diff --git a/.gitattributes b/.gitattributes index bed0738c7eeb449bca98b5d2f33c89a1ee56349a..86ad3948ee6acd901cf6729c2ce296dcaba95379 100644 --- a/.gitattributes +++ b/.gitattributes @@ -58,3 +58,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text # Video files - compressed *.mp4 filter=lfs diff=lfs merge=lfs -text *.webm filter=lfs diff=lfs merge=lfs -text +python_splits/train_verified.jsonl filter=lfs diff=lfs merge=lfs -text +python_splits/train_verified_with_cfg_weights.jsonl filter=lfs diff=lfs merge=lfs -text +python_splits/train_verified_with_weights.jsonl filter=lfs diff=lfs merge=lfs -text +sven_bigvul_sft_all_1_1024_train.json filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4b0ea1fdf3eda43bb42e9c3e5d1fccea49a541b2 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# `data/` — Datasets and indices + +Data for **Python code generation / repair**: HumanEval-style `jsonl`, length-bucketed subsets, SVEN-related json/jsonl, and optional **torch-preprocessed** caches. Often large and **gitignored**; fetch or generate separately. + +## Top-level files (examples) + +| Path | Description | +|------|-------------| +| `sven_rl_train.jsonl`, `sven_rl_val.jsonl` | Merged SVEN RL lists (combine with `sven_rl_buckets/` when using buckets) | +| `sven_bigvul_sft_all_1_1024_{train,val}.json` | Big-Vul subset SFT splits | + +## Subdirectories + +| Path | Description | +|------|-------------| +| [`python_splits/`](python_splits/README.md) | Train/val/test `jsonl`, weighted variants, **target-token buckets** | +| [`preprocessed/`](preprocessed/README.md) | `train.pt` / `val.pt` / `meta.json` tokenized caches | +| [`sven_rl_buckets/`](sven_rl_buckets/README.md) | **Length-bucketed** `jsonl` for RL (`train/`, `val/`) | +| [`codenet/`](codenet/README.md) | CodeNet **public test cases** and related files | + +## Preparation tips + +- **Buckets**: Keep `scripts/classify_target_tokens_dream.py` consistent with `python_splits/test_verified.target_bucket_subsets/`. +- **SVEN RL**: Prefer `scripts/convert_sven_to_dream_jsonl.py` to populate `sven_rl_buckets/`. diff --git a/codenet/README.md b/codenet/README.md new file mode 100644 index 0000000000000000000000000000000000000000..85d3ffe1b18377b87de46aa466e88beaf74cc45d --- /dev/null +++ b/codenet/README.md @@ -0,0 +1,11 @@ +# `data/codenet/` — CodeNet assets + +Local files for **CodeNet**-aligned data or evaluation (if downloaded). + +## Typical contents + +| Path | Description | +|------|-------------| +| `public_test_cases/` | **Public tests** (inputs/outputs) for many problems, for local execution and judging | + +The repo does not require the full CodeNet drop. If the folder is empty, fetch data before running CodeNet-dependent scripts. Layout and filenames follow the official CodeNet release. diff --git a/codenet/public_test_cases/p00000/input.1.txt b/codenet/public_test_cases/p00000/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p00000/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p00000/output.1.txt b/codenet/public_test_cases/p00000/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p00000/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p00001/input.0.txt b/codenet/public_test_cases/p00001/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d13274734f497ddf366272e9192c328a514ed83 --- /dev/null +++ b/codenet/public_test_cases/p00001/input.0.txt @@ -0,0 +1,10 @@ +1819 +2003 +876 +2840 +1723 +1673 +3776 +2848 +1592 +922 diff --git a/codenet/public_test_cases/p00001/input.1.txt b/codenet/public_test_cases/p00001/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d13274734f497ddf366272e9192c328a514ed83 --- /dev/null +++ b/codenet/public_test_cases/p00001/input.1.txt @@ -0,0 +1,10 @@ +1819 +2003 +876 +2840 +1723 +1673 +3776 +2848 +1592 +922 diff --git a/codenet/public_test_cases/p00001/input.2.txt b/codenet/public_test_cases/p00001/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..08caf1becb2a79dd970ffc3a995cb4c9f3dfaf60 --- /dev/null +++ b/codenet/public_test_cases/p00001/input.2.txt @@ -0,0 +1,10 @@ +100 +200 +300 +400 +500 +600 +700 +800 +900 +900 diff --git a/codenet/public_test_cases/p00001/output.0.txt b/codenet/public_test_cases/p00001/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..674119f611c6cf0c2ce825731300023308cad8ad --- /dev/null +++ b/codenet/public_test_cases/p00001/output.0.txt @@ -0,0 +1,3 @@ +3776 +2848 +2840 diff --git a/codenet/public_test_cases/p00001/output.1.txt b/codenet/public_test_cases/p00001/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..674119f611c6cf0c2ce825731300023308cad8ad --- /dev/null +++ b/codenet/public_test_cases/p00001/output.1.txt @@ -0,0 +1,3 @@ +3776 +2848 +2840 diff --git a/codenet/public_test_cases/p00001/output.2.txt b/codenet/public_test_cases/p00001/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..05ea39d07fb07012093238c8f7df63ed9455c32b --- /dev/null +++ b/codenet/public_test_cases/p00001/output.2.txt @@ -0,0 +1,3 @@ +900 +900 +800 diff --git a/codenet/public_test_cases/p00002/input.0.txt b/codenet/public_test_cases/p00002/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..15d9da739e783571bb32eb7ed4d0d6fb1a403291 --- /dev/null +++ b/codenet/public_test_cases/p00002/input.0.txt @@ -0,0 +1,3 @@ +5 7 +1 99 +1000 999 diff --git a/codenet/public_test_cases/p00002/input.1.txt b/codenet/public_test_cases/p00002/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..15d9da739e783571bb32eb7ed4d0d6fb1a403291 --- /dev/null +++ b/codenet/public_test_cases/p00002/input.1.txt @@ -0,0 +1,3 @@ +5 7 +1 99 +1000 999 diff --git a/codenet/public_test_cases/p00002/output.0.txt b/codenet/public_test_cases/p00002/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcf37cd5e26203dc0a9570d26b7a5074049d4c9c --- /dev/null +++ b/codenet/public_test_cases/p00002/output.0.txt @@ -0,0 +1,3 @@ +2 +3 +4 diff --git a/codenet/public_test_cases/p00002/output.1.txt b/codenet/public_test_cases/p00002/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcf37cd5e26203dc0a9570d26b7a5074049d4c9c --- /dev/null +++ b/codenet/public_test_cases/p00002/output.1.txt @@ -0,0 +1,3 @@ +2 +3 +4 diff --git a/codenet/public_test_cases/p00003/input.0.txt b/codenet/public_test_cases/p00003/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff5474d259bcb37ae70c54a27e80a1255f516ab5 --- /dev/null +++ b/codenet/public_test_cases/p00003/input.0.txt @@ -0,0 +1,4 @@ +3 +4 3 5 +4 3 6 +8 8 8 diff --git a/codenet/public_test_cases/p00003/input.1.txt b/codenet/public_test_cases/p00003/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff5474d259bcb37ae70c54a27e80a1255f516ab5 --- /dev/null +++ b/codenet/public_test_cases/p00003/input.1.txt @@ -0,0 +1,4 @@ +3 +4 3 5 +4 3 6 +8 8 8 diff --git a/codenet/public_test_cases/p00003/output.0.txt b/codenet/public_test_cases/p00003/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6e03a3424cbc9fd3c1c5139fbef28b53ec422af --- /dev/null +++ b/codenet/public_test_cases/p00003/output.0.txt @@ -0,0 +1,3 @@ +YES +NO +NO diff --git a/codenet/public_test_cases/p00003/output.1.txt b/codenet/public_test_cases/p00003/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6e03a3424cbc9fd3c1c5139fbef28b53ec422af --- /dev/null +++ b/codenet/public_test_cases/p00003/output.1.txt @@ -0,0 +1,3 @@ +YES +NO +NO diff --git a/codenet/public_test_cases/p00004/input.0.txt b/codenet/public_test_cases/p00004/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b6a727d933380e9bc9d5bf4c4369dcca8190e3 --- /dev/null +++ b/codenet/public_test_cases/p00004/input.0.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +2 -1 -2 -1 -1 -5 diff --git a/codenet/public_test_cases/p00004/input.1.txt b/codenet/public_test_cases/p00004/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b6a727d933380e9bc9d5bf4c4369dcca8190e3 --- /dev/null +++ b/codenet/public_test_cases/p00004/input.1.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +2 -1 -2 -1 -1 -5 diff --git a/codenet/public_test_cases/p00004/input.2.txt b/codenet/public_test_cases/p00004/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e17ad1ab10e4da831935992d44bd72f90bee974a --- /dev/null +++ b/codenet/public_test_cases/p00004/input.2.txt @@ -0,0 +1,2 @@ +2 -1 -3 1 -1 -3 +2 -1 -3 -9 9 27 diff --git a/codenet/public_test_cases/p00004/output.0.txt b/codenet/public_test_cases/p00004/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..06fc1eecdf2d532cb4a6867902fc85333b6f4d53 --- /dev/null +++ b/codenet/public_test_cases/p00004/output.0.txt @@ -0,0 +1,2 @@ +-1.000 2.000 +1.000 4.000 diff --git a/codenet/public_test_cases/p00004/output.1.txt b/codenet/public_test_cases/p00004/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..06fc1eecdf2d532cb4a6867902fc85333b6f4d53 --- /dev/null +++ b/codenet/public_test_cases/p00004/output.1.txt @@ -0,0 +1,2 @@ +-1.000 2.000 +1.000 4.000 diff --git a/codenet/public_test_cases/p00004/output.2.txt b/codenet/public_test_cases/p00004/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c9666759d4ea443c860dd524083c75c251d6b29 --- /dev/null +++ b/codenet/public_test_cases/p00004/output.2.txt @@ -0,0 +1,2 @@ +0.000 3.000 +0.000 3.000 diff --git a/codenet/public_test_cases/p00005/input.0.txt b/codenet/public_test_cases/p00005/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f015a2360df285c8508d501daa7e1266eca4491d --- /dev/null +++ b/codenet/public_test_cases/p00005/input.0.txt @@ -0,0 +1,2 @@ +8 6 +50000000 30000000 diff --git a/codenet/public_test_cases/p00005/input.1.txt b/codenet/public_test_cases/p00005/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f015a2360df285c8508d501daa7e1266eca4491d --- /dev/null +++ b/codenet/public_test_cases/p00005/input.1.txt @@ -0,0 +1,2 @@ +8 6 +50000000 30000000 diff --git a/codenet/public_test_cases/p00005/output.0.txt b/codenet/public_test_cases/p00005/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..815b96d3c3583a03cdb7e3502bd08c4482353fe0 --- /dev/null +++ b/codenet/public_test_cases/p00005/output.0.txt @@ -0,0 +1,2 @@ +2 24 +10000000 150000000 diff --git a/codenet/public_test_cases/p00005/output.1.txt b/codenet/public_test_cases/p00005/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..815b96d3c3583a03cdb7e3502bd08c4482353fe0 --- /dev/null +++ b/codenet/public_test_cases/p00005/output.1.txt @@ -0,0 +1,2 @@ +2 24 +10000000 150000000 diff --git a/codenet/public_test_cases/p00006/input.0.txt b/codenet/public_test_cases/p00006/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b600185ad57851dd1b656fd1aa68309230d35bca --- /dev/null +++ b/codenet/public_test_cases/p00006/input.0.txt @@ -0,0 +1 @@ +w32nimda diff --git a/codenet/public_test_cases/p00006/input.1.txt b/codenet/public_test_cases/p00006/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b600185ad57851dd1b656fd1aa68309230d35bca --- /dev/null +++ b/codenet/public_test_cases/p00006/input.1.txt @@ -0,0 +1 @@ +w32nimda diff --git a/codenet/public_test_cases/p00006/output.0.txt b/codenet/public_test_cases/p00006/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e7c11615b9340589860b710f0d3066659dcbf7f --- /dev/null +++ b/codenet/public_test_cases/p00006/output.0.txt @@ -0,0 +1 @@ +admin23w diff --git a/codenet/public_test_cases/p00006/output.1.txt b/codenet/public_test_cases/p00006/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e7c11615b9340589860b710f0d3066659dcbf7f --- /dev/null +++ b/codenet/public_test_cases/p00006/output.1.txt @@ -0,0 +1 @@ +admin23w diff --git a/codenet/public_test_cases/p00007/input.0.txt b/codenet/public_test_cases/p00007/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00007/input.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00007/input.1.txt b/codenet/public_test_cases/p00007/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00007/input.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00007/output.0.txt b/codenet/public_test_cases/p00007/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b2439819af887fad5492bec31144d43b1d1088d --- /dev/null +++ b/codenet/public_test_cases/p00007/output.0.txt @@ -0,0 +1 @@ +130000 diff --git a/codenet/public_test_cases/p00007/output.1.txt b/codenet/public_test_cases/p00007/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b2439819af887fad5492bec31144d43b1d1088d --- /dev/null +++ b/codenet/public_test_cases/p00007/output.1.txt @@ -0,0 +1 @@ +130000 diff --git a/codenet/public_test_cases/p00008/input.0.txt b/codenet/public_test_cases/p00008/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cd6874aa3c141fdd3989a0a7b1874cb35b184ee --- /dev/null +++ b/codenet/public_test_cases/p00008/input.0.txt @@ -0,0 +1,2 @@ +35 +1 diff --git a/codenet/public_test_cases/p00008/input.1.txt b/codenet/public_test_cases/p00008/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cd6874aa3c141fdd3989a0a7b1874cb35b184ee --- /dev/null +++ b/codenet/public_test_cases/p00008/input.1.txt @@ -0,0 +1,2 @@ +35 +1 diff --git a/codenet/public_test_cases/p00008/output.0.txt b/codenet/public_test_cases/p00008/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7290ba859f4adbf90d68526fe0ab1f8cbcf65098 --- /dev/null +++ b/codenet/public_test_cases/p00008/output.0.txt @@ -0,0 +1,2 @@ +4 +4 diff --git a/codenet/public_test_cases/p00008/output.1.txt b/codenet/public_test_cases/p00008/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7290ba859f4adbf90d68526fe0ab1f8cbcf65098 --- /dev/null +++ b/codenet/public_test_cases/p00008/output.1.txt @@ -0,0 +1,2 @@ +4 +4 diff --git a/codenet/public_test_cases/p00009/input.0.txt b/codenet/public_test_cases/p00009/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de3d8a94b8ae700abb2f6bfafaee2a499733f73f --- /dev/null +++ b/codenet/public_test_cases/p00009/input.0.txt @@ -0,0 +1,3 @@ +10 +3 +11 diff --git a/codenet/public_test_cases/p00009/input.1.txt b/codenet/public_test_cases/p00009/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de3d8a94b8ae700abb2f6bfafaee2a499733f73f --- /dev/null +++ b/codenet/public_test_cases/p00009/input.1.txt @@ -0,0 +1,3 @@ +10 +3 +11 diff --git a/codenet/public_test_cases/p00009/output.0.txt b/codenet/public_test_cases/p00009/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9e2036d6ff3461493e65010b4ed07ccbfd8d9ec --- /dev/null +++ b/codenet/public_test_cases/p00009/output.0.txt @@ -0,0 +1,3 @@ +4 +2 +5 diff --git a/codenet/public_test_cases/p00009/output.1.txt b/codenet/public_test_cases/p00009/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9e2036d6ff3461493e65010b4ed07ccbfd8d9ec --- /dev/null +++ b/codenet/public_test_cases/p00009/output.1.txt @@ -0,0 +1,3 @@ +4 +2 +5 diff --git a/codenet/public_test_cases/p00010/input.0.txt b/codenet/public_test_cases/p00010/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0a64ec6edd99f87a574100f4590755c1e15e213 --- /dev/null +++ b/codenet/public_test_cases/p00010/input.0.txt @@ -0,0 +1,2 @@ +1 +0.0 0.0 2.0 0.0 2.0 2.0 diff --git a/codenet/public_test_cases/p00010/input.1.txt b/codenet/public_test_cases/p00010/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0a64ec6edd99f87a574100f4590755c1e15e213 --- /dev/null +++ b/codenet/public_test_cases/p00010/input.1.txt @@ -0,0 +1,2 @@ +1 +0.0 0.0 2.0 0.0 2.0 2.0 diff --git a/codenet/public_test_cases/p00010/output.0.txt b/codenet/public_test_cases/p00010/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d45248750b925747e48eee329a6b72c6c94320c1 --- /dev/null +++ b/codenet/public_test_cases/p00010/output.0.txt @@ -0,0 +1 @@ +1.000 1.000 1.414 diff --git a/codenet/public_test_cases/p00010/output.1.txt b/codenet/public_test_cases/p00010/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d45248750b925747e48eee329a6b72c6c94320c1 --- /dev/null +++ b/codenet/public_test_cases/p00010/output.1.txt @@ -0,0 +1 @@ +1.000 1.000 1.414 diff --git a/codenet/public_test_cases/p00011/input.0.txt b/codenet/public_test_cases/p00011/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..490d2318d7c61ad817a08da5e88ca79627f63117 --- /dev/null +++ b/codenet/public_test_cases/p00011/input.0.txt @@ -0,0 +1,6 @@ +5 +4 +2,4 +3,5 +1,2 +3,4 diff --git a/codenet/public_test_cases/p00011/input.1.txt b/codenet/public_test_cases/p00011/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..490d2318d7c61ad817a08da5e88ca79627f63117 --- /dev/null +++ b/codenet/public_test_cases/p00011/input.1.txt @@ -0,0 +1,6 @@ +5 +4 +2,4 +3,5 +1,2 +3,4 diff --git a/codenet/public_test_cases/p00011/output.0.txt b/codenet/public_test_cases/p00011/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea5464ab656e98652762dd44ec64ad1959376842 --- /dev/null +++ b/codenet/public_test_cases/p00011/output.0.txt @@ -0,0 +1,5 @@ +4 +1 +2 +5 +3 diff --git a/codenet/public_test_cases/p00011/output.1.txt b/codenet/public_test_cases/p00011/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea5464ab656e98652762dd44ec64ad1959376842 --- /dev/null +++ b/codenet/public_test_cases/p00011/output.1.txt @@ -0,0 +1,5 @@ +4 +1 +2 +5 +3 diff --git a/codenet/public_test_cases/p00012/input.0.txt b/codenet/public_test_cases/p00012/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48781eb99fbbbd50924b2b10a8f7f67d4a97f9d1 --- /dev/null +++ b/codenet/public_test_cases/p00012/input.0.txt @@ -0,0 +1,2 @@ +0.0 0.0 2.0 0.0 2.0 2.0 1.5 0.5 +0.0 0.0 1.0 4.0 5.0 3.0 -1.0 3.0 diff --git a/codenet/public_test_cases/p00012/input.1.txt b/codenet/public_test_cases/p00012/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48781eb99fbbbd50924b2b10a8f7f67d4a97f9d1 --- /dev/null +++ b/codenet/public_test_cases/p00012/input.1.txt @@ -0,0 +1,2 @@ +0.0 0.0 2.0 0.0 2.0 2.0 1.5 0.5 +0.0 0.0 1.0 4.0 5.0 3.0 -1.0 3.0 diff --git a/codenet/public_test_cases/p00012/output.0.txt b/codenet/public_test_cases/p00012/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p00012/output.0.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p00012/output.1.txt b/codenet/public_test_cases/p00012/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p00012/output.1.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p00013/input.0.txt b/codenet/public_test_cases/p00013/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..019d7595eb12b5b437296cd113759660ae412d5a --- /dev/null +++ b/codenet/public_test_cases/p00013/input.0.txt @@ -0,0 +1,8 @@ +1 +6 +0 +8 +10 +0 +0 +0 diff --git a/codenet/public_test_cases/p00013/input.1.txt b/codenet/public_test_cases/p00013/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..019d7595eb12b5b437296cd113759660ae412d5a --- /dev/null +++ b/codenet/public_test_cases/p00013/input.1.txt @@ -0,0 +1,8 @@ +1 +6 +0 +8 +10 +0 +0 +0 diff --git a/codenet/public_test_cases/p00013/output.0.txt b/codenet/public_test_cases/p00013/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14bec04b36d2a9877b2edf9167d8997ecd4b40cc --- /dev/null +++ b/codenet/public_test_cases/p00013/output.0.txt @@ -0,0 +1,4 @@ +6 +10 +8 +1 diff --git a/codenet/public_test_cases/p00013/output.1.txt b/codenet/public_test_cases/p00013/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14bec04b36d2a9877b2edf9167d8997ecd4b40cc --- /dev/null +++ b/codenet/public_test_cases/p00013/output.1.txt @@ -0,0 +1,4 @@ +6 +10 +8 +1 diff --git a/codenet/public_test_cases/p00014/input.0.txt b/codenet/public_test_cases/p00014/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f3696793326ded3bfa2a54eb4f0da8e1da9c425 --- /dev/null +++ b/codenet/public_test_cases/p00014/input.0.txt @@ -0,0 +1,2 @@ +20 +10 diff --git a/codenet/public_test_cases/p00014/input.1.txt b/codenet/public_test_cases/p00014/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f3696793326ded3bfa2a54eb4f0da8e1da9c425 --- /dev/null +++ b/codenet/public_test_cases/p00014/input.1.txt @@ -0,0 +1,2 @@ +20 +10 diff --git a/codenet/public_test_cases/p00014/output.0.txt b/codenet/public_test_cases/p00014/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8fb512f814c321d3ef124d0db31bb39b99f5b3c --- /dev/null +++ b/codenet/public_test_cases/p00014/output.0.txt @@ -0,0 +1,2 @@ +68440000 +70210000 diff --git a/codenet/public_test_cases/p00014/output.1.txt b/codenet/public_test_cases/p00014/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8fb512f814c321d3ef124d0db31bb39b99f5b3c --- /dev/null +++ b/codenet/public_test_cases/p00014/output.1.txt @@ -0,0 +1,2 @@ +68440000 +70210000 diff --git a/codenet/public_test_cases/p00015/input.0.txt b/codenet/public_test_cases/p00015/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cb1e80b15cf94b28d9d859cecf94e69a8fc59a5 --- /dev/null +++ b/codenet/public_test_cases/p00015/input.0.txt @@ -0,0 +1,13 @@ +6 +1000 +800 +9999999999999999999999999999999999999999 +1 +99999999999999999999999999999999999999999999999999999999999999999999999999999999 +1 +99999999999999999999999999999999999999999999999999999999999999999999999999999999 +0 +100000000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +100000000000000000000000000000000000000000000000000000000000000000000000000000000 +100000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/codenet/public_test_cases/p00015/input.1.txt b/codenet/public_test_cases/p00015/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cb1e80b15cf94b28d9d859cecf94e69a8fc59a5 --- /dev/null +++ b/codenet/public_test_cases/p00015/input.1.txt @@ -0,0 +1,13 @@ +6 +1000 +800 +9999999999999999999999999999999999999999 +1 +99999999999999999999999999999999999999999999999999999999999999999999999999999999 +1 +99999999999999999999999999999999999999999999999999999999999999999999999999999999 +0 +100000000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +100000000000000000000000000000000000000000000000000000000000000000000000000000000 +100000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/codenet/public_test_cases/p00015/output.0.txt b/codenet/public_test_cases/p00015/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91cdb8c012779aebc34617fc06f5d61b24a32034 --- /dev/null +++ b/codenet/public_test_cases/p00015/output.0.txt @@ -0,0 +1,6 @@ +1800 +10000000000000000000000000000000000000000 +overflow +99999999999999999999999999999999999999999999999999999999999999999999999999999999 +overflow +overflow diff --git a/codenet/public_test_cases/p00015/output.1.txt b/codenet/public_test_cases/p00015/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91cdb8c012779aebc34617fc06f5d61b24a32034 --- /dev/null +++ b/codenet/public_test_cases/p00015/output.1.txt @@ -0,0 +1,6 @@ +1800 +10000000000000000000000000000000000000000 +overflow +99999999999999999999999999999999999999999999999999999999999999999999999999999999 +overflow +overflow diff --git a/codenet/public_test_cases/p00016/input.0.txt b/codenet/public_test_cases/p00016/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9a1a6af1ef37e981cc4e385934602de5204b681 --- /dev/null +++ b/codenet/public_test_cases/p00016/input.0.txt @@ -0,0 +1,11 @@ +56,65 +97,54 +64,-4 +55,76 +42,-27 +43,80 +87,-86 +55,-6 +89,34 +95,5 +0,0 diff --git a/codenet/public_test_cases/p00016/input.1.txt b/codenet/public_test_cases/p00016/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9a1a6af1ef37e981cc4e385934602de5204b681 --- /dev/null +++ b/codenet/public_test_cases/p00016/input.1.txt @@ -0,0 +1,11 @@ +56,65 +97,54 +64,-4 +55,76 +42,-27 +43,80 +87,-86 +55,-6 +89,34 +95,5 +0,0 diff --git a/codenet/public_test_cases/p00016/output.0.txt b/codenet/public_test_cases/p00016/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05d9f37c4e709956b8caea99c6779823c9a67547 --- /dev/null +++ b/codenet/public_test_cases/p00016/output.0.txt @@ -0,0 +1,2 @@ +171 +-302 diff --git a/codenet/public_test_cases/p00016/output.1.txt b/codenet/public_test_cases/p00016/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05d9f37c4e709956b8caea99c6779823c9a67547 --- /dev/null +++ b/codenet/public_test_cases/p00016/output.1.txt @@ -0,0 +1,2 @@ +171 +-302 diff --git a/codenet/public_test_cases/p00017/input.0.txt b/codenet/public_test_cases/p00017/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..44ac7e291f9aca8b0db1345acd000a9ac4628f53 --- /dev/null +++ b/codenet/public_test_cases/p00017/input.0.txt @@ -0,0 +1 @@ +xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt. diff --git a/codenet/public_test_cases/p00017/input.1.txt b/codenet/public_test_cases/p00017/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..44ac7e291f9aca8b0db1345acd000a9ac4628f53 --- /dev/null +++ b/codenet/public_test_cases/p00017/input.1.txt @@ -0,0 +1 @@ +xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt. diff --git a/codenet/public_test_cases/p00017/output.0.txt b/codenet/public_test_cases/p00017/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d8c8f7b93a014012011bc80faa0e09859fb1571 --- /dev/null +++ b/codenet/public_test_cases/p00017/output.0.txt @@ -0,0 +1 @@ +this is the picture that i took in the trip. diff --git a/codenet/public_test_cases/p00017/output.1.txt b/codenet/public_test_cases/p00017/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d8c8f7b93a014012011bc80faa0e09859fb1571 --- /dev/null +++ b/codenet/public_test_cases/p00017/output.1.txt @@ -0,0 +1 @@ +this is the picture that i took in the trip. diff --git a/codenet/public_test_cases/p00018/input.0.txt b/codenet/public_test_cases/p00018/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d16e9007f405f24c59f0d5221cedb9daf704798 --- /dev/null +++ b/codenet/public_test_cases/p00018/input.0.txt @@ -0,0 +1 @@ +3 6 9 7 5 diff --git a/codenet/public_test_cases/p00018/output.0.txt b/codenet/public_test_cases/p00018/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1b762f9329ab1a969dbf1ed84a502f69863eddc --- /dev/null +++ b/codenet/public_test_cases/p00018/output.0.txt @@ -0,0 +1 @@ +9 7 6 5 3 diff --git a/codenet/public_test_cases/p00019/input.0.txt b/codenet/public_test_cases/p00019/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00019/input.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00019/input.1.txt b/codenet/public_test_cases/p00019/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00019/input.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00019/output.0.txt b/codenet/public_test_cases/p00019/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52bd8e43afb01d0c9747f1fedf2fc94684ee4cc4 --- /dev/null +++ b/codenet/public_test_cases/p00019/output.0.txt @@ -0,0 +1 @@ +120 diff --git a/codenet/public_test_cases/p00019/output.1.txt b/codenet/public_test_cases/p00019/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..52bd8e43afb01d0c9747f1fedf2fc94684ee4cc4 --- /dev/null +++ b/codenet/public_test_cases/p00019/output.1.txt @@ -0,0 +1 @@ +120 diff --git a/codenet/public_test_cases/p00020/input.0.txt b/codenet/public_test_cases/p00020/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..702f2db905e4ea759ee8d1486d3276aa663fdc66 --- /dev/null +++ b/codenet/public_test_cases/p00020/input.0.txt @@ -0,0 +1 @@ +this is a pen. diff --git a/codenet/public_test_cases/p00020/input.1.txt b/codenet/public_test_cases/p00020/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..702f2db905e4ea759ee8d1486d3276aa663fdc66 --- /dev/null +++ b/codenet/public_test_cases/p00020/input.1.txt @@ -0,0 +1 @@ +this is a pen. diff --git a/codenet/public_test_cases/p00020/output.0.txt b/codenet/public_test_cases/p00020/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7bf1cfd85705111858132f2c51ca6c0d44170be --- /dev/null +++ b/codenet/public_test_cases/p00020/output.0.txt @@ -0,0 +1 @@ +THIS IS A PEN. diff --git a/codenet/public_test_cases/p00020/output.1.txt b/codenet/public_test_cases/p00020/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7bf1cfd85705111858132f2c51ca6c0d44170be --- /dev/null +++ b/codenet/public_test_cases/p00020/output.1.txt @@ -0,0 +1 @@ +THIS IS A PEN. diff --git a/codenet/public_test_cases/p00021/input.0.txt b/codenet/public_test_cases/p00021/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0dc18f4f4c2ef0d7c1d9eb974c41f06a73dcd7ce --- /dev/null +++ b/codenet/public_test_cases/p00021/input.0.txt @@ -0,0 +1,3 @@ +2 +0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 +3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 diff --git a/codenet/public_test_cases/p00021/input.1.txt b/codenet/public_test_cases/p00021/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0dc18f4f4c2ef0d7c1d9eb974c41f06a73dcd7ce --- /dev/null +++ b/codenet/public_test_cases/p00021/input.1.txt @@ -0,0 +1,3 @@ +2 +0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 +3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 diff --git a/codenet/public_test_cases/p00021/output.0.txt b/codenet/public_test_cases/p00021/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p00021/output.0.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p00021/output.1.txt b/codenet/public_test_cases/p00021/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p00021/output.1.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p00022/input.0.txt b/codenet/public_test_cases/p00022/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4dfd27d5cee5cd9f23aa751134204d673dd8829 --- /dev/null +++ b/codenet/public_test_cases/p00022/input.0.txt @@ -0,0 +1,27 @@ +7 +-5 +-1 +6 +4 +9 +-6 +-7 +13 +1 +2 +3 +2 +-2 +-1 +1 +2 +3 +2 +1 +-2 +1 +3 +1000 +-200 +201 +0 diff --git a/codenet/public_test_cases/p00022/input.1.txt b/codenet/public_test_cases/p00022/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4dfd27d5cee5cd9f23aa751134204d673dd8829 --- /dev/null +++ b/codenet/public_test_cases/p00022/input.1.txt @@ -0,0 +1,27 @@ +7 +-5 +-1 +6 +4 +9 +-6 +-7 +13 +1 +2 +3 +2 +-2 +-1 +1 +2 +3 +2 +1 +-2 +1 +3 +1000 +-200 +201 +0 diff --git a/codenet/public_test_cases/p00022/output.0.txt b/codenet/public_test_cases/p00022/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b087a6fbc9f578ddcb343133e382c79c6cb0c3b --- /dev/null +++ b/codenet/public_test_cases/p00022/output.0.txt @@ -0,0 +1,3 @@ +19 +14 +1001 diff --git a/codenet/public_test_cases/p00022/output.1.txt b/codenet/public_test_cases/p00022/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b087a6fbc9f578ddcb343133e382c79c6cb0c3b --- /dev/null +++ b/codenet/public_test_cases/p00022/output.1.txt @@ -0,0 +1,3 @@ +19 +14 +1001 diff --git a/codenet/public_test_cases/p00023/input.0.txt b/codenet/public_test_cases/p00023/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d09cafbfc6e89ed0285d02553d31f6a24dae6c5 --- /dev/null +++ b/codenet/public_test_cases/p00023/input.0.txt @@ -0,0 +1,3 @@ +2 +0.0 0.0 5.0 0.0 0.0 4.0 +0.0 0.0 2.0 4.1 0.0 2.0 diff --git a/codenet/public_test_cases/p00023/input.1.txt b/codenet/public_test_cases/p00023/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d09cafbfc6e89ed0285d02553d31f6a24dae6c5 --- /dev/null +++ b/codenet/public_test_cases/p00023/input.1.txt @@ -0,0 +1,3 @@ +2 +0.0 0.0 5.0 0.0 0.0 4.0 +0.0 0.0 2.0 4.1 0.0 2.0 diff --git a/codenet/public_test_cases/p00023/output.0.txt b/codenet/public_test_cases/p00023/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..389e2621455b5b9129a49a4006e658565a970912 --- /dev/null +++ b/codenet/public_test_cases/p00023/output.0.txt @@ -0,0 +1,2 @@ +2 +0 diff --git a/codenet/public_test_cases/p00023/output.1.txt b/codenet/public_test_cases/p00023/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..389e2621455b5b9129a49a4006e658565a970912 --- /dev/null +++ b/codenet/public_test_cases/p00023/output.1.txt @@ -0,0 +1,2 @@ +2 +0 diff --git a/codenet/public_test_cases/p00024/input.0.txt b/codenet/public_test_cases/p00024/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..634e1e667134952e830bb70ee435cb46312b5418 --- /dev/null +++ b/codenet/public_test_cases/p00024/input.0.txt @@ -0,0 +1,2 @@ +25.4 +25.4 diff --git a/codenet/public_test_cases/p00024/input.1.txt b/codenet/public_test_cases/p00024/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..634e1e667134952e830bb70ee435cb46312b5418 --- /dev/null +++ b/codenet/public_test_cases/p00024/input.1.txt @@ -0,0 +1,2 @@ +25.4 +25.4 diff --git a/codenet/public_test_cases/p00024/output.0.txt b/codenet/public_test_cases/p00024/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..226aaf8af79f3f0bd0ba7766db38233fb0406a58 --- /dev/null +++ b/codenet/public_test_cases/p00024/output.0.txt @@ -0,0 +1,2 @@ +8 +8 diff --git a/codenet/public_test_cases/p00024/output.1.txt b/codenet/public_test_cases/p00024/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..226aaf8af79f3f0bd0ba7766db38233fb0406a58 --- /dev/null +++ b/codenet/public_test_cases/p00024/output.1.txt @@ -0,0 +1,2 @@ +8 +8 diff --git a/codenet/public_test_cases/p00025/input.0.txt b/codenet/public_test_cases/p00025/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e82357b71280fa170385a078648c6e308e66236a --- /dev/null +++ b/codenet/public_test_cases/p00025/input.0.txt @@ -0,0 +1,4 @@ +9 1 8 2 +4 1 5 9 +4 6 8 2 +4 6 3 2 diff --git a/codenet/public_test_cases/p00025/input.1.txt b/codenet/public_test_cases/p00025/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e82357b71280fa170385a078648c6e308e66236a --- /dev/null +++ b/codenet/public_test_cases/p00025/input.1.txt @@ -0,0 +1,4 @@ +9 1 8 2 +4 1 5 9 +4 6 8 2 +4 6 3 2 diff --git a/codenet/public_test_cases/p00025/output.0.txt b/codenet/public_test_cases/p00025/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..585ee4432051ed4510353666ba6f8784efa699c0 --- /dev/null +++ b/codenet/public_test_cases/p00025/output.0.txt @@ -0,0 +1,2 @@ +1 1 +3 0 diff --git a/codenet/public_test_cases/p00025/output.1.txt b/codenet/public_test_cases/p00025/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..585ee4432051ed4510353666ba6f8784efa699c0 --- /dev/null +++ b/codenet/public_test_cases/p00025/output.1.txt @@ -0,0 +1,2 @@ +1 1 +3 0 diff --git a/codenet/public_test_cases/p00026/input.0.txt b/codenet/public_test_cases/p00026/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0534165a958f7c18bd7f6b956dfaa22061fbb419 --- /dev/null +++ b/codenet/public_test_cases/p00026/input.0.txt @@ -0,0 +1,6 @@ +2,5,3 +3,6,1 +3,4,2 +4,5,2 +3,6,3 +2,4,1 diff --git a/codenet/public_test_cases/p00026/input.1.txt b/codenet/public_test_cases/p00026/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0534165a958f7c18bd7f6b956dfaa22061fbb419 --- /dev/null +++ b/codenet/public_test_cases/p00026/input.1.txt @@ -0,0 +1,6 @@ +2,5,3 +3,6,1 +3,4,2 +4,5,2 +3,6,3 +2,4,1 diff --git a/codenet/public_test_cases/p00026/output.0.txt b/codenet/public_test_cases/p00026/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e35ba7eed0e2e48204864f8ae76134963fd45093 --- /dev/null +++ b/codenet/public_test_cases/p00026/output.0.txt @@ -0,0 +1,2 @@ +77 +5 diff --git a/codenet/public_test_cases/p00026/output.1.txt b/codenet/public_test_cases/p00026/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e35ba7eed0e2e48204864f8ae76134963fd45093 --- /dev/null +++ b/codenet/public_test_cases/p00026/output.1.txt @@ -0,0 +1,2 @@ +77 +5 diff --git a/codenet/public_test_cases/p00027/input.0.txt b/codenet/public_test_cases/p00027/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc64ea5aaa6ebab939da1ba72387b678b512e4f --- /dev/null +++ b/codenet/public_test_cases/p00027/input.0.txt @@ -0,0 +1,3 @@ +1 1 +2 29 +0 0 diff --git a/codenet/public_test_cases/p00027/input.1.txt b/codenet/public_test_cases/p00027/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc64ea5aaa6ebab939da1ba72387b678b512e4f --- /dev/null +++ b/codenet/public_test_cases/p00027/input.1.txt @@ -0,0 +1,3 @@ +1 1 +2 29 +0 0 diff --git a/codenet/public_test_cases/p00027/output.0.txt b/codenet/public_test_cases/p00027/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9535a288626db3cde7b02d765afa90f17b81a1e5 --- /dev/null +++ b/codenet/public_test_cases/p00027/output.0.txt @@ -0,0 +1,2 @@ +Thursday +Sunday diff --git a/codenet/public_test_cases/p00027/output.1.txt b/codenet/public_test_cases/p00027/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9535a288626db3cde7b02d765afa90f17b81a1e5 --- /dev/null +++ b/codenet/public_test_cases/p00027/output.1.txt @@ -0,0 +1,2 @@ +Thursday +Sunday diff --git a/codenet/public_test_cases/p00028/input.0.txt b/codenet/public_test_cases/p00028/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a84c7e7121f6041f957cec995f555a6b1420f3d --- /dev/null +++ b/codenet/public_test_cases/p00028/input.0.txt @@ -0,0 +1,12 @@ +5 +6 +3 +5 +8 +7 +5 +3 +9 +7 +3 +4 diff --git a/codenet/public_test_cases/p00028/input.1.txt b/codenet/public_test_cases/p00028/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a84c7e7121f6041f957cec995f555a6b1420f3d --- /dev/null +++ b/codenet/public_test_cases/p00028/input.1.txt @@ -0,0 +1,12 @@ +5 +6 +3 +5 +8 +7 +5 +3 +9 +7 +3 +4 diff --git a/codenet/public_test_cases/p00028/output.0.txt b/codenet/public_test_cases/p00028/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ee0007bf1f1aaeab67e3ea1c9ae21003171a460 --- /dev/null +++ b/codenet/public_test_cases/p00028/output.0.txt @@ -0,0 +1,2 @@ +3 +5 diff --git a/codenet/public_test_cases/p00028/output.1.txt b/codenet/public_test_cases/p00028/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ee0007bf1f1aaeab67e3ea1c9ae21003171a460 --- /dev/null +++ b/codenet/public_test_cases/p00028/output.1.txt @@ -0,0 +1,2 @@ +3 +5 diff --git a/codenet/public_test_cases/p00029/input.0.txt b/codenet/public_test_cases/p00029/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7892647623ceec61716abf5557a0597aa72c4f12 --- /dev/null +++ b/codenet/public_test_cases/p00029/input.0.txt @@ -0,0 +1 @@ +Thank you for your mail and your lectures diff --git a/codenet/public_test_cases/p00029/input.1.txt b/codenet/public_test_cases/p00029/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7892647623ceec61716abf5557a0597aa72c4f12 --- /dev/null +++ b/codenet/public_test_cases/p00029/input.1.txt @@ -0,0 +1 @@ +Thank you for your mail and your lectures diff --git a/codenet/public_test_cases/p00029/output.0.txt b/codenet/public_test_cases/p00029/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec2cba9ede9039f962128eed81bb262fc1b6e7ea --- /dev/null +++ b/codenet/public_test_cases/p00029/output.0.txt @@ -0,0 +1 @@ +your lectures diff --git a/codenet/public_test_cases/p00029/output.1.txt b/codenet/public_test_cases/p00029/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec2cba9ede9039f962128eed81bb262fc1b6e7ea --- /dev/null +++ b/codenet/public_test_cases/p00029/output.1.txt @@ -0,0 +1 @@ +your lectures diff --git a/codenet/public_test_cases/p00030/input.0.txt b/codenet/public_test_cases/p00030/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c9409ef811a36ab2fd25e9e8b09d722e4c3ed93 --- /dev/null +++ b/codenet/public_test_cases/p00030/input.0.txt @@ -0,0 +1,3 @@ +3 6 +3 1 +0 0 diff --git a/codenet/public_test_cases/p00030/input.1.txt b/codenet/public_test_cases/p00030/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c9409ef811a36ab2fd25e9e8b09d722e4c3ed93 --- /dev/null +++ b/codenet/public_test_cases/p00030/input.1.txt @@ -0,0 +1,3 @@ +3 6 +3 1 +0 0 diff --git a/codenet/public_test_cases/p00030/output.0.txt b/codenet/public_test_cases/p00030/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p00030/output.0.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p00030/output.1.txt b/codenet/public_test_cases/p00030/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p00030/output.1.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p00031/input.0.txt b/codenet/public_test_cases/p00031/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f34079899ced1752e76a425231c97f67c88d898 --- /dev/null +++ b/codenet/public_test_cases/p00031/input.0.txt @@ -0,0 +1,3 @@ +5 +7 +127 diff --git a/codenet/public_test_cases/p00031/input.1.txt b/codenet/public_test_cases/p00031/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f34079899ced1752e76a425231c97f67c88d898 --- /dev/null +++ b/codenet/public_test_cases/p00031/input.1.txt @@ -0,0 +1,3 @@ +5 +7 +127 diff --git a/codenet/public_test_cases/p00031/output.0.txt b/codenet/public_test_cases/p00031/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4040e7ad180594721ff96c5eb0187f3f2443a40a --- /dev/null +++ b/codenet/public_test_cases/p00031/output.0.txt @@ -0,0 +1,3 @@ +1 4 +1 2 4 +1 2 4 8 16 32 64 diff --git a/codenet/public_test_cases/p00031/output.1.txt b/codenet/public_test_cases/p00031/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4040e7ad180594721ff96c5eb0187f3f2443a40a --- /dev/null +++ b/codenet/public_test_cases/p00031/output.1.txt @@ -0,0 +1,3 @@ +1 4 +1 2 4 +1 2 4 8 16 32 64 diff --git a/codenet/public_test_cases/p00032/input.0.txt b/codenet/public_test_cases/p00032/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b37c1fa3953d1f98b6507d2881317bb112dffa2 --- /dev/null +++ b/codenet/public_test_cases/p00032/input.0.txt @@ -0,0 +1,4 @@ +3,4,5 +5,5,8 +4,4,4 +5,4,3 diff --git a/codenet/public_test_cases/p00032/input.1.txt b/codenet/public_test_cases/p00032/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b37c1fa3953d1f98b6507d2881317bb112dffa2 --- /dev/null +++ b/codenet/public_test_cases/p00032/input.1.txt @@ -0,0 +1,4 @@ +3,4,5 +5,5,8 +4,4,4 +5,4,3 diff --git a/codenet/public_test_cases/p00032/output.0.txt b/codenet/public_test_cases/p00032/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p00032/output.0.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p00032/output.1.txt b/codenet/public_test_cases/p00032/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p00032/output.1.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p00033/input.0.txt b/codenet/public_test_cases/p00033/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54f112ba3e1823fff4fe8780dceab534b39c4b69 --- /dev/null +++ b/codenet/public_test_cases/p00033/input.0.txt @@ -0,0 +1,3 @@ +2 +3 1 4 2 5 6 7 8 9 10 +10 9 8 7 6 5 4 3 2 1 diff --git a/codenet/public_test_cases/p00033/input.1.txt b/codenet/public_test_cases/p00033/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..54f112ba3e1823fff4fe8780dceab534b39c4b69 --- /dev/null +++ b/codenet/public_test_cases/p00033/input.1.txt @@ -0,0 +1,3 @@ +2 +3 1 4 2 5 6 7 8 9 10 +10 9 8 7 6 5 4 3 2 1 diff --git a/codenet/public_test_cases/p00033/output.0.txt b/codenet/public_test_cases/p00033/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p00033/output.0.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p00033/output.1.txt b/codenet/public_test_cases/p00033/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p00033/output.1.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p00034/input.0.txt b/codenet/public_test_cases/p00034/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..79a7e69e02c6853192d5de389dc2b07c7f86f4df --- /dev/null +++ b/codenet/public_test_cases/p00034/input.0.txt @@ -0,0 +1,3 @@ +1,1,1,1,1,1,1,1,1,1,40,60 +1,1,1,1,1,3,3,3,3,3,50,50 +10,10,10,10,10,10,10,10,10,10,50,49 diff --git a/codenet/public_test_cases/p00034/input.1.txt b/codenet/public_test_cases/p00034/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..79a7e69e02c6853192d5de389dc2b07c7f86f4df --- /dev/null +++ b/codenet/public_test_cases/p00034/input.1.txt @@ -0,0 +1,3 @@ +1,1,1,1,1,1,1,1,1,1,40,60 +1,1,1,1,1,3,3,3,3,3,50,50 +10,10,10,10,10,10,10,10,10,10,50,49 diff --git a/codenet/public_test_cases/p00034/output.0.txt b/codenet/public_test_cases/p00034/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25901e1dca6a4ab5c4043c3d8ce40d833bac7f45 --- /dev/null +++ b/codenet/public_test_cases/p00034/output.0.txt @@ -0,0 +1,3 @@ +4 +7 +6 diff --git a/codenet/public_test_cases/p00034/output.1.txt b/codenet/public_test_cases/p00034/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..25901e1dca6a4ab5c4043c3d8ce40d833bac7f45 --- /dev/null +++ b/codenet/public_test_cases/p00034/output.1.txt @@ -0,0 +1,3 @@ +4 +7 +6 diff --git a/codenet/public_test_cases/p00035/input.0.txt b/codenet/public_test_cases/p00035/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37f5105eaf72a174c716ddef88189e58dd7bc9b5 --- /dev/null +++ b/codenet/public_test_cases/p00035/input.0.txt @@ -0,0 +1,2 @@ +0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0 +0.0,0.0,3.0,0.0,1.0,1.0,1.0,3.0 diff --git a/codenet/public_test_cases/p00035/input.1.txt b/codenet/public_test_cases/p00035/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37f5105eaf72a174c716ddef88189e58dd7bc9b5 --- /dev/null +++ b/codenet/public_test_cases/p00035/input.1.txt @@ -0,0 +1,2 @@ +0.0,0.0,1.0,0.0,1.0,1.0,0.0,1.0 +0.0,0.0,3.0,0.0,1.0,1.0,1.0,3.0 diff --git a/codenet/public_test_cases/p00035/output.0.txt b/codenet/public_test_cases/p00035/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p00035/output.0.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p00035/output.1.txt b/codenet/public_test_cases/p00035/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p00035/output.1.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p00036/input.0.txt b/codenet/public_test_cases/p00036/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..842852cf1597d8f36a088f3942f30e9b7d090c31 --- /dev/null +++ b/codenet/public_test_cases/p00036/input.0.txt @@ -0,0 +1,26 @@ +00000000 +00000000 +01100000 +00110000 +00000000 +00000000 +00000000 +00000000 + +00011110 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +00000000 +00000000 +00110000 +00110000 +00000000 +00000000 +00000000 +00000000 diff --git a/codenet/public_test_cases/p00036/input.1.txt b/codenet/public_test_cases/p00036/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..842852cf1597d8f36a088f3942f30e9b7d090c31 --- /dev/null +++ b/codenet/public_test_cases/p00036/input.1.txt @@ -0,0 +1,26 @@ +00000000 +00000000 +01100000 +00110000 +00000000 +00000000 +00000000 +00000000 + +00011110 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +00000000 +00000000 +00110000 +00110000 +00000000 +00000000 +00000000 +00000000 diff --git a/codenet/public_test_cases/p00036/output.0.txt b/codenet/public_test_cases/p00036/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..513c645e159faf4080d1a0aab6129fa9d753809e --- /dev/null +++ b/codenet/public_test_cases/p00036/output.0.txt @@ -0,0 +1,3 @@ +E +C +A diff --git a/codenet/public_test_cases/p00036/output.1.txt b/codenet/public_test_cases/p00036/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..513c645e159faf4080d1a0aab6129fa9d753809e --- /dev/null +++ b/codenet/public_test_cases/p00036/output.1.txt @@ -0,0 +1,3 @@ +E +C +A diff --git a/codenet/public_test_cases/p00037/input.0.txt b/codenet/public_test_cases/p00037/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..876d2cf08b3c8c33ff3b59c55d97a408b2ab59ec --- /dev/null +++ b/codenet/public_test_cases/p00037/input.0.txt @@ -0,0 +1,9 @@ +1111 +00001 +0110 +01011 +0010 +01111 +0010 +01001 +0111 diff --git a/codenet/public_test_cases/p00037/input.1.txt b/codenet/public_test_cases/p00037/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..876d2cf08b3c8c33ff3b59c55d97a408b2ab59ec --- /dev/null +++ b/codenet/public_test_cases/p00037/input.1.txt @@ -0,0 +1,9 @@ +1111 +00001 +0110 +01011 +0010 +01111 +0010 +01001 +0111 diff --git a/codenet/public_test_cases/p00037/output.0.txt b/codenet/public_test_cases/p00037/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85a1ff7f99ef6e6ce07b890efb1a1f9044e85f2c --- /dev/null +++ b/codenet/public_test_cases/p00037/output.0.txt @@ -0,0 +1 @@ +RRRRDDDDLLLUUURRDDLURULLDDDRRRUUUULLLL diff --git a/codenet/public_test_cases/p00037/output.1.txt b/codenet/public_test_cases/p00037/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85a1ff7f99ef6e6ce07b890efb1a1f9044e85f2c --- /dev/null +++ b/codenet/public_test_cases/p00037/output.1.txt @@ -0,0 +1 @@ +RRRRDDDDLLLUUURRDDLURULLDDDRRRUUUULLLL diff --git a/codenet/public_test_cases/p00038/input.0.txt b/codenet/public_test_cases/p00038/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7eaf356a56bb20184c3bfd44e4b224ef1024930 --- /dev/null +++ b/codenet/public_test_cases/p00038/input.0.txt @@ -0,0 +1,8 @@ +1,2,3,4,1 +2,3,2,3,12 +12,13,11,12,12 +7,6,7,6,7 +3,3,2,3,3 +6,7,8,9,10 +11,12,10,1,13 +11,12,13,1,2 diff --git a/codenet/public_test_cases/p00038/input.1.txt b/codenet/public_test_cases/p00038/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7eaf356a56bb20184c3bfd44e4b224ef1024930 --- /dev/null +++ b/codenet/public_test_cases/p00038/input.1.txt @@ -0,0 +1,8 @@ +1,2,3,4,1 +2,3,2,3,12 +12,13,11,12,12 +7,6,7,6,7 +3,3,2,3,3 +6,7,8,9,10 +11,12,10,1,13 +11,12,13,1,2 diff --git a/codenet/public_test_cases/p00038/output.0.txt b/codenet/public_test_cases/p00038/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2c0f045cc21124b01308dab46b41b32237702e6 --- /dev/null +++ b/codenet/public_test_cases/p00038/output.0.txt @@ -0,0 +1,8 @@ +one pair +two pair +three card +full house +four card +straight +straight +null diff --git a/codenet/public_test_cases/p00038/output.1.txt b/codenet/public_test_cases/p00038/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2c0f045cc21124b01308dab46b41b32237702e6 --- /dev/null +++ b/codenet/public_test_cases/p00038/output.1.txt @@ -0,0 +1,8 @@ +one pair +two pair +three card +full house +four card +straight +straight +null diff --git a/codenet/public_test_cases/p00039/input.0.txt b/codenet/public_test_cases/p00039/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..77d5646ae0af51b832929853f7fd4d4f79658bce --- /dev/null +++ b/codenet/public_test_cases/p00039/input.0.txt @@ -0,0 +1,3 @@ +IV +CCCCLXXXXVIIII +CDXCIX diff --git a/codenet/public_test_cases/p00039/input.1.txt b/codenet/public_test_cases/p00039/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..77d5646ae0af51b832929853f7fd4d4f79658bce --- /dev/null +++ b/codenet/public_test_cases/p00039/input.1.txt @@ -0,0 +1,3 @@ +IV +CCCCLXXXXVIIII +CDXCIX diff --git a/codenet/public_test_cases/p00039/output.0.txt b/codenet/public_test_cases/p00039/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f4a5265c799543582220aa743a81dd5ed4f3f8c --- /dev/null +++ b/codenet/public_test_cases/p00039/output.0.txt @@ -0,0 +1,3 @@ +4 +499 +499 diff --git a/codenet/public_test_cases/p00039/output.1.txt b/codenet/public_test_cases/p00039/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f4a5265c799543582220aa743a81dd5ed4f3f8c --- /dev/null +++ b/codenet/public_test_cases/p00039/output.1.txt @@ -0,0 +1,3 @@ +4 +499 +499 diff --git a/codenet/public_test_cases/p00040/input.0.txt b/codenet/public_test_cases/p00040/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83dd6d900fac721d55dd003ac288ce4944142aff --- /dev/null +++ b/codenet/public_test_cases/p00040/input.0.txt @@ -0,0 +1,2 @@ +1 +y eazqyp pnop pngtg ye obmpngt xmybp mr lygw diff --git a/codenet/public_test_cases/p00040/input.1.txt b/codenet/public_test_cases/p00040/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83dd6d900fac721d55dd003ac288ce4944142aff --- /dev/null +++ b/codenet/public_test_cases/p00040/input.1.txt @@ -0,0 +1,2 @@ +1 +y eazqyp pnop pngtg ye obmpngt xmybp mr lygw diff --git a/codenet/public_test_cases/p00040/output.0.txt b/codenet/public_test_cases/p00040/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6389ea651f5cf4e37933c67a490e7902aaa746b7 --- /dev/null +++ b/codenet/public_test_cases/p00040/output.0.txt @@ -0,0 +1 @@ +i submit that there is another point of view diff --git a/codenet/public_test_cases/p00040/output.1.txt b/codenet/public_test_cases/p00040/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6389ea651f5cf4e37933c67a490e7902aaa746b7 --- /dev/null +++ b/codenet/public_test_cases/p00040/output.1.txt @@ -0,0 +1 @@ +i submit that there is another point of view diff --git a/codenet/public_test_cases/p00041/input.0.txt b/codenet/public_test_cases/p00041/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c855e27e1e86dc335433b4cf1410d6e25fd3fc94 --- /dev/null +++ b/codenet/public_test_cases/p00041/input.0.txt @@ -0,0 +1,4 @@ +8 7 9 9 +4 4 4 4 +5 5 7 5 +0 0 0 0 diff --git a/codenet/public_test_cases/p00041/input.1.txt b/codenet/public_test_cases/p00041/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c855e27e1e86dc335433b4cf1410d6e25fd3fc94 --- /dev/null +++ b/codenet/public_test_cases/p00041/input.1.txt @@ -0,0 +1,4 @@ +8 7 9 9 +4 4 4 4 +5 5 7 5 +0 0 0 0 diff --git a/codenet/public_test_cases/p00041/output.0.txt b/codenet/public_test_cases/p00041/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8812adca1e7eb35548c70d6dff964783bc740203 --- /dev/null +++ b/codenet/public_test_cases/p00041/output.0.txt @@ -0,0 +1,3 @@ +((9 * (9 - 7)) - 8) +0 +((7 * 5) - (5 * 5)) diff --git a/codenet/public_test_cases/p00041/output.1.txt b/codenet/public_test_cases/p00041/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8812adca1e7eb35548c70d6dff964783bc740203 --- /dev/null +++ b/codenet/public_test_cases/p00041/output.1.txt @@ -0,0 +1,3 @@ +((9 * (9 - 7)) - 8) +0 +((7 * 5) - (5 * 5)) diff --git a/codenet/public_test_cases/p00042/input.0.txt b/codenet/public_test_cases/p00042/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a6d7bcdb6755b6f8fef18b22a1a310293fae8d0 --- /dev/null +++ b/codenet/public_test_cases/p00042/input.0.txt @@ -0,0 +1,15 @@ +50 +5 +60,10 +100,20 +120,30 +210,45 +10,4 +50 +5 +60,10 +100,20 +120,30 +210,45 +10,4 +0 diff --git a/codenet/public_test_cases/p00042/input.1.txt b/codenet/public_test_cases/p00042/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a6d7bcdb6755b6f8fef18b22a1a310293fae8d0 --- /dev/null +++ b/codenet/public_test_cases/p00042/input.1.txt @@ -0,0 +1,15 @@ +50 +5 +60,10 +100,20 +120,30 +210,45 +10,4 +50 +5 +60,10 +100,20 +120,30 +210,45 +10,4 +0 diff --git a/codenet/public_test_cases/p00042/output.0.txt b/codenet/public_test_cases/p00042/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b41b6b84a6b4c096feeb15641e653e35fa3d9f98 --- /dev/null +++ b/codenet/public_test_cases/p00042/output.0.txt @@ -0,0 +1,6 @@ +Case 1: +220 +49 +Case 2: +220 +49 diff --git a/codenet/public_test_cases/p00042/output.1.txt b/codenet/public_test_cases/p00042/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b41b6b84a6b4c096feeb15641e653e35fa3d9f98 --- /dev/null +++ b/codenet/public_test_cases/p00042/output.1.txt @@ -0,0 +1,6 @@ +Case 1: +220 +49 +Case 2: +220 +49 diff --git a/codenet/public_test_cases/p00043/input.0.txt b/codenet/public_test_cases/p00043/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..acbac4efc3bedd53adf3e3c18f62f1dc62d2cbcc --- /dev/null +++ b/codenet/public_test_cases/p00043/input.0.txt @@ -0,0 +1,6 @@ +3649596966777 +6358665788577 +9118992346175 +9643871425498 +7755542764533 +1133557799246 diff --git a/codenet/public_test_cases/p00043/input.1.txt b/codenet/public_test_cases/p00043/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..acbac4efc3bedd53adf3e3c18f62f1dc62d2cbcc --- /dev/null +++ b/codenet/public_test_cases/p00043/input.1.txt @@ -0,0 +1,6 @@ +3649596966777 +6358665788577 +9118992346175 +9643871425498 +7755542764533 +1133557799246 diff --git a/codenet/public_test_cases/p00043/output.0.txt b/codenet/public_test_cases/p00043/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61d14423f0f89660c20ed31b3d22b9b9d7571f52 --- /dev/null +++ b/codenet/public_test_cases/p00043/output.0.txt @@ -0,0 +1,6 @@ +2 3 5 8 +3 4 +1 2 3 4 5 6 7 8 9 +7 8 9 +1 2 3 4 6 7 8 +0 diff --git a/codenet/public_test_cases/p00043/output.1.txt b/codenet/public_test_cases/p00043/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..61d14423f0f89660c20ed31b3d22b9b9d7571f52 --- /dev/null +++ b/codenet/public_test_cases/p00043/output.1.txt @@ -0,0 +1,6 @@ +2 3 5 8 +3 4 +1 2 3 4 5 6 7 8 9 +7 8 9 +1 2 3 4 6 7 8 +0 diff --git a/codenet/public_test_cases/p00044/input.0.txt b/codenet/public_test_cases/p00044/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1503cce67d9b2ad83ff21cdc7235fb176b839260 --- /dev/null +++ b/codenet/public_test_cases/p00044/input.0.txt @@ -0,0 +1,2 @@ +19 +3517 diff --git a/codenet/public_test_cases/p00044/input.1.txt b/codenet/public_test_cases/p00044/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1503cce67d9b2ad83ff21cdc7235fb176b839260 --- /dev/null +++ b/codenet/public_test_cases/p00044/input.1.txt @@ -0,0 +1,2 @@ +19 +3517 diff --git a/codenet/public_test_cases/p00044/output.0.txt b/codenet/public_test_cases/p00044/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56867365f15a7635b2ecb0f59fe81bcd2165218c --- /dev/null +++ b/codenet/public_test_cases/p00044/output.0.txt @@ -0,0 +1,2 @@ +17 23 +3511 3527 diff --git a/codenet/public_test_cases/p00044/output.1.txt b/codenet/public_test_cases/p00044/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..56867365f15a7635b2ecb0f59fe81bcd2165218c --- /dev/null +++ b/codenet/public_test_cases/p00044/output.1.txt @@ -0,0 +1,2 @@ +17 23 +3511 3527 diff --git a/codenet/public_test_cases/p00045/input.0.txt b/codenet/public_test_cases/p00045/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45de4cb6bf051e8bd89c9e28f5d2683a3f976a3b --- /dev/null +++ b/codenet/public_test_cases/p00045/input.0.txt @@ -0,0 +1,3 @@ +100,20 +50,10 +70,35 diff --git a/codenet/public_test_cases/p00045/input.1.txt b/codenet/public_test_cases/p00045/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45de4cb6bf051e8bd89c9e28f5d2683a3f976a3b --- /dev/null +++ b/codenet/public_test_cases/p00045/input.1.txt @@ -0,0 +1,3 @@ +100,20 +50,10 +70,35 diff --git a/codenet/public_test_cases/p00045/output.0.txt b/codenet/public_test_cases/p00045/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..22aacc3803cdc341c906dc1aaf6d3c31e443fd3f --- /dev/null +++ b/codenet/public_test_cases/p00045/output.0.txt @@ -0,0 +1,2 @@ +4950 +22 diff --git a/codenet/public_test_cases/p00045/output.1.txt b/codenet/public_test_cases/p00045/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..22aacc3803cdc341c906dc1aaf6d3c31e443fd3f --- /dev/null +++ b/codenet/public_test_cases/p00045/output.1.txt @@ -0,0 +1,2 @@ +4950 +22 diff --git a/codenet/public_test_cases/p00046/input.0.txt b/codenet/public_test_cases/p00046/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e875e058146552030762935da5024ac0d04c733 --- /dev/null +++ b/codenet/public_test_cases/p00046/input.0.txt @@ -0,0 +1,5 @@ +3776.0 +1819.0 +645.2 +2004.1 +1208.6 diff --git a/codenet/public_test_cases/p00046/input.1.txt b/codenet/public_test_cases/p00046/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e875e058146552030762935da5024ac0d04c733 --- /dev/null +++ b/codenet/public_test_cases/p00046/input.1.txt @@ -0,0 +1,5 @@ +3776.0 +1819.0 +645.2 +2004.1 +1208.6 diff --git a/codenet/public_test_cases/p00046/output.0.txt b/codenet/public_test_cases/p00046/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a149f9b19d093696b4bb73fc805429a4eb9aa61 --- /dev/null +++ b/codenet/public_test_cases/p00046/output.0.txt @@ -0,0 +1 @@ +3130.8 diff --git a/codenet/public_test_cases/p00046/output.1.txt b/codenet/public_test_cases/p00046/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a149f9b19d093696b4bb73fc805429a4eb9aa61 --- /dev/null +++ b/codenet/public_test_cases/p00046/output.1.txt @@ -0,0 +1 @@ +3130.8 diff --git a/codenet/public_test_cases/p00047/input.0.txt b/codenet/public_test_cases/p00047/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55162a4a046519c4ca9fd0d3588af960f46f1b68 --- /dev/null +++ b/codenet/public_test_cases/p00047/input.0.txt @@ -0,0 +1,5 @@ +B,C +A,C +C,B +A,B +C,B diff --git a/codenet/public_test_cases/p00047/output.0.txt b/codenet/public_test_cases/p00047/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70f10e4db19068f79bc43844b49f3eece45c4e8 --- /dev/null +++ b/codenet/public_test_cases/p00047/output.0.txt @@ -0,0 +1 @@ +A diff --git a/codenet/public_test_cases/p00048/input.0.txt b/codenet/public_test_cases/p00048/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b910014f616ffc887d95495bb7ca12e7c5414540 --- /dev/null +++ b/codenet/public_test_cases/p00048/input.0.txt @@ -0,0 +1,4 @@ +60.2 +70.2 +48.0 +80.2 diff --git a/codenet/public_test_cases/p00048/output.0.txt b/codenet/public_test_cases/p00048/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbd0087f8f54c04b42d07c8bc94ec9b5133ba81c --- /dev/null +++ b/codenet/public_test_cases/p00048/output.0.txt @@ -0,0 +1,4 @@ +light welter +light middle +light fly +middle diff --git a/codenet/public_test_cases/p00049/input.0.txt b/codenet/public_test_cases/p00049/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f6dd0333a76a6585c18af56ea1b4e6a15665c3e --- /dev/null +++ b/codenet/public_test_cases/p00049/input.0.txt @@ -0,0 +1,14 @@ +1,B +2,A +3,B +4,AB +5,B +6,O +7,A +8,O +9,AB +10,A +11,A +12,B +13,AB +14,A diff --git a/codenet/public_test_cases/p00049/input.1.txt b/codenet/public_test_cases/p00049/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f6dd0333a76a6585c18af56ea1b4e6a15665c3e --- /dev/null +++ b/codenet/public_test_cases/p00049/input.1.txt @@ -0,0 +1,14 @@ +1,B +2,A +3,B +4,AB +5,B +6,O +7,A +8,O +9,AB +10,A +11,A +12,B +13,AB +14,A diff --git a/codenet/public_test_cases/p00049/output.0.txt b/codenet/public_test_cases/p00049/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab259cf9835b9a610ce7b284c96af8765db876f3 --- /dev/null +++ b/codenet/public_test_cases/p00049/output.0.txt @@ -0,0 +1,4 @@ +5 +4 +3 +2 diff --git a/codenet/public_test_cases/p00049/output.1.txt b/codenet/public_test_cases/p00049/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab259cf9835b9a610ce7b284c96af8765db876f3 --- /dev/null +++ b/codenet/public_test_cases/p00049/output.1.txt @@ -0,0 +1,4 @@ +5 +4 +3 +2 diff --git a/codenet/public_test_cases/p00050/input.0.txt b/codenet/public_test_cases/p00050/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d50ebd51871ea51dcc4110ca4cd702caceb4813d --- /dev/null +++ b/codenet/public_test_cases/p00050/input.0.txt @@ -0,0 +1 @@ +the cost of one peach is higher than that of one apple. diff --git a/codenet/public_test_cases/p00050/input.1.txt b/codenet/public_test_cases/p00050/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d50ebd51871ea51dcc4110ca4cd702caceb4813d --- /dev/null +++ b/codenet/public_test_cases/p00050/input.1.txt @@ -0,0 +1 @@ +the cost of one peach is higher than that of one apple. diff --git a/codenet/public_test_cases/p00050/output.0.txt b/codenet/public_test_cases/p00050/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ae7c38023ac66bb50f9491a6c2be1b1935e5cc3 --- /dev/null +++ b/codenet/public_test_cases/p00050/output.0.txt @@ -0,0 +1 @@ +the cost of one apple is higher than that of one peach. diff --git a/codenet/public_test_cases/p00050/output.1.txt b/codenet/public_test_cases/p00050/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ae7c38023ac66bb50f9491a6c2be1b1935e5cc3 --- /dev/null +++ b/codenet/public_test_cases/p00050/output.1.txt @@ -0,0 +1 @@ +the cost of one apple is higher than that of one peach. diff --git a/codenet/public_test_cases/p00051/input.0.txt b/codenet/public_test_cases/p00051/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..527c9952a708b917e1b0d92304b85928f656c8b7 --- /dev/null +++ b/codenet/public_test_cases/p00051/input.0.txt @@ -0,0 +1,3 @@ +2 +65539010 +65539010 diff --git a/codenet/public_test_cases/p00051/input.1.txt b/codenet/public_test_cases/p00051/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..527c9952a708b917e1b0d92304b85928f656c8b7 --- /dev/null +++ b/codenet/public_test_cases/p00051/input.1.txt @@ -0,0 +1,3 @@ +2 +65539010 +65539010 diff --git a/codenet/public_test_cases/p00051/output.0.txt b/codenet/public_test_cases/p00051/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1da5ee1dff1c60e92578cdb59a4daf5d2a660cfc --- /dev/null +++ b/codenet/public_test_cases/p00051/output.0.txt @@ -0,0 +1,2 @@ +96417531 +96417531 diff --git a/codenet/public_test_cases/p00051/output.1.txt b/codenet/public_test_cases/p00051/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1da5ee1dff1c60e92578cdb59a4daf5d2a660cfc --- /dev/null +++ b/codenet/public_test_cases/p00051/output.1.txt @@ -0,0 +1,2 @@ +96417531 +96417531 diff --git a/codenet/public_test_cases/p00052/input.0.txt b/codenet/public_test_cases/p00052/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a342e2880e3354ebbbc6942102a27f84a53d64c2 --- /dev/null +++ b/codenet/public_test_cases/p00052/input.0.txt @@ -0,0 +1,4 @@ +2 +12 +10000 +0 diff --git a/codenet/public_test_cases/p00052/input.1.txt b/codenet/public_test_cases/p00052/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a342e2880e3354ebbbc6942102a27f84a53d64c2 --- /dev/null +++ b/codenet/public_test_cases/p00052/input.1.txt @@ -0,0 +1,4 @@ +2 +12 +10000 +0 diff --git a/codenet/public_test_cases/p00052/output.0.txt b/codenet/public_test_cases/p00052/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ca3ec61302d4ccc250544cdd6e7b3dacb13508e --- /dev/null +++ b/codenet/public_test_cases/p00052/output.0.txt @@ -0,0 +1,3 @@ +0 +2 +2499 diff --git a/codenet/public_test_cases/p00052/output.1.txt b/codenet/public_test_cases/p00052/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ca3ec61302d4ccc250544cdd6e7b3dacb13508e --- /dev/null +++ b/codenet/public_test_cases/p00052/output.1.txt @@ -0,0 +1,3 @@ +0 +2 +2499 diff --git a/codenet/public_test_cases/p00053/input.0.txt b/codenet/public_test_cases/p00053/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5addec973565cba76ee2d4f101a66ae7c22b629 --- /dev/null +++ b/codenet/public_test_cases/p00053/input.0.txt @@ -0,0 +1,3 @@ +2 +9 +0 diff --git a/codenet/public_test_cases/p00053/input.1.txt b/codenet/public_test_cases/p00053/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5addec973565cba76ee2d4f101a66ae7c22b629 --- /dev/null +++ b/codenet/public_test_cases/p00053/input.1.txt @@ -0,0 +1,3 @@ +2 +9 +0 diff --git a/codenet/public_test_cases/p00053/output.0.txt b/codenet/public_test_cases/p00053/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..51a3e80716e394419c949bc612b9b78dd2aa67ea --- /dev/null +++ b/codenet/public_test_cases/p00053/output.0.txt @@ -0,0 +1,2 @@ +5 +100 diff --git a/codenet/public_test_cases/p00053/output.1.txt b/codenet/public_test_cases/p00053/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51a3e80716e394419c949bc612b9b78dd2aa67ea --- /dev/null +++ b/codenet/public_test_cases/p00053/output.1.txt @@ -0,0 +1,2 @@ +5 +100 diff --git a/codenet/public_test_cases/p00054/input.0.txt b/codenet/public_test_cases/p00054/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4bdd7e94ad441830eb85c6ac67bc6b732af656e7 --- /dev/null +++ b/codenet/public_test_cases/p00054/input.0.txt @@ -0,0 +1,4 @@ +1 2 3 +2 3 4 +5 4 3 +4 3 2 diff --git a/codenet/public_test_cases/p00054/input.1.txt b/codenet/public_test_cases/p00054/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4bdd7e94ad441830eb85c6ac67bc6b732af656e7 --- /dev/null +++ b/codenet/public_test_cases/p00054/input.1.txt @@ -0,0 +1,4 @@ +1 2 3 +2 3 4 +5 4 3 +4 3 2 diff --git a/codenet/public_test_cases/p00054/output.0.txt b/codenet/public_test_cases/p00054/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ab7ddb0beb987fa6cf596d78336721e5ceeed87 --- /dev/null +++ b/codenet/public_test_cases/p00054/output.0.txt @@ -0,0 +1,4 @@ +5 +24 +7 +6 diff --git a/codenet/public_test_cases/p00054/output.1.txt b/codenet/public_test_cases/p00054/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ab7ddb0beb987fa6cf596d78336721e5ceeed87 --- /dev/null +++ b/codenet/public_test_cases/p00054/output.1.txt @@ -0,0 +1,4 @@ +5 +24 +7 +6 diff --git a/codenet/public_test_cases/p00055/input.0.txt b/codenet/public_test_cases/p00055/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e7782bca057db65e939fb0bc9a8df7b17b26e14 --- /dev/null +++ b/codenet/public_test_cases/p00055/input.0.txt @@ -0,0 +1,3 @@ +1.0 +2.0 +3.0 diff --git a/codenet/public_test_cases/p00055/input.1.txt b/codenet/public_test_cases/p00055/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e7782bca057db65e939fb0bc9a8df7b17b26e14 --- /dev/null +++ b/codenet/public_test_cases/p00055/input.1.txt @@ -0,0 +1,3 @@ +1.0 +2.0 +3.0 diff --git a/codenet/public_test_cases/p00055/output.0.txt b/codenet/public_test_cases/p00055/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c7342bb879041160dd8061ebda5450d9dd8e99b --- /dev/null +++ b/codenet/public_test_cases/p00055/output.0.txt @@ -0,0 +1,3 @@ +7.81481481 +15.62962963 +23.44444444 diff --git a/codenet/public_test_cases/p00055/output.1.txt b/codenet/public_test_cases/p00055/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c7342bb879041160dd8061ebda5450d9dd8e99b --- /dev/null +++ b/codenet/public_test_cases/p00055/output.1.txt @@ -0,0 +1,3 @@ +7.81481481 +15.62962963 +23.44444444 diff --git a/codenet/public_test_cases/p00056/input.0.txt b/codenet/public_test_cases/p00056/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7eeae9def6c4c4391d4d642e11ab20c54785e58 --- /dev/null +++ b/codenet/public_test_cases/p00056/input.0.txt @@ -0,0 +1,3 @@ +10 +11 +0 diff --git a/codenet/public_test_cases/p00056/input.1.txt b/codenet/public_test_cases/p00056/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7eeae9def6c4c4391d4d642e11ab20c54785e58 --- /dev/null +++ b/codenet/public_test_cases/p00056/input.1.txt @@ -0,0 +1,3 @@ +10 +11 +0 diff --git a/codenet/public_test_cases/p00056/output.0.txt b/codenet/public_test_cases/p00056/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..389e2621455b5b9129a49a4006e658565a970912 --- /dev/null +++ b/codenet/public_test_cases/p00056/output.0.txt @@ -0,0 +1,2 @@ +2 +0 diff --git a/codenet/public_test_cases/p00056/output.1.txt b/codenet/public_test_cases/p00056/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..389e2621455b5b9129a49a4006e658565a970912 --- /dev/null +++ b/codenet/public_test_cases/p00056/output.1.txt @@ -0,0 +1,2 @@ +2 +0 diff --git a/codenet/public_test_cases/p00057/input.0.txt b/codenet/public_test_cases/p00057/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p00057/input.0.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p00057/input.1.txt b/codenet/public_test_cases/p00057/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p00057/input.1.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p00057/output.0.txt b/codenet/public_test_cases/p00057/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e15ee42734b17a6e148d79be947360671597e2f --- /dev/null +++ b/codenet/public_test_cases/p00057/output.0.txt @@ -0,0 +1,2 @@ +2 +7 diff --git a/codenet/public_test_cases/p00057/output.1.txt b/codenet/public_test_cases/p00057/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e15ee42734b17a6e148d79be947360671597e2f --- /dev/null +++ b/codenet/public_test_cases/p00057/output.1.txt @@ -0,0 +1,2 @@ +2 +7 diff --git a/codenet/public_test_cases/p00058/input.0.txt b/codenet/public_test_cases/p00058/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ad6dae246dd1d1a05735a4e373d591886329f69 --- /dev/null +++ b/codenet/public_test_cases/p00058/input.0.txt @@ -0,0 +1,4 @@ +1.0 1.0 2.0 2.0 0.0 0.0 1.0 -1.0 +0.0 0.0 2.0 0.0 -1.0 2.0 2.0 2.0 +10.0 6.0 3.4 5.2 6.8 9.5 4.3 2.1 +2.5 3.5 2.5 4.5 -3.3 -2.3 6.8 -2.3 diff --git a/codenet/public_test_cases/p00058/input.1.txt b/codenet/public_test_cases/p00058/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ad6dae246dd1d1a05735a4e373d591886329f69 --- /dev/null +++ b/codenet/public_test_cases/p00058/input.1.txt @@ -0,0 +1,4 @@ +1.0 1.0 2.0 2.0 0.0 0.0 1.0 -1.0 +0.0 0.0 2.0 0.0 -1.0 2.0 2.0 2.0 +10.0 6.0 3.4 5.2 6.8 9.5 4.3 2.1 +2.5 3.5 2.5 4.5 -3.3 -2.3 6.8 -2.3 diff --git a/codenet/public_test_cases/p00058/output.0.txt b/codenet/public_test_cases/p00058/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8cd35136f7e468a059f028417df0629adeddf07 --- /dev/null +++ b/codenet/public_test_cases/p00058/output.0.txt @@ -0,0 +1,4 @@ +YES +NO +NO +YES diff --git a/codenet/public_test_cases/p00058/output.1.txt b/codenet/public_test_cases/p00058/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8cd35136f7e468a059f028417df0629adeddf07 --- /dev/null +++ b/codenet/public_test_cases/p00058/output.1.txt @@ -0,0 +1,4 @@ +YES +NO +NO +YES diff --git a/codenet/public_test_cases/p00059/input.0.txt b/codenet/public_test_cases/p00059/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e91804cedbdcc3a51d3156e94a43ac554a69eeb --- /dev/null +++ b/codenet/public_test_cases/p00059/input.0.txt @@ -0,0 +1,3 @@ +0.0 0.0 5.0 5.0 1.0 1.0 4.0 4.0 +0.0 0.0 4.0 5.0 1.0 1.0 5.0 5.0 +0.0 0.0 4.0 4.0 -3.0 -5.0 2.0 -1.0 diff --git a/codenet/public_test_cases/p00059/input.1.txt b/codenet/public_test_cases/p00059/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e91804cedbdcc3a51d3156e94a43ac554a69eeb --- /dev/null +++ b/codenet/public_test_cases/p00059/input.1.txt @@ -0,0 +1,3 @@ +0.0 0.0 5.0 5.0 1.0 1.0 4.0 4.0 +0.0 0.0 4.0 5.0 1.0 1.0 5.0 5.0 +0.0 0.0 4.0 4.0 -3.0 -5.0 2.0 -1.0 diff --git a/codenet/public_test_cases/p00059/output.0.txt b/codenet/public_test_cases/p00059/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ae1e3d350ec895e94f1290f50846bd436dbebb1 --- /dev/null +++ b/codenet/public_test_cases/p00059/output.0.txt @@ -0,0 +1,3 @@ +YES +YES +NO diff --git a/codenet/public_test_cases/p00059/output.1.txt b/codenet/public_test_cases/p00059/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ae1e3d350ec895e94f1290f50846bd436dbebb1 --- /dev/null +++ b/codenet/public_test_cases/p00059/output.1.txt @@ -0,0 +1,3 @@ +YES +YES +NO diff --git a/codenet/public_test_cases/p00060/input.0.txt b/codenet/public_test_cases/p00060/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..294e6a7aa48b858b1c29c07abeafcb1496b836b9 --- /dev/null +++ b/codenet/public_test_cases/p00060/input.0.txt @@ -0,0 +1,3 @@ +1 2 3 +5 6 9 +8 9 10 diff --git a/codenet/public_test_cases/p00060/input.1.txt b/codenet/public_test_cases/p00060/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..294e6a7aa48b858b1c29c07abeafcb1496b836b9 --- /dev/null +++ b/codenet/public_test_cases/p00060/input.1.txt @@ -0,0 +1,3 @@ +1 2 3 +5 6 9 +8 9 10 diff --git a/codenet/public_test_cases/p00060/output.0.txt b/codenet/public_test_cases/p00060/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ae1e3d350ec895e94f1290f50846bd436dbebb1 --- /dev/null +++ b/codenet/public_test_cases/p00060/output.0.txt @@ -0,0 +1,3 @@ +YES +YES +NO diff --git a/codenet/public_test_cases/p00060/output.1.txt b/codenet/public_test_cases/p00060/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ae1e3d350ec895e94f1290f50846bd436dbebb1 --- /dev/null +++ b/codenet/public_test_cases/p00060/output.1.txt @@ -0,0 +1,3 @@ +YES +YES +NO diff --git a/codenet/public_test_cases/p00061/input.0.txt b/codenet/public_test_cases/p00061/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98e870d4b9b3a9ef770fc9d9d4fde3dece578eb1 --- /dev/null +++ b/codenet/public_test_cases/p00061/input.0.txt @@ -0,0 +1,11 @@ +1,20 +2,20 +3,30 +4,10 +5,10 +6,20 +0,0 +1 +2 +4 +5 diff --git a/codenet/public_test_cases/p00061/input.1.txt b/codenet/public_test_cases/p00061/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98e870d4b9b3a9ef770fc9d9d4fde3dece578eb1 --- /dev/null +++ b/codenet/public_test_cases/p00061/input.1.txt @@ -0,0 +1,11 @@ +1,20 +2,20 +3,30 +4,10 +5,10 +6,20 +0,0 +1 +2 +4 +5 diff --git a/codenet/public_test_cases/p00061/output.0.txt b/codenet/public_test_cases/p00061/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e70345417f101c54acb5ec85441c23bb591175 --- /dev/null +++ b/codenet/public_test_cases/p00061/output.0.txt @@ -0,0 +1,4 @@ +2 +2 +3 +3 diff --git a/codenet/public_test_cases/p00061/output.1.txt b/codenet/public_test_cases/p00061/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e70345417f101c54acb5ec85441c23bb591175 --- /dev/null +++ b/codenet/public_test_cases/p00061/output.1.txt @@ -0,0 +1,4 @@ +2 +2 +3 +3 diff --git a/codenet/public_test_cases/p00062/input.0.txt b/codenet/public_test_cases/p00062/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69bb54cfa0691056a81fd476360d32c8483ecf33 --- /dev/null +++ b/codenet/public_test_cases/p00062/input.0.txt @@ -0,0 +1,3 @@ +4823108376 +1234567890 +0123456789 diff --git a/codenet/public_test_cases/p00062/input.1.txt b/codenet/public_test_cases/p00062/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69bb54cfa0691056a81fd476360d32c8483ecf33 --- /dev/null +++ b/codenet/public_test_cases/p00062/input.1.txt @@ -0,0 +1,3 @@ +4823108376 +1234567890 +0123456789 diff --git a/codenet/public_test_cases/p00062/output.0.txt b/codenet/public_test_cases/p00062/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e698d749bc1500f16e1f0ecd18f53916f75be02 --- /dev/null +++ b/codenet/public_test_cases/p00062/output.0.txt @@ -0,0 +1,3 @@ +5 +6 +4 diff --git a/codenet/public_test_cases/p00062/output.1.txt b/codenet/public_test_cases/p00062/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e698d749bc1500f16e1f0ecd18f53916f75be02 --- /dev/null +++ b/codenet/public_test_cases/p00062/output.1.txt @@ -0,0 +1,3 @@ +5 +6 +4 diff --git a/codenet/public_test_cases/p00063/input.0.txt b/codenet/public_test_cases/p00063/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..084ca8cfd204563a0ba15b1ecfa5bde6573ac7bf --- /dev/null +++ b/codenet/public_test_cases/p00063/input.0.txt @@ -0,0 +1,4 @@ +abcba +sx +abcddcba +rttrd diff --git a/codenet/public_test_cases/p00063/input.1.txt b/codenet/public_test_cases/p00063/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..084ca8cfd204563a0ba15b1ecfa5bde6573ac7bf --- /dev/null +++ b/codenet/public_test_cases/p00063/input.1.txt @@ -0,0 +1,4 @@ +abcba +sx +abcddcba +rttrd diff --git a/codenet/public_test_cases/p00063/output.0.txt b/codenet/public_test_cases/p00063/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00063/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00063/output.1.txt b/codenet/public_test_cases/p00063/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00063/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00064/input.0.txt b/codenet/public_test_cases/p00064/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4b04fea890a2f4b8e0892f317c7e9de0883f3c0 --- /dev/null +++ b/codenet/public_test_cases/p00064/input.0.txt @@ -0,0 +1,2 @@ +Thereare100yenonthetable.Iam17yearsold. +Ishouldgohomeat6pm. diff --git a/codenet/public_test_cases/p00064/input.1.txt b/codenet/public_test_cases/p00064/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4b04fea890a2f4b8e0892f317c7e9de0883f3c0 --- /dev/null +++ b/codenet/public_test_cases/p00064/input.1.txt @@ -0,0 +1,2 @@ +Thereare100yenonthetable.Iam17yearsold. +Ishouldgohomeat6pm. diff --git a/codenet/public_test_cases/p00064/output.0.txt b/codenet/public_test_cases/p00064/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..190a18037c64c43e6b11489df4bf0b9eb6d2c9bf --- /dev/null +++ b/codenet/public_test_cases/p00064/output.0.txt @@ -0,0 +1 @@ +123 diff --git a/codenet/public_test_cases/p00064/output.1.txt b/codenet/public_test_cases/p00064/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..190a18037c64c43e6b11489df4bf0b9eb6d2c9bf --- /dev/null +++ b/codenet/public_test_cases/p00064/output.1.txt @@ -0,0 +1 @@ +123 diff --git a/codenet/public_test_cases/p00065/input.0.txt b/codenet/public_test_cases/p00065/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..450d64895e736ec561b8b78c94ecbe555b895730 --- /dev/null +++ b/codenet/public_test_cases/p00065/input.0.txt @@ -0,0 +1,7 @@ +123,10 +56,12 +34,14 + +123,3 +56,4 +123,5 diff --git a/codenet/public_test_cases/p00065/input.1.txt b/codenet/public_test_cases/p00065/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..450d64895e736ec561b8b78c94ecbe555b895730 --- /dev/null +++ b/codenet/public_test_cases/p00065/input.1.txt @@ -0,0 +1,7 @@ +123,10 +56,12 +34,14 + +123,3 +56,4 +123,5 diff --git a/codenet/public_test_cases/p00065/output.0.txt b/codenet/public_test_cases/p00065/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..929005969ea56ec48b85aec81a8fe0377534da34 --- /dev/null +++ b/codenet/public_test_cases/p00065/output.0.txt @@ -0,0 +1,2 @@ +56 2 +123 3 diff --git a/codenet/public_test_cases/p00065/output.1.txt b/codenet/public_test_cases/p00065/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..929005969ea56ec48b85aec81a8fe0377534da34 --- /dev/null +++ b/codenet/public_test_cases/p00065/output.1.txt @@ -0,0 +1,2 @@ +56 2 +123 3 diff --git a/codenet/public_test_cases/p00066/input.0.txt b/codenet/public_test_cases/p00066/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94d265a9d79a6b77b806e9b9988ba3f35afb97a2 --- /dev/null +++ b/codenet/public_test_cases/p00066/input.0.txt @@ -0,0 +1,3 @@ +ooosxssxs +xoosxsosx +ooxxxooxo diff --git a/codenet/public_test_cases/p00066/input.1.txt b/codenet/public_test_cases/p00066/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94d265a9d79a6b77b806e9b9988ba3f35afb97a2 --- /dev/null +++ b/codenet/public_test_cases/p00066/input.1.txt @@ -0,0 +1,3 @@ +ooosxssxs +xoosxsosx +ooxxxooxo diff --git a/codenet/public_test_cases/p00066/output.0.txt b/codenet/public_test_cases/p00066/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..47500bc7ebe4f299b1f887eee2a1bcfa24f3833a --- /dev/null +++ b/codenet/public_test_cases/p00066/output.0.txt @@ -0,0 +1,3 @@ +o +x +d diff --git a/codenet/public_test_cases/p00066/output.1.txt b/codenet/public_test_cases/p00066/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..47500bc7ebe4f299b1f887eee2a1bcfa24f3833a --- /dev/null +++ b/codenet/public_test_cases/p00066/output.1.txt @@ -0,0 +1,3 @@ +o +x +d diff --git a/codenet/public_test_cases/p00067/input.0.txt b/codenet/public_test_cases/p00067/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7158acec50af9e3f18523e2951c00de48ab8c82d --- /dev/null +++ b/codenet/public_test_cases/p00067/input.0.txt @@ -0,0 +1,38 @@ +111100001111 +111000001111 +110000001111 +100000001111 +000100010000 +000000111000 +000001111100 +100011111110 +110001111100 +111000111000 +111100010000 +000000000000 + +010001111100 +110010000010 +010010000001 +010000000001 +010000000110 +010000111000 +010000000100 +010000000010 +010000000001 +010010000001 +010010000010 +111001111100 + +000000000000 +111111111111 +100010100001 +100010100001 +100010100001 +100010100001 +100100100101 +101000011101 +100000000001 +100000000001 +111111111111 +100000000001 diff --git a/codenet/public_test_cases/p00067/input.1.txt b/codenet/public_test_cases/p00067/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7158acec50af9e3f18523e2951c00de48ab8c82d --- /dev/null +++ b/codenet/public_test_cases/p00067/input.1.txt @@ -0,0 +1,38 @@ +111100001111 +111000001111 +110000001111 +100000001111 +000100010000 +000000111000 +000001111100 +100011111110 +110001111100 +111000111000 +111100010000 +000000000000 + +010001111100 +110010000010 +010010000001 +010000000001 +010000000110 +010000111000 +010000000100 +010000000010 +010000000001 +010010000001 +010010000010 +111001111100 + +000000000000 +111111111111 +100010100001 +100010100001 +100010100001 +100010100001 +100100100101 +101000011101 +100000000001 +100000000001 +111111111111 +100000000001 diff --git a/codenet/public_test_cases/p00067/output.0.txt b/codenet/public_test_cases/p00067/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae14b1a809601f0c48888f33601d0d5a405e53a2 --- /dev/null +++ b/codenet/public_test_cases/p00067/output.0.txt @@ -0,0 +1,3 @@ +5 +13 +4 diff --git a/codenet/public_test_cases/p00067/output.1.txt b/codenet/public_test_cases/p00067/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae14b1a809601f0c48888f33601d0d5a405e53a2 --- /dev/null +++ b/codenet/public_test_cases/p00067/output.1.txt @@ -0,0 +1,3 @@ +5 +13 +4 diff --git a/codenet/public_test_cases/p00068/input.0.txt b/codenet/public_test_cases/p00068/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..faee5d4633f7e3a72f605f0fedbd0f57487983fb --- /dev/null +++ b/codenet/public_test_cases/p00068/input.0.txt @@ -0,0 +1,16 @@ +4 +1.0,0.0 +0.0,1.0 +2.0,1.0 +1.0,2.0 +9 +-509.94,892.63 +567.62,639.99 +-859.32,-64.84 +-445.99,383.69 +667.54,430.49 +551.12,828.21 +-940.2,-877.2 +-361.62,-970 +-125.42,-178.48 +0 diff --git a/codenet/public_test_cases/p00068/input.1.txt b/codenet/public_test_cases/p00068/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..faee5d4633f7e3a72f605f0fedbd0f57487983fb --- /dev/null +++ b/codenet/public_test_cases/p00068/input.1.txt @@ -0,0 +1,16 @@ +4 +1.0,0.0 +0.0,1.0 +2.0,1.0 +1.0,2.0 +9 +-509.94,892.63 +567.62,639.99 +-859.32,-64.84 +-445.99,383.69 +667.54,430.49 +551.12,828.21 +-940.2,-877.2 +-361.62,-970 +-125.42,-178.48 +0 diff --git a/codenet/public_test_cases/p00068/output.0.txt b/codenet/public_test_cases/p00068/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12decc137ab95f0009b32acb6b7f40bd120ca8ad --- /dev/null +++ b/codenet/public_test_cases/p00068/output.0.txt @@ -0,0 +1,2 @@ +0 +3 diff --git a/codenet/public_test_cases/p00068/output.1.txt b/codenet/public_test_cases/p00068/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12decc137ab95f0009b32acb6b7f40bd120ca8ad --- /dev/null +++ b/codenet/public_test_cases/p00068/output.1.txt @@ -0,0 +1,2 @@ +0 +3 diff --git a/codenet/public_test_cases/p00069/input.0.txt b/codenet/public_test_cases/p00069/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b1a5610d2441077226826b2b79affe118892a02 --- /dev/null +++ b/codenet/public_test_cases/p00069/input.0.txt @@ -0,0 +1,14 @@ +5 +2 +3 +9 +1010 +1001 +0100 +1001 +0010 +1000 +0100 +0101 +1010 +0 diff --git a/codenet/public_test_cases/p00069/input.1.txt b/codenet/public_test_cases/p00069/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b1a5610d2441077226826b2b79affe118892a02 --- /dev/null +++ b/codenet/public_test_cases/p00069/input.1.txt @@ -0,0 +1,14 @@ +5 +2 +3 +9 +1010 +1001 +0100 +1001 +0010 +1000 +0100 +0101 +1010 +0 diff --git a/codenet/public_test_cases/p00069/output.0.txt b/codenet/public_test_cases/p00069/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9efb403ac19b10bb1044ee6f241a1af54f353edb --- /dev/null +++ b/codenet/public_test_cases/p00069/output.0.txt @@ -0,0 +1 @@ +6 4 diff --git a/codenet/public_test_cases/p00069/output.1.txt b/codenet/public_test_cases/p00069/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9efb403ac19b10bb1044ee6f241a1af54f353edb --- /dev/null +++ b/codenet/public_test_cases/p00069/output.1.txt @@ -0,0 +1 @@ +6 4 diff --git a/codenet/public_test_cases/p00070/input.0.txt b/codenet/public_test_cases/p00070/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..661d9cc86453988a2e41b67c45c37c99da3f9f7d --- /dev/null +++ b/codenet/public_test_cases/p00070/input.0.txt @@ -0,0 +1,2 @@ +3 10 +3 1 diff --git a/codenet/public_test_cases/p00070/input.1.txt b/codenet/public_test_cases/p00070/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..661d9cc86453988a2e41b67c45c37c99da3f9f7d --- /dev/null +++ b/codenet/public_test_cases/p00070/input.1.txt @@ -0,0 +1,2 @@ +3 10 +3 1 diff --git a/codenet/public_test_cases/p00070/output.0.txt b/codenet/public_test_cases/p00070/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9807191ab0a725715beff8f74c1b49fe8dd17e59 --- /dev/null +++ b/codenet/public_test_cases/p00070/output.0.txt @@ -0,0 +1,2 @@ +8 +0 diff --git a/codenet/public_test_cases/p00070/output.1.txt b/codenet/public_test_cases/p00070/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9807191ab0a725715beff8f74c1b49fe8dd17e59 --- /dev/null +++ b/codenet/public_test_cases/p00070/output.1.txt @@ -0,0 +1,2 @@ +8 +0 diff --git a/codenet/public_test_cases/p00071/input.0.txt b/codenet/public_test_cases/p00071/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae126fd241e0539b8561b00f1db0af49b3e2610a --- /dev/null +++ b/codenet/public_test_cases/p00071/input.0.txt @@ -0,0 +1,23 @@ +2 + +00010010 +00000100 +10001001 +00100010 +01000000 +00001000 +10100010 +01010010 +2 +5 + +00010010 +00000100 +10001001 +00100010 +01000000 +00001000 +10100010 +01010010 +2 +5 diff --git a/codenet/public_test_cases/p00071/input.1.txt b/codenet/public_test_cases/p00071/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae126fd241e0539b8561b00f1db0af49b3e2610a --- /dev/null +++ b/codenet/public_test_cases/p00071/input.1.txt @@ -0,0 +1,23 @@ +2 + +00010010 +00000100 +10001001 +00100010 +01000000 +00001000 +10100010 +01010010 +2 +5 + +00010010 +00000100 +10001001 +00100010 +01000000 +00001000 +10100010 +01010010 +2 +5 diff --git a/codenet/public_test_cases/p00071/output.0.txt b/codenet/public_test_cases/p00071/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..357ef471ccc7ae97489a0ae9578c30deebba74db --- /dev/null +++ b/codenet/public_test_cases/p00071/output.0.txt @@ -0,0 +1,18 @@ +Data 1: +00000000 +00000100 +10001001 +00100000 +00000000 +00001000 +10100000 +00000000 +Data 2: +00000000 +00000100 +10001001 +00100000 +00000000 +00001000 +10100000 +00000000 diff --git a/codenet/public_test_cases/p00071/output.1.txt b/codenet/public_test_cases/p00071/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..357ef471ccc7ae97489a0ae9578c30deebba74db --- /dev/null +++ b/codenet/public_test_cases/p00071/output.1.txt @@ -0,0 +1,18 @@ +Data 1: +00000000 +00000100 +10001001 +00100000 +00000000 +00001000 +10100000 +00000000 +Data 2: +00000000 +00000100 +10001001 +00100000 +00000000 +00001000 +10100000 +00000000 diff --git a/codenet/public_test_cases/p00072/input.0.txt b/codenet/public_test_cases/p00072/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60cb444cb44f27a72b60a55d29baddfa88129747 --- /dev/null +++ b/codenet/public_test_cases/p00072/input.0.txt @@ -0,0 +1,7 @@ +4 +4 +0,1,1500 +0,2,2000 +1,2,600 +1,3,500 +0 diff --git a/codenet/public_test_cases/p00072/input.1.txt b/codenet/public_test_cases/p00072/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60cb444cb44f27a72b60a55d29baddfa88129747 --- /dev/null +++ b/codenet/public_test_cases/p00072/input.1.txt @@ -0,0 +1,7 @@ +4 +4 +0,1,1500 +0,2,2000 +1,2,600 +1,3,500 +0 diff --git a/codenet/public_test_cases/p00072/output.0.txt b/codenet/public_test_cases/p00072/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p00072/output.0.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p00072/output.1.txt b/codenet/public_test_cases/p00072/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p00072/output.1.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p00073/input.0.txt b/codenet/public_test_cases/p00073/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac5f12934a162cdf03b17e78753438c85a5bfa61 --- /dev/null +++ b/codenet/public_test_cases/p00073/input.0.txt @@ -0,0 +1,6 @@ +6 +4 +7 +9 +0 +0 diff --git a/codenet/public_test_cases/p00073/input.1.txt b/codenet/public_test_cases/p00073/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac5f12934a162cdf03b17e78753438c85a5bfa61 --- /dev/null +++ b/codenet/public_test_cases/p00073/input.1.txt @@ -0,0 +1,6 @@ +6 +4 +7 +9 +0 +0 diff --git a/codenet/public_test_cases/p00073/output.0.txt b/codenet/public_test_cases/p00073/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cb3644f72319e31e2dece495a5eb43ffa24bd2f --- /dev/null +++ b/codenet/public_test_cases/p00073/output.0.txt @@ -0,0 +1,2 @@ +96.000000 +184.192455 diff --git a/codenet/public_test_cases/p00073/output.1.txt b/codenet/public_test_cases/p00073/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cb3644f72319e31e2dece495a5eb43ffa24bd2f --- /dev/null +++ b/codenet/public_test_cases/p00073/output.1.txt @@ -0,0 +1,2 @@ +96.000000 +184.192455 diff --git a/codenet/public_test_cases/p00074/input.0.txt b/codenet/public_test_cases/p00074/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..471df12567c0dc296fafd911bf1ab7854868ce75 --- /dev/null +++ b/codenet/public_test_cases/p00074/input.0.txt @@ -0,0 +1,2 @@ +1 30 0 +-1 -1 -1 diff --git a/codenet/public_test_cases/p00074/input.1.txt b/codenet/public_test_cases/p00074/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..471df12567c0dc296fafd911bf1ab7854868ce75 --- /dev/null +++ b/codenet/public_test_cases/p00074/input.1.txt @@ -0,0 +1,2 @@ +1 30 0 +-1 -1 -1 diff --git a/codenet/public_test_cases/p00074/output.0.txt b/codenet/public_test_cases/p00074/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ae3394bc754d399b52214a5ef514b323975607a --- /dev/null +++ b/codenet/public_test_cases/p00074/output.0.txt @@ -0,0 +1,2 @@ +00:30:00 +01:30:00 diff --git a/codenet/public_test_cases/p00074/output.1.txt b/codenet/public_test_cases/p00074/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ae3394bc754d399b52214a5ef514b323975607a --- /dev/null +++ b/codenet/public_test_cases/p00074/output.1.txt @@ -0,0 +1,2 @@ +00:30:00 +01:30:00 diff --git a/codenet/public_test_cases/p00075/input.0.txt b/codenet/public_test_cases/p00075/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef4ac5bf08e93c5317221e6d63f5a080ff701a6b --- /dev/null +++ b/codenet/public_test_cases/p00075/input.0.txt @@ -0,0 +1,5 @@ +1001,50.0,1.60 +1002,60.0,1.70 +1003,70.0,1.80 +1004,80.0,1.70 +1005,90.0,1.60 diff --git a/codenet/public_test_cases/p00075/input.1.txt b/codenet/public_test_cases/p00075/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef4ac5bf08e93c5317221e6d63f5a080ff701a6b --- /dev/null +++ b/codenet/public_test_cases/p00075/input.1.txt @@ -0,0 +1,5 @@ +1001,50.0,1.60 +1002,60.0,1.70 +1003,70.0,1.80 +1004,80.0,1.70 +1005,90.0,1.60 diff --git a/codenet/public_test_cases/p00075/output.0.txt b/codenet/public_test_cases/p00075/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef99b311e532d0c1d3e361939dc8ce32e875c5de --- /dev/null +++ b/codenet/public_test_cases/p00075/output.0.txt @@ -0,0 +1,2 @@ +1004 +1005 diff --git a/codenet/public_test_cases/p00075/output.1.txt b/codenet/public_test_cases/p00075/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef99b311e532d0c1d3e361939dc8ce32e875c5de --- /dev/null +++ b/codenet/public_test_cases/p00075/output.1.txt @@ -0,0 +1,2 @@ +1004 +1005 diff --git a/codenet/public_test_cases/p00076/input.0.txt b/codenet/public_test_cases/p00076/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7826a91b3b070cd1d914b83865910540d71add17 --- /dev/null +++ b/codenet/public_test_cases/p00076/input.0.txt @@ -0,0 +1,3 @@ +3 +6 +-1 diff --git a/codenet/public_test_cases/p00076/input.1.txt b/codenet/public_test_cases/p00076/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7826a91b3b070cd1d914b83865910540d71add17 --- /dev/null +++ b/codenet/public_test_cases/p00076/input.1.txt @@ -0,0 +1,3 @@ +3 +6 +-1 diff --git a/codenet/public_test_cases/p00076/output.0.txt b/codenet/public_test_cases/p00076/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4cc3c8f1e6c31c91defe6a5bd1177ed4ddc7dafe --- /dev/null +++ b/codenet/public_test_cases/p00076/output.0.txt @@ -0,0 +1,4 @@ +0.29 +1.71 +-2.31 +0.80 diff --git a/codenet/public_test_cases/p00076/output.1.txt b/codenet/public_test_cases/p00076/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4cc3c8f1e6c31c91defe6a5bd1177ed4ddc7dafe --- /dev/null +++ b/codenet/public_test_cases/p00076/output.1.txt @@ -0,0 +1,4 @@ +0.29 +1.71 +-2.31 +0.80 diff --git a/codenet/public_test_cases/p00077/input.0.txt b/codenet/public_test_cases/p00077/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6371034966f144daad0b14363f5944bdab532879 --- /dev/null +++ b/codenet/public_test_cases/p00077/input.0.txt @@ -0,0 +1,2 @@ +ab@5C1@8050 +@99+1=1@90 diff --git a/codenet/public_test_cases/p00077/input.1.txt b/codenet/public_test_cases/p00077/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6371034966f144daad0b14363f5944bdab532879 --- /dev/null +++ b/codenet/public_test_cases/p00077/input.1.txt @@ -0,0 +1,2 @@ +ab@5C1@8050 +@99+1=1@90 diff --git a/codenet/public_test_cases/p00077/output.0.txt b/codenet/public_test_cases/p00077/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fafbadf76dc68213788b7f0f933a288d8bcf51c7 --- /dev/null +++ b/codenet/public_test_cases/p00077/output.0.txt @@ -0,0 +1,2 @@ +abCCCCC10000000050 +999999999+1=1000000000 diff --git a/codenet/public_test_cases/p00077/output.1.txt b/codenet/public_test_cases/p00077/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fafbadf76dc68213788b7f0f933a288d8bcf51c7 --- /dev/null +++ b/codenet/public_test_cases/p00077/output.1.txt @@ -0,0 +1,2 @@ +abCCCCC10000000050 +999999999+1=1000000000 diff --git a/codenet/public_test_cases/p00078/input.0.txt b/codenet/public_test_cases/p00078/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ab00536a9db6a73ce9aa7bd2ecc2df36d5ec678 --- /dev/null +++ b/codenet/public_test_cases/p00078/input.0.txt @@ -0,0 +1,3 @@ +3 +5 +0 diff --git a/codenet/public_test_cases/p00078/input.1.txt b/codenet/public_test_cases/p00078/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ab00536a9db6a73ce9aa7bd2ecc2df36d5ec678 --- /dev/null +++ b/codenet/public_test_cases/p00078/input.1.txt @@ -0,0 +1,3 @@ +3 +5 +0 diff --git a/codenet/public_test_cases/p00078/output.0.txt b/codenet/public_test_cases/p00078/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..977abea9c398f867226b41832316b57191e385de --- /dev/null +++ b/codenet/public_test_cases/p00078/output.0.txt @@ -0,0 +1,8 @@ + 4 9 2 + 3 5 7 + 8 1 6 + 11 24 7 20 3 + 4 12 25 8 16 + 17 5 13 21 9 + 10 18 1 14 22 + 23 6 19 2 15 diff --git a/codenet/public_test_cases/p00078/output.1.txt b/codenet/public_test_cases/p00078/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b22588ce6b6cfe88b4b4a1bdab9cb0e54cfef9c5 --- /dev/null +++ b/codenet/public_test_cases/p00078/output.1.txt @@ -0,0 +1,8 @@ +4 9 2 + 3 5 7 + 8 1 6 + 11 24 7 20 3 + 4 12 25 8 16 + 17 5 13 21 9 + 10 18 1 14 22 + 23 6 19 2 15 diff --git a/codenet/public_test_cases/p00079/input.0.txt b/codenet/public_test_cases/p00079/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7222396379b5c7edd0519202db1d06838aeda55 --- /dev/null +++ b/codenet/public_test_cases/p00079/input.0.txt @@ -0,0 +1,5 @@ +0.0,0.0 +0.0,1.0 +1.0,1.0 +2.0,0.0 +1.0,-1.0 diff --git a/codenet/public_test_cases/p00079/input.1.txt b/codenet/public_test_cases/p00079/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7222396379b5c7edd0519202db1d06838aeda55 --- /dev/null +++ b/codenet/public_test_cases/p00079/input.1.txt @@ -0,0 +1,5 @@ +0.0,0.0 +0.0,1.0 +1.0,1.0 +2.0,0.0 +1.0,-1.0 diff --git a/codenet/public_test_cases/p00079/output.0.txt b/codenet/public_test_cases/p00079/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74886823d19a013778633d54d37dcfc88d424928 --- /dev/null +++ b/codenet/public_test_cases/p00079/output.0.txt @@ -0,0 +1 @@ +2.500000 diff --git a/codenet/public_test_cases/p00079/output.1.txt b/codenet/public_test_cases/p00079/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74886823d19a013778633d54d37dcfc88d424928 --- /dev/null +++ b/codenet/public_test_cases/p00079/output.1.txt @@ -0,0 +1 @@ +2.500000 diff --git a/codenet/public_test_cases/p00080/input.0.txt b/codenet/public_test_cases/p00080/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..658074f11852085f0f78a52ac3843b596ce6f222 --- /dev/null +++ b/codenet/public_test_cases/p00080/input.0.txt @@ -0,0 +1,3 @@ +15 +15 +-1 diff --git a/codenet/public_test_cases/p00080/input.1.txt b/codenet/public_test_cases/p00080/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..658074f11852085f0f78a52ac3843b596ce6f222 --- /dev/null +++ b/codenet/public_test_cases/p00080/input.1.txt @@ -0,0 +1,3 @@ +15 +15 +-1 diff --git a/codenet/public_test_cases/p00080/output.0.txt b/codenet/public_test_cases/p00080/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e71424c98df6625562e9c1c8814e37cd210a338b --- /dev/null +++ b/codenet/public_test_cases/p00080/output.0.txt @@ -0,0 +1,2 @@ +2.466212 +2.466212 diff --git a/codenet/public_test_cases/p00080/output.1.txt b/codenet/public_test_cases/p00080/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e71424c98df6625562e9c1c8814e37cd210a338b --- /dev/null +++ b/codenet/public_test_cases/p00080/output.1.txt @@ -0,0 +1,2 @@ +2.466212 +2.466212 diff --git a/codenet/public_test_cases/p00081/input.0.txt b/codenet/public_test_cases/p00081/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9582fac3c0613dba8adde3d4cbb747b1aa096ec6 --- /dev/null +++ b/codenet/public_test_cases/p00081/input.0.txt @@ -0,0 +1,3 @@ +1.0,0.0,-1.0,0.0,1.0,1.0 +1.0,0.0,0.0,-1.0,3.0,0.0 +0.0,1.0,0.0,-1.0,1.0,1.0 diff --git a/codenet/public_test_cases/p00081/input.1.txt b/codenet/public_test_cases/p00081/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9582fac3c0613dba8adde3d4cbb747b1aa096ec6 --- /dev/null +++ b/codenet/public_test_cases/p00081/input.1.txt @@ -0,0 +1,3 @@ +1.0,0.0,-1.0,0.0,1.0,1.0 +1.0,0.0,0.0,-1.0,3.0,0.0 +0.0,1.0,0.0,-1.0,1.0,1.0 diff --git a/codenet/public_test_cases/p00081/output.0.txt b/codenet/public_test_cases/p00081/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8f417f23d515566faba47760cc707387739078c --- /dev/null +++ b/codenet/public_test_cases/p00081/output.0.txt @@ -0,0 +1,3 @@ +1.000000 -1.000000 +1.000000 2.000000 +-1.000000 1.000000 diff --git a/codenet/public_test_cases/p00081/output.1.txt b/codenet/public_test_cases/p00081/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8f417f23d515566faba47760cc707387739078c --- /dev/null +++ b/codenet/public_test_cases/p00081/output.1.txt @@ -0,0 +1,3 @@ +1.000000 -1.000000 +1.000000 2.000000 +-1.000000 1.000000 diff --git a/codenet/public_test_cases/p00082/input.0.txt b/codenet/public_test_cases/p00082/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcfe38054c1a4ae721a953a6ba3c6c69ad0f6822 --- /dev/null +++ b/codenet/public_test_cases/p00082/input.0.txt @@ -0,0 +1,2 @@ +2 3 1 4 0 1 0 1 +4 2 3 2 2 2 1 1 diff --git a/codenet/public_test_cases/p00082/input.1.txt b/codenet/public_test_cases/p00082/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcfe38054c1a4ae721a953a6ba3c6c69ad0f6822 --- /dev/null +++ b/codenet/public_test_cases/p00082/input.1.txt @@ -0,0 +1,2 @@ +2 3 1 4 0 1 0 1 +4 2 3 2 2 2 1 1 diff --git a/codenet/public_test_cases/p00082/output.0.txt b/codenet/public_test_cases/p00082/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..070888721af44dd82be68053ebaefc42868f2810 --- /dev/null +++ b/codenet/public_test_cases/p00082/output.0.txt @@ -0,0 +1,2 @@ +1 4 1 4 1 2 1 2 +4 1 4 1 2 1 2 1 diff --git a/codenet/public_test_cases/p00082/output.1.txt b/codenet/public_test_cases/p00082/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..070888721af44dd82be68053ebaefc42868f2810 --- /dev/null +++ b/codenet/public_test_cases/p00082/output.1.txt @@ -0,0 +1,2 @@ +1 4 1 4 1 2 1 2 +4 1 4 1 2 1 2 1 diff --git a/codenet/public_test_cases/p00083/input.0.txt b/codenet/public_test_cases/p00083/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dce723e968466274161f8bc875a04439a843399c --- /dev/null +++ b/codenet/public_test_cases/p00083/input.0.txt @@ -0,0 +1,3 @@ +2005 9 3 +1868 12 2 +1868 9 7 diff --git a/codenet/public_test_cases/p00083/input.1.txt b/codenet/public_test_cases/p00083/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dce723e968466274161f8bc875a04439a843399c --- /dev/null +++ b/codenet/public_test_cases/p00083/input.1.txt @@ -0,0 +1,3 @@ +2005 9 3 +1868 12 2 +1868 9 7 diff --git a/codenet/public_test_cases/p00083/output.0.txt b/codenet/public_test_cases/p00083/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..86130e1cbde2a66d736c068fbe449606dacd84bd --- /dev/null +++ b/codenet/public_test_cases/p00083/output.0.txt @@ -0,0 +1,3 @@ +heisei 17 9 3 +meiji 1 12 2 +pre-meiji diff --git a/codenet/public_test_cases/p00083/output.1.txt b/codenet/public_test_cases/p00083/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86130e1cbde2a66d736c068fbe449606dacd84bd --- /dev/null +++ b/codenet/public_test_cases/p00083/output.1.txt @@ -0,0 +1,3 @@ +heisei 17 9 3 +meiji 1 12 2 +pre-meiji diff --git a/codenet/public_test_cases/p00084/input.0.txt b/codenet/public_test_cases/p00084/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e708f84757d3cb531c1416fdb20bfdb6c81ad48e --- /dev/null +++ b/codenet/public_test_cases/p00084/input.0.txt @@ -0,0 +1 @@ +Rain, rain, go to Spain. diff --git a/codenet/public_test_cases/p00084/input.1.txt b/codenet/public_test_cases/p00084/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae1e466b5e0ab4ceb5b3fbc03afed4310d77f969 --- /dev/null +++ b/codenet/public_test_cases/p00084/input.1.txt @@ -0,0 +1 @@ +Win today's preliminary contest and be qualified to visit University of Aizu. diff --git a/codenet/public_test_cases/p00084/input.2.txt b/codenet/public_test_cases/p00084/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e708f84757d3cb531c1416fdb20bfdb6c81ad48e --- /dev/null +++ b/codenet/public_test_cases/p00084/input.2.txt @@ -0,0 +1 @@ +Rain, rain, go to Spain. diff --git a/codenet/public_test_cases/p00084/output.0.txt b/codenet/public_test_cases/p00084/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ebc101b8c068919715e09d899ea5eae8e38eb05 --- /dev/null +++ b/codenet/public_test_cases/p00084/output.0.txt @@ -0,0 +1 @@ +Rain rain Spain diff --git a/codenet/public_test_cases/p00084/output.1.txt b/codenet/public_test_cases/p00084/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de69890fb8b02561dd7329cfe4e2cc22ae2ec01c --- /dev/null +++ b/codenet/public_test_cases/p00084/output.1.txt @@ -0,0 +1 @@ +Win and visit Aizu diff --git a/codenet/public_test_cases/p00084/output.2.txt b/codenet/public_test_cases/p00084/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ebc101b8c068919715e09d899ea5eae8e38eb05 --- /dev/null +++ b/codenet/public_test_cases/p00084/output.2.txt @@ -0,0 +1 @@ +Rain rain Spain diff --git a/codenet/public_test_cases/p00085/input.0.txt b/codenet/public_test_cases/p00085/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..22e86dde405e53d0113f4dffa6a3a6adcfacc703 --- /dev/null +++ b/codenet/public_test_cases/p00085/input.0.txt @@ -0,0 +1,3 @@ +41 3 +30 9 +0 0 diff --git a/codenet/public_test_cases/p00085/input.1.txt b/codenet/public_test_cases/p00085/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..22e86dde405e53d0113f4dffa6a3a6adcfacc703 --- /dev/null +++ b/codenet/public_test_cases/p00085/input.1.txt @@ -0,0 +1,3 @@ +41 3 +30 9 +0 0 diff --git a/codenet/public_test_cases/p00085/output.0.txt b/codenet/public_test_cases/p00085/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9caf223f8ab14ab805721131703e73f4d6ffb99 --- /dev/null +++ b/codenet/public_test_cases/p00085/output.0.txt @@ -0,0 +1,2 @@ +31 +21 diff --git a/codenet/public_test_cases/p00085/output.1.txt b/codenet/public_test_cases/p00085/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9caf223f8ab14ab805721131703e73f4d6ffb99 --- /dev/null +++ b/codenet/public_test_cases/p00085/output.1.txt @@ -0,0 +1,2 @@ +31 +21 diff --git a/codenet/public_test_cases/p00086/input.0.txt b/codenet/public_test_cases/p00086/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..753ce03b5b39a8e556dff1324f87a97d2bf91dd8 --- /dev/null +++ b/codenet/public_test_cases/p00086/input.0.txt @@ -0,0 +1,22 @@ +1 3 +3 4 +3 5 +3 6 +4 6 +4 7 +4 7 +5 6 +6 7 +5 8 +5 8 +6 8 +6 9 +7 9 +8 9 +9 2 +0 0 +1 3 +3 4 +3 4 +4 2 +0 0 diff --git a/codenet/public_test_cases/p00086/input.1.txt b/codenet/public_test_cases/p00086/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..753ce03b5b39a8e556dff1324f87a97d2bf91dd8 --- /dev/null +++ b/codenet/public_test_cases/p00086/input.1.txt @@ -0,0 +1,22 @@ +1 3 +3 4 +3 5 +3 6 +4 6 +4 7 +4 7 +5 6 +6 7 +5 8 +5 8 +6 8 +6 9 +7 9 +8 9 +9 2 +0 0 +1 3 +3 4 +3 4 +4 2 +0 0 diff --git a/codenet/public_test_cases/p00086/output.0.txt b/codenet/public_test_cases/p00086/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14b51739d7a3a392ce92a7cf76c0211e0cc3cc35 --- /dev/null +++ b/codenet/public_test_cases/p00086/output.0.txt @@ -0,0 +1,2 @@ +OK +NG diff --git a/codenet/public_test_cases/p00086/output.1.txt b/codenet/public_test_cases/p00086/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14b51739d7a3a392ce92a7cf76c0211e0cc3cc35 --- /dev/null +++ b/codenet/public_test_cases/p00086/output.1.txt @@ -0,0 +1,2 @@ +OK +NG diff --git a/codenet/public_test_cases/p00087/input.0.txt b/codenet/public_test_cases/p00087/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eae834da36897efdfe70a27c1419e1d144f9e1c1 --- /dev/null +++ b/codenet/public_test_cases/p00087/input.0.txt @@ -0,0 +1,3 @@ +10 2 12 - / +3 4 - 7 2 3 * + * +-1 -2 3 + + diff --git a/codenet/public_test_cases/p00087/input.1.txt b/codenet/public_test_cases/p00087/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eae834da36897efdfe70a27c1419e1d144f9e1c1 --- /dev/null +++ b/codenet/public_test_cases/p00087/input.1.txt @@ -0,0 +1,3 @@ +10 2 12 - / +3 4 - 7 2 3 * + * +-1 -2 3 + + diff --git a/codenet/public_test_cases/p00087/output.0.txt b/codenet/public_test_cases/p00087/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fefa4c9f8a3e9f9a0d066f901768d3eee350c006 --- /dev/null +++ b/codenet/public_test_cases/p00087/output.0.txt @@ -0,0 +1,3 @@ +-1.000000 +-13.000000 +0.000000 diff --git a/codenet/public_test_cases/p00087/output.1.txt b/codenet/public_test_cases/p00087/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fefa4c9f8a3e9f9a0d066f901768d3eee350c006 --- /dev/null +++ b/codenet/public_test_cases/p00087/output.1.txt @@ -0,0 +1,3 @@ +-1.000000 +-13.000000 +0.000000 diff --git a/codenet/public_test_cases/p00088/input.0.txt b/codenet/public_test_cases/p00088/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a0c28d36ab6c9664fabfa51f5ebb95d0e62bb34 --- /dev/null +++ b/codenet/public_test_cases/p00088/input.0.txt @@ -0,0 +1 @@ +PETER POTTER diff --git a/codenet/public_test_cases/p00088/input.1.txt b/codenet/public_test_cases/p00088/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a0c28d36ab6c9664fabfa51f5ebb95d0e62bb34 --- /dev/null +++ b/codenet/public_test_cases/p00088/input.1.txt @@ -0,0 +1 @@ +PETER POTTER diff --git a/codenet/public_test_cases/p00088/output.0.txt b/codenet/public_test_cases/p00088/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9a1deb901eea850ad181140caf6c07663f16b2d --- /dev/null +++ b/codenet/public_test_cases/p00088/output.0.txt @@ -0,0 +1 @@ +?D-C'KOPUA diff --git a/codenet/public_test_cases/p00088/output.1.txt b/codenet/public_test_cases/p00088/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9a1deb901eea850ad181140caf6c07663f16b2d --- /dev/null +++ b/codenet/public_test_cases/p00088/output.1.txt @@ -0,0 +1 @@ +?D-C'KOPUA diff --git a/codenet/public_test_cases/p00089/input.0.txt b/codenet/public_test_cases/p00089/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a2d6c99361c624ea8ecb9637dfca7d5c6507f11 --- /dev/null +++ b/codenet/public_test_cases/p00089/input.0.txt @@ -0,0 +1,9 @@ +7 +3,8 +8,1,0 +2,7,4,4 +4,5,2,6,5 +2,7,4,4 +8,1,0 +3,8 +7 diff --git a/codenet/public_test_cases/p00089/input.1.txt b/codenet/public_test_cases/p00089/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a2d6c99361c624ea8ecb9637dfca7d5c6507f11 --- /dev/null +++ b/codenet/public_test_cases/p00089/input.1.txt @@ -0,0 +1,9 @@ +7 +3,8 +8,1,0 +2,7,4,4 +4,5,2,6,5 +2,7,4,4 +8,1,0 +3,8 +7 diff --git a/codenet/public_test_cases/p00089/output.0.txt b/codenet/public_test_cases/p00089/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3f407c0955bb5738e40a82664c79b63f04a9adb --- /dev/null +++ b/codenet/public_test_cases/p00089/output.0.txt @@ -0,0 +1 @@ +55 diff --git a/codenet/public_test_cases/p00089/output.1.txt b/codenet/public_test_cases/p00089/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3f407c0955bb5738e40a82664c79b63f04a9adb --- /dev/null +++ b/codenet/public_test_cases/p00089/output.1.txt @@ -0,0 +1 @@ +55 diff --git a/codenet/public_test_cases/p00090/input.0.txt b/codenet/public_test_cases/p00090/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f49809dfcc1fd4fb2991d6f386debbd6afa80de7 --- /dev/null +++ b/codenet/public_test_cases/p00090/input.0.txt @@ -0,0 +1,17 @@ +15 +3.14979,8.51743 +2.39506,3.84915 +2.68432,5.39095 +5.61904,9.16332 +7.85653,4.75593 +2.84021,5.41511 +1.79500,8.59211 +7.55389,8.17604 +4.70665,4.66125 +1.63470,4.42538 +7.34959,4.61981 +5.09003,8.11122 +5.24373,1.30066 +0.13517,1.83659 +7.57313,1.58150 +0 diff --git a/codenet/public_test_cases/p00090/input.1.txt b/codenet/public_test_cases/p00090/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f49809dfcc1fd4fb2991d6f386debbd6afa80de7 --- /dev/null +++ b/codenet/public_test_cases/p00090/input.1.txt @@ -0,0 +1,17 @@ +15 +3.14979,8.51743 +2.39506,3.84915 +2.68432,5.39095 +5.61904,9.16332 +7.85653,4.75593 +2.84021,5.41511 +1.79500,8.59211 +7.55389,8.17604 +4.70665,4.66125 +1.63470,4.42538 +7.34959,4.61981 +5.09003,8.11122 +5.24373,1.30066 +0.13517,1.83659 +7.57313,1.58150 +0 diff --git a/codenet/public_test_cases/p00090/output.0.txt b/codenet/public_test_cases/p00090/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00090/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00090/output.1.txt b/codenet/public_test_cases/p00090/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00090/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00091/input.0.txt b/codenet/public_test_cases/p00091/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..277b3caf8b1056cd1d8ecbf74a508a23685446a6 --- /dev/null +++ b/codenet/public_test_cases/p00091/input.0.txt @@ -0,0 +1,11 @@ +2 +0 0 0 0 0 0 0 0 0 0 +0 0 0 1 0 0 0 0 0 0 +0 0 1 1 1 0 0 0 0 0 +0 0 0 1 0 0 0 1 1 1 +0 0 0 0 0 0 0 1 1 1 +0 0 0 0 0 0 0 1 1 1 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00091/input.1.txt b/codenet/public_test_cases/p00091/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..277b3caf8b1056cd1d8ecbf74a508a23685446a6 --- /dev/null +++ b/codenet/public_test_cases/p00091/input.1.txt @@ -0,0 +1,11 @@ +2 +0 0 0 0 0 0 0 0 0 0 +0 0 0 1 0 0 0 0 0 0 +0 0 1 1 1 0 0 0 0 0 +0 0 0 1 0 0 0 1 1 1 +0 0 0 0 0 0 0 1 1 1 +0 0 0 0 0 0 0 1 1 1 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00091/output.0.txt b/codenet/public_test_cases/p00091/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dde248fd1c32a7b2e44475ed1d8930786839ad0 --- /dev/null +++ b/codenet/public_test_cases/p00091/output.0.txt @@ -0,0 +1,2 @@ +3 2 1 +8 4 2 diff --git a/codenet/public_test_cases/p00091/output.1.txt b/codenet/public_test_cases/p00091/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dde248fd1c32a7b2e44475ed1d8930786839ad0 --- /dev/null +++ b/codenet/public_test_cases/p00091/output.1.txt @@ -0,0 +1,2 @@ +3 2 1 +8 4 2 diff --git a/codenet/public_test_cases/p00092/input.0.txt b/codenet/public_test_cases/p00092/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d0df507425359d6ffd639222590e50d7f53c243 --- /dev/null +++ b/codenet/public_test_cases/p00092/input.0.txt @@ -0,0 +1,23 @@ +10 +...*....** +.......... +**....**.. +........*. +..*....... +.......... +.*........ +.......... +....*..*** +.*....*... +10 +****.***** +*..*.*.... +****.*.... +*....*.... +*....***** +.......... +****.***** +*..*...*.. +****...*.. +*..*...*.. +0 diff --git a/codenet/public_test_cases/p00092/input.1.txt b/codenet/public_test_cases/p00092/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d0df507425359d6ffd639222590e50d7f53c243 --- /dev/null +++ b/codenet/public_test_cases/p00092/input.1.txt @@ -0,0 +1,23 @@ +10 +...*....** +.......... +**....**.. +........*. +..*....... +.......... +.*........ +.......... +....*..*** +.*....*... +10 +****.***** +*..*.*.... +****.*.... +*....*.... +*....***** +.......... +****.***** +*..*...*.. +****...*.. +*..*...*.. +0 diff --git a/codenet/public_test_cases/p00092/output.0.txt b/codenet/public_test_cases/p00092/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c1a16947c33733f06d0fc68fea007b475eb2ba1 --- /dev/null +++ b/codenet/public_test_cases/p00092/output.0.txt @@ -0,0 +1,2 @@ +5 +3 diff --git a/codenet/public_test_cases/p00092/output.1.txt b/codenet/public_test_cases/p00092/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c1a16947c33733f06d0fc68fea007b475eb2ba1 --- /dev/null +++ b/codenet/public_test_cases/p00092/output.1.txt @@ -0,0 +1,2 @@ +5 +3 diff --git a/codenet/public_test_cases/p00093/input.0.txt b/codenet/public_test_cases/p00093/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4e9f045c3a3b98d5c990983107d0312176f9efe --- /dev/null +++ b/codenet/public_test_cases/p00093/input.0.txt @@ -0,0 +1,4 @@ +2001 2010 +2005 2005 +2001 2010 +0 0 diff --git a/codenet/public_test_cases/p00093/input.1.txt b/codenet/public_test_cases/p00093/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4e9f045c3a3b98d5c990983107d0312176f9efe --- /dev/null +++ b/codenet/public_test_cases/p00093/input.1.txt @@ -0,0 +1,4 @@ +2001 2010 +2005 2005 +2001 2010 +0 0 diff --git a/codenet/public_test_cases/p00093/output.0.txt b/codenet/public_test_cases/p00093/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f442737a1e6a47ed9d0fabfe710f4d5f2b4f9784 --- /dev/null +++ b/codenet/public_test_cases/p00093/output.0.txt @@ -0,0 +1,7 @@ +2004 +2008 + +NA + +2004 +2008 diff --git a/codenet/public_test_cases/p00093/output.1.txt b/codenet/public_test_cases/p00093/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f442737a1e6a47ed9d0fabfe710f4d5f2b4f9784 --- /dev/null +++ b/codenet/public_test_cases/p00093/output.1.txt @@ -0,0 +1,7 @@ +2004 +2008 + +NA + +2004 +2008 diff --git a/codenet/public_test_cases/p00094/input.0.txt b/codenet/public_test_cases/p00094/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5208477395b2ec61350fbc16491ed7241f7bf1 --- /dev/null +++ b/codenet/public_test_cases/p00094/input.0.txt @@ -0,0 +1 @@ +15 25 diff --git a/codenet/public_test_cases/p00094/input.1.txt b/codenet/public_test_cases/p00094/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5208477395b2ec61350fbc16491ed7241f7bf1 --- /dev/null +++ b/codenet/public_test_cases/p00094/input.1.txt @@ -0,0 +1 @@ +15 25 diff --git a/codenet/public_test_cases/p00094/output.0.txt b/codenet/public_test_cases/p00094/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3e5ce9c3a38c2b9464b2a2d5298b357471fe9a0 --- /dev/null +++ b/codenet/public_test_cases/p00094/output.0.txt @@ -0,0 +1 @@ +113.437508 diff --git a/codenet/public_test_cases/p00094/output.1.txt b/codenet/public_test_cases/p00094/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3e5ce9c3a38c2b9464b2a2d5298b357471fe9a0 --- /dev/null +++ b/codenet/public_test_cases/p00094/output.1.txt @@ -0,0 +1 @@ +113.437508 diff --git a/codenet/public_test_cases/p00095/input.0.txt b/codenet/public_test_cases/p00095/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecd37e0df4effdbd01ac9ba87807a297e74efa43 --- /dev/null +++ b/codenet/public_test_cases/p00095/input.0.txt @@ -0,0 +1,7 @@ +6 +1 14 +2 25 +3 42 +4 11 +5 40 +6 37 diff --git a/codenet/public_test_cases/p00095/input.1.txt b/codenet/public_test_cases/p00095/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecd37e0df4effdbd01ac9ba87807a297e74efa43 --- /dev/null +++ b/codenet/public_test_cases/p00095/input.1.txt @@ -0,0 +1,7 @@ +6 +1 14 +2 25 +3 42 +4 11 +5 40 +6 37 diff --git a/codenet/public_test_cases/p00095/output.0.txt b/codenet/public_test_cases/p00095/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f45c312e05fba5d6c85266c17cf6c6e9310591a9 --- /dev/null +++ b/codenet/public_test_cases/p00095/output.0.txt @@ -0,0 +1 @@ +3 42 diff --git a/codenet/public_test_cases/p00095/output.1.txt b/codenet/public_test_cases/p00095/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f45c312e05fba5d6c85266c17cf6c6e9310591a9 --- /dev/null +++ b/codenet/public_test_cases/p00095/output.1.txt @@ -0,0 +1 @@ +3 42 diff --git a/codenet/public_test_cases/p00096/input.0.txt b/codenet/public_test_cases/p00096/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..256600b3f7c864b9a77d7cc84d76f0ab31394a05 --- /dev/null +++ b/codenet/public_test_cases/p00096/input.0.txt @@ -0,0 +1,3 @@ +2 +3 +35 diff --git a/codenet/public_test_cases/p00096/input.1.txt b/codenet/public_test_cases/p00096/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..256600b3f7c864b9a77d7cc84d76f0ab31394a05 --- /dev/null +++ b/codenet/public_test_cases/p00096/input.1.txt @@ -0,0 +1,3 @@ +2 +3 +35 diff --git a/codenet/public_test_cases/p00096/output.0.txt b/codenet/public_test_cases/p00096/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6477ec0d7c12cb8c110378449e1d2b0ffea656a --- /dev/null +++ b/codenet/public_test_cases/p00096/output.0.txt @@ -0,0 +1,3 @@ +10 +20 +8436 diff --git a/codenet/public_test_cases/p00096/output.1.txt b/codenet/public_test_cases/p00096/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6477ec0d7c12cb8c110378449e1d2b0ffea656a --- /dev/null +++ b/codenet/public_test_cases/p00096/output.1.txt @@ -0,0 +1,3 @@ +10 +20 +8436 diff --git a/codenet/public_test_cases/p00097/input.0.txt b/codenet/public_test_cases/p00097/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c9409ef811a36ab2fd25e9e8b09d722e4c3ed93 --- /dev/null +++ b/codenet/public_test_cases/p00097/input.0.txt @@ -0,0 +1,3 @@ +3 6 +3 1 +0 0 diff --git a/codenet/public_test_cases/p00097/input.1.txt b/codenet/public_test_cases/p00097/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c9409ef811a36ab2fd25e9e8b09d722e4c3ed93 --- /dev/null +++ b/codenet/public_test_cases/p00097/input.1.txt @@ -0,0 +1,3 @@ +3 6 +3 1 +0 0 diff --git a/codenet/public_test_cases/p00097/output.0.txt b/codenet/public_test_cases/p00097/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p00097/output.0.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p00097/output.1.txt b/codenet/public_test_cases/p00097/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p00097/output.1.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p00098/input.0.txt b/codenet/public_test_cases/p00098/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27d63baf23f12bdc7aa79adb5616a10318660f2b --- /dev/null +++ b/codenet/public_test_cases/p00098/input.0.txt @@ -0,0 +1,4 @@ +3 +1 -2 3 +-4 5 6 +7 8 -9 diff --git a/codenet/public_test_cases/p00098/input.1.txt b/codenet/public_test_cases/p00098/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27d63baf23f12bdc7aa79adb5616a10318660f2b --- /dev/null +++ b/codenet/public_test_cases/p00098/input.1.txt @@ -0,0 +1,4 @@ +3 +1 -2 3 +-4 5 6 +7 8 -9 diff --git a/codenet/public_test_cases/p00098/input.2.txt b/codenet/public_test_cases/p00098/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e914edf4dd608825c0550c724ed2c16ce353f78a --- /dev/null +++ b/codenet/public_test_cases/p00098/input.2.txt @@ -0,0 +1,5 @@ +4 +1 3 -9 2 +2 7 -1 5 +-8 3 2 -1 +5 0 -3 1 diff --git a/codenet/public_test_cases/p00098/output.0.txt b/codenet/public_test_cases/p00098/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p00098/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p00098/output.1.txt b/codenet/public_test_cases/p00098/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p00098/output.1.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p00098/output.2.txt b/codenet/public_test_cases/p00098/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p00098/output.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p00099/input.0.txt b/codenet/public_test_cases/p00099/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a2659b1a01e2fcea2b0f816e9a759ef76a729b --- /dev/null +++ b/codenet/public_test_cases/p00099/input.0.txt @@ -0,0 +1,6 @@ +3 5 +1 4 +2 5 +1 3 +3 6 +2 7 diff --git a/codenet/public_test_cases/p00099/input.1.txt b/codenet/public_test_cases/p00099/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a2659b1a01e2fcea2b0f816e9a759ef76a729b --- /dev/null +++ b/codenet/public_test_cases/p00099/input.1.txt @@ -0,0 +1,6 @@ +3 5 +1 4 +2 5 +1 3 +3 6 +2 7 diff --git a/codenet/public_test_cases/p00099/output.0.txt b/codenet/public_test_cases/p00099/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..beb294ca47d9971f55e3ac371b3773cd066501b4 --- /dev/null +++ b/codenet/public_test_cases/p00099/output.0.txt @@ -0,0 +1,5 @@ +1 4 +2 5 +1 7 +1 7 +2 12 diff --git a/codenet/public_test_cases/p00099/output.1.txt b/codenet/public_test_cases/p00099/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..beb294ca47d9971f55e3ac371b3773cd066501b4 --- /dev/null +++ b/codenet/public_test_cases/p00099/output.1.txt @@ -0,0 +1,5 @@ +1 4 +2 5 +1 7 +1 7 +2 12 diff --git a/codenet/public_test_cases/p00100/input.0.txt b/codenet/public_test_cases/p00100/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0c7c5623963655ce6dadae887901c5408265aed --- /dev/null +++ b/codenet/public_test_cases/p00100/input.0.txt @@ -0,0 +1,12 @@ +4 +1001 2000 520 +1002 1800 450 +1003 1600 625 +1001 200 1220 +2 +1001 100 3 +1005 1000 100 +2 +2013 5000 100 +2013 5000 100 +0 diff --git a/codenet/public_test_cases/p00100/input.1.txt b/codenet/public_test_cases/p00100/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0c7c5623963655ce6dadae887901c5408265aed --- /dev/null +++ b/codenet/public_test_cases/p00100/input.1.txt @@ -0,0 +1,12 @@ +4 +1001 2000 520 +1002 1800 450 +1003 1600 625 +1001 200 1220 +2 +1001 100 3 +1005 1000 100 +2 +2013 5000 100 +2013 5000 100 +0 diff --git a/codenet/public_test_cases/p00100/output.0.txt b/codenet/public_test_cases/p00100/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc408cfba682a2644990184b18f77ceaac697065 --- /dev/null +++ b/codenet/public_test_cases/p00100/output.0.txt @@ -0,0 +1,4 @@ +1001 +1003 +NA +2013 diff --git a/codenet/public_test_cases/p00100/output.1.txt b/codenet/public_test_cases/p00100/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc408cfba682a2644990184b18f77ceaac697065 --- /dev/null +++ b/codenet/public_test_cases/p00100/output.1.txt @@ -0,0 +1,4 @@ +1001 +1003 +NA +2013 diff --git a/codenet/public_test_cases/p00101/input.0.txt b/codenet/public_test_cases/p00101/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..95cd4bd911b2b3258693de412678c038353ea829 --- /dev/null +++ b/codenet/public_test_cases/p00101/input.0.txt @@ -0,0 +1,4 @@ +3 +Hoshino +Hashino +Masayuki Hoshino was the grandson of Ieyasu Tokugawa. diff --git a/codenet/public_test_cases/p00101/input.1.txt b/codenet/public_test_cases/p00101/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..95cd4bd911b2b3258693de412678c038353ea829 --- /dev/null +++ b/codenet/public_test_cases/p00101/input.1.txt @@ -0,0 +1,4 @@ +3 +Hoshino +Hashino +Masayuki Hoshino was the grandson of Ieyasu Tokugawa. diff --git a/codenet/public_test_cases/p00101/output.0.txt b/codenet/public_test_cases/p00101/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb0de651ad2ff5bafd0e684dea82234eeb7ba12 --- /dev/null +++ b/codenet/public_test_cases/p00101/output.0.txt @@ -0,0 +1,3 @@ +Hoshina +Hashino +Masayuki Hoshina was the grandson of Ieyasu Tokugawa. diff --git a/codenet/public_test_cases/p00101/output.1.txt b/codenet/public_test_cases/p00101/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb0de651ad2ff5bafd0e684dea82234eeb7ba12 --- /dev/null +++ b/codenet/public_test_cases/p00101/output.1.txt @@ -0,0 +1,3 @@ +Hoshina +Hashino +Masayuki Hoshina was the grandson of Ieyasu Tokugawa. diff --git a/codenet/public_test_cases/p00102/input.0.txt b/codenet/public_test_cases/p00102/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a35e2b78f55580523ee9294bc3ef30377eda536c --- /dev/null +++ b/codenet/public_test_cases/p00102/input.0.txt @@ -0,0 +1,11 @@ +4 +52 96 15 20 +86 22 35 45 +45 78 54 36 +16 86 74 55 +4 +52 96 15 20 +86 22 35 45 +45 78 54 36 +16 86 74 55 +0 diff --git a/codenet/public_test_cases/p00102/input.1.txt b/codenet/public_test_cases/p00102/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a35e2b78f55580523ee9294bc3ef30377eda536c --- /dev/null +++ b/codenet/public_test_cases/p00102/input.1.txt @@ -0,0 +1,11 @@ +4 +52 96 15 20 +86 22 35 45 +45 78 54 36 +16 86 74 55 +4 +52 96 15 20 +86 22 35 45 +45 78 54 36 +16 86 74 55 +0 diff --git a/codenet/public_test_cases/p00102/output.0.txt b/codenet/public_test_cases/p00102/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d41c54deaf09b29b38b230a3df9bd6459f82d56 --- /dev/null +++ b/codenet/public_test_cases/p00102/output.0.txt @@ -0,0 +1,10 @@ + 52 96 15 20 183 + 86 22 35 45 188 + 45 78 54 36 213 + 16 86 74 55 231 + 199 282 178 156 815 + 52 96 15 20 183 + 86 22 35 45 188 + 45 78 54 36 213 + 16 86 74 55 231 + 199 282 178 156 815 diff --git a/codenet/public_test_cases/p00102/output.1.txt b/codenet/public_test_cases/p00102/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e3687c0435d7178e045f31c12040fbb996e480c --- /dev/null +++ b/codenet/public_test_cases/p00102/output.1.txt @@ -0,0 +1,10 @@ +52 96 15 20 183 + 86 22 35 45 188 + 45 78 54 36 213 + 16 86 74 55 231 + 199 282 178 156 815 + 52 96 15 20 183 + 86 22 35 45 188 + 45 78 54 36 213 + 16 86 74 55 231 + 199 282 178 156 815 diff --git a/codenet/public_test_cases/p00103/input.0.txt b/codenet/public_test_cases/p00103/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13b12c1e320039bc7905218f906b6092e4661981 --- /dev/null +++ b/codenet/public_test_cases/p00103/input.0.txt @@ -0,0 +1,20 @@ +2 +HIT +OUT +HOMERUN +HIT +HIT +HOMERUN +HIT +OUT +HIT +HIT +HIT +HIT +OUT +HIT +HIT +OUT +HIT +OUT +OUT diff --git a/codenet/public_test_cases/p00103/input.1.txt b/codenet/public_test_cases/p00103/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..13b12c1e320039bc7905218f906b6092e4661981 --- /dev/null +++ b/codenet/public_test_cases/p00103/input.1.txt @@ -0,0 +1,20 @@ +2 +HIT +OUT +HOMERUN +HIT +HIT +HOMERUN +HIT +OUT +HIT +HIT +HIT +HIT +OUT +HIT +HIT +OUT +HIT +OUT +OUT diff --git a/codenet/public_test_cases/p00103/output.0.txt b/codenet/public_test_cases/p00103/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8148db66ee1c3076e731d4fffde293f68628869 --- /dev/null +++ b/codenet/public_test_cases/p00103/output.0.txt @@ -0,0 +1,2 @@ +7 +0 diff --git a/codenet/public_test_cases/p00103/output.1.txt b/codenet/public_test_cases/p00103/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8148db66ee1c3076e731d4fffde293f68628869 --- /dev/null +++ b/codenet/public_test_cases/p00103/output.1.txt @@ -0,0 +1,2 @@ +7 +0 diff --git a/codenet/public_test_cases/p00104/input.0.txt b/codenet/public_test_cases/p00104/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a3e320962cb87a7f01bc0a949a6ea64c0f33ec3 --- /dev/null +++ b/codenet/public_test_cases/p00104/input.0.txt @@ -0,0 +1,6 @@ +10 10 +>>>v..>>>v +...v..^..v +>>>>>>^..v +.........v +.v diff --git a/codenet/public_test_cases/p00104/input.1.txt b/codenet/public_test_cases/p00104/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a3e320962cb87a7f01bc0a949a6ea64c0f33ec3 --- /dev/null +++ b/codenet/public_test_cases/p00104/input.1.txt @@ -0,0 +1,6 @@ +10 10 +>>>v..>>>v +...v..^..v +>>>>>>^..v +.........v +.v diff --git a/codenet/public_test_cases/p00104/input.2.txt b/codenet/public_test_cases/p00104/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f885c7cabd2773b66d95e96224883c07128afcd4 --- /dev/null +++ b/codenet/public_test_cases/p00104/input.2.txt @@ -0,0 +1,19 @@ +10 10 +>>>v..>>>v +...v..^..v +>>>>>>^..v +.........v +.v<<<<...v +.v.v.^...v +.v.v.^<<<< +.v.v.....v +.v...^...v +.>>>>^.... +6 10 +>>>>>>>>>v +.........v +.........v +>>>>v....v +^...v....v +^<<<<<<<<< +0 0 diff --git a/codenet/public_test_cases/p00104/output.0.txt b/codenet/public_test_cases/p00104/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f2b6a9e945892cd3c7904038d6f1937218231b1 --- /dev/null +++ b/codenet/public_test_cases/p00104/output.0.txt @@ -0,0 +1,2 @@ +5 7 +LOOP diff --git a/codenet/public_test_cases/p00104/output.1.txt b/codenet/public_test_cases/p00104/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f2b6a9e945892cd3c7904038d6f1937218231b1 --- /dev/null +++ b/codenet/public_test_cases/p00104/output.1.txt @@ -0,0 +1,2 @@ +5 7 +LOOP diff --git a/codenet/public_test_cases/p00104/output.2.txt b/codenet/public_test_cases/p00104/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f2b6a9e945892cd3c7904038d6f1937218231b1 --- /dev/null +++ b/codenet/public_test_cases/p00104/output.2.txt @@ -0,0 +1,2 @@ +5 7 +LOOP diff --git a/codenet/public_test_cases/p00105/input.0.txt b/codenet/public_test_cases/p00105/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02152b891ce6714dfe33efd2dc9dc9c774a497eb --- /dev/null +++ b/codenet/public_test_cases/p00105/input.0.txt @@ -0,0 +1,8 @@ +style 12 +even 25 +introduction 3 +easy 9 +style 7 +document 13 +style 21 +even 18 diff --git a/codenet/public_test_cases/p00105/input.1.txt b/codenet/public_test_cases/p00105/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..02152b891ce6714dfe33efd2dc9dc9c774a497eb --- /dev/null +++ b/codenet/public_test_cases/p00105/input.1.txt @@ -0,0 +1,8 @@ +style 12 +even 25 +introduction 3 +easy 9 +style 7 +document 13 +style 21 +even 18 diff --git a/codenet/public_test_cases/p00105/output.0.txt b/codenet/public_test_cases/p00105/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05b49f690d9be3343da451170b433b68eb555835 --- /dev/null +++ b/codenet/public_test_cases/p00105/output.0.txt @@ -0,0 +1,10 @@ +document +13 +easy +9 +even +18 25 +introduction +3 +style +7 12 21 diff --git a/codenet/public_test_cases/p00105/output.1.txt b/codenet/public_test_cases/p00105/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05b49f690d9be3343da451170b433b68eb555835 --- /dev/null +++ b/codenet/public_test_cases/p00105/output.1.txt @@ -0,0 +1,10 @@ +document +13 +easy +9 +even +18 25 +introduction +3 +style +7 12 21 diff --git a/codenet/public_test_cases/p00106/input.0.txt b/codenet/public_test_cases/p00106/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93ac507b5b8d7b6da9d334281821fa18e578f7cb --- /dev/null +++ b/codenet/public_test_cases/p00106/input.0.txt @@ -0,0 +1,3 @@ +500 +2200 +0 diff --git a/codenet/public_test_cases/p00106/input.1.txt b/codenet/public_test_cases/p00106/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..93ac507b5b8d7b6da9d334281821fa18e578f7cb --- /dev/null +++ b/codenet/public_test_cases/p00106/input.1.txt @@ -0,0 +1,3 @@ +500 +2200 +0 diff --git a/codenet/public_test_cases/p00106/output.0.txt b/codenet/public_test_cases/p00106/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f78ba07491ab66a59c42b0c7501c80127a127ac --- /dev/null +++ b/codenet/public_test_cases/p00106/output.0.txt @@ -0,0 +1,2 @@ +850 +3390 diff --git a/codenet/public_test_cases/p00106/output.1.txt b/codenet/public_test_cases/p00106/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f78ba07491ab66a59c42b0c7501c80127a127ac --- /dev/null +++ b/codenet/public_test_cases/p00106/output.1.txt @@ -0,0 +1,2 @@ +850 +3390 diff --git a/codenet/public_test_cases/p00107/input.0.txt b/codenet/public_test_cases/p00107/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d152b7fe69e8ba8aab81097ca1bd8edda106ae6 --- /dev/null +++ b/codenet/public_test_cases/p00107/input.0.txt @@ -0,0 +1,8 @@ +10 6 8 +5 +4 +8 +6 +2 +5 +0 0 0 diff --git a/codenet/public_test_cases/p00107/input.1.txt b/codenet/public_test_cases/p00107/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d152b7fe69e8ba8aab81097ca1bd8edda106ae6 --- /dev/null +++ b/codenet/public_test_cases/p00107/input.1.txt @@ -0,0 +1,8 @@ +10 6 8 +5 +4 +8 +6 +2 +5 +0 0 0 diff --git a/codenet/public_test_cases/p00107/output.0.txt b/codenet/public_test_cases/p00107/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb2c4e5b81862265c0fe5a5547e50b9988b59a9c --- /dev/null +++ b/codenet/public_test_cases/p00107/output.0.txt @@ -0,0 +1,5 @@ +NA +OK +OK +NA +NA diff --git a/codenet/public_test_cases/p00107/output.1.txt b/codenet/public_test_cases/p00107/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb2c4e5b81862265c0fe5a5547e50b9988b59a9c --- /dev/null +++ b/codenet/public_test_cases/p00107/output.1.txt @@ -0,0 +1,5 @@ +NA +OK +OK +NA +NA diff --git a/codenet/public_test_cases/p00108/input.0.txt b/codenet/public_test_cases/p00108/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abe7df6cbec0acefba9ab93de7d90e591781f103 --- /dev/null +++ b/codenet/public_test_cases/p00108/input.0.txt @@ -0,0 +1,3 @@ +10 +4 5 1 1 4 5 12 3 5 4 +0 diff --git a/codenet/public_test_cases/p00108/input.1.txt b/codenet/public_test_cases/p00108/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abe7df6cbec0acefba9ab93de7d90e591781f103 --- /dev/null +++ b/codenet/public_test_cases/p00108/input.1.txt @@ -0,0 +1,3 @@ +10 +4 5 1 1 4 5 12 3 5 4 +0 diff --git a/codenet/public_test_cases/p00108/output.0.txt b/codenet/public_test_cases/p00108/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76cb6777f4f765ff8e53b667b98d1e109f259445 --- /dev/null +++ b/codenet/public_test_cases/p00108/output.0.txt @@ -0,0 +1,2 @@ +3 +6 6 4 4 6 6 4 4 6 6 diff --git a/codenet/public_test_cases/p00108/output.1.txt b/codenet/public_test_cases/p00108/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76cb6777f4f765ff8e53b667b98d1e109f259445 --- /dev/null +++ b/codenet/public_test_cases/p00108/output.1.txt @@ -0,0 +1,2 @@ +3 +6 6 4 4 6 6 4 4 6 6 diff --git a/codenet/public_test_cases/p00109/input.0.txt b/codenet/public_test_cases/p00109/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c4b78c780fdf5444e31549d59e6479c1990f789 --- /dev/null +++ b/codenet/public_test_cases/p00109/input.0.txt @@ -0,0 +1,3 @@ +2 +4-2*3= +4*(8+4+3)= diff --git a/codenet/public_test_cases/p00109/input.1.txt b/codenet/public_test_cases/p00109/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c4b78c780fdf5444e31549d59e6479c1990f789 --- /dev/null +++ b/codenet/public_test_cases/p00109/input.1.txt @@ -0,0 +1,3 @@ +2 +4-2*3= +4*(8+4+3)= diff --git a/codenet/public_test_cases/p00109/output.0.txt b/codenet/public_test_cases/p00109/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..684c0a02546d0e47c587a1dc8ab77fbf75c0214a --- /dev/null +++ b/codenet/public_test_cases/p00109/output.0.txt @@ -0,0 +1,2 @@ +-2 +60 diff --git a/codenet/public_test_cases/p00109/output.1.txt b/codenet/public_test_cases/p00109/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..684c0a02546d0e47c587a1dc8ab77fbf75c0214a --- /dev/null +++ b/codenet/public_test_cases/p00109/output.1.txt @@ -0,0 +1,2 @@ +-2 +60 diff --git a/codenet/public_test_cases/p00110/input.0.txt b/codenet/public_test_cases/p00110/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2e814225849f0cf9b04bbaf06f3d37ba9ea6397 --- /dev/null +++ b/codenet/public_test_cases/p00110/input.0.txt @@ -0,0 +1,3 @@ +123+4X6=X79 +12X+4X6=X79 +XX22+89=X2XX diff --git a/codenet/public_test_cases/p00110/input.1.txt b/codenet/public_test_cases/p00110/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2e814225849f0cf9b04bbaf06f3d37ba9ea6397 --- /dev/null +++ b/codenet/public_test_cases/p00110/input.1.txt @@ -0,0 +1,3 @@ +123+4X6=X79 +12X+4X6=X79 +XX22+89=X2XX diff --git a/codenet/public_test_cases/p00110/output.0.txt b/codenet/public_test_cases/p00110/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..20b5495686fbca8e78739a78613afc1107d18bf7 --- /dev/null +++ b/codenet/public_test_cases/p00110/output.0.txt @@ -0,0 +1,3 @@ +5 +NA +1 diff --git a/codenet/public_test_cases/p00110/output.1.txt b/codenet/public_test_cases/p00110/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..20b5495686fbca8e78739a78613afc1107d18bf7 --- /dev/null +++ b/codenet/public_test_cases/p00110/output.1.txt @@ -0,0 +1,3 @@ +5 +NA +1 diff --git a/codenet/public_test_cases/p00111/input.0.txt b/codenet/public_test_cases/p00111/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9a1deb901eea850ad181140caf6c07663f16b2d --- /dev/null +++ b/codenet/public_test_cases/p00111/input.0.txt @@ -0,0 +1 @@ +?D-C'KOPUA diff --git a/codenet/public_test_cases/p00111/input.1.txt b/codenet/public_test_cases/p00111/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9a1deb901eea850ad181140caf6c07663f16b2d --- /dev/null +++ b/codenet/public_test_cases/p00111/input.1.txt @@ -0,0 +1 @@ +?D-C'KOPUA diff --git a/codenet/public_test_cases/p00111/output.0.txt b/codenet/public_test_cases/p00111/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a0c28d36ab6c9664fabfa51f5ebb95d0e62bb34 --- /dev/null +++ b/codenet/public_test_cases/p00111/output.0.txt @@ -0,0 +1 @@ +PETER POTTER diff --git a/codenet/public_test_cases/p00111/output.1.txt b/codenet/public_test_cases/p00111/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a0c28d36ab6c9664fabfa51f5ebb95d0e62bb34 --- /dev/null +++ b/codenet/public_test_cases/p00111/output.1.txt @@ -0,0 +1 @@ +PETER POTTER diff --git a/codenet/public_test_cases/p00112/input.0.txt b/codenet/public_test_cases/p00112/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad1834160dc7a4667287b72b60ea251a6e6a4b15 --- /dev/null +++ b/codenet/public_test_cases/p00112/input.0.txt @@ -0,0 +1,7 @@ +5 +2 +6 +4 +3 +9 +0 diff --git a/codenet/public_test_cases/p00112/input.1.txt b/codenet/public_test_cases/p00112/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad1834160dc7a4667287b72b60ea251a6e6a4b15 --- /dev/null +++ b/codenet/public_test_cases/p00112/input.1.txt @@ -0,0 +1,7 @@ +5 +2 +6 +4 +3 +9 +0 diff --git a/codenet/public_test_cases/p00112/output.0.txt b/codenet/public_test_cases/p00112/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e85087affded170efcbc6f9672a6fc671d839ed0 --- /dev/null +++ b/codenet/public_test_cases/p00112/output.0.txt @@ -0,0 +1 @@ +31 diff --git a/codenet/public_test_cases/p00112/output.1.txt b/codenet/public_test_cases/p00112/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e85087affded170efcbc6f9672a6fc671d839ed0 --- /dev/null +++ b/codenet/public_test_cases/p00112/output.1.txt @@ -0,0 +1 @@ +31 diff --git a/codenet/public_test_cases/p00113/input.0.txt b/codenet/public_test_cases/p00113/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9535a8a512a3c863debad9279c5e74731873a87 --- /dev/null +++ b/codenet/public_test_cases/p00113/input.0.txt @@ -0,0 +1,4 @@ +1 12 +10000 32768 +1 11100 +1 459550 diff --git a/codenet/public_test_cases/p00113/output.0.txt b/codenet/public_test_cases/p00113/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d7d3196085072316427d6df48e77afe71fc3649 --- /dev/null +++ b/codenet/public_test_cases/p00113/output.0.txt @@ -0,0 +1,7 @@ +083 + ^ +30517578125 +00009 + ^^^ +00000217604178 + ^^^^^^^^^^^^ diff --git a/codenet/public_test_cases/p00114/input.0.txt b/codenet/public_test_cases/p00114/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18532c6369fbb73a625579948102829919b77885 --- /dev/null +++ b/codenet/public_test_cases/p00114/input.0.txt @@ -0,0 +1,3 @@ +2 5 3 7 6 13 +517 1024 746 6561 4303 3125 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00114/input.1.txt b/codenet/public_test_cases/p00114/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18532c6369fbb73a625579948102829919b77885 --- /dev/null +++ b/codenet/public_test_cases/p00114/input.1.txt @@ -0,0 +1,3 @@ +2 5 3 7 6 13 +517 1024 746 6561 4303 3125 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00114/output.0.txt b/codenet/public_test_cases/p00114/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1486c07aba75827c3114ba22762a7427ad7808d8 --- /dev/null +++ b/codenet/public_test_cases/p00114/output.0.txt @@ -0,0 +1,2 @@ +12 +116640000 diff --git a/codenet/public_test_cases/p00114/output.1.txt b/codenet/public_test_cases/p00114/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1486c07aba75827c3114ba22762a7427ad7808d8 --- /dev/null +++ b/codenet/public_test_cases/p00114/output.1.txt @@ -0,0 +1,2 @@ +12 +116640000 diff --git a/codenet/public_test_cases/p00115/input.0.txt b/codenet/public_test_cases/p00115/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db2cc5a4b40600a95b5c20aaf6ad0290b3cb348f --- /dev/null +++ b/codenet/public_test_cases/p00115/input.0.txt @@ -0,0 +1,5 @@ +-10 0 0 +10 0 0 +0 10 0 +0 10 10 +0 0 10 diff --git a/codenet/public_test_cases/p00115/input.1.txt b/codenet/public_test_cases/p00115/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b8f3f8631c07edfb8b02b9c302c8109ac295eff --- /dev/null +++ b/codenet/public_test_cases/p00115/input.1.txt @@ -0,0 +1,5 @@ +-10 6 6 +10 6 6 +0 10 0 +0 10 10 +0 0 10 diff --git a/codenet/public_test_cases/p00115/input.2.txt b/codenet/public_test_cases/p00115/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db2cc5a4b40600a95b5c20aaf6ad0290b3cb348f --- /dev/null +++ b/codenet/public_test_cases/p00115/input.2.txt @@ -0,0 +1,5 @@ +-10 0 0 +10 0 0 +0 10 0 +0 10 10 +0 0 10 diff --git a/codenet/public_test_cases/p00115/output.0.txt b/codenet/public_test_cases/p00115/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6585d3d3f59ccb55601e6136b2828ee11ed125d --- /dev/null +++ b/codenet/public_test_cases/p00115/output.0.txt @@ -0,0 +1 @@ +HIT diff --git a/codenet/public_test_cases/p00115/output.1.txt b/codenet/public_test_cases/p00115/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e68b9200eac0ea99728b20daba3f5349766e3546 --- /dev/null +++ b/codenet/public_test_cases/p00115/output.1.txt @@ -0,0 +1 @@ +MISS diff --git a/codenet/public_test_cases/p00115/output.2.txt b/codenet/public_test_cases/p00115/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6585d3d3f59ccb55601e6136b2828ee11ed125d --- /dev/null +++ b/codenet/public_test_cases/p00115/output.2.txt @@ -0,0 +1 @@ +HIT diff --git a/codenet/public_test_cases/p00116/input.0.txt b/codenet/public_test_cases/p00116/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85dc3065dfdae2d8ce23bbf7fba90c06a9de4ce7 --- /dev/null +++ b/codenet/public_test_cases/p00116/input.0.txt @@ -0,0 +1,26 @@ +10 10 +...*....** +.......... +**....**.. +........*. +..*....... +**........ +.*........ +.......... +....*..*** +.*....*... +10 10 +..*....*.. +.*.*...*.. +*****..*.. +*...*..*.. +*...*..*.. +.......... +****.*...* +..*..*...* +.*...*...* +****..***. +2 3 +... +... +0 0 diff --git a/codenet/public_test_cases/p00116/input.1.txt b/codenet/public_test_cases/p00116/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85dc3065dfdae2d8ce23bbf7fba90c06a9de4ce7 --- /dev/null +++ b/codenet/public_test_cases/p00116/input.1.txt @@ -0,0 +1,26 @@ +10 10 +...*....** +.......... +**....**.. +........*. +..*....... +**........ +.*........ +.......... +....*..*** +.*....*... +10 10 +..*....*.. +.*.*...*.. +*****..*.. +*...*..*.. +*...*..*.. +.......... +****.*...* +..*..*...* +.*...*...* +****..***. +2 3 +... +... +0 0 diff --git a/codenet/public_test_cases/p00116/output.0.txt b/codenet/public_test_cases/p00116/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8266dae799d31559f7cafedc920e97ce0fd76663 --- /dev/null +++ b/codenet/public_test_cases/p00116/output.0.txt @@ -0,0 +1,3 @@ +28 +12 +6 diff --git a/codenet/public_test_cases/p00116/output.1.txt b/codenet/public_test_cases/p00116/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8266dae799d31559f7cafedc920e97ce0fd76663 --- /dev/null +++ b/codenet/public_test_cases/p00116/output.1.txt @@ -0,0 +1,3 @@ +28 +12 +6 diff --git a/codenet/public_test_cases/p00117/input.0.txt b/codenet/public_test_cases/p00117/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e692ba1b8f660d8d078dddf2be25368f584d900 --- /dev/null +++ b/codenet/public_test_cases/p00117/input.0.txt @@ -0,0 +1,11 @@ +6 +8 +1,2,2,2 +1,3,4,3 +1,4,4,2 +2,5,3,2 +3,4,4,2 +3,6,1,2 +4,6,1,1 +5,6,1,2 +2,4,50,30 diff --git a/codenet/public_test_cases/p00117/input.1.txt b/codenet/public_test_cases/p00117/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e692ba1b8f660d8d078dddf2be25368f584d900 --- /dev/null +++ b/codenet/public_test_cases/p00117/input.1.txt @@ -0,0 +1,11 @@ +6 +8 +1,2,2,2 +1,3,4,3 +1,4,4,2 +2,5,3,2 +3,4,4,2 +3,6,1,2 +4,6,1,1 +5,6,1,2 +2,4,50,30 diff --git a/codenet/public_test_cases/p00117/output.0.txt b/codenet/public_test_cases/p00117/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00117/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00117/output.1.txt b/codenet/public_test_cases/p00117/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00117/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00118/input.0.txt b/codenet/public_test_cases/p00118/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..47198c2c451351263562c6fd9b571c90e4f8c3f7 --- /dev/null +++ b/codenet/public_test_cases/p00118/input.0.txt @@ -0,0 +1,12 @@ +10 10 +####*****@ +@#@@@@#*#* +@##***@@@* +#****#*@** +##@*#@@*## +*@@@@*@@@# +***#@*@##* +*@@@*@@##@ +*@*#*@##** +@****#@@#@ +0 0 diff --git a/codenet/public_test_cases/p00118/input.1.txt b/codenet/public_test_cases/p00118/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b6de1aaf3c2f610ef6ba1bb8bdde135b1df152b --- /dev/null +++ b/codenet/public_test_cases/p00118/input.1.txt @@ -0,0 +1,12 @@ +10 10 +*****@ +@#@@@@#*#* +@##***@@@* +****#*@** +@*#@@*## +*@@@@*@@@# +***#@*@##* +*@@@*@@##@ +*@*#*@##** +@****#@@#@ +0 0 diff --git a/codenet/public_test_cases/p00118/input.2.txt b/codenet/public_test_cases/p00118/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..47198c2c451351263562c6fd9b571c90e4f8c3f7 --- /dev/null +++ b/codenet/public_test_cases/p00118/input.2.txt @@ -0,0 +1,12 @@ +10 10 +####*****@ +@#@@@@#*#* +@##***@@@* +#****#*@** +##@*#@@*## +*@@@@*@@@# +***#@*@##* +*@@@*@@##@ +*@*#*@##** +@****#@@#@ +0 0 diff --git a/codenet/public_test_cases/p00118/output.0.txt b/codenet/public_test_cases/p00118/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb95160cb6e07358f54a28a208ae41e69889c97b --- /dev/null +++ b/codenet/public_test_cases/p00118/output.0.txt @@ -0,0 +1 @@ +33 diff --git a/codenet/public_test_cases/p00118/output.1.txt b/codenet/public_test_cases/p00118/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb95160cb6e07358f54a28a208ae41e69889c97b --- /dev/null +++ b/codenet/public_test_cases/p00118/output.1.txt @@ -0,0 +1 @@ +33 diff --git a/codenet/public_test_cases/p00118/output.2.txt b/codenet/public_test_cases/p00118/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb95160cb6e07358f54a28a208ae41e69889c97b --- /dev/null +++ b/codenet/public_test_cases/p00118/output.2.txt @@ -0,0 +1 @@ +33 diff --git a/codenet/public_test_cases/p00119/input.0.txt b/codenet/public_test_cases/p00119/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2f60ec0b27f75064fc74afbe1d1f9dd3a014dba --- /dev/null +++ b/codenet/public_test_cases/p00119/input.0.txt @@ -0,0 +1,9 @@ +6 +7 +5 2 +1 4 +3 5 +4 2 +1 6 +6 4 +3 4 diff --git a/codenet/public_test_cases/p00119/input.1.txt b/codenet/public_test_cases/p00119/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2f60ec0b27f75064fc74afbe1d1f9dd3a014dba --- /dev/null +++ b/codenet/public_test_cases/p00119/input.1.txt @@ -0,0 +1,9 @@ +6 +7 +5 2 +1 4 +3 5 +4 2 +1 6 +6 4 +3 4 diff --git a/codenet/public_test_cases/p00119/output.0.txt b/codenet/public_test_cases/p00119/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5bd492ac119233772f596d6af202d5084cf231 --- /dev/null +++ b/codenet/public_test_cases/p00119/output.0.txt @@ -0,0 +1,6 @@ +3 +5 +1 +6 +4 +2 diff --git a/codenet/public_test_cases/p00119/output.1.txt b/codenet/public_test_cases/p00119/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5bd492ac119233772f596d6af202d5084cf231 --- /dev/null +++ b/codenet/public_test_cases/p00119/output.1.txt @@ -0,0 +1,6 @@ +3 +5 +1 +6 +4 +2 diff --git a/codenet/public_test_cases/p00120/input.0.txt b/codenet/public_test_cases/p00120/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7bd58728290ea3ccd4797097613a2cb556e0efc --- /dev/null +++ b/codenet/public_test_cases/p00120/input.0.txt @@ -0,0 +1,4 @@ +30 4 5 6 +30 5 5 5 +50 3 3 3 10 10 +49 3 3 3 10 10 diff --git a/codenet/public_test_cases/p00120/input.1.txt b/codenet/public_test_cases/p00120/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7bd58728290ea3ccd4797097613a2cb556e0efc --- /dev/null +++ b/codenet/public_test_cases/p00120/input.1.txt @@ -0,0 +1,4 @@ +30 4 5 6 +30 5 5 5 +50 3 3 3 10 10 +49 3 3 3 10 10 diff --git a/codenet/public_test_cases/p00120/output.0.txt b/codenet/public_test_cases/p00120/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0312efe3430031104afc6ef74b96b5679e5971ef --- /dev/null +++ b/codenet/public_test_cases/p00120/output.0.txt @@ -0,0 +1,4 @@ +OK +OK +OK +NA diff --git a/codenet/public_test_cases/p00120/output.1.txt b/codenet/public_test_cases/p00120/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0312efe3430031104afc6ef74b96b5679e5971ef --- /dev/null +++ b/codenet/public_test_cases/p00120/output.1.txt @@ -0,0 +1,4 @@ +OK +OK +OK +NA diff --git a/codenet/public_test_cases/p00121/input.0.txt b/codenet/public_test_cases/p00121/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b115fa42f45b77fb17e2f2f473995d3a565b2fa5 --- /dev/null +++ b/codenet/public_test_cases/p00121/input.0.txt @@ -0,0 +1,3 @@ +0 1 2 3 4 5 6 7 +1 0 2 3 4 5 6 7 +7 6 5 4 3 2 1 0 diff --git a/codenet/public_test_cases/p00121/input.1.txt b/codenet/public_test_cases/p00121/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b115fa42f45b77fb17e2f2f473995d3a565b2fa5 --- /dev/null +++ b/codenet/public_test_cases/p00121/input.1.txt @@ -0,0 +1,3 @@ +0 1 2 3 4 5 6 7 +1 0 2 3 4 5 6 7 +7 6 5 4 3 2 1 0 diff --git a/codenet/public_test_cases/p00121/output.0.txt b/codenet/public_test_cases/p00121/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cefffb7ff4b8dc502bb2de5cb682ebbe1084323 --- /dev/null +++ b/codenet/public_test_cases/p00121/output.0.txt @@ -0,0 +1,3 @@ +0 +1 +28 diff --git a/codenet/public_test_cases/p00121/output.1.txt b/codenet/public_test_cases/p00121/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cefffb7ff4b8dc502bb2de5cb682ebbe1084323 --- /dev/null +++ b/codenet/public_test_cases/p00121/output.1.txt @@ -0,0 +1,3 @@ +0 +1 +28 diff --git a/codenet/public_test_cases/p00122/input.0.txt b/codenet/public_test_cases/p00122/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a8658e1d7ea277b2323acf1f8f630fd3e54bd1e --- /dev/null +++ b/codenet/public_test_cases/p00122/input.0.txt @@ -0,0 +1,7 @@ +6 1 +10 +6 4 3 3 1 2 0 5 4 6 1 8 5 9 7 7 8 6 8 3 +6 1 +10 +6 4 3 3 1 2 0 5 4 6 1 8 5 9 7 7 8 6 9 0 +0 0 diff --git a/codenet/public_test_cases/p00122/input.1.txt b/codenet/public_test_cases/p00122/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a8658e1d7ea277b2323acf1f8f630fd3e54bd1e --- /dev/null +++ b/codenet/public_test_cases/p00122/input.1.txt @@ -0,0 +1,7 @@ +6 1 +10 +6 4 3 3 1 2 0 5 4 6 1 8 5 9 7 7 8 6 8 3 +6 1 +10 +6 4 3 3 1 2 0 5 4 6 1 8 5 9 7 7 8 6 9 0 +0 0 diff --git a/codenet/public_test_cases/p00122/output.0.txt b/codenet/public_test_cases/p00122/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2afad5c1deacd6c2b007ada04625959e7c6e0403 --- /dev/null +++ b/codenet/public_test_cases/p00122/output.0.txt @@ -0,0 +1,2 @@ +OK +NA diff --git a/codenet/public_test_cases/p00122/output.1.txt b/codenet/public_test_cases/p00122/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2afad5c1deacd6c2b007ada04625959e7c6e0403 --- /dev/null +++ b/codenet/public_test_cases/p00122/output.1.txt @@ -0,0 +1,2 @@ +OK +NA diff --git a/codenet/public_test_cases/p00123/input.0.txt b/codenet/public_test_cases/p00123/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abaab8c3598db20cc6518da5a3ae08523067a43d --- /dev/null +++ b/codenet/public_test_cases/p00123/input.0.txt @@ -0,0 +1,2 @@ +40.0 70.0 +72.5 140.51 diff --git a/codenet/public_test_cases/p00123/input.1.txt b/codenet/public_test_cases/p00123/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abaab8c3598db20cc6518da5a3ae08523067a43d --- /dev/null +++ b/codenet/public_test_cases/p00123/input.1.txt @@ -0,0 +1,2 @@ +40.0 70.0 +72.5 140.51 diff --git a/codenet/public_test_cases/p00123/output.0.txt b/codenet/public_test_cases/p00123/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9f27e2f7a16fa43fea86c632f0316ef49830c09 --- /dev/null +++ b/codenet/public_test_cases/p00123/output.0.txt @@ -0,0 +1,2 @@ +B +NA diff --git a/codenet/public_test_cases/p00123/output.1.txt b/codenet/public_test_cases/p00123/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9f27e2f7a16fa43fea86c632f0316ef49830c09 --- /dev/null +++ b/codenet/public_test_cases/p00123/output.1.txt @@ -0,0 +1,2 @@ +B +NA diff --git a/codenet/public_test_cases/p00124/input.0.txt b/codenet/public_test_cases/p00124/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ba8cb5911e1c3a870bb91f0b143109ba9e22462 --- /dev/null +++ b/codenet/public_test_cases/p00124/input.0.txt @@ -0,0 +1,10 @@ +4 +Japan 1 0 2 +Egypt 1 2 0 +Canada 0 2 1 +Spain 2 0 1 +3 +India 0 2 0 +Poland 1 0 1 +Italy 1 0 1 +0 diff --git a/codenet/public_test_cases/p00124/input.1.txt b/codenet/public_test_cases/p00124/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ba8cb5911e1c3a870bb91f0b143109ba9e22462 --- /dev/null +++ b/codenet/public_test_cases/p00124/input.1.txt @@ -0,0 +1,10 @@ +4 +Japan 1 0 2 +Egypt 1 2 0 +Canada 0 2 1 +Spain 2 0 1 +3 +India 0 2 0 +Poland 1 0 1 +Italy 1 0 1 +0 diff --git a/codenet/public_test_cases/p00124/output.0.txt b/codenet/public_test_cases/p00124/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5551b8492b49fd8f8afc677f29323845409b86c --- /dev/null +++ b/codenet/public_test_cases/p00124/output.0.txt @@ -0,0 +1,8 @@ +Spain,7 +Japan,5 +Egypt,3 +Canada,1 + +Poland,4 +Italy,4 +India,0 diff --git a/codenet/public_test_cases/p00124/output.1.txt b/codenet/public_test_cases/p00124/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5551b8492b49fd8f8afc677f29323845409b86c --- /dev/null +++ b/codenet/public_test_cases/p00124/output.1.txt @@ -0,0 +1,8 @@ +Spain,7 +Japan,5 +Egypt,3 +Canada,1 + +Poland,4 +Italy,4 +India,0 diff --git a/codenet/public_test_cases/p00125/input.0.txt b/codenet/public_test_cases/p00125/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f0cdcd4ed9bd6e6104e9c7d9b8ca957754aaf1e --- /dev/null +++ b/codenet/public_test_cases/p00125/input.0.txt @@ -0,0 +1,6 @@ +2006 9 2 2006 9 3 +2006 9 2 2006 11 11 +2004 1 1 2005 1 1 +2000 1 1 2006 1 1 +2000 1 1 2101 1 1 +-1 -1 -1 -1 -1 -1 diff --git a/codenet/public_test_cases/p00125/input.1.txt b/codenet/public_test_cases/p00125/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f0cdcd4ed9bd6e6104e9c7d9b8ca957754aaf1e --- /dev/null +++ b/codenet/public_test_cases/p00125/input.1.txt @@ -0,0 +1,6 @@ +2006 9 2 2006 9 3 +2006 9 2 2006 11 11 +2004 1 1 2005 1 1 +2000 1 1 2006 1 1 +2000 1 1 2101 1 1 +-1 -1 -1 -1 -1 -1 diff --git a/codenet/public_test_cases/p00125/output.0.txt b/codenet/public_test_cases/p00125/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6d0b7685ca63ae8faa3bf36b21c030385b38875 --- /dev/null +++ b/codenet/public_test_cases/p00125/output.0.txt @@ -0,0 +1,5 @@ +1 +70 +366 +2192 +36890 diff --git a/codenet/public_test_cases/p00125/output.1.txt b/codenet/public_test_cases/p00125/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6d0b7685ca63ae8faa3bf36b21c030385b38875 --- /dev/null +++ b/codenet/public_test_cases/p00125/output.1.txt @@ -0,0 +1,5 @@ +1 +70 +366 +2192 +36890 diff --git a/codenet/public_test_cases/p00126/input.0.txt b/codenet/public_test_cases/p00126/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b96d9752c9c64f274a67945a9e2c1226735d96a --- /dev/null +++ b/codenet/public_test_cases/p00126/input.0.txt @@ -0,0 +1,19 @@ +2 +2 1 3 4 5 6 7 8 9 +4 5 6 7 8 9 1 2 3 +7 8 9 1 2 3 4 5 6 +2 3 4 5 6 7 8 9 1 +5 6 7 8 9 1 2 3 4 +8 9 1 2 3 4 5 6 7 +3 4 5 6 7 8 9 1 2 +6 7 8 9 1 2 3 4 5 +9 1 2 3 4 5 6 7 8 +2 1 3 4 5 6 7 8 9 +4 5 6 7 8 9 1 2 3 +7 8 9 1 2 3 4 5 6 +2 3 4 5 6 7 8 9 1 +5 6 7 8 9 1 2 3 4 +8 9 1 2 3 4 5 6 7 +3 4 5 6 7 8 9 1 2 +6 7 8 9 1 2 3 4 5 +9 1 2 3 4 5 6 7 8 diff --git a/codenet/public_test_cases/p00126/input.1.txt b/codenet/public_test_cases/p00126/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b96d9752c9c64f274a67945a9e2c1226735d96a --- /dev/null +++ b/codenet/public_test_cases/p00126/input.1.txt @@ -0,0 +1,19 @@ +2 +2 1 3 4 5 6 7 8 9 +4 5 6 7 8 9 1 2 3 +7 8 9 1 2 3 4 5 6 +2 3 4 5 6 7 8 9 1 +5 6 7 8 9 1 2 3 4 +8 9 1 2 3 4 5 6 7 +3 4 5 6 7 8 9 1 2 +6 7 8 9 1 2 3 4 5 +9 1 2 3 4 5 6 7 8 +2 1 3 4 5 6 7 8 9 +4 5 6 7 8 9 1 2 3 +7 8 9 1 2 3 4 5 6 +2 3 4 5 6 7 8 9 1 +5 6 7 8 9 1 2 3 4 +8 9 1 2 3 4 5 6 7 +3 4 5 6 7 8 9 1 2 +6 7 8 9 1 2 3 4 5 +9 1 2 3 4 5 6 7 8 diff --git a/codenet/public_test_cases/p00126/output.0.txt b/codenet/public_test_cases/p00126/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6ddaa1b15dde216dbb8dc06d17145841ed484b9 --- /dev/null +++ b/codenet/public_test_cases/p00126/output.0.txt @@ -0,0 +1,19 @@ +*2*1 3 4 5 6 7 8 9 + 4 5 6 7 8 9 1 2 3 + 7 8 9 1 2 3 4 5 6 +*2 3 4 5 6 7 8 9 1 + 5 6 7 8 9 1 2 3 4 + 8 9 1 2 3 4 5 6 7 + 3 4 5 6 7 8 9 1 2 + 6 7 8 9 1 2 3 4 5 + 9*1 2 3 4 5 6 7 8 + +*2*1 3 4 5 6 7 8 9 + 4 5 6 7 8 9 1 2 3 + 7 8 9 1 2 3 4 5 6 +*2 3 4 5 6 7 8 9 1 + 5 6 7 8 9 1 2 3 4 + 8 9 1 2 3 4 5 6 7 + 3 4 5 6 7 8 9 1 2 + 6 7 8 9 1 2 3 4 5 + 9*1 2 3 4 5 6 7 8 diff --git a/codenet/public_test_cases/p00126/output.1.txt b/codenet/public_test_cases/p00126/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6ddaa1b15dde216dbb8dc06d17145841ed484b9 --- /dev/null +++ b/codenet/public_test_cases/p00126/output.1.txt @@ -0,0 +1,19 @@ +*2*1 3 4 5 6 7 8 9 + 4 5 6 7 8 9 1 2 3 + 7 8 9 1 2 3 4 5 6 +*2 3 4 5 6 7 8 9 1 + 5 6 7 8 9 1 2 3 4 + 8 9 1 2 3 4 5 6 7 + 3 4 5 6 7 8 9 1 2 + 6 7 8 9 1 2 3 4 5 + 9*1 2 3 4 5 6 7 8 + +*2*1 3 4 5 6 7 8 9 + 4 5 6 7 8 9 1 2 3 + 7 8 9 1 2 3 4 5 6 +*2 3 4 5 6 7 8 9 1 + 5 6 7 8 9 1 2 3 4 + 8 9 1 2 3 4 5 6 7 + 3 4 5 6 7 8 9 1 2 + 6 7 8 9 1 2 3 4 5 + 9*1 2 3 4 5 6 7 8 diff --git a/codenet/public_test_cases/p00127/input.0.txt b/codenet/public_test_cases/p00127/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c36c6a114e0c0a91ca64b44e469d430fe37fd04 --- /dev/null +++ b/codenet/public_test_cases/p00127/input.0.txt @@ -0,0 +1,8 @@ +341143514535 +314 +143565553551655311343411652235654535651124615163 +551544654451431564 +4 +3411 +6363636363 +153414 diff --git a/codenet/public_test_cases/p00127/input.1.txt b/codenet/public_test_cases/p00127/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c36c6a114e0c0a91ca64b44e469d430fe37fd04 --- /dev/null +++ b/codenet/public_test_cases/p00127/input.1.txt @@ -0,0 +1,8 @@ +341143514535 +314 +143565553551655311343411652235654535651124615163 +551544654451431564 +4 +3411 +6363636363 +153414 diff --git a/codenet/public_test_cases/p00127/output.0.txt b/codenet/public_test_cases/p00127/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80e87fb3e68f606e8ef226446e3e6df9ad8d2b6e --- /dev/null +++ b/codenet/public_test_cases/p00127/output.0.txt @@ -0,0 +1,8 @@ +naruto +NA +do you wanna go to aizu? +yes sure! +NA +na +????? +end diff --git a/codenet/public_test_cases/p00127/output.1.txt b/codenet/public_test_cases/p00127/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..80e87fb3e68f606e8ef226446e3e6df9ad8d2b6e --- /dev/null +++ b/codenet/public_test_cases/p00127/output.1.txt @@ -0,0 +1,8 @@ +naruto +NA +do you wanna go to aizu? +yes sure! +NA +na +????? +end diff --git a/codenet/public_test_cases/p00128/input.0.txt b/codenet/public_test_cases/p00128/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05abd00261a6ee152057dc9329cd6544a1694052 --- /dev/null +++ b/codenet/public_test_cases/p00128/input.0.txt @@ -0,0 +1,2 @@ +2006 +1111 diff --git a/codenet/public_test_cases/p00128/input.1.txt b/codenet/public_test_cases/p00128/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05abd00261a6ee152057dc9329cd6544a1694052 --- /dev/null +++ b/codenet/public_test_cases/p00128/input.1.txt @@ -0,0 +1,2 @@ +2006 +1111 diff --git a/codenet/public_test_cases/p00128/output.0.txt b/codenet/public_test_cases/p00128/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b3e2425ebc107c5bd36ec615414692d0896a263 --- /dev/null +++ b/codenet/public_test_cases/p00128/output.0.txt @@ -0,0 +1,17 @@ +**** + * +===== + * * +**** +* *** +***** +***** + +***** + +===== + **** +* +***** +***** +***** diff --git a/codenet/public_test_cases/p00128/output.1.txt b/codenet/public_test_cases/p00128/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b3e2425ebc107c5bd36ec615414692d0896a263 --- /dev/null +++ b/codenet/public_test_cases/p00128/output.1.txt @@ -0,0 +1,17 @@ +**** + * +===== + * * +**** +* *** +***** +***** + +***** + +===== + **** +* +***** +***** +***** diff --git a/codenet/public_test_cases/p00129/input.0.txt b/codenet/public_test_cases/p00129/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e44fdb3f6ac50a1a332bb88db1a34996aeb8f149 --- /dev/null +++ b/codenet/public_test_cases/p00129/input.0.txt @@ -0,0 +1,12 @@ +3 +6 6 3 +19 7 4 +21 8 1 +6 +5 4 2 11 +12 4 2 11 +11 9 2 11 +14 3 20 5 +17 9 20 5 +20 10 20 5 +0 diff --git a/codenet/public_test_cases/p00129/input.1.txt b/codenet/public_test_cases/p00129/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e44fdb3f6ac50a1a332bb88db1a34996aeb8f149 --- /dev/null +++ b/codenet/public_test_cases/p00129/input.1.txt @@ -0,0 +1,12 @@ +3 +6 6 3 +19 7 4 +21 8 1 +6 +5 4 2 11 +12 4 2 11 +11 9 2 11 +14 3 20 5 +17 9 20 5 +20 10 20 5 +0 diff --git a/codenet/public_test_cases/p00129/output.0.txt b/codenet/public_test_cases/p00129/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..43f93dd5434354cd8c9ba0364a8924c8e9ce7623 --- /dev/null +++ b/codenet/public_test_cases/p00129/output.0.txt @@ -0,0 +1,6 @@ +Safe +Safe +Danger +Safe +Danger +Safe diff --git a/codenet/public_test_cases/p00129/output.1.txt b/codenet/public_test_cases/p00129/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..43f93dd5434354cd8c9ba0364a8924c8e9ce7623 --- /dev/null +++ b/codenet/public_test_cases/p00129/output.1.txt @@ -0,0 +1,6 @@ +Safe +Safe +Danger +Safe +Danger +Safe diff --git a/codenet/public_test_cases/p00130/input.0.txt b/codenet/public_test_cases/p00130/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9341de025d8a34012d3b790256e21d9737f3bad1 --- /dev/null +++ b/codenet/public_test_cases/p00130/input.0.txt @@ -0,0 +1,3 @@ +4 +a->e->c->b->d +b diff --git a/codenet/public_test_cases/p00130/input.1.txt b/codenet/public_test_cases/p00130/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9341de025d8a34012d3b790256e21d9737f3bad1 --- /dev/null +++ b/codenet/public_test_cases/p00130/input.1.txt @@ -0,0 +1,3 @@ +4 +a->e->c->b->d +b diff --git a/codenet/public_test_cases/p00130/input.2.txt b/codenet/public_test_cases/p00130/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..50a5e18fe920afd15f94b070efa5dad176b61c02 --- /dev/null +++ b/codenet/public_test_cases/p00130/input.2.txt @@ -0,0 +1,5 @@ +4 +a->e->c->b->d +b<-c<-a<-d<-e +b->a->c<-a->c->d<-c<-a<-b->a->c->d->e<-d +a->e<-a<-d->a->e<-a<-d<-c->d->a<-d<-c<-b->c->d<-c diff --git a/codenet/public_test_cases/p00130/output.0.txt b/codenet/public_test_cases/p00130/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7014cb85a8148ea6bbe74867915744a2ec3cb56b --- /dev/null +++ b/codenet/public_test_cases/p00130/output.0.txt @@ -0,0 +1,4 @@ +aecbd +edacb +bacde +bcdae diff --git a/codenet/public_test_cases/p00130/output.1.txt b/codenet/public_test_cases/p00130/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7014cb85a8148ea6bbe74867915744a2ec3cb56b --- /dev/null +++ b/codenet/public_test_cases/p00130/output.1.txt @@ -0,0 +1,4 @@ +aecbd +edacb +bacde +bcdae diff --git a/codenet/public_test_cases/p00130/output.2.txt b/codenet/public_test_cases/p00130/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7014cb85a8148ea6bbe74867915744a2ec3cb56b --- /dev/null +++ b/codenet/public_test_cases/p00130/output.2.txt @@ -0,0 +1,4 @@ +aecbd +edacb +bacde +bcdae diff --git a/codenet/public_test_cases/p00131/input.0.txt b/codenet/public_test_cases/p00131/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b507d5e035dfe2a06827e67b60d5f5659fa798de --- /dev/null +++ b/codenet/public_test_cases/p00131/input.0.txt @@ -0,0 +1,11 @@ +1 +0 1 0 0 0 0 0 0 0 0 +1 1 1 0 0 0 0 0 0 0 +0 1 0 0 0 0 0 0 0 0 +0 0 0 0 1 1 0 0 0 0 +0 0 0 1 0 0 1 0 0 0 +0 0 0 0 1 1 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 0 0 1 1 1 +0 0 0 0 0 0 0 0 1 0 diff --git a/codenet/public_test_cases/p00131/input.1.txt b/codenet/public_test_cases/p00131/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b507d5e035dfe2a06827e67b60d5f5659fa798de --- /dev/null +++ b/codenet/public_test_cases/p00131/input.1.txt @@ -0,0 +1,11 @@ +1 +0 1 0 0 0 0 0 0 0 0 +1 1 1 0 0 0 0 0 0 0 +0 1 0 0 0 0 0 0 0 0 +0 0 0 0 1 1 0 0 0 0 +0 0 0 1 0 0 1 0 0 0 +0 0 0 0 1 1 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 0 0 1 1 1 +0 0 0 0 0 0 0 0 1 0 diff --git a/codenet/public_test_cases/p00131/output.0.txt b/codenet/public_test_cases/p00131/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2858774b14e7021caf408fe6471391fccc39ce8 --- /dev/null +++ b/codenet/public_test_cases/p00131/output.0.txt @@ -0,0 +1,10 @@ +0 0 0 0 0 0 0 0 0 0 +0 1 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 1 1 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00131/output.1.txt b/codenet/public_test_cases/p00131/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2858774b14e7021caf408fe6471391fccc39ce8 --- /dev/null +++ b/codenet/public_test_cases/p00131/output.1.txt @@ -0,0 +1,10 @@ +0 0 0 0 0 0 0 0 0 0 +0 1 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 1 1 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00132/input.0.txt b/codenet/public_test_cases/p00132/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59790341e0650abc0ea39cdec27f0058841f2a27 --- /dev/null +++ b/codenet/public_test_cases/p00132/input.0.txt @@ -0,0 +1,81 @@ +14 20 +#################### +###.............#### +####..........###### +#######.....######## +########.....####### +###..###......###### +###..####......##### +#########......##### +###########.....#### +############.....### +###.########......## +###.#######...###.## +##...###....#####.## +#################### +10 +12 15 +#############.. +.##########.... +....#####...... +.....#####..... +.....######.... +......######... +......######... +........#####.. +.........#####. +.........###### +........###...# +.....####.....# +3 3 +#.. +### +#.. +2 2 +## +## +4 10 +....#####. +....###### +...###...# +####.....# +6 5 +....# +..### +##### +##.## +#..## +#..#. +6 4 +...# +.### +#### +##.# +##.# +#... +2 6 +###### +.##### +2 7 +..##### +####### +2 13 +############# +.##########.. +6 9 +#####.... +.######.. +.######.. +..######. +...#####. +....##### +8 +3 1 2 3 +4 1 2 3 4 +7 2 3 4 5 6 7 8 +5 2 3 10 7 8 +6 2 3 9 5 6 4 +8 2 3 4 6 9 5 4 10 +4 4 5 6 9 +5 10 2 3 4 9 +0 0 diff --git a/codenet/public_test_cases/p00132/input.1.txt b/codenet/public_test_cases/p00132/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59790341e0650abc0ea39cdec27f0058841f2a27 --- /dev/null +++ b/codenet/public_test_cases/p00132/input.1.txt @@ -0,0 +1,81 @@ +14 20 +#################### +###.............#### +####..........###### +#######.....######## +########.....####### +###..###......###### +###..####......##### +#########......##### +###########.....#### +############.....### +###.########......## +###.#######...###.## +##...###....#####.## +#################### +10 +12 15 +#############.. +.##########.... +....#####...... +.....#####..... +.....######.... +......######... +......######... +........#####.. +.........#####. +.........###### +........###...# +.....####.....# +3 3 +#.. +### +#.. +2 2 +## +## +4 10 +....#####. +....###### +...###...# +####.....# +6 5 +....# +..### +##### +##.## +#..## +#..#. +6 4 +...# +.### +#### +##.# +##.# +#... +2 6 +###### +.##### +2 7 +..##### +####### +2 13 +############# +.##########.. +6 9 +#####.... +.######.. +.######.. +..######. +...#####. +....##### +8 +3 1 2 3 +4 1 2 3 4 +7 2 3 4 5 6 7 8 +5 2 3 10 7 8 +6 2 3 9 5 6 4 +8 2 3 4 6 9 5 4 10 +4 4 5 6 9 +5 10 2 3 4 9 +0 0 diff --git a/codenet/public_test_cases/p00132/output.0.txt b/codenet/public_test_cases/p00132/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..df03a04834b3f0f081056b34e6c2fa1534e2cc47 --- /dev/null +++ b/codenet/public_test_cases/p00132/output.0.txt @@ -0,0 +1,8 @@ +YES +NO +YES +NO +YES +NO +NO +YES diff --git a/codenet/public_test_cases/p00132/output.1.txt b/codenet/public_test_cases/p00132/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..df03a04834b3f0f081056b34e6c2fa1534e2cc47 --- /dev/null +++ b/codenet/public_test_cases/p00132/output.1.txt @@ -0,0 +1,8 @@ +YES +NO +YES +NO +YES +NO +NO +YES diff --git a/codenet/public_test_cases/p00133/input.0.txt b/codenet/public_test_cases/p00133/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d109c98a3cab1aadf0bbb75cf6178a8b967001d8 --- /dev/null +++ b/codenet/public_test_cases/p00133/input.0.txt @@ -0,0 +1,8 @@ +#******* +#******* +#******* +#******* +#******* +#******* +#******* +######## diff --git a/codenet/public_test_cases/p00133/input.1.txt b/codenet/public_test_cases/p00133/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d109c98a3cab1aadf0bbb75cf6178a8b967001d8 --- /dev/null +++ b/codenet/public_test_cases/p00133/input.1.txt @@ -0,0 +1,8 @@ +#******* +#******* +#******* +#******* +#******* +#******* +#******* +######## diff --git a/codenet/public_test_cases/p00133/input.2.txt b/codenet/public_test_cases/p00133/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..43e9e0249325c5bfd01ae6ce994ac10d8ab6288b --- /dev/null +++ b/codenet/public_test_cases/p00133/input.2.txt @@ -0,0 +1,7 @@ +******* +******* +******* +******* +******* +******* +******* diff --git a/codenet/public_test_cases/p00133/output.0.txt b/codenet/public_test_cases/p00133/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e073d8f2bb92c1f0af4eb18231e9ab23d04ded8 --- /dev/null +++ b/codenet/public_test_cases/p00133/output.0.txt @@ -0,0 +1,27 @@ +90 +######## +#******* +#******* +#******* +#******* +#******* +#******* +#******* +180 +######## +*******# +*******# +*******# +*******# +*******# +*******# +*******# +270 +*******# +*******# +*******# +*******# +*******# +*******# +*******# +######## diff --git a/codenet/public_test_cases/p00133/output.1.txt b/codenet/public_test_cases/p00133/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e073d8f2bb92c1f0af4eb18231e9ab23d04ded8 --- /dev/null +++ b/codenet/public_test_cases/p00133/output.1.txt @@ -0,0 +1,27 @@ +90 +######## +#******* +#******* +#******* +#******* +#******* +#******* +#******* +180 +######## +*******# +*******# +*******# +*******# +*******# +*******# +*******# +270 +*******# +*******# +*******# +*******# +*******# +*******# +*******# +######## diff --git a/codenet/public_test_cases/p00133/output.2.txt b/codenet/public_test_cases/p00133/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7f5a117d71ac226ca4f6eeb561b87cfb4c27d8d --- /dev/null +++ b/codenet/public_test_cases/p00133/output.2.txt @@ -0,0 +1,26 @@ +90 + +******* +******* +******* +******* +******* +******* +******* +180 + +*******# +*******# +*******# +*******# +*******# +*******# +*******# +270 +*******# +*******# +*******# +*******# +*******# +*******# +*******# diff --git a/codenet/public_test_cases/p00134/input.0.txt b/codenet/public_test_cases/p00134/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..70854f3a0050b742df73c360352a5fbcce9f9b49 --- /dev/null +++ b/codenet/public_test_cases/p00134/input.0.txt @@ -0,0 +1,7 @@ +6 +12300 +5600 +33800 +0 +26495 +52000 diff --git a/codenet/public_test_cases/p00134/input.1.txt b/codenet/public_test_cases/p00134/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..70854f3a0050b742df73c360352a5fbcce9f9b49 --- /dev/null +++ b/codenet/public_test_cases/p00134/input.1.txt @@ -0,0 +1,7 @@ +6 +12300 +5600 +33800 +0 +26495 +52000 diff --git a/codenet/public_test_cases/p00134/output.0.txt b/codenet/public_test_cases/p00134/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..671c144ae456b8673683c0b1ea04e75f20c926b9 --- /dev/null +++ b/codenet/public_test_cases/p00134/output.0.txt @@ -0,0 +1 @@ +21699 diff --git a/codenet/public_test_cases/p00134/output.1.txt b/codenet/public_test_cases/p00134/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..671c144ae456b8673683c0b1ea04e75f20c926b9 --- /dev/null +++ b/codenet/public_test_cases/p00134/output.1.txt @@ -0,0 +1 @@ +21699 diff --git a/codenet/public_test_cases/p00135/input.0.txt b/codenet/public_test_cases/p00135/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..68f3d5a61ff248b9b5273a1af8bd6f2cb2fce3e8 --- /dev/null +++ b/codenet/public_test_cases/p00135/input.0.txt @@ -0,0 +1,5 @@ +4 +02:15 +06:01 +11:55 +10:40 diff --git a/codenet/public_test_cases/p00135/input.1.txt b/codenet/public_test_cases/p00135/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..68f3d5a61ff248b9b5273a1af8bd6f2cb2fce3e8 --- /dev/null +++ b/codenet/public_test_cases/p00135/input.1.txt @@ -0,0 +1,5 @@ +4 +02:15 +06:01 +11:55 +10:40 diff --git a/codenet/public_test_cases/p00135/output.0.txt b/codenet/public_test_cases/p00135/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae5b48d3503c781acdf6aa80aed0d2759a098ec0 --- /dev/null +++ b/codenet/public_test_cases/p00135/output.0.txt @@ -0,0 +1,4 @@ +alert +safe +alert +warning diff --git a/codenet/public_test_cases/p00135/output.1.txt b/codenet/public_test_cases/p00135/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae5b48d3503c781acdf6aa80aed0d2759a098ec0 --- /dev/null +++ b/codenet/public_test_cases/p00135/output.1.txt @@ -0,0 +1,4 @@ +alert +safe +alert +warning diff --git a/codenet/public_test_cases/p00136/input.0.txt b/codenet/public_test_cases/p00136/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58bf7e26ec6d0e6438e65e309fc8e0cd6f882dbf --- /dev/null +++ b/codenet/public_test_cases/p00136/input.0.txt @@ -0,0 +1,5 @@ +4 +180.3 +168.2 +165.5 +175.3 diff --git a/codenet/public_test_cases/p00136/input.1.txt b/codenet/public_test_cases/p00136/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58bf7e26ec6d0e6438e65e309fc8e0cd6f882dbf --- /dev/null +++ b/codenet/public_test_cases/p00136/input.1.txt @@ -0,0 +1,5 @@ +4 +180.3 +168.2 +165.5 +175.3 diff --git a/codenet/public_test_cases/p00136/input.2.txt b/codenet/public_test_cases/p00136/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c69c5ea165c19dd8d783612487bc60f9066dc6ad --- /dev/null +++ b/codenet/public_test_cases/p00136/input.2.txt @@ -0,0 +1,22 @@ +21 +179.4 +171.5 +156.6 +173.0 +169.4 +181.2 +172.4 +170.0 +163.6 +165.9 +173.5 +168.2 +162.5 +172.0 +175.1 +172.3 +167.5 +175.9 +186.2 +168.0 +178.6 diff --git a/codenet/public_test_cases/p00136/output.0.txt b/codenet/public_test_cases/p00136/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6819911f0050b23b849faa74c4139937e5f28e98 --- /dev/null +++ b/codenet/public_test_cases/p00136/output.0.txt @@ -0,0 +1,6 @@ +1: +2:** +3: +4:* +5:* +6: diff --git a/codenet/public_test_cases/p00136/output.1.txt b/codenet/public_test_cases/p00136/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6819911f0050b23b849faa74c4139937e5f28e98 --- /dev/null +++ b/codenet/public_test_cases/p00136/output.1.txt @@ -0,0 +1,6 @@ +1: +2:** +3: +4:* +5:* +6: diff --git a/codenet/public_test_cases/p00136/output.2.txt b/codenet/public_test_cases/p00136/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba1cef71bc2fddad7debf24a8c2fb2f68eadf0d7 --- /dev/null +++ b/codenet/public_test_cases/p00136/output.2.txt @@ -0,0 +1,6 @@ +1:*** +2:***** +3:******* +4:**** +5:* +6:* diff --git a/codenet/public_test_cases/p00137/input.0.txt b/codenet/public_test_cases/p00137/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02d9e123b3f47412be611893b9056c4a811341d9 --- /dev/null +++ b/codenet/public_test_cases/p00137/input.0.txt @@ -0,0 +1,3 @@ +2 +123 +567 diff --git a/codenet/public_test_cases/p00137/input.1.txt b/codenet/public_test_cases/p00137/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..02d9e123b3f47412be611893b9056c4a811341d9 --- /dev/null +++ b/codenet/public_test_cases/p00137/input.1.txt @@ -0,0 +1,3 @@ +2 +123 +567 diff --git a/codenet/public_test_cases/p00137/output.0.txt b/codenet/public_test_cases/p00137/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9328c5fc7378c2f38cd110eeb4d21d5de7a6b6aa --- /dev/null +++ b/codenet/public_test_cases/p00137/output.0.txt @@ -0,0 +1,22 @@ +Case 1: +151 +228 +519 +2693 +2522 +3604 +9888 +7725 +6756 +6435 +Case 2: +3214 +3297 +8702 +7248 +5335 +4622 +3628 +1623 +6341 +2082 diff --git a/codenet/public_test_cases/p00137/output.1.txt b/codenet/public_test_cases/p00137/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9328c5fc7378c2f38cd110eeb4d21d5de7a6b6aa --- /dev/null +++ b/codenet/public_test_cases/p00137/output.1.txt @@ -0,0 +1,22 @@ +Case 1: +151 +228 +519 +2693 +2522 +3604 +9888 +7725 +6756 +6435 +Case 2: +3214 +3297 +8702 +7248 +5335 +4622 +3628 +1623 +6341 +2082 diff --git a/codenet/public_test_cases/p00138/input.0.txt b/codenet/public_test_cases/p00138/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb19b1fe9bcac7d6669e3e574aa8ad7728bb4840 --- /dev/null +++ b/codenet/public_test_cases/p00138/input.0.txt @@ -0,0 +1,24 @@ +18 25.46 +16 26.23 +3 23.00 +10 24.79 +5 22.88 +11 23.87 +19 23.90 +1 25.11 +23 23.88 +4 23.46 +7 24.12 +12 22.91 +13 21.99 +14 22.86 +21 23.12 +9 24.09 +17 22.51 +22 23.49 +6 23.02 +20 22.23 +24 21.89 +15 24.14 +8 23.77 +2 23.42 diff --git a/codenet/public_test_cases/p00138/input.1.txt b/codenet/public_test_cases/p00138/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb19b1fe9bcac7d6669e3e574aa8ad7728bb4840 --- /dev/null +++ b/codenet/public_test_cases/p00138/input.1.txt @@ -0,0 +1,24 @@ +18 25.46 +16 26.23 +3 23.00 +10 24.79 +5 22.88 +11 23.87 +19 23.90 +1 25.11 +23 23.88 +4 23.46 +7 24.12 +12 22.91 +13 21.99 +14 22.86 +21 23.12 +9 24.09 +17 22.51 +22 23.49 +6 23.02 +20 22.23 +24 21.89 +15 24.14 +8 23.77 +2 23.42 diff --git a/codenet/public_test_cases/p00138/output.0.txt b/codenet/public_test_cases/p00138/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f170b19dce999ba77e3986f6ae6ca3498a0389cd --- /dev/null +++ b/codenet/public_test_cases/p00138/output.0.txt @@ -0,0 +1,8 @@ +5 22.88 +3 23.00 +13 21.99 +14 22.86 +24 21.89 +20 22.23 +17 22.51 +12 22.91 diff --git a/codenet/public_test_cases/p00138/output.1.txt b/codenet/public_test_cases/p00138/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f170b19dce999ba77e3986f6ae6ca3498a0389cd --- /dev/null +++ b/codenet/public_test_cases/p00138/output.1.txt @@ -0,0 +1,8 @@ +5 22.88 +3 23.00 +13 21.99 +14 22.86 +24 21.89 +20 22.23 +17 22.51 +12 22.91 diff --git a/codenet/public_test_cases/p00139/input.0.txt b/codenet/public_test_cases/p00139/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1767deb1954b220fb4cb58256f9543bc415c0aff --- /dev/null +++ b/codenet/public_test_cases/p00139/input.0.txt @@ -0,0 +1,4 @@ +3 +>'======#======~ +>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~ +>'===#====~ diff --git a/codenet/public_test_cases/p00139/input.1.txt b/codenet/public_test_cases/p00139/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1767deb1954b220fb4cb58256f9543bc415c0aff --- /dev/null +++ b/codenet/public_test_cases/p00139/input.1.txt @@ -0,0 +1,4 @@ +3 +>'======#======~ +>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~ +>'===#====~ diff --git a/codenet/public_test_cases/p00139/output.0.txt b/codenet/public_test_cases/p00139/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cca459d631058776081d99b03aabf6f0af69e0a --- /dev/null +++ b/codenet/public_test_cases/p00139/output.0.txt @@ -0,0 +1,3 @@ +A +B +NA diff --git a/codenet/public_test_cases/p00139/output.1.txt b/codenet/public_test_cases/p00139/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cca459d631058776081d99b03aabf6f0af69e0a --- /dev/null +++ b/codenet/public_test_cases/p00139/output.1.txt @@ -0,0 +1,3 @@ +A +B +NA diff --git a/codenet/public_test_cases/p00140/input.0.txt b/codenet/public_test_cases/p00140/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..968326ef26050b27ac5f6b7d27248b609e1e550f --- /dev/null +++ b/codenet/public_test_cases/p00140/input.0.txt @@ -0,0 +1,3 @@ +2 +2 4 +4 2 diff --git a/codenet/public_test_cases/p00140/input.1.txt b/codenet/public_test_cases/p00140/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..968326ef26050b27ac5f6b7d27248b609e1e550f --- /dev/null +++ b/codenet/public_test_cases/p00140/input.1.txt @@ -0,0 +1,3 @@ +2 +2 4 +4 2 diff --git a/codenet/public_test_cases/p00140/output.0.txt b/codenet/public_test_cases/p00140/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb83bdd8a555585781250f8dbea35b4c42b9f95b --- /dev/null +++ b/codenet/public_test_cases/p00140/output.0.txt @@ -0,0 +1,2 @@ +2 3 4 +4 3 2 diff --git a/codenet/public_test_cases/p00140/output.1.txt b/codenet/public_test_cases/p00140/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb83bdd8a555585781250f8dbea35b4c42b9f95b --- /dev/null +++ b/codenet/public_test_cases/p00140/output.1.txt @@ -0,0 +1,2 @@ +2 3 4 +4 3 2 diff --git a/codenet/public_test_cases/p00141/input.0.txt b/codenet/public_test_cases/p00141/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c17eb53f3028550b87538aa285e69e21ef919fb9 --- /dev/null +++ b/codenet/public_test_cases/p00141/input.0.txt @@ -0,0 +1,3 @@ +2 +5 +6 diff --git a/codenet/public_test_cases/p00141/input.1.txt b/codenet/public_test_cases/p00141/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c17eb53f3028550b87538aa285e69e21ef919fb9 --- /dev/null +++ b/codenet/public_test_cases/p00141/input.1.txt @@ -0,0 +1,3 @@ +2 +5 +6 diff --git a/codenet/public_test_cases/p00141/output.0.txt b/codenet/public_test_cases/p00141/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..114ca0a1a5de73952bd16cd7a418b84b4891d610 --- /dev/null +++ b/codenet/public_test_cases/p00141/output.0.txt @@ -0,0 +1,12 @@ +##### +# # +# # # +# # # +# ### + +###### +# # +# ## # +# # # +# # # +# #### diff --git a/codenet/public_test_cases/p00141/output.1.txt b/codenet/public_test_cases/p00141/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..114ca0a1a5de73952bd16cd7a418b84b4891d610 --- /dev/null +++ b/codenet/public_test_cases/p00141/output.1.txt @@ -0,0 +1,12 @@ +##### +# # +# # # +# # # +# ### + +###### +# # +# ## # +# # # +# # # +# #### diff --git a/codenet/public_test_cases/p00142/input.0.txt b/codenet/public_test_cases/p00142/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5141e50d6d08647d548af4736b217adc112edcaf --- /dev/null +++ b/codenet/public_test_cases/p00142/input.0.txt @@ -0,0 +1,3 @@ +11 +15 +0 diff --git a/codenet/public_test_cases/p00142/input.1.txt b/codenet/public_test_cases/p00142/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5141e50d6d08647d548af4736b217adc112edcaf --- /dev/null +++ b/codenet/public_test_cases/p00142/input.1.txt @@ -0,0 +1,3 @@ +11 +15 +0 diff --git a/codenet/public_test_cases/p00142/output.0.txt b/codenet/public_test_cases/p00142/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56e5ff57950bbf53b791a708f6e2ae8e0ced48e2 --- /dev/null +++ b/codenet/public_test_cases/p00142/output.0.txt @@ -0,0 +1,12 @@ +4 +4 +4 +4 +4 +2 +2 +4 +2 +4 +4 +2 diff --git a/codenet/public_test_cases/p00142/output.1.txt b/codenet/public_test_cases/p00142/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..56e5ff57950bbf53b791a708f6e2ae8e0ced48e2 --- /dev/null +++ b/codenet/public_test_cases/p00142/output.1.txt @@ -0,0 +1,12 @@ +4 +4 +4 +4 +4 +2 +2 +4 +2 +4 +4 +2 diff --git a/codenet/public_test_cases/p00143/input.0.txt b/codenet/public_test_cases/p00143/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0c6f9dcfa7d9b4a7bb6902cd81c579332e86c9d --- /dev/null +++ b/codenet/public_test_cases/p00143/input.0.txt @@ -0,0 +1,6 @@ +5 +2 5 9 2 8 9 2 11 6 5 +2 5 9 2 8 9 2 11 12 6 +2 5 9 2 8 9 2 11 11 9 +14 1 25 7 17 12 17 9 20 5 +14 1 25 7 17 12 22 13 20 5 diff --git a/codenet/public_test_cases/p00143/input.1.txt b/codenet/public_test_cases/p00143/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0c6f9dcfa7d9b4a7bb6902cd81c579332e86c9d --- /dev/null +++ b/codenet/public_test_cases/p00143/input.1.txt @@ -0,0 +1,6 @@ +5 +2 5 9 2 8 9 2 11 6 5 +2 5 9 2 8 9 2 11 12 6 +2 5 9 2 8 9 2 11 11 9 +14 1 25 7 17 12 17 9 20 5 +14 1 25 7 17 12 22 13 20 5 diff --git a/codenet/public_test_cases/p00143/output.0.txt b/codenet/public_test_cases/p00143/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4b45a227229cb6b22dd6df1c0e66f9bac93fd48 --- /dev/null +++ b/codenet/public_test_cases/p00143/output.0.txt @@ -0,0 +1,5 @@ +OK +NG +NG +NG +OK diff --git a/codenet/public_test_cases/p00143/output.1.txt b/codenet/public_test_cases/p00143/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4b45a227229cb6b22dd6df1c0e66f9bac93fd48 --- /dev/null +++ b/codenet/public_test_cases/p00143/output.1.txt @@ -0,0 +1,5 @@ +OK +NG +NG +NG +OK diff --git a/codenet/public_test_cases/p00144/input.0.txt b/codenet/public_test_cases/p00144/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a0200dff3c1b06e75ca8280cc8c5df1230921a9 --- /dev/null +++ b/codenet/public_test_cases/p00144/input.0.txt @@ -0,0 +1,15 @@ +7 +1 4 2 5 4 3 +2 1 5 +3 1 6 +4 1 7 +5 2 7 6 +6 1 1 +7 0 +6 +1 2 2 +1 5 3 +1 2 1 +5 1 3 +6 3 3 +1 7 4 diff --git a/codenet/public_test_cases/p00144/input.1.txt b/codenet/public_test_cases/p00144/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a0200dff3c1b06e75ca8280cc8c5df1230921a9 --- /dev/null +++ b/codenet/public_test_cases/p00144/input.1.txt @@ -0,0 +1,15 @@ +7 +1 4 2 5 4 3 +2 1 5 +3 1 6 +4 1 7 +5 2 7 6 +6 1 1 +7 0 +6 +1 2 2 +1 5 3 +1 2 1 +5 1 3 +6 3 3 +1 7 4 diff --git a/codenet/public_test_cases/p00144/output.0.txt b/codenet/public_test_cases/p00144/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..257da25b0f642d1ab2ff25ed86b6cd75d1e4b770 --- /dev/null +++ b/codenet/public_test_cases/p00144/output.0.txt @@ -0,0 +1,6 @@ +2 +2 +NA +3 +3 +3 diff --git a/codenet/public_test_cases/p00144/output.1.txt b/codenet/public_test_cases/p00144/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..257da25b0f642d1ab2ff25ed86b6cd75d1e4b770 --- /dev/null +++ b/codenet/public_test_cases/p00144/output.1.txt @@ -0,0 +1,6 @@ +2 +2 +NA +3 +3 +3 diff --git a/codenet/public_test_cases/p00145/input.0.txt b/codenet/public_test_cases/p00145/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af93791de193319977ef3ad3aa130d9953ad2faf --- /dev/null +++ b/codenet/public_test_cases/p00145/input.0.txt @@ -0,0 +1,4 @@ +3 +3 5 +2 8 +5 4 diff --git a/codenet/public_test_cases/p00145/input.1.txt b/codenet/public_test_cases/p00145/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af93791de193319977ef3ad3aa130d9953ad2faf --- /dev/null +++ b/codenet/public_test_cases/p00145/input.1.txt @@ -0,0 +1,4 @@ +3 +3 5 +2 8 +5 4 diff --git a/codenet/public_test_cases/p00145/output.0.txt b/codenet/public_test_cases/p00145/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..534a21edd7244e9db55d46372c9665683c036a5d --- /dev/null +++ b/codenet/public_test_cases/p00145/output.0.txt @@ -0,0 +1 @@ +440 diff --git a/codenet/public_test_cases/p00145/output.1.txt b/codenet/public_test_cases/p00145/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..534a21edd7244e9db55d46372c9665683c036a5d --- /dev/null +++ b/codenet/public_test_cases/p00145/output.1.txt @@ -0,0 +1 @@ +440 diff --git a/codenet/public_test_cases/p00146/input.0.txt b/codenet/public_test_cases/p00146/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7904858d9f9f9a7e77e5218faefbf7e595a9363 --- /dev/null +++ b/codenet/public_test_cases/p00146/input.0.txt @@ -0,0 +1,3 @@ +2 +1 100 1 +2 200 2 diff --git a/codenet/public_test_cases/p00146/input.1.txt b/codenet/public_test_cases/p00146/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d9b15673ac60f9c705cc7d04d054d55f94fc6e9 --- /dev/null +++ b/codenet/public_test_cases/p00146/input.1.txt @@ -0,0 +1,6 @@ +5 +13 199 1 +51 1000 1 +37 350 10 +27 300 2 +99 200 1000 diff --git a/codenet/public_test_cases/p00146/input.2.txt b/codenet/public_test_cases/p00146/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc105963476a85eb4bd511b1c271e2b2deb63a5d --- /dev/null +++ b/codenet/public_test_cases/p00146/input.2.txt @@ -0,0 +1,4 @@ +3 +11 100 1 +13 200 20 +12 300 3 diff --git a/codenet/public_test_cases/p00146/input.3.txt b/codenet/public_test_cases/p00146/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7904858d9f9f9a7e77e5218faefbf7e595a9363 --- /dev/null +++ b/codenet/public_test_cases/p00146/input.3.txt @@ -0,0 +1,3 @@ +2 +1 100 1 +2 200 2 diff --git a/codenet/public_test_cases/p00146/output.0.txt b/codenet/public_test_cases/p00146/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p00146/output.0.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p00146/output.1.txt b/codenet/public_test_cases/p00146/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..95cedd90ca4e5ec099ef847e3669f3a0d09a1ae2 --- /dev/null +++ b/codenet/public_test_cases/p00146/output.1.txt @@ -0,0 +1 @@ +51 37 27 13 99 diff --git a/codenet/public_test_cases/p00146/output.2.txt b/codenet/public_test_cases/p00146/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db498d87f01a41305c3814b92177bf2f6148de4a --- /dev/null +++ b/codenet/public_test_cases/p00146/output.2.txt @@ -0,0 +1 @@ +11 12 13 diff --git a/codenet/public_test_cases/p00146/output.3.txt b/codenet/public_test_cases/p00146/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p00146/output.3.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p00147/input.0.txt b/codenet/public_test_cases/p00147/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aac70f843f29afb5bee93055fa1862bf07f7932 --- /dev/null +++ b/codenet/public_test_cases/p00147/input.0.txt @@ -0,0 +1,4 @@ +5 +6 +7 +8 diff --git a/codenet/public_test_cases/p00147/input.1.txt b/codenet/public_test_cases/p00147/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aac70f843f29afb5bee93055fa1862bf07f7932 --- /dev/null +++ b/codenet/public_test_cases/p00147/input.1.txt @@ -0,0 +1,4 @@ +5 +6 +7 +8 diff --git a/codenet/public_test_cases/p00147/output.0.txt b/codenet/public_test_cases/p00147/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..34db05453309ab4042390ca95e25e4dedc5126ff --- /dev/null +++ b/codenet/public_test_cases/p00147/output.0.txt @@ -0,0 +1,4 @@ +0 +14 +9 +4 diff --git a/codenet/public_test_cases/p00147/output.1.txt b/codenet/public_test_cases/p00147/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..34db05453309ab4042390ca95e25e4dedc5126ff --- /dev/null +++ b/codenet/public_test_cases/p00147/output.1.txt @@ -0,0 +1,4 @@ +0 +14 +9 +4 diff --git a/codenet/public_test_cases/p00148/input.0.txt b/codenet/public_test_cases/p00148/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09ab401c5bd31bbb49dd546f8876c25c33999bf6 --- /dev/null +++ b/codenet/public_test_cases/p00148/input.0.txt @@ -0,0 +1,4 @@ +50 +5576 +5577 +5578 diff --git a/codenet/public_test_cases/p00148/input.1.txt b/codenet/public_test_cases/p00148/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09ab401c5bd31bbb49dd546f8876c25c33999bf6 --- /dev/null +++ b/codenet/public_test_cases/p00148/input.1.txt @@ -0,0 +1,4 @@ +50 +5576 +5577 +5578 diff --git a/codenet/public_test_cases/p00148/output.0.txt b/codenet/public_test_cases/p00148/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1ecad803f8ee2973515bc0d39b29c4162b92f79 --- /dev/null +++ b/codenet/public_test_cases/p00148/output.0.txt @@ -0,0 +1,4 @@ +3C11 +3C38 +3C39 +3C01 diff --git a/codenet/public_test_cases/p00148/output.1.txt b/codenet/public_test_cases/p00148/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1ecad803f8ee2973515bc0d39b29c4162b92f79 --- /dev/null +++ b/codenet/public_test_cases/p00148/output.1.txt @@ -0,0 +1,4 @@ +3C11 +3C38 +3C39 +3C01 diff --git a/codenet/public_test_cases/p00149/input.0.txt b/codenet/public_test_cases/p00149/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a5f01a52ca31520a4a510d24efbcfa371bb6839 --- /dev/null +++ b/codenet/public_test_cases/p00149/input.0.txt @@ -0,0 +1,4 @@ +1.0 1.2 +0.8 1.5 +1.2 0.7 +2.0 2.0 diff --git a/codenet/public_test_cases/p00149/input.1.txt b/codenet/public_test_cases/p00149/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a5f01a52ca31520a4a510d24efbcfa371bb6839 --- /dev/null +++ b/codenet/public_test_cases/p00149/input.1.txt @@ -0,0 +1,4 @@ +1.0 1.2 +0.8 1.5 +1.2 0.7 +2.0 2.0 diff --git a/codenet/public_test_cases/p00149/output.0.txt b/codenet/public_test_cases/p00149/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d09c80f5c283a446c6b36475a2385baa08fa65c --- /dev/null +++ b/codenet/public_test_cases/p00149/output.0.txt @@ -0,0 +1,4 @@ +2 3 +2 1 +0 0 +0 0 diff --git a/codenet/public_test_cases/p00149/output.1.txt b/codenet/public_test_cases/p00149/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d09c80f5c283a446c6b36475a2385baa08fa65c --- /dev/null +++ b/codenet/public_test_cases/p00149/output.1.txt @@ -0,0 +1,4 @@ +2 3 +2 1 +0 0 +0 0 diff --git a/codenet/public_test_cases/p00150/input.0.txt b/codenet/public_test_cases/p00150/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76c26dc5224b54873161167d654ea8d9a9b820df --- /dev/null +++ b/codenet/public_test_cases/p00150/input.0.txt @@ -0,0 +1,5 @@ +12 +100 +200 +300 +0 diff --git a/codenet/public_test_cases/p00150/input.1.txt b/codenet/public_test_cases/p00150/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76c26dc5224b54873161167d654ea8d9a9b820df --- /dev/null +++ b/codenet/public_test_cases/p00150/input.1.txt @@ -0,0 +1,5 @@ +12 +100 +200 +300 +0 diff --git a/codenet/public_test_cases/p00150/output.0.txt b/codenet/public_test_cases/p00150/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..400bf8b9171154bd6badb2d1bf534d42eb236fbc --- /dev/null +++ b/codenet/public_test_cases/p00150/output.0.txt @@ -0,0 +1,4 @@ +5 7 +71 73 +197 199 +281 283 diff --git a/codenet/public_test_cases/p00150/output.1.txt b/codenet/public_test_cases/p00150/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..400bf8b9171154bd6badb2d1bf534d42eb236fbc --- /dev/null +++ b/codenet/public_test_cases/p00150/output.1.txt @@ -0,0 +1,4 @@ +5 7 +71 73 +197 199 +281 283 diff --git a/codenet/public_test_cases/p00151/input.0.txt b/codenet/public_test_cases/p00151/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d4ee996c2582dd5bf540dcd3488114061c96ccc --- /dev/null +++ b/codenet/public_test_cases/p00151/input.0.txt @@ -0,0 +1,23 @@ +5 +00011 +00101 +01000 +10101 +00010 +8 +11000001 +10110111 +01100111 +01111010 +11111111 +01011010 +10100010 +10000001 +2 +01 +00 +3 +000 +000 +000 +0 diff --git a/codenet/public_test_cases/p00151/input.1.txt b/codenet/public_test_cases/p00151/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d4ee996c2582dd5bf540dcd3488114061c96ccc --- /dev/null +++ b/codenet/public_test_cases/p00151/input.1.txt @@ -0,0 +1,23 @@ +5 +00011 +00101 +01000 +10101 +00010 +8 +11000001 +10110111 +01100111 +01111010 +11111111 +01011010 +10100010 +10000001 +2 +01 +00 +3 +000 +000 +000 +0 diff --git a/codenet/public_test_cases/p00151/output.0.txt b/codenet/public_test_cases/p00151/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc87b6ddf872d6bb980f98506535358e88ed3243 --- /dev/null +++ b/codenet/public_test_cases/p00151/output.0.txt @@ -0,0 +1,4 @@ +4 +8 +1 +0 diff --git a/codenet/public_test_cases/p00151/output.1.txt b/codenet/public_test_cases/p00151/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc87b6ddf872d6bb980f98506535358e88ed3243 --- /dev/null +++ b/codenet/public_test_cases/p00151/output.1.txt @@ -0,0 +1,4 @@ +4 +8 +1 +0 diff --git a/codenet/public_test_cases/p00152/input.0.txt b/codenet/public_test_cases/p00152/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3960246717fd6f8333a0aac550d08eb93d2d7b5f --- /dev/null +++ b/codenet/public_test_cases/p00152/input.0.txt @@ -0,0 +1,10 @@ +3 +1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 9 1 9 0 +1200 5 3 9 1 7 1 0 0 8 1 10 10 4 3 9 1 8 2 9 +1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 +4 +3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10 +3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1 +3335 10 10 10 10 10 10 10 10 10 10 10 10 +3340 8 2 7 3 6 4 8 2 8 2 9 1 7 3 6 4 8 2 9 1 7 +0 diff --git a/codenet/public_test_cases/p00152/input.1.txt b/codenet/public_test_cases/p00152/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3960246717fd6f8333a0aac550d08eb93d2d7b5f --- /dev/null +++ b/codenet/public_test_cases/p00152/input.1.txt @@ -0,0 +1,10 @@ +3 +1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 9 1 9 0 +1200 5 3 9 1 7 1 0 0 8 1 10 10 4 3 9 1 8 2 9 +1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 +4 +3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10 +3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1 +3335 10 10 10 10 10 10 10 10 10 10 10 10 +3340 8 2 7 3 6 4 8 2 8 2 9 1 7 3 6 4 8 2 9 1 7 +0 diff --git a/codenet/public_test_cases/p00152/output.0.txt b/codenet/public_test_cases/p00152/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..97b56297937033c09eef35b8f3bb5e704916a6a4 --- /dev/null +++ b/codenet/public_test_cases/p00152/output.0.txt @@ -0,0 +1,7 @@ +1200 127 +1010 123 +1101 60 +3335 300 +3321 200 +3340 175 +3332 122 diff --git a/codenet/public_test_cases/p00152/output.1.txt b/codenet/public_test_cases/p00152/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97b56297937033c09eef35b8f3bb5e704916a6a4 --- /dev/null +++ b/codenet/public_test_cases/p00152/output.1.txt @@ -0,0 +1,7 @@ +1200 127 +1010 123 +1101 60 +3335 300 +3321 200 +3340 175 +3332 122 diff --git a/codenet/public_test_cases/p00153/input.0.txt b/codenet/public_test_cases/p00153/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd3bb8d07d39db60e3da4d0b2d555d68ea775b20 --- /dev/null +++ b/codenet/public_test_cases/p00153/input.0.txt @@ -0,0 +1,21 @@ +1 1 +3 1 +3 3 +3 2 +3 +3 12 +9 3 +11 12 +8 7 +5 +15 3 +17 7 +22 5 +7 6 +4 +6 11 +8 2 +16 9 +10 8 +2 +0 0 diff --git a/codenet/public_test_cases/p00153/input.1.txt b/codenet/public_test_cases/p00153/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd3bb8d07d39db60e3da4d0b2d555d68ea775b20 --- /dev/null +++ b/codenet/public_test_cases/p00153/input.1.txt @@ -0,0 +1,21 @@ +1 1 +3 1 +3 3 +3 2 +3 +3 12 +9 3 +11 12 +8 7 +5 +15 3 +17 7 +22 5 +7 6 +4 +6 11 +8 2 +16 9 +10 8 +2 +0 0 diff --git a/codenet/public_test_cases/p00153/output.0.txt b/codenet/public_test_cases/p00153/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b3bcc2b33023f8bc38297a55466efa12dd111e2 --- /dev/null +++ b/codenet/public_test_cases/p00153/output.0.txt @@ -0,0 +1,4 @@ +b +c +d +a diff --git a/codenet/public_test_cases/p00153/output.1.txt b/codenet/public_test_cases/p00153/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b3bcc2b33023f8bc38297a55466efa12dd111e2 --- /dev/null +++ b/codenet/public_test_cases/p00153/output.1.txt @@ -0,0 +1,4 @@ +b +c +d +a diff --git a/codenet/public_test_cases/p00154/input.0.txt b/codenet/public_test_cases/p00154/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb501695e2f39baf491f91b12407ff67ec3e0b5f --- /dev/null +++ b/codenet/public_test_cases/p00154/input.0.txt @@ -0,0 +1,24 @@ +5 +1 10 +5 3 +10 3 +25 2 +50 2 +4 +120 +500 +100 +168 +7 +1 10 +3 10 +5 10 +10 10 +25 10 +50 10 +100 10 +3 +452 +574 +787 +0 diff --git a/codenet/public_test_cases/p00154/input.1.txt b/codenet/public_test_cases/p00154/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb501695e2f39baf491f91b12407ff67ec3e0b5f --- /dev/null +++ b/codenet/public_test_cases/p00154/input.1.txt @@ -0,0 +1,24 @@ +5 +1 10 +5 3 +10 3 +25 2 +50 2 +4 +120 +500 +100 +168 +7 +1 10 +3 10 +5 10 +10 10 +25 10 +50 10 +100 10 +3 +452 +574 +787 +0 diff --git a/codenet/public_test_cases/p00154/output.0.txt b/codenet/public_test_cases/p00154/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c022a40829c3fcd6edfa76c91fb99977541ec8ad --- /dev/null +++ b/codenet/public_test_cases/p00154/output.0.txt @@ -0,0 +1,7 @@ +16 +0 +12 +7 +9789 +13658 +17466 diff --git a/codenet/public_test_cases/p00154/output.1.txt b/codenet/public_test_cases/p00154/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c022a40829c3fcd6edfa76c91fb99977541ec8ad --- /dev/null +++ b/codenet/public_test_cases/p00154/output.1.txt @@ -0,0 +1,7 @@ +16 +0 +12 +7 +9789 +13658 +17466 diff --git a/codenet/public_test_cases/p00155/input.0.txt b/codenet/public_test_cases/p00155/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e02055591847e3f2f377cfb284b35f952539e6de --- /dev/null +++ b/codenet/public_test_cases/p00155/input.0.txt @@ -0,0 +1,34 @@ +4 +1 0 0 +2 30 0 +3 60 40 +4 0 60 +2 +1 3 +1 4 +22 +1 0 0 +2 150 40 +3 30 20 +4 180 150 +5 40 80 +6 130 130 +7 72 28 +8 172 118 +9 50 50 +10 160 82 +11 90 105 +12 144 131 +13 130 64 +14 80 140 +15 38 117 +16 190 90 +17 60 100 +18 100 70 +19 130 100 +20 71 69 +21 200 110 +22 120 150 +1 +1 22 +0 diff --git a/codenet/public_test_cases/p00155/input.1.txt b/codenet/public_test_cases/p00155/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e02055591847e3f2f377cfb284b35f952539e6de --- /dev/null +++ b/codenet/public_test_cases/p00155/input.1.txt @@ -0,0 +1,34 @@ +4 +1 0 0 +2 30 0 +3 60 40 +4 0 60 +2 +1 3 +1 4 +22 +1 0 0 +2 150 40 +3 30 20 +4 180 150 +5 40 80 +6 130 130 +7 72 28 +8 172 118 +9 50 50 +10 160 82 +11 90 105 +12 144 131 +13 130 64 +14 80 140 +15 38 117 +16 190 90 +17 60 100 +18 100 70 +19 130 100 +20 71 69 +21 200 110 +22 120 150 +1 +1 22 +0 diff --git a/codenet/public_test_cases/p00155/output.0.txt b/codenet/public_test_cases/p00155/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e5f4a669322b5021658fd3e4ac5f925853e9910 --- /dev/null +++ b/codenet/public_test_cases/p00155/output.0.txt @@ -0,0 +1,3 @@ +1 2 3 +NA +1 3 9 20 11 6 22 diff --git a/codenet/public_test_cases/p00155/output.1.txt b/codenet/public_test_cases/p00155/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e5f4a669322b5021658fd3e4ac5f925853e9910 --- /dev/null +++ b/codenet/public_test_cases/p00155/output.1.txt @@ -0,0 +1,3 @@ +1 2 3 +NA +1 3 9 20 11 6 22 diff --git a/codenet/public_test_cases/p00156/input.0.txt b/codenet/public_test_cases/p00156/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78fce1d20ced2f89d2183ea0f2e8c14831b99d38 --- /dev/null +++ b/codenet/public_test_cases/p00156/input.0.txt @@ -0,0 +1,38 @@ +5 5 +.###. +#...# +#.&.# +#...# +.###. +18 15 +..####....####.... +####..####....#### +#...............## +.#.############.## +#..#..........#.## +.#.#.########.#.## +#..#.#......#.#.## +.#.#....&...#.#.## +#..#........#.#.## +.#.#.########.#.## +#..#..........#.## +.#.############.## +#...............## +.################# +################## +9 10 +######### +........# +#######.# +#.....#.# +#.###.#.# +#.#&#.#.# +#.#...#.# +#.#####.# +#.......# +######### +9 3 +###...### +#.#.&.#.# +###...### +0 0 diff --git a/codenet/public_test_cases/p00156/input.1.txt b/codenet/public_test_cases/p00156/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78fce1d20ced2f89d2183ea0f2e8c14831b99d38 --- /dev/null +++ b/codenet/public_test_cases/p00156/input.1.txt @@ -0,0 +1,38 @@ +5 5 +.###. +#...# +#.&.# +#...# +.###. +18 15 +..####....####.... +####..####....#### +#...............## +.#.############.## +#..#..........#.## +.#.#.########.#.## +#..#.#......#.#.## +.#.#....&...#.#.## +#..#........#.#.## +.#.#.########.#.## +#..#..........#.## +.#.############.## +#...............## +.################# +################## +9 10 +######### +........# +#######.# +#.....#.# +#.###.#.# +#.#&#.#.# +#.#...#.# +#.#####.# +#.......# +######### +9 3 +###...### +#.#.&.#.# +###...### +0 0 diff --git a/codenet/public_test_cases/p00156/input.2.txt b/codenet/public_test_cases/p00156/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfd0706fbff1922afc554d5bdb4f1eed40e62304 --- /dev/null +++ b/codenet/public_test_cases/p00156/input.2.txt @@ -0,0 +1,39 @@ +5 5 +.###. +...# +.&.# +...# +.###. +18 15 +..####....####.... +..####....#### +...............## +.#.############.## +..#..........#.## +.#.#.########.#.## +..#.#......#.#.## +.#.#....&...#.#.## +..#........#.#.## +.#.#.########.#.## +..#..........#.## +.#.############.## +...............## +.################# + +9 10 + +........# +.# +.....#.# +.###.#.# +.#&#.#.# +.#...#.# +.#####.# +.......# + +9 3 +...### +.#.&.#.# +...### +0 0 + diff --git a/codenet/public_test_cases/p00156/output.0.txt b/codenet/public_test_cases/p00156/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccbfdb44910368788c0b36f2b8561732acbcb16e --- /dev/null +++ b/codenet/public_test_cases/p00156/output.0.txt @@ -0,0 +1,4 @@ +1 +2 +0 +0 diff --git a/codenet/public_test_cases/p00156/output.1.txt b/codenet/public_test_cases/p00156/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccbfdb44910368788c0b36f2b8561732acbcb16e --- /dev/null +++ b/codenet/public_test_cases/p00156/output.1.txt @@ -0,0 +1,4 @@ +1 +2 +0 +0 diff --git a/codenet/public_test_cases/p00156/output.2.txt b/codenet/public_test_cases/p00156/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccbfdb44910368788c0b36f2b8561732acbcb16e --- /dev/null +++ b/codenet/public_test_cases/p00156/output.2.txt @@ -0,0 +1,4 @@ +1 +2 +0 +0 diff --git a/codenet/public_test_cases/p00157/input.0.txt b/codenet/public_test_cases/p00157/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82575121d806838bc5529042de18cabe44615f05 --- /dev/null +++ b/codenet/public_test_cases/p00157/input.0.txt @@ -0,0 +1,33 @@ +6 +1 1 +4 3 +6 5 +8 6 +10 10 +14 14 +5 +2 2 +5 4 +6 6 +9 8 +15 10 +4 +1 1 +4 3 +6 5 +8 6 +3 +2 2 +5 4 +6 6 +4 +1 1 +4 3 +6 5 +8 6 +4 +10 10 +12 11 +18 15 +24 20 +0 diff --git a/codenet/public_test_cases/p00157/input.1.txt b/codenet/public_test_cases/p00157/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..82575121d806838bc5529042de18cabe44615f05 --- /dev/null +++ b/codenet/public_test_cases/p00157/input.1.txt @@ -0,0 +1,33 @@ +6 +1 1 +4 3 +6 5 +8 6 +10 10 +14 14 +5 +2 2 +5 4 +6 6 +9 8 +15 10 +4 +1 1 +4 3 +6 5 +8 6 +3 +2 2 +5 4 +6 6 +4 +1 1 +4 3 +6 5 +8 6 +4 +10 10 +12 11 +18 15 +24 20 +0 diff --git a/codenet/public_test_cases/p00157/output.0.txt b/codenet/public_test_cases/p00157/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62389651958500459c1b4fee7742b0981f5856a7 --- /dev/null +++ b/codenet/public_test_cases/p00157/output.0.txt @@ -0,0 +1,3 @@ +9 +6 +8 diff --git a/codenet/public_test_cases/p00157/output.1.txt b/codenet/public_test_cases/p00157/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..62389651958500459c1b4fee7742b0981f5856a7 --- /dev/null +++ b/codenet/public_test_cases/p00157/output.1.txt @@ -0,0 +1,3 @@ +9 +6 +8 diff --git a/codenet/public_test_cases/p00158/input.0.txt b/codenet/public_test_cases/p00158/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14d1ccaf9adf371fd7a45a17a78140a1de83590d --- /dev/null +++ b/codenet/public_test_cases/p00158/input.0.txt @@ -0,0 +1,3 @@ +3 +10 +0 diff --git a/codenet/public_test_cases/p00158/input.1.txt b/codenet/public_test_cases/p00158/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14d1ccaf9adf371fd7a45a17a78140a1de83590d --- /dev/null +++ b/codenet/public_test_cases/p00158/input.1.txt @@ -0,0 +1,3 @@ +3 +10 +0 diff --git a/codenet/public_test_cases/p00158/output.0.txt b/codenet/public_test_cases/p00158/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c95497458af2e9fb757da2f5861da8da3116d8a5 --- /dev/null +++ b/codenet/public_test_cases/p00158/output.0.txt @@ -0,0 +1,2 @@ +7 +6 diff --git a/codenet/public_test_cases/p00158/output.1.txt b/codenet/public_test_cases/p00158/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c95497458af2e9fb757da2f5861da8da3116d8a5 --- /dev/null +++ b/codenet/public_test_cases/p00158/output.1.txt @@ -0,0 +1,2 @@ +7 +6 diff --git a/codenet/public_test_cases/p00159/input.0.txt b/codenet/public_test_cases/p00159/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0affb8142d542df54b485600d3f31d146304876 --- /dev/null +++ b/codenet/public_test_cases/p00159/input.0.txt @@ -0,0 +1,12 @@ +6 +1 165 66 +2 178 60 +3 180 72 +4 160 65 +5 185 62 +6 182 62 +3 +3 160 65 +2 180 70 +1 170 75 +0 diff --git a/codenet/public_test_cases/p00159/input.1.txt b/codenet/public_test_cases/p00159/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0affb8142d542df54b485600d3f31d146304876 --- /dev/null +++ b/codenet/public_test_cases/p00159/input.1.txt @@ -0,0 +1,12 @@ +6 +1 165 66 +2 178 60 +3 180 72 +4 160 65 +5 185 62 +6 182 62 +3 +3 160 65 +2 180 70 +1 170 75 +0 diff --git a/codenet/public_test_cases/p00159/output.0.txt b/codenet/public_test_cases/p00159/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e5eeed2d935fb330d6755eeb3e46d18fa7aac1 --- /dev/null +++ b/codenet/public_test_cases/p00159/output.0.txt @@ -0,0 +1,2 @@ +3 +2 diff --git a/codenet/public_test_cases/p00159/output.1.txt b/codenet/public_test_cases/p00159/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e5eeed2d935fb330d6755eeb3e46d18fa7aac1 --- /dev/null +++ b/codenet/public_test_cases/p00159/output.1.txt @@ -0,0 +1,2 @@ +3 +2 diff --git a/codenet/public_test_cases/p00160/input.0.txt b/codenet/public_test_cases/p00160/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9e3063eeec4763d62cca248ad3c8260a620cbb7 --- /dev/null +++ b/codenet/public_test_cases/p00160/input.0.txt @@ -0,0 +1,8 @@ +2 +50 25 5 5 +80 60 10 30 +3 +10 15 25 24 +5 8 12 5 +30 30 30 18 +0 diff --git a/codenet/public_test_cases/p00160/input.1.txt b/codenet/public_test_cases/p00160/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9e3063eeec4763d62cca248ad3c8260a620cbb7 --- /dev/null +++ b/codenet/public_test_cases/p00160/input.1.txt @@ -0,0 +1,8 @@ +2 +50 25 5 5 +80 60 10 30 +3 +10 15 25 24 +5 8 12 5 +30 30 30 18 +0 diff --git a/codenet/public_test_cases/p00160/output.0.txt b/codenet/public_test_cases/p00160/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..43206667d116d1eeea6566eea12a00cdba4bbf20 --- /dev/null +++ b/codenet/public_test_cases/p00160/output.0.txt @@ -0,0 +1,2 @@ +800 +3800 diff --git a/codenet/public_test_cases/p00160/output.1.txt b/codenet/public_test_cases/p00160/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..43206667d116d1eeea6566eea12a00cdba4bbf20 --- /dev/null +++ b/codenet/public_test_cases/p00160/output.1.txt @@ -0,0 +1,2 @@ +800 +3800 diff --git a/codenet/public_test_cases/p00161/input.0.txt b/codenet/public_test_cases/p00161/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8446ef7caed5e02abc894185c57dff67363313b2 --- /dev/null +++ b/codenet/public_test_cases/p00161/input.0.txt @@ -0,0 +1,15 @@ +8 +34001 3 20 3 8 6 27 2 25 +20941 3 5 2 41 7 19 2 42 +90585 4 8 3 12 6 46 2 34 +92201 3 28 2 47 6 37 2 58 +10001 3 50 2 42 7 12 2 54 +63812 4 11 3 11 6 53 2 22 +54092 3 33 2 54 6 18 2 19 +25012 3 44 2 58 6 45 2 46 +4 +1 3 23 1 23 1 34 4 44 +2 5 12 2 12 3 41 2 29 +3 5 24 1 24 2 0 3 35 +4 4 49 2 22 4 41 4 23 +0 diff --git a/codenet/public_test_cases/p00161/input.1.txt b/codenet/public_test_cases/p00161/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8446ef7caed5e02abc894185c57dff67363313b2 --- /dev/null +++ b/codenet/public_test_cases/p00161/input.1.txt @@ -0,0 +1,15 @@ +8 +34001 3 20 3 8 6 27 2 25 +20941 3 5 2 41 7 19 2 42 +90585 4 8 3 12 6 46 2 34 +92201 3 28 2 47 6 37 2 58 +10001 3 50 2 42 7 12 2 54 +63812 4 11 3 11 6 53 2 22 +54092 3 33 2 54 6 18 2 19 +25012 3 44 2 58 6 45 2 46 +4 +1 3 23 1 23 1 34 4 44 +2 5 12 2 12 3 41 2 29 +3 5 24 1 24 2 0 3 35 +4 4 49 2 22 4 41 4 23 +0 diff --git a/codenet/public_test_cases/p00161/output.0.txt b/codenet/public_test_cases/p00161/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..077ec8769cc5397b9f48a80c9edd0982f1994a0c --- /dev/null +++ b/codenet/public_test_cases/p00161/output.0.txt @@ -0,0 +1,6 @@ +54092 +34001 +10001 +1 +3 +2 diff --git a/codenet/public_test_cases/p00161/output.1.txt b/codenet/public_test_cases/p00161/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..077ec8769cc5397b9f48a80c9edd0982f1994a0c --- /dev/null +++ b/codenet/public_test_cases/p00161/output.1.txt @@ -0,0 +1,6 @@ +54092 +34001 +10001 +1 +3 +2 diff --git a/codenet/public_test_cases/p00162/input.0.txt b/codenet/public_test_cases/p00162/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..366d5742fcafad07b0d5e45275cb2157e9c7686a --- /dev/null +++ b/codenet/public_test_cases/p00162/input.0.txt @@ -0,0 +1,4 @@ +3 8 +1 27 +1 86 +0 diff --git a/codenet/public_test_cases/p00162/input.1.txt b/codenet/public_test_cases/p00162/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..366d5742fcafad07b0d5e45275cb2157e9c7686a --- /dev/null +++ b/codenet/public_test_cases/p00162/input.1.txt @@ -0,0 +1,4 @@ +3 8 +1 27 +1 86 +0 diff --git a/codenet/public_test_cases/p00162/output.0.txt b/codenet/public_test_cases/p00162/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d1f1c825b27675e1c7c615c55739fdcc47af3c0 --- /dev/null +++ b/codenet/public_test_cases/p00162/output.0.txt @@ -0,0 +1,3 @@ +5 +17 +31 diff --git a/codenet/public_test_cases/p00162/output.1.txt b/codenet/public_test_cases/p00162/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d1f1c825b27675e1c7c615c55739fdcc47af3c0 --- /dev/null +++ b/codenet/public_test_cases/p00162/output.1.txt @@ -0,0 +1,3 @@ +5 +17 +31 diff --git a/codenet/public_test_cases/p00163/input.0.txt b/codenet/public_test_cases/p00163/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf73f7be57cdb434154dfebf3ad3e6fc8b64222e --- /dev/null +++ b/codenet/public_test_cases/p00163/input.0.txt @@ -0,0 +1,9 @@ +2 +17 25 +4 +17 45 +4 +17 25 +7 +19 35 +0 diff --git a/codenet/public_test_cases/p00163/input.1.txt b/codenet/public_test_cases/p00163/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf73f7be57cdb434154dfebf3ad3e6fc8b64222e --- /dev/null +++ b/codenet/public_test_cases/p00163/input.1.txt @@ -0,0 +1,9 @@ +2 +17 25 +4 +17 45 +4 +17 25 +7 +19 35 +0 diff --git a/codenet/public_test_cases/p00163/output.0.txt b/codenet/public_test_cases/p00163/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1ba533b0b53c90981cff06899513c2a8617c6f --- /dev/null +++ b/codenet/public_test_cases/p00163/output.0.txt @@ -0,0 +1,2 @@ +250 +1300 diff --git a/codenet/public_test_cases/p00163/output.1.txt b/codenet/public_test_cases/p00163/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1ba533b0b53c90981cff06899513c2a8617c6f --- /dev/null +++ b/codenet/public_test_cases/p00163/output.1.txt @@ -0,0 +1,2 @@ +250 +1300 diff --git a/codenet/public_test_cases/p00164/input.0.txt b/codenet/public_test_cases/p00164/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7da4686f60482e88e1dea4bd4d243e45fe12e068 --- /dev/null +++ b/codenet/public_test_cases/p00164/input.0.txt @@ -0,0 +1,5 @@ +4 +3 1 4 2 +3 +4 3 2 +0 diff --git a/codenet/public_test_cases/p00164/output.0.txt b/codenet/public_test_cases/p00164/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb51cb5f36cd5f00d6c6ed2651d98af85182782c --- /dev/null +++ b/codenet/public_test_cases/p00164/output.0.txt @@ -0,0 +1,28 @@ +31 +28 +26 +25 +21 +17 +16 +14 +11 +8 +6 +5 +1 +0 +31 +27 +26 +23 +21 +19 +16 +12 +11 +8 +6 +4 +1 +0 diff --git a/codenet/public_test_cases/p00165/input.0.txt b/codenet/public_test_cases/p00165/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1f8a73539df5307f4f16e41ff1743fcb1532a60 --- /dev/null +++ b/codenet/public_test_cases/p00165/input.0.txt @@ -0,0 +1,8 @@ +4 +5 0 +9 1 +3 10 +11 3 +1 +999983 20 +0 diff --git a/codenet/public_test_cases/p00165/input.1.txt b/codenet/public_test_cases/p00165/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1f8a73539df5307f4f16e41ff1743fcb1532a60 --- /dev/null +++ b/codenet/public_test_cases/p00165/input.1.txt @@ -0,0 +1,8 @@ +4 +5 0 +9 1 +3 10 +11 3 +1 +999983 20 +0 diff --git a/codenet/public_test_cases/p00165/output.0.txt b/codenet/public_test_cases/p00165/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af74fdcd71a03732095b62ca716ac02310b9fa71 --- /dev/null +++ b/codenet/public_test_cases/p00165/output.0.txt @@ -0,0 +1,2 @@ +5 +1 diff --git a/codenet/public_test_cases/p00165/output.1.txt b/codenet/public_test_cases/p00165/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af74fdcd71a03732095b62ca716ac02310b9fa71 --- /dev/null +++ b/codenet/public_test_cases/p00165/output.1.txt @@ -0,0 +1,2 @@ +5 +1 diff --git a/codenet/public_test_cases/p00166/input.0.txt b/codenet/public_test_cases/p00166/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8824f35eb1609627c4428d87d3d43b4551981d0 --- /dev/null +++ b/codenet/public_test_cases/p00166/input.0.txt @@ -0,0 +1,28 @@ +4 +30 +125 +75 +4 +30 +125 +75 +5 +30 +125 +75 +65 +4 +30 +125 +75 +4 +30 +125 +75 +6 +30 +50 +50 +25 +75 +0 diff --git a/codenet/public_test_cases/p00166/input.1.txt b/codenet/public_test_cases/p00166/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8824f35eb1609627c4428d87d3d43b4551981d0 --- /dev/null +++ b/codenet/public_test_cases/p00166/input.1.txt @@ -0,0 +1,28 @@ +4 +30 +125 +75 +4 +30 +125 +75 +5 +30 +125 +75 +65 +4 +30 +125 +75 +4 +30 +125 +75 +6 +30 +50 +50 +25 +75 +0 diff --git a/codenet/public_test_cases/p00166/output.0.txt b/codenet/public_test_cases/p00166/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4539bbf2d22d5c3b4227859ff854eda060a687fb --- /dev/null +++ b/codenet/public_test_cases/p00166/output.0.txt @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/codenet/public_test_cases/p00166/output.1.txt b/codenet/public_test_cases/p00166/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4539bbf2d22d5c3b4227859ff854eda060a687fb --- /dev/null +++ b/codenet/public_test_cases/p00166/output.1.txt @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/codenet/public_test_cases/p00167/input.0.txt b/codenet/public_test_cases/p00167/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d757cf5ffc2afc4e1d0444fc35d1571e11af35de --- /dev/null +++ b/codenet/public_test_cases/p00167/input.0.txt @@ -0,0 +1,18 @@ +5 +5 +3 +2 +1 +4 +6 +1 +2 +3 +4 +5 +6 +3 +3 +2 +1 +0 diff --git a/codenet/public_test_cases/p00167/input.1.txt b/codenet/public_test_cases/p00167/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d757cf5ffc2afc4e1d0444fc35d1571e11af35de --- /dev/null +++ b/codenet/public_test_cases/p00167/input.1.txt @@ -0,0 +1,18 @@ +5 +5 +3 +2 +1 +4 +6 +1 +2 +3 +4 +5 +6 +3 +3 +2 +1 +0 diff --git a/codenet/public_test_cases/p00167/output.0.txt b/codenet/public_test_cases/p00167/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..895ee63c4579e5fada120cd28916fccc323d6949 --- /dev/null +++ b/codenet/public_test_cases/p00167/output.0.txt @@ -0,0 +1,3 @@ +7 +0 +3 diff --git a/codenet/public_test_cases/p00167/output.1.txt b/codenet/public_test_cases/p00167/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..895ee63c4579e5fada120cd28916fccc323d6949 --- /dev/null +++ b/codenet/public_test_cases/p00167/output.1.txt @@ -0,0 +1,3 @@ +7 +0 +3 diff --git a/codenet/public_test_cases/p00168/input.0.txt b/codenet/public_test_cases/p00168/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d95e395d7197549d417e4ac2c36aa976a7caad01 --- /dev/null +++ b/codenet/public_test_cases/p00168/input.0.txt @@ -0,0 +1,5 @@ +1 +10 +20 +25 +0 diff --git a/codenet/public_test_cases/p00168/input.1.txt b/codenet/public_test_cases/p00168/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d95e395d7197549d417e4ac2c36aa976a7caad01 --- /dev/null +++ b/codenet/public_test_cases/p00168/input.1.txt @@ -0,0 +1,5 @@ +1 +10 +20 +25 +0 diff --git a/codenet/public_test_cases/p00168/output.0.txt b/codenet/public_test_cases/p00168/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29c5b9e6c93190bc22db4b26e689707d8da89512 --- /dev/null +++ b/codenet/public_test_cases/p00168/output.0.txt @@ -0,0 +1,4 @@ +1 +1 +34 +701 diff --git a/codenet/public_test_cases/p00168/output.1.txt b/codenet/public_test_cases/p00168/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29c5b9e6c93190bc22db4b26e689707d8da89512 --- /dev/null +++ b/codenet/public_test_cases/p00168/output.1.txt @@ -0,0 +1,4 @@ +1 +1 +34 +701 diff --git a/codenet/public_test_cases/p00169/input.0.txt b/codenet/public_test_cases/p00169/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecd069f9df0f075965a42dba4e7b6604fde19fd9 --- /dev/null +++ b/codenet/public_test_cases/p00169/input.0.txt @@ -0,0 +1,6 @@ +1 +7 7 7 +7 7 8 +12 1 +10 1 1 +0 diff --git a/codenet/public_test_cases/p00169/input.1.txt b/codenet/public_test_cases/p00169/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecd069f9df0f075965a42dba4e7b6604fde19fd9 --- /dev/null +++ b/codenet/public_test_cases/p00169/input.1.txt @@ -0,0 +1,6 @@ +1 +7 7 7 +7 7 8 +12 1 +10 1 1 +0 diff --git a/codenet/public_test_cases/p00169/output.0.txt b/codenet/public_test_cases/p00169/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdc90ac5b11f75194902a85e7d5b89b08ee40c5a --- /dev/null +++ b/codenet/public_test_cases/p00169/output.0.txt @@ -0,0 +1,5 @@ +11 +21 +0 +21 +12 diff --git a/codenet/public_test_cases/p00169/output.1.txt b/codenet/public_test_cases/p00169/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdc90ac5b11f75194902a85e7d5b89b08ee40c5a --- /dev/null +++ b/codenet/public_test_cases/p00169/output.1.txt @@ -0,0 +1,5 @@ +11 +21 +0 +21 +12 diff --git a/codenet/public_test_cases/p00170/input.0.txt b/codenet/public_test_cases/p00170/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aab9d9ae380ac76fe6890857d13e5abdce1e9115 --- /dev/null +++ b/codenet/public_test_cases/p00170/input.0.txt @@ -0,0 +1,16 @@ +4 +sandwich 80 120 +apple 50 200 +cheese 20 40 +cake 100 100 +9 +onigiri 80 300 +onigiri 80 300 +anpan 70 280 +mikan 50 80 +kanzume 100 500 +chocolate 50 350 +cookie 30 80 +purin 40 400 +cracker 40 160 +0 diff --git a/codenet/public_test_cases/p00170/input.1.txt b/codenet/public_test_cases/p00170/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aab9d9ae380ac76fe6890857d13e5abdce1e9115 --- /dev/null +++ b/codenet/public_test_cases/p00170/input.1.txt @@ -0,0 +1,16 @@ +4 +sandwich 80 120 +apple 50 200 +cheese 20 40 +cake 100 100 +9 +onigiri 80 300 +onigiri 80 300 +anpan 70 280 +mikan 50 80 +kanzume 100 500 +chocolate 50 350 +cookie 30 80 +purin 40 400 +cracker 40 160 +0 diff --git a/codenet/public_test_cases/p00170/output.0.txt b/codenet/public_test_cases/p00170/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ab547c7d5f38ae39ac32b8fa9380a9351ae030b --- /dev/null +++ b/codenet/public_test_cases/p00170/output.0.txt @@ -0,0 +1,13 @@ +apple +cake +sandwich +cheese +kanzume +purin +chocolate +onigiri +onigiri +anpan +mikan +cracker +cookie diff --git a/codenet/public_test_cases/p00170/output.1.txt b/codenet/public_test_cases/p00170/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ab547c7d5f38ae39ac32b8fa9380a9351ae030b --- /dev/null +++ b/codenet/public_test_cases/p00170/output.1.txt @@ -0,0 +1,13 @@ +apple +cake +sandwich +cheese +kanzume +purin +chocolate +onigiri +onigiri +anpan +mikan +cracker +cookie diff --git a/codenet/public_test_cases/p00171/input.0.txt b/codenet/public_test_cases/p00171/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e30e6d3e2c821600076dba427528f7144922482 --- /dev/null +++ b/codenet/public_test_cases/p00171/input.0.txt @@ -0,0 +1,41 @@ +zabZNq +BCxmAi +ZcbBCj +aizXCm +QgmABC +JHzMop +ImoXGz +MZTOhp +zabZnQ +BCxmAi +ZcbBCj +aizXCm +QgmABC +JHzMop +ImoXGz +MZTOhp +abcdef +ABDCFE +FBDCAE +abcdef +BEACDF +bfcaed +fabcde +DEABCF +UnivOf +AizuaH +zTXZYW +piglIt +GRULNP +higGtH +uAzIXZ +FizmKZ +UnivOf +AizuaH +piglIt +higGtH +GRULNP +uAzIXZ +FizmKZ +ZTXzYW +0 diff --git a/codenet/public_test_cases/p00171/input.1.txt b/codenet/public_test_cases/p00171/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e30e6d3e2c821600076dba427528f7144922482 --- /dev/null +++ b/codenet/public_test_cases/p00171/input.1.txt @@ -0,0 +1,41 @@ +zabZNq +BCxmAi +ZcbBCj +aizXCm +QgmABC +JHzMop +ImoXGz +MZTOhp +zabZnQ +BCxmAi +ZcbBCj +aizXCm +QgmABC +JHzMop +ImoXGz +MZTOhp +abcdef +ABDCFE +FBDCAE +abcdef +BEACDF +bfcaed +fabcde +DEABCF +UnivOf +AizuaH +zTXZYW +piglIt +GRULNP +higGtH +uAzIXZ +FizmKZ +UnivOf +AizuaH +piglIt +higGtH +GRULNP +uAzIXZ +FizmKZ +ZTXzYW +0 diff --git a/codenet/public_test_cases/p00171/output.0.txt b/codenet/public_test_cases/p00171/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6591b85a854fbd799ec89ab32514879fc9ad3255 --- /dev/null +++ b/codenet/public_test_cases/p00171/output.0.txt @@ -0,0 +1,5 @@ +YES +NO +YES +YES +NO diff --git a/codenet/public_test_cases/p00171/output.1.txt b/codenet/public_test_cases/p00171/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6591b85a854fbd799ec89ab32514879fc9ad3255 --- /dev/null +++ b/codenet/public_test_cases/p00171/output.1.txt @@ -0,0 +1,5 @@ +YES +NO +YES +YES +NO diff --git a/codenet/public_test_cases/p00172/input.0.txt b/codenet/public_test_cases/p00172/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..46a85c428df4a7aee1ca380ea4373217362f93dd --- /dev/null +++ b/codenet/public_test_cases/p00172/input.0.txt @@ -0,0 +1,28 @@ +4 3 +1 2 +2 3 +2 4 +1 0 0 0 +2 2 3 +0 +3 1 2 4 +2 2 3 +4 3 +1 2 +2 3 +2 4 +1 0 0 0 +2 2 3 +0 +3 1 2 4 +1 3 +4 3 +1 2 +2 3 +2 4 +1 0 0 0 +2 2 3 +0 +2 1 2 +2 2 3 +0 0 diff --git a/codenet/public_test_cases/p00172/input.1.txt b/codenet/public_test_cases/p00172/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46a85c428df4a7aee1ca380ea4373217362f93dd --- /dev/null +++ b/codenet/public_test_cases/p00172/input.1.txt @@ -0,0 +1,28 @@ +4 3 +1 2 +2 3 +2 4 +1 0 0 0 +2 2 3 +0 +3 1 2 4 +2 2 3 +4 3 +1 2 +2 3 +2 4 +1 0 0 0 +2 2 3 +0 +3 1 2 4 +1 3 +4 3 +1 2 +2 3 +2 4 +1 0 0 0 +2 2 3 +0 +2 1 2 +2 2 3 +0 0 diff --git a/codenet/public_test_cases/p00172/output.0.txt b/codenet/public_test_cases/p00172/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eec2bfdf1f3e7cdde1098c3bcb7453913af70a77 --- /dev/null +++ b/codenet/public_test_cases/p00172/output.0.txt @@ -0,0 +1,13 @@ +You can go home in 10 steps. +Switch on room 2. +Switch on room 3. +Move to room 2. +Move to room 3. +Switch off room 1. +Switch on room 4. +Move to room 2. +Move to room 4. +Switch off room 2. +Switch off room 3. +You can not switch off all lights. +Help me! diff --git a/codenet/public_test_cases/p00172/output.1.txt b/codenet/public_test_cases/p00172/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eec2bfdf1f3e7cdde1098c3bcb7453913af70a77 --- /dev/null +++ b/codenet/public_test_cases/p00172/output.1.txt @@ -0,0 +1,13 @@ +You can go home in 10 steps. +Switch on room 2. +Switch on room 3. +Move to room 2. +Move to room 3. +Switch off room 1. +Switch on room 4. +Move to room 2. +Move to room 4. +Switch off room 2. +Switch off room 3. +You can not switch off all lights. +Help me! diff --git a/codenet/public_test_cases/p00173/input.0.txt b/codenet/public_test_cases/p00173/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3a1a51b61b82d7d2b9c2a792a85b86f955a7ef1 --- /dev/null +++ b/codenet/public_test_cases/p00173/input.0.txt @@ -0,0 +1,9 @@ +1a 132 243 +1c 324 183 +1f 93 199 +2b 372 163 +2c 229 293 +2e 391 206 +3a 118 168 +3b 263 293 +3d 281 102 diff --git a/codenet/public_test_cases/p00173/input.1.txt b/codenet/public_test_cases/p00173/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3a1a51b61b82d7d2b9c2a792a85b86f955a7ef1 --- /dev/null +++ b/codenet/public_test_cases/p00173/input.1.txt @@ -0,0 +1,9 @@ +1a 132 243 +1c 324 183 +1f 93 199 +2b 372 163 +2c 229 293 +2e 391 206 +3a 118 168 +3b 263 293 +3d 281 102 diff --git a/codenet/public_test_cases/p00173/output.0.txt b/codenet/public_test_cases/p00173/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..10b1b92a7b2f42cd3f000046653e7d49fca56e3d --- /dev/null +++ b/codenet/public_test_cases/p00173/output.0.txt @@ -0,0 +1,9 @@ +1a 375 99300 +1c 507 119700 +1f 292 78300 +2b 535 123300 +2c 522 133700 +2e 597 140000 +3a 286 74000 +3b 556 140500 +3d 383 86800 diff --git a/codenet/public_test_cases/p00173/output.1.txt b/codenet/public_test_cases/p00173/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..10b1b92a7b2f42cd3f000046653e7d49fca56e3d --- /dev/null +++ b/codenet/public_test_cases/p00173/output.1.txt @@ -0,0 +1,9 @@ +1a 375 99300 +1c 507 119700 +1f 292 78300 +2b 535 123300 +2c 522 133700 +2e 597 140000 +3a 286 74000 +3b 556 140500 +3d 383 86800 diff --git a/codenet/public_test_cases/p00174/input.0.txt b/codenet/public_test_cases/p00174/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61da7ffc846d5139d49478b0575d3cc149b77726 --- /dev/null +++ b/codenet/public_test_cases/p00174/input.0.txt @@ -0,0 +1,7 @@ +ABAABBBAABABAAABBAA +AABBBABBABBAAABABABAAB +BABAABAABABABBAAAB +AABABAAABBAABBBABAA +AAAAAAAAAAA +ABBBBBBBBBB +0 diff --git a/codenet/public_test_cases/p00174/input.1.txt b/codenet/public_test_cases/p00174/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..61da7ffc846d5139d49478b0575d3cc149b77726 --- /dev/null +++ b/codenet/public_test_cases/p00174/input.1.txt @@ -0,0 +1,7 @@ +ABAABBBAABABAAABBAA +AABBBABBABBAAABABABAAB +BABAABAABABABBAAAB +AABABAAABBAABBBABAA +AAAAAAAAAAA +ABBBBBBBBBB +0 diff --git a/codenet/public_test_cases/p00174/output.0.txt b/codenet/public_test_cases/p00174/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6928877e2806cc2760d1847748755f370c7a8b23 --- /dev/null +++ b/codenet/public_test_cases/p00174/output.0.txt @@ -0,0 +1,6 @@ +11 8 +10 12 +11 7 +11 8 +11 0 +0 11 diff --git a/codenet/public_test_cases/p00174/output.1.txt b/codenet/public_test_cases/p00174/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6928877e2806cc2760d1847748755f370c7a8b23 --- /dev/null +++ b/codenet/public_test_cases/p00174/output.1.txt @@ -0,0 +1,6 @@ +11 8 +10 12 +11 7 +11 8 +11 0 +0 11 diff --git a/codenet/public_test_cases/p00175/input.0.txt b/codenet/public_test_cases/p00175/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a39ca8e963a25869b000b148950624736975abc8 --- /dev/null +++ b/codenet/public_test_cases/p00175/input.0.txt @@ -0,0 +1,7 @@ +7 +4 +0 +12 +10 +10000 +-1 diff --git a/codenet/public_test_cases/p00175/input.1.txt b/codenet/public_test_cases/p00175/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a39ca8e963a25869b000b148950624736975abc8 --- /dev/null +++ b/codenet/public_test_cases/p00175/input.1.txt @@ -0,0 +1,7 @@ +7 +4 +0 +12 +10 +10000 +-1 diff --git a/codenet/public_test_cases/p00175/output.0.txt b/codenet/public_test_cases/p00175/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b86711423d777fbcb5b2063a87fb104421d34f28 --- /dev/null +++ b/codenet/public_test_cases/p00175/output.0.txt @@ -0,0 +1,6 @@ +13 +10 +0 +30 +22 +2130100 diff --git a/codenet/public_test_cases/p00175/output.1.txt b/codenet/public_test_cases/p00175/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b86711423d777fbcb5b2063a87fb104421d34f28 --- /dev/null +++ b/codenet/public_test_cases/p00175/output.1.txt @@ -0,0 +1,6 @@ +13 +10 +0 +30 +22 +2130100 diff --git a/codenet/public_test_cases/p00176/input.0.txt b/codenet/public_test_cases/p00176/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1062b4709dc99b68adc143f202eb772ee5882a42 --- /dev/null +++ b/codenet/public_test_cases/p00176/input.0.txt @@ -0,0 +1,5 @@ +#ffe085 +#787878 +#decade +#ff55ff +0 diff --git a/codenet/public_test_cases/p00176/input.1.txt b/codenet/public_test_cases/p00176/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1062b4709dc99b68adc143f202eb772ee5882a42 --- /dev/null +++ b/codenet/public_test_cases/p00176/input.1.txt @@ -0,0 +1,5 @@ +#ffe085 +#787878 +#decade +#ff55ff +0 diff --git a/codenet/public_test_cases/p00176/input.2.txt b/codenet/public_test_cases/p00176/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..83e6507652a1dea47df4fdc0c62c03177513096b --- /dev/null +++ b/codenet/public_test_cases/p00176/input.2.txt @@ -0,0 +1,5 @@ +ffe085 +787878 +decade +ff55ff +0 diff --git a/codenet/public_test_cases/p00176/output.0.txt b/codenet/public_test_cases/p00176/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce7f59775aa6a7e65a2d85ce1e8ef5157c8acea2 --- /dev/null +++ b/codenet/public_test_cases/p00176/output.0.txt @@ -0,0 +1,4 @@ +white +black +white +fuchsia diff --git a/codenet/public_test_cases/p00176/output.1.txt b/codenet/public_test_cases/p00176/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce7f59775aa6a7e65a2d85ce1e8ef5157c8acea2 --- /dev/null +++ b/codenet/public_test_cases/p00176/output.1.txt @@ -0,0 +1,4 @@ +white +black +white +fuchsia diff --git a/codenet/public_test_cases/p00176/output.2.txt b/codenet/public_test_cases/p00176/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce7f59775aa6a7e65a2d85ce1e8ef5157c8acea2 --- /dev/null +++ b/codenet/public_test_cases/p00176/output.2.txt @@ -0,0 +1,4 @@ +white +black +white +fuchsia diff --git a/codenet/public_test_cases/p00177/input.0.txt b/codenet/public_test_cases/p00177/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea116740172191d05a683d78a73948e09f188f76 --- /dev/null +++ b/codenet/public_test_cases/p00177/input.0.txt @@ -0,0 +1,4 @@ +35.68 139.77 51.15 359.82 +1.37 103.92 41.78 272.25 +51.15 359.82 -34.58 301.52 +-1 -1 -1 -1 diff --git a/codenet/public_test_cases/p00177/input.1.txt b/codenet/public_test_cases/p00177/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea116740172191d05a683d78a73948e09f188f76 --- /dev/null +++ b/codenet/public_test_cases/p00177/input.1.txt @@ -0,0 +1,4 @@ +35.68 139.77 51.15 359.82 +1.37 103.92 41.78 272.25 +51.15 359.82 -34.58 301.52 +-1 -1 -1 -1 diff --git a/codenet/public_test_cases/p00177/output.0.txt b/codenet/public_test_cases/p00177/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..26c0cc504eea340a12aba0e45e980206332f35cf --- /dev/null +++ b/codenet/public_test_cases/p00177/output.0.txt @@ -0,0 +1,3 @@ +9609 +15092 +11112 diff --git a/codenet/public_test_cases/p00177/output.1.txt b/codenet/public_test_cases/p00177/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..26c0cc504eea340a12aba0e45e980206332f35cf --- /dev/null +++ b/codenet/public_test_cases/p00177/output.1.txt @@ -0,0 +1,3 @@ +9609 +15092 +11112 diff --git a/codenet/public_test_cases/p00178/input.0.txt b/codenet/public_test_cases/p00178/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..829ead48d2a36af1f79fb6c2380ffc3b5ddc8f8a --- /dev/null +++ b/codenet/public_test_cases/p00178/input.0.txt @@ -0,0 +1,16 @@ +4 +1 4 1 +1 3 1 +2 2 4 +2 3 5 +1 +1 5 1 +7 +2 2 2 +1 4 1 +2 1 3 +1 4 1 +1 1 1 +2 5 5 +1 4 2 +0 diff --git a/codenet/public_test_cases/p00178/input.1.txt b/codenet/public_test_cases/p00178/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..829ead48d2a36af1f79fb6c2380ffc3b5ddc8f8a --- /dev/null +++ b/codenet/public_test_cases/p00178/input.1.txt @@ -0,0 +1,16 @@ +4 +1 4 1 +1 3 1 +2 2 4 +2 3 5 +1 +1 5 1 +7 +2 2 2 +1 4 1 +2 1 3 +1 4 1 +1 1 1 +2 5 5 +1 4 2 +0 diff --git a/codenet/public_test_cases/p00178/output.0.txt b/codenet/public_test_cases/p00178/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..179e41616ad19168037d93533b75a7200475d299 --- /dev/null +++ b/codenet/public_test_cases/p00178/output.0.txt @@ -0,0 +1,3 @@ +2 +0 +6 diff --git a/codenet/public_test_cases/p00178/output.1.txt b/codenet/public_test_cases/p00178/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..179e41616ad19168037d93533b75a7200475d299 --- /dev/null +++ b/codenet/public_test_cases/p00178/output.1.txt @@ -0,0 +1,3 @@ +2 +0 +6 diff --git a/codenet/public_test_cases/p00179/input.0.txt b/codenet/public_test_cases/p00179/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0aee4434fb56509cf31e84cde62ec712fb1b34d9 --- /dev/null +++ b/codenet/public_test_cases/p00179/input.0.txt @@ -0,0 +1,9 @@ +rbgrg +rbbgbbr +bgr +bgrbrgbr +bggrgbgrr +gbrggrbggr +rrrrr +bgbr +0 diff --git a/codenet/public_test_cases/p00179/input.1.txt b/codenet/public_test_cases/p00179/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0aee4434fb56509cf31e84cde62ec712fb1b34d9 --- /dev/null +++ b/codenet/public_test_cases/p00179/input.1.txt @@ -0,0 +1,9 @@ +rbgrg +rbbgbbr +bgr +bgrbrgbr +bggrgbgrr +gbrggrbggr +rrrrr +bgbr +0 diff --git a/codenet/public_test_cases/p00179/output.0.txt b/codenet/public_test_cases/p00179/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f4bec66245732b705fea4c651f6e0ec9e2e743e --- /dev/null +++ b/codenet/public_test_cases/p00179/output.0.txt @@ -0,0 +1,8 @@ +5 +7 +1 +6 +NA +8 +0 +4 diff --git a/codenet/public_test_cases/p00179/output.1.txt b/codenet/public_test_cases/p00179/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f4bec66245732b705fea4c651f6e0ec9e2e743e --- /dev/null +++ b/codenet/public_test_cases/p00179/output.1.txt @@ -0,0 +1,8 @@ +5 +7 +1 +6 +NA +8 +0 +4 diff --git a/codenet/public_test_cases/p00180/input.0.txt b/codenet/public_test_cases/p00180/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbfb0415b2c507196ee3fa36401a79755452a437 --- /dev/null +++ b/codenet/public_test_cases/p00180/input.0.txt @@ -0,0 +1,12 @@ +5 6 +0 2 1 +2 1 3 +2 3 8 +1 3 2 +3 4 5 +1 4 4 +3 3 +1 2 3 +2 0 3 +0 1 3 +0 0 diff --git a/codenet/public_test_cases/p00180/input.1.txt b/codenet/public_test_cases/p00180/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbfb0415b2c507196ee3fa36401a79755452a437 --- /dev/null +++ b/codenet/public_test_cases/p00180/input.1.txt @@ -0,0 +1,12 @@ +5 6 +0 2 1 +2 1 3 +2 3 8 +1 3 2 +3 4 5 +1 4 4 +3 3 +1 2 3 +2 0 3 +0 1 3 +0 0 diff --git a/codenet/public_test_cases/p00180/output.0.txt b/codenet/public_test_cases/p00180/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c09a82473e1449fa79e9e4dc0ba27c3f9488be9 --- /dev/null +++ b/codenet/public_test_cases/p00180/output.0.txt @@ -0,0 +1,2 @@ +10 +6 diff --git a/codenet/public_test_cases/p00180/output.1.txt b/codenet/public_test_cases/p00180/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c09a82473e1449fa79e9e4dc0ba27c3f9488be9 --- /dev/null +++ b/codenet/public_test_cases/p00180/output.1.txt @@ -0,0 +1,2 @@ +10 +6 diff --git a/codenet/public_test_cases/p00181/input.0.txt b/codenet/public_test_cases/p00181/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5ef9af2bb7acb9b94a9facf118b09f9598bc922 --- /dev/null +++ b/codenet/public_test_cases/p00181/input.0.txt @@ -0,0 +1,15 @@ +3 9 +500 +300 +800 +200 +100 +600 +900 +700 +400 +4 3 +1000 +1000 +1000 +0 0 diff --git a/codenet/public_test_cases/p00181/input.1.txt b/codenet/public_test_cases/p00181/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5ef9af2bb7acb9b94a9facf118b09f9598bc922 --- /dev/null +++ b/codenet/public_test_cases/p00181/input.1.txt @@ -0,0 +1,15 @@ +3 9 +500 +300 +800 +200 +100 +600 +900 +700 +400 +4 3 +1000 +1000 +1000 +0 0 diff --git a/codenet/public_test_cases/p00181/output.0.txt b/codenet/public_test_cases/p00181/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c512e3cc690db614dfca9f5a5354adb1d61b6d91 --- /dev/null +++ b/codenet/public_test_cases/p00181/output.0.txt @@ -0,0 +1,2 @@ +1800 +1000 diff --git a/codenet/public_test_cases/p00181/output.1.txt b/codenet/public_test_cases/p00181/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c512e3cc690db614dfca9f5a5354adb1d61b6d91 --- /dev/null +++ b/codenet/public_test_cases/p00181/output.1.txt @@ -0,0 +1,2 @@ +1800 +1000 diff --git a/codenet/public_test_cases/p00182/input.0.txt b/codenet/public_test_cases/p00182/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5a1443a7757fd91e31b2b055739eb49c6ace48b --- /dev/null +++ b/codenet/public_test_cases/p00182/input.0.txt @@ -0,0 +1,11 @@ +10 +11 2 23 4 2 12 8 5 2 10 +8 +2 1 3 11 2 3 1 4 +9 +5 9 1 2 4 8 17 1 8 +8 +3 38 9 4 18 14 19 5 +1 +1 +0 diff --git a/codenet/public_test_cases/p00182/input.1.txt b/codenet/public_test_cases/p00182/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5a1443a7757fd91e31b2b055739eb49c6ace48b --- /dev/null +++ b/codenet/public_test_cases/p00182/input.1.txt @@ -0,0 +1,11 @@ +10 +11 2 23 4 2 12 8 5 2 10 +8 +2 1 3 11 2 3 1 4 +9 +5 9 1 2 4 8 17 1 8 +8 +3 38 9 4 18 14 19 5 +1 +1 +0 diff --git a/codenet/public_test_cases/p00182/output.0.txt b/codenet/public_test_cases/p00182/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3c24bad922ff06bc38d5b40ea32467833aea976 --- /dev/null +++ b/codenet/public_test_cases/p00182/output.0.txt @@ -0,0 +1,5 @@ +YES +YES +YES +NO +YES diff --git a/codenet/public_test_cases/p00182/output.1.txt b/codenet/public_test_cases/p00182/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3c24bad922ff06bc38d5b40ea32467833aea976 --- /dev/null +++ b/codenet/public_test_cases/p00182/output.1.txt @@ -0,0 +1,5 @@ +YES +YES +YES +NO +YES diff --git a/codenet/public_test_cases/p00183/input.0.txt b/codenet/public_test_cases/p00183/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a474f5951875bb9bfb626606242f5666af68684 --- /dev/null +++ b/codenet/public_test_cases/p00183/input.0.txt @@ -0,0 +1,7 @@ +bbw +wbw ++b+ +bwb +wbw +wbw +0 diff --git a/codenet/public_test_cases/p00183/input.1.txt b/codenet/public_test_cases/p00183/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a474f5951875bb9bfb626606242f5666af68684 --- /dev/null +++ b/codenet/public_test_cases/p00183/input.1.txt @@ -0,0 +1,7 @@ +bbw +wbw ++b+ +bwb +wbw +wbw +0 diff --git a/codenet/public_test_cases/p00183/output.0.txt b/codenet/public_test_cases/p00183/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e129f6d5a16f30de71f3c54380c2a41ed20da5c --- /dev/null +++ b/codenet/public_test_cases/p00183/output.0.txt @@ -0,0 +1,2 @@ +b +NA diff --git a/codenet/public_test_cases/p00183/output.1.txt b/codenet/public_test_cases/p00183/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e129f6d5a16f30de71f3c54380c2a41ed20da5c --- /dev/null +++ b/codenet/public_test_cases/p00183/output.1.txt @@ -0,0 +1,2 @@ +b +NA diff --git a/codenet/public_test_cases/p00184/input.0.txt b/codenet/public_test_cases/p00184/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b8b2a06dd3d45fea2a1afe333a79b638834d131 --- /dev/null +++ b/codenet/public_test_cases/p00184/input.0.txt @@ -0,0 +1,15 @@ +8 +71 +34 +65 +11 +41 +39 +6 +5 +4 +67 +81 +78 +65 +0 diff --git a/codenet/public_test_cases/p00184/input.1.txt b/codenet/public_test_cases/p00184/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b8b2a06dd3d45fea2a1afe333a79b638834d131 --- /dev/null +++ b/codenet/public_test_cases/p00184/input.1.txt @@ -0,0 +1,15 @@ +8 +71 +34 +65 +11 +41 +39 +6 +5 +4 +67 +81 +78 +65 +0 diff --git a/codenet/public_test_cases/p00184/output.0.txt b/codenet/public_test_cases/p00184/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9cd2ee15c84201a50b585dd169f5f5cd5176a0b --- /dev/null +++ b/codenet/public_test_cases/p00184/output.0.txt @@ -0,0 +1,14 @@ +2 +1 +0 +2 +1 +0 +2 +0 +0 +0 +0 +0 +0 +4 diff --git a/codenet/public_test_cases/p00184/output.1.txt b/codenet/public_test_cases/p00184/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9cd2ee15c84201a50b585dd169f5f5cd5176a0b --- /dev/null +++ b/codenet/public_test_cases/p00184/output.1.txt @@ -0,0 +1,14 @@ +2 +1 +0 +2 +1 +0 +2 +0 +0 +0 +0 +0 +0 +4 diff --git a/codenet/public_test_cases/p00185/input.0.txt b/codenet/public_test_cases/p00185/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..498a9fe4892ecfa77b7fab651e0d3d1799328102 --- /dev/null +++ b/codenet/public_test_cases/p00185/input.0.txt @@ -0,0 +1,5 @@ +134 +4330 +34808 +98792 +0 diff --git a/codenet/public_test_cases/p00185/output.0.txt b/codenet/public_test_cases/p00185/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd1c3874979ab3dcd27009bbe8bdb90cab6eb6b4 --- /dev/null +++ b/codenet/public_test_cases/p00185/output.0.txt @@ -0,0 +1,4 @@ +6 +72 +274 +607 diff --git a/codenet/public_test_cases/p00186/input.0.txt b/codenet/public_test_cases/p00186/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cccf955980eb5002ad673791853cac18f953fe6c --- /dev/null +++ b/codenet/public_test_cases/p00186/input.0.txt @@ -0,0 +1,9 @@ +48 9297 240 126 32 +20 3010 157 141 7 +30 117002 5680 962 15 +8 1673 1712 190 22 +64 8478 87 54 307 +23 5477 117 92 12 +50 7558 1396 187 17 +279 88677 4522 514 14 +0 diff --git a/codenet/public_test_cases/p00186/input.1.txt b/codenet/public_test_cases/p00186/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cccf955980eb5002ad673791853cac18f953fe6c --- /dev/null +++ b/codenet/public_test_cases/p00186/input.1.txt @@ -0,0 +1,9 @@ +48 9297 240 126 32 +20 3010 157 141 7 +30 117002 5680 962 15 +8 1673 1712 190 22 +64 8478 87 54 307 +23 5477 117 92 12 +50 7558 1396 187 17 +279 88677 4522 514 14 +0 diff --git a/codenet/public_test_cases/p00186/output.0.txt b/codenet/public_test_cases/p00186/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a21c9be8964e07b169877f6c37ebba535728a020 --- /dev/null +++ b/codenet/public_test_cases/p00186/output.0.txt @@ -0,0 +1,8 @@ +28 20 +7 13 +15 33 +NA +97 0 +12 44 +NA +NA diff --git a/codenet/public_test_cases/p00186/output.1.txt b/codenet/public_test_cases/p00186/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a21c9be8964e07b169877f6c37ebba535728a020 --- /dev/null +++ b/codenet/public_test_cases/p00186/output.1.txt @@ -0,0 +1,8 @@ +28 20 +7 13 +15 33 +NA +97 0 +12 44 +NA +NA diff --git a/codenet/public_test_cases/p00187/input.0.txt b/codenet/public_test_cases/p00187/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4c7927b03e54d934e91abb8168bffb2ee768e04 --- /dev/null +++ b/codenet/public_test_cases/p00187/input.0.txt @@ -0,0 +1,7 @@ +-3 -2 9 6 +3 -2 7 6 +-1 0 5 0 +2 2 -1 -1 +0 1 2 1 +-3 -1 3 1 +0 0 0 0 diff --git a/codenet/public_test_cases/p00187/input.1.txt b/codenet/public_test_cases/p00187/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4c7927b03e54d934e91abb8168bffb2ee768e04 --- /dev/null +++ b/codenet/public_test_cases/p00187/input.1.txt @@ -0,0 +1,7 @@ +-3 -2 9 6 +3 -2 7 6 +-1 0 5 0 +2 2 -1 -1 +0 1 2 1 +-3 -1 3 1 +0 0 0 0 diff --git a/codenet/public_test_cases/p00187/output.0.txt b/codenet/public_test_cases/p00187/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88e502ce269854fdea9833b3aa5d19074558a683 --- /dev/null +++ b/codenet/public_test_cases/p00187/output.0.txt @@ -0,0 +1,2 @@ +syo-kichi +kyo diff --git a/codenet/public_test_cases/p00187/output.1.txt b/codenet/public_test_cases/p00187/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..88e502ce269854fdea9833b3aa5d19074558a683 --- /dev/null +++ b/codenet/public_test_cases/p00187/output.1.txt @@ -0,0 +1,2 @@ +syo-kichi +kyo diff --git a/codenet/public_test_cases/p00188/input.0.txt b/codenet/public_test_cases/p00188/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45e7389c33385731e9b6d92327095669cc82e4b0 --- /dev/null +++ b/codenet/public_test_cases/p00188/input.0.txt @@ -0,0 +1,16 @@ +7 +11 +15 +23 +36 +51 +61 +86 +51 +4 +1 +2 +3 +5 +4 +0 diff --git a/codenet/public_test_cases/p00188/input.1.txt b/codenet/public_test_cases/p00188/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45e7389c33385731e9b6d92327095669cc82e4b0 --- /dev/null +++ b/codenet/public_test_cases/p00188/input.1.txt @@ -0,0 +1,16 @@ +7 +11 +15 +23 +36 +51 +61 +86 +51 +4 +1 +2 +3 +5 +4 +0 diff --git a/codenet/public_test_cases/p00188/output.0.txt b/codenet/public_test_cases/p00188/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c8806279fa7d6b7d04418a47e21b7e89ab18f8 --- /dev/null +++ b/codenet/public_test_cases/p00188/output.0.txt @@ -0,0 +1,2 @@ +3 +3 diff --git a/codenet/public_test_cases/p00188/output.1.txt b/codenet/public_test_cases/p00188/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c8806279fa7d6b7d04418a47e21b7e89ab18f8 --- /dev/null +++ b/codenet/public_test_cases/p00188/output.1.txt @@ -0,0 +1,2 @@ +3 +3 diff --git a/codenet/public_test_cases/p00189/input.0.txt b/codenet/public_test_cases/p00189/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bbcb5a98922fd234aab2a229a4484c2e56abdd4 --- /dev/null +++ b/codenet/public_test_cases/p00189/input.0.txt @@ -0,0 +1,11 @@ +6 +0 1 80 +1 2 20 +0 2 60 +2 3 50 +3 4 60 +1 4 90 +2 +0 1 1 +1 2 1 +0 diff --git a/codenet/public_test_cases/p00189/input.1.txt b/codenet/public_test_cases/p00189/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bbcb5a98922fd234aab2a229a4484c2e56abdd4 --- /dev/null +++ b/codenet/public_test_cases/p00189/input.1.txt @@ -0,0 +1,11 @@ +6 +0 1 80 +1 2 20 +0 2 60 +2 3 50 +3 4 60 +1 4 90 +2 +0 1 1 +1 2 1 +0 diff --git a/codenet/public_test_cases/p00189/output.0.txt b/codenet/public_test_cases/p00189/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4afc0141e24700903f57db0c48926e5976b6f152 --- /dev/null +++ b/codenet/public_test_cases/p00189/output.0.txt @@ -0,0 +1,2 @@ +2 240 +1 2 diff --git a/codenet/public_test_cases/p00189/output.1.txt b/codenet/public_test_cases/p00189/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4afc0141e24700903f57db0c48926e5976b6f152 --- /dev/null +++ b/codenet/public_test_cases/p00189/output.1.txt @@ -0,0 +1,2 @@ +2 240 +1 2 diff --git a/codenet/public_test_cases/p00190/input.0.txt b/codenet/public_test_cases/p00190/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd137d068f13ab198e5e3c455240d633854352b7 --- /dev/null +++ b/codenet/public_test_cases/p00190/input.0.txt @@ -0,0 +1,16 @@ +2 +1 0 3 +4 5 6 7 8 +9 0 11 +10 +0 +1 2 3 +4 5 6 7 8 +9 10 11 +0 +0 +11 10 9 +8 7 6 5 4 +3 2 1 +0 +-1 diff --git a/codenet/public_test_cases/p00190/input.1.txt b/codenet/public_test_cases/p00190/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd137d068f13ab198e5e3c455240d633854352b7 --- /dev/null +++ b/codenet/public_test_cases/p00190/input.1.txt @@ -0,0 +1,16 @@ +2 +1 0 3 +4 5 6 7 8 +9 0 11 +10 +0 +1 2 3 +4 5 6 7 8 +9 10 11 +0 +0 +11 10 9 +8 7 6 5 4 +3 2 1 +0 +-1 diff --git a/codenet/public_test_cases/p00190/output.0.txt b/codenet/public_test_cases/p00190/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..06d74209e59f1378f5ef55840fb09b9c1c36b307 --- /dev/null +++ b/codenet/public_test_cases/p00190/output.0.txt @@ -0,0 +1,3 @@ +2 +0 +NA diff --git a/codenet/public_test_cases/p00190/output.1.txt b/codenet/public_test_cases/p00190/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..06d74209e59f1378f5ef55840fb09b9c1c36b307 --- /dev/null +++ b/codenet/public_test_cases/p00190/output.1.txt @@ -0,0 +1,3 @@ +2 +0 +NA diff --git a/codenet/public_test_cases/p00191/input.0.txt b/codenet/public_test_cases/p00191/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d60b833d5e432268896c8ae1a9096a8261b65fe2 --- /dev/null +++ b/codenet/public_test_cases/p00191/input.0.txt @@ -0,0 +1,8 @@ +3 3 +1.3 3.0 0.5 +2.4 2.1 1.0 +3.0 0.8 1.2 +2 2 +1.0 1.0 +1.0 1.0 +0 0 diff --git a/codenet/public_test_cases/p00191/input.1.txt b/codenet/public_test_cases/p00191/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d60b833d5e432268896c8ae1a9096a8261b65fe2 --- /dev/null +++ b/codenet/public_test_cases/p00191/input.1.txt @@ -0,0 +1,8 @@ +3 3 +1.3 3.0 0.5 +2.4 2.1 1.0 +3.0 0.8 1.2 +2 2 +1.0 1.0 +1.0 1.0 +0 0 diff --git a/codenet/public_test_cases/p00191/output.0.txt b/codenet/public_test_cases/p00191/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..544386df19b2c35983ca598193ede4e7eb134980 --- /dev/null +++ b/codenet/public_test_cases/p00191/output.0.txt @@ -0,0 +1,2 @@ +9.00 +1.00 diff --git a/codenet/public_test_cases/p00191/output.1.txt b/codenet/public_test_cases/p00191/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..544386df19b2c35983ca598193ede4e7eb134980 --- /dev/null +++ b/codenet/public_test_cases/p00191/output.1.txt @@ -0,0 +1,2 @@ +9.00 +1.00 diff --git a/codenet/public_test_cases/p00192/input.0.txt b/codenet/public_test_cases/p00192/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ed3188c7eb291eae03dcf66e80e0fa0d8a465d4 --- /dev/null +++ b/codenet/public_test_cases/p00192/input.0.txt @@ -0,0 +1,12 @@ +3 5 +90 +52 +82 +84 +70 +2 4 +10 +30 +40 +60 +0 0 diff --git a/codenet/public_test_cases/p00192/input.1.txt b/codenet/public_test_cases/p00192/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ed3188c7eb291eae03dcf66e80e0fa0d8a465d4 --- /dev/null +++ b/codenet/public_test_cases/p00192/input.1.txt @@ -0,0 +1,12 @@ +3 5 +90 +52 +82 +84 +70 +2 4 +10 +30 +40 +60 +0 0 diff --git a/codenet/public_test_cases/p00192/output.0.txt b/codenet/public_test_cases/p00192/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6092bcd4116324804dc8775c01870500840ebd6e --- /dev/null +++ b/codenet/public_test_cases/p00192/output.0.txt @@ -0,0 +1,2 @@ +2 5 1 4 3 +1 2 4 3 diff --git a/codenet/public_test_cases/p00192/output.1.txt b/codenet/public_test_cases/p00192/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6092bcd4116324804dc8775c01870500840ebd6e --- /dev/null +++ b/codenet/public_test_cases/p00192/output.1.txt @@ -0,0 +1,2 @@ +2 5 1 4 3 +1 2 4 3 diff --git a/codenet/public_test_cases/p00193/input.0.txt b/codenet/public_test_cases/p00193/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3eb6c6105ac245014b2f0def1d6a894ec24a909c --- /dev/null +++ b/codenet/public_test_cases/p00193/input.0.txt @@ -0,0 +1,23 @@ +6 6 +6 +1 1 +6 1 +3 2 +3 5 +1 6 +5 6 +2 +1 3 +5 3 +6 6 +6 +3 2 +3 5 +6 1 +1 1 +1 6 +5 6 +2 +2 3 +5 3 +0 0 diff --git a/codenet/public_test_cases/p00193/input.1.txt b/codenet/public_test_cases/p00193/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3eb6c6105ac245014b2f0def1d6a894ec24a909c --- /dev/null +++ b/codenet/public_test_cases/p00193/input.1.txt @@ -0,0 +1,23 @@ +6 6 +6 +1 1 +6 1 +3 2 +3 5 +1 6 +5 6 +2 +1 3 +5 3 +6 6 +6 +3 2 +3 5 +6 1 +1 1 +1 6 +5 6 +2 +2 3 +5 3 +0 0 diff --git a/codenet/public_test_cases/p00193/output.0.txt b/codenet/public_test_cases/p00193/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7290ba859f4adbf90d68526fe0ab1f8cbcf65098 --- /dev/null +++ b/codenet/public_test_cases/p00193/output.0.txt @@ -0,0 +1,2 @@ +4 +4 diff --git a/codenet/public_test_cases/p00193/output.1.txt b/codenet/public_test_cases/p00193/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7290ba859f4adbf90d68526fe0ab1f8cbcf65098 --- /dev/null +++ b/codenet/public_test_cases/p00193/output.1.txt @@ -0,0 +1,2 @@ +4 +4 diff --git a/codenet/public_test_cases/p00194/input.0.txt b/codenet/public_test_cases/p00194/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..22ca47f88d96a7d5fc5ea3260a0f5096524064da --- /dev/null +++ b/codenet/public_test_cases/p00194/input.0.txt @@ -0,0 +1,43 @@ +4 5 +1 +3 +b-2 3 +c-3 2 +c-4 1 +3 +a-2 b-2 +b-3 c-3 +d-3 d-4 +2 +b-3 b-4 1 +c-1 d-1 1 +d-1 b-4 +4 5 +1 +3 +b-2 3 +c-3 2 +c-4 1 +3 +a-2 b-2 +b-3 c-3 +d-3 d-4 +2 +b-3 b-4 1 +c-1 d-1 1 +d-2 b-4 +4 5 +1 +3 +b-2 3 +c-3 2 +c-4 1 +3 +a-2 b-2 +b-3 c-3 +d-3 d-4 +2 +b-3 b-4 1 +c-1 d-1 1 +d-3 b-4 +0 0 diff --git a/codenet/public_test_cases/p00194/output.0.txt b/codenet/public_test_cases/p00194/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da8e9a099bbd8150bc622abb994ff28e96710a95 --- /dev/null +++ b/codenet/public_test_cases/p00194/output.0.txt @@ -0,0 +1,3 @@ +7 +4 +8 diff --git a/codenet/public_test_cases/p00195/input.0.txt b/codenet/public_test_cases/p00195/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfc0bc0b5fee1e6db56f4c6e7c3f0c1aec927cd0 --- /dev/null +++ b/codenet/public_test_cases/p00195/input.0.txt @@ -0,0 +1,11 @@ +1593 4311 +4321 2155 +1256 6421 +5310 1455 +2152 5421 +1549 3386 +4528 3719 +1234 4321 +3330 3109 +2739 2199 +0 0 diff --git a/codenet/public_test_cases/p00195/input.1.txt b/codenet/public_test_cases/p00195/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfc0bc0b5fee1e6db56f4c6e7c3f0c1aec927cd0 --- /dev/null +++ b/codenet/public_test_cases/p00195/input.1.txt @@ -0,0 +1,11 @@ +1593 4311 +4321 2155 +1256 6421 +5310 1455 +2152 5421 +1549 3386 +4528 3719 +1234 4321 +3330 3109 +2739 2199 +0 0 diff --git a/codenet/public_test_cases/p00195/output.0.txt b/codenet/public_test_cases/p00195/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea7159f64b28764a2a0ba12de0102aa11b5495f0 --- /dev/null +++ b/codenet/public_test_cases/p00195/output.0.txt @@ -0,0 +1,2 @@ +C 7677 +B 8247 diff --git a/codenet/public_test_cases/p00195/output.1.txt b/codenet/public_test_cases/p00195/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea7159f64b28764a2a0ba12de0102aa11b5495f0 --- /dev/null +++ b/codenet/public_test_cases/p00195/output.1.txt @@ -0,0 +1,2 @@ +C 7677 +B 8247 diff --git a/codenet/public_test_cases/p00196/input.0.txt b/codenet/public_test_cases/p00196/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..661e1b3e06ed5631516d6162cab17a3d6e076ccc --- /dev/null +++ b/codenet/public_test_cases/p00196/input.0.txt @@ -0,0 +1,13 @@ +6 +A 1 0 0 2 0 +B 0 0 1 1 0 +C 1 1 1 1 1 +D 1 0 0 1 2 +E 2 0 0 0 0 +F 1 1 0 2 1 +4 +g 1 1 1 +h 0 1 2 +w 0 0 0 +b 0 2 1 +0 diff --git a/codenet/public_test_cases/p00196/input.1.txt b/codenet/public_test_cases/p00196/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..661e1b3e06ed5631516d6162cab17a3d6e076ccc --- /dev/null +++ b/codenet/public_test_cases/p00196/input.1.txt @@ -0,0 +1,13 @@ +6 +A 1 0 0 2 0 +B 0 0 1 1 0 +C 1 1 1 1 1 +D 1 0 0 1 2 +E 2 0 0 0 0 +F 1 1 0 2 1 +4 +g 1 1 1 +h 0 1 2 +w 0 0 0 +b 0 2 1 +0 diff --git a/codenet/public_test_cases/p00196/output.0.txt b/codenet/public_test_cases/p00196/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55c3ee3f8678885dc213d4884c704552c89b96d8 --- /dev/null +++ b/codenet/public_test_cases/p00196/output.0.txt @@ -0,0 +1,10 @@ +E +A +B +D +F +C +w +h +b +g diff --git a/codenet/public_test_cases/p00196/output.1.txt b/codenet/public_test_cases/p00196/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..55c3ee3f8678885dc213d4884c704552c89b96d8 --- /dev/null +++ b/codenet/public_test_cases/p00196/output.1.txt @@ -0,0 +1,10 @@ +E +A +B +D +F +C +w +h +b +g diff --git a/codenet/public_test_cases/p00197/input.0.txt b/codenet/public_test_cases/p00197/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..79926a24509a46fdac445219cb6483a211aefa99 --- /dev/null +++ b/codenet/public_test_cases/p00197/input.0.txt @@ -0,0 +1,3 @@ +1071 1029 +5 5 +0 0 diff --git a/codenet/public_test_cases/p00197/input.1.txt b/codenet/public_test_cases/p00197/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..79926a24509a46fdac445219cb6483a211aefa99 --- /dev/null +++ b/codenet/public_test_cases/p00197/input.1.txt @@ -0,0 +1,3 @@ +1071 1029 +5 5 +0 0 diff --git a/codenet/public_test_cases/p00197/output.0.txt b/codenet/public_test_cases/p00197/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a49e54f4431055d477e8539c49af99f2675f5e6f --- /dev/null +++ b/codenet/public_test_cases/p00197/output.0.txt @@ -0,0 +1,2 @@ +21 3 +5 1 diff --git a/codenet/public_test_cases/p00197/output.1.txt b/codenet/public_test_cases/p00197/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a49e54f4431055d477e8539c49af99f2675f5e6f --- /dev/null +++ b/codenet/public_test_cases/p00197/output.1.txt @@ -0,0 +1,2 @@ +21 3 +5 1 diff --git a/codenet/public_test_cases/p00198/input.0.txt b/codenet/public_test_cases/p00198/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05c6f30baaae85b220f7537ceacbc302cffa4e21 --- /dev/null +++ b/codenet/public_test_cases/p00198/input.0.txt @@ -0,0 +1,10 @@ +3 +Cyan Yellow Red Magenta Green Blue +Cyan Yellow Red Magenta Green Blue +Red Yellow Magenta Blue Green Cyan +4 +Red Magenta Blue Green Yellow Cyan +Red Yellow Magenta Blue Green Cyan +Magenta Green Red Cyan Yellow Blue +Cyan Green Yellow Blue Magenta Red +0 diff --git a/codenet/public_test_cases/p00198/input.1.txt b/codenet/public_test_cases/p00198/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05c6f30baaae85b220f7537ceacbc302cffa4e21 --- /dev/null +++ b/codenet/public_test_cases/p00198/input.1.txt @@ -0,0 +1,10 @@ +3 +Cyan Yellow Red Magenta Green Blue +Cyan Yellow Red Magenta Green Blue +Red Yellow Magenta Blue Green Cyan +4 +Red Magenta Blue Green Yellow Cyan +Red Yellow Magenta Blue Green Cyan +Magenta Green Red Cyan Yellow Blue +Cyan Green Yellow Blue Magenta Red +0 diff --git a/codenet/public_test_cases/p00198/output.0.txt b/codenet/public_test_cases/p00198/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p00198/output.0.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p00198/output.1.txt b/codenet/public_test_cases/p00198/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p00198/output.1.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p00199/input.0.txt b/codenet/public_test_cases/p00199/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7aaa946c6ad46285a4b434b2b504fd827504ac30 --- /dev/null +++ b/codenet/public_test_cases/p00199/input.0.txt @@ -0,0 +1,11 @@ +5 4 +A +B +C +D +5 4 +D +C +B +A +0 0 diff --git a/codenet/public_test_cases/p00199/input.1.txt b/codenet/public_test_cases/p00199/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7aaa946c6ad46285a4b434b2b504fd827504ac30 --- /dev/null +++ b/codenet/public_test_cases/p00199/input.1.txt @@ -0,0 +1,11 @@ +5 4 +A +B +C +D +5 4 +D +C +B +A +0 0 diff --git a/codenet/public_test_cases/p00199/output.0.txt b/codenet/public_test_cases/p00199/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c93e6e74b07ac85e861c19be5ee2492c87f2cd22 --- /dev/null +++ b/codenet/public_test_cases/p00199/output.0.txt @@ -0,0 +1,2 @@ +ACD#B +DCA#B diff --git a/codenet/public_test_cases/p00199/output.1.txt b/codenet/public_test_cases/p00199/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c93e6e74b07ac85e861c19be5ee2492c87f2cd22 --- /dev/null +++ b/codenet/public_test_cases/p00199/output.1.txt @@ -0,0 +1,2 @@ +ACD#B +DCA#B diff --git a/codenet/public_test_cases/p00200/input.0.txt b/codenet/public_test_cases/p00200/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81f3d8dfdd279b1459c693167e6318a5a9aa1027 --- /dev/null +++ b/codenet/public_test_cases/p00200/input.0.txt @@ -0,0 +1,11 @@ +6 5 +1 2 200 10 +1 4 400 15 +1 3 250 25 +2 4 100 10 +4 5 150 20 +3 5 300 20 +2 +1 5 0 +1 5 1 +0 0 diff --git a/codenet/public_test_cases/p00200/input.1.txt b/codenet/public_test_cases/p00200/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81f3d8dfdd279b1459c693167e6318a5a9aa1027 --- /dev/null +++ b/codenet/public_test_cases/p00200/input.1.txt @@ -0,0 +1,11 @@ +6 5 +1 2 200 10 +1 4 400 15 +1 3 250 25 +2 4 100 10 +4 5 150 20 +3 5 300 20 +2 +1 5 0 +1 5 1 +0 0 diff --git a/codenet/public_test_cases/p00200/output.0.txt b/codenet/public_test_cases/p00200/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..417e759543255b8c1a0dc21755615c6d9e71f03f --- /dev/null +++ b/codenet/public_test_cases/p00200/output.0.txt @@ -0,0 +1,2 @@ +450 +35 diff --git a/codenet/public_test_cases/p00200/output.1.txt b/codenet/public_test_cases/p00200/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..417e759543255b8c1a0dc21755615c6d9e71f03f --- /dev/null +++ b/codenet/public_test_cases/p00200/output.1.txt @@ -0,0 +1,2 @@ +450 +35 diff --git a/codenet/public_test_cases/p00201/input.0.txt b/codenet/public_test_cases/p00201/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbbb7eb5af9c7a0d9beb9cf2937d54811f91e2e8 --- /dev/null +++ b/codenet/public_test_cases/p00201/input.0.txt @@ -0,0 +1,19 @@ +8 +wood 3000 +string 800 +rice 36 +water 0 +racket 5000 +microphone 9800 +onigiri 140 +guitar 98000 +3 +racket 2 wood string +onigiri 2 rice water +guitar 3 racket microphone onigiri +guitar +1 +computer 300000 +0 +computer +0 diff --git a/codenet/public_test_cases/p00201/input.1.txt b/codenet/public_test_cases/p00201/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbbb7eb5af9c7a0d9beb9cf2937d54811f91e2e8 --- /dev/null +++ b/codenet/public_test_cases/p00201/input.1.txt @@ -0,0 +1,19 @@ +8 +wood 3000 +string 800 +rice 36 +water 0 +racket 5000 +microphone 9800 +onigiri 140 +guitar 98000 +3 +racket 2 wood string +onigiri 2 rice water +guitar 3 racket microphone onigiri +guitar +1 +computer 300000 +0 +computer +0 diff --git a/codenet/public_test_cases/p00201/output.0.txt b/codenet/public_test_cases/p00201/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0ebd584c3a22e3d6d82499ad70c8f2d68a5f754 --- /dev/null +++ b/codenet/public_test_cases/p00201/output.0.txt @@ -0,0 +1,2 @@ +13636 +300000 diff --git a/codenet/public_test_cases/p00201/output.1.txt b/codenet/public_test_cases/p00201/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0ebd584c3a22e3d6d82499ad70c8f2d68a5f754 --- /dev/null +++ b/codenet/public_test_cases/p00201/output.1.txt @@ -0,0 +1,2 @@ +13636 +300000 diff --git a/codenet/public_test_cases/p00202/input.0.txt b/codenet/public_test_cases/p00202/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b59f65ebfb8cc4a62e0baf9c837eb014f4137a5a --- /dev/null +++ b/codenet/public_test_cases/p00202/input.0.txt @@ -0,0 +1,14 @@ +4 15000 +305 +260 +129 +500 +3 400 +10 +20 +30 +3 200909 +5 +9 +12 +0 0 diff --git a/codenet/public_test_cases/p00202/input.1.txt b/codenet/public_test_cases/p00202/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b59f65ebfb8cc4a62e0baf9c837eb014f4137a5a --- /dev/null +++ b/codenet/public_test_cases/p00202/input.1.txt @@ -0,0 +1,14 @@ +4 15000 +305 +260 +129 +500 +3 400 +10 +20 +30 +3 200909 +5 +9 +12 +0 0 diff --git a/codenet/public_test_cases/p00202/output.0.txt b/codenet/public_test_cases/p00202/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d936e8404943939b534b3d6cb4be54d2af3a40f --- /dev/null +++ b/codenet/public_test_cases/p00202/output.0.txt @@ -0,0 +1,3 @@ +14983 +NA +200909 diff --git a/codenet/public_test_cases/p00202/output.1.txt b/codenet/public_test_cases/p00202/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d936e8404943939b534b3d6cb4be54d2af3a40f --- /dev/null +++ b/codenet/public_test_cases/p00202/output.1.txt @@ -0,0 +1,3 @@ +14983 +NA +200909 diff --git a/codenet/public_test_cases/p00203/input.0.txt b/codenet/public_test_cases/p00203/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e836494035861c15547421b46ca27afad62ed91 --- /dev/null +++ b/codenet/public_test_cases/p00203/input.0.txt @@ -0,0 +1,29 @@ +5 5 +0 0 0 0 1 +2 1 0 2 0 +1 0 0 1 1 +0 2 1 2 0 +0 1 0 0 0 +5 5 +0 0 1 0 0 +2 1 0 2 0 +1 0 0 1 1 +0 2 1 2 0 +0 1 0 0 0 +15 15 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 diff --git a/codenet/public_test_cases/p00203/input.1.txt b/codenet/public_test_cases/p00203/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e836494035861c15547421b46ca27afad62ed91 --- /dev/null +++ b/codenet/public_test_cases/p00203/input.1.txt @@ -0,0 +1,29 @@ +5 5 +0 0 0 0 1 +2 1 0 2 0 +1 0 0 1 1 +0 2 1 2 0 +0 1 0 0 0 +5 5 +0 0 1 0 0 +2 1 0 2 0 +1 0 0 1 1 +0 2 1 2 0 +0 1 0 0 0 +15 15 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 diff --git a/codenet/public_test_cases/p00203/output.0.txt b/codenet/public_test_cases/p00203/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d0c169d5c13f8f3a0c8275a3d6036f05113246a --- /dev/null +++ b/codenet/public_test_cases/p00203/output.0.txt @@ -0,0 +1,3 @@ +8 +6 +52694573 diff --git a/codenet/public_test_cases/p00203/output.1.txt b/codenet/public_test_cases/p00203/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d0c169d5c13f8f3a0c8275a3d6036f05113246a --- /dev/null +++ b/codenet/public_test_cases/p00203/output.1.txt @@ -0,0 +1,3 @@ +8 +6 +52694573 diff --git a/codenet/public_test_cases/p00204/input.0.txt b/codenet/public_test_cases/p00204/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05e5281c2ab6d4c6148e623c7f139e69f9f3e682 --- /dev/null +++ b/codenet/public_test_cases/p00204/input.0.txt @@ -0,0 +1,19 @@ +100 5 +101 101 5 5 +110 110 2 3 +-112 -100 9 11 +-208 160 82 90 +-110 108 10 2 +10 11 +15 0 5 1 +25 0 5 1 +35 0 5 1 +45 0 5 1 +55 0 5 1 +65 0 5 1 +75 0 5 1 +85 0 5 1 +95 0 5 1 +-20 0 5 20 +-30 0 500 5 +0 0 diff --git a/codenet/public_test_cases/p00204/input.1.txt b/codenet/public_test_cases/p00204/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05e5281c2ab6d4c6148e623c7f139e69f9f3e682 --- /dev/null +++ b/codenet/public_test_cases/p00204/input.1.txt @@ -0,0 +1,19 @@ +100 5 +101 101 5 5 +110 110 2 3 +-112 -100 9 11 +-208 160 82 90 +-110 108 10 2 +10 11 +15 0 5 1 +25 0 5 1 +35 0 5 1 +45 0 5 1 +55 0 5 1 +65 0 5 1 +75 0 5 1 +85 0 5 1 +95 0 5 1 +-20 0 5 20 +-30 0 500 5 +0 0 diff --git a/codenet/public_test_cases/p00204/output.0.txt b/codenet/public_test_cases/p00204/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p00204/output.0.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p00204/output.1.txt b/codenet/public_test_cases/p00204/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p00204/output.1.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p00205/input.0.txt b/codenet/public_test_cases/p00205/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccd3a04bd40f727e14dedf5e790ef1621c567ca2 --- /dev/null +++ b/codenet/public_test_cases/p00205/input.0.txt @@ -0,0 +1,11 @@ +1 +2 +3 +2 +1 +1 +2 +2 +2 +1 +0 diff --git a/codenet/public_test_cases/p00205/input.1.txt b/codenet/public_test_cases/p00205/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccd3a04bd40f727e14dedf5e790ef1621c567ca2 --- /dev/null +++ b/codenet/public_test_cases/p00205/input.1.txt @@ -0,0 +1,11 @@ +1 +2 +3 +2 +1 +1 +2 +2 +2 +1 +0 diff --git a/codenet/public_test_cases/p00205/output.0.txt b/codenet/public_test_cases/p00205/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..520e7abb3b7c861641a5fe16b78209ee94790aa6 --- /dev/null +++ b/codenet/public_test_cases/p00205/output.0.txt @@ -0,0 +1,10 @@ +3 +3 +3 +3 +3 +1 +2 +2 +2 +1 diff --git a/codenet/public_test_cases/p00205/output.1.txt b/codenet/public_test_cases/p00205/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..520e7abb3b7c861641a5fe16b78209ee94790aa6 --- /dev/null +++ b/codenet/public_test_cases/p00205/output.1.txt @@ -0,0 +1,10 @@ +3 +3 +3 +3 +3 +1 +2 +2 +2 +1 diff --git a/codenet/public_test_cases/p00206/input.0.txt b/codenet/public_test_cases/p00206/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e3ccd6f396baa74186039f156c098ff9edaad44 --- /dev/null +++ b/codenet/public_test_cases/p00206/input.0.txt @@ -0,0 +1,27 @@ +10000 +5000 3150 +5000 5000 +0 0 +5000 1050 +5000 3980 +5000 210 +5000 5000 +5000 5000 +0 0 +5000 2100 +5000 2100 +5000 2100 +29170 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 70831 +0 diff --git a/codenet/public_test_cases/p00206/input.1.txt b/codenet/public_test_cases/p00206/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e3ccd6f396baa74186039f156c098ff9edaad44 --- /dev/null +++ b/codenet/public_test_cases/p00206/input.1.txt @@ -0,0 +1,27 @@ +10000 +5000 3150 +5000 5000 +0 0 +5000 1050 +5000 3980 +5000 210 +5000 5000 +5000 5000 +0 0 +5000 2100 +5000 2100 +5000 2100 +29170 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 70831 +0 diff --git a/codenet/public_test_cases/p00206/output.0.txt b/codenet/public_test_cases/p00206/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1901a097c05e92b6bb66587d6891787f8ca266bd --- /dev/null +++ b/codenet/public_test_cases/p00206/output.0.txt @@ -0,0 +1,2 @@ +6 +NA diff --git a/codenet/public_test_cases/p00206/output.1.txt b/codenet/public_test_cases/p00206/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1901a097c05e92b6bb66587d6891787f8ca266bd --- /dev/null +++ b/codenet/public_test_cases/p00206/output.1.txt @@ -0,0 +1,2 @@ +6 +NA diff --git a/codenet/public_test_cases/p00207/input.0.txt b/codenet/public_test_cases/p00207/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3fce10894064468cda1ccc6b4918b36351c68de --- /dev/null +++ b/codenet/public_test_cases/p00207/input.0.txt @@ -0,0 +1,22 @@ +20 20 +1 1 +9 9 +7 +2 0 1 1 +5 1 1 3 +2 1 3 3 +1 1 5 2 +5 1 7 3 +2 0 2 7 +2 0 6 8 +20 20 +9 9 +1 1 +6 +2 0 1 1 +1 0 5 1 +2 1 1 3 +5 0 1 7 +3 1 5 5 +4 1 8 5 +0 0 diff --git a/codenet/public_test_cases/p00207/input.1.txt b/codenet/public_test_cases/p00207/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3fce10894064468cda1ccc6b4918b36351c68de --- /dev/null +++ b/codenet/public_test_cases/p00207/input.1.txt @@ -0,0 +1,22 @@ +20 20 +1 1 +9 9 +7 +2 0 1 1 +5 1 1 3 +2 1 3 3 +1 1 5 2 +5 1 7 3 +2 0 2 7 +2 0 6 8 +20 20 +9 9 +1 1 +6 +2 0 1 1 +1 0 5 1 +2 1 1 3 +5 0 1 7 +3 1 5 5 +4 1 8 5 +0 0 diff --git a/codenet/public_test_cases/p00207/output.0.txt b/codenet/public_test_cases/p00207/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14b51739d7a3a392ce92a7cf76c0211e0cc3cc35 --- /dev/null +++ b/codenet/public_test_cases/p00207/output.0.txt @@ -0,0 +1,2 @@ +OK +NG diff --git a/codenet/public_test_cases/p00207/output.1.txt b/codenet/public_test_cases/p00207/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14b51739d7a3a392ce92a7cf76c0211e0cc3cc35 --- /dev/null +++ b/codenet/public_test_cases/p00207/output.1.txt @@ -0,0 +1,2 @@ +OK +NG diff --git a/codenet/public_test_cases/p00208/input.0.txt b/codenet/public_test_cases/p00208/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87bd9c7c65761a0c6093e354ee8b11678f1a6482 --- /dev/null +++ b/codenet/public_test_cases/p00208/input.0.txt @@ -0,0 +1,5 @@ +15 +100 +1000000000 +3 +0 diff --git a/codenet/public_test_cases/p00208/input.1.txt b/codenet/public_test_cases/p00208/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87bd9c7c65761a0c6093e354ee8b11678f1a6482 --- /dev/null +++ b/codenet/public_test_cases/p00208/input.1.txt @@ -0,0 +1,5 @@ +15 +100 +1000000000 +3 +0 diff --git a/codenet/public_test_cases/p00208/output.0.txt b/codenet/public_test_cases/p00208/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8614031ef29c9c387bf9fe584d74a3a62e4268cc --- /dev/null +++ b/codenet/public_test_cases/p00208/output.0.txt @@ -0,0 +1,4 @@ +19 +155 +9358757000 +3 diff --git a/codenet/public_test_cases/p00208/output.1.txt b/codenet/public_test_cases/p00208/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8614031ef29c9c387bf9fe584d74a3a62e4268cc --- /dev/null +++ b/codenet/public_test_cases/p00208/output.1.txt @@ -0,0 +1,4 @@ +19 +155 +9358757000 +3 diff --git a/codenet/public_test_cases/p00209/input.0.txt b/codenet/public_test_cases/p00209/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6e6e977996d5decead588fddb269de9ede703b4 --- /dev/null +++ b/codenet/public_test_cases/p00209/input.0.txt @@ -0,0 +1,23 @@ +8 4 +2 1 3 1 1 5 1 3 +2 3 2 4 1 0 2 1 +0 3 1 2 1 1 4 2 +1 2 3 2 1 1 5 4 +0 2 0 1 1 3 2 1 +1 3 1 2 2 4 3 2 +5 1 2 1 4 1 1 5 +4 1 1 0 1 2 2 1 +2 -1 -1 -1 +0 3 -1 -1 +-1 2 2 4 +-1 1 -1 1 +5 3 +1 0 2 3 5 +2 3 7 2 1 +2 5 4 2 2 +8 9 0 3 3 +3 6 0 4 7 +-1 -1 2 +-1 3 5 +0 4 -1 +0 0 diff --git a/codenet/public_test_cases/p00209/input.1.txt b/codenet/public_test_cases/p00209/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6e6e977996d5decead588fddb269de9ede703b4 --- /dev/null +++ b/codenet/public_test_cases/p00209/input.1.txt @@ -0,0 +1,23 @@ +8 4 +2 1 3 1 1 5 1 3 +2 3 2 4 1 0 2 1 +0 3 1 2 1 1 4 2 +1 2 3 2 1 1 5 4 +0 2 0 1 1 3 2 1 +1 3 1 2 2 4 3 2 +5 1 2 1 4 1 1 5 +4 1 1 0 1 2 2 1 +2 -1 -1 -1 +0 3 -1 -1 +-1 2 2 4 +-1 1 -1 1 +5 3 +1 0 2 3 5 +2 3 7 2 1 +2 5 4 2 2 +8 9 0 3 3 +3 6 0 4 7 +-1 -1 2 +-1 3 5 +0 4 -1 +0 0 diff --git a/codenet/public_test_cases/p00209/output.0.txt b/codenet/public_test_cases/p00209/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0936a1db27b7a38f9513fb7f072205f3a9ebfc57 --- /dev/null +++ b/codenet/public_test_cases/p00209/output.0.txt @@ -0,0 +1,2 @@ +4 2 +NA diff --git a/codenet/public_test_cases/p00209/output.1.txt b/codenet/public_test_cases/p00209/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0936a1db27b7a38f9513fb7f072205f3a9ebfc57 --- /dev/null +++ b/codenet/public_test_cases/p00209/output.1.txt @@ -0,0 +1,2 @@ +4 2 +NA diff --git a/codenet/public_test_cases/p00210/input.0.txt b/codenet/public_test_cases/p00210/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b7858d104c7b4141a513a1106539e57e222a060 --- /dev/null +++ b/codenet/public_test_cases/p00210/input.0.txt @@ -0,0 +1,32 @@ +10 3 +########## +#E.......X +########## +4 4 +#### +#N.# +#..X +#### +5 5 +##### +#N..# +###.X +#S..# +##### +6 6 +###### +#..#X# +#.EE.# +####N# +#....# +###### +8 8 +##X##### +#....E.# +#####.## +#.#...## +#.W.#..# +#.#.N#.X +#X##.#.# +######## +0 0 diff --git a/codenet/public_test_cases/p00210/input.1.txt b/codenet/public_test_cases/p00210/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b7858d104c7b4141a513a1106539e57e222a060 --- /dev/null +++ b/codenet/public_test_cases/p00210/input.1.txt @@ -0,0 +1,32 @@ +10 3 +########## +#E.......X +########## +4 4 +#### +#N.# +#..X +#### +5 5 +##### +#N..# +###.X +#S..# +##### +6 6 +###### +#..#X# +#.EE.# +####N# +#....# +###### +8 8 +##X##### +#....E.# +#####.## +#.#...## +#.W.#..# +#.#.N#.X +#X##.#.# +######## +0 0 diff --git a/codenet/public_test_cases/p00210/input.2.txt b/codenet/public_test_cases/p00210/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8e8461792e00f4c331297f3a0cde8cb2a9f35b8 --- /dev/null +++ b/codenet/public_test_cases/p00210/input.2.txt @@ -0,0 +1,32 @@ +10 3 + +E.......X + +4 4 + +N.# +..X + +5 5 + +N..# +.X +S..# + +6 6 + +..#X# +.EE.# +N# +....# + +8 8 +X##### +....E.# +.## +.#...## +.W.#..# +.#.N#.X +X##.#.# + +0 0 diff --git a/codenet/public_test_cases/p00210/output.0.txt b/codenet/public_test_cases/p00210/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27c341e6fed58861f793eaf90e3850ef7b3575db --- /dev/null +++ b/codenet/public_test_cases/p00210/output.0.txt @@ -0,0 +1,5 @@ +8 +NA +9 +16 +10 diff --git a/codenet/public_test_cases/p00210/output.1.txt b/codenet/public_test_cases/p00210/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27c341e6fed58861f793eaf90e3850ef7b3575db --- /dev/null +++ b/codenet/public_test_cases/p00210/output.1.txt @@ -0,0 +1,5 @@ +8 +NA +9 +16 +10 diff --git a/codenet/public_test_cases/p00210/output.2.txt b/codenet/public_test_cases/p00210/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..27c341e6fed58861f793eaf90e3850ef7b3575db --- /dev/null +++ b/codenet/public_test_cases/p00210/output.2.txt @@ -0,0 +1,5 @@ +8 +NA +9 +16 +10 diff --git a/codenet/public_test_cases/p00211/input.0.txt b/codenet/public_test_cases/p00211/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5c0ae2f54cd7bd0f5f4c1e8356c9c5542513883 --- /dev/null +++ b/codenet/public_test_cases/p00211/input.0.txt @@ -0,0 +1,13 @@ +2 +4 3 +5 4 +5 +789 289 +166 46 +9 4 +617 252 +972 303 +2 +8 5 +32 20 +0 diff --git a/codenet/public_test_cases/p00211/input.1.txt b/codenet/public_test_cases/p00211/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5c0ae2f54cd7bd0f5f4c1e8356c9c5542513883 --- /dev/null +++ b/codenet/public_test_cases/p00211/input.1.txt @@ -0,0 +1,13 @@ +2 +4 3 +5 4 +5 +789 289 +166 46 +9 4 +617 252 +972 303 +2 +8 5 +32 20 +0 diff --git a/codenet/public_test_cases/p00211/output.0.txt b/codenet/public_test_cases/p00211/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b0ae7bd32c39b6de3dab589cf65ac8b2448a033 --- /dev/null +++ b/codenet/public_test_cases/p00211/output.0.txt @@ -0,0 +1,9 @@ +15 +16 +1598397732 +1209243492 +1939462992 +1782294192 +1360317793 +1 +1 diff --git a/codenet/public_test_cases/p00211/output.1.txt b/codenet/public_test_cases/p00211/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b0ae7bd32c39b6de3dab589cf65ac8b2448a033 --- /dev/null +++ b/codenet/public_test_cases/p00211/output.1.txt @@ -0,0 +1,9 @@ +15 +16 +1598397732 +1209243492 +1939462992 +1782294192 +1360317793 +1 +1 diff --git a/codenet/public_test_cases/p00212/input.0.txt b/codenet/public_test_cases/p00212/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8843841404f611518e6448be3550a0ce2ce5f007 --- /dev/null +++ b/codenet/public_test_cases/p00212/input.0.txt @@ -0,0 +1,16 @@ +1 3 3 1 3 +1 3 2000 +1 2 1000 +2 3 1000 +2 3 3 1 3 +1 3 2300 +1 2 1000 +2 3 1200 +2 6 6 5 1 +1 2 1500 +1 3 4500 +2 6 2000 +5 4 1000 +6 4 2200 +3 5 3000 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00212/input.1.txt b/codenet/public_test_cases/p00212/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8843841404f611518e6448be3550a0ce2ce5f007 --- /dev/null +++ b/codenet/public_test_cases/p00212/input.1.txt @@ -0,0 +1,16 @@ +1 3 3 1 3 +1 3 2000 +1 2 1000 +2 3 1000 +2 3 3 1 3 +1 3 2300 +1 2 1000 +2 3 1200 +2 6 6 5 1 +1 2 1500 +1 3 4500 +2 6 2000 +5 4 1000 +6 4 2200 +3 5 3000 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00212/output.0.txt b/codenet/public_test_cases/p00212/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85398aba288e8e1aecb4d48bb8c2ac39de616e29 --- /dev/null +++ b/codenet/public_test_cases/p00212/output.0.txt @@ -0,0 +1,3 @@ +1000 +1100 +3750 diff --git a/codenet/public_test_cases/p00212/output.1.txt b/codenet/public_test_cases/p00212/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85398aba288e8e1aecb4d48bb8c2ac39de616e29 --- /dev/null +++ b/codenet/public_test_cases/p00212/output.1.txt @@ -0,0 +1,3 @@ +1000 +1100 +3750 diff --git a/codenet/public_test_cases/p00213/input.0.txt b/codenet/public_test_cases/p00213/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bbe6aade99fb3d683196aa59504cffac274c8caa --- /dev/null +++ b/codenet/public_test_cases/p00213/input.0.txt @@ -0,0 +1,26 @@ +5 4 6 +1 6 +2 4 +3 3 +4 4 +5 1 +6 2 +0 0 1 0 0 +0 0 0 2 0 +0 0 0 3 0 +0 4 5 0 6 +3 3 1 +1 9 +0 0 1 +0 0 0 +0 0 0 +4 4 4 +1 6 +2 2 +3 4 +4 4 +0 1 0 0 +0 0 0 2 +0 0 3 0 +0 4 0 0 +0 0 0 diff --git a/codenet/public_test_cases/p00213/input.1.txt b/codenet/public_test_cases/p00213/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bbe6aade99fb3d683196aa59504cffac274c8caa --- /dev/null +++ b/codenet/public_test_cases/p00213/input.1.txt @@ -0,0 +1,26 @@ +5 4 6 +1 6 +2 4 +3 3 +4 4 +5 1 +6 2 +0 0 1 0 0 +0 0 0 2 0 +0 0 0 3 0 +0 4 5 0 6 +3 3 1 +1 9 +0 0 1 +0 0 0 +0 0 0 +4 4 4 +1 6 +2 2 +3 4 +4 4 +0 1 0 0 +0 0 0 2 +0 0 3 0 +0 4 0 0 +0 0 0 diff --git a/codenet/public_test_cases/p00213/output.0.txt b/codenet/public_test_cases/p00213/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f24d7bc89a5d6cdf9bcbea3d1cf86a20fc2d3d2 --- /dev/null +++ b/codenet/public_test_cases/p00213/output.0.txt @@ -0,0 +1,8 @@ +1 1 1 2 2 +1 1 1 2 2 +4 4 3 3 3 +4 4 5 6 6 +1 1 1 +1 1 1 +1 1 1 +NA diff --git a/codenet/public_test_cases/p00213/output.1.txt b/codenet/public_test_cases/p00213/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f24d7bc89a5d6cdf9bcbea3d1cf86a20fc2d3d2 --- /dev/null +++ b/codenet/public_test_cases/p00213/output.1.txt @@ -0,0 +1,8 @@ +1 1 1 2 2 +1 1 1 2 2 +4 4 3 3 3 +4 4 5 6 6 +1 1 1 +1 1 1 +1 1 1 +NA diff --git a/codenet/public_test_cases/p00214/input.0.txt b/codenet/public_test_cases/p00214/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c197fe5ef5ecd607b10014e19e076c20b1fbcdc6 --- /dev/null +++ b/codenet/public_test_cases/p00214/input.0.txt @@ -0,0 +1,15 @@ +3 +1 +0 0 0 1 1 1 1 0 +2 +0 0 0 1 1 1 1 0 +100 100 100 200 200 200 200 100 +2 +0 0 0 100 100 100 100 0 +10 10 10 20 20 20 20 10 +2 +1 +30 40 40 50 40 20 20 10 +1 +30 40 40 50 40 20 20 10 +0 diff --git a/codenet/public_test_cases/p00214/input.1.txt b/codenet/public_test_cases/p00214/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c197fe5ef5ecd607b10014e19e076c20b1fbcdc6 --- /dev/null +++ b/codenet/public_test_cases/p00214/input.1.txt @@ -0,0 +1,15 @@ +3 +1 +0 0 0 1 1 1 1 0 +2 +0 0 0 1 1 1 1 0 +100 100 100 200 200 200 200 100 +2 +0 0 0 100 100 100 100 0 +10 10 10 20 20 20 20 10 +2 +1 +30 40 40 50 40 20 20 10 +1 +30 40 40 50 40 20 20 10 +0 diff --git a/codenet/public_test_cases/p00214/output.0.txt b/codenet/public_test_cases/p00214/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa148df726409e7450c70d7b4d6191233d4b75f5 --- /dev/null +++ b/codenet/public_test_cases/p00214/output.0.txt @@ -0,0 +1,5 @@ +1 +2 +1 +1 +1 diff --git a/codenet/public_test_cases/p00214/output.1.txt b/codenet/public_test_cases/p00214/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa148df726409e7450c70d7b4d6191233d4b75f5 --- /dev/null +++ b/codenet/public_test_cases/p00214/output.1.txt @@ -0,0 +1,5 @@ +1 +2 +1 +1 +1 diff --git a/codenet/public_test_cases/p00215/input.0.txt b/codenet/public_test_cases/p00215/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52fbd4f6b29400ca6ce8a357c629d78ef974778c --- /dev/null +++ b/codenet/public_test_cases/p00215/input.0.txt @@ -0,0 +1,11 @@ +6 6 +S.1..4 +3..5.. +..4.1. +4....5 +.2.32. +5.1..G +3 2 +... +S.G +0 0 diff --git a/codenet/public_test_cases/p00215/input.1.txt b/codenet/public_test_cases/p00215/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..52fbd4f6b29400ca6ce8a357c629d78ef974778c --- /dev/null +++ b/codenet/public_test_cases/p00215/input.1.txt @@ -0,0 +1,11 @@ +6 6 +S.1..4 +3..5.. +..4.1. +4....5 +.2.32. +5.1..G +3 2 +... +S.G +0 0 diff --git a/codenet/public_test_cases/p00215/output.0.txt b/codenet/public_test_cases/p00215/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4be2bc763289efbbd55a873695c4b3d968eee53 --- /dev/null +++ b/codenet/public_test_cases/p00215/output.0.txt @@ -0,0 +1,2 @@ +2 10 +NA diff --git a/codenet/public_test_cases/p00215/output.1.txt b/codenet/public_test_cases/p00215/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4be2bc763289efbbd55a873695c4b3d968eee53 --- /dev/null +++ b/codenet/public_test_cases/p00215/output.1.txt @@ -0,0 +1,2 @@ +2 10 +NA diff --git a/codenet/public_test_cases/p00216/input.0.txt b/codenet/public_test_cases/p00216/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d0c3666cdb1b2f458dc10d11aa2a27e529e2139 --- /dev/null +++ b/codenet/public_test_cases/p00216/input.0.txt @@ -0,0 +1,4 @@ +29 +40 +0 +-1 diff --git a/codenet/public_test_cases/p00216/input.1.txt b/codenet/public_test_cases/p00216/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d0c3666cdb1b2f458dc10d11aa2a27e529e2139 --- /dev/null +++ b/codenet/public_test_cases/p00216/input.1.txt @@ -0,0 +1,4 @@ +29 +40 +0 +-1 diff --git a/codenet/public_test_cases/p00216/output.0.txt b/codenet/public_test_cases/p00216/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8739ec399f953c1af1fe9c0ac8c20d098e139eb8 --- /dev/null +++ b/codenet/public_test_cases/p00216/output.0.txt @@ -0,0 +1,3 @@ +620 +-1120 +3130 diff --git a/codenet/public_test_cases/p00216/output.1.txt b/codenet/public_test_cases/p00216/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8739ec399f953c1af1fe9c0ac8c20d098e139eb8 --- /dev/null +++ b/codenet/public_test_cases/p00216/output.1.txt @@ -0,0 +1,3 @@ +620 +-1120 +3130 diff --git a/codenet/public_test_cases/p00217/input.0.txt b/codenet/public_test_cases/p00217/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a36e8bbb119077266997b4104efdc051df5cd7b --- /dev/null +++ b/codenet/public_test_cases/p00217/input.0.txt @@ -0,0 +1,11 @@ +5 +263 2345 2504 +1 3210 1985 +5000 1501 4132 +10000 503 3107 +51 1758 2690 +3 +345 5000 2396 +7 3910 1590 +6789 2525 3616 +0 diff --git a/codenet/public_test_cases/p00217/input.1.txt b/codenet/public_test_cases/p00217/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a36e8bbb119077266997b4104efdc051df5cd7b --- /dev/null +++ b/codenet/public_test_cases/p00217/input.1.txt @@ -0,0 +1,11 @@ +5 +263 2345 2504 +1 3210 1985 +5000 1501 4132 +10000 503 3107 +51 1758 2690 +3 +345 5000 2396 +7 3910 1590 +6789 2525 3616 +0 diff --git a/codenet/public_test_cases/p00217/output.0.txt b/codenet/public_test_cases/p00217/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..472dde19b526a78bf15089916f2ef1a765c622e5 --- /dev/null +++ b/codenet/public_test_cases/p00217/output.0.txt @@ -0,0 +1,2 @@ +5000 5633 +345 7396 diff --git a/codenet/public_test_cases/p00217/output.1.txt b/codenet/public_test_cases/p00217/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..472dde19b526a78bf15089916f2ef1a765c622e5 --- /dev/null +++ b/codenet/public_test_cases/p00217/output.1.txt @@ -0,0 +1,2 @@ +5000 5633 +345 7396 diff --git a/codenet/public_test_cases/p00218/input.0.txt b/codenet/public_test_cases/p00218/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a87d17cfd536a00b421a62bd381cb232199ed195 --- /dev/null +++ b/codenet/public_test_cases/p00218/input.0.txt @@ -0,0 +1,9 @@ +4 +100 70 20 +98 86 55 +80 34 36 +65 79 65 +2 +99 81 20 +66 72 90 +0 diff --git a/codenet/public_test_cases/p00218/input.1.txt b/codenet/public_test_cases/p00218/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a87d17cfd536a00b421a62bd381cb232199ed195 --- /dev/null +++ b/codenet/public_test_cases/p00218/input.1.txt @@ -0,0 +1,9 @@ +4 +100 70 20 +98 86 55 +80 34 36 +65 79 65 +2 +99 81 20 +66 72 90 +0 diff --git a/codenet/public_test_cases/p00218/output.0.txt b/codenet/public_test_cases/p00218/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fdb569209fcb49bd81a922591c54466595db30f --- /dev/null +++ b/codenet/public_test_cases/p00218/output.0.txt @@ -0,0 +1,6 @@ +A +A +B +C +A +B diff --git a/codenet/public_test_cases/p00218/output.1.txt b/codenet/public_test_cases/p00218/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fdb569209fcb49bd81a922591c54466595db30f --- /dev/null +++ b/codenet/public_test_cases/p00218/output.1.txt @@ -0,0 +1,6 @@ +A +A +B +C +A +B diff --git a/codenet/public_test_cases/p00219/input.0.txt b/codenet/public_test_cases/p00219/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5e1c564d93483901621230b7f7b0dd872d9cad2 --- /dev/null +++ b/codenet/public_test_cases/p00219/input.0.txt @@ -0,0 +1,21 @@ +15 +2 +6 +7 +0 +1 +9 +8 +7 +3 +8 +9 +4 +8 +2 +2 +3 +9 +1 +5 +0 diff --git a/codenet/public_test_cases/p00219/input.1.txt b/codenet/public_test_cases/p00219/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5e1c564d93483901621230b7f7b0dd872d9cad2 --- /dev/null +++ b/codenet/public_test_cases/p00219/input.1.txt @@ -0,0 +1,21 @@ +15 +2 +6 +7 +0 +1 +9 +8 +7 +3 +8 +9 +4 +8 +2 +2 +3 +9 +1 +5 +0 diff --git a/codenet/public_test_cases/p00219/output.0.txt b/codenet/public_test_cases/p00219/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afcbdf0216ad7649c76de02f23eec8b904f4d7f0 --- /dev/null +++ b/codenet/public_test_cases/p00219/output.0.txt @@ -0,0 +1,20 @@ +* +* +*** +* +* +- +* +** +*** +** +- +* +- +- +- +* +- +- +- +* diff --git a/codenet/public_test_cases/p00219/output.1.txt b/codenet/public_test_cases/p00219/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afcbdf0216ad7649c76de02f23eec8b904f4d7f0 --- /dev/null +++ b/codenet/public_test_cases/p00219/output.1.txt @@ -0,0 +1,20 @@ +* +* +*** +* +* +- +* +** +*** +** +- +* +- +- +- +* +- +- +- +* diff --git a/codenet/public_test_cases/p00220/input.0.txt b/codenet/public_test_cases/p00220/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d56a3faf6013091380a27a1144b5e11c5d585315 --- /dev/null +++ b/codenet/public_test_cases/p00220/input.0.txt @@ -0,0 +1,3 @@ +23.5 +158.1 +-1.0 diff --git a/codenet/public_test_cases/p00220/input.1.txt b/codenet/public_test_cases/p00220/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d56a3faf6013091380a27a1144b5e11c5d585315 --- /dev/null +++ b/codenet/public_test_cases/p00220/input.1.txt @@ -0,0 +1,3 @@ +23.5 +158.1 +-1.0 diff --git a/codenet/public_test_cases/p00220/output.0.txt b/codenet/public_test_cases/p00220/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..208e7141275e961e0059a7aff1cab7b608335805 --- /dev/null +++ b/codenet/public_test_cases/p00220/output.0.txt @@ -0,0 +1,2 @@ +00010111.1000 +NA diff --git a/codenet/public_test_cases/p00220/output.1.txt b/codenet/public_test_cases/p00220/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..208e7141275e961e0059a7aff1cab7b608335805 --- /dev/null +++ b/codenet/public_test_cases/p00220/output.1.txt @@ -0,0 +1,2 @@ +00010111.1000 +NA diff --git a/codenet/public_test_cases/p00221/input.0.txt b/codenet/public_test_cases/p00221/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d71d5164592be50f784f4bd81b8158339a70319 --- /dev/null +++ b/codenet/public_test_cases/p00221/input.0.txt @@ -0,0 +1,15 @@ +5 7 +1 +2 +Fizz +4 +Buzz +6 +7 +3 5 +1 +2 +3 +4 +5 +0 0 diff --git a/codenet/public_test_cases/p00221/input.1.txt b/codenet/public_test_cases/p00221/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d71d5164592be50f784f4bd81b8158339a70319 --- /dev/null +++ b/codenet/public_test_cases/p00221/input.1.txt @@ -0,0 +1,15 @@ +5 7 +1 +2 +Fizz +4 +Buzz +6 +7 +3 5 +1 +2 +3 +4 +5 +0 0 diff --git a/codenet/public_test_cases/p00221/output.0.txt b/codenet/public_test_cases/p00221/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..103a1ca8bcd9c167c4b1789480a059bc230c7227 --- /dev/null +++ b/codenet/public_test_cases/p00221/output.0.txt @@ -0,0 +1,2 @@ +2 3 4 5 +1 diff --git a/codenet/public_test_cases/p00221/output.1.txt b/codenet/public_test_cases/p00221/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..103a1ca8bcd9c167c4b1789480a059bc230c7227 --- /dev/null +++ b/codenet/public_test_cases/p00221/output.1.txt @@ -0,0 +1,2 @@ +2 3 4 5 +1 diff --git a/codenet/public_test_cases/p00222/input.0.txt b/codenet/public_test_cases/p00222/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9666f631e8358a71ad4cc9c6ffe2c87b0767b808 --- /dev/null +++ b/codenet/public_test_cases/p00222/input.0.txt @@ -0,0 +1,10 @@ +13 +14 +15 +16 +17 +18 +19 +20 +10000 +0 diff --git a/codenet/public_test_cases/p00222/input.1.txt b/codenet/public_test_cases/p00222/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9666f631e8358a71ad4cc9c6ffe2c87b0767b808 --- /dev/null +++ b/codenet/public_test_cases/p00222/input.1.txt @@ -0,0 +1,10 @@ +13 +14 +15 +16 +17 +18 +19 +20 +10000 +0 diff --git a/codenet/public_test_cases/p00222/output.0.txt b/codenet/public_test_cases/p00222/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23cae1c9f3b753cfb18240f84fa4ab476d4db43a --- /dev/null +++ b/codenet/public_test_cases/p00222/output.0.txt @@ -0,0 +1,9 @@ +13 +13 +13 +13 +13 +13 +19 +19 +9439 diff --git a/codenet/public_test_cases/p00222/output.1.txt b/codenet/public_test_cases/p00222/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..23cae1c9f3b753cfb18240f84fa4ab476d4db43a --- /dev/null +++ b/codenet/public_test_cases/p00222/output.1.txt @@ -0,0 +1,9 @@ +13 +13 +13 +13 +13 +13 +19 +19 +9439 diff --git a/codenet/public_test_cases/p00223/input.0.txt b/codenet/public_test_cases/p00223/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded99c39a80d269d2be825c6b0f184fac7d0c7cf --- /dev/null +++ b/codenet/public_test_cases/p00223/input.0.txt @@ -0,0 +1,16 @@ +6 6 +2 4 +6 2 +0 0 0 0 1 0 +0 1 0 0 0 0 +0 1 0 0 0 0 +0 0 0 1 0 0 +0 0 0 0 0 1 +0 0 0 0 0 0 +3 3 +1 1 +3 3 +0 0 0 +0 1 0 +0 0 0 +0 0 diff --git a/codenet/public_test_cases/p00223/input.1.txt b/codenet/public_test_cases/p00223/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded99c39a80d269d2be825c6b0f184fac7d0c7cf --- /dev/null +++ b/codenet/public_test_cases/p00223/input.1.txt @@ -0,0 +1,16 @@ +6 6 +2 4 +6 2 +0 0 0 0 1 0 +0 1 0 0 0 0 +0 1 0 0 0 0 +0 0 0 1 0 0 +0 0 0 0 0 1 +0 0 0 0 0 0 +3 3 +1 1 +3 3 +0 0 0 +0 1 0 +0 0 0 +0 0 diff --git a/codenet/public_test_cases/p00223/output.0.txt b/codenet/public_test_cases/p00223/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4d9939b23cee6eb0dc46d6b81bca1a6ab93be9b --- /dev/null +++ b/codenet/public_test_cases/p00223/output.0.txt @@ -0,0 +1,2 @@ +3 +NA diff --git a/codenet/public_test_cases/p00223/output.1.txt b/codenet/public_test_cases/p00223/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4d9939b23cee6eb0dc46d6b81bca1a6ab93be9b --- /dev/null +++ b/codenet/public_test_cases/p00223/output.1.txt @@ -0,0 +1,2 @@ +3 +NA diff --git a/codenet/public_test_cases/p00224/input.0.txt b/codenet/public_test_cases/p00224/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ff242af363af817392b8f96d8d432bcf7188b92 --- /dev/null +++ b/codenet/public_test_cases/p00224/input.0.txt @@ -0,0 +1,16 @@ +1 1 2 5 +35 +H L1 5 +C1 D 6 +C1 H 12 +L1 D 10 +C1 L1 20 +2 1 4 6 +100 70 +H L1 5 +C1 L1 12 +C1 D 11 +C2 L1 7 +C2 D 15 +L1 D 8 +0 0 0 0 diff --git a/codenet/public_test_cases/p00224/input.1.txt b/codenet/public_test_cases/p00224/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ff242af363af817392b8f96d8d432bcf7188b92 --- /dev/null +++ b/codenet/public_test_cases/p00224/input.1.txt @@ -0,0 +1,16 @@ +1 1 2 5 +35 +H L1 5 +C1 D 6 +C1 H 12 +L1 D 10 +C1 L1 20 +2 1 4 6 +100 70 +H L1 5 +C1 L1 12 +C1 D 11 +C2 L1 7 +C2 D 15 +L1 D 8 +0 0 0 0 diff --git a/codenet/public_test_cases/p00224/output.0.txt b/codenet/public_test_cases/p00224/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..223767efa820bfec43233770fc3e2f3cef22c328 --- /dev/null +++ b/codenet/public_test_cases/p00224/output.0.txt @@ -0,0 +1,2 @@ +1 +-2 diff --git a/codenet/public_test_cases/p00224/output.1.txt b/codenet/public_test_cases/p00224/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..223767efa820bfec43233770fc3e2f3cef22c328 --- /dev/null +++ b/codenet/public_test_cases/p00224/output.1.txt @@ -0,0 +1,2 @@ +1 +-2 diff --git a/codenet/public_test_cases/p00225/input.0.txt b/codenet/public_test_cases/p00225/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe5f2383add311203e233548bc2f3099ca7893e9 --- /dev/null +++ b/codenet/public_test_cases/p00225/input.0.txt @@ -0,0 +1,15 @@ +5 +apple +yellow +georgia +king +email +7 +apple +yellow +georgia +king +email +wink +lucky +0 diff --git a/codenet/public_test_cases/p00225/input.1.txt b/codenet/public_test_cases/p00225/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe5f2383add311203e233548bc2f3099ca7893e9 --- /dev/null +++ b/codenet/public_test_cases/p00225/input.1.txt @@ -0,0 +1,15 @@ +5 +apple +yellow +georgia +king +email +7 +apple +yellow +georgia +king +email +wink +lucky +0 diff --git a/codenet/public_test_cases/p00225/output.0.txt b/codenet/public_test_cases/p00225/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e567f9e08a16e5834dffa203a1ba3027c32307c --- /dev/null +++ b/codenet/public_test_cases/p00225/output.0.txt @@ -0,0 +1,2 @@ +NG +OK diff --git a/codenet/public_test_cases/p00225/output.1.txt b/codenet/public_test_cases/p00225/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e567f9e08a16e5834dffa203a1ba3027c32307c --- /dev/null +++ b/codenet/public_test_cases/p00225/output.1.txt @@ -0,0 +1,2 @@ +NG +OK diff --git a/codenet/public_test_cases/p00226/input.0.txt b/codenet/public_test_cases/p00226/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59194b8c474ebca112640c0f44b9f6885da0ac3b --- /dev/null +++ b/codenet/public_test_cases/p00226/input.0.txt @@ -0,0 +1,6 @@ +1234 5678 +1234 1354 +1234 1234 +1230 1023 +0123 1234 +0 0 diff --git a/codenet/public_test_cases/p00226/input.1.txt b/codenet/public_test_cases/p00226/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59194b8c474ebca112640c0f44b9f6885da0ac3b --- /dev/null +++ b/codenet/public_test_cases/p00226/input.1.txt @@ -0,0 +1,6 @@ +1234 5678 +1234 1354 +1234 1234 +1230 1023 +0123 1234 +0 0 diff --git a/codenet/public_test_cases/p00226/output.0.txt b/codenet/public_test_cases/p00226/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae732da39d9736ab8aa28f97da1583e3e551a635 --- /dev/null +++ b/codenet/public_test_cases/p00226/output.0.txt @@ -0,0 +1,5 @@ +0 0 +2 1 +4 0 +1 3 +0 3 diff --git a/codenet/public_test_cases/p00226/output.1.txt b/codenet/public_test_cases/p00226/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae732da39d9736ab8aa28f97da1583e3e551a635 --- /dev/null +++ b/codenet/public_test_cases/p00226/output.1.txt @@ -0,0 +1,5 @@ +0 0 +2 1 +4 0 +1 3 +0 3 diff --git a/codenet/public_test_cases/p00227/input.0.txt b/codenet/public_test_cases/p00227/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba240043dc507f6052b737c8bf2a4a02b0ae246a --- /dev/null +++ b/codenet/public_test_cases/p00227/input.0.txt @@ -0,0 +1,5 @@ +4 2 +50 40 100 80 +7 3 +400 300 100 700 200 600 500 +0 0 diff --git a/codenet/public_test_cases/p00227/input.1.txt b/codenet/public_test_cases/p00227/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba240043dc507f6052b737c8bf2a4a02b0ae246a --- /dev/null +++ b/codenet/public_test_cases/p00227/input.1.txt @@ -0,0 +1,5 @@ +4 2 +50 40 100 80 +7 3 +400 300 100 700 200 600 500 +0 0 diff --git a/codenet/public_test_cases/p00227/output.0.txt b/codenet/public_test_cases/p00227/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d9e74eebd4a330b102f43008786e1d72bb73047 --- /dev/null +++ b/codenet/public_test_cases/p00227/output.0.txt @@ -0,0 +1,2 @@ +150 +2100 diff --git a/codenet/public_test_cases/p00227/output.1.txt b/codenet/public_test_cases/p00227/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d9e74eebd4a330b102f43008786e1d72bb73047 --- /dev/null +++ b/codenet/public_test_cases/p00227/output.1.txt @@ -0,0 +1,2 @@ +150 +2100 diff --git a/codenet/public_test_cases/p00228/input.0.txt b/codenet/public_test_cases/p00228/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9f8c811561af00a9a349be9f55c24c1c9d6994b --- /dev/null +++ b/codenet/public_test_cases/p00228/input.0.txt @@ -0,0 +1,7 @@ +3 +0 +5 +1 +1 +0 +-1 diff --git a/codenet/public_test_cases/p00228/input.1.txt b/codenet/public_test_cases/p00228/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9f8c811561af00a9a349be9f55c24c1c9d6994b --- /dev/null +++ b/codenet/public_test_cases/p00228/input.1.txt @@ -0,0 +1,7 @@ +3 +0 +5 +1 +1 +0 +-1 diff --git a/codenet/public_test_cases/p00228/output.0.txt b/codenet/public_test_cases/p00228/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c8caafe78c0298fa8c9b353c150d44d114029e7 --- /dev/null +++ b/codenet/public_test_cases/p00228/output.0.txt @@ -0,0 +1,4 @@ +0111111 +1010010 +1101011 +0111111 diff --git a/codenet/public_test_cases/p00228/output.1.txt b/codenet/public_test_cases/p00228/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c8caafe78c0298fa8c9b353c150d44d114029e7 --- /dev/null +++ b/codenet/public_test_cases/p00228/output.1.txt @@ -0,0 +1,4 @@ +0111111 +1010010 +1101011 +0111111 diff --git a/codenet/public_test_cases/p00229/input.0.txt b/codenet/public_test_cases/p00229/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed4bfd795ff45596a984b173e898a0ecf5607de2 --- /dev/null +++ b/codenet/public_test_cases/p00229/input.0.txt @@ -0,0 +1,6 @@ +3 2 30 3 26 226 +9 0 18 3 20 118 +5 5 12 2 15 203 +7 4 19 2 22 197 +7 4 24 4 17 209 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00229/input.1.txt b/codenet/public_test_cases/p00229/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed4bfd795ff45596a984b173e898a0ecf5607de2 --- /dev/null +++ b/codenet/public_test_cases/p00229/input.1.txt @@ -0,0 +1,6 @@ +3 2 30 3 26 226 +9 0 18 3 20 118 +5 5 12 2 15 203 +7 4 19 2 22 197 +7 4 24 4 17 209 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00229/output.0.txt b/codenet/public_test_cases/p00229/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d5c8c3fe585d082fef845a10ed3c3dd70206ee8 --- /dev/null +++ b/codenet/public_test_cases/p00229/output.0.txt @@ -0,0 +1,5 @@ +127 +793 +414 +629 +617 diff --git a/codenet/public_test_cases/p00229/output.1.txt b/codenet/public_test_cases/p00229/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d5c8c3fe585d082fef845a10ed3c3dd70206ee8 --- /dev/null +++ b/codenet/public_test_cases/p00229/output.1.txt @@ -0,0 +1,5 @@ +127 +793 +414 +629 +617 diff --git a/codenet/public_test_cases/p00230/input.0.txt b/codenet/public_test_cases/p00230/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33c37f1bc0d82e052ceb9d1d2f0b7b7703ad113a --- /dev/null +++ b/codenet/public_test_cases/p00230/input.0.txt @@ -0,0 +1,7 @@ +8 +0 0 0 2 2 2 0 0 +1 1 1 1 0 0 0 0 +4 +1 1 2 2 +0 0 2 2 +0 diff --git a/codenet/public_test_cases/p00230/input.1.txt b/codenet/public_test_cases/p00230/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..33c37f1bc0d82e052ceb9d1d2f0b7b7703ad113a --- /dev/null +++ b/codenet/public_test_cases/p00230/input.1.txt @@ -0,0 +1,7 @@ +8 +0 0 0 2 2 2 0 0 +1 1 1 1 0 0 0 0 +4 +1 1 2 2 +0 0 2 2 +0 diff --git a/codenet/public_test_cases/p00230/output.0.txt b/codenet/public_test_cases/p00230/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d1f8f4c26058ff823fab74bb60b3880e7bd63ab --- /dev/null +++ b/codenet/public_test_cases/p00230/output.0.txt @@ -0,0 +1,2 @@ +4 +NA diff --git a/codenet/public_test_cases/p00230/output.1.txt b/codenet/public_test_cases/p00230/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d1f8f4c26058ff823fab74bb60b3880e7bd63ab --- /dev/null +++ b/codenet/public_test_cases/p00230/output.1.txt @@ -0,0 +1,2 @@ +4 +NA diff --git a/codenet/public_test_cases/p00231/input.0.txt b/codenet/public_test_cases/p00231/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b74692c14f902b0684f1e41e5878041e47cb5f38 --- /dev/null +++ b/codenet/public_test_cases/p00231/input.0.txt @@ -0,0 +1,9 @@ +3 +80 0 30 +50 5 25 +90 27 50 +3 +80 0 30 +70 5 25 +71 30 50 +0 diff --git a/codenet/public_test_cases/p00231/input.1.txt b/codenet/public_test_cases/p00231/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b74692c14f902b0684f1e41e5878041e47cb5f38 --- /dev/null +++ b/codenet/public_test_cases/p00231/input.1.txt @@ -0,0 +1,9 @@ +3 +80 0 30 +50 5 25 +90 27 50 +3 +80 0 30 +70 5 25 +71 30 50 +0 diff --git a/codenet/public_test_cases/p00231/output.0.txt b/codenet/public_test_cases/p00231/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e567f9e08a16e5834dffa203a1ba3027c32307c --- /dev/null +++ b/codenet/public_test_cases/p00231/output.0.txt @@ -0,0 +1,2 @@ +NG +OK diff --git a/codenet/public_test_cases/p00231/output.1.txt b/codenet/public_test_cases/p00231/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e567f9e08a16e5834dffa203a1ba3027c32307c --- /dev/null +++ b/codenet/public_test_cases/p00231/output.1.txt @@ -0,0 +1,2 @@ +NG +OK diff --git a/codenet/public_test_cases/p00232/input.0.txt b/codenet/public_test_cases/p00232/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37903224fc4c563b3a0d6a897b84da0a9ef86934 --- /dev/null +++ b/codenet/public_test_cases/p00232/input.0.txt @@ -0,0 +1,17 @@ +1 2 0 +1 +1 2 1 +1 +1 2 100 +1 2 1 +2 +1 2 100 +2 2 1 +1 2 +1 2 100 +4 5 3 +1 2 3 4 +1 1 2 +2 2 100 +4 3 60 +0 0 0 diff --git a/codenet/public_test_cases/p00232/input.1.txt b/codenet/public_test_cases/p00232/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37903224fc4c563b3a0d6a897b84da0a9ef86934 --- /dev/null +++ b/codenet/public_test_cases/p00232/input.1.txt @@ -0,0 +1,17 @@ +1 2 0 +1 +1 2 1 +1 +1 2 100 +1 2 1 +2 +1 2 100 +2 2 1 +1 2 +1 2 100 +4 5 3 +1 2 3 4 +1 1 2 +2 2 100 +4 3 60 +0 0 0 diff --git a/codenet/public_test_cases/p00232/output.0.txt b/codenet/public_test_cases/p00232/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38b77cbbb17be19b403b327a86b21ce6533bb410 --- /dev/null +++ b/codenet/public_test_cases/p00232/output.0.txt @@ -0,0 +1,5 @@ +0 +100 +0 +50 +20 diff --git a/codenet/public_test_cases/p00232/output.1.txt b/codenet/public_test_cases/p00232/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38b77cbbb17be19b403b327a86b21ce6533bb410 --- /dev/null +++ b/codenet/public_test_cases/p00232/output.1.txt @@ -0,0 +1,5 @@ +0 +100 +0 +50 +20 diff --git a/codenet/public_test_cases/p00233/input.0.txt b/codenet/public_test_cases/p00233/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b472cd6fc1fb35d10f6166b55964fac2ccc587c --- /dev/null +++ b/codenet/public_test_cases/p00233/input.0.txt @@ -0,0 +1,6 @@ +9 +10 +-10 +-1944 +-305432133 +0 diff --git a/codenet/public_test_cases/p00233/output.0.txt b/codenet/public_test_cases/p00233/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8ee002a6755e55c9e2738f0ec7f5562925d66f9 --- /dev/null +++ b/codenet/public_test_cases/p00233/output.0.txt @@ -0,0 +1,5 @@ +9 +190 +10 +2156 +1715573947 diff --git a/codenet/public_test_cases/p00234/input.0.txt b/codenet/public_test_cases/p00234/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74b819b109b1aaf62d99c061f891d9095192597c --- /dev/null +++ b/codenet/public_test_cases/p00234/input.0.txt @@ -0,0 +1,28 @@ +3 3 +100 10 10 +-100 -20 -100 +-100 -20 -100 +-100 -20 -100 +3 3 +100 10 10 +-100 -20 -100 +-100 -20 -20 +-100 -60 -20 +3 3 +100 10 3 +-100 -20 -100 +-20 -20 -20 +-20 -100 -20 +3 3 +100 3 3 +-100 -20 -30 +-100 -20 2 +-100 -20 -20 +4 5 +1500 5 4 +-10 -380 -250 -250 +-90 2 -80 8 +-250 -130 -330 -120 +-120 -40 -50 -20 +-250 -10 -20 -150 +0 0 diff --git a/codenet/public_test_cases/p00234/input.1.txt b/codenet/public_test_cases/p00234/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74b819b109b1aaf62d99c061f891d9095192597c --- /dev/null +++ b/codenet/public_test_cases/p00234/input.1.txt @@ -0,0 +1,28 @@ +3 3 +100 10 10 +-100 -20 -100 +-100 -20 -100 +-100 -20 -100 +3 3 +100 10 10 +-100 -20 -100 +-100 -20 -20 +-100 -60 -20 +3 3 +100 10 3 +-100 -20 -100 +-20 -20 -20 +-20 -100 -20 +3 3 +100 3 3 +-100 -20 -30 +-100 -20 2 +-100 -20 -20 +4 5 +1500 5 4 +-10 -380 -250 -250 +-90 2 -80 8 +-250 -130 -330 -120 +-120 -40 -50 -20 +-250 -10 -20 -150 +0 0 diff --git a/codenet/public_test_cases/p00234/output.0.txt b/codenet/public_test_cases/p00234/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da037dcfcb0d5366a87b1ca92076b444d6516d4f --- /dev/null +++ b/codenet/public_test_cases/p00234/output.0.txt @@ -0,0 +1,5 @@ +60 +80 +NA +50 +390 diff --git a/codenet/public_test_cases/p00234/output.1.txt b/codenet/public_test_cases/p00234/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..da037dcfcb0d5366a87b1ca92076b444d6516d4f --- /dev/null +++ b/codenet/public_test_cases/p00234/output.1.txt @@ -0,0 +1,5 @@ +60 +80 +NA +50 +390 diff --git a/codenet/public_test_cases/p00235/input.0.txt b/codenet/public_test_cases/p00235/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98245116c38f6981467cdc2007035521c2e3ddf6 --- /dev/null +++ b/codenet/public_test_cases/p00235/input.0.txt @@ -0,0 +1,8 @@ +7 +1 2 5 +2 3 2 +3 4 3 +2 5 3 +5 6 3 +5 7 8 +0 diff --git a/codenet/public_test_cases/p00235/input.1.txt b/codenet/public_test_cases/p00235/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98245116c38f6981467cdc2007035521c2e3ddf6 --- /dev/null +++ b/codenet/public_test_cases/p00235/input.1.txt @@ -0,0 +1,8 @@ +7 +1 2 5 +2 3 2 +3 4 3 +2 5 3 +5 6 3 +5 7 8 +0 diff --git a/codenet/public_test_cases/p00235/output.0.txt b/codenet/public_test_cases/p00235/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p00235/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p00235/output.1.txt b/codenet/public_test_cases/p00235/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p00235/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p00236/input.0.txt b/codenet/public_test_cases/p00236/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca4a6719243f6dd0d048ba9e1935759987979db3 --- /dev/null +++ b/codenet/public_test_cases/p00236/input.0.txt @@ -0,0 +1,11 @@ +5 4 +0 0 0 0 0 +0 1 1 0 0 +0 0 1 0 1 +1 0 0 0 1 +5 4 +0 0 0 0 0 +0 1 1 0 0 +0 0 0 0 1 +1 0 0 0 1 +0 0 diff --git a/codenet/public_test_cases/p00236/input.1.txt b/codenet/public_test_cases/p00236/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca4a6719243f6dd0d048ba9e1935759987979db3 --- /dev/null +++ b/codenet/public_test_cases/p00236/input.1.txt @@ -0,0 +1,11 @@ +5 4 +0 0 0 0 0 +0 1 1 0 0 +0 0 1 0 1 +1 0 0 0 1 +5 4 +0 0 0 0 0 +0 1 1 0 0 +0 0 0 0 1 +1 0 0 0 1 +0 0 diff --git a/codenet/public_test_cases/p00236/output.0.txt b/codenet/public_test_cases/p00236/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p00236/output.0.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p00236/output.1.txt b/codenet/public_test_cases/p00236/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p00236/output.1.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p00237/input.0.txt b/codenet/public_test_cases/p00237/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fa00dd16af6b80d92aca2388ddb1d79912e9496 --- /dev/null +++ b/codenet/public_test_cases/p00237/input.0.txt @@ -0,0 +1,9 @@ +3 4 +1 0 3 0 2 1 +2 3 2 5 3 4 +5 3 5 5 6 4 +3 2 +1 0 3 0 2 1 +2 3 2 5 3 4 +5 3 5 5 6 4 +0 0 diff --git a/codenet/public_test_cases/p00237/output.0.txt b/codenet/public_test_cases/p00237/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p00237/output.0.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p00238/input.0.txt b/codenet/public_test_cases/p00238/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2aaf99c832c6f78a69f2a62b7ae4cd79b5ef076b --- /dev/null +++ b/codenet/public_test_cases/p00238/input.0.txt @@ -0,0 +1,10 @@ +10 +3 +6 11 +12 15 +18 22 +14 +2 +6 11 +13 20 +0 diff --git a/codenet/public_test_cases/p00238/input.1.txt b/codenet/public_test_cases/p00238/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2aaf99c832c6f78a69f2a62b7ae4cd79b5ef076b --- /dev/null +++ b/codenet/public_test_cases/p00238/input.1.txt @@ -0,0 +1,10 @@ +10 +3 +6 11 +12 15 +18 22 +14 +2 +6 11 +13 20 +0 diff --git a/codenet/public_test_cases/p00238/output.0.txt b/codenet/public_test_cases/p00238/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d0eac0fe69f577a1ba16316a9c5397cc029faf4 --- /dev/null +++ b/codenet/public_test_cases/p00238/output.0.txt @@ -0,0 +1,2 @@ +OK +2 diff --git a/codenet/public_test_cases/p00238/output.1.txt b/codenet/public_test_cases/p00238/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d0eac0fe69f577a1ba16316a9c5397cc029faf4 --- /dev/null +++ b/codenet/public_test_cases/p00238/output.1.txt @@ -0,0 +1,2 @@ +OK +2 diff --git a/codenet/public_test_cases/p00239/input.0.txt b/codenet/public_test_cases/p00239/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60b732cf1039f04ade51709165b70b35629e7884 --- /dev/null +++ b/codenet/public_test_cases/p00239/input.0.txt @@ -0,0 +1,11 @@ +4 +1 7 14 47 +2 5 35 55 +3 6 3 59 +4 6 5 15 +10 15 50 400 +2 +1 8 10 78 +2 4 18 33 +10 10 50 300 +0 diff --git a/codenet/public_test_cases/p00239/input.1.txt b/codenet/public_test_cases/p00239/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60b732cf1039f04ade51709165b70b35629e7884 --- /dev/null +++ b/codenet/public_test_cases/p00239/input.1.txt @@ -0,0 +1,11 @@ +4 +1 7 14 47 +2 5 35 55 +3 6 3 59 +4 6 5 15 +10 15 50 400 +2 +1 8 10 78 +2 4 18 33 +10 10 50 300 +0 diff --git a/codenet/public_test_cases/p00239/output.0.txt b/codenet/public_test_cases/p00239/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..373867482e2a72a5b3620afd87a4518bd2e140aa --- /dev/null +++ b/codenet/public_test_cases/p00239/output.0.txt @@ -0,0 +1,3 @@ +1 +4 +NA diff --git a/codenet/public_test_cases/p00239/output.1.txt b/codenet/public_test_cases/p00239/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..373867482e2a72a5b3620afd87a4518bd2e140aa --- /dev/null +++ b/codenet/public_test_cases/p00239/output.1.txt @@ -0,0 +1,3 @@ +1 +4 +NA diff --git a/codenet/public_test_cases/p00240/input.0.txt b/codenet/public_test_cases/p00240/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a5a05fc176e482c3c0107fc1d04b31e7ad91e57 --- /dev/null +++ b/codenet/public_test_cases/p00240/input.0.txt @@ -0,0 +1,9 @@ +2 +8 +1 5 2 +2 6 1 +2 +9 +1 5 2 +2 6 1 +0 diff --git a/codenet/public_test_cases/p00240/input.1.txt b/codenet/public_test_cases/p00240/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a5a05fc176e482c3c0107fc1d04b31e7ad91e57 --- /dev/null +++ b/codenet/public_test_cases/p00240/input.1.txt @@ -0,0 +1,9 @@ +2 +8 +1 5 2 +2 6 1 +2 +9 +1 5 2 +2 6 1 +0 diff --git a/codenet/public_test_cases/p00240/output.0.txt b/codenet/public_test_cases/p00240/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p00240/output.0.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p00240/output.1.txt b/codenet/public_test_cases/p00240/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p00240/output.1.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p00241/input.0.txt b/codenet/public_test_cases/p00241/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63fe29b77023c1b2b8308592800e45d55f61fab2 --- /dev/null +++ b/codenet/public_test_cases/p00241/input.0.txt @@ -0,0 +1,4 @@ +2 +1 2 3 4 7 6 7 8 +5 6 7 8 3 2 3 4 +0 diff --git a/codenet/public_test_cases/p00241/input.1.txt b/codenet/public_test_cases/p00241/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63fe29b77023c1b2b8308592800e45d55f61fab2 --- /dev/null +++ b/codenet/public_test_cases/p00241/input.1.txt @@ -0,0 +1,4 @@ +2 +1 2 3 4 7 6 7 8 +5 6 7 8 3 2 3 4 +0 diff --git a/codenet/public_test_cases/p00241/output.0.txt b/codenet/public_test_cases/p00241/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3712e455314bbfddc3e42bfc9835d8c16f4acc55 --- /dev/null +++ b/codenet/public_test_cases/p00241/output.0.txt @@ -0,0 +1,2 @@ +-58 16 36 32 +-50 32 28 48 diff --git a/codenet/public_test_cases/p00241/output.1.txt b/codenet/public_test_cases/p00241/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3712e455314bbfddc3e42bfc9835d8c16f4acc55 --- /dev/null +++ b/codenet/public_test_cases/p00241/output.1.txt @@ -0,0 +1,2 @@ +-58 16 36 32 +-50 32 28 48 diff --git a/codenet/public_test_cases/p00242/input.0.txt b/codenet/public_test_cases/p00242/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..846af8ee988c02e4e49e9fc70859069c567fb49c --- /dev/null +++ b/codenet/public_test_cases/p00242/input.0.txt @@ -0,0 +1,16 @@ +1 +ben likes bananas the best among many fruits because bananas are sweet and cheap +b +1 +winners get to visit aizu and the university of aizu and make many friends as well +a +3 +ask alex about +the answer for the +assignment on android apps +a +2 +programming is both +a sport and an intellectual puzzle +c +0 diff --git a/codenet/public_test_cases/p00242/input.1.txt b/codenet/public_test_cases/p00242/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..846af8ee988c02e4e49e9fc70859069c567fb49c --- /dev/null +++ b/codenet/public_test_cases/p00242/input.1.txt @@ -0,0 +1,16 @@ +1 +ben likes bananas the best among many fruits because bananas are sweet and cheap +b +1 +winners get to visit aizu and the university of aizu and make many friends as well +a +3 +ask alex about +the answer for the +assignment on android apps +a +2 +programming is both +a sport and an intellectual puzzle +c +0 diff --git a/codenet/public_test_cases/p00242/output.0.txt b/codenet/public_test_cases/p00242/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c43a6c08621788afcd7e36cfba3a1ca517c27292 --- /dev/null +++ b/codenet/public_test_cases/p00242/output.0.txt @@ -0,0 +1,4 @@ +bananas because ben best +aizu and as +about alex android answer apps +NA diff --git a/codenet/public_test_cases/p00242/output.1.txt b/codenet/public_test_cases/p00242/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c43a6c08621788afcd7e36cfba3a1ca517c27292 --- /dev/null +++ b/codenet/public_test_cases/p00242/output.1.txt @@ -0,0 +1,4 @@ +bananas because ben best +aizu and as +about alex android answer apps +NA diff --git a/codenet/public_test_cases/p00243/input.0.txt b/codenet/public_test_cases/p00243/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..73338656425b4bb0b72e710d3a8e05d57486ab74 --- /dev/null +++ b/codenet/public_test_cases/p00243/input.0.txt @@ -0,0 +1,14 @@ +3 3 +R G B +G G G +G B B +2 4 +R G +G G +R B +B R +4 3 +G G B R +G R R G +B G G R +0 0 diff --git a/codenet/public_test_cases/p00243/input.1.txt b/codenet/public_test_cases/p00243/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..73338656425b4bb0b72e710d3a8e05d57486ab74 --- /dev/null +++ b/codenet/public_test_cases/p00243/input.1.txt @@ -0,0 +1,14 @@ +3 3 +R G B +G G G +G B B +2 4 +R G +G G +R B +B R +4 3 +G G B R +G R R G +B G G R +0 0 diff --git a/codenet/public_test_cases/p00243/output.0.txt b/codenet/public_test_cases/p00243/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c51a200abf8b097f48f1b334f950dce5eed776ba --- /dev/null +++ b/codenet/public_test_cases/p00243/output.0.txt @@ -0,0 +1,3 @@ +2 +4 +4 diff --git a/codenet/public_test_cases/p00243/output.1.txt b/codenet/public_test_cases/p00243/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c51a200abf8b097f48f1b334f950dce5eed776ba --- /dev/null +++ b/codenet/public_test_cases/p00243/output.1.txt @@ -0,0 +1,3 @@ +2 +4 +4 diff --git a/codenet/public_test_cases/p00244/input.0.txt b/codenet/public_test_cases/p00244/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de722433779b5fa16d7d924bf672fa170eb7621a --- /dev/null +++ b/codenet/public_test_cases/p00244/input.0.txt @@ -0,0 +1,16 @@ +2 1 +1 2 5 +3 2 +1 2 5 +2 3 5 +6 9 +1 2 7 +1 3 9 +1 5 14 +2 3 10 +2 4 15 +3 4 11 +3 5 2 +4 5 9 +4 6 8 +0 0 diff --git a/codenet/public_test_cases/p00244/input.1.txt b/codenet/public_test_cases/p00244/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de722433779b5fa16d7d924bf672fa170eb7621a --- /dev/null +++ b/codenet/public_test_cases/p00244/input.1.txt @@ -0,0 +1,16 @@ +2 1 +1 2 5 +3 2 +1 2 5 +2 3 5 +6 9 +1 2 7 +1 3 9 +1 5 14 +2 3 10 +2 4 15 +3 4 11 +3 5 2 +4 5 9 +4 6 8 +0 0 diff --git a/codenet/public_test_cases/p00244/output.0.txt b/codenet/public_test_cases/p00244/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c0fb2b7b4d4008b1f50e8061f41394a4868e76c --- /dev/null +++ b/codenet/public_test_cases/p00244/output.0.txt @@ -0,0 +1,3 @@ +5 +0 +7 diff --git a/codenet/public_test_cases/p00244/output.1.txt b/codenet/public_test_cases/p00244/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c0fb2b7b4d4008b1f50e8061f41394a4868e76c --- /dev/null +++ b/codenet/public_test_cases/p00244/output.1.txt @@ -0,0 +1,3 @@ +5 +0 +7 diff --git a/codenet/public_test_cases/p00245/input.0.txt b/codenet/public_test_cases/p00245/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8328abac96fa964310cb817f065c01b02d56ed35 --- /dev/null +++ b/codenet/public_test_cases/p00245/input.0.txt @@ -0,0 +1,13 @@ +6 5 +1 1 . 0 0 4 +1 . . . . . +. . 2 2 . . +. . 2 2 3 3 +P . . . . . +5 +0 50 5 10 +1 20 0 10 +2 10 5 15 +3 150 3 5 +4 100 8 9 +0 0 diff --git a/codenet/public_test_cases/p00245/input.1.txt b/codenet/public_test_cases/p00245/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8328abac96fa964310cb817f065c01b02d56ed35 --- /dev/null +++ b/codenet/public_test_cases/p00245/input.1.txt @@ -0,0 +1,13 @@ +6 5 +1 1 . 0 0 4 +1 . . . . . +. . 2 2 . . +. . 2 2 3 3 +P . . . . . +5 +0 50 5 10 +1 20 0 10 +2 10 5 15 +3 150 3 5 +4 100 8 9 +0 0 diff --git a/codenet/public_test_cases/p00245/output.0.txt b/codenet/public_test_cases/p00245/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3af99eeec11bbfeb1fc5514129c2cd6e97503dbd --- /dev/null +++ b/codenet/public_test_cases/p00245/output.0.txt @@ -0,0 +1 @@ +180 diff --git a/codenet/public_test_cases/p00245/output.1.txt b/codenet/public_test_cases/p00245/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3af99eeec11bbfeb1fc5514129c2cd6e97503dbd --- /dev/null +++ b/codenet/public_test_cases/p00245/output.1.txt @@ -0,0 +1 @@ +180 diff --git a/codenet/public_test_cases/p00246/input.0.txt b/codenet/public_test_cases/p00246/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..006cf18ad90cb5daac383bd52d26fbfc21b10fac --- /dev/null +++ b/codenet/public_test_cases/p00246/input.0.txt @@ -0,0 +1,7 @@ +5 +4 9 1 3 8 +10 +8 5 3 6 2 1 4 5 4 5 +9 +5 7 3 8 2 9 6 4 1 +0 diff --git a/codenet/public_test_cases/p00246/input.1.txt b/codenet/public_test_cases/p00246/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..006cf18ad90cb5daac383bd52d26fbfc21b10fac --- /dev/null +++ b/codenet/public_test_cases/p00246/input.1.txt @@ -0,0 +1,7 @@ +5 +4 9 1 3 8 +10 +8 5 3 6 2 1 4 5 4 5 +9 +5 7 3 8 2 9 6 4 1 +0 diff --git a/codenet/public_test_cases/p00246/output.0.txt b/codenet/public_test_cases/p00246/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0530f9af2d4deeab751b87dcb554996f1d5cec62 --- /dev/null +++ b/codenet/public_test_cases/p00246/output.0.txt @@ -0,0 +1,3 @@ +1 +4 +4 diff --git a/codenet/public_test_cases/p00246/output.1.txt b/codenet/public_test_cases/p00246/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0530f9af2d4deeab751b87dcb554996f1d5cec62 --- /dev/null +++ b/codenet/public_test_cases/p00246/output.1.txt @@ -0,0 +1,3 @@ +1 +4 +4 diff --git a/codenet/public_test_cases/p00247/input.0.txt b/codenet/public_test_cases/p00247/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..07726b548427060c41c81eccc5fd2f845ecd9a05 --- /dev/null +++ b/codenet/public_test_cases/p00247/input.0.txt @@ -0,0 +1,27 @@ +5 5 +.X.S. +.X#.. +.XX## +.#XG. +..X.. +7 3 +SXX.XXG +X.#.#X. +XXX.XX# +4 4 +S... +X.X. +GX.. +...X +10 10 +..XXXXX.XX +.X.#.#X.XX +SX.#X.X..X +#X.##.X.XX +..XXXX#.XX +##.##.##XX +....X.XX#X +.##X..#X#X +....XX#..X +...#XXG..X +0 0 diff --git a/codenet/public_test_cases/p00247/input.1.txt b/codenet/public_test_cases/p00247/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..07726b548427060c41c81eccc5fd2f845ecd9a05 --- /dev/null +++ b/codenet/public_test_cases/p00247/input.1.txt @@ -0,0 +1,27 @@ +5 5 +.X.S. +.X#.. +.XX## +.#XG. +..X.. +7 3 +SXX.XXG +X.#.#X. +XXX.XX# +4 4 +S... +X.X. +GX.. +...X +10 10 +..XXXXX.XX +.X.#.#X.XX +SX.#X.X..X +#X.##.X.XX +..XXXX#.XX +##.##.##XX +....X.XX#X +.##X..#X#X +....XX#..X +...#XXG..X +0 0 diff --git a/codenet/public_test_cases/p00247/output.0.txt b/codenet/public_test_cases/p00247/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9e79789d3a490262d32ca073adb84b44ee83683 --- /dev/null +++ b/codenet/public_test_cases/p00247/output.0.txt @@ -0,0 +1,4 @@ +11 +10 +10 +33 diff --git a/codenet/public_test_cases/p00247/output.1.txt b/codenet/public_test_cases/p00247/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9e79789d3a490262d32ca073adb84b44ee83683 --- /dev/null +++ b/codenet/public_test_cases/p00247/output.1.txt @@ -0,0 +1,4 @@ +11 +10 +10 +33 diff --git a/codenet/public_test_cases/p00248/input.0.txt b/codenet/public_test_cases/p00248/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa051eb75045fcb3461261580ca855ce7190723b --- /dev/null +++ b/codenet/public_test_cases/p00248/input.0.txt @@ -0,0 +1,14 @@ +5 4 +1 2 +2 3 +3 4 +4 5 +4 6 +1 2 +1 3 +1 4 +2 3 +2 4 +3 4 +5 0 +0 0 diff --git a/codenet/public_test_cases/p00248/input.1.txt b/codenet/public_test_cases/p00248/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa051eb75045fcb3461261580ca855ce7190723b --- /dev/null +++ b/codenet/public_test_cases/p00248/input.1.txt @@ -0,0 +1,14 @@ +5 4 +1 2 +2 3 +3 4 +4 5 +4 6 +1 2 +1 3 +1 4 +2 3 +2 4 +3 4 +5 0 +0 0 diff --git a/codenet/public_test_cases/p00248/output.0.txt b/codenet/public_test_cases/p00248/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7be48c9686901a95c814c024e067e247fdd0e34f --- /dev/null +++ b/codenet/public_test_cases/p00248/output.0.txt @@ -0,0 +1,3 @@ +yes +no +yes diff --git a/codenet/public_test_cases/p00248/output.1.txt b/codenet/public_test_cases/p00248/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7be48c9686901a95c814c024e067e247fdd0e34f --- /dev/null +++ b/codenet/public_test_cases/p00248/output.1.txt @@ -0,0 +1,3 @@ +yes +no +yes diff --git a/codenet/public_test_cases/p00249/input.0.txt b/codenet/public_test_cases/p00249/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..938eda8e95c862af09887f3ae2079f1ed5a43f44 --- /dev/null +++ b/codenet/public_test_cases/p00249/input.0.txt @@ -0,0 +1,6 @@ +4 1 1 +0 0 +1 0 +1 2 +0 2 +0 0 0 diff --git a/codenet/public_test_cases/p00249/input.1.txt b/codenet/public_test_cases/p00249/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..938eda8e95c862af09887f3ae2079f1ed5a43f44 --- /dev/null +++ b/codenet/public_test_cases/p00249/input.1.txt @@ -0,0 +1,6 @@ +4 1 1 +0 0 +1 0 +1 2 +0 2 +0 0 0 diff --git a/codenet/public_test_cases/p00249/output.0.txt b/codenet/public_test_cases/p00249/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..961b372472a1809353ba4658ea88ca265d88b75c --- /dev/null +++ b/codenet/public_test_cases/p00249/output.0.txt @@ -0,0 +1 @@ +1.000000 diff --git a/codenet/public_test_cases/p00249/output.1.txt b/codenet/public_test_cases/p00249/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..961b372472a1809353ba4658ea88ca265d88b75c --- /dev/null +++ b/codenet/public_test_cases/p00249/output.1.txt @@ -0,0 +1 @@ +1.000000 diff --git a/codenet/public_test_cases/p00250/input.0.txt b/codenet/public_test_cases/p00250/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4890341e4b09a1db3a6d170e44fcec0503cc8546 --- /dev/null +++ b/codenet/public_test_cases/p00250/input.0.txt @@ -0,0 +1,11 @@ +5 11 +11 27 34 45 56 +8 5 +0 2 1 5 4 6 8 3 +5 2 +2 4 2 4 6 +10 18 +10 15 12 31 12 50 11 23 43 181 +1 100 +5 +0 0 diff --git a/codenet/public_test_cases/p00250/input.1.txt b/codenet/public_test_cases/p00250/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4890341e4b09a1db3a6d170e44fcec0503cc8546 --- /dev/null +++ b/codenet/public_test_cases/p00250/input.1.txt @@ -0,0 +1,11 @@ +5 11 +11 27 34 45 56 +8 5 +0 2 1 5 4 6 8 3 +5 2 +2 4 2 4 6 +10 18 +10 15 12 31 12 50 11 23 43 181 +1 100 +5 +0 0 diff --git a/codenet/public_test_cases/p00250/output.0.txt b/codenet/public_test_cases/p00250/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..643ca93c0b83ccd53632c83cf05e7d37bcf4dffb --- /dev/null +++ b/codenet/public_test_cases/p00250/output.0.txt @@ -0,0 +1,5 @@ +8 +4 +0 +17 +5 diff --git a/codenet/public_test_cases/p00250/output.1.txt b/codenet/public_test_cases/p00250/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..643ca93c0b83ccd53632c83cf05e7d37bcf4dffb --- /dev/null +++ b/codenet/public_test_cases/p00250/output.1.txt @@ -0,0 +1,5 @@ +8 +4 +0 +17 +5 diff --git a/codenet/public_test_cases/p00251/input.0.txt b/codenet/public_test_cases/p00251/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00c965d8307308469e537302baa73048488f162 --- /dev/null +++ b/codenet/public_test_cases/p00251/input.0.txt @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/codenet/public_test_cases/p00251/input.1.txt b/codenet/public_test_cases/p00251/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00c965d8307308469e537302baa73048488f162 --- /dev/null +++ b/codenet/public_test_cases/p00251/input.1.txt @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/codenet/public_test_cases/p00251/output.0.txt b/codenet/public_test_cases/p00251/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3f407c0955bb5738e40a82664c79b63f04a9adb --- /dev/null +++ b/codenet/public_test_cases/p00251/output.0.txt @@ -0,0 +1 @@ +55 diff --git a/codenet/public_test_cases/p00251/output.1.txt b/codenet/public_test_cases/p00251/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3f407c0955bb5738e40a82664c79b63f04a9adb --- /dev/null +++ b/codenet/public_test_cases/p00251/output.1.txt @@ -0,0 +1 @@ +55 diff --git a/codenet/public_test_cases/p00252/input.0.txt b/codenet/public_test_cases/p00252/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..398641ed77732ea1055eccf06e7e4f6c00b7da49 --- /dev/null +++ b/codenet/public_test_cases/p00252/input.0.txt @@ -0,0 +1 @@ +0 0 1 diff --git a/codenet/public_test_cases/p00252/input.1.txt b/codenet/public_test_cases/p00252/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..398641ed77732ea1055eccf06e7e4f6c00b7da49 --- /dev/null +++ b/codenet/public_test_cases/p00252/input.1.txt @@ -0,0 +1 @@ +0 0 1 diff --git a/codenet/public_test_cases/p00252/output.0.txt b/codenet/public_test_cases/p00252/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4b3a5fc6b58011164567d0650635d78701d52 --- /dev/null +++ b/codenet/public_test_cases/p00252/output.0.txt @@ -0,0 +1 @@ +Open diff --git a/codenet/public_test_cases/p00252/output.1.txt b/codenet/public_test_cases/p00252/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4b3a5fc6b58011164567d0650635d78701d52 --- /dev/null +++ b/codenet/public_test_cases/p00252/output.1.txt @@ -0,0 +1 @@ +Open diff --git a/codenet/public_test_cases/p00253/input.0.txt b/codenet/public_test_cases/p00253/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f0eebed9aae470df401d1a75b041f5a50554b3f --- /dev/null +++ b/codenet/public_test_cases/p00253/input.0.txt @@ -0,0 +1,7 @@ +5 +1 2 3 6 4 5 +6 +1 3 6 9 12 15 18 +4 +5 7 9 11 12 +0 diff --git a/codenet/public_test_cases/p00253/input.1.txt b/codenet/public_test_cases/p00253/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f0eebed9aae470df401d1a75b041f5a50554b3f --- /dev/null +++ b/codenet/public_test_cases/p00253/input.1.txt @@ -0,0 +1,7 @@ +5 +1 2 3 6 4 5 +6 +1 3 6 9 12 15 18 +4 +5 7 9 11 12 +0 diff --git a/codenet/public_test_cases/p00253/output.0.txt b/codenet/public_test_cases/p00253/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a69573684859c9ca7a518d2eb8803395e881afed --- /dev/null +++ b/codenet/public_test_cases/p00253/output.0.txt @@ -0,0 +1,3 @@ +6 +1 +12 diff --git a/codenet/public_test_cases/p00253/output.1.txt b/codenet/public_test_cases/p00253/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a69573684859c9ca7a518d2eb8803395e881afed --- /dev/null +++ b/codenet/public_test_cases/p00253/output.1.txt @@ -0,0 +1,3 @@ +6 +1 +12 diff --git a/codenet/public_test_cases/p00254/input.0.txt b/codenet/public_test_cases/p00254/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea6d4fd7fe9da9bc10ce00d7f137103f369afed0 --- /dev/null +++ b/codenet/public_test_cases/p00254/input.0.txt @@ -0,0 +1,4 @@ +6174 +2012 +3333 +0000 diff --git a/codenet/public_test_cases/p00254/input.1.txt b/codenet/public_test_cases/p00254/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea6d4fd7fe9da9bc10ce00d7f137103f369afed0 --- /dev/null +++ b/codenet/public_test_cases/p00254/input.1.txt @@ -0,0 +1,4 @@ +6174 +2012 +3333 +0000 diff --git a/codenet/public_test_cases/p00254/output.0.txt b/codenet/public_test_cases/p00254/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fca0e4f4fba14cbd1a35924df3ae60598794f08 --- /dev/null +++ b/codenet/public_test_cases/p00254/output.0.txt @@ -0,0 +1,3 @@ +0 +3 +NA diff --git a/codenet/public_test_cases/p00254/output.1.txt b/codenet/public_test_cases/p00254/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fca0e4f4fba14cbd1a35924df3ae60598794f08 --- /dev/null +++ b/codenet/public_test_cases/p00254/output.1.txt @@ -0,0 +1,3 @@ +0 +3 +NA diff --git a/codenet/public_test_cases/p00255/input.0.txt b/codenet/public_test_cases/p00255/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..06c9be5d230b7611531e996600b44caee6adddc3 --- /dev/null +++ b/codenet/public_test_cases/p00255/input.0.txt @@ -0,0 +1,10 @@ +3 +1 1 1 +3 3 +4 +3 3 3 3 +1 1 1 +5 +1 2 3 4 5 +4 3 2 1 +0 diff --git a/codenet/public_test_cases/p00255/input.1.txt b/codenet/public_test_cases/p00255/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..06c9be5d230b7611531e996600b44caee6adddc3 --- /dev/null +++ b/codenet/public_test_cases/p00255/input.1.txt @@ -0,0 +1,10 @@ +3 +1 1 1 +3 3 +4 +3 3 3 3 +1 1 1 +5 +1 2 3 4 5 +4 3 2 1 +0 diff --git a/codenet/public_test_cases/p00255/output.0.txt b/codenet/public_test_cases/p00255/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99ea6f78a28a66b460aae627bab6cc3db87be292 --- /dev/null +++ b/codenet/public_test_cases/p00255/output.0.txt @@ -0,0 +1,3 @@ +12 +48 +76 diff --git a/codenet/public_test_cases/p00255/output.1.txt b/codenet/public_test_cases/p00255/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99ea6f78a28a66b460aae627bab6cc3db87be292 --- /dev/null +++ b/codenet/public_test_cases/p00255/output.1.txt @@ -0,0 +1,3 @@ +12 +48 +76 diff --git a/codenet/public_test_cases/p00256/input.0.txt b/codenet/public_test_cases/p00256/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaeef18c55e41f7c1de9bb87c71fa3dde9faa810 --- /dev/null +++ b/codenet/public_test_cases/p00256/input.0.txt @@ -0,0 +1,6 @@ +2012.12.31 +2.12.16.14.14 +7138.5.13 +10.5.2.1.5 +10000000.12.31 +# diff --git a/codenet/public_test_cases/p00256/input.1.txt b/codenet/public_test_cases/p00256/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaeef18c55e41f7c1de9bb87c71fa3dde9faa810 --- /dev/null +++ b/codenet/public_test_cases/p00256/input.1.txt @@ -0,0 +1,6 @@ +2012.12.31 +2.12.16.14.14 +7138.5.13 +10.5.2.1.5 +10000000.12.31 +# diff --git a/codenet/public_test_cases/p00256/output.0.txt b/codenet/public_test_cases/p00256/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ecb1865b880534c9444870de71e3bd163f2a9ef --- /dev/null +++ b/codenet/public_test_cases/p00256/output.0.txt @@ -0,0 +1,5 @@ +0.0.0.0.10 +3054.8.15 +0.0.0.0.10 +6056.2.29 +8.19.3.13.2 diff --git a/codenet/public_test_cases/p00256/output.1.txt b/codenet/public_test_cases/p00256/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ecb1865b880534c9444870de71e3bd163f2a9ef --- /dev/null +++ b/codenet/public_test_cases/p00256/output.1.txt @@ -0,0 +1,5 @@ +0.0.0.0.10 +3054.8.15 +0.0.0.0.10 +6056.2.29 +8.19.3.13.2 diff --git a/codenet/public_test_cases/p00257/input.0.txt b/codenet/public_test_cases/p00257/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f3e1839abb28103e4337bde313f3ce123047f4f --- /dev/null +++ b/codenet/public_test_cases/p00257/input.0.txt @@ -0,0 +1,16 @@ +3 +3 +-2 +1 +0 +2 +4 +2 +0 +-1 +-2 +2 +2 +-2 +-2 +0 diff --git a/codenet/public_test_cases/p00257/input.1.txt b/codenet/public_test_cases/p00257/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f3e1839abb28103e4337bde313f3ce123047f4f --- /dev/null +++ b/codenet/public_test_cases/p00257/input.1.txt @@ -0,0 +1,16 @@ +3 +3 +-2 +1 +0 +2 +4 +2 +0 +-1 +-2 +2 +2 +-2 +-2 +0 diff --git a/codenet/public_test_cases/p00257/output.0.txt b/codenet/public_test_cases/p00257/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8043f04a5582bd24242d90512db32497b076dd3a --- /dev/null +++ b/codenet/public_test_cases/p00257/output.0.txt @@ -0,0 +1,3 @@ +OK +NG +NG diff --git a/codenet/public_test_cases/p00257/output.1.txt b/codenet/public_test_cases/p00257/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8043f04a5582bd24242d90512db32497b076dd3a --- /dev/null +++ b/codenet/public_test_cases/p00257/output.1.txt @@ -0,0 +1,3 @@ +OK +NG +NG diff --git a/codenet/public_test_cases/p00258/input.0.txt b/codenet/public_test_cases/p00258/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8afbbcc2442bca8d49f7adce8976473a122311ca --- /dev/null +++ b/codenet/public_test_cases/p00258/input.0.txt @@ -0,0 +1,20 @@ +2 2 +0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 +1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 +0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 +1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 +2 2 +0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0 +0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 +0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 +0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 +5 3 +0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 +1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 +0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 +0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 +0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 +0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 +1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 +0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 +0 0 diff --git a/codenet/public_test_cases/p00258/input.1.txt b/codenet/public_test_cases/p00258/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8afbbcc2442bca8d49f7adce8976473a122311ca --- /dev/null +++ b/codenet/public_test_cases/p00258/input.1.txt @@ -0,0 +1,20 @@ +2 2 +0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 +1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 +0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 +1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 +2 2 +0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0 +0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 +0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 +0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 +5 3 +0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 +1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 +0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 +0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 +0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 +0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 +1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 +0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 +0 0 diff --git a/codenet/public_test_cases/p00258/output.0.txt b/codenet/public_test_cases/p00258/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14e430a2cb9df75d09eb5dca18ffff498d4af8dd --- /dev/null +++ b/codenet/public_test_cases/p00258/output.0.txt @@ -0,0 +1,3 @@ +8 +7 +16 diff --git a/codenet/public_test_cases/p00258/output.1.txt b/codenet/public_test_cases/p00258/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14e430a2cb9df75d09eb5dca18ffff498d4af8dd --- /dev/null +++ b/codenet/public_test_cases/p00258/output.1.txt @@ -0,0 +1,3 @@ +8 +7 +16 diff --git a/codenet/public_test_cases/p00259/input.0.txt b/codenet/public_test_cases/p00259/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52ee7263294e5158c1449663adc2379ad2f79b8c --- /dev/null +++ b/codenet/public_test_cases/p00259/input.0.txt @@ -0,0 +1,6 @@ +5: 2 - 3 +17: 1 + 3 * (2 + 3 / 5 * 2) + 7 +11: 1 / 8 - 5 - 8 * 2 +19: 8 / (2 - 3 * 7) +1153: 10 * 3 / 7 + ( 50 + 81 / 22 ) + 11 +0: diff --git a/codenet/public_test_cases/p00259/input.1.txt b/codenet/public_test_cases/p00259/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..52ee7263294e5158c1449663adc2379ad2f79b8c --- /dev/null +++ b/codenet/public_test_cases/p00259/input.1.txt @@ -0,0 +1,6 @@ +5: 2 - 3 +17: 1 + 3 * (2 + 3 / 5 * 2) + 7 +11: 1 / 8 - 5 - 8 * 2 +19: 8 / (2 - 3 * 7) +1153: 10 * 3 / 7 + ( 50 + 81 / 22 ) + 11 +0: diff --git a/codenet/public_test_cases/p00259/output.0.txt b/codenet/public_test_cases/p00259/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94590361c3113c6d0e2478789afb8f1eedba8e08 --- /dev/null +++ b/codenet/public_test_cases/p00259/output.0.txt @@ -0,0 +1,5 @@ +2-3 = 4 (mod 5) +1+3*(2+3/5*2)+7 = 4 (mod 17) +1/8-5-8*2 = 8 (mod 11) +NG +10*3/7+(50+81/22)+11 = 915 (mod 1153) diff --git a/codenet/public_test_cases/p00259/output.1.txt b/codenet/public_test_cases/p00259/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94590361c3113c6d0e2478789afb8f1eedba8e08 --- /dev/null +++ b/codenet/public_test_cases/p00259/output.1.txt @@ -0,0 +1,5 @@ +2-3 = 4 (mod 5) +1+3*(2+3/5*2)+7 = 4 (mod 17) +1/8-5-8*2 = 8 (mod 11) +NG +10*3/7+(50+81/22)+11 = 915 (mod 1153) diff --git a/codenet/public_test_cases/p00260/input.0.txt b/codenet/public_test_cases/p00260/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd16d410a4ef3a7faa5491d9c90f24ae89b53af4 --- /dev/null +++ b/codenet/public_test_cases/p00260/input.0.txt @@ -0,0 +1,19 @@ +8 +0 0 +3 2 +6 2 +8 6 +6 5 +7 7 +0 4 +3 4 +8 +0 0 +5 3 +5 2 +4 1 +6 1 +8 6 +6 4 +2 4 +0 diff --git a/codenet/public_test_cases/p00260/input.1.txt b/codenet/public_test_cases/p00260/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd16d410a4ef3a7faa5491d9c90f24ae89b53af4 --- /dev/null +++ b/codenet/public_test_cases/p00260/input.1.txt @@ -0,0 +1,19 @@ +8 +0 0 +3 2 +6 2 +8 6 +6 5 +7 7 +0 4 +3 4 +8 +0 0 +5 3 +5 2 +4 1 +6 1 +8 6 +6 4 +2 4 +0 diff --git a/codenet/public_test_cases/p00260/output.0.txt b/codenet/public_test_cases/p00260/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p00260/output.0.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p00260/output.1.txt b/codenet/public_test_cases/p00260/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p00260/output.1.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p00261/input.0.txt b/codenet/public_test_cases/p00261/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c416a00a0b0e44c67b7bbf0adf2e22418f853e9 --- /dev/null +++ b/codenet/public_test_cases/p00261/input.0.txt @@ -0,0 +1,8 @@ +0100 +0101 +10100 +01000 +0101011 +0011 +011111 +# diff --git a/codenet/public_test_cases/p00261/input.1.txt b/codenet/public_test_cases/p00261/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c416a00a0b0e44c67b7bbf0adf2e22418f853e9 --- /dev/null +++ b/codenet/public_test_cases/p00261/input.1.txt @@ -0,0 +1,8 @@ +0100 +0101 +10100 +01000 +0101011 +0011 +011111 +# diff --git a/codenet/public_test_cases/p00261/output.0.txt b/codenet/public_test_cases/p00261/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eef9da8aa14fb0604fa84ccf45666c8d82c1760 --- /dev/null +++ b/codenet/public_test_cases/p00261/output.0.txt @@ -0,0 +1,7 @@ +Yes +No +Yes +No +Yes +No +Yes diff --git a/codenet/public_test_cases/p00261/output.1.txt b/codenet/public_test_cases/p00261/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eef9da8aa14fb0604fa84ccf45666c8d82c1760 --- /dev/null +++ b/codenet/public_test_cases/p00261/output.1.txt @@ -0,0 +1,7 @@ +Yes +No +Yes +No +Yes +No +Yes diff --git a/codenet/public_test_cases/p00262/input.0.txt b/codenet/public_test_cases/p00262/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c723e0d23549d79d0855ec3237d97e57dca93401 --- /dev/null +++ b/codenet/public_test_cases/p00262/input.0.txt @@ -0,0 +1,15 @@ +6 +1 4 1 3 2 4 +5 +1 2 3 4 5 +10 +1 1 1 1 1 1 1 1 1 1 +9 +1 1 1 1 1 1 1 1 1 +12 +1 4 1 3 2 4 3 3 2 1 2 2 +1 +5050 +3 +10000 10000 100 +0 diff --git a/codenet/public_test_cases/p00262/input.1.txt b/codenet/public_test_cases/p00262/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c723e0d23549d79d0855ec3237d97e57dca93401 --- /dev/null +++ b/codenet/public_test_cases/p00262/input.1.txt @@ -0,0 +1,15 @@ +6 +1 4 1 3 2 4 +5 +1 2 3 4 5 +10 +1 1 1 1 1 1 1 1 1 1 +9 +1 1 1 1 1 1 1 1 1 +12 +1 4 1 3 2 4 3 3 2 1 2 2 +1 +5050 +3 +10000 10000 100 +0 diff --git a/codenet/public_test_cases/p00262/output.0.txt b/codenet/public_test_cases/p00262/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78a662b6cc1715e8670339c2debcbbe4ed1c1954 --- /dev/null +++ b/codenet/public_test_cases/p00262/output.0.txt @@ -0,0 +1,7 @@ +24 +0 +10 +-1 +48 +5049 +-1 diff --git a/codenet/public_test_cases/p00262/output.1.txt b/codenet/public_test_cases/p00262/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78a662b6cc1715e8670339c2debcbbe4ed1c1954 --- /dev/null +++ b/codenet/public_test_cases/p00262/output.1.txt @@ -0,0 +1,7 @@ +24 +0 +10 +-1 +48 +5049 +-1 diff --git a/codenet/public_test_cases/p00263/input.0.txt b/codenet/public_test_cases/p00263/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d761c75f1cdb55342db90318d2b190f52fac110c --- /dev/null +++ b/codenet/public_test_cases/p00263/input.0.txt @@ -0,0 +1,9 @@ +8 +00000000 +80000000 +00000080 +00000040 +000000c0 +00000100 +80000780 +80000f70 diff --git a/codenet/public_test_cases/p00263/input.1.txt b/codenet/public_test_cases/p00263/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d761c75f1cdb55342db90318d2b190f52fac110c --- /dev/null +++ b/codenet/public_test_cases/p00263/input.1.txt @@ -0,0 +1,9 @@ +8 +00000000 +80000000 +00000080 +00000040 +000000c0 +00000100 +80000780 +80000f70 diff --git a/codenet/public_test_cases/p00263/output.0.txt b/codenet/public_test_cases/p00263/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b21d924925865b01418b8a1f690c694050fb76b --- /dev/null +++ b/codenet/public_test_cases/p00263/output.0.txt @@ -0,0 +1,8 @@ +0.0 +-0.0 +1.0 +0.5 +1.5 +2.0 +-15.0 +-30.875 diff --git a/codenet/public_test_cases/p00263/output.1.txt b/codenet/public_test_cases/p00263/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b21d924925865b01418b8a1f690c694050fb76b --- /dev/null +++ b/codenet/public_test_cases/p00263/output.1.txt @@ -0,0 +1,8 @@ +0.0 +-0.0 +1.0 +0.5 +1.5 +2.0 +-15.0 +-30.875 diff --git a/codenet/public_test_cases/p00264/input.0.txt b/codenet/public_test_cases/p00264/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..687508692e7de90ad940c835a2ffe1a7714e238d --- /dev/null +++ b/codenet/public_test_cases/p00264/input.0.txt @@ -0,0 +1,22 @@ +6 3 +2 1 +1 2 +5 2 +1 3 +1 5 +-2 3 +1 1 1 90 30 45 +3 -4 +-3 0 +2 -2 +45 6 +90 6 +135 6 +2 1 +1 3 +5 2 +0 1 1 90 30 45 +-3 0 +2 -2 +45 6 +0 0 diff --git a/codenet/public_test_cases/p00264/input.1.txt b/codenet/public_test_cases/p00264/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..687508692e7de90ad940c835a2ffe1a7714e238d --- /dev/null +++ b/codenet/public_test_cases/p00264/input.1.txt @@ -0,0 +1,22 @@ +6 3 +2 1 +1 2 +5 2 +1 3 +1 5 +-2 3 +1 1 1 90 30 45 +3 -4 +-3 0 +2 -2 +45 6 +90 6 +135 6 +2 1 +1 3 +5 2 +0 1 1 90 30 45 +-3 0 +2 -2 +45 6 +0 0 diff --git a/codenet/public_test_cases/p00264/output.0.txt b/codenet/public_test_cases/p00264/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1570fe4e8e87a053e6a739dcdc1ddb5bceaac43 --- /dev/null +++ b/codenet/public_test_cases/p00264/output.0.txt @@ -0,0 +1,2 @@ +5 6 +NA diff --git a/codenet/public_test_cases/p00264/output.1.txt b/codenet/public_test_cases/p00264/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1570fe4e8e87a053e6a739dcdc1ddb5bceaac43 --- /dev/null +++ b/codenet/public_test_cases/p00264/output.1.txt @@ -0,0 +1,2 @@ +5 6 +NA diff --git a/codenet/public_test_cases/p00265/input.0.txt b/codenet/public_test_cases/p00265/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..57f2f5164731bedf90e2f405a9723ef98573b269 --- /dev/null +++ b/codenet/public_test_cases/p00265/input.0.txt @@ -0,0 +1,5 @@ +3 3 +9 3 8 +4 +6 +5 diff --git a/codenet/public_test_cases/p00265/input.1.txt b/codenet/public_test_cases/p00265/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57f2f5164731bedf90e2f405a9723ef98573b269 --- /dev/null +++ b/codenet/public_test_cases/p00265/input.1.txt @@ -0,0 +1,5 @@ +3 3 +9 3 8 +4 +6 +5 diff --git a/codenet/public_test_cases/p00265/output.0.txt b/codenet/public_test_cases/p00265/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27f13770c2ea9090aa27fae95d3824849f7c0592 --- /dev/null +++ b/codenet/public_test_cases/p00265/output.0.txt @@ -0,0 +1,3 @@ +3 +3 +4 diff --git a/codenet/public_test_cases/p00265/output.1.txt b/codenet/public_test_cases/p00265/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27f13770c2ea9090aa27fae95d3824849f7c0592 --- /dev/null +++ b/codenet/public_test_cases/p00265/output.1.txt @@ -0,0 +1,3 @@ +3 +3 +4 diff --git a/codenet/public_test_cases/p00266/input.0.txt b/codenet/public_test_cases/p00266/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bbc44b5af5fa3007be46dfc5e8345fb3341c8de --- /dev/null +++ b/codenet/public_test_cases/p00266/input.0.txt @@ -0,0 +1,9 @@ +3 +2 +1 2 +2 3 +4 +2 +2 3 +2 4 +0 diff --git a/codenet/public_test_cases/p00266/input.1.txt b/codenet/public_test_cases/p00266/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bbc44b5af5fa3007be46dfc5e8345fb3341c8de --- /dev/null +++ b/codenet/public_test_cases/p00266/input.1.txt @@ -0,0 +1,9 @@ +3 +2 +1 2 +2 3 +4 +2 +2 3 +2 4 +0 diff --git a/codenet/public_test_cases/p00266/output.0.txt b/codenet/public_test_cases/p00266/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b94473479cd96f84ea5fdd389a9f4f9d3786b8c1 --- /dev/null +++ b/codenet/public_test_cases/p00266/output.0.txt @@ -0,0 +1,2 @@ +3 +4 diff --git a/codenet/public_test_cases/p00266/output.1.txt b/codenet/public_test_cases/p00266/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b94473479cd96f84ea5fdd389a9f4f9d3786b8c1 --- /dev/null +++ b/codenet/public_test_cases/p00266/output.1.txt @@ -0,0 +1,2 @@ +3 +4 diff --git a/codenet/public_test_cases/p00267/input.0.txt b/codenet/public_test_cases/p00267/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..617a254a76e12e64b6e0d30c5454b07e252e7e6c --- /dev/null +++ b/codenet/public_test_cases/p00267/input.0.txt @@ -0,0 +1,10 @@ +10 +4 9 1 9 5 9 2 3 2 1 +8 7 6 5 10 5 5 4 7 6 +5 +4 3 2 5 1 +4 4 4 4 4 +4 +4 1 3 2 +4 3 2 1 +0 diff --git a/codenet/public_test_cases/p00267/input.1.txt b/codenet/public_test_cases/p00267/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..617a254a76e12e64b6e0d30c5454b07e252e7e6c --- /dev/null +++ b/codenet/public_test_cases/p00267/input.1.txt @@ -0,0 +1,10 @@ +10 +4 9 1 9 5 9 2 3 2 1 +8 7 6 5 10 5 5 4 7 6 +5 +4 3 2 5 1 +4 4 4 4 4 +4 +4 1 3 2 +4 3 2 1 +0 diff --git a/codenet/public_test_cases/p00267/output.0.txt b/codenet/public_test_cases/p00267/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38678021acf0c9bd6aed36c1987701546f9fe10a --- /dev/null +++ b/codenet/public_test_cases/p00267/output.0.txt @@ -0,0 +1,3 @@ +3 +1 +NA diff --git a/codenet/public_test_cases/p00267/output.1.txt b/codenet/public_test_cases/p00267/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38678021acf0c9bd6aed36c1987701546f9fe10a --- /dev/null +++ b/codenet/public_test_cases/p00267/output.1.txt @@ -0,0 +1,3 @@ +3 +1 +NA diff --git a/codenet/public_test_cases/p00268/input.0.txt b/codenet/public_test_cases/p00268/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61603df64ac2e4b2626d464b0099aafd4d35325 --- /dev/null +++ b/codenet/public_test_cases/p00268/input.0.txt @@ -0,0 +1,45 @@ +4 4 +0 0 +1 0 +1 1 +0 1 +1 2 +1 4 +2 3 +3 4 +12 22 +2 0 +4 0 +8 0 +4 2 +6 2 +8 2 +2 4 +4 4 +6 4 +0 6 +8 6 +0 8 +1 2 +2 3 +1 4 +1 7 +1 10 +2 4 +2 5 +3 5 +3 6 +4 5 +4 8 +5 6 +5 9 +6 9 +6 11 +7 10 +7 8 +8 9 +9 11 +10 11 +10 12 +11 12 +0 0 diff --git a/codenet/public_test_cases/p00268/input.1.txt b/codenet/public_test_cases/p00268/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61603df64ac2e4b2626d464b0099aafd4d35325 --- /dev/null +++ b/codenet/public_test_cases/p00268/input.1.txt @@ -0,0 +1,45 @@ +4 4 +0 0 +1 0 +1 1 +0 1 +1 2 +1 4 +2 3 +3 4 +12 22 +2 0 +4 0 +8 0 +4 2 +6 2 +8 2 +2 4 +4 4 +6 4 +0 6 +8 6 +0 8 +1 2 +2 3 +1 4 +1 7 +1 10 +2 4 +2 5 +3 5 +3 6 +4 5 +4 8 +5 6 +5 9 +6 9 +6 11 +7 10 +7 8 +8 9 +9 11 +10 11 +10 12 +11 12 +0 0 diff --git a/codenet/public_test_cases/p00268/output.0.txt b/codenet/public_test_cases/p00268/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p00268/output.0.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p00268/output.1.txt b/codenet/public_test_cases/p00268/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p00268/output.1.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p00269/input.0.txt b/codenet/public_test_cases/p00269/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c66c39cbb6f2ca6f37fc1c21ec5a292e043381f --- /dev/null +++ b/codenet/public_test_cases/p00269/input.0.txt @@ -0,0 +1,39 @@ +2 2 1 +5 3 +2 2 +3 3 1 +2 0 +1 2 +2 2 +1 1 +2 2 1 +5 3 +2 2 +3 2 1 +2 0 +1 2 +2 2 +1 1 +2 2 2 +5 3 +2 2 +3 2 1 +2 0 +1 2 +2 2 +1 1 +4 3 1 +2 2 1 +3 2 2 +2 3 3 +1 2 2 +5 4 3 +1 1 0 +1 0 1 +1 0 2 +1 1 2 +2 2 2 +1 0 1 +2 0 2 +1 1 1 +0 0 0 diff --git a/codenet/public_test_cases/p00269/input.1.txt b/codenet/public_test_cases/p00269/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c66c39cbb6f2ca6f37fc1c21ec5a292e043381f --- /dev/null +++ b/codenet/public_test_cases/p00269/input.1.txt @@ -0,0 +1,39 @@ +2 2 1 +5 3 +2 2 +3 3 1 +2 0 +1 2 +2 2 +1 1 +2 2 1 +5 3 +2 2 +3 2 1 +2 0 +1 2 +2 2 +1 1 +2 2 2 +5 3 +2 2 +3 2 1 +2 0 +1 2 +2 2 +1 1 +4 3 1 +2 2 1 +3 2 2 +2 3 3 +1 2 2 +5 4 3 +1 1 0 +1 0 1 +1 0 2 +1 1 2 +2 2 2 +1 0 1 +2 0 2 +1 1 1 +0 0 0 diff --git a/codenet/public_test_cases/p00269/output.0.txt b/codenet/public_test_cases/p00269/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c58c4c29afdf686329955fae23b899eed8366ac --- /dev/null +++ b/codenet/public_test_cases/p00269/output.0.txt @@ -0,0 +1,4 @@ +-1 +9 +6 +7 diff --git a/codenet/public_test_cases/p00269/output.1.txt b/codenet/public_test_cases/p00269/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c58c4c29afdf686329955fae23b899eed8366ac --- /dev/null +++ b/codenet/public_test_cases/p00269/output.1.txt @@ -0,0 +1,4 @@ +-1 +9 +6 +7 diff --git a/codenet/public_test_cases/p00270/input.0.txt b/codenet/public_test_cases/p00270/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f43dd125b8dec21101edbdc44b8f4757d59f307e --- /dev/null +++ b/codenet/public_test_cases/p00270/input.0.txt @@ -0,0 +1,15 @@ +6 7 +1 2 3 +1 4 1 +2 3 5 +4 3 1 +3 6 2 +4 5 2 +5 6 1 +1 6 6 +1 6 +4 3 +4 6 +5 6 +2 6 +2 5 diff --git a/codenet/public_test_cases/p00270/input.1.txt b/codenet/public_test_cases/p00270/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f43dd125b8dec21101edbdc44b8f4757d59f307e --- /dev/null +++ b/codenet/public_test_cases/p00270/input.1.txt @@ -0,0 +1,15 @@ +6 7 +1 2 3 +1 4 1 +2 3 5 +4 3 1 +3 6 2 +4 5 2 +5 6 1 +1 6 6 +1 6 +4 3 +4 6 +5 6 +2 6 +2 5 diff --git a/codenet/public_test_cases/p00270/output.0.txt b/codenet/public_test_cases/p00270/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d58ad83fc3bc681a24577f922dfefa7615f83d15 --- /dev/null +++ b/codenet/public_test_cases/p00270/output.0.txt @@ -0,0 +1,6 @@ +Yes +Yes +Yes +Yes +No +No diff --git a/codenet/public_test_cases/p00270/output.1.txt b/codenet/public_test_cases/p00270/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d58ad83fc3bc681a24577f922dfefa7615f83d15 --- /dev/null +++ b/codenet/public_test_cases/p00270/output.1.txt @@ -0,0 +1,6 @@ +Yes +Yes +Yes +Yes +No +No diff --git a/codenet/public_test_cases/p00271/input.0.txt b/codenet/public_test_cases/p00271/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dd032e79edb76f49557f5de3d151eeec993985c --- /dev/null +++ b/codenet/public_test_cases/p00271/input.0.txt @@ -0,0 +1,7 @@ +30 19 +39 20 +19 18 +25 20 +22 21 +23 10 +10 -10 diff --git a/codenet/public_test_cases/p00271/input.1.txt b/codenet/public_test_cases/p00271/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dd032e79edb76f49557f5de3d151eeec993985c --- /dev/null +++ b/codenet/public_test_cases/p00271/input.1.txt @@ -0,0 +1,7 @@ +30 19 +39 20 +19 18 +25 20 +22 21 +23 10 +10 -10 diff --git a/codenet/public_test_cases/p00271/output.0.txt b/codenet/public_test_cases/p00271/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6f682d088c35369a5f9cd69e1eef602d54e82a1 --- /dev/null +++ b/codenet/public_test_cases/p00271/output.0.txt @@ -0,0 +1,7 @@ +11 +19 +1 +5 +1 +13 +20 diff --git a/codenet/public_test_cases/p00271/output.1.txt b/codenet/public_test_cases/p00271/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6f682d088c35369a5f9cd69e1eef602d54e82a1 --- /dev/null +++ b/codenet/public_test_cases/p00271/output.1.txt @@ -0,0 +1,7 @@ +11 +19 +1 +5 +1 +13 +20 diff --git a/codenet/public_test_cases/p00272/input.0.txt b/codenet/public_test_cases/p00272/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd6c8c665176bede736f3b1208ed4144f333df6d --- /dev/null +++ b/codenet/public_test_cases/p00272/input.0.txt @@ -0,0 +1,4 @@ +3 10 +1 4 +4 1 +2 5 diff --git a/codenet/public_test_cases/p00272/input.1.txt b/codenet/public_test_cases/p00272/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd6c8c665176bede736f3b1208ed4144f333df6d --- /dev/null +++ b/codenet/public_test_cases/p00272/input.1.txt @@ -0,0 +1,4 @@ +3 10 +1 4 +4 1 +2 5 diff --git a/codenet/public_test_cases/p00272/output.0.txt b/codenet/public_test_cases/p00272/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23f97a986f1aba0e4d166867e242057da1e5bc40 --- /dev/null +++ b/codenet/public_test_cases/p00272/output.0.txt @@ -0,0 +1,4 @@ +30000 +24000 +2000 +20000 diff --git a/codenet/public_test_cases/p00272/output.1.txt b/codenet/public_test_cases/p00272/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..23f97a986f1aba0e4d166867e242057da1e5bc40 --- /dev/null +++ b/codenet/public_test_cases/p00272/output.1.txt @@ -0,0 +1,4 @@ +30000 +24000 +2000 +20000 diff --git a/codenet/public_test_cases/p00273/input.0.txt b/codenet/public_test_cases/p00273/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b60d2f879bc9dc09f53068ca7264e53611c4aef4 --- /dev/null +++ b/codenet/public_test_cases/p00273/input.0.txt @@ -0,0 +1,3 @@ +2 +100 100 1 1 +1000 500 5 2 diff --git a/codenet/public_test_cases/p00273/input.1.txt b/codenet/public_test_cases/p00273/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b60d2f879bc9dc09f53068ca7264e53611c4aef4 --- /dev/null +++ b/codenet/public_test_cases/p00273/input.1.txt @@ -0,0 +1,3 @@ +2 +100 100 1 1 +1000 500 5 2 diff --git a/codenet/public_test_cases/p00273/output.0.txt b/codenet/public_test_cases/p00273/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6755f7fe8241b39546634a4e1e74c6bdfb59cff3 --- /dev/null +++ b/codenet/public_test_cases/p00273/output.0.txt @@ -0,0 +1,2 @@ +200 +4800 diff --git a/codenet/public_test_cases/p00273/output.1.txt b/codenet/public_test_cases/p00273/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6755f7fe8241b39546634a4e1e74c6bdfb59cff3 --- /dev/null +++ b/codenet/public_test_cases/p00273/output.1.txt @@ -0,0 +1,2 @@ +200 +4800 diff --git a/codenet/public_test_cases/p00274/input.0.txt b/codenet/public_test_cases/p00274/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d221cfa50726f8384ad7543fc0ef281de2148582 --- /dev/null +++ b/codenet/public_test_cases/p00274/input.0.txt @@ -0,0 +1,7 @@ +2 +3 2 +3 +0 1 1 +1 +1000 +0 diff --git a/codenet/public_test_cases/p00274/input.1.txt b/codenet/public_test_cases/p00274/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d221cfa50726f8384ad7543fc0ef281de2148582 --- /dev/null +++ b/codenet/public_test_cases/p00274/input.1.txt @@ -0,0 +1,7 @@ +2 +3 2 +3 +0 1 1 +1 +1000 +0 diff --git a/codenet/public_test_cases/p00274/output.0.txt b/codenet/public_test_cases/p00274/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e479723610d1850f422c9967bfd7b81fcb8a5a6 --- /dev/null +++ b/codenet/public_test_cases/p00274/output.0.txt @@ -0,0 +1,3 @@ +3 +NA +2 diff --git a/codenet/public_test_cases/p00274/output.1.txt b/codenet/public_test_cases/p00274/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e479723610d1850f422c9967bfd7b81fcb8a5a6 --- /dev/null +++ b/codenet/public_test_cases/p00274/output.1.txt @@ -0,0 +1,3 @@ +3 +NA +2 diff --git a/codenet/public_test_cases/p00275/input.0.txt b/codenet/public_test_cases/p00275/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d7cba791706a6561f60e1945b8c69fff2e25829 --- /dev/null +++ b/codenet/public_test_cases/p00275/input.0.txt @@ -0,0 +1,7 @@ +2 +SSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +2 +SSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMSL +5 +MMMMMMSLSLLMMMSMMSLMMMLMMMMLSLLLLMLSMMLMMLLMSSSLMMMMLMLSMLMSMMMMMMMSMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM +0 diff --git a/codenet/public_test_cases/p00275/input.1.txt b/codenet/public_test_cases/p00275/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d7cba791706a6561f60e1945b8c69fff2e25829 --- /dev/null +++ b/codenet/public_test_cases/p00275/input.1.txt @@ -0,0 +1,7 @@ +2 +SSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +2 +SSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMSL +5 +MMMMMMSLSLLMMMSMMSLMMMLMMMMLSLLLLMLSMMLMMLLMSSSLMMMMLMLSMLMSMMMMMMMSMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM +0 diff --git a/codenet/public_test_cases/p00275/output.0.txt b/codenet/public_test_cases/p00275/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..16622f09f6094b0f2fe0e2841705aa4529fe88e2 --- /dev/null +++ b/codenet/public_test_cases/p00275/output.0.txt @@ -0,0 +1,3 @@ +42 58 0 +0 100 0 +0 0 3 10 59 28 diff --git a/codenet/public_test_cases/p00275/output.1.txt b/codenet/public_test_cases/p00275/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..16622f09f6094b0f2fe0e2841705aa4529fe88e2 --- /dev/null +++ b/codenet/public_test_cases/p00275/output.1.txt @@ -0,0 +1,3 @@ +42 58 0 +0 100 0 +0 0 3 10 59 28 diff --git a/codenet/public_test_cases/p00276/input.0.txt b/codenet/public_test_cases/p00276/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13f8df1967b4c82ddd8bce5f9675ad14ad73f9cb --- /dev/null +++ b/codenet/public_test_cases/p00276/input.0.txt @@ -0,0 +1,5 @@ +4 +3 0 0 +1 1 1 +9 4 1 +0 1 2 diff --git a/codenet/public_test_cases/p00276/input.1.txt b/codenet/public_test_cases/p00276/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..13f8df1967b4c82ddd8bce5f9675ad14ad73f9cb --- /dev/null +++ b/codenet/public_test_cases/p00276/input.1.txt @@ -0,0 +1,5 @@ +4 +3 0 0 +1 1 1 +9 4 1 +0 1 2 diff --git a/codenet/public_test_cases/p00276/output.0.txt b/codenet/public_test_cases/p00276/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b434899fd1184219bfae3826cb0fa052207ccb02 --- /dev/null +++ b/codenet/public_test_cases/p00276/output.0.txt @@ -0,0 +1,4 @@ +1 +1 +4 +0 diff --git a/codenet/public_test_cases/p00276/output.1.txt b/codenet/public_test_cases/p00276/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b434899fd1184219bfae3826cb0fa052207ccb02 --- /dev/null +++ b/codenet/public_test_cases/p00276/output.1.txt @@ -0,0 +1,4 @@ +1 +1 +4 +0 diff --git a/codenet/public_test_cases/p00277/input.0.txt b/codenet/public_test_cases/p00277/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0fe8d094e73332e82de0065a378cdcea8283a3a --- /dev/null +++ b/codenet/public_test_cases/p00277/input.0.txt @@ -0,0 +1,5 @@ +3 4 600 +3 100 5 +1 200 10 +2 400 20 +3 500 20 diff --git a/codenet/public_test_cases/p00277/input.1.txt b/codenet/public_test_cases/p00277/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0fe8d094e73332e82de0065a378cdcea8283a3a --- /dev/null +++ b/codenet/public_test_cases/p00277/input.1.txt @@ -0,0 +1,5 @@ +3 4 600 +3 100 5 +1 200 10 +2 400 20 +3 500 20 diff --git a/codenet/public_test_cases/p00277/output.0.txt b/codenet/public_test_cases/p00277/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00277/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00277/output.1.txt b/codenet/public_test_cases/p00277/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00277/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00278/input.0.txt b/codenet/public_test_cases/p00278/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c96cbfc327a7f95f21b40bd7f9e69056623f482 --- /dev/null +++ b/codenet/public_test_cases/p00278/input.0.txt @@ -0,0 +1,14 @@ +5 8 +5 +10 +8 +7 +3 +ADD 1 +ADD 3 +CHECK 0 +CHECK 1 +CHECK 2 +CHECK 3 +CHECK 4 +CHECK 5 diff --git a/codenet/public_test_cases/p00278/input.1.txt b/codenet/public_test_cases/p00278/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c96cbfc327a7f95f21b40bd7f9e69056623f482 --- /dev/null +++ b/codenet/public_test_cases/p00278/input.1.txt @@ -0,0 +1,14 @@ +5 8 +5 +10 +8 +7 +3 +ADD 1 +ADD 3 +CHECK 0 +CHECK 1 +CHECK 2 +CHECK 3 +CHECK 4 +CHECK 5 diff --git a/codenet/public_test_cases/p00278/output.0.txt b/codenet/public_test_cases/p00278/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..685275ef702faca67d9f19fc1b27d300b238bddf --- /dev/null +++ b/codenet/public_test_cases/p00278/output.0.txt @@ -0,0 +1,6 @@ +NA +2 +1 +0 +0 +0 diff --git a/codenet/public_test_cases/p00278/output.1.txt b/codenet/public_test_cases/p00278/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..685275ef702faca67d9f19fc1b27d300b238bddf --- /dev/null +++ b/codenet/public_test_cases/p00278/output.1.txt @@ -0,0 +1,6 @@ +NA +2 +1 +0 +0 +0 diff --git a/codenet/public_test_cases/p00279/input.0.txt b/codenet/public_test_cases/p00279/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88737bb60fea418f141f1afbfa994b6c9b159f98 --- /dev/null +++ b/codenet/public_test_cases/p00279/input.0.txt @@ -0,0 +1,10 @@ +5 +0 0 +3 0 +5 2 +1 4 +0 3 +3 +3 +4 +5 diff --git a/codenet/public_test_cases/p00279/input.1.txt b/codenet/public_test_cases/p00279/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..88737bb60fea418f141f1afbfa994b6c9b159f98 --- /dev/null +++ b/codenet/public_test_cases/p00279/input.1.txt @@ -0,0 +1,10 @@ +5 +0 0 +3 0 +5 2 +1 4 +0 3 +3 +3 +4 +5 diff --git a/codenet/public_test_cases/p00279/output.0.txt b/codenet/public_test_cases/p00279/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66f3c745cc41f57a05157abf997b81dfd2eabe66 --- /dev/null +++ b/codenet/public_test_cases/p00279/output.0.txt @@ -0,0 +1,3 @@ +1 4 5 +1 2 4 5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p00279/output.1.txt b/codenet/public_test_cases/p00279/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..66f3c745cc41f57a05157abf997b81dfd2eabe66 --- /dev/null +++ b/codenet/public_test_cases/p00279/output.1.txt @@ -0,0 +1,3 @@ +1 4 5 +1 2 4 5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p00280/input.0.txt b/codenet/public_test_cases/p00280/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p00280/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p00280/output.0.txt b/codenet/public_test_cases/p00280/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf8522816484531af57b2f877d9fbcecce8af262 --- /dev/null +++ b/codenet/public_test_cases/p00280/output.0.txt @@ -0,0 +1,6 @@ +AABB +ABAB +ABBA +BAAB +BABA +BBAA diff --git a/codenet/public_test_cases/p00281/input.0.txt b/codenet/public_test_cases/p00281/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..423fffbbea1f461bfc0dfb43d353f72979ad61c2 --- /dev/null +++ b/codenet/public_test_cases/p00281/input.0.txt @@ -0,0 +1,13 @@ +4 6 +1 2 1 +2 3 2 +2 4 3 +3 1 5 +4 2 4 +4 3 2 +4 6 10 +0 0 0 +3 +1 3 2 4 0 10 +6 5 4 3 2 1 +5 1 1 5 5 1 diff --git a/codenet/public_test_cases/p00281/output.0.txt b/codenet/public_test_cases/p00281/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3cc2c7c7790d19f667829e5ef58798bdc5b8608 --- /dev/null +++ b/codenet/public_test_cases/p00281/output.0.txt @@ -0,0 +1,3 @@ +3 16 5 116 +5 17 30 38 +1 17 25 16 diff --git a/codenet/public_test_cases/p00282/input.0.txt b/codenet/public_test_cases/p00282/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02eddea94d731a05d9717fc242c707bc89618aad --- /dev/null +++ b/codenet/public_test_cases/p00282/input.0.txt @@ -0,0 +1,5 @@ +2 10 +5 20 +10 8 +20 17 +0 0 diff --git a/codenet/public_test_cases/p00282/output.0.txt b/codenet/public_test_cases/p00282/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdfbccd7f89d4b18f5420abda0fc7e740f2a4528 --- /dev/null +++ b/codenet/public_test_cases/p00282/output.0.txt @@ -0,0 +1,4 @@ +1024 +95Cho3674Oku3164Man625 +1Oku +131Gai720Kei diff --git a/codenet/public_test_cases/p00283/input.0.txt b/codenet/public_test_cases/p00283/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a0da26dd34bb2df2cc3e804ae20aa35e1315c72 --- /dev/null +++ b/codenet/public_test_cases/p00283/input.0.txt @@ -0,0 +1,13 @@ +15 4 +1 1 0 +1 2 2 +5 10 5 +8 1 15 +60 4 +5 2 0 +8 8 2 +3 5 0 +49 0 18 +100 1 +1 1 1 +0 0 diff --git a/codenet/public_test_cases/p00283/output.0.txt b/codenet/public_test_cases/p00283/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c44d47f16775d1ef5a5d0eae85a1e031c60a9c25 --- /dev/null +++ b/codenet/public_test_cases/p00283/output.0.txt @@ -0,0 +1,3 @@ +6 +4 +NA diff --git a/codenet/public_test_cases/p00284/input.0.txt b/codenet/public_test_cases/p00284/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9128b02f6ef671a8836779e83ae113fb9258b82f --- /dev/null +++ b/codenet/public_test_cases/p00284/input.0.txt @@ -0,0 +1,4 @@ +3 +0 7 +-1048576 0 +-3 5 diff --git a/codenet/public_test_cases/p00284/output.0.txt b/codenet/public_test_cases/p00284/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..376b761b1d6afe0c1772ee23b0063980f86948ad --- /dev/null +++ b/codenet/public_test_cases/p00284/output.0.txt @@ -0,0 +1,3 @@ +3 +1 +4 diff --git a/codenet/public_test_cases/p00285/input.0.txt b/codenet/public_test_cases/p00285/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..835e9c2eab9354050d2acfd5b1209744dcbfb270 --- /dev/null +++ b/codenet/public_test_cases/p00285/input.0.txt @@ -0,0 +1,10 @@ +3 3 +0 20 30 +10 20 30 +10 10 +32 10 15 8 20 10 6 45 50 41 +18 0 37 25 45 11 25 21 32 27 +7 3 +23 14 39 6 47 16 23 +19 37 8 +0 0 diff --git a/codenet/public_test_cases/p00285/output.0.txt b/codenet/public_test_cases/p00285/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9362f48131f8ec053504aa9904df8c70f230a7a3 --- /dev/null +++ b/codenet/public_test_cases/p00285/output.0.txt @@ -0,0 +1,3 @@ +12000 +53906 +11629 diff --git a/codenet/public_test_cases/p00286/input.0.txt b/codenet/public_test_cases/p00286/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0680264de2fae6c3d39efd5367764ea7c5e16140 --- /dev/null +++ b/codenet/public_test_cases/p00286/input.0.txt @@ -0,0 +1,13 @@ +5 2 +A 5 +1 0 0 1 +0 1 0 0 +1 0 1 0 +0 1 0 1 +B 4 +1 0 0 1 +0 1 0 0 +0 0 1 0 +2 +2(A+B) +1000000000(1000000000A+1000000000B) diff --git a/codenet/public_test_cases/p00286/output.0.txt b/codenet/public_test_cases/p00286/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5d7592760a33aeaafa6c2e626ce3e61f07370af --- /dev/null +++ b/codenet/public_test_cases/p00286/output.0.txt @@ -0,0 +1,2 @@ +4 2 5 1 3 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p00287/input.0.txt b/codenet/public_test_cases/p00287/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1cbc7226589dcd7c6aa96f0aa9c9445bdd8043d5 --- /dev/null +++ b/codenet/public_test_cases/p00287/input.0.txt @@ -0,0 +1,9 @@ +5 6 5 +0 2 5 2 +0 3 5 3 +0 4 3 4 +1 4 1 6 +3 0 3 6 +2 +2 5 4 1 +2 5 4 5 diff --git a/codenet/public_test_cases/p00287/output.0.txt b/codenet/public_test_cases/p00287/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p00287/output.0.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p00288/input.0.txt b/codenet/public_test_cases/p00288/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaa10020b0f2e66a89ccbbba978b928f242d66dc --- /dev/null +++ b/codenet/public_test_cases/p00288/input.0.txt @@ -0,0 +1,72 @@ +1 1 1 +0 0 +0 0 1 0 +1 1 0 +0 0 +-3 0 2 3 +1 3 1 +0 0 +-3 0 2 3 +0 -5 2 0 +4 0 2 1 +4 3 1 +0 0 +0 0 +0 0 +0 0 +-3 0 2 3 +0 -5 2 0 +4 0 2 1 +6 3 1 +0 0 +0 0 +0 0 +0 0 +0 0 +0 0 +-3 0 2 3 +0 -5 2 0 +4 0 2 1 +6 3 2 +0 0 +0 0 +0 0 +0 0 +0 0 +0 0 +-3 0 2 3 +0 -5 2 0 +4 0 2 1 +10 5 1 +0 0 +2 0 +4 0 +8 0 +100 0 +100 0 +100 0 +100 0 +100 0 +100 0 +-3 0 1 0 +1 0 1 0 +3 0 2 0 +15 0 1 0 +105 0 6 0 +10 5 2 +0 0 +2 0 +4 0 +8 0 +100 0 +100 0 +100 0 +100 0 +100 0 +100 0 +-3 0 1 0 +1 0 1 0 +3 0 2 0 +15 0 1 0 +105 0 6 0 +0 0 0 diff --git a/codenet/public_test_cases/p00288/output.0.txt b/codenet/public_test_cases/p00288/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..68b0cdaf2bab0754afb4d5edf0a0b7e0a945dfe6 --- /dev/null +++ b/codenet/public_test_cases/p00288/output.0.txt @@ -0,0 +1,8 @@ +0 +3 +5 +11 +18 +28 +20 +38 diff --git a/codenet/public_test_cases/p00289/input.0.txt b/codenet/public_test_cases/p00289/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9d117f611399fdca70f96f411b4ff882049a4de --- /dev/null +++ b/codenet/public_test_cases/p00289/input.0.txt @@ -0,0 +1,14 @@ +6 7 +1 2 +2 3 +1 3 +1 4 +4 5 +5 6 +6 1 +5 +2 +3 +4 +5 +6 diff --git a/codenet/public_test_cases/p00289/output.0.txt b/codenet/public_test_cases/p00289/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c51caf8326e5df1990f6bcf62455a80251faa897 --- /dev/null +++ b/codenet/public_test_cases/p00289/output.0.txt @@ -0,0 +1,5 @@ +2 +3 +4 +4 +5 diff --git a/codenet/public_test_cases/p00290/input.0.txt b/codenet/public_test_cases/p00290/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d7c784a9981a5314a36cc86dcc685123577e8e0 --- /dev/null +++ b/codenet/public_test_cases/p00290/input.0.txt @@ -0,0 +1 @@ +20 2 diff --git a/codenet/public_test_cases/p00290/output.0.txt b/codenet/public_test_cases/p00290/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p00290/output.0.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p00291/input.0.txt b/codenet/public_test_cases/p00291/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ff0e0bd4791632a896ec00ea9fa5905d9cf3706 --- /dev/null +++ b/codenet/public_test_cases/p00291/input.0.txt @@ -0,0 +1 @@ +3 1 4 0 4 1 diff --git a/codenet/public_test_cases/p00291/output.0.txt b/codenet/public_test_cases/p00291/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00291/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00292/input.0.txt b/codenet/public_test_cases/p00292/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38da8dff0d678983febd9ed8b560ec3cf35a71f8 --- /dev/null +++ b/codenet/public_test_cases/p00292/input.0.txt @@ -0,0 +1,4 @@ +3 +10 3 +2 10 +4 2 diff --git a/codenet/public_test_cases/p00292/output.0.txt b/codenet/public_test_cases/p00292/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ca3cd52fcf5f3ce33b7fd5b2542687a9a39a77a --- /dev/null +++ b/codenet/public_test_cases/p00292/output.0.txt @@ -0,0 +1,3 @@ +1 +2 +2 diff --git a/codenet/public_test_cases/p00293/input.0.txt b/codenet/public_test_cases/p00293/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..637454808030d395b6340445f1780a554e969a18 --- /dev/null +++ b/codenet/public_test_cases/p00293/input.0.txt @@ -0,0 +1,2 @@ +2 9 8 15 59 +1 8 27 diff --git a/codenet/public_test_cases/p00293/output.0.txt b/codenet/public_test_cases/p00293/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82ba69c8013f358c118043655e1248df9fde3b99 --- /dev/null +++ b/codenet/public_test_cases/p00293/output.0.txt @@ -0,0 +1 @@ +8:27 9:08 15:59 diff --git a/codenet/public_test_cases/p00294/input.0.txt b/codenet/public_test_cases/p00294/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..92b13f40bc090b70a9e7ecf8427c7d5eac22d2cf --- /dev/null +++ b/codenet/public_test_cases/p00294/input.0.txt @@ -0,0 +1,5 @@ +5 4 0 +1 +2 +3 +4 diff --git a/codenet/public_test_cases/p00294/output.0.txt b/codenet/public_test_cases/p00294/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d411bb7c1acabe5edc652eb910b74ab77be9dd3d --- /dev/null +++ b/codenet/public_test_cases/p00294/output.0.txt @@ -0,0 +1 @@ +400 diff --git a/codenet/public_test_cases/p00295/input.0.txt b/codenet/public_test_cases/p00295/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..217749ea1b4c5a1d7b144fe6b67874b197127934 --- /dev/null +++ b/codenet/public_test_cases/p00295/input.0.txt @@ -0,0 +1,5 @@ +4 +1 1 1 1 1 1 1 1 1 2 2 2 4 4 4 6 6 6 5 5 5 3 3 3 3 3 3 3 3 3 +3 3 3 1 1 1 1 1 1 2 2 2 4 4 6 4 6 6 5 5 5 3 3 3 3 3 3 1 1 1 +3 3 3 1 1 3 1 1 1 2 2 5 6 4 4 4 6 6 2 5 5 3 3 3 1 3 3 1 1 1 +1 3 1 3 1 3 3 1 3 2 2 2 6 4 4 6 6 4 5 5 5 1 3 1 1 3 1 3 1 3 diff --git a/codenet/public_test_cases/p00295/output.0.txt b/codenet/public_test_cases/p00295/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..857ba3db782f3f69fb14e161fd2b07e7fc1f5bd3 --- /dev/null +++ b/codenet/public_test_cases/p00295/output.0.txt @@ -0,0 +1,4 @@ +0 +1 +2 +7 diff --git a/codenet/public_test_cases/p00296/input.0.txt b/codenet/public_test_cases/p00296/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf4851ca8732af074132b1bf39a076ca8151eeee --- /dev/null +++ b/codenet/public_test_cases/p00296/input.0.txt @@ -0,0 +1,3 @@ +10 5 3 +2 6 5 18 3 +3 0 5 diff --git a/codenet/public_test_cases/p00296/output.0.txt b/codenet/public_test_cases/p00296/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..16db301bb512cb809eb9cc31acf34eb98cb19541 --- /dev/null +++ b/codenet/public_test_cases/p00296/output.0.txt @@ -0,0 +1,3 @@ +1 +0 +1 diff --git a/codenet/public_test_cases/p00297/input.0.txt b/codenet/public_test_cases/p00297/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b5ff8ef9a89a22be28a66474f34f50cc931edea --- /dev/null +++ b/codenet/public_test_cases/p00297/input.0.txt @@ -0,0 +1,10 @@ +9 2 +1 1 1 +1 5 12 +2 3 2 +3 2 4 +4 4 1 +5 1 3 +5 3 8 +6 5 5 +7 2 4 diff --git a/codenet/public_test_cases/p00297/output.0.txt b/codenet/public_test_cases/p00297/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p00297/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p00298/input.0.txt b/codenet/public_test_cases/p00298/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d01eb8ad6cd862a8ed7fc0a99c8474fec65eec1 --- /dev/null +++ b/codenet/public_test_cases/p00298/input.0.txt @@ -0,0 +1,4 @@ +3 +150 120 +100 50 +80 100 diff --git a/codenet/public_test_cases/p00298/input.1.txt b/codenet/public_test_cases/p00298/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d01eb8ad6cd862a8ed7fc0a99c8474fec65eec1 --- /dev/null +++ b/codenet/public_test_cases/p00298/input.1.txt @@ -0,0 +1,4 @@ +3 +150 120 +100 50 +80 100 diff --git a/codenet/public_test_cases/p00298/output.0.txt b/codenet/public_test_cases/p00298/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00298/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00298/output.1.txt b/codenet/public_test_cases/p00298/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00298/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00299/input.0.txt b/codenet/public_test_cases/p00299/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7419f89c710420cc6f77eb33e44098c35a9b088 --- /dev/null +++ b/codenet/public_test_cases/p00299/input.0.txt @@ -0,0 +1,2 @@ +3 2 +1 diff --git a/codenet/public_test_cases/p00299/input.1.txt b/codenet/public_test_cases/p00299/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7419f89c710420cc6f77eb33e44098c35a9b088 --- /dev/null +++ b/codenet/public_test_cases/p00299/input.1.txt @@ -0,0 +1,2 @@ +3 2 +1 diff --git a/codenet/public_test_cases/p00299/output.0.txt b/codenet/public_test_cases/p00299/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00299/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00299/output.1.txt b/codenet/public_test_cases/p00299/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00299/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00300/input.0.txt b/codenet/public_test_cases/p00300/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..72b00fec777e5776351c2b79db0c7b3f4d9a6c02 --- /dev/null +++ b/codenet/public_test_cases/p00300/input.0.txt @@ -0,0 +1,5 @@ +4 +300 120 +300 105 +250 105 +250 90 diff --git a/codenet/public_test_cases/p00300/output.0.txt b/codenet/public_test_cases/p00300/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bc0539ae3c3fd1fa5d79a2c5168cd6d36f37d87 --- /dev/null +++ b/codenet/public_test_cases/p00300/output.0.txt @@ -0,0 +1,4 @@ +23 +18 23 +17 18 22 23 +17 18 diff --git a/codenet/public_test_cases/p00301/input.0.txt b/codenet/public_test_cases/p00301/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p00301/input.0.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p00301/input.1.txt b/codenet/public_test_cases/p00301/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p00301/input.1.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p00301/output.0.txt b/codenet/public_test_cases/p00301/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c5f00ca723062ce0d1f1bac26ca38620785d63f --- /dev/null +++ b/codenet/public_test_cases/p00301/output.0.txt @@ -0,0 +1 @@ ++0-+ diff --git a/codenet/public_test_cases/p00301/output.1.txt b/codenet/public_test_cases/p00301/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c5f00ca723062ce0d1f1bac26ca38620785d63f --- /dev/null +++ b/codenet/public_test_cases/p00301/output.1.txt @@ -0,0 +1 @@ ++0-+ diff --git a/codenet/public_test_cases/p00302/input.0.txt b/codenet/public_test_cases/p00302/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b940abc548ff9bea47b31415df9400115ed47017 --- /dev/null +++ b/codenet/public_test_cases/p00302/input.0.txt @@ -0,0 +1,2 @@ +1 10 20 +1 diff --git a/codenet/public_test_cases/p00302/output.0.txt b/codenet/public_test_cases/p00302/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00302/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00303/input.0.txt b/codenet/public_test_cases/p00303/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60ad272f621fcbc84625ccac1f4148a52e204941 --- /dev/null +++ b/codenet/public_test_cases/p00303/input.0.txt @@ -0,0 +1,5 @@ +4 +1 lock 1 +2 lock 2 +1 wait 2 +2 wait 1 diff --git a/codenet/public_test_cases/p00303/output.0.txt b/codenet/public_test_cases/p00303/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00303/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00304/input.0.txt b/codenet/public_test_cases/p00304/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27ea60de786ab7425d1a24870fbf2cb426736ef2 --- /dev/null +++ b/codenet/public_test_cases/p00304/input.0.txt @@ -0,0 +1,24 @@ +12 +A +E +E +E +R? +E? +E? +E +E +E +E? +E +1 2 +1 3 +1 4 +2 5 +4 6 +4 7 +5 8 +5 9 +7 10 +7 11 +11 12 diff --git a/codenet/public_test_cases/p00304/output.0.txt b/codenet/public_test_cases/p00304/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00304/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00305/input.0.txt b/codenet/public_test_cases/p00305/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b724aca2e62aaaac5b69b91f11bfcdccf9bc5fc4 --- /dev/null +++ b/codenet/public_test_cases/p00305/input.0.txt @@ -0,0 +1,6 @@ +5 +2 0 0 2 0 +0 1 0 2 0 +0 0 0 -1 0 +0 4 0 3 0 +-1 0 0 1 0 diff --git a/codenet/public_test_cases/p00305/output.0.txt b/codenet/public_test_cases/p00305/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p00305/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p00306/input.0.txt b/codenet/public_test_cases/p00306/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..36fbf7823a66422e4b1d7a1830ad531ed0b11fb6 --- /dev/null +++ b/codenet/public_test_cases/p00306/input.0.txt @@ -0,0 +1 @@ +90 10 diff --git a/codenet/public_test_cases/p00306/input.1.txt b/codenet/public_test_cases/p00306/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..36fbf7823a66422e4b1d7a1830ad531ed0b11fb6 --- /dev/null +++ b/codenet/public_test_cases/p00306/input.1.txt @@ -0,0 +1 @@ +90 10 diff --git a/codenet/public_test_cases/p00306/output.0.txt b/codenet/public_test_cases/p00306/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba66466c2a0d0a1080ad71d8e1a67a97f336c384 --- /dev/null +++ b/codenet/public_test_cases/p00306/output.0.txt @@ -0,0 +1 @@ +0.0 diff --git a/codenet/public_test_cases/p00306/output.1.txt b/codenet/public_test_cases/p00306/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba66466c2a0d0a1080ad71d8e1a67a97f336c384 --- /dev/null +++ b/codenet/public_test_cases/p00306/output.1.txt @@ -0,0 +1 @@ +0.0 diff --git a/codenet/public_test_cases/p00307/input.0.txt b/codenet/public_test_cases/p00307/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bbdc5b086b8db7d87b11e04ebe8ed3625e31f18 --- /dev/null +++ b/codenet/public_test_cases/p00307/input.0.txt @@ -0,0 +1,8 @@ +3 4 +2 2 +3 3 +4 4 +3 3 +4 4 +1 1 +2 2 diff --git a/codenet/public_test_cases/p00307/output.0.txt b/codenet/public_test_cases/p00307/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00307/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00308/input.0.txt b/codenet/public_test_cases/p00308/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cde1f025b11407560ecfc07eca6ed4a561a6880 --- /dev/null +++ b/codenet/public_test_cases/p00308/input.0.txt @@ -0,0 +1,7 @@ +6 +oooxxxx +ooooxxx +oxxooxxo +ooxx +oo +ooo diff --git a/codenet/public_test_cases/p00308/input.1.txt b/codenet/public_test_cases/p00308/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cde1f025b11407560ecfc07eca6ed4a561a6880 --- /dev/null +++ b/codenet/public_test_cases/p00308/input.1.txt @@ -0,0 +1,7 @@ +6 +oooxxxx +ooooxxx +oxxooxxo +ooxx +oo +ooo diff --git a/codenet/public_test_cases/p00308/output.0.txt b/codenet/public_test_cases/p00308/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c8934753486cd8e5d988f548cc3c93df1e6e35d --- /dev/null +++ b/codenet/public_test_cases/p00308/output.0.txt @@ -0,0 +1,17 @@ +-1 +7 +split 0 0 +join 2 1 +split 3 4 +split 4 0 +join 7 6 +split 8 2 +split 9 0 +3 +split 0 1 +split 2 1 +split 4 1 +-1 +0 +1 +split 0 0 diff --git a/codenet/public_test_cases/p00308/output.1.txt b/codenet/public_test_cases/p00308/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c8934753486cd8e5d988f548cc3c93df1e6e35d --- /dev/null +++ b/codenet/public_test_cases/p00308/output.1.txt @@ -0,0 +1,17 @@ +-1 +7 +split 0 0 +join 2 1 +split 3 4 +split 4 0 +join 7 6 +split 8 2 +split 9 0 +3 +split 0 1 +split 2 1 +split 4 1 +-1 +0 +1 +split 0 0 diff --git a/codenet/public_test_cases/p00309/input.0.txt b/codenet/public_test_cases/p00309/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f36b5ac31ef0f41f3244010be88e1cfd303eb81 --- /dev/null +++ b/codenet/public_test_cases/p00309/input.0.txt @@ -0,0 +1,8 @@ +6 7 +1 2 1 +2 3 2 +3 1 3 +4 5 4 +5 6 5 +6 4 6 +1 4 7 diff --git a/codenet/public_test_cases/p00309/input.1.txt b/codenet/public_test_cases/p00309/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f36b5ac31ef0f41f3244010be88e1cfd303eb81 --- /dev/null +++ b/codenet/public_test_cases/p00309/input.1.txt @@ -0,0 +1,8 @@ +6 7 +1 2 1 +2 3 2 +3 1 3 +4 5 4 +5 6 5 +6 4 6 +1 4 7 diff --git a/codenet/public_test_cases/p00309/output.0.txt b/codenet/public_test_cases/p00309/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b77c2f033300f5f36b92ef059d51b885745f4b3 --- /dev/null +++ b/codenet/public_test_cases/p00309/output.0.txt @@ -0,0 +1 @@ +7 18 diff --git a/codenet/public_test_cases/p00309/output.1.txt b/codenet/public_test_cases/p00309/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b77c2f033300f5f36b92ef059d51b885745f4b3 --- /dev/null +++ b/codenet/public_test_cases/p00309/output.1.txt @@ -0,0 +1 @@ +7 18 diff --git a/codenet/public_test_cases/p00310/input.0.txt b/codenet/public_test_cases/p00310/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..320b8ab09b5beed47ad52b325ba39183470d8ee9 --- /dev/null +++ b/codenet/public_test_cases/p00310/input.0.txt @@ -0,0 +1 @@ +10 10 20 diff --git a/codenet/public_test_cases/p00310/input.1.txt b/codenet/public_test_cases/p00310/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..320b8ab09b5beed47ad52b325ba39183470d8ee9 --- /dev/null +++ b/codenet/public_test_cases/p00310/input.1.txt @@ -0,0 +1 @@ +10 10 20 diff --git a/codenet/public_test_cases/p00310/input.2.txt b/codenet/public_test_cases/p00310/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d1e8c4c28a2a91994ca3d178f65a51713975170 --- /dev/null +++ b/codenet/public_test_cases/p00310/input.2.txt @@ -0,0 +1 @@ +100 0 0 diff --git a/codenet/public_test_cases/p00310/input.3.txt b/codenet/public_test_cases/p00310/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a488289edd1f3e7691ce68ead07631af9ca1169a --- /dev/null +++ b/codenet/public_test_cases/p00310/input.3.txt @@ -0,0 +1 @@ +1000 1000 1000 diff --git a/codenet/public_test_cases/p00310/output.0.txt b/codenet/public_test_cases/p00310/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p00310/output.0.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p00310/output.1.txt b/codenet/public_test_cases/p00310/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p00310/output.1.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p00310/output.2.txt b/codenet/public_test_cases/p00310/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p00310/output.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p00310/output.3.txt b/codenet/public_test_cases/p00310/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..13de30f45d1a183bfc67d7f3c660dfce3dfee9e4 --- /dev/null +++ b/codenet/public_test_cases/p00310/output.3.txt @@ -0,0 +1 @@ +3000 diff --git a/codenet/public_test_cases/p00311/input.0.txt b/codenet/public_test_cases/p00311/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8fdf337445edaf4374ad4c74f1c8c75e9277cc7 --- /dev/null +++ b/codenet/public_test_cases/p00311/input.0.txt @@ -0,0 +1,3 @@ +5 1 +3 1 +1 2 5 5 diff --git a/codenet/public_test_cases/p00311/input.1.txt b/codenet/public_test_cases/p00311/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8fdf337445edaf4374ad4c74f1c8c75e9277cc7 --- /dev/null +++ b/codenet/public_test_cases/p00311/input.1.txt @@ -0,0 +1,3 @@ +5 1 +3 1 +1 2 5 5 diff --git a/codenet/public_test_cases/p00311/input.2.txt b/codenet/public_test_cases/p00311/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ecfbf4f239ce03c371b71507df29188c8edecfd --- /dev/null +++ b/codenet/public_test_cases/p00311/input.2.txt @@ -0,0 +1,3 @@ +0 20 +10 0 +1 1 10 0 diff --git a/codenet/public_test_cases/p00311/input.3.txt b/codenet/public_test_cases/p00311/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..17cd6d88fd6dbd1cd8d78d7fefb749df05ec757f --- /dev/null +++ b/codenet/public_test_cases/p00311/input.3.txt @@ -0,0 +1,3 @@ +5 1 +4 2 +1 2 5 5 diff --git a/codenet/public_test_cases/p00311/output.0.txt b/codenet/public_test_cases/p00311/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63be707c671cb61cdcc2be9b33cc7b0b86936c9c --- /dev/null +++ b/codenet/public_test_cases/p00311/output.0.txt @@ -0,0 +1 @@ +hiroshi diff --git a/codenet/public_test_cases/p00311/output.1.txt b/codenet/public_test_cases/p00311/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63be707c671cb61cdcc2be9b33cc7b0b86936c9c --- /dev/null +++ b/codenet/public_test_cases/p00311/output.1.txt @@ -0,0 +1 @@ +hiroshi diff --git a/codenet/public_test_cases/p00311/output.2.txt b/codenet/public_test_cases/p00311/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab6a4d161e7db5506de09f4372bd84f9a625415c --- /dev/null +++ b/codenet/public_test_cases/p00311/output.2.txt @@ -0,0 +1 @@ +even diff --git a/codenet/public_test_cases/p00311/output.3.txt b/codenet/public_test_cases/p00311/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4b2a19298df52b4bfb8fedbe1f94c89fdba9813 --- /dev/null +++ b/codenet/public_test_cases/p00311/output.3.txt @@ -0,0 +1 @@ +kenjiro diff --git a/codenet/public_test_cases/p00312/input.0.txt b/codenet/public_test_cases/p00312/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2deca7fbadd84a9ab0a54387a6aef25603311e73 --- /dev/null +++ b/codenet/public_test_cases/p00312/input.0.txt @@ -0,0 +1 @@ +10 5 diff --git a/codenet/public_test_cases/p00312/input.1.txt b/codenet/public_test_cases/p00312/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2deca7fbadd84a9ab0a54387a6aef25603311e73 --- /dev/null +++ b/codenet/public_test_cases/p00312/input.1.txt @@ -0,0 +1 @@ +10 5 diff --git a/codenet/public_test_cases/p00312/input.2.txt b/codenet/public_test_cases/p00312/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..883251633a21a0f0722f7aa96da5ae023fa2df5c --- /dev/null +++ b/codenet/public_test_cases/p00312/input.2.txt @@ -0,0 +1 @@ +7 4 diff --git a/codenet/public_test_cases/p00312/output.0.txt b/codenet/public_test_cases/p00312/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00312/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00312/output.1.txt b/codenet/public_test_cases/p00312/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00312/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00312/output.2.txt b/codenet/public_test_cases/p00312/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00312/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00313/input.0.txt b/codenet/public_test_cases/p00313/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..500f168a95fbf21232cfb70b4e4c7fedb0a9c989 --- /dev/null +++ b/codenet/public_test_cases/p00313/input.0.txt @@ -0,0 +1,4 @@ +5 +3 1 2 3 +2 4 5 +2 3 4 diff --git a/codenet/public_test_cases/p00313/input.1.txt b/codenet/public_test_cases/p00313/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..500f168a95fbf21232cfb70b4e4c7fedb0a9c989 --- /dev/null +++ b/codenet/public_test_cases/p00313/input.1.txt @@ -0,0 +1,4 @@ +5 +3 1 2 3 +2 4 5 +2 3 4 diff --git a/codenet/public_test_cases/p00313/input.2.txt b/codenet/public_test_cases/p00313/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6617ccb49b14a8d268c45673c5a1e2dc29663bfd --- /dev/null +++ b/codenet/public_test_cases/p00313/input.2.txt @@ -0,0 +1,4 @@ +100 +3 1 100 4 +0 +2 2 3 diff --git a/codenet/public_test_cases/p00313/output.0.txt b/codenet/public_test_cases/p00313/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00313/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00313/output.1.txt b/codenet/public_test_cases/p00313/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00313/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00313/output.2.txt b/codenet/public_test_cases/p00313/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00313/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00314/input.0.txt b/codenet/public_test_cases/p00314/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..811330c78c462efd4519067bf4c706af0decf360 --- /dev/null +++ b/codenet/public_test_cases/p00314/input.0.txt @@ -0,0 +1,2 @@ +7 +5 4 3 10 2 4 1 diff --git a/codenet/public_test_cases/p00314/input.1.txt b/codenet/public_test_cases/p00314/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..811330c78c462efd4519067bf4c706af0decf360 --- /dev/null +++ b/codenet/public_test_cases/p00314/input.1.txt @@ -0,0 +1,2 @@ +7 +5 4 3 10 2 4 1 diff --git a/codenet/public_test_cases/p00314/input.2.txt b/codenet/public_test_cases/p00314/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..42e1fa7d956c2088f593d8c7a69a831a394aaec5 --- /dev/null +++ b/codenet/public_test_cases/p00314/input.2.txt @@ -0,0 +1,2 @@ +3 +1 1 100 diff --git a/codenet/public_test_cases/p00314/input.3.txt b/codenet/public_test_cases/p00314/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9644da5b07677840117414553684c1bfde82316 --- /dev/null +++ b/codenet/public_test_cases/p00314/input.3.txt @@ -0,0 +1,2 @@ +4 +11 15 58 1 diff --git a/codenet/public_test_cases/p00314/output.0.txt b/codenet/public_test_cases/p00314/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00314/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00314/output.1.txt b/codenet/public_test_cases/p00314/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00314/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00314/output.2.txt b/codenet/public_test_cases/p00314/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00314/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00314/output.3.txt b/codenet/public_test_cases/p00314/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00314/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00315/input.0.txt b/codenet/public_test_cases/p00315/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dec86ee78febfcb08b30d86a3e9fb7f0314be580 --- /dev/null +++ b/codenet/public_test_cases/p00315/input.0.txt @@ -0,0 +1,25 @@ +7 8 +00100000 +00011000 +10111101 +01100110 +01000110 +10111101 +00011000 +00100100 +2 +5 3 +1 6 +1 +6 8 +3 +6 8 +3 3 +3 6 +2 +6 3 +6 6 +0 +2 +3 8 +6 8 diff --git a/codenet/public_test_cases/p00315/input.1.txt b/codenet/public_test_cases/p00315/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29bed0313978cc27edb4fbb5bcd09aa1f47f6c76 --- /dev/null +++ b/codenet/public_test_cases/p00315/input.1.txt @@ -0,0 +1,7 @@ +1 6 +000000 +000000 +010010 +010010 +000000 +000000 diff --git a/codenet/public_test_cases/p00315/input.2.txt b/codenet/public_test_cases/p00315/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dec86ee78febfcb08b30d86a3e9fb7f0314be580 --- /dev/null +++ b/codenet/public_test_cases/p00315/input.2.txt @@ -0,0 +1,25 @@ +7 8 +00100000 +00011000 +10111101 +01100110 +01000110 +10111101 +00011000 +00100100 +2 +5 3 +1 6 +1 +6 8 +3 +6 8 +3 3 +3 6 +2 +6 3 +6 6 +0 +2 +3 8 +6 8 diff --git a/codenet/public_test_cases/p00315/input.3.txt b/codenet/public_test_cases/p00315/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..390b5cb3a1b53f190d7fc95927998dbebab05c2b --- /dev/null +++ b/codenet/public_test_cases/p00315/input.3.txt @@ -0,0 +1,8 @@ +2 2 +00 +00 +4 +1 1 +1 2 +2 1 +2 2 diff --git a/codenet/public_test_cases/p00315/output.0.txt b/codenet/public_test_cases/p00315/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00315/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00315/output.1.txt b/codenet/public_test_cases/p00315/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00315/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00315/output.2.txt b/codenet/public_test_cases/p00315/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00315/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00315/output.3.txt b/codenet/public_test_cases/p00315/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00315/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00316/input.0.txt b/codenet/public_test_cases/p00316/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45f0f285e4a5b1396b22efb84aba3eb31a02beea --- /dev/null +++ b/codenet/public_test_cases/p00316/input.0.txt @@ -0,0 +1,6 @@ +3 2 5 +1 1 2 +1 2 3 +2 1 1 +2 3 2 +2 2 1 diff --git a/codenet/public_test_cases/p00316/input.1.txt b/codenet/public_test_cases/p00316/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45f0f285e4a5b1396b22efb84aba3eb31a02beea --- /dev/null +++ b/codenet/public_test_cases/p00316/input.1.txt @@ -0,0 +1,6 @@ +3 2 5 +1 1 2 +1 2 3 +2 1 1 +2 3 2 +2 2 1 diff --git a/codenet/public_test_cases/p00316/input.2.txt b/codenet/public_test_cases/p00316/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cc25a016cd8d7d64996b4d59bdee2c3b2c69079 --- /dev/null +++ b/codenet/public_test_cases/p00316/input.2.txt @@ -0,0 +1,5 @@ +3 2 4 +1 1 2 +2 1 1 +2 3 2 +2 2 1 diff --git a/codenet/public_test_cases/p00316/input.3.txt b/codenet/public_test_cases/p00316/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfbefd07881321968131bb843e998e23555c534a --- /dev/null +++ b/codenet/public_test_cases/p00316/input.3.txt @@ -0,0 +1,3 @@ +3 2 2 +1 1 2 +2 1 1 diff --git a/codenet/public_test_cases/p00316/output.0.txt b/codenet/public_test_cases/p00316/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00316/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00316/output.1.txt b/codenet/public_test_cases/p00316/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00316/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00316/output.2.txt b/codenet/public_test_cases/p00316/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00316/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00316/output.3.txt b/codenet/public_test_cases/p00316/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00316/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00317/input.0.txt b/codenet/public_test_cases/p00317/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4c6b1ed38117479d56151b7f63a564af2498642 --- /dev/null +++ b/codenet/public_test_cases/p00317/input.0.txt @@ -0,0 +1,10 @@ +5 4 +aloe +apple +apricot +cactus +cat +apple +ap* +*e +ca?* diff --git a/codenet/public_test_cases/p00317/input.1.txt b/codenet/public_test_cases/p00317/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4c6b1ed38117479d56151b7f63a564af2498642 --- /dev/null +++ b/codenet/public_test_cases/p00317/input.1.txt @@ -0,0 +1,10 @@ +5 4 +aloe +apple +apricot +cactus +cat +apple +ap* +*e +ca?* diff --git a/codenet/public_test_cases/p00317/output.0.txt b/codenet/public_test_cases/p00317/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cb54d9ad3e3bfb02c8c32bbed8f60b859d86637 --- /dev/null +++ b/codenet/public_test_cases/p00317/output.0.txt @@ -0,0 +1,4 @@ +1 +2 +2 +2 diff --git a/codenet/public_test_cases/p00317/output.1.txt b/codenet/public_test_cases/p00317/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cb54d9ad3e3bfb02c8c32bbed8f60b859d86637 --- /dev/null +++ b/codenet/public_test_cases/p00317/output.1.txt @@ -0,0 +1,4 @@ +1 +2 +2 +2 diff --git a/codenet/public_test_cases/p00318/input.0.txt b/codenet/public_test_cases/p00318/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..146a2b98c20df0e1d2261642f2565619a4e7fe11 --- /dev/null +++ b/codenet/public_test_cases/p00318/input.0.txt @@ -0,0 +1,3 @@ +2 +0 2 +1 2 diff --git a/codenet/public_test_cases/p00318/input.1.txt b/codenet/public_test_cases/p00318/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5662c2ff0bba8d85c4d8d2a5b1a71c1815191b6 --- /dev/null +++ b/codenet/public_test_cases/p00318/input.1.txt @@ -0,0 +1,4 @@ +3 +0 3 +1 2 +2 1 diff --git a/codenet/public_test_cases/p00318/input.2.txt b/codenet/public_test_cases/p00318/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..146a2b98c20df0e1d2261642f2565619a4e7fe11 --- /dev/null +++ b/codenet/public_test_cases/p00318/input.2.txt @@ -0,0 +1,3 @@ +2 +0 2 +1 2 diff --git a/codenet/public_test_cases/p00318/input.3.txt b/codenet/public_test_cases/p00318/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c7e63f245e0bacfb6e8bbba1d8caed48ee14fa5 --- /dev/null +++ b/codenet/public_test_cases/p00318/input.3.txt @@ -0,0 +1,3 @@ +2 +0 1 +3 2 diff --git a/codenet/public_test_cases/p00318/output.0.txt b/codenet/public_test_cases/p00318/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da14cf0728c6043935ad3717b0005d7caeeadac8 --- /dev/null +++ b/codenet/public_test_cases/p00318/output.0.txt @@ -0,0 +1 @@ +1.936 diff --git a/codenet/public_test_cases/p00318/output.1.txt b/codenet/public_test_cases/p00318/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3827e75a5cadb9fe4a27e1cb9b6d192e7323120 --- /dev/null +++ b/codenet/public_test_cases/p00318/output.1.txt @@ -0,0 +1 @@ +1.0 diff --git a/codenet/public_test_cases/p00318/output.2.txt b/codenet/public_test_cases/p00318/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..da14cf0728c6043935ad3717b0005d7caeeadac8 --- /dev/null +++ b/codenet/public_test_cases/p00318/output.2.txt @@ -0,0 +1 @@ +1.936 diff --git a/codenet/public_test_cases/p00318/output.3.txt b/codenet/public_test_cases/p00318/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba66466c2a0d0a1080ad71d8e1a67a97f336c384 --- /dev/null +++ b/codenet/public_test_cases/p00318/output.3.txt @@ -0,0 +1 @@ +0.0 diff --git a/codenet/public_test_cases/p00319/input.0.txt b/codenet/public_test_cases/p00319/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08eb3253007e85bc6d059323ce7a1739ba82bb8f --- /dev/null +++ b/codenet/public_test_cases/p00319/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 2 +2 3 1 2 +1 3 1 3 diff --git a/codenet/public_test_cases/p00319/input.1.txt b/codenet/public_test_cases/p00319/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d3f4e5e829bf2d6f60a6421913a61a6ff3990d8 --- /dev/null +++ b/codenet/public_test_cases/p00319/input.1.txt @@ -0,0 +1,6 @@ +4 5 +1 2 3 5 +1 3 1 3 +3 2 2 5 +2 4 6 1 +3 4 5 5 diff --git a/codenet/public_test_cases/p00319/input.2.txt b/codenet/public_test_cases/p00319/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..08eb3253007e85bc6d059323ce7a1739ba82bb8f --- /dev/null +++ b/codenet/public_test_cases/p00319/input.2.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 2 +2 3 1 2 +1 3 1 3 diff --git a/codenet/public_test_cases/p00319/input.3.txt b/codenet/public_test_cases/p00319/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5df5ceb8f4350c8e9467d69f52363e4c51779534 --- /dev/null +++ b/codenet/public_test_cases/p00319/input.3.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 2 +2 3 1 2 +1 3 1 1 diff --git a/codenet/public_test_cases/p00319/output.0.txt b/codenet/public_test_cases/p00319/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00319/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00319/output.1.txt b/codenet/public_test_cases/p00319/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p00319/output.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p00319/output.2.txt b/codenet/public_test_cases/p00319/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00319/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00319/output.3.txt b/codenet/public_test_cases/p00319/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00319/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00320/input.0.txt b/codenet/public_test_cases/p00320/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ace1e9f2438006953c076f9f4dc6382749d15d47 --- /dev/null +++ b/codenet/public_test_cases/p00320/input.0.txt @@ -0,0 +1,6 @@ +2 2 +2 3 +2 3 +2 3 +2 2 +3 2 diff --git a/codenet/public_test_cases/p00320/input.1.txt b/codenet/public_test_cases/p00320/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ace1e9f2438006953c076f9f4dc6382749d15d47 --- /dev/null +++ b/codenet/public_test_cases/p00320/input.1.txt @@ -0,0 +1,6 @@ +2 2 +2 3 +2 3 +2 3 +2 2 +3 2 diff --git a/codenet/public_test_cases/p00320/input.2.txt b/codenet/public_test_cases/p00320/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1754937926ab27828b99a24e64e27faf813a5bd0 --- /dev/null +++ b/codenet/public_test_cases/p00320/input.2.txt @@ -0,0 +1,6 @@ +2 2 +2 3 +2 3 +2 3 +2 2 +2 2 diff --git a/codenet/public_test_cases/p00320/output.0.txt b/codenet/public_test_cases/p00320/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00320/output.0.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00320/output.1.txt b/codenet/public_test_cases/p00320/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00320/output.1.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00320/output.2.txt b/codenet/public_test_cases/p00320/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00320/output.2.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00321/input.0.txt b/codenet/public_test_cases/p00321/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9dd34d0757947dfe36366f92a0743140e1b40b79 --- /dev/null +++ b/codenet/public_test_cases/p00321/input.0.txt @@ -0,0 +1,6 @@ +5 2 +3 bread milk banana +2 milk cornflakes +3 potato bread milk +4 cornflakes bread milk butter +2 potato bread diff --git a/codenet/public_test_cases/p00321/input.1.txt b/codenet/public_test_cases/p00321/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae8ce9abcaa70d0095bdb75e5bab7a5d957f3d7f --- /dev/null +++ b/codenet/public_test_cases/p00321/input.1.txt @@ -0,0 +1,6 @@ +5 5 +3 bread milk banana +2 milk cornflakes +3 potato bread milk +4 cornflakes bread milk butter +2 potato bread diff --git a/codenet/public_test_cases/p00321/input.2.txt b/codenet/public_test_cases/p00321/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9dd34d0757947dfe36366f92a0743140e1b40b79 --- /dev/null +++ b/codenet/public_test_cases/p00321/input.2.txt @@ -0,0 +1,6 @@ +5 2 +3 bread milk banana +2 milk cornflakes +3 potato bread milk +4 cornflakes bread milk butter +2 potato bread diff --git a/codenet/public_test_cases/p00321/output.0.txt b/codenet/public_test_cases/p00321/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bef41159448f211b5f9055c1dcc53a68ac173ce --- /dev/null +++ b/codenet/public_test_cases/p00321/output.0.txt @@ -0,0 +1,4 @@ +3 +bread milk +bread potato +cornflakes milk diff --git a/codenet/public_test_cases/p00321/output.1.txt b/codenet/public_test_cases/p00321/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00321/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00321/output.2.txt b/codenet/public_test_cases/p00321/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bef41159448f211b5f9055c1dcc53a68ac173ce --- /dev/null +++ b/codenet/public_test_cases/p00321/output.2.txt @@ -0,0 +1,4 @@ +3 +bread milk +bread potato +cornflakes milk diff --git a/codenet/public_test_cases/p00322/input.0.txt b/codenet/public_test_cases/p00322/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18c79074692dd262e90a8a4a275faa96ca2bc94f --- /dev/null +++ b/codenet/public_test_cases/p00322/input.0.txt @@ -0,0 +1 @@ +7 6 -1 1 -1 9 2 3 4 diff --git a/codenet/public_test_cases/p00322/input.1.txt b/codenet/public_test_cases/p00322/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a892f7f98c532dd14cf34f2e4cf1ca68a76a3f5 --- /dev/null +++ b/codenet/public_test_cases/p00322/input.1.txt @@ -0,0 +1 @@ +7 6 5 1 8 9 2 3 4 diff --git a/codenet/public_test_cases/p00322/input.2.txt b/codenet/public_test_cases/p00322/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a661242336851cfe9461034aa87c08140eca2871 --- /dev/null +++ b/codenet/public_test_cases/p00322/input.2.txt @@ -0,0 +1 @@ +-1 -1 -1 -1 -1 -1 8 4 6 diff --git a/codenet/public_test_cases/p00322/input.3.txt b/codenet/public_test_cases/p00322/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..18c79074692dd262e90a8a4a275faa96ca2bc94f --- /dev/null +++ b/codenet/public_test_cases/p00322/input.3.txt @@ -0,0 +1 @@ +7 6 -1 1 -1 9 2 3 4 diff --git a/codenet/public_test_cases/p00322/input.4.txt b/codenet/public_test_cases/p00322/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..553c692d1456bb9dd76c5a9607b1709a1c2faa10 --- /dev/null +++ b/codenet/public_test_cases/p00322/input.4.txt @@ -0,0 +1 @@ +-1 -1 -1 -1 -1 -1 -1 -1 -1 diff --git a/codenet/public_test_cases/p00322/output.0.txt b/codenet/public_test_cases/p00322/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00322/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00322/output.1.txt b/codenet/public_test_cases/p00322/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00322/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00322/output.2.txt b/codenet/public_test_cases/p00322/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p00322/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p00322/output.3.txt b/codenet/public_test_cases/p00322/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00322/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00322/output.4.txt b/codenet/public_test_cases/p00322/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..de8febe1c7474dee3415470d6c7bdade54ad1865 --- /dev/null +++ b/codenet/public_test_cases/p00322/output.4.txt @@ -0,0 +1 @@ +168 diff --git a/codenet/public_test_cases/p00323/input.0.txt b/codenet/public_test_cases/p00323/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..df49ef0b0b1c9e8146998a4d77e27d3931a09dc5 --- /dev/null +++ b/codenet/public_test_cases/p00323/input.0.txt @@ -0,0 +1,4 @@ +3 +2 1 +1 3 +2 2 diff --git a/codenet/public_test_cases/p00323/input.1.txt b/codenet/public_test_cases/p00323/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d1de6fc25b29f860a9305faaec6706bf19a30dd --- /dev/null +++ b/codenet/public_test_cases/p00323/input.1.txt @@ -0,0 +1,2 @@ +1 +100000 2 diff --git a/codenet/public_test_cases/p00323/input.2.txt b/codenet/public_test_cases/p00323/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..df49ef0b0b1c9e8146998a4d77e27d3931a09dc5 --- /dev/null +++ b/codenet/public_test_cases/p00323/input.2.txt @@ -0,0 +1,4 @@ +3 +2 1 +1 3 +2 2 diff --git a/codenet/public_test_cases/p00323/output.0.txt b/codenet/public_test_cases/p00323/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc396bddcc91e00e77a94940cfbc1eced3cead97 --- /dev/null +++ b/codenet/public_test_cases/p00323/output.0.txt @@ -0,0 +1,2 @@ +3 0 +5 0 diff --git a/codenet/public_test_cases/p00323/output.1.txt b/codenet/public_test_cases/p00323/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db58a0bf23164f67a1dbc6aa0f1521e7183bd36e --- /dev/null +++ b/codenet/public_test_cases/p00323/output.1.txt @@ -0,0 +1 @@ +100002 0 diff --git a/codenet/public_test_cases/p00323/output.2.txt b/codenet/public_test_cases/p00323/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc396bddcc91e00e77a94940cfbc1eced3cead97 --- /dev/null +++ b/codenet/public_test_cases/p00323/output.2.txt @@ -0,0 +1,2 @@ +3 0 +5 0 diff --git a/codenet/public_test_cases/p00324/input.0.txt b/codenet/public_test_cases/p00324/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffe67d04bb731fb032348c6069e1636652787253 --- /dev/null +++ b/codenet/public_test_cases/p00324/input.0.txt @@ -0,0 +1,6 @@ +5 +18 +102 +-155 +53 +32 diff --git a/codenet/public_test_cases/p00324/input.1.txt b/codenet/public_test_cases/p00324/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcb9f2ece5f5642ba3d9ff21634c6ffe271d1576 --- /dev/null +++ b/codenet/public_test_cases/p00324/input.1.txt @@ -0,0 +1,5 @@ +4 +1 +1 +-1 +-1 diff --git a/codenet/public_test_cases/p00324/input.2.txt b/codenet/public_test_cases/p00324/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffe67d04bb731fb032348c6069e1636652787253 --- /dev/null +++ b/codenet/public_test_cases/p00324/input.2.txt @@ -0,0 +1,6 @@ +5 +18 +102 +-155 +53 +32 diff --git a/codenet/public_test_cases/p00324/output.0.txt b/codenet/public_test_cases/p00324/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00324/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00324/output.1.txt b/codenet/public_test_cases/p00324/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00324/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00324/output.2.txt b/codenet/public_test_cases/p00324/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00324/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00325/input.0.txt b/codenet/public_test_cases/p00325/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3da5076fa4741a43729023c23d215fed763e0c69 --- /dev/null +++ b/codenet/public_test_cases/p00325/input.0.txt @@ -0,0 +1,7 @@ +6 +10 SET c 1 +20 SET i 5 +100 ADD s s i +110 SUB i i c +120 IF i 100 +200 HALT diff --git a/codenet/public_test_cases/p00325/input.1.txt b/codenet/public_test_cases/p00325/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c16c19c9bc2a6fc2eea66dd378979c4bc8036be1 --- /dev/null +++ b/codenet/public_test_cases/p00325/input.1.txt @@ -0,0 +1,4 @@ +3 +111 SET c 1 +12 SUB c c 2 +777 SET a 4 diff --git a/codenet/public_test_cases/p00325/input.2.txt b/codenet/public_test_cases/p00325/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ac60f304ff1871c6761b9665e26c83a7237242a --- /dev/null +++ b/codenet/public_test_cases/p00325/input.2.txt @@ -0,0 +1,4 @@ +3 +10 SET c 1 +120 IF c 10 +20 HALT diff --git a/codenet/public_test_cases/p00325/input.3.txt b/codenet/public_test_cases/p00325/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3da5076fa4741a43729023c23d215fed763e0c69 --- /dev/null +++ b/codenet/public_test_cases/p00325/input.3.txt @@ -0,0 +1,7 @@ +6 +10 SET c 1 +20 SET i 5 +100 ADD s s i +110 SUB i i c +120 IF i 100 +200 HALT diff --git a/codenet/public_test_cases/p00325/output.0.txt b/codenet/public_test_cases/p00325/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd7af8886991fd8b142a4a5c6db06402d56cce84 --- /dev/null +++ b/codenet/public_test_cases/p00325/output.0.txt @@ -0,0 +1,3 @@ +c=1 +i=0 +s=15 diff --git a/codenet/public_test_cases/p00325/output.1.txt b/codenet/public_test_cases/p00325/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58d0245f1184d6b558644b7b693bdd6ef7d7d4eb --- /dev/null +++ b/codenet/public_test_cases/p00325/output.1.txt @@ -0,0 +1,2 @@ +a=0 +c=1 diff --git a/codenet/public_test_cases/p00325/output.2.txt b/codenet/public_test_cases/p00325/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8484d062f57dd9d5606ee2db1c06424879fd62f4 --- /dev/null +++ b/codenet/public_test_cases/p00325/output.2.txt @@ -0,0 +1 @@ +inf diff --git a/codenet/public_test_cases/p00325/output.3.txt b/codenet/public_test_cases/p00325/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd7af8886991fd8b142a4a5c6db06402d56cce84 --- /dev/null +++ b/codenet/public_test_cases/p00325/output.3.txt @@ -0,0 +1,3 @@ +c=1 +i=0 +s=15 diff --git a/codenet/public_test_cases/p00326/input.0.txt b/codenet/public_test_cases/p00326/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6060be34a5a0f81706b19e3ade4b78ab4937cf3e --- /dev/null +++ b/codenet/public_test_cases/p00326/input.0.txt @@ -0,0 +1,11 @@ +5 3 +1 5 2 +3 8 5 +1 2 3 +5 5 5 +4 8 2 +0 +1 2 3 +2 +2 2 3 1 +4 3 1 2 diff --git a/codenet/public_test_cases/p00326/input.1.txt b/codenet/public_test_cases/p00326/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6060be34a5a0f81706b19e3ade4b78ab4937cf3e --- /dev/null +++ b/codenet/public_test_cases/p00326/input.1.txt @@ -0,0 +1,11 @@ +5 3 +1 5 2 +3 8 5 +1 2 3 +5 5 5 +4 8 2 +0 +1 2 3 +2 +2 2 3 1 +4 3 1 2 diff --git a/codenet/public_test_cases/p00326/input.2.txt b/codenet/public_test_cases/p00326/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d343d0ed52dcdba569d6445d1fe96f5c64228c25 --- /dev/null +++ b/codenet/public_test_cases/p00326/input.2.txt @@ -0,0 +1,13 @@ +5 2 +1 1 +2 1 +3 1 +4 4 +5 2 +3 +1 4 +2 4 +2 5 +1 2 +1 +3 2 1 diff --git a/codenet/public_test_cases/p00326/output.0.txt b/codenet/public_test_cases/p00326/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc3a930eceede1ae71ee46c03feaa35659bedc77 --- /dev/null +++ b/codenet/public_test_cases/p00326/output.0.txt @@ -0,0 +1,5 @@ +4 +5 +2 +1 +3 diff --git a/codenet/public_test_cases/p00326/output.1.txt b/codenet/public_test_cases/p00326/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc3a930eceede1ae71ee46c03feaa35659bedc77 --- /dev/null +++ b/codenet/public_test_cases/p00326/output.1.txt @@ -0,0 +1,5 @@ +4 +5 +2 +1 +3 diff --git a/codenet/public_test_cases/p00326/output.2.txt b/codenet/public_test_cases/p00326/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..17bddaebe8df5f5d7c62ed93075570d6699eac02 --- /dev/null +++ b/codenet/public_test_cases/p00326/output.2.txt @@ -0,0 +1,5 @@ +3 +2 +5 +1 +4 diff --git a/codenet/public_test_cases/p00327/input.0.txt b/codenet/public_test_cases/p00327/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c265366a937dae4567531bdf8573941743bb8708 --- /dev/null +++ b/codenet/public_test_cases/p00327/input.0.txt @@ -0,0 +1,2 @@ +8 +1 2 3 3 2 1 2 2 diff --git a/codenet/public_test_cases/p00327/input.1.txt b/codenet/public_test_cases/p00327/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b5b994e878496304cef8846613405b2b958692c --- /dev/null +++ b/codenet/public_test_cases/p00327/input.1.txt @@ -0,0 +1,2 @@ +5 +1 1 2 2 1 diff --git a/codenet/public_test_cases/p00327/input.2.txt b/codenet/public_test_cases/p00327/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c265366a937dae4567531bdf8573941743bb8708 --- /dev/null +++ b/codenet/public_test_cases/p00327/input.2.txt @@ -0,0 +1,2 @@ +8 +1 2 3 3 2 1 2 2 diff --git a/codenet/public_test_cases/p00327/input.3.txt b/codenet/public_test_cases/p00327/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..12da52257cba05fc3a63931bf642f8cb48a4e99f --- /dev/null +++ b/codenet/public_test_cases/p00327/input.3.txt @@ -0,0 +1,2 @@ +16 +9 8 8 7 7 6 5 4 4 5 1 1 2 2 3 3 diff --git a/codenet/public_test_cases/p00327/input.4.txt b/codenet/public_test_cases/p00327/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..179fdeeefbc7e0f54c9d5cf29c34476d168c25fd --- /dev/null +++ b/codenet/public_test_cases/p00327/input.4.txt @@ -0,0 +1,2 @@ +7 +1 2 2 1 1 3 3 diff --git a/codenet/public_test_cases/p00327/output.0.txt b/codenet/public_test_cases/p00327/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00327/output.0.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00327/output.1.txt b/codenet/public_test_cases/p00327/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00327/output.1.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00327/output.2.txt b/codenet/public_test_cases/p00327/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00327/output.2.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00327/output.3.txt b/codenet/public_test_cases/p00327/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00327/output.3.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00327/output.4.txt b/codenet/public_test_cases/p00327/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00327/output.4.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00328/input.0.txt b/codenet/public_test_cases/p00328/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..26009a3faa5d49c880deb90dbc2a19cfbe07214e --- /dev/null +++ b/codenet/public_test_cases/p00328/input.0.txt @@ -0,0 +1,10 @@ +9 +0 2 5 2 +1 3 1 7 +0 6 3 6 +2 4 8 4 +4 0 4 5 +6 3 6 0 +5 6 7 6 +8 3 8 7 +6 5 11 5 diff --git a/codenet/public_test_cases/p00328/input.1.txt b/codenet/public_test_cases/p00328/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..26009a3faa5d49c880deb90dbc2a19cfbe07214e --- /dev/null +++ b/codenet/public_test_cases/p00328/input.1.txt @@ -0,0 +1,10 @@ +9 +0 2 5 2 +1 3 1 7 +0 6 3 6 +2 4 8 4 +4 0 4 5 +6 3 6 0 +5 6 7 6 +8 3 8 7 +6 5 11 5 diff --git a/codenet/public_test_cases/p00328/output.0.txt b/codenet/public_test_cases/p00328/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..49993ce401f9635aa83d2de6278c7759f2d20d72 --- /dev/null +++ b/codenet/public_test_cases/p00328/output.0.txt @@ -0,0 +1,9 @@ +1 +1 +0 +1 +0 +1 +1 +0 +1 diff --git a/codenet/public_test_cases/p00328/output.1.txt b/codenet/public_test_cases/p00328/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..49993ce401f9635aa83d2de6278c7759f2d20d72 --- /dev/null +++ b/codenet/public_test_cases/p00328/output.1.txt @@ -0,0 +1,9 @@ +1 +1 +0 +1 +0 +1 +1 +0 +1 diff --git a/codenet/public_test_cases/p00329/input.0.txt b/codenet/public_test_cases/p00329/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be9bc97df601046c8a8267b6126469188db665e4 --- /dev/null +++ b/codenet/public_test_cases/p00329/input.0.txt @@ -0,0 +1,6 @@ +6 +1 0 0 0 1 +1 0 1 0 1 +0 1 0 1 0 +0 0 0 1 0 +0 1 0 0 1 diff --git a/codenet/public_test_cases/p00329/input.1.txt b/codenet/public_test_cases/p00329/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a697427e90f721d99434478d5dbb1c536cd0557f --- /dev/null +++ b/codenet/public_test_cases/p00329/input.1.txt @@ -0,0 +1,5 @@ +5 +1 0 0 1 +0 1 0 1 +1 0 0 0 +0 1 0 1 diff --git a/codenet/public_test_cases/p00329/input.2.txt b/codenet/public_test_cases/p00329/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a4255ddaec24a45268334b2ff1e3f80cc574287 --- /dev/null +++ b/codenet/public_test_cases/p00329/input.2.txt @@ -0,0 +1,5 @@ +5 +0 1 0 1 +0 1 0 1 +1 0 1 0 +1 0 0 1 diff --git a/codenet/public_test_cases/p00329/input.3.txt b/codenet/public_test_cases/p00329/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..be9bc97df601046c8a8267b6126469188db665e4 --- /dev/null +++ b/codenet/public_test_cases/p00329/input.3.txt @@ -0,0 +1,6 @@ +6 +1 0 0 0 1 +1 0 1 0 1 +0 1 0 1 0 +0 0 0 1 0 +0 1 0 0 1 diff --git a/codenet/public_test_cases/p00329/output.0.txt b/codenet/public_test_cases/p00329/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fee0368bf6d3015cc12d057154d3cce614a344bd --- /dev/null +++ b/codenet/public_test_cases/p00329/output.0.txt @@ -0,0 +1,6 @@ +yes +1 +3 +2 +4 +5 diff --git a/codenet/public_test_cases/p00329/output.1.txt b/codenet/public_test_cases/p00329/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00329/output.1.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00329/output.2.txt b/codenet/public_test_cases/p00329/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..899a49b9085c9da660221aef8af5af543a4fa389 --- /dev/null +++ b/codenet/public_test_cases/p00329/output.2.txt @@ -0,0 +1,5 @@ +yes +4 +1 +3 +2 diff --git a/codenet/public_test_cases/p00329/output.3.txt b/codenet/public_test_cases/p00329/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fee0368bf6d3015cc12d057154d3cce614a344bd --- /dev/null +++ b/codenet/public_test_cases/p00329/output.3.txt @@ -0,0 +1,6 @@ +yes +1 +3 +2 +4 +5 diff --git a/codenet/public_test_cases/p00330/input.0.txt b/codenet/public_test_cases/p00330/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00330/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00330/input.1.txt b/codenet/public_test_cases/p00330/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00330/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00330/input.2.txt b/codenet/public_test_cases/p00330/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00330/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00330/output.0.txt b/codenet/public_test_cases/p00330/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a949a93dfcca659638ff00284e1d1703accef77a --- /dev/null +++ b/codenet/public_test_cases/p00330/output.0.txt @@ -0,0 +1 @@ +128 diff --git a/codenet/public_test_cases/p00330/output.1.txt b/codenet/public_test_cases/p00330/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a949a93dfcca659638ff00284e1d1703accef77a --- /dev/null +++ b/codenet/public_test_cases/p00330/output.1.txt @@ -0,0 +1 @@ +128 diff --git a/codenet/public_test_cases/p00330/output.2.txt b/codenet/public_test_cases/p00330/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f906e1845dc9a277bd1a44cddccef74038e38367 --- /dev/null +++ b/codenet/public_test_cases/p00330/output.2.txt @@ -0,0 +1 @@ +96 diff --git a/codenet/public_test_cases/p00331/input.0.txt b/codenet/public_test_cases/p00331/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad3ed436a561dce4fc98362dd6d60e0b6d496a62 --- /dev/null +++ b/codenet/public_test_cases/p00331/input.0.txt @@ -0,0 +1 @@ +-3 3 diff --git a/codenet/public_test_cases/p00331/input.1.txt b/codenet/public_test_cases/p00331/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p00331/input.1.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p00331/input.2.txt b/codenet/public_test_cases/p00331/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad3ed436a561dce4fc98362dd6d60e0b6d496a62 --- /dev/null +++ b/codenet/public_test_cases/p00331/input.2.txt @@ -0,0 +1 @@ +-3 3 diff --git a/codenet/public_test_cases/p00331/input.3.txt b/codenet/public_test_cases/p00331/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..344022bab630b416efec48499d42991e9e17be7e --- /dev/null +++ b/codenet/public_test_cases/p00331/input.3.txt @@ -0,0 +1 @@ +-4 3 diff --git a/codenet/public_test_cases/p00331/output.0.txt b/codenet/public_test_cases/p00331/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00331/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00331/output.1.txt b/codenet/public_test_cases/p00331/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00331/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00331/output.2.txt b/codenet/public_test_cases/p00331/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00331/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00331/output.3.txt b/codenet/public_test_cases/p00331/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p00331/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p00332/input.0.txt b/codenet/public_test_cases/p00332/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8cb283848db6740c247d6fd99e7ffe9194ec5e --- /dev/null +++ b/codenet/public_test_cases/p00332/input.0.txt @@ -0,0 +1 @@ +0 2015 diff --git a/codenet/public_test_cases/p00332/input.1.txt b/codenet/public_test_cases/p00332/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8cb283848db6740c247d6fd99e7ffe9194ec5e --- /dev/null +++ b/codenet/public_test_cases/p00332/input.1.txt @@ -0,0 +1 @@ +0 2015 diff --git a/codenet/public_test_cases/p00332/input.2.txt b/codenet/public_test_cases/p00332/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4bb03f6514a8d4eb204920c1a607b0eb25a41f5 --- /dev/null +++ b/codenet/public_test_cases/p00332/input.2.txt @@ -0,0 +1 @@ +0 1912 diff --git a/codenet/public_test_cases/p00332/input.3.txt b/codenet/public_test_cases/p00332/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c0be994f48951c116b10827fd15d9bc9f7696 --- /dev/null +++ b/codenet/public_test_cases/p00332/input.3.txt @@ -0,0 +1 @@ +4 28 diff --git a/codenet/public_test_cases/p00332/input.4.txt b/codenet/public_test_cases/p00332/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p00332/input.4.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p00332/output.0.txt b/codenet/public_test_cases/p00332/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b86a2e21ad8c4bb8058b530eea19ebaf34ba1767 --- /dev/null +++ b/codenet/public_test_cases/p00332/output.0.txt @@ -0,0 +1 @@ +H27 diff --git a/codenet/public_test_cases/p00332/output.1.txt b/codenet/public_test_cases/p00332/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b86a2e21ad8c4bb8058b530eea19ebaf34ba1767 --- /dev/null +++ b/codenet/public_test_cases/p00332/output.1.txt @@ -0,0 +1 @@ +H27 diff --git a/codenet/public_test_cases/p00332/output.2.txt b/codenet/public_test_cases/p00332/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..df24da6de0a71f37a7dbeefdb97dccfdce4f5431 --- /dev/null +++ b/codenet/public_test_cases/p00332/output.2.txt @@ -0,0 +1 @@ +T1 diff --git a/codenet/public_test_cases/p00332/output.3.txt b/codenet/public_test_cases/p00332/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f6d045ba55368ee9da6be4da284ab966456e8dc --- /dev/null +++ b/codenet/public_test_cases/p00332/output.3.txt @@ -0,0 +1 @@ +2016 diff --git a/codenet/public_test_cases/p00332/output.4.txt b/codenet/public_test_cases/p00332/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..23e07fb71b3f988e44853721a99fe76686f17270 --- /dev/null +++ b/codenet/public_test_cases/p00332/output.4.txt @@ -0,0 +1 @@ +1912 diff --git a/codenet/public_test_cases/p00333/input.0.txt b/codenet/public_test_cases/p00333/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb66e6683d5456cce8395b8e65b3107c9dc28444 --- /dev/null +++ b/codenet/public_test_cases/p00333/input.0.txt @@ -0,0 +1 @@ +10 20 5 diff --git a/codenet/public_test_cases/p00333/input.1.txt b/codenet/public_test_cases/p00333/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbab1f59507ab3edd55e60e970b506a772ce2bb0 --- /dev/null +++ b/codenet/public_test_cases/p00333/input.1.txt @@ -0,0 +1 @@ +27 6 1 diff --git a/codenet/public_test_cases/p00333/input.2.txt b/codenet/public_test_cases/p00333/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb66e6683d5456cce8395b8e65b3107c9dc28444 --- /dev/null +++ b/codenet/public_test_cases/p00333/input.2.txt @@ -0,0 +1 @@ +10 20 5 diff --git a/codenet/public_test_cases/p00333/output.0.txt b/codenet/public_test_cases/p00333/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00333/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00333/output.1.txt b/codenet/public_test_cases/p00333/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p00333/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p00333/output.2.txt b/codenet/public_test_cases/p00333/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00333/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00334/input.0.txt b/codenet/public_test_cases/p00334/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a725b24b72ae4ae68a25dad50520b13e3c1ce34f --- /dev/null +++ b/codenet/public_test_cases/p00334/input.0.txt @@ -0,0 +1,5 @@ +4 +1 3 2 +1 2 4 +1 4 3 +2 3 4 diff --git a/codenet/public_test_cases/p00334/input.1.txt b/codenet/public_test_cases/p00334/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a725b24b72ae4ae68a25dad50520b13e3c1ce34f --- /dev/null +++ b/codenet/public_test_cases/p00334/input.1.txt @@ -0,0 +1,5 @@ +4 +1 3 2 +1 2 4 +1 4 3 +2 3 4 diff --git a/codenet/public_test_cases/p00334/input.2.txt b/codenet/public_test_cases/p00334/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b14d45f57f24db48497c152661e1360572d0034d --- /dev/null +++ b/codenet/public_test_cases/p00334/input.2.txt @@ -0,0 +1,7 @@ +6 +1 3 2 +1 2 4 +1 4 3 +2 3 4 +3 2 1 +2 3 1 diff --git a/codenet/public_test_cases/p00334/output.0.txt b/codenet/public_test_cases/p00334/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00334/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00334/output.1.txt b/codenet/public_test_cases/p00334/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00334/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00334/output.2.txt b/codenet/public_test_cases/p00334/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00334/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00335/input.0.txt b/codenet/public_test_cases/p00335/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56221aadc5dfac666c62fd57ad1536458c512851 --- /dev/null +++ b/codenet/public_test_cases/p00335/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 1 diff --git a/codenet/public_test_cases/p00335/input.1.txt b/codenet/public_test_cases/p00335/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18c7e30258ce235c39048d8178d025cfca552592 --- /dev/null +++ b/codenet/public_test_cases/p00335/input.1.txt @@ -0,0 +1,2 @@ +3 +0 3 0 diff --git a/codenet/public_test_cases/p00335/input.2.txt b/codenet/public_test_cases/p00335/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..56221aadc5dfac666c62fd57ad1536458c512851 --- /dev/null +++ b/codenet/public_test_cases/p00335/input.2.txt @@ -0,0 +1,2 @@ +3 +1 2 1 diff --git a/codenet/public_test_cases/p00335/output.0.txt b/codenet/public_test_cases/p00335/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00335/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00335/output.1.txt b/codenet/public_test_cases/p00335/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00335/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00335/output.2.txt b/codenet/public_test_cases/p00335/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00335/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00336/input.0.txt b/codenet/public_test_cases/p00336/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c70e9ba03b4bf760a013911ce4e5188745feab76 --- /dev/null +++ b/codenet/public_test_cases/p00336/input.0.txt @@ -0,0 +1,2 @@ +abab +ab diff --git a/codenet/public_test_cases/p00336/input.1.txt b/codenet/public_test_cases/p00336/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..618c57497391fd6f45e310a808536170518371f4 --- /dev/null +++ b/codenet/public_test_cases/p00336/input.1.txt @@ -0,0 +1,2 @@ +data +structure diff --git a/codenet/public_test_cases/p00336/input.2.txt b/codenet/public_test_cases/p00336/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..24b5b3d6552dc15ee794fc5bb342a83f604ca36f --- /dev/null +++ b/codenet/public_test_cases/p00336/input.2.txt @@ -0,0 +1,2 @@ +aaaabaaaabaaaabaaaab +aaaaa diff --git a/codenet/public_test_cases/p00336/input.3.txt b/codenet/public_test_cases/p00336/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c70e9ba03b4bf760a013911ce4e5188745feab76 --- /dev/null +++ b/codenet/public_test_cases/p00336/input.3.txt @@ -0,0 +1,2 @@ +abab +ab diff --git a/codenet/public_test_cases/p00336/output.0.txt b/codenet/public_test_cases/p00336/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00336/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00336/output.1.txt b/codenet/public_test_cases/p00336/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00336/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00336/output.2.txt b/codenet/public_test_cases/p00336/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb142a728733657b134404226417bd2462e1d8bb --- /dev/null +++ b/codenet/public_test_cases/p00336/output.2.txt @@ -0,0 +1 @@ +4368 diff --git a/codenet/public_test_cases/p00336/output.3.txt b/codenet/public_test_cases/p00336/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00336/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00337/input.0.txt b/codenet/public_test_cases/p00337/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a785b16c5e5278e4dae0514b771b8fa9090bda5 --- /dev/null +++ b/codenet/public_test_cases/p00337/input.0.txt @@ -0,0 +1,11 @@ +5 5 +0 0 +1 1 +3 0 +3 2 +0 2 +1 2 +2 3 +2 4 +3 4 +1 5 diff --git a/codenet/public_test_cases/p00337/input.1.txt b/codenet/public_test_cases/p00337/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a785b16c5e5278e4dae0514b771b8fa9090bda5 --- /dev/null +++ b/codenet/public_test_cases/p00337/input.1.txt @@ -0,0 +1,11 @@ +5 5 +0 0 +1 1 +3 0 +3 2 +0 2 +1 2 +2 3 +2 4 +3 4 +1 5 diff --git a/codenet/public_test_cases/p00337/input.2.txt b/codenet/public_test_cases/p00337/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3ec5578cfad0f899995f9ef92a16c7b342e4d0b --- /dev/null +++ b/codenet/public_test_cases/p00337/input.2.txt @@ -0,0 +1,14 @@ +7 6 +0 2 +3 0 +2 2 +1 0 +4 1 +2 3 +3 5 +1 3 +2 4 +2 3 +3 5 +3 7 +6 7 diff --git a/codenet/public_test_cases/p00337/output.0.txt b/codenet/public_test_cases/p00337/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6e0ba74893ec055fbf724489a892b5b5fb7b9c7 --- /dev/null +++ b/codenet/public_test_cases/p00337/output.0.txt @@ -0,0 +1 @@ +11.4142 diff --git a/codenet/public_test_cases/p00337/output.1.txt b/codenet/public_test_cases/p00337/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6e0ba74893ec055fbf724489a892b5b5fb7b9c7 --- /dev/null +++ b/codenet/public_test_cases/p00337/output.1.txt @@ -0,0 +1 @@ +11.4142 diff --git a/codenet/public_test_cases/p00337/output.2.txt b/codenet/public_test_cases/p00337/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..10c47764ff019e76ba29e64c862b1d37a96f1f71 --- /dev/null +++ b/codenet/public_test_cases/p00337/output.2.txt @@ -0,0 +1 @@ +18.2521 diff --git a/codenet/public_test_cases/p00338/input.0.txt b/codenet/public_test_cases/p00338/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dea7b5e188d899c23dbdcb5f9a9448cb274c7b9d --- /dev/null +++ b/codenet/public_test_cases/p00338/input.0.txt @@ -0,0 +1,12 @@ +3 11 +0 2 5 +0 1 5 +0 3 4 +1 1 +1 2 +1 3 +0 3 2 +1 1 +0 2 1 +1 2 +1 3 diff --git a/codenet/public_test_cases/p00338/input.1.txt b/codenet/public_test_cases/p00338/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dea7b5e188d899c23dbdcb5f9a9448cb274c7b9d --- /dev/null +++ b/codenet/public_test_cases/p00338/input.1.txt @@ -0,0 +1,12 @@ +3 11 +0 2 5 +0 1 5 +0 3 4 +1 1 +1 2 +1 3 +0 3 2 +1 1 +0 2 1 +1 2 +1 3 diff --git a/codenet/public_test_cases/p00338/input.2.txt b/codenet/public_test_cases/p00338/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cefad22376344f9211f5a61be32ba913821fd37 --- /dev/null +++ b/codenet/public_test_cases/p00338/input.2.txt @@ -0,0 +1,3 @@ +5 2 +1 1 +1 2 diff --git a/codenet/public_test_cases/p00338/output.0.txt b/codenet/public_test_cases/p00338/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4285c2393ddc3bd83f5dca251d0b7dc23be8ec7f --- /dev/null +++ b/codenet/public_test_cases/p00338/output.0.txt @@ -0,0 +1,6 @@ +1 5 +2 5 +3 4 +3 6 +3 6 +1 5 diff --git a/codenet/public_test_cases/p00338/output.1.txt b/codenet/public_test_cases/p00338/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4285c2393ddc3bd83f5dca251d0b7dc23be8ec7f --- /dev/null +++ b/codenet/public_test_cases/p00338/output.1.txt @@ -0,0 +1,6 @@ +1 5 +2 5 +3 4 +3 6 +3 6 +1 5 diff --git a/codenet/public_test_cases/p00338/output.2.txt b/codenet/public_test_cases/p00338/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..27ccd34d8bf3ba4518079a2473fb840356156dc5 --- /dev/null +++ b/codenet/public_test_cases/p00338/output.2.txt @@ -0,0 +1,2 @@ +1 0 +2 0 diff --git a/codenet/public_test_cases/p00339/input.0.txt b/codenet/public_test_cases/p00339/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..affd533a44a8a4401a58362bc09b969db153c7ad --- /dev/null +++ b/codenet/public_test_cases/p00339/input.0.txt @@ -0,0 +1,10 @@ +5 4 +3 3 +2 1 +1 5 +4 2 +2 6 +4 1 +8 2 +10 4 +12 17 diff --git a/codenet/public_test_cases/p00339/input.1.txt b/codenet/public_test_cases/p00339/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c94c2b399033f9ad6b2a32888c190894624831e9 --- /dev/null +++ b/codenet/public_test_cases/p00339/input.1.txt @@ -0,0 +1,10 @@ +5 4 +3 3 +2 1 +1 5 +4 2 +2 6 +4 1 +8 2 +10 4 +12 30 diff --git a/codenet/public_test_cases/p00339/input.2.txt b/codenet/public_test_cases/p00339/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..affd533a44a8a4401a58362bc09b969db153c7ad --- /dev/null +++ b/codenet/public_test_cases/p00339/input.2.txt @@ -0,0 +1,10 @@ +5 4 +3 3 +2 1 +1 5 +4 2 +2 6 +4 1 +8 2 +10 4 +12 17 diff --git a/codenet/public_test_cases/p00339/output.0.txt b/codenet/public_test_cases/p00339/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00339/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00339/output.1.txt b/codenet/public_test_cases/p00339/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p00339/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p00339/output.2.txt b/codenet/public_test_cases/p00339/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00339/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00340/input.0.txt b/codenet/public_test_cases/p00340/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01aed53aca7e015f4b00452fdf9b794c2e19c94c --- /dev/null +++ b/codenet/public_test_cases/p00340/input.0.txt @@ -0,0 +1 @@ +1 1 3 4 diff --git a/codenet/public_test_cases/p00340/input.1.txt b/codenet/public_test_cases/p00340/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1409b1c7c807c83489d56f470457810e6c246c59 --- /dev/null +++ b/codenet/public_test_cases/p00340/input.1.txt @@ -0,0 +1 @@ +1 1 2 2 diff --git a/codenet/public_test_cases/p00340/input.2.txt b/codenet/public_test_cases/p00340/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4d4aed612a187447f105cf4926aef8d0233fbd9 --- /dev/null +++ b/codenet/public_test_cases/p00340/input.2.txt @@ -0,0 +1 @@ +4 4 4 10 diff --git a/codenet/public_test_cases/p00340/input.3.txt b/codenet/public_test_cases/p00340/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..338dcc084623a87c7998ea73d70788e1eaa47ad4 --- /dev/null +++ b/codenet/public_test_cases/p00340/input.3.txt @@ -0,0 +1 @@ +2 1 1 2 diff --git a/codenet/public_test_cases/p00340/input.4.txt b/codenet/public_test_cases/p00340/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..01aed53aca7e015f4b00452fdf9b794c2e19c94c --- /dev/null +++ b/codenet/public_test_cases/p00340/input.4.txt @@ -0,0 +1 @@ +1 1 3 4 diff --git a/codenet/public_test_cases/p00340/output.0.txt b/codenet/public_test_cases/p00340/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00340/output.0.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00340/output.1.txt b/codenet/public_test_cases/p00340/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00340/output.1.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00340/output.2.txt b/codenet/public_test_cases/p00340/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00340/output.2.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00340/output.3.txt b/codenet/public_test_cases/p00340/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00340/output.3.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00340/output.4.txt b/codenet/public_test_cases/p00340/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00340/output.4.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00341/input.0.txt b/codenet/public_test_cases/p00341/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef740f455427e2d080d102c222d1b320df77e1d --- /dev/null +++ b/codenet/public_test_cases/p00341/input.0.txt @@ -0,0 +1 @@ +1 1 3 4 8 9 7 3 4 5 5 5 diff --git a/codenet/public_test_cases/p00341/input.1.txt b/codenet/public_test_cases/p00341/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8815a7d0e7020f92c6edc7489a647c284b261f27 --- /dev/null +++ b/codenet/public_test_cases/p00341/input.1.txt @@ -0,0 +1 @@ +1 1 2 2 3 1 2 3 3 3 1 2 diff --git a/codenet/public_test_cases/p00341/input.2.txt b/codenet/public_test_cases/p00341/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef740f455427e2d080d102c222d1b320df77e1d --- /dev/null +++ b/codenet/public_test_cases/p00341/input.2.txt @@ -0,0 +1 @@ +1 1 3 4 8 9 7 3 4 5 5 5 diff --git a/codenet/public_test_cases/p00341/output.0.txt b/codenet/public_test_cases/p00341/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00341/output.0.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00341/output.1.txt b/codenet/public_test_cases/p00341/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00341/output.1.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00341/output.2.txt b/codenet/public_test_cases/p00341/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00341/output.2.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00342/input.0.txt b/codenet/public_test_cases/p00342/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63bb24569506e0895c5b2218f31d7303bfe857a5 --- /dev/null +++ b/codenet/public_test_cases/p00342/input.0.txt @@ -0,0 +1,2 @@ +10 +1 2 3 4 5 6 7 8 9 10 diff --git a/codenet/public_test_cases/p00342/input.1.txt b/codenet/public_test_cases/p00342/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1aa11bf3411bb61ff19fe60b3f5ab06f7883c011 --- /dev/null +++ b/codenet/public_test_cases/p00342/input.1.txt @@ -0,0 +1,2 @@ +5 +22 100 42 3 86 diff --git a/codenet/public_test_cases/p00342/input.2.txt b/codenet/public_test_cases/p00342/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..63bb24569506e0895c5b2218f31d7303bfe857a5 --- /dev/null +++ b/codenet/public_test_cases/p00342/input.2.txt @@ -0,0 +1,2 @@ +10 +1 2 3 4 5 6 7 8 9 10 diff --git a/codenet/public_test_cases/p00342/input.3.txt b/codenet/public_test_cases/p00342/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9b0f335c1d1f34a2f5c063ae1093712f15c9bfe --- /dev/null +++ b/codenet/public_test_cases/p00342/input.3.txt @@ -0,0 +1,2 @@ +4 +100000 99999 8 1 diff --git a/codenet/public_test_cases/p00342/input.4.txt b/codenet/public_test_cases/p00342/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e1df3326e38936b3ffe7c7801b89f98d32ef479 --- /dev/null +++ b/codenet/public_test_cases/p00342/input.4.txt @@ -0,0 +1,2 @@ +6 +15 21 36 10 34 5 diff --git a/codenet/public_test_cases/p00342/output.0.txt b/codenet/public_test_cases/p00342/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..160be64680ec9841580c14d67a95517660d34377 --- /dev/null +++ b/codenet/public_test_cases/p00342/output.0.txt @@ -0,0 +1 @@ +19.00000 diff --git a/codenet/public_test_cases/p00342/output.1.txt b/codenet/public_test_cases/p00342/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0a885d08fa70bcaf49630b6f694a949b2235dc0 --- /dev/null +++ b/codenet/public_test_cases/p00342/output.1.txt @@ -0,0 +1 @@ +9.78947 diff --git a/codenet/public_test_cases/p00342/output.2.txt b/codenet/public_test_cases/p00342/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..160be64680ec9841580c14d67a95517660d34377 --- /dev/null +++ b/codenet/public_test_cases/p00342/output.2.txt @@ -0,0 +1 @@ +19.00000 diff --git a/codenet/public_test_cases/p00342/output.3.txt b/codenet/public_test_cases/p00342/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b387bb9df521026306d70de3c344ef0137f65a9f --- /dev/null +++ b/codenet/public_test_cases/p00342/output.3.txt @@ -0,0 +1 @@ +28571.285714 diff --git a/codenet/public_test_cases/p00342/output.4.txt b/codenet/public_test_cases/p00342/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d9d1781ae2f796f96c9e82e8ba89a7e83f149d9 --- /dev/null +++ b/codenet/public_test_cases/p00342/output.4.txt @@ -0,0 +1 @@ +18.00000 diff --git a/codenet/public_test_cases/p00343/input.0.txt b/codenet/public_test_cases/p00343/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d56279bdc0ffba71c92c13d06b6e345fd7d5df5 --- /dev/null +++ b/codenet/public_test_cases/p00343/input.0.txt @@ -0,0 +1,6 @@ +5 +1 2 3 4 5 6 +1 3 5 6 8 4 +1 2 3 4 5 8 +1 2 4 5 10 11 +1 2 3 6 9 11 diff --git a/codenet/public_test_cases/p00343/input.1.txt b/codenet/public_test_cases/p00343/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d56279bdc0ffba71c92c13d06b6e345fd7d5df5 --- /dev/null +++ b/codenet/public_test_cases/p00343/input.1.txt @@ -0,0 +1,6 @@ +5 +1 2 3 4 5 6 +1 3 5 6 8 4 +1 2 3 4 5 8 +1 2 4 5 10 11 +1 2 3 6 9 11 diff --git a/codenet/public_test_cases/p00343/output.0.txt b/codenet/public_test_cases/p00343/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b28d985a14490d6c1d16ae69d252be02dbb9dfb4 --- /dev/null +++ b/codenet/public_test_cases/p00343/output.0.txt @@ -0,0 +1,5 @@ +yes +yes +no +yes +no diff --git a/codenet/public_test_cases/p00343/output.1.txt b/codenet/public_test_cases/p00343/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b28d985a14490d6c1d16ae69d252be02dbb9dfb4 --- /dev/null +++ b/codenet/public_test_cases/p00343/output.1.txt @@ -0,0 +1,5 @@ +yes +yes +no +yes +no diff --git a/codenet/public_test_cases/p00344/input.0.txt b/codenet/public_test_cases/p00344/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d86050b0e039e215b0da8a93663a9bb6efd092a --- /dev/null +++ b/codenet/public_test_cases/p00344/input.0.txt @@ -0,0 +1,2 @@ +3 +1 1 1 diff --git a/codenet/public_test_cases/p00344/input.1.txt b/codenet/public_test_cases/p00344/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d86050b0e039e215b0da8a93663a9bb6efd092a --- /dev/null +++ b/codenet/public_test_cases/p00344/input.1.txt @@ -0,0 +1,2 @@ +3 +1 1 1 diff --git a/codenet/public_test_cases/p00344/input.2.txt b/codenet/public_test_cases/p00344/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c42f359cfbb97c49b9b7c4c7a484cd58fd6c794d --- /dev/null +++ b/codenet/public_test_cases/p00344/input.2.txt @@ -0,0 +1,2 @@ +8 +2 3 7 3 3 3 4 4 diff --git a/codenet/public_test_cases/p00344/input.3.txt b/codenet/public_test_cases/p00344/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c54d55a8d166e20db07dc7c7ab25cb293a0c3cfd --- /dev/null +++ b/codenet/public_test_cases/p00344/input.3.txt @@ -0,0 +1,2 @@ +3 +1 1 2 diff --git a/codenet/public_test_cases/p00344/output.0.txt b/codenet/public_test_cases/p00344/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00344/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00344/output.1.txt b/codenet/public_test_cases/p00344/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00344/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00344/output.2.txt b/codenet/public_test_cases/p00344/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00344/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00344/output.3.txt b/codenet/public_test_cases/p00344/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00344/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00345/input.0.txt b/codenet/public_test_cases/p00345/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfa0aeadb64f38d28955420cea69adbd899ed4f6 --- /dev/null +++ b/codenet/public_test_cases/p00345/input.0.txt @@ -0,0 +1 @@ +0.(3) diff --git a/codenet/public_test_cases/p00345/input.1.txt b/codenet/public_test_cases/p00345/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3827e75a5cadb9fe4a27e1cb9b6d192e7323120 --- /dev/null +++ b/codenet/public_test_cases/p00345/input.1.txt @@ -0,0 +1 @@ +1.0 diff --git a/codenet/public_test_cases/p00345/input.2.txt b/codenet/public_test_cases/p00345/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cff9f58e0230aa19010f7ce4a566f17803bd19c0 --- /dev/null +++ b/codenet/public_test_cases/p00345/input.2.txt @@ -0,0 +1 @@ +0.0739 diff --git a/codenet/public_test_cases/p00345/input.3.txt b/codenet/public_test_cases/p00345/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7805d0bb27344532088d937f47d9cd493093ec0 --- /dev/null +++ b/codenet/public_test_cases/p00345/input.3.txt @@ -0,0 +1 @@ +5.2(143) diff --git a/codenet/public_test_cases/p00345/input.4.txt b/codenet/public_test_cases/p00345/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfa0aeadb64f38d28955420cea69adbd899ed4f6 --- /dev/null +++ b/codenet/public_test_cases/p00345/input.4.txt @@ -0,0 +1 @@ +0.(3) diff --git a/codenet/public_test_cases/p00345/output.0.txt b/codenet/public_test_cases/p00345/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e56468d21b3b1a83ba91d0eb289d8b1d11d9d30 --- /dev/null +++ b/codenet/public_test_cases/p00345/output.0.txt @@ -0,0 +1 @@ +1/3 diff --git a/codenet/public_test_cases/p00345/output.1.txt b/codenet/public_test_cases/p00345/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3391a0601f59769b7a91228694e0fb9f0e3b009a --- /dev/null +++ b/codenet/public_test_cases/p00345/output.1.txt @@ -0,0 +1 @@ +1/1 diff --git a/codenet/public_test_cases/p00345/output.2.txt b/codenet/public_test_cases/p00345/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5cbddf79e0f9c936f02c61231d2ef6a61956dd4 --- /dev/null +++ b/codenet/public_test_cases/p00345/output.2.txt @@ -0,0 +1 @@ +739/10000 diff --git a/codenet/public_test_cases/p00345/output.3.txt b/codenet/public_test_cases/p00345/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ee1cb3a75fd1a365744c617b00b892cef4c2eff --- /dev/null +++ b/codenet/public_test_cases/p00345/output.3.txt @@ -0,0 +1 @@ +52091/9990 diff --git a/codenet/public_test_cases/p00345/output.4.txt b/codenet/public_test_cases/p00345/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e56468d21b3b1a83ba91d0eb289d8b1d11d9d30 --- /dev/null +++ b/codenet/public_test_cases/p00345/output.4.txt @@ -0,0 +1 @@ +1/3 diff --git a/codenet/public_test_cases/p00346/input.0.txt b/codenet/public_test_cases/p00346/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a69862994c9418cb627c617327633a59017af57 --- /dev/null +++ b/codenet/public_test_cases/p00346/input.0.txt @@ -0,0 +1,6 @@ +4 5 +1 2 2 +1 3 2 +2 3 1 +2 4 2 +3 4 1 diff --git a/codenet/public_test_cases/p00346/input.1.txt b/codenet/public_test_cases/p00346/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..92d754db3c1bf88459431812cf6f053c13e13950 --- /dev/null +++ b/codenet/public_test_cases/p00346/input.1.txt @@ -0,0 +1,12 @@ +7 11 +1 2 2 +1 3 1 +2 4 2 +2 5 2 +2 6 1 +3 4 1 +3 5 1 +3 6 1 +4 7 2 +5 7 2 +6 7 1 diff --git a/codenet/public_test_cases/p00346/input.2.txt b/codenet/public_test_cases/p00346/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a69862994c9418cb627c617327633a59017af57 --- /dev/null +++ b/codenet/public_test_cases/p00346/input.2.txt @@ -0,0 +1,6 @@ +4 5 +1 2 2 +1 3 2 +2 3 1 +2 4 2 +3 4 1 diff --git a/codenet/public_test_cases/p00346/output.0.txt b/codenet/public_test_cases/p00346/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p00346/output.0.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p00346/output.1.txt b/codenet/public_test_cases/p00346/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce161176ae74ec2092c00465a083646075fc02b8 --- /dev/null +++ b/codenet/public_test_cases/p00346/output.1.txt @@ -0,0 +1,4 @@ +3 +2 +4 +5 diff --git a/codenet/public_test_cases/p00346/output.2.txt b/codenet/public_test_cases/p00346/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p00346/output.2.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p00347/input.0.txt b/codenet/public_test_cases/p00347/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cca70a4421d42a2ff66e408638387b99d6cce12 --- /dev/null +++ b/codenet/public_test_cases/p00347/input.0.txt @@ -0,0 +1,2 @@ +2 1 +-2 1 diff --git a/codenet/public_test_cases/p00347/input.1.txt b/codenet/public_test_cases/p00347/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c339ccbb95057193767a7ca6f9b720733e6ad1b --- /dev/null +++ b/codenet/public_test_cases/p00347/input.1.txt @@ -0,0 +1,5 @@ +5 4 +5 3 2 -5 2 +2 -4 2 8 -4 +2 3 -7 6 7 +3 -4 10 -3 -3 diff --git a/codenet/public_test_cases/p00347/input.2.txt b/codenet/public_test_cases/p00347/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cca70a4421d42a2ff66e408638387b99d6cce12 --- /dev/null +++ b/codenet/public_test_cases/p00347/input.2.txt @@ -0,0 +1,2 @@ +2 1 +-2 1 diff --git a/codenet/public_test_cases/p00347/input.3.txt b/codenet/public_test_cases/p00347/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..87737966218c570f7b2a3417477d69f8d470d953 --- /dev/null +++ b/codenet/public_test_cases/p00347/input.3.txt @@ -0,0 +1,3 @@ +2 2 +2 -3 +3 -1 diff --git a/codenet/public_test_cases/p00347/output.0.txt b/codenet/public_test_cases/p00347/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00347/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00347/output.1.txt b/codenet/public_test_cases/p00347/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00347/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00347/output.2.txt b/codenet/public_test_cases/p00347/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00347/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00347/output.3.txt b/codenet/public_test_cases/p00347/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00347/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00348/input.0.txt b/codenet/public_test_cases/p00348/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da181e87546a3f9b30c131eb7a84704bafd5d94d --- /dev/null +++ b/codenet/public_test_cases/p00348/input.0.txt @@ -0,0 +1,2 @@ +6 +1 3 6 5 8 2 diff --git a/codenet/public_test_cases/p00348/input.1.txt b/codenet/public_test_cases/p00348/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c72001f2e8f93d6c45f22c3c37e0b3bded52287 --- /dev/null +++ b/codenet/public_test_cases/p00348/input.1.txt @@ -0,0 +1,2 @@ +4 +4 3 2 1 diff --git a/codenet/public_test_cases/p00348/input.2.txt b/codenet/public_test_cases/p00348/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..da181e87546a3f9b30c131eb7a84704bafd5d94d --- /dev/null +++ b/codenet/public_test_cases/p00348/input.2.txt @@ -0,0 +1,2 @@ +6 +1 3 6 5 8 2 diff --git a/codenet/public_test_cases/p00348/output.0.txt b/codenet/public_test_cases/p00348/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00348/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00348/output.1.txt b/codenet/public_test_cases/p00348/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00348/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00348/output.2.txt b/codenet/public_test_cases/p00348/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00348/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00349/input.0.txt b/codenet/public_test_cases/p00349/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba3149ca707c08e212c5ae7fea0fe5a7b750b7a5 --- /dev/null +++ b/codenet/public_test_cases/p00349/input.0.txt @@ -0,0 +1,4 @@ +3 3 3 +2 1 S +1 2 E +2 2 E diff --git a/codenet/public_test_cases/p00349/input.1.txt b/codenet/public_test_cases/p00349/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba3149ca707c08e212c5ae7fea0fe5a7b750b7a5 --- /dev/null +++ b/codenet/public_test_cases/p00349/input.1.txt @@ -0,0 +1,4 @@ +3 3 3 +2 1 S +1 2 E +2 2 E diff --git a/codenet/public_test_cases/p00349/input.2.txt b/codenet/public_test_cases/p00349/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58ae4888ec6c7e834217f27be9d93ef04cb0b35c --- /dev/null +++ b/codenet/public_test_cases/p00349/input.2.txt @@ -0,0 +1,4 @@ +5 4 3 +3 1 S +2 2 E +1 3 E diff --git a/codenet/public_test_cases/p00349/output.0.txt b/codenet/public_test_cases/p00349/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0571a2e15a712887514f5eabbbe731a4b1b70672 --- /dev/null +++ b/codenet/public_test_cases/p00349/output.0.txt @@ -0,0 +1,3 @@ +3 +1 +2 diff --git a/codenet/public_test_cases/p00349/output.1.txt b/codenet/public_test_cases/p00349/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0571a2e15a712887514f5eabbbe731a4b1b70672 --- /dev/null +++ b/codenet/public_test_cases/p00349/output.1.txt @@ -0,0 +1,3 @@ +3 +1 +2 diff --git a/codenet/public_test_cases/p00349/output.2.txt b/codenet/public_test_cases/p00349/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..17435e586d4e2ca33fd1d88b9e75f547d157aaa8 --- /dev/null +++ b/codenet/public_test_cases/p00349/output.2.txt @@ -0,0 +1,3 @@ +2 +3 +1 diff --git a/codenet/public_test_cases/p00350/input.0.txt b/codenet/public_test_cases/p00350/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1ef96b4e17873487a94f1ac7a6f70896b8571f9 --- /dev/null +++ b/codenet/public_test_cases/p00350/input.0.txt @@ -0,0 +1,12 @@ +13 +aizualgorithm +9 +comp 1 1 4 5 +comp 2 6 1 5 +set 9 12 b +comp 9 9 10 10 +comp 5 8 1 4 +set 1 10 z +set 11 13 x +comp 8 10 1 5 +comp 1 5 1 5 diff --git a/codenet/public_test_cases/p00350/input.1.txt b/codenet/public_test_cases/p00350/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1ef96b4e17873487a94f1ac7a6f70896b8571f9 --- /dev/null +++ b/codenet/public_test_cases/p00350/input.1.txt @@ -0,0 +1,12 @@ +13 +aizualgorithm +9 +comp 1 1 4 5 +comp 2 6 1 5 +set 9 12 b +comp 9 9 10 10 +comp 5 8 1 4 +set 1 10 z +set 11 13 x +comp 8 10 1 5 +comp 1 5 1 5 diff --git a/codenet/public_test_cases/p00350/output.0.txt b/codenet/public_test_cases/p00350/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..edd8c610e68670fa1c82ba84ce293f9cca170fa7 --- /dev/null +++ b/codenet/public_test_cases/p00350/output.0.txt @@ -0,0 +1,6 @@ +s +t +e +t +s +e diff --git a/codenet/public_test_cases/p00350/output.1.txt b/codenet/public_test_cases/p00350/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..edd8c610e68670fa1c82ba84ce293f9cca170fa7 --- /dev/null +++ b/codenet/public_test_cases/p00350/output.1.txt @@ -0,0 +1,6 @@ +s +t +e +t +s +e diff --git a/codenet/public_test_cases/p00351/input.0.txt b/codenet/public_test_cases/p00351/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cd68b0dd8e84dec5d3cd53fda7e48b685be1b5 --- /dev/null +++ b/codenet/public_test_cases/p00351/input.0.txt @@ -0,0 +1 @@ +0 2 diff --git a/codenet/public_test_cases/p00351/input.1.txt b/codenet/public_test_cases/p00351/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cd68b0dd8e84dec5d3cd53fda7e48b685be1b5 --- /dev/null +++ b/codenet/public_test_cases/p00351/input.1.txt @@ -0,0 +1 @@ +0 2 diff --git a/codenet/public_test_cases/p00351/input.2.txt b/codenet/public_test_cases/p00351/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7335a0738c81332a2d737fae48f528835a7b3ca0 --- /dev/null +++ b/codenet/public_test_cases/p00351/input.2.txt @@ -0,0 +1,4 @@ +3 2 +-2 1 1 +-1 1 2 +0 2 1 diff --git a/codenet/public_test_cases/p00351/output.0.txt b/codenet/public_test_cases/p00351/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..84f5e5cefe21999a6f810d40c1c626050ac26e6f --- /dev/null +++ b/codenet/public_test_cases/p00351/output.0.txt @@ -0,0 +1 @@ +0.00000000 diff --git a/codenet/public_test_cases/p00351/output.1.txt b/codenet/public_test_cases/p00351/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..84f5e5cefe21999a6f810d40c1c626050ac26e6f --- /dev/null +++ b/codenet/public_test_cases/p00351/output.1.txt @@ -0,0 +1 @@ +0.00000000 diff --git a/codenet/public_test_cases/p00351/output.2.txt b/codenet/public_test_cases/p00351/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a272bee5bf384dc2be999d7182fdecc81962ba23 --- /dev/null +++ b/codenet/public_test_cases/p00351/output.2.txt @@ -0,0 +1 @@ +1.25065774 diff --git a/codenet/public_test_cases/p00352/input.0.txt b/codenet/public_test_cases/p00352/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aec3d1631b352671316272905257ef83b1db9911 --- /dev/null +++ b/codenet/public_test_cases/p00352/input.0.txt @@ -0,0 +1 @@ +1000 3000 diff --git a/codenet/public_test_cases/p00352/input.1.txt b/codenet/public_test_cases/p00352/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db60ead11968c0eb84ae91c8ce3554ec00bb8066 --- /dev/null +++ b/codenet/public_test_cases/p00352/input.1.txt @@ -0,0 +1 @@ +5000 5000 diff --git a/codenet/public_test_cases/p00352/input.2.txt b/codenet/public_test_cases/p00352/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..04d9fc2b857dc6e083d5c40977309fcd47167125 --- /dev/null +++ b/codenet/public_test_cases/p00352/input.2.txt @@ -0,0 +1 @@ +1000 2000 diff --git a/codenet/public_test_cases/p00352/input.3.txt b/codenet/public_test_cases/p00352/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aec3d1631b352671316272905257ef83b1db9911 --- /dev/null +++ b/codenet/public_test_cases/p00352/input.3.txt @@ -0,0 +1 @@ +1000 3000 diff --git a/codenet/public_test_cases/p00352/output.0.txt b/codenet/public_test_cases/p00352/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd1af11bf283704974791862e5f3b3bd5e411aa --- /dev/null +++ b/codenet/public_test_cases/p00352/output.0.txt @@ -0,0 +1 @@ +2000 diff --git a/codenet/public_test_cases/p00352/output.1.txt b/codenet/public_test_cases/p00352/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9c02dad1826afb00c3759de476520d6de144bb3 --- /dev/null +++ b/codenet/public_test_cases/p00352/output.1.txt @@ -0,0 +1 @@ +5000 diff --git a/codenet/public_test_cases/p00352/output.2.txt b/codenet/public_test_cases/p00352/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d86ec6498f3f2c00a73220120de77934b185d8d --- /dev/null +++ b/codenet/public_test_cases/p00352/output.2.txt @@ -0,0 +1 @@ +1500 diff --git a/codenet/public_test_cases/p00352/output.3.txt b/codenet/public_test_cases/p00352/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd1af11bf283704974791862e5f3b3bd5e411aa --- /dev/null +++ b/codenet/public_test_cases/p00352/output.3.txt @@ -0,0 +1 @@ +2000 diff --git a/codenet/public_test_cases/p00353/input.0.txt b/codenet/public_test_cases/p00353/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88a0ea4cbc5770ae468d50a7dca91a679748312f --- /dev/null +++ b/codenet/public_test_cases/p00353/input.0.txt @@ -0,0 +1 @@ +1000 3000 3000 diff --git a/codenet/public_test_cases/p00353/input.1.txt b/codenet/public_test_cases/p00353/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5754c8dcb621f36603dc89aba4dfa8edf6dcc190 --- /dev/null +++ b/codenet/public_test_cases/p00353/input.1.txt @@ -0,0 +1 @@ +5000 3000 4500 diff --git a/codenet/public_test_cases/p00353/input.2.txt b/codenet/public_test_cases/p00353/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..88a0ea4cbc5770ae468d50a7dca91a679748312f --- /dev/null +++ b/codenet/public_test_cases/p00353/input.2.txt @@ -0,0 +1 @@ +1000 3000 3000 diff --git a/codenet/public_test_cases/p00353/input.3.txt b/codenet/public_test_cases/p00353/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3568ec0ad2c66c4eeaa95230a0a5a13023a0b30c --- /dev/null +++ b/codenet/public_test_cases/p00353/input.3.txt @@ -0,0 +1 @@ +500 1000 2000 diff --git a/codenet/public_test_cases/p00353/output.0.txt b/codenet/public_test_cases/p00353/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd1af11bf283704974791862e5f3b3bd5e411aa --- /dev/null +++ b/codenet/public_test_cases/p00353/output.0.txt @@ -0,0 +1 @@ +2000 diff --git a/codenet/public_test_cases/p00353/output.1.txt b/codenet/public_test_cases/p00353/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00353/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00353/output.2.txt b/codenet/public_test_cases/p00353/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd1af11bf283704974791862e5f3b3bd5e411aa --- /dev/null +++ b/codenet/public_test_cases/p00353/output.2.txt @@ -0,0 +1 @@ +2000 diff --git a/codenet/public_test_cases/p00353/output.3.txt b/codenet/public_test_cases/p00353/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..69fc4ef2be0c2550c183850902cb55dbf3d37b30 --- /dev/null +++ b/codenet/public_test_cases/p00353/output.3.txt @@ -0,0 +1 @@ +NA diff --git a/codenet/public_test_cases/p00354/input.0.txt b/codenet/public_test_cases/p00354/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00354/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00354/output.0.txt b/codenet/public_test_cases/p00354/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8ba6efed23de86f5f51bd870df6d04505e1f9aa --- /dev/null +++ b/codenet/public_test_cases/p00354/output.0.txt @@ -0,0 +1 @@ +fri diff --git a/codenet/public_test_cases/p00355/input.0.txt b/codenet/public_test_cases/p00355/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..634f0559d38d749bc292b7fba695453d561368d0 --- /dev/null +++ b/codenet/public_test_cases/p00355/input.0.txt @@ -0,0 +1,5 @@ +5 7 +3 +1 4 +4 5 +7 10 diff --git a/codenet/public_test_cases/p00355/input.1.txt b/codenet/public_test_cases/p00355/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e50aab666c9611f9369bddc1d7c48f23b9345c10 --- /dev/null +++ b/codenet/public_test_cases/p00355/input.1.txt @@ -0,0 +1,5 @@ +3 7 +3 +7 10 +1 4 +4 5 diff --git a/codenet/public_test_cases/p00355/input.2.txt b/codenet/public_test_cases/p00355/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..634f0559d38d749bc292b7fba695453d561368d0 --- /dev/null +++ b/codenet/public_test_cases/p00355/input.2.txt @@ -0,0 +1,5 @@ +5 7 +3 +1 4 +4 5 +7 10 diff --git a/codenet/public_test_cases/p00355/output.0.txt b/codenet/public_test_cases/p00355/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00355/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00355/output.1.txt b/codenet/public_test_cases/p00355/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00355/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00355/output.2.txt b/codenet/public_test_cases/p00355/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00355/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00356/input.0.txt b/codenet/public_test_cases/p00356/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8835c0701f66f328251eac951d4278ae8acd00a1 --- /dev/null +++ b/codenet/public_test_cases/p00356/input.0.txt @@ -0,0 +1 @@ +4 4 diff --git a/codenet/public_test_cases/p00356/input.1.txt b/codenet/public_test_cases/p00356/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9290688fa7995d643a841e69083fc3f1316a0ef8 --- /dev/null +++ b/codenet/public_test_cases/p00356/input.1.txt @@ -0,0 +1 @@ +4 6 diff --git a/codenet/public_test_cases/p00356/input.2.txt b/codenet/public_test_cases/p00356/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8835c0701f66f328251eac951d4278ae8acd00a1 --- /dev/null +++ b/codenet/public_test_cases/p00356/input.2.txt @@ -0,0 +1 @@ +4 4 diff --git a/codenet/public_test_cases/p00356/output.0.txt b/codenet/public_test_cases/p00356/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00356/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00356/output.1.txt b/codenet/public_test_cases/p00356/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p00356/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p00356/output.2.txt b/codenet/public_test_cases/p00356/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00356/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00357/input.0.txt b/codenet/public_test_cases/p00357/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02b0786c567c906fd9780420381460f5e6aa98f0 --- /dev/null +++ b/codenet/public_test_cases/p00357/input.0.txt @@ -0,0 +1,5 @@ +4 +20 +5 +10 +1 diff --git a/codenet/public_test_cases/p00357/input.1.txt b/codenet/public_test_cases/p00357/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6bf677bcce3fefe485d3bf0f9bb62614457cf28 --- /dev/null +++ b/codenet/public_test_cases/p00357/input.1.txt @@ -0,0 +1,5 @@ +4 +20 +30 +1 +20 diff --git a/codenet/public_test_cases/p00357/input.2.txt b/codenet/public_test_cases/p00357/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..02b0786c567c906fd9780420381460f5e6aa98f0 --- /dev/null +++ b/codenet/public_test_cases/p00357/input.2.txt @@ -0,0 +1,5 @@ +4 +20 +5 +10 +1 diff --git a/codenet/public_test_cases/p00357/input.3.txt b/codenet/public_test_cases/p00357/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..485169703796a2b89892b7db24ae4d2284d09e96 --- /dev/null +++ b/codenet/public_test_cases/p00357/input.3.txt @@ -0,0 +1,4 @@ +3 +10 +5 +10 diff --git a/codenet/public_test_cases/p00357/output.0.txt b/codenet/public_test_cases/p00357/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00357/output.0.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00357/output.1.txt b/codenet/public_test_cases/p00357/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00357/output.1.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00357/output.2.txt b/codenet/public_test_cases/p00357/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00357/output.2.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00357/output.3.txt b/codenet/public_test_cases/p00357/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00357/output.3.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00358/input.0.txt b/codenet/public_test_cases/p00358/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90cd2bbe6102cc8d69dadc2e1aae25ae1b48439c --- /dev/null +++ b/codenet/public_test_cases/p00358/input.0.txt @@ -0,0 +1,4 @@ +5 3 +0 1 +1 2 +3 3 diff --git a/codenet/public_test_cases/p00358/output.0.txt b/codenet/public_test_cases/p00358/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00358/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00359/input.0.txt b/codenet/public_test_cases/p00359/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..113209c99ab8cebea46eded406ecfb95f9ed7bd1 --- /dev/null +++ b/codenet/public_test_cases/p00359/input.0.txt @@ -0,0 +1,5 @@ +5 4 4 +0 3 +1 1 +2 2 +2 3 diff --git a/codenet/public_test_cases/p00359/input.1.txt b/codenet/public_test_cases/p00359/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..113209c99ab8cebea46eded406ecfb95f9ed7bd1 --- /dev/null +++ b/codenet/public_test_cases/p00359/input.1.txt @@ -0,0 +1,5 @@ +5 4 4 +0 3 +1 1 +2 2 +2 3 diff --git a/codenet/public_test_cases/p00359/input.2.txt b/codenet/public_test_cases/p00359/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba1a36d124d0cdc2a4bb394556efdefa47cb572 --- /dev/null +++ b/codenet/public_test_cases/p00359/input.2.txt @@ -0,0 +1,6 @@ +6 6 5 +2 1 +5 2 +3 3 +1 4 +1 5 diff --git a/codenet/public_test_cases/p00359/input.3.txt b/codenet/public_test_cases/p00359/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..789637afffe89c774c58db2446ce245a9abb6aeb --- /dev/null +++ b/codenet/public_test_cases/p00359/input.3.txt @@ -0,0 +1,5 @@ +8 8 4 +6 0 +7 0 +0 6 +0 7 diff --git a/codenet/public_test_cases/p00359/output.0.txt b/codenet/public_test_cases/p00359/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00359/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00359/output.1.txt b/codenet/public_test_cases/p00359/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00359/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00359/output.2.txt b/codenet/public_test_cases/p00359/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00359/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00359/output.3.txt b/codenet/public_test_cases/p00359/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00359/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00360/input.0.txt b/codenet/public_test_cases/p00360/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fb66abee0a2fb39b2f17293f503eaa93d51d316 --- /dev/null +++ b/codenet/public_test_cases/p00360/input.0.txt @@ -0,0 +1,2 @@ +pckoshien +3 diff --git a/codenet/public_test_cases/p00360/input.1.txt b/codenet/public_test_cases/p00360/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fb66abee0a2fb39b2f17293f503eaa93d51d316 --- /dev/null +++ b/codenet/public_test_cases/p00360/input.1.txt @@ -0,0 +1,2 @@ +pckoshien +3 diff --git a/codenet/public_test_cases/p00360/input.2.txt b/codenet/public_test_cases/p00360/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..17830b0d09b94076f9c46bd23cae187e6b924928 --- /dev/null +++ b/codenet/public_test_cases/p00360/input.2.txt @@ -0,0 +1,2 @@ +pckoshien +10 diff --git a/codenet/public_test_cases/p00360/output.0.txt b/codenet/public_test_cases/p00360/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f150198f759fe0c443ebd7008adf2696212bc04d --- /dev/null +++ b/codenet/public_test_cases/p00360/output.0.txt @@ -0,0 +1 @@ +ckopshien diff --git a/codenet/public_test_cases/p00360/output.1.txt b/codenet/public_test_cases/p00360/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f150198f759fe0c443ebd7008adf2696212bc04d --- /dev/null +++ b/codenet/public_test_cases/p00360/output.1.txt @@ -0,0 +1 @@ +ckopshien diff --git a/codenet/public_test_cases/p00360/output.2.txt b/codenet/public_test_cases/p00360/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed1d996f09c894a5c51cd5d346756b15afd5b63c --- /dev/null +++ b/codenet/public_test_cases/p00360/output.2.txt @@ -0,0 +1 @@ +cekophsin diff --git a/codenet/public_test_cases/p00361/input.0.txt b/codenet/public_test_cases/p00361/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e37c217c5f05648ddeede4ed23633e3a29c3c55 --- /dev/null +++ b/codenet/public_test_cases/p00361/input.0.txt @@ -0,0 +1,8 @@ +6 7 +0 2 +2 1 +1 0 +2 3 +4 3 +4 5 +5 4 diff --git a/codenet/public_test_cases/p00361/output.0.txt b/codenet/public_test_cases/p00361/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00361/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00362/input.0.txt b/codenet/public_test_cases/p00362/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..791723a880333116e18f6bdc5665af1b41019f27 --- /dev/null +++ b/codenet/public_test_cases/p00362/input.0.txt @@ -0,0 +1,10 @@ +6 3 +0 1 1 +0 2 1 +0 3 1 +2 4 1 +2 5 1 +3 +send 1 4 +add 2 2 +send 1 4 diff --git a/codenet/public_test_cases/p00362/output.0.txt b/codenet/public_test_cases/p00362/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p00362/output.0.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p00363/input.0.txt b/codenet/public_test_cases/p00363/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7530ed2334e34a68c4041500b8cf33977309aaab --- /dev/null +++ b/codenet/public_test_cases/p00363/input.0.txt @@ -0,0 +1 @@ +3 3 B diff --git a/codenet/public_test_cases/p00363/output.0.txt b/codenet/public_test_cases/p00363/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9194d608680e499ae625ba5356a77ae31e0fc434 --- /dev/null +++ b/codenet/public_test_cases/p00363/output.0.txt @@ -0,0 +1,3 @@ ++-+ +|B| ++-+ diff --git a/codenet/public_test_cases/p00364/input.0.txt b/codenet/public_test_cases/p00364/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c63d7eaec8417918bec6b9c5ec307afc92abd4b3 --- /dev/null +++ b/codenet/public_test_cases/p00364/input.0.txt @@ -0,0 +1,4 @@ +3 10 +6 4 +4 2 +3 2 diff --git a/codenet/public_test_cases/p00364/input.1.txt b/codenet/public_test_cases/p00364/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c63d7eaec8417918bec6b9c5ec307afc92abd4b3 --- /dev/null +++ b/codenet/public_test_cases/p00364/input.1.txt @@ -0,0 +1,4 @@ +3 10 +6 4 +4 2 +3 2 diff --git a/codenet/public_test_cases/p00364/output.0.txt b/codenet/public_test_cases/p00364/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e987f5b28d3081028ecd40981c4fe287ca927b0e --- /dev/null +++ b/codenet/public_test_cases/p00364/output.0.txt @@ -0,0 +1 @@ +6.666667 diff --git a/codenet/public_test_cases/p00364/output.1.txt b/codenet/public_test_cases/p00364/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e987f5b28d3081028ecd40981c4fe287ca927b0e --- /dev/null +++ b/codenet/public_test_cases/p00364/output.1.txt @@ -0,0 +1 @@ +6.666667 diff --git a/codenet/public_test_cases/p00365/input.0.txt b/codenet/public_test_cases/p00365/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d19c57e94c6d74486af82562af24a2572bef131 --- /dev/null +++ b/codenet/public_test_cases/p00365/input.0.txt @@ -0,0 +1,2 @@ +1999 9 9 +2001 11 3 diff --git a/codenet/public_test_cases/p00365/input.1.txt b/codenet/public_test_cases/p00365/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87f6f746a8cfd50d42f43970753b884821d88bd3 --- /dev/null +++ b/codenet/public_test_cases/p00365/input.1.txt @@ -0,0 +1,2 @@ +2008 2 29 +2015 3 1 diff --git a/codenet/public_test_cases/p00365/input.2.txt b/codenet/public_test_cases/p00365/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d19c57e94c6d74486af82562af24a2572bef131 --- /dev/null +++ b/codenet/public_test_cases/p00365/input.2.txt @@ -0,0 +1,2 @@ +1999 9 9 +2001 11 3 diff --git a/codenet/public_test_cases/p00365/output.0.txt b/codenet/public_test_cases/p00365/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00365/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00365/output.1.txt b/codenet/public_test_cases/p00365/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00365/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00365/output.2.txt b/codenet/public_test_cases/p00365/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00365/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00366/input.0.txt b/codenet/public_test_cases/p00366/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1cad3353b94c6346ac9038ae63fed76cee98f39 --- /dev/null +++ b/codenet/public_test_cases/p00366/input.0.txt @@ -0,0 +1,4 @@ +3 +3 +6 +8 diff --git a/codenet/public_test_cases/p00366/input.1.txt b/codenet/public_test_cases/p00366/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1cad3353b94c6346ac9038ae63fed76cee98f39 --- /dev/null +++ b/codenet/public_test_cases/p00366/input.1.txt @@ -0,0 +1,4 @@ +3 +3 +6 +8 diff --git a/codenet/public_test_cases/p00366/input.2.txt b/codenet/public_test_cases/p00366/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b59af4ee00e426e2b6e32555bf7f4e9da112d23e --- /dev/null +++ b/codenet/public_test_cases/p00366/input.2.txt @@ -0,0 +1,3 @@ +2 +10 +10 diff --git a/codenet/public_test_cases/p00366/output.0.txt b/codenet/public_test_cases/p00366/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00366/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00366/output.1.txt b/codenet/public_test_cases/p00366/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00366/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00366/output.2.txt b/codenet/public_test_cases/p00366/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00366/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00367/input.0.txt b/codenet/public_test_cases/p00367/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7dda926ea093334c51ecfd16740811dcea73fe4 --- /dev/null +++ b/codenet/public_test_cases/p00367/input.0.txt @@ -0,0 +1,6 @@ +5 +1 0 2 0 3 30 4 30 6 0 7 0 +2 30 3 0 4 0 5 0 5 30 6 30 +1 30 2 30 4 30 5 0 6 30 7 0 +2 30 3 0 5 0 6 0 6 30 7 0 +1 0 2 0 3 0 3 30 4 0 5 0 diff --git a/codenet/public_test_cases/p00367/output.0.txt b/codenet/public_test_cases/p00367/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00367/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00368/input.0.txt b/codenet/public_test_cases/p00368/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab1fe8061af319dd9af3de8ae34d37a75098f448 --- /dev/null +++ b/codenet/public_test_cases/p00368/input.0.txt @@ -0,0 +1,3 @@ +3 2 +1 1 0 +0 0 1 diff --git a/codenet/public_test_cases/p00368/input.1.txt b/codenet/public_test_cases/p00368/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab1fe8061af319dd9af3de8ae34d37a75098f448 --- /dev/null +++ b/codenet/public_test_cases/p00368/input.1.txt @@ -0,0 +1,3 @@ +3 2 +1 1 0 +0 0 1 diff --git a/codenet/public_test_cases/p00368/input.2.txt b/codenet/public_test_cases/p00368/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5f28f1716217ee6ce729c83af4fc722fe43c61a --- /dev/null +++ b/codenet/public_test_cases/p00368/input.2.txt @@ -0,0 +1,3 @@ +2 2 +0 0 +1 1 diff --git a/codenet/public_test_cases/p00368/output.0.txt b/codenet/public_test_cases/p00368/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00368/output.0.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00368/output.1.txt b/codenet/public_test_cases/p00368/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p00368/output.1.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p00368/output.2.txt b/codenet/public_test_cases/p00368/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p00368/output.2.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p00369/input.0.txt b/codenet/public_test_cases/p00369/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6281df3ec0c199953dff7bb16ee0c1763744d502 --- /dev/null +++ b/codenet/public_test_cases/p00369/input.0.txt @@ -0,0 +1 @@ +11121314 diff --git a/codenet/public_test_cases/p00369/input.1.txt b/codenet/public_test_cases/p00369/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..239b0159bf15ed65fa9bad095d080b5795896503 --- /dev/null +++ b/codenet/public_test_cases/p00369/input.1.txt @@ -0,0 +1 @@ +123125129 diff --git a/codenet/public_test_cases/p00369/input.2.txt b/codenet/public_test_cases/p00369/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..acf6af209f1a05a4e18b05e3fc11e897a2217223 --- /dev/null +++ b/codenet/public_test_cases/p00369/input.2.txt @@ -0,0 +1 @@ +119138 diff --git a/codenet/public_test_cases/p00369/input.3.txt b/codenet/public_test_cases/p00369/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6281df3ec0c199953dff7bb16ee0c1763744d502 --- /dev/null +++ b/codenet/public_test_cases/p00369/input.3.txt @@ -0,0 +1 @@ +11121314 diff --git a/codenet/public_test_cases/p00369/output.0.txt b/codenet/public_test_cases/p00369/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00369/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00369/output.1.txt b/codenet/public_test_cases/p00369/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00369/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00369/output.2.txt b/codenet/public_test_cases/p00369/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00369/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00369/output.3.txt b/codenet/public_test_cases/p00369/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00369/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00370/input.0.txt b/codenet/public_test_cases/p00370/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbdea8e500606002d5b27cbfbb258da4707104f6 --- /dev/null +++ b/codenet/public_test_cases/p00370/input.0.txt @@ -0,0 +1,7 @@ +0 0 +4 0 +4 +1 1 +2 1 +3 3 +1 2 diff --git a/codenet/public_test_cases/p00370/input.1.txt b/codenet/public_test_cases/p00370/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59bac48c09a52851949582b617d976011f55033d --- /dev/null +++ b/codenet/public_test_cases/p00370/input.1.txt @@ -0,0 +1,7 @@ +4 4 +0 0 +4 +1 1 +3 1 +3 3 +1 3 diff --git a/codenet/public_test_cases/p00370/input.2.txt b/codenet/public_test_cases/p00370/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbdea8e500606002d5b27cbfbb258da4707104f6 --- /dev/null +++ b/codenet/public_test_cases/p00370/input.2.txt @@ -0,0 +1,7 @@ +0 0 +4 0 +4 +1 1 +2 1 +3 3 +1 2 diff --git a/codenet/public_test_cases/p00370/output.0.txt b/codenet/public_test_cases/p00370/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91627b921bf58ee5c988575560c6c6674b152739 --- /dev/null +++ b/codenet/public_test_cases/p00370/output.0.txt @@ -0,0 +1 @@ +4.472136 diff --git a/codenet/public_test_cases/p00370/output.1.txt b/codenet/public_test_cases/p00370/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7941eaaafe0c48b5a90e92944a714e98a1dae09a --- /dev/null +++ b/codenet/public_test_cases/p00370/output.1.txt @@ -0,0 +1 @@ +6.32455 diff --git a/codenet/public_test_cases/p00370/output.2.txt b/codenet/public_test_cases/p00370/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..91627b921bf58ee5c988575560c6c6674b152739 --- /dev/null +++ b/codenet/public_test_cases/p00370/output.2.txt @@ -0,0 +1 @@ +4.472136 diff --git a/codenet/public_test_cases/p00371/input.0.txt b/codenet/public_test_cases/p00371/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50e93200d45fa64a130af4659cd97f33f8d3980a --- /dev/null +++ b/codenet/public_test_cases/p00371/input.0.txt @@ -0,0 +1,10 @@ +3 2 7 +8 +3 +6 +5 +2 2 +3 2 +4 1 +6 1 +6 0 diff --git a/codenet/public_test_cases/p00371/input.1.txt b/codenet/public_test_cases/p00371/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..50e93200d45fa64a130af4659cd97f33f8d3980a --- /dev/null +++ b/codenet/public_test_cases/p00371/input.1.txt @@ -0,0 +1,10 @@ +3 2 7 +8 +3 +6 +5 +2 2 +3 2 +4 1 +6 1 +6 0 diff --git a/codenet/public_test_cases/p00371/output.0.txt b/codenet/public_test_cases/p00371/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..327eb9ea33006825e685d0061108ca44b4cd670f --- /dev/null +++ b/codenet/public_test_cases/p00371/output.0.txt @@ -0,0 +1,5 @@ +yes +no +yes +no +yes diff --git a/codenet/public_test_cases/p00371/output.1.txt b/codenet/public_test_cases/p00371/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..327eb9ea33006825e685d0061108ca44b4cd670f --- /dev/null +++ b/codenet/public_test_cases/p00371/output.1.txt @@ -0,0 +1,5 @@ +yes +no +yes +no +yes diff --git a/codenet/public_test_cases/p00372/input.0.txt b/codenet/public_test_cases/p00372/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91581d7e49c3fe78348893c08c98a4017c178197 --- /dev/null +++ b/codenet/public_test_cases/p00372/input.0.txt @@ -0,0 +1,9 @@ +7 8 +0 1 +1 2 +1 3 +2 3 +0 4 +4 5 +4 6 +5 6 diff --git a/codenet/public_test_cases/p00372/input.1.txt b/codenet/public_test_cases/p00372/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29e38fec53191345dc1822cd4e1ca7f667cb1b89 --- /dev/null +++ b/codenet/public_test_cases/p00372/input.1.txt @@ -0,0 +1,3 @@ +3 2 +0 1 +1 2 diff --git a/codenet/public_test_cases/p00372/input.2.txt b/codenet/public_test_cases/p00372/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..91581d7e49c3fe78348893c08c98a4017c178197 --- /dev/null +++ b/codenet/public_test_cases/p00372/input.2.txt @@ -0,0 +1,9 @@ +7 8 +0 1 +1 2 +1 3 +2 3 +0 4 +4 5 +4 6 +5 6 diff --git a/codenet/public_test_cases/p00372/output.0.txt b/codenet/public_test_cases/p00372/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00372/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00372/output.1.txt b/codenet/public_test_cases/p00372/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00372/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00372/output.2.txt b/codenet/public_test_cases/p00372/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00372/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00373/input.0.txt b/codenet/public_test_cases/p00373/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ca889fea9d6f3d79ef9372255a1e4b3914523a2 --- /dev/null +++ b/codenet/public_test_cases/p00373/input.0.txt @@ -0,0 +1,9 @@ +5 5 3 3 +AF??z +W?p88 +???Hk +pU?m? +F???c +F?? +p?8 +?H? diff --git a/codenet/public_test_cases/p00373/input.1.txt b/codenet/public_test_cases/p00373/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ca889fea9d6f3d79ef9372255a1e4b3914523a2 --- /dev/null +++ b/codenet/public_test_cases/p00373/input.1.txt @@ -0,0 +1,9 @@ +5 5 3 3 +AF??z +W?p88 +???Hk +pU?m? +F???c +F?? +p?8 +?H? diff --git a/codenet/public_test_cases/p00373/input.2.txt b/codenet/public_test_cases/p00373/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f536a74d993eba41fefaef89f2ef43e996ba7786 --- /dev/null +++ b/codenet/public_test_cases/p00373/input.2.txt @@ -0,0 +1,8 @@ +6 5 4 2 +aaaaaa +aaaaaa +aaaaaa +aaaaaa +aaaaaa +aaaa +aaaa diff --git a/codenet/public_test_cases/p00373/output.0.txt b/codenet/public_test_cases/p00373/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00373/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00373/output.1.txt b/codenet/public_test_cases/p00373/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00373/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00373/output.2.txt b/codenet/public_test_cases/p00373/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p00373/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p00374/input.0.txt b/codenet/public_test_cases/p00374/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d13dc4286e10335efb13a9bbcdb638851b364ae8 --- /dev/null +++ b/codenet/public_test_cases/p00374/input.0.txt @@ -0,0 +1,27 @@ +18 8 3 6 +4 +3 +3 +3 +3 +2 +2 +2 +1 +1 +1 +1 +1 +2 +2 +3 +3 +3 +1 +1 +1 +1 +1 +1 +1 +1 diff --git a/codenet/public_test_cases/p00374/input.1.txt b/codenet/public_test_cases/p00374/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d13dc4286e10335efb13a9bbcdb638851b364ae8 --- /dev/null +++ b/codenet/public_test_cases/p00374/input.1.txt @@ -0,0 +1,27 @@ +18 8 3 6 +4 +3 +3 +3 +3 +2 +2 +2 +1 +1 +1 +1 +1 +2 +2 +3 +3 +3 +1 +1 +1 +1 +1 +1 +1 +1 diff --git a/codenet/public_test_cases/p00374/output.0.txt b/codenet/public_test_cases/p00374/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00374/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00374/output.1.txt b/codenet/public_test_cases/p00374/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00374/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00375/input.0.txt b/codenet/public_test_cases/p00375/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38b10c1b2badd802b554ecc944a7a40c5f055d47 --- /dev/null +++ b/codenet/public_test_cases/p00375/input.0.txt @@ -0,0 +1 @@ +68 diff --git a/codenet/public_test_cases/p00375/input.1.txt b/codenet/public_test_cases/p00375/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38b10c1b2badd802b554ecc944a7a40c5f055d47 --- /dev/null +++ b/codenet/public_test_cases/p00375/input.1.txt @@ -0,0 +1 @@ +68 diff --git a/codenet/public_test_cases/p00375/input.2.txt b/codenet/public_test_cases/p00375/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p00375/input.2.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p00375/output.0.txt b/codenet/public_test_cases/p00375/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p00375/output.0.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p00375/output.1.txt b/codenet/public_test_cases/p00375/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p00375/output.1.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p00375/output.2.txt b/codenet/public_test_cases/p00375/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00375/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00376/input.0.txt b/codenet/public_test_cases/p00376/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0060859b452a59e54223686d6c4afba11c2dddf9 --- /dev/null +++ b/codenet/public_test_cases/p00376/input.0.txt @@ -0,0 +1 @@ +20 30 diff --git a/codenet/public_test_cases/p00376/input.1.txt b/codenet/public_test_cases/p00376/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a32f311428604996cf26127c6a44512d30f5fb --- /dev/null +++ b/codenet/public_test_cases/p00376/input.1.txt @@ -0,0 +1 @@ +50 25 diff --git a/codenet/public_test_cases/p00376/input.2.txt b/codenet/public_test_cases/p00376/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9126f02c42e75cae0891521168fb649bd890943 --- /dev/null +++ b/codenet/public_test_cases/p00376/input.2.txt @@ -0,0 +1 @@ +25 25 diff --git a/codenet/public_test_cases/p00376/input.3.txt b/codenet/public_test_cases/p00376/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0060859b452a59e54223686d6c4afba11c2dddf9 --- /dev/null +++ b/codenet/public_test_cases/p00376/input.3.txt @@ -0,0 +1 @@ +20 30 diff --git a/codenet/public_test_cases/p00376/output.0.txt b/codenet/public_test_cases/p00376/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00376/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00376/output.1.txt b/codenet/public_test_cases/p00376/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p00376/output.1.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p00376/output.2.txt b/codenet/public_test_cases/p00376/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00376/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00376/output.3.txt b/codenet/public_test_cases/p00376/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00376/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00377/input.0.txt b/codenet/public_test_cases/p00377/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0e5a878642e16b968ae70192f20534d2616649c --- /dev/null +++ b/codenet/public_test_cases/p00377/input.0.txt @@ -0,0 +1,2 @@ +5 4 +5 5 6 5 diff --git a/codenet/public_test_cases/p00377/input.1.txt b/codenet/public_test_cases/p00377/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b6a507be155f89008576002dcc94c2839ddd418 --- /dev/null +++ b/codenet/public_test_cases/p00377/input.1.txt @@ -0,0 +1,2 @@ +7 5 +8 8 8 8 8 diff --git a/codenet/public_test_cases/p00377/input.2.txt b/codenet/public_test_cases/p00377/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0e5a878642e16b968ae70192f20534d2616649c --- /dev/null +++ b/codenet/public_test_cases/p00377/input.2.txt @@ -0,0 +1,2 @@ +5 4 +5 5 6 5 diff --git a/codenet/public_test_cases/p00377/input.3.txt b/codenet/public_test_cases/p00377/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e01d013b7a6342ebedbd7fe7661e5c96fef076ae --- /dev/null +++ b/codenet/public_test_cases/p00377/input.3.txt @@ -0,0 +1,2 @@ +100 3 +3 3 3 diff --git a/codenet/public_test_cases/p00377/output.0.txt b/codenet/public_test_cases/p00377/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00377/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00377/output.1.txt b/codenet/public_test_cases/p00377/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00377/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00377/output.2.txt b/codenet/public_test_cases/p00377/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00377/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00377/output.3.txt b/codenet/public_test_cases/p00377/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00377/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00378/input.0.txt b/codenet/public_test_cases/p00378/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..358c23de4d9c9a8d9d83ee2555ccf6d04ed9f4a2 --- /dev/null +++ b/codenet/public_test_cases/p00378/input.0.txt @@ -0,0 +1 @@ +180 100 2400 diff --git a/codenet/public_test_cases/p00378/input.1.txt b/codenet/public_test_cases/p00378/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..358c23de4d9c9a8d9d83ee2555ccf6d04ed9f4a2 --- /dev/null +++ b/codenet/public_test_cases/p00378/input.1.txt @@ -0,0 +1 @@ +180 100 2400 diff --git a/codenet/public_test_cases/p00378/input.2.txt b/codenet/public_test_cases/p00378/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa867799ed2194e26f1b3e88f7377c1bdecd8426 --- /dev/null +++ b/codenet/public_test_cases/p00378/input.2.txt @@ -0,0 +1 @@ +200 90 2018 diff --git a/codenet/public_test_cases/p00378/output.0.txt b/codenet/public_test_cases/p00378/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccbd68fb26640899442c8ff3d1d0d63794edcc77 --- /dev/null +++ b/codenet/public_test_cases/p00378/output.0.txt @@ -0,0 +1 @@ +460 diff --git a/codenet/public_test_cases/p00378/output.1.txt b/codenet/public_test_cases/p00378/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccbd68fb26640899442c8ff3d1d0d63794edcc77 --- /dev/null +++ b/codenet/public_test_cases/p00378/output.1.txt @@ -0,0 +1 @@ +460 diff --git a/codenet/public_test_cases/p00378/output.2.txt b/codenet/public_test_cases/p00378/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29ba0dfff405f334ea0cd50eb42167723b762771 --- /dev/null +++ b/codenet/public_test_cases/p00378/output.2.txt @@ -0,0 +1 @@ +450 diff --git a/codenet/public_test_cases/p00379/input.0.txt b/codenet/public_test_cases/p00379/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b9bc2508fc677e79cf0d0f354053b98415b93e3 --- /dev/null +++ b/codenet/public_test_cases/p00379/input.0.txt @@ -0,0 +1 @@ +16 2 1000 diff --git a/codenet/public_test_cases/p00379/output.0.txt b/codenet/public_test_cases/p00379/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00379/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00380/input.0.txt b/codenet/public_test_cases/p00380/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c2cba2ce463ab585c85c6262b2f100b7ef2513c --- /dev/null +++ b/codenet/public_test_cases/p00380/input.0.txt @@ -0,0 +1,6 @@ +6 +9 7 5 6 3 1 +3 +1 6 +2 5 +3 4 diff --git a/codenet/public_test_cases/p00380/output.0.txt b/codenet/public_test_cases/p00380/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00380/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00381/input.0.txt b/codenet/public_test_cases/p00381/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37b2d2aeab803c19361e1224826af389fdb83d21 --- /dev/null +++ b/codenet/public_test_cases/p00381/input.0.txt @@ -0,0 +1,3 @@ +6 +abbaba +baabab diff --git a/codenet/public_test_cases/p00381/input.1.txt b/codenet/public_test_cases/p00381/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87b8dbcf11d082407897cdd579c04948b3663d11 --- /dev/null +++ b/codenet/public_test_cases/p00381/input.1.txt @@ -0,0 +1,3 @@ +25 +neihsokcpuziafoytisrevinu +universityofaizupckoshien diff --git a/codenet/public_test_cases/p00381/input.2.txt b/codenet/public_test_cases/p00381/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..37b2d2aeab803c19361e1224826af389fdb83d21 --- /dev/null +++ b/codenet/public_test_cases/p00381/input.2.txt @@ -0,0 +1,3 @@ +6 +abbaba +baabab diff --git a/codenet/public_test_cases/p00381/output.0.txt b/codenet/public_test_cases/p00381/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00381/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00381/output.1.txt b/codenet/public_test_cases/p00381/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00381/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00381/output.2.txt b/codenet/public_test_cases/p00381/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00381/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00382/input.0.txt b/codenet/public_test_cases/p00382/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb8083cc046fa82e36e07ff4f7b51c3f6c17bb8e --- /dev/null +++ b/codenet/public_test_cases/p00382/input.0.txt @@ -0,0 +1,4 @@ +3 +3 8 10 1 +4 7 1 2 15 +3 11 8 19 diff --git a/codenet/public_test_cases/p00382/input.1.txt b/codenet/public_test_cases/p00382/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb8083cc046fa82e36e07ff4f7b51c3f6c17bb8e --- /dev/null +++ b/codenet/public_test_cases/p00382/input.1.txt @@ -0,0 +1,4 @@ +3 +3 8 10 1 +4 7 1 2 15 +3 11 8 19 diff --git a/codenet/public_test_cases/p00382/output.0.txt b/codenet/public_test_cases/p00382/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea90ee31980757b2e469741512bcb39e73494e78 --- /dev/null +++ b/codenet/public_test_cases/p00382/output.0.txt @@ -0,0 +1 @@ +45 diff --git a/codenet/public_test_cases/p00382/output.1.txt b/codenet/public_test_cases/p00382/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea90ee31980757b2e469741512bcb39e73494e78 --- /dev/null +++ b/codenet/public_test_cases/p00382/output.1.txt @@ -0,0 +1 @@ +45 diff --git a/codenet/public_test_cases/p00383/input.0.txt b/codenet/public_test_cases/p00383/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bfee98ec1cda8674cf20c0d40fa28a8a0e04581 --- /dev/null +++ b/codenet/public_test_cases/p00383/input.0.txt @@ -0,0 +1,6 @@ +5 4 +0 0 +1 0 +1 1 +0 1 +2 2 diff --git a/codenet/public_test_cases/p00383/input.1.txt b/codenet/public_test_cases/p00383/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bfee98ec1cda8674cf20c0d40fa28a8a0e04581 --- /dev/null +++ b/codenet/public_test_cases/p00383/input.1.txt @@ -0,0 +1,6 @@ +5 4 +0 0 +1 0 +1 1 +0 1 +2 2 diff --git a/codenet/public_test_cases/p00383/input.2.txt b/codenet/public_test_cases/p00383/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..95b10049baf4cea302f0c9151c973801cf0c2d59 --- /dev/null +++ b/codenet/public_test_cases/p00383/input.2.txt @@ -0,0 +1,8 @@ +7 5 +0 0 +1 0 +1 1 +0 1 +2 0 +3 0 +4 0 diff --git a/codenet/public_test_cases/p00383/output.0.txt b/codenet/public_test_cases/p00383/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00383/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00383/output.1.txt b/codenet/public_test_cases/p00383/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00383/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00383/output.2.txt b/codenet/public_test_cases/p00383/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00383/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00384/input.0.txt b/codenet/public_test_cases/p00384/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fe5ecacf0f29e280cdc6e604012d1772f84b308 --- /dev/null +++ b/codenet/public_test_cases/p00384/input.0.txt @@ -0,0 +1,14 @@ +7 +6 +1 +-1 +4 +3 +3 +1 +1 2 +2 3 +3 4 +3 5 +5 6 +5 7 diff --git a/codenet/public_test_cases/p00384/input.1.txt b/codenet/public_test_cases/p00384/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fe5ecacf0f29e280cdc6e604012d1772f84b308 --- /dev/null +++ b/codenet/public_test_cases/p00384/input.1.txt @@ -0,0 +1,14 @@ +7 +6 +1 +-1 +4 +3 +3 +1 +1 2 +2 3 +3 4 +3 5 +5 6 +5 7 diff --git a/codenet/public_test_cases/p00384/input.2.txt b/codenet/public_test_cases/p00384/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1925de303a6e33e29e7b4968f3198aea6aca7dc7 --- /dev/null +++ b/codenet/public_test_cases/p00384/input.2.txt @@ -0,0 +1,8 @@ +4 +5 +0 +1 +1 +1 2 +2 3 +2 4 diff --git a/codenet/public_test_cases/p00384/output.0.txt b/codenet/public_test_cases/p00384/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00384/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00384/output.1.txt b/codenet/public_test_cases/p00384/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00384/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00384/output.2.txt b/codenet/public_test_cases/p00384/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00384/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00385/input.0.txt b/codenet/public_test_cases/p00385/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..79bc93401305fe4de0ca2260011d7c92008fc271 --- /dev/null +++ b/codenet/public_test_cases/p00385/input.0.txt @@ -0,0 +1,3 @@ +5 3 1 +1 -2 0 +2 3 diff --git a/codenet/public_test_cases/p00385/input.1.txt b/codenet/public_test_cases/p00385/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..79bc93401305fe4de0ca2260011d7c92008fc271 --- /dev/null +++ b/codenet/public_test_cases/p00385/input.1.txt @@ -0,0 +1,3 @@ +5 3 1 +1 -2 0 +2 3 diff --git a/codenet/public_test_cases/p00385/input.2.txt b/codenet/public_test_cases/p00385/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4822c3b2d2708d85a3bfc7ccc21b630803781f81 --- /dev/null +++ b/codenet/public_test_cases/p00385/input.2.txt @@ -0,0 +1,7 @@ +5 7 5 +0 0 3 3 3 3 3 +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p00385/output.0.txt b/codenet/public_test_cases/p00385/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a83d1d524c8bb033d6d2bc907474dbebd8b57b72 --- /dev/null +++ b/codenet/public_test_cases/p00385/output.0.txt @@ -0,0 +1 @@ +-3 diff --git a/codenet/public_test_cases/p00385/output.1.txt b/codenet/public_test_cases/p00385/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a83d1d524c8bb033d6d2bc907474dbebd8b57b72 --- /dev/null +++ b/codenet/public_test_cases/p00385/output.1.txt @@ -0,0 +1 @@ +-3 diff --git a/codenet/public_test_cases/p00385/output.2.txt b/codenet/public_test_cases/p00385/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a1218a1024a212bb3db30becd860315f9f3ac52 --- /dev/null +++ b/codenet/public_test_cases/p00385/output.2.txt @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p00386/input.0.txt b/codenet/public_test_cases/p00386/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..796dfd0f418bc5cd71985c29daf84a5eb55307b5 --- /dev/null +++ b/codenet/public_test_cases/p00386/input.0.txt @@ -0,0 +1,9 @@ +5 4 +1 2 3 +2 3 4 +2 4 2 +4 5 3 +1 3 4 +1 4 5 +1 2 3 +2 4 5 diff --git a/codenet/public_test_cases/p00386/input.1.txt b/codenet/public_test_cases/p00386/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11d91ddd64f7eee24cdd37b335b8e989d1eba8c9 --- /dev/null +++ b/codenet/public_test_cases/p00386/input.1.txt @@ -0,0 +1,30 @@ +15 15 +1 2 45 +2 3 81 +1 4 29 +1 5 2 +5 6 25 +4 7 84 +7 8 56 +4 9 2 +4 10 37 +7 11 39 +1 12 11 +11 13 6 +3 14 68 +2 15 16 +10 13 14 +13 14 15 +2 14 15 +7 12 15 +10 14 15 +9 10 15 +9 14 15 +8 13 15 +5 6 13 +11 13 15 +12 13 14 +2 3 10 +5 13 15 +10 11 14 +6 8 11 diff --git a/codenet/public_test_cases/p00386/input.2.txt b/codenet/public_test_cases/p00386/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa0f36f16d0a8909303a0d97225abf9d42b6c64f --- /dev/null +++ b/codenet/public_test_cases/p00386/input.2.txt @@ -0,0 +1,8 @@ +5 3 +1 2 1 +2 3 1 +3 4 1 +4 5 1 +1 2 3 +1 3 5 +1 2 4 diff --git a/codenet/public_test_cases/p00386/input.3.txt b/codenet/public_test_cases/p00386/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..796dfd0f418bc5cd71985c29daf84a5eb55307b5 --- /dev/null +++ b/codenet/public_test_cases/p00386/input.3.txt @@ -0,0 +1,9 @@ +5 4 +1 2 3 +2 3 4 +2 4 2 +4 5 3 +1 3 4 +1 4 5 +1 2 3 +2 4 5 diff --git a/codenet/public_test_cases/p00386/output.0.txt b/codenet/public_test_cases/p00386/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1aae893828e364e703a82a2b04b00cb8415890f --- /dev/null +++ b/codenet/public_test_cases/p00386/output.0.txt @@ -0,0 +1,4 @@ +4 +5 +4 +3 diff --git a/codenet/public_test_cases/p00386/output.1.txt b/codenet/public_test_cases/p00386/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03233936a93e1c2c3fed9e8d7f16b0f6be35fe6a --- /dev/null +++ b/codenet/public_test_cases/p00386/output.1.txt @@ -0,0 +1,15 @@ +194 +194 +97 +90 +149 +66 +149 +140 +129 +129 +194 +111 +129 +194 +140 diff --git a/codenet/public_test_cases/p00386/output.2.txt b/codenet/public_test_cases/p00386/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ca3cd52fcf5f3ce33b7fd5b2542687a9a39a77a --- /dev/null +++ b/codenet/public_test_cases/p00386/output.2.txt @@ -0,0 +1,3 @@ +1 +2 +2 diff --git a/codenet/public_test_cases/p00386/output.3.txt b/codenet/public_test_cases/p00386/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1aae893828e364e703a82a2b04b00cb8415890f --- /dev/null +++ b/codenet/public_test_cases/p00386/output.3.txt @@ -0,0 +1,4 @@ +4 +5 +4 +3 diff --git a/codenet/public_test_cases/p00387/input.0.txt b/codenet/public_test_cases/p00387/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p00387/input.0.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p00387/input.1.txt b/codenet/public_test_cases/p00387/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac9e65fecfb1d8da728dc6716cadf05d4c3c2cae --- /dev/null +++ b/codenet/public_test_cases/p00387/input.1.txt @@ -0,0 +1 @@ +25 10 diff --git a/codenet/public_test_cases/p00387/input.2.txt b/codenet/public_test_cases/p00387/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p00387/input.2.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p00387/output.0.txt b/codenet/public_test_cases/p00387/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00387/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00387/output.1.txt b/codenet/public_test_cases/p00387/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00387/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00387/output.2.txt b/codenet/public_test_cases/p00387/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00387/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00388/input.0.txt b/codenet/public_test_cases/p00388/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b32aceca545ccb0225bdcab4c67b1ce77375c36c --- /dev/null +++ b/codenet/public_test_cases/p00388/input.0.txt @@ -0,0 +1 @@ +100 2 4 diff --git a/codenet/public_test_cases/p00388/input.1.txt b/codenet/public_test_cases/p00388/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..058008b6d08285a532f015d1cda9aa9c7020875f --- /dev/null +++ b/codenet/public_test_cases/p00388/input.1.txt @@ -0,0 +1 @@ +101 3 5 diff --git a/codenet/public_test_cases/p00388/input.2.txt b/codenet/public_test_cases/p00388/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b32aceca545ccb0225bdcab4c67b1ce77375c36c --- /dev/null +++ b/codenet/public_test_cases/p00388/input.2.txt @@ -0,0 +1 @@ +100 2 4 diff --git a/codenet/public_test_cases/p00388/output.0.txt b/codenet/public_test_cases/p00388/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00388/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00388/output.1.txt b/codenet/public_test_cases/p00388/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00388/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00388/output.2.txt b/codenet/public_test_cases/p00388/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00388/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00389/input.0.txt b/codenet/public_test_cases/p00389/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..805e7f5a05abb0767d277398dd810d64910d282f --- /dev/null +++ b/codenet/public_test_cases/p00389/input.0.txt @@ -0,0 +1 @@ +4 2 diff --git a/codenet/public_test_cases/p00389/input.1.txt b/codenet/public_test_cases/p00389/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p00389/input.1.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p00389/input.2.txt b/codenet/public_test_cases/p00389/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..805e7f5a05abb0767d277398dd810d64910d282f --- /dev/null +++ b/codenet/public_test_cases/p00389/input.2.txt @@ -0,0 +1 @@ +4 2 diff --git a/codenet/public_test_cases/p00389/output.0.txt b/codenet/public_test_cases/p00389/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00389/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00389/output.1.txt b/codenet/public_test_cases/p00389/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00389/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00389/output.2.txt b/codenet/public_test_cases/p00389/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00389/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00390/input.0.txt b/codenet/public_test_cases/p00390/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbc6f29b2dd1c9feaf3eb8363633c6805a559636 --- /dev/null +++ b/codenet/public_test_cases/p00390/input.0.txt @@ -0,0 +1,3 @@ +5 +1 0 0 1 0 +2 3 5 1 2 diff --git a/codenet/public_test_cases/p00390/input.1.txt b/codenet/public_test_cases/p00390/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad8bb2bad1c5e2d68530e19dbf4eb61fbe11875b --- /dev/null +++ b/codenet/public_test_cases/p00390/input.1.txt @@ -0,0 +1,3 @@ +3 +0 0 0 +1 2 3 diff --git a/codenet/public_test_cases/p00390/input.2.txt b/codenet/public_test_cases/p00390/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbc6f29b2dd1c9feaf3eb8363633c6805a559636 --- /dev/null +++ b/codenet/public_test_cases/p00390/input.2.txt @@ -0,0 +1,3 @@ +5 +1 0 0 1 0 +2 3 5 1 2 diff --git a/codenet/public_test_cases/p00390/output.0.txt b/codenet/public_test_cases/p00390/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00390/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00390/output.1.txt b/codenet/public_test_cases/p00390/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00390/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00390/output.2.txt b/codenet/public_test_cases/p00390/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00390/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00391/input.0.txt b/codenet/public_test_cases/p00391/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..43fbcacfb3700e135b3fbfd3f15a3766c1c3d038 --- /dev/null +++ b/codenet/public_test_cases/p00391/input.0.txt @@ -0,0 +1,3 @@ +5 4 +0 2 2 1 1 +1 1 1 3 diff --git a/codenet/public_test_cases/p00391/input.1.txt b/codenet/public_test_cases/p00391/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0aef4e4194d7ee108d9feb1857c91c45c3e6576c --- /dev/null +++ b/codenet/public_test_cases/p00391/input.1.txt @@ -0,0 +1,3 @@ +5 5 +3 2 3 0 0 +4 2 0 0 2 diff --git a/codenet/public_test_cases/p00391/input.2.txt b/codenet/public_test_cases/p00391/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..43fbcacfb3700e135b3fbfd3f15a3766c1c3d038 --- /dev/null +++ b/codenet/public_test_cases/p00391/input.2.txt @@ -0,0 +1,3 @@ +5 4 +0 2 2 1 1 +1 1 1 3 diff --git a/codenet/public_test_cases/p00391/output.0.txt b/codenet/public_test_cases/p00391/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00391/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00391/output.1.txt b/codenet/public_test_cases/p00391/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00391/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00391/output.2.txt b/codenet/public_test_cases/p00391/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00391/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00392/input.0.txt b/codenet/public_test_cases/p00392/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f65302957e433ae6dad04be62f93b5ac13abd20 --- /dev/null +++ b/codenet/public_test_cases/p00392/input.0.txt @@ -0,0 +1,2 @@ +5 +6 4 2 3 7 diff --git a/codenet/public_test_cases/p00392/input.1.txt b/codenet/public_test_cases/p00392/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f65302957e433ae6dad04be62f93b5ac13abd20 --- /dev/null +++ b/codenet/public_test_cases/p00392/input.1.txt @@ -0,0 +1,2 @@ +5 +6 4 2 3 7 diff --git a/codenet/public_test_cases/p00392/input.2.txt b/codenet/public_test_cases/p00392/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1269f3f8d037ad3828e3676baddc2418031b967 --- /dev/null +++ b/codenet/public_test_cases/p00392/input.2.txt @@ -0,0 +1,2 @@ +7 +2 9 6 5 6 7 3 diff --git a/codenet/public_test_cases/p00392/output.0.txt b/codenet/public_test_cases/p00392/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00392/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00392/output.1.txt b/codenet/public_test_cases/p00392/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00392/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00392/output.2.txt b/codenet/public_test_cases/p00392/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00392/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00393/input.0.txt b/codenet/public_test_cases/p00393/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p00393/input.0.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p00393/input.1.txt b/codenet/public_test_cases/p00393/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p00393/input.1.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p00393/input.2.txt b/codenet/public_test_cases/p00393/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..805e7f5a05abb0767d277398dd810d64910d282f --- /dev/null +++ b/codenet/public_test_cases/p00393/input.2.txt @@ -0,0 +1 @@ +4 2 diff --git a/codenet/public_test_cases/p00393/output.0.txt b/codenet/public_test_cases/p00393/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00393/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00393/output.1.txt b/codenet/public_test_cases/p00393/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00393/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00393/output.2.txt b/codenet/public_test_cases/p00393/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00393/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00394/input.0.txt b/codenet/public_test_cases/p00394/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb4d5e0363e5d9803ddfc8446533761489c06c5 --- /dev/null +++ b/codenet/public_test_cases/p00394/input.0.txt @@ -0,0 +1,4 @@ +3 2 2 +3 2 1 +1 2 3 +1 2 diff --git a/codenet/public_test_cases/p00394/output.0.txt b/codenet/public_test_cases/p00394/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p00394/output.0.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p00395/input.0.txt b/codenet/public_test_cases/p00395/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc530f508c7385dcc2dcfac47812ad8c880e15ad --- /dev/null +++ b/codenet/public_test_cases/p00395/input.0.txt @@ -0,0 +1,16 @@ +12 5 +.....S...... +.abcdefghij. +.0123456789. +.ABCDEFGHIJ. +.....T...... +0 1 0 0 0 0 0 0 0 0 +2 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00395/input.1.txt b/codenet/public_test_cases/p00395/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc530f508c7385dcc2dcfac47812ad8c880e15ad --- /dev/null +++ b/codenet/public_test_cases/p00395/input.1.txt @@ -0,0 +1,16 @@ +12 5 +.....S...... +.abcdefghij. +.0123456789. +.ABCDEFGHIJ. +.....T...... +0 1 0 0 0 0 0 0 0 0 +2 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00395/input.2.txt b/codenet/public_test_cases/p00395/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..679b6e0d046d7ee549e85f8ace3acff93761136c --- /dev/null +++ b/codenet/public_test_cases/p00395/input.2.txt @@ -0,0 +1,17 @@ +5 6 +..S.. + +01234 +56789 + +..T.. +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00395/input.3.txt b/codenet/public_test_cases/p00395/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdd53d660328181c5d512193cf1580070295e117 --- /dev/null +++ b/codenet/public_test_cases/p00395/input.3.txt @@ -0,0 +1,18 @@ +7 7 +1.3#8.0 +.###.# +.###.# +5..S..9 +.#T#.# +.###.# +4.2#6.7 +0 0 0 0 0 0 0 0 1 0 +0 0 0 1 0 0 0 0 0 0 +0 0 0 0 7 0 0 0 0 0 +0 2 0 0 0 0 0 0 0 0 +0 0 3 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 8 0 0 0 +2 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00395/input.4.txt b/codenet/public_test_cases/p00395/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e483d2a6f3494c9b64dbda3d98bd7b905fedac7 --- /dev/null +++ b/codenet/public_test_cases/p00395/input.4.txt @@ -0,0 +1,16 @@ +4 5 +0jSB +. +1234 +5678 +9..T +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00395/output.0.txt b/codenet/public_test_cases/p00395/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bfbf8a3ae8ab969fe01f8242b33abf7011ada21 --- /dev/null +++ b/codenet/public_test_cases/p00395/output.0.txt @@ -0,0 +1 @@ +26 2 diff --git a/codenet/public_test_cases/p00395/output.1.txt b/codenet/public_test_cases/p00395/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bfbf8a3ae8ab969fe01f8242b33abf7011ada21 --- /dev/null +++ b/codenet/public_test_cases/p00395/output.1.txt @@ -0,0 +1 @@ +26 2 diff --git a/codenet/public_test_cases/p00395/output.2.txt b/codenet/public_test_cases/p00395/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p00395/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p00395/output.3.txt b/codenet/public_test_cases/p00395/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aae88d347414665cea66b445e407ba91c0fd9b60 --- /dev/null +++ b/codenet/public_test_cases/p00395/output.3.txt @@ -0,0 +1 @@ +53 19 diff --git a/codenet/public_test_cases/p00395/output.4.txt b/codenet/public_test_cases/p00395/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..24cf19ecccf5af7282f80b7b5f492c6c68a2cb3a --- /dev/null +++ b/codenet/public_test_cases/p00395/output.4.txt @@ -0,0 +1 @@ +31 0 diff --git a/codenet/public_test_cases/p00396/input.0.txt b/codenet/public_test_cases/p00396/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9328afd827957b4e20ab3012d1d801a4a88eff2e --- /dev/null +++ b/codenet/public_test_cases/p00396/input.0.txt @@ -0,0 +1,5 @@ +4 +24 99 +15 68 +12 90 +95 79 diff --git a/codenet/public_test_cases/p00396/input.1.txt b/codenet/public_test_cases/p00396/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9328afd827957b4e20ab3012d1d801a4a88eff2e --- /dev/null +++ b/codenet/public_test_cases/p00396/input.1.txt @@ -0,0 +1,5 @@ +4 +24 99 +15 68 +12 90 +95 79 diff --git a/codenet/public_test_cases/p00396/input.2.txt b/codenet/public_test_cases/p00396/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99a5c4e4af2a5ff1440202f631cc6ce60b515bac --- /dev/null +++ b/codenet/public_test_cases/p00396/input.2.txt @@ -0,0 +1,4 @@ +3 +2 46 +94 8 +46 57 diff --git a/codenet/public_test_cases/p00396/output.0.txt b/codenet/public_test_cases/p00396/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00396/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00396/output.1.txt b/codenet/public_test_cases/p00396/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00396/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00396/output.2.txt b/codenet/public_test_cases/p00396/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00396/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00397/input.0.txt b/codenet/public_test_cases/p00397/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e6c03e4e6d4a7352717eb6d36ee63669371c68a --- /dev/null +++ b/codenet/public_test_cases/p00397/input.0.txt @@ -0,0 +1,2 @@ +3 3 +1 2 3 diff --git a/codenet/public_test_cases/p00397/input.1.txt b/codenet/public_test_cases/p00397/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e6c03e4e6d4a7352717eb6d36ee63669371c68a --- /dev/null +++ b/codenet/public_test_cases/p00397/input.1.txt @@ -0,0 +1,2 @@ +3 3 +1 2 3 diff --git a/codenet/public_test_cases/p00397/input.2.txt b/codenet/public_test_cases/p00397/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9414001bb789842b01954b8e3dc72f15f41138b0 --- /dev/null +++ b/codenet/public_test_cases/p00397/input.2.txt @@ -0,0 +1,2 @@ +7 1 +1 0 1 0 1 0 1 diff --git a/codenet/public_test_cases/p00397/input.3.txt b/codenet/public_test_cases/p00397/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a38602b21c349b5aa7b7d50aa9cb009dfa4df71 --- /dev/null +++ b/codenet/public_test_cases/p00397/input.3.txt @@ -0,0 +1,2 @@ +5 10 +1 2 4 8 16 diff --git a/codenet/public_test_cases/p00397/output.0.txt b/codenet/public_test_cases/p00397/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00397/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00397/output.1.txt b/codenet/public_test_cases/p00397/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00397/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00397/output.2.txt b/codenet/public_test_cases/p00397/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00397/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00397/output.3.txt b/codenet/public_test_cases/p00397/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p00397/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p00398/input.0.txt b/codenet/public_test_cases/p00398/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da31a4b48254cd37eada1d9428319442f178ef5f --- /dev/null +++ b/codenet/public_test_cases/p00398/input.0.txt @@ -0,0 +1,4 @@ +3 +1 2 +3 4 +10 1 diff --git a/codenet/public_test_cases/p00398/input.1.txt b/codenet/public_test_cases/p00398/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6eaf7eafaba53d71ca79ee7b4d97fdb7a6f0641e --- /dev/null +++ b/codenet/public_test_cases/p00398/input.1.txt @@ -0,0 +1,4 @@ +3 +1 2 +3 4 +3 2 diff --git a/codenet/public_test_cases/p00398/input.2.txt b/codenet/public_test_cases/p00398/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f61b9e58c8b4de591eea17f554ae1e928717a2c9 --- /dev/null +++ b/codenet/public_test_cases/p00398/input.2.txt @@ -0,0 +1,6 @@ +5 +7 41 +10 0 +99 27 +71 87 +14 25 diff --git a/codenet/public_test_cases/p00398/input.3.txt b/codenet/public_test_cases/p00398/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..da31a4b48254cd37eada1d9428319442f178ef5f --- /dev/null +++ b/codenet/public_test_cases/p00398/input.3.txt @@ -0,0 +1,4 @@ +3 +1 2 +3 4 +10 1 diff --git a/codenet/public_test_cases/p00398/output.0.txt b/codenet/public_test_cases/p00398/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p00398/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p00398/output.1.txt b/codenet/public_test_cases/p00398/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00398/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00398/output.2.txt b/codenet/public_test_cases/p00398/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cc2bc3e608c719315fc8565917017907a7c5288 --- /dev/null +++ b/codenet/public_test_cases/p00398/output.2.txt @@ -0,0 +1 @@ +163 diff --git a/codenet/public_test_cases/p00398/output.3.txt b/codenet/public_test_cases/p00398/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p00398/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p00399/input.0.txt b/codenet/public_test_cases/p00399/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33a89f520491be5c77afa362ab4eb83f1ccdbc45 --- /dev/null +++ b/codenet/public_test_cases/p00399/input.0.txt @@ -0,0 +1 @@ +4 2 1 1 diff --git a/codenet/public_test_cases/p00399/output.0.txt b/codenet/public_test_cases/p00399/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00399/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00400/input.0.txt b/codenet/public_test_cases/p00400/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fdcd7c44cb1791f45e7386a8f230e018fd7e052 --- /dev/null +++ b/codenet/public_test_cases/p00400/input.0.txt @@ -0,0 +1 @@ +67 diff --git a/codenet/public_test_cases/p00400/output.0.txt b/codenet/public_test_cases/p00400/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00400/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00401/input.0.txt b/codenet/public_test_cases/p00401/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb1e7bc86996a80d4a16529b990adda1d3434c92 --- /dev/null +++ b/codenet/public_test_cases/p00401/input.0.txt @@ -0,0 +1 @@ +54 diff --git a/codenet/public_test_cases/p00401/output.0.txt b/codenet/public_test_cases/p00401/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p00401/output.0.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p00402/input.0.txt b/codenet/public_test_cases/p00402/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a2746d518a27bbedf3fecf3e6b0b51ff6dd10ee --- /dev/null +++ b/codenet/public_test_cases/p00402/input.0.txt @@ -0,0 +1,2 @@ +3 +4 0 1 diff --git a/codenet/public_test_cases/p00402/output.0.txt b/codenet/public_test_cases/p00402/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00402/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00403/input.0.txt b/codenet/public_test_cases/p00403/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7285045b33df951ab96808437e75bf0fdb57a11 --- /dev/null +++ b/codenet/public_test_cases/p00403/input.0.txt @@ -0,0 +1,2 @@ +4 +1 2 -3 -1 diff --git a/codenet/public_test_cases/p00403/output.0.txt b/codenet/public_test_cases/p00403/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00403/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00404/input.0.txt b/codenet/public_test_cases/p00404/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b748e2dcfcbc7db3aae214293cef6cb2afbd0a65 --- /dev/null +++ b/codenet/public_test_cases/p00404/input.0.txt @@ -0,0 +1 @@ +0 0 diff --git a/codenet/public_test_cases/p00404/output.0.txt b/codenet/public_test_cases/p00404/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00404/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00405/input.0.txt b/codenet/public_test_cases/p00405/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2dd1fa695890617325657cb61db25959ba4ab86 --- /dev/null +++ b/codenet/public_test_cases/p00405/input.0.txt @@ -0,0 +1,2 @@ +3 +3 5 2 diff --git a/codenet/public_test_cases/p00405/output.0.txt b/codenet/public_test_cases/p00405/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p00405/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p00406/input.0.txt b/codenet/public_test_cases/p00406/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b85a3c20eb5fb7d676f14731c9bd71e62c04278d --- /dev/null +++ b/codenet/public_test_cases/p00406/input.0.txt @@ -0,0 +1,3 @@ +2 10 +3 0 +6 1 diff --git a/codenet/public_test_cases/p00406/output.0.txt b/codenet/public_test_cases/p00406/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00406/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00407/input.0.txt b/codenet/public_test_cases/p00407/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25ab0a177679f8625925d278d2f7e6c18b2d6d30 --- /dev/null +++ b/codenet/public_test_cases/p00407/input.0.txt @@ -0,0 +1,13 @@ +6 +0 0 +4 0 +6 3 +5 5 +1 5 +0 3 +5 +2 2 +6 6 +3 1 +5 1 +-1 -1 diff --git a/codenet/public_test_cases/p00407/output.0.txt b/codenet/public_test_cases/p00407/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..73c38f12b212f80c0b77113d3a78424485188acd --- /dev/null +++ b/codenet/public_test_cases/p00407/output.0.txt @@ -0,0 +1,5 @@ +1 +0 +1 +0 +0 diff --git a/codenet/public_test_cases/p00408/input.0.txt b/codenet/public_test_cases/p00408/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4af6367f0bdccd94780713d85e9aaec7d6842d6c --- /dev/null +++ b/codenet/public_test_cases/p00408/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 +1 3 diff --git a/codenet/public_test_cases/p00408/output.0.txt b/codenet/public_test_cases/p00408/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00408/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00409/input.0.txt b/codenet/public_test_cases/p00409/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..15c16f87c283e8109354d3caf642f0a57e357f51 --- /dev/null +++ b/codenet/public_test_cases/p00409/input.0.txt @@ -0,0 +1,7 @@ +6 5 +ababac +6 b +3 c +4 a +5 b +6 c diff --git a/codenet/public_test_cases/p00409/input.1.txt b/codenet/public_test_cases/p00409/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..15c16f87c283e8109354d3caf642f0a57e357f51 --- /dev/null +++ b/codenet/public_test_cases/p00409/input.1.txt @@ -0,0 +1,7 @@ +6 5 +ababac +6 b +3 c +4 a +5 b +6 c diff --git a/codenet/public_test_cases/p00409/output.0.txt b/codenet/public_test_cases/p00409/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98a6ad2411c8f8df291cf76fa47737350bbf658b --- /dev/null +++ b/codenet/public_test_cases/p00409/output.0.txt @@ -0,0 +1,5 @@ +2 +6 +6 +6 +3 diff --git a/codenet/public_test_cases/p00409/output.1.txt b/codenet/public_test_cases/p00409/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98a6ad2411c8f8df291cf76fa47737350bbf658b --- /dev/null +++ b/codenet/public_test_cases/p00409/output.1.txt @@ -0,0 +1,5 @@ +2 +6 +6 +6 +3 diff --git a/codenet/public_test_cases/p00410/input.0.txt b/codenet/public_test_cases/p00410/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..680292c1c1b411d781344141c0507e909a393c57 --- /dev/null +++ b/codenet/public_test_cases/p00410/input.0.txt @@ -0,0 +1,10 @@ +5 4 +2 +1 +3 +6 +4 +1 2 +2 3 +2 4 +4 5 diff --git a/codenet/public_test_cases/p00410/input.1.txt b/codenet/public_test_cases/p00410/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..680292c1c1b411d781344141c0507e909a393c57 --- /dev/null +++ b/codenet/public_test_cases/p00410/input.1.txt @@ -0,0 +1,10 @@ +5 4 +2 +1 +3 +6 +4 +1 2 +2 3 +2 4 +4 5 diff --git a/codenet/public_test_cases/p00410/input.2.txt b/codenet/public_test_cases/p00410/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00410/input.2.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00410/output.0.txt b/codenet/public_test_cases/p00410/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p00410/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p00410/output.1.txt b/codenet/public_test_cases/p00410/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p00410/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p00410/output.2.txt b/codenet/public_test_cases/p00410/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00410/output.2.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00411/input.0.txt b/codenet/public_test_cases/p00411/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2a7d9f196fb269ce8c81e0dd531b8d8105e78f7 --- /dev/null +++ b/codenet/public_test_cases/p00411/input.0.txt @@ -0,0 +1 @@ +180 120 90 diff --git a/codenet/public_test_cases/p00411/output.0.txt b/codenet/public_test_cases/p00411/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f8d809e7ae7e977cfff60a19e0ad990b57a6bf2 --- /dev/null +++ b/codenet/public_test_cases/p00411/output.0.txt @@ -0,0 +1 @@ +60.0 diff --git a/codenet/public_test_cases/p00412/input.0.txt b/codenet/public_test_cases/p00412/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceae16eaf15d94ec760357deeabbb3e4766e82de --- /dev/null +++ b/codenet/public_test_cases/p00412/input.0.txt @@ -0,0 +1,8 @@ +2 7 +1 999 +1 1000 +0 2 +1 1001 +1 1002 +0 1 +0 1 diff --git a/codenet/public_test_cases/p00412/input.1.txt b/codenet/public_test_cases/p00412/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceae16eaf15d94ec760357deeabbb3e4766e82de --- /dev/null +++ b/codenet/public_test_cases/p00412/input.1.txt @@ -0,0 +1,8 @@ +2 7 +1 999 +1 1000 +0 2 +1 1001 +1 1002 +0 1 +0 1 diff --git a/codenet/public_test_cases/p00412/output.0.txt b/codenet/public_test_cases/p00412/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69b49fa2893718abe71129d3179ec02dbea5cbad --- /dev/null +++ b/codenet/public_test_cases/p00412/output.0.txt @@ -0,0 +1,3 @@ +1000 +999 +1002 diff --git a/codenet/public_test_cases/p00412/output.1.txt b/codenet/public_test_cases/p00412/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69b49fa2893718abe71129d3179ec02dbea5cbad --- /dev/null +++ b/codenet/public_test_cases/p00412/output.1.txt @@ -0,0 +1,3 @@ +1000 +999 +1002 diff --git a/codenet/public_test_cases/p00413/input.0.txt b/codenet/public_test_cases/p00413/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c2870adafd44278b57411ae643d090898b64af4 --- /dev/null +++ b/codenet/public_test_cases/p00413/input.0.txt @@ -0,0 +1,2 @@ +0 0 4 5 +2 2 3 6 diff --git a/codenet/public_test_cases/p00413/output.0.txt b/codenet/public_test_cases/p00413/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p00413/output.0.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p00414/input.0.txt b/codenet/public_test_cases/p00414/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e42af6a37a11fbd9ee4cfd1d7d65c9b48ad33a17 --- /dev/null +++ b/codenet/public_test_cases/p00414/input.0.txt @@ -0,0 +1,2 @@ +3 2 +ooo diff --git a/codenet/public_test_cases/p00414/output.0.txt b/codenet/public_test_cases/p00414/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p00414/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p00415/input.0.txt b/codenet/public_test_cases/p00415/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b5683ab70389e041e138a1388731a1d3812c991 --- /dev/null +++ b/codenet/public_test_cases/p00415/input.0.txt @@ -0,0 +1,2 @@ +7 3 +1 4 1 4 2 1 3 diff --git a/codenet/public_test_cases/p00415/output.0.txt b/codenet/public_test_cases/p00415/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2ba7ca0da8d294725b837f9b3ede567f87318b5 --- /dev/null +++ b/codenet/public_test_cases/p00415/output.0.txt @@ -0,0 +1 @@ +4423 diff --git a/codenet/public_test_cases/p00416/input.0.txt b/codenet/public_test_cases/p00416/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a0c3efa16cf11938f8eed8a240746c015f922dd --- /dev/null +++ b/codenet/public_test_cases/p00416/input.0.txt @@ -0,0 +1,2 @@ +6 +2 2 3 2 2 2 diff --git a/codenet/public_test_cases/p00416/output.0.txt b/codenet/public_test_cases/p00416/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00416/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00417/input.0.txt b/codenet/public_test_cases/p00417/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2d69b0eeb1209199f6bdbc1cca1bf59db666452 --- /dev/null +++ b/codenet/public_test_cases/p00417/input.0.txt @@ -0,0 +1 @@ +3 2 100000007 diff --git a/codenet/public_test_cases/p00417/output.0.txt b/codenet/public_test_cases/p00417/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00417/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00418/input.0.txt b/codenet/public_test_cases/p00418/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59977c4edd5c536651bb893abc8edaa6c1cd0c44 --- /dev/null +++ b/codenet/public_test_cases/p00418/input.0.txt @@ -0,0 +1,6 @@ +3 2 +5 1 +10 4 +6 2 +2 1 3 +3 2 1 diff --git a/codenet/public_test_cases/p00418/output.0.txt b/codenet/public_test_cases/p00418/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea90ee31980757b2e469741512bcb39e73494e78 --- /dev/null +++ b/codenet/public_test_cases/p00418/output.0.txt @@ -0,0 +1 @@ +45 diff --git a/codenet/public_test_cases/p00419/input.0.txt b/codenet/public_test_cases/p00419/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6f1789eae64e1a0dc9b148721616ecb5bfbe02b --- /dev/null +++ b/codenet/public_test_cases/p00419/input.0.txt @@ -0,0 +1,5 @@ +4 +aedb +aeb +ebCd +cdE diff --git a/codenet/public_test_cases/p00419/output.0.txt b/codenet/public_test_cases/p00419/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00419/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00420/input.0.txt b/codenet/public_test_cases/p00420/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b1b1617215d729b1d365e7742deec0a1ba73783 --- /dev/null +++ b/codenet/public_test_cases/p00420/input.0.txt @@ -0,0 +1,14 @@ +6 5 8 +1 3 +2 5 +3 4 +2 4 +2 5 +1 1 5 1 +1 1 5 2 +1 1 5 3 +1 1 5 4 +1 1 5 5 +1 1 5 6 +2 3 4 2 +1 1 1 1 diff --git a/codenet/public_test_cases/p00420/input.1.txt b/codenet/public_test_cases/p00420/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b1b1617215d729b1d365e7742deec0a1ba73783 --- /dev/null +++ b/codenet/public_test_cases/p00420/input.1.txt @@ -0,0 +1,14 @@ +6 5 8 +1 3 +2 5 +3 4 +2 4 +2 5 +1 1 5 1 +1 1 5 2 +1 1 5 3 +1 1 5 4 +1 1 5 5 +1 1 5 6 +2 3 4 2 +1 1 1 1 diff --git a/codenet/public_test_cases/p00420/output.0.txt b/codenet/public_test_cases/p00420/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..baf2306b05602d030b93ad552e0af2a79a18077c --- /dev/null +++ b/codenet/public_test_cases/p00420/output.0.txt @@ -0,0 +1,8 @@ +3 +2 +4 +5 +1 +6 +4 +3 diff --git a/codenet/public_test_cases/p00420/output.1.txt b/codenet/public_test_cases/p00420/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..baf2306b05602d030b93ad552e0af2a79a18077c --- /dev/null +++ b/codenet/public_test_cases/p00420/output.1.txt @@ -0,0 +1,8 @@ +3 +2 +4 +5 +1 +6 +4 +3 diff --git a/codenet/public_test_cases/p00421/input.0.txt b/codenet/public_test_cases/p00421/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p00421/input.0.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p00421/output.0.txt b/codenet/public_test_cases/p00421/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00421/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00423/input.0.txt b/codenet/public_test_cases/p00423/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a75a6fcaffe30984ec8a909a79c4c8090401fb58 --- /dev/null +++ b/codenet/public_test_cases/p00423/input.0.txt @@ -0,0 +1,13 @@ +3 +9 1 +5 4 +0 8 +3 +9 1 +5 4 +1 0 +3 +9 1 +5 5 +1 8 +0 diff --git a/codenet/public_test_cases/p00423/input.1.txt b/codenet/public_test_cases/p00423/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a75a6fcaffe30984ec8a909a79c4c8090401fb58 --- /dev/null +++ b/codenet/public_test_cases/p00423/input.1.txt @@ -0,0 +1,13 @@ +3 +9 1 +5 4 +0 8 +3 +9 1 +5 4 +1 0 +3 +9 1 +5 5 +1 8 +0 diff --git a/codenet/public_test_cases/p00423/output.0.txt b/codenet/public_test_cases/p00423/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea911a6068edd02c9750b1b3107bef19da0d2036 --- /dev/null +++ b/codenet/public_test_cases/p00423/output.0.txt @@ -0,0 +1,3 @@ +19 8 +20 0 +15 14 diff --git a/codenet/public_test_cases/p00423/output.1.txt b/codenet/public_test_cases/p00423/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea911a6068edd02c9750b1b3107bef19da0d2036 --- /dev/null +++ b/codenet/public_test_cases/p00423/output.1.txt @@ -0,0 +1,3 @@ +19 8 +20 0 +15 14 diff --git a/codenet/public_test_cases/p00424/input.0.txt b/codenet/public_test_cases/p00424/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..545c847d9e06984e3a9917b4973518e68055f50c --- /dev/null +++ b/codenet/public_test_cases/p00424/input.0.txt @@ -0,0 +1,31 @@ +3 +A a +0 5 +5 4 +10 +A +B +C +0 +1 +4 +5 +a +b +A +3 +A a +0 5 +5 4 +10 +A +B +C +0 +1 +4 +5 +a +b +A +0 diff --git a/codenet/public_test_cases/p00424/input.1.txt b/codenet/public_test_cases/p00424/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..545c847d9e06984e3a9917b4973518e68055f50c --- /dev/null +++ b/codenet/public_test_cases/p00424/input.1.txt @@ -0,0 +1,31 @@ +3 +A a +0 5 +5 4 +10 +A +B +C +0 +1 +4 +5 +a +b +A +3 +A a +0 5 +5 4 +10 +A +B +C +0 +1 +4 +5 +a +b +A +0 diff --git a/codenet/public_test_cases/p00424/output.0.txt b/codenet/public_test_cases/p00424/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b710f45edd7c23b563c7a84b80a034ee60bc0c8 --- /dev/null +++ b/codenet/public_test_cases/p00424/output.0.txt @@ -0,0 +1,2 @@ +aBC5144aba +aBC5144aba diff --git a/codenet/public_test_cases/p00424/output.1.txt b/codenet/public_test_cases/p00424/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b710f45edd7c23b563c7a84b80a034ee60bc0c8 --- /dev/null +++ b/codenet/public_test_cases/p00424/output.1.txt @@ -0,0 +1,2 @@ +aBC5144aba +aBC5144aba diff --git a/codenet/public_test_cases/p00425/input.0.txt b/codenet/public_test_cases/p00425/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe298eb30c959a1ac9bf9fc9773625c2e2a25aea --- /dev/null +++ b/codenet/public_test_cases/p00425/input.0.txt @@ -0,0 +1,16 @@ +5 +North +North +East +South +West +8 +West +North +Left +South +Right +North +Left +East +0 diff --git a/codenet/public_test_cases/p00425/input.1.txt b/codenet/public_test_cases/p00425/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe298eb30c959a1ac9bf9fc9773625c2e2a25aea --- /dev/null +++ b/codenet/public_test_cases/p00425/input.1.txt @@ -0,0 +1,16 @@ +5 +North +North +East +South +West +8 +West +North +Left +South +Right +North +Left +East +0 diff --git a/codenet/public_test_cases/p00425/output.0.txt b/codenet/public_test_cases/p00425/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a263c1c69619a30b0d235e488744c7cb1ce702db --- /dev/null +++ b/codenet/public_test_cases/p00425/output.0.txt @@ -0,0 +1,2 @@ +21 +34 diff --git a/codenet/public_test_cases/p00425/output.1.txt b/codenet/public_test_cases/p00425/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a263c1c69619a30b0d235e488744c7cb1ce702db --- /dev/null +++ b/codenet/public_test_cases/p00425/output.1.txt @@ -0,0 +1,2 @@ +21 +34 diff --git a/codenet/public_test_cases/p00426/input.0.txt b/codenet/public_test_cases/p00426/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b321f0b53dfa3bc9113deb94b84070aac89b98b9 --- /dev/null +++ b/codenet/public_test_cases/p00426/input.0.txt @@ -0,0 +1,17 @@ +3 10 +0 +1 1 +2 2 3 +4 20 +2 1 2 +1 3 +1 4 +2 5 +2 1 2 +0 +0 +3 3 +0 +1 1 +2 2 3 +0 0 diff --git a/codenet/public_test_cases/p00426/input.1.txt b/codenet/public_test_cases/p00426/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b321f0b53dfa3bc9113deb94b84070aac89b98b9 --- /dev/null +++ b/codenet/public_test_cases/p00426/input.1.txt @@ -0,0 +1,17 @@ +3 10 +0 +1 1 +2 2 3 +4 20 +2 1 2 +1 3 +1 4 +2 5 +2 1 2 +0 +0 +3 3 +0 +1 1 +2 2 3 +0 0 diff --git a/codenet/public_test_cases/p00426/output.0.txt b/codenet/public_test_cases/p00426/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fef050a5dbc28a72a70798c177c328aba61e936e --- /dev/null +++ b/codenet/public_test_cases/p00426/output.0.txt @@ -0,0 +1,4 @@ +9 +3 +0 +-1 diff --git a/codenet/public_test_cases/p00426/output.1.txt b/codenet/public_test_cases/p00426/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fef050a5dbc28a72a70798c177c328aba61e936e --- /dev/null +++ b/codenet/public_test_cases/p00426/output.1.txt @@ -0,0 +1,4 @@ +9 +3 +0 +-1 diff --git a/codenet/public_test_cases/p00427/input.0.txt b/codenet/public_test_cases/p00427/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ca40a1bdc9110d955b57234f8c24c3c48cb4c46 --- /dev/null +++ b/codenet/public_test_cases/p00427/input.0.txt @@ -0,0 +1,4 @@ +2 1 0 5 +3 1 1 3 +2 2 1 3 +0 0 0 0 diff --git a/codenet/public_test_cases/p00427/input.1.txt b/codenet/public_test_cases/p00427/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ca40a1bdc9110d955b57234f8c24c3c48cb4c46 --- /dev/null +++ b/codenet/public_test_cases/p00427/input.1.txt @@ -0,0 +1,4 @@ +2 1 0 5 +3 1 1 3 +2 2 1 3 +0 0 0 0 diff --git a/codenet/public_test_cases/p00427/output.0.txt b/codenet/public_test_cases/p00427/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..947c1292c4db030528a9da2ea379c5855e86795c --- /dev/null +++ b/codenet/public_test_cases/p00427/output.0.txt @@ -0,0 +1,3 @@ +0.50000 +0.833 +1.000 diff --git a/codenet/public_test_cases/p00427/output.1.txt b/codenet/public_test_cases/p00427/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..947c1292c4db030528a9da2ea379c5855e86795c --- /dev/null +++ b/codenet/public_test_cases/p00427/output.1.txt @@ -0,0 +1,3 @@ +0.50000 +0.833 +1.000 diff --git a/codenet/public_test_cases/p00428/input.0.txt b/codenet/public_test_cases/p00428/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b8465baa2e36bb8b9370fa5ced5ae5e18fafdc3 --- /dev/null +++ b/codenet/public_test_cases/p00428/input.0.txt @@ -0,0 +1,11 @@ +4 6 +1 0 1 0 1 1 +1 1 0 1 0 0 +1 1 1 0 0 0 +1 0 1 0 1 0 +4 6 +1 0 1 0 1 1 +1 1 0 1 0 0 +1 1 1 0 0 0 +1 0 1 0 1 0 +0 0 diff --git a/codenet/public_test_cases/p00428/input.1.txt b/codenet/public_test_cases/p00428/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b8465baa2e36bb8b9370fa5ced5ae5e18fafdc3 --- /dev/null +++ b/codenet/public_test_cases/p00428/input.1.txt @@ -0,0 +1,11 @@ +4 6 +1 0 1 0 1 1 +1 1 0 1 0 0 +1 1 1 0 0 0 +1 0 1 0 1 0 +4 6 +1 0 1 0 1 1 +1 1 0 1 0 0 +1 1 1 0 0 0 +1 0 1 0 1 0 +0 0 diff --git a/codenet/public_test_cases/p00428/output.0.txt b/codenet/public_test_cases/p00428/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cbce0221ac234b2438cd31d439623e80e25d4dc --- /dev/null +++ b/codenet/public_test_cases/p00428/output.0.txt @@ -0,0 +1,2 @@ +1 3 2 5 4 6 +1 3 2 5 4 6 diff --git a/codenet/public_test_cases/p00428/output.1.txt b/codenet/public_test_cases/p00428/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cbce0221ac234b2438cd31d439623e80e25d4dc --- /dev/null +++ b/codenet/public_test_cases/p00428/output.1.txt @@ -0,0 +1,2 @@ +1 3 2 5 4 6 +1 3 2 5 4 6 diff --git a/codenet/public_test_cases/p00429/input.0.txt b/codenet/public_test_cases/p00429/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9eb61143906b64a2ea672325aca9e841b499f3a --- /dev/null +++ b/codenet/public_test_cases/p00429/input.0.txt @@ -0,0 +1,5 @@ +5 +11 +5 +11 +0 diff --git a/codenet/public_test_cases/p00429/input.1.txt b/codenet/public_test_cases/p00429/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9eb61143906b64a2ea672325aca9e841b499f3a --- /dev/null +++ b/codenet/public_test_cases/p00429/input.1.txt @@ -0,0 +1,5 @@ +5 +11 +5 +11 +0 diff --git a/codenet/public_test_cases/p00429/output.0.txt b/codenet/public_test_cases/p00429/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9785d3a4e5283eab1f9ba4275827dcec7521f2d --- /dev/null +++ b/codenet/public_test_cases/p00429/output.0.txt @@ -0,0 +1,2 @@ +13112221 +13112221 diff --git a/codenet/public_test_cases/p00429/output.1.txt b/codenet/public_test_cases/p00429/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9785d3a4e5283eab1f9ba4275827dcec7521f2d --- /dev/null +++ b/codenet/public_test_cases/p00429/output.1.txt @@ -0,0 +1,2 @@ +13112221 +13112221 diff --git a/codenet/public_test_cases/p00430/input.0.txt b/codenet/public_test_cases/p00430/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9123d3fdf769283958f86264e8407b48b28d2f15 --- /dev/null +++ b/codenet/public_test_cases/p00430/input.0.txt @@ -0,0 +1,3 @@ +5 +5 +0 diff --git a/codenet/public_test_cases/p00430/input.1.txt b/codenet/public_test_cases/p00430/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9123d3fdf769283958f86264e8407b48b28d2f15 --- /dev/null +++ b/codenet/public_test_cases/p00430/input.1.txt @@ -0,0 +1,3 @@ +5 +5 +0 diff --git a/codenet/public_test_cases/p00430/output.0.txt b/codenet/public_test_cases/p00430/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b8e99f42ebb51d4b33ce4464706d6d0b6207c72 --- /dev/null +++ b/codenet/public_test_cases/p00430/output.0.txt @@ -0,0 +1,14 @@ +5 +4 1 +3 2 +3 1 1 +2 2 1 +2 1 1 1 +1 1 1 1 1 +5 +4 1 +3 2 +3 1 1 +2 2 1 +2 1 1 1 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p00430/output.1.txt b/codenet/public_test_cases/p00430/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b8e99f42ebb51d4b33ce4464706d6d0b6207c72 --- /dev/null +++ b/codenet/public_test_cases/p00430/output.1.txt @@ -0,0 +1,14 @@ +5 +4 1 +3 2 +3 1 1 +2 2 1 +2 1 1 1 +1 1 1 1 1 +5 +4 1 +3 2 +3 1 1 +2 2 1 +2 1 1 1 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p00431/input.0.txt b/codenet/public_test_cases/p00431/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..741af568cc12629cd7423f310c01ef815f3630b0 --- /dev/null +++ b/codenet/public_test_cases/p00431/input.0.txt @@ -0,0 +1,24 @@ +7 +1 3 +3 4 +1 4 +2 7 +5 7 +6 7 +1 7 +6 +1 2 +2 3 +3 4 +4 5 +1 5 +2 6 +7 +1 3 +2 4 +3 5 +4 6 +6 7 +2 6 +4 7 +0 diff --git a/codenet/public_test_cases/p00431/input.1.txt b/codenet/public_test_cases/p00431/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..741af568cc12629cd7423f310c01ef815f3630b0 --- /dev/null +++ b/codenet/public_test_cases/p00431/input.1.txt @@ -0,0 +1,24 @@ +7 +1 3 +3 4 +1 4 +2 7 +5 7 +6 7 +1 7 +6 +1 2 +2 3 +3 4 +4 5 +1 5 +2 6 +7 +1 3 +2 4 +3 5 +4 6 +6 7 +2 6 +4 7 +0 diff --git a/codenet/public_test_cases/p00431/output.0.txt b/codenet/public_test_cases/p00431/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e698d749bc1500f16e1f0ecd18f53916f75be02 --- /dev/null +++ b/codenet/public_test_cases/p00431/output.0.txt @@ -0,0 +1,3 @@ +5 +6 +4 diff --git a/codenet/public_test_cases/p00431/output.1.txt b/codenet/public_test_cases/p00431/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e698d749bc1500f16e1f0ecd18f53916f75be02 --- /dev/null +++ b/codenet/public_test_cases/p00431/output.1.txt @@ -0,0 +1,3 @@ +5 +6 +4 diff --git a/codenet/public_test_cases/p00432/input.0.txt b/codenet/public_test_cases/p00432/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2da779d31fb3188ed290488a8fca8eb4494e44e --- /dev/null +++ b/codenet/public_test_cases/p00432/input.0.txt @@ -0,0 +1,20 @@ +5 1 +0 0 3 2 +1 1 2 5 +0 4 6 5 +3 3 5 6 +5 0 7 6 +5 2 +0 0 3 2 +1 1 2 5 +0 4 6 5 +3 3 5 6 +5 0 7 6 +2 2 +0 0 8 9 +0 0 9 8 +3 2 +2 2 8 8 +3 0 4 9 +5 0 7 9 +0 0 diff --git a/codenet/public_test_cases/p00432/input.1.txt b/codenet/public_test_cases/p00432/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2da779d31fb3188ed290488a8fca8eb4494e44e --- /dev/null +++ b/codenet/public_test_cases/p00432/input.1.txt @@ -0,0 +1,20 @@ +5 1 +0 0 3 2 +1 1 2 5 +0 4 6 5 +3 3 5 6 +5 0 7 6 +5 2 +0 0 3 2 +1 1 2 5 +0 4 6 5 +3 3 5 6 +5 0 7 6 +2 2 +0 0 8 9 +0 0 9 8 +3 2 +2 2 8 8 +3 0 4 9 +5 0 7 9 +0 0 diff --git a/codenet/public_test_cases/p00432/output.0.txt b/codenet/public_test_cases/p00432/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1f440674b665a369f24bc5eb9d232cf3b334dc2 --- /dev/null +++ b/codenet/public_test_cases/p00432/output.0.txt @@ -0,0 +1,7 @@ +29 +29 +38 +80 +36 +45 +36 diff --git a/codenet/public_test_cases/p00432/output.1.txt b/codenet/public_test_cases/p00432/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1f440674b665a369f24bc5eb9d232cf3b334dc2 --- /dev/null +++ b/codenet/public_test_cases/p00432/output.1.txt @@ -0,0 +1,7 @@ +29 +29 +38 +80 +36 +45 +36 diff --git a/codenet/public_test_cases/p00433/input.0.txt b/codenet/public_test_cases/p00433/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe69cff9c9ff32fbc1e04453e98dc6d0ad747a50 --- /dev/null +++ b/codenet/public_test_cases/p00433/input.0.txt @@ -0,0 +1,2 @@ +100 80 70 60 +80 70 80 90 diff --git a/codenet/public_test_cases/p00433/output.0.txt b/codenet/public_test_cases/p00433/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18eed1357e5cd545ac4b5945c0d350f8317748c3 --- /dev/null +++ b/codenet/public_test_cases/p00433/output.0.txt @@ -0,0 +1 @@ +320 diff --git a/codenet/public_test_cases/p00434/input.0.txt b/codenet/public_test_cases/p00434/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3948bb0d00b6c6c1a7f0c977a3bedc8be689dba7 --- /dev/null +++ b/codenet/public_test_cases/p00434/input.0.txt @@ -0,0 +1,28 @@ +3 +1 +4 +5 +7 +9 +6 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 diff --git a/codenet/public_test_cases/p00434/output.0.txt b/codenet/public_test_cases/p00434/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3d01f2b95d9739fba02133c689ca1278557347b --- /dev/null +++ b/codenet/public_test_cases/p00434/output.0.txt @@ -0,0 +1,2 @@ +2 +8 diff --git a/codenet/public_test_cases/p00435/input.0.txt b/codenet/public_test_cases/p00435/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba806d3d44888ce79b5f7d9c088774187f3356b2 --- /dev/null +++ b/codenet/public_test_cases/p00435/input.0.txt @@ -0,0 +1 @@ +MRL diff --git a/codenet/public_test_cases/p00435/output.0.txt b/codenet/public_test_cases/p00435/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b496e2b7055c942b212f8da6d1c7d689c8951b65 --- /dev/null +++ b/codenet/public_test_cases/p00435/output.0.txt @@ -0,0 +1 @@ +JOI diff --git a/codenet/public_test_cases/p00436/input.0.txt b/codenet/public_test_cases/p00436/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe63bcfc7146e52114fbd10edcf36eb80bb814e5 --- /dev/null +++ b/codenet/public_test_cases/p00436/input.0.txt @@ -0,0 +1,4 @@ +2 +2 +1 +0 diff --git a/codenet/public_test_cases/p00436/output.0.txt b/codenet/public_test_cases/p00436/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bb81325da22b7d0ffd9d907136cfb58b03b0316 --- /dev/null +++ b/codenet/public_test_cases/p00436/output.0.txt @@ -0,0 +1,4 @@ +2 +4 +3 +1 diff --git a/codenet/public_test_cases/p00437/input.0.txt b/codenet/public_test_cases/p00437/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93161b626ade5e8edd98b34a6a836b8139f8cd57 --- /dev/null +++ b/codenet/public_test_cases/p00437/input.0.txt @@ -0,0 +1,7 @@ +2 2 2 +4 +2 4 5 0 +2 3 6 0 +1 4 5 0 +2 3 5 1 +0 0 0 diff --git a/codenet/public_test_cases/p00437/input.1.txt b/codenet/public_test_cases/p00437/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..93161b626ade5e8edd98b34a6a836b8139f8cd57 --- /dev/null +++ b/codenet/public_test_cases/p00437/input.1.txt @@ -0,0 +1,7 @@ +2 2 2 +4 +2 4 5 0 +2 3 6 0 +1 4 5 0 +2 3 5 1 +0 0 0 diff --git a/codenet/public_test_cases/p00437/output.0.txt b/codenet/public_test_cases/p00437/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65ec6b09ea1cb1a7deb2d91d68c2c0fa99e35a16 --- /dev/null +++ b/codenet/public_test_cases/p00437/output.0.txt @@ -0,0 +1,6 @@ +2 +1 +1 +0 +1 +0 diff --git a/codenet/public_test_cases/p00437/output.1.txt b/codenet/public_test_cases/p00437/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..65ec6b09ea1cb1a7deb2d91d68c2c0fa99e35a16 --- /dev/null +++ b/codenet/public_test_cases/p00437/output.1.txt @@ -0,0 +1,6 @@ +2 +1 +1 +0 +1 +0 diff --git a/codenet/public_test_cases/p00438/input.0.txt b/codenet/public_test_cases/p00438/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b953d414bdebbb032851e5dc23487819701b6ae --- /dev/null +++ b/codenet/public_test_cases/p00438/input.0.txt @@ -0,0 +1,11 @@ +5 4 +3 +2 2 +2 3 +4 2 +5 4 +3 +2 2 +2 3 +4 2 +0 0 diff --git a/codenet/public_test_cases/p00438/output.0.txt b/codenet/public_test_cases/p00438/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd3c81a4d763121f1827c8b4bbdd0cef674c30f9 --- /dev/null +++ b/codenet/public_test_cases/p00438/output.0.txt @@ -0,0 +1,2 @@ +5 +5 diff --git a/codenet/public_test_cases/p00439/input.0.txt b/codenet/public_test_cases/p00439/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19282adfb138f38ac66ae29c07e8f504b6876112 --- /dev/null +++ b/codenet/public_test_cases/p00439/input.0.txt @@ -0,0 +1,7 @@ +5 3 +2 +5 +-4 +10 +3 +0 0 diff --git a/codenet/public_test_cases/p00439/input.1.txt b/codenet/public_test_cases/p00439/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19282adfb138f38ac66ae29c07e8f504b6876112 --- /dev/null +++ b/codenet/public_test_cases/p00439/input.1.txt @@ -0,0 +1,7 @@ +5 3 +2 +5 +-4 +10 +3 +0 0 diff --git a/codenet/public_test_cases/p00439/output.0.txt b/codenet/public_test_cases/p00439/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00439/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00439/output.1.txt b/codenet/public_test_cases/p00439/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00439/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00440/input.0.txt b/codenet/public_test_cases/p00440/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cd70477363c0b77af9d521f5c52cb32dc41dfcd --- /dev/null +++ b/codenet/public_test_cases/p00440/input.0.txt @@ -0,0 +1,13 @@ +7 5 +6 +2 +4 +7 +1 +7 5 +6 +2 +0 +4 +7 +0 0 diff --git a/codenet/public_test_cases/p00440/input.1.txt b/codenet/public_test_cases/p00440/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cd70477363c0b77af9d521f5c52cb32dc41dfcd --- /dev/null +++ b/codenet/public_test_cases/p00440/input.1.txt @@ -0,0 +1,13 @@ +7 5 +6 +2 +4 +7 +1 +7 5 +6 +2 +0 +4 +7 +0 0 diff --git a/codenet/public_test_cases/p00440/output.0.txt b/codenet/public_test_cases/p00440/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da7f84740bd775747fe094def1e06a800d8e874f --- /dev/null +++ b/codenet/public_test_cases/p00440/output.0.txt @@ -0,0 +1,2 @@ +2 +4 diff --git a/codenet/public_test_cases/p00440/output.1.txt b/codenet/public_test_cases/p00440/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..da7f84740bd775747fe094def1e06a800d8e874f --- /dev/null +++ b/codenet/public_test_cases/p00440/output.1.txt @@ -0,0 +1,2 @@ +2 +4 diff --git a/codenet/public_test_cases/p00441/input.0.txt b/codenet/public_test_cases/p00441/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f8665679276933fb894502b316b9dc23adf6087 --- /dev/null +++ b/codenet/public_test_cases/p00441/input.0.txt @@ -0,0 +1,23 @@ +10 +9 4 +4 3 +1 1 +4 2 +2 4 +5 8 +4 0 +5 3 +0 5 +5 2 +10 +9 4 +4 3 +1 1 +4 2 +2 4 +5 8 +4 0 +5 3 +0 5 +5 2 +0 diff --git a/codenet/public_test_cases/p00441/input.1.txt b/codenet/public_test_cases/p00441/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f8665679276933fb894502b316b9dc23adf6087 --- /dev/null +++ b/codenet/public_test_cases/p00441/input.1.txt @@ -0,0 +1,23 @@ +10 +9 4 +4 3 +1 1 +4 2 +2 4 +5 8 +4 0 +5 3 +0 5 +5 2 +10 +9 4 +4 3 +1 1 +4 2 +2 4 +5 8 +4 0 +5 3 +0 5 +5 2 +0 diff --git a/codenet/public_test_cases/p00441/output.0.txt b/codenet/public_test_cases/p00441/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2f7f08c17074991c47ce9b2475c3fe58fc26247 --- /dev/null +++ b/codenet/public_test_cases/p00441/output.0.txt @@ -0,0 +1,2 @@ +10 +10 diff --git a/codenet/public_test_cases/p00441/output.1.txt b/codenet/public_test_cases/p00441/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2f7f08c17074991c47ce9b2475c3fe58fc26247 --- /dev/null +++ b/codenet/public_test_cases/p00441/output.1.txt @@ -0,0 +1,2 @@ +10 +10 diff --git a/codenet/public_test_cases/p00442/input.0.txt b/codenet/public_test_cases/p00442/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69f4ed7f6db64d561e08441baf8a29f23d1e61a6 --- /dev/null +++ b/codenet/public_test_cases/p00442/input.0.txt @@ -0,0 +1,7 @@ +4 +5 +1 2 +3 1 +3 2 +3 4 +4 1 diff --git a/codenet/public_test_cases/p00442/output.0.txt b/codenet/public_test_cases/p00442/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69e2390beecb62f1d6572feae8ffd858bb926b00 --- /dev/null +++ b/codenet/public_test_cases/p00442/output.0.txt @@ -0,0 +1,5 @@ +3 +4 +1 +2 +0 diff --git a/codenet/public_test_cases/p00443/input.0.txt b/codenet/public_test_cases/p00443/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b482a9a3e9de9255c389eee5068410e8a2285e --- /dev/null +++ b/codenet/public_test_cases/p00443/input.0.txt @@ -0,0 +1,8 @@ +1 +6 9 0 0 +4 +3 2 0 4 +1 3 0 0 +4 4 2 1 +2 2 0 0 +0 diff --git a/codenet/public_test_cases/p00443/input.1.txt b/codenet/public_test_cases/p00443/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b482a9a3e9de9255c389eee5068410e8a2285e --- /dev/null +++ b/codenet/public_test_cases/p00443/input.1.txt @@ -0,0 +1,8 @@ +1 +6 9 0 0 +4 +3 2 0 4 +1 3 0 0 +4 4 2 1 +2 2 0 0 +0 diff --git a/codenet/public_test_cases/p00443/output.0.txt b/codenet/public_test_cases/p00443/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..356775bbbf6c8eebd9ac7062d5a15792939e0b66 --- /dev/null +++ b/codenet/public_test_cases/p00443/output.0.txt @@ -0,0 +1,2 @@ +5 +40 diff --git a/codenet/public_test_cases/p00443/output.1.txt b/codenet/public_test_cases/p00443/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..356775bbbf6c8eebd9ac7062d5a15792939e0b66 --- /dev/null +++ b/codenet/public_test_cases/p00443/output.1.txt @@ -0,0 +1,2 @@ +5 +40 diff --git a/codenet/public_test_cases/p00444/input.0.txt b/codenet/public_test_cases/p00444/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3c1ccf1e8dd98441137861f99976a5b6bd65dc7 --- /dev/null +++ b/codenet/public_test_cases/p00444/input.0.txt @@ -0,0 +1,3 @@ +380 +1 +0 diff --git a/codenet/public_test_cases/p00444/input.1.txt b/codenet/public_test_cases/p00444/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3c1ccf1e8dd98441137861f99976a5b6bd65dc7 --- /dev/null +++ b/codenet/public_test_cases/p00444/input.1.txt @@ -0,0 +1,3 @@ +380 +1 +0 diff --git a/codenet/public_test_cases/p00444/output.0.txt b/codenet/public_test_cases/p00444/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18febc72d15f481d3d5ff77e1d3993cc9f8d8432 --- /dev/null +++ b/codenet/public_test_cases/p00444/output.0.txt @@ -0,0 +1,2 @@ +4 +15 diff --git a/codenet/public_test_cases/p00444/output.1.txt b/codenet/public_test_cases/p00444/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18febc72d15f481d3d5ff77e1d3993cc9f8d8432 --- /dev/null +++ b/codenet/public_test_cases/p00444/output.1.txt @@ -0,0 +1,2 @@ +4 +15 diff --git a/codenet/public_test_cases/p00445/input.0.txt b/codenet/public_test_cases/p00445/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32b5b558da8ff0b8c0abdeeab44c4a6a76d2ea5b --- /dev/null +++ b/codenet/public_test_cases/p00445/input.0.txt @@ -0,0 +1,3 @@ +JOIJOI +JOIOIOIOI +JOIOIJOINXNXJIOIOIOJ diff --git a/codenet/public_test_cases/p00445/input.1.txt b/codenet/public_test_cases/p00445/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32b5b558da8ff0b8c0abdeeab44c4a6a76d2ea5b --- /dev/null +++ b/codenet/public_test_cases/p00445/input.1.txt @@ -0,0 +1,3 @@ +JOIJOI +JOIOIOIOI +JOIOIJOINXNXJIOIOIOJ diff --git a/codenet/public_test_cases/p00445/input.2.txt b/codenet/public_test_cases/p00445/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00445/input.2.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00445/output.0.txt b/codenet/public_test_cases/p00445/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdf8784694025c7004587c5e09fbfec9195ef99b --- /dev/null +++ b/codenet/public_test_cases/p00445/output.0.txt @@ -0,0 +1,6 @@ +2 +0 +1 +3 +2 +3 diff --git a/codenet/public_test_cases/p00445/output.1.txt b/codenet/public_test_cases/p00445/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdf8784694025c7004587c5e09fbfec9195ef99b --- /dev/null +++ b/codenet/public_test_cases/p00445/output.1.txt @@ -0,0 +1,6 @@ +2 +0 +1 +3 +2 +3 diff --git a/codenet/public_test_cases/p00445/output.2.txt b/codenet/public_test_cases/p00445/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00445/output.2.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00446/input.0.txt b/codenet/public_test_cases/p00446/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2e72e9dd024e6e120b54583490c457cc6b20c2c --- /dev/null +++ b/codenet/public_test_cases/p00446/input.0.txt @@ -0,0 +1,18 @@ +5 +1 +7 +9 +6 +10 +10 +8 +7 +14 +18 +4 +11 +3 +17 +5 +19 +0 diff --git a/codenet/public_test_cases/p00446/input.1.txt b/codenet/public_test_cases/p00446/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2e72e9dd024e6e120b54583490c457cc6b20c2c --- /dev/null +++ b/codenet/public_test_cases/p00446/input.1.txt @@ -0,0 +1,18 @@ +5 +1 +7 +9 +6 +10 +10 +8 +7 +14 +18 +4 +11 +3 +17 +5 +19 +0 diff --git a/codenet/public_test_cases/p00446/output.0.txt b/codenet/public_test_cases/p00446/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a64f7d5acc3b5e0c909a0f970fd85d7f35e8401 --- /dev/null +++ b/codenet/public_test_cases/p00446/output.0.txt @@ -0,0 +1,4 @@ +3 +0 +2 +0 diff --git a/codenet/public_test_cases/p00446/output.1.txt b/codenet/public_test_cases/p00446/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a64f7d5acc3b5e0c909a0f970fd85d7f35e8401 --- /dev/null +++ b/codenet/public_test_cases/p00446/output.1.txt @@ -0,0 +1,4 @@ +3 +0 +2 +0 diff --git a/codenet/public_test_cases/p00447/input.0.txt b/codenet/public_test_cases/p00447/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0585bb1357dca7a4102ad8ae1acf59479d0523e --- /dev/null +++ b/codenet/public_test_cases/p00447/input.0.txt @@ -0,0 +1,35 @@ +5 +8 5 +6 4 +4 3 +7 10 +0 10 +10 +10 5 +2 7 +9 7 +8 10 +10 2 +1 2 +8 1 +6 7 +6 0 +0 9 +5 +904207 809784 +845370 244806 +499091 59863 +638406 182509 +435076 362268 +10 +757559 866424 +114810 239537 +519926 989458 +461089 424480 +674361 448440 +81851 150384 +459107 795405 +299682 6700 +254125 362183 +50795 541942 +0 diff --git a/codenet/public_test_cases/p00447/input.1.txt b/codenet/public_test_cases/p00447/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0585bb1357dca7a4102ad8ae1acf59479d0523e --- /dev/null +++ b/codenet/public_test_cases/p00447/input.1.txt @@ -0,0 +1,35 @@ +5 +8 5 +6 4 +4 3 +7 10 +0 10 +10 +10 5 +2 7 +9 7 +8 10 +10 2 +1 2 +8 1 +6 7 +6 0 +0 9 +5 +904207 809784 +845370 244806 +499091 59863 +638406 182509 +435076 362268 +10 +757559 866424 +114810 239537 +519926 989458 +461089 424480 +674361 448440 +81851 150384 +459107 795405 +299682 6700 +254125 362183 +50795 541942 +0 diff --git a/codenet/public_test_cases/p00447/output.0.txt b/codenet/public_test_cases/p00447/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08cdc6a77588b7b89c1bd5f9f6cf37089248f091 --- /dev/null +++ b/codenet/public_test_cases/p00447/output.0.txt @@ -0,0 +1,2 @@ +2 -3 +-384281 179674 diff --git a/codenet/public_test_cases/p00447/output.1.txt b/codenet/public_test_cases/p00447/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08cdc6a77588b7b89c1bd5f9f6cf37089248f091 --- /dev/null +++ b/codenet/public_test_cases/p00447/output.1.txt @@ -0,0 +1,2 @@ +2 -3 +-384281 179674 diff --git a/codenet/public_test_cases/p00448/input.0.txt b/codenet/public_test_cases/p00448/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..86b6a66d82844dc3697274d9206f709279757bc5 --- /dev/null +++ b/codenet/public_test_cases/p00448/input.0.txt @@ -0,0 +1,8 @@ +2 5 +0 1 0 1 0 +1 0 0 0 1 +3 6 +1 0 0 0 1 0 +1 1 1 0 1 0 +1 0 1 1 0 1 +0 0 diff --git a/codenet/public_test_cases/p00448/input.1.txt b/codenet/public_test_cases/p00448/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86b6a66d82844dc3697274d9206f709279757bc5 --- /dev/null +++ b/codenet/public_test_cases/p00448/input.1.txt @@ -0,0 +1,8 @@ +2 5 +0 1 0 1 0 +1 0 0 0 1 +3 6 +1 0 0 0 1 0 +1 1 1 0 1 0 +1 0 1 1 0 1 +0 0 diff --git a/codenet/public_test_cases/p00448/output.0.txt b/codenet/public_test_cases/p00448/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..777df8f5dc310388ad71bf351843c94d01755310 --- /dev/null +++ b/codenet/public_test_cases/p00448/output.0.txt @@ -0,0 +1,2 @@ +9 +15 diff --git a/codenet/public_test_cases/p00448/output.1.txt b/codenet/public_test_cases/p00448/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..777df8f5dc310388ad71bf351843c94d01755310 --- /dev/null +++ b/codenet/public_test_cases/p00448/output.1.txt @@ -0,0 +1,2 @@ +9 +15 diff --git a/codenet/public_test_cases/p00449/input.0.txt b/codenet/public_test_cases/p00449/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d7049841c009171cd5dcb946670977903122d75 --- /dev/null +++ b/codenet/public_test_cases/p00449/input.0.txt @@ -0,0 +1,27 @@ +3 8 +1 3 1 10 +0 2 3 +1 2 3 20 +1 1 2 5 +0 3 2 +1 1 3 7 +1 2 1 9 +0 2 3 +5 16 +1 1 2 343750 +1 1 3 3343 +1 1 4 347392 +1 1 5 5497 +1 2 3 123394 +1 2 4 545492 +1 2 5 458 +1 3 4 343983 +1 3 5 843468 +1 4 5 15934 +0 2 1 +0 4 1 +0 3 2 +0 4 2 +0 4 3 +0 5 3 +0 0 diff --git a/codenet/public_test_cases/p00449/input.1.txt b/codenet/public_test_cases/p00449/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d7049841c009171cd5dcb946670977903122d75 --- /dev/null +++ b/codenet/public_test_cases/p00449/input.1.txt @@ -0,0 +1,27 @@ +3 8 +1 3 1 10 +0 2 3 +1 2 3 20 +1 1 2 5 +0 3 2 +1 1 3 7 +1 2 1 9 +0 2 3 +5 16 +1 1 2 343750 +1 1 3 3343 +1 1 4 347392 +1 1 5 5497 +1 2 3 123394 +1 2 4 545492 +1 2 5 458 +1 3 4 343983 +1 3 5 843468 +1 4 5 15934 +0 2 1 +0 4 1 +0 3 2 +0 4 2 +0 4 3 +0 5 3 +0 0 diff --git a/codenet/public_test_cases/p00449/output.0.txt b/codenet/public_test_cases/p00449/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..46ac8161d440fbb128d2d250dbee8dce08a74b58 --- /dev/null +++ b/codenet/public_test_cases/p00449/output.0.txt @@ -0,0 +1,9 @@ +-1 +15 +12 +5955 +21431 +9298 +16392 +24774 +8840 diff --git a/codenet/public_test_cases/p00449/output.1.txt b/codenet/public_test_cases/p00449/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46ac8161d440fbb128d2d250dbee8dce08a74b58 --- /dev/null +++ b/codenet/public_test_cases/p00449/output.1.txt @@ -0,0 +1,9 @@ +-1 +15 +12 +5955 +21431 +9298 +16392 +24774 +8840 diff --git a/codenet/public_test_cases/p00450/input.0.txt b/codenet/public_test_cases/p00450/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5832e0e57409ef2ded94d200672b5446d8228380 --- /dev/null +++ b/codenet/public_test_cases/p00450/input.0.txt @@ -0,0 +1,19 @@ +8 +1 +0 +1 +1 +0 +0 +0 +0 +8 +1 +0 +1 +1 +0 +0 +0 +1 +0 diff --git a/codenet/public_test_cases/p00450/input.1.txt b/codenet/public_test_cases/p00450/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5832e0e57409ef2ded94d200672b5446d8228380 --- /dev/null +++ b/codenet/public_test_cases/p00450/input.1.txt @@ -0,0 +1,19 @@ +8 +1 +0 +1 +1 +0 +0 +0 +0 +8 +1 +0 +1 +1 +0 +0 +0 +1 +0 diff --git a/codenet/public_test_cases/p00450/output.0.txt b/codenet/public_test_cases/p00450/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74abe52ea08f303355ad2b8a25939c5ba57c9224 --- /dev/null +++ b/codenet/public_test_cases/p00450/output.0.txt @@ -0,0 +1,2 @@ +6 +2 diff --git a/codenet/public_test_cases/p00450/output.1.txt b/codenet/public_test_cases/p00450/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74abe52ea08f303355ad2b8a25939c5ba57c9224 --- /dev/null +++ b/codenet/public_test_cases/p00450/output.1.txt @@ -0,0 +1,2 @@ +6 +2 diff --git a/codenet/public_test_cases/p00451/input.0.txt b/codenet/public_test_cases/p00451/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b45417ec75e25c8a324431cd9e8e0bd4a187825 --- /dev/null +++ b/codenet/public_test_cases/p00451/input.0.txt @@ -0,0 +1,4 @@ +ABRACADABRA +ECADADABRBCRDARA +UPWJCIRUCAXIIRGL +SBQNYBSBZDFNEV diff --git a/codenet/public_test_cases/p00451/input.1.txt b/codenet/public_test_cases/p00451/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00451/input.1.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00451/input.2.txt b/codenet/public_test_cases/p00451/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b45417ec75e25c8a324431cd9e8e0bd4a187825 --- /dev/null +++ b/codenet/public_test_cases/p00451/input.2.txt @@ -0,0 +1,4 @@ +ABRACADABRA +ECADADABRBCRDARA +UPWJCIRUCAXIIRGL +SBQNYBSBZDFNEV diff --git a/codenet/public_test_cases/p00451/output.0.txt b/codenet/public_test_cases/p00451/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb6e5ed4d8639a530576fe07e5332e9dcbf6424a --- /dev/null +++ b/codenet/public_test_cases/p00451/output.0.txt @@ -0,0 +1,2 @@ +5 +0 diff --git a/codenet/public_test_cases/p00451/output.1.txt b/codenet/public_test_cases/p00451/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00451/output.1.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00451/output.2.txt b/codenet/public_test_cases/p00451/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb6e5ed4d8639a530576fe07e5332e9dcbf6424a --- /dev/null +++ b/codenet/public_test_cases/p00451/output.2.txt @@ -0,0 +1,2 @@ +5 +0 diff --git a/codenet/public_test_cases/p00452/input.0.txt b/codenet/public_test_cases/p00452/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e911cee4724093f58fb397ca3a807e71234fdb79 --- /dev/null +++ b/codenet/public_test_cases/p00452/input.0.txt @@ -0,0 +1,10 @@ +4 50 +3 +14 +15 +9 +3 21 +16 +11 +2 +0 0 diff --git a/codenet/public_test_cases/p00452/input.1.txt b/codenet/public_test_cases/p00452/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e911cee4724093f58fb397ca3a807e71234fdb79 --- /dev/null +++ b/codenet/public_test_cases/p00452/input.1.txt @@ -0,0 +1,10 @@ +4 50 +3 +14 +15 +9 +3 21 +16 +11 +2 +0 0 diff --git a/codenet/public_test_cases/p00452/output.0.txt b/codenet/public_test_cases/p00452/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca9e09753a42b198c783922da4b2e20a4aac20f1 --- /dev/null +++ b/codenet/public_test_cases/p00452/output.0.txt @@ -0,0 +1,2 @@ +48 +20 diff --git a/codenet/public_test_cases/p00452/output.1.txt b/codenet/public_test_cases/p00452/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca9e09753a42b198c783922da4b2e20a4aac20f1 --- /dev/null +++ b/codenet/public_test_cases/p00452/output.1.txt @@ -0,0 +1,2 @@ +48 +20 diff --git a/codenet/public_test_cases/p00453/input.0.txt b/codenet/public_test_cases/p00453/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e45ca8447a171b55504938e476fa3920f09d7a3 --- /dev/null +++ b/codenet/public_test_cases/p00453/input.0.txt @@ -0,0 +1,13 @@ +5 1 +2 1 3 2 2 +1 3 2 +1 1 7 +1 2 1 +1 4 4 +5 0 +2 1 3 2 2 +1 3 2 +1 1 7 +1 2 1 +1 4 4 +0 0 diff --git a/codenet/public_test_cases/p00453/input.1.txt b/codenet/public_test_cases/p00453/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e45ca8447a171b55504938e476fa3920f09d7a3 --- /dev/null +++ b/codenet/public_test_cases/p00453/input.1.txt @@ -0,0 +1,13 @@ +5 1 +2 1 3 2 2 +1 3 2 +1 1 7 +1 2 1 +1 4 4 +5 0 +2 1 3 2 2 +1 3 2 +1 1 7 +1 2 1 +1 4 4 +0 0 diff --git a/codenet/public_test_cases/p00453/output.0.txt b/codenet/public_test_cases/p00453/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..39c1d301ccb811d0773790f977f88d7a7a2a5663 --- /dev/null +++ b/codenet/public_test_cases/p00453/output.0.txt @@ -0,0 +1,2 @@ +17 +40 diff --git a/codenet/public_test_cases/p00453/output.1.txt b/codenet/public_test_cases/p00453/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..39c1d301ccb811d0773790f977f88d7a7a2a5663 --- /dev/null +++ b/codenet/public_test_cases/p00453/output.1.txt @@ -0,0 +1,2 @@ +17 +40 diff --git a/codenet/public_test_cases/p00454/input.0.txt b/codenet/public_test_cases/p00454/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c243f8d0c8d6c6dabc2c70433309eacf46ed1fd0 --- /dev/null +++ b/codenet/public_test_cases/p00454/input.0.txt @@ -0,0 +1,13 @@ +15 6 +10 +1 4 5 6 +2 1 4 5 +1 0 5 1 +6 1 7 5 +7 5 9 6 +7 0 9 2 +9 1 10 5 +11 0 14 1 +12 1 13 5 +11 5 14 6 +0 0 diff --git a/codenet/public_test_cases/p00454/input.1.txt b/codenet/public_test_cases/p00454/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c243f8d0c8d6c6dabc2c70433309eacf46ed1fd0 --- /dev/null +++ b/codenet/public_test_cases/p00454/input.1.txt @@ -0,0 +1,13 @@ +15 6 +10 +1 4 5 6 +2 1 4 5 +1 0 5 1 +6 1 7 5 +7 5 9 6 +7 0 9 2 +9 1 10 5 +11 0 14 1 +12 1 13 5 +11 5 14 6 +0 0 diff --git a/codenet/public_test_cases/p00454/output.0.txt b/codenet/public_test_cases/p00454/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00454/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00454/output.1.txt b/codenet/public_test_cases/p00454/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00454/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00455/input.0.txt b/codenet/public_test_cases/p00455/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ccc8db9d43fb3a3ccebd0b6d3f4eca40a9a70cc --- /dev/null +++ b/codenet/public_test_cases/p00455/input.0.txt @@ -0,0 +1,3 @@ +9 0 0 18 0 0 +9 0 1 18 0 0 +12 14 52 12 15 30 diff --git a/codenet/public_test_cases/p00455/input.1.txt b/codenet/public_test_cases/p00455/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ccc8db9d43fb3a3ccebd0b6d3f4eca40a9a70cc --- /dev/null +++ b/codenet/public_test_cases/p00455/input.1.txt @@ -0,0 +1,3 @@ +9 0 0 18 0 0 +9 0 1 18 0 0 +12 14 52 12 15 30 diff --git a/codenet/public_test_cases/p00455/input.2.txt b/codenet/public_test_cases/p00455/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00455/input.2.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00455/output.0.txt b/codenet/public_test_cases/p00455/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fa22a61d599723190ed492cddae5260953c8838 --- /dev/null +++ b/codenet/public_test_cases/p00455/output.0.txt @@ -0,0 +1,3 @@ +9 0 0 +8 59 59 +0 0 38 diff --git a/codenet/public_test_cases/p00455/output.1.txt b/codenet/public_test_cases/p00455/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fa22a61d599723190ed492cddae5260953c8838 --- /dev/null +++ b/codenet/public_test_cases/p00455/output.1.txt @@ -0,0 +1,3 @@ +9 0 0 +8 59 59 +0 0 38 diff --git a/codenet/public_test_cases/p00455/output.2.txt b/codenet/public_test_cases/p00455/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00455/output.2.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00456/input.0.txt b/codenet/public_test_cases/p00456/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f99a72cbd95d7855db4a039739cf3d9b58c9594 --- /dev/null +++ b/codenet/public_test_cases/p00456/input.0.txt @@ -0,0 +1,20 @@ +23 +23 +20 +15 +15 +14 +13 +9 +7 +6 +25 +19 +17 +17 +16 +13 +12 +11 +9 +5 diff --git a/codenet/public_test_cases/p00456/output.0.txt b/codenet/public_test_cases/p00456/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f0141ba59d8eb271b7b4a541c2fc96a66bb2732 --- /dev/null +++ b/codenet/public_test_cases/p00456/output.0.txt @@ -0,0 +1 @@ +66 61 diff --git a/codenet/public_test_cases/p00457/input.0.txt b/codenet/public_test_cases/p00457/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..246bdf39c9d859fd1f8de47b36b0d5428088ee0e --- /dev/null +++ b/codenet/public_test_cases/p00457/input.0.txt @@ -0,0 +1,27 @@ +12 +3 +2 +1 +1 +2 +3 +2 +2 +2 +1 +1 +3 +12 +3 +2 +1 +1 +2 +3 +2 +1 +3 +2 +1 +3 +0 diff --git a/codenet/public_test_cases/p00457/input.1.txt b/codenet/public_test_cases/p00457/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..246bdf39c9d859fd1f8de47b36b0d5428088ee0e --- /dev/null +++ b/codenet/public_test_cases/p00457/input.1.txt @@ -0,0 +1,27 @@ +12 +3 +2 +1 +1 +2 +3 +2 +2 +2 +1 +1 +3 +12 +3 +2 +1 +1 +2 +3 +2 +1 +3 +2 +1 +3 +0 diff --git a/codenet/public_test_cases/p00457/output.0.txt b/codenet/public_test_cases/p00457/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd5972620bf4aba08b68a4d8b01c265a50ef25be --- /dev/null +++ b/codenet/public_test_cases/p00457/output.0.txt @@ -0,0 +1,2 @@ +3 +12 diff --git a/codenet/public_test_cases/p00457/output.1.txt b/codenet/public_test_cases/p00457/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd5972620bf4aba08b68a4d8b01c265a50ef25be --- /dev/null +++ b/codenet/public_test_cases/p00457/output.1.txt @@ -0,0 +1,2 @@ +3 +12 diff --git a/codenet/public_test_cases/p00458/input.0.txt b/codenet/public_test_cases/p00458/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ccbe7448b53f445b4c5817d6cef1e0af86a62b5 --- /dev/null +++ b/codenet/public_test_cases/p00458/input.0.txt @@ -0,0 +1,12 @@ +3 +3 +1 1 0 +1 0 1 +1 1 0 +5 +3 +1 1 1 0 1 +1 1 0 0 0 +1 0 0 0 1 +0 +0 diff --git a/codenet/public_test_cases/p00458/input.1.txt b/codenet/public_test_cases/p00458/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ccbe7448b53f445b4c5817d6cef1e0af86a62b5 --- /dev/null +++ b/codenet/public_test_cases/p00458/input.1.txt @@ -0,0 +1,12 @@ +3 +3 +1 1 0 +1 0 1 +1 1 0 +5 +3 +1 1 1 0 1 +1 1 0 0 0 +1 0 0 0 1 +0 +0 diff --git a/codenet/public_test_cases/p00458/output.0.txt b/codenet/public_test_cases/p00458/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd3c81a4d763121f1827c8b4bbdd0cef674c30f9 --- /dev/null +++ b/codenet/public_test_cases/p00458/output.0.txt @@ -0,0 +1,2 @@ +5 +5 diff --git a/codenet/public_test_cases/p00458/output.1.txt b/codenet/public_test_cases/p00458/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd3c81a4d763121f1827c8b4bbdd0cef674c30f9 --- /dev/null +++ b/codenet/public_test_cases/p00458/output.1.txt @@ -0,0 +1,2 @@ +5 +5 diff --git a/codenet/public_test_cases/p00459/input.0.txt b/codenet/public_test_cases/p00459/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecd869134c413720b00d47b31db39b4544ef7a80 --- /dev/null +++ b/codenet/public_test_cases/p00459/input.0.txt @@ -0,0 +1,11 @@ +9 +1 +3 7 4 +3 5 +12 +3 +3 8 5 +3 8 +2 5 +6 10 +0 diff --git a/codenet/public_test_cases/p00459/input.1.txt b/codenet/public_test_cases/p00459/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecd869134c413720b00d47b31db39b4544ef7a80 --- /dev/null +++ b/codenet/public_test_cases/p00459/input.1.txt @@ -0,0 +1,11 @@ +9 +1 +3 7 4 +3 5 +12 +3 +3 8 5 +3 8 +2 5 +6 10 +0 diff --git a/codenet/public_test_cases/p00459/output.0.txt b/codenet/public_test_cases/p00459/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4792e70f333077a81456ca2bc74e492ab8bb58c3 --- /dev/null +++ b/codenet/public_test_cases/p00459/output.0.txt @@ -0,0 +1,2 @@ +2 +3 diff --git a/codenet/public_test_cases/p00459/output.1.txt b/codenet/public_test_cases/p00459/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4792e70f333077a81456ca2bc74e492ab8bb58c3 --- /dev/null +++ b/codenet/public_test_cases/p00459/output.1.txt @@ -0,0 +1,2 @@ +2 +3 diff --git a/codenet/public_test_cases/p00460/input.0.txt b/codenet/public_test_cases/p00460/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a92f90cd6baf6b9d1ef3f4a8ae06a52470d04aae --- /dev/null +++ b/codenet/public_test_cases/p00460/input.0.txt @@ -0,0 +1,4 @@ +3 9 45 +3 100 50 +5 50 685 +0 0 0 diff --git a/codenet/public_test_cases/p00460/input.1.txt b/codenet/public_test_cases/p00460/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a92f90cd6baf6b9d1ef3f4a8ae06a52470d04aae --- /dev/null +++ b/codenet/public_test_cases/p00460/input.1.txt @@ -0,0 +1,4 @@ +3 9 45 +3 100 50 +5 50 685 +0 0 0 diff --git a/codenet/public_test_cases/p00460/output.0.txt b/codenet/public_test_cases/p00460/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1306c15ce4fc4afda9868bd782f58e4a0e2282a5 --- /dev/null +++ b/codenet/public_test_cases/p00460/output.0.txt @@ -0,0 +1,3 @@ +1 +7 +74501 diff --git a/codenet/public_test_cases/p00460/output.1.txt b/codenet/public_test_cases/p00460/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1306c15ce4fc4afda9868bd782f58e4a0e2282a5 --- /dev/null +++ b/codenet/public_test_cases/p00460/output.1.txt @@ -0,0 +1,3 @@ +1 +7 +74501 diff --git a/codenet/public_test_cases/p00461/input.0.txt b/codenet/public_test_cases/p00461/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..86301baf134c8e4b3f3d3eb1ab4a0172d017805e --- /dev/null +++ b/codenet/public_test_cases/p00461/input.0.txt @@ -0,0 +1,7 @@ +1 +13 +OOIOIOIOIIOII +2 +13 +OOIOIOIOIIOII +0 diff --git a/codenet/public_test_cases/p00461/input.1.txt b/codenet/public_test_cases/p00461/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86301baf134c8e4b3f3d3eb1ab4a0172d017805e --- /dev/null +++ b/codenet/public_test_cases/p00461/input.1.txt @@ -0,0 +1,7 @@ +1 +13 +OOIOIOIOIIOII +2 +13 +OOIOIOIOIIOII +0 diff --git a/codenet/public_test_cases/p00461/output.0.txt b/codenet/public_test_cases/p00461/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc7fa75e6a7bc42f0431e7fa75b59e3ddc4dc40f --- /dev/null +++ b/codenet/public_test_cases/p00461/output.0.txt @@ -0,0 +1,2 @@ +4 +2 diff --git a/codenet/public_test_cases/p00461/output.1.txt b/codenet/public_test_cases/p00461/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc7fa75e6a7bc42f0431e7fa75b59e3ddc4dc40f --- /dev/null +++ b/codenet/public_test_cases/p00461/output.1.txt @@ -0,0 +1,2 @@ +4 +2 diff --git a/codenet/public_test_cases/p00462/input.0.txt b/codenet/public_test_cases/p00462/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52180a750a52a5455a6d087207e75691f7c1d7d0 --- /dev/null +++ b/codenet/public_test_cases/p00462/input.0.txt @@ -0,0 +1,18 @@ +8 +3 +2 +3 +1 +4 +6 +20 +4 +4 +12 +8 +16 +7 +7 +11 +8 +0 diff --git a/codenet/public_test_cases/p00462/input.1.txt b/codenet/public_test_cases/p00462/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..52180a750a52a5455a6d087207e75691f7c1d7d0 --- /dev/null +++ b/codenet/public_test_cases/p00462/input.1.txt @@ -0,0 +1,18 @@ +8 +3 +2 +3 +1 +4 +6 +20 +4 +4 +12 +8 +16 +7 +7 +11 +8 +0 diff --git a/codenet/public_test_cases/p00462/output.0.txt b/codenet/public_test_cases/p00462/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c8806279fa7d6b7d04418a47e21b7e89ab18f8 --- /dev/null +++ b/codenet/public_test_cases/p00462/output.0.txt @@ -0,0 +1,2 @@ +3 +3 diff --git a/codenet/public_test_cases/p00462/output.1.txt b/codenet/public_test_cases/p00462/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c8806279fa7d6b7d04418a47e21b7e89ab18f8 --- /dev/null +++ b/codenet/public_test_cases/p00462/output.1.txt @@ -0,0 +1,2 @@ +3 +3 diff --git a/codenet/public_test_cases/p00463/input.0.txt b/codenet/public_test_cases/p00463/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a9f6ea6cc4aad44849efbe483d937022e7891ee --- /dev/null +++ b/codenet/public_test_cases/p00463/input.0.txt @@ -0,0 +1,16 @@ +4 5 7 2 +20 +80 +100 +50 +1 1 +2 6 +2 3 +1 5 +3 1 +2 2 5 1 +10 +20 +1 1 +1 3 +0 0 0 0 diff --git a/codenet/public_test_cases/p00463/input.1.txt b/codenet/public_test_cases/p00463/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a9f6ea6cc4aad44849efbe483d937022e7891ee --- /dev/null +++ b/codenet/public_test_cases/p00463/input.1.txt @@ -0,0 +1,16 @@ +4 5 7 2 +20 +80 +100 +50 +1 1 +2 6 +2 3 +1 5 +3 1 +2 2 5 1 +10 +20 +1 1 +1 3 +0 0 0 0 diff --git a/codenet/public_test_cases/p00463/output.0.txt b/codenet/public_test_cases/p00463/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dafc01ac7ceb05a056388a0e084b2f0a1702954c --- /dev/null +++ b/codenet/public_test_cases/p00463/output.0.txt @@ -0,0 +1,2 @@ +100 +10 diff --git a/codenet/public_test_cases/p00463/output.1.txt b/codenet/public_test_cases/p00463/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dafc01ac7ceb05a056388a0e084b2f0a1702954c --- /dev/null +++ b/codenet/public_test_cases/p00463/output.1.txt @@ -0,0 +1,2 @@ +100 +10 diff --git a/codenet/public_test_cases/p00464/input.0.txt b/codenet/public_test_cases/p00464/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b6399a3193ba76319e93a5e6653cdc3bdc6228e --- /dev/null +++ b/codenet/public_test_cases/p00464/input.0.txt @@ -0,0 +1,5 @@ +3 4 3 +1 0 1 1 +0 1 0 0 +1 0 1 0 +0 0 0 diff --git a/codenet/public_test_cases/p00464/input.1.txt b/codenet/public_test_cases/p00464/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b6399a3193ba76319e93a5e6653cdc3bdc6228e --- /dev/null +++ b/codenet/public_test_cases/p00464/input.1.txt @@ -0,0 +1,5 @@ +3 4 3 +1 0 1 1 +0 1 0 0 +1 0 1 0 +0 0 0 diff --git a/codenet/public_test_cases/p00464/output.0.txt b/codenet/public_test_cases/p00464/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d6a524ba4bb4d62ff585ceb90c77652523ffb50 --- /dev/null +++ b/codenet/public_test_cases/p00464/output.0.txt @@ -0,0 +1 @@ +1 5 diff --git a/codenet/public_test_cases/p00464/output.1.txt b/codenet/public_test_cases/p00464/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d6a524ba4bb4d62ff585ceb90c77652523ffb50 --- /dev/null +++ b/codenet/public_test_cases/p00464/output.1.txt @@ -0,0 +1 @@ +1 5 diff --git a/codenet/public_test_cases/p00465/input.0.txt b/codenet/public_test_cases/p00465/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bc0ecf945ce695ddb11bc984e9eb9968943b20f --- /dev/null +++ b/codenet/public_test_cases/p00465/input.0.txt @@ -0,0 +1,28 @@ +5 +2 2 1 2 +9 5 +1 17 +3 2 2 1 +6 1 20 +8 18 3 +8 +5 4 1 3 +5 5 4 5 5 +8 2 1 9 7 +1 1 3 5 1 +7 2 7 1 3 +6 5 6 2 +2 3 5 8 2 7 +1 6 9 4 5 1 +2 4 5 4 2 2 +5 4 2 5 3 3 +7 1 5 1 5 6 +6 +3 3 2 2 +2 9 2 +9 1 9 +2 9 2 +2 2 1 1 +1 3 +5 7 +0 diff --git a/codenet/public_test_cases/p00465/input.1.txt b/codenet/public_test_cases/p00465/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bc0ecf945ce695ddb11bc984e9eb9968943b20f --- /dev/null +++ b/codenet/public_test_cases/p00465/input.1.txt @@ -0,0 +1,28 @@ +5 +2 2 1 2 +9 5 +1 17 +3 2 2 1 +6 1 20 +8 18 3 +8 +5 4 1 3 +5 5 4 5 5 +8 2 1 9 7 +1 1 3 5 1 +7 2 7 1 3 +6 5 6 2 +2 3 5 8 2 7 +1 6 9 4 5 1 +2 4 5 4 2 2 +5 4 2 5 3 3 +7 1 5 1 5 6 +6 +3 3 2 2 +2 9 2 +9 1 9 +2 9 2 +2 2 1 1 +1 3 +5 7 +0 diff --git a/codenet/public_test_cases/p00465/output.0.txt b/codenet/public_test_cases/p00465/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a63e867c1deb5636c5bb50ac552cc2f72acbb74 --- /dev/null +++ b/codenet/public_test_cases/p00465/output.0.txt @@ -0,0 +1,3 @@ +15 +4 +9 diff --git a/codenet/public_test_cases/p00465/output.1.txt b/codenet/public_test_cases/p00465/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a63e867c1deb5636c5bb50ac552cc2f72acbb74 --- /dev/null +++ b/codenet/public_test_cases/p00465/output.1.txt @@ -0,0 +1,3 @@ +15 +4 +9 diff --git a/codenet/public_test_cases/p00466/input.0.txt b/codenet/public_test_cases/p00466/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b136ed2e5cf97afa286b4ac8df2e74c2275fc1da --- /dev/null +++ b/codenet/public_test_cases/p00466/input.0.txt @@ -0,0 +1,11 @@ +9850 +1050 +800 +420 +380 +600 +820 +2400 +1800 +980 +0 diff --git a/codenet/public_test_cases/p00466/input.1.txt b/codenet/public_test_cases/p00466/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b136ed2e5cf97afa286b4ac8df2e74c2275fc1da --- /dev/null +++ b/codenet/public_test_cases/p00466/input.1.txt @@ -0,0 +1,11 @@ +9850 +1050 +800 +420 +380 +600 +820 +2400 +1800 +980 +0 diff --git a/codenet/public_test_cases/p00466/output.0.txt b/codenet/public_test_cases/p00466/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9f960cf4ac4e28e6cf8ecbad6f08c44ea9de347 --- /dev/null +++ b/codenet/public_test_cases/p00466/output.0.txt @@ -0,0 +1 @@ +600 diff --git a/codenet/public_test_cases/p00466/output.1.txt b/codenet/public_test_cases/p00466/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9f960cf4ac4e28e6cf8ecbad6f08c44ea9de347 --- /dev/null +++ b/codenet/public_test_cases/p00466/output.1.txt @@ -0,0 +1 @@ +600 diff --git a/codenet/public_test_cases/p00467/input.0.txt b/codenet/public_test_cases/p00467/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f700497598acaae3320298cff4df729c9bcc4f8 --- /dev/null +++ b/codenet/public_test_cases/p00467/input.0.txt @@ -0,0 +1,38 @@ +10 5 +0 +0 +5 +6 +-3 +8 +1 +8 +-4 +0 +1 +3 +5 +1 +5 +10 10 +0 +-1 +-1 +4 +4 +-5 +0 +1 +-6 +0 +1 +5 +2 +4 +6 +5 +5 +4 +1 +6 +0 0 diff --git a/codenet/public_test_cases/p00467/input.1.txt b/codenet/public_test_cases/p00467/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f700497598acaae3320298cff4df729c9bcc4f8 --- /dev/null +++ b/codenet/public_test_cases/p00467/input.1.txt @@ -0,0 +1,38 @@ +10 5 +0 +0 +5 +6 +-3 +8 +1 +8 +-4 +0 +1 +3 +5 +1 +5 +10 10 +0 +-1 +-1 +4 +4 +-5 +0 +1 +-6 +0 +1 +5 +2 +4 +6 +5 +5 +4 +1 +6 +0 0 diff --git a/codenet/public_test_cases/p00467/output.0.txt b/codenet/public_test_cases/p00467/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6613b568867eb6fb5247be321a988fb430e4d3ad --- /dev/null +++ b/codenet/public_test_cases/p00467/output.0.txt @@ -0,0 +1,2 @@ +5 +6 diff --git a/codenet/public_test_cases/p00467/output.1.txt b/codenet/public_test_cases/p00467/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6613b568867eb6fb5247be321a988fb430e4d3ad --- /dev/null +++ b/codenet/public_test_cases/p00467/output.1.txt @@ -0,0 +1,2 @@ +5 +6 diff --git a/codenet/public_test_cases/p00468/input.0.txt b/codenet/public_test_cases/p00468/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c199dccfb21676a57cc5601de38a83f515af4022 --- /dev/null +++ b/codenet/public_test_cases/p00468/input.0.txt @@ -0,0 +1,16 @@ +6 +5 +1 2 +1 3 +3 4 +2 3 +4 5 +6 +5 +2 3 +3 4 +4 5 +5 6 +2 5 +0 +0 diff --git a/codenet/public_test_cases/p00468/input.1.txt b/codenet/public_test_cases/p00468/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c199dccfb21676a57cc5601de38a83f515af4022 --- /dev/null +++ b/codenet/public_test_cases/p00468/input.1.txt @@ -0,0 +1,16 @@ +6 +5 +1 2 +1 3 +3 4 +2 3 +4 5 +6 +5 +2 3 +3 4 +4 5 +5 6 +2 5 +0 +0 diff --git a/codenet/public_test_cases/p00468/output.0.txt b/codenet/public_test_cases/p00468/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p00468/output.0.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p00468/output.1.txt b/codenet/public_test_cases/p00468/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p00468/output.1.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p00469/input.0.txt b/codenet/public_test_cases/p00469/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83e06de8101ef2e4f9725ec4f8cc390e107ad7da --- /dev/null +++ b/codenet/public_test_cases/p00469/input.0.txt @@ -0,0 +1,16 @@ +4 +2 +1 +2 +12 +1 +6 +3 +72 +2 +12 +7 +2 +1 +0 +0 diff --git a/codenet/public_test_cases/p00469/input.1.txt b/codenet/public_test_cases/p00469/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83e06de8101ef2e4f9725ec4f8cc390e107ad7da --- /dev/null +++ b/codenet/public_test_cases/p00469/input.1.txt @@ -0,0 +1,16 @@ +4 +2 +1 +2 +12 +1 +6 +3 +72 +2 +12 +7 +2 +1 +0 +0 diff --git a/codenet/public_test_cases/p00469/output.0.txt b/codenet/public_test_cases/p00469/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01c1adb5caf547748967d8c2490426b6acd88a56 --- /dev/null +++ b/codenet/public_test_cases/p00469/output.0.txt @@ -0,0 +1,2 @@ +7 +68 diff --git a/codenet/public_test_cases/p00469/output.1.txt b/codenet/public_test_cases/p00469/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01c1adb5caf547748967d8c2490426b6acd88a56 --- /dev/null +++ b/codenet/public_test_cases/p00469/output.1.txt @@ -0,0 +1,2 @@ +7 +68 diff --git a/codenet/public_test_cases/p00470/input.0.txt b/codenet/public_test_cases/p00470/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f6be43ed0e983abf9b6db0ecadf871d085d3cd5 --- /dev/null +++ b/codenet/public_test_cases/p00470/input.0.txt @@ -0,0 +1,3 @@ +3 4 +15 15 +0 0 diff --git a/codenet/public_test_cases/p00470/input.1.txt b/codenet/public_test_cases/p00470/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f6be43ed0e983abf9b6db0ecadf871d085d3cd5 --- /dev/null +++ b/codenet/public_test_cases/p00470/input.1.txt @@ -0,0 +1,3 @@ +3 4 +15 15 +0 0 diff --git a/codenet/public_test_cases/p00470/output.0.txt b/codenet/public_test_cases/p00470/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93385c563fa0114f85c2ba85e9fc7e37ec729d0f --- /dev/null +++ b/codenet/public_test_cases/p00470/output.0.txt @@ -0,0 +1,2 @@ +5 +43688 diff --git a/codenet/public_test_cases/p00470/output.1.txt b/codenet/public_test_cases/p00470/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..93385c563fa0114f85c2ba85e9fc7e37ec729d0f --- /dev/null +++ b/codenet/public_test_cases/p00470/output.1.txt @@ -0,0 +1,2 @@ +5 +43688 diff --git a/codenet/public_test_cases/p00471/input.0.txt b/codenet/public_test_cases/p00471/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01fbda5822dd6f402eeda91e39625140463e29d2 --- /dev/null +++ b/codenet/public_test_cases/p00471/input.0.txt @@ -0,0 +1,8 @@ +3 2 +1 0 1 +1 0 2 +3 3 +1 1 1 +1 0 1 +1 1 2 +0 0 diff --git a/codenet/public_test_cases/p00471/input.1.txt b/codenet/public_test_cases/p00471/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01fbda5822dd6f402eeda91e39625140463e29d2 --- /dev/null +++ b/codenet/public_test_cases/p00471/input.1.txt @@ -0,0 +1,8 @@ +3 2 +1 0 1 +1 0 2 +3 3 +1 1 1 +1 0 1 +1 1 2 +0 0 diff --git a/codenet/public_test_cases/p00471/output.0.txt b/codenet/public_test_cases/p00471/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b24e3127788ab5dd07d265a75dd56cfd6c495b8 --- /dev/null +++ b/codenet/public_test_cases/p00471/output.0.txt @@ -0,0 +1,2 @@ +2 +6 diff --git a/codenet/public_test_cases/p00471/output.1.txt b/codenet/public_test_cases/p00471/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b24e3127788ab5dd07d265a75dd56cfd6c495b8 --- /dev/null +++ b/codenet/public_test_cases/p00471/output.1.txt @@ -0,0 +1,2 @@ +2 +6 diff --git a/codenet/public_test_cases/p00472/input.0.txt b/codenet/public_test_cases/p00472/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e17a0f79c5461f0e724e1d1461738e096d89651 --- /dev/null +++ b/codenet/public_test_cases/p00472/input.0.txt @@ -0,0 +1,12 @@ +7 5 +2 +1 +1 +3 +2 +1 +2 +-1 +3 +2 +-3 diff --git a/codenet/public_test_cases/p00472/input.1.txt b/codenet/public_test_cases/p00472/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e17a0f79c5461f0e724e1d1461738e096d89651 --- /dev/null +++ b/codenet/public_test_cases/p00472/input.1.txt @@ -0,0 +1,12 @@ +7 5 +2 +1 +1 +3 +2 +1 +2 +-1 +3 +2 +-3 diff --git a/codenet/public_test_cases/p00472/output.0.txt b/codenet/public_test_cases/p00472/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p00472/output.0.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p00472/output.1.txt b/codenet/public_test_cases/p00472/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p00472/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p00473/input.0.txt b/codenet/public_test_cases/p00473/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b872c35fc2e8af4f197432e5f285775173f6c421 --- /dev/null +++ b/codenet/public_test_cases/p00473/input.0.txt @@ -0,0 +1,6 @@ +6 +1 +8 +12 +6 +2 diff --git a/codenet/public_test_cases/p00473/input.1.txt b/codenet/public_test_cases/p00473/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b872c35fc2e8af4f197432e5f285775173f6c421 --- /dev/null +++ b/codenet/public_test_cases/p00473/input.1.txt @@ -0,0 +1,6 @@ +6 +1 +8 +12 +6 +2 diff --git a/codenet/public_test_cases/p00473/output.0.txt b/codenet/public_test_cases/p00473/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p00473/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p00473/output.1.txt b/codenet/public_test_cases/p00473/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p00473/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p00474/input.0.txt b/codenet/public_test_cases/p00474/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea3e898b8527233d3e5f1ceb1948c0654389245e --- /dev/null +++ b/codenet/public_test_cases/p00474/input.0.txt @@ -0,0 +1,5 @@ +4 6 +4 +2 +3 +5 diff --git a/codenet/public_test_cases/p00474/input.1.txt b/codenet/public_test_cases/p00474/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea3e898b8527233d3e5f1ceb1948c0654389245e --- /dev/null +++ b/codenet/public_test_cases/p00474/input.1.txt @@ -0,0 +1,5 @@ +4 6 +4 +2 +3 +5 diff --git a/codenet/public_test_cases/p00474/output.0.txt b/codenet/public_test_cases/p00474/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00474/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00474/output.1.txt b/codenet/public_test_cases/p00474/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00474/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00475/input.0.txt b/codenet/public_test_cases/p00475/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..383f7c5cc52057be726d413f32982827d2e4cce6 --- /dev/null +++ b/codenet/public_test_cases/p00475/input.0.txt @@ -0,0 +1,6 @@ +5 +0 0 +1 0 +-1 -2 +0 1 +-1 1 diff --git a/codenet/public_test_cases/p00475/input.1.txt b/codenet/public_test_cases/p00475/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..383f7c5cc52057be726d413f32982827d2e4cce6 --- /dev/null +++ b/codenet/public_test_cases/p00475/input.1.txt @@ -0,0 +1,6 @@ +5 +0 0 +1 0 +-1 -2 +0 1 +-1 1 diff --git a/codenet/public_test_cases/p00475/output.0.txt b/codenet/public_test_cases/p00475/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00475/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00475/output.1.txt b/codenet/public_test_cases/p00475/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00475/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00476/input.0.txt b/codenet/public_test_cases/p00476/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8aab60a6b35d5b703a06719bb118d13eaef4443 --- /dev/null +++ b/codenet/public_test_cases/p00476/input.0.txt @@ -0,0 +1,10 @@ +10 10 +4 2 +2 5 +6 1 +7 3 +6 4 +9 6 +0 8 +4 1 +9 4 diff --git a/codenet/public_test_cases/p00476/input.1.txt b/codenet/public_test_cases/p00476/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8aab60a6b35d5b703a06719bb118d13eaef4443 --- /dev/null +++ b/codenet/public_test_cases/p00476/input.1.txt @@ -0,0 +1,10 @@ +10 10 +4 2 +2 5 +6 1 +7 3 +6 4 +9 6 +0 8 +4 1 +9 4 diff --git a/codenet/public_test_cases/p00476/output.0.txt b/codenet/public_test_cases/p00476/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00476/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00476/output.1.txt b/codenet/public_test_cases/p00476/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00476/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00477/input.0.txt b/codenet/public_test_cases/p00477/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0824ed2cf63fa330348cfd9247b8c49e84c19776 --- /dev/null +++ b/codenet/public_test_cases/p00477/input.0.txt @@ -0,0 +1,4 @@ +31 +34 +7 +151 diff --git a/codenet/public_test_cases/p00477/output.0.txt b/codenet/public_test_cases/p00477/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3e02b45bf183334116352a95d7830cefd2d9dd7 --- /dev/null +++ b/codenet/public_test_cases/p00477/output.0.txt @@ -0,0 +1,2 @@ +3 +43 diff --git a/codenet/public_test_cases/p00478/input.0.txt b/codenet/public_test_cases/p00478/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecc0cde27c542791d3ec48bf9be9670d4d2cde3b --- /dev/null +++ b/codenet/public_test_cases/p00478/input.0.txt @@ -0,0 +1,5 @@ +ABCD +3 +ABCDXXXXXX +YYYYABCDXX +DCBAZZZZZZ diff --git a/codenet/public_test_cases/p00478/output.0.txt b/codenet/public_test_cases/p00478/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00478/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00479/input.0.txt b/codenet/public_test_cases/p00479/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7547b521088d107a5e7c95e0bc5a9b50a36c1bf9 --- /dev/null +++ b/codenet/public_test_cases/p00479/input.0.txt @@ -0,0 +1,6 @@ +11 +4 +5 2 +9 7 +4 4 +3 9 diff --git a/codenet/public_test_cases/p00479/output.0.txt b/codenet/public_test_cases/p00479/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..348305ef77d09723e06589c0288a7b6ac01f95be --- /dev/null +++ b/codenet/public_test_cases/p00479/output.0.txt @@ -0,0 +1,4 @@ +2 +3 +1 +3 diff --git a/codenet/public_test_cases/p00480/input.0.txt b/codenet/public_test_cases/p00480/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb38d6f90641b94c2428c05936443480c1a82125 --- /dev/null +++ b/codenet/public_test_cases/p00480/input.0.txt @@ -0,0 +1,2 @@ +11 +8 3 2 4 8 7 2 4 0 8 8 diff --git a/codenet/public_test_cases/p00480/output.0.txt b/codenet/public_test_cases/p00480/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00480/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00481/input.0.txt b/codenet/public_test_cases/p00481/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fef4223d1fb536b32c8b5222b9c4bff3845ae340 --- /dev/null +++ b/codenet/public_test_cases/p00481/input.0.txt @@ -0,0 +1,4 @@ +3 3 1 +S.. +... +..1 diff --git a/codenet/public_test_cases/p00481/output.0.txt b/codenet/public_test_cases/p00481/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00481/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00482/input.0.txt b/codenet/public_test_cases/p00482/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..44f0fcff43bf0169ca75137a7b921367ef1e700d --- /dev/null +++ b/codenet/public_test_cases/p00482/input.0.txt @@ -0,0 +1,3 @@ +2 3 +??O +IIJ diff --git a/codenet/public_test_cases/p00482/output.0.txt b/codenet/public_test_cases/p00482/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00482/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00483/input.0.txt b/codenet/public_test_cases/p00483/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfb4164223397713921e6417f4f160f86f4cc11b --- /dev/null +++ b/codenet/public_test_cases/p00483/input.0.txt @@ -0,0 +1,10 @@ +4 7 +4 +JIOJOIJ +IOJOIJO +JOIJOOI +OOJJIJO +3 5 4 7 +2 2 3 6 +2 2 2 2 +1 1 4 7 diff --git a/codenet/public_test_cases/p00483/input.1.txt b/codenet/public_test_cases/p00483/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfb4164223397713921e6417f4f160f86f4cc11b --- /dev/null +++ b/codenet/public_test_cases/p00483/input.1.txt @@ -0,0 +1,10 @@ +4 7 +4 +JIOJOIJ +IOJOIJO +JOIJOOI +OOJJIJO +3 5 4 7 +2 2 3 6 +2 2 2 2 +1 1 4 7 diff --git a/codenet/public_test_cases/p00483/output.0.txt b/codenet/public_test_cases/p00483/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a4e346b52253ac809e78e6e2aeb964db3c443b2 --- /dev/null +++ b/codenet/public_test_cases/p00483/output.0.txt @@ -0,0 +1,4 @@ +1 3 2 +3 5 2 +0 1 0 +10 11 7 diff --git a/codenet/public_test_cases/p00483/output.1.txt b/codenet/public_test_cases/p00483/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a4e346b52253ac809e78e6e2aeb964db3c443b2 --- /dev/null +++ b/codenet/public_test_cases/p00483/output.1.txt @@ -0,0 +1,4 @@ +1 3 2 +3 5 2 +0 1 0 +10 11 7 diff --git a/codenet/public_test_cases/p00484/input.0.txt b/codenet/public_test_cases/p00484/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..724195155d3bfc720a15ac4ac3ecd219e11e6589 --- /dev/null +++ b/codenet/public_test_cases/p00484/input.0.txt @@ -0,0 +1,8 @@ +7 4 +14 1 +13 2 +12 3 +14 2 +8 2 +16 3 +11 2 diff --git a/codenet/public_test_cases/p00484/input.1.txt b/codenet/public_test_cases/p00484/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..724195155d3bfc720a15ac4ac3ecd219e11e6589 --- /dev/null +++ b/codenet/public_test_cases/p00484/input.1.txt @@ -0,0 +1,8 @@ +7 4 +14 1 +13 2 +12 3 +14 2 +8 2 +16 3 +11 2 diff --git a/codenet/public_test_cases/p00484/output.0.txt b/codenet/public_test_cases/p00484/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p00484/output.0.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p00484/output.1.txt b/codenet/public_test_cases/p00484/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p00484/output.1.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p00485/input.0.txt b/codenet/public_test_cases/p00485/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..089a904b9a0ac31413a0f9476481bd804ab6b561 --- /dev/null +++ b/codenet/public_test_cases/p00485/input.0.txt @@ -0,0 +1,5 @@ +3 3 1 +1 2 1 +2 3 1 +3 1 1 +1 diff --git a/codenet/public_test_cases/p00485/input.1.txt b/codenet/public_test_cases/p00485/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..089a904b9a0ac31413a0f9476481bd804ab6b561 --- /dev/null +++ b/codenet/public_test_cases/p00485/input.1.txt @@ -0,0 +1,5 @@ +3 3 1 +1 2 1 +2 3 1 +3 1 1 +1 diff --git a/codenet/public_test_cases/p00485/output.0.txt b/codenet/public_test_cases/p00485/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00485/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00485/output.1.txt b/codenet/public_test_cases/p00485/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00485/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00486/input.0.txt b/codenet/public_test_cases/p00486/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83719a8642e351cd33e5752cf7380af2e3232a33 --- /dev/null +++ b/codenet/public_test_cases/p00486/input.0.txt @@ -0,0 +1,5 @@ +5 4 +3 +1 1 +3 4 +5 3 diff --git a/codenet/public_test_cases/p00486/input.1.txt b/codenet/public_test_cases/p00486/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83719a8642e351cd33e5752cf7380af2e3232a33 --- /dev/null +++ b/codenet/public_test_cases/p00486/input.1.txt @@ -0,0 +1,5 @@ +5 4 +3 +1 1 +3 4 +5 3 diff --git a/codenet/public_test_cases/p00486/output.0.txt b/codenet/public_test_cases/p00486/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3d27ffbf0418faf03dae8aec9928c677f9ff805 --- /dev/null +++ b/codenet/public_test_cases/p00486/output.0.txt @@ -0,0 +1,2 @@ +10 +3 3 diff --git a/codenet/public_test_cases/p00486/output.1.txt b/codenet/public_test_cases/p00486/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3d27ffbf0418faf03dae8aec9928c677f9ff805 --- /dev/null +++ b/codenet/public_test_cases/p00486/output.1.txt @@ -0,0 +1,2 @@ +10 +3 3 diff --git a/codenet/public_test_cases/p00487/input.0.txt b/codenet/public_test_cases/p00487/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fddd90113914970f9113b4e17c906faf555ba3f5 --- /dev/null +++ b/codenet/public_test_cases/p00487/input.0.txt @@ -0,0 +1,7 @@ +6 +12 8 +5 9 +2 4 +10 12 +6 7 +13 9 diff --git a/codenet/public_test_cases/p00487/input.1.txt b/codenet/public_test_cases/p00487/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fddd90113914970f9113b4e17c906faf555ba3f5 --- /dev/null +++ b/codenet/public_test_cases/p00487/input.1.txt @@ -0,0 +1,7 @@ +6 +12 8 +5 9 +2 4 +10 12 +6 7 +13 9 diff --git a/codenet/public_test_cases/p00487/output.0.txt b/codenet/public_test_cases/p00487/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00487/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00487/output.1.txt b/codenet/public_test_cases/p00487/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00487/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00488/input.0.txt b/codenet/public_test_cases/p00488/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..def4b3d1d3df81e87778ed8495565d1e78885864 --- /dev/null +++ b/codenet/public_test_cases/p00488/input.0.txt @@ -0,0 +1,5 @@ +800 +700 +900 +198 +330 diff --git a/codenet/public_test_cases/p00488/input.1.txt b/codenet/public_test_cases/p00488/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..def4b3d1d3df81e87778ed8495565d1e78885864 --- /dev/null +++ b/codenet/public_test_cases/p00488/input.1.txt @@ -0,0 +1,5 @@ +800 +700 +900 +198 +330 diff --git a/codenet/public_test_cases/p00488/output.0.txt b/codenet/public_test_cases/p00488/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e18fc9c1ae346233fe28f54186a6922d10515b3 --- /dev/null +++ b/codenet/public_test_cases/p00488/output.0.txt @@ -0,0 +1 @@ +848 diff --git a/codenet/public_test_cases/p00488/output.1.txt b/codenet/public_test_cases/p00488/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e18fc9c1ae346233fe28f54186a6922d10515b3 --- /dev/null +++ b/codenet/public_test_cases/p00488/output.1.txt @@ -0,0 +1 @@ +848 diff --git a/codenet/public_test_cases/p00489/input.0.txt b/codenet/public_test_cases/p00489/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9fdc191d5aa1fa8ae5aa15c153d72475fe80dfa --- /dev/null +++ b/codenet/public_test_cases/p00489/input.0.txt @@ -0,0 +1,7 @@ +4 +1 2 0 1 +1 3 2 1 +1 4 2 2 +2 3 1 1 +2 4 3 0 +3 4 1 3 diff --git a/codenet/public_test_cases/p00489/input.1.txt b/codenet/public_test_cases/p00489/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9fdc191d5aa1fa8ae5aa15c153d72475fe80dfa --- /dev/null +++ b/codenet/public_test_cases/p00489/input.1.txt @@ -0,0 +1,7 @@ +4 +1 2 0 1 +1 3 2 1 +1 4 2 2 +2 3 1 1 +2 4 3 0 +3 4 1 3 diff --git a/codenet/public_test_cases/p00489/output.0.txt b/codenet/public_test_cases/p00489/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..92831152fe09dee6feb22f9b01319691b9974b83 --- /dev/null +++ b/codenet/public_test_cases/p00489/output.0.txt @@ -0,0 +1,4 @@ +2 +1 +4 +2 diff --git a/codenet/public_test_cases/p00489/output.1.txt b/codenet/public_test_cases/p00489/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..92831152fe09dee6feb22f9b01319691b9974b83 --- /dev/null +++ b/codenet/public_test_cases/p00489/output.1.txt @@ -0,0 +1,4 @@ +2 +1 +4 +2 diff --git a/codenet/public_test_cases/p00490/input.0.txt b/codenet/public_test_cases/p00490/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c7d6b18203b6b32f78bd1a00a2ee319831249f7 --- /dev/null +++ b/codenet/public_test_cases/p00490/input.0.txt @@ -0,0 +1,6 @@ +3 +12 2 +200 +50 +300 +100 diff --git a/codenet/public_test_cases/p00490/input.1.txt b/codenet/public_test_cases/p00490/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c7d6b18203b6b32f78bd1a00a2ee319831249f7 --- /dev/null +++ b/codenet/public_test_cases/p00490/input.1.txt @@ -0,0 +1,6 @@ +3 +12 2 +200 +50 +300 +100 diff --git a/codenet/public_test_cases/p00490/output.0.txt b/codenet/public_test_cases/p00490/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81b5c5d06cc0b8290c264b408abb32cc0986e8f2 --- /dev/null +++ b/codenet/public_test_cases/p00490/output.0.txt @@ -0,0 +1 @@ +37 diff --git a/codenet/public_test_cases/p00490/output.1.txt b/codenet/public_test_cases/p00490/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81b5c5d06cc0b8290c264b408abb32cc0986e8f2 --- /dev/null +++ b/codenet/public_test_cases/p00490/output.1.txt @@ -0,0 +1 @@ +37 diff --git a/codenet/public_test_cases/p00491/input.0.txt b/codenet/public_test_cases/p00491/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6e64a97f7c4f66cd03da69216c8dcb30d252303 --- /dev/null +++ b/codenet/public_test_cases/p00491/input.0.txt @@ -0,0 +1,4 @@ +5 3 +3 1 +1 1 +4 2 diff --git a/codenet/public_test_cases/p00491/input.1.txt b/codenet/public_test_cases/p00491/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6e64a97f7c4f66cd03da69216c8dcb30d252303 --- /dev/null +++ b/codenet/public_test_cases/p00491/input.1.txt @@ -0,0 +1,4 @@ +5 3 +3 1 +1 1 +4 2 diff --git a/codenet/public_test_cases/p00491/output.0.txt b/codenet/public_test_cases/p00491/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00491/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00491/output.1.txt b/codenet/public_test_cases/p00491/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00491/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00492/input.0.txt b/codenet/public_test_cases/p00492/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..054fcdce22f9f017cc7dac723c1841e3638df9e8 --- /dev/null +++ b/codenet/public_test_cases/p00492/input.0.txt @@ -0,0 +1,5 @@ +8 4 +0 1 0 1 0 1 1 1 +0 1 1 0 0 1 0 0 +1 0 1 0 1 1 1 1 +0 1 1 0 1 0 1 0 diff --git a/codenet/public_test_cases/p00492/input.1.txt b/codenet/public_test_cases/p00492/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..054fcdce22f9f017cc7dac723c1841e3638df9e8 --- /dev/null +++ b/codenet/public_test_cases/p00492/input.1.txt @@ -0,0 +1,5 @@ +8 4 +0 1 0 1 0 1 1 1 +0 1 1 0 0 1 0 0 +1 0 1 0 1 1 1 1 +0 1 1 0 1 0 1 0 diff --git a/codenet/public_test_cases/p00492/output.0.txt b/codenet/public_test_cases/p00492/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p00492/output.0.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p00492/output.1.txt b/codenet/public_test_cases/p00492/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p00492/output.1.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p00493/input.0.txt b/codenet/public_test_cases/p00493/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ecff2c10cb89ea6cd6ce238671a32be47d36506 --- /dev/null +++ b/codenet/public_test_cases/p00493/input.0.txt @@ -0,0 +1,3 @@ +100 +200 +5 diff --git a/codenet/public_test_cases/p00493/input.1.txt b/codenet/public_test_cases/p00493/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ecff2c10cb89ea6cd6ce238671a32be47d36506 --- /dev/null +++ b/codenet/public_test_cases/p00493/input.1.txt @@ -0,0 +1,3 @@ +100 +200 +5 diff --git a/codenet/public_test_cases/p00493/output.0.txt b/codenet/public_test_cases/p00493/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p00493/output.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p00493/output.1.txt b/codenet/public_test_cases/p00493/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p00493/output.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p00494/input.0.txt b/codenet/public_test_cases/p00494/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b2fa96c41eed9ba68a4f184b4c62bb6fa7236ec --- /dev/null +++ b/codenet/public_test_cases/p00494/input.0.txt @@ -0,0 +1 @@ +OJJOOIIOJOI diff --git a/codenet/public_test_cases/p00494/output.0.txt b/codenet/public_test_cases/p00494/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00494/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00495/input.0.txt b/codenet/public_test_cases/p00495/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7be82dbc13f9406ad3bcc5c2bbe41955922dd157 --- /dev/null +++ b/codenet/public_test_cases/p00495/input.0.txt @@ -0,0 +1,3 @@ +5 4 +1 2 3 4 5 +3 1 4 1 diff --git a/codenet/public_test_cases/p00495/output.0.txt b/codenet/public_test_cases/p00495/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00495/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00496/input.0.txt b/codenet/public_test_cases/p00496/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..adffaec6d853b37d779f6af1f0a7862f88486383 --- /dev/null +++ b/codenet/public_test_cases/p00496/input.0.txt @@ -0,0 +1,6 @@ +5 20 14 +8 9 +2 4 +7 13 +6 3 +5 8 diff --git a/codenet/public_test_cases/p00496/input.1.txt b/codenet/public_test_cases/p00496/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..adffaec6d853b37d779f6af1f0a7862f88486383 --- /dev/null +++ b/codenet/public_test_cases/p00496/input.1.txt @@ -0,0 +1,6 @@ +5 20 14 +8 9 +2 4 +7 13 +6 3 +5 8 diff --git a/codenet/public_test_cases/p00496/input.2.txt b/codenet/public_test_cases/p00496/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00496/input.2.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00496/output.0.txt b/codenet/public_test_cases/p00496/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p00496/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p00496/output.1.txt b/codenet/public_test_cases/p00496/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p00496/output.1.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p00496/output.2.txt b/codenet/public_test_cases/p00496/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00496/output.2.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00497/input.0.txt b/codenet/public_test_cases/p00497/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30ec59631a14a28a14e974bee0f829be699fac4a --- /dev/null +++ b/codenet/public_test_cases/p00497/input.0.txt @@ -0,0 +1,3 @@ +5 2 +2 2 1 +2 1 3 diff --git a/codenet/public_test_cases/p00497/input.1.txt b/codenet/public_test_cases/p00497/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00497/input.1.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00497/input.2.txt b/codenet/public_test_cases/p00497/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..30ec59631a14a28a14e974bee0f829be699fac4a --- /dev/null +++ b/codenet/public_test_cases/p00497/input.2.txt @@ -0,0 +1,3 @@ +5 2 +2 2 1 +2 1 3 diff --git a/codenet/public_test_cases/p00497/output.0.txt b/codenet/public_test_cases/p00497/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p00497/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p00497/output.1.txt b/codenet/public_test_cases/p00497/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00497/output.1.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00497/output.2.txt b/codenet/public_test_cases/p00497/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p00497/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p00498/input.0.txt b/codenet/public_test_cases/p00498/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91b6f3b805a849914cc8be1380adcae0a42aead6 --- /dev/null +++ b/codenet/public_test_cases/p00498/input.0.txt @@ -0,0 +1,12 @@ +6 6 2 3 +1 2 5 +2 3 4 +2 4 6 +3 5 9 +4 5 3 +5 6 7 +1 +6 +3 4 +5 2 +1 4 diff --git a/codenet/public_test_cases/p00498/output.0.txt b/codenet/public_test_cases/p00498/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..267dabb73cd30deae7788e0eef5e587e820b97ec --- /dev/null +++ b/codenet/public_test_cases/p00498/output.0.txt @@ -0,0 +1,3 @@ +7 +5 +0 diff --git a/codenet/public_test_cases/p00499/input.0.txt b/codenet/public_test_cases/p00499/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..70ba73a983064dc6d23f212f6ff65ce05c418240 --- /dev/null +++ b/codenet/public_test_cases/p00499/input.0.txt @@ -0,0 +1,5 @@ +20 +25 +30 +6 +8 diff --git a/codenet/public_test_cases/p00499/input.1.txt b/codenet/public_test_cases/p00499/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..70ba73a983064dc6d23f212f6ff65ce05c418240 --- /dev/null +++ b/codenet/public_test_cases/p00499/input.1.txt @@ -0,0 +1,5 @@ +20 +25 +30 +6 +8 diff --git a/codenet/public_test_cases/p00499/output.0.txt b/codenet/public_test_cases/p00499/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p00499/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p00499/output.1.txt b/codenet/public_test_cases/p00499/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p00499/output.1.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p00500/input.0.txt b/codenet/public_test_cases/p00500/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c9a61323b3d7fdd5079aaa3cb5708e3e5379bc4 --- /dev/null +++ b/codenet/public_test_cases/p00500/input.0.txt @@ -0,0 +1,6 @@ +5 +100 99 98 +100 97 92 +63 89 63 +99 99 99 +89 97 98 diff --git a/codenet/public_test_cases/p00500/input.1.txt b/codenet/public_test_cases/p00500/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c9a61323b3d7fdd5079aaa3cb5708e3e5379bc4 --- /dev/null +++ b/codenet/public_test_cases/p00500/input.1.txt @@ -0,0 +1,6 @@ +5 +100 99 98 +100 97 92 +63 89 63 +99 99 99 +89 97 98 diff --git a/codenet/public_test_cases/p00500/output.0.txt b/codenet/public_test_cases/p00500/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1be04dc607fbd6d42b2599e8e41080200aa1b4ba --- /dev/null +++ b/codenet/public_test_cases/p00500/output.0.txt @@ -0,0 +1,5 @@ +0 +92 +215 +198 +89 diff --git a/codenet/public_test_cases/p00500/output.1.txt b/codenet/public_test_cases/p00500/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1be04dc607fbd6d42b2599e8e41080200aa1b4ba --- /dev/null +++ b/codenet/public_test_cases/p00500/output.1.txt @@ -0,0 +1,5 @@ +0 +92 +215 +198 +89 diff --git a/codenet/public_test_cases/p00501/input.0.txt b/codenet/public_test_cases/p00501/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fbce3a61607295e8ee3ae84eceb7751d6c00376 --- /dev/null +++ b/codenet/public_test_cases/p00501/input.0.txt @@ -0,0 +1,6 @@ +4 +bar +abracadabra +bear +bar +baraxbara diff --git a/codenet/public_test_cases/p00501/input.1.txt b/codenet/public_test_cases/p00501/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fbce3a61607295e8ee3ae84eceb7751d6c00376 --- /dev/null +++ b/codenet/public_test_cases/p00501/input.1.txt @@ -0,0 +1,6 @@ +4 +bar +abracadabra +bear +bar +baraxbara diff --git a/codenet/public_test_cases/p00501/output.0.txt b/codenet/public_test_cases/p00501/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00501/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00501/output.1.txt b/codenet/public_test_cases/p00501/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00501/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00502/input.0.txt b/codenet/public_test_cases/p00502/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ec63293177f68d3fc6d24ab5e5d9b6d805a3441 --- /dev/null +++ b/codenet/public_test_cases/p00502/input.0.txt @@ -0,0 +1,8 @@ +3 4 +31 +27 +35 +20 25 30 +23 29 90 +21 35 60 +28 33 40 diff --git a/codenet/public_test_cases/p00502/input.1.txt b/codenet/public_test_cases/p00502/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ec63293177f68d3fc6d24ab5e5d9b6d805a3441 --- /dev/null +++ b/codenet/public_test_cases/p00502/input.1.txt @@ -0,0 +1,8 @@ +3 4 +31 +27 +35 +20 25 30 +23 29 90 +21 35 60 +28 33 40 diff --git a/codenet/public_test_cases/p00502/output.0.txt b/codenet/public_test_cases/p00502/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p00502/output.0.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p00502/output.1.txt b/codenet/public_test_cases/p00502/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p00502/output.1.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p00503/input.0.txt b/codenet/public_test_cases/p00503/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ded8c00a8735c07aa232e587b5afba389726545 --- /dev/null +++ b/codenet/public_test_cases/p00503/input.0.txt @@ -0,0 +1,4 @@ +3 2 +30 50 0 50 70 100 +10 20 20 70 90 60 +40 60 20 90 90 70 diff --git a/codenet/public_test_cases/p00503/input.1.txt b/codenet/public_test_cases/p00503/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ded8c00a8735c07aa232e587b5afba389726545 --- /dev/null +++ b/codenet/public_test_cases/p00503/input.1.txt @@ -0,0 +1,4 @@ +3 2 +30 50 0 50 70 100 +10 20 20 70 90 60 +40 60 20 90 90 70 diff --git a/codenet/public_test_cases/p00503/output.0.txt b/codenet/public_test_cases/p00503/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afdd418402aef3f8fe266a04d34586ec8f5dcd12 --- /dev/null +++ b/codenet/public_test_cases/p00503/output.0.txt @@ -0,0 +1 @@ +49000 diff --git a/codenet/public_test_cases/p00503/output.1.txt b/codenet/public_test_cases/p00503/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afdd418402aef3f8fe266a04d34586ec8f5dcd12 --- /dev/null +++ b/codenet/public_test_cases/p00503/output.1.txt @@ -0,0 +1 @@ +49000 diff --git a/codenet/public_test_cases/p00504/input.0.txt b/codenet/public_test_cases/p00504/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..312bf7f65d0d2810d2f557a6ea25f7179cf89393 --- /dev/null +++ b/codenet/public_test_cases/p00504/input.0.txt @@ -0,0 +1,6 @@ +5 4 2 +...# +.#.# +.#73 +8##. +.... diff --git a/codenet/public_test_cases/p00504/input.1.txt b/codenet/public_test_cases/p00504/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..312bf7f65d0d2810d2f557a6ea25f7179cf89393 --- /dev/null +++ b/codenet/public_test_cases/p00504/input.1.txt @@ -0,0 +1,6 @@ +5 4 2 +...# +.#.# +.#73 +8##. +.... diff --git a/codenet/public_test_cases/p00504/output.0.txt b/codenet/public_test_cases/p00504/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00504/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00504/output.1.txt b/codenet/public_test_cases/p00504/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00504/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00505/input.0.txt b/codenet/public_test_cases/p00505/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ada4eac5030821f038ca7c216b057c8caa147e21 --- /dev/null +++ b/codenet/public_test_cases/p00505/input.0.txt @@ -0,0 +1,5 @@ +3 4 5 +2 1 2 +6 3 4 +1 1 1 +1 2 3 diff --git a/codenet/public_test_cases/p00505/output.0.txt b/codenet/public_test_cases/p00505/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..35d66973cd17e34e8af2ddbd0975cc053c50d369 --- /dev/null +++ b/codenet/public_test_cases/p00505/output.0.txt @@ -0,0 +1 @@ +3 1 1 1 diff --git a/codenet/public_test_cases/p00506/input.0.txt b/codenet/public_test_cases/p00506/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb15027ca576d65717b58d670ba6022cbf85c38d --- /dev/null +++ b/codenet/public_test_cases/p00506/input.0.txt @@ -0,0 +1,2 @@ +2 +75 125 diff --git a/codenet/public_test_cases/p00506/output.0.txt b/codenet/public_test_cases/p00506/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05d453538d8783a4161d11a7c2ee13e8d0a1aba8 --- /dev/null +++ b/codenet/public_test_cases/p00506/output.0.txt @@ -0,0 +1,3 @@ +1 +5 +25 diff --git a/codenet/public_test_cases/p00507/input.0.txt b/codenet/public_test_cases/p00507/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b55b06454b2f9a222965d61358b26ad4fa982426 --- /dev/null +++ b/codenet/public_test_cases/p00507/input.0.txt @@ -0,0 +1,4 @@ +3 +2 +7 +5 diff --git a/codenet/public_test_cases/p00507/output.0.txt b/codenet/public_test_cases/p00507/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0691f67b202a873c99bdb9b99e15a667cb916a5b --- /dev/null +++ b/codenet/public_test_cases/p00507/output.0.txt @@ -0,0 +1 @@ +52 diff --git a/codenet/public_test_cases/p00508/input.0.txt b/codenet/public_test_cases/p00508/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..736b8244187c8d0a21bd7be834a4f2e1aff95c08 --- /dev/null +++ b/codenet/public_test_cases/p00508/input.0.txt @@ -0,0 +1,3 @@ +2 +0 0 +1 1 diff --git a/codenet/public_test_cases/p00508/output.0.txt b/codenet/public_test_cases/p00508/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00508/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00509/input.0.txt b/codenet/public_test_cases/p00509/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80c0cc79aabb27a7894c5795860fa87c6473f004 --- /dev/null +++ b/codenet/public_test_cases/p00509/input.0.txt @@ -0,0 +1 @@ +1 0 diff --git a/codenet/public_test_cases/p00509/output.0.txt b/codenet/public_test_cases/p00509/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..398050c62c882fa5ebc8d8aaa2e730e70790beeb --- /dev/null +++ b/codenet/public_test_cases/p00509/output.0.txt @@ -0,0 +1 @@ +101 diff --git a/codenet/public_test_cases/p00510/input.0.txt b/codenet/public_test_cases/p00510/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abd0367c5cc709b7b5fde88769b1d97d1326265d --- /dev/null +++ b/codenet/public_test_cases/p00510/input.0.txt @@ -0,0 +1,5 @@ +3 +2 +2 3 +2 3 +4 1 diff --git a/codenet/public_test_cases/p00510/output.0.txt b/codenet/public_test_cases/p00510/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00510/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00511/input.0.txt b/codenet/public_test_cases/p00511/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..009caffa6a0aa0ed1893cf6975fe847658564230 --- /dev/null +++ b/codenet/public_test_cases/p00511/input.0.txt @@ -0,0 +1,4 @@ +1 ++ +1 += diff --git a/codenet/public_test_cases/p00511/output.0.txt b/codenet/public_test_cases/p00511/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00511/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00512/input.0.txt b/codenet/public_test_cases/p00512/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74d460b176a58c0cda325b504121ff379c0030fb --- /dev/null +++ b/codenet/public_test_cases/p00512/input.0.txt @@ -0,0 +1,6 @@ +5 +A 20 +B 20 +A 20 +AB 10 +Z 10 diff --git a/codenet/public_test_cases/p00512/output.0.txt b/codenet/public_test_cases/p00512/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d442f08621ac0307234117caf2b5a941744816f --- /dev/null +++ b/codenet/public_test_cases/p00512/output.0.txt @@ -0,0 +1,4 @@ +A 40 +B 20 +Z 10 +AB 10 diff --git a/codenet/public_test_cases/p00513/input.0.txt b/codenet/public_test_cases/p00513/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..220920e69dc97bb0c642949cf90e35ff919043cc --- /dev/null +++ b/codenet/public_test_cases/p00513/input.0.txt @@ -0,0 +1,11 @@ +10 +4 +7 +9 +10 +12 +13 +16 +17 +19 +20 diff --git a/codenet/public_test_cases/p00513/input.1.txt b/codenet/public_test_cases/p00513/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00513/input.1.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00513/input.2.txt b/codenet/public_test_cases/p00513/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..220920e69dc97bb0c642949cf90e35ff919043cc --- /dev/null +++ b/codenet/public_test_cases/p00513/input.2.txt @@ -0,0 +1,11 @@ +10 +4 +7 +9 +10 +12 +13 +16 +17 +19 +20 diff --git a/codenet/public_test_cases/p00513/output.0.txt b/codenet/public_test_cases/p00513/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00513/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00513/output.1.txt b/codenet/public_test_cases/p00513/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00513/output.1.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00513/output.2.txt b/codenet/public_test_cases/p00513/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00513/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00514/input.0.txt b/codenet/public_test_cases/p00514/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fc5a74913d1e0922a3d30f54b2b4ca9c6b59417 --- /dev/null +++ b/codenet/public_test_cases/p00514/input.0.txt @@ -0,0 +1 @@ +2 0 3 diff --git a/codenet/public_test_cases/p00514/output.0.txt b/codenet/public_test_cases/p00514/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00514/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00515/input.0.txt b/codenet/public_test_cases/p00515/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b465ceee743dfb34845f0baa1054afec47b09fd --- /dev/null +++ b/codenet/public_test_cases/p00515/input.0.txt @@ -0,0 +1,5 @@ +10 +65 +100 +30 +95 diff --git a/codenet/public_test_cases/p00515/input.1.txt b/codenet/public_test_cases/p00515/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b465ceee743dfb34845f0baa1054afec47b09fd --- /dev/null +++ b/codenet/public_test_cases/p00515/input.1.txt @@ -0,0 +1,5 @@ +10 +65 +100 +30 +95 diff --git a/codenet/public_test_cases/p00515/output.0.txt b/codenet/public_test_cases/p00515/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38b10c1b2badd802b554ecc944a7a40c5f055d47 --- /dev/null +++ b/codenet/public_test_cases/p00515/output.0.txt @@ -0,0 +1 @@ +68 diff --git a/codenet/public_test_cases/p00515/output.1.txt b/codenet/public_test_cases/p00515/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38b10c1b2badd802b554ecc944a7a40c5f055d47 --- /dev/null +++ b/codenet/public_test_cases/p00515/output.1.txt @@ -0,0 +1 @@ +68 diff --git a/codenet/public_test_cases/p00516/input.0.txt b/codenet/public_test_cases/p00516/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b180a0fb7c6eb6f8c6249e5daf4edef7aec1397d --- /dev/null +++ b/codenet/public_test_cases/p00516/input.0.txt @@ -0,0 +1,8 @@ +4 3 +5 +3 +1 +4 +4 +3 +2 diff --git a/codenet/public_test_cases/p00516/output.0.txt b/codenet/public_test_cases/p00516/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00516/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00517/input.0.txt b/codenet/public_test_cases/p00517/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b16a42af6e494b688139d59a78980f3d7f34b3aa --- /dev/null +++ b/codenet/public_test_cases/p00517/input.0.txt @@ -0,0 +1,4 @@ +4 3 3 +1 1 +3 3 +4 1 diff --git a/codenet/public_test_cases/p00517/output.0.txt b/codenet/public_test_cases/p00517/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00517/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00518/input.0.txt b/codenet/public_test_cases/p00518/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66231f4b11383fc007f6ed20c3d05ca7182cfc68 --- /dev/null +++ b/codenet/public_test_cases/p00518/input.0.txt @@ -0,0 +1,2 @@ +2 +OI diff --git a/codenet/public_test_cases/p00518/output.0.txt b/codenet/public_test_cases/p00518/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p00518/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p00519/input.0.txt b/codenet/public_test_cases/p00519/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f5e12783d527467ee7f449f7393d552c3d21889 --- /dev/null +++ b/codenet/public_test_cases/p00519/input.0.txt @@ -0,0 +1,13 @@ +6 6 +400 2 +200 1 +600 3 +1000 1 +300 5 +700 4 +1 2 +2 3 +3 6 +4 6 +1 5 +2 4 diff --git a/codenet/public_test_cases/p00519/input.1.txt b/codenet/public_test_cases/p00519/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f5e12783d527467ee7f449f7393d552c3d21889 --- /dev/null +++ b/codenet/public_test_cases/p00519/input.1.txt @@ -0,0 +1,13 @@ +6 6 +400 2 +200 1 +600 3 +1000 1 +300 5 +700 4 +1 2 +2 3 +3 6 +4 6 +1 5 +2 4 diff --git a/codenet/public_test_cases/p00519/input.2.txt b/codenet/public_test_cases/p00519/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00519/input.2.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00519/output.0.txt b/codenet/public_test_cases/p00519/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4890ce57fed26f8237519931c4892b8d323d249 --- /dev/null +++ b/codenet/public_test_cases/p00519/output.0.txt @@ -0,0 +1 @@ +700 diff --git a/codenet/public_test_cases/p00519/output.1.txt b/codenet/public_test_cases/p00519/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4890ce57fed26f8237519931c4892b8d323d249 --- /dev/null +++ b/codenet/public_test_cases/p00519/output.1.txt @@ -0,0 +1 @@ +700 diff --git a/codenet/public_test_cases/p00519/output.2.txt b/codenet/public_test_cases/p00519/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0047fa49f09537200023a679a676db5c8173cfc --- /dev/null +++ b/codenet/public_test_cases/p00519/output.2.txt @@ -0,0 +1 @@ +None diff --git a/codenet/public_test_cases/p00520/input.0.txt b/codenet/public_test_cases/p00520/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c74fcf721bb368187297fd4d2623ec56652aec5 --- /dev/null +++ b/codenet/public_test_cases/p00520/input.0.txt @@ -0,0 +1,3 @@ +5 +1 0 1 1 2 +0 2 6 3 4 diff --git a/codenet/public_test_cases/p00520/output.0.txt b/codenet/public_test_cases/p00520/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p00520/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p00521/input.0.txt b/codenet/public_test_cases/p00521/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..35e5257754fe13ca997c8069ceeda27373f278ab --- /dev/null +++ b/codenet/public_test_cases/p00521/input.0.txt @@ -0,0 +1,6 @@ +3 5 +JOIJO +IJOOO +IIJIJ +JO +IJ diff --git a/codenet/public_test_cases/p00521/output.0.txt b/codenet/public_test_cases/p00521/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00521/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00522/input.0.txt b/codenet/public_test_cases/p00522/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56a6f821144fa986980d0f059d61b777e22a2b04 --- /dev/null +++ b/codenet/public_test_cases/p00522/input.0.txt @@ -0,0 +1,8 @@ +4 3 +180 +160 +170 +190 +2 100 +3 120 +4 250 diff --git a/codenet/public_test_cases/p00522/output.0.txt b/codenet/public_test_cases/p00522/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..36e082614b99c3d3a3445b3f0d978e02031d92d8 --- /dev/null +++ b/codenet/public_test_cases/p00522/output.0.txt @@ -0,0 +1 @@ +480 diff --git a/codenet/public_test_cases/p00523/input.0.txt b/codenet/public_test_cases/p00523/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ece36d75c10115770f9b6e56e81128cf012a7d3 --- /dev/null +++ b/codenet/public_test_cases/p00523/input.0.txt @@ -0,0 +1,7 @@ +6 +1 +5 +4 +5 +2 +4 diff --git a/codenet/public_test_cases/p00523/output.0.txt b/codenet/public_test_cases/p00523/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00523/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00524/input.0.txt b/codenet/public_test_cases/p00524/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f537e7ba7a5b30d123d724640b96e0e7181466e5 --- /dev/null +++ b/codenet/public_test_cases/p00524/input.0.txt @@ -0,0 +1,11 @@ +5 5 0 +50 +100 +25 +30 +10 +1 2 10 +2 5 50 +2 4 20 +4 3 1 +5 4 20 diff --git a/codenet/public_test_cases/p00524/output.0.txt b/codenet/public_test_cases/p00524/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p00524/output.0.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p00525/input.0.txt b/codenet/public_test_cases/p00525/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ac1d0bdd9143cfefd762b0e15d56232ccfad0a7 --- /dev/null +++ b/codenet/public_test_cases/p00525/input.0.txt @@ -0,0 +1,6 @@ +10 10 5 +6 0 6 7 +0 6 7 6 +2 3 9 3 +2 3 2 10 +1 9 8 9 diff --git a/codenet/public_test_cases/p00525/output.0.txt b/codenet/public_test_cases/p00525/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00525/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00526/input.0.txt b/codenet/public_test_cases/p00526/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2767cf8330da935376f9fdb2bda68dc1f0f9befa --- /dev/null +++ b/codenet/public_test_cases/p00526/input.0.txt @@ -0,0 +1,2 @@ +10 +1 1 0 0 1 0 1 1 1 0 diff --git a/codenet/public_test_cases/p00526/input.1.txt b/codenet/public_test_cases/p00526/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2767cf8330da935376f9fdb2bda68dc1f0f9befa --- /dev/null +++ b/codenet/public_test_cases/p00526/input.1.txt @@ -0,0 +1,2 @@ +10 +1 1 0 0 1 0 1 1 1 0 diff --git a/codenet/public_test_cases/p00526/output.0.txt b/codenet/public_test_cases/p00526/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p00526/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p00526/output.1.txt b/codenet/public_test_cases/p00526/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p00526/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p00527/input.0.txt b/codenet/public_test_cases/p00527/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a9cc8ddf0abf3310d6f4be0efd2bae5f15d0e70 --- /dev/null +++ b/codenet/public_test_cases/p00527/input.0.txt @@ -0,0 +1,3 @@ +5 5 +OIOOI +OOIOI diff --git a/codenet/public_test_cases/p00527/input.1.txt b/codenet/public_test_cases/p00527/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a9cc8ddf0abf3310d6f4be0efd2bae5f15d0e70 --- /dev/null +++ b/codenet/public_test_cases/p00527/input.1.txt @@ -0,0 +1,3 @@ +5 5 +OIOOI +OOIOI diff --git a/codenet/public_test_cases/p00527/output.0.txt b/codenet/public_test_cases/p00527/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p00527/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p00527/output.1.txt b/codenet/public_test_cases/p00527/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p00527/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p00528/input.0.txt b/codenet/public_test_cases/p00528/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b81e6020169312a3c460da74f42a16e9c636ad94 --- /dev/null +++ b/codenet/public_test_cases/p00528/input.0.txt @@ -0,0 +1,2 @@ +3 2 1 +1 2 diff --git a/codenet/public_test_cases/p00528/input.1.txt b/codenet/public_test_cases/p00528/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b81e6020169312a3c460da74f42a16e9c636ad94 --- /dev/null +++ b/codenet/public_test_cases/p00528/input.1.txt @@ -0,0 +1,2 @@ +3 2 1 +1 2 diff --git a/codenet/public_test_cases/p00528/output.0.txt b/codenet/public_test_cases/p00528/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00528/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00528/output.1.txt b/codenet/public_test_cases/p00528/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00528/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00529/input.0.txt b/codenet/public_test_cases/p00529/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f28b26f564db95583c31b19f50e95767ee2ee869 --- /dev/null +++ b/codenet/public_test_cases/p00529/input.0.txt @@ -0,0 +1,2 @@ +6 +JOIIOI diff --git a/codenet/public_test_cases/p00529/input.1.txt b/codenet/public_test_cases/p00529/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f28b26f564db95583c31b19f50e95767ee2ee869 --- /dev/null +++ b/codenet/public_test_cases/p00529/input.1.txt @@ -0,0 +1,2 @@ +6 +JOIIOI diff --git a/codenet/public_test_cases/p00529/output.0.txt b/codenet/public_test_cases/p00529/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00529/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00529/output.1.txt b/codenet/public_test_cases/p00529/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00529/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00530/input.0.txt b/codenet/public_test_cases/p00530/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0acd7a56c6bc18885e0777311b3678d25c4d7ba3 --- /dev/null +++ b/codenet/public_test_cases/p00530/input.0.txt @@ -0,0 +1,6 @@ +5 +10 +3 +6 +8 +1 diff --git a/codenet/public_test_cases/p00530/input.1.txt b/codenet/public_test_cases/p00530/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0acd7a56c6bc18885e0777311b3678d25c4d7ba3 --- /dev/null +++ b/codenet/public_test_cases/p00530/input.1.txt @@ -0,0 +1,6 @@ +5 +10 +3 +6 +8 +1 diff --git a/codenet/public_test_cases/p00530/output.0.txt b/codenet/public_test_cases/p00530/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00530/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00530/output.1.txt b/codenet/public_test_cases/p00530/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00530/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00531/input.0.txt b/codenet/public_test_cases/p00531/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce8aefa8b0e7b3101783d6b2d4a5c64bfffda138 --- /dev/null +++ b/codenet/public_test_cases/p00531/input.0.txt @@ -0,0 +1,5 @@ +9 +100 +20 +3 +10 diff --git a/codenet/public_test_cases/p00531/output.0.txt b/codenet/public_test_cases/p00531/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61f00d8cad3920809f4d992ac3031b3f32e7f10 --- /dev/null +++ b/codenet/public_test_cases/p00531/output.0.txt @@ -0,0 +1 @@ +90 diff --git a/codenet/public_test_cases/p00532/input.0.txt b/codenet/public_test_cases/p00532/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eee56bb1ddb6b2d70e18ff3edad8072369d31abf --- /dev/null +++ b/codenet/public_test_cases/p00532/input.0.txt @@ -0,0 +1,7 @@ +3 +4 +1 2 3 2 +1 1 2 +3 2 2 +1 1 3 +2 2 2 diff --git a/codenet/public_test_cases/p00532/output.0.txt b/codenet/public_test_cases/p00532/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2e8ea0904b0fdd2d02ac80f08d60c82e199e8a5 --- /dev/null +++ b/codenet/public_test_cases/p00532/output.0.txt @@ -0,0 +1,3 @@ +3 +4 +5 diff --git a/codenet/public_test_cases/p00533/input.0.txt b/codenet/public_test_cases/p00533/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..048e4ab39f09237bfdf0b729d044add38827c9d9 --- /dev/null +++ b/codenet/public_test_cases/p00533/input.0.txt @@ -0,0 +1,4 @@ +3 4 +c..c +..c. +.... diff --git a/codenet/public_test_cases/p00533/output.0.txt b/codenet/public_test_cases/p00533/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbbc0cbded717aab9e1912a5450b5a1882eb6b94 --- /dev/null +++ b/codenet/public_test_cases/p00533/output.0.txt @@ -0,0 +1,3 @@ +0 1 2 0 +-1 -1 0 1 +-1 -1 -1 -1 diff --git a/codenet/public_test_cases/p00534/input.0.txt b/codenet/public_test_cases/p00534/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94110e3809617d7223b306617baf8530ee0e3b61 --- /dev/null +++ b/codenet/public_test_cases/p00534/input.0.txt @@ -0,0 +1,9 @@ +3 5 +10 +25 +15 +50 +30 +15 +40 +30 diff --git a/codenet/public_test_cases/p00534/input.1.txt b/codenet/public_test_cases/p00534/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94110e3809617d7223b306617baf8530ee0e3b61 --- /dev/null +++ b/codenet/public_test_cases/p00534/input.1.txt @@ -0,0 +1,9 @@ +3 5 +10 +25 +15 +50 +30 +15 +40 +30 diff --git a/codenet/public_test_cases/p00534/output.0.txt b/codenet/public_test_cases/p00534/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7061465351498768c4b9bb21c500c9531d87d414 --- /dev/null +++ b/codenet/public_test_cases/p00534/output.0.txt @@ -0,0 +1 @@ +1125 diff --git a/codenet/public_test_cases/p00534/output.1.txt b/codenet/public_test_cases/p00534/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7061465351498768c4b9bb21c500c9531d87d414 --- /dev/null +++ b/codenet/public_test_cases/p00534/output.1.txt @@ -0,0 +1 @@ +1125 diff --git a/codenet/public_test_cases/p00535/input.0.txt b/codenet/public_test_cases/p00535/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..312185f6997890b3038d5be65b2cff8c962cb3ec --- /dev/null +++ b/codenet/public_test_cases/p00535/input.0.txt @@ -0,0 +1,6 @@ +5 6 +...... +.939.. +.3428. +.9393. +...... diff --git a/codenet/public_test_cases/p00535/output.0.txt b/codenet/public_test_cases/p00535/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00535/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00536/input.0.txt b/codenet/public_test_cases/p00536/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61875a5ddb22d4378325e8ecadaa197c3823428 --- /dev/null +++ b/codenet/public_test_cases/p00536/input.0.txt @@ -0,0 +1,7 @@ +6 15 +50 900 +30 200 +40 100 +80 600 +60 100 +70 700 diff --git a/codenet/public_test_cases/p00536/output.0.txt b/codenet/public_test_cases/p00536/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59a3ec59b53573619be25381cf973b173e2a60ba --- /dev/null +++ b/codenet/public_test_cases/p00536/output.0.txt @@ -0,0 +1 @@ +1200 diff --git a/codenet/public_test_cases/p00537/input.0.txt b/codenet/public_test_cases/p00537/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65f093ec9207b8b9ac0475f68b781839b12491df --- /dev/null +++ b/codenet/public_test_cases/p00537/input.0.txt @@ -0,0 +1,5 @@ +4 4 +1 3 2 4 +120 90 100 +110 50 80 +250 70 130 diff --git a/codenet/public_test_cases/p00537/input.1.txt b/codenet/public_test_cases/p00537/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..65f093ec9207b8b9ac0475f68b781839b12491df --- /dev/null +++ b/codenet/public_test_cases/p00537/input.1.txt @@ -0,0 +1,5 @@ +4 4 +1 3 2 4 +120 90 100 +110 50 80 +250 70 130 diff --git a/codenet/public_test_cases/p00537/output.0.txt b/codenet/public_test_cases/p00537/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75e27a6bd6cd35c489cbf14e7a853a1b37c75319 --- /dev/null +++ b/codenet/public_test_cases/p00537/output.0.txt @@ -0,0 +1 @@ +550 diff --git a/codenet/public_test_cases/p00537/output.1.txt b/codenet/public_test_cases/p00537/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75e27a6bd6cd35c489cbf14e7a853a1b37c75319 --- /dev/null +++ b/codenet/public_test_cases/p00537/output.1.txt @@ -0,0 +1 @@ +550 diff --git a/codenet/public_test_cases/p00538/input.0.txt b/codenet/public_test_cases/p00538/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a9768a996678e73f3c1c7e59a1b127a6cef1df7 --- /dev/null +++ b/codenet/public_test_cases/p00538/input.0.txt @@ -0,0 +1,6 @@ +5 +2 +8 +1 +10 +9 diff --git a/codenet/public_test_cases/p00538/input.1.txt b/codenet/public_test_cases/p00538/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a9768a996678e73f3c1c7e59a1b127a6cef1df7 --- /dev/null +++ b/codenet/public_test_cases/p00538/input.1.txt @@ -0,0 +1,6 @@ +5 +2 +8 +1 +10 +9 diff --git a/codenet/public_test_cases/p00538/output.0.txt b/codenet/public_test_cases/p00538/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p00538/output.0.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p00538/output.1.txt b/codenet/public_test_cases/p00538/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p00538/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p00539/input.0.txt b/codenet/public_test_cases/p00539/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e712a4e89829272f47ebbc74cc80093cd951f586 --- /dev/null +++ b/codenet/public_test_cases/p00539/input.0.txt @@ -0,0 +1,6 @@ +5 5 2 +2 3 1 +3 1 2 +2 4 3 +1 2 4 +2 5 5 diff --git a/codenet/public_test_cases/p00539/input.1.txt b/codenet/public_test_cases/p00539/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e712a4e89829272f47ebbc74cc80093cd951f586 --- /dev/null +++ b/codenet/public_test_cases/p00539/input.1.txt @@ -0,0 +1,6 @@ +5 5 2 +2 3 1 +3 1 2 +2 4 3 +1 2 4 +2 5 5 diff --git a/codenet/public_test_cases/p00539/output.0.txt b/codenet/public_test_cases/p00539/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p00539/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p00539/output.1.txt b/codenet/public_test_cases/p00539/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p00539/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p00540/input.0.txt b/codenet/public_test_cases/p00540/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02e46fb01b80568b764a80d1dac42c609f52e9bc --- /dev/null +++ b/codenet/public_test_cases/p00540/input.0.txt @@ -0,0 +1,8 @@ +7 3 +5 2 +5 5 +8 6 +6 +2 +8 +9 diff --git a/codenet/public_test_cases/p00540/input.1.txt b/codenet/public_test_cases/p00540/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..02e46fb01b80568b764a80d1dac42c609f52e9bc --- /dev/null +++ b/codenet/public_test_cases/p00540/input.1.txt @@ -0,0 +1,8 @@ +7 3 +5 2 +5 5 +8 6 +6 +2 +8 +9 diff --git a/codenet/public_test_cases/p00540/output.0.txt b/codenet/public_test_cases/p00540/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00540/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00540/output.1.txt b/codenet/public_test_cases/p00540/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00540/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00541/input.0.txt b/codenet/public_test_cases/p00541/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c23cb5b57ee4dcb1dfd0e522548b820534ad8f3 --- /dev/null +++ b/codenet/public_test_cases/p00541/input.0.txt @@ -0,0 +1,3 @@ +5 5 3 2 +2 2 +4 3 diff --git a/codenet/public_test_cases/p00541/input.1.txt b/codenet/public_test_cases/p00541/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c23cb5b57ee4dcb1dfd0e522548b820534ad8f3 --- /dev/null +++ b/codenet/public_test_cases/p00541/input.1.txt @@ -0,0 +1,3 @@ +5 5 3 2 +2 2 +4 3 diff --git a/codenet/public_test_cases/p00541/output.0.txt b/codenet/public_test_cases/p00541/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00541/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00541/output.1.txt b/codenet/public_test_cases/p00541/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00541/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00542/input.0.txt b/codenet/public_test_cases/p00542/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e3909682f3bf48932a0c55bc06c6f4edafbe2ea --- /dev/null +++ b/codenet/public_test_cases/p00542/input.0.txt @@ -0,0 +1,6 @@ +100 +34 +76 +42 +10 +0 diff --git a/codenet/public_test_cases/p00542/input.1.txt b/codenet/public_test_cases/p00542/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e3909682f3bf48932a0c55bc06c6f4edafbe2ea --- /dev/null +++ b/codenet/public_test_cases/p00542/input.1.txt @@ -0,0 +1,6 @@ +100 +34 +76 +42 +10 +0 diff --git a/codenet/public_test_cases/p00542/output.0.txt b/codenet/public_test_cases/p00542/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9be0dc9a9e6f4d2dedc39a0148a071fd5e2e455d --- /dev/null +++ b/codenet/public_test_cases/p00542/output.0.txt @@ -0,0 +1 @@ +228 diff --git a/codenet/public_test_cases/p00542/output.1.txt b/codenet/public_test_cases/p00542/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9be0dc9a9e6f4d2dedc39a0148a071fd5e2e455d --- /dev/null +++ b/codenet/public_test_cases/p00542/output.1.txt @@ -0,0 +1 @@ +228 diff --git a/codenet/public_test_cases/p00543/input.0.txt b/codenet/public_test_cases/p00543/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..644f9e5cf23eb0b8673bd901b4fc62c867b1a5e5 --- /dev/null +++ b/codenet/public_test_cases/p00543/input.0.txt @@ -0,0 +1,7 @@ +6 4 +3 +2 +8 +3 +1 +5 diff --git a/codenet/public_test_cases/p00543/input.1.txt b/codenet/public_test_cases/p00543/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..644f9e5cf23eb0b8673bd901b4fc62c867b1a5e5 --- /dev/null +++ b/codenet/public_test_cases/p00543/input.1.txt @@ -0,0 +1,7 @@ +6 4 +3 +2 +8 +3 +1 +5 diff --git a/codenet/public_test_cases/p00543/output.0.txt b/codenet/public_test_cases/p00543/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..04b109af90cb95827d2747d0561a8621227e30ae --- /dev/null +++ b/codenet/public_test_cases/p00543/output.0.txt @@ -0,0 +1,6 @@ +2 +3 +1 +8 +5 +3 diff --git a/codenet/public_test_cases/p00543/output.1.txt b/codenet/public_test_cases/p00543/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..04b109af90cb95827d2747d0561a8621227e30ae --- /dev/null +++ b/codenet/public_test_cases/p00543/output.1.txt @@ -0,0 +1,6 @@ +2 +3 +1 +8 +5 +3 diff --git a/codenet/public_test_cases/p00544/input.0.txt b/codenet/public_test_cases/p00544/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b3bfdb99379d738788d1d177e775fe585ae4442 --- /dev/null +++ b/codenet/public_test_cases/p00544/input.0.txt @@ -0,0 +1,5 @@ +4 5 +WRWRW +BWRWB +WRWRW +RWBWR diff --git a/codenet/public_test_cases/p00544/input.1.txt b/codenet/public_test_cases/p00544/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b3bfdb99379d738788d1d177e775fe585ae4442 --- /dev/null +++ b/codenet/public_test_cases/p00544/input.1.txt @@ -0,0 +1,5 @@ +4 5 +WRWRW +BWRWB +WRWRW +RWBWR diff --git a/codenet/public_test_cases/p00544/output.0.txt b/codenet/public_test_cases/p00544/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00544/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00544/output.1.txt b/codenet/public_test_cases/p00544/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00544/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00545/input.0.txt b/codenet/public_test_cases/p00545/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4916060435cfc87516ec8664c0cab04264a15ccd --- /dev/null +++ b/codenet/public_test_cases/p00545/input.0.txt @@ -0,0 +1,9 @@ +5 5 3 +-8 1 +-4 2 +-2 2 +4 2 +10 1 +1 +3 +5 diff --git a/codenet/public_test_cases/p00545/input.1.txt b/codenet/public_test_cases/p00545/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4916060435cfc87516ec8664c0cab04264a15ccd --- /dev/null +++ b/codenet/public_test_cases/p00545/input.1.txt @@ -0,0 +1,9 @@ +5 5 3 +-8 1 +-4 2 +-2 2 +4 2 +10 1 +1 +3 +5 diff --git a/codenet/public_test_cases/p00545/output.0.txt b/codenet/public_test_cases/p00545/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7436c57ddf9325008c9f9baa28fdc2cab5cbffca --- /dev/null +++ b/codenet/public_test_cases/p00545/output.0.txt @@ -0,0 +1,3 @@ +-6 +-6 +15 diff --git a/codenet/public_test_cases/p00545/output.1.txt b/codenet/public_test_cases/p00545/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7436c57ddf9325008c9f9baa28fdc2cab5cbffca --- /dev/null +++ b/codenet/public_test_cases/p00545/output.1.txt @@ -0,0 +1,3 @@ +-6 +-6 +15 diff --git a/codenet/public_test_cases/p00546/input.0.txt b/codenet/public_test_cases/p00546/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9b9f3d0e79f5d6da2b46b71a68a26a73e4ced48 --- /dev/null +++ b/codenet/public_test_cases/p00546/input.0.txt @@ -0,0 +1,24 @@ +13 21 1 1 +1000 6000 +7 +1 2 +3 7 +2 4 +5 8 +8 9 +2 5 +3 4 +4 7 +9 10 +10 11 +5 9 +7 12 +3 6 +4 5 +1 3 +11 12 +6 7 +8 11 +6 13 +7 8 +12 13 diff --git a/codenet/public_test_cases/p00546/input.1.txt b/codenet/public_test_cases/p00546/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9b9f3d0e79f5d6da2b46b71a68a26a73e4ced48 --- /dev/null +++ b/codenet/public_test_cases/p00546/input.1.txt @@ -0,0 +1,24 @@ +13 21 1 1 +1000 6000 +7 +1 2 +3 7 +2 4 +5 8 +8 9 +2 5 +3 4 +4 7 +9 10 +10 11 +5 9 +7 12 +3 6 +4 5 +1 3 +11 12 +6 7 +8 11 +6 13 +7 8 +12 13 diff --git a/codenet/public_test_cases/p00546/output.0.txt b/codenet/public_test_cases/p00546/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82b3803a20e9f2f5a15500747a459c5ccf2208fd --- /dev/null +++ b/codenet/public_test_cases/p00546/output.0.txt @@ -0,0 +1 @@ +11000 diff --git a/codenet/public_test_cases/p00546/output.1.txt b/codenet/public_test_cases/p00546/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..82b3803a20e9f2f5a15500747a459c5ccf2208fd --- /dev/null +++ b/codenet/public_test_cases/p00546/output.1.txt @@ -0,0 +1 @@ +11000 diff --git a/codenet/public_test_cases/p00547/input.0.txt b/codenet/public_test_cases/p00547/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e9b62a71a9576fb747a515b277c7df0a06acb31 --- /dev/null +++ b/codenet/public_test_cases/p00547/input.0.txt @@ -0,0 +1,6 @@ +5 5 +..483 +.59.9 +3.866 +79... +4.8.. diff --git a/codenet/public_test_cases/p00547/input.1.txt b/codenet/public_test_cases/p00547/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e9b62a71a9576fb747a515b277c7df0a06acb31 --- /dev/null +++ b/codenet/public_test_cases/p00547/input.1.txt @@ -0,0 +1,6 @@ +5 5 +..483 +.59.9 +3.866 +79... +4.8.. diff --git a/codenet/public_test_cases/p00547/output.0.txt b/codenet/public_test_cases/p00547/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p00547/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p00547/output.1.txt b/codenet/public_test_cases/p00547/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p00547/output.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p00548/input.0.txt b/codenet/public_test_cases/p00548/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f9373f5c39b1dd71b17b3fd5e7a640aee36b3a3 --- /dev/null +++ b/codenet/public_test_cases/p00548/input.0.txt @@ -0,0 +1,7 @@ +6 3 6 +1 +2 +3 +1 +2 +1 diff --git a/codenet/public_test_cases/p00548/output.0.txt b/codenet/public_test_cases/p00548/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p00548/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p00549/input.0.txt b/codenet/public_test_cases/p00549/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00b6d777b38c993cf8f1992ba624a0beb05ce5d0 --- /dev/null +++ b/codenet/public_test_cases/p00549/input.0.txt @@ -0,0 +1,2 @@ +5 +JOIOI diff --git a/codenet/public_test_cases/p00549/output.0.txt b/codenet/public_test_cases/p00549/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00549/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00550/input.0.txt b/codenet/public_test_cases/p00550/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b3244337281742680dec4df1953bb4cf7018c94 --- /dev/null +++ b/codenet/public_test_cases/p00550/input.0.txt @@ -0,0 +1,12 @@ +5 6 5 +1 2 +1 3 +4 2 +3 2 +2 5 +5 3 +5 +2 +4 +1 +3 diff --git a/codenet/public_test_cases/p00550/output.0.txt b/codenet/public_test_cases/p00550/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..080c074815da030aa13e6fd8ee188cf931234a5f --- /dev/null +++ b/codenet/public_test_cases/p00550/output.0.txt @@ -0,0 +1,5 @@ +0 +2 +2 +4 +4 diff --git a/codenet/public_test_cases/p00551/input.0.txt b/codenet/public_test_cases/p00551/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6d394badf96b601f0a58e631a056e6f35510cae --- /dev/null +++ b/codenet/public_test_cases/p00551/input.0.txt @@ -0,0 +1,2 @@ +12 1 +EENWSEEESWWS diff --git a/codenet/public_test_cases/p00551/output.0.txt b/codenet/public_test_cases/p00551/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00551/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00552/input.0.txt b/codenet/public_test_cases/p00552/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a4f66d2e76d0706c9296472b351c8fa4afa100f --- /dev/null +++ b/codenet/public_test_cases/p00552/input.0.txt @@ -0,0 +1,3 @@ +10 2 +12 1 3 +2 2 2 diff --git a/codenet/public_test_cases/p00552/output.0.txt b/codenet/public_test_cases/p00552/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18d4f3626994a8f1ed24533cfa9e75b2110f9196 --- /dev/null +++ b/codenet/public_test_cases/p00552/output.0.txt @@ -0,0 +1,10 @@ +3 +3 +5 +5 +5 +5 +5 +5 +2 +2 diff --git a/codenet/public_test_cases/p00553/input.0.txt b/codenet/public_test_cases/p00553/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8846daf23295d3afcecff4bf9a9b92c0184d3b0 --- /dev/null +++ b/codenet/public_test_cases/p00553/input.0.txt @@ -0,0 +1,5 @@ +-10 +20 +5 +10 +3 diff --git a/codenet/public_test_cases/p00553/output.0.txt b/codenet/public_test_cases/p00553/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52bd8e43afb01d0c9747f1fedf2fc94684ee4cc4 --- /dev/null +++ b/codenet/public_test_cases/p00553/output.0.txt @@ -0,0 +1 @@ +120 diff --git a/codenet/public_test_cases/p00554/input.0.txt b/codenet/public_test_cases/p00554/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45f008908565a8b4120ae35122ac477cd2d47f37 --- /dev/null +++ b/codenet/public_test_cases/p00554/input.0.txt @@ -0,0 +1,6 @@ +4 5 +1 7 +6 2 +3 5 +4 4 +0 8 diff --git a/codenet/public_test_cases/p00554/output.0.txt b/codenet/public_test_cases/p00554/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00554/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00555/input.0.txt b/codenet/public_test_cases/p00555/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b59c9cae5596fd1650df7ff4db7a1189be2430d4 --- /dev/null +++ b/codenet/public_test_cases/p00555/input.0.txt @@ -0,0 +1,4 @@ +3 5 2 +...#. +#...# +....# diff --git a/codenet/public_test_cases/p00555/output.0.txt b/codenet/public_test_cases/p00555/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p00555/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p00556/input.0.txt b/codenet/public_test_cases/p00556/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5841a137b6d3d571989fd4a2608b60c00be50940 --- /dev/null +++ b/codenet/public_test_cases/p00556/input.0.txt @@ -0,0 +1,8 @@ +7 2 +1 +2 +2 +2 +1 +2 +1 diff --git a/codenet/public_test_cases/p00556/output.0.txt b/codenet/public_test_cases/p00556/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00556/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00557/input.0.txt b/codenet/public_test_cases/p00557/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63a746ed9a9b60d3490afe31ee958cff4ce9cdd9 --- /dev/null +++ b/codenet/public_test_cases/p00557/input.0.txt @@ -0,0 +1,4 @@ +3 3 +2 9 4 +7 5 3 +6 1 8 diff --git a/codenet/public_test_cases/p00557/output.0.txt b/codenet/public_test_cases/p00557/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00557/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00558/input.0.txt b/codenet/public_test_cases/p00558/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b54081fa2a3abf74175f54c46442ec60a76f4cb6 --- /dev/null +++ b/codenet/public_test_cases/p00558/input.0.txt @@ -0,0 +1,19 @@ +8 10 4 +0 +1 +1 +2 +1 +1 +2 +0 +1 2 1 +1 3 1 +2 3 3 +2 4 5 +3 4 1 +4 5 1 +5 6 1 +5 8 1 +1 7 2 +7 8 2 diff --git a/codenet/public_test_cases/p00558/output.0.txt b/codenet/public_test_cases/p00558/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p00558/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p00559/input.0.txt b/codenet/public_test_cases/p00559/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cec98e5b405411b20e4e18681a36861774211582 --- /dev/null +++ b/codenet/public_test_cases/p00559/input.0.txt @@ -0,0 +1,10 @@ +3 5 1 2 +0 +4 +1 +8 +1 2 2 +1 1 -2 +2 3 5 +1 2 -1 +1 3 5 diff --git a/codenet/public_test_cases/p00559/input.1.txt b/codenet/public_test_cases/p00559/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cec98e5b405411b20e4e18681a36861774211582 --- /dev/null +++ b/codenet/public_test_cases/p00559/input.1.txt @@ -0,0 +1,10 @@ +3 5 1 2 +0 +4 +1 +8 +1 2 2 +1 1 -2 +2 3 5 +1 2 -1 +1 3 5 diff --git a/codenet/public_test_cases/p00559/output.0.txt b/codenet/public_test_cases/p00559/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaedc719209cb0e66d02398e2470fbb0fff6e3e1 --- /dev/null +++ b/codenet/public_test_cases/p00559/output.0.txt @@ -0,0 +1,5 @@ +-5 +-7 +-13 +-13 +-18 diff --git a/codenet/public_test_cases/p00559/output.1.txt b/codenet/public_test_cases/p00559/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaedc719209cb0e66d02398e2470fbb0fff6e3e1 --- /dev/null +++ b/codenet/public_test_cases/p00559/output.1.txt @@ -0,0 +1,5 @@ +-5 +-7 +-13 +-13 +-18 diff --git a/codenet/public_test_cases/p00560/input.0.txt b/codenet/public_test_cases/p00560/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7076c0efc09144519de650e264ac9d8e5f996347 --- /dev/null +++ b/codenet/public_test_cases/p00560/input.0.txt @@ -0,0 +1,6 @@ +10 3 5 +10 3 5 +30 +1 +6 +10 diff --git a/codenet/public_test_cases/p00560/input.1.txt b/codenet/public_test_cases/p00560/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7076c0efc09144519de650e264ac9d8e5f996347 --- /dev/null +++ b/codenet/public_test_cases/p00560/input.1.txt @@ -0,0 +1,6 @@ +10 3 5 +10 3 5 +30 +1 +6 +10 diff --git a/codenet/public_test_cases/p00560/output.0.txt b/codenet/public_test_cases/p00560/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00560/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00560/output.1.txt b/codenet/public_test_cases/p00560/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00560/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00561/input.0.txt b/codenet/public_test_cases/p00561/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4036888b8138dc56325584e5b49853cd07e758fb --- /dev/null +++ b/codenet/public_test_cases/p00561/input.0.txt @@ -0,0 +1,5 @@ +4 4 +1 12 6 11 +11 10 2 14 +10 1 9 20 +4 17 19 10 diff --git a/codenet/public_test_cases/p00561/input.1.txt b/codenet/public_test_cases/p00561/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4036888b8138dc56325584e5b49853cd07e758fb --- /dev/null +++ b/codenet/public_test_cases/p00561/input.1.txt @@ -0,0 +1,5 @@ +4 4 +1 12 6 11 +11 10 2 14 +10 1 9 20 +4 17 19 10 diff --git a/codenet/public_test_cases/p00561/output.0.txt b/codenet/public_test_cases/p00561/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00561/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00561/output.1.txt b/codenet/public_test_cases/p00561/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00561/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00562/input.0.txt b/codenet/public_test_cases/p00562/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ee2e21e945c8e0513ee60dec8df03194213fd19 --- /dev/null +++ b/codenet/public_test_cases/p00562/input.0.txt @@ -0,0 +1,6 @@ +6 5 +1 3 6 +3 +1 1 +0 4 +6 5 diff --git a/codenet/public_test_cases/p00562/input.1.txt b/codenet/public_test_cases/p00562/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ee2e21e945c8e0513ee60dec8df03194213fd19 --- /dev/null +++ b/codenet/public_test_cases/p00562/input.1.txt @@ -0,0 +1,6 @@ +6 5 +1 3 6 +3 +1 1 +0 4 +6 5 diff --git a/codenet/public_test_cases/p00562/output.0.txt b/codenet/public_test_cases/p00562/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p00562/output.0.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p00562/output.1.txt b/codenet/public_test_cases/p00562/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p00562/output.1.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p00563/input.0.txt b/codenet/public_test_cases/p00563/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f32853dfe91f1f5fa230cc09055a815c07660bfd --- /dev/null +++ b/codenet/public_test_cases/p00563/input.0.txt @@ -0,0 +1,2 @@ +5 3 +1 2 3 3 2 diff --git a/codenet/public_test_cases/p00563/input.1.txt b/codenet/public_test_cases/p00563/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f32853dfe91f1f5fa230cc09055a815c07660bfd --- /dev/null +++ b/codenet/public_test_cases/p00563/input.1.txt @@ -0,0 +1,2 @@ +5 3 +1 2 3 3 2 diff --git a/codenet/public_test_cases/p00563/output.0.txt b/codenet/public_test_cases/p00563/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe234be093e7ad8424af41b8a2162a42d19b3e9 --- /dev/null +++ b/codenet/public_test_cases/p00563/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +1 diff --git a/codenet/public_test_cases/p00563/output.1.txt b/codenet/public_test_cases/p00563/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe234be093e7ad8424af41b8a2162a42d19b3e9 --- /dev/null +++ b/codenet/public_test_cases/p00563/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +1 diff --git a/codenet/public_test_cases/p00570/input.0.txt b/codenet/public_test_cases/p00570/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1ab6bfff653611c285e958a22ad2ac401237d81 --- /dev/null +++ b/codenet/public_test_cases/p00570/input.0.txt @@ -0,0 +1,4 @@ +3 2 +1 +3 +6 diff --git a/codenet/public_test_cases/p00570/input.1.txt b/codenet/public_test_cases/p00570/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1ab6bfff653611c285e958a22ad2ac401237d81 --- /dev/null +++ b/codenet/public_test_cases/p00570/input.1.txt @@ -0,0 +1,4 @@ +3 2 +1 +3 +6 diff --git a/codenet/public_test_cases/p00570/output.0.txt b/codenet/public_test_cases/p00570/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00570/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00570/output.1.txt b/codenet/public_test_cases/p00570/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00570/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00571/input.0.txt b/codenet/public_test_cases/p00571/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0c88407e4f651b546e40e4998b8993e9cbd72e6 --- /dev/null +++ b/codenet/public_test_cases/p00571/input.0.txt @@ -0,0 +1,4 @@ +3 +2 3 +11 2 +4 5 diff --git a/codenet/public_test_cases/p00571/input.1.txt b/codenet/public_test_cases/p00571/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0c88407e4f651b546e40e4998b8993e9cbd72e6 --- /dev/null +++ b/codenet/public_test_cases/p00571/input.1.txt @@ -0,0 +1,4 @@ +3 +2 3 +11 2 +4 5 diff --git a/codenet/public_test_cases/p00571/output.0.txt b/codenet/public_test_cases/p00571/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00571/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00571/output.1.txt b/codenet/public_test_cases/p00571/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00571/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00572/input.0.txt b/codenet/public_test_cases/p00572/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b170a8a4937aeafd407f009da5d6a5b95e93ce24 --- /dev/null +++ b/codenet/public_test_cases/p00572/input.0.txt @@ -0,0 +1,4 @@ +3 4 +RGWR +GRGG +RGWW diff --git a/codenet/public_test_cases/p00572/input.1.txt b/codenet/public_test_cases/p00572/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b170a8a4937aeafd407f009da5d6a5b95e93ce24 --- /dev/null +++ b/codenet/public_test_cases/p00572/input.1.txt @@ -0,0 +1,4 @@ +3 4 +RGWR +GRGG +RGWW diff --git a/codenet/public_test_cases/p00572/output.0.txt b/codenet/public_test_cases/p00572/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00572/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00572/output.1.txt b/codenet/public_test_cases/p00572/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00572/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00573/input.0.txt b/codenet/public_test_cases/p00573/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a125d17cc7136c84707520389a4d81c55be08347 --- /dev/null +++ b/codenet/public_test_cases/p00573/input.0.txt @@ -0,0 +1,9 @@ +6 6 +1 6 +1 4 +1 2 1 +2 3 1 +3 5 1 +2 4 3 +4 5 2 +5 6 1 diff --git a/codenet/public_test_cases/p00573/input.1.txt b/codenet/public_test_cases/p00573/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a125d17cc7136c84707520389a4d81c55be08347 --- /dev/null +++ b/codenet/public_test_cases/p00573/input.1.txt @@ -0,0 +1,9 @@ +6 6 +1 6 +1 4 +1 2 1 +2 3 1 +3 5 1 +2 4 3 +4 5 2 +5 6 1 diff --git a/codenet/public_test_cases/p00573/output.0.txt b/codenet/public_test_cases/p00573/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00573/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00573/output.1.txt b/codenet/public_test_cases/p00573/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00573/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00574/input.0.txt b/codenet/public_test_cases/p00574/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c85fec7fdfff9141d14299f42db66fcea04d2e5c --- /dev/null +++ b/codenet/public_test_cases/p00574/input.0.txt @@ -0,0 +1,7 @@ +3 5 +12345678 +000 +0?? +1?0 +?11 +??? diff --git a/codenet/public_test_cases/p00574/input.1.txt b/codenet/public_test_cases/p00574/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c85fec7fdfff9141d14299f42db66fcea04d2e5c --- /dev/null +++ b/codenet/public_test_cases/p00574/input.1.txt @@ -0,0 +1,7 @@ +3 5 +12345678 +000 +0?? +1?0 +?11 +??? diff --git a/codenet/public_test_cases/p00574/output.0.txt b/codenet/public_test_cases/p00574/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..063abfae940687242c42c3a2e7240d6e1c3141bb --- /dev/null +++ b/codenet/public_test_cases/p00574/output.0.txt @@ -0,0 +1,5 @@ +1 +10 +12 +12 +36 diff --git a/codenet/public_test_cases/p00574/output.1.txt b/codenet/public_test_cases/p00574/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..063abfae940687242c42c3a2e7240d6e1c3141bb --- /dev/null +++ b/codenet/public_test_cases/p00574/output.1.txt @@ -0,0 +1,5 @@ +1 +10 +12 +12 +36 diff --git a/codenet/public_test_cases/p00575/input.0.txt b/codenet/public_test_cases/p00575/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dc7162cac5c76af676526ec0f3351fa370e810a --- /dev/null +++ b/codenet/public_test_cases/p00575/input.0.txt @@ -0,0 +1 @@ +3 0 10 diff --git a/codenet/public_test_cases/p00575/input.1.txt b/codenet/public_test_cases/p00575/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dc7162cac5c76af676526ec0f3351fa370e810a --- /dev/null +++ b/codenet/public_test_cases/p00575/input.1.txt @@ -0,0 +1 @@ +3 0 10 diff --git a/codenet/public_test_cases/p00575/output.0.txt b/codenet/public_test_cases/p00575/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00575/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00575/output.1.txt b/codenet/public_test_cases/p00575/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00575/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00576/input.0.txt b/codenet/public_test_cases/p00576/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc9fd83ec867bdbcc8400df8be8c9568d08efb5f --- /dev/null +++ b/codenet/public_test_cases/p00576/input.0.txt @@ -0,0 +1,4 @@ +3 +2 3 6 +2 +1 3 diff --git a/codenet/public_test_cases/p00576/output.0.txt b/codenet/public_test_cases/p00576/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ad209730d8bd13f1901a6faa451aa75bf873ce1 --- /dev/null +++ b/codenet/public_test_cases/p00576/output.0.txt @@ -0,0 +1,3 @@ +2 +3 +7 diff --git a/codenet/public_test_cases/p00577/input.0.txt b/codenet/public_test_cases/p00577/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..16c93869a5ebf8c35c86e0933dc612f2e7579c06 --- /dev/null +++ b/codenet/public_test_cases/p00577/input.0.txt @@ -0,0 +1,2 @@ +5 +OXXOX diff --git a/codenet/public_test_cases/p00577/output.0.txt b/codenet/public_test_cases/p00577/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00577/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00578/input.0.txt b/codenet/public_test_cases/p00578/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e09da6c87aaea15145196f40f1195d067e0d01a --- /dev/null +++ b/codenet/public_test_cases/p00578/input.0.txt @@ -0,0 +1,2 @@ +6 +0 1 2 1 3 2 diff --git a/codenet/public_test_cases/p00578/output.0.txt b/codenet/public_test_cases/p00578/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00578/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00579/input.0.txt b/codenet/public_test_cases/p00579/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..927ea472d5ef31f68dda90c0670c6b3666a30d18 --- /dev/null +++ b/codenet/public_test_cases/p00579/input.0.txt @@ -0,0 +1,3 @@ +4 1 +1 2 3 8 +2 4 diff --git a/codenet/public_test_cases/p00579/output.0.txt b/codenet/public_test_cases/p00579/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p00579/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p00580/input.0.txt b/codenet/public_test_cases/p00580/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1833f640710780b7cd87e6639d7ff8925c201dc7 --- /dev/null +++ b/codenet/public_test_cases/p00580/input.0.txt @@ -0,0 +1,2 @@ +4 +2 1 1 1 diff --git a/codenet/public_test_cases/p00580/output.0.txt b/codenet/public_test_cases/p00580/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00580/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00581/input.0.txt b/codenet/public_test_cases/p00581/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11a8bdd1385c0a5be5221c935fb23beef18d45b9 --- /dev/null +++ b/codenet/public_test_cases/p00581/input.0.txt @@ -0,0 +1,4 @@ +3 4 +JOIJ +JIOO +IIII diff --git a/codenet/public_test_cases/p00581/output.0.txt b/codenet/public_test_cases/p00581/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00581/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00582/input.0.txt b/codenet/public_test_cases/p00582/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4a661dbd6b846cda3fbf1ac7bff32f46b4c53da --- /dev/null +++ b/codenet/public_test_cases/p00582/input.0.txt @@ -0,0 +1,8 @@ +3 4 +10 20 +5 1 +3 5 +4 +6 +10 +4 diff --git a/codenet/public_test_cases/p00582/output.0.txt b/codenet/public_test_cases/p00582/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00582/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00583/input.0.txt b/codenet/public_test_cases/p00583/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..482405e44fd0d723a0608b691a5d8be15c23d2fa --- /dev/null +++ b/codenet/public_test_cases/p00583/input.0.txt @@ -0,0 +1,2 @@ +5 +RRGYY diff --git a/codenet/public_test_cases/p00583/output.0.txt b/codenet/public_test_cases/p00583/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00583/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00584/input.0.txt b/codenet/public_test_cases/p00584/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..520a80a2c8665e1163da9d87880f263a59fb50c5 --- /dev/null +++ b/codenet/public_test_cases/p00584/input.0.txt @@ -0,0 +1,7 @@ +3 +0 0 +0 4 +4 0 +2 1 +2 5 +-1 1 diff --git a/codenet/public_test_cases/p00584/output.0.txt b/codenet/public_test_cases/p00584/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p00584/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p00585/input.0.txt b/codenet/public_test_cases/p00585/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b3b26e01511186c18a8ba9931de9886875203ef --- /dev/null +++ b/codenet/public_test_cases/p00585/input.0.txt @@ -0,0 +1,6 @@ +5 4 +1 2 +2 3 +3 4 +3 5 +1 2 1 2 4 diff --git a/codenet/public_test_cases/p00585/output.0.txt b/codenet/public_test_cases/p00585/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..172e9e5af990512baa8caa175709c2568210ce2d --- /dev/null +++ b/codenet/public_test_cases/p00585/output.0.txt @@ -0,0 +1,5 @@ +2 +0 +1 +1 +1 diff --git a/codenet/public_test_cases/p00586/input.0.txt b/codenet/public_test_cases/p00586/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d022e9fa555b1dafd52487c855fc24b810e216dc --- /dev/null +++ b/codenet/public_test_cases/p00586/input.0.txt @@ -0,0 +1,3 @@ +1 2 +10 5 +100 20 diff --git a/codenet/public_test_cases/p00586/input.1.txt b/codenet/public_test_cases/p00586/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d022e9fa555b1dafd52487c855fc24b810e216dc --- /dev/null +++ b/codenet/public_test_cases/p00586/input.1.txt @@ -0,0 +1,3 @@ +1 2 +10 5 +100 20 diff --git a/codenet/public_test_cases/p00586/output.0.txt b/codenet/public_test_cases/p00586/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..869cdc76f26b4b20cac4f4632f8085a55d43f359 --- /dev/null +++ b/codenet/public_test_cases/p00586/output.0.txt @@ -0,0 +1,3 @@ +3 +15 +120 diff --git a/codenet/public_test_cases/p00586/output.1.txt b/codenet/public_test_cases/p00586/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..869cdc76f26b4b20cac4f4632f8085a55d43f359 --- /dev/null +++ b/codenet/public_test_cases/p00586/output.1.txt @@ -0,0 +1,3 @@ +3 +15 +120 diff --git a/codenet/public_test_cases/p00587/input.0.txt b/codenet/public_test_cases/p00587/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c521813f5072540310cbcdc7ffe46d7dce8e3ad6 --- /dev/null +++ b/codenet/public_test_cases/p00587/input.0.txt @@ -0,0 +1,2 @@ +i ((,),(,)) ((,(,)),) +u ((,),(,)) ((,(,)),) diff --git a/codenet/public_test_cases/p00587/input.1.txt b/codenet/public_test_cases/p00587/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c521813f5072540310cbcdc7ffe46d7dce8e3ad6 --- /dev/null +++ b/codenet/public_test_cases/p00587/input.1.txt @@ -0,0 +1,2 @@ +i ((,),(,)) ((,(,)),) +u ((,),(,)) ((,(,)),) diff --git a/codenet/public_test_cases/p00587/output.0.txt b/codenet/public_test_cases/p00587/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..04d210dc5f5622fc9d0761374fb1dbf9f97e6929 --- /dev/null +++ b/codenet/public_test_cases/p00587/output.0.txt @@ -0,0 +1,2 @@ +((,),) +((,(,)),(,)) diff --git a/codenet/public_test_cases/p00587/output.1.txt b/codenet/public_test_cases/p00587/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..04d210dc5f5622fc9d0761374fb1dbf9f97e6929 --- /dev/null +++ b/codenet/public_test_cases/p00587/output.1.txt @@ -0,0 +1,2 @@ +((,),) +((,(,)),(,)) diff --git a/codenet/public_test_cases/p00588/input.0.txt b/codenet/public_test_cases/p00588/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3b06b2fedb58d62a2058f1dbeb678e2aec428f4 --- /dev/null +++ b/codenet/public_test_cases/p00588/input.0.txt @@ -0,0 +1,5 @@ +2 +2 +YNNNNYYY +4 +NYNNYYNNNYNYYNNN diff --git a/codenet/public_test_cases/p00588/input.1.txt b/codenet/public_test_cases/p00588/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3b06b2fedb58d62a2058f1dbeb678e2aec428f4 --- /dev/null +++ b/codenet/public_test_cases/p00588/input.1.txt @@ -0,0 +1,5 @@ +2 +2 +YNNNNYYY +4 +NYNNYYNNNYNYYNNN diff --git a/codenet/public_test_cases/p00588/output.0.txt b/codenet/public_test_cases/p00588/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..95b562c8e68036d3eeda8bd9f59123609db2498b --- /dev/null +++ b/codenet/public_test_cases/p00588/output.0.txt @@ -0,0 +1,2 @@ +6 +9 diff --git a/codenet/public_test_cases/p00588/output.1.txt b/codenet/public_test_cases/p00588/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..95b562c8e68036d3eeda8bd9f59123609db2498b --- /dev/null +++ b/codenet/public_test_cases/p00588/output.1.txt @@ -0,0 +1,2 @@ +6 +9 diff --git a/codenet/public_test_cases/p00589/input.0.txt b/codenet/public_test_cases/p00589/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..978dcffe29d2e288c0507021915852eecd36ccef --- /dev/null +++ b/codenet/public_test_cases/p00589/input.0.txt @@ -0,0 +1,3 @@ +666660666 +44444416003334446633111 +20202202000333003330333 diff --git a/codenet/public_test_cases/p00589/input.1.txt b/codenet/public_test_cases/p00589/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..978dcffe29d2e288c0507021915852eecd36ccef --- /dev/null +++ b/codenet/public_test_cases/p00589/input.1.txt @@ -0,0 +1,3 @@ +666660666 +44444416003334446633111 +20202202000333003330333 diff --git a/codenet/public_test_cases/p00589/output.0.txt b/codenet/public_test_cases/p00589/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13822b71aeca532c3ebba13a4528899f94a34e29 --- /dev/null +++ b/codenet/public_test_cases/p00589/output.0.txt @@ -0,0 +1,3 @@ +No +I'm fine. +aaba f ff diff --git a/codenet/public_test_cases/p00589/output.1.txt b/codenet/public_test_cases/p00589/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..13822b71aeca532c3ebba13a4528899f94a34e29 --- /dev/null +++ b/codenet/public_test_cases/p00589/output.1.txt @@ -0,0 +1,3 @@ +No +I'm fine. +aaba f ff diff --git a/codenet/public_test_cases/p00590/input.0.txt b/codenet/public_test_cases/p00590/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c9031f0eed53ddd309cb8eb73e54e1037efa5e6 --- /dev/null +++ b/codenet/public_test_cases/p00590/input.0.txt @@ -0,0 +1,4 @@ +1 +4 +7 +51 diff --git a/codenet/public_test_cases/p00590/input.1.txt b/codenet/public_test_cases/p00590/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c9031f0eed53ddd309cb8eb73e54e1037efa5e6 --- /dev/null +++ b/codenet/public_test_cases/p00590/input.1.txt @@ -0,0 +1,4 @@ +1 +4 +7 +51 diff --git a/codenet/public_test_cases/p00590/output.0.txt b/codenet/public_test_cases/p00590/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e70222671300830ca2818cc44bf6a4e7f189f3b4 --- /dev/null +++ b/codenet/public_test_cases/p00590/output.0.txt @@ -0,0 +1,4 @@ +0 +2 +2 +6 diff --git a/codenet/public_test_cases/p00590/output.1.txt b/codenet/public_test_cases/p00590/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e70222671300830ca2818cc44bf6a4e7f189f3b4 --- /dev/null +++ b/codenet/public_test_cases/p00590/output.1.txt @@ -0,0 +1,4 @@ +0 +2 +2 +6 diff --git a/codenet/public_test_cases/p00591/input.0.txt b/codenet/public_test_cases/p00591/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fee40df601f9d433e8f7662c28dc999ef73db2d --- /dev/null +++ b/codenet/public_test_cases/p00591/input.0.txt @@ -0,0 +1,9 @@ +3 +1 2 3 +4 5 6 +7 8 9 +3 +1 2 3 +7 8 9 +4 5 6 +0 diff --git a/codenet/public_test_cases/p00591/input.1.txt b/codenet/public_test_cases/p00591/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fee40df601f9d433e8f7662c28dc999ef73db2d --- /dev/null +++ b/codenet/public_test_cases/p00591/input.1.txt @@ -0,0 +1,9 @@ +3 +1 2 3 +4 5 6 +7 8 9 +3 +1 2 3 +7 8 9 +4 5 6 +0 diff --git a/codenet/public_test_cases/p00591/output.0.txt b/codenet/public_test_cases/p00591/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..49019db807899bc5793047943ce0fbb1a09b2e14 --- /dev/null +++ b/codenet/public_test_cases/p00591/output.0.txt @@ -0,0 +1,2 @@ +7 +7 diff --git a/codenet/public_test_cases/p00591/output.1.txt b/codenet/public_test_cases/p00591/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..49019db807899bc5793047943ce0fbb1a09b2e14 --- /dev/null +++ b/codenet/public_test_cases/p00591/output.1.txt @@ -0,0 +1,2 @@ +7 +7 diff --git a/codenet/public_test_cases/p00592/input.0.txt b/codenet/public_test_cases/p00592/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6f6be2a184e64cea411539cfe120ea6612ea0b0 --- /dev/null +++ b/codenet/public_test_cases/p00592/input.0.txt @@ -0,0 +1,11 @@ +1 2100 2400 +1 +2130 2200 +3 2100 2400 +3 +2100 2130 2200 2230 2300 2330 +2 +2130 2200 2330 2400 +2 +2100 2130 2330 2400 +0 0 0 diff --git a/codenet/public_test_cases/p00592/output.0.txt b/codenet/public_test_cases/p00592/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61028f20a901caca427f962e621bcbaa8aac7ca7 --- /dev/null +++ b/codenet/public_test_cases/p00592/output.0.txt @@ -0,0 +1,2 @@ +120 +180 diff --git a/codenet/public_test_cases/p00593/input.0.txt b/codenet/public_test_cases/p00593/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b22b448c0fd52cae4d6fa4e8f396e5dfb83734ef --- /dev/null +++ b/codenet/public_test_cases/p00593/input.0.txt @@ -0,0 +1,3 @@ +3 +4 +0 diff --git a/codenet/public_test_cases/p00593/input.1.txt b/codenet/public_test_cases/p00593/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b22b448c0fd52cae4d6fa4e8f396e5dfb83734ef --- /dev/null +++ b/codenet/public_test_cases/p00593/input.1.txt @@ -0,0 +1,3 @@ +3 +4 +0 diff --git a/codenet/public_test_cases/p00593/output.0.txt b/codenet/public_test_cases/p00593/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3261af2562932014b6da604cc0c4a4c6db9a7c86 --- /dev/null +++ b/codenet/public_test_cases/p00593/output.0.txt @@ -0,0 +1,9 @@ +Case 1: + 1 2 6 + 3 5 7 + 4 8 9 +Case 2: + 1 2 6 7 + 3 5 8 13 + 4 9 12 14 + 10 11 15 16 diff --git a/codenet/public_test_cases/p00593/output.1.txt b/codenet/public_test_cases/p00593/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3261af2562932014b6da604cc0c4a4c6db9a7c86 --- /dev/null +++ b/codenet/public_test_cases/p00593/output.1.txt @@ -0,0 +1,9 @@ +Case 1: + 1 2 6 + 3 5 7 + 4 8 9 +Case 2: + 1 2 6 7 + 3 5 8 13 + 4 9 12 14 + 10 11 15 16 diff --git a/codenet/public_test_cases/p00594/input.0.txt b/codenet/public_test_cases/p00594/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5891461e490003468881e17f8d6fb3efb4919ae --- /dev/null +++ b/codenet/public_test_cases/p00594/input.0.txt @@ -0,0 +1,5 @@ +8 +3 1 2 3 3 1 5 3 +7 +5 2 5 3 4 5 5 +0 diff --git a/codenet/public_test_cases/p00594/input.1.txt b/codenet/public_test_cases/p00594/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5891461e490003468881e17f8d6fb3efb4919ae --- /dev/null +++ b/codenet/public_test_cases/p00594/input.1.txt @@ -0,0 +1,5 @@ +8 +3 1 2 3 3 1 5 3 +7 +5 2 5 3 4 5 5 +0 diff --git a/codenet/public_test_cases/p00594/output.0.txt b/codenet/public_test_cases/p00594/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2da56d7585101124db56de16602463892e75ac67 --- /dev/null +++ b/codenet/public_test_cases/p00594/output.0.txt @@ -0,0 +1,2 @@ +NO COLOR +5 diff --git a/codenet/public_test_cases/p00594/output.1.txt b/codenet/public_test_cases/p00594/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2da56d7585101124db56de16602463892e75ac67 --- /dev/null +++ b/codenet/public_test_cases/p00594/output.1.txt @@ -0,0 +1,2 @@ +NO COLOR +5 diff --git a/codenet/public_test_cases/p00595/input.0.txt b/codenet/public_test_cases/p00595/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33f2111cbb6a8fda044c8c79881f2e9317bb3246 --- /dev/null +++ b/codenet/public_test_cases/p00595/input.0.txt @@ -0,0 +1,2 @@ +57 38 +60 84 diff --git a/codenet/public_test_cases/p00595/input.1.txt b/codenet/public_test_cases/p00595/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..33f2111cbb6a8fda044c8c79881f2e9317bb3246 --- /dev/null +++ b/codenet/public_test_cases/p00595/input.1.txt @@ -0,0 +1,2 @@ +57 38 +60 84 diff --git a/codenet/public_test_cases/p00595/output.0.txt b/codenet/public_test_cases/p00595/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..984cd0d19792527129ce124763ca2972c3811a1c --- /dev/null +++ b/codenet/public_test_cases/p00595/output.0.txt @@ -0,0 +1,2 @@ +19 +12 diff --git a/codenet/public_test_cases/p00595/output.1.txt b/codenet/public_test_cases/p00595/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..984cd0d19792527129ce124763ca2972c3811a1c --- /dev/null +++ b/codenet/public_test_cases/p00595/output.1.txt @@ -0,0 +1,2 @@ +19 +12 diff --git a/codenet/public_test_cases/p00596/input.0.txt b/codenet/public_test_cases/p00596/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7cd4223e19822520197849b421c8a5d79f0a471 --- /dev/null +++ b/codenet/public_test_cases/p00596/input.0.txt @@ -0,0 +1,4 @@ +6 +13 23 14 24 15 25 +10 +00 01 11 02 12 22 03 13 23 33 diff --git a/codenet/public_test_cases/p00596/input.1.txt b/codenet/public_test_cases/p00596/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7cd4223e19822520197849b421c8a5d79f0a471 --- /dev/null +++ b/codenet/public_test_cases/p00596/input.1.txt @@ -0,0 +1,4 @@ +6 +13 23 14 24 15 25 +10 +00 01 11 02 12 22 03 13 23 33 diff --git a/codenet/public_test_cases/p00596/output.0.txt b/codenet/public_test_cases/p00596/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p00596/output.0.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p00596/output.1.txt b/codenet/public_test_cases/p00596/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p00596/output.1.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p00597/input.0.txt b/codenet/public_test_cases/p00597/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f1b638ff5484e6eb4dd0128d8e70e75b0946e98 --- /dev/null +++ b/codenet/public_test_cases/p00597/input.0.txt @@ -0,0 +1,2 @@ +1 +4 diff --git a/codenet/public_test_cases/p00597/input.1.txt b/codenet/public_test_cases/p00597/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f1b638ff5484e6eb4dd0128d8e70e75b0946e98 --- /dev/null +++ b/codenet/public_test_cases/p00597/input.1.txt @@ -0,0 +1,2 @@ +1 +4 diff --git a/codenet/public_test_cases/p00597/output.0.txt b/codenet/public_test_cases/p00597/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19be0583652c18cc7ec81f2c3f16fcea799ed9bb --- /dev/null +++ b/codenet/public_test_cases/p00597/output.0.txt @@ -0,0 +1,2 @@ +1 +8 diff --git a/codenet/public_test_cases/p00597/output.1.txt b/codenet/public_test_cases/p00597/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19be0583652c18cc7ec81f2c3f16fcea799ed9bb --- /dev/null +++ b/codenet/public_test_cases/p00597/output.1.txt @@ -0,0 +1,2 @@ +1 +8 diff --git a/codenet/public_test_cases/p00598/input.0.txt b/codenet/public_test_cases/p00598/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b233dac9fd7a94d3e631543d70a18b40f0198504 --- /dev/null +++ b/codenet/public_test_cases/p00598/input.0.txt @@ -0,0 +1,16 @@ +A 3 +1 3 -1 +B 4 +3 1 5 7 +D 1 +5 +R 0 +cAiBdD +C 3 +1 2 3 +A 4 +2 10 8 3 +B 3 +2 4 8 +R 0 +(As(AiB))uC diff --git a/codenet/public_test_cases/p00598/input.1.txt b/codenet/public_test_cases/p00598/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b233dac9fd7a94d3e631543d70a18b40f0198504 --- /dev/null +++ b/codenet/public_test_cases/p00598/input.1.txt @@ -0,0 +1,16 @@ +A 3 +1 3 -1 +B 4 +3 1 5 7 +D 1 +5 +R 0 +cAiBdD +C 3 +1 2 3 +A 4 +2 10 8 3 +B 3 +2 4 8 +R 0 +(As(AiB))uC diff --git a/codenet/public_test_cases/p00598/output.0.txt b/codenet/public_test_cases/p00598/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d915ef00aad544073f59a8dfb38f2d9c6b9b5726 --- /dev/null +++ b/codenet/public_test_cases/p00598/output.0.txt @@ -0,0 +1,2 @@ +7 +1 2 3 10 diff --git a/codenet/public_test_cases/p00598/output.1.txt b/codenet/public_test_cases/p00598/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d915ef00aad544073f59a8dfb38f2d9c6b9b5726 --- /dev/null +++ b/codenet/public_test_cases/p00598/output.1.txt @@ -0,0 +1,2 @@ +7 +1 2 3 10 diff --git a/codenet/public_test_cases/p00599/input.0.txt b/codenet/public_test_cases/p00599/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f3fdaf616b8b4141814f93e83cb97491573e270 --- /dev/null +++ b/codenet/public_test_cases/p00599/input.0.txt @@ -0,0 +1,9 @@ +4 +-5.000000 0.000000 +5.000000 0.000000 +9.635255 14.265848 +-0.364745 14.265848 +3 +-1.000000 0.000000 +0.000000 0.000000 +0.000000 1.000000 diff --git a/codenet/public_test_cases/p00599/input.1.txt b/codenet/public_test_cases/p00599/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f3fdaf616b8b4141814f93e83cb97491573e270 --- /dev/null +++ b/codenet/public_test_cases/p00599/input.1.txt @@ -0,0 +1,9 @@ +4 +-5.000000 0.000000 +5.000000 0.000000 +9.635255 14.265848 +-0.364745 14.265848 +3 +-1.000000 0.000000 +0.000000 0.000000 +0.000000 1.000000 diff --git a/codenet/public_test_cases/p00599/output.0.txt b/codenet/public_test_cases/p00599/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c409d1d73f8da9a3db78db252bc32d9847d84219 --- /dev/null +++ b/codenet/public_test_cases/p00599/output.0.txt @@ -0,0 +1,2 @@ +0 150 +-1 -1 diff --git a/codenet/public_test_cases/p00599/output.1.txt b/codenet/public_test_cases/p00599/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c409d1d73f8da9a3db78db252bc32d9847d84219 --- /dev/null +++ b/codenet/public_test_cases/p00599/output.1.txt @@ -0,0 +1,2 @@ +0 150 +-1 -1 diff --git a/codenet/public_test_cases/p00600/input.0.txt b/codenet/public_test_cases/p00600/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75548d7ef9335237f14d54b0c8cd1cb70a8c98f8 --- /dev/null +++ b/codenet/public_test_cases/p00600/input.0.txt @@ -0,0 +1,9 @@ +3 5 +12 8 25 19 23 +9 13 16 0 17 +20 14 16 10 22 +17 27 18 16 +9 7 0 +19 5 +21 +0 0 diff --git a/codenet/public_test_cases/p00600/input.1.txt b/codenet/public_test_cases/p00600/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75548d7ef9335237f14d54b0c8cd1cb70a8c98f8 --- /dev/null +++ b/codenet/public_test_cases/p00600/input.1.txt @@ -0,0 +1,9 @@ +3 5 +12 8 25 19 23 +9 13 16 0 17 +20 14 16 10 22 +17 27 18 16 +9 7 0 +19 5 +21 +0 0 diff --git a/codenet/public_test_cases/p00600/output.0.txt b/codenet/public_test_cases/p00600/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e522732c77ec94723e739d22f28df549b0231f5f --- /dev/null +++ b/codenet/public_test_cases/p00600/output.0.txt @@ -0,0 +1 @@ +38 diff --git a/codenet/public_test_cases/p00600/output.1.txt b/codenet/public_test_cases/p00600/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e522732c77ec94723e739d22f28df549b0231f5f --- /dev/null +++ b/codenet/public_test_cases/p00600/output.1.txt @@ -0,0 +1 @@ +38 diff --git a/codenet/public_test_cases/p00601/input.0.txt b/codenet/public_test_cases/p00601/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..95e8bcb0de9821b08cc5d764ce8796446b11d518 --- /dev/null +++ b/codenet/public_test_cases/p00601/input.0.txt @@ -0,0 +1,11 @@ +5 4 +0 1 +0 4 +1 2 +3 4 +5 4 +0 1 +0 4 +1 2 +3 4 +0 0 diff --git a/codenet/public_test_cases/p00601/input.1.txt b/codenet/public_test_cases/p00601/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..95e8bcb0de9821b08cc5d764ce8796446b11d518 --- /dev/null +++ b/codenet/public_test_cases/p00601/input.1.txt @@ -0,0 +1,11 @@ +5 4 +0 1 +0 4 +1 2 +3 4 +5 4 +0 1 +0 4 +1 2 +3 4 +0 0 diff --git a/codenet/public_test_cases/p00601/output.0.txt b/codenet/public_test_cases/p00601/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..51993f072d5832f20b98b6bd0cf763fb8b4c8a1b --- /dev/null +++ b/codenet/public_test_cases/p00601/output.0.txt @@ -0,0 +1,2 @@ +2 +2 diff --git a/codenet/public_test_cases/p00601/output.1.txt b/codenet/public_test_cases/p00601/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51993f072d5832f20b98b6bd0cf763fb8b4c8a1b --- /dev/null +++ b/codenet/public_test_cases/p00601/output.1.txt @@ -0,0 +1,2 @@ +2 +2 diff --git a/codenet/public_test_cases/p00602/input.0.txt b/codenet/public_test_cases/p00602/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f1547dcc81f3416ecd289f1838fdfb444aca8bc --- /dev/null +++ b/codenet/public_test_cases/p00602/input.0.txt @@ -0,0 +1,3 @@ +5 5 +50 1 +13 13 diff --git a/codenet/public_test_cases/p00602/input.1.txt b/codenet/public_test_cases/p00602/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f1547dcc81f3416ecd289f1838fdfb444aca8bc --- /dev/null +++ b/codenet/public_test_cases/p00602/input.1.txt @@ -0,0 +1,3 @@ +5 5 +50 1 +13 13 diff --git a/codenet/public_test_cases/p00602/output.0.txt b/codenet/public_test_cases/p00602/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aff61af3fabe95adb897de590ee28366a01fab5f --- /dev/null +++ b/codenet/public_test_cases/p00602/output.0.txt @@ -0,0 +1,3 @@ +2 +50 +8 diff --git a/codenet/public_test_cases/p00602/output.1.txt b/codenet/public_test_cases/p00602/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aff61af3fabe95adb897de590ee28366a01fab5f --- /dev/null +++ b/codenet/public_test_cases/p00602/output.1.txt @@ -0,0 +1,3 @@ +2 +50 +8 diff --git a/codenet/public_test_cases/p00603/input.0.txt b/codenet/public_test_cases/p00603/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..981bf9094eb63c2258516407f934a5e1e81b423e --- /dev/null +++ b/codenet/public_test_cases/p00603/input.0.txt @@ -0,0 +1,4 @@ +9 1 +3 +9 4 +1 2 3 4 diff --git a/codenet/public_test_cases/p00603/input.1.txt b/codenet/public_test_cases/p00603/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..981bf9094eb63c2258516407f934a5e1e81b423e --- /dev/null +++ b/codenet/public_test_cases/p00603/input.1.txt @@ -0,0 +1,4 @@ +9 1 +3 +9 4 +1 2 3 4 diff --git a/codenet/public_test_cases/p00603/output.0.txt b/codenet/public_test_cases/p00603/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p00603/output.0.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p00603/output.1.txt b/codenet/public_test_cases/p00603/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p00603/output.1.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p00604/input.0.txt b/codenet/public_test_cases/p00604/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c254e5418f9b6b5bfc349dbf7248a5d10a856a49 --- /dev/null +++ b/codenet/public_test_cases/p00604/input.0.txt @@ -0,0 +1,4 @@ +3 +10 20 30 +7 +56 26 62 43 25 80 7 diff --git a/codenet/public_test_cases/p00604/input.1.txt b/codenet/public_test_cases/p00604/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c254e5418f9b6b5bfc349dbf7248a5d10a856a49 --- /dev/null +++ b/codenet/public_test_cases/p00604/input.1.txt @@ -0,0 +1,4 @@ +3 +10 20 30 +7 +56 26 62 43 25 80 7 diff --git a/codenet/public_test_cases/p00604/output.0.txt b/codenet/public_test_cases/p00604/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f898f47213f3691c98a9942ade55710236e573b --- /dev/null +++ b/codenet/public_test_cases/p00604/output.0.txt @@ -0,0 +1,2 @@ +100 +873 diff --git a/codenet/public_test_cases/p00604/output.1.txt b/codenet/public_test_cases/p00604/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f898f47213f3691c98a9942ade55710236e573b --- /dev/null +++ b/codenet/public_test_cases/p00604/output.1.txt @@ -0,0 +1,2 @@ +100 +873 diff --git a/codenet/public_test_cases/p00605/input.0.txt b/codenet/public_test_cases/p00605/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573ec4a77bd064f8d99d580155203371e1f530cb --- /dev/null +++ b/codenet/public_test_cases/p00605/input.0.txt @@ -0,0 +1,10 @@ +2 3 +5 4 5 +1 2 3 +3 2 1 +3 5 +1 2 3 4 5 +0 1 0 1 2 +0 1 1 2 2 +1 0 3 1 1 +0 0 diff --git a/codenet/public_test_cases/p00605/input.1.txt b/codenet/public_test_cases/p00605/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573ec4a77bd064f8d99d580155203371e1f530cb --- /dev/null +++ b/codenet/public_test_cases/p00605/input.1.txt @@ -0,0 +1,10 @@ +2 3 +5 4 5 +1 2 3 +3 2 1 +3 5 +1 2 3 4 5 +0 1 0 1 2 +0 1 1 2 2 +1 0 3 1 1 +0 0 diff --git a/codenet/public_test_cases/p00605/output.0.txt b/codenet/public_test_cases/p00605/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p00605/output.0.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p00605/output.1.txt b/codenet/public_test_cases/p00605/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p00605/output.1.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p00606/input.0.txt b/codenet/public_test_cases/p00606/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..046cc8be65fddd1c9ada6f35b5a89e0ee65bc4eb --- /dev/null +++ b/codenet/public_test_cases/p00606/input.0.txt @@ -0,0 +1,7 @@ +1 +E A C +1 +E B C +2 +E A B +0 diff --git a/codenet/public_test_cases/p00606/input.1.txt b/codenet/public_test_cases/p00606/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..046cc8be65fddd1c9ada6f35b5a89e0ee65bc4eb --- /dev/null +++ b/codenet/public_test_cases/p00606/input.1.txt @@ -0,0 +1,7 @@ +1 +E A C +1 +E B C +2 +E A B +0 diff --git a/codenet/public_test_cases/p00606/output.0.txt b/codenet/public_test_cases/p00606/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..943bfa41428f38dda06f5a45c5d1ef37972cdeb2 --- /dev/null +++ b/codenet/public_test_cases/p00606/output.0.txt @@ -0,0 +1,3 @@ +0.00000000 +0.25000000 +0.06250000 diff --git a/codenet/public_test_cases/p00606/output.1.txt b/codenet/public_test_cases/p00606/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..943bfa41428f38dda06f5a45c5d1ef37972cdeb2 --- /dev/null +++ b/codenet/public_test_cases/p00606/output.1.txt @@ -0,0 +1,3 @@ +0.00000000 +0.25000000 +0.06250000 diff --git a/codenet/public_test_cases/p00607/input.0.txt b/codenet/public_test_cases/p00607/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfbd362497d42e028368e7ed302d7345715a8d6e --- /dev/null +++ b/codenet/public_test_cases/p00607/input.0.txt @@ -0,0 +1,19 @@ +hyo +ni +END_OF_TEXT +f +d +f +f +k +p +p +e +y +a +k +y +y +n +y +- diff --git a/codenet/public_test_cases/p00607/input.1.txt b/codenet/public_test_cases/p00607/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfbd362497d42e028368e7ed302d7345715a8d6e --- /dev/null +++ b/codenet/public_test_cases/p00607/input.1.txt @@ -0,0 +1,19 @@ +hyo +ni +END_OF_TEXT +f +d +f +f +k +p +p +e +y +a +k +y +y +n +y +- diff --git a/codenet/public_test_cases/p00607/output.0.txt b/codenet/public_test_cases/p00607/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5a26340c9ca67d9d79047454e1e8e1b995b5872 --- /dev/null +++ b/codenet/public_test_cases/p00607/output.0.txt @@ -0,0 +1,2 @@ +honihoni +honi diff --git a/codenet/public_test_cases/p00607/output.1.txt b/codenet/public_test_cases/p00607/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5a26340c9ca67d9d79047454e1e8e1b995b5872 --- /dev/null +++ b/codenet/public_test_cases/p00607/output.1.txt @@ -0,0 +1,2 @@ +honihoni +honi diff --git a/codenet/public_test_cases/p00608/input.0.txt b/codenet/public_test_cases/p00608/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc5d8d6fa906a6e95faa0e901f3b1b5b2b85dda1 --- /dev/null +++ b/codenet/public_test_cases/p00608/input.0.txt @@ -0,0 +1,13 @@ +5 5 +4=..2 ++#=#+ +.-2=. +=#*#= +.-.=3 +6 +7 3 1 4 / 8 +1 6 +8..3=2 +2 +2 + +0 0 diff --git a/codenet/public_test_cases/p00608/input.1.txt b/codenet/public_test_cases/p00608/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc5d8d6fa906a6e95faa0e901f3b1b5b2b85dda1 --- /dev/null +++ b/codenet/public_test_cases/p00608/input.1.txt @@ -0,0 +1,13 @@ +5 5 +4=..2 ++#=#+ +.-2=. +=#*#= +.-.=3 +6 +7 3 1 4 / 8 +1 6 +8..3=2 +2 +2 + +0 0 diff --git a/codenet/public_test_cases/p00608/output.0.txt b/codenet/public_test_cases/p00608/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p00608/output.0.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p00608/output.1.txt b/codenet/public_test_cases/p00608/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p00608/output.1.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p00609/input.0.txt b/codenet/public_test_cases/p00609/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5366a88ef526520c2aa158912ef76e91fb2d3469 --- /dev/null +++ b/codenet/public_test_cases/p00609/input.0.txt @@ -0,0 +1,6 @@ +2 2 1 +0 0 +0 4 +2 2 +2 8 +0 0 0 diff --git a/codenet/public_test_cases/p00609/input.1.txt b/codenet/public_test_cases/p00609/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5366a88ef526520c2aa158912ef76e91fb2d3469 --- /dev/null +++ b/codenet/public_test_cases/p00609/input.1.txt @@ -0,0 +1,6 @@ +2 2 1 +0 0 +0 4 +2 2 +2 8 +0 0 0 diff --git a/codenet/public_test_cases/p00609/output.0.txt b/codenet/public_test_cases/p00609/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00609/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00609/output.1.txt b/codenet/public_test_cases/p00609/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00609/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00610/input.0.txt b/codenet/public_test_cases/p00610/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1ea8b9f479dccef9b2e1fddb1aca82870d59576 --- /dev/null +++ b/codenet/public_test_cases/p00610/input.0.txt @@ -0,0 +1,4 @@ +2 1 +2 3 +6 4 +0 0 diff --git a/codenet/public_test_cases/p00610/input.1.txt b/codenet/public_test_cases/p00610/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1ea8b9f479dccef9b2e1fddb1aca82870d59576 --- /dev/null +++ b/codenet/public_test_cases/p00610/input.1.txt @@ -0,0 +1,4 @@ +2 1 +2 3 +6 4 +0 0 diff --git a/codenet/public_test_cases/p00610/output.0.txt b/codenet/public_test_cases/p00610/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28765d5a1d858c697aa89c1e0fd243e77e462079 --- /dev/null +++ b/codenet/public_test_cases/p00610/output.0.txt @@ -0,0 +1,11 @@ +.. +.. + +No + +..EEEE +..E..E +EEE..E +E..EEE +E..E.. +EEEE.. diff --git a/codenet/public_test_cases/p00610/output.1.txt b/codenet/public_test_cases/p00610/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28765d5a1d858c697aa89c1e0fd243e77e462079 --- /dev/null +++ b/codenet/public_test_cases/p00610/output.1.txt @@ -0,0 +1,11 @@ +.. +.. + +No + +..EEEE +..E..E +EEE..E +E..EEE +E..E.. +EEEE.. diff --git a/codenet/public_test_cases/p00611/input.0.txt b/codenet/public_test_cases/p00611/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e5ee8bcc40b4a3664d32cd7433575786c297447 --- /dev/null +++ b/codenet/public_test_cases/p00611/input.0.txt @@ -0,0 +1,16 @@ +3 8 +######## +#P....*# +######## +10 10 +########## +#P.......# +#..#*....# +#..#*.#.*# +#.....#*.# +#*.......# +#..##....# +#...#.P..# +#P......P# +########## +0 0 diff --git a/codenet/public_test_cases/p00611/input.1.txt b/codenet/public_test_cases/p00611/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e5ee8bcc40b4a3664d32cd7433575786c297447 --- /dev/null +++ b/codenet/public_test_cases/p00611/input.1.txt @@ -0,0 +1,16 @@ +3 8 +######## +#P....*# +######## +10 10 +########## +#P.......# +#..#*....# +#..#*.#.*# +#.....#*.# +#*.......# +#..##....# +#...#.P..# +#P......P# +########## +0 0 diff --git a/codenet/public_test_cases/p00611/output.0.txt b/codenet/public_test_cases/p00611/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3cfd618cdfc16b63d81a2bd5420c68ffe00d86c --- /dev/null +++ b/codenet/public_test_cases/p00611/output.0.txt @@ -0,0 +1,2 @@ +5 +14 diff --git a/codenet/public_test_cases/p00611/output.1.txt b/codenet/public_test_cases/p00611/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3cfd618cdfc16b63d81a2bd5420c68ffe00d86c --- /dev/null +++ b/codenet/public_test_cases/p00611/output.1.txt @@ -0,0 +1,2 @@ +5 +14 diff --git a/codenet/public_test_cases/p00612/input.0.txt b/codenet/public_test_cases/p00612/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a87bc64ccd1d71c709afc65cb7b2aee0bdc4911 --- /dev/null +++ b/codenet/public_test_cases/p00612/input.0.txt @@ -0,0 +1,3 @@ +2 +4 +0 diff --git a/codenet/public_test_cases/p00612/input.1.txt b/codenet/public_test_cases/p00612/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a87bc64ccd1d71c709afc65cb7b2aee0bdc4911 --- /dev/null +++ b/codenet/public_test_cases/p00612/input.1.txt @@ -0,0 +1,3 @@ +2 +4 +0 diff --git a/codenet/public_test_cases/p00612/output.0.txt b/codenet/public_test_cases/p00612/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..71277a2db930ed2adbaf61ae429028155ba09f78 --- /dev/null +++ b/codenet/public_test_cases/p00612/output.0.txt @@ -0,0 +1,2 @@ +24 +64 diff --git a/codenet/public_test_cases/p00612/output.1.txt b/codenet/public_test_cases/p00612/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..71277a2db930ed2adbaf61ae429028155ba09f78 --- /dev/null +++ b/codenet/public_test_cases/p00612/output.1.txt @@ -0,0 +1,2 @@ +24 +64 diff --git a/codenet/public_test_cases/p00613/input.0.txt b/codenet/public_test_cases/p00613/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d365301c1fbb912f3aa88758bd586dfd77505f79 --- /dev/null +++ b/codenet/public_test_cases/p00613/input.0.txt @@ -0,0 +1,5 @@ +2 +2 +3 +5 4 3 +0 diff --git a/codenet/public_test_cases/p00613/input.1.txt b/codenet/public_test_cases/p00613/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d365301c1fbb912f3aa88758bd586dfd77505f79 --- /dev/null +++ b/codenet/public_test_cases/p00613/input.1.txt @@ -0,0 +1,5 @@ +2 +2 +3 +5 4 3 +0 diff --git a/codenet/public_test_cases/p00613/output.0.txt b/codenet/public_test_cases/p00613/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b24e3127788ab5dd07d265a75dd56cfd6c495b8 --- /dev/null +++ b/codenet/public_test_cases/p00613/output.0.txt @@ -0,0 +1,2 @@ +2 +6 diff --git a/codenet/public_test_cases/p00613/output.1.txt b/codenet/public_test_cases/p00613/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b24e3127788ab5dd07d265a75dd56cfd6c495b8 --- /dev/null +++ b/codenet/public_test_cases/p00613/output.1.txt @@ -0,0 +1,2 @@ +2 +6 diff --git a/codenet/public_test_cases/p00614/input.0.txt b/codenet/public_test_cases/p00614/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7c5662c2df31e0ceb362ac316ca3beebb885b06 --- /dev/null +++ b/codenet/public_test_cases/p00614/input.0.txt @@ -0,0 +1,3 @@ +123 3 0 2 0 1 1 +999 9 9 9 9 9 9 +0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00614/input.1.txt b/codenet/public_test_cases/p00614/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7c5662c2df31e0ceb362ac316ca3beebb885b06 --- /dev/null +++ b/codenet/public_test_cases/p00614/input.1.txt @@ -0,0 +1,3 @@ +123 3 0 2 0 1 1 +999 9 9 9 9 9 9 +0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00614/output.0.txt b/codenet/public_test_cases/p00614/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ea2ad9b222807db88b70e3bdbf18f2407963073 --- /dev/null +++ b/codenet/public_test_cases/p00614/output.0.txt @@ -0,0 +1,2 @@ +6 +3 diff --git a/codenet/public_test_cases/p00614/output.1.txt b/codenet/public_test_cases/p00614/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ea2ad9b222807db88b70e3bdbf18f2407963073 --- /dev/null +++ b/codenet/public_test_cases/p00614/output.1.txt @@ -0,0 +1,2 @@ +6 +3 diff --git a/codenet/public_test_cases/p00615/input.0.txt b/codenet/public_test_cases/p00615/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccab94b9f0ca9e42d543b68b3721f05570e66386 --- /dev/null +++ b/codenet/public_test_cases/p00615/input.0.txt @@ -0,0 +1,12 @@ +4 5 +20 35 60 70 +15 30 40 80 90 +3 2 +10 20 30 +42 60 +0 1 +100 +1 1 +10 +50 +0 0 diff --git a/codenet/public_test_cases/p00615/input.1.txt b/codenet/public_test_cases/p00615/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccab94b9f0ca9e42d543b68b3721f05570e66386 --- /dev/null +++ b/codenet/public_test_cases/p00615/input.1.txt @@ -0,0 +1,12 @@ +4 5 +20 35 60 70 +15 30 40 80 90 +3 2 +10 20 30 +42 60 +0 1 +100 +1 1 +10 +50 +0 0 diff --git a/codenet/public_test_cases/p00615/output.0.txt b/codenet/public_test_cases/p00615/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb3a218650d32098b4787a4a677aa8bfb1b327b7 --- /dev/null +++ b/codenet/public_test_cases/p00615/output.0.txt @@ -0,0 +1,4 @@ +20 +18 +100 +40 diff --git a/codenet/public_test_cases/p00615/output.1.txt b/codenet/public_test_cases/p00615/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb3a218650d32098b4787a4a677aa8bfb1b327b7 --- /dev/null +++ b/codenet/public_test_cases/p00615/output.1.txt @@ -0,0 +1,4 @@ +20 +18 +100 +40 diff --git a/codenet/public_test_cases/p00616/input.0.txt b/codenet/public_test_cases/p00616/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69c4964a9af5065bde5a405f24fd91ca4dfc5396 --- /dev/null +++ b/codenet/public_test_cases/p00616/input.0.txt @@ -0,0 +1,11 @@ +4 3 +xy 4 4 +xz 1 2 +yz 2 3 +4 5 +xy 1 1 +xy 3 3 +xz 3 3 +yz 2 1 +yz 3 3 +0 0 diff --git a/codenet/public_test_cases/p00616/input.1.txt b/codenet/public_test_cases/p00616/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69c4964a9af5065bde5a405f24fd91ca4dfc5396 --- /dev/null +++ b/codenet/public_test_cases/p00616/input.1.txt @@ -0,0 +1,11 @@ +4 3 +xy 4 4 +xz 1 2 +yz 2 3 +4 5 +xy 1 1 +xy 3 3 +xz 3 3 +yz 2 1 +yz 3 3 +0 0 diff --git a/codenet/public_test_cases/p00616/output.0.txt b/codenet/public_test_cases/p00616/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31f313e2dd68308a81517d911ea5db218c776331 --- /dev/null +++ b/codenet/public_test_cases/p00616/output.0.txt @@ -0,0 +1,2 @@ +52 +46 diff --git a/codenet/public_test_cases/p00616/output.1.txt b/codenet/public_test_cases/p00616/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31f313e2dd68308a81517d911ea5db218c776331 --- /dev/null +++ b/codenet/public_test_cases/p00616/output.1.txt @@ -0,0 +1,2 @@ +52 +46 diff --git a/codenet/public_test_cases/p00617/input.0.txt b/codenet/public_test_cases/p00617/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7d20881a66dd78092e6f75d4024ec28ba22eb30 --- /dev/null +++ b/codenet/public_test_cases/p00617/input.0.txt @@ -0,0 +1,8 @@ +5 +
10,10,190,15020,20,70,14080,20,180,140
+10 10 +15 15 +40 60 +2 3 +130 80 +0 diff --git a/codenet/public_test_cases/p00617/input.1.txt b/codenet/public_test_cases/p00617/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7d20881a66dd78092e6f75d4024ec28ba22eb30 --- /dev/null +++ b/codenet/public_test_cases/p00617/input.1.txt @@ -0,0 +1,8 @@ +5 +
10,10,190,15020,20,70,14080,20,180,140
+10 10 +15 15 +40 60 +2 3 +130 80 +0 diff --git a/codenet/public_test_cases/p00617/output.0.txt b/codenet/public_test_cases/p00617/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..115825244f0fc4c398218d45763e0d5a5d29d0fd --- /dev/null +++ b/codenet/public_test_cases/p00617/output.0.txt @@ -0,0 +1,5 @@ +main 2 +main 2 +menu 0 +OUT OF MAIN PANEL 1 +primary 0 diff --git a/codenet/public_test_cases/p00617/output.1.txt b/codenet/public_test_cases/p00617/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..115825244f0fc4c398218d45763e0d5a5d29d0fd --- /dev/null +++ b/codenet/public_test_cases/p00617/output.1.txt @@ -0,0 +1,5 @@ +main 2 +main 2 +menu 0 +OUT OF MAIN PANEL 1 +primary 0 diff --git a/codenet/public_test_cases/p00618/input.0.txt b/codenet/public_test_cases/p00618/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..533829d5064ac4cdab264a8c793f036164d5e090 --- /dev/null +++ b/codenet/public_test_cases/p00618/input.0.txt @@ -0,0 +1,10 @@ +4 4 +1 0 +3 2 0 2 +2 0 +2 0 +3 6 +1 0 +3 2 0 2 +2 0 +0 0 diff --git a/codenet/public_test_cases/p00618/input.1.txt b/codenet/public_test_cases/p00618/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..533829d5064ac4cdab264a8c793f036164d5e090 --- /dev/null +++ b/codenet/public_test_cases/p00618/input.1.txt @@ -0,0 +1,10 @@ +4 4 +1 0 +3 2 0 2 +2 0 +2 0 +3 6 +1 0 +3 2 0 2 +2 0 +0 0 diff --git a/codenet/public_test_cases/p00618/output.0.txt b/codenet/public_test_cases/p00618/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4792e70f333077a81456ca2bc74e492ab8bb58c3 --- /dev/null +++ b/codenet/public_test_cases/p00618/output.0.txt @@ -0,0 +1,2 @@ +2 +3 diff --git a/codenet/public_test_cases/p00618/output.1.txt b/codenet/public_test_cases/p00618/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4792e70f333077a81456ca2bc74e492ab8bb58c3 --- /dev/null +++ b/codenet/public_test_cases/p00618/output.1.txt @@ -0,0 +1,2 @@ +2 +3 diff --git a/codenet/public_test_cases/p00619/input.0.txt b/codenet/public_test_cases/p00619/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2111a9a47e1ccbf4ae813a64f53fa4301ea82ad --- /dev/null +++ b/codenet/public_test_cases/p00619/input.0.txt @@ -0,0 +1,23 @@ +8 +1 3 11 3 +5 3 13 11 +10 10 17 10 +11 2 11 6 +10 5 14 5 +13 6 13 2 +17 10 17 3 +13 3 19 3 +1 3 19 3 +6 +1 3 11 3 +5 3 13 11 +10 10 17 10 +11 2 11 6 +10 5 14 5 +13 3 19 3 +1 3 19 3 +2 +0 0 7 0 +3 0 7 3 +0 0 7 3 +0 diff --git a/codenet/public_test_cases/p00619/input.1.txt b/codenet/public_test_cases/p00619/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2111a9a47e1ccbf4ae813a64f53fa4301ea82ad --- /dev/null +++ b/codenet/public_test_cases/p00619/input.1.txt @@ -0,0 +1,23 @@ +8 +1 3 11 3 +5 3 13 11 +10 10 17 10 +11 2 11 6 +10 5 14 5 +13 6 13 2 +17 10 17 3 +13 3 19 3 +1 3 19 3 +6 +1 3 11 3 +5 3 13 11 +10 10 17 10 +11 2 11 6 +10 5 14 5 +13 3 19 3 +1 3 19 3 +2 +0 0 7 0 +3 0 7 3 +0 0 7 3 +0 diff --git a/codenet/public_test_cases/p00619/output.0.txt b/codenet/public_test_cases/p00619/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b33034761e8684546362865b06aa19d4b664767a --- /dev/null +++ b/codenet/public_test_cases/p00619/output.0.txt @@ -0,0 +1,3 @@ +270.0000 +-1 +36.86989765 diff --git a/codenet/public_test_cases/p00619/output.1.txt b/codenet/public_test_cases/p00619/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b33034761e8684546362865b06aa19d4b664767a --- /dev/null +++ b/codenet/public_test_cases/p00619/output.1.txt @@ -0,0 +1,3 @@ +270.0000 +-1 +36.86989765 diff --git a/codenet/public_test_cases/p00620/input.0.txt b/codenet/public_test_cases/p00620/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..584c1ead1259c12ec4a9eddbaf6e257b17c3b421 --- /dev/null +++ b/codenet/public_test_cases/p00620/input.0.txt @@ -0,0 +1,28 @@ +3 +-3 1 1 +2 -4 1 +2 1 -1 +3 +-4 1 1 +1 1 -6 +1 -5 3 +4 +-8 6 -2 1 +2 -7 -2 1 +1 -1 1 1 +1 1 1 -5 +6 +2 2 3 -7 3 2 +1 -10 1 1 3 2 +2 6 5 2 -6 1 +3 4 -23 2 2 5 +3 3 -6 2 3 7 +-7 2 3 2 -5 -13 +6 +2 2 3 -7 3 2 +1 -10 1 1 3 2 +2 6 5 2 -6 1 +3 4 -23 2 2 5 +3 3 -6 2 3 7 +-7 2 3 2 -5 -12 +0 diff --git a/codenet/public_test_cases/p00620/input.1.txt b/codenet/public_test_cases/p00620/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..584c1ead1259c12ec4a9eddbaf6e257b17c3b421 --- /dev/null +++ b/codenet/public_test_cases/p00620/input.1.txt @@ -0,0 +1,28 @@ +3 +-3 1 1 +2 -4 1 +2 1 -1 +3 +-4 1 1 +1 1 -6 +1 -5 3 +4 +-8 6 -2 1 +2 -7 -2 1 +1 -1 1 1 +1 1 1 -5 +6 +2 2 3 -7 3 2 +1 -10 1 1 3 2 +2 6 5 2 -6 1 +3 4 -23 2 2 5 +3 3 -6 2 3 7 +-7 2 3 2 -5 -13 +6 +2 2 3 -7 3 2 +1 -10 1 1 3 2 +2 6 5 2 -6 1 +3 4 -23 2 2 5 +3 3 -6 2 3 7 +-7 2 3 2 -5 -12 +0 diff --git a/codenet/public_test_cases/p00620/output.0.txt b/codenet/public_test_cases/p00620/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f1e3962f67d212807dac8dbdfe6973572fc1765 --- /dev/null +++ b/codenet/public_test_cases/p00620/output.0.txt @@ -0,0 +1,5 @@ +YES +NO +NO +YES +NO diff --git a/codenet/public_test_cases/p00620/output.1.txt b/codenet/public_test_cases/p00620/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f1e3962f67d212807dac8dbdfe6973572fc1765 --- /dev/null +++ b/codenet/public_test_cases/p00620/output.1.txt @@ -0,0 +1,5 @@ +YES +NO +NO +YES +NO diff --git a/codenet/public_test_cases/p00621/input.0.txt b/codenet/public_test_cases/p00621/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a940586ef86a7d6310451701d08ba8aeea2ecd0c --- /dev/null +++ b/codenet/public_test_cases/p00621/input.0.txt @@ -0,0 +1,12 @@ +4 6 +s 0 2 +s 1 3 +s 2 1 +w 0 +s 3 3 +s 4 2 +3 3 +s 0 1 +s 1 1 +s 2 1 +0 0 diff --git a/codenet/public_test_cases/p00621/input.1.txt b/codenet/public_test_cases/p00621/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a940586ef86a7d6310451701d08ba8aeea2ecd0c --- /dev/null +++ b/codenet/public_test_cases/p00621/input.1.txt @@ -0,0 +1,12 @@ +4 6 +s 0 2 +s 1 3 +s 2 1 +w 0 +s 3 3 +s 4 2 +3 3 +s 0 1 +s 1 1 +s 2 1 +0 0 diff --git a/codenet/public_test_cases/p00621/output.0.txt b/codenet/public_test_cases/p00621/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fbcaef978061b037d654f2290e4bcb74dc0f4d5 --- /dev/null +++ b/codenet/public_test_cases/p00621/output.0.txt @@ -0,0 +1,10 @@ +0 +impossible +2 +impossible +0 +END +0 +1 +2 +END diff --git a/codenet/public_test_cases/p00621/output.1.txt b/codenet/public_test_cases/p00621/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fbcaef978061b037d654f2290e4bcb74dc0f4d5 --- /dev/null +++ b/codenet/public_test_cases/p00621/output.1.txt @@ -0,0 +1,10 @@ +0 +impossible +2 +impossible +0 +END +0 +1 +2 +END diff --git a/codenet/public_test_cases/p00622/input.0.txt b/codenet/public_test_cases/p00622/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f0f99dffc0b6dc990a6feda4b927dd6557fa829 --- /dev/null +++ b/codenet/public_test_cases/p00622/input.0.txt @@ -0,0 +1,7 @@ +CBA +cba +cCa +X +ZY +Z +- diff --git a/codenet/public_test_cases/p00622/input.1.txt b/codenet/public_test_cases/p00622/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f0f99dffc0b6dc990a6feda4b927dd6557fa829 --- /dev/null +++ b/codenet/public_test_cases/p00622/input.1.txt @@ -0,0 +1,7 @@ +CBA +cba +cCa +X +ZY +Z +- diff --git a/codenet/public_test_cases/p00622/output.0.txt b/codenet/public_test_cases/p00622/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab62206170ecffa6f1bfc5a2524a26b20b639dd5 --- /dev/null +++ b/codenet/public_test_cases/p00622/output.0.txt @@ -0,0 +1,2 @@ +BbA +XY diff --git a/codenet/public_test_cases/p00622/output.1.txt b/codenet/public_test_cases/p00622/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab62206170ecffa6f1bfc5a2524a26b20b639dd5 --- /dev/null +++ b/codenet/public_test_cases/p00622/output.1.txt @@ -0,0 +1,2 @@ +BbA +XY diff --git a/codenet/public_test_cases/p00623/input.0.txt b/codenet/public_test_cases/p00623/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0badd54c446498f840ef7a02dd8e81e87986fcf3 --- /dev/null +++ b/codenet/public_test_cases/p00623/input.0.txt @@ -0,0 +1,10 @@ +(1 2) +2 +0 1 0 1 +1 0 1 0 +((1 2) 3) +3 +1 1 0 0 +1 0 1 0 +0 0 0 1 +END diff --git a/codenet/public_test_cases/p00623/output.0.txt b/codenet/public_test_cases/p00623/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..51993f072d5832f20b98b6bd0cf763fb8b4c8a1b --- /dev/null +++ b/codenet/public_test_cases/p00623/output.0.txt @@ -0,0 +1,2 @@ +2 +2 diff --git a/codenet/public_test_cases/p00624/input.0.txt b/codenet/public_test_cases/p00624/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6156ed191b69a5575bb3eb2ba80b91ae1a7e5cc --- /dev/null +++ b/codenet/public_test_cases/p00624/input.0.txt @@ -0,0 +1,17 @@ +5 5 +##### +##@## +#wc.# +#Ew.# +##### +5 5 +##### +##@.# +#wc.# +#E#.# +##### +3 6 +###### +#@.wE# +###### +0 0 diff --git a/codenet/public_test_cases/p00624/input.1.txt b/codenet/public_test_cases/p00624/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6156ed191b69a5575bb3eb2ba80b91ae1a7e5cc --- /dev/null +++ b/codenet/public_test_cases/p00624/input.1.txt @@ -0,0 +1,17 @@ +5 5 +##### +##@## +#wc.# +#Ew.# +##### +5 5 +##### +##@.# +#wc.# +#E#.# +##### +3 6 +###### +#@.wE# +###### +0 0 diff --git a/codenet/public_test_cases/p00624/input.2.txt b/codenet/public_test_cases/p00624/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..078be31c9f0ffc2e2add1571534fc93675b02593 --- /dev/null +++ b/codenet/public_test_cases/p00624/input.2.txt @@ -0,0 +1,17 @@ +5 5 + +@## +wc.# +Ew.# + +5 5 + +@.# +wc.# +E#.# + +3 6 + +@.wE# + +0 0 diff --git a/codenet/public_test_cases/p00624/output.0.txt b/codenet/public_test_cases/p00624/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7be35112d0850f42bdadb040ebdabb4eb2c5030d --- /dev/null +++ b/codenet/public_test_cases/p00624/output.0.txt @@ -0,0 +1,3 @@ +3 +5 +-1 diff --git a/codenet/public_test_cases/p00624/output.1.txt b/codenet/public_test_cases/p00624/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7be35112d0850f42bdadb040ebdabb4eb2c5030d --- /dev/null +++ b/codenet/public_test_cases/p00624/output.1.txt @@ -0,0 +1,3 @@ +3 +5 +-1 diff --git a/codenet/public_test_cases/p00624/output.2.txt b/codenet/public_test_cases/p00624/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7be35112d0850f42bdadb040ebdabb4eb2c5030d --- /dev/null +++ b/codenet/public_test_cases/p00624/output.2.txt @@ -0,0 +1,3 @@ +3 +5 +-1 diff --git a/codenet/public_test_cases/p00625/input.0.txt b/codenet/public_test_cases/p00625/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14e5c9a7c3125c1ff52f796d167e1fd8c5b179fb --- /dev/null +++ b/codenet/public_test_cases/p00625/input.0.txt @@ -0,0 +1,11 @@ +2 1 +12 5 3 +0 17 3 +0 0 2 2 +2 3 +2 0 2 +100 100 2 +0 0 -1 0 +-2 -5 0 3 +100 100 1 1 +0 0 diff --git a/codenet/public_test_cases/p00625/input.1.txt b/codenet/public_test_cases/p00625/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14e5c9a7c3125c1ff52f796d167e1fd8c5b179fb --- /dev/null +++ b/codenet/public_test_cases/p00625/input.1.txt @@ -0,0 +1,11 @@ +2 1 +12 5 3 +0 17 3 +0 0 2 2 +2 3 +2 0 2 +100 100 2 +0 0 -1 0 +-2 -5 0 3 +100 100 1 1 +0 0 diff --git a/codenet/public_test_cases/p00625/output.0.txt b/codenet/public_test_cases/p00625/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce9743ca913cb8604deebf0303e3497527568313 --- /dev/null +++ b/codenet/public_test_cases/p00625/output.0.txt @@ -0,0 +1,2 @@ +1 0 +2 1 diff --git a/codenet/public_test_cases/p00625/output.1.txt b/codenet/public_test_cases/p00625/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce9743ca913cb8604deebf0303e3497527568313 --- /dev/null +++ b/codenet/public_test_cases/p00625/output.1.txt @@ -0,0 +1,2 @@ +1 0 +2 1 diff --git a/codenet/public_test_cases/p00626/input.0.txt b/codenet/public_test_cases/p00626/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ced41346a29256f7c12ca01e900c83f41ed680d4 --- /dev/null +++ b/codenet/public_test_cases/p00626/input.0.txt @@ -0,0 +1,11 @@ +4 4 +1 0 0 0 +0 0 1 0 +0 1 0 0 +1 0 0 1 +1 1 +1 +2 3 +1 0 0 +0 0 1 +0 0 diff --git a/codenet/public_test_cases/p00626/input.1.txt b/codenet/public_test_cases/p00626/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ced41346a29256f7c12ca01e900c83f41ed680d4 --- /dev/null +++ b/codenet/public_test_cases/p00626/input.1.txt @@ -0,0 +1,11 @@ +4 4 +1 0 0 0 +0 0 1 0 +0 1 0 0 +1 0 0 1 +1 1 +1 +2 3 +1 0 0 +0 0 1 +0 0 diff --git a/codenet/public_test_cases/p00626/output.0.txt b/codenet/public_test_cases/p00626/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f3aebfda96e05309e167e5488c157b6b4f45003 --- /dev/null +++ b/codenet/public_test_cases/p00626/output.0.txt @@ -0,0 +1,3 @@ +7 +0 +2 diff --git a/codenet/public_test_cases/p00626/output.1.txt b/codenet/public_test_cases/p00626/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f3aebfda96e05309e167e5488c157b6b4f45003 --- /dev/null +++ b/codenet/public_test_cases/p00626/output.1.txt @@ -0,0 +1,3 @@ +7 +0 +2 diff --git a/codenet/public_test_cases/p00627/input.0.txt b/codenet/public_test_cases/p00627/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d543685bb718467d4b453ac17ec089046ac2cba --- /dev/null +++ b/codenet/public_test_cases/p00627/input.0.txt @@ -0,0 +1,10 @@ +20 +4 +3 +2 +1 +3 +8 +2 +0 +0 diff --git a/codenet/public_test_cases/p00627/input.1.txt b/codenet/public_test_cases/p00627/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d543685bb718467d4b453ac17ec089046ac2cba --- /dev/null +++ b/codenet/public_test_cases/p00627/input.1.txt @@ -0,0 +1,10 @@ +20 +4 +3 +2 +1 +3 +8 +2 +0 +0 diff --git a/codenet/public_test_cases/p00627/output.0.txt b/codenet/public_test_cases/p00627/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abee444d94b02835362069f50e7142521ccbb095 --- /dev/null +++ b/codenet/public_test_cases/p00627/output.0.txt @@ -0,0 +1,2 @@ +13 +2 diff --git a/codenet/public_test_cases/p00627/output.1.txt b/codenet/public_test_cases/p00627/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abee444d94b02835362069f50e7142521ccbb095 --- /dev/null +++ b/codenet/public_test_cases/p00627/output.1.txt @@ -0,0 +1,2 @@ +13 +2 diff --git a/codenet/public_test_cases/p00628/input.0.txt b/codenet/public_test_cases/p00628/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd9c33e2eb4e2c98e869b999fd12269d3ae5aa9c --- /dev/null +++ b/codenet/public_test_cases/p00628/input.0.txt @@ -0,0 +1,4 @@ +Yes I have a number +How I wish I could calculate an unused color for space +Thank you +END OF INPUT diff --git a/codenet/public_test_cases/p00628/input.1.txt b/codenet/public_test_cases/p00628/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd9c33e2eb4e2c98e869b999fd12269d3ae5aa9c --- /dev/null +++ b/codenet/public_test_cases/p00628/input.1.txt @@ -0,0 +1,4 @@ +Yes I have a number +How I wish I could calculate an unused color for space +Thank you +END OF INPUT diff --git a/codenet/public_test_cases/p00628/output.0.txt b/codenet/public_test_cases/p00628/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62f9706056a01b590e2fb6f829ca13ed93a70f28 --- /dev/null +++ b/codenet/public_test_cases/p00628/output.0.txt @@ -0,0 +1,3 @@ +31416 +31415926535 +53 diff --git a/codenet/public_test_cases/p00628/output.1.txt b/codenet/public_test_cases/p00628/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..62f9706056a01b590e2fb6f829ca13ed93a70f28 --- /dev/null +++ b/codenet/public_test_cases/p00628/output.1.txt @@ -0,0 +1,3 @@ +31416 +31415926535 +53 diff --git a/codenet/public_test_cases/p00629/input.0.txt b/codenet/public_test_cases/p00629/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d503c8cf087ff8038c9fa6df709d014471bea87 --- /dev/null +++ b/codenet/public_test_cases/p00629/input.0.txt @@ -0,0 +1,15 @@ +6 +1 1 6 200 +2 1 6 300 +3 1 6 400 +4 2 5 1200 +5 1 5 1400 +6 3 4 800 +3 +777 1 5 300 +808 2 4 20 +123 3 6 500 +2 +2 1 3 100 +1 1 3 100 +0 diff --git a/codenet/public_test_cases/p00629/input.1.txt b/codenet/public_test_cases/p00629/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d503c8cf087ff8038c9fa6df709d014471bea87 --- /dev/null +++ b/codenet/public_test_cases/p00629/input.1.txt @@ -0,0 +1,15 @@ +6 +1 1 6 200 +2 1 6 300 +3 1 6 400 +4 2 5 1200 +5 1 5 1400 +6 3 4 800 +3 +777 1 5 300 +808 2 4 20 +123 3 6 500 +2 +2 1 3 100 +1 1 3 100 +0 diff --git a/codenet/public_test_cases/p00629/output.0.txt b/codenet/public_test_cases/p00629/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4419ecf895117f5a85bce1e56f7ca31ab659f033 --- /dev/null +++ b/codenet/public_test_cases/p00629/output.0.txt @@ -0,0 +1,10 @@ +1 +2 +3 +4 +6 +123 +777 +808 +1 +2 diff --git a/codenet/public_test_cases/p00629/output.1.txt b/codenet/public_test_cases/p00629/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4419ecf895117f5a85bce1e56f7ca31ab659f033 --- /dev/null +++ b/codenet/public_test_cases/p00629/output.1.txt @@ -0,0 +1,10 @@ +1 +2 +3 +4 +6 +123 +777 +808 +1 +2 diff --git a/codenet/public_test_cases/p00630/input.0.txt b/codenet/public_test_cases/p00630/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..10fe95df7194443879541177b75ccb98e7317a8f --- /dev/null +++ b/codenet/public_test_cases/p00630/input.0.txt @@ -0,0 +1,4 @@ +get_user_name L +getUserName U +GetUserName D +EndOfInput X diff --git a/codenet/public_test_cases/p00630/input.1.txt b/codenet/public_test_cases/p00630/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..10fe95df7194443879541177b75ccb98e7317a8f --- /dev/null +++ b/codenet/public_test_cases/p00630/input.1.txt @@ -0,0 +1,4 @@ +get_user_name L +getUserName U +GetUserName D +EndOfInput X diff --git a/codenet/public_test_cases/p00630/output.0.txt b/codenet/public_test_cases/p00630/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..521298bad5dc24dbdf1082a81bff132ef179904c --- /dev/null +++ b/codenet/public_test_cases/p00630/output.0.txt @@ -0,0 +1,3 @@ +getUserName +GetUserName +get_user_name diff --git a/codenet/public_test_cases/p00630/output.1.txt b/codenet/public_test_cases/p00630/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..521298bad5dc24dbdf1082a81bff132ef179904c --- /dev/null +++ b/codenet/public_test_cases/p00630/output.1.txt @@ -0,0 +1,3 @@ +getUserName +GetUserName +get_user_name diff --git a/codenet/public_test_cases/p00631/input.0.txt b/codenet/public_test_cases/p00631/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31a1916d70a004fcf5c5b70e4792cdbfa218b4fa --- /dev/null +++ b/codenet/public_test_cases/p00631/input.0.txt @@ -0,0 +1,5 @@ +5 +1 2 3 4 5 +4 +2 3 5 7 +0 diff --git a/codenet/public_test_cases/p00631/input.1.txt b/codenet/public_test_cases/p00631/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31a1916d70a004fcf5c5b70e4792cdbfa218b4fa --- /dev/null +++ b/codenet/public_test_cases/p00631/input.1.txt @@ -0,0 +1,5 @@ +5 +1 2 3 4 5 +4 +2 3 5 7 +0 diff --git a/codenet/public_test_cases/p00631/output.0.txt b/codenet/public_test_cases/p00631/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p00631/output.0.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p00631/output.1.txt b/codenet/public_test_cases/p00631/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p00631/output.1.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p00632/input.0.txt b/codenet/public_test_cases/p00632/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0114289cc12ee052ec7de76a2e1d17a1fa9f0ca7 --- /dev/null +++ b/codenet/public_test_cases/p00632/input.0.txt @@ -0,0 +1,31 @@ +4 7 +A#...#B +.#.#.#. +.#.#.#. +...#... +5 +4 7 +A#...#B +.#.#.#. +.#.#.#. +...#... +2 +4 7 +A#...#B +.#.#.#. +.#.#.#. +...#... +4 +4 7 +A#...#B +.#.#.#. +.#.#.#. +...#... +442668 +1 10 +A#.......B +55555554 +1 10 +A#.......B +55555555 +0 0 diff --git a/codenet/public_test_cases/p00632/input.1.txt b/codenet/public_test_cases/p00632/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0114289cc12ee052ec7de76a2e1d17a1fa9f0ca7 --- /dev/null +++ b/codenet/public_test_cases/p00632/input.1.txt @@ -0,0 +1,31 @@ +4 7 +A#...#B +.#.#.#. +.#.#.#. +...#... +5 +4 7 +A#...#B +.#.#.#. +.#.#.#. +...#... +2 +4 7 +A#...#B +.#.#.#. +.#.#.#. +...#... +4 +4 7 +A#...#B +.#.#.#. +.#.#.#. +...#... +442668 +1 10 +A#.......B +55555554 +1 10 +A#.......B +55555555 +0 0 diff --git a/codenet/public_test_cases/p00632/output.0.txt b/codenet/public_test_cases/p00632/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e4ae34d7c9d56c9f4c3f9212557a9c380577558 --- /dev/null +++ b/codenet/public_test_cases/p00632/output.0.txt @@ -0,0 +1,6 @@ +18 0 6 +15 3 6 +6 0 0 +14 0 4 +72 0 0 +impossible diff --git a/codenet/public_test_cases/p00632/output.1.txt b/codenet/public_test_cases/p00632/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e4ae34d7c9d56c9f4c3f9212557a9c380577558 --- /dev/null +++ b/codenet/public_test_cases/p00632/output.1.txt @@ -0,0 +1,6 @@ +18 0 6 +15 3 6 +6 0 0 +14 0 4 +72 0 0 +impossible diff --git a/codenet/public_test_cases/p00633/input.0.txt b/codenet/public_test_cases/p00633/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdc723dfc2a39d3eebb2111aed00b9db69b64fe --- /dev/null +++ b/codenet/public_test_cases/p00633/input.0.txt @@ -0,0 +1,11 @@ +4 +6 4 2 +4 7 3 +7 10 3 +13 6 1 +4 +7 4 2 +4 7 3 +7 10 3 +11 6 3 +0 diff --git a/codenet/public_test_cases/p00633/input.1.txt b/codenet/public_test_cases/p00633/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdc723dfc2a39d3eebb2111aed00b9db69b64fe --- /dev/null +++ b/codenet/public_test_cases/p00633/input.1.txt @@ -0,0 +1,11 @@ +4 +6 4 2 +4 7 3 +7 10 3 +13 6 1 +4 +7 4 2 +4 7 3 +7 10 3 +11 6 3 +0 diff --git a/codenet/public_test_cases/p00633/output.0.txt b/codenet/public_test_cases/p00633/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..177a4084eb1314ddceb3502cc387ad412012a76f --- /dev/null +++ b/codenet/public_test_cases/p00633/output.0.txt @@ -0,0 +1,2 @@ +39.664699289572 +45.627024663706 diff --git a/codenet/public_test_cases/p00633/output.1.txt b/codenet/public_test_cases/p00633/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..177a4084eb1314ddceb3502cc387ad412012a76f --- /dev/null +++ b/codenet/public_test_cases/p00633/output.1.txt @@ -0,0 +1,2 @@ +39.664699289572 +45.627024663706 diff --git a/codenet/public_test_cases/p00634/input.0.txt b/codenet/public_test_cases/p00634/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..46f66fc4012c032033e796f592ca6bd6d43c33e4 --- /dev/null +++ b/codenet/public_test_cases/p00634/input.0.txt @@ -0,0 +1,30 @@ +3 +3 apple 100 banana 200 egg 300 +3 apple 150 banana 100 cola 200 +3 apple 100 banana 150 cola 200 +3 +apple +banana +cola +5 +0 2 4 +0 1 3 +0 3 3 +1 2 3 +2 3 5 +3 +3 apple 100 banana 200 egg 300 +3 apple 150 banana 100 cola 200 +3 apple 100 banana 150 cola 200 +4 +apple +banana +cola +jump +5 +0 2 4 +0 1 3 +0 3 3 +1 2 3 +2 3 5 +0 diff --git a/codenet/public_test_cases/p00634/input.1.txt b/codenet/public_test_cases/p00634/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46f66fc4012c032033e796f592ca6bd6d43c33e4 --- /dev/null +++ b/codenet/public_test_cases/p00634/input.1.txt @@ -0,0 +1,30 @@ +3 +3 apple 100 banana 200 egg 300 +3 apple 150 banana 100 cola 200 +3 apple 100 banana 150 cola 200 +3 +apple +banana +cola +5 +0 2 4 +0 1 3 +0 3 3 +1 2 3 +2 3 5 +3 +3 apple 100 banana 200 egg 300 +3 apple 150 banana 100 cola 200 +3 apple 100 banana 150 cola 200 +4 +apple +banana +cola +jump +5 +0 2 4 +0 1 3 +0 3 3 +1 2 3 +2 3 5 +0 diff --git a/codenet/public_test_cases/p00634/output.0.txt b/codenet/public_test_cases/p00634/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aab82458b883707b72c2aa95799b9889d515dee8 --- /dev/null +++ b/codenet/public_test_cases/p00634/output.0.txt @@ -0,0 +1,2 @@ +400 10 +impossible diff --git a/codenet/public_test_cases/p00634/output.1.txt b/codenet/public_test_cases/p00634/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aab82458b883707b72c2aa95799b9889d515dee8 --- /dev/null +++ b/codenet/public_test_cases/p00634/output.1.txt @@ -0,0 +1,2 @@ +400 10 +impossible diff --git a/codenet/public_test_cases/p00635/input.0.txt b/codenet/public_test_cases/p00635/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..15e2672416253821555825e6dc8cdb3aa099c933 --- /dev/null +++ b/codenet/public_test_cases/p00635/input.0.txt @@ -0,0 +1,9 @@ +4 +0 2 3 1 +4 0 4 2 +1 1 0 3 +3 1 5 0 +2 +0 3 +3 0 +0 diff --git a/codenet/public_test_cases/p00635/output.0.txt b/codenet/public_test_cases/p00635/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1cf023e17835c681bfebf18f867f94899296b9c --- /dev/null +++ b/codenet/public_test_cases/p00635/output.0.txt @@ -0,0 +1,2 @@ +8 +3 diff --git a/codenet/public_test_cases/p00636/input.0.txt b/codenet/public_test_cases/p00636/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f65b9e20eb5cdb9bf7f70634d37ea16b75379141 --- /dev/null +++ b/codenet/public_test_cases/p00636/input.0.txt @@ -0,0 +1,11 @@ +2 +1 1 +3 3 +4 +1.0 0.5 +1.0 2.5 +3.0 1.5 +3.0 3.5 +1 +2.0 2.0 +0 diff --git a/codenet/public_test_cases/p00636/input.1.txt b/codenet/public_test_cases/p00636/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f65b9e20eb5cdb9bf7f70634d37ea16b75379141 --- /dev/null +++ b/codenet/public_test_cases/p00636/input.1.txt @@ -0,0 +1,11 @@ +2 +1 1 +3 3 +4 +1.0 0.5 +1.0 2.5 +3.0 1.5 +3.0 3.5 +1 +2.0 2.0 +0 diff --git a/codenet/public_test_cases/p00636/output.0.txt b/codenet/public_test_cases/p00636/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee8fd6e6b21e1b1fb7b89ccf49e3c9b8ac0e427 --- /dev/null +++ b/codenet/public_test_cases/p00636/output.0.txt @@ -0,0 +1,3 @@ +5.656854249492 +4.618033988750 +impossible diff --git a/codenet/public_test_cases/p00636/output.1.txt b/codenet/public_test_cases/p00636/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee8fd6e6b21e1b1fb7b89ccf49e3c9b8ac0e427 --- /dev/null +++ b/codenet/public_test_cases/p00636/output.1.txt @@ -0,0 +1,3 @@ +5.656854249492 +4.618033988750 +impossible diff --git a/codenet/public_test_cases/p00637/input.0.txt b/codenet/public_test_cases/p00637/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4a67e7b7d1835aa2159b5dbe7c95d24f1782df3 --- /dev/null +++ b/codenet/public_test_cases/p00637/input.0.txt @@ -0,0 +1,5 @@ +5 +1 2 3 5 6 +3 +7 8 9 +0 diff --git a/codenet/public_test_cases/p00637/input.1.txt b/codenet/public_test_cases/p00637/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4a67e7b7d1835aa2159b5dbe7c95d24f1782df3 --- /dev/null +++ b/codenet/public_test_cases/p00637/input.1.txt @@ -0,0 +1,5 @@ +5 +1 2 3 5 6 +3 +7 8 9 +0 diff --git a/codenet/public_test_cases/p00637/output.0.txt b/codenet/public_test_cases/p00637/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6d37ad9ac3709711b33ecc484297886b71b835f --- /dev/null +++ b/codenet/public_test_cases/p00637/output.0.txt @@ -0,0 +1,2 @@ +1-3 5-6 +7-9 diff --git a/codenet/public_test_cases/p00637/output.1.txt b/codenet/public_test_cases/p00637/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6d37ad9ac3709711b33ecc484297886b71b835f --- /dev/null +++ b/codenet/public_test_cases/p00637/output.1.txt @@ -0,0 +1,2 @@ +1-3 5-6 +7-9 diff --git a/codenet/public_test_cases/p00638/input.0.txt b/codenet/public_test_cases/p00638/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8eedf0dfb8de21872010e913d12f7f12d5ba9fc2 --- /dev/null +++ b/codenet/public_test_cases/p00638/input.0.txt @@ -0,0 +1,9 @@ +3 +2 3 +3 6 +1 2 +3 +2 3 +3 5 +1 2 +0 diff --git a/codenet/public_test_cases/p00638/input.1.txt b/codenet/public_test_cases/p00638/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8eedf0dfb8de21872010e913d12f7f12d5ba9fc2 --- /dev/null +++ b/codenet/public_test_cases/p00638/input.1.txt @@ -0,0 +1,9 @@ +3 +2 3 +3 6 +1 2 +3 +2 3 +3 5 +1 2 +0 diff --git a/codenet/public_test_cases/p00638/output.0.txt b/codenet/public_test_cases/p00638/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p00638/output.0.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p00638/output.1.txt b/codenet/public_test_cases/p00638/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p00638/output.1.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p00639/input.0.txt b/codenet/public_test_cases/p00639/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a08b023574c686d9e9527bc5d6211f7a4171948 --- /dev/null +++ b/codenet/public_test_cases/p00639/input.0.txt @@ -0,0 +1,5 @@ +10.0 +0.5 0.0 -0.2 0.0 +1.0 +0.1 0.0 0.2 0.2 +0 diff --git a/codenet/public_test_cases/p00639/input.1.txt b/codenet/public_test_cases/p00639/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a08b023574c686d9e9527bc5d6211f7a4171948 --- /dev/null +++ b/codenet/public_test_cases/p00639/input.1.txt @@ -0,0 +1,5 @@ +10.0 +0.5 0.0 -0.2 0.0 +1.0 +0.1 0.0 0.2 0.2 +0 diff --git a/codenet/public_test_cases/p00639/output.0.txt b/codenet/public_test_cases/p00639/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eaaca4b85d6d1ff9c05e6e4fc7d6360afc6280d --- /dev/null +++ b/codenet/public_test_cases/p00639/output.0.txt @@ -0,0 +1,2 @@ +0.50000000 +impossible diff --git a/codenet/public_test_cases/p00639/output.1.txt b/codenet/public_test_cases/p00639/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eaaca4b85d6d1ff9c05e6e4fc7d6360afc6280d --- /dev/null +++ b/codenet/public_test_cases/p00639/output.1.txt @@ -0,0 +1,2 @@ +0.50000000 +impossible diff --git a/codenet/public_test_cases/p00640/input.0.txt b/codenet/public_test_cases/p00640/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1f88c14bfc0c047cfebea6a32adb8c7c17d2cc5 --- /dev/null +++ b/codenet/public_test_cases/p00640/input.0.txt @@ -0,0 +1,20 @@ +3 +800 600 +index 1 +500 100 700 200 profile +profile 2 +100 100 400 200 index +100 400 400 500 link +link 1 +100 100 300 200 index +9 +click 600 150 +show +click 200 450 +show +back +back +show +forward +show +0 diff --git a/codenet/public_test_cases/p00640/input.1.txt b/codenet/public_test_cases/p00640/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1f88c14bfc0c047cfebea6a32adb8c7c17d2cc5 --- /dev/null +++ b/codenet/public_test_cases/p00640/input.1.txt @@ -0,0 +1,20 @@ +3 +800 600 +index 1 +500 100 700 200 profile +profile 2 +100 100 400 200 index +100 400 400 500 link +link 1 +100 100 300 200 index +9 +click 600 150 +show +click 200 450 +show +back +back +show +forward +show +0 diff --git a/codenet/public_test_cases/p00640/output.0.txt b/codenet/public_test_cases/p00640/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3a0a8acbe459cff1c547314ea0cb5cc4e6d898a --- /dev/null +++ b/codenet/public_test_cases/p00640/output.0.txt @@ -0,0 +1,4 @@ +profile +link +index +profile diff --git a/codenet/public_test_cases/p00640/output.1.txt b/codenet/public_test_cases/p00640/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3a0a8acbe459cff1c547314ea0cb5cc4e6d898a --- /dev/null +++ b/codenet/public_test_cases/p00640/output.1.txt @@ -0,0 +1,4 @@ +profile +link +index +profile diff --git a/codenet/public_test_cases/p00641/input.0.txt b/codenet/public_test_cases/p00641/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b131f9b441944eb29d7114f2a12f32c73bb4e42f --- /dev/null +++ b/codenet/public_test_cases/p00641/input.0.txt @@ -0,0 +1,13 @@ +3 +1 1 2 3 +0 1 2 2 +1 2 0 3 +7 +1 2 2 1 +0 2 3 2 +0 1 3 1 +2 1 1 2 +5 3 6 2 +4 3 6 1 +4 2 5 1 +0 diff --git a/codenet/public_test_cases/p00641/input.1.txt b/codenet/public_test_cases/p00641/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b131f9b441944eb29d7114f2a12f32c73bb4e42f --- /dev/null +++ b/codenet/public_test_cases/p00641/input.1.txt @@ -0,0 +1,13 @@ +3 +1 1 2 3 +0 1 2 2 +1 2 0 3 +7 +1 2 2 1 +0 2 3 2 +0 1 3 1 +2 1 1 2 +5 3 6 2 +4 3 6 1 +4 2 5 1 +0 diff --git a/codenet/public_test_cases/p00641/output.0.txt b/codenet/public_test_cases/p00641/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p00641/output.0.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p00641/output.1.txt b/codenet/public_test_cases/p00641/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p00641/output.1.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p00642/input.0.txt b/codenet/public_test_cases/p00642/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82b6055c7ce7ff03d4f27976037cf11f5cf6ce3a --- /dev/null +++ b/codenet/public_test_cases/p00642/input.0.txt @@ -0,0 +1,4 @@ +1 +2 +3 +0 diff --git a/codenet/public_test_cases/p00642/input.1.txt b/codenet/public_test_cases/p00642/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..82b6055c7ce7ff03d4f27976037cf11f5cf6ce3a --- /dev/null +++ b/codenet/public_test_cases/p00642/input.1.txt @@ -0,0 +1,4 @@ +1 +2 +3 +0 diff --git a/codenet/public_test_cases/p00642/output.0.txt b/codenet/public_test_cases/p00642/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe4ff8efbbcbdde7bbf7146dd88ce78fd9cf2ae4 --- /dev/null +++ b/codenet/public_test_cases/p00642/output.0.txt @@ -0,0 +1,3 @@ +1.00000000 +1.50000000 +2.12500000 diff --git a/codenet/public_test_cases/p00642/output.1.txt b/codenet/public_test_cases/p00642/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe4ff8efbbcbdde7bbf7146dd88ce78fd9cf2ae4 --- /dev/null +++ b/codenet/public_test_cases/p00642/output.1.txt @@ -0,0 +1,3 @@ +1.00000000 +1.50000000 +2.12500000 diff --git a/codenet/public_test_cases/p00643/input.0.txt b/codenet/public_test_cases/p00643/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66a242a6e8e17d741df88fd2e444416bdb0909d0 --- /dev/null +++ b/codenet/public_test_cases/p00643/input.0.txt @@ -0,0 +1,27 @@ +1 2 +8 8 +0 0 +0 1 +3 3 +1 2 5 +2 8 3 +0 1 2 +0 0 +2 2 +3 3 +1 2 5 +2 8 3 +0 1 2 +0 0 +1 2 +2 2 +1 2 +3 4 +0 0 +0 1 +2 3 +1 2 3 +4 5 6 +0 0 +1 2 +0 0 diff --git a/codenet/public_test_cases/p00643/input.1.txt b/codenet/public_test_cases/p00643/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..66a242a6e8e17d741df88fd2e444416bdb0909d0 --- /dev/null +++ b/codenet/public_test_cases/p00643/input.1.txt @@ -0,0 +1,27 @@ +1 2 +8 8 +0 0 +0 1 +3 3 +1 2 5 +2 8 3 +0 1 2 +0 0 +2 2 +3 3 +1 2 5 +2 8 3 +0 1 2 +0 0 +1 2 +2 2 +1 2 +3 4 +0 0 +0 1 +2 3 +1 2 3 +4 5 6 +0 0 +1 2 +0 0 diff --git a/codenet/public_test_cases/p00643/output.0.txt b/codenet/public_test_cases/p00643/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db2579395789c445d40697fb458b596d3efbe565 --- /dev/null +++ b/codenet/public_test_cases/p00643/output.0.txt @@ -0,0 +1,5 @@ +24 +19 +17 +6 +21 diff --git a/codenet/public_test_cases/p00643/output.1.txt b/codenet/public_test_cases/p00643/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db2579395789c445d40697fb458b596d3efbe565 --- /dev/null +++ b/codenet/public_test_cases/p00643/output.1.txt @@ -0,0 +1,5 @@ +24 +19 +17 +6 +21 diff --git a/codenet/public_test_cases/p00644/input.0.txt b/codenet/public_test_cases/p00644/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a99c34ea75519995be562647bf5b05e6f620f82 --- /dev/null +++ b/codenet/public_test_cases/p00644/input.0.txt @@ -0,0 +1,13 @@ +3 2 1 +0 1 2 +1 2 3 +1 +4 5 2 +0 1 1 +0 2 1 +1 2 1 +1 3 1 +2 3 1 +1 +2 +0 0 0 diff --git a/codenet/public_test_cases/p00644/input.1.txt b/codenet/public_test_cases/p00644/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a99c34ea75519995be562647bf5b05e6f620f82 --- /dev/null +++ b/codenet/public_test_cases/p00644/input.1.txt @@ -0,0 +1,13 @@ +3 2 1 +0 1 2 +1 2 3 +1 +4 5 2 +0 1 1 +0 2 1 +1 2 1 +1 3 1 +2 3 1 +1 +2 +0 0 0 diff --git a/codenet/public_test_cases/p00644/output.0.txt b/codenet/public_test_cases/p00644/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d17f1f50a25c07ec721e8e9eb43388aea13bc8c5 --- /dev/null +++ b/codenet/public_test_cases/p00644/output.0.txt @@ -0,0 +1,4 @@ +1.00000000 + +0.50000000 +0.50000000 diff --git a/codenet/public_test_cases/p00644/output.1.txt b/codenet/public_test_cases/p00644/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d17f1f50a25c07ec721e8e9eb43388aea13bc8c5 --- /dev/null +++ b/codenet/public_test_cases/p00644/output.1.txt @@ -0,0 +1,4 @@ +1.00000000 + +0.50000000 +0.50000000 diff --git a/codenet/public_test_cases/p00645/input.0.txt b/codenet/public_test_cases/p00645/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f72b88feabcb75b80127594243ea8aae7f85ab47 --- /dev/null +++ b/codenet/public_test_cases/p00645/input.0.txt @@ -0,0 +1,17 @@ +5 +1 1 1 1 1 +1 0 0 0 1 +1 0 1 0 1 +1 0 0 0 1 +1 1 1 1 1 +3 +1 1 1 +1 1 1 +1 1 1 +5 +1 1 1 1 0 +1 1 1 1 0 +1 0 0 0 1 +0 1 1 1 1 +0 1 1 1 1 +0 diff --git a/codenet/public_test_cases/p00645/input.1.txt b/codenet/public_test_cases/p00645/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f72b88feabcb75b80127594243ea8aae7f85ab47 --- /dev/null +++ b/codenet/public_test_cases/p00645/input.1.txt @@ -0,0 +1,17 @@ +5 +1 1 1 1 1 +1 0 0 0 1 +1 0 1 0 1 +1 0 0 0 1 +1 1 1 1 1 +3 +1 1 1 +1 1 1 +1 1 1 +5 +1 1 1 1 0 +1 1 1 1 0 +1 0 0 0 1 +0 1 1 1 1 +0 1 1 1 1 +0 diff --git a/codenet/public_test_cases/p00645/output.0.txt b/codenet/public_test_cases/p00645/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7f4499f50424d72046d889e16bcc33e5a6603c3 --- /dev/null +++ b/codenet/public_test_cases/p00645/output.0.txt @@ -0,0 +1,3 @@ +myonmyonmyon +myon +myonmyon diff --git a/codenet/public_test_cases/p00645/output.1.txt b/codenet/public_test_cases/p00645/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7f4499f50424d72046d889e16bcc33e5a6603c3 --- /dev/null +++ b/codenet/public_test_cases/p00645/output.1.txt @@ -0,0 +1,3 @@ +myonmyonmyon +myon +myonmyon diff --git a/codenet/public_test_cases/p00646/input.0.txt b/codenet/public_test_cases/p00646/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d69cf48438e97763e4f99194ec059b5dc2ccaa6c --- /dev/null +++ b/codenet/public_test_cases/p00646/input.0.txt @@ -0,0 +1,4 @@ +12 +9 +2 +0 diff --git a/codenet/public_test_cases/p00646/input.1.txt b/codenet/public_test_cases/p00646/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d69cf48438e97763e4f99194ec059b5dc2ccaa6c --- /dev/null +++ b/codenet/public_test_cases/p00646/input.1.txt @@ -0,0 +1,4 @@ +12 +9 +2 +0 diff --git a/codenet/public_test_cases/p00646/output.0.txt b/codenet/public_test_cases/p00646/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f8537fef92e6a22365d6a97a5fe830f5c5e5cbd --- /dev/null +++ b/codenet/public_test_cases/p00646/output.0.txt @@ -0,0 +1,3 @@ +8 +3 +2 diff --git a/codenet/public_test_cases/p00646/output.1.txt b/codenet/public_test_cases/p00646/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f8537fef92e6a22365d6a97a5fe830f5c5e5cbd --- /dev/null +++ b/codenet/public_test_cases/p00646/output.1.txt @@ -0,0 +1,3 @@ +8 +3 +2 diff --git a/codenet/public_test_cases/p00647/input.0.txt b/codenet/public_test_cases/p00647/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..429ddf80503d444f4a511c187a94ad4fd074678c --- /dev/null +++ b/codenet/public_test_cases/p00647/input.0.txt @@ -0,0 +1,7 @@ +5 +12:57 59 +20:12 15 +12:19 21 +18:52 03 +16:09 14 +0 diff --git a/codenet/public_test_cases/p00647/input.1.txt b/codenet/public_test_cases/p00647/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..429ddf80503d444f4a511c187a94ad4fd074678c --- /dev/null +++ b/codenet/public_test_cases/p00647/input.1.txt @@ -0,0 +1,7 @@ +5 +12:57 59 +20:12 15 +12:19 21 +18:52 03 +16:09 14 +0 diff --git a/codenet/public_test_cases/p00647/output.0.txt b/codenet/public_test_cases/p00647/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..358413d40dd1e7a97d8a77c8c179521d915df84f --- /dev/null +++ b/codenet/public_test_cases/p00647/output.0.txt @@ -0,0 +1,3 @@ +lunch 100 +dinner 50 +midnight no guest diff --git a/codenet/public_test_cases/p00647/output.1.txt b/codenet/public_test_cases/p00647/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..358413d40dd1e7a97d8a77c8c179521d915df84f --- /dev/null +++ b/codenet/public_test_cases/p00647/output.1.txt @@ -0,0 +1,3 @@ +lunch 100 +dinner 50 +midnight no guest diff --git a/codenet/public_test_cases/p00648/input.0.txt b/codenet/public_test_cases/p00648/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbc3dd9ad3e94678a560e83f23cec8ae6defa16e --- /dev/null +++ b/codenet/public_test_cases/p00648/input.0.txt @@ -0,0 +1,65 @@ +1 +galaxy_angel 0 600 +1 +galaxy_angel +11 +A 0 600 +B 0 610 +C 0 610 +D 0 610 +E 0 640 +EE 0 700 +F 0 710 +G 0 710 +H 0 710 +I 0 740 +J 0 750 +2 +B +H +42 +nchj 6 2620 +anhnnnmewbktthsrn 4 2515 +gntmdsh 1 1800 +achnnl 4 2540 +hnskirh 0 2200 +aonexrcst 0 1700 +dgdys 6 2330 +hdnnara 4 2525 +dnpaonntssotk 4 2555 +ddmnwndrlnd 6 2500 +C 4 2445 +astrttnomch 0 2330 +seknnqasr 1 2630 +sftnt 4 2630 +stnsgt 2 2605 +drrnenmknmrmr 4 2610 +hnzm 6 2713 +yndmsoazzlsn 6 2658 +mrahlcalv 4 2615 +hshzrhkkrhs 1 900 +ortchntsbshni 0 2430 +kmnmzshrski 1 2530 +sktdnc 4 1800 +gykkybrkjhkirkhn 2 2459 +trk 0 900 +30zzsinhkntiik 3 2700 +sngkotmmmirprdx 1 2600 +yran 2 2529 +tntissygntinybu 1 2614 +skiichhtki 5 2505 +tgrbnny 6 2558 +dnbrsnki 3 1927 +yugozxl 1 1930 +frbllchrmn 1 1928 +fjrg 1 1955 +shwmngtr 0 2200 +xmn 5 2200 +rngnkkrskitikihn 0 2100 +szysz 0 1254 +prttyrythmaulrdrm 6 1000 +sckiesfrntrqst 5 1820 +mshdr 1 2255 +1 +mrahlcalv +0 diff --git a/codenet/public_test_cases/p00648/input.1.txt b/codenet/public_test_cases/p00648/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbc3dd9ad3e94678a560e83f23cec8ae6defa16e --- /dev/null +++ b/codenet/public_test_cases/p00648/input.1.txt @@ -0,0 +1,65 @@ +1 +galaxy_angel 0 600 +1 +galaxy_angel +11 +A 0 600 +B 0 610 +C 0 610 +D 0 610 +E 0 640 +EE 0 700 +F 0 710 +G 0 710 +H 0 710 +I 0 740 +J 0 750 +2 +B +H +42 +nchj 6 2620 +anhnnnmewbktthsrn 4 2515 +gntmdsh 1 1800 +achnnl 4 2540 +hnskirh 0 2200 +aonexrcst 0 1700 +dgdys 6 2330 +hdnnara 4 2525 +dnpaonntssotk 4 2555 +ddmnwndrlnd 6 2500 +C 4 2445 +astrttnomch 0 2330 +seknnqasr 1 2630 +sftnt 4 2630 +stnsgt 2 2605 +drrnenmknmrmr 4 2610 +hnzm 6 2713 +yndmsoazzlsn 6 2658 +mrahlcalv 4 2615 +hshzrhkkrhs 1 900 +ortchntsbshni 0 2430 +kmnmzshrski 1 2530 +sktdnc 4 1800 +gykkybrkjhkirkhn 2 2459 +trk 0 900 +30zzsinhkntiik 3 2700 +sngkotmmmirprdx 1 2600 +yran 2 2529 +tntissygntinybu 1 2614 +skiichhtki 5 2505 +tgrbnny 6 2558 +dnbrsnki 3 1927 +yugozxl 1 1930 +frbllchrmn 1 1928 +fjrg 1 1955 +shwmngtr 0 2200 +xmn 5 2200 +rngnkkrskitikihn 0 2100 +szysz 0 1254 +prttyrythmaulrdrm 6 1000 +sckiesfrntrqst 5 1820 +mshdr 1 2255 +1 +mrahlcalv +0 diff --git a/codenet/public_test_cases/p00648/output.0.txt b/codenet/public_test_cases/p00648/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..938bb5de9e0f2b554c1158867c6df7ef00d6f809 --- /dev/null +++ b/codenet/public_test_cases/p00648/output.0.txt @@ -0,0 +1,3 @@ +1 +4 +31 diff --git a/codenet/public_test_cases/p00648/output.1.txt b/codenet/public_test_cases/p00648/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..938bb5de9e0f2b554c1158867c6df7ef00d6f809 --- /dev/null +++ b/codenet/public_test_cases/p00648/output.1.txt @@ -0,0 +1,3 @@ +1 +4 +31 diff --git a/codenet/public_test_cases/p00649/input.0.txt b/codenet/public_test_cases/p00649/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ff387827631dcbfa94dd3ee7fb7299431eca087 --- /dev/null +++ b/codenet/public_test_cases/p00649/input.0.txt @@ -0,0 +1,13 @@ +4 +0 0 100 60 +0 60 50 90 +50 60 100 90 +0 90 100 120 +6 +0 0 100 40 +0 40 50 70 +50 40 100 60 +50 60 100 80 +0 70 50 120 +50 80 100 120 +0 diff --git a/codenet/public_test_cases/p00649/input.1.txt b/codenet/public_test_cases/p00649/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ff387827631dcbfa94dd3ee7fb7299431eca087 --- /dev/null +++ b/codenet/public_test_cases/p00649/input.1.txt @@ -0,0 +1,13 @@ +4 +0 0 100 60 +0 60 50 90 +50 60 100 90 +0 90 100 120 +6 +0 0 100 40 +0 40 50 70 +50 40 100 60 +50 60 100 80 +0 70 50 120 +50 80 100 120 +0 diff --git a/codenet/public_test_cases/p00649/output.0.txt b/codenet/public_test_cases/p00649/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a417504db744427ed8060aac7a2779ead9ab1a29 --- /dev/null +++ b/codenet/public_test_cases/p00649/output.0.txt @@ -0,0 +1,11 @@ +1 +2 +3 +4 + +1 +2 +4 +5 +3 +6 diff --git a/codenet/public_test_cases/p00649/output.1.txt b/codenet/public_test_cases/p00649/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a417504db744427ed8060aac7a2779ead9ab1a29 --- /dev/null +++ b/codenet/public_test_cases/p00649/output.1.txt @@ -0,0 +1,11 @@ +1 +2 +3 +4 + +1 +2 +4 +5 +3 +6 diff --git a/codenet/public_test_cases/p00650/input.0.txt b/codenet/public_test_cases/p00650/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b24b83d83d565cc1a4d8605ff30bbb9baa016a5e --- /dev/null +++ b/codenet/public_test_cases/p00650/input.0.txt @@ -0,0 +1,10 @@ +3 2 +0 1 2 +1 2 1 +2 1 +0 1 100 +2 1 +0 1 0 +2 1 +0 1 -1 +0 0 diff --git a/codenet/public_test_cases/p00650/input.1.txt b/codenet/public_test_cases/p00650/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b24b83d83d565cc1a4d8605ff30bbb9baa016a5e --- /dev/null +++ b/codenet/public_test_cases/p00650/input.1.txt @@ -0,0 +1,10 @@ +3 2 +0 1 2 +1 2 1 +2 1 +0 1 100 +2 1 +0 1 0 +2 1 +0 1 -1 +0 0 diff --git a/codenet/public_test_cases/p00650/output.0.txt b/codenet/public_test_cases/p00650/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e57fe9ca7d1944c565a8895d9430002ace6e1186 --- /dev/null +++ b/codenet/public_test_cases/p00650/output.0.txt @@ -0,0 +1,4 @@ +1 +100 +0 +-1 diff --git a/codenet/public_test_cases/p00650/output.1.txt b/codenet/public_test_cases/p00650/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e57fe9ca7d1944c565a8895d9430002ace6e1186 --- /dev/null +++ b/codenet/public_test_cases/p00650/output.1.txt @@ -0,0 +1,4 @@ +1 +100 +0 +-1 diff --git a/codenet/public_test_cases/p00651/input.0.txt b/codenet/public_test_cases/p00651/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..633ede7d82f3fd99b40b0aeadd0ecdf15f69f940 --- /dev/null +++ b/codenet/public_test_cases/p00651/input.0.txt @@ -0,0 +1,6 @@ +4 10 8 +0 -10 +3 -7 +0 -4 +-3 -7 +0 0 0 diff --git a/codenet/public_test_cases/p00651/input.1.txt b/codenet/public_test_cases/p00651/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..633ede7d82f3fd99b40b0aeadd0ecdf15f69f940 --- /dev/null +++ b/codenet/public_test_cases/p00651/input.1.txt @@ -0,0 +1,6 @@ +4 10 8 +0 -10 +3 -7 +0 -4 +-3 -7 +0 0 0 diff --git a/codenet/public_test_cases/p00651/output.0.txt b/codenet/public_test_cases/p00651/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ca249f66070ae8db27183772f0f0640c1f16a3a --- /dev/null +++ b/codenet/public_test_cases/p00651/output.0.txt @@ -0,0 +1,8 @@ +-4.146082488326 -9.100000000000 +-7.545870128753 -6.562000000000 +-9.587401146004 -2.842840000000 +-9.903199956975 1.388031200000 +-8.436422775690 5.369056784000 +-5.451089494781 8.383652146880 +-1.484560104812 9.889190123322 +2.749190104024 9.614673877565 diff --git a/codenet/public_test_cases/p00651/output.1.txt b/codenet/public_test_cases/p00651/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ca249f66070ae8db27183772f0f0640c1f16a3a --- /dev/null +++ b/codenet/public_test_cases/p00651/output.1.txt @@ -0,0 +1,8 @@ +-4.146082488326 -9.100000000000 +-7.545870128753 -6.562000000000 +-9.587401146004 -2.842840000000 +-9.903199956975 1.388031200000 +-8.436422775690 5.369056784000 +-5.451089494781 8.383652146880 +-1.484560104812 9.889190123322 +2.749190104024 9.614673877565 diff --git a/codenet/public_test_cases/p00652/input.0.txt b/codenet/public_test_cases/p00652/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcf3c5c757281c50f49e27fb7829205a2b4bccc6 --- /dev/null +++ b/codenet/public_test_cases/p00652/input.0.txt @@ -0,0 +1,31 @@ +2 3 10 10 50 +3 3 +6 6 +10 10 +4.0000000000 4.0000000000 +7.0000000000 7.0000000000 +2 3 10 10 70 +3 3 +6 6 +10 10 +4.0000000000 4.0000000000 +7.0000000000 7.0000000000 +2 3 10 10 30 +3 3 +6 6 +10 10 +4.0000000000 4.0000000000 +7.0000000000 7.0000000000 +2 3 10 10 40 +3 3 +6 6 +10 10 +4.0000000000 4.0000000000 +7.0000000000 7.0000000000 +2 3 10 10 100 +3 3 +6 6 +10 10 +4.0000000000 4.0000000000 +7.0000000000 7.0000000000 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00652/input.1.txt b/codenet/public_test_cases/p00652/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcf3c5c757281c50f49e27fb7829205a2b4bccc6 --- /dev/null +++ b/codenet/public_test_cases/p00652/input.1.txt @@ -0,0 +1,31 @@ +2 3 10 10 50 +3 3 +6 6 +10 10 +4.0000000000 4.0000000000 +7.0000000000 7.0000000000 +2 3 10 10 70 +3 3 +6 6 +10 10 +4.0000000000 4.0000000000 +7.0000000000 7.0000000000 +2 3 10 10 30 +3 3 +6 6 +10 10 +4.0000000000 4.0000000000 +7.0000000000 7.0000000000 +2 3 10 10 40 +3 3 +6 6 +10 10 +4.0000000000 4.0000000000 +7.0000000000 7.0000000000 +2 3 10 10 100 +3 3 +6 6 +10 10 +4.0000000000 4.0000000000 +7.0000000000 7.0000000000 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00652/output.0.txt b/codenet/public_test_cases/p00652/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cfc238426e05769204832ee8e1d7cd458ae5c42 --- /dev/null +++ b/codenet/public_test_cases/p00652/output.0.txt @@ -0,0 +1,5 @@ +1 +1 +0 +1 +2 diff --git a/codenet/public_test_cases/p00652/output.1.txt b/codenet/public_test_cases/p00652/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cfc238426e05769204832ee8e1d7cd458ae5c42 --- /dev/null +++ b/codenet/public_test_cases/p00652/output.1.txt @@ -0,0 +1,5 @@ +1 +1 +0 +1 +2 diff --git a/codenet/public_test_cases/p00653/input.0.txt b/codenet/public_test_cases/p00653/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b817317d7ea1e1a1bae4a32f977fce682c50822 --- /dev/null +++ b/codenet/public_test_cases/p00653/input.0.txt @@ -0,0 +1,15 @@ +3 3 4 +1 2 3 +4 2 2 +2 1 1 +0 0 2 2 +0 0 1 1 +1 0 1 0 +0 1 1 2 +1 10 4 +1 2 3 4 5 6 7 8 9 10 +0 0 0 9 +0 0 0 4 +0 5 0 9 +0 4 0 5 +0 0 0 diff --git a/codenet/public_test_cases/p00653/input.1.txt b/codenet/public_test_cases/p00653/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b817317d7ea1e1a1bae4a32f977fce682c50822 --- /dev/null +++ b/codenet/public_test_cases/p00653/input.1.txt @@ -0,0 +1,15 @@ +3 3 4 +1 2 3 +4 2 2 +2 1 1 +0 0 2 2 +0 0 1 1 +1 0 1 0 +0 1 1 2 +1 10 4 +1 2 3 4 5 6 7 8 9 10 +0 0 0 9 +0 0 0 4 +0 5 0 9 +0 4 0 5 +0 0 0 diff --git a/codenet/public_test_cases/p00653/output.0.txt b/codenet/public_test_cases/p00653/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4971b8fb3552e58e04af32ab9a82549d99c87d8 --- /dev/null +++ b/codenet/public_test_cases/p00653/output.0.txt @@ -0,0 +1,8 @@ +1 +1 +4 +2 +1 +1 +6 +5 diff --git a/codenet/public_test_cases/p00653/output.1.txt b/codenet/public_test_cases/p00653/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4971b8fb3552e58e04af32ab9a82549d99c87d8 --- /dev/null +++ b/codenet/public_test_cases/p00653/output.1.txt @@ -0,0 +1,8 @@ +1 +1 +4 +2 +1 +1 +6 +5 diff --git a/codenet/public_test_cases/p00654/input.0.txt b/codenet/public_test_cases/p00654/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be06bba200f010bf22d04e3063b8527f0f5c0141 --- /dev/null +++ b/codenet/public_test_cases/p00654/input.0.txt @@ -0,0 +1,5 @@ +3 +6 10 14 15 21 35 +2 +30 42 35 +0 diff --git a/codenet/public_test_cases/p00654/input.1.txt b/codenet/public_test_cases/p00654/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..be06bba200f010bf22d04e3063b8527f0f5c0141 --- /dev/null +++ b/codenet/public_test_cases/p00654/input.1.txt @@ -0,0 +1,5 @@ +3 +6 10 14 15 21 35 +2 +30 42 35 +0 diff --git a/codenet/public_test_cases/p00654/output.0.txt b/codenet/public_test_cases/p00654/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50f8fbea67170672840960338f9089389f0dd8e1 --- /dev/null +++ b/codenet/public_test_cases/p00654/output.0.txt @@ -0,0 +1,4 @@ +2 +3 5 7 +6 +5 7 diff --git a/codenet/public_test_cases/p00654/output.1.txt b/codenet/public_test_cases/p00654/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..50f8fbea67170672840960338f9089389f0dd8e1 --- /dev/null +++ b/codenet/public_test_cases/p00654/output.1.txt @@ -0,0 +1,4 @@ +2 +3 5 7 +6 +5 7 diff --git a/codenet/public_test_cases/p00655/input.0.txt b/codenet/public_test_cases/p00655/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d45778bba0c28251a443b7437f4d6838834998e5 --- /dev/null +++ b/codenet/public_test_cases/p00655/input.0.txt @@ -0,0 +1,79 @@ +5 +0 1 +0 2 +0 3 +0 4 +1 +6 +0 1 +0 2 +0 3 +0 4 +0 5 +1 +31 +0 6 +0 2 +0 3 +0 4 +0 5 +0 1 +0 8 +4 1 +4 2 +5 1 +5 2 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +1 +32 +0 1 +0 3 +0 2 +0 5 +0 9 +0 6 +0 7 +8 1 +8 2 +8 3 +9 1 +9 2 +6 +7 +1 +6 +7 +1 +6 +7 +1 +6 +7 +1 +6 +7 +1 +6 +7 +1 +6 +1 +0 diff --git a/codenet/public_test_cases/p00655/input.1.txt b/codenet/public_test_cases/p00655/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d45778bba0c28251a443b7437f4d6838834998e5 --- /dev/null +++ b/codenet/public_test_cases/p00655/input.1.txt @@ -0,0 +1,79 @@ +5 +0 1 +0 2 +0 3 +0 4 +1 +6 +0 1 +0 2 +0 3 +0 4 +0 5 +1 +31 +0 6 +0 2 +0 3 +0 4 +0 5 +0 1 +0 8 +4 1 +4 2 +5 1 +5 2 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +3 +1 +2 +1 +32 +0 1 +0 3 +0 2 +0 5 +0 9 +0 6 +0 7 +8 1 +8 2 +8 3 +9 1 +9 2 +6 +7 +1 +6 +7 +1 +6 +7 +1 +6 +7 +1 +6 +7 +1 +6 +7 +1 +6 +1 +0 diff --git a/codenet/public_test_cases/p00655/output.0.txt b/codenet/public_test_cases/p00655/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bab7ba4e7330cf3ce7c8e731d4e2bb358ca501da --- /dev/null +++ b/codenet/public_test_cases/p00655/output.0.txt @@ -0,0 +1,55 @@ +2 +end +3 +end +2 +6 +1 +8 +2 +1 +4 +2 +1 +3 +2 +1 +5 +2 +1 +2 +1 +8 +1 +6 +8 +6 +8 +8 +end +5 +3 +1 +9 +7 +5 +9 +5 +3 +9 +2 +9 +7 +9 +3 +7 +3 +6 +7 +6 +1 +7 +1 +7 +7 +end diff --git a/codenet/public_test_cases/p00655/output.1.txt b/codenet/public_test_cases/p00655/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bab7ba4e7330cf3ce7c8e731d4e2bb358ca501da --- /dev/null +++ b/codenet/public_test_cases/p00655/output.1.txt @@ -0,0 +1,55 @@ +2 +end +3 +end +2 +6 +1 +8 +2 +1 +4 +2 +1 +3 +2 +1 +5 +2 +1 +2 +1 +8 +1 +6 +8 +6 +8 +8 +end +5 +3 +1 +9 +7 +5 +9 +5 +3 +9 +2 +9 +7 +9 +3 +7 +3 +6 +7 +6 +1 +7 +1 +7 +7 +end diff --git a/codenet/public_test_cases/p00656/input.0.txt b/codenet/public_test_cases/p00656/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2eab5dd3f48d739c87e67f49ce1ca62b3bbbfd5 --- /dev/null +++ b/codenet/public_test_cases/p00656/input.0.txt @@ -0,0 +1,45 @@ +3 4 +abc 1 1 +abc 10 1 +abc 100 1 +3 +a +abc +ab +3 4 +ab 1 1 +ab 10 1 +abc 100 1 +3 +abc +ab +a +3 4 +abc 1 1 +abc 10 1 +abc 100 1 +3 +ab +ab +ab +8 20 +abcdef 100 2 +bcdef 200 1 +cfghj 300 3 +ksjirto 400 6 +ksitoew 500 2 +qwertyl 600 2 +kjhbvc 700 2 +edfghucb 800 1 +10 +ks +cd +hj +e +a +g +h +j +i +a +0 0 diff --git a/codenet/public_test_cases/p00656/output.0.txt b/codenet/public_test_cases/p00656/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e57aa1860644de3ed45cb182cde71937f300ec1 --- /dev/null +++ b/codenet/public_test_cases/p00656/output.0.txt @@ -0,0 +1,19 @@ +111 +110 +100 +100 +11 +10 +111 +110 +100 +900 +300 +300 +2200 +100 +1100 +1500 +1400 +900 +-1 diff --git a/codenet/public_test_cases/p00657/input.0.txt b/codenet/public_test_cases/p00657/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87034c9c3f823ff34f79dcf7b6630396a2700ee9 --- /dev/null +++ b/codenet/public_test_cases/p00657/input.0.txt @@ -0,0 +1,3 @@ +1 1 +2 2 +0 0 diff --git a/codenet/public_test_cases/p00657/input.1.txt b/codenet/public_test_cases/p00657/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87034c9c3f823ff34f79dcf7b6630396a2700ee9 --- /dev/null +++ b/codenet/public_test_cases/p00657/input.1.txt @@ -0,0 +1,3 @@ +1 1 +2 2 +0 0 diff --git a/codenet/public_test_cases/p00657/output.0.txt b/codenet/public_test_cases/p00657/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ce46e2638ea0f64c92ba9f99b358ab371d889fa --- /dev/null +++ b/codenet/public_test_cases/p00657/output.0.txt @@ -0,0 +1,2 @@ +no +yes diff --git a/codenet/public_test_cases/p00657/output.1.txt b/codenet/public_test_cases/p00657/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ce46e2638ea0f64c92ba9f99b358ab371d889fa --- /dev/null +++ b/codenet/public_test_cases/p00657/output.1.txt @@ -0,0 +1,2 @@ +no +yes diff --git a/codenet/public_test_cases/p00658/input.0.txt b/codenet/public_test_cases/p00658/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76866c05a9a8c38758a55f48f6e90f1c4b6634bd --- /dev/null +++ b/codenet/public_test_cases/p00658/input.0.txt @@ -0,0 +1,50 @@ +8 8 +........ +........ +....###. +...#.#.G +S#B...## +#ICII.I# +#..#.#.# +.#..#.#. +7 +PUSH RIGHT +MOVETO 2 +CLIMB RIGHT +CLIMB RIGHT +GETDOWN RIGHT +CLIMB RIGHT +GETDOWN RIGHT +8 8 +........ +........ +........ +...G.... +S#B..... +#ICIIIII +#..#.#.# +.#..#.#. +4 +PUSH RIGHT +MOVETO 2 +CLIMB RIGHT +CLIMB RIGHT +8 8 +........ +....#.#. +.....#.G +...#..#. +S#B....# +#ICIII.# +#..#.#.# +.#..#.#. +8 +PUSH RIGHT +MOVETO 2 +CLIMB RIGHT +CLIMB RIGHT +CLIMB RIGHT +GETDOWN RIGHT +CLIMB RIGHT +GETDOWN RIGHT +0 0 diff --git a/codenet/public_test_cases/p00658/output.0.txt b/codenet/public_test_cases/p00658/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dc275ed5764f936c6f0f18fadae7faa7ee6d44d --- /dev/null +++ b/codenet/public_test_cases/p00658/output.0.txt @@ -0,0 +1,3 @@ +Game Over : Death by Hole +Game Over : Cleared +Game Over : Death by Walking Goal diff --git a/codenet/public_test_cases/p00659/input.0.txt b/codenet/public_test_cases/p00659/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1d31bf8510f5ca416065c84d746d8ab45b3d776 --- /dev/null +++ b/codenet/public_test_cases/p00659/input.0.txt @@ -0,0 +1,53 @@ +4 +akzakr 2 1 8 +fnmyi 5 2 3 4 6 9 +tsnukk 5 2 3 4 7 9 +yskwcnt 6 3 4 7 8 9 10 +4 +akzakr 1 2 +fnmyi 3 10 11 12 +tsnukk 2 1 8 +yskwcnt 2 1 8 +5 +knmmdk 2 13 19 +akmhmr 4 13 15 19 22 +mksyk 6 3 7 12 13 15 19 +skrkyk 3 1 4 8 +tmemm 3 1 17 24 +5 +knmmdk 5 5 6 16 18 26 +akmhmr 9 3 4 7 11 14 15 17 18 20 +mksyk 5 6 13 25 27 28 +skrkyk 4 3 16 23 24 +tmemm 3 6 12 20 +14 +hrkamm 6 4 6 8 10 20 22 +mkhsi 6 1 10 12 15 22 27 +hbkgnh 2 4 9 +chyksrg 8 3 4 12 15 16 20 25 28 +mktkkc 6 0 1 8 15 17 20 +tknsj 6 6 8 18 19 25 26 +yyitktk 3 3 12 18 +ykhhgwr 5 3 9 10 11 24 +amftm 7 2 6 8 12 13 14 17 +mmftm 4 6 12 16 18 +rtkakzk 3 14 15 21 +azsmur 7 1 2 4 12 15 18 20 +iormns 2 4 20 +ktrotns 6 7 12 14 17 20 25 +14 +hrkamm 2 4 21 +mkhsi 6 2 3 8 11 18 20 +hbkgnh 4 4 16 28 29 +chyksrg 5 0 3 9 17 22 +mktkkc 2 7 18 +tknsj 3 3 9 23 +yyitktk 3 10 13 25 +ykhhgwr 2 18 26 +amftm 3 13 18 22 +mmftm 4 1 20 24 27 +rtkakzk 2 1 10 +azsmur 5 2 5 10 14 17 +iormns 3 9 15 16 +ktrotns 5 7 12 16 17 20 +0 diff --git a/codenet/public_test_cases/p00659/input.1.txt b/codenet/public_test_cases/p00659/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1d31bf8510f5ca416065c84d746d8ab45b3d776 --- /dev/null +++ b/codenet/public_test_cases/p00659/input.1.txt @@ -0,0 +1,53 @@ +4 +akzakr 2 1 8 +fnmyi 5 2 3 4 6 9 +tsnukk 5 2 3 4 7 9 +yskwcnt 6 3 4 7 8 9 10 +4 +akzakr 1 2 +fnmyi 3 10 11 12 +tsnukk 2 1 8 +yskwcnt 2 1 8 +5 +knmmdk 2 13 19 +akmhmr 4 13 15 19 22 +mksyk 6 3 7 12 13 15 19 +skrkyk 3 1 4 8 +tmemm 3 1 17 24 +5 +knmmdk 5 5 6 16 18 26 +akmhmr 9 3 4 7 11 14 15 17 18 20 +mksyk 5 6 13 25 27 28 +skrkyk 4 3 16 23 24 +tmemm 3 6 12 20 +14 +hrkamm 6 4 6 8 10 20 22 +mkhsi 6 1 10 12 15 22 27 +hbkgnh 2 4 9 +chyksrg 8 3 4 12 15 16 20 25 28 +mktkkc 6 0 1 8 15 17 20 +tknsj 6 6 8 18 19 25 26 +yyitktk 3 3 12 18 +ykhhgwr 5 3 9 10 11 24 +amftm 7 2 6 8 12 13 14 17 +mmftm 4 6 12 16 18 +rtkakzk 3 14 15 21 +azsmur 7 1 2 4 12 15 18 20 +iormns 2 4 20 +ktrotns 6 7 12 14 17 20 25 +14 +hrkamm 2 4 21 +mkhsi 6 2 3 8 11 18 20 +hbkgnh 4 4 16 28 29 +chyksrg 5 0 3 9 17 22 +mktkkc 2 7 18 +tknsj 3 3 9 23 +yyitktk 3 10 13 25 +ykhhgwr 2 18 26 +amftm 3 13 18 22 +mmftm 4 1 20 24 27 +rtkakzk 2 1 10 +azsmur 5 2 5 10 14 17 +iormns 3 9 15 16 +ktrotns 5 7 12 16 17 20 +0 diff --git a/codenet/public_test_cases/p00659/output.0.txt b/codenet/public_test_cases/p00659/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ed9edca254844a19b94e59e63c70d85e8ae1506 --- /dev/null +++ b/codenet/public_test_cases/p00659/output.0.txt @@ -0,0 +1,6 @@ +7 akzakr +4 akzakr +6 knmmdk +12 tmemm +19 iormns +24 mktkkc diff --git a/codenet/public_test_cases/p00659/output.1.txt b/codenet/public_test_cases/p00659/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ed9edca254844a19b94e59e63c70d85e8ae1506 --- /dev/null +++ b/codenet/public_test_cases/p00659/output.1.txt @@ -0,0 +1,6 @@ +7 akzakr +4 akzakr +6 knmmdk +12 tmemm +19 iormns +24 mktkkc diff --git a/codenet/public_test_cases/p00660/input.0.txt b/codenet/public_test_cases/p00660/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbcce47ff2824db9b5039e84e37916f10ae112 --- /dev/null +++ b/codenet/public_test_cases/p00660/input.0.txt @@ -0,0 +1,85 @@ +.......#######......................#######.............. +.......#.....#......................#..-..#.............. +.......#.|...#......................#.|.|.#.............. +.......#.....#......................#..-..#.............. +.......#.|...#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +############################.############################ +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +#.-.-.##...|.##.-.-.##.|.|.#.#.....##.|.|.##.-.-.##.|.|.# +#|.|.|##..-..##|.|.|##..-..#.#....|##..-..##|.|.|##..-..# +#...-.##.|...##...-.##.|.|.#.#.-.-.##.|...##...-.##.|...# +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +############################.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#.|.|.#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +############################.############################ +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +#.-.-.##...|.##.-.-.##.|.|.#.#...-.##...|.##.-...##.|.|.# +#|.|.|##..-..##|.|.|##..-..#.#|.|.|##..-..##|.|.|##..-..# +#.-.-.##.|...##...-.##.|...#.#.-...##.|.|.##.-.-.##.|...# +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +############################.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +############################.############################ +#.....##..-..##.....##..-..#.#.....##..-..##.....##.....# +#.-.-.##.|.|.##.-.-.##...|.#.#.....##.|.|.##...-.##.|...# +#|.|.|##..-..##|....##..-..#.#....|##..-..##|.|.|##.....# +#.-.-.##.|.|.##.....##.|.|.#.#.-.-.##.|.|.##.-...##.|...# +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +############################.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|.|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +############################.############################ +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +#.-.-.##...|.##.-.-.##.|.|.#.#.-...##.|.|.##.-...##.|.|.# +#|.|.|##..-..##|.|.|##..-..#.#|.|.|##..-..##|.|.|##..-..# +#...-.##.|...##.-.-.##.|.|.#.#.-.-.##.|...##.-.-.##.|.|.# +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +############################.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +0 diff --git a/codenet/public_test_cases/p00660/input.1.txt b/codenet/public_test_cases/p00660/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbcce47ff2824db9b5039e84e37916f10ae112 --- /dev/null +++ b/codenet/public_test_cases/p00660/input.1.txt @@ -0,0 +1,85 @@ +.......#######......................#######.............. +.......#.....#......................#..-..#.............. +.......#.|...#......................#.|.|.#.............. +.......#.....#......................#..-..#.............. +.......#.|...#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +############################.############################ +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +#.-.-.##...|.##.-.-.##.|.|.#.#.....##.|.|.##.-.-.##.|.|.# +#|.|.|##..-..##|.|.|##..-..#.#....|##..-..##|.|.|##..-..# +#...-.##.|...##...-.##.|.|.#.#.-.-.##.|...##...-.##.|...# +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +############################.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#.|.|.#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +############################.############################ +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +#.-.-.##...|.##.-.-.##.|.|.#.#...-.##...|.##.-...##.|.|.# +#|.|.|##..-..##|.|.|##..-..#.#|.|.|##..-..##|.|.|##..-..# +#.-.-.##.|...##...-.##.|...#.#.-...##.|.|.##.-.-.##.|...# +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +############################.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +############################.############################ +#.....##..-..##.....##..-..#.#.....##..-..##.....##.....# +#.-.-.##.|.|.##.-.-.##...|.#.#.....##.|.|.##...-.##.|...# +#|.|.|##..-..##|....##..-..#.#....|##..-..##|.|.|##.....# +#.-.-.##.|.|.##.....##.|.|.#.#.-.-.##.|.|.##.-...##.|...# +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +############################.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|.|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +############################.############################ +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +#.-.-.##...|.##.-.-.##.|.|.#.#.-...##.|.|.##.-...##.|.|.# +#|.|.|##..-..##|.|.|##..-..#.#|.|.|##..-..##|.|.|##..-..# +#...-.##.|...##.-.-.##.|.|.#.#.-.-.##.|...##.-.-.##.|.|.# +#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +############################.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +0 diff --git a/codenet/public_test_cases/p00660/input.2.txt b/codenet/public_test_cases/p00660/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e35916b6a7e86c9655872e44fb87d11cce6ed5c1 --- /dev/null +++ b/codenet/public_test_cases/p00660/input.2.txt @@ -0,0 +1,85 @@ +.......#######......................#######.............. +.......#.....#......................#..-..#.............. +.......#.|...#......................#.|.|.#.............. +.......#.....#......................#..-..#.............. +.......#.|...#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.############################ +.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +.-.-.##...|.##.-.-.##.|.|.#.#.....##.|.|.##.-.-.##.|.|.# +|.|.|##..-..##|.|.|##..-..#.#....|##..-..##|.|.|##..-..# +...-.##.|...##...-.##.|.|.#.#.-.-.##.|...##...-.##.|...# +.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#.|.|.#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.############################ +.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +.-.-.##...|.##.-.-.##.|.|.#.#...-.##...|.##.-...##.|.|.# +|.|.|##..-..##|.|.|##..-..#.#|.|.|##..-..##|.|.|##..-..# +.-.-.##.|...##...-.##.|...#.#.-...##.|.|.##.-.-.##.|...# +.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.############################ +.....##..-..##.....##..-..#.#.....##..-..##.....##.....# +.-.-.##.|.|.##.-.-.##...|.#.#.....##.|.|.##...-.##.|...# +|.|.|##..-..##|....##..-..#.#....|##..-..##|.|.|##.....# +.-.-.##.|.|.##.....##.|.|.#.#.-.-.##.|.|.##.-...##.|...# +.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|.|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|...#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +.############################ +.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +.-.-.##...|.##.-.-.##.|.|.#.#.-...##.|.|.##.-...##.|.|.# +|.|.|##..-..##|.|.|##..-..#.#|.|.|##..-..##|.|.|##..-..# +...-.##.|...##.-.-.##.|.|.#.#.-.-.##.|...##.-.-.##.|.|.# +.....##..-..##.....##..-..#.#.....##..-..##.....##..-..# +.############################ +.......#######......................#######.............. +.......#..-..#......................#..-..#.............. +.......#...|.#......................#.|.|.#.............. +.......#..-..#......................#..-..#.............. +.......#.|...#......................#...|.#.............. +.......#..-..#......................#..-..#.............. +.......#######......................#######.............. +0 diff --git a/codenet/public_test_cases/p00660/output.0.txt b/codenet/public_test_cases/p00660/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1f7126714a9355570fea8278cab55069e1c45a7 --- /dev/null +++ b/codenet/public_test_cases/p00660/output.0.txt @@ -0,0 +1,4 @@ +LOW +HIGH +HIGH +LOW diff --git a/codenet/public_test_cases/p00660/output.1.txt b/codenet/public_test_cases/p00660/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1f7126714a9355570fea8278cab55069e1c45a7 --- /dev/null +++ b/codenet/public_test_cases/p00660/output.1.txt @@ -0,0 +1,4 @@ +LOW +HIGH +HIGH +LOW diff --git a/codenet/public_test_cases/p00660/output.2.txt b/codenet/public_test_cases/p00660/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1f7126714a9355570fea8278cab55069e1c45a7 --- /dev/null +++ b/codenet/public_test_cases/p00660/output.2.txt @@ -0,0 +1,4 @@ +LOW +HIGH +HIGH +LOW diff --git a/codenet/public_test_cases/p00661/input.0.txt b/codenet/public_test_cases/p00661/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2dbe3a2a54034163038c75077e25c744ba61369 --- /dev/null +++ b/codenet/public_test_cases/p00661/input.0.txt @@ -0,0 +1,5 @@ +12 3 +2 3 6 +12 4 +1 2 3 6 +0 0 diff --git a/codenet/public_test_cases/p00661/input.1.txt b/codenet/public_test_cases/p00661/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2dbe3a2a54034163038c75077e25c744ba61369 --- /dev/null +++ b/codenet/public_test_cases/p00661/input.1.txt @@ -0,0 +1,5 @@ +12 3 +2 3 6 +12 4 +1 2 3 6 +0 0 diff --git a/codenet/public_test_cases/p00661/output.0.txt b/codenet/public_test_cases/p00661/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5e649a6ad8bee66fbc0c74ac228a2ccdcd3353a --- /dev/null +++ b/codenet/public_test_cases/p00661/output.0.txt @@ -0,0 +1,2 @@ +6.0000000000 +0.0000000000 diff --git a/codenet/public_test_cases/p00661/output.1.txt b/codenet/public_test_cases/p00661/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5e649a6ad8bee66fbc0c74ac228a2ccdcd3353a --- /dev/null +++ b/codenet/public_test_cases/p00661/output.1.txt @@ -0,0 +1,2 @@ +6.0000000000 +0.0000000000 diff --git a/codenet/public_test_cases/p00662/input.0.txt b/codenet/public_test_cases/p00662/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd83b1ad8fbb692c3684e17c552744ef4d97d028 --- /dev/null +++ b/codenet/public_test_cases/p00662/input.0.txt @@ -0,0 +1,9 @@ +1 1 1 1 1 1 +1 1 1 0 0 0 +1 0 0 0 1 1 +3 0 0 3 0 0 +3 1 0 1 3 1 +1 2 0 2 0 1 +0 0 1 1 0 3 +1 0 0 1 1 0 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00662/input.1.txt b/codenet/public_test_cases/p00662/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd83b1ad8fbb692c3684e17c552744ef4d97d028 --- /dev/null +++ b/codenet/public_test_cases/p00662/input.1.txt @@ -0,0 +1,9 @@ +1 1 1 1 1 1 +1 1 1 0 0 0 +1 0 0 0 1 1 +3 0 0 3 0 0 +3 1 0 1 3 1 +1 2 0 2 0 1 +0 0 1 1 0 3 +1 0 0 1 1 0 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00662/output.0.txt b/codenet/public_test_cases/p00662/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2196d86d24bf384bb6c150e2b454a98a198f3cbb --- /dev/null +++ b/codenet/public_test_cases/p00662/output.0.txt @@ -0,0 +1,8 @@ +2 +1 +1 +2 +3 +1 +1 +0 diff --git a/codenet/public_test_cases/p00662/output.1.txt b/codenet/public_test_cases/p00662/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2196d86d24bf384bb6c150e2b454a98a198f3cbb --- /dev/null +++ b/codenet/public_test_cases/p00662/output.1.txt @@ -0,0 +1,8 @@ +2 +1 +1 +2 +3 +1 +1 +0 diff --git a/codenet/public_test_cases/p00663/input.0.txt b/codenet/public_test_cases/p00663/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ac453c8e13f5b37a2752fb896cb7a034eb1050c --- /dev/null +++ b/codenet/public_test_cases/p00663/input.0.txt @@ -0,0 +1,3 @@ +(B&B&f)|(~d&~i&i)|(~v&i&~V)|(~g&~e&o)|(~f&d&~v)|(d&~i&o)|(g&i&~B)|(~i&f&d)|(e&~i&~V)|(~v&f&~d) +(S&X&~X) +# diff --git a/codenet/public_test_cases/p00663/input.1.txt b/codenet/public_test_cases/p00663/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ac453c8e13f5b37a2752fb896cb7a034eb1050c --- /dev/null +++ b/codenet/public_test_cases/p00663/input.1.txt @@ -0,0 +1,3 @@ +(B&B&f)|(~d&~i&i)|(~v&i&~V)|(~g&~e&o)|(~f&d&~v)|(d&~i&o)|(g&i&~B)|(~i&f&d)|(e&~i&~V)|(~v&f&~d) +(S&X&~X) +# diff --git a/codenet/public_test_cases/p00663/input.2.txt b/codenet/public_test_cases/p00663/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..862ca21c062e9f2b9ee03b5b9b3d540126cbd83b --- /dev/null +++ b/codenet/public_test_cases/p00663/input.2.txt @@ -0,0 +1,2 @@ +(B&B&f)|(~d&~i&i)|(~v&i&~V)|(~g&~e&o)|(~f&d&~v)|(d&~i&o)|(g&i&~B)|(~i&f&d)|(e&~i&~V)|(~v&f&~d) +(S&X&~X) diff --git a/codenet/public_test_cases/p00663/output.0.txt b/codenet/public_test_cases/p00663/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3548ec75745b4bab76190bb939fc489d7873f60 --- /dev/null +++ b/codenet/public_test_cases/p00663/output.0.txt @@ -0,0 +1,2 @@ +yes +no diff --git a/codenet/public_test_cases/p00663/output.1.txt b/codenet/public_test_cases/p00663/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3548ec75745b4bab76190bb939fc489d7873f60 --- /dev/null +++ b/codenet/public_test_cases/p00663/output.1.txt @@ -0,0 +1,2 @@ +yes +no diff --git a/codenet/public_test_cases/p00663/output.2.txt b/codenet/public_test_cases/p00663/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3548ec75745b4bab76190bb939fc489d7873f60 --- /dev/null +++ b/codenet/public_test_cases/p00663/output.2.txt @@ -0,0 +1,2 @@ +yes +no diff --git a/codenet/public_test_cases/p00664/input.0.txt b/codenet/public_test_cases/p00664/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d430a3314c82a3b2f46fc59d9db2590d4587429 --- /dev/null +++ b/codenet/public_test_cases/p00664/input.0.txt @@ -0,0 +1,19 @@ +5 5 5 +0 0 1 +0 0 0 +0 2 0 +1 2 1 +0 0 0 +5 5 5 +1 4 0 +0 1 1 +0 4 1 +1 3 0 +0 3 1 +5 5 5 +1 0 0 +0 3 0 +1 2 1 +0 4 0 +0 1 1 +0 0 0 diff --git a/codenet/public_test_cases/p00664/input.1.txt b/codenet/public_test_cases/p00664/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d430a3314c82a3b2f46fc59d9db2590d4587429 --- /dev/null +++ b/codenet/public_test_cases/p00664/input.1.txt @@ -0,0 +1,19 @@ +5 5 5 +0 0 1 +0 0 0 +0 2 0 +1 2 1 +0 0 0 +5 5 5 +1 4 0 +0 1 1 +0 4 1 +1 3 0 +0 3 1 +5 5 5 +1 0 0 +0 3 0 +1 2 1 +0 4 0 +0 1 1 +0 0 0 diff --git a/codenet/public_test_cases/p00664/output.0.txt b/codenet/public_test_cases/p00664/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f04d5cd7caa76738eb3603dcefb25d073e8b1cd --- /dev/null +++ b/codenet/public_test_cases/p00664/output.0.txt @@ -0,0 +1,3 @@ +4 +13 +8 diff --git a/codenet/public_test_cases/p00664/output.1.txt b/codenet/public_test_cases/p00664/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f04d5cd7caa76738eb3603dcefb25d073e8b1cd --- /dev/null +++ b/codenet/public_test_cases/p00664/output.1.txt @@ -0,0 +1,3 @@ +4 +13 +8 diff --git a/codenet/public_test_cases/p00665/input.0.txt b/codenet/public_test_cases/p00665/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7042470cedaed779fa41befc02992d8167f54b7c --- /dev/null +++ b/codenet/public_test_cases/p00665/input.0.txt @@ -0,0 +1,76 @@ +4 1 3 4 +yskwcnt 16 +akzakr 7 +tsnukk 12 +fnmyi 13 +akzakr +4 1 3 5 +akzakr 7 +tsnukk 12 +fnmyi 13 +yskwcnt 16 +akzakr +4 2 2 1 +akzakr 4 +tsnukk 6 +yskwcnt 6 +fnmyi 12 +akzakr +fnmyi +5 2 3 28 +knmmdk 6 +skrkyk 14 +tmemm 14 +akmhmr 15 +mksyk 25 +knmmdk +skrkyk +5 2 3 11 +tmemm 12 +skrkyk 18 +knmmdk 21 +mksyk 23 +akmhmr 42 +skrkyk +tmemm +14 5 10 38 +iormns 19 +hbkgnh 23 +yyitktk 31 +rtkakzk 36 +mmftm 43 +ykhhgwr 65 +hrkamm 66 +ktrotns 67 +mktkkc 68 +mkhsi 69 +azsmur 73 +tknsj 73 +amftm 81 +chyksrg 88 +mkhsi +hbkgnh +mktkkc +yyitktk +tknsj +14 5 10 38 +mktkkc 24 +rtkakzk 25 +ykhhgwr 25 +hrkamm 27 +amftm 37 +iormns 38 +tknsj 38 +yyitktk 39 +hbkgnh 53 +mmftm 53 +chyksrg 63 +ktrotns 63 +azsmur 65 +mkhsi 76 +mkhsi +hbkgnh +mktkkc +yyitktk +tknsj +0 0 0 0 diff --git a/codenet/public_test_cases/p00665/input.1.txt b/codenet/public_test_cases/p00665/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7042470cedaed779fa41befc02992d8167f54b7c --- /dev/null +++ b/codenet/public_test_cases/p00665/input.1.txt @@ -0,0 +1,76 @@ +4 1 3 4 +yskwcnt 16 +akzakr 7 +tsnukk 12 +fnmyi 13 +akzakr +4 1 3 5 +akzakr 7 +tsnukk 12 +fnmyi 13 +yskwcnt 16 +akzakr +4 2 2 1 +akzakr 4 +tsnukk 6 +yskwcnt 6 +fnmyi 12 +akzakr +fnmyi +5 2 3 28 +knmmdk 6 +skrkyk 14 +tmemm 14 +akmhmr 15 +mksyk 25 +knmmdk +skrkyk +5 2 3 11 +tmemm 12 +skrkyk 18 +knmmdk 21 +mksyk 23 +akmhmr 42 +skrkyk +tmemm +14 5 10 38 +iormns 19 +hbkgnh 23 +yyitktk 31 +rtkakzk 36 +mmftm 43 +ykhhgwr 65 +hrkamm 66 +ktrotns 67 +mktkkc 68 +mkhsi 69 +azsmur 73 +tknsj 73 +amftm 81 +chyksrg 88 +mkhsi +hbkgnh +mktkkc +yyitktk +tknsj +14 5 10 38 +mktkkc 24 +rtkakzk 25 +ykhhgwr 25 +hrkamm 27 +amftm 37 +iormns 38 +tknsj 38 +yyitktk 39 +hbkgnh 53 +mmftm 53 +chyksrg 63 +ktrotns 63 +azsmur 65 +mkhsi 76 +mkhsi +hbkgnh +mktkkc +yyitktk +tknsj +0 0 0 0 diff --git a/codenet/public_test_cases/p00665/output.0.txt b/codenet/public_test_cases/p00665/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c179e3bd3cf6d128352e1e9aebb2fff2006d2f7a --- /dev/null +++ b/codenet/public_test_cases/p00665/output.0.txt @@ -0,0 +1,7 @@ +0 +1 +1 +2 +1 +4 +5 diff --git a/codenet/public_test_cases/p00665/output.1.txt b/codenet/public_test_cases/p00665/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c179e3bd3cf6d128352e1e9aebb2fff2006d2f7a --- /dev/null +++ b/codenet/public_test_cases/p00665/output.1.txt @@ -0,0 +1,7 @@ +0 +1 +1 +2 +1 +4 +5 diff --git a/codenet/public_test_cases/p00666/input.0.txt b/codenet/public_test_cases/p00666/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fd53e777bcb3565e6d9c6927cb7f01a0be9268b --- /dev/null +++ b/codenet/public_test_cases/p00666/input.0.txt @@ -0,0 +1,29 @@ +4 +0.200 3 0.500 +0.100 0 0.400 +0.900 1 1.000 +0.400 2 0.600 +2 +0.600 1 0.800 +0.500 0 1.000 +9 +0.200 7 0.600 +0.400 0 0.500 +0.700 8 1.000 +0.100 4 0.400 +0.200 2 0.600 +0.100 6 0.400 +0.100 5 0.400 +0.600 3 0.900 +0.500 1 0.900 +9 +0.300 8 0.900 +0.700 3 0.800 +0.300 0 0.900 +0.700 6 0.800 +0.200 5 0.700 +0.200 2 0.700 +0.700 4 0.800 +0.700 1 0.800 +0.300 7 0.900 +0 diff --git a/codenet/public_test_cases/p00666/input.1.txt b/codenet/public_test_cases/p00666/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fd53e777bcb3565e6d9c6927cb7f01a0be9268b --- /dev/null +++ b/codenet/public_test_cases/p00666/input.1.txt @@ -0,0 +1,29 @@ +4 +0.200 3 0.500 +0.100 0 0.400 +0.900 1 1.000 +0.400 2 0.600 +2 +0.600 1 0.800 +0.500 0 1.000 +9 +0.200 7 0.600 +0.400 0 0.500 +0.700 8 1.000 +0.100 4 0.400 +0.200 2 0.600 +0.100 6 0.400 +0.100 5 0.400 +0.600 3 0.900 +0.500 1 0.900 +9 +0.300 8 0.900 +0.700 3 0.800 +0.300 0 0.900 +0.700 6 0.800 +0.200 5 0.700 +0.200 2 0.700 +0.700 4 0.800 +0.700 1 0.800 +0.300 7 0.900 +0 diff --git a/codenet/public_test_cases/p00666/output.0.txt b/codenet/public_test_cases/p00666/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea52a20b9fdb418d5001ca171f47bd74dc3372dc --- /dev/null +++ b/codenet/public_test_cases/p00666/output.0.txt @@ -0,0 +1,4 @@ +7.27777777778 1 +2.66666666667 1 +23.98412698413 72 +11.36904761905 4 diff --git a/codenet/public_test_cases/p00666/output.1.txt b/codenet/public_test_cases/p00666/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea52a20b9fdb418d5001ca171f47bd74dc3372dc --- /dev/null +++ b/codenet/public_test_cases/p00666/output.1.txt @@ -0,0 +1,4 @@ +7.27777777778 1 +2.66666666667 1 +23.98412698413 72 +11.36904761905 4 diff --git a/codenet/public_test_cases/p00667/input.0.txt b/codenet/public_test_cases/p00667/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55d778e9445e663559d70495aecd9655fe7a481b --- /dev/null +++ b/codenet/public_test_cases/p00667/input.0.txt @@ -0,0 +1,15 @@ +1 +11 +111111 +111111111111 +12345 +11111111119999999999 +11111111113333333333 +11111111118888888888 +11111111112222222222111111111 +11111111110000000000444444444 +11224111122411 +888888888888999999999999888888888888999999999999999999 +666666666666666777333333333338888888888 +1111114444441111111444499999931111111222222222222888111111115555 +# diff --git a/codenet/public_test_cases/p00667/input.1.txt b/codenet/public_test_cases/p00667/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bedeb1fe45b9c5ce1c1552935726004fe0fe960 --- /dev/null +++ b/codenet/public_test_cases/p00667/input.1.txt @@ -0,0 +1,14 @@ +1 +11 +111111 +111111111111 +12345 +11111111119999999999 +11111111113333333333 +11111111118888888888 +11111111112222222222111111111 +11111111110000000000444444444 +11224111122411 +888888888888999999999999888888888888999999999999999999 +666666666666666777333333333338888888888 +1111114444441111111444499999931111111222222222222888111111115555 diff --git a/codenet/public_test_cases/p00667/input.2.txt b/codenet/public_test_cases/p00667/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..55d778e9445e663559d70495aecd9655fe7a481b --- /dev/null +++ b/codenet/public_test_cases/p00667/input.2.txt @@ -0,0 +1,15 @@ +1 +11 +111111 +111111111111 +12345 +11111111119999999999 +11111111113333333333 +11111111118888888888 +11111111112222222222111111111 +11111111110000000000444444444 +11224111122411 +888888888888999999999999888888888888999999999999999999 +666666666666666777333333333338888888888 +1111114444441111111444499999931111111222222222222888111111115555 +# diff --git a/codenet/public_test_cases/p00667/output.0.txt b/codenet/public_test_cases/p00667/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bcd0989e5f83b96b6c2342cb4d629265c71322f --- /dev/null +++ b/codenet/public_test_cases/p00667/output.0.txt @@ -0,0 +1,14 @@ +1 +2 +32 +1856 +1 +230400 +230400 +156480 +56217600 +38181120 +128 +26681431 +61684293 +40046720 diff --git a/codenet/public_test_cases/p00667/output.1.txt b/codenet/public_test_cases/p00667/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bcd0989e5f83b96b6c2342cb4d629265c71322f --- /dev/null +++ b/codenet/public_test_cases/p00667/output.1.txt @@ -0,0 +1,14 @@ +1 +2 +32 +1856 +1 +230400 +230400 +156480 +56217600 +38181120 +128 +26681431 +61684293 +40046720 diff --git a/codenet/public_test_cases/p00667/output.2.txt b/codenet/public_test_cases/p00667/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bcd0989e5f83b96b6c2342cb4d629265c71322f --- /dev/null +++ b/codenet/public_test_cases/p00667/output.2.txt @@ -0,0 +1,14 @@ +1 +2 +32 +1856 +1 +230400 +230400 +156480 +56217600 +38181120 +128 +26681431 +61684293 +40046720 diff --git a/codenet/public_test_cases/p00668/input.0.txt b/codenet/public_test_cases/p00668/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..358635d801123c41784d24eff1db2fd1aa6d0f5b --- /dev/null +++ b/codenet/public_test_cases/p00668/input.0.txt @@ -0,0 +1,86 @@ +22 5 +0 0 +0 1 +0 2 +0 3 +0 4 +2 1 +2 2 +2 3 +2 4 +2 5 +0 5 +2 1 +0 6 +2 2 +3 3 +2 2 +2 2 +1 2 +2 2 +2 1 +2 2 +2 3 +30 5 +0 383594529 +1 1 +0 868094164 +0 708344471 +0 4102559 +0 944076771 +0 320398558 +1 1 +0 949521499 +0 1035499529 +0 585547493 +0 915496840 +0 721553343 +0 405934659 +0 814301872 +1 1 +2 3 +0 919753364 +1 1 +0 69231610 +2 2 +0 373477673 +0 842917649 +0 961543702 +0 907959899 +2 1 +2 2 +2 3 +2 4 +2 5 +30 5 +0 726736645 +0 1 +0 344304573 +0 241734870 +3 726736645 +1 3 +2 1 +0 586879203 +2 3 +0 511883046 +0 481344051 +0 154183395 +0 435126242 +0 185906768 +1 1 +0 383123551 +0 20253038 +1 5 +2 1 +2 2 +0 163044554 +3 435126242 +0 105612613 +0 725050544 +0 559442328 +2 1 +2 2 +2 3 +2 4 +2 5 +0 0 diff --git a/codenet/public_test_cases/p00668/input.1.txt b/codenet/public_test_cases/p00668/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..358635d801123c41784d24eff1db2fd1aa6d0f5b --- /dev/null +++ b/codenet/public_test_cases/p00668/input.1.txt @@ -0,0 +1,86 @@ +22 5 +0 0 +0 1 +0 2 +0 3 +0 4 +2 1 +2 2 +2 3 +2 4 +2 5 +0 5 +2 1 +0 6 +2 2 +3 3 +2 2 +2 2 +1 2 +2 2 +2 1 +2 2 +2 3 +30 5 +0 383594529 +1 1 +0 868094164 +0 708344471 +0 4102559 +0 944076771 +0 320398558 +1 1 +0 949521499 +0 1035499529 +0 585547493 +0 915496840 +0 721553343 +0 405934659 +0 814301872 +1 1 +2 3 +0 919753364 +1 1 +0 69231610 +2 2 +0 373477673 +0 842917649 +0 961543702 +0 907959899 +2 1 +2 2 +2 3 +2 4 +2 5 +30 5 +0 726736645 +0 1 +0 344304573 +0 241734870 +3 726736645 +1 3 +2 1 +0 586879203 +2 3 +0 511883046 +0 481344051 +0 154183395 +0 435126242 +0 185906768 +1 1 +0 383123551 +0 20253038 +1 5 +2 1 +2 2 +0 163044554 +3 435126242 +0 105612613 +0 725050544 +0 559442328 +2 1 +2 2 +2 3 +2 4 +2 5 +0 0 diff --git a/codenet/public_test_cases/p00668/output.0.txt b/codenet/public_test_cases/p00668/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75e29b4a2b5abe7db0b9f88d393c0efd1a2de02a --- /dev/null +++ b/codenet/public_test_cases/p00668/output.0.txt @@ -0,0 +1,32 @@ +0 +1 +2 +3 +4 +1 +3 +4 +4 +5 +2 +5 +6 +end +405934659 +405934659 +69231610 +373477673 +842917649 +961543702 +907959899 +end +1 +586879203 +154183395 +435126242 +383123551 +163044554 +105612613 +725050544 +559442328 +end diff --git a/codenet/public_test_cases/p00668/output.1.txt b/codenet/public_test_cases/p00668/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75e29b4a2b5abe7db0b9f88d393c0efd1a2de02a --- /dev/null +++ b/codenet/public_test_cases/p00668/output.1.txt @@ -0,0 +1,32 @@ +0 +1 +2 +3 +4 +1 +3 +4 +4 +5 +2 +5 +6 +end +405934659 +405934659 +69231610 +373477673 +842917649 +961543702 +907959899 +end +1 +586879203 +154183395 +435126242 +383123551 +163044554 +105612613 +725050544 +559442328 +end diff --git a/codenet/public_test_cases/p00669/input.0.txt b/codenet/public_test_cases/p00669/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66a630ee069f1942172a27af7e6a4e0edf521ac3 --- /dev/null +++ b/codenet/public_test_cases/p00669/input.0.txt @@ -0,0 +1,6 @@ +4 2 +2 +3 +7 +5 +0 0 diff --git a/codenet/public_test_cases/p00669/input.1.txt b/codenet/public_test_cases/p00669/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..66a630ee069f1942172a27af7e6a4e0edf521ac3 --- /dev/null +++ b/codenet/public_test_cases/p00669/input.1.txt @@ -0,0 +1,6 @@ +4 2 +2 +3 +7 +5 +0 0 diff --git a/codenet/public_test_cases/p00669/output.0.txt b/codenet/public_test_cases/p00669/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00669/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00669/output.1.txt b/codenet/public_test_cases/p00669/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00669/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00670/input.0.txt b/codenet/public_test_cases/p00670/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e85826313fd06452c1b657c3fc96296989f27a6 --- /dev/null +++ b/codenet/public_test_cases/p00670/input.0.txt @@ -0,0 +1,5 @@ +3 7 +1 +3 +10 +0 0 diff --git a/codenet/public_test_cases/p00670/input.1.txt b/codenet/public_test_cases/p00670/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e85826313fd06452c1b657c3fc96296989f27a6 --- /dev/null +++ b/codenet/public_test_cases/p00670/input.1.txt @@ -0,0 +1,5 @@ +3 7 +1 +3 +10 +0 0 diff --git a/codenet/public_test_cases/p00670/output.0.txt b/codenet/public_test_cases/p00670/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00670/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00670/output.1.txt b/codenet/public_test_cases/p00670/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00670/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00671/input.0.txt b/codenet/public_test_cases/p00671/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae64b4127fa45b9422114e88c2efa9dec3aee212 --- /dev/null +++ b/codenet/public_test_cases/p00671/input.0.txt @@ -0,0 +1,36 @@ +5 5 10 2 +1 1 0 1 1 +0 9 1 0 1 +1 1 1 9 1 +1 1 9 0 1 +1 1 1 1 0 +1 1 0 1 1 +0 9 1 0 1 +1 1 1 9 1 +1 1 1 0 1 +1 1 1 1 0 +1 1 10 0 +3 +7 +1 1 5 0 +3 +6 +1 2 10 1 +6 7 +5 6 +2 1 10 1 +4 +8 +3 +7 +2 1 10 0 +4 +8 +3 +7 +2 1 5 0 +4 +8 +3 +6 +0 0 0 0 diff --git a/codenet/public_test_cases/p00671/input.1.txt b/codenet/public_test_cases/p00671/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae64b4127fa45b9422114e88c2efa9dec3aee212 --- /dev/null +++ b/codenet/public_test_cases/p00671/input.1.txt @@ -0,0 +1,36 @@ +5 5 10 2 +1 1 0 1 1 +0 9 1 0 1 +1 1 1 9 1 +1 1 9 0 1 +1 1 1 1 0 +1 1 0 1 1 +0 9 1 0 1 +1 1 1 9 1 +1 1 1 0 1 +1 1 1 1 0 +1 1 10 0 +3 +7 +1 1 5 0 +3 +6 +1 2 10 1 +6 7 +5 6 +2 1 10 1 +4 +8 +3 +7 +2 1 10 0 +4 +8 +3 +7 +2 1 5 0 +4 +8 +3 +6 +0 0 0 0 diff --git a/codenet/public_test_cases/p00671/output.0.txt b/codenet/public_test_cases/p00671/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3db76c52b45cbb10f4e586d40156f9c126b2284f --- /dev/null +++ b/codenet/public_test_cases/p00671/output.0.txt @@ -0,0 +1,7 @@ +18 +3 +0 +7 +12 +8 +4 diff --git a/codenet/public_test_cases/p00671/output.1.txt b/codenet/public_test_cases/p00671/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3db76c52b45cbb10f4e586d40156f9c126b2284f --- /dev/null +++ b/codenet/public_test_cases/p00671/output.1.txt @@ -0,0 +1,7 @@ +18 +3 +0 +7 +12 +8 +4 diff --git a/codenet/public_test_cases/p00672/input.0.txt b/codenet/public_test_cases/p00672/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de6f5a7ec0378c954a6e8f7003d18e552da5cc23 --- /dev/null +++ b/codenet/public_test_cases/p00672/input.0.txt @@ -0,0 +1,63 @@ +2 3 2 +length +1 0 +time +0 1 +speed +1 -1 +a/b +a length +b time +2 3 3 +length +1 0 +time +0 1 +speed +1 -1 +a/b+c +a length +b time +c speed +2 3 3 +length +1 0 +time +0 1 +speed +1 -1 +a/b+c +a length +b time +c time +2 3 2 +length +1 0 +time +0 1 +speed +1 -1 +a/b/b +a length +b time +3 6 6 +speed +1 -1 0 +acceleration +1 -2 0 +force +1 -2 1 +length +1 0 0 +time +0 1 0 +weight +0 0 1 +((v+l/t)+a*t)/(t*t)*w*t+f+w*a +v speed +l length +a acceleration +t time +w weight +f force +0 0 0 diff --git a/codenet/public_test_cases/p00672/input.1.txt b/codenet/public_test_cases/p00672/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de6f5a7ec0378c954a6e8f7003d18e552da5cc23 --- /dev/null +++ b/codenet/public_test_cases/p00672/input.1.txt @@ -0,0 +1,63 @@ +2 3 2 +length +1 0 +time +0 1 +speed +1 -1 +a/b +a length +b time +2 3 3 +length +1 0 +time +0 1 +speed +1 -1 +a/b+c +a length +b time +c speed +2 3 3 +length +1 0 +time +0 1 +speed +1 -1 +a/b+c +a length +b time +c time +2 3 2 +length +1 0 +time +0 1 +speed +1 -1 +a/b/b +a length +b time +3 6 6 +speed +1 -1 0 +acceleration +1 -2 0 +force +1 -2 1 +length +1 0 0 +time +0 1 0 +weight +0 0 1 +((v+l/t)+a*t)/(t*t)*w*t+f+w*a +v speed +l length +a acceleration +t time +w weight +f force +0 0 0 diff --git a/codenet/public_test_cases/p00672/output.0.txt b/codenet/public_test_cases/p00672/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0786a60c473843ba8fa735ac1d9f0b952d822f31 --- /dev/null +++ b/codenet/public_test_cases/p00672/output.0.txt @@ -0,0 +1,5 @@ +speed +speed +error +undefined +force diff --git a/codenet/public_test_cases/p00672/output.1.txt b/codenet/public_test_cases/p00672/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0786a60c473843ba8fa735ac1d9f0b952d822f31 --- /dev/null +++ b/codenet/public_test_cases/p00672/output.1.txt @@ -0,0 +1,5 @@ +speed +speed +error +undefined +force diff --git a/codenet/public_test_cases/p00673/input.0.txt b/codenet/public_test_cases/p00673/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4127f1977d7cc8f1fa4c6a7e6ba4fbb106b3e44a --- /dev/null +++ b/codenet/public_test_cases/p00673/input.0.txt @@ -0,0 +1,17 @@ +2 +4 +1 2 10 +2 2 5 +1 3 20 +2 3 10 +10 +3 +2 +1 2 5 +0 3 4 +3 +10 11 100 +2 12 2 +12 12 3 +10 +0 diff --git a/codenet/public_test_cases/p00673/input.1.txt b/codenet/public_test_cases/p00673/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4127f1977d7cc8f1fa4c6a7e6ba4fbb106b3e44a --- /dev/null +++ b/codenet/public_test_cases/p00673/input.1.txt @@ -0,0 +1,17 @@ +2 +4 +1 2 10 +2 2 5 +1 3 20 +2 3 10 +10 +3 +2 +1 2 5 +0 3 4 +3 +10 11 100 +2 12 2 +12 12 3 +10 +0 diff --git a/codenet/public_test_cases/p00673/output.0.txt b/codenet/public_test_cases/p00673/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac2c8ace99a52ec833ea5cbe37d920888ebb2dc6 --- /dev/null +++ b/codenet/public_test_cases/p00673/output.0.txt @@ -0,0 +1,2 @@ +2 15 +2 111 diff --git a/codenet/public_test_cases/p00673/output.1.txt b/codenet/public_test_cases/p00673/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac2c8ace99a52ec833ea5cbe37d920888ebb2dc6 --- /dev/null +++ b/codenet/public_test_cases/p00673/output.1.txt @@ -0,0 +1,2 @@ +2 15 +2 111 diff --git a/codenet/public_test_cases/p00674/input.0.txt b/codenet/public_test_cases/p00674/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80d5864f6b145b4450c6104281965a7e345f99ce --- /dev/null +++ b/codenet/public_test_cases/p00674/input.0.txt @@ -0,0 +1,31 @@ +4 +-100 -100 +100 -100 +100 100 +-100 100 +4 +-99 -100 +100 -100 +100 100 +-99 100 +4 +-100 -99 +100 -99 +100 100 +-100 100 +14 +-99 -70 +-92 -79 +10 -98 +37 -100 +62 -95 +77 -69 +88 -47 +92 -10 +96 28 +100 91 +42 92 +-62 92 +-88 91 +-98 64 +0 diff --git a/codenet/public_test_cases/p00674/input.1.txt b/codenet/public_test_cases/p00674/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..80d5864f6b145b4450c6104281965a7e345f99ce --- /dev/null +++ b/codenet/public_test_cases/p00674/input.1.txt @@ -0,0 +1,31 @@ +4 +-100 -100 +100 -100 +100 100 +-100 100 +4 +-99 -100 +100 -100 +100 100 +-99 100 +4 +-100 -99 +100 -99 +100 100 +-100 100 +14 +-99 -70 +-92 -79 +10 -98 +37 -100 +62 -95 +77 -69 +88 -47 +92 -10 +96 28 +100 91 +42 92 +-62 92 +-88 91 +-98 64 +0 diff --git a/codenet/public_test_cases/p00674/output.0.txt b/codenet/public_test_cases/p00674/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0302c12abd34465a5a2ffeb97c6ed60a9c3857e5 --- /dev/null +++ b/codenet/public_test_cases/p00674/output.0.txt @@ -0,0 +1,4 @@ +100.000000000000000 0.000000000000000 +100.000000000000000 0.000000000000000 +0.000000000000000 100.000000000000000 +-96.983291994836122 66.745111613942484 diff --git a/codenet/public_test_cases/p00674/output.1.txt b/codenet/public_test_cases/p00674/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0302c12abd34465a5a2ffeb97c6ed60a9c3857e5 --- /dev/null +++ b/codenet/public_test_cases/p00674/output.1.txt @@ -0,0 +1,4 @@ +100.000000000000000 0.000000000000000 +100.000000000000000 0.000000000000000 +0.000000000000000 100.000000000000000 +-96.983291994836122 66.745111613942484 diff --git a/codenet/public_test_cases/p00675/input.0.txt b/codenet/public_test_cases/p00675/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23b9a625b4d6061a38d0cbbb20c8373b5ffaea16 --- /dev/null +++ b/codenet/public_test_cases/p00675/input.0.txt @@ -0,0 +1,65 @@ +2 +1 +1 +2 +1 2 1 +2 1 1 +1 +1111 +2 +1 +1 +2 +1 2 1 +2 1 1 +1 +11 +2 +1 +1 +2 +1 2 1 +2 1 1 +10 +1111 +2 +1 +1 +2 +1 2 1 +2 1 1 +10 +111111 +2 +1 +1 +2 +1 2 -1 +2 1 0 +10 +11 +2 +1 +1 +2 +1 2 -1 +2 1 0 +10 +1111 +2 +1 +1 +2 +1 2 -1 +2 1 0 +10 +12 +2 +1 +1 +2 +1 2 -1 +2 1 0 +10 +1111111111 +0 diff --git a/codenet/public_test_cases/p00675/input.1.txt b/codenet/public_test_cases/p00675/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..23b9a625b4d6061a38d0cbbb20c8373b5ffaea16 --- /dev/null +++ b/codenet/public_test_cases/p00675/input.1.txt @@ -0,0 +1,65 @@ +2 +1 +1 +2 +1 2 1 +2 1 1 +1 +1111 +2 +1 +1 +2 +1 2 1 +2 1 1 +1 +11 +2 +1 +1 +2 +1 2 1 +2 1 1 +10 +1111 +2 +1 +1 +2 +1 2 1 +2 1 1 +10 +111111 +2 +1 +1 +2 +1 2 -1 +2 1 0 +10 +11 +2 +1 +1 +2 +1 2 -1 +2 1 0 +10 +1111 +2 +1 +1 +2 +1 2 -1 +2 1 0 +10 +12 +2 +1 +1 +2 +1 2 -1 +2 1 0 +10 +1111111111 +0 diff --git a/codenet/public_test_cases/p00675/output.0.txt b/codenet/public_test_cases/p00675/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e64c4563d68730052696c18171dcca4d00741bf --- /dev/null +++ b/codenet/public_test_cases/p00675/output.0.txt @@ -0,0 +1,8 @@ +1 1 +0 0 +1 1 +2 4 +0 0 +1 -1 +-1 +4 -10 diff --git a/codenet/public_test_cases/p00675/output.1.txt b/codenet/public_test_cases/p00675/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e64c4563d68730052696c18171dcca4d00741bf --- /dev/null +++ b/codenet/public_test_cases/p00675/output.1.txt @@ -0,0 +1,8 @@ +1 1 +0 0 +1 1 +2 4 +0 0 +1 -1 +-1 +4 -10 diff --git a/codenet/public_test_cases/p00676/input.0.txt b/codenet/public_test_cases/p00676/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..adf92cb3e76a942148329a51499ee03e76fc3adb --- /dev/null +++ b/codenet/public_test_cases/p00676/input.0.txt @@ -0,0 +1,4 @@ +2 2 1 +2 3 1 +3 2 3 +2 3 5 diff --git a/codenet/public_test_cases/p00676/input.1.txt b/codenet/public_test_cases/p00676/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..adf92cb3e76a942148329a51499ee03e76fc3adb --- /dev/null +++ b/codenet/public_test_cases/p00676/input.1.txt @@ -0,0 +1,4 @@ +2 2 1 +2 3 1 +3 2 3 +2 3 5 diff --git a/codenet/public_test_cases/p00676/output.0.txt b/codenet/public_test_cases/p00676/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd96a9a8ba5edb56b8dac0fdcdfb3beb7cc8341c --- /dev/null +++ b/codenet/public_test_cases/p00676/output.0.txt @@ -0,0 +1,4 @@ +3.9681187851 +6.7970540913 +6.5668891783 +13.9527248554 diff --git a/codenet/public_test_cases/p00676/output.1.txt b/codenet/public_test_cases/p00676/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd96a9a8ba5edb56b8dac0fdcdfb3beb7cc8341c --- /dev/null +++ b/codenet/public_test_cases/p00676/output.1.txt @@ -0,0 +1,4 @@ +3.9681187851 +6.7970540913 +6.5668891783 +13.9527248554 diff --git a/codenet/public_test_cases/p00677/input.0.txt b/codenet/public_test_cases/p00677/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e8783c3f141ca1df1347acc98239908bfb15e82 --- /dev/null +++ b/codenet/public_test_cases/p00677/input.0.txt @@ -0,0 +1,13 @@ +3 3 100 +2 +5 20 3 10 +2 +10 50 12 60 +2 +8 30 22 100 +0 1 2 + +1 1 30 +1 +13 8 +0 diff --git a/codenet/public_test_cases/p00677/input.1.txt b/codenet/public_test_cases/p00677/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e8783c3f141ca1df1347acc98239908bfb15e82 --- /dev/null +++ b/codenet/public_test_cases/p00677/input.1.txt @@ -0,0 +1,13 @@ +3 3 100 +2 +5 20 3 10 +2 +10 50 12 60 +2 +8 30 22 100 +0 1 2 + +1 1 30 +1 +13 8 +0 diff --git a/codenet/public_test_cases/p00677/output.0.txt b/codenet/public_test_cases/p00677/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4f3047e7049bfaa0fc79eec6a54ce6bfe0e0bb7 --- /dev/null +++ b/codenet/public_test_cases/p00677/output.0.txt @@ -0,0 +1,2 @@ +23 100 +13 8 diff --git a/codenet/public_test_cases/p00677/output.1.txt b/codenet/public_test_cases/p00677/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4f3047e7049bfaa0fc79eec6a54ce6bfe0e0bb7 --- /dev/null +++ b/codenet/public_test_cases/p00677/output.1.txt @@ -0,0 +1,2 @@ +23 100 +13 8 diff --git a/codenet/public_test_cases/p00678/input.0.txt b/codenet/public_test_cases/p00678/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..79154438ebb615be8303af92ae5906687a2c0571 --- /dev/null +++ b/codenet/public_test_cases/p00678/input.0.txt @@ -0,0 +1,9 @@ +2 +1 1 1 +2 2 1 +4 +1 1 3 +3 1 3 +4 2 1 +1 5 3 +0 diff --git a/codenet/public_test_cases/p00678/input.1.txt b/codenet/public_test_cases/p00678/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..79154438ebb615be8303af92ae5906687a2c0571 --- /dev/null +++ b/codenet/public_test_cases/p00678/input.1.txt @@ -0,0 +1,9 @@ +2 +1 1 1 +2 2 1 +4 +1 1 3 +3 1 3 +4 2 1 +1 5 3 +0 diff --git a/codenet/public_test_cases/p00678/output.0.txt b/codenet/public_test_cases/p00678/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1529211d0826984cb71545a429582183bc2fe37c --- /dev/null +++ b/codenet/public_test_cases/p00678/output.0.txt @@ -0,0 +1,2 @@ +0.70710678 +1.06066017 diff --git a/codenet/public_test_cases/p00678/output.1.txt b/codenet/public_test_cases/p00678/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1529211d0826984cb71545a429582183bc2fe37c --- /dev/null +++ b/codenet/public_test_cases/p00678/output.1.txt @@ -0,0 +1,2 @@ +0.70710678 +1.06066017 diff --git a/codenet/public_test_cases/p00679/input.0.txt b/codenet/public_test_cases/p00679/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b9514ef032cbd7679ee751c5775411d06fedee8 --- /dev/null +++ b/codenet/public_test_cases/p00679/input.0.txt @@ -0,0 +1,13 @@ +3 2 +0 0 0 +1 1 1 +2 2 2 +4 +-1 -1 -1 +3 3 3 +-1 -1 -1 +4 4 4 +2 +1234 5678 9012 +1716 6155 9455 +0 0 diff --git a/codenet/public_test_cases/p00679/output.0.txt b/codenet/public_test_cases/p00679/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..39ad5cc443890158cc99a3c653e7872aa950817c --- /dev/null +++ b/codenet/public_test_cases/p00679/output.0.txt @@ -0,0 +1,2 @@ +12.124355653 +810.001234567 diff --git a/codenet/public_test_cases/p00680/input.0.txt b/codenet/public_test_cases/p00680/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db4d186989b5358f66ed3ba2fef7e98d0383c239 --- /dev/null +++ b/codenet/public_test_cases/p00680/input.0.txt @@ -0,0 +1,64 @@ +3 +3 0 2 5 +1 1 1 6 +3 2 1 10 +1 -2 3 6 +2 +1 2 +3 3 +1 +2 +3 +0 +3 0 2 5 +1 1 1 6 +3 2 1 10 +1 -2 3 6 +2 +1 2 +2 2 +1 +2 +2 +0 +10 2 7 20 +8 9 -5 6 -9 5 1 0 4 9 4 +3 -1 -8 0 -5 4 3 0 -3 2 4 +-4 5 8 -4 1 -8 -6 3 3 5 -7 +-7 0 2 5 8 -5 -9 -8 1 -2 -1 +3 8 1 -3 8 2 -5 8 -3 4 -4 +-2 5 0 -2 -4 4 -3 9 6 -1 -2 +4 1 2 -9 3 5 6 -4 4 -1 -4 +-4 6 6 9 -2 1 -9 -3 -7 3 -4 +1 -1 6 3 1 -5 9 5 -5 -9 -5 +-7 4 6 8 8 4 -4 4 -7 -8 -5 +5 +1 5 0 6 3 +15 17 14 7 15 +3 +1 5 7 +6 8 14 +10 +3 5 3 5 9 5 9 5 1 4 +12 6 16 11 16 7 9 3 13 13 +10 +9 1 5 6 2 5 8 5 9 4 +15 8 8 14 13 13 18 1 12 11 +5 +3 5 0 4 6 +14 15 4 14 11 +9 +5 0 6 2 7 8 8 6 6 +6 5 7 17 17 17 17 19 3 +9 +7 7 2 7 8 4 7 7 0 +4 13 16 10 19 17 19 12 19 +3 +1 5 1 +3 7 16 +8 +5 7 4 9 1 4 6 8 +4 3 6 12 6 19 10 1 +4 +1 3 6 3 +5 15 18 14 diff --git a/codenet/public_test_cases/p00680/input.1.txt b/codenet/public_test_cases/p00680/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db4d186989b5358f66ed3ba2fef7e98d0383c239 --- /dev/null +++ b/codenet/public_test_cases/p00680/input.1.txt @@ -0,0 +1,64 @@ +3 +3 0 2 5 +1 1 1 6 +3 2 1 10 +1 -2 3 6 +2 +1 2 +3 3 +1 +2 +3 +0 +3 0 2 5 +1 1 1 6 +3 2 1 10 +1 -2 3 6 +2 +1 2 +2 2 +1 +2 +2 +0 +10 2 7 20 +8 9 -5 6 -9 5 1 0 4 9 4 +3 -1 -8 0 -5 4 3 0 -3 2 4 +-4 5 8 -4 1 -8 -6 3 3 5 -7 +-7 0 2 5 8 -5 -9 -8 1 -2 -1 +3 8 1 -3 8 2 -5 8 -3 4 -4 +-2 5 0 -2 -4 4 -3 9 6 -1 -2 +4 1 2 -9 3 5 6 -4 4 -1 -4 +-4 6 6 9 -2 1 -9 -3 -7 3 -4 +1 -1 6 3 1 -5 9 5 -5 -9 -5 +-7 4 6 8 8 4 -4 4 -7 -8 -5 +5 +1 5 0 6 3 +15 17 14 7 15 +3 +1 5 7 +6 8 14 +10 +3 5 3 5 9 5 9 5 1 4 +12 6 16 11 16 7 9 3 13 13 +10 +9 1 5 6 2 5 8 5 9 4 +15 8 8 14 13 13 18 1 12 11 +5 +3 5 0 4 6 +14 15 4 14 11 +9 +5 0 6 2 7 8 8 6 6 +6 5 7 17 17 17 17 19 3 +9 +7 7 2 7 8 4 7 7 0 +4 13 16 10 19 17 19 12 19 +3 +1 5 1 +3 7 16 +8 +5 7 4 9 1 4 6 8 +4 3 6 12 6 19 10 1 +4 +1 3 6 3 +5 15 18 14 diff --git a/codenet/public_test_cases/p00680/output.0.txt b/codenet/public_test_cases/p00680/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..757158e2cb570e622280c2bf0aa60075763d4d71 --- /dev/null +++ b/codenet/public_test_cases/p00680/output.0.txt @@ -0,0 +1,3 @@ +10.0000000000 +impossible +11.9354380207 diff --git a/codenet/public_test_cases/p00680/output.1.txt b/codenet/public_test_cases/p00680/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..757158e2cb570e622280c2bf0aa60075763d4d71 --- /dev/null +++ b/codenet/public_test_cases/p00680/output.1.txt @@ -0,0 +1,3 @@ +10.0000000000 +impossible +11.9354380207 diff --git a/codenet/public_test_cases/p00681/input.0.txt b/codenet/public_test_cases/p00681/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e338546ea788f808339826101be7db0ee68753b --- /dev/null +++ b/codenet/public_test_cases/p00681/input.0.txt @@ -0,0 +1,27 @@ +3 3 + 0 0 +0 0 0 + 0 0 +0 0 1 + 0 1 +0 0 +0 1 +1 1 +2 2 +1 +5 5 + 0 1 0 0 +1 0 0 1 0 + 1 0 1 0 +0 1 0 0 1 + 0 1 1 0 +0 1 0 1 0 + 1 1 1 0 +0 0 0 0 0 + 0 0 1 1 +0 0 +1 0 +4 4 +0 1 +2 +0 0 diff --git a/codenet/public_test_cases/p00681/input.1.txt b/codenet/public_test_cases/p00681/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1129fbfe54297af97e766e1e7057e6e5c6e2dad0 --- /dev/null +++ b/codenet/public_test_cases/p00681/input.1.txt @@ -0,0 +1,27 @@ +3 3 +0 0 +0 0 0 +0 0 +0 0 1 +0 1 +0 0 +0 1 +1 1 +2 2 +1 +5 5 +0 1 0 0 +1 0 0 1 0 +1 0 1 0 +0 1 0 0 1 +0 1 1 0 +0 1 0 1 0 +1 1 1 0 +0 0 0 0 0 +0 0 1 1 +0 0 +1 0 +4 4 +0 1 +2 +0 0 diff --git a/codenet/public_test_cases/p00681/input.2.txt b/codenet/public_test_cases/p00681/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e338546ea788f808339826101be7db0ee68753b --- /dev/null +++ b/codenet/public_test_cases/p00681/input.2.txt @@ -0,0 +1,27 @@ +3 3 + 0 0 +0 0 0 + 0 0 +0 0 1 + 0 1 +0 0 +0 1 +1 1 +2 2 +1 +5 5 + 0 1 0 0 +1 0 0 1 0 + 1 0 1 0 +0 1 0 0 1 + 0 1 1 0 +0 1 0 1 0 + 1 1 1 0 +0 0 0 0 0 + 0 0 1 1 +0 0 +1 0 +4 4 +0 1 +2 +0 0 diff --git a/codenet/public_test_cases/p00681/output.0.txt b/codenet/public_test_cases/p00681/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18febc72d15f481d3d5ff77e1d3993cc9f8d8432 --- /dev/null +++ b/codenet/public_test_cases/p00681/output.0.txt @@ -0,0 +1,2 @@ +4 +15 diff --git a/codenet/public_test_cases/p00681/output.1.txt b/codenet/public_test_cases/p00681/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18febc72d15f481d3d5ff77e1d3993cc9f8d8432 --- /dev/null +++ b/codenet/public_test_cases/p00681/output.1.txt @@ -0,0 +1,2 @@ +4 +15 diff --git a/codenet/public_test_cases/p00681/output.2.txt b/codenet/public_test_cases/p00681/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..18febc72d15f481d3d5ff77e1d3993cc9f8d8432 --- /dev/null +++ b/codenet/public_test_cases/p00681/output.2.txt @@ -0,0 +1,2 @@ +4 +15 diff --git a/codenet/public_test_cases/p00682/input.0.txt b/codenet/public_test_cases/p00682/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..97156b9ca04da7d16e3829d89599167597f25e19 --- /dev/null +++ b/codenet/public_test_cases/p00682/input.0.txt @@ -0,0 +1,15 @@ +3 +1 1 +3 4 +6 0 + +7 +0 0 +10 10 +0 20 +10 30 +0 40 +100 40 +100 0 + +0 diff --git a/codenet/public_test_cases/p00682/input.1.txt b/codenet/public_test_cases/p00682/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97156b9ca04da7d16e3829d89599167597f25e19 --- /dev/null +++ b/codenet/public_test_cases/p00682/input.1.txt @@ -0,0 +1,15 @@ +3 +1 1 +3 4 +6 0 + +7 +0 0 +10 10 +0 20 +10 30 +0 40 +100 40 +100 0 + +0 diff --git a/codenet/public_test_cases/p00682/output.0.txt b/codenet/public_test_cases/p00682/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dc605169f552bd409a5146da52f81c725284799 --- /dev/null +++ b/codenet/public_test_cases/p00682/output.0.txt @@ -0,0 +1,2 @@ +1 8.5 +2 3800.0 diff --git a/codenet/public_test_cases/p00682/output.1.txt b/codenet/public_test_cases/p00682/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dc605169f552bd409a5146da52f81c725284799 --- /dev/null +++ b/codenet/public_test_cases/p00682/output.1.txt @@ -0,0 +1,2 @@ +1 8.5 +2 3800.0 diff --git a/codenet/public_test_cases/p00683/input.1.txt b/codenet/public_test_cases/p00683/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..158092b725ada4746ca887e59a71c06531c10229 --- /dev/null +++ b/codenet/public_test_cases/p00683/input.1.txt @@ -0,0 +1,26 @@ +3 +A sample input +9 +forward word +delete char +forward word +delete char +forward word +delete char +backward word +backward word +forward word +Hallow, Word. +7 +forward char +delete word +insert "ello, " +forward word +backward char +backward char +insert "l" + +3 +forward word +backward word +delete word diff --git a/codenet/public_test_cases/p00683/output.1.txt b/codenet/public_test_cases/p00683/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f25185c70cc9ed7ef907dc2a06698696d555e75f --- /dev/null +++ b/codenet/public_test_cases/p00683/output.1.txt @@ -0,0 +1,3 @@ +Asampleinput^ +Hello, Worl^d. +^ diff --git a/codenet/public_test_cases/p00684/input.0.txt b/codenet/public_test_cases/p00684/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..613d0dac898eb1f2c5e09bf69127589d4f771ddb --- /dev/null +++ b/codenet/public_test_cases/p00684/input.0.txt @@ -0,0 +1,4 @@ +(1-10*i)+00007+(3+10*i) +3+4*i*(4+10*i) +(102+10*i)*(99+10*i) +2*i+3+9999*i+4 diff --git a/codenet/public_test_cases/p00684/input.1.txt b/codenet/public_test_cases/p00684/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..613d0dac898eb1f2c5e09bf69127589d4f771ddb --- /dev/null +++ b/codenet/public_test_cases/p00684/input.1.txt @@ -0,0 +1,4 @@ +(1-10*i)+00007+(3+10*i) +3+4*i*(4+10*i) +(102+10*i)*(99+10*i) +2*i+3+9999*i+4 diff --git a/codenet/public_test_cases/p00684/output.0.txt b/codenet/public_test_cases/p00684/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..41f274ef9ba2652931e7c27f664699244d8af8b6 --- /dev/null +++ b/codenet/public_test_cases/p00684/output.0.txt @@ -0,0 +1,4 @@ +11 +-37+16i +9998+2010i +overflow diff --git a/codenet/public_test_cases/p00684/output.1.txt b/codenet/public_test_cases/p00684/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..41f274ef9ba2652931e7c27f664699244d8af8b6 --- /dev/null +++ b/codenet/public_test_cases/p00684/output.1.txt @@ -0,0 +1,4 @@ +11 +-37+16i +9998+2010i +overflow diff --git a/codenet/public_test_cases/p00685/input.1.txt b/codenet/public_test_cases/p00685/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b77146d3b62c8f484b6f51eded2f01f10870487 --- /dev/null +++ b/codenet/public_test_cases/p00685/input.1.txt @@ -0,0 +1,3 @@ +-2 1 -1 1 1 1 1 2 +1 0 2 1 2 2 3 3 +5 diff --git a/codenet/public_test_cases/p00685/output.1.txt b/codenet/public_test_cases/p00685/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4652308295b238bc90288cfd0662193b8186200 --- /dev/null +++ b/codenet/public_test_cases/p00685/output.1.txt @@ -0,0 +1,2 @@ +2 +15 diff --git a/codenet/public_test_cases/p00686/input.0.txt b/codenet/public_test_cases/p00686/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc8bd0951d2d5251e6387e114dea813ba50f5e8f --- /dev/null +++ b/codenet/public_test_cases/p00686/input.0.txt @@ -0,0 +1,11 @@ +6 5 +FORWARD 3 +RIGHT +FORWARD 5 +LEFT +BACKWARD 2 +STOP +3 1 +FORWARD 2 +STOP +0 0 diff --git a/codenet/public_test_cases/p00686/input.1.txt b/codenet/public_test_cases/p00686/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc8bd0951d2d5251e6387e114dea813ba50f5e8f --- /dev/null +++ b/codenet/public_test_cases/p00686/input.1.txt @@ -0,0 +1,11 @@ +6 5 +FORWARD 3 +RIGHT +FORWARD 5 +LEFT +BACKWARD 2 +STOP +3 1 +FORWARD 2 +STOP +0 0 diff --git a/codenet/public_test_cases/p00686/output.0.txt b/codenet/public_test_cases/p00686/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d51fbd88825d756c79d808e251125c21bc7a46cb --- /dev/null +++ b/codenet/public_test_cases/p00686/output.0.txt @@ -0,0 +1,2 @@ +6 2 +1 1 diff --git a/codenet/public_test_cases/p00686/output.1.txt b/codenet/public_test_cases/p00686/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d51fbd88825d756c79d808e251125c21bc7a46cb --- /dev/null +++ b/codenet/public_test_cases/p00686/output.1.txt @@ -0,0 +1,2 @@ +6 2 +1 1 diff --git a/codenet/public_test_cases/p00687/input.0.txt b/codenet/public_test_cases/p00687/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74100f7a9e2dabc693151fefdde5e7e3a71fce61 --- /dev/null +++ b/codenet/public_test_cases/p00687/input.0.txt @@ -0,0 +1,4 @@ +10 2 3 +10 2 5 +100 5 25 +0 0 0 diff --git a/codenet/public_test_cases/p00687/input.1.txt b/codenet/public_test_cases/p00687/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74100f7a9e2dabc693151fefdde5e7e3a71fce61 --- /dev/null +++ b/codenet/public_test_cases/p00687/input.1.txt @@ -0,0 +1,4 @@ +10 2 3 +10 2 5 +100 5 25 +0 0 0 diff --git a/codenet/public_test_cases/p00687/output.0.txt b/codenet/public_test_cases/p00687/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..96f23fe673723c0f27a12aad6d957cea2c49e55b --- /dev/null +++ b/codenet/public_test_cases/p00687/output.0.txt @@ -0,0 +1,3 @@ +1 +2 +80 diff --git a/codenet/public_test_cases/p00687/output.1.txt b/codenet/public_test_cases/p00687/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..96f23fe673723c0f27a12aad6d957cea2c49e55b --- /dev/null +++ b/codenet/public_test_cases/p00687/output.1.txt @@ -0,0 +1,3 @@ +1 +2 +80 diff --git a/codenet/public_test_cases/p00688/input.0.txt b/codenet/public_test_cases/p00688/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdaa9cfe157cedee3fe9576210868340b3a5c06c --- /dev/null +++ b/codenet/public_test_cases/p00688/input.0.txt @@ -0,0 +1,5 @@ +2 5 2 +1 1 1 +10 -7 0 +1 0 -3 +0 0 0 diff --git a/codenet/public_test_cases/p00688/input.1.txt b/codenet/public_test_cases/p00688/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdaa9cfe157cedee3fe9576210868340b3a5c06c --- /dev/null +++ b/codenet/public_test_cases/p00688/input.1.txt @@ -0,0 +1,5 @@ +2 5 2 +1 1 1 +10 -7 0 +1 0 -3 +0 0 0 diff --git a/codenet/public_test_cases/p00688/output.0.txt b/codenet/public_test_cases/p00688/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..955c3dc349a8fb32a8425dcb802e8fdb5278882d --- /dev/null +++ b/codenet/public_test_cases/p00688/output.0.txt @@ -0,0 +1,4 @@ +2 1 1 2 +Impossible +10 -7 1 0 +Impossible diff --git a/codenet/public_test_cases/p00688/output.1.txt b/codenet/public_test_cases/p00688/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..955c3dc349a8fb32a8425dcb802e8fdb5278882d --- /dev/null +++ b/codenet/public_test_cases/p00688/output.1.txt @@ -0,0 +1,4 @@ +2 1 1 2 +Impossible +10 -7 1 0 +Impossible diff --git a/codenet/public_test_cases/p00689/input.0.txt b/codenet/public_test_cases/p00689/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5ffc7320d8954b542769d055e10d806b449276e --- /dev/null +++ b/codenet/public_test_cases/p00689/input.0.txt @@ -0,0 +1,16 @@ +8 + 60 70 + 20 40 + 50 50 + 70 10 + 10 70 + 80 90 + 70 50 + 100 50 +5 + 60 50 + 0 80 + 60 20 + 10 20 + 60 80 +0 diff --git a/codenet/public_test_cases/p00689/output.0.txt b/codenet/public_test_cases/p00689/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9db4cc83c5f33591ceb008f73365bccb9b67b97f --- /dev/null +++ b/codenet/public_test_cases/p00689/output.0.txt @@ -0,0 +1,2 @@ +388.9 +250.0 diff --git a/codenet/public_test_cases/p00690/input.0.txt b/codenet/public_test_cases/p00690/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce200a572bcd760f9d98b048a48eff63983e734c --- /dev/null +++ b/codenet/public_test_cases/p00690/input.0.txt @@ -0,0 +1,18 @@ + 6 5 + 1 3 10 + 2 3 12 + 3 4 2 + 4 5 13 + 4 6 11 +10 10 + 1 2 11 + 2 3 25 + 2 5 81 + 2 6 82 + 4 5 58 + 5 9 68 + 6 7 80 + 6 9 67 + 8 9 44 + 9 10 21 + 0 0 diff --git a/codenet/public_test_cases/p00690/input.1.txt b/codenet/public_test_cases/p00690/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8924988caa55b8e9817d35b4868a0bb95aa0398c --- /dev/null +++ b/codenet/public_test_cases/p00690/input.1.txt @@ -0,0 +1,18 @@ +6 5 + 1 3 10 + 2 3 12 + 3 4 2 + 4 5 13 + 4 6 11 +10 10 + 1 2 11 + 2 3 25 + 2 5 81 + 2 6 82 + 4 5 58 + 5 9 68 + 6 7 80 + 6 9 67 + 8 9 44 + 9 10 21 + 0 0 diff --git a/codenet/public_test_cases/p00690/input.2.txt b/codenet/public_test_cases/p00690/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5652e35578d06fac55134fd254f8b55a5b05dfb1 --- /dev/null +++ b/codenet/public_test_cases/p00690/input.2.txt @@ -0,0 +1,18 @@ +6 5 +1 3 10 +2 3 12 +3 4 2 +4 5 13 +4 6 11 +10 10 +1 2 11 +2 3 25 +2 5 81 +2 6 82 +4 5 58 +5 9 68 +6 7 80 +6 9 67 +8 9 44 +9 10 21 +0 0 diff --git a/codenet/public_test_cases/p00690/output.0.txt b/codenet/public_test_cases/p00690/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8392cfcc9057e47b9c46f62d5bf22acec9f91bbc --- /dev/null +++ b/codenet/public_test_cases/p00690/output.0.txt @@ -0,0 +1,4 @@ +27 +2 3 4 5 +378 +6 2 5 9 6 7 diff --git a/codenet/public_test_cases/p00690/output.1.txt b/codenet/public_test_cases/p00690/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8392cfcc9057e47b9c46f62d5bf22acec9f91bbc --- /dev/null +++ b/codenet/public_test_cases/p00690/output.1.txt @@ -0,0 +1,4 @@ +27 +2 3 4 5 +378 +6 2 5 9 6 7 diff --git a/codenet/public_test_cases/p00690/output.2.txt b/codenet/public_test_cases/p00690/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8392cfcc9057e47b9c46f62d5bf22acec9f91bbc --- /dev/null +++ b/codenet/public_test_cases/p00690/output.2.txt @@ -0,0 +1,4 @@ +27 +2 3 4 5 +378 +6 2 5 9 6 7 diff --git a/codenet/public_test_cases/p00691/input.0.txt b/codenet/public_test_cases/p00691/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33e16568c1ade14f6f00bf4bbe74742321436ac5 --- /dev/null +++ b/codenet/public_test_cases/p00691/input.0.txt @@ -0,0 +1,4 @@ +6 +4 +2 +0 diff --git a/codenet/public_test_cases/p00691/input.1.txt b/codenet/public_test_cases/p00691/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..33e16568c1ade14f6f00bf4bbe74742321436ac5 --- /dev/null +++ b/codenet/public_test_cases/p00691/input.1.txt @@ -0,0 +1,4 @@ +6 +4 +2 +0 diff --git a/codenet/public_test_cases/p00691/output.0.txt b/codenet/public_test_cases/p00691/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..17abb03806adc87300558944d613c128b1f96b60 --- /dev/null +++ b/codenet/public_test_cases/p00691/output.0.txt @@ -0,0 +1,3 @@ +27 +10 +6 diff --git a/codenet/public_test_cases/p00691/output.1.txt b/codenet/public_test_cases/p00691/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..17abb03806adc87300558944d613c128b1f96b60 --- /dev/null +++ b/codenet/public_test_cases/p00691/output.1.txt @@ -0,0 +1,3 @@ +27 +10 +6 diff --git a/codenet/public_test_cases/p00692/input.0.txt b/codenet/public_test_cases/p00692/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbab541e3d944fcb48877359641127c98725e941 --- /dev/null +++ b/codenet/public_test_cases/p00692/input.0.txt @@ -0,0 +1,21 @@ +4 +1 4 5 2 +3 1 4 3 +5 4 2 2 +4 5 2 3 +1 1 3 5 +5 1 5 1 +4 5 3 2 +3 2 1 4 +1 4 5 3 +2 3 4 2 +1 2 1 2 +5 4 5 4 +2 1 2 1 +3 5 3 4 +3 3 5 4 +4 2 3 1 +2 5 3 1 +3 5 4 2 +1 5 4 1 +4 5 3 2 diff --git a/codenet/public_test_cases/p00692/input.1.txt b/codenet/public_test_cases/p00692/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbab541e3d944fcb48877359641127c98725e941 --- /dev/null +++ b/codenet/public_test_cases/p00692/input.1.txt @@ -0,0 +1,21 @@ +4 +1 4 5 2 +3 1 4 3 +5 4 2 2 +4 5 2 3 +1 1 3 5 +5 1 5 1 +4 5 3 2 +3 2 1 4 +1 4 5 3 +2 3 4 2 +1 2 1 2 +5 4 5 4 +2 1 2 1 +3 5 3 4 +3 3 5 4 +4 2 3 1 +2 5 3 1 +3 5 4 2 +1 5 4 1 +4 5 3 2 diff --git a/codenet/public_test_cases/p00692/output.0.txt b/codenet/public_test_cases/p00692/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4742e0a2b3a95181e7d25dea56d69e8a73bfcd --- /dev/null +++ b/codenet/public_test_cases/p00692/output.0.txt @@ -0,0 +1,4 @@ +0 +4 +12 +0 diff --git a/codenet/public_test_cases/p00692/output.1.txt b/codenet/public_test_cases/p00692/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4742e0a2b3a95181e7d25dea56d69e8a73bfcd --- /dev/null +++ b/codenet/public_test_cases/p00692/output.1.txt @@ -0,0 +1,4 @@ +0 +4 +12 +0 diff --git a/codenet/public_test_cases/p00693/input.0.txt b/codenet/public_test_cases/p00693/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8829909b6d99502d1f6191664d5c8aa122c78049 --- /dev/null +++ b/codenet/public_test_cases/p00693/input.0.txt @@ -0,0 +1,13 @@ +2 5 +permit 192168?? ?12??34? +deny 19216899 012343?5 +19216711 11233340 HiIamACracker +19216891 01234345 Hello +19216899 01234345 HiIamAlsoACracker +19216809 11200340 World +00000000 99999999 TheEndOfTheWorld +1 2 +permit 12345678 23456789 +19216891 01234345 Hello +12345678 23456789 Hello +0 0 diff --git a/codenet/public_test_cases/p00693/input.1.txt b/codenet/public_test_cases/p00693/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8829909b6d99502d1f6191664d5c8aa122c78049 --- /dev/null +++ b/codenet/public_test_cases/p00693/input.1.txt @@ -0,0 +1,13 @@ +2 5 +permit 192168?? ?12??34? +deny 19216899 012343?5 +19216711 11233340 HiIamACracker +19216891 01234345 Hello +19216899 01234345 HiIamAlsoACracker +19216809 11200340 World +00000000 99999999 TheEndOfTheWorld +1 2 +permit 12345678 23456789 +19216891 01234345 Hello +12345678 23456789 Hello +0 0 diff --git a/codenet/public_test_cases/p00693/output.0.txt b/codenet/public_test_cases/p00693/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f55b1b3ff93b81eeb72976ed23d542729b01c06a --- /dev/null +++ b/codenet/public_test_cases/p00693/output.0.txt @@ -0,0 +1,5 @@ +2 +19216891 01234345 Hello +19216809 11200340 World +1 +12345678 23456789 Hello diff --git a/codenet/public_test_cases/p00693/output.1.txt b/codenet/public_test_cases/p00693/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f55b1b3ff93b81eeb72976ed23d542729b01c06a --- /dev/null +++ b/codenet/public_test_cases/p00693/output.1.txt @@ -0,0 +1,5 @@ +2 +19216891 01234345 Hello +19216809 11200340 World +1 +12345678 23456789 Hello diff --git a/codenet/public_test_cases/p00694/input.0.txt b/codenet/public_test_cases/p00694/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50abecb9a076d070faa520a06babb84bdf3a92f2 --- /dev/null +++ b/codenet/public_test_cases/p00694/input.0.txt @@ -0,0 +1,20 @@ +19 + 1 +x 1 +y +z 3 +z + 3 +y -z +x +y -z -x +z 2 +z + 2 +y +19 + 1 +x 1 +y +z 3 +y -z +x +y -z -x +z 2 +y + 3 +z + 2 +z +19 + 1 +x 1 +y +z 3 +z + 3 +y -z +x +y -z -x +z 2 +y + 2 +z +18 + 1 -y + 1 +y -z +x + 1 +z +y +x +z +y -x -y 2 -y + 2 +z +3 +x +y +z +3 +y +z -x +0 diff --git a/codenet/public_test_cases/p00694/input.1.txt b/codenet/public_test_cases/p00694/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..50abecb9a076d070faa520a06babb84bdf3a92f2 --- /dev/null +++ b/codenet/public_test_cases/p00694/input.1.txt @@ -0,0 +1,20 @@ +19 + 1 +x 1 +y +z 3 +z + 3 +y -z +x +y -z -x +z 2 +z + 2 +y +19 + 1 +x 1 +y +z 3 +y -z +x +y -z -x +z 2 +y + 3 +z + 2 +z +19 + 1 +x 1 +y +z 3 +z + 3 +y -z +x +y -z -x +z 2 +y + 2 +z +18 + 1 -y + 1 +y -z +x + 1 +z +y +x +z +y -x -y 2 -y + 2 +z +3 +x +y +z +3 +y +z -x +0 diff --git a/codenet/public_test_cases/p00694/input.2.txt b/codenet/public_test_cases/p00694/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4362a8f46a4c65e1b913d454fa5ed704bc5b2c14 --- /dev/null +++ b/codenet/public_test_cases/p00694/input.2.txt @@ -0,0 +1,20 @@ +19 +1 +x 1 +y +z 3 +z +3 +y -z +x +y -z -x +z 2 +z +2 +y +19 +1 +x 1 +y +z 3 +y -z +x +y -z -x +z 2 +y +3 +z +2 +z +19 +1 +x 1 +y +z 3 +z +3 +y -z +x +y -z -x +z 2 +y +2 +z +18 +1 -y +1 +y -z +x +1 +z +y +x +z +y -x -y 2 -y +2 +z +3 +x +y +z +3 +y +z -x +0 diff --git a/codenet/public_test_cases/p00694/output.0.txt b/codenet/public_test_cases/p00694/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e54294616fe07dd8560bd7f7bd8f1e3788b81e8 --- /dev/null +++ b/codenet/public_test_cases/p00694/output.0.txt @@ -0,0 +1,3 @@ +SAME +SAME +DIFFERENT diff --git a/codenet/public_test_cases/p00694/output.1.txt b/codenet/public_test_cases/p00694/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e54294616fe07dd8560bd7f7bd8f1e3788b81e8 --- /dev/null +++ b/codenet/public_test_cases/p00694/output.1.txt @@ -0,0 +1,3 @@ +SAME +SAME +DIFFERENT diff --git a/codenet/public_test_cases/p00694/output.2.txt b/codenet/public_test_cases/p00694/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e54294616fe07dd8560bd7f7bd8f1e3788b81e8 --- /dev/null +++ b/codenet/public_test_cases/p00694/output.2.txt @@ -0,0 +1,3 @@ +SAME +SAME +DIFFERENT diff --git a/codenet/public_test_cases/p00695/input.0.txt b/codenet/public_test_cases/p00695/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..642a5e44ad1923f568012b4709640a519486abb3 --- /dev/null +++ b/codenet/public_test_cases/p00695/input.0.txt @@ -0,0 +1,18 @@ +3 +1 1 0 1 0 +0 1 1 1 1 +1 0 1 0 1 +0 1 1 1 0 +0 1 1 0 0 + +0 1 0 1 1 +0 1 0 1 0 +0 0 1 0 0 +0 0 1 1 0 +1 0 1 0 0 + +1 1 1 1 0 +0 1 1 1 0 +0 1 1 0 1 +0 1 1 1 0 +0 0 0 0 1 diff --git a/codenet/public_test_cases/p00695/input.1.txt b/codenet/public_test_cases/p00695/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..642a5e44ad1923f568012b4709640a519486abb3 --- /dev/null +++ b/codenet/public_test_cases/p00695/input.1.txt @@ -0,0 +1,18 @@ +3 +1 1 0 1 0 +0 1 1 1 1 +1 0 1 0 1 +0 1 1 1 0 +0 1 1 0 0 + +0 1 0 1 1 +0 1 0 1 0 +0 0 1 0 0 +0 0 1 1 0 +1 0 1 0 0 + +1 1 1 1 0 +0 1 1 1 0 +0 1 1 0 1 +0 1 1 1 0 +0 0 0 0 1 diff --git a/codenet/public_test_cases/p00695/output.0.txt b/codenet/public_test_cases/p00695/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c21b06b55b00601046c865c263d0583c86c193d0 --- /dev/null +++ b/codenet/public_test_cases/p00695/output.0.txt @@ -0,0 +1,3 @@ +4 +3 +8 diff --git a/codenet/public_test_cases/p00695/output.1.txt b/codenet/public_test_cases/p00695/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c21b06b55b00601046c865c263d0583c86c193d0 --- /dev/null +++ b/codenet/public_test_cases/p00695/output.1.txt @@ -0,0 +1,3 @@ +4 +3 +8 diff --git a/codenet/public_test_cases/p00696/input.1.txt b/codenet/public_test_cases/p00696/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6075d21138be4e4bea540064c45e9a57b5bcb336 --- /dev/null +++ b/codenet/public_test_cases/p00696/input.1.txt @@ -0,0 +1,27 @@ +6 +2 +8 +1 +AZXU5 +1GU2D4B +K +PO4IUTFV +THE +Q34NBVC78 +T +1961 +XWS34WQ + +LNGLNSNXTTPG +ED +MN +MLMNG +? +4 +2 +6 +2 +QWERTY +FLHL +? +0 diff --git a/codenet/public_test_cases/p00696/output.1.txt b/codenet/public_test_cases/p00696/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b84e8a82712f821eb3792b469cdf6e984f832282 --- /dev/null +++ b/codenet/public_test_cases/p00696/output.1.txt @@ -0,0 +1,21 @@ +AZXU5....8....... +1GU2D4B..T....... +K........1961.... +PO4IUTFV.XWS34WQ. +THE.............. +Q34NBVC7.LNGLNSNX + +TTPG............. +ED............... +MN............... +MLMNG............ +................. +................. + +? +QWERTY........ +FLHL.......... +.............. +.............. + +? diff --git a/codenet/public_test_cases/p00697/input.0.txt b/codenet/public_test_cases/p00697/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3619a2da6e2ef6d672b683679fc44e5e1b7968b5 --- /dev/null +++ b/codenet/public_test_cases/p00697/input.0.txt @@ -0,0 +1,7 @@ +6 +WwRR wwrg RRGb rGBG RGrb RrRg RGrg rgBB Wrgr +RrGb WWGR rGgb Wbrg wgBb GgBg WbBG Wwwg WWGG +RBbr Wrbr wGGG wggR WgGR WBWb WRgB wBgG WBgG +wBrg rGgb WRrB WWbw wRRB RbbB WRrb wrbb WgrG +WrwB WWww wRRB WGGb Wbbg WBgG WrbG Wrww RBgg +WWgg RBrr Rggr RGBg Wbgr WGbg WBbr WGWB GGGg diff --git a/codenet/public_test_cases/p00697/input.1.txt b/codenet/public_test_cases/p00697/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3619a2da6e2ef6d672b683679fc44e5e1b7968b5 --- /dev/null +++ b/codenet/public_test_cases/p00697/input.1.txt @@ -0,0 +1,7 @@ +6 +WwRR wwrg RRGb rGBG RGrb RrRg RGrg rgBB Wrgr +RrGb WWGR rGgb Wbrg wgBb GgBg WbBG Wwwg WWGG +RBbr Wrbr wGGG wggR WgGR WBWb WRgB wBgG WBgG +wBrg rGgb WRrB WWbw wRRB RbbB WRrb wrbb WgrG +WrwB WWww wRRB WGGb Wbbg WBgG WrbG Wrww RBgg +WWgg RBrr Rggr RGBg Wbgr WGbg WBbr WGWB GGGg diff --git a/codenet/public_test_cases/p00697/output.0.txt b/codenet/public_test_cases/p00697/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a105047e20caeaa592ddc1ac009fcba589dba80c --- /dev/null +++ b/codenet/public_test_cases/p00697/output.0.txt @@ -0,0 +1,6 @@ +40 +8 +32 +4 +12 +0 diff --git a/codenet/public_test_cases/p00697/output.1.txt b/codenet/public_test_cases/p00697/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a105047e20caeaa592ddc1ac009fcba589dba80c --- /dev/null +++ b/codenet/public_test_cases/p00697/output.1.txt @@ -0,0 +1,6 @@ +40 +8 +32 +4 +12 +0 diff --git a/codenet/public_test_cases/p00698/input.0.txt b/codenet/public_test_cases/p00698/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bad9f39a6afbf35d460a7511b7d08ff9579fcbf --- /dev/null +++ b/codenet/public_test_cases/p00698/input.0.txt @@ -0,0 +1,17 @@ +3 3 +? ? 70 105 +? 50 ? 150 +30 60 90 180 +45 150 240 435 + +2 2 +? ? 40 +? ? 40 +40 40 80 + +2 3 +? 30 40 90 +50 60 70 180 +70 90 110 270 + +0 diff --git a/codenet/public_test_cases/p00698/input.1.txt b/codenet/public_test_cases/p00698/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bad9f39a6afbf35d460a7511b7d08ff9579fcbf --- /dev/null +++ b/codenet/public_test_cases/p00698/input.1.txt @@ -0,0 +1,17 @@ +3 3 +? ? 70 105 +? 50 ? 150 +30 60 90 180 +45 150 240 435 + +2 2 +? ? 40 +? ? 40 +40 40 80 + +2 3 +? 30 40 90 +50 60 70 180 +70 90 110 270 + +0 diff --git a/codenet/public_test_cases/p00698/output.0.txt b/codenet/public_test_cases/p00698/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fef266742656be86787bb0fda81c347d370cd28 --- /dev/null +++ b/codenet/public_test_cases/p00698/output.0.txt @@ -0,0 +1,8 @@ +-5 +40 +20 +80 + +NO + +20 diff --git a/codenet/public_test_cases/p00698/output.1.txt b/codenet/public_test_cases/p00698/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fef266742656be86787bb0fda81c347d370cd28 --- /dev/null +++ b/codenet/public_test_cases/p00698/output.1.txt @@ -0,0 +1,8 @@ +-5 +40 +20 +80 + +NO + +20 diff --git a/codenet/public_test_cases/p00699/input.0.txt b/codenet/public_test_cases/p00699/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffdc178e4fb55b48518387a1c1031ffa332cd0f4 --- /dev/null +++ b/codenet/public_test_cases/p00699/input.0.txt @@ -0,0 +1,31 @@ +6 +0 0 0 0 0 +0 0 0 0 6 +0 2 4 5 3 +0 0 1 0 0 +0 0 0 0 0 +0 0 3 0 0 +0 0 2 0 0 +0 0 4 1 0 +0 0 0 5 0 +0 0 0 6 0 +0 0 0 3 0 +0 0 2 5 0 +0 4 1 0 0 +0 0 6 0 0 +0 0 0 0 0 +0 6 2 0 0 +0 0 4 0 0 +0 1 5 0 0 +0 0 3 0 0 +0 0 0 0 0 +0 0 0 0 6 +0 2 4 5 3 +0 0 1 0 0 +0 0 0 0 0 +0 0 0 1 0 +0 0 0 0 6 +0 2 4 5 3 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 1 0 diff --git a/codenet/public_test_cases/p00699/input.1.txt b/codenet/public_test_cases/p00699/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffdc178e4fb55b48518387a1c1031ffa332cd0f4 --- /dev/null +++ b/codenet/public_test_cases/p00699/input.1.txt @@ -0,0 +1,31 @@ +6 +0 0 0 0 0 +0 0 0 0 6 +0 2 4 5 3 +0 0 1 0 0 +0 0 0 0 0 +0 0 3 0 0 +0 0 2 0 0 +0 0 4 1 0 +0 0 0 5 0 +0 0 0 6 0 +0 0 0 3 0 +0 0 2 5 0 +0 4 1 0 0 +0 0 6 0 0 +0 0 0 0 0 +0 6 2 0 0 +0 0 4 0 0 +0 1 5 0 0 +0 0 3 0 0 +0 0 0 0 0 +0 0 0 0 6 +0 2 4 5 3 +0 0 1 0 0 +0 0 0 0 0 +0 0 0 1 0 +0 0 0 0 6 +0 2 4 5 3 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 1 0 diff --git a/codenet/public_test_cases/p00699/output.0.txt b/codenet/public_test_cases/p00699/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c57f16fc9c99d2a753f1eb7648bb82d6b6970962 --- /dev/null +++ b/codenet/public_test_cases/p00699/output.0.txt @@ -0,0 +1,6 @@ +true +true +false +false +false +false diff --git a/codenet/public_test_cases/p00699/output.1.txt b/codenet/public_test_cases/p00699/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c57f16fc9c99d2a753f1eb7648bb82d6b6970962 --- /dev/null +++ b/codenet/public_test_cases/p00699/output.1.txt @@ -0,0 +1,6 @@ +true +true +false +false +false +false diff --git a/codenet/public_test_cases/p00700/input.0.txt b/codenet/public_test_cases/p00700/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbc72c0eda5c16e61373a73766a25b1208990ebc --- /dev/null +++ b/codenet/public_test_cases/p00700/input.0.txt @@ -0,0 +1,40 @@ +3 +1 0 +0 1 +-1 0 +1 0 +0 5 +-1 0 +0 -1 +5 0 +0 1 +0 -1 +1 0 +0 -4 +-3 0 +0 3 +2 0 +0 -2 +-1 0 +0 1 +0 -1 +1 0 +0 2 +-2 0 +0 -3 +3 0 +0 4 +-4 0 +0 -5 +-2 0 +0 0 +1 0 +-1 0 +0 0 +2 0 +0 1 +-1 0 +0 1 +-1 0 +0 -2 +0 0 diff --git a/codenet/public_test_cases/p00700/input.1.txt b/codenet/public_test_cases/p00700/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbc72c0eda5c16e61373a73766a25b1208990ebc --- /dev/null +++ b/codenet/public_test_cases/p00700/input.1.txt @@ -0,0 +1,40 @@ +3 +1 0 +0 1 +-1 0 +1 0 +0 5 +-1 0 +0 -1 +5 0 +0 1 +0 -1 +1 0 +0 -4 +-3 0 +0 3 +2 0 +0 -2 +-1 0 +0 1 +0 -1 +1 0 +0 2 +-2 0 +0 -3 +3 0 +0 4 +-4 0 +0 -5 +-2 0 +0 0 +1 0 +-1 0 +0 0 +2 0 +0 1 +-1 0 +0 1 +-1 0 +0 -2 +0 0 diff --git a/codenet/public_test_cases/p00700/output.0.txt b/codenet/public_test_cases/p00700/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbb53808c2f936e89537c253cb71418e121de150 --- /dev/null +++ b/codenet/public_test_cases/p00700/output.0.txt @@ -0,0 +1,3 @@ +6 5 +1 0 +2 1 diff --git a/codenet/public_test_cases/p00700/output.1.txt b/codenet/public_test_cases/p00700/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbb53808c2f936e89537c253cb71418e121de150 --- /dev/null +++ b/codenet/public_test_cases/p00700/output.1.txt @@ -0,0 +1,3 @@ +6 5 +1 0 +2 1 diff --git a/codenet/public_test_cases/p00701/input.0.txt b/codenet/public_test_cases/p00701/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..421e34688f09c24006fa7c10ca7bb8d3779a5efa --- /dev/null +++ b/codenet/public_test_cases/p00701/input.0.txt @@ -0,0 +1,17 @@ +3 +1 3 +2 0 +0 0 +4 +4 1 +3 1 +1 2 +0 0 +5 +2 1 +3 1 +4 1 +3 2 +1 1 +0 0 +0 diff --git a/codenet/public_test_cases/p00701/input.1.txt b/codenet/public_test_cases/p00701/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..421e34688f09c24006fa7c10ca7bb8d3779a5efa --- /dev/null +++ b/codenet/public_test_cases/p00701/input.1.txt @@ -0,0 +1,17 @@ +3 +1 3 +2 0 +0 0 +4 +4 1 +3 1 +1 2 +0 0 +5 +2 1 +3 1 +4 1 +3 2 +1 1 +0 0 +0 diff --git a/codenet/public_test_cases/p00701/output.0.txt b/codenet/public_test_cases/p00701/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1471baf82e16a38ad35782a95e01ee0dc7dae6d0 --- /dev/null +++ b/codenet/public_test_cases/p00701/output.0.txt @@ -0,0 +1,10 @@ +1 +2 +end +1 +1 +2 +end +1 +4 +end diff --git a/codenet/public_test_cases/p00701/output.1.txt b/codenet/public_test_cases/p00701/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1471baf82e16a38ad35782a95e01ee0dc7dae6d0 --- /dev/null +++ b/codenet/public_test_cases/p00701/output.1.txt @@ -0,0 +1,10 @@ +1 +2 +end +1 +1 +2 +end +1 +4 +end diff --git a/codenet/public_test_cases/p00702/input.0.txt b/codenet/public_test_cases/p00702/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3eccdc35613edbdeb3a6d7b49aa6e918b20df58a --- /dev/null +++ b/codenet/public_test_cases/p00702/input.0.txt @@ -0,0 +1,4 @@ +3 +nai tiruvantel ar varyuvantel i valar tielyama nu vilya +qua ist qda quang ncw psts +svampti tsuldya jay quadal ciszeriol diff --git a/codenet/public_test_cases/p00702/output.0.txt b/codenet/public_test_cases/p00702/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c73f47ff1050651a425c2073114e7b04493e381 --- /dev/null +++ b/codenet/public_test_cases/p00702/output.0.txt @@ -0,0 +1,38 @@ +a r 3 +b a 0 +c i 1 +d a 2 +e l 3 +f a 0 +g a 0 +h a 0 +i s 2 +j a 1 +k a 0 +l y 2 +m a 1 +n a 1 +o l 1 +p a 0 +q d 1 +r i 1 +s t 1 +t i 3 +u v 2 +v a 5 +w a 0 +x a 0 +y a 3 +z e 1 +ld y 1 +mb a 0 +mp t 1 +nc w 1 +nd a 0 +ng a 0 +nt e 2 +nw a 0 +ps ts 1 +qu a 3 +cw a 0 +ts u 1 diff --git a/codenet/public_test_cases/p00703/input.0.txt b/codenet/public_test_cases/p00703/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..416c0c35babd1b6696c0cfb39df060f00a8be7b3 --- /dev/null +++ b/codenet/public_test_cases/p00703/input.0.txt @@ -0,0 +1,29 @@ +6 4 +160348 0 4 +913286 2 3 +431289 3 1 +671283 3 3 +10 8 +3827690415 2 8 +0482691573 1 9 +1924730586 3 7 +1378490256 1 9 +6297830541 1 9 +4829531706 3 7 +4621570983 1 9 +9820147536 6 4 +4 4 +2713 0 3 +1247 2 0 +1230 1 1 +1387 2 1 +6 5 +605743 0 4 +593026 2 2 +792456 1 2 +143052 1 3 +093614 3 3 +5 2 +12345 5 0 +67890 0 5 +0 0 diff --git a/codenet/public_test_cases/p00703/input.1.txt b/codenet/public_test_cases/p00703/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..416c0c35babd1b6696c0cfb39df060f00a8be7b3 --- /dev/null +++ b/codenet/public_test_cases/p00703/input.1.txt @@ -0,0 +1,29 @@ +6 4 +160348 0 4 +913286 2 3 +431289 3 1 +671283 3 3 +10 8 +3827690415 2 8 +0482691573 1 9 +1924730586 3 7 +1378490256 1 9 +6297830541 1 9 +4829531706 3 7 +4621570983 1 9 +9820147536 6 4 +4 4 +2713 0 3 +1247 2 0 +1230 1 1 +1387 2 1 +6 5 +605743 0 4 +593026 2 2 +792456 1 2 +143052 1 3 +093614 3 3 +5 2 +12345 5 0 +67890 0 5 +0 0 diff --git a/codenet/public_test_cases/p00703/output.0.txt b/codenet/public_test_cases/p00703/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f60f4a990fe2b7fc2ea8a7690e269e81e7413b08 --- /dev/null +++ b/codenet/public_test_cases/p00703/output.0.txt @@ -0,0 +1,5 @@ +637281 +7820914536 +3287 +NO +NO diff --git a/codenet/public_test_cases/p00703/output.1.txt b/codenet/public_test_cases/p00703/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f60f4a990fe2b7fc2ea8a7690e269e81e7413b08 --- /dev/null +++ b/codenet/public_test_cases/p00703/output.1.txt @@ -0,0 +1,5 @@ +637281 +7820914536 +3287 +NO +NO diff --git a/codenet/public_test_cases/p00705/input.0.txt b/codenet/public_test_cases/p00705/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27a38ae4e81a75a4a1350b082ef726dfac9dee5d --- /dev/null +++ b/codenet/public_test_cases/p00705/input.0.txt @@ -0,0 +1,17 @@ +3 2 +2 1 4 +0 +3 3 4 8 +3 2 +4 1 5 8 9 +3 2 5 9 +5 2 4 5 7 9 +3 3 +2 1 4 +3 2 5 9 +2 2 4 +3 3 +2 1 2 +3 1 2 9 +2 2 4 +0 0 diff --git a/codenet/public_test_cases/p00705/input.1.txt b/codenet/public_test_cases/p00705/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27a38ae4e81a75a4a1350b082ef726dfac9dee5d --- /dev/null +++ b/codenet/public_test_cases/p00705/input.1.txt @@ -0,0 +1,17 @@ +3 2 +2 1 4 +0 +3 3 4 8 +3 2 +4 1 5 8 9 +3 2 5 9 +5 2 4 5 7 9 +3 3 +2 1 4 +3 2 5 9 +2 2 4 +3 3 +2 1 2 +3 1 2 9 +2 2 4 +0 0 diff --git a/codenet/public_test_cases/p00705/output.0.txt b/codenet/public_test_cases/p00705/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eeb5dd564a95cd6bea35e829deaec82908bd869a --- /dev/null +++ b/codenet/public_test_cases/p00705/output.0.txt @@ -0,0 +1,4 @@ +4 +5 +0 +2 diff --git a/codenet/public_test_cases/p00705/output.1.txt b/codenet/public_test_cases/p00705/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eeb5dd564a95cd6bea35e829deaec82908bd869a --- /dev/null +++ b/codenet/public_test_cases/p00705/output.1.txt @@ -0,0 +1,4 @@ +4 +5 +0 +2 diff --git a/codenet/public_test_cases/p00706/input.0.txt b/codenet/public_test_cases/p00706/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8b358816f1d61ee83fa14564f081dca8f363a5e --- /dev/null +++ b/codenet/public_test_cases/p00706/input.0.txt @@ -0,0 +1,31 @@ +16 +10 8 +2 2 +2 5 +2 7 +3 3 +3 8 +4 2 +4 5 +4 8 +6 4 +6 7 +7 5 +7 8 +8 1 +8 4 +9 6 +10 3 +4 3 +8 +6 4 +1 2 +2 1 +2 4 +3 4 +4 2 +5 3 +6 1 +6 2 +3 2 +0 diff --git a/codenet/public_test_cases/p00706/input.1.txt b/codenet/public_test_cases/p00706/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8b358816f1d61ee83fa14564f081dca8f363a5e --- /dev/null +++ b/codenet/public_test_cases/p00706/input.1.txt @@ -0,0 +1,31 @@ +16 +10 8 +2 2 +2 5 +2 7 +3 3 +3 8 +4 2 +4 5 +4 8 +6 4 +6 7 +7 5 +7 8 +8 1 +8 4 +9 6 +10 3 +4 3 +8 +6 4 +1 2 +2 1 +2 4 +3 4 +4 2 +5 3 +6 1 +6 2 +3 2 +0 diff --git a/codenet/public_test_cases/p00706/output.0.txt b/codenet/public_test_cases/p00706/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81450f3d334f886509a186abffcf1a1aee0866a5 --- /dev/null +++ b/codenet/public_test_cases/p00706/output.0.txt @@ -0,0 +1,2 @@ +4 +3 diff --git a/codenet/public_test_cases/p00706/output.1.txt b/codenet/public_test_cases/p00706/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81450f3d334f886509a186abffcf1a1aee0866a5 --- /dev/null +++ b/codenet/public_test_cases/p00706/output.1.txt @@ -0,0 +1,2 @@ +4 +3 diff --git a/codenet/public_test_cases/p00707/input.0.txt b/codenet/public_test_cases/p00707/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4abc3a8c25fe8aec904afc494f4051b151147366 --- /dev/null +++ b/codenet/public_test_cases/p00707/input.0.txt @@ -0,0 +1,17 @@ +7 4 +9R2A993 +0E314A0 +8A900DE +820R037 +6 7 +JH03HE +ID7722 +0DA1AH +30C9G5 +99971A +CA7EAI +AHLBEM +20 2 +A1234567891234CBDEGH +BDEDF908034265091499 +0 0 diff --git a/codenet/public_test_cases/p00707/input.1.txt b/codenet/public_test_cases/p00707/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4abc3a8c25fe8aec904afc494f4051b151147366 --- /dev/null +++ b/codenet/public_test_cases/p00707/input.1.txt @@ -0,0 +1,17 @@ +7 4 +9R2A993 +0E314A0 +8A900DE +820R037 +6 7 +JH03HE +ID7722 +0DA1AH +30C9G5 +99971A +CA7EAI +AHLBEM +20 2 +A1234567891234CBDEGH +BDEDF908034265091499 +0 0 diff --git a/codenet/public_test_cases/p00707/output.0.txt b/codenet/public_test_cases/p00707/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7346f510527f1688b8e5833f20daa8482b2f28f8 --- /dev/null +++ b/codenet/public_test_cases/p00707/output.0.txt @@ -0,0 +1,3 @@ +23900037 +771971 +12345908034265091499 diff --git a/codenet/public_test_cases/p00707/output.1.txt b/codenet/public_test_cases/p00707/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7346f510527f1688b8e5833f20daa8482b2f28f8 --- /dev/null +++ b/codenet/public_test_cases/p00707/output.1.txt @@ -0,0 +1,3 @@ +23900037 +771971 +12345908034265091499 diff --git a/codenet/public_test_cases/p00708/input.0.txt b/codenet/public_test_cases/p00708/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f3581048bf68fa45cf6b11fd1c728d2d2c158e5 --- /dev/null +++ b/codenet/public_test_cases/p00708/input.0.txt @@ -0,0 +1,14 @@ +3 +10.000 10.000 50.000 10.000 +40.000 10.000 50.000 10.000 +40.000 40.000 50.000 10.000 +2 +30.000 30.000 30.000 20.000 +40.000 40.000 40.000 20.000 +5 +5.729 15.143 3.996 25.837 +6.013 14.372 4.818 10.671 +80.115 63.292 84.477 15.120 +64.095 80.924 70.029 14.881 +39.472 85.116 71.369 5.553 +0 diff --git a/codenet/public_test_cases/p00708/input.1.txt b/codenet/public_test_cases/p00708/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f3581048bf68fa45cf6b11fd1c728d2d2c158e5 --- /dev/null +++ b/codenet/public_test_cases/p00708/input.1.txt @@ -0,0 +1,14 @@ +3 +10.000 10.000 50.000 10.000 +40.000 10.000 50.000 10.000 +40.000 40.000 50.000 10.000 +2 +30.000 30.000 30.000 20.000 +40.000 40.000 40.000 20.000 +5 +5.729 15.143 3.996 25.837 +6.013 14.372 4.818 10.671 +80.115 63.292 84.477 15.120 +64.095 80.924 70.029 14.881 +39.472 85.116 71.369 5.553 +0 diff --git a/codenet/public_test_cases/p00708/output.0.txt b/codenet/public_test_cases/p00708/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1fae9ea37f6989d1c5aba5b310d985b46cdb6dab --- /dev/null +++ b/codenet/public_test_cases/p00708/output.0.txt @@ -0,0 +1,3 @@ +20.000 +0.000 +73.834 diff --git a/codenet/public_test_cases/p00708/output.1.txt b/codenet/public_test_cases/p00708/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1fae9ea37f6989d1c5aba5b310d985b46cdb6dab --- /dev/null +++ b/codenet/public_test_cases/p00708/output.1.txt @@ -0,0 +1,3 @@ +20.000 +0.000 +73.834 diff --git a/codenet/public_test_cases/p00709/input.0.txt b/codenet/public_test_cases/p00709/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c20a3aab21b36d545f66c61401b4e72a7aa8ece8 --- /dev/null +++ b/codenet/public_test_cases/p00709/input.0.txt @@ -0,0 +1,31 @@ +4 3 +0 1 1 1 +1 1 1 1 +1 1 1 1 +8 5 +0 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +1 1 1 0 1 1 1 1 +0 1 1 1 0 1 1 1 +8 8 +0 1 1 0 0 1 1 0 +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +0 1 1 0 0 1 1 0 +0 1 1 0 0 1 1 0 +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +0 1 1 0 0 1 1 0 +10 10 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 0 1 1 0 1 1 0 1 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 0 1 1 0 1 1 0 1 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 0 1 1 0 1 1 0 1 +1 1 1 1 1 1 1 1 1 1 +0 0 diff --git a/codenet/public_test_cases/p00709/input.1.txt b/codenet/public_test_cases/p00709/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c20a3aab21b36d545f66c61401b4e72a7aa8ece8 --- /dev/null +++ b/codenet/public_test_cases/p00709/input.1.txt @@ -0,0 +1,31 @@ +4 3 +0 1 1 1 +1 1 1 1 +1 1 1 1 +8 5 +0 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +1 1 1 0 1 1 1 1 +0 1 1 1 0 1 1 1 +8 8 +0 1 1 0 0 1 1 0 +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +0 1 1 0 0 1 1 0 +0 1 1 0 0 1 1 0 +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +0 1 1 0 0 1 1 0 +10 10 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 0 1 1 0 1 1 0 1 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 0 1 1 0 1 1 0 1 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 0 1 1 0 1 1 0 1 +1 1 1 1 1 1 1 1 1 1 +0 0 diff --git a/codenet/public_test_cases/p00709/output.0.txt b/codenet/public_test_cases/p00709/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1c38e6b26638b2eaaaf07ed59cdefbbacd67fe2 --- /dev/null +++ b/codenet/public_test_cases/p00709/output.0.txt @@ -0,0 +1,4 @@ +2 +6 +14 +29 diff --git a/codenet/public_test_cases/p00709/output.1.txt b/codenet/public_test_cases/p00709/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1c38e6b26638b2eaaaf07ed59cdefbbacd67fe2 --- /dev/null +++ b/codenet/public_test_cases/p00709/output.1.txt @@ -0,0 +1,4 @@ +2 +6 +14 +29 diff --git a/codenet/public_test_cases/p00710/input.0.txt b/codenet/public_test_cases/p00710/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..96914dfa8dd80b068ace504bdf79931dc9b350de --- /dev/null +++ b/codenet/public_test_cases/p00710/input.0.txt @@ -0,0 +1,8 @@ +5 2 +3 1 +3 1 +10 3 +1 10 +10 1 +8 3 +0 0 diff --git a/codenet/public_test_cases/p00710/input.1.txt b/codenet/public_test_cases/p00710/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..96914dfa8dd80b068ace504bdf79931dc9b350de --- /dev/null +++ b/codenet/public_test_cases/p00710/input.1.txt @@ -0,0 +1,8 @@ +5 2 +3 1 +3 1 +10 3 +1 10 +10 1 +8 3 +0 0 diff --git a/codenet/public_test_cases/p00710/output.0.txt b/codenet/public_test_cases/p00710/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7290ba859f4adbf90d68526fe0ab1f8cbcf65098 --- /dev/null +++ b/codenet/public_test_cases/p00710/output.0.txt @@ -0,0 +1,2 @@ +4 +4 diff --git a/codenet/public_test_cases/p00710/output.1.txt b/codenet/public_test_cases/p00710/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7290ba859f4adbf90d68526fe0ab1f8cbcf65098 --- /dev/null +++ b/codenet/public_test_cases/p00710/output.1.txt @@ -0,0 +1,2 @@ +4 +4 diff --git a/codenet/public_test_cases/p00711/input.0.txt b/codenet/public_test_cases/p00711/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b42ec4d7328ca3a6ec56ac0ead5e79c5c107002 --- /dev/null +++ b/codenet/public_test_cases/p00711/input.0.txt @@ -0,0 +1,36 @@ +6 9 +....#. +.....# +...... +...... +...... +...... +...... +#@...# +.#..#. +11 9 +.#......... +.#.#######. +.#.#.....#. +.#.#.###.#. +.#.#..@#.#. +.#.#####.#. +.#.......#. +.#########. +........... +11 6 +..#..#..#.. +..#..#..#.. +..#..#..### +..#..#..#@. +..#..#..#.. +..#..#..#.. +7 7 +..#.#.. +..#.#.. +###.### +...@... +###.### +..#.#.. +..#.#.. +0 0 diff --git a/codenet/public_test_cases/p00711/input.1.txt b/codenet/public_test_cases/p00711/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae772379c5393cb97c1e5d089fd6e73e60e96bf2 --- /dev/null +++ b/codenet/public_test_cases/p00711/input.1.txt @@ -0,0 +1,36 @@ +6 9 +....#. +.....# +...... +...... +...... +...... +...... +@...# +.#..#. +11 9 +.#......... +.#.#######. +.#.#.....#. +.#.#.###.#. +.#.#..@#.#. +.#.#####.#. +.#.......#. +.#########. +........... +11 6 +..#..#..#.. +..#..#..#.. +..#..#..### +..#..#..#@. +..#..#..#.. +..#..#..#.. +7 7 +..#.#.. +..#.#.. +.### +...@... +.### +..#.#.. +..#.#.. +0 0 diff --git a/codenet/public_test_cases/p00711/input.2.txt b/codenet/public_test_cases/p00711/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b42ec4d7328ca3a6ec56ac0ead5e79c5c107002 --- /dev/null +++ b/codenet/public_test_cases/p00711/input.2.txt @@ -0,0 +1,36 @@ +6 9 +....#. +.....# +...... +...... +...... +...... +...... +#@...# +.#..#. +11 9 +.#......... +.#.#######. +.#.#.....#. +.#.#.###.#. +.#.#..@#.#. +.#.#####.#. +.#.......#. +.#########. +........... +11 6 +..#..#..#.. +..#..#..#.. +..#..#..### +..#..#..#@. +..#..#..#.. +..#..#..#.. +7 7 +..#.#.. +..#.#.. +###.### +...@... +###.### +..#.#.. +..#.#.. +0 0 diff --git a/codenet/public_test_cases/p00711/output.0.txt b/codenet/public_test_cases/p00711/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b68e33e89b57ead5dce9e5a7caa0a7d9f17d2a2 --- /dev/null +++ b/codenet/public_test_cases/p00711/output.0.txt @@ -0,0 +1,4 @@ +45 +59 +6 +13 diff --git a/codenet/public_test_cases/p00711/output.1.txt b/codenet/public_test_cases/p00711/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b68e33e89b57ead5dce9e5a7caa0a7d9f17d2a2 --- /dev/null +++ b/codenet/public_test_cases/p00711/output.1.txt @@ -0,0 +1,4 @@ +45 +59 +6 +13 diff --git a/codenet/public_test_cases/p00711/output.2.txt b/codenet/public_test_cases/p00711/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b68e33e89b57ead5dce9e5a7caa0a7d9f17d2a2 --- /dev/null +++ b/codenet/public_test_cases/p00711/output.2.txt @@ -0,0 +1,4 @@ +45 +59 +6 +13 diff --git a/codenet/public_test_cases/p00712/input.0.txt b/codenet/public_test_cases/p00712/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b19e09ddbc46153d6896318909ba7be7ec43e519 --- /dev/null +++ b/codenet/public_test_cases/p00712/input.0.txt @@ -0,0 +1,10 @@ +2 3 120 3 +2 3 300 3 +2 3 299 3 +2 3 12 3 +2 3 12000 7 +54 795 12000 7 +2 3 300 1 +2 1 200 5 +2 4 54 2 +0 0 0 0 diff --git a/codenet/public_test_cases/p00712/input.1.txt b/codenet/public_test_cases/p00712/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b19e09ddbc46153d6896318909ba7be7ec43e519 --- /dev/null +++ b/codenet/public_test_cases/p00712/input.1.txt @@ -0,0 +1,10 @@ +2 3 120 3 +2 3 300 3 +2 3 299 3 +2 3 12 3 +2 3 12000 7 +54 795 12000 7 +2 3 300 1 +2 1 200 5 +2 4 54 2 +0 0 0 0 diff --git a/codenet/public_test_cases/p00712/output.0.txt b/codenet/public_test_cases/p00712/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..504920ff36f828d7f6454466c66de0507accdfd3 --- /dev/null +++ b/codenet/public_test_cases/p00712/output.0.txt @@ -0,0 +1,9 @@ +4 +7 +6 +2 +42 +1 +0 +9 +3 diff --git a/codenet/public_test_cases/p00712/output.1.txt b/codenet/public_test_cases/p00712/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..504920ff36f828d7f6454466c66de0507accdfd3 --- /dev/null +++ b/codenet/public_test_cases/p00712/output.1.txt @@ -0,0 +1,9 @@ +4 +7 +6 +2 +42 +1 +0 +9 +3 diff --git a/codenet/public_test_cases/p00713/input.0.txt b/codenet/public_test_cases/p00713/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..234185cdb44a8b5c657aa27866af15a9b4127cf6 --- /dev/null +++ b/codenet/public_test_cases/p00713/input.0.txt @@ -0,0 +1,42 @@ +3 +6.47634 7.69628 +5.16828 4.79915 +6.69533 6.20378 +6 +7.15296 4.08328 +6.50827 2.69466 +5.91219 3.86661 +5.29853 4.16097 +6.10838 3.46039 +6.34060 2.41599 +8 +7.90650 4.01746 +4.10998 4.18354 +4.67289 4.01887 +6.33885 4.28388 +4.98106 3.82728 +5.12379 5.16473 +7.84664 4.67693 +4.02776 3.87990 +20 +6.65128 5.47490 +6.42743 6.26189 +6.35864 4.61611 +6.59020 4.54228 +4.43967 5.70059 +4.38226 5.70536 +5.50755 6.18163 +7.41971 6.13668 +6.71936 3.04496 +5.61832 4.23857 +5.99424 4.29328 +5.60961 4.32998 +6.82242 5.79683 +5.44693 3.82724 +6.70906 3.65736 +7.89087 5.68000 +6.23300 4.59530 +5.92401 4.92329 +6.24168 3.81389 +6.22671 3.62210 +0 diff --git a/codenet/public_test_cases/p00713/input.1.txt b/codenet/public_test_cases/p00713/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..234185cdb44a8b5c657aa27866af15a9b4127cf6 --- /dev/null +++ b/codenet/public_test_cases/p00713/input.1.txt @@ -0,0 +1,42 @@ +3 +6.47634 7.69628 +5.16828 4.79915 +6.69533 6.20378 +6 +7.15296 4.08328 +6.50827 2.69466 +5.91219 3.86661 +5.29853 4.16097 +6.10838 3.46039 +6.34060 2.41599 +8 +7.90650 4.01746 +4.10998 4.18354 +4.67289 4.01887 +6.33885 4.28388 +4.98106 3.82728 +5.12379 5.16473 +7.84664 4.67693 +4.02776 3.87990 +20 +6.65128 5.47490 +6.42743 6.26189 +6.35864 4.61611 +6.59020 4.54228 +4.43967 5.70059 +4.38226 5.70536 +5.50755 6.18163 +7.41971 6.13668 +6.71936 3.04496 +5.61832 4.23857 +5.99424 4.29328 +5.60961 4.32998 +6.82242 5.79683 +5.44693 3.82724 +6.70906 3.65736 +7.89087 5.68000 +6.23300 4.59530 +5.92401 4.92329 +6.24168 3.81389 +6.22671 3.62210 +0 diff --git a/codenet/public_test_cases/p00713/output.0.txt b/codenet/public_test_cases/p00713/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..35a28ea3b81f34d5981dfd999e88a8648bc5634e --- /dev/null +++ b/codenet/public_test_cases/p00713/output.0.txt @@ -0,0 +1,4 @@ +2 +5 +5 +11 diff --git a/codenet/public_test_cases/p00713/output.1.txt b/codenet/public_test_cases/p00713/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..35a28ea3b81f34d5981dfd999e88a8648bc5634e --- /dev/null +++ b/codenet/public_test_cases/p00713/output.1.txt @@ -0,0 +1,4 @@ +2 +5 +5 +11 diff --git a/codenet/public_test_cases/p00714/input.0.txt b/codenet/public_test_cases/p00714/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e06200c95b1f10f88a13638ce1ba404b9d683a0 --- /dev/null +++ b/codenet/public_test_cases/p00714/input.0.txt @@ -0,0 +1,31 @@ +2 +5 +15 40 +35 20 +50 45 +70 30 +80 10 +3 +20 3 +60 2 +65 2 +6 +40 4100 +25 7500 +10 18000 +90 7000 +25 15000 +25 22000 +5 +15 40 +35 20 +50 45 +70 30 +80 10 +2 +60 4 +75 1 +3 +60 6000 +75 6000 +85 6000 diff --git a/codenet/public_test_cases/p00714/input.1.txt b/codenet/public_test_cases/p00714/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e06200c95b1f10f88a13638ce1ba404b9d683a0 --- /dev/null +++ b/codenet/public_test_cases/p00714/input.1.txt @@ -0,0 +1,31 @@ +2 +5 +15 40 +35 20 +50 45 +70 30 +80 10 +3 +20 3 +60 2 +65 2 +6 +40 4100 +25 7500 +10 18000 +90 7000 +25 15000 +25 22000 +5 +15 40 +35 20 +50 45 +70 30 +80 10 +2 +60 4 +75 1 +3 +60 6000 +75 6000 +85 6000 diff --git a/codenet/public_test_cases/p00714/output.0.txt b/codenet/public_test_cases/p00714/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bac83d1526d87d73e57db44c9959d43e54c0c89 --- /dev/null +++ b/codenet/public_test_cases/p00714/output.0.txt @@ -0,0 +1,9 @@ +0.666667 +21.4286 +36.6667 +11.1111 +40.0 +50.0 +30.0 +13.3333 +13.3333 diff --git a/codenet/public_test_cases/p00714/output.1.txt b/codenet/public_test_cases/p00714/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bac83d1526d87d73e57db44c9959d43e54c0c89 --- /dev/null +++ b/codenet/public_test_cases/p00714/output.1.txt @@ -0,0 +1,9 @@ +0.666667 +21.4286 +36.6667 +11.1111 +40.0 +50.0 +30.0 +13.3333 +13.3333 diff --git a/codenet/public_test_cases/p00715/input.0.txt b/codenet/public_test_cases/p00715/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..41613f0f3266f6f85440b043ce6c9a2a95f61780 --- /dev/null +++ b/codenet/public_test_cases/p00715/input.0.txt @@ -0,0 +1,26 @@ +7 +Shijo-Kawaramachi +Karasuma-Imadegawa +Kawaramachi-Imadegawa +Nishioji-Shijo +Karasuma-Gojo +Torimaru-Rokujo +Rokujo-Karasuma +6 +Shijo-Karasuma +Imadegawa-Nishioji +Nishioji-Gojo +Shijo-Torimaru +Torimaru-Gojo +Shijo-Kawabata +4 +1jo-Midosuji +Midosuji-2jo +2jo-Omotesando +Omotesando-1jo +4 +Midosuji-1jo +1jo-Midosuji +Midosuji-Omotesando +1jo-1jo +0 diff --git a/codenet/public_test_cases/p00715/input.1.txt b/codenet/public_test_cases/p00715/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..41613f0f3266f6f85440b043ce6c9a2a95f61780 --- /dev/null +++ b/codenet/public_test_cases/p00715/input.1.txt @@ -0,0 +1,26 @@ +7 +Shijo-Kawaramachi +Karasuma-Imadegawa +Kawaramachi-Imadegawa +Nishioji-Shijo +Karasuma-Gojo +Torimaru-Rokujo +Rokujo-Karasuma +6 +Shijo-Karasuma +Imadegawa-Nishioji +Nishioji-Gojo +Shijo-Torimaru +Torimaru-Gojo +Shijo-Kawabata +4 +1jo-Midosuji +Midosuji-2jo +2jo-Omotesando +Omotesando-1jo +4 +Midosuji-1jo +1jo-Midosuji +Midosuji-Omotesando +1jo-1jo +0 diff --git a/codenet/public_test_cases/p00715/output.0.txt b/codenet/public_test_cases/p00715/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d99d08c9fba1d96ef66f6b709736f3cec33baa5b --- /dev/null +++ b/codenet/public_test_cases/p00715/output.0.txt @@ -0,0 +1,12 @@ +8 +YES +NO +YES +NO +YES +NO +4 +YES +YES +NO +NO diff --git a/codenet/public_test_cases/p00715/output.1.txt b/codenet/public_test_cases/p00715/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d99d08c9fba1d96ef66f6b709736f3cec33baa5b --- /dev/null +++ b/codenet/public_test_cases/p00715/output.1.txt @@ -0,0 +1,12 @@ +8 +YES +NO +YES +NO +YES +NO +4 +YES +YES +NO +NO diff --git a/codenet/public_test_cases/p00716/input.0.txt b/codenet/public_test_cases/p00716/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a1652609fc3673d8058e714c705dd2227924a75 --- /dev/null +++ b/codenet/public_test_cases/p00716/input.0.txt @@ -0,0 +1,25 @@ +4 +1000000 +5 +2 +0 0.03125 3000 +1 0.03125 3000 +6620000 +7 +2 +0 0.0732421875 42307 +1 0.0740966796875 40942 +39677000 +4 +4 +0 0.0709228515625 30754 +1 0.00634765625 26165 +0 0.03662109375 79468 +0 0.0679931640625 10932 +10585000 +6 +4 +1 0.0054931640625 59759 +1 0.12353515625 56464 +0 0.0496826171875 98193 +0 0.0887451171875 78966 diff --git a/codenet/public_test_cases/p00716/input.1.txt b/codenet/public_test_cases/p00716/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a1652609fc3673d8058e714c705dd2227924a75 --- /dev/null +++ b/codenet/public_test_cases/p00716/input.1.txt @@ -0,0 +1,25 @@ +4 +1000000 +5 +2 +0 0.03125 3000 +1 0.03125 3000 +6620000 +7 +2 +0 0.0732421875 42307 +1 0.0740966796875 40942 +39677000 +4 +4 +0 0.0709228515625 30754 +1 0.00634765625 26165 +0 0.03662109375 79468 +0 0.0679931640625 10932 +10585000 +6 +4 +1 0.0054931640625 59759 +1 0.12353515625 56464 +0 0.0496826171875 98193 +0 0.0887451171875 78966 diff --git a/codenet/public_test_cases/p00716/output.0.txt b/codenet/public_test_cases/p00716/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3c83688f2fdeb9a4c301420aabed61671d73961 --- /dev/null +++ b/codenet/public_test_cases/p00716/output.0.txt @@ -0,0 +1,4 @@ +1150357 +10559683 +50796918 +20829397 diff --git a/codenet/public_test_cases/p00716/output.1.txt b/codenet/public_test_cases/p00716/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3c83688f2fdeb9a4c301420aabed61671d73961 --- /dev/null +++ b/codenet/public_test_cases/p00716/output.1.txt @@ -0,0 +1,4 @@ +1150357 +10559683 +50796918 +20829397 diff --git a/codenet/public_test_cases/p00717/input.0.txt b/codenet/public_test_cases/p00717/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..231ae609a1e83adad3fa32f9c61d7d9b38b194a5 --- /dev/null +++ b/codenet/public_test_cases/p00717/input.0.txt @@ -0,0 +1,89 @@ +5 +5 +0 0 +2 0 +2 1 +4 1 +4 0 +5 +0 0 +0 2 +-1 2 +-1 4 +0 4 +5 +0 0 +0 1 +-2 1 +-2 2 +0 2 +5 +0 0 +0 -1 +2 -1 +2 0 +4 0 +5 +0 0 +2 0 +2 -1 +4 -1 +4 0 +5 +0 0 +2 0 +2 1 +4 1 +4 0 +4 +4 +-60 -75 +-60 -78 +-42 -78 +-42 -6 +4 +10 3 +10 7 +-4 7 +-4 40 +4 +-74 66 +-74 63 +-92 63 +-92 135 +4 +-12 22 +-12 25 +-30 25 +-30 -47 +4 +12 -22 +12 -25 +30 -25 +30 47 +3 +5 +-8 5 +-8 2 +0 2 +0 4 +8 4 +5 +-3 -1 +0 -1 +0 7 +-2 7 +-2 16 +5 +-1 6 +-1 3 +7 3 +7 5 +16 5 +5 +0 1 +0 -2 +8 -2 +8 0 +17 0 +0 diff --git a/codenet/public_test_cases/p00717/input.1.txt b/codenet/public_test_cases/p00717/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..231ae609a1e83adad3fa32f9c61d7d9b38b194a5 --- /dev/null +++ b/codenet/public_test_cases/p00717/input.1.txt @@ -0,0 +1,89 @@ +5 +5 +0 0 +2 0 +2 1 +4 1 +4 0 +5 +0 0 +0 2 +-1 2 +-1 4 +0 4 +5 +0 0 +0 1 +-2 1 +-2 2 +0 2 +5 +0 0 +0 -1 +2 -1 +2 0 +4 0 +5 +0 0 +2 0 +2 -1 +4 -1 +4 0 +5 +0 0 +2 0 +2 1 +4 1 +4 0 +4 +4 +-60 -75 +-60 -78 +-42 -78 +-42 -6 +4 +10 3 +10 7 +-4 7 +-4 40 +4 +-74 66 +-74 63 +-92 63 +-92 135 +4 +-12 22 +-12 25 +-30 25 +-30 -47 +4 +12 -22 +12 -25 +30 -25 +30 47 +3 +5 +-8 5 +-8 2 +0 2 +0 4 +8 4 +5 +-3 -1 +0 -1 +0 7 +-2 7 +-2 16 +5 +-1 6 +-1 3 +7 3 +7 5 +16 5 +5 +0 1 +0 -2 +8 -2 +8 0 +17 0 +0 diff --git a/codenet/public_test_cases/p00717/output.0.txt b/codenet/public_test_cases/p00717/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..971208776b5c0847465d543b3ea74408cab31430 --- /dev/null +++ b/codenet/public_test_cases/p00717/output.0.txt @@ -0,0 +1,8 @@ +1 +3 +5 ++++++ +3 +4 ++++++ ++++++ diff --git a/codenet/public_test_cases/p00717/output.1.txt b/codenet/public_test_cases/p00717/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..971208776b5c0847465d543b3ea74408cab31430 --- /dev/null +++ b/codenet/public_test_cases/p00717/output.1.txt @@ -0,0 +1,8 @@ +1 +3 +5 ++++++ +3 +4 ++++++ ++++++ diff --git a/codenet/public_test_cases/p00718/input.0.txt b/codenet/public_test_cases/p00718/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f91ec20f0379dd6841356a984332af6f5705f5d3 --- /dev/null +++ b/codenet/public_test_cases/p00718/input.0.txt @@ -0,0 +1,11 @@ +10 +xi x9i +i 9i +c2x2i 4c8x8i +m2ci 4m7c9x8i +9c9x9i i +i 9m9c9x8i +m i +i m +m9i i +9m8c7xi c2x8i diff --git a/codenet/public_test_cases/p00718/input.1.txt b/codenet/public_test_cases/p00718/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f91ec20f0379dd6841356a984332af6f5705f5d3 --- /dev/null +++ b/codenet/public_test_cases/p00718/input.1.txt @@ -0,0 +1,11 @@ +10 +xi x9i +i 9i +c2x2i 4c8x8i +m2ci 4m7c9x8i +9c9x9i i +i 9m9c9x8i +m i +i m +m9i i +9m8c7xi c2x8i diff --git a/codenet/public_test_cases/p00718/output.0.txt b/codenet/public_test_cases/p00718/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e9d2fca797e8739ac03a4dbd6ca5ee9777f98c7 --- /dev/null +++ b/codenet/public_test_cases/p00718/output.0.txt @@ -0,0 +1,10 @@ +3x +x +6cx +5m9c9x9i +m +9m9c9x9i +mi +mi +mx +9m9c9x9i diff --git a/codenet/public_test_cases/p00718/output.1.txt b/codenet/public_test_cases/p00718/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e9d2fca797e8739ac03a4dbd6ca5ee9777f98c7 --- /dev/null +++ b/codenet/public_test_cases/p00718/output.1.txt @@ -0,0 +1,10 @@ +3x +x +6cx +5m9c9x9i +m +9m9c9x9i +mi +mi +mx +9m9c9x9i diff --git a/codenet/public_test_cases/p00719/input.0.txt b/codenet/public_test_cases/p00719/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e31ca65676f6a80f9f5a4ebf56209b9d9af2c544 --- /dev/null +++ b/codenet/public_test_cases/p00719/input.0.txt @@ -0,0 +1,31 @@ +3 4 3 1 4 +3 1 2 +1 2 10 +2 3 30 +3 4 20 +2 4 4 2 1 +3 1 +2 3 3 +1 3 3 +4 1 2 +4 2 5 +2 4 3 4 1 +5 5 +1 2 10 +2 3 10 +3 4 10 +1 2 0 1 2 +1 +8 5 10 1 5 +2 7 1 8 4 5 6 3 +1 2 5 +2 3 4 +3 4 7 +4 5 3 +1 3 25 +2 4 23 +3 5 22 +1 4 45 +2 5 51 +1 5 99 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00719/input.1.txt b/codenet/public_test_cases/p00719/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e31ca65676f6a80f9f5a4ebf56209b9d9af2c544 --- /dev/null +++ b/codenet/public_test_cases/p00719/input.1.txt @@ -0,0 +1,31 @@ +3 4 3 1 4 +3 1 2 +1 2 10 +2 3 30 +3 4 20 +2 4 4 2 1 +3 1 +2 3 3 +1 3 3 +4 1 2 +4 2 5 +2 4 3 4 1 +5 5 +1 2 10 +2 3 10 +3 4 10 +1 2 0 1 2 +1 +8 5 10 1 5 +2 7 1 8 4 5 6 3 +1 2 5 +2 3 4 +3 4 7 +4 5 3 +1 3 25 +2 4 23 +3 5 22 +1 4 45 +2 5 51 +1 5 99 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00719/output.0.txt b/codenet/public_test_cases/p00719/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..72a82e6f06fc4276cf495eb806db2b5e8df35cb6 --- /dev/null +++ b/codenet/public_test_cases/p00719/output.0.txt @@ -0,0 +1,5 @@ +30.000 +3.667 +Impossible +Impossible +2.856 diff --git a/codenet/public_test_cases/p00719/output.1.txt b/codenet/public_test_cases/p00719/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..72a82e6f06fc4276cf495eb806db2b5e8df35cb6 --- /dev/null +++ b/codenet/public_test_cases/p00719/output.1.txt @@ -0,0 +1,5 @@ +30.000 +3.667 +Impossible +Impossible +2.856 diff --git a/codenet/public_test_cases/p00720/input.0.txt b/codenet/public_test_cases/p00720/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bae9b8b4b123fa60ef8e77b2bc8b584b55f7ad02 --- /dev/null +++ b/codenet/public_test_cases/p00720/input.0.txt @@ -0,0 +1,37 @@ +3 5 10 +red +0 0 0 +5 0 0 +green +0 5 5 +5 6 1 +blue +0 40 5 +5 0 0 +3 10 5 +atom +0 47 32 +5 -10 -7 +10 1 0 +pluto +0 0 0 +7 0 0 +10 3 3 +gesicht +0 25 7 +5 -7 -2 +10 -1 10 +4 100 7 +impulse +0 -500 0 +100 10 1 +freedom +0 -491 0 +100 9 2 +destiny +0 -472 0 +100 7 4 +strike +0 -482 0 +100 8 3 +0 0 0 diff --git a/codenet/public_test_cases/p00720/input.1.txt b/codenet/public_test_cases/p00720/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bae9b8b4b123fa60ef8e77b2bc8b584b55f7ad02 --- /dev/null +++ b/codenet/public_test_cases/p00720/input.1.txt @@ -0,0 +1,37 @@ +3 5 10 +red +0 0 0 +5 0 0 +green +0 5 5 +5 6 1 +blue +0 40 5 +5 0 0 +3 10 5 +atom +0 47 32 +5 -10 -7 +10 1 0 +pluto +0 0 0 +7 0 0 +10 3 3 +gesicht +0 25 7 +5 -7 -2 +10 -1 10 +4 100 7 +impulse +0 -500 0 +100 10 1 +freedom +0 -491 0 +100 9 2 +destiny +0 -472 0 +100 7 4 +strike +0 -482 0 +100 8 3 +0 0 0 diff --git a/codenet/public_test_cases/p00720/output.0.txt b/codenet/public_test_cases/p00720/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..953b710a4bc38bc5bfe20e1129fcf8fcf684c6b7 --- /dev/null +++ b/codenet/public_test_cases/p00720/output.0.txt @@ -0,0 +1,9 @@ +blue +green +red +atom +gesicht +pluto +freedom +impulse +strike diff --git a/codenet/public_test_cases/p00720/output.1.txt b/codenet/public_test_cases/p00720/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..953b710a4bc38bc5bfe20e1129fcf8fcf684c6b7 --- /dev/null +++ b/codenet/public_test_cases/p00720/output.1.txt @@ -0,0 +1,9 @@ +blue +green +red +atom +gesicht +pluto +freedom +impulse +strike diff --git a/codenet/public_test_cases/p00721/input.0.txt b/codenet/public_test_cases/p00721/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d7ac010c698a604bc8ef4e7ec9c9088877d4920 --- /dev/null +++ b/codenet/public_test_cases/p00721/input.0.txt @@ -0,0 +1,32 @@ +7 5 +....... +.o...*. +....... +.*...*. +....... +15 13 +.......x....... +...o...x....*.. +.......x....... +.......x....... +.......x....... +............... +xxxxx.....xxxxx +............... +.......x....... +.......x....... +.......x....... +..*....x....*.. +.......x....... +10 10 +.......... +..o....... +.......... +.......... +.......... +.....xxxxx +.....x.... +.....x.*.. +.....x.... +.....x.... +0 0 diff --git a/codenet/public_test_cases/p00721/input.1.txt b/codenet/public_test_cases/p00721/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d7ac010c698a604bc8ef4e7ec9c9088877d4920 --- /dev/null +++ b/codenet/public_test_cases/p00721/input.1.txt @@ -0,0 +1,32 @@ +7 5 +....... +.o...*. +....... +.*...*. +....... +15 13 +.......x....... +...o...x....*.. +.......x....... +.......x....... +.......x....... +............... +xxxxx.....xxxxx +............... +.......x....... +.......x....... +.......x....... +..*....x....*.. +.......x....... +10 10 +.......... +..o....... +.......... +.......... +.......... +.....xxxxx +.....x.... +.....x.*.. +.....x.... +.....x.... +0 0 diff --git a/codenet/public_test_cases/p00721/output.0.txt b/codenet/public_test_cases/p00721/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..86fdbd906444c6d2911abb61b73a8d66d2c10abc --- /dev/null +++ b/codenet/public_test_cases/p00721/output.0.txt @@ -0,0 +1,3 @@ +8 +49 +-1 diff --git a/codenet/public_test_cases/p00721/output.1.txt b/codenet/public_test_cases/p00721/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86fdbd906444c6d2911abb61b73a8d66d2c10abc --- /dev/null +++ b/codenet/public_test_cases/p00721/output.1.txt @@ -0,0 +1,3 @@ +8 +49 +-1 diff --git a/codenet/public_test_cases/p00722/input.0.txt b/codenet/public_test_cases/p00722/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c02c8c4463334da215818a86786a5243f1c5a95d --- /dev/null +++ b/codenet/public_test_cases/p00722/input.0.txt @@ -0,0 +1,13 @@ +367 186 151 +179 10 203 +271 37 39 +103 230 1 +27 104 185 +253 50 85 +1 1 1 +9075 337 210 +307 24 79 +331 221 177 +259 170 40 +269 58 102 +0 0 0 diff --git a/codenet/public_test_cases/p00722/input.1.txt b/codenet/public_test_cases/p00722/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c02c8c4463334da215818a86786a5243f1c5a95d --- /dev/null +++ b/codenet/public_test_cases/p00722/input.1.txt @@ -0,0 +1,13 @@ +367 186 151 +179 10 203 +271 37 39 +103 230 1 +27 104 185 +253 50 85 +1 1 1 +9075 337 210 +307 24 79 +331 221 177 +259 170 40 +269 58 102 +0 0 0 diff --git a/codenet/public_test_cases/p00722/output.0.txt b/codenet/public_test_cases/p00722/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8b5970bfe5455f1d820d13234f66cf7885bf6a4 --- /dev/null +++ b/codenet/public_test_cases/p00722/output.0.txt @@ -0,0 +1,12 @@ +92809 +6709 +12037 +103 +93523 +14503 +2 +899429 +5107 +412717 +22699 +25673 diff --git a/codenet/public_test_cases/p00722/output.1.txt b/codenet/public_test_cases/p00722/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8b5970bfe5455f1d820d13234f66cf7885bf6a4 --- /dev/null +++ b/codenet/public_test_cases/p00722/output.1.txt @@ -0,0 +1,12 @@ +92809 +6709 +12037 +103 +93523 +14503 +2 +899429 +5107 +412717 +22699 +25673 diff --git a/codenet/public_test_cases/p00723/input.0.txt b/codenet/public_test_cases/p00723/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7759f8c5285226d9dbd0646e7b930b2cbae5c85b --- /dev/null +++ b/codenet/public_test_cases/p00723/input.0.txt @@ -0,0 +1,5 @@ +4 +aa +abba +abcd +abcde diff --git a/codenet/public_test_cases/p00723/input.1.txt b/codenet/public_test_cases/p00723/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7759f8c5285226d9dbd0646e7b930b2cbae5c85b --- /dev/null +++ b/codenet/public_test_cases/p00723/input.1.txt @@ -0,0 +1,5 @@ +4 +aa +abba +abcd +abcde diff --git a/codenet/public_test_cases/p00723/output.0.txt b/codenet/public_test_cases/p00723/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b90284a5d3c8df49e4e8c7c7a858723e16624c7f --- /dev/null +++ b/codenet/public_test_cases/p00723/output.0.txt @@ -0,0 +1,4 @@ +1 +6 +12 +18 diff --git a/codenet/public_test_cases/p00723/output.1.txt b/codenet/public_test_cases/p00723/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b90284a5d3c8df49e4e8c7c7a858723e16624c7f --- /dev/null +++ b/codenet/public_test_cases/p00723/output.1.txt @@ -0,0 +1,4 @@ +1 +6 +12 +18 diff --git a/codenet/public_test_cases/p00724/input.0.txt b/codenet/public_test_cases/p00724/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c5de43e7b28f4a05fbf921077dfb13b5ca02527 --- /dev/null +++ b/codenet/public_test_cases/p00724/input.0.txt @@ -0,0 +1,60 @@ +3 +2 -2 +2 -1 +1 0 +1 +0 2 +0 0 +4 +2 -2 +2 -1 +2 0 +3 0 +2 +1 -1 +0 2 +0 0 +8 +-6 0 +-5 0 +-4 0 +-3 0 +-2 0 +-1 0 +0 0 +1 0 +1 +-1 1 +0 0 +6 +2 -3 +3 -3 +3 -2 +3 -1 +3 0 +2 1 +3 +1 -1 +1 0 +1 1 +0 0 +3 +-8000 4996 +-8000 4997 +-8000 4998 +2 +-7999 4999 +-8001 5000 +-8000 5000 +8 +10 -8 +9 -7 +9 -6 +9 -5 +9 -4 +9 -3 +9 -2 +9 -1 +0 +0 0 +0 diff --git a/codenet/public_test_cases/p00724/input.1.txt b/codenet/public_test_cases/p00724/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c5de43e7b28f4a05fbf921077dfb13b5ca02527 --- /dev/null +++ b/codenet/public_test_cases/p00724/input.1.txt @@ -0,0 +1,60 @@ +3 +2 -2 +2 -1 +1 0 +1 +0 2 +0 0 +4 +2 -2 +2 -1 +2 0 +3 0 +2 +1 -1 +0 2 +0 0 +8 +-6 0 +-5 0 +-4 0 +-3 0 +-2 0 +-1 0 +0 0 +1 0 +1 +-1 1 +0 0 +6 +2 -3 +3 -3 +3 -2 +3 -1 +3 0 +2 1 +3 +1 -1 +1 0 +1 1 +0 0 +3 +-8000 4996 +-8000 4997 +-8000 4998 +2 +-7999 4999 +-8001 5000 +-8000 5000 +8 +10 -8 +9 -7 +9 -6 +9 -5 +9 -4 +9 -3 +9 -2 +9 -1 +0 +0 0 +0 diff --git a/codenet/public_test_cases/p00724/output.0.txt b/codenet/public_test_cases/p00724/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fdb856ac94957d63e2dd8e1ab3231e63f584eb5 --- /dev/null +++ b/codenet/public_test_cases/p00724/output.0.txt @@ -0,0 +1,6 @@ +3 +9 +18 +18 +19 +20 diff --git a/codenet/public_test_cases/p00724/output.1.txt b/codenet/public_test_cases/p00724/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fdb856ac94957d63e2dd8e1ab3231e63f584eb5 --- /dev/null +++ b/codenet/public_test_cases/p00724/output.1.txt @@ -0,0 +1,6 @@ +3 +9 +18 +18 +19 +20 diff --git a/codenet/public_test_cases/p00725/input.0.txt b/codenet/public_test_cases/p00725/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..269851f3620104ee186076ad3547fdf719642bfa --- /dev/null +++ b/codenet/public_test_cases/p00725/input.0.txt @@ -0,0 +1,18 @@ +2 1 +3 2 +6 6 +1 0 0 2 1 0 +1 1 0 0 0 0 +0 0 0 0 0 3 +0 0 0 0 0 0 +1 0 0 0 0 1 +0 1 1 1 1 1 +6 1 +1 1 2 1 1 3 +6 1 +1 0 2 1 1 3 +12 1 +2 0 1 1 1 1 1 1 1 1 1 3 +13 1 +2 0 1 1 1 1 1 1 1 1 1 1 3 +0 0 diff --git a/codenet/public_test_cases/p00725/input.1.txt b/codenet/public_test_cases/p00725/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..269851f3620104ee186076ad3547fdf719642bfa --- /dev/null +++ b/codenet/public_test_cases/p00725/input.1.txt @@ -0,0 +1,18 @@ +2 1 +3 2 +6 6 +1 0 0 2 1 0 +1 1 0 0 0 0 +0 0 0 0 0 3 +0 0 0 0 0 0 +1 0 0 0 0 1 +0 1 1 1 1 1 +6 1 +1 1 2 1 1 3 +6 1 +1 0 2 1 1 3 +12 1 +2 0 1 1 1 1 1 1 1 1 1 3 +13 1 +2 0 1 1 1 1 1 1 1 1 1 1 3 +0 0 diff --git a/codenet/public_test_cases/p00725/output.0.txt b/codenet/public_test_cases/p00725/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bac7b2a8783a8e09df7f2241911570adc43f261a --- /dev/null +++ b/codenet/public_test_cases/p00725/output.0.txt @@ -0,0 +1,6 @@ +1 +4 +-1 +4 +10 +-1 diff --git a/codenet/public_test_cases/p00725/output.1.txt b/codenet/public_test_cases/p00725/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bac7b2a8783a8e09df7f2241911570adc43f261a --- /dev/null +++ b/codenet/public_test_cases/p00725/output.1.txt @@ -0,0 +1,6 @@ +1 +4 +-1 +4 +10 +-1 diff --git a/codenet/public_test_cases/p00726/input.0.txt b/codenet/public_test_cases/p00726/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..16999f829c00aa9e963c1fbac736b694cea97d42 --- /dev/null +++ b/codenet/public_test_cases/p00726/input.0.txt @@ -0,0 +1,5 @@ +ABC 3 +ABC 0 +2(4(AB)3(XY))10C 30 +1000(1000(1000(1000(1000(1000(NM)))))) 999999 +0 0 diff --git a/codenet/public_test_cases/p00726/input.1.txt b/codenet/public_test_cases/p00726/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..16999f829c00aa9e963c1fbac736b694cea97d42 --- /dev/null +++ b/codenet/public_test_cases/p00726/input.1.txt @@ -0,0 +1,5 @@ +ABC 3 +ABC 0 +2(4(AB)3(XY))10C 30 +1000(1000(1000(1000(1000(1000(NM)))))) 999999 +0 0 diff --git a/codenet/public_test_cases/p00726/output.0.txt b/codenet/public_test_cases/p00726/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4efffa58e0ca50ef17bd0a6b67836c05cf2bae7 --- /dev/null +++ b/codenet/public_test_cases/p00726/output.0.txt @@ -0,0 +1,4 @@ +0 +A +C +M diff --git a/codenet/public_test_cases/p00726/output.1.txt b/codenet/public_test_cases/p00726/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4efffa58e0ca50ef17bd0a6b67836c05cf2bae7 --- /dev/null +++ b/codenet/public_test_cases/p00726/output.1.txt @@ -0,0 +1,4 @@ +0 +A +C +M diff --git a/codenet/public_test_cases/p00727/input.0.txt b/codenet/public_test_cases/p00727/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..46719f29a4929da349056c0bab6234e03fde53c6 --- /dev/null +++ b/codenet/public_test_cases/p00727/input.0.txt @@ -0,0 +1,28 @@ +3 +1 1 +3 1 +4 3 +4 +1 1 +2 3 +3 8 +1 9 +8 +1 1 +3 1 +6 1 +1 3 +5 3 +1 7 +3 5 +5 5 +8 +20 7 +1 27 +30 14 +9 6 +17 13 +4 2 +17 7 +8 9 +0 diff --git a/codenet/public_test_cases/p00727/input.1.txt b/codenet/public_test_cases/p00727/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46719f29a4929da349056c0bab6234e03fde53c6 --- /dev/null +++ b/codenet/public_test_cases/p00727/input.1.txt @@ -0,0 +1,28 @@ +3 +1 1 +3 1 +4 3 +4 +1 1 +2 3 +3 8 +1 9 +8 +1 1 +3 1 +6 1 +1 3 +5 3 +1 7 +3 5 +5 5 +8 +20 7 +1 27 +30 14 +9 6 +17 13 +4 2 +17 7 +8 9 +0 diff --git a/codenet/public_test_cases/p00727/output.0.txt b/codenet/public_test_cases/p00727/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e467a54db81206459d2d77f712b9612d48d7003 --- /dev/null +++ b/codenet/public_test_cases/p00727/output.0.txt @@ -0,0 +1,8 @@ +2.553590050042226 +0.982793723247329 +1.570796326794896 +2.819842099193151 +1.325817663668032 +2.094395102393196 +2.777613697080149 +0.588002603547568 diff --git a/codenet/public_test_cases/p00727/output.1.txt b/codenet/public_test_cases/p00727/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e467a54db81206459d2d77f712b9612d48d7003 --- /dev/null +++ b/codenet/public_test_cases/p00727/output.1.txt @@ -0,0 +1,8 @@ +2.553590050042226 +0.982793723247329 +1.570796326794896 +2.819842099193151 +1.325817663668032 +2.094395102393196 +2.777613697080149 +0.588002603547568 diff --git a/codenet/public_test_cases/p00728/input.0.txt b/codenet/public_test_cases/p00728/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f83c41f0490e6e703d67a8d95e9b37ab92c1ac68 --- /dev/null +++ b/codenet/public_test_cases/p00728/input.0.txt @@ -0,0 +1,26 @@ +3 +1000 +342 +0 +5 +2 +2 +9 +11 +932 +5 +300 +1000 +0 +200 +400 +8 +353 +242 +402 +274 +283 +132 +402 +523 +0 diff --git a/codenet/public_test_cases/p00728/input.1.txt b/codenet/public_test_cases/p00728/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f83c41f0490e6e703d67a8d95e9b37ab92c1ac68 --- /dev/null +++ b/codenet/public_test_cases/p00728/input.1.txt @@ -0,0 +1,26 @@ +3 +1000 +342 +0 +5 +2 +2 +9 +11 +932 +5 +300 +1000 +0 +200 +400 +8 +353 +242 +402 +274 +283 +132 +402 +523 +0 diff --git a/codenet/public_test_cases/p00728/output.0.txt b/codenet/public_test_cases/p00728/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad78128b4ee7261a68a2ce746ac3ba9a1b594342 --- /dev/null +++ b/codenet/public_test_cases/p00728/output.0.txt @@ -0,0 +1,4 @@ +342 +7 +300 +326 diff --git a/codenet/public_test_cases/p00728/output.1.txt b/codenet/public_test_cases/p00728/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad78128b4ee7261a68a2ce746ac3ba9a1b594342 --- /dev/null +++ b/codenet/public_test_cases/p00728/output.1.txt @@ -0,0 +1,4 @@ +342 +7 +300 +326 diff --git a/codenet/public_test_cases/p00729/input.0.txt b/codenet/public_test_cases/p00729/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc4d7274bfd27adc5b02000b8744706657fa1b03 --- /dev/null +++ b/codenet/public_test_cases/p00729/input.0.txt @@ -0,0 +1,43 @@ +4 2 +10 +775 1 1 1 +780 4 2 1 +790 2 1 1 +800 2 1 0 +810 3 1 1 +820 1 1 0 +825 3 1 0 +860 1 1 1 +870 4 2 0 +880 1 1 0 +1 +780 870 1 +13 15 +12 +540 12 13 1 +600 12 13 0 +650 13 15 1 +660 12 15 1 +665 11 13 1 +670 13 15 0 +675 11 13 0 +680 12 15 0 +1000 11 14 1 +1060 12 14 1 +1060 11 14 0 +1080 12 14 0 +3 +540 700 13 +600 1000 15 +1000 1200 11 +1 1 +2 +600 1 1 1 +700 1 1 0 +5 +540 600 1 +550 650 1 +610 620 1 +650 750 1 +700 800 1 +0 0 diff --git a/codenet/public_test_cases/p00729/input.1.txt b/codenet/public_test_cases/p00729/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc4d7274bfd27adc5b02000b8744706657fa1b03 --- /dev/null +++ b/codenet/public_test_cases/p00729/input.1.txt @@ -0,0 +1,43 @@ +4 2 +10 +775 1 1 1 +780 4 2 1 +790 2 1 1 +800 2 1 0 +810 3 1 1 +820 1 1 0 +825 3 1 0 +860 1 1 1 +870 4 2 0 +880 1 1 0 +1 +780 870 1 +13 15 +12 +540 12 13 1 +600 12 13 0 +650 13 15 1 +660 12 15 1 +665 11 13 1 +670 13 15 0 +675 11 13 0 +680 12 15 0 +1000 11 14 1 +1060 12 14 1 +1060 11 14 0 +1080 12 14 0 +3 +540 700 13 +600 1000 15 +1000 1200 11 +1 1 +2 +600 1 1 1 +700 1 1 0 +5 +540 600 1 +550 650 1 +610 620 1 +650 750 1 +700 800 1 +0 0 diff --git a/codenet/public_test_cases/p00729/output.0.txt b/codenet/public_test_cases/p00729/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da60bf3a1bae0549f3dc8fc9771a2e3b37a7bfd5 --- /dev/null +++ b/codenet/public_test_cases/p00729/output.0.txt @@ -0,0 +1,9 @@ +55 +70 +30 +0 +0 +50 +10 +50 +0 diff --git a/codenet/public_test_cases/p00729/output.1.txt b/codenet/public_test_cases/p00729/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..da60bf3a1bae0549f3dc8fc9771a2e3b37a7bfd5 --- /dev/null +++ b/codenet/public_test_cases/p00729/output.1.txt @@ -0,0 +1,9 @@ +55 +70 +30 +0 +0 +50 +10 +50 +0 diff --git a/codenet/public_test_cases/p00730/input.0.txt b/codenet/public_test_cases/p00730/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7c1c7d3278b8ab474610412605f099a2517388d --- /dev/null +++ b/codenet/public_test_cases/p00730/input.0.txt @@ -0,0 +1,10 @@ +3 5 6 +1 18 +2 19 +1 2 +3 4 1 +1 1 +2 1 +3 1 +0 2 5 +0 0 0 diff --git a/codenet/public_test_cases/p00730/input.1.txt b/codenet/public_test_cases/p00730/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7c1c7d3278b8ab474610412605f099a2517388d --- /dev/null +++ b/codenet/public_test_cases/p00730/input.1.txt @@ -0,0 +1,10 @@ +3 5 6 +1 18 +2 19 +1 2 +3 4 1 +1 1 +2 1 +3 1 +0 2 5 +0 0 0 diff --git a/codenet/public_test_cases/p00730/output.0.txt b/codenet/public_test_cases/p00730/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..031fbb974d38a0c2407900859f830be6ca3a0994 --- /dev/null +++ b/codenet/public_test_cases/p00730/output.0.txt @@ -0,0 +1,3 @@ +4 4 6 16 +1 1 1 1 +10 diff --git a/codenet/public_test_cases/p00730/output.1.txt b/codenet/public_test_cases/p00730/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..031fbb974d38a0c2407900859f830be6ca3a0994 --- /dev/null +++ b/codenet/public_test_cases/p00730/output.1.txt @@ -0,0 +1,3 @@ +4 4 6 16 +1 1 1 1 +10 diff --git a/codenet/public_test_cases/p00731/input.0.txt b/codenet/public_test_cases/p00731/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91ffc5559378f28dbde5a6cd737a519f42e562df --- /dev/null +++ b/codenet/public_test_cases/p00731/input.0.txt @@ -0,0 +1,49 @@ +6 6 +4 4 X X T T +4 7 8 2 X 7 +3 X X X 1 8 +1 2 X X X 6 +1 1 2 4 4 7 +S S 2 3 X X +2 10 +T 1 +1 X +1 X +1 X +1 1 +1 X +1 X +1 1 +1 X +S S +2 10 +T X +1 X +1 X +1 X +1 1 +1 X +1 X +1 1 +1 X +S S +10 10 +T T T T T T T T T T +X 2 X X X X X 3 4 X +9 8 9 X X X 2 9 X 9 +7 7 X 7 3 X X 8 9 X +8 9 9 9 6 3 X 5 X 5 +8 9 9 9 6 X X 5 X 5 +8 6 5 4 6 8 X 5 X 5 +8 9 3 9 6 8 X 5 X 5 +8 3 9 9 6 X X X 5 X +S S S S S S S S S S +10 7 +2 3 2 3 2 3 2 3 T T +1 2 3 2 3 2 3 2 3 2 +3 2 3 2 3 2 3 2 3 4 +3 2 3 2 3 2 3 2 3 5 +3 2 3 1 3 2 3 2 3 5 +2 2 3 2 4 2 3 2 3 5 +S S 2 3 2 1 2 3 2 3 +0 0 diff --git a/codenet/public_test_cases/p00731/input.1.txt b/codenet/public_test_cases/p00731/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91ffc5559378f28dbde5a6cd737a519f42e562df --- /dev/null +++ b/codenet/public_test_cases/p00731/input.1.txt @@ -0,0 +1,49 @@ +6 6 +4 4 X X T T +4 7 8 2 X 7 +3 X X X 1 8 +1 2 X X X 6 +1 1 2 4 4 7 +S S 2 3 X X +2 10 +T 1 +1 X +1 X +1 X +1 1 +1 X +1 X +1 1 +1 X +S S +2 10 +T X +1 X +1 X +1 X +1 1 +1 X +1 X +1 1 +1 X +S S +10 10 +T T T T T T T T T T +X 2 X X X X X 3 4 X +9 8 9 X X X 2 9 X 9 +7 7 X 7 3 X X 8 9 X +8 9 9 9 6 3 X 5 X 5 +8 9 9 9 6 X X 5 X 5 +8 6 5 4 6 8 X 5 X 5 +8 9 3 9 6 8 X 5 X 5 +8 3 9 9 6 X X X 5 X +S S S S S S S S S S +10 7 +2 3 2 3 2 3 2 3 T T +1 2 3 2 3 2 3 2 3 2 +3 2 3 2 3 2 3 2 3 4 +3 2 3 2 3 2 3 2 3 5 +3 2 3 1 3 2 3 2 3 5 +2 2 3 2 4 2 3 2 3 5 +S S 2 3 2 1 2 3 2 3 +0 0 diff --git a/codenet/public_test_cases/p00731/output.0.txt b/codenet/public_test_cases/p00731/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b77064440e40fae23176f0cbfb48b9d82e525d74 --- /dev/null +++ b/codenet/public_test_cases/p00731/output.0.txt @@ -0,0 +1,5 @@ +12 +5 +-1 +22 +12 diff --git a/codenet/public_test_cases/p00731/output.1.txt b/codenet/public_test_cases/p00731/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b77064440e40fae23176f0cbfb48b9d82e525d74 --- /dev/null +++ b/codenet/public_test_cases/p00731/output.1.txt @@ -0,0 +1,5 @@ +12 +5 +-1 +22 +12 diff --git a/codenet/public_test_cases/p00732/input.0.txt b/codenet/public_test_cases/p00732/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74c93e97cb881ad7aadcac79d820708d2311024d --- /dev/null +++ b/codenet/public_test_cases/p00732/input.0.txt @@ -0,0 +1,46 @@ +4.0 2.0 8 +-1 0 +5 0 +5 -2 +7 -2 +7 0 +18 0 +18 6 +-1 6 +4.0 2.0 4 +-1 0 +10 0 +10 12 +-1 12 +4.0 1.0 7 +-1 0 +2 0 +-1 -3 +-1 -8 +6 -8 +6 6 +-1 6 +4.0 2.0 6 +-1 0 +10 0 +10 3 +7 3 +7 5 +-1 5 +5.0 2.0 6 +-1 0 +2 0 +2 -4 +6 -4 +6 6 +-1 6 +6.0 1.0 8 +-1 0 +8 0 +7 2 +9 2 +8 4 +11 4 +11 12 +-1 12 +0 0 0 diff --git a/codenet/public_test_cases/p00732/input.1.txt b/codenet/public_test_cases/p00732/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74c93e97cb881ad7aadcac79d820708d2311024d --- /dev/null +++ b/codenet/public_test_cases/p00732/input.1.txt @@ -0,0 +1,46 @@ +4.0 2.0 8 +-1 0 +5 0 +5 -2 +7 -2 +7 0 +18 0 +18 6 +-1 6 +4.0 2.0 4 +-1 0 +10 0 +10 12 +-1 12 +4.0 1.0 7 +-1 0 +2 0 +-1 -3 +-1 -8 +6 -8 +6 6 +-1 6 +4.0 2.0 6 +-1 0 +10 0 +10 3 +7 3 +7 5 +-1 5 +5.0 2.0 6 +-1 0 +2 0 +2 -4 +6 -4 +6 6 +-1 6 +6.0 1.0 8 +-1 0 +8 0 +7 2 +9 2 +8 4 +11 4 +11 12 +-1 12 +0 0 0 diff --git a/codenet/public_test_cases/p00732/output.0.txt b/codenet/public_test_cases/p00732/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..544fe6164b2e502719b40c04b75650a8290b0af7 --- /dev/null +++ b/codenet/public_test_cases/p00732/output.0.txt @@ -0,0 +1,6 @@ +16.0 0.0 +9.999999999999998 7.4641016151377535 +0.585786437626906 -5.414213562373095 +8.0 0.0 +6.0 0.0 +9.52786404500042 4.0 diff --git a/codenet/public_test_cases/p00732/output.1.txt b/codenet/public_test_cases/p00732/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..544fe6164b2e502719b40c04b75650a8290b0af7 --- /dev/null +++ b/codenet/public_test_cases/p00732/output.1.txt @@ -0,0 +1,6 @@ +16.0 0.0 +9.999999999999998 7.4641016151377535 +0.585786437626906 -5.414213562373095 +8.0 0.0 +6.0 0.0 +9.52786404500042 4.0 diff --git a/codenet/public_test_cases/p00733/input.0.txt b/codenet/public_test_cases/p00733/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d51a81c7862ddd53b29ef70119c5ea37b74a9e10 --- /dev/null +++ b/codenet/public_test_cases/p00733/input.0.txt @@ -0,0 +1,8 @@ +(((x x) x) ((x x) (x (x x)))) +(((x x) (x x)) ((x x) ((x x) (x x)))) +(((x x) ((x x) x)) (((x (x x)) x) (x x))) +(((x x) x) ((x x) (((((x x) x) x) x) x))) +(((x x) x) ((x (x x)) (x (x x)))) +((((x (x x)) x) (x ((x x) x))) ((x (x x)) (x x))) +((((x x) x) ((x x) (x (x x)))) (((x x) (x x)) ((x x) ((x x) (x x))))) +0 diff --git a/codenet/public_test_cases/p00733/input.1.txt b/codenet/public_test_cases/p00733/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d51a81c7862ddd53b29ef70119c5ea37b74a9e10 --- /dev/null +++ b/codenet/public_test_cases/p00733/input.1.txt @@ -0,0 +1,8 @@ +(((x x) x) ((x x) (x (x x)))) +(((x x) (x x)) ((x x) ((x x) (x x)))) +(((x x) ((x x) x)) (((x (x x)) x) (x x))) +(((x x) x) ((x x) (((((x x) x) x) x) x))) +(((x x) x) ((x (x x)) (x (x x)))) +((((x (x x)) x) (x ((x x) x))) ((x (x x)) (x x))) +((((x x) x) ((x x) (x (x x)))) (((x x) (x x)) ((x x) ((x x) (x x))))) +0 diff --git a/codenet/public_test_cases/p00733/output.0.txt b/codenet/public_test_cases/p00733/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..789cbccdce592a6db5b1f2d2845eb914f781289e --- /dev/null +++ b/codenet/public_test_cases/p00733/output.0.txt @@ -0,0 +1,7 @@ +((x (x x)) ((x x) ((x x) x))) +(((x x) ((x x) (x x))) ((x x) (x x))) +(((x ((x x) x)) (x x)) ((x x) ((x x) x))) +(((x ((x ((x x) x)) x)) (x x)) ((x x) x)) +((x (x x)) ((x (x x)) ((x x) x))) +(((x (x x)) (x x)) ((x ((x x) x)) ((x (x x)) x))) +(((x (x x)) ((x x) ((x x) x))) (((x x) (x x)) (((x x) (x x)) (x x)))) diff --git a/codenet/public_test_cases/p00733/output.1.txt b/codenet/public_test_cases/p00733/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..789cbccdce592a6db5b1f2d2845eb914f781289e --- /dev/null +++ b/codenet/public_test_cases/p00733/output.1.txt @@ -0,0 +1,7 @@ +((x (x x)) ((x x) ((x x) x))) +(((x x) ((x x) (x x))) ((x x) (x x))) +(((x ((x x) x)) (x x)) ((x x) ((x x) x))) +(((x ((x ((x x) x)) x)) (x x)) ((x x) x)) +((x (x x)) ((x (x x)) ((x x) x))) +(((x (x x)) (x x)) ((x ((x x) x)) ((x (x x)) x))) +(((x (x x)) ((x x) ((x x) x))) (((x x) (x x)) (((x x) (x x)) (x x)))) diff --git a/codenet/public_test_cases/p00734/input.0.txt b/codenet/public_test_cases/p00734/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2746c81684b429799b8c8a979e028000c4762f2a --- /dev/null +++ b/codenet/public_test_cases/p00734/input.0.txt @@ -0,0 +1,46 @@ +2 2 +1 +5 +3 +7 +6 5 +3 +9 +5 +2 +3 +3 +12 +2 +7 +3 +5 +4 5 +10 +0 +3 +8 +1 +9 +6 +0 +6 +7 4 +1 +1 +2 +1 +2 +1 +4 +2 +3 +4 +3 +2 3 +1 +1 +2 +2 +2 +0 0 diff --git a/codenet/public_test_cases/p00734/input.1.txt b/codenet/public_test_cases/p00734/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2746c81684b429799b8c8a979e028000c4762f2a --- /dev/null +++ b/codenet/public_test_cases/p00734/input.1.txt @@ -0,0 +1,46 @@ +2 2 +1 +5 +3 +7 +6 5 +3 +9 +5 +2 +3 +3 +12 +2 +7 +3 +5 +4 5 +10 +0 +3 +8 +1 +9 +6 +0 +6 +7 4 +1 +1 +2 +1 +2 +1 +4 +2 +3 +4 +3 +2 3 +1 +1 +2 +2 +2 +0 0 diff --git a/codenet/public_test_cases/p00734/output.0.txt b/codenet/public_test_cases/p00734/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f8751154e3ef758f1d652547f7cdebe41d35e08 --- /dev/null +++ b/codenet/public_test_cases/p00734/output.0.txt @@ -0,0 +1,5 @@ +1 3 +3 5 +-1 +2 2 +-1 diff --git a/codenet/public_test_cases/p00734/output.1.txt b/codenet/public_test_cases/p00734/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f8751154e3ef758f1d652547f7cdebe41d35e08 --- /dev/null +++ b/codenet/public_test_cases/p00734/output.1.txt @@ -0,0 +1,5 @@ +1 3 +3 5 +-1 +2 2 +-1 diff --git a/codenet/public_test_cases/p00735/input.0.txt b/codenet/public_test_cases/p00735/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..92f913c60ac7f91614587323917f849586ab37cf --- /dev/null +++ b/codenet/public_test_cases/p00735/input.0.txt @@ -0,0 +1,6 @@ +205920 +262144 +262200 +279936 +299998 +1 diff --git a/codenet/public_test_cases/p00735/input.1.txt b/codenet/public_test_cases/p00735/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..92f913c60ac7f91614587323917f849586ab37cf --- /dev/null +++ b/codenet/public_test_cases/p00735/input.1.txt @@ -0,0 +1,6 @@ +205920 +262144 +262200 +279936 +299998 +1 diff --git a/codenet/public_test_cases/p00735/output.0.txt b/codenet/public_test_cases/p00735/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37153417e466c625ed1be68d78dad1baacab86a6 --- /dev/null +++ b/codenet/public_test_cases/p00735/output.0.txt @@ -0,0 +1,5 @@ +205920: 6 8 13 15 20 22 55 99 +262144: 8 +262200: 6 8 15 20 50 57 69 76 92 190 230 475 575 874 2185 +279936: 6 8 27 +299998: 299998 diff --git a/codenet/public_test_cases/p00735/output.1.txt b/codenet/public_test_cases/p00735/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37153417e466c625ed1be68d78dad1baacab86a6 --- /dev/null +++ b/codenet/public_test_cases/p00735/output.1.txt @@ -0,0 +1,5 @@ +205920: 6 8 13 15 20 22 55 99 +262144: 8 +262200: 6 8 15 20 50 57 69 76 92 190 230 475 575 874 2185 +279936: 6 8 27 +299998: 299998 diff --git a/codenet/public_test_cases/p00736/input.0.txt b/codenet/public_test_cases/p00736/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..70cdf36c8024d8c28413809854299c82fb0cd062 --- /dev/null +++ b/codenet/public_test_cases/p00736/input.0.txt @@ -0,0 +1,7 @@ +(P*Q) +(--R+(P*Q)) +(P*-P) +2 +1 +(-1+(((---P+Q)*(--Q+---R))*(-R+-P))) +. diff --git a/codenet/public_test_cases/p00736/input.1.txt b/codenet/public_test_cases/p00736/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..70cdf36c8024d8c28413809854299c82fb0cd062 --- /dev/null +++ b/codenet/public_test_cases/p00736/input.1.txt @@ -0,0 +1,7 @@ +(P*Q) +(--R+(P*Q)) +(P*-P) +2 +1 +(-1+(((---P+Q)*(--Q+---R))*(-R+-P))) +. diff --git a/codenet/public_test_cases/p00736/output.0.txt b/codenet/public_test_cases/p00736/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6201bb738dab5a64c50d0da4b7d91103d86b2811 --- /dev/null +++ b/codenet/public_test_cases/p00736/output.0.txt @@ -0,0 +1,6 @@ +3 +11 +0 +27 +0 +7 diff --git a/codenet/public_test_cases/p00736/output.1.txt b/codenet/public_test_cases/p00736/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6201bb738dab5a64c50d0da4b7d91103d86b2811 --- /dev/null +++ b/codenet/public_test_cases/p00736/output.1.txt @@ -0,0 +1,6 @@ +3 +11 +0 +27 +0 +7 diff --git a/codenet/public_test_cases/p00737/input.0.txt b/codenet/public_test_cases/p00737/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..704f18e50c22c173298ff0f06835b7680bac1268 --- /dev/null +++ b/codenet/public_test_cases/p00737/input.0.txt @@ -0,0 +1,22 @@ +8 3 +0 0 0 0 0 0 0 1 +2 3 0 1 4 0 0 1 +3 3 0 0 0 0 0 4 +9 9 1 9 +4 4 +3 3 4 0 +1 2 4 4 +1 1 1 0 +0 2 4 4 +8 7 2 1 +2 8 +2 2 +4 1 +0 4 +1 3 +1 0 +2 1 +0 3 +1 4 +1 9 3 1 +0 0 diff --git a/codenet/public_test_cases/p00737/input.1.txt b/codenet/public_test_cases/p00737/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..704f18e50c22c173298ff0f06835b7680bac1268 --- /dev/null +++ b/codenet/public_test_cases/p00737/input.1.txt @@ -0,0 +1,22 @@ +8 3 +0 0 0 0 0 0 0 1 +2 3 0 1 4 0 0 1 +3 3 0 0 0 0 0 4 +9 9 1 9 +4 4 +3 3 4 0 +1 2 4 4 +1 1 1 0 +0 2 4 4 +8 7 2 1 +2 8 +2 2 +4 1 +0 4 +1 3 +1 0 +2 1 +0 3 +1 4 +1 9 3 1 +0 0 diff --git a/codenet/public_test_cases/p00737/output.0.txt b/codenet/public_test_cases/p00737/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddf11cf6267ea205e050a761f12feddcf9426cdd --- /dev/null +++ b/codenet/public_test_cases/p00737/output.0.txt @@ -0,0 +1,3 @@ +1 +11 +6 diff --git a/codenet/public_test_cases/p00737/output.1.txt b/codenet/public_test_cases/p00737/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddf11cf6267ea205e050a761f12feddcf9426cdd --- /dev/null +++ b/codenet/public_test_cases/p00737/output.1.txt @@ -0,0 +1,3 @@ +1 +11 +6 diff --git a/codenet/public_test_cases/p00738/input.0.txt b/codenet/public_test_cases/p00738/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d8e82e2f79f60bfb55409913d0e6b61ea30b931 --- /dev/null +++ b/codenet/public_test_cases/p00738/input.0.txt @@ -0,0 +1,38 @@ +2 +-40 -40 100 30 +-100 -100 -50 -30 1 +30 -70 90 -30 10 +2 +-4 -4 10 3 +-10 -10 -5 -3 1 +3 -7 9 -3 1 +2 +-40 -40 100 30 +-100 -100 -50 -30 3 +30 -70 90 -30 10 +2 +-400 -400 1000 300 +-800 -800 -500 -300 7 +300 -700 900 -300 20 +3 +20 70 150 70 +0 0 50 50 4 +40 100 60 120 8 +130 80 200 200 1 +3 +20 70 150 70 +0 0 50 50 4 +40 100 60 120 10 +130 80 200 200 1 +3 +20 70 150 70 +0 0 50 50 10 +40 100 60 120 10 +130 80 200 200 3 +1 +2 4 8 8 +0 0 10 10 1 +1 +1 4 9 9 +2 2 7 7 1 +0 diff --git a/codenet/public_test_cases/p00738/input.1.txt b/codenet/public_test_cases/p00738/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d8e82e2f79f60bfb55409913d0e6b61ea30b931 --- /dev/null +++ b/codenet/public_test_cases/p00738/input.1.txt @@ -0,0 +1,38 @@ +2 +-40 -40 100 30 +-100 -100 -50 -30 1 +30 -70 90 -30 10 +2 +-4 -4 10 3 +-10 -10 -5 -3 1 +3 -7 9 -3 1 +2 +-40 -40 100 30 +-100 -100 -50 -30 3 +30 -70 90 -30 10 +2 +-400 -400 1000 300 +-800 -800 -500 -300 7 +300 -700 900 -300 20 +3 +20 70 150 70 +0 0 50 50 4 +40 100 60 120 8 +130 80 200 200 1 +3 +20 70 150 70 +0 0 50 50 4 +40 100 60 120 10 +130 80 200 200 1 +3 +20 70 150 70 +0 0 50 50 10 +40 100 60 120 10 +130 80 200 200 3 +1 +2 4 8 8 +0 0 10 10 1 +1 +1 4 9 9 +2 2 7 7 1 +0 diff --git a/codenet/public_test_cases/p00738/output.0.txt b/codenet/public_test_cases/p00738/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e5161d06c67d2972f9bf463f71d142efe64c98b --- /dev/null +++ b/codenet/public_test_cases/p00738/output.0.txt @@ -0,0 +1,9 @@ +30 +1 +18.16666666667 +717.7857142857 +50.5 +50 +18.16666666667 +0 +0 diff --git a/codenet/public_test_cases/p00738/output.1.txt b/codenet/public_test_cases/p00738/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e5161d06c67d2972f9bf463f71d142efe64c98b --- /dev/null +++ b/codenet/public_test_cases/p00738/output.1.txt @@ -0,0 +1,9 @@ +30 +1 +18.16666666667 +717.7857142857 +50.5 +50 +18.16666666667 +0 +0 diff --git a/codenet/public_test_cases/p00739/input.0.txt b/codenet/public_test_cases/p00739/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..49538f79d2085aecddf10600d01cc13dd99de74e --- /dev/null +++ b/codenet/public_test_cases/p00739/input.0.txt @@ -0,0 +1,55 @@ +2 2 +1 1 +1 1 +3 3 +0 1 0 +1 1 0 +1 1 1 +4 6 +1 1 1 0 +1 1 1 1 +1 1 1 0 +1 1 1 0 +0 1 1 0 +1 1 1 0 +7 5 +0 0 1 0 0 1 1 +0 1 1 1 1 1 0 +0 1 1 1 1 1 0 +1 1 1 1 1 1 0 +1 0 0 0 1 1 0 +9 7 +0 0 1 0 0 0 0 0 0 +0 0 1 1 0 0 0 0 0 +1 1 1 1 1 1 1 1 0 +1 1 1 1 1 1 1 1 0 +0 1 1 1 1 1 1 1 1 +0 0 0 1 1 0 0 0 0 +0 0 0 1 0 0 0 0 0 +9 7 +0 0 1 0 0 0 0 0 0 +0 0 1 0 0 0 0 0 0 +1 1 1 1 1 1 1 1 0 +1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 +0 0 0 1 0 0 0 0 0 +0 0 0 1 0 0 0 0 0 +7 6 +1 1 1 1 1 1 1 +1 1 1 1 1 1 1 +1 1 1 1 1 1 0 +1 1 1 1 1 1 0 +0 1 1 1 1 1 0 +0 1 1 1 1 1 0 +10 10 +0 1 1 1 1 1 1 1 1 1 +1 1 0 0 0 0 0 0 0 0 +1 1 0 0 0 0 0 0 0 0 +1 1 0 0 0 0 0 0 0 0 +1 1 0 0 0 0 0 0 0 0 +1 1 0 0 0 0 0 0 0 0 +1 1 0 0 0 0 0 0 0 0 +1 1 0 0 0 0 0 0 0 0 +1 1 1 0 0 0 0 0 1 0 +1 1 1 1 1 1 1 1 1 0 +0 0 diff --git a/codenet/public_test_cases/p00739/output.0.txt b/codenet/public_test_cases/p00739/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcb4e0067bc3aa50e4411294c583bd8087ab7f46 --- /dev/null +++ b/codenet/public_test_cases/p00739/output.0.txt @@ -0,0 +1,8 @@ +YES +NO +YES +YES +YES +NO +NO +YES diff --git a/codenet/public_test_cases/p00740/input.0.txt b/codenet/public_test_cases/p00740/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bb66ef9f43ca96e13c79bd00bca4339e52787a3 --- /dev/null +++ b/codenet/public_test_cases/p00740/input.0.txt @@ -0,0 +1,8 @@ +3 2 +3 3 +3 50 +10 29 +31 32 +50 2 +50 50 +0 0 diff --git a/codenet/public_test_cases/p00740/input.1.txt b/codenet/public_test_cases/p00740/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bb66ef9f43ca96e13c79bd00bca4339e52787a3 --- /dev/null +++ b/codenet/public_test_cases/p00740/input.1.txt @@ -0,0 +1,8 @@ +3 2 +3 3 +3 50 +10 29 +31 32 +50 2 +50 50 +0 0 diff --git a/codenet/public_test_cases/p00740/output.0.txt b/codenet/public_test_cases/p00740/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7eac42b7ba749107632d92fabee499eedbf5a18 --- /dev/null +++ b/codenet/public_test_cases/p00740/output.0.txt @@ -0,0 +1,7 @@ +1 +0 +1 +5 +30 +1 +13 diff --git a/codenet/public_test_cases/p00740/output.1.txt b/codenet/public_test_cases/p00740/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7eac42b7ba749107632d92fabee499eedbf5a18 --- /dev/null +++ b/codenet/public_test_cases/p00740/output.1.txt @@ -0,0 +1,7 @@ +1 +0 +1 +5 +30 +1 +13 diff --git a/codenet/public_test_cases/p00741/input.0.txt b/codenet/public_test_cases/p00741/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d81979bc2a5c32312983554c7bc5072caadd7522 --- /dev/null +++ b/codenet/public_test_cases/p00741/input.0.txt @@ -0,0 +1,25 @@ +1 1 +0 +2 2 +0 1 +1 0 +3 2 +1 1 1 +1 1 1 +5 4 +1 0 1 0 0 +1 0 0 0 0 +1 0 1 0 1 +1 0 0 1 0 +5 4 +1 1 1 0 1 +1 0 1 0 1 +1 0 1 0 1 +1 0 1 1 1 +5 5 +1 0 1 0 1 +0 0 0 0 0 +1 0 1 0 1 +0 0 0 0 0 +1 0 1 0 1 +0 0 diff --git a/codenet/public_test_cases/p00741/input.1.txt b/codenet/public_test_cases/p00741/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d81979bc2a5c32312983554c7bc5072caadd7522 --- /dev/null +++ b/codenet/public_test_cases/p00741/input.1.txt @@ -0,0 +1,25 @@ +1 1 +0 +2 2 +0 1 +1 0 +3 2 +1 1 1 +1 1 1 +5 4 +1 0 1 0 0 +1 0 0 0 0 +1 0 1 0 1 +1 0 0 1 0 +5 4 +1 1 1 0 1 +1 0 1 0 1 +1 0 1 0 1 +1 0 1 1 1 +5 5 +1 0 1 0 1 +0 0 0 0 0 +1 0 1 0 1 +0 0 0 0 0 +1 0 1 0 1 +0 0 diff --git a/codenet/public_test_cases/p00741/output.0.txt b/codenet/public_test_cases/p00741/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..383cdef103c3ad958b8a9ebdd2edc754be3c497f --- /dev/null +++ b/codenet/public_test_cases/p00741/output.0.txt @@ -0,0 +1,6 @@ +0 +1 +1 +3 +1 +9 diff --git a/codenet/public_test_cases/p00741/output.1.txt b/codenet/public_test_cases/p00741/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..383cdef103c3ad958b8a9ebdd2edc754be3c497f --- /dev/null +++ b/codenet/public_test_cases/p00741/output.1.txt @@ -0,0 +1,6 @@ +0 +1 +1 +3 +1 +9 diff --git a/codenet/public_test_cases/p00742/input.0.txt b/codenet/public_test_cases/p00742/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..003b910397f84894b1577aea3f5b2c99649eaa3f --- /dev/null +++ b/codenet/public_test_cases/p00742/input.0.txt @@ -0,0 +1,40 @@ +3 +ACM +IBM +ICPC +3 +GAME +BEST +GAMER +4 +A +B +C +AB +3 +A +B +CD +3 +ONE +TWO +THREE +3 +TWO +THREE +FIVE +3 +MOV +POP +DIV +9 +A +B +C +D +E +F +G +H +IJ +0 diff --git a/codenet/public_test_cases/p00742/input.1.txt b/codenet/public_test_cases/p00742/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..003b910397f84894b1577aea3f5b2c99649eaa3f --- /dev/null +++ b/codenet/public_test_cases/p00742/input.1.txt @@ -0,0 +1,40 @@ +3 +ACM +IBM +ICPC +3 +GAME +BEST +GAMER +4 +A +B +C +AB +3 +A +B +CD +3 +ONE +TWO +THREE +3 +TWO +THREE +FIVE +3 +MOV +POP +DIV +9 +A +B +C +D +E +F +G +H +IJ +0 diff --git a/codenet/public_test_cases/p00742/output.0.txt b/codenet/public_test_cases/p00742/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd6cc211e5c066ba5aec5432e82f562e8bf2e8ac --- /dev/null +++ b/codenet/public_test_cases/p00742/output.0.txt @@ -0,0 +1,8 @@ +4 +1 +8 +30 +0 +0 +0 +40320 diff --git a/codenet/public_test_cases/p00742/output.1.txt b/codenet/public_test_cases/p00742/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd6cc211e5c066ba5aec5432e82f562e8bf2e8ac --- /dev/null +++ b/codenet/public_test_cases/p00742/output.1.txt @@ -0,0 +1,8 @@ +4 +1 +8 +30 +0 +0 +0 +40320 diff --git a/codenet/public_test_cases/p00743/input.0.txt b/codenet/public_test_cases/p00743/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f0dc1c0414c3796976240f00c3edf66d77c5620 --- /dev/null +++ b/codenet/public_test_cases/p00743/input.0.txt @@ -0,0 +1,26 @@ +2 0 +1 2 +5 4 +1 5 +1 2 1 1 +2 3 2 2 +3 4 2 2 +4 5 1 1 +6 6 +1 6 +1 2 2 1 +2 3 2 1 +3 6 2 1 +1 4 2 30 +4 5 3 30 +5 6 2 30 +6 7 +1 6 +1 2 1 30 +2 3 1 30 +3 1 1 30 +3 4 100 30 +4 5 1 30 +5 6 1 30 +6 4 1 30 +0 0 diff --git a/codenet/public_test_cases/p00743/input.1.txt b/codenet/public_test_cases/p00743/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f0dc1c0414c3796976240f00c3edf66d77c5620 --- /dev/null +++ b/codenet/public_test_cases/p00743/input.1.txt @@ -0,0 +1,26 @@ +2 0 +1 2 +5 4 +1 5 +1 2 1 1 +2 3 2 2 +3 4 2 2 +4 5 1 1 +6 6 +1 6 +1 2 2 1 +2 3 2 1 +3 6 2 1 +1 4 2 30 +4 5 3 30 +5 6 2 30 +6 7 +1 6 +1 2 1 30 +2 3 1 30 +3 1 1 30 +3 4 100 30 +4 5 1 30 +5 6 1 30 +6 4 1 30 +0 0 diff --git a/codenet/public_test_cases/p00743/output.0.txt b/codenet/public_test_cases/p00743/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f49b1478ebe07e712ec9449f48de49dee1e0b443 --- /dev/null +++ b/codenet/public_test_cases/p00743/output.0.txt @@ -0,0 +1,4 @@ +unreachable +4.00000 +5.50000 +11.25664 diff --git a/codenet/public_test_cases/p00743/output.1.txt b/codenet/public_test_cases/p00743/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f49b1478ebe07e712ec9449f48de49dee1e0b443 --- /dev/null +++ b/codenet/public_test_cases/p00743/output.1.txt @@ -0,0 +1,4 @@ +unreachable +4.00000 +5.50000 +11.25664 diff --git a/codenet/public_test_cases/p00744/input.0.txt b/codenet/public_test_cases/p00744/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b38ea295f11730dfbca3d2918c1cab360130532 --- /dev/null +++ b/codenet/public_test_cases/p00744/input.0.txt @@ -0,0 +1,42 @@ +4 3 +2 6 6 15 +2 3 5 +2 3 +4 9 +8 16 32 +4 2 +4 9 11 13 +5 7 +5 5 +2 3 5 1001 1001 +7 11 13 30 30 +10 10 +2 3 5 7 9 11 13 15 17 29 +4 6 10 14 18 22 26 30 34 38 +20 20 +195 144 903 63 137 513 44 626 75 473 +876 421 568 519 755 840 374 368 570 872 +363 650 155 265 64 26 426 391 15 421 +373 984 564 54 823 477 565 866 879 638 +100 100 +195 144 903 63 137 513 44 626 75 473 +876 421 568 519 755 840 374 368 570 872 +363 650 155 265 64 26 426 391 15 421 +373 984 564 54 823 477 565 866 879 638 +117 755 835 683 52 369 302 424 513 870 +75 874 299 228 140 361 30 342 750 819 +761 123 804 325 952 405 578 517 49 457 +932 941 988 767 624 41 912 702 241 426 +351 92 300 648 318 216 785 347 556 535 +166 318 434 746 419 386 928 996 680 975 +231 390 916 220 933 319 37 846 797 54 +272 924 145 348 350 239 563 135 362 119 +446 305 213 879 51 631 43 755 405 499 +509 412 887 203 408 821 298 443 445 96 +274 715 796 417 839 147 654 402 280 17 +298 725 98 287 382 923 694 201 679 99 +699 188 288 364 389 694 185 464 138 406 +558 188 897 354 603 737 277 35 139 556 +826 213 59 922 499 217 846 193 416 525 +69 115 489 355 256 654 49 439 118 961 +0 0 diff --git a/codenet/public_test_cases/p00744/input.1.txt b/codenet/public_test_cases/p00744/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b38ea295f11730dfbca3d2918c1cab360130532 --- /dev/null +++ b/codenet/public_test_cases/p00744/input.1.txt @@ -0,0 +1,42 @@ +4 3 +2 6 6 15 +2 3 5 +2 3 +4 9 +8 16 32 +4 2 +4 9 11 13 +5 7 +5 5 +2 3 5 1001 1001 +7 11 13 30 30 +10 10 +2 3 5 7 9 11 13 15 17 29 +4 6 10 14 18 22 26 30 34 38 +20 20 +195 144 903 63 137 513 44 626 75 473 +876 421 568 519 755 840 374 368 570 872 +363 650 155 265 64 26 426 391 15 421 +373 984 564 54 823 477 565 866 879 638 +100 100 +195 144 903 63 137 513 44 626 75 473 +876 421 568 519 755 840 374 368 570 872 +363 650 155 265 64 26 426 391 15 421 +373 984 564 54 823 477 565 866 879 638 +117 755 835 683 52 369 302 424 513 870 +75 874 299 228 140 361 30 342 750 819 +761 123 804 325 952 405 578 517 49 457 +932 941 988 767 624 41 912 702 241 426 +351 92 300 648 318 216 785 347 556 535 +166 318 434 746 419 386 928 996 680 975 +231 390 916 220 933 319 37 846 797 54 +272 924 145 348 350 239 563 135 362 119 +446 305 213 879 51 631 43 755 405 499 +509 412 887 203 408 821 298 443 445 96 +274 715 796 417 839 147 654 402 280 17 +298 725 98 287 382 923 694 201 679 99 +699 188 288 364 389 694 185 464 138 406 +558 188 897 354 603 737 277 35 139 556 +826 213 59 922 499 217 846 193 416 525 +69 115 489 355 256 654 49 439 118 961 +0 0 diff --git a/codenet/public_test_cases/p00744/output.0.txt b/codenet/public_test_cases/p00744/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ed563591eca8af3958c0659c3138c24fe1841f7 --- /dev/null +++ b/codenet/public_test_cases/p00744/output.0.txt @@ -0,0 +1,7 @@ +3 +1 +0 +4 +9 +18 +85 diff --git a/codenet/public_test_cases/p00744/output.1.txt b/codenet/public_test_cases/p00744/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ed563591eca8af3958c0659c3138c24fe1841f7 --- /dev/null +++ b/codenet/public_test_cases/p00744/output.1.txt @@ -0,0 +1,7 @@ +3 +1 +0 +4 +9 +18 +85 diff --git a/codenet/public_test_cases/p00745/input.0.txt b/codenet/public_test_cases/p00745/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..960814f180a7134b284816dcd789c6784671606f --- /dev/null +++ b/codenet/public_test_cases/p00745/input.0.txt @@ -0,0 +1,102 @@ +6 16 +5 4 +11 988 +474 975 +459 16 +985 12 +984 982 +242 227 +140 266 +45 410 +92 570 +237 644 +370 567 +406 424 +336 290 +756 220 +634 251 +511 404 +575 554 +726 643 +868 571 +907 403 +845 283 +10 4 +261 196 +943 289 +859 925 +56 822 +112 383 +514 0 +1000 457 +514 1000 +0 485 +233 224 +710 242 +850 654 +485 915 +140 663 +26 5 +0 953 +180 0 +299 501 +37 301 +325 124 +162 507 +84 140 +913 409 +635 157 +645 555 +894 229 +598 223 +783 514 +765 137 +599 445 +695 126 +859 462 +599 312 +838 167 +708 563 +565 258 +945 283 +251 454 +125 111 +28 469 +1000 1000 +185 319 +717 296 +9 315 +372 249 +203 528 +15 15 +200 247 +859 597 +340 134 +967 247 +421 623 +1000 427 +751 1000 +102 737 +448 0 +978 510 +556 907 +0 582 +627 201 +697 963 +616 608 +345 819 +810 809 +437 706 +702 695 +448 474 +605 474 +329 355 +691 350 +816 231 +313 216 +864 360 +772 278 +756 747 +529 639 +513 525 +0 0 diff --git a/codenet/public_test_cases/p00745/input.1.txt b/codenet/public_test_cases/p00745/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..960814f180a7134b284816dcd789c6784671606f --- /dev/null +++ b/codenet/public_test_cases/p00745/input.1.txt @@ -0,0 +1,102 @@ +6 16 +5 4 +11 988 +474 975 +459 16 +985 12 +984 982 +242 227 +140 266 +45 410 +92 570 +237 644 +370 567 +406 424 +336 290 +756 220 +634 251 +511 404 +575 554 +726 643 +868 571 +907 403 +845 283 +10 4 +261 196 +943 289 +859 925 +56 822 +112 383 +514 0 +1000 457 +514 1000 +0 485 +233 224 +710 242 +850 654 +485 915 +140 663 +26 5 +0 953 +180 0 +299 501 +37 301 +325 124 +162 507 +84 140 +913 409 +635 157 +645 555 +894 229 +598 223 +783 514 +765 137 +599 445 +695 126 +859 462 +599 312 +838 167 +708 563 +565 258 +945 283 +251 454 +125 111 +28 469 +1000 1000 +185 319 +717 296 +9 315 +372 249 +203 528 +15 15 +200 247 +859 597 +340 134 +967 247 +421 623 +1000 427 +751 1000 +102 737 +448 0 +978 510 +556 907 +0 582 +627 201 +697 963 +616 608 +345 819 +810 809 +437 706 +702 695 +448 474 +605 474 +329 355 +691 350 +816 231 +313 216 +864 360 +772 278 +756 747 +529 639 +513 525 +0 0 diff --git a/codenet/public_test_cases/p00745/output.0.txt b/codenet/public_test_cases/p00745/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74097d360eb7a65f70523ff3d5313bec09087541 --- /dev/null +++ b/codenet/public_test_cases/p00745/output.0.txt @@ -0,0 +1,4 @@ +2257.0518296609 +3609.92159564177 +2195.83727086364 +3619.77160684813 diff --git a/codenet/public_test_cases/p00745/output.1.txt b/codenet/public_test_cases/p00745/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74097d360eb7a65f70523ff3d5313bec09087541 --- /dev/null +++ b/codenet/public_test_cases/p00745/output.1.txt @@ -0,0 +1,4 @@ +2257.0518296609 +3609.92159564177 +2195.83727086364 +3619.77160684813 diff --git a/codenet/public_test_cases/p00746/input.0.txt b/codenet/public_test_cases/p00746/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3ed8ec01f680cf1e1e8462e4d437494199b3cc7 --- /dev/null +++ b/codenet/public_test_cases/p00746/input.0.txt @@ -0,0 +1,29 @@ +1 +5 +0 0 +0 1 +0 2 +0 3 +12 +0 0 +1 0 +2 0 +3 1 +4 1 +5 1 +6 2 +7 2 +8 2 +9 3 +10 3 +10 +0 2 +1 2 +2 2 +3 2 +2 1 +5 1 +6 1 +7 1 +8 1 +0 diff --git a/codenet/public_test_cases/p00746/input.1.txt b/codenet/public_test_cases/p00746/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3ed8ec01f680cf1e1e8462e4d437494199b3cc7 --- /dev/null +++ b/codenet/public_test_cases/p00746/input.1.txt @@ -0,0 +1,29 @@ +1 +5 +0 0 +0 1 +0 2 +0 3 +12 +0 0 +1 0 +2 0 +3 1 +4 1 +5 1 +6 2 +7 2 +8 2 +9 3 +10 3 +10 +0 2 +1 2 +2 2 +3 2 +2 1 +5 1 +6 1 +7 1 +8 1 +0 diff --git a/codenet/public_test_cases/p00746/output.0.txt b/codenet/public_test_cases/p00746/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..298b0aa7c2f95af63f261430fc52823e9912bcf3 --- /dev/null +++ b/codenet/public_test_cases/p00746/output.0.txt @@ -0,0 +1,4 @@ +1 1 +3 3 +4 4 +5 6 diff --git a/codenet/public_test_cases/p00746/output.1.txt b/codenet/public_test_cases/p00746/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..298b0aa7c2f95af63f261430fc52823e9912bcf3 --- /dev/null +++ b/codenet/public_test_cases/p00746/output.1.txt @@ -0,0 +1,4 @@ +1 1 +3 3 +4 4 +5 6 diff --git a/codenet/public_test_cases/p00748/input.0.txt b/codenet/public_test_cases/p00748/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..86c9d3918d7e15045bd13187f01623438d28d7ac --- /dev/null +++ b/codenet/public_test_cases/p00748/input.0.txt @@ -0,0 +1,9 @@ +40 +14 +5 +165 +120 +103 +106 +139 +0 diff --git a/codenet/public_test_cases/p00748/input.1.txt b/codenet/public_test_cases/p00748/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86c9d3918d7e15045bd13187f01623438d28d7ac --- /dev/null +++ b/codenet/public_test_cases/p00748/input.1.txt @@ -0,0 +1,9 @@ +40 +14 +5 +165 +120 +103 +106 +139 +0 diff --git a/codenet/public_test_cases/p00748/output.0.txt b/codenet/public_test_cases/p00748/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e984acf544501dbfad856b28232c6ef29243edee --- /dev/null +++ b/codenet/public_test_cases/p00748/output.0.txt @@ -0,0 +1,8 @@ +2 6 +2 14 +2 5 +1 1 +1 18 +5 35 +4 4 +3 37 diff --git a/codenet/public_test_cases/p00748/output.1.txt b/codenet/public_test_cases/p00748/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e984acf544501dbfad856b28232c6ef29243edee --- /dev/null +++ b/codenet/public_test_cases/p00748/output.1.txt @@ -0,0 +1,8 @@ +2 6 +2 14 +2 5 +1 1 +1 18 +5 35 +4 4 +3 37 diff --git a/codenet/public_test_cases/p00749/input.0.txt b/codenet/public_test_cases/p00749/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b22921192e67a2019ed87f964d2ca651fa7452b --- /dev/null +++ b/codenet/public_test_cases/p00749/input.0.txt @@ -0,0 +1,58 @@ +4 5 +..33 +..33 +2222 +..1. +.111 +5 7 +....1 +.1..1 +.1..1 +11..1 +.2222 +..111 +...1. +3 6 +.3. +233 +23. +22. +.11 +.11 +4 3 +2222 +..11 +..11 +4 5 +.3.. +33.. +322. +2211 +.11. +3 3 +222 +2.1 +111 +3 4 +11. +11. +.2. +222 +3 4 +.11 +.11 +.2. +222 +2 7 +11 +.1 +21 +22 +23 +.3 +33 +2 3 +1. +11 +.1 +0 0 diff --git a/codenet/public_test_cases/p00749/input.1.txt b/codenet/public_test_cases/p00749/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b22921192e67a2019ed87f964d2ca651fa7452b --- /dev/null +++ b/codenet/public_test_cases/p00749/input.1.txt @@ -0,0 +1,58 @@ +4 5 +..33 +..33 +2222 +..1. +.111 +5 7 +....1 +.1..1 +.1..1 +11..1 +.2222 +..111 +...1. +3 6 +.3. +233 +23. +22. +.11 +.11 +4 3 +2222 +..11 +..11 +4 5 +.3.. +33.. +322. +2211 +.11. +3 3 +222 +2.1 +111 +3 4 +11. +11. +.2. +222 +3 4 +.11 +.11 +.2. +222 +2 7 +11 +.1 +21 +22 +23 +.3 +33 +2 3 +1. +11 +.1 +0 0 diff --git a/codenet/public_test_cases/p00749/output.0.txt b/codenet/public_test_cases/p00749/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b35881563b704a18554d136f5939d858ba510105 --- /dev/null +++ b/codenet/public_test_cases/p00749/output.0.txt @@ -0,0 +1,10 @@ +STABLE +STABLE +STABLE +UNSTABLE +STABLE +STABLE +UNSTABLE +UNSTABLE +UNSTABLE +UNSTABLE diff --git a/codenet/public_test_cases/p00749/output.1.txt b/codenet/public_test_cases/p00749/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b35881563b704a18554d136f5939d858ba510105 --- /dev/null +++ b/codenet/public_test_cases/p00749/output.1.txt @@ -0,0 +1,10 @@ +STABLE +STABLE +STABLE +UNSTABLE +STABLE +STABLE +UNSTABLE +UNSTABLE +UNSTABLE +UNSTABLE diff --git a/codenet/public_test_cases/p00750/input.0.txt b/codenet/public_test_cases/p00750/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecc1e0b93a74f878740e3e0af6fd0e8c950047d4 --- /dev/null +++ b/codenet/public_test_cases/p00750/input.0.txt @@ -0,0 +1,21 @@ +4 7 0 2 +0 1 abra +0 1 oil +2 0 ket +1 3 cada +3 3 da +3 2 bra +2 3 ket +2 2 0 1 +0 0 a +0 1 b +5 6 3 0 +3 1 op +3 2 op +3 4 opq +1 0 st +2 0 qr +4 0 r +2 1 0 1 +1 1 loooop +0 0 0 0 diff --git a/codenet/public_test_cases/p00750/input.1.txt b/codenet/public_test_cases/p00750/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecc1e0b93a74f878740e3e0af6fd0e8c950047d4 --- /dev/null +++ b/codenet/public_test_cases/p00750/input.1.txt @@ -0,0 +1,21 @@ +4 7 0 2 +0 1 abra +0 1 oil +2 0 ket +1 3 cada +3 3 da +3 2 bra +2 3 ket +2 2 0 1 +0 0 a +0 1 b +5 6 3 0 +3 1 op +3 2 op +3 4 opq +1 0 st +2 0 qr +4 0 r +2 1 0 1 +1 1 loooop +0 0 0 0 diff --git a/codenet/public_test_cases/p00750/output.0.txt b/codenet/public_test_cases/p00750/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b30300d0fdaca601054728a2f58d4b1519c3ba --- /dev/null +++ b/codenet/public_test_cases/p00750/output.0.txt @@ -0,0 +1,4 @@ +abracadabra +NO +opqr +NO diff --git a/codenet/public_test_cases/p00750/output.1.txt b/codenet/public_test_cases/p00750/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b30300d0fdaca601054728a2f58d4b1519c3ba --- /dev/null +++ b/codenet/public_test_cases/p00750/output.1.txt @@ -0,0 +1,4 @@ +abracadabra +NO +opqr +NO diff --git a/codenet/public_test_cases/p00751/input.0.txt b/codenet/public_test_cases/p00751/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0873c23d62f16de323a806cc771d6bd9f01521f4 --- /dev/null +++ b/codenet/public_test_cases/p00751/input.0.txt @@ -0,0 +1,21 @@ +1 4 +AABBCCDDEEFFGGHHIJJKKLLMMNNOOPP +AABBCCDDEEFFGG +CCDDEEFFGGHHII +FFGGHHIIJJKKLL +JJKKLLMMNNOOPP +2 3 +ABRACADABRA.ABBRACADABRA. +ABRACADABRA.A +.ABRACADABRA. +BRA.ABRACADAB +2 2 +AAAAAAAAAAAAAAAA +AAAAAAAAAAAAA +AAAAAAAAAAAAA +2 3 +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXAXXXXXX +XXXXXXBXXXXXX +XXXXXXXXXXXXX +0 0 diff --git a/codenet/public_test_cases/p00751/input.1.txt b/codenet/public_test_cases/p00751/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0873c23d62f16de323a806cc771d6bd9f01521f4 --- /dev/null +++ b/codenet/public_test_cases/p00751/input.1.txt @@ -0,0 +1,21 @@ +1 4 +AABBCCDDEEFFGGHHIJJKKLLMMNNOOPP +AABBCCDDEEFFGG +CCDDEEFFGGHHII +FFGGHHIIJJKKLL +JJKKLLMMNNOOPP +2 3 +ABRACADABRA.ABBRACADABRA. +ABRACADABRA.A +.ABRACADABRA. +BRA.ABRACADAB +2 2 +AAAAAAAAAAAAAAAA +AAAAAAAAAAAAA +AAAAAAAAAAAAA +2 3 +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXAXXXXXX +XXXXXXBXXXXXX +XXXXXXXXXXXXX +0 0 diff --git a/codenet/public_test_cases/p00751/output.0.txt b/codenet/public_test_cases/p00751/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19d54a7250b9e1300788ccf10a00004e0e02f1ba --- /dev/null +++ b/codenet/public_test_cases/p00751/output.0.txt @@ -0,0 +1,15 @@ +1 +AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP +5 +.ABRACADABRA.ABRACADABRA. +ABRACADABRA.A.ABRACADABRA. +ABRACADABRA.AABRACADABRA.A +ABRACADABRA.ABRACADABRA. +ABRACADABRA.ABRACADABRA.A +5 +AAAAAAAAAAAAAA +AAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAA +257 diff --git a/codenet/public_test_cases/p00751/output.1.txt b/codenet/public_test_cases/p00751/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19d54a7250b9e1300788ccf10a00004e0e02f1ba --- /dev/null +++ b/codenet/public_test_cases/p00751/output.1.txt @@ -0,0 +1,15 @@ +1 +AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP +5 +.ABRACADABRA.ABRACADABRA. +ABRACADABRA.A.ABRACADABRA. +ABRACADABRA.AABRACADABRA.A +ABRACADABRA.ABRACADABRA. +ABRACADABRA.ABRACADABRA.A +5 +AAAAAAAAAAAAAA +AAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAA +257 diff --git a/codenet/public_test_cases/p00752/input.0.txt b/codenet/public_test_cases/p00752/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b293cbdc31ec72a0b620487c29ffd26d73f8bcef --- /dev/null +++ b/codenet/public_test_cases/p00752/input.0.txt @@ -0,0 +1,30 @@ +2 +30 10 30 75 +60 30 60 95 +90 0 +0 100 +1 +20 81 90 90 +10 90 +90 10 +2 +10 0 10 58 +20 20 20 58 +0 70 +30 0 +4 +8 0 8 60 +16 16 16 48 +16 10 28 30 +16 52 28 34 +24 0 +24 64 +5 +8 0 8 60 +16 16 16 48 +16 10 28 30 +16 52 28 34 +100 0 100 50 +24 0 +24 64 +0 diff --git a/codenet/public_test_cases/p00752/input.1.txt b/codenet/public_test_cases/p00752/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b293cbdc31ec72a0b620487c29ffd26d73f8bcef --- /dev/null +++ b/codenet/public_test_cases/p00752/input.1.txt @@ -0,0 +1,30 @@ +2 +30 10 30 75 +60 30 60 95 +90 0 +0 100 +1 +20 81 90 90 +10 90 +90 10 +2 +10 0 10 58 +20 20 20 58 +0 70 +30 0 +4 +8 0 8 60 +16 16 16 48 +16 10 28 30 +16 52 28 34 +24 0 +24 64 +5 +8 0 8 60 +16 16 16 48 +16 10 28 30 +16 52 28 34 +100 0 100 50 +24 0 +24 64 +0 diff --git a/codenet/public_test_cases/p00752/output.0.txt b/codenet/public_test_cases/p00752/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bd07dbd09955b51f2b5ea59f98a8d7f7be19aca --- /dev/null +++ b/codenet/public_test_cases/p00752/output.0.txt @@ -0,0 +1,5 @@ +180.27756377319946 +113.13708498984761 +98.99494936611666 +90.50966799187809 +90.50966799187809 diff --git a/codenet/public_test_cases/p00752/output.1.txt b/codenet/public_test_cases/p00752/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bd07dbd09955b51f2b5ea59f98a8d7f7be19aca --- /dev/null +++ b/codenet/public_test_cases/p00752/output.1.txt @@ -0,0 +1,5 @@ +180.27756377319946 +113.13708498984761 +98.99494936611666 +90.50966799187809 +90.50966799187809 diff --git a/codenet/public_test_cases/p00754/input.1.txt b/codenet/public_test_cases/p00754/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p00754/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p00754/output.1.txt b/codenet/public_test_cases/p00754/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p00754/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p00760/input.0.txt b/codenet/public_test_cases/p00760/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d314557127165ea0cca8dc6f28d6eb3042a0df69 --- /dev/null +++ b/codenet/public_test_cases/p00760/input.0.txt @@ -0,0 +1,9 @@ +8 +1 1 1 +344 3 1 +696 5 1 +182 9 5 +998 8 7 +344 2 19 +696 4 19 +999 10 20 diff --git a/codenet/public_test_cases/p00760/input.1.txt b/codenet/public_test_cases/p00760/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d314557127165ea0cca8dc6f28d6eb3042a0df69 --- /dev/null +++ b/codenet/public_test_cases/p00760/input.1.txt @@ -0,0 +1,9 @@ +8 +1 1 1 +344 3 1 +696 5 1 +182 9 5 +998 8 7 +344 2 19 +696 4 19 +999 10 20 diff --git a/codenet/public_test_cases/p00760/output.0.txt b/codenet/public_test_cases/p00760/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18aa55f240f6f237719cef7522b5830c453bf9c1 --- /dev/null +++ b/codenet/public_test_cases/p00760/output.0.txt @@ -0,0 +1,8 @@ +196470 +128976 +59710 +160715 +252 +128977 +59712 +1 diff --git a/codenet/public_test_cases/p00760/output.1.txt b/codenet/public_test_cases/p00760/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18aa55f240f6f237719cef7522b5830c453bf9c1 --- /dev/null +++ b/codenet/public_test_cases/p00760/output.1.txt @@ -0,0 +1,8 @@ +196470 +128976 +59710 +160715 +252 +128977 +59712 +1 diff --git a/codenet/public_test_cases/p00761/input.0.txt b/codenet/public_test_cases/p00761/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e4702b911d0b5543feeaf9b359acfc357230a9e --- /dev/null +++ b/codenet/public_test_cases/p00761/input.0.txt @@ -0,0 +1,6 @@ +2012 4 +83268 6 +1112 4 +0 1 +99 2 +0 0 diff --git a/codenet/public_test_cases/p00761/input.1.txt b/codenet/public_test_cases/p00761/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e4702b911d0b5543feeaf9b359acfc357230a9e --- /dev/null +++ b/codenet/public_test_cases/p00761/input.1.txt @@ -0,0 +1,6 @@ +2012 4 +83268 6 +1112 4 +0 1 +99 2 +0 0 diff --git a/codenet/public_test_cases/p00761/output.0.txt b/codenet/public_test_cases/p00761/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83fd7e90713ef3a52e60c2b7bc4d5b8a4520dade --- /dev/null +++ b/codenet/public_test_cases/p00761/output.0.txt @@ -0,0 +1,5 @@ +3 6174 1 +1 862632 7 +5 6174 1 +0 0 1 +1 0 1 diff --git a/codenet/public_test_cases/p00761/output.1.txt b/codenet/public_test_cases/p00761/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83fd7e90713ef3a52e60c2b7bc4d5b8a4520dade --- /dev/null +++ b/codenet/public_test_cases/p00761/output.1.txt @@ -0,0 +1,5 @@ +3 6174 1 +1 862632 7 +5 6174 1 +0 0 1 +1 0 1 diff --git a/codenet/public_test_cases/p00762/input.0.txt b/codenet/public_test_cases/p00762/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4aa3b769081dfb2b0ca7965a7e9d8efa2da325c --- /dev/null +++ b/codenet/public_test_cases/p00762/input.0.txt @@ -0,0 +1,25 @@ +4 +6 4 +6 4 +6 4 +6 4 +2 +5 3 +5 3 +8 +4 2 +4 2 +4 2 +4 2 +4 2 +4 2 +4 2 +4 2 +6 +4 6 +1 5 +2 3 +5 3 +2 4 +4 2 +0 diff --git a/codenet/public_test_cases/p00762/input.1.txt b/codenet/public_test_cases/p00762/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4aa3b769081dfb2b0ca7965a7e9d8efa2da325c --- /dev/null +++ b/codenet/public_test_cases/p00762/input.1.txt @@ -0,0 +1,25 @@ +4 +6 4 +6 4 +6 4 +6 4 +2 +5 3 +5 3 +8 +4 2 +4 2 +4 2 +4 2 +4 2 +4 2 +4 2 +4 2 +6 +4 6 +1 5 +2 3 +5 3 +2 4 +4 2 +0 diff --git a/codenet/public_test_cases/p00762/output.0.txt b/codenet/public_test_cases/p00762/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e10b950da925596291ab7b1dbbc32bcad86f50fd --- /dev/null +++ b/codenet/public_test_cases/p00762/output.0.txt @@ -0,0 +1,4 @@ +0 1 1 0 0 1 +1 0 0 0 1 0 +1 2 2 1 0 0 +2 3 0 0 0 0 diff --git a/codenet/public_test_cases/p00762/output.1.txt b/codenet/public_test_cases/p00762/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e10b950da925596291ab7b1dbbc32bcad86f50fd --- /dev/null +++ b/codenet/public_test_cases/p00762/output.1.txt @@ -0,0 +1,4 @@ +0 1 1 0 0 1 +1 0 0 0 1 0 +1 2 2 1 0 0 +2 3 0 0 0 0 diff --git a/codenet/public_test_cases/p00763/input.0.txt b/codenet/public_test_cases/p00763/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e55663c8bf62c533122479253f539156bf3728eb --- /dev/null +++ b/codenet/public_test_cases/p00763/input.0.txt @@ -0,0 +1,37 @@ +4 4 2 1 4 +1 2 2 1 +2 3 2 1 +3 4 5 1 +2 4 4 2 +3 1 +3 6 +10 5 3 + +10 +2 0 1 1 2 +1 + +1 +4 5 2 4 1 +4 3 10 1 +3 2 2 1 +3 2 1 2 +3 2 5 2 +2 1 10 1 +3 3 +20 30 +3 2 1 +5 10 +3 2 1 +5 5 2 1 5 +1 2 10 2 +1 3 20 2 +2 4 20 1 +3 4 10 1 +4 5 20 1 +2 2 +20 +4 1 +20 +3 1 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00763/input.1.txt b/codenet/public_test_cases/p00763/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e55663c8bf62c533122479253f539156bf3728eb --- /dev/null +++ b/codenet/public_test_cases/p00763/input.1.txt @@ -0,0 +1,37 @@ +4 4 2 1 4 +1 2 2 1 +2 3 2 1 +3 4 5 1 +2 4 4 2 +3 1 +3 6 +10 5 3 + +10 +2 0 1 1 2 +1 + +1 +4 5 2 4 1 +4 3 10 1 +3 2 2 1 +3 2 1 2 +3 2 5 2 +2 1 10 1 +3 3 +20 30 +3 2 1 +5 10 +3 2 1 +5 5 2 1 5 +1 2 10 2 +1 3 20 2 +2 4 20 1 +3 4 10 1 +4 5 20 1 +2 2 +20 +4 1 +20 +3 1 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00763/output.0.txt b/codenet/public_test_cases/p00763/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a917d33f82c21ec25c569cfd175ea43c5e522e3 --- /dev/null +++ b/codenet/public_test_cases/p00763/output.0.txt @@ -0,0 +1,4 @@ +54 +-1 +63 +130 diff --git a/codenet/public_test_cases/p00763/output.1.txt b/codenet/public_test_cases/p00763/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a917d33f82c21ec25c569cfd175ea43c5e522e3 --- /dev/null +++ b/codenet/public_test_cases/p00763/output.1.txt @@ -0,0 +1,4 @@ +54 +-1 +63 +130 diff --git a/codenet/public_test_cases/p00764/input.0.txt b/codenet/public_test_cases/p00764/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87e7340db26bccb65bf0661a4b047c9e610923ae --- /dev/null +++ b/codenet/public_test_cases/p00764/input.0.txt @@ -0,0 +1,42 @@ +10 +802 0 10 +814 0 4 +820 1 4 +826 1 4 +832 3 5 +838 5 5 +845 7 3 +849 10 3 +853 14 4 +857 18 3 +3 +0 0 5 +8 0 5 +8 8 5 +3 +0 0 5 +7 3 6 +16 0 5 +9 +0 3 5 +8 0 8 +19 2 8 +23 14 6 +23 21 6 +23 28 6 +19 40 8 +8 42 8 +0 39 5 +11 +0 0 5 +8 0 5 +18 8 10 +8 16 5 +0 16 5 +0 24 5 +3 32 5 +10 32 5 +17 28 8 +27 25 3 +30 18 5 +0 diff --git a/codenet/public_test_cases/p00764/input.1.txt b/codenet/public_test_cases/p00764/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87e7340db26bccb65bf0661a4b047c9e610923ae --- /dev/null +++ b/codenet/public_test_cases/p00764/input.1.txt @@ -0,0 +1,42 @@ +10 +802 0 10 +814 0 4 +820 1 4 +826 1 4 +832 3 5 +838 5 5 +845 7 3 +849 10 3 +853 14 4 +857 18 3 +3 +0 0 5 +8 0 5 +8 8 5 +3 +0 0 5 +7 3 6 +16 0 5 +9 +0 3 5 +8 0 8 +19 2 8 +23 14 6 +23 21 6 +23 28 6 +19 40 8 +8 42 8 +0 39 5 +11 +0 0 5 +8 0 5 +18 8 10 +8 16 5 +0 16 5 +0 24 5 +3 32 5 +10 32 5 +17 28 8 +27 25 3 +30 18 5 +0 diff --git a/codenet/public_test_cases/p00764/output.0.txt b/codenet/public_test_cases/p00764/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ebc878d66bf6bd99a6bb50ce2693c9e15c64ca8 --- /dev/null +++ b/codenet/public_test_cases/p00764/output.0.txt @@ -0,0 +1,5 @@ +58.953437 +11.414214 +16.0 +61.874812 +63.195179 diff --git a/codenet/public_test_cases/p00764/output.1.txt b/codenet/public_test_cases/p00764/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ebc878d66bf6bd99a6bb50ce2693c9e15c64ca8 --- /dev/null +++ b/codenet/public_test_cases/p00764/output.1.txt @@ -0,0 +1,5 @@ +58.953437 +11.414214 +16.0 +61.874812 +63.195179 diff --git a/codenet/public_test_cases/p00765/input.0.txt b/codenet/public_test_cases/p00765/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2263f4fce404b2e973703740256845599399670e --- /dev/null +++ b/codenet/public_test_cases/p00765/input.0.txt @@ -0,0 +1,39 @@ +1 1 1 +a +3 3 4 +a+ * a * +2 2 3 +a a b +2 2 3 +* * * +2 2 3 +* b b +2 2 2 +a a +2 3 3 +a a+ a++ +2 6 6 +a a+ a++ b b+ b++ +4 13 5 +a a * * * +4 13 5 +a a b b * +4 13 5 +a a a * * +4 13 5 +a a+ a++ a+++ a++++ +4 13 5 +* * * * * +4 13 5 +a a a b b +4 13 5 +a a a a * +7 60 7 +a b a b c c * +7 60 7 +* * * * * * * +7 60 7 +a a+ a++ a+++ a++++ a+++++ a++++++ +1 14 4 +b a+ a a +0 0 0 diff --git a/codenet/public_test_cases/p00765/input.1.txt b/codenet/public_test_cases/p00765/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2263f4fce404b2e973703740256845599399670e --- /dev/null +++ b/codenet/public_test_cases/p00765/input.1.txt @@ -0,0 +1,39 @@ +1 1 1 +a +3 3 4 +a+ * a * +2 2 3 +a a b +2 2 3 +* * * +2 2 3 +* b b +2 2 2 +a a +2 3 3 +a a+ a++ +2 6 6 +a a+ a++ b b+ b++ +4 13 5 +a a * * * +4 13 5 +a a b b * +4 13 5 +a a a * * +4 13 5 +a a+ a++ a+++ a++++ +4 13 5 +* * * * * +4 13 5 +a a a b b +4 13 5 +a a a a * +7 60 7 +a b a b c c * +7 60 7 +* * * * * * * +7 60 7 +a a+ a++ a+++ a++++ a+++++ a++++++ +1 14 4 +b a+ a a +0 0 0 diff --git a/codenet/public_test_cases/p00765/output.0.txt b/codenet/public_test_cases/p00765/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29c328aa01feb5c3821322156699301c0028aa5c --- /dev/null +++ b/codenet/public_test_cases/p00765/output.0.txt @@ -0,0 +1,19 @@ +1.0000000000 +0.8809523810 +1.0000000000 +1.0000000000 +1.0000000000 +0.3333333333 +0.4000000000 +0.1212121212 +0.4929171669 +0.0492196879 +0.0228091236 +0.0035460338 +1.0000000000 +0.0014405762 +0.0002400960 +0.0002967709 +1.0000000000 +0.0000001022 +0.0000000000 diff --git a/codenet/public_test_cases/p00765/output.1.txt b/codenet/public_test_cases/p00765/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29c328aa01feb5c3821322156699301c0028aa5c --- /dev/null +++ b/codenet/public_test_cases/p00765/output.1.txt @@ -0,0 +1,19 @@ +1.0000000000 +0.8809523810 +1.0000000000 +1.0000000000 +1.0000000000 +0.3333333333 +0.4000000000 +0.1212121212 +0.4929171669 +0.0492196879 +0.0228091236 +0.0035460338 +1.0000000000 +0.0014405762 +0.0002400960 +0.0002967709 +1.0000000000 +0.0000001022 +0.0000000000 diff --git a/codenet/public_test_cases/p00766/input.0.txt b/codenet/public_test_cases/p00766/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9512651adb6c5d771f3989e0e9e8ab32dd40bca --- /dev/null +++ b/codenet/public_test_cases/p00766/input.0.txt @@ -0,0 +1,33 @@ +3 5 +###.# +##### +###.. +4 5 +.#.## +.#### +####. +##.#. +8 8 +.#.#.#.# +######## +.######. +######## +.######. +######## +.######. +######## +8 8 +.#.#.#.# +######## +.##.#.#. +##....## +.##.###. +##...### +.##.###. +###.#.## +4 4 +#### +#### +#### +#### +0 0 diff --git a/codenet/public_test_cases/p00766/input.1.txt b/codenet/public_test_cases/p00766/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9512651adb6c5d771f3989e0e9e8ab32dd40bca --- /dev/null +++ b/codenet/public_test_cases/p00766/input.1.txt @@ -0,0 +1,33 @@ +3 5 +###.# +##### +###.. +4 5 +.#.## +.#### +####. +##.#. +8 8 +.#.#.#.# +######## +.######. +######## +.######. +######## +.######. +######## +8 8 +.#.#.#.# +######## +.##.#.#. +##....## +.##.###. +##...### +.##.###. +###.#.## +4 4 +#### +#### +#### +#### +0 0 diff --git a/codenet/public_test_cases/p00766/output.0.txt b/codenet/public_test_cases/p00766/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..189a109af8fc51734eab55d83dc9e9b6b361f6a9 --- /dev/null +++ b/codenet/public_test_cases/p00766/output.0.txt @@ -0,0 +1,5 @@ +3 +5 +11 +19 +1 diff --git a/codenet/public_test_cases/p00766/output.1.txt b/codenet/public_test_cases/p00766/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..189a109af8fc51734eab55d83dc9e9b6b361f6a9 --- /dev/null +++ b/codenet/public_test_cases/p00766/output.1.txt @@ -0,0 +1,5 @@ +3 +5 +11 +19 +1 diff --git a/codenet/public_test_cases/p00767/input.0.txt b/codenet/public_test_cases/p00767/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..053f78b733089355068092a54cacd3c17820f24a --- /dev/null +++ b/codenet/public_test_cases/p00767/input.0.txt @@ -0,0 +1,11 @@ +1 2 +1 3 +2 3 +1 4 +2 4 +5 6 +1 8 +4 7 +98 100 +99 100 +0 0 diff --git a/codenet/public_test_cases/p00767/output.0.txt b/codenet/public_test_cases/p00767/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2a8e9b2053847c7bf6c8c9c5e78960e8c44123a --- /dev/null +++ b/codenet/public_test_cases/p00767/output.0.txt @@ -0,0 +1,10 @@ +1 3 +2 3 +1 4 +2 4 +3 4 +1 8 +4 7 +2 8 +3 140 +89 109 diff --git a/codenet/public_test_cases/p00768/input.0.txt b/codenet/public_test_cases/p00768/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2930d1c084e43cd72bb87cc83bab2a444181c8ad --- /dev/null +++ b/codenet/public_test_cases/p00768/input.0.txt @@ -0,0 +1,34 @@ +300 10 8 5 +50 5 2 1 +70 5 2 0 +75 1 1 0 +100 3 1 0 +150 3 2 0 +240 5 5 7 +50 1 1 0 +60 2 2 0 +70 2 3 0 +90 1 3 0 +120 3 5 0 +140 4 1 0 +150 2 4 1 +180 3 5 4 +15 2 2 1 +20 2 2 1 +25 2 2 0 +60 1 1 0 +120 5 5 4 +15 5 4 1 +20 5 4 0 +40 1 1 0 +40 2 2 0 +120 2 3 4 +30 1 1 0 +40 2 1 0 +50 2 2 0 +60 1 2 0 +120 3 3 2 +0 1 1 0 +1 2 2 0 +300 5 8 0 +0 0 0 0 diff --git a/codenet/public_test_cases/p00768/input.1.txt b/codenet/public_test_cases/p00768/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2930d1c084e43cd72bb87cc83bab2a444181c8ad --- /dev/null +++ b/codenet/public_test_cases/p00768/input.1.txt @@ -0,0 +1,34 @@ +300 10 8 5 +50 5 2 1 +70 5 2 0 +75 1 1 0 +100 3 1 0 +150 3 2 0 +240 5 5 7 +50 1 1 0 +60 2 2 0 +70 2 3 0 +90 1 3 0 +120 3 5 0 +140 4 1 0 +150 2 4 1 +180 3 5 4 +15 2 2 1 +20 2 2 1 +25 2 2 0 +60 1 1 0 +120 5 5 4 +15 5 4 1 +20 5 4 0 +40 1 1 0 +40 2 2 0 +120 2 3 4 +30 1 1 0 +40 2 1 0 +50 2 2 0 +60 1 2 0 +120 3 3 2 +0 1 1 0 +1 2 2 0 +300 5 8 0 +0 0 0 0 diff --git a/codenet/public_test_cases/p00768/output.0.txt b/codenet/public_test_cases/p00768/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9277caf0216d515da955ae22954ddaabde9cdc8b --- /dev/null +++ b/codenet/public_test_cases/p00768/output.0.txt @@ -0,0 +1,7 @@ +3,1,5,10=9=8=7=6=4=2 +2,1,3,4,5 +1,2,3 +5=2=1,4=3 +2=1 +1,2,3 +5=4=3=2=1 diff --git a/codenet/public_test_cases/p00768/output.1.txt b/codenet/public_test_cases/p00768/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9277caf0216d515da955ae22954ddaabde9cdc8b --- /dev/null +++ b/codenet/public_test_cases/p00768/output.1.txt @@ -0,0 +1,7 @@ +3,1,5,10=9=8=7=6=4=2 +2,1,3,4,5 +1,2,3 +5=2=1,4=3 +2=1 +1,2,3 +5=4=3=2=1 diff --git a/codenet/public_test_cases/p00769/input.0.txt b/codenet/public_test_cases/p00769/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..73600a8eff6578d845da22de534838a7b7afdfbc --- /dev/null +++ b/codenet/public_test_cases/p00769/input.0.txt @@ -0,0 +1,7 @@ +6 +[[123][4567][89]] +[[5][3][7][3][9]] +[[[99][59][63][85][51]][[1539][7995][467]][[51][57][79][99][3][91][59]]] +[[[37][95][31][77][15]][[43][5][5][5][85]][[71][3][51][89][29]][[57][95][5][69][31]][[99][59][65][73][31]]] +[[[[9][7][3]][[3][5][7]][[7][9][5]]][[[9][9][3]][[5][9][9]][[7][7][3]]][[[5][9][7]][[3][9][3]][[9][5][5]]]] +[[8231][3721][203][3271][8843]] diff --git a/codenet/public_test_cases/p00769/input.1.txt b/codenet/public_test_cases/p00769/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..73600a8eff6578d845da22de534838a7b7afdfbc --- /dev/null +++ b/codenet/public_test_cases/p00769/input.1.txt @@ -0,0 +1,7 @@ +6 +[[123][4567][89]] +[[5][3][7][3][9]] +[[[99][59][63][85][51]][[1539][7995][467]][[51][57][79][99][3][91][59]]] +[[[37][95][31][77][15]][[43][5][5][5][85]][[71][3][51][89][29]][[57][95][5][69][31]][[99][59][65][73][31]]] +[[[[9][7][3]][[3][5][7]][[7][9][5]]][[[9][9][3]][[5][9][9]][[7][7][3]]][[[5][9][7]][[3][9][3]][[9][5][5]]]] +[[8231][3721][203][3271][8843]] diff --git a/codenet/public_test_cases/p00769/output.0.txt b/codenet/public_test_cases/p00769/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bd03b05018cb4695fba05388e47df0ad2c56563 --- /dev/null +++ b/codenet/public_test_cases/p00769/output.0.txt @@ -0,0 +1,6 @@ +107 +7 +175 +95 +21 +3599 diff --git a/codenet/public_test_cases/p00769/output.1.txt b/codenet/public_test_cases/p00769/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bd03b05018cb4695fba05388e47df0ad2c56563 --- /dev/null +++ b/codenet/public_test_cases/p00769/output.1.txt @@ -0,0 +1,6 @@ +107 +7 +175 +95 +21 +3599 diff --git a/codenet/public_test_cases/p00770/input.0.txt b/codenet/public_test_cases/p00770/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2377de52b99852c24520400b10732b3ba301264 --- /dev/null +++ b/codenet/public_test_cases/p00770/input.0.txt @@ -0,0 +1,10 @@ +49 22 +46 37 +42 23 +945 561 +1081 681 +1056 452 +1042 862 +973 677 +1000000 1000000 +0 0 diff --git a/codenet/public_test_cases/p00770/input.1.txt b/codenet/public_test_cases/p00770/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2377de52b99852c24520400b10732b3ba301264 --- /dev/null +++ b/codenet/public_test_cases/p00770/input.1.txt @@ -0,0 +1,10 @@ +49 22 +46 37 +42 23 +945 561 +1081 681 +1056 452 +1042 862 +973 677 +1000000 1000000 +0 0 diff --git a/codenet/public_test_cases/p00770/output.0.txt b/codenet/public_test_cases/p00770/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb35afc8f22c6c22479560ccefb2c27fdffff851 --- /dev/null +++ b/codenet/public_test_cases/p00770/output.0.txt @@ -0,0 +1,9 @@ +0 0 +6 43 +1 23 +20 829 +18 947 +10 947 +13 947 +23 947 +534 993541 diff --git a/codenet/public_test_cases/p00770/output.1.txt b/codenet/public_test_cases/p00770/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb35afc8f22c6c22479560ccefb2c27fdffff851 --- /dev/null +++ b/codenet/public_test_cases/p00770/output.1.txt @@ -0,0 +1,9 @@ +0 0 +6 43 +1 23 +20 829 +18 947 +10 947 +13 947 +23 947 +534 993541 diff --git a/codenet/public_test_cases/p00771/input.0.txt b/codenet/public_test_cases/p00771/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..991073b4b3f6da3ddf4556142816df965e333a7f --- /dev/null +++ b/codenet/public_test_cases/p00771/input.0.txt @@ -0,0 +1,55 @@ +3 +10 10 20 +10 -10 20 +-10 10 120 +1 +10 10 16 +2 +10 10 20 +10 -10 20 +2 +100 0 101 +-90 0 91 +2 +0 0 53 +30 40 102 +3 +10 10 20 +10 -10 20 +-10 -10 20 +3 +1 5 13 +5 -3 13 +-3 -3 13 +3 +98 97 168 +-82 -80 193 +-99 -96 211 +4 +90 -100 160 +-80 -80 150 +90 80 150 +80 80 245 +4 +85 -90 290 +-80 -80 220 +-85 90 145 +85 90 170 +5 +0 0 4 +3 0 5 +-3 0 5 +0 3 5 +0 -3 5 +10 +95 -93 260 +-86 96 211 +91 90 177 +-81 -80 124 +-91 91 144 +97 94 165 +-90 -86 194 +89 85 167 +-93 -80 222 +92 -84 218 +0 diff --git a/codenet/public_test_cases/p00771/input.1.txt b/codenet/public_test_cases/p00771/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..991073b4b3f6da3ddf4556142816df965e333a7f --- /dev/null +++ b/codenet/public_test_cases/p00771/input.1.txt @@ -0,0 +1,55 @@ +3 +10 10 20 +10 -10 20 +-10 10 120 +1 +10 10 16 +2 +10 10 20 +10 -10 20 +2 +100 0 101 +-90 0 91 +2 +0 0 53 +30 40 102 +3 +10 10 20 +10 -10 20 +-10 -10 20 +3 +1 5 13 +5 -3 13 +-3 -3 13 +3 +98 97 168 +-82 -80 193 +-99 -96 211 +4 +90 -100 160 +-80 -80 150 +90 80 150 +80 80 245 +4 +85 -90 290 +-80 -80 220 +-85 90 145 +85 90 170 +5 +0 0 4 +3 0 5 +-3 0 5 +0 3 5 +0 -3 5 +10 +95 -93 260 +-86 96 211 +91 90 177 +-81 -80 124 +-91 91 144 +97 94 165 +-90 -86 194 +89 85 167 +-93 -80 222 +92 -84 218 +0 diff --git a/codenet/public_test_cases/p00771/output.0.txt b/codenet/public_test_cases/p00771/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e054b03e9afea72977465ba2df1f046450cd158 --- /dev/null +++ b/codenet/public_test_cases/p00771/output.0.txt @@ -0,0 +1,12 @@ +17.3205081 +16.0000000 +17.3205081 +13.8011200 +53.0000000 +14.1421356 +12.0000000 +128.3928757 +94.1879092 +131.1240816 +4.0000000 +72.2251798 diff --git a/codenet/public_test_cases/p00771/output.1.txt b/codenet/public_test_cases/p00771/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e054b03e9afea72977465ba2df1f046450cd158 --- /dev/null +++ b/codenet/public_test_cases/p00771/output.1.txt @@ -0,0 +1,12 @@ +17.3205081 +16.0000000 +17.3205081 +13.8011200 +53.0000000 +14.1421356 +12.0000000 +128.3928757 +94.1879092 +131.1240816 +4.0000000 +72.2251798 diff --git a/codenet/public_test_cases/p00772/input.0.txt b/codenet/public_test_cases/p00772/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cb67808044c91bb0ad4c3757d97e79cfe3c760c --- /dev/null +++ b/codenet/public_test_cases/p00772/input.0.txt @@ -0,0 +1,25 @@ +3 3 3 +1 2 3 +4 5 6 +2 1 2 5 +2 6 4 3 +2 5 3 1 +3 3 2 +1 1 1 +2 2 1 +2 1 1 2 +2 2 2 1 +7 1 2 +1 1 2 1 4 1 2 +4 +3 1 4 1 4 +3 2 4 2 4 +16 14 5 +2 1 2 2 1 3 2 1 3 2 2 1 1 3 1 2 +2 1 3 1 1 2 3 1 2 2 2 2 1 3 +2 3 1 3 +3 2 2 2 1 +3 2 2 1 2 +3 1 2 2 2 +4 2 1 2 2 2 +0 0 0 diff --git a/codenet/public_test_cases/p00772/input.1.txt b/codenet/public_test_cases/p00772/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cb67808044c91bb0ad4c3757d97e79cfe3c760c --- /dev/null +++ b/codenet/public_test_cases/p00772/input.1.txt @@ -0,0 +1,25 @@ +3 3 3 +1 2 3 +4 5 6 +2 1 2 5 +2 6 4 3 +2 5 3 1 +3 3 2 +1 1 1 +2 2 1 +2 1 1 2 +2 2 2 1 +7 1 2 +1 1 2 1 4 1 2 +4 +3 1 4 1 4 +3 2 4 2 4 +16 14 5 +2 1 2 2 1 3 2 1 3 2 2 1 1 3 1 2 +2 1 3 1 1 2 3 1 2 2 2 2 1 3 +2 3 1 3 +3 2 2 2 1 +3 2 2 1 2 +3 1 2 2 2 +4 2 1 2 2 2 +0 0 0 diff --git a/codenet/public_test_cases/p00772/output.0.txt b/codenet/public_test_cases/p00772/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..570b2369c4bbb88bf26399086355b32b4b030ec9 --- /dev/null +++ b/codenet/public_test_cases/p00772/output.0.txt @@ -0,0 +1,4 @@ +2 +-1 +1 +9 diff --git a/codenet/public_test_cases/p00772/output.1.txt b/codenet/public_test_cases/p00772/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..570b2369c4bbb88bf26399086355b32b4b030ec9 --- /dev/null +++ b/codenet/public_test_cases/p00772/output.1.txt @@ -0,0 +1,4 @@ +2 +-1 +1 +9 diff --git a/codenet/public_test_cases/p00773/input.0.txt b/codenet/public_test_cases/p00773/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d7a23934a43ad0117f12e32a5f61cd5eb18cbe6 --- /dev/null +++ b/codenet/public_test_cases/p00773/input.0.txt @@ -0,0 +1,17 @@ +5 8 105 +8 5 105 +1 2 24 +99 98 24 +12 13 26 +1 22 23 +1 13 201 +13 16 112 +2 24 50 +1 82 61 +1 84 125 +1 99 999 +99 1 999 +98 99 999 +1 99 11 +99 1 12 +0 0 0 diff --git a/codenet/public_test_cases/p00773/input.1.txt b/codenet/public_test_cases/p00773/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d7a23934a43ad0117f12e32a5f61cd5eb18cbe6 --- /dev/null +++ b/codenet/public_test_cases/p00773/input.1.txt @@ -0,0 +1,17 @@ +5 8 105 +8 5 105 +1 2 24 +99 98 24 +12 13 26 +1 22 23 +1 13 201 +13 16 112 +2 24 50 +1 82 61 +1 84 125 +1 99 999 +99 1 999 +98 99 999 +1 99 11 +99 1 12 +0 0 0 diff --git a/codenet/public_test_cases/p00773/output.0.txt b/codenet/public_test_cases/p00773/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f45140c2c2dec5ca36d08e2640ebee886272632 --- /dev/null +++ b/codenet/public_test_cases/p00773/output.0.txt @@ -0,0 +1,16 @@ +109 +103 +24 +24 +26 +27 +225 +116 +62 +111 +230 +1972 +508 +1004 +20 +7 diff --git a/codenet/public_test_cases/p00773/output.1.txt b/codenet/public_test_cases/p00773/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f45140c2c2dec5ca36d08e2640ebee886272632 --- /dev/null +++ b/codenet/public_test_cases/p00773/output.1.txt @@ -0,0 +1,16 @@ +109 +103 +24 +24 +26 +27 +225 +116 +62 +111 +230 +1972 +508 +1004 +20 +7 diff --git a/codenet/public_test_cases/p00774/input.0.txt b/codenet/public_test_cases/p00774/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..67fa86fe3652c59756db2e07734955942be01089 --- /dev/null +++ b/codenet/public_test_cases/p00774/input.0.txt @@ -0,0 +1,30 @@ +1 +6 9 9 9 9 +5 +5 9 5 5 9 +5 5 6 9 9 +4 6 3 6 9 +3 3 2 9 9 +2 2 1 1 1 +10 +3 5 6 5 6 +2 2 2 8 3 +6 2 5 9 2 +7 7 7 6 1 +4 6 6 4 9 +8 9 1 1 8 +5 6 1 8 1 +6 8 2 1 2 +9 6 3 3 5 +5 3 8 8 8 +5 +1 2 3 4 5 +6 7 8 9 1 +2 3 4 5 6 +7 8 9 1 2 +3 4 5 6 7 +3 +2 2 8 7 4 +6 5 7 7 7 +8 8 9 9 9 +0 diff --git a/codenet/public_test_cases/p00774/input.1.txt b/codenet/public_test_cases/p00774/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67fa86fe3652c59756db2e07734955942be01089 --- /dev/null +++ b/codenet/public_test_cases/p00774/input.1.txt @@ -0,0 +1,30 @@ +1 +6 9 9 9 9 +5 +5 9 5 5 9 +5 5 6 9 9 +4 6 3 6 9 +3 3 2 9 9 +2 2 1 1 1 +10 +3 5 6 5 6 +2 2 2 8 3 +6 2 5 9 2 +7 7 7 6 1 +4 6 6 4 9 +8 9 1 1 8 +5 6 1 8 1 +6 8 2 1 2 +9 6 3 3 5 +5 3 8 8 8 +5 +1 2 3 4 5 +6 7 8 9 1 +2 3 4 5 6 +7 8 9 1 2 +3 4 5 6 7 +3 +2 2 8 7 4 +6 5 7 7 7 +8 8 9 9 9 +0 diff --git a/codenet/public_test_cases/p00774/output.0.txt b/codenet/public_test_cases/p00774/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37712dc1821c233777aa00e45b78d43fcdbcb01e --- /dev/null +++ b/codenet/public_test_cases/p00774/output.0.txt @@ -0,0 +1,5 @@ +36 +38 +99 +0 +72 diff --git a/codenet/public_test_cases/p00774/output.1.txt b/codenet/public_test_cases/p00774/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37712dc1821c233777aa00e45b78d43fcdbcb01e --- /dev/null +++ b/codenet/public_test_cases/p00774/output.1.txt @@ -0,0 +1,5 @@ +36 +38 +99 +0 +72 diff --git a/codenet/public_test_cases/p00775/input.0.txt b/codenet/public_test_cases/p00775/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cbd9f252f1505918ef096c9fc1e6a5d42ccc421 --- /dev/null +++ b/codenet/public_test_cases/p00775/input.0.txt @@ -0,0 +1,22 @@ +2 3 +-2 -1 3 +0 1 3 +2 3 3 +2 2 +-2 0 4 +0 2 3 +2 6 +-3 3 1 +-2 3 2 +-1 3 3 +0 3 4 +1 3 5 +2 3 6 +2 6 +-3 3 1 +-3 2 2 +-3 1 3 +-3 0 4 +-3 -1 5 +-3 -2 6 +0 0 diff --git a/codenet/public_test_cases/p00775/input.1.txt b/codenet/public_test_cases/p00775/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cbd9f252f1505918ef096c9fc1e6a5d42ccc421 --- /dev/null +++ b/codenet/public_test_cases/p00775/input.1.txt @@ -0,0 +1,22 @@ +2 3 +-2 -1 3 +0 1 3 +2 3 3 +2 2 +-2 0 4 +0 2 3 +2 6 +-3 3 1 +-2 3 2 +-1 3 3 +0 3 4 +1 3 5 +2 3 6 +2 6 +-3 3 1 +-3 2 2 +-3 1 3 +-3 0 4 +-3 -1 5 +-3 -2 6 +0 0 diff --git a/codenet/public_test_cases/p00775/output.0.txt b/codenet/public_test_cases/p00775/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21a99efba4a94ca46e63409ade70a7ce1d778d36 --- /dev/null +++ b/codenet/public_test_cases/p00775/output.0.txt @@ -0,0 +1,4 @@ +0.0000 +3.0000 +2.2679 +2.2679 diff --git a/codenet/public_test_cases/p00775/output.1.txt b/codenet/public_test_cases/p00775/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..21a99efba4a94ca46e63409ade70a7ce1d778d36 --- /dev/null +++ b/codenet/public_test_cases/p00775/output.1.txt @@ -0,0 +1,4 @@ +0.0000 +3.0000 +2.2679 +2.2679 diff --git a/codenet/public_test_cases/p00776/input.0.txt b/codenet/public_test_cases/p00776/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..703842f32c1d45cbb384acb5a1bd603048912f6b --- /dev/null +++ b/codenet/public_test_cases/p00776/input.0.txt @@ -0,0 +1,5 @@ +enw +abc +abcdefghijklmnopqrst +z +# diff --git a/codenet/public_test_cases/p00776/input.1.txt b/codenet/public_test_cases/p00776/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..703842f32c1d45cbb384acb5a1bd603048912f6b --- /dev/null +++ b/codenet/public_test_cases/p00776/input.1.txt @@ -0,0 +1,5 @@ +enw +abc +abcdefghijklmnopqrst +z +# diff --git a/codenet/public_test_cases/p00776/output.0.txt b/codenet/public_test_cases/p00776/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1ae4d1aa98183e665ae76845e96a6145e2fd13f --- /dev/null +++ b/codenet/public_test_cases/p00776/output.0.txt @@ -0,0 +1,20 @@ +1 +fox +5 +acc +acd +bbd +bcc +bcd +17711 +acceeggiikkmmooqqssu +acceeggiikkmmooqqstt +acceeggiikkmmooqqstu +acceeggiikkmmooqrrtt +acceeggiikkmmooqrrtu +bcdefghijklmnopqrrtt +bcdefghijklmnopqrrtu +bcdefghijklmnopqrssu +bcdefghijklmnopqrstt +bcdefghijklmnopqrstu +0 diff --git a/codenet/public_test_cases/p00776/output.1.txt b/codenet/public_test_cases/p00776/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1ae4d1aa98183e665ae76845e96a6145e2fd13f --- /dev/null +++ b/codenet/public_test_cases/p00776/output.1.txt @@ -0,0 +1,20 @@ +1 +fox +5 +acc +acd +bbd +bcc +bcd +17711 +acceeggiikkmmooqqssu +acceeggiikkmmooqqstt +acceeggiikkmmooqqstu +acceeggiikkmmooqrrtt +acceeggiikkmmooqrrtu +bcdefghijklmnopqrrtt +bcdefghijklmnopqrrtu +bcdefghijklmnopqrssu +bcdefghijklmnopqrstt +bcdefghijklmnopqrstu +0 diff --git a/codenet/public_test_cases/p00777/input.0.txt b/codenet/public_test_cases/p00777/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7c7e29bb156d9a135574c77ddce5f5b9d7c0ddb --- /dev/null +++ b/codenet/public_test_cases/p00777/input.0.txt @@ -0,0 +1,10 @@ +4 +1 2 3 +10 20 30 +10 +1 2 2 1 5 5 1 8 8 +10 1 1 20 1 1 30 1 1 +3 +1 1 +1 1 +0 diff --git a/codenet/public_test_cases/p00777/input.1.txt b/codenet/public_test_cases/p00777/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7c7e29bb156d9a135574c77ddce5f5b9d7c0ddb --- /dev/null +++ b/codenet/public_test_cases/p00777/input.1.txt @@ -0,0 +1,10 @@ +4 +1 2 3 +10 20 30 +10 +1 2 2 1 5 5 1 8 8 +10 1 1 20 1 1 30 1 1 +3 +1 1 +1 1 +0 diff --git a/codenet/public_test_cases/p00777/output.0.txt b/codenet/public_test_cases/p00777/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee19f056faf479589b08b4d94683e5867741bbc9 --- /dev/null +++ b/codenet/public_test_cases/p00777/output.0.txt @@ -0,0 +1,3 @@ +80 +136 +2 diff --git a/codenet/public_test_cases/p00777/output.1.txt b/codenet/public_test_cases/p00777/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee19f056faf479589b08b4d94683e5867741bbc9 --- /dev/null +++ b/codenet/public_test_cases/p00777/output.1.txt @@ -0,0 +1,3 @@ +80 +136 +2 diff --git a/codenet/public_test_cases/p00778/input.0.txt b/codenet/public_test_cases/p00778/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4155c1a4b7afb1e412e1a4ab86fd5e11cce0acff --- /dev/null +++ b/codenet/public_test_cases/p00778/input.0.txt @@ -0,0 +1,15 @@ +1 1 1 1 1 1 +1 6 +1 1 1 1 1 1 +4 5 +0 0 0 0 0 2 +1 2 +0 0 2 2 2 4 +5 9 +1 2 3 4 5 6 +15 16 +0 1 2 3 5 9 +13 16 +2 13 22 27 31 91 +100 170 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00778/input.1.txt b/codenet/public_test_cases/p00778/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4155c1a4b7afb1e412e1a4ab86fd5e11cce0acff --- /dev/null +++ b/codenet/public_test_cases/p00778/input.1.txt @@ -0,0 +1,15 @@ +1 1 1 1 1 1 +1 6 +1 1 1 1 1 1 +4 5 +0 0 0 0 0 2 +1 2 +0 0 2 2 2 4 +5 9 +1 2 3 4 5 6 +15 16 +0 1 2 3 5 9 +13 16 +2 13 22 27 31 91 +100 170 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00778/output.0.txt b/codenet/public_test_cases/p00778/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf99fd3801140fb76a7dbd639d8e48b01d123148 --- /dev/null +++ b/codenet/public_test_cases/p00778/output.0.txt @@ -0,0 +1,7 @@ +EEENEE +NE +impossible +NSSNW +EN +EWNS +SNSNSNSNSNSNSNSNSNSNSNSSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNWEWE diff --git a/codenet/public_test_cases/p00778/output.1.txt b/codenet/public_test_cases/p00778/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf99fd3801140fb76a7dbd639d8e48b01d123148 --- /dev/null +++ b/codenet/public_test_cases/p00778/output.1.txt @@ -0,0 +1,7 @@ +EEENEE +NE +impossible +NSSNW +EN +EWNS +SNSNSNSNSNSNSNSNSNSNSNSSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNWEWE diff --git a/codenet/public_test_cases/p00779/input.0.txt b/codenet/public_test_cases/p00779/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5141e7d81aeb590d8d496a3aaee0d554f99d0cb --- /dev/null +++ b/codenet/public_test_cases/p00779/input.0.txt @@ -0,0 +1,79 @@ +5 3 +0 0 1000 +1399 1331 931 +0 1331 500 +1398 0 400 +2000 360 340 +450 950 1600 380 +450 950 1399 1331 +450 950 450 2000 +1 2 +50 50 50 +0 10 100 90 +0 10 50 50 +2 2 +50 50 50 +100 50 50 +40 50 110 50 +40 50 0 0 +4 1 +25 100 26 +75 100 26 +50 40 40 +50 160 40 +50 81 50 119 +6 1 +100 50 40 +0 50 40 +50 0 48 +50 50 3 +55 55 4 +55 105 48 +50 55 55 50 +20 6 +270 180 50 +360 170 50 +0 0 50 +10 0 10 +0 90 50 +0 180 50 +90 180 50 +180 180 50 +205 90 50 +180 0 50 +65 0 20 +75 30 16 +90 78 36 +105 30 16 +115 0 20 +128 48 15 +128 100 15 +280 0 30 +330 0 30 +305 65 42 +0 20 10 20 +0 20 10 0 +50 30 133 0 +50 30 133 30 +90 40 305 20 +90 40 240 30 +16 2 +0 0 50 +0 90 50 +0 180 50 +90 180 50 +180 180 50 +205 90 50 +180 0 50 +65 0 20 +115 0 20 +90 0 15 +280 0 30 +330 0 30 +305 65 42 +75 40 16 +90 88 36 +105 40 16 +128 35 250 30 +90 50 305 20 +0 0 diff --git a/codenet/public_test_cases/p00779/input.1.txt b/codenet/public_test_cases/p00779/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5141e7d81aeb590d8d496a3aaee0d554f99d0cb --- /dev/null +++ b/codenet/public_test_cases/p00779/input.1.txt @@ -0,0 +1,79 @@ +5 3 +0 0 1000 +1399 1331 931 +0 1331 500 +1398 0 400 +2000 360 340 +450 950 1600 380 +450 950 1399 1331 +450 950 450 2000 +1 2 +50 50 50 +0 10 100 90 +0 10 50 50 +2 2 +50 50 50 +100 50 50 +40 50 110 50 +40 50 0 0 +4 1 +25 100 26 +75 100 26 +50 40 40 +50 160 40 +50 81 50 119 +6 1 +100 50 40 +0 50 40 +50 0 48 +50 50 3 +55 55 4 +55 105 48 +50 55 55 50 +20 6 +270 180 50 +360 170 50 +0 0 50 +10 0 10 +0 90 50 +0 180 50 +90 180 50 +180 180 50 +205 90 50 +180 0 50 +65 0 20 +75 30 16 +90 78 36 +105 30 16 +115 0 20 +128 48 15 +128 100 15 +280 0 30 +330 0 30 +305 65 42 +0 20 10 20 +0 20 10 0 +50 30 133 0 +50 30 133 30 +90 40 305 20 +90 40 240 30 +16 2 +0 0 50 +0 90 50 +0 180 50 +90 180 50 +180 180 50 +205 90 50 +180 0 50 +65 0 20 +115 0 20 +90 0 15 +280 0 30 +330 0 30 +305 65 42 +75 40 16 +90 88 36 +105 40 16 +128 35 250 30 +90 50 305 20 +0 0 diff --git a/codenet/public_test_cases/p00779/output.0.txt b/codenet/public_test_cases/p00779/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e528a7ee258e150d36ad9fc7cec0069d43171b2 --- /dev/null +++ b/codenet/public_test_cases/p00779/output.0.txt @@ -0,0 +1,7 @@ +YES NO NO +YES NO +NO NO +NO +YES +YES NO NO YES NO NO +NO NO diff --git a/codenet/public_test_cases/p00779/output.1.txt b/codenet/public_test_cases/p00779/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e528a7ee258e150d36ad9fc7cec0069d43171b2 --- /dev/null +++ b/codenet/public_test_cases/p00779/output.1.txt @@ -0,0 +1,7 @@ +YES NO NO +YES NO +NO NO +NO +YES +YES NO NO YES NO NO +NO NO diff --git a/codenet/public_test_cases/p00780/input.0.txt b/codenet/public_test_cases/p00780/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a1d39327b0c3cd0de2ba74aa9f099e75fe3fd07 --- /dev/null +++ b/codenet/public_test_cases/p00780/input.0.txt @@ -0,0 +1,4 @@ +6 +10 +12 +0 diff --git a/codenet/public_test_cases/p00780/input.1.txt b/codenet/public_test_cases/p00780/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a1d39327b0c3cd0de2ba74aa9f099e75fe3fd07 --- /dev/null +++ b/codenet/public_test_cases/p00780/input.1.txt @@ -0,0 +1,4 @@ +6 +10 +12 +0 diff --git a/codenet/public_test_cases/p00780/output.0.txt b/codenet/public_test_cases/p00780/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e13c5bfaa64f706a467fbfed13e3c609dc07a95e --- /dev/null +++ b/codenet/public_test_cases/p00780/output.0.txt @@ -0,0 +1,3 @@ +1 +2 +1 diff --git a/codenet/public_test_cases/p00780/output.1.txt b/codenet/public_test_cases/p00780/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e13c5bfaa64f706a467fbfed13e3c609dc07a95e --- /dev/null +++ b/codenet/public_test_cases/p00780/output.1.txt @@ -0,0 +1,3 @@ +1 +2 +1 diff --git a/codenet/public_test_cases/p00781/input.0.txt b/codenet/public_test_cases/p00781/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..750e3acb8fcc4859c77a8d9d668d323fbf011654 --- /dev/null +++ b/codenet/public_test_cases/p00781/input.0.txt @@ -0,0 +1,3 @@ +10000 01000 00100 11000 01100 11111 01110 11100 10110 11110 +10101 01000 00000 11001 01100 11101 01110 11100 10110 11010 +END diff --git a/codenet/public_test_cases/p00781/input.1.txt b/codenet/public_test_cases/p00781/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..750e3acb8fcc4859c77a8d9d668d323fbf011654 --- /dev/null +++ b/codenet/public_test_cases/p00781/input.1.txt @@ -0,0 +1,3 @@ +10000 01000 00100 11000 01100 11111 01110 11100 10110 11110 +10101 01000 00000 11001 01100 11101 01110 11100 10110 11010 +END diff --git a/codenet/public_test_cases/p00781/output.0.txt b/codenet/public_test_cases/p00781/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48ec64da2889d3818d1fbfd06e0ff5f97b16513b --- /dev/null +++ b/codenet/public_test_cases/p00781/output.0.txt @@ -0,0 +1,2 @@ +40 +6 diff --git a/codenet/public_test_cases/p00781/output.1.txt b/codenet/public_test_cases/p00781/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48ec64da2889d3818d1fbfd06e0ff5f97b16513b --- /dev/null +++ b/codenet/public_test_cases/p00781/output.1.txt @@ -0,0 +1,2 @@ +40 +6 diff --git a/codenet/public_test_cases/p00782/input.0.txt b/codenet/public_test_cases/p00782/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be4829e3abbd9c198bf900714950f241aaefcd6f --- /dev/null +++ b/codenet/public_test_cases/p00782/input.0.txt @@ -0,0 +1,8 @@ +3 +4.0 4.0 3.0 +5.0 6.0 3.0 +5.5 4.5 1.0 +2 +3.0 3.0 3.0 +1.5 1.5 1.0 +0 diff --git a/codenet/public_test_cases/p00782/input.1.txt b/codenet/public_test_cases/p00782/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..be4829e3abbd9c198bf900714950f241aaefcd6f --- /dev/null +++ b/codenet/public_test_cases/p00782/input.1.txt @@ -0,0 +1,8 @@ +3 +4.0 4.0 3.0 +5.0 6.0 3.0 +5.5 4.5 1.0 +2 +3.0 3.0 3.0 +1.5 1.5 1.0 +0 diff --git a/codenet/public_test_cases/p00782/output.0.txt b/codenet/public_test_cases/p00782/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c82c1f76bb29ccae7a82a486231da351bd82a2cc --- /dev/null +++ b/codenet/public_test_cases/p00782/output.0.txt @@ -0,0 +1,2 @@ +1 52.00 +2 36.00 diff --git a/codenet/public_test_cases/p00782/output.1.txt b/codenet/public_test_cases/p00782/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c82c1f76bb29ccae7a82a486231da351bd82a2cc --- /dev/null +++ b/codenet/public_test_cases/p00782/output.1.txt @@ -0,0 +1,2 @@ +1 52.00 +2 36.00 diff --git a/codenet/public_test_cases/p00783/input.0.txt b/codenet/public_test_cases/p00783/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afdd4c1e794fbc822619c5c651a261dd2f0320b9 --- /dev/null +++ b/codenet/public_test_cases/p00783/input.0.txt @@ -0,0 +1,5 @@ +As the first man said to the +first woman: +"Madam, I'm Adam." +She responded: +"Eve." diff --git a/codenet/public_test_cases/p00783/input.1.txt b/codenet/public_test_cases/p00783/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afdd4c1e794fbc822619c5c651a261dd2f0320b9 --- /dev/null +++ b/codenet/public_test_cases/p00783/input.1.txt @@ -0,0 +1,5 @@ +As the first man said to the +first woman: +"Madam, I'm Adam." +She responded: +"Eve." diff --git a/codenet/public_test_cases/p00783/output.0.txt b/codenet/public_test_cases/p00783/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..803cf46d7597b841d67cf7e829dd3e753146dd43 --- /dev/null +++ b/codenet/public_test_cases/p00783/output.0.txt @@ -0,0 +1,5 @@ +TOT + +MADAMIMADAM MADAM +ERE DED +EVE diff --git a/codenet/public_test_cases/p00783/output.1.txt b/codenet/public_test_cases/p00783/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..803cf46d7597b841d67cf7e829dd3e753146dd43 --- /dev/null +++ b/codenet/public_test_cases/p00783/output.1.txt @@ -0,0 +1,5 @@ +TOT + +MADAMIMADAM MADAM +ERE DED +EVE diff --git a/codenet/public_test_cases/p00784/input.0.txt b/codenet/public_test_cases/p00784/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81aee7aca650173d62e81eadaed86c44ed521777 --- /dev/null +++ b/codenet/public_test_cases/p00784/input.0.txt @@ -0,0 +1,7 @@ +7 +X...XX. +.X..... +..X.... +...X... +......X +0 diff --git a/codenet/public_test_cases/p00784/input.1.txt b/codenet/public_test_cases/p00784/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81aee7aca650173d62e81eadaed86c44ed521777 --- /dev/null +++ b/codenet/public_test_cases/p00784/input.1.txt @@ -0,0 +1,7 @@ +7 +X...XX. +.X..... +..X.... +...X... +......X +0 diff --git a/codenet/public_test_cases/p00784/output.0.txt b/codenet/public_test_cases/p00784/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p00784/output.0.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p00784/output.1.txt b/codenet/public_test_cases/p00784/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p00784/output.1.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p00785/input.0.txt b/codenet/public_test_cases/p00785/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d86c10cf053d50333835a8f29db1ff82bd324066 --- /dev/null +++ b/codenet/public_test_cases/p00785/input.0.txt @@ -0,0 +1,12 @@ +3 +100 500 +200 500 +300 500 +6 +100 300 +100 600 +200 100 +200 700 +500 100 +600 300 +0 diff --git a/codenet/public_test_cases/p00785/output.0.txt b/codenet/public_test_cases/p00785/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d622081392a87ce49f347a78570004526b847547 --- /dev/null +++ b/codenet/public_test_cases/p00785/output.0.txt @@ -0,0 +1,2 @@ +166.6667 555.5556 +333.3333 333.3333 diff --git a/codenet/public_test_cases/p00786/input.0.txt b/codenet/public_test_cases/p00786/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ece716a98be267aa8e7f1e6332f7fdde4cfb603 --- /dev/null +++ b/codenet/public_test_cases/p00786/input.0.txt @@ -0,0 +1,21 @@ +a(A,b(B,C)); +x( y( y( z(z), v( s, t ) ) ), u ) ; + +a( b( c, + d( + e(f), + g + ) + ), + h( i( + j( + k(k,k), + l(l) + ), + m(m) + ) + ) + ); + +a(B(C),d(e(f(g(h(i(j,k),l),m),n),o),p)) +. diff --git a/codenet/public_test_cases/p00786/input.1.txt b/codenet/public_test_cases/p00786/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ece716a98be267aa8e7f1e6332f7fdde4cfb603 --- /dev/null +++ b/codenet/public_test_cases/p00786/input.1.txt @@ -0,0 +1,21 @@ +a(A,b(B,C)); +x( y( y( z(z), v( s, t ) ) ), u ) ; + +a( b( c, + d( + e(f), + g + ) + ), + h( i( + j( + k(k,k), + l(l) + ), + m(m) + ) + ) + ); + +a(B(C),d(e(f(g(h(i(j,k),l),m),n),o),p)) +. diff --git a/codenet/public_test_cases/p00786/input.2.txt b/codenet/public_test_cases/p00786/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf31ff9e42df5e7d6f9c8f9923a79f52951ae2c7 --- /dev/null +++ b/codenet/public_test_cases/p00786/input.2.txt @@ -0,0 +1,21 @@ +a(A,b(B,C)); +x( y( y( z(z), v( s, t ) ) ), u ) ; + +a( b( c, +d( +e(f), +g +) +), +h( i( +j( +k(k,k), +l(l) +), +m(m) +) +) +); + +a(B(C),d(e(f(g(h(i(j,k),l),m),n),o),p)) +. diff --git a/codenet/public_test_cases/p00786/output.0.txt b/codenet/public_test_cases/p00786/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c8e9acb3289e570a97979afb0483a89197a5e06 --- /dev/null +++ b/codenet/public_test_cases/p00786/output.0.txt @@ -0,0 +1,44 @@ +1: + B C + --- +A b +--- + a +2: +z s t +- --- +z v +---- + y + - + y u + --- + x +3: + k k l + --- - + f k l m + - ---- - + e g j m + --- ----- +c d i +--- - + b h + ------- + a +4: +j k +--- + i l + --- + h m + --- + g n + --- + f o + --- + C e p + - --- + B d + ---- + a diff --git a/codenet/public_test_cases/p00786/output.1.txt b/codenet/public_test_cases/p00786/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c8e9acb3289e570a97979afb0483a89197a5e06 --- /dev/null +++ b/codenet/public_test_cases/p00786/output.1.txt @@ -0,0 +1,44 @@ +1: + B C + --- +A b +--- + a +2: +z s t +- --- +z v +---- + y + - + y u + --- + x +3: + k k l + --- - + f k l m + - ---- - + e g j m + --- ----- +c d i +--- - + b h + ------- + a +4: +j k +--- + i l + --- + h m + --- + g n + --- + f o + --- + C e p + - --- + B d + ---- + a diff --git a/codenet/public_test_cases/p00786/output.2.txt b/codenet/public_test_cases/p00786/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5baab08523ca217aece9c0a7fe2d8c9f45cd1f6d --- /dev/null +++ b/codenet/public_test_cases/p00786/output.2.txt @@ -0,0 +1,44 @@ +1: +B C +--- +A b +--- +a +2: +z s t +- --- +z v +---- +y +- +y u +--- +x +3: +k k l +--- - +f k l m +- ---- - +e g j m +--- ----- +c d i +--- - +b h +------- +a +4: +j k +--- +i l +--- +h m +--- +g n +--- +f o +--- +C e p +- --- +B d +---- +a diff --git a/codenet/public_test_cases/p00787/input.0.txt b/codenet/public_test_cases/p00787/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b79c335a6368de083a93681e971091ca5cb9b43f --- /dev/null +++ b/codenet/public_test_cases/p00787/input.0.txt @@ -0,0 +1,23 @@ +6 28 6 32 25 32 26 27 26 24 6 24 99999 +2 28 2 35 30 35 30 20 2 20 99999 + +3 28 +22.667 +0 1 1 1 1 0 0 -1 0 -1 1 0 0 0 1 0 -1 0 0 -1 -1 -1 -1 0 -1 0 -1 -1 -1 1 -1 1 +-1 1 -1 0 1 0 1 1 1 1 1 0 1 1 99999 + +5 28 +22.667 +0 1 -1 1 1 0 1 -1 1 -1 1 0 1 0 1 0 -1 -1 -1 0 -1 -1 -1 0 -1 1 -1 -1 -1 1 +-1 0 -1 1 -1 0 1 0 1 0 1 1 1 1 1 1 99999 + +4 28 +6.333 +0 1 0 1 1 -1 -1 -1 0 -1 0 -1 0 -1 99999 + +3 28 +20.000 +0 -1 1 -1 1 0 1 1 1 1 1 0 -1 0 -1 0 -1 1 -1 1 +-1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 1 0 1 -1 1 -1 1 -1 99999 + +99999 diff --git a/codenet/public_test_cases/p00787/input.1.txt b/codenet/public_test_cases/p00787/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b79c335a6368de083a93681e971091ca5cb9b43f --- /dev/null +++ b/codenet/public_test_cases/p00787/input.1.txt @@ -0,0 +1,23 @@ +6 28 6 32 25 32 26 27 26 24 6 24 99999 +2 28 2 35 30 35 30 20 2 20 99999 + +3 28 +22.667 +0 1 1 1 1 0 0 -1 0 -1 1 0 0 0 1 0 -1 0 0 -1 -1 -1 -1 0 -1 0 -1 -1 -1 1 -1 1 +-1 1 -1 0 1 0 1 1 1 1 1 0 1 1 99999 + +5 28 +22.667 +0 1 -1 1 1 0 1 -1 1 -1 1 0 1 0 1 0 -1 -1 -1 0 -1 -1 -1 0 -1 1 -1 -1 -1 1 +-1 0 -1 1 -1 0 1 0 1 0 1 1 1 1 1 1 99999 + +4 28 +6.333 +0 1 0 1 1 -1 -1 -1 0 -1 0 -1 0 -1 99999 + +3 28 +20.000 +0 -1 1 -1 1 0 1 1 1 1 1 0 -1 0 -1 0 -1 1 -1 1 +-1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 1 0 1 -1 1 -1 1 -1 99999 + +99999 diff --git a/codenet/public_test_cases/p00787/output.0.txt b/codenet/public_test_cases/p00787/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6884743a74fd90dace2e41bde37a746710576f09 --- /dev/null +++ b/codenet/public_test_cases/p00787/output.0.txt @@ -0,0 +1,4 @@ +OK +NG +NG +NG diff --git a/codenet/public_test_cases/p00787/output.1.txt b/codenet/public_test_cases/p00787/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6884743a74fd90dace2e41bde37a746710576f09 --- /dev/null +++ b/codenet/public_test_cases/p00787/output.1.txt @@ -0,0 +1,4 @@ +OK +NG +NG +NG diff --git a/codenet/public_test_cases/p00788/input.0.txt b/codenet/public_test_cases/p00788/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a707c2d9b79795a3ed02033d47f16bc09c403583 --- /dev/null +++ b/codenet/public_test_cases/p00788/input.0.txt @@ -0,0 +1,4 @@ +2 5 +3 10 +5 100 +0 0 diff --git a/codenet/public_test_cases/p00788/input.1.txt b/codenet/public_test_cases/p00788/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a707c2d9b79795a3ed02033d47f16bc09c403583 --- /dev/null +++ b/codenet/public_test_cases/p00788/input.1.txt @@ -0,0 +1,4 @@ +2 5 +3 10 +5 100 +0 0 diff --git a/codenet/public_test_cases/p00788/output.0.txt b/codenet/public_test_cases/p00788/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..84a2778718648df7f3072fdc290a5b72fcaef7f2 --- /dev/null +++ b/codenet/public_test_cases/p00788/output.0.txt @@ -0,0 +1,3 @@ +3/2 4/3 +7/4 5/3 +85/38 38/17 diff --git a/codenet/public_test_cases/p00788/output.1.txt b/codenet/public_test_cases/p00788/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..84a2778718648df7f3072fdc290a5b72fcaef7f2 --- /dev/null +++ b/codenet/public_test_cases/p00788/output.1.txt @@ -0,0 +1,3 @@ +3/2 4/3 +7/4 5/3 +85/38 38/17 diff --git a/codenet/public_test_cases/p00789/input.0.txt b/codenet/public_test_cases/p00789/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e4aae41f2c50b108a464ef04df24faba5b3df9a --- /dev/null +++ b/codenet/public_test_cases/p00789/input.0.txt @@ -0,0 +1,4 @@ +2 +10 +30 +0 diff --git a/codenet/public_test_cases/p00789/input.1.txt b/codenet/public_test_cases/p00789/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e4aae41f2c50b108a464ef04df24faba5b3df9a --- /dev/null +++ b/codenet/public_test_cases/p00789/input.1.txt @@ -0,0 +1,4 @@ +2 +10 +30 +0 diff --git a/codenet/public_test_cases/p00789/output.0.txt b/codenet/public_test_cases/p00789/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fbe9b3c179f294ffc3f3131365ee994149c7c26 --- /dev/null +++ b/codenet/public_test_cases/p00789/output.0.txt @@ -0,0 +1,3 @@ +1 +4 +27 diff --git a/codenet/public_test_cases/p00789/output.1.txt b/codenet/public_test_cases/p00789/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fbe9b3c179f294ffc3f3131365ee994149c7c26 --- /dev/null +++ b/codenet/public_test_cases/p00789/output.1.txt @@ -0,0 +1,3 @@ +1 +4 +27 diff --git a/codenet/public_test_cases/p00790/input.0.txt b/codenet/public_test_cases/p00790/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7ce5b1c61598b6c2b7daadf48f6ddff22b0b17f --- /dev/null +++ b/codenet/public_test_cases/p00790/input.0.txt @@ -0,0 +1,7 @@ +1 +north +3 +north +east +south +0 diff --git a/codenet/public_test_cases/p00790/input.1.txt b/codenet/public_test_cases/p00790/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7ce5b1c61598b6c2b7daadf48f6ddff22b0b17f --- /dev/null +++ b/codenet/public_test_cases/p00790/input.1.txt @@ -0,0 +1,7 @@ +1 +north +3 +north +east +south +0 diff --git a/codenet/public_test_cases/p00790/output.0.txt b/codenet/public_test_cases/p00790/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af74fdcd71a03732095b62ca716ac02310b9fa71 --- /dev/null +++ b/codenet/public_test_cases/p00790/output.0.txt @@ -0,0 +1,2 @@ +5 +1 diff --git a/codenet/public_test_cases/p00790/output.1.txt b/codenet/public_test_cases/p00790/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af74fdcd71a03732095b62ca716ac02310b9fa71 --- /dev/null +++ b/codenet/public_test_cases/p00790/output.1.txt @@ -0,0 +1,2 @@ +5 +1 diff --git a/codenet/public_test_cases/p00791/input.0.txt b/codenet/public_test_cases/p00791/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..973ba9a4dc2dfb573267b5079df758200e7a211d --- /dev/null +++ b/codenet/public_test_cases/p00791/input.0.txt @@ -0,0 +1,31 @@ +7 +******** +* * +* *** * +* * * * +* *** * +* * +******** +9 + +*** +* * +***** ***** + * * + *** ***** + * * + * * + *** +11 + **** ******************* + * * ********* * * + ****** * * **** * ********* * + * *** * * * * * * * +*** * * * * **** ******* * * *** *** * * +* * * ***** * * * * * * * * * * * +*** * * *** * * *** *** * * + ********* * * * * + * ********************* * + * * + ***************************** +0 diff --git a/codenet/public_test_cases/p00791/input.1.txt b/codenet/public_test_cases/p00791/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e53bfcf00095538362338aad29030e0b89afb411 --- /dev/null +++ b/codenet/public_test_cases/p00791/input.1.txt @@ -0,0 +1,31 @@ +7 +******** +* * +* *** * +* * * * +* *** * +* * +******** +9 + +*** +* * +***** ***** +* * +*** ***** +* * +* * +*** +11 +**** ******************* +* * ********* * * +****** * * **** * ********* * +* *** * * * * * * * +*** * * * * **** ******* * * *** *** * * +* * * ***** * * * * * * * * * * * +*** * * *** * * *** *** * * +********* * * * * +* ********************* * +* * +***************************** +0 diff --git a/codenet/public_test_cases/p00791/input.2.txt b/codenet/public_test_cases/p00791/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..973ba9a4dc2dfb573267b5079df758200e7a211d --- /dev/null +++ b/codenet/public_test_cases/p00791/input.2.txt @@ -0,0 +1,31 @@ +7 +******** +* * +* *** * +* * * * +* *** * +* * +******** +9 + +*** +* * +***** ***** + * * + *** ***** + * * + * * + *** +11 + **** ******************* + * * ********* * * + ****** * * **** * ********* * + * *** * * * * * * * +*** * * * * **** ******* * * *** *** * * +* * * ***** * * * * * * * * * * * +*** * * *** * * *** *** * * + ********* * * * * + * ********************* * + * * + ***************************** +0 diff --git a/codenet/public_test_cases/p00791/output.0.txt b/codenet/public_test_cases/p00791/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4f1551f68475b3500f310517bfa7812ee994878 --- /dev/null +++ b/codenet/public_test_cases/p00791/output.0.txt @@ -0,0 +1,12 @@ +9 1 +56 1 +---------- +12 2 +15 1 +---------- +9 3 +12 2 +15 2 +63 1 +105 1 +264 1 diff --git a/codenet/public_test_cases/p00791/output.1.txt b/codenet/public_test_cases/p00791/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4f1551f68475b3500f310517bfa7812ee994878 --- /dev/null +++ b/codenet/public_test_cases/p00791/output.1.txt @@ -0,0 +1,12 @@ +9 1 +56 1 +---------- +12 2 +15 1 +---------- +9 3 +12 2 +15 2 +63 1 +105 1 +264 1 diff --git a/codenet/public_test_cases/p00791/output.2.txt b/codenet/public_test_cases/p00791/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4f1551f68475b3500f310517bfa7812ee994878 --- /dev/null +++ b/codenet/public_test_cases/p00791/output.2.txt @@ -0,0 +1,12 @@ +9 1 +56 1 +---------- +12 2 +15 1 +---------- +9 3 +12 2 +15 2 +63 1 +105 1 +264 1 diff --git a/codenet/public_test_cases/p00792/input.0.txt b/codenet/public_test_cases/p00792/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b76682aef9e36aaf3cfe2243db2513f08c068989 --- /dev/null +++ b/codenet/public_test_cases/p00792/input.0.txt @@ -0,0 +1,14 @@ +0 +1 +y 8 7 +4 +y 8 7 +x 7 8 +y 0 0 +x 0 0 +4 +y 2 1 +x 1 2 +y 0 0 +x 0 0 +-1 diff --git a/codenet/public_test_cases/p00792/input.1.txt b/codenet/public_test_cases/p00792/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b76682aef9e36aaf3cfe2243db2513f08c068989 --- /dev/null +++ b/codenet/public_test_cases/p00792/input.1.txt @@ -0,0 +1,14 @@ +0 +1 +y 8 7 +4 +y 8 7 +x 7 8 +y 0 0 +x 0 0 +4 +y 2 1 +x 1 2 +y 0 0 +x 0 0 +-1 diff --git a/codenet/public_test_cases/p00792/output.0.txt b/codenet/public_test_cases/p00792/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14bf98308cbaf3fb553ebde6ed3aaf817fad4390 --- /dev/null +++ b/codenet/public_test_cases/p00792/output.0.txt @@ -0,0 +1,4 @@ +800 750 +750 800 +75 25 +75 25 diff --git a/codenet/public_test_cases/p00792/output.1.txt b/codenet/public_test_cases/p00792/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14bf98308cbaf3fb553ebde6ed3aaf817fad4390 --- /dev/null +++ b/codenet/public_test_cases/p00792/output.1.txt @@ -0,0 +1,4 @@ +800 750 +750 800 +75 25 +75 25 diff --git a/codenet/public_test_cases/p00793/input.0.txt b/codenet/public_test_cases/p00793/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a55c733381065fd6a0dae66b605ede87aa0a7f91 --- /dev/null +++ b/codenet/public_test_cases/p00793/input.0.txt @@ -0,0 +1,3 @@ +2000 2000 8000 8000 9000 9500 +2500 2500 7500 2500 2500 7500 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00793/input.1.txt b/codenet/public_test_cases/p00793/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a55c733381065fd6a0dae66b605ede87aa0a7f91 --- /dev/null +++ b/codenet/public_test_cases/p00793/input.1.txt @@ -0,0 +1,3 @@ +2000 2000 8000 8000 9000 9500 +2500 2500 7500 2500 2500 7500 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00793/output.0.txt b/codenet/public_test_cases/p00793/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..67f6070a423bda87a4849d2af2cae9894a0bbcb2 --- /dev/null +++ b/codenet/public_test_cases/p00793/output.0.txt @@ -0,0 +1,2 @@ +1 0.50000 +2 0.25000 diff --git a/codenet/public_test_cases/p00793/output.1.txt b/codenet/public_test_cases/p00793/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67f6070a423bda87a4849d2af2cae9894a0bbcb2 --- /dev/null +++ b/codenet/public_test_cases/p00793/output.1.txt @@ -0,0 +1,2 @@ +1 0.50000 +2 0.25000 diff --git a/codenet/public_test_cases/p00794/input.0.txt b/codenet/public_test_cases/p00794/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a31ad90f3b5020447760e122b9077f457d4dcba1 --- /dev/null +++ b/codenet/public_test_cases/p00794/input.0.txt @@ -0,0 +1,16 @@ +3 3 +2 1 1 +1 1 0 +1 1 3 +8 4 +2 1 1 0 1 1 1 0 +1 0 4 1 1 0 4 1 +1 0 0 0 0 0 0 1 +1 1 1 4 1 1 1 3 +8 5 +1 2 1 1 1 1 1 4 +1 0 0 0 1 0 0 1 +1 4 1 0 1 1 0 1 +1 0 0 0 0 3 0 1 +1 1 4 1 1 1 1 1 +0 0 diff --git a/codenet/public_test_cases/p00794/output.0.txt b/codenet/public_test_cases/p00794/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..873870147d124c6d334985af4c6592823f074538 --- /dev/null +++ b/codenet/public_test_cases/p00794/output.0.txt @@ -0,0 +1,3 @@ +4 +-1 +13 diff --git a/codenet/public_test_cases/p00795/input.0.txt b/codenet/public_test_cases/p00795/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad443240007bd7e3b978a05829955848825a6dd7 --- /dev/null +++ b/codenet/public_test_cases/p00795/input.0.txt @@ -0,0 +1,25 @@ +Thefirstexampleistrivial. + +mfv + +AhugeamountofinformationisbeingheapedonWWW.Albeititisnot +well-organized,userscanbrowseWWWasanunboundedsourceof +up-to-dateinformation,insteadofconsultingestablishedbutalittle +out-of-dateencyclopedia.However,youcanfurtherexploitWWWby +learningmoreaboutkeywordsearchalgorithms.Forexample,ifyou +wanttogetinformationonrecentcomparisonbetweenWindowsandUNIX, +youmayexpecttogetrelevantdescriptionoutofabigbunchofWeb +texts,byextractingtextsthatcontainbothkeywords"Windows"and"UNIX" +closetogether. + +bWn + +3.1415926535897932384626433832795028841971693993751058209749445923078164 + +pi + +Wagner,Bach,Beethoven,Chopin,Brahms,Hindemith,Ives,Suk,Mozart,Stravinsky + +Weary + +ASCIIcharacterssuchas+,*,[,#, diff --git a/codenet/public_test_cases/p00795/input.1.txt b/codenet/public_test_cases/p00795/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad443240007bd7e3b978a05829955848825a6dd7 --- /dev/null +++ b/codenet/public_test_cases/p00795/input.1.txt @@ -0,0 +1,25 @@ +Thefirstexampleistrivial. + +mfv + +AhugeamountofinformationisbeingheapedonWWW.Albeititisnot +well-organized,userscanbrowseWWWasanunboundedsourceof +up-to-dateinformation,insteadofconsultingestablishedbutalittle +out-of-dateencyclopedia.However,youcanfurtherexploitWWWby +learningmoreaboutkeywordsearchalgorithms.Forexample,ifyou +wanttogetinformationonrecentcomparisonbetweenWindowsandUNIX, +youmayexpecttogetrelevantdescriptionoutofabigbunchofWeb +texts,byextractingtextsthatcontainbothkeywords"Windows"and"UNIX" +closetogether. + +bWn + +3.1415926535897932384626433832795028841971693993751058209749445923078164 + +pi + +Wagner,Bach,Beethoven,Chopin,Brahms,Hindemith,Ives,Suk,Mozart,Stravinsky + +Weary + +ASCIIcharacterssuchas+,*,[,#, diff --git a/codenet/public_test_cases/p00795/input.2.txt b/codenet/public_test_cases/p00795/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdb9ec4cf10b9636850efa6fd8b62becbec3c36e --- /dev/null +++ b/codenet/public_test_cases/p00795/input.2.txt @@ -0,0 +1,35 @@ +Thefirstexampleistrivial. + +mfv + +AhugeamountofinformationisbeingheapedonWWW.Albeititisnot +well-organized,userscanbrowseWWWasanunboundedsourceof +up-to-dateinformation,insteadofconsultingestablishedbutalittle +out-of-dateencyclopedia.However,youcanfurtherexploitWWWby +learningmoreaboutkeywordsearchalgorithms.Forexample,ifyou +wanttogetinformationonrecentcomparisonbetweenWindowsandUNIX, +youmayexpecttogetrelevantdescriptionoutofabigbunchofWeb +texts,byextractingtextsthatcontainbothkeywords"Windows"and"UNIX" +closetogether. + +bWn + +3.1415926535897932384626433832795028841971693993751058209749445923078164 + +pi + +Wagner,Bach,Beethoven,Chopin,Brahms,Hindemith,Ives,Suk,Mozart,Stravinsky + +Weary + +ASCIIcharacterssuchas+,*,[,#,<,},_arenotexcludedinagivenstringas +thisexampleillustratesbyitself.Youshouldnotforgetthem.Onemorefact +youshouldnoticeisthatuppercaselettersandlowercaselettersare +distinguishedinthisproblem.Don'tidentify"g"and"G",forexmaple. +However,weareafraidthatthisexamplegivesyoutoomuchhint! + +![GsC_l + +ETAONRISHDLFCMUGYPWBVKXJQZ + +ABCDEFGHIJKLMNOPQRSTUVWXYZ diff --git a/codenet/public_test_cases/p00795/output.0.txt b/codenet/public_test_cases/p00795/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85a5e6d99a470062a45ff2131122ecbfae08eb80 --- /dev/null +++ b/codenet/public_test_cases/p00795/output.0.txt @@ -0,0 +1,17 @@ +1 + +firstexampleistriv + +7 + +nWWW.Alb + +0 + +1 + +Wagner,Bach,Beethoven,Chopin,Brahms,Hindemith,Ives,Suk,Mozart,Stravinsky + +1 + +CIIcharacterssuchas+,*,[,#, diff --git a/codenet/public_test_cases/p00795/output.1.txt b/codenet/public_test_cases/p00795/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85a5e6d99a470062a45ff2131122ecbfae08eb80 --- /dev/null +++ b/codenet/public_test_cases/p00795/output.1.txt @@ -0,0 +1,17 @@ +1 + +firstexampleistriv + +7 + +nWWW.Alb + +0 + +1 + +Wagner,Bach,Beethoven,Chopin,Brahms,Hindemith,Ives,Suk,Mozart,Stravinsky + +1 + +CIIcharacterssuchas+,*,[,#, diff --git a/codenet/public_test_cases/p00795/output.2.txt b/codenet/public_test_cases/p00795/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0596a0ea7a7f7355aeef0963d21ad02fbf8b8444 --- /dev/null +++ b/codenet/public_test_cases/p00795/output.2.txt @@ -0,0 +1,25 @@ +1 + +firstexampleistriv + +7 + +nWWW.Alb + +0 + +1 + +Wagner,Bach,Beethoven,Chopin,Brahms,Hindemith,Ives,Suk,Mozart,Stravinsky + +1 + +CIIcharacterssuchas+,*,[,#,<,},_arenotexcludedinagivenstringasthisexampl +eillustratesbyitself.Youshouldnotforgetthem.Onemorefactyoushouldnoticeis +thatuppercaselettersandlowercaselettersaredistinguishedinthisproblem.Don +'tidentify"g"and"G",forexmaple.However,weareafraidthatthisexamplegivesyo +utoomuchhint! + +1 + +ETAONRISHDLFCMUGYPWBVKXJQZ diff --git a/codenet/public_test_cases/p00796/input.0.txt b/codenet/public_test_cases/p00796/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69190861e47a234f77a3a72c92bf8b0e8fc8bee --- /dev/null +++ b/codenet/public_test_cases/p00796/input.0.txt @@ -0,0 +1,15 @@ +2 + 50.36493 81.61338 79.96592 +5 + -10293.83 -4800.033 -5296.238 + 14936.30 6964.826 7684.818 + -4516.069 25748.41 -27016.06 + 18301.59 -11946.25 5380.309 + 27115.20 43415.93 -71607.81 + 11.51547 13.35555 14.57307 +5 + -56292.27 2583.892 67754.62 + -567.5082 -756.2763 -118.7268 + -1235.987 -213.3318 -216.4862 + -317.6108 -54.81976 -55.63033 + 22505.44 -40752.88 27482.94 diff --git a/codenet/public_test_cases/p00796/input.1.txt b/codenet/public_test_cases/p00796/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4090178339ab277fbad5de0a00599733a85c7332 --- /dev/null +++ b/codenet/public_test_cases/p00796/input.1.txt @@ -0,0 +1,15 @@ +2 +50.36493 81.61338 79.96592 +5 +-10293.83 -4800.033 -5296.238 +14936.30 6964.826 7684.818 +-4516.069 25748.41 -27016.06 +18301.59 -11946.25 5380.309 +27115.20 43415.93 -71607.81 +11.51547 13.35555 14.57307 +5 +-56292.27 2583.892 67754.62 +-567.5082 -756.2763 -118.7268 +-1235.987 -213.3318 -216.4862 +-317.6108 -54.81976 -55.63033 +22505.44 -40752.88 27482.94 diff --git a/codenet/public_test_cases/p00796/input.2.txt b/codenet/public_test_cases/p00796/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69190861e47a234f77a3a72c92bf8b0e8fc8bee --- /dev/null +++ b/codenet/public_test_cases/p00796/input.2.txt @@ -0,0 +1,15 @@ +2 + 50.36493 81.61338 79.96592 +5 + -10293.83 -4800.033 -5296.238 + 14936.30 6964.826 7684.818 + -4516.069 25748.41 -27016.06 + 18301.59 -11946.25 5380.309 + 27115.20 43415.93 -71607.81 + 11.51547 13.35555 14.57307 +5 + -56292.27 2583.892 67754.62 + -567.5082 -756.2763 -118.7268 + -1235.987 -213.3318 -216.4862 + -317.6108 -54.81976 -55.63033 + 22505.44 -40752.88 27482.94 diff --git a/codenet/public_test_cases/p00796/output.0.txt b/codenet/public_test_cases/p00796/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5211ea520df70b2389f901424290737499954737 --- /dev/null +++ b/codenet/public_test_cases/p00796/output.0.txt @@ -0,0 +1,2 @@ +1 2 4 +3 4 2 diff --git a/codenet/public_test_cases/p00796/output.1.txt b/codenet/public_test_cases/p00796/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5211ea520df70b2389f901424290737499954737 --- /dev/null +++ b/codenet/public_test_cases/p00796/output.1.txt @@ -0,0 +1,2 @@ +1 2 4 +3 4 2 diff --git a/codenet/public_test_cases/p00796/output.2.txt b/codenet/public_test_cases/p00796/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5211ea520df70b2389f901424290737499954737 --- /dev/null +++ b/codenet/public_test_cases/p00796/output.2.txt @@ -0,0 +1,2 @@ +1 2 4 +3 4 2 diff --git a/codenet/public_test_cases/p00797/input.0.txt b/codenet/public_test_cases/p00797/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90d544e40e7efdcfc07a0360d42ae4f2639745c3 --- /dev/null +++ b/codenet/public_test_cases/p00797/input.0.txt @@ -0,0 +1,17 @@ +6 5 +John + Robert + Frank + Andrew + Nancy + David +Robert is a child of John. +Robert is an ancestor of Andrew. +Robert is a sibling of Nancy. +Nancy is the parent of Frank. +John is a descendant of Andrew. +2 1 +abc + xyz +xyz is a child of abc. +0 0 diff --git a/codenet/public_test_cases/p00797/input.1.txt b/codenet/public_test_cases/p00797/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67cd522ee2e9ceff64c75054d8d7bafa4a6ddd95 --- /dev/null +++ b/codenet/public_test_cases/p00797/input.1.txt @@ -0,0 +1,17 @@ +6 5 +John +Robert +Frank +Andrew +Nancy +David +Robert is a child of John. +Robert is an ancestor of Andrew. +Robert is a sibling of Nancy. +Nancy is the parent of Frank. +John is a descendant of Andrew. +2 1 +abc +xyz +xyz is a child of abc. +0 0 diff --git a/codenet/public_test_cases/p00797/input.2.txt b/codenet/public_test_cases/p00797/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..90d544e40e7efdcfc07a0360d42ae4f2639745c3 --- /dev/null +++ b/codenet/public_test_cases/p00797/input.2.txt @@ -0,0 +1,17 @@ +6 5 +John + Robert + Frank + Andrew + Nancy + David +Robert is a child of John. +Robert is an ancestor of Andrew. +Robert is a sibling of Nancy. +Nancy is the parent of Frank. +John is a descendant of Andrew. +2 1 +abc + xyz +xyz is a child of abc. +0 0 diff --git a/codenet/public_test_cases/p00797/output.0.txt b/codenet/public_test_cases/p00797/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..36512ed31b2f14489e162b5e087e60f239bfba77 --- /dev/null +++ b/codenet/public_test_cases/p00797/output.0.txt @@ -0,0 +1,7 @@ +True +True +True +False +False + +True diff --git a/codenet/public_test_cases/p00797/output.1.txt b/codenet/public_test_cases/p00797/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..36512ed31b2f14489e162b5e087e60f239bfba77 --- /dev/null +++ b/codenet/public_test_cases/p00797/output.1.txt @@ -0,0 +1,7 @@ +True +True +True +False +False + +True diff --git a/codenet/public_test_cases/p00797/output.2.txt b/codenet/public_test_cases/p00797/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..36512ed31b2f14489e162b5e087e60f239bfba77 --- /dev/null +++ b/codenet/public_test_cases/p00797/output.2.txt @@ -0,0 +1,7 @@ +True +True +True +False +False + +True diff --git a/codenet/public_test_cases/p00798/input.0.txt b/codenet/public_test_cases/p00798/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4c3678bb62088e2bc3e49267b0c0d2312c29e20 --- /dev/null +++ b/codenet/public_test_cases/p00798/input.0.txt @@ -0,0 +1,24 @@ +5 5 +0 0 0 0 0 +4 2 0 1 1 +0 1 0 0 0 +1 0 0 0 3 +1 0 0 0 0 +5 3 +4 0 0 0 0 +2 0 0 0 0 +0 0 0 0 3 +7 5 +1 1 4 1 0 0 0 +1 1 2 1 0 0 0 +3 0 0 0 0 0 0 +0 1 0 1 0 0 0 +0 0 0 1 0 0 0 +6 6 +0 0 0 0 0 3 +0 0 0 0 0 0 +0 0 0 0 0 0 +0 0 0 0 0 0 +0 2 0 0 0 0 +4 0 0 0 0 0 +0 0 diff --git a/codenet/public_test_cases/p00798/input.1.txt b/codenet/public_test_cases/p00798/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4c3678bb62088e2bc3e49267b0c0d2312c29e20 --- /dev/null +++ b/codenet/public_test_cases/p00798/input.1.txt @@ -0,0 +1,24 @@ +5 5 +0 0 0 0 0 +4 2 0 1 1 +0 1 0 0 0 +1 0 0 0 3 +1 0 0 0 0 +5 3 +4 0 0 0 0 +2 0 0 0 0 +0 0 0 0 3 +7 5 +1 1 4 1 0 0 0 +1 1 2 1 0 0 0 +3 0 0 0 0 0 0 +0 1 0 1 0 0 0 +0 0 0 1 0 0 0 +6 6 +0 0 0 0 0 3 +0 0 0 0 0 0 +0 0 0 0 0 0 +0 0 0 0 0 0 +0 2 0 0 0 0 +4 0 0 0 0 0 +0 0 diff --git a/codenet/public_test_cases/p00798/output.0.txt b/codenet/public_test_cases/p00798/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..42a11b8d7572a02ca9ee5cbbdfcfd1ddf1bab170 --- /dev/null +++ b/codenet/public_test_cases/p00798/output.0.txt @@ -0,0 +1,4 @@ +5 +-1 +11 +8 diff --git a/codenet/public_test_cases/p00798/output.1.txt b/codenet/public_test_cases/p00798/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..42a11b8d7572a02ca9ee5cbbdfcfd1ddf1bab170 --- /dev/null +++ b/codenet/public_test_cases/p00798/output.1.txt @@ -0,0 +1,4 @@ +5 +-1 +11 +8 diff --git a/codenet/public_test_cases/p00799/input.0.txt b/codenet/public_test_cases/p00799/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc5e026b3c0472b2545936179689108b2a773aa1 --- /dev/null +++ b/codenet/public_test_cases/p00799/input.0.txt @@ -0,0 +1,18 @@ +3 25 +3 1 2 1 4 1 0 +1 1 0 +2 1 3 2 0 + +4 1000 +80 20 80 20 80 20 80 20 0 +80 +20 +0 +80 20 90 +10 80 +20 +0 +90 10 +0 + +0 0 diff --git a/codenet/public_test_cases/p00799/input.1.txt b/codenet/public_test_cases/p00799/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc5e026b3c0472b2545936179689108b2a773aa1 --- /dev/null +++ b/codenet/public_test_cases/p00799/input.1.txt @@ -0,0 +1,18 @@ +3 25 +3 1 2 1 4 1 0 +1 1 0 +2 1 3 2 0 + +4 1000 +80 20 80 20 80 20 80 20 0 +80 +20 +0 +80 20 90 +10 80 +20 +0 +90 10 +0 + +0 0 diff --git a/codenet/public_test_cases/p00799/output.0.txt b/codenet/public_test_cases/p00799/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6c1b081dcc55115636f097ee34a5a3669363208 --- /dev/null +++ b/codenet/public_test_cases/p00799/output.0.txt @@ -0,0 +1,2 @@ +10 +110 diff --git a/codenet/public_test_cases/p00799/output.1.txt b/codenet/public_test_cases/p00799/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6c1b081dcc55115636f097ee34a5a3669363208 --- /dev/null +++ b/codenet/public_test_cases/p00799/output.1.txt @@ -0,0 +1,2 @@ +10 +110 diff --git a/codenet/public_test_cases/p00800/input.0.txt b/codenet/public_test_cases/p00800/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d12ab6bf69432146c5aa95cea6b43b68185ded1b --- /dev/null +++ b/codenet/public_test_cases/p00800/input.0.txt @@ -0,0 +1,4 @@ +3 +12BC3BC4BNBBDD5 +aaaBCNBBBCb +aaaBBCbNBC diff --git a/codenet/public_test_cases/p00800/input.1.txt b/codenet/public_test_cases/p00800/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d12ab6bf69432146c5aa95cea6b43b68185ded1b --- /dev/null +++ b/codenet/public_test_cases/p00800/input.1.txt @@ -0,0 +1,4 @@ +3 +12BC3BC4BNBBDD5 +aaaBCNBBBCb +aaaBBCbNBC diff --git a/codenet/public_test_cases/p00800/output.0.txt b/codenet/public_test_cases/p00800/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98081b5e7082421e71f368f6b370b30f735ee407 --- /dev/null +++ b/codenet/public_test_cases/p00800/output.0.txt @@ -0,0 +1,3 @@ +15234 +aba +ERROR diff --git a/codenet/public_test_cases/p00800/output.1.txt b/codenet/public_test_cases/p00800/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98081b5e7082421e71f368f6b370b30f735ee407 --- /dev/null +++ b/codenet/public_test_cases/p00800/output.1.txt @@ -0,0 +1,3 @@ +15234 +aba +ERROR diff --git a/codenet/public_test_cases/p00801/input.0.txt b/codenet/public_test_cases/p00801/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd8526bec5d16bd6721cf074dbda681c7f5e51b5 --- /dev/null +++ b/codenet/public_test_cases/p00801/input.0.txt @@ -0,0 +1,10 @@ +3 +5 +7 +15 +655 +2711 +6395 +7195 +8465 +0 diff --git a/codenet/public_test_cases/p00801/input.1.txt b/codenet/public_test_cases/p00801/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd8526bec5d16bd6721cf074dbda681c7f5e51b5 --- /dev/null +++ b/codenet/public_test_cases/p00801/input.1.txt @@ -0,0 +1,10 @@ +3 +5 +7 +15 +655 +2711 +6395 +7195 +8465 +0 diff --git a/codenet/public_test_cases/p00801/output.0.txt b/codenet/public_test_cases/p00801/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a79a88017e51e70f20d4c2c777743bd5e699273c --- /dev/null +++ b/codenet/public_test_cases/p00801/output.0.txt @@ -0,0 +1,9 @@ +2 3 +1 1 +9 11 +105 65 +398 332 +415 332 +430 332 +428 332 +190 421 diff --git a/codenet/public_test_cases/p00801/output.1.txt b/codenet/public_test_cases/p00801/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a79a88017e51e70f20d4c2c777743bd5e699273c --- /dev/null +++ b/codenet/public_test_cases/p00801/output.1.txt @@ -0,0 +1,9 @@ +2 3 +1 1 +9 11 +105 65 +398 332 +415 332 +430 332 +428 332 +190 421 diff --git a/codenet/public_test_cases/p00802/input.0.txt b/codenet/public_test_cases/p00802/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c4cfe89c325cf51617d7e60b7ecf59b9badc8a6 --- /dev/null +++ b/codenet/public_test_cases/p00802/input.0.txt @@ -0,0 +1,14 @@ +4 3 +0.0 0.25 0.5 0.666666666666666666667 +4 4 +0.0 0.25 0.5 0.75 +30 15 +0.00 0.03 0.06 0.09 0.12 0.15 0.18 0.21 0.24 0.27 +0.30 0.33 0.36 0.39 0.42 0.45 0.48 0.51 0.54 0.57 +0.61 0.64 0.66 0.69 0.72 0.75 0.78 0.81 0.84 0.87 +40 20 +0.351 0.353 0.355 0.357 0.359 0.361 0.363 0.365 0.367 0.369 +0.371 0.373 0.375 0.377 0.379 0.381 0.383 0.385 0.387 0.389 +0.611 0.613 0.615 0.617 0.619 0.621 0.623 0.625 0.627 0.629 +0.631 0.633 0.635 0.637 0.639 0.641 0.643 0.645 0.647 0.649 +0 0 diff --git a/codenet/public_test_cases/p00802/input.1.txt b/codenet/public_test_cases/p00802/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c4cfe89c325cf51617d7e60b7ecf59b9badc8a6 --- /dev/null +++ b/codenet/public_test_cases/p00802/input.1.txt @@ -0,0 +1,14 @@ +4 3 +0.0 0.25 0.5 0.666666666666666666667 +4 4 +0.0 0.25 0.5 0.75 +30 15 +0.00 0.03 0.06 0.09 0.12 0.15 0.18 0.21 0.24 0.27 +0.30 0.33 0.36 0.39 0.42 0.45 0.48 0.51 0.54 0.57 +0.61 0.64 0.66 0.69 0.72 0.75 0.78 0.81 0.84 0.87 +40 20 +0.351 0.353 0.355 0.357 0.359 0.361 0.363 0.365 0.367 0.369 +0.371 0.373 0.375 0.377 0.379 0.381 0.383 0.385 0.387 0.389 +0.611 0.613 0.615 0.617 0.619 0.621 0.623 0.625 0.627 0.629 +0.631 0.633 0.635 0.637 0.639 0.641 0.643 0.645 0.647 0.649 +0 0 diff --git a/codenet/public_test_cases/p00802/output.0.txt b/codenet/public_test_cases/p00802/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee52433097e92b852b9b62526070cb23eccef470 --- /dev/null +++ b/codenet/public_test_cases/p00802/output.0.txt @@ -0,0 +1,4 @@ +1.183013 +2.000000 +3.026998 +0.253581 diff --git a/codenet/public_test_cases/p00802/output.1.txt b/codenet/public_test_cases/p00802/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee52433097e92b852b9b62526070cb23eccef470 --- /dev/null +++ b/codenet/public_test_cases/p00802/output.1.txt @@ -0,0 +1,4 @@ +1.183013 +2.000000 +3.026998 +0.253581 diff --git a/codenet/public_test_cases/p00803/input.0.txt b/codenet/public_test_cases/p00803/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50578c93d06c070a956e4f1e86f0ff29294477ea --- /dev/null +++ b/codenet/public_test_cases/p00803/input.0.txt @@ -0,0 +1,6 @@ +100 +64 +50 +20 +151200 +0 diff --git a/codenet/public_test_cases/p00803/input.1.txt b/codenet/public_test_cases/p00803/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..50578c93d06c070a956e4f1e86f0ff29294477ea --- /dev/null +++ b/codenet/public_test_cases/p00803/input.1.txt @@ -0,0 +1,6 @@ +100 +64 +50 +20 +151200 +0 diff --git a/codenet/public_test_cases/p00803/output.0.txt b/codenet/public_test_cases/p00803/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c70f13e7638e65fe78fffb6edeb946f19af306b --- /dev/null +++ b/codenet/public_test_cases/p00803/output.0.txt @@ -0,0 +1,5 @@ +99 +64 +47 +20 +151200 diff --git a/codenet/public_test_cases/p00803/output.1.txt b/codenet/public_test_cases/p00803/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c70f13e7638e65fe78fffb6edeb946f19af306b --- /dev/null +++ b/codenet/public_test_cases/p00803/output.1.txt @@ -0,0 +1,5 @@ +99 +64 +47 +20 +151200 diff --git a/codenet/public_test_cases/p00804/input.0.txt b/codenet/public_test_cases/p00804/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..601166e5fea854490c3959401df758bdfb6fce6e --- /dev/null +++ b/codenet/public_test_cases/p00804/input.0.txt @@ -0,0 +1,24 @@ +3 +PERLIS SELL A 300 +WILKES BUY A 200 +HAMMING SELL A 100 +4 +BACKUS SELL A 10 +FLOYD BUY A 20 +IVERSON SELL B 30 +BACKUS BUY B 40 +7 +WILKINSON SELL A 500 +MCCARTHY BUY C 300 +WILKINSON SELL C 200 +DIJKSTRA SELL B 100 +BACHMAN BUY A 400 +DIJKSTRA BUY A 600 +WILKINSON SELL A 300 +2 +ABCD SELL X 10 +ABC BUY X 15 +2 +A SELL M 100 +A BUY M 100 +0 diff --git a/codenet/public_test_cases/p00804/input.1.txt b/codenet/public_test_cases/p00804/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..601166e5fea854490c3959401df758bdfb6fce6e --- /dev/null +++ b/codenet/public_test_cases/p00804/input.1.txt @@ -0,0 +1,24 @@ +3 +PERLIS SELL A 300 +WILKES BUY A 200 +HAMMING SELL A 100 +4 +BACKUS SELL A 10 +FLOYD BUY A 20 +IVERSON SELL B 30 +BACKUS BUY B 40 +7 +WILKINSON SELL A 500 +MCCARTHY BUY C 300 +WILKINSON SELL C 200 +DIJKSTRA SELL B 100 +BACHMAN BUY A 400 +DIJKSTRA BUY A 600 +WILKINSON SELL A 300 +2 +ABCD SELL X 10 +ABC BUY X 15 +2 +A SELL M 100 +A BUY M 100 +0 diff --git a/codenet/public_test_cases/p00804/output.0.txt b/codenet/public_test_cases/p00804/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f467c2a0436837312b198aaf33ac3b65e46c7319 --- /dev/null +++ b/codenet/public_test_cases/p00804/output.0.txt @@ -0,0 +1,29 @@ +A 150 150 150 +-- +HAMMING 0 150 +PERLIS 0 0 +WILKES 150 0 +---------- +A 15 15 15 +B 35 35 35 +-- +BACKUS 35 15 +FLOYD 15 0 +IVERSON 0 35 +---------- +A 350 450 550 +C 250 250 250 +-- +BACHMAN 350 0 +DIJKSTRA 550 0 +MCCARTHY 250 0 +WILKINSON 0 1150 +---------- +X 12 12 12 +-- +ABC 12 0 +ABCD 0 12 +---------- +-- +A 0 0 +---------- diff --git a/codenet/public_test_cases/p00804/output.1.txt b/codenet/public_test_cases/p00804/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f467c2a0436837312b198aaf33ac3b65e46c7319 --- /dev/null +++ b/codenet/public_test_cases/p00804/output.1.txt @@ -0,0 +1,29 @@ +A 150 150 150 +-- +HAMMING 0 150 +PERLIS 0 0 +WILKES 150 0 +---------- +A 15 15 15 +B 35 35 35 +-- +BACKUS 35 15 +FLOYD 15 0 +IVERSON 0 35 +---------- +A 350 450 550 +C 250 250 250 +-- +BACHMAN 350 0 +DIJKSTRA 550 0 +MCCARTHY 250 0 +WILKINSON 0 1150 +---------- +X 12 12 12 +-- +ABC 12 0 +ABCD 0 12 +---------- +-- +A 0 0 +---------- diff --git a/codenet/public_test_cases/p00805/input.0.txt b/codenet/public_test_cases/p00805/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7599d29bdfb50dc63e4274ae0562b0595070aa2a --- /dev/null +++ b/codenet/public_test_cases/p00805/input.0.txt @@ -0,0 +1,26 @@ +2 +0.2000000 0.6000000 +0.3000000 0.8000000 +0.3000000 0.5000000 +0.5000000 0.6000000 +2 +0.3333330 0.6666670 +0.3333330 0.6666670 +0.3333330 0.6666670 +0.3333330 0.6666670 +4 +0.2000000 0.4000000 0.6000000 0.8000000 +0.1000000 0.5000000 0.6000000 0.9000000 +0.2000000 0.4000000 0.6000000 0.8000000 +0.1000000 0.5000000 0.6000000 0.9000000 +2 +0.5138701 0.9476283 +0.1717362 0.1757412 +0.3086521 0.7022313 +0.2264312 0.5345343 +1 +0.4000000 +0.6000000 +0.3000000 +0.5000000 +0 diff --git a/codenet/public_test_cases/p00805/input.1.txt b/codenet/public_test_cases/p00805/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7599d29bdfb50dc63e4274ae0562b0595070aa2a --- /dev/null +++ b/codenet/public_test_cases/p00805/input.1.txt @@ -0,0 +1,26 @@ +2 +0.2000000 0.6000000 +0.3000000 0.8000000 +0.3000000 0.5000000 +0.5000000 0.6000000 +2 +0.3333330 0.6666670 +0.3333330 0.6666670 +0.3333330 0.6666670 +0.3333330 0.6666670 +4 +0.2000000 0.4000000 0.6000000 0.8000000 +0.1000000 0.5000000 0.6000000 0.9000000 +0.2000000 0.4000000 0.6000000 0.8000000 +0.1000000 0.5000000 0.6000000 0.9000000 +2 +0.5138701 0.9476283 +0.1717362 0.1757412 +0.3086521 0.7022313 +0.2264312 0.5345343 +1 +0.4000000 +0.6000000 +0.3000000 +0.5000000 +0 diff --git a/codenet/public_test_cases/p00805/output.0.txt b/codenet/public_test_cases/p00805/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..039252cb58e16f6148fb7ddfd06c94efcc29bf40 --- /dev/null +++ b/codenet/public_test_cases/p00805/output.0.txt @@ -0,0 +1,5 @@ +0.215657 +0.111112 +0.078923 +0.279223 +0.348958 diff --git a/codenet/public_test_cases/p00805/output.1.txt b/codenet/public_test_cases/p00805/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..039252cb58e16f6148fb7ddfd06c94efcc29bf40 --- /dev/null +++ b/codenet/public_test_cases/p00805/output.1.txt @@ -0,0 +1,5 @@ +0.215657 +0.111112 +0.078923 +0.279223 +0.348958 diff --git a/codenet/public_test_cases/p00806/input.0.txt b/codenet/public_test_cases/p00806/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..400cbf269a93602d7e70b2bf4b4f00a6214f1495 --- /dev/null +++ b/codenet/public_test_cases/p00806/input.0.txt @@ -0,0 +1,19 @@ +5 +push +press +the +button +bottom +77377843288866 +4 +i +am +going +go +42646464 +3 +a +b +c +333 +0 diff --git a/codenet/public_test_cases/p00806/input.1.txt b/codenet/public_test_cases/p00806/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..400cbf269a93602d7e70b2bf4b4f00a6214f1495 --- /dev/null +++ b/codenet/public_test_cases/p00806/input.1.txt @@ -0,0 +1,19 @@ +5 +push +press +the +button +bottom +77377843288866 +4 +i +am +going +go +42646464 +3 +a +b +c +333 +0 diff --git a/codenet/public_test_cases/p00806/output.0.txt b/codenet/public_test_cases/p00806/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae9133cef17e7e9a665c9301e5cd74c932c1ffb8 --- /dev/null +++ b/codenet/public_test_cases/p00806/output.0.txt @@ -0,0 +1,6 @@ +press the button. +-- +i am going. +i am go go i. +-- +-- diff --git a/codenet/public_test_cases/p00806/output.1.txt b/codenet/public_test_cases/p00806/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae9133cef17e7e9a665c9301e5cd74c932c1ffb8 --- /dev/null +++ b/codenet/public_test_cases/p00806/output.1.txt @@ -0,0 +1,6 @@ +press the button. +-- +i am going. +i am go go i. +-- +-- diff --git a/codenet/public_test_cases/p00807/input.0.txt b/codenet/public_test_cases/p00807/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50d3ade25aa174958bcc785935dcd17fe78e6809 --- /dev/null +++ b/codenet/public_test_cases/p00807/input.0.txt @@ -0,0 +1,16 @@ +5 +faafd +bcbdb +- +bcbdb +bccac +- +faafd +aafdd +- +aaafddd +aaaeff +- +aaedd +aafdd +- diff --git a/codenet/public_test_cases/p00807/input.1.txt b/codenet/public_test_cases/p00807/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..50d3ade25aa174958bcc785935dcd17fe78e6809 --- /dev/null +++ b/codenet/public_test_cases/p00807/input.1.txt @@ -0,0 +1,16 @@ +5 +faafd +bcbdb +- +bcbdb +bccac +- +faafd +aafdd +- +aaafddd +aaaeff +- +aaedd +aafdd +- diff --git a/codenet/public_test_cases/p00807/output.0.txt b/codenet/public_test_cases/p00807/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cfc907bd140a44da2be558b59f8f7d62189aa3a --- /dev/null +++ b/codenet/public_test_cases/p00807/output.0.txt @@ -0,0 +1,5 @@ +true +true +false +false +false diff --git a/codenet/public_test_cases/p00807/output.1.txt b/codenet/public_test_cases/p00807/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cfc907bd140a44da2be558b59f8f7d62189aa3a --- /dev/null +++ b/codenet/public_test_cases/p00807/output.1.txt @@ -0,0 +1,5 @@ +true +true +false +false +false diff --git a/codenet/public_test_cases/p00808/input.0.txt b/codenet/public_test_cases/p00808/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e92e88a1a1c4803fc3bd3f89a7356e662c8a03b --- /dev/null +++ b/codenet/public_test_cases/p00808/input.0.txt @@ -0,0 +1,31 @@ +5 +Hakodate 08:15 Morioka 12:30 2500 +Morioka 14:05 Hakodate 17:30 2500 +Morioka 15:30 Hakodate 18:00 3000 +Morioka 14:30 Tokyo 17:50 3000 +Tokyo 08:30 Morioka 13:35 3000 +4 +Hakodate 08:15 Morioka 12:30 2500 +Morioka 14:04 Hakodate 17:30 2500 +Morioka 14:30 Tokyo 17:50 3000 +Tokyo 08:30 Morioka 13:35 3000 +18 +Hakodate 09:55 Akita 10:53 3840 +Hakodate 14:14 Akita 16:09 1920 +Hakodate 18:36 Akita 19:33 3840 +Hakodate 08:00 Morioka 08:53 3550 +Hakodate 22:40 Morioka 23:34 3550 +Akita 14:23 Tokyo 14:53 2010 +Akita 20:36 Tokyo 21:06 2010 +Akita 08:20 Hakodate 09:18 3840 +Akita 13:56 Hakodate 14:54 3840 +Akita 21:37 Hakodate 22:35 3840 +Morioka 09:51 Tokyo 10:31 2660 +Morioka 14:49 Tokyo 15:29 2660 +Morioka 19:42 Tokyo 20:22 2660 +Morioka 15:11 Hakodate 16:04 3550 +Morioka 23:03 Hakodate 23:56 3550 +Tokyo 09:44 Morioka 11:04 1330 +Tokyo 21:54 Morioka 22:34 2660 +Tokyo 11:34 Akita 12:04 2010 +0 diff --git a/codenet/public_test_cases/p00808/input.1.txt b/codenet/public_test_cases/p00808/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e92e88a1a1c4803fc3bd3f89a7356e662c8a03b --- /dev/null +++ b/codenet/public_test_cases/p00808/input.1.txt @@ -0,0 +1,31 @@ +5 +Hakodate 08:15 Morioka 12:30 2500 +Morioka 14:05 Hakodate 17:30 2500 +Morioka 15:30 Hakodate 18:00 3000 +Morioka 14:30 Tokyo 17:50 3000 +Tokyo 08:30 Morioka 13:35 3000 +4 +Hakodate 08:15 Morioka 12:30 2500 +Morioka 14:04 Hakodate 17:30 2500 +Morioka 14:30 Tokyo 17:50 3000 +Tokyo 08:30 Morioka 13:35 3000 +18 +Hakodate 09:55 Akita 10:53 3840 +Hakodate 14:14 Akita 16:09 1920 +Hakodate 18:36 Akita 19:33 3840 +Hakodate 08:00 Morioka 08:53 3550 +Hakodate 22:40 Morioka 23:34 3550 +Akita 14:23 Tokyo 14:53 2010 +Akita 20:36 Tokyo 21:06 2010 +Akita 08:20 Hakodate 09:18 3840 +Akita 13:56 Hakodate 14:54 3840 +Akita 21:37 Hakodate 22:35 3840 +Morioka 09:51 Tokyo 10:31 2660 +Morioka 14:49 Tokyo 15:29 2660 +Morioka 19:42 Tokyo 20:22 2660 +Morioka 15:11 Hakodate 16:04 3550 +Morioka 23:03 Hakodate 23:56 3550 +Tokyo 09:44 Morioka 11:04 1330 +Tokyo 21:54 Morioka 22:34 2660 +Tokyo 11:34 Akita 12:04 2010 +0 diff --git a/codenet/public_test_cases/p00808/output.0.txt b/codenet/public_test_cases/p00808/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a5dbacac6b96792645dc587ec2883830d8de684 --- /dev/null +++ b/codenet/public_test_cases/p00808/output.0.txt @@ -0,0 +1,3 @@ +11000 +0 +11090 diff --git a/codenet/public_test_cases/p00808/output.1.txt b/codenet/public_test_cases/p00808/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a5dbacac6b96792645dc587ec2883830d8de684 --- /dev/null +++ b/codenet/public_test_cases/p00808/output.1.txt @@ -0,0 +1,3 @@ +11000 +0 +11090 diff --git a/codenet/public_test_cases/p00809/input.0.txt b/codenet/public_test_cases/p00809/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a582f444cd9b5e6ef7cd8dd4d9b45c0f24928f4 --- /dev/null +++ b/codenet/public_test_cases/p00809/input.0.txt @@ -0,0 +1,4 @@ +1 101 4 4 +1 100 4 4 +3 97 8 7 6 5 4 3 +0 diff --git a/codenet/public_test_cases/p00809/input.1.txt b/codenet/public_test_cases/p00809/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a582f444cd9b5e6ef7cd8dd4d9b45c0f24928f4 --- /dev/null +++ b/codenet/public_test_cases/p00809/input.1.txt @@ -0,0 +1,4 @@ +1 101 4 4 +1 100 4 4 +3 97 8 7 6 5 4 3 +0 diff --git a/codenet/public_test_cases/p00809/output.0.txt b/codenet/public_test_cases/p00809/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..986394f7c0fa05e52a94a3d93dee7085ed84cca4 --- /dev/null +++ b/codenet/public_test_cases/p00809/output.0.txt @@ -0,0 +1,3 @@ +0 +1 +1 diff --git a/codenet/public_test_cases/p00809/output.1.txt b/codenet/public_test_cases/p00809/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..986394f7c0fa05e52a94a3d93dee7085ed84cca4 --- /dev/null +++ b/codenet/public_test_cases/p00809/output.1.txt @@ -0,0 +1,3 @@ +0 +1 +1 diff --git a/codenet/public_test_cases/p00810/input.0.txt b/codenet/public_test_cases/p00810/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a14412b9fac2e9c41d65cf876b2b7bebe98b10ff --- /dev/null +++ b/codenet/public_test_cases/p00810/input.0.txt @@ -0,0 +1,11 @@ +4 +10.00000 10.00000 10.00000 +20.00000 10.00000 10.00000 +20.00000 20.00000 10.00000 +10.00000 20.00000 10.00000 +4 +10.00000 10.00000 10.00000 +10.00000 50.00000 50.00000 +50.00000 10.00000 50.00000 +50.00000 50.00000 10.00000 +0 diff --git a/codenet/public_test_cases/p00810/input.1.txt b/codenet/public_test_cases/p00810/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a14412b9fac2e9c41d65cf876b2b7bebe98b10ff --- /dev/null +++ b/codenet/public_test_cases/p00810/input.1.txt @@ -0,0 +1,11 @@ +4 +10.00000 10.00000 10.00000 +20.00000 10.00000 10.00000 +20.00000 20.00000 10.00000 +10.00000 20.00000 10.00000 +4 +10.00000 10.00000 10.00000 +10.00000 50.00000 50.00000 +50.00000 10.00000 50.00000 +50.00000 50.00000 10.00000 +0 diff --git a/codenet/public_test_cases/p00810/output.0.txt b/codenet/public_test_cases/p00810/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88dccd7b47e9937a3047cbe797983700eae02c70 --- /dev/null +++ b/codenet/public_test_cases/p00810/output.0.txt @@ -0,0 +1,2 @@ +7.07107 +34.64102 diff --git a/codenet/public_test_cases/p00810/output.1.txt b/codenet/public_test_cases/p00810/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..88dccd7b47e9937a3047cbe797983700eae02c70 --- /dev/null +++ b/codenet/public_test_cases/p00810/output.1.txt @@ -0,0 +1,2 @@ +7.07107 +34.64102 diff --git a/codenet/public_test_cases/p00811/input.0.txt b/codenet/public_test_cases/p00811/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..922b089cbddfe60fbd1a3d68fce87181d8c7ed9e --- /dev/null +++ b/codenet/public_test_cases/p00811/input.0.txt @@ -0,0 +1,6 @@ +5 1 2 +99999 999 999 +1680 5 16 +1970 1 1 +2002 4 11 +0 0 0 diff --git a/codenet/public_test_cases/p00811/input.1.txt b/codenet/public_test_cases/p00811/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..922b089cbddfe60fbd1a3d68fce87181d8c7ed9e --- /dev/null +++ b/codenet/public_test_cases/p00811/input.1.txt @@ -0,0 +1,6 @@ +5 1 2 +99999 999 999 +1680 5 16 +1970 1 1 +2002 4 11 +0 0 0 diff --git a/codenet/public_test_cases/p00811/output.0.txt b/codenet/public_test_cases/p00811/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e193025d151a419dba3e77efb141eb20cd391e9e --- /dev/null +++ b/codenet/public_test_cases/p00811/output.0.txt @@ -0,0 +1,5 @@ +2 2 +313 313 +23 73 +43 43 +37 53 diff --git a/codenet/public_test_cases/p00811/output.1.txt b/codenet/public_test_cases/p00811/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e193025d151a419dba3e77efb141eb20cd391e9e --- /dev/null +++ b/codenet/public_test_cases/p00811/output.1.txt @@ -0,0 +1,5 @@ +2 2 +313 313 +23 73 +43 43 +37 53 diff --git a/codenet/public_test_cases/p00812/input.0.txt b/codenet/public_test_cases/p00812/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe96c21aae83832fe685a1e2cbb477e2a03b269c --- /dev/null +++ b/codenet/public_test_cases/p00812/input.0.txt @@ -0,0 +1,13 @@ +a+b+c +(a+b)+c +a- (b-c)+2 +. +4ab +(a - b) (0-b+a) - 1a ^ 2 - b ^ 2 +2 b 2 a +. +108 a +2 2 3 3 3 a +4 a^1 27 +. +. diff --git a/codenet/public_test_cases/p00812/input.1.txt b/codenet/public_test_cases/p00812/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe96c21aae83832fe685a1e2cbb477e2a03b269c --- /dev/null +++ b/codenet/public_test_cases/p00812/input.1.txt @@ -0,0 +1,13 @@ +a+b+c +(a+b)+c +a- (b-c)+2 +. +4ab +(a - b) (0-b+a) - 1a ^ 2 - b ^ 2 +2 b 2 a +. +108 a +2 2 3 3 3 a +4 a^1 27 +. +. diff --git a/codenet/public_test_cases/p00812/output.0.txt b/codenet/public_test_cases/p00812/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f97215043f66b03e999b1dd4d295fa503653b8d5 --- /dev/null +++ b/codenet/public_test_cases/p00812/output.0.txt @@ -0,0 +1,9 @@ +yes +no +. +no +yes +. +yes +yes +. diff --git a/codenet/public_test_cases/p00812/output.1.txt b/codenet/public_test_cases/p00812/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f97215043f66b03e999b1dd4d295fa503653b8d5 --- /dev/null +++ b/codenet/public_test_cases/p00812/output.1.txt @@ -0,0 +1,9 @@ +yes +no +. +no +yes +. +yes +yes +. diff --git a/codenet/public_test_cases/p00813/input.0.txt b/codenet/public_test_cases/p00813/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a08725b6f44b6352adf1ef613990ae1501a5d366 --- /dev/null +++ b/codenet/public_test_cases/p00813/input.0.txt @@ -0,0 +1,26 @@ +5 +_____*AAA__BBB__CCC__DDD +*AAA_______0-0__0-0___-_ +_BBB_____________-___0-0 +_CCC_________________0-0 +_DDD____________________ +______CHN__CRC__TUR_*BRA +_CHN_______0-2___-___0-4 +_CRC____________1-1___-_ +_TUR_________________1-2 +*BRA____________________ +______CMR_*KSA__GER__IRL +_CMR_______1-0___-___1-1 +*KSA____________0-8___-_ +_GER_________________1-1 +_IRL____________________ +______TUN__JPN_*BEL__RUS +_TUN________-___1-1__0-2 +_JPN____________2-2__1-0 +*BEL__________________-_ +_RUS____________________ +______MEX__CRO_*ECU__ITA +_MEX_______1-0__2-1___-_ +_CRO_____________-___2-1 +*ECU_________________0-2 +_ITA____________________ diff --git a/codenet/public_test_cases/p00813/input.1.txt b/codenet/public_test_cases/p00813/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a08725b6f44b6352adf1ef613990ae1501a5d366 --- /dev/null +++ b/codenet/public_test_cases/p00813/input.1.txt @@ -0,0 +1,26 @@ +5 +_____*AAA__BBB__CCC__DDD +*AAA_______0-0__0-0___-_ +_BBB_____________-___0-0 +_CCC_________________0-0 +_DDD____________________ +______CHN__CRC__TUR_*BRA +_CHN_______0-2___-___0-4 +_CRC____________1-1___-_ +_TUR_________________1-2 +*BRA____________________ +______CMR_*KSA__GER__IRL +_CMR_______1-0___-___1-1 +*KSA____________0-8___-_ +_GER_________________1-1 +_IRL____________________ +______TUN__JPN_*BEL__RUS +_TUN________-___1-1__0-2 +_JPN____________2-2__1-0 +*BEL__________________-_ +_RUS____________________ +______MEX__CRO_*ECU__ITA +_MEX_______1-0__2-1___-_ +_CRO_____________-___2-1 +*ECU_________________0-2 +_ITA____________________ diff --git a/codenet/public_test_cases/p00813/output.0.txt b/codenet/public_test_cases/p00813/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0210357bdb4985aca0831e9f52611a3d3c4c595c --- /dev/null +++ b/codenet/public_test_cases/p00813/output.0.txt @@ -0,0 +1,5 @@ +0.5000000 +1.0000000 +0.0000000 +0.3852746 +0.0353304 diff --git a/codenet/public_test_cases/p00813/output.1.txt b/codenet/public_test_cases/p00813/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0210357bdb4985aca0831e9f52611a3d3c4c595c --- /dev/null +++ b/codenet/public_test_cases/p00813/output.1.txt @@ -0,0 +1,5 @@ +0.5000000 +1.0000000 +0.0000000 +0.3852746 +0.0353304 diff --git a/codenet/public_test_cases/p00814/input.0.txt b/codenet/public_test_cases/p00814/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f2056b1ce57e9718a4446cbd782bae1d7a46661 --- /dev/null +++ b/codenet/public_test_cases/p00814/input.0.txt @@ -0,0 +1,65 @@ +4 4 + 2 + 2 3 + 1 0 4 +1 1 4 0 +4 5 + 2 + 2 3 + 3 0 4 +1 1 4 0 +4 1 + 2 + 2 3 + 3 0 4 +1 1 4 0 +4 1 + 1 + 1 1 + 1 1 1 +1 1 1 0 +4 2 + 1 + 1 1 + 1 1 1 +1 1 1 0 +4 1 + 0 + 2 2 + 5 0 7 +0 5 7 0 +4 2 + 0 + 0 3 + 1 0 4 +0 1 0 4 +4 3 + 0 + 3 3 + 3 2 3 +0 3 0 3 +4 2 + 0 + 3 3 + 3 2 3 +0 3 0 3 +6 1 + 1 + 1 2 + 1 1 0 + 6 7 6 8 + 0 7 6 8 2 +6 6 7 2 2 0 +5 9 + 0 + 0 0 + 0 0 0 + 0 0 0 0 +0 0 0 0 0 +5 3 + 3 + 3 2 + 4 3 2 + 4 4 0 3 +3 3 3 0 3 +0 0 diff --git a/codenet/public_test_cases/p00814/input.1.txt b/codenet/public_test_cases/p00814/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f2056b1ce57e9718a4446cbd782bae1d7a46661 --- /dev/null +++ b/codenet/public_test_cases/p00814/input.1.txt @@ -0,0 +1,65 @@ +4 4 + 2 + 2 3 + 1 0 4 +1 1 4 0 +4 5 + 2 + 2 3 + 3 0 4 +1 1 4 0 +4 1 + 2 + 2 3 + 3 0 4 +1 1 4 0 +4 1 + 1 + 1 1 + 1 1 1 +1 1 1 0 +4 2 + 1 + 1 1 + 1 1 1 +1 1 1 0 +4 1 + 0 + 2 2 + 5 0 7 +0 5 7 0 +4 2 + 0 + 0 3 + 1 0 4 +0 1 0 4 +4 3 + 0 + 3 3 + 3 2 3 +0 3 0 3 +4 2 + 0 + 3 3 + 3 2 3 +0 3 0 3 +6 1 + 1 + 1 2 + 1 1 0 + 6 7 6 8 + 0 7 6 8 2 +6 6 7 2 2 0 +5 9 + 0 + 0 0 + 0 0 0 + 0 0 0 0 +0 0 0 0 0 +5 3 + 3 + 3 2 + 4 3 2 + 4 4 0 3 +3 3 3 0 3 +0 0 diff --git a/codenet/public_test_cases/p00814/input.2.txt b/codenet/public_test_cases/p00814/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e9875f6e3ec5846c26c59f6db0ecda0474194d2 --- /dev/null +++ b/codenet/public_test_cases/p00814/input.2.txt @@ -0,0 +1,65 @@ +4 4 +2 +2 3 +1 0 4 +1 1 4 0 +4 5 +2 +2 3 +3 0 4 +1 1 4 0 +4 1 +2 +2 3 +3 0 4 +1 1 4 0 +4 1 +1 +1 1 +1 1 1 +1 1 1 0 +4 2 +1 +1 1 +1 1 1 +1 1 1 0 +4 1 +0 +2 2 +5 0 7 +0 5 7 0 +4 2 +0 +0 3 +1 0 4 +0 1 0 4 +4 3 +0 +3 3 +3 2 3 +0 3 0 3 +4 2 +0 +3 3 +3 2 3 +0 3 0 3 +6 1 +1 +1 2 +1 1 0 +6 7 6 8 +0 7 6 8 2 +6 6 7 2 2 0 +5 9 +0 +0 0 +0 0 0 +0 0 0 0 +0 0 0 0 0 +5 3 +3 +3 2 +4 3 2 +4 4 0 3 +3 3 3 0 3 +0 0 diff --git a/codenet/public_test_cases/p00814/output.0.txt b/codenet/public_test_cases/p00814/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e186ed7c859b5174e0168a794417b54a9e6879ed --- /dev/null +++ b/codenet/public_test_cases/p00814/output.0.txt @@ -0,0 +1,12 @@ +6 +5 +1 +-10 +8 +-1 +0 +1 +-1 +5 +0 +5 diff --git a/codenet/public_test_cases/p00814/output.1.txt b/codenet/public_test_cases/p00814/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e186ed7c859b5174e0168a794417b54a9e6879ed --- /dev/null +++ b/codenet/public_test_cases/p00814/output.1.txt @@ -0,0 +1,12 @@ +6 +5 +1 +-10 +8 +-1 +0 +1 +-1 +5 +0 +5 diff --git a/codenet/public_test_cases/p00814/output.2.txt b/codenet/public_test_cases/p00814/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e186ed7c859b5174e0168a794417b54a9e6879ed --- /dev/null +++ b/codenet/public_test_cases/p00814/output.2.txt @@ -0,0 +1,12 @@ +6 +5 +1 +-10 +8 +-1 +0 +1 +-1 +5 +0 +5 diff --git a/codenet/public_test_cases/p00815/input.0.txt b/codenet/public_test_cases/p00815/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..feecdb8c1c80c91b11530262f0149069d981fef5 --- /dev/null +++ b/codenet/public_test_cases/p00815/input.0.txt @@ -0,0 +1,3 @@ +2 +3 3 3 3 -3 3 2 -5 3 2 -5 -3 0 +3 5 4 -2 4 -3 -2 -2 -1 0 diff --git a/codenet/public_test_cases/p00815/input.1.txt b/codenet/public_test_cases/p00815/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..feecdb8c1c80c91b11530262f0149069d981fef5 --- /dev/null +++ b/codenet/public_test_cases/p00815/input.1.txt @@ -0,0 +1,3 @@ +2 +3 3 3 3 -3 3 2 -5 3 2 -5 -3 0 +3 5 4 -2 4 -3 -2 -2 -1 0 diff --git a/codenet/public_test_cases/p00815/output.0.txt b/codenet/public_test_cases/p00815/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a9eee25906437c29a696b87cbbd2d4497290b95 --- /dev/null +++ b/codenet/public_test_cases/p00815/output.0.txt @@ -0,0 +1,12 @@ +1 2 4 6 +2 1 3 8 +3 2 4 7 +4 1 3 5 +5 4 6 7 +6 1 5 +7 3 5 8 +8 2 7 +1 2 3 4 +2 1 3 3 4 4 +3 1 2 2 4 +4 1 2 2 3 diff --git a/codenet/public_test_cases/p00815/output.1.txt b/codenet/public_test_cases/p00815/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a9eee25906437c29a696b87cbbd2d4497290b95 --- /dev/null +++ b/codenet/public_test_cases/p00815/output.1.txt @@ -0,0 +1,12 @@ +1 2 4 6 +2 1 3 8 +3 2 4 7 +4 1 3 5 +5 4 6 7 +6 1 5 +7 3 5 8 +8 2 7 +1 2 3 4 +2 1 3 3 4 4 +3 1 2 2 4 +4 1 2 2 3 diff --git a/codenet/public_test_cases/p00816/input.0.txt b/codenet/public_test_cases/p00816/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bb8f6a8769765d78eade59f1431d090c7604143 --- /dev/null +++ b/codenet/public_test_cases/p00816/input.0.txt @@ -0,0 +1,10 @@ +50 12346 +376 144139 +927438 927438 +18 3312 +9 3142 +25 1299 +111 33333 +103 862150 +6 1104 +0 0 diff --git a/codenet/public_test_cases/p00816/input.1.txt b/codenet/public_test_cases/p00816/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bb8f6a8769765d78eade59f1431d090c7604143 --- /dev/null +++ b/codenet/public_test_cases/p00816/input.1.txt @@ -0,0 +1,10 @@ +50 12346 +376 144139 +927438 927438 +18 3312 +9 3142 +25 1299 +111 33333 +103 862150 +6 1104 +0 0 diff --git a/codenet/public_test_cases/p00816/output.0.txt b/codenet/public_test_cases/p00816/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..39fcdc5a86212c793c92d5ebbbce0ea937e52dc1 --- /dev/null +++ b/codenet/public_test_cases/p00816/output.0.txt @@ -0,0 +1,9 @@ +43 1 2 34 6 +283 144 139 +927438 927438 +18 3 3 12 +error +21 1 2 9 9 +rejected +103 86 2 15 0 +rejected diff --git a/codenet/public_test_cases/p00816/output.1.txt b/codenet/public_test_cases/p00816/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..39fcdc5a86212c793c92d5ebbbce0ea937e52dc1 --- /dev/null +++ b/codenet/public_test_cases/p00816/output.1.txt @@ -0,0 +1,9 @@ +43 1 2 34 6 +283 144 139 +927438 927438 +18 3 3 12 +error +21 1 2 9 9 +rejected +103 86 2 15 0 +rejected diff --git a/codenet/public_test_cases/p00817/input.0.txt b/codenet/public_test_cases/p00817/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..503f9a218cb7dd7ffeafcc07d6344173b05acf63 --- /dev/null +++ b/codenet/public_test_cases/p00817/input.0.txt @@ -0,0 +1,17 @@ +2 1 1 +1 2 no +2 1 no +3 2 1 +1 1 yes +2 2 yes +3 3 yes +2 2 1 +1 2 yes +2 3 no +5 4 3 +1 2 yes +1 3 no +4 5 yes +5 6 yes +6 7 no +0 0 0 diff --git a/codenet/public_test_cases/p00817/input.1.txt b/codenet/public_test_cases/p00817/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..503f9a218cb7dd7ffeafcc07d6344173b05acf63 --- /dev/null +++ b/codenet/public_test_cases/p00817/input.1.txt @@ -0,0 +1,17 @@ +2 1 1 +1 2 no +2 1 no +3 2 1 +1 1 yes +2 2 yes +3 3 yes +2 2 1 +1 2 yes +2 3 no +5 4 3 +1 2 yes +1 3 no +4 5 yes +5 6 yes +6 7 no +0 0 0 diff --git a/codenet/public_test_cases/p00817/output.0.txt b/codenet/public_test_cases/p00817/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..caa664280c65d27d279a191362d61b384a2e9a42 --- /dev/null +++ b/codenet/public_test_cases/p00817/output.0.txt @@ -0,0 +1,10 @@ +no +no +1 +2 +end +3 +4 +5 +6 +end diff --git a/codenet/public_test_cases/p00817/output.1.txt b/codenet/public_test_cases/p00817/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..caa664280c65d27d279a191362d61b384a2e9a42 --- /dev/null +++ b/codenet/public_test_cases/p00817/output.1.txt @@ -0,0 +1,10 @@ +no +no +1 +2 +end +3 +4 +5 +6 +end diff --git a/codenet/public_test_cases/p00818/input.0.txt b/codenet/public_test_cases/p00818/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..89a902547ecc9fa725d9b54e0913c36344583e1d --- /dev/null +++ b/codenet/public_test_cases/p00818/input.0.txt @@ -0,0 +1,23 @@ +3 +0 0 0.5 +-0.9 0 1.00000000001 +0.9 0 1.00000000001 +5 +0 1 0.5 +1 1 1.00000000001 +0 2 1.00000000001 +-1 1 1.00000000001 +0 -0.00001 1.00000000001 +5 +0 1 0.5 +1 1 1.00000000001 +0 2 1.00000000001 +-1 1 1.00000000001 +0 0 1.00000000001 +2 +0 0 1.0000001 +0 0 1 +2 +0 0 1 +0.00000001 0 1 +0 diff --git a/codenet/public_test_cases/p00818/input.1.txt b/codenet/public_test_cases/p00818/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..89a902547ecc9fa725d9b54e0913c36344583e1d --- /dev/null +++ b/codenet/public_test_cases/p00818/input.1.txt @@ -0,0 +1,23 @@ +3 +0 0 0.5 +-0.9 0 1.00000000001 +0.9 0 1.00000000001 +5 +0 1 0.5 +1 1 1.00000000001 +0 2 1.00000000001 +-1 1 1.00000000001 +0 -0.00001 1.00000000001 +5 +0 1 0.5 +1 1 1.00000000001 +0 2 1.00000000001 +-1 1 1.00000000001 +0 0 1.00000000001 +2 +0 0 1.0000001 +0 0 1 +2 +0 0 1 +0.00000001 0 1 +0 diff --git a/codenet/public_test_cases/p00818/output.0.txt b/codenet/public_test_cases/p00818/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6ca2a729a690657d23e655af064badea63327fb --- /dev/null +++ b/codenet/public_test_cases/p00818/output.0.txt @@ -0,0 +1,5 @@ +3 +5 +4 +2 +2 diff --git a/codenet/public_test_cases/p00818/output.1.txt b/codenet/public_test_cases/p00818/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6ca2a729a690657d23e655af064badea63327fb --- /dev/null +++ b/codenet/public_test_cases/p00818/output.1.txt @@ -0,0 +1,5 @@ +3 +5 +4 +2 +2 diff --git a/codenet/public_test_cases/p00819/input.0.txt b/codenet/public_test_cases/p00819/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ade824270282faca24e11ff32e825e226363180 --- /dev/null +++ b/codenet/public_test_cases/p00819/input.0.txt @@ -0,0 +1,11 @@ +5 +AJMP +aB23d +E +86AE +AM +6 +JPEM +WaEaETC302Q +CP +rTurnAGundam1isdefferentf diff --git a/codenet/public_test_cases/p00819/input.1.txt b/codenet/public_test_cases/p00819/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ade824270282faca24e11ff32e825e226363180 --- /dev/null +++ b/codenet/public_test_cases/p00819/input.1.txt @@ -0,0 +1,11 @@ +5 +AJMP +aB23d +E +86AE +AM +6 +JPEM +WaEaETC302Q +CP +rTurnAGundam1isdefferentf diff --git a/codenet/public_test_cases/p00819/output.0.txt b/codenet/public_test_cases/p00819/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f49fa74e05bc1063cc4af14a05c2d056510b775 --- /dev/null +++ b/codenet/public_test_cases/p00819/output.0.txt @@ -0,0 +1,5 @@ +32Bad +AE86 +7 +EC302QTWaEa +TurnAGundam0isdefferentfr diff --git a/codenet/public_test_cases/p00819/output.1.txt b/codenet/public_test_cases/p00819/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f49fa74e05bc1063cc4af14a05c2d056510b775 --- /dev/null +++ b/codenet/public_test_cases/p00819/output.1.txt @@ -0,0 +1,5 @@ +32Bad +AE86 +7 +EC302QTWaEa +TurnAGundam0isdefferentfr diff --git a/codenet/public_test_cases/p00820/input.0.txt b/codenet/public_test_cases/p00820/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50efa34972f7358687c1cb4e962ecfd4306e7a32 --- /dev/null +++ b/codenet/public_test_cases/p00820/input.0.txt @@ -0,0 +1,6 @@ +1 +25 +2003 +211 +20007 +0 diff --git a/codenet/public_test_cases/p00820/input.1.txt b/codenet/public_test_cases/p00820/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..50efa34972f7358687c1cb4e962ecfd4306e7a32 --- /dev/null +++ b/codenet/public_test_cases/p00820/input.1.txt @@ -0,0 +1,6 @@ +1 +25 +2003 +211 +20007 +0 diff --git a/codenet/public_test_cases/p00820/output.0.txt b/codenet/public_test_cases/p00820/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..41069ce8fc1b43723c721fec32b2ee627bd5c7aa --- /dev/null +++ b/codenet/public_test_cases/p00820/output.0.txt @@ -0,0 +1,5 @@ +1 +3 +48 +7 +738 diff --git a/codenet/public_test_cases/p00820/output.1.txt b/codenet/public_test_cases/p00820/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..41069ce8fc1b43723c721fec32b2ee627bd5c7aa --- /dev/null +++ b/codenet/public_test_cases/p00820/output.1.txt @@ -0,0 +1,5 @@ +1 +3 +48 +7 +738 diff --git a/codenet/public_test_cases/p00821/input.0.txt b/codenet/public_test_cases/p00821/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da286e2e17d18c53a8acc2444ac418c38ee686d7 --- /dev/null +++ b/codenet/public_test_cases/p00821/input.0.txt @@ -0,0 +1,20 @@ +4 +5 -3 +1 0 +1 7 +-7 -1 +3 +5 5 +18 5 +5 10 +3 +-5 -5 +-5 -10 +-18 -10 +5 +0 0 +20 2 +11 1 +21 2 +2 0 +0 diff --git a/codenet/public_test_cases/p00821/input.1.txt b/codenet/public_test_cases/p00821/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..da286e2e17d18c53a8acc2444ac418c38ee686d7 --- /dev/null +++ b/codenet/public_test_cases/p00821/input.1.txt @@ -0,0 +1,20 @@ +4 +5 -3 +1 0 +1 7 +-7 -1 +3 +5 5 +18 5 +5 10 +3 +-5 -5 +-5 -10 +-18 -10 +5 +0 0 +20 2 +11 1 +21 2 +2 0 +0 diff --git a/codenet/public_test_cases/p00821/output.0.txt b/codenet/public_test_cases/p00821/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe5938957569097cf2c83e411190890936451bff --- /dev/null +++ b/codenet/public_test_cases/p00821/output.0.txt @@ -0,0 +1,4 @@ +55 +41 +41 +23 diff --git a/codenet/public_test_cases/p00821/output.1.txt b/codenet/public_test_cases/p00821/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe5938957569097cf2c83e411190890936451bff --- /dev/null +++ b/codenet/public_test_cases/p00821/output.1.txt @@ -0,0 +1,4 @@ +55 +41 +41 +23 diff --git a/codenet/public_test_cases/p00822/input.0.txt b/codenet/public_test_cases/p00822/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f256bc547747a2163fe689d90cb969565643b79 --- /dev/null +++ b/codenet/public_test_cases/p00822/input.0.txt @@ -0,0 +1,35 @@ +1 +0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 +7 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 +0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 +0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 +0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 +1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 +0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 +7 +0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 +0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 +0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 +0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 +0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 +0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 +15 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 +0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 +1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 +0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 +0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 +1 0 0 1 1 0 0 0 0 1 0 1 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 +0 diff --git a/codenet/public_test_cases/p00822/input.1.txt b/codenet/public_test_cases/p00822/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f256bc547747a2163fe689d90cb969565643b79 --- /dev/null +++ b/codenet/public_test_cases/p00822/input.1.txt @@ -0,0 +1,35 @@ +1 +0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 +7 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 +0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 +0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 +0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 +1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 +0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 +7 +0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 +0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 +0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 +0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 +0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 +0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 +15 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 +0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 +1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 +0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 +0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 +1 0 0 1 1 0 0 0 0 1 0 1 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 +0 diff --git a/codenet/public_test_cases/p00822/output.0.txt b/codenet/public_test_cases/p00822/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5565ed6787ffbbdfdde23a1dd76682900001d005 --- /dev/null +++ b/codenet/public_test_cases/p00822/output.0.txt @@ -0,0 +1,4 @@ +0 +1 +0 +1 diff --git a/codenet/public_test_cases/p00822/output.1.txt b/codenet/public_test_cases/p00822/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5565ed6787ffbbdfdde23a1dd76682900001d005 --- /dev/null +++ b/codenet/public_test_cases/p00822/output.1.txt @@ -0,0 +1,4 @@ +0 +1 +0 +1 diff --git a/codenet/public_test_cases/p00823/input.0.txt b/codenet/public_test_cases/p00823/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b742a37466979863816a8d3de60e4654c326970c --- /dev/null +++ b/codenet/public_test_cases/p00823/input.0.txt @@ -0,0 +1,14 @@ +H 1 +He 4 +C 12 +O 16 +F 19 +Ne 20 +Cu 64 +Cc 333 +END_OF_FIRST_PART +H2C +(MgF)2As +Cu(OH)2 +H((CO)2F)99 +0 diff --git a/codenet/public_test_cases/p00823/input.1.txt b/codenet/public_test_cases/p00823/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b742a37466979863816a8d3de60e4654c326970c --- /dev/null +++ b/codenet/public_test_cases/p00823/input.1.txt @@ -0,0 +1,14 @@ +H 1 +He 4 +C 12 +O 16 +F 19 +Ne 20 +Cu 64 +Cc 333 +END_OF_FIRST_PART +H2C +(MgF)2As +Cu(OH)2 +H((CO)2F)99 +0 diff --git a/codenet/public_test_cases/p00823/output.0.txt b/codenet/public_test_cases/p00823/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0d34ec5a6f8a053e539d33172f5e5d54a47fcf2 --- /dev/null +++ b/codenet/public_test_cases/p00823/output.0.txt @@ -0,0 +1,4 @@ +14 +UNKNOWN +98 +7426 diff --git a/codenet/public_test_cases/p00823/output.1.txt b/codenet/public_test_cases/p00823/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0d34ec5a6f8a053e539d33172f5e5d54a47fcf2 --- /dev/null +++ b/codenet/public_test_cases/p00823/output.1.txt @@ -0,0 +1,4 @@ +14 +UNKNOWN +98 +7426 diff --git a/codenet/public_test_cases/p00824/input.0.txt b/codenet/public_test_cases/p00824/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..df135b66923f4ddfdf5d6b38edc4b34dc1c91983 --- /dev/null +++ b/codenet/public_test_cases/p00824/input.0.txt @@ -0,0 +1,21 @@ +4 + +12 13 14 15 16 17 21 +22 23 24 25 26 27 31 +32 33 34 35 36 37 41 +42 43 44 45 46 47 11 + +26 31 13 44 21 24 42 +17 45 23 25 41 36 11 +46 34 14 12 37 32 47 +16 43 27 35 22 33 15 + +17 12 16 13 15 14 11 +27 22 26 23 25 24 21 +37 32 36 33 35 34 31 +47 42 46 43 45 44 41 + +27 14 22 35 32 46 33 +13 17 36 24 44 21 15 +43 16 45 47 23 11 26 +25 37 41 34 42 12 31 diff --git a/codenet/public_test_cases/p00824/input.1.txt b/codenet/public_test_cases/p00824/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..df135b66923f4ddfdf5d6b38edc4b34dc1c91983 --- /dev/null +++ b/codenet/public_test_cases/p00824/input.1.txt @@ -0,0 +1,21 @@ +4 + +12 13 14 15 16 17 21 +22 23 24 25 26 27 31 +32 33 34 35 36 37 41 +42 43 44 45 46 47 11 + +26 31 13 44 21 24 42 +17 45 23 25 41 36 11 +46 34 14 12 37 32 47 +16 43 27 35 22 33 15 + +17 12 16 13 15 14 11 +27 22 26 23 25 24 21 +37 32 36 33 35 34 31 +47 42 46 43 45 44 41 + +27 14 22 35 32 46 33 +13 17 36 24 44 21 15 +43 16 45 47 23 11 26 +25 37 41 34 42 12 31 diff --git a/codenet/public_test_cases/p00824/output.0.txt b/codenet/public_test_cases/p00824/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..361e78600a1ec2e62bb94e098332880a37179723 --- /dev/null +++ b/codenet/public_test_cases/p00824/output.0.txt @@ -0,0 +1,4 @@ +0 +33 +60 +-1 diff --git a/codenet/public_test_cases/p00824/output.1.txt b/codenet/public_test_cases/p00824/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..361e78600a1ec2e62bb94e098332880a37179723 --- /dev/null +++ b/codenet/public_test_cases/p00824/output.1.txt @@ -0,0 +1,4 @@ +0 +33 +60 +-1 diff --git a/codenet/public_test_cases/p00825/input.0.txt b/codenet/public_test_cases/p00825/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5c49874972825ae24829085f49b74db41307a1d --- /dev/null +++ b/codenet/public_test_cases/p00825/input.0.txt @@ -0,0 +1,22 @@ +4 +1 2 10 +2 3 10 +3 3 10 +1 3 10 +6 +1 20 1000 +3 25 10000 +5 15 5000 +22 300 5500 +10 295 9000 +7 7 6000 +8 +32 251 2261 +123 281 1339 +211 235 5641 +162 217 7273 +22 139 7851 +194 198 9190 +119 274 878 +122 173 8640 +0 diff --git a/codenet/public_test_cases/p00825/input.1.txt b/codenet/public_test_cases/p00825/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5c49874972825ae24829085f49b74db41307a1d --- /dev/null +++ b/codenet/public_test_cases/p00825/input.1.txt @@ -0,0 +1,22 @@ +4 +1 2 10 +2 3 10 +3 3 10 +1 3 10 +6 +1 20 1000 +3 25 10000 +5 15 5000 +22 300 5500 +10 295 9000 +7 7 6000 +8 +32 251 2261 +123 281 1339 +211 235 5641 +162 217 7273 +22 139 7851 +194 198 9190 +119 274 878 +122 173 8640 +0 diff --git a/codenet/public_test_cases/p00825/output.0.txt b/codenet/public_test_cases/p00825/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9430a1046e154ee444a0997c4ed55c1921f9c60a --- /dev/null +++ b/codenet/public_test_cases/p00825/output.0.txt @@ -0,0 +1,3 @@ +30 +25500 +38595 diff --git a/codenet/public_test_cases/p00825/output.1.txt b/codenet/public_test_cases/p00825/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9430a1046e154ee444a0997c4ed55c1921f9c60a --- /dev/null +++ b/codenet/public_test_cases/p00825/output.1.txt @@ -0,0 +1,3 @@ +30 +25500 +38595 diff --git a/codenet/public_test_cases/p00826/input.0.txt b/codenet/public_test_cases/p00826/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b179443eff582ec97ab7d9c35b3252af834529b --- /dev/null +++ b/codenet/public_test_cases/p00826/input.0.txt @@ -0,0 +1,19 @@ +8 +-7 9 6 9 +-5 5 6 5 +-10 -5 10 -5 +-6 9 -9 -6 +6 9 9 -6 +-1 -2 -3 10 +1 -2 3 10 +-2 -3 2 -3 +8 +-7 9 5 7 +-5 5 6 5 +-10 -5 10 -5 +-6 9 -9 -6 +6 9 9 -6 +-1 -2 -3 10 +1 -2 3 10 +-2 -3 2 -3 +0 diff --git a/codenet/public_test_cases/p00826/input.1.txt b/codenet/public_test_cases/p00826/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b179443eff582ec97ab7d9c35b3252af834529b --- /dev/null +++ b/codenet/public_test_cases/p00826/input.1.txt @@ -0,0 +1,19 @@ +8 +-7 9 6 9 +-5 5 6 5 +-10 -5 10 -5 +-6 9 -9 -6 +6 9 9 -6 +-1 -2 -3 10 +1 -2 3 10 +-2 -3 2 -3 +8 +-7 9 5 7 +-5 5 6 5 +-10 -5 10 -5 +-6 9 -9 -6 +6 9 9 -6 +-1 -2 -3 10 +1 -2 3 10 +-2 -3 2 -3 +0 diff --git a/codenet/public_test_cases/p00826/output.0.txt b/codenet/public_test_cases/p00826/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3548ec75745b4bab76190bb939fc489d7873f60 --- /dev/null +++ b/codenet/public_test_cases/p00826/output.0.txt @@ -0,0 +1,2 @@ +yes +no diff --git a/codenet/public_test_cases/p00826/output.1.txt b/codenet/public_test_cases/p00826/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3548ec75745b4bab76190bb939fc489d7873f60 --- /dev/null +++ b/codenet/public_test_cases/p00826/output.1.txt @@ -0,0 +1,2 @@ +yes +no diff --git a/codenet/public_test_cases/p00827/input.0.txt b/codenet/public_test_cases/p00827/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69e0abb035c2e73bda0d353dd0f0aaf1cec9515b --- /dev/null +++ b/codenet/public_test_cases/p00827/input.0.txt @@ -0,0 +1,8 @@ +700 300 200 +500 200 300 +500 200 500 +275 110 330 +275 110 385 +648 375 4002 +3 1 10000 +0 0 0 diff --git a/codenet/public_test_cases/p00827/input.1.txt b/codenet/public_test_cases/p00827/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69e0abb035c2e73bda0d353dd0f0aaf1cec9515b --- /dev/null +++ b/codenet/public_test_cases/p00827/input.1.txt @@ -0,0 +1,8 @@ +700 300 200 +500 200 300 +500 200 500 +275 110 330 +275 110 385 +648 375 4002 +3 1 10000 +0 0 0 diff --git a/codenet/public_test_cases/p00827/output.0.txt b/codenet/public_test_cases/p00827/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..51320b439758a79a788697f1e6a71042fd94b779 --- /dev/null +++ b/codenet/public_test_cases/p00827/output.0.txt @@ -0,0 +1,7 @@ +1 3 +1 1 +1 0 +0 3 +1 1 +49 74 +3333 1 diff --git a/codenet/public_test_cases/p00827/output.1.txt b/codenet/public_test_cases/p00827/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51320b439758a79a788697f1e6a71042fd94b779 --- /dev/null +++ b/codenet/public_test_cases/p00827/output.1.txt @@ -0,0 +1,7 @@ +1 3 +1 1 +1 0 +0 3 +1 1 +49 74 +3333 1 diff --git a/codenet/public_test_cases/p00828/input.0.txt b/codenet/public_test_cases/p00828/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1f0cc880634291072b4ee59394be83eb029be91 --- /dev/null +++ b/codenet/public_test_cases/p00828/input.0.txt @@ -0,0 +1,29 @@ +3 3 3 +1 1 +1 1 +1 1 +3 3 7 +2 2 +1 3 +1 1 +2 3 +2 1 +3 3 +3 1 +4 3 15 +1 1 +2 2 +1 1 +3 3 +3 3 +1 1 +3 3 +3 3 +4 4 +1 1 +4 4 +4 4 +4 4 +4 1 +2 2 +0 0 0 diff --git a/codenet/public_test_cases/p00828/input.1.txt b/codenet/public_test_cases/p00828/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1f0cc880634291072b4ee59394be83eb029be91 --- /dev/null +++ b/codenet/public_test_cases/p00828/input.1.txt @@ -0,0 +1,29 @@ +3 3 3 +1 1 +1 1 +1 1 +3 3 7 +2 2 +1 3 +1 1 +2 3 +2 1 +3 3 +3 1 +4 3 15 +1 1 +2 2 +1 1 +3 3 +3 3 +1 1 +3 3 +3 3 +4 4 +1 1 +4 4 +4 4 +4 4 +4 1 +2 2 +0 0 0 diff --git a/codenet/public_test_cases/p00828/output.0.txt b/codenet/public_test_cases/p00828/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5f5c75cc7cbccbb02db6a37a1e598a38693c000 --- /dev/null +++ b/codenet/public_test_cases/p00828/output.0.txt @@ -0,0 +1,3 @@ +Draw +White 6 +Black 15 diff --git a/codenet/public_test_cases/p00828/output.1.txt b/codenet/public_test_cases/p00828/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5f5c75cc7cbccbb02db6a37a1e598a38693c000 --- /dev/null +++ b/codenet/public_test_cases/p00828/output.1.txt @@ -0,0 +1,3 @@ +Draw +White 6 +Black 15 diff --git a/codenet/public_test_cases/p00829/input.0.txt b/codenet/public_test_cases/p00829/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..935af1811c3b82cf23759c287640180aaed2cea2 --- /dev/null +++ b/codenet/public_test_cases/p00829/input.0.txt @@ -0,0 +1,11 @@ +8 +1 1 1 1 1 1 1 1 8 +3 2 3 2 3 2 3 2 6 +3 4 4 7 7 b a 2 2e +e1 13 ce 28 ca 6 ab 46 a6d +b08 49e2 6128 f27 8cf2 bc50 7380 7fe1 723b +4eba eb4 a352 fd14 6ac1 eed1 dd06 bb83 392bc +ef593c08 847e522f 74c02b9c 26f3a4e1 e2720a01 6fe66007 +7a4e96ad 6ee5cef6 3853cd88 +60202fb8 757d6d66 9c3a9525 fbcd7983 82b9571c ddc54bab 853e52da +22047c88 e5524401 diff --git a/codenet/public_test_cases/p00829/input.1.txt b/codenet/public_test_cases/p00829/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..935af1811c3b82cf23759c287640180aaed2cea2 --- /dev/null +++ b/codenet/public_test_cases/p00829/input.1.txt @@ -0,0 +1,11 @@ +8 +1 1 1 1 1 1 1 1 8 +3 2 3 2 3 2 3 2 6 +3 4 4 7 7 b a 2 2e +e1 13 ce 28 ca 6 ab 46 a6d +b08 49e2 6128 f27 8cf2 bc50 7380 7fe1 723b +4eba eb4 a352 fd14 6ac1 eed1 dd06 bb83 392bc +ef593c08 847e522f 74c02b9c 26f3a4e1 e2720a01 6fe66007 +7a4e96ad 6ee5cef6 3853cd88 +60202fb8 757d6d66 9c3a9525 fbcd7983 82b9571c ddc54bab 853e52da +22047c88 e5524401 diff --git a/codenet/public_test_cases/p00829/output.0.txt b/codenet/public_test_cases/p00829/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e09a90faaa4d8f6c1d52ccabd9f8cb339f124ba --- /dev/null +++ b/codenet/public_test_cases/p00829/output.0.txt @@ -0,0 +1,8 @@ +0 +2 +6 +1c6 +4924afc7 +ffff95c5 +546991d +901c4a16 diff --git a/codenet/public_test_cases/p00829/output.1.txt b/codenet/public_test_cases/p00829/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e09a90faaa4d8f6c1d52ccabd9f8cb339f124ba --- /dev/null +++ b/codenet/public_test_cases/p00829/output.1.txt @@ -0,0 +1,8 @@ +0 +2 +6 +1c6 +4924afc7 +ffff95c5 +546991d +901c4a16 diff --git a/codenet/public_test_cases/p00830/input.0.txt b/codenet/public_test_cases/p00830/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ec772b4e131fc153c32f2f4f0480f135719b8fe --- /dev/null +++ b/codenet/public_test_cases/p00830/input.0.txt @@ -0,0 +1,29 @@ +5 6 +/home/ACM/index.html +/ICPC/index.html +/ICPC/general.html +/ICPC/japanese/index.html +/ICPC/secret/confidential/2005/index.html +/home/ACM/ +/home/ICPC/../ACM/ +/ICPC/secret/ +/ICPC/secret/index.html +/ICPC +/ICPC/../ICPC/index.html +/ICPC +/ICPC/general.html +/ICPC/japanese/.././ +/ICPC/japanese/./../ +/home/ACM/index.html +/home/ACM/index.html/ +1 4 +/index.html/index.html +/ +/index.html/index.html +/index.html +/index.html/index.html +/.. +/index.html/../.. +/index.html/ +/index.html/index.html/.. +0 0 diff --git a/codenet/public_test_cases/p00830/input.1.txt b/codenet/public_test_cases/p00830/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ec772b4e131fc153c32f2f4f0480f135719b8fe --- /dev/null +++ b/codenet/public_test_cases/p00830/input.1.txt @@ -0,0 +1,29 @@ +5 6 +/home/ACM/index.html +/ICPC/index.html +/ICPC/general.html +/ICPC/japanese/index.html +/ICPC/secret/confidential/2005/index.html +/home/ACM/ +/home/ICPC/../ACM/ +/ICPC/secret/ +/ICPC/secret/index.html +/ICPC +/ICPC/../ICPC/index.html +/ICPC +/ICPC/general.html +/ICPC/japanese/.././ +/ICPC/japanese/./../ +/home/ACM/index.html +/home/ACM/index.html/ +1 4 +/index.html/index.html +/ +/index.html/index.html +/index.html +/index.html/index.html +/.. +/index.html/../.. +/index.html/ +/index.html/index.html/.. +0 0 diff --git a/codenet/public_test_cases/p00830/output.0.txt b/codenet/public_test_cases/p00830/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..933384c22d5fd247c13d0cb05b60d8e9c5acd97e --- /dev/null +++ b/codenet/public_test_cases/p00830/output.0.txt @@ -0,0 +1,10 @@ +not found +not found +yes +no +yes +not found +not found +yes +not found +not found diff --git a/codenet/public_test_cases/p00830/output.1.txt b/codenet/public_test_cases/p00830/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..933384c22d5fd247c13d0cb05b60d8e9c5acd97e --- /dev/null +++ b/codenet/public_test_cases/p00830/output.1.txt @@ -0,0 +1,10 @@ +not found +not found +yes +no +yes +not found +not found +yes +not found +not found diff --git a/codenet/public_test_cases/p00831/input.0.txt b/codenet/public_test_cases/p00831/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..758e8b5264632459fdfd62e15ee32d0e23b631da --- /dev/null +++ b/codenet/public_test_cases/p00831/input.0.txt @@ -0,0 +1,26 @@ +8 +2 +omura +toshio +raku +tanaka +imura +yoshoi +hayashi +miura +3 +1 +tasaka +nakata +tanaka +1 +1 +foo +5 +2 +psqt +abcdef +abzdefa +pqrst +abdxcef +0 diff --git a/codenet/public_test_cases/p00831/input.1.txt b/codenet/public_test_cases/p00831/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..758e8b5264632459fdfd62e15ee32d0e23b631da --- /dev/null +++ b/codenet/public_test_cases/p00831/input.1.txt @@ -0,0 +1,26 @@ +8 +2 +omura +toshio +raku +tanaka +imura +yoshoi +hayashi +miura +3 +1 +tasaka +nakata +tanaka +1 +1 +foo +5 +2 +psqt +abcdef +abzdefa +pqrst +abdxcef +0 diff --git a/codenet/public_test_cases/p00831/output.0.txt b/codenet/public_test_cases/p00831/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d754f0b6132273b31f0742f35cdbf47da04638d5 --- /dev/null +++ b/codenet/public_test_cases/p00831/output.0.txt @@ -0,0 +1,12 @@ +imura,miura +imura,omura +miura,omura +toshio,yoshoi +4 +tanaka,tasaka +1 +0 +abcdef,abdxcef +abcdef,abzdefa +pqrst,psqt +3 diff --git a/codenet/public_test_cases/p00831/output.1.txt b/codenet/public_test_cases/p00831/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d754f0b6132273b31f0742f35cdbf47da04638d5 --- /dev/null +++ b/codenet/public_test_cases/p00831/output.1.txt @@ -0,0 +1,12 @@ +imura,miura +imura,omura +miura,omura +toshio,yoshoi +4 +tanaka,tasaka +1 +0 +abcdef,abdxcef +abcdef,abzdefa +pqrst,psqt +3 diff --git a/codenet/public_test_cases/p00832/input.0.txt b/codenet/public_test_cases/p00832/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af557de344d740ef68429fbd13ba330fbb97f3c9 --- /dev/null +++ b/codenet/public_test_cases/p00832/input.0.txt @@ -0,0 +1,25 @@ +4 +1 1 1 +1 1 1 +1 1 1 +2 2 2 +2 2 2 +2 2 2 +4 3 3 +5 2 2 +4 3 3 +6 1 1 +6 1 1 +6 1 0 +1 0 0 +0 2 0 +0 0 0 +5 1 2 +5 1 2 +0 0 0 +2 0 0 +0 3 0 +0 0 0 +0 0 0 +0 0 0 +3 0 1 diff --git a/codenet/public_test_cases/p00832/input.1.txt b/codenet/public_test_cases/p00832/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af557de344d740ef68429fbd13ba330fbb97f3c9 --- /dev/null +++ b/codenet/public_test_cases/p00832/input.1.txt @@ -0,0 +1,25 @@ +4 +1 1 1 +1 1 1 +1 1 1 +2 2 2 +2 2 2 +2 2 2 +4 3 3 +5 2 2 +4 3 3 +6 1 1 +6 1 1 +6 1 0 +1 0 0 +0 2 0 +0 0 0 +5 1 2 +5 1 2 +0 0 0 +2 0 0 +0 3 0 +0 0 0 +0 0 0 +0 0 0 +3 0 1 diff --git a/codenet/public_test_cases/p00832/output.0.txt b/codenet/public_test_cases/p00832/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f2411f62078e946109003dc930b7ee4208b85a0 --- /dev/null +++ b/codenet/public_test_cases/p00832/output.0.txt @@ -0,0 +1,4 @@ +27 +24 +32 33 36 +0 diff --git a/codenet/public_test_cases/p00832/output.1.txt b/codenet/public_test_cases/p00832/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f2411f62078e946109003dc930b7ee4208b85a0 --- /dev/null +++ b/codenet/public_test_cases/p00832/output.1.txt @@ -0,0 +1,4 @@ +27 +24 +32 33 36 +0 diff --git a/codenet/public_test_cases/p00833/input.0.txt b/codenet/public_test_cases/p00833/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..585be75ac677489a2565f4d27f90d8fa54760db7 --- /dev/null +++ b/codenet/public_test_cases/p00833/input.0.txt @@ -0,0 +1,67 @@ +6 +Blizid +0 0 +60 0 +60 60 +0 60 +0 50 +50 50 +50 10 +0 10 +-1 +Blizid +0 10 +10 10 +10 50 +0 50 +-1 +Windom +10 10 +50 10 +40 20 +20 20 +20 40 +10 50 +-1 +Accent +50 10 +50 50 +35 50 +35 25 +-1 +Pilot +35 25 +35 50 +10 50 +-1 +Blizid +20 20 +40 20 +20 40 +-1 +4 +A1234567890123456789 +0 0 +0 100 +100 100 +100 0 +-1 +B1234567890123456789 +100 100 +100 200 +200 200 +200 100 +-1 +C1234567890123456789 +0 100 +100 100 +100 200 +0 200 +-1 +D123456789012345678 +100 0 +100 100 +200 100 +200 0 +-1 +0 diff --git a/codenet/public_test_cases/p00833/input.1.txt b/codenet/public_test_cases/p00833/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..585be75ac677489a2565f4d27f90d8fa54760db7 --- /dev/null +++ b/codenet/public_test_cases/p00833/input.1.txt @@ -0,0 +1,67 @@ +6 +Blizid +0 0 +60 0 +60 60 +0 60 +0 50 +50 50 +50 10 +0 10 +-1 +Blizid +0 10 +10 10 +10 50 +0 50 +-1 +Windom +10 10 +50 10 +40 20 +20 20 +20 40 +10 50 +-1 +Accent +50 10 +50 50 +35 50 +35 25 +-1 +Pilot +35 25 +35 50 +10 50 +-1 +Blizid +20 20 +40 20 +20 40 +-1 +4 +A1234567890123456789 +0 0 +0 100 +100 100 +100 0 +-1 +B1234567890123456789 +100 100 +100 200 +200 200 +200 100 +-1 +C1234567890123456789 +0 100 +100 100 +100 200 +0 200 +-1 +D123456789012345678 +100 0 +100 100 +200 100 +200 0 +-1 +0 diff --git a/codenet/public_test_cases/p00833/output.0.txt b/codenet/public_test_cases/p00833/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc7fa75e6a7bc42f0431e7fa75b59e3ddc4dc40f --- /dev/null +++ b/codenet/public_test_cases/p00833/output.0.txt @@ -0,0 +1,2 @@ +4 +2 diff --git a/codenet/public_test_cases/p00833/output.1.txt b/codenet/public_test_cases/p00833/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc7fa75e6a7bc42f0431e7fa75b59e3ddc4dc40f --- /dev/null +++ b/codenet/public_test_cases/p00833/output.1.txt @@ -0,0 +1,2 @@ +4 +2 diff --git a/codenet/public_test_cases/p00834/input.0.txt b/codenet/public_test_cases/p00834/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7201889b4ffb426cae9de0f845f9525f6426494c --- /dev/null +++ b/codenet/public_test_cases/p00834/input.0.txt @@ -0,0 +1,30 @@ +3 +95 20 180 18 +125 20 185 18 +40 27 195 10 +1 +5 5 5 4 +2 +5 5 5 4 +5 5 5 3 +2 +5 5 5 4 +5 7 5 3 +16 +2338 3465 29034 710 +1571 14389 25019 842 +1706 8015 11324 1155 +1899 4359 33815 888 +2160 10364 20511 1264 +2048 8835 23706 1906 +2598 13041 23679 618 +1613 11112 8003 1125 +1777 4754 25986 929 +2707 9945 11458 617 +1153 10358 4305 755 +2462 8450 21838 934 +1822 11539 10025 1639 +1473 11939 12924 638 +1388 8519 18653 834 +2239 7384 32729 862 +0 diff --git a/codenet/public_test_cases/p00834/input.1.txt b/codenet/public_test_cases/p00834/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7201889b4ffb426cae9de0f845f9525f6426494c --- /dev/null +++ b/codenet/public_test_cases/p00834/input.1.txt @@ -0,0 +1,30 @@ +3 +95 20 180 18 +125 20 185 18 +40 27 195 10 +1 +5 5 5 4 +2 +5 5 5 4 +5 5 5 3 +2 +5 5 5 4 +5 7 5 3 +16 +2338 3465 29034 710 +1571 14389 25019 842 +1706 8015 11324 1155 +1899 4359 33815 888 +2160 10364 20511 1264 +2048 8835 23706 1906 +2598 13041 23679 618 +1613 11112 8003 1125 +1777 4754 25986 929 +2707 9945 11458 617 +1153 10358 4305 755 +2462 8450 21838 934 +1822 11539 10025 1639 +1473 11939 12924 638 +1388 8519 18653 834 +2239 7384 32729 862 +0 diff --git a/codenet/public_test_cases/p00834/output.0.txt b/codenet/public_test_cases/p00834/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..42338b9e7259e5ff2e6535a1c6c3bc49e1ee5a32 --- /dev/null +++ b/codenet/public_test_cases/p00834/output.0.txt @@ -0,0 +1,10 @@ +8 +11011000 +2 +10 +2 +10 +2 +10 +28 +1011100100110101101000101100 diff --git a/codenet/public_test_cases/p00834/output.1.txt b/codenet/public_test_cases/p00834/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..42338b9e7259e5ff2e6535a1c6c3bc49e1ee5a32 --- /dev/null +++ b/codenet/public_test_cases/p00834/output.1.txt @@ -0,0 +1,10 @@ +8 +11011000 +2 +10 +2 +10 +2 +10 +28 +1011100100110101101000101100 diff --git a/codenet/public_test_cases/p00835/input.0.txt b/codenet/public_test_cases/p00835/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b2ec76c9df1ab6a57fe218389097eff40c7ffd6 --- /dev/null +++ b/codenet/public_test_cases/p00835/input.0.txt @@ -0,0 +1,40 @@ +4 +5 0 +0 10 +7 5 +10 5 +4 +7 5 +10 5 +5 0 +0 10 +4 +0 10 +10 10 +10 0 +0 0 +3 +0 0 +0 10 +10 0 +4 +0 10 +10 5 +0 0 +9 5 +4 +5 0 +0 10 +5 5 +10 10 +4 +0 5 +5 10 +10 5 +5 0 +4 +7 1 +4 1 +0 1 +9 5 +0 diff --git a/codenet/public_test_cases/p00835/input.1.txt b/codenet/public_test_cases/p00835/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b2ec76c9df1ab6a57fe218389097eff40c7ffd6 --- /dev/null +++ b/codenet/public_test_cases/p00835/input.1.txt @@ -0,0 +1,40 @@ +4 +5 0 +0 10 +7 5 +10 5 +4 +7 5 +10 5 +5 0 +0 10 +4 +0 10 +10 10 +10 0 +0 0 +3 +0 0 +0 10 +10 0 +4 +0 10 +10 5 +0 0 +9 5 +4 +5 0 +0 10 +5 5 +10 10 +4 +0 5 +5 10 +10 5 +5 0 +4 +7 1 +4 1 +0 1 +9 5 +0 diff --git a/codenet/public_test_cases/p00835/output.0.txt b/codenet/public_test_cases/p00835/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..012d4d0a712116e9a979c5a7f7fe28cbd34c5f93 --- /dev/null +++ b/codenet/public_test_cases/p00835/output.0.txt @@ -0,0 +1,8 @@ +194.8255 +194.8255 +600.0000 +341.4214 +42.9519 +182.5141 +282.8427 +149.2470 diff --git a/codenet/public_test_cases/p00835/output.1.txt b/codenet/public_test_cases/p00835/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..012d4d0a712116e9a979c5a7f7fe28cbd34c5f93 --- /dev/null +++ b/codenet/public_test_cases/p00835/output.1.txt @@ -0,0 +1,8 @@ +194.8255 +194.8255 +600.0000 +341.4214 +42.9519 +182.5141 +282.8427 +149.2470 diff --git a/codenet/public_test_cases/p00836/input.0.txt b/codenet/public_test_cases/p00836/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb5019c9487e6c2bdc26b8b53cc3f7df64e5fc0c --- /dev/null +++ b/codenet/public_test_cases/p00836/input.0.txt @@ -0,0 +1,9 @@ +2 +3 +17 +41 +20 +666 +12 +53 +0 diff --git a/codenet/public_test_cases/p00836/input.1.txt b/codenet/public_test_cases/p00836/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb5019c9487e6c2bdc26b8b53cc3f7df64e5fc0c --- /dev/null +++ b/codenet/public_test_cases/p00836/input.1.txt @@ -0,0 +1,9 @@ +2 +3 +17 +41 +20 +666 +12 +53 +0 diff --git a/codenet/public_test_cases/p00836/output.0.txt b/codenet/public_test_cases/p00836/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..690368aafbe3f07f68f6976a6143b6576c53a475 --- /dev/null +++ b/codenet/public_test_cases/p00836/output.0.txt @@ -0,0 +1,8 @@ +1 +1 +2 +3 +0 +0 +1 +2 diff --git a/codenet/public_test_cases/p00836/output.1.txt b/codenet/public_test_cases/p00836/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..690368aafbe3f07f68f6976a6143b6576c53a475 --- /dev/null +++ b/codenet/public_test_cases/p00836/output.1.txt @@ -0,0 +1,8 @@ +1 +1 +2 +3 +0 +0 +1 +2 diff --git a/codenet/public_test_cases/p00837/input.0.txt b/codenet/public_test_cases/p00837/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecd4f9836edf7c34c2fee796b298722f6d486c9d --- /dev/null +++ b/codenet/public_test_cases/p00837/input.0.txt @@ -0,0 +1,40 @@ +2 1 1 +1 +50 +2 1 2 +1 +50 +1 +60 +2 1 2 +2 +60 61 +1 +70 +4 2 3 +3 +60 61 62 +1 +70 +2 +80 81 +3 1 2 +3 +60 61 62 +2 +70 60 +1 2 5 +2 +87 95 +3 +96 71 35 +2 +68 2 +3 +3 18 93 +2 +57 2 +2 2 1 +5 +1 2 1 3 1 +0 0 0 diff --git a/codenet/public_test_cases/p00837/input.1.txt b/codenet/public_test_cases/p00837/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecd4f9836edf7c34c2fee796b298722f6d486c9d --- /dev/null +++ b/codenet/public_test_cases/p00837/input.1.txt @@ -0,0 +1,40 @@ +2 1 1 +1 +50 +2 1 2 +1 +50 +1 +60 +2 1 2 +2 +60 61 +1 +70 +4 2 3 +3 +60 61 62 +1 +70 +2 +80 81 +3 1 2 +3 +60 61 62 +2 +70 60 +1 2 5 +2 +87 95 +3 +96 71 35 +2 +68 2 +3 +3 18 93 +2 +57 2 +2 2 1 +5 +1 2 1 3 1 +0 0 0 diff --git a/codenet/public_test_cases/p00837/output.0.txt b/codenet/public_test_cases/p00837/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64dafdb1785e5222495332daeb2c52a3991cc722 --- /dev/null +++ b/codenet/public_test_cases/p00837/output.0.txt @@ -0,0 +1,7 @@ +4 +16 +28 +68 +58 +98 +23 diff --git a/codenet/public_test_cases/p00837/output.1.txt b/codenet/public_test_cases/p00837/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64dafdb1785e5222495332daeb2c52a3991cc722 --- /dev/null +++ b/codenet/public_test_cases/p00837/output.1.txt @@ -0,0 +1,7 @@ +4 +16 +28 +68 +58 +98 +23 diff --git a/codenet/public_test_cases/p00838/input.0.txt b/codenet/public_test_cases/p00838/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65b9af3207ee8a8c29656827584f6fedafab3bad --- /dev/null +++ b/codenet/public_test_cases/p00838/input.0.txt @@ -0,0 +1,38 @@ +3 +scarlet green blue yellow magenta cyan +blue pink green magenta cyan lemon +purple red blue yellow cyan green +2 +red green blue yellow magenta cyan +cyan green blue yellow magenta red +2 +red green gray gray magenta cyan +cyan green gray gray magenta red +2 +red green blue yellow magenta cyan +magenta red blue yellow cyan green +3 +red green blue yellow magenta cyan +cyan green blue yellow magenta red +magenta red blue yellow cyan green +3 +blue green green green green blue +green blue blue green green green +green green green green green sea-green +3 +red yellow red yellow red yellow +red red yellow yellow red yellow +red red red red red red +4 +violet violet salmon salmon salmon salmon +violet salmon salmon salmon salmon violet +violet violet salmon salmon violet violet +violet violet violet violet salmon salmon +1 +red green blue yellow magenta cyan +4 +magenta pink red scarlet vermilion wine-red +aquamarine blue cyan indigo sky-blue turquoise-blue +blond cream chrome-yellow lemon olive yellow +chrome-green emerald-green green olive vilidian sky-blue +0 diff --git a/codenet/public_test_cases/p00838/input.1.txt b/codenet/public_test_cases/p00838/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..65b9af3207ee8a8c29656827584f6fedafab3bad --- /dev/null +++ b/codenet/public_test_cases/p00838/input.1.txt @@ -0,0 +1,38 @@ +3 +scarlet green blue yellow magenta cyan +blue pink green magenta cyan lemon +purple red blue yellow cyan green +2 +red green blue yellow magenta cyan +cyan green blue yellow magenta red +2 +red green gray gray magenta cyan +cyan green gray gray magenta red +2 +red green blue yellow magenta cyan +magenta red blue yellow cyan green +3 +red green blue yellow magenta cyan +cyan green blue yellow magenta red +magenta red blue yellow cyan green +3 +blue green green green green blue +green blue blue green green green +green green green green green sea-green +3 +red yellow red yellow red yellow +red red yellow yellow red yellow +red red red red red red +4 +violet violet salmon salmon salmon salmon +violet salmon salmon salmon salmon violet +violet violet salmon salmon violet violet +violet violet violet violet salmon salmon +1 +red green blue yellow magenta cyan +4 +magenta pink red scarlet vermilion wine-red +aquamarine blue cyan indigo sky-blue turquoise-blue +blond cream chrome-yellow lemon olive yellow +chrome-green emerald-green green olive vilidian sky-blue +0 diff --git a/codenet/public_test_cases/p00838/output.0.txt b/codenet/public_test_cases/p00838/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6941f8cd1190ea96c003aaab5bdd990e4159a9d --- /dev/null +++ b/codenet/public_test_cases/p00838/output.0.txt @@ -0,0 +1,10 @@ +4 +2 +0 +0 +2 +3 +4 +4 +0 +16 diff --git a/codenet/public_test_cases/p00838/output.1.txt b/codenet/public_test_cases/p00838/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6941f8cd1190ea96c003aaab5bdd990e4159a9d --- /dev/null +++ b/codenet/public_test_cases/p00838/output.1.txt @@ -0,0 +1,10 @@ +4 +2 +0 +0 +2 +3 +4 +4 +0 +16 diff --git a/codenet/public_test_cases/p00839/input.0.txt b/codenet/public_test_cases/p00839/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ef6aeb597c10ed01beb47f694bf7e4d0c133f48 --- /dev/null +++ b/codenet/public_test_cases/p00839/input.0.txt @@ -0,0 +1,34 @@ +3 5 +0W 1W +0W 2W +0W 2E +0E 1E +1E 2E +aabbccdee +- +- +- +- +bbaadeecc +3 3 +0E 1W +1E 2W +2E 0W +aabb +bbcc +aa +bbbb +cc +aaaa +3 4 +0E 1W +0E 2E +1E 2W +2E 0W +ababab +- +- +aaabbb +- +- +0 0 diff --git a/codenet/public_test_cases/p00839/input.1.txt b/codenet/public_test_cases/p00839/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ef6aeb597c10ed01beb47f694bf7e4d0c133f48 --- /dev/null +++ b/codenet/public_test_cases/p00839/input.1.txt @@ -0,0 +1,34 @@ +3 5 +0W 1W +0W 2W +0W 2E +0E 1E +1E 2E +aabbccdee +- +- +- +- +bbaadeecc +3 3 +0E 1W +1E 2W +2E 0W +aabb +bbcc +aa +bbbb +cc +aaaa +3 4 +0E 1W +0E 2E +1E 2W +2E 0W +ababab +- +- +aaabbb +- +- +0 0 diff --git a/codenet/public_test_cases/p00839/output.0.txt b/codenet/public_test_cases/p00839/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9e2036d6ff3461493e65010b4ed07ccbfd8d9ec --- /dev/null +++ b/codenet/public_test_cases/p00839/output.0.txt @@ -0,0 +1,3 @@ +4 +2 +5 diff --git a/codenet/public_test_cases/p00839/output.1.txt b/codenet/public_test_cases/p00839/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9e2036d6ff3461493e65010b4ed07ccbfd8d9ec --- /dev/null +++ b/codenet/public_test_cases/p00839/output.1.txt @@ -0,0 +1,3 @@ +4 +2 +5 diff --git a/codenet/public_test_cases/p00840/input.0.txt b/codenet/public_test_cases/p00840/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..161c8957e5a5ea9d77a12fe8d6f0a5dd78200561 --- /dev/null +++ b/codenet/public_test_cases/p00840/input.0.txt @@ -0,0 +1,28 @@ +5 +1.3 +3 +1 +2 +1 +1.4 +3 +1 +2 +1 +2.0 +3 +1 +2 +1 +1.59 +4 +2 +1 +1 +3 +1.7143 +4 +1 +2 +3 +5 diff --git a/codenet/public_test_cases/p00840/input.1.txt b/codenet/public_test_cases/p00840/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..161c8957e5a5ea9d77a12fe8d6f0a5dd78200561 --- /dev/null +++ b/codenet/public_test_cases/p00840/input.1.txt @@ -0,0 +1,28 @@ +5 +1.3 +3 +1 +2 +1 +1.4 +3 +1 +2 +1 +2.0 +3 +1 +2 +1 +1.59 +4 +2 +1 +1 +3 +1.7143 +4 +1 +2 +3 +5 diff --git a/codenet/public_test_cases/p00840/output.0.txt b/codenet/public_test_cases/p00840/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f11c7be2cb6c80347ba1eee9d7a552bc3843e410 --- /dev/null +++ b/codenet/public_test_cases/p00840/output.0.txt @@ -0,0 +1,5 @@ +-1 +1.3333333333333335 +1.6666666666666667 +1.5833333333333335 +1.7142857142857142 diff --git a/codenet/public_test_cases/p00840/output.1.txt b/codenet/public_test_cases/p00840/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f11c7be2cb6c80347ba1eee9d7a552bc3843e410 --- /dev/null +++ b/codenet/public_test_cases/p00840/output.1.txt @@ -0,0 +1,5 @@ +-1 +1.3333333333333335 +1.6666666666666667 +1.5833333333333335 +1.7142857142857142 diff --git a/codenet/public_test_cases/p00841/input.0.txt b/codenet/public_test_cases/p00841/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1223d629f0e47f831c98bf350fcfe382561e287 --- /dev/null +++ b/codenet/public_test_cases/p00841/input.0.txt @@ -0,0 +1,13 @@ +2 +2 3 +1.0 +1 1.0 0.1 0.3 +5 +5 10 15 20 25 +0.15 +1 1.0 0.04 0.5 +10 +1783 3640 3991 4623 5465 5481 6369 6533 6865 8425 +4.172 +72 59.4705 0.0052834 0.0611224 +0 diff --git a/codenet/public_test_cases/p00841/input.1.txt b/codenet/public_test_cases/p00841/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1223d629f0e47f831c98bf350fcfe382561e287 --- /dev/null +++ b/codenet/public_test_cases/p00841/input.1.txt @@ -0,0 +1,13 @@ +2 +2 3 +1.0 +1 1.0 0.1 0.3 +5 +5 10 15 20 25 +0.15 +1 1.0 0.04 0.5 +10 +1783 3640 3991 4623 5465 5481 6369 6533 6865 8425 +4.172 +72 59.4705 0.0052834 0.0611224 +0 diff --git a/codenet/public_test_cases/p00841/output.0.txt b/codenet/public_test_cases/p00841/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..158c70482c70aa62bb52ac1be8e38dc0c2e3ecd9 --- /dev/null +++ b/codenet/public_test_cases/p00841/output.0.txt @@ -0,0 +1,3 @@ +3.5397 +31.9249 +168.6682 diff --git a/codenet/public_test_cases/p00841/output.1.txt b/codenet/public_test_cases/p00841/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..158c70482c70aa62bb52ac1be8e38dc0c2e3ecd9 --- /dev/null +++ b/codenet/public_test_cases/p00841/output.1.txt @@ -0,0 +1,3 @@ +3.5397 +31.9249 +168.6682 diff --git a/codenet/public_test_cases/p00842/input.0.txt b/codenet/public_test_cases/p00842/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..89c225a1cdd65ffa428e7a3c37c6b0d188c16f39 --- /dev/null +++ b/codenet/public_test_cases/p00842/input.0.txt @@ -0,0 +1,14 @@ +4 + 0 2 2 2 + 2 0 2 2 + 2 2 0 2 + 2 2 2 0 +4 + 0 2 4 4 + 2 0 4 4 + 4 4 0 2 + 4 4 2 0 +2 + 0 12 + 12 0 +0 diff --git a/codenet/public_test_cases/p00842/input.1.txt b/codenet/public_test_cases/p00842/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..89c225a1cdd65ffa428e7a3c37c6b0d188c16f39 --- /dev/null +++ b/codenet/public_test_cases/p00842/input.1.txt @@ -0,0 +1,14 @@ +4 + 0 2 2 2 + 2 0 2 2 + 2 2 0 2 + 2 2 2 0 +4 + 0 2 4 4 + 2 0 4 4 + 4 4 0 2 + 4 4 2 0 +2 + 0 12 + 12 0 +0 diff --git a/codenet/public_test_cases/p00842/input.2.txt b/codenet/public_test_cases/p00842/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5fb6e63b6095c5a08f6db0b9a42fecc317abb56 --- /dev/null +++ b/codenet/public_test_cases/p00842/input.2.txt @@ -0,0 +1,14 @@ +4 +0 2 2 2 +2 0 2 2 +2 2 0 2 +2 2 2 0 +4 +0 2 4 4 +2 0 4 4 +4 4 0 2 +4 4 2 0 +2 +0 12 +12 0 +0 diff --git a/codenet/public_test_cases/p00842/output.0.txt b/codenet/public_test_cases/p00842/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0c9830ed5b045f6523faa2b515d40a3ec5a5291 --- /dev/null +++ b/codenet/public_test_cases/p00842/output.0.txt @@ -0,0 +1,3 @@ +4 +2 3 3 +2 2 2 2 2 2 2 2 2 2 2 diff --git a/codenet/public_test_cases/p00842/output.1.txt b/codenet/public_test_cases/p00842/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0c9830ed5b045f6523faa2b515d40a3ec5a5291 --- /dev/null +++ b/codenet/public_test_cases/p00842/output.1.txt @@ -0,0 +1,3 @@ +4 +2 3 3 +2 2 2 2 2 2 2 2 2 2 2 diff --git a/codenet/public_test_cases/p00842/output.2.txt b/codenet/public_test_cases/p00842/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0c9830ed5b045f6523faa2b515d40a3ec5a5291 --- /dev/null +++ b/codenet/public_test_cases/p00842/output.2.txt @@ -0,0 +1,3 @@ +4 +2 3 3 +2 2 2 2 2 2 2 2 2 2 2 diff --git a/codenet/public_test_cases/p00843/input.0.txt b/codenet/public_test_cases/p00843/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a3c075fc8e282c23cf880a1f7357087179caa09 --- /dev/null +++ b/codenet/public_test_cases/p00843/input.0.txt @@ -0,0 +1,21 @@ +4 3 +10 25 11 20 6 2 1 15 23 +5 21 3 12 23 17 7 26 2 +8 18 4 22 13 27 16 5 11 +19 9 24 2 11 5 14 28 16 +4 3 +12 13 20 24 28 32 15 16 17 +12 13 21 25 29 33 16 17 18 +12 13 22 26 30 34 17 18 15 +12 13 23 27 31 35 18 15 16 +4 3 +11 12 13 14 15 16 17 18 19 +21 22 23 24 25 26 27 28 29 +31 32 33 34 35 36 37 38 39 +41 42 43 44 45 46 47 48 49 +4 4 +2 6 9 21 15 23 17 31 33 12 25 4 8 24 13 36 +22 18 27 26 35 28 3 7 11 20 38 16 5 32 14 29 +26 7 16 29 27 3 38 14 18 28 20 32 22 35 11 5 +36 13 24 8 4 25 12 33 31 17 23 15 21 9 6 2 +0 0 diff --git a/codenet/public_test_cases/p00843/input.1.txt b/codenet/public_test_cases/p00843/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a3c075fc8e282c23cf880a1f7357087179caa09 --- /dev/null +++ b/codenet/public_test_cases/p00843/input.1.txt @@ -0,0 +1,21 @@ +4 3 +10 25 11 20 6 2 1 15 23 +5 21 3 12 23 17 7 26 2 +8 18 4 22 13 27 16 5 11 +19 9 24 2 11 5 14 28 16 +4 3 +12 13 20 24 28 32 15 16 17 +12 13 21 25 29 33 16 17 18 +12 13 22 26 30 34 17 18 15 +12 13 23 27 31 35 18 15 16 +4 3 +11 12 13 14 15 16 17 18 19 +21 22 23 24 25 26 27 28 29 +31 32 33 34 35 36 37 38 39 +41 42 43 44 45 46 47 48 49 +4 4 +2 6 9 21 15 23 17 31 33 12 25 4 8 24 13 36 +22 18 27 26 35 28 3 7 11 20 38 16 5 32 14 29 +26 7 16 29 27 3 38 14 18 28 20 32 22 35 11 5 +36 13 24 8 4 25 12 33 31 17 23 15 21 9 6 2 +0 0 diff --git a/codenet/public_test_cases/p00843/output.0.txt b/codenet/public_test_cases/p00843/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec3192a43df90d75bf3fda1249deda1da13dfda7 --- /dev/null +++ b/codenet/public_test_cases/p00843/output.0.txt @@ -0,0 +1,4 @@ +5 +4 +12 +0 diff --git a/codenet/public_test_cases/p00843/output.1.txt b/codenet/public_test_cases/p00843/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec3192a43df90d75bf3fda1249deda1da13dfda7 --- /dev/null +++ b/codenet/public_test_cases/p00843/output.1.txt @@ -0,0 +1,4 @@ +5 +4 +12 +0 diff --git a/codenet/public_test_cases/p00844/input.0.txt b/codenet/public_test_cases/p00844/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd54e47c165b7b5b7b9c02f49bcfd25333a38362 --- /dev/null +++ b/codenet/public_test_cases/p00844/input.0.txt @@ -0,0 +1,44 @@ +10.5235 +3 +0 0 +100 100 +0 100 +4 +0 50 +20 50 +20 80 +0 80 +10.0 +4 +120 45 +140 35 +140 65 +120 55 +8 +0 0 +100 0 +100 100 +0 100 +0 55 +80 90 +80 10 +0 45 +10.0 +3 +0 0 +1 0 +0 1 +3 +0 100 +1 101 +0 101 +10.0 +3 +0 0 +1 0 +0 100 +3 +0 50 +100 50 +0 51 +0 diff --git a/codenet/public_test_cases/p00844/input.1.txt b/codenet/public_test_cases/p00844/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd54e47c165b7b5b7b9c02f49bcfd25333a38362 --- /dev/null +++ b/codenet/public_test_cases/p00844/input.1.txt @@ -0,0 +1,44 @@ +10.5235 +3 +0 0 +100 100 +0 100 +4 +0 50 +20 50 +20 80 +0 80 +10.0 +4 +120 45 +140 35 +140 65 +120 55 +8 +0 0 +100 0 +100 100 +0 100 +0 55 +80 90 +80 10 +0 45 +10.0 +3 +0 0 +1 0 +0 1 +3 +0 100 +1 101 +0 101 +10.0 +3 +0 0 +1 0 +0 100 +3 +0 50 +100 50 +0 51 +0 diff --git a/codenet/public_test_cases/p00844/output.0.txt b/codenet/public_test_cases/p00844/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b20156c7fb842baa83ab36b16551d257d74f893c --- /dev/null +++ b/codenet/public_test_cases/p00844/output.0.txt @@ -0,0 +1,4 @@ +114.882476 +100 +1 +110.5005 diff --git a/codenet/public_test_cases/p00844/output.1.txt b/codenet/public_test_cases/p00844/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b20156c7fb842baa83ab36b16551d257d74f893c --- /dev/null +++ b/codenet/public_test_cases/p00844/output.1.txt @@ -0,0 +1,4 @@ +114.882476 +100 +1 +110.5005 diff --git a/codenet/public_test_cases/p00845/input.0.txt b/codenet/public_test_cases/p00845/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..839c5e15bb4be8229671f0dd233b89f9938d38a6 --- /dev/null +++ b/codenet/public_test_cases/p00845/input.0.txt @@ -0,0 +1,26 @@ +3 +100 0 500 +-500.243 -200.1 -300.5 +0 300 200 +2 +1 1 1 0.65 +-1 0 0 1.57 +3 +1 0 0 +0 1 0 +0 0 1 +4 +1 -1 -1 0.9553 +-1 1 -1 0.9554 +-1 -1 1 0.9553 +-1 1 -1 0.9554 +3 +1 0 0 +0 1 0 +0 0 1 +4 +1 -1 -1 0.9553 +-1 1 -1 0.9553 +-1 -1 1 0.9553 +-1 1 -1 0.9553 +0 diff --git a/codenet/public_test_cases/p00845/input.1.txt b/codenet/public_test_cases/p00845/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..839c5e15bb4be8229671f0dd233b89f9938d38a6 --- /dev/null +++ b/codenet/public_test_cases/p00845/input.1.txt @@ -0,0 +1,26 @@ +3 +100 0 500 +-500.243 -200.1 -300.5 +0 300 200 +2 +1 1 1 0.65 +-1 0 0 1.57 +3 +1 0 0 +0 1 0 +0 0 1 +4 +1 -1 -1 0.9553 +-1 1 -1 0.9554 +-1 -1 1 0.9553 +-1 1 -1 0.9554 +3 +1 0 0 +0 1 0 +0 0 1 +4 +1 -1 -1 0.9553 +-1 1 -1 0.9553 +-1 -1 1 0.9553 +-1 1 -1 0.9553 +0 diff --git a/codenet/public_test_cases/p00845/output.0.txt b/codenet/public_test_cases/p00845/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p00845/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p00845/output.1.txt b/codenet/public_test_cases/p00845/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p00845/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p00846/input.0.txt b/codenet/public_test_cases/p00846/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f444f6352d4bd62eaa3951eed4ed33d24c33dc36 --- /dev/null +++ b/codenet/public_test_cases/p00846/input.0.txt @@ -0,0 +1,17 @@ +6 +66 13 +96 61 +76 98 +13 94 +4 0 +45 68 +8 +27 21 +55 14 +93 12 +56 95 +15 48 +38 46 +51 65 +64 31 +0 diff --git a/codenet/public_test_cases/p00846/input.1.txt b/codenet/public_test_cases/p00846/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f444f6352d4bd62eaa3951eed4ed33d24c33dc36 --- /dev/null +++ b/codenet/public_test_cases/p00846/input.1.txt @@ -0,0 +1,17 @@ +6 +66 13 +96 61 +76 98 +13 94 +4 0 +45 68 +8 +27 21 +55 14 +93 12 +56 95 +15 48 +38 46 +51 65 +64 31 +0 diff --git a/codenet/public_test_cases/p00846/output.0.txt b/codenet/public_test_cases/p00846/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b261da18d51a39dc2cf0d156791e9c0b35dd83f4 --- /dev/null +++ b/codenet/public_test_cases/p00846/output.0.txt @@ -0,0 +1,2 @@ +1 +0 diff --git a/codenet/public_test_cases/p00846/output.1.txt b/codenet/public_test_cases/p00846/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b261da18d51a39dc2cf0d156791e9c0b35dd83f4 --- /dev/null +++ b/codenet/public_test_cases/p00846/output.1.txt @@ -0,0 +1,2 @@ +1 +0 diff --git a/codenet/public_test_cases/p00847/input.0.txt b/codenet/public_test_cases/p00847/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..645e314e4daac26130b8f7a4ab3ad33acae1ee13 --- /dev/null +++ b/codenet/public_test_cases/p00847/input.0.txt @@ -0,0 +1,33 @@ +1 2 +W W W +E W W +W W W +2 1 +R B W +R W W +E W W +3 3 +W B W +B R E +R B R +3 3 +B W R +B W R +B E R +2 1 +B B B +B R B +B R E +1 1 +R R R +W W W +R R E +2 1 +R R R +B W B +R R E +3 2 +R R R +W E W +R R R +0 0 diff --git a/codenet/public_test_cases/p00847/input.1.txt b/codenet/public_test_cases/p00847/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..645e314e4daac26130b8f7a4ab3ad33acae1ee13 --- /dev/null +++ b/codenet/public_test_cases/p00847/input.1.txt @@ -0,0 +1,33 @@ +1 2 +W W W +E W W +W W W +2 1 +R B W +R W W +E W W +3 3 +W B W +B R E +R B R +3 3 +B W R +B W R +B E R +2 1 +B B B +B R B +B R E +1 1 +R R R +W W W +R R E +2 1 +R R R +B W B +R R E +3 2 +R R R +W E W +R R R +0 0 diff --git a/codenet/public_test_cases/p00847/output.0.txt b/codenet/public_test_cases/p00847/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3882169660232eec9eeb1a5606a8b1945c3f6a1b --- /dev/null +++ b/codenet/public_test_cases/p00847/output.0.txt @@ -0,0 +1,8 @@ +0 +3 +13 +23 +29 +30 +-1 +-1 diff --git a/codenet/public_test_cases/p00847/output.1.txt b/codenet/public_test_cases/p00847/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3882169660232eec9eeb1a5606a8b1945c3f6a1b --- /dev/null +++ b/codenet/public_test_cases/p00847/output.1.txt @@ -0,0 +1,8 @@ +0 +3 +13 +23 +29 +30 +-1 +-1 diff --git a/codenet/public_test_cases/p00848/input.0.txt b/codenet/public_test_cases/p00848/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..beb2703e44e095fe311413e066d8e2877cc0a011 --- /dev/null +++ b/codenet/public_test_cases/p00848/input.0.txt @@ -0,0 +1,13 @@ +24 3 +24 2 +2 1 +1 1 +4 2 +18 3 +17 1 +17 3 +17 4 +100 5 +1000 10 +1120 14 +0 0 diff --git a/codenet/public_test_cases/p00848/input.1.txt b/codenet/public_test_cases/p00848/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..beb2703e44e095fe311413e066d8e2877cc0a011 --- /dev/null +++ b/codenet/public_test_cases/p00848/input.1.txt @@ -0,0 +1,13 @@ +24 3 +24 2 +2 1 +1 1 +4 2 +18 3 +17 1 +17 3 +17 4 +100 5 +1000 10 +1120 14 +0 0 diff --git a/codenet/public_test_cases/p00848/output.0.txt b/codenet/public_test_cases/p00848/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9dd54672b613ef9d655adf40fe87b8b2a839948 --- /dev/null +++ b/codenet/public_test_cases/p00848/output.0.txt @@ -0,0 +1,12 @@ +2 +3 +1 +0 +0 +2 +1 +0 +1 +55 +200102899 +2079324314 diff --git a/codenet/public_test_cases/p00848/output.1.txt b/codenet/public_test_cases/p00848/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9dd54672b613ef9d655adf40fe87b8b2a839948 --- /dev/null +++ b/codenet/public_test_cases/p00848/output.1.txt @@ -0,0 +1,12 @@ +2 +3 +1 +0 +0 +2 +1 +0 +1 +55 +200102899 +2079324314 diff --git a/codenet/public_test_cases/p00849/input.0.txt b/codenet/public_test_cases/p00849/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba409c02a34f09cbd5dacb714ecf21572d7545b6 --- /dev/null +++ b/codenet/public_test_cases/p00849/input.0.txt @@ -0,0 +1,53 @@ +5 5 +0 0 0 0 0 +0 0 0 3 0 +2 0 2 0 0 +1 0 1 1 1 +0 0 0 0 3 +2 3 +2 2 0 +0 3 3 +6 5 +2 0 0 0 0 +0 3 0 0 0 +0 0 0 0 0 +1 1 1 0 0 +0 0 0 0 0 +0 0 2 3 0 +5 9 +0 0 0 0 0 0 0 0 0 +0 0 0 0 3 0 0 0 0 +0 2 0 0 0 0 0 2 0 +0 0 0 0 3 0 0 0 0 +0 0 0 0 0 0 0 0 0 +9 9 +3 0 0 0 0 0 0 0 2 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +2 0 0 0 0 0 0 0 3 +9 9 +0 0 0 1 0 0 0 0 0 +0 2 0 1 0 0 0 0 3 +0 0 0 1 0 0 0 0 2 +0 0 0 1 0 0 0 0 3 +0 0 0 1 1 1 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +9 9 +0 0 0 0 0 0 0 0 0 +0 3 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 2 3 2 +0 0 diff --git a/codenet/public_test_cases/p00849/input.1.txt b/codenet/public_test_cases/p00849/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba409c02a34f09cbd5dacb714ecf21572d7545b6 --- /dev/null +++ b/codenet/public_test_cases/p00849/input.1.txt @@ -0,0 +1,53 @@ +5 5 +0 0 0 0 0 +0 0 0 3 0 +2 0 2 0 0 +1 0 1 1 1 +0 0 0 0 3 +2 3 +2 2 0 +0 3 3 +6 5 +2 0 0 0 0 +0 3 0 0 0 +0 0 0 0 0 +1 1 1 0 0 +0 0 0 0 0 +0 0 2 3 0 +5 9 +0 0 0 0 0 0 0 0 0 +0 0 0 0 3 0 0 0 0 +0 2 0 0 0 0 0 2 0 +0 0 0 0 3 0 0 0 0 +0 0 0 0 0 0 0 0 0 +9 9 +3 0 0 0 0 0 0 0 2 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +2 0 0 0 0 0 0 0 3 +9 9 +0 0 0 1 0 0 0 0 0 +0 2 0 1 0 0 0 0 3 +0 0 0 1 0 0 0 0 2 +0 0 0 1 0 0 0 0 3 +0 0 0 1 1 1 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +9 9 +0 0 0 0 0 0 0 0 0 +0 3 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 2 3 2 +0 0 diff --git a/codenet/public_test_cases/p00849/output.0.txt b/codenet/public_test_cases/p00849/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6010730fe3945e459a43db465eaf0cb42111fbe --- /dev/null +++ b/codenet/public_test_cases/p00849/output.0.txt @@ -0,0 +1,7 @@ +18 +2 +17 +12 +0 +52 +43 diff --git a/codenet/public_test_cases/p00849/output.1.txt b/codenet/public_test_cases/p00849/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6010730fe3945e459a43db465eaf0cb42111fbe --- /dev/null +++ b/codenet/public_test_cases/p00849/output.1.txt @@ -0,0 +1,7 @@ +18 +2 +17 +12 +0 +52 +43 diff --git a/codenet/public_test_cases/p00850/input.0.txt b/codenet/public_test_cases/p00850/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99b2234b3a7142a701fcd82eb7f0d8c93f489fd9 --- /dev/null +++ b/codenet/public_test_cases/p00850/input.0.txt @@ -0,0 +1,9 @@ +1 +31 +70 +91 +473 +512 +811 +953 +0 diff --git a/codenet/public_test_cases/p00850/input.1.txt b/codenet/public_test_cases/p00850/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99b2234b3a7142a701fcd82eb7f0d8c93f489fd9 --- /dev/null +++ b/codenet/public_test_cases/p00850/input.1.txt @@ -0,0 +1,9 @@ +1 +31 +70 +91 +473 +512 +811 +953 +0 diff --git a/codenet/public_test_cases/p00850/output.0.txt b/codenet/public_test_cases/p00850/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb6907667b6de6b5c369db26fb2510736bfa37cf --- /dev/null +++ b/codenet/public_test_cases/p00850/output.0.txt @@ -0,0 +1,8 @@ +0 +6 +8 +9 +11 +9 +13 +12 diff --git a/codenet/public_test_cases/p00850/output.1.txt b/codenet/public_test_cases/p00850/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb6907667b6de6b5c369db26fb2510736bfa37cf --- /dev/null +++ b/codenet/public_test_cases/p00850/output.1.txt @@ -0,0 +1,8 @@ +0 +6 +8 +9 +11 +9 +13 +12 diff --git a/codenet/public_test_cases/p00851/input.0.txt b/codenet/public_test_cases/p00851/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2acc2969eb2c4aa7b9cf56fdbeca23fd607e7cc5 --- /dev/null +++ b/codenet/public_test_cases/p00851/input.0.txt @@ -0,0 +1,13 @@ +3 +3 4 5 +5 +1 2 5 5 5 +6 +195 221 255 260 265 290 +6 +130 145 169 185 195 265 +3 +1 1 2 +6 +3 3 3 3 3 3 +0 diff --git a/codenet/public_test_cases/p00851/output.0.txt b/codenet/public_test_cases/p00851/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33813afc1bea4cc83f3e0aa8f6564357e6bde7bd --- /dev/null +++ b/codenet/public_test_cases/p00851/output.0.txt @@ -0,0 +1,6 @@ +6 +19 +158253 +-1 +-1 +18 diff --git a/codenet/public_test_cases/p00852/input.0.txt b/codenet/public_test_cases/p00852/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dcaa1de9b66e2d6fc996bcb0b6f699a16a2d4ae --- /dev/null +++ b/codenet/public_test_cases/p00852/input.0.txt @@ -0,0 +1,28 @@ +4 3 +A=a +A= +S=ASb +S=Ab +2 5 +S=aSb +S= +1 5 +S=S +1 0 +S=S +1 0 +A= +2 0 +A= +S=AA +4 5 +A=aB +A=b +B=SA +S=A +4 20 +S=AAAAAAAAAA +A=aA +A=bA +A= +0 0 diff --git a/codenet/public_test_cases/p00852/input.1.txt b/codenet/public_test_cases/p00852/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dcaa1de9b66e2d6fc996bcb0b6f699a16a2d4ae --- /dev/null +++ b/codenet/public_test_cases/p00852/input.1.txt @@ -0,0 +1,28 @@ +4 3 +A=a +A= +S=ASb +S=Ab +2 5 +S=aSb +S= +1 5 +S=S +1 0 +S=S +1 0 +A= +2 0 +A= +S=AA +4 5 +A=aB +A=b +B=SA +S=A +4 20 +S=AAAAAAAAAA +A=aA +A=bA +A= +0 0 diff --git a/codenet/public_test_cases/p00852/output.0.txt b/codenet/public_test_cases/p00852/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee8bb3d2e57430e448bdf8b7cb7d30d0b1356e17 --- /dev/null +++ b/codenet/public_test_cases/p00852/output.0.txt @@ -0,0 +1,8 @@ +abb +- +- +- +- + +aabbb +aaaaaaaaaaaaaaaaaaaa diff --git a/codenet/public_test_cases/p00852/output.1.txt b/codenet/public_test_cases/p00852/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee8bb3d2e57430e448bdf8b7cb7d30d0b1356e17 --- /dev/null +++ b/codenet/public_test_cases/p00852/output.1.txt @@ -0,0 +1,8 @@ +abb +- +- +- +- + +aabbb +aaaaaaaaaaaaaaaaaaaa diff --git a/codenet/public_test_cases/p00853/input.0.txt b/codenet/public_test_cases/p00853/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8632f19c9cad9ec92289eece53d95acdc086712d --- /dev/null +++ b/codenet/public_test_cases/p00853/input.0.txt @@ -0,0 +1,33 @@ +5 20 10 1 5 +1 2 1 +1 3 2 +1 4 1 +1 5 3 +2 1 1 +2 3 1 +2 4 2 +2 5 2 +3 1 1 +3 2 2 +3 4 1 +3 5 1 +4 1 1 +4 2 1 +4 3 1 +4 5 2 +5 1 1 +5 2 1 +5 3 1 +5 4 1 +4 6 1 1 4 +2 4 2 +1 3 2 +1 2 1 +1 4 3 +2 3 1 +3 4 1 +3 3 5 1 3 +1 2 1 +2 3 1 +1 3 1 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00853/input.1.txt b/codenet/public_test_cases/p00853/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8632f19c9cad9ec92289eece53d95acdc086712d --- /dev/null +++ b/codenet/public_test_cases/p00853/input.1.txt @@ -0,0 +1,33 @@ +5 20 10 1 5 +1 2 1 +1 3 2 +1 4 1 +1 5 3 +2 1 1 +2 3 1 +2 4 2 +2 5 2 +3 1 1 +3 2 2 +3 4 1 +3 5 1 +4 1 1 +4 2 1 +4 3 1 +4 5 2 +5 1 1 +5 2 1 +5 3 1 +5 4 1 +4 6 1 1 4 +2 4 2 +1 3 2 +1 2 1 +1 4 3 +2 3 1 +3 4 1 +3 3 5 1 3 +1 2 1 +2 3 1 +1 3 1 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00853/output.0.txt b/codenet/public_test_cases/p00853/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6fee95c1f3bca7a9155e7d2dd383e7d4da40054 --- /dev/null +++ b/codenet/public_test_cases/p00853/output.0.txt @@ -0,0 +1,3 @@ +1-2-4-3-5 +1-2-3-4 +None diff --git a/codenet/public_test_cases/p00853/output.1.txt b/codenet/public_test_cases/p00853/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6fee95c1f3bca7a9155e7d2dd383e7d4da40054 --- /dev/null +++ b/codenet/public_test_cases/p00853/output.1.txt @@ -0,0 +1,3 @@ +1-2-4-3-5 +1-2-3-4 +None diff --git a/codenet/public_test_cases/p00854/input.0.txt b/codenet/public_test_cases/p00854/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29a40250307b2373f88e7a10f13bf71cdec6171a --- /dev/null +++ b/codenet/public_test_cases/p00854/input.0.txt @@ -0,0 +1,4 @@ +8 5 3 +100 9999 98 +10000 10000 10000 +0 0 0 diff --git a/codenet/public_test_cases/p00854/input.1.txt b/codenet/public_test_cases/p00854/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29a40250307b2373f88e7a10f13bf71cdec6171a --- /dev/null +++ b/codenet/public_test_cases/p00854/input.1.txt @@ -0,0 +1,4 @@ +8 5 3 +100 9999 98 +10000 10000 10000 +0 0 0 diff --git a/codenet/public_test_cases/p00854/output.0.txt b/codenet/public_test_cases/p00854/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f740acfc485b92875a929b5ed83f06ba0f7564cf --- /dev/null +++ b/codenet/public_test_cases/p00854/output.0.txt @@ -0,0 +1,3 @@ +1 +93 +2019 diff --git a/codenet/public_test_cases/p00854/output.1.txt b/codenet/public_test_cases/p00854/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f740acfc485b92875a929b5ed83f06ba0f7564cf --- /dev/null +++ b/codenet/public_test_cases/p00854/output.1.txt @@ -0,0 +1,3 @@ +1 +93 +2019 diff --git a/codenet/public_test_cases/p00855/input.0.txt b/codenet/public_test_cases/p00855/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61dcb8c379f4eb1605ad8e7eb623869e471050c1 --- /dev/null +++ b/codenet/public_test_cases/p00855/input.0.txt @@ -0,0 +1,6 @@ +10 +11 +27 +2 +492170 +0 diff --git a/codenet/public_test_cases/p00855/input.1.txt b/codenet/public_test_cases/p00855/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..61dcb8c379f4eb1605ad8e7eb623869e471050c1 --- /dev/null +++ b/codenet/public_test_cases/p00855/input.1.txt @@ -0,0 +1,6 @@ +10 +11 +27 +2 +492170 +0 diff --git a/codenet/public_test_cases/p00855/output.0.txt b/codenet/public_test_cases/p00855/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c628b549997760a96ed24bf212739545520c2d2 --- /dev/null +++ b/codenet/public_test_cases/p00855/output.0.txt @@ -0,0 +1,5 @@ +4 +0 +6 +0 +114 diff --git a/codenet/public_test_cases/p00855/output.1.txt b/codenet/public_test_cases/p00855/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c628b549997760a96ed24bf212739545520c2d2 --- /dev/null +++ b/codenet/public_test_cases/p00855/output.1.txt @@ -0,0 +1,5 @@ +4 +0 +6 +0 +114 diff --git a/codenet/public_test_cases/p00856/input.0.txt b/codenet/public_test_cases/p00856/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eba8189bc3e04e86b5bdf3def0797642e0216f6f --- /dev/null +++ b/codenet/public_test_cases/p00856/input.0.txt @@ -0,0 +1,14 @@ +6 1 0 0 +7 1 0 0 +7 2 0 0 +6 6 1 1 +2 +5 +7 10 0 6 +1 +2 +3 +4 +5 +6 +0 0 0 0 diff --git a/codenet/public_test_cases/p00856/input.1.txt b/codenet/public_test_cases/p00856/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eba8189bc3e04e86b5bdf3def0797642e0216f6f --- /dev/null +++ b/codenet/public_test_cases/p00856/input.1.txt @@ -0,0 +1,14 @@ +6 1 0 0 +7 1 0 0 +7 2 0 0 +6 6 1 1 +2 +5 +7 10 0 6 +1 +2 +3 +4 +5 +6 +0 0 0 0 diff --git a/codenet/public_test_cases/p00856/output.0.txt b/codenet/public_test_cases/p00856/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e9abf1284e1b8c0568741a2499306bd0222fc0d --- /dev/null +++ b/codenet/public_test_cases/p00856/output.0.txt @@ -0,0 +1,5 @@ +0.166667 +0.000000 +0.166667 +0.619642 +0.000000 diff --git a/codenet/public_test_cases/p00856/output.1.txt b/codenet/public_test_cases/p00856/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e9abf1284e1b8c0568741a2499306bd0222fc0d --- /dev/null +++ b/codenet/public_test_cases/p00856/output.1.txt @@ -0,0 +1,5 @@ +0.166667 +0.000000 +0.166667 +0.619642 +0.000000 diff --git a/codenet/public_test_cases/p00857/input.0.txt b/codenet/public_test_cases/p00857/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21656236377ad1fc7d70cbda02e5100e5695eeb5 --- /dev/null +++ b/codenet/public_test_cases/p00857/input.0.txt @@ -0,0 +1,5 @@ +0 0 1 0 0 1 +0 0 5 0 2 5 +-100 -100 100 -100 0 100 +-72 -72 72 -72 0 72 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00857/input.1.txt b/codenet/public_test_cases/p00857/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..21656236377ad1fc7d70cbda02e5100e5695eeb5 --- /dev/null +++ b/codenet/public_test_cases/p00857/input.1.txt @@ -0,0 +1,5 @@ +0 0 1 0 0 1 +0 0 5 0 2 5 +-100 -100 100 -100 0 100 +-72 -72 72 -72 0 72 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00857/output.0.txt b/codenet/public_test_cases/p00857/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b790c68f9050bed64260bec5773852b48b4d085 --- /dev/null +++ b/codenet/public_test_cases/p00857/output.0.txt @@ -0,0 +1,4 @@ +2 +1.49666 +-1 +8.52936 diff --git a/codenet/public_test_cases/p00857/output.1.txt b/codenet/public_test_cases/p00857/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b790c68f9050bed64260bec5773852b48b4d085 --- /dev/null +++ b/codenet/public_test_cases/p00857/output.1.txt @@ -0,0 +1,4 @@ +2 +1.49666 +-1 +8.52936 diff --git a/codenet/public_test_cases/p00858/input.0.txt b/codenet/public_test_cases/p00858/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4bd479282864c7a3237602b063b4db6637f985e --- /dev/null +++ b/codenet/public_test_cases/p00858/input.0.txt @@ -0,0 +1,38 @@ +8 +1 1 +4 4 +1 1 4 1 +1 1 1 4 +3 1 3 4 +4 3 5 3 +2 4 3 5 +4 1 4 4 +3 3 2 2 +1 4 4 4 +9 +1 5 +5 1 +5 4 5 1 +1 5 1 1 +1 5 5 1 +2 3 2 4 +5 4 1 5 +3 2 2 1 +4 2 4 1 +1 1 5 1 +5 3 4 3 +11 +5 5 +1 0 +3 1 5 1 +4 3 4 2 +3 1 5 5 +2 3 2 2 +1 0 1 2 +1 2 3 4 +3 4 5 5 +1 0 5 2 +4 0 4 1 +5 5 5 1 +2 3 2 4 +0 diff --git a/codenet/public_test_cases/p00858/input.1.txt b/codenet/public_test_cases/p00858/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4bd479282864c7a3237602b063b4db6637f985e --- /dev/null +++ b/codenet/public_test_cases/p00858/input.1.txt @@ -0,0 +1,38 @@ +8 +1 1 +4 4 +1 1 4 1 +1 1 1 4 +3 1 3 4 +4 3 5 3 +2 4 3 5 +4 1 4 4 +3 3 2 2 +1 4 4 4 +9 +1 5 +5 1 +5 4 5 1 +1 5 1 1 +1 5 5 1 +2 3 2 4 +5 4 1 5 +3 2 2 1 +4 2 4 1 +1 1 5 1 +5 3 4 3 +11 +5 5 +1 0 +3 1 5 1 +4 3 4 2 +3 1 5 5 +2 3 2 2 +1 0 1 2 +1 2 3 4 +3 4 5 5 +1 0 5 2 +4 0 4 1 +5 5 5 1 +2 3 2 4 +0 diff --git a/codenet/public_test_cases/p00858/output.0.txt b/codenet/public_test_cases/p00858/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaaaf6e9e93490a0a1206e17dc4ad9df38a02db4 --- /dev/null +++ b/codenet/public_test_cases/p00858/output.0.txt @@ -0,0 +1,11 @@ +1 1 +3 1 +3 4 +4 4 +0 +-1 +5 5 +5 2 +3 1 +1 0 +0 diff --git a/codenet/public_test_cases/p00858/output.1.txt b/codenet/public_test_cases/p00858/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaaaf6e9e93490a0a1206e17dc4ad9df38a02db4 --- /dev/null +++ b/codenet/public_test_cases/p00858/output.1.txt @@ -0,0 +1,11 @@ +1 1 +3 1 +3 4 +4 4 +0 +-1 +5 5 +5 2 +3 1 +1 0 +0 diff --git a/codenet/public_test_cases/p00859/input.0.txt b/codenet/public_test_cases/p00859/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4eb2878a454838c329c083f355b5fc44f43b651 --- /dev/null +++ b/codenet/public_test_cases/p00859/input.0.txt @@ -0,0 +1,54 @@ +4 5 +1 2 3 +1 3 5 +1 4 6 +2 4 6 +3 4 7 +4 6 +1 2 10 +1 3 100 +1 4 90 +2 3 20 +2 4 80 +3 4 40 +2 1 +1 2 1 +3 0 +3 1 +1 2 1 +3 3 +1 2 2 +2 3 5 +1 3 6 +5 10 +1 2 110 +1 3 120 +1 4 130 +1 5 120 +2 3 110 +2 4 120 +2 5 130 +3 4 120 +3 5 110 +4 5 120 +5 10 +1 2 9384 +1 3 887 +1 4 2778 +1 5 6916 +2 3 7794 +2 4 8336 +2 5 5387 +3 4 493 +3 5 6650 +4 5 1422 +5 8 +1 2 1 +2 3 100 +3 4 100 +4 5 100 +1 5 50 +2 5 50 +3 5 50 +4 1 150 +0 0 diff --git a/codenet/public_test_cases/p00859/input.1.txt b/codenet/public_test_cases/p00859/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4eb2878a454838c329c083f355b5fc44f43b651 --- /dev/null +++ b/codenet/public_test_cases/p00859/input.1.txt @@ -0,0 +1,54 @@ +4 5 +1 2 3 +1 3 5 +1 4 6 +2 4 6 +3 4 7 +4 6 +1 2 10 +1 3 100 +1 4 90 +2 3 20 +2 4 80 +3 4 40 +2 1 +1 2 1 +3 0 +3 1 +1 2 1 +3 3 +1 2 2 +2 3 5 +1 3 6 +5 10 +1 2 110 +1 3 120 +1 4 130 +1 5 120 +2 3 110 +2 4 120 +2 5 130 +3 4 120 +3 5 110 +4 5 120 +5 10 +1 2 9384 +1 3 887 +1 4 2778 +1 5 6916 +2 3 7794 +2 4 8336 +2 5 5387 +3 4 493 +3 5 6650 +4 5 1422 +5 8 +1 2 1 +2 3 100 +3 4 100 +4 5 100 +1 5 50 +2 5 50 +3 5 50 +4 1 150 +0 0 diff --git a/codenet/public_test_cases/p00859/output.0.txt b/codenet/public_test_cases/p00859/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0058daf62626e631b84196cb007cafcbdcf57e8c --- /dev/null +++ b/codenet/public_test_cases/p00859/output.0.txt @@ -0,0 +1,9 @@ +1 +20 +0 +-1 +-1 +1 +0 +1686 +50 diff --git a/codenet/public_test_cases/p00859/output.1.txt b/codenet/public_test_cases/p00859/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0058daf62626e631b84196cb007cafcbdcf57e8c --- /dev/null +++ b/codenet/public_test_cases/p00859/output.1.txt @@ -0,0 +1,9 @@ +1 +20 +0 +-1 +-1 +1 +0 +1686 +50 diff --git a/codenet/public_test_cases/p00860/input.0.txt b/codenet/public_test_cases/p00860/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..590b82730942cf58cc97c716038024a65dd561b2 --- /dev/null +++ b/codenet/public_test_cases/p00860/input.0.txt @@ -0,0 +1,29 @@ +5 5 2 +##### +#A#B# +# # +#b#a# +##### +16 4 3 +################ +## ########## ## +# ABCcba # +################ +16 16 3 +################ +### ## # ## +## # ## # c# +# ## ########b# +# ## # # # # +# # ## # # ## +## a# # # # # +### ## #### ## # +## # # # # +# ##### # ## ## +#### #B# # # +## C# # ### +# # # ####### # +# ###### A## # +# # ## +################ +0 0 0 diff --git a/codenet/public_test_cases/p00860/input.1.txt b/codenet/public_test_cases/p00860/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..590b82730942cf58cc97c716038024a65dd561b2 --- /dev/null +++ b/codenet/public_test_cases/p00860/input.1.txt @@ -0,0 +1,29 @@ +5 5 2 +##### +#A#B# +# # +#b#a# +##### +16 4 3 +################ +## ########## ## +# ABCcba # +################ +16 16 3 +################ +### ## # ## +## # ## # c# +# ## ########b# +# ## # # # # +# # ## # # ## +## a# # # # # +### ## #### ## # +## # # # # +# ##### # ## ## +#### #B# # # +## C# # ### +# # # ####### # +# ###### A## # +# # ## +################ +0 0 0 diff --git a/codenet/public_test_cases/p00860/input.2.txt b/codenet/public_test_cases/p00860/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..700a813e878f1f55357642eb009bfb8bde9cd644 --- /dev/null +++ b/codenet/public_test_cases/p00860/input.2.txt @@ -0,0 +1,29 @@ +5 5 2 + +A#B# + +b#a# + +16 4 3 + + +ABCcba # + +16 16 3 + + +c# +b# + + +a# # # # # + + + +B# # # +C# # ### + +A## # + + +0 0 0 diff --git a/codenet/public_test_cases/p00860/output.0.txt b/codenet/public_test_cases/p00860/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cea2e5dda663a1e0f93c49cd91f04660232d6ad7 --- /dev/null +++ b/codenet/public_test_cases/p00860/output.0.txt @@ -0,0 +1,3 @@ +7 +36 +77 diff --git a/codenet/public_test_cases/p00860/output.1.txt b/codenet/public_test_cases/p00860/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cea2e5dda663a1e0f93c49cd91f04660232d6ad7 --- /dev/null +++ b/codenet/public_test_cases/p00860/output.1.txt @@ -0,0 +1,3 @@ +7 +36 +77 diff --git a/codenet/public_test_cases/p00860/output.2.txt b/codenet/public_test_cases/p00860/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cea2e5dda663a1e0f93c49cd91f04660232d6ad7 --- /dev/null +++ b/codenet/public_test_cases/p00860/output.2.txt @@ -0,0 +1,3 @@ +7 +36 +77 diff --git a/codenet/public_test_cases/p00861/input.0.txt b/codenet/public_test_cases/p00861/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c81e59ea99a105d866d4bc48ff9d961105b405c8 --- /dev/null +++ b/codenet/public_test_cases/p00861/input.0.txt @@ -0,0 +1,27 @@ +a[3] +a[0]=a[1] +. +x[1] +x[0]=x[0] +. +a[0] +a[0]=1 +. +b[2] +b[0]=2 +b[1]=b[b[0]] +b[0]=b[1] +. +g[2] +G[10] +g[0]=0 +g[1]=G[0] +. +a[2147483647] +a[0]=1 +B[2] +B[a[0]]=2 +a[B[a[0]]]=3 +a[2147483646]=a[2] +. +. diff --git a/codenet/public_test_cases/p00861/input.1.txt b/codenet/public_test_cases/p00861/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c81e59ea99a105d866d4bc48ff9d961105b405c8 --- /dev/null +++ b/codenet/public_test_cases/p00861/input.1.txt @@ -0,0 +1,27 @@ +a[3] +a[0]=a[1] +. +x[1] +x[0]=x[0] +. +a[0] +a[0]=1 +. +b[2] +b[0]=2 +b[1]=b[b[0]] +b[0]=b[1] +. +g[2] +G[10] +g[0]=0 +g[1]=G[0] +. +a[2147483647] +a[0]=1 +B[2] +B[a[0]]=2 +a[B[a[0]]]=3 +a[2147483646]=a[2] +. +. diff --git a/codenet/public_test_cases/p00861/output.0.txt b/codenet/public_test_cases/p00861/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d494e1966d08f9d35cd07e536f9d75b3aa99584 --- /dev/null +++ b/codenet/public_test_cases/p00861/output.0.txt @@ -0,0 +1,6 @@ +2 +2 +2 +3 +4 +0 diff --git a/codenet/public_test_cases/p00861/output.1.txt b/codenet/public_test_cases/p00861/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d494e1966d08f9d35cd07e536f9d75b3aa99584 --- /dev/null +++ b/codenet/public_test_cases/p00861/output.1.txt @@ -0,0 +1,6 @@ +2 +2 +2 +3 +4 +0 diff --git a/codenet/public_test_cases/p00862/input.0.txt b/codenet/public_test_cases/p00862/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef89fd81459b80878fba6b6df2a74efbea3c3b55 --- /dev/null +++ b/codenet/public_test_cases/p00862/input.0.txt @@ -0,0 +1,21 @@ +4 +0 0 +10000 0 +10000 10000 +0 10000 +3 +0 0 +10000 0 +7000 1000 +6 +0 40 +100 20 +250 40 +250 70 +100 90 +0 70 +3 +0 0 +10000 10000 +5000 5001 +0 diff --git a/codenet/public_test_cases/p00862/input.1.txt b/codenet/public_test_cases/p00862/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef89fd81459b80878fba6b6df2a74efbea3c3b55 --- /dev/null +++ b/codenet/public_test_cases/p00862/input.1.txt @@ -0,0 +1,21 @@ +4 +0 0 +10000 0 +10000 10000 +0 10000 +3 +0 0 +10000 0 +7000 1000 +6 +0 40 +100 20 +250 40 +250 70 +100 90 +0 70 +3 +0 0 +10000 10000 +5000 5001 +0 diff --git a/codenet/public_test_cases/p00862/output.0.txt b/codenet/public_test_cases/p00862/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d406264897df8e963fa963a58bf019deffe8a6bc --- /dev/null +++ b/codenet/public_test_cases/p00862/output.0.txt @@ -0,0 +1,4 @@ +5000.000000 +494.233641 +34.542948 +0.353553 diff --git a/codenet/public_test_cases/p00862/output.1.txt b/codenet/public_test_cases/p00862/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d406264897df8e963fa963a58bf019deffe8a6bc --- /dev/null +++ b/codenet/public_test_cases/p00862/output.1.txt @@ -0,0 +1,4 @@ +5000.000000 +494.233641 +34.542948 +0.353553 diff --git a/codenet/public_test_cases/p00863/input.0.txt b/codenet/public_test_cases/p00863/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..611f751886ae50ef4f276353d3013c6c2460e40e --- /dev/null +++ b/codenet/public_test_cases/p00863/input.0.txt @@ -0,0 +1,6 @@ +3 2 2 2 +3 2 2 3 +2 2 3 4 +31 4 2 3 +3 2 2 7 +0 0 0 0 diff --git a/codenet/public_test_cases/p00863/input.1.txt b/codenet/public_test_cases/p00863/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..611f751886ae50ef4f276353d3013c6c2460e40e --- /dev/null +++ b/codenet/public_test_cases/p00863/input.1.txt @@ -0,0 +1,6 @@ +3 2 2 2 +3 2 2 3 +2 2 3 4 +31 4 2 3 +3 2 2 7 +0 0 0 0 diff --git a/codenet/public_test_cases/p00863/output.0.txt b/codenet/public_test_cases/p00863/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b3d86db9c27cc59874e8bba8948d55169e19c04 --- /dev/null +++ b/codenet/public_test_cases/p00863/output.0.txt @@ -0,0 +1,5 @@ +1 0 -10 0 1 +1 0 -9 -4 27 -36 -23 +1 0 -8 0 18 0 -104 0 1 +1 0 0 -8 -93 0 24 -2976 2883 -32 -3720 -23064 -29775 +1 0 -21 0 189 0 -945 -4 2835 -252 -5103 -1260 5103 -756 -2183 diff --git a/codenet/public_test_cases/p00863/output.1.txt b/codenet/public_test_cases/p00863/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b3d86db9c27cc59874e8bba8948d55169e19c04 --- /dev/null +++ b/codenet/public_test_cases/p00863/output.1.txt @@ -0,0 +1,5 @@ +1 0 -10 0 1 +1 0 -9 -4 27 -36 -23 +1 0 -8 0 18 0 -104 0 1 +1 0 0 -8 -93 0 24 -2976 2883 -32 -3720 -23064 -29775 +1 0 -21 0 189 0 -945 -4 2835 -252 -5103 -1260 5103 -756 -2183 diff --git a/codenet/public_test_cases/p00864/input.0.txt b/codenet/public_test_cases/p00864/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66155414fa08cfc2e0d38b2cff56e34c7ee7651d --- /dev/null +++ b/codenet/public_test_cases/p00864/input.0.txt @@ -0,0 +1,20 @@ +3 50 +100 +0 +100 +3 50 +100 +100 +50 +10 10 +1 +2 +3 +4 +5 +16 +17 +18 +29 +30 +0 0 diff --git a/codenet/public_test_cases/p00864/input.1.txt b/codenet/public_test_cases/p00864/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..66155414fa08cfc2e0d38b2cff56e34c7ee7651d --- /dev/null +++ b/codenet/public_test_cases/p00864/input.1.txt @@ -0,0 +1,20 @@ +3 50 +100 +0 +100 +3 50 +100 +100 +50 +10 10 +1 +2 +3 +4 +5 +16 +17 +18 +29 +30 +0 0 diff --git a/codenet/public_test_cases/p00864/output.0.txt b/codenet/public_test_cases/p00864/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..463ff6160c13a05021f1fc4389b68f5dcde89244 --- /dev/null +++ b/codenet/public_test_cases/p00864/output.0.txt @@ -0,0 +1,3 @@ +0.51 +0.26 +1.4766666666666667 diff --git a/codenet/public_test_cases/p00864/output.1.txt b/codenet/public_test_cases/p00864/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..463ff6160c13a05021f1fc4389b68f5dcde89244 --- /dev/null +++ b/codenet/public_test_cases/p00864/output.1.txt @@ -0,0 +1,3 @@ +0.51 +0.26 +1.4766666666666667 diff --git a/codenet/public_test_cases/p00865/input.0.txt b/codenet/public_test_cases/p00865/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..72d51954251804b00cdccb3c0c9a85d2b293f084 --- /dev/null +++ b/codenet/public_test_cases/p00865/input.0.txt @@ -0,0 +1,6 @@ +2 6 0 +2 6 3 +3 10 9 +13 3 27 +1 2008 3 +0 0 0 diff --git a/codenet/public_test_cases/p00865/input.1.txt b/codenet/public_test_cases/p00865/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..72d51954251804b00cdccb3c0c9a85d2b293f084 --- /dev/null +++ b/codenet/public_test_cases/p00865/input.1.txt @@ -0,0 +1,6 @@ +2 6 0 +2 6 3 +3 10 9 +13 3 27 +1 2008 3 +0 0 0 diff --git a/codenet/public_test_cases/p00865/output.0.txt b/codenet/public_test_cases/p00865/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37982e091babd37f17da66c0ad7bbe361a06d30d --- /dev/null +++ b/codenet/public_test_cases/p00865/output.0.txt @@ -0,0 +1,5 @@ +7.00000000 +4.11111111 +7.71000000 +1.42902599 +1001.50298805 diff --git a/codenet/public_test_cases/p00865/output.1.txt b/codenet/public_test_cases/p00865/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37982e091babd37f17da66c0ad7bbe361a06d30d --- /dev/null +++ b/codenet/public_test_cases/p00865/output.1.txt @@ -0,0 +1,5 @@ +7.00000000 +4.11111111 +7.71000000 +1.42902599 +1001.50298805 diff --git a/codenet/public_test_cases/p00866/input.0.txt b/codenet/public_test_cases/p00866/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b9d681f8a33d671ff0fead0002ea1e536f733a8 --- /dev/null +++ b/codenet/public_test_cases/p00866/input.0.txt @@ -0,0 +1,26 @@ +3 +8 8 18 +32 32 32 +57 2 57 +5 +49 3 49 +7 30 44 +27 21 21 +33 56 56 +21 46 4 +3 +45 52 28 +36 26 36 +20 55 50 +10 +33 8 39 +50 57 43 +35 21 12 +21 17 11 +16 21 58 +45 40 53 +45 30 53 +39 1 8 +55 48 30 +7 48 15 +0 diff --git a/codenet/public_test_cases/p00866/input.1.txt b/codenet/public_test_cases/p00866/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b9d681f8a33d671ff0fead0002ea1e536f733a8 --- /dev/null +++ b/codenet/public_test_cases/p00866/input.1.txt @@ -0,0 +1,26 @@ +3 +8 8 18 +32 32 32 +57 2 57 +5 +49 3 49 +7 30 44 +27 21 21 +33 56 56 +21 46 4 +3 +45 52 28 +36 26 36 +20 55 50 +10 +33 8 39 +50 57 43 +35 21 12 +21 17 11 +16 21 58 +45 40 53 +45 30 53 +39 1 8 +55 48 30 +7 48 15 +0 diff --git a/codenet/public_test_cases/p00866/output.0.txt b/codenet/public_test_cases/p00866/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1f603c9f7f7eaca578b75a254a5f0db83ca258f --- /dev/null +++ b/codenet/public_test_cases/p00866/output.0.txt @@ -0,0 +1,4 @@ +00:00:00 00:00:10 +06:14:56 06:32:09 +07:27:37 07:32:02 +05:17:40 05:21:03 diff --git a/codenet/public_test_cases/p00866/output.1.txt b/codenet/public_test_cases/p00866/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1f603c9f7f7eaca578b75a254a5f0db83ca258f --- /dev/null +++ b/codenet/public_test_cases/p00866/output.1.txt @@ -0,0 +1,4 @@ +00:00:00 00:00:10 +06:14:56 06:32:09 +07:27:37 07:32:02 +05:17:40 05:21:03 diff --git a/codenet/public_test_cases/p00867/input.0.txt b/codenet/public_test_cases/p00867/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c35a66fed309d677c3bd0cfea2ba3ef8ad430488 --- /dev/null +++ b/codenet/public_test_cases/p00867/input.0.txt @@ -0,0 +1,41 @@ +9 +60 140 200 300 +300 105 330 135 +330 135 250 215 +240 205 250 215 +298 167 285 154 +30 40 30 90 +30 90 150 90 +150 90 150 20 +30 40 150 40 +8 +320 20 300 60 +320 20 380 50 +380 50 240 330 +10 50 40 20 +10 50 110 150 +110 150 180 80 +40 20 37 17 +37 17 27 27 +20 +72 222 132 182 +204 154 204 54 +510 410 520 370 +404 54 204 54 +530 450 410 450 +204 68 404 68 +80 110 120 30 +130 160 180 60 +520 370 320 320 +310 360 320 320 +120 30 180 60 +60 100 80 110 +404 154 204 154 +80 60 60 100 +430 550 590 550 +510 410 310 360 +430 450 430 550 +404 54 404 154 +232 202 142 262 +142 262 102 202 +0 diff --git a/codenet/public_test_cases/p00867/input.1.txt b/codenet/public_test_cases/p00867/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c35a66fed309d677c3bd0cfea2ba3ef8ad430488 --- /dev/null +++ b/codenet/public_test_cases/p00867/input.1.txt @@ -0,0 +1,41 @@ +9 +60 140 200 300 +300 105 330 135 +330 135 250 215 +240 205 250 215 +298 167 285 154 +30 40 30 90 +30 90 150 90 +150 90 150 20 +30 40 150 40 +8 +320 20 300 60 +320 20 380 50 +380 50 240 330 +10 50 40 20 +10 50 110 150 +110 150 180 80 +40 20 37 17 +37 17 27 27 +20 +72 222 132 182 +204 154 204 54 +510 410 520 370 +404 54 204 54 +530 450 410 450 +204 68 404 68 +80 110 120 30 +130 160 180 60 +520 370 320 320 +310 360 320 320 +120 30 180 60 +60 100 80 110 +404 154 204 154 +80 60 60 100 +430 550 590 550 +510 410 310 360 +430 450 430 550 +404 54 404 154 +232 202 142 262 +142 262 102 202 +0 diff --git a/codenet/public_test_cases/p00867/output.0.txt b/codenet/public_test_cases/p00867/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00a89181973e323f052e43b9fd19b6bf59d203d9 --- /dev/null +++ b/codenet/public_test_cases/p00867/output.0.txt @@ -0,0 +1,3 @@ +0 1 0 1 0 0 0 0 0 1 +0 0 0 0 0 1 0 1 0 0 +1 0 1 0 2 0 0 0 1 0 diff --git a/codenet/public_test_cases/p00867/output.1.txt b/codenet/public_test_cases/p00867/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00a89181973e323f052e43b9fd19b6bf59d203d9 --- /dev/null +++ b/codenet/public_test_cases/p00867/output.1.txt @@ -0,0 +1,3 @@ +0 1 0 1 0 0 0 0 0 1 +0 0 0 0 0 1 0 1 0 0 +1 0 1 0 2 0 0 0 1 0 diff --git a/codenet/public_test_cases/p00868/input.0.txt b/codenet/public_test_cases/p00868/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e0510732350db863a7a92bc4aa6f58e0909a329 --- /dev/null +++ b/codenet/public_test_cases/p00868/input.0.txt @@ -0,0 +1,12 @@ +3 +-20 -20 -24 +100 100 100 30 +10 8 3 5 +-70 -70 -84 5 +4 +0 47 84 +-23 41 42 8 +45 -10 14 19 +-5 28 47 12 +-27 68 34 14 +0 diff --git a/codenet/public_test_cases/p00868/input.1.txt b/codenet/public_test_cases/p00868/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e0510732350db863a7a92bc4aa6f58e0909a329 --- /dev/null +++ b/codenet/public_test_cases/p00868/input.1.txt @@ -0,0 +1,12 @@ +3 +-20 -20 -24 +100 100 100 30 +10 8 3 5 +-70 -70 -84 5 +4 +0 47 84 +-23 41 42 8 +45 -10 14 19 +-5 28 47 12 +-27 68 34 14 +0 diff --git a/codenet/public_test_cases/p00868/output.0.txt b/codenet/public_test_cases/p00868/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..126c9ba1b713ca0d44e2bbc46cd16e26a583b73a --- /dev/null +++ b/codenet/public_test_cases/p00868/output.0.txt @@ -0,0 +1,2 @@ +79.0940 79.0940 94.9128 +-21.8647 54.9770 34.1761 diff --git a/codenet/public_test_cases/p00868/output.1.txt b/codenet/public_test_cases/p00868/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..126c9ba1b713ca0d44e2bbc46cd16e26a583b73a --- /dev/null +++ b/codenet/public_test_cases/p00868/output.1.txt @@ -0,0 +1,2 @@ +79.0940 79.0940 94.9128 +-21.8647 54.9770 34.1761 diff --git a/codenet/public_test_cases/p00869/input.0.txt b/codenet/public_test_cases/p00869/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ee0ce4951bf2db064da1de7921e73786b24fef2 --- /dev/null +++ b/codenet/public_test_cases/p00869/input.0.txt @@ -0,0 +1,22 @@ +10 5 +kkkkkwwwww +w#wwwrwwww +wwwwbgwwww +kwwmcwwwkk +kkwywwwkkk +rgbcmy +10 5 +kkkkkkkkkk +k#kkkkkkkk +kwkkkkkwwk +kcmyrgbwwk +kwwwwwwwwk +cmyrgb +10 5 +kkkkkkkkkk +k#kkkkkkkk +kwkkkkkwkk +kcmyrgbwwk +kwwwwwwwwk +cmyrgb +0 0 diff --git a/codenet/public_test_cases/p00869/input.1.txt b/codenet/public_test_cases/p00869/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ee0ce4951bf2db064da1de7921e73786b24fef2 --- /dev/null +++ b/codenet/public_test_cases/p00869/input.1.txt @@ -0,0 +1,22 @@ +10 5 +kkkkkwwwww +w#wwwrwwww +wwwwbgwwww +kwwmcwwwkk +kkwywwwkkk +rgbcmy +10 5 +kkkkkkkkkk +k#kkkkkkkk +kwkkkkkwwk +kcmyrgbwwk +kwwwwwwwwk +cmyrgb +10 5 +kkkkkkkkkk +k#kkkkkkkk +kwkkkkkwkk +kcmyrgbwwk +kwwwwwwwwk +cmyrgb +0 0 diff --git a/codenet/public_test_cases/p00869/output.0.txt b/codenet/public_test_cases/p00869/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99eed9587ce5bd74c6db5adb11ae9ff4061525cc --- /dev/null +++ b/codenet/public_test_cases/p00869/output.0.txt @@ -0,0 +1,3 @@ +9 +49 +unreachable diff --git a/codenet/public_test_cases/p00869/output.1.txt b/codenet/public_test_cases/p00869/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99eed9587ce5bd74c6db5adb11ae9ff4061525cc --- /dev/null +++ b/codenet/public_test_cases/p00869/output.1.txt @@ -0,0 +1,3 @@ +9 +49 +unreachable diff --git a/codenet/public_test_cases/p00870/input.0.txt b/codenet/public_test_cases/p00870/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ae74d7202160a46538bad8ed41da20bc03daf8b --- /dev/null +++ b/codenet/public_test_cases/p00870/input.0.txt @@ -0,0 +1,19 @@ +3 1 +aa +b +ccc +aabccczbaacccbaazaabbcccaa +3 1 +a +b +c +cbbcbcbabaacabccaccbaacbccbcaaaccccbcbcbbcacbaacccaccbbcaacbbabbabaccc +3 4 +aaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +0 0 diff --git a/codenet/public_test_cases/p00870/input.1.txt b/codenet/public_test_cases/p00870/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ae74d7202160a46538bad8ed41da20bc03daf8b --- /dev/null +++ b/codenet/public_test_cases/p00870/input.1.txt @@ -0,0 +1,19 @@ +3 1 +aa +b +ccc +aabccczbaacccbaazaabbcccaa +3 1 +a +b +c +cbbcbcbabaacabccaccbaacbccbcaaaccccbcbcbbcacbaacccaccbbcaacbbabbabaccc +3 4 +aaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +0 0 diff --git a/codenet/public_test_cases/p00870/output.0.txt b/codenet/public_test_cases/p00870/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c600706208898f75efb631c4e74a4701f53d446 --- /dev/null +++ b/codenet/public_test_cases/p00870/output.0.txt @@ -0,0 +1,3 @@ +5 +12 +197 diff --git a/codenet/public_test_cases/p00870/output.1.txt b/codenet/public_test_cases/p00870/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c600706208898f75efb631c4e74a4701f53d446 --- /dev/null +++ b/codenet/public_test_cases/p00870/output.1.txt @@ -0,0 +1,3 @@ +5 +12 +197 diff --git a/codenet/public_test_cases/p00871/input.0.txt b/codenet/public_test_cases/p00871/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f40dfa214eb9419a2aa2acaf474c0e0cbbf3e5b --- /dev/null +++ b/codenet/public_test_cases/p00871/input.0.txt @@ -0,0 +1,36 @@ +start 0 0 +arc 2 2 -2 +line 2 5 +arc 0 3 -2 +close +start -1 1 +line 2 1 +line 2 2 +line -2 2 +arc -3 1 -1 +line -3 -2 +arc -2 -3 -1 +line 2 -3 +line 2 -2 +line -1 -2 +line -1 -1 +arc -1 0 2 +close +start 0 0 +line 3 0 +line 5 -1 +arc 4 -2 -1 +line 6 -2 +line 6 1 +line 7 3 +arc 8 2 -1 +line 8 4 +line 5 4 +line 3 5 +arc 4 6 -1 +line 2 6 +line 2 3 +line 1 1 +arc 0 2 -1 +close +end diff --git a/codenet/public_test_cases/p00871/input.1.txt b/codenet/public_test_cases/p00871/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f40dfa214eb9419a2aa2acaf474c0e0cbbf3e5b --- /dev/null +++ b/codenet/public_test_cases/p00871/input.1.txt @@ -0,0 +1,36 @@ +start 0 0 +arc 2 2 -2 +line 2 5 +arc 0 3 -2 +close +start -1 1 +line 2 1 +line 2 2 +line -2 2 +arc -3 1 -1 +line -3 -2 +arc -2 -3 -1 +line 2 -3 +line 2 -2 +line -1 -2 +line -1 -1 +arc -1 0 2 +close +start 0 0 +line 3 0 +line 5 -1 +arc 4 -2 -1 +line 6 -2 +line 6 1 +line 7 3 +arc 8 2 -1 +line 8 4 +line 5 4 +line 3 5 +arc 4 6 -1 +line 2 6 +line 2 3 +line 1 1 +arc 0 2 -1 +close +end diff --git a/codenet/public_test_cases/p00871/output.0.txt b/codenet/public_test_cases/p00871/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58a13a95dd3225665104ffc2a39908e38b3d8c51 --- /dev/null +++ b/codenet/public_test_cases/p00871/output.0.txt @@ -0,0 +1,3 @@ +1.00000 2.50000 + +-1.01522 -0.50000 - +4.00000 2.00000 + diff --git a/codenet/public_test_cases/p00871/output.1.txt b/codenet/public_test_cases/p00871/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58a13a95dd3225665104ffc2a39908e38b3d8c51 --- /dev/null +++ b/codenet/public_test_cases/p00871/output.1.txt @@ -0,0 +1,3 @@ +1.00000 2.50000 + +-1.01522 -0.50000 - +4.00000 2.00000 + diff --git a/codenet/public_test_cases/p00872/input.0.txt b/codenet/public_test_cases/p00872/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..751bf1a2eaf0f2aa62d1c5433b6da9a42de3ed41 --- /dev/null +++ b/codenet/public_test_cases/p00872/input.0.txt @@ -0,0 +1,7 @@ +-(x^3-3x^2+3x-1) +(x-1)^2 +x^2+10x+25 +x^2+6x+5 +x^3+1 +x-1 +. diff --git a/codenet/public_test_cases/p00872/input.1.txt b/codenet/public_test_cases/p00872/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..751bf1a2eaf0f2aa62d1c5433b6da9a42de3ed41 --- /dev/null +++ b/codenet/public_test_cases/p00872/input.1.txt @@ -0,0 +1,7 @@ +-(x^3-3x^2+3x-1) +(x-1)^2 +x^2+10x+25 +x^2+6x+5 +x^3+1 +x-1 +. diff --git a/codenet/public_test_cases/p00872/output.0.txt b/codenet/public_test_cases/p00872/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..345cbe0c440f6f6e615481285befb9cd18f98d6e --- /dev/null +++ b/codenet/public_test_cases/p00872/output.0.txt @@ -0,0 +1,3 @@ +x^2-2x+1 +x+5 +1 diff --git a/codenet/public_test_cases/p00872/output.1.txt b/codenet/public_test_cases/p00872/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..345cbe0c440f6f6e615481285befb9cd18f98d6e --- /dev/null +++ b/codenet/public_test_cases/p00872/output.1.txt @@ -0,0 +1,3 @@ +x^2-2x+1 +x+5 +1 diff --git a/codenet/public_test_cases/p00873/input.0.txt b/codenet/public_test_cases/p00873/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e667cffa9fd83dcd8834b0b0d65198ae35b151e --- /dev/null +++ b/codenet/public_test_cases/p00873/input.0.txt @@ -0,0 +1,63 @@ +2 +0 0 +10 9 +4 +0 0 +3 1 +0 3 +3 3 +10 +2 2 +4 2 +6 2 +2 4 +4 4 +6 4 +2 6 +4 6 +6 6 +3 3 +10 +0 0 +2 0 +4 0 +0 2 +2 2 +4 2 +0 4 +2 4 +4 4 +6 8 +9 +0 0 +1 0 +3 0 +0 1 +1 1 +3 1 +0 2 +1 2 +2 2 +10 +0 0 +1 0 +0 1 +1 1 +9 9 +9 10 +10 9 +10 10 +0 2 +10 8 +10 +0 0 +0 10 +2 0 +2 1 +2 7 +2 10 +5 1 +6 7 +9 2 +10 9 +0 diff --git a/codenet/public_test_cases/p00873/input.1.txt b/codenet/public_test_cases/p00873/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e667cffa9fd83dcd8834b0b0d65198ae35b151e --- /dev/null +++ b/codenet/public_test_cases/p00873/input.1.txt @@ -0,0 +1,63 @@ +2 +0 0 +10 9 +4 +0 0 +3 1 +0 3 +3 3 +10 +2 2 +4 2 +6 2 +2 4 +4 4 +6 4 +2 6 +4 6 +6 6 +3 3 +10 +0 0 +2 0 +4 0 +0 2 +2 2 +4 2 +0 4 +2 4 +4 4 +6 8 +9 +0 0 +1 0 +3 0 +0 1 +1 1 +3 1 +0 2 +1 2 +2 2 +10 +0 0 +1 0 +0 1 +1 1 +9 9 +9 10 +10 9 +10 10 +0 2 +10 8 +10 +0 0 +0 10 +2 0 +2 1 +2 7 +2 10 +5 1 +6 7 +9 2 +10 9 +0 diff --git a/codenet/public_test_cases/p00873/output.0.txt b/codenet/public_test_cases/p00873/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98fb59ce2513aea48bbb22eaf2f2fbf2fb3d5a4c --- /dev/null +++ b/codenet/public_test_cases/p00873/output.0.txt @@ -0,0 +1,7 @@ +0 13.45362405 +1 18.48683298 +3 24.14213562 +4 24.94813673 +3 12.24264069 +3 60.78289622 +3 502.7804353 diff --git a/codenet/public_test_cases/p00873/output.1.txt b/codenet/public_test_cases/p00873/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98fb59ce2513aea48bbb22eaf2f2fbf2fb3d5a4c --- /dev/null +++ b/codenet/public_test_cases/p00873/output.1.txt @@ -0,0 +1,7 @@ +0 13.45362405 +1 18.48683298 +3 24.14213562 +4 24.94813673 +3 12.24264069 +3 60.78289622 +3 502.7804353 diff --git a/codenet/public_test_cases/p00874/input.0.txt b/codenet/public_test_cases/p00874/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..892cc4839b74a6e498e1396480e225eee2e2b643 --- /dev/null +++ b/codenet/public_test_cases/p00874/input.0.txt @@ -0,0 +1,28 @@ +5 5 +1 2 3 4 5 +1 2 3 4 5 +5 5 +2 5 4 1 3 +4 1 5 3 2 +5 5 +1 2 3 4 5 +3 3 3 4 5 +3 3 +7 7 7 +7 7 7 +3 3 +4 4 4 +4 3 4 +4 3 +4 2 2 4 +4 2 1 +4 4 +2 8 8 8 +2 3 8 3 +10 10 +9 9 9 9 9 9 9 9 9 9 +9 9 9 9 9 9 9 9 9 9 +10 9 +20 1 20 20 20 20 20 18 20 20 +20 20 20 20 7 20 20 20 20 +0 0 diff --git a/codenet/public_test_cases/p00874/input.1.txt b/codenet/public_test_cases/p00874/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..892cc4839b74a6e498e1396480e225eee2e2b643 --- /dev/null +++ b/codenet/public_test_cases/p00874/input.1.txt @@ -0,0 +1,28 @@ +5 5 +1 2 3 4 5 +1 2 3 4 5 +5 5 +2 5 4 1 3 +4 1 5 3 2 +5 5 +1 2 3 4 5 +3 3 3 4 5 +3 3 +7 7 7 +7 7 7 +3 3 +4 4 4 +4 3 4 +4 3 +4 2 2 4 +4 2 1 +4 4 +2 8 8 8 +2 3 8 3 +10 10 +9 9 9 9 9 9 9 9 9 9 +9 9 9 9 9 9 9 9 9 9 +10 9 +20 1 20 20 20 20 20 18 20 20 +20 20 20 20 7 20 20 20 20 +0 0 diff --git a/codenet/public_test_cases/p00874/output.0.txt b/codenet/public_test_cases/p00874/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0568bcccd259ced9c0fbcd1d1666a7fe6ce2655 --- /dev/null +++ b/codenet/public_test_cases/p00874/output.0.txt @@ -0,0 +1,9 @@ +15 +15 +21 +21 +15 +13 +32 +90 +186 diff --git a/codenet/public_test_cases/p00874/output.1.txt b/codenet/public_test_cases/p00874/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0568bcccd259ced9c0fbcd1d1666a7fe6ce2655 --- /dev/null +++ b/codenet/public_test_cases/p00874/output.1.txt @@ -0,0 +1,9 @@ +15 +15 +21 +21 +15 +13 +32 +90 +186 diff --git a/codenet/public_test_cases/p00875/input.0.txt b/codenet/public_test_cases/p00875/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfc5b1816b6431bcb66b9cc1530382517bfe35ec --- /dev/null +++ b/codenet/public_test_cases/p00875/input.0.txt @@ -0,0 +1,29 @@ +2 +a bb +b aa +a +bbbbbbbb +1 +a aa +a +aaaaa +3 +ab aab +abc aadc +ad dee +abc +deeeeeeeec +10 +a abc +b bai +c acf +d bed +e abh +f fag +g abe +h bag +i aaj +j bbb +a +abacfaabe +0 diff --git a/codenet/public_test_cases/p00875/input.1.txt b/codenet/public_test_cases/p00875/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfc5b1816b6431bcb66b9cc1530382517bfe35ec --- /dev/null +++ b/codenet/public_test_cases/p00875/input.1.txt @@ -0,0 +1,29 @@ +2 +a bb +b aa +a +bbbbbbbb +1 +a aa +a +aaaaa +3 +ab aab +abc aadc +ad dee +abc +deeeeeeeec +10 +a abc +b bai +c acf +d bed +e abh +f fag +g abe +h bag +i aaj +j bbb +a +abacfaabe +0 diff --git a/codenet/public_test_cases/p00875/output.0.txt b/codenet/public_test_cases/p00875/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..97f5f07f281fd5ee1fd427456086609aa4b3113b --- /dev/null +++ b/codenet/public_test_cases/p00875/output.0.txt @@ -0,0 +1,4 @@ +3 +-1 +7 +4 diff --git a/codenet/public_test_cases/p00875/output.1.txt b/codenet/public_test_cases/p00875/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97f5f07f281fd5ee1fd427456086609aa4b3113b --- /dev/null +++ b/codenet/public_test_cases/p00875/output.1.txt @@ -0,0 +1,4 @@ +3 +-1 +7 +4 diff --git a/codenet/public_test_cases/p00876/input.0.txt b/codenet/public_test_cases/p00876/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a35f3f582c1ff6bdc9d85d898ee78f9d3da8e0cc --- /dev/null +++ b/codenet/public_test_cases/p00876/input.0.txt @@ -0,0 +1,16 @@ +2 +10 30 +15 20 +2 +10 240 +15 160 +3 +2 6 +7 2 +8 2 +4 +2 4 +7 2 +8 2 +18 1 +0 diff --git a/codenet/public_test_cases/p00876/input.1.txt b/codenet/public_test_cases/p00876/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a35f3f582c1ff6bdc9d85d898ee78f9d3da8e0cc --- /dev/null +++ b/codenet/public_test_cases/p00876/input.1.txt @@ -0,0 +1,16 @@ +2 +10 30 +15 20 +2 +10 240 +15 160 +3 +2 6 +7 2 +8 2 +4 +2 4 +7 2 +8 2 +18 1 +0 diff --git a/codenet/public_test_cases/p00876/output.0.txt b/codenet/public_test_cases/p00876/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..148e0e9a34e9eca3bf7edd03a130874f0cf4a37e --- /dev/null +++ b/codenet/public_test_cases/p00876/output.0.txt @@ -0,0 +1,4 @@ +600 +4800 +36 +40 diff --git a/codenet/public_test_cases/p00876/output.1.txt b/codenet/public_test_cases/p00876/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..148e0e9a34e9eca3bf7edd03a130874f0cf4a37e --- /dev/null +++ b/codenet/public_test_cases/p00876/output.1.txt @@ -0,0 +1,4 @@ +600 +4800 +36 +40 diff --git a/codenet/public_test_cases/p00877/input.0.txt b/codenet/public_test_cases/p00877/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1eec29514f55e30798f53a2ec58a3dd2f815e04 --- /dev/null +++ b/codenet/public_test_cases/p00877/input.0.txt @@ -0,0 +1,61 @@ +3 3 +100 700 +200 200 +600 600 +500 100 +500 300 +800 500 +3 3 +100 300 +400 600 +400 100 +600 400 +500 900 +300 300 +3 4 +300 300 +500 300 +400 600 +100 100 +200 900 +500 900 +800 100 +1 2 +300 300 +100 100 +500 500 +1 1 +100 100 +200 100 +2 2 +0 0 +500 700 +1000 1400 +1500 2100 +2 2 +0 0 +1000 1000 +1000 0 +0 1000 +3 3 +0 100 +4999 102 +10000 103 +5001 102 +10000 102 +0 101 +3 3 +100 100 +200 100 +100 200 +0 0 +400 0 +0 400 +3 3 +2813 1640 +2583 2892 +2967 1916 +541 3562 +9298 3686 +7443 7921 +0 0 diff --git a/codenet/public_test_cases/p00877/input.1.txt b/codenet/public_test_cases/p00877/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1eec29514f55e30798f53a2ec58a3dd2f815e04 --- /dev/null +++ b/codenet/public_test_cases/p00877/input.1.txt @@ -0,0 +1,61 @@ +3 3 +100 700 +200 200 +600 600 +500 100 +500 300 +800 500 +3 3 +100 300 +400 600 +400 100 +600 400 +500 900 +300 300 +3 4 +300 300 +500 300 +400 600 +100 100 +200 900 +500 900 +800 100 +1 2 +300 300 +100 100 +500 500 +1 1 +100 100 +200 100 +2 2 +0 0 +500 700 +1000 1400 +1500 2100 +2 2 +0 0 +1000 1000 +1000 0 +0 1000 +3 3 +0 100 +4999 102 +10000 103 +5001 102 +10000 102 +0 101 +3 3 +100 100 +200 100 +100 200 +0 0 +400 0 +0 400 +3 3 +2813 1640 +2583 2892 +2967 1916 +541 3562 +9298 3686 +7443 7921 +0 0 diff --git a/codenet/public_test_cases/p00877/output.0.txt b/codenet/public_test_cases/p00877/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0268770b2979ccc57a517e8a5ce3b5afa736d98e --- /dev/null +++ b/codenet/public_test_cases/p00877/output.0.txt @@ -0,0 +1,10 @@ +YES +NO +NO +NO +YES +YES +NO +NO +NO +YES diff --git a/codenet/public_test_cases/p00877/output.1.txt b/codenet/public_test_cases/p00877/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0268770b2979ccc57a517e8a5ce3b5afa736d98e --- /dev/null +++ b/codenet/public_test_cases/p00877/output.1.txt @@ -0,0 +1,10 @@ +YES +NO +NO +NO +YES +YES +NO +NO +NO +YES diff --git a/codenet/public_test_cases/p00878/input.0.txt b/codenet/public_test_cases/p00878/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38c28d0bae5490e23b889fa863e9ca048ce261c1 --- /dev/null +++ b/codenet/public_test_cases/p00878/input.0.txt @@ -0,0 +1,40 @@ +2 +90 90 80 20 +80 20 75 50 +50 35 +2 +90 90 80 20 +75 50 80 20 +55 20 +3 +5 90 15 70 +95 90 85 75 +20 67 20 73 +20 75 +3 +5 90 15 70 +5 10 15 55 +20 67 20 73 +75 80 +8 +1 48 1 50 +10 73 10 75 +31 87 31 89 +91 94 91 96 +63 97 62 96 +63 80 61 82 +39 97 41 95 +62 89 62 90 +41 93 +5 +2 1 1 1 +-95 1 -96 1 +-190 1 -191 1 +-283 1 -284 1 +-373 1 -374 1 +-450 1 +2 +77 17 89 8 +103 13 85 10 +53 36 +0 diff --git a/codenet/public_test_cases/p00878/input.1.txt b/codenet/public_test_cases/p00878/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38c28d0bae5490e23b889fa863e9ca048ce261c1 --- /dev/null +++ b/codenet/public_test_cases/p00878/input.1.txt @@ -0,0 +1,40 @@ +2 +90 90 80 20 +80 20 75 50 +50 35 +2 +90 90 80 20 +75 50 80 20 +55 20 +3 +5 90 15 70 +95 90 85 75 +20 67 20 73 +20 75 +3 +5 90 15 70 +5 10 15 55 +20 67 20 73 +75 80 +8 +1 48 1 50 +10 73 10 75 +31 87 31 89 +91 94 91 96 +63 97 62 96 +63 80 61 82 +39 97 41 95 +62 89 62 90 +41 93 +5 +2 1 1 1 +-95 1 -96 1 +-190 1 -191 1 +-283 1 -284 1 +-373 1 -374 1 +-450 1 +2 +77 17 89 8 +103 13 85 10 +53 36 +0 diff --git a/codenet/public_test_cases/p00878/output.0.txt b/codenet/public_test_cases/p00878/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..991bf9e7b68121dca3d6a001c0ae1c2b42871dff --- /dev/null +++ b/codenet/public_test_cases/p00878/output.0.txt @@ -0,0 +1,7 @@ +3 +4 +3 +2 +32 +1 +0 diff --git a/codenet/public_test_cases/p00878/output.1.txt b/codenet/public_test_cases/p00878/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..991bf9e7b68121dca3d6a001c0ae1c2b42871dff --- /dev/null +++ b/codenet/public_test_cases/p00878/output.1.txt @@ -0,0 +1,7 @@ +3 +4 +3 +2 +32 +1 +0 diff --git a/codenet/public_test_cases/p00879/input.0.txt b/codenet/public_test_cases/p00879/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec22578fa47f14c5d06c63947d949d9699be162b --- /dev/null +++ b/codenet/public_test_cases/p00879/input.0.txt @@ -0,0 +1,10 @@ +N2+H2->NH3. +Na+Cl2->NaCl. +Ca(OH)2+CO2->CaCO3+H2O. +CaCl2+AgNO3->Ca(NO3)2+AgCl. +C2H5OH+O2->CO2+H2O. +C4H10+O2->CO2+H2O. +A12B23+C34D45+ABCD->A6D7+B8C9. +A98B+B98C+C98->A98B99C99. +A2+B3+C5+D7+E11+F13->ABCDEF. +. diff --git a/codenet/public_test_cases/p00879/input.1.txt b/codenet/public_test_cases/p00879/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec22578fa47f14c5d06c63947d949d9699be162b --- /dev/null +++ b/codenet/public_test_cases/p00879/input.1.txt @@ -0,0 +1,10 @@ +N2+H2->NH3. +Na+Cl2->NaCl. +Ca(OH)2+CO2->CaCO3+H2O. +CaCl2+AgNO3->Ca(NO3)2+AgCl. +C2H5OH+O2->CO2+H2O. +C4H10+O2->CO2+H2O. +A12B23+C34D45+ABCD->A6D7+B8C9. +A98B+B98C+C98->A98B99C99. +A2+B3+C5+D7+E11+F13->ABCDEF. +. diff --git a/codenet/public_test_cases/p00879/output.0.txt b/codenet/public_test_cases/p00879/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..301a6005c5704c4534d9dce31b3514fe50b9c7a0 --- /dev/null +++ b/codenet/public_test_cases/p00879/output.0.txt @@ -0,0 +1,9 @@ +1 3 2 +2 1 2 +1 1 1 1 +1 2 1 2 +1 3 2 3 +2 13 8 10 +2 123 33042 5511 4136 +1 1 1 1 +15015 10010 6006 4290 2730 2310 30030 diff --git a/codenet/public_test_cases/p00879/output.1.txt b/codenet/public_test_cases/p00879/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..301a6005c5704c4534d9dce31b3514fe50b9c7a0 --- /dev/null +++ b/codenet/public_test_cases/p00879/output.1.txt @@ -0,0 +1,9 @@ +1 3 2 +2 1 2 +1 1 1 1 +1 2 1 2 +1 3 2 3 +2 13 8 10 +2 123 33042 5511 4136 +1 1 1 1 +15015 10010 6006 4290 2730 2310 30030 diff --git a/codenet/public_test_cases/p00880/input.0.txt b/codenet/public_test_cases/p00880/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e56388dfbe1a07bf93fbc1d9f889700f1ac8f3a --- /dev/null +++ b/codenet/public_test_cases/p00880/input.0.txt @@ -0,0 +1,10 @@ +20 80 -40 -20 120 -20 +20 -20 120 -20 -40 80 +0 0 1 0 0 1 +0 0 999 1 -999 1 +897 -916 847 -972 890 -925 +999 999 -999 -998 -998 -999 +-999 -999 999 -999 0 731 +-999 -999 999 -464 -464 999 +979 -436 -955 -337 157 -439 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00880/input.1.txt b/codenet/public_test_cases/p00880/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e56388dfbe1a07bf93fbc1d9f889700f1ac8f3a --- /dev/null +++ b/codenet/public_test_cases/p00880/input.1.txt @@ -0,0 +1,10 @@ +20 80 -40 -20 120 -20 +20 -20 120 -20 -40 80 +0 0 1 0 0 1 +0 0 999 1 -999 1 +897 -916 847 -972 890 -925 +999 999 -999 -998 -998 -999 +-999 -999 999 -999 0 731 +-999 -999 999 -464 -464 999 +979 -436 -955 -337 157 -439 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00880/output.0.txt b/codenet/public_test_cases/p00880/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..addd24b3ecb7ad3a5ce1ff41e46334d96ad023d1 --- /dev/null +++ b/codenet/public_test_cases/p00880/output.0.txt @@ -0,0 +1,9 @@ +21.565935 24.409005 27.107493 +9.942044 19.150565 19.913790 +0.148847 0.207107 0.207107 +0.125125 0.499750 0.499750 +0.373458 0.383897 0.100456 +0.706768 0.353509 0.353509 +365.638023 365.638023 365.601038 +378.524085 378.605339 378.605339 +21.895803 22.052921 5.895714 diff --git a/codenet/public_test_cases/p00880/output.1.txt b/codenet/public_test_cases/p00880/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..addd24b3ecb7ad3a5ce1ff41e46334d96ad023d1 --- /dev/null +++ b/codenet/public_test_cases/p00880/output.1.txt @@ -0,0 +1,9 @@ +21.565935 24.409005 27.107493 +9.942044 19.150565 19.913790 +0.148847 0.207107 0.207107 +0.125125 0.499750 0.499750 +0.373458 0.383897 0.100456 +0.706768 0.353509 0.353509 +365.638023 365.638023 365.601038 +378.524085 378.605339 378.605339 +21.895803 22.052921 5.895714 diff --git a/codenet/public_test_cases/p00881/input.0.txt b/codenet/public_test_cases/p00881/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8edfcc0eddd17efcb660deb783cae508db54a12 --- /dev/null +++ b/codenet/public_test_cases/p00881/input.0.txt @@ -0,0 +1,71 @@ +8 1 +11010101 +11 4 +00111001100 +01001101011 +01010000011 +01100110001 +11 16 +01000101111 +01011000000 +01011111001 +01101101001 +01110010111 +01110100111 +10000001010 +10010001000 +10010110100 +10100010100 +10101010110 +10110100010 +11001010011 +11011001001 +11111000111 +11111011101 +11 12 +10000000000 +01000000000 +00100000000 +00010000000 +00001000000 +00000100000 +00000010000 +00000001000 +00000000100 +00000000010 +00000000001 +00000000000 +9 32 +001000000 +000100000 +000010000 +000001000 +000000100 +000000010 +000000001 +000000000 +011000000 +010100000 +010010000 +010001000 +010000100 +010000010 +010000001 +010000000 +101000000 +100100000 +100010000 +100001000 +100000100 +100000010 +100000001 +100000000 +111000000 +110100000 +110010000 +110001000 +110000100 +110000010 +110000001 +110000000 +0 0 diff --git a/codenet/public_test_cases/p00881/input.1.txt b/codenet/public_test_cases/p00881/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8edfcc0eddd17efcb660deb783cae508db54a12 --- /dev/null +++ b/codenet/public_test_cases/p00881/input.1.txt @@ -0,0 +1,71 @@ +8 1 +11010101 +11 4 +00111001100 +01001101011 +01010000011 +01100110001 +11 16 +01000101111 +01011000000 +01011111001 +01101101001 +01110010111 +01110100111 +10000001010 +10010001000 +10010110100 +10100010100 +10101010110 +10110100010 +11001010011 +11011001001 +11111000111 +11111011101 +11 12 +10000000000 +01000000000 +00100000000 +00010000000 +00001000000 +00000100000 +00000010000 +00000001000 +00000000100 +00000000010 +00000000001 +00000000000 +9 32 +001000000 +000100000 +000010000 +000001000 +000000100 +000000010 +000000001 +000000000 +011000000 +010100000 +010010000 +010001000 +010000100 +010000010 +010000001 +010000000 +101000000 +100100000 +100010000 +100001000 +100000100 +100000010 +100000001 +100000000 +111000000 +110100000 +110010000 +110001000 +110000100 +110000010 +110000001 +110000000 +0 0 diff --git a/codenet/public_test_cases/p00881/output.0.txt b/codenet/public_test_cases/p00881/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38de7dbeced0db6aaa18a98aa777ac9f72a9a91e --- /dev/null +++ b/codenet/public_test_cases/p00881/output.0.txt @@ -0,0 +1,5 @@ +0 +2 +4 +11 +9 diff --git a/codenet/public_test_cases/p00881/output.1.txt b/codenet/public_test_cases/p00881/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38de7dbeced0db6aaa18a98aa777ac9f72a9a91e --- /dev/null +++ b/codenet/public_test_cases/p00881/output.1.txt @@ -0,0 +1,5 @@ +0 +2 +4 +11 +9 diff --git a/codenet/public_test_cases/p00882/input.0.txt b/codenet/public_test_cases/p00882/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..10110c3588952ce62393f123723d030ec5f5e27f --- /dev/null +++ b/codenet/public_test_cases/p00882/input.0.txt @@ -0,0 +1,33 @@ +5 2 +C L S R C +C C S C C +6 4 +C C C C C C +S L R R C S +S S S L C S +C C C C C C +6 6 +C L S S S C +C C C S S C +C C C S S C +C L C S S C +C C L S S C +C S L S S C +6 6 +C S S S S C +S C S L C S +S C S R C S +S C L S C S +S C R S C S +C S S S S C +4 4 +S C C S +S C L S +S L C S +C C C C +6 4 +C R S S L C +C R L R L C +C S C C S C +C S S S S C +0 0 diff --git a/codenet/public_test_cases/p00882/input.1.txt b/codenet/public_test_cases/p00882/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..10110c3588952ce62393f123723d030ec5f5e27f --- /dev/null +++ b/codenet/public_test_cases/p00882/input.1.txt @@ -0,0 +1,33 @@ +5 2 +C L S R C +C C S C C +6 4 +C C C C C C +S L R R C S +S S S L C S +C C C C C C +6 6 +C L S S S C +C C C S S C +C C C S S C +C L C S S C +C C L S S C +C S L S S C +6 6 +C S S S S C +S C S L C S +S C S R C S +S C L S C S +S C R S C S +C S S S S C +4 4 +S C C S +S C L S +S L C S +C C C C +6 4 +C R S S L C +C R L R L C +C S C C S C +C S S S S C +0 0 diff --git a/codenet/public_test_cases/p00882/output.0.txt b/codenet/public_test_cases/p00882/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f38857a1bd4bfb17dd99dd5e30af25eed73ac91e --- /dev/null +++ b/codenet/public_test_cases/p00882/output.0.txt @@ -0,0 +1,6 @@ +24 +20 +148 +14 +0 +178 diff --git a/codenet/public_test_cases/p00882/output.1.txt b/codenet/public_test_cases/p00882/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f38857a1bd4bfb17dd99dd5e30af25eed73ac91e --- /dev/null +++ b/codenet/public_test_cases/p00882/output.1.txt @@ -0,0 +1,6 @@ +24 +20 +148 +14 +0 +178 diff --git a/codenet/public_test_cases/p00883/input.0.txt b/codenet/public_test_cases/p00883/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f14e4a9be01265f9f864e2821402db9cb8512a8b --- /dev/null +++ b/codenet/public_test_cases/p00883/input.0.txt @@ -0,0 +1,43 @@ +3 +... +.@. +... +3 +.## +.#. +@## +3 +##. +#.. +@.. +5 +....@ +##... +#.... +...#. +##.## +5 +#...# +...#. +#.... +...## +..@.. +5 +#.... +..... +..... +..... +..@.. +5 +#..#. +#.#.# +.#.#. +....# +.#@## +5 +..##. +..#.. +#.... +#.... +.#@.. +0 diff --git a/codenet/public_test_cases/p00883/input.1.txt b/codenet/public_test_cases/p00883/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f14e4a9be01265f9f864e2821402db9cb8512a8b --- /dev/null +++ b/codenet/public_test_cases/p00883/input.1.txt @@ -0,0 +1,43 @@ +3 +... +.@. +... +3 +.## +.#. +@## +3 +##. +#.. +@.. +5 +....@ +##... +#.... +...#. +##.## +5 +#...# +...#. +#.... +...## +..@.. +5 +#.... +..... +..... +..... +..@.. +5 +#..#. +#.#.# +.#.#. +....# +.#@## +5 +..##. +..#.. +#.... +#.... +.#@.. +0 diff --git a/codenet/public_test_cases/p00883/input.2.txt b/codenet/public_test_cases/p00883/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfaf4ed858b3d95e33a6a322f295b14f750cfa32 --- /dev/null +++ b/codenet/public_test_cases/p00883/input.2.txt @@ -0,0 +1,43 @@ +3 +... +.@. +... +3 +.## +.#. +@## +3 +. +.. +@.. +5 +....@ +... +.... +...#. +.## +5 +...# +...#. +.... +...## +..@.. +5 +.... +..... +..... +..... +..@.. +5 +..#. +.#.# +.#.#. +....# +.#@## +5 +..##. +..#.. +.... +.... +.#@.. +0 diff --git a/codenet/public_test_cases/p00883/output.0.txt b/codenet/public_test_cases/p00883/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db045b9ba449b0ad37f30abf32e446e53374457d --- /dev/null +++ b/codenet/public_test_cases/p00883/output.0.txt @@ -0,0 +1,8 @@ +0 +10 +-1 +3 +2 +1 +6 +4 diff --git a/codenet/public_test_cases/p00883/output.1.txt b/codenet/public_test_cases/p00883/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db045b9ba449b0ad37f30abf32e446e53374457d --- /dev/null +++ b/codenet/public_test_cases/p00883/output.1.txt @@ -0,0 +1,8 @@ +0 +10 +-1 +3 +2 +1 +6 +4 diff --git a/codenet/public_test_cases/p00883/output.2.txt b/codenet/public_test_cases/p00883/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db045b9ba449b0ad37f30abf32e446e53374457d --- /dev/null +++ b/codenet/public_test_cases/p00883/output.2.txt @@ -0,0 +1,8 @@ +0 +10 +-1 +3 +2 +1 +6 +4 diff --git a/codenet/public_test_cases/p00884/input.0.txt b/codenet/public_test_cases/p00884/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f5fbbc65c7a574c0b173d43ff7b229e849ca885 --- /dev/null +++ b/codenet/public_test_cases/p00884/input.0.txt @@ -0,0 +1,23 @@ +2 +development:alice,bob,design,eve. +design:carol,alice. +3 +one:another. +another:yetanother. +yetanother:dave. +3 +friends:alice,bob,bestfriends,carol,fran,badcompany. +bestfriends:eve,alice. +badcompany:dave,carol. +5 +a:b,c,d,e. +b:c,d,e,f. +c:d,e,f,g. +d:e,f,g,h. +e:f,g,h,i. +4 +aa:bb. +cc:dd,ee. +ff:gg. +bb:cc. +0 diff --git a/codenet/public_test_cases/p00884/input.1.txt b/codenet/public_test_cases/p00884/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f5fbbc65c7a574c0b173d43ff7b229e849ca885 --- /dev/null +++ b/codenet/public_test_cases/p00884/input.1.txt @@ -0,0 +1,23 @@ +2 +development:alice,bob,design,eve. +design:carol,alice. +3 +one:another. +another:yetanother. +yetanother:dave. +3 +friends:alice,bob,bestfriends,carol,fran,badcompany. +bestfriends:eve,alice. +badcompany:dave,carol. +5 +a:b,c,d,e. +b:c,d,e,f. +c:d,e,f,g. +d:e,f,g,h. +e:f,g,h,i. +4 +aa:bb. +cc:dd,ee. +ff:gg. +bb:cc. +0 diff --git a/codenet/public_test_cases/p00884/output.0.txt b/codenet/public_test_cases/p00884/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c3873e6a6d0c53d642825b2e631f038a7de9bf2 --- /dev/null +++ b/codenet/public_test_cases/p00884/output.0.txt @@ -0,0 +1,5 @@ +4 +1 +6 +4 +2 diff --git a/codenet/public_test_cases/p00884/output.1.txt b/codenet/public_test_cases/p00884/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c3873e6a6d0c53d642825b2e631f038a7de9bf2 --- /dev/null +++ b/codenet/public_test_cases/p00884/output.1.txt @@ -0,0 +1,5 @@ +4 +1 +6 +4 +2 diff --git a/codenet/public_test_cases/p00885/input.0.txt b/codenet/public_test_cases/p00885/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e82579356b797bb3ee34473b1bc39e5d945c50d8 --- /dev/null +++ b/codenet/public_test_cases/p00885/input.0.txt @@ -0,0 +1,28 @@ +2 +10 100 +100 270 +2 +10 100 +100 280 +3 +100 150 +10 360 +40 450 +3 +100 150 +10 360 +40 440 +2 +100 10 +50 200 +2 +100 100 +50 110 +1 +15 10 +4 +1 10 +2 20 +3 100 +90 200 +0 diff --git a/codenet/public_test_cases/p00885/input.1.txt b/codenet/public_test_cases/p00885/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e82579356b797bb3ee34473b1bc39e5d945c50d8 --- /dev/null +++ b/codenet/public_test_cases/p00885/input.1.txt @@ -0,0 +1,28 @@ +2 +10 100 +100 270 +2 +10 100 +100 280 +3 +100 150 +10 360 +40 450 +3 +100 150 +10 360 +40 440 +2 +100 10 +50 200 +2 +100 100 +50 110 +1 +15 10 +4 +1 10 +2 20 +3 100 +90 200 +0 diff --git a/codenet/public_test_cases/p00885/output.0.txt b/codenet/public_test_cases/p00885/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6b07f051426b34ee520d5c43d4c975266e5cfa5 --- /dev/null +++ b/codenet/public_test_cases/p00885/output.0.txt @@ -0,0 +1,8 @@ +OK 220 +OK 200 +OK 260 +OK 280 +NG 1 +NG 2 +NG 1 +OK 188 diff --git a/codenet/public_test_cases/p00885/output.1.txt b/codenet/public_test_cases/p00885/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6b07f051426b34ee520d5c43d4c975266e5cfa5 --- /dev/null +++ b/codenet/public_test_cases/p00885/output.1.txt @@ -0,0 +1,8 @@ +OK 220 +OK 200 +OK 260 +OK 280 +NG 1 +NG 2 +NG 1 +OK 188 diff --git a/codenet/public_test_cases/p00886/input.0.txt b/codenet/public_test_cases/p00886/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ce773b594caefd9b6db459d7a5160067ecd5cb3 --- /dev/null +++ b/codenet/public_test_cases/p00886/input.0.txt @@ -0,0 +1,34 @@ +2 +1 +3 +5 3 2 +3 +6 3 2 +5 +9 8 7 6 6 4 3 2 2 1 +6 +9 8 8 7 6 6 5 5 3 3 3 2 2 1 1 +6 +11 10 9 8 7 6 6 5 5 4 3 2 2 1 1 +7 +72 65 55 51 48 45 40 38 34 32 27 25 24 23 21 17 14 13 11 10 7 +20 +190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 +170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 +150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 +130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 +110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 +90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 +70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 +50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 +30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 +10 9 8 7 6 5 4 3 2 1 +19 +60 59 58 56 53 52 51 50 48 48 47 46 45 45 44 43 43 42 42 41 41 40 40 40 +40 40 40 40 39 39 39 38 38 38 37 37 36 36 35 35 34 33 33 32 32 32 31 31 +30 30 30 29 28 28 28 28 27 27 26 26 25 25 25 25 24 24 23 23 23 23 22 22 +22 22 21 21 21 21 20 20 20 20 20 20 20 20 20 20 20 20 20 19 19 19 19 19 +18 18 18 18 18 17 17 17 17 16 16 16 15 15 15 15 14 14 13 13 13 12 12 12 +12 12 11 11 11 10 10 10 10 10 9 9 8 8 8 8 8 8 7 7 7 6 6 6 5 5 5 5 5 5 4 +4 4 3 3 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 +0 diff --git a/codenet/public_test_cases/p00886/input.1.txt b/codenet/public_test_cases/p00886/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ce773b594caefd9b6db459d7a5160067ecd5cb3 --- /dev/null +++ b/codenet/public_test_cases/p00886/input.1.txt @@ -0,0 +1,34 @@ +2 +1 +3 +5 3 2 +3 +6 3 2 +5 +9 8 7 6 6 4 3 2 2 1 +6 +9 8 8 7 6 6 5 5 3 3 3 2 2 1 1 +6 +11 10 9 8 7 6 6 5 5 4 3 2 2 1 1 +7 +72 65 55 51 48 45 40 38 34 32 27 25 24 23 21 17 14 13 11 10 7 +20 +190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 +170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 +150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 +130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 +110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 +90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 +70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 +50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 +30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 +10 9 8 7 6 5 4 3 2 1 +19 +60 59 58 56 53 52 51 50 48 48 47 46 45 45 44 43 43 42 42 41 41 40 40 40 +40 40 40 40 39 39 39 38 38 38 37 37 36 36 35 35 34 33 33 32 32 32 31 31 +30 30 30 29 28 28 28 28 27 27 26 26 25 25 25 25 24 24 23 23 23 23 22 22 +22 22 21 21 21 21 20 20 20 20 20 20 20 20 20 20 20 20 20 19 19 19 19 19 +18 18 18 18 18 17 17 17 17 16 16 16 15 15 15 15 14 14 13 13 13 12 12 12 +12 12 11 11 11 10 10 10 10 10 9 9 8 8 8 8 8 8 7 7 7 6 6 6 5 5 5 5 5 5 4 +4 4 3 3 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 +0 diff --git a/codenet/public_test_cases/p00886/output.0.txt b/codenet/public_test_cases/p00886/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..806bc714b58d631ae5759391e52c1f3aff5872df --- /dev/null +++ b/codenet/public_test_cases/p00886/output.0.txt @@ -0,0 +1,23 @@ +1 +----- +2 3 +3 2 +----- +----- +1 2 4 2 +2 4 2 1 +----- +1 2 3 2 1 +----- +1 1 4 2 3 +1 5 1 2 2 +2 2 1 5 1 +3 2 4 1 1 +----- +7 14 11 13 10 17 +17 10 13 11 14 7 +----- +----- +1 1 2 3 5 8 1 1 2 3 5 8 1 1 2 3 5 8 +8 5 3 2 1 1 8 5 3 2 1 1 8 5 3 2 1 1 +----- diff --git a/codenet/public_test_cases/p00886/output.1.txt b/codenet/public_test_cases/p00886/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..806bc714b58d631ae5759391e52c1f3aff5872df --- /dev/null +++ b/codenet/public_test_cases/p00886/output.1.txt @@ -0,0 +1,23 @@ +1 +----- +2 3 +3 2 +----- +----- +1 2 4 2 +2 4 2 1 +----- +1 2 3 2 1 +----- +1 1 4 2 3 +1 5 1 2 2 +2 2 1 5 1 +3 2 4 1 1 +----- +7 14 11 13 10 17 +17 10 13 11 14 7 +----- +----- +1 1 2 3 5 8 1 1 2 3 5 8 1 1 2 3 5 8 +8 5 3 2 1 1 8 5 3 2 1 1 8 5 3 2 1 1 +----- diff --git a/codenet/public_test_cases/p00887/input.0.txt b/codenet/public_test_cases/p00887/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94132bf4aa3b6c4f451b66e0e67137fed673cb90 --- /dev/null +++ b/codenet/public_test_cases/p00887/input.0.txt @@ -0,0 +1,68 @@ +1 1 1 +1 +2 2 1 +1 1 +1 1 +3 2 1 +1 0 1 +0 1 0 +3 3 1 +1 0 1 +0 1 0 +1 0 1 +4 4 2 +1 1 0 1 +0 0 0 1 +1 0 1 1 +1 0 0 0 +5 5 1 +1 1 1 0 1 +0 1 0 1 0 +1 0 1 0 1 +0 1 0 1 0 +1 0 1 0 1 +5 5 2 +0 0 0 0 0 +0 0 0 0 0 +0 0 1 0 0 +0 0 0 0 0 +0 0 0 0 0 +11 11 3 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 1 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +11 11 3 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 1 1 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +13 13 7 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 1 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 diff --git a/codenet/public_test_cases/p00887/input.1.txt b/codenet/public_test_cases/p00887/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94132bf4aa3b6c4f451b66e0e67137fed673cb90 --- /dev/null +++ b/codenet/public_test_cases/p00887/input.1.txt @@ -0,0 +1,68 @@ +1 1 1 +1 +2 2 1 +1 1 +1 1 +3 2 1 +1 0 1 +0 1 0 +3 3 1 +1 0 1 +0 1 0 +1 0 1 +4 4 2 +1 1 0 1 +0 0 0 1 +1 0 1 1 +1 0 0 0 +5 5 1 +1 1 1 0 1 +0 1 0 1 0 +1 0 1 0 1 +0 1 0 1 0 +1 0 1 0 1 +5 5 2 +0 0 0 0 0 +0 0 0 0 0 +0 0 1 0 0 +0 0 0 0 0 +0 0 0 0 0 +11 11 3 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 1 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +11 11 3 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 1 1 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 +13 13 7 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 1 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 diff --git a/codenet/public_test_cases/p00887/output.0.txt b/codenet/public_test_cases/p00887/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4b3e5fe2a0b294b353a491db492aa9b91816fd7 --- /dev/null +++ b/codenet/public_test_cases/p00887/output.0.txt @@ -0,0 +1,10 @@ +1 +1 +0 +1 +0 +0 +1 +1 +0 +1 diff --git a/codenet/public_test_cases/p00887/output.1.txt b/codenet/public_test_cases/p00887/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4b3e5fe2a0b294b353a491db492aa9b91816fd7 --- /dev/null +++ b/codenet/public_test_cases/p00887/output.1.txt @@ -0,0 +1,10 @@ +1 +1 +0 +1 +0 +0 +1 +1 +0 +1 diff --git a/codenet/public_test_cases/p00888/input.0.txt b/codenet/public_test_cases/p00888/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91777cd206fd194c7ba68942800151e9be82c4c7 --- /dev/null +++ b/codenet/public_test_cases/p00888/input.0.txt @@ -0,0 +1,33 @@ +6 +0 0 +3 4 +9 12 +17 6 +21 9 +33 0 +5 +0 0 +10 0 +20 0 +30 0 +40 0 +10 +0 0 +1 2 +3 0 +6 3 +9 0 +11 2 +13 0 +15 2 +16 2 +18 0 +7 +0 0 +150 997 +300 1 +450 999 +600 2 +750 998 +900 0 +0 diff --git a/codenet/public_test_cases/p00888/input.1.txt b/codenet/public_test_cases/p00888/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91777cd206fd194c7ba68942800151e9be82c4c7 --- /dev/null +++ b/codenet/public_test_cases/p00888/input.1.txt @@ -0,0 +1,33 @@ +6 +0 0 +3 4 +9 12 +17 6 +21 9 +33 0 +5 +0 0 +10 0 +20 0 +30 0 +40 0 +10 +0 0 +1 2 +3 0 +6 3 +9 0 +11 2 +13 0 +15 2 +16 2 +18 0 +7 +0 0 +150 997 +300 1 +450 999 +600 2 +750 998 +900 0 +0 diff --git a/codenet/public_test_cases/p00888/output.0.txt b/codenet/public_test_cases/p00888/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d31cab8febf6d565d0c9cbbfe721e9e34f559ae4 --- /dev/null +++ b/codenet/public_test_cases/p00888/output.0.txt @@ -0,0 +1,4 @@ +52.5 +40.0 +30.3356209304689 +10078.072814085803 diff --git a/codenet/public_test_cases/p00888/output.1.txt b/codenet/public_test_cases/p00888/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d31cab8febf6d565d0c9cbbfe721e9e34f559ae4 --- /dev/null +++ b/codenet/public_test_cases/p00888/output.1.txt @@ -0,0 +1,4 @@ +52.5 +40.0 +30.3356209304689 +10078.072814085803 diff --git a/codenet/public_test_cases/p00889/input.0.txt b/codenet/public_test_cases/p00889/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c8d115c857fbcfd0b3c09a7d64f7df4698ad8fb --- /dev/null +++ b/codenet/public_test_cases/p00889/input.0.txt @@ -0,0 +1,6 @@ +3 32 64 7 +4 35 89 5 +5 555 442 3 +5 777 465 11 +100000 666 701622763 65537 +0 0 0 0 diff --git a/codenet/public_test_cases/p00889/input.1.txt b/codenet/public_test_cases/p00889/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c8d115c857fbcfd0b3c09a7d64f7df4698ad8fb --- /dev/null +++ b/codenet/public_test_cases/p00889/input.1.txt @@ -0,0 +1,6 @@ +3 32 64 7 +4 35 89 5 +5 555 442 3 +5 777 465 11 +100000 666 701622763 65537 +0 0 0 0 diff --git a/codenet/public_test_cases/p00889/output.0.txt b/codenet/public_test_cases/p00889/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d07661aa938924e6d860a6c355da66f9bdb3477b --- /dev/null +++ b/codenet/public_test_cases/p00889/output.0.txt @@ -0,0 +1,5 @@ +2 +4 +6 +3 +68530 diff --git a/codenet/public_test_cases/p00889/output.1.txt b/codenet/public_test_cases/p00889/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d07661aa938924e6d860a6c355da66f9bdb3477b --- /dev/null +++ b/codenet/public_test_cases/p00889/output.1.txt @@ -0,0 +1,5 @@ +2 +4 +6 +3 +68530 diff --git a/codenet/public_test_cases/p00890/input.0.txt b/codenet/public_test_cases/p00890/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea96a72ecc385879f4507f0c706448020ffe4898 --- /dev/null +++ b/codenet/public_test_cases/p00890/input.0.txt @@ -0,0 +1,37 @@ +3 3 3 +1 2 3 +2 3 3 +1 3 8 +12 12 2010 +1 2 0 +2 3 3000 +3 4 0 +4 5 3000 +5 6 3000 +6 12 2010 +2 7 100 +7 8 200 +8 9 300 +9 10 400 +10 11 500 +11 6 512 +10 18 1 +1 2 9 +1 3 2 +1 4 6 +2 5 0 +2 6 10 +2 7 2 +3 5 10 +3 6 3 +3 7 10 +4 7 6 +5 8 10 +6 8 2 +6 9 11 +7 9 3 +8 9 9 +8 10 8 +9 10 1 +8 2 1 +0 0 0 diff --git a/codenet/public_test_cases/p00890/input.1.txt b/codenet/public_test_cases/p00890/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea96a72ecc385879f4507f0c706448020ffe4898 --- /dev/null +++ b/codenet/public_test_cases/p00890/input.1.txt @@ -0,0 +1,37 @@ +3 3 3 +1 2 3 +2 3 3 +1 3 8 +12 12 2010 +1 2 0 +2 3 3000 +3 4 0 +4 5 3000 +5 6 3000 +6 12 2010 +2 7 100 +7 8 200 +8 9 300 +9 10 400 +10 11 500 +11 6 512 +10 18 1 +1 2 9 +1 3 2 +1 4 6 +2 5 0 +2 6 10 +2 7 2 +3 5 10 +3 6 3 +3 7 10 +4 7 6 +5 8 10 +6 8 2 +6 9 11 +7 9 3 +8 9 9 +8 10 8 +9 10 1 +8 2 1 +0 0 0 diff --git a/codenet/public_test_cases/p00890/output.0.txt b/codenet/public_test_cases/p00890/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01e79c32a8c99c557f0757da7cb6d65b3414466d --- /dev/null +++ b/codenet/public_test_cases/p00890/output.0.txt @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/codenet/public_test_cases/p00890/output.1.txt b/codenet/public_test_cases/p00890/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01e79c32a8c99c557f0757da7cb6d65b3414466d --- /dev/null +++ b/codenet/public_test_cases/p00890/output.1.txt @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/codenet/public_test_cases/p00891/input.0.txt b/codenet/public_test_cases/p00891/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdd7f6db2e1f66874432d7eeb6705608ec625c1d --- /dev/null +++ b/codenet/public_test_cases/p00891/input.0.txt @@ -0,0 +1,25 @@ +48 3 3 +gAY4I4wA +gIIgIIgg +w4IAYAg4 +g +g +w +153 3 3 +kkkkkkkkkkkkkkkkkkkkkkkkkg +SSSSSSSSSSSSSSSSSSSSSSSSSQ +JJJJJJJJJJJJJJJJJJJJJJJJJI +g +Q +I +1 1 2 +A +A +A +384 3 2 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ +BCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/A +CDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/AB +A +A +0 0 0 diff --git a/codenet/public_test_cases/p00891/input.1.txt b/codenet/public_test_cases/p00891/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdd7f6db2e1f66874432d7eeb6705608ec625c1d --- /dev/null +++ b/codenet/public_test_cases/p00891/input.1.txt @@ -0,0 +1,25 @@ +48 3 3 +gAY4I4wA +gIIgIIgg +w4IAYAg4 +g +g +w +153 3 3 +kkkkkkkkkkkkkkkkkkkkkkkkkg +SSSSSSSSSSSSSSSSSSSSSSSSSQ +JJJJJJJJJJJJJJJJJJJJJJJJJI +g +Q +I +1 1 2 +A +A +A +384 3 2 +ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ +BCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/A +CDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/AB +A +A +0 0 0 diff --git a/codenet/public_test_cases/p00891/output.0.txt b/codenet/public_test_cases/p00891/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4487f9656ca7d0e77621945139f9116a4dc50c55 --- /dev/null +++ b/codenet/public_test_cases/p00891/output.0.txt @@ -0,0 +1,4 @@ +8 +51 +0 +98 diff --git a/codenet/public_test_cases/p00891/output.1.txt b/codenet/public_test_cases/p00891/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4487f9656ca7d0e77621945139f9116a4dc50c55 --- /dev/null +++ b/codenet/public_test_cases/p00891/output.1.txt @@ -0,0 +1,4 @@ +8 +51 +0 +98 diff --git a/codenet/public_test_cases/p00892/input.0.txt b/codenet/public_test_cases/p00892/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..657344da003358ffa5086327d8eed82318e2c6c6 --- /dev/null +++ b/codenet/public_test_cases/p00892/input.0.txt @@ -0,0 +1,48 @@ +4 3 +7 2 +3 3 +0 2 +3 1 +4 2 +0 1 +8 1 +4 4 +30 2 +30 12 +2 12 +2 2 +15 2 +30 8 +13 14 +2 8 +8 5 +13 5 +21 7 +21 9 +18 15 +11 15 +6 10 +6 8 +8 5 +10 12 +5 9 +15 6 +20 10 +18 12 +3 3 +5 5 +10 3 +10 10 +20 8 +10 15 +10 8 +4 4 +-98 99 +-99 -99 +99 -98 +99 97 +-99 99 +-98 -98 +99 -99 +96 99 +0 0 diff --git a/codenet/public_test_cases/p00892/input.1.txt b/codenet/public_test_cases/p00892/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..657344da003358ffa5086327d8eed82318e2c6c6 --- /dev/null +++ b/codenet/public_test_cases/p00892/input.1.txt @@ -0,0 +1,48 @@ +4 3 +7 2 +3 3 +0 2 +3 1 +4 2 +0 1 +8 1 +4 4 +30 2 +30 12 +2 12 +2 2 +15 2 +30 8 +13 14 +2 8 +8 5 +13 5 +21 7 +21 9 +18 15 +11 15 +6 10 +6 8 +8 5 +10 12 +5 9 +15 6 +20 10 +18 12 +3 3 +5 5 +10 3 +10 10 +20 8 +10 15 +10 8 +4 4 +-98 99 +-99 -99 +99 -98 +99 97 +-99 99 +-98 -98 +99 -99 +96 99 +0 0 diff --git a/codenet/public_test_cases/p00892/output.0.txt b/codenet/public_test_cases/p00892/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2da4a167bf4f8abfa6dae7f4b654b37dca9bd9c --- /dev/null +++ b/codenet/public_test_cases/p00892/output.0.txt @@ -0,0 +1,5 @@ +4.708333333333333 +1680.0000000000005 +491.1500000000007 +0.0 +7600258.4847715655 diff --git a/codenet/public_test_cases/p00892/output.1.txt b/codenet/public_test_cases/p00892/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2da4a167bf4f8abfa6dae7f4b654b37dca9bd9c --- /dev/null +++ b/codenet/public_test_cases/p00892/output.1.txt @@ -0,0 +1,5 @@ +4.708333333333333 +1680.0000000000005 +491.1500000000007 +0.0 +7600258.4847715655 diff --git a/codenet/public_test_cases/p00893/input.0.txt b/codenet/public_test_cases/p00893/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..498397669b98cd98de3f784e3bfab106cd264da9 --- /dev/null +++ b/codenet/public_test_cases/p00893/input.0.txt @@ -0,0 +1,51 @@ +1 +A=[1 2 3;4 5 6]. +1 +A=[[1 2 3;4 5 6] [7 8;9 10] [11;12];13 14 15 16 17 18]. +3 +B=[3 -2 1;-9 8 7]. +C=([1 2 3;4 5 6]+B)(2,3). +D=([1 2 3;4 5 6]+B)([1 2],[2 3]). +5 +A=2*[1 2;-3 4]'. +B=A([2 1 2],[2 1]). +A=[1 2;3 4]*3. +A=[2]*[1 2;3 4]. +A=[1 2;3 4]*[3]. +2 +A=[11 12 13;0 22 23;0 0 33]. +A=[A A';--A''' A]. +2 +A=[1 -1 1;1 1 -1;-1 1 1]*3. +A=[A -A+-A;-A'([3 2 1],[3 2 1]) -A']. +1 +A=1([1 1 1],[1 1 1 1]). +3 +A=[1 2 -3;4 -5 6;-7 8 9]. +B=A([3 1 2],[2 1 3]). +C=A*B-B*A+-A*-B-B*-A. +3 +A=[1 2 3 4 5]. +B=A'*A. +C=B([1 5],[5 1]). +3 +A=[-11 12 13;21 -22 23;31 32 -33]. +B=[1 0 0;0 1 0;0 0 1]. +C=[(A-B) (A+B)*B (A+B)*(B-A)([1 1 1],[3 2 1]) [1 2 3;2 1 1;-1 2 1]*(A-B)]. +3 +A=[11 12 13;0 22 23;0 0 33]. +B=[1 2]. +C=------A((((B))),B)(B,B)''''''. +2 +A=1+[2]+[[3]]+[[[4]]]+2*[[[[5]]]]*3. +B=[(-[([(-A)]+-A)])]. +8 +A=[1 2;3 4]. +B=[A A+[1 1;0 1]*4;A+[1 1;0 1]'*8 A+[1 1;0 1]''*12]. +C=B([1],[1]). +C=B([1],[1 2 3 4]). +C=B([1 2 3 4],[1]). +C=B([2 3],[2 3]). +A=[1 2;1 2]. +D=(A*-A+-A)'(A'(1,[1 2]),A'(2,[1 2])). +0 diff --git a/codenet/public_test_cases/p00893/input.1.txt b/codenet/public_test_cases/p00893/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..498397669b98cd98de3f784e3bfab106cd264da9 --- /dev/null +++ b/codenet/public_test_cases/p00893/input.1.txt @@ -0,0 +1,51 @@ +1 +A=[1 2 3;4 5 6]. +1 +A=[[1 2 3;4 5 6] [7 8;9 10] [11;12];13 14 15 16 17 18]. +3 +B=[3 -2 1;-9 8 7]. +C=([1 2 3;4 5 6]+B)(2,3). +D=([1 2 3;4 5 6]+B)([1 2],[2 3]). +5 +A=2*[1 2;-3 4]'. +B=A([2 1 2],[2 1]). +A=[1 2;3 4]*3. +A=[2]*[1 2;3 4]. +A=[1 2;3 4]*[3]. +2 +A=[11 12 13;0 22 23;0 0 33]. +A=[A A';--A''' A]. +2 +A=[1 -1 1;1 1 -1;-1 1 1]*3. +A=[A -A+-A;-A'([3 2 1],[3 2 1]) -A']. +1 +A=1([1 1 1],[1 1 1 1]). +3 +A=[1 2 -3;4 -5 6;-7 8 9]. +B=A([3 1 2],[2 1 3]). +C=A*B-B*A+-A*-B-B*-A. +3 +A=[1 2 3 4 5]. +B=A'*A. +C=B([1 5],[5 1]). +3 +A=[-11 12 13;21 -22 23;31 32 -33]. +B=[1 0 0;0 1 0;0 0 1]. +C=[(A-B) (A+B)*B (A+B)*(B-A)([1 1 1],[3 2 1]) [1 2 3;2 1 1;-1 2 1]*(A-B)]. +3 +A=[11 12 13;0 22 23;0 0 33]. +B=[1 2]. +C=------A((((B))),B)(B,B)''''''. +2 +A=1+[2]+[[3]]+[[[4]]]+2*[[[[5]]]]*3. +B=[(-[([(-A)]+-A)])]. +8 +A=[1 2;3 4]. +B=[A A+[1 1;0 1]*4;A+[1 1;0 1]'*8 A+[1 1;0 1]''*12]. +C=B([1],[1]). +C=B([1],[1 2 3 4]). +C=B([1 2 3 4],[1]). +C=B([2 3],[2 3]). +A=[1 2;1 2]. +D=(A*-A+-A)'(A'(1,[1 2]),A'(2,[1 2])). +0 diff --git a/codenet/public_test_cases/p00893/output.0.txt b/codenet/public_test_cases/p00893/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29ddce8cbd7ff40459432933f251bbd618517c50 --- /dev/null +++ b/codenet/public_test_cases/p00893/output.0.txt @@ -0,0 +1,107 @@ +1 2 3 +4 5 6 +----- +1 2 3 7 8 11 +4 5 6 9 10 12 +13 14 15 16 17 18 +----- +3 32766 1 +32759 8 7 +13 +0 4 +13 13 +----- +2 32762 +4 8 +8 4 +32762 2 +8 4 +3 6 +9 12 +2 4 +6 8 +3 6 +9 12 +----- +11 12 13 +0 22 23 +0 0 33 +11 12 13 11 0 0 +0 22 23 12 22 0 +0 0 33 13 23 33 +11 0 0 11 12 13 +12 22 0 0 22 23 +13 23 33 0 0 33 +----- +3 32765 3 +3 3 32765 +32765 3 3 +3 32765 3 32762 6 32762 +3 3 32765 32762 32762 6 +32765 3 3 6 32762 32762 +32765 3 32765 32765 32765 3 +32765 32765 3 3 32765 32765 +3 32765 32765 32765 3 32765 +----- +1 1 1 1 +1 1 1 1 +1 1 1 1 +----- +1 2 32765 +4 32763 6 +32761 8 9 +8 32761 9 +2 1 32765 +32763 4 6 +54 32734 32738 +32752 32750 174 +32598 186 32702 +----- +1 2 3 4 5 +1 2 3 4 5 +2 4 6 8 10 +3 6 9 12 15 +4 8 12 16 20 +5 10 15 20 25 +5 1 +25 5 +----- +32757 12 13 +21 32746 23 +31 32 32735 +1 0 0 +0 1 0 +0 0 1 +32756 12 13 32758 12 13 32573 32588 180 123 62 32725 +21 32745 23 21 32747 23 32469 32492 276 28 33 15 +31 32 32734 31 32 32736 32365 32396 372 85 32742 32767 +----- +11 12 13 +0 22 23 +0 0 33 +1 2 +11 12 +0 22 +----- +40 +80 +----- +1 2 +3 4 +1 2 5 6 +3 4 3 8 +9 2 13 14 +11 12 3 16 +1 +1 2 5 6 +1 +3 +9 +11 +4 3 +2 13 +1 2 +1 2 +32764 32764 +32764 32764 +----- diff --git a/codenet/public_test_cases/p00893/output.1.txt b/codenet/public_test_cases/p00893/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29ddce8cbd7ff40459432933f251bbd618517c50 --- /dev/null +++ b/codenet/public_test_cases/p00893/output.1.txt @@ -0,0 +1,107 @@ +1 2 3 +4 5 6 +----- +1 2 3 7 8 11 +4 5 6 9 10 12 +13 14 15 16 17 18 +----- +3 32766 1 +32759 8 7 +13 +0 4 +13 13 +----- +2 32762 +4 8 +8 4 +32762 2 +8 4 +3 6 +9 12 +2 4 +6 8 +3 6 +9 12 +----- +11 12 13 +0 22 23 +0 0 33 +11 12 13 11 0 0 +0 22 23 12 22 0 +0 0 33 13 23 33 +11 0 0 11 12 13 +12 22 0 0 22 23 +13 23 33 0 0 33 +----- +3 32765 3 +3 3 32765 +32765 3 3 +3 32765 3 32762 6 32762 +3 3 32765 32762 32762 6 +32765 3 3 6 32762 32762 +32765 3 32765 32765 32765 3 +32765 32765 3 3 32765 32765 +3 32765 32765 32765 3 32765 +----- +1 1 1 1 +1 1 1 1 +1 1 1 1 +----- +1 2 32765 +4 32763 6 +32761 8 9 +8 32761 9 +2 1 32765 +32763 4 6 +54 32734 32738 +32752 32750 174 +32598 186 32702 +----- +1 2 3 4 5 +1 2 3 4 5 +2 4 6 8 10 +3 6 9 12 15 +4 8 12 16 20 +5 10 15 20 25 +5 1 +25 5 +----- +32757 12 13 +21 32746 23 +31 32 32735 +1 0 0 +0 1 0 +0 0 1 +32756 12 13 32758 12 13 32573 32588 180 123 62 32725 +21 32745 23 21 32747 23 32469 32492 276 28 33 15 +31 32 32734 31 32 32736 32365 32396 372 85 32742 32767 +----- +11 12 13 +0 22 23 +0 0 33 +1 2 +11 12 +0 22 +----- +40 +80 +----- +1 2 +3 4 +1 2 5 6 +3 4 3 8 +9 2 13 14 +11 12 3 16 +1 +1 2 5 6 +1 +3 +9 +11 +4 3 +2 13 +1 2 +1 2 +32764 32764 +32764 32764 +----- diff --git a/codenet/public_test_cases/p00894/input.0.txt b/codenet/public_test_cases/p00894/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b65d0b69f5f84fad846ef00999638187b84ab3a --- /dev/null +++ b/codenet/public_test_cases/p00894/input.0.txt @@ -0,0 +1,37 @@ +14 +04/21 09:00 I 000 +04/21 09:00 I 001 +04/21 09:15 I 002 +04/21 09:30 O 001 +04/21 09:45 O 000 +04/21 10:00 O 002 +04/28 09:00 I 003 +04/28 09:15 I 000 +04/28 09:30 I 004 +04/28 09:45 O 004 +04/28 10:00 O 000 +04/28 10:15 O 003 +04/29 20:00 I 002 +04/29 21:30 O 002 +20 +06/01 09:00 I 001 +06/01 09:15 I 002 +06/01 09:15 I 003 +06/01 09:30 O 002 +06/01 10:00 I 000 +06/01 10:15 O 001 +06/01 10:30 I 002 +06/01 10:45 O 002 +06/01 11:00 I 001 +06/01 11:15 O 000 +06/01 11:30 I 002 +06/01 11:45 O 001 +06/01 12:00 O 002 +06/01 12:15 I 000 +06/01 12:30 I 002 +06/01 12:45 O 000 +06/01 13:00 I 000 +06/01 13:15 O 000 +06/01 13:30 O 002 +06/01 13:45 O 003 +0 diff --git a/codenet/public_test_cases/p00894/input.1.txt b/codenet/public_test_cases/p00894/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b65d0b69f5f84fad846ef00999638187b84ab3a --- /dev/null +++ b/codenet/public_test_cases/p00894/input.1.txt @@ -0,0 +1,37 @@ +14 +04/21 09:00 I 000 +04/21 09:00 I 001 +04/21 09:15 I 002 +04/21 09:30 O 001 +04/21 09:45 O 000 +04/21 10:00 O 002 +04/28 09:00 I 003 +04/28 09:15 I 000 +04/28 09:30 I 004 +04/28 09:45 O 004 +04/28 10:00 O 000 +04/28 10:15 O 003 +04/29 20:00 I 002 +04/29 21:30 O 002 +20 +06/01 09:00 I 001 +06/01 09:15 I 002 +06/01 09:15 I 003 +06/01 09:30 O 002 +06/01 10:00 I 000 +06/01 10:15 O 001 +06/01 10:30 I 002 +06/01 10:45 O 002 +06/01 11:00 I 001 +06/01 11:15 O 000 +06/01 11:30 I 002 +06/01 11:45 O 001 +06/01 12:00 O 002 +06/01 12:15 I 000 +06/01 12:30 I 002 +06/01 12:45 O 000 +06/01 13:00 I 000 +06/01 13:15 O 000 +06/01 13:30 O 002 +06/01 13:45 O 003 +0 diff --git a/codenet/public_test_cases/p00894/output.0.txt b/codenet/public_test_cases/p00894/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa145646691535b1d8b89d6fa201b8e3eda619b2 --- /dev/null +++ b/codenet/public_test_cases/p00894/output.0.txt @@ -0,0 +1,2 @@ +45 +120 diff --git a/codenet/public_test_cases/p00894/output.1.txt b/codenet/public_test_cases/p00894/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa145646691535b1d8b89d6fa201b8e3eda619b2 --- /dev/null +++ b/codenet/public_test_cases/p00894/output.1.txt @@ -0,0 +1,2 @@ +45 +120 diff --git a/codenet/public_test_cases/p00895/input.0.txt b/codenet/public_test_cases/p00895/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd28b77b6da407c5fce74f2b8b49836174d94292 --- /dev/null +++ b/codenet/public_test_cases/p00895/input.0.txt @@ -0,0 +1,30 @@ +5 7 +RRCABXT +AABMFAB +RROMJAC +APTADAB +YABADAO +3 13 +ABCDEFGHIJKLM +XMADAMIMADAMY +ACEGIKMOQSUWY +3 4 +DEFG +ACAB +HIJK +3 6 +ABCDEF +GHIAKL +MNOPQR +10 19 +JFZODYDXMZZPEYTRNCW +XVGHPOKEYNZTQFZJKOD +EYEHHQKHFZOVNRGOOLP +QFZOIHRQMGHPNISHXOC +DRGILJHSQEHHQLYTILL +NCSHQMKHTZZIHRPAUJA +NCCTINCLAUTFJHSZBVK +LPBAUJIUMBVQYKHTZCW +XMYHBVKUGNCWTLLAUID +EYNDCCWLEOODXYUMBVN +0 0 diff --git a/codenet/public_test_cases/p00895/input.1.txt b/codenet/public_test_cases/p00895/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd28b77b6da407c5fce74f2b8b49836174d94292 --- /dev/null +++ b/codenet/public_test_cases/p00895/input.1.txt @@ -0,0 +1,30 @@ +5 7 +RRCABXT +AABMFAB +RROMJAC +APTADAB +YABADAO +3 13 +ABCDEFGHIJKLM +XMADAMIMADAMY +ACEGIKMOQSUWY +3 4 +DEFG +ACAB +HIJK +3 6 +ABCDEF +GHIAKL +MNOPQR +10 19 +JFZODYDXMZZPEYTRNCW +XVGHPOKEYNZTQFZJKOD +EYEHHQKHFZOVNRGOOLP +QFZOIHRQMGHPNISHXOC +DRGILJHSQEHHQLYTILL +NCSHQMKHTZZIHRPAUJA +NCCTINCLAUTFJHSZBVK +LPBAUJIUMBVQYKHTZCW +XMYHBVKUGNCWTLLAUID +EYNDCCWLEOODXYUMBVN +0 0 diff --git a/codenet/public_test_cases/p00895/output.0.txt b/codenet/public_test_cases/p00895/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c7f88917bccadeedd7509db93f5577a373708d9 --- /dev/null +++ b/codenet/public_test_cases/p00895/output.0.txt @@ -0,0 +1,5 @@ +ABRACADABRA +MADAMIMADAM +ABAC +0 +ABCDEFGHIJKLMNOPQRSTUVWXYZHHHHHABCDEFGHIJKLMNOPQRSTUVWXYZ diff --git a/codenet/public_test_cases/p00895/output.1.txt b/codenet/public_test_cases/p00895/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c7f88917bccadeedd7509db93f5577a373708d9 --- /dev/null +++ b/codenet/public_test_cases/p00895/output.1.txt @@ -0,0 +1,5 @@ +ABRACADABRA +MADAMIMADAM +ABAC +0 +ABCDEFGHIJKLMNOPQRSTUVWXYZHHHHHABCDEFGHIJKLMNOPQRSTUVWXYZ diff --git a/codenet/public_test_cases/p00896/input.0.txt b/codenet/public_test_cases/p00896/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..711a55342f61699ab868bcb4c94cf970e9e650a0 --- /dev/null +++ b/codenet/public_test_cases/p00896/input.0.txt @@ -0,0 +1,33 @@ +4 +A +AND +CAT +DOG +Z XUW ZVX Z YZT. +2 +AZ +AY +ZA. +2 +AA +BB +CC. +16 +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +ABCDEFGHIJKLMNO +A B C D E F G H I J K L M N O ABCDEFGHIJKLMNO. +0 diff --git a/codenet/public_test_cases/p00896/input.1.txt b/codenet/public_test_cases/p00896/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..711a55342f61699ab868bcb4c94cf970e9e650a0 --- /dev/null +++ b/codenet/public_test_cases/p00896/input.1.txt @@ -0,0 +1,33 @@ +4 +A +AND +CAT +DOG +Z XUW ZVX Z YZT. +2 +AZ +AY +ZA. +2 +AA +BB +CC. +16 +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +ABCDEFGHIJKLMNO +A B C D E F G H I J K L M N O ABCDEFGHIJKLMNO. +0 diff --git a/codenet/public_test_cases/p00896/output.0.txt b/codenet/public_test_cases/p00896/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4555504caa29cea78cda2ebaa7b3b7d999f99bc9 --- /dev/null +++ b/codenet/public_test_cases/p00896/output.0.txt @@ -0,0 +1,4 @@ +A DOG AND A CAT. +AZ. +-. +A B C D E F G H I J K L M N O ABCDEFGHIJKLMNO. diff --git a/codenet/public_test_cases/p00896/output.1.txt b/codenet/public_test_cases/p00896/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4555504caa29cea78cda2ebaa7b3b7d999f99bc9 --- /dev/null +++ b/codenet/public_test_cases/p00896/output.1.txt @@ -0,0 +1,4 @@ +A DOG AND A CAT. +AZ. +-. +A B C D E F G H I J K L M N O ABCDEFGHIJKLMNO. diff --git a/codenet/public_test_cases/p00897/input.0.txt b/codenet/public_test_cases/p00897/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc241e4d2a6521d8a9febc1fe1eac05e09f7b6ab --- /dev/null +++ b/codenet/public_test_cases/p00897/input.0.txt @@ -0,0 +1,23 @@ +6 3 34 +Tokyo Kyoto +Tokyo Niigata 335 +Tokyo Shizuoka 174 +Shizuoka Nagoya 176 +Nagoya Kyoto 195 +Toyama Niigata 215 +Toyama Kyoto 296 +Nagoya +Niigata +Toyama +6 3 30 +Tokyo Kyoto +Tokyo Niigata 335 +Tokyo Shizuoka 174 +Shizuoka Nagoya 176 +Nagoya Kyoto 195 +Toyama Niigata 215 +Toyama Kyoto 296 +Nagoya +Niigata +Toyama +0 0 0 diff --git a/codenet/public_test_cases/p00897/input.1.txt b/codenet/public_test_cases/p00897/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc241e4d2a6521d8a9febc1fe1eac05e09f7b6ab --- /dev/null +++ b/codenet/public_test_cases/p00897/input.1.txt @@ -0,0 +1,23 @@ +6 3 34 +Tokyo Kyoto +Tokyo Niigata 335 +Tokyo Shizuoka 174 +Shizuoka Nagoya 176 +Nagoya Kyoto 195 +Toyama Niigata 215 +Toyama Kyoto 296 +Nagoya +Niigata +Toyama +6 3 30 +Tokyo Kyoto +Tokyo Niigata 335 +Tokyo Shizuoka 174 +Shizuoka Nagoya 176 +Nagoya Kyoto 195 +Toyama Niigata 215 +Toyama Kyoto 296 +Nagoya +Niigata +Toyama +0 0 0 diff --git a/codenet/public_test_cases/p00897/output.0.txt b/codenet/public_test_cases/p00897/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fe4fc854193e604de2c6147032c814ef0e148a4 --- /dev/null +++ b/codenet/public_test_cases/p00897/output.0.txt @@ -0,0 +1,2 @@ +846 +-1 diff --git a/codenet/public_test_cases/p00897/output.1.txt b/codenet/public_test_cases/p00897/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fe4fc854193e604de2c6147032c814ef0e148a4 --- /dev/null +++ b/codenet/public_test_cases/p00897/output.1.txt @@ -0,0 +1,2 @@ +846 +-1 diff --git a/codenet/public_test_cases/p00898/input.0.txt b/codenet/public_test_cases/p00898/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18b776ca803e4126c9adb26d73732d98a0847311 --- /dev/null +++ b/codenet/public_test_cases/p00898/input.0.txt @@ -0,0 +1,7 @@ +0 0 1 +3 5 2 +-4 1 3 +13 -13 2 +-32 15 9 +-50 50 0 +0 0 0 diff --git a/codenet/public_test_cases/p00898/input.1.txt b/codenet/public_test_cases/p00898/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18b776ca803e4126c9adb26d73732d98a0847311 --- /dev/null +++ b/codenet/public_test_cases/p00898/input.1.txt @@ -0,0 +1,7 @@ +0 0 1 +3 5 2 +-4 1 3 +13 -13 2 +-32 15 9 +-50 50 0 +0 0 0 diff --git a/codenet/public_test_cases/p00898/output.0.txt b/codenet/public_test_cases/p00898/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..002a10c81278a5ad9242576837841e734ea7e30a --- /dev/null +++ b/codenet/public_test_cases/p00898/output.0.txt @@ -0,0 +1,6 @@ +6 +10 +9 +30 +47 +100 diff --git a/codenet/public_test_cases/p00898/output.1.txt b/codenet/public_test_cases/p00898/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..002a10c81278a5ad9242576837841e734ea7e30a --- /dev/null +++ b/codenet/public_test_cases/p00898/output.1.txt @@ -0,0 +1,6 @@ +6 +10 +9 +30 +47 +100 diff --git a/codenet/public_test_cases/p00899/input.0.txt b/codenet/public_test_cases/p00899/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00899/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00899/input.1.txt b/codenet/public_test_cases/p00899/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcc6b694d4b0734970d7af84ffdbbaeecd211e86 --- /dev/null +++ b/codenet/public_test_cases/p00899/input.1.txt @@ -0,0 +1,35 @@ +3 +FUKUOKA +OKAYAMA +YAMAGUCHI +3 +FUKUOKA +FUKUYAMA +OKAYAMA +2 +ABCDE +EDCBA +4 +GA +DEFG +CDDE +ABCD +2 +ABCDE +C +14 +AAAAA +BBBBB +CCCCC +DDDDD +EEEEE +FFFFF +GGGGG +HHHHH +IIIII +JJJJJ +KKKKK +LLLLL +MMMMM +NNNNN +0 diff --git a/codenet/public_test_cases/p00899/input.2.txt b/codenet/public_test_cases/p00899/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00899/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00899/output.0.txt b/codenet/public_test_cases/p00899/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p00899/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p00899/output.1.txt b/codenet/public_test_cases/p00899/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3e3cfeb85de75069a9a09562fa9a6178026c328 --- /dev/null +++ b/codenet/public_test_cases/p00899/output.1.txt @@ -0,0 +1,6 @@ +16 +19 +9 +9 +5 +70 diff --git a/codenet/public_test_cases/p00899/output.2.txt b/codenet/public_test_cases/p00899/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p00899/output.2.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p00900/input.0.txt b/codenet/public_test_cases/p00900/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e605fb09576858f177be31a77eb690c0191c0182 --- /dev/null +++ b/codenet/public_test_cases/p00900/input.0.txt @@ -0,0 +1 @@ +5 6 diff --git a/codenet/public_test_cases/p00900/input.1.txt b/codenet/public_test_cases/p00900/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67b7659d92aafce63213d466d6023e26f51a78b1 --- /dev/null +++ b/codenet/public_test_cases/p00900/input.1.txt @@ -0,0 +1,37 @@ +5 6 +*2.2** +..*... +..2... +..*... +*2.2** +6 5 +.*2*. +..*.. +..*.. +..2.. +..*.. +.*2*. +5 6 +.1111. +**...* +33.... +**...0 +.*2**. +6 9 +....1.... +...1.1... +....1.... +.1..*..1. +1.1***1.1 +.1..*..1. +9 9 +********* +*4*4*4*4* +********* +*4*4*4*4* +********* +*4*4*4*4* +********* +*4*4*4*** +********* +0 0 diff --git a/codenet/public_test_cases/p00900/input.2.txt b/codenet/public_test_cases/p00900/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e605fb09576858f177be31a77eb690c0191c0182 --- /dev/null +++ b/codenet/public_test_cases/p00900/input.2.txt @@ -0,0 +1 @@ +5 6 diff --git a/codenet/public_test_cases/p00900/output.0.txt b/codenet/public_test_cases/p00900/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00900/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00900/output.1.txt b/codenet/public_test_cases/p00900/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ef444dc563580be778a0f40bc4d847883b316e0 --- /dev/null +++ b/codenet/public_test_cases/p00900/output.1.txt @@ -0,0 +1,5 @@ +6 +5 +5 +6 +23 diff --git a/codenet/public_test_cases/p00900/output.2.txt b/codenet/public_test_cases/p00900/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00900/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00901/input.0.txt b/codenet/public_test_cases/p00901/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b2a6ea36fff5702952867e725110e1d47b598db --- /dev/null +++ b/codenet/public_test_cases/p00901/input.0.txt @@ -0,0 +1,80 @@ +4 +........4...2.......... +(.1.-.----.)..*.-.5.+.6 +........2.............. +.......3............... +3 +...3. +-.--- +...4. +4 +.3.+.4.*.-.2. +------------- +..........2.. +...-.1.-.2... +2 +...2..3 +(.4..). +1 +2.+.3.*.5.-.7.+.9 +1 +(.2.+.3.).*.(.5.-.7.).+.9 +3 +.2....3. +4..+.--- +......5. +3 +.2......-.-.3. +4..-.-.------- +..........5... +9 +............1............ +------------------------- +..............1.......... +.1.+.-------------------. +................1........ +......1.+.-------------.. +..................1...... +...........1.+.-------... +................1.+.2.... +15 +.................2...... +................---..... +.......2.........5....3. +.(.---------.+.-----.).. +.....7...........3...... +....---.+.1............. +.....4.................. +------------------------ +.......2................ +......---............... +.......5.......2....2... +...(.-----.+.-----.).... +.......3.......3........ +..............---....... +...............4........ +2 +.0....2.... +3..+.4..*.5 +20 +............2............................2...................................... +...........3............................3....................................... +..........----.........................----..................................... +............4............................4...................................... +.....2.+.------.+.1...............2.+.------.+.1................................ +............2............................2...................................... +...........2............................2........................2.............. +..........----.........................----.....................3............... +............2............................2.....................----............. +...........3............................3........................4.............. +(.(.----------------.+.2.+.3.).*.----------------.+.2.).*.2.+.------.+.1.+.2.*.5 +............2............................2.......................2.............. +...........5............................5.......................2............... +..........----.........................----....................----............. +............6............................6.......................2.............. +.........------.......................------....................3............... +............3............................3...................................... +..........----.........................----..................................... +............2............................2...................................... +...........7............................7....................................... +0 diff --git a/codenet/public_test_cases/p00901/input.1.txt b/codenet/public_test_cases/p00901/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b2a6ea36fff5702952867e725110e1d47b598db --- /dev/null +++ b/codenet/public_test_cases/p00901/input.1.txt @@ -0,0 +1,80 @@ +4 +........4...2.......... +(.1.-.----.)..*.-.5.+.6 +........2.............. +.......3............... +3 +...3. +-.--- +...4. +4 +.3.+.4.*.-.2. +------------- +..........2.. +...-.1.-.2... +2 +...2..3 +(.4..). +1 +2.+.3.*.5.-.7.+.9 +1 +(.2.+.3.).*.(.5.-.7.).+.9 +3 +.2....3. +4..+.--- +......5. +3 +.2......-.-.3. +4..-.-.------- +..........5... +9 +............1............ +------------------------- +..............1.......... +.1.+.-------------------. +................1........ +......1.+.-------------.. +..................1...... +...........1.+.-------... +................1.+.2.... +15 +.................2...... +................---..... +.......2.........5....3. +.(.---------.+.-----.).. +.....7...........3...... +....---.+.1............. +.....4.................. +------------------------ +.......2................ +......---............... +.......5.......2....2... +...(.-----.+.-----.).... +.......3.......3........ +..............---....... +...............4........ +2 +.0....2.... +3..+.4..*.5 +20 +............2............................2...................................... +...........3............................3....................................... +..........----.........................----..................................... +............4............................4...................................... +.....2.+.------.+.1...............2.+.------.+.1................................ +............2............................2...................................... +...........2............................2........................2.............. +..........----.........................----.....................3............... +............2............................2.....................----............. +...........3............................3........................4.............. +(.(.----------------.+.2.+.3.).*.----------------.+.2.).*.2.+.------.+.1.+.2.*.5 +............2............................2.......................2.............. +...........5............................5.......................2............... +..........----.........................----....................----............. +............6............................6.......................2.............. +.........------.......................------....................3............... +............3............................3...................................... +..........----.........................----..................................... +............2............................2...................................... +...........7............................7....................................... +0 diff --git a/codenet/public_test_cases/p00901/output.0.txt b/codenet/public_test_cases/p00901/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1850a02095d0f690b0b7b1aa664bbf606a882c33 --- /dev/null +++ b/codenet/public_test_cases/p00901/output.0.txt @@ -0,0 +1,12 @@ +501 +502 +1 +74 +19 +2010 +821 +821 +1646 +148 +81 +1933 diff --git a/codenet/public_test_cases/p00901/output.1.txt b/codenet/public_test_cases/p00901/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1850a02095d0f690b0b7b1aa664bbf606a882c33 --- /dev/null +++ b/codenet/public_test_cases/p00901/output.1.txt @@ -0,0 +1,12 @@ +501 +502 +1 +74 +19 +2010 +821 +821 +1646 +148 +81 +1933 diff --git a/codenet/public_test_cases/p00902/input.0.txt b/codenet/public_test_cases/p00902/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d92784b3c3760802282b8da4474482e6e74649d8 --- /dev/null +++ b/codenet/public_test_cases/p00902/input.0.txt @@ -0,0 +1,75 @@ +1 10 +5 5 7 +2 12 +5 5 7 +8 6 3 +3 10 +3 11 2 +2 1 1 +2 16 3 +3 15 +-5 2 5 +9 2 9 +5 8 6 +3 38 +-25 -10 8 +30 5 7 +-3 35 11 +3 39 +-25 -10 8 +30 5 7 +-3 35 11 +3 800 +-400 400 2 +300 300 1 +300 302 1 +3 800 +400 -400 2 +300 300 1 +307 300 3 +8 147 +130 80 12 +130 -40 12 +-110 80 12 +-110 -40 12 +70 140 12 +70 -100 12 +-50 140 12 +-50 -100 12 +3 493 +345 154 10 +291 111 75 +-275 -301 46 +4 55 +54 0 1 +40 30 5 +27 36 10 +0 48 7 +3 30 +0 3 3 +-3 0 4 +400 0 3 +3 7 +2 3 2 +-5 -4 2 +-4 3 2 +3 10 +-5 -4 5 +2 3 5 +-4 3 5 +4 6 +4 6 1 +5 5 1 +1 7 1 +0 1 1 +3 493 +345 154 10 +291 111 75 +-275 -301 46 +5 20 +-9 12 5 +0 15 5 +3 -3 3 +12 9 5 +-12 9 5 +0 0 diff --git a/codenet/public_test_cases/p00902/input.1.txt b/codenet/public_test_cases/p00902/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d92784b3c3760802282b8da4474482e6e74649d8 --- /dev/null +++ b/codenet/public_test_cases/p00902/input.1.txt @@ -0,0 +1,75 @@ +1 10 +5 5 7 +2 12 +5 5 7 +8 6 3 +3 10 +3 11 2 +2 1 1 +2 16 3 +3 15 +-5 2 5 +9 2 9 +5 8 6 +3 38 +-25 -10 8 +30 5 7 +-3 35 11 +3 39 +-25 -10 8 +30 5 7 +-3 35 11 +3 800 +-400 400 2 +300 300 1 +300 302 1 +3 800 +400 -400 2 +300 300 1 +307 300 3 +8 147 +130 80 12 +130 -40 12 +-110 80 12 +-110 -40 12 +70 140 12 +70 -100 12 +-50 140 12 +-50 -100 12 +3 493 +345 154 10 +291 111 75 +-275 -301 46 +4 55 +54 0 1 +40 30 5 +27 36 10 +0 48 7 +3 30 +0 3 3 +-3 0 4 +400 0 3 +3 7 +2 3 2 +-5 -4 2 +-4 3 2 +3 10 +-5 -4 5 +2 3 5 +-4 3 5 +4 6 +4 6 1 +5 5 1 +1 7 1 +0 1 1 +3 493 +345 154 10 +291 111 75 +-275 -301 46 +5 20 +-9 12 5 +0 15 5 +3 -3 3 +12 9 5 +-12 9 5 +0 0 diff --git a/codenet/public_test_cases/p00902/output.0.txt b/codenet/public_test_cases/p00902/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd4d0327c3b21b4159fbbba497840682c583c103 --- /dev/null +++ b/codenet/public_test_cases/p00902/output.0.txt @@ -0,0 +1,17 @@ +81.68140899333463 +106.81415022205297 +74.11215318612639 +108.92086846105579 +0.0 +254.85616536128433 +8576.936716409238 +8569.462129048667 +929.1977057481128 +4181.124698202453 +505.09134735536804 +0.0 +46.82023824234038 +65.66979416387915 +50.990642291793506 +4181.124698202453 +158.87951420768937 diff --git a/codenet/public_test_cases/p00902/output.1.txt b/codenet/public_test_cases/p00902/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd4d0327c3b21b4159fbbba497840682c583c103 --- /dev/null +++ b/codenet/public_test_cases/p00902/output.1.txt @@ -0,0 +1,17 @@ +81.68140899333463 +106.81415022205297 +74.11215318612639 +108.92086846105579 +0.0 +254.85616536128433 +8576.936716409238 +8569.462129048667 +929.1977057481128 +4181.124698202453 +505.09134735536804 +0.0 +46.82023824234038 +65.66979416387915 +50.990642291793506 +4181.124698202453 +158.87951420768937 diff --git a/codenet/public_test_cases/p00903/input.0.txt b/codenet/public_test_cases/p00903/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd3824f719a250a136befea912a079ea8fb4015f --- /dev/null +++ b/codenet/public_test_cases/p00903/input.0.txt @@ -0,0 +1,27 @@ +3 6 +3 1 +1 2 1 +2 3 1 +3 2 1 +2 1 1 +1 3 4 +3 1 4 +3 6 +5 1 +1 2 1 +2 3 1 +3 2 1 +2 1 1 +1 3 4 +3 1 4 +4 5 +3 1 +3 1 +1 2 5 +2 3 5 +3 4 5 +4 2 5 +3 1 5 +2 1 +2 1 1 +0 0 diff --git a/codenet/public_test_cases/p00903/input.1.txt b/codenet/public_test_cases/p00903/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd3824f719a250a136befea912a079ea8fb4015f --- /dev/null +++ b/codenet/public_test_cases/p00903/input.1.txt @@ -0,0 +1,27 @@ +3 6 +3 1 +1 2 1 +2 3 1 +3 2 1 +2 1 1 +1 3 4 +3 1 4 +3 6 +5 1 +1 2 1 +2 3 1 +3 2 1 +2 1 1 +1 3 4 +3 1 4 +4 5 +3 1 +3 1 +1 2 5 +2 3 5 +3 4 5 +4 2 5 +3 1 5 +2 1 +2 1 1 +0 0 diff --git a/codenet/public_test_cases/p00903/output.0.txt b/codenet/public_test_cases/p00903/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebc1826f6dcbd08150b0139b16c9e97540e3cb8d --- /dev/null +++ b/codenet/public_test_cases/p00903/output.0.txt @@ -0,0 +1,4 @@ +7 +8 +36 +-1 diff --git a/codenet/public_test_cases/p00903/output.1.txt b/codenet/public_test_cases/p00903/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebc1826f6dcbd08150b0139b16c9e97540e3cb8d --- /dev/null +++ b/codenet/public_test_cases/p00903/output.1.txt @@ -0,0 +1,4 @@ +7 +8 +36 +-1 diff --git a/codenet/public_test_cases/p00904/input.0.txt b/codenet/public_test_cases/p00904/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecf1bf4a938ca6820d2b9610f5a4ba9c3e409f82 --- /dev/null +++ b/codenet/public_test_cases/p00904/input.0.txt @@ -0,0 +1,9 @@ +8 +10 0 +0 2 +-3 0 +4 2 +0 -13 +-4 1 +-2 -1 +3 -1 diff --git a/codenet/public_test_cases/p00904/input.1.txt b/codenet/public_test_cases/p00904/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecf1bf4a938ca6820d2b9610f5a4ba9c3e409f82 --- /dev/null +++ b/codenet/public_test_cases/p00904/input.1.txt @@ -0,0 +1,9 @@ +8 +10 0 +0 2 +-3 0 +4 2 +0 -13 +-4 1 +-2 -1 +3 -1 diff --git a/codenet/public_test_cases/p00904/output.0.txt b/codenet/public_test_cases/p00904/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7622f3cb9776be26bfa711ccad504a2ba329d393 --- /dev/null +++ b/codenet/public_test_cases/p00904/output.0.txt @@ -0,0 +1,8 @@ +C +C +P +C +C +P +P +C diff --git a/codenet/public_test_cases/p00904/output.1.txt b/codenet/public_test_cases/p00904/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7622f3cb9776be26bfa711ccad504a2ba329d393 --- /dev/null +++ b/codenet/public_test_cases/p00904/output.1.txt @@ -0,0 +1,8 @@ +C +C +P +C +C +P +P +C diff --git a/codenet/public_test_cases/p00905/input.0.txt b/codenet/public_test_cases/p00905/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..610c642290eca020485702f17ca3c2d98fcdeffb --- /dev/null +++ b/codenet/public_test_cases/p00905/input.0.txt @@ -0,0 +1,58 @@ +5 4 +(Follow.my.style +.........starting.from.round.brackets) +{then.curly.brackets +.....[.and.finally +.......square.brackets.]} +(Thank.you +{for.showing.me +[all +the.secrets]}) +4 2 +(This.time.I.will.show.you +.........(how.to.use.round.brackets) +.........[but.not.about.square.brackets] +.........{nor.curly.brackets}) +(I.learned +how.to.use.round.brackets) +4 2 +(This.time.I.will.show.you +.........(how.to.use.round.brackets) +.........[but.not.about.square.brackets] +.........{nor.curly.brackets}) +[I.have.not.learned +how.to.use.square.brackets] +2 2 +(Be.smart.and.let.fear.of +..(closed.brackets).go) +(A.pair.of.round.brackets.enclosing +[A.line.enclosed.in.square.brackets]) +1 2 +Telling.you.nothing.but.you.can.make.it +[One.liner.(is).(never.indented)] +[One.liner.(is).(never.indented)] +2 4 +([{Learn.from.my.KungFu +...}]) +(( +{{ +[[ +]]}})) +1 2 +Do.not.waste.your.time.trying.to.read.from.emptiness +( +) +2 3 +({Quite.interesting.art.of.ambiguity +....}) +{ +( +)} +2 4 +({[ +............................................................]}) +( +{ +[ +]}) +0 0 diff --git a/codenet/public_test_cases/p00905/input.1.txt b/codenet/public_test_cases/p00905/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..610c642290eca020485702f17ca3c2d98fcdeffb --- /dev/null +++ b/codenet/public_test_cases/p00905/input.1.txt @@ -0,0 +1,58 @@ +5 4 +(Follow.my.style +.........starting.from.round.brackets) +{then.curly.brackets +.....[.and.finally +.......square.brackets.]} +(Thank.you +{for.showing.me +[all +the.secrets]}) +4 2 +(This.time.I.will.show.you +.........(how.to.use.round.brackets) +.........[but.not.about.square.brackets] +.........{nor.curly.brackets}) +(I.learned +how.to.use.round.brackets) +4 2 +(This.time.I.will.show.you +.........(how.to.use.round.brackets) +.........[but.not.about.square.brackets] +.........{nor.curly.brackets}) +[I.have.not.learned +how.to.use.square.brackets] +2 2 +(Be.smart.and.let.fear.of +..(closed.brackets).go) +(A.pair.of.round.brackets.enclosing +[A.line.enclosed.in.square.brackets]) +1 2 +Telling.you.nothing.but.you.can.make.it +[One.liner.(is).(never.indented)] +[One.liner.(is).(never.indented)] +2 4 +([{Learn.from.my.KungFu +...}]) +(( +{{ +[[ +]]}})) +1 2 +Do.not.waste.your.time.trying.to.read.from.emptiness +( +) +2 3 +({Quite.interesting.art.of.ambiguity +....}) +{ +( +)} +2 4 +({[ +............................................................]}) +( +{ +[ +]}) +0 0 diff --git a/codenet/public_test_cases/p00905/output.0.txt b/codenet/public_test_cases/p00905/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..029d809760e3ed92f527e2ae06eebe0d5e4ae7ff --- /dev/null +++ b/codenet/public_test_cases/p00905/output.0.txt @@ -0,0 +1,9 @@ +0 9 14 16 +0 9 +0 -1 +0 2 +0 0 +0 2 4 6 +0 -1 +0 -1 4 +0 20 40 60 diff --git a/codenet/public_test_cases/p00905/output.1.txt b/codenet/public_test_cases/p00905/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..029d809760e3ed92f527e2ae06eebe0d5e4ae7ff --- /dev/null +++ b/codenet/public_test_cases/p00905/output.1.txt @@ -0,0 +1,9 @@ +0 9 14 16 +0 9 +0 -1 +0 2 +0 0 +0 2 4 6 +0 -1 +0 -1 4 +0 20 40 60 diff --git a/codenet/public_test_cases/p00906/input.0.txt b/codenet/public_test_cases/p00906/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffd36a575db6e98550d9176434db79e157243554 --- /dev/null +++ b/codenet/public_test_cases/p00906/input.0.txt @@ -0,0 +1,19 @@ +5 4 1 3 2 0 +0 1 2 0 1 +5 7 1 3 2 1 +0 1 2 0 1 +5 13 1 3 2 11 +0 1 2 0 1 +5 5 2 0 1 100 +0 1 2 0 1 +6 6 0 2 3 1000 +0 1 2 0 1 4 +20 1000 0 2 3 1000000000 +0 1 2 0 1 0 1 2 0 1 0 1 2 0 1 0 1 2 0 1 +30 2 1 0 1 1000000000 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 +30 2 1 1 1 1000000000 +1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +30 5 2 3 1 1000000000 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00906/input.1.txt b/codenet/public_test_cases/p00906/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffd36a575db6e98550d9176434db79e157243554 --- /dev/null +++ b/codenet/public_test_cases/p00906/input.1.txt @@ -0,0 +1,19 @@ +5 4 1 3 2 0 +0 1 2 0 1 +5 7 1 3 2 1 +0 1 2 0 1 +5 13 1 3 2 11 +0 1 2 0 1 +5 5 2 0 1 100 +0 1 2 0 1 +6 6 0 2 3 1000 +0 1 2 0 1 4 +20 1000 0 2 3 1000000000 +0 1 2 0 1 0 1 2 0 1 0 1 2 0 1 0 1 2 0 1 +30 2 1 0 1 1000000000 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 +30 2 1 1 1 1000000000 +1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +30 5 2 3 1 1000000000 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00906/output.0.txt b/codenet/public_test_cases/p00906/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaa8e87e54b40d52d16113a9d4494d280009b6fa --- /dev/null +++ b/codenet/public_test_cases/p00906/output.0.txt @@ -0,0 +1,9 @@ +0 1 2 0 1 +2 0 0 4 3 +2 12 10 9 11 +3 0 4 2 1 +0 4 2 0 4 4 +0 376 752 0 376 0 376 752 0 376 0 376 752 0 376 0 376 752 0 376 +1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 +1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 +1 1 3 2 2 2 3 3 1 4 3 1 2 3 0 4 3 3 0 4 2 2 2 2 1 1 2 1 3 0 diff --git a/codenet/public_test_cases/p00906/output.1.txt b/codenet/public_test_cases/p00906/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaa8e87e54b40d52d16113a9d4494d280009b6fa --- /dev/null +++ b/codenet/public_test_cases/p00906/output.1.txt @@ -0,0 +1,9 @@ +0 1 2 0 1 +2 0 0 4 3 +2 12 10 9 11 +3 0 4 2 1 +0 4 2 0 4 4 +0 376 752 0 376 0 376 752 0 376 0 376 752 0 376 0 376 752 0 376 +1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 +1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 +1 1 3 2 2 2 3 3 1 4 3 1 2 3 0 4 3 3 0 4 2 2 2 2 1 1 2 1 3 0 diff --git a/codenet/public_test_cases/p00907/input.0.txt b/codenet/public_test_cases/p00907/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..819250aca4b95f5f6d463b0cdc228e6e0159488c --- /dev/null +++ b/codenet/public_test_cases/p00907/input.0.txt @@ -0,0 +1,29 @@ +2 +1.0 +4.0 +12.0 +16.0 +25.0 +1 +-30.5893962764 +5.76397083962 +39.3853798058 +74.3727663177 +4 +42.4715310246 +79.5420238202 +28.0282396675 +-30.3627807522 +-49.8363481393 +-25.5101480106 +7.58575761381 +5 +-21.9161699038 +-48.469304271 +-24.3188578417 +-2.35085940324 +-9.70239202086 +-47.2709510623 +-93.5066246072 +-82.5073836498 +0 diff --git a/codenet/public_test_cases/p00907/input.1.txt b/codenet/public_test_cases/p00907/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..819250aca4b95f5f6d463b0cdc228e6e0159488c --- /dev/null +++ b/codenet/public_test_cases/p00907/input.1.txt @@ -0,0 +1,29 @@ +2 +1.0 +4.0 +12.0 +16.0 +25.0 +1 +-30.5893962764 +5.76397083962 +39.3853798058 +74.3727663177 +4 +42.4715310246 +79.5420238202 +28.0282396675 +-30.3627807522 +-49.8363481393 +-25.5101480106 +7.58575761381 +5 +-21.9161699038 +-48.469304271 +-24.3188578417 +-2.35085940324 +-9.70239202086 +-47.2709510623 +-93.5066246072 +-82.5073836498 +0 diff --git a/codenet/public_test_cases/p00907/output.0.txt b/codenet/public_test_cases/p00907/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b1d45f6d0814e36350c724cce690a1967e37ecd --- /dev/null +++ b/codenet/public_test_cases/p00907/output.0.txt @@ -0,0 +1,4 @@ +2 +1 +1 +6 diff --git a/codenet/public_test_cases/p00907/output.1.txt b/codenet/public_test_cases/p00907/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b1d45f6d0814e36350c724cce690a1967e37ecd --- /dev/null +++ b/codenet/public_test_cases/p00907/output.1.txt @@ -0,0 +1,4 @@ +2 +1 +1 +6 diff --git a/codenet/public_test_cases/p00908/input.0.txt b/codenet/public_test_cases/p00908/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1f5b0a020ea5f67b6fc7e6763652f5a417f8886 --- /dev/null +++ b/codenet/public_test_cases/p00908/input.0.txt @@ -0,0 +1,27 @@ +3 3 +oo. +oXX +.XX +3 3 +XXo +XX. +o.o +3 5 +.o*XX +oooXX +oooo. +7 12 +oooooooooooo +ooooo*****oo +oooooo****oo +o**ooo***ooo +o***ooooo..o +o**ooooooXXo +ooooo****XXo +5 30 +oooooooooooooooooooooooooooooo +oooooooooooooooooooooooooooooo +o***************************oo +XX.ooooooooooooooooooooooooooo +XX.ooooooooooooooooooooooooooo +0 0 diff --git a/codenet/public_test_cases/p00908/input.1.txt b/codenet/public_test_cases/p00908/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1f5b0a020ea5f67b6fc7e6763652f5a417f8886 --- /dev/null +++ b/codenet/public_test_cases/p00908/input.1.txt @@ -0,0 +1,27 @@ +3 3 +oo. +oXX +.XX +3 3 +XXo +XX. +o.o +3 5 +.o*XX +oooXX +oooo. +7 12 +oooooooooooo +ooooo*****oo +oooooo****oo +o**ooo***ooo +o***ooooo..o +o**ooooooXXo +ooooo****XXo +5 30 +oooooooooooooooooooooooooooooo +oooooooooooooooooooooooooooooo +o***************************oo +XX.ooooooooooooooooooooooooooo +XX.ooooooooooooooooooooooooooo +0 0 diff --git a/codenet/public_test_cases/p00908/output.0.txt b/codenet/public_test_cases/p00908/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9786882852bc251bbe27300b758c261d8b7cdd4e --- /dev/null +++ b/codenet/public_test_cases/p00908/output.0.txt @@ -0,0 +1,5 @@ +11 +0 +-1 +382 +6807 diff --git a/codenet/public_test_cases/p00908/output.1.txt b/codenet/public_test_cases/p00908/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9786882852bc251bbe27300b758c261d8b7cdd4e --- /dev/null +++ b/codenet/public_test_cases/p00908/output.1.txt @@ -0,0 +1,5 @@ +11 +0 +-1 +382 +6807 diff --git a/codenet/public_test_cases/p00909/input.0.txt b/codenet/public_test_cases/p00909/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c29e09cab13998b54d1e9aa4e325377cd28e02f1 --- /dev/null +++ b/codenet/public_test_cases/p00909/input.0.txt @@ -0,0 +1,15 @@ +2 2 +! 1 2 1 +? 1 2 +2 2 +! 1 2 1 +? 2 1 +4 7 +! 1 2 100 +? 2 3 +! 2 3 100 +? 2 3 +? 1 3 +! 4 3 150 +? 4 1 +0 0 diff --git a/codenet/public_test_cases/p00909/input.1.txt b/codenet/public_test_cases/p00909/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c29e09cab13998b54d1e9aa4e325377cd28e02f1 --- /dev/null +++ b/codenet/public_test_cases/p00909/input.1.txt @@ -0,0 +1,15 @@ +2 2 +! 1 2 1 +? 1 2 +2 2 +! 1 2 1 +? 2 1 +4 7 +! 1 2 100 +? 2 3 +! 2 3 100 +? 2 3 +? 1 3 +! 4 3 150 +? 4 1 +0 0 diff --git a/codenet/public_test_cases/p00909/output.0.txt b/codenet/public_test_cases/p00909/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cdc88568e3eb21f64098200c24a6f78336d05cf --- /dev/null +++ b/codenet/public_test_cases/p00909/output.0.txt @@ -0,0 +1,6 @@ +1 +-1 +UNKNOWN +100 +200 +-50 diff --git a/codenet/public_test_cases/p00909/output.1.txt b/codenet/public_test_cases/p00909/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cdc88568e3eb21f64098200c24a6f78336d05cf --- /dev/null +++ b/codenet/public_test_cases/p00909/output.1.txt @@ -0,0 +1,6 @@ +1 +-1 +UNKNOWN +100 +200 +-50 diff --git a/codenet/public_test_cases/p00910/input.0.txt b/codenet/public_test_cases/p00910/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b04ee707529b48cb0f87c2e1cdf9a49e2a53953e --- /dev/null +++ b/codenet/public_test_cases/p00910/input.0.txt @@ -0,0 +1,55 @@ +12 5 4 +0 10 0 1 +1 5 0 2 +1 4 0 2 +0 0 0 2 +10 0 0 1 +3 -1 0 2 +5 -1 0 2 +10 10 0 15 +0 -10 0 1 +10 -10 0 1 +-10 -10 0 1 +10 10 0 1 +0 10 0 240 +10 0 0 200 +10 -2 0 52 +-10 0 0 100 +1 1 0 2 +0 0 0 +12 5 4 +0 10 0 1 +1 5 0 2 +1 4 0 2 +0 0 0 2 +10 0 0 1 +3 -1 0 2 +5 -1 0 2 +10 10 0 15 +0 -10 0 1 +10 -10 0 1 +-10 -10 0 1 +10 10 0 1 +0 10 0 260 +10 0 0 200 +10 -2 0 52 +-10 0 0 100 +1 1 0 2 +0 0 0 +5 1 3 +1 2 0 2 +-1 8 -1 8 +-2 -3 5 6 +-2 1 3 3 +-4 2 3 5 +1 1 2 7 +0 0 0 +5 1 2 +1 2 0 2 +-1 8 -1 8 +-2 -3 5 6 +-2 1 3 3 +-4 2 3 5 +1 1 2 7 +0 0 0 +0 0 0 diff --git a/codenet/public_test_cases/p00910/input.1.txt b/codenet/public_test_cases/p00910/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b04ee707529b48cb0f87c2e1cdf9a49e2a53953e --- /dev/null +++ b/codenet/public_test_cases/p00910/input.1.txt @@ -0,0 +1,55 @@ +12 5 4 +0 10 0 1 +1 5 0 2 +1 4 0 2 +0 0 0 2 +10 0 0 1 +3 -1 0 2 +5 -1 0 2 +10 10 0 15 +0 -10 0 1 +10 -10 0 1 +-10 -10 0 1 +10 10 0 1 +0 10 0 240 +10 0 0 200 +10 -2 0 52 +-10 0 0 100 +1 1 0 2 +0 0 0 +12 5 4 +0 10 0 1 +1 5 0 2 +1 4 0 2 +0 0 0 2 +10 0 0 1 +3 -1 0 2 +5 -1 0 2 +10 10 0 15 +0 -10 0 1 +10 -10 0 1 +-10 -10 0 1 +10 10 0 1 +0 10 0 260 +10 0 0 200 +10 -2 0 52 +-10 0 0 100 +1 1 0 2 +0 0 0 +5 1 3 +1 2 0 2 +-1 8 -1 8 +-2 -3 5 6 +-2 1 3 3 +-4 2 3 5 +1 1 2 7 +0 0 0 +5 1 2 +1 2 0 2 +-1 8 -1 8 +-2 -3 5 6 +-2 1 3 3 +-4 2 3 5 +1 1 2 7 +0 0 0 +0 0 0 diff --git a/codenet/public_test_cases/p00910/output.0.txt b/codenet/public_test_cases/p00910/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ff89df06e0a074d9f11a7a0402afacdb7ce8be0 --- /dev/null +++ b/codenet/public_test_cases/p00910/output.0.txt @@ -0,0 +1,4 @@ +3.5 +3.6 +1.1666666666666667 +0.0 diff --git a/codenet/public_test_cases/p00910/output.1.txt b/codenet/public_test_cases/p00910/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ff89df06e0a074d9f11a7a0402afacdb7ce8be0 --- /dev/null +++ b/codenet/public_test_cases/p00910/output.1.txt @@ -0,0 +1,4 @@ +3.5 +3.6 +1.1666666666666667 +0.0 diff --git a/codenet/public_test_cases/p00911/input.0.txt b/codenet/public_test_cases/p00911/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfc3aab3f8702d2dcc45f22cde19b5b8237f888f --- /dev/null +++ b/codenet/public_test_cases/p00911/input.0.txt @@ -0,0 +1,22 @@ +4 5 +1 2 1 +1 3 2 +1 1 3 +3 1 3 +1 3 1 +4 4 +1 2 1 +1 3 2 +1 1 3 +4 1 3 +4 5 +1 2 1 +1 3 2 +1 1 3 +4 1 3 +5 1 3 +2 3 +1 1 2 +2 1 2 +3 1 2 +0 0 diff --git a/codenet/public_test_cases/p00911/output.0.txt b/codenet/public_test_cases/p00911/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d99b619f547604cf45c4a45eb646db49ae3912ed --- /dev/null +++ b/codenet/public_test_cases/p00911/output.0.txt @@ -0,0 +1,4 @@ +3 +4 +4 +2 diff --git a/codenet/public_test_cases/p00912/input.0.txt b/codenet/public_test_cases/p00912/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5416ba96cf6af86418bea1d0f0b9382239f8bb8 --- /dev/null +++ b/codenet/public_test_cases/p00912/input.0.txt @@ -0,0 +1,11 @@ +11 4 +4 2 1 3 +5 7 +1 1 1 2 2 1 2 +11 7 +3 1 3 1 3 3 4 +100 3 +30 30 39 +30 3 +2 5 3 +0 0 diff --git a/codenet/public_test_cases/p00912/output.0.txt b/codenet/public_test_cases/p00912/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c12b24cf6a60ceb02fa0740e499124bac6cd143 --- /dev/null +++ b/codenet/public_test_cases/p00912/output.0.txt @@ -0,0 +1,5 @@ +2 +1 +2 +40 +1 diff --git a/codenet/public_test_cases/p00913/input.0.txt b/codenet/public_test_cases/p00913/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54569fab3a403bfa9c1501ec3ce0a2bd408c05e0 --- /dev/null +++ b/codenet/public_test_cases/p00913/input.0.txt @@ -0,0 +1,51 @@ +0 0 0 3 3 3 +### +### +### +### +### +### +### +### +### +3 3 0 0 0 3 +#.. +### +### +### +### +### +#.# +### +### +0 0 2 2 2 2 +... +... +... +.#. +#.. +... +##. +##. +... +0 1 2 2 1 1 +... +... +... +.#. +#.. +... +##. +##. +... +3 2 0 2 3 2 +### +..# +... +..# +... +.#. +..# +..# +.## +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00913/input.1.txt b/codenet/public_test_cases/p00913/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..54569fab3a403bfa9c1501ec3ce0a2bd408c05e0 --- /dev/null +++ b/codenet/public_test_cases/p00913/input.1.txt @@ -0,0 +1,51 @@ +0 0 0 3 3 3 +### +### +### +### +### +### +### +### +### +3 3 0 0 0 3 +#.. +### +### +### +### +### +#.# +### +### +0 0 2 2 2 2 +... +... +... +.#. +#.. +... +##. +##. +... +0 1 2 2 1 1 +... +... +... +.#. +#.. +... +##. +##. +... +3 2 0 2 3 2 +### +..# +... +..# +... +.#. +..# +..# +.## +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p00913/output.0.txt b/codenet/public_test_cases/p00913/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0635202b37966d3bb9e283351c3f8f4975817103 --- /dev/null +++ b/codenet/public_test_cases/p00913/output.0.txt @@ -0,0 +1,5 @@ +6.70820393249936941515 +6.47870866461907457534 +2.82842712474619029095 +2.23606797749978980505 +2.82842712474619029095 diff --git a/codenet/public_test_cases/p00913/output.1.txt b/codenet/public_test_cases/p00913/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0635202b37966d3bb9e283351c3f8f4975817103 --- /dev/null +++ b/codenet/public_test_cases/p00913/output.1.txt @@ -0,0 +1,5 @@ +6.70820393249936941515 +6.47870866461907457534 +2.82842712474619029095 +2.23606797749978980505 +2.82842712474619029095 diff --git a/codenet/public_test_cases/p00914/input.0.txt b/codenet/public_test_cases/p00914/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa299021c970d2d66a899784156ed48e71e8a1a1 --- /dev/null +++ b/codenet/public_test_cases/p00914/input.0.txt @@ -0,0 +1,10 @@ +9 3 23 +9 3 22 +10 3 28 +16 10 107 +20 8 102 +20 10 105 +20 10 155 +3 4 3 +4 2 11 +0 0 0 diff --git a/codenet/public_test_cases/p00914/input.1.txt b/codenet/public_test_cases/p00914/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa299021c970d2d66a899784156ed48e71e8a1a1 --- /dev/null +++ b/codenet/public_test_cases/p00914/input.1.txt @@ -0,0 +1,10 @@ +9 3 23 +9 3 22 +10 3 28 +16 10 107 +20 8 102 +20 10 105 +20 10 155 +3 4 3 +4 2 11 +0 0 0 diff --git a/codenet/public_test_cases/p00914/output.0.txt b/codenet/public_test_cases/p00914/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..47061306dbb5eebeb3676067bc81b48e8a8c2e10 --- /dev/null +++ b/codenet/public_test_cases/p00914/output.0.txt @@ -0,0 +1,9 @@ +1 +2 +0 +20 +1542 +5448 +1 +0 +0 diff --git a/codenet/public_test_cases/p00914/output.1.txt b/codenet/public_test_cases/p00914/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..47061306dbb5eebeb3676067bc81b48e8a8c2e10 --- /dev/null +++ b/codenet/public_test_cases/p00914/output.1.txt @@ -0,0 +1,9 @@ +1 +2 +0 +20 +1542 +5448 +1 +0 +0 diff --git a/codenet/public_test_cases/p00915/input.0.txt b/codenet/public_test_cases/p00915/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..47124828102190cfd10bd8d19b5c540d07351ca1 --- /dev/null +++ b/codenet/public_test_cases/p00915/input.0.txt @@ -0,0 +1,28 @@ +3 6 +R 1 +L 2 +L 5 +1 10 +R 1 +2 10 +R 5 +L 7 +2 10 +R 3 +L 8 +2 99 +R 1 +L 98 +4 10 +L 1 +R 2 +L 8 +R 9 +6 10 +R 2 +R 3 +L 4 +R 6 +L 7 +L 8 +0 0 diff --git a/codenet/public_test_cases/p00915/input.1.txt b/codenet/public_test_cases/p00915/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..47124828102190cfd10bd8d19b5c540d07351ca1 --- /dev/null +++ b/codenet/public_test_cases/p00915/input.1.txt @@ -0,0 +1,28 @@ +3 6 +R 1 +L 2 +L 5 +1 10 +R 1 +2 10 +R 5 +L 7 +2 10 +R 3 +L 8 +2 99 +R 1 +L 98 +4 10 +L 1 +R 2 +L 8 +R 9 +6 10 +R 2 +R 3 +L 4 +R 6 +L 7 +L 8 +0 0 diff --git a/codenet/public_test_cases/p00915/output.0.txt b/codenet/public_test_cases/p00915/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..250cdc06dc1c39cca3739fd4198c17aae33172ba --- /dev/null +++ b/codenet/public_test_cases/p00915/output.0.txt @@ -0,0 +1,7 @@ +5 1 +9 1 +7 1 +8 2 +98 2 +8 2 +8 3 diff --git a/codenet/public_test_cases/p00915/output.1.txt b/codenet/public_test_cases/p00915/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..250cdc06dc1c39cca3739fd4198c17aae33172ba --- /dev/null +++ b/codenet/public_test_cases/p00915/output.1.txt @@ -0,0 +1,7 @@ +5 1 +9 1 +7 1 +8 2 +98 2 +8 2 +8 3 diff --git a/codenet/public_test_cases/p00916/input.0.txt b/codenet/public_test_cases/p00916/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbe904a7e59770e74267f6f8e44cfe36f086f84a --- /dev/null +++ b/codenet/public_test_cases/p00916/input.0.txt @@ -0,0 +1,14 @@ +3 +4 28 27 11 +15 20 42 5 +11 24 33 14 +5 +4 28 27 11 +12 11 34 2 +7 26 14 16 +14 16 19 12 +17 28 27 21 +2 +300000 1000000 600000 0 +0 600000 1000000 300000 +0 diff --git a/codenet/public_test_cases/p00916/input.1.txt b/codenet/public_test_cases/p00916/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbe904a7e59770e74267f6f8e44cfe36f086f84a --- /dev/null +++ b/codenet/public_test_cases/p00916/input.1.txt @@ -0,0 +1,14 @@ +3 +4 28 27 11 +15 20 42 5 +11 24 33 14 +5 +4 28 27 11 +12 11 34 2 +7 26 14 16 +14 16 19 12 +17 28 27 21 +2 +300000 1000000 600000 0 +0 600000 1000000 300000 +0 diff --git a/codenet/public_test_cases/p00916/output.0.txt b/codenet/public_test_cases/p00916/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fea14c26b691d25a3209399c86759b403a79dbff --- /dev/null +++ b/codenet/public_test_cases/p00916/output.0.txt @@ -0,0 +1,3 @@ +8 +6 +6 diff --git a/codenet/public_test_cases/p00916/output.1.txt b/codenet/public_test_cases/p00916/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fea14c26b691d25a3209399c86759b403a79dbff --- /dev/null +++ b/codenet/public_test_cases/p00916/output.1.txt @@ -0,0 +1,3 @@ +8 +6 +6 diff --git a/codenet/public_test_cases/p00917/input.0.txt b/codenet/public_test_cases/p00917/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8216068f0073a4c77745097ae77b968f787d5c5b --- /dev/null +++ b/codenet/public_test_cases/p00917/input.0.txt @@ -0,0 +1,25 @@ +12 0 0 0 +12 11 59 59 +12 1 56 0 +12 1 56 3 +12 1 56 34 +12 3 9 43 +12 3 10 14 +12 7 17 58 +12 7 18 28 +12 7 23 0 +12 7 23 31 +2 0 38 29 +2 0 39 0 +2 0 39 30 +2 1 6 20 +2 1 20 1 +2 1 20 31 +3 2 15 0 +3 2 59 30 +4 0 28 48 +5 1 5 40 +5 1 6 10 +5 1 7 41 +11 0 55 0 +0 0 0 0 diff --git a/codenet/public_test_cases/p00917/input.1.txt b/codenet/public_test_cases/p00917/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8216068f0073a4c77745097ae77b968f787d5c5b --- /dev/null +++ b/codenet/public_test_cases/p00917/input.1.txt @@ -0,0 +1,25 @@ +12 0 0 0 +12 11 59 59 +12 1 56 0 +12 1 56 3 +12 1 56 34 +12 3 9 43 +12 3 10 14 +12 7 17 58 +12 7 18 28 +12 7 23 0 +12 7 23 31 +2 0 38 29 +2 0 39 0 +2 0 39 30 +2 1 6 20 +2 1 20 1 +2 1 20 31 +3 2 15 0 +3 2 59 30 +4 0 28 48 +5 1 5 40 +5 1 6 10 +5 1 7 41 +11 0 55 0 +0 0 0 0 diff --git a/codenet/public_test_cases/p00917/output.0.txt b/codenet/public_test_cases/p00917/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5a8de7b541942fcbbb703ec5ba8f000316d1a24 --- /dev/null +++ b/codenet/public_test_cases/p00917/output.0.txt @@ -0,0 +1,24 @@ +0 0 43200 1427 +0 0 43200 1427 +1 56 4080 1427 +1 56 47280 1427 +1 57 4860 1427 +3 10 18600 1427 +3 10 61800 1427 +7 18 39240 1427 +7 18 82440 1427 +7 23 43140 1427 +7 24 720 1427 +0 38 4680 79 +0 39 2340 79 +0 40 0 1 +1 6 3960 79 +1 20 2400 79 +1 21 60 79 +2 15 0 1 +0 0 2700 89 +0 28 48 1 +1 6 320 33 +1 6 40 1 +1 8 120 11 +0 55 0 1 diff --git a/codenet/public_test_cases/p00917/output.1.txt b/codenet/public_test_cases/p00917/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5a8de7b541942fcbbb703ec5ba8f000316d1a24 --- /dev/null +++ b/codenet/public_test_cases/p00917/output.1.txt @@ -0,0 +1,24 @@ +0 0 43200 1427 +0 0 43200 1427 +1 56 4080 1427 +1 56 47280 1427 +1 57 4860 1427 +3 10 18600 1427 +3 10 61800 1427 +7 18 39240 1427 +7 18 82440 1427 +7 23 43140 1427 +7 24 720 1427 +0 38 4680 79 +0 39 2340 79 +0 40 0 1 +1 6 3960 79 +1 20 2400 79 +1 21 60 79 +2 15 0 1 +0 0 2700 89 +0 28 48 1 +1 6 320 33 +1 6 40 1 +1 8 120 11 +0 55 0 1 diff --git a/codenet/public_test_cases/p00918/input.0.txt b/codenet/public_test_cases/p00918/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c8d9ad79802fc3cea75dfcc42433cedce2663c5 --- /dev/null +++ b/codenet/public_test_cases/p00918/input.0.txt @@ -0,0 +1,29 @@ +4 9 +6 3 0 +8 1 2 +4 5 7 +6 3 0 +8 1 2 +4 5 7 +31 31 +4 3 6 +0 1 5 +8 2 7 +0 3 6 +4 1 5 +8 2 7 +92 4 +1 5 3 +4 0 7 +8 2 6 +1 5 0 +4 7 3 +8 2 6 +12 28 +3 4 5 +0 2 6 +7 1 8 +5 7 1 +8 6 2 +0 3 4 +0 0 diff --git a/codenet/public_test_cases/p00918/input.1.txt b/codenet/public_test_cases/p00918/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c8d9ad79802fc3cea75dfcc42433cedce2663c5 --- /dev/null +++ b/codenet/public_test_cases/p00918/input.1.txt @@ -0,0 +1,29 @@ +4 9 +6 3 0 +8 1 2 +4 5 7 +6 3 0 +8 1 2 +4 5 7 +31 31 +4 3 6 +0 1 5 +8 2 7 +0 3 6 +4 1 5 +8 2 7 +92 4 +1 5 3 +4 0 7 +8 2 6 +1 5 0 +4 7 3 +8 2 6 +12 28 +3 4 5 +0 2 6 +7 1 8 +5 7 1 +8 6 2 +0 3 4 +0 0 diff --git a/codenet/public_test_cases/p00918/output.0.txt b/codenet/public_test_cases/p00918/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eec3249d4c66ebf938b20fb79904913e1aa6689b --- /dev/null +++ b/codenet/public_test_cases/p00918/output.0.txt @@ -0,0 +1,4 @@ +0 +31 +96 +312 diff --git a/codenet/public_test_cases/p00918/output.1.txt b/codenet/public_test_cases/p00918/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eec3249d4c66ebf938b20fb79904913e1aa6689b --- /dev/null +++ b/codenet/public_test_cases/p00918/output.1.txt @@ -0,0 +1,4 @@ +0 +31 +96 +312 diff --git a/codenet/public_test_cases/p00919/input.0.txt b/codenet/public_test_cases/p00919/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1ccafdb0794d1378bc0601835cef497d7f3e47 --- /dev/null +++ b/codenet/public_test_cases/p00919/input.0.txt @@ -0,0 +1,10 @@ +4 0 2013 1124 +1 1 1 +2 2 2 +2 1 1 +1 2 1 +2 100 131832453 129800231 +42 40 46 +42 40 46 +0 100000 7004674 484521438 +0 0 0 0 diff --git a/codenet/public_test_cases/p00919/input.1.txt b/codenet/public_test_cases/p00919/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1ccafdb0794d1378bc0601835cef497d7f3e47 --- /dev/null +++ b/codenet/public_test_cases/p00919/input.1.txt @@ -0,0 +1,10 @@ +4 0 2013 1124 +1 1 1 +2 2 2 +2 1 1 +1 2 1 +2 100 131832453 129800231 +42 40 46 +42 40 46 +0 100000 7004674 484521438 +0 0 0 0 diff --git a/codenet/public_test_cases/p00919/output.0.txt b/codenet/public_test_cases/p00919/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d410d19a0c428b58bafb57f43f1e50687214eb4f --- /dev/null +++ b/codenet/public_test_cases/p00919/output.0.txt @@ -0,0 +1,3 @@ +1 1 1 1 2 1 +42 40 46 83 79 91 +92 92 79 99 99 85 diff --git a/codenet/public_test_cases/p00919/output.1.txt b/codenet/public_test_cases/p00919/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d410d19a0c428b58bafb57f43f1e50687214eb4f --- /dev/null +++ b/codenet/public_test_cases/p00919/output.1.txt @@ -0,0 +1,3 @@ +1 1 1 1 2 1 +42 40 46 83 79 91 +92 92 79 99 99 85 diff --git a/codenet/public_test_cases/p00920/input.0.txt b/codenet/public_test_cases/p00920/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..162581835343c91a32f96f98795f6c05f49b63e0 --- /dev/null +++ b/codenet/public_test_cases/p00920/input.0.txt @@ -0,0 +1,26 @@ +6 0 1 1 +0 0 0 +0 2 2 +1 1 1 +2 0 2 +2 2 0 +2 2 2 +5 0 1 1 +0 0 0 +1 1 1 +2 2 2 +3 3 3 +4 4 4 +10 0 1 1 +3 0 0 +2 1 0 +2 0 1 +1 2 0 +1 1 1 +1 0 2 +0 3 0 +0 2 1 +0 1 2 +0 0 3 +0 10 1 1 +0 0 0 0 diff --git a/codenet/public_test_cases/p00920/input.1.txt b/codenet/public_test_cases/p00920/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..162581835343c91a32f96f98795f6c05f49b63e0 --- /dev/null +++ b/codenet/public_test_cases/p00920/input.1.txt @@ -0,0 +1,26 @@ +6 0 1 1 +0 0 0 +0 2 2 +1 1 1 +2 0 2 +2 2 0 +2 2 2 +5 0 1 1 +0 0 0 +1 1 1 +2 2 2 +3 3 3 +4 4 4 +10 0 1 1 +3 0 0 +2 1 0 +2 0 1 +1 2 0 +1 1 1 +1 0 2 +0 3 0 +0 2 1 +0 1 2 +0 0 3 +0 10 1 1 +0 0 0 0 diff --git a/codenet/public_test_cases/p00920/output.0.txt b/codenet/public_test_cases/p00920/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38b5e7a6ae03292acfd0642ce7cc9d4f05e65998 --- /dev/null +++ b/codenet/public_test_cases/p00920/output.0.txt @@ -0,0 +1,4 @@ +3 +5 +1 +3 diff --git a/codenet/public_test_cases/p00920/output.1.txt b/codenet/public_test_cases/p00920/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38b5e7a6ae03292acfd0642ce7cc9d4f05e65998 --- /dev/null +++ b/codenet/public_test_cases/p00920/output.1.txt @@ -0,0 +1,4 @@ +3 +5 +1 +3 diff --git a/codenet/public_test_cases/p00921/input.0.txt b/codenet/public_test_cases/p00921/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f699cdda73e11894f6d9fabd351e521befc47505 --- /dev/null +++ b/codenet/public_test_cases/p00921/input.0.txt @@ -0,0 +1,22 @@ +5 16 +70 66 40 +38 52 20 +40 35 10 +70 30 10 +20 60 10 +1 100 +54 75 200 +1 10 +90 10 1 +1 11 +54 75 200 +3 10 +53 60 1 +61 38 1 +45 48 1 +4 10 +20 20 10 +20 80 10 +80 20 10 +80 80 10 +0 0 diff --git a/codenet/public_test_cases/p00921/input.1.txt b/codenet/public_test_cases/p00921/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f699cdda73e11894f6d9fabd351e521befc47505 --- /dev/null +++ b/codenet/public_test_cases/p00921/input.1.txt @@ -0,0 +1,22 @@ +5 16 +70 66 40 +38 52 20 +40 35 10 +70 30 10 +20 60 10 +1 100 +54 75 200 +1 10 +90 10 1 +1 11 +54 75 200 +3 10 +53 60 1 +61 38 1 +45 48 1 +4 10 +20 20 10 +20 80 10 +80 20 10 +80 80 10 +0 0 diff --git a/codenet/public_test_cases/p00921/output.0.txt b/codenet/public_test_cases/p00921/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..36134583e93d0bd9f3d9c8f9508ba4d39cf74287 --- /dev/null +++ b/codenet/public_test_cases/p00921/output.0.txt @@ -0,0 +1,6 @@ +26.00000 +39.00000 +130.00000 +49.49777 +85.00000 +95.00000 diff --git a/codenet/public_test_cases/p00921/output.1.txt b/codenet/public_test_cases/p00921/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..36134583e93d0bd9f3d9c8f9508ba4d39cf74287 --- /dev/null +++ b/codenet/public_test_cases/p00921/output.1.txt @@ -0,0 +1,6 @@ +26.00000 +39.00000 +130.00000 +49.49777 +85.00000 +95.00000 diff --git a/codenet/public_test_cases/p00922/input.0.txt b/codenet/public_test_cases/p00922/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5be28bbda1fce3dd5c025bc50a6f3e61e1a650a2 --- /dev/null +++ b/codenet/public_test_cases/p00922/input.0.txt @@ -0,0 +1,11 @@ +9 +3 4 1 3 1 2 4 4 6 +4 +3 12 6 3 +10 +10 9 8 7 6 5 4 3 2 1 +11 +10 9 8 7 6 5 4 3 2 1 1 +8 +1 1 1 1 1 1 1 1 +0 diff --git a/codenet/public_test_cases/p00922/input.1.txt b/codenet/public_test_cases/p00922/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5be28bbda1fce3dd5c025bc50a6f3e61e1a650a2 --- /dev/null +++ b/codenet/public_test_cases/p00922/input.1.txt @@ -0,0 +1,11 @@ +9 +3 4 1 3 1 2 4 4 6 +4 +3 12 6 3 +10 +10 9 8 7 6 5 4 3 2 1 +11 +10 9 8 7 6 5 4 3 2 1 1 +8 +1 1 1 1 1 1 1 1 +0 diff --git a/codenet/public_test_cases/p00922/output.0.txt b/codenet/public_test_cases/p00922/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09b82d920af56517d053a640550f1a66a3caa8dc --- /dev/null +++ b/codenet/public_test_cases/p00922/output.0.txt @@ -0,0 +1,5 @@ +6 +2 +1 +5 +8 diff --git a/codenet/public_test_cases/p00922/output.1.txt b/codenet/public_test_cases/p00922/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09b82d920af56517d053a640550f1a66a3caa8dc --- /dev/null +++ b/codenet/public_test_cases/p00922/output.1.txt @@ -0,0 +1,5 @@ +6 +2 +1 +5 +8 diff --git a/codenet/public_test_cases/p00923/input.0.txt b/codenet/public_test_cases/p00923/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e119c2b0025b40686cc1cd9da0e523a7a852f683 --- /dev/null +++ b/codenet/public_test_cases/p00923/input.0.txt @@ -0,0 +1,2 @@ +2 2 +^(C|I|T|Y)* diff --git a/codenet/public_test_cases/p00923/input.1.txt b/codenet/public_test_cases/p00923/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..20ae769b14dc094e079d8e73b2c873ea5961071a --- /dev/null +++ b/codenet/public_test_cases/p00923/input.1.txt @@ -0,0 +1,38 @@ +2 2 +^(C|I|T|Y)*$ +^(C|O|P|S)*$ +^(F|L|I|P)*$ +^(B|A|C|K)*$ +2 2 +^HE|LL|O*$ +^(P|L|E|A|S|E)*$ +^(H|L)*$ +^EP|IP|EF$ +4 4 +^LONG|TALL|S*ALLY$ +^(R*EV*|OL*U(TIO)*N)*$ +^(STRAWBERRY|F*I*E*L*D*S*|FOREVER)*$ +^P.S.|I|LOVE|YOU$ +^(RE|A|L)((L|OV*E)*)$ +^(LUC*Y*|IN.THE.SKY)(WITH|DI*A*M*ON*D*S*)$ +^(IVE*|GOT|A|F*E*E*L*I*N*G*)*$ +^YEST*E*R*D*A*Y*$ +2 3 +^(C|P)(OL|AS)$ +^(LU|TO)(X|R)$ +^CT|PL$ +^OU|AO$ +^SR|LX$ +2 2 +^T*|(HI)|S*$ +^SE|NT|EN|CE$ +^IS$ +^(F|A|L|S|E)*$ +2 4 +^ARKA|BARB|COLU$ +^NSAS|ADOS|MBIA$ +^..$ +^..$ +^KA|RO|LI$ +^AS|BA|US$ +0 0 diff --git a/codenet/public_test_cases/p00923/output.0.txt b/codenet/public_test_cases/p00923/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b35c60e9eca842b8553db84870d06517b0f1395 --- /dev/null +++ b/codenet/public_test_cases/p00923/output.0.txt @@ -0,0 +1,12 @@ +IC +PC +HE +LP +ALLY +OUNE +EDIS +LOVE +ambiguous +none +ARKA +NSAS diff --git a/codenet/public_test_cases/p00923/output.1.txt b/codenet/public_test_cases/p00923/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b35c60e9eca842b8553db84870d06517b0f1395 --- /dev/null +++ b/codenet/public_test_cases/p00923/output.1.txt @@ -0,0 +1,12 @@ +IC +PC +HE +LP +ALLY +OUNE +EDIS +LOVE +ambiguous +none +ARKA +NSAS diff --git a/codenet/public_test_cases/p00924/input.0.txt b/codenet/public_test_cases/p00924/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0252bf02f105fc6a7bd7bbafa1e24e611482c7f7 --- /dev/null +++ b/codenet/public_test_cases/p00924/input.0.txt @@ -0,0 +1,3 @@ +6 3 +1 0 0 1 0 1 +1 3 2 diff --git a/codenet/public_test_cases/p00924/input.1.txt b/codenet/public_test_cases/p00924/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0252bf02f105fc6a7bd7bbafa1e24e611482c7f7 --- /dev/null +++ b/codenet/public_test_cases/p00924/input.1.txt @@ -0,0 +1,3 @@ +6 3 +1 0 0 1 0 1 +1 3 2 diff --git a/codenet/public_test_cases/p00924/output.0.txt b/codenet/public_test_cases/p00924/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00924/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00924/output.1.txt b/codenet/public_test_cases/p00924/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00924/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00925/input.0.txt b/codenet/public_test_cases/p00925/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1827f7a57f7b4fed6b3f7681332257a4e259c3f5 --- /dev/null +++ b/codenet/public_test_cases/p00925/input.0.txt @@ -0,0 +1,2 @@ +1+2*3+4 +11 diff --git a/codenet/public_test_cases/p00925/input.1.txt b/codenet/public_test_cases/p00925/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1827f7a57f7b4fed6b3f7681332257a4e259c3f5 --- /dev/null +++ b/codenet/public_test_cases/p00925/input.1.txt @@ -0,0 +1,2 @@ +1+2*3+4 +11 diff --git a/codenet/public_test_cases/p00925/output.0.txt b/codenet/public_test_cases/p00925/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab7768987ce64e0490e93767ca9a4bcd950c79f6 --- /dev/null +++ b/codenet/public_test_cases/p00925/output.0.txt @@ -0,0 +1 @@ +M diff --git a/codenet/public_test_cases/p00925/output.1.txt b/codenet/public_test_cases/p00925/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab7768987ce64e0490e93767ca9a4bcd950c79f6 --- /dev/null +++ b/codenet/public_test_cases/p00925/output.1.txt @@ -0,0 +1 @@ +M diff --git a/codenet/public_test_cases/p00926/input.0.txt b/codenet/public_test_cases/p00926/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2542f843ae857d425354c786aa1f82c66fd25c65 --- /dev/null +++ b/codenet/public_test_cases/p00926/input.0.txt @@ -0,0 +1,4 @@ +10 3 +3 7 +8 9 +2 5 diff --git a/codenet/public_test_cases/p00926/input.1.txt b/codenet/public_test_cases/p00926/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2542f843ae857d425354c786aa1f82c66fd25c65 --- /dev/null +++ b/codenet/public_test_cases/p00926/input.1.txt @@ -0,0 +1,4 @@ +10 3 +3 7 +8 9 +2 5 diff --git a/codenet/public_test_cases/p00926/output.0.txt b/codenet/public_test_cases/p00926/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p00926/output.0.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p00926/output.1.txt b/codenet/public_test_cases/p00926/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p00926/output.1.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p00927/input.0.txt b/codenet/public_test_cases/p00927/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfb2f002df7088426ef4fc02cd981c81a4265e9f --- /dev/null +++ b/codenet/public_test_cases/p00927/input.0.txt @@ -0,0 +1,2 @@ +100 1 0 +50 100 diff --git a/codenet/public_test_cases/p00927/input.1.txt b/codenet/public_test_cases/p00927/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfb2f002df7088426ef4fc02cd981c81a4265e9f --- /dev/null +++ b/codenet/public_test_cases/p00927/input.1.txt @@ -0,0 +1,2 @@ +100 1 0 +50 100 diff --git a/codenet/public_test_cases/p00927/output.0.txt b/codenet/public_test_cases/p00927/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..359f144ef8f40420341c0a1ee10d877a367e0dca --- /dev/null +++ b/codenet/public_test_cases/p00927/output.0.txt @@ -0,0 +1 @@ +14.57738 diff --git a/codenet/public_test_cases/p00927/output.1.txt b/codenet/public_test_cases/p00927/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..359f144ef8f40420341c0a1ee10d877a367e0dca --- /dev/null +++ b/codenet/public_test_cases/p00927/output.1.txt @@ -0,0 +1 @@ +14.57738 diff --git a/codenet/public_test_cases/p00928/input.0.txt b/codenet/public_test_cases/p00928/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65d2bcd6a72edd199440fc7692e80d031117c32f --- /dev/null +++ b/codenet/public_test_cases/p00928/input.0.txt @@ -0,0 +1,6 @@ +4 2 1 1 +1 1 1 2 +2 2 2 1 +2 2 1 2 +1 1 2 1 +9 N diff --git a/codenet/public_test_cases/p00928/input.1.txt b/codenet/public_test_cases/p00928/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..65d2bcd6a72edd199440fc7692e80d031117c32f --- /dev/null +++ b/codenet/public_test_cases/p00928/input.1.txt @@ -0,0 +1,6 @@ +4 2 1 1 +1 1 1 2 +2 2 2 1 +2 2 1 2 +1 1 2 1 +9 N diff --git a/codenet/public_test_cases/p00928/output.0.txt b/codenet/public_test_cases/p00928/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..534fb831b52dd06eb844551dc8df3424726f91c8 --- /dev/null +++ b/codenet/public_test_cases/p00928/output.0.txt @@ -0,0 +1,2 @@ +1 1 +2 2 diff --git a/codenet/public_test_cases/p00928/output.1.txt b/codenet/public_test_cases/p00928/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..534fb831b52dd06eb844551dc8df3424726f91c8 --- /dev/null +++ b/codenet/public_test_cases/p00928/output.1.txt @@ -0,0 +1,2 @@ +1 1 +2 2 diff --git a/codenet/public_test_cases/p00929/input.0.txt b/codenet/public_test_cases/p00929/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05b6876bae0716848c08d9347a5623f0ee8a5e72 --- /dev/null +++ b/codenet/public_test_cases/p00929/input.0.txt @@ -0,0 +1,5 @@ +4 4 +1 2 3 +1 3 3 +2 3 3 +2 4 3 diff --git a/codenet/public_test_cases/p00929/input.1.txt b/codenet/public_test_cases/p00929/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05b6876bae0716848c08d9347a5623f0ee8a5e72 --- /dev/null +++ b/codenet/public_test_cases/p00929/input.1.txt @@ -0,0 +1,5 @@ +4 4 +1 2 3 +1 3 3 +2 3 3 +2 4 3 diff --git a/codenet/public_test_cases/p00929/output.0.txt b/codenet/public_test_cases/p00929/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p00929/output.0.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p00929/output.1.txt b/codenet/public_test_cases/p00929/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p00929/output.1.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p00930/input.0.txt b/codenet/public_test_cases/p00930/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..969f6555b09c5e843f07c28f9f4c5f86a2a0f0de --- /dev/null +++ b/codenet/public_test_cases/p00930/input.0.txt @@ -0,0 +1,5 @@ +6 3 +((())) +4 +3 +1 diff --git a/codenet/public_test_cases/p00930/input.1.txt b/codenet/public_test_cases/p00930/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..969f6555b09c5e843f07c28f9f4c5f86a2a0f0de --- /dev/null +++ b/codenet/public_test_cases/p00930/input.1.txt @@ -0,0 +1,5 @@ +6 3 +((())) +4 +3 +1 diff --git a/codenet/public_test_cases/p00930/output.0.txt b/codenet/public_test_cases/p00930/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19920de3d3ca2f47740788afd7bd6979b4753a25 --- /dev/null +++ b/codenet/public_test_cases/p00930/output.0.txt @@ -0,0 +1,3 @@ +2 +2 +1 diff --git a/codenet/public_test_cases/p00930/output.1.txt b/codenet/public_test_cases/p00930/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19920de3d3ca2f47740788afd7bd6979b4753a25 --- /dev/null +++ b/codenet/public_test_cases/p00930/output.1.txt @@ -0,0 +1,3 @@ +2 +2 +1 diff --git a/codenet/public_test_cases/p00931/input.0.txt b/codenet/public_test_cases/p00931/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd8290ddbdb3edc5a263934a5246a246cae091 --- /dev/null +++ b/codenet/public_test_cases/p00931/input.0.txt @@ -0,0 +1,9 @@ +8 900 0 +40 100 +70 -80 +350 30 +680 -20 +230 230 +300 400 +530 130 +75 -275 diff --git a/codenet/public_test_cases/p00931/input.1.txt b/codenet/public_test_cases/p00931/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd8290ddbdb3edc5a263934a5246a246cae091 --- /dev/null +++ b/codenet/public_test_cases/p00931/input.1.txt @@ -0,0 +1,9 @@ +8 900 0 +40 100 +70 -80 +350 30 +680 -20 +230 230 +300 400 +530 130 +75 -275 diff --git a/codenet/public_test_cases/p00931/output.0.txt b/codenet/public_test_cases/p00931/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..738fe25d1db02db1f954b5459cfd718aee8e8627 --- /dev/null +++ b/codenet/public_test_cases/p00931/output.0.txt @@ -0,0 +1 @@ +1210.99416 diff --git a/codenet/public_test_cases/p00931/output.1.txt b/codenet/public_test_cases/p00931/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..738fe25d1db02db1f954b5459cfd718aee8e8627 --- /dev/null +++ b/codenet/public_test_cases/p00931/output.1.txt @@ -0,0 +1 @@ +1210.99416 diff --git a/codenet/public_test_cases/p00932/input.0.txt b/codenet/public_test_cases/p00932/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b675d8b23035141754b796eebefa2423272e368 --- /dev/null +++ b/codenet/public_test_cases/p00932/input.0.txt @@ -0,0 +1,3 @@ +2 5 4 +5 7 +4 8 diff --git a/codenet/public_test_cases/p00932/input.1.txt b/codenet/public_test_cases/p00932/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b675d8b23035141754b796eebefa2423272e368 --- /dev/null +++ b/codenet/public_test_cases/p00932/input.1.txt @@ -0,0 +1,3 @@ +2 5 4 +5 7 +4 8 diff --git a/codenet/public_test_cases/p00932/output.0.txt b/codenet/public_test_cases/p00932/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b931b626951453f7df0a8d00612b2153fb38ae0f --- /dev/null +++ b/codenet/public_test_cases/p00932/output.0.txt @@ -0,0 +1 @@ +8 7 diff --git a/codenet/public_test_cases/p00932/output.1.txt b/codenet/public_test_cases/p00932/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b931b626951453f7df0a8d00612b2153fb38ae0f --- /dev/null +++ b/codenet/public_test_cases/p00932/output.1.txt @@ -0,0 +1 @@ +8 7 diff --git a/codenet/public_test_cases/p00933/input.0.txt b/codenet/public_test_cases/p00933/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcaf2a48d232d435d45debac34acd2edc9c75f64 --- /dev/null +++ b/codenet/public_test_cases/p00933/input.0.txt @@ -0,0 +1,7 @@ +6 5 1 2 3 +5 5 5 +1 5 5 +2 5 4 +3 5 3 +4 5 2 +5 5 1 diff --git a/codenet/public_test_cases/p00933/input.1.txt b/codenet/public_test_cases/p00933/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcaf2a48d232d435d45debac34acd2edc9c75f64 --- /dev/null +++ b/codenet/public_test_cases/p00933/input.1.txt @@ -0,0 +1,7 @@ +6 5 1 2 3 +5 5 5 +1 5 5 +2 5 4 +3 5 3 +4 5 2 +5 5 1 diff --git a/codenet/public_test_cases/p00933/output.0.txt b/codenet/public_test_cases/p00933/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b577109f2c38b587bbe85cf6f62a249a7d6b0993 --- /dev/null +++ b/codenet/public_test_cases/p00933/output.0.txt @@ -0,0 +1 @@ +0.631579 diff --git a/codenet/public_test_cases/p00933/output.1.txt b/codenet/public_test_cases/p00933/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b577109f2c38b587bbe85cf6f62a249a7d6b0993 --- /dev/null +++ b/codenet/public_test_cases/p00933/output.1.txt @@ -0,0 +1 @@ +0.631579 diff --git a/codenet/public_test_cases/p00934/input.0.txt b/codenet/public_test_cases/p00934/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6eed801e8a5eaf7ae770d9d3736452ff2b74c061 --- /dev/null +++ b/codenet/public_test_cases/p00934/input.0.txt @@ -0,0 +1,4 @@ +3 2 4 0 +2 2 +-2 -2 +-2 2 diff --git a/codenet/public_test_cases/p00934/input.1.txt b/codenet/public_test_cases/p00934/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6eed801e8a5eaf7ae770d9d3736452ff2b74c061 --- /dev/null +++ b/codenet/public_test_cases/p00934/input.1.txt @@ -0,0 +1,4 @@ +3 2 4 0 +2 2 +-2 -2 +-2 2 diff --git a/codenet/public_test_cases/p00934/output.0.txt b/codenet/public_test_cases/p00934/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p00934/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p00934/output.1.txt b/codenet/public_test_cases/p00934/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p00934/output.1.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p00935/input.0.txt b/codenet/public_test_cases/p00935/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01b9e21f7db584fe04191f0fb0b3758a047cc1ce --- /dev/null +++ b/codenet/public_test_cases/p00935/input.0.txt @@ -0,0 +1,2 @@ +3 +3 0 1 diff --git a/codenet/public_test_cases/p00935/input.1.txt b/codenet/public_test_cases/p00935/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01b9e21f7db584fe04191f0fb0b3758a047cc1ce --- /dev/null +++ b/codenet/public_test_cases/p00935/input.1.txt @@ -0,0 +1,2 @@ +3 +3 0 1 diff --git a/codenet/public_test_cases/p00935/output.0.txt b/codenet/public_test_cases/p00935/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00935/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00935/output.1.txt b/codenet/public_test_cases/p00935/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00935/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00936/input.0.txt b/codenet/public_test_cases/p00936/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3314d15e70c1c64f25f278a70ac685bc43dca403 --- /dev/null +++ b/codenet/public_test_cases/p00936/input.0.txt @@ -0,0 +1,2 @@ +2 +10 10 diff --git a/codenet/public_test_cases/p00936/input.1.txt b/codenet/public_test_cases/p00936/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3314d15e70c1c64f25f278a70ac685bc43dca403 --- /dev/null +++ b/codenet/public_test_cases/p00936/input.1.txt @@ -0,0 +1,2 @@ +2 +10 10 diff --git a/codenet/public_test_cases/p00936/output.0.txt b/codenet/public_test_cases/p00936/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7301d4c91097107817a52fd3302b651d724cffc7 --- /dev/null +++ b/codenet/public_test_cases/p00936/output.0.txt @@ -0,0 +1 @@ +40.00000000 diff --git a/codenet/public_test_cases/p00936/output.1.txt b/codenet/public_test_cases/p00936/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7301d4c91097107817a52fd3302b651d724cffc7 --- /dev/null +++ b/codenet/public_test_cases/p00936/output.1.txt @@ -0,0 +1 @@ +40.00000000 diff --git a/codenet/public_test_cases/p00937/input.0.txt b/codenet/public_test_cases/p00937/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..829615584e7034e77f6370a9bab487d613b54a7b --- /dev/null +++ b/codenet/public_test_cases/p00937/input.0.txt @@ -0,0 +1,4 @@ +3 3 1 2 4 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p00937/input.1.txt b/codenet/public_test_cases/p00937/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..829615584e7034e77f6370a9bab487d613b54a7b --- /dev/null +++ b/codenet/public_test_cases/p00937/input.1.txt @@ -0,0 +1,4 @@ +3 3 1 2 4 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p00937/output.0.txt b/codenet/public_test_cases/p00937/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p00937/output.0.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p00937/output.1.txt b/codenet/public_test_cases/p00937/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p00937/output.1.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p00938/input.0.txt b/codenet/public_test_cases/p00938/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6db901c21a47c6a04fbb7477e40599b6910f372 --- /dev/null +++ b/codenet/public_test_cases/p00938/input.0.txt @@ -0,0 +1,3 @@ +2 10 6 +4 4 E +6 4 W diff --git a/codenet/public_test_cases/p00938/input.1.txt b/codenet/public_test_cases/p00938/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6db901c21a47c6a04fbb7477e40599b6910f372 --- /dev/null +++ b/codenet/public_test_cases/p00938/input.1.txt @@ -0,0 +1,3 @@ +2 10 6 +4 4 E +6 4 W diff --git a/codenet/public_test_cases/p00938/output.0.txt b/codenet/public_test_cases/p00938/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00938/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00938/output.1.txt b/codenet/public_test_cases/p00938/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00938/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00939/input.0.txt b/codenet/public_test_cases/p00939/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p00939/input.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p00939/input.1.txt b/codenet/public_test_cases/p00939/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p00939/input.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p00939/output.0.txt b/codenet/public_test_cases/p00939/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00939/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00939/output.1.txt b/codenet/public_test_cases/p00939/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00939/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00940/input.0.txt b/codenet/public_test_cases/p00940/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27ea32e24385a1f65613b03261854f28704b3428 --- /dev/null +++ b/codenet/public_test_cases/p00940/input.0.txt @@ -0,0 +1,11 @@ +2 2 7 +3 4 +3 2 +1 3 +1 1 +2 2 +1 2 +2 1 +1 2 +2 2 +1 1 diff --git a/codenet/public_test_cases/p00940/input.1.txt b/codenet/public_test_cases/p00940/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27ea32e24385a1f65613b03261854f28704b3428 --- /dev/null +++ b/codenet/public_test_cases/p00940/input.1.txt @@ -0,0 +1,11 @@ +2 2 7 +3 4 +3 2 +1 3 +1 1 +2 2 +1 2 +2 1 +1 2 +2 2 +1 1 diff --git a/codenet/public_test_cases/p00940/output.0.txt b/codenet/public_test_cases/p00940/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00940/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00940/output.1.txt b/codenet/public_test_cases/p00940/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00940/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00941/input.0.txt b/codenet/public_test_cases/p00941/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba393ea5c64524c08ca0c79545f7338a2596292a --- /dev/null +++ b/codenet/public_test_cases/p00941/input.0.txt @@ -0,0 +1,2 @@ +crc +1 diff --git a/codenet/public_test_cases/p00941/input.1.txt b/codenet/public_test_cases/p00941/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba393ea5c64524c08ca0c79545f7338a2596292a --- /dev/null +++ b/codenet/public_test_cases/p00941/input.1.txt @@ -0,0 +1,2 @@ +crc +1 diff --git a/codenet/public_test_cases/p00941/output.0.txt b/codenet/public_test_cases/p00941/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4267887735831d77a420901ff7c2493cf5fac344 --- /dev/null +++ b/codenet/public_test_cases/p00941/output.0.txt @@ -0,0 +1 @@ +crc diff --git a/codenet/public_test_cases/p00941/output.1.txt b/codenet/public_test_cases/p00941/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4267887735831d77a420901ff7c2493cf5fac344 --- /dev/null +++ b/codenet/public_test_cases/p00941/output.1.txt @@ -0,0 +1 @@ +crc diff --git a/codenet/public_test_cases/p00942/input.0.txt b/codenet/public_test_cases/p00942/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..021f8343579d9f09449c4b9ad5b03fd890adad00 --- /dev/null +++ b/codenet/public_test_cases/p00942/input.0.txt @@ -0,0 +1,11 @@ +4 6 5 +-2 5 +-2 -1 +2 -1 +2 5 +-2 1 +-2 0 +0 0 +0 -2 +2 -2 +2 1 diff --git a/codenet/public_test_cases/p00942/input.1.txt b/codenet/public_test_cases/p00942/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..021f8343579d9f09449c4b9ad5b03fd890adad00 --- /dev/null +++ b/codenet/public_test_cases/p00942/input.1.txt @@ -0,0 +1,11 @@ +4 6 5 +-2 5 +-2 -1 +2 -1 +2 5 +-2 1 +-2 0 +0 0 +0 -2 +2 -2 +2 1 diff --git a/codenet/public_test_cases/p00942/output.0.txt b/codenet/public_test_cases/p00942/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00942/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00942/output.1.txt b/codenet/public_test_cases/p00942/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p00942/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p00943/input.0.txt b/codenet/public_test_cases/p00943/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbec3e75a11fc50242437c78ee957f77be0ea3c0 --- /dev/null +++ b/codenet/public_test_cases/p00943/input.0.txt @@ -0,0 +1,13 @@ +6 6 +3 +1 +9 +4 +3 +6 +1 2 +1 4 +2 6 +5 4 +6 5 +3 2 diff --git a/codenet/public_test_cases/p00943/input.1.txt b/codenet/public_test_cases/p00943/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbec3e75a11fc50242437c78ee957f77be0ea3c0 --- /dev/null +++ b/codenet/public_test_cases/p00943/input.1.txt @@ -0,0 +1,13 @@ +6 6 +3 +1 +9 +4 +3 +6 +1 2 +1 4 +2 6 +5 4 +6 5 +3 2 diff --git a/codenet/public_test_cases/p00943/output.0.txt b/codenet/public_test_cases/p00943/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p00943/output.0.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p00943/output.1.txt b/codenet/public_test_cases/p00943/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p00943/output.1.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p00944/input.0.txt b/codenet/public_test_cases/p00944/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c18c738c70a9cf61425242f8fa8309bf8a0fd2d --- /dev/null +++ b/codenet/public_test_cases/p00944/input.0.txt @@ -0,0 +1,21 @@ +8 8 +1 2 +1 3 +2 4 +2 5 +2 8 +3 5 +3 6 +4 7 +1000 +100 +100 +10 +10 +10 +1 +1 +3 +2 8 6 +2 4 7 +2 7 8 diff --git a/codenet/public_test_cases/p00944/input.1.txt b/codenet/public_test_cases/p00944/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c18c738c70a9cf61425242f8fa8309bf8a0fd2d --- /dev/null +++ b/codenet/public_test_cases/p00944/input.1.txt @@ -0,0 +1,21 @@ +8 8 +1 2 +1 3 +2 4 +2 5 +2 8 +3 5 +3 6 +4 7 +1000 +100 +100 +10 +10 +10 +1 +1 +3 +2 8 6 +2 4 7 +2 7 8 diff --git a/codenet/public_test_cases/p00944/output.0.txt b/codenet/public_test_cases/p00944/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01ce9d0260a273ad67d1e00baddd689c41f7b84b --- /dev/null +++ b/codenet/public_test_cases/p00944/output.0.txt @@ -0,0 +1,3 @@ +1000 +10 +100 diff --git a/codenet/public_test_cases/p00944/output.1.txt b/codenet/public_test_cases/p00944/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01ce9d0260a273ad67d1e00baddd689c41f7b84b --- /dev/null +++ b/codenet/public_test_cases/p00944/output.1.txt @@ -0,0 +1,3 @@ +1000 +10 +100 diff --git a/codenet/public_test_cases/p00945/input.0.txt b/codenet/public_test_cases/p00945/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..701f1aba1c07c8f092ac0ea2e46324efad80b51e --- /dev/null +++ b/codenet/public_test_cases/p00945/input.0.txt @@ -0,0 +1,2 @@ +5 Alice +10 20 30 40 50 diff --git a/codenet/public_test_cases/p00945/input.1.txt b/codenet/public_test_cases/p00945/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..701f1aba1c07c8f092ac0ea2e46324efad80b51e --- /dev/null +++ b/codenet/public_test_cases/p00945/input.1.txt @@ -0,0 +1,2 @@ +5 Alice +10 20 30 40 50 diff --git a/codenet/public_test_cases/p00945/output.0.txt b/codenet/public_test_cases/p00945/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p00945/output.0.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p00945/output.1.txt b/codenet/public_test_cases/p00945/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p00945/output.1.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p00946/input.0.txt b/codenet/public_test_cases/p00946/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..06aaaeb44c1d7c147b3a0d474d263ae80b277dee --- /dev/null +++ b/codenet/public_test_cases/p00946/input.0.txt @@ -0,0 +1,4 @@ +5 3 +4 +2 +5 diff --git a/codenet/public_test_cases/p00946/input.1.txt b/codenet/public_test_cases/p00946/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..06aaaeb44c1d7c147b3a0d474d263ae80b277dee --- /dev/null +++ b/codenet/public_test_cases/p00946/input.1.txt @@ -0,0 +1,4 @@ +5 3 +4 +2 +5 diff --git a/codenet/public_test_cases/p00946/output.0.txt b/codenet/public_test_cases/p00946/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbcbd24bd8d4c4a420b38fc3b8b91d7c72080960 --- /dev/null +++ b/codenet/public_test_cases/p00946/output.0.txt @@ -0,0 +1,5 @@ +5 +2 +4 +1 +3 diff --git a/codenet/public_test_cases/p00946/output.1.txt b/codenet/public_test_cases/p00946/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbcbd24bd8d4c4a420b38fc3b8b91d7c72080960 --- /dev/null +++ b/codenet/public_test_cases/p00946/output.1.txt @@ -0,0 +1,5 @@ +5 +2 +4 +1 +3 diff --git a/codenet/public_test_cases/p00947/input.0.txt b/codenet/public_test_cases/p00947/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38d5e7849b8ec61302fb4168968612fc7740bedb --- /dev/null +++ b/codenet/public_test_cases/p00947/input.0.txt @@ -0,0 +1,10 @@ +0 3 1 7 5 9 8 6 4 2 +7 0 9 2 1 5 4 8 6 3 +4 2 0 6 8 7 1 3 5 9 +1 7 5 0 9 8 3 4 2 6 +6 1 2 3 0 4 5 9 7 8 +3 6 7 4 2 0 9 5 8 1 +5 8 6 9 7 2 0 1 3 4 +8 9 4 5 3 6 2 0 1 7 +9 4 3 8 6 1 7 2 0 5 +2 5 8 1 4 3 6 7 9 0 diff --git a/codenet/public_test_cases/p00947/input.1.txt b/codenet/public_test_cases/p00947/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38d5e7849b8ec61302fb4168968612fc7740bedb --- /dev/null +++ b/codenet/public_test_cases/p00947/input.1.txt @@ -0,0 +1,10 @@ +0 3 1 7 5 9 8 6 4 2 +7 0 9 2 1 5 4 8 6 3 +4 2 0 6 8 7 1 3 5 9 +1 7 5 0 9 8 3 4 2 6 +6 1 2 3 0 4 5 9 7 8 +3 6 7 4 2 0 9 5 8 1 +5 8 6 9 7 2 0 1 3 4 +8 9 4 5 3 6 2 0 1 7 +9 4 3 8 6 1 7 2 0 5 +2 5 8 1 4 3 6 7 9 0 diff --git a/codenet/public_test_cases/p00947/output.0.txt b/codenet/public_test_cases/p00947/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00947/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00947/output.1.txt b/codenet/public_test_cases/p00947/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00947/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00948/input.0.txt b/codenet/public_test_cases/p00948/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bf5902674c7a752b957d269ab6724c15c66e043 --- /dev/null +++ b/codenet/public_test_cases/p00948/input.0.txt @@ -0,0 +1,4 @@ +4 3 +1000 1 +2000 2 +3000 3 diff --git a/codenet/public_test_cases/p00948/input.1.txt b/codenet/public_test_cases/p00948/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bf5902674c7a752b957d269ab6724c15c66e043 --- /dev/null +++ b/codenet/public_test_cases/p00948/input.1.txt @@ -0,0 +1,4 @@ +4 3 +1000 1 +2000 2 +3000 3 diff --git a/codenet/public_test_cases/p00948/output.0.txt b/codenet/public_test_cases/p00948/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e96def4da39925f003d00125f6047f560e56b5f --- /dev/null +++ b/codenet/public_test_cases/p00948/output.0.txt @@ -0,0 +1 @@ +2 3 4 4 diff --git a/codenet/public_test_cases/p00948/output.1.txt b/codenet/public_test_cases/p00948/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e96def4da39925f003d00125f6047f560e56b5f --- /dev/null +++ b/codenet/public_test_cases/p00948/output.1.txt @@ -0,0 +1 @@ +2 3 4 4 diff --git a/codenet/public_test_cases/p00949/input.0.txt b/codenet/public_test_cases/p00949/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b0c396a2e52213252b8ab553115f413b7c68d70 --- /dev/null +++ b/codenet/public_test_cases/p00949/input.0.txt @@ -0,0 +1,2 @@ +anagram +grandmother diff --git a/codenet/public_test_cases/p00949/input.1.txt b/codenet/public_test_cases/p00949/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b0c396a2e52213252b8ab553115f413b7c68d70 --- /dev/null +++ b/codenet/public_test_cases/p00949/input.1.txt @@ -0,0 +1,2 @@ +anagram +grandmother diff --git a/codenet/public_test_cases/p00949/output.0.txt b/codenet/public_test_cases/p00949/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00949/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00949/output.1.txt b/codenet/public_test_cases/p00949/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00949/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00950/input.0.txt b/codenet/public_test_cases/p00950/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..71095f0089edb4eebc182047b16e0d1e66155944 --- /dev/null +++ b/codenet/public_test_cases/p00950/input.0.txt @@ -0,0 +1 @@ +ACM diff --git a/codenet/public_test_cases/p00950/input.1.txt b/codenet/public_test_cases/p00950/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..71095f0089edb4eebc182047b16e0d1e66155944 --- /dev/null +++ b/codenet/public_test_cases/p00950/input.1.txt @@ -0,0 +1 @@ +ACM diff --git a/codenet/public_test_cases/p00950/output.0.txt b/codenet/public_test_cases/p00950/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00950/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00950/output.1.txt b/codenet/public_test_cases/p00950/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00950/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00951/input.0.txt b/codenet/public_test_cases/p00951/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7dad9bc12d6526976d5104c693e84096683705e --- /dev/null +++ b/codenet/public_test_cases/p00951/input.0.txt @@ -0,0 +1,11 @@ +Alice Bob +3 +2 +Alice Bob +Bob Clare +2 +Bob Clare +Clare David +2 +Clare David +David Alice diff --git a/codenet/public_test_cases/p00951/input.1.txt b/codenet/public_test_cases/p00951/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7dad9bc12d6526976d5104c693e84096683705e --- /dev/null +++ b/codenet/public_test_cases/p00951/input.1.txt @@ -0,0 +1,11 @@ +Alice Bob +3 +2 +Alice Bob +Bob Clare +2 +Bob Clare +Clare David +2 +Clare David +David Alice diff --git a/codenet/public_test_cases/p00951/output.0.txt b/codenet/public_test_cases/p00951/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p00951/output.0.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p00951/output.1.txt b/codenet/public_test_cases/p00951/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p00951/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p00952/input.0.txt b/codenet/public_test_cases/p00952/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b847c740ca208bc70defd3b99ce74904c0297062 --- /dev/null +++ b/codenet/public_test_cases/p00952/input.0.txt @@ -0,0 +1,7 @@ +6 +2 +3 +1 +1 +4 +2 diff --git a/codenet/public_test_cases/p00952/input.1.txt b/codenet/public_test_cases/p00952/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b847c740ca208bc70defd3b99ce74904c0297062 --- /dev/null +++ b/codenet/public_test_cases/p00952/input.1.txt @@ -0,0 +1,7 @@ +6 +2 +3 +1 +1 +4 +2 diff --git a/codenet/public_test_cases/p00952/output.0.txt b/codenet/public_test_cases/p00952/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebd85b34895a7d6e2047278e995a907d70f7e3d9 --- /dev/null +++ b/codenet/public_test_cases/p00952/output.0.txt @@ -0,0 +1,6 @@ +Yes +Yes +Yes +No +Yes +No diff --git a/codenet/public_test_cases/p00952/output.1.txt b/codenet/public_test_cases/p00952/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebd85b34895a7d6e2047278e995a907d70f7e3d9 --- /dev/null +++ b/codenet/public_test_cases/p00952/output.1.txt @@ -0,0 +1,6 @@ +Yes +Yes +Yes +No +Yes +No diff --git a/codenet/public_test_cases/p00953/input.0.txt b/codenet/public_test_cases/p00953/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..68583a202a6df246d3f363a0c145ff72dbad34fc --- /dev/null +++ b/codenet/public_test_cases/p00953/input.0.txt @@ -0,0 +1,2 @@ +2 1 +1 2 2 diff --git a/codenet/public_test_cases/p00953/input.1.txt b/codenet/public_test_cases/p00953/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..68583a202a6df246d3f363a0c145ff72dbad34fc --- /dev/null +++ b/codenet/public_test_cases/p00953/input.1.txt @@ -0,0 +1,2 @@ +2 1 +1 2 2 diff --git a/codenet/public_test_cases/p00953/output.0.txt b/codenet/public_test_cases/p00953/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00953/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00953/output.1.txt b/codenet/public_test_cases/p00953/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00953/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00954/input.0.txt b/codenet/public_test_cases/p00954/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..238e77d1ce997981ca3625612ec74e7e901d04b3 --- /dev/null +++ b/codenet/public_test_cases/p00954/input.0.txt @@ -0,0 +1,3 @@ +2 +5 6 +1000000000 2 diff --git a/codenet/public_test_cases/p00954/input.1.txt b/codenet/public_test_cases/p00954/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..238e77d1ce997981ca3625612ec74e7e901d04b3 --- /dev/null +++ b/codenet/public_test_cases/p00954/input.1.txt @@ -0,0 +1,3 @@ +2 +5 6 +1000000000 2 diff --git a/codenet/public_test_cases/p00954/output.0.txt b/codenet/public_test_cases/p00954/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f411cb49cf1030897f1967a7b78f0158c129a1e6 --- /dev/null +++ b/codenet/public_test_cases/p00954/output.0.txt @@ -0,0 +1,9 @@ +4 +5 6 +0 6 +0 0 +5 0 +3 +1000000000 0 +0 2 +999999999 0 diff --git a/codenet/public_test_cases/p00954/output.1.txt b/codenet/public_test_cases/p00954/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f411cb49cf1030897f1967a7b78f0158c129a1e6 --- /dev/null +++ b/codenet/public_test_cases/p00954/output.1.txt @@ -0,0 +1,9 @@ +4 +5 6 +0 6 +0 0 +5 0 +3 +1000000000 0 +0 2 +999999999 0 diff --git a/codenet/public_test_cases/p00955/input.0.txt b/codenet/public_test_cases/p00955/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a36461d7da058013f9f8468ae02863364b9f142 --- /dev/null +++ b/codenet/public_test_cases/p00955/input.0.txt @@ -0,0 +1,5 @@ +4 4 +0 0 +6 0 +6 6 +0 6 diff --git a/codenet/public_test_cases/p00955/input.1.txt b/codenet/public_test_cases/p00955/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a36461d7da058013f9f8468ae02863364b9f142 --- /dev/null +++ b/codenet/public_test_cases/p00955/input.1.txt @@ -0,0 +1,5 @@ +4 4 +0 0 +6 0 +6 6 +0 6 diff --git a/codenet/public_test_cases/p00955/output.0.txt b/codenet/public_test_cases/p00955/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8e3f4ac3f15a1e2831aff4b3c44bd3023877e5 --- /dev/null +++ b/codenet/public_test_cases/p00955/output.0.txt @@ -0,0 +1 @@ +35.759506 diff --git a/codenet/public_test_cases/p00955/output.1.txt b/codenet/public_test_cases/p00955/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8e3f4ac3f15a1e2831aff4b3c44bd3023877e5 --- /dev/null +++ b/codenet/public_test_cases/p00955/output.1.txt @@ -0,0 +1 @@ +35.759506 diff --git a/codenet/public_test_cases/p00956/input.0.txt b/codenet/public_test_cases/p00956/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4517805b4b9eda6d89d898a1064863b14c16ffe7 --- /dev/null +++ b/codenet/public_test_cases/p00956/input.0.txt @@ -0,0 +1,5 @@ +4 +B +W +WB +WB diff --git a/codenet/public_test_cases/p00956/input.1.txt b/codenet/public_test_cases/p00956/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4517805b4b9eda6d89d898a1064863b14c16ffe7 --- /dev/null +++ b/codenet/public_test_cases/p00956/input.1.txt @@ -0,0 +1,5 @@ +4 +B +W +WB +WB diff --git a/codenet/public_test_cases/p00956/output.0.txt b/codenet/public_test_cases/p00956/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00956/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00956/output.1.txt b/codenet/public_test_cases/p00956/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00956/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00957/input.0.txt b/codenet/public_test_cases/p00957/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p00957/input.0.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p00957/input.1.txt b/codenet/public_test_cases/p00957/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p00957/input.1.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p00957/output.0.txt b/codenet/public_test_cases/p00957/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00957/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00957/output.1.txt b/codenet/public_test_cases/p00957/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p00957/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p00958/input.0.txt b/codenet/public_test_cases/p00958/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..032dd219e74aaca58a42a045f4762a0dc48761fe --- /dev/null +++ b/codenet/public_test_cases/p00958/input.0.txt @@ -0,0 +1,5 @@ +4 +0 0 +1 1 +0 2 +2 4 diff --git a/codenet/public_test_cases/p00958/input.1.txt b/codenet/public_test_cases/p00958/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..032dd219e74aaca58a42a045f4762a0dc48761fe --- /dev/null +++ b/codenet/public_test_cases/p00958/input.1.txt @@ -0,0 +1,5 @@ +4 +0 0 +1 1 +0 2 +2 4 diff --git a/codenet/public_test_cases/p00958/output.0.txt b/codenet/public_test_cases/p00958/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00958/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00958/output.1.txt b/codenet/public_test_cases/p00958/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00958/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00959/input.0.txt b/codenet/public_test_cases/p00959/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6126bad35f529ade2a4fe3b262adb47c28dafe0 --- /dev/null +++ b/codenet/public_test_cases/p00959/input.0.txt @@ -0,0 +1,4 @@ +3 20 +5 +7 +3 diff --git a/codenet/public_test_cases/p00959/input.1.txt b/codenet/public_test_cases/p00959/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6126bad35f529ade2a4fe3b262adb47c28dafe0 --- /dev/null +++ b/codenet/public_test_cases/p00959/input.1.txt @@ -0,0 +1,4 @@ +3 20 +5 +7 +3 diff --git a/codenet/public_test_cases/p00959/output.0.txt b/codenet/public_test_cases/p00959/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1f394db19e9252b3d2f55039da3727fdd8e3780 --- /dev/null +++ b/codenet/public_test_cases/p00959/output.0.txt @@ -0,0 +1,3 @@ +5 +3 +2 diff --git a/codenet/public_test_cases/p00959/output.1.txt b/codenet/public_test_cases/p00959/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1f394db19e9252b3d2f55039da3727fdd8e3780 --- /dev/null +++ b/codenet/public_test_cases/p00959/output.1.txt @@ -0,0 +1,3 @@ +5 +3 +2 diff --git a/codenet/public_test_cases/p00960/input.0.txt b/codenet/public_test_cases/p00960/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaa6a17e699e2040e8b35e90914a9a584da68509 --- /dev/null +++ b/codenet/public_test_cases/p00960/input.0.txt @@ -0,0 +1,11 @@ +10 +-53 62 +-19 58 +-11 11 +-9 -22 +45 -7 +37 -39 +47 -58 +-2 41 +-37 10 +13 42 diff --git a/codenet/public_test_cases/p00960/input.1.txt b/codenet/public_test_cases/p00960/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaa6a17e699e2040e8b35e90914a9a584da68509 --- /dev/null +++ b/codenet/public_test_cases/p00960/input.1.txt @@ -0,0 +1,11 @@ +10 +-53 62 +-19 58 +-11 11 +-9 -22 +45 -7 +37 -39 +47 -58 +-2 41 +-37 10 +13 42 diff --git a/codenet/public_test_cases/p00960/output.0.txt b/codenet/public_test_cases/p00960/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d0d1652ac407069ff017cf3e515f3be2f460fac --- /dev/null +++ b/codenet/public_test_cases/p00960/output.0.txt @@ -0,0 +1 @@ +72.96316928 diff --git a/codenet/public_test_cases/p00960/output.1.txt b/codenet/public_test_cases/p00960/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d0d1652ac407069ff017cf3e515f3be2f460fac --- /dev/null +++ b/codenet/public_test_cases/p00960/output.1.txt @@ -0,0 +1 @@ +72.96316928 diff --git a/codenet/public_test_cases/p00961/input.0.txt b/codenet/public_test_cases/p00961/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e21fad4fed23c2ec831f8686c80fcd37c317fc01 --- /dev/null +++ b/codenet/public_test_cases/p00961/input.0.txt @@ -0,0 +1,3 @@ +4 4 +BWWB +WBBW diff --git a/codenet/public_test_cases/p00961/input.1.txt b/codenet/public_test_cases/p00961/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e21fad4fed23c2ec831f8686c80fcd37c317fc01 --- /dev/null +++ b/codenet/public_test_cases/p00961/input.1.txt @@ -0,0 +1,3 @@ +4 4 +BWWB +WBBW diff --git a/codenet/public_test_cases/p00961/output.0.txt b/codenet/public_test_cases/p00961/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00961/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00961/output.1.txt b/codenet/public_test_cases/p00961/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00961/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00962/input.0.txt b/codenet/public_test_cases/p00962/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e94812c9872832f96e1eb70054c38af4cd026f02 --- /dev/null +++ b/codenet/public_test_cases/p00962/input.0.txt @@ -0,0 +1,6 @@ +4 5 +1 3 5 +3 4 6 +4 2 7 +2 1 18 +2 3 12 diff --git a/codenet/public_test_cases/p00962/input.1.txt b/codenet/public_test_cases/p00962/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e94812c9872832f96e1eb70054c38af4cd026f02 --- /dev/null +++ b/codenet/public_test_cases/p00962/input.1.txt @@ -0,0 +1,6 @@ +4 5 +1 3 5 +3 4 6 +4 2 7 +2 1 18 +2 3 12 diff --git a/codenet/public_test_cases/p00962/output.0.txt b/codenet/public_test_cases/p00962/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bc85352f975465d9b13acf789dff5a08293a14d --- /dev/null +++ b/codenet/public_test_cases/p00962/output.0.txt @@ -0,0 +1,5 @@ +SAD +SAD +SAD +SOSO +HAPPY diff --git a/codenet/public_test_cases/p00962/output.1.txt b/codenet/public_test_cases/p00962/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bc85352f975465d9b13acf789dff5a08293a14d --- /dev/null +++ b/codenet/public_test_cases/p00962/output.1.txt @@ -0,0 +1,5 @@ +SAD +SAD +SAD +SOSO +HAPPY diff --git a/codenet/public_test_cases/p00963/input.0.txt b/codenet/public_test_cases/p00963/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e5fa2c39924e6ffc78b786d9e3ecd5bbc363162 --- /dev/null +++ b/codenet/public_test_cases/p00963/input.0.txt @@ -0,0 +1,2 @@ +CD 30 1 +DB 30 1 diff --git a/codenet/public_test_cases/p00963/input.1.txt b/codenet/public_test_cases/p00963/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e5fa2c39924e6ffc78b786d9e3ecd5bbc363162 --- /dev/null +++ b/codenet/public_test_cases/p00963/input.1.txt @@ -0,0 +1,2 @@ +CD 30 1 +DB 30 1 diff --git a/codenet/public_test_cases/p00963/output.0.txt b/codenet/public_test_cases/p00963/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p00963/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p00963/output.1.txt b/codenet/public_test_cases/p00963/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p00963/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p00964/input.0.txt b/codenet/public_test_cases/p00964/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d629cf439fc349ab5b51a134bae1e393b5d8fa52 --- /dev/null +++ b/codenet/public_test_cases/p00964/input.0.txt @@ -0,0 +1,7 @@ +6 3 +1 2 +1 5 +2 3 +2 6 +4 5 +4 6 diff --git a/codenet/public_test_cases/p00964/output.0.txt b/codenet/public_test_cases/p00964/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74abe52ea08f303355ad2b8a25939c5ba57c9224 --- /dev/null +++ b/codenet/public_test_cases/p00964/output.0.txt @@ -0,0 +1,2 @@ +6 +2 diff --git a/codenet/public_test_cases/p00965/input.0.txt b/codenet/public_test_cases/p00965/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a8548f7f726074e75eea5f91c7c76b2350971cf --- /dev/null +++ b/codenet/public_test_cases/p00965/input.0.txt @@ -0,0 +1,5 @@ +4 +1 3 +1 3 +3 6 +3 6 diff --git a/codenet/public_test_cases/p00965/input.1.txt b/codenet/public_test_cases/p00965/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a8548f7f726074e75eea5f91c7c76b2350971cf --- /dev/null +++ b/codenet/public_test_cases/p00965/input.1.txt @@ -0,0 +1,5 @@ +4 +1 3 +1 3 +3 6 +3 6 diff --git a/codenet/public_test_cases/p00965/output.0.txt b/codenet/public_test_cases/p00965/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p00965/output.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p00965/output.1.txt b/codenet/public_test_cases/p00965/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p00965/output.1.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p00966/input.0.txt b/codenet/public_test_cases/p00966/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00a10c84d83db78f672ccf5c93b00751b43fa75b --- /dev/null +++ b/codenet/public_test_cases/p00966/input.0.txt @@ -0,0 +1,14 @@ +9 4 5 4 +3 C +4 I +7 C +9 P +2 1 +4 0 +6 2 +7 0 +8 4 +8 +1 +9 +6 diff --git a/codenet/public_test_cases/p00966/input.1.txt b/codenet/public_test_cases/p00966/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00a10c84d83db78f672ccf5c93b00751b43fa75b --- /dev/null +++ b/codenet/public_test_cases/p00966/input.1.txt @@ -0,0 +1,14 @@ +9 4 5 4 +3 C +4 I +7 C +9 P +2 1 +4 0 +6 2 +7 0 +8 4 +8 +1 +9 +6 diff --git a/codenet/public_test_cases/p00966/output.0.txt b/codenet/public_test_cases/p00966/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f9942a39cec662030bad290e85515385f2b9361 --- /dev/null +++ b/codenet/public_test_cases/p00966/output.0.txt @@ -0,0 +1 @@ +ICPC diff --git a/codenet/public_test_cases/p00966/output.1.txt b/codenet/public_test_cases/p00966/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f9942a39cec662030bad290e85515385f2b9361 --- /dev/null +++ b/codenet/public_test_cases/p00966/output.1.txt @@ -0,0 +1 @@ +ICPC diff --git a/codenet/public_test_cases/p00967/input.0.txt b/codenet/public_test_cases/p00967/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d543efe645160a1c7785e94bfa586aa20767ce8 --- /dev/null +++ b/codenet/public_test_cases/p00967/input.0.txt @@ -0,0 +1,6 @@ +4 5 +1 2 +1 3 +1 4 +2 3 +3 4 diff --git a/codenet/public_test_cases/p00967/input.1.txt b/codenet/public_test_cases/p00967/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d543efe645160a1c7785e94bfa586aa20767ce8 --- /dev/null +++ b/codenet/public_test_cases/p00967/input.1.txt @@ -0,0 +1,6 @@ +4 5 +1 2 +1 3 +1 4 +2 3 +3 4 diff --git a/codenet/public_test_cases/p00967/output.0.txt b/codenet/public_test_cases/p00967/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00967/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00967/output.1.txt b/codenet/public_test_cases/p00967/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00967/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00968/input.0.txt b/codenet/public_test_cases/p00968/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75b02ee23568bcbbc5147fe52f9090b937b0c10e --- /dev/null +++ b/codenet/public_test_cases/p00968/input.0.txt @@ -0,0 +1,4 @@ +2 +file10 +file20 +file3 diff --git a/codenet/public_test_cases/p00968/input.1.txt b/codenet/public_test_cases/p00968/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75b02ee23568bcbbc5147fe52f9090b937b0c10e --- /dev/null +++ b/codenet/public_test_cases/p00968/input.1.txt @@ -0,0 +1,4 @@ +2 +file10 +file20 +file3 diff --git a/codenet/public_test_cases/p00968/output.0.txt b/codenet/public_test_cases/p00968/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58f2351689788f641f0cbc0222e0f86da3bede50 --- /dev/null +++ b/codenet/public_test_cases/p00968/output.0.txt @@ -0,0 +1,2 @@ ++ +- diff --git a/codenet/public_test_cases/p00968/output.1.txt b/codenet/public_test_cases/p00968/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58f2351689788f641f0cbc0222e0f86da3bede50 --- /dev/null +++ b/codenet/public_test_cases/p00968/output.1.txt @@ -0,0 +1,2 @@ ++ +- diff --git a/codenet/public_test_cases/p00969/input.0.txt b/codenet/public_test_cases/p00969/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3150c77111a49edc3eaa2c56054e2b16cc33b81 --- /dev/null +++ b/codenet/public_test_cases/p00969/input.0.txt @@ -0,0 +1,2 @@ +6 +0 1 3 5 6 9 diff --git a/codenet/public_test_cases/p00969/input.1.txt b/codenet/public_test_cases/p00969/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3150c77111a49edc3eaa2c56054e2b16cc33b81 --- /dev/null +++ b/codenet/public_test_cases/p00969/input.1.txt @@ -0,0 +1,2 @@ +6 +0 1 3 5 6 9 diff --git a/codenet/public_test_cases/p00969/output.0.txt b/codenet/public_test_cases/p00969/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00969/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00969/output.1.txt b/codenet/public_test_cases/p00969/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00969/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00970/input.0.txt b/codenet/public_test_cases/p00970/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a175c31998e44768538b46e5fead4e7dfcdf541e --- /dev/null +++ b/codenet/public_test_cases/p00970/input.0.txt @@ -0,0 +1,8 @@ +5 2 7 +1 1 +1 2 +1 3 +2 3 +2 4 +4 4 +5 2 diff --git a/codenet/public_test_cases/p00970/input.1.txt b/codenet/public_test_cases/p00970/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a175c31998e44768538b46e5fead4e7dfcdf541e --- /dev/null +++ b/codenet/public_test_cases/p00970/input.1.txt @@ -0,0 +1,8 @@ +5 2 7 +1 1 +1 2 +1 3 +2 3 +2 4 +4 4 +5 2 diff --git a/codenet/public_test_cases/p00970/output.0.txt b/codenet/public_test_cases/p00970/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p00970/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p00970/output.1.txt b/codenet/public_test_cases/p00970/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p00970/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p00971/input.0.txt b/codenet/public_test_cases/p00971/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a08e1a0dd3ad4603035f3a62d1f1d4939049760 --- /dev/null +++ b/codenet/public_test_cases/p00971/input.0.txt @@ -0,0 +1,2 @@ +0101 +1100001 diff --git a/codenet/public_test_cases/p00971/input.1.txt b/codenet/public_test_cases/p00971/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a08e1a0dd3ad4603035f3a62d1f1d4939049760 --- /dev/null +++ b/codenet/public_test_cases/p00971/input.1.txt @@ -0,0 +1,2 @@ +0101 +1100001 diff --git a/codenet/public_test_cases/p00971/output.0.txt b/codenet/public_test_cases/p00971/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66375d5000b615df5a358e796369a416871d0bef --- /dev/null +++ b/codenet/public_test_cases/p00971/output.0.txt @@ -0,0 +1 @@ +0010 diff --git a/codenet/public_test_cases/p00971/output.1.txt b/codenet/public_test_cases/p00971/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..66375d5000b615df5a358e796369a416871d0bef --- /dev/null +++ b/codenet/public_test_cases/p00971/output.1.txt @@ -0,0 +1 @@ +0010 diff --git a/codenet/public_test_cases/p00972/input.0.txt b/codenet/public_test_cases/p00972/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e24350da4dcc86fbf3fbe2775e72d0d00043af06 --- /dev/null +++ b/codenet/public_test_cases/p00972/input.0.txt @@ -0,0 +1,3 @@ +4 2 +1 2 +3 4 diff --git a/codenet/public_test_cases/p00972/input.1.txt b/codenet/public_test_cases/p00972/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e24350da4dcc86fbf3fbe2775e72d0d00043af06 --- /dev/null +++ b/codenet/public_test_cases/p00972/input.1.txt @@ -0,0 +1,3 @@ +4 2 +1 2 +3 4 diff --git a/codenet/public_test_cases/p00972/output.0.txt b/codenet/public_test_cases/p00972/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6ba1f7d0c19599ab70f0a325be1f6b7fdbfeb43 --- /dev/null +++ b/codenet/public_test_cases/p00972/output.0.txt @@ -0,0 +1,3 @@ +2 +1 4 +2 3 diff --git a/codenet/public_test_cases/p00972/output.1.txt b/codenet/public_test_cases/p00972/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6ba1f7d0c19599ab70f0a325be1f6b7fdbfeb43 --- /dev/null +++ b/codenet/public_test_cases/p00972/output.1.txt @@ -0,0 +1,3 @@ +2 +1 4 +2 3 diff --git a/codenet/public_test_cases/p00973/input.0.txt b/codenet/public_test_cases/p00973/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d5068448b7f24d961044caa0a2364befd8481e7 --- /dev/null +++ b/codenet/public_test_cases/p00973/input.0.txt @@ -0,0 +1,5 @@ +4 +0 0 +10 0 +10 10 +0 10 diff --git a/codenet/public_test_cases/p00973/input.1.txt b/codenet/public_test_cases/p00973/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d5068448b7f24d961044caa0a2364befd8481e7 --- /dev/null +++ b/codenet/public_test_cases/p00973/input.1.txt @@ -0,0 +1,5 @@ +4 +0 0 +10 0 +10 10 +0 10 diff --git a/codenet/public_test_cases/p00973/output.0.txt b/codenet/public_test_cases/p00973/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c9715714211c690f5bc9498a141d103794c8d18 --- /dev/null +++ b/codenet/public_test_cases/p00973/output.0.txt @@ -0,0 +1,2 @@ +10 +14.142135623730950488 diff --git a/codenet/public_test_cases/p00973/output.1.txt b/codenet/public_test_cases/p00973/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c9715714211c690f5bc9498a141d103794c8d18 --- /dev/null +++ b/codenet/public_test_cases/p00973/output.1.txt @@ -0,0 +1,2 @@ +10 +14.142135623730950488 diff --git a/codenet/public_test_cases/p00974/input.0.txt b/codenet/public_test_cases/p00974/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e87d7a086c27bcb29567dd1086f15cc55abd524 --- /dev/null +++ b/codenet/public_test_cases/p00974/input.0.txt @@ -0,0 +1,2 @@ +7 +3 1 4 1 5 9 2 diff --git a/codenet/public_test_cases/p00974/input.1.txt b/codenet/public_test_cases/p00974/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e87d7a086c27bcb29567dd1086f15cc55abd524 --- /dev/null +++ b/codenet/public_test_cases/p00974/input.1.txt @@ -0,0 +1,2 @@ +7 +3 1 4 1 5 9 2 diff --git a/codenet/public_test_cases/p00974/output.0.txt b/codenet/public_test_cases/p00974/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00974/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00974/output.1.txt b/codenet/public_test_cases/p00974/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00974/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00975/input.0.txt b/codenet/public_test_cases/p00975/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad04b14d836580364bfd760bf14a0915b0a36c9f --- /dev/null +++ b/codenet/public_test_cases/p00975/input.0.txt @@ -0,0 +1,14 @@ +5 8 +0 0 +2 0 +0 2 +2 2 +1 1 +1 2 +1 3 +1 5 +2 4 +2 5 +3 4 +3 5 +4 5 diff --git a/codenet/public_test_cases/p00975/input.1.txt b/codenet/public_test_cases/p00975/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad04b14d836580364bfd760bf14a0915b0a36c9f --- /dev/null +++ b/codenet/public_test_cases/p00975/input.1.txt @@ -0,0 +1,14 @@ +5 8 +0 0 +2 0 +0 2 +2 2 +1 1 +1 2 +1 3 +1 5 +2 4 +2 5 +3 4 +3 5 +4 5 diff --git a/codenet/public_test_cases/p00975/output.0.txt b/codenet/public_test_cases/p00975/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2272d0d0ecd659c805a87c06bd1909a0bc31a6e9 --- /dev/null +++ b/codenet/public_test_cases/p00975/output.0.txt @@ -0,0 +1,5 @@ +1 +2 +2 +1 +3 diff --git a/codenet/public_test_cases/p00975/output.1.txt b/codenet/public_test_cases/p00975/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2272d0d0ecd659c805a87c06bd1909a0bc31a6e9 --- /dev/null +++ b/codenet/public_test_cases/p00975/output.1.txt @@ -0,0 +1,5 @@ +1 +2 +2 +1 +3 diff --git a/codenet/public_test_cases/p00976/input.0.txt b/codenet/public_test_cases/p00976/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc2e386f170b0278d6ceafb4b5fe49d64bef59a0 --- /dev/null +++ b/codenet/public_test_cases/p00976/input.0.txt @@ -0,0 +1,3 @@ +2 3 +001 +101 diff --git a/codenet/public_test_cases/p00976/input.1.txt b/codenet/public_test_cases/p00976/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc2e386f170b0278d6ceafb4b5fe49d64bef59a0 --- /dev/null +++ b/codenet/public_test_cases/p00976/input.1.txt @@ -0,0 +1,3 @@ +2 3 +001 +101 diff --git a/codenet/public_test_cases/p00976/output.0.txt b/codenet/public_test_cases/p00976/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcbbe1b8e52e1c702e2ef0a0e561bbc301309211 --- /dev/null +++ b/codenet/public_test_cases/p00976/output.0.txt @@ -0,0 +1,2 @@ +-0- +-00 diff --git a/codenet/public_test_cases/p00976/output.1.txt b/codenet/public_test_cases/p00976/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcbbe1b8e52e1c702e2ef0a0e561bbc301309211 --- /dev/null +++ b/codenet/public_test_cases/p00976/output.1.txt @@ -0,0 +1,2 @@ +-0- +-00 diff --git a/codenet/public_test_cases/p00977/input.0.txt b/codenet/public_test_cases/p00977/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98270692f8f19feba05ac8b0be8eed251ae7e2ee --- /dev/null +++ b/codenet/public_test_cases/p00977/input.0.txt @@ -0,0 +1,18 @@ +5 +1 2 +2 3 +3 4 +2 5 +1 2 1 2 3 +11 +Q 1 +Q 2 +Q 3 +Q 4 +U 5 1 +Q 1 +U 3 2 +Q 1 +Q 2 +U 5 4 +Q 1 diff --git a/codenet/public_test_cases/p00977/input.1.txt b/codenet/public_test_cases/p00977/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98270692f8f19feba05ac8b0be8eed251ae7e2ee --- /dev/null +++ b/codenet/public_test_cases/p00977/input.1.txt @@ -0,0 +1,18 @@ +5 +1 2 +2 3 +3 4 +2 5 +1 2 1 2 3 +11 +Q 1 +Q 2 +Q 3 +Q 4 +U 5 1 +Q 1 +U 3 2 +Q 1 +Q 2 +U 5 4 +Q 1 diff --git a/codenet/public_test_cases/p00977/output.0.txt b/codenet/public_test_cases/p00977/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45bcb8ca1fbc7d5a2bcac4a3ab675a23a630f5dc --- /dev/null +++ b/codenet/public_test_cases/p00977/output.0.txt @@ -0,0 +1,8 @@ +2 +2 +0 +-1 +3 +2 +2 +0 diff --git a/codenet/public_test_cases/p00977/output.1.txt b/codenet/public_test_cases/p00977/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45bcb8ca1fbc7d5a2bcac4a3ab675a23a630f5dc --- /dev/null +++ b/codenet/public_test_cases/p00977/output.1.txt @@ -0,0 +1,8 @@ +2 +2 +0 +-1 +3 +2 +2 +0 diff --git a/codenet/public_test_cases/p00978/input.0.txt b/codenet/public_test_cases/p00978/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87f24fba09d68504b852c6b3be97212f97651b90 --- /dev/null +++ b/codenet/public_test_cases/p00978/input.0.txt @@ -0,0 +1,3 @@ +5 +1 2 3 4 5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p00978/input.1.txt b/codenet/public_test_cases/p00978/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87f24fba09d68504b852c6b3be97212f97651b90 --- /dev/null +++ b/codenet/public_test_cases/p00978/input.1.txt @@ -0,0 +1,3 @@ +5 +1 2 3 4 5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p00978/output.0.txt b/codenet/public_test_cases/p00978/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0aea478dd748e3319cbdb3130376fadc9608568 --- /dev/null +++ b/codenet/public_test_cases/p00978/output.0.txt @@ -0,0 +1 @@ +2 3 4 5 1 diff --git a/codenet/public_test_cases/p00978/output.1.txt b/codenet/public_test_cases/p00978/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0aea478dd748e3319cbdb3130376fadc9608568 --- /dev/null +++ b/codenet/public_test_cases/p00978/output.1.txt @@ -0,0 +1 @@ +2 3 4 5 1 diff --git a/codenet/public_test_cases/p00979/input.0.txt b/codenet/public_test_cases/p00979/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p00979/input.0.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p00979/input.1.txt b/codenet/public_test_cases/p00979/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p00979/input.1.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p00979/output.0.txt b/codenet/public_test_cases/p00979/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00979/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00979/output.1.txt b/codenet/public_test_cases/p00979/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p00979/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p00980/input.0.txt b/codenet/public_test_cases/p00980/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62d6db627746c41ae15afa50dd58833bc7f90d22 --- /dev/null +++ b/codenet/public_test_cases/p00980/input.0.txt @@ -0,0 +1,3 @@ +5 4 2 +1 1 10 +5 4 3 diff --git a/codenet/public_test_cases/p00980/input.1.txt b/codenet/public_test_cases/p00980/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..62d6db627746c41ae15afa50dd58833bc7f90d22 --- /dev/null +++ b/codenet/public_test_cases/p00980/input.1.txt @@ -0,0 +1,3 @@ +5 4 2 +1 1 10 +5 4 3 diff --git a/codenet/public_test_cases/p00980/output.0.txt b/codenet/public_test_cases/p00980/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd03ab2a61f407d4bd9068d6faf07cb898805cc0 --- /dev/null +++ b/codenet/public_test_cases/p00980/output.0.txt @@ -0,0 +1 @@ +130 diff --git a/codenet/public_test_cases/p00980/output.1.txt b/codenet/public_test_cases/p00980/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd03ab2a61f407d4bd9068d6faf07cb898805cc0 --- /dev/null +++ b/codenet/public_test_cases/p00980/output.1.txt @@ -0,0 +1 @@ +130 diff --git a/codenet/public_test_cases/p00981/input.0.txt b/codenet/public_test_cases/p00981/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cb0190fce925b5bb372663e072cae6212e2a0ef --- /dev/null +++ b/codenet/public_test_cases/p00981/input.0.txt @@ -0,0 +1,6 @@ +8 5 10 5 +1 1 7 +3 1 2 +1 5 6 +3 1 4 +3 6 8 diff --git a/codenet/public_test_cases/p00981/input.1.txt b/codenet/public_test_cases/p00981/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cb0190fce925b5bb372663e072cae6212e2a0ef --- /dev/null +++ b/codenet/public_test_cases/p00981/input.1.txt @@ -0,0 +1,6 @@ +8 5 10 5 +1 1 7 +3 1 2 +1 5 6 +3 1 4 +3 6 8 diff --git a/codenet/public_test_cases/p00981/output.0.txt b/codenet/public_test_cases/p00981/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bbd69c2e548374bb9a87e06a2cfe52136f28465 --- /dev/null +++ b/codenet/public_test_cases/p00981/output.0.txt @@ -0,0 +1 @@ +70 diff --git a/codenet/public_test_cases/p00981/output.1.txt b/codenet/public_test_cases/p00981/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bbd69c2e548374bb9a87e06a2cfe52136f28465 --- /dev/null +++ b/codenet/public_test_cases/p00981/output.1.txt @@ -0,0 +1 @@ +70 diff --git a/codenet/public_test_cases/p00982/input.0.txt b/codenet/public_test_cases/p00982/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87f490b4c178136e11c553dc1c7802469adc8827 --- /dev/null +++ b/codenet/public_test_cases/p00982/input.0.txt @@ -0,0 +1,11 @@ +3 +0 0 0 +1 0 0 +3 0 0 +1 2 +2 3 +0 0 0 +0 2 2 +0 3 3 +4 5 +5 6 diff --git a/codenet/public_test_cases/p00982/input.1.txt b/codenet/public_test_cases/p00982/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87f490b4c178136e11c553dc1c7802469adc8827 --- /dev/null +++ b/codenet/public_test_cases/p00982/input.1.txt @@ -0,0 +1,11 @@ +3 +0 0 0 +1 0 0 +3 0 0 +1 2 +2 3 +0 0 0 +0 2 2 +0 3 3 +4 5 +5 6 diff --git a/codenet/public_test_cases/p00982/output.0.txt b/codenet/public_test_cases/p00982/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00982/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00982/output.1.txt b/codenet/public_test_cases/p00982/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00982/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00983/input.0.txt b/codenet/public_test_cases/p00983/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf0b66608ba6a1a3178a8b32ebdd2f03e9061e0c --- /dev/null +++ b/codenet/public_test_cases/p00983/input.0.txt @@ -0,0 +1,2 @@ +6 3 +1 3 4 2 6 5 diff --git a/codenet/public_test_cases/p00983/input.1.txt b/codenet/public_test_cases/p00983/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf0b66608ba6a1a3178a8b32ebdd2f03e9061e0c --- /dev/null +++ b/codenet/public_test_cases/p00983/input.1.txt @@ -0,0 +1,2 @@ +6 3 +1 3 4 2 6 5 diff --git a/codenet/public_test_cases/p00983/output.0.txt b/codenet/public_test_cases/p00983/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00983/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00983/output.1.txt b/codenet/public_test_cases/p00983/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00983/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00984/input.0.txt b/codenet/public_test_cases/p00984/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c325ab72f14861e314c2822cd3be1c8d5bcf3fa --- /dev/null +++ b/codenet/public_test_cases/p00984/input.0.txt @@ -0,0 +1,3 @@ +2 0 +5 1 2 1 1 +10 1 3 2 2 diff --git a/codenet/public_test_cases/p00984/input.1.txt b/codenet/public_test_cases/p00984/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c325ab72f14861e314c2822cd3be1c8d5bcf3fa --- /dev/null +++ b/codenet/public_test_cases/p00984/input.1.txt @@ -0,0 +1,3 @@ +2 0 +5 1 2 1 1 +10 1 3 2 2 diff --git a/codenet/public_test_cases/p00984/output.0.txt b/codenet/public_test_cases/p00984/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p00984/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p00984/output.1.txt b/codenet/public_test_cases/p00984/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p00984/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p00985/input.0.txt b/codenet/public_test_cases/p00985/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6e1963b49cecaa477a7a58eee42cf0de8ef51b --- /dev/null +++ b/codenet/public_test_cases/p00985/input.0.txt @@ -0,0 +1,4 @@ +3 +0 +01 +10 diff --git a/codenet/public_test_cases/p00985/input.1.txt b/codenet/public_test_cases/p00985/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6e1963b49cecaa477a7a58eee42cf0de8ef51b --- /dev/null +++ b/codenet/public_test_cases/p00985/input.1.txt @@ -0,0 +1,4 @@ +3 +0 +01 +10 diff --git a/codenet/public_test_cases/p00985/output.0.txt b/codenet/public_test_cases/p00985/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00985/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00985/output.1.txt b/codenet/public_test_cases/p00985/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00985/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00986/input.0.txt b/codenet/public_test_cases/p00986/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0397e493a137c471cb2a2d52ca8ccd982b7e1bbe --- /dev/null +++ b/codenet/public_test_cases/p00986/input.0.txt @@ -0,0 +1 @@ +(()())---) diff --git a/codenet/public_test_cases/p00986/input.1.txt b/codenet/public_test_cases/p00986/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0397e493a137c471cb2a2d52ca8ccd982b7e1bbe --- /dev/null +++ b/codenet/public_test_cases/p00986/input.1.txt @@ -0,0 +1 @@ +(()())---) diff --git a/codenet/public_test_cases/p00986/output.0.txt b/codenet/public_test_cases/p00986/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a9dc15be9c3463b11790de22e24632793f49f2e --- /dev/null +++ b/codenet/public_test_cases/p00986/output.0.txt @@ -0,0 +1,10 @@ +0 +0 +1 +1 +3 +4 +3 +1 +1 +2 diff --git a/codenet/public_test_cases/p00986/output.1.txt b/codenet/public_test_cases/p00986/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a9dc15be9c3463b11790de22e24632793f49f2e --- /dev/null +++ b/codenet/public_test_cases/p00986/output.1.txt @@ -0,0 +1,10 @@ +0 +0 +1 +1 +3 +4 +3 +1 +1 +2 diff --git a/codenet/public_test_cases/p00987/input.0.txt b/codenet/public_test_cases/p00987/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd048a83a6e08bbb7573940461c43b1c40556587 --- /dev/null +++ b/codenet/public_test_cases/p00987/input.0.txt @@ -0,0 +1,7 @@ +3 2 +1 2 +2 3 +3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p00987/input.1.txt b/codenet/public_test_cases/p00987/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd048a83a6e08bbb7573940461c43b1c40556587 --- /dev/null +++ b/codenet/public_test_cases/p00987/input.1.txt @@ -0,0 +1,7 @@ +3 2 +1 2 +2 3 +3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p00987/output.0.txt b/codenet/public_test_cases/p00987/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ce42eefbc5dadd71a38d24c1b79349cd71ba7bf --- /dev/null +++ b/codenet/public_test_cases/p00987/output.0.txt @@ -0,0 +1,3 @@ +Yes +1 2 +2 3 diff --git a/codenet/public_test_cases/p00987/output.1.txt b/codenet/public_test_cases/p00987/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ce42eefbc5dadd71a38d24c1b79349cd71ba7bf --- /dev/null +++ b/codenet/public_test_cases/p00987/output.1.txt @@ -0,0 +1,3 @@ +Yes +1 2 +2 3 diff --git a/codenet/public_test_cases/p00988/input.0.txt b/codenet/public_test_cases/p00988/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db2f09217e5d7e0c7292e72407767f2fd4ca8205 --- /dev/null +++ b/codenet/public_test_cases/p00988/input.0.txt @@ -0,0 +1,5 @@ +4 +10 0 +20 10 +10 30 +0 10 diff --git a/codenet/public_test_cases/p00988/input.1.txt b/codenet/public_test_cases/p00988/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db2f09217e5d7e0c7292e72407767f2fd4ca8205 --- /dev/null +++ b/codenet/public_test_cases/p00988/input.1.txt @@ -0,0 +1,5 @@ +4 +10 0 +20 10 +10 30 +0 10 diff --git a/codenet/public_test_cases/p00988/output.0.txt b/codenet/public_test_cases/p00988/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56e040a2fb15adbe575b788826e882f18abed084 --- /dev/null +++ b/codenet/public_test_cases/p00988/output.0.txt @@ -0,0 +1 @@ +300.00 diff --git a/codenet/public_test_cases/p00988/output.1.txt b/codenet/public_test_cases/p00988/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..56e040a2fb15adbe575b788826e882f18abed084 --- /dev/null +++ b/codenet/public_test_cases/p00988/output.1.txt @@ -0,0 +1 @@ +300.00 diff --git a/codenet/public_test_cases/p00989/input.0.txt b/codenet/public_test_cases/p00989/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a255422f825fc448aff57c6e90e9d3694291b0 --- /dev/null +++ b/codenet/public_test_cases/p00989/input.0.txt @@ -0,0 +1,4 @@ +3 3 1 2 3 +.#. +### +.#. diff --git a/codenet/public_test_cases/p00989/input.1.txt b/codenet/public_test_cases/p00989/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a255422f825fc448aff57c6e90e9d3694291b0 --- /dev/null +++ b/codenet/public_test_cases/p00989/input.1.txt @@ -0,0 +1,4 @@ +3 3 1 2 3 +.#. +### +.#. diff --git a/codenet/public_test_cases/p00989/output.0.txt b/codenet/public_test_cases/p00989/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00989/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00989/output.1.txt b/codenet/public_test_cases/p00989/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00989/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00990/input.0.txt b/codenet/public_test_cases/p00990/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb1505768e1a5bf2c2f7c0fcfe4b3fd234eaa73e --- /dev/null +++ b/codenet/public_test_cases/p00990/input.0.txt @@ -0,0 +1,4 @@ +5 +5*57* +2 +3 9 diff --git a/codenet/public_test_cases/p00990/input.1.txt b/codenet/public_test_cases/p00990/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb1505768e1a5bf2c2f7c0fcfe4b3fd234eaa73e --- /dev/null +++ b/codenet/public_test_cases/p00990/input.1.txt @@ -0,0 +1,4 @@ +5 +5*57* +2 +3 9 diff --git a/codenet/public_test_cases/p00990/input.2.txt b/codenet/public_test_cases/p00990/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..17da0ea33c89c8ad55329916775d6702988ae3dd --- /dev/null +++ b/codenet/public_test_cases/p00990/input.2.txt @@ -0,0 +1,4 @@ +15 +2***9*2*6*1199* +9 +0 1 2 3 4 6 7 8 9 diff --git a/codenet/public_test_cases/p00990/output.0.txt b/codenet/public_test_cases/p00990/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00990/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00990/output.1.txt b/codenet/public_test_cases/p00990/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00990/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00990/output.2.txt b/codenet/public_test_cases/p00990/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd14f3beab95384a0a2fc92d09601ab2f2b32f6c --- /dev/null +++ b/codenet/public_test_cases/p00990/output.2.txt @@ -0,0 +1 @@ +478297 diff --git a/codenet/public_test_cases/p00991/input.0.txt b/codenet/public_test_cases/p00991/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cd9041630f58056d7b075e5c31aba14e2b4f151 --- /dev/null +++ b/codenet/public_test_cases/p00991/input.0.txt @@ -0,0 +1 @@ +4 4 0 0 3 3 diff --git a/codenet/public_test_cases/p00991/input.1.txt b/codenet/public_test_cases/p00991/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d4dbaaa29370c0848137a1ebde0d430c1ad79df --- /dev/null +++ b/codenet/public_test_cases/p00991/input.1.txt @@ -0,0 +1 @@ +500 500 0 0 200 200 diff --git a/codenet/public_test_cases/p00991/input.2.txt b/codenet/public_test_cases/p00991/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2325b4bcd61217365fc554cbb061e49738c94aa9 --- /dev/null +++ b/codenet/public_test_cases/p00991/input.2.txt @@ -0,0 +1 @@ +4 4 0 0 1 1 diff --git a/codenet/public_test_cases/p00991/input.3.txt b/codenet/public_test_cases/p00991/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cd9041630f58056d7b075e5c31aba14e2b4f151 --- /dev/null +++ b/codenet/public_test_cases/p00991/input.3.txt @@ -0,0 +1 @@ +4 4 0 0 3 3 diff --git a/codenet/public_test_cases/p00991/input.4.txt b/codenet/public_test_cases/p00991/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e53acc069eeef13fe6e6295a39aea542de4fc2cc --- /dev/null +++ b/codenet/public_test_cases/p00991/input.4.txt @@ -0,0 +1 @@ +2 3 0 0 1 2 diff --git a/codenet/public_test_cases/p00991/output.0.txt b/codenet/public_test_cases/p00991/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00991/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00991/output.1.txt b/codenet/public_test_cases/p00991/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..53e98daa050cdbd82bd093f2c14755c4591a86e0 --- /dev/null +++ b/codenet/public_test_cases/p00991/output.1.txt @@ -0,0 +1 @@ +34807775 diff --git a/codenet/public_test_cases/p00991/output.2.txt b/codenet/public_test_cases/p00991/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00991/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00991/output.3.txt b/codenet/public_test_cases/p00991/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00991/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00991/output.4.txt b/codenet/public_test_cases/p00991/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p00991/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p00992/input.0.txt b/codenet/public_test_cases/p00992/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..43ef02e3de6652847b39caafa66b03c7897b9e7a --- /dev/null +++ b/codenet/public_test_cases/p00992/input.0.txt @@ -0,0 +1,3 @@ +2 +5 +5 diff --git a/codenet/public_test_cases/p00992/input.1.txt b/codenet/public_test_cases/p00992/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c39b59ac349d289935dd2b1c14e59c8e5572bee0 --- /dev/null +++ b/codenet/public_test_cases/p00992/input.1.txt @@ -0,0 +1,11 @@ +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 diff --git a/codenet/public_test_cases/p00992/input.2.txt b/codenet/public_test_cases/p00992/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..43ef02e3de6652847b39caafa66b03c7897b9e7a --- /dev/null +++ b/codenet/public_test_cases/p00992/input.2.txt @@ -0,0 +1,3 @@ +2 +5 +5 diff --git a/codenet/public_test_cases/p00992/input.3.txt b/codenet/public_test_cases/p00992/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..74fc6f901f7e14b2a1243ec3e8ab6c3e49b438f6 --- /dev/null +++ b/codenet/public_test_cases/p00992/input.3.txt @@ -0,0 +1,6 @@ +5 +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p00992/output.0.txt b/codenet/public_test_cases/p00992/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00992/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00992/output.1.txt b/codenet/public_test_cases/p00992/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c67f579c9a811e9614857067f83cdfc7434920bf --- /dev/null +++ b/codenet/public_test_cases/p00992/output.1.txt @@ -0,0 +1 @@ +93 diff --git a/codenet/public_test_cases/p00992/output.2.txt b/codenet/public_test_cases/p00992/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p00992/output.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p00992/output.3.txt b/codenet/public_test_cases/p00992/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p00992/output.3.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p00993/input.0.txt b/codenet/public_test_cases/p00993/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00993/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00993/input.1.txt b/codenet/public_test_cases/p00993/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00993/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00993/input.2.txt b/codenet/public_test_cases/p00993/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p00993/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p00993/output.0.txt b/codenet/public_test_cases/p00993/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f4116020ef96ae272a8d72fbdee3778a31681c --- /dev/null +++ b/codenet/public_test_cases/p00993/output.0.txt @@ -0,0 +1,3 @@ +8 +2 +3 diff --git a/codenet/public_test_cases/p00993/output.1.txt b/codenet/public_test_cases/p00993/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca2c5d49b582e2df64024bc06e808597bde46550 --- /dev/null +++ b/codenet/public_test_cases/p00993/output.1.txt @@ -0,0 +1,4 @@ +8 +2 +3 +5 diff --git a/codenet/public_test_cases/p00993/output.2.txt b/codenet/public_test_cases/p00993/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f4116020ef96ae272a8d72fbdee3778a31681c --- /dev/null +++ b/codenet/public_test_cases/p00993/output.2.txt @@ -0,0 +1,3 @@ +8 +2 +3 diff --git a/codenet/public_test_cases/p00994/input.0.txt b/codenet/public_test_cases/p00994/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..04de1359f567af40937debd1eb13e5ec920bef20 --- /dev/null +++ b/codenet/public_test_cases/p00994/input.0.txt @@ -0,0 +1,4 @@ +3 3 +.1. +1.1 +.1. diff --git a/codenet/public_test_cases/p00994/input.1.txt b/codenet/public_test_cases/p00994/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e803339956ba9cb276183089d2fadea4a428e76 --- /dev/null +++ b/codenet/public_test_cases/p00994/input.1.txt @@ -0,0 +1,8 @@ +7 7 +2.3.1.1 +....... +2...... +....... +..3.3.. +....... +2.2.4.3 diff --git a/codenet/public_test_cases/p00994/input.2.txt b/codenet/public_test_cases/p00994/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..04de1359f567af40937debd1eb13e5ec920bef20 --- /dev/null +++ b/codenet/public_test_cases/p00994/input.2.txt @@ -0,0 +1,4 @@ +3 3 +.1. +1.1 +.1. diff --git a/codenet/public_test_cases/p00994/input.3.txt b/codenet/public_test_cases/p00994/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e8a241f1e32bcbf5e0fdfaee60eedeeb27c620e --- /dev/null +++ b/codenet/public_test_cases/p00994/input.3.txt @@ -0,0 +1,2 @@ +1 3 +1.1 diff --git a/codenet/public_test_cases/p00994/input.4.txt b/codenet/public_test_cases/p00994/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bb91e7721e9b2d6b2dcaba328734d49efdec97e --- /dev/null +++ b/codenet/public_test_cases/p00994/input.4.txt @@ -0,0 +1,4 @@ +3 3 +4.2 +... +2.. diff --git a/codenet/public_test_cases/p00994/output.0.txt b/codenet/public_test_cases/p00994/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00994/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00994/output.1.txt b/codenet/public_test_cases/p00994/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p00994/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p00994/output.2.txt b/codenet/public_test_cases/p00994/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p00994/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p00994/output.3.txt b/codenet/public_test_cases/p00994/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00994/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00994/output.4.txt b/codenet/public_test_cases/p00994/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p00994/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p00995/input.0.txt b/codenet/public_test_cases/p00995/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b7730dbe8372bc18eadb92b8dde16c26001b00a --- /dev/null +++ b/codenet/public_test_cases/p00995/input.0.txt @@ -0,0 +1,10 @@ +4 4 +0 1 3 +1 3 4 +0 2 2 +2 3 1 +4 +0 0 +2 2 +2 1 +3 4 diff --git a/codenet/public_test_cases/p00995/input.1.txt b/codenet/public_test_cases/p00995/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b7730dbe8372bc18eadb92b8dde16c26001b00a --- /dev/null +++ b/codenet/public_test_cases/p00995/input.1.txt @@ -0,0 +1,10 @@ +4 4 +0 1 3 +1 3 4 +0 2 2 +2 3 1 +4 +0 0 +2 2 +2 1 +3 4 diff --git a/codenet/public_test_cases/p00995/output.0.txt b/codenet/public_test_cases/p00995/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c35630e3ebade68a1b866f3b58b95f7533785fc7 --- /dev/null +++ b/codenet/public_test_cases/p00995/output.0.txt @@ -0,0 +1,4 @@ +1 +1 +2 +1 diff --git a/codenet/public_test_cases/p00995/output.1.txt b/codenet/public_test_cases/p00995/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c35630e3ebade68a1b866f3b58b95f7533785fc7 --- /dev/null +++ b/codenet/public_test_cases/p00995/output.1.txt @@ -0,0 +1,4 @@ +1 +1 +2 +1 diff --git a/codenet/public_test_cases/p00996/input.0.txt b/codenet/public_test_cases/p00996/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1817035476248eda77ef353cd7b0f17bb1180f45 --- /dev/null +++ b/codenet/public_test_cases/p00996/input.0.txt @@ -0,0 +1,4 @@ +3 3 +4o. +4o. +4o. diff --git a/codenet/public_test_cases/p00996/input.1.txt b/codenet/public_test_cases/p00996/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd6ed0b69cfe82b1fa5f2402fabe9ae2eb04c07c --- /dev/null +++ b/codenet/public_test_cases/p00996/input.1.txt @@ -0,0 +1,5 @@ +4 4 +4o.. +.o3. +.o.. +.5.. diff --git a/codenet/public_test_cases/p00996/input.2.txt b/codenet/public_test_cases/p00996/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1817035476248eda77ef353cd7b0f17bb1180f45 --- /dev/null +++ b/codenet/public_test_cases/p00996/input.2.txt @@ -0,0 +1,4 @@ +3 3 +4o. +4o. +4o. diff --git a/codenet/public_test_cases/p00996/input.3.txt b/codenet/public_test_cases/p00996/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fda7925c59006c2eb5f69e7d6f1b080fa54d869 --- /dev/null +++ b/codenet/public_test_cases/p00996/input.3.txt @@ -0,0 +1,7 @@ +6 10 +1xxxxxxxxx +o.......o. +xxxx.xxxx4 +xoxx.xxxx. +x....3xx.. +x..xxxxx.. diff --git a/codenet/public_test_cases/p00996/output.0.txt b/codenet/public_test_cases/p00996/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c68b42835be0cfa8ce1104c349a75c77a78406a8 --- /dev/null +++ b/codenet/public_test_cases/p00996/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00996/output.1.txt b/codenet/public_test_cases/p00996/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p00996/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00996/output.2.txt b/codenet/public_test_cases/p00996/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c68b42835be0cfa8ce1104c349a75c77a78406a8 --- /dev/null +++ b/codenet/public_test_cases/p00996/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p00996/output.3.txt b/codenet/public_test_cases/p00996/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p00996/output.3.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p00997/input.0.txt b/codenet/public_test_cases/p00997/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f7cba1fe1459397ea2cdc8220b2294bb37c2310 --- /dev/null +++ b/codenet/public_test_cases/p00997/input.0.txt @@ -0,0 +1,4 @@ +4 +0 1 3 +1 2 5 +1 3 2 diff --git a/codenet/public_test_cases/p00997/input.1.txt b/codenet/public_test_cases/p00997/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f7cba1fe1459397ea2cdc8220b2294bb37c2310 --- /dev/null +++ b/codenet/public_test_cases/p00997/input.1.txt @@ -0,0 +1,4 @@ +4 +0 1 3 +1 2 5 +1 3 2 diff --git a/codenet/public_test_cases/p00997/input.2.txt b/codenet/public_test_cases/p00997/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c8e13be994cd473c497eb64d253c19486ebd289 --- /dev/null +++ b/codenet/public_test_cases/p00997/input.2.txt @@ -0,0 +1,6 @@ +6 +0 2 5 +2 1 1 +2 3 10 +3 5 4 +3 4 2 diff --git a/codenet/public_test_cases/p00997/output.0.txt b/codenet/public_test_cases/p00997/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p00997/output.0.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p00997/output.1.txt b/codenet/public_test_cases/p00997/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p00997/output.1.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p00997/output.2.txt b/codenet/public_test_cases/p00997/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p00997/output.2.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p00998/input.0.txt b/codenet/public_test_cases/p00998/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12348c5af0a9296195990a2aae8058ac0a579a65 --- /dev/null +++ b/codenet/public_test_cases/p00998/input.0.txt @@ -0,0 +1,14 @@ +10 3 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +1 5 7 +0 2 5 +1 5 7 diff --git a/codenet/public_test_cases/p00998/input.1.txt b/codenet/public_test_cases/p00998/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12348c5af0a9296195990a2aae8058ac0a579a65 --- /dev/null +++ b/codenet/public_test_cases/p00998/input.1.txt @@ -0,0 +1,14 @@ +10 3 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +1 5 7 +0 2 5 +1 5 7 diff --git a/codenet/public_test_cases/p00998/input.2.txt b/codenet/public_test_cases/p00998/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8aa696a664ed7448d5940a78a1063b78d3240711 --- /dev/null +++ b/codenet/public_test_cases/p00998/input.2.txt @@ -0,0 +1,21 @@ +10 10 +289383 +930886 +692777 +636915 +747793 +238335 +885386 +760492 +516649 +641421 +2 7 368690 +1 3 6 +0 2 6 +1 1 8 +0 2 9 +2 2 665123 +1 5 9 +0 2 8 +2 7 961393 +1 1 2 diff --git a/codenet/public_test_cases/p00998/output.0.txt b/codenet/public_test_cases/p00998/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5104f3ba92814f8a900b02edfd354d47ebfb143 --- /dev/null +++ b/codenet/public_test_cases/p00998/output.0.txt @@ -0,0 +1,2 @@ +5 +4 diff --git a/codenet/public_test_cases/p00998/output.1.txt b/codenet/public_test_cases/p00998/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5104f3ba92814f8a900b02edfd354d47ebfb143 --- /dev/null +++ b/codenet/public_test_cases/p00998/output.1.txt @@ -0,0 +1,2 @@ +5 +4 diff --git a/codenet/public_test_cases/p00998/output.2.txt b/codenet/public_test_cases/p00998/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d285930fa4cf2c163533af6d96a0736ae3a5b0fd --- /dev/null +++ b/codenet/public_test_cases/p00998/output.2.txt @@ -0,0 +1,4 @@ +238335 +238335 +238335 +368690 diff --git a/codenet/public_test_cases/p00999/input.0.txt b/codenet/public_test_cases/p00999/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99b4d5354772a3c714af0655b5ad317e8bce7175 --- /dev/null +++ b/codenet/public_test_cases/p00999/input.0.txt @@ -0,0 +1,7 @@ +70 100 340 4 200 +1 1 4 +70 100 340 4 200 +0 1 3 +70 100 340 4 200 +1 1 2 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00999/input.1.txt b/codenet/public_test_cases/p00999/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99b4d5354772a3c714af0655b5ad317e8bce7175 --- /dev/null +++ b/codenet/public_test_cases/p00999/input.1.txt @@ -0,0 +1,7 @@ +70 100 340 4 200 +1 1 4 +70 100 340 4 200 +0 1 3 +70 100 340 4 200 +1 1 2 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p00999/output.0.txt b/codenet/public_test_cases/p00999/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..050b69256b7233cf9a1708665bb114fa1bff0d78 --- /dev/null +++ b/codenet/public_test_cases/p00999/output.0.txt @@ -0,0 +1,3 @@ +970 +800 +800 diff --git a/codenet/public_test_cases/p00999/output.1.txt b/codenet/public_test_cases/p00999/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..050b69256b7233cf9a1708665bb114fa1bff0d78 --- /dev/null +++ b/codenet/public_test_cases/p00999/output.1.txt @@ -0,0 +1,3 @@ +970 +800 +800 diff --git a/codenet/public_test_cases/p01000/input.0.txt b/codenet/public_test_cases/p01000/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f6d01a28e23f393d8bf4e67b0c7092648482476 --- /dev/null +++ b/codenet/public_test_cases/p01000/input.0.txt @@ -0,0 +1,100 @@ +5 +00000 +01010 +00000 +00100 +00000 + +00000 +01010 +00000 +01010 +00000 + +00000 +00100 +00000 +01010 +00000 + +00000 +01010 +00000 +00100 +00000 + +00000 +00000 +00100 +00000 +00000 + +1 2 +2 3 4 +4 +01110 +00100 +00100 +00100 +01110 + +01110 +10001 +10000 +10001 +01110 + +11111 +10001 +11111 +10000 +10000 + +01110 +10001 +10000 +10001 +01110 + +00000 +00000 +00000 +00000 +00000 + +2 3 4 +1 2 +100 +00100 +01010 +01110 +10001 +10001 + +01110 +00100 +00100 +00100 +01110 + +00000 +00000 +00000 +00000 +00000 + +11111 +00010 +00100 +01000 +11111 + +10001 +10001 +10001 +10001 +01110 + +5 1 3 5 7 9 +5 0 2 4 6 8 +0 diff --git a/codenet/public_test_cases/p01000/input.1.txt b/codenet/public_test_cases/p01000/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f6d01a28e23f393d8bf4e67b0c7092648482476 --- /dev/null +++ b/codenet/public_test_cases/p01000/input.1.txt @@ -0,0 +1,100 @@ +5 +00000 +01010 +00000 +00100 +00000 + +00000 +01010 +00000 +01010 +00000 + +00000 +00100 +00000 +01010 +00000 + +00000 +01010 +00000 +00100 +00000 + +00000 +00000 +00100 +00000 +00000 + +1 2 +2 3 4 +4 +01110 +00100 +00100 +00100 +01110 + +01110 +10001 +10000 +10001 +01110 + +11111 +10001 +11111 +10000 +10000 + +01110 +10001 +10000 +10001 +01110 + +00000 +00000 +00000 +00000 +00000 + +2 3 4 +1 2 +100 +00100 +01010 +01110 +10001 +10001 + +01110 +00100 +00100 +00100 +01110 + +00000 +00000 +00000 +00000 +00000 + +11111 +00010 +00100 +01000 +11111 + +10001 +10001 +10001 +10001 +01110 + +5 1 3 5 7 9 +5 0 2 4 6 8 +0 diff --git a/codenet/public_test_cases/p01000/output.0.txt b/codenet/public_test_cases/p01000/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d67e71eeba56962aff61d318c81f78d12d240bc --- /dev/null +++ b/codenet/public_test_cases/p01000/output.0.txt @@ -0,0 +1,92 @@ +Case 1: +00000 +00000 +01010 +01110 +10101 + +00000 +10001 +00000 +00000 +00000 + +00000 +00000 +11111 +10001 +00000 + +00000 +00000 +00000 +00000 +01010 + +00000 +00000 +01110 +00100 +11111 + +Case 2: +00010 +10110 +00000 +11000 +10000 + +00001 +00000 +10101 +00010 +00100 + +10001 +00000 +00000 +00000 +00010 + +01110 +10001 +00000 +00001 +10000 + +00000 +00000 +00111 +01001 +01000 + +Case 3: +00000 +00000 +00000 +00000 +00000 + +00000 +00000 +00000 +00000 +00000 + +00000 +00000 +00000 +00000 +00000 + +00000 +00000 +00000 +00000 +00000 + +00000 +00000 +00000 +00000 +00000 diff --git a/codenet/public_test_cases/p01000/output.1.txt b/codenet/public_test_cases/p01000/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d67e71eeba56962aff61d318c81f78d12d240bc --- /dev/null +++ b/codenet/public_test_cases/p01000/output.1.txt @@ -0,0 +1,92 @@ +Case 1: +00000 +00000 +01010 +01110 +10101 + +00000 +10001 +00000 +00000 +00000 + +00000 +00000 +11111 +10001 +00000 + +00000 +00000 +00000 +00000 +01010 + +00000 +00000 +01110 +00100 +11111 + +Case 2: +00010 +10110 +00000 +11000 +10000 + +00001 +00000 +10101 +00010 +00100 + +10001 +00000 +00000 +00000 +00010 + +01110 +10001 +00000 +00001 +10000 + +00000 +00000 +00111 +01001 +01000 + +Case 3: +00000 +00000 +00000 +00000 +00000 + +00000 +00000 +00000 +00000 +00000 + +00000 +00000 +00000 +00000 +00000 + +00000 +00000 +00000 +00000 +00000 + +00000 +00000 +00000 +00000 +00000 diff --git a/codenet/public_test_cases/p01001/input.0.txt b/codenet/public_test_cases/p01001/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aaa1a6d8e80310f9bc21bb296121127ef679d44 --- /dev/null +++ b/codenet/public_test_cases/p01001/input.0.txt @@ -0,0 +1,22 @@ +9 0 0 0 +0 9 0 0 +0 0 0 0 +0 0 0 0 +5 +1 1 1 1 1 +1000 500 +10 10 10 10 +10 10 10 10 +10 10 10 10 +10 10 10 10 +5 +1 0 2 0 1 +1000 2000 +3 8 6 10 +0 1 6 8 +10 2 4 7 +8 6 6 8 +19 +2 2 0 2 2 0 2 1 0 1 2 0 1 2 0 1 0 2 2 +200 100 +-1 -1 -1 -1 diff --git a/codenet/public_test_cases/p01001/input.1.txt b/codenet/public_test_cases/p01001/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aaa1a6d8e80310f9bc21bb296121127ef679d44 --- /dev/null +++ b/codenet/public_test_cases/p01001/input.1.txt @@ -0,0 +1,22 @@ +9 0 0 0 +0 9 0 0 +0 0 0 0 +0 0 0 0 +5 +1 1 1 1 1 +1000 500 +10 10 10 10 +10 10 10 10 +10 10 10 10 +10 10 10 10 +5 +1 0 2 0 1 +1000 2000 +3 8 6 10 +0 1 6 8 +10 2 4 7 +8 6 6 8 +19 +2 2 0 2 2 0 2 1 0 1 2 0 1 2 0 1 0 2 2 +200 100 +-1 -1 -1 -1 diff --git a/codenet/public_test_cases/p01001/output.0.txt b/codenet/public_test_cases/p01001/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b82511d6e69fc8253a4581933c2902d760cfe7b2 --- /dev/null +++ b/codenet/public_test_cases/p01001/output.0.txt @@ -0,0 +1,3 @@ +0.3024000000 +0.0000000000 +0.5120000000 diff --git a/codenet/public_test_cases/p01001/output.1.txt b/codenet/public_test_cases/p01001/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b82511d6e69fc8253a4581933c2902d760cfe7b2 --- /dev/null +++ b/codenet/public_test_cases/p01001/output.1.txt @@ -0,0 +1,3 @@ +0.3024000000 +0.0000000000 +0.5120000000 diff --git a/codenet/public_test_cases/p01002/input.0.txt b/codenet/public_test_cases/p01002/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b064a85eba8b5dee306efd24ebe8232d9d535124 --- /dev/null +++ b/codenet/public_test_cases/p01002/input.0.txt @@ -0,0 +1,22 @@ +0 +1 1 1 5 5 +5 5 5 5 5 +5 5 1 5 5 +5 1 1 1 5 +5 5 5 5 5 +0 0 0 0 1 +2 +1 2 3 4 5 +2 3 4 5 5 +2 3 4 5 5 +3 4 5 5 1 +5 4 3 2 1 +100 99 98 97 96 +5 +1 2 3 4 5 +2 3 4 5 1 +1 2 3 4 5 +5 4 3 2 1 +1 2 3 4 5 +99 79 31 23 56 +-1 diff --git a/codenet/public_test_cases/p01002/input.1.txt b/codenet/public_test_cases/p01002/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b064a85eba8b5dee306efd24ebe8232d9d535124 --- /dev/null +++ b/codenet/public_test_cases/p01002/input.1.txt @@ -0,0 +1,22 @@ +0 +1 1 1 5 5 +5 5 5 5 5 +5 5 1 5 5 +5 1 1 1 5 +5 5 5 5 5 +0 0 0 0 1 +2 +1 2 3 4 5 +2 3 4 5 5 +2 3 4 5 5 +3 4 5 5 1 +5 4 3 2 1 +100 99 98 97 96 +5 +1 2 3 4 5 +2 3 4 5 1 +1 2 3 4 5 +5 4 3 2 1 +1 2 3 4 5 +99 79 31 23 56 +-1 diff --git a/codenet/public_test_cases/p01002/output.0.txt b/codenet/public_test_cases/p01002/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cff67184e2ebed24b03f18bc02383d34eeb3888 --- /dev/null +++ b/codenet/public_test_cases/p01002/output.0.txt @@ -0,0 +1,3 @@ +17 +2040 +926 diff --git a/codenet/public_test_cases/p01002/output.1.txt b/codenet/public_test_cases/p01002/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cff67184e2ebed24b03f18bc02383d34eeb3888 --- /dev/null +++ b/codenet/public_test_cases/p01002/output.1.txt @@ -0,0 +1,3 @@ +17 +2040 +926 diff --git a/codenet/public_test_cases/p01003/input.0.txt b/codenet/public_test_cases/p01003/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dde08dcf31a745c9ab0a8e6e8739d910d069d57f --- /dev/null +++ b/codenet/public_test_cases/p01003/input.0.txt @@ -0,0 +1,69 @@ +9 14 5 10 +1 2 1 +1 4 5 +2 4 4 +2 3 3 +2 6 2 +3 6 3 +3 7 2 +4 6 5 +4 5 6 +5 8 8 +6 7 3 +7 8 1 +7 9 9 +8 9 2 +1 9 +1 +2 +5 +7 +9 +4 5 1 3 +1 2 1 +1 3 2 +2 3 2 +2 4 9 +3 4 1 +1 4 +2 +4 5 1 10 +1 2 1 +1 3 2 +2 3 2 +2 4 9 +3 4 1 +1 4 +2 +4 3 1 1 +1 2 1 +2 3 1 +3 4 1 +1 4 +1 +4 3 1 2 +1 2 1 +2 3 1 +3 4 1 +1 4 +1 +4 3 1 10 +1 2 1 +2 3 1 +3 4 1 +1 4 +1 +2 1 1 1 +1 2 1 +1 2 +1 +2 1 1 10 +1 2 1 +1 2 +1 +4 2 1 4 +1 2 1 +3 4 1 +1 4 +2 +0 0 0 0 diff --git a/codenet/public_test_cases/p01003/input.1.txt b/codenet/public_test_cases/p01003/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dde08dcf31a745c9ab0a8e6e8739d910d069d57f --- /dev/null +++ b/codenet/public_test_cases/p01003/input.1.txt @@ -0,0 +1,69 @@ +9 14 5 10 +1 2 1 +1 4 5 +2 4 4 +2 3 3 +2 6 2 +3 6 3 +3 7 2 +4 6 5 +4 5 6 +5 8 8 +6 7 3 +7 8 1 +7 9 9 +8 9 2 +1 9 +1 +2 +5 +7 +9 +4 5 1 3 +1 2 1 +1 3 2 +2 3 2 +2 4 9 +3 4 1 +1 4 +2 +4 5 1 10 +1 2 1 +1 3 2 +2 3 2 +2 4 9 +3 4 1 +1 4 +2 +4 3 1 1 +1 2 1 +2 3 1 +3 4 1 +1 4 +1 +4 3 1 2 +1 2 1 +2 3 1 +3 4 1 +1 4 +1 +4 3 1 10 +1 2 1 +2 3 1 +3 4 1 +1 4 +1 +2 1 1 1 +1 2 1 +1 2 +1 +2 1 1 10 +1 2 1 +1 2 +1 +4 2 1 4 +1 2 1 +3 4 1 +1 4 +2 +0 0 0 0 diff --git a/codenet/public_test_cases/p01003/output.0.txt b/codenet/public_test_cases/p01003/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9676f2e72bfd2374a69cedfd3546fd9b1c6d9675 --- /dev/null +++ b/codenet/public_test_cases/p01003/output.0.txt @@ -0,0 +1,9 @@ +27 +6 +8 +3 +5 +7 +1 +19 +NA diff --git a/codenet/public_test_cases/p01003/output.1.txt b/codenet/public_test_cases/p01003/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9676f2e72bfd2374a69cedfd3546fd9b1c6d9675 --- /dev/null +++ b/codenet/public_test_cases/p01003/output.1.txt @@ -0,0 +1,9 @@ +27 +6 +8 +3 +5 +7 +1 +19 +NA diff --git a/codenet/public_test_cases/p01004/input.0.txt b/codenet/public_test_cases/p01004/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdc1aeb66915905104080dda75abdf0b9681a714 --- /dev/null +++ b/codenet/public_test_cases/p01004/input.0.txt @@ -0,0 +1,19 @@ +3 4 +10 75 +50 5 +90 75 +50 50 10 10 2 +40 90 1 1 3 +10 20 10 15 1 +50 70 50 50 4 +4 2 +25 25 +25 75 +75 75 +75 25 +50 50 10 10 1 +50 50 15 15 2 +1 1 +5 5 +1 1 1 1 1 +0 0 diff --git a/codenet/public_test_cases/p01004/input.1.txt b/codenet/public_test_cases/p01004/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdc1aeb66915905104080dda75abdf0b9681a714 --- /dev/null +++ b/codenet/public_test_cases/p01004/input.1.txt @@ -0,0 +1,19 @@ +3 4 +10 75 +50 5 +90 75 +50 50 10 10 2 +40 90 1 1 3 +10 20 10 15 1 +50 70 50 50 4 +4 2 +25 25 +25 75 +75 75 +75 25 +50 50 10 10 1 +50 50 15 15 2 +1 1 +5 5 +1 1 1 1 1 +0 0 diff --git a/codenet/public_test_cases/p01004/output.0.txt b/codenet/public_test_cases/p01004/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..20a6ffda5204180a16ada837cb7c6adcb3169917 --- /dev/null +++ b/codenet/public_test_cases/p01004/output.0.txt @@ -0,0 +1,3 @@ +5.442857 +0.750000 +1.000000 diff --git a/codenet/public_test_cases/p01004/output.1.txt b/codenet/public_test_cases/p01004/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..20a6ffda5204180a16ada837cb7c6adcb3169917 --- /dev/null +++ b/codenet/public_test_cases/p01004/output.1.txt @@ -0,0 +1,3 @@ +5.442857 +0.750000 +1.000000 diff --git a/codenet/public_test_cases/p01005/input.0.txt b/codenet/public_test_cases/p01005/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02b7795ea1ce9cd8863b57ab6d5c45113f057238 --- /dev/null +++ b/codenet/public_test_cases/p01005/input.0.txt @@ -0,0 +1,30 @@ +18 10 +0 +4 1 +1 1 +4 1 +0 +1 1 +0 +2 2 +1 10 +0 +1 1 +0 +1 1 +0 +1 5 +3 4 0 +3 4 1 +0 +9 10 +4 1 +2 2 +3 5 5 +0 +4 1 +2 2 +3 5 5 +0 +2 1 +0 0 diff --git a/codenet/public_test_cases/p01005/input.1.txt b/codenet/public_test_cases/p01005/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..02b7795ea1ce9cd8863b57ab6d5c45113f057238 --- /dev/null +++ b/codenet/public_test_cases/p01005/input.1.txt @@ -0,0 +1,30 @@ +18 10 +0 +4 1 +1 1 +4 1 +0 +1 1 +0 +2 2 +1 10 +0 +1 1 +0 +1 1 +0 +1 5 +3 4 0 +3 4 1 +0 +9 10 +4 1 +2 2 +3 5 5 +0 +4 1 +2 2 +3 5 5 +0 +2 1 +0 0 diff --git a/codenet/public_test_cases/p01005/output.0.txt b/codenet/public_test_cases/p01005/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dac4d21cf5525a13c5c919230fb4a5e41325aa8 --- /dev/null +++ b/codenet/public_test_cases/p01005/output.0.txt @@ -0,0 +1,15 @@ +distance 10 +distance 9 +hit +damage 2 +bomb 1 +bomb 2 +end +distance -1 +miss +bomb 0 +distance 10 +miss +bomb 1 +hit +end diff --git a/codenet/public_test_cases/p01005/output.1.txt b/codenet/public_test_cases/p01005/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dac4d21cf5525a13c5c919230fb4a5e41325aa8 --- /dev/null +++ b/codenet/public_test_cases/p01005/output.1.txt @@ -0,0 +1,15 @@ +distance 10 +distance 9 +hit +damage 2 +bomb 1 +bomb 2 +end +distance -1 +miss +bomb 0 +distance 10 +miss +bomb 1 +hit +end diff --git a/codenet/public_test_cases/p01006/input.0.txt b/codenet/public_test_cases/p01006/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09d59b54c33d6a2a958e7fc094fc87cae9825822 --- /dev/null +++ b/codenet/public_test_cases/p01006/input.0.txt @@ -0,0 +1,8 @@ +ABCFI +ABCABCABC +AEI +EFC +(中略) +DEHED +EEEEE +(以上でちょうど1000個) diff --git a/codenet/public_test_cases/p01006/input.1.txt b/codenet/public_test_cases/p01006/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09d59b54c33d6a2a958e7fc094fc87cae9825822 --- /dev/null +++ b/codenet/public_test_cases/p01006/input.1.txt @@ -0,0 +1,8 @@ +ABCFI +ABCABCABC +AEI +EFC +(中略) +DEHED +EEEEE +(以上でちょうど1000個) diff --git a/codenet/public_test_cases/p01006/output.0.txt b/codenet/public_test_cases/p01006/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21bbe9637c8379403a4bf0176a5b3ebb96650f87 --- /dev/null +++ b/codenet/public_test_cases/p01006/output.0.txt @@ -0,0 +1,4 @@ +ABCFI +EFC +(中略) +DEHED diff --git a/codenet/public_test_cases/p01006/output.1.txt b/codenet/public_test_cases/p01006/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..21bbe9637c8379403a4bf0176a5b3ebb96650f87 --- /dev/null +++ b/codenet/public_test_cases/p01006/output.1.txt @@ -0,0 +1,4 @@ +ABCFI +EFC +(中略) +DEHED diff --git a/codenet/public_test_cases/p01007/input.0.txt b/codenet/public_test_cases/p01007/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b7fd99fa755c05a97f57f9b2f4ff4f03a8dffe2 --- /dev/null +++ b/codenet/public_test_cases/p01007/input.0.txt @@ -0,0 +1,5 @@ +3 1 +1 1 0 +0 1 1 +1 0 1 +0 2 2 2 90 diff --git a/codenet/public_test_cases/p01007/input.1.txt b/codenet/public_test_cases/p01007/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209bc2f106443de1daa357e3bb980bbb6b013855 --- /dev/null +++ b/codenet/public_test_cases/p01007/input.1.txt @@ -0,0 +1,8 @@ +5 2 +0 0 0 0 0 +1 0 0 0 0 +0 1 1 1 0 +0 1 1 1 0 +0 0 0 0 0 +3 2 +4 2 2 diff --git a/codenet/public_test_cases/p01007/input.2.txt b/codenet/public_test_cases/p01007/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b7fd99fa755c05a97f57f9b2f4ff4f03a8dffe2 --- /dev/null +++ b/codenet/public_test_cases/p01007/input.2.txt @@ -0,0 +1,5 @@ +3 1 +1 1 0 +0 1 1 +1 0 1 +0 2 2 2 90 diff --git a/codenet/public_test_cases/p01007/input.3.txt b/codenet/public_test_cases/p01007/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..51a210cb461dc1d22faa92335cedcb375a7b7990 --- /dev/null +++ b/codenet/public_test_cases/p01007/input.3.txt @@ -0,0 +1,8 @@ +5 2 +1 1 1 0 1 +1 0 0 0 0 +0 0 0 1 1 +0 1 0 0 0 +0 1 1 1 0 +1 3 3 3 +0 1 1 5 90 diff --git a/codenet/public_test_cases/p01007/output.0.txt b/codenet/public_test_cases/p01007/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29203a4f485bf2fb12291b0d6e1794c4eb6637b1 --- /dev/null +++ b/codenet/public_test_cases/p01007/output.0.txt @@ -0,0 +1,3 @@ +1 1 0 +0 0 1 +1 1 1 diff --git a/codenet/public_test_cases/p01007/output.1.txt b/codenet/public_test_cases/p01007/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae6ea0650e376781256001828dc5a6e4e71ef06b --- /dev/null +++ b/codenet/public_test_cases/p01007/output.1.txt @@ -0,0 +1,5 @@ +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01007/output.2.txt b/codenet/public_test_cases/p01007/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29203a4f485bf2fb12291b0d6e1794c4eb6637b1 --- /dev/null +++ b/codenet/public_test_cases/p01007/output.2.txt @@ -0,0 +1,3 @@ +1 1 0 +0 0 1 +1 1 1 diff --git a/codenet/public_test_cases/p01007/output.3.txt b/codenet/public_test_cases/p01007/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b2d4b6f9f39fa4d903811e019c4880e70d778cb --- /dev/null +++ b/codenet/public_test_cases/p01007/output.3.txt @@ -0,0 +1,5 @@ +0 0 0 1 1 +1 1 0 0 1 +0 1 1 0 1 +0 1 0 0 0 +1 1 0 0 1 diff --git a/codenet/public_test_cases/p01008/input.0.txt b/codenet/public_test_cases/p01008/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c55485e368d3504203dd7ee802592a74df0acd88 --- /dev/null +++ b/codenet/public_test_cases/p01008/input.0.txt @@ -0,0 +1,2 @@ +1 +10 1 diff --git a/codenet/public_test_cases/p01008/input.1.txt b/codenet/public_test_cases/p01008/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c55485e368d3504203dd7ee802592a74df0acd88 --- /dev/null +++ b/codenet/public_test_cases/p01008/input.1.txt @@ -0,0 +1,2 @@ +1 +10 1 diff --git a/codenet/public_test_cases/p01008/input.2.txt b/codenet/public_test_cases/p01008/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f957e8c490c043503e085bc4bf3c9dff3a1c22a --- /dev/null +++ b/codenet/public_test_cases/p01008/input.2.txt @@ -0,0 +1,4 @@ +3 +25 53AI +43 3BI0 +62 pn6 diff --git a/codenet/public_test_cases/p01008/input.3.txt b/codenet/public_test_cases/p01008/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..87502fb67058652648240c0c5b55a5ea5e97a610 --- /dev/null +++ b/codenet/public_test_cases/p01008/input.3.txt @@ -0,0 +1,3 @@ +2 +10 1 +10 1 diff --git a/codenet/public_test_cases/p01008/output.0.txt b/codenet/public_test_cases/p01008/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58382f8c03ab8e8d916fca122e8a0f36d7fd4b7b --- /dev/null +++ b/codenet/public_test_cases/p01008/output.0.txt @@ -0,0 +1 @@ +win diff --git a/codenet/public_test_cases/p01008/output.1.txt b/codenet/public_test_cases/p01008/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58382f8c03ab8e8d916fca122e8a0f36d7fd4b7b --- /dev/null +++ b/codenet/public_test_cases/p01008/output.1.txt @@ -0,0 +1 @@ +win diff --git a/codenet/public_test_cases/p01008/output.2.txt b/codenet/public_test_cases/p01008/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58382f8c03ab8e8d916fca122e8a0f36d7fd4b7b --- /dev/null +++ b/codenet/public_test_cases/p01008/output.2.txt @@ -0,0 +1 @@ +win diff --git a/codenet/public_test_cases/p01008/output.3.txt b/codenet/public_test_cases/p01008/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..54f937b21c7e5e4e394a0324a2e7025ec0750593 --- /dev/null +++ b/codenet/public_test_cases/p01008/output.3.txt @@ -0,0 +1 @@ +lose diff --git a/codenet/public_test_cases/p01009/input.0.txt b/codenet/public_test_cases/p01009/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce27d208076f765dae14fd9e4d4233f8c09d51d2 --- /dev/null +++ b/codenet/public_test_cases/p01009/input.0.txt @@ -0,0 +1,6 @@ +3 5 +COMPARE 1 2 +IN 1 2 5 +IN 2 3 3 +COMPARE 2 3 +COMPARE 1 3 diff --git a/codenet/public_test_cases/p01009/input.1.txt b/codenet/public_test_cases/p01009/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd3e2d2ef380432435aa30bef9e88187a72aabcb --- /dev/null +++ b/codenet/public_test_cases/p01009/input.1.txt @@ -0,0 +1,4 @@ +4 3 +IN 1 4 10 +IN 2 3 20 +COMPARE 1 2 diff --git a/codenet/public_test_cases/p01009/input.2.txt b/codenet/public_test_cases/p01009/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b45607132d390151c7bf7d09df02820797c2475 --- /dev/null +++ b/codenet/public_test_cases/p01009/input.2.txt @@ -0,0 +1,5 @@ +10 4 +IN 10 8 2328 +IN 8 4 3765 +IN 3 8 574 +COMPARE 4 8 diff --git a/codenet/public_test_cases/p01009/input.3.txt b/codenet/public_test_cases/p01009/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce27d208076f765dae14fd9e4d4233f8c09d51d2 --- /dev/null +++ b/codenet/public_test_cases/p01009/input.3.txt @@ -0,0 +1,6 @@ +3 5 +COMPARE 1 2 +IN 1 2 5 +IN 2 3 3 +COMPARE 2 3 +COMPARE 1 3 diff --git a/codenet/public_test_cases/p01009/input.4.txt b/codenet/public_test_cases/p01009/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..30712ed1832b6f51615777c94412c931a0663f85 --- /dev/null +++ b/codenet/public_test_cases/p01009/input.4.txt @@ -0,0 +1,5 @@ +3 4 +IN 2 1 2 +IN 3 1 2 +COMPARE 1 3 +COMPARE 2 3 diff --git a/codenet/public_test_cases/p01009/input.5.txt b/codenet/public_test_cases/p01009/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..533437b708a47b0e46765862c1a3fab0edf0d3b2 --- /dev/null +++ b/codenet/public_test_cases/p01009/input.5.txt @@ -0,0 +1,6 @@ +3 5 +IN 1 2 5 +IN 1 2 5 +IN 2 3 10 +COMPARE 1 2 +COMPARE 2 3 diff --git a/codenet/public_test_cases/p01009/output.0.txt b/codenet/public_test_cases/p01009/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded4a29ccb3c797b82d08ade747de9c8aad0f3fe --- /dev/null +++ b/codenet/public_test_cases/p01009/output.0.txt @@ -0,0 +1,3 @@ +WARNING +3 +11 diff --git a/codenet/public_test_cases/p01009/output.1.txt b/codenet/public_test_cases/p01009/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2500fa5ab0745ff1ff3a4ec0e759e2c6480e966 --- /dev/null +++ b/codenet/public_test_cases/p01009/output.1.txt @@ -0,0 +1 @@ +WARNING diff --git a/codenet/public_test_cases/p01009/output.2.txt b/codenet/public_test_cases/p01009/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddfd7fdf295d66f6dd106cc876b10a396d7f6a11 --- /dev/null +++ b/codenet/public_test_cases/p01009/output.2.txt @@ -0,0 +1 @@ +-3191 diff --git a/codenet/public_test_cases/p01009/output.3.txt b/codenet/public_test_cases/p01009/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded4a29ccb3c797b82d08ade747de9c8aad0f3fe --- /dev/null +++ b/codenet/public_test_cases/p01009/output.3.txt @@ -0,0 +1,3 @@ +WARNING +3 +11 diff --git a/codenet/public_test_cases/p01009/output.4.txt b/codenet/public_test_cases/p01009/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c848c1a3a44be597439d85f76c53bf986cc05e2 --- /dev/null +++ b/codenet/public_test_cases/p01009/output.4.txt @@ -0,0 +1,2 @@ +-2 +2 diff --git a/codenet/public_test_cases/p01009/output.5.txt b/codenet/public_test_cases/p01009/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3010439f278d7262d59df55452093bd75d736f3c --- /dev/null +++ b/codenet/public_test_cases/p01009/output.5.txt @@ -0,0 +1,2 @@ +15 +10 diff --git a/codenet/public_test_cases/p01010/input.0.txt b/codenet/public_test_cases/p01010/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..014e50a78942e67faaf74b88c678fe3f9a4c0b72 --- /dev/null +++ b/codenet/public_test_cases/p01010/input.0.txt @@ -0,0 +1,4 @@ +1 +90 10 20 +3 3 1 90 10 315 10 +6 0 1 diff --git a/codenet/public_test_cases/p01010/input.1.txt b/codenet/public_test_cases/p01010/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..13a581599d83ef1cb0c1fb8b0fab932dcdab7510 --- /dev/null +++ b/codenet/public_test_cases/p01010/input.1.txt @@ -0,0 +1,5 @@ +2 +90 10 10 +-3 0 1 45 10 90 10 +-6 0 2 30 3 180 10 +-9 0 1 diff --git a/codenet/public_test_cases/p01010/input.2.txt b/codenet/public_test_cases/p01010/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..014e50a78942e67faaf74b88c678fe3f9a4c0b72 --- /dev/null +++ b/codenet/public_test_cases/p01010/input.2.txt @@ -0,0 +1,4 @@ +1 +90 10 20 +3 3 1 90 10 315 10 +6 0 1 diff --git a/codenet/public_test_cases/p01010/output.0.txt b/codenet/public_test_cases/p01010/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p01010/output.0.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p01010/output.1.txt b/codenet/public_test_cases/p01010/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01010/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01010/output.2.txt b/codenet/public_test_cases/p01010/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p01010/output.2.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p01011/input.0.txt b/codenet/public_test_cases/p01011/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..17028dca42c65456530d7d112247996071a9339e --- /dev/null +++ b/codenet/public_test_cases/p01011/input.0.txt @@ -0,0 +1,4 @@ +3 3 +0 0 0 +0 18 0 +0 0 0 diff --git a/codenet/public_test_cases/p01011/input.1.txt b/codenet/public_test_cases/p01011/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..247528d4dce51fc193bd002c85760c284f9140d0 --- /dev/null +++ b/codenet/public_test_cases/p01011/input.1.txt @@ -0,0 +1,4 @@ +3 3 +0 0 0 +0 2 0 +0 0 0 diff --git a/codenet/public_test_cases/p01011/input.2.txt b/codenet/public_test_cases/p01011/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e187511da969aa37303890aa623729789223f3e7 --- /dev/null +++ b/codenet/public_test_cases/p01011/input.2.txt @@ -0,0 +1,7 @@ +6 6 +0 0 0 0 0 0 +0 0 0 0 0 0 +0 0 0 0 0 0 +0 0 0 0 0 0 +0 0 0 0 0 0 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p01011/input.3.txt b/codenet/public_test_cases/p01011/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c8f67345dc0733270c06550b563b1a23243d582 --- /dev/null +++ b/codenet/public_test_cases/p01011/input.3.txt @@ -0,0 +1,2 @@ +1 1 +1 diff --git a/codenet/public_test_cases/p01011/input.4.txt b/codenet/public_test_cases/p01011/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffed043323e1a0ab637668adede2863c9de6c3af --- /dev/null +++ b/codenet/public_test_cases/p01011/input.4.txt @@ -0,0 +1,4 @@ +3 3 +0 1 0 +1 0 0 +0 1 1 diff --git a/codenet/public_test_cases/p01011/input.5.txt b/codenet/public_test_cases/p01011/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..17028dca42c65456530d7d112247996071a9339e --- /dev/null +++ b/codenet/public_test_cases/p01011/input.5.txt @@ -0,0 +1,4 @@ +3 3 +0 0 0 +0 18 0 +0 0 0 diff --git a/codenet/public_test_cases/p01011/output.0.txt b/codenet/public_test_cases/p01011/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p01011/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p01011/output.1.txt b/codenet/public_test_cases/p01011/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e64f24d5508a94514dd5ea2d1025ae91f3f70760 --- /dev/null +++ b/codenet/public_test_cases/p01011/output.1.txt @@ -0,0 +1 @@ +336 diff --git a/codenet/public_test_cases/p01011/output.2.txt b/codenet/public_test_cases/p01011/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f758e8084f7a4dcb6488d5121e0d844f61996220 --- /dev/null +++ b/codenet/public_test_cases/p01011/output.2.txt @@ -0,0 +1 @@ +80065005 diff --git a/codenet/public_test_cases/p01011/output.3.txt b/codenet/public_test_cases/p01011/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01011/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01011/output.4.txt b/codenet/public_test_cases/p01011/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01011/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01011/output.5.txt b/codenet/public_test_cases/p01011/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p01011/output.5.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p01012/input.0.txt b/codenet/public_test_cases/p01012/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e154dfee663d01fa97287e2eb3e88e9953a7fbda --- /dev/null +++ b/codenet/public_test_cases/p01012/input.0.txt @@ -0,0 +1,2 @@ +1 1 1 +1 1 1 diff --git a/codenet/public_test_cases/p01012/input.1.txt b/codenet/public_test_cases/p01012/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bace2e108ba83becf7f00340b48da3b09f8951c8 --- /dev/null +++ b/codenet/public_test_cases/p01012/input.1.txt @@ -0,0 +1,2 @@ +1 2 2 +1 1 1 diff --git a/codenet/public_test_cases/p01012/input.2.txt b/codenet/public_test_cases/p01012/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..40b6c15b544933407220282e2d031fcbce7c1bef --- /dev/null +++ b/codenet/public_test_cases/p01012/input.2.txt @@ -0,0 +1,2 @@ +1 2 0 +3 4 0 diff --git a/codenet/public_test_cases/p01012/input.3.txt b/codenet/public_test_cases/p01012/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e154dfee663d01fa97287e2eb3e88e9953a7fbda --- /dev/null +++ b/codenet/public_test_cases/p01012/input.3.txt @@ -0,0 +1,2 @@ +1 1 1 +1 1 1 diff --git a/codenet/public_test_cases/p01012/output.0.txt b/codenet/public_test_cases/p01012/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66993079a80fea53114bc9aaf886aec4881f923f --- /dev/null +++ b/codenet/public_test_cases/p01012/output.0.txt @@ -0,0 +1 @@ +0.562500 diff --git a/codenet/public_test_cases/p01012/output.1.txt b/codenet/public_test_cases/p01012/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfea2a97e5aaefcb8d995d1387fe87ce7450ae6d --- /dev/null +++ b/codenet/public_test_cases/p01012/output.1.txt @@ -0,0 +1 @@ +0.490741 diff --git a/codenet/public_test_cases/p01012/output.2.txt b/codenet/public_test_cases/p01012/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..961b372472a1809353ba4658ea88ca265d88b75c --- /dev/null +++ b/codenet/public_test_cases/p01012/output.2.txt @@ -0,0 +1 @@ +1.000000 diff --git a/codenet/public_test_cases/p01012/output.3.txt b/codenet/public_test_cases/p01012/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..66993079a80fea53114bc9aaf886aec4881f923f --- /dev/null +++ b/codenet/public_test_cases/p01012/output.3.txt @@ -0,0 +1 @@ +0.562500 diff --git a/codenet/public_test_cases/p01013/input.0.txt b/codenet/public_test_cases/p01013/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83ea1ffaf922e90921373533e5c5e247d8d01a01 --- /dev/null +++ b/codenet/public_test_cases/p01013/input.0.txt @@ -0,0 +1,3 @@ +0 0 10 +0 0 0 4 +0 0 1 diff --git a/codenet/public_test_cases/p01013/input.1.txt b/codenet/public_test_cases/p01013/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83ea1ffaf922e90921373533e5c5e247d8d01a01 --- /dev/null +++ b/codenet/public_test_cases/p01013/input.1.txt @@ -0,0 +1,3 @@ +0 0 10 +0 0 0 4 +0 0 1 diff --git a/codenet/public_test_cases/p01013/output.0.txt b/codenet/public_test_cases/p01013/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af2ef66fefc56beb90860e425a62e8d82d44a389 --- /dev/null +++ b/codenet/public_test_cases/p01013/output.0.txt @@ -0,0 +1 @@ +91.769438 75.782170 diff --git a/codenet/public_test_cases/p01013/output.1.txt b/codenet/public_test_cases/p01013/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af2ef66fefc56beb90860e425a62e8d82d44a389 --- /dev/null +++ b/codenet/public_test_cases/p01013/output.1.txt @@ -0,0 +1 @@ +91.769438 75.782170 diff --git a/codenet/public_test_cases/p01014/input.0.txt b/codenet/public_test_cases/p01014/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb4e1cb7c96b3b54de6113bd4145aaa72ebd6615 --- /dev/null +++ b/codenet/public_test_cases/p01014/input.0.txt @@ -0,0 +1,6 @@ +5 5 2 +##### +#S.G# +#...# +#...# +##### diff --git a/codenet/public_test_cases/p01014/input.1.txt b/codenet/public_test_cases/p01014/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb4e1cb7c96b3b54de6113bd4145aaa72ebd6615 --- /dev/null +++ b/codenet/public_test_cases/p01014/input.1.txt @@ -0,0 +1,6 @@ +5 5 2 +##### +#S.G# +#...# +#...# +##### diff --git a/codenet/public_test_cases/p01014/input.2.txt b/codenet/public_test_cases/p01014/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64a0e3668012b99f8b362191539f08b92673532 --- /dev/null +++ b/codenet/public_test_cases/p01014/input.2.txt @@ -0,0 +1,3 @@ +3 12 2 + +S...A.a..G# diff --git a/codenet/public_test_cases/p01014/input.3.txt b/codenet/public_test_cases/p01014/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29a949049e951f4cde69f9923a3dc807d420968e --- /dev/null +++ b/codenet/public_test_cases/p01014/input.3.txt @@ -0,0 +1,3 @@ +3 12 2 + +S^^.^^.^^G# diff --git a/codenet/public_test_cases/p01014/input.4.txt b/codenet/public_test_cases/p01014/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b4da17c934f7f707c56666e40d7db9f723c6149 --- /dev/null +++ b/codenet/public_test_cases/p01014/input.4.txt @@ -0,0 +1,3 @@ +3 12 2 + +S..A..a..G# diff --git a/codenet/public_test_cases/p01014/input.5.txt b/codenet/public_test_cases/p01014/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0030612bfc4e2e3d210c8defab55b4f8c2b5c90e --- /dev/null +++ b/codenet/public_test_cases/p01014/input.5.txt @@ -0,0 +1,5 @@ +5 5 2 + +S.G# +...# +...# diff --git a/codenet/public_test_cases/p01014/input.6.txt b/codenet/public_test_cases/p01014/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..c946ebb824e7b66a0f799a7bf77325733d512b07 --- /dev/null +++ b/codenet/public_test_cases/p01014/input.6.txt @@ -0,0 +1,7 @@ +7 13 3 + +S....#.....# +.....#.....# +.....#.....# +...........# +..........G# diff --git a/codenet/public_test_cases/p01014/output.0.txt b/codenet/public_test_cases/p01014/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01014/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01014/output.1.txt b/codenet/public_test_cases/p01014/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01014/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01014/output.2.txt b/codenet/public_test_cases/p01014/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01014/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01014/output.3.txt b/codenet/public_test_cases/p01014/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01014/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01014/output.4.txt b/codenet/public_test_cases/p01014/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01014/output.4.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01014/output.5.txt b/codenet/public_test_cases/p01014/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01014/output.5.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01014/output.6.txt b/codenet/public_test_cases/p01014/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01014/output.6.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01015/input.0.txt b/codenet/public_test_cases/p01015/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6678986ee1cef52f6ae548d38a7b1e91bdbe5c51 --- /dev/null +++ b/codenet/public_test_cases/p01015/input.0.txt @@ -0,0 +1,3 @@ +10 2 +9 left : 9 left +9 right : 9 right diff --git a/codenet/public_test_cases/p01015/input.1.txt b/codenet/public_test_cases/p01015/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6678986ee1cef52f6ae548d38a7b1e91bdbe5c51 --- /dev/null +++ b/codenet/public_test_cases/p01015/input.1.txt @@ -0,0 +1,3 @@ +10 2 +9 left : 9 left +9 right : 9 right diff --git a/codenet/public_test_cases/p01015/input.2.txt b/codenet/public_test_cases/p01015/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..116309768c0936be612f819881dd0e24f11c21a4 --- /dev/null +++ b/codenet/public_test_cases/p01015/input.2.txt @@ -0,0 +1,6 @@ +4 5 +1 left : 2 right +2 left : 3 right +2 left : 3 left +1 right : 3 left +2 right : 3 right diff --git a/codenet/public_test_cases/p01015/output.0.txt b/codenet/public_test_cases/p01015/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01015/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01015/output.1.txt b/codenet/public_test_cases/p01015/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01015/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01015/output.2.txt b/codenet/public_test_cases/p01015/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01015/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01016/input.0.txt b/codenet/public_test_cases/p01016/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..019fa7f9a5d738fab94817ff9d46989b1da4434d --- /dev/null +++ b/codenet/public_test_cases/p01016/input.0.txt @@ -0,0 +1,2 @@ +ABCDE +ABC diff --git a/codenet/public_test_cases/p01016/input.1.txt b/codenet/public_test_cases/p01016/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..708952918d5ce3106ff4570f932c0e7aee4d075c --- /dev/null +++ b/codenet/public_test_cases/p01016/input.1.txt @@ -0,0 +1,2 @@ +KUSATSU +KSATSU diff --git a/codenet/public_test_cases/p01016/input.2.txt b/codenet/public_test_cases/p01016/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0eb676f66d5546a5e66802d0b4fa453f4e08b61 --- /dev/null +++ b/codenet/public_test_cases/p01016/input.2.txt @@ -0,0 +1,2 @@ +ABCABC +ACBA_B diff --git a/codenet/public_test_cases/p01016/input.3.txt b/codenet/public_test_cases/p01016/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc5477bd401544434ebd1e5024baec48d6909daa --- /dev/null +++ b/codenet/public_test_cases/p01016/input.3.txt @@ -0,0 +1,2 @@ +RUPCUAPC +__PC diff --git a/codenet/public_test_cases/p01016/input.4.txt b/codenet/public_test_cases/p01016/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9df49a575dcb5e46d22ae29e0cb738d01795e72a --- /dev/null +++ b/codenet/public_test_cases/p01016/input.4.txt @@ -0,0 +1,2 @@ +AIZU +_A diff --git a/codenet/public_test_cases/p01016/input.5.txt b/codenet/public_test_cases/p01016/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..019fa7f9a5d738fab94817ff9d46989b1da4434d --- /dev/null +++ b/codenet/public_test_cases/p01016/input.5.txt @@ -0,0 +1,2 @@ +ABCDE +ABC diff --git a/codenet/public_test_cases/p01016/output.0.txt b/codenet/public_test_cases/p01016/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01016/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01016/output.1.txt b/codenet/public_test_cases/p01016/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01016/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01016/output.2.txt b/codenet/public_test_cases/p01016/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01016/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01016/output.3.txt b/codenet/public_test_cases/p01016/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01016/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01016/output.4.txt b/codenet/public_test_cases/p01016/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01016/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01016/output.5.txt b/codenet/public_test_cases/p01016/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01016/output.5.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01017/input.0.txt b/codenet/public_test_cases/p01017/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f183675b5229be817d8ab337ffbc95f7aa2c13f --- /dev/null +++ b/codenet/public_test_cases/p01017/input.0.txt @@ -0,0 +1,12 @@ +4 4 +10 2 -1 6 +8 1 -100 41 +22 47 32 11 +-41 99 12 -8 +1 0 0 1 +0 0 1 0 +0 1 0 1 +0 0 1 0 +2 3 +1 0 1 +0 1 0 diff --git a/codenet/public_test_cases/p01017/input.1.txt b/codenet/public_test_cases/p01017/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f183675b5229be817d8ab337ffbc95f7aa2c13f --- /dev/null +++ b/codenet/public_test_cases/p01017/input.1.txt @@ -0,0 +1,12 @@ +4 4 +10 2 -1 6 +8 1 -100 41 +22 47 32 11 +-41 99 12 -8 +1 0 0 1 +0 0 1 0 +0 1 0 1 +0 0 1 0 +2 3 +1 0 1 +0 1 0 diff --git a/codenet/public_test_cases/p01017/input.2.txt b/codenet/public_test_cases/p01017/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b70dcf0df2370ba82a58321d4499a8cc0d197b98 --- /dev/null +++ b/codenet/public_test_cases/p01017/input.2.txt @@ -0,0 +1,9 @@ +3 4 +4 1 9 1 +9 1 -1 3 +2 -4 1 10 +1 1 0 1 +0 1 1 1 +1 1 0 0 +1 4 +1 1 1 1 diff --git a/codenet/public_test_cases/p01017/input.3.txt b/codenet/public_test_cases/p01017/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..13a4f374f5c65d0ff4387061fc50f1b6951308b1 --- /dev/null +++ b/codenet/public_test_cases/p01017/input.3.txt @@ -0,0 +1,9 @@ +3 3 +5 1 3 +2 5 9 +0 1 5 +1 0 0 +0 1 1 +0 1 1 +1 1 +1 diff --git a/codenet/public_test_cases/p01017/output.0.txt b/codenet/public_test_cases/p01017/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2455a46adf1375e99d0a55c3b2b8ccf30b322204 --- /dev/null +++ b/codenet/public_test_cases/p01017/output.0.txt @@ -0,0 +1 @@ +193 diff --git a/codenet/public_test_cases/p01017/output.1.txt b/codenet/public_test_cases/p01017/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2455a46adf1375e99d0a55c3b2b8ccf30b322204 --- /dev/null +++ b/codenet/public_test_cases/p01017/output.1.txt @@ -0,0 +1 @@ +193 diff --git a/codenet/public_test_cases/p01017/output.2.txt b/codenet/public_test_cases/p01017/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..69fc4ef2be0c2550c183850902cb55dbf3d37b30 --- /dev/null +++ b/codenet/public_test_cases/p01017/output.2.txt @@ -0,0 +1 @@ +NA diff --git a/codenet/public_test_cases/p01017/output.3.txt b/codenet/public_test_cases/p01017/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01017/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01018/input.0.txt b/codenet/public_test_cases/p01018/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc20050c32578c8cded560809f88ef66d5d9144e --- /dev/null +++ b/codenet/public_test_cases/p01018/input.0.txt @@ -0,0 +1,4 @@ +10 3 +2 2 1 +4 2 1 +8 1 1 diff --git a/codenet/public_test_cases/p01018/input.1.txt b/codenet/public_test_cases/p01018/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ffd4e75e55ebb1f5d670c9b77d2d0a32579ee67 --- /dev/null +++ b/codenet/public_test_cases/p01018/input.1.txt @@ -0,0 +1,3 @@ +10 2 +2 3 1 +3 5 1 diff --git a/codenet/public_test_cases/p01018/input.2.txt b/codenet/public_test_cases/p01018/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..80c0cc79aabb27a7894c5795860fa87c6473f004 --- /dev/null +++ b/codenet/public_test_cases/p01018/input.2.txt @@ -0,0 +1 @@ +1 0 diff --git a/codenet/public_test_cases/p01018/input.3.txt b/codenet/public_test_cases/p01018/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc20050c32578c8cded560809f88ef66d5d9144e --- /dev/null +++ b/codenet/public_test_cases/p01018/input.3.txt @@ -0,0 +1,4 @@ +10 3 +2 2 1 +4 2 1 +8 1 1 diff --git a/codenet/public_test_cases/p01018/output.0.txt b/codenet/public_test_cases/p01018/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01018/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01018/output.1.txt b/codenet/public_test_cases/p01018/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01018/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01018/output.2.txt b/codenet/public_test_cases/p01018/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01018/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01018/output.3.txt b/codenet/public_test_cases/p01018/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01018/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01019/input.0.txt b/codenet/public_test_cases/p01019/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd0d4ff80eb70548e08a6178e366b4cb59216f11 --- /dev/null +++ b/codenet/public_test_cases/p01019/input.0.txt @@ -0,0 +1,5 @@ +4 +1 1 1 5 +3 3 5 3 +4 2 4 4 +7 1 7 5 diff --git a/codenet/public_test_cases/p01019/input.1.txt b/codenet/public_test_cases/p01019/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd0d4ff80eb70548e08a6178e366b4cb59216f11 --- /dev/null +++ b/codenet/public_test_cases/p01019/input.1.txt @@ -0,0 +1,5 @@ +4 +1 1 1 5 +3 3 5 3 +4 2 4 4 +7 1 7 5 diff --git a/codenet/public_test_cases/p01019/input.2.txt b/codenet/public_test_cases/p01019/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b8d40c1dc3a95026e86df9c2e396b16a281a110 --- /dev/null +++ b/codenet/public_test_cases/p01019/input.2.txt @@ -0,0 +1,24 @@ +23 +1 1 3 1 +3 1 3 3 +3 3 1 3 +1 3 1 5 +1 5 3 5 +5 2 7 2 +7 2 7 4 +7 4 5 4 +5 4 5 6 +5 6 7 6 +11 4 13 4 +13 0 15 0 +15 0 15 4 +18 2 18 2 +21 5 23 5 +21 5 21 7 +21 7 23 7 +23 7 23 9 +23 9 21 9 +24 0 26 0 +24 0 24 4 +24 4 26 4 +26 0 26 4 diff --git a/codenet/public_test_cases/p01019/output.0.txt b/codenet/public_test_cases/p01019/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01019/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01019/output.1.txt b/codenet/public_test_cases/p01019/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01019/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01019/output.2.txt b/codenet/public_test_cases/p01019/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8972e8d8994232788218b7eb5e8e8d14fec32dd --- /dev/null +++ b/codenet/public_test_cases/p01019/output.2.txt @@ -0,0 +1 @@ +-328 diff --git a/codenet/public_test_cases/p01020/input.0.txt b/codenet/public_test_cases/p01020/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a4d515660c3c567ab07859fc5e252f8c966e46 --- /dev/null +++ b/codenet/public_test_cases/p01020/input.0.txt @@ -0,0 +1,2 @@ +4 +1 2 3 4 diff --git a/codenet/public_test_cases/p01020/input.1.txt b/codenet/public_test_cases/p01020/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a4d515660c3c567ab07859fc5e252f8c966e46 --- /dev/null +++ b/codenet/public_test_cases/p01020/input.1.txt @@ -0,0 +1,2 @@ +4 +1 2 3 4 diff --git a/codenet/public_test_cases/p01020/input.2.txt b/codenet/public_test_cases/p01020/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6ad0ca15d6caa972e6ddf0d652c404bffd885a2 --- /dev/null +++ b/codenet/public_test_cases/p01020/input.2.txt @@ -0,0 +1,2 @@ +5 +3 3 3 3 3 diff --git a/codenet/public_test_cases/p01020/output.0.txt b/codenet/public_test_cases/p01020/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01020/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01020/output.1.txt b/codenet/public_test_cases/p01020/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01020/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01020/output.2.txt b/codenet/public_test_cases/p01020/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p01020/output.2.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p01021/input.0.txt b/codenet/public_test_cases/p01021/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b22984e2f8ea7169acbd3871296eb5976daef60 --- /dev/null +++ b/codenet/public_test_cases/p01021/input.0.txt @@ -0,0 +1,3 @@ +1 2 +18 +6 9 diff --git a/codenet/public_test_cases/p01021/output.0.txt b/codenet/public_test_cases/p01021/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01021/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01022/input.0.txt b/codenet/public_test_cases/p01022/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cf4dcc8688300be6f6260f78b1dc27ca658939b --- /dev/null +++ b/codenet/public_test_cases/p01022/input.0.txt @@ -0,0 +1,4 @@ +3 +1 1 +2 2 +3 3 diff --git a/codenet/public_test_cases/p01022/input.1.txt b/codenet/public_test_cases/p01022/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cf4dcc8688300be6f6260f78b1dc27ca658939b --- /dev/null +++ b/codenet/public_test_cases/p01022/input.1.txt @@ -0,0 +1,4 @@ +3 +1 1 +2 2 +3 3 diff --git a/codenet/public_test_cases/p01022/input.2.txt b/codenet/public_test_cases/p01022/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2072965c94828c89f81d4a943e80f619638dd658 --- /dev/null +++ b/codenet/public_test_cases/p01022/input.2.txt @@ -0,0 +1,6 @@ +5 +1 5 +2 4 +3 3 +4 2 +5 1 diff --git a/codenet/public_test_cases/p01022/input.3.txt b/codenet/public_test_cases/p01022/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2feb24ec39f73c21b03d74f166bee1737a44f784 --- /dev/null +++ b/codenet/public_test_cases/p01022/input.3.txt @@ -0,0 +1,6 @@ +5 +2 3 +3 5 +1 2 +1 4 +3 5 diff --git a/codenet/public_test_cases/p01022/input.4.txt b/codenet/public_test_cases/p01022/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..31ca5160e48efa4278576402aa930af30b840579 --- /dev/null +++ b/codenet/public_test_cases/p01022/input.4.txt @@ -0,0 +1,11 @@ +10 +5 11 +12 12 +4 14 +22 12 +11 13 +3 3 +3 3 +12 5 +55 55 +1 1 diff --git a/codenet/public_test_cases/p01022/output.0.txt b/codenet/public_test_cases/p01022/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01022/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01022/output.1.txt b/codenet/public_test_cases/p01022/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01022/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01022/output.2.txt b/codenet/public_test_cases/p01022/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01022/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01022/output.3.txt b/codenet/public_test_cases/p01022/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01022/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01022/output.4.txt b/codenet/public_test_cases/p01022/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01022/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01023/input.0.txt b/codenet/public_test_cases/p01023/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d68e47b49f2bbecc2dbebe5a1c61388f1d6d84bb --- /dev/null +++ b/codenet/public_test_cases/p01023/input.0.txt @@ -0,0 +1,6 @@ +5 8 3 +#....... +#.####2# +#.#.3..# +#.###### +.1Sabcde diff --git a/codenet/public_test_cases/p01023/input.1.txt b/codenet/public_test_cases/p01023/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d68e47b49f2bbecc2dbebe5a1c61388f1d6d84bb --- /dev/null +++ b/codenet/public_test_cases/p01023/input.1.txt @@ -0,0 +1,6 @@ +5 8 3 +#....... +#.####2# +#.#.3..# +#.###### +.1Sabcde diff --git a/codenet/public_test_cases/p01023/input.2.txt b/codenet/public_test_cases/p01023/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fd2f2a31129e87500ff030e53e7d0182328d225 --- /dev/null +++ b/codenet/public_test_cases/p01023/input.2.txt @@ -0,0 +1,3 @@ +2 6 2 +.1.baS +.2.cde diff --git a/codenet/public_test_cases/p01023/input.3.txt b/codenet/public_test_cases/p01023/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4679cdbdeac0d84350e79cded8cee38c7afae559 --- /dev/null +++ b/codenet/public_test_cases/p01023/input.3.txt @@ -0,0 +1,3 @@ +2 6 2 +.1#baS +.2.cde diff --git a/codenet/public_test_cases/p01023/input.4.txt b/codenet/public_test_cases/p01023/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ed01b4ef8cb4e3a390ca2dbea38f08912974ec9 --- /dev/null +++ b/codenet/public_test_cases/p01023/input.4.txt @@ -0,0 +1,6 @@ +5 8 3 +....... +.####2# +.#.3..# +.###### +.1Sabcde diff --git a/codenet/public_test_cases/p01023/output.0.txt b/codenet/public_test_cases/p01023/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01023/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01023/output.1.txt b/codenet/public_test_cases/p01023/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01023/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01023/output.2.txt b/codenet/public_test_cases/p01023/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01023/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01023/output.3.txt b/codenet/public_test_cases/p01023/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01023/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01023/output.4.txt b/codenet/public_test_cases/p01023/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01023/output.4.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01024/input.0.txt b/codenet/public_test_cases/p01024/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..039a4eb056bbf6e477a135d4d5a290c9ebde0ff4 --- /dev/null +++ b/codenet/public_test_cases/p01024/input.0.txt @@ -0,0 +1 @@ +1 1 9 diff --git a/codenet/public_test_cases/p01024/input.1.txt b/codenet/public_test_cases/p01024/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..039a4eb056bbf6e477a135d4d5a290c9ebde0ff4 --- /dev/null +++ b/codenet/public_test_cases/p01024/input.1.txt @@ -0,0 +1 @@ +1 1 9 diff --git a/codenet/public_test_cases/p01024/input.2.txt b/codenet/public_test_cases/p01024/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea03bbd6afb25a6f7d7de81b26e5f6c82337c2ad --- /dev/null +++ b/codenet/public_test_cases/p01024/input.2.txt @@ -0,0 +1 @@ +100 7 12 diff --git a/codenet/public_test_cases/p01024/input.3.txt b/codenet/public_test_cases/p01024/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5327bb22b576be8bc6917669fb95d05f27aa4819 --- /dev/null +++ b/codenet/public_test_cases/p01024/input.3.txt @@ -0,0 +1 @@ +6 11 11 diff --git a/codenet/public_test_cases/p01024/input.4.txt b/codenet/public_test_cases/p01024/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaee162b8456e2053528a953d12c3db963e8c3b0 --- /dev/null +++ b/codenet/public_test_cases/p01024/input.4.txt @@ -0,0 +1 @@ +2 1 3 diff --git a/codenet/public_test_cases/p01024/input.5.txt b/codenet/public_test_cases/p01024/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..634157c25377f8436fb0616cc566ed8498ecb0b0 --- /dev/null +++ b/codenet/public_test_cases/p01024/input.5.txt @@ -0,0 +1 @@ +123 123 3 diff --git a/codenet/public_test_cases/p01024/output.0.txt b/codenet/public_test_cases/p01024/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01024/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01024/output.1.txt b/codenet/public_test_cases/p01024/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01024/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01024/output.2.txt b/codenet/public_test_cases/p01024/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01024/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01024/output.3.txt b/codenet/public_test_cases/p01024/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..69a893aa31141827125ddaaee26966b7aed3de74 --- /dev/null +++ b/codenet/public_test_cases/p01024/output.3.txt @@ -0,0 +1 @@ +66 diff --git a/codenet/public_test_cases/p01024/output.4.txt b/codenet/public_test_cases/p01024/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01024/output.4.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01024/output.5.txt b/codenet/public_test_cases/p01024/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01024/output.5.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01026/input.0.txt b/codenet/public_test_cases/p01026/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f463d72beeef25f3da21d02d8b157691fdda3cac --- /dev/null +++ b/codenet/public_test_cases/p01026/input.0.txt @@ -0,0 +1,25 @@ +7 +1 +2 +3 +4 +5 +6 +7 +1 2 +1 3 +3 4 +3 5 +5 6 +5 7 +10 +0 1 7 +0 2 7 +1 1 15 +0 1 7 +0 2 7 +0 1 1 +1 1 -15 +0 1 7 +0 2 7 +0 1 1 diff --git a/codenet/public_test_cases/p01026/input.1.txt b/codenet/public_test_cases/p01026/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f463d72beeef25f3da21d02d8b157691fdda3cac --- /dev/null +++ b/codenet/public_test_cases/p01026/input.1.txt @@ -0,0 +1,25 @@ +7 +1 +2 +3 +4 +5 +6 +7 +1 2 +1 3 +3 4 +3 5 +5 6 +5 7 +10 +0 1 7 +0 2 7 +1 1 15 +0 1 7 +0 2 7 +0 1 1 +1 1 -15 +0 1 7 +0 2 7 +0 1 1 diff --git a/codenet/public_test_cases/p01026/output.0.txt b/codenet/public_test_cases/p01026/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b18c2a3284ec6e74105cd8e881c2f348fa8f2b0 --- /dev/null +++ b/codenet/public_test_cases/p01026/output.0.txt @@ -0,0 +1,8 @@ +16 +18 +31 +33 +16 +16 +18 +1 diff --git a/codenet/public_test_cases/p01026/output.1.txt b/codenet/public_test_cases/p01026/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b18c2a3284ec6e74105cd8e881c2f348fa8f2b0 --- /dev/null +++ b/codenet/public_test_cases/p01026/output.1.txt @@ -0,0 +1,8 @@ +16 +18 +31 +33 +16 +16 +18 +1 diff --git a/codenet/public_test_cases/p01027/input.0.txt b/codenet/public_test_cases/p01027/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..17400e35ce9b8026e97930715965fbfe33212565 --- /dev/null +++ b/codenet/public_test_cases/p01027/input.0.txt @@ -0,0 +1,10 @@ +3 +frence 1 +usi 1 +powland 1 +2 +usi 0 frence 0 10 +frence 0 powland 0 10 +2 +usi 0 +powland 0 diff --git a/codenet/public_test_cases/p01027/input.1.txt b/codenet/public_test_cases/p01027/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3098605e7248a213c8d62e01848a290bd8a57e5c --- /dev/null +++ b/codenet/public_test_cases/p01027/input.1.txt @@ -0,0 +1,14 @@ +3 +chinax 1 +ok 1 +austraria 2 +6 +chinax 0 austraria 0 5 +austraria 0 chinax 0 5 +austraria 1 austraria 0 1 +ok 0 austraria 0 5 +austraria 0 ok 0 5 +ok 0 austraria 1 1 +2 +chinax 0 +ok 0 diff --git a/codenet/public_test_cases/p01027/input.2.txt b/codenet/public_test_cases/p01027/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ac7c2977105ba6d3269f2188c41d100cec033c9 --- /dev/null +++ b/codenet/public_test_cases/p01027/input.2.txt @@ -0,0 +1,10 @@ +2 +usso 2 +caneda 2 +4 +usso 1 usso 0 1 +usso 0 caneda 0 10 +usso 0 caneda 1 2 +caneda 1 caneda 0 2 +1 +usso 1 diff --git a/codenet/public_test_cases/p01027/input.3.txt b/codenet/public_test_cases/p01027/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2e1cf9036758683a7131946c0a88792355841e4 --- /dev/null +++ b/codenet/public_test_cases/p01027/input.3.txt @@ -0,0 +1,21 @@ +3 +neepal 2 +luxenbourg 4 +noway 2 +12 +neepal 1 neepal 0 2 +neepal 0 noway 1 2 +neepal 0 luxenbourg 0 10 +neepal 0 luxenbourg 3 2 +luxenbourg 3 luxenbourg 1 2 +luxenbourg 3 luxenbourg 2 2 +luxenbourg 1 luxenbourg 0 2 +luxenbourg 2 luxenbourg 0 2 +noway 1 noway 0 2 +noway 0 neepal 0 2 +noway 0 luxenbourg 3 2 +noway 0 luxenbourg 0 10 +3 +neepal 1 +luxenbourg 3 +noway 1 diff --git a/codenet/public_test_cases/p01027/input.4.txt b/codenet/public_test_cases/p01027/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..17400e35ce9b8026e97930715965fbfe33212565 --- /dev/null +++ b/codenet/public_test_cases/p01027/input.4.txt @@ -0,0 +1,10 @@ +3 +frence 1 +usi 1 +powland 1 +2 +usi 0 frence 0 10 +frence 0 powland 0 10 +2 +usi 0 +powland 0 diff --git a/codenet/public_test_cases/p01027/output.0.txt b/codenet/public_test_cases/p01027/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5573a4f69c78ec68b717d45440b633e92db54677 --- /dev/null +++ b/codenet/public_test_cases/p01027/output.0.txt @@ -0,0 +1,6 @@ +20 +usi 0 frence 0 +frence 0 powland 0 +----- +Impossible +----- diff --git a/codenet/public_test_cases/p01027/output.1.txt b/codenet/public_test_cases/p01027/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..79a50b53ea3429b81500181d36f575043299af78 --- /dev/null +++ b/codenet/public_test_cases/p01027/output.1.txt @@ -0,0 +1,9 @@ +10 +chinax 0 austraria 0 +austraria 0 ok 0 +----- +7 +ok 0 austraria 1 +austraria 1 austraria 0 +austraria 0 chinax 0 +----- diff --git a/codenet/public_test_cases/p01027/output.2.txt b/codenet/public_test_cases/p01027/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3c3a40c98b399c1837fa6bb030c068207013fa3 --- /dev/null +++ b/codenet/public_test_cases/p01027/output.2.txt @@ -0,0 +1,5 @@ +5 +usso 1 usso 0 +usso 0 caneda 1 +caneda 1 caneda 0 +----- diff --git a/codenet/public_test_cases/p01027/output.3.txt b/codenet/public_test_cases/p01027/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7ea0dc919c257ba6d9ebdda6c276552eeb088be --- /dev/null +++ b/codenet/public_test_cases/p01027/output.3.txt @@ -0,0 +1,17 @@ +12 +neepal 1 neepal 0 +neepal 0 luxenbourg 3 +luxenbourg 3 luxenbourg 2 +luxenbourg 2 luxenbourg 0 +neepal 0 noway 1 +noway 1 noway 0 +----- +Impossible +----- +10 +noway 1 noway 0 +neepal 0 luxenbourg 3 +luxenbourg 3 luxenbourg 2 +luxenbourg 2 luxenbourg 0 +noway 0 neepal 0 +----- diff --git a/codenet/public_test_cases/p01027/output.4.txt b/codenet/public_test_cases/p01027/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5573a4f69c78ec68b717d45440b633e92db54677 --- /dev/null +++ b/codenet/public_test_cases/p01027/output.4.txt @@ -0,0 +1,6 @@ +20 +usi 0 frence 0 +frence 0 powland 0 +----- +Impossible +----- diff --git a/codenet/public_test_cases/p01028/input.0.txt b/codenet/public_test_cases/p01028/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d249d05ec9a08a09c61c1d6b23ca75834619d174 --- /dev/null +++ b/codenet/public_test_cases/p01028/input.0.txt @@ -0,0 +1,2 @@ +1 10 +1 2 3 4 5 6 7 8 9 10 diff --git a/codenet/public_test_cases/p01028/input.1.txt b/codenet/public_test_cases/p01028/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d27f4a3f68a1ea04523047ae8a89b108917763c --- /dev/null +++ b/codenet/public_test_cases/p01028/input.1.txt @@ -0,0 +1,2 @@ +5 30 +25 51 32 9 2 1 10 2 5 10 diff --git a/codenet/public_test_cases/p01028/input.2.txt b/codenet/public_test_cases/p01028/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d249d05ec9a08a09c61c1d6b23ca75834619d174 --- /dev/null +++ b/codenet/public_test_cases/p01028/input.2.txt @@ -0,0 +1,2 @@ +1 10 +1 2 3 4 5 6 7 8 9 10 diff --git a/codenet/public_test_cases/p01028/input.3.txt b/codenet/public_test_cases/p01028/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cd3ea678d6dac07edbb601ed65fffc15536f2da --- /dev/null +++ b/codenet/public_test_cases/p01028/input.3.txt @@ -0,0 +1,2 @@ +5 100 +101 101 101 101 101 101 101 101 101 101 diff --git a/codenet/public_test_cases/p01028/input.4.txt b/codenet/public_test_cases/p01028/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cb2bbe4ec181adfc3d5a6ea1506d04495fbe8fa --- /dev/null +++ b/codenet/public_test_cases/p01028/input.4.txt @@ -0,0 +1,2 @@ +3 10 +8 4 5 3 5 6 9 10 11 2 diff --git a/codenet/public_test_cases/p01028/output.0.txt b/codenet/public_test_cases/p01028/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01028/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01028/output.1.txt b/codenet/public_test_cases/p01028/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2420c5e8665a68c89ca774f8b5a71c517d2c03dd --- /dev/null +++ b/codenet/public_test_cases/p01028/output.1.txt @@ -0,0 +1 @@ +04555 diff --git a/codenet/public_test_cases/p01028/output.2.txt b/codenet/public_test_cases/p01028/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01028/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01028/output.3.txt b/codenet/public_test_cases/p01028/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..69fc4ef2be0c2550c183850902cb55dbf3d37b30 --- /dev/null +++ b/codenet/public_test_cases/p01028/output.3.txt @@ -0,0 +1 @@ +NA diff --git a/codenet/public_test_cases/p01028/output.4.txt b/codenet/public_test_cases/p01028/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..078fa0fe576b141de649b5439c1fbebbb391dff4 --- /dev/null +++ b/codenet/public_test_cases/p01028/output.4.txt @@ -0,0 +1 @@ +119 diff --git a/codenet/public_test_cases/p01029/input.0.txt b/codenet/public_test_cases/p01029/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb1c9bf4a1ed4b45ffacb10fcd9470f53a4cc611 --- /dev/null +++ b/codenet/public_test_cases/p01029/input.0.txt @@ -0,0 +1,5 @@ +3 3 +c ? ? +0 1 +0 2 +1 2 diff --git a/codenet/public_test_cases/p01029/input.1.txt b/codenet/public_test_cases/p01029/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b06cb80b2c8408a7d139d382d184b0af466c1711 --- /dev/null +++ b/codenet/public_test_cases/p01029/input.1.txt @@ -0,0 +1,4 @@ +3 2 +c ? ? +0 1 +0 2 diff --git a/codenet/public_test_cases/p01029/input.2.txt b/codenet/public_test_cases/p01029/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..39b6efcd9465aa9fc3fa122e392f7b0d68c6beeb --- /dev/null +++ b/codenet/public_test_cases/p01029/input.2.txt @@ -0,0 +1,2 @@ +5 0 +? ? ? ? ? diff --git a/codenet/public_test_cases/p01029/input.3.txt b/codenet/public_test_cases/p01029/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb1c9bf4a1ed4b45ffacb10fcd9470f53a4cc611 --- /dev/null +++ b/codenet/public_test_cases/p01029/input.3.txt @@ -0,0 +1,5 @@ +3 3 +c ? ? +0 1 +0 2 +1 2 diff --git a/codenet/public_test_cases/p01029/input.4.txt b/codenet/public_test_cases/p01029/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..77ae6482d9b36422d0aab8159ef5f88c02547bda --- /dev/null +++ b/codenet/public_test_cases/p01029/input.4.txt @@ -0,0 +1,8 @@ +7 6 +? a ? ? z a ? +0 1 +0 2 +3 4 +4 5 +4 6 +5 6 diff --git a/codenet/public_test_cases/p01029/output.0.txt b/codenet/public_test_cases/p01029/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c9f758ee968ddbcacc8fb53856ed91e141ab815 --- /dev/null +++ b/codenet/public_test_cases/p01029/output.0.txt @@ -0,0 +1 @@ +cab diff --git a/codenet/public_test_cases/p01029/output.1.txt b/codenet/public_test_cases/p01029/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c07c90f93bb95cbe78b79f97ba018f48bb15a1df --- /dev/null +++ b/codenet/public_test_cases/p01029/output.1.txt @@ -0,0 +1 @@ +caa diff --git a/codenet/public_test_cases/p01029/output.2.txt b/codenet/public_test_cases/p01029/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccc3e7b48da0932cc0f7c4ce7b4fd834c7032fe1 --- /dev/null +++ b/codenet/public_test_cases/p01029/output.2.txt @@ -0,0 +1 @@ +aaaaa diff --git a/codenet/public_test_cases/p01029/output.3.txt b/codenet/public_test_cases/p01029/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c9f758ee968ddbcacc8fb53856ed91e141ab815 --- /dev/null +++ b/codenet/public_test_cases/p01029/output.3.txt @@ -0,0 +1 @@ +cab diff --git a/codenet/public_test_cases/p01029/output.4.txt b/codenet/public_test_cases/p01029/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..aae3b51e1c53779a03be22c0f555c18d96dd6cf3 --- /dev/null +++ b/codenet/public_test_cases/p01029/output.4.txt @@ -0,0 +1 @@ +baaazab diff --git a/codenet/public_test_cases/p01030/input.0.txt b/codenet/public_test_cases/p01030/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45d548864ee3d6c80dce52aa3a811038426d67eb --- /dev/null +++ b/codenet/public_test_cases/p01030/input.0.txt @@ -0,0 +1,7 @@ +2 2 +S. +.G +1 +3 +## +## diff --git a/codenet/public_test_cases/p01030/input.1.txt b/codenet/public_test_cases/p01030/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..068519234ec4db44804d0711cdc5a48c2d6ef220 --- /dev/null +++ b/codenet/public_test_cases/p01030/input.1.txt @@ -0,0 +1,14 @@ +2 3 +S## +G +4 +2 + +.## +3 + +.# +5 + +. +7 diff --git a/codenet/public_test_cases/p01030/input.2.txt b/codenet/public_test_cases/p01030/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..216f654c4592a10de17bbefa8a921e86a9ab11e3 --- /dev/null +++ b/codenet/public_test_cases/p01030/input.2.txt @@ -0,0 +1,25 @@ +4 3 +S.. +... +.G. +... +4 +2 + +.# + +.# +4 + +.. +.. + +6 + +.# + +.. +8 + +.. +.. diff --git a/codenet/public_test_cases/p01030/input.3.txt b/codenet/public_test_cases/p01030/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..530db091be2eed72dbd2b8b267c2ee373f03844c --- /dev/null +++ b/codenet/public_test_cases/p01030/input.3.txt @@ -0,0 +1,9 @@ +3 3 +S## + +G +1 +1 +... +... +... diff --git a/codenet/public_test_cases/p01030/input.4.txt b/codenet/public_test_cases/p01030/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8938a867484bf8d26f3a8bd8ec94eb539a342962 --- /dev/null +++ b/codenet/public_test_cases/p01030/input.4.txt @@ -0,0 +1,5 @@ +2 2 +S. +.G +1 +3 diff --git a/codenet/public_test_cases/p01030/input.5.txt b/codenet/public_test_cases/p01030/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfb81fc234c59427b7aeb275effa9951b6724ec9 --- /dev/null +++ b/codenet/public_test_cases/p01030/input.5.txt @@ -0,0 +1,5 @@ +2 2 +S. +.G +1 +2 diff --git a/codenet/public_test_cases/p01030/input.6.txt b/codenet/public_test_cases/p01030/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..45d548864ee3d6c80dce52aa3a811038426d67eb --- /dev/null +++ b/codenet/public_test_cases/p01030/input.6.txt @@ -0,0 +1,7 @@ +2 2 +S. +.G +1 +3 +## +## diff --git a/codenet/public_test_cases/p01030/output.0.txt b/codenet/public_test_cases/p01030/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01030/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01030/output.1.txt b/codenet/public_test_cases/p01030/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01030/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01030/output.2.txt b/codenet/public_test_cases/p01030/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01030/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01030/output.3.txt b/codenet/public_test_cases/p01030/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01030/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01030/output.4.txt b/codenet/public_test_cases/p01030/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01030/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01030/output.5.txt b/codenet/public_test_cases/p01030/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01030/output.5.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01030/output.6.txt b/codenet/public_test_cases/p01030/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01030/output.6.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01031/input.0.txt b/codenet/public_test_cases/p01031/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c62d9281b8fe149271a4c150cff330e0de9a8306 --- /dev/null +++ b/codenet/public_test_cases/p01031/input.0.txt @@ -0,0 +1,2 @@ +6 25 3 +8 5 1 1 2 6 diff --git a/codenet/public_test_cases/p01031/input.1.txt b/codenet/public_test_cases/p01031/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32d2d95b501cb5cfd24a5204d509282aab806d59 --- /dev/null +++ b/codenet/public_test_cases/p01031/input.1.txt @@ -0,0 +1,2 @@ +4 10 1 +1 2 3 4 diff --git a/codenet/public_test_cases/p01031/input.2.txt b/codenet/public_test_cases/p01031/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60e1fbf1948ad8173896e93ed602dba3828191ec --- /dev/null +++ b/codenet/public_test_cases/p01031/input.2.txt @@ -0,0 +1,2 @@ +4 11 1 +1 2 3 4 diff --git a/codenet/public_test_cases/p01031/input.3.txt b/codenet/public_test_cases/p01031/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c62d9281b8fe149271a4c150cff330e0de9a8306 --- /dev/null +++ b/codenet/public_test_cases/p01031/input.3.txt @@ -0,0 +1,2 @@ +6 25 3 +8 5 1 1 2 6 diff --git a/codenet/public_test_cases/p01031/output.0.txt b/codenet/public_test_cases/p01031/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01031/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01031/output.1.txt b/codenet/public_test_cases/p01031/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01031/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01031/output.2.txt b/codenet/public_test_cases/p01031/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01031/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01031/output.3.txt b/codenet/public_test_cases/p01031/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01031/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01032/input.0.txt b/codenet/public_test_cases/p01032/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b07e54d3ad0910b13b678fef5356036fb8f85b70 --- /dev/null +++ b/codenet/public_test_cases/p01032/input.0.txt @@ -0,0 +1,4 @@ +6 3 +4 +4 +5 diff --git a/codenet/public_test_cases/p01032/input.1.txt b/codenet/public_test_cases/p01032/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b07e54d3ad0910b13b678fef5356036fb8f85b70 --- /dev/null +++ b/codenet/public_test_cases/p01032/input.1.txt @@ -0,0 +1,4 @@ +6 3 +4 +4 +5 diff --git a/codenet/public_test_cases/p01032/input.2.txt b/codenet/public_test_cases/p01032/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ffc927ab8cdfb8b703bed04bcaf1bc473b1ee7c --- /dev/null +++ b/codenet/public_test_cases/p01032/input.2.txt @@ -0,0 +1,5 @@ +6 4 +2 +5 +4 +5 diff --git a/codenet/public_test_cases/p01032/output.0.txt b/codenet/public_test_cases/p01032/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p01032/output.0.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p01032/output.1.txt b/codenet/public_test_cases/p01032/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p01032/output.1.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p01032/output.2.txt b/codenet/public_test_cases/p01032/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p01032/output.2.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p01033/input.0.txt b/codenet/public_test_cases/p01033/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b97e512eda80bea9efaca7190fced08b574761a1 --- /dev/null +++ b/codenet/public_test_cases/p01033/input.0.txt @@ -0,0 +1,15 @@ +3 3 +3 +0 0 +1 1 +2 2 +2 +1 0 +2 1 +3 +1 1 +2 2 +0 1 +2 +1 0 +2 0 diff --git a/codenet/public_test_cases/p01033/input.1.txt b/codenet/public_test_cases/p01033/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b97e512eda80bea9efaca7190fced08b574761a1 --- /dev/null +++ b/codenet/public_test_cases/p01033/input.1.txt @@ -0,0 +1,15 @@ +3 3 +3 +0 0 +1 1 +2 2 +2 +1 0 +2 1 +3 +1 1 +2 2 +0 1 +2 +1 0 +2 0 diff --git a/codenet/public_test_cases/p01033/input.2.txt b/codenet/public_test_cases/p01033/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e1b9ecae76f4f16f671f908caa23a419d0f6c7a --- /dev/null +++ b/codenet/public_test_cases/p01033/input.2.txt @@ -0,0 +1,25 @@ +5 5 +5 +4 1 +2 2 +1 4 +1 3 +4 2 +5 +1 1 +1 2 +3 3 +3 0 +3 4 +5 +2 3 +2 2 +0 3 +0 2 +4 1 +5 +2 0 +4 0 +1 0 +4 3 +2 1 diff --git a/codenet/public_test_cases/p01033/output.0.txt b/codenet/public_test_cases/p01033/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55a3691e6307c272f9b59fccd659236978ccea23 --- /dev/null +++ b/codenet/public_test_cases/p01033/output.0.txt @@ -0,0 +1 @@ +2 0 0 diff --git a/codenet/public_test_cases/p01033/output.1.txt b/codenet/public_test_cases/p01033/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..55a3691e6307c272f9b59fccd659236978ccea23 --- /dev/null +++ b/codenet/public_test_cases/p01033/output.1.txt @@ -0,0 +1 @@ +2 0 0 diff --git a/codenet/public_test_cases/p01033/output.2.txt b/codenet/public_test_cases/p01033/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf3b95ccb2dce2dba412eba3a42880252b3238a3 --- /dev/null +++ b/codenet/public_test_cases/p01033/output.2.txt @@ -0,0 +1 @@ +2 1 0 diff --git a/codenet/public_test_cases/p01034/input.0.txt b/codenet/public_test_cases/p01034/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a716789f457f205e23450d17a864936a60a6fed --- /dev/null +++ b/codenet/public_test_cases/p01034/input.0.txt @@ -0,0 +1,3 @@ +3 2 -3 +0 1 1 +0 2 5 diff --git a/codenet/public_test_cases/p01034/input.1.txt b/codenet/public_test_cases/p01034/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de7714a3561e29d45952202fe44c842f46c03fa8 --- /dev/null +++ b/codenet/public_test_cases/p01034/input.1.txt @@ -0,0 +1,9 @@ +7 8 -8 +0 1 5 +0 4 3 +1 2 10 +1 3 1 +3 6 6 +4 3 1 +4 5 2 +4 6 2 diff --git a/codenet/public_test_cases/p01034/input.2.txt b/codenet/public_test_cases/p01034/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..694fe7b4782d4c6f0498529f5101f60f6815e6eb --- /dev/null +++ b/codenet/public_test_cases/p01034/input.2.txt @@ -0,0 +1,3 @@ +3 2 -1 +0 1 1 +0 2 5 diff --git a/codenet/public_test_cases/p01034/input.3.txt b/codenet/public_test_cases/p01034/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a716789f457f205e23450d17a864936a60a6fed --- /dev/null +++ b/codenet/public_test_cases/p01034/input.3.txt @@ -0,0 +1,3 @@ +3 2 -3 +0 1 1 +0 2 5 diff --git a/codenet/public_test_cases/p01034/input.4.txt b/codenet/public_test_cases/p01034/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..da3bc12d843c427cc4845c3b860f12a924c39134 --- /dev/null +++ b/codenet/public_test_cases/p01034/input.4.txt @@ -0,0 +1,5 @@ +5 4 -30 +0 1 1 +1 3 15 +1 4 4 +2 1 3 diff --git a/codenet/public_test_cases/p01034/output.0.txt b/codenet/public_test_cases/p01034/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fbedf693b51d80a9480634ff720815943de9889 --- /dev/null +++ b/codenet/public_test_cases/p01034/output.0.txt @@ -0,0 +1 @@ +-2 diff --git a/codenet/public_test_cases/p01034/output.1.txt b/codenet/public_test_cases/p01034/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01034/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01034/output.2.txt b/codenet/public_test_cases/p01034/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..69fc4ef2be0c2550c183850902cb55dbf3d37b30 --- /dev/null +++ b/codenet/public_test_cases/p01034/output.2.txt @@ -0,0 +1 @@ +NA diff --git a/codenet/public_test_cases/p01034/output.3.txt b/codenet/public_test_cases/p01034/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fbedf693b51d80a9480634ff720815943de9889 --- /dev/null +++ b/codenet/public_test_cases/p01034/output.3.txt @@ -0,0 +1 @@ +-2 diff --git a/codenet/public_test_cases/p01034/output.4.txt b/codenet/public_test_cases/p01034/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..53c2ee5a7f6d46d703d90a7958e1d2d6e013e1fe --- /dev/null +++ b/codenet/public_test_cases/p01034/output.4.txt @@ -0,0 +1 @@ +-12 diff --git a/codenet/public_test_cases/p01035/input.0.txt b/codenet/public_test_cases/p01035/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7f9ef63288f1c327d7b5891ae6091cca3318948 --- /dev/null +++ b/codenet/public_test_cases/p01035/input.0.txt @@ -0,0 +1,6 @@ +3 +1 2 3 +3 +0 2 2 +0 2 4 +0 0 2 diff --git a/codenet/public_test_cases/p01035/input.1.txt b/codenet/public_test_cases/p01035/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7f9ef63288f1c327d7b5891ae6091cca3318948 --- /dev/null +++ b/codenet/public_test_cases/p01035/input.1.txt @@ -0,0 +1,6 @@ +3 +1 2 3 +3 +0 2 2 +0 2 4 +0 0 2 diff --git a/codenet/public_test_cases/p01035/input.2.txt b/codenet/public_test_cases/p01035/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f734c1c88bb207497f53e69b4ed9daa578a3a26f --- /dev/null +++ b/codenet/public_test_cases/p01035/input.2.txt @@ -0,0 +1,8 @@ +10 +4 5 0 21 9 100 12 9 0 8 +5 +0 3 20 +2 5 100 +8 9 9 +5 5 10 +0 9 20 diff --git a/codenet/public_test_cases/p01035/output.0.txt b/codenet/public_test_cases/p01035/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..986394f7c0fa05e52a94a3d93dee7085ed84cca4 --- /dev/null +++ b/codenet/public_test_cases/p01035/output.0.txt @@ -0,0 +1,3 @@ +0 +1 +1 diff --git a/codenet/public_test_cases/p01035/output.1.txt b/codenet/public_test_cases/p01035/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..986394f7c0fa05e52a94a3d93dee7085ed84cca4 --- /dev/null +++ b/codenet/public_test_cases/p01035/output.1.txt @@ -0,0 +1,3 @@ +0 +1 +1 diff --git a/codenet/public_test_cases/p01035/output.2.txt b/codenet/public_test_cases/p01035/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8652982420f51521b0dbe5503e7ee6787ec2d5bf --- /dev/null +++ b/codenet/public_test_cases/p01035/output.2.txt @@ -0,0 +1,5 @@ +1 +0 +1 +90 +1 diff --git a/codenet/public_test_cases/p01036/input.0.txt b/codenet/public_test_cases/p01036/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65f8e9f6243b330606d6fafa0bc5295c07a58e61 --- /dev/null +++ b/codenet/public_test_cases/p01036/input.0.txt @@ -0,0 +1,6 @@ +1 2 2 1 +4 1 +0 0 +2 0 +2 2 +0 2 diff --git a/codenet/public_test_cases/p01036/input.1.txt b/codenet/public_test_cases/p01036/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ab0e796b40c957f97a267cd4c60ecb32137883f --- /dev/null +++ b/codenet/public_test_cases/p01036/input.1.txt @@ -0,0 +1,6 @@ +1 2 2 1 +4 1 +0 0 +5 0 +5 5 +0 5 diff --git a/codenet/public_test_cases/p01036/input.2.txt b/codenet/public_test_cases/p01036/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..65f8e9f6243b330606d6fafa0bc5295c07a58e61 --- /dev/null +++ b/codenet/public_test_cases/p01036/input.2.txt @@ -0,0 +1,6 @@ +1 2 2 1 +4 1 +0 0 +2 0 +2 2 +0 2 diff --git a/codenet/public_test_cases/p01036/input.3.txt b/codenet/public_test_cases/p01036/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6919a8bd72554d6c080a86783d85a284a9c9f25 --- /dev/null +++ b/codenet/public_test_cases/p01036/input.3.txt @@ -0,0 +1,6 @@ +1 10 10 1 +4 10 +0 0 +1 0 +1 1 +0 1 diff --git a/codenet/public_test_cases/p01036/input.4.txt b/codenet/public_test_cases/p01036/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e666ffbf044bfc21f5e7249a6575dac47fcd2f0 --- /dev/null +++ b/codenet/public_test_cases/p01036/input.4.txt @@ -0,0 +1,19 @@ +4 3 3 2 +3 1 +1 1 +3 3 +1 5 +4 2 +2 0 +5 0 +4 2 +3 2 +3 3 +4 3 +6 1 +6 5 +4 4 +3 4 +4 4 +5 6 +2 6 diff --git a/codenet/public_test_cases/p01036/output.0.txt b/codenet/public_test_cases/p01036/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc245fcad7d3c100b33c2e91359706373a8dc3e8 --- /dev/null +++ b/codenet/public_test_cases/p01036/output.0.txt @@ -0,0 +1 @@ +0.2500000000 diff --git a/codenet/public_test_cases/p01036/output.1.txt b/codenet/public_test_cases/p01036/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..487cbbc74cbdc97e962d1773d88da2ca4f560520 --- /dev/null +++ b/codenet/public_test_cases/p01036/output.1.txt @@ -0,0 +1 @@ +1.0000000000 diff --git a/codenet/public_test_cases/p01036/output.2.txt b/codenet/public_test_cases/p01036/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc245fcad7d3c100b33c2e91359706373a8dc3e8 --- /dev/null +++ b/codenet/public_test_cases/p01036/output.2.txt @@ -0,0 +1 @@ +0.2500000000 diff --git a/codenet/public_test_cases/p01036/output.3.txt b/codenet/public_test_cases/p01036/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9ea018f39fb93217cb6e831e08c8a7d15907f1a --- /dev/null +++ b/codenet/public_test_cases/p01036/output.3.txt @@ -0,0 +1 @@ +0.0000000000 diff --git a/codenet/public_test_cases/p01036/output.4.txt b/codenet/public_test_cases/p01036/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c89f3ed9b7b797d0179d94307c4895271507846b --- /dev/null +++ b/codenet/public_test_cases/p01036/output.4.txt @@ -0,0 +1 @@ +1.0574955319 diff --git a/codenet/public_test_cases/p01037/input.0.txt b/codenet/public_test_cases/p01037/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ef7105cdcd6ea255d2eb2c78b7e69613839dde5 --- /dev/null +++ b/codenet/public_test_cases/p01037/input.0.txt @@ -0,0 +1,4 @@ +5 3 +0 1 +2 1 +3 1 diff --git a/codenet/public_test_cases/p01037/input.1.txt b/codenet/public_test_cases/p01037/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..491d4d8adbe34566a5ea5a9d93aa76d73f874f79 --- /dev/null +++ b/codenet/public_test_cases/p01037/input.1.txt @@ -0,0 +1,3 @@ +4 2 +0 2 +1 2 diff --git a/codenet/public_test_cases/p01037/input.2.txt b/codenet/public_test_cases/p01037/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c39bf4cd760e083a448f208a8f751acde834539 --- /dev/null +++ b/codenet/public_test_cases/p01037/input.2.txt @@ -0,0 +1,4 @@ +10 3 +2 1 +4 1 +9 2 diff --git a/codenet/public_test_cases/p01037/input.3.txt b/codenet/public_test_cases/p01037/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ef7105cdcd6ea255d2eb2c78b7e69613839dde5 --- /dev/null +++ b/codenet/public_test_cases/p01037/input.3.txt @@ -0,0 +1,4 @@ +5 3 +0 1 +2 1 +3 1 diff --git a/codenet/public_test_cases/p01037/output.0.txt b/codenet/public_test_cases/p01037/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0962b6a34ef917a2b7cbd89e1894e4541155cf0 --- /dev/null +++ b/codenet/public_test_cases/p01037/output.0.txt @@ -0,0 +1,2 @@ +2 1 +1 1 diff --git a/codenet/public_test_cases/p01037/output.1.txt b/codenet/public_test_cases/p01037/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p01037/output.1.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p01037/output.2.txt b/codenet/public_test_cases/p01037/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fa10279583c299e9d987e8a5ad331bc6c8704d --- /dev/null +++ b/codenet/public_test_cases/p01037/output.2.txt @@ -0,0 +1,2 @@ +2 1 +1 2 diff --git a/codenet/public_test_cases/p01037/output.3.txt b/codenet/public_test_cases/p01037/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0962b6a34ef917a2b7cbd89e1894e4541155cf0 --- /dev/null +++ b/codenet/public_test_cases/p01037/output.3.txt @@ -0,0 +1,2 @@ +2 1 +1 1 diff --git a/codenet/public_test_cases/p01038/input.0.txt b/codenet/public_test_cases/p01038/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21cda1691d5d903687be133f4cb6c9fbaafa0965 --- /dev/null +++ b/codenet/public_test_cases/p01038/input.0.txt @@ -0,0 +1 @@ +5 1 2 3 4 3 diff --git a/codenet/public_test_cases/p01038/output.0.txt b/codenet/public_test_cases/p01038/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7df794048e03bdb00a8732afa470f6c8326d40f --- /dev/null +++ b/codenet/public_test_cases/p01038/output.0.txt @@ -0,0 +1 @@ +0 0 0 1 0 diff --git a/codenet/public_test_cases/p01039/input.0.txt b/codenet/public_test_cases/p01039/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d6846178d9240773ed9c764d4b18bd034a2d717 --- /dev/null +++ b/codenet/public_test_cases/p01039/input.0.txt @@ -0,0 +1,3 @@ +2 5 +1 1 +2 1 diff --git a/codenet/public_test_cases/p01039/input.1.txt b/codenet/public_test_cases/p01039/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c049490168783326daf5006e1899937bd87ea8d1 --- /dev/null +++ b/codenet/public_test_cases/p01039/input.1.txt @@ -0,0 +1,2 @@ +1 3 +4 1 diff --git a/codenet/public_test_cases/p01039/input.2.txt b/codenet/public_test_cases/p01039/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..18fd2ac0597ffff008663daa938609c2c6e63932 --- /dev/null +++ b/codenet/public_test_cases/p01039/input.2.txt @@ -0,0 +1,3 @@ +2 12 +9 1 +3 2 diff --git a/codenet/public_test_cases/p01039/input.3.txt b/codenet/public_test_cases/p01039/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d6846178d9240773ed9c764d4b18bd034a2d717 --- /dev/null +++ b/codenet/public_test_cases/p01039/input.3.txt @@ -0,0 +1,3 @@ +2 5 +1 1 +2 1 diff --git a/codenet/public_test_cases/p01039/output.0.txt b/codenet/public_test_cases/p01039/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01039/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01039/output.1.txt b/codenet/public_test_cases/p01039/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01039/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01039/output.2.txt b/codenet/public_test_cases/p01039/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01039/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01039/output.3.txt b/codenet/public_test_cases/p01039/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01039/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01040/input.0.txt b/codenet/public_test_cases/p01040/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..038f1dd3e3a8a3629cd5325528d86d1a7bd67640 --- /dev/null +++ b/codenet/public_test_cases/p01040/input.0.txt @@ -0,0 +1 @@ +2015 3 13 2015 3 13 diff --git a/codenet/public_test_cases/p01040/input.1.txt b/codenet/public_test_cases/p01040/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..038f1dd3e3a8a3629cd5325528d86d1a7bd67640 --- /dev/null +++ b/codenet/public_test_cases/p01040/input.1.txt @@ -0,0 +1 @@ +2015 3 13 2015 3 13 diff --git a/codenet/public_test_cases/p01040/input.2.txt b/codenet/public_test_cases/p01040/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5a1444870c5c1b9e45722e1b2b8741da4d8d734 --- /dev/null +++ b/codenet/public_test_cases/p01040/input.2.txt @@ -0,0 +1 @@ +2015 2 14 2015 3 15 diff --git a/codenet/public_test_cases/p01040/input.3.txt b/codenet/public_test_cases/p01040/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a558fd1a40845f1082473ddf0a0ef6c5fc5599af --- /dev/null +++ b/codenet/public_test_cases/p01040/input.3.txt @@ -0,0 +1 @@ +1234 5 6 789012345678901234 5 6 diff --git a/codenet/public_test_cases/p01040/output.0.txt b/codenet/public_test_cases/p01040/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01040/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01040/output.1.txt b/codenet/public_test_cases/p01040/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01040/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01040/output.2.txt b/codenet/public_test_cases/p01040/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01040/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01040/output.3.txt b/codenet/public_test_cases/p01040/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..103571ef6651aa5e2f3dbcb67184756d0d8ec0b0 --- /dev/null +++ b/codenet/public_test_cases/p01040/output.3.txt @@ -0,0 +1 @@ +1357101234567708000 diff --git a/codenet/public_test_cases/p01041/input.0.txt b/codenet/public_test_cases/p01041/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2d85d4d03a94359339b65a7e9032ffa67842f79 --- /dev/null +++ b/codenet/public_test_cases/p01041/input.0.txt @@ -0,0 +1,14 @@ +3 +apple +app +banana +9 +1 1 +3 1 +3 2 +3 3 +2 1 +1 2 +3 1 +3 2 +3 3 diff --git a/codenet/public_test_cases/p01041/input.1.txt b/codenet/public_test_cases/p01041/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2d85d4d03a94359339b65a7e9032ffa67842f79 --- /dev/null +++ b/codenet/public_test_cases/p01041/input.1.txt @@ -0,0 +1,14 @@ +3 +apple +app +banana +9 +1 1 +3 1 +3 2 +3 3 +2 1 +1 2 +3 1 +3 2 +3 3 diff --git a/codenet/public_test_cases/p01041/input.2.txt b/codenet/public_test_cases/p01041/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..87dc35cf59a8c244beeebb9a964af2fc720c9d82 --- /dev/null +++ b/codenet/public_test_cases/p01041/input.2.txt @@ -0,0 +1,22 @@ +7 +aaaab +aaa +aaaa +aaaaaabc +abbbbbc +ab +abbb +13 +1 1 +3 2 +1 4 +3 2 +1 3 +3 2 +2 3 +3 3 +1 5 +1 7 +3 6 +2 5 +3 6 diff --git a/codenet/public_test_cases/p01041/output.0.txt b/codenet/public_test_cases/p01041/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7efb0a539e76475821ef7b1a09acfcbc771a2133 --- /dev/null +++ b/codenet/public_test_cases/p01041/output.0.txt @@ -0,0 +1,6 @@ +1 +1 +-1 +-1 +2 +-1 diff --git a/codenet/public_test_cases/p01041/output.1.txt b/codenet/public_test_cases/p01041/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7efb0a539e76475821ef7b1a09acfcbc771a2133 --- /dev/null +++ b/codenet/public_test_cases/p01041/output.1.txt @@ -0,0 +1,6 @@ +1 +1 +-1 +-1 +2 +-1 diff --git a/codenet/public_test_cases/p01041/output.2.txt b/codenet/public_test_cases/p01041/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0aca568aeaa122c7db302da6973c98069834b811 --- /dev/null +++ b/codenet/public_test_cases/p01041/output.2.txt @@ -0,0 +1,6 @@ +1 +4 +3 +4 +7 +7 diff --git a/codenet/public_test_cases/p01042/input.0.txt b/codenet/public_test_cases/p01042/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8dad79ae16d34988419a776183e7ba2ff7cf2b2 --- /dev/null +++ b/codenet/public_test_cases/p01042/input.0.txt @@ -0,0 +1 @@ +2 5 3 3 11 diff --git a/codenet/public_test_cases/p01042/input.1.txt b/codenet/public_test_cases/p01042/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8dad79ae16d34988419a776183e7ba2ff7cf2b2 --- /dev/null +++ b/codenet/public_test_cases/p01042/input.1.txt @@ -0,0 +1 @@ +2 5 3 3 11 diff --git a/codenet/public_test_cases/p01042/input.2.txt b/codenet/public_test_cases/p01042/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8012e69a9d8a86746712ff57750b859a21098a4a --- /dev/null +++ b/codenet/public_test_cases/p01042/input.2.txt @@ -0,0 +1 @@ +1 2 3 4 100 diff --git a/codenet/public_test_cases/p01042/output.0.txt b/codenet/public_test_cases/p01042/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01042/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01042/output.1.txt b/codenet/public_test_cases/p01042/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01042/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01042/output.2.txt b/codenet/public_test_cases/p01042/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01042/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01043/input.0.txt b/codenet/public_test_cases/p01043/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a3a48676370ccf45f945355c65d7084b6e95877 --- /dev/null +++ b/codenet/public_test_cases/p01043/input.0.txt @@ -0,0 +1,19 @@ +3 1 +4 +0 4 +2 4 +2 7 +0 7 +1 6 +5 +1 0 +6 0 +4 5 +2 2 +1 4 +4 2 +3 +2 6 +6 4 +6 7 +5 6 diff --git a/codenet/public_test_cases/p01043/input.1.txt b/codenet/public_test_cases/p01043/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98b835b87db5f6884c9a7c0eaba77e6a9984f003 --- /dev/null +++ b/codenet/public_test_cases/p01043/input.1.txt @@ -0,0 +1,23 @@ +4 4 +3 +0 5 +3 8 +0 8 +1 7 +3 +1 3 +4 3 +1 6 +2 4 +5 +2 0 +7 0 +7 2 +3 2 +2 3 +6 1 +3 +6 2 +7 7 +2 7 +6 6 diff --git a/codenet/public_test_cases/p01043/input.2.txt b/codenet/public_test_cases/p01043/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5214ddd0c5e8cb58e39cc940a5450c5d63a37f62 --- /dev/null +++ b/codenet/public_test_cases/p01043/input.2.txt @@ -0,0 +1,16 @@ +3 2 +3 +0 2 +3 5 +0 5 +1 4 +3 +1 0 +4 0 +1 3 +2 1 +3 +2 2 +4 3 +2 4 +3 3 diff --git a/codenet/public_test_cases/p01043/input.3.txt b/codenet/public_test_cases/p01043/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a3a48676370ccf45f945355c65d7084b6e95877 --- /dev/null +++ b/codenet/public_test_cases/p01043/input.3.txt @@ -0,0 +1,19 @@ +3 1 +4 +0 4 +2 4 +2 7 +0 7 +1 6 +5 +1 0 +6 0 +4 5 +2 2 +1 4 +4 2 +3 +2 6 +6 4 +6 7 +5 6 diff --git a/codenet/public_test_cases/p01043/output.0.txt b/codenet/public_test_cases/p01043/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e068e41881c3fa76bfae1ee81500eb563777991 --- /dev/null +++ b/codenet/public_test_cases/p01043/output.0.txt @@ -0,0 +1 @@ +14.6502815399 diff --git a/codenet/public_test_cases/p01043/output.1.txt b/codenet/public_test_cases/p01043/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..059ebde8c8440dda32266bc42dfba53b62c074c6 --- /dev/null +++ b/codenet/public_test_cases/p01043/output.1.txt @@ -0,0 +1 @@ +18.9356648257 diff --git a/codenet/public_test_cases/p01043/output.2.txt b/codenet/public_test_cases/p01043/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f0de41e89a4663d7ffc2c9fe794ff9ccecda90d --- /dev/null +++ b/codenet/public_test_cases/p01043/output.2.txt @@ -0,0 +1 @@ +8.0644951022 diff --git a/codenet/public_test_cases/p01043/output.3.txt b/codenet/public_test_cases/p01043/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e068e41881c3fa76bfae1ee81500eb563777991 --- /dev/null +++ b/codenet/public_test_cases/p01043/output.3.txt @@ -0,0 +1 @@ +14.6502815399 diff --git a/codenet/public_test_cases/p01044/input.0.txt b/codenet/public_test_cases/p01044/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b323070ac3426b5f3681ee495b3f44d0ea694fb7 --- /dev/null +++ b/codenet/public_test_cases/p01044/input.0.txt @@ -0,0 +1,6 @@ +3 3 +RGR +RBP +YEB +1 +1 1 diff --git a/codenet/public_test_cases/p01044/input.1.txt b/codenet/public_test_cases/p01044/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e72f4ba413c754788a5906f654acccbdc3085e6 --- /dev/null +++ b/codenet/public_test_cases/p01044/input.1.txt @@ -0,0 +1,8 @@ +4 5 +BYYGG +RRRRR +RRBRR +YYGGB +2 +3 1 +3 1 diff --git a/codenet/public_test_cases/p01044/input.2.txt b/codenet/public_test_cases/p01044/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b323070ac3426b5f3681ee495b3f44d0ea694fb7 --- /dev/null +++ b/codenet/public_test_cases/p01044/input.2.txt @@ -0,0 +1,6 @@ +3 3 +RGR +RBP +YEB +1 +1 1 diff --git a/codenet/public_test_cases/p01044/input.3.txt b/codenet/public_test_cases/p01044/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6219d38b56ed47cb195a710e4b5be2ba5a6b9de8 --- /dev/null +++ b/codenet/public_test_cases/p01044/input.3.txt @@ -0,0 +1,7 @@ +4 4 +BEEP +ERYY +BBRP +RBYP +1 +1 2 diff --git a/codenet/public_test_cases/p01044/output.0.txt b/codenet/public_test_cases/p01044/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cfc5d471ea14075a774fac7847fc6676db4258f --- /dev/null +++ b/codenet/public_test_cases/p01044/output.0.txt @@ -0,0 +1,3 @@ +… +YBG +EBP diff --git a/codenet/public_test_cases/p01044/output.1.txt b/codenet/public_test_cases/p01044/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2996942bc91ecd921709dad00d89fc99df84dd92 --- /dev/null +++ b/codenet/public_test_cases/p01044/output.1.txt @@ -0,0 +1,4 @@ +..... +..... +..... +B.BGB diff --git a/codenet/public_test_cases/p01044/output.2.txt b/codenet/public_test_cases/p01044/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cfc5d471ea14075a774fac7847fc6676db4258f --- /dev/null +++ b/codenet/public_test_cases/p01044/output.2.txt @@ -0,0 +1,3 @@ +… +YBG +EBP diff --git a/codenet/public_test_cases/p01044/output.3.txt b/codenet/public_test_cases/p01044/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1e89fb5f95a5f346b5f3b05d7ae4a0e0446687e --- /dev/null +++ b/codenet/public_test_cases/p01044/output.3.txt @@ -0,0 +1,4 @@ +.... +.... +.... +.B.. diff --git a/codenet/public_test_cases/p01045/input.0.txt b/codenet/public_test_cases/p01045/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0deecdc4457d447b400b25b5828d9ef033a41222 --- /dev/null +++ b/codenet/public_test_cases/p01045/input.0.txt @@ -0,0 +1,4 @@ +3 3 2 +... +... +... diff --git a/codenet/public_test_cases/p01045/input.1.txt b/codenet/public_test_cases/p01045/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0deecdc4457d447b400b25b5828d9ef033a41222 --- /dev/null +++ b/codenet/public_test_cases/p01045/input.1.txt @@ -0,0 +1,4 @@ +3 3 2 +... +... +... diff --git a/codenet/public_test_cases/p01045/input.2.txt b/codenet/public_test_cases/p01045/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1ef3a93ac27affb7745edf6550f1bc79ba34c41 --- /dev/null +++ b/codenet/public_test_cases/p01045/input.2.txt @@ -0,0 +1,4 @@ +3 3 2 +.# +.#. +.. diff --git a/codenet/public_test_cases/p01045/output.0.txt b/codenet/public_test_cases/p01045/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f10b6db8a931de62c5205aefcbb9ba9eece291b --- /dev/null +++ b/codenet/public_test_cases/p01045/output.0.txt @@ -0,0 +1 @@ +Chieno diff --git a/codenet/public_test_cases/p01045/output.1.txt b/codenet/public_test_cases/p01045/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f10b6db8a931de62c5205aefcbb9ba9eece291b --- /dev/null +++ b/codenet/public_test_cases/p01045/output.1.txt @@ -0,0 +1 @@ +Chieno diff --git a/codenet/public_test_cases/p01045/output.2.txt b/codenet/public_test_cases/p01045/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a24d2f28c071c24f9b990ecf481d7c6896fdb9f --- /dev/null +++ b/codenet/public_test_cases/p01045/output.2.txt @@ -0,0 +1 @@ +Cacao diff --git a/codenet/public_test_cases/p01046/input.0.txt b/codenet/public_test_cases/p01046/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e685b5e2ee232b1ef7269f8f60f510201f43398 --- /dev/null +++ b/codenet/public_test_cases/p01046/input.0.txt @@ -0,0 +1,5 @@ +3 3 1 10 +@0. +... +... +0 100 diff --git a/codenet/public_test_cases/p01046/input.1.txt b/codenet/public_test_cases/p01046/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b3ed9ca6f7c099c2c925f1fbd1b2240357d2f4e --- /dev/null +++ b/codenet/public_test_cases/p01046/input.1.txt @@ -0,0 +1,5 @@ +3 3 1 10 +@#b +.#. +.#. +b 100 diff --git a/codenet/public_test_cases/p01046/input.2.txt b/codenet/public_test_cases/p01046/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..293671de848fa94d5050522caae61b2ba8714a36 --- /dev/null +++ b/codenet/public_test_cases/p01046/input.2.txt @@ -0,0 +1,5 @@ +3 3 1 20 +@*C +..* +... +C 10 diff --git a/codenet/public_test_cases/p01046/input.3.txt b/codenet/public_test_cases/p01046/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e685b5e2ee232b1ef7269f8f60f510201f43398 --- /dev/null +++ b/codenet/public_test_cases/p01046/input.3.txt @@ -0,0 +1,5 @@ +3 3 1 10 +@0. +... +... +0 100 diff --git a/codenet/public_test_cases/p01046/output.0.txt b/codenet/public_test_cases/p01046/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p01046/output.0.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p01046/output.1.txt b/codenet/public_test_cases/p01046/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01046/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01046/output.2.txt b/codenet/public_test_cases/p01046/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01046/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01046/output.3.txt b/codenet/public_test_cases/p01046/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p01046/output.3.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p01047/input.0.txt b/codenet/public_test_cases/p01047/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..294a1c78bf86dc56473e2f65c2297d7bb3088d52 --- /dev/null +++ b/codenet/public_test_cases/p01047/input.0.txt @@ -0,0 +1,3 @@ +2 1 +1 2 +5 0 0 diff --git a/codenet/public_test_cases/p01047/output.0.txt b/codenet/public_test_cases/p01047/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01047/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01048/input.0.txt b/codenet/public_test_cases/p01048/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01048/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01048/input.1.txt b/codenet/public_test_cases/p01048/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01048/input.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01048/input.2.txt b/codenet/public_test_cases/p01048/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01048/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01048/input.3.txt b/codenet/public_test_cases/p01048/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01048/input.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01048/output.0.txt b/codenet/public_test_cases/p01048/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01048/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01048/output.1.txt b/codenet/public_test_cases/p01048/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01048/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01048/output.2.txt b/codenet/public_test_cases/p01048/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01048/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01048/output.3.txt b/codenet/public_test_cases/p01048/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01048/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01049/input.0.txt b/codenet/public_test_cases/p01049/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..806dc2531e4f939d8117e86987fb85bb9af9f4bb --- /dev/null +++ b/codenet/public_test_cases/p01049/input.0.txt @@ -0,0 +1,7 @@ +5 +2 3 +3 +0 2 5 +0 3 5 +1 2 4 +2 diff --git a/codenet/public_test_cases/p01049/input.1.txt b/codenet/public_test_cases/p01049/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..441cd54c0481460b6debcf8ce2cd158acfd170f6 --- /dev/null +++ b/codenet/public_test_cases/p01049/input.1.txt @@ -0,0 +1,8 @@ +6 +5 5 +4 +0 1 2 +1 1 2 +0 4 1 +1 1 6 +3 diff --git a/codenet/public_test_cases/p01049/input.2.txt b/codenet/public_test_cases/p01049/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..806dc2531e4f939d8117e86987fb85bb9af9f4bb --- /dev/null +++ b/codenet/public_test_cases/p01049/input.2.txt @@ -0,0 +1,7 @@ +5 +2 3 +3 +0 2 5 +0 3 5 +1 2 4 +2 diff --git a/codenet/public_test_cases/p01049/output.0.txt b/codenet/public_test_cases/p01049/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01049/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01049/output.1.txt b/codenet/public_test_cases/p01049/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01049/output.1.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01049/output.2.txt b/codenet/public_test_cases/p01049/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01049/output.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01050/input.0.txt b/codenet/public_test_cases/p01050/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7bd7af3062fd4ddf5ecec42c19213487bea7d3a --- /dev/null +++ b/codenet/public_test_cases/p01050/input.0.txt @@ -0,0 +1 @@ +0ig3he12fz99 diff --git a/codenet/public_test_cases/p01050/input.1.txt b/codenet/public_test_cases/p01050/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7bd7af3062fd4ddf5ecec42c19213487bea7d3a --- /dev/null +++ b/codenet/public_test_cases/p01050/input.1.txt @@ -0,0 +1 @@ +0ig3he12fz99 diff --git a/codenet/public_test_cases/p01050/input.2.txt b/codenet/public_test_cases/p01050/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c4af41619703a4d59e8a45db2a60984f91179bb --- /dev/null +++ b/codenet/public_test_cases/p01050/input.2.txt @@ -0,0 +1 @@ +1122334455 diff --git a/codenet/public_test_cases/p01050/output.0.txt b/codenet/public_test_cases/p01050/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01050/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01050/output.1.txt b/codenet/public_test_cases/p01050/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01050/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01050/output.2.txt b/codenet/public_test_cases/p01050/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01050/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01051/input.0.txt b/codenet/public_test_cases/p01051/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..584fd19e3af5c74d5d52822172195fe804175438 --- /dev/null +++ b/codenet/public_test_cases/p01051/input.0.txt @@ -0,0 +1,6 @@ +5 5 +S.... +..... +..... +..... +....G diff --git a/codenet/public_test_cases/p01051/input.1.txt b/codenet/public_test_cases/p01051/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aedcf17287086c28f66dcc571c7e6288b920c7e0 --- /dev/null +++ b/codenet/public_test_cases/p01051/input.1.txt @@ -0,0 +1,5 @@ +4 5 +S#... +.#.#. +.#.#. +...#G diff --git a/codenet/public_test_cases/p01051/input.2.txt b/codenet/public_test_cases/p01051/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..311267d82d0252dd15cbf2630fa62519298e1549 --- /dev/null +++ b/codenet/public_test_cases/p01051/input.2.txt @@ -0,0 +1,6 @@ +5 5 +Sxxxx +xxxxx +xxxxx +xxxxx +xxxxG diff --git a/codenet/public_test_cases/p01051/input.3.txt b/codenet/public_test_cases/p01051/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..855248f11974e109237a8b9178ab8d4bae352d51 --- /dev/null +++ b/codenet/public_test_cases/p01051/input.3.txt @@ -0,0 +1,5 @@ +4 5 +S#ooo +o#o#o +o#o#o +ooo#G diff --git a/codenet/public_test_cases/p01051/input.4.txt b/codenet/public_test_cases/p01051/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..584fd19e3af5c74d5d52822172195fe804175438 --- /dev/null +++ b/codenet/public_test_cases/p01051/input.4.txt @@ -0,0 +1,6 @@ +5 5 +S.... +..... +..... +..... +....G diff --git a/codenet/public_test_cases/p01051/input.5.txt b/codenet/public_test_cases/p01051/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f649e22ea471a429828c2cb6cfab017b2e2477c --- /dev/null +++ b/codenet/public_test_cases/p01051/input.5.txt @@ -0,0 +1,5 @@ +4 5 +G#### +ooxoo +x#o +Soooo diff --git a/codenet/public_test_cases/p01051/output.0.txt b/codenet/public_test_cases/p01051/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01051/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01051/output.1.txt b/codenet/public_test_cases/p01051/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p01051/output.1.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p01051/output.2.txt b/codenet/public_test_cases/p01051/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01051/output.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01051/output.3.txt b/codenet/public_test_cases/p01051/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01051/output.3.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01051/output.4.txt b/codenet/public_test_cases/p01051/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01051/output.4.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01051/output.5.txt b/codenet/public_test_cases/p01051/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01051/output.5.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01052/input.0.txt b/codenet/public_test_cases/p01052/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b09859e0dc2f624b91ff09b77719da7b7747db47 --- /dev/null +++ b/codenet/public_test_cases/p01052/input.0.txt @@ -0,0 +1,5 @@ +4 +1 31 +2 2 +2 3 +3 3 diff --git a/codenet/public_test_cases/p01052/input.1.txt b/codenet/public_test_cases/p01052/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b09859e0dc2f624b91ff09b77719da7b7747db47 --- /dev/null +++ b/codenet/public_test_cases/p01052/input.1.txt @@ -0,0 +1,5 @@ +4 +1 31 +2 2 +2 3 +3 3 diff --git a/codenet/public_test_cases/p01052/input.2.txt b/codenet/public_test_cases/p01052/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba40e6bf70aa48ef6f3e9b8c2afc301cfa8e1c92 --- /dev/null +++ b/codenet/public_test_cases/p01052/input.2.txt @@ -0,0 +1,6 @@ +5 +1 10 +10 20 +20 21 +22 31 +4 20 diff --git a/codenet/public_test_cases/p01052/output.0.txt b/codenet/public_test_cases/p01052/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9eea8f079dcc914d9ddbaf169fc05433d03a862 --- /dev/null +++ b/codenet/public_test_cases/p01052/output.0.txt @@ -0,0 +1 @@ +1700 diff --git a/codenet/public_test_cases/p01052/output.1.txt b/codenet/public_test_cases/p01052/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9eea8f079dcc914d9ddbaf169fc05433d03a862 --- /dev/null +++ b/codenet/public_test_cases/p01052/output.1.txt @@ -0,0 +1 @@ +1700 diff --git a/codenet/public_test_cases/p01052/output.2.txt b/codenet/public_test_cases/p01052/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb08106db05e908c6bca41665d2f6d746dd9f9ac --- /dev/null +++ b/codenet/public_test_cases/p01052/output.2.txt @@ -0,0 +1 @@ +1800 diff --git a/codenet/public_test_cases/p01053/input.0.txt b/codenet/public_test_cases/p01053/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e02b3fef23a3b1de39ae093f2d039150b86d45d9 --- /dev/null +++ b/codenet/public_test_cases/p01053/input.0.txt @@ -0,0 +1,11 @@ +6 3 1 10 +0 1 0 +0 2 0 +0 3 0 +1 3 3 +0 2 1 +2 2 2 +2 3 2 +2 2 0 +1 1 1 +2 2 1 diff --git a/codenet/public_test_cases/p01053/input.1.txt b/codenet/public_test_cases/p01053/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e02b3fef23a3b1de39ae093f2d039150b86d45d9 --- /dev/null +++ b/codenet/public_test_cases/p01053/input.1.txt @@ -0,0 +1,11 @@ +6 3 1 10 +0 1 0 +0 2 0 +0 3 0 +1 3 3 +0 2 1 +2 2 2 +2 3 2 +2 2 0 +1 1 1 +2 2 1 diff --git a/codenet/public_test_cases/p01053/output.0.txt b/codenet/public_test_cases/p01053/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8120fd0948e74c7095d0df823d8b41920fb0ba5a --- /dev/null +++ b/codenet/public_test_cases/p01053/output.0.txt @@ -0,0 +1,10 @@ +1 +3 +9 +9 +0 +3 +9 +3 +1 +0 diff --git a/codenet/public_test_cases/p01053/output.1.txt b/codenet/public_test_cases/p01053/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8120fd0948e74c7095d0df823d8b41920fb0ba5a --- /dev/null +++ b/codenet/public_test_cases/p01053/output.1.txt @@ -0,0 +1,10 @@ +1 +3 +9 +9 +0 +3 +9 +3 +1 +0 diff --git a/codenet/public_test_cases/p01054/input.0.txt b/codenet/public_test_cases/p01054/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdce47caa488b8cd3ce07fa99d9816b98b6227d5 --- /dev/null +++ b/codenet/public_test_cases/p01054/input.0.txt @@ -0,0 +1,3 @@ +3 +abc +xyz diff --git a/codenet/public_test_cases/p01054/input.1.txt b/codenet/public_test_cases/p01054/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdce47caa488b8cd3ce07fa99d9816b98b6227d5 --- /dev/null +++ b/codenet/public_test_cases/p01054/input.1.txt @@ -0,0 +1,3 @@ +3 +abc +xyz diff --git a/codenet/public_test_cases/p01054/input.2.txt b/codenet/public_test_cases/p01054/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..381fb646ab6394cda36ba8491c6f0cfa3b101648 --- /dev/null +++ b/codenet/public_test_cases/p01054/input.2.txt @@ -0,0 +1,3 @@ +5 +aaabb +xyxyz diff --git a/codenet/public_test_cases/p01054/output.0.txt b/codenet/public_test_cases/p01054/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01054/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01054/output.1.txt b/codenet/public_test_cases/p01054/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01054/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01054/output.2.txt b/codenet/public_test_cases/p01054/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01054/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01055/input.0.txt b/codenet/public_test_cases/p01055/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e2eb69ade31b1a42ac539bd27c43f679ec8cde1 --- /dev/null +++ b/codenet/public_test_cases/p01055/input.0.txt @@ -0,0 +1,3 @@ +2 2 1 +2 1 +3 1 1 1 2 2 2 diff --git a/codenet/public_test_cases/p01055/input.1.txt b/codenet/public_test_cases/p01055/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94c25c1e6cd549c108dfaa9a11416b53e4a0277a --- /dev/null +++ b/codenet/public_test_cases/p01055/input.1.txt @@ -0,0 +1,3 @@ +3 3 1 +2 2 +2 2 2 2 1 diff --git a/codenet/public_test_cases/p01055/input.2.txt b/codenet/public_test_cases/p01055/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e0e4e31c7ea0080bd1c2fe7c7913de1bb4e1f50 --- /dev/null +++ b/codenet/public_test_cases/p01055/input.2.txt @@ -0,0 +1,3 @@ +2 2 1 +2 1 +2 1 1 1 2 diff --git a/codenet/public_test_cases/p01055/input.3.txt b/codenet/public_test_cases/p01055/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e2eb69ade31b1a42ac539bd27c43f679ec8cde1 --- /dev/null +++ b/codenet/public_test_cases/p01055/input.3.txt @@ -0,0 +1,3 @@ +2 2 1 +2 1 +3 1 1 1 2 2 2 diff --git a/codenet/public_test_cases/p01055/input.4.txt b/codenet/public_test_cases/p01055/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b62ebe736a0af50db20c86eaf420e6e206803007 --- /dev/null +++ b/codenet/public_test_cases/p01055/input.4.txt @@ -0,0 +1,4 @@ +3 3 2 +1 3 +3 2 3 2 2 2 1 +5 2 1 1 1 1 2 2 2 3 2 diff --git a/codenet/public_test_cases/p01055/output.0.txt b/codenet/public_test_cases/p01055/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01055/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01055/output.1.txt b/codenet/public_test_cases/p01055/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01055/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01055/output.2.txt b/codenet/public_test_cases/p01055/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01055/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01055/output.3.txt b/codenet/public_test_cases/p01055/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01055/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01055/output.4.txt b/codenet/public_test_cases/p01055/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01055/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01056/input.0.txt b/codenet/public_test_cases/p01056/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..44d5f0a71e160542eb308030eaad6ca0ef61c482 --- /dev/null +++ b/codenet/public_test_cases/p01056/input.0.txt @@ -0,0 +1,2 @@ +3 1 +0 4 diff --git a/codenet/public_test_cases/p01056/input.1.txt b/codenet/public_test_cases/p01056/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..345e7cc849aa3f48d25485c523ec1540cfc24e2d --- /dev/null +++ b/codenet/public_test_cases/p01056/input.1.txt @@ -0,0 +1,3 @@ +3 2 +2 2 +2 3 diff --git a/codenet/public_test_cases/p01056/input.2.txt b/codenet/public_test_cases/p01056/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..44d5f0a71e160542eb308030eaad6ca0ef61c482 --- /dev/null +++ b/codenet/public_test_cases/p01056/input.2.txt @@ -0,0 +1,2 @@ +3 1 +0 4 diff --git a/codenet/public_test_cases/p01056/output.0.txt b/codenet/public_test_cases/p01056/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p01056/output.0.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p01056/output.1.txt b/codenet/public_test_cases/p01056/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01056/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01056/output.2.txt b/codenet/public_test_cases/p01056/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p01056/output.2.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p01057/input.0.txt b/codenet/public_test_cases/p01057/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d06614baffc45ad967d4769e655e34d89a772af --- /dev/null +++ b/codenet/public_test_cases/p01057/input.0.txt @@ -0,0 +1,4 @@ +2 1 +abcd +efgh +1 1 2 2 3 diff --git a/codenet/public_test_cases/p01057/input.1.txt b/codenet/public_test_cases/p01057/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d06614baffc45ad967d4769e655e34d89a772af --- /dev/null +++ b/codenet/public_test_cases/p01057/input.1.txt @@ -0,0 +1,4 @@ +2 1 +abcd +efgh +1 1 2 2 3 diff --git a/codenet/public_test_cases/p01057/input.2.txt b/codenet/public_test_cases/p01057/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d89bec949d654e241b6033023236b65b4ab32dd --- /dev/null +++ b/codenet/public_test_cases/p01057/input.2.txt @@ -0,0 +1,6 @@ +2 3 +abcd +efgh +1 1 2 2 3 +2 1 3 x +2 2 4 x diff --git a/codenet/public_test_cases/p01057/input.3.txt b/codenet/public_test_cases/p01057/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..180ffeb84e027cd3218d0ba528fa5f5d1586d868 --- /dev/null +++ b/codenet/public_test_cases/p01057/input.3.txt @@ -0,0 +1,21 @@ +10 10 +sjcvpauokb +fmeaowomscy +sepeqqfcosrjmonfsv +zapc +aromazjzqoeiqswvcaf +clifpa +dusudcz +qeqdzdtdzlkhc +gkpsjvdvadmf +xrtyxnkolluagwxp +1 4 4 6 3 +1 7 1 8 1 +2 2 6 o +1 4 4 3 7 +2 1 2 i +1 6 3 3 2 +1 6 5 1 9 +2 10 9 j +1 2 2 7 3 +2 3 2 b diff --git a/codenet/public_test_cases/p01057/output.0.txt b/codenet/public_test_cases/p01057/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..615c145e1d4214cacfa3db0740bc484eb42395a2 --- /dev/null +++ b/codenet/public_test_cases/p01057/output.0.txt @@ -0,0 +1,2 @@ +agh +efbcd diff --git a/codenet/public_test_cases/p01057/output.1.txt b/codenet/public_test_cases/p01057/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..615c145e1d4214cacfa3db0740bc484eb42395a2 --- /dev/null +++ b/codenet/public_test_cases/p01057/output.1.txt @@ -0,0 +1,2 @@ +agh +efbcd diff --git a/codenet/public_test_cases/p01057/output.2.txt b/codenet/public_test_cases/p01057/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..96edd04f7eed331e0972adee33c1b4945bf3d311 --- /dev/null +++ b/codenet/public_test_cases/p01057/output.2.txt @@ -0,0 +1,2 @@ +agx +efbxd diff --git a/codenet/public_test_cases/p01057/output.3.txt b/codenet/public_test_cases/p01057/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc333a7547a9cdcc38ee271f0ebfb344e5308e36 --- /dev/null +++ b/codenet/public_test_cases/p01057/output.3.txt @@ -0,0 +1,10 @@ +sicvpauoeqqifpa +fqdzdtdzlkhc +sb +zapfcosrjmonfsv +aromazjzqoeiqswvcaf +clepkb +qemeaooomscy +dusudcz +gkpsjvdvadmf +xrtyxnkojluagwxp diff --git a/codenet/public_test_cases/p01058/input.0.txt b/codenet/public_test_cases/p01058/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0008eb3f6e552b4c1490e57e83fc6760ac9ba2d --- /dev/null +++ b/codenet/public_test_cases/p01058/input.0.txt @@ -0,0 +1 @@ +2 2 0 0 0 1 diff --git a/codenet/public_test_cases/p01058/input.1.txt b/codenet/public_test_cases/p01058/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0008eb3f6e552b4c1490e57e83fc6760ac9ba2d --- /dev/null +++ b/codenet/public_test_cases/p01058/input.1.txt @@ -0,0 +1 @@ +2 2 0 0 0 1 diff --git a/codenet/public_test_cases/p01058/input.2.txt b/codenet/public_test_cases/p01058/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a736c77baffd0d8deff9bacc9e5772c6b3b7d287 --- /dev/null +++ b/codenet/public_test_cases/p01058/input.2.txt @@ -0,0 +1 @@ +3 2 1 0 0 0 diff --git a/codenet/public_test_cases/p01058/output.0.txt b/codenet/public_test_cases/p01058/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01058/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01058/output.1.txt b/codenet/public_test_cases/p01058/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01058/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01058/output.2.txt b/codenet/public_test_cases/p01058/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01058/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01059/input.0.txt b/codenet/public_test_cases/p01059/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01e1eb3dc73c7c5ad813adbcec6427b9aaf0a39a --- /dev/null +++ b/codenet/public_test_cases/p01059/input.0.txt @@ -0,0 +1,2 @@ +3 2 +1 3 diff --git a/codenet/public_test_cases/p01059/input.1.txt b/codenet/public_test_cases/p01059/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d082dc5970808de0259d6425d901708b602e4d18 --- /dev/null +++ b/codenet/public_test_cases/p01059/input.1.txt @@ -0,0 +1,2 @@ +10 3 +2 5 7 diff --git a/codenet/public_test_cases/p01059/input.2.txt b/codenet/public_test_cases/p01059/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d5e12a89a8834ce635d71bc7831890e6693a4e7 --- /dev/null +++ b/codenet/public_test_cases/p01059/input.2.txt @@ -0,0 +1,2 @@ +100000 1 +1 diff --git a/codenet/public_test_cases/p01059/input.3.txt b/codenet/public_test_cases/p01059/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4f52b8f6461d406437886ebf9379e46b51778fb --- /dev/null +++ b/codenet/public_test_cases/p01059/input.3.txt @@ -0,0 +1,2 @@ +10 5 +2 5 6 8 10 diff --git a/codenet/public_test_cases/p01059/input.4.txt b/codenet/public_test_cases/p01059/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..01e1eb3dc73c7c5ad813adbcec6427b9aaf0a39a --- /dev/null +++ b/codenet/public_test_cases/p01059/input.4.txt @@ -0,0 +1,2 @@ +3 2 +1 3 diff --git a/codenet/public_test_cases/p01059/output.0.txt b/codenet/public_test_cases/p01059/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01059/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01059/output.1.txt b/codenet/public_test_cases/p01059/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01059/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01059/output.2.txt b/codenet/public_test_cases/p01059/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..90ef1ea404f5aeb59bc233448c4e724c91f3fff8 --- /dev/null +++ b/codenet/public_test_cases/p01059/output.2.txt @@ -0,0 +1 @@ +99999 diff --git a/codenet/public_test_cases/p01059/output.3.txt b/codenet/public_test_cases/p01059/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01059/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01059/output.4.txt b/codenet/public_test_cases/p01059/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01059/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01060/input.0.txt b/codenet/public_test_cases/p01060/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..03ae260cff4af88bed167ec100f62e084bdb46ee --- /dev/null +++ b/codenet/public_test_cases/p01060/input.0.txt @@ -0,0 +1,3 @@ +11 11 +5 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01060/input.1.txt b/codenet/public_test_cases/p01060/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03ae260cff4af88bed167ec100f62e084bdb46ee --- /dev/null +++ b/codenet/public_test_cases/p01060/input.1.txt @@ -0,0 +1,3 @@ +11 11 +5 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01060/input.2.txt b/codenet/public_test_cases/p01060/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2993a5a2495cbb9c874d1ef02acaf4feddf2c01c --- /dev/null +++ b/codenet/public_test_cases/p01060/input.2.txt @@ -0,0 +1,3 @@ +11 11 +5 +0 0 1 1 1 diff --git a/codenet/public_test_cases/p01060/output.0.txt b/codenet/public_test_cases/p01060/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01060/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01060/output.1.txt b/codenet/public_test_cases/p01060/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01060/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01060/output.2.txt b/codenet/public_test_cases/p01060/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01060/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01061/input.0.txt b/codenet/public_test_cases/p01061/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fa34b26edbf5a028e89c0ad87b196b184ac114a --- /dev/null +++ b/codenet/public_test_cases/p01061/input.0.txt @@ -0,0 +1,2 @@ +3 1 +1 2 diff --git a/codenet/public_test_cases/p01061/input.1.txt b/codenet/public_test_cases/p01061/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2310894e6580b3c491ef5a783bbc55ea17774df --- /dev/null +++ b/codenet/public_test_cases/p01061/input.1.txt @@ -0,0 +1,3 @@ +4 2 +1 4 +2 3 diff --git a/codenet/public_test_cases/p01061/input.2.txt b/codenet/public_test_cases/p01061/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e846a7c6282b3642ed86ac23209829f4a4a48586 --- /dev/null +++ b/codenet/public_test_cases/p01061/input.2.txt @@ -0,0 +1 @@ +5 0 diff --git a/codenet/public_test_cases/p01061/input.3.txt b/codenet/public_test_cases/p01061/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..75655a92a759224497f519a03cd42cfcd806ba1b --- /dev/null +++ b/codenet/public_test_cases/p01061/input.3.txt @@ -0,0 +1,6 @@ +10 5 +3 4 +1 2 +9 6 +2 6 +2 9 diff --git a/codenet/public_test_cases/p01061/input.4.txt b/codenet/public_test_cases/p01061/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fa34b26edbf5a028e89c0ad87b196b184ac114a --- /dev/null +++ b/codenet/public_test_cases/p01061/input.4.txt @@ -0,0 +1,2 @@ +3 1 +1 2 diff --git a/codenet/public_test_cases/p01061/input.5.txt b/codenet/public_test_cases/p01061/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..57b9c358b596a57fe065011680d481a8d16e7691 --- /dev/null +++ b/codenet/public_test_cases/p01061/input.5.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01061/input.6.txt b/codenet/public_test_cases/p01061/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p01061/input.6.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p01061/input.7.txt b/codenet/public_test_cases/p01061/input.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2541fa8c8f4122ab63ae35baf61e4f58826c484 --- /dev/null +++ b/codenet/public_test_cases/p01061/input.7.txt @@ -0,0 +1,5 @@ +5 4 +1 2 +2 3 +3 4 +4 5 diff --git a/codenet/public_test_cases/p01061/output.0.txt b/codenet/public_test_cases/p01061/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01061/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01061/output.1.txt b/codenet/public_test_cases/p01061/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01061/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01061/output.2.txt b/codenet/public_test_cases/p01061/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01061/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01061/output.3.txt b/codenet/public_test_cases/p01061/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01061/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01061/output.4.txt b/codenet/public_test_cases/p01061/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01061/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01061/output.5.txt b/codenet/public_test_cases/p01061/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01061/output.5.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01061/output.6.txt b/codenet/public_test_cases/p01061/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01061/output.6.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01061/output.7.txt b/codenet/public_test_cases/p01061/output.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01061/output.7.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01062/input.0.txt b/codenet/public_test_cases/p01062/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..629655e7d3be0789a713920d65d98e399e909085 --- /dev/null +++ b/codenet/public_test_cases/p01062/input.0.txt @@ -0,0 +1,4 @@ +4 1 4 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p01062/input.1.txt b/codenet/public_test_cases/p01062/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..44cd3f9b8eac52defdc6fc48ed7635d8db3660fc --- /dev/null +++ b/codenet/public_test_cases/p01062/input.1.txt @@ -0,0 +1,4 @@ +4 2 3 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p01062/input.2.txt b/codenet/public_test_cases/p01062/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e1b74484c8adbf26268723de13a3a8b0cf954fa --- /dev/null +++ b/codenet/public_test_cases/p01062/input.2.txt @@ -0,0 +1,6 @@ +6 1 5 +1 2 +1 4 +2 3 +4 5 +3 6 diff --git a/codenet/public_test_cases/p01062/input.3.txt b/codenet/public_test_cases/p01062/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..43a4fb333b43a38cacb630fa1a688c64d7197f31 --- /dev/null +++ b/codenet/public_test_cases/p01062/input.3.txt @@ -0,0 +1,8 @@ +8 3 6 +1 2 +2 4 +3 4 +4 5 +5 6 +6 7 +7 8 diff --git a/codenet/public_test_cases/p01062/input.4.txt b/codenet/public_test_cases/p01062/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..629655e7d3be0789a713920d65d98e399e909085 --- /dev/null +++ b/codenet/public_test_cases/p01062/input.4.txt @@ -0,0 +1,4 @@ +4 1 4 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p01062/output.0.txt b/codenet/public_test_cases/p01062/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01062/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01062/output.1.txt b/codenet/public_test_cases/p01062/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01062/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01062/output.2.txt b/codenet/public_test_cases/p01062/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01062/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01062/output.3.txt b/codenet/public_test_cases/p01062/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01062/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01062/output.4.txt b/codenet/public_test_cases/p01062/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01062/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01063/input.0.txt b/codenet/public_test_cases/p01063/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5cb7437c2f62713a090322f8f157aaea959cc21 --- /dev/null +++ b/codenet/public_test_cases/p01063/input.0.txt @@ -0,0 +1,3 @@ +3 +0 0 0 +1 2 2 diff --git a/codenet/public_test_cases/p01063/input.1.txt b/codenet/public_test_cases/p01063/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4cee505bdd0d9ba3c94e75d1d0c2f7227c1452a4 --- /dev/null +++ b/codenet/public_test_cases/p01063/input.1.txt @@ -0,0 +1,3 @@ +3 +0 0 0 +0 0 2 diff --git a/codenet/public_test_cases/p01063/input.2.txt b/codenet/public_test_cases/p01063/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5cb7437c2f62713a090322f8f157aaea959cc21 --- /dev/null +++ b/codenet/public_test_cases/p01063/input.2.txt @@ -0,0 +1,3 @@ +3 +0 0 0 +1 2 2 diff --git a/codenet/public_test_cases/p01063/output.0.txt b/codenet/public_test_cases/p01063/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01063/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01063/output.1.txt b/codenet/public_test_cases/p01063/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01063/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01063/output.2.txt b/codenet/public_test_cases/p01063/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01063/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01064/input.0.txt b/codenet/public_test_cases/p01064/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4378ea45ea06e1509b7d21fb81f5a7e3f40603ad --- /dev/null +++ b/codenet/public_test_cases/p01064/input.0.txt @@ -0,0 +1,7 @@ +4 +2 1 +3 +0 1 2 +1 1 4 +2 2 4 +3 diff --git a/codenet/public_test_cases/p01064/input.1.txt b/codenet/public_test_cases/p01064/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f16755edb69d29e4b5c1708956feb850a7763f5 --- /dev/null +++ b/codenet/public_test_cases/p01064/input.1.txt @@ -0,0 +1,7 @@ +5 +1 2 +3 +1 2 3 +2 3 5 +0 1 5 +1 diff --git a/codenet/public_test_cases/p01064/input.2.txt b/codenet/public_test_cases/p01064/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4378ea45ea06e1509b7d21fb81f5a7e3f40603ad --- /dev/null +++ b/codenet/public_test_cases/p01064/input.2.txt @@ -0,0 +1,7 @@ +4 +2 1 +3 +0 1 2 +1 1 4 +2 2 4 +3 diff --git a/codenet/public_test_cases/p01064/output.0.txt b/codenet/public_test_cases/p01064/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01064/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01064/output.1.txt b/codenet/public_test_cases/p01064/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01064/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01064/output.2.txt b/codenet/public_test_cases/p01064/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01064/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01065/input.0.txt b/codenet/public_test_cases/p01065/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ffa7bf56300dcf55d673632c6f82c0f40885723 --- /dev/null +++ b/codenet/public_test_cases/p01065/input.0.txt @@ -0,0 +1,5 @@ +3 +3 3 +3 2 4 1 +5 1 2 1 +3 1 3 2 diff --git a/codenet/public_test_cases/p01065/input.1.txt b/codenet/public_test_cases/p01065/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1cf4b0aa44d8ad06c4b25bd70b4bc640428d8075 --- /dev/null +++ b/codenet/public_test_cases/p01065/input.1.txt @@ -0,0 +1,6 @@ +4 +5 0 +5 1 1 1 +2 1 2 1 +4 1 1 1 +3 1 3 1 diff --git a/codenet/public_test_cases/p01065/input.2.txt b/codenet/public_test_cases/p01065/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ffa7bf56300dcf55d673632c6f82c0f40885723 --- /dev/null +++ b/codenet/public_test_cases/p01065/input.2.txt @@ -0,0 +1,5 @@ +3 +3 3 +3 2 4 1 +5 1 2 1 +3 1 3 2 diff --git a/codenet/public_test_cases/p01065/input.3.txt b/codenet/public_test_cases/p01065/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9dae2db87f8808795d3c23f3d3b4758be9966614 --- /dev/null +++ b/codenet/public_test_cases/p01065/input.3.txt @@ -0,0 +1,5 @@ +3 +3 4 +3 1 3 1 +3 1 4 1 +3 1 2 1 diff --git a/codenet/public_test_cases/p01065/input.4.txt b/codenet/public_test_cases/p01065/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2a09bcdaa469ddc9c7c4c77f0efcf1025f18133 --- /dev/null +++ b/codenet/public_test_cases/p01065/input.4.txt @@ -0,0 +1,6 @@ +4 +0 0 +1 10 1 10 +2 5 2 5 +3 25 5 6 +1 15 2 20 diff --git a/codenet/public_test_cases/p01065/output.0.txt b/codenet/public_test_cases/p01065/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01065/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01065/output.1.txt b/codenet/public_test_cases/p01065/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01065/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01065/output.2.txt b/codenet/public_test_cases/p01065/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01065/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01065/output.3.txt b/codenet/public_test_cases/p01065/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01065/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01065/output.4.txt b/codenet/public_test_cases/p01065/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01065/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01066/input.0.txt b/codenet/public_test_cases/p01066/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea858fa58f0a5657638c17a89379c3474218e764 --- /dev/null +++ b/codenet/public_test_cases/p01066/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 +0 1 +1 0 diff --git a/codenet/public_test_cases/p01066/input.1.txt b/codenet/public_test_cases/p01066/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c027162d921993a5ec30c1fba0edbfc43e972690 --- /dev/null +++ b/codenet/public_test_cases/p01066/input.1.txt @@ -0,0 +1,5 @@ +4 +0 0 +0 1 +0 2 +0 3 diff --git a/codenet/public_test_cases/p01066/input.2.txt b/codenet/public_test_cases/p01066/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea858fa58f0a5657638c17a89379c3474218e764 --- /dev/null +++ b/codenet/public_test_cases/p01066/input.2.txt @@ -0,0 +1,4 @@ +3 +0 0 +0 1 +1 0 diff --git a/codenet/public_test_cases/p01066/output.0.txt b/codenet/public_test_cases/p01066/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01066/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01066/output.1.txt b/codenet/public_test_cases/p01066/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01066/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01066/output.2.txt b/codenet/public_test_cases/p01066/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01066/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01067/input.0.txt b/codenet/public_test_cases/p01067/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fa6faeda85b79030b0ccef36f5e393bc3fbaa8c --- /dev/null +++ b/codenet/public_test_cases/p01067/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 2 +3 3 1 +6 1 1 diff --git a/codenet/public_test_cases/p01067/input.1.txt b/codenet/public_test_cases/p01067/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d67bed923816600c6afc67fbe615bac3f6ebf91 --- /dev/null +++ b/codenet/public_test_cases/p01067/input.1.txt @@ -0,0 +1,6 @@ +5 +0 0 5 +0 10 1 +10 0 1 +-10 0 1 +0 -10 1 diff --git a/codenet/public_test_cases/p01067/input.2.txt b/codenet/public_test_cases/p01067/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..28747460b143dfaeb3711227cabb9c25d4492c0c --- /dev/null +++ b/codenet/public_test_cases/p01067/input.2.txt @@ -0,0 +1,5 @@ +4 +1 2 3 +12 2 2 +7 6 2 +1 9 3 diff --git a/codenet/public_test_cases/p01067/input.3.txt b/codenet/public_test_cases/p01067/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fa6faeda85b79030b0ccef36f5e393bc3fbaa8c --- /dev/null +++ b/codenet/public_test_cases/p01067/input.3.txt @@ -0,0 +1,4 @@ +3 +0 0 2 +3 3 1 +6 1 1 diff --git a/codenet/public_test_cases/p01067/output.0.txt b/codenet/public_test_cases/p01067/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01067/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01067/output.1.txt b/codenet/public_test_cases/p01067/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01067/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01067/output.2.txt b/codenet/public_test_cases/p01067/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01067/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01067/output.3.txt b/codenet/public_test_cases/p01067/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01067/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01068/input.0.txt b/codenet/public_test_cases/p01068/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..889b446b2a61af35eb3faffade49fbddecbbcbca --- /dev/null +++ b/codenet/public_test_cases/p01068/input.0.txt @@ -0,0 +1,4 @@ +2 1 +0 0 1 +0 1 0 +0 diff --git a/codenet/public_test_cases/p01068/input.1.txt b/codenet/public_test_cases/p01068/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9163fae5e18aeb09cacebd164d4cfbcb22b84cb3 --- /dev/null +++ b/codenet/public_test_cases/p01068/input.1.txt @@ -0,0 +1,13 @@ +6 6 +0 1 5 +1 1 1 +0 1 5 +0 2 1 +0 5 1 +1 5 5 +0 +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p01068/input.2.txt b/codenet/public_test_cases/p01068/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..889b446b2a61af35eb3faffade49fbddecbbcbca --- /dev/null +++ b/codenet/public_test_cases/p01068/input.2.txt @@ -0,0 +1,4 @@ +2 1 +0 0 1 +0 1 0 +0 diff --git a/codenet/public_test_cases/p01068/output.0.txt b/codenet/public_test_cases/p01068/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01068/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01068/output.1.txt b/codenet/public_test_cases/p01068/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..880ebd048330c374e8b01d539e1d3e8a9adbe166 --- /dev/null +++ b/codenet/public_test_cases/p01068/output.1.txt @@ -0,0 +1,6 @@ +3 +2 +3 +1 +3 +2 diff --git a/codenet/public_test_cases/p01068/output.2.txt b/codenet/public_test_cases/p01068/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01068/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01069/input.0.txt b/codenet/public_test_cases/p01069/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b4be63c8ac4934b5fa31db03d4e725075a564e --- /dev/null +++ b/codenet/public_test_cases/p01069/input.0.txt @@ -0,0 +1,4 @@ +3 3 1 +1 2 3 +3 1 2 +3 diff --git a/codenet/public_test_cases/p01069/input.1.txt b/codenet/public_test_cases/p01069/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b4be63c8ac4934b5fa31db03d4e725075a564e --- /dev/null +++ b/codenet/public_test_cases/p01069/input.1.txt @@ -0,0 +1,4 @@ +3 3 1 +1 2 3 +3 1 2 +3 diff --git a/codenet/public_test_cases/p01069/input.2.txt b/codenet/public_test_cases/p01069/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ff387dbde98245c64c8dae925de883850e8b2ec --- /dev/null +++ b/codenet/public_test_cases/p01069/input.2.txt @@ -0,0 +1,5 @@ +5 4 2 +1 2 3 4 5 +2 2 2 2 +11 +12 diff --git a/codenet/public_test_cases/p01069/output.0.txt b/codenet/public_test_cases/p01069/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01069/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01069/output.1.txt b/codenet/public_test_cases/p01069/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01069/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01069/output.2.txt b/codenet/public_test_cases/p01069/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b94473479cd96f84ea5fdd389a9f4f9d3786b8c1 --- /dev/null +++ b/codenet/public_test_cases/p01069/output.2.txt @@ -0,0 +1,2 @@ +3 +4 diff --git a/codenet/public_test_cases/p01070/input.0.txt b/codenet/public_test_cases/p01070/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..036d3873a2e6ba15c4a1d4bd894d5e2376bc3379 --- /dev/null +++ b/codenet/public_test_cases/p01070/input.0.txt @@ -0,0 +1,6 @@ +rupcrupc 5 +0 3 rupc +0 7 rupc +2 7 ru +2 7 pc +1 5 u diff --git a/codenet/public_test_cases/p01070/input.1.txt b/codenet/public_test_cases/p01070/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b15721aa2b3a152af5eb963c9c4d99f04402e748 --- /dev/null +++ b/codenet/public_test_cases/p01070/input.1.txt @@ -0,0 +1,6 @@ +aaaaaaaaaa 5 +0 9 aaa +0 9 aa +5 9 aaaa +2 8 aa +1 2 a diff --git a/codenet/public_test_cases/p01070/input.2.txt b/codenet/public_test_cases/p01070/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..036d3873a2e6ba15c4a1d4bd894d5e2376bc3379 --- /dev/null +++ b/codenet/public_test_cases/p01070/input.2.txt @@ -0,0 +1,6 @@ +rupcrupc 5 +0 3 rupc +0 7 rupc +2 7 ru +2 7 pc +1 5 u diff --git a/codenet/public_test_cases/p01070/input.3.txt b/codenet/public_test_cases/p01070/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ea84e3c8f59e6e585542cab9d98775de8a2fa96 --- /dev/null +++ b/codenet/public_test_cases/p01070/input.3.txt @@ -0,0 +1,9 @@ +abatagaadbura 8 +0 6 a +6 12 a +0 6 aa +0 3 a +3 5 a +5 9 a +1 8 b +1 12 b diff --git a/codenet/public_test_cases/p01070/output.0.txt b/codenet/public_test_cases/p01070/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..128dde7896d82e5bf2d86ff8e526f848808c91c4 --- /dev/null +++ b/codenet/public_test_cases/p01070/output.0.txt @@ -0,0 +1,5 @@ +1 +2 +1 +2 +2 diff --git a/codenet/public_test_cases/p01070/output.1.txt b/codenet/public_test_cases/p01070/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..211598b9afbef02dbc65c64a1d678d2381cc4de8 --- /dev/null +++ b/codenet/public_test_cases/p01070/output.1.txt @@ -0,0 +1,5 @@ +8 +9 +2 +6 +2 diff --git a/codenet/public_test_cases/p01070/output.2.txt b/codenet/public_test_cases/p01070/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..128dde7896d82e5bf2d86ff8e526f848808c91c4 --- /dev/null +++ b/codenet/public_test_cases/p01070/output.2.txt @@ -0,0 +1,5 @@ +1 +2 +1 +2 +2 diff --git a/codenet/public_test_cases/p01070/output.3.txt b/codenet/public_test_cases/p01070/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5a7202b7ab42d40baa7ce09bde51f3a07afc2c2 --- /dev/null +++ b/codenet/public_test_cases/p01070/output.3.txt @@ -0,0 +1,8 @@ +4 +3 +0 +2 +1 +2 +1 +2 diff --git a/codenet/public_test_cases/p01071/input.0.txt b/codenet/public_test_cases/p01071/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09389fe17b1a95d21a245a7164fd54a52d2f1b7a --- /dev/null +++ b/codenet/public_test_cases/p01071/input.0.txt @@ -0,0 +1,7 @@ +5 4 +5 +1 1 3 3 +3 2 4 2 +4 3 5 4 +1 4 5 4 +4 1 4 1 diff --git a/codenet/public_test_cases/p01071/input.1.txt b/codenet/public_test_cases/p01071/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09389fe17b1a95d21a245a7164fd54a52d2f1b7a --- /dev/null +++ b/codenet/public_test_cases/p01071/input.1.txt @@ -0,0 +1,7 @@ +5 4 +5 +1 1 3 3 +3 2 4 2 +4 3 5 4 +1 4 5 4 +4 1 4 1 diff --git a/codenet/public_test_cases/p01071/output.0.txt b/codenet/public_test_cases/p01071/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f662d9ddfdee314291ff8eedf5d64e8c59395192 --- /dev/null +++ b/codenet/public_test_cases/p01071/output.0.txt @@ -0,0 +1,5 @@ +9 +9 +13 +13 +14 diff --git a/codenet/public_test_cases/p01071/output.1.txt b/codenet/public_test_cases/p01071/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f662d9ddfdee314291ff8eedf5d64e8c59395192 --- /dev/null +++ b/codenet/public_test_cases/p01071/output.1.txt @@ -0,0 +1,5 @@ +9 +9 +13 +13 +14 diff --git a/codenet/public_test_cases/p01072/input.0.txt b/codenet/public_test_cases/p01072/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a679e0c915ab5cdda15e732033701ccb05d014bc --- /dev/null +++ b/codenet/public_test_cases/p01072/input.0.txt @@ -0,0 +1,10 @@ +3 3 3 +5 +2 0 0 +0 1 0 +1 1 1 +1 2 1 +2 2 0 +0 0 0 +0 1 0 +0 0 0 diff --git a/codenet/public_test_cases/p01072/input.1.txt b/codenet/public_test_cases/p01072/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a04d6a1c5e0d9969923e5e8f725f06a17e57609d --- /dev/null +++ b/codenet/public_test_cases/p01072/input.1.txt @@ -0,0 +1,7 @@ +2 3 4 +2 +0 0 0 +1 1 3 +1 0 +0 0 +0 0 diff --git a/codenet/public_test_cases/p01072/input.2.txt b/codenet/public_test_cases/p01072/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..89761367e70a6d7852168cf90d7c18fdd42a7174 --- /dev/null +++ b/codenet/public_test_cases/p01072/input.2.txt @@ -0,0 +1,16 @@ +3 8 6 +6 +0 4 3 +2 5 3 +0 2 3 +2 2 5 +1 1 3 +2 2 1 +1 1 1 +1 1 1 +1 1 1 +1 0 1 +0 1 1 +1 1 0 +1 0 1 +0 1 0 diff --git a/codenet/public_test_cases/p01072/input.3.txt b/codenet/public_test_cases/p01072/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d353efb79b7fcc96e1771cdea4a5d8c4c398f2a --- /dev/null +++ b/codenet/public_test_cases/p01072/input.3.txt @@ -0,0 +1,12 @@ +8 3 3 +7 +0 1 1 +5 1 0 +4 0 2 +3 2 0 +3 1 1 +3 0 1 +5 1 1 +1 0 1 1 0 0 1 0 +0 0 1 1 0 1 0 1 +0 1 0 0 0 1 0 1 diff --git a/codenet/public_test_cases/p01072/input.4.txt b/codenet/public_test_cases/p01072/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a679e0c915ab5cdda15e732033701ccb05d014bc --- /dev/null +++ b/codenet/public_test_cases/p01072/input.4.txt @@ -0,0 +1,10 @@ +3 3 3 +5 +2 0 0 +0 1 0 +1 1 1 +1 2 1 +2 2 0 +0 0 0 +0 1 0 +0 0 0 diff --git a/codenet/public_test_cases/p01072/output.0.txt b/codenet/public_test_cases/p01072/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01072/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01072/output.1.txt b/codenet/public_test_cases/p01072/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01072/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01072/output.2.txt b/codenet/public_test_cases/p01072/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01072/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01072/output.3.txt b/codenet/public_test_cases/p01072/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01072/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01072/output.4.txt b/codenet/public_test_cases/p01072/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01072/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01073/input.0.txt b/codenet/public_test_cases/p01073/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e508b5b3ef1a68e6e9ea837079d9fa5a8f04ab5 --- /dev/null +++ b/codenet/public_test_cases/p01073/input.0.txt @@ -0,0 +1,3 @@ +5 100 3 +2 3 4 5 6 +50 40 20 10 5 diff --git a/codenet/public_test_cases/p01073/input.1.txt b/codenet/public_test_cases/p01073/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e508b5b3ef1a68e6e9ea837079d9fa5a8f04ab5 --- /dev/null +++ b/codenet/public_test_cases/p01073/input.1.txt @@ -0,0 +1,3 @@ +5 100 3 +2 3 4 5 6 +50 40 20 10 5 diff --git a/codenet/public_test_cases/p01073/input.2.txt b/codenet/public_test_cases/p01073/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..829bf1388c8cda23a2a009ee51d8077bb14b2de0 --- /dev/null +++ b/codenet/public_test_cases/p01073/input.2.txt @@ -0,0 +1,3 @@ +5 100 3 +2 3 4 5 100 +50 40 20 10 1 diff --git a/codenet/public_test_cases/p01073/output.0.txt b/codenet/public_test_cases/p01073/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b1c1312820bf5617d09108d59f960ecb19cc8ac --- /dev/null +++ b/codenet/public_test_cases/p01073/output.0.txt @@ -0,0 +1 @@ +280 diff --git a/codenet/public_test_cases/p01073/output.1.txt b/codenet/public_test_cases/p01073/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b1c1312820bf5617d09108d59f960ecb19cc8ac --- /dev/null +++ b/codenet/public_test_cases/p01073/output.1.txt @@ -0,0 +1 @@ +280 diff --git a/codenet/public_test_cases/p01073/output.2.txt b/codenet/public_test_cases/p01073/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ce6b02d782bd9e4200abe5d3bdc752070c3c517 --- /dev/null +++ b/codenet/public_test_cases/p01073/output.2.txt @@ -0,0 +1 @@ +339 diff --git a/codenet/public_test_cases/p01074/input.0.txt b/codenet/public_test_cases/p01074/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99565f3385300a6100e391870aca9086168d627a --- /dev/null +++ b/codenet/public_test_cases/p01074/input.0.txt @@ -0,0 +1,8 @@ +3 7 3 +0 1 1 1 +0 1 1 2 +1 1 3 4 +1 1 1 1 +1 2 1 2 +2 1 1 3 +2 2 2 1 diff --git a/codenet/public_test_cases/p01074/input.1.txt b/codenet/public_test_cases/p01074/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99565f3385300a6100e391870aca9086168d627a --- /dev/null +++ b/codenet/public_test_cases/p01074/input.1.txt @@ -0,0 +1,8 @@ +3 7 3 +0 1 1 1 +0 1 1 2 +1 1 3 4 +1 1 1 1 +1 2 1 2 +2 1 1 3 +2 2 2 1 diff --git a/codenet/public_test_cases/p01074/input.2.txt b/codenet/public_test_cases/p01074/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..286830a56f8d87eef30d9540b90caa4f8c271dc2 --- /dev/null +++ b/codenet/public_test_cases/p01074/input.2.txt @@ -0,0 +1,11 @@ +5 10 5 +0 1 1 2 +0 2 1 2 +0 1 2 3 +1 2 1 2 +1 4 2 3 +2 1 1 1 +2 1 1 2 +3 3 2 3 +4 1 1 2 +4 2 1 2 diff --git a/codenet/public_test_cases/p01074/output.0.txt b/codenet/public_test_cases/p01074/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01074/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01074/output.1.txt b/codenet/public_test_cases/p01074/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01074/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01074/output.2.txt b/codenet/public_test_cases/p01074/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p01074/output.2.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p01075/input.0.txt b/codenet/public_test_cases/p01075/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb2f243d19d9cae5f280bbab8e7d8fd92baad6e8 --- /dev/null +++ b/codenet/public_test_cases/p01075/input.0.txt @@ -0,0 +1,3 @@ +3 2 +1 2 10 +2 3 20 diff --git a/codenet/public_test_cases/p01075/input.1.txt b/codenet/public_test_cases/p01075/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5e75a7e6aa042f51d5acb1a9733bc914d024cdd --- /dev/null +++ b/codenet/public_test_cases/p01075/input.1.txt @@ -0,0 +1,3 @@ +3 2 +1 2 20 +2 3 10 diff --git a/codenet/public_test_cases/p01075/input.2.txt b/codenet/public_test_cases/p01075/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..18bdf2a3da9c6dadb41d5e5993f890ac46755635 --- /dev/null +++ b/codenet/public_test_cases/p01075/input.2.txt @@ -0,0 +1,5 @@ +4 4 +1 2 27 +1 3 37 +2 3 47 +3 1 57 diff --git a/codenet/public_test_cases/p01075/input.3.txt b/codenet/public_test_cases/p01075/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb2f243d19d9cae5f280bbab8e7d8fd92baad6e8 --- /dev/null +++ b/codenet/public_test_cases/p01075/input.3.txt @@ -0,0 +1,3 @@ +3 2 +1 2 10 +2 3 20 diff --git a/codenet/public_test_cases/p01075/input.4.txt b/codenet/public_test_cases/p01075/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b764578e6c23af6e20fd2106aac0625dfa4d2f1 --- /dev/null +++ b/codenet/public_test_cases/p01075/input.4.txt @@ -0,0 +1,3 @@ +3 2 +1 2 10 +2 3 10 diff --git a/codenet/public_test_cases/p01075/input.5.txt b/codenet/public_test_cases/p01075/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..f08786f615c2200be90d8de521893dcc302b40e8 --- /dev/null +++ b/codenet/public_test_cases/p01075/input.5.txt @@ -0,0 +1,4 @@ +3 3 +1 2 13 +2 3 17 +2 3 15 diff --git a/codenet/public_test_cases/p01075/output.0.txt b/codenet/public_test_cases/p01075/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p01075/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p01075/output.1.txt b/codenet/public_test_cases/p01075/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01075/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01075/output.2.txt b/codenet/public_test_cases/p01075/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01075/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01075/output.3.txt b/codenet/public_test_cases/p01075/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p01075/output.3.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p01075/output.4.txt b/codenet/public_test_cases/p01075/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01075/output.4.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01075/output.5.txt b/codenet/public_test_cases/p01075/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p01075/output.5.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p01076/input.0.txt b/codenet/public_test_cases/p01076/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p01076/input.0.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p01076/input.1.txt b/codenet/public_test_cases/p01076/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..805e7f5a05abb0767d277398dd810d64910d282f --- /dev/null +++ b/codenet/public_test_cases/p01076/input.1.txt @@ -0,0 +1 @@ +4 2 diff --git a/codenet/public_test_cases/p01076/input.2.txt b/codenet/public_test_cases/p01076/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c3e36b56c13943c0b4452e45c0f58d406a76285 --- /dev/null +++ b/codenet/public_test_cases/p01076/input.2.txt @@ -0,0 +1 @@ +5 1 diff --git a/codenet/public_test_cases/p01076/input.3.txt b/codenet/public_test_cases/p01076/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p01076/input.3.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p01076/output.0.txt b/codenet/public_test_cases/p01076/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01076/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01076/output.1.txt b/codenet/public_test_cases/p01076/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01076/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01076/output.2.txt b/codenet/public_test_cases/p01076/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01076/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01076/output.3.txt b/codenet/public_test_cases/p01076/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01076/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01077/input.0.txt b/codenet/public_test_cases/p01077/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9254fb5e238a7cfd4ca254934d7ebeceb6a641bb --- /dev/null +++ b/codenet/public_test_cases/p01077/input.0.txt @@ -0,0 +1,2 @@ +1 10 +o........@ diff --git a/codenet/public_test_cases/p01077/input.1.txt b/codenet/public_test_cases/p01077/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b8bf7fb06c09e5ffd7608fda20732691a47714c --- /dev/null +++ b/codenet/public_test_cases/p01077/input.1.txt @@ -0,0 +1,4 @@ +3 6 +...... +.o..@. +...... diff --git a/codenet/public_test_cases/p01077/input.2.txt b/codenet/public_test_cases/p01077/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcd41549dc43c5896d85ec6c9fe067a901f83753 --- /dev/null +++ b/codenet/public_test_cases/p01077/input.2.txt @@ -0,0 +1,7 @@ +6 4 +.... +.oo. +.oo. +.... +.@.. +.... diff --git a/codenet/public_test_cases/p01077/input.3.txt b/codenet/public_test_cases/p01077/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9254fb5e238a7cfd4ca254934d7ebeceb6a641bb --- /dev/null +++ b/codenet/public_test_cases/p01077/input.3.txt @@ -0,0 +1,2 @@ +1 10 +o........@ diff --git a/codenet/public_test_cases/p01077/output.0.txt b/codenet/public_test_cases/p01077/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p01077/output.0.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p01077/output.1.txt b/codenet/public_test_cases/p01077/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p01077/output.1.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p01077/output.2.txt b/codenet/public_test_cases/p01077/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p01077/output.2.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p01077/output.3.txt b/codenet/public_test_cases/p01077/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p01077/output.3.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p01078/input.0.txt b/codenet/public_test_cases/p01078/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p01078/input.0.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p01078/input.1.txt b/codenet/public_test_cases/p01078/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c69a2a059f23a72f2508e7b0e321371a28eb8fb7 --- /dev/null +++ b/codenet/public_test_cases/p01078/input.1.txt @@ -0,0 +1 @@ +100000 3 diff --git a/codenet/public_test_cases/p01078/input.2.txt b/codenet/public_test_cases/p01078/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..13786522932ed94919370205cbb84d301c1c3499 --- /dev/null +++ b/codenet/public_test_cases/p01078/input.2.txt @@ -0,0 +1 @@ +20 3 diff --git a/codenet/public_test_cases/p01078/input.3.txt b/codenet/public_test_cases/p01078/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f036e7ba038ea9020e90a29f669ac3db830dd66 --- /dev/null +++ b/codenet/public_test_cases/p01078/input.3.txt @@ -0,0 +1 @@ +7 3 diff --git a/codenet/public_test_cases/p01078/input.4.txt b/codenet/public_test_cases/p01078/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p01078/input.4.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p01078/output.0.txt b/codenet/public_test_cases/p01078/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a2e611db0f0e715f6ccae730d468da3be927d1b --- /dev/null +++ b/codenet/public_test_cases/p01078/output.0.txt @@ -0,0 +1 @@ +1.12256994 diff --git a/codenet/public_test_cases/p01078/output.1.txt b/codenet/public_test_cases/p01078/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2f0ccc68873eceed7b493b7e539d6ae19f83203 --- /dev/null +++ b/codenet/public_test_cases/p01078/output.1.txt @@ -0,0 +1 @@ +3.14159265 diff --git a/codenet/public_test_cases/p01078/output.2.txt b/codenet/public_test_cases/p01078/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4389715ced1d7c2aec24adfdd248e6f16ffbe10f --- /dev/null +++ b/codenet/public_test_cases/p01078/output.2.txt @@ -0,0 +1 @@ +2.93114293 diff --git a/codenet/public_test_cases/p01078/output.3.txt b/codenet/public_test_cases/p01078/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6e0d1df3b6acbb5ab92954d59c7b345f9777cdd --- /dev/null +++ b/codenet/public_test_cases/p01078/output.3.txt @@ -0,0 +1 @@ +1.08395920 diff --git a/codenet/public_test_cases/p01078/output.4.txt b/codenet/public_test_cases/p01078/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a2e611db0f0e715f6ccae730d468da3be927d1b --- /dev/null +++ b/codenet/public_test_cases/p01078/output.4.txt @@ -0,0 +1 @@ +1.12256994 diff --git a/codenet/public_test_cases/p01079/input.0.txt b/codenet/public_test_cases/p01079/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6b32806e63d65ce3478fc0f2950fb51a7dee8c3 --- /dev/null +++ b/codenet/public_test_cases/p01079/input.0.txt @@ -0,0 +1,6 @@ +5 4 40 +0 1 1 1 0 +1 2 5 +2 3 5 +3 4 5 +4 5 5 diff --git a/codenet/public_test_cases/p01079/input.1.txt b/codenet/public_test_cases/p01079/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7c9a9c6774af32303b3d98f27ade62a668295d3 --- /dev/null +++ b/codenet/public_test_cases/p01079/input.1.txt @@ -0,0 +1,6 @@ +5 4 50 +0 1 1 10 0 +1 2 10 +2 3 10 +2 4 10 +4 5 10 diff --git a/codenet/public_test_cases/p01079/input.2.txt b/codenet/public_test_cases/p01079/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6b32806e63d65ce3478fc0f2950fb51a7dee8c3 --- /dev/null +++ b/codenet/public_test_cases/p01079/input.2.txt @@ -0,0 +1,6 @@ +5 4 40 +0 1 1 1 0 +1 2 5 +2 3 5 +3 4 5 +4 5 5 diff --git a/codenet/public_test_cases/p01079/input.3.txt b/codenet/public_test_cases/p01079/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd2fa306c07407331410bde32ff0b2b75fb46f82 --- /dev/null +++ b/codenet/public_test_cases/p01079/input.3.txt @@ -0,0 +1,5 @@ +4 3 100 +0 3 1 0 +1 2 5 +2 3 30 +3 4 5 diff --git a/codenet/public_test_cases/p01079/output.0.txt b/codenet/public_test_cases/p01079/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01079/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01079/output.1.txt b/codenet/public_test_cases/p01079/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p01079/output.1.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p01079/output.2.txt b/codenet/public_test_cases/p01079/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01079/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01079/output.3.txt b/codenet/public_test_cases/p01079/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p01079/output.3.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p01080/input.0.txt b/codenet/public_test_cases/p01080/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p01080/input.0.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p01080/input.1.txt b/codenet/public_test_cases/p01080/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b002149a43b17d23d74efb6535e90c2ba0cc53ea --- /dev/null +++ b/codenet/public_test_cases/p01080/input.1.txt @@ -0,0 +1,6 @@ +6 +1 2 +1 3 +3 4 +3 5 +5 6 diff --git a/codenet/public_test_cases/p01080/input.2.txt b/codenet/public_test_cases/p01080/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p01080/input.2.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p01080/output.0.txt b/codenet/public_test_cases/p01080/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p01080/output.0.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p01080/output.1.txt b/codenet/public_test_cases/p01080/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e587d298ab8fd27e4815bba1f42f347c0da5edc --- /dev/null +++ b/codenet/public_test_cases/p01080/output.1.txt @@ -0,0 +1,6 @@ +7 +6 +8 +7 +7 +6 diff --git a/codenet/public_test_cases/p01080/output.2.txt b/codenet/public_test_cases/p01080/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p01080/output.2.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p01081/input.0.txt b/codenet/public_test_cases/p01081/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d73f4a01eab55c1ad6db28331e0262c69a76d7e --- /dev/null +++ b/codenet/public_test_cases/p01081/input.0.txt @@ -0,0 +1 @@ +acca diff --git a/codenet/public_test_cases/p01081/input.1.txt b/codenet/public_test_cases/p01081/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d73f4a01eab55c1ad6db28331e0262c69a76d7e --- /dev/null +++ b/codenet/public_test_cases/p01081/input.1.txt @@ -0,0 +1 @@ +acca diff --git a/codenet/public_test_cases/p01081/input.2.txt b/codenet/public_test_cases/p01081/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b4665e2a8f6fe3f9032253e7a2e86da103aebcc --- /dev/null +++ b/codenet/public_test_cases/p01081/input.2.txt @@ -0,0 +1 @@ +acpcacpc diff --git a/codenet/public_test_cases/p01081/input.3.txt b/codenet/public_test_cases/p01081/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7a4fbd9f02df7bd987d8bbfff727b9436610eea --- /dev/null +++ b/codenet/public_test_cases/p01081/input.3.txt @@ -0,0 +1 @@ +aizu diff --git a/codenet/public_test_cases/p01081/output.0.txt b/codenet/public_test_cases/p01081/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01081/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01081/output.1.txt b/codenet/public_test_cases/p01081/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01081/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01081/output.2.txt b/codenet/public_test_cases/p01081/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01081/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01081/output.3.txt b/codenet/public_test_cases/p01081/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01081/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01082/input.0.txt b/codenet/public_test_cases/p01082/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d868a6723ff8527e5c96f72c30b665fb569eaee --- /dev/null +++ b/codenet/public_test_cases/p01082/input.0.txt @@ -0,0 +1,2 @@ +20 10 1 +0 0 diff --git a/codenet/public_test_cases/p01082/input.1.txt b/codenet/public_test_cases/p01082/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d868a6723ff8527e5c96f72c30b665fb569eaee --- /dev/null +++ b/codenet/public_test_cases/p01082/input.1.txt @@ -0,0 +1,2 @@ +20 10 1 +0 0 diff --git a/codenet/public_test_cases/p01082/input.2.txt b/codenet/public_test_cases/p01082/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6d881751b30f4339dfa34b979b114cb95e50239 --- /dev/null +++ b/codenet/public_test_cases/p01082/input.2.txt @@ -0,0 +1,3 @@ +20 10 2 +0 0 +17 5 diff --git a/codenet/public_test_cases/p01082/input.3.txt b/codenet/public_test_cases/p01082/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd2fc7b06d0f05196270ed7671ce5811ff250ea3 --- /dev/null +++ b/codenet/public_test_cases/p01082/input.3.txt @@ -0,0 +1,4 @@ +20 10 3 +0 0 +17 5 +6 9 diff --git a/codenet/public_test_cases/p01082/output.0.txt b/codenet/public_test_cases/p01082/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9902f17848a8974ab57d57999b74a63198fe6e23 --- /dev/null +++ b/codenet/public_test_cases/p01082/output.0.txt @@ -0,0 +1 @@ +28 diff --git a/codenet/public_test_cases/p01082/output.1.txt b/codenet/public_test_cases/p01082/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9902f17848a8974ab57d57999b74a63198fe6e23 --- /dev/null +++ b/codenet/public_test_cases/p01082/output.1.txt @@ -0,0 +1 @@ +28 diff --git a/codenet/public_test_cases/p01082/output.2.txt b/codenet/public_test_cases/p01082/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01082/output.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01082/output.3.txt b/codenet/public_test_cases/p01082/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01082/output.3.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01083/input.0.txt b/codenet/public_test_cases/p01083/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8054fa6c307fef07a39829b1d5f391e958e4538d --- /dev/null +++ b/codenet/public_test_cases/p01083/input.0.txt @@ -0,0 +1,7 @@ +2 +3 3 2 +8 3 2 +0 3 +3 7 +8 0 +8 7 diff --git a/codenet/public_test_cases/p01083/input.1.txt b/codenet/public_test_cases/p01083/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b46dfe9a84d441bcd3c95819301848cac28a0ce0 --- /dev/null +++ b/codenet/public_test_cases/p01083/input.1.txt @@ -0,0 +1,7 @@ +2 +3 3 2 +8 3 2 +3 0 +3 7 +8 0 +8 7 diff --git a/codenet/public_test_cases/p01083/input.2.txt b/codenet/public_test_cases/p01083/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8054fa6c307fef07a39829b1d5f391e958e4538d --- /dev/null +++ b/codenet/public_test_cases/p01083/input.2.txt @@ -0,0 +1,7 @@ +2 +3 3 2 +8 3 2 +0 3 +3 7 +8 0 +8 7 diff --git a/codenet/public_test_cases/p01083/input.3.txt b/codenet/public_test_cases/p01083/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9268787e79f8a5c931dac4fa1597640a5058a20 --- /dev/null +++ b/codenet/public_test_cases/p01083/input.3.txt @@ -0,0 +1,5 @@ +1 +10 10 10 +31 10 10 +15 19 +26 1 diff --git a/codenet/public_test_cases/p01083/input.4.txt b/codenet/public_test_cases/p01083/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..281e7444e1ee034706b3891dfbece0049139f514 --- /dev/null +++ b/codenet/public_test_cases/p01083/input.4.txt @@ -0,0 +1,7 @@ +2 +3 3 2 +8 3 2 +0 0 +0 5 +11 0 +11 5 diff --git a/codenet/public_test_cases/p01083/output.0.txt b/codenet/public_test_cases/p01083/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b86ad468934ad4478c253bfc07aa0ef978c43e48 --- /dev/null +++ b/codenet/public_test_cases/p01083/output.0.txt @@ -0,0 +1 @@ +13.8190642862 diff --git a/codenet/public_test_cases/p01083/output.1.txt b/codenet/public_test_cases/p01083/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31f007a37d6576182ea4296f8bb330a9416475fa --- /dev/null +++ b/codenet/public_test_cases/p01083/output.1.txt @@ -0,0 +1 @@ +10.0000000000 diff --git a/codenet/public_test_cases/p01083/output.2.txt b/codenet/public_test_cases/p01083/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b86ad468934ad4478c253bfc07aa0ef978c43e48 --- /dev/null +++ b/codenet/public_test_cases/p01083/output.2.txt @@ -0,0 +1 @@ +13.8190642862 diff --git a/codenet/public_test_cases/p01083/output.3.txt b/codenet/public_test_cases/p01083/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p01083/output.3.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p01083/output.4.txt b/codenet/public_test_cases/p01083/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a39d631d3a81abdaa984c25e324b955748ffdbd0 --- /dev/null +++ b/codenet/public_test_cases/p01083/output.4.txt @@ -0,0 +1 @@ +22.0000000000 diff --git a/codenet/public_test_cases/p01084/input.0.txt b/codenet/public_test_cases/p01084/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb9a61b2b57340c7349cd3dc5a2c70467ccb3392 --- /dev/null +++ b/codenet/public_test_cases/p01084/input.0.txt @@ -0,0 +1,2 @@ +1 +0111f diff --git a/codenet/public_test_cases/p01084/input.1.txt b/codenet/public_test_cases/p01084/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..789d2b15421449da7af4abd1a4bfdb4b0d9f8734 --- /dev/null +++ b/codenet/public_test_cases/p01084/input.1.txt @@ -0,0 +1,4 @@ +3 +57567 +57587 +0d351 diff --git a/codenet/public_test_cases/p01084/input.2.txt b/codenet/public_test_cases/p01084/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb9a61b2b57340c7349cd3dc5a2c70467ccb3392 --- /dev/null +++ b/codenet/public_test_cases/p01084/input.2.txt @@ -0,0 +1,2 @@ +1 +0111f diff --git a/codenet/public_test_cases/p01084/input.3.txt b/codenet/public_test_cases/p01084/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec7ecb6e13d01ae157b99a3443792f1b93a2f40b --- /dev/null +++ b/codenet/public_test_cases/p01084/input.3.txt @@ -0,0 +1,7 @@ +6 +1811b +1a11b +f3b1e +f3b1c +b0df3 +bedf3 diff --git a/codenet/public_test_cases/p01084/output.0.txt b/codenet/public_test_cases/p01084/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb9a61b2b57340c7349cd3dc5a2c70467ccb3392 --- /dev/null +++ b/codenet/public_test_cases/p01084/output.0.txt @@ -0,0 +1,2 @@ +1 +0111f diff --git a/codenet/public_test_cases/p01084/output.1.txt b/codenet/public_test_cases/p01084/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3ca12f676704e5d5a1232fb952e5647dc0e2266 --- /dev/null +++ b/codenet/public_test_cases/p01084/output.1.txt @@ -0,0 +1,3 @@ +2 +0d351 +57577 diff --git a/codenet/public_test_cases/p01084/output.2.txt b/codenet/public_test_cases/p01084/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb9a61b2b57340c7349cd3dc5a2c70467ccb3392 --- /dev/null +++ b/codenet/public_test_cases/p01084/output.2.txt @@ -0,0 +1,2 @@ +1 +0111f diff --git a/codenet/public_test_cases/p01084/output.3.txt b/codenet/public_test_cases/p01084/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..488fbfa2fc5d6a3835e1be0576e037ed99c5a242 --- /dev/null +++ b/codenet/public_test_cases/p01084/output.3.txt @@ -0,0 +1,4 @@ +3 +1911b +bfdf3 +f3b1d diff --git a/codenet/public_test_cases/p01085/input.0.txt b/codenet/public_test_cases/p01085/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c93104021613eaaa182c05bf841c5041904c94c --- /dev/null +++ b/codenet/public_test_cases/p01085/input.0.txt @@ -0,0 +1,33 @@ +5 2 4 +100 +90 +82 +70 +65 +5 2 4 +100 +90 +80 +75 +65 +3 1 2 +5000 +4000 +3000 +4 2 3 +10000 +10000 +8000 +8000 +4 2 3 +10000 +10000 +10000 +8000 +5 2 3 +100 +80 +68 +60 +45 +0 0 0 diff --git a/codenet/public_test_cases/p01085/input.1.txt b/codenet/public_test_cases/p01085/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c93104021613eaaa182c05bf841c5041904c94c --- /dev/null +++ b/codenet/public_test_cases/p01085/input.1.txt @@ -0,0 +1,33 @@ +5 2 4 +100 +90 +82 +70 +65 +5 2 4 +100 +90 +80 +75 +65 +3 1 2 +5000 +4000 +3000 +4 2 3 +10000 +10000 +8000 +8000 +4 2 3 +10000 +10000 +10000 +8000 +5 2 3 +100 +80 +68 +60 +45 +0 0 0 diff --git a/codenet/public_test_cases/p01085/output.0.txt b/codenet/public_test_cases/p01085/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce913a2f1d9d163549c051febc1fb2d852ab694 --- /dev/null +++ b/codenet/public_test_cases/p01085/output.0.txt @@ -0,0 +1,6 @@ +3 +4 +2 +2 +3 +2 diff --git a/codenet/public_test_cases/p01085/output.1.txt b/codenet/public_test_cases/p01085/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce913a2f1d9d163549c051febc1fb2d852ab694 --- /dev/null +++ b/codenet/public_test_cases/p01085/output.1.txt @@ -0,0 +1,6 @@ +3 +4 +2 +2 +3 +2 diff --git a/codenet/public_test_cases/p01086/input.0.txt b/codenet/public_test_cases/p01086/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec8d263cbf326c09860a7adb44de1b3911c9010a --- /dev/null +++ b/codenet/public_test_cases/p01086/input.0.txt @@ -0,0 +1,42 @@ +9 +do +the +best +and +enjoy +today +at +acm +icpc +14 +oh +yes +by +far +it +is +wow +so +bad +to +me +you +know +hey +15 +abcde +fghijkl +mnopq +rstuvwx +yzz +abcde +fghijkl +mnopq +rstuvwx +yz +abcde +fghijkl +mnopq +rstuvwx +yz +0 diff --git a/codenet/public_test_cases/p01086/input.1.txt b/codenet/public_test_cases/p01086/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec8d263cbf326c09860a7adb44de1b3911c9010a --- /dev/null +++ b/codenet/public_test_cases/p01086/input.1.txt @@ -0,0 +1,42 @@ +9 +do +the +best +and +enjoy +today +at +acm +icpc +14 +oh +yes +by +far +it +is +wow +so +bad +to +me +you +know +hey +15 +abcde +fghijkl +mnopq +rstuvwx +yzz +abcde +fghijkl +mnopq +rstuvwx +yz +abcde +fghijkl +mnopq +rstuvwx +yz +0 diff --git a/codenet/public_test_cases/p01086/output.0.txt b/codenet/public_test_cases/p01086/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e47fd69325dd935eb530f94d9dbe48d312f5decf --- /dev/null +++ b/codenet/public_test_cases/p01086/output.0.txt @@ -0,0 +1,3 @@ +1 +2 +6 diff --git a/codenet/public_test_cases/p01086/output.1.txt b/codenet/public_test_cases/p01086/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e47fd69325dd935eb530f94d9dbe48d312f5decf --- /dev/null +++ b/codenet/public_test_cases/p01086/output.1.txt @@ -0,0 +1,3 @@ +1 +2 +6 diff --git a/codenet/public_test_cases/p01087/input.0.txt b/codenet/public_test_cases/p01087/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a90199a652aabc225259e0aa7dd9cad7e12112f --- /dev/null +++ b/codenet/public_test_cases/p01087/input.0.txt @@ -0,0 +1,29 @@ +1 +9 +4 ++ +.1 +.2 +.3 +9 ++ +.0 +.+ +..* +...1 +...* +....1 +....2 +..0 +10 ++ +.+ +..6 +..2 +.+ +..1 +..* +...7 +...6 +.3 +0 diff --git a/codenet/public_test_cases/p01087/input.1.txt b/codenet/public_test_cases/p01087/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a90199a652aabc225259e0aa7dd9cad7e12112f --- /dev/null +++ b/codenet/public_test_cases/p01087/input.1.txt @@ -0,0 +1,29 @@ +1 +9 +4 ++ +.1 +.2 +.3 +9 ++ +.0 +.+ +..* +...1 +...* +....1 +....2 +..0 +10 ++ +.+ +..6 +..2 +.+ +..1 +..* +...7 +...6 +.3 +0 diff --git a/codenet/public_test_cases/p01087/output.0.txt b/codenet/public_test_cases/p01087/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f88dda1b467ff16e98fa7ff6e2b2f9b74160a038 --- /dev/null +++ b/codenet/public_test_cases/p01087/output.0.txt @@ -0,0 +1,4 @@ +9 +6 +2 +54 diff --git a/codenet/public_test_cases/p01087/output.1.txt b/codenet/public_test_cases/p01087/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f88dda1b467ff16e98fa7ff6e2b2f9b74160a038 --- /dev/null +++ b/codenet/public_test_cases/p01087/output.1.txt @@ -0,0 +1,4 @@ +9 +6 +2 +54 diff --git a/codenet/public_test_cases/p01088/input.0.txt b/codenet/public_test_cases/p01088/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8222f5fafd472dfbc4e1de166b1304cb9f7f7e9 --- /dev/null +++ b/codenet/public_test_cases/p01088/input.0.txt @@ -0,0 +1,29 @@ +4 +800 +700 +1600 +600 +4 +300 +700 +1600 +600 +4 +300 +700 +1600 +650 +3 +1000 +2000 +500 +3 +250 +250 +1000 +4 +1251 +667 +876 +299 +0 diff --git a/codenet/public_test_cases/p01088/input.1.txt b/codenet/public_test_cases/p01088/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8222f5fafd472dfbc4e1de166b1304cb9f7f7e9 --- /dev/null +++ b/codenet/public_test_cases/p01088/input.1.txt @@ -0,0 +1,29 @@ +4 +800 +700 +1600 +600 +4 +300 +700 +1600 +600 +4 +300 +700 +1600 +650 +3 +1000 +2000 +500 +3 +250 +250 +1000 +4 +1251 +667 +876 +299 +0 diff --git a/codenet/public_test_cases/p01088/output.0.txt b/codenet/public_test_cases/p01088/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75507fc281f05e5262a385ad9657ea1628eb5bc4 --- /dev/null +++ b/codenet/public_test_cases/p01088/output.0.txt @@ -0,0 +1,6 @@ +2 2900 +3 2500 +3 3250 +1 500 +3 1500 +3 2217 diff --git a/codenet/public_test_cases/p01088/output.1.txt b/codenet/public_test_cases/p01088/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75507fc281f05e5262a385ad9657ea1628eb5bc4 --- /dev/null +++ b/codenet/public_test_cases/p01088/output.1.txt @@ -0,0 +1,6 @@ +2 2900 +3 2500 +3 3250 +1 500 +3 1500 +3 2217 diff --git a/codenet/public_test_cases/p01089/input.0.txt b/codenet/public_test_cases/p01089/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4d66fc9fb224585bd4c65a05aa59aea3fe58e8b --- /dev/null +++ b/codenet/public_test_cases/p01089/input.0.txt @@ -0,0 +1,13 @@ +11 +01u12u0123u +6 +01u10u +8 +201u210u +9 +01u12u20u +3 +77u +12 +9u8u845u954u +0 diff --git a/codenet/public_test_cases/p01089/input.1.txt b/codenet/public_test_cases/p01089/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4d66fc9fb224585bd4c65a05aa59aea3fe58e8b --- /dev/null +++ b/codenet/public_test_cases/p01089/input.1.txt @@ -0,0 +1,13 @@ +11 +01u12u0123u +6 +01u10u +8 +201u210u +9 +01u12u20u +3 +77u +12 +9u8u845u954u +0 diff --git a/codenet/public_test_cases/p01089/output.0.txt b/codenet/public_test_cases/p01089/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee8123bc2a800bff7f30c2342a772aec50d6db5c --- /dev/null +++ b/codenet/public_test_cases/p01089/output.0.txt @@ -0,0 +1,6 @@ +SAFE +UNSAFE +SAFE +UNSAFE +UNSAFE +UNSAFE diff --git a/codenet/public_test_cases/p01089/output.1.txt b/codenet/public_test_cases/p01089/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee8123bc2a800bff7f30c2342a772aec50d6db5c --- /dev/null +++ b/codenet/public_test_cases/p01089/output.1.txt @@ -0,0 +1,6 @@ +SAFE +UNSAFE +SAFE +UNSAFE +UNSAFE +UNSAFE diff --git a/codenet/public_test_cases/p01090/input.0.txt b/codenet/public_test_cases/p01090/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..855dfbc0a0e6e42027ba3ed5b1d6534e4fd7c3ea --- /dev/null +++ b/codenet/public_test_cases/p01090/input.0.txt @@ -0,0 +1,28 @@ +4 5 2 +1 2 2 A +1 3 2 A +1 4 2 A +2 3 1 B +3 4 1 B +5 8 2 +1 2 1 A +2 3 1 A +3 4 3 A +4 5 3 A +1 2 5 B +2 3 5 B +3 4 8 B +4 5 8 B +5 5 1 +1 2 1 A +2 3 1 A +3 4 1 A +4 5 1 B +3 5 1 B +4 5 3 +1 2 2 A +2 4 3 B +3 4 4 B +2 3 5 A +3 1 6 A +0 0 0 diff --git a/codenet/public_test_cases/p01090/input.1.txt b/codenet/public_test_cases/p01090/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..855dfbc0a0e6e42027ba3ed5b1d6534e4fd7c3ea --- /dev/null +++ b/codenet/public_test_cases/p01090/input.1.txt @@ -0,0 +1,28 @@ +4 5 2 +1 2 2 A +1 3 2 A +1 4 2 A +2 3 1 B +3 4 1 B +5 8 2 +1 2 1 A +2 3 1 A +3 4 3 A +4 5 3 A +1 2 5 B +2 3 5 B +3 4 8 B +4 5 8 B +5 5 1 +1 2 1 A +2 3 1 A +3 4 1 A +4 5 1 B +3 5 1 B +4 5 3 +1 2 2 A +2 4 3 B +3 4 4 B +2 3 5 A +3 1 6 A +0 0 0 diff --git a/codenet/public_test_cases/p01090/output.0.txt b/codenet/public_test_cases/p01090/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38afd1b0e8674afb3b96b6d870c61bd25f0aee73 --- /dev/null +++ b/codenet/public_test_cases/p01090/output.0.txt @@ -0,0 +1,4 @@ +5 +16 +-1 +-1 diff --git a/codenet/public_test_cases/p01090/output.1.txt b/codenet/public_test_cases/p01090/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38afd1b0e8674afb3b96b6d870c61bd25f0aee73 --- /dev/null +++ b/codenet/public_test_cases/p01090/output.1.txt @@ -0,0 +1,4 @@ +5 +16 +-1 +-1 diff --git a/codenet/public_test_cases/p01091/input.0.txt b/codenet/public_test_cases/p01091/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..782df0d1d6f8fa53a5df09e740187f10af29e074 --- /dev/null +++ b/codenet/public_test_cases/p01091/input.0.txt @@ -0,0 +1,59 @@ +4 +0 0 +10 0 +10 5 +0 5 +3 +5 0 +17 3 +7 10 +4 +0 5 +5 0 +10 0 +7 8 +4 +0 0 +40 0 +50 5 +0 5 +4 +0 0 +10 0 +20 5 +10 5 +7 +4 0 +20 0 +24 1 +22 10 +2 10 +0 6 +0 4 +18 +728 997 +117 996 +14 988 +1 908 +0 428 +2 98 +6 54 +30 28 +106 2 +746 1 +979 17 +997 25 +998 185 +999 573 +999 938 +995 973 +970 993 +910 995 +6 +0 40 +0 30 +10 0 +20 0 +40 70 +30 70 +0 diff --git a/codenet/public_test_cases/p01091/input.1.txt b/codenet/public_test_cases/p01091/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..782df0d1d6f8fa53a5df09e740187f10af29e074 --- /dev/null +++ b/codenet/public_test_cases/p01091/input.1.txt @@ -0,0 +1,59 @@ +4 +0 0 +10 0 +10 5 +0 5 +3 +5 0 +17 3 +7 10 +4 +0 5 +5 0 +10 0 +7 8 +4 +0 0 +40 0 +50 5 +0 5 +4 +0 0 +10 0 +20 5 +10 5 +7 +4 0 +20 0 +24 1 +22 10 +2 10 +0 6 +0 4 +18 +728 997 +117 996 +14 988 +1 908 +0 428 +2 98 +6 54 +30 28 +106 2 +746 1 +979 17 +997 25 +998 185 +999 573 +999 938 +995 973 +970 993 +910 995 +6 +0 40 +0 30 +10 0 +20 0 +40 70 +30 70 +0 diff --git a/codenet/public_test_cases/p01091/output.0.txt b/codenet/public_test_cases/p01091/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..16967545e565593825a95a68355448267418edce --- /dev/null +++ b/codenet/public_test_cases/p01091/output.0.txt @@ -0,0 +1,8 @@ +23.090170 +28.528295 +23.553450 +97.135255 +34.270510 +57.124116 +3327.900180 +142.111776 diff --git a/codenet/public_test_cases/p01091/output.1.txt b/codenet/public_test_cases/p01091/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..16967545e565593825a95a68355448267418edce --- /dev/null +++ b/codenet/public_test_cases/p01091/output.1.txt @@ -0,0 +1,8 @@ +23.090170 +28.528295 +23.553450 +97.135255 +34.270510 +57.124116 +3327.900180 +142.111776 diff --git a/codenet/public_test_cases/p01092/input.0.txt b/codenet/public_test_cases/p01092/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae1bd28b096f29c5868d5d5050e2375f374baeb3 --- /dev/null +++ b/codenet/public_test_cases/p01092/input.0.txt @@ -0,0 +1,82 @@ +2 +1 2 8 +1 1 1 +8 8 1 +3 3 3 3 2 +3 +3 2 3 +1 1 2 +1 1 2 +1 1 2 +1 1 1 1 2 +1 2 1 2 2 +2 1 2 1 2 +2 +2 3 100 +100 50 1 +1 50 3 +100 1 100 100 3 +1 1 1 100 2 +5 +6 7 60 +11 11 1 +11 51 1 +51 11 1 +51 51 1 +31 31 1 +11 11 51 51 2 +11 11 51 51 3 +11 11 51 51 4 +11 11 51 51 5 +18 1 54 42 6 +1 43 59 60 7 +5 +6 4 9 +5 5 3 +1 1 1 +1 9 1 +9 1 1 +9 9 1 +3 3 7 7 4 +4 4 6 6 2 +1 1 2 2 3 +1 8 2 9 3 +8 1 9 2 3 +8 8 9 9 3 +5 +10 5 50 +3 40 1 +29 13 2 +39 28 1 +50 50 1 +25 30 5 +3 5 10 10 2 +11 11 14 14 2 +15 15 20 23 2 +40 40 41 50 2 +1 49 3 50 2 +30 30 50 50 3 +1 1 10 10 4 +1 30 1 50 5 +20 30 20 50 5 +40 30 40 50 5 +15 +2 2 1000000 +514898 704203 1 +743530 769450 1 +202298 424059 1 +803485 898125 1 +271735 512227 1 +442644 980009 1 +444735 799591 1 +474132 623298 1 +67459 184056 1 +467347 302466 1 +477265 160425 2 +425470 102631 2 +547058 210758 2 +52246 779950 2 +291896 907904 2 +480318 350180 768473 486661 2 +776214 135749 872708 799857 2 +0 diff --git a/codenet/public_test_cases/p01092/input.1.txt b/codenet/public_test_cases/p01092/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae1bd28b096f29c5868d5d5050e2375f374baeb3 --- /dev/null +++ b/codenet/public_test_cases/p01092/input.1.txt @@ -0,0 +1,82 @@ +2 +1 2 8 +1 1 1 +8 8 1 +3 3 3 3 2 +3 +3 2 3 +1 1 2 +1 1 2 +1 1 2 +1 1 1 1 2 +1 2 1 2 2 +2 1 2 1 2 +2 +2 3 100 +100 50 1 +1 50 3 +100 1 100 100 3 +1 1 1 100 2 +5 +6 7 60 +11 11 1 +11 51 1 +51 11 1 +51 51 1 +31 31 1 +11 11 51 51 2 +11 11 51 51 3 +11 11 51 51 4 +11 11 51 51 5 +18 1 54 42 6 +1 43 59 60 7 +5 +6 4 9 +5 5 3 +1 1 1 +1 9 1 +9 1 1 +9 9 1 +3 3 7 7 4 +4 4 6 6 2 +1 1 2 2 3 +1 8 2 9 3 +8 1 9 2 3 +8 8 9 9 3 +5 +10 5 50 +3 40 1 +29 13 2 +39 28 1 +50 50 1 +25 30 5 +3 5 10 10 2 +11 11 14 14 2 +15 15 20 23 2 +40 40 41 50 2 +1 49 3 50 2 +30 30 50 50 3 +1 1 10 10 4 +1 30 1 50 5 +20 30 20 50 5 +40 30 40 50 5 +15 +2 2 1000000 +514898 704203 1 +743530 769450 1 +202298 424059 1 +803485 898125 1 +271735 512227 1 +442644 980009 1 +444735 799591 1 +474132 623298 1 +67459 184056 1 +467347 302466 1 +477265 160425 2 +425470 102631 2 +547058 210758 2 +52246 779950 2 +291896 907904 2 +480318 350180 768473 486661 2 +776214 135749 872708 799857 2 +0 diff --git a/codenet/public_test_cases/p01092/output.0.txt b/codenet/public_test_cases/p01092/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..614c54c8badc4e3c3c638a2f23e8db0164efbd1b --- /dev/null +++ b/codenet/public_test_cases/p01092/output.0.txt @@ -0,0 +1,7 @@ +216 +6 +497 +3181 +1365 +1930 +6485356 diff --git a/codenet/public_test_cases/p01092/output.1.txt b/codenet/public_test_cases/p01092/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..614c54c8badc4e3c3c638a2f23e8db0164efbd1b --- /dev/null +++ b/codenet/public_test_cases/p01092/output.1.txt @@ -0,0 +1,7 @@ +216 +6 +497 +3181 +1365 +1930 +6485356 diff --git a/codenet/public_test_cases/p01093/input.0.txt b/codenet/public_test_cases/p01093/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7a99ce71d157a7fb4e2e02c17554844cc284eed --- /dev/null +++ b/codenet/public_test_cases/p01093/input.0.txt @@ -0,0 +1,7 @@ +5 +10 10 10 10 10 +5 +1 5 8 9 11 +7 +11 34 83 47 59 29 70 +0 diff --git a/codenet/public_test_cases/p01093/input.1.txt b/codenet/public_test_cases/p01093/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7a99ce71d157a7fb4e2e02c17554844cc284eed --- /dev/null +++ b/codenet/public_test_cases/p01093/input.1.txt @@ -0,0 +1,7 @@ +5 +10 10 10 10 10 +5 +1 5 8 9 11 +7 +11 34 83 47 59 29 70 +0 diff --git a/codenet/public_test_cases/p01093/output.0.txt b/codenet/public_test_cases/p01093/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1029ed67f6200e05a29f5ee7c33a376c0fc6d116 --- /dev/null +++ b/codenet/public_test_cases/p01093/output.0.txt @@ -0,0 +1,3 @@ +0 +1 +5 diff --git a/codenet/public_test_cases/p01093/output.1.txt b/codenet/public_test_cases/p01093/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1029ed67f6200e05a29f5ee7c33a376c0fc6d116 --- /dev/null +++ b/codenet/public_test_cases/p01093/output.1.txt @@ -0,0 +1,3 @@ +0 +1 +5 diff --git a/codenet/public_test_cases/p01094/input.0.txt b/codenet/public_test_cases/p01094/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ef28e0d070b3fce21e2eb89236c56f3bb237627 --- /dev/null +++ b/codenet/public_test_cases/p01094/input.0.txt @@ -0,0 +1,15 @@ +1 +A +4 +A A B B +5 +L M N L N +6 +K K K K K K +6 +X X X Y Z X +10 +A A A B A C A C C B +10 +U U U U U V V W W W +0 diff --git a/codenet/public_test_cases/p01094/input.1.txt b/codenet/public_test_cases/p01094/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ef28e0d070b3fce21e2eb89236c56f3bb237627 --- /dev/null +++ b/codenet/public_test_cases/p01094/input.1.txt @@ -0,0 +1,15 @@ +1 +A +4 +A A B B +5 +L M N L N +6 +K K K K K K +6 +X X X Y Z X +10 +A A A B A C A C C B +10 +U U U U U V V W W W +0 diff --git a/codenet/public_test_cases/p01094/output.0.txt b/codenet/public_test_cases/p01094/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2259c70702a62c1f3899f8cd37a3c0d012d9305d --- /dev/null +++ b/codenet/public_test_cases/p01094/output.0.txt @@ -0,0 +1,7 @@ +A 1 +TIE +TIE +K 4 +X 5 +A 7 +U 8 diff --git a/codenet/public_test_cases/p01094/output.1.txt b/codenet/public_test_cases/p01094/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2259c70702a62c1f3899f8cd37a3c0d012d9305d --- /dev/null +++ b/codenet/public_test_cases/p01094/output.1.txt @@ -0,0 +1,7 @@ +A 1 +TIE +TIE +K 4 +X 5 +A 7 +U 8 diff --git a/codenet/public_test_cases/p01095/input.0.txt b/codenet/public_test_cases/p01095/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19ecbe7d0039a658cd50de87857380ece7fe4eff --- /dev/null +++ b/codenet/public_test_cases/p01095/input.0.txt @@ -0,0 +1,6 @@ +3 1 +3 4 +10 20 +100 50 +2 500000 +0 0 diff --git a/codenet/public_test_cases/p01095/input.1.txt b/codenet/public_test_cases/p01095/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19ecbe7d0039a658cd50de87857380ece7fe4eff --- /dev/null +++ b/codenet/public_test_cases/p01095/input.1.txt @@ -0,0 +1,6 @@ +3 1 +3 4 +10 20 +100 50 +2 500000 +0 0 diff --git a/codenet/public_test_cases/p01095/output.0.txt b/codenet/public_test_cases/p01095/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de3412e5907fd15938a902b51dcd78967ad3870f --- /dev/null +++ b/codenet/public_test_cases/p01095/output.0.txt @@ -0,0 +1,5 @@ +4 +11 +47 +150 +7368791 diff --git a/codenet/public_test_cases/p01095/output.1.txt b/codenet/public_test_cases/p01095/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de3412e5907fd15938a902b51dcd78967ad3870f --- /dev/null +++ b/codenet/public_test_cases/p01095/output.1.txt @@ -0,0 +1,5 @@ +4 +11 +47 +150 +7368791 diff --git a/codenet/public_test_cases/p01096/input.0.txt b/codenet/public_test_cases/p01096/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e046906392cfcd8aa769a9108abc6a089a5c1ebc --- /dev/null +++ b/codenet/public_test_cases/p01096/input.0.txt @@ -0,0 +1,11 @@ +4 +1 2 3 4 +4 +1 2 3 1 +5 +5 1 2 3 6 +14 +8 7 1 4 3 5 4 1 6 8 10 4 6 5 +5 +1 3 5 1 3 +0 diff --git a/codenet/public_test_cases/p01096/input.1.txt b/codenet/public_test_cases/p01096/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e046906392cfcd8aa769a9108abc6a089a5c1ebc --- /dev/null +++ b/codenet/public_test_cases/p01096/input.1.txt @@ -0,0 +1,11 @@ +4 +1 2 3 4 +4 +1 2 3 1 +5 +5 1 2 3 6 +14 +8 7 1 4 3 5 4 1 6 8 10 4 6 5 +5 +1 3 5 1 3 +0 diff --git a/codenet/public_test_cases/p01096/output.0.txt b/codenet/public_test_cases/p01096/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1aee74b290a2272657d43714f3c40f955c4126fa --- /dev/null +++ b/codenet/public_test_cases/p01096/output.0.txt @@ -0,0 +1,5 @@ +4 +4 +2 +12 +0 diff --git a/codenet/public_test_cases/p01096/output.1.txt b/codenet/public_test_cases/p01096/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1aee74b290a2272657d43714f3c40f955c4126fa --- /dev/null +++ b/codenet/public_test_cases/p01096/output.1.txt @@ -0,0 +1,5 @@ +4 +4 +2 +12 +0 diff --git a/codenet/public_test_cases/p01097/input.0.txt b/codenet/public_test_cases/p01097/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c7db202964802d613e6fb10a1fd901be6a538e7 --- /dev/null +++ b/codenet/public_test_cases/p01097/input.0.txt @@ -0,0 +1,72 @@ +1 1 100 +100 100 100 +6 4 10 +100 100 100 +106 102 102 +112 110 104 +104 116 102 +100 114 104 +92 107 100 +10 4 10 +-100 101 100 +-108 102 120 +-116 103 100 +-124 100 100 +-132 99 100 +-92 98 100 +-84 100 140 +-76 103 100 +-68 102 100 +-60 101 100 +10 4 10 +100 100 100 +108 101 100 +116 102 100 +124 100 100 +132 102 100 +200 100 103 +192 100 102 +184 100 101 +176 100 100 +168 100 103 +4 4 10 +100 100 100 +108 94 100 +116 100 100 +108 106 100 +23 6 10 +100 100 100 +96 109 100 +100 118 100 +109 126 100 +118 126 100 +127 118 98 +127 109 104 +127 100 97 +118 91 102 +109 91 100 +111 102 100 +111 102 109 +111 102 118 +111 102 91 +111 102 82 +111 114 96 +111 114 105 +102 114 114 +93 114 114 +84 114 105 +84 114 96 +93 114 87 +102 114 87 +10 3 10 +100 100 100 +116 116 102 +132 132 104 +148 148 106 +164 164 108 +108 108 108 +124 124 106 +140 140 104 +156 156 102 +172 172 100 +0 0 0 diff --git a/codenet/public_test_cases/p01097/input.1.txt b/codenet/public_test_cases/p01097/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c7db202964802d613e6fb10a1fd901be6a538e7 --- /dev/null +++ b/codenet/public_test_cases/p01097/input.1.txt @@ -0,0 +1,72 @@ +1 1 100 +100 100 100 +6 4 10 +100 100 100 +106 102 102 +112 110 104 +104 116 102 +100 114 104 +92 107 100 +10 4 10 +-100 101 100 +-108 102 120 +-116 103 100 +-124 100 100 +-132 99 100 +-92 98 100 +-84 100 140 +-76 103 100 +-68 102 100 +-60 101 100 +10 4 10 +100 100 100 +108 101 100 +116 102 100 +124 100 100 +132 102 100 +200 100 103 +192 100 102 +184 100 101 +176 100 100 +168 100 103 +4 4 10 +100 100 100 +108 94 100 +116 100 100 +108 106 100 +23 6 10 +100 100 100 +96 109 100 +100 118 100 +109 126 100 +118 126 100 +127 118 98 +127 109 104 +127 100 97 +118 91 102 +109 91 100 +111 102 100 +111 102 109 +111 102 118 +111 102 91 +111 102 82 +111 114 96 +111 114 105 +102 114 114 +93 114 114 +84 114 105 +84 114 96 +93 114 87 +102 114 87 +10 3 10 +100 100 100 +116 116 102 +132 132 104 +148 148 106 +164 164 108 +108 108 108 +124 124 106 +140 140 104 +156 156 102 +172 172 100 +0 0 0 diff --git a/codenet/public_test_cases/p01097/output.0.txt b/codenet/public_test_cases/p01097/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11fa95172958b9c84b73fee9f306d2090812e0c8 --- /dev/null +++ b/codenet/public_test_cases/p01097/output.0.txt @@ -0,0 +1,7 @@ +60000 +1856 +-1 +1632 +1856 +2796 +1640 diff --git a/codenet/public_test_cases/p01097/output.1.txt b/codenet/public_test_cases/p01097/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11fa95172958b9c84b73fee9f306d2090812e0c8 --- /dev/null +++ b/codenet/public_test_cases/p01097/output.1.txt @@ -0,0 +1,7 @@ +60000 +1856 +-1 +1632 +1856 +2796 +1640 diff --git a/codenet/public_test_cases/p01098/input.0.txt b/codenet/public_test_cases/p01098/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ead6a0e6a1ba4bf55fe2d64ab283a74c87fdfe45 --- /dev/null +++ b/codenet/public_test_cases/p01098/input.0.txt @@ -0,0 +1,92 @@ +3 6 +.#..#. +#.##.# +.#..#. +8 7 +.#####. +#.....# +#..#..# +#.#.#.# +#..#..# +#..#..# +.#####. +...#... +3 3 +#.. +... +#.. +3 3 +#.. +.#. +#.. +3 3 +... +... +... +3 3 +... +.#. +... +3 3 +.#. +#.# +.#. +3 3 +.#. +### +.#. +7 7 +.#####. +#.....# +#..#..# +#.#.#.# +#..#..# +#.....# +.#####. +7 7 +.#####. +#.....# +#..#..# +#.#.#.# +#..#..# +#..#..# +.#####. +7 7 +.#####. +#.....# +#..#..# +#.#.#.# +#..#..# +#.....# +.#####. +7 11 +.#####..... +#.....#.... +#..#..#..#. +#.#.#.#.#.# +#..#..#..#. +#.....#.... +.#####..... +7 3 +.#. +#.# +.#. +#.# +.#. +#.# +.#. +7 7 +.#####. +#..#..# +#..#..# +#.#.#.# +#..#..# +#..#..# +.#####. +3 1 +# +# +. +1 2 +#. +0 0 diff --git a/codenet/public_test_cases/p01098/input.1.txt b/codenet/public_test_cases/p01098/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ead6a0e6a1ba4bf55fe2d64ab283a74c87fdfe45 --- /dev/null +++ b/codenet/public_test_cases/p01098/input.1.txt @@ -0,0 +1,92 @@ +3 6 +.#..#. +#.##.# +.#..#. +8 7 +.#####. +#.....# +#..#..# +#.#.#.# +#..#..# +#..#..# +.#####. +...#... +3 3 +#.. +... +#.. +3 3 +#.. +.#. +#.. +3 3 +... +... +... +3 3 +... +.#. +... +3 3 +.#. +#.# +.#. +3 3 +.#. +### +.#. +7 7 +.#####. +#.....# +#..#..# +#.#.#.# +#..#..# +#.....# +.#####. +7 7 +.#####. +#.....# +#..#..# +#.#.#.# +#..#..# +#..#..# +.#####. +7 7 +.#####. +#.....# +#..#..# +#.#.#.# +#..#..# +#.....# +.#####. +7 11 +.#####..... +#.....#.... +#..#..#..#. +#.#.#.#.#.# +#..#..#..#. +#.....#.... +.#####..... +7 3 +.#. +#.# +.#. +#.# +.#. +#.# +.#. +7 7 +.#####. +#..#..# +#..#..# +#.#.#.# +#..#..# +#..#..# +.#####. +3 1 +# +# +. +1 2 +#. +0 0 diff --git a/codenet/public_test_cases/p01098/output.0.txt b/codenet/public_test_cases/p01098/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f730fa7078343f99a6f6750ac1d9b380094c6a0 --- /dev/null +++ b/codenet/public_test_cases/p01098/output.0.txt @@ -0,0 +1,8 @@ +yes +no +no +no +no +no +yes +yes diff --git a/codenet/public_test_cases/p01098/output.1.txt b/codenet/public_test_cases/p01098/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f730fa7078343f99a6f6750ac1d9b380094c6a0 --- /dev/null +++ b/codenet/public_test_cases/p01098/output.1.txt @@ -0,0 +1,8 @@ +yes +no +no +no +no +no +yes +yes diff --git a/codenet/public_test_cases/p01099/input.0.txt b/codenet/public_test_cases/p01099/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b69172a5eba83370fcf295d3687b5d2158a71e9 --- /dev/null +++ b/codenet/public_test_cases/p01099/input.0.txt @@ -0,0 +1,53 @@ +3 4 +100 4 +100 0 +0 0 +1 2 1.00 +2 1 1.00 +3 1 9.99 +3 2 9.99 +7 6 +0 0 +1 0 +2 0 +0 10 +1 10 +2 10 +20 5 +1 7 1.00 +2 7 1.00 +3 7 1.00 +4 7 1.00 +5 7 1.00 +6 7 1.00 +4 4 +-1 -1 +1 -1 +-1 1 +1 1 +1 4 1.10 +4 2 2.10 +2 3 3.10 +3 1 4.10 +8 12 +-91 0 +-62 0 +-18 0 +2 0 +23 0 +55 0 +63 0 +80 0 +2 7 3.96 +3 2 2.25 +2 4 5.48 +8 7 9.74 +5 6 6.70 +7 6 1.51 +4 1 7.41 +5 8 1.11 +6 3 2.98 +3 4 2.75 +1 8 5.89 +4 5 5.37 +0 0 diff --git a/codenet/public_test_cases/p01099/input.1.txt b/codenet/public_test_cases/p01099/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b69172a5eba83370fcf295d3687b5d2158a71e9 --- /dev/null +++ b/codenet/public_test_cases/p01099/input.1.txt @@ -0,0 +1,53 @@ +3 4 +100 4 +100 0 +0 0 +1 2 1.00 +2 1 1.00 +3 1 9.99 +3 2 9.99 +7 6 +0 0 +1 0 +2 0 +0 10 +1 10 +2 10 +20 5 +1 7 1.00 +2 7 1.00 +3 7 1.00 +4 7 1.00 +5 7 1.00 +6 7 1.00 +4 4 +-1 -1 +1 -1 +-1 1 +1 1 +1 4 1.10 +4 2 2.10 +2 3 3.10 +3 1 4.10 +8 12 +-91 0 +-62 0 +-18 0 +2 0 +23 0 +55 0 +63 0 +80 0 +2 7 3.96 +3 2 2.25 +2 4 5.48 +8 7 9.74 +5 6 6.70 +7 6 1.51 +4 1 7.41 +5 8 1.11 +6 3 2.98 +3 4 2.75 +1 8 5.89 +4 5 5.37 +0 0 diff --git a/codenet/public_test_cases/p01099/output.0.txt b/codenet/public_test_cases/p01099/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa0672908b8b494dfcc4ddf7f03e03b19fd51dac --- /dev/null +++ b/codenet/public_test_cases/p01099/output.0.txt @@ -0,0 +1,4 @@ +1.414214 +0.816497 +0.356001 +5.854704 diff --git a/codenet/public_test_cases/p01099/output.1.txt b/codenet/public_test_cases/p01099/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa0672908b8b494dfcc4ddf7f03e03b19fd51dac --- /dev/null +++ b/codenet/public_test_cases/p01099/output.1.txt @@ -0,0 +1,4 @@ +1.414214 +0.816497 +0.356001 +5.854704 diff --git a/codenet/public_test_cases/p01100/input.0.txt b/codenet/public_test_cases/p01100/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a19e791848c3976cebea0154c57316d90f01052 --- /dev/null +++ b/codenet/public_test_cases/p01100/input.0.txt @@ -0,0 +1,16 @@ +3 3 +1 2 +2 3 +1 3 +4 3 +1 2 +1 3 +1 4 +4 6 +1 2 +1 3 +1 4 +2 3 +3 4 +2 4 +0 0 diff --git a/codenet/public_test_cases/p01100/input.1.txt b/codenet/public_test_cases/p01100/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a19e791848c3976cebea0154c57316d90f01052 --- /dev/null +++ b/codenet/public_test_cases/p01100/input.1.txt @@ -0,0 +1,16 @@ +3 3 +1 2 +2 3 +1 3 +4 3 +1 2 +1 3 +1 4 +4 6 +1 2 +1 3 +1 4 +2 3 +3 4 +2 4 +0 0 diff --git a/codenet/public_test_cases/p01100/output.0.txt b/codenet/public_test_cases/p01100/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c5dc14e83a88800a515699e3495fc3be5e15db6 --- /dev/null +++ b/codenet/public_test_cases/p01100/output.0.txt @@ -0,0 +1,3 @@ +1 1 +0 1 +1 2 diff --git a/codenet/public_test_cases/p01100/output.1.txt b/codenet/public_test_cases/p01100/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c5dc14e83a88800a515699e3495fc3be5e15db6 --- /dev/null +++ b/codenet/public_test_cases/p01100/output.1.txt @@ -0,0 +1,3 @@ +1 1 +0 1 +1 2 diff --git a/codenet/public_test_cases/p01101/input.0.txt b/codenet/public_test_cases/p01101/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..474b43e25bf7f99419173cb4b3f3c049360a1ca8 --- /dev/null +++ b/codenet/public_test_cases/p01101/input.0.txt @@ -0,0 +1,11 @@ +3 45 +10 20 30 +6 10 +1 2 5 8 9 11 +7 100 +11 34 83 47 59 29 70 +4 100 +80 70 60 50 +4 20 +10 5 10 16 +0 0 diff --git a/codenet/public_test_cases/p01101/input.1.txt b/codenet/public_test_cases/p01101/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..474b43e25bf7f99419173cb4b3f3c049360a1ca8 --- /dev/null +++ b/codenet/public_test_cases/p01101/input.1.txt @@ -0,0 +1,11 @@ +3 45 +10 20 30 +6 10 +1 2 5 8 9 11 +7 100 +11 34 83 47 59 29 70 +4 100 +80 70 60 50 +4 20 +10 5 10 16 +0 0 diff --git a/codenet/public_test_cases/p01101/output.0.txt b/codenet/public_test_cases/p01101/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4122920b2cd3fe996e5c797be7da3c072f9cb402 --- /dev/null +++ b/codenet/public_test_cases/p01101/output.0.txt @@ -0,0 +1,5 @@ +40 +10 +99 +NONE +20 diff --git a/codenet/public_test_cases/p01101/output.1.txt b/codenet/public_test_cases/p01101/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4122920b2cd3fe996e5c797be7da3c072f9cb402 --- /dev/null +++ b/codenet/public_test_cases/p01101/output.1.txt @@ -0,0 +1,5 @@ +40 +10 +99 +NONE +20 diff --git a/codenet/public_test_cases/p01102/input.0.txt b/codenet/public_test_cases/p01102/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69ceb72e6d452367ba22046583d065346c15348f --- /dev/null +++ b/codenet/public_test_cases/p01102/input.0.txt @@ -0,0 +1,19 @@ +print"hello";print123 +print"hello";print123 +read"B1input";solve;output; +read"B2";solve;output; +read"C1";solve;output"C1ans"; +read"C2";solve;output"C2ans"; +"""""""" +"""42""""" +slow"program" +fast"code" +"super"fast"program" +"super"faster"program" +X"" +X +I"S""CREAM" +I"CE""CREAM" +11"22"11 +1"33"111 +. diff --git a/codenet/public_test_cases/p01102/input.1.txt b/codenet/public_test_cases/p01102/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69ceb72e6d452367ba22046583d065346c15348f --- /dev/null +++ b/codenet/public_test_cases/p01102/input.1.txt @@ -0,0 +1,19 @@ +print"hello";print123 +print"hello";print123 +read"B1input";solve;output; +read"B2";solve;output; +read"C1";solve;output"C1ans"; +read"C2";solve;output"C2ans"; +"""""""" +"""42""""" +slow"program" +fast"code" +"super"fast"program" +"super"faster"program" +X"" +X +I"S""CREAM" +I"CE""CREAM" +11"22"11 +1"33"111 +. diff --git a/codenet/public_test_cases/p01102/output.0.txt b/codenet/public_test_cases/p01102/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60fa109888724f8141bd7d68af1cba408e065533 --- /dev/null +++ b/codenet/public_test_cases/p01102/output.0.txt @@ -0,0 +1,9 @@ +IDENTICAL +CLOSE +DIFFERENT +CLOSE +DIFFERENT +DIFFERENT +DIFFERENT +CLOSE +DIFFERENT diff --git a/codenet/public_test_cases/p01102/output.1.txt b/codenet/public_test_cases/p01102/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60fa109888724f8141bd7d68af1cba408e065533 --- /dev/null +++ b/codenet/public_test_cases/p01102/output.1.txt @@ -0,0 +1,9 @@ +IDENTICAL +CLOSE +DIFFERENT +CLOSE +DIFFERENT +DIFFERENT +DIFFERENT +CLOSE +DIFFERENT diff --git a/codenet/public_test_cases/p01103/input.0.txt b/codenet/public_test_cases/p01103/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..886a5bffc013c6b7cd7cec9b6c67d1a5cc79519d --- /dev/null +++ b/codenet/public_test_cases/p01103/input.0.txt @@ -0,0 +1,24 @@ +3 3 +2 3 2 +2 1 2 +2 3 1 +3 5 +3 3 4 3 3 +3 1 0 2 3 +3 3 4 3 2 +7 7 +1 1 1 1 1 0 0 +1 0 0 0 1 0 0 +1 0 1 1 1 1 1 +1 0 1 0 1 0 1 +1 1 1 1 1 0 1 +0 0 1 0 0 0 1 +0 0 1 1 1 1 1 +6 6 +1 1 1 1 2 2 +1 0 0 2 0 2 +1 0 0 2 0 2 +3 3 3 9 9 9 +3 0 0 9 0 9 +3 3 3 9 9 9 +0 0 diff --git a/codenet/public_test_cases/p01103/input.1.txt b/codenet/public_test_cases/p01103/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..886a5bffc013c6b7cd7cec9b6c67d1a5cc79519d --- /dev/null +++ b/codenet/public_test_cases/p01103/input.1.txt @@ -0,0 +1,24 @@ +3 3 +2 3 2 +2 1 2 +2 3 1 +3 5 +3 3 4 3 3 +3 1 0 2 3 +3 3 4 3 2 +7 7 +1 1 1 1 1 0 0 +1 0 0 0 1 0 0 +1 0 1 1 1 1 1 +1 0 1 0 1 0 1 +1 1 1 1 1 0 1 +0 0 1 0 0 0 1 +0 0 1 1 1 1 1 +6 6 +1 1 1 1 2 2 +1 0 0 2 0 2 +1 0 0 2 0 2 +3 3 3 9 9 9 +3 0 0 9 0 9 +3 3 3 9 9 9 +0 0 diff --git a/codenet/public_test_cases/p01103/output.0.txt b/codenet/public_test_cases/p01103/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2f6d89f5a5a197d1119135f23395b8c6ee2b92a --- /dev/null +++ b/codenet/public_test_cases/p01103/output.0.txt @@ -0,0 +1,4 @@ +0 +3 +1 +9 diff --git a/codenet/public_test_cases/p01103/output.1.txt b/codenet/public_test_cases/p01103/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2f6d89f5a5a197d1119135f23395b8c6ee2b92a --- /dev/null +++ b/codenet/public_test_cases/p01103/output.1.txt @@ -0,0 +1,4 @@ +0 +3 +1 +9 diff --git a/codenet/public_test_cases/p01104/input.0.txt b/codenet/public_test_cases/p01104/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9921367dfdfe0eecd961916e35a224b71a14f0da --- /dev/null +++ b/codenet/public_test_cases/p01104/input.0.txt @@ -0,0 +1,26 @@ +4 3 +110 +101 +011 +110 +7 1 +1 +1 +1 +1 +1 +1 +1 +4 5 +10000 +01000 +00100 +00010 +6 6 +111111 +011000 +100000 +000010 +100001 +100100 +0 0 diff --git a/codenet/public_test_cases/p01104/input.1.txt b/codenet/public_test_cases/p01104/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9921367dfdfe0eecd961916e35a224b71a14f0da --- /dev/null +++ b/codenet/public_test_cases/p01104/input.1.txt @@ -0,0 +1,26 @@ +4 3 +110 +101 +011 +110 +7 1 +1 +1 +1 +1 +1 +1 +1 +4 5 +10000 +01000 +00100 +00010 +6 6 +111111 +011000 +100000 +000010 +100001 +100100 +0 0 diff --git a/codenet/public_test_cases/p01104/output.0.txt b/codenet/public_test_cases/p01104/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b38158a7ad769f092fcb02f6eb1f40bc4919404 --- /dev/null +++ b/codenet/public_test_cases/p01104/output.0.txt @@ -0,0 +1,4 @@ +3 +6 +0 +6 diff --git a/codenet/public_test_cases/p01104/output.1.txt b/codenet/public_test_cases/p01104/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b38158a7ad769f092fcb02f6eb1f40bc4919404 --- /dev/null +++ b/codenet/public_test_cases/p01104/output.1.txt @@ -0,0 +1,4 @@ +3 +6 +0 +6 diff --git a/codenet/public_test_cases/p01105/input.0.txt b/codenet/public_test_cases/p01105/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..250aa900e47f319dff271f65404d57561057d219 --- /dev/null +++ b/codenet/public_test_cases/p01105/input.0.txt @@ -0,0 +1,6 @@ +0 +(a*(1*b)) +(1^a) +(-(-a*-b)*a) +(a^(b^(c^d))) +. diff --git a/codenet/public_test_cases/p01105/input.1.txt b/codenet/public_test_cases/p01105/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..250aa900e47f319dff271f65404d57561057d219 --- /dev/null +++ b/codenet/public_test_cases/p01105/input.1.txt @@ -0,0 +1,6 @@ +0 +(a*(1*b)) +(1^a) +(-(-a*-b)*a) +(a^(b^(c^d))) +. diff --git a/codenet/public_test_cases/p01105/output.0.txt b/codenet/public_test_cases/p01105/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dce30daa0e74ad41233c5511fad41512df406d67 --- /dev/null +++ b/codenet/public_test_cases/p01105/output.0.txt @@ -0,0 +1,5 @@ +1 +5 +2 +1 +13 diff --git a/codenet/public_test_cases/p01105/output.1.txt b/codenet/public_test_cases/p01105/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dce30daa0e74ad41233c5511fad41512df406d67 --- /dev/null +++ b/codenet/public_test_cases/p01105/output.1.txt @@ -0,0 +1,5 @@ +1 +5 +2 +1 +13 diff --git a/codenet/public_test_cases/p01106/input.0.txt b/codenet/public_test_cases/p01106/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e78e5599864697be98939410a589fb4da3fe0d7f --- /dev/null +++ b/codenet/public_test_cases/p01106/input.0.txt @@ -0,0 +1,4 @@ +3 3 2 +12 578 2214 +59 471605241352156968 431565444592236940 +0 0 0 diff --git a/codenet/public_test_cases/p01106/input.1.txt b/codenet/public_test_cases/p01106/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e78e5599864697be98939410a589fb4da3fe0d7f --- /dev/null +++ b/codenet/public_test_cases/p01106/input.1.txt @@ -0,0 +1,4 @@ +3 3 2 +12 578 2214 +59 471605241352156968 431565444592236940 +0 0 0 diff --git a/codenet/public_test_cases/p01106/output.0.txt b/codenet/public_test_cases/p01106/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..882268284557ba8cf9a89a1a501f980f84b27d73 --- /dev/null +++ b/codenet/public_test_cases/p01106/output.0.txt @@ -0,0 +1,3 @@ +LRR +RLLLRRRLRRLL +LRRRLRRLLRRRRLLLLRLLRRRLRRLLRLLLLLLRLRLLRLRLLLRLRLLRLLRRRLL diff --git a/codenet/public_test_cases/p01106/output.1.txt b/codenet/public_test_cases/p01106/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..882268284557ba8cf9a89a1a501f980f84b27d73 --- /dev/null +++ b/codenet/public_test_cases/p01106/output.1.txt @@ -0,0 +1,3 @@ +LRR +RLLLRRRLRRLL +LRRRLRRLLRRRRLLLLRLLRRRLRRLLRLLLLLLRLRLLRLRLLLRLRLLRLLRRRLL diff --git a/codenet/public_test_cases/p01107/input.0.txt b/codenet/public_test_cases/p01107/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..181c4253689f1ed293dc5597f2418b2ba7bcaa5b --- /dev/null +++ b/codenet/public_test_cases/p01107/input.0.txt @@ -0,0 +1,24 @@ +3 3 +... +.#. +... +5 5 +..#.. +..... +#.... +..... +..... +3 8 +..#..... +........ +.....#.. +3 5 +..#.. +..... +..#.. +4 4 +.... +.... +..## +..#. +0 0 diff --git a/codenet/public_test_cases/p01107/input.1.txt b/codenet/public_test_cases/p01107/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..181c4253689f1ed293dc5597f2418b2ba7bcaa5b --- /dev/null +++ b/codenet/public_test_cases/p01107/input.1.txt @@ -0,0 +1,24 @@ +3 3 +... +.#. +... +5 5 +..#.. +..... +#.... +..... +..... +3 8 +..#..... +........ +.....#.. +3 5 +..#.. +..... +..#.. +4 4 +.... +.... +..## +..#. +0 0 diff --git a/codenet/public_test_cases/p01107/output.0.txt b/codenet/public_test_cases/p01107/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eea507683ac1bcb6111264c5273c80f68e87fd4d --- /dev/null +++ b/codenet/public_test_cases/p01107/output.0.txt @@ -0,0 +1,5 @@ +YES +NO +YES +NO +NO diff --git a/codenet/public_test_cases/p01107/output.1.txt b/codenet/public_test_cases/p01107/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eea507683ac1bcb6111264c5273c80f68e87fd4d --- /dev/null +++ b/codenet/public_test_cases/p01107/output.1.txt @@ -0,0 +1,5 @@ +YES +NO +YES +NO +NO diff --git a/codenet/public_test_cases/p01108/input.0.txt b/codenet/public_test_cases/p01108/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ef1db6bed271d768501578d7cd6d2d1f087035c --- /dev/null +++ b/codenet/public_test_cases/p01108/input.0.txt @@ -0,0 +1,90 @@ +0 1 +2 2 +1 0 +1 3 +5 2 +4 3 + +0 0 +0 1 +1 0 +0 3 +0 2 +1 -1 + +-5 -4 +0 1 +0 15 +-10 14 +-5 10 +0 -8 + +-110 221 +-731 525 +-555 -258 +511 -83 +-1000 -737 +66 -562 + +533 -45 +-525 -450 +-282 -667 +-439 823 +-196 606 +-768 -233 + +0 0 +0 1 +1 0 +99 1 +100 1 +55 2 + +354 -289 +89 -79 +256 -166 +131 -196 +-774 -809 +-519 -623 + +-990 688 +-38 601 +-360 712 +384 759 +-241 140 +-59 196 + +629 -591 +360 -847 +936 -265 +109 -990 +-456 -913 +-787 -884 + +-1000 -1000 +-999 -999 +-1000 -998 +1000 1000 +999 999 +1000 998 + +-386 -83 +404 -83 +-408 -117 +-162 -348 +128 -88 +296 -30 + +-521 -245 +-613 -250 +797 451 +-642 239 +646 309 +-907 180 + +-909 -544 +-394 10 +-296 260 +-833 268 +-875 882 +-907 -423 diff --git a/codenet/public_test_cases/p01108/input.1.txt b/codenet/public_test_cases/p01108/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ef1db6bed271d768501578d7cd6d2d1f087035c --- /dev/null +++ b/codenet/public_test_cases/p01108/input.1.txt @@ -0,0 +1,90 @@ +0 1 +2 2 +1 0 +1 3 +5 2 +4 3 + +0 0 +0 1 +1 0 +0 3 +0 2 +1 -1 + +-5 -4 +0 1 +0 15 +-10 14 +-5 10 +0 -8 + +-110 221 +-731 525 +-555 -258 +511 -83 +-1000 -737 +66 -562 + +533 -45 +-525 -450 +-282 -667 +-439 823 +-196 606 +-768 -233 + +0 0 +0 1 +1 0 +99 1 +100 1 +55 2 + +354 -289 +89 -79 +256 -166 +131 -196 +-774 -809 +-519 -623 + +-990 688 +-38 601 +-360 712 +384 759 +-241 140 +-59 196 + +629 -591 +360 -847 +936 -265 +109 -990 +-456 -913 +-787 -884 + +-1000 -1000 +-999 -999 +-1000 -998 +1000 1000 +999 999 +1000 998 + +-386 -83 +404 -83 +-408 -117 +-162 -348 +128 -88 +296 -30 + +-521 -245 +-613 -250 +797 451 +-642 239 +646 309 +-907 180 + +-909 -544 +-394 10 +-296 260 +-833 268 +-875 882 +-907 -423 diff --git a/codenet/public_test_cases/p01108/output.0.txt b/codenet/public_test_cases/p01108/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a612811fc557bca4e37197c6d29302cef4dc34ab --- /dev/null +++ b/codenet/public_test_cases/p01108/output.0.txt @@ -0,0 +1,13 @@ +4 +3 +3 +3 +3 +4 +4 +4 +4 +Many +Many +Many +Many diff --git a/codenet/public_test_cases/p01108/output.1.txt b/codenet/public_test_cases/p01108/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a612811fc557bca4e37197c6d29302cef4dc34ab --- /dev/null +++ b/codenet/public_test_cases/p01108/output.1.txt @@ -0,0 +1,13 @@ +4 +3 +3 +3 +3 +4 +4 +4 +4 +Many +Many +Many +Many diff --git a/codenet/public_test_cases/p01109/input.0.txt b/codenet/public_test_cases/p01109/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b1d9a111d4dbb63defde60c82b1ffdd13f48b7c --- /dev/null +++ b/codenet/public_test_cases/p01109/input.0.txt @@ -0,0 +1,11 @@ +7 +15 15 15 15 15 15 15 +4 +10 20 30 60 +10 +1 1 1 1 1 1 1 1 1 100 +7 +90 90 90 90 90 90 10 +7 +2 7 1 8 2 8 4 +0 diff --git a/codenet/public_test_cases/p01109/input.1.txt b/codenet/public_test_cases/p01109/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b1d9a111d4dbb63defde60c82b1ffdd13f48b7c --- /dev/null +++ b/codenet/public_test_cases/p01109/input.1.txt @@ -0,0 +1,11 @@ +7 +15 15 15 15 15 15 15 +4 +10 20 30 60 +10 +1 1 1 1 1 1 1 1 1 100 +7 +90 90 90 90 90 90 10 +7 +2 7 1 8 2 8 4 +0 diff --git a/codenet/public_test_cases/p01109/output.0.txt b/codenet/public_test_cases/p01109/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f411fbe9efb896b75ba549eec19cdf8a090723c5 --- /dev/null +++ b/codenet/public_test_cases/p01109/output.0.txt @@ -0,0 +1,5 @@ +7 +3 +9 +1 +4 diff --git a/codenet/public_test_cases/p01109/output.1.txt b/codenet/public_test_cases/p01109/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f411fbe9efb896b75ba549eec19cdf8a090723c5 --- /dev/null +++ b/codenet/public_test_cases/p01109/output.1.txt @@ -0,0 +1,5 @@ +7 +3 +9 +1 +4 diff --git a/codenet/public_test_cases/p01110/input.0.txt b/codenet/public_test_cases/p01110/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8226a5c1a547566d5d5cf8dcf09cb23b1328aa7c --- /dev/null +++ b/codenet/public_test_cases/p01110/input.0.txt @@ -0,0 +1,20 @@ +2 1 1 1 +1 1 +0 0 +1 3 2 1 +2 1 +2 1 +0 0 +10 8 3 2 +2 2 +1 3 +1 1 +0 1 +3 4 +3 3 3 2 +1 2 +2 1 +1 1 +0 1 +0 0 +0 0 0 0 diff --git a/codenet/public_test_cases/p01110/input.1.txt b/codenet/public_test_cases/p01110/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8226a5c1a547566d5d5cf8dcf09cb23b1328aa7c --- /dev/null +++ b/codenet/public_test_cases/p01110/input.1.txt @@ -0,0 +1,20 @@ +2 1 1 1 +1 1 +0 0 +1 3 2 1 +2 1 +2 1 +0 0 +10 8 3 2 +2 2 +1 3 +1 1 +0 1 +3 4 +3 3 3 2 +1 2 +2 1 +1 1 +0 1 +0 0 +0 0 0 0 diff --git a/codenet/public_test_cases/p01110/output.0.txt b/codenet/public_test_cases/p01110/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4bd293d130e4fefaef33291d43c8fef680fe8171 --- /dev/null +++ b/codenet/public_test_cases/p01110/output.0.txt @@ -0,0 +1,6 @@ +2 +3 +8 +1 +3 +6 diff --git a/codenet/public_test_cases/p01110/output.1.txt b/codenet/public_test_cases/p01110/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4bd293d130e4fefaef33291d43c8fef680fe8171 --- /dev/null +++ b/codenet/public_test_cases/p01110/output.1.txt @@ -0,0 +1,6 @@ +2 +3 +8 +1 +3 +6 diff --git a/codenet/public_test_cases/p01111/input.0.txt b/codenet/public_test_cases/p01111/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2df91af098ab50fe5140f5ccdf1e2b7fe026ec4 --- /dev/null +++ b/codenet/public_test_cases/p01111/input.0.txt @@ -0,0 +1,11 @@ +15 +16 +2 +3 +9699690 +223092870 +847288609 +900660121 +987698769 +999999999 +0 diff --git a/codenet/public_test_cases/p01111/input.1.txt b/codenet/public_test_cases/p01111/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2df91af098ab50fe5140f5ccdf1e2b7fe026ec4 --- /dev/null +++ b/codenet/public_test_cases/p01111/input.1.txt @@ -0,0 +1,11 @@ +15 +16 +2 +3 +9699690 +223092870 +847288609 +900660121 +987698769 +999999999 +0 diff --git a/codenet/public_test_cases/p01111/output.0.txt b/codenet/public_test_cases/p01111/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee911e0228f52ab95e603d202c9ecec672cbf505 --- /dev/null +++ b/codenet/public_test_cases/p01111/output.0.txt @@ -0,0 +1,10 @@ +1 5 +16 1 +2 1 +1 2 +16 4389 +129 20995 +4112949 206 +15006 30011 +46887 17718 +163837 5994 diff --git a/codenet/public_test_cases/p01111/output.1.txt b/codenet/public_test_cases/p01111/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee911e0228f52ab95e603d202c9ecec672cbf505 --- /dev/null +++ b/codenet/public_test_cases/p01111/output.1.txt @@ -0,0 +1,10 @@ +1 5 +16 1 +2 1 +1 2 +16 4389 +129 20995 +4112949 206 +15006 30011 +46887 17718 +163837 5994 diff --git a/codenet/public_test_cases/p01112/input.0.txt b/codenet/public_test_cases/p01112/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e411762e08d2675eebea97bd08a19811b6a2ff4 --- /dev/null +++ b/codenet/public_test_cases/p01112/input.0.txt @@ -0,0 +1,66 @@ +5 +3 +3 2 +4 1 +5 1 +3 +1 +1 2 +3 +2 +1 2 +3 2 +5 +4 +4 1 +4 2 +5 1 +5 2 +5 +3 +4 1 +4 2 +5 1 +5 +4 +3 2 +4 1 +5 1 +5 2 +9 +11 +6 1 +6 4 +7 2 +7 3 +7 4 +8 2 +8 3 +8 4 +9 1 +9 3 +9 5 +9 +10 +6 1 +6 4 +7 2 +7 3 +7 4 +8 2 +8 3 +8 4 +9 1 +9 3 +5 +6 +4 3 +2 1 +5 1 +2 4 +1 3 +2 3 +9 +1 +1 2 +0 diff --git a/codenet/public_test_cases/p01112/input.1.txt b/codenet/public_test_cases/p01112/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e411762e08d2675eebea97bd08a19811b6a2ff4 --- /dev/null +++ b/codenet/public_test_cases/p01112/input.1.txt @@ -0,0 +1,66 @@ +5 +3 +3 2 +4 1 +5 1 +3 +1 +1 2 +3 +2 +1 2 +3 2 +5 +4 +4 1 +4 2 +5 1 +5 2 +5 +3 +4 1 +4 2 +5 1 +5 +4 +3 2 +4 1 +5 1 +5 2 +9 +11 +6 1 +6 4 +7 2 +7 3 +7 4 +8 2 +8 3 +8 4 +9 1 +9 3 +9 5 +9 +10 +6 1 +6 4 +7 2 +7 3 +7 4 +8 2 +8 3 +8 4 +9 1 +9 3 +5 +6 +4 3 +2 1 +5 1 +2 4 +1 3 +2 3 +9 +1 +1 2 +0 diff --git a/codenet/public_test_cases/p01112/output.0.txt b/codenet/public_test_cases/p01112/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f3b3701791158c0977e5715a4eebce9b4c7b4c1 --- /dev/null +++ b/codenet/public_test_cases/p01112/output.0.txt @@ -0,0 +1,10 @@ +2 +1 +0 +0 +1 +0 +0 +16 +0 +1615040 diff --git a/codenet/public_test_cases/p01112/output.1.txt b/codenet/public_test_cases/p01112/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f3b3701791158c0977e5715a4eebce9b4c7b4c1 --- /dev/null +++ b/codenet/public_test_cases/p01112/output.1.txt @@ -0,0 +1,10 @@ +2 +1 +0 +0 +1 +0 +0 +16 +0 +1615040 diff --git a/codenet/public_test_cases/p01113/input.0.txt b/codenet/public_test_cases/p01113/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..950f21dc987821210b1a89aa1e6c1c4b2cbca40a --- /dev/null +++ b/codenet/public_test_cases/p01113/input.0.txt @@ -0,0 +1,17 @@ +1 +0000000000000000000000000000000000000000000000000000 +2 +0000000000000000000000000000000000000000000000000000 +3 +0000000000000000000000000000000000000000000000000000 +4 +0000000000000000000000000000000000000000000000000000 +7 +1101000000000000000000000000000000000000000000000000 +100 +1100011010100001100111100101000111001001111100101011 +123456789 +1010101010101010101010101010101010101010101010101010 +1000000000000000000 +1111111111111111111111111111111111111111111111111111 +0 diff --git a/codenet/public_test_cases/p01113/input.1.txt b/codenet/public_test_cases/p01113/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..950f21dc987821210b1a89aa1e6c1c4b2cbca40a --- /dev/null +++ b/codenet/public_test_cases/p01113/input.1.txt @@ -0,0 +1,17 @@ +1 +0000000000000000000000000000000000000000000000000000 +2 +0000000000000000000000000000000000000000000000000000 +3 +0000000000000000000000000000000000000000000000000000 +4 +0000000000000000000000000000000000000000000000000000 +7 +1101000000000000000000000000000000000000000000000000 +100 +1100011010100001100111100101000111001001111100101011 +123456789 +1010101010101010101010101010101010101010101010101010 +1000000000000000000 +1111111111111111111111111111111111111111111111111111 +0 diff --git a/codenet/public_test_cases/p01113/output.0.txt b/codenet/public_test_cases/p01113/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8838e81d4b3669e72c31ee7e9bd7ab0b1eb9753 --- /dev/null +++ b/codenet/public_test_cases/p01113/output.0.txt @@ -0,0 +1,8 @@ +0000000000010000000000000000000000000000000000000000000000000000 +0000000000011000000000000000000000000000000000000000000000000000 +0000000000100000000000000000000000000000000000000000000000000000 +0000000000100100000000000000000000000000000000000000000000000000 +0000000000111101000000000000000000000000000000000000000000000000 +0000000001110110011010111011100001101110110010001001010101111111 +0000000110111000100001110101011001000111100001010011110101011000 +0000001101010000000000000000000000000000000000000000000000000000 diff --git a/codenet/public_test_cases/p01113/output.1.txt b/codenet/public_test_cases/p01113/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8838e81d4b3669e72c31ee7e9bd7ab0b1eb9753 --- /dev/null +++ b/codenet/public_test_cases/p01113/output.1.txt @@ -0,0 +1,8 @@ +0000000000010000000000000000000000000000000000000000000000000000 +0000000000011000000000000000000000000000000000000000000000000000 +0000000000100000000000000000000000000000000000000000000000000000 +0000000000100100000000000000000000000000000000000000000000000000 +0000000000111101000000000000000000000000000000000000000000000000 +0000000001110110011010111011100001101110110010001001010101111111 +0000000110111000100001110101011001000111100001010011110101011000 +0000001101010000000000000000000000000000000000000000000000000000 diff --git a/codenet/public_test_cases/p01114/input.0.txt b/codenet/public_test_cases/p01114/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..97af30871a706da85811168b8e36d0f9f8f0d6f5 --- /dev/null +++ b/codenet/public_test_cases/p01114/input.0.txt @@ -0,0 +1,40 @@ +4 +1 +0 1 +1 2 +-1 2 +2 1 +4 +1 +1 1 +2 2 +1 3 +1 4 +4 +1 +1 1 +2 2 +3 1 +4 1 +4 +1 +1 2 +2 1 +3 2 +4 2 +5 +2 +0 1 +0 2 +0 3 +0 4 +0 5 +6 +3 +0 2 +2 2 +1 1 +0 3 +2 3 +1 4 +0 diff --git a/codenet/public_test_cases/p01114/input.1.txt b/codenet/public_test_cases/p01114/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97af30871a706da85811168b8e36d0f9f8f0d6f5 --- /dev/null +++ b/codenet/public_test_cases/p01114/input.1.txt @@ -0,0 +1,40 @@ +4 +1 +0 1 +1 2 +-1 2 +2 1 +4 +1 +1 1 +2 2 +1 3 +1 4 +4 +1 +1 1 +2 2 +3 1 +4 1 +4 +1 +1 2 +2 1 +3 2 +4 2 +5 +2 +0 1 +0 2 +0 3 +0 4 +0 5 +6 +3 +0 2 +2 2 +1 1 +0 3 +2 3 +1 4 +0 diff --git a/codenet/public_test_cases/p01114/output.0.txt b/codenet/public_test_cases/p01114/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..131c01c667089dc96346e5cefb2a62a4c53f0215 --- /dev/null +++ b/codenet/public_test_cases/p01114/output.0.txt @@ -0,0 +1,6 @@ +6.000000000000 +6.928203230276 +6.000000000000 +7.732050807569 +6.928203230276 +6.000000000000 diff --git a/codenet/public_test_cases/p01114/output.1.txt b/codenet/public_test_cases/p01114/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..131c01c667089dc96346e5cefb2a62a4c53f0215 --- /dev/null +++ b/codenet/public_test_cases/p01114/output.1.txt @@ -0,0 +1,6 @@ +6.000000000000 +6.928203230276 +6.000000000000 +7.732050807569 +6.928203230276 +6.000000000000 diff --git a/codenet/public_test_cases/p01115/input.0.txt b/codenet/public_test_cases/p01115/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0076d600392cf7849b84d6522eef644b981db0d8 --- /dev/null +++ b/codenet/public_test_cases/p01115/input.0.txt @@ -0,0 +1,7 @@ +3 +(1+2)*3+3 +2 +1*1*1+1*1*1 +587 +1*(2*3*4)+5+((6+7*8))*(9) +0 diff --git a/codenet/public_test_cases/p01115/input.1.txt b/codenet/public_test_cases/p01115/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0076d600392cf7849b84d6522eef644b981db0d8 --- /dev/null +++ b/codenet/public_test_cases/p01115/input.1.txt @@ -0,0 +1,7 @@ +3 +(1+2)*3+3 +2 +1*1*1+1*1*1 +587 +1*(2*3*4)+5+((6+7*8))*(9) +0 diff --git a/codenet/public_test_cases/p01115/output.0.txt b/codenet/public_test_cases/p01115/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be8d50347ef0017b16de5171b85881ae6d42b0e9 --- /dev/null +++ b/codenet/public_test_cases/p01115/output.0.txt @@ -0,0 +1,3 @@ +4 +9 +2 diff --git a/codenet/public_test_cases/p01115/output.1.txt b/codenet/public_test_cases/p01115/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..be8d50347ef0017b16de5171b85881ae6d42b0e9 --- /dev/null +++ b/codenet/public_test_cases/p01115/output.1.txt @@ -0,0 +1,3 @@ +4 +9 +2 diff --git a/codenet/public_test_cases/p01116/input.0.txt b/codenet/public_test_cases/p01116/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..89556e825c79f34e0be283f3360a434ad910b81c --- /dev/null +++ b/codenet/public_test_cases/p01116/input.0.txt @@ -0,0 +1,16 @@ +3 10 +5 4 3 +1 2 3 +1 2 +5 2 +5 40 +10 10 10 10 8 +1 2 3 4 5 +1 1 2 3 +10 10 10 10 +5 10 +2 2 2 5 2 +2 2 2 5 2 +1 1 2 2 +2 1 2 1 +0 0 diff --git a/codenet/public_test_cases/p01116/input.1.txt b/codenet/public_test_cases/p01116/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..89556e825c79f34e0be283f3360a434ad910b81c --- /dev/null +++ b/codenet/public_test_cases/p01116/input.1.txt @@ -0,0 +1,16 @@ +3 10 +5 4 3 +1 2 3 +1 2 +5 2 +5 40 +10 10 10 10 8 +1 2 3 4 5 +1 1 2 3 +10 10 10 10 +5 10 +2 2 2 5 2 +2 2 2 5 2 +1 1 2 2 +2 1 2 1 +0 0 diff --git a/codenet/public_test_cases/p01116/output.0.txt b/codenet/public_test_cases/p01116/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..44973e7878dc282c879033fa0418f896d6ed3bc9 --- /dev/null +++ b/codenet/public_test_cases/p01116/output.0.txt @@ -0,0 +1,3 @@ +18 +108 +35 diff --git a/codenet/public_test_cases/p01116/output.1.txt b/codenet/public_test_cases/p01116/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..44973e7878dc282c879033fa0418f896d6ed3bc9 --- /dev/null +++ b/codenet/public_test_cases/p01116/output.1.txt @@ -0,0 +1,3 @@ +18 +108 +35 diff --git a/codenet/public_test_cases/p01117/input.0.txt b/codenet/public_test_cases/p01117/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..17c53848da51e5e7099644c8d14fe1065b963192 --- /dev/null +++ b/codenet/public_test_cases/p01117/input.0.txt @@ -0,0 +1,11 @@ +5 2 +10 20 30 40 50 +15 25 35 45 55 +6 3 +10 20 30 15 25 35 +21 34 11 52 20 18 +31 15 42 10 21 19 +4 2 +0 0 0 0 +0 0 0 0 +0 0 diff --git a/codenet/public_test_cases/p01117/input.1.txt b/codenet/public_test_cases/p01117/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..17c53848da51e5e7099644c8d14fe1065b963192 --- /dev/null +++ b/codenet/public_test_cases/p01117/input.1.txt @@ -0,0 +1,11 @@ +5 2 +10 20 30 40 50 +15 25 35 45 55 +6 3 +10 20 30 15 25 35 +21 34 11 52 20 18 +31 15 42 10 21 19 +4 2 +0 0 0 0 +0 0 0 0 +0 0 diff --git a/codenet/public_test_cases/p01117/output.0.txt b/codenet/public_test_cases/p01117/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3099353c8a95ce6fbcaab83faf9027a3f91211f0 --- /dev/null +++ b/codenet/public_test_cases/p01117/output.0.txt @@ -0,0 +1,3 @@ +105 +83 +0 diff --git a/codenet/public_test_cases/p01117/output.1.txt b/codenet/public_test_cases/p01117/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3099353c8a95ce6fbcaab83faf9027a3f91211f0 --- /dev/null +++ b/codenet/public_test_cases/p01117/output.1.txt @@ -0,0 +1,3 @@ +105 +83 +0 diff --git a/codenet/public_test_cases/p01118/input.0.txt b/codenet/public_test_cases/p01118/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5115c1f4f37b6246c5f0a3c51bd4b18451e30474 --- /dev/null +++ b/codenet/public_test_cases/p01118/input.0.txt @@ -0,0 +1,19 @@ +3 9 +ABCDEFGHI +JKLMNOPQR +STUVWXYZ_ +ICPC +5 11 +___________ +____A______ +________M__ +___________ +_C_________ +ACM +4 21 +1_2_3_4_5_6_7_8_9_0_- +QqWwEeRrTtYyUuIiOoPp@ +AaSsDdFfGgHhJjKkLl;_: +ZzXxCcVvBbNnMm,_._/__ +ICPC2019,AsiaYokohamaRegional,QualificationRound +0 0 diff --git a/codenet/public_test_cases/p01118/input.1.txt b/codenet/public_test_cases/p01118/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5115c1f4f37b6246c5f0a3c51bd4b18451e30474 --- /dev/null +++ b/codenet/public_test_cases/p01118/input.1.txt @@ -0,0 +1,19 @@ +3 9 +ABCDEFGHI +JKLMNOPQR +STUVWXYZ_ +ICPC +5 11 +___________ +____A______ +________M__ +___________ +_C_________ +ACM +4 21 +1_2_3_4_5_6_7_8_9_0_- +QqWwEeRrTtYyUuIiOoPp@ +AaSsDdFfGgHhJjKkLl;_: +ZzXxCcVvBbNnMm,_._/__ +ICPC2019,AsiaYokohamaRegional,QualificationRound +0 0 diff --git a/codenet/public_test_cases/p01118/output.0.txt b/codenet/public_test_cases/p01118/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..167b6eeac728958aea105850a2a9898ab28ae438 --- /dev/null +++ b/codenet/public_test_cases/p01118/output.0.txt @@ -0,0 +1,3 @@ +28 +23 +493 diff --git a/codenet/public_test_cases/p01118/output.1.txt b/codenet/public_test_cases/p01118/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..167b6eeac728958aea105850a2a9898ab28ae438 --- /dev/null +++ b/codenet/public_test_cases/p01118/output.1.txt @@ -0,0 +1,3 @@ +28 +23 +493 diff --git a/codenet/public_test_cases/p01119/input.0.txt b/codenet/public_test_cases/p01119/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7ff18de89388ea2db8a0534a1e4db33e01a2da7 --- /dev/null +++ b/codenet/public_test_cases/p01119/input.0.txt @@ -0,0 +1,13 @@ +4 2 +9 2 7 11 +2 9 +6 2 +7 3 6 12 16 9 +2 9 +5 2 +7 3 6 12 17 +2 9 +7 5 +15 21 33 48 51 75 111 +36 54 57 93 113 +0 0 diff --git a/codenet/public_test_cases/p01119/input.1.txt b/codenet/public_test_cases/p01119/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7ff18de89388ea2db8a0534a1e4db33e01a2da7 --- /dev/null +++ b/codenet/public_test_cases/p01119/input.1.txt @@ -0,0 +1,13 @@ +4 2 +9 2 7 11 +2 9 +6 2 +7 3 6 12 16 9 +2 9 +5 2 +7 3 6 12 17 +2 9 +7 5 +15 21 33 48 51 75 111 +36 54 57 93 113 +0 0 diff --git a/codenet/public_test_cases/p01119/output.0.txt b/codenet/public_test_cases/p01119/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..883dd019e51cf1df3db4a7dd4d64c11b3fe4db25 --- /dev/null +++ b/codenet/public_test_cases/p01119/output.0.txt @@ -0,0 +1,4 @@ +0 +5 +-1 +5 diff --git a/codenet/public_test_cases/p01119/output.1.txt b/codenet/public_test_cases/p01119/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..883dd019e51cf1df3db4a7dd4d64c11b3fe4db25 --- /dev/null +++ b/codenet/public_test_cases/p01119/output.1.txt @@ -0,0 +1,4 @@ +0 +5 +-1 +5 diff --git a/codenet/public_test_cases/p01120/input.0.txt b/codenet/public_test_cases/p01120/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d52f788c06a0652d9be93cc4a4b757abd7105d2 --- /dev/null +++ b/codenet/public_test_cases/p01120/input.0.txt @@ -0,0 +1,10 @@ +4 5 +2 3 1 4 +2 5 5 2 +3 100 +1 10 100 +1 10 100 +5 10000 +4971 7482 1238 8523 1823 +3287 9013 9812 297 1809 +0 0 diff --git a/codenet/public_test_cases/p01120/input.1.txt b/codenet/public_test_cases/p01120/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d52f788c06a0652d9be93cc4a4b757abd7105d2 --- /dev/null +++ b/codenet/public_test_cases/p01120/input.1.txt @@ -0,0 +1,10 @@ +4 5 +2 3 1 4 +2 5 5 2 +3 100 +1 10 100 +1 10 100 +5 10000 +4971 7482 1238 8523 1823 +3287 9013 9812 297 1809 +0 0 diff --git a/codenet/public_test_cases/p01120/output.0.txt b/codenet/public_test_cases/p01120/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9f0614fb1628c29e67340d6893daed27a20875a --- /dev/null +++ b/codenet/public_test_cases/p01120/output.0.txt @@ -0,0 +1,3 @@ +4 +0 +14731 diff --git a/codenet/public_test_cases/p01120/output.1.txt b/codenet/public_test_cases/p01120/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9f0614fb1628c29e67340d6893daed27a20875a --- /dev/null +++ b/codenet/public_test_cases/p01120/output.1.txt @@ -0,0 +1,3 @@ +4 +0 +14731 diff --git a/codenet/public_test_cases/p01121/input.0.txt b/codenet/public_test_cases/p01121/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c85331ffc8db59bb670631cad9a0893bc9d35abe --- /dev/null +++ b/codenet/public_test_cases/p01121/input.0.txt @@ -0,0 +1,63 @@ +5 +..XX. +.XXX. +XXXXX +XXXXX +X.... +....X +XXXXX +.XXX. +.XXX. +..... +..XXX +XXXX. +.XXXX +.XXXX +...X. +...X. +.XXXX +XXXX. +XXXX. +.X.X. +XXX.X +.XXXX +XXXXX +.XXXX +.XXXX +XX... +.XXXX +XXXXX +XXXXX +XX... +5 +..XX. +.XXX. +XXXXX +XXXX. +X.... +....X +XXXXX +.XXX. +.XXX. +..... +.XXXX +XXXX. +.XXXX +.XXXX +...X. +...X. +.XXXX +XXXX. +XXXX. +.X.X. +XXX.X +.XXXX +XXXXX +.XXXX +.XXXX +XX... +XXXXX +XXXXX +.XXXX +XX... +0 diff --git a/codenet/public_test_cases/p01121/input.1.txt b/codenet/public_test_cases/p01121/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c85331ffc8db59bb670631cad9a0893bc9d35abe --- /dev/null +++ b/codenet/public_test_cases/p01121/input.1.txt @@ -0,0 +1,63 @@ +5 +..XX. +.XXX. +XXXXX +XXXXX +X.... +....X +XXXXX +.XXX. +.XXX. +..... +..XXX +XXXX. +.XXXX +.XXXX +...X. +...X. +.XXXX +XXXX. +XXXX. +.X.X. +XXX.X +.XXXX +XXXXX +.XXXX +.XXXX +XX... +.XXXX +XXXXX +XXXXX +XX... +5 +..XX. +.XXX. +XXXXX +XXXX. +X.... +....X +XXXXX +.XXX. +.XXX. +..... +.XXXX +XXXX. +.XXXX +.XXXX +...X. +...X. +.XXXX +XXXX. +XXXX. +.X.X. +XXX.X +.XXXX +XXXXX +.XXXX +.XXXX +XX... +XXXXX +XXXXX +.XXXX +XX... +0 diff --git a/codenet/public_test_cases/p01121/output.0.txt b/codenet/public_test_cases/p01121/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p01121/output.0.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p01121/output.1.txt b/codenet/public_test_cases/p01121/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p01121/output.1.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p01122/input.0.txt b/codenet/public_test_cases/p01122/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6bd038763e7bde68cbb2b4e477c6758bb510697 --- /dev/null +++ b/codenet/public_test_cases/p01122/input.0.txt @@ -0,0 +1,17 @@ +4 +3 3 1 +2 6 +-4 +3 +1 -10 +100 +5 +-2 -2 -2 -2 +-1 -1 -1 +-1 -1 +1 +4 +-4 7 6 +2 3 +-1 +0 diff --git a/codenet/public_test_cases/p01122/input.1.txt b/codenet/public_test_cases/p01122/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6bd038763e7bde68cbb2b4e477c6758bb510697 --- /dev/null +++ b/codenet/public_test_cases/p01122/input.1.txt @@ -0,0 +1,17 @@ +4 +3 3 1 +2 6 +-4 +3 +1 -10 +100 +5 +-2 -2 -2 -2 +-1 -1 -1 +-1 -1 +1 +4 +-4 7 6 +2 3 +-1 +0 diff --git a/codenet/public_test_cases/p01122/output.0.txt b/codenet/public_test_cases/p01122/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c38471455b5decf8bf7895433cb9ceec48d1fcee --- /dev/null +++ b/codenet/public_test_cases/p01122/output.0.txt @@ -0,0 +1,4 @@ +7 +11 +-1 +9 diff --git a/codenet/public_test_cases/p01122/output.1.txt b/codenet/public_test_cases/p01122/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c38471455b5decf8bf7895433cb9ceec48d1fcee --- /dev/null +++ b/codenet/public_test_cases/p01122/output.1.txt @@ -0,0 +1,4 @@ +7 +11 +-1 +9 diff --git a/codenet/public_test_cases/p01123/input.0.txt b/codenet/public_test_cases/p01123/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..49bff2ae25111250d8db0afd9e54d24126d73961 --- /dev/null +++ b/codenet/public_test_cases/p01123/input.0.txt @@ -0,0 +1,55 @@ +4 +..E. +.AD. +B... +..C. +D +4 +..E. +.AD. +B... +..C. +DR +3 +... +.A. +BC. +((URD)3L)2R +5 +...P. +PPPPP +PPP.. +PPPPP +..P.. +LRLR(LR)12RLLR +20 +.................... +.................... +.III..CC..PPP...CC.. +..I..C..C.P..P.C..C. +..I..C....P..P.C.... +..I..C....PPP..C.... +..I..C....P....C.... +..I..C..C.P....C..C. +.III..CC..P.....CC.. +.................... +..XX...XX...X...XX.. +.X..X.X..X..X..X..X. +....X.X..X..X..X..X. +...X..X..X..X..X..X. +...X..X..X..X...XXX. +..X...X..X..X.....X. +..X...X..X..X.....X. +.XXXX..XX...X...XX.. +.................... +.................... +((LDRU)1000(DLUR)2000(RULD)3000(URDL)4000)123456789012 +6 +...NE. +MFJ..G +...E.. +.FBN.K +....MN +RA.I.. +((((((((((((((((((((((((URD)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L +0 diff --git a/codenet/public_test_cases/p01123/input.1.txt b/codenet/public_test_cases/p01123/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..49bff2ae25111250d8db0afd9e54d24126d73961 --- /dev/null +++ b/codenet/public_test_cases/p01123/input.1.txt @@ -0,0 +1,55 @@ +4 +..E. +.AD. +B... +..C. +D +4 +..E. +.AD. +B... +..C. +DR +3 +... +.A. +BC. +((URD)3L)2R +5 +...P. +PPPPP +PPP.. +PPPPP +..P.. +LRLR(LR)12RLLR +20 +.................... +.................... +.III..CC..PPP...CC.. +..I..C..C.P..P.C..C. +..I..C....P..P.C.... +..I..C....PPP..C.... +..I..C....P....C.... +..I..C..C.P....C..C. +.III..CC..P.....CC.. +.................... +..XX...XX...X...XX.. +.X..X.X..X..X..X..X. +....X.X..X..X..X..X. +...X..X..X..X..X..X. +...X..X..X..X...XXX. +..X...X..X..X.....X. +..X...X..X..X.....X. +.XXXX..XX...X...XX.. +.................... +.................... +((LDRU)1000(DLUR)2000(RULD)3000(URDL)4000)123456789012 +6 +...NE. +MFJ..G +...E.. +.FBN.K +....MN +RA.I.. +((((((((((((((((((((((((URD)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L)2L +0 diff --git a/codenet/public_test_cases/p01123/output.0.txt b/codenet/public_test_cases/p01123/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78f669ede6a3890f0bdc815c89e80b29d86774f5 --- /dev/null +++ b/codenet/public_test_cases/p01123/output.0.txt @@ -0,0 +1,42 @@ +.... +..E. +..D. +BAC. +.... +...E +...D +.BAC +... +..C +.AB +....P +PPPPP +..PPP +PPPPP +....P +.................... +.................... +.................... +.................... +.................... +XXXX................ +PXXXX............... +CXXXX............... +XXXXX............... +XXPCXX.............. +CCXXCX.............. +CXXXXX.............. +CXXXXX.............. +CPCIXXX............. +CXPPCXX............. +PCXXXIC............. +CPPCCXI............. +CXCIPXXX............ +XCPCICIXX........... +PIPPICIXII.......... +...... +...... +N..... +JNG... +RMMKFE +BEAIFN diff --git a/codenet/public_test_cases/p01123/output.1.txt b/codenet/public_test_cases/p01123/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78f669ede6a3890f0bdc815c89e80b29d86774f5 --- /dev/null +++ b/codenet/public_test_cases/p01123/output.1.txt @@ -0,0 +1,42 @@ +.... +..E. +..D. +BAC. +.... +...E +...D +.BAC +... +..C +.AB +....P +PPPPP +..PPP +PPPPP +....P +.................... +.................... +.................... +.................... +.................... +XXXX................ +PXXXX............... +CXXXX............... +XXXXX............... +XXPCXX.............. +CCXXCX.............. +CXXXXX.............. +CXXXXX.............. +CPCIXXX............. +CXPPCXX............. +PCXXXIC............. +CPPCCXI............. +CXCIPXXX............ +XCPCICIXX........... +PIPPICIXII.......... +...... +...... +N..... +JNG... +RMMKFE +BEAIFN diff --git a/codenet/public_test_cases/p01124/input.0.txt b/codenet/public_test_cases/p01124/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..219d7f66c164ee5ac7386ad06f62887d2dae55a0 --- /dev/null +++ b/codenet/public_test_cases/p01124/input.0.txt @@ -0,0 +1,51 @@ +5 3 +0 0 +2 0 +2 1 +1 2 +0 2 +0 0 +1 0 +0 1 +4 4 +0 0 +5 0 +5 5 +0 5 +0 0 +2 0 +2 2 +0 2 +3 3 +0 0 +1 0 +0 1 +0 1 +0 0 +1 1 +3 3 +0 0 +1 0 +1 1 +0 0 +1 0 +1 1 +4 4 +0 0 +2 0 +2 2 +0 2 +0 0 +1 0 +1 2 +0 2 +4 4 +0 0 +3 0 +3 1 +0 1 +0 0 +1 0 +1 1 +0 1 +0 0 diff --git a/codenet/public_test_cases/p01124/input.1.txt b/codenet/public_test_cases/p01124/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..219d7f66c164ee5ac7386ad06f62887d2dae55a0 --- /dev/null +++ b/codenet/public_test_cases/p01124/input.1.txt @@ -0,0 +1,51 @@ +5 3 +0 0 +2 0 +2 1 +1 2 +0 2 +0 0 +1 0 +0 1 +4 4 +0 0 +5 0 +5 5 +0 5 +0 0 +2 0 +2 2 +0 2 +3 3 +0 0 +1 0 +0 1 +0 1 +0 0 +1 1 +3 3 +0 0 +1 0 +1 1 +0 0 +1 0 +1 1 +4 4 +0 0 +2 0 +2 2 +0 2 +0 0 +1 0 +1 2 +0 2 +4 4 +0 0 +3 0 +3 1 +0 1 +0 0 +1 0 +1 1 +0 1 +0 0 diff --git a/codenet/public_test_cases/p01124/output.0.txt b/codenet/public_test_cases/p01124/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..366296807f14b693f4d332d954a22c7b30d7480b --- /dev/null +++ b/codenet/public_test_cases/p01124/output.0.txt @@ -0,0 +1,6 @@ +3 +2 +2 +1 +0 +2 diff --git a/codenet/public_test_cases/p01124/output.1.txt b/codenet/public_test_cases/p01124/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..366296807f14b693f4d332d954a22c7b30d7480b --- /dev/null +++ b/codenet/public_test_cases/p01124/output.1.txt @@ -0,0 +1,6 @@ +3 +2 +2 +1 +0 +2 diff --git a/codenet/public_test_cases/p01125/input.0.txt b/codenet/public_test_cases/p01125/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0712c6c71190e40cbb5bb9fd62747ed205028bc7 --- /dev/null +++ b/codenet/public_test_cases/p01125/input.0.txt @@ -0,0 +1,23 @@ +2 +10 11 +11 12 +2 +N 2 +E 1 +2 +10 11 +11 12 +2 +N 2 +W 1 +3 +0 15 +5 10 +5 15 +5 +W 10 +S 10 +N 20 +E 10 +S 10 +0 diff --git a/codenet/public_test_cases/p01125/input.1.txt b/codenet/public_test_cases/p01125/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0712c6c71190e40cbb5bb9fd62747ed205028bc7 --- /dev/null +++ b/codenet/public_test_cases/p01125/input.1.txt @@ -0,0 +1,23 @@ +2 +10 11 +11 12 +2 +N 2 +E 1 +2 +10 11 +11 12 +2 +N 2 +W 1 +3 +0 15 +5 10 +5 15 +5 +W 10 +S 10 +N 20 +E 10 +S 10 +0 diff --git a/codenet/public_test_cases/p01125/output.0.txt b/codenet/public_test_cases/p01125/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bf36cc5d20dabeb408ab3ef5f5dfcf9cf66dd41 --- /dev/null +++ b/codenet/public_test_cases/p01125/output.0.txt @@ -0,0 +1,3 @@ +Yes +No +No diff --git a/codenet/public_test_cases/p01125/output.1.txt b/codenet/public_test_cases/p01125/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bf36cc5d20dabeb408ab3ef5f5dfcf9cf66dd41 --- /dev/null +++ b/codenet/public_test_cases/p01125/output.1.txt @@ -0,0 +1,3 @@ +Yes +No +No diff --git a/codenet/public_test_cases/p01126/input.0.txt b/codenet/public_test_cases/p01126/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fecaaf9306113c51ee72dec53d1d76bac3d7346 --- /dev/null +++ b/codenet/public_test_cases/p01126/input.0.txt @@ -0,0 +1,6 @@ +4 4 1 +3 1 2 +2 2 3 +3 3 4 +1 3 4 +0 0 0 diff --git a/codenet/public_test_cases/p01126/input.1.txt b/codenet/public_test_cases/p01126/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fecaaf9306113c51ee72dec53d1d76bac3d7346 --- /dev/null +++ b/codenet/public_test_cases/p01126/input.1.txt @@ -0,0 +1,6 @@ +4 4 1 +3 1 2 +2 2 3 +3 3 4 +1 3 4 +0 0 0 diff --git a/codenet/public_test_cases/p01126/output.0.txt b/codenet/public_test_cases/p01126/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01126/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01126/output.1.txt b/codenet/public_test_cases/p01126/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01126/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01127/input.0.txt b/codenet/public_test_cases/p01127/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2f5b6b7130913165a95557355232a5a7e6484dd --- /dev/null +++ b/codenet/public_test_cases/p01127/input.0.txt @@ -0,0 +1,57 @@ +6 +1 1 +. +3 3 +... +.W. +... +10 10 +.......... +.DDDDCCC.. +.DDDDCCC.. +.DDDDCCC.. +ADDDDCCC.. +AAA..CCC.. +AAABBBBC.. +AAABBBB... +..BBBBB... +.......... +10 10 +.......... +.DDDDDD... +.DDDDCCC.. +.DDDDCCC.. +ADDDDCCC.. +AAA..CCC.. +AAABBBBC.. +AAABBBB... +..BBBBB... +.......... +10 10 +R..E..C.T. +R.EEE.C.T. +.EEEEE.... +EEEEEEE... +.EEEEEEE.. +..EEEEEEE. +...EEEEEEE +....EEEEE. +.....EEE.. +......E... +16 50 +.................................................. +.........AAAAAAAAAAAAAAAA......................... +....PPP...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..... +....PPP...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..... +....PPP...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.... +....PPP..............AAAAA.AAAAAAAAAAAAAAAA....... +....PPP................A....AAA.AAAAAAAAAA........ +....PPP...........IIIIIAAIIAIII.AAAAAAAAAA........ +..CCCCCCCCCCCCC...IIIIIIAAAAAAAAAAAAAAAAAA........ +..CCCCCCCCCCCCC...IIIIIIIIIIIII...AAAAAAAAAA...... +....PPP............................AAAAAAAAAA..... +MMMMPPPMMMMMMMMMMMMMMM.............AAAAAAAAAAA.... +MMMMPPPMMMMMMMMMMMMMMM..............AAAAAAAAAAA... +MMMMMMMMMMMMMMMMMMMMMM...............AAAAAAAAAA... +MMMMMMMMMMMMMMMMMMMMMM...............AAAAAAAAAA... +MMMMMMMMMMMMMMMMMMMMMM............................ diff --git a/codenet/public_test_cases/p01127/input.1.txt b/codenet/public_test_cases/p01127/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2f5b6b7130913165a95557355232a5a7e6484dd --- /dev/null +++ b/codenet/public_test_cases/p01127/input.1.txt @@ -0,0 +1,57 @@ +6 +1 1 +. +3 3 +... +.W. +... +10 10 +.......... +.DDDDCCC.. +.DDDDCCC.. +.DDDDCCC.. +ADDDDCCC.. +AAA..CCC.. +AAABBBBC.. +AAABBBB... +..BBBBB... +.......... +10 10 +.......... +.DDDDDD... +.DDDDCCC.. +.DDDDCCC.. +ADDDDCCC.. +AAA..CCC.. +AAABBBBC.. +AAABBBB... +..BBBBB... +.......... +10 10 +R..E..C.T. +R.EEE.C.T. +.EEEEE.... +EEEEEEE... +.EEEEEEE.. +..EEEEEEE. +...EEEEEEE +....EEEEE. +.....EEE.. +......E... +16 50 +.................................................. +.........AAAAAAAAAAAAAAAA......................... +....PPP...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..... +....PPP...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..... +....PPP...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.... +....PPP..............AAAAA.AAAAAAAAAAAAAAAA....... +....PPP................A....AAA.AAAAAAAAAA........ +....PPP...........IIIIIAAIIAIII.AAAAAAAAAA........ +..CCCCCCCCCCCCC...IIIIIIAAAAAAAAAAAAAAAAAA........ +..CCCCCCCCCCCCC...IIIIIIIIIIIII...AAAAAAAAAA...... +....PPP............................AAAAAAAAAA..... +MMMMPPPMMMMMMMMMMMMMMM.............AAAAAAAAAAA.... +MMMMPPPMMMMMMMMMMMMMMM..............AAAAAAAAAAA... +MMMMMMMMMMMMMMMMMMMMMM...............AAAAAAAAAA... +MMMMMMMMMMMMMMMMMMMMMM...............AAAAAAAAAA... +MMMMMMMMMMMMMMMMMMMMMM............................ diff --git a/codenet/public_test_cases/p01127/output.0.txt b/codenet/public_test_cases/p01127/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..150ef565f2000f86d0d0fb1b057ac0c76a31b828 --- /dev/null +++ b/codenet/public_test_cases/p01127/output.0.txt @@ -0,0 +1,6 @@ +SAFE +SAFE +SAFE +SUSPICIOUS +SUSPICIOUS +SUSPICIOUS diff --git a/codenet/public_test_cases/p01127/output.1.txt b/codenet/public_test_cases/p01127/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..150ef565f2000f86d0d0fb1b057ac0c76a31b828 --- /dev/null +++ b/codenet/public_test_cases/p01127/output.1.txt @@ -0,0 +1,6 @@ +SAFE +SAFE +SAFE +SUSPICIOUS +SUSPICIOUS +SUSPICIOUS diff --git a/codenet/public_test_cases/p01128/input.0.txt b/codenet/public_test_cases/p01128/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32454884cfa4de2cf64dd5e61ec22c75cf56e7a9 --- /dev/null +++ b/codenet/public_test_cases/p01128/input.0.txt @@ -0,0 +1,17 @@ +2 +-10 1 10 1 +4 +-6 2 -2 -2 0 1 +-6 -2 -2 2 1 0 +6 2 2 -2 0 0 +6 -2 2 2 1 1 +8 12 -7 -3 +8 +4 -5 4 -2 1 1 +4 -2 4 9 1 0 +6 9 6 14 1 1 +-7 6 7 6 0 0 +1 0 1 10 0 0 +-5 0 -5 10 0 1 +-7 0 7 0 0 1 +-1 0 -1 -5 0 1 diff --git a/codenet/public_test_cases/p01128/input.1.txt b/codenet/public_test_cases/p01128/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32454884cfa4de2cf64dd5e61ec22c75cf56e7a9 --- /dev/null +++ b/codenet/public_test_cases/p01128/input.1.txt @@ -0,0 +1,17 @@ +2 +-10 1 10 1 +4 +-6 2 -2 -2 0 1 +-6 -2 -2 2 1 0 +6 2 2 -2 0 0 +6 -2 2 2 1 1 +8 12 -7 -3 +8 +4 -5 4 -2 1 1 +4 -2 4 9 1 0 +6 9 6 14 1 1 +-7 6 7 6 0 0 +1 0 1 10 0 0 +-5 0 -5 10 0 1 +-7 0 7 0 0 1 +-1 0 -1 -5 0 1 diff --git a/codenet/public_test_cases/p01128/output.0.txt b/codenet/public_test_cases/p01128/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p01128/output.0.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p01128/output.1.txt b/codenet/public_test_cases/p01128/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p01128/output.1.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p01129/input.0.txt b/codenet/public_test_cases/p01129/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f52fca66476ef7c4d5e8a9bc3183ade1ef04706a --- /dev/null +++ b/codenet/public_test_cases/p01129/input.0.txt @@ -0,0 +1,7 @@ +5 2 +5000 +10 20 0 30 5 +10 1000 6 1 +20 500 8 1 +3 40 25 30 +0 0 diff --git a/codenet/public_test_cases/p01129/input.1.txt b/codenet/public_test_cases/p01129/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f52fca66476ef7c4d5e8a9bc3183ade1ef04706a --- /dev/null +++ b/codenet/public_test_cases/p01129/input.1.txt @@ -0,0 +1,7 @@ +5 2 +5000 +10 20 0 30 5 +10 1000 6 1 +20 500 8 1 +3 40 25 30 +0 0 diff --git a/codenet/public_test_cases/p01129/output.0.txt b/codenet/public_test_cases/p01129/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a269a13c508634846490474c2182c111384f02aa --- /dev/null +++ b/codenet/public_test_cases/p01129/output.0.txt @@ -0,0 +1 @@ +50 84.000 diff --git a/codenet/public_test_cases/p01129/output.1.txt b/codenet/public_test_cases/p01129/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a269a13c508634846490474c2182c111384f02aa --- /dev/null +++ b/codenet/public_test_cases/p01129/output.1.txt @@ -0,0 +1 @@ +50 84.000 diff --git a/codenet/public_test_cases/p01130/input.0.txt b/codenet/public_test_cases/p01130/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffbdda0a0a7ffa7587137ff5dd7eafc157c785e5 --- /dev/null +++ b/codenet/public_test_cases/p01130/input.0.txt @@ -0,0 +1,7 @@ +4 5 1 3 4 +1 2 5 +2 3 5 +2 4 5 +1 3 8 +1 4 8 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01130/input.1.txt b/codenet/public_test_cases/p01130/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffbdda0a0a7ffa7587137ff5dd7eafc157c785e5 --- /dev/null +++ b/codenet/public_test_cases/p01130/input.1.txt @@ -0,0 +1,7 @@ +4 5 1 3 4 +1 2 5 +2 3 5 +2 4 5 +1 3 8 +1 4 8 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01130/output.0.txt b/codenet/public_test_cases/p01130/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01130/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01130/output.1.txt b/codenet/public_test_cases/p01130/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01130/output.1.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01131/input.0.txt b/codenet/public_test_cases/p01131/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ada384fc2c42d4ec8f14147d9c18235fb6287d0 --- /dev/null +++ b/codenet/public_test_cases/p01131/input.0.txt @@ -0,0 +1,6 @@ +5 +20 +220 +222220 +44033055505550666011011111090666077705550301110 +000555555550000330000444000080000200004440000 diff --git a/codenet/public_test_cases/p01131/input.1.txt b/codenet/public_test_cases/p01131/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ada384fc2c42d4ec8f14147d9c18235fb6287d0 --- /dev/null +++ b/codenet/public_test_cases/p01131/input.1.txt @@ -0,0 +1,6 @@ +5 +20 +220 +222220 +44033055505550666011011111090666077705550301110 +000555555550000330000444000080000200004440000 diff --git a/codenet/public_test_cases/p01131/output.0.txt b/codenet/public_test_cases/p01131/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eeda45ef4bd85e787d33ea76be39c76a97c3e21d --- /dev/null +++ b/codenet/public_test_cases/p01131/output.0.txt @@ -0,0 +1,5 @@ +a +b +b +hello, world! +keitai diff --git a/codenet/public_test_cases/p01131/output.1.txt b/codenet/public_test_cases/p01131/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eeda45ef4bd85e787d33ea76be39c76a97c3e21d --- /dev/null +++ b/codenet/public_test_cases/p01131/output.1.txt @@ -0,0 +1,5 @@ +a +b +b +hello, world! +keitai diff --git a/codenet/public_test_cases/p01132/input.0.txt b/codenet/public_test_cases/p01132/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..609e9fb79cbbb2f46e2469a888c153cfcae6b0ad --- /dev/null +++ b/codenet/public_test_cases/p01132/input.0.txt @@ -0,0 +1,5 @@ +160 +1 1 2 0 +160 +1 0 2 10 +0 diff --git a/codenet/public_test_cases/p01132/input.1.txt b/codenet/public_test_cases/p01132/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..609e9fb79cbbb2f46e2469a888c153cfcae6b0ad --- /dev/null +++ b/codenet/public_test_cases/p01132/input.1.txt @@ -0,0 +1,5 @@ +160 +1 1 2 0 +160 +1 0 2 10 +0 diff --git a/codenet/public_test_cases/p01132/output.0.txt b/codenet/public_test_cases/p01132/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cabd566a5e0a59a8b120c94e491a854ebd3fcc0f --- /dev/null +++ b/codenet/public_test_cases/p01132/output.0.txt @@ -0,0 +1,6 @@ +10 1 +50 1 +100 1 + +10 1 +100 2 diff --git a/codenet/public_test_cases/p01132/output.1.txt b/codenet/public_test_cases/p01132/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cabd566a5e0a59a8b120c94e491a854ebd3fcc0f --- /dev/null +++ b/codenet/public_test_cases/p01132/output.1.txt @@ -0,0 +1,6 @@ +10 1 +50 1 +100 1 + +10 1 +100 2 diff --git a/codenet/public_test_cases/p01133/input.0.txt b/codenet/public_test_cases/p01133/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b94ef9ffdfc6081a55f1dbd3eb1bad63e4f90e2e --- /dev/null +++ b/codenet/public_test_cases/p01133/input.0.txt @@ -0,0 +1,10 @@ +2 0 0 10 10 +1 1 +4 4 +2 0 0 10 10 +1 1 +6 6 +2 0 0 10 10 +1 1 +5 5 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01133/input.1.txt b/codenet/public_test_cases/p01133/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b94ef9ffdfc6081a55f1dbd3eb1bad63e4f90e2e --- /dev/null +++ b/codenet/public_test_cases/p01133/input.1.txt @@ -0,0 +1,10 @@ +2 0 0 10 10 +1 1 +4 4 +2 0 0 10 10 +1 1 +6 6 +2 0 0 10 10 +1 1 +5 5 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01133/output.0.txt b/codenet/public_test_cases/p01133/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6e03a3424cbc9fd3c1c5139fbef28b53ec422af --- /dev/null +++ b/codenet/public_test_cases/p01133/output.0.txt @@ -0,0 +1,3 @@ +YES +NO +NO diff --git a/codenet/public_test_cases/p01133/output.1.txt b/codenet/public_test_cases/p01133/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6e03a3424cbc9fd3c1c5139fbef28b53ec422af --- /dev/null +++ b/codenet/public_test_cases/p01133/output.1.txt @@ -0,0 +1,3 @@ +YES +NO +NO diff --git a/codenet/public_test_cases/p01134/input.0.txt b/codenet/public_test_cases/p01134/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4d6f65946d9edf6b491dad45547022c74e631ed --- /dev/null +++ b/codenet/public_test_cases/p01134/input.0.txt @@ -0,0 +1,7 @@ +2 +-100 -20 100 20 +-20 -100 20 100 +2 +-100 -20 -20 -100 +20 100 100 20 +0 diff --git a/codenet/public_test_cases/p01134/input.1.txt b/codenet/public_test_cases/p01134/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4d6f65946d9edf6b491dad45547022c74e631ed --- /dev/null +++ b/codenet/public_test_cases/p01134/input.1.txt @@ -0,0 +1,7 @@ +2 +-100 -20 100 20 +-20 -100 20 100 +2 +-100 -20 -20 -100 +20 100 100 20 +0 diff --git a/codenet/public_test_cases/p01134/output.0.txt b/codenet/public_test_cases/p01134/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81450f3d334f886509a186abffcf1a1aee0866a5 --- /dev/null +++ b/codenet/public_test_cases/p01134/output.0.txt @@ -0,0 +1,2 @@ +4 +3 diff --git a/codenet/public_test_cases/p01134/output.1.txt b/codenet/public_test_cases/p01134/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81450f3d334f886509a186abffcf1a1aee0866a5 --- /dev/null +++ b/codenet/public_test_cases/p01134/output.1.txt @@ -0,0 +1,2 @@ +4 +3 diff --git a/codenet/public_test_cases/p01135/input.0.txt b/codenet/public_test_cases/p01135/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..193db4aa2c0c2e03468eb1cf1d8d2156c61dcbfa --- /dev/null +++ b/codenet/public_test_cases/p01135/input.0.txt @@ -0,0 +1,18 @@ +4 5 +1 2 10 +1 3 15 +2 3 5 +2 4 3 +3 4 10 +2 +1 4 10 LoveLetter +2 3 20 Greetings +3 3 +1 2 1 +2 3 1 +3 1 1 +3 +1 2 1 BusinessMailC +2 3 1 BusinessMailB +3 1 1 BusinessMailA +0 0 diff --git a/codenet/public_test_cases/p01135/input.1.txt b/codenet/public_test_cases/p01135/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..193db4aa2c0c2e03468eb1cf1d8d2156c61dcbfa --- /dev/null +++ b/codenet/public_test_cases/p01135/input.1.txt @@ -0,0 +1,18 @@ +4 5 +1 2 10 +1 3 15 +2 3 5 +2 4 3 +3 4 10 +2 +1 4 10 LoveLetter +2 3 20 Greetings +3 3 +1 2 1 +2 3 1 +3 1 1 +3 +1 2 1 BusinessMailC +2 3 1 BusinessMailB +3 1 1 BusinessMailA +0 0 diff --git a/codenet/public_test_cases/p01135/output.0.txt b/codenet/public_test_cases/p01135/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ef1284ea44376ef4a8e88ecdd80ac9087f2bfc9 --- /dev/null +++ b/codenet/public_test_cases/p01135/output.0.txt @@ -0,0 +1,6 @@ +Greetings 25 +LoveLetter 33 + +BusinessMailA 2 +BusinessMailB 2 +BusinessMailC 2 diff --git a/codenet/public_test_cases/p01135/output.1.txt b/codenet/public_test_cases/p01135/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ef1284ea44376ef4a8e88ecdd80ac9087f2bfc9 --- /dev/null +++ b/codenet/public_test_cases/p01135/output.1.txt @@ -0,0 +1,6 @@ +Greetings 25 +LoveLetter 33 + +BusinessMailA 2 +BusinessMailB 2 +BusinessMailC 2 diff --git a/codenet/public_test_cases/p01136/input.0.txt b/codenet/public_test_cases/p01136/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a55d8ad8b334ecf7c1812261c296e0f94aa3e5a --- /dev/null +++ b/codenet/public_test_cases/p01136/input.0.txt @@ -0,0 +1,6 @@ +4 +1 1 +2 2 3 +2 1 2 +3 3 4 5 +0 diff --git a/codenet/public_test_cases/p01136/input.1.txt b/codenet/public_test_cases/p01136/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a55d8ad8b334ecf7c1812261c296e0f94aa3e5a --- /dev/null +++ b/codenet/public_test_cases/p01136/input.1.txt @@ -0,0 +1,6 @@ +4 +1 1 +2 2 3 +2 1 2 +3 3 4 5 +0 diff --git a/codenet/public_test_cases/p01136/output.0.txt b/codenet/public_test_cases/p01136/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01136/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01136/output.1.txt b/codenet/public_test_cases/p01136/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01136/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01137/input.0.txt b/codenet/public_test_cases/p01137/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..078fb536f108940533b25364557b17472c7ab364 --- /dev/null +++ b/codenet/public_test_cases/p01137/input.0.txt @@ -0,0 +1,7 @@ +1 +2 +4 +27 +300 +1250 +0 diff --git a/codenet/public_test_cases/p01137/input.1.txt b/codenet/public_test_cases/p01137/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..078fb536f108940533b25364557b17472c7ab364 --- /dev/null +++ b/codenet/public_test_cases/p01137/input.1.txt @@ -0,0 +1,7 @@ +1 +2 +4 +27 +300 +1250 +0 diff --git a/codenet/public_test_cases/p01137/output.0.txt b/codenet/public_test_cases/p01137/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27469545ac6271314db950cb0f1f943042f64d7b --- /dev/null +++ b/codenet/public_test_cases/p01137/output.0.txt @@ -0,0 +1,6 @@ +1 +2 +2 +3 +18 +44 diff --git a/codenet/public_test_cases/p01137/output.1.txt b/codenet/public_test_cases/p01137/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27469545ac6271314db950cb0f1f943042f64d7b --- /dev/null +++ b/codenet/public_test_cases/p01137/output.1.txt @@ -0,0 +1,6 @@ +1 +2 +2 +3 +18 +44 diff --git a/codenet/public_test_cases/p01138/input.0.txt b/codenet/public_test_cases/p01138/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c4fffadd257878fe11b0e0d274fa37337465df1 --- /dev/null +++ b/codenet/public_test_cases/p01138/input.0.txt @@ -0,0 +1,12 @@ +3 +05:47:15 09:54:40 +12:12:59 12:13:00 +16:30:20 21:18:53 +6 +00:00:00 03:00:00 +01:00:00 03:00:00 +02:00:00 03:00:00 +03:00:00 04:00:00 +03:00:00 05:00:00 +03:00:00 06:00:00 +0 diff --git a/codenet/public_test_cases/p01138/input.1.txt b/codenet/public_test_cases/p01138/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c4fffadd257878fe11b0e0d274fa37337465df1 --- /dev/null +++ b/codenet/public_test_cases/p01138/input.1.txt @@ -0,0 +1,12 @@ +3 +05:47:15 09:54:40 +12:12:59 12:13:00 +16:30:20 21:18:53 +6 +00:00:00 03:00:00 +01:00:00 03:00:00 +02:00:00 03:00:00 +03:00:00 04:00:00 +03:00:00 05:00:00 +03:00:00 06:00:00 +0 diff --git a/codenet/public_test_cases/p01138/output.0.txt b/codenet/public_test_cases/p01138/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p01138/output.0.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p01138/output.1.txt b/codenet/public_test_cases/p01138/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p01138/output.1.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p01139/input.0.txt b/codenet/public_test_cases/p01139/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88b42350b06d70bf243e2b9029cae371286b0887 --- /dev/null +++ b/codenet/public_test_cases/p01139/input.0.txt @@ -0,0 +1,18 @@ +10 10 +.....W.... +....W.W... +...W...W.. +....W...W. +.....W...W +......W.W. +BBB....W.. +..B..BBBBB +..B..B.... +..B..B..W. +5 3 +...B. +...BB +..... +1 1 +. +0 0 diff --git a/codenet/public_test_cases/p01139/input.1.txt b/codenet/public_test_cases/p01139/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..88b42350b06d70bf243e2b9029cae371286b0887 --- /dev/null +++ b/codenet/public_test_cases/p01139/input.1.txt @@ -0,0 +1,18 @@ +10 10 +.....W.... +....W.W... +...W...W.. +....W...W. +.....W...W +......W.W. +BBB....W.. +..B..BBBBB +..B..B.... +..B..B..W. +5 3 +...B. +...BB +..... +1 1 +. +0 0 diff --git a/codenet/public_test_cases/p01139/output.0.txt b/codenet/public_test_cases/p01139/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7948314237a7bb50e0a7e0f78e887125a7d3df11 --- /dev/null +++ b/codenet/public_test_cases/p01139/output.0.txt @@ -0,0 +1,3 @@ +6 21 +12 0 +0 0 diff --git a/codenet/public_test_cases/p01139/output.1.txt b/codenet/public_test_cases/p01139/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7948314237a7bb50e0a7e0f78e887125a7d3df11 --- /dev/null +++ b/codenet/public_test_cases/p01139/output.1.txt @@ -0,0 +1,3 @@ +6 21 +12 0 +0 0 diff --git a/codenet/public_test_cases/p01140/input.0.txt b/codenet/public_test_cases/p01140/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4aded3f83e8bd3e0499bb6509f3820feeba34578 --- /dev/null +++ b/codenet/public_test_cases/p01140/input.0.txt @@ -0,0 +1,12 @@ +3 3 +1 +1 +4 +2 +3 +1 +1 2 +10 +10 +10 +0 0 diff --git a/codenet/public_test_cases/p01140/input.1.txt b/codenet/public_test_cases/p01140/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4aded3f83e8bd3e0499bb6509f3820feeba34578 --- /dev/null +++ b/codenet/public_test_cases/p01140/input.1.txt @@ -0,0 +1,12 @@ +3 3 +1 +1 +4 +2 +3 +1 +1 2 +10 +10 +10 +0 0 diff --git a/codenet/public_test_cases/p01140/output.0.txt b/codenet/public_test_cases/p01140/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74abe52ea08f303355ad2b8a25939c5ba57c9224 --- /dev/null +++ b/codenet/public_test_cases/p01140/output.0.txt @@ -0,0 +1,2 @@ +6 +2 diff --git a/codenet/public_test_cases/p01140/output.1.txt b/codenet/public_test_cases/p01140/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74abe52ea08f303355ad2b8a25939c5ba57c9224 --- /dev/null +++ b/codenet/public_test_cases/p01140/output.1.txt @@ -0,0 +1,2 @@ +6 +2 diff --git a/codenet/public_test_cases/p01141/input.0.txt b/codenet/public_test_cases/p01141/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55ea99b537d1d040204db1c24a68c6aa09f26f0f --- /dev/null +++ b/codenet/public_test_cases/p01141/input.0.txt @@ -0,0 +1,25 @@ +4 +0 0 10 0 10 10 0 10 +10 +12 +0 5 +9 5 +4 +0 0 10 0 10 10 0 10 +10 +12 +0 0 +9 1 +4 +0 0 10 0 10 10 0 10 +10 +12 +0 1 +9 1 +8 +2 0 4 0 6 2 6 4 4 6 2 6 0 4 0 2 +10 +12 +3 0 +3 5 +0 diff --git a/codenet/public_test_cases/p01141/input.1.txt b/codenet/public_test_cases/p01141/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..55ea99b537d1d040204db1c24a68c6aa09f26f0f --- /dev/null +++ b/codenet/public_test_cases/p01141/input.1.txt @@ -0,0 +1,25 @@ +4 +0 0 10 0 10 10 0 10 +10 +12 +0 5 +9 5 +4 +0 0 10 0 10 10 0 10 +10 +12 +0 0 +9 1 +4 +0 0 10 0 10 10 0 10 +10 +12 +0 1 +9 1 +8 +2 0 4 0 6 2 6 4 4 6 2 6 0 4 0 2 +10 +12 +3 0 +3 5 +0 diff --git a/codenet/public_test_cases/p01141/output.0.txt b/codenet/public_test_cases/p01141/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11a685aa4f9287958b56cce87fb53d9241e8e48c --- /dev/null +++ b/codenet/public_test_cases/p01141/output.0.txt @@ -0,0 +1,4 @@ +108.0 +96.63324958071081 +103.2664991614216 +60.0 diff --git a/codenet/public_test_cases/p01141/output.1.txt b/codenet/public_test_cases/p01141/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11a685aa4f9287958b56cce87fb53d9241e8e48c --- /dev/null +++ b/codenet/public_test_cases/p01141/output.1.txt @@ -0,0 +1,4 @@ +108.0 +96.63324958071081 +103.2664991614216 +60.0 diff --git a/codenet/public_test_cases/p01142/input.0.txt b/codenet/public_test_cases/p01142/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cb2b2854f77bba31457c0112912264e8517251e --- /dev/null +++ b/codenet/public_test_cases/p01142/input.0.txt @@ -0,0 +1,105 @@ +5 3 +##### +#K.M# +##### +9 5 +######### +#.....### +#.###..M# +#K####### +######### +9 5 +######### +#K......# +####.#### +####M#### +######### +9 5 +######### +#M......# +####.#### +####K#### +######### +7 9 +####### +#####M# +#####.# +#.....# +#.###.# +#.....# +#.##### +#K##### +####### +7 6 +####### +#####.# +##....# +#K..#.# +###M#.# +####### +7 8 +####### +##...## +###.#M# +#.....# +#.#...# +#.#..## +#.K#### +####### +9 6 +######### +###..##.# +##......# +#K....#.# +##..#M#.# +######### +9 6 +######### +#.####### +#....#M.# +#.#...#.# +###K#...# +######### +12 7 +############ +###...####.# +##K#...M##.# +##.....#...# +#........#.# +###..#...#.# +############ +23 16 +####################### +#########...########### +##########.###.######## +##########.....######## +##########.#.#.###...## +########.#.#.######.### +########............### +########.###.######.### +############.######.### +#K...........######.### +####.#######.######.### +####.#######.######.### +####.................M# +####.#######.########## +###...#####...######### +####################### +46 16 +############################################## +#..............#..############################ +#..#..........#.#.###....#...................# +#.................###.#.#.#...............#..# +#...#..#....#...#.###.#......................# +#...#....#....#.#.###.#.#...#....#....#..#...# +#.#........#..........#.#.#....#....#....#...# +#...#...#.......###.#........#.........#...#.# +#.#...#.........###.#..##.......#........#...# +#...#........#..###.#..##.........#........#.# +#...............###.#..##..#.........#...#...# +############.######.#..##....................# +###########K...........#.########.############ +###################...............M########### +##################.......##################### +############################################## +0 0 diff --git a/codenet/public_test_cases/p01142/input.1.txt b/codenet/public_test_cases/p01142/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cb2b2854f77bba31457c0112912264e8517251e --- /dev/null +++ b/codenet/public_test_cases/p01142/input.1.txt @@ -0,0 +1,105 @@ +5 3 +##### +#K.M# +##### +9 5 +######### +#.....### +#.###..M# +#K####### +######### +9 5 +######### +#K......# +####.#### +####M#### +######### +9 5 +######### +#M......# +####.#### +####K#### +######### +7 9 +####### +#####M# +#####.# +#.....# +#.###.# +#.....# +#.##### +#K##### +####### +7 6 +####### +#####.# +##....# +#K..#.# +###M#.# +####### +7 8 +####### +##...## +###.#M# +#.....# +#.#...# +#.#..## +#.K#### +####### +9 6 +######### +###..##.# +##......# +#K....#.# +##..#M#.# +######### +9 6 +######### +#.####### +#....#M.# +#.#...#.# +###K#...# +######### +12 7 +############ +###...####.# +##K#...M##.# +##.....#...# +#........#.# +###..#...#.# +############ +23 16 +####################### +#########...########### +##########.###.######## +##########.....######## +##########.#.#.###...## +########.#.#.######.### +########............### +########.###.######.### +############.######.### +#K...........######.### +####.#######.######.### +####.#######.######.### +####.................M# +####.#######.########## +###...#####...######### +####################### +46 16 +############################################## +#..............#..############################ +#..#..........#.#.###....#...................# +#.................###.#.#.#...............#..# +#...#..#....#...#.###.#......................# +#...#....#....#.#.###.#.#...#....#....#..#...# +#.#........#..........#.#.#....#....#....#...# +#...#...#.......###.#........#.........#...#.# +#.#...#.........###.#..##.......#........#...# +#...#........#..###.#..##.........#........#.# +#...............###.#..##..#.........#...#...# +############.######.#..##....................# +###########K...........#.########.############ +###################...............M########### +##################.......##################### +############################################## +0 0 diff --git a/codenet/public_test_cases/p01142/output.0.txt b/codenet/public_test_cases/p01142/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..944c09245604b356d889d903cd2aa2d86bf9f522 --- /dev/null +++ b/codenet/public_test_cases/p01142/output.0.txt @@ -0,0 +1,12 @@ +He can accomplish his mission. +He can accomplish his mission. +He cannot bring tea to his master. +He cannot return to the kitchen. +He can accomplish his mission. +He can accomplish his mission. +He cannot return to the kitchen. +He cannot return to the kitchen. +He can accomplish his mission. +He can accomplish his mission. +He cannot return to the kitchen. +He can accomplish his mission. diff --git a/codenet/public_test_cases/p01142/output.1.txt b/codenet/public_test_cases/p01142/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..944c09245604b356d889d903cd2aa2d86bf9f522 --- /dev/null +++ b/codenet/public_test_cases/p01142/output.1.txt @@ -0,0 +1,12 @@ +He can accomplish his mission. +He can accomplish his mission. +He cannot bring tea to his master. +He cannot return to the kitchen. +He can accomplish his mission. +He can accomplish his mission. +He cannot return to the kitchen. +He cannot return to the kitchen. +He can accomplish his mission. +He can accomplish his mission. +He cannot return to the kitchen. +He can accomplish his mission. diff --git a/codenet/public_test_cases/p01143/input.0.txt b/codenet/public_test_cases/p01143/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b359f753b6c0b197e613da26b048df51ef3649b1 --- /dev/null +++ b/codenet/public_test_cases/p01143/input.0.txt @@ -0,0 +1,14 @@ +3 2 50 +1 +2 +3 +4 4 75 +1 +2 +3 +0 +3 1 10 +8 +1 +1 +0 0 0 diff --git a/codenet/public_test_cases/p01143/input.1.txt b/codenet/public_test_cases/p01143/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b359f753b6c0b197e613da26b048df51ef3649b1 --- /dev/null +++ b/codenet/public_test_cases/p01143/input.1.txt @@ -0,0 +1,14 @@ +3 2 50 +1 +2 +3 +4 4 75 +1 +2 +3 +0 +3 1 10 +8 +1 +1 +0 0 0 diff --git a/codenet/public_test_cases/p01143/output.0.txt b/codenet/public_test_cases/p01143/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78956d4b69f3fe72f864e5d2650ec855ecbea669 --- /dev/null +++ b/codenet/public_test_cases/p01143/output.0.txt @@ -0,0 +1,3 @@ +150 +0 +112 diff --git a/codenet/public_test_cases/p01143/output.1.txt b/codenet/public_test_cases/p01143/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78956d4b69f3fe72f864e5d2650ec855ecbea669 --- /dev/null +++ b/codenet/public_test_cases/p01143/output.1.txt @@ -0,0 +1,3 @@ +150 +0 +112 diff --git a/codenet/public_test_cases/p01144/input.0.txt b/codenet/public_test_cases/p01144/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fecaca7d95705e95e473ab0e6afb4e8a95d7d18 --- /dev/null +++ b/codenet/public_test_cases/p01144/input.0.txt @@ -0,0 +1,8 @@ +2 8 +5 6 +4 5 +3 1 +5 10 +5 10 +5 10 +0 0 diff --git a/codenet/public_test_cases/p01144/input.1.txt b/codenet/public_test_cases/p01144/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fecaca7d95705e95e473ab0e6afb4e8a95d7d18 --- /dev/null +++ b/codenet/public_test_cases/p01144/input.1.txt @@ -0,0 +1,8 @@ +2 8 +5 6 +4 5 +3 1 +5 10 +5 10 +5 10 +0 0 diff --git a/codenet/public_test_cases/p01144/output.0.txt b/codenet/public_test_cases/p01144/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e9ce252efd0fec511ca7d2628fbdd27b3ea3915 --- /dev/null +++ b/codenet/public_test_cases/p01144/output.0.txt @@ -0,0 +1,2 @@ +5 +140 diff --git a/codenet/public_test_cases/p01144/output.1.txt b/codenet/public_test_cases/p01144/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e9ce252efd0fec511ca7d2628fbdd27b3ea3915 --- /dev/null +++ b/codenet/public_test_cases/p01144/output.1.txt @@ -0,0 +1,2 @@ +5 +140 diff --git a/codenet/public_test_cases/p01145/input.0.txt b/codenet/public_test_cases/p01145/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb625ee6baee4fa536f380b55d1b3316b5926a67 --- /dev/null +++ b/codenet/public_test_cases/p01145/input.0.txt @@ -0,0 +1,9 @@ +kusa +haha +hakata +kippu +sasakisan +sosonokasu +hottokouhii +i +# diff --git a/codenet/public_test_cases/p01145/output.0.txt b/codenet/public_test_cases/p01145/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..468b3fa46cc3b737cfcf912c37222cce7f42d7f6 --- /dev/null +++ b/codenet/public_test_cases/p01145/output.0.txt @@ -0,0 +1,8 @@ +k(u)sa +h(a)ha +h(a)kata +k(i)ppu +s(a)sak(i)san +s(o)sonokas(u) +hott(o)kouhii +i diff --git a/codenet/public_test_cases/p01146/input.0.txt b/codenet/public_test_cases/p01146/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2e9ba118040e697527e87d2c8327bb00acf73de --- /dev/null +++ b/codenet/public_test_cases/p01146/input.0.txt @@ -0,0 +1,33 @@ +2 1 0 1 0 1 +0 1 2 +3 1 1 2 0 1 +2 +0 2 1 +1 2 1 +3 2 1 2 0 1 +2 +0 2 1 +1 2 1 +4 4 1 4 1 3 +2 +0 1 2 +1 2 4 +0 2 1 +3 0 3 +5 3 2 6 0 3 +1 2 +2 1 2 +1 0 1 +3 4 1 +2 4 1 +4 1 2 +2 0 2 +5 4 2 6 0 3 +1 2 +4 2 4 +2 1 2 +4 3 1 +0 1 5 +1 4 2 +2 0 3 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p01146/input.1.txt b/codenet/public_test_cases/p01146/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2e9ba118040e697527e87d2c8327bb00acf73de --- /dev/null +++ b/codenet/public_test_cases/p01146/input.1.txt @@ -0,0 +1,33 @@ +2 1 0 1 0 1 +0 1 2 +3 1 1 2 0 1 +2 +0 2 1 +1 2 1 +3 2 1 2 0 1 +2 +0 2 1 +1 2 1 +4 4 1 4 1 3 +2 +0 1 2 +1 2 4 +0 2 1 +3 0 3 +5 3 2 6 0 3 +1 2 +2 1 2 +1 0 1 +3 4 1 +2 4 1 +4 1 2 +2 0 2 +5 4 2 6 0 3 +1 2 +4 2 4 +2 1 2 +4 3 1 +0 1 5 +1 4 2 +2 0 3 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p01146/output.0.txt b/codenet/public_test_cases/p01146/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..007fea144e4774b920641189448568ac72afc118 --- /dev/null +++ b/codenet/public_test_cases/p01146/output.0.txt @@ -0,0 +1,6 @@ +Help! +3 +2 +10 +5 +12 diff --git a/codenet/public_test_cases/p01146/output.1.txt b/codenet/public_test_cases/p01146/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..007fea144e4774b920641189448568ac72afc118 --- /dev/null +++ b/codenet/public_test_cases/p01146/output.1.txt @@ -0,0 +1,6 @@ +Help! +3 +2 +10 +5 +12 diff --git a/codenet/public_test_cases/p01147/input.0.txt b/codenet/public_test_cases/p01147/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d1bee64fb56d8c2dae88ec1680ea1a399c9faaa --- /dev/null +++ b/codenet/public_test_cases/p01147/input.0.txt @@ -0,0 +1,16 @@ +4 +apple +length +things +thin +2 +icp +cpc +3 +zeta +eta +alphabet +2 +until +till +0 diff --git a/codenet/public_test_cases/p01147/input.1.txt b/codenet/public_test_cases/p01147/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d1bee64fb56d8c2dae88ec1680ea1a399c9faaa --- /dev/null +++ b/codenet/public_test_cases/p01147/input.1.txt @@ -0,0 +1,16 @@ +4 +apple +length +things +thin +2 +icp +cpc +3 +zeta +eta +alphabet +2 +until +till +0 diff --git a/codenet/public_test_cases/p01147/output.0.txt b/codenet/public_test_cases/p01147/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1312cfea4c41548849db33c98dd2fb5d849d303b --- /dev/null +++ b/codenet/public_test_cases/p01147/output.0.txt @@ -0,0 +1,4 @@ +applengthings +icpc +zetalphabet +untill diff --git a/codenet/public_test_cases/p01147/output.1.txt b/codenet/public_test_cases/p01147/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1312cfea4c41548849db33c98dd2fb5d849d303b --- /dev/null +++ b/codenet/public_test_cases/p01147/output.1.txt @@ -0,0 +1,4 @@ +applengthings +icpc +zetalphabet +untill diff --git a/codenet/public_test_cases/p01148/input.0.txt b/codenet/public_test_cases/p01148/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82b49820d12399f23f27a5b205f6ebe7cc22ed6c --- /dev/null +++ b/codenet/public_test_cases/p01148/input.0.txt @@ -0,0 +1,8 @@ +4 1 1 +1 1 +1 2 +-1 2 +-1 1 +2 1 0 +0 1 0 1 2 +0 0 0 diff --git a/codenet/public_test_cases/p01148/input.1.txt b/codenet/public_test_cases/p01148/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..82b49820d12399f23f27a5b205f6ebe7cc22ed6c --- /dev/null +++ b/codenet/public_test_cases/p01148/input.1.txt @@ -0,0 +1,8 @@ +4 1 1 +1 1 +1 2 +-1 2 +-1 1 +2 1 0 +0 1 0 1 2 +0 0 0 diff --git a/codenet/public_test_cases/p01148/output.0.txt b/codenet/public_test_cases/p01148/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..112836e3d65356d5decb054f4c85d7201f618aef --- /dev/null +++ b/codenet/public_test_cases/p01148/output.0.txt @@ -0,0 +1,2 @@ +1 +1.000 diff --git a/codenet/public_test_cases/p01148/output.1.txt b/codenet/public_test_cases/p01148/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..112836e3d65356d5decb054f4c85d7201f618aef --- /dev/null +++ b/codenet/public_test_cases/p01148/output.1.txt @@ -0,0 +1,2 @@ +1 +1.000 diff --git a/codenet/public_test_cases/p01149/input.0.txt b/codenet/public_test_cases/p01149/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..959707ed361d20d60ea0ad2c0e58ac55b20db2bd --- /dev/null +++ b/codenet/public_test_cases/p01149/input.0.txt @@ -0,0 +1,9 @@ +4 +5 4 +9 2 8 3 7 4 6 5 +A J +K Q J T 9 8 7 6 +T 4 +7 J A 6 Q T K 7 +2 2 +2 3 4 K 2 3 4 K diff --git a/codenet/public_test_cases/p01149/input.1.txt b/codenet/public_test_cases/p01149/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..959707ed361d20d60ea0ad2c0e58ac55b20db2bd --- /dev/null +++ b/codenet/public_test_cases/p01149/input.1.txt @@ -0,0 +1,9 @@ +4 +5 4 +9 2 8 3 7 4 6 5 +A J +K Q J T 9 8 7 6 +T 4 +7 J A 6 Q T K 7 +2 2 +2 3 4 K 2 3 4 K diff --git a/codenet/public_test_cases/p01149/output.0.txt b/codenet/public_test_cases/p01149/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7c6f2f1eed280d39777e5d6ddde23eb10abb905 --- /dev/null +++ b/codenet/public_test_cases/p01149/output.0.txt @@ -0,0 +1,4 @@ +18 +blackjack +21 +bust diff --git a/codenet/public_test_cases/p01149/output.1.txt b/codenet/public_test_cases/p01149/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7c6f2f1eed280d39777e5d6ddde23eb10abb905 --- /dev/null +++ b/codenet/public_test_cases/p01149/output.1.txt @@ -0,0 +1,4 @@ +18 +blackjack +21 +bust diff --git a/codenet/public_test_cases/p01150/input.0.txt b/codenet/public_test_cases/p01150/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9f2f89bafab08d66ba1b1835614023bf5a3b9e5 --- /dev/null +++ b/codenet/public_test_cases/p01150/input.0.txt @@ -0,0 +1,4 @@ +8 +16 +17 +0 diff --git a/codenet/public_test_cases/p01150/input.1.txt b/codenet/public_test_cases/p01150/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9f2f89bafab08d66ba1b1835614023bf5a3b9e5 --- /dev/null +++ b/codenet/public_test_cases/p01150/input.1.txt @@ -0,0 +1,4 @@ +8 +16 +17 +0 diff --git a/codenet/public_test_cases/p01150/output.0.txt b/codenet/public_test_cases/p01150/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d46fc6aa9dff5bfd3582c771643cd74adbed61d --- /dev/null +++ b/codenet/public_test_cases/p01150/output.0.txt @@ -0,0 +1,3 @@ +0 +0 +685440 diff --git a/codenet/public_test_cases/p01150/output.1.txt b/codenet/public_test_cases/p01150/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d46fc6aa9dff5bfd3582c771643cd74adbed61d --- /dev/null +++ b/codenet/public_test_cases/p01150/output.1.txt @@ -0,0 +1,3 @@ +0 +0 +685440 diff --git a/codenet/public_test_cases/p01151/input.0.txt b/codenet/public_test_cases/p01151/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1cc6eb8234026f673a507f11f6de62b778e29c04 --- /dev/null +++ b/codenet/public_test_cases/p01151/input.0.txt @@ -0,0 +1,5 @@ +5 +1 2 3 3 7 +4 +2 3 3 3 +0 diff --git a/codenet/public_test_cases/p01151/input.1.txt b/codenet/public_test_cases/p01151/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1cc6eb8234026f673a507f11f6de62b778e29c04 --- /dev/null +++ b/codenet/public_test_cases/p01151/input.1.txt @@ -0,0 +1,5 @@ +5 +1 2 3 3 7 +4 +2 3 3 3 +0 diff --git a/codenet/public_test_cases/p01151/output.0.txt b/codenet/public_test_cases/p01151/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e3063f4322585d2825f986727c69b45ca00c6d6 --- /dev/null +++ b/codenet/public_test_cases/p01151/output.0.txt @@ -0,0 +1,2 @@ +3 3 1 7 2 +No diff --git a/codenet/public_test_cases/p01151/output.1.txt b/codenet/public_test_cases/p01151/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e3063f4322585d2825f986727c69b45ca00c6d6 --- /dev/null +++ b/codenet/public_test_cases/p01151/output.1.txt @@ -0,0 +1,2 @@ +3 3 1 7 2 +No diff --git a/codenet/public_test_cases/p01152/input.0.txt b/codenet/public_test_cases/p01152/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f991579427fa8cdda87ea9825e2c00c0a212440f --- /dev/null +++ b/codenet/public_test_cases/p01152/input.0.txt @@ -0,0 +1,6 @@ +5 +3 C E G +3 C E G# +4 C A G E +5 F A C E D +3 C D E diff --git a/codenet/public_test_cases/p01152/input.1.txt b/codenet/public_test_cases/p01152/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f991579427fa8cdda87ea9825e2c00c0a212440f --- /dev/null +++ b/codenet/public_test_cases/p01152/input.1.txt @@ -0,0 +1,6 @@ +5 +3 C E G +3 C E G# +4 C A G E +5 F A C E D +3 C D E diff --git a/codenet/public_test_cases/p01152/output.0.txt b/codenet/public_test_cases/p01152/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..071bde7a0e336c04fad6f26fcf253d7aefd25773 --- /dev/null +++ b/codenet/public_test_cases/p01152/output.0.txt @@ -0,0 +1,5 @@ +C Em(+5) +C(+5) E(+5) G#(+5) +C(13) Am7 Am(+13) +Dm7(9) FM7(13) +UNKNOWN diff --git a/codenet/public_test_cases/p01152/output.1.txt b/codenet/public_test_cases/p01152/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..071bde7a0e336c04fad6f26fcf253d7aefd25773 --- /dev/null +++ b/codenet/public_test_cases/p01152/output.1.txt @@ -0,0 +1,5 @@ +C Em(+5) +C(+5) E(+5) G#(+5) +C(13) Am7 Am(+13) +Dm7(9) FM7(13) +UNKNOWN diff --git a/codenet/public_test_cases/p01153/input.0.txt b/codenet/public_test_cases/p01153/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..537e3f97a2a83b376c22f69a218a7b311dbb0af8 --- /dev/null +++ b/codenet/public_test_cases/p01153/input.0.txt @@ -0,0 +1,3 @@ +2 +4 0 1 2 3 +6 1 8 0 3 5 9 diff --git a/codenet/public_test_cases/p01153/input.1.txt b/codenet/public_test_cases/p01153/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..537e3f97a2a83b376c22f69a218a7b311dbb0af8 --- /dev/null +++ b/codenet/public_test_cases/p01153/input.1.txt @@ -0,0 +1,3 @@ +2 +4 0 1 2 3 +6 1 8 0 3 5 9 diff --git a/codenet/public_test_cases/p01153/output.0.txt b/codenet/public_test_cases/p01153/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff6593e176d8c3cdb49109a3cdf2c411c30dff8f --- /dev/null +++ b/codenet/public_test_cases/p01153/output.0.txt @@ -0,0 +1,2 @@ +6 +34 diff --git a/codenet/public_test_cases/p01153/output.1.txt b/codenet/public_test_cases/p01153/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff6593e176d8c3cdb49109a3cdf2c411c30dff8f --- /dev/null +++ b/codenet/public_test_cases/p01153/output.1.txt @@ -0,0 +1,2 @@ +6 +34 diff --git a/codenet/public_test_cases/p01154/input.0.txt b/codenet/public_test_cases/p01154/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e50423d958276ddb27cad607117e75d13846a4fa --- /dev/null +++ b/codenet/public_test_cases/p01154/input.0.txt @@ -0,0 +1,15 @@ +4 +0 0 +2 0 +2 2 +0 2 +1 1 +6 +2 2 +2 5 +0 5 +0 0 +5 0 +5 2 +1 4 +0 diff --git a/codenet/public_test_cases/p01154/input.1.txt b/codenet/public_test_cases/p01154/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e50423d958276ddb27cad607117e75d13846a4fa --- /dev/null +++ b/codenet/public_test_cases/p01154/input.1.txt @@ -0,0 +1,15 @@ +4 +0 0 +2 0 +2 2 +0 2 +1 1 +6 +2 2 +2 5 +0 5 +0 0 +5 0 +5 2 +1 4 +0 diff --git a/codenet/public_test_cases/p01154/output.0.txt b/codenet/public_test_cases/p01154/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..202b0c58fcc90431004c8d41ac5ac3891f1bdff8 --- /dev/null +++ b/codenet/public_test_cases/p01154/output.0.txt @@ -0,0 +1,2 @@ +0.000 +3.000 diff --git a/codenet/public_test_cases/p01154/output.1.txt b/codenet/public_test_cases/p01154/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..202b0c58fcc90431004c8d41ac5ac3891f1bdff8 --- /dev/null +++ b/codenet/public_test_cases/p01154/output.1.txt @@ -0,0 +1,2 @@ +0.000 +3.000 diff --git a/codenet/public_test_cases/p01155/input.0.txt b/codenet/public_test_cases/p01155/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..70501dd3de561b2f59275188c4ac6c0283669f4f --- /dev/null +++ b/codenet/public_test_cases/p01155/input.0.txt @@ -0,0 +1,3 @@ +33 40 +57 144 +0 0 diff --git a/codenet/public_test_cases/p01155/input.1.txt b/codenet/public_test_cases/p01155/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..70501dd3de561b2f59275188c4ac6c0283669f4f --- /dev/null +++ b/codenet/public_test_cases/p01155/input.1.txt @@ -0,0 +1,3 @@ +33 40 +57 144 +0 0 diff --git a/codenet/public_test_cases/p01155/output.0.txt b/codenet/public_test_cases/p01155/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbde413bca5a7bf7a619b1d0fb0afd1bc5a5bb35 --- /dev/null +++ b/codenet/public_test_cases/p01155/output.0.txt @@ -0,0 +1,2 @@ +22 +94 diff --git a/codenet/public_test_cases/p01155/output.1.txt b/codenet/public_test_cases/p01155/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbde413bca5a7bf7a619b1d0fb0afd1bc5a5bb35 --- /dev/null +++ b/codenet/public_test_cases/p01155/output.1.txt @@ -0,0 +1,2 @@ +22 +94 diff --git a/codenet/public_test_cases/p01156/input.0.txt b/codenet/public_test_cases/p01156/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea508bd2d8f7cb963beff3851ae2e1636f274306 --- /dev/null +++ b/codenet/public_test_cases/p01156/input.0.txt @@ -0,0 +1,14 @@ +8 +Lightning +Gun +Paper +Sponge +Water +Dragon +Devil +Air +3 +Rock +Scissors +Paper +0 diff --git a/codenet/public_test_cases/p01156/input.1.txt b/codenet/public_test_cases/p01156/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea508bd2d8f7cb963beff3851ae2e1636f274306 --- /dev/null +++ b/codenet/public_test_cases/p01156/input.1.txt @@ -0,0 +1,14 @@ +8 +Lightning +Gun +Paper +Sponge +Water +Dragon +Devil +Air +3 +Rock +Scissors +Paper +0 diff --git a/codenet/public_test_cases/p01156/output.0.txt b/codenet/public_test_cases/p01156/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e693b8bd3e2ce67d8f293760020d68c40dd64b4d --- /dev/null +++ b/codenet/public_test_cases/p01156/output.0.txt @@ -0,0 +1,2 @@ +Sponge +Draw diff --git a/codenet/public_test_cases/p01156/output.1.txt b/codenet/public_test_cases/p01156/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e693b8bd3e2ce67d8f293760020d68c40dd64b4d --- /dev/null +++ b/codenet/public_test_cases/p01156/output.1.txt @@ -0,0 +1,2 @@ +Sponge +Draw diff --git a/codenet/public_test_cases/p01157/input.0.txt b/codenet/public_test_cases/p01157/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b82dd181ca45953e6e32ee0e5375c422c21da77 --- /dev/null +++ b/codenet/public_test_cases/p01157/input.0.txt @@ -0,0 +1,21 @@ +3 2 +1 2 10 +3 +0 3420 o +1 4589 o +2 4638 x +3 +1 6577 SUZUMIYA +2 7644 SUZUMIYA +0 19979 YASUZUMI +4 2 +150 150 150 150 +4 +0 1344 HOGEHOGE +1 1466 HOGEHOGE +2 1789 HOGEHOGE +3 19100 GEHO +2 +2 1200 SETTEN +3 700 SETTEN +0 0 diff --git a/codenet/public_test_cases/p01157/input.1.txt b/codenet/public_test_cases/p01157/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b82dd181ca45953e6e32ee0e5375c422c21da77 --- /dev/null +++ b/codenet/public_test_cases/p01157/input.1.txt @@ -0,0 +1,21 @@ +3 2 +1 2 10 +3 +0 3420 o +1 4589 o +2 4638 x +3 +1 6577 SUZUMIYA +2 7644 SUZUMIYA +0 19979 YASUZUMI +4 2 +150 150 150 150 +4 +0 1344 HOGEHOGE +1 1466 HOGEHOGE +2 1789 HOGEHOGE +3 19100 GEHO +2 +2 1200 SETTEN +3 700 SETTEN +0 0 diff --git a/codenet/public_test_cases/p01157/output.0.txt b/codenet/public_test_cases/p01157/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e2276fc01b3f29605145e2cc9f161f17b6959b1 --- /dev/null +++ b/codenet/public_test_cases/p01157/output.0.txt @@ -0,0 +1,10 @@ +177 57 +19 58 +19 57 +19 62 + +253 70 +13 58 +13 58 +24 66 +20 71 diff --git a/codenet/public_test_cases/p01157/output.1.txt b/codenet/public_test_cases/p01157/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e2276fc01b3f29605145e2cc9f161f17b6959b1 --- /dev/null +++ b/codenet/public_test_cases/p01157/output.1.txt @@ -0,0 +1,10 @@ +177 57 +19 58 +19 57 +19 62 + +253 70 +13 58 +13 58 +24 66 +20 71 diff --git a/codenet/public_test_cases/p01158/input.0.txt b/codenet/public_test_cases/p01158/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9c15ba3f600627d7791c776d3e6efda34763fff --- /dev/null +++ b/codenet/public_test_cases/p01158/input.0.txt @@ -0,0 +1,17 @@ +3 +gu 20 pa 10 +ci 20 gu 10 +pa 20 ci 10 +2 +tool 20 tool 10 +product 1000 tool 10 +8 +fishhook 21 disk 3 +mill 14 axe 7 +boomerang 56 sundial 28 +flint 35 fishhook 5 +axe 35 flint 14 +disk 42 disk 2 +sundial 14 disk 7 +hammer 28 mill 7 +0 diff --git a/codenet/public_test_cases/p01158/input.1.txt b/codenet/public_test_cases/p01158/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9c15ba3f600627d7791c776d3e6efda34763fff --- /dev/null +++ b/codenet/public_test_cases/p01158/input.1.txt @@ -0,0 +1,17 @@ +3 +gu 20 pa 10 +ci 20 gu 10 +pa 20 ci 10 +2 +tool 20 tool 10 +product 1000 tool 10 +8 +fishhook 21 disk 3 +mill 14 axe 7 +boomerang 56 sundial 28 +flint 35 fishhook 5 +axe 35 flint 14 +disk 42 disk 2 +sundial 14 disk 7 +hammer 28 mill 7 +0 diff --git a/codenet/public_test_cases/p01158/output.0.txt b/codenet/public_test_cases/p01158/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81df06b34b3d8b5e560b75cb5c009688f8b0361a --- /dev/null +++ b/codenet/public_test_cases/p01158/output.0.txt @@ -0,0 +1,3 @@ +40 +30 +113 diff --git a/codenet/public_test_cases/p01158/output.1.txt b/codenet/public_test_cases/p01158/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81df06b34b3d8b5e560b75cb5c009688f8b0361a --- /dev/null +++ b/codenet/public_test_cases/p01158/output.1.txt @@ -0,0 +1,3 @@ +40 +30 +113 diff --git a/codenet/public_test_cases/p01159/input.0.txt b/codenet/public_test_cases/p01159/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..49e6de4b2a8d4110f7c88e82a69a548c6750eddb --- /dev/null +++ b/codenet/public_test_cases/p01159/input.0.txt @@ -0,0 +1,17 @@ +3 1 +0 0 +1 1 +2 0 +11 1.5 +0 0 +2 7 +5 3 +7 8 +10 -5 +13 4 +15 -1 +17 3 +20 -7 +23 9 +24 0 +0 0 diff --git a/codenet/public_test_cases/p01159/input.1.txt b/codenet/public_test_cases/p01159/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..49e6de4b2a8d4110f7c88e82a69a548c6750eddb --- /dev/null +++ b/codenet/public_test_cases/p01159/input.1.txt @@ -0,0 +1,17 @@ +3 1 +0 0 +1 1 +2 0 +11 1.5 +0 0 +2 7 +5 3 +7 8 +10 -5 +13 4 +15 -1 +17 3 +20 -7 +23 9 +24 0 +0 0 diff --git a/codenet/public_test_cases/p01159/output.0.txt b/codenet/public_test_cases/p01159/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fd3915ae8aba4f1fb9147ac2a508d0ab56406ef --- /dev/null +++ b/codenet/public_test_cases/p01159/output.0.txt @@ -0,0 +1,2 @@ +0.166666666666667 +165.213541666667 diff --git a/codenet/public_test_cases/p01159/output.1.txt b/codenet/public_test_cases/p01159/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fd3915ae8aba4f1fb9147ac2a508d0ab56406ef --- /dev/null +++ b/codenet/public_test_cases/p01159/output.1.txt @@ -0,0 +1,2 @@ +0.166666666666667 +165.213541666667 diff --git a/codenet/public_test_cases/p01160/input.0.txt b/codenet/public_test_cases/p01160/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7d7097fbcb708c1cd80f289bcf398f6efbed6b3 --- /dev/null +++ b/codenet/public_test_cases/p01160/input.0.txt @@ -0,0 +1,2 @@ +YMAOKDOAMIMHAADAMMA +LELVEEL diff --git a/codenet/public_test_cases/p01160/input.1.txt b/codenet/public_test_cases/p01160/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7d7097fbcb708c1cd80f289bcf398f6efbed6b3 --- /dev/null +++ b/codenet/public_test_cases/p01160/input.1.txt @@ -0,0 +1,2 @@ +YMAOKDOAMIMHAADAMMA +LELVEEL diff --git a/codenet/public_test_cases/p01160/output.0.txt b/codenet/public_test_cases/p01160/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b982e59af2f44aaade94cd4d5ff620bdafb79644 --- /dev/null +++ b/codenet/public_test_cases/p01160/output.0.txt @@ -0,0 +1,2 @@ +MADAMIMADAM +LEVEL diff --git a/codenet/public_test_cases/p01160/output.1.txt b/codenet/public_test_cases/p01160/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b982e59af2f44aaade94cd4d5ff620bdafb79644 --- /dev/null +++ b/codenet/public_test_cases/p01160/output.1.txt @@ -0,0 +1,2 @@ +MADAMIMADAM +LEVEL diff --git a/codenet/public_test_cases/p01161/input.0.txt b/codenet/public_test_cases/p01161/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b021a723732c1a213938d5d4f007bd0e6a5440ff --- /dev/null +++ b/codenet/public_test_cases/p01161/input.0.txt @@ -0,0 +1,31 @@ +4 4 +2 2 2 +2 2 2 +99 1 0 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +99 1 0 +99 1 0 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +99 1 0 +1 0 +1 6 +2 2 +10 +10 +5 5 0 +5 5 0 +5 5 0 +5 5 0 +5 0 +5 10 +0 0 diff --git a/codenet/public_test_cases/p01161/input.1.txt b/codenet/public_test_cases/p01161/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b021a723732c1a213938d5d4f007bd0e6a5440ff --- /dev/null +++ b/codenet/public_test_cases/p01161/input.1.txt @@ -0,0 +1,31 @@ +4 4 +2 2 2 +2 2 2 +99 1 0 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +99 1 0 +99 1 0 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +1 99 1 +99 1 0 +1 0 +1 6 +2 2 +10 +10 +5 5 0 +5 5 0 +5 5 0 +5 5 0 +5 0 +5 10 +0 0 diff --git a/codenet/public_test_cases/p01161/output.0.txt b/codenet/public_test_cases/p01161/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea1bb27e6e00123ced5e4d79955baae1a010f1d2 --- /dev/null +++ b/codenet/public_test_cases/p01161/output.0.txt @@ -0,0 +1,2 @@ +28 +25 diff --git a/codenet/public_test_cases/p01161/output.1.txt b/codenet/public_test_cases/p01161/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea1bb27e6e00123ced5e4d79955baae1a010f1d2 --- /dev/null +++ b/codenet/public_test_cases/p01161/output.1.txt @@ -0,0 +1,2 @@ +28 +25 diff --git a/codenet/public_test_cases/p01162/input.0.txt b/codenet/public_test_cases/p01162/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ebf69e68f33697a5ff642293a4507f1264d20ed --- /dev/null +++ b/codenet/public_test_cases/p01162/input.0.txt @@ -0,0 +1,6 @@ +4 +0 4 2 4 +0 2 2 0 +3 0 4 2 +6 2 6 0 +0 diff --git a/codenet/public_test_cases/p01162/output.0.txt b/codenet/public_test_cases/p01162/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e928a5889e7d5aed929417626b96ac8ede80160 --- /dev/null +++ b/codenet/public_test_cases/p01162/output.0.txt @@ -0,0 +1 @@ +8.0000 diff --git a/codenet/public_test_cases/p01163/input.0.txt b/codenet/public_test_cases/p01163/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee6b28fc6e5615a4af37ab5e682a75d4091bcfa5 --- /dev/null +++ b/codenet/public_test_cases/p01163/input.0.txt @@ -0,0 +1,7 @@ +10 +12 +15 +777 +4999 +5000 +0 diff --git a/codenet/public_test_cases/p01163/input.1.txt b/codenet/public_test_cases/p01163/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee6b28fc6e5615a4af37ab5e682a75d4091bcfa5 --- /dev/null +++ b/codenet/public_test_cases/p01163/input.1.txt @@ -0,0 +1,7 @@ +10 +12 +15 +777 +4999 +5000 +0 diff --git a/codenet/public_test_cases/p01163/output.0.txt b/codenet/public_test_cases/p01163/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8bf5544213aea5691882ed7d11e17dc38354dd --- /dev/null +++ b/codenet/public_test_cases/p01163/output.0.txt @@ -0,0 +1,6 @@ +0 +1 +2 +110 +2780 +0 diff --git a/codenet/public_test_cases/p01163/output.1.txt b/codenet/public_test_cases/p01163/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8bf5544213aea5691882ed7d11e17dc38354dd --- /dev/null +++ b/codenet/public_test_cases/p01163/output.1.txt @@ -0,0 +1,6 @@ +0 +1 +2 +110 +2780 +0 diff --git a/codenet/public_test_cases/p01164/input.0.txt b/codenet/public_test_cases/p01164/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..662c1397293bc4eb5bd0ab8b9afc5ec89cccd9be --- /dev/null +++ b/codenet/public_test_cases/p01164/input.0.txt @@ -0,0 +1,7 @@ +4 +WBWB +BWBW +8 +WWWWBWBB +WWBBWBWW +0 diff --git a/codenet/public_test_cases/p01164/input.1.txt b/codenet/public_test_cases/p01164/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..662c1397293bc4eb5bd0ab8b9afc5ec89cccd9be --- /dev/null +++ b/codenet/public_test_cases/p01164/input.1.txt @@ -0,0 +1,7 @@ +4 +WBWB +BWBW +8 +WWWWBWBB +WWBBWBWW +0 diff --git a/codenet/public_test_cases/p01164/output.0.txt b/codenet/public_test_cases/p01164/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d57ce06bb401400d884d7e254adf735e6bf49a8 --- /dev/null +++ b/codenet/public_test_cases/p01164/output.0.txt @@ -0,0 +1,2 @@ +3 +9 diff --git a/codenet/public_test_cases/p01164/output.1.txt b/codenet/public_test_cases/p01164/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d57ce06bb401400d884d7e254adf735e6bf49a8 --- /dev/null +++ b/codenet/public_test_cases/p01164/output.1.txt @@ -0,0 +1,2 @@ +3 +9 diff --git a/codenet/public_test_cases/p01165/input.0.txt b/codenet/public_test_cases/p01165/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1cb50071bebd48eee6585ef3b9173f429b49a8e --- /dev/null +++ b/codenet/public_test_cases/p01165/input.0.txt @@ -0,0 +1,65 @@ +5 1 1 +0 0 2 0 +1 1 2 1 +1 2 3 2 +1 0 1 2 +2 0 2 2 +0 0 +3 2 +2 1 +1 2 +2 1 1 +1 0 1 2 +0 1 2 1 +1 0 +0 1 +1 0 +2 1 +2 1 1 +1 0 1 2 +0 1 2 1 +1 0 +0 1 +1 2 +2 1 +4 1 1 +0 0 2 0 +1 1 3 1 +1 0 1 1 +2 0 2 1 +0 0 +3 1 +1 0 +2 1 +5 1 1 +0 0 2 0 +1 1 2 1 +1 2 3 2 +1 0 1 2 +2 0 2 2 +0 0 +3 2 +3 2 +0 0 +8 3 3 +1 1 3 1 +0 2 4 2 +1 3 5 3 +2 4 4 4 +1 1 1 3 +2 0 2 4 +3 1 3 5 +4 2 4 4 +0 2 +1 1 +2 0 +3 5 +4 4 +5 3 +3 5 +4 4 +5 3 +0 2 +1 1 +2 0 +0 0 0 diff --git a/codenet/public_test_cases/p01165/output.0.txt b/codenet/public_test_cases/p01165/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc19af68c636104864afddd5c85c6cac5bdb352c --- /dev/null +++ b/codenet/public_test_cases/p01165/output.0.txt @@ -0,0 +1,6 @@ +3 +1 +2 +2 +7 +18 diff --git a/codenet/public_test_cases/p01166/input.0.txt b/codenet/public_test_cases/p01166/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94a1256626089f8704bfa9d8cfd2336bbf5d4c98 --- /dev/null +++ b/codenet/public_test_cases/p01166/input.0.txt @@ -0,0 +1,42 @@ +3 1 +1 09:00 3 10:00 +3 +1 09:10 +2 09:30 +3 09:40 +3 2 +1 09:00 1 10:00 +3 +1 09:10 +2 09:30 +3 09:40 +3 +3 09:20 +2 09:30 +1 10:00 +1 0 +1 09:00 1 10:00 +1 0 +1 10:00 1 09:00 +3 1 +1 09:00 3 09:35 +3 +1 09:10 +2 09:30 +3 09:40 +4 3 +1 09:00 4 11:00 +3 +1 09:10 +2 09:20 +4 09:40 +3 +1 10:30 +3 10:40 +4 10:50 +4 +1 08:50 +2 09:30 +3 10:30 +4 11:10 +0 0 diff --git a/codenet/public_test_cases/p01166/input.1.txt b/codenet/public_test_cases/p01166/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94a1256626089f8704bfa9d8cfd2336bbf5d4c98 --- /dev/null +++ b/codenet/public_test_cases/p01166/input.1.txt @@ -0,0 +1,42 @@ +3 1 +1 09:00 3 10:00 +3 +1 09:10 +2 09:30 +3 09:40 +3 2 +1 09:00 1 10:00 +3 +1 09:10 +2 09:30 +3 09:40 +3 +3 09:20 +2 09:30 +1 10:00 +1 0 +1 09:00 1 10:00 +1 0 +1 10:00 1 09:00 +3 1 +1 09:00 3 09:35 +3 +1 09:10 +2 09:30 +3 09:40 +4 3 +1 09:00 4 11:00 +3 +1 09:10 +2 09:20 +4 09:40 +3 +1 10:30 +3 10:40 +4 10:50 +4 +1 08:50 +2 09:30 +3 10:30 +4 11:10 +0 0 diff --git a/codenet/public_test_cases/p01166/output.0.txt b/codenet/public_test_cases/p01166/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8b7a74c5cc674a3475587ab00db978e9937b5d1 --- /dev/null +++ b/codenet/public_test_cases/p01166/output.0.txt @@ -0,0 +1,6 @@ +30 +30 +0 +impossible +impossible +60 diff --git a/codenet/public_test_cases/p01166/output.1.txt b/codenet/public_test_cases/p01166/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8b7a74c5cc674a3475587ab00db978e9937b5d1 --- /dev/null +++ b/codenet/public_test_cases/p01166/output.1.txt @@ -0,0 +1,6 @@ +30 +30 +0 +impossible +impossible +60 diff --git a/codenet/public_test_cases/p01167/input.0.txt b/codenet/public_test_cases/p01167/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..274a350f051290a18c151926338d4e8784384634 --- /dev/null +++ b/codenet/public_test_cases/p01167/input.0.txt @@ -0,0 +1,10 @@ +czujthebdgfoliskax +bdgchuptzefliskaox +fox +fennec +oinarisama +xiaorong +customizedrevisedfoooox +accurateredundantfooooooooox +fox +* diff --git a/codenet/public_test_cases/p01167/output.0.txt b/codenet/public_test_cases/p01167/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60f504c86e15b3b5e3139040f494a4e9837cec27 --- /dev/null +++ b/codenet/public_test_cases/p01167/output.0.txt @@ -0,0 +1,3 @@ +cutefox +Impossible +cuteredfox diff --git a/codenet/public_test_cases/p01168/input.0.txt b/codenet/public_test_cases/p01168/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..089629ae1428d47f30986db0407901f26d3cf63b --- /dev/null +++ b/codenet/public_test_cases/p01168/input.0.txt @@ -0,0 +1,3 @@ +23 18 53 +46 30 47 +-1 -1 -1 diff --git a/codenet/public_test_cases/p01168/input.1.txt b/codenet/public_test_cases/p01168/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..089629ae1428d47f30986db0407901f26d3cf63b --- /dev/null +++ b/codenet/public_test_cases/p01168/input.1.txt @@ -0,0 +1,3 @@ +23 18 53 +46 30 47 +-1 -1 -1 diff --git a/codenet/public_test_cases/p01168/output.0.txt b/codenet/public_test_cases/p01168/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b08e49504a4c0be80bb9e32b4db7dc65575e61d8 --- /dev/null +++ b/codenet/public_test_cases/p01168/output.0.txt @@ -0,0 +1,2 @@ +49 +-1 diff --git a/codenet/public_test_cases/p01168/output.1.txt b/codenet/public_test_cases/p01168/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b08e49504a4c0be80bb9e32b4db7dc65575e61d8 --- /dev/null +++ b/codenet/public_test_cases/p01168/output.1.txt @@ -0,0 +1,2 @@ +49 +-1 diff --git a/codenet/public_test_cases/p01169/input.0.txt b/codenet/public_test_cases/p01169/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425b975c2482c8969dbe3a0b4b50815a1cf385fb --- /dev/null +++ b/codenet/public_test_cases/p01169/input.0.txt @@ -0,0 +1,13 @@ +5 4 +0 0 20 0 20 10 0 10 1 5 +10 3 12 5 10 7 8 5 +10 5 +4 3 +0 0 10 0 10 5 0 5 +3 1 6 1 5 4 +0 0 +5 3 +0 0 10 0 10 10 0 10 3 5 +1 1 4 1 4 6 +0 0 +0 0 diff --git a/codenet/public_test_cases/p01169/input.1.txt b/codenet/public_test_cases/p01169/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..425b975c2482c8969dbe3a0b4b50815a1cf385fb --- /dev/null +++ b/codenet/public_test_cases/p01169/input.1.txt @@ -0,0 +1,13 @@ +5 4 +0 0 20 0 20 10 0 10 1 5 +10 3 12 5 10 7 8 5 +10 5 +4 3 +0 0 10 0 10 5 0 5 +3 1 6 1 5 4 +0 0 +5 3 +0 0 10 0 10 10 0 10 3 5 +1 1 4 1 4 6 +0 0 +0 0 diff --git a/codenet/public_test_cases/p01169/output.0.txt b/codenet/public_test_cases/p01169/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..70814357d8a01fe450b2a5ea52f15905beb3ebb1 --- /dev/null +++ b/codenet/public_test_cases/p01169/output.0.txt @@ -0,0 +1,3 @@ +360.0000000 +12.6803835 +3.3722867 diff --git a/codenet/public_test_cases/p01169/output.1.txt b/codenet/public_test_cases/p01169/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..70814357d8a01fe450b2a5ea52f15905beb3ebb1 --- /dev/null +++ b/codenet/public_test_cases/p01169/output.1.txt @@ -0,0 +1,3 @@ +360.0000000 +12.6803835 +3.3722867 diff --git a/codenet/public_test_cases/p01170/input.0.txt b/codenet/public_test_cases/p01170/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ed0e8e1e89ffb3e1314532d769204d8c9bfc666 --- /dev/null +++ b/codenet/public_test_cases/p01170/input.0.txt @@ -0,0 +1,11 @@ +2 +1.0 0.0 +0.5 +0.0 0.0 1 +2.0 0.0 -1 +2 +1.0 0.0 +0.5 +0.0 0.0 -1 +2.0 0.0 1 +0 diff --git a/codenet/public_test_cases/p01170/input.1.txt b/codenet/public_test_cases/p01170/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ed0e8e1e89ffb3e1314532d769204d8c9bfc666 --- /dev/null +++ b/codenet/public_test_cases/p01170/input.1.txt @@ -0,0 +1,11 @@ +2 +1.0 0.0 +0.5 +0.0 0.0 1 +2.0 0.0 -1 +2 +1.0 0.0 +0.5 +0.0 0.0 -1 +2.0 0.0 1 +0 diff --git a/codenet/public_test_cases/p01170/output.0.txt b/codenet/public_test_cases/p01170/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3808dfb243e38ba00d73ffb528e603d8bb2f0686 --- /dev/null +++ b/codenet/public_test_cases/p01170/output.0.txt @@ -0,0 +1,2 @@ +0.500000 +SAFE diff --git a/codenet/public_test_cases/p01170/output.1.txt b/codenet/public_test_cases/p01170/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3808dfb243e38ba00d73ffb528e603d8bb2f0686 --- /dev/null +++ b/codenet/public_test_cases/p01170/output.1.txt @@ -0,0 +1,2 @@ +0.500000 +SAFE diff --git a/codenet/public_test_cases/p01171/input.0.txt b/codenet/public_test_cases/p01171/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..204cec9e666082321840c28f6ab2e1a51d009a82 --- /dev/null +++ b/codenet/public_test_cases/p01171/input.0.txt @@ -0,0 +1,3 @@ +10 15 +30 20 +0 0 diff --git a/codenet/public_test_cases/p01171/input.1.txt b/codenet/public_test_cases/p01171/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..204cec9e666082321840c28f6ab2e1a51d009a82 --- /dev/null +++ b/codenet/public_test_cases/p01171/input.1.txt @@ -0,0 +1,3 @@ +10 15 +30 20 +0 0 diff --git a/codenet/public_test_cases/p01171/output.0.txt b/codenet/public_test_cases/p01171/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..422c2b7ab3b3c668038da977e4e93a5fc623169c --- /dev/null +++ b/codenet/public_test_cases/p01171/output.0.txt @@ -0,0 +1,2 @@ +a +b diff --git a/codenet/public_test_cases/p01171/output.1.txt b/codenet/public_test_cases/p01171/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..422c2b7ab3b3c668038da977e4e93a5fc623169c --- /dev/null +++ b/codenet/public_test_cases/p01171/output.1.txt @@ -0,0 +1,2 @@ +a +b diff --git a/codenet/public_test_cases/p01172/input.0.txt b/codenet/public_test_cases/p01172/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6134de3acf16b883887129149f8366f966bae42 --- /dev/null +++ b/codenet/public_test_cases/p01172/input.0.txt @@ -0,0 +1,6 @@ +1 3 +1 6 +3 5 +2 200 +25 99 +0 0 diff --git a/codenet/public_test_cases/p01172/input.1.txt b/codenet/public_test_cases/p01172/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6134de3acf16b883887129149f8366f966bae42 --- /dev/null +++ b/codenet/public_test_cases/p01172/input.1.txt @@ -0,0 +1,6 @@ +1 3 +1 6 +3 5 +2 200 +25 99 +0 0 diff --git a/codenet/public_test_cases/p01172/output.0.txt b/codenet/public_test_cases/p01172/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ffe521d026adcf665b12cf05c032ef868e13c02 --- /dev/null +++ b/codenet/public_test_cases/p01172/output.0.txt @@ -0,0 +1,5 @@ +0 1 +1 1 +1 0 +2 0 +0 2 diff --git a/codenet/public_test_cases/p01172/output.1.txt b/codenet/public_test_cases/p01172/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ffe521d026adcf665b12cf05c032ef868e13c02 --- /dev/null +++ b/codenet/public_test_cases/p01172/output.1.txt @@ -0,0 +1,5 @@ +0 1 +1 1 +1 0 +2 0 +0 2 diff --git a/codenet/public_test_cases/p01173/input.0.txt b/codenet/public_test_cases/p01173/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c9c857c728f23575e6b3de182721e1ee50aee09 --- /dev/null +++ b/codenet/public_test_cases/p01173/input.0.txt @@ -0,0 +1,29 @@ +3 +2 1 +0 0 +50 50 +100 0 +3 +1 1 +0 0 +50 50 +100 0 +3 +1 2 +0 0 +50 50 +100 0 +3 +2 1 +0 0 +100 100 +150 50 +6 +1 2 +0 0 +50 50 +100 0 +150 0 +200 50 +250 0 +0 diff --git a/codenet/public_test_cases/p01173/input.1.txt b/codenet/public_test_cases/p01173/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c9c857c728f23575e6b3de182721e1ee50aee09 --- /dev/null +++ b/codenet/public_test_cases/p01173/input.1.txt @@ -0,0 +1,29 @@ +3 +2 1 +0 0 +50 50 +100 0 +3 +1 1 +0 0 +50 50 +100 0 +3 +1 2 +0 0 +50 50 +100 0 +3 +2 1 +0 0 +100 100 +150 50 +6 +1 2 +0 0 +50 50 +100 0 +150 0 +200 50 +250 0 +0 diff --git a/codenet/public_test_cases/p01173/output.0.txt b/codenet/public_test_cases/p01173/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09c1512ce6ea93ef10577e072a576ea22f042c35 --- /dev/null +++ b/codenet/public_test_cases/p01173/output.0.txt @@ -0,0 +1,5 @@ +70.710678 +100.000000 +50.000000 +106.066017 +150.000000 diff --git a/codenet/public_test_cases/p01173/output.1.txt b/codenet/public_test_cases/p01173/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09c1512ce6ea93ef10577e072a576ea22f042c35 --- /dev/null +++ b/codenet/public_test_cases/p01173/output.1.txt @@ -0,0 +1,5 @@ +70.710678 +100.000000 +50.000000 +106.066017 +150.000000 diff --git a/codenet/public_test_cases/p01174/input.0.txt b/codenet/public_test_cases/p01174/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..630eb13c307e231b1797501cd7f6cac1e5151fa2 --- /dev/null +++ b/codenet/public_test_cases/p01174/input.0.txt @@ -0,0 +1,8 @@ +3 +0.0 0.0 +1.0 1.0 +0.0 1.0 +3.0 3.0 +2.0 2.0 +3.0 2.0 +0 diff --git a/codenet/public_test_cases/p01174/input.1.txt b/codenet/public_test_cases/p01174/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..630eb13c307e231b1797501cd7f6cac1e5151fa2 --- /dev/null +++ b/codenet/public_test_cases/p01174/input.1.txt @@ -0,0 +1,8 @@ +3 +0.0 0.0 +1.0 1.0 +0.0 1.0 +3.0 3.0 +2.0 2.0 +3.0 2.0 +0 diff --git a/codenet/public_test_cases/p01174/output.0.txt b/codenet/public_test_cases/p01174/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1113b83e8f16ef607af4427b77d90ed0bfec0b8 --- /dev/null +++ b/codenet/public_test_cases/p01174/output.0.txt @@ -0,0 +1 @@ +3.14159265359 diff --git a/codenet/public_test_cases/p01174/output.1.txt b/codenet/public_test_cases/p01174/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1113b83e8f16ef607af4427b77d90ed0bfec0b8 --- /dev/null +++ b/codenet/public_test_cases/p01174/output.1.txt @@ -0,0 +1 @@ +3.14159265359 diff --git a/codenet/public_test_cases/p01175/input.0.txt b/codenet/public_test_cases/p01175/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fd07e143bedca4351980fcf66927fc5f8f37f2a --- /dev/null +++ b/codenet/public_test_cases/p01175/input.0.txt @@ -0,0 +1,4 @@ +3 +R2R2 +R1R2R4R8R16R32R64 +R1R4R16 diff --git a/codenet/public_test_cases/p01175/input.1.txt b/codenet/public_test_cases/p01175/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fd07e143bedca4351980fcf66927fc5f8f37f2a --- /dev/null +++ b/codenet/public_test_cases/p01175/input.1.txt @@ -0,0 +1,4 @@ +3 +R2R2 +R1R2R4R8R16R32R64 +R1R4R16 diff --git a/codenet/public_test_cases/p01175/output.0.txt b/codenet/public_test_cases/p01175/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14113c758be4ddd2d3eae0a1dc12334751010b57 --- /dev/null +++ b/codenet/public_test_cases/p01175/output.0.txt @@ -0,0 +1,3 @@ +R1 +R1...... +R16R1R4 diff --git a/codenet/public_test_cases/p01175/output.1.txt b/codenet/public_test_cases/p01175/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14113c758be4ddd2d3eae0a1dc12334751010b57 --- /dev/null +++ b/codenet/public_test_cases/p01175/output.1.txt @@ -0,0 +1,3 @@ +R1 +R1...... +R16R1R4 diff --git a/codenet/public_test_cases/p01176/input.0.txt b/codenet/public_test_cases/p01176/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..126cbaaccbf8ee9a099a58d8ca326aa38d3f3315 --- /dev/null +++ b/codenet/public_test_cases/p01176/input.0.txt @@ -0,0 +1,47 @@ +2 1 +0 1 +0 0 +2 1 +0 0 +1 0 +3 3 +0 1 1 +0 0 1 +0 0 0 +3 3 +0 1 0 +0 0 0 +1 1 0 +3 1 +0 1 0 +0 0 0 +1 1 0 +3 3 +0 1 0 +0 0 1 +1 0 0 +6 4 +0 0 0 0 0 1 +1 0 1 0 1 0 +1 0 0 1 1 0 +1 1 0 0 1 0 +1 0 0 0 0 0 +0 1 1 1 1 0 +7 2 +0 1 0 0 0 1 0 +0 0 1 0 1 1 1 +1 0 0 1 1 0 0 +1 1 0 0 0 1 0 +1 0 0 1 0 0 1 +0 0 1 0 1 0 0 +1 0 1 1 0 1 0 +8 6 +0 0 0 0 1 0 0 0 +1 0 1 1 0 0 0 0 +1 0 0 0 1 0 0 0 +1 0 1 0 0 1 0 1 +0 1 0 1 0 0 1 0 +1 1 1 0 1 0 0 1 +1 1 1 1 0 1 0 0 +1 1 1 0 1 0 1 0 +0 0 diff --git a/codenet/public_test_cases/p01176/input.1.txt b/codenet/public_test_cases/p01176/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..126cbaaccbf8ee9a099a58d8ca326aa38d3f3315 --- /dev/null +++ b/codenet/public_test_cases/p01176/input.1.txt @@ -0,0 +1,47 @@ +2 1 +0 1 +0 0 +2 1 +0 0 +1 0 +3 3 +0 1 1 +0 0 1 +0 0 0 +3 3 +0 1 0 +0 0 0 +1 1 0 +3 1 +0 1 0 +0 0 0 +1 1 0 +3 3 +0 1 0 +0 0 1 +1 0 0 +6 4 +0 0 0 0 0 1 +1 0 1 0 1 0 +1 0 0 1 1 0 +1 1 0 0 1 0 +1 0 0 0 0 0 +0 1 1 1 1 0 +7 2 +0 1 0 0 0 1 0 +0 0 1 0 1 1 1 +1 0 0 1 1 0 0 +1 1 0 0 0 1 0 +1 0 0 1 0 0 1 +0 0 1 0 1 0 0 +1 0 1 1 0 1 0 +8 6 +0 0 0 0 1 0 0 0 +1 0 1 1 0 0 0 0 +1 0 0 0 1 0 0 0 +1 0 1 0 0 1 0 1 +0 1 0 1 0 0 1 0 +1 1 1 0 1 0 0 1 +1 1 1 1 0 1 0 0 +1 1 1 0 1 0 1 0 +0 0 diff --git a/codenet/public_test_cases/p01176/output.0.txt b/codenet/public_test_cases/p01176/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9adce95de8ee05bb939f2cdedefea728ac0927ab --- /dev/null +++ b/codenet/public_test_cases/p01176/output.0.txt @@ -0,0 +1,9 @@ +1 +0 +0 +3 +0 +1 +11 +139 +78 diff --git a/codenet/public_test_cases/p01176/output.1.txt b/codenet/public_test_cases/p01176/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9adce95de8ee05bb939f2cdedefea728ac0927ab --- /dev/null +++ b/codenet/public_test_cases/p01176/output.1.txt @@ -0,0 +1,9 @@ +1 +0 +0 +3 +0 +1 +11 +139 +78 diff --git a/codenet/public_test_cases/p01177/input.0.txt b/codenet/public_test_cases/p01177/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fe3bdb27b9f3f09df3195849add9106988dd31 --- /dev/null +++ b/codenet/public_test_cases/p01177/input.0.txt @@ -0,0 +1,53 @@ +3 2 3 +10 2 1 2 +20 2 3 2 +1 +2 +3 +5 2 5 +10 3 1 2 4 +20 3 2 3 5 +1 +2 +3 +4 +5 +4 1 4 +10 2 1 4 +1 +2 +3 +4 +4 3 4 +30 2 1 4 +20 2 2 4 +10 2 3 4 +1 +2 +3 +4 +4 3 4 +10 2 1 4 +20 2 2 4 +30 2 3 4 +1 +2 +3 +4 +4 3 4 +10 2 1 2 +15 2 1 4 +20 2 2 3 +1 +2 +3 +4 +3 2 3 +10 2 2 3 +20 2 1 2 +1 +2 +3 +1 0 1 +1 +0 0 0 diff --git a/codenet/public_test_cases/p01177/input.1.txt b/codenet/public_test_cases/p01177/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fe3bdb27b9f3f09df3195849add9106988dd31 --- /dev/null +++ b/codenet/public_test_cases/p01177/input.1.txt @@ -0,0 +1,53 @@ +3 2 3 +10 2 1 2 +20 2 3 2 +1 +2 +3 +5 2 5 +10 3 1 2 4 +20 3 2 3 5 +1 +2 +3 +4 +5 +4 1 4 +10 2 1 4 +1 +2 +3 +4 +4 3 4 +30 2 1 4 +20 2 2 4 +10 2 3 4 +1 +2 +3 +4 +4 3 4 +10 2 1 4 +20 2 2 4 +30 2 3 4 +1 +2 +3 +4 +4 3 4 +10 2 1 2 +15 2 1 4 +20 2 2 3 +1 +2 +3 +4 +3 2 3 +10 2 2 3 +20 2 1 2 +1 +2 +3 +1 0 1 +1 +0 0 0 diff --git a/codenet/public_test_cases/p01177/output.0.txt b/codenet/public_test_cases/p01177/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b20f2f9a71a914c8c137ee1920fec2a9c7999e98 --- /dev/null +++ b/codenet/public_test_cases/p01177/output.0.txt @@ -0,0 +1,35 @@ +1 +2 +3 + +1 +2 +3 +5 +4 + +1 +4 +2 +3 + +1 +4 +2 +3 + +1 +2 +3 +4 + +1 +4 +2 +3 + +1 +2 +3 + +1 diff --git a/codenet/public_test_cases/p01177/output.1.txt b/codenet/public_test_cases/p01177/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b20f2f9a71a914c8c137ee1920fec2a9c7999e98 --- /dev/null +++ b/codenet/public_test_cases/p01177/output.1.txt @@ -0,0 +1,35 @@ +1 +2 +3 + +1 +2 +3 +5 +4 + +1 +4 +2 +3 + +1 +4 +2 +3 + +1 +2 +3 +4 + +1 +4 +2 +3 + +1 +2 +3 + +1 diff --git a/codenet/public_test_cases/p01178/input.0.txt b/codenet/public_test_cases/p01178/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a66f46dbcb36d1d27842c8a4b7ed16d45b51864b --- /dev/null +++ b/codenet/public_test_cases/p01178/input.0.txt @@ -0,0 +1,24 @@ +1 4 100 +7 +10 1 50 50 +15 2 50 50 +25 1 50 50 +35 3 50 50 +1 2 100 +5 +30 3 20 50 +40 4 40 50 +1 2 100 +5 +49 3 20 50 +60 4 50 30 +1 2 100 +5 +50 3 20 50 +60 4 50 30 +2 3 100 +4 2 +10 4 20 20 +30 2 20 20 +40 4 20 20 +0 0 0 diff --git a/codenet/public_test_cases/p01178/input.1.txt b/codenet/public_test_cases/p01178/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a66f46dbcb36d1d27842c8a4b7ed16d45b51864b --- /dev/null +++ b/codenet/public_test_cases/p01178/input.1.txt @@ -0,0 +1,24 @@ +1 4 100 +7 +10 1 50 50 +15 2 50 50 +25 1 50 50 +35 3 50 50 +1 2 100 +5 +30 3 20 50 +40 4 40 50 +1 2 100 +5 +49 3 20 50 +60 4 50 30 +1 2 100 +5 +50 3 20 50 +60 4 50 30 +2 3 100 +4 2 +10 4 20 20 +30 2 20 20 +40 4 20 20 +0 0 0 diff --git a/codenet/public_test_cases/p01178/output.0.txt b/codenet/public_test_cases/p01178/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b7992ac77cce259cb1b07aa8c0545cf7c8c8dec --- /dev/null +++ b/codenet/public_test_cases/p01178/output.0.txt @@ -0,0 +1,5 @@ +0.7428571428571429 +0.4285714285714285 +0.5542857142857143 +-0.1428571428571428 +0.8000000000000000 diff --git a/codenet/public_test_cases/p01178/output.1.txt b/codenet/public_test_cases/p01178/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b7992ac77cce259cb1b07aa8c0545cf7c8c8dec --- /dev/null +++ b/codenet/public_test_cases/p01178/output.1.txt @@ -0,0 +1,5 @@ +0.7428571428571429 +0.4285714285714285 +0.5542857142857143 +-0.1428571428571428 +0.8000000000000000 diff --git a/codenet/public_test_cases/p01179/input.0.txt b/codenet/public_test_cases/p01179/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87492835724bfdc6f72193621db77aea727a5ac5 --- /dev/null +++ b/codenet/public_test_cases/p01179/input.0.txt @@ -0,0 +1,8 @@ +7 +C is A’s father’s brother’s son’s aunt +C is A’s mother’s brother’s son’s aunt +C is A’s son’s mother’s mother’s son +C is A’s aunt’s niece’s aunt’s niece +C is A’s father’s son’s brother +C is A’s son’s son’s mother +C is A diff --git a/codenet/public_test_cases/p01179/input.1.txt b/codenet/public_test_cases/p01179/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87492835724bfdc6f72193621db77aea727a5ac5 --- /dev/null +++ b/codenet/public_test_cases/p01179/input.1.txt @@ -0,0 +1,8 @@ +7 +C is A’s father’s brother’s son’s aunt +C is A’s mother’s brother’s son’s aunt +C is A’s son’s mother’s mother’s son +C is A’s aunt’s niece’s aunt’s niece +C is A’s father’s son’s brother +C is A’s son’s son’s mother +C is A diff --git a/codenet/public_test_cases/p01179/output.0.txt b/codenet/public_test_cases/p01179/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..200cb28dc22370669eb2787ba2b4bb346d81bd7a --- /dev/null +++ b/codenet/public_test_cases/p01179/output.0.txt @@ -0,0 +1,7 @@ +5 3 +5 1 +2 2 +6 0 +2 0 +1 1 +0 0 diff --git a/codenet/public_test_cases/p01179/output.1.txt b/codenet/public_test_cases/p01179/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..200cb28dc22370669eb2787ba2b4bb346d81bd7a --- /dev/null +++ b/codenet/public_test_cases/p01179/output.1.txt @@ -0,0 +1,7 @@ +5 3 +5 1 +2 2 +6 0 +2 0 +1 1 +0 0 diff --git a/codenet/public_test_cases/p01180/input.0.txt b/codenet/public_test_cases/p01180/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e745cdf4582723119758bbb550f0c9c9d80a509 --- /dev/null +++ b/codenet/public_test_cases/p01180/input.0.txt @@ -0,0 +1,6 @@ +4 +1.0 0.0 0.0 +1.5 0.0 3.0 +2.0 4.0 0.0 +1.0 3.0 4.0 +0 diff --git a/codenet/public_test_cases/p01180/input.1.txt b/codenet/public_test_cases/p01180/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e745cdf4582723119758bbb550f0c9c9d80a509 --- /dev/null +++ b/codenet/public_test_cases/p01180/input.1.txt @@ -0,0 +1,6 @@ +4 +1.0 0.0 0.0 +1.5 0.0 3.0 +2.0 4.0 0.0 +1.0 3.0 4.0 +0 diff --git a/codenet/public_test_cases/p01180/output.0.txt b/codenet/public_test_cases/p01180/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb3c4fe4eebcdea3da0790cc0ba74cb286ec4f4 --- /dev/null +++ b/codenet/public_test_cases/p01180/output.0.txt @@ -0,0 +1 @@ +0.5 diff --git a/codenet/public_test_cases/p01180/output.1.txt b/codenet/public_test_cases/p01180/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb3c4fe4eebcdea3da0790cc0ba74cb286ec4f4 --- /dev/null +++ b/codenet/public_test_cases/p01180/output.1.txt @@ -0,0 +1 @@ +0.5 diff --git a/codenet/public_test_cases/p01181/input.0.txt b/codenet/public_test_cases/p01181/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80d02ee0f43e29a9ac1c2c38010a73fac4211603 --- /dev/null +++ b/codenet/public_test_cases/p01181/input.0.txt @@ -0,0 +1,3 @@ +3 1 6 8 10 7 0 0 2 5 +0 0 0 0 0 0 0 0 0 1 +-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 diff --git a/codenet/public_test_cases/p01181/input.1.txt b/codenet/public_test_cases/p01181/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..80d02ee0f43e29a9ac1c2c38010a73fac4211603 --- /dev/null +++ b/codenet/public_test_cases/p01181/input.1.txt @@ -0,0 +1,3 @@ +3 1 6 8 10 7 0 0 2 5 +0 0 0 0 0 0 0 0 0 1 +-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 diff --git a/codenet/public_test_cases/p01181/output.0.txt b/codenet/public_test_cases/p01181/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7372cac2f09cea706418d519b3553a8905add0e7 --- /dev/null +++ b/codenet/public_test_cases/p01181/output.0.txt @@ -0,0 +1,2 @@ +2 +362880 diff --git a/codenet/public_test_cases/p01181/output.1.txt b/codenet/public_test_cases/p01181/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7372cac2f09cea706418d519b3553a8905add0e7 --- /dev/null +++ b/codenet/public_test_cases/p01181/output.1.txt @@ -0,0 +1,2 @@ +2 +362880 diff --git a/codenet/public_test_cases/p01182/input.0.txt b/codenet/public_test_cases/p01182/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19cba5b18ff7cd327492905b8214674b1083b506 --- /dev/null +++ b/codenet/public_test_cases/p01182/input.0.txt @@ -0,0 +1,11 @@ +5 4 +Ramen 3 10 +Chahan 5 5 +Gyoza 5 10 +Rice 1 1 +Soup 1 1 +5 2 Ramen Gyoza +10 6 Chahan Gyoza Soup Ramen Gyoza Rice +20 1 Chahan +25 1 Ramen +0 0 diff --git a/codenet/public_test_cases/p01182/input.1.txt b/codenet/public_test_cases/p01182/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19cba5b18ff7cd327492905b8214674b1083b506 --- /dev/null +++ b/codenet/public_test_cases/p01182/input.1.txt @@ -0,0 +1,11 @@ +5 4 +Ramen 3 10 +Chahan 5 5 +Gyoza 5 10 +Rice 1 1 +Soup 1 1 +5 2 Ramen Gyoza +10 6 Chahan Gyoza Soup Ramen Gyoza Rice +20 1 Chahan +25 1 Ramen +0 0 diff --git a/codenet/public_test_cases/p01182/output.0.txt b/codenet/public_test_cases/p01182/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d14269a40171ec270834ed028efd93a6421abb59 --- /dev/null +++ b/codenet/public_test_cases/p01182/output.0.txt @@ -0,0 +1,4 @@ +25 +42 +40 +35 diff --git a/codenet/public_test_cases/p01182/output.1.txt b/codenet/public_test_cases/p01182/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d14269a40171ec270834ed028efd93a6421abb59 --- /dev/null +++ b/codenet/public_test_cases/p01182/output.1.txt @@ -0,0 +1,4 @@ +25 +42 +40 +35 diff --git a/codenet/public_test_cases/p01183/input.0.txt b/codenet/public_test_cases/p01183/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..935e5a2c7b73fffb9499ad30d71375dc8cdb1be4 --- /dev/null +++ b/codenet/public_test_cases/p01183/input.0.txt @@ -0,0 +1,2 @@ +7 1 2 2 2 2 2 2 +0 diff --git a/codenet/public_test_cases/p01183/input.1.txt b/codenet/public_test_cases/p01183/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..935e5a2c7b73fffb9499ad30d71375dc8cdb1be4 --- /dev/null +++ b/codenet/public_test_cases/p01183/input.1.txt @@ -0,0 +1,2 @@ +7 1 2 2 2 2 2 2 +0 diff --git a/codenet/public_test_cases/p01183/output.0.txt b/codenet/public_test_cases/p01183/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..17f7b59f4cf09b92e4ff94010c7d29e9e04c116a --- /dev/null +++ b/codenet/public_test_cases/p01183/output.0.txt @@ -0,0 +1 @@ +0.942809 diff --git a/codenet/public_test_cases/p01183/output.1.txt b/codenet/public_test_cases/p01183/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..17f7b59f4cf09b92e4ff94010c7d29e9e04c116a --- /dev/null +++ b/codenet/public_test_cases/p01183/output.1.txt @@ -0,0 +1 @@ +0.942809 diff --git a/codenet/public_test_cases/p01184/input.0.txt b/codenet/public_test_cases/p01184/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d25d46efdd555a64e0361882964492af088f90b5 --- /dev/null +++ b/codenet/public_test_cases/p01184/input.0.txt @@ -0,0 +1,28 @@ +3 4 +English +French +Japanese +1 English +2 French English +2 Japanese English +1 Japanese +2 2 +English +Japanese +1 English +1 Japanese +6 7 +English +Dutch +German +French +Italian +Spanish +1 English +2 English Dutch +2 Dutch German +2 German French +2 French Italian +2 Italian Spanish +1 Spanish +0 0 diff --git a/codenet/public_test_cases/p01184/input.1.txt b/codenet/public_test_cases/p01184/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d25d46efdd555a64e0361882964492af088f90b5 --- /dev/null +++ b/codenet/public_test_cases/p01184/input.1.txt @@ -0,0 +1,28 @@ +3 4 +English +French +Japanese +1 English +2 French English +2 Japanese English +1 Japanese +2 2 +English +Japanese +1 English +1 Japanese +6 7 +English +Dutch +German +French +Italian +Spanish +1 English +2 English Dutch +2 Dutch German +2 German French +2 French Italian +2 Italian Spanish +1 Spanish +0 0 diff --git a/codenet/public_test_cases/p01184/output.0.txt b/codenet/public_test_cases/p01184/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b45afb8519c31117a87bfa390bc866a438424ed --- /dev/null +++ b/codenet/public_test_cases/p01184/output.0.txt @@ -0,0 +1,7 @@ +2 +English +Japanese + +Impossible + +Impossible diff --git a/codenet/public_test_cases/p01184/output.1.txt b/codenet/public_test_cases/p01184/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b45afb8519c31117a87bfa390bc866a438424ed --- /dev/null +++ b/codenet/public_test_cases/p01184/output.1.txt @@ -0,0 +1,7 @@ +2 +English +Japanese + +Impossible + +Impossible diff --git a/codenet/public_test_cases/p01185/input.0.txt b/codenet/public_test_cases/p01185/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d896eaae5ca898e1d01821da07be90ba278c75f1 --- /dev/null +++ b/codenet/public_test_cases/p01185/input.0.txt @@ -0,0 +1,5 @@ +2 +0 0 3 3 +0 4 3 1 +1 1 +0 diff --git a/codenet/public_test_cases/p01185/input.1.txt b/codenet/public_test_cases/p01185/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d896eaae5ca898e1d01821da07be90ba278c75f1 --- /dev/null +++ b/codenet/public_test_cases/p01185/input.1.txt @@ -0,0 +1,5 @@ +2 +0 0 3 3 +0 4 3 1 +1 1 +0 diff --git a/codenet/public_test_cases/p01185/output.0.txt b/codenet/public_test_cases/p01185/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..44537cf1d5579dd6e0250acc16cb13fd8f8d5880 --- /dev/null +++ b/codenet/public_test_cases/p01185/output.0.txt @@ -0,0 +1 @@ +4.243 diff --git a/codenet/public_test_cases/p01185/output.1.txt b/codenet/public_test_cases/p01185/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..44537cf1d5579dd6e0250acc16cb13fd8f8d5880 --- /dev/null +++ b/codenet/public_test_cases/p01185/output.1.txt @@ -0,0 +1 @@ +4.243 diff --git a/codenet/public_test_cases/p01186/input.0.txt b/codenet/public_test_cases/p01186/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0976f7337a70cf5d9d1750b148ba3edeaa4b52e6 --- /dev/null +++ b/codenet/public_test_cases/p01186/input.0.txt @@ -0,0 +1,12 @@ +4 +OmoikkiriTV 12:00 13:00 5 1 +WaratteIitomo 12:00 13:00 10 2 +WatarusekennhaOnibakari 20:00 21:00 10 3 +SuzumiyaharuhiNoYuuutsu 23:00 23:30 100 40 +5 +a 0:00 1:00 100 100 +b 0:00 1:00 101 101 +c 0:00 1:00 102 102 +d 0:00 1:00 103 103 +e 0:00 1:00 104 104 +0 diff --git a/codenet/public_test_cases/p01186/input.1.txt b/codenet/public_test_cases/p01186/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0976f7337a70cf5d9d1750b148ba3edeaa4b52e6 --- /dev/null +++ b/codenet/public_test_cases/p01186/input.1.txt @@ -0,0 +1,12 @@ +4 +OmoikkiriTV 12:00 13:00 5 1 +WaratteIitomo 12:00 13:00 10 2 +WatarusekennhaOnibakari 20:00 21:00 10 3 +SuzumiyaharuhiNoYuuutsu 23:00 23:30 100 40 +5 +a 0:00 1:00 100 100 +b 0:00 1:00 101 101 +c 0:00 1:00 102 102 +d 0:00 1:00 103 103 +e 0:00 1:00 104 104 +0 diff --git a/codenet/public_test_cases/p01186/output.0.txt b/codenet/public_test_cases/p01186/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9499cfd80e6f3ae2c071c00209ed666f2830be9 --- /dev/null +++ b/codenet/public_test_cases/p01186/output.0.txt @@ -0,0 +1,2 @@ +121 +207 diff --git a/codenet/public_test_cases/p01186/output.1.txt b/codenet/public_test_cases/p01186/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9499cfd80e6f3ae2c071c00209ed666f2830be9 --- /dev/null +++ b/codenet/public_test_cases/p01186/output.1.txt @@ -0,0 +1,2 @@ +121 +207 diff --git a/codenet/public_test_cases/p01187/input.0.txt b/codenet/public_test_cases/p01187/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffd235150a9b960807f12621fb3ac8e06a8d1c33 --- /dev/null +++ b/codenet/public_test_cases/p01187/input.0.txt @@ -0,0 +1,6 @@ +3 +3 1 3 5 +2 1 4 +4 1 2 3 6 +1 3 +0 diff --git a/codenet/public_test_cases/p01187/input.1.txt b/codenet/public_test_cases/p01187/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffd235150a9b960807f12621fb3ac8e06a8d1c33 --- /dev/null +++ b/codenet/public_test_cases/p01187/input.1.txt @@ -0,0 +1,6 @@ +3 +3 1 3 5 +2 1 4 +4 1 2 3 6 +1 3 +0 diff --git a/codenet/public_test_cases/p01187/output.0.txt b/codenet/public_test_cases/p01187/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01187/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01187/output.1.txt b/codenet/public_test_cases/p01187/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01187/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01188/input.0.txt b/codenet/public_test_cases/p01188/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8f47012417524c45ec5a640d8c35eef39a1c587 --- /dev/null +++ b/codenet/public_test_cases/p01188/input.0.txt @@ -0,0 +1,27 @@ +3 +10 30 +......#############........... +....##_____________#.......... +...#________________####...... +..#________####_________#..... +.#________#....##________#.... +#_________#......#________#... +#__________###...#_____^^_#... +.#__________A_#...#____^^_#... +..#___________#...#_>__###.... +...###########.....####....... +7 17 +......#.......... +.....#_##........ +.#...#_A_#....... +#^####___#....... +#_______#........ +#>_____#......... +########......... +6 5 +##### +#_A_# +#___# +#_>_# +#___# +##### diff --git a/codenet/public_test_cases/p01188/input.1.txt b/codenet/public_test_cases/p01188/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8f47012417524c45ec5a640d8c35eef39a1c587 --- /dev/null +++ b/codenet/public_test_cases/p01188/input.1.txt @@ -0,0 +1,27 @@ +3 +10 30 +......#############........... +....##_____________#.......... +...#________________####...... +..#________####_________#..... +.#________#....##________#.... +#_________#......#________#... +#__________###...#_____^^_#... +.#__________A_#...#____^^_#... +..#___________#...#_>__###.... +...###########.....####....... +7 17 +......#.......... +.....#_##........ +.#...#_A_#....... +#^####___#....... +#_______#........ +#>_____#......... +########......... +6 5 +##### +#_A_# +#___# +#_>_# +#___# +##### diff --git a/codenet/public_test_cases/p01188/input.2.txt b/codenet/public_test_cases/p01188/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3dd9d62a8f46d84f6f184e3a2c1ff4f256e9a074 --- /dev/null +++ b/codenet/public_test_cases/p01188/input.2.txt @@ -0,0 +1,26 @@ +3 +10 30 +......#############........... +....##_____________#.......... +...#________________####...... +..#________####_________#..... +.#________#....##________#.... +_________#......#________#... +__________###...#_____^^_#... +.#__________A_#...#____^^_#... +..#___________#...#_>__###.... +...###########.....####....... +7 17 +......#.......... +.....#_##........ +.#...#_A_#....... +^####___#....... +_______#........ +>_____#......... +......... +6 5 + +_A_# +___# +_>_# +___# diff --git a/codenet/public_test_cases/p01188/output.0.txt b/codenet/public_test_cases/p01188/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p01188/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p01188/output.1.txt b/codenet/public_test_cases/p01188/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p01188/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p01188/output.2.txt b/codenet/public_test_cases/p01188/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p01188/output.2.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p01189/input.0.txt b/codenet/public_test_cases/p01189/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa5fefc293e5ecc49d3693d15dd7dabdfc5a3b98 --- /dev/null +++ b/codenet/public_test_cases/p01189/input.0.txt @@ -0,0 +1,4 @@ +2 +0 -12 0 0 2 +0 0 12 0 2 +0 diff --git a/codenet/public_test_cases/p01189/input.1.txt b/codenet/public_test_cases/p01189/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa5fefc293e5ecc49d3693d15dd7dabdfc5a3b98 --- /dev/null +++ b/codenet/public_test_cases/p01189/input.1.txt @@ -0,0 +1,4 @@ +2 +0 -12 0 0 2 +0 0 12 0 2 +0 diff --git a/codenet/public_test_cases/p01189/output.0.txt b/codenet/public_test_cases/p01189/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2a0f6f3c78a703c0b8b63bcb51efb29afacacdd --- /dev/null +++ b/codenet/public_test_cases/p01189/output.0.txt @@ -0,0 +1 @@ +39.14159 diff --git a/codenet/public_test_cases/p01189/output.1.txt b/codenet/public_test_cases/p01189/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2a0f6f3c78a703c0b8b63bcb51efb29afacacdd --- /dev/null +++ b/codenet/public_test_cases/p01189/output.1.txt @@ -0,0 +1 @@ +39.14159 diff --git a/codenet/public_test_cases/p01190/input.0.txt b/codenet/public_test_cases/p01190/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c141011cb3308d2cbef5af243b6720e6606b163 --- /dev/null +++ b/codenet/public_test_cases/p01190/input.0.txt @@ -0,0 +1,5 @@ +4 +a list of A, B, C and D +a list of A, a list of P and Q, B, a list of X, Y and Z and C +a list of A +a list of a list of A and B diff --git a/codenet/public_test_cases/p01190/input.1.txt b/codenet/public_test_cases/p01190/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c141011cb3308d2cbef5af243b6720e6606b163 --- /dev/null +++ b/codenet/public_test_cases/p01190/input.1.txt @@ -0,0 +1,5 @@ +4 +a list of A, B, C and D +a list of A, a list of P and Q, B, a list of X, Y and Z and C +a list of A +a list of a list of A and B diff --git a/codenet/public_test_cases/p01190/output.0.txt b/codenet/public_test_cases/p01190/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59b3df652d369ae4abbdecd51d72f1c7c44ecb30 --- /dev/null +++ b/codenet/public_test_cases/p01190/output.0.txt @@ -0,0 +1,4 @@ +(A B C D) +(A (P Q) B (X Y Z) C) +(A) +AMBIGUOUS diff --git a/codenet/public_test_cases/p01190/output.1.txt b/codenet/public_test_cases/p01190/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59b3df652d369ae4abbdecd51d72f1c7c44ecb30 --- /dev/null +++ b/codenet/public_test_cases/p01190/output.1.txt @@ -0,0 +1,4 @@ +(A B C D) +(A (P Q) B (X Y Z) C) +(A) +AMBIGUOUS diff --git a/codenet/public_test_cases/p01191/input.0.txt b/codenet/public_test_cases/p01191/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de344edeccf7198ef25909c588075873956b0bd9 --- /dev/null +++ b/codenet/public_test_cases/p01191/input.0.txt @@ -0,0 +1,9 @@ +2 +1 2 +1 +42 3.141592653589793 +5 20 +3 +0 307.09242465218927 +180 307.09242465218927 +90 728.30573874452591 diff --git a/codenet/public_test_cases/p01191/input.1.txt b/codenet/public_test_cases/p01191/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de344edeccf7198ef25909c588075873956b0bd9 --- /dev/null +++ b/codenet/public_test_cases/p01191/input.1.txt @@ -0,0 +1,9 @@ +2 +1 2 +1 +42 3.141592653589793 +5 20 +3 +0 307.09242465218927 +180 307.09242465218927 +90 728.30573874452591 diff --git a/codenet/public_test_cases/p01191/output.0.txt b/codenet/public_test_cases/p01191/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0c9d30785ef063055f618e986a7f17d997b3c27 --- /dev/null +++ b/codenet/public_test_cases/p01191/output.0.txt @@ -0,0 +1,2 @@ +2.0 3.141592653589793 +8.660254038 5.235987756 diff --git a/codenet/public_test_cases/p01191/output.1.txt b/codenet/public_test_cases/p01191/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0c9d30785ef063055f618e986a7f17d997b3c27 --- /dev/null +++ b/codenet/public_test_cases/p01191/output.1.txt @@ -0,0 +1,2 @@ +2.0 3.141592653589793 +8.660254038 5.235987756 diff --git a/codenet/public_test_cases/p01192/input.0.txt b/codenet/public_test_cases/p01192/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fa4e5829d5305e1522d48f1f248d93377f096ea --- /dev/null +++ b/codenet/public_test_cases/p01192/input.0.txt @@ -0,0 +1,4 @@ +3 1 5 25 +3 7 77 777 +4 1 8 27 64 +0 diff --git a/codenet/public_test_cases/p01192/input.1.txt b/codenet/public_test_cases/p01192/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fa4e5829d5305e1522d48f1f248d93377f096ea --- /dev/null +++ b/codenet/public_test_cases/p01192/input.1.txt @@ -0,0 +1,4 @@ +3 1 5 25 +3 7 77 777 +4 1 8 27 64 +0 diff --git a/codenet/public_test_cases/p01192/output.0.txt b/codenet/public_test_cases/p01192/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fb01a09cdcff1d4c2afed64633b1e773481427c --- /dev/null +++ b/codenet/public_test_cases/p01192/output.0.txt @@ -0,0 +1,3 @@ +Case #1: OK +Case #2: Cannot pay some amount +Case #3: Cannot use greedy algorithm diff --git a/codenet/public_test_cases/p01192/output.1.txt b/codenet/public_test_cases/p01192/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fb01a09cdcff1d4c2afed64633b1e773481427c --- /dev/null +++ b/codenet/public_test_cases/p01192/output.1.txt @@ -0,0 +1,3 @@ +Case #1: OK +Case #2: Cannot pay some amount +Case #3: Cannot use greedy algorithm diff --git a/codenet/public_test_cases/p01193/input.0.txt b/codenet/public_test_cases/p01193/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d6720dbadfe107b773ba0ec49a487de1babcf54 --- /dev/null +++ b/codenet/public_test_cases/p01193/input.0.txt @@ -0,0 +1,7 @@ +1+2+3+4+5+6+7+8+9+10= +1000-500-250-125= +1*2*3*4*5*6= +5000*5000= +10-100= +100*100= +10000= diff --git a/codenet/public_test_cases/p01193/input.1.txt b/codenet/public_test_cases/p01193/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d6720dbadfe107b773ba0ec49a487de1babcf54 --- /dev/null +++ b/codenet/public_test_cases/p01193/input.1.txt @@ -0,0 +1,7 @@ +1+2+3+4+5+6+7+8+9+10= +1000-500-250-125= +1*2*3*4*5*6= +5000*5000= +10-100= +100*100= +10000= diff --git a/codenet/public_test_cases/p01193/output.0.txt b/codenet/public_test_cases/p01193/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ffa2ca81656d969540312f3751ba8f2da280a87 --- /dev/null +++ b/codenet/public_test_cases/p01193/output.0.txt @@ -0,0 +1,7 @@ +55 +125 +720 +E +E +E +E diff --git a/codenet/public_test_cases/p01193/output.1.txt b/codenet/public_test_cases/p01193/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ffa2ca81656d969540312f3751ba8f2da280a87 --- /dev/null +++ b/codenet/public_test_cases/p01193/output.1.txt @@ -0,0 +1,7 @@ +55 +125 +720 +E +E +E +E diff --git a/codenet/public_test_cases/p01194/input.0.txt b/codenet/public_test_cases/p01194/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48247eea62f2206be66866262fe22516666962ed --- /dev/null +++ b/codenet/public_test_cases/p01194/input.0.txt @@ -0,0 +1,4 @@ +5 1 +2 1 3 2 +2 1 2 2 +0 0 diff --git a/codenet/public_test_cases/p01194/input.1.txt b/codenet/public_test_cases/p01194/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48247eea62f2206be66866262fe22516666962ed --- /dev/null +++ b/codenet/public_test_cases/p01194/input.1.txt @@ -0,0 +1,4 @@ +5 1 +2 1 3 2 +2 1 2 2 +0 0 diff --git a/codenet/public_test_cases/p01194/output.0.txt b/codenet/public_test_cases/p01194/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdaefe3468b581d104b44a7918e02d57e12d4efc --- /dev/null +++ b/codenet/public_test_cases/p01194/output.0.txt @@ -0,0 +1 @@ +4.18 diff --git a/codenet/public_test_cases/p01194/output.1.txt b/codenet/public_test_cases/p01194/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdaefe3468b581d104b44a7918e02d57e12d4efc --- /dev/null +++ b/codenet/public_test_cases/p01194/output.1.txt @@ -0,0 +1 @@ +4.18 diff --git a/codenet/public_test_cases/p01195/input.0.txt b/codenet/public_test_cases/p01195/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7492acb3a8314b404d3444017280db3fcdee35f --- /dev/null +++ b/codenet/public_test_cases/p01195/input.0.txt @@ -0,0 +1,51 @@ +3 +philosopher’s-stone +4 10 +tongue 1 +tear 1 +dunkelheit 1 +aroma-materia 1 + +aroma-materia +4 5 +solt 1 +holy-water 1 +golden-rock 1 +neutralizer 2 + +neutralizer +1 1 +red-rock 5 + +7 +tongue 1 +tear 1 +dunkelheit 1 +solt 2 +holy-water 3 +golden-rock 2 +red-rock 10 + +2 +philosopher’s-stone +5 3 +ninjin 1 +jagaimo 3 +tamanegi 1 +barmont 12 + +barmont +3 1 +curry 5 +komugiko 20 +batar 10 + +7 +ninjin 3 +jagaimo 2 +tamanegi 5 +curry 150 +komugiko 750 +batar 200 + +0 diff --git a/codenet/public_test_cases/p01195/output.0.txt b/codenet/public_test_cases/p01195/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e29252f2d71219bcf1616f21e8d835290701d60c --- /dev/null +++ b/codenet/public_test_cases/p01195/output.0.txt @@ -0,0 +1,2 @@ +16 +impossible diff --git a/codenet/public_test_cases/p01196/input.0.txt b/codenet/public_test_cases/p01196/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a1d7ba17a03f73084b95ef2f9e49d810a26a90f --- /dev/null +++ b/codenet/public_test_cases/p01196/input.0.txt @@ -0,0 +1,7 @@ +4 4 +3 3 5 3 +3 5 5 6 +4 4 +3 3 5 3 +3 5 5 5 +0 0 diff --git a/codenet/public_test_cases/p01196/input.1.txt b/codenet/public_test_cases/p01196/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a1d7ba17a03f73084b95ef2f9e49d810a26a90f --- /dev/null +++ b/codenet/public_test_cases/p01196/input.1.txt @@ -0,0 +1,7 @@ +4 4 +3 3 5 3 +3 5 5 6 +4 4 +3 3 5 3 +3 5 5 5 +0 0 diff --git a/codenet/public_test_cases/p01196/output.0.txt b/codenet/public_test_cases/p01196/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d25b2b9a0a86dbcfe905e6c58b36bbfb95cb918d --- /dev/null +++ b/codenet/public_test_cases/p01196/output.0.txt @@ -0,0 +1,2 @@ +4 +TOO MANY diff --git a/codenet/public_test_cases/p01196/output.1.txt b/codenet/public_test_cases/p01196/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d25b2b9a0a86dbcfe905e6c58b36bbfb95cb918d --- /dev/null +++ b/codenet/public_test_cases/p01196/output.1.txt @@ -0,0 +1,2 @@ +4 +TOO MANY diff --git a/codenet/public_test_cases/p01197/input.0.txt b/codenet/public_test_cases/p01197/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d3bded7235edb53834a6e84c3e88ecee5dfb1bc --- /dev/null +++ b/codenet/public_test_cases/p01197/input.0.txt @@ -0,0 +1,13 @@ +2 + +3 3 +0 2 +0 2 240 80 +0 1 130 60 +1 2 260 60 + +3 3 +0 2 +0 2 180 60 +0 1 130 60 +1 2 260 60 diff --git a/codenet/public_test_cases/p01197/input.1.txt b/codenet/public_test_cases/p01197/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d3bded7235edb53834a6e84c3e88ecee5dfb1bc --- /dev/null +++ b/codenet/public_test_cases/p01197/input.1.txt @@ -0,0 +1,13 @@ +2 + +3 3 +0 2 +0 2 240 80 +0 1 130 60 +1 2 260 60 + +3 3 +0 2 +0 2 180 60 +0 1 130 60 +1 2 260 60 diff --git a/codenet/public_test_cases/p01197/output.0.txt b/codenet/public_test_cases/p01197/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6477f819bd3f87fad6a6c5f550c5b8f25e12d64 --- /dev/null +++ b/codenet/public_test_cases/p01197/output.0.txt @@ -0,0 +1,2 @@ +3.2500 +3.0000 diff --git a/codenet/public_test_cases/p01197/output.1.txt b/codenet/public_test_cases/p01197/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6477f819bd3f87fad6a6c5f550c5b8f25e12d64 --- /dev/null +++ b/codenet/public_test_cases/p01197/output.1.txt @@ -0,0 +1,2 @@ +3.2500 +3.0000 diff --git a/codenet/public_test_cases/p01198/input.0.txt b/codenet/public_test_cases/p01198/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..20cacb3e56ed34b5337fdb89cbf18cb4f8adb20c --- /dev/null +++ b/codenet/public_test_cases/p01198/input.0.txt @@ -0,0 +1,8 @@ +1 +3 +2 4 6 +4 +10 100 +2 3 +10 6 +7 6 diff --git a/codenet/public_test_cases/p01198/input.1.txt b/codenet/public_test_cases/p01198/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..20cacb3e56ed34b5337fdb89cbf18cb4f8adb20c --- /dev/null +++ b/codenet/public_test_cases/p01198/input.1.txt @@ -0,0 +1,8 @@ +1 +3 +2 4 6 +4 +10 100 +2 3 +10 6 +7 6 diff --git a/codenet/public_test_cases/p01198/output.0.txt b/codenet/public_test_cases/p01198/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdc5619afd31e87ea2fdb1b0f883e157eb52ecef --- /dev/null +++ b/codenet/public_test_cases/p01198/output.0.txt @@ -0,0 +1,4 @@ +crash +try again +good 1.000 +perfect diff --git a/codenet/public_test_cases/p01198/output.1.txt b/codenet/public_test_cases/p01198/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdc5619afd31e87ea2fdb1b0f883e157eb52ecef --- /dev/null +++ b/codenet/public_test_cases/p01198/output.1.txt @@ -0,0 +1,4 @@ +crash +try again +good 1.000 +perfect diff --git a/codenet/public_test_cases/p01199/input.0.txt b/codenet/public_test_cases/p01199/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9be39bcf9467427489230b84ee888ddb0b12b1d6 --- /dev/null +++ b/codenet/public_test_cases/p01199/input.0.txt @@ -0,0 +1,13 @@ +1 0 1 +51 +50 +2 1 1 +1 2 1 +1000 0 +0 1000 +4 3 5 +1 2 4 +1 3 1 +3 4 2 +0 1000 1000 1000 +3000 0 0 0 diff --git a/codenet/public_test_cases/p01199/input.1.txt b/codenet/public_test_cases/p01199/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9be39bcf9467427489230b84ee888ddb0b12b1d6 --- /dev/null +++ b/codenet/public_test_cases/p01199/input.1.txt @@ -0,0 +1,13 @@ +1 0 1 +51 +50 +2 1 1 +1 2 1 +1000 0 +0 1000 +4 3 5 +1 2 4 +1 3 1 +3 4 2 +0 1000 1000 1000 +3000 0 0 0 diff --git a/codenet/public_test_cases/p01199/output.0.txt b/codenet/public_test_cases/p01199/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5170a22506485bd2cc935e4460b22ca21da7704 --- /dev/null +++ b/codenet/public_test_cases/p01199/output.0.txt @@ -0,0 +1,3 @@ +50 +0 +3000 diff --git a/codenet/public_test_cases/p01199/output.1.txt b/codenet/public_test_cases/p01199/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5170a22506485bd2cc935e4460b22ca21da7704 --- /dev/null +++ b/codenet/public_test_cases/p01199/output.1.txt @@ -0,0 +1,3 @@ +50 +0 +3000 diff --git a/codenet/public_test_cases/p01200/input.0.txt b/codenet/public_test_cases/p01200/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccdb0af427fc3744f02a50d9cdb8c71cc72e5f5a --- /dev/null +++ b/codenet/public_test_cases/p01200/input.0.txt @@ -0,0 +1,15 @@ +2 3 +10.00 +3 10 10 20 10 10 20 +4 30 10 40 10 40 20 30 20 +1.00 3 0 0 10 0 0 10 +0.50 4 20 15 25 15 25 20 20 20 +0.75 6 40 35 50 40 40 50 30 50 25 45 30 40 +4 1 +5.00 +3 0 0 24 0 0 24 +3 50 0 50 24 26 0 +3 0 50 0 26 24 50 +3 50 50 26 50 50 26 +1.00 4 25 0 50 25 25 50 0 25 +0 0 diff --git a/codenet/public_test_cases/p01200/input.1.txt b/codenet/public_test_cases/p01200/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccdb0af427fc3744f02a50d9cdb8c71cc72e5f5a --- /dev/null +++ b/codenet/public_test_cases/p01200/input.1.txt @@ -0,0 +1,15 @@ +2 3 +10.00 +3 10 10 20 10 10 20 +4 30 10 40 10 40 20 30 20 +1.00 3 0 0 10 0 0 10 +0.50 4 20 15 25 15 25 20 20 20 +0.75 6 40 35 50 40 40 50 30 50 25 45 30 40 +4 1 +5.00 +3 0 0 24 0 0 24 +3 50 0 50 24 26 0 +3 0 50 0 26 24 50 +3 50 50 26 50 50 26 +1.00 4 25 0 50 25 25 50 0 25 +0 0 diff --git a/codenet/public_test_cases/p01200/output.0.txt b/codenet/public_test_cases/p01200/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..787f68905cedc72a349de9d355cba74bbf73775c --- /dev/null +++ b/codenet/public_test_cases/p01200/output.0.txt @@ -0,0 +1,7 @@ +35.4 +5.6 + +133.3 +133.3 +133.3 +133.3 diff --git a/codenet/public_test_cases/p01200/output.1.txt b/codenet/public_test_cases/p01200/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..787f68905cedc72a349de9d355cba74bbf73775c --- /dev/null +++ b/codenet/public_test_cases/p01200/output.1.txt @@ -0,0 +1,7 @@ +35.4 +5.6 + +133.3 +133.3 +133.3 +133.3 diff --git a/codenet/public_test_cases/p01201/input.0.txt b/codenet/public_test_cases/p01201/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0b6d86a1fc6d0fe10a30af923ae43d0492d7cc4 --- /dev/null +++ b/codenet/public_test_cases/p01201/input.0.txt @@ -0,0 +1,19 @@ +push 1 +push 2 +sqrt +div +push 1 +push 3 +sqrt +div +add +disp +push 8 +sqrt +push 3 +push 2 +sqrt +mul +add +disp +stop diff --git a/codenet/public_test_cases/p01201/output.0.txt b/codenet/public_test_cases/p01201/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec33fa80fed4f7a83aceee15229f07939222499c --- /dev/null +++ b/codenet/public_test_cases/p01201/output.0.txt @@ -0,0 +1,2 @@ +1/2*sqrt(2) + 1/3*sqrt(3) +5*sqrt(2) diff --git a/codenet/public_test_cases/p01202/input.0.txt b/codenet/public_test_cases/p01202/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7bec0c76f3cdb3426efaf2081d22914c2d3c17a --- /dev/null +++ b/codenet/public_test_cases/p01202/input.0.txt @@ -0,0 +1,4 @@ +3 +UU +RDUL +ULDURDULDURDULDURDULDURD diff --git a/codenet/public_test_cases/p01202/input.1.txt b/codenet/public_test_cases/p01202/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7bec0c76f3cdb3426efaf2081d22914c2d3c17a --- /dev/null +++ b/codenet/public_test_cases/p01202/input.1.txt @@ -0,0 +1,4 @@ +3 +UU +RDUL +ULDURDULDURDULDURDULDURD diff --git a/codenet/public_test_cases/p01202/output.0.txt b/codenet/public_test_cases/p01202/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..833b95f1a1278c9952face6007de225c51813935 --- /dev/null +++ b/codenet/public_test_cases/p01202/output.0.txt @@ -0,0 +1,3 @@ +No +Yes +Yes diff --git a/codenet/public_test_cases/p01202/output.1.txt b/codenet/public_test_cases/p01202/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..833b95f1a1278c9952face6007de225c51813935 --- /dev/null +++ b/codenet/public_test_cases/p01202/output.1.txt @@ -0,0 +1,3 @@ +No +Yes +Yes diff --git a/codenet/public_test_cases/p01203/input.0.txt b/codenet/public_test_cases/p01203/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a86ec20eb4ff0cbc59e76e58661f3d39cb9e978 --- /dev/null +++ b/codenet/public_test_cases/p01203/input.0.txt @@ -0,0 +1,10 @@ +6 1 +2 1 +2 1 +2 1 +2 1 +2 1 +5 1 +1 1 +4 2 +0 0 diff --git a/codenet/public_test_cases/p01203/input.1.txt b/codenet/public_test_cases/p01203/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a86ec20eb4ff0cbc59e76e58661f3d39cb9e978 --- /dev/null +++ b/codenet/public_test_cases/p01203/input.1.txt @@ -0,0 +1,10 @@ +6 1 +2 1 +2 1 +2 1 +2 1 +2 1 +5 1 +1 1 +4 2 +0 0 diff --git a/codenet/public_test_cases/p01203/output.0.txt b/codenet/public_test_cases/p01203/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..97828e9446fed69e0c983da1695fda0e6d2a9620 --- /dev/null +++ b/codenet/public_test_cases/p01203/output.0.txt @@ -0,0 +1,2 @@ +2 +Impossible diff --git a/codenet/public_test_cases/p01203/output.1.txt b/codenet/public_test_cases/p01203/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97828e9446fed69e0c983da1695fda0e6d2a9620 --- /dev/null +++ b/codenet/public_test_cases/p01203/output.1.txt @@ -0,0 +1,2 @@ +2 +Impossible diff --git a/codenet/public_test_cases/p01204/input.0.txt b/codenet/public_test_cases/p01204/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82564110727a16b52841ace42952bd69f92f71c7 --- /dev/null +++ b/codenet/public_test_cases/p01204/input.0.txt @@ -0,0 +1,14 @@ +2 +0 0 0 0 2 0 +0 0 1 0 0 -1 +2 0 0 0 2 0 +3 +0 5 0 3 1 4 +0 1 0 0 -1 0 +1 0 1 -1 0 1 +3 1 -1 3 1 1 +2 +0 0 0 3 0 0 +0 0 0 0 1 0 +3 0 0 3 1 0 +0 diff --git a/codenet/public_test_cases/p01204/input.1.txt b/codenet/public_test_cases/p01204/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..82564110727a16b52841ace42952bd69f92f71c7 --- /dev/null +++ b/codenet/public_test_cases/p01204/input.1.txt @@ -0,0 +1,14 @@ +2 +0 0 0 0 2 0 +0 0 1 0 0 -1 +2 0 0 0 2 0 +3 +0 5 0 3 1 4 +0 1 0 0 -1 0 +1 0 1 -1 0 1 +3 1 -1 3 1 1 +2 +0 0 0 3 0 0 +0 0 0 0 1 0 +3 0 0 3 1 0 +0 diff --git a/codenet/public_test_cases/p01204/output.0.txt b/codenet/public_test_cases/p01204/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a1474823bacd1cc068fc0714a2f1e0f733e495 --- /dev/null +++ b/codenet/public_test_cases/p01204/output.0.txt @@ -0,0 +1,3 @@ +1.414 +2.000 +3.000 diff --git a/codenet/public_test_cases/p01204/output.1.txt b/codenet/public_test_cases/p01204/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a1474823bacd1cc068fc0714a2f1e0f733e495 --- /dev/null +++ b/codenet/public_test_cases/p01204/output.1.txt @@ -0,0 +1,3 @@ +1.414 +2.000 +3.000 diff --git a/codenet/public_test_cases/p01205/input.0.txt b/codenet/public_test_cases/p01205/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c00eebdd056f798246a2391689247ee8d94ea505 --- /dev/null +++ b/codenet/public_test_cases/p01205/input.0.txt @@ -0,0 +1,5 @@ +4 4 +4 3 2 2 +4 4 +4 3 2 3 +0 0 diff --git a/codenet/public_test_cases/p01205/input.1.txt b/codenet/public_test_cases/p01205/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c00eebdd056f798246a2391689247ee8d94ea505 --- /dev/null +++ b/codenet/public_test_cases/p01205/input.1.txt @@ -0,0 +1,5 @@ +4 4 +4 3 2 2 +4 4 +4 3 2 3 +0 0 diff --git a/codenet/public_test_cases/p01205/output.0.txt b/codenet/public_test_cases/p01205/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a832874bc0f938d08aaf13abcfeff133789d9887 --- /dev/null +++ b/codenet/public_test_cases/p01205/output.0.txt @@ -0,0 +1,2 @@ +1111001 +Goofy diff --git a/codenet/public_test_cases/p01205/output.1.txt b/codenet/public_test_cases/p01205/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a832874bc0f938d08aaf13abcfeff133789d9887 --- /dev/null +++ b/codenet/public_test_cases/p01205/output.1.txt @@ -0,0 +1,2 @@ +1111001 +Goofy diff --git a/codenet/public_test_cases/p01206/input.0.txt b/codenet/public_test_cases/p01206/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11f28a0b2992dc06b45af1af73df6fd1a5dedb62 --- /dev/null +++ b/codenet/public_test_cases/p01206/input.0.txt @@ -0,0 +1,31 @@ +4 4 1 1 +2 2 2 2 +2 1 1 2 +2 1 1 2 +2 1 2 2 +1 1 +4 4 1 1 +2 2 2 2 +2 1 1 2 +2 1 1 2 +2 1 2 2 +2 2 +4 4 1 1 +2 2 2 2 +2 1 1 2 +2 1 1 2 +2 1 1 2 +1 1 +3 6 6 1 +1 6 7 1 7 1 +5 1 2 8 1 6 +1 4 3 1 5 1 +1 4 +5 6 21 1 +1 3 3 3 3 1 +3 1 1 1 1 3 +3 1 1 3 2 2 +3 1 1 1 1 3 +1 3 3 3 3 1 +3 4 +0 0 0 0 diff --git a/codenet/public_test_cases/p01206/input.1.txt b/codenet/public_test_cases/p01206/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11f28a0b2992dc06b45af1af73df6fd1a5dedb62 --- /dev/null +++ b/codenet/public_test_cases/p01206/input.1.txt @@ -0,0 +1,31 @@ +4 4 1 1 +2 2 2 2 +2 1 1 2 +2 1 1 2 +2 1 2 2 +1 1 +4 4 1 1 +2 2 2 2 +2 1 1 2 +2 1 1 2 +2 1 2 2 +2 2 +4 4 1 1 +2 2 2 2 +2 1 1 2 +2 1 1 2 +2 1 1 2 +1 1 +3 6 6 1 +1 6 7 1 7 1 +5 1 2 8 1 6 +1 4 3 1 5 1 +1 4 +5 6 21 1 +1 3 3 3 3 1 +3 1 1 1 1 3 +3 1 1 3 2 2 +3 1 1 1 1 3 +1 3 3 3 3 1 +3 4 +0 0 0 0 diff --git a/codenet/public_test_cases/p01206/output.0.txt b/codenet/public_test_cases/p01206/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b02b677570662263248e87dce70af0f0f69bc63 --- /dev/null +++ b/codenet/public_test_cases/p01206/output.0.txt @@ -0,0 +1,5 @@ +Yes +No +No +No +Yes diff --git a/codenet/public_test_cases/p01206/output.1.txt b/codenet/public_test_cases/p01206/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b02b677570662263248e87dce70af0f0f69bc63 --- /dev/null +++ b/codenet/public_test_cases/p01206/output.1.txt @@ -0,0 +1,5 @@ +Yes +No +No +No +Yes diff --git a/codenet/public_test_cases/p01207/input.0.txt b/codenet/public_test_cases/p01207/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..301393b8c5ac74e7857c2c49c7301e834bf688e2 --- /dev/null +++ b/codenet/public_test_cases/p01207/input.0.txt @@ -0,0 +1,9 @@ +2 +1234 3 0 +1245 3 0 +1 +1234 0 0 +2 +0123 0 4 +1230 0 4 +0 diff --git a/codenet/public_test_cases/p01207/input.1.txt b/codenet/public_test_cases/p01207/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..301393b8c5ac74e7857c2c49c7301e834bf688e2 --- /dev/null +++ b/codenet/public_test_cases/p01207/input.1.txt @@ -0,0 +1,9 @@ +2 +1234 3 0 +1245 3 0 +1 +1234 0 0 +2 +0123 0 4 +1230 0 4 +0 diff --git a/codenet/public_test_cases/p01207/output.0.txt b/codenet/public_test_cases/p01207/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd3f7073fb868bf5130b80d0b50f49f16e8ceaa2 --- /dev/null +++ b/codenet/public_test_cases/p01207/output.0.txt @@ -0,0 +1,3 @@ +1235 +???? +0132 diff --git a/codenet/public_test_cases/p01207/output.1.txt b/codenet/public_test_cases/p01207/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd3f7073fb868bf5130b80d0b50f49f16e8ceaa2 --- /dev/null +++ b/codenet/public_test_cases/p01207/output.1.txt @@ -0,0 +1,3 @@ +1235 +???? +0132 diff --git a/codenet/public_test_cases/p01208/input.0.txt b/codenet/public_test_cases/p01208/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94dc3c955ccc77836659bdc4e7fab19d6b9e5f24 --- /dev/null +++ b/codenet/public_test_cases/p01208/input.0.txt @@ -0,0 +1,56 @@ +2 1 +KarasumaKitaoji 0 6150 +KarasumaNanajo 0 0 +KarasumaNanajo KarasumaKitaoji +KarasumaKitaoji KarasumaNanajo +3 2 +KujoOmiya 0 0 +KujoAburanokoji 400 0 +OmiyaNanajo 0 1150 +KujoOmiya KujoAburanokoji +KujoOmiya OmiyaNanajo +KujoAburanokoji OmiyaNanajo +10 12 +KarasumaGojo 745 0 +HorikawaShijo 0 870 +ShijoKarasuma 745 870 +ShijoKawaramachi 1645 870 +HorikawaOike 0 1700 +KarasumaOike 745 1700 +KawaramachiOike 1645 1700 +KawabataOike 1945 1700 +KarasumaMarutamachi 745 2445 +KawaramachiMarutamachi 1645 2445 +KarasumaGojo ShijoKarasuma +HorikawaShijo ShijoKarasuma +ShijoKarasuma ShijoKawaramachi +HorikawaShijo HorikawaOike +ShijoKarasuma KarasumaOike +ShijoKawaramachi KawaramachiOike +HorikawaOike KarasumaOike +KarasumaOike KawaramachiOike +KawaramachiOike KawabataOike +KarasumaOike KarasumaMarutamachi +KawaramachiOike KawaramachiMarutamachi +KarasumaMarutamachi KawaramachiMarutamachi +KarasumaGojo KawabataOike +8 9 +NishikojiNanajo 0 0 +NishiojiNanajo 750 0 +NishikojiGojo 0 800 +NishiojiGojo 750 800 +HorikawaGojo 2550 800 +NishiojiShijo 750 1700 +Enmachi 750 3250 +HorikawaMarutamachi 2550 3250 +NishikojiNanajo NishiojiNanajo +NishikojiNanajo NishikojiGojo +NishiojiNanajo NishiojiGojo +NishikojiGojo NishiojiGojo +NishiojiGojo HorikawaGojo +NishiojiGojo NishiojiShijo +HorikawaGojo HorikawaMarutamachi +NishiojiShijo Enmachi +Enmachi HorikawaMarutamachi +HorikawaGojo NishiojiShijo +0 0 diff --git a/codenet/public_test_cases/p01208/input.1.txt b/codenet/public_test_cases/p01208/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94dc3c955ccc77836659bdc4e7fab19d6b9e5f24 --- /dev/null +++ b/codenet/public_test_cases/p01208/input.1.txt @@ -0,0 +1,56 @@ +2 1 +KarasumaKitaoji 0 6150 +KarasumaNanajo 0 0 +KarasumaNanajo KarasumaKitaoji +KarasumaKitaoji KarasumaNanajo +3 2 +KujoOmiya 0 0 +KujoAburanokoji 400 0 +OmiyaNanajo 0 1150 +KujoOmiya KujoAburanokoji +KujoOmiya OmiyaNanajo +KujoAburanokoji OmiyaNanajo +10 12 +KarasumaGojo 745 0 +HorikawaShijo 0 870 +ShijoKarasuma 745 870 +ShijoKawaramachi 1645 870 +HorikawaOike 0 1700 +KarasumaOike 745 1700 +KawaramachiOike 1645 1700 +KawabataOike 1945 1700 +KarasumaMarutamachi 745 2445 +KawaramachiMarutamachi 1645 2445 +KarasumaGojo ShijoKarasuma +HorikawaShijo ShijoKarasuma +ShijoKarasuma ShijoKawaramachi +HorikawaShijo HorikawaOike +ShijoKarasuma KarasumaOike +ShijoKawaramachi KawaramachiOike +HorikawaOike KarasumaOike +KarasumaOike KawaramachiOike +KawaramachiOike KawabataOike +KarasumaOike KarasumaMarutamachi +KawaramachiOike KawaramachiMarutamachi +KarasumaMarutamachi KawaramachiMarutamachi +KarasumaGojo KawabataOike +8 9 +NishikojiNanajo 0 0 +NishiojiNanajo 750 0 +NishikojiGojo 0 800 +NishiojiGojo 750 800 +HorikawaGojo 2550 800 +NishiojiShijo 750 1700 +Enmachi 750 3250 +HorikawaMarutamachi 2550 3250 +NishikojiNanajo NishiojiNanajo +NishikojiNanajo NishikojiGojo +NishiojiNanajo NishiojiGojo +NishikojiGojo NishiojiGojo +NishiojiGojo HorikawaGojo +NishiojiGojo NishiojiShijo +HorikawaGojo HorikawaMarutamachi +NishiojiShijo Enmachi +Enmachi HorikawaMarutamachi +HorikawaGojo NishiojiShijo +0 0 diff --git a/codenet/public_test_cases/p01208/output.0.txt b/codenet/public_test_cases/p01208/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdc9f1640612d52cca289cc96a51263ee39d51aa --- /dev/null +++ b/codenet/public_test_cases/p01208/output.0.txt @@ -0,0 +1,4 @@ +2 +impossible +13 +4 diff --git a/codenet/public_test_cases/p01208/output.1.txt b/codenet/public_test_cases/p01208/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdc9f1640612d52cca289cc96a51263ee39d51aa --- /dev/null +++ b/codenet/public_test_cases/p01208/output.1.txt @@ -0,0 +1,4 @@ +2 +impossible +13 +4 diff --git a/codenet/public_test_cases/p01209/input.0.txt b/codenet/public_test_cases/p01209/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8b25e9802e71f31b95d2c463589657d96b0bcaa --- /dev/null +++ b/codenet/public_test_cases/p01209/input.0.txt @@ -0,0 +1,3 @@ +10 500 +16 A +0 0 diff --git a/codenet/public_test_cases/p01209/input.1.txt b/codenet/public_test_cases/p01209/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8b25e9802e71f31b95d2c463589657d96b0bcaa --- /dev/null +++ b/codenet/public_test_cases/p01209/input.1.txt @@ -0,0 +1,3 @@ +10 500 +16 A +0 0 diff --git a/codenet/public_test_cases/p01209/output.0.txt b/codenet/public_test_cases/p01209/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30d5b67fbeacc6a283af364f6f5340f3a06c9f1d --- /dev/null +++ b/codenet/public_test_cases/p01209/output.0.txt @@ -0,0 +1,2 @@ +124 +2 diff --git a/codenet/public_test_cases/p01209/output.1.txt b/codenet/public_test_cases/p01209/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..30d5b67fbeacc6a283af364f6f5340f3a06c9f1d --- /dev/null +++ b/codenet/public_test_cases/p01209/output.1.txt @@ -0,0 +1,2 @@ +124 +2 diff --git a/codenet/public_test_cases/p01210/input.0.txt b/codenet/public_test_cases/p01210/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6da8a459dcbb972257095ecf83d9d46e7b4e3a5 --- /dev/null +++ b/codenet/public_test_cases/p01210/input.0.txt @@ -0,0 +1,17 @@ +1 +SA +1 +C2 +2 +SA HA +2 +C2 C3 +5 +S3 S5 S8 S9 S2 +3 +H7 H3 H4 +10 +H7 CJ C5 CA C6 S2 D8 DA S6 HK +10 +C2 D6 D4 H5 DJ CX S8 S9 D3 D5 +0 diff --git a/codenet/public_test_cases/p01210/input.1.txt b/codenet/public_test_cases/p01210/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6da8a459dcbb972257095ecf83d9d46e7b4e3a5 --- /dev/null +++ b/codenet/public_test_cases/p01210/input.1.txt @@ -0,0 +1,17 @@ +1 +SA +1 +C2 +2 +SA HA +2 +C2 C3 +5 +S3 S5 S8 S9 S2 +3 +H7 H3 H4 +10 +H7 CJ C5 CA C6 S2 D8 DA S6 HK +10 +C2 D6 D4 H5 DJ CX S8 S9 D3 D5 +0 diff --git a/codenet/public_test_cases/p01210/output.0.txt b/codenet/public_test_cases/p01210/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2196d52e23e3ab920ba3bd99afa9d6ea412dbb01 --- /dev/null +++ b/codenet/public_test_cases/p01210/output.0.txt @@ -0,0 +1,4 @@ +A wins. +B wins. +B wins. +A wins. diff --git a/codenet/public_test_cases/p01210/output.1.txt b/codenet/public_test_cases/p01210/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2196d52e23e3ab920ba3bd99afa9d6ea412dbb01 --- /dev/null +++ b/codenet/public_test_cases/p01210/output.1.txt @@ -0,0 +1,4 @@ +A wins. +B wins. +B wins. +A wins. diff --git a/codenet/public_test_cases/p01211/input.0.txt b/codenet/public_test_cases/p01211/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..16e4c76efaeb15bdda0e8b765a186094ef7aa520 --- /dev/null +++ b/codenet/public_test_cases/p01211/input.0.txt @@ -0,0 +1,3 @@ +3 2 1 +3 2 0 +0 0 0 diff --git a/codenet/public_test_cases/p01211/input.1.txt b/codenet/public_test_cases/p01211/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..16e4c76efaeb15bdda0e8b765a186094ef7aa520 --- /dev/null +++ b/codenet/public_test_cases/p01211/input.1.txt @@ -0,0 +1,3 @@ +3 2 1 +3 2 0 +0 0 0 diff --git a/codenet/public_test_cases/p01211/output.0.txt b/codenet/public_test_cases/p01211/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..36a3982157c0609b9c24409ccdb09c5d6be16c8d --- /dev/null +++ b/codenet/public_test_cases/p01211/output.0.txt @@ -0,0 +1,2 @@ +13.36 +6.28 diff --git a/codenet/public_test_cases/p01211/output.1.txt b/codenet/public_test_cases/p01211/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..36a3982157c0609b9c24409ccdb09c5d6be16c8d --- /dev/null +++ b/codenet/public_test_cases/p01211/output.1.txt @@ -0,0 +1,2 @@ +13.36 +6.28 diff --git a/codenet/public_test_cases/p01212/input.0.txt b/codenet/public_test_cases/p01212/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2ccb2b5166f369d7b0ec52c369e36d0b49014c8 --- /dev/null +++ b/codenet/public_test_cases/p01212/input.0.txt @@ -0,0 +1,23 @@ +8 3 +######## +# gb) { + VAR saa; + VAR sab; + IF(saa > ga) { + saa = sab; + } +} +WHILE(gb > ga) { + VAR sba; + sba = ga; + ga = gb; +} +7 +VAR thisisthelongest; +IF(thisisthelongest / 0) { + VARone; + one = thisisthelongest + 1234567890123456789012345; +} +VAR another; +32 = another; +0 diff --git a/codenet/public_test_cases/p01221/input.1.txt b/codenet/public_test_cases/p01221/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2f114f4581c49d670a910b1c5d5b7015bd11598 --- /dev/null +++ b/codenet/public_test_cases/p01221/input.1.txt @@ -0,0 +1,24 @@ +14 +VAR ga; +VAR gb; +IF(ga > gb) { +VAR saa; +VAR sab; +IF(saa > ga) { +saa = sab; +} +} +WHILE(gb > ga) { +VAR sba; +sba = ga; +ga = gb; +} +7 +VAR thisisthelongest; +IF(thisisthelongest / 0) { +VARone; +one = thisisthelongest + 1234567890123456789012345; +} +VAR another; +32 = another; +0 diff --git a/codenet/public_test_cases/p01221/input.2.txt b/codenet/public_test_cases/p01221/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..23c774ae9f40161039fd5f30fd7ddd522d6711f9 --- /dev/null +++ b/codenet/public_test_cases/p01221/input.2.txt @@ -0,0 +1,24 @@ +14 +VAR ga; +VAR gb; +IF(ga > gb) { + VAR saa; + VAR sab; + IF(saa > ga) { + saa = sab; + } +} +WHILE(gb > ga) { + VAR sba; + sba = ga; + ga = gb; +} +7 +VAR thisisthelongest; +IF(thisisthelongest / 0) { + VARone; + one = thisisthelongest + 1234567890123456789012345; +} +VAR another; +32 = another; +0 diff --git a/codenet/public_test_cases/p01221/output.0.txt b/codenet/public_test_cases/p01221/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcf644afb412167f24e8e8078fd69185daf74c0e --- /dev/null +++ b/codenet/public_test_cases/p01221/output.0.txt @@ -0,0 +1,2 @@ +73 +59 diff --git a/codenet/public_test_cases/p01221/output.1.txt b/codenet/public_test_cases/p01221/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcf644afb412167f24e8e8078fd69185daf74c0e --- /dev/null +++ b/codenet/public_test_cases/p01221/output.1.txt @@ -0,0 +1,2 @@ +73 +59 diff --git a/codenet/public_test_cases/p01221/output.2.txt b/codenet/public_test_cases/p01221/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcf644afb412167f24e8e8078fd69185daf74c0e --- /dev/null +++ b/codenet/public_test_cases/p01221/output.2.txt @@ -0,0 +1,2 @@ +73 +59 diff --git a/codenet/public_test_cases/p01222/input.0.txt b/codenet/public_test_cases/p01222/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f8fc38bd932c57e18cc24e4d5229fb723e41504 --- /dev/null +++ b/codenet/public_test_cases/p01222/input.0.txt @@ -0,0 +1,6 @@ +1 1 +4 10 0 0 10 0 10 10 0 10 +-5 -20 30 15 +135 45 +0 -15 15 0 +0 0 diff --git a/codenet/public_test_cases/p01222/input.1.txt b/codenet/public_test_cases/p01222/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f8fc38bd932c57e18cc24e4d5229fb723e41504 --- /dev/null +++ b/codenet/public_test_cases/p01222/input.1.txt @@ -0,0 +1,6 @@ +1 1 +4 10 0 0 10 0 10 10 0 10 +-5 -20 30 15 +135 45 +0 -15 15 0 +0 0 diff --git a/codenet/public_test_cases/p01222/output.0.txt b/codenet/public_test_cases/p01222/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4080e821acfe2cb6228f6bb7e90187c915553707 --- /dev/null +++ b/codenet/public_test_cases/p01222/output.0.txt @@ -0,0 +1 @@ +11.213 diff --git a/codenet/public_test_cases/p01222/output.1.txt b/codenet/public_test_cases/p01222/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4080e821acfe2cb6228f6bb7e90187c915553707 --- /dev/null +++ b/codenet/public_test_cases/p01222/output.1.txt @@ -0,0 +1 @@ +11.213 diff --git a/codenet/public_test_cases/p01223/input.0.txt b/codenet/public_test_cases/p01223/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec989ac962f5207167fb4cd6d7cba3d607d82f78 --- /dev/null +++ b/codenet/public_test_cases/p01223/input.0.txt @@ -0,0 +1,11 @@ +5 +5 +10 70 30 50 90 +2 +20 100 +2 +100 30 +3 +50 50 50 +7 +123 45 678 901 234 567 890 diff --git a/codenet/public_test_cases/p01223/input.1.txt b/codenet/public_test_cases/p01223/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec989ac962f5207167fb4cd6d7cba3d607d82f78 --- /dev/null +++ b/codenet/public_test_cases/p01223/input.1.txt @@ -0,0 +1,11 @@ +5 +5 +10 70 30 50 90 +2 +20 100 +2 +100 30 +3 +50 50 50 +7 +123 45 678 901 234 567 890 diff --git a/codenet/public_test_cases/p01223/output.0.txt b/codenet/public_test_cases/p01223/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f17f2d47dc8e32965dd391b80758791307fe69ef --- /dev/null +++ b/codenet/public_test_cases/p01223/output.0.txt @@ -0,0 +1,5 @@ +60 40 +80 0 +0 70 +0 0 +633 667 diff --git a/codenet/public_test_cases/p01223/output.1.txt b/codenet/public_test_cases/p01223/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f17f2d47dc8e32965dd391b80758791307fe69ef --- /dev/null +++ b/codenet/public_test_cases/p01223/output.1.txt @@ -0,0 +1,5 @@ +60 40 +80 0 +0 70 +0 0 +633 667 diff --git a/codenet/public_test_cases/p01224/input.0.txt b/codenet/public_test_cases/p01224/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba867bd4b23a5983b3be68ba227b77f171cabf3d --- /dev/null +++ b/codenet/public_test_cases/p01224/input.0.txt @@ -0,0 +1,13 @@ +1 +2 +3 +4 +6 +12 +16 +28 +33550336 +99999998 +99999999 +100000000 +0 diff --git a/codenet/public_test_cases/p01224/input.1.txt b/codenet/public_test_cases/p01224/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba867bd4b23a5983b3be68ba227b77f171cabf3d --- /dev/null +++ b/codenet/public_test_cases/p01224/input.1.txt @@ -0,0 +1,13 @@ +1 +2 +3 +4 +6 +12 +16 +28 +33550336 +99999998 +99999999 +100000000 +0 diff --git a/codenet/public_test_cases/p01224/output.0.txt b/codenet/public_test_cases/p01224/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c58100102e42755881f3f0948e61f1dc0eaba026 --- /dev/null +++ b/codenet/public_test_cases/p01224/output.0.txt @@ -0,0 +1,12 @@ +deficient number +deficient number +deficient number +deficient number +perfect number +abundant number +deficient number +perfect number +perfect number +deficient number +deficient number +abundant number diff --git a/codenet/public_test_cases/p01224/output.1.txt b/codenet/public_test_cases/p01224/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c58100102e42755881f3f0948e61f1dc0eaba026 --- /dev/null +++ b/codenet/public_test_cases/p01224/output.1.txt @@ -0,0 +1,12 @@ +deficient number +deficient number +deficient number +deficient number +perfect number +abundant number +deficient number +perfect number +perfect number +deficient number +deficient number +abundant number diff --git a/codenet/public_test_cases/p01225/input.0.txt b/codenet/public_test_cases/p01225/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcae5ce46b102d44c430993ee1ff7d8009f2a7b0 --- /dev/null +++ b/codenet/public_test_cases/p01225/input.0.txt @@ -0,0 +1,11 @@ +5 +1 2 3 3 4 5 7 7 7 +R R R R R R G G G +1 2 2 3 4 4 4 4 5 +R R R R R R R R R +1 2 3 4 4 4 5 5 5 +R R B R R R R R R +1 1 1 3 4 5 6 6 6 +R R B G G G R R R +2 2 2 3 3 3 1 1 1 +R G B R G B R G B diff --git a/codenet/public_test_cases/p01225/input.1.txt b/codenet/public_test_cases/p01225/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcae5ce46b102d44c430993ee1ff7d8009f2a7b0 --- /dev/null +++ b/codenet/public_test_cases/p01225/input.1.txt @@ -0,0 +1,11 @@ +5 +1 2 3 3 4 5 7 7 7 +R R R R R R G G G +1 2 2 3 4 4 4 4 5 +R R R R R R R R R +1 2 3 4 4 4 5 5 5 +R R B R R R R R R +1 1 1 3 4 5 6 6 6 +R R B G G G R R R +2 2 2 3 3 3 1 1 1 +R G B R G B R G B diff --git a/codenet/public_test_cases/p01225/output.0.txt b/codenet/public_test_cases/p01225/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b3b3c74d7cc2e59d6efb1dd215f934120513e2f --- /dev/null +++ b/codenet/public_test_cases/p01225/output.0.txt @@ -0,0 +1,5 @@ +1 +0 +0 +0 +1 diff --git a/codenet/public_test_cases/p01225/output.1.txt b/codenet/public_test_cases/p01225/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b3b3c74d7cc2e59d6efb1dd215f934120513e2f --- /dev/null +++ b/codenet/public_test_cases/p01225/output.1.txt @@ -0,0 +1,5 @@ +1 +0 +0 +0 +1 diff --git a/codenet/public_test_cases/p01226/input.0.txt b/codenet/public_test_cases/p01226/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f012b38d64a42dcc83a657590683f2e437de9339 --- /dev/null +++ b/codenet/public_test_cases/p01226/input.0.txt @@ -0,0 +1,27 @@ +4 +4 6 +*.*..* +*..... +..-... +^.*#.. +10 +SRSSRRUSSR +2 2 +<. +.. +12 +DDSRRSUUSLLS +3 5 +>-#** +.-*#* +.-**# +15 +SSSDRSSSDRSSSUU +5 5 +v**** +***** +***** +***** +***** +44 +SSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD diff --git a/codenet/public_test_cases/p01226/input.1.txt b/codenet/public_test_cases/p01226/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f012b38d64a42dcc83a657590683f2e437de9339 --- /dev/null +++ b/codenet/public_test_cases/p01226/input.1.txt @@ -0,0 +1,27 @@ +4 +4 6 +*.*..* +*..... +..-... +^.*#.. +10 +SRSSRRUSSR +2 2 +<. +.. +12 +DDSRRSUUSLLS +3 5 +>-#** +.-*#* +.-**# +15 +SSSDRSSSDRSSSUU +5 5 +v**** +***** +***** +***** +***** +44 +SSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD diff --git a/codenet/public_test_cases/p01226/output.0.txt b/codenet/public_test_cases/p01226/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..987a19ad6c312f4c430f14512b4c97da169ad9f1 --- /dev/null +++ b/codenet/public_test_cases/p01226/output.0.txt @@ -0,0 +1,17 @@ +*....* +...... +..-... +..>#.. + +<. +.. + +^-#** +.-.#* +.-..# + +..... +.***. +..*.. +..*.. +....v diff --git a/codenet/public_test_cases/p01226/output.1.txt b/codenet/public_test_cases/p01226/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..987a19ad6c312f4c430f14512b4c97da169ad9f1 --- /dev/null +++ b/codenet/public_test_cases/p01226/output.1.txt @@ -0,0 +1,17 @@ +*....* +...... +..-... +..>#.. + +<. +.. + +^-#** +.-.#* +.-..# + +..... +.***. +..*.. +..*.. +....v diff --git a/codenet/public_test_cases/p01227/input.0.txt b/codenet/public_test_cases/p01227/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85b0c5628c459fc1e004b63e2e27c763a53c0709 --- /dev/null +++ b/codenet/public_test_cases/p01227/input.0.txt @@ -0,0 +1,13 @@ +6 +5 2 +10 30 40 70 100 +7 3 +3 6 10 17 21 26 28 +1 1 +100 +2 1 +0 1000000 +3 5 +30 70 150 +6 4 +0 10 20 30 40 50 diff --git a/codenet/public_test_cases/p01227/input.1.txt b/codenet/public_test_cases/p01227/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85b0c5628c459fc1e004b63e2e27c763a53c0709 --- /dev/null +++ b/codenet/public_test_cases/p01227/input.1.txt @@ -0,0 +1,13 @@ +6 +5 2 +10 30 40 70 100 +7 3 +3 6 10 17 21 26 28 +1 1 +100 +2 1 +0 1000000 +3 5 +30 70 150 +6 4 +0 10 20 30 40 50 diff --git a/codenet/public_test_cases/p01227/output.0.txt b/codenet/public_test_cases/p01227/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..96d4619617d007aeb7cfb52ae4e8b3ffedf16181 --- /dev/null +++ b/codenet/public_test_cases/p01227/output.0.txt @@ -0,0 +1,6 @@ +60 +13 +0 +1000000 +0 +20 diff --git a/codenet/public_test_cases/p01227/output.1.txt b/codenet/public_test_cases/p01227/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..96d4619617d007aeb7cfb52ae4e8b3ffedf16181 --- /dev/null +++ b/codenet/public_test_cases/p01227/output.1.txt @@ -0,0 +1,6 @@ +60 +13 +0 +1000000 +0 +20 diff --git a/codenet/public_test_cases/p01228/input.0.txt b/codenet/public_test_cases/p01228/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..42f284db6bf28f67adf68ce0416d123866e0e96a --- /dev/null +++ b/codenet/public_test_cases/p01228/input.0.txt @@ -0,0 +1,17 @@ +5 +2 +01000100 +00020202 +2 +0102 +00000810 +1 +0200020008000200 +5 +0001 +000001 +0000000001 +00000000000001 +0000000000000000000001 +1 +000000 diff --git a/codenet/public_test_cases/p01228/input.1.txt b/codenet/public_test_cases/p01228/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..42f284db6bf28f67adf68ce0416d123866e0e96a --- /dev/null +++ b/codenet/public_test_cases/p01228/input.1.txt @@ -0,0 +1,17 @@ +5 +2 +01000100 +00020202 +2 +0102 +00000810 +1 +0200020008000200 +5 +0001 +000001 +0000000001 +00000000000001 +0000000000000000000001 +1 +000000 diff --git a/codenet/public_test_cases/p01228/output.0.txt b/codenet/public_test_cases/p01228/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..503a9e2d0fce3ee9627526c8cb453a8dcacafd04 --- /dev/null +++ b/codenet/public_test_cases/p01228/output.0.txt @@ -0,0 +1,5 @@ +01020302 +01000A10 +02020802 +Too complex. +00 diff --git a/codenet/public_test_cases/p01228/output.1.txt b/codenet/public_test_cases/p01228/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..503a9e2d0fce3ee9627526c8cb453a8dcacafd04 --- /dev/null +++ b/codenet/public_test_cases/p01228/output.1.txt @@ -0,0 +1,5 @@ +01020302 +01000A10 +02020802 +Too complex. +00 diff --git a/codenet/public_test_cases/p01229/input.0.txt b/codenet/public_test_cases/p01229/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa047c3ca71d58fda1b908d76552bf3a30e87dbb --- /dev/null +++ b/codenet/public_test_cases/p01229/input.0.txt @@ -0,0 +1,15 @@ +7 +1 +2 +2 +1 2 +3 +4 1 4 +3 +4 0 4 +5 +4 1 4 0 4 +5 +4 1 4 1 4 +5 +4 2 4 0 4 diff --git a/codenet/public_test_cases/p01229/input.1.txt b/codenet/public_test_cases/p01229/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa047c3ca71d58fda1b908d76552bf3a30e87dbb --- /dev/null +++ b/codenet/public_test_cases/p01229/input.1.txt @@ -0,0 +1,15 @@ +7 +1 +2 +2 +1 2 +3 +4 1 4 +3 +4 0 4 +5 +4 1 4 0 4 +5 +4 1 4 1 4 +5 +4 2 4 0 4 diff --git a/codenet/public_test_cases/p01229/output.0.txt b/codenet/public_test_cases/p01229/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f37a88e34dec23c8bf979366051f536417d0e91b --- /dev/null +++ b/codenet/public_test_cases/p01229/output.0.txt @@ -0,0 +1,7 @@ +2 +2 +8 +4 +7 +12 +11 diff --git a/codenet/public_test_cases/p01229/output.1.txt b/codenet/public_test_cases/p01229/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f37a88e34dec23c8bf979366051f536417d0e91b --- /dev/null +++ b/codenet/public_test_cases/p01229/output.1.txt @@ -0,0 +1,7 @@ +2 +2 +8 +4 +7 +12 +11 diff --git a/codenet/public_test_cases/p01230/input.0.txt b/codenet/public_test_cases/p01230/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6749b59785c3fe23b5e5d80e36dc02f178b35da --- /dev/null +++ b/codenet/public_test_cases/p01230/input.0.txt @@ -0,0 +1,25 @@ +2 1 1 +1 2 +2 1 2 +1 2 +3 1 2 +1 2 +8 8 5778 +1 2 +2 3 +2 4 +3 5 +5 6 +6 7 +7 8 +4 8 +8 8 5777 +1 2 +2 3 +2 4 +3 5 +5 6 +6 7 +7 8 +4 8 +0 0 0 diff --git a/codenet/public_test_cases/p01230/input.1.txt b/codenet/public_test_cases/p01230/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6749b59785c3fe23b5e5d80e36dc02f178b35da --- /dev/null +++ b/codenet/public_test_cases/p01230/input.1.txt @@ -0,0 +1,25 @@ +2 1 1 +1 2 +2 1 2 +1 2 +3 1 2 +1 2 +8 8 5778 +1 2 +2 3 +2 4 +3 5 +5 6 +6 7 +7 8 +4 8 +8 8 5777 +1 2 +2 3 +2 4 +3 5 +5 6 +6 7 +7 8 +4 8 +0 0 0 diff --git a/codenet/public_test_cases/p01230/output.0.txt b/codenet/public_test_cases/p01230/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6660bb915970364ebfb69efdc9ca21fc5722161 --- /dev/null +++ b/codenet/public_test_cases/p01230/output.0.txt @@ -0,0 +1,5 @@ +yes +no +no +yes +no diff --git a/codenet/public_test_cases/p01230/output.1.txt b/codenet/public_test_cases/p01230/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6660bb915970364ebfb69efdc9ca21fc5722161 --- /dev/null +++ b/codenet/public_test_cases/p01230/output.1.txt @@ -0,0 +1,5 @@ +yes +no +no +yes +no diff --git a/codenet/public_test_cases/p01231/input.0.txt b/codenet/public_test_cases/p01231/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a852a3628d7f610a04faa8780ca3c3ee1212ad1d --- /dev/null +++ b/codenet/public_test_cases/p01231/input.0.txt @@ -0,0 +1,45 @@ +6 +8 +0 1 0 0 0 0 0 0 +1 0 1 0 0 0 0 0 +0 1 0 1 1 0 0 0 +0 0 1 0 0 0 0 0 +0 0 1 0 0 1 1 0 +0 0 0 0 1 0 0 0 +0 0 0 0 1 0 0 1 +0 0 0 0 0 0 1 0 +3 0 +4 +0 1 1 0 +1 0 0 1 +1 0 0 1 +0 1 1 0 +1 0 +5 +0 1 0 1 0 +1 0 0 1 0 +0 0 0 0 1 +1 1 0 0 0 +0 0 1 0 0 +2 0 +5 +0 1 0 0 1 +1 0 1 1 1 +0 1 0 1 0 +0 1 1 0 1 +1 1 0 1 0 +2 4 +5 +0 1 0 1 0 +1 0 1 1 0 +0 1 0 0 1 +1 1 0 0 1 +0 0 1 1 0 +3 0 +5 +0 1 0 1 1 +1 0 1 0 1 +0 1 0 1 0 +1 0 1 0 1 +1 1 0 1 0 +0 4 diff --git a/codenet/public_test_cases/p01231/input.1.txt b/codenet/public_test_cases/p01231/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a852a3628d7f610a04faa8780ca3c3ee1212ad1d --- /dev/null +++ b/codenet/public_test_cases/p01231/input.1.txt @@ -0,0 +1,45 @@ +6 +8 +0 1 0 0 0 0 0 0 +1 0 1 0 0 0 0 0 +0 1 0 1 1 0 0 0 +0 0 1 0 0 0 0 0 +0 0 1 0 0 1 1 0 +0 0 0 0 1 0 0 0 +0 0 0 0 1 0 0 1 +0 0 0 0 0 0 1 0 +3 0 +4 +0 1 1 0 +1 0 0 1 +1 0 0 1 +0 1 1 0 +1 0 +5 +0 1 0 1 0 +1 0 0 1 0 +0 0 0 0 1 +1 1 0 0 0 +0 0 1 0 0 +2 0 +5 +0 1 0 0 1 +1 0 1 1 1 +0 1 0 1 0 +0 1 1 0 1 +1 1 0 1 0 +2 4 +5 +0 1 0 1 0 +1 0 1 1 0 +0 1 0 0 1 +1 1 0 0 1 +0 0 1 1 0 +3 0 +5 +0 1 0 1 1 +1 0 1 0 1 +0 1 0 1 0 +1 0 1 0 1 +1 1 0 1 0 +0 4 diff --git a/codenet/public_test_cases/p01231/output.0.txt b/codenet/public_test_cases/p01231/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fb8c95c0f947b539ab56d34d4d12d4371c40288 --- /dev/null +++ b/codenet/public_test_cases/p01231/output.0.txt @@ -0,0 +1,6 @@ +5 +infinity +infinity +2 +infinity +1 diff --git a/codenet/public_test_cases/p01231/output.1.txt b/codenet/public_test_cases/p01231/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fb8c95c0f947b539ab56d34d4d12d4371c40288 --- /dev/null +++ b/codenet/public_test_cases/p01231/output.1.txt @@ -0,0 +1,6 @@ +5 +infinity +infinity +2 +infinity +1 diff --git a/codenet/public_test_cases/p01232/input.0.txt b/codenet/public_test_cases/p01232/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7290a17f774a5947ce924088badcf91d95ebee2 --- /dev/null +++ b/codenet/public_test_cases/p01232/input.0.txt @@ -0,0 +1,18 @@ +2 +3 +R 1 = +L 2 + - +L 2 * / +6 +a+b*c-d +(p-q)/q/d +a+b*c=d-e +t+t+t+t+t +s=s=s=s=s +(((((z))))) +3 +R 3 = < > +L 3 & | ^ +L 4 + - * / +1 +a>b*c=dk diff --git a/codenet/public_test_cases/p01232/input.1.txt b/codenet/public_test_cases/p01232/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7290a17f774a5947ce924088badcf91d95ebee2 --- /dev/null +++ b/codenet/public_test_cases/p01232/input.1.txt @@ -0,0 +1,18 @@ +2 +3 +R 1 = +L 2 + - +L 2 * / +6 +a+b*c-d +(p-q)/q/d +a+b*c=d-e +t+t+t+t+t +s=s=s=s=s +(((((z))))) +3 +R 3 = < > +L 3 & | ^ +L 4 + - * / +1 +a>b*c=dk diff --git a/codenet/public_test_cases/p01232/output.0.txt b/codenet/public_test_cases/p01232/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8779ac598c4d1e0feacc0623519ce34477d3d864 --- /dev/null +++ b/codenet/public_test_cases/p01232/output.0.txt @@ -0,0 +1,8 @@ +((a+(b*c))-d) +(((p-q)/q)/d) +((a+(b*c))=(d-e)) +((((t+t)+t)+t)+t) +(s=(s=(s=(s=s)))) +z + +(a>((b*c)=(d<((((e|(f+g))^h)&i)<(j>k))))) diff --git a/codenet/public_test_cases/p01232/output.1.txt b/codenet/public_test_cases/p01232/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8779ac598c4d1e0feacc0623519ce34477d3d864 --- /dev/null +++ b/codenet/public_test_cases/p01232/output.1.txt @@ -0,0 +1,8 @@ +((a+(b*c))-d) +(((p-q)/q)/d) +((a+(b*c))=(d-e)) +((((t+t)+t)+t)+t) +(s=(s=(s=(s=s)))) +z + +(a>((b*c)=(d<((((e|(f+g))^h)&i)<(j>k))))) diff --git a/codenet/public_test_cases/p01233/input.0.txt b/codenet/public_test_cases/p01233/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8a372b1900127e7925fc63afef3fbb6f3858899 --- /dev/null +++ b/codenet/public_test_cases/p01233/input.0.txt @@ -0,0 +1,5 @@ +4 +0 1 3 2 0 1 +1 1 2 2 9 9 +0 0 1 4 5 5 +0 0 1 4 5 10 diff --git a/codenet/public_test_cases/p01233/input.1.txt b/codenet/public_test_cases/p01233/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8a372b1900127e7925fc63afef3fbb6f3858899 --- /dev/null +++ b/codenet/public_test_cases/p01233/input.1.txt @@ -0,0 +1,5 @@ +4 +0 1 3 2 0 1 +1 1 2 2 9 9 +0 0 1 4 5 5 +0 0 1 4 5 10 diff --git a/codenet/public_test_cases/p01233/output.0.txt b/codenet/public_test_cases/p01233/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc856dafab0941942ccea4202bfa3a5b02bf4371 --- /dev/null +++ b/codenet/public_test_cases/p01233/output.0.txt @@ -0,0 +1,4 @@ +0 +1 +2 +3 diff --git a/codenet/public_test_cases/p01233/output.1.txt b/codenet/public_test_cases/p01233/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc856dafab0941942ccea4202bfa3a5b02bf4371 --- /dev/null +++ b/codenet/public_test_cases/p01233/output.1.txt @@ -0,0 +1,4 @@ +0 +1 +2 +3 diff --git a/codenet/public_test_cases/p01234/input.0.txt b/codenet/public_test_cases/p01234/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76892ff1c4f0af620db4758d09ceff0b70475ed7 --- /dev/null +++ b/codenet/public_test_cases/p01234/input.0.txt @@ -0,0 +1,3 @@ +2 +150 1 50 30 50 +100 1 20 30 40 diff --git a/codenet/public_test_cases/p01234/output.0.txt b/codenet/public_test_cases/p01234/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9963ba1ab61a4001cc2cba5207ac773e65538567 --- /dev/null +++ b/codenet/public_test_cases/p01234/output.0.txt @@ -0,0 +1,6 @@ +Case 1: +Fire at 37.995392 degree(s). +Projectile destroyed in 2.290123 second(s). + +Case 2: +Projectile reaches the land. diff --git a/codenet/public_test_cases/p01235/input.0.txt b/codenet/public_test_cases/p01235/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..77cfbf4299d48746447e0efbf92add1d05f6cf0f --- /dev/null +++ b/codenet/public_test_cases/p01235/input.0.txt @@ -0,0 +1,5 @@ +2 +2 1 2 2 +0 0 1 0 +0 1 0 2 +0 diff --git a/codenet/public_test_cases/p01235/input.1.txt b/codenet/public_test_cases/p01235/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..77cfbf4299d48746447e0efbf92add1d05f6cf0f --- /dev/null +++ b/codenet/public_test_cases/p01235/input.1.txt @@ -0,0 +1,5 @@ +2 +2 1 2 2 +0 0 1 0 +0 1 0 2 +0 diff --git a/codenet/public_test_cases/p01235/output.0.txt b/codenet/public_test_cases/p01235/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b60e7120826afb7e33767ef68b38de129f831ab --- /dev/null +++ b/codenet/public_test_cases/p01235/output.0.txt @@ -0,0 +1 @@ +Case 1: 3.00000 diff --git a/codenet/public_test_cases/p01235/output.1.txt b/codenet/public_test_cases/p01235/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b60e7120826afb7e33767ef68b38de129f831ab --- /dev/null +++ b/codenet/public_test_cases/p01235/output.1.txt @@ -0,0 +1 @@ +Case 1: 3.00000 diff --git a/codenet/public_test_cases/p01236/input.0.txt b/codenet/public_test_cases/p01236/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f40f9c611f85c399498288dcb2c9db7ee3a329ad --- /dev/null +++ b/codenet/public_test_cases/p01236/input.0.txt @@ -0,0 +1,22 @@ +5 5 +##### +##### +##### +##### +##### +4 4 +#### +#### +#### +#### +4 4 +#... +.... +.... +...# +4 4 +.#.# +#.#. +.#.# +#.#. +0 0 diff --git a/codenet/public_test_cases/p01236/input.1.txt b/codenet/public_test_cases/p01236/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffb66d2dcf41d51e70f909c1f57b7a99b275a40b --- /dev/null +++ b/codenet/public_test_cases/p01236/input.1.txt @@ -0,0 +1,22 @@ +5 5 + + + + + +4 4 + + + + +4 4 +... +.... +.... +...# +4 4 +.#.# +.#. +.#.# +.#. +0 0 diff --git a/codenet/public_test_cases/p01236/input.2.txt b/codenet/public_test_cases/p01236/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f40f9c611f85c399498288dcb2c9db7ee3a329ad --- /dev/null +++ b/codenet/public_test_cases/p01236/input.2.txt @@ -0,0 +1,22 @@ +5 5 +##### +##### +##### +##### +##### +4 4 +#### +#### +#### +#### +4 4 +#... +.... +.... +...# +4 4 +.#.# +#.#. +.#.# +#.#. +0 0 diff --git a/codenet/public_test_cases/p01236/output.0.txt b/codenet/public_test_cases/p01236/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4110aff8e1b1e99fb6e3ee72dfbeed57fc6d1e35 --- /dev/null +++ b/codenet/public_test_cases/p01236/output.0.txt @@ -0,0 +1,4 @@ +Case 1: 10 +Case 2: 6 +Case 3: 2 +Case 4: Impossible diff --git a/codenet/public_test_cases/p01236/output.1.txt b/codenet/public_test_cases/p01236/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4110aff8e1b1e99fb6e3ee72dfbeed57fc6d1e35 --- /dev/null +++ b/codenet/public_test_cases/p01236/output.1.txt @@ -0,0 +1,4 @@ +Case 1: 10 +Case 2: 6 +Case 3: 2 +Case 4: Impossible diff --git a/codenet/public_test_cases/p01236/output.2.txt b/codenet/public_test_cases/p01236/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4110aff8e1b1e99fb6e3ee72dfbeed57fc6d1e35 --- /dev/null +++ b/codenet/public_test_cases/p01236/output.2.txt @@ -0,0 +1,4 @@ +Case 1: 10 +Case 2: 6 +Case 3: 2 +Case 4: Impossible diff --git a/codenet/public_test_cases/p01237/input.0.txt b/codenet/public_test_cases/p01237/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a33a141cca02bbf67ca0308a06ab1ed8cb5cbbf --- /dev/null +++ b/codenet/public_test_cases/p01237/input.0.txt @@ -0,0 +1,13 @@ +3 3 1 +1 0 0 +0 0 0 0 +0 0 0 0 0 +0 0 0 0 +0 0 1 +3 3 2 +1 0 0 +0 0 0 0 +0 0 0 0 0 +0 0 0 0 +0 0 1 +0 0 0 diff --git a/codenet/public_test_cases/p01237/input.1.txt b/codenet/public_test_cases/p01237/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a33a141cca02bbf67ca0308a06ab1ed8cb5cbbf --- /dev/null +++ b/codenet/public_test_cases/p01237/input.1.txt @@ -0,0 +1,13 @@ +3 3 1 +1 0 0 +0 0 0 0 +0 0 0 0 0 +0 0 0 0 +0 0 1 +3 3 2 +1 0 0 +0 0 0 0 +0 0 0 0 0 +0 0 0 0 +0 0 1 +0 0 0 diff --git a/codenet/public_test_cases/p01237/output.0.txt b/codenet/public_test_cases/p01237/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af760e1dc4bf6ef835d7b99a4e621a26d7fed2cd --- /dev/null +++ b/codenet/public_test_cases/p01237/output.0.txt @@ -0,0 +1,2 @@ +Case 1: 8 +Case 2: 18 diff --git a/codenet/public_test_cases/p01237/output.1.txt b/codenet/public_test_cases/p01237/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af760e1dc4bf6ef835d7b99a4e621a26d7fed2cd --- /dev/null +++ b/codenet/public_test_cases/p01237/output.1.txt @@ -0,0 +1,2 @@ +Case 1: 8 +Case 2: 18 diff --git a/codenet/public_test_cases/p01238/input.0.txt b/codenet/public_test_cases/p01238/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a384d6e47192315a7e2bf6737b188b13b20f9c9e --- /dev/null +++ b/codenet/public_test_cases/p01238/input.0.txt @@ -0,0 +1,3 @@ +1 +2 +0 diff --git a/codenet/public_test_cases/p01238/input.1.txt b/codenet/public_test_cases/p01238/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a384d6e47192315a7e2bf6737b188b13b20f9c9e --- /dev/null +++ b/codenet/public_test_cases/p01238/input.1.txt @@ -0,0 +1,3 @@ +1 +2 +0 diff --git a/codenet/public_test_cases/p01238/output.0.txt b/codenet/public_test_cases/p01238/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..adc8aa4ca6dccbf900193ccb72f3b5913186f20c --- /dev/null +++ b/codenet/public_test_cases/p01238/output.0.txt @@ -0,0 +1,2 @@ +Case 1: 3 2 +Case 2: 2 1 diff --git a/codenet/public_test_cases/p01238/output.1.txt b/codenet/public_test_cases/p01238/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..adc8aa4ca6dccbf900193ccb72f3b5913186f20c --- /dev/null +++ b/codenet/public_test_cases/p01238/output.1.txt @@ -0,0 +1,2 @@ +Case 1: 3 2 +Case 2: 2 1 diff --git a/codenet/public_test_cases/p01239/input.0.txt b/codenet/public_test_cases/p01239/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd5192b0b8a310db935e4987ecf5459510c8c2c5 --- /dev/null +++ b/codenet/public_test_cases/p01239/input.0.txt @@ -0,0 +1,9 @@ +4 +0 1 0 9 +10 1 10 9 +1 0 9 0 +1 10 9 10 +2 +1.2 3.4 5.6 7.8 +5.6 3.4 1.2 7.8 +0 diff --git a/codenet/public_test_cases/p01239/input.1.txt b/codenet/public_test_cases/p01239/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd5192b0b8a310db935e4987ecf5459510c8c2c5 --- /dev/null +++ b/codenet/public_test_cases/p01239/input.1.txt @@ -0,0 +1,9 @@ +4 +0 1 0 9 +10 1 10 9 +1 0 9 0 +1 10 9 10 +2 +1.2 3.4 5.6 7.8 +5.6 3.4 1.2 7.8 +0 diff --git a/codenet/public_test_cases/p01239/output.0.txt b/codenet/public_test_cases/p01239/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b0707d332de1ce20a3f95ddf4d5f08cf73d0577 --- /dev/null +++ b/codenet/public_test_cases/p01239/output.0.txt @@ -0,0 +1,2 @@ +Case 1: 36.24264 +Case 2: 16.84508 diff --git a/codenet/public_test_cases/p01239/output.1.txt b/codenet/public_test_cases/p01239/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b0707d332de1ce20a3f95ddf4d5f08cf73d0577 --- /dev/null +++ b/codenet/public_test_cases/p01239/output.1.txt @@ -0,0 +1,2 @@ +Case 1: 36.24264 +Case 2: 16.84508 diff --git a/codenet/public_test_cases/p01240/input.0.txt b/codenet/public_test_cases/p01240/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3be27d7e4a950de6905041c5078edb9958024fd --- /dev/null +++ b/codenet/public_test_cases/p01240/input.0.txt @@ -0,0 +1,7 @@ +2 +2 2 +2 3 +3 5 +3 2 +4 1 1 +2 1 4 diff --git a/codenet/public_test_cases/p01240/input.1.txt b/codenet/public_test_cases/p01240/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3be27d7e4a950de6905041c5078edb9958024fd --- /dev/null +++ b/codenet/public_test_cases/p01240/input.1.txt @@ -0,0 +1,7 @@ +2 +2 2 +2 3 +3 5 +3 2 +4 1 1 +2 1 4 diff --git a/codenet/public_test_cases/p01240/output.0.txt b/codenet/public_test_cases/p01240/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..57a02a4be312ac3c97d92e5993be2af8fd09def0 --- /dev/null +++ b/codenet/public_test_cases/p01240/output.0.txt @@ -0,0 +1,2 @@ +Case 1: 7 +Case 2: 8 diff --git a/codenet/public_test_cases/p01240/output.1.txt b/codenet/public_test_cases/p01240/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57a02a4be312ac3c97d92e5993be2af8fd09def0 --- /dev/null +++ b/codenet/public_test_cases/p01240/output.1.txt @@ -0,0 +1,2 @@ +Case 1: 7 +Case 2: 8 diff --git a/codenet/public_test_cases/p01241/input.0.txt b/codenet/public_test_cases/p01241/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcad53721e29bdd219b8869b3ae8f4ada88d0b29 --- /dev/null +++ b/codenet/public_test_cases/p01241/input.0.txt @@ -0,0 +1,4 @@ +2 1 +10 5 +15 10 +0 0 diff --git a/codenet/public_test_cases/p01241/input.1.txt b/codenet/public_test_cases/p01241/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcad53721e29bdd219b8869b3ae8f4ada88d0b29 --- /dev/null +++ b/codenet/public_test_cases/p01241/input.1.txt @@ -0,0 +1,4 @@ +2 1 +10 5 +15 10 +0 0 diff --git a/codenet/public_test_cases/p01241/output.0.txt b/codenet/public_test_cases/p01241/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a58ce8a171677aadc88086ec632d2bf4776f1b35 --- /dev/null +++ b/codenet/public_test_cases/p01241/output.0.txt @@ -0,0 +1,3 @@ +Case 1: 1 +Case 2: 11 +Case 3: 210 diff --git a/codenet/public_test_cases/p01241/output.1.txt b/codenet/public_test_cases/p01241/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a58ce8a171677aadc88086ec632d2bf4776f1b35 --- /dev/null +++ b/codenet/public_test_cases/p01241/output.1.txt @@ -0,0 +1,3 @@ +Case 1: 1 +Case 2: 11 +Case 3: 210 diff --git a/codenet/public_test_cases/p01242/input.0.txt b/codenet/public_test_cases/p01242/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..059ce6f1747b61484faef3d77b4b1d49775c2049 --- /dev/null +++ b/codenet/public_test_cases/p01242/input.0.txt @@ -0,0 +1,12 @@ +4 3 +ooxx +ooxx +ooxx +4 1 +null +4 4 +aabb +aabb +ccdd +ccdd +0 0 diff --git a/codenet/public_test_cases/p01242/output.0.txt b/codenet/public_test_cases/p01242/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..942b2714a342aa264b1b737ab7c06b99ae5ff98f --- /dev/null +++ b/codenet/public_test_cases/p01242/output.0.txt @@ -0,0 +1,12 @@ +Case 1: +o 0 0 +x 2 0 +Case 2: +l 2 0 +n 0 0 +u 1 0 +Case 3: +a 0 0 +b 2 0 +c 0 2 +d 2 2 diff --git a/codenet/public_test_cases/p01243/input.0.txt b/codenet/public_test_cases/p01243/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a3eec57f26818ff352a0352708f8a1ec9f07a5d --- /dev/null +++ b/codenet/public_test_cases/p01243/input.0.txt @@ -0,0 +1,16 @@ +5 4 +0 0 +4 0 +4 4 +2 2 +0 4 +8 80 +45 41 +70 31 +86 61 +72 64 +80 79 +40 80 +8 94 +28 22 +0 0 diff --git a/codenet/public_test_cases/p01243/input.1.txt b/codenet/public_test_cases/p01243/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a3eec57f26818ff352a0352708f8a1ec9f07a5d --- /dev/null +++ b/codenet/public_test_cases/p01243/input.1.txt @@ -0,0 +1,16 @@ +5 4 +0 0 +4 0 +4 4 +2 2 +0 4 +8 80 +45 41 +70 31 +86 61 +72 64 +80 79 +40 80 +8 94 +28 22 +0 0 diff --git a/codenet/public_test_cases/p01243/output.0.txt b/codenet/public_test_cases/p01243/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fbfcdfd4408bef2615a6a63bca0e11af53467d --- /dev/null +++ b/codenet/public_test_cases/p01243/output.0.txt @@ -0,0 +1,2 @@ +case 1: 16.0 +case 2: 3375.0 diff --git a/codenet/public_test_cases/p01243/output.1.txt b/codenet/public_test_cases/p01243/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fbfcdfd4408bef2615a6a63bca0e11af53467d --- /dev/null +++ b/codenet/public_test_cases/p01243/output.1.txt @@ -0,0 +1,2 @@ +case 1: 16.0 +case 2: 3375.0 diff --git a/codenet/public_test_cases/p01244/input.0.txt b/codenet/public_test_cases/p01244/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c78acc9afbcd5e69ad4fa555d5b7bfba1389dd6e --- /dev/null +++ b/codenet/public_test_cases/p01244/input.0.txt @@ -0,0 +1,6 @@ +1 +2 +3 +10 +50 +0 diff --git a/codenet/public_test_cases/p01244/input.1.txt b/codenet/public_test_cases/p01244/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c78acc9afbcd5e69ad4fa555d5b7bfba1389dd6e --- /dev/null +++ b/codenet/public_test_cases/p01244/input.1.txt @@ -0,0 +1,6 @@ +1 +2 +3 +10 +50 +0 diff --git a/codenet/public_test_cases/p01244/output.0.txt b/codenet/public_test_cases/p01244/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..092c1e9d2f2a56f2dd3cf61b4912cc8e25e43f41 --- /dev/null +++ b/codenet/public_test_cases/p01244/output.0.txt @@ -0,0 +1,5 @@ +1.000000 +1.500000 +1.500000 +2.000000 +2.583333 diff --git a/codenet/public_test_cases/p01244/output.1.txt b/codenet/public_test_cases/p01244/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..092c1e9d2f2a56f2dd3cf61b4912cc8e25e43f41 --- /dev/null +++ b/codenet/public_test_cases/p01244/output.1.txt @@ -0,0 +1,5 @@ +1.000000 +1.500000 +1.500000 +2.000000 +2.583333 diff --git a/codenet/public_test_cases/p01245/input.0.txt b/codenet/public_test_cases/p01245/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a69ea11bb33b284334f72892faebec0bda15948 --- /dev/null +++ b/codenet/public_test_cases/p01245/input.0.txt @@ -0,0 +1,49 @@ +7 8 +0 2 3 +2 3 -20 +3 4 3 +4 1 -5 +1 5 1 +5 4 5 +1 3 2 +3 6 -2 +0 6 30 +7 8 +0 2 3 +2 3 -20 +3 4 3 +4 1 -5 +1 5 1 +5 4 5 +1 3 2 +3 6 -2 +0 6 20 +4 4 +0 1 -10 +1 2 -50 +2 1 51 +1 3 1 +0 3 20 +11 14 +0 1 -49 +1 2 1 +2 3 40 +3 1 -40 +1 4 -9 +4 5 40 +5 1 -30 +1 6 -19 +6 7 40 +7 1 -20 +1 8 -30 +8 9 40 +9 1 -9 +1 10 1 +0 10 50 +3 4 +0 1 -49 +1 2 10 +2 0 50 +2 1 10 +0 1 50 +0 0 diff --git a/codenet/public_test_cases/p01245/input.1.txt b/codenet/public_test_cases/p01245/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a69ea11bb33b284334f72892faebec0bda15948 --- /dev/null +++ b/codenet/public_test_cases/p01245/input.1.txt @@ -0,0 +1,49 @@ +7 8 +0 2 3 +2 3 -20 +3 4 3 +4 1 -5 +1 5 1 +5 4 5 +1 3 2 +3 6 -2 +0 6 30 +7 8 +0 2 3 +2 3 -20 +3 4 3 +4 1 -5 +1 5 1 +5 4 5 +1 3 2 +3 6 -2 +0 6 20 +4 4 +0 1 -10 +1 2 -50 +2 1 51 +1 3 1 +0 3 20 +11 14 +0 1 -49 +1 2 1 +2 3 40 +3 1 -40 +1 4 -9 +4 5 40 +5 1 -30 +1 6 -19 +6 7 40 +7 1 -20 +1 8 -30 +8 9 40 +9 1 -9 +1 10 1 +0 10 50 +3 4 +0 1 -49 +1 2 10 +2 0 50 +2 1 10 +0 1 50 +0 0 diff --git a/codenet/public_test_cases/p01245/output.0.txt b/codenet/public_test_cases/p01245/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55206362d074ed3d47acaf6cf6bc1cfee64c9861 --- /dev/null +++ b/codenet/public_test_cases/p01245/output.0.txt @@ -0,0 +1,5 @@ +Case 1: 25 +Case 2: GAME OVER +Case 3: 11 +Case 4: 31 +Case 5: 1 diff --git a/codenet/public_test_cases/p01245/output.1.txt b/codenet/public_test_cases/p01245/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..55206362d074ed3d47acaf6cf6bc1cfee64c9861 --- /dev/null +++ b/codenet/public_test_cases/p01245/output.1.txt @@ -0,0 +1,5 @@ +Case 1: 25 +Case 2: GAME OVER +Case 3: 11 +Case 4: 31 +Case 5: 1 diff --git a/codenet/public_test_cases/p01246/input.0.txt b/codenet/public_test_cases/p01246/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a17547d277e59cdec1a20fba613351fa98a6c267 --- /dev/null +++ b/codenet/public_test_cases/p01246/input.0.txt @@ -0,0 +1,27 @@ +8 +1 0 +2 0 +3 1 +3 2 +2 3 +1 3 +0 2 +0 1 +1 2 3 4 5 6 7 8 +8 +1 0 +2 0 +3 1 +3 2 +2 3 +1 3 +0 2 +0 1 +4 3 2 1 8 7 6 5 +4 +0 0 +1 0 +1 1 +0 1 +1 2 3 4 +0 diff --git a/codenet/public_test_cases/p01246/input.1.txt b/codenet/public_test_cases/p01246/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a17547d277e59cdec1a20fba613351fa98a6c267 --- /dev/null +++ b/codenet/public_test_cases/p01246/input.1.txt @@ -0,0 +1,27 @@ +8 +1 0 +2 0 +3 1 +3 2 +2 3 +1 3 +0 2 +0 1 +1 2 3 4 5 6 7 8 +8 +1 0 +2 0 +3 1 +3 2 +2 3 +1 3 +0 2 +0 1 +4 3 2 1 8 7 6 5 +4 +0 0 +1 0 +1 1 +0 1 +1 2 3 4 +0 diff --git a/codenet/public_test_cases/p01246/output.0.txt b/codenet/public_test_cases/p01246/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..729f25eb7fbbf3020a22aeb8e54b1731285d9c00 --- /dev/null +++ b/codenet/public_test_cases/p01246/output.0.txt @@ -0,0 +1,3 @@ +Case 1: 10.00000 +Case 2: No area +Case 3: Infinity diff --git a/codenet/public_test_cases/p01246/output.1.txt b/codenet/public_test_cases/p01246/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..729f25eb7fbbf3020a22aeb8e54b1731285d9c00 --- /dev/null +++ b/codenet/public_test_cases/p01246/output.1.txt @@ -0,0 +1,3 @@ +Case 1: 10.00000 +Case 2: No area +Case 3: Infinity diff --git a/codenet/public_test_cases/p01247/input.0.txt b/codenet/public_test_cases/p01247/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ca200fd03d013dd183c48245c5ac04254cfe2ad --- /dev/null +++ b/codenet/public_test_cases/p01247/input.0.txt @@ -0,0 +1,20 @@ +3 +0.7 0.1 0.2 +0.1 0.8 0.1 +0.0 0.0 1.0 +4 3 2 +8 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +2 2 2 2 2 2 2 2 +2 +1 0 +1 0 +2 2 +0 diff --git a/codenet/public_test_cases/p01247/input.1.txt b/codenet/public_test_cases/p01247/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ca200fd03d013dd183c48245c5ac04254cfe2ad --- /dev/null +++ b/codenet/public_test_cases/p01247/input.1.txt @@ -0,0 +1,20 @@ +3 +0.7 0.1 0.2 +0.1 0.8 0.1 +0.0 0.0 1.0 +4 3 2 +8 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 +2 2 2 2 2 2 2 2 +2 +1 0 +1 0 +2 2 +0 diff --git a/codenet/public_test_cases/p01247/output.0.txt b/codenet/public_test_cases/p01247/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..844dd271b4ff98405d7f184e1ed1b1f08ecb578f --- /dev/null +++ b/codenet/public_test_cases/p01247/output.0.txt @@ -0,0 +1,3 @@ +Case 1: -1.89723999 +Case 2: -8.14438201 +Case 3: -INFINITY diff --git a/codenet/public_test_cases/p01247/output.1.txt b/codenet/public_test_cases/p01247/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..844dd271b4ff98405d7f184e1ed1b1f08ecb578f --- /dev/null +++ b/codenet/public_test_cases/p01247/output.1.txt @@ -0,0 +1,3 @@ +Case 1: -1.89723999 +Case 2: -8.14438201 +Case 3: -INFINITY diff --git a/codenet/public_test_cases/p01248/input.0.txt b/codenet/public_test_cases/p01248/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e20713a9241dd53e533386768c5babe58097621 --- /dev/null +++ b/codenet/public_test_cases/p01248/input.0.txt @@ -0,0 +1,11 @@ +4 10 +8 +6 +9 +1 +4 7 +1 +2 +3 +4 +0 0 diff --git a/codenet/public_test_cases/p01248/input.1.txt b/codenet/public_test_cases/p01248/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e20713a9241dd53e533386768c5babe58097621 --- /dev/null +++ b/codenet/public_test_cases/p01248/input.1.txt @@ -0,0 +1,11 @@ +4 10 +8 +6 +9 +1 +4 7 +1 +2 +3 +4 +0 0 diff --git a/codenet/public_test_cases/p01248/output.0.txt b/codenet/public_test_cases/p01248/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b89b54f39a503a76ed59b6af0d2a2c015f0b9e2 --- /dev/null +++ b/codenet/public_test_cases/p01248/output.0.txt @@ -0,0 +1,2 @@ +Case 1: 4 +Case 2: 1 diff --git a/codenet/public_test_cases/p01248/output.1.txt b/codenet/public_test_cases/p01248/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b89b54f39a503a76ed59b6af0d2a2c015f0b9e2 --- /dev/null +++ b/codenet/public_test_cases/p01248/output.1.txt @@ -0,0 +1,2 @@ +Case 1: 4 +Case 2: 1 diff --git a/codenet/public_test_cases/p01249/input.0.txt b/codenet/public_test_cases/p01249/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59a03206c4dbe7ee298088688eee129d3ab22de7 --- /dev/null +++ b/codenet/public_test_cases/p01249/input.0.txt @@ -0,0 +1,23 @@ +3 +billion 9 +million 6 +thousand 3 +billionmillionthousand +3 +oku 8 +sen 3 +man 4 +okusenman +2 +nico 2 +video 4 +niconicovideo +6 +abcd 1 +efgh 2 +abcde 4 +fgh 6 +y 8 +yy 10 +abcdefgh +0 diff --git a/codenet/public_test_cases/p01249/input.1.txt b/codenet/public_test_cases/p01249/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59a03206c4dbe7ee298088688eee129d3ab22de7 --- /dev/null +++ b/codenet/public_test_cases/p01249/input.1.txt @@ -0,0 +1,23 @@ +3 +billion 9 +million 6 +thousand 3 +billionmillionthousand +3 +oku 8 +sen 3 +man 4 +okusenman +2 +nico 2 +video 4 +niconicovideo +6 +abcd 1 +efgh 2 +abcde 4 +fgh 6 +y 8 +yy 10 +abcdefgh +0 diff --git a/codenet/public_test_cases/p01249/output.0.txt b/codenet/public_test_cases/p01249/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad76a7f7078a38951dbcbc3ac7b588a9bc28b3b5 --- /dev/null +++ b/codenet/public_test_cases/p01249/output.0.txt @@ -0,0 +1,4 @@ +Case 1: 14 +Case 2: 9 +Case 3: 10 +Case 4: 2 diff --git a/codenet/public_test_cases/p01249/output.1.txt b/codenet/public_test_cases/p01249/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad76a7f7078a38951dbcbc3ac7b588a9bc28b3b5 --- /dev/null +++ b/codenet/public_test_cases/p01249/output.1.txt @@ -0,0 +1,4 @@ +Case 1: 14 +Case 2: 9 +Case 3: 10 +Case 4: 2 diff --git a/codenet/public_test_cases/p01250/input.0.txt b/codenet/public_test_cases/p01250/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91f5363abb0a094b0bf0ef2255c664eaf396095b --- /dev/null +++ b/codenet/public_test_cases/p01250/input.0.txt @@ -0,0 +1,3 @@ +0.15 +0.05 +0.0 diff --git a/codenet/public_test_cases/p01250/input.1.txt b/codenet/public_test_cases/p01250/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91f5363abb0a094b0bf0ef2255c664eaf396095b --- /dev/null +++ b/codenet/public_test_cases/p01250/input.1.txt @@ -0,0 +1,3 @@ +0.15 +0.05 +0.0 diff --git a/codenet/public_test_cases/p01250/output.0.txt b/codenet/public_test_cases/p01250/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13f08633e58c88f39c7186fb727fe0f8199de94a --- /dev/null +++ b/codenet/public_test_cases/p01250/output.0.txt @@ -0,0 +1,2 @@ +3/1 +19/6 diff --git a/codenet/public_test_cases/p01250/output.1.txt b/codenet/public_test_cases/p01250/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..13f08633e58c88f39c7186fb727fe0f8199de94a --- /dev/null +++ b/codenet/public_test_cases/p01250/output.1.txt @@ -0,0 +1,2 @@ +3/1 +19/6 diff --git a/codenet/public_test_cases/p01251/input.0.txt b/codenet/public_test_cases/p01251/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce5b8aa00d9f8ea7d66143f5defef18688d20453 --- /dev/null +++ b/codenet/public_test_cases/p01251/input.0.txt @@ -0,0 +1,14 @@ +3 3 3 +1 0 1 2 +1 2 2 2 +2 2 2 1 +0 0 1 0 1 1 +3 3 4 +1 0 1 2 +1 2 2 2 +2 2 2 1 +2 1 1 1 +0 0 1 0 1 1 +3 3 0 +0 0 1 0 1 1 +0 0 0 diff --git a/codenet/public_test_cases/p01251/input.1.txt b/codenet/public_test_cases/p01251/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce5b8aa00d9f8ea7d66143f5defef18688d20453 --- /dev/null +++ b/codenet/public_test_cases/p01251/input.1.txt @@ -0,0 +1,14 @@ +3 3 3 +1 0 1 2 +1 2 2 2 +2 2 2 1 +0 0 1 0 1 1 +3 3 4 +1 0 1 2 +1 2 2 2 +2 2 2 1 +2 1 1 1 +0 0 1 0 1 1 +3 3 0 +0 0 1 0 1 1 +0 0 0 diff --git a/codenet/public_test_cases/p01251/output.0.txt b/codenet/public_test_cases/p01251/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..71c919bf16dc6800352fb2e268ae634c9a33d1af --- /dev/null +++ b/codenet/public_test_cases/p01251/output.0.txt @@ -0,0 +1,3 @@ +9 +Impossible +Impossible diff --git a/codenet/public_test_cases/p01251/output.1.txt b/codenet/public_test_cases/p01251/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..71c919bf16dc6800352fb2e268ae634c9a33d1af --- /dev/null +++ b/codenet/public_test_cases/p01251/output.1.txt @@ -0,0 +1,3 @@ +9 +Impossible +Impossible diff --git a/codenet/public_test_cases/p01252/input.0.txt b/codenet/public_test_cases/p01252/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..079ea6064da97c81389b456d91a96e2fbab4369e --- /dev/null +++ b/codenet/public_test_cases/p01252/input.0.txt @@ -0,0 +1,21 @@ +1 +3 3 7 7 +2 2 8 2 +2 +2 5 5 9 +6 1 9 5 +1 5 10 5 +2 +2 1 3 2 +2 3 3 4 +1 1 4 4 +1 +3 3 7 7 +1 5 9 5 +1 +3 3 7 7 +1 5 8 5 +1 +3 3 7 7 +1 5 10 5 +0 diff --git a/codenet/public_test_cases/p01252/input.1.txt b/codenet/public_test_cases/p01252/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..079ea6064da97c81389b456d91a96e2fbab4369e --- /dev/null +++ b/codenet/public_test_cases/p01252/input.1.txt @@ -0,0 +1,21 @@ +1 +3 3 7 7 +2 2 8 2 +2 +2 5 5 9 +6 1 9 5 +1 5 10 5 +2 +2 1 3 2 +2 3 3 4 +1 1 4 4 +1 +3 3 7 7 +1 5 9 5 +1 +3 3 7 7 +1 5 8 5 +1 +3 3 7 7 +1 5 10 5 +0 diff --git a/codenet/public_test_cases/p01252/output.0.txt b/codenet/public_test_cases/p01252/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d4941ea71cd3464efd1ac727dd5e516f7058c93 --- /dev/null +++ b/codenet/public_test_cases/p01252/output.0.txt @@ -0,0 +1,6 @@ +0.000 +0.000 +0.000 +5.657 +6.406 +4.992 diff --git a/codenet/public_test_cases/p01252/output.1.txt b/codenet/public_test_cases/p01252/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d4941ea71cd3464efd1ac727dd5e516f7058c93 --- /dev/null +++ b/codenet/public_test_cases/p01252/output.1.txt @@ -0,0 +1,6 @@ +0.000 +0.000 +0.000 +5.657 +6.406 +4.992 diff --git a/codenet/public_test_cases/p01253/input.0.txt b/codenet/public_test_cases/p01253/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bec650cbd90f6c4acf2395b866d62998f5b35a2a --- /dev/null +++ b/codenet/public_test_cases/p01253/input.0.txt @@ -0,0 +1,9 @@ +6 1 +RBRBRB +10 1 +RBBBRBBBBB +10 2 +RBBBRBBBBB +10 10 +RBBBBBBBBB +0 0 diff --git a/codenet/public_test_cases/p01253/input.1.txt b/codenet/public_test_cases/p01253/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bec650cbd90f6c4acf2395b866d62998f5b35a2a --- /dev/null +++ b/codenet/public_test_cases/p01253/input.1.txt @@ -0,0 +1,9 @@ +6 1 +RBRBRB +10 1 +RBBBRBBBBB +10 2 +RBBBRBBBBB +10 10 +RBBBBBBBBB +0 0 diff --git a/codenet/public_test_cases/p01253/output.0.txt b/codenet/public_test_cases/p01253/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc4d339e97da6a6d186a5977c652cae444d2a33a --- /dev/null +++ b/codenet/public_test_cases/p01253/output.0.txt @@ -0,0 +1,4 @@ +0.50000000 +0.33333333 +0.22222222 +0.10025221 diff --git a/codenet/public_test_cases/p01253/output.1.txt b/codenet/public_test_cases/p01253/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc4d339e97da6a6d186a5977c652cae444d2a33a --- /dev/null +++ b/codenet/public_test_cases/p01253/output.1.txt @@ -0,0 +1,4 @@ +0.50000000 +0.33333333 +0.22222222 +0.10025221 diff --git a/codenet/public_test_cases/p01254/input.0.txt b/codenet/public_test_cases/p01254/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30b6acdffaf833512616642bde4bf0a330b08c4c --- /dev/null +++ b/codenet/public_test_cases/p01254/input.0.txt @@ -0,0 +1,8 @@ +4 +1 4 +4 +1 2 +2 3 +3 4 +4 1 +0 diff --git a/codenet/public_test_cases/p01254/input.1.txt b/codenet/public_test_cases/p01254/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..30b6acdffaf833512616642bde4bf0a330b08c4c --- /dev/null +++ b/codenet/public_test_cases/p01254/input.1.txt @@ -0,0 +1,8 @@ +4 +1 4 +4 +1 2 +2 3 +3 4 +4 1 +0 diff --git a/codenet/public_test_cases/p01254/output.0.txt b/codenet/public_test_cases/p01254/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c67935b4f7ea6b9e676e8dae3b32b6f5aa810ee --- /dev/null +++ b/codenet/public_test_cases/p01254/output.0.txt @@ -0,0 +1 @@ +1 4 diff --git a/codenet/public_test_cases/p01254/output.1.txt b/codenet/public_test_cases/p01254/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c67935b4f7ea6b9e676e8dae3b32b6f5aa810ee --- /dev/null +++ b/codenet/public_test_cases/p01254/output.1.txt @@ -0,0 +1 @@ +1 4 diff --git a/codenet/public_test_cases/p01255/input.0.txt b/codenet/public_test_cases/p01255/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..42b93c9e8ca099a41d127727a20accd8a4b4ea44 --- /dev/null +++ b/codenet/public_test_cases/p01255/input.0.txt @@ -0,0 +1,25 @@ +2 +2 +0 0 +10 0 +2 +0 10 +10 10 +2 +2 +0 0 +10 10 +2 +0 10 +10 0 +3 +2 +0 0 +10 10 +2 +0 10 +10 0 +2 +1 0 +1 10 +0 diff --git a/codenet/public_test_cases/p01255/input.1.txt b/codenet/public_test_cases/p01255/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..42b93c9e8ca099a41d127727a20accd8a4b4ea44 --- /dev/null +++ b/codenet/public_test_cases/p01255/input.1.txt @@ -0,0 +1,25 @@ +2 +2 +0 0 +10 0 +2 +0 10 +10 10 +2 +2 +0 0 +10 10 +2 +0 10 +10 0 +3 +2 +0 0 +10 10 +2 +0 10 +10 0 +2 +1 0 +1 10 +0 diff --git a/codenet/public_test_cases/p01255/output.0.txt b/codenet/public_test_cases/p01255/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01e79c32a8c99c557f0757da7cb6d65b3414466d --- /dev/null +++ b/codenet/public_test_cases/p01255/output.0.txt @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/codenet/public_test_cases/p01255/output.1.txt b/codenet/public_test_cases/p01255/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01e79c32a8c99c557f0757da7cb6d65b3414466d --- /dev/null +++ b/codenet/public_test_cases/p01255/output.1.txt @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/codenet/public_test_cases/p01256/input.0.txt b/codenet/public_test_cases/p01256/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b37db9f2fda547dee6b6dc14bc3f96ea0a36d90 --- /dev/null +++ b/codenet/public_test_cases/p01256/input.0.txt @@ -0,0 +1,22 @@ +7 6 +####### +#.._..# +#.*.*.# +#.@.*.# +#_..._# +####### +10 13 +########## +####___### +####...### +####...### +#####.#### +#.....#..# +#.#*.*.*.# +#...###..# +###.#.#.## +###.#.#.## +###.....## +###..@..## +########## +0 0 diff --git a/codenet/public_test_cases/p01256/input.1.txt b/codenet/public_test_cases/p01256/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67a855a3488cb6e42ca9a6866e302f0abeb812a9 --- /dev/null +++ b/codenet/public_test_cases/p01256/input.1.txt @@ -0,0 +1,22 @@ +7 6 + +.._..# +.*.*.# +.@.*.# +_..._# + +10 13 + +___### +...### +...### +.#### +.....#..# +.#*.*.*.# +...###..# +.#.#.## +.#.#.## +.....## +..@..## + +0 0 diff --git a/codenet/public_test_cases/p01256/input.2.txt b/codenet/public_test_cases/p01256/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b37db9f2fda547dee6b6dc14bc3f96ea0a36d90 --- /dev/null +++ b/codenet/public_test_cases/p01256/input.2.txt @@ -0,0 +1,22 @@ +7 6 +####### +#.._..# +#.*.*.# +#.@.*.# +#_..._# +####### +10 13 +########## +####___### +####...### +####...### +#####.#### +#.....#..# +#.#*.*.*.# +#...###..# +###.#.#.## +###.#.#.## +###.....## +###..@..## +########## +0 0 diff --git a/codenet/public_test_cases/p01256/output.0.txt b/codenet/public_test_cases/p01256/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a872aee34c1f504c8e1d8307d39806ede4b7d00 --- /dev/null +++ b/codenet/public_test_cases/p01256/output.0.txt @@ -0,0 +1,2 @@ +15 +118 diff --git a/codenet/public_test_cases/p01256/output.1.txt b/codenet/public_test_cases/p01256/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a872aee34c1f504c8e1d8307d39806ede4b7d00 --- /dev/null +++ b/codenet/public_test_cases/p01256/output.1.txt @@ -0,0 +1,2 @@ +15 +118 diff --git a/codenet/public_test_cases/p01256/output.2.txt b/codenet/public_test_cases/p01256/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a872aee34c1f504c8e1d8307d39806ede4b7d00 --- /dev/null +++ b/codenet/public_test_cases/p01256/output.2.txt @@ -0,0 +1,2 @@ +15 +118 diff --git a/codenet/public_test_cases/p01257/input.0.txt b/codenet/public_test_cases/p01257/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..160a55345969a4eba84e54f1898220f4ab49dea1 --- /dev/null +++ b/codenet/public_test_cases/p01257/input.0.txt @@ -0,0 +1,7 @@ +6 330 +1 5 10 50 100 500 +7 127 +1 2 4 8 16 32 64 +2 10000 +1000 2000 +0 0 diff --git a/codenet/public_test_cases/p01257/input.1.txt b/codenet/public_test_cases/p01257/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..160a55345969a4eba84e54f1898220f4ab49dea1 --- /dev/null +++ b/codenet/public_test_cases/p01257/input.1.txt @@ -0,0 +1,7 @@ +6 330 +1 5 10 50 100 500 +7 127 +1 2 4 8 16 32 64 +2 10000 +1000 2000 +0 0 diff --git a/codenet/public_test_cases/p01257/output.0.txt b/codenet/public_test_cases/p01257/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eb1267296b5c72164a6cf76bcde9d16dd5a83c0 --- /dev/null +++ b/codenet/public_test_cases/p01257/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +4 diff --git a/codenet/public_test_cases/p01257/output.1.txt b/codenet/public_test_cases/p01257/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eb1267296b5c72164a6cf76bcde9d16dd5a83c0 --- /dev/null +++ b/codenet/public_test_cases/p01257/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +4 diff --git a/codenet/public_test_cases/p01258/input.0.txt b/codenet/public_test_cases/p01258/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28a3d5d1cdd87c2def9fae5271db7124bcf39159 --- /dev/null +++ b/codenet/public_test_cases/p01258/input.0.txt @@ -0,0 +1,7 @@ +2 +4 +6 +8 +10 +52 +0 diff --git a/codenet/public_test_cases/p01258/input.1.txt b/codenet/public_test_cases/p01258/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28a3d5d1cdd87c2def9fae5271db7124bcf39159 --- /dev/null +++ b/codenet/public_test_cases/p01258/input.1.txt @@ -0,0 +1,7 @@ +2 +4 +6 +8 +10 +52 +0 diff --git a/codenet/public_test_cases/p01258/output.0.txt b/codenet/public_test_cases/p01258/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28371011e3f9c211f96227603098ef181670055d --- /dev/null +++ b/codenet/public_test_cases/p01258/output.0.txt @@ -0,0 +1,6 @@ +0.0000000000 +0.6666666667 +1.3333333333 +1.9238095238 +2.5523809524 +15.4435236099 diff --git a/codenet/public_test_cases/p01258/output.1.txt b/codenet/public_test_cases/p01258/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28371011e3f9c211f96227603098ef181670055d --- /dev/null +++ b/codenet/public_test_cases/p01258/output.1.txt @@ -0,0 +1,6 @@ +0.0000000000 +0.6666666667 +1.3333333333 +1.9238095238 +2.5523809524 +15.4435236099 diff --git a/codenet/public_test_cases/p01259/input.0.txt b/codenet/public_test_cases/p01259/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..612911871ea34bfe63ee617998731b9d0b3db7f2 --- /dev/null +++ b/codenet/public_test_cases/p01259/input.0.txt @@ -0,0 +1,12 @@ +4 +3 1 2 3 +1 1 0 1 +2 0 2 2 +3 1 2 3 +5 +3 3 3 0 0 +3 3 3 0 0 +3 3 0 4 4 +0 0 4 4 4 +0 0 4 4 4 +0 diff --git a/codenet/public_test_cases/p01259/output.0.txt b/codenet/public_test_cases/p01259/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b16233ba9cb6f58321be5b0f8bc46cfa8891f36c --- /dev/null +++ b/codenet/public_test_cases/p01259/output.0.txt @@ -0,0 +1,10 @@ +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 2 + +0 0 0 0 0 +0 3 0 0 0 +0 0 0 0 0 +0 0 0 4 0 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01260/input.0.txt b/codenet/public_test_cases/p01260/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b99c48c32367f3b953204c5749ed0fb171331bf --- /dev/null +++ b/codenet/public_test_cases/p01260/input.0.txt @@ -0,0 +1,7 @@ +6 +1 GB +3 GBGBBB +9 BBBGBBBGGG +9 GGBGBBGBBB +7 GBGGGGBGGG +3 BBBBBGBBBB diff --git a/codenet/public_test_cases/p01260/input.1.txt b/codenet/public_test_cases/p01260/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b99c48c32367f3b953204c5749ed0fb171331bf --- /dev/null +++ b/codenet/public_test_cases/p01260/input.1.txt @@ -0,0 +1,7 @@ +6 +1 GB +3 GBGBBB +9 BBBGBBBGGG +9 GGBGBBGBBB +7 GBGGGGBGGG +3 BBBBBGBBBB diff --git a/codenet/public_test_cases/p01260/output.0.txt b/codenet/public_test_cases/p01260/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce01d285d8881d2655a2cdf2188bcb6c0fe7a473 --- /dev/null +++ b/codenet/public_test_cases/p01260/output.0.txt @@ -0,0 +1,6 @@ +1 +4 +4 +1 +0 +8 diff --git a/codenet/public_test_cases/p01260/output.1.txt b/codenet/public_test_cases/p01260/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce01d285d8881d2655a2cdf2188bcb6c0fe7a473 --- /dev/null +++ b/codenet/public_test_cases/p01260/output.1.txt @@ -0,0 +1,6 @@ +1 +4 +4 +1 +0 +8 diff --git a/codenet/public_test_cases/p01261/input.0.txt b/codenet/public_test_cases/p01261/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1c0645298e3ab64ae917aefadb8dad1751c9ff9 --- /dev/null +++ b/codenet/public_test_cases/p01261/input.0.txt @@ -0,0 +1,3 @@ +3 3 +3 5 +0 0 diff --git a/codenet/public_test_cases/p01261/input.1.txt b/codenet/public_test_cases/p01261/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1c0645298e3ab64ae917aefadb8dad1751c9ff9 --- /dev/null +++ b/codenet/public_test_cases/p01261/input.1.txt @@ -0,0 +1,3 @@ +3 3 +3 5 +0 0 diff --git a/codenet/public_test_cases/p01261/output.0.txt b/codenet/public_test_cases/p01261/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94728aea03443e8615f7510a8f60aef357d7dcdf --- /dev/null +++ b/codenet/public_test_cases/p01261/output.0.txt @@ -0,0 +1,2 @@ +010 +011 diff --git a/codenet/public_test_cases/p01261/output.1.txt b/codenet/public_test_cases/p01261/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94728aea03443e8615f7510a8f60aef357d7dcdf --- /dev/null +++ b/codenet/public_test_cases/p01261/output.1.txt @@ -0,0 +1,2 @@ +010 +011 diff --git a/codenet/public_test_cases/p01262/input.0.txt b/codenet/public_test_cases/p01262/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3b79490a97a5c31e3d11d5d849b67ce4deb80e5 --- /dev/null +++ b/codenet/public_test_cases/p01262/input.0.txt @@ -0,0 +1,5 @@ +5 2 1 +0.1 0.2 0.3 0.4 0.5 +6 2 2 +0.1 0.2 0.3 0.4 0.5 0.6 +0 0 0 diff --git a/codenet/public_test_cases/p01262/input.1.txt b/codenet/public_test_cases/p01262/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3b79490a97a5c31e3d11d5d849b67ce4deb80e5 --- /dev/null +++ b/codenet/public_test_cases/p01262/input.1.txt @@ -0,0 +1,5 @@ +5 2 1 +0.1 0.2 0.3 0.4 0.5 +6 2 2 +0.1 0.2 0.3 0.4 0.5 0.6 +0 0 0 diff --git a/codenet/public_test_cases/p01262/output.0.txt b/codenet/public_test_cases/p01262/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31149b0de9e65e45dc0358662ac3eb470b9d258e --- /dev/null +++ b/codenet/public_test_cases/p01262/output.0.txt @@ -0,0 +1,2 @@ +0.01 +0.00 diff --git a/codenet/public_test_cases/p01262/output.1.txt b/codenet/public_test_cases/p01262/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31149b0de9e65e45dc0358662ac3eb470b9d258e --- /dev/null +++ b/codenet/public_test_cases/p01262/output.1.txt @@ -0,0 +1,2 @@ +0.01 +0.00 diff --git a/codenet/public_test_cases/p01263/input.0.txt b/codenet/public_test_cases/p01263/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc943620a2ab416f92cc768f0e330f6e5309af54 --- /dev/null +++ b/codenet/public_test_cases/p01263/input.0.txt @@ -0,0 +1,25 @@ +2 2 +1 1 +1 1 +4 +A 10 +B 20 +C 30 +D 40 +4 +1 1 3 A A A +1 2 2 B C +2 1 1 D +2 2 3 A A B +2 2 +1 2 +2 1 +3 +Scroll 50 +Bastard 100 +Heal100 10 +3 +1 1 1 Scroll +2 1 1 Bastard +2 2 1 Heal100 +0 0 diff --git a/codenet/public_test_cases/p01263/input.1.txt b/codenet/public_test_cases/p01263/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc943620a2ab416f92cc768f0e330f6e5309af54 --- /dev/null +++ b/codenet/public_test_cases/p01263/input.1.txt @@ -0,0 +1,25 @@ +2 2 +1 1 +1 1 +4 +A 10 +B 20 +C 30 +D 40 +4 +1 1 3 A A A +1 2 2 B C +2 1 1 D +2 2 3 A A B +2 2 +1 2 +2 1 +3 +Scroll 50 +Bastard 100 +Heal100 10 +3 +1 1 1 Scroll +2 1 1 Bastard +2 2 1 Heal100 +0 0 diff --git a/codenet/public_test_cases/p01263/output.0.txt b/codenet/public_test_cases/p01263/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb9b7977151d42b089f5a1518c18623aa17b162d --- /dev/null +++ b/codenet/public_test_cases/p01263/output.0.txt @@ -0,0 +1,2 @@ +90 +200 diff --git a/codenet/public_test_cases/p01263/output.1.txt b/codenet/public_test_cases/p01263/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb9b7977151d42b089f5a1518c18623aa17b162d --- /dev/null +++ b/codenet/public_test_cases/p01263/output.1.txt @@ -0,0 +1,2 @@ +90 +200 diff --git a/codenet/public_test_cases/p01264/input.0.txt b/codenet/public_test_cases/p01264/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8fe69cdd31e1d1ba403255070ee65994f086e3b --- /dev/null +++ b/codenet/public_test_cases/p01264/input.0.txt @@ -0,0 +1,4 @@ +1 1 1 +10 15 5 +15 10 100 +0 0 0 diff --git a/codenet/public_test_cases/p01264/input.1.txt b/codenet/public_test_cases/p01264/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8fe69cdd31e1d1ba403255070ee65994f086e3b --- /dev/null +++ b/codenet/public_test_cases/p01264/input.1.txt @@ -0,0 +1,4 @@ +1 1 1 +10 15 5 +15 10 100 +0 0 0 diff --git a/codenet/public_test_cases/p01264/output.0.txt b/codenet/public_test_cases/p01264/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9725466b96a2131d9942bdc74cf3901c3554836 --- /dev/null +++ b/codenet/public_test_cases/p01264/output.0.txt @@ -0,0 +1,3 @@ +8.000 +409.479 +861.420 diff --git a/codenet/public_test_cases/p01264/output.1.txt b/codenet/public_test_cases/p01264/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9725466b96a2131d9942bdc74cf3901c3554836 --- /dev/null +++ b/codenet/public_test_cases/p01264/output.1.txt @@ -0,0 +1,3 @@ +8.000 +409.479 +861.420 diff --git a/codenet/public_test_cases/p01265/input.0.txt b/codenet/public_test_cases/p01265/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..316b8dd3e6a54d0f0ca2d3f70c9deaf1d3fcc1b3 --- /dev/null +++ b/codenet/public_test_cases/p01265/input.0.txt @@ -0,0 +1,14 @@ +6 23 +####################### +#%.^.^################# +#^^^^^######^^^^^^^^^^# +#^^^...^^^^...^^*^^..*# +#^^^^^^^^^^^^^^^^^^^^^# +####################### +5 16 +################ +#^^^^^^^^^^^^^^# +#*..^^^.%.^^..*# +#^^#####^^^^^^^# +################ +0 0 diff --git a/codenet/public_test_cases/p01265/input.1.txt b/codenet/public_test_cases/p01265/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..316b8dd3e6a54d0f0ca2d3f70c9deaf1d3fcc1b3 --- /dev/null +++ b/codenet/public_test_cases/p01265/input.1.txt @@ -0,0 +1,14 @@ +6 23 +####################### +#%.^.^################# +#^^^^^######^^^^^^^^^^# +#^^^...^^^^...^^*^^..*# +#^^^^^^^^^^^^^^^^^^^^^# +####################### +5 16 +################ +#^^^^^^^^^^^^^^# +#*..^^^.%.^^..*# +#^^#####^^^^^^^# +################ +0 0 diff --git a/codenet/public_test_cases/p01265/output.0.txt b/codenet/public_test_cases/p01265/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..587e79739c5d3c5a6a412f137cdb062b35e813a3 --- /dev/null +++ b/codenet/public_test_cases/p01265/output.0.txt @@ -0,0 +1,2 @@ +1 44 +2 28 diff --git a/codenet/public_test_cases/p01265/output.1.txt b/codenet/public_test_cases/p01265/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..587e79739c5d3c5a6a412f137cdb062b35e813a3 --- /dev/null +++ b/codenet/public_test_cases/p01265/output.1.txt @@ -0,0 +1,2 @@ +1 44 +2 28 diff --git a/codenet/public_test_cases/p01266/input.0.txt b/codenet/public_test_cases/p01266/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..acd0dcedb61c6c706891c0dccac1744f598dc8ee --- /dev/null +++ b/codenet/public_test_cases/p01266/input.0.txt @@ -0,0 +1,11 @@ +4 2 +2 0 0 1 +0 4 1 0 +4 6 0 -1 +6 2 -1 0 +4 6 +2 0 0 1 +0 4 1 0 +4 6 0 -1 +6 2 -1 0 +0 0 diff --git a/codenet/public_test_cases/p01266/input.1.txt b/codenet/public_test_cases/p01266/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..acd0dcedb61c6c706891c0dccac1744f598dc8ee --- /dev/null +++ b/codenet/public_test_cases/p01266/input.1.txt @@ -0,0 +1,11 @@ +4 2 +2 0 0 1 +0 4 1 0 +4 6 0 -1 +6 2 -1 0 +4 6 +2 0 0 1 +0 4 1 0 +4 6 0 -1 +6 2 -1 0 +0 0 diff --git a/codenet/public_test_cases/p01266/output.0.txt b/codenet/public_test_cases/p01266/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5e34826108b49ed4e533c32a8dbe15651694530 --- /dev/null +++ b/codenet/public_test_cases/p01266/output.0.txt @@ -0,0 +1,2 @@ +6.00000000 +4.24264069 diff --git a/codenet/public_test_cases/p01266/output.1.txt b/codenet/public_test_cases/p01266/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5e34826108b49ed4e533c32a8dbe15651694530 --- /dev/null +++ b/codenet/public_test_cases/p01266/output.1.txt @@ -0,0 +1,2 @@ +6.00000000 +4.24264069 diff --git a/codenet/public_test_cases/p01267/input.0.txt b/codenet/public_test_cases/p01267/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed20c8343851bcb49aab86d9a204443f2910ca56 --- /dev/null +++ b/codenet/public_test_cases/p01267/input.0.txt @@ -0,0 +1,17 @@ +1 5 7 11 10 +10 +2 5 7 11 10 +2 4 +2 1 1 256 0 +128 255 +2 0 0 1 0 +1234 5678 +2 1 1 100 0 +99 98 +2 1 1 100 0 +99 99 +2 1 1 10000 0 +1 0 +2 1 1 10000 0 +2 1 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01267/input.1.txt b/codenet/public_test_cases/p01267/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed20c8343851bcb49aab86d9a204443f2910ca56 --- /dev/null +++ b/codenet/public_test_cases/p01267/input.1.txt @@ -0,0 +1,17 @@ +1 5 7 11 10 +10 +2 5 7 11 10 +2 4 +2 1 1 256 0 +128 255 +2 0 0 1 0 +1234 5678 +2 1 1 100 0 +99 98 +2 1 1 100 0 +99 99 +2 1 1 10000 0 +1 0 +2 1 1 10000 0 +2 1 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01267/output.0.txt b/codenet/public_test_cases/p01267/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fe41f0a253adf98059a8a3b312657388ed01353 --- /dev/null +++ b/codenet/public_test_cases/p01267/output.0.txt @@ -0,0 +1,8 @@ +0 +3 +255 +-1 +198 +199 +10000 +-1 diff --git a/codenet/public_test_cases/p01267/output.1.txt b/codenet/public_test_cases/p01267/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fe41f0a253adf98059a8a3b312657388ed01353 --- /dev/null +++ b/codenet/public_test_cases/p01267/output.1.txt @@ -0,0 +1,8 @@ +0 +3 +255 +-1 +198 +199 +10000 +-1 diff --git a/codenet/public_test_cases/p01268/input.0.txt b/codenet/public_test_cases/p01268/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..315f64beee7f4384b107964fb874213efe87dbee --- /dev/null +++ b/codenet/public_test_cases/p01268/input.0.txt @@ -0,0 +1,15 @@ +0 55 +0 1 +0 2 +0 3 +10 1 +10 2 +10 3 +10 4 +10 5 +10 6 +11 1 +11 2 +11 3 +100000 100 +-1 -1 diff --git a/codenet/public_test_cases/p01268/input.1.txt b/codenet/public_test_cases/p01268/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..315f64beee7f4384b107964fb874213efe87dbee --- /dev/null +++ b/codenet/public_test_cases/p01268/input.1.txt @@ -0,0 +1,15 @@ +0 55 +0 1 +0 2 +0 3 +10 1 +10 2 +10 3 +10 4 +10 5 +10 6 +11 1 +11 2 +11 3 +100000 100 +-1 -1 diff --git a/codenet/public_test_cases/p01268/output.0.txt b/codenet/public_test_cases/p01268/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8879f5f8f17b70d85f5db411fd68d1a20ac82b75 --- /dev/null +++ b/codenet/public_test_cases/p01268/output.0.txt @@ -0,0 +1,14 @@ +42 +4 +5 +6 +22 +24 +26 +28 +30 +30 +26 +30 +32 +200274 diff --git a/codenet/public_test_cases/p01268/output.1.txt b/codenet/public_test_cases/p01268/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8879f5f8f17b70d85f5db411fd68d1a20ac82b75 --- /dev/null +++ b/codenet/public_test_cases/p01268/output.1.txt @@ -0,0 +1,14 @@ +42 +4 +5 +6 +22 +24 +26 +28 +30 +30 +26 +30 +32 +200274 diff --git a/codenet/public_test_cases/p01269/input.0.txt b/codenet/public_test_cases/p01269/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cce04496c79b432b91ef7a09178929234e247079 --- /dev/null +++ b/codenet/public_test_cases/p01269/input.0.txt @@ -0,0 +1,16 @@ +3 2 10 +1 2 8 6 +2 3 10 3 +3 2 10 +1 2 3 8 +2 3 7 7 +3 3 10 +1 3 17 6 +1 2 2 4 +2 3 9 13 +4 4 5 +1 3 9 3 +1 4 7 25 +2 3 8 2 +2 4 9 3 +0 0 0 diff --git a/codenet/public_test_cases/p01269/input.1.txt b/codenet/public_test_cases/p01269/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cce04496c79b432b91ef7a09178929234e247079 --- /dev/null +++ b/codenet/public_test_cases/p01269/input.1.txt @@ -0,0 +1,16 @@ +3 2 10 +1 2 8 6 +2 3 10 3 +3 2 10 +1 2 3 8 +2 3 7 7 +3 3 10 +1 3 17 6 +1 2 2 4 +2 3 9 13 +4 4 5 +1 3 9 3 +1 4 7 25 +2 3 8 2 +2 4 9 3 +0 0 0 diff --git a/codenet/public_test_cases/p01269/output.0.txt b/codenet/public_test_cases/p01269/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..406fe50e349c3a712a43e7dfba7e5dcb85a7e951 --- /dev/null +++ b/codenet/public_test_cases/p01269/output.0.txt @@ -0,0 +1,4 @@ +3 +0 +4 +8 diff --git a/codenet/public_test_cases/p01269/output.1.txt b/codenet/public_test_cases/p01269/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..406fe50e349c3a712a43e7dfba7e5dcb85a7e951 --- /dev/null +++ b/codenet/public_test_cases/p01269/output.1.txt @@ -0,0 +1,4 @@ +3 +0 +4 +8 diff --git a/codenet/public_test_cases/p01270/input.0.txt b/codenet/public_test_cases/p01270/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14d9efdcbc9ab4835f5dee00db4d5adda691b6c5 --- /dev/null +++ b/codenet/public_test_cases/p01270/input.0.txt @@ -0,0 +1,10 @@ +6 +W 0 2 +W 1 2 +D 0 +W 2 4 +R 3 +R 1 +1 +R 1000000000 +0 diff --git a/codenet/public_test_cases/p01270/input.1.txt b/codenet/public_test_cases/p01270/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14d9efdcbc9ab4835f5dee00db4d5adda691b6c5 --- /dev/null +++ b/codenet/public_test_cases/p01270/input.1.txt @@ -0,0 +1,10 @@ +6 +W 0 2 +W 1 2 +D 0 +W 2 4 +R 3 +R 1 +1 +R 1000000000 +0 diff --git a/codenet/public_test_cases/p01270/output.0.txt b/codenet/public_test_cases/p01270/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a84aba42bb27a95d4451ae4ce928659902a02ef5 --- /dev/null +++ b/codenet/public_test_cases/p01270/output.0.txt @@ -0,0 +1,4 @@ +1 +2 + +-1 diff --git a/codenet/public_test_cases/p01270/output.1.txt b/codenet/public_test_cases/p01270/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a84aba42bb27a95d4451ae4ce928659902a02ef5 --- /dev/null +++ b/codenet/public_test_cases/p01270/output.1.txt @@ -0,0 +1,4 @@ +1 +2 + +-1 diff --git a/codenet/public_test_cases/p01271/input.0.txt b/codenet/public_test_cases/p01271/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90925bc8942a0202f719e69ccb3a4b0dc7e14a91 --- /dev/null +++ b/codenet/public_test_cases/p01271/input.0.txt @@ -0,0 +1,12 @@ +5 5 +%#... ...#% +.#.#. .#.#. +.#.#. .#.#. +.#.#. .#.#. +...#L R#... +3 2 +.L. .R# +%.. .%. +4 1 +L.%. %..R +0 0 diff --git a/codenet/public_test_cases/p01271/input.1.txt b/codenet/public_test_cases/p01271/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..90925bc8942a0202f719e69ccb3a4b0dc7e14a91 --- /dev/null +++ b/codenet/public_test_cases/p01271/input.1.txt @@ -0,0 +1,12 @@ +5 5 +%#... ...#% +.#.#. .#.#. +.#.#. .#.#. +.#.#. .#.#. +...#L R#... +3 2 +.L. .R# +%.. .%. +4 1 +L.%. %..R +0 0 diff --git a/codenet/public_test_cases/p01271/output.0.txt b/codenet/public_test_cases/p01271/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e42eaccba8fbb670afcbc090ead039c26258d21 --- /dev/null +++ b/codenet/public_test_cases/p01271/output.0.txt @@ -0,0 +1,3 @@ +Yes +Yes +No diff --git a/codenet/public_test_cases/p01271/output.1.txt b/codenet/public_test_cases/p01271/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e42eaccba8fbb670afcbc090ead039c26258d21 --- /dev/null +++ b/codenet/public_test_cases/p01271/output.1.txt @@ -0,0 +1,3 @@ +Yes +Yes +No diff --git a/codenet/public_test_cases/p01272/input.0.txt b/codenet/public_test_cases/p01272/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81721d00817155a0d7a7acb31858e5e34cb7d399 --- /dev/null +++ b/codenet/public_test_cases/p01272/input.0.txt @@ -0,0 +1,14 @@ +3 1 +0 0 +10 0 +5 10 +3 1 +0 0 +10 0 +0 10 +4 1 +0 0 +10 0 +10 10 +0 10 +0 0 diff --git a/codenet/public_test_cases/p01272/input.1.txt b/codenet/public_test_cases/p01272/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81721d00817155a0d7a7acb31858e5e34cb7d399 --- /dev/null +++ b/codenet/public_test_cases/p01272/input.1.txt @@ -0,0 +1,14 @@ +3 1 +0 0 +10 0 +5 10 +3 1 +0 0 +10 0 +0 10 +4 1 +0 0 +10 0 +10 10 +0 10 +0 0 diff --git a/codenet/public_test_cases/p01272/output.0.txt b/codenet/public_test_cases/p01272/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3090b6b04cb1fe9f2443e7c00a12a1e370b5c14 --- /dev/null +++ b/codenet/public_test_cases/p01272/output.0.txt @@ -0,0 +1,3 @@ +22.6524758425 +23.8994949366 +32.0000000000 diff --git a/codenet/public_test_cases/p01272/output.1.txt b/codenet/public_test_cases/p01272/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3090b6b04cb1fe9f2443e7c00a12a1e370b5c14 --- /dev/null +++ b/codenet/public_test_cases/p01272/output.1.txt @@ -0,0 +1,3 @@ +22.6524758425 +23.8994949366 +32.0000000000 diff --git a/codenet/public_test_cases/p01273/input.0.txt b/codenet/public_test_cases/p01273/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d92686ff021b2f61a2a4bdc480c4d824d1bb540 --- /dev/null +++ b/codenet/public_test_cases/p01273/input.0.txt @@ -0,0 +1,7 @@ +3 2 +1 1 2 +2 2 3 +3 2 +2 3 2 +1 2 1 +0 0 diff --git a/codenet/public_test_cases/p01273/input.1.txt b/codenet/public_test_cases/p01273/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d92686ff021b2f61a2a4bdc480c4d824d1bb540 --- /dev/null +++ b/codenet/public_test_cases/p01273/input.1.txt @@ -0,0 +1,7 @@ +3 2 +1 1 2 +2 2 3 +3 2 +2 3 2 +1 2 1 +0 0 diff --git a/codenet/public_test_cases/p01273/output.0.txt b/codenet/public_test_cases/p01273/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p01273/output.0.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p01273/output.1.txt b/codenet/public_test_cases/p01273/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p01273/output.1.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p01274/input.0.txt b/codenet/public_test_cases/p01274/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d53d11d593626f3818dfac1fb58bc7c2f542c13b --- /dev/null +++ b/codenet/public_test_cases/p01274/input.0.txt @@ -0,0 +1,7 @@ +3 +8000 15000 30000 +3 +Flare 45 Single 8000 +Meteor 62 All 6000 +Ultimate 80 All 9999 +0 diff --git a/codenet/public_test_cases/p01274/input.1.txt b/codenet/public_test_cases/p01274/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d53d11d593626f3818dfac1fb58bc7c2f542c13b --- /dev/null +++ b/codenet/public_test_cases/p01274/input.1.txt @@ -0,0 +1,7 @@ +3 +8000 15000 30000 +3 +Flare 45 Single 8000 +Meteor 62 All 6000 +Ultimate 80 All 9999 +0 diff --git a/codenet/public_test_cases/p01274/output.0.txt b/codenet/public_test_cases/p01274/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c022aedd2727a0a82f74d783431c9cd293a295f --- /dev/null +++ b/codenet/public_test_cases/p01274/output.0.txt @@ -0,0 +1 @@ +232 diff --git a/codenet/public_test_cases/p01274/output.1.txt b/codenet/public_test_cases/p01274/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c022aedd2727a0a82f74d783431c9cd293a295f --- /dev/null +++ b/codenet/public_test_cases/p01274/output.1.txt @@ -0,0 +1 @@ +232 diff --git a/codenet/public_test_cases/p01275/input.0.txt b/codenet/public_test_cases/p01275/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3014306d26a94580af33e91fd1b62debbd12d9bc --- /dev/null +++ b/codenet/public_test_cases/p01275/input.0.txt @@ -0,0 +1,5 @@ +4 +1357 4680 +6 +777777 003330 +0 diff --git a/codenet/public_test_cases/p01275/input.1.txt b/codenet/public_test_cases/p01275/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3014306d26a94580af33e91fd1b62debbd12d9bc --- /dev/null +++ b/codenet/public_test_cases/p01275/input.1.txt @@ -0,0 +1,5 @@ +4 +1357 4680 +6 +777777 003330 +0 diff --git a/codenet/public_test_cases/p01275/output.0.txt b/codenet/public_test_cases/p01275/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p01275/output.0.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p01275/output.1.txt b/codenet/public_test_cases/p01275/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p01275/output.1.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p01276/input.0.txt b/codenet/public_test_cases/p01276/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7723e0e02038f61e2570d13986b05e606727299 --- /dev/null +++ b/codenet/public_test_cases/p01276/input.0.txt @@ -0,0 +1,22 @@ +5 +5 5 +4 4 +3 3 +2 2 +1 1 +5 +1 5 +3 4 +2 5 +2 3 +1 4 +8 +8 3 +4 2 +6 4 +3 5 +5 8 +7 1 +2 6 +1 7 +0 diff --git a/codenet/public_test_cases/p01276/input.1.txt b/codenet/public_test_cases/p01276/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7723e0e02038f61e2570d13986b05e606727299 --- /dev/null +++ b/codenet/public_test_cases/p01276/input.1.txt @@ -0,0 +1,22 @@ +5 +5 5 +4 4 +3 3 +2 2 +1 1 +5 +1 5 +3 4 +2 5 +2 3 +1 4 +8 +8 3 +4 2 +6 4 +3 5 +5 8 +7 1 +2 6 +1 7 +0 diff --git a/codenet/public_test_cases/p01276/output.0.txt b/codenet/public_test_cases/p01276/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ffd0808ee2e8c7952ef8a57f1c7f44797f65f1c --- /dev/null +++ b/codenet/public_test_cases/p01276/output.0.txt @@ -0,0 +1,3 @@ +15 +9 +21 diff --git a/codenet/public_test_cases/p01276/output.1.txt b/codenet/public_test_cases/p01276/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ffd0808ee2e8c7952ef8a57f1c7f44797f65f1c --- /dev/null +++ b/codenet/public_test_cases/p01276/output.1.txt @@ -0,0 +1,3 @@ +15 +9 +21 diff --git a/codenet/public_test_cases/p01277/input.0.txt b/codenet/public_test_cases/p01277/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19de14ac707a86dfb49ff10854773593c9f2ed58 --- /dev/null +++ b/codenet/public_test_cases/p01277/input.0.txt @@ -0,0 +1,5 @@ +4 +0 1 +1 0 +0 0 +1 1 diff --git a/codenet/public_test_cases/p01277/input.1.txt b/codenet/public_test_cases/p01277/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..edd3f854ea2531f6c2fe4a0b762ca78f823204d6 --- /dev/null +++ b/codenet/public_test_cases/p01277/input.1.txt @@ -0,0 +1,5 @@ +4 +0 2 +0 0 +-1 0 +1 0 diff --git a/codenet/public_test_cases/p01277/input.2.txt b/codenet/public_test_cases/p01277/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..19de14ac707a86dfb49ff10854773593c9f2ed58 --- /dev/null +++ b/codenet/public_test_cases/p01277/input.2.txt @@ -0,0 +1,5 @@ +4 +0 1 +1 0 +0 0 +1 1 diff --git a/codenet/public_test_cases/p01277/input.3.txt b/codenet/public_test_cases/p01277/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a77af2b56ba06ad203fe025ac40357701e7f7986 --- /dev/null +++ b/codenet/public_test_cases/p01277/input.3.txt @@ -0,0 +1,10 @@ +9 +-1 1 +0 1 +1 1 +-1 0 +0 0 +1 0 +-1 -1 +0 -1 +1 -1 diff --git a/codenet/public_test_cases/p01277/input.4.txt b/codenet/public_test_cases/p01277/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..48d67a86fb9b86ad08c5ae9bb68cd837cd744e0b --- /dev/null +++ b/codenet/public_test_cases/p01277/input.4.txt @@ -0,0 +1,5 @@ +4 +0 1 +1 -1 +0 0 +1 1 diff --git a/codenet/public_test_cases/p01277/input.5.txt b/codenet/public_test_cases/p01277/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..98cc916af670b2023ba2260e0bb75ff74e714a51 --- /dev/null +++ b/codenet/public_test_cases/p01277/input.5.txt @@ -0,0 +1,4 @@ +3 +-1 -1 +0 0 +1 1 diff --git a/codenet/public_test_cases/p01277/output.0.txt b/codenet/public_test_cases/p01277/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01277/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01277/output.1.txt b/codenet/public_test_cases/p01277/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01277/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01277/output.2.txt b/codenet/public_test_cases/p01277/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01277/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01277/output.3.txt b/codenet/public_test_cases/p01277/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01277/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01277/output.4.txt b/codenet/public_test_cases/p01277/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01277/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01277/output.5.txt b/codenet/public_test_cases/p01277/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01277/output.5.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01278/input.0.txt b/codenet/public_test_cases/p01278/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc6ae18d04b324501b6d4d668f0e1d2cd92bb9a2 --- /dev/null +++ b/codenet/public_test_cases/p01278/input.0.txt @@ -0,0 +1,8 @@ +3 3 +0 0 +8 0 +0 8 +2 2 +4 2 +2 4 +0 0 diff --git a/codenet/public_test_cases/p01278/input.1.txt b/codenet/public_test_cases/p01278/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc6ae18d04b324501b6d4d668f0e1d2cd92bb9a2 --- /dev/null +++ b/codenet/public_test_cases/p01278/input.1.txt @@ -0,0 +1,8 @@ +3 3 +0 0 +8 0 +0 8 +2 2 +4 2 +2 4 +0 0 diff --git a/codenet/public_test_cases/p01278/output.0.txt b/codenet/public_test_cases/p01278/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19096fb8ae4dfa6027cb18a8ac444acb8507a5a3 --- /dev/null +++ b/codenet/public_test_cases/p01278/output.0.txt @@ -0,0 +1,3 @@ +9.0 +11.5 +11.5 diff --git a/codenet/public_test_cases/p01278/output.1.txt b/codenet/public_test_cases/p01278/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19096fb8ae4dfa6027cb18a8ac444acb8507a5a3 --- /dev/null +++ b/codenet/public_test_cases/p01278/output.1.txt @@ -0,0 +1,3 @@ +9.0 +11.5 +11.5 diff --git a/codenet/public_test_cases/p01279/input.0.txt b/codenet/public_test_cases/p01279/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..97f339b016908b66c5db128aa4d8914d84059453 --- /dev/null +++ b/codenet/public_test_cases/p01279/input.0.txt @@ -0,0 +1,6 @@ +2 2 +10 20 1 +0 10 1 +0 10 +10 0 +0 0 diff --git a/codenet/public_test_cases/p01279/input.1.txt b/codenet/public_test_cases/p01279/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97f339b016908b66c5db128aa4d8914d84059453 --- /dev/null +++ b/codenet/public_test_cases/p01279/input.1.txt @@ -0,0 +1,6 @@ +2 2 +10 20 1 +0 10 1 +0 10 +10 0 +0 0 diff --git a/codenet/public_test_cases/p01279/output.0.txt b/codenet/public_test_cases/p01279/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2268880eccf0013311e2456fc52d9d20e828c08 --- /dev/null +++ b/codenet/public_test_cases/p01279/output.0.txt @@ -0,0 +1 @@ +14.14213562 diff --git a/codenet/public_test_cases/p01279/output.1.txt b/codenet/public_test_cases/p01279/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2268880eccf0013311e2456fc52d9d20e828c08 --- /dev/null +++ b/codenet/public_test_cases/p01279/output.1.txt @@ -0,0 +1 @@ +14.14213562 diff --git a/codenet/public_test_cases/p01280/input.0.txt b/codenet/public_test_cases/p01280/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45efd81736b5af6d9e92e7efb26a6de0b246500e --- /dev/null +++ b/codenet/public_test_cases/p01280/input.0.txt @@ -0,0 +1,4 @@ +2 +4 0 1 2 3 4 +2 0 2 1 +0 diff --git a/codenet/public_test_cases/p01280/input.1.txt b/codenet/public_test_cases/p01280/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45efd81736b5af6d9e92e7efb26a6de0b246500e --- /dev/null +++ b/codenet/public_test_cases/p01280/input.1.txt @@ -0,0 +1,4 @@ +2 +4 0 1 2 3 4 +2 0 2 1 +0 diff --git a/codenet/public_test_cases/p01280/output.0.txt b/codenet/public_test_cases/p01280/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01280/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01280/output.1.txt b/codenet/public_test_cases/p01280/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01280/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01281/input.0.txt b/codenet/public_test_cases/p01281/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d267fce9b9cf6f5f469e99c553828623f9f8c1dd --- /dev/null +++ b/codenet/public_test_cases/p01281/input.0.txt @@ -0,0 +1,3 @@ +3 4 +4 4 +0 0 diff --git a/codenet/public_test_cases/p01281/input.1.txt b/codenet/public_test_cases/p01281/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d267fce9b9cf6f5f469e99c553828623f9f8c1dd --- /dev/null +++ b/codenet/public_test_cases/p01281/input.1.txt @@ -0,0 +1,3 @@ +3 4 +4 4 +0 0 diff --git a/codenet/public_test_cases/p01281/output.0.txt b/codenet/public_test_cases/p01281/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc7fa75e6a7bc42f0431e7fa75b59e3ddc4dc40f --- /dev/null +++ b/codenet/public_test_cases/p01281/output.0.txt @@ -0,0 +1,2 @@ +4 +2 diff --git a/codenet/public_test_cases/p01281/output.1.txt b/codenet/public_test_cases/p01281/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc7fa75e6a7bc42f0431e7fa75b59e3ddc4dc40f --- /dev/null +++ b/codenet/public_test_cases/p01281/output.1.txt @@ -0,0 +1,2 @@ +4 +2 diff --git a/codenet/public_test_cases/p01282/input.0.txt b/codenet/public_test_cases/p01282/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ec4bafb91609bc435f600fa7415ea7ca5e959de --- /dev/null +++ b/codenet/public_test_cases/p01282/input.0.txt @@ -0,0 +1,7 @@ +3 1 +3 2 +3 3 +4 2 +10 5 +1000 500 +0 0 diff --git a/codenet/public_test_cases/p01282/input.1.txt b/codenet/public_test_cases/p01282/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ec4bafb91609bc435f600fa7415ea7ca5e959de --- /dev/null +++ b/codenet/public_test_cases/p01282/input.1.txt @@ -0,0 +1,7 @@ +3 1 +3 2 +3 3 +4 2 +10 5 +1000 500 +0 0 diff --git a/codenet/public_test_cases/p01282/output.0.txt b/codenet/public_test_cases/p01282/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..667e6c56863f6554e2e78c7d9794b6ffb8a476dd --- /dev/null +++ b/codenet/public_test_cases/p01282/output.0.txt @@ -0,0 +1,6 @@ +0 +2 +4 +2 +90 +570682 diff --git a/codenet/public_test_cases/p01282/output.1.txt b/codenet/public_test_cases/p01282/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..667e6c56863f6554e2e78c7d9794b6ffb8a476dd --- /dev/null +++ b/codenet/public_test_cases/p01282/output.1.txt @@ -0,0 +1,6 @@ +0 +2 +4 +2 +90 +570682 diff --git a/codenet/public_test_cases/p01283/input.0.txt b/codenet/public_test_cases/p01283/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e770c183308f477c6dbced84bd9177f69005d40b --- /dev/null +++ b/codenet/public_test_cases/p01283/input.0.txt @@ -0,0 +1,7 @@ +5 +5 4 3 2 1 +5 +7 7 7 7 7 +10 +186 8 42 24 154 40 10 56 122 72 +0 diff --git a/codenet/public_test_cases/p01283/input.1.txt b/codenet/public_test_cases/p01283/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e770c183308f477c6dbced84bd9177f69005d40b --- /dev/null +++ b/codenet/public_test_cases/p01283/input.1.txt @@ -0,0 +1,7 @@ +5 +5 4 3 2 1 +5 +7 7 7 7 7 +10 +186 8 42 24 154 40 10 56 122 72 +0 diff --git a/codenet/public_test_cases/p01283/output.0.txt b/codenet/public_test_cases/p01283/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdd9e694d2b484c17fe65335277cffe74888329d --- /dev/null +++ b/codenet/public_test_cases/p01283/output.0.txt @@ -0,0 +1,3 @@ +0 1 1 +0 0 0 +8 7 14 diff --git a/codenet/public_test_cases/p01283/output.1.txt b/codenet/public_test_cases/p01283/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdd9e694d2b484c17fe65335277cffe74888329d --- /dev/null +++ b/codenet/public_test_cases/p01283/output.1.txt @@ -0,0 +1,3 @@ +0 1 1 +0 0 0 +8 7 14 diff --git a/codenet/public_test_cases/p01284/input.0.txt b/codenet/public_test_cases/p01284/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..15b3c782d8e2a658fc273008dc002bd94d576208 --- /dev/null +++ b/codenet/public_test_cases/p01284/input.0.txt @@ -0,0 +1,7 @@ +2 +1 23 +3 +1 1 +2 1 +3 1 +0 diff --git a/codenet/public_test_cases/p01284/input.1.txt b/codenet/public_test_cases/p01284/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..15b3c782d8e2a658fc273008dc002bd94d576208 --- /dev/null +++ b/codenet/public_test_cases/p01284/input.1.txt @@ -0,0 +1,7 @@ +2 +1 23 +3 +1 1 +2 1 +3 1 +0 diff --git a/codenet/public_test_cases/p01284/output.0.txt b/codenet/public_test_cases/p01284/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01284/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01284/output.1.txt b/codenet/public_test_cases/p01284/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01284/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01285/input.0.txt b/codenet/public_test_cases/p01285/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5cdaf2daa64f81277f49fae725eb2daa263741e --- /dev/null +++ b/codenet/public_test_cases/p01285/input.0.txt @@ -0,0 +1,14 @@ +2 +-35 -35 100 100 +-49 49 2000 -2000 +4 +0 0 0 3 +0 0 3 0 +0 3 3 3 +3 0 3 3 +4 +0 3 -4 6 +3 0 6 -4 +2 3 6 6 +-1 2 -4 6 +0 diff --git a/codenet/public_test_cases/p01285/input.1.txt b/codenet/public_test_cases/p01285/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5cdaf2daa64f81277f49fae725eb2daa263741e --- /dev/null +++ b/codenet/public_test_cases/p01285/input.1.txt @@ -0,0 +1,14 @@ +2 +-35 -35 100 100 +-49 49 2000 -2000 +4 +0 0 0 3 +0 0 3 0 +0 3 3 3 +3 0 3 3 +4 +0 3 -4 6 +3 0 6 -4 +2 3 6 6 +-1 2 -4 6 +0 diff --git a/codenet/public_test_cases/p01285/output.0.txt b/codenet/public_test_cases/p01285/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f1475c8adcf2da1c9f0def485d0ffe8d03a297 --- /dev/null +++ b/codenet/public_test_cases/p01285/output.0.txt @@ -0,0 +1,3 @@ +Many +1.5000 1.5000 +1.000 1.000 diff --git a/codenet/public_test_cases/p01285/output.1.txt b/codenet/public_test_cases/p01285/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f1475c8adcf2da1c9f0def485d0ffe8d03a297 --- /dev/null +++ b/codenet/public_test_cases/p01285/output.1.txt @@ -0,0 +1,3 @@ +Many +1.5000 1.5000 +1.000 1.000 diff --git a/codenet/public_test_cases/p01286/input.0.txt b/codenet/public_test_cases/p01286/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82ba959c0d5ae1b1c834fcb855b4522a742f4d44 --- /dev/null +++ b/codenet/public_test_cases/p01286/input.0.txt @@ -0,0 +1,17 @@ +2 1 1 1 1 1 1 +1 1 +1 1 +1 1 +1 1 1 1 0 0 0 +1 1 +1 1 +1 1 +1 0 1 0 1 0 1 +0 +1 1 0 1 0 1 0 +0 +0 +1 1 0 1 0 1 0 +1 1 +0 +-1 -1 -1 -1 -1 -1 -1 diff --git a/codenet/public_test_cases/p01286/output.0.txt b/codenet/public_test_cases/p01286/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d7f4fae2649db723974e64058aa456109f8584a --- /dev/null +++ b/codenet/public_test_cases/p01286/output.0.txt @@ -0,0 +1,5 @@ +2 +1 +1 +0 +1 diff --git a/codenet/public_test_cases/p01287/input.0.txt b/codenet/public_test_cases/p01287/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a52521ab8fb73cd840139567b045133162e3a961 --- /dev/null +++ b/codenet/public_test_cases/p01287/input.0.txt @@ -0,0 +1,3 @@ +blue blue blue blue blue blue blue blue +red blue blue blue blue blue blue blue +red red blue blue blue blue blue blue diff --git a/codenet/public_test_cases/p01287/input.1.txt b/codenet/public_test_cases/p01287/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a52521ab8fb73cd840139567b045133162e3a961 --- /dev/null +++ b/codenet/public_test_cases/p01287/input.1.txt @@ -0,0 +1,3 @@ +blue blue blue blue blue blue blue blue +red blue blue blue blue blue blue blue +red red blue blue blue blue blue blue diff --git a/codenet/public_test_cases/p01287/output.0.txt b/codenet/public_test_cases/p01287/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a3a1ad4e15825ece4f696edeb27c252126408b2 --- /dev/null +++ b/codenet/public_test_cases/p01287/output.0.txt @@ -0,0 +1,3 @@ +1 +1 +3 diff --git a/codenet/public_test_cases/p01287/output.1.txt b/codenet/public_test_cases/p01287/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a3a1ad4e15825ece4f696edeb27c252126408b2 --- /dev/null +++ b/codenet/public_test_cases/p01287/output.1.txt @@ -0,0 +1,3 @@ +1 +1 +3 diff --git a/codenet/public_test_cases/p01288/input.0.txt b/codenet/public_test_cases/p01288/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc2500975b943654da5c2d031d9db3638654910f --- /dev/null +++ b/codenet/public_test_cases/p01288/input.0.txt @@ -0,0 +1,10 @@ +6 3 +1 +1 +2 +3 +3 +Q 5 +M 3 +Q 5 +0 0 diff --git a/codenet/public_test_cases/p01288/input.1.txt b/codenet/public_test_cases/p01288/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc2500975b943654da5c2d031d9db3638654910f --- /dev/null +++ b/codenet/public_test_cases/p01288/input.1.txt @@ -0,0 +1,10 @@ +6 3 +1 +1 +2 +3 +3 +Q 5 +M 3 +Q 5 +0 0 diff --git a/codenet/public_test_cases/p01288/output.0.txt b/codenet/public_test_cases/p01288/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01288/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01288/output.1.txt b/codenet/public_test_cases/p01288/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01288/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01289/input.0.txt b/codenet/public_test_cases/p01289/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08d038357ae1087e664869a1eba231be1bfbbf63 --- /dev/null +++ b/codenet/public_test_cases/p01289/input.0.txt @@ -0,0 +1,8 @@ +5 1 5 +1 0 1 0 0 +0 2 1 0 0 +2 0 0 1 0 +1 0 0 1 0 +0 1 1 0 1 +0 0 0 1 0 +0 0 0 diff --git a/codenet/public_test_cases/p01289/input.1.txt b/codenet/public_test_cases/p01289/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08d038357ae1087e664869a1eba231be1bfbbf63 --- /dev/null +++ b/codenet/public_test_cases/p01289/input.1.txt @@ -0,0 +1,8 @@ +5 1 5 +1 0 1 0 0 +0 2 1 0 0 +2 0 0 1 0 +1 0 0 1 0 +0 1 1 0 1 +0 0 0 1 0 +0 0 0 diff --git a/codenet/public_test_cases/p01289/output.0.txt b/codenet/public_test_cases/p01289/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c4898a5ecfd8ac493da68eaef3523a050e273bd --- /dev/null +++ b/codenet/public_test_cases/p01289/output.0.txt @@ -0,0 +1 @@ +8.50000000 diff --git a/codenet/public_test_cases/p01289/output.1.txt b/codenet/public_test_cases/p01289/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c4898a5ecfd8ac493da68eaef3523a050e273bd --- /dev/null +++ b/codenet/public_test_cases/p01289/output.1.txt @@ -0,0 +1 @@ +8.50000000 diff --git a/codenet/public_test_cases/p01290/input.0.txt b/codenet/public_test_cases/p01290/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..842ae2861203b968165b6db1faf9af3c221c8acc --- /dev/null +++ b/codenet/public_test_cases/p01290/input.0.txt @@ -0,0 +1,22 @@ +2 2 +QE +EA +3 1 +QAE +3 1 +AQE +5 5 +..E.. +.###. +A###Q +.###. +..E.. +5 1 +A.E.Q +5 5 +A.... +####. +..E.. +.#### +....Q +0 0 diff --git a/codenet/public_test_cases/p01290/input.1.txt b/codenet/public_test_cases/p01290/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..759bf1c77bfda25dd62cd10cd193fd39bd2f4aa0 --- /dev/null +++ b/codenet/public_test_cases/p01290/input.1.txt @@ -0,0 +1,22 @@ +2 2 +QE +EA +3 1 +QAE +3 1 +AQE +5 5 +..E.. +.###. +A###Q +.###. +..E.. +5 1 +A.E.Q +5 5 +A.... +. +..E.. +.#### +....Q +0 0 diff --git a/codenet/public_test_cases/p01290/input.2.txt b/codenet/public_test_cases/p01290/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..842ae2861203b968165b6db1faf9af3c221c8acc --- /dev/null +++ b/codenet/public_test_cases/p01290/input.2.txt @@ -0,0 +1,22 @@ +2 2 +QE +EA +3 1 +QAE +3 1 +AQE +5 5 +..E.. +.###. +A###Q +.###. +..E.. +5 1 +A.E.Q +5 5 +A.... +####. +..E.. +.#### +....Q +0 0 diff --git a/codenet/public_test_cases/p01290/output.0.txt b/codenet/public_test_cases/p01290/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8e4ba6d6094d90016b25c148b8eff8ed3f15f2c --- /dev/null +++ b/codenet/public_test_cases/p01290/output.0.txt @@ -0,0 +1,6 @@ +Queen can not escape and Army can not catch Queen. +Army can catch Queen. +Queen can escape. +Queen can not escape and Army can not catch Queen. +Army can catch Queen. +Army can catch Queen. diff --git a/codenet/public_test_cases/p01290/output.1.txt b/codenet/public_test_cases/p01290/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8e4ba6d6094d90016b25c148b8eff8ed3f15f2c --- /dev/null +++ b/codenet/public_test_cases/p01290/output.1.txt @@ -0,0 +1,6 @@ +Queen can not escape and Army can not catch Queen. +Army can catch Queen. +Queen can escape. +Queen can not escape and Army can not catch Queen. +Army can catch Queen. +Army can catch Queen. diff --git a/codenet/public_test_cases/p01290/output.2.txt b/codenet/public_test_cases/p01290/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8e4ba6d6094d90016b25c148b8eff8ed3f15f2c --- /dev/null +++ b/codenet/public_test_cases/p01290/output.2.txt @@ -0,0 +1,6 @@ +Queen can not escape and Army can not catch Queen. +Army can catch Queen. +Queen can escape. +Queen can not escape and Army can not catch Queen. +Army can catch Queen. +Army can catch Queen. diff --git a/codenet/public_test_cases/p01291/input.0.txt b/codenet/public_test_cases/p01291/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a7a16c845f0749715814168affe1bed03fdabe7 --- /dev/null +++ b/codenet/public_test_cases/p01291/input.0.txt @@ -0,0 +1,12 @@ +5 2 +4 +1 1 +1 2 +2 2 +2 1 +4 +3 3 +3 4 +4 4 +4 3 +0 0 diff --git a/codenet/public_test_cases/p01291/input.1.txt b/codenet/public_test_cases/p01291/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a7a16c845f0749715814168affe1bed03fdabe7 --- /dev/null +++ b/codenet/public_test_cases/p01291/input.1.txt @@ -0,0 +1,12 @@ +5 2 +4 +1 1 +1 2 +2 2 +2 1 +4 +3 3 +3 4 +4 4 +4 3 +0 0 diff --git a/codenet/public_test_cases/p01291/output.0.txt b/codenet/public_test_cases/p01291/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..591a254521455a4628aed24c3b18c96891ffbc0f --- /dev/null +++ b/codenet/public_test_cases/p01291/output.0.txt @@ -0,0 +1 @@ +3.41421356 diff --git a/codenet/public_test_cases/p01291/output.1.txt b/codenet/public_test_cases/p01291/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..591a254521455a4628aed24c3b18c96891ffbc0f --- /dev/null +++ b/codenet/public_test_cases/p01291/output.1.txt @@ -0,0 +1 @@ +3.41421356 diff --git a/codenet/public_test_cases/p01292/input.0.txt b/codenet/public_test_cases/p01292/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..589690af74d5900d4c9fe605d862f53532f8c4e8 --- /dev/null +++ b/codenet/public_test_cases/p01292/input.0.txt @@ -0,0 +1,9 @@ +50 100 +2 +50 50 0 +51 51 50 +2 +0 0 0 +1 1 50 +0 +0 0 diff --git a/codenet/public_test_cases/p01292/input.1.txt b/codenet/public_test_cases/p01292/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..589690af74d5900d4c9fe605d862f53532f8c4e8 --- /dev/null +++ b/codenet/public_test_cases/p01292/input.1.txt @@ -0,0 +1,9 @@ +50 100 +2 +50 50 0 +51 51 50 +2 +0 0 0 +1 1 50 +0 +0 0 diff --git a/codenet/public_test_cases/p01292/output.0.txt b/codenet/public_test_cases/p01292/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p01292/output.0.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p01292/output.1.txt b/codenet/public_test_cases/p01292/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p01292/output.1.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p01293/input.0.txt b/codenet/public_test_cases/p01293/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b7fe2efc61c4e3583e48c2bae9293f9eb4a42d3 --- /dev/null +++ b/codenet/public_test_cases/p01293/input.0.txt @@ -0,0 +1,11 @@ +H +4C 8H QS 5D JD KS 8S AH 6H 7H 3S 7S 6D +TC JC JS KD AC QC QD 2H QH 3H 3C 7C 4D +6C 9C AS TD 5H 6S 5S KH TH AD 9S 8D 2D +8C 5C 2S 7D KC 4S TS JH 4H 9H 2C 9D 3D +D +8D 9D 9S QS 4H 5H JD JS 9H 6S TH 6H QH +QD 9C 5S 7S 7H AC 2D KD 6C 3D 8C TC 7C +5D QC 3S 4S 3H 3C 6D KS JC AS 5C 8H TS +4D 4C 8S 2S 2H KC TD JH 2C AH 7D AD KH +# diff --git a/codenet/public_test_cases/p01293/input.1.txt b/codenet/public_test_cases/p01293/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..26ea3dd1c2a826b45e2ff4d980477bbbc71a6761 --- /dev/null +++ b/codenet/public_test_cases/p01293/input.1.txt @@ -0,0 +1,10 @@ +H +4C 8H QS 5D JD KS 8S AH 6H 7H 3S 7S 6D +TC JC JS KD AC QC QD 2H QH 3H 3C 7C 4D +6C 9C AS TD 5H 6S 5S KH TH AD 9S 8D 2D +8C 5C 2S 7D KC 4S TS JH 4H 9H 2C 9D 3D +D +8D 9D 9S QS 4H 5H JD JS 9H 6S TH 6H QH +QD 9C 5S 7S 7H AC 2D KD 6C 3D 8C TC 7C +5D QC 3S 4S 3H 3C 6D KS JC AS 5C 8H TS +4D 4C 8S 2S 2H KC TD JH 2C AH 7D AD KH diff --git a/codenet/public_test_cases/p01293/input.2.txt b/codenet/public_test_cases/p01293/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b7fe2efc61c4e3583e48c2bae9293f9eb4a42d3 --- /dev/null +++ b/codenet/public_test_cases/p01293/input.2.txt @@ -0,0 +1,11 @@ +H +4C 8H QS 5D JD KS 8S AH 6H 7H 3S 7S 6D +TC JC JS KD AC QC QD 2H QH 3H 3C 7C 4D +6C 9C AS TD 5H 6S 5S KH TH AD 9S 8D 2D +8C 5C 2S 7D KC 4S TS JH 4H 9H 2C 9D 3D +D +8D 9D 9S QS 4H 5H JD JS 9H 6S TH 6H QH +QD 9C 5S 7S 7H AC 2D KD 6C 3D 8C TC 7C +5D QC 3S 4S 3H 3C 6D KS JC AS 5C 8H TS +4D 4C 8S 2S 2H KC TD JH 2C AH 7D AD KH +# diff --git a/codenet/public_test_cases/p01293/output.0.txt b/codenet/public_test_cases/p01293/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1792b789be0c06a7fb84225b80625a20139906d --- /dev/null +++ b/codenet/public_test_cases/p01293/output.0.txt @@ -0,0 +1,2 @@ +EW 1 +EW 2 diff --git a/codenet/public_test_cases/p01293/output.1.txt b/codenet/public_test_cases/p01293/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1792b789be0c06a7fb84225b80625a20139906d --- /dev/null +++ b/codenet/public_test_cases/p01293/output.1.txt @@ -0,0 +1,2 @@ +EW 1 +EW 2 diff --git a/codenet/public_test_cases/p01293/output.2.txt b/codenet/public_test_cases/p01293/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1792b789be0c06a7fb84225b80625a20139906d --- /dev/null +++ b/codenet/public_test_cases/p01293/output.2.txt @@ -0,0 +1,2 @@ +EW 1 +EW 2 diff --git a/codenet/public_test_cases/p01294/input.0.txt b/codenet/public_test_cases/p01294/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..572864f2c01171304e86c9aab9be356d49973a93 --- /dev/null +++ b/codenet/public_test_cases/p01294/input.0.txt @@ -0,0 +1,9 @@ +3 3 +3 4 1 1 +2 1 5 +2 3 3 +3 3 +3 2 3 1 +2 1 5 +2 3 3 +0 0 diff --git a/codenet/public_test_cases/p01294/input.1.txt b/codenet/public_test_cases/p01294/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..572864f2c01171304e86c9aab9be356d49973a93 --- /dev/null +++ b/codenet/public_test_cases/p01294/input.1.txt @@ -0,0 +1,9 @@ +3 3 +3 4 1 1 +2 1 5 +2 3 3 +3 3 +3 2 3 1 +2 1 5 +2 3 3 +0 0 diff --git a/codenet/public_test_cases/p01294/output.0.txt b/codenet/public_test_cases/p01294/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p01294/output.0.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p01294/output.1.txt b/codenet/public_test_cases/p01294/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p01294/output.1.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p01295/input.0.txt b/codenet/public_test_cases/p01295/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0da6c134f84c556116712bf22c5efb6af4c09f0 --- /dev/null +++ b/codenet/public_test_cases/p01295/input.0.txt @@ -0,0 +1,3 @@ +4 5 +6 7 +0 0 diff --git a/codenet/public_test_cases/p01295/input.1.txt b/codenet/public_test_cases/p01295/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0da6c134f84c556116712bf22c5efb6af4c09f0 --- /dev/null +++ b/codenet/public_test_cases/p01295/input.1.txt @@ -0,0 +1,3 @@ +4 5 +6 7 +0 0 diff --git a/codenet/public_test_cases/p01295/output.0.txt b/codenet/public_test_cases/p01295/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..643021915a0a646eaa3a7723640f6fcc6cef5c1e --- /dev/null +++ b/codenet/public_test_cases/p01295/output.0.txt @@ -0,0 +1,2 @@ +45678 +6789101 diff --git a/codenet/public_test_cases/p01295/output.1.txt b/codenet/public_test_cases/p01295/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..643021915a0a646eaa3a7723640f6fcc6cef5c1e --- /dev/null +++ b/codenet/public_test_cases/p01295/output.1.txt @@ -0,0 +1,2 @@ +45678 +6789101 diff --git a/codenet/public_test_cases/p01296/input.0.txt b/codenet/public_test_cases/p01296/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dc42972ae1a6c7f206b64b37fdcf23295042eed --- /dev/null +++ b/codenet/public_test_cases/p01296/input.0.txt @@ -0,0 +1,16 @@ +4 +0 0 x +2 0 x +0 1 x +2 1 x +4 +1 0 x +0 1 x +2 1 x +1 2 x +4 +0 0 x +2 0 y +0 1 y +1 2 x +0 diff --git a/codenet/public_test_cases/p01296/input.1.txt b/codenet/public_test_cases/p01296/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dc42972ae1a6c7f206b64b37fdcf23295042eed --- /dev/null +++ b/codenet/public_test_cases/p01296/input.1.txt @@ -0,0 +1,16 @@ +4 +0 0 x +2 0 x +0 1 x +2 1 x +4 +1 0 x +0 1 x +2 1 x +1 2 x +4 +0 0 x +2 0 y +0 1 y +1 2 x +0 diff --git a/codenet/public_test_cases/p01296/output.0.txt b/codenet/public_test_cases/p01296/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef5c0439807192f2948a416361d3fec90374dac --- /dev/null +++ b/codenet/public_test_cases/p01296/output.0.txt @@ -0,0 +1,3 @@ +Yes +No +Yes diff --git a/codenet/public_test_cases/p01296/output.1.txt b/codenet/public_test_cases/p01296/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef5c0439807192f2948a416361d3fec90374dac --- /dev/null +++ b/codenet/public_test_cases/p01296/output.1.txt @@ -0,0 +1,3 @@ +Yes +No +Yes diff --git a/codenet/public_test_cases/p01297/input.0.txt b/codenet/public_test_cases/p01297/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..816eeeda548b7430cf438aaa85e3bb14d2c4fb4f --- /dev/null +++ b/codenet/public_test_cases/p01297/input.0.txt @@ -0,0 +1,5 @@ +100 100 1 1 +50 0 50 100 50 +640 480 1 1 +0 0 640 480 100 +0 0 0 0 diff --git a/codenet/public_test_cases/p01297/input.1.txt b/codenet/public_test_cases/p01297/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..816eeeda548b7430cf438aaa85e3bb14d2c4fb4f --- /dev/null +++ b/codenet/public_test_cases/p01297/input.1.txt @@ -0,0 +1,5 @@ +100 100 1 1 +50 0 50 100 50 +640 480 1 1 +0 0 640 480 100 +0 0 0 0 diff --git a/codenet/public_test_cases/p01297/output.0.txt b/codenet/public_test_cases/p01297/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6631b22779376d4c1b0470c35390d511ec268e3c --- /dev/null +++ b/codenet/public_test_cases/p01297/output.0.txt @@ -0,0 +1,2 @@ +No +Yes diff --git a/codenet/public_test_cases/p01297/output.1.txt b/codenet/public_test_cases/p01297/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6631b22779376d4c1b0470c35390d511ec268e3c --- /dev/null +++ b/codenet/public_test_cases/p01297/output.1.txt @@ -0,0 +1,2 @@ +No +Yes diff --git a/codenet/public_test_cases/p01298/input.0.txt b/codenet/public_test_cases/p01298/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28ff868b6613dd75eba5f48d9b38de9479d7d21b --- /dev/null +++ b/codenet/public_test_cases/p01298/input.0.txt @@ -0,0 +1,5 @@ +1 100 +0 86400 1 +1 100 +43200 86400 1 +0 0 diff --git a/codenet/public_test_cases/p01298/input.1.txt b/codenet/public_test_cases/p01298/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28ff868b6613dd75eba5f48d9b38de9479d7d21b --- /dev/null +++ b/codenet/public_test_cases/p01298/input.1.txt @@ -0,0 +1,5 @@ +1 100 +0 86400 1 +1 100 +43200 86400 1 +0 0 diff --git a/codenet/public_test_cases/p01298/output.0.txt b/codenet/public_test_cases/p01298/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd311e8bf8bb6b31c4195ff6d782dd83285a62e5 --- /dev/null +++ b/codenet/public_test_cases/p01298/output.0.txt @@ -0,0 +1,2 @@ +1.000000 +0.997685 diff --git a/codenet/public_test_cases/p01298/output.1.txt b/codenet/public_test_cases/p01298/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd311e8bf8bb6b31c4195ff6d782dd83285a62e5 --- /dev/null +++ b/codenet/public_test_cases/p01298/output.1.txt @@ -0,0 +1,2 @@ +1.000000 +0.997685 diff --git a/codenet/public_test_cases/p01299/input.0.txt b/codenet/public_test_cases/p01299/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ccc3b9b1ddf4741dcab6af025fcddbc941982d0 --- /dev/null +++ b/codenet/public_test_cases/p01299/input.0.txt @@ -0,0 +1,12 @@ +3 +0 0 100 100 +60 100 50 +100 100 10 +80 80 50 +4 +0 0 100 100 +50 50 50 +150 50 50 +50 150 50 +150 150 50 +0 diff --git a/codenet/public_test_cases/p01299/input.1.txt b/codenet/public_test_cases/p01299/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ccc3b9b1ddf4741dcab6af025fcddbc941982d0 --- /dev/null +++ b/codenet/public_test_cases/p01299/input.1.txt @@ -0,0 +1,12 @@ +3 +0 0 100 100 +60 100 50 +100 100 10 +80 80 50 +4 +0 0 100 100 +50 50 50 +150 50 50 +50 150 50 +150 150 50 +0 diff --git a/codenet/public_test_cases/p01299/output.0.txt b/codenet/public_test_cases/p01299/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..389e2621455b5b9129a49a4006e658565a970912 --- /dev/null +++ b/codenet/public_test_cases/p01299/output.0.txt @@ -0,0 +1,2 @@ +2 +0 diff --git a/codenet/public_test_cases/p01299/output.1.txt b/codenet/public_test_cases/p01299/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..389e2621455b5b9129a49a4006e658565a970912 --- /dev/null +++ b/codenet/public_test_cases/p01299/output.1.txt @@ -0,0 +1,2 @@ +2 +0 diff --git a/codenet/public_test_cases/p01300/input.0.txt b/codenet/public_test_cases/p01300/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea263ce151f8a0c256b460b4f5fdef7f68590d38 --- /dev/null +++ b/codenet/public_test_cases/p01300/input.0.txt @@ -0,0 +1,5 @@ +17819 +1111 +11011 +1234567891011121314151617181920 +0 diff --git a/codenet/public_test_cases/p01300/input.1.txt b/codenet/public_test_cases/p01300/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea263ce151f8a0c256b460b4f5fdef7f68590d38 --- /dev/null +++ b/codenet/public_test_cases/p01300/input.1.txt @@ -0,0 +1,5 @@ +17819 +1111 +11011 +1234567891011121314151617181920 +0 diff --git a/codenet/public_test_cases/p01300/output.0.txt b/codenet/public_test_cases/p01300/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb1b8efdaca7c827d6be106f76ac7d35294e9b7a --- /dev/null +++ b/codenet/public_test_cases/p01300/output.0.txt @@ -0,0 +1,4 @@ +1 +4 +4 +38 diff --git a/codenet/public_test_cases/p01300/output.1.txt b/codenet/public_test_cases/p01300/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb1b8efdaca7c827d6be106f76ac7d35294e9b7a --- /dev/null +++ b/codenet/public_test_cases/p01300/output.1.txt @@ -0,0 +1,4 @@ +1 +4 +4 +38 diff --git a/codenet/public_test_cases/p01301/input.0.txt b/codenet/public_test_cases/p01301/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29f3991bf1503ad7b4ae0c6617160823c8d9eb6e --- /dev/null +++ b/codenet/public_test_cases/p01301/input.0.txt @@ -0,0 +1,59 @@ +3 3 3 5 +3 2 2 +*** +.*. + +.*. +... + +3 2 1 +*** +**. + +3 1 3 +..* + +.** + +**. + +3 2 2 +..* +... + +*** +..* + +3 1 3 +.** + +.** + +*** + +3 3 3 2 +3 3 3 +*** +*** +*** + +*** +*.* +*** + +*** +*** +*** + +1 1 1 +* + +3 2 1 2 +3 1 1 +*** + +2 2 1 +** +*. + +0 0 0 0 diff --git a/codenet/public_test_cases/p01301/input.1.txt b/codenet/public_test_cases/p01301/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29f3991bf1503ad7b4ae0c6617160823c8d9eb6e --- /dev/null +++ b/codenet/public_test_cases/p01301/input.1.txt @@ -0,0 +1,59 @@ +3 3 3 5 +3 2 2 +*** +.*. + +.*. +... + +3 2 1 +*** +**. + +3 1 3 +..* + +.** + +**. + +3 2 2 +..* +... + +*** +..* + +3 1 3 +.** + +.** + +*** + +3 3 3 2 +3 3 3 +*** +*** +*** + +*** +*.* +*** + +*** +*** +*** + +1 1 1 +* + +3 2 1 2 +3 1 1 +*** + +2 2 1 +** +*. + +0 0 0 0 diff --git a/codenet/public_test_cases/p01301/output.0.txt b/codenet/public_test_cases/p01301/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e42eaccba8fbb670afcbc090ead039c26258d21 --- /dev/null +++ b/codenet/public_test_cases/p01301/output.0.txt @@ -0,0 +1,3 @@ +Yes +Yes +No diff --git a/codenet/public_test_cases/p01301/output.1.txt b/codenet/public_test_cases/p01301/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e42eaccba8fbb670afcbc090ead039c26258d21 --- /dev/null +++ b/codenet/public_test_cases/p01301/output.1.txt @@ -0,0 +1,3 @@ +Yes +Yes +No diff --git a/codenet/public_test_cases/p01302/input.0.txt b/codenet/public_test_cases/p01302/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ed900c1de4d4e398c9f778d51c13898c9b4849 --- /dev/null +++ b/codenet/public_test_cases/p01302/input.0.txt @@ -0,0 +1,17 @@ +5 +0 1 +0 0 +5 0 +1 1 +5 2 +0 2 +7 +9999 9998 +0 0 +2 0 +3 1 +1 1 +10000 9999 +2 2 +0 2 +0 diff --git a/codenet/public_test_cases/p01302/input.1.txt b/codenet/public_test_cases/p01302/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ed900c1de4d4e398c9f778d51c13898c9b4849 --- /dev/null +++ b/codenet/public_test_cases/p01302/input.1.txt @@ -0,0 +1,17 @@ +5 +0 1 +0 0 +5 0 +1 1 +5 2 +0 2 +7 +9999 9998 +0 0 +2 0 +3 1 +1 1 +10000 9999 +2 2 +0 2 +0 diff --git a/codenet/public_test_cases/p01302/output.0.txt b/codenet/public_test_cases/p01302/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac96f0888cfc8bf6c04e8ffeaba016e1db9b8d3f --- /dev/null +++ b/codenet/public_test_cases/p01302/output.0.txt @@ -0,0 +1,2 @@ +2.00 +2.2500000 diff --git a/codenet/public_test_cases/p01302/output.1.txt b/codenet/public_test_cases/p01302/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac96f0888cfc8bf6c04e8ffeaba016e1db9b8d3f --- /dev/null +++ b/codenet/public_test_cases/p01302/output.1.txt @@ -0,0 +1,2 @@ +2.00 +2.2500000 diff --git a/codenet/public_test_cases/p01303/input.0.txt b/codenet/public_test_cases/p01303/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5d9380f4cd61f775bc09a28b348696139cea60b --- /dev/null +++ b/codenet/public_test_cases/p01303/input.0.txt @@ -0,0 +1,13 @@ +2 +1 3 20 10 +4 +21 13 +1 15 +10 10 +25 10 +1 3 20 10 +4 +21 13 +1 15 +10 10 +25 10 diff --git a/codenet/public_test_cases/p01303/input.1.txt b/codenet/public_test_cases/p01303/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5d9380f4cd61f775bc09a28b348696139cea60b --- /dev/null +++ b/codenet/public_test_cases/p01303/input.1.txt @@ -0,0 +1,13 @@ +2 +1 3 20 10 +4 +21 13 +1 15 +10 10 +25 10 +1 3 20 10 +4 +21 13 +1 15 +10 10 +25 10 diff --git a/codenet/public_test_cases/p01303/output.0.txt b/codenet/public_test_cases/p01303/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..51993f072d5832f20b98b6bd0cf763fb8b4c8a1b --- /dev/null +++ b/codenet/public_test_cases/p01303/output.0.txt @@ -0,0 +1,2 @@ +2 +2 diff --git a/codenet/public_test_cases/p01303/output.1.txt b/codenet/public_test_cases/p01303/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51993f072d5832f20b98b6bd0cf763fb8b4c8a1b --- /dev/null +++ b/codenet/public_test_cases/p01303/output.1.txt @@ -0,0 +1,2 @@ +2 +2 diff --git a/codenet/public_test_cases/p01304/input.0.txt b/codenet/public_test_cases/p01304/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db1ce6f32afdcfcd352c920bbdf40d4889a6c374 --- /dev/null +++ b/codenet/public_test_cases/p01304/input.0.txt @@ -0,0 +1,15 @@ +4 +2 2 +0 +1 1 +2 +0 0 0 1 +0 0 1 0 +4 3 +4 +1 0 0 0 +3 3 4 3 +4 1 4 0 +0 2 0 3 +15 15 +0 diff --git a/codenet/public_test_cases/p01304/input.1.txt b/codenet/public_test_cases/p01304/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db1ce6f32afdcfcd352c920bbdf40d4889a6c374 --- /dev/null +++ b/codenet/public_test_cases/p01304/input.1.txt @@ -0,0 +1,15 @@ +4 +2 2 +0 +1 1 +2 +0 0 0 1 +0 0 1 0 +4 3 +4 +1 0 0 0 +3 3 4 3 +4 1 4 0 +0 2 0 3 +15 15 +0 diff --git a/codenet/public_test_cases/p01304/output.0.txt b/codenet/public_test_cases/p01304/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8814d77731b96237d5ddcc6fdd61dd1a2e4f94ca --- /dev/null +++ b/codenet/public_test_cases/p01304/output.0.txt @@ -0,0 +1,4 @@ +6 +Miserable Hokusai! +5 +155117520 diff --git a/codenet/public_test_cases/p01304/output.1.txt b/codenet/public_test_cases/p01304/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8814d77731b96237d5ddcc6fdd61dd1a2e4f94ca --- /dev/null +++ b/codenet/public_test_cases/p01304/output.1.txt @@ -0,0 +1,4 @@ +6 +Miserable Hokusai! +5 +155117520 diff --git a/codenet/public_test_cases/p01305/input.0.txt b/codenet/public_test_cases/p01305/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee1a130d2f9f274f73404ef354b23cd3c8098f98 --- /dev/null +++ b/codenet/public_test_cases/p01305/input.0.txt @@ -0,0 +1,5 @@ +2 +1 3 5 7 9 11 13 15 17 +2 4 6 8 10 12 14 16 18 +1 5 7 9 11 13 15 17 18 +2 3 4 6 8 10 12 14 16 diff --git a/codenet/public_test_cases/p01305/input.1.txt b/codenet/public_test_cases/p01305/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee1a130d2f9f274f73404ef354b23cd3c8098f98 --- /dev/null +++ b/codenet/public_test_cases/p01305/input.1.txt @@ -0,0 +1,5 @@ +2 +1 3 5 7 9 11 13 15 17 +2 4 6 8 10 12 14 16 18 +1 5 7 9 11 13 15 17 18 +2 3 4 6 8 10 12 14 16 diff --git a/codenet/public_test_cases/p01305/output.0.txt b/codenet/public_test_cases/p01305/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f277275b076aa5f252032d8f8b91c58d1931bca2 --- /dev/null +++ b/codenet/public_test_cases/p01305/output.0.txt @@ -0,0 +1,2 @@ +0.30891 0.69109 +0.92747 0.07253 diff --git a/codenet/public_test_cases/p01305/output.1.txt b/codenet/public_test_cases/p01305/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f277275b076aa5f252032d8f8b91c58d1931bca2 --- /dev/null +++ b/codenet/public_test_cases/p01305/output.1.txt @@ -0,0 +1,2 @@ +0.30891 0.69109 +0.92747 0.07253 diff --git a/codenet/public_test_cases/p01306/input.0.txt b/codenet/public_test_cases/p01306/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b66bca9dd97f4d2891f9aa2476700eb3e518e64 --- /dev/null +++ b/codenet/public_test_cases/p01306/input.0.txt @@ -0,0 +1,8 @@ +7 +12.3 kilo meters +0.45 mega watts +0.000000000000000000000001 yotta grams +1000000000000000000000000 yocto seconds +42 amperes +0.42 joules +1234.56789012345678901234567890 hecto pascals diff --git a/codenet/public_test_cases/p01306/input.1.txt b/codenet/public_test_cases/p01306/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b66bca9dd97f4d2891f9aa2476700eb3e518e64 --- /dev/null +++ b/codenet/public_test_cases/p01306/input.1.txt @@ -0,0 +1,8 @@ +7 +12.3 kilo meters +0.45 mega watts +0.000000000000000000000001 yotta grams +1000000000000000000000000 yocto seconds +42 amperes +0.42 joules +1234.56789012345678901234567890 hecto pascals diff --git a/codenet/public_test_cases/p01306/output.0.txt b/codenet/public_test_cases/p01306/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab6be12db9f4c5fb10b73d1cd7a453503d1608c4 --- /dev/null +++ b/codenet/public_test_cases/p01306/output.0.txt @@ -0,0 +1,7 @@ +1.23 * 10^4 meters +4.5 * 10^5 watts +1 * 10^0 grams +1.000000000000000000000000 * 10^0 seconds +4.2 * 10^1 amperes +4.2 * 10^-1 joules +1.23456789012345678901234567890 * 10^5 pascals diff --git a/codenet/public_test_cases/p01306/output.1.txt b/codenet/public_test_cases/p01306/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab6be12db9f4c5fb10b73d1cd7a453503d1608c4 --- /dev/null +++ b/codenet/public_test_cases/p01306/output.1.txt @@ -0,0 +1,7 @@ +1.23 * 10^4 meters +4.5 * 10^5 watts +1 * 10^0 grams +1.000000000000000000000000 * 10^0 seconds +4.2 * 10^1 amperes +4.2 * 10^-1 joules +1.23456789012345678901234567890 * 10^5 pascals diff --git a/codenet/public_test_cases/p01307/input.0.txt b/codenet/public_test_cases/p01307/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e576fd77a403af35c0819e66e401314c175c76a --- /dev/null +++ b/codenet/public_test_cases/p01307/input.0.txt @@ -0,0 +1,4 @@ +3 +1234 +5555 +9 diff --git a/codenet/public_test_cases/p01307/input.1.txt b/codenet/public_test_cases/p01307/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e576fd77a403af35c0819e66e401314c175c76a --- /dev/null +++ b/codenet/public_test_cases/p01307/input.1.txt @@ -0,0 +1,4 @@ +3 +1234 +5555 +9 diff --git a/codenet/public_test_cases/p01307/output.0.txt b/codenet/public_test_cases/p01307/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f42ed7177dbc64ecf0b40a4df62fff9478d0323e --- /dev/null +++ b/codenet/public_test_cases/p01307/output.0.txt @@ -0,0 +1,3 @@ +Audrey wins. +Fabre wins. +Audrey wins. diff --git a/codenet/public_test_cases/p01307/output.1.txt b/codenet/public_test_cases/p01307/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f42ed7177dbc64ecf0b40a4df62fff9478d0323e --- /dev/null +++ b/codenet/public_test_cases/p01307/output.1.txt @@ -0,0 +1,3 @@ +Audrey wins. +Fabre wins. +Audrey wins. diff --git a/codenet/public_test_cases/p01308/input.0.txt b/codenet/public_test_cases/p01308/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc05001e54037f8c3bddf31f302d652d2c7a77c0 --- /dev/null +++ b/codenet/public_test_cases/p01308/input.0.txt @@ -0,0 +1,13 @@ +4 +6 4 +C E D# F G A +C E F G +6 4 +C E D# F G A +C D# F G +3 6 +C D D +D# B D B D# C# +8 8 +C B B B B B F F +C B B B B B B B diff --git a/codenet/public_test_cases/p01308/input.1.txt b/codenet/public_test_cases/p01308/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc05001e54037f8c3bddf31f302d652d2c7a77c0 --- /dev/null +++ b/codenet/public_test_cases/p01308/input.1.txt @@ -0,0 +1,13 @@ +4 +6 4 +C E D# F G A +C E F G +6 4 +C E D# F G A +C D# F G +3 6 +C D D +D# B D B D# C# +8 8 +C B B B B B F F +C B B B B B B B diff --git a/codenet/public_test_cases/p01308/output.0.txt b/codenet/public_test_cases/p01308/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8108ded7943097dbb59a48405f78663efad42e90 --- /dev/null +++ b/codenet/public_test_cases/p01308/output.0.txt @@ -0,0 +1,4 @@ +Yes +No +Yes +No diff --git a/codenet/public_test_cases/p01308/output.1.txt b/codenet/public_test_cases/p01308/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8108ded7943097dbb59a48405f78663efad42e90 --- /dev/null +++ b/codenet/public_test_cases/p01308/output.1.txt @@ -0,0 +1,4 @@ +Yes +No +Yes +No diff --git a/codenet/public_test_cases/p01309/input.0.txt b/codenet/public_test_cases/p01309/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76c825c498db0a572f9e8f551bf93badd4ac9c86 --- /dev/null +++ b/codenet/public_test_cases/p01309/input.0.txt @@ -0,0 +1,24 @@ +4 +3 3 5 +0 0 +10 0 +40 40 +40 90 +4 5 10 +100 100 +50 100 +50 150 +100 50 +100 150 +4 60 10 +100 100 +90 100 +110 100 +100 90 +100 110 +4 60 10 +100 100 +80 100 +110 100 +100 80 +100 110 diff --git a/codenet/public_test_cases/p01309/input.1.txt b/codenet/public_test_cases/p01309/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76c825c498db0a572f9e8f551bf93badd4ac9c86 --- /dev/null +++ b/codenet/public_test_cases/p01309/input.1.txt @@ -0,0 +1,24 @@ +4 +3 3 5 +0 0 +10 0 +40 40 +40 90 +4 5 10 +100 100 +50 100 +50 150 +100 50 +100 150 +4 60 10 +100 100 +90 100 +110 100 +100 90 +100 110 +4 60 10 +100 100 +80 100 +110 100 +100 80 +100 110 diff --git a/codenet/public_test_cases/p01309/output.0.txt b/codenet/public_test_cases/p01309/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4031939a2288a78cbd4ea5cf8788f0b0b89473d4 --- /dev/null +++ b/codenet/public_test_cases/p01309/output.0.txt @@ -0,0 +1,4 @@ +9 +0 +60 +You're always welcome! diff --git a/codenet/public_test_cases/p01309/output.1.txt b/codenet/public_test_cases/p01309/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4031939a2288a78cbd4ea5cf8788f0b0b89473d4 --- /dev/null +++ b/codenet/public_test_cases/p01309/output.1.txt @@ -0,0 +1,4 @@ +9 +0 +60 +You're always welcome! diff --git a/codenet/public_test_cases/p01310/input.0.txt b/codenet/public_test_cases/p01310/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d75ecf3ea290c1766a10e96484f5c9b208b319e --- /dev/null +++ b/codenet/public_test_cases/p01310/input.0.txt @@ -0,0 +1,16 @@ +4 +3 2 1 +20 1 +10 2 +5 7 3 +70 1 +60 4 +50 2 +40 4 +30 1 +20 3 +10 2 +1 0 1 +4 2 1 +10 1 +10 3 diff --git a/codenet/public_test_cases/p01310/input.1.txt b/codenet/public_test_cases/p01310/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d75ecf3ea290c1766a10e96484f5c9b208b319e --- /dev/null +++ b/codenet/public_test_cases/p01310/input.1.txt @@ -0,0 +1,16 @@ +4 +3 2 1 +20 1 +10 2 +5 7 3 +70 1 +60 4 +50 2 +40 4 +30 1 +20 3 +10 2 +1 0 1 +4 2 1 +10 1 +10 3 diff --git a/codenet/public_test_cases/p01310/output.0.txt b/codenet/public_test_cases/p01310/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3eb584b1d7af4ccb1b070a7d932460ed5b5c7d5 --- /dev/null +++ b/codenet/public_test_cases/p01310/output.0.txt @@ -0,0 +1,13 @@ +1 +0 +1 +1 +0 +1 +1 +2 +0 +1 +0 +1 +2 diff --git a/codenet/public_test_cases/p01310/output.1.txt b/codenet/public_test_cases/p01310/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3eb584b1d7af4ccb1b070a7d932460ed5b5c7d5 --- /dev/null +++ b/codenet/public_test_cases/p01310/output.1.txt @@ -0,0 +1,13 @@ +1 +0 +1 +1 +0 +1 +1 +2 +0 +1 +0 +1 +2 diff --git a/codenet/public_test_cases/p01311/input.0.txt b/codenet/public_test_cases/p01311/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..761d7d1d82bfa1400477eb89132377e9d92e8167 --- /dev/null +++ b/codenet/public_test_cases/p01311/input.0.txt @@ -0,0 +1,17 @@ +2 +4 6 +1 2 +1 2 N +2 3 N +3 4 N +4 1 N +1 4 L +4 0 L +4 6 +1 2 +1 2 N +2 3 N +3 4 N +4 1 N +1 4 L +4 0 N diff --git a/codenet/public_test_cases/p01311/input.1.txt b/codenet/public_test_cases/p01311/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..761d7d1d82bfa1400477eb89132377e9d92e8167 --- /dev/null +++ b/codenet/public_test_cases/p01311/input.1.txt @@ -0,0 +1,17 @@ +2 +4 6 +1 2 +1 2 N +2 3 N +3 4 N +4 1 N +1 4 L +4 0 L +4 6 +1 2 +1 2 N +2 3 N +3 4 N +4 1 N +1 4 L +4 0 N diff --git a/codenet/public_test_cases/p01311/output.0.txt b/codenet/public_test_cases/p01311/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p01311/output.0.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p01311/output.1.txt b/codenet/public_test_cases/p01311/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p01311/output.1.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p01312/input.0.txt b/codenet/public_test_cases/p01312/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e49e6442664b715d9e31da1b395fe8ac7909126 --- /dev/null +++ b/codenet/public_test_cases/p01312/input.0.txt @@ -0,0 +1,13 @@ +2 +0 0 +0 0 +15:00:00 +18:00:00 +1 +4 0 7199 1125 7199 1125 8324 0 8324 +0 0 +0 0 +15:00:00 +18:00:00 +1 +4 0 7201 1125 7201 1125 8326 0 8326 diff --git a/codenet/public_test_cases/p01312/input.1.txt b/codenet/public_test_cases/p01312/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e49e6442664b715d9e31da1b395fe8ac7909126 --- /dev/null +++ b/codenet/public_test_cases/p01312/input.1.txt @@ -0,0 +1,13 @@ +2 +0 0 +0 0 +15:00:00 +18:00:00 +1 +4 0 7199 1125 7199 1125 8324 0 8324 +0 0 +0 0 +15:00:00 +18:00:00 +1 +4 0 7201 1125 7201 1125 8326 0 8326 diff --git a/codenet/public_test_cases/p01312/output.0.txt b/codenet/public_test_cases/p01312/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a905cc546837f700099f1c9ecb2e26a1bb75c303 --- /dev/null +++ b/codenet/public_test_cases/p01312/output.0.txt @@ -0,0 +1,4 @@ +1 +17 59 59.076923 +0 +15 00 00.000000 diff --git a/codenet/public_test_cases/p01312/output.1.txt b/codenet/public_test_cases/p01312/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a905cc546837f700099f1c9ecb2e26a1bb75c303 --- /dev/null +++ b/codenet/public_test_cases/p01312/output.1.txt @@ -0,0 +1,4 @@ +1 +17 59 59.076923 +0 +15 00 00.000000 diff --git a/codenet/public_test_cases/p01313/input.0.txt b/codenet/public_test_cases/p01313/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..43b66826b330595fcf1f0cf963af92253e8d5337 --- /dev/null +++ b/codenet/public_test_cases/p01313/input.0.txt @@ -0,0 +1,5 @@ +4 +1 1 +1 3 +1 4 +2 2 diff --git a/codenet/public_test_cases/p01313/output.0.txt b/codenet/public_test_cases/p01313/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6add108a1a5cbe07c2bd3c6e0f92e9f52d415eba --- /dev/null +++ b/codenet/public_test_cases/p01313/output.0.txt @@ -0,0 +1,8 @@ +1 5 +2 7 +7 119 +No cats. +13 53 +18 63 +33 88 +35 91 diff --git a/codenet/public_test_cases/p01314/input.0.txt b/codenet/public_test_cases/p01314/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38d74319b84dfccff5cf0cc3a7bfae35268b41ce --- /dev/null +++ b/codenet/public_test_cases/p01314/input.0.txt @@ -0,0 +1,3 @@ +9 +500 +0 diff --git a/codenet/public_test_cases/p01314/input.1.txt b/codenet/public_test_cases/p01314/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38d74319b84dfccff5cf0cc3a7bfae35268b41ce --- /dev/null +++ b/codenet/public_test_cases/p01314/input.1.txt @@ -0,0 +1,3 @@ +9 +500 +0 diff --git a/codenet/public_test_cases/p01314/output.0.txt b/codenet/public_test_cases/p01314/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4792e70f333077a81456ca2bc74e492ab8bb58c3 --- /dev/null +++ b/codenet/public_test_cases/p01314/output.0.txt @@ -0,0 +1,2 @@ +2 +3 diff --git a/codenet/public_test_cases/p01314/output.1.txt b/codenet/public_test_cases/p01314/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4792e70f333077a81456ca2bc74e492ab8bb58c3 --- /dev/null +++ b/codenet/public_test_cases/p01314/output.1.txt @@ -0,0 +1,2 @@ +2 +3 diff --git a/codenet/public_test_cases/p01315/input.0.txt b/codenet/public_test_cases/p01315/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b27661a0169a19411acd00271fce8bb570714cdd --- /dev/null +++ b/codenet/public_test_cases/p01315/input.0.txt @@ -0,0 +1,16 @@ +5 +apple 1 1 1 1 1 1 1 10 1 +banana 1 2 2 2 2 2 1 10 1 +carrot 1 2 2 2 2 2 1 10 2 +durian 1 3 3 3 3 3 1 10 1 +eggplant 1 3 3 3 3 3 1 100 1 +4 +enoki 1 3 3 3 3 3 1 10 1 +tomato 1 3 3 3 3 3 1 10 1 +potato 1 3 3 3 3 3 1 10 1 +onion 1 3 3 3 3 3 1 10 1 +3 +a 10 1 1 1 1 1 1 10 1 +b 10 2 2 2 2 2 2 10 1 +c 10 2 2 2 2 2 2 10 1 +0 diff --git a/codenet/public_test_cases/p01315/input.1.txt b/codenet/public_test_cases/p01315/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b27661a0169a19411acd00271fce8bb570714cdd --- /dev/null +++ b/codenet/public_test_cases/p01315/input.1.txt @@ -0,0 +1,16 @@ +5 +apple 1 1 1 1 1 1 1 10 1 +banana 1 2 2 2 2 2 1 10 1 +carrot 1 2 2 2 2 2 1 10 2 +durian 1 3 3 3 3 3 1 10 1 +eggplant 1 3 3 3 3 3 1 100 1 +4 +enoki 1 3 3 3 3 3 1 10 1 +tomato 1 3 3 3 3 3 1 10 1 +potato 1 3 3 3 3 3 1 10 1 +onion 1 3 3 3 3 3 1 10 1 +3 +a 10 1 1 1 1 1 1 10 1 +b 10 2 2 2 2 2 2 10 1 +c 10 2 2 2 2 2 2 10 1 +0 diff --git a/codenet/public_test_cases/p01315/output.0.txt b/codenet/public_test_cases/p01315/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fd03f79c6efab99cb79ab1e822941297152e0a0 --- /dev/null +++ b/codenet/public_test_cases/p01315/output.0.txt @@ -0,0 +1,15 @@ +eggplant +apple +carrot +banana +durian +# +enoki +onion +potato +tomato +# +b +c +a +# diff --git a/codenet/public_test_cases/p01315/output.1.txt b/codenet/public_test_cases/p01315/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fd03f79c6efab99cb79ab1e822941297152e0a0 --- /dev/null +++ b/codenet/public_test_cases/p01315/output.1.txt @@ -0,0 +1,15 @@ +eggplant +apple +carrot +banana +durian +# +enoki +onion +potato +tomato +# +b +c +a +# diff --git a/codenet/public_test_cases/p01316/input.0.txt b/codenet/public_test_cases/p01316/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0dd65b73701a783490bf55b87427cd86992a985b --- /dev/null +++ b/codenet/public_test_cases/p01316/input.0.txt @@ -0,0 +1,52 @@ +2 7 +4 +2 +1 +0 +-1 +-2 +-4 +131 +137 +2 7 +4 +2 +1 +0 +-1 +-2 +-4 +131 +123 +10 7 +-4 +-2 +-1 +0 +1 +2 +4 +132 +134 +135 +134 +132 +128 +124 +122 +121 +122 +5 1 +255 +0 +0 +0 +0 +0 +4 1 +0 +255 +0 +255 +0 +0 0 diff --git a/codenet/public_test_cases/p01316/input.1.txt b/codenet/public_test_cases/p01316/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0dd65b73701a783490bf55b87427cd86992a985b --- /dev/null +++ b/codenet/public_test_cases/p01316/input.1.txt @@ -0,0 +1,52 @@ +2 7 +4 +2 +1 +0 +-1 +-2 +-4 +131 +137 +2 7 +4 +2 +1 +0 +-1 +-2 +-4 +131 +123 +10 7 +-4 +-2 +-1 +0 +1 +2 +4 +132 +134 +135 +134 +132 +128 +124 +122 +121 +122 +5 1 +255 +0 +0 +0 +0 +0 +4 1 +0 +255 +0 +255 +0 +0 0 diff --git a/codenet/public_test_cases/p01316/output.0.txt b/codenet/public_test_cases/p01316/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..350d4463f5c54c9a7ddfa73d296b6747c04c65e6 --- /dev/null +++ b/codenet/public_test_cases/p01316/output.0.txt @@ -0,0 +1,5 @@ +2 +8 +0 +325125 +65026 diff --git a/codenet/public_test_cases/p01316/output.1.txt b/codenet/public_test_cases/p01316/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..350d4463f5c54c9a7ddfa73d296b6747c04c65e6 --- /dev/null +++ b/codenet/public_test_cases/p01316/output.1.txt @@ -0,0 +1,5 @@ +2 +8 +0 +325125 +65026 diff --git a/codenet/public_test_cases/p01317/input.0.txt b/codenet/public_test_cases/p01317/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2a7f58137e48c757636ffa90ae413996438076e --- /dev/null +++ b/codenet/public_test_cases/p01317/input.0.txt @@ -0,0 +1,15 @@ +3 3 +1 2 5 L +1 2 7 S +2 3 11 S +3 +1 2 3 +5 5 +1 2 15 L +2 3 10 L +4 5 7 L +1 3 30 S +3 4 100 S +5 +1 3 5 4 1 +0 0 diff --git a/codenet/public_test_cases/p01317/input.1.txt b/codenet/public_test_cases/p01317/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2a7f58137e48c757636ffa90ae413996438076e --- /dev/null +++ b/codenet/public_test_cases/p01317/input.1.txt @@ -0,0 +1,15 @@ +3 3 +1 2 5 L +1 2 7 S +2 3 11 S +3 +1 2 3 +5 5 +1 2 15 L +2 3 10 L +4 5 7 L +1 3 30 S +3 4 100 S +5 +1 3 5 4 1 +0 0 diff --git a/codenet/public_test_cases/p01317/output.0.txt b/codenet/public_test_cases/p01317/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27e9431df7d57586f781b0f7f392722e3191a85a --- /dev/null +++ b/codenet/public_test_cases/p01317/output.0.txt @@ -0,0 +1,2 @@ +18 +269 diff --git a/codenet/public_test_cases/p01317/output.1.txt b/codenet/public_test_cases/p01317/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27e9431df7d57586f781b0f7f392722e3191a85a --- /dev/null +++ b/codenet/public_test_cases/p01317/output.1.txt @@ -0,0 +1,2 @@ +18 +269 diff --git a/codenet/public_test_cases/p01318/input.0.txt b/codenet/public_test_cases/p01318/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6024cfc3322cbd1994bf4d10c3812d97faf5f013 --- /dev/null +++ b/codenet/public_test_cases/p01318/input.0.txt @@ -0,0 +1,22 @@ +6 +-2 -2 1 1 +2 2 2 0 +5 7 1 1 +8 0 3 1 +13 4 1 1 +16 1 1 2 +3 +0 0 2 1 +10 0 2 1 +0 10 2 1 +3 +0 0 2 1 +10 0 2 1 +0 6 2 1 +3 +0 0 2 1 +10 0 2 1 +0 4 2 1 +1 +0 0 1 1 +0 diff --git a/codenet/public_test_cases/p01318/input.1.txt b/codenet/public_test_cases/p01318/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6024cfc3322cbd1994bf4d10c3812d97faf5f013 --- /dev/null +++ b/codenet/public_test_cases/p01318/input.1.txt @@ -0,0 +1,22 @@ +6 +-2 -2 1 1 +2 2 2 0 +5 7 1 1 +8 0 3 1 +13 4 1 1 +16 1 1 2 +3 +0 0 2 1 +10 0 2 1 +0 10 2 1 +3 +0 0 2 1 +10 0 2 1 +0 6 2 1 +3 +0 0 2 1 +10 0 2 1 +0 4 2 1 +1 +0 0 1 1 +0 diff --git a/codenet/public_test_cases/p01318/output.0.txt b/codenet/public_test_cases/p01318/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b3da84cf16d1c98e5101c7fdd8c85099dfa49ef --- /dev/null +++ b/codenet/public_test_cases/p01318/output.0.txt @@ -0,0 +1,5 @@ +4 +2 +3 +3 +1 diff --git a/codenet/public_test_cases/p01318/output.1.txt b/codenet/public_test_cases/p01318/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b3da84cf16d1c98e5101c7fdd8c85099dfa49ef --- /dev/null +++ b/codenet/public_test_cases/p01318/output.1.txt @@ -0,0 +1,5 @@ +4 +2 +3 +3 +1 diff --git a/codenet/public_test_cases/p01319/input.0.txt b/codenet/public_test_cases/p01319/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a04fcc09f0d68e5399dd0d9b30ac59886764088 --- /dev/null +++ b/codenet/public_test_cases/p01319/input.0.txt @@ -0,0 +1,19 @@ +1 1 100 +50 200 20 40 0 +1 +2 4 100 +7 4 1 4 1 +19 5 1 4 0 +5 +3 +7 +9 +1 2 3 +1 1 1 1 0 +1 +3 +1 2 10 +5 10 1 1 1 +2 +3 +0 0 0 diff --git a/codenet/public_test_cases/p01319/input.1.txt b/codenet/public_test_cases/p01319/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a04fcc09f0d68e5399dd0d9b30ac59886764088 --- /dev/null +++ b/codenet/public_test_cases/p01319/input.1.txt @@ -0,0 +1,19 @@ +1 1 100 +50 200 20 40 0 +1 +2 4 100 +7 4 1 4 1 +19 5 1 4 0 +5 +3 +7 +9 +1 2 3 +1 1 1 1 0 +1 +3 +1 2 10 +5 10 1 1 1 +2 +3 +0 0 0 diff --git a/codenet/public_test_cases/p01319/output.0.txt b/codenet/public_test_cases/p01319/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a68c36c32e69b2b0850c8b63cdbb60b38b37fb --- /dev/null +++ b/codenet/public_test_cases/p01319/output.0.txt @@ -0,0 +1,4 @@ +110 +46.6666666667 +5 +41.6666666667 diff --git a/codenet/public_test_cases/p01319/output.1.txt b/codenet/public_test_cases/p01319/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a68c36c32e69b2b0850c8b63cdbb60b38b37fb --- /dev/null +++ b/codenet/public_test_cases/p01319/output.1.txt @@ -0,0 +1,4 @@ +110 +46.6666666667 +5 +41.6666666667 diff --git a/codenet/public_test_cases/p01320/input.0.txt b/codenet/public_test_cases/p01320/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d90f24eaa1ee740a432e5790031db68bf8ffea5a --- /dev/null +++ b/codenet/public_test_cases/p01320/input.0.txt @@ -0,0 +1,12 @@ +4 4 1 +1 0 +0 1 +-1 0 +0 -1 +5 6 2 +1 1 +4 4 +2 -4 +-4 2 +1 5 +0 0 0 diff --git a/codenet/public_test_cases/p01320/input.1.txt b/codenet/public_test_cases/p01320/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d90f24eaa1ee740a432e5790031db68bf8ffea5a --- /dev/null +++ b/codenet/public_test_cases/p01320/input.1.txt @@ -0,0 +1,12 @@ +4 4 1 +1 0 +0 1 +-1 0 +0 -1 +5 6 2 +1 1 +4 4 +2 -4 +-4 2 +1 5 +0 0 0 diff --git a/codenet/public_test_cases/p01320/output.0.txt b/codenet/public_test_cases/p01320/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94557bf9e9b7dbda9533d9090d3890cdf9aac673 --- /dev/null +++ b/codenet/public_test_cases/p01320/output.0.txt @@ -0,0 +1,2 @@ +1.000000000 +6.797434948 diff --git a/codenet/public_test_cases/p01320/output.1.txt b/codenet/public_test_cases/p01320/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94557bf9e9b7dbda9533d9090d3890cdf9aac673 --- /dev/null +++ b/codenet/public_test_cases/p01320/output.1.txt @@ -0,0 +1,2 @@ +1.000000000 +6.797434948 diff --git a/codenet/public_test_cases/p01321/input.0.txt b/codenet/public_test_cases/p01321/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a16d99e67105414cd0deeb30039a9291fea3a25a --- /dev/null +++ b/codenet/public_test_cases/p01321/input.0.txt @@ -0,0 +1,10 @@ +3 +49 50 87 78 41 +27 61 100 45 84 +28 88 40 95 66 +2 +100 100 100 100 100 +0 0 0 0 0 +1 +89 90 85 93 82 +0 diff --git a/codenet/public_test_cases/p01321/input.1.txt b/codenet/public_test_cases/p01321/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a16d99e67105414cd0deeb30039a9291fea3a25a --- /dev/null +++ b/codenet/public_test_cases/p01321/input.1.txt @@ -0,0 +1,10 @@ +3 +49 50 87 78 41 +27 61 100 45 84 +28 88 40 95 66 +2 +100 100 100 100 100 +0 0 0 0 0 +1 +89 90 85 93 82 +0 diff --git a/codenet/public_test_cases/p01321/input.2.txt b/codenet/public_test_cases/p01321/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0ccd4b00dc7ff4ec4bd42d67d461f509b265b41 --- /dev/null +++ b/codenet/public_test_cases/p01321/input.2.txt @@ -0,0 +1,3 @@ +2 +100 100 100 100 100 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01321/input.3.txt b/codenet/public_test_cases/p01321/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..de9426d6e387247bcaf97471859fbc9e015c5f0c --- /dev/null +++ b/codenet/public_test_cases/p01321/input.3.txt @@ -0,0 +1,2 @@ +1 +89 90 85 93 82 diff --git a/codenet/public_test_cases/p01321/input.4.txt b/codenet/public_test_cases/p01321/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e20df62744a6202afee4d72ccf20d3a6ab3fd138 --- /dev/null +++ b/codenet/public_test_cases/p01321/input.4.txt @@ -0,0 +1,4 @@ +3 +49 50 87 78 41 +27 61 100 45 84 +28 88 40 95 66 diff --git a/codenet/public_test_cases/p01321/output.0.txt b/codenet/public_test_cases/p01321/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58d6edc1e0919fe44087ae1a6570c793f08fa87d --- /dev/null +++ b/codenet/public_test_cases/p01321/output.0.txt @@ -0,0 +1,3 @@ +317 305 +500 0 +439 439 diff --git a/codenet/public_test_cases/p01321/output.1.txt b/codenet/public_test_cases/p01321/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58d6edc1e0919fe44087ae1a6570c793f08fa87d --- /dev/null +++ b/codenet/public_test_cases/p01321/output.1.txt @@ -0,0 +1,3 @@ +317 305 +500 0 +439 439 diff --git a/codenet/public_test_cases/p01321/output.2.txt b/codenet/public_test_cases/p01321/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..221202e49da0c4c4be5952b355c2f909d518ff0f --- /dev/null +++ b/codenet/public_test_cases/p01321/output.2.txt @@ -0,0 +1 @@ +500 0 diff --git a/codenet/public_test_cases/p01321/output.3.txt b/codenet/public_test_cases/p01321/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce6ba0b2bdcac285bd25d321c9702ce235bda6b2 --- /dev/null +++ b/codenet/public_test_cases/p01321/output.3.txt @@ -0,0 +1 @@ +439 439 diff --git a/codenet/public_test_cases/p01321/output.4.txt b/codenet/public_test_cases/p01321/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3dc63d64d7260690913c4023fee1c2e79540d7b --- /dev/null +++ b/codenet/public_test_cases/p01321/output.4.txt @@ -0,0 +1 @@ +317 305 diff --git a/codenet/public_test_cases/p01322/input.0.txt b/codenet/public_test_cases/p01322/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..befe663848822a7d08d2b8779868ceca71046eb0 --- /dev/null +++ b/codenet/public_test_cases/p01322/input.0.txt @@ -0,0 +1,29 @@ +3 3 +*******1 100 +******22 1000 +11111112 1000000 +01203291 +02382022 +11111111 +10 10 +****3228 149416 +****3992 198635 +****4286 77783 +****4843 225244 +***49835 231046 +***59393 379996 +*5763748 437345 +*6726222 58054 +*8117882 16375 +*9244339 537727 +77885716 +96726222 +26971031 +66652868 +89599648 +37772338 +64679621 +65479161 +92959393 +57855682 +0 0 diff --git a/codenet/public_test_cases/p01322/input.1.txt b/codenet/public_test_cases/p01322/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..befe663848822a7d08d2b8779868ceca71046eb0 --- /dev/null +++ b/codenet/public_test_cases/p01322/input.1.txt @@ -0,0 +1,29 @@ +3 3 +*******1 100 +******22 1000 +11111112 1000000 +01203291 +02382022 +11111111 +10 10 +****3228 149416 +****3992 198635 +****4286 77783 +****4843 225244 +***49835 231046 +***59393 379996 +*5763748 437345 +*6726222 58054 +*8117882 16375 +*9244339 537727 +77885716 +96726222 +26971031 +66652868 +89599648 +37772338 +64679621 +65479161 +92959393 +57855682 +0 0 diff --git a/codenet/public_test_cases/p01322/input.2.txt b/codenet/public_test_cases/p01322/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4a7a25fbcb1ac66f0f2a36286d30832dc340f07 --- /dev/null +++ b/codenet/public_test_cases/p01322/input.2.txt @@ -0,0 +1,7 @@ +3 3 +*******1 100 +******22 1000 +11111112 1000000 +01203291 +02382022 +11111111 diff --git a/codenet/public_test_cases/p01322/input.3.txt b/codenet/public_test_cases/p01322/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..43a09c89bcea6c9a49b87007529ccc94d08badf8 --- /dev/null +++ b/codenet/public_test_cases/p01322/input.3.txt @@ -0,0 +1,21 @@ +10 10 +****3228 149416 +****3992 198635 +****4286 77783 +****4843 225244 +***49835 231046 +***59393 379996 +*5763748 437345 +*6726222 58054 +*8117882 16375 +*9244339 537727 +77885716 +96726222 +26971031 +66652868 +89599648 +37772338 +64679621 +65479161 +92959393 +57855682 diff --git a/codenet/public_test_cases/p01322/output.0.txt b/codenet/public_test_cases/p01322/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9669651e3a9b60f681ea9e4836efdd365242774 --- /dev/null +++ b/codenet/public_test_cases/p01322/output.0.txt @@ -0,0 +1,2 @@ +1200 +438050 diff --git a/codenet/public_test_cases/p01322/output.1.txt b/codenet/public_test_cases/p01322/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9669651e3a9b60f681ea9e4836efdd365242774 --- /dev/null +++ b/codenet/public_test_cases/p01322/output.1.txt @@ -0,0 +1,2 @@ +1200 +438050 diff --git a/codenet/public_test_cases/p01322/output.2.txt b/codenet/public_test_cases/p01322/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..59a3ec59b53573619be25381cf973b173e2a60ba --- /dev/null +++ b/codenet/public_test_cases/p01322/output.2.txt @@ -0,0 +1 @@ +1200 diff --git a/codenet/public_test_cases/p01322/output.3.txt b/codenet/public_test_cases/p01322/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cef62d58221b55152f330b41ca21b6983e1825e4 --- /dev/null +++ b/codenet/public_test_cases/p01322/output.3.txt @@ -0,0 +1 @@ +438050 diff --git a/codenet/public_test_cases/p01323/input.0.txt b/codenet/public_test_cases/p01323/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa94c4db899cd9fb97f051661124de45aa71bef6 --- /dev/null +++ b/codenet/public_test_cases/p01323/input.0.txt @@ -0,0 +1,37 @@ +3 +...... +...... +...... +...... +...... +...... +...... +...... +.RGB.. +RGOP.. +RGBPB. +RGBPP. +GBRGYP +GBRRYP +BGGRBB +BPRGYY +GGPRRY +BYPPRB +YGGGPB +GYYYPR +YRBRBR +YBRBRB +BRBRBR +BRBRBR +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +..OO.. +..OO.. diff --git a/codenet/public_test_cases/p01323/input.1.txt b/codenet/public_test_cases/p01323/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa94c4db899cd9fb97f051661124de45aa71bef6 --- /dev/null +++ b/codenet/public_test_cases/p01323/input.1.txt @@ -0,0 +1,37 @@ +3 +...... +...... +...... +...... +...... +...... +...... +...... +.RGB.. +RGOP.. +RGBPB. +RGBPP. +GBRGYP +GBRRYP +BGGRBB +BPRGYY +GGPRRY +BYPPRB +YGGGPB +GYYYPR +YRBRBR +YBRBRB +BRBRBR +BRBRBR +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +..OO.. +..OO.. diff --git a/codenet/public_test_cases/p01323/output.0.txt b/codenet/public_test_cases/p01323/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9888c2468189dca538ed5f7c638d2fe24284f9c2 --- /dev/null +++ b/codenet/public_test_cases/p01323/output.0.txt @@ -0,0 +1,3 @@ +3 +18 +0 diff --git a/codenet/public_test_cases/p01323/output.1.txt b/codenet/public_test_cases/p01323/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9888c2468189dca538ed5f7c638d2fe24284f9c2 --- /dev/null +++ b/codenet/public_test_cases/p01323/output.1.txt @@ -0,0 +1,3 @@ +3 +18 +0 diff --git a/codenet/public_test_cases/p01324/input.0.txt b/codenet/public_test_cases/p01324/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..622db439075b561aa0193e01241522831787e5f0 --- /dev/null +++ b/codenet/public_test_cases/p01324/input.0.txt @@ -0,0 +1,23 @@ +3 +1 km = 10^3 m +1 m = 10^2 cm +1 km = 10^5 cm +7 +1 kilometre = 10^3 metre +1 megametre = 10^3 kilometre +1 metre = 10^-6 megametre +1 terametre = 10^3 gigametre +1 petametre = 10^3 terametre +1 gigametre = 10^-6 petametre +1 metre = 10^-15 petametre +4 +1 a = 10^2 b +1 a = 10^3 c +1 b = 10^2 c +1 c = 10^1 d +4 +1 acm = 10^2 icpc +1 icpc = 10^3 utpc +1 utpc = 10^4 topcoder +1 topcoder = 10^-1 acm +0 diff --git a/codenet/public_test_cases/p01324/input.1.txt b/codenet/public_test_cases/p01324/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32650d341d8da62f36a847c927dec674d701ecd7 --- /dev/null +++ b/codenet/public_test_cases/p01324/input.1.txt @@ -0,0 +1,4 @@ +3 +1 km = 10^3 m +1 m = 10^2 cm +1 km = 10^5 cm diff --git a/codenet/public_test_cases/p01324/input.2.txt b/codenet/public_test_cases/p01324/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c10af45022e9fa841f257e7968d324876d62436a --- /dev/null +++ b/codenet/public_test_cases/p01324/input.2.txt @@ -0,0 +1,5 @@ +4 +1 acm = 10^2 icpc +1 icpc = 10^3 utpc +1 utpc = 10^4 topcoder +1 topcoder = 10^-1 acm diff --git a/codenet/public_test_cases/p01324/input.3.txt b/codenet/public_test_cases/p01324/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..71e9ebd763eab48e9083e67ce7d516fd6585b133 --- /dev/null +++ b/codenet/public_test_cases/p01324/input.3.txt @@ -0,0 +1,8 @@ +7 +1 kilometre = 10^3 metre +1 megametre = 10^3 kilometre +1 metre = 10^-6 megametre +1 terametre = 10^3 gigametre +1 petametre = 10^3 terametre +1 gigametre = 10^-6 petametre +1 metre = 10^-15 petametre diff --git a/codenet/public_test_cases/p01324/input.4.txt b/codenet/public_test_cases/p01324/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b89d1c349c3bf6d8fc354ce4de4161bfd5d1648d --- /dev/null +++ b/codenet/public_test_cases/p01324/input.4.txt @@ -0,0 +1,5 @@ +4 +1 a = 10^2 b +1 a = 10^3 c +1 b = 10^2 c +1 c = 10^1 d diff --git a/codenet/public_test_cases/p01324/input.5.txt b/codenet/public_test_cases/p01324/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..622db439075b561aa0193e01241522831787e5f0 --- /dev/null +++ b/codenet/public_test_cases/p01324/input.5.txt @@ -0,0 +1,23 @@ +3 +1 km = 10^3 m +1 m = 10^2 cm +1 km = 10^5 cm +7 +1 kilometre = 10^3 metre +1 megametre = 10^3 kilometre +1 metre = 10^-6 megametre +1 terametre = 10^3 gigametre +1 petametre = 10^3 terametre +1 gigametre = 10^-6 petametre +1 metre = 10^-15 petametre +4 +1 a = 10^2 b +1 a = 10^3 c +1 b = 10^2 c +1 c = 10^1 d +4 +1 acm = 10^2 icpc +1 icpc = 10^3 utpc +1 utpc = 10^4 topcoder +1 topcoder = 10^-1 acm +0 diff --git a/codenet/public_test_cases/p01324/output.0.txt b/codenet/public_test_cases/p01324/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e2693a6a646517947eac7e545ff980e868b191f --- /dev/null +++ b/codenet/public_test_cases/p01324/output.0.txt @@ -0,0 +1,4 @@ +Yes +Yes +No +No diff --git a/codenet/public_test_cases/p01324/output.1.txt b/codenet/public_test_cases/p01324/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01324/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01324/output.2.txt b/codenet/public_test_cases/p01324/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01324/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01324/output.3.txt b/codenet/public_test_cases/p01324/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01324/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01324/output.4.txt b/codenet/public_test_cases/p01324/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01324/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01324/output.5.txt b/codenet/public_test_cases/p01324/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e2693a6a646517947eac7e545ff980e868b191f --- /dev/null +++ b/codenet/public_test_cases/p01324/output.5.txt @@ -0,0 +1,4 @@ +Yes +Yes +No +No diff --git a/codenet/public_test_cases/p01325/input.0.txt b/codenet/public_test_cases/p01325/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be17aba850feaeb5cf834269d1523c5443c9bb69 --- /dev/null +++ b/codenet/public_test_cases/p01325/input.0.txt @@ -0,0 +1,10 @@ +2 +1 2 +2 1 +3 +2 1 2 +2 1 2 +10 +0 1 1 2 5 5 5 8 8 9 +0 1 3 3 3 6 6 6 7 9 +0 diff --git a/codenet/public_test_cases/p01325/input.1.txt b/codenet/public_test_cases/p01325/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..be17aba850feaeb5cf834269d1523c5443c9bb69 --- /dev/null +++ b/codenet/public_test_cases/p01325/input.1.txt @@ -0,0 +1,10 @@ +2 +1 2 +2 1 +3 +2 1 2 +2 1 2 +10 +0 1 1 2 5 5 5 8 8 9 +0 1 3 3 3 6 6 6 7 9 +0 diff --git a/codenet/public_test_cases/p01325/input.2.txt b/codenet/public_test_cases/p01325/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa7d0f0f1e28959d848625a44b83ea744d8ff49d --- /dev/null +++ b/codenet/public_test_cases/p01325/input.2.txt @@ -0,0 +1,3 @@ +10 +0 1 1 2 5 5 5 8 8 9 +0 1 3 3 3 6 6 6 7 9 diff --git a/codenet/public_test_cases/p01325/input.3.txt b/codenet/public_test_cases/p01325/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..df4c71bf55331ba9589f15a71b8c771322bb9597 --- /dev/null +++ b/codenet/public_test_cases/p01325/input.3.txt @@ -0,0 +1,3 @@ +3 +2 1 2 +2 1 2 diff --git a/codenet/public_test_cases/p01325/input.4.txt b/codenet/public_test_cases/p01325/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc5603f7239f6d1e1aed210053e696b76f11df91 --- /dev/null +++ b/codenet/public_test_cases/p01325/input.4.txt @@ -0,0 +1,3 @@ +2 +1 2 +2 1 diff --git a/codenet/public_test_cases/p01325/output.0.txt b/codenet/public_test_cases/p01325/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef5c0439807192f2948a416361d3fec90374dac --- /dev/null +++ b/codenet/public_test_cases/p01325/output.0.txt @@ -0,0 +1,3 @@ +Yes +No +Yes diff --git a/codenet/public_test_cases/p01325/output.1.txt b/codenet/public_test_cases/p01325/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef5c0439807192f2948a416361d3fec90374dac --- /dev/null +++ b/codenet/public_test_cases/p01325/output.1.txt @@ -0,0 +1,3 @@ +Yes +No +Yes diff --git a/codenet/public_test_cases/p01325/output.2.txt b/codenet/public_test_cases/p01325/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01325/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01325/output.3.txt b/codenet/public_test_cases/p01325/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01325/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01325/output.4.txt b/codenet/public_test_cases/p01325/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01325/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01326/input.0.txt b/codenet/public_test_cases/p01326/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc57055ba73724b28e787502610a3e37d067078a --- /dev/null +++ b/codenet/public_test_cases/p01326/input.0.txt @@ -0,0 +1,16 @@ +1 +xxxxxxxx +3 +11100000 +10x00000 +10111111 +3 +11100000 +10000000 +10111111 +4 +xxxxxxxx +xxxxxxxx +xxxxxxxx +xxxxxxxx +0 diff --git a/codenet/public_test_cases/p01326/input.1.txt b/codenet/public_test_cases/p01326/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85cc31978b4aef24f5b8c368ff8ad3b790724ed2 --- /dev/null +++ b/codenet/public_test_cases/p01326/input.1.txt @@ -0,0 +1,2 @@ +1 +xxxxxxxx diff --git a/codenet/public_test_cases/p01326/input.2.txt b/codenet/public_test_cases/p01326/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc57055ba73724b28e787502610a3e37d067078a --- /dev/null +++ b/codenet/public_test_cases/p01326/input.2.txt @@ -0,0 +1,16 @@ +1 +xxxxxxxx +3 +11100000 +10x00000 +10111111 +3 +11100000 +10000000 +10111111 +4 +xxxxxxxx +xxxxxxxx +xxxxxxxx +xxxxxxxx +0 diff --git a/codenet/public_test_cases/p01326/input.3.txt b/codenet/public_test_cases/p01326/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ab018ecfcd548d0c9621ab1fb398c4d38b89c76 --- /dev/null +++ b/codenet/public_test_cases/p01326/input.3.txt @@ -0,0 +1,4 @@ +3 +11100000 +10000000 +10111111 diff --git a/codenet/public_test_cases/p01326/input.4.txt b/codenet/public_test_cases/p01326/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8263f5e9f89377dc64c2bcb6312778c2a0534ce3 --- /dev/null +++ b/codenet/public_test_cases/p01326/input.4.txt @@ -0,0 +1,4 @@ +3 +11100000 +10x00000 +10111111 diff --git a/codenet/public_test_cases/p01326/input.5.txt b/codenet/public_test_cases/p01326/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6b2e745d0d90365e488fe332e0d57e7be1629c6 --- /dev/null +++ b/codenet/public_test_cases/p01326/input.5.txt @@ -0,0 +1,5 @@ +4 +xxxxxxxx +xxxxxxxx +xxxxxxxx +xxxxxxxx diff --git a/codenet/public_test_cases/p01326/output.0.txt b/codenet/public_test_cases/p01326/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5f1ad8af3585b2b9bb6c942ceb52a7574bf2acd --- /dev/null +++ b/codenet/public_test_cases/p01326/output.0.txt @@ -0,0 +1,4 @@ +128 +1 +0 +778240 diff --git a/codenet/public_test_cases/p01326/output.1.txt b/codenet/public_test_cases/p01326/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a949a93dfcca659638ff00284e1d1703accef77a --- /dev/null +++ b/codenet/public_test_cases/p01326/output.1.txt @@ -0,0 +1 @@ +128 diff --git a/codenet/public_test_cases/p01326/output.2.txt b/codenet/public_test_cases/p01326/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5f1ad8af3585b2b9bb6c942ceb52a7574bf2acd --- /dev/null +++ b/codenet/public_test_cases/p01326/output.2.txt @@ -0,0 +1,4 @@ +128 +1 +0 +778240 diff --git a/codenet/public_test_cases/p01326/output.3.txt b/codenet/public_test_cases/p01326/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01326/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01326/output.4.txt b/codenet/public_test_cases/p01326/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01326/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01326/output.5.txt b/codenet/public_test_cases/p01326/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..87dfba2c8c4721d2fff6ff2e0a74d43b4c6b42d6 --- /dev/null +++ b/codenet/public_test_cases/p01326/output.5.txt @@ -0,0 +1 @@ +778240 diff --git a/codenet/public_test_cases/p01327/input.0.txt b/codenet/public_test_cases/p01327/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2cc1186600f8d3bce35926bd021dac9e13c2ba6 --- /dev/null +++ b/codenet/public_test_cases/p01327/input.0.txt @@ -0,0 +1,1244 @@ +3 +7/7 18:30 +3 +Aquila 8 +359.216 -32.936 +358.624 -49.913 +352.155 -43.404 +346.852 -35.279 +345.110 -36.796 +342.448 -44.407 +343.088 -38.981 +336.070 -43.369 +Cygnus 11 +357.838 6.615 +355.808 5.107 +353.475 -18.553 +348.868 -10.771 +347.949 1.298 +344.907 -4.637 +342.909 1.163 +338.483 -9.293 +338.854 -1.786 +338.515 1.304 +331.752 -10.737 +Lyra 4 +5.063 -7.812 +2.708 -13.386 +1.327 -2.841 +0.815 -14.109 +9/3 02:40 +3 +SevenStars 7 +40.483 50.729 +48.968 50.637 +50.421 42.796 +44.855 40.960 +43.493 35.637 +42.111 31.430 +44.997 25.256 +SummerTriangle 3 +342.909 1.163 +345.110 -36.796 +5.063 -7.812 +WinterTriangle 3 +165.368 51.176 +207.400 51.262 +184.960 31.381 +7/7 19:00 +91 +Andromeda 25 +300.224 10.559 +313.114 22.235 +304.593 17.311 +305.145 18.508 +299.557 18.169 +295.825 15.561 +296.928 16.703 +290.573 13.699 +304.020 24.766 +300.872 24.287 +296.636 24.636 +304.470 32.153 +303.783 32.893 +298.697 32.261 +306.181 35.986 +296.619 37.096 +301.005 41.728 +319.394 10.944 +323.303 16.879 +313.853 10.187 +313.295 13.504 +317.463 18.294 +315.012 16.124 +315.502 17.165 +316.369 19.322 +Antila 5 +150.199 5.822 +143.663 11.282 +144.808 2.868 +138.069 2.334 +136.680 -6.080 +Apus 6 +159.498 -45.403 +165.358 -47.196 +157.404 -51.717 +166.529 -52.133 +167.065 -52.812 +162.765 -60.430 +Aquarius 28 +318.790 -48.408 +321.209 -45.287 +318.270 -46.509 +310.269 -47.366 +305.625 -45.668 +308.937 -39.175 +306.021 -39.676 +303.902 -30.310 +293.964 -39.757 +296.515 -33.643 +282.661 -42.871 +299.661 -28.583 +300.287 -26.468 +290.965 -33.635 +281.107 -39.811 +297.231 -25.827 +293.848 -28.361 +279.450 -36.914 +284.435 -32.529 +288.734 -27.776 +281.899 -32.844 +273.078 -34.510 +284.834 -23.654 +282.207 -25.447 +282.043 -24.537 +271.558 -31.463 +273.631 -23.685 +269.813 -26.206 +Aquila 19 +0.874 -31.730 +359.216 -32.936 +358.624 -49.913 +355.895 -52.798 +355.474 -35.099 +353.377 -34.624 +352.155 -43.404 +349.613 -47.552 +349.977 -38.924 +345.808 -53.003 +346.852 -35.279 +339.294 -54.454 +345.110 -36.796 +342.448 -44.407 +343.088 -38.981 +340.624 -37.632 +336.070 -43.369 +340.114 -29.343 +329.215 -43.658 +Ara 8 +139.371 -64.281 +128.988 -67.070 +126.140 -67.495 +133.937 -70.565 +146.948 -68.649 +115.206 -73.448 +124.296 -74.895 +129.807 -78.284 +Aries 16 +275.089 19.700 +277.208 23.346 +277.494 27.270 +273.485 25.417 +269.538 23.135 +277.570 29.777 +272.582 27.036 +270.956 32.094 +275.776 36.366 +274.279 37.296 +262.543 29.989 +266.391 34.798 +273.056 41.891 +263.012 36.658 +263.680 38.088 +262.590 39.297 +Auriga 21 +258.333 63.534 +282.118 68.223 +274.900 67.732 +274.775 68.507 +266.432 68.904 +287.684 71.012 +269.744 70.488 +245.605 69.176 +303.422 75.275 +259.211 76.033 +324.841 73.413 +322.545 74.855 +284.226 78.538 +218.521 73.350 +316.324 81.078 +231.890 84.097 +278.842 87.076 +336.299 83.829 +155.787 85.774 +127.797 86.332 +120.527 85.282 +Bootes 24 +63.869 9.873 +69.774 4.070 +67.862 3.467 +60.529 5.629 +63.774 0.539 +40.081 23.036 +44.262 19.473 +67.421 -4.525 +38.676 22.314 +61.891 -1.179 +53.418 6.177 +47.886 11.938 +53.387 5.299 +42.612 15.477 +64.297 -9.243 +54.097 1.616 +42.092 9.644 +50.239 -1.089 +36.476 15.172 +51.041 -3.111 +44.417 2.429 +40.498 4.563 +37.434 6.614 +36.639 5.466 +Caelum 3 +206.749 -2.707 +206.383 0.705 +207.503 3.802 +Camelopardis 9 +336.366 53.550 +306.868 63.261 +314.379 64.832 +333.859 61.000 +324.283 65.152 +333.999 66.052 +347.170 66.444 +358.133 64.282 +22.412 70.692 +Cancer 14 +152.932 60.247 +141.543 68.586 +149.220 52.365 +129.286 67.634 +139.314 59.869 +141.009 55.655 +133.303 60.477 +128.079 59.843 +131.349 56.985 +116.140 64.655 +132.656 49.904 +105.407 64.702 +130.791 47.655 +118.700 56.309 +CanesVenatici 9 +63.515 33.891 +54.117 37.264 +64.014 31.442 +60.753 31.416 +60.907 26.172 +61.859 23.114 +58.947 24.067 +56.181 24.166 +56.197 23.490 +CanisMajor 12 +189.554 16.222 +191.117 30.052 +187.145 25.454 +184.960 31.381 +182.841 15.253 +182.535 34.807 +180.964 19.769 +180.236 20.737 +179.917 24.636 +179.696 32.436 +178.624 21.184 +175.070 17.938 +CanisMinor 5 +169.498 54.684 +167.330 58.263 +165.368 51.176 +160.497 56.218 +161.829 47.153 +Capricornus 15 +327.283 -54.381 +319.640 -62.109 +327.152 -54.307 +324.725 -55.607 +313.330 -57.369 +302.734 -61.915 +300.239 -61.281 +305.714 -52.841 +295.483 -58.754 +302.466 -49.134 +294.302 -53.161 +297.453 -46.446 +300.104 -41.866 +295.158 -45.704 +296.821 -42.155 +Carina 7 +186.061 -4.875 +171.511 -4.945 +169.452 -13.029 +167.374 -24.125 +162.642 -15.652 +163.244 -28.369 +156.225 -25.313 +Cassiopeia 18 +324.796 30.076 +326.794 34.518 +317.285 30.327 +319.592 32.153 +311.156 28.226 +340.196 40.324 +322.818 35.995 +315.615 34.775 +320.474 39.098 +330.339 41.508 +332.996 42.444 +336.611 43.459 +329.769 42.982 +323.558 43.299 +335.542 45.252 +327.048 45.835 +331.423 27.745 +324.605 27.533 +Centaurus 16 +144.780 -21.358 +151.103 -29.155 +136.031 -24.020 +134.304 -26.850 +128.655 -31.224 +114.889 -26.222 +130.425 -37.948 +109.349 -29.106 +117.349 -34.385 +122.386 -37.770 +137.790 -43.449 +109.153 -34.197 +107.859 -36.848 +112.627 -42.112 +135.878 -47.823 +110.171 -46.148 +Cepheus 16 +355.930 31.338 +349.846 17.598 +347.662 17.057 +344.189 19.225 +347.193 26.771 +346.570 27.967 +340.498 19.415 +339.367 22.048 +345.204 30.053 +335.982 18.661 +334.049 20.245 +349.184 35.742 +344.517 32.277 +336.609 24.983 +337.594 27.709 +345.323 37.813 +Cetus 29 +267.392 -21.962 +272.139 -12.783 +274.115 -7.347 +261.316 -14.311 +265.273 -8.669 +271.035 -2.352 +270.805 1.139 +261.818 -5.639 +260.665 -1.490 +256.455 -4.506 +250.542 -9.105 +252.749 -2.256 +255.205 2.027 +254.630 2.111 +245.181 -4.356 +264.415 18.831 +253.034 9.471 +247.128 6.587 +261.394 21.309 +243.942 5.376 +257.758 20.709 +249.146 12.323 +253.144 17.620 +243.530 9.279 +259.617 25.458 +255.832 27.254 +251.561 24.282 +245.843 22.473 +247.574 26.675 +Chamaeleon 6 +174.828 -30.357 +173.717 -31.227 +167.691 -34.936 +169.124 -36.723 +161.658 -35.846 +165.432 -40.069 +Circinus 2 +141.590 -48.550 +132.085 -52.609 +Columba 6 +202.143 9.996 +197.412 10.578 +195.025 10.858 +193.570 10.680 +191.926 4.413 +189.632 11.237 +ComaBerenices 7 +76.648 24.387 +79.683 19.987 +77.453 20.178 +80.843 17.387 +70.827 20.336 +73.668 13.661 +67.542 17.115 +CoronaAustralis 3 +76.831 -84.408 +72.159 -87.309 +349.050 -82.780 +CoronaBorealis 6 +44.830 -2.520 +42.619 -1.332 +44.991 -5.346 +37.053 0.095 +40.620 -8.046 +33.560 -1.062 +Corvus 4 +114.367 -5.461 +109.900 -2.973 +106.846 -4.729 +111.347 -10.379 +Crater 7 +124.123 8.440 +124.193 3.979 +117.555 8.787 +118.622 5.586 +110.936 9.608 +116.023 1.385 +113.531 0.100 +Crux 4 +142.482 -29.634 +147.192 -33.867 +140.733 -31.246 +140.848 -33.879 +Cygnus 26 +357.838 6.615 +355.808 5.107 +353.475 -18.553 +353.876 -12.067 +354.603 3.708 +351.653 -8.897 +348.868 -10.771 +346.567 -8.538 +350.193 10.869 +347.949 1.298 +344.907 -4.637 +342.557 -7.945 +340.846 -13.795 +342.909 1.163 +338.483 -9.293 +338.854 -1.786 +340.656 4.326 +338.515 1.304 +336.234 -3.364 +331.752 -10.737 +334.609 -1.970 +332.686 -6.040 +335.619 5.437 +334.489 4.935 +331.664 0.559 +334.307 9.233 +Delphinus 5 +333.672 -31.713 +331.571 -32.362 +333.741 -26.848 +332.447 -27.320 +332.054 -26.066 +Dorado 7 +205.464 -10.486 +200.871 -13.113 +196.063 -12.729 +191.203 -21.965 +190.853 -16.249 +188.787 -18.553 +185.561 -20.832 +Draco 28 +28.940 47.754 +32.728 46.686 +27.652 42.406 +32.423 39.207 +30.070 33.592 +29.528 32.232 +26.812 21.591 +22.960 18.431 +14.533 25.591 +12.136 21.124 +13.986 7.554 +8.952 22.630 +12.900 10.242 +12.891 10.228 +8.276 23.088 +6.773 26.220 +4.729 30.713 +9.530 11.119 +10.253 5.765 +5.511 18.022 +3.426 26.157 +1.169 28.661 +1.500 12.613 +0.731 24.504 +358.998 20.874 +358.972 26.573 +353.557 29.067 +356.093 36.356 +Equuleus 2 +323.384 -29.260 +319.354 -32.975 +Eridanus 29 +219.089 -30.779 +223.136 -24.855 +220.757 -22.413 +222.767 -18.286 +226.742 -10.667 +236.404 3.705 +244.644 15.058 +223.094 -9.567 +233.490 4.341 +240.785 18.142 +239.287 22.218 +236.398 19.741 +228.885 10.392 +230.696 13.844 +234.428 21.532 +239.136 27.577 +224.969 10.176 +228.619 20.174 +235.564 30.495 +230.014 28.159 +229.050 32.214 +212.080 4.745 +211.967 9.906 +225.626 33.576 +218.908 24.204 +220.788 30.349 +223.184 34.664 +215.927 35.337 +214.381 33.359 +Fornax 7 +238.898 -9.116 +237.171 -8.220 +240.540 -1.605 +231.177 -8.178 +229.829 -4.623 +224.613 6.412 +221.710 3.538 +Gemini 22 +215.932 66.683 +204.877 67.736 +199.742 65.953 +193.146 62.679 +193.518 71.530 +188.373 59.467 +192.635 80.565 +180.202 71.018 +179.143 67.371 +174.375 62.866 +171.813 63.143 +168.932 68.478 +161.323 73.914 +153.261 77.453 +148.264 77.059 +154.841 72.360 +152.127 69.337 +146.998 72.565 +156.258 63.667 +134.440 76.874 +143.773 70.603 +136.491 70.307 +Grus 10 +266.639 -56.891 +261.892 -55.418 +250.399 -57.109 +258.350 -51.534 +252.761 -52.750 +247.501 -51.272 +238.441 -51.698 +236.933 -49.917 +245.584 -46.524 +235.380 -46.029 +Hercules 31 +33.142 5.662 +43.844 -17.673 +29.344 6.259 +26.982 6.515 +39.748 -17.544 +45.996 -28.329 +41.678 -22.405 +36.788 -16.433 +26.483 1.894 +22.911 7.383 +26.485 -1.995 +30.710 -15.768 +27.551 -9.426 +26.391 -10.747 +25.126 -8.401 +32.749 -27.966 +25.531 -17.599 +21.385 -6.334 +21.711 -10.815 +15.742 3.862 +21.581 -17.539 +14.288 1.096 +17.591 -16.951 +15.964 -19.046 +13.290 -8.148 +14.702 -16.037 +17.081 -28.351 +12.616 -16.934 +9.946 -24.416 +4.443 -26.136 +4.239 -28.516 +Horologium 4 +212.195 -27.502 +215.685 -21.711 +209.563 -22.898 +210.127 -2.984 +Hydra 24 +143.985 47.058 +145.069 44.803 +151.923 30.938 +145.140 38.337 +138.169 45.241 +135.092 39.726 +136.675 32.126 +137.556 29.724 +130.493 33.636 +138.050 22.682 +132.130 20.111 +130.180 20.428 +129.080 15.379 +131.778 8.535 +124.835 11.440 +128.852 0.658 +126.517 -5.926 +127.538 -9.245 +104.527 -18.245 +98.485 -25.440 +99.975 -26.915 +99.280 -28.259 +98.943 -34.064 +93.274 -36.105 +Hydrus 11 +198.297 -43.876 +202.979 -41.907 +208.163 -34.122 +213.775 -30.545 +205.448 -32.460 +200.398 -35.209 +193.118 -38.207 +203.866 -31.341 +200.214 -31.329 +193.659 -34.973 +194.307 -31.540 +Indus 7 +249.907 -72.922 +239.450 -71.406 +220.919 -67.358 +206.717 -56.713 +235.616 -59.690 +231.364 -58.806 +207.454 -50.856 +Lacerta 4 +330.868 14.794 +328.679 13.927 +320.762 5.716 +321.696 8.482 +Leo 27 +108.913 56.585 +123.339 44.644 +122.115 42.133 +99.000 55.511 +117.773 44.879 +106.792 51.358 +102.424 51.543 +118.908 37.713 +109.440 42.916 +113.660 39.315 +100.430 45.670 +106.478 36.782 +110.515 33.255 +99.191 37.449 +106.077 31.291 +109.303 24.383 +105.551 26.268 +109.300 22.087 +92.537 33.471 +97.094 30.159 +110.548 17.282 +103.478 22.505 +104.608 19.066 +104.441 16.037 +87.023 27.107 +91.610 23.269 +89.591 22.768 +LeoMinor 9 +90.267 60.380 +78.517 57.855 +92.724 53.388 +86.200 50.349 +81.581 50.769 +86.265 46.546 +95.468 40.706 +86.698 44.569 +81.288 45.027 +Lepus 9 +208.923 19.793 +209.526 25.864 +209.073 29.219 +204.435 23.896 +204.385 27.140 +199.741 22.797 +201.635 31.020 +198.720 25.558 +198.849 30.984 +Libra 16 +81.767 -29.125 +83.418 -30.457 +77.768 -27.899 +74.449 -26.474 +89.322 -38.371 +81.462 -35.785 +72.163 -30.079 +75.587 -36.700 +69.669 -33.980 +72.203 -36.540 +86.964 -46.207 +75.625 -41.168 +74.720 -44.181 +67.649 -40.782 +68.788 -42.391 +61.765 -36.662 +Lupus 11 +117.171 -41.790 +118.068 -45.036 +111.531 -46.416 +116.593 -50.101 +123.695 -51.230 +93.851 -43.568 +104.221 -48.998 +99.276 -47.504 +98.305 -47.468 +90.274 -51.170 +91.817 -55.374 +Lynx 10 +340.957 72.851 +350.646 71.341 +13.353 77.484 +18.414 73.281 +59.902 79.893 +47.406 76.156 +83.141 75.429 +72.888 72.348 +78.567 66.265 +96.482 61.871 +Lyra 7 +8.778 -10.140 +5.063 -7.812 +2.708 -13.386 +1.327 -2.841 +0.815 -14.109 +359.054 -10.696 +357.282 -8.610 +Mensa 7 +188.214 -35.195 +193.058 -25.199 +190.066 -28.325 +185.361 -35.800 +186.324 -29.775 +184.202 -26.795 +181.257 -32.429 +Microscopium 5 +264.385 -70.579 +286.221 -64.016 +274.073 -66.473 +281.802 -61.120 +266.935 -63.909 +Monoceros 11 +193.937 39.673 +195.344 50.445 +191.879 42.909 +192.497 53.543 +187.013 55.210 +185.664 49.081 +177.432 43.009 +176.624 47.247 +168.308 42.271 +167.934 37.614 +160.433 42.707 +Musca 5 +152.442 -31.405 +156.829 -38.365 +153.135 -37.536 +154.045 -40.135 +148.162 -39.941 +Norma 3 +108.500 -58.666 +125.170 -60.575 +117.887 -61.581 +Octans 13 +198.046 -45.252 +176.567 -38.166 +173.012 -42.811 +172.072 -43.886 +172.730 -47.145 +179.818 -46.801 +191.207 -53.945 +182.212 -45.697 +194.137 -52.731 +192.192 -49.399 +186.876 -46.654 +191.609 -47.909 +184.474 -44.508 +Ophiuchus 20 +54.470 -34.618 +54.219 -36.013 +48.446 -37.238 +54.066 -43.720 +50.326 -45.370 +36.864 -29.115 +36.334 -30.222 +43.032 -42.256 +53.910 -61.019 +53.402 -62.293 +31.010 -37.921 +59.681 -65.616 +25.109 -30.741 +42.187 -61.743 +25.758 -38.990 +25.154 -41.103 +26.385 -52.352 +20.997 -41.799 +16.895 -35.752 +14.223 -42.479 +Orion 20 +228.557 43.501 +227.159 42.547 +233.926 49.831 +224.091 40.245 +231.313 52.497 +224.916 48.508 +212.650 33.396 +213.079 36.124 +214.760 41.605 +217.291 47.355 +211.550 42.550 +216.105 51.230 +208.390 38.774 +209.681 41.921 +203.047 35.727 +207.400 51.262 +202.907 45.028 +202.227 48.919 +206.751 59.217 +201.381 57.499 +Pavo 10 +157.654 -67.059 +164.415 -71.696 +176.459 -62.514 +176.133 -71.320 +189.680 -61.203 +196.371 -65.611 +220.726 -71.988 +203.251 -63.374 +200.903 -58.638 +210.828 -60.620 +Pegasus 31 +289.423 1.639 +292.789 5.389 +325.271 -19.328 +325.355 -15.082 +321.576 -18.057 +315.029 -25.454 +309.887 -31.091 +324.502 -7.231 +321.746 -10.569 +313.113 -20.498 +318.709 -9.439 +322.477 -2.549 +322.345 -2.460 +306.855 -24.931 +308.208 -18.427 +304.677 -19.779 +318.503 -0.637 +303.255 -16.572 +314.882 -0.922 +310.240 -4.458 +309.992 0.187 +301.577 -9.597 +297.306 -13.646 +295.935 -13.393 +304.294 -0.680 +309.331 6.413 +303.256 -0.214 +295.450 -7.529 +295.715 0.944 +290.000 -4.903 +299.060 6.102 +Perseus 24 +307.992 37.714 +307.408 38.982 +311.185 41.765 +294.837 44.540 +301.426 46.254 +310.678 48.794 +305.863 48.704 +281.711 43.164 +306.515 50.399 +285.480 45.931 +287.939 47.329 +300.332 50.249 +299.861 52.709 +296.472 53.324 +295.380 55.305 +286.455 54.355 +269.053 51.499 +280.841 55.738 +273.943 54.251 +299.144 59.485 +293.899 59.557 +295.040 60.674 +268.445 57.603 +282.731 62.992 +Phoenix 9 +240.413 -36.726 +241.278 -32.781 +234.988 -34.724 +235.320 -32.610 +223.631 -37.224 +233.002 -23.838 +227.369 -22.186 +247.359 -41.041 +233.157 -41.238 +Pictor 5 +199.115 -5.204 +196.549 -5.314 +190.277 -10.223 +187.892 -6.886 +181.859 -13.299 +Pisces 30 +276.084 -15.147 +276.760 -13.373 +283.165 -1.965 +277.824 -5.444 +287.819 5.104 +277.923 2.647 +284.761 9.075 +292.714 18.557 +275.728 5.436 +280.618 10.596 +284.273 15.764 +291.602 21.582 +273.667 7.181 +270.057 5.224 +288.083 21.157 +280.421 17.307 +276.573 15.617 +273.154 14.509 +267.381 10.808 +269.460 14.019 +263.563 11.435 +294.064 -18.352 +291.117 -16.513 +287.818 -16.306 +291.268 -12.413 +288.534 -10.905 +285.402 -13.291 +282.129 -14.379 +279.313 -13.299 +285.935 -6.652 +PiscesAustrinus 8 +278.189 -58.674 +274.140 -56.842 +272.659 -51.571 +277.649 -47.812 +267.833 -47.693 +271.890 -43.451 +267.416 -41.162 +260.978 -42.711 +Puppis 9 +184.580 3.817 +182.079 -2.625 +177.070 9.833 +175.119 3.899 +167.505 32.508 +168.381 22.802 +168.339 5.677 +164.057 21.464 +160.076 30.354 +Pyxis 4 +158.634 10.564 +154.957 16.224 +152.121 11.537 +147.334 15.581 +Reticulum 5 +204.908 -22.855 +201.994 -23.451 +202.121 -20.347 +199.887 -20.103 +198.493 -20.590 +Sagitta 3 +349.566 -28.691 +348.056 -27.420 +345.286 -25.999 +Sagittarius 25 +48.012 -67.119 +44.526 -72.258 +28.519 -65.511 +51.339 -78.206 +32.619 -72.785 +41.334 -77.820 +23.740 -70.063 +12.238 -71.480 +5.559 -72.441 +3.057 -67.672 +356.728 -73.111 +355.646 -67.730 +351.935 -63.658 +350.579 -60.563 +262.868 -86.361 +312.000 -84.491 +337.993 -68.724 +340.644 -61.337 +339.682 -61.389 +336.325 -63.392 +282.888 -79.729 +333.366 -58.963 +302.710 -76.078 +319.336 -69.154 +268.021 -75.299 +Scorpius 14 +80.363 -49.004 +74.835 -46.432 +70.299 -45.175 +73.601 -52.052 +73.114 -54.227 +74.595 -56.737 +80.967 -62.586 +89.217 -64.779 +98.307 -69.868 +77.481 -71.296 +77.193 -71.890 +89.403 -74.055 +81.163 -74.348 +83.072 -75.589 +Sculptor 11 +258.000 -26.547 +249.899 -31.550 +243.095 -27.647 +248.893 -19.849 +246.841 -20.340 +240.080 -14.665 +244.594 -9.531 +260.749 -39.021 +253.603 -38.949 +257.110 -35.369 +259.902 -31.592 +Scutum 5 +16.148 -59.376 +11.653 -54.049 +8.921 -55.461 +8.156 -54.279 +6.023 -49.906 +Serpens 13 +62.443 -19.751 +53.456 -13.220 +55.387 -23.131 +49.361 -16.131 +47.238 -14.241 +60.461 -31.027 +55.246 -25.667 +47.088 -17.328 +50.255 -33.010 +39.013 -56.091 +15.238 -46.901 +11.969 -46.189 +2.194 -42.577 +SevenStars 7 +40.483 50.729 +48.968 50.637 +50.421 42.796 +44.855 40.960 +43.493 35.637 +42.111 31.430 +44.997 25.256 +Sextans 5 +129.626 29.644 +126.345 22.444 +122.446 24.760 +119.299 25.894 +119.015 18.085 +SummerTriangle 3 +342.909 1.163 +345.110 -36.796 +5.063 -7.812 +Taurus 27 +250.893 31.722 +250.982 32.632 +252.943 35.539 +241.685 27.325 +261.126 45.412 +244.002 33.045 +260.593 45.877 +260.194 46.146 +245.956 40.306 +239.935 35.811 +254.646 47.658 +250.907 46.787 +258.577 51.508 +239.262 40.001 +244.242 45.761 +245.368 47.668 +245.642 49.782 +239.805 47.440 +240.886 49.021 +246.413 54.695 +238.949 53.205 +238.548 57.087 +240.905 65.777 +226.104 57.692 +225.532 61.707 +217.863 59.965 +227.613 69.046 +Telescopium 6 +99.632 -80.656 +100.423 -83.483 +175.148 -82.103 +227.583 -82.622 +206.443 -75.581 +228.471 -76.495 +Triangulum 5 +285.165 28.434 +288.118 34.349 +285.904 35.093 +280.102 34.723 +286.401 38.875 +TriangulumAustrale 6 +148.672 -52.090 +146.607 -54.162 +142.070 -56.831 +142.826 -59.157 +156.860 -56.997 +157.390 -58.985 +Tucana 6 +216.837 -42.185 +208.705 -40.221 +217.821 -35.934 +223.308 -56.356 +226.434 -48.712 +215.737 -44.634 +UrsaMajor 29 +29.282 68.109 +66.378 69.195 +22.970 60.853 +68.864 68.465 +34.212 60.841 +58.080 63.568 +23.054 57.220 +43.463 59.925 +73.296 55.002 +33.894 55.376 +75.061 53.630 +50.113 54.941 +48.195 54.330 +72.518 46.730 +48.968 50.637 +40.483 50.729 +65.995 46.548 +79.010 39.942 +73.034 42.329 +65.674 42.568 +74.681 36.517 +58.506 41.892 +50.421 42.796 +44.855 40.960 +42.300 39.601 +36.409 39.726 +43.493 35.637 +42.111 31.430 +44.997 25.256 +UrsaMinor 10 +359.062 43.472 +15.334 38.584 +16.704 36.737 +17.194 34.620 +17.526 31.442 +11.304 34.699 +11.341 32.253 +11.030 31.917 +5.554 36.468 +1.714 40.033 +Vela 5 +168.619 -1.071 +164.855 -6.629 +157.488 -0.252 +160.372 -12.557 +155.025 -13.588 +Virgo 33 +98.539 18.430 +101.244 14.256 +95.800 15.774 +93.423 16.427 +96.882 8.238 +94.860 9.978 +97.474 1.850 +98.384 0.141 +86.005 10.761 +87.288 8.349 +97.602 -4.270 +88.734 3.618 +92.116 -0.944 +82.053 7.572 +92.018 -4.372 +83.466 1.036 +100.540 -14.806 +94.167 -11.471 +94.253 -12.053 +75.583 4.802 +81.944 -3.198 +84.072 -5.412 +87.744 -9.129 +88.703 -12.071 +94.791 -18.290 +95.548 -20.598 +78.670 -9.609 +85.118 -19.408 +81.691 -17.430 +86.326 -22.486 +76.304 -16.663 +75.459 -21.104 +70.253 -17.188 +Volans 6 +181.087 -22.253 +179.426 -22.704 +178.481 -19.274 +176.577 -24.804 +171.114 -20.237 +167.223 -21.251 +Vulpecula 7 +353.634 -21.875 +350.153 -20.389 +346.451 -17.791 +342.107 -20.025 +335.915 -21.936 +334.725 -14.255 +331.735 -19.292 +WinterTriangle 3 +165.368 51.176 +207.400 51.262 +184.960 31.381 diff --git a/codenet/public_test_cases/p01327/output.0.txt b/codenet/public_test_cases/p01327/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..79693f8d5cd5afdfe32332b5da5551978adec360 --- /dev/null +++ b/codenet/public_test_cases/p01327/output.0.txt @@ -0,0 +1,36 @@ +Cygnus +Lyra +SevenStars +SummerTriangle +WinterTriangle +Bootes +Camelopardis +Cancer +CanesVenatici +Cassiopeia +Cepheus +ComaBerenices +CoronaBorealis +Corvus +Crater +Cygnus +Delphinus +Draco +Hercules +Lacerta +Leo +LeoMinor +Libra +Lynx +Lyra +Ophiuchus +Sagitta +Scutum +Serpens +SevenStars +Sextans +SummerTriangle +UrsaMajor +UrsaMinor +Virgo +Vulpecula diff --git a/codenet/public_test_cases/p01328/input.0.txt b/codenet/public_test_cases/p01328/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e3be6a6a5eafc19956def07cfaa3346fbe2d5be --- /dev/null +++ b/codenet/public_test_cases/p01328/input.0.txt @@ -0,0 +1,2 @@ +N M +x diff --git a/codenet/public_test_cases/p01328/input.1.txt b/codenet/public_test_cases/p01328/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9779a780efa8cf17af0a35007bed9ca38ded1fef --- /dev/null +++ b/codenet/public_test_cases/p01328/input.1.txt @@ -0,0 +1,19 @@ +3 3 +-1 1 1 +0 1 1 +1 1 1 +-3 +0 +3 +5 5 +7 3 5 +-9 2 7 +4 9 6 +10 5 9 +-9 7 9 +0 +-1 +-2 +-9 +-8 +0 0 diff --git a/codenet/public_test_cases/p01328/output.0.txt b/codenet/public_test_cases/p01328/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad91b58948dceb1b8ddbbef65f18bfea2ed50baf --- /dev/null +++ b/codenet/public_test_cases/p01328/output.0.txt @@ -0,0 +1,2 @@ +2 +20 diff --git a/codenet/public_test_cases/p01328/output.1.txt b/codenet/public_test_cases/p01328/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad91b58948dceb1b8ddbbef65f18bfea2ed50baf --- /dev/null +++ b/codenet/public_test_cases/p01328/output.1.txt @@ -0,0 +1,2 @@ +2 +20 diff --git a/codenet/public_test_cases/p01329/input.0.txt b/codenet/public_test_cases/p01329/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be29a115d69e1261001dd64f72be0a111980c662 --- /dev/null +++ b/codenet/public_test_cases/p01329/input.0.txt @@ -0,0 +1,55 @@ +7 6 +...... +.####. +.####. +...S#. +...##. +...##. +.....G +3 +LD +DD +LLL +7 8 +S#...... +.#.####. +.#.#G.#. +.#.##.#. +.#....#. +.######. +........ +8 +DDDD +DDDU +UUUU +UUUD +RRRR +RRRL +LLLL +LLLR +3 8 +######## +S......G +######## +2 +U +D +6 10 +.......... +.S........ +.......... +.......... +........G. +.......... +0 +6 7 +....... +...#... +...#.S. +...###. +.G..... +....... +2 +LL +DD +0 0 diff --git a/codenet/public_test_cases/p01329/input.1.txt b/codenet/public_test_cases/p01329/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e720005d77d993bdbbf6c17e34766306976a03c --- /dev/null +++ b/codenet/public_test_cases/p01329/input.1.txt @@ -0,0 +1,10 @@ +6 7 +....... +...#... +...#.S. +...###. +.G..... +....... +2 +LL +DD diff --git a/codenet/public_test_cases/p01329/input.2.txt b/codenet/public_test_cases/p01329/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a710d7482cbb11c0ee13b73a2929cb91c113f334 --- /dev/null +++ b/codenet/public_test_cases/p01329/input.2.txt @@ -0,0 +1,55 @@ +7 6 +...... +.####. +.####. +...S#. +...##. +...##. +.....G +3 +LD +DD +LLL +7 8 +S#...... +.#.####. +.#.#G.#. +.#.##.#. +.#....#. +.######. +........ +8 +DDDD +DDDU +UUUU +UUUD +RRRR +RRRL +LLLL +LLLR +3 8 + +S......G + +2 +U +D +6 10 +.......... +.S........ +.......... +.......... +........G. +.......... +0 +6 7 +....... +...#... +...#.S. +...###. +.G..... +....... +2 +LL +DD +0 0 diff --git a/codenet/public_test_cases/p01329/input.3.txt b/codenet/public_test_cases/p01329/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..95a6903f4bd696e9d2336228d342af49a0e4d75c --- /dev/null +++ b/codenet/public_test_cases/p01329/input.3.txt @@ -0,0 +1,7 @@ +3 8 + +S......G + +2 +U +D diff --git a/codenet/public_test_cases/p01329/input.4.txt b/codenet/public_test_cases/p01329/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..003e54755b4b7af281238281cc5f687bc025fe12 --- /dev/null +++ b/codenet/public_test_cases/p01329/input.4.txt @@ -0,0 +1,8 @@ +6 10 +.......... +.S........ +.......... +.......... +........G. +.......... +0 diff --git a/codenet/public_test_cases/p01329/input.5.txt b/codenet/public_test_cases/p01329/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..be29a115d69e1261001dd64f72be0a111980c662 --- /dev/null +++ b/codenet/public_test_cases/p01329/input.5.txt @@ -0,0 +1,55 @@ +7 6 +...... +.####. +.####. +...S#. +...##. +...##. +.....G +3 +LD +DD +LLL +7 8 +S#...... +.#.####. +.#.#G.#. +.#.##.#. +.#....#. +.######. +........ +8 +DDDD +DDDU +UUUU +UUUD +RRRR +RRRL +LLLL +LLLR +3 8 +######## +S......G +######## +2 +U +D +6 10 +.......... +.S........ +.......... +.......... +........G. +.......... +0 +6 7 +....... +...#... +...#.S. +...###. +.G..... +....... +2 +LL +DD +0 0 diff --git a/codenet/public_test_cases/p01329/input.6.txt b/codenet/public_test_cases/p01329/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a44e07f02170c8155edf91d56d7d48321f8beb7 --- /dev/null +++ b/codenet/public_test_cases/p01329/input.6.txt @@ -0,0 +1,12 @@ +7 6 +...... +.####. +.####. +...S#. +...##. +...##. +.....G +3 +LD +DD +LLL diff --git a/codenet/public_test_cases/p01329/input.7.txt b/codenet/public_test_cases/p01329/input.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..b79927109448d4557ece4c7e6a1b41b681f13015 --- /dev/null +++ b/codenet/public_test_cases/p01329/input.7.txt @@ -0,0 +1,17 @@ +7 8 +S#...... +.#.####. +.#.#G.#. +.#.##.#. +.#....#. +.######. +........ +8 +DDDD +DDDU +UUUU +UUUD +RRRR +RRRL +LLLL +LLLR diff --git a/codenet/public_test_cases/p01329/output.0.txt b/codenet/public_test_cases/p01329/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..872819c586afb4f9fdf57820b12c83635446b897 --- /dev/null +++ b/codenet/public_test_cases/p01329/output.0.txt @@ -0,0 +1,5 @@ +13 +60 +7 +10 +-1 diff --git a/codenet/public_test_cases/p01329/output.1.txt b/codenet/public_test_cases/p01329/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01329/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01329/output.2.txt b/codenet/public_test_cases/p01329/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..872819c586afb4f9fdf57820b12c83635446b897 --- /dev/null +++ b/codenet/public_test_cases/p01329/output.2.txt @@ -0,0 +1,5 @@ +13 +60 +7 +10 +-1 diff --git a/codenet/public_test_cases/p01329/output.3.txt b/codenet/public_test_cases/p01329/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01329/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01329/output.4.txt b/codenet/public_test_cases/p01329/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01329/output.4.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01329/output.5.txt b/codenet/public_test_cases/p01329/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..872819c586afb4f9fdf57820b12c83635446b897 --- /dev/null +++ b/codenet/public_test_cases/p01329/output.5.txt @@ -0,0 +1,5 @@ +13 +60 +7 +10 +-1 diff --git a/codenet/public_test_cases/p01329/output.6.txt b/codenet/public_test_cases/p01329/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p01329/output.6.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p01329/output.7.txt b/codenet/public_test_cases/p01329/output.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p01329/output.7.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p01330/input.0.txt b/codenet/public_test_cases/p01330/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9001471f93e7185932171d308c3585ae8a95963f --- /dev/null +++ b/codenet/public_test_cases/p01330/input.0.txt @@ -0,0 +1,5 @@ +2 3 +1 2 1 +2 3 +1 2 6 +0 0 diff --git a/codenet/public_test_cases/p01330/input.1.txt b/codenet/public_test_cases/p01330/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4253ee1f6ffb341f375e06f12aee6c563dfa8636 --- /dev/null +++ b/codenet/public_test_cases/p01330/input.1.txt @@ -0,0 +1,2 @@ +2 3 +1 2 6 diff --git a/codenet/public_test_cases/p01330/input.2.txt b/codenet/public_test_cases/p01330/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9001471f93e7185932171d308c3585ae8a95963f --- /dev/null +++ b/codenet/public_test_cases/p01330/input.2.txt @@ -0,0 +1,5 @@ +2 3 +1 2 1 +2 3 +1 2 6 +0 0 diff --git a/codenet/public_test_cases/p01330/input.3.txt b/codenet/public_test_cases/p01330/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a42365b17a2f576124c939eb2f9a504e78c7f4ff --- /dev/null +++ b/codenet/public_test_cases/p01330/input.3.txt @@ -0,0 +1,2 @@ +2 3 +1 2 1 diff --git a/codenet/public_test_cases/p01330/output.0.txt b/codenet/public_test_cases/p01330/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p01330/output.0.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p01330/output.1.txt b/codenet/public_test_cases/p01330/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01330/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01330/output.2.txt b/codenet/public_test_cases/p01330/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p01330/output.2.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p01330/output.3.txt b/codenet/public_test_cases/p01330/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01330/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01331/input.0.txt b/codenet/public_test_cases/p01331/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..49f0e4e9c7c651f53c416f16cebe0e06e1c80ecb --- /dev/null +++ b/codenet/public_test_cases/p01331/input.0.txt @@ -0,0 +1,15 @@ +4 4 1 +2 2 3 3 +1 4 1 +1 2 1 3 +5 5 2 +2 2 3 4 +3 3 5 3 +5 5 3 +4 4 5 5 +2 2 3 3 +3 3 4 4 +100000 100000 1 +2 2 99999 99999 +1 1 0 +0 0 0 diff --git a/codenet/public_test_cases/p01331/input.1.txt b/codenet/public_test_cases/p01331/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..936f0031f4d6c7409652246e16cb6bbaafe67506 --- /dev/null +++ b/codenet/public_test_cases/p01331/input.1.txt @@ -0,0 +1 @@ +1 1 0 diff --git a/codenet/public_test_cases/p01331/input.2.txt b/codenet/public_test_cases/p01331/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c685a9c869e1dc0c3735e628699d81848709b816 --- /dev/null +++ b/codenet/public_test_cases/p01331/input.2.txt @@ -0,0 +1,4 @@ +5 5 3 +4 4 5 5 +2 2 3 3 +3 3 4 4 diff --git a/codenet/public_test_cases/p01331/input.3.txt b/codenet/public_test_cases/p01331/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..42f7018c36fb6e567334e4b981f5080f7c46484a --- /dev/null +++ b/codenet/public_test_cases/p01331/input.3.txt @@ -0,0 +1,2 @@ +1 4 1 +1 2 1 3 diff --git a/codenet/public_test_cases/p01331/input.4.txt b/codenet/public_test_cases/p01331/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9bbbf6f72e27c355b56910f15e1be17c9e64301 --- /dev/null +++ b/codenet/public_test_cases/p01331/input.4.txt @@ -0,0 +1,2 @@ +4 4 1 +2 2 3 3 diff --git a/codenet/public_test_cases/p01331/input.5.txt b/codenet/public_test_cases/p01331/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..49f0e4e9c7c651f53c416f16cebe0e06e1c80ecb --- /dev/null +++ b/codenet/public_test_cases/p01331/input.5.txt @@ -0,0 +1,15 @@ +4 4 1 +2 2 3 3 +1 4 1 +1 2 1 3 +5 5 2 +2 2 3 4 +3 3 5 3 +5 5 3 +4 4 5 5 +2 2 3 3 +3 3 4 4 +100000 100000 1 +2 2 99999 99999 +1 1 0 +0 0 0 diff --git a/codenet/public_test_cases/p01331/input.6.txt b/codenet/public_test_cases/p01331/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a2f1a3632686e6d52f1d9d5285164a575265b07 --- /dev/null +++ b/codenet/public_test_cases/p01331/input.6.txt @@ -0,0 +1,2 @@ +100000 100000 1 +2 2 99999 99999 diff --git a/codenet/public_test_cases/p01331/input.7.txt b/codenet/public_test_cases/p01331/input.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..26e9039785d22d4f0a86891236d863dfe6eb5569 --- /dev/null +++ b/codenet/public_test_cases/p01331/input.7.txt @@ -0,0 +1,3 @@ +5 5 2 +2 2 3 4 +3 3 5 3 diff --git a/codenet/public_test_cases/p01331/output.0.txt b/codenet/public_test_cases/p01331/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d79b1c1a0127e283cabc7cd2ff2030b275619d3 --- /dev/null +++ b/codenet/public_test_cases/p01331/output.0.txt @@ -0,0 +1,6 @@ +12 +1 +26 +18 +615667476 +1 diff --git a/codenet/public_test_cases/p01331/output.1.txt b/codenet/public_test_cases/p01331/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01331/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01331/output.2.txt b/codenet/public_test_cases/p01331/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p01331/output.2.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p01331/output.3.txt b/codenet/public_test_cases/p01331/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01331/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01331/output.4.txt b/codenet/public_test_cases/p01331/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p01331/output.4.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p01331/output.5.txt b/codenet/public_test_cases/p01331/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d79b1c1a0127e283cabc7cd2ff2030b275619d3 --- /dev/null +++ b/codenet/public_test_cases/p01331/output.5.txt @@ -0,0 +1,6 @@ +12 +1 +26 +18 +615667476 +1 diff --git a/codenet/public_test_cases/p01331/output.6.txt b/codenet/public_test_cases/p01331/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..9dc35b67c9c40bb3c7d6c47b3ddbd9ee312a4581 --- /dev/null +++ b/codenet/public_test_cases/p01331/output.6.txt @@ -0,0 +1 @@ +615667476 diff --git a/codenet/public_test_cases/p01331/output.7.txt b/codenet/public_test_cases/p01331/output.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p01331/output.7.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p01332/input.0.txt b/codenet/public_test_cases/p01332/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee5f8162f5b0e1d46b64f1e6ba249575b9976987 --- /dev/null +++ b/codenet/public_test_cases/p01332/input.0.txt @@ -0,0 +1,47 @@ +4 +0 0 +100 0 +100 100 +0 100 +4 +0 0 +100 0 +100 100 +0 100 +4 +0 0 +100 0 +100 100 +0 100 +3 +0 0 +100 0 +0 100 +3 +0 0 +100 0 +0 100 +3 +0 0 +100 0 +0 100 +5 +0 0 +200 0 +200 200 +100 100 +0 200 +5 +0 0 +200 0 +100 100 +200 200 +0 200 +4 +0 0 +200 0 +200 200 +0 200 +0 +0 +0 diff --git a/codenet/public_test_cases/p01332/input.1.txt b/codenet/public_test_cases/p01332/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee5f8162f5b0e1d46b64f1e6ba249575b9976987 --- /dev/null +++ b/codenet/public_test_cases/p01332/input.1.txt @@ -0,0 +1,47 @@ +4 +0 0 +100 0 +100 100 +0 100 +4 +0 0 +100 0 +100 100 +0 100 +4 +0 0 +100 0 +100 100 +0 100 +3 +0 0 +100 0 +0 100 +3 +0 0 +100 0 +0 100 +3 +0 0 +100 0 +0 100 +5 +0 0 +200 0 +200 200 +100 100 +0 200 +5 +0 0 +200 0 +100 100 +200 200 +0 200 +4 +0 0 +200 0 +200 200 +0 200 +0 +0 +0 diff --git a/codenet/public_test_cases/p01332/input.2.txt b/codenet/public_test_cases/p01332/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..263caae33fa64ccf96ed62483bf46d90f99e3a14 --- /dev/null +++ b/codenet/public_test_cases/p01332/input.2.txt @@ -0,0 +1,15 @@ +4 +0 0 +100 0 +100 100 +0 100 +4 +0 0 +100 0 +100 100 +0 100 +4 +0 0 +100 0 +100 100 +0 100 diff --git a/codenet/public_test_cases/p01332/input.3.txt b/codenet/public_test_cases/p01332/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..49f271386b97de0f965f3ccbf9a167829afe1a2a --- /dev/null +++ b/codenet/public_test_cases/p01332/input.3.txt @@ -0,0 +1,17 @@ +5 +0 0 +200 0 +200 200 +100 100 +0 200 +5 +0 0 +200 0 +100 100 +200 200 +0 200 +4 +0 0 +200 0 +200 200 +0 200 diff --git a/codenet/public_test_cases/p01332/input.4.txt b/codenet/public_test_cases/p01332/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7aeae86d1193d9d323e5a5fc03845269b1a49c91 --- /dev/null +++ b/codenet/public_test_cases/p01332/input.4.txt @@ -0,0 +1,12 @@ +3 +0 0 +100 0 +0 100 +3 +0 0 +100 0 +0 100 +3 +0 0 +100 0 +0 100 diff --git a/codenet/public_test_cases/p01332/output.0.txt b/codenet/public_test_cases/p01332/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75b351934b875fcd8b289bdc2301847652899f2e --- /dev/null +++ b/codenet/public_test_cases/p01332/output.0.txt @@ -0,0 +1,3 @@ +1000000.0000 +250000.0000 +5333333.3333 diff --git a/codenet/public_test_cases/p01332/output.1.txt b/codenet/public_test_cases/p01332/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75b351934b875fcd8b289bdc2301847652899f2e --- /dev/null +++ b/codenet/public_test_cases/p01332/output.1.txt @@ -0,0 +1,3 @@ +1000000.0000 +250000.0000 +5333333.3333 diff --git a/codenet/public_test_cases/p01332/output.2.txt b/codenet/public_test_cases/p01332/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..33f127646b992a33b4a66d2225cec0056cdf575a --- /dev/null +++ b/codenet/public_test_cases/p01332/output.2.txt @@ -0,0 +1 @@ +1000000.0000 diff --git a/codenet/public_test_cases/p01332/output.3.txt b/codenet/public_test_cases/p01332/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..772b9b42fdc2441b210e941230fed6061270e01a --- /dev/null +++ b/codenet/public_test_cases/p01332/output.3.txt @@ -0,0 +1 @@ +5333333.3333 diff --git a/codenet/public_test_cases/p01332/output.4.txt b/codenet/public_test_cases/p01332/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..adbaf81d6ec945d9ac1d060ff24f79c56667fe4d --- /dev/null +++ b/codenet/public_test_cases/p01332/output.4.txt @@ -0,0 +1 @@ +250000.0000 diff --git a/codenet/public_test_cases/p01333/input.0.txt b/codenet/public_test_cases/p01333/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af20bd7d76dfb19b311e26d548999f2e93ff1f99 --- /dev/null +++ b/codenet/public_test_cases/p01333/input.0.txt @@ -0,0 +1,6 @@ +500 1000 +100 10000 +400 700 +600 5000 +10000 10000 +0 0 diff --git a/codenet/public_test_cases/p01333/input.1.txt b/codenet/public_test_cases/p01333/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af20bd7d76dfb19b311e26d548999f2e93ff1f99 --- /dev/null +++ b/codenet/public_test_cases/p01333/input.1.txt @@ -0,0 +1,6 @@ +500 1000 +100 10000 +400 700 +600 5000 +10000 10000 +0 0 diff --git a/codenet/public_test_cases/p01333/output.0.txt b/codenet/public_test_cases/p01333/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0a7b15fb77feed7e0aadcce6e3606cb00b24c04 --- /dev/null +++ b/codenet/public_test_cases/p01333/output.0.txt @@ -0,0 +1,5 @@ +0 1 0 +4 1 9 +3 0 0 +4 0 4 +0 0 0 diff --git a/codenet/public_test_cases/p01333/output.1.txt b/codenet/public_test_cases/p01333/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0a7b15fb77feed7e0aadcce6e3606cb00b24c04 --- /dev/null +++ b/codenet/public_test_cases/p01333/output.1.txt @@ -0,0 +1,5 @@ +0 1 0 +4 1 9 +3 0 0 +4 0 4 +0 0 0 diff --git a/codenet/public_test_cases/p01334/input.0.txt b/codenet/public_test_cases/p01334/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..456945cf06d43a213b652ab967d95b4faa3d9b10 --- /dev/null +++ b/codenet/public_test_cases/p01334/input.0.txt @@ -0,0 +1,18 @@ +1 +0 0 +2 +1 1 0 1 +1 0 0 0 +2 +1 1 0 1 +1 1 1 0 +3 +0 1 2 2 2 1 +0 2 1 2 2 1 +0 0 0 1 1 1 +4 +3 2 2 0 3 2 2 1 +1 1 0 3 1 1 3 1 +0 3 2 3 3 0 2 3 +1 1 1 1 3 2 1 3 +0 diff --git a/codenet/public_test_cases/p01334/input.1.txt b/codenet/public_test_cases/p01334/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..456945cf06d43a213b652ab967d95b4faa3d9b10 --- /dev/null +++ b/codenet/public_test_cases/p01334/input.1.txt @@ -0,0 +1,18 @@ +1 +0 0 +2 +1 1 0 1 +1 0 0 0 +2 +1 1 0 1 +1 1 1 0 +3 +0 1 2 2 2 1 +0 2 1 2 2 1 +0 0 0 1 1 1 +4 +3 2 2 0 3 2 2 1 +1 1 0 3 1 1 3 1 +0 3 2 3 3 0 2 3 +1 1 1 1 3 2 1 3 +0 diff --git a/codenet/public_test_cases/p01334/output.0.txt b/codenet/public_test_cases/p01334/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4265686e0eb7910dbc7902e6ceeb2d39c320867 --- /dev/null +++ b/codenet/public_test_cases/p01334/output.0.txt @@ -0,0 +1,5 @@ +1 +2 +1 +2 +3 diff --git a/codenet/public_test_cases/p01334/output.1.txt b/codenet/public_test_cases/p01334/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4265686e0eb7910dbc7902e6ceeb2d39c320867 --- /dev/null +++ b/codenet/public_test_cases/p01334/output.1.txt @@ -0,0 +1,5 @@ +1 +2 +1 +2 +3 diff --git a/codenet/public_test_cases/p01335/input.0.txt b/codenet/public_test_cases/p01335/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5882c087c1da77aee6a938e0a348e8c5b3588791 --- /dev/null +++ b/codenet/public_test_cases/p01335/input.0.txt @@ -0,0 +1,25 @@ +3 +0 1 0 1 0 0 0 0 0 1 0 0 0 +1 0 0 0 0 0 1 0 0 1 0 0 2 +0 1 1 0 1 1 1 0 0 0 0 5 5 +3 1 1 1 0 1 0 0 1 0 3 0 2 +1 1 2 4 5 10 20 50 100 +7H 6H 2H 5H 3H +9S 9C 9H 8H 8D +KS KH QH JD TS +10 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 2 3 4 5 6 7 8 9 +AS 3D 2C 5D 6H +6S 6C 7D 8H 9C +TS TD QC JD JC +KD KH KC AD 2C +3D 4H 6D 5H 7C +2S KS QS AS JS +TS TD JD JC TH +8H 8D TC 8C 8S +4S 5S 3S 7S 6S +KD QD JD TD AD diff --git a/codenet/public_test_cases/p01335/input.1.txt b/codenet/public_test_cases/p01335/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5882c087c1da77aee6a938e0a348e8c5b3588791 --- /dev/null +++ b/codenet/public_test_cases/p01335/input.1.txt @@ -0,0 +1,25 @@ +3 +0 1 0 1 0 0 0 0 0 1 0 0 0 +1 0 0 0 0 0 1 0 0 1 0 0 2 +0 1 1 0 1 1 1 0 0 0 0 5 5 +3 1 1 1 0 1 0 0 1 0 3 0 2 +1 1 2 4 5 10 20 50 100 +7H 6H 2H 5H 3H +9S 9C 9H 8H 8D +KS KH QH JD TS +10 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 +1 2 3 4 5 6 7 8 9 +AS 3D 2C 5D 6H +6S 6C 7D 8H 9C +TS TD QC JD JC +KD KH KC AD 2C +3D 4H 6D 5H 7C +2S KS QS AS JS +TS TD JD JC TH +8H 8D TC 8C 8S +4S 5S 3S 7S 6S +KD QD JD TD AD diff --git a/codenet/public_test_cases/p01335/output.0.txt b/codenet/public_test_cases/p01335/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..10c51ea475de2fa8aaefc7deec9d0e2fabf3a595 --- /dev/null +++ b/codenet/public_test_cases/p01335/output.0.txt @@ -0,0 +1,14 @@ +25 +0 +14 + +0 +5 +10 +15 +20 +25 +30 +35 +40 +45 diff --git a/codenet/public_test_cases/p01335/output.1.txt b/codenet/public_test_cases/p01335/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..10c51ea475de2fa8aaefc7deec9d0e2fabf3a595 --- /dev/null +++ b/codenet/public_test_cases/p01335/output.1.txt @@ -0,0 +1,14 @@ +25 +0 +14 + +0 +5 +10 +15 +20 +25 +30 +35 +40 +45 diff --git a/codenet/public_test_cases/p01336/input.0.txt b/codenet/public_test_cases/p01336/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ce51926507de9b2b8c52b8fbcaa10b3fcb3b265 --- /dev/null +++ b/codenet/public_test_cases/p01336/input.0.txt @@ -0,0 +1,12 @@ +3 10 +Dobkeradops +7 5 23 10 +PataPata +1 1 2 1 +dop +5 3 11 14 +2 300 +Bydo System Alpha +7 11 4 7 +Green Inferno +300 300 300 300 diff --git a/codenet/public_test_cases/p01336/input.1.txt b/codenet/public_test_cases/p01336/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ce51926507de9b2b8c52b8fbcaa10b3fcb3b265 --- /dev/null +++ b/codenet/public_test_cases/p01336/input.1.txt @@ -0,0 +1,12 @@ +3 10 +Dobkeradops +7 5 23 10 +PataPata +1 1 2 1 +dop +5 3 11 14 +2 300 +Bydo System Alpha +7 11 4 7 +Green Inferno +300 300 300 300 diff --git a/codenet/public_test_cases/p01336/output.0.txt b/codenet/public_test_cases/p01336/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7f0ae08adb788fd0e6e5fcee941951c0da7ea2f --- /dev/null +++ b/codenet/public_test_cases/p01336/output.0.txt @@ -0,0 +1,2 @@ +29 +462 diff --git a/codenet/public_test_cases/p01336/output.1.txt b/codenet/public_test_cases/p01336/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7f0ae08adb788fd0e6e5fcee941951c0da7ea2f --- /dev/null +++ b/codenet/public_test_cases/p01336/output.1.txt @@ -0,0 +1,2 @@ +29 +462 diff --git a/codenet/public_test_cases/p01337/input.0.txt b/codenet/public_test_cases/p01337/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c394dfad733608febeda6a97b302febfa0679f02 --- /dev/null +++ b/codenet/public_test_cases/p01337/input.0.txt @@ -0,0 +1,3 @@ +2 +1 3 3 1 +-10 0 0 0 diff --git a/codenet/public_test_cases/p01337/input.1.txt b/codenet/public_test_cases/p01337/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c394dfad733608febeda6a97b302febfa0679f02 --- /dev/null +++ b/codenet/public_test_cases/p01337/input.1.txt @@ -0,0 +1,3 @@ +2 +1 3 3 1 +-10 0 0 0 diff --git a/codenet/public_test_cases/p01337/output.0.txt b/codenet/public_test_cases/p01337/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c353561c042b658802ef4dc244572016f992d65 --- /dev/null +++ b/codenet/public_test_cases/p01337/output.0.txt @@ -0,0 +1,2 @@ +0 3 +0 0 diff --git a/codenet/public_test_cases/p01337/output.1.txt b/codenet/public_test_cases/p01337/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c353561c042b658802ef4dc244572016f992d65 --- /dev/null +++ b/codenet/public_test_cases/p01337/output.1.txt @@ -0,0 +1,2 @@ +0 3 +0 0 diff --git a/codenet/public_test_cases/p01338/input.0.txt b/codenet/public_test_cases/p01338/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f803f96f12d7ded1e38a38313cb63ce78d5925cf --- /dev/null +++ b/codenet/public_test_cases/p01338/input.0.txt @@ -0,0 +1,31 @@ +5 + +1 1 0 3 3 +1 1 0 3 3 +0 0 0 0 0 +2 2 0 4 4 +2 2 0 4 4 + +1 1 1 0 0 +1 1 1 1 0 +1 0 1 1 0 +0 0 1 1 1 +1 1 1 1 1 + +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 + +4 3 4 3 4 +3 4 3 4 3 +4 3 4 3 4 +3 4 3 4 3 +4 3 4 3 4 + +2 2 2 2 2 +0 0 0 2 0 +2 2 0 2 0 +2 2 0 2 0 +0 0 0 2 0 diff --git a/codenet/public_test_cases/p01338/input.1.txt b/codenet/public_test_cases/p01338/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f803f96f12d7ded1e38a38313cb63ce78d5925cf --- /dev/null +++ b/codenet/public_test_cases/p01338/input.1.txt @@ -0,0 +1,31 @@ +5 + +1 1 0 3 3 +1 1 0 3 3 +0 0 0 0 0 +2 2 0 4 4 +2 2 0 4 4 + +1 1 1 0 0 +1 1 1 1 0 +1 0 1 1 0 +0 0 1 1 1 +1 1 1 1 1 + +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 + +4 3 4 3 4 +3 4 3 4 3 +4 3 4 3 4 +3 4 3 4 3 +4 3 4 3 4 + +2 2 2 2 2 +0 0 0 2 0 +2 2 0 2 0 +2 2 0 2 0 +0 0 0 2 0 diff --git a/codenet/public_test_cases/p01338/output.0.txt b/codenet/public_test_cases/p01338/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8c4f2db080aaeff5a5570c2bfd8c4b7e22994ee --- /dev/null +++ b/codenet/public_test_cases/p01338/output.0.txt @@ -0,0 +1,5 @@ +1280 +1420 +0 +1920 +1020 diff --git a/codenet/public_test_cases/p01338/output.1.txt b/codenet/public_test_cases/p01338/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8c4f2db080aaeff5a5570c2bfd8c4b7e22994ee --- /dev/null +++ b/codenet/public_test_cases/p01338/output.1.txt @@ -0,0 +1,5 @@ +1280 +1420 +0 +1920 +1020 diff --git a/codenet/public_test_cases/p01339/input.0.txt b/codenet/public_test_cases/p01339/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c870f880507179ea9b47351e19f5bf33c947f81 --- /dev/null +++ b/codenet/public_test_cases/p01339/input.0.txt @@ -0,0 +1,5 @@ +5 4 +2 3 +3 4 +4 3 +5 4 diff --git a/codenet/public_test_cases/p01339/input.1.txt b/codenet/public_test_cases/p01339/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c870f880507179ea9b47351e19f5bf33c947f81 --- /dev/null +++ b/codenet/public_test_cases/p01339/input.1.txt @@ -0,0 +1,5 @@ +5 4 +2 3 +3 4 +4 3 +5 4 diff --git a/codenet/public_test_cases/p01339/input.2.txt b/codenet/public_test_cases/p01339/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e846a7c6282b3642ed86ac23209829f4a4a48586 --- /dev/null +++ b/codenet/public_test_cases/p01339/input.2.txt @@ -0,0 +1 @@ +5 0 diff --git a/codenet/public_test_cases/p01339/input.3.txt b/codenet/public_test_cases/p01339/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..769d2bcf06e88eaf5f9d9d5db4fd57d96bbb5a4e --- /dev/null +++ b/codenet/public_test_cases/p01339/input.3.txt @@ -0,0 +1,6 @@ +5 5 +1 2 +2 3 +3 4 +4 5 +5 1 diff --git a/codenet/public_test_cases/p01339/output.0.txt b/codenet/public_test_cases/p01339/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01339/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01339/output.1.txt b/codenet/public_test_cases/p01339/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01339/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01339/output.2.txt b/codenet/public_test_cases/p01339/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p01339/output.2.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p01339/output.3.txt b/codenet/public_test_cases/p01339/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01339/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01340/input.0.txt b/codenet/public_test_cases/p01340/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..beb4ae90a7fc5a3631175cfdb9eccb9a34a26a4b --- /dev/null +++ b/codenet/public_test_cases/p01340/input.0.txt @@ -0,0 +1,3 @@ +2 3 +Uo. +.oo diff --git a/codenet/public_test_cases/p01340/input.1.txt b/codenet/public_test_cases/p01340/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00480645176146a20aafb4ea5e96157e0f3bb10a --- /dev/null +++ b/codenet/public_test_cases/p01340/input.1.txt @@ -0,0 +1,11 @@ +10 10 +.o....o... +o.oo...... +..oo..oo.. +..o....... +..oo..oo.. +..o...o.o. +o..U.o.... +oo......oo +oo........ +oo..oo.... diff --git a/codenet/public_test_cases/p01340/input.2.txt b/codenet/public_test_cases/p01340/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b2baf5ac29a26717bdd024bf046ce2469059f7e --- /dev/null +++ b/codenet/public_test_cases/p01340/input.2.txt @@ -0,0 +1,11 @@ +10 1 +D +. +. +. +. +. +. +. +. +o diff --git a/codenet/public_test_cases/p01340/input.3.txt b/codenet/public_test_cases/p01340/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..beb4ae90a7fc5a3631175cfdb9eccb9a34a26a4b --- /dev/null +++ b/codenet/public_test_cases/p01340/input.3.txt @@ -0,0 +1,3 @@ +2 3 +Uo. +.oo diff --git a/codenet/public_test_cases/p01340/output.0.txt b/codenet/public_test_cases/p01340/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..699fd525ccb3785daa51f3612f1ca5664fecff99 --- /dev/null +++ b/codenet/public_test_cases/p01340/output.0.txt @@ -0,0 +1 @@ +RDR diff --git a/codenet/public_test_cases/p01340/output.1.txt b/codenet/public_test_cases/p01340/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75de0fb3e33d98aac72a727e9b7335e11e07292c --- /dev/null +++ b/codenet/public_test_cases/p01340/output.1.txt @@ -0,0 +1 @@ +URRULULDDLUURDLLLURRDLDDDRRDR diff --git a/codenet/public_test_cases/p01340/output.2.txt b/codenet/public_test_cases/p01340/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..178481050188cf00d7d9cd5a11e43ab8fab9294f --- /dev/null +++ b/codenet/public_test_cases/p01340/output.2.txt @@ -0,0 +1 @@ +D diff --git a/codenet/public_test_cases/p01340/output.3.txt b/codenet/public_test_cases/p01340/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..699fd525ccb3785daa51f3612f1ca5664fecff99 --- /dev/null +++ b/codenet/public_test_cases/p01340/output.3.txt @@ -0,0 +1 @@ +RDR diff --git a/codenet/public_test_cases/p01341/input.0.txt b/codenet/public_test_cases/p01341/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0d9d0f6c42f8b917cc336b38118559af42172bc --- /dev/null +++ b/codenet/public_test_cases/p01341/input.0.txt @@ -0,0 +1,7 @@ +3 3 +0 0 +3 0 +0 4 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01341/input.1.txt b/codenet/public_test_cases/p01341/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0d9d0f6c42f8b917cc336b38118559af42172bc --- /dev/null +++ b/codenet/public_test_cases/p01341/input.1.txt @@ -0,0 +1,7 @@ +3 3 +0 0 +3 0 +0 4 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01341/input.2.txt b/codenet/public_test_cases/p01341/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9622e61b1b733afa6476b6aa7b1a3cb3a6bc073 --- /dev/null +++ b/codenet/public_test_cases/p01341/input.2.txt @@ -0,0 +1,13 @@ +6 6 +0 0 +0 1 +1 0 +30 0 +0 40 +30 40 +1 2 +2 3 +3 1 +4 5 +5 6 +6 4 diff --git a/codenet/public_test_cases/p01341/input.3.txt b/codenet/public_test_cases/p01341/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..143fed849db714daebd4df72d578343a5ca715df --- /dev/null +++ b/codenet/public_test_cases/p01341/input.3.txt @@ -0,0 +1,8 @@ +4 3 +0 0 +-100 0 +100 0 +0 100 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p01341/input.4.txt b/codenet/public_test_cases/p01341/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..969749344330e76fc07f2ab0b8fa48f529ca69d7 --- /dev/null +++ b/codenet/public_test_cases/p01341/input.4.txt @@ -0,0 +1,14 @@ +6 7 +2 0 +6 0 +8 2 +6 3 +0 5 +1 7 +1 2 +2 3 +3 4 +4 1 +5 1 +5 4 +5 6 diff --git a/codenet/public_test_cases/p01341/output.0.txt b/codenet/public_test_cases/p01341/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecbc2d38c9e969ddeb8209870bd7bf039e343db0 --- /dev/null +++ b/codenet/public_test_cases/p01341/output.0.txt @@ -0,0 +1 @@ +3.000 diff --git a/codenet/public_test_cases/p01341/output.1.txt b/codenet/public_test_cases/p01341/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecbc2d38c9e969ddeb8209870bd7bf039e343db0 --- /dev/null +++ b/codenet/public_test_cases/p01341/output.1.txt @@ -0,0 +1 @@ +3.000 diff --git a/codenet/public_test_cases/p01341/output.2.txt b/codenet/public_test_cases/p01341/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c885a87f61a87143556e0ed904cce8de26b898a --- /dev/null +++ b/codenet/public_test_cases/p01341/output.2.txt @@ -0,0 +1 @@ +31.000 diff --git a/codenet/public_test_cases/p01341/output.3.txt b/codenet/public_test_cases/p01341/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b54df995394a3c063f473ae761d97774b7b58fa --- /dev/null +++ b/codenet/public_test_cases/p01341/output.3.txt @@ -0,0 +1 @@ +0.000 diff --git a/codenet/public_test_cases/p01341/output.4.txt b/codenet/public_test_cases/p01341/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb5b611fea872343cb606dd812c0e36fbc515fc4 --- /dev/null +++ b/codenet/public_test_cases/p01341/output.4.txt @@ -0,0 +1 @@ +7.236 diff --git a/codenet/public_test_cases/p01342/input.0.txt b/codenet/public_test_cases/p01342/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1517420d2efb54ef6d0e39a0d63fd717e58fa76c --- /dev/null +++ b/codenet/public_test_cases/p01342/input.0.txt @@ -0,0 +1,7 @@ +3 4 4 +1 0 1 1 +1 3 1 4 +1 2 2 2 +2 1 2 3 +0 0 +1 0 diff --git a/codenet/public_test_cases/p01342/input.1.txt b/codenet/public_test_cases/p01342/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d3785f63f5964d897d57f2f38335390b1bddd56 --- /dev/null +++ b/codenet/public_test_cases/p01342/input.1.txt @@ -0,0 +1,3 @@ +50 2 0 +0 0 +49 1 diff --git a/codenet/public_test_cases/p01342/input.2.txt b/codenet/public_test_cases/p01342/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..61023f16faab8651689f8ec135e8a3c7ab4754ed --- /dev/null +++ b/codenet/public_test_cases/p01342/input.2.txt @@ -0,0 +1,3 @@ +50 2 0 +0 0 +49 0 diff --git a/codenet/public_test_cases/p01342/input.3.txt b/codenet/public_test_cases/p01342/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1517420d2efb54ef6d0e39a0d63fd717e58fa76c --- /dev/null +++ b/codenet/public_test_cases/p01342/input.3.txt @@ -0,0 +1,7 @@ +3 4 4 +1 0 1 1 +1 3 1 4 +1 2 2 2 +2 1 2 3 +0 0 +1 0 diff --git a/codenet/public_test_cases/p01342/output.0.txt b/codenet/public_test_cases/p01342/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01342/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01342/output.1.txt b/codenet/public_test_cases/p01342/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01342/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01342/output.2.txt b/codenet/public_test_cases/p01342/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01342/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01342/output.3.txt b/codenet/public_test_cases/p01342/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01342/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01343/input.0.txt b/codenet/public_test_cases/p01343/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b690d6ca68201704e85bcb5537de61ab50d5baa --- /dev/null +++ b/codenet/public_test_cases/p01343/input.0.txt @@ -0,0 +1,3 @@ +2 1 +0 0 1 0 +1 1 0 1 diff --git a/codenet/public_test_cases/p01343/input.1.txt b/codenet/public_test_cases/p01343/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff2629ce7035ab422878f6886af2c1d48af01c0b --- /dev/null +++ b/codenet/public_test_cases/p01343/input.1.txt @@ -0,0 +1,2 @@ +1 1 +0 0 2 0 diff --git a/codenet/public_test_cases/p01343/input.2.txt b/codenet/public_test_cases/p01343/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b690d6ca68201704e85bcb5537de61ab50d5baa --- /dev/null +++ b/codenet/public_test_cases/p01343/input.2.txt @@ -0,0 +1,3 @@ +2 1 +0 0 1 0 +1 1 0 1 diff --git a/codenet/public_test_cases/p01343/input.3.txt b/codenet/public_test_cases/p01343/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8100fc969e79961905867c7430af9b0a8b56aefc --- /dev/null +++ b/codenet/public_test_cases/p01343/input.3.txt @@ -0,0 +1,4 @@ +3 2 +0 0 2 0 +1 -1 1 2 +0 1 2 1 diff --git a/codenet/public_test_cases/p01343/output.0.txt b/codenet/public_test_cases/p01343/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea2470b527dc31800c5da5b6e6df213ba857a66b --- /dev/null +++ b/codenet/public_test_cases/p01343/output.0.txt @@ -0,0 +1 @@ +5.2793638507 diff --git a/codenet/public_test_cases/p01343/output.1.txt b/codenet/public_test_cases/p01343/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9eeebef101196fa6bd9639d1e493472995848ed6 --- /dev/null +++ b/codenet/public_test_cases/p01343/output.1.txt @@ -0,0 +1 @@ +2.8284271082 diff --git a/codenet/public_test_cases/p01343/output.2.txt b/codenet/public_test_cases/p01343/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea2470b527dc31800c5da5b6e6df213ba857a66b --- /dev/null +++ b/codenet/public_test_cases/p01343/output.2.txt @@ -0,0 +1 @@ +5.2793638507 diff --git a/codenet/public_test_cases/p01343/output.3.txt b/codenet/public_test_cases/p01343/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ed2ea04e2ab4bab6e33eb7eae74d8b02e1ecbb8 --- /dev/null +++ b/codenet/public_test_cases/p01343/output.3.txt @@ -0,0 +1 @@ +11.1364603512 diff --git a/codenet/public_test_cases/p01344/input.0.txt b/codenet/public_test_cases/p01344/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1b4f9686b5384991d848367b778eb566e4f56a9 --- /dev/null +++ b/codenet/public_test_cases/p01344/input.0.txt @@ -0,0 +1,8 @@ +6 +4 3 3 +10 17 +15 14 +10 15 +11 12 +16 18 +15 22 diff --git a/codenet/public_test_cases/p01344/input.1.txt b/codenet/public_test_cases/p01344/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ccb79aa9236ded593e3dd866f4da0494e086da0 --- /dev/null +++ b/codenet/public_test_cases/p01344/input.1.txt @@ -0,0 +1,9 @@ +7 +4 2 4 +11 18 +14 18 +10 14 +13 14 +14 17 +17 21 +16 26 diff --git a/codenet/public_test_cases/p01344/input.2.txt b/codenet/public_test_cases/p01344/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f7ae77dae789bc06387e9e3949735e6d001cb5d --- /dev/null +++ b/codenet/public_test_cases/p01344/input.2.txt @@ -0,0 +1,8 @@ +6 +2 3 3 +11 22 +12 20 +10 15 +11 17 +13 23 +16 22 diff --git a/codenet/public_test_cases/p01344/input.3.txt b/codenet/public_test_cases/p01344/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3d20923f5ce80c8d156dd231917ef83b075df44 --- /dev/null +++ b/codenet/public_test_cases/p01344/input.3.txt @@ -0,0 +1,8 @@ +6 +2 2 4 +12 22 +13 21 +14 15 +10 16 +16 24 +10 35 diff --git a/codenet/public_test_cases/p01344/input.4.txt b/codenet/public_test_cases/p01344/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1b4f9686b5384991d848367b778eb566e4f56a9 --- /dev/null +++ b/codenet/public_test_cases/p01344/input.4.txt @@ -0,0 +1,8 @@ +6 +4 3 3 +10 17 +15 14 +10 15 +11 12 +16 18 +15 22 diff --git a/codenet/public_test_cases/p01344/output.0.txt b/codenet/public_test_cases/p01344/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01344/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01344/output.1.txt b/codenet/public_test_cases/p01344/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01344/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01344/output.2.txt b/codenet/public_test_cases/p01344/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01344/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01344/output.3.txt b/codenet/public_test_cases/p01344/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01344/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01344/output.4.txt b/codenet/public_test_cases/p01344/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01344/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01345/input.0.txt b/codenet/public_test_cases/p01345/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93687b0a2cb0ee289754745024494fadd04768f3 --- /dev/null +++ b/codenet/public_test_cases/p01345/input.0.txt @@ -0,0 +1,6 @@ +4 +0 0 +10 10 +10 -10 +-10 -10 +-10 10 diff --git a/codenet/public_test_cases/p01345/input.1.txt b/codenet/public_test_cases/p01345/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abe5c130a6ee546ebd6a955718615e6c617c8823 --- /dev/null +++ b/codenet/public_test_cases/p01345/input.1.txt @@ -0,0 +1,6 @@ +4 +89 0 +0 0 +0 -90 +0 180 +0 90 diff --git a/codenet/public_test_cases/p01345/input.2.txt b/codenet/public_test_cases/p01345/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..93687b0a2cb0ee289754745024494fadd04768f3 --- /dev/null +++ b/codenet/public_test_cases/p01345/input.2.txt @@ -0,0 +1,6 @@ +4 +0 0 +10 10 +10 -10 +-10 -10 +-10 10 diff --git a/codenet/public_test_cases/p01345/input.3.txt b/codenet/public_test_cases/p01345/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..51f98975c6017f37f5df3d8b7aa6d7effa9ae26c --- /dev/null +++ b/codenet/public_test_cases/p01345/input.3.txt @@ -0,0 +1,6 @@ +4 +89 0 +0 0 +0 90 +0 180 +0 -90 diff --git a/codenet/public_test_cases/p01345/output.0.txt b/codenet/public_test_cases/p01345/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01345/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01345/output.1.txt b/codenet/public_test_cases/p01345/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01345/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01345/output.2.txt b/codenet/public_test_cases/p01345/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01345/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01345/output.3.txt b/codenet/public_test_cases/p01345/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01345/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01346/input.0.txt b/codenet/public_test_cases/p01346/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..171f08b13fb4b2fcdeac0febc7573bae55857d3d --- /dev/null +++ b/codenet/public_test_cases/p01346/input.0.txt @@ -0,0 +1,2 @@ +3 3 2 1 +1 1 4 diff --git a/codenet/public_test_cases/p01346/input.1.txt b/codenet/public_test_cases/p01346/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..171f08b13fb4b2fcdeac0febc7573bae55857d3d --- /dev/null +++ b/codenet/public_test_cases/p01346/input.1.txt @@ -0,0 +1,2 @@ +3 3 2 1 +1 1 4 diff --git a/codenet/public_test_cases/p01346/input.2.txt b/codenet/public_test_cases/p01346/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0369e2b937ba800a1bc14315b7d0da42a6525506 --- /dev/null +++ b/codenet/public_test_cases/p01346/input.2.txt @@ -0,0 +1,2 @@ +3 3 2 1 +1 4 1 diff --git a/codenet/public_test_cases/p01346/output.0.txt b/codenet/public_test_cases/p01346/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01346/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01346/output.1.txt b/codenet/public_test_cases/p01346/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01346/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01346/output.2.txt b/codenet/public_test_cases/p01346/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01346/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01347/input.0.txt b/codenet/public_test_cases/p01347/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f92b55f50eaae9feb22b37504590883b2c1c3bce --- /dev/null +++ b/codenet/public_test_cases/p01347/input.0.txt @@ -0,0 +1,4 @@ +3 3 +0 1 5 +1 2 3 +0 2 2 diff --git a/codenet/public_test_cases/p01347/input.1.txt b/codenet/public_test_cases/p01347/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7722f072fe096dbeef7f2a0a5a4f26c89ff0cdbd --- /dev/null +++ b/codenet/public_test_cases/p01347/input.1.txt @@ -0,0 +1,7 @@ +4 6 +0 1 5 +0 2 5 +0 3 5 +1 2 5 +1 3 5 +2 3 5 diff --git a/codenet/public_test_cases/p01347/input.2.txt b/codenet/public_test_cases/p01347/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f289a7b6851759f1022f0921856b235b86eb4dbf --- /dev/null +++ b/codenet/public_test_cases/p01347/input.2.txt @@ -0,0 +1,2 @@ +2 1 +0 1 10 diff --git a/codenet/public_test_cases/p01347/input.3.txt b/codenet/public_test_cases/p01347/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f92b55f50eaae9feb22b37504590883b2c1c3bce --- /dev/null +++ b/codenet/public_test_cases/p01347/input.3.txt @@ -0,0 +1,4 @@ +3 3 +0 1 5 +1 2 3 +0 2 2 diff --git a/codenet/public_test_cases/p01347/output.0.txt b/codenet/public_test_cases/p01347/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01347/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01347/output.1.txt b/codenet/public_test_cases/p01347/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p01347/output.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p01347/output.2.txt b/codenet/public_test_cases/p01347/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01347/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01347/output.3.txt b/codenet/public_test_cases/p01347/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01347/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01348/input.0.txt b/codenet/public_test_cases/p01348/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1c7c60a6bfbd0a1c1c28e7c33cec21564c420b5 --- /dev/null +++ b/codenet/public_test_cases/p01348/input.0.txt @@ -0,0 +1,3 @@ +4 2 +0 2 +3 1 diff --git a/codenet/public_test_cases/p01348/input.1.txt b/codenet/public_test_cases/p01348/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b0b3975c97c4e7d0770175c1d96db5ab8fba4f3 --- /dev/null +++ b/codenet/public_test_cases/p01348/input.1.txt @@ -0,0 +1,4 @@ +10 3 +0 0 +4 4 +1 4 diff --git a/codenet/public_test_cases/p01348/input.2.txt b/codenet/public_test_cases/p01348/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..405a1e1131a1c53906d6a9ba02f8e1137d25d99d --- /dev/null +++ b/codenet/public_test_cases/p01348/input.2.txt @@ -0,0 +1,3 @@ +4 2 +2 3 +3 2 diff --git a/codenet/public_test_cases/p01348/input.3.txt b/codenet/public_test_cases/p01348/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1c7c60a6bfbd0a1c1c28e7c33cec21564c420b5 --- /dev/null +++ b/codenet/public_test_cases/p01348/input.3.txt @@ -0,0 +1,3 @@ +4 2 +0 2 +3 1 diff --git a/codenet/public_test_cases/p01348/output.0.txt b/codenet/public_test_cases/p01348/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01348/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01348/output.1.txt b/codenet/public_test_cases/p01348/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb8e83187e71f102f8a11bf0a40ca13fd7bf5449 --- /dev/null +++ b/codenet/public_test_cases/p01348/output.1.txt @@ -0,0 +1 @@ +1127 diff --git a/codenet/public_test_cases/p01348/output.2.txt b/codenet/public_test_cases/p01348/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01348/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01348/output.3.txt b/codenet/public_test_cases/p01348/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01348/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01349/input.0.txt b/codenet/public_test_cases/p01349/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3c8eadeaa6a273ba85a63331c28532bccfbb1da --- /dev/null +++ b/codenet/public_test_cases/p01349/input.0.txt @@ -0,0 +1,5 @@ +4 6 3 +...... +...Y.. +...Y.. +RRYRYY diff --git a/codenet/public_test_cases/p01349/input.1.txt b/codenet/public_test_cases/p01349/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3c8eadeaa6a273ba85a63331c28532bccfbb1da --- /dev/null +++ b/codenet/public_test_cases/p01349/input.1.txt @@ -0,0 +1,5 @@ +4 6 3 +...... +...Y.. +...Y.. +RRYRYY diff --git a/codenet/public_test_cases/p01349/input.2.txt b/codenet/public_test_cases/p01349/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c44f4f963549fd097c6da031e3fb79a273dee3ee --- /dev/null +++ b/codenet/public_test_cases/p01349/input.2.txt @@ -0,0 +1,5 @@ +4 6 3 +...... +...Y.. +...Y.. +RRYRY. diff --git a/codenet/public_test_cases/p01349/output.0.txt b/codenet/public_test_cases/p01349/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01349/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01349/output.1.txt b/codenet/public_test_cases/p01349/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01349/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01349/output.2.txt b/codenet/public_test_cases/p01349/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p01349/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p01350/input.0.txt b/codenet/public_test_cases/p01350/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0896f7651e2118cffc80dd6fa656b875b408f82 --- /dev/null +++ b/codenet/public_test_cases/p01350/input.0.txt @@ -0,0 +1,7 @@ +5 +100.1 90.1 +0 0 +0 10 +5 5 +10 0 +10 10 diff --git a/codenet/public_test_cases/p01350/input.1.txt b/codenet/public_test_cases/p01350/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0896f7651e2118cffc80dd6fa656b875b408f82 --- /dev/null +++ b/codenet/public_test_cases/p01350/input.1.txt @@ -0,0 +1,7 @@ +5 +100.1 90.1 +0 0 +0 10 +5 5 +10 0 +10 10 diff --git a/codenet/public_test_cases/p01350/output.0.txt b/codenet/public_test_cases/p01350/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01350/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01350/output.1.txt b/codenet/public_test_cases/p01350/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01350/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01351/input.0.txt b/codenet/public_test_cases/p01351/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0639a7f9a9b2d067ec7b9a9f9da4e842e66a46c --- /dev/null +++ b/codenet/public_test_cases/p01351/input.0.txt @@ -0,0 +1 @@ +6 6 2 2 2 4 diff --git a/codenet/public_test_cases/p01351/input.1.txt b/codenet/public_test_cases/p01351/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0639a7f9a9b2d067ec7b9a9f9da4e842e66a46c --- /dev/null +++ b/codenet/public_test_cases/p01351/input.1.txt @@ -0,0 +1 @@ +6 6 2 2 2 4 diff --git a/codenet/public_test_cases/p01351/output.0.txt b/codenet/public_test_cases/p01351/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01351/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01351/output.1.txt b/codenet/public_test_cases/p01351/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01351/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01352/input.0.txt b/codenet/public_test_cases/p01352/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4233e56ecfff0a86aa315d5e688a0ca8cedaf13e --- /dev/null +++ b/codenet/public_test_cases/p01352/input.0.txt @@ -0,0 +1,11 @@ +4 10 +1 0 1 +1 0 2 +3 1 2 +2 0 1 +1 2 3 +3 0 1 +1 0 1 +2 0 2 +1 1 3 +3 0 2 diff --git a/codenet/public_test_cases/p01352/input.1.txt b/codenet/public_test_cases/p01352/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4233e56ecfff0a86aa315d5e688a0ca8cedaf13e --- /dev/null +++ b/codenet/public_test_cases/p01352/input.1.txt @@ -0,0 +1,11 @@ +4 10 +1 0 1 +1 0 2 +3 1 2 +2 0 1 +1 2 3 +3 0 1 +1 0 1 +2 0 2 +1 1 3 +3 0 2 diff --git a/codenet/public_test_cases/p01352/output.0.txt b/codenet/public_test_cases/p01352/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0db7433a539f2df28a97ee70cae486285cc2acad --- /dev/null +++ b/codenet/public_test_cases/p01352/output.0.txt @@ -0,0 +1,3 @@ +YES +NO +YES diff --git a/codenet/public_test_cases/p01352/output.1.txt b/codenet/public_test_cases/p01352/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0db7433a539f2df28a97ee70cae486285cc2acad --- /dev/null +++ b/codenet/public_test_cases/p01352/output.1.txt @@ -0,0 +1,3 @@ +YES +NO +YES diff --git a/codenet/public_test_cases/p01353/input.0.txt b/codenet/public_test_cases/p01353/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..765dd463098d854fc69a426a407245ce8a5f2fa7 --- /dev/null +++ b/codenet/public_test_cases/p01353/input.0.txt @@ -0,0 +1,4 @@ +2 +10 3 1 2 +2 4 1 3 +2 2 1 1 diff --git a/codenet/public_test_cases/p01353/input.1.txt b/codenet/public_test_cases/p01353/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..72b1126af7dfdeebbafdb4e74f08bf3b9f02b3aa --- /dev/null +++ b/codenet/public_test_cases/p01353/input.1.txt @@ -0,0 +1,3 @@ +1 +1 1 1 1 +10000 10000 10000 10000 diff --git a/codenet/public_test_cases/p01353/input.2.txt b/codenet/public_test_cases/p01353/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..765dd463098d854fc69a426a407245ce8a5f2fa7 --- /dev/null +++ b/codenet/public_test_cases/p01353/input.2.txt @@ -0,0 +1,4 @@ +2 +10 3 1 2 +2 4 1 3 +2 2 1 1 diff --git a/codenet/public_test_cases/p01353/output.0.txt b/codenet/public_test_cases/p01353/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01353/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01353/output.1.txt b/codenet/public_test_cases/p01353/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01353/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01353/output.2.txt b/codenet/public_test_cases/p01353/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01353/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01354/input.0.txt b/codenet/public_test_cases/p01354/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83afc928e459165eedab395fb9b63c50a546f5ac --- /dev/null +++ b/codenet/public_test_cases/p01354/input.0.txt @@ -0,0 +1,3 @@ +2 3 +0.900 0.500 0.100 +0.500 0.500 0.500 diff --git a/codenet/public_test_cases/p01354/input.1.txt b/codenet/public_test_cases/p01354/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83afc928e459165eedab395fb9b63c50a546f5ac --- /dev/null +++ b/codenet/public_test_cases/p01354/input.1.txt @@ -0,0 +1,3 @@ +2 3 +0.900 0.500 0.100 +0.500 0.500 0.500 diff --git a/codenet/public_test_cases/p01354/output.0.txt b/codenet/public_test_cases/p01354/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2814a15f8648b668f398ed3831615857d288917f --- /dev/null +++ b/codenet/public_test_cases/p01354/output.0.txt @@ -0,0 +1 @@ +0.372500000000 diff --git a/codenet/public_test_cases/p01354/output.1.txt b/codenet/public_test_cases/p01354/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2814a15f8648b668f398ed3831615857d288917f --- /dev/null +++ b/codenet/public_test_cases/p01354/output.1.txt @@ -0,0 +1 @@ +0.372500000000 diff --git a/codenet/public_test_cases/p01355/input.0.txt b/codenet/public_test_cases/p01355/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffec93763b1f91f96c3f3425377782ca6f626696 --- /dev/null +++ b/codenet/public_test_cases/p01355/input.0.txt @@ -0,0 +1,3 @@ +2 1 +10 0 10 +20 0 10 diff --git a/codenet/public_test_cases/p01355/input.1.txt b/codenet/public_test_cases/p01355/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffec93763b1f91f96c3f3425377782ca6f626696 --- /dev/null +++ b/codenet/public_test_cases/p01355/input.1.txt @@ -0,0 +1,3 @@ +2 1 +10 0 10 +20 0 10 diff --git a/codenet/public_test_cases/p01355/output.0.txt b/codenet/public_test_cases/p01355/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01355/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01355/output.1.txt b/codenet/public_test_cases/p01355/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01355/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01356/input.0.txt b/codenet/public_test_cases/p01356/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bfffc0fe58ded2a1a890585410c60ca9ed42644 --- /dev/null +++ b/codenet/public_test_cases/p01356/input.0.txt @@ -0,0 +1 @@ +6 200 2 3 4 5 diff --git a/codenet/public_test_cases/p01356/input.1.txt b/codenet/public_test_cases/p01356/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..263b0a96c4486f9e744493145e65561b080215ba --- /dev/null +++ b/codenet/public_test_cases/p01356/input.1.txt @@ -0,0 +1 @@ +6 1 2 3 4 5 diff --git a/codenet/public_test_cases/p01356/input.2.txt b/codenet/public_test_cases/p01356/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bfffc0fe58ded2a1a890585410c60ca9ed42644 --- /dev/null +++ b/codenet/public_test_cases/p01356/input.2.txt @@ -0,0 +1 @@ +6 200 2 3 4 5 diff --git a/codenet/public_test_cases/p01356/output.0.txt b/codenet/public_test_cases/p01356/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01356/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01356/output.1.txt b/codenet/public_test_cases/p01356/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01356/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01356/output.2.txt b/codenet/public_test_cases/p01356/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01356/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01357/input.0.txt b/codenet/public_test_cases/p01357/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c1162cf2f3d221a7191b183031463e459b1229a --- /dev/null +++ b/codenet/public_test_cases/p01357/input.0.txt @@ -0,0 +1,7 @@ +2 +1 -1 3 -1 3 1 1 3 -1 3 -1 1 +3 0 4 0 4 1 3 2 2 2 2 1 +3 +1 1 +-1 -1 +2 4 diff --git a/codenet/public_test_cases/p01357/input.1.txt b/codenet/public_test_cases/p01357/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c1162cf2f3d221a7191b183031463e459b1229a --- /dev/null +++ b/codenet/public_test_cases/p01357/input.1.txt @@ -0,0 +1,7 @@ +2 +1 -1 3 -1 3 1 1 3 -1 3 -1 1 +3 0 4 0 4 1 3 2 2 2 2 1 +3 +1 1 +-1 -1 +2 4 diff --git a/codenet/public_test_cases/p01357/output.0.txt b/codenet/public_test_cases/p01357/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0db7433a539f2df28a97ee70cae486285cc2acad --- /dev/null +++ b/codenet/public_test_cases/p01357/output.0.txt @@ -0,0 +1,3 @@ +YES +NO +YES diff --git a/codenet/public_test_cases/p01357/output.1.txt b/codenet/public_test_cases/p01357/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0db7433a539f2df28a97ee70cae486285cc2acad --- /dev/null +++ b/codenet/public_test_cases/p01357/output.1.txt @@ -0,0 +1,3 @@ +YES +NO +YES diff --git a/codenet/public_test_cases/p01358/input.0.txt b/codenet/public_test_cases/p01358/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f46337be4374406b2ef19e61fa3cd7c69db1def --- /dev/null +++ b/codenet/public_test_cases/p01358/input.0.txt @@ -0,0 +1,17 @@ +3 2 2 10 +1 2 3 +4 5 6 +7 8 9 +1 2 3 +6 5 4 +7 8 9 +11 +4 +7 +5 +10 +9 +2 +1 +3 +8 diff --git a/codenet/public_test_cases/p01358/input.1.txt b/codenet/public_test_cases/p01358/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f46337be4374406b2ef19e61fa3cd7c69db1def --- /dev/null +++ b/codenet/public_test_cases/p01358/input.1.txt @@ -0,0 +1,17 @@ +3 2 2 10 +1 2 3 +4 5 6 +7 8 9 +1 2 3 +6 5 4 +7 8 9 +11 +4 +7 +5 +10 +9 +2 +1 +3 +8 diff --git a/codenet/public_test_cases/p01358/input.2.txt b/codenet/public_test_cases/p01358/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..529a79b612d182660aa0cc6f3356de8bf3bd23ed --- /dev/null +++ b/codenet/public_test_cases/p01358/input.2.txt @@ -0,0 +1,17 @@ +3 2 1 10 +1 2 3 +4 5 6 +7 8 9 +1 2 3 +6 5 4 +7 8 9 +11 +4 +7 +5 +10 +9 +2 +1 +3 +8 diff --git a/codenet/public_test_cases/p01358/output.0.txt b/codenet/public_test_cases/p01358/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2604de8b3a8927c9a3f7239eba4290e3d496f25 --- /dev/null +++ b/codenet/public_test_cases/p01358/output.0.txt @@ -0,0 +1 @@ +USAGI diff --git a/codenet/public_test_cases/p01358/output.1.txt b/codenet/public_test_cases/p01358/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2604de8b3a8927c9a3f7239eba4290e3d496f25 --- /dev/null +++ b/codenet/public_test_cases/p01358/output.1.txt @@ -0,0 +1 @@ +USAGI diff --git a/codenet/public_test_cases/p01358/output.2.txt b/codenet/public_test_cases/p01358/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ce347c6df96e59194f0123cc266c1d81bdea49a --- /dev/null +++ b/codenet/public_test_cases/p01358/output.2.txt @@ -0,0 +1 @@ +DRAW diff --git a/codenet/public_test_cases/p01359/input.0.txt b/codenet/public_test_cases/p01359/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b454bb0a9bb2ae3787347f16ba82caa665dba3a --- /dev/null +++ b/codenet/public_test_cases/p01359/input.0.txt @@ -0,0 +1,12 @@ +4 3 +meiji 10 1877 +taisho 6 1917 +showa 62 1987 +heisei 22 2010 +1868 +1917 +1988 +1 1 +universalcentury 123 2168 +2010 +0 0 diff --git a/codenet/public_test_cases/p01359/input.1.txt b/codenet/public_test_cases/p01359/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b454bb0a9bb2ae3787347f16ba82caa665dba3a --- /dev/null +++ b/codenet/public_test_cases/p01359/input.1.txt @@ -0,0 +1,12 @@ +4 3 +meiji 10 1877 +taisho 6 1917 +showa 62 1987 +heisei 22 2010 +1868 +1917 +1988 +1 1 +universalcentury 123 2168 +2010 +0 0 diff --git a/codenet/public_test_cases/p01359/output.0.txt b/codenet/public_test_cases/p01359/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..79f66c1e43a290e95c34770d08bfeaffc2f12ee0 --- /dev/null +++ b/codenet/public_test_cases/p01359/output.0.txt @@ -0,0 +1,4 @@ +meiji 1 +taisho 6 +Unknown +Unknown diff --git a/codenet/public_test_cases/p01359/output.1.txt b/codenet/public_test_cases/p01359/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..79f66c1e43a290e95c34770d08bfeaffc2f12ee0 --- /dev/null +++ b/codenet/public_test_cases/p01359/output.1.txt @@ -0,0 +1,4 @@ +meiji 1 +taisho 6 +Unknown +Unknown diff --git a/codenet/public_test_cases/p01360/input.0.txt b/codenet/public_test_cases/p01360/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5fc975791fd47cf3b4c87507e8914b38d06ed9a --- /dev/null +++ b/codenet/public_test_cases/p01360/input.0.txt @@ -0,0 +1,8 @@ +1 +12 +123 +369 +6748 +4247219123 +1232123212321232 +# diff --git a/codenet/public_test_cases/p01360/input.1.txt b/codenet/public_test_cases/p01360/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac92c26dfd414407da0c3dfaf81ac530ed58c5c --- /dev/null +++ b/codenet/public_test_cases/p01360/input.1.txt @@ -0,0 +1,7 @@ +1 +12 +123 +369 +6748 +4247219123 +1232123212321232 diff --git a/codenet/public_test_cases/p01360/input.2.txt b/codenet/public_test_cases/p01360/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5fc975791fd47cf3b4c87507e8914b38d06ed9a --- /dev/null +++ b/codenet/public_test_cases/p01360/input.2.txt @@ -0,0 +1,8 @@ +1 +12 +123 +369 +6748 +4247219123 +1232123212321232 +# diff --git a/codenet/public_test_cases/p01360/output.0.txt b/codenet/public_test_cases/p01360/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99564e9d7e5bba043676dd81702ca8c8960a0849 --- /dev/null +++ b/codenet/public_test_cases/p01360/output.0.txt @@ -0,0 +1,7 @@ +0 +0 +1 +0 +1 +2 +7 diff --git a/codenet/public_test_cases/p01360/output.1.txt b/codenet/public_test_cases/p01360/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99564e9d7e5bba043676dd81702ca8c8960a0849 --- /dev/null +++ b/codenet/public_test_cases/p01360/output.1.txt @@ -0,0 +1,7 @@ +0 +0 +1 +0 +1 +2 +7 diff --git a/codenet/public_test_cases/p01360/output.2.txt b/codenet/public_test_cases/p01360/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99564e9d7e5bba043676dd81702ca8c8960a0849 --- /dev/null +++ b/codenet/public_test_cases/p01360/output.2.txt @@ -0,0 +1,7 @@ +0 +0 +1 +0 +1 +2 +7 diff --git a/codenet/public_test_cases/p01361/input.0.txt b/codenet/public_test_cases/p01361/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ad4aca9b9a83a2ad99358d318b08bb062a3b69a --- /dev/null +++ b/codenet/public_test_cases/p01361/input.0.txt @@ -0,0 +1,54 @@ +1 10 +3 3 +AAA +ABA +CCC +3 +A 0 +B 5 +C 9 +3 +D 2 +R 1 +U 2 +5 +10 +10 +10 +10 +10 +100 100 +10 10 +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +8 +T 0 +H 1 +I 2 +S 3 +A 4 +P 5 +E 6 +N 7 +9 +R 1 +D 3 +R 8 +D 2 +L 9 +D 2 +R 9 +D 2 +L 9 +2 +20 +10 +0 0 diff --git a/codenet/public_test_cases/p01361/input.1.txt b/codenet/public_test_cases/p01361/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ad4aca9b9a83a2ad99358d318b08bb062a3b69a --- /dev/null +++ b/codenet/public_test_cases/p01361/input.1.txt @@ -0,0 +1,54 @@ +1 10 +3 3 +AAA +ABA +CCC +3 +A 0 +B 5 +C 9 +3 +D 2 +R 1 +U 2 +5 +10 +10 +10 +10 +10 +100 100 +10 10 +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +THISISAPEN +8 +T 0 +H 1 +I 2 +S 3 +A 4 +P 5 +E 6 +N 7 +9 +R 1 +D 3 +R 8 +D 2 +L 9 +D 2 +R 9 +D 2 +L 9 +2 +20 +10 +0 0 diff --git a/codenet/public_test_cases/p01361/output.0.txt b/codenet/public_test_cases/p01361/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p01361/output.0.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p01361/output.1.txt b/codenet/public_test_cases/p01361/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p01361/output.1.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p01362/input.0.txt b/codenet/public_test_cases/p01362/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a1def9bb4bbeaddbe316da08872526728b051ca --- /dev/null +++ b/codenet/public_test_cases/p01362/input.0.txt @@ -0,0 +1,58 @@ +... +... +.*. +... +... +.*. +... +... +... +... +... +.*. +... +... +.*. +... +... +... + +... +.*. +... +*.. +... +..* +*.* +*.* +*.* +*.* +.*. +*.* +*.. +.*. +..* +*.* +... +*.* + +... +.*. +.*. +... +.** +*.. +... +... +.*. +.*. +... +*.. +..* +... +.** +... +*.. +... + +# diff --git a/codenet/public_test_cases/p01362/input.1.txt b/codenet/public_test_cases/p01362/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e65bf4fbf505a0886ed44ea398cd88997d752b18 --- /dev/null +++ b/codenet/public_test_cases/p01362/input.1.txt @@ -0,0 +1,56 @@ +... +... +.*. +... +... +.*. +... +... +... +... +... +.*. +... +... +.*. +... +... +... + +... +.*. +... +*.. +... +..* +*.* +*.* +*.* +*.* +.*. +*.* +*.. +.*. +..* +*.* +... +*.* + +... +.*. +.*. +... +.** +*.. +... +... +.*. +.*. +... +*.. +..* +... +.** +... +*.. +... diff --git a/codenet/public_test_cases/p01362/input.2.txt b/codenet/public_test_cases/p01362/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a1def9bb4bbeaddbe316da08872526728b051ca --- /dev/null +++ b/codenet/public_test_cases/p01362/input.2.txt @@ -0,0 +1,58 @@ +... +... +.*. +... +... +.*. +... +... +... +... +... +.*. +... +... +.*. +... +... +... + +... +.*. +... +*.. +... +..* +*.* +*.* +*.* +*.* +.*. +*.* +*.. +.*. +..* +*.* +... +*.* + +... +.*. +.*. +... +.** +*.. +... +... +.*. +.*. +... +*.. +..* +... +.** +... +*.. +... + +# diff --git a/codenet/public_test_cases/p01362/output.0.txt b/codenet/public_test_cases/p01362/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b90379abb74e1fddf978dc94ff316bc2412331c --- /dev/null +++ b/codenet/public_test_cases/p01362/output.0.txt @@ -0,0 +1,3 @@ +3 +1 +0 diff --git a/codenet/public_test_cases/p01362/output.1.txt b/codenet/public_test_cases/p01362/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b90379abb74e1fddf978dc94ff316bc2412331c --- /dev/null +++ b/codenet/public_test_cases/p01362/output.1.txt @@ -0,0 +1,3 @@ +3 +1 +0 diff --git a/codenet/public_test_cases/p01362/output.2.txt b/codenet/public_test_cases/p01362/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b90379abb74e1fddf978dc94ff316bc2412331c --- /dev/null +++ b/codenet/public_test_cases/p01362/output.2.txt @@ -0,0 +1,3 @@ +3 +1 +0 diff --git a/codenet/public_test_cases/p01363/input.0.txt b/codenet/public_test_cases/p01363/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6caa534c8a93b959ef7ed0202bb6f99ec58e25c6 --- /dev/null +++ b/codenet/public_test_cases/p01363/input.0.txt @@ -0,0 +1,20 @@ +1 +1 1 +4 -1 0 -2 -1 -1 -2 0 -1 +1 +0 3 +4 1 1 1 2 -1 2 -1 1 +1 +-6 -6 +6 1 -2 2 -2 2 3 -2 3 -2 1 1 1 +1 +-10 0 +4 0 -5 1 -5 1 5 0 5 +1 +10 1 +4 5 1 6 2 5 3 4 2 +2 +-47 -37 +4 14 3 20 13 9 12 15 9 +4 -38 -3 -34 -19 -34 -14 -24 -10 +0 diff --git a/codenet/public_test_cases/p01363/input.1.txt b/codenet/public_test_cases/p01363/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6caa534c8a93b959ef7ed0202bb6f99ec58e25c6 --- /dev/null +++ b/codenet/public_test_cases/p01363/input.1.txt @@ -0,0 +1,20 @@ +1 +1 1 +4 -1 0 -2 -1 -1 -2 0 -1 +1 +0 3 +4 1 1 1 2 -1 2 -1 1 +1 +-6 -6 +6 1 -2 2 -2 2 3 -2 3 -2 1 1 1 +1 +-10 0 +4 0 -5 1 -5 1 5 0 5 +1 +10 1 +4 5 1 6 2 5 3 4 2 +2 +-47 -37 +4 14 3 20 13 9 12 15 9 +4 -38 -3 -34 -19 -34 -14 -24 -10 +0 diff --git a/codenet/public_test_cases/p01363/output.0.txt b/codenet/public_test_cases/p01363/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b8a742f3f077619d582cf442ca77c833d6ac830 --- /dev/null +++ b/codenet/public_test_cases/p01363/output.0.txt @@ -0,0 +1,6 @@ +1.00000000 +0.00000000 +3.23606798 +5.00000000 +1.00000000 +11.78517297 diff --git a/codenet/public_test_cases/p01363/output.1.txt b/codenet/public_test_cases/p01363/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b8a742f3f077619d582cf442ca77c833d6ac830 --- /dev/null +++ b/codenet/public_test_cases/p01363/output.1.txt @@ -0,0 +1,6 @@ +1.00000000 +0.00000000 +3.23606798 +5.00000000 +1.00000000 +11.78517297 diff --git a/codenet/public_test_cases/p01364/input.0.txt b/codenet/public_test_cases/p01364/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb440576cba3d65721dec57b93ebba95b607dc50 --- /dev/null +++ b/codenet/public_test_cases/p01364/input.0.txt @@ -0,0 +1,12 @@ +1 1 +180 90 2 +1 1 +180 180 20 +2 10 +360 -360 5 +-90 360 8 +3 2 +100 60 9 +-72 -72 10 +-45 -225 5 +0 0 diff --git a/codenet/public_test_cases/p01364/input.1.txt b/codenet/public_test_cases/p01364/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb440576cba3d65721dec57b93ebba95b607dc50 --- /dev/null +++ b/codenet/public_test_cases/p01364/input.1.txt @@ -0,0 +1,12 @@ +1 1 +180 90 2 +1 1 +180 180 20 +2 10 +360 -360 5 +-90 360 8 +3 2 +100 60 9 +-72 -72 10 +-45 -225 5 +0 0 diff --git a/codenet/public_test_cases/p01364/output.0.txt b/codenet/public_test_cases/p01364/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fbb60dd4f0ba13a55cb1996338fd84cc24d6960 --- /dev/null +++ b/codenet/public_test_cases/p01364/output.0.txt @@ -0,0 +1,8 @@ +3.00000 +3.00000 +0.00000 +62.83185 +12.00000 +0.00000 +-2.44505 +13.12132 diff --git a/codenet/public_test_cases/p01364/output.1.txt b/codenet/public_test_cases/p01364/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fbb60dd4f0ba13a55cb1996338fd84cc24d6960 --- /dev/null +++ b/codenet/public_test_cases/p01364/output.1.txt @@ -0,0 +1,8 @@ +3.00000 +3.00000 +0.00000 +62.83185 +12.00000 +0.00000 +-2.44505 +13.12132 diff --git a/codenet/public_test_cases/p01365/input.0.txt b/codenet/public_test_cases/p01365/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc5d72561c8149fdad1ee12e6b0499f6eb2fab1c --- /dev/null +++ b/codenet/public_test_cases/p01365/input.0.txt @@ -0,0 +1,41 @@ +2 +0 0 +2 +-5 5 0 +5 5 10 +1 +0 6 +2 +5 5 0 +-5 5 10 +1 +6 10 +1 +7 -65 +2 +-65 10 0 +65 1 3 +2 +0 1 +23 24 +2 +0 0 +2 +100 10 0 +-10 10 10 +5 +0 1 +2 3 +4 5 +6 7 +8 9 +2 +10 0 0 +0 10 10 +5 +1 2 +3 4 +5 6 +7 8 +9 10 +0 diff --git a/codenet/public_test_cases/p01365/input.1.txt b/codenet/public_test_cases/p01365/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc5d72561c8149fdad1ee12e6b0499f6eb2fab1c --- /dev/null +++ b/codenet/public_test_cases/p01365/input.1.txt @@ -0,0 +1,41 @@ +2 +0 0 +2 +-5 5 0 +5 5 10 +1 +0 6 +2 +5 5 0 +-5 5 10 +1 +6 10 +1 +7 -65 +2 +-65 10 0 +65 1 3 +2 +0 1 +23 24 +2 +0 0 +2 +100 10 0 +-10 10 10 +5 +0 1 +2 3 +4 5 +6 7 +8 9 +2 +10 0 0 +0 10 10 +5 +1 2 +3 4 +5 6 +7 8 +9 10 +0 diff --git a/codenet/public_test_cases/p01365/output.0.txt b/codenet/public_test_cases/p01365/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9e02a3b7796ef0d05067a41f41378808cf5ce38 --- /dev/null +++ b/codenet/public_test_cases/p01365/output.0.txt @@ -0,0 +1,3 @@ +9.00000000 +2.00000000 +5.98862017 diff --git a/codenet/public_test_cases/p01365/output.1.txt b/codenet/public_test_cases/p01365/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9e02a3b7796ef0d05067a41f41378808cf5ce38 --- /dev/null +++ b/codenet/public_test_cases/p01365/output.1.txt @@ -0,0 +1,3 @@ +9.00000000 +2.00000000 +5.98862017 diff --git a/codenet/public_test_cases/p01366/input.0.txt b/codenet/public_test_cases/p01366/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0fe10e744d5e0c416ddfffd5bf084bb25bd0047 --- /dev/null +++ b/codenet/public_test_cases/p01366/input.0.txt @@ -0,0 +1,33 @@ +3 3 +1 2 1 2 +2 3 2 1 +3 1 3 2 +5 5 +1 2 2 2 +2 3 1 1 +1 4 1 1 +4 5 1 1 +5 3 1 1 +5 10 +1 2 32 10 +1 3 43 43 +1 4 12 52 +1 5 84 23 +2 3 58 42 +2 4 86 99 +2 5 57 83 +3 4 11 32 +3 5 75 21 +4 5 23 43 +5 10 +1 2 1 53 +1 3 1 65 +1 4 1 24 +1 5 1 76 +2 3 1 19 +2 4 1 46 +2 5 1 25 +3 4 1 13 +3 5 1 65 +4 5 1 34 +0 0 diff --git a/codenet/public_test_cases/p01366/input.1.txt b/codenet/public_test_cases/p01366/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0fe10e744d5e0c416ddfffd5bf084bb25bd0047 --- /dev/null +++ b/codenet/public_test_cases/p01366/input.1.txt @@ -0,0 +1,33 @@ +3 3 +1 2 1 2 +2 3 2 1 +3 1 3 2 +5 5 +1 2 2 2 +2 3 1 1 +1 4 1 1 +4 5 1 1 +5 3 1 1 +5 10 +1 2 32 10 +1 3 43 43 +1 4 12 52 +1 5 84 23 +2 3 58 42 +2 4 86 99 +2 5 57 83 +3 4 11 32 +3 5 75 21 +4 5 23 43 +5 10 +1 2 1 53 +1 3 1 65 +1 4 1 24 +1 5 1 76 +2 3 1 19 +2 4 1 46 +2 5 1 25 +3 4 1 13 +3 5 1 65 +4 5 1 34 +0 0 diff --git a/codenet/public_test_cases/p01366/output.0.txt b/codenet/public_test_cases/p01366/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc3be338ae4748f83707a586412c17ec22a93e02 --- /dev/null +++ b/codenet/public_test_cases/p01366/output.0.txt @@ -0,0 +1,4 @@ +3 +5 +137 +218 diff --git a/codenet/public_test_cases/p01366/output.1.txt b/codenet/public_test_cases/p01366/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc3be338ae4748f83707a586412c17ec22a93e02 --- /dev/null +++ b/codenet/public_test_cases/p01366/output.1.txt @@ -0,0 +1,4 @@ +3 +5 +137 +218 diff --git a/codenet/public_test_cases/p01367/input.0.txt b/codenet/public_test_cases/p01367/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd0922417061dd698519b8aaa1271e05159b2b65 --- /dev/null +++ b/codenet/public_test_cases/p01367/input.0.txt @@ -0,0 +1,30 @@ +3 300 +100 50 150 +100 50 150 +100 50 150 +3 300 +100 50 150 +100 50 150 +200 50 150 +9 18 +3 1 1 +3 1 1 +3 1 1 +4 100 1 +5 100 1 +5 100 1 +10 5 3 +10 5 3 +1 7 1000 +10 18 +1 2 3 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +7 8 9 +8 9 10 +9 10 11 +10 11 12 +0 0 diff --git a/codenet/public_test_cases/p01367/input.1.txt b/codenet/public_test_cases/p01367/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd0922417061dd698519b8aaa1271e05159b2b65 --- /dev/null +++ b/codenet/public_test_cases/p01367/input.1.txt @@ -0,0 +1,30 @@ +3 300 +100 50 150 +100 50 150 +100 50 150 +3 300 +100 50 150 +100 50 150 +200 50 150 +9 18 +3 1 1 +3 1 1 +3 1 1 +4 100 1 +5 100 1 +5 100 1 +10 5 3 +10 5 3 +1 7 1000 +10 18 +1 2 3 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +7 8 9 +8 9 10 +9 10 11 +10 11 12 +0 0 diff --git a/codenet/public_test_cases/p01367/output.0.txt b/codenet/public_test_cases/p01367/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0a74072125fe583055f512ca095803b58c07526 --- /dev/null +++ b/codenet/public_test_cases/p01367/output.0.txt @@ -0,0 +1,4 @@ +2 +3 +3 +4 diff --git a/codenet/public_test_cases/p01367/output.1.txt b/codenet/public_test_cases/p01367/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0a74072125fe583055f512ca095803b58c07526 --- /dev/null +++ b/codenet/public_test_cases/p01367/output.1.txt @@ -0,0 +1,4 @@ +2 +3 +3 +4 diff --git a/codenet/public_test_cases/p01368/input.0.txt b/codenet/public_test_cases/p01368/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..96f9aa3df86bc1a1396c07c5e1bf814f8633eece --- /dev/null +++ b/codenet/public_test_cases/p01368/input.0.txt @@ -0,0 +1,35 @@ +3 2 3 +0 1 10 +1 2 10 +0 0 +1 10 +2 0 +3 2 4 +0 1 10 +1 2 10 +0 0 +1 10 +2 20 +0 40 +10 10 10 +0 1 39 +2 3 48 +3 5 20 +4 8 43 +3 9 10 +8 9 40 +3 4 5 +5 7 20 +1 7 93 +1 3 20 +0 0 +1 100000000 +2 100 +3 543 +4 500 +5 400 +6 300 +7 200 +8 100 +9 100 +0 0 0 diff --git a/codenet/public_test_cases/p01368/input.1.txt b/codenet/public_test_cases/p01368/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..96f9aa3df86bc1a1396c07c5e1bf814f8633eece --- /dev/null +++ b/codenet/public_test_cases/p01368/input.1.txt @@ -0,0 +1,35 @@ +3 2 3 +0 1 10 +1 2 10 +0 0 +1 10 +2 0 +3 2 4 +0 1 10 +1 2 10 +0 0 +1 10 +2 20 +0 40 +10 10 10 +0 1 39 +2 3 48 +3 5 20 +4 8 43 +3 9 10 +8 9 40 +3 4 5 +5 7 20 +1 7 93 +1 3 20 +0 0 +1 100000000 +2 100 +3 543 +4 500 +5 400 +6 300 +7 200 +8 100 +9 100 +0 0 0 diff --git a/codenet/public_test_cases/p01368/output.0.txt b/codenet/public_test_cases/p01368/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eb1267296b5c72164a6cf76bcde9d16dd5a83c0 --- /dev/null +++ b/codenet/public_test_cases/p01368/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +4 diff --git a/codenet/public_test_cases/p01368/output.1.txt b/codenet/public_test_cases/p01368/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eb1267296b5c72164a6cf76bcde9d16dd5a83c0 --- /dev/null +++ b/codenet/public_test_cases/p01368/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +4 diff --git a/codenet/public_test_cases/p01388/input.0.txt b/codenet/public_test_cases/p01388/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9aa7a9e7863fbe5ed1dcdf474efa972ae7a4daae --- /dev/null +++ b/codenet/public_test_cases/p01388/input.0.txt @@ -0,0 +1 @@ +KUPCkupcKUPC diff --git a/codenet/public_test_cases/p01388/output.0.txt b/codenet/public_test_cases/p01388/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01388/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01389/input.0.txt b/codenet/public_test_cases/p01389/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4bee545f73996adbace14d0c11483cc5d56df097 --- /dev/null +++ b/codenet/public_test_cases/p01389/input.0.txt @@ -0,0 +1,4 @@ +3 3 +023 +321 +120 diff --git a/codenet/public_test_cases/p01389/output.0.txt b/codenet/public_test_cases/p01389/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01389/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01391/input.0.txt b/codenet/public_test_cases/p01391/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0dd2b56c245c89cd95c2f5aee7d8379b3dcb2295 --- /dev/null +++ b/codenet/public_test_cases/p01391/input.0.txt @@ -0,0 +1,3 @@ +8 2 +1 2 7 8 +4 5 7 8 diff --git a/codenet/public_test_cases/p01391/output.0.txt b/codenet/public_test_cases/p01391/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f8f880f4cba452dd4c4b777420091a8280c9552 --- /dev/null +++ b/codenet/public_test_cases/p01391/output.0.txt @@ -0,0 +1 @@ +01010101 diff --git a/codenet/public_test_cases/p01392/input.0.txt b/codenet/public_test_cases/p01392/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a61e6d0473363a17ef5b5e8fdd57c49dcb6d3d59 --- /dev/null +++ b/codenet/public_test_cases/p01392/input.0.txt @@ -0,0 +1 @@ +18 2 diff --git a/codenet/public_test_cases/p01392/output.0.txt b/codenet/public_test_cases/p01392/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01392/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01393/input.0.txt b/codenet/public_test_cases/p01393/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabdcf858d8622aba2264711f15ccad7b6b33ffc --- /dev/null +++ b/codenet/public_test_cases/p01393/input.0.txt @@ -0,0 +1,3 @@ +2 1 +10 10 10 +-10 10 10 diff --git a/codenet/public_test_cases/p01393/output.0.txt b/codenet/public_test_cases/p01393/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c49766cb9841829dbdb4dd01ba3c80da1b5c9c58 --- /dev/null +++ b/codenet/public_test_cases/p01393/output.0.txt @@ -0,0 +1 @@ +0.50 diff --git a/codenet/public_test_cases/p01395/input.0.txt b/codenet/public_test_cases/p01395/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54c99059a0546e50c09fd5b191c1208664961e05 --- /dev/null +++ b/codenet/public_test_cases/p01395/input.0.txt @@ -0,0 +1,2 @@ +1 100 +1 1 1 diff --git a/codenet/public_test_cases/p01395/output.0.txt b/codenet/public_test_cases/p01395/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..997b0a01edffc3b74257c31a4292f5300f73c4f1 --- /dev/null +++ b/codenet/public_test_cases/p01395/output.0.txt @@ -0,0 +1 @@ +100.0 diff --git a/codenet/public_test_cases/p01396/input.0.txt b/codenet/public_test_cases/p01396/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12280a7cfe1970f45239e01f62a0650514469da6 --- /dev/null +++ b/codenet/public_test_cases/p01396/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 3 2 +7 9 8 +4 6 5 diff --git a/codenet/public_test_cases/p01396/output.0.txt b/codenet/public_test_cases/p01396/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01396/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01397/input.0.txt b/codenet/public_test_cases/p01397/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4371a50934ae6d97aea700881cbfb015854b0419 --- /dev/null +++ b/codenet/public_test_cases/p01397/input.0.txt @@ -0,0 +1,6 @@ +5 5 +0 2 0 2 0 +2 0 0 0 2 +0 0 0 0 0 +2 0 0 0 2 +0 2 0 2 0 diff --git a/codenet/public_test_cases/p01397/output.0.txt b/codenet/public_test_cases/p01397/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01397/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01398/input.0.txt b/codenet/public_test_cases/p01398/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c12eab2ac170ab51f132ed7e230213fc7892ab05 --- /dev/null +++ b/codenet/public_test_cases/p01398/input.0.txt @@ -0,0 +1,18 @@ +1 +tojxo +1 4 +5 +uhcqmlmkv +4 5 +6 9 +3 6 +1 7 +3 6 +5 +shzxadexonr +8 9 +3 9 +5 8 +4 9 +10 11 +0 diff --git a/codenet/public_test_cases/p01398/input.1.txt b/codenet/public_test_cases/p01398/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c12eab2ac170ab51f132ed7e230213fc7892ab05 --- /dev/null +++ b/codenet/public_test_cases/p01398/input.1.txt @@ -0,0 +1,18 @@ +1 +tojxo +1 4 +5 +uhcqmlmkv +4 5 +6 9 +3 6 +1 7 +3 6 +5 +shzxadexonr +8 9 +3 9 +5 8 +4 9 +10 11 +0 diff --git a/codenet/public_test_cases/p01398/output.0.txt b/codenet/public_test_cases/p01398/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bc9ca75bfe10c18acb1912eb1720e6d95b0a882 --- /dev/null +++ b/codenet/public_test_cases/p01398/output.0.txt @@ -0,0 +1,3 @@ +aojwo +shinryaku +shitadegeso diff --git a/codenet/public_test_cases/p01398/output.1.txt b/codenet/public_test_cases/p01398/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bc9ca75bfe10c18acb1912eb1720e6d95b0a882 --- /dev/null +++ b/codenet/public_test_cases/p01398/output.1.txt @@ -0,0 +1,3 @@ +aojwo +shinryaku +shitadegeso diff --git a/codenet/public_test_cases/p01399/input.0.txt b/codenet/public_test_cases/p01399/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bac3c2fd925685a72c4a225bb945cdd9bfbb423 --- /dev/null +++ b/codenet/public_test_cases/p01399/input.0.txt @@ -0,0 +1,7 @@ +3 100 +3 7 4 +5 24 +4 6 12 3 8 +5 1 +1 1 2 2 3 +0 0 diff --git a/codenet/public_test_cases/p01399/input.1.txt b/codenet/public_test_cases/p01399/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bac3c2fd925685a72c4a225bb945cdd9bfbb423 --- /dev/null +++ b/codenet/public_test_cases/p01399/input.1.txt @@ -0,0 +1,7 @@ +3 100 +3 7 4 +5 24 +4 6 12 3 8 +5 1 +1 1 2 2 3 +0 0 diff --git a/codenet/public_test_cases/p01399/output.0.txt b/codenet/public_test_cases/p01399/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0429fae9e5f6d96184dd0c4c28363722419c29ae --- /dev/null +++ b/codenet/public_test_cases/p01399/output.0.txt @@ -0,0 +1,3 @@ +2 +4 +5 diff --git a/codenet/public_test_cases/p01399/output.1.txt b/codenet/public_test_cases/p01399/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0429fae9e5f6d96184dd0c4c28363722419c29ae --- /dev/null +++ b/codenet/public_test_cases/p01399/output.1.txt @@ -0,0 +1,3 @@ +2 +4 +5 diff --git a/codenet/public_test_cases/p01400/input.0.txt b/codenet/public_test_cases/p01400/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..732346f7945dfca21c9a3561a202d5f6c016790c --- /dev/null +++ b/codenet/public_test_cases/p01400/input.0.txt @@ -0,0 +1,15 @@ +4 4 +A B G +A B 40 3 +B C 80 0 +A G 40 0 +B G 80 0 +5 6 +Kusatsu Tokyo Aizu +Tokyo Nagoya 120 3 +Kusatsu Nagoya 40 0 +Kusatsu Kanazawa 40 0 +Kanazawa Aizu 40 0 +Tokyo Kanazawa 40 0 +Tokyo Aizu 80 4 +0 0 diff --git a/codenet/public_test_cases/p01400/input.1.txt b/codenet/public_test_cases/p01400/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..732346f7945dfca21c9a3561a202d5f6c016790c --- /dev/null +++ b/codenet/public_test_cases/p01400/input.1.txt @@ -0,0 +1,15 @@ +4 4 +A B G +A B 40 3 +B C 80 0 +A G 40 0 +B G 80 0 +5 6 +Kusatsu Tokyo Aizu +Tokyo Nagoya 120 3 +Kusatsu Nagoya 40 0 +Kusatsu Kanazawa 40 0 +Kanazawa Aizu 40 0 +Tokyo Kanazawa 40 0 +Tokyo Aizu 80 4 +0 0 diff --git a/codenet/public_test_cases/p01400/output.0.txt b/codenet/public_test_cases/p01400/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5104f3ba92814f8a900b02edfd354d47ebfb143 --- /dev/null +++ b/codenet/public_test_cases/p01400/output.0.txt @@ -0,0 +1,2 @@ +5 +4 diff --git a/codenet/public_test_cases/p01400/output.1.txt b/codenet/public_test_cases/p01400/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5104f3ba92814f8a900b02edfd354d47ebfb143 --- /dev/null +++ b/codenet/public_test_cases/p01400/output.1.txt @@ -0,0 +1,2 @@ +5 +4 diff --git a/codenet/public_test_cases/p01401/input.0.txt b/codenet/public_test_cases/p01401/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f97d6470da3efa32489e87ab107e663c3419c7c --- /dev/null +++ b/codenet/public_test_cases/p01401/input.0.txt @@ -0,0 +1,34 @@ +10 10 +S . . . . . . . . . +. . . . . . . . . . +. . . . 1 . . . . . +. . . . . . . . . . +. . . . . . . . . . +. . . . . . . 3 . . +. . . . . . . . . . +. . . . . 4 . . . . +. . . . . . . . . . +2 . . . . . . . . G +10 10 +S . . . . . 3 . . . +. . 3 . . . . . . . +. . . . 1 . . . . . +. . . . . . 4 . . . +. . 3 . . . 1 . . . +. . . . . . . 3 . . +. . . . . . . . . . +. . . . . 4 . . . . +. . . . . 5 . . . . +2 . . . . . . . . G +10 10 +S . . . . . . . . 1 +. . . . . 5 . . . . +. 4 . . . . . . . . +. . . . 8 . 9 . . . +. . . . 10 . . . . . +. . 7 . G . . . . . +. . . 11 . . . . . . +3 . . . . . . . . 6 +. . . . . . . 2 . . +. . . . . . . . . . +0 0 diff --git a/codenet/public_test_cases/p01401/input.1.txt b/codenet/public_test_cases/p01401/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f97d6470da3efa32489e87ab107e663c3419c7c --- /dev/null +++ b/codenet/public_test_cases/p01401/input.1.txt @@ -0,0 +1,34 @@ +10 10 +S . . . . . . . . . +. . . . . . . . . . +. . . . 1 . . . . . +. . . . . . . . . . +. . . . . . . . . . +. . . . . . . 3 . . +. . . . . . . . . . +. . . . . 4 . . . . +. . . . . . . . . . +2 . . . . . . . . G +10 10 +S . . . . . 3 . . . +. . 3 . . . . . . . +. . . . 1 . . . . . +. . . . . . 4 . . . +. . 3 . . . 1 . . . +. . . . . . . 3 . . +. . . . . . . . . . +. . . . . 4 . . . . +. . . . . 5 . . . . +2 . . . . . . . . G +10 10 +S . . . . . . . . 1 +. . . . . 5 . . . . +. 4 . . . . . . . . +. . . . 8 . 9 . . . +. . . . 10 . . . . . +. . 7 . G . . . . . +. . . 11 . . . . . . +3 . . . . . . . . 6 +. . . . . . . 2 . . +. . . . . . . . . . +0 0 diff --git a/codenet/public_test_cases/p01401/output.0.txt b/codenet/public_test_cases/p01401/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..53937aeeb43a3acb3dc6c84e36e7243c62849fb9 --- /dev/null +++ b/codenet/public_test_cases/p01401/output.0.txt @@ -0,0 +1,3 @@ +38 +36 +71 diff --git a/codenet/public_test_cases/p01401/output.1.txt b/codenet/public_test_cases/p01401/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..53937aeeb43a3acb3dc6c84e36e7243c62849fb9 --- /dev/null +++ b/codenet/public_test_cases/p01401/output.1.txt @@ -0,0 +1,3 @@ +38 +36 +71 diff --git a/codenet/public_test_cases/p01402/input.0.txt b/codenet/public_test_cases/p01402/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..feeebd667105550ff4e338ddec58336e139f68b6 --- /dev/null +++ b/codenet/public_test_cases/p01402/input.0.txt @@ -0,0 +1,28 @@ +100 2 2 2 +A 5 6 +B 7 8 +C 1 2 +D 3 4 +27 2 3 3 +A 8 10 +B 8 10 +C 6 7 +D 5 4 +E 8 9 +27 2 3 2 +A 8 10 +B 8 10 +C 6 7 +D 5 4 +E 8 9 +44 3 6 5 +YamatoNoHito 9 10 +ZettoNoHito 9 10 +TMR 10 10 +SkillNoGroup 8 10 +NanaSama 6 9 +FRPSD 6 8 +Magi3rdDeshi 5 7 +Magi13thDeshi 2 2 +MagicalItoh 4 6 +0 0 0 0 diff --git a/codenet/public_test_cases/p01402/input.1.txt b/codenet/public_test_cases/p01402/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..feeebd667105550ff4e338ddec58336e139f68b6 --- /dev/null +++ b/codenet/public_test_cases/p01402/input.1.txt @@ -0,0 +1,28 @@ +100 2 2 2 +A 5 6 +B 7 8 +C 1 2 +D 3 4 +27 2 3 3 +A 8 10 +B 8 10 +C 6 7 +D 5 4 +E 8 9 +27 2 3 2 +A 8 10 +B 8 10 +C 6 7 +D 5 4 +E 8 9 +44 3 6 5 +YamatoNoHito 9 10 +ZettoNoHito 9 10 +TMR 10 10 +SkillNoGroup 8 10 +NanaSama 6 9 +FRPSD 6 8 +Magi3rdDeshi 5 7 +Magi13thDeshi 2 2 +MagicalItoh 4 6 +0 0 0 0 diff --git a/codenet/public_test_cases/p01402/output.0.txt b/codenet/public_test_cases/p01402/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..205f6a7949140d552f996607f1f2867d2cc88715 --- /dev/null +++ b/codenet/public_test_cases/p01402/output.0.txt @@ -0,0 +1,4 @@ +20 +30 +31 +55 diff --git a/codenet/public_test_cases/p01402/output.1.txt b/codenet/public_test_cases/p01402/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..205f6a7949140d552f996607f1f2867d2cc88715 --- /dev/null +++ b/codenet/public_test_cases/p01402/output.1.txt @@ -0,0 +1,4 @@ +20 +30 +31 +55 diff --git a/codenet/public_test_cases/p01403/input.0.txt b/codenet/public_test_cases/p01403/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e543d3934759d715ac9ca39e71e2b14a992e64e0 --- /dev/null +++ b/codenet/public_test_cases/p01403/input.0.txt @@ -0,0 +1,3 @@ +2 +3 +5 diff --git a/codenet/public_test_cases/p01403/input.1.txt b/codenet/public_test_cases/p01403/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e543d3934759d715ac9ca39e71e2b14a992e64e0 --- /dev/null +++ b/codenet/public_test_cases/p01403/input.1.txt @@ -0,0 +1,3 @@ +2 +3 +5 diff --git a/codenet/public_test_cases/p01403/output.0.txt b/codenet/public_test_cases/p01403/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0dc7263c90abb77ccd1520502336f3bf563b7a1b --- /dev/null +++ b/codenet/public_test_cases/p01403/output.0.txt @@ -0,0 +1,2 @@ +5 +11 diff --git a/codenet/public_test_cases/p01403/output.1.txt b/codenet/public_test_cases/p01403/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0dc7263c90abb77ccd1520502336f3bf563b7a1b --- /dev/null +++ b/codenet/public_test_cases/p01403/output.1.txt @@ -0,0 +1,2 @@ +5 +11 diff --git a/codenet/public_test_cases/p01404/input.0.txt b/codenet/public_test_cases/p01404/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb43f6261ea251e30c056a002c25f9c10877b7a --- /dev/null +++ b/codenet/public_test_cases/p01404/input.0.txt @@ -0,0 +1,22 @@ +3 3 +1 1 900 +0 10 0 +10 45 10 +10 0 0 +3 +5 1 1 +50 1 0 +100 0 1 +5 5 +2 0 9000 +0 0 4 0 0 +0 3 3 3 0 +2 2 2 2 2 +0 0 1 0 0 +0 0 1 0 0 +4 +5 2 0 +10 2 1 +100 2 2 +250 2 3 +0 0 diff --git a/codenet/public_test_cases/p01404/input.1.txt b/codenet/public_test_cases/p01404/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb43f6261ea251e30c056a002c25f9c10877b7a --- /dev/null +++ b/codenet/public_test_cases/p01404/input.1.txt @@ -0,0 +1,22 @@ +3 3 +1 1 900 +0 10 0 +10 45 10 +10 0 0 +3 +5 1 1 +50 1 0 +100 0 1 +5 5 +2 0 9000 +0 0 4 0 0 +0 3 3 3 0 +2 2 2 2 2 +0 0 1 0 0 +0 0 1 0 0 +4 +5 2 0 +10 2 1 +100 2 2 +250 2 3 +0 0 diff --git a/codenet/public_test_cases/p01404/output.0.txt b/codenet/public_test_cases/p01404/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a71da40561a653f6e981259f62155006d37294e --- /dev/null +++ b/codenet/public_test_cases/p01404/output.0.txt @@ -0,0 +1,7 @@ +5 +5 +8 +30 +5 +13 +4 diff --git a/codenet/public_test_cases/p01404/output.1.txt b/codenet/public_test_cases/p01404/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a71da40561a653f6e981259f62155006d37294e --- /dev/null +++ b/codenet/public_test_cases/p01404/output.1.txt @@ -0,0 +1,7 @@ +5 +5 +8 +30 +5 +13 +4 diff --git a/codenet/public_test_cases/p01405/input.0.txt b/codenet/public_test_cases/p01405/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5612c59d1915fabe1454cd4e5844a8c463880428 --- /dev/null +++ b/codenet/public_test_cases/p01405/input.0.txt @@ -0,0 +1,39 @@ +4 +2 1 +0 1 a +2 2 +0 1 a +0 1 b +5 5 +0 1 a +0 2 b +1 3 a +2 3 c +3 4 e +3 3 +0 1 aa +0 2 bce +1 2 a +2 4 +0 1 abc +0 1 def +0 1 ghi +0 1 jkl +2 4 +0 1 ghi +0 1 jkl +0 1 mno +0 1 pqr +6 7 +0 1 haru +0 1 natsu +1 2 wa +2 3 ake +2 4 saron +3 5 bono +4 5 pusu +5 4 +0 1 haruw +1 2 aakeb +2 3 o +3 4 no diff --git a/codenet/public_test_cases/p01405/input.1.txt b/codenet/public_test_cases/p01405/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5612c59d1915fabe1454cd4e5844a8c463880428 --- /dev/null +++ b/codenet/public_test_cases/p01405/input.1.txt @@ -0,0 +1,39 @@ +4 +2 1 +0 1 a +2 2 +0 1 a +0 1 b +5 5 +0 1 a +0 2 b +1 3 a +2 3 c +3 4 e +3 3 +0 1 aa +0 2 bce +1 2 a +2 4 +0 1 abc +0 1 def +0 1 ghi +0 1 jkl +2 4 +0 1 ghi +0 1 jkl +0 1 mno +0 1 pqr +6 7 +0 1 haru +0 1 natsu +1 2 wa +2 3 ake +2 4 saron +3 5 bono +4 5 pusu +5 4 +0 1 haruw +1 2 aakeb +2 3 o +3 4 no diff --git a/codenet/public_test_cases/p01405/output.0.txt b/codenet/public_test_cases/p01405/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c35630e3ebade68a1b866f3b58b95f7533785fc7 --- /dev/null +++ b/codenet/public_test_cases/p01405/output.0.txt @@ -0,0 +1,4 @@ +1 +1 +2 +1 diff --git a/codenet/public_test_cases/p01405/output.1.txt b/codenet/public_test_cases/p01405/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c35630e3ebade68a1b866f3b58b95f7533785fc7 --- /dev/null +++ b/codenet/public_test_cases/p01405/output.1.txt @@ -0,0 +1,4 @@ +1 +1 +2 +1 diff --git a/codenet/public_test_cases/p01406/input.0.txt b/codenet/public_test_cases/p01406/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..303f9b6b696e014d4eda01c657398ebbbc946add --- /dev/null +++ b/codenet/public_test_cases/p01406/input.0.txt @@ -0,0 +1,12 @@ +3 +3 +17 12 7 340 180 +26 22 10 150 270 +27 13 5 100 230 +3 +0 0 8 0 90 +10 10 8 180 0 +50 50 5 180 270 +2 +10 10 5 0 270 +0 0 30 0 90 diff --git a/codenet/public_test_cases/p01406/input.1.txt b/codenet/public_test_cases/p01406/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..303f9b6b696e014d4eda01c657398ebbbc946add --- /dev/null +++ b/codenet/public_test_cases/p01406/input.1.txt @@ -0,0 +1,12 @@ +3 +3 +17 12 7 340 180 +26 22 10 150 270 +27 13 5 100 230 +3 +0 0 8 0 90 +10 10 8 180 0 +50 50 5 180 270 +2 +10 10 5 0 270 +0 0 30 0 90 diff --git a/codenet/public_test_cases/p01406/output.0.txt b/codenet/public_test_cases/p01406/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3cb04507b740b492d5c49c55e8ac5dc39be987f --- /dev/null +++ b/codenet/public_test_cases/p01406/output.0.txt @@ -0,0 +1,3 @@ +3 +2 +2 diff --git a/codenet/public_test_cases/p01406/output.1.txt b/codenet/public_test_cases/p01406/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3cb04507b740b492d5c49c55e8ac5dc39be987f --- /dev/null +++ b/codenet/public_test_cases/p01406/output.1.txt @@ -0,0 +1,3 @@ +3 +2 +2 diff --git a/codenet/public_test_cases/p01407/input.0.txt b/codenet/public_test_cases/p01407/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b0f30eeaa66ca2ac2462980192ab3b312c08cd3 --- /dev/null +++ b/codenet/public_test_cases/p01407/input.0.txt @@ -0,0 +1,4 @@ +3 10 150 250 +100 20 123 +201 10 67 +202 10 45 diff --git a/codenet/public_test_cases/p01407/input.1.txt b/codenet/public_test_cases/p01407/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f4a70485197a803d2a9d175972617deab633fb5 --- /dev/null +++ b/codenet/public_test_cases/p01407/input.1.txt @@ -0,0 +1,2 @@ +1 7 20 90 +55 5 73 diff --git a/codenet/public_test_cases/p01407/input.2.txt b/codenet/public_test_cases/p01407/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c3d6bdf4b70d39a1d8f9fad6abca37cb156a814 --- /dev/null +++ b/codenet/public_test_cases/p01407/input.2.txt @@ -0,0 +1,11 @@ +10 2 1000 2000 +400 300 1 +600 200 1 +700 800 1 +700 500 1 +900 600 1 +1000 700 1 +1300 900 1 +1400 400 1 +1500 1000 1 +2000 100 1 diff --git a/codenet/public_test_cases/p01407/input.3.txt b/codenet/public_test_cases/p01407/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b0f30eeaa66ca2ac2462980192ab3b312c08cd3 --- /dev/null +++ b/codenet/public_test_cases/p01407/input.3.txt @@ -0,0 +1,4 @@ +3 10 150 250 +100 20 123 +201 10 67 +202 10 45 diff --git a/codenet/public_test_cases/p01407/output.0.txt b/codenet/public_test_cases/p01407/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..598ed30e89eae2dd245fbeb4558c57a57e10ea6d --- /dev/null +++ b/codenet/public_test_cases/p01407/output.0.txt @@ -0,0 +1 @@ +190 diff --git a/codenet/public_test_cases/p01407/output.1.txt b/codenet/public_test_cases/p01407/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d69c74c8b95c8c0574cec707ab1a39d5926b9398 --- /dev/null +++ b/codenet/public_test_cases/p01407/output.1.txt @@ -0,0 +1 @@ +73 diff --git a/codenet/public_test_cases/p01407/output.2.txt b/codenet/public_test_cases/p01407/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01407/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01407/output.3.txt b/codenet/public_test_cases/p01407/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..598ed30e89eae2dd245fbeb4558c57a57e10ea6d --- /dev/null +++ b/codenet/public_test_cases/p01407/output.3.txt @@ -0,0 +1 @@ +190 diff --git a/codenet/public_test_cases/p01408/input.0.txt b/codenet/public_test_cases/p01408/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..137968e7029c9e8f4b84af2bf329db389034065d --- /dev/null +++ b/codenet/public_test_cases/p01408/input.0.txt @@ -0,0 +1,4 @@ +4 3 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p01408/input.1.txt b/codenet/public_test_cases/p01408/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c10d33ca00c79b2468a0aa071314560a78f097d --- /dev/null +++ b/codenet/public_test_cases/p01408/input.1.txt @@ -0,0 +1,6 @@ +11 5 +1 2 +3 4 +5 6 +7 8 +9 10 diff --git a/codenet/public_test_cases/p01408/input.2.txt b/codenet/public_test_cases/p01408/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..137968e7029c9e8f4b84af2bf329db389034065d --- /dev/null +++ b/codenet/public_test_cases/p01408/input.2.txt @@ -0,0 +1,4 @@ +4 3 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p01408/input.3.txt b/codenet/public_test_cases/p01408/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cac59b9f07f878b1027c6a7e470826b6103b34ac --- /dev/null +++ b/codenet/public_test_cases/p01408/input.3.txt @@ -0,0 +1,15 @@ +9 14 +1 2 +1 3 +2 3 +3 4 +3 5 +3 6 +3 7 +3 8 +3 9 +4 5 +4 6 +5 6 +7 8 +8 9 diff --git a/codenet/public_test_cases/p01408/output.0.txt b/codenet/public_test_cases/p01408/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p01408/output.0.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p01408/output.1.txt b/codenet/public_test_cases/p01408/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..68ceb98804160c3b00040a8d60e7f66c0a64de98 --- /dev/null +++ b/codenet/public_test_cases/p01408/output.1.txt @@ -0,0 +1,2 @@ +6 +32 diff --git a/codenet/public_test_cases/p01408/output.2.txt b/codenet/public_test_cases/p01408/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p01408/output.2.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p01408/output.3.txt b/codenet/public_test_cases/p01408/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfbeb15fac5256c14238255de929074ca952a96e --- /dev/null +++ b/codenet/public_test_cases/p01408/output.3.txt @@ -0,0 +1,2 @@ +4 +6 diff --git a/codenet/public_test_cases/p01409/input.0.txt b/codenet/public_test_cases/p01409/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..619d0b4112bb48799df1482ed258d4328e9a3984 --- /dev/null +++ b/codenet/public_test_cases/p01409/input.0.txt @@ -0,0 +1,2 @@ +ICPC +CPCPC diff --git a/codenet/public_test_cases/p01409/input.1.txt b/codenet/public_test_cases/p01409/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..619d0b4112bb48799df1482ed258d4328e9a3984 --- /dev/null +++ b/codenet/public_test_cases/p01409/input.1.txt @@ -0,0 +1,2 @@ +ICPC +CPCPC diff --git a/codenet/public_test_cases/p01409/input.2.txt b/codenet/public_test_cases/p01409/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..98c6f1440ad57ae7abd490fa084a1238a384853b --- /dev/null +++ b/codenet/public_test_cases/p01409/input.2.txt @@ -0,0 +1,2 @@ +MYON +USAGI diff --git a/codenet/public_test_cases/p01409/input.3.txt b/codenet/public_test_cases/p01409/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..064833e4e4173f4461dd53212252e1e993f91af2 --- /dev/null +++ b/codenet/public_test_cases/p01409/input.3.txt @@ -0,0 +1,2 @@ +BABBAB +ABBA diff --git a/codenet/public_test_cases/p01409/output.0.txt b/codenet/public_test_cases/p01409/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01409/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01409/output.1.txt b/codenet/public_test_cases/p01409/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01409/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01409/output.2.txt b/codenet/public_test_cases/p01409/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01409/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01409/output.3.txt b/codenet/public_test_cases/p01409/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01409/output.3.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01410/input.0.txt b/codenet/public_test_cases/p01410/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be5d179de1320c20bbbcdad3607756b6d1680c31 --- /dev/null +++ b/codenet/public_test_cases/p01410/input.0.txt @@ -0,0 +1,4 @@ +3 +10 40 +10 40 +20 30 diff --git a/codenet/public_test_cases/p01410/input.1.txt b/codenet/public_test_cases/p01410/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..be5d179de1320c20bbbcdad3607756b6d1680c31 --- /dev/null +++ b/codenet/public_test_cases/p01410/input.1.txt @@ -0,0 +1,4 @@ +3 +10 40 +10 40 +20 30 diff --git a/codenet/public_test_cases/p01410/input.2.txt b/codenet/public_test_cases/p01410/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..832c36e16729902d033d7600badfba284a4a6ea2 --- /dev/null +++ b/codenet/public_test_cases/p01410/input.2.txt @@ -0,0 +1,5 @@ +4 +1 2 +2 3 +3 4 +4 1 diff --git a/codenet/public_test_cases/p01410/output.0.txt b/codenet/public_test_cases/p01410/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p01410/output.0.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p01410/output.1.txt b/codenet/public_test_cases/p01410/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p01410/output.1.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p01410/output.2.txt b/codenet/public_test_cases/p01410/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01410/output.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01411/input.0.txt b/codenet/public_test_cases/p01411/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74943bb51d66de5d3c21f63c809caf03e8c353ea --- /dev/null +++ b/codenet/public_test_cases/p01411/input.0.txt @@ -0,0 +1,3 @@ +9 4 3 2 1 +2 1 +7 3 diff --git a/codenet/public_test_cases/p01411/input.1.txt b/codenet/public_test_cases/p01411/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9da3abb49675c9a42c2c74ec5ad9aeb24c8af407 --- /dev/null +++ b/codenet/public_test_cases/p01411/input.1.txt @@ -0,0 +1,3 @@ +9 4 3 2 3 +2 1 +7 3 diff --git a/codenet/public_test_cases/p01411/input.2.txt b/codenet/public_test_cases/p01411/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74943bb51d66de5d3c21f63c809caf03e8c353ea --- /dev/null +++ b/codenet/public_test_cases/p01411/input.2.txt @@ -0,0 +1,3 @@ +9 4 3 2 1 +2 1 +7 3 diff --git a/codenet/public_test_cases/p01411/output.0.txt b/codenet/public_test_cases/p01411/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f99627272a36a0acbbbdc2a3b96613ea50bd69f --- /dev/null +++ b/codenet/public_test_cases/p01411/output.0.txt @@ -0,0 +1 @@ +0.571428571 diff --git a/codenet/public_test_cases/p01411/output.1.txt b/codenet/public_test_cases/p01411/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00cf2295ae6ec302cb058079de1d4a501d154c01 --- /dev/null +++ b/codenet/public_test_cases/p01411/output.1.txt @@ -0,0 +1 @@ +0.375661376 diff --git a/codenet/public_test_cases/p01411/output.2.txt b/codenet/public_test_cases/p01411/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f99627272a36a0acbbbdc2a3b96613ea50bd69f --- /dev/null +++ b/codenet/public_test_cases/p01411/output.2.txt @@ -0,0 +1 @@ +0.571428571 diff --git a/codenet/public_test_cases/p01412/input.0.txt b/codenet/public_test_cases/p01412/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82ce1652d7070516de8f52c40a64e27d1bb4d772 --- /dev/null +++ b/codenet/public_test_cases/p01412/input.0.txt @@ -0,0 +1,5 @@ +4 +7 +5 +10 +6 diff --git a/codenet/public_test_cases/p01412/input.1.txt b/codenet/public_test_cases/p01412/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..582d858463ce0429a3b1f5f60cfe25a188e72572 --- /dev/null +++ b/codenet/public_test_cases/p01412/input.1.txt @@ -0,0 +1,4 @@ +3 +0 +0 +1000000000 diff --git a/codenet/public_test_cases/p01412/input.2.txt b/codenet/public_test_cases/p01412/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..82ce1652d7070516de8f52c40a64e27d1bb4d772 --- /dev/null +++ b/codenet/public_test_cases/p01412/input.2.txt @@ -0,0 +1,5 @@ +4 +7 +5 +10 +6 diff --git a/codenet/public_test_cases/p01412/output.0.txt b/codenet/public_test_cases/p01412/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..459e27ca69be020c33ba2d8f61532a57a8e2ef24 --- /dev/null +++ b/codenet/public_test_cases/p01412/output.0.txt @@ -0,0 +1,4 @@ +5 +6 +7 +10 diff --git a/codenet/public_test_cases/p01412/output.1.txt b/codenet/public_test_cases/p01412/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..17cb999bb0c21363b09bca4caa27c7edeb959db7 --- /dev/null +++ b/codenet/public_test_cases/p01412/output.1.txt @@ -0,0 +1,3 @@ +1000000000 +0 +0 diff --git a/codenet/public_test_cases/p01412/output.2.txt b/codenet/public_test_cases/p01412/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..459e27ca69be020c33ba2d8f61532a57a8e2ef24 --- /dev/null +++ b/codenet/public_test_cases/p01412/output.2.txt @@ -0,0 +1,4 @@ +5 +6 +7 +10 diff --git a/codenet/public_test_cases/p01413/input.0.txt b/codenet/public_test_cases/p01413/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaaf132db3becb74451248efed4e3d2cd5eceb94 --- /dev/null +++ b/codenet/public_test_cases/p01413/input.0.txt @@ -0,0 +1,7 @@ +2 2 100 20 +alfalfa 10 10 +carrot 5 10 +1 1 6 +carrot 4 +1 -3 0 +alfalfa 5 diff --git a/codenet/public_test_cases/p01413/input.1.txt b/codenet/public_test_cases/p01413/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef3cee9c8ceda8e6da216336054062c7e03af5a4 --- /dev/null +++ b/codenet/public_test_cases/p01413/input.1.txt @@ -0,0 +1,11 @@ +2 3 100 20 +vim 10 10 +emacs 5 10 +vstudio 65 100 +2 1 6 +emacs 4 +vstudio 13 +3 -3 0 +vim 5 +emacs 9 +vstudio 62 diff --git a/codenet/public_test_cases/p01413/input.2.txt b/codenet/public_test_cases/p01413/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaaf132db3becb74451248efed4e3d2cd5eceb94 --- /dev/null +++ b/codenet/public_test_cases/p01413/input.2.txt @@ -0,0 +1,7 @@ +2 2 100 20 +alfalfa 10 10 +carrot 5 10 +1 1 6 +carrot 4 +1 -3 0 +alfalfa 5 diff --git a/codenet/public_test_cases/p01413/output.0.txt b/codenet/public_test_cases/p01413/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cd1cfa2cfe0f845d31839e6c8500e55df8fad41 --- /dev/null +++ b/codenet/public_test_cases/p01413/output.0.txt @@ -0,0 +1 @@ +170 diff --git a/codenet/public_test_cases/p01413/output.1.txt b/codenet/public_test_cases/p01413/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..90afb3e998fd880687c5db3cfb3c166313f2483c --- /dev/null +++ b/codenet/public_test_cases/p01413/output.1.txt @@ -0,0 +1 @@ +183 diff --git a/codenet/public_test_cases/p01413/output.2.txt b/codenet/public_test_cases/p01413/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cd1cfa2cfe0f845d31839e6c8500e55df8fad41 --- /dev/null +++ b/codenet/public_test_cases/p01413/output.2.txt @@ -0,0 +1 @@ +170 diff --git a/codenet/public_test_cases/p01414/input.0.txt b/codenet/public_test_cases/p01414/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd11b57fd963afb6084ba64600c6a3da2e5a450 --- /dev/null +++ b/codenet/public_test_cases/p01414/input.0.txt @@ -0,0 +1,7 @@ +2 +4 4 +1 1 +RRRR +RRGR +RBRR +RRRR diff --git a/codenet/public_test_cases/p01414/input.1.txt b/codenet/public_test_cases/p01414/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8264d5f1b0289b570115a3483fab804fabe30dcf --- /dev/null +++ b/codenet/public_test_cases/p01414/input.1.txt @@ -0,0 +1,6 @@ +1 +2 3 +RRGG +BRGG +BRRR +BRRR diff --git a/codenet/public_test_cases/p01414/input.2.txt b/codenet/public_test_cases/p01414/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd11b57fd963afb6084ba64600c6a3da2e5a450 --- /dev/null +++ b/codenet/public_test_cases/p01414/input.2.txt @@ -0,0 +1,7 @@ +2 +4 4 +1 1 +RRRR +RRGR +RBRR +RRRR diff --git a/codenet/public_test_cases/p01414/output.0.txt b/codenet/public_test_cases/p01414/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01414/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01414/output.1.txt b/codenet/public_test_cases/p01414/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01414/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01414/output.2.txt b/codenet/public_test_cases/p01414/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01414/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01415/input.0.txt b/codenet/public_test_cases/p01415/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3bccf7c7fdd266b48813250e5e9a113c07ae4d7 --- /dev/null +++ b/codenet/public_test_cases/p01415/input.0.txt @@ -0,0 +1,2 @@ +1 1 1 2 3 100 +50 diff --git a/codenet/public_test_cases/p01415/input.1.txt b/codenet/public_test_cases/p01415/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3bccf7c7fdd266b48813250e5e9a113c07ae4d7 --- /dev/null +++ b/codenet/public_test_cases/p01415/input.1.txt @@ -0,0 +1,2 @@ +1 1 1 2 3 100 +50 diff --git a/codenet/public_test_cases/p01415/input.2.txt b/codenet/public_test_cases/p01415/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d6d86ac8763334e4290ad52bbe4e2f5f043187c --- /dev/null +++ b/codenet/public_test_cases/p01415/input.2.txt @@ -0,0 +1,4 @@ +3 1 1 2 3 100 +49 +50 +51 diff --git a/codenet/public_test_cases/p01415/output.0.txt b/codenet/public_test_cases/p01415/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..97abf75a141be5ca24c9d0276483797e59fe964f --- /dev/null +++ b/codenet/public_test_cases/p01415/output.0.txt @@ -0,0 +1 @@ +49.500000000 diff --git a/codenet/public_test_cases/p01415/output.1.txt b/codenet/public_test_cases/p01415/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97abf75a141be5ca24c9d0276483797e59fe964f --- /dev/null +++ b/codenet/public_test_cases/p01415/output.1.txt @@ -0,0 +1 @@ +49.500000000 diff --git a/codenet/public_test_cases/p01415/output.2.txt b/codenet/public_test_cases/p01415/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ed8cc5354f1e0812469b5b5a8652223426f2e4c --- /dev/null +++ b/codenet/public_test_cases/p01415/output.2.txt @@ -0,0 +1 @@ +48.666666667 diff --git a/codenet/public_test_cases/p01416/input.0.txt b/codenet/public_test_cases/p01416/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82173bfbba3b5b9aec22f9327441f0c44444189d --- /dev/null +++ b/codenet/public_test_cases/p01416/input.0.txt @@ -0,0 +1,6 @@ +5 10 +..A....... +.......B.. +.......... +..B....... +..A.CC.... diff --git a/codenet/public_test_cases/p01416/input.1.txt b/codenet/public_test_cases/p01416/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9d494dd2bea3d993562dfaefe2f99e4bcf6a898 --- /dev/null +++ b/codenet/public_test_cases/p01416/input.1.txt @@ -0,0 +1,4 @@ +3 3 +ABC +D.D +CBA diff --git a/codenet/public_test_cases/p01416/input.2.txt b/codenet/public_test_cases/p01416/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..82173bfbba3b5b9aec22f9327441f0c44444189d --- /dev/null +++ b/codenet/public_test_cases/p01416/input.2.txt @@ -0,0 +1,6 @@ +5 10 +..A....... +.......B.. +.......... +..B....... +..A.CC.... diff --git a/codenet/public_test_cases/p01416/input.3.txt b/codenet/public_test_cases/p01416/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..76b44a91162970ee7ed63706b35a58c65eadc1bf --- /dev/null +++ b/codenet/public_test_cases/p01416/input.3.txt @@ -0,0 +1,6 @@ +5 7 +NUTUBOR +QT.SZRQ +SANAGIP +LMDGZBM +KLKIODP diff --git a/codenet/public_test_cases/p01416/output.0.txt b/codenet/public_test_cases/p01416/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01416/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01416/output.1.txt b/codenet/public_test_cases/p01416/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01416/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01416/output.2.txt b/codenet/public_test_cases/p01416/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01416/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01416/output.3.txt b/codenet/public_test_cases/p01416/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p01416/output.3.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p01417/input.0.txt b/codenet/public_test_cases/p01417/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c064451d93a6eb2cef770de671f6f420f792f11c --- /dev/null +++ b/codenet/public_test_cases/p01417/input.0.txt @@ -0,0 +1,4 @@ +3 2 +0 0 0 +10 10 10 +100 100 100 diff --git a/codenet/public_test_cases/p01417/input.1.txt b/codenet/public_test_cases/p01417/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60145b6ecc3d54580c9eb2919df59c190fd8a62e --- /dev/null +++ b/codenet/public_test_cases/p01417/input.1.txt @@ -0,0 +1,3 @@ +2 1 +1.0 1.0 1.0 +0.0 0.0 0.0 diff --git a/codenet/public_test_cases/p01417/input.2.txt b/codenet/public_test_cases/p01417/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..462fe5d460a86bef315c6a8a8095a5cebe4411c4 --- /dev/null +++ b/codenet/public_test_cases/p01417/input.2.txt @@ -0,0 +1,6 @@ +5 3 +12.0 15.0 9.0 +10.0 -3.0 2.2 +3.5 6.8 9.0 +2.1 4.4 5.9 +1.2 4.0 -5.4 diff --git a/codenet/public_test_cases/p01417/input.3.txt b/codenet/public_test_cases/p01417/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c064451d93a6eb2cef770de671f6f420f792f11c --- /dev/null +++ b/codenet/public_test_cases/p01417/input.3.txt @@ -0,0 +1,4 @@ +3 2 +0 0 0 +10 10 10 +100 100 100 diff --git a/codenet/public_test_cases/p01417/output.0.txt b/codenet/public_test_cases/p01417/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e98aafc398692ed1df6f4b010a6a2c0325ac706e --- /dev/null +++ b/codenet/public_test_cases/p01417/output.0.txt @@ -0,0 +1 @@ +30000.00000000000000000000 diff --git a/codenet/public_test_cases/p01417/output.1.txt b/codenet/public_test_cases/p01417/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..30510ba1e67cfacc2fcbfd622ff9118cd19b3a28 --- /dev/null +++ b/codenet/public_test_cases/p01417/output.1.txt @@ -0,0 +1 @@ +0.00000000000000000000 diff --git a/codenet/public_test_cases/p01417/output.2.txt b/codenet/public_test_cases/p01417/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb2ecab264e122e469ad04fc1c1bcd3c5072721a --- /dev/null +++ b/codenet/public_test_cases/p01417/output.2.txt @@ -0,0 +1 @@ +1003.44000000000005456968 diff --git a/codenet/public_test_cases/p01417/output.3.txt b/codenet/public_test_cases/p01417/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e98aafc398692ed1df6f4b010a6a2c0325ac706e --- /dev/null +++ b/codenet/public_test_cases/p01417/output.3.txt @@ -0,0 +1 @@ +30000.00000000000000000000 diff --git a/codenet/public_test_cases/p01418/input.0.txt b/codenet/public_test_cases/p01418/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c76b4d1d7015d775bf5e664f1409df6676c586f4 --- /dev/null +++ b/codenet/public_test_cases/p01418/input.0.txt @@ -0,0 +1,4 @@ +3 0 2 +0.10000000000 +0.50000000000 +1.00000000000 diff --git a/codenet/public_test_cases/p01418/input.1.txt b/codenet/public_test_cases/p01418/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb442152f66ba639cc5c3b5fb2b404987f440574 --- /dev/null +++ b/codenet/public_test_cases/p01418/input.1.txt @@ -0,0 +1,4 @@ +3 0 2 +0.10000000000 +0.00000100000 +0.37500000000 diff --git a/codenet/public_test_cases/p01418/input.2.txt b/codenet/public_test_cases/p01418/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d620020e97a1f86cd233618e470b8129d4b3107a --- /dev/null +++ b/codenet/public_test_cases/p01418/input.2.txt @@ -0,0 +1,4 @@ +3 0 2 +0.10000000000 +0.37499999977 +1.00000000000 diff --git a/codenet/public_test_cases/p01418/input.3.txt b/codenet/public_test_cases/p01418/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c76b4d1d7015d775bf5e664f1409df6676c586f4 --- /dev/null +++ b/codenet/public_test_cases/p01418/input.3.txt @@ -0,0 +1,4 @@ +3 0 2 +0.10000000000 +0.50000000000 +1.00000000000 diff --git a/codenet/public_test_cases/p01418/input.4.txt b/codenet/public_test_cases/p01418/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d122d6734f9a25c23f1ca438e69ff0e97ead6286 --- /dev/null +++ b/codenet/public_test_cases/p01418/input.4.txt @@ -0,0 +1,4 @@ +3 0 2 +0.20000000000 +0.00000100000 +0.37500000000 diff --git a/codenet/public_test_cases/p01418/output.0.txt b/codenet/public_test_cases/p01418/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cc0c9f209a4992ecc63dd1a6afadedac77e148e --- /dev/null +++ b/codenet/public_test_cases/p01418/output.0.txt @@ -0,0 +1 @@ +0.900000 diff --git a/codenet/public_test_cases/p01418/output.1.txt b/codenet/public_test_cases/p01418/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..226f407660089e719dd2cb7c83e08ae19acea534 --- /dev/null +++ b/codenet/public_test_cases/p01418/output.1.txt @@ -0,0 +1 @@ +0.729000 diff --git a/codenet/public_test_cases/p01418/output.2.txt b/codenet/public_test_cases/p01418/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bdaddc448e76d4155ba58020df4edcedb42e9b0 --- /dev/null +++ b/codenet/public_test_cases/p01418/output.2.txt @@ -0,0 +1 @@ +0.810000 diff --git a/codenet/public_test_cases/p01418/output.3.txt b/codenet/public_test_cases/p01418/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cc0c9f209a4992ecc63dd1a6afadedac77e148e --- /dev/null +++ b/codenet/public_test_cases/p01418/output.3.txt @@ -0,0 +1 @@ +0.900000 diff --git a/codenet/public_test_cases/p01418/output.4.txt b/codenet/public_test_cases/p01418/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b6d10961336d7175615444ac994434725882aa4 --- /dev/null +++ b/codenet/public_test_cases/p01418/output.4.txt @@ -0,0 +1 @@ +0.512000 diff --git a/codenet/public_test_cases/p01419/input.0.txt b/codenet/public_test_cases/p01419/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..895fd724773f37fd9853e5c249b930f80da67ded --- /dev/null +++ b/codenet/public_test_cases/p01419/input.0.txt @@ -0,0 +1,7 @@ +1 3 2 +... +1 1 1 +1 2 1 +1 1 1 +0 0 +0 2 diff --git a/codenet/public_test_cases/p01419/input.1.txt b/codenet/public_test_cases/p01419/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..30eef881ea771c9012b53e208d500df36996f6cd --- /dev/null +++ b/codenet/public_test_cases/p01419/input.1.txt @@ -0,0 +1,18 @@ +3 3 5 +... +.## +..# +1 1 1 +1 0 0 +1 1 0 +3 3 3 +3 0 0 +3 3 0 +5 4 5 +4 0 0 +5 4 0 +1 0 +2 1 +0 2 +2 0 +0 0 diff --git a/codenet/public_test_cases/p01419/input.2.txt b/codenet/public_test_cases/p01419/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..895fd724773f37fd9853e5c249b930f80da67ded --- /dev/null +++ b/codenet/public_test_cases/p01419/input.2.txt @@ -0,0 +1,7 @@ +1 3 2 +... +1 1 1 +1 2 1 +1 1 1 +0 0 +0 2 diff --git a/codenet/public_test_cases/p01419/input.3.txt b/codenet/public_test_cases/p01419/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5151dff234d100e1cdeaae4929ce99863212cc4a --- /dev/null +++ b/codenet/public_test_cases/p01419/input.3.txt @@ -0,0 +1,31 @@ +5 5 10 +.### +.... +.# +..#.# +.... +0 12 0 0 0 +0 4 3 2 10 +0 0 0 99 0 +11 13 0 2 0 +0 1 1 2 1 +0 4 0 0 0 +0 13 8 2 4 +0 0 0 16 0 +1 1 0 2 0 +0 2 3 1 99 +0 2 0 0 0 +0 12 2 12 2 +0 0 0 3 0 +4 14 0 16 0 +0 2 14 2 90 +0 1 +3 0 +4 4 +1 4 +1 1 +4 4 +1 1 +4 3 +3 0 +1 4 diff --git a/codenet/public_test_cases/p01419/output.0.txt b/codenet/public_test_cases/p01419/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01419/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01419/output.1.txt b/codenet/public_test_cases/p01419/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..987e7ca9a76df749c99da91a829e772e9aa622f6 --- /dev/null +++ b/codenet/public_test_cases/p01419/output.1.txt @@ -0,0 +1 @@ +77 diff --git a/codenet/public_test_cases/p01419/output.2.txt b/codenet/public_test_cases/p01419/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01419/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01419/output.3.txt b/codenet/public_test_cases/p01419/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e68a0f7e9e1d2da6cdabd3d1588fc2eaa0c9e64 --- /dev/null +++ b/codenet/public_test_cases/p01419/output.3.txt @@ -0,0 +1 @@ +777 diff --git a/codenet/public_test_cases/p01420/input.0.txt b/codenet/public_test_cases/p01420/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..517648c7ff1d33b49d4c17fb7524c8718c247308 --- /dev/null +++ b/codenet/public_test_cases/p01420/input.0.txt @@ -0,0 +1,3 @@ +2 2 50 +30 50 1 +30 50 2 diff --git a/codenet/public_test_cases/p01420/input.1.txt b/codenet/public_test_cases/p01420/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7cb71cdee5dbb4db076059a9ce26003c57efe2d --- /dev/null +++ b/codenet/public_test_cases/p01420/input.1.txt @@ -0,0 +1,3 @@ +2 1 100 +100 100 10 +0 100 1 diff --git a/codenet/public_test_cases/p01420/input.2.txt b/codenet/public_test_cases/p01420/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..51eb8472cb05f735ce6a575b10c22f87d0b7a847 --- /dev/null +++ b/codenet/public_test_cases/p01420/input.2.txt @@ -0,0 +1,3 @@ +2 2 50 +30 0 1 +30 50 2 diff --git a/codenet/public_test_cases/p01420/input.3.txt b/codenet/public_test_cases/p01420/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..517648c7ff1d33b49d4c17fb7524c8718c247308 --- /dev/null +++ b/codenet/public_test_cases/p01420/input.3.txt @@ -0,0 +1,3 @@ +2 2 50 +30 50 1 +30 50 2 diff --git a/codenet/public_test_cases/p01420/input.4.txt b/codenet/public_test_cases/p01420/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7031376eee20197170cce0cc6d9004199f2343ca --- /dev/null +++ b/codenet/public_test_cases/p01420/input.4.txt @@ -0,0 +1,4 @@ +3 1 100 +50 1 1 +50 1 1 +50 1 1 diff --git a/codenet/public_test_cases/p01420/output.0.txt b/codenet/public_test_cases/p01420/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..700f2b1aef12f5957b468e10659129613c45c257 --- /dev/null +++ b/codenet/public_test_cases/p01420/output.0.txt @@ -0,0 +1,2 @@ +0.28770000 +0.71230000 diff --git a/codenet/public_test_cases/p01420/output.1.txt b/codenet/public_test_cases/p01420/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..969e882926113ee88e387b38747ab9b338c60567 --- /dev/null +++ b/codenet/public_test_cases/p01420/output.1.txt @@ -0,0 +1,2 @@ +0.00000000 +1.00000000 diff --git a/codenet/public_test_cases/p01420/output.2.txt b/codenet/public_test_cases/p01420/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a28e020d99b44f32890860f86b947daa2ea291c4 --- /dev/null +++ b/codenet/public_test_cases/p01420/output.2.txt @@ -0,0 +1,2 @@ +0.51000000 +0.49000000 diff --git a/codenet/public_test_cases/p01420/output.3.txt b/codenet/public_test_cases/p01420/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..700f2b1aef12f5957b468e10659129613c45c257 --- /dev/null +++ b/codenet/public_test_cases/p01420/output.3.txt @@ -0,0 +1,2 @@ +0.28770000 +0.71230000 diff --git a/codenet/public_test_cases/p01420/output.4.txt b/codenet/public_test_cases/p01420/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..428d8e80f43d17906263eae834b8183e48815753 --- /dev/null +++ b/codenet/public_test_cases/p01420/output.4.txt @@ -0,0 +1,3 @@ +0.12500000 +0.12500000 +0.12500000 diff --git a/codenet/public_test_cases/p01421/input.0.txt b/codenet/public_test_cases/p01421/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3304c9c1bf0a75fd9fd95d16d84d0d00bb4f027e --- /dev/null +++ b/codenet/public_test_cases/p01421/input.0.txt @@ -0,0 +1,3 @@ +2 1 +2 1 +2 1 diff --git a/codenet/public_test_cases/p01421/input.1.txt b/codenet/public_test_cases/p01421/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3304c9c1bf0a75fd9fd95d16d84d0d00bb4f027e --- /dev/null +++ b/codenet/public_test_cases/p01421/input.1.txt @@ -0,0 +1,3 @@ +2 1 +2 1 +2 1 diff --git a/codenet/public_test_cases/p01421/input.2.txt b/codenet/public_test_cases/p01421/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bef3b5a2820701ed81f9ab0a8ece97b1087ce4a2 --- /dev/null +++ b/codenet/public_test_cases/p01421/input.2.txt @@ -0,0 +1,3 @@ +2 1 +1 2 +2 1 diff --git a/codenet/public_test_cases/p01421/input.3.txt b/codenet/public_test_cases/p01421/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b8ac05bfe34fe94a18c828e34e01b642394a223 --- /dev/null +++ b/codenet/public_test_cases/p01421/input.3.txt @@ -0,0 +1,5 @@ +3 3 +3 2 +1 2 +3 1 +1 3 diff --git a/codenet/public_test_cases/p01421/output.0.txt b/codenet/public_test_cases/p01421/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b261da18d51a39dc2cf0d156791e9c0b35dd83f4 --- /dev/null +++ b/codenet/public_test_cases/p01421/output.0.txt @@ -0,0 +1,2 @@ +1 +0 diff --git a/codenet/public_test_cases/p01421/output.1.txt b/codenet/public_test_cases/p01421/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b261da18d51a39dc2cf0d156791e9c0b35dd83f4 --- /dev/null +++ b/codenet/public_test_cases/p01421/output.1.txt @@ -0,0 +1,2 @@ +1 +0 diff --git a/codenet/public_test_cases/p01421/output.2.txt b/codenet/public_test_cases/p01421/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8183f05f5db68b3934e93f4bf6bed2bb664e0b5 --- /dev/null +++ b/codenet/public_test_cases/p01421/output.2.txt @@ -0,0 +1,3 @@ +1 +1 +1 diff --git a/codenet/public_test_cases/p01421/output.3.txt b/codenet/public_test_cases/p01421/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd0f1430b7c8e910d00fb5aa5d65f53c3c41df20 --- /dev/null +++ b/codenet/public_test_cases/p01421/output.3.txt @@ -0,0 +1,4 @@ +2 +2 +1 +3 diff --git a/codenet/public_test_cases/p01422/input.0.txt b/codenet/public_test_cases/p01422/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..499aaee910e71b3cb0d991854ec235e17579a629 --- /dev/null +++ b/codenet/public_test_cases/p01422/input.0.txt @@ -0,0 +1,2 @@ +3 +6 11 12 diff --git a/codenet/public_test_cases/p01422/input.1.txt b/codenet/public_test_cases/p01422/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d0efa9625d006b3a78f803110df3584416da2a2 --- /dev/null +++ b/codenet/public_test_cases/p01422/input.1.txt @@ -0,0 +1,2 @@ +3 +6 11 24 diff --git a/codenet/public_test_cases/p01422/input.2.txt b/codenet/public_test_cases/p01422/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99a77bf681438c3e379b1e4486aed429aa7c19ed --- /dev/null +++ b/codenet/public_test_cases/p01422/input.2.txt @@ -0,0 +1,2 @@ +3 +6 11 30 diff --git a/codenet/public_test_cases/p01422/input.3.txt b/codenet/public_test_cases/p01422/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..499aaee910e71b3cb0d991854ec235e17579a629 --- /dev/null +++ b/codenet/public_test_cases/p01422/input.3.txt @@ -0,0 +1,2 @@ +3 +6 11 12 diff --git a/codenet/public_test_cases/p01422/output.0.txt b/codenet/public_test_cases/p01422/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..03d7df72b70f39fa289f3295c36de07e40fe2304 --- /dev/null +++ b/codenet/public_test_cases/p01422/output.0.txt @@ -0,0 +1 @@ +0.090909090909 diff --git a/codenet/public_test_cases/p01422/output.1.txt b/codenet/public_test_cases/p01422/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03d7df72b70f39fa289f3295c36de07e40fe2304 --- /dev/null +++ b/codenet/public_test_cases/p01422/output.1.txt @@ -0,0 +1 @@ +0.090909090909 diff --git a/codenet/public_test_cases/p01422/output.2.txt b/codenet/public_test_cases/p01422/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f74ee430eef00182751de889408d33a18639185b --- /dev/null +++ b/codenet/public_test_cases/p01422/output.2.txt @@ -0,0 +1 @@ +0.166666666667 diff --git a/codenet/public_test_cases/p01422/output.3.txt b/codenet/public_test_cases/p01422/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..03d7df72b70f39fa289f3295c36de07e40fe2304 --- /dev/null +++ b/codenet/public_test_cases/p01422/output.3.txt @@ -0,0 +1 @@ +0.090909090909 diff --git a/codenet/public_test_cases/p01423/input.0.txt b/codenet/public_test_cases/p01423/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3f55b2dd4744161cead05cfc8ac32ce396fd8dd --- /dev/null +++ b/codenet/public_test_cases/p01423/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 3 +2 3 1 +3 1 2 diff --git a/codenet/public_test_cases/p01423/input.1.txt b/codenet/public_test_cases/p01423/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3f55b2dd4744161cead05cfc8ac32ce396fd8dd --- /dev/null +++ b/codenet/public_test_cases/p01423/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 3 +2 3 1 +3 1 2 diff --git a/codenet/public_test_cases/p01423/input.2.txt b/codenet/public_test_cases/p01423/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bb8fccd53586fa6e574f7e95d9c83cf965fd263 --- /dev/null +++ b/codenet/public_test_cases/p01423/input.2.txt @@ -0,0 +1,2 @@ +2 1 +1 2 5 diff --git a/codenet/public_test_cases/p01423/input.3.txt b/codenet/public_test_cases/p01423/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dee0375cff201233d99ece7f559c2e725dfbb0a --- /dev/null +++ b/codenet/public_test_cases/p01423/input.3.txt @@ -0,0 +1,6 @@ +4 5 +1 2 4 +1 3 3 +2 3 7 +2 4 5 +3 4 6 diff --git a/codenet/public_test_cases/p01423/input.4.txt b/codenet/public_test_cases/p01423/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..80c0cc79aabb27a7894c5795860fa87c6473f004 --- /dev/null +++ b/codenet/public_test_cases/p01423/input.4.txt @@ -0,0 +1 @@ +1 0 diff --git a/codenet/public_test_cases/p01423/output.0.txt b/codenet/public_test_cases/p01423/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01423/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01423/output.1.txt b/codenet/public_test_cases/p01423/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01423/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01423/output.2.txt b/codenet/public_test_cases/p01423/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01423/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01423/output.3.txt b/codenet/public_test_cases/p01423/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p01423/output.3.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p01423/output.4.txt b/codenet/public_test_cases/p01423/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01423/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01424/input.0.txt b/codenet/public_test_cases/p01424/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54d5bccee535d28a4ae269a2dccec6470b6d8675 --- /dev/null +++ b/codenet/public_test_cases/p01424/input.0.txt @@ -0,0 +1,5 @@ +2 2 +ab +ba +1 1 +1 2 diff --git a/codenet/public_test_cases/p01424/input.1.txt b/codenet/public_test_cases/p01424/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5000f0c7e8723bc94eeeada0eb28301345e2ae48 --- /dev/null +++ b/codenet/public_test_cases/p01424/input.1.txt @@ -0,0 +1,5 @@ +2 2 +ab +ba +1 1 +2 2 diff --git a/codenet/public_test_cases/p01424/input.2.txt b/codenet/public_test_cases/p01424/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..54d5bccee535d28a4ae269a2dccec6470b6d8675 --- /dev/null +++ b/codenet/public_test_cases/p01424/input.2.txt @@ -0,0 +1,5 @@ +2 2 +ab +ba +1 1 +1 2 diff --git a/codenet/public_test_cases/p01424/input.3.txt b/codenet/public_test_cases/p01424/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5ae37f458b3a82a23752f2b0c48ef7ad7f51839 --- /dev/null +++ b/codenet/public_test_cases/p01424/input.3.txt @@ -0,0 +1,5 @@ +2 2 +ab +a +1 1 +1 2 diff --git a/codenet/public_test_cases/p01424/output.0.txt b/codenet/public_test_cases/p01424/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01424/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01424/output.1.txt b/codenet/public_test_cases/p01424/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01424/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01424/output.2.txt b/codenet/public_test_cases/p01424/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01424/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01424/output.3.txt b/codenet/public_test_cases/p01424/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01424/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01425/input.0.txt b/codenet/public_test_cases/p01425/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b949f5642e813df2b62f78a520d88b8f2df190e --- /dev/null +++ b/codenet/public_test_cases/p01425/input.0.txt @@ -0,0 +1 @@ +0 7 3 1 diff --git a/codenet/public_test_cases/p01425/input.1.txt b/codenet/public_test_cases/p01425/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b949f5642e813df2b62f78a520d88b8f2df190e --- /dev/null +++ b/codenet/public_test_cases/p01425/input.1.txt @@ -0,0 +1 @@ +0 7 3 1 diff --git a/codenet/public_test_cases/p01425/input.2.txt b/codenet/public_test_cases/p01425/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..621ec2df01cb254c0ee51627ecb576649ed95ef6 --- /dev/null +++ b/codenet/public_test_cases/p01425/input.2.txt @@ -0,0 +1,2 @@ +1 7 2 2 +0 1 1 2 diff --git a/codenet/public_test_cases/p01425/input.3.txt b/codenet/public_test_cases/p01425/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..46da63b7b24ac57bd305daffc7711f78519765ae --- /dev/null +++ b/codenet/public_test_cases/p01425/input.3.txt @@ -0,0 +1,2 @@ +1 7 3 1 +1 1 2 2 diff --git a/codenet/public_test_cases/p01425/output.0.txt b/codenet/public_test_cases/p01425/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01425/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01425/output.1.txt b/codenet/public_test_cases/p01425/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01425/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01425/output.2.txt b/codenet/public_test_cases/p01425/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01425/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01425/output.3.txt b/codenet/public_test_cases/p01425/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01425/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01426/input.0.txt b/codenet/public_test_cases/p01426/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f64b7de79426a5f83c225f12d1ad90dc3c9229c --- /dev/null +++ b/codenet/public_test_cases/p01426/input.0.txt @@ -0,0 +1,4 @@ +2 3 +1.0 1.0 +-1.0 0.0 +0.5 0.5 diff --git a/codenet/public_test_cases/p01426/input.1.txt b/codenet/public_test_cases/p01426/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f64b7de79426a5f83c225f12d1ad90dc3c9229c --- /dev/null +++ b/codenet/public_test_cases/p01426/input.1.txt @@ -0,0 +1,4 @@ +2 3 +1.0 1.0 +-1.0 0.0 +0.5 0.5 diff --git a/codenet/public_test_cases/p01426/input.2.txt b/codenet/public_test_cases/p01426/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd0d553670c99f1d8326f2d782380913d5126782 --- /dev/null +++ b/codenet/public_test_cases/p01426/input.2.txt @@ -0,0 +1,4 @@ +4 3 +1.0 1.0 0.0 0.0 +-1.0 0.0 -1.0 0.0 +0.5 0.5 0.5 0.5 diff --git a/codenet/public_test_cases/p01426/input.3.txt b/codenet/public_test_cases/p01426/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b03d2bba43909b6567e0094a859a35a93cdf674 --- /dev/null +++ b/codenet/public_test_cases/p01426/input.3.txt @@ -0,0 +1,2 @@ +1 1 +1.0 diff --git a/codenet/public_test_cases/p01426/output.0.txt b/codenet/public_test_cases/p01426/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3827e75a5cadb9fe4a27e1cb9b6d192e7323120 --- /dev/null +++ b/codenet/public_test_cases/p01426/output.0.txt @@ -0,0 +1 @@ +1.0 diff --git a/codenet/public_test_cases/p01426/output.1.txt b/codenet/public_test_cases/p01426/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3827e75a5cadb9fe4a27e1cb9b6d192e7323120 --- /dev/null +++ b/codenet/public_test_cases/p01426/output.1.txt @@ -0,0 +1 @@ +1.0 diff --git a/codenet/public_test_cases/p01426/output.2.txt b/codenet/public_test_cases/p01426/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f55b2ccb5f234fc6b87ada62389a3d73815d0d1 --- /dev/null +++ b/codenet/public_test_cases/p01426/output.2.txt @@ -0,0 +1 @@ +3.0 diff --git a/codenet/public_test_cases/p01426/output.3.txt b/codenet/public_test_cases/p01426/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3827e75a5cadb9fe4a27e1cb9b6d192e7323120 --- /dev/null +++ b/codenet/public_test_cases/p01426/output.3.txt @@ -0,0 +1 @@ +1.0 diff --git a/codenet/public_test_cases/p01427/input.0.txt b/codenet/public_test_cases/p01427/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..993903dd6feb6ffe5c3960296815c8730e28fc61 --- /dev/null +++ b/codenet/public_test_cases/p01427/input.0.txt @@ -0,0 +1,4 @@ +3 5 +##..# +#..## +####. diff --git a/codenet/public_test_cases/p01427/output.0.txt b/codenet/public_test_cases/p01427/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01427/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01428/input.0.txt b/codenet/public_test_cases/p01428/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85b089d6a8772c5855e8b815c64a681dac003517 --- /dev/null +++ b/codenet/public_test_cases/p01428/input.0.txt @@ -0,0 +1,8 @@ +ooox.... +.x...... +ooo..... +........ +........ +........ +........ +........ diff --git a/codenet/public_test_cases/p01428/output.0.txt b/codenet/public_test_cases/p01428/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25fded20ddb35e641bd3909fd2e5578f58672c43 --- /dev/null +++ b/codenet/public_test_cases/p01428/output.0.txt @@ -0,0 +1,8 @@ +ooooo... +.o...... +ooo..... +...o.... +....o... +........ +........ +........ diff --git a/codenet/public_test_cases/p01429/input.0.txt b/codenet/public_test_cases/p01429/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..764c72d74ac7d05412638e29ec3e324d75bd7cfb --- /dev/null +++ b/codenet/public_test_cases/p01429/input.0.txt @@ -0,0 +1,3 @@ +4 5 99 +1 4 5 3 +100 200 300 400 500 diff --git a/codenet/public_test_cases/p01429/output.0.txt b/codenet/public_test_cases/p01429/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81b5c5d06cc0b8290c264b408abb32cc0986e8f2 --- /dev/null +++ b/codenet/public_test_cases/p01429/output.0.txt @@ -0,0 +1 @@ +37 diff --git a/codenet/public_test_cases/p01430/input.0.txt b/codenet/public_test_cases/p01430/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..665c22fdc906e42ec00494d5f2866fca358b6ff5 --- /dev/null +++ b/codenet/public_test_cases/p01430/input.0.txt @@ -0,0 +1,4 @@ +2 1 2 +1 2 +2 1 2 +1 2 1 diff --git a/codenet/public_test_cases/p01430/output.0.txt b/codenet/public_test_cases/p01430/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d66ea1aee9527bfa39185ead1f9cdbd96bba88c --- /dev/null +++ b/codenet/public_test_cases/p01430/output.0.txt @@ -0,0 +1,2 @@ +0 +1 diff --git a/codenet/public_test_cases/p01431/input.0.txt b/codenet/public_test_cases/p01431/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9060f16d61c069dfb9e0801355f58018d6f85d33 --- /dev/null +++ b/codenet/public_test_cases/p01431/input.0.txt @@ -0,0 +1,4 @@ +3 4 +.##. +#??# +.#?# diff --git a/codenet/public_test_cases/p01431/output.0.txt b/codenet/public_test_cases/p01431/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01431/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01432/input.0.txt b/codenet/public_test_cases/p01432/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..408d47c88b70c3171521ad84537daaa1d7b8b657 --- /dev/null +++ b/codenet/public_test_cases/p01432/input.0.txt @@ -0,0 +1 @@ +6 6 1 diff --git a/codenet/public_test_cases/p01432/output.0.txt b/codenet/public_test_cases/p01432/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..576e90a7a937ebd635d232de1e461edde119f985 --- /dev/null +++ b/codenet/public_test_cases/p01432/output.0.txt @@ -0,0 +1 @@ +6.00000000 diff --git a/codenet/public_test_cases/p01433/input.0.txt b/codenet/public_test_cases/p01433/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc7b47bf8cdddc04c8188367d863ca68bea5f34a --- /dev/null +++ b/codenet/public_test_cases/p01433/input.0.txt @@ -0,0 +1,5 @@ +4 5 25 +0 10 +10 0 +20 0 +30 10 diff --git a/codenet/public_test_cases/p01433/output.0.txt b/codenet/public_test_cases/p01433/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d30c10806e6b92fddd5794c9fdc1857b75369792 --- /dev/null +++ b/codenet/public_test_cases/p01433/output.0.txt @@ -0,0 +1 @@ +Red diff --git a/codenet/public_test_cases/p01434/input.0.txt b/codenet/public_test_cases/p01434/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23c7f5ae255ffac6a690d0a14dd48557544e8a5e --- /dev/null +++ b/codenet/public_test_cases/p01434/input.0.txt @@ -0,0 +1,6 @@ +2 3 +1 8 +20 5 +3 +7 +15 diff --git a/codenet/public_test_cases/p01434/output.0.txt b/codenet/public_test_cases/p01434/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01434/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01435/input.0.txt b/codenet/public_test_cases/p01435/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4020ea9e614e93a8639b725f5540ac4c8c10c2d2 --- /dev/null +++ b/codenet/public_test_cases/p01435/input.0.txt @@ -0,0 +1,3 @@ +3 1 3 +1 1 0 +3 2 1 2 diff --git a/codenet/public_test_cases/p01435/output.0.txt b/codenet/public_test_cases/p01435/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01435/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01436/input.0.txt b/codenet/public_test_cases/p01436/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b563acc19ae69bf3f87ef14f196d132c3660466c --- /dev/null +++ b/codenet/public_test_cases/p01436/input.0.txt @@ -0,0 +1,5 @@ +4 4 +.S.. +K... +.... +..sk diff --git a/codenet/public_test_cases/p01436/output.0.txt b/codenet/public_test_cases/p01436/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01436/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01437/input.0.txt b/codenet/public_test_cases/p01437/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae7e3d924a76f74ca2a6e74c977674d097d5ac27 --- /dev/null +++ b/codenet/public_test_cases/p01437/input.0.txt @@ -0,0 +1,23 @@ +3 3 10 +E.. +.#. +... +5 5 19 +####. +..... +.#S#. +...#. +#.##. +5 5 6 +#.#.. +#.... +##.#. +#..S. +#.... +5 4 35 +..## +.... +.##. +.#S. +...# +0 0 0 diff --git a/codenet/public_test_cases/p01437/input.1.txt b/codenet/public_test_cases/p01437/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae7e3d924a76f74ca2a6e74c977674d097d5ac27 --- /dev/null +++ b/codenet/public_test_cases/p01437/input.1.txt @@ -0,0 +1,23 @@ +3 3 10 +E.. +.#. +... +5 5 19 +####. +..... +.#S#. +...#. +#.##. +5 5 6 +#.#.. +#.... +##.#. +#..S. +#.... +5 4 35 +..## +.... +.##. +.#S. +...# +0 0 0 diff --git a/codenet/public_test_cases/p01437/input.2.txt b/codenet/public_test_cases/p01437/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..94ce42fdc54919bfc114efff2e14666669fd4068 --- /dev/null +++ b/codenet/public_test_cases/p01437/input.2.txt @@ -0,0 +1,23 @@ +3 3 10 +E.. +.#. +... +5 5 19 +. +..... +.#S#. +...#. +.##. +5 5 6 +.#.. +.... +.#. +..S. +.... +5 4 35 +..## +.... +.##. +.#S. +...# +0 0 0 diff --git a/codenet/public_test_cases/p01437/output.0.txt b/codenet/public_test_cases/p01437/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38db59a19a5f2d2b0f6cbf66a55e9fb7aa94ad4d --- /dev/null +++ b/codenet/public_test_cases/p01437/output.0.txt @@ -0,0 +1,4 @@ +1 3 E +4 5 S +4 4 E +1 1 N diff --git a/codenet/public_test_cases/p01437/output.1.txt b/codenet/public_test_cases/p01437/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38db59a19a5f2d2b0f6cbf66a55e9fb7aa94ad4d --- /dev/null +++ b/codenet/public_test_cases/p01437/output.1.txt @@ -0,0 +1,4 @@ +1 3 E +4 5 S +4 4 E +1 1 N diff --git a/codenet/public_test_cases/p01437/output.2.txt b/codenet/public_test_cases/p01437/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..38db59a19a5f2d2b0f6cbf66a55e9fb7aa94ad4d --- /dev/null +++ b/codenet/public_test_cases/p01437/output.2.txt @@ -0,0 +1,4 @@ +1 3 E +4 5 S +4 4 E +1 1 N diff --git a/codenet/public_test_cases/p01438/input.0.txt b/codenet/public_test_cases/p01438/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94c34ee70aca79361889c0400ca44f09f879fb30 --- /dev/null +++ b/codenet/public_test_cases/p01438/input.0.txt @@ -0,0 +1,50 @@ +2 +2 100 +10 12 +14 16 +2 200 +12 13 +18 20 +4 +1 100 +6 22 +1 1000 +6 22 +1 10000 +6 22 +1 100000 +6 22 +16 +1 100000000 +6 7 +1 100000000 +7 8 +1 100000000 +8 9 +1 100000000 +9 10 +1 100000000 +10 11 +1 100000000 +11 12 +1 100000000 +12 13 +1 100000000 +13 14 +1 100000000 +14 15 +1 100000000 +15 16 +1 100000000 +16 17 +1 100000000 +17 18 +1 100000000 +18 19 +1 100000000 +19 20 +1 100000000 +20 21 +1 100000000 +21 22 +0 diff --git a/codenet/public_test_cases/p01438/input.1.txt b/codenet/public_test_cases/p01438/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94c34ee70aca79361889c0400ca44f09f879fb30 --- /dev/null +++ b/codenet/public_test_cases/p01438/input.1.txt @@ -0,0 +1,50 @@ +2 +2 100 +10 12 +14 16 +2 200 +12 13 +18 20 +4 +1 100 +6 22 +1 1000 +6 22 +1 10000 +6 22 +1 100000 +6 22 +16 +1 100000000 +6 7 +1 100000000 +7 8 +1 100000000 +8 9 +1 100000000 +9 10 +1 100000000 +10 11 +1 100000000 +11 12 +1 100000000 +12 13 +1 100000000 +13 14 +1 100000000 +14 15 +1 100000000 +15 16 +1 100000000 +16 17 +1 100000000 +17 18 +1 100000000 +18 19 +1 100000000 +19 20 +1 100000000 +20 21 +1 100000000 +21 22 +0 diff --git a/codenet/public_test_cases/p01438/output.0.txt b/codenet/public_test_cases/p01438/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7748152d69aaaf0179c28e004b0b6e16bab5105 --- /dev/null +++ b/codenet/public_test_cases/p01438/output.0.txt @@ -0,0 +1,3 @@ +300 +100000 +1600000000 diff --git a/codenet/public_test_cases/p01438/output.1.txt b/codenet/public_test_cases/p01438/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7748152d69aaaf0179c28e004b0b6e16bab5105 --- /dev/null +++ b/codenet/public_test_cases/p01438/output.1.txt @@ -0,0 +1,3 @@ +300 +100000 +1600000000 diff --git a/codenet/public_test_cases/p01439/input.0.txt b/codenet/public_test_cases/p01439/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..72be167351edf43e55e3818845e04f0df659bc37 --- /dev/null +++ b/codenet/public_test_cases/p01439/input.0.txt @@ -0,0 +1,23 @@ +6 +onetwo2 +- +onetwo1 +onetwo2 +- +onetwo1 +7 +v +topbottom2 +onetwo2 +- +onetwo1 +topbottom1 +- +6 +baz2 +foo2 +baz1v +bar2 +foo1 +bar1 +0 diff --git a/codenet/public_test_cases/p01439/input.1.txt b/codenet/public_test_cases/p01439/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..72be167351edf43e55e3818845e04f0df659bc37 --- /dev/null +++ b/codenet/public_test_cases/p01439/input.1.txt @@ -0,0 +1,23 @@ +6 +onetwo2 +- +onetwo1 +onetwo2 +- +onetwo1 +7 +v +topbottom2 +onetwo2 +- +onetwo1 +topbottom1 +- +6 +baz2 +foo2 +baz1v +bar2 +foo1 +bar1 +0 diff --git a/codenet/public_test_cases/p01439/output.0.txt b/codenet/public_test_cases/p01439/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a58449d64e5138ff3ad86d76cb7149aa2c872efd --- /dev/null +++ b/codenet/public_test_cases/p01439/output.0.txt @@ -0,0 +1,19 @@ +2 +3 +1 +5 +6 +4 +4 +5 +3 +6 +2 +1 +7 +5 +2 +6 +4 +3 +1 diff --git a/codenet/public_test_cases/p01439/output.1.txt b/codenet/public_test_cases/p01439/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a58449d64e5138ff3ad86d76cb7149aa2c872efd --- /dev/null +++ b/codenet/public_test_cases/p01439/output.1.txt @@ -0,0 +1,19 @@ +2 +3 +1 +5 +6 +4 +4 +5 +3 +6 +2 +1 +7 +5 +2 +6 +4 +3 +1 diff --git a/codenet/public_test_cases/p01440/input.0.txt b/codenet/public_test_cases/p01440/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b42b50da3cd65f33bf72c59941aa79bf8b0e2cf9 --- /dev/null +++ b/codenet/public_test_cases/p01440/input.0.txt @@ -0,0 +1,5 @@ +45678 +67891011 +21 +314159265358979 +# diff --git a/codenet/public_test_cases/p01440/input.1.txt b/codenet/public_test_cases/p01440/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c73ab5ec487927d55a846780eb3f80d51f2fecd7 --- /dev/null +++ b/codenet/public_test_cases/p01440/input.1.txt @@ -0,0 +1,4 @@ +45678 +67891011 +21 +314159265358979 diff --git a/codenet/public_test_cases/p01440/input.2.txt b/codenet/public_test_cases/p01440/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b42b50da3cd65f33bf72c59941aa79bf8b0e2cf9 --- /dev/null +++ b/codenet/public_test_cases/p01440/input.2.txt @@ -0,0 +1,5 @@ +45678 +67891011 +21 +314159265358979 +# diff --git a/codenet/public_test_cases/p01440/output.0.txt b/codenet/public_test_cases/p01440/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7392ee5ad802e2850bcb8948822d67b639dc0393 --- /dev/null +++ b/codenet/public_test_cases/p01440/output.0.txt @@ -0,0 +1,4 @@ +4 +6 +15 +2012778692735799 diff --git a/codenet/public_test_cases/p01440/output.1.txt b/codenet/public_test_cases/p01440/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7392ee5ad802e2850bcb8948822d67b639dc0393 --- /dev/null +++ b/codenet/public_test_cases/p01440/output.1.txt @@ -0,0 +1,4 @@ +4 +6 +15 +2012778692735799 diff --git a/codenet/public_test_cases/p01440/output.2.txt b/codenet/public_test_cases/p01440/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7392ee5ad802e2850bcb8948822d67b639dc0393 --- /dev/null +++ b/codenet/public_test_cases/p01440/output.2.txt @@ -0,0 +1,4 @@ +4 +6 +15 +2012778692735799 diff --git a/codenet/public_test_cases/p01441/input.0.txt b/codenet/public_test_cases/p01441/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..174772f3e44d6a6664bf1f1e0f57c95067fa2e4f --- /dev/null +++ b/codenet/public_test_cases/p01441/input.0.txt @@ -0,0 +1,7 @@ +a +QMAClone +acmicpc +abcdefgha +abcdefgdhbi +abcbcd +# diff --git a/codenet/public_test_cases/p01441/input.1.txt b/codenet/public_test_cases/p01441/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eafc85241da17962b0672e6b588c376bcee7263a --- /dev/null +++ b/codenet/public_test_cases/p01441/input.1.txt @@ -0,0 +1,6 @@ +a +QMAClone +acmicpc +abcdefgha +abcdefgdhbi +abcbcd diff --git a/codenet/public_test_cases/p01441/input.2.txt b/codenet/public_test_cases/p01441/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..174772f3e44d6a6664bf1f1e0f57c95067fa2e4f --- /dev/null +++ b/codenet/public_test_cases/p01441/input.2.txt @@ -0,0 +1,7 @@ +a +QMAClone +acmicpc +abcdefgha +abcdefgdhbi +abcbcd +# diff --git a/codenet/public_test_cases/p01441/output.0.txt b/codenet/public_test_cases/p01441/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..46b7e959c638e641b3ac41584c840b513eeb7300 --- /dev/null +++ b/codenet/public_test_cases/p01441/output.0.txt @@ -0,0 +1,6 @@ +No Results +9 +7 +9 +12 +6 diff --git a/codenet/public_test_cases/p01441/output.1.txt b/codenet/public_test_cases/p01441/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46b7e959c638e641b3ac41584c840b513eeb7300 --- /dev/null +++ b/codenet/public_test_cases/p01441/output.1.txt @@ -0,0 +1,6 @@ +No Results +9 +7 +9 +12 +6 diff --git a/codenet/public_test_cases/p01441/output.2.txt b/codenet/public_test_cases/p01441/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..46b7e959c638e641b3ac41584c840b513eeb7300 --- /dev/null +++ b/codenet/public_test_cases/p01441/output.2.txt @@ -0,0 +1,6 @@ +No Results +9 +7 +9 +12 +6 diff --git a/codenet/public_test_cases/p01442/input.0.txt b/codenet/public_test_cases/p01442/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19bc4ef259942886d7861a5b3ea6f85694081790 --- /dev/null +++ b/codenet/public_test_cases/p01442/input.0.txt @@ -0,0 +1,14 @@ +2 2 1 +L +G. +#S +2 2 2 +RR +G. +.S +3 3 6 +LLLLLL +G#. +... +.#S +0 0 0 diff --git a/codenet/public_test_cases/p01442/input.1.txt b/codenet/public_test_cases/p01442/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19bc4ef259942886d7861a5b3ea6f85694081790 --- /dev/null +++ b/codenet/public_test_cases/p01442/input.1.txt @@ -0,0 +1,14 @@ +2 2 1 +L +G. +#S +2 2 2 +RR +G. +.S +3 3 6 +LLLLLL +G#. +... +.#S +0 0 0 diff --git a/codenet/public_test_cases/p01442/input.2.txt b/codenet/public_test_cases/p01442/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d229247142dc0245f74a80f734dc694c7845663 --- /dev/null +++ b/codenet/public_test_cases/p01442/input.2.txt @@ -0,0 +1,14 @@ +2 2 1 +L +G. +S +2 2 2 +RR +G. +.S +3 3 6 +LLLLLL +G#. +... +.#S +0 0 0 diff --git a/codenet/public_test_cases/p01442/output.0.txt b/codenet/public_test_cases/p01442/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef5c0439807192f2948a416361d3fec90374dac --- /dev/null +++ b/codenet/public_test_cases/p01442/output.0.txt @@ -0,0 +1,3 @@ +Yes +No +Yes diff --git a/codenet/public_test_cases/p01442/output.1.txt b/codenet/public_test_cases/p01442/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef5c0439807192f2948a416361d3fec90374dac --- /dev/null +++ b/codenet/public_test_cases/p01442/output.1.txt @@ -0,0 +1,3 @@ +Yes +No +Yes diff --git a/codenet/public_test_cases/p01442/output.2.txt b/codenet/public_test_cases/p01442/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef5c0439807192f2948a416361d3fec90374dac --- /dev/null +++ b/codenet/public_test_cases/p01442/output.2.txt @@ -0,0 +1,3 @@ +Yes +No +Yes diff --git a/codenet/public_test_cases/p01443/input.0.txt b/codenet/public_test_cases/p01443/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6ab5d0dbda3c4b5aa9b39a2e229d20d0d6924bd --- /dev/null +++ b/codenet/public_test_cases/p01443/input.0.txt @@ -0,0 +1,4 @@ +1 10 1000 +1 100000 1000000000 +999999999 1000099998 1000000000 +0 0 0 diff --git a/codenet/public_test_cases/p01443/input.1.txt b/codenet/public_test_cases/p01443/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6ab5d0dbda3c4b5aa9b39a2e229d20d0d6924bd --- /dev/null +++ b/codenet/public_test_cases/p01443/input.1.txt @@ -0,0 +1,4 @@ +1 10 1000 +1 100000 1000000000 +999999999 1000099998 1000000000 +0 0 0 diff --git a/codenet/public_test_cases/p01443/output.0.txt b/codenet/public_test_cases/p01443/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c4a01a1d188a2a74cab624f166e9d49058d14a6 --- /dev/null +++ b/codenet/public_test_cases/p01443/output.0.txt @@ -0,0 +1,3 @@ +513 +899507743 +941554688 diff --git a/codenet/public_test_cases/p01443/output.1.txt b/codenet/public_test_cases/p01443/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c4a01a1d188a2a74cab624f166e9d49058d14a6 --- /dev/null +++ b/codenet/public_test_cases/p01443/output.1.txt @@ -0,0 +1,3 @@ +513 +899507743 +941554688 diff --git a/codenet/public_test_cases/p01444/input.0.txt b/codenet/public_test_cases/p01444/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..809e4b3d312f870c1b19e5f678ffa30042d65f44 --- /dev/null +++ b/codenet/public_test_cases/p01444/input.0.txt @@ -0,0 +1,13 @@ +1 +1 1 +10 -480 +2 +6 7 +5 5 +4 1 +3 +10 5 +4 4 +8 4 +2 0 +0 diff --git a/codenet/public_test_cases/p01444/input.1.txt b/codenet/public_test_cases/p01444/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..809e4b3d312f870c1b19e5f678ffa30042d65f44 --- /dev/null +++ b/codenet/public_test_cases/p01444/input.1.txt @@ -0,0 +1,13 @@ +1 +1 1 +10 -480 +2 +6 7 +5 5 +4 1 +3 +10 5 +4 4 +8 4 +2 0 +0 diff --git a/codenet/public_test_cases/p01444/output.0.txt b/codenet/public_test_cases/p01444/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e42eaccba8fbb670afcbc090ead039c26258d21 --- /dev/null +++ b/codenet/public_test_cases/p01444/output.0.txt @@ -0,0 +1,3 @@ +Yes +Yes +No diff --git a/codenet/public_test_cases/p01444/output.1.txt b/codenet/public_test_cases/p01444/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e42eaccba8fbb670afcbc090ead039c26258d21 --- /dev/null +++ b/codenet/public_test_cases/p01444/output.1.txt @@ -0,0 +1,3 @@ +Yes +Yes +No diff --git a/codenet/public_test_cases/p01445/input.0.txt b/codenet/public_test_cases/p01445/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7aa3320864586f7aef0cd0c3ed1cd5add66873b4 --- /dev/null +++ b/codenet/public_test_cases/p01445/input.0.txt @@ -0,0 +1,13 @@ +3 3 +1 2 x+2 +2 3 2x+1 +3 1 x+1 +2 0 +3 2 +1 2 x +2 3 2 +4 3 +1 2 x^3+2x^2+3x+4 +2 3 x^2+2x+3 +3 4 x+2 +0 0 diff --git a/codenet/public_test_cases/p01445/input.1.txt b/codenet/public_test_cases/p01445/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7aa3320864586f7aef0cd0c3ed1cd5add66873b4 --- /dev/null +++ b/codenet/public_test_cases/p01445/input.1.txt @@ -0,0 +1,13 @@ +3 3 +1 2 x+2 +2 3 2x+1 +3 1 x+1 +2 0 +3 2 +1 2 x +2 3 2 +4 3 +1 2 x^3+2x^2+3x+4 +2 3 x^2+2x+3 +3 4 x+2 +0 0 diff --git a/codenet/public_test_cases/p01445/output.0.txt b/codenet/public_test_cases/p01445/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdc4747fbee10fa6b0f932afc853cbf01317c97d --- /dev/null +++ b/codenet/public_test_cases/p01445/output.0.txt @@ -0,0 +1,4 @@ +2x+3 +0 +2 +x+2 diff --git a/codenet/public_test_cases/p01445/output.1.txt b/codenet/public_test_cases/p01445/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdc4747fbee10fa6b0f932afc853cbf01317c97d --- /dev/null +++ b/codenet/public_test_cases/p01445/output.1.txt @@ -0,0 +1,4 @@ +2x+3 +0 +2 +x+2 diff --git a/codenet/public_test_cases/p01446/input.0.txt b/codenet/public_test_cases/p01446/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b3fd2b4d3063377169a9c6dae1f1e84291606de --- /dev/null +++ b/codenet/public_test_cases/p01446/input.0.txt @@ -0,0 +1,110 @@ +2 +5 +0 0 +10 0 +20 0 +30 0 +30 10 +4 +1 2 +2 3 +3 4 +4 5 +2 +1 2 4 +3 2 2 +5 +-10 0 +0 0 +0 -10 +0 -20 +0 -30 +4 +1 2 +2 3 +3 4 +4 5 +1 +4 1 3 +1 1 +2 1 +4 +3 +4 3 +0 0 +5 0 +2 +1 2 +2 3 +0 +3 +0 0 +3 4 +0 5 +2 +1 2 +1 3 +1 +2 3 4 +4 +0 13 +0 0 +13 0 +13 13 +4 +1 2 +1 4 +2 3 +2 4 +0 +4 +5 12 +0 0 +-7 17 +-12 5 +4 +1 2 +2 3 +2 4 +4 3 +0 +1 1 +4 1 +4 +3 +0 0 +2 0 +0 4 +2 +1 2 +1 3 +0 +3 +0 0 +-2 0 +0 4 +2 +1 2 +1 3 +1 +1 4 1 +3 +0 0 +1 0 +0 2 +2 +1 2 +1 3 +1 +1 4 1 +3 +0 0 +2 0 +0 4 +2 +1 2 +2 3 +0 +1 1 +4 1 +0 diff --git a/codenet/public_test_cases/p01446/input.1.txt b/codenet/public_test_cases/p01446/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b3fd2b4d3063377169a9c6dae1f1e84291606de --- /dev/null +++ b/codenet/public_test_cases/p01446/input.1.txt @@ -0,0 +1,110 @@ +2 +5 +0 0 +10 0 +20 0 +30 0 +30 10 +4 +1 2 +2 3 +3 4 +4 5 +2 +1 2 4 +3 2 2 +5 +-10 0 +0 0 +0 -10 +0 -20 +0 -30 +4 +1 2 +2 3 +3 4 +4 5 +1 +4 1 3 +1 1 +2 1 +4 +3 +4 3 +0 0 +5 0 +2 +1 2 +2 3 +0 +3 +0 0 +3 4 +0 5 +2 +1 2 +1 3 +1 +2 3 4 +4 +0 13 +0 0 +13 0 +13 13 +4 +1 2 +1 4 +2 3 +2 4 +0 +4 +5 12 +0 0 +-7 17 +-12 5 +4 +1 2 +2 3 +2 4 +4 3 +0 +1 1 +4 1 +4 +3 +0 0 +2 0 +0 4 +2 +1 2 +1 3 +0 +3 +0 0 +-2 0 +0 4 +2 +1 2 +1 3 +1 +1 4 1 +3 +0 0 +1 0 +0 2 +2 +1 2 +1 3 +1 +1 4 1 +3 +0 0 +2 0 +0 4 +2 +1 2 +2 3 +0 +1 1 +4 1 +0 diff --git a/codenet/public_test_cases/p01446/output.0.txt b/codenet/public_test_cases/p01446/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d621f3509ce5eccfd8446006c6fac44469e12ca --- /dev/null +++ b/codenet/public_test_cases/p01446/output.0.txt @@ -0,0 +1,3 @@ +10.0000000000 +41.3847763109 +-1.000000000 diff --git a/codenet/public_test_cases/p01446/output.1.txt b/codenet/public_test_cases/p01446/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d621f3509ce5eccfd8446006c6fac44469e12ca --- /dev/null +++ b/codenet/public_test_cases/p01446/output.1.txt @@ -0,0 +1,3 @@ +10.0000000000 +41.3847763109 +-1.000000000 diff --git a/codenet/public_test_cases/p01447/input.0.txt b/codenet/public_test_cases/p01447/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01447/input.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01447/input.1.txt b/codenet/public_test_cases/p01447/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p01447/input.1.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p01447/input.2.txt b/codenet/public_test_cases/p01447/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01447/input.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01447/input.3.txt b/codenet/public_test_cases/p01447/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..04b2646e30b0383d7bab169b05c1edc80feed7b0 --- /dev/null +++ b/codenet/public_test_cases/p01447/input.3.txt @@ -0,0 +1 @@ +2000000000 diff --git a/codenet/public_test_cases/p01447/output.0.txt b/codenet/public_test_cases/p01447/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01447/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01447/output.1.txt b/codenet/public_test_cases/p01447/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01447/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01447/output.2.txt b/codenet/public_test_cases/p01447/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01447/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01447/output.3.txt b/codenet/public_test_cases/p01447/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p01447/output.3.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p01448/input.0.txt b/codenet/public_test_cases/p01448/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29ab1b3022c1f55398c7131f01375168b1a27446 --- /dev/null +++ b/codenet/public_test_cases/p01448/input.0.txt @@ -0,0 +1,5 @@ +4 +2 5 +4 7 +2 4 +3 6 diff --git a/codenet/public_test_cases/p01448/input.1.txt b/codenet/public_test_cases/p01448/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e165c53a06bd4c1633b0a761bd5061f7e6095ab0 --- /dev/null +++ b/codenet/public_test_cases/p01448/input.1.txt @@ -0,0 +1,6 @@ +5 +8 100001 +7 100001 +12 100001 +8 100001 +3 100001 diff --git a/codenet/public_test_cases/p01448/input.2.txt b/codenet/public_test_cases/p01448/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29ab1b3022c1f55398c7131f01375168b1a27446 --- /dev/null +++ b/codenet/public_test_cases/p01448/input.2.txt @@ -0,0 +1,5 @@ +4 +2 5 +4 7 +2 4 +3 6 diff --git a/codenet/public_test_cases/p01448/input.3.txt b/codenet/public_test_cases/p01448/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..afaf2af13c890ed9f29420f68e66052d2824b6f9 --- /dev/null +++ b/codenet/public_test_cases/p01448/input.3.txt @@ -0,0 +1,7 @@ +6 +2 9 +4 8 +6 7 +6 6 +5 7 +2 100001 diff --git a/codenet/public_test_cases/p01448/output.0.txt b/codenet/public_test_cases/p01448/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01448/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01448/output.1.txt b/codenet/public_test_cases/p01448/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01448/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01448/output.2.txt b/codenet/public_test_cases/p01448/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01448/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01448/output.3.txt b/codenet/public_test_cases/p01448/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01448/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01449/input.0.txt b/codenet/public_test_cases/p01449/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0a6defa1b7bd2677756e9d2991e0e67de464771 --- /dev/null +++ b/codenet/public_test_cases/p01449/input.0.txt @@ -0,0 +1,12 @@ +11 +0 +0 +-2 +0 +-4 +1 +-1 +2 +0 +0 +0 diff --git a/codenet/public_test_cases/p01449/input.1.txt b/codenet/public_test_cases/p01449/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0a6defa1b7bd2677756e9d2991e0e67de464771 --- /dev/null +++ b/codenet/public_test_cases/p01449/input.1.txt @@ -0,0 +1,12 @@ +11 +0 +0 +-2 +0 +-4 +1 +-1 +2 +0 +0 +0 diff --git a/codenet/public_test_cases/p01449/input.2.txt b/codenet/public_test_cases/p01449/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9627f87ed0361c5efa60094138ebfa739eac3ef3 --- /dev/null +++ b/codenet/public_test_cases/p01449/input.2.txt @@ -0,0 +1,13 @@ +12 +0 +0 +7 +0 +2 +0 +0 +3 +-6 +-2 +1 +0 diff --git a/codenet/public_test_cases/p01449/input.3.txt b/codenet/public_test_cases/p01449/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..daf86eb9ef6eaf04e16438aa40b4e2377d82f12b --- /dev/null +++ b/codenet/public_test_cases/p01449/input.3.txt @@ -0,0 +1,9 @@ +8 +0 +4 +-1 +1 +-2 +-2 +0 +0 diff --git a/codenet/public_test_cases/p01449/output.0.txt b/codenet/public_test_cases/p01449/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01449/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01449/output.1.txt b/codenet/public_test_cases/p01449/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01449/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01449/output.2.txt b/codenet/public_test_cases/p01449/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01449/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01449/output.3.txt b/codenet/public_test_cases/p01449/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01449/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01450/input.0.txt b/codenet/public_test_cases/p01450/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21b0e22b3c35fe8d63c3ee9dfa61475df4f840f6 --- /dev/null +++ b/codenet/public_test_cases/p01450/input.0.txt @@ -0,0 +1,5 @@ +4 8 +1 +2 +7 +9 diff --git a/codenet/public_test_cases/p01450/input.1.txt b/codenet/public_test_cases/p01450/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..087421ee95256ee0ee932c7a0dfe61e58baf4067 --- /dev/null +++ b/codenet/public_test_cases/p01450/input.1.txt @@ -0,0 +1,7 @@ +6 37 +5 +9 +13 +18 +26 +33 diff --git a/codenet/public_test_cases/p01450/input.2.txt b/codenet/public_test_cases/p01450/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..beac3b0350ca379f77b2b71e8cec0b8e4f92687a --- /dev/null +++ b/codenet/public_test_cases/p01450/input.2.txt @@ -0,0 +1,5 @@ +4 25 +20 +15 +20 +15 diff --git a/codenet/public_test_cases/p01450/input.3.txt b/codenet/public_test_cases/p01450/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..21b0e22b3c35fe8d63c3ee9dfa61475df4f840f6 --- /dev/null +++ b/codenet/public_test_cases/p01450/input.3.txt @@ -0,0 +1,5 @@ +4 8 +1 +2 +7 +9 diff --git a/codenet/public_test_cases/p01450/output.0.txt b/codenet/public_test_cases/p01450/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01450/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01450/output.1.txt b/codenet/public_test_cases/p01450/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01450/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01450/output.2.txt b/codenet/public_test_cases/p01450/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01450/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01450/output.3.txt b/codenet/public_test_cases/p01450/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01450/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01451/input.0.txt b/codenet/public_test_cases/p01451/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f962bd7fde7852c29d5fc8a75eea729580a0c454 --- /dev/null +++ b/codenet/public_test_cases/p01451/input.0.txt @@ -0,0 +1,5 @@ +2 2 +0 0 +1 1 +2 0 +2 -1 diff --git a/codenet/public_test_cases/p01451/input.1.txt b/codenet/public_test_cases/p01451/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c49be354a3bb1240408e7d28c5b8a502998341c --- /dev/null +++ b/codenet/public_test_cases/p01451/input.1.txt @@ -0,0 +1,6 @@ +2 3 +4 0 +0 0 +2 3 +2 -2 +3 1 diff --git a/codenet/public_test_cases/p01451/input.2.txt b/codenet/public_test_cases/p01451/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f962bd7fde7852c29d5fc8a75eea729580a0c454 --- /dev/null +++ b/codenet/public_test_cases/p01451/input.2.txt @@ -0,0 +1,5 @@ +2 2 +0 0 +1 1 +2 0 +2 -1 diff --git a/codenet/public_test_cases/p01451/input.3.txt b/codenet/public_test_cases/p01451/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..083e71f06aa4ba46af182945d62467589ad20d2c --- /dev/null +++ b/codenet/public_test_cases/p01451/input.3.txt @@ -0,0 +1,8 @@ +5 2 +-2 1 +1 2 +-1 3 +-1 5 +1 4 +0 4 +0 0 diff --git a/codenet/public_test_cases/p01451/output.0.txt b/codenet/public_test_cases/p01451/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e05ff84f68212a888fbe9661dcac0f7aca498365 --- /dev/null +++ b/codenet/public_test_cases/p01451/output.0.txt @@ -0,0 +1 @@ +2.414213562373 diff --git a/codenet/public_test_cases/p01451/output.1.txt b/codenet/public_test_cases/p01451/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01451/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01451/output.2.txt b/codenet/public_test_cases/p01451/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e05ff84f68212a888fbe9661dcac0f7aca498365 --- /dev/null +++ b/codenet/public_test_cases/p01451/output.2.txt @@ -0,0 +1 @@ +2.414213562373 diff --git a/codenet/public_test_cases/p01451/output.3.txt b/codenet/public_test_cases/p01451/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dbe491838e6dd5f72eee7b9e286c1ebbfd700a8 --- /dev/null +++ b/codenet/public_test_cases/p01451/output.3.txt @@ -0,0 +1 @@ +12.359173603117 diff --git a/codenet/public_test_cases/p01452/input.0.txt b/codenet/public_test_cases/p01452/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3249ef73fc1bab6d88800daa9ded7b31f6001310 --- /dev/null +++ b/codenet/public_test_cases/p01452/input.0.txt @@ -0,0 +1 @@ +6 4 0 diff --git a/codenet/public_test_cases/p01452/input.1.txt b/codenet/public_test_cases/p01452/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3249ef73fc1bab6d88800daa9ded7b31f6001310 --- /dev/null +++ b/codenet/public_test_cases/p01452/input.1.txt @@ -0,0 +1 @@ +6 4 0 diff --git a/codenet/public_test_cases/p01452/input.2.txt b/codenet/public_test_cases/p01452/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4bfbd71f51f7e06235ec9dc7d620f404bcf15b9 --- /dev/null +++ b/codenet/public_test_cases/p01452/input.2.txt @@ -0,0 +1 @@ +124 218 367 diff --git a/codenet/public_test_cases/p01452/input.3.txt b/codenet/public_test_cases/p01452/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1674dab122422fc07619df25d2934abc4b8cbd89 --- /dev/null +++ b/codenet/public_test_cases/p01452/input.3.txt @@ -0,0 +1 @@ +3 3 1 diff --git a/codenet/public_test_cases/p01452/output.0.txt b/codenet/public_test_cases/p01452/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd7da05e3d264bd30a49a5f2c4c647a4ee0d3ec3 --- /dev/null +++ b/codenet/public_test_cases/p01452/output.0.txt @@ -0,0 +1 @@ +210 diff --git a/codenet/public_test_cases/p01452/output.1.txt b/codenet/public_test_cases/p01452/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd7da05e3d264bd30a49a5f2c4c647a4ee0d3ec3 --- /dev/null +++ b/codenet/public_test_cases/p01452/output.1.txt @@ -0,0 +1 @@ +210 diff --git a/codenet/public_test_cases/p01452/output.2.txt b/codenet/public_test_cases/p01452/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..926d12b77a26af832d15c7ccc755b2c5caaa4b84 --- /dev/null +++ b/codenet/public_test_cases/p01452/output.2.txt @@ -0,0 +1 @@ +817857665 diff --git a/codenet/public_test_cases/p01452/output.3.txt b/codenet/public_test_cases/p01452/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5379c470da317d0e62ea78acdded4eb1f48cd7aa --- /dev/null +++ b/codenet/public_test_cases/p01452/output.3.txt @@ -0,0 +1 @@ +448 diff --git a/codenet/public_test_cases/p01453/input.0.txt b/codenet/public_test_cases/p01453/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c99993a2bd5781d8cf80dc662d0a825c570d08fb --- /dev/null +++ b/codenet/public_test_cases/p01453/input.0.txt @@ -0,0 +1,7 @@ +8 6 +######## +#..##g.# +#*#.*#.# +#......# +#*s#*.*# +######## diff --git a/codenet/public_test_cases/p01453/input.1.txt b/codenet/public_test_cases/p01453/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c99993a2bd5781d8cf80dc662d0a825c570d08fb --- /dev/null +++ b/codenet/public_test_cases/p01453/input.1.txt @@ -0,0 +1,7 @@ +8 6 +######## +#..##g.# +#*#.*#.# +#......# +#*s#*.*# +######## diff --git a/codenet/public_test_cases/p01453/input.2.txt b/codenet/public_test_cases/p01453/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..26bb970299c59217755cd3f1ba6496efa3d6dacf --- /dev/null +++ b/codenet/public_test_cases/p01453/input.2.txt @@ -0,0 +1,6 @@ +8 6 + +..##g.# +*#.*#.# +......# +*s#*.*# diff --git a/codenet/public_test_cases/p01453/input.3.txt b/codenet/public_test_cases/p01453/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..635c13aa22e286cf76cb8381bcd40a445471f345 --- /dev/null +++ b/codenet/public_test_cases/p01453/input.3.txt @@ -0,0 +1,11 @@ +21 11 + +*#*.*.*.*.*.*.*.*#*# +*#...............#*# +*#.#.#.#.#.#.#.#.#*# +.#.#.#.#.#.#.#.#.## +...................# +.#.#.#.#.#.#.#.#.## +s#.#.#.#.#.#.#.#.#g# +...................# +...................# diff --git a/codenet/public_test_cases/p01453/input.4.txt b/codenet/public_test_cases/p01453/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb544f744b3040f5ea9bfe5c0f6e7317b84d5b4c --- /dev/null +++ b/codenet/public_test_cases/p01453/input.4.txt @@ -0,0 +1,8 @@ +9 8 + +...#*.*# +.*.#...# +...#*.*# + +.s....g# +.*#.*..# diff --git a/codenet/public_test_cases/p01453/output.0.txt b/codenet/public_test_cases/p01453/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..10cb0e376588b4e059fcfb811929923e62b092dd --- /dev/null +++ b/codenet/public_test_cases/p01453/output.0.txt @@ -0,0 +1 @@ +5.857142857143 diff --git a/codenet/public_test_cases/p01453/output.1.txt b/codenet/public_test_cases/p01453/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..10cb0e376588b4e059fcfb811929923e62b092dd --- /dev/null +++ b/codenet/public_test_cases/p01453/output.1.txt @@ -0,0 +1 @@ +5.857142857143 diff --git a/codenet/public_test_cases/p01453/output.2.txt b/codenet/public_test_cases/p01453/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..10cb0e376588b4e059fcfb811929923e62b092dd --- /dev/null +++ b/codenet/public_test_cases/p01453/output.2.txt @@ -0,0 +1 @@ +5.857142857143 diff --git a/codenet/public_test_cases/p01453/output.3.txt b/codenet/public_test_cases/p01453/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bd630466260f0fc38d3a1f0590de16cdd23f843 --- /dev/null +++ b/codenet/public_test_cases/p01453/output.3.txt @@ -0,0 +1 @@ +20.000000000000 diff --git a/codenet/public_test_cases/p01453/output.4.txt b/codenet/public_test_cases/p01453/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..524a22b44e14110cd1ca1275d0e9b44059fe6cb8 --- /dev/null +++ b/codenet/public_test_cases/p01453/output.4.txt @@ -0,0 +1 @@ +5.000000000000 diff --git a/codenet/public_test_cases/p01454/input.0.txt b/codenet/public_test_cases/p01454/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..97ee703ebd89a4e0a14a817ccd92ad82fc9f8c4a --- /dev/null +++ b/codenet/public_test_cases/p01454/input.0.txt @@ -0,0 +1,8 @@ +4 3 12 +3 6 +2 4 +7 9 +10 1 +6 5 +8 4 +15 19 diff --git a/codenet/public_test_cases/p01454/input.1.txt b/codenet/public_test_cases/p01454/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c70446a6202ca16b9e48dfa0123b88b78f967fb8 --- /dev/null +++ b/codenet/public_test_cases/p01454/input.1.txt @@ -0,0 +1,15 @@ +8 6 65 +30 98 +27 51 +4 74 +65 87 +49 19 +27 48 +43 7 +35 28 +43 69 +8 47 +64 75 +18 23 +54 29 +40 43 diff --git a/codenet/public_test_cases/p01454/input.2.txt b/codenet/public_test_cases/p01454/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..95ff8985f965df12818fbe493161a10a656bf7a7 --- /dev/null +++ b/codenet/public_test_cases/p01454/input.2.txt @@ -0,0 +1,5 @@ +1 3 10 +1 15 +6 8 +5 9 +8 7 diff --git a/codenet/public_test_cases/p01454/input.3.txt b/codenet/public_test_cases/p01454/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..97ee703ebd89a4e0a14a817ccd92ad82fc9f8c4a --- /dev/null +++ b/codenet/public_test_cases/p01454/input.3.txt @@ -0,0 +1,8 @@ +4 3 12 +3 6 +2 4 +7 9 +10 1 +6 5 +8 4 +15 19 diff --git a/codenet/public_test_cases/p01454/output.0.txt b/codenet/public_test_cases/p01454/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01454/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01454/output.1.txt b/codenet/public_test_cases/p01454/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01454/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01454/output.2.txt b/codenet/public_test_cases/p01454/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01454/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01454/output.3.txt b/codenet/public_test_cases/p01454/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01454/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01455/input.0.txt b/codenet/public_test_cases/p01455/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59d5c380a0f40fd0423effb351cbab820c407995 --- /dev/null +++ b/codenet/public_test_cases/p01455/input.0.txt @@ -0,0 +1,8 @@ +4 3 +huda +leide +loar +sheza +huda leide +leide loar +loar sheza diff --git a/codenet/public_test_cases/p01455/input.1.txt b/codenet/public_test_cases/p01455/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8608f59db853bd050e7af79ad688b0e221d3429b --- /dev/null +++ b/codenet/public_test_cases/p01455/input.1.txt @@ -0,0 +1,20 @@ +9 10 +riris +soa +elah +clar +arma +memori +neoles +qhaon +clue +clar riris +riris memori +riris neoles +soa clar +soa memori +neoles elah +elah qhaon +neoles qhaon +clue riris +arma elah diff --git a/codenet/public_test_cases/p01455/input.2.txt b/codenet/public_test_cases/p01455/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d36dca56872a05cd796fc72fc8119900fe374481 --- /dev/null +++ b/codenet/public_test_cases/p01455/input.2.txt @@ -0,0 +1,7 @@ +3 3 +torn +siole +dimi +torn siole +torn dimi +siole dimi diff --git a/codenet/public_test_cases/p01455/input.3.txt b/codenet/public_test_cases/p01455/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..59d5c380a0f40fd0423effb351cbab820c407995 --- /dev/null +++ b/codenet/public_test_cases/p01455/input.3.txt @@ -0,0 +1,8 @@ +4 3 +huda +leide +loar +sheza +huda leide +leide loar +loar sheza diff --git a/codenet/public_test_cases/p01455/output.0.txt b/codenet/public_test_cases/p01455/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01455/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01455/output.1.txt b/codenet/public_test_cases/p01455/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb1e7bc86996a80d4a16529b990adda1d3434c92 --- /dev/null +++ b/codenet/public_test_cases/p01455/output.1.txt @@ -0,0 +1 @@ +54 diff --git a/codenet/public_test_cases/p01455/output.2.txt b/codenet/public_test_cases/p01455/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01455/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01455/output.3.txt b/codenet/public_test_cases/p01455/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01455/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01456/input.0.txt b/codenet/public_test_cases/p01456/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..86a492254601383b0487ec65ae9f013cc7205f76 --- /dev/null +++ b/codenet/public_test_cases/p01456/input.0.txt @@ -0,0 +1,12 @@ +6 5 +7 +14 +5 +11 +2 +5 +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p01456/input.1.txt b/codenet/public_test_cases/p01456/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e85d1048ab8c52e961f14ba4d1f2ec559b628f2 --- /dev/null +++ b/codenet/public_test_cases/p01456/input.1.txt @@ -0,0 +1,16 @@ +8 7 +6 +1 +7 +2 +5 +2 +6 +3 +1 3 +6 3 +7 4 +4 2 +1 6 +5 4 +7 5 diff --git a/codenet/public_test_cases/p01456/input.2.txt b/codenet/public_test_cases/p01456/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1436a883d5f0384bc6495e57430dd7fba3327b0 --- /dev/null +++ b/codenet/public_test_cases/p01456/input.2.txt @@ -0,0 +1,13 @@ +5 7 +295 +127 +350 +982 +426 +1 5 +3 5 +4 2 +3 1 +3 4 +5 4 +3 2 diff --git a/codenet/public_test_cases/p01456/input.3.txt b/codenet/public_test_cases/p01456/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..86a492254601383b0487ec65ae9f013cc7205f76 --- /dev/null +++ b/codenet/public_test_cases/p01456/input.3.txt @@ -0,0 +1,12 @@ +6 5 +7 +14 +5 +11 +2 +5 +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p01456/output.0.txt b/codenet/public_test_cases/p01456/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01456/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01456/output.1.txt b/codenet/public_test_cases/p01456/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01456/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01456/output.2.txt b/codenet/public_test_cases/p01456/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01456/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01456/output.3.txt b/codenet/public_test_cases/p01456/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01456/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01457/input.0.txt b/codenet/public_test_cases/p01457/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bdda566485ba2788e4c7c4a0079efa3992bc177 --- /dev/null +++ b/codenet/public_test_cases/p01457/input.0.txt @@ -0,0 +1,4 @@ +3 +0 ( 10 +10 ) 5 +10 ) 5 diff --git a/codenet/public_test_cases/p01457/input.1.txt b/codenet/public_test_cases/p01457/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a5054123ced5bb33075485cbce20c8bc2c9e0c5 --- /dev/null +++ b/codenet/public_test_cases/p01457/input.1.txt @@ -0,0 +1,4 @@ +3 +0 ( 10 +10 ) 20 +0 ( 10 diff --git a/codenet/public_test_cases/p01457/input.2.txt b/codenet/public_test_cases/p01457/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bdda566485ba2788e4c7c4a0079efa3992bc177 --- /dev/null +++ b/codenet/public_test_cases/p01457/input.2.txt @@ -0,0 +1,4 @@ +3 +0 ( 10 +10 ) 5 +10 ) 5 diff --git a/codenet/public_test_cases/p01457/input.3.txt b/codenet/public_test_cases/p01457/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac7edb819b25326bd1090b46bf48f4b33a3f9580 --- /dev/null +++ b/codenet/public_test_cases/p01457/input.3.txt @@ -0,0 +1,4 @@ +3 +0 ) 10 +10 ( 5 +10 ( 5 diff --git a/codenet/public_test_cases/p01457/output.0.txt b/codenet/public_test_cases/p01457/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..464d18dabd8db5efc162bbdc98b6fbe51d6d78dc --- /dev/null +++ b/codenet/public_test_cases/p01457/output.0.txt @@ -0,0 +1,3 @@ +No +No +Yes diff --git a/codenet/public_test_cases/p01457/output.1.txt b/codenet/public_test_cases/p01457/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..464d18dabd8db5efc162bbdc98b6fbe51d6d78dc --- /dev/null +++ b/codenet/public_test_cases/p01457/output.1.txt @@ -0,0 +1,3 @@ +No +No +Yes diff --git a/codenet/public_test_cases/p01457/output.2.txt b/codenet/public_test_cases/p01457/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..464d18dabd8db5efc162bbdc98b6fbe51d6d78dc --- /dev/null +++ b/codenet/public_test_cases/p01457/output.2.txt @@ -0,0 +1,3 @@ +No +No +Yes diff --git a/codenet/public_test_cases/p01457/output.3.txt b/codenet/public_test_cases/p01457/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..464d18dabd8db5efc162bbdc98b6fbe51d6d78dc --- /dev/null +++ b/codenet/public_test_cases/p01457/output.3.txt @@ -0,0 +1,3 @@ +No +No +Yes diff --git a/codenet/public_test_cases/p01458/input.0.txt b/codenet/public_test_cases/p01458/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f4cdbff6dc24cedaa89dfd1da1c88310de50f83 --- /dev/null +++ b/codenet/public_test_cases/p01458/input.0.txt @@ -0,0 +1,3 @@ +2 10 2 +hello +world diff --git a/codenet/public_test_cases/p01458/input.1.txt b/codenet/public_test_cases/p01458/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9b0c3d25f2b2d3aff5af6b0fcae43fc7e26031c --- /dev/null +++ b/codenet/public_test_cases/p01458/input.1.txt @@ -0,0 +1,4 @@ +3 3 6 +a +aa +b diff --git a/codenet/public_test_cases/p01458/input.2.txt b/codenet/public_test_cases/p01458/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f4cdbff6dc24cedaa89dfd1da1c88310de50f83 --- /dev/null +++ b/codenet/public_test_cases/p01458/input.2.txt @@ -0,0 +1,3 @@ +2 10 2 +hello +world diff --git a/codenet/public_test_cases/p01458/input.3.txt b/codenet/public_test_cases/p01458/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4cb8b2e2e8d1201c55dd777b20fdb2eec6d02e5f --- /dev/null +++ b/codenet/public_test_cases/p01458/input.3.txt @@ -0,0 +1,3 @@ +2 59 1000000000000000000 +a +b diff --git a/codenet/public_test_cases/p01458/output.0.txt b/codenet/public_test_cases/p01458/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31e0fce560e96c8b357f5b8630c7d8fbeb0a3ec8 --- /dev/null +++ b/codenet/public_test_cases/p01458/output.0.txt @@ -0,0 +1 @@ +helloworld diff --git a/codenet/public_test_cases/p01458/output.1.txt b/codenet/public_test_cases/p01458/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9265f8251cfab3529825e5c708c15c55801bed5 --- /dev/null +++ b/codenet/public_test_cases/p01458/output.1.txt @@ -0,0 +1 @@ +aba diff --git a/codenet/public_test_cases/p01458/output.2.txt b/codenet/public_test_cases/p01458/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..31e0fce560e96c8b357f5b8630c7d8fbeb0a3ec8 --- /dev/null +++ b/codenet/public_test_cases/p01458/output.2.txt @@ -0,0 +1 @@ +helloworld diff --git a/codenet/public_test_cases/p01458/output.3.txt b/codenet/public_test_cases/p01458/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..39cdd0ded6df763f8ef1209d48a407a427a5edb7 --- /dev/null +++ b/codenet/public_test_cases/p01458/output.3.txt @@ -0,0 +1 @@ +- diff --git a/codenet/public_test_cases/p01459/input.0.txt b/codenet/public_test_cases/p01459/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90bcb30c04fa50c5975288522b31d762cbd874b6 --- /dev/null +++ b/codenet/public_test_cases/p01459/input.0.txt @@ -0,0 +1,4 @@ +3 3 2 +S#. +... +.#G diff --git a/codenet/public_test_cases/p01459/input.1.txt b/codenet/public_test_cases/p01459/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ee9cfff0d9984b4dcf49ea49f5d4a1ad8c329db --- /dev/null +++ b/codenet/public_test_cases/p01459/input.1.txt @@ -0,0 +1,4 @@ +3 3 1 +S#. +... +.#G diff --git a/codenet/public_test_cases/p01459/input.2.txt b/codenet/public_test_cases/p01459/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..def15fabe2c8fc7db8fbd6b3289e25df9bb5e2e1 --- /dev/null +++ b/codenet/public_test_cases/p01459/input.2.txt @@ -0,0 +1,4 @@ +3 3 1 +S#G +... +.#. diff --git a/codenet/public_test_cases/p01459/input.3.txt b/codenet/public_test_cases/p01459/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..90bcb30c04fa50c5975288522b31d762cbd874b6 --- /dev/null +++ b/codenet/public_test_cases/p01459/input.3.txt @@ -0,0 +1,4 @@ +3 3 2 +S#. +... +.#G diff --git a/codenet/public_test_cases/p01459/input.4.txt b/codenet/public_test_cases/p01459/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..303d759f9156f7b1298a43b7d894d1c592615d04 --- /dev/null +++ b/codenet/public_test_cases/p01459/input.4.txt @@ -0,0 +1,5 @@ +4 3 2 +S.. +... +..# +.#G diff --git a/codenet/public_test_cases/p01459/output.0.txt b/codenet/public_test_cases/p01459/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01459/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01459/output.1.txt b/codenet/public_test_cases/p01459/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01459/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01459/output.2.txt b/codenet/public_test_cases/p01459/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01459/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01459/output.3.txt b/codenet/public_test_cases/p01459/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01459/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01459/output.4.txt b/codenet/public_test_cases/p01459/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01459/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01460/input.0.txt b/codenet/public_test_cases/p01460/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fb8c304af3ea99a528174214c75db4b595e4481 --- /dev/null +++ b/codenet/public_test_cases/p01460/input.0.txt @@ -0,0 +1,2 @@ +2 1 3 6 12 1 2 1 2 +WR 1 1 1 diff --git a/codenet/public_test_cases/p01460/input.1.txt b/codenet/public_test_cases/p01460/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c049ae2871c78f40127032c8b1826f18233b711a --- /dev/null +++ b/codenet/public_test_cases/p01460/input.1.txt @@ -0,0 +1,2 @@ +2 1 3 6 12 1 2 1 2 +RL diff --git a/codenet/public_test_cases/p01460/input.2.txt b/codenet/public_test_cases/p01460/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5ce5fa26296037484908396bb7758af878e2dc4 --- /dev/null +++ b/codenet/public_test_cases/p01460/input.2.txt @@ -0,0 +1,2 @@ +2 1 3 6 12 1 2 1 2 +RH diff --git a/codenet/public_test_cases/p01460/input.3.txt b/codenet/public_test_cases/p01460/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8acf7f293ebdc8c5656f73ac8ec931f7f854b0bc --- /dev/null +++ b/codenet/public_test_cases/p01460/input.3.txt @@ -0,0 +1,7 @@ +39989 6 999983 999979 999961 1 1000 1 1000 +SR 1 39989 +SC 1 39989 +RL +RH +RR +RV diff --git a/codenet/public_test_cases/p01460/input.4.txt b/codenet/public_test_cases/p01460/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fb8c304af3ea99a528174214c75db4b595e4481 --- /dev/null +++ b/codenet/public_test_cases/p01460/input.4.txt @@ -0,0 +1,2 @@ +2 1 3 6 12 1 2 1 2 +WR 1 1 1 diff --git a/codenet/public_test_cases/p01460/output.0.txt b/codenet/public_test_cases/p01460/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..77ee16e960f84c638494db16b482c23c76fa0740 --- /dev/null +++ b/codenet/public_test_cases/p01460/output.0.txt @@ -0,0 +1 @@ +676573821 diff --git a/codenet/public_test_cases/p01460/output.1.txt b/codenet/public_test_cases/p01460/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f5755c2a809750dea2b43ede051840503a4ce1d --- /dev/null +++ b/codenet/public_test_cases/p01460/output.1.txt @@ -0,0 +1 @@ +676636559 diff --git a/codenet/public_test_cases/p01460/output.2.txt b/codenet/public_test_cases/p01460/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..30edd44c3e2ce075f7c8dc25fda66ae644d4a81f --- /dev/null +++ b/codenet/public_test_cases/p01460/output.2.txt @@ -0,0 +1 @@ +676547189 diff --git a/codenet/public_test_cases/p01460/output.3.txt b/codenet/public_test_cases/p01460/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..746c48944295f44a2f0139ac559299a7654aaed7 --- /dev/null +++ b/codenet/public_test_cases/p01460/output.3.txt @@ -0,0 +1 @@ +458797120 diff --git a/codenet/public_test_cases/p01460/output.4.txt b/codenet/public_test_cases/p01460/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..77ee16e960f84c638494db16b482c23c76fa0740 --- /dev/null +++ b/codenet/public_test_cases/p01460/output.4.txt @@ -0,0 +1 @@ +676573821 diff --git a/codenet/public_test_cases/p01461/input.0.txt b/codenet/public_test_cases/p01461/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0be75d3147aa0f1aaa598f611c2613c64400432d --- /dev/null +++ b/codenet/public_test_cases/p01461/input.0.txt @@ -0,0 +1,4 @@ +4 +2 3 +4 4 +4 4 diff --git a/codenet/public_test_cases/p01461/input.1.txt b/codenet/public_test_cases/p01461/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..847c1edd0e42b03a02d04005453819a4507de829 --- /dev/null +++ b/codenet/public_test_cases/p01461/input.1.txt @@ -0,0 +1,5 @@ +5 +5 2 +3 5 +5 4 +5 5 diff --git a/codenet/public_test_cases/p01461/input.2.txt b/codenet/public_test_cases/p01461/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0be75d3147aa0f1aaa598f611c2613c64400432d --- /dev/null +++ b/codenet/public_test_cases/p01461/input.2.txt @@ -0,0 +1,4 @@ +4 +2 3 +4 4 +4 4 diff --git a/codenet/public_test_cases/p01461/output.0.txt b/codenet/public_test_cases/p01461/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01461/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01461/output.1.txt b/codenet/public_test_cases/p01461/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01461/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01461/output.2.txt b/codenet/public_test_cases/p01461/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01461/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01462/input.0.txt b/codenet/public_test_cases/p01462/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d25b8badfb92ca8fc06cfdfd706273b30fe4e1a6 --- /dev/null +++ b/codenet/public_test_cases/p01462/input.0.txt @@ -0,0 +1,4 @@ +3 3 50 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01462/input.1.txt b/codenet/public_test_cases/p01462/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..817c5e39567be4a5c25fb3fc1ec3e7f0093a78f8 --- /dev/null +++ b/codenet/public_test_cases/p01462/input.1.txt @@ -0,0 +1,4 @@ +3 3 10 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01462/input.2.txt b/codenet/public_test_cases/p01462/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cc10ea49ea976969d0e7a5f082f7ee669dfbc69 --- /dev/null +++ b/codenet/public_test_cases/p01462/input.2.txt @@ -0,0 +1,6 @@ +4 5 50 +1 2 +2 3 +3 4 +4 1 +1 3 diff --git a/codenet/public_test_cases/p01462/input.3.txt b/codenet/public_test_cases/p01462/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d25b8badfb92ca8fc06cfdfd706273b30fe4e1a6 --- /dev/null +++ b/codenet/public_test_cases/p01462/input.3.txt @@ -0,0 +1,4 @@ +3 3 50 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01462/output.0.txt b/codenet/public_test_cases/p01462/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ebd5c87b2e73360d7a176e595e520f4107af874 --- /dev/null +++ b/codenet/public_test_cases/p01462/output.0.txt @@ -0,0 +1 @@ +0.500000000000 diff --git a/codenet/public_test_cases/p01462/output.1.txt b/codenet/public_test_cases/p01462/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..43e221125001a0a996d09c65b4ec46479418303a --- /dev/null +++ b/codenet/public_test_cases/p01462/output.1.txt @@ -0,0 +1 @@ +0.972000000000 diff --git a/codenet/public_test_cases/p01462/output.2.txt b/codenet/public_test_cases/p01462/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..530d0c96ddcaf9acb1ef27b8ee1886f1c90d30e4 --- /dev/null +++ b/codenet/public_test_cases/p01462/output.2.txt @@ -0,0 +1 @@ +0.437500000000 diff --git a/codenet/public_test_cases/p01462/output.3.txt b/codenet/public_test_cases/p01462/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ebd5c87b2e73360d7a176e595e520f4107af874 --- /dev/null +++ b/codenet/public_test_cases/p01462/output.3.txt @@ -0,0 +1 @@ +0.500000000000 diff --git a/codenet/public_test_cases/p01463/input.0.txt b/codenet/public_test_cases/p01463/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5fa956cfcf39c25b87b4e994149b4709d57d3b5 --- /dev/null +++ b/codenet/public_test_cases/p01463/input.0.txt @@ -0,0 +1,5 @@ +2 +0 0 +15 0 +5 0 1 +10 10 2 diff --git a/codenet/public_test_cases/p01463/input.1.txt b/codenet/public_test_cases/p01463/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5fa956cfcf39c25b87b4e994149b4709d57d3b5 --- /dev/null +++ b/codenet/public_test_cases/p01463/input.1.txt @@ -0,0 +1,5 @@ +2 +0 0 +15 0 +5 0 1 +10 10 2 diff --git a/codenet/public_test_cases/p01463/input.2.txt b/codenet/public_test_cases/p01463/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c137e95a7bb89b51019e8864cfc80c099a5415b5 --- /dev/null +++ b/codenet/public_test_cases/p01463/input.2.txt @@ -0,0 +1,5 @@ +2 +0 0 +10 0 +5 0 1 +9 0 3 diff --git a/codenet/public_test_cases/p01463/input.3.txt b/codenet/public_test_cases/p01463/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..eee9c723414d3dbebbba598b115ca96532ed2b1c --- /dev/null +++ b/codenet/public_test_cases/p01463/input.3.txt @@ -0,0 +1,6 @@ +3 +-10 0 +0 0 +0 10 +-1 0 1 +3 0 2 diff --git a/codenet/public_test_cases/p01463/output.0.txt b/codenet/public_test_cases/p01463/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..819e07a22435f1e8efcbdd1d1c062deef0e501b1 --- /dev/null +++ b/codenet/public_test_cases/p01463/output.0.txt @@ -0,0 +1 @@ +5.0 diff --git a/codenet/public_test_cases/p01463/output.1.txt b/codenet/public_test_cases/p01463/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..819e07a22435f1e8efcbdd1d1c062deef0e501b1 --- /dev/null +++ b/codenet/public_test_cases/p01463/output.1.txt @@ -0,0 +1 @@ +5.0 diff --git a/codenet/public_test_cases/p01463/output.2.txt b/codenet/public_test_cases/p01463/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd5ac039d67e0bdadb17976e4ac39f0ffe6bb6e4 --- /dev/null +++ b/codenet/public_test_cases/p01463/output.2.txt @@ -0,0 +1 @@ +2.0 diff --git a/codenet/public_test_cases/p01463/output.3.txt b/codenet/public_test_cases/p01463/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..34d88b2e8c0c94da69a21eb143db68cb62159629 --- /dev/null +++ b/codenet/public_test_cases/p01463/output.3.txt @@ -0,0 +1 @@ +4.072027 diff --git a/codenet/public_test_cases/p01464/input.0.txt b/codenet/public_test_cases/p01464/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1204717e6e39b2ab86a540636a8793ecebb3654f --- /dev/null +++ b/codenet/public_test_cases/p01464/input.0.txt @@ -0,0 +1,6 @@ +5 5 +1 2 +2 3 +3 4 +4 5 +1 3 diff --git a/codenet/public_test_cases/p01464/input.1.txt b/codenet/public_test_cases/p01464/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1204717e6e39b2ab86a540636a8793ecebb3654f --- /dev/null +++ b/codenet/public_test_cases/p01464/input.1.txt @@ -0,0 +1,6 @@ +5 5 +1 2 +2 3 +3 4 +4 5 +1 3 diff --git a/codenet/public_test_cases/p01464/input.2.txt b/codenet/public_test_cases/p01464/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a0e0f9c4948bc5ff9e0cf74ba0a8105ad799456 --- /dev/null +++ b/codenet/public_test_cases/p01464/input.2.txt @@ -0,0 +1,6 @@ +5 5 +1 2 +2 3 +3 4 +4 5 +1 4 diff --git a/codenet/public_test_cases/p01464/output.0.txt b/codenet/public_test_cases/p01464/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01464/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01464/output.1.txt b/codenet/public_test_cases/p01464/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01464/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01464/output.2.txt b/codenet/public_test_cases/p01464/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01464/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01465/input.0.txt b/codenet/public_test_cases/p01465/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fd957790793ccce4db85502d5cec762f1e2a121 --- /dev/null +++ b/codenet/public_test_cases/p01465/input.0.txt @@ -0,0 +1 @@ +(x1&x2) diff --git a/codenet/public_test_cases/p01465/input.1.txt b/codenet/public_test_cases/p01465/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fd957790793ccce4db85502d5cec762f1e2a121 --- /dev/null +++ b/codenet/public_test_cases/p01465/input.1.txt @@ -0,0 +1 @@ +(x1&x2) diff --git a/codenet/public_test_cases/p01465/input.2.txt b/codenet/public_test_cases/p01465/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fa0067d3a76a8700a9fbaf31c3d0d65a08f231f --- /dev/null +++ b/codenet/public_test_cases/p01465/input.2.txt @@ -0,0 +1 @@ +(x1&x2)|(x3&x4)|(~(x5|x6)&(x7&x8)) diff --git a/codenet/public_test_cases/p01465/output.0.txt b/codenet/public_test_cases/p01465/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01465/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01465/output.1.txt b/codenet/public_test_cases/p01465/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01465/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01465/output.2.txt b/codenet/public_test_cases/p01465/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9289ddcee3446cde7bd64e816af423a090ea0226 --- /dev/null +++ b/codenet/public_test_cases/p01465/output.2.txt @@ -0,0 +1 @@ +121 diff --git a/codenet/public_test_cases/p01466/input.0.txt b/codenet/public_test_cases/p01466/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..564b5a96a75187ec248633b674d70d3824c14890 --- /dev/null +++ b/codenet/public_test_cases/p01466/input.0.txt @@ -0,0 +1,9 @@ +4 6 +1 1 1 1 +1 1 1 1 +1 1 2 1 1 +1 1 3 1 2 +1 1 4 1 1 +2 1 3 1 1 +2 1 4 1 2 +3 1 4 1 1 diff --git a/codenet/public_test_cases/p01466/input.1.txt b/codenet/public_test_cases/p01466/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..93cc05e13ada82f418c409dd6c1f23fd2eefe9eb --- /dev/null +++ b/codenet/public_test_cases/p01466/input.1.txt @@ -0,0 +1,19 @@ +2 16 +4 4 +2 2 +1 1 1 2 1 +1 1 1 3 2 +1 1 1 4 1 +1 2 1 3 1 +1 2 1 4 2 +1 3 1 4 1 +2 1 2 2 1 +2 1 2 3 2 +2 1 2 4 1 +2 2 2 3 1 +2 2 2 4 2 +2 3 2 4 1 +1 1 2 1 1 +1 1 2 2 2 +1 2 2 1 2 +1 2 2 2 1 diff --git a/codenet/public_test_cases/p01466/input.2.txt b/codenet/public_test_cases/p01466/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b59d92d305223697eae77848ecd7db0130b04d25 --- /dev/null +++ b/codenet/public_test_cases/p01466/input.2.txt @@ -0,0 +1,5 @@ +2 2 +2 1 +1 1 +1 1 1 2 1 +1 1 2 1 1 diff --git a/codenet/public_test_cases/p01466/input.3.txt b/codenet/public_test_cases/p01466/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..564b5a96a75187ec248633b674d70d3824c14890 --- /dev/null +++ b/codenet/public_test_cases/p01466/input.3.txt @@ -0,0 +1,9 @@ +4 6 +1 1 1 1 +1 1 1 1 +1 1 2 1 1 +1 1 3 1 2 +1 1 4 1 1 +2 1 3 1 1 +2 1 4 1 2 +3 1 4 1 1 diff --git a/codenet/public_test_cases/p01466/output.0.txt b/codenet/public_test_cases/p01466/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01466/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01466/output.1.txt b/codenet/public_test_cases/p01466/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01466/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01466/output.2.txt b/codenet/public_test_cases/p01466/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01466/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01466/output.3.txt b/codenet/public_test_cases/p01466/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01466/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01467/input.0.txt b/codenet/public_test_cases/p01467/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54e451ad068d587c6b4692120448376249557a6f --- /dev/null +++ b/codenet/public_test_cases/p01467/input.0.txt @@ -0,0 +1 @@ +99 98 1 diff --git a/codenet/public_test_cases/p01467/input.1.txt b/codenet/public_test_cases/p01467/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6f065ca52355b1e64cff12b79b6c001c2b65fd0 --- /dev/null +++ b/codenet/public_test_cases/p01467/input.1.txt @@ -0,0 +1 @@ +538 84 1 diff --git a/codenet/public_test_cases/p01467/input.2.txt b/codenet/public_test_cases/p01467/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b4260df8fed54ac0f5685a6271e94680cc6c0ae --- /dev/null +++ b/codenet/public_test_cases/p01467/input.2.txt @@ -0,0 +1 @@ +2012 1987 1 diff --git a/codenet/public_test_cases/p01467/input.3.txt b/codenet/public_test_cases/p01467/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..54e451ad068d587c6b4692120448376249557a6f --- /dev/null +++ b/codenet/public_test_cases/p01467/input.3.txt @@ -0,0 +1 @@ +99 98 1 diff --git a/codenet/public_test_cases/p01467/input.4.txt b/codenet/public_test_cases/p01467/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..37f1f2a8a901bf7ce59d6fb4fc8bfe784657d1a3 --- /dev/null +++ b/codenet/public_test_cases/p01467/input.4.txt @@ -0,0 +1 @@ +100 2 3 diff --git a/codenet/public_test_cases/p01467/output.0.txt b/codenet/public_test_cases/p01467/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01467/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01467/output.1.txt b/codenet/public_test_cases/p01467/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1f994ac98222c4c3a9c3d5458e5061aea54cce5 --- /dev/null +++ b/codenet/public_test_cases/p01467/output.1.txt @@ -0,0 +1 @@ +554 diff --git a/codenet/public_test_cases/p01467/output.2.txt b/codenet/public_test_cases/p01467/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bec4b5cd08949f80a44e721b14a31d39bfc7b7df --- /dev/null +++ b/codenet/public_test_cases/p01467/output.2.txt @@ -0,0 +1 @@ +1025 diff --git a/codenet/public_test_cases/p01467/output.3.txt b/codenet/public_test_cases/p01467/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01467/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01467/output.4.txt b/codenet/public_test_cases/p01467/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca55a6c593be020340f95b3ada9f869955700e60 --- /dev/null +++ b/codenet/public_test_cases/p01467/output.4.txt @@ -0,0 +1 @@ +198 diff --git a/codenet/public_test_cases/p01468/input.0.txt b/codenet/public_test_cases/p01468/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..180b3b8c8c8d95a7d4c85b2526ba5de19ef94805 --- /dev/null +++ b/codenet/public_test_cases/p01468/input.0.txt @@ -0,0 +1,5 @@ +4 +2 0 2 25 +0 30 15 20 +16 20 5 15 +23 0 23 30 diff --git a/codenet/public_test_cases/p01468/input.1.txt b/codenet/public_test_cases/p01468/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e1743079908fddfe16da470935f86316ef60056 --- /dev/null +++ b/codenet/public_test_cases/p01468/input.1.txt @@ -0,0 +1,7 @@ +6 +5 5 5 45 +7 45 19 45 +7 30 19 30 +21 34 21 44 +26 45 36 28 +45 45 26 5 diff --git a/codenet/public_test_cases/p01468/input.2.txt b/codenet/public_test_cases/p01468/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..180b3b8c8c8d95a7d4c85b2526ba5de19ef94805 --- /dev/null +++ b/codenet/public_test_cases/p01468/input.2.txt @@ -0,0 +1,5 @@ +4 +2 0 2 25 +0 30 15 20 +16 20 5 15 +23 0 23 30 diff --git a/codenet/public_test_cases/p01468/input.3.txt b/codenet/public_test_cases/p01468/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e087a4510af2d379460c1aedcc6dc33e3bd17895 --- /dev/null +++ b/codenet/public_test_cases/p01468/input.3.txt @@ -0,0 +1,12 @@ +11 +10 10 10 90 +10 90 35 90 +10 60 35 60 +35 60 35 90 +40 10 40 90 +37 45 60 45 +60 10 60 45 +65 10 65 90 +65 90 90 90 +65 60 90 65 +90 60 90 90 diff --git a/codenet/public_test_cases/p01468/input.4.txt b/codenet/public_test_cases/p01468/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6332174369989286470315cf4d30c207610eefeb --- /dev/null +++ b/codenet/public_test_cases/p01468/input.4.txt @@ -0,0 +1,7 @@ +6 +0 0 0 5 +1 3 3 5 +6 0 6 10 +7 4 10 4 +11 1 11 3 +7 0 10 0 diff --git a/codenet/public_test_cases/p01468/output.0.txt b/codenet/public_test_cases/p01468/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18dce6dc8462d7d124afff69a2f475dc8b68aa26 --- /dev/null +++ b/codenet/public_test_cases/p01468/output.0.txt @@ -0,0 +1 @@ +0.41380294 diff --git a/codenet/public_test_cases/p01468/output.1.txt b/codenet/public_test_cases/p01468/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4a74e9118f0fc0dd7f05717eb2414940e14801e --- /dev/null +++ b/codenet/public_test_cases/p01468/output.1.txt @@ -0,0 +1 @@ +0.83553169 diff --git a/codenet/public_test_cases/p01468/output.2.txt b/codenet/public_test_cases/p01468/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..18dce6dc8462d7d124afff69a2f475dc8b68aa26 --- /dev/null +++ b/codenet/public_test_cases/p01468/output.2.txt @@ -0,0 +1 @@ +0.41380294 diff --git a/codenet/public_test_cases/p01468/output.3.txt b/codenet/public_test_cases/p01468/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..84f5e5cefe21999a6f810d40c1c626050ac26e6f --- /dev/null +++ b/codenet/public_test_cases/p01468/output.3.txt @@ -0,0 +1 @@ +0.00000000 diff --git a/codenet/public_test_cases/p01468/output.4.txt b/codenet/public_test_cases/p01468/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0791a90d6a252124e045a06241ead70bf6c2855 --- /dev/null +++ b/codenet/public_test_cases/p01468/output.4.txt @@ -0,0 +1 @@ +1.00000000 diff --git a/codenet/public_test_cases/p01469/input.0.txt b/codenet/public_test_cases/p01469/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0beea95e717453c3acb7685446eb5ebaff8cbdcb --- /dev/null +++ b/codenet/public_test_cases/p01469/input.0.txt @@ -0,0 +1,2 @@ +3 +25 125 5 diff --git a/codenet/public_test_cases/p01469/input.1.txt b/codenet/public_test_cases/p01469/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f57bcddee648facdcc70bb49e0fd89cc5b95e1e --- /dev/null +++ b/codenet/public_test_cases/p01469/input.1.txt @@ -0,0 +1,2 @@ +3 +6 3 2 diff --git a/codenet/public_test_cases/p01469/input.2.txt b/codenet/public_test_cases/p01469/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c78f37d5b104dc2323d424eba0fb725c449d1a8c --- /dev/null +++ b/codenet/public_test_cases/p01469/input.2.txt @@ -0,0 +1,2 @@ +10 +10 9 8 7 6 5 4 3 2 1 diff --git a/codenet/public_test_cases/p01469/input.3.txt b/codenet/public_test_cases/p01469/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0beea95e717453c3acb7685446eb5ebaff8cbdcb --- /dev/null +++ b/codenet/public_test_cases/p01469/input.3.txt @@ -0,0 +1,2 @@ +3 +25 125 5 diff --git a/codenet/public_test_cases/p01469/output.0.txt b/codenet/public_test_cases/p01469/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01469/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01469/output.1.txt b/codenet/public_test_cases/p01469/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p01469/output.1.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p01469/output.2.txt b/codenet/public_test_cases/p01469/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aacb59525ae5e32096372e24707fe291c5a4dae4 --- /dev/null +++ b/codenet/public_test_cases/p01469/output.2.txt @@ -0,0 +1 @@ +1 2 3 4 5 diff --git a/codenet/public_test_cases/p01469/output.3.txt b/codenet/public_test_cases/p01469/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01469/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01470/input.0.txt b/codenet/public_test_cases/p01470/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8dd4603f5ae406a1ea4968a19f0741b754a1bb3 --- /dev/null +++ b/codenet/public_test_cases/p01470/input.0.txt @@ -0,0 +1,5 @@ +4 +1 1 +4 2 +2 4 +3 4 diff --git a/codenet/public_test_cases/p01470/input.1.txt b/codenet/public_test_cases/p01470/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8dd4603f5ae406a1ea4968a19f0741b754a1bb3 --- /dev/null +++ b/codenet/public_test_cases/p01470/input.1.txt @@ -0,0 +1,5 @@ +4 +1 1 +4 2 +2 4 +3 4 diff --git a/codenet/public_test_cases/p01470/output.0.txt b/codenet/public_test_cases/p01470/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad4d9c340c1491418f0d0b84ce1751712f397406 --- /dev/null +++ b/codenet/public_test_cases/p01470/output.0.txt @@ -0,0 +1 @@ +-14 diff --git a/codenet/public_test_cases/p01470/output.1.txt b/codenet/public_test_cases/p01470/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad4d9c340c1491418f0d0b84ce1751712f397406 --- /dev/null +++ b/codenet/public_test_cases/p01470/output.1.txt @@ -0,0 +1 @@ +-14 diff --git a/codenet/public_test_cases/p01471/input.0.txt b/codenet/public_test_cases/p01471/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f71a7b0841352dec6384113f07778abcc613c9b --- /dev/null +++ b/codenet/public_test_cases/p01471/input.0.txt @@ -0,0 +1,2 @@ +1 1 +3 1 diff --git a/codenet/public_test_cases/p01471/input.1.txt b/codenet/public_test_cases/p01471/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f71a7b0841352dec6384113f07778abcc613c9b --- /dev/null +++ b/codenet/public_test_cases/p01471/input.1.txt @@ -0,0 +1,2 @@ +1 1 +3 1 diff --git a/codenet/public_test_cases/p01471/input.2.txt b/codenet/public_test_cases/p01471/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ada4554c860eafbd1bc6da20a11fb60fd3f910d7 --- /dev/null +++ b/codenet/public_test_cases/p01471/input.2.txt @@ -0,0 +1,3 @@ +2 1 +-1 -3 +3 10 diff --git a/codenet/public_test_cases/p01471/input.3.txt b/codenet/public_test_cases/p01471/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..50647895a4afb562236fcc206a05d7e1624fa030 --- /dev/null +++ b/codenet/public_test_cases/p01471/input.3.txt @@ -0,0 +1,3 @@ +2 3 +3 3 +1 2 diff --git a/codenet/public_test_cases/p01471/output.0.txt b/codenet/public_test_cases/p01471/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bbca1c98f8fdb4d556e05f72f9ebb8a6f4ded2b --- /dev/null +++ b/codenet/public_test_cases/p01471/output.0.txt @@ -0,0 +1 @@ +0.333333 diff --git a/codenet/public_test_cases/p01471/output.1.txt b/codenet/public_test_cases/p01471/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bbca1c98f8fdb4d556e05f72f9ebb8a6f4ded2b --- /dev/null +++ b/codenet/public_test_cases/p01471/output.1.txt @@ -0,0 +1 @@ +0.333333 diff --git a/codenet/public_test_cases/p01471/output.2.txt b/codenet/public_test_cases/p01471/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ef28ab59e5b22105dab1a96d62b036b5bc4ff6c --- /dev/null +++ b/codenet/public_test_cases/p01471/output.2.txt @@ -0,0 +1 @@ +3.666667 diff --git a/codenet/public_test_cases/p01471/output.3.txt b/codenet/public_test_cases/p01471/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9406425c60fc6c56a6ddcfaec9467d926c62225b --- /dev/null +++ b/codenet/public_test_cases/p01471/output.3.txt @@ -0,0 +1 @@ +4.000000 diff --git a/codenet/public_test_cases/p01472/input.0.txt b/codenet/public_test_cases/p01472/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d556dc0caed9e25a428b234b1cd539b83eb7379f --- /dev/null +++ b/codenet/public_test_cases/p01472/input.0.txt @@ -0,0 +1,3 @@ +2 0 +1 3 +1 1 diff --git a/codenet/public_test_cases/p01472/input.1.txt b/codenet/public_test_cases/p01472/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef26b296eec1bf799dcd502d45af1cca9cff0925 --- /dev/null +++ b/codenet/public_test_cases/p01472/input.1.txt @@ -0,0 +1,3 @@ +2 5 +3 4 +7 6 diff --git a/codenet/public_test_cases/p01472/input.2.txt b/codenet/public_test_cases/p01472/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d556dc0caed9e25a428b234b1cd539b83eb7379f --- /dev/null +++ b/codenet/public_test_cases/p01472/input.2.txt @@ -0,0 +1,3 @@ +2 0 +1 3 +1 1 diff --git a/codenet/public_test_cases/p01472/input.3.txt b/codenet/public_test_cases/p01472/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e765bae60568912f6dc29b66ca137cfcde41c10b --- /dev/null +++ b/codenet/public_test_cases/p01472/input.3.txt @@ -0,0 +1,3 @@ +2 100 +0 0 +0 0 diff --git a/codenet/public_test_cases/p01472/output.0.txt b/codenet/public_test_cases/p01472/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c428bd646570b717cf3c9895414efe12d942248 --- /dev/null +++ b/codenet/public_test_cases/p01472/output.0.txt @@ -0,0 +1,2 @@ +Second +3 diff --git a/codenet/public_test_cases/p01472/output.1.txt b/codenet/public_test_cases/p01472/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc63740ccf338055e903c194333c4bd70855626 --- /dev/null +++ b/codenet/public_test_cases/p01472/output.1.txt @@ -0,0 +1,2 @@ +Draw +4 diff --git a/codenet/public_test_cases/p01472/output.2.txt b/codenet/public_test_cases/p01472/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c428bd646570b717cf3c9895414efe12d942248 --- /dev/null +++ b/codenet/public_test_cases/p01472/output.2.txt @@ -0,0 +1,2 @@ +Second +3 diff --git a/codenet/public_test_cases/p01472/output.3.txt b/codenet/public_test_cases/p01472/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba15f7df5e35e569908af959b699335f8db3ed7 --- /dev/null +++ b/codenet/public_test_cases/p01472/output.3.txt @@ -0,0 +1,2 @@ +First +2 diff --git a/codenet/public_test_cases/p01473/input.0.txt b/codenet/public_test_cases/p01473/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81bf396956110ad81c14860af1bbcc9dfbe4df20 --- /dev/null +++ b/codenet/public_test_cases/p01473/input.0.txt @@ -0,0 +1 @@ +ab diff --git a/codenet/public_test_cases/p01473/input.1.txt b/codenet/public_test_cases/p01473/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81bf396956110ad81c14860af1bbcc9dfbe4df20 --- /dev/null +++ b/codenet/public_test_cases/p01473/input.1.txt @@ -0,0 +1 @@ +ab diff --git a/codenet/public_test_cases/p01473/input.2.txt b/codenet/public_test_cases/p01473/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3656652b938f9c8893ac99318173682282fff1bc --- /dev/null +++ b/codenet/public_test_cases/p01473/input.2.txt @@ -0,0 +1 @@ +abba diff --git a/codenet/public_test_cases/p01473/output.0.txt b/codenet/public_test_cases/p01473/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01473/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01473/output.1.txt b/codenet/public_test_cases/p01473/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01473/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01473/output.2.txt b/codenet/public_test_cases/p01473/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01473/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01474/input.0.txt b/codenet/public_test_cases/p01474/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b25f17f033c7fd49540a1806978cb87f114ffe64 --- /dev/null +++ b/codenet/public_test_cases/p01474/input.0.txt @@ -0,0 +1,2 @@ +3 1 1 1 +1 3 diff --git a/codenet/public_test_cases/p01474/input.1.txt b/codenet/public_test_cases/p01474/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b25f17f033c7fd49540a1806978cb87f114ffe64 --- /dev/null +++ b/codenet/public_test_cases/p01474/input.1.txt @@ -0,0 +1,2 @@ +3 1 1 1 +1 3 diff --git a/codenet/public_test_cases/p01474/input.2.txt b/codenet/public_test_cases/p01474/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e78f8675d4ec47ab2e0a42d1c9a3361620e8ca40 --- /dev/null +++ b/codenet/public_test_cases/p01474/input.2.txt @@ -0,0 +1,3 @@ +4 2 1 1 +2 3 +3 2 diff --git a/codenet/public_test_cases/p01474/output.0.txt b/codenet/public_test_cases/p01474/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01474/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01474/output.1.txt b/codenet/public_test_cases/p01474/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01474/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01474/output.2.txt b/codenet/public_test_cases/p01474/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01474/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01475/input.0.txt b/codenet/public_test_cases/p01475/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cf20a77d2506169f8f622ea167a58e67899f278 --- /dev/null +++ b/codenet/public_test_cases/p01475/input.0.txt @@ -0,0 +1,3 @@ +1 +1 0 1 0 0 -1 +1 -1 0 diff --git a/codenet/public_test_cases/p01475/input.1.txt b/codenet/public_test_cases/p01475/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..449226baa1fe9716406e402a10461ff4aaf337b4 --- /dev/null +++ b/codenet/public_test_cases/p01475/input.1.txt @@ -0,0 +1,4 @@ +2 +1 0 -1 0 0 -1 +3 0 6 +-5 0 -10 diff --git a/codenet/public_test_cases/p01475/input.2.txt b/codenet/public_test_cases/p01475/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8818b3464076600847c74ce32ee0a37c8bf0bca --- /dev/null +++ b/codenet/public_test_cases/p01475/input.2.txt @@ -0,0 +1,4 @@ +2 +1 0 0 0 -1 0 +2 -1 -1 +6 9 1 diff --git a/codenet/public_test_cases/p01475/input.3.txt b/codenet/public_test_cases/p01475/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cf20a77d2506169f8f622ea167a58e67899f278 --- /dev/null +++ b/codenet/public_test_cases/p01475/input.3.txt @@ -0,0 +1,3 @@ +1 +1 0 1 0 0 -1 +1 -1 0 diff --git a/codenet/public_test_cases/p01475/output.0.txt b/codenet/public_test_cases/p01475/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01475/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01475/output.1.txt b/codenet/public_test_cases/p01475/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01475/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01475/output.2.txt b/codenet/public_test_cases/p01475/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01475/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01475/output.3.txt b/codenet/public_test_cases/p01475/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01475/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01476/input.0.txt b/codenet/public_test_cases/p01476/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ab20a34cd6d5f19348d237b0a69fc68586cbefe --- /dev/null +++ b/codenet/public_test_cases/p01476/input.0.txt @@ -0,0 +1,6 @@ +5 +0 1 2 8 +0 2 3 9 +0 2 2 11 +1 2 2 7 +0 1 3 7 diff --git a/codenet/public_test_cases/p01476/input.1.txt b/codenet/public_test_cases/p01476/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eac60f5aba3ba50fcfa5dd40c29c1d61da6b8afb --- /dev/null +++ b/codenet/public_test_cases/p01476/input.1.txt @@ -0,0 +1,3 @@ +2 +1 10 100 333 +0 100 1000 555 diff --git a/codenet/public_test_cases/p01476/input.2.txt b/codenet/public_test_cases/p01476/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ab20a34cd6d5f19348d237b0a69fc68586cbefe --- /dev/null +++ b/codenet/public_test_cases/p01476/input.2.txt @@ -0,0 +1,6 @@ +5 +0 1 2 8 +0 2 3 9 +0 2 2 11 +1 2 2 7 +0 1 3 7 diff --git a/codenet/public_test_cases/p01476/output.0.txt b/codenet/public_test_cases/p01476/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01476/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01476/output.1.txt b/codenet/public_test_cases/p01476/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p01476/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p01476/output.2.txt b/codenet/public_test_cases/p01476/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01476/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01477/input.0.txt b/codenet/public_test_cases/p01477/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8a739b1fe5efb69b73dc3c06ab81f18a8fab34a --- /dev/null +++ b/codenet/public_test_cases/p01477/input.0.txt @@ -0,0 +1,2 @@ +2 1 +1 -2 diff --git a/codenet/public_test_cases/p01477/input.1.txt b/codenet/public_test_cases/p01477/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76db56d391a04f69c2bc020f8da93543a07fdd68 --- /dev/null +++ b/codenet/public_test_cases/p01477/input.1.txt @@ -0,0 +1,3 @@ +3 2 +-1 -2 +1 -3 diff --git a/codenet/public_test_cases/p01477/input.2.txt b/codenet/public_test_cases/p01477/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8a739b1fe5efb69b73dc3c06ab81f18a8fab34a --- /dev/null +++ b/codenet/public_test_cases/p01477/input.2.txt @@ -0,0 +1,2 @@ +2 1 +1 -2 diff --git a/codenet/public_test_cases/p01477/output.0.txt b/codenet/public_test_cases/p01477/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01477/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01477/output.1.txt b/codenet/public_test_cases/p01477/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01477/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01477/output.2.txt b/codenet/public_test_cases/p01477/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01477/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01478/input.0.txt b/codenet/public_test_cases/p01478/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0ff138eb8a992ddb18766f36b085841f2a6141e --- /dev/null +++ b/codenet/public_test_cases/p01478/input.0.txt @@ -0,0 +1,4 @@ +3 +0 1 3 +1 0 8 +3 8 0 diff --git a/codenet/public_test_cases/p01478/input.1.txt b/codenet/public_test_cases/p01478/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0ff138eb8a992ddb18766f36b085841f2a6141e --- /dev/null +++ b/codenet/public_test_cases/p01478/input.1.txt @@ -0,0 +1,4 @@ +3 +0 1 3 +1 0 8 +3 8 0 diff --git a/codenet/public_test_cases/p01478/output.0.txt b/codenet/public_test_cases/p01478/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01478/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01478/output.1.txt b/codenet/public_test_cases/p01478/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01478/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01479/input.0.txt b/codenet/public_test_cases/p01479/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..67b8760eab8043ebc0d8e8bd5f183794ed067f46 --- /dev/null +++ b/codenet/public_test_cases/p01479/input.0.txt @@ -0,0 +1 @@ +eggchickenegg diff --git a/codenet/public_test_cases/p01479/input.1.txt b/codenet/public_test_cases/p01479/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67b8760eab8043ebc0d8e8bd5f183794ed067f46 --- /dev/null +++ b/codenet/public_test_cases/p01479/input.1.txt @@ -0,0 +1 @@ +eggchickenegg diff --git a/codenet/public_test_cases/p01479/output.0.txt b/codenet/public_test_cases/p01479/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d464a4941c87d8bfd46c2caa039e6d5247e3b18 --- /dev/null +++ b/codenet/public_test_cases/p01479/output.0.txt @@ -0,0 +1 @@ +egg diff --git a/codenet/public_test_cases/p01479/output.1.txt b/codenet/public_test_cases/p01479/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d464a4941c87d8bfd46c2caa039e6d5247e3b18 --- /dev/null +++ b/codenet/public_test_cases/p01479/output.1.txt @@ -0,0 +1 @@ +egg diff --git a/codenet/public_test_cases/p01480/input.0.txt b/codenet/public_test_cases/p01480/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8bd72d474525f3bf94978b68bf09a449e44239b --- /dev/null +++ b/codenet/public_test_cases/p01480/input.0.txt @@ -0,0 +1,10 @@ +2 +4 2 +4 0.4000000 +3 0.5000000 +4 1 +5 0.3333333 +5 3 +5 0.7777777 +4 0.1111111 +2 0.0001111 diff --git a/codenet/public_test_cases/p01480/input.1.txt b/codenet/public_test_cases/p01480/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8bd72d474525f3bf94978b68bf09a449e44239b --- /dev/null +++ b/codenet/public_test_cases/p01480/input.1.txt @@ -0,0 +1,10 @@ +2 +4 2 +4 0.4000000 +3 0.5000000 +4 1 +5 0.3333333 +5 3 +5 0.7777777 +4 0.1111111 +2 0.0001111 diff --git a/codenet/public_test_cases/p01480/output.0.txt b/codenet/public_test_cases/p01480/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01480/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01480/output.1.txt b/codenet/public_test_cases/p01480/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01480/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01481/input.0.txt b/codenet/public_test_cases/p01481/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b4755778e3651de95ec48f9f1cce50e38f4f4b5 --- /dev/null +++ b/codenet/public_test_cases/p01481/input.0.txt @@ -0,0 +1,15 @@ +10 10 +.....#.... +.....#.... +.....#.... +######.... +.......... +####...... +....###... +t..#..#### +...##..... +....#...## +3 +0 3 +0 5 +4 6 diff --git a/codenet/public_test_cases/p01481/input.1.txt b/codenet/public_test_cases/p01481/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b4755778e3651de95ec48f9f1cce50e38f4f4b5 --- /dev/null +++ b/codenet/public_test_cases/p01481/input.1.txt @@ -0,0 +1,15 @@ +10 10 +.....#.... +.....#.... +.....#.... +######.... +.......... +####...... +....###... +t..#..#### +...##..... +....#...## +3 +0 3 +0 5 +4 6 diff --git a/codenet/public_test_cases/p01481/output.0.txt b/codenet/public_test_cases/p01481/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01481/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01481/output.1.txt b/codenet/public_test_cases/p01481/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01481/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01482/input.0.txt b/codenet/public_test_cases/p01482/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8543dcc23f7422dba00b2dcf2ca633bc914e185d --- /dev/null +++ b/codenet/public_test_cases/p01482/input.0.txt @@ -0,0 +1,4 @@ +100 +A=malloc(10) +B=clone(A) +free(A) diff --git a/codenet/public_test_cases/p01482/input.1.txt b/codenet/public_test_cases/p01482/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8543dcc23f7422dba00b2dcf2ca633bc914e185d --- /dev/null +++ b/codenet/public_test_cases/p01482/input.1.txt @@ -0,0 +1,4 @@ +100 +A=malloc(10) +B=clone(A) +free(A) diff --git a/codenet/public_test_cases/p01482/output.0.txt b/codenet/public_test_cases/p01482/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01482/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01482/output.1.txt b/codenet/public_test_cases/p01482/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01482/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01483/input.0.txt b/codenet/public_test_cases/p01483/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..04c67f0fa92f27004a5af2b953f34822bb27ffd6 --- /dev/null +++ b/codenet/public_test_cases/p01483/input.0.txt @@ -0,0 +1,4 @@ +3 3 2 +1 1 +2 1 1 +3 1 1 1 diff --git a/codenet/public_test_cases/p01483/input.1.txt b/codenet/public_test_cases/p01483/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..04c67f0fa92f27004a5af2b953f34822bb27ffd6 --- /dev/null +++ b/codenet/public_test_cases/p01483/input.1.txt @@ -0,0 +1,4 @@ +3 3 2 +1 1 +2 1 1 +3 1 1 1 diff --git a/codenet/public_test_cases/p01483/output.0.txt b/codenet/public_test_cases/p01483/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01483/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01483/output.1.txt b/codenet/public_test_cases/p01483/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01483/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01484/input.0.txt b/codenet/public_test_cases/p01484/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..519b415e0ab0d0915b0d81edf16d8a9d6dcd0bd4 --- /dev/null +++ b/codenet/public_test_cases/p01484/input.0.txt @@ -0,0 +1,4 @@ +5 3 2 +aaaaa +aaa +aab diff --git a/codenet/public_test_cases/p01484/input.1.txt b/codenet/public_test_cases/p01484/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..519b415e0ab0d0915b0d81edf16d8a9d6dcd0bd4 --- /dev/null +++ b/codenet/public_test_cases/p01484/input.1.txt @@ -0,0 +1,4 @@ +5 3 2 +aaaaa +aaa +aab diff --git a/codenet/public_test_cases/p01484/output.0.txt b/codenet/public_test_cases/p01484/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32ac9cc4e429950e6787fbe4aa5c9a1e40874ec0 --- /dev/null +++ b/codenet/public_test_cases/p01484/output.0.txt @@ -0,0 +1 @@ +1 6 diff --git a/codenet/public_test_cases/p01484/output.1.txt b/codenet/public_test_cases/p01484/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32ac9cc4e429950e6787fbe4aa5c9a1e40874ec0 --- /dev/null +++ b/codenet/public_test_cases/p01484/output.1.txt @@ -0,0 +1 @@ +1 6 diff --git a/codenet/public_test_cases/p01485/input.0.txt b/codenet/public_test_cases/p01485/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b77f9bdf68957d07c7ec01e22600286bb4470ef5 --- /dev/null +++ b/codenet/public_test_cases/p01485/input.0.txt @@ -0,0 +1,6 @@ +2 +0 0 5 0 10 +1 0 6 0 10 +1 +0.000000 0.000000 +6.000000 0.000000 diff --git a/codenet/public_test_cases/p01485/input.1.txt b/codenet/public_test_cases/p01485/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b77f9bdf68957d07c7ec01e22600286bb4470ef5 --- /dev/null +++ b/codenet/public_test_cases/p01485/input.1.txt @@ -0,0 +1,6 @@ +2 +0 0 5 0 10 +1 0 6 0 10 +1 +0.000000 0.000000 +6.000000 0.000000 diff --git a/codenet/public_test_cases/p01485/output.0.txt b/codenet/public_test_cases/p01485/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01485/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01485/output.1.txt b/codenet/public_test_cases/p01485/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01485/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01486/input.0.txt b/codenet/public_test_cases/p01486/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5a36825698d29204a9da5454bc3e4391adeecb6 --- /dev/null +++ b/codenet/public_test_cases/p01486/input.0.txt @@ -0,0 +1 @@ +mmemewwemeww diff --git a/codenet/public_test_cases/p01486/input.1.txt b/codenet/public_test_cases/p01486/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5a36825698d29204a9da5454bc3e4391adeecb6 --- /dev/null +++ b/codenet/public_test_cases/p01486/input.1.txt @@ -0,0 +1 @@ +mmemewwemeww diff --git a/codenet/public_test_cases/p01486/output.0.txt b/codenet/public_test_cases/p01486/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b651cbbd95463c39ef3ef1958c6ee01974db1938 --- /dev/null +++ b/codenet/public_test_cases/p01486/output.0.txt @@ -0,0 +1 @@ +Cat diff --git a/codenet/public_test_cases/p01486/output.1.txt b/codenet/public_test_cases/p01486/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b651cbbd95463c39ef3ef1958c6ee01974db1938 --- /dev/null +++ b/codenet/public_test_cases/p01486/output.1.txt @@ -0,0 +1 @@ +Cat diff --git a/codenet/public_test_cases/p01487/input.0.txt b/codenet/public_test_cases/p01487/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..acab9620f7fb7cc6062b5916060f362036eb1fee --- /dev/null +++ b/codenet/public_test_cases/p01487/input.0.txt @@ -0,0 +1,6 @@ +8 5 +1 2 +6 5 +6 4 +1 3 +4 7 diff --git a/codenet/public_test_cases/p01487/input.1.txt b/codenet/public_test_cases/p01487/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..acab9620f7fb7cc6062b5916060f362036eb1fee --- /dev/null +++ b/codenet/public_test_cases/p01487/input.1.txt @@ -0,0 +1,6 @@ +8 5 +1 2 +6 5 +6 4 +1 3 +4 7 diff --git a/codenet/public_test_cases/p01487/output.0.txt b/codenet/public_test_cases/p01487/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01487/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01487/output.1.txt b/codenet/public_test_cases/p01487/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01487/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01488/input.0.txt b/codenet/public_test_cases/p01488/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c34b83525083a7ad524de2654469de65077f285 --- /dev/null +++ b/codenet/public_test_cases/p01488/input.0.txt @@ -0,0 +1,8 @@ +2 10 +Warsaw Petersburg +3 +Kiev Moscow Petersburg +150 120 +3 +Moscow Minsk Warsaw +100 150 diff --git a/codenet/public_test_cases/p01488/input.1.txt b/codenet/public_test_cases/p01488/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c34b83525083a7ad524de2654469de65077f285 --- /dev/null +++ b/codenet/public_test_cases/p01488/input.1.txt @@ -0,0 +1,8 @@ +2 10 +Warsaw Petersburg +3 +Kiev Moscow Petersburg +150 120 +3 +Moscow Minsk Warsaw +100 150 diff --git a/codenet/public_test_cases/p01488/output.0.txt b/codenet/public_test_cases/p01488/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a33a84892990993004852adfb4ebc8c09d04d9bb --- /dev/null +++ b/codenet/public_test_cases/p01488/output.0.txt @@ -0,0 +1 @@ +380 1 diff --git a/codenet/public_test_cases/p01488/output.1.txt b/codenet/public_test_cases/p01488/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a33a84892990993004852adfb4ebc8c09d04d9bb --- /dev/null +++ b/codenet/public_test_cases/p01488/output.1.txt @@ -0,0 +1 @@ +380 1 diff --git a/codenet/public_test_cases/p01489/input.0.txt b/codenet/public_test_cases/p01489/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01489/input.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01489/input.1.txt b/codenet/public_test_cases/p01489/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01489/input.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01489/output.0.txt b/codenet/public_test_cases/p01489/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01489/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01489/output.1.txt b/codenet/public_test_cases/p01489/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01489/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01490/input.0.txt b/codenet/public_test_cases/p01490/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..065bedafca86dee03244a6a3c9675269f55e7184 --- /dev/null +++ b/codenet/public_test_cases/p01490/input.0.txt @@ -0,0 +1,5 @@ +4 +5 +8 +58 +85 diff --git a/codenet/public_test_cases/p01490/input.1.txt b/codenet/public_test_cases/p01490/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..065bedafca86dee03244a6a3c9675269f55e7184 --- /dev/null +++ b/codenet/public_test_cases/p01490/input.1.txt @@ -0,0 +1,5 @@ +4 +5 +8 +58 +85 diff --git a/codenet/public_test_cases/p01490/output.0.txt b/codenet/public_test_cases/p01490/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b483cabaa1252aed42541b75043a54c5acf12f26 --- /dev/null +++ b/codenet/public_test_cases/p01490/output.0.txt @@ -0,0 +1 @@ +2970.000000000 diff --git a/codenet/public_test_cases/p01490/output.1.txt b/codenet/public_test_cases/p01490/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b483cabaa1252aed42541b75043a54c5acf12f26 --- /dev/null +++ b/codenet/public_test_cases/p01490/output.1.txt @@ -0,0 +1 @@ +2970.000000000 diff --git a/codenet/public_test_cases/p01491/input.0.txt b/codenet/public_test_cases/p01491/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..038b10d57ab06b4684d4d4fddac4096e5341b694 --- /dev/null +++ b/codenet/public_test_cases/p01491/input.0.txt @@ -0,0 +1 @@ +2 3 1 3 1 0 diff --git a/codenet/public_test_cases/p01491/input.1.txt b/codenet/public_test_cases/p01491/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..038b10d57ab06b4684d4d4fddac4096e5341b694 --- /dev/null +++ b/codenet/public_test_cases/p01491/input.1.txt @@ -0,0 +1 @@ +2 3 1 3 1 0 diff --git a/codenet/public_test_cases/p01491/output.0.txt b/codenet/public_test_cases/p01491/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01491/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01491/output.1.txt b/codenet/public_test_cases/p01491/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01491/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01492/input.0.txt b/codenet/public_test_cases/p01492/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01492/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01492/input.1.txt b/codenet/public_test_cases/p01492/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01492/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01492/output.0.txt b/codenet/public_test_cases/p01492/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb194a309884f6002ed6bc2b3dde6b7597e7ee4b --- /dev/null +++ b/codenet/public_test_cases/p01492/output.0.txt @@ -0,0 +1,5 @@ +4 +0 0 +1 0 +2 0 +1 1 diff --git a/codenet/public_test_cases/p01492/output.1.txt b/codenet/public_test_cases/p01492/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb194a309884f6002ed6bc2b3dde6b7597e7ee4b --- /dev/null +++ b/codenet/public_test_cases/p01492/output.1.txt @@ -0,0 +1,5 @@ +4 +0 0 +1 0 +2 0 +1 1 diff --git a/codenet/public_test_cases/p01493/input.0.txt b/codenet/public_test_cases/p01493/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e98e1d626ccca555473db176684af11832aee44 --- /dev/null +++ b/codenet/public_test_cases/p01493/input.0.txt @@ -0,0 +1,4 @@ +3 +NNN +NNN +NNN diff --git a/codenet/public_test_cases/p01493/input.1.txt b/codenet/public_test_cases/p01493/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e98e1d626ccca555473db176684af11832aee44 --- /dev/null +++ b/codenet/public_test_cases/p01493/input.1.txt @@ -0,0 +1,4 @@ +3 +NNN +NNN +NNN diff --git a/codenet/public_test_cases/p01493/output.0.txt b/codenet/public_test_cases/p01493/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09944d98ec0b61a33b7c995d56052895ea55d2a2 --- /dev/null +++ b/codenet/public_test_cases/p01493/output.0.txt @@ -0,0 +1 @@ +Taro diff --git a/codenet/public_test_cases/p01493/output.1.txt b/codenet/public_test_cases/p01493/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09944d98ec0b61a33b7c995d56052895ea55d2a2 --- /dev/null +++ b/codenet/public_test_cases/p01493/output.1.txt @@ -0,0 +1 @@ +Taro diff --git a/codenet/public_test_cases/p01494/input.0.txt b/codenet/public_test_cases/p01494/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0d0cdbd2101e3d07f1ea334194a44fe1e17c5ad --- /dev/null +++ b/codenet/public_test_cases/p01494/input.0.txt @@ -0,0 +1,2 @@ +3 3 1 +0 0 diff --git a/codenet/public_test_cases/p01494/input.1.txt b/codenet/public_test_cases/p01494/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0d0cdbd2101e3d07f1ea334194a44fe1e17c5ad --- /dev/null +++ b/codenet/public_test_cases/p01494/input.1.txt @@ -0,0 +1,2 @@ +3 3 1 +0 0 diff --git a/codenet/public_test_cases/p01494/output.0.txt b/codenet/public_test_cases/p01494/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01494/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01494/output.1.txt b/codenet/public_test_cases/p01494/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01494/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01495/input.0.txt b/codenet/public_test_cases/p01495/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ec6acd8fc112be1f012c8aa382ca84fba04a0b9 --- /dev/null +++ b/codenet/public_test_cases/p01495/input.0.txt @@ -0,0 +1 @@ +3 1 0 1 diff --git a/codenet/public_test_cases/p01495/input.1.txt b/codenet/public_test_cases/p01495/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ec6acd8fc112be1f012c8aa382ca84fba04a0b9 --- /dev/null +++ b/codenet/public_test_cases/p01495/input.1.txt @@ -0,0 +1 @@ +3 1 0 1 diff --git a/codenet/public_test_cases/p01495/output.0.txt b/codenet/public_test_cases/p01495/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p01495/output.0.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p01495/output.1.txt b/codenet/public_test_cases/p01495/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p01495/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p01496/input.0.txt b/codenet/public_test_cases/p01496/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5ca58da03939b75c047f58754d90dbca0071580 --- /dev/null +++ b/codenet/public_test_cases/p01496/input.0.txt @@ -0,0 +1,4 @@ +3 40 +.a....a....a....a....f....f....f....f... +#bc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#. +.#....#....#....#....#....#....#....#... diff --git a/codenet/public_test_cases/p01496/input.1.txt b/codenet/public_test_cases/p01496/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e542d19d33d2375c72815a94f8f054f3e052558b --- /dev/null +++ b/codenet/public_test_cases/p01496/input.1.txt @@ -0,0 +1,4 @@ +3 40 +.a....a....a....a....f....f....f....f... +bc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#eb#. +.#....#....#....#....#....#....#....#... diff --git a/codenet/public_test_cases/p01496/input.2.txt b/codenet/public_test_cases/p01496/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..89a14be3c7ef578552bb8de94d9fc645ecc5e782 --- /dev/null +++ b/codenet/public_test_cases/p01496/input.2.txt @@ -0,0 +1,4 @@ +3 40 +.a....a....a....a....f....f....f....f... +bc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#. +.#....#....#....#....#....#....#....#... diff --git a/codenet/public_test_cases/p01496/input.3.txt b/codenet/public_test_cases/p01496/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5ca58da03939b75c047f58754d90dbca0071580 --- /dev/null +++ b/codenet/public_test_cases/p01496/input.3.txt @@ -0,0 +1,4 @@ +3 40 +.a....a....a....a....f....f....f....f... +#bc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.#be#. +.#....#....#....#....#....#....#....#... diff --git a/codenet/public_test_cases/p01496/input.4.txt b/codenet/public_test_cases/p01496/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ceaf733e47a2606ca94323e49cf0710786bd896 --- /dev/null +++ b/codenet/public_test_cases/p01496/input.4.txt @@ -0,0 +1,6 @@ +5 35 +.a....a....a....a....f....f....f... +bc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#. +.#..f.#....#....#....#....#....#... +..e##.............................. +.b#................................ diff --git a/codenet/public_test_cases/p01496/output.0.txt b/codenet/public_test_cases/p01496/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01496/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01496/output.1.txt b/codenet/public_test_cases/p01496/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01496/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01496/output.2.txt b/codenet/public_test_cases/p01496/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01496/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01496/output.3.txt b/codenet/public_test_cases/p01496/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01496/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01496/output.4.txt b/codenet/public_test_cases/p01496/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01496/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01497/input.0.txt b/codenet/public_test_cases/p01497/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba81a47ca4f97e63ab9d7e18df514bbececb3933 --- /dev/null +++ b/codenet/public_test_cases/p01497/input.0.txt @@ -0,0 +1,4 @@ +4 4 4 4 +4 4 4 4 +4 4 4 4 +4 4 4 4 diff --git a/codenet/public_test_cases/p01497/input.1.txt b/codenet/public_test_cases/p01497/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cb1cef85e73793dc94f6ea67e7b7bb435f727c8 --- /dev/null +++ b/codenet/public_test_cases/p01497/input.1.txt @@ -0,0 +1,4 @@ +2 4 4 1 +2 4 4 1 +2 4 4 1 +2 4 4 1 diff --git a/codenet/public_test_cases/p01497/input.2.txt b/codenet/public_test_cases/p01497/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba81a47ca4f97e63ab9d7e18df514bbececb3933 --- /dev/null +++ b/codenet/public_test_cases/p01497/input.2.txt @@ -0,0 +1,4 @@ +4 4 4 4 +4 4 4 4 +4 4 4 4 +4 4 4 4 diff --git a/codenet/public_test_cases/p01497/input.3.txt b/codenet/public_test_cases/p01497/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9f9ee373a664d47f31adabfec9252d387d74526 --- /dev/null +++ b/codenet/public_test_cases/p01497/input.3.txt @@ -0,0 +1,4 @@ +2 4 3 4 +2 2 4 4 +3 3 2 2 +2 3 3 3 diff --git a/codenet/public_test_cases/p01497/output.0.txt b/codenet/public_test_cases/p01497/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01497/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01497/output.1.txt b/codenet/public_test_cases/p01497/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01497/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01497/output.2.txt b/codenet/public_test_cases/p01497/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01497/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01497/output.3.txt b/codenet/public_test_cases/p01497/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01497/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01498/input.0.txt b/codenet/public_test_cases/p01498/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f514fcce7d61b9c77d851ee9efe2b67c70ced32 --- /dev/null +++ b/codenet/public_test_cases/p01498/input.0.txt @@ -0,0 +1,5 @@ +4 3 3 +1 1 +1 3 +3 1 +3 3 diff --git a/codenet/public_test_cases/p01498/input.1.txt b/codenet/public_test_cases/p01498/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7ad3d1e5ecc38e41d3a35f9693a1abbc634e626 --- /dev/null +++ b/codenet/public_test_cases/p01498/input.1.txt @@ -0,0 +1,3 @@ +2 3 3 +2 2 +3 3 diff --git a/codenet/public_test_cases/p01498/input.2.txt b/codenet/public_test_cases/p01498/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f514fcce7d61b9c77d851ee9efe2b67c70ced32 --- /dev/null +++ b/codenet/public_test_cases/p01498/input.2.txt @@ -0,0 +1,5 @@ +4 3 3 +1 1 +1 3 +3 1 +3 3 diff --git a/codenet/public_test_cases/p01498/input.3.txt b/codenet/public_test_cases/p01498/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b5956286e4aaaaaeac523c5257e6da86d4c46c9 --- /dev/null +++ b/codenet/public_test_cases/p01498/input.3.txt @@ -0,0 +1,3 @@ +2 4 4 +2 2 +3 3 diff --git a/codenet/public_test_cases/p01498/input.4.txt b/codenet/public_test_cases/p01498/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a91dcab57baffc91b80d5298105791d31b1bc3a1 --- /dev/null +++ b/codenet/public_test_cases/p01498/input.4.txt @@ -0,0 +1,3 @@ +2 4 4 +2 2 +2 3 diff --git a/codenet/public_test_cases/p01498/output.0.txt b/codenet/public_test_cases/p01498/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01498/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01498/output.1.txt b/codenet/public_test_cases/p01498/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01498/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01498/output.2.txt b/codenet/public_test_cases/p01498/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01498/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01498/output.3.txt b/codenet/public_test_cases/p01498/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01498/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01498/output.4.txt b/codenet/public_test_cases/p01498/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01498/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01499/input.0.txt b/codenet/public_test_cases/p01499/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e404b76a3220609ea50d574f3d2a4455d079d263 --- /dev/null +++ b/codenet/public_test_cases/p01499/input.0.txt @@ -0,0 +1,4 @@ +3 1 +1 +2 +3 diff --git a/codenet/public_test_cases/p01499/input.1.txt b/codenet/public_test_cases/p01499/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e404b76a3220609ea50d574f3d2a4455d079d263 --- /dev/null +++ b/codenet/public_test_cases/p01499/input.1.txt @@ -0,0 +1,4 @@ +3 1 +1 +2 +3 diff --git a/codenet/public_test_cases/p01499/input.2.txt b/codenet/public_test_cases/p01499/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..df69403341bfaecd62999afb379e31e099beb455 --- /dev/null +++ b/codenet/public_test_cases/p01499/input.2.txt @@ -0,0 +1,6 @@ +5 3 +9 +2 +6 +8 +8 diff --git a/codenet/public_test_cases/p01499/input.3.txt b/codenet/public_test_cases/p01499/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bd3cbbf2c84a7c676ea9e2564a7be21f18c7e75 --- /dev/null +++ b/codenet/public_test_cases/p01499/input.3.txt @@ -0,0 +1,6 @@ +5 7 +9 +9 +9 +1 +5 diff --git a/codenet/public_test_cases/p01499/output.0.txt b/codenet/public_test_cases/p01499/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01499/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01499/output.1.txt b/codenet/public_test_cases/p01499/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01499/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01499/output.2.txt b/codenet/public_test_cases/p01499/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p01499/output.2.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p01499/output.3.txt b/codenet/public_test_cases/p01499/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..21e72e8ac3d7e23bd6532b5f1f4a6bdf8362e6cf --- /dev/null +++ b/codenet/public_test_cases/p01499/output.3.txt @@ -0,0 +1 @@ +48 diff --git a/codenet/public_test_cases/p01500/input.0.txt b/codenet/public_test_cases/p01500/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf55745ab03b5a740c1152f075f3e094931f1095 --- /dev/null +++ b/codenet/public_test_cases/p01500/input.0.txt @@ -0,0 +1,9 @@ +6 3 1.0 +1 2 3 +4 5 6 +0 0 +1 0 +2 0 +0 1 +1 1 +2 1 diff --git a/codenet/public_test_cases/p01500/input.1.txt b/codenet/public_test_cases/p01500/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf55745ab03b5a740c1152f075f3e094931f1095 --- /dev/null +++ b/codenet/public_test_cases/p01500/input.1.txt @@ -0,0 +1,9 @@ +6 3 1.0 +1 2 3 +4 5 6 +0 0 +1 0 +2 0 +0 1 +1 1 +2 1 diff --git a/codenet/public_test_cases/p01500/output.0.txt b/codenet/public_test_cases/p01500/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01500/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01500/output.1.txt b/codenet/public_test_cases/p01500/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01500/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01501/input.0.txt b/codenet/public_test_cases/p01501/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88be9ac94f5aded6390ffd0a78f239064de547ac --- /dev/null +++ b/codenet/public_test_cases/p01501/input.0.txt @@ -0,0 +1,6 @@ +4 1 +0 0 +3 0 +3 3 +0 3 +1 1 diff --git a/codenet/public_test_cases/p01501/input.1.txt b/codenet/public_test_cases/p01501/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..88be9ac94f5aded6390ffd0a78f239064de547ac --- /dev/null +++ b/codenet/public_test_cases/p01501/input.1.txt @@ -0,0 +1,6 @@ +4 1 +0 0 +3 0 +3 3 +0 3 +1 1 diff --git a/codenet/public_test_cases/p01501/output.0.txt b/codenet/public_test_cases/p01501/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b79fe6d0e019db65d91d38d05cb8616be73a00a --- /dev/null +++ b/codenet/public_test_cases/p01501/output.0.txt @@ -0,0 +1 @@ +2.0000000000 diff --git a/codenet/public_test_cases/p01501/output.1.txt b/codenet/public_test_cases/p01501/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b79fe6d0e019db65d91d38d05cb8616be73a00a --- /dev/null +++ b/codenet/public_test_cases/p01501/output.1.txt @@ -0,0 +1 @@ +2.0000000000 diff --git a/codenet/public_test_cases/p01502/input.0.txt b/codenet/public_test_cases/p01502/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ec16339886bd6d000ff75931b04e2ad2209172c --- /dev/null +++ b/codenet/public_test_cases/p01502/input.0.txt @@ -0,0 +1,4 @@ +3 +0 2 7 +2 0 4 +5 8 0 diff --git a/codenet/public_test_cases/p01502/input.1.txt b/codenet/public_test_cases/p01502/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ec16339886bd6d000ff75931b04e2ad2209172c --- /dev/null +++ b/codenet/public_test_cases/p01502/input.1.txt @@ -0,0 +1,4 @@ +3 +0 2 7 +2 0 4 +5 8 0 diff --git a/codenet/public_test_cases/p01502/output.0.txt b/codenet/public_test_cases/p01502/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01502/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01502/output.1.txt b/codenet/public_test_cases/p01502/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01502/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01503/input.0.txt b/codenet/public_test_cases/p01503/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac7d099c15d38a622aa5789cebffc3ce3d37ea96 --- /dev/null +++ b/codenet/public_test_cases/p01503/input.0.txt @@ -0,0 +1 @@ +1 1 1 1 1 diff --git a/codenet/public_test_cases/p01503/input.1.txt b/codenet/public_test_cases/p01503/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac7d099c15d38a622aa5789cebffc3ce3d37ea96 --- /dev/null +++ b/codenet/public_test_cases/p01503/input.1.txt @@ -0,0 +1 @@ +1 1 1 1 1 diff --git a/codenet/public_test_cases/p01503/output.0.txt b/codenet/public_test_cases/p01503/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae15b90673dd72da308bf241b7567543c4b07ea9 --- /dev/null +++ b/codenet/public_test_cases/p01503/output.0.txt @@ -0,0 +1 @@ +0.000000000000 diff --git a/codenet/public_test_cases/p01503/output.1.txt b/codenet/public_test_cases/p01503/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae15b90673dd72da308bf241b7567543c4b07ea9 --- /dev/null +++ b/codenet/public_test_cases/p01503/output.1.txt @@ -0,0 +1 @@ +0.000000000000 diff --git a/codenet/public_test_cases/p01504/input.0.txt b/codenet/public_test_cases/p01504/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9dd73863e9160af62d1288b90e118eb8503a6ea7 --- /dev/null +++ b/codenet/public_test_cases/p01504/input.0.txt @@ -0,0 +1,12 @@ +2 2 1 +1 2 1 +1 +2 +4 3 2 +1 2 1 +1 3 2 +1 4 3 +2 +3 +4 +0 0 0 diff --git a/codenet/public_test_cases/p01504/input.1.txt b/codenet/public_test_cases/p01504/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9dd73863e9160af62d1288b90e118eb8503a6ea7 --- /dev/null +++ b/codenet/public_test_cases/p01504/input.1.txt @@ -0,0 +1,12 @@ +2 2 1 +1 2 1 +1 +2 +4 3 2 +1 2 1 +1 3 2 +1 4 3 +2 +3 +4 +0 0 0 diff --git a/codenet/public_test_cases/p01504/output.0.txt b/codenet/public_test_cases/p01504/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ba033b1fdce7c74553ab143861906f4d670e0be --- /dev/null +++ b/codenet/public_test_cases/p01504/output.0.txt @@ -0,0 +1,2 @@ +Case 1: 1 +Case 2: 3 diff --git a/codenet/public_test_cases/p01504/output.1.txt b/codenet/public_test_cases/p01504/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ba033b1fdce7c74553ab143861906f4d670e0be --- /dev/null +++ b/codenet/public_test_cases/p01504/output.1.txt @@ -0,0 +1,2 @@ +Case 1: 1 +Case 2: 3 diff --git a/codenet/public_test_cases/p01505/input.0.txt b/codenet/public_test_cases/p01505/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ff0555a869700be07eb9255e3bd1e03c6e73fc0 --- /dev/null +++ b/codenet/public_test_cases/p01505/input.0.txt @@ -0,0 +1,9 @@ +2 +3 +2 1 +4 +9 +2 4 +8 5 3 +7 1 6 10 +0 diff --git a/codenet/public_test_cases/p01505/input.1.txt b/codenet/public_test_cases/p01505/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ff0555a869700be07eb9255e3bd1e03c6e73fc0 --- /dev/null +++ b/codenet/public_test_cases/p01505/input.1.txt @@ -0,0 +1,9 @@ +2 +3 +2 1 +4 +9 +2 4 +8 5 3 +7 1 6 10 +0 diff --git a/codenet/public_test_cases/p01505/output.0.txt b/codenet/public_test_cases/p01505/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f3d597dd3ec7e647f2e3a413d01bcc26f25d484 --- /dev/null +++ b/codenet/public_test_cases/p01505/output.0.txt @@ -0,0 +1,2 @@ +Case 1: 1 +Case 2: 13 diff --git a/codenet/public_test_cases/p01505/output.1.txt b/codenet/public_test_cases/p01505/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f3d597dd3ec7e647f2e3a413d01bcc26f25d484 --- /dev/null +++ b/codenet/public_test_cases/p01505/output.1.txt @@ -0,0 +1,2 @@ +Case 1: 1 +Case 2: 13 diff --git a/codenet/public_test_cases/p01506/input.0.txt b/codenet/public_test_cases/p01506/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..40133f206a05f9c53946de62eb0de42f7a091713 --- /dev/null +++ b/codenet/public_test_cases/p01506/input.0.txt @@ -0,0 +1,3 @@ +0 1000 10 +1 1000 10 +0 0 0 diff --git a/codenet/public_test_cases/p01506/input.1.txt b/codenet/public_test_cases/p01506/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..40133f206a05f9c53946de62eb0de42f7a091713 --- /dev/null +++ b/codenet/public_test_cases/p01506/input.1.txt @@ -0,0 +1,3 @@ +0 1000 10 +1 1000 10 +0 0 0 diff --git a/codenet/public_test_cases/p01506/output.0.txt b/codenet/public_test_cases/p01506/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ab1d37528dadfb81d09539ac4816432d4a5c304 --- /dev/null +++ b/codenet/public_test_cases/p01506/output.0.txt @@ -0,0 +1,2 @@ +Case 1: 1 +Case 2: 10 diff --git a/codenet/public_test_cases/p01506/output.1.txt b/codenet/public_test_cases/p01506/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ab1d37528dadfb81d09539ac4816432d4a5c304 --- /dev/null +++ b/codenet/public_test_cases/p01506/output.1.txt @@ -0,0 +1,2 @@ +Case 1: 1 +Case 2: 10 diff --git a/codenet/public_test_cases/p01507/input.0.txt b/codenet/public_test_cases/p01507/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b90bd3aaec4a20d6935630f9050e4f0e99868da8 --- /dev/null +++ b/codenet/public_test_cases/p01507/input.0.txt @@ -0,0 +1,8 @@ +2 2 +.. +.. +3 3 +... +... +..# +0 0 diff --git a/codenet/public_test_cases/p01507/input.1.txt b/codenet/public_test_cases/p01507/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b90bd3aaec4a20d6935630f9050e4f0e99868da8 --- /dev/null +++ b/codenet/public_test_cases/p01507/input.1.txt @@ -0,0 +1,8 @@ +2 2 +.. +.. +3 3 +... +... +..# +0 0 diff --git a/codenet/public_test_cases/p01507/output.0.txt b/codenet/public_test_cases/p01507/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5aae7c9b05672c6b2e0a9416ba548529fc1502e --- /dev/null +++ b/codenet/public_test_cases/p01507/output.0.txt @@ -0,0 +1,2 @@ +Case 1: 4 +Case 2: 56 diff --git a/codenet/public_test_cases/p01507/output.1.txt b/codenet/public_test_cases/p01507/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5aae7c9b05672c6b2e0a9416ba548529fc1502e --- /dev/null +++ b/codenet/public_test_cases/p01507/output.1.txt @@ -0,0 +1,2 @@ +Case 1: 4 +Case 2: 56 diff --git a/codenet/public_test_cases/p01508/input.0.txt b/codenet/public_test_cases/p01508/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a1a7d39e712cf28e8ad63e9cf3f1761a7a0f252 --- /dev/null +++ b/codenet/public_test_cases/p01508/input.0.txt @@ -0,0 +1,10 @@ +4 +0 0 +10 0 +10 10 +0 10 +3 +0 0 +1 0 +0 1 +0 diff --git a/codenet/public_test_cases/p01508/input.1.txt b/codenet/public_test_cases/p01508/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a1a7d39e712cf28e8ad63e9cf3f1761a7a0f252 --- /dev/null +++ b/codenet/public_test_cases/p01508/input.1.txt @@ -0,0 +1,10 @@ +4 +0 0 +10 0 +10 10 +0 10 +3 +0 0 +1 0 +0 1 +0 diff --git a/codenet/public_test_cases/p01508/output.0.txt b/codenet/public_test_cases/p01508/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c531b56b1449e51170baef833da02e936b68f276 --- /dev/null +++ b/codenet/public_test_cases/p01508/output.0.txt @@ -0,0 +1,2 @@ +Case 1: 14.142135624 +Case 2: 1.41421356 diff --git a/codenet/public_test_cases/p01508/output.1.txt b/codenet/public_test_cases/p01508/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c531b56b1449e51170baef833da02e936b68f276 --- /dev/null +++ b/codenet/public_test_cases/p01508/output.1.txt @@ -0,0 +1,2 @@ +Case 1: 14.142135624 +Case 2: 1.41421356 diff --git a/codenet/public_test_cases/p01509/input.0.txt b/codenet/public_test_cases/p01509/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..381cf1f599a761c8ccc14bee0cdcada3d2ed7a64 --- /dev/null +++ b/codenet/public_test_cases/p01509/input.0.txt @@ -0,0 +1,4 @@ +C4C4G4G4A4A4G2F4F4E4E4D4D4C2 +O4C4.C8F4.F8G8F8E8D8C2 +B-8>C8C8Markup language has Declined
Programmers world +1 +15 3 0 index diff --git a/codenet/public_test_cases/p01535/input.1.txt b/codenet/public_test_cases/p01535/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9ca273331992bba02dd06db1c862c11f9ddf5fb --- /dev/null +++ b/codenet/public_test_cases/p01535/input.1.txt @@ -0,0 +1,5 @@ +1 +index.dml +Markup language has Declined
Programmers world
+1 +15 3 0 index diff --git a/codenet/public_test_cases/p01535/output.0.txt b/codenet/public_test_cases/p01535/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e471e338cff73d11f82fb385f2c342afbc4a0f --- /dev/null +++ b/codenet/public_test_cases/p01535/output.0.txt @@ -0,0 +1,3 @@ +Markup language + has Declined.. +Programmers wor diff --git a/codenet/public_test_cases/p01535/output.1.txt b/codenet/public_test_cases/p01535/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e471e338cff73d11f82fb385f2c342afbc4a0f --- /dev/null +++ b/codenet/public_test_cases/p01535/output.1.txt @@ -0,0 +1,3 @@ +Markup language + has Declined.. +Programmers wor diff --git a/codenet/public_test_cases/p01536/input.0.txt b/codenet/public_test_cases/p01536/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..35150757276332fc7de8e40973295f1bdef5c8b2 --- /dev/null +++ b/codenet/public_test_cases/p01536/input.0.txt @@ -0,0 +1,2 @@ +4 +1 1 1 3 3 3 5 5 5 7 7 7 9 diff --git a/codenet/public_test_cases/p01536/input.1.txt b/codenet/public_test_cases/p01536/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..35150757276332fc7de8e40973295f1bdef5c8b2 --- /dev/null +++ b/codenet/public_test_cases/p01536/input.1.txt @@ -0,0 +1,2 @@ +4 +1 1 1 3 3 3 5 5 5 7 7 7 9 diff --git a/codenet/public_test_cases/p01536/output.0.txt b/codenet/public_test_cases/p01536/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..512858e6043259188cb34dca269dc909c1e59537 --- /dev/null +++ b/codenet/public_test_cases/p01536/output.0.txt @@ -0,0 +1,2 @@ +8 +9 diff --git a/codenet/public_test_cases/p01536/output.1.txt b/codenet/public_test_cases/p01536/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..512858e6043259188cb34dca269dc909c1e59537 --- /dev/null +++ b/codenet/public_test_cases/p01536/output.1.txt @@ -0,0 +1,2 @@ +8 +9 diff --git a/codenet/public_test_cases/p01537/input.0.txt b/codenet/public_test_cases/p01537/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..195120bbf7e4dac60684d5de988fce51c79e2ec5 --- /dev/null +++ b/codenet/public_test_cases/p01537/input.0.txt @@ -0,0 +1,20 @@ +3 3 +25 100 10 +8 +-10 0 +-2 2 +0 10 +2 2 +10 0 +2 -2 +0 -10 +-2 -2 +4 +30 0 +50 0 +50 40 +30 40 +3 +30 -10 +45 -70 +60 -10 diff --git a/codenet/public_test_cases/p01537/input.1.txt b/codenet/public_test_cases/p01537/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..195120bbf7e4dac60684d5de988fce51c79e2ec5 --- /dev/null +++ b/codenet/public_test_cases/p01537/input.1.txt @@ -0,0 +1,20 @@ +3 3 +25 100 10 +8 +-10 0 +-2 2 +0 10 +2 2 +10 0 +2 -2 +0 -10 +-2 -2 +4 +30 0 +50 0 +50 40 +30 40 +3 +30 -10 +45 -70 +60 -10 diff --git a/codenet/public_test_cases/p01537/output.0.txt b/codenet/public_test_cases/p01537/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0571a2e15a712887514f5eabbbe731a4b1b70672 --- /dev/null +++ b/codenet/public_test_cases/p01537/output.0.txt @@ -0,0 +1,3 @@ +3 +1 +2 diff --git a/codenet/public_test_cases/p01537/output.1.txt b/codenet/public_test_cases/p01537/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0571a2e15a712887514f5eabbbe731a4b1b70672 --- /dev/null +++ b/codenet/public_test_cases/p01537/output.1.txt @@ -0,0 +1,3 @@ +3 +1 +2 diff --git a/codenet/public_test_cases/p01538/input.0.txt b/codenet/public_test_cases/p01538/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14fd726975cc907fc30daa3ecce6dcc53b28bb0b --- /dev/null +++ b/codenet/public_test_cases/p01538/input.0.txt @@ -0,0 +1,4 @@ +3 +9 +99 +123 diff --git a/codenet/public_test_cases/p01538/input.1.txt b/codenet/public_test_cases/p01538/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ac2467bf68b5a57aeefa70178c9f62f607c13ed --- /dev/null +++ b/codenet/public_test_cases/p01538/input.1.txt @@ -0,0 +1,3 @@ +2 +999999 +1000000 diff --git a/codenet/public_test_cases/p01538/input.2.txt b/codenet/public_test_cases/p01538/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..14fd726975cc907fc30daa3ecce6dcc53b28bb0b --- /dev/null +++ b/codenet/public_test_cases/p01538/input.2.txt @@ -0,0 +1,4 @@ +3 +9 +99 +123 diff --git a/codenet/public_test_cases/p01538/output.0.txt b/codenet/public_test_cases/p01538/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1556c06ea8333942b224f233562f1ab167635aff --- /dev/null +++ b/codenet/public_test_cases/p01538/output.0.txt @@ -0,0 +1,3 @@ +0 +2 +3 diff --git a/codenet/public_test_cases/p01538/output.1.txt b/codenet/public_test_cases/p01538/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfe9b7e72d47952b069f1ddfad0ed10429dacbae --- /dev/null +++ b/codenet/public_test_cases/p01538/output.1.txt @@ -0,0 +1,2 @@ +12 +1 diff --git a/codenet/public_test_cases/p01538/output.2.txt b/codenet/public_test_cases/p01538/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1556c06ea8333942b224f233562f1ab167635aff --- /dev/null +++ b/codenet/public_test_cases/p01538/output.2.txt @@ -0,0 +1,3 @@ +0 +2 +3 diff --git a/codenet/public_test_cases/p01539/input.0.txt b/codenet/public_test_cases/p01539/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85019046c1e6277fd1a3e3819210f3e759583b02 --- /dev/null +++ b/codenet/public_test_cases/p01539/input.0.txt @@ -0,0 +1,3 @@ +0 0 0 2 +0 +2 2 diff --git a/codenet/public_test_cases/p01539/input.1.txt b/codenet/public_test_cases/p01539/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5927f0654c3643d6c70a42e356c481076579d76c --- /dev/null +++ b/codenet/public_test_cases/p01539/input.1.txt @@ -0,0 +1,4 @@ +0 0 0 2 +1 +0 1 +2 2 diff --git a/codenet/public_test_cases/p01539/input.2.txt b/codenet/public_test_cases/p01539/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..738e13be7230eefd4ff5ea28c6ea740c33a4e08e --- /dev/null +++ b/codenet/public_test_cases/p01539/input.2.txt @@ -0,0 +1,9 @@ +0 0 0 2 +6 +0 1 +1 0 +1 -1 +0 -1 +-1 -1 +-1 0 +2 2 diff --git a/codenet/public_test_cases/p01539/input.3.txt b/codenet/public_test_cases/p01539/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..85019046c1e6277fd1a3e3819210f3e759583b02 --- /dev/null +++ b/codenet/public_test_cases/p01539/input.3.txt @@ -0,0 +1,3 @@ +0 0 0 2 +0 +2 2 diff --git a/codenet/public_test_cases/p01539/output.0.txt b/codenet/public_test_cases/p01539/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01539/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01539/output.1.txt b/codenet/public_test_cases/p01539/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01539/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01539/output.2.txt b/codenet/public_test_cases/p01539/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01539/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01539/output.3.txt b/codenet/public_test_cases/p01539/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01539/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01540/input.0.txt b/codenet/public_test_cases/p01540/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..638ae73f634f2d4e802bfdb98654e0df7b004395 --- /dev/null +++ b/codenet/public_test_cases/p01540/input.0.txt @@ -0,0 +1,5 @@ +3 1 +1 1 +2 4 +5 3 +0 0 5 5 diff --git a/codenet/public_test_cases/p01540/input.1.txt b/codenet/public_test_cases/p01540/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c978a0ca209b2be9394b78e316f8eb5609f5d6 --- /dev/null +++ b/codenet/public_test_cases/p01540/input.1.txt @@ -0,0 +1,11 @@ +5 5 +10 5 +-3 -8 +2 11 +6 0 +-1 3 +-3 1 3 13 +-1 -1 9 5 +-3 -8 10 11 +0 0 5 5 +-10 -9 15 10 diff --git a/codenet/public_test_cases/p01540/input.2.txt b/codenet/public_test_cases/p01540/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..638ae73f634f2d4e802bfdb98654e0df7b004395 --- /dev/null +++ b/codenet/public_test_cases/p01540/input.2.txt @@ -0,0 +1,5 @@ +3 1 +1 1 +2 4 +5 3 +0 0 5 5 diff --git a/codenet/public_test_cases/p01540/input.3.txt b/codenet/public_test_cases/p01540/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac0f92e26fab927b61e64ce63710ac21026f17e --- /dev/null +++ b/codenet/public_test_cases/p01540/input.3.txt @@ -0,0 +1,7 @@ +4 2 +-1 1 +0 3 +4 0 +2 1 +-3 1 5 1 +4 0 4 0 diff --git a/codenet/public_test_cases/p01540/input.4.txt b/codenet/public_test_cases/p01540/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ab384f88e04921f3e9b8e55d934c5bb1a8ac222 --- /dev/null +++ b/codenet/public_test_cases/p01540/input.4.txt @@ -0,0 +1,6 @@ +2 3 +0 0 +0 0 +-1 -1 1 1 +0 0 2 2 +1 1 4 4 diff --git a/codenet/public_test_cases/p01540/output.0.txt b/codenet/public_test_cases/p01540/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01540/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01540/output.1.txt b/codenet/public_test_cases/p01540/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28c3b9d1c6696e2b34276650f7918694e6ac8fa3 --- /dev/null +++ b/codenet/public_test_cases/p01540/output.1.txt @@ -0,0 +1,5 @@ +2 +2 +5 +0 +4 diff --git a/codenet/public_test_cases/p01540/output.2.txt b/codenet/public_test_cases/p01540/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01540/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01540/output.3.txt b/codenet/public_test_cases/p01540/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p01540/output.3.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p01540/output.4.txt b/codenet/public_test_cases/p01540/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..073f6a1f4553b50607f473c89c54ef74adab11c4 --- /dev/null +++ b/codenet/public_test_cases/p01540/output.4.txt @@ -0,0 +1,3 @@ +2 +2 +0 diff --git a/codenet/public_test_cases/p01541/input.0.txt b/codenet/public_test_cases/p01541/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fa4b16938340a4e415e06180ae61b73e33c40d0 --- /dev/null +++ b/codenet/public_test_cases/p01541/input.0.txt @@ -0,0 +1,5 @@ +100 +2 +1 +2 +0 diff --git a/codenet/public_test_cases/p01541/input.1.txt b/codenet/public_test_cases/p01541/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff60234e31a857359ed7a8cba3a77b95f2668882 --- /dev/null +++ b/codenet/public_test_cases/p01541/input.1.txt @@ -0,0 +1,9 @@ +100 +4 +3 +1 +1 +3 +2 +40 +60 diff --git a/codenet/public_test_cases/p01541/input.2.txt b/codenet/public_test_cases/p01541/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c333e90727f1bcc8cd9e760efd19c48e63319aba --- /dev/null +++ b/codenet/public_test_cases/p01541/input.2.txt @@ -0,0 +1,5 @@ +100 +2 +2 +1 +0 diff --git a/codenet/public_test_cases/p01541/input.3.txt b/codenet/public_test_cases/p01541/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c780fa6b6f52529fb408c7312f7a53cde07ddd6 --- /dev/null +++ b/codenet/public_test_cases/p01541/input.3.txt @@ -0,0 +1,7 @@ +100 +3 +2 +1 +1 +1 +50 diff --git a/codenet/public_test_cases/p01541/input.4.txt b/codenet/public_test_cases/p01541/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fa4b16938340a4e415e06180ae61b73e33c40d0 --- /dev/null +++ b/codenet/public_test_cases/p01541/input.4.txt @@ -0,0 +1,5 @@ +100 +2 +1 +2 +0 diff --git a/codenet/public_test_cases/p01541/output.0.txt b/codenet/public_test_cases/p01541/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bc92d44ac9d8a185fa33dec183c593d71d79372 --- /dev/null +++ b/codenet/public_test_cases/p01541/output.0.txt @@ -0,0 +1 @@ +201 diff --git a/codenet/public_test_cases/p01541/output.1.txt b/codenet/public_test_cases/p01541/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bb7ac539ae8f07b73046a3afb611ab976ccbd5d --- /dev/null +++ b/codenet/public_test_cases/p01541/output.1.txt @@ -0,0 +1 @@ +421 diff --git a/codenet/public_test_cases/p01541/output.2.txt b/codenet/public_test_cases/p01541/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..08839f6bb296e888d311d8ea2f35f7ff82dd3f2d --- /dev/null +++ b/codenet/public_test_cases/p01541/output.2.txt @@ -0,0 +1 @@ +200 diff --git a/codenet/public_test_cases/p01541/output.3.txt b/codenet/public_test_cases/p01541/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..08839f6bb296e888d311d8ea2f35f7ff82dd3f2d --- /dev/null +++ b/codenet/public_test_cases/p01541/output.3.txt @@ -0,0 +1 @@ +200 diff --git a/codenet/public_test_cases/p01541/output.4.txt b/codenet/public_test_cases/p01541/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bc92d44ac9d8a185fa33dec183c593d71d79372 --- /dev/null +++ b/codenet/public_test_cases/p01541/output.4.txt @@ -0,0 +1 @@ +201 diff --git a/codenet/public_test_cases/p01542/input.0.txt b/codenet/public_test_cases/p01542/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f087a34c80c2123f05aae01e910c871b9e23773 --- /dev/null +++ b/codenet/public_test_cases/p01542/input.0.txt @@ -0,0 +1 @@ +000 diff --git a/codenet/public_test_cases/p01542/input.1.txt b/codenet/public_test_cases/p01542/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba66466c2a0d0a1080ad71d8e1a67a97f336c384 --- /dev/null +++ b/codenet/public_test_cases/p01542/input.1.txt @@ -0,0 +1 @@ +0.0 diff --git a/codenet/public_test_cases/p01542/input.2.txt b/codenet/public_test_cases/p01542/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..39259d1c3efd03eab6a1982812db25f47aa7129b --- /dev/null +++ b/codenet/public_test_cases/p01542/input.2.txt @@ -0,0 +1 @@ +(1.1) diff --git a/codenet/public_test_cases/p01542/input.3.txt b/codenet/public_test_cases/p01542/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb1ae458f8ee6e88c072a9989724d7685c56beb1 --- /dev/null +++ b/codenet/public_test_cases/p01542/input.3.txt @@ -0,0 +1 @@ +... diff --git a/codenet/public_test_cases/p01542/input.4.txt b/codenet/public_test_cases/p01542/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba25aea5642b5df8019bcc185def9da860917a0e --- /dev/null +++ b/codenet/public_test_cases/p01542/input.4.txt @@ -0,0 +1 @@ +0-1. diff --git a/codenet/public_test_cases/p01542/input.5.txt b/codenet/public_test_cases/p01542/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f087a34c80c2123f05aae01e910c871b9e23773 --- /dev/null +++ b/codenet/public_test_cases/p01542/input.5.txt @@ -0,0 +1 @@ +000 diff --git a/codenet/public_test_cases/p01542/output.0.txt b/codenet/public_test_cases/p01542/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01542/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01542/output.1.txt b/codenet/public_test_cases/p01542/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01542/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01542/output.2.txt b/codenet/public_test_cases/p01542/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01542/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01542/output.3.txt b/codenet/public_test_cases/p01542/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01542/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01542/output.4.txt b/codenet/public_test_cases/p01542/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01542/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01542/output.5.txt b/codenet/public_test_cases/p01542/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01542/output.5.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01543/input.0.txt b/codenet/public_test_cases/p01543/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f56a128a67862ea2ec7e0c4ad671a18a16429b34 --- /dev/null +++ b/codenet/public_test_cases/p01543/input.0.txt @@ -0,0 +1,10 @@ +3 +1 1 1 +1 1 1 +1 1 1 +1 1 1 +1 1 1 +1 1 1 +o.o +... +.o. diff --git a/codenet/public_test_cases/p01543/input.1.txt b/codenet/public_test_cases/p01543/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fb26381c2c8705485baf7000f51f78ba646f128 --- /dev/null +++ b/codenet/public_test_cases/p01543/input.1.txt @@ -0,0 +1,13 @@ +4 +1 2 3 4 +1 2 3 4 +1 2 3 4 +1 2 3 4 +1 2 3 4 +1 2 3 4 +1 2 3 4 +1 2 3 4 +oooo +oooo +oooo +oooo diff --git a/codenet/public_test_cases/p01543/input.2.txt b/codenet/public_test_cases/p01543/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb2534db2a1da683e644c5fde4a16efbd37137ad --- /dev/null +++ b/codenet/public_test_cases/p01543/input.2.txt @@ -0,0 +1,10 @@ +3 +1 1 1 +1 1 1 +1 1 1 +1 1 1 +1 1 1 +1 1 1 +o.. +.o. +..o diff --git a/codenet/public_test_cases/p01543/input.3.txt b/codenet/public_test_cases/p01543/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f56a128a67862ea2ec7e0c4ad671a18a16429b34 --- /dev/null +++ b/codenet/public_test_cases/p01543/input.3.txt @@ -0,0 +1,10 @@ +3 +1 1 1 +1 1 1 +1 1 1 +1 1 1 +1 1 1 +1 1 1 +o.o +... +.o. diff --git a/codenet/public_test_cases/p01543/output.0.txt b/codenet/public_test_cases/p01543/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..489a08cf26de862776766c3318037cf7832ea8ee --- /dev/null +++ b/codenet/public_test_cases/p01543/output.0.txt @@ -0,0 +1,4 @@ +2 +2 +1 3 erase +2 3 write diff --git a/codenet/public_test_cases/p01543/output.1.txt b/codenet/public_test_cases/p01543/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..862cecfc8e7a181dc4381697f758c8208ade0cd7 --- /dev/null +++ b/codenet/public_test_cases/p01543/output.1.txt @@ -0,0 +1,14 @@ +30 +12 +1 1 erase +1 2 erase +1 3 erase +2 1 erase +2 2 erase +2 4 erase +3 1 erase +3 3 erase +3 4 erase +4 2 erase +4 3 erase +4 4 erase diff --git a/codenet/public_test_cases/p01543/output.2.txt b/codenet/public_test_cases/p01543/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa47d0d46d47a06090f436b0b851b76bb6f3b6e2 --- /dev/null +++ b/codenet/public_test_cases/p01543/output.2.txt @@ -0,0 +1,2 @@ +0 +0 diff --git a/codenet/public_test_cases/p01543/output.3.txt b/codenet/public_test_cases/p01543/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..489a08cf26de862776766c3318037cf7832ea8ee --- /dev/null +++ b/codenet/public_test_cases/p01543/output.3.txt @@ -0,0 +1,4 @@ +2 +2 +1 3 erase +2 3 write diff --git a/codenet/public_test_cases/p01544/input.0.txt b/codenet/public_test_cases/p01544/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb25ab683c82bc3289c24336d1b3cd8a711b58c9 --- /dev/null +++ b/codenet/public_test_cases/p01544/input.0.txt @@ -0,0 +1,4 @@ +3 +1 +2 +4 diff --git a/codenet/public_test_cases/p01544/input.1.txt b/codenet/public_test_cases/p01544/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..330933ffc0f69e762f248c9d032f2dfcadbeefd3 --- /dev/null +++ b/codenet/public_test_cases/p01544/input.1.txt @@ -0,0 +1,4 @@ +3 +4 +2 +1 diff --git a/codenet/public_test_cases/p01544/input.2.txt b/codenet/public_test_cases/p01544/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb25ab683c82bc3289c24336d1b3cd8a711b58c9 --- /dev/null +++ b/codenet/public_test_cases/p01544/input.2.txt @@ -0,0 +1,4 @@ +3 +1 +2 +4 diff --git a/codenet/public_test_cases/p01544/input.3.txt b/codenet/public_test_cases/p01544/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..47caebfbef7dff406435e96bcb077353adfe2a4e --- /dev/null +++ b/codenet/public_test_cases/p01544/input.3.txt @@ -0,0 +1,4 @@ +3 +2 +2 +2 diff --git a/codenet/public_test_cases/p01544/output.0.txt b/codenet/public_test_cases/p01544/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..655926867979efc0d6df8145b3df7ec0b9be971a --- /dev/null +++ b/codenet/public_test_cases/p01544/output.0.txt @@ -0,0 +1,2 @@ +3 +1 2 diff --git a/codenet/public_test_cases/p01544/output.1.txt b/codenet/public_test_cases/p01544/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0882bc13239cdd33e350d87c7888c8da565a232b --- /dev/null +++ b/codenet/public_test_cases/p01544/output.1.txt @@ -0,0 +1,2 @@ +1 +(空行) diff --git a/codenet/public_test_cases/p01544/output.2.txt b/codenet/public_test_cases/p01544/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..655926867979efc0d6df8145b3df7ec0b9be971a --- /dev/null +++ b/codenet/public_test_cases/p01544/output.2.txt @@ -0,0 +1,2 @@ +3 +1 2 diff --git a/codenet/public_test_cases/p01544/output.3.txt b/codenet/public_test_cases/p01544/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p01544/output.3.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p01545/input.0.txt b/codenet/public_test_cases/p01545/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98c3cdb827e227fc2dae7159ec6ebd576f5306ce --- /dev/null +++ b/codenet/public_test_cases/p01545/input.0.txt @@ -0,0 +1,2 @@ +4 +1 4 2 3 diff --git a/codenet/public_test_cases/p01545/input.1.txt b/codenet/public_test_cases/p01545/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a6d86d594377511b91f16cb4e83f6746e1b5e7e --- /dev/null +++ b/codenet/public_test_cases/p01545/input.1.txt @@ -0,0 +1,2 @@ +8 +6 2 1 3 8 5 4 7 diff --git a/codenet/public_test_cases/p01545/input.2.txt b/codenet/public_test_cases/p01545/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3211909f096efb51d4e8ba04f21ce00cd75693fa --- /dev/null +++ b/codenet/public_test_cases/p01545/input.2.txt @@ -0,0 +1,2 @@ +5 +1 5 3 2 4 diff --git a/codenet/public_test_cases/p01545/input.3.txt b/codenet/public_test_cases/p01545/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1867bcc2bb2dbdce09956ca9bd917b085cfdda7b --- /dev/null +++ b/codenet/public_test_cases/p01545/input.3.txt @@ -0,0 +1,2 @@ +7 +1 2 3 4 5 6 7 diff --git a/codenet/public_test_cases/p01545/input.4.txt b/codenet/public_test_cases/p01545/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..98c3cdb827e227fc2dae7159ec6ebd576f5306ce --- /dev/null +++ b/codenet/public_test_cases/p01545/input.4.txt @@ -0,0 +1,2 @@ +4 +1 4 2 3 diff --git a/codenet/public_test_cases/p01545/output.0.txt b/codenet/public_test_cases/p01545/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01545/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01545/output.1.txt b/codenet/public_test_cases/p01545/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p01545/output.1.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p01545/output.2.txt b/codenet/public_test_cases/p01545/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01545/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01545/output.3.txt b/codenet/public_test_cases/p01545/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01545/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01545/output.4.txt b/codenet/public_test_cases/p01545/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01545/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01546/input.0.txt b/codenet/public_test_cases/p01546/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..983433d87103a8719556a6fb2eecc847c4989aec --- /dev/null +++ b/codenet/public_test_cases/p01546/input.0.txt @@ -0,0 +1,10 @@ +3 9 89 +2 0 2 +1 0 3 +2 0 1 +2 0 3 +0 1 1 +0 1 2 +1 2 3 +0 1 1 +1 0 2 diff --git a/codenet/public_test_cases/p01546/input.1.txt b/codenet/public_test_cases/p01546/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4a7cf962a3734fb7884e1584b8213e89ccf0439 --- /dev/null +++ b/codenet/public_test_cases/p01546/input.1.txt @@ -0,0 +1,9 @@ +7 8 4000 +0 1 1 +1 0 1 +1 2 2 +2 3 2 +3 4 2 +5 4 3 +3 5 4 +5 6 5 diff --git a/codenet/public_test_cases/p01546/input.2.txt b/codenet/public_test_cases/p01546/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..73c24018a0866d8a224f58f77b2dc95913c24333 --- /dev/null +++ b/codenet/public_test_cases/p01546/input.2.txt @@ -0,0 +1 @@ +2 0 1 diff --git a/codenet/public_test_cases/p01546/input.3.txt b/codenet/public_test_cases/p01546/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..983433d87103a8719556a6fb2eecc847c4989aec --- /dev/null +++ b/codenet/public_test_cases/p01546/input.3.txt @@ -0,0 +1,10 @@ +3 9 89 +2 0 2 +1 0 3 +2 0 1 +2 0 3 +0 1 1 +0 1 2 +1 2 3 +0 1 1 +1 0 2 diff --git a/codenet/public_test_cases/p01546/output.0.txt b/codenet/public_test_cases/p01546/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..659d12303394c198a1669a15b1549a6db6d0978d --- /dev/null +++ b/codenet/public_test_cases/p01546/output.0.txt @@ -0,0 +1,2 @@ +34 +1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 0 diff --git a/codenet/public_test_cases/p01546/output.1.txt b/codenet/public_test_cases/p01546/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3f9da2b2a6b17e3b3ed9246842c2f2b31dd78fb --- /dev/null +++ b/codenet/public_test_cases/p01546/output.1.txt @@ -0,0 +1 @@ +3991 diff --git a/codenet/public_test_cases/p01546/output.2.txt b/codenet/public_test_cases/p01546/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01546/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01546/output.3.txt b/codenet/public_test_cases/p01546/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..659d12303394c198a1669a15b1549a6db6d0978d --- /dev/null +++ b/codenet/public_test_cases/p01546/output.3.txt @@ -0,0 +1,2 @@ +34 +1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 0 diff --git a/codenet/public_test_cases/p01547/input.0.txt b/codenet/public_test_cases/p01547/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..974132f40fda2f572214d40f2bc78fe0fd3a006f --- /dev/null +++ b/codenet/public_test_cases/p01547/input.0.txt @@ -0,0 +1,12 @@ +2 +4 +0 4 +1 1 +3 1 +4 4 +3 +6 0 +10 0 +8 7 +1 +2 3 9 1 diff --git a/codenet/public_test_cases/p01547/input.1.txt b/codenet/public_test_cases/p01547/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..974132f40fda2f572214d40f2bc78fe0fd3a006f --- /dev/null +++ b/codenet/public_test_cases/p01547/input.1.txt @@ -0,0 +1,12 @@ +2 +4 +0 4 +1 1 +3 1 +4 4 +3 +6 0 +10 0 +8 7 +1 +2 3 9 1 diff --git a/codenet/public_test_cases/p01547/input.2.txt b/codenet/public_test_cases/p01547/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..570d064242f161423dacab368f9fc4acb8884251 --- /dev/null +++ b/codenet/public_test_cases/p01547/input.2.txt @@ -0,0 +1,13 @@ +2 +4 +0 0 +10 0 +10 10 +0 10 +4 +10 0 +20 0 +20 10 +10 10 +1 +5 5 15 5 diff --git a/codenet/public_test_cases/p01547/input.3.txt b/codenet/public_test_cases/p01547/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6f386db78de1382ad7a07f5f11a10c31b7da672 --- /dev/null +++ b/codenet/public_test_cases/p01547/input.3.txt @@ -0,0 +1,14 @@ +2 +4 +0 0 +10 0 +10 10 +0 10 +4 +0 0 +10 0 +10 10 +0 10 +2 +15 5 5 5 +5 5 15 5 diff --git a/codenet/public_test_cases/p01547/input.4.txt b/codenet/public_test_cases/p01547/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..313172450dc5a8392de9ad75d493c8ff74f3bebe --- /dev/null +++ b/codenet/public_test_cases/p01547/input.4.txt @@ -0,0 +1,9 @@ +1 +4 +0 0 +10 0 +10 10 +0 10 +2 +15 5 5 5 +5 5 15 5 diff --git a/codenet/public_test_cases/p01547/input.5.txt b/codenet/public_test_cases/p01547/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e0d911e44ac4e3a986a6678acb04f82f919fc98 --- /dev/null +++ b/codenet/public_test_cases/p01547/input.5.txt @@ -0,0 +1,11 @@ +2 +3 +0 0 +10 0 +5 10 +3 +5 0 +15 0 +10 10 +1 +5 5 10 5 diff --git a/codenet/public_test_cases/p01547/output.0.txt b/codenet/public_test_cases/p01547/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01547/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01547/output.1.txt b/codenet/public_test_cases/p01547/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01547/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01547/output.2.txt b/codenet/public_test_cases/p01547/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01547/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01547/output.3.txt b/codenet/public_test_cases/p01547/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..51993f072d5832f20b98b6bd0cf763fb8b4c8a1b --- /dev/null +++ b/codenet/public_test_cases/p01547/output.3.txt @@ -0,0 +1,2 @@ +2 +2 diff --git a/codenet/public_test_cases/p01547/output.4.txt b/codenet/public_test_cases/p01547/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p01547/output.4.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p01547/output.5.txt b/codenet/public_test_cases/p01547/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01547/output.5.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01548/input.0.txt b/codenet/public_test_cases/p01548/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38f3701c75d4347393880f3036b6e8895fe180d0 --- /dev/null +++ b/codenet/public_test_cases/p01548/input.0.txt @@ -0,0 +1,5 @@ +4 1 +1 1 1 +1 1 1 +1 1 1 +1 1 1 diff --git a/codenet/public_test_cases/p01548/input.1.txt b/codenet/public_test_cases/p01548/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38f3701c75d4347393880f3036b6e8895fe180d0 --- /dev/null +++ b/codenet/public_test_cases/p01548/input.1.txt @@ -0,0 +1,5 @@ +4 1 +1 1 1 +1 1 1 +1 1 1 +1 1 1 diff --git a/codenet/public_test_cases/p01548/input.2.txt b/codenet/public_test_cases/p01548/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..176fa923190b4e2f727ce4e2dc74afd43450a74e --- /dev/null +++ b/codenet/public_test_cases/p01548/input.2.txt @@ -0,0 +1,10 @@ +9 9 +13 5 19 +19 21 37 +15 1 7 +7 11 15 +21 23 25 +33 29 19 +13 19 11 +21 5 15 +7 13 1 diff --git a/codenet/public_test_cases/p01548/input.3.txt b/codenet/public_test_cases/p01548/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e14775a1395a39df1aa7b236bf9438bb132d49fe --- /dev/null +++ b/codenet/public_test_cases/p01548/input.3.txt @@ -0,0 +1,5 @@ +4 10 +1 1 1 +10 10 10 +10 10 10 +10 10 10 diff --git a/codenet/public_test_cases/p01548/output.0.txt b/codenet/public_test_cases/p01548/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c2970418cb91498c0defa164f996a936836d82b --- /dev/null +++ b/codenet/public_test_cases/p01548/output.0.txt @@ -0,0 +1 @@ +2.777777777778 diff --git a/codenet/public_test_cases/p01548/output.1.txt b/codenet/public_test_cases/p01548/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c2970418cb91498c0defa164f996a936836d82b --- /dev/null +++ b/codenet/public_test_cases/p01548/output.1.txt @@ -0,0 +1 @@ +2.777777777778 diff --git a/codenet/public_test_cases/p01548/output.2.txt b/codenet/public_test_cases/p01548/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..88b17dcf91e970573b61a25ad28948733be5da2b --- /dev/null +++ b/codenet/public_test_cases/p01548/output.2.txt @@ -0,0 +1 @@ +4.678837855075 diff --git a/codenet/public_test_cases/p01548/output.3.txt b/codenet/public_test_cases/p01548/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc70ff0d610a6ed122eb2503260acab3011dfa4c --- /dev/null +++ b/codenet/public_test_cases/p01548/output.3.txt @@ -0,0 +1 @@ +-2.335340954780 diff --git a/codenet/public_test_cases/p01549/input.0.txt b/codenet/public_test_cases/p01549/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5840196d6e003eb0a8e8ac9386f687f35d291f26 --- /dev/null +++ b/codenet/public_test_cases/p01549/input.0.txt @@ -0,0 +1,4 @@ +1 +a 1 10 +3 +10 a / diff --git a/codenet/public_test_cases/p01549/input.1.txt b/codenet/public_test_cases/p01549/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4249cf6f5f12c812532a457809b265c45f0323a6 --- /dev/null +++ b/codenet/public_test_cases/p01549/input.1.txt @@ -0,0 +1,4 @@ +1 +a 0 255 +7 +1 a 2 * 1 + / diff --git a/codenet/public_test_cases/p01549/input.2.txt b/codenet/public_test_cases/p01549/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5840196d6e003eb0a8e8ac9386f687f35d291f26 --- /dev/null +++ b/codenet/public_test_cases/p01549/input.2.txt @@ -0,0 +1,4 @@ +1 +a 1 10 +3 +10 a / diff --git a/codenet/public_test_cases/p01549/input.3.txt b/codenet/public_test_cases/p01549/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b9e38ab295e3a2ebf804299541bb7292570c463 --- /dev/null +++ b/codenet/public_test_cases/p01549/input.3.txt @@ -0,0 +1,5 @@ +2 +a 1 10 +b 1 10 +5 +1 a b - / diff --git a/codenet/public_test_cases/p01549/output.0.txt b/codenet/public_test_cases/p01549/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..818e321255fbb4a60638e17ad13b35731bace83b --- /dev/null +++ b/codenet/public_test_cases/p01549/output.0.txt @@ -0,0 +1 @@ +correct diff --git a/codenet/public_test_cases/p01549/output.1.txt b/codenet/public_test_cases/p01549/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..818e321255fbb4a60638e17ad13b35731bace83b --- /dev/null +++ b/codenet/public_test_cases/p01549/output.1.txt @@ -0,0 +1 @@ +correct diff --git a/codenet/public_test_cases/p01549/output.2.txt b/codenet/public_test_cases/p01549/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..818e321255fbb4a60638e17ad13b35731bace83b --- /dev/null +++ b/codenet/public_test_cases/p01549/output.2.txt @@ -0,0 +1 @@ +correct diff --git a/codenet/public_test_cases/p01549/output.3.txt b/codenet/public_test_cases/p01549/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8276753746b12b5843b25ec22b5a061787b0b670 --- /dev/null +++ b/codenet/public_test_cases/p01549/output.3.txt @@ -0,0 +1 @@ +error diff --git a/codenet/public_test_cases/p01550/input.0.txt b/codenet/public_test_cases/p01550/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p01550/input.0.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p01550/input.1.txt b/codenet/public_test_cases/p01550/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p01550/input.1.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p01550/input.2.txt b/codenet/public_test_cases/p01550/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aeb669e1498972cef39c1770a1422b92c7e1ff16 --- /dev/null +++ b/codenet/public_test_cases/p01550/input.2.txt @@ -0,0 +1,5 @@ +4 +0 +4 +7 +8 diff --git a/codenet/public_test_cases/p01550/input.3.txt b/codenet/public_test_cases/p01550/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..98116a7daf0bcccd73a52dc0a9239d00138aefba --- /dev/null +++ b/codenet/public_test_cases/p01550/input.3.txt @@ -0,0 +1,3 @@ +2 +1 +11 diff --git a/codenet/public_test_cases/p01550/output.0.txt b/codenet/public_test_cases/p01550/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p01550/output.0.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p01550/output.1.txt b/codenet/public_test_cases/p01550/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p01550/output.1.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p01550/output.2.txt b/codenet/public_test_cases/p01550/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8994f58e46dc55f5a54e2201d58aa19e0e0f9ea --- /dev/null +++ b/codenet/public_test_cases/p01550/output.2.txt @@ -0,0 +1 @@ +135299 diff --git a/codenet/public_test_cases/p01550/output.3.txt b/codenet/public_test_cases/p01550/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b5813c6a7ebef887d9dc34812413e64603bc838 --- /dev/null +++ b/codenet/public_test_cases/p01550/output.3.txt @@ -0,0 +1 @@ +234 diff --git a/codenet/public_test_cases/p01551/input.0.txt b/codenet/public_test_cases/p01551/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..930fdfa352e64e76fb76ae6e24f2c93a1e861bd0 --- /dev/null +++ b/codenet/public_test_cases/p01551/input.0.txt @@ -0,0 +1,5 @@ +1 0 1 0 +3 +dna: a b +a: [AT] +b: [GC] diff --git a/codenet/public_test_cases/p01551/input.1.txt b/codenet/public_test_cases/p01551/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c3f7fa86aa9202920d22f9f4bd05899f68bf48d --- /dev/null +++ b/codenet/public_test_cases/p01551/input.1.txt @@ -0,0 +1,3 @@ +1 1 1 2 +1 +k: [ATG] [ATG] [ATG] [C] [C] diff --git a/codenet/public_test_cases/p01551/input.2.txt b/codenet/public_test_cases/p01551/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8b05463bb79c9aa54f551291a36af35ae83f9ec --- /dev/null +++ b/codenet/public_test_cases/p01551/input.2.txt @@ -0,0 +1,5 @@ +3 1 1 1 +3 +inv: at b b b +at: [ATG] b +b: [C] diff --git a/codenet/public_test_cases/p01551/input.3.txt b/codenet/public_test_cases/p01551/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..930fdfa352e64e76fb76ae6e24f2c93a1e861bd0 --- /dev/null +++ b/codenet/public_test_cases/p01551/input.3.txt @@ -0,0 +1,5 @@ +1 0 1 0 +3 +dna: a b +a: [AT] +b: [GC] diff --git a/codenet/public_test_cases/p01551/output.0.txt b/codenet/public_test_cases/p01551/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01551/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01551/output.1.txt b/codenet/public_test_cases/p01551/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01551/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01551/output.2.txt b/codenet/public_test_cases/p01551/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01551/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01551/output.3.txt b/codenet/public_test_cases/p01551/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01551/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01552/input.0.txt b/codenet/public_test_cases/p01552/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f020ce9d2e4fccdaf458c9c30a02f376a8fc026 --- /dev/null +++ b/codenet/public_test_cases/p01552/input.0.txt @@ -0,0 +1,6 @@ +.tweets.1 +name: shimeji +id: shimejitan +tweets: + 1: shimejilove + 2: azupero diff --git a/codenet/public_test_cases/p01552/input.1.txt b/codenet/public_test_cases/p01552/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc73cd0ea101adcfa2a3a008e2758affbd450cf5 --- /dev/null +++ b/codenet/public_test_cases/p01552/input.1.txt @@ -0,0 +1,6 @@ +.tweets.1 +name: shimeji +id: shimejitan +tweets: +1: shimejilove +2: azupero diff --git a/codenet/public_test_cases/p01552/input.2.txt b/codenet/public_test_cases/p01552/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3baeb42adb74ebb624037711a1c50f5fcc93279f --- /dev/null +++ b/codenet/public_test_cases/p01552/input.2.txt @@ -0,0 +1,4 @@ +.no.such.property +object: +prop1: str +prop2: str diff --git a/codenet/public_test_cases/p01552/input.3.txt b/codenet/public_test_cases/p01552/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f020ce9d2e4fccdaf458c9c30a02f376a8fc026 --- /dev/null +++ b/codenet/public_test_cases/p01552/input.3.txt @@ -0,0 +1,6 @@ +.tweets.1 +name: shimeji +id: shimejitan +tweets: + 1: shimejilove + 2: azupero diff --git a/codenet/public_test_cases/p01552/input.4.txt b/codenet/public_test_cases/p01552/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d78d4de892b62fccb55077d5857466cf8259e9f7 --- /dev/null +++ b/codenet/public_test_cases/p01552/input.4.txt @@ -0,0 +1,7 @@ +.my.obj +my: +str: string value +obj: +a: a +b: b +c: c diff --git a/codenet/public_test_cases/p01552/input.5.txt b/codenet/public_test_cases/p01552/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e0758a18c7e207043cc462bf044ecca1aa0853d --- /dev/null +++ b/codenet/public_test_cases/p01552/input.5.txt @@ -0,0 +1,2 @@ +.a +a: sample case diff --git a/codenet/public_test_cases/p01552/input.6.txt b/codenet/public_test_cases/p01552/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..b97a8e24f91cdca2f9aa7a37bca53c5f2a71d4b8 --- /dev/null +++ b/codenet/public_test_cases/p01552/input.6.txt @@ -0,0 +1,2 @@ +.str.inner +str: inner diff --git a/codenet/public_test_cases/p01552/output.0.txt b/codenet/public_test_cases/p01552/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf5c7c7cf29dde0654582849629491291e32aea5 --- /dev/null +++ b/codenet/public_test_cases/p01552/output.0.txt @@ -0,0 +1 @@ +string "shimejilove" diff --git a/codenet/public_test_cases/p01552/output.1.txt b/codenet/public_test_cases/p01552/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf5c7c7cf29dde0654582849629491291e32aea5 --- /dev/null +++ b/codenet/public_test_cases/p01552/output.1.txt @@ -0,0 +1 @@ +string "shimejilove" diff --git a/codenet/public_test_cases/p01552/output.2.txt b/codenet/public_test_cases/p01552/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b0a9ad0af189ef480ec0f8887da515cb21b19b3 --- /dev/null +++ b/codenet/public_test_cases/p01552/output.2.txt @@ -0,0 +1 @@ +no such property diff --git a/codenet/public_test_cases/p01552/output.3.txt b/codenet/public_test_cases/p01552/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf5c7c7cf29dde0654582849629491291e32aea5 --- /dev/null +++ b/codenet/public_test_cases/p01552/output.3.txt @@ -0,0 +1 @@ +string "shimejilove" diff --git a/codenet/public_test_cases/p01552/output.4.txt b/codenet/public_test_cases/p01552/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2f6b779bb955caccbca4cafb2886569e46608f2 --- /dev/null +++ b/codenet/public_test_cases/p01552/output.4.txt @@ -0,0 +1 @@ +object diff --git a/codenet/public_test_cases/p01552/output.5.txt b/codenet/public_test_cases/p01552/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..9da678118db62a6c03a0ae5fe4a78a765f6bfef8 --- /dev/null +++ b/codenet/public_test_cases/p01552/output.5.txt @@ -0,0 +1 @@ +string "sample case" diff --git a/codenet/public_test_cases/p01552/output.6.txt b/codenet/public_test_cases/p01552/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b0a9ad0af189ef480ec0f8887da515cb21b19b3 --- /dev/null +++ b/codenet/public_test_cases/p01552/output.6.txt @@ -0,0 +1 @@ +no such property diff --git a/codenet/public_test_cases/p01553/input.0.txt b/codenet/public_test_cases/p01553/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3952b3499ceefef3b59bd5e3fe33a135c3e6bba2 --- /dev/null +++ b/codenet/public_test_cases/p01553/input.0.txt @@ -0,0 +1,4 @@ +3 +- +U +D diff --git a/codenet/public_test_cases/p01553/input.1.txt b/codenet/public_test_cases/p01553/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3952b3499ceefef3b59bd5e3fe33a135c3e6bba2 --- /dev/null +++ b/codenet/public_test_cases/p01553/input.1.txt @@ -0,0 +1,4 @@ +3 +- +U +D diff --git a/codenet/public_test_cases/p01553/input.2.txt b/codenet/public_test_cases/p01553/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d0d05a718d6b3fddc741c159cbda80788243a5c --- /dev/null +++ b/codenet/public_test_cases/p01553/input.2.txt @@ -0,0 +1,11 @@ +10 +U +D +U +D +U +D +U +D +U +D diff --git a/codenet/public_test_cases/p01553/input.3.txt b/codenet/public_test_cases/p01553/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d54e00c161fb5c545e674edd71527fcbfd9922a --- /dev/null +++ b/codenet/public_test_cases/p01553/input.3.txt @@ -0,0 +1,9 @@ +8 +U +D +D +D +D +D +D +D diff --git a/codenet/public_test_cases/p01553/input.4.txt b/codenet/public_test_cases/p01553/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..680d1a1a4746969109de5bdcbca335a8bfab19b8 --- /dev/null +++ b/codenet/public_test_cases/p01553/input.4.txt @@ -0,0 +1,3 @@ +2 +D +U diff --git a/codenet/public_test_cases/p01553/input.5.txt b/codenet/public_test_cases/p01553/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..6238ce0f203f017276f97baa3ea5f32bf5d319f3 --- /dev/null +++ b/codenet/public_test_cases/p01553/input.5.txt @@ -0,0 +1,6 @@ +5 +U +U +- +D +D diff --git a/codenet/public_test_cases/p01553/output.0.txt b/codenet/public_test_cases/p01553/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01553/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01553/output.1.txt b/codenet/public_test_cases/p01553/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01553/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01553/output.2.txt b/codenet/public_test_cases/p01553/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce5acf70991a02c791a7b82fa6ad9537e8576366 --- /dev/null +++ b/codenet/public_test_cases/p01553/output.2.txt @@ -0,0 +1 @@ +608 diff --git a/codenet/public_test_cases/p01553/output.3.txt b/codenet/public_test_cases/p01553/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01553/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01553/output.4.txt b/codenet/public_test_cases/p01553/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01553/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01553/output.5.txt b/codenet/public_test_cases/p01553/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01553/output.5.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01554/input.0.txt b/codenet/public_test_cases/p01554/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbb640c2c395fec19b4b7d08ea75053788f58cf5 --- /dev/null +++ b/codenet/public_test_cases/p01554/input.0.txt @@ -0,0 +1,11 @@ +4 +abcd +efgh +ijkl +mnop +5 +abcd +abcc +efgh +abcd +mnop diff --git a/codenet/public_test_cases/p01554/output.0.txt b/codenet/public_test_cases/p01554/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87d6e5774bc124098e73db562ea7474669c3f178 --- /dev/null +++ b/codenet/public_test_cases/p01554/output.0.txt @@ -0,0 +1,5 @@ +Opened by abcd +Unknown abcc +Closed by efgh +Opened by abcd +Closed by mnop diff --git a/codenet/public_test_cases/p01555/input.0.txt b/codenet/public_test_cases/p01555/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01555/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01555/input.1.txt b/codenet/public_test_cases/p01555/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p01555/input.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p01555/input.2.txt b/codenet/public_test_cases/p01555/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa70b89f2419392b9755e77e59b6b93b424cca9a --- /dev/null +++ b/codenet/public_test_cases/p01555/input.2.txt @@ -0,0 +1 @@ +10000000000 diff --git a/codenet/public_test_cases/p01555/input.3.txt b/codenet/public_test_cases/p01555/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01555/input.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01555/output.0.txt b/codenet/public_test_cases/p01555/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..234bdd8db06dd8ce4c24da815c9c977a4929a7b6 --- /dev/null +++ b/codenet/public_test_cases/p01555/output.0.txt @@ -0,0 +1 @@ +12Fizz4BuzzFizz78Fiz diff --git a/codenet/public_test_cases/p01555/output.1.txt b/codenet/public_test_cases/p01555/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12248914f4861db2d1619d0db8d807415dad1c08 --- /dev/null +++ b/codenet/public_test_cases/p01555/output.1.txt @@ -0,0 +1 @@ +zzBuzz11Fizz1314Fizz diff --git a/codenet/public_test_cases/p01555/output.2.txt b/codenet/public_test_cases/p01555/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..95f536ba9c2fa8981483395aa9dfcd2e83a88b38 --- /dev/null +++ b/codenet/public_test_cases/p01555/output.2.txt @@ -0,0 +1 @@ +93FizzBuzz1418650796 diff --git a/codenet/public_test_cases/p01555/output.3.txt b/codenet/public_test_cases/p01555/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..234bdd8db06dd8ce4c24da815c9c977a4929a7b6 --- /dev/null +++ b/codenet/public_test_cases/p01555/output.3.txt @@ -0,0 +1 @@ +12Fizz4BuzzFizz78Fiz diff --git a/codenet/public_test_cases/p01556/input.0.txt b/codenet/public_test_cases/p01556/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1a49c5457dbf5f05a951ef9c8c63e5b18591355 --- /dev/null +++ b/codenet/public_test_cases/p01556/input.0.txt @@ -0,0 +1,5 @@ +4 +100 100 +0 100 +0 0 +100 0 diff --git a/codenet/public_test_cases/p01556/input.1.txt b/codenet/public_test_cases/p01556/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1a49c5457dbf5f05a951ef9c8c63e5b18591355 --- /dev/null +++ b/codenet/public_test_cases/p01556/input.1.txt @@ -0,0 +1,5 @@ +4 +100 100 +0 100 +0 0 +100 0 diff --git a/codenet/public_test_cases/p01556/input.2.txt b/codenet/public_test_cases/p01556/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60fb45158917b35eb258232eb7f2178167ef126c --- /dev/null +++ b/codenet/public_test_cases/p01556/input.2.txt @@ -0,0 +1,4 @@ +3 +100 100 +0 100 +0 0 diff --git a/codenet/public_test_cases/p01556/output.0.txt b/codenet/public_test_cases/p01556/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2b2918388e8789b576e640acdcef041bf943a57 --- /dev/null +++ b/codenet/public_test_cases/p01556/output.0.txt @@ -0,0 +1 @@ +50.00000 50.00000 diff --git a/codenet/public_test_cases/p01556/output.1.txt b/codenet/public_test_cases/p01556/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2b2918388e8789b576e640acdcef041bf943a57 --- /dev/null +++ b/codenet/public_test_cases/p01556/output.1.txt @@ -0,0 +1 @@ +50.00000 50.00000 diff --git a/codenet/public_test_cases/p01556/output.2.txt b/codenet/public_test_cases/p01556/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..69fc4ef2be0c2550c183850902cb55dbf3d37b30 --- /dev/null +++ b/codenet/public_test_cases/p01556/output.2.txt @@ -0,0 +1 @@ +NA diff --git a/codenet/public_test_cases/p01557/input.0.txt b/codenet/public_test_cases/p01557/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28360663082779fc5b0073c379f3bd0a3995650e --- /dev/null +++ b/codenet/public_test_cases/p01557/input.0.txt @@ -0,0 +1,2 @@ +5 +1 4 3 5 2 diff --git a/codenet/public_test_cases/p01557/input.1.txt b/codenet/public_test_cases/p01557/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p01557/input.1.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p01557/input.2.txt b/codenet/public_test_cases/p01557/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..28360663082779fc5b0073c379f3bd0a3995650e --- /dev/null +++ b/codenet/public_test_cases/p01557/input.2.txt @@ -0,0 +1,2 @@ +5 +1 4 3 5 2 diff --git a/codenet/public_test_cases/p01557/input.3.txt b/codenet/public_test_cases/p01557/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..395c0477b6ff70177fb8ef2a7be17d33d7915f36 --- /dev/null +++ b/codenet/public_test_cases/p01557/input.3.txt @@ -0,0 +1,2 @@ +10 +3 1 5 2 7 4 9 6 10 8 diff --git a/codenet/public_test_cases/p01557/input.4.txt b/codenet/public_test_cases/p01557/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..88e49fe3ef69b291a170f7b8516b9395c79e54fd --- /dev/null +++ b/codenet/public_test_cases/p01557/input.4.txt @@ -0,0 +1,2 @@ +5 +3 1 5 2 4 diff --git a/codenet/public_test_cases/p01557/output.0.txt b/codenet/public_test_cases/p01557/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01557/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01557/output.1.txt b/codenet/public_test_cases/p01557/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01557/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01557/output.2.txt b/codenet/public_test_cases/p01557/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01557/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01557/output.3.txt b/codenet/public_test_cases/p01557/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01557/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01557/output.4.txt b/codenet/public_test_cases/p01557/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01557/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01558/input.0.txt b/codenet/public_test_cases/p01558/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c790f1c45d30245590c5c1948688cab6f37ff89 --- /dev/null +++ b/codenet/public_test_cases/p01558/input.0.txt @@ -0,0 +1,6 @@ +5 4 +abcde +R++ +R++ +L++ +L-- diff --git a/codenet/public_test_cases/p01558/input.1.txt b/codenet/public_test_cases/p01558/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c790f1c45d30245590c5c1948688cab6f37ff89 --- /dev/null +++ b/codenet/public_test_cases/p01558/input.1.txt @@ -0,0 +1,6 @@ +5 4 +abcde +R++ +R++ +L++ +L-- diff --git a/codenet/public_test_cases/p01558/input.2.txt b/codenet/public_test_cases/p01558/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..466e4aecbc3772582b283009f1ecb20507918e09 --- /dev/null +++ b/codenet/public_test_cases/p01558/input.2.txt @@ -0,0 +1,15 @@ +10 13 +aacacbabac +R++ +R++ +L++ +R++ +R++ +L++ +L++ +R++ +R++ +L-- +L-- +R-- +R-- diff --git a/codenet/public_test_cases/p01558/input.3.txt b/codenet/public_test_cases/p01558/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..04e6da6db799f0783482c9d822e1dde1f2224146 --- /dev/null +++ b/codenet/public_test_cases/p01558/input.3.txt @@ -0,0 +1,8 @@ +4 6 +abab +R++ +L++ +R++ +L++ +R++ +L++ diff --git a/codenet/public_test_cases/p01558/output.0.txt b/codenet/public_test_cases/p01558/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01558/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01558/output.1.txt b/codenet/public_test_cases/p01558/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01558/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01558/output.2.txt b/codenet/public_test_cases/p01558/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01558/output.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01558/output.3.txt b/codenet/public_test_cases/p01558/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01558/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01559/input.0.txt b/codenet/public_test_cases/p01559/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c91fc456a55f62b231b0bb99a48540e5320a73b --- /dev/null +++ b/codenet/public_test_cases/p01559/input.0.txt @@ -0,0 +1 @@ +3 0 diff --git a/codenet/public_test_cases/p01559/input.1.txt b/codenet/public_test_cases/p01559/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c91fc456a55f62b231b0bb99a48540e5320a73b --- /dev/null +++ b/codenet/public_test_cases/p01559/input.1.txt @@ -0,0 +1 @@ +3 0 diff --git a/codenet/public_test_cases/p01559/input.2.txt b/codenet/public_test_cases/p01559/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a722fbed65d7af24e7bb40865060083927e55e3a --- /dev/null +++ b/codenet/public_test_cases/p01559/input.2.txt @@ -0,0 +1,2 @@ +3 1 +2 2 diff --git a/codenet/public_test_cases/p01559/input.3.txt b/codenet/public_test_cases/p01559/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a03909c9118f8dd57b202dd59dd023111ce6f1a5 --- /dev/null +++ b/codenet/public_test_cases/p01559/input.3.txt @@ -0,0 +1,11 @@ +1000 10 +104 87 +637 366 +393 681 +215 604 +707 876 +943 414 +95 327 +93 415 +663 596 +661 842 diff --git a/codenet/public_test_cases/p01559/input.4.txt b/codenet/public_test_cases/p01559/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..391ed66acee5eb4b85c929e5c4673ac3c0c84bb8 --- /dev/null +++ b/codenet/public_test_cases/p01559/input.4.txt @@ -0,0 +1,9 @@ +5 8 +4 3 +2 1 +4 2 +4 4 +3 4 +2 2 +2 4 +1 4 diff --git a/codenet/public_test_cases/p01559/input.5.txt b/codenet/public_test_cases/p01559/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf26463ad0c816f4a3965504e371b6421ce43892 --- /dev/null +++ b/codenet/public_test_cases/p01559/input.5.txt @@ -0,0 +1,3 @@ +2 2 +1 2 +2 1 diff --git a/codenet/public_test_cases/p01559/output.0.txt b/codenet/public_test_cases/p01559/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01559/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01559/output.1.txt b/codenet/public_test_cases/p01559/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01559/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01559/output.2.txt b/codenet/public_test_cases/p01559/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01559/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01559/output.3.txt b/codenet/public_test_cases/p01559/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9dcb769021f4557cae932bf4d8697cda4e0ecf89 --- /dev/null +++ b/codenet/public_test_cases/p01559/output.3.txt @@ -0,0 +1 @@ +340340391 diff --git a/codenet/public_test_cases/p01559/output.4.txt b/codenet/public_test_cases/p01559/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01559/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01559/output.5.txt b/codenet/public_test_cases/p01559/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01559/output.5.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01560/input.0.txt b/codenet/public_test_cases/p01560/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3174de00ff648a72e1e2cf079a62b1b6b464a2f --- /dev/null +++ b/codenet/public_test_cases/p01560/input.0.txt @@ -0,0 +1,3 @@ +2 15 +3 5 +50 50 diff --git a/codenet/public_test_cases/p01560/input.1.txt b/codenet/public_test_cases/p01560/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3174de00ff648a72e1e2cf079a62b1b6b464a2f --- /dev/null +++ b/codenet/public_test_cases/p01560/input.1.txt @@ -0,0 +1,3 @@ +2 15 +3 5 +50 50 diff --git a/codenet/public_test_cases/p01560/input.2.txt b/codenet/public_test_cases/p01560/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d861c6b2e1132ae9f9aa4e1cdff55c008a0abbc --- /dev/null +++ b/codenet/public_test_cases/p01560/input.2.txt @@ -0,0 +1,3 @@ +4 100 +2 3 5 7 +80 60 40 20 diff --git a/codenet/public_test_cases/p01560/input.3.txt b/codenet/public_test_cases/p01560/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..577717a7730ee984e4c668bb26f14bf6d9c8b64b --- /dev/null +++ b/codenet/public_test_cases/p01560/input.3.txt @@ -0,0 +1,3 @@ +4 210 +2 3 5 7 +80 60 40 20 diff --git a/codenet/public_test_cases/p01560/output.0.txt b/codenet/public_test_cases/p01560/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3446ce26825770db08a5d7818a42d335892df74d --- /dev/null +++ b/codenet/public_test_cases/p01560/output.0.txt @@ -0,0 +1 @@ +3.75 diff --git a/codenet/public_test_cases/p01560/output.1.txt b/codenet/public_test_cases/p01560/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3446ce26825770db08a5d7818a42d335892df74d --- /dev/null +++ b/codenet/public_test_cases/p01560/output.1.txt @@ -0,0 +1 @@ +3.75 diff --git a/codenet/public_test_cases/p01560/output.2.txt b/codenet/public_test_cases/p01560/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb7faaeff4ac6d57ab221dae899123bef08134b7 --- /dev/null +++ b/codenet/public_test_cases/p01560/output.2.txt @@ -0,0 +1 @@ +57.352 diff --git a/codenet/public_test_cases/p01560/output.3.txt b/codenet/public_test_cases/p01560/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b667dbd47cdad9f58b0cc43e4e6b6078c8d41f82 --- /dev/null +++ b/codenet/public_test_cases/p01560/output.3.txt @@ -0,0 +1 @@ +119.9136 diff --git a/codenet/public_test_cases/p01561/input.0.txt b/codenet/public_test_cases/p01561/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b77565ee39685b01a3df439dedb831354119140 --- /dev/null +++ b/codenet/public_test_cases/p01561/input.0.txt @@ -0,0 +1,20 @@ +6 6 +###### +#_|A%# +#B#_|# +#^BBa# +#B&A## +###### +2 +###### +#*|*.# +#.#.|# +#*.**# +#...## +###### +###### +#*|*.# +#*#.|# +#..**# +#..*## +###### diff --git a/codenet/public_test_cases/p01561/input.1.txt b/codenet/public_test_cases/p01561/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..35dc5b6bd07e851afc1a2b3a8a0399c23a481b90 --- /dev/null +++ b/codenet/public_test_cases/p01561/input.1.txt @@ -0,0 +1,19 @@ +6 6 + +_|A%# +B#_|# +^BBa# +B&A## + +2 + +*|*.# +.#.|# +*.**# +...## + + +*|*.# +*#.|# +..**# +..*## diff --git a/codenet/public_test_cases/p01561/input.2.txt b/codenet/public_test_cases/p01561/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd6e3a8794418b545a49d2947fde38fec324e019 --- /dev/null +++ b/codenet/public_test_cases/p01561/input.2.txt @@ -0,0 +1,10 @@ +8 3 + +%||Aa&# + +2 + +*||*..# + + +.||*.*# diff --git a/codenet/public_test_cases/p01561/input.3.txt b/codenet/public_test_cases/p01561/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2e9a92e831cc92ca00ae07776ae40d174013b2a --- /dev/null +++ b/codenet/public_test_cases/p01561/input.3.txt @@ -0,0 +1,7 @@ +3 5 + +%# +^# +&# + +0 diff --git a/codenet/public_test_cases/p01561/input.4.txt b/codenet/public_test_cases/p01561/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1506bfbfbcc26a067e5f82d4337bac0ce503e70a --- /dev/null +++ b/codenet/public_test_cases/p01561/input.4.txt @@ -0,0 +1,6 @@ +3 4 + +%# +&# + +0 diff --git a/codenet/public_test_cases/p01561/input.5.txt b/codenet/public_test_cases/p01561/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b77565ee39685b01a3df439dedb831354119140 --- /dev/null +++ b/codenet/public_test_cases/p01561/input.5.txt @@ -0,0 +1,20 @@ +6 6 +###### +#_|A%# +#B#_|# +#^BBa# +#B&A## +###### +2 +###### +#*|*.# +#.#.|# +#*.**# +#...## +###### +###### +#*|*.# +#*#.|# +#..**# +#..*## +###### diff --git a/codenet/public_test_cases/p01561/output.0.txt b/codenet/public_test_cases/p01561/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p01561/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p01561/output.1.txt b/codenet/public_test_cases/p01561/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p01561/output.1.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p01561/output.2.txt b/codenet/public_test_cases/p01561/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01561/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01561/output.3.txt b/codenet/public_test_cases/p01561/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01561/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01561/output.4.txt b/codenet/public_test_cases/p01561/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01561/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01561/output.5.txt b/codenet/public_test_cases/p01561/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p01561/output.5.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p01562/input.0.txt b/codenet/public_test_cases/p01562/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30af226578b2b66c0224da9cc7437353bc39a71e --- /dev/null +++ b/codenet/public_test_cases/p01562/input.0.txt @@ -0,0 +1,6 @@ +5 +0 0 +1 1 +1 0 +0 1 +0 0 diff --git a/codenet/public_test_cases/p01562/input.1.txt b/codenet/public_test_cases/p01562/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a67fb186a9093cba9417b7cb67d2283ab5fb450 --- /dev/null +++ b/codenet/public_test_cases/p01562/input.1.txt @@ -0,0 +1,6 @@ +5 +0 0 +1 1 +1 0 +0 1 +1 0 diff --git a/codenet/public_test_cases/p01562/input.2.txt b/codenet/public_test_cases/p01562/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9c45dc7a148b5474580559bf57432bda3a28685 --- /dev/null +++ b/codenet/public_test_cases/p01562/input.2.txt @@ -0,0 +1,8 @@ +7 +26 52 +33 12 +-51 68 +16 61 +43 -26 +87 24 +12 10 diff --git a/codenet/public_test_cases/p01562/input.3.txt b/codenet/public_test_cases/p01562/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6c428de4551524d56ddd5c517e05986f93e7ebf --- /dev/null +++ b/codenet/public_test_cases/p01562/input.3.txt @@ -0,0 +1,17 @@ +16 +0 0 +1 0 +1 1 +0 1 +0 2 +0 3 +1 3 +1 2 +2 2 +2 3 +3 3 +3 2 +3 1 +2 1 +2 0 +3 0 diff --git a/codenet/public_test_cases/p01562/input.4.txt b/codenet/public_test_cases/p01562/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..30af226578b2b66c0224da9cc7437353bc39a71e --- /dev/null +++ b/codenet/public_test_cases/p01562/input.4.txt @@ -0,0 +1,6 @@ +5 +0 0 +1 1 +1 0 +0 1 +0 0 diff --git a/codenet/public_test_cases/p01562/input.5.txt b/codenet/public_test_cases/p01562/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5fcd3896c5d4eec55200b724b6b9bcfe75b2950 --- /dev/null +++ b/codenet/public_test_cases/p01562/input.5.txt @@ -0,0 +1,22 @@ +21 +1 1 +-1 1 +-1 2 +-2 2 +-2 1 +-1 1 +-1 -1 +-2 -1 +-2 -2 +-1 -2 +-1 -1 +1 -1 +1 -2 +2 -2 +2 -1 +1 -1 +1 1 +2 1 +2 2 +1 2 +1 1 diff --git a/codenet/public_test_cases/p01562/output.0.txt b/codenet/public_test_cases/p01562/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb3c4fe4eebcdea3da0790cc0ba74cb286ec4f4 --- /dev/null +++ b/codenet/public_test_cases/p01562/output.0.txt @@ -0,0 +1 @@ +0.5 diff --git a/codenet/public_test_cases/p01562/output.1.txt b/codenet/public_test_cases/p01562/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d385d419cc848ee6394256288edbcd8f4f7522a --- /dev/null +++ b/codenet/public_test_cases/p01562/output.1.txt @@ -0,0 +1 @@ +0.25 diff --git a/codenet/public_test_cases/p01562/output.2.txt b/codenet/public_test_cases/p01562/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58393e087c702572e7d5ba4ccebef4f577324827 --- /dev/null +++ b/codenet/public_test_cases/p01562/output.2.txt @@ -0,0 +1 @@ +2714.840579710 diff --git a/codenet/public_test_cases/p01562/output.3.txt b/codenet/public_test_cases/p01562/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01562/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01562/output.4.txt b/codenet/public_test_cases/p01562/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb3c4fe4eebcdea3da0790cc0ba74cb286ec4f4 --- /dev/null +++ b/codenet/public_test_cases/p01562/output.4.txt @@ -0,0 +1 @@ +0.5 diff --git a/codenet/public_test_cases/p01562/output.5.txt b/codenet/public_test_cases/p01562/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01562/output.5.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01563/input.0.txt b/codenet/public_test_cases/p01563/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..205c1ab6f846667bfb882a553e789c7728c1d557 --- /dev/null +++ b/codenet/public_test_cases/p01563/input.0.txt @@ -0,0 +1,3 @@ +2 4 +ACM +ICPC diff --git a/codenet/public_test_cases/p01563/input.1.txt b/codenet/public_test_cases/p01563/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e53bfe7eafdc81420f57e0de53e23c366e20e41e --- /dev/null +++ b/codenet/public_test_cases/p01563/input.1.txt @@ -0,0 +1,5 @@ +4 16 +INTERNATIONAL +COLLEGIATE +PROGRAMMING +CONTEST diff --git a/codenet/public_test_cases/p01563/input.2.txt b/codenet/public_test_cases/p01563/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..205c1ab6f846667bfb882a553e789c7728c1d557 --- /dev/null +++ b/codenet/public_test_cases/p01563/input.2.txt @@ -0,0 +1,3 @@ +2 4 +ACM +ICPC diff --git a/codenet/public_test_cases/p01563/input.3.txt b/codenet/public_test_cases/p01563/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..565ad582b4be8e2bb3ff85f4e5b574937a0d0ac2 --- /dev/null +++ b/codenet/public_test_cases/p01563/input.3.txt @@ -0,0 +1,3 @@ +2 9 +PROBLEMF +CONNECT diff --git a/codenet/public_test_cases/p01563/output.0.txt b/codenet/public_test_cases/p01563/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01563/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01563/output.1.txt b/codenet/public_test_cases/p01563/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p01563/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p01563/output.2.txt b/codenet/public_test_cases/p01563/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01563/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01563/output.3.txt b/codenet/public_test_cases/p01563/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01563/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01564/input.0.txt b/codenet/public_test_cases/p01564/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..df0443926faf6dfe8ac41f26a43932a821cdc188 --- /dev/null +++ b/codenet/public_test_cases/p01564/input.0.txt @@ -0,0 +1,8 @@ +3 4 +1 2 3 +1 2 +2 3 +2 1 3 0 +1 2 2 -4 +2 1 3 0 +2 2 2 0 diff --git a/codenet/public_test_cases/p01564/input.1.txt b/codenet/public_test_cases/p01564/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7796bcc995b3a4a7d35ab0eb71b3033358169d48 --- /dev/null +++ b/codenet/public_test_cases/p01564/input.1.txt @@ -0,0 +1,13 @@ +7 5 +-8 5 5 5 5 5 5 +1 2 +2 3 +1 4 +4 5 +1 6 +6 7 +2 3 7 0 +2 5 2 0 +2 4 3 0 +1 1 1 -1 +2 3 7 0 diff --git a/codenet/public_test_cases/p01564/input.2.txt b/codenet/public_test_cases/p01564/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4c28f12b1054c50a4da01999cd36997b044be0e --- /dev/null +++ b/codenet/public_test_cases/p01564/input.2.txt @@ -0,0 +1,52 @@ +21 30 +10 0 -10 -8 5 -5 -4 -3 1 -2 8 -1 -7 2 7 6 -9 -6 3 4 9 +10 3 +3 2 +3 12 +12 4 +4 13 +4 9 +10 21 +21 1 +1 11 +11 14 +1 15 +10 6 +6 17 +6 16 +6 5 +5 18 +5 19 +10 7 +10 8 +8 20 +1 1 21 -10 +1 3 19 10 +2 1 13 0 +1 4 18 8 +1 5 17 -5 +2 16 7 0 +1 6 16 5 +1 7 15 4 +2 4 20 0 +1 8 14 3 +1 9 13 -1 +2 9 18 0 +1 10 12 2 +1 11 11 -8 +2 21 15 0 +1 12 10 1 +1 13 9 7 +2 6 14 0 +1 14 8 -2 +1 15 7 -7 +2 10 2 0 +1 16 6 -6 +1 17 5 9 +2 12 17 0 +1 18 4 6 +1 19 3 -3 +2 11 8 0 +1 20 2 -4 +1 21 1 -9 +2 5 19 0 diff --git a/codenet/public_test_cases/p01564/input.3.txt b/codenet/public_test_cases/p01564/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..df0443926faf6dfe8ac41f26a43932a821cdc188 --- /dev/null +++ b/codenet/public_test_cases/p01564/input.3.txt @@ -0,0 +1,8 @@ +3 4 +1 2 3 +1 2 +2 3 +2 1 3 0 +1 2 2 -4 +2 1 3 0 +2 2 2 0 diff --git a/codenet/public_test_cases/p01564/output.0.txt b/codenet/public_test_cases/p01564/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f43a16f22a69935dc005050c49caf4ec9ab41f3 --- /dev/null +++ b/codenet/public_test_cases/p01564/output.0.txt @@ -0,0 +1,3 @@ +6 +3 +-4 diff --git a/codenet/public_test_cases/p01564/output.1.txt b/codenet/public_test_cases/p01564/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b3cbea0cccb68de7c7c67c4f937777eca5bbf48 --- /dev/null +++ b/codenet/public_test_cases/p01564/output.1.txt @@ -0,0 +1,4 @@ +12 +10 +10 +19 diff --git a/codenet/public_test_cases/p01564/output.2.txt b/codenet/public_test_cases/p01564/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..886d528bfc0b9b7cdcb0d19cb40e125f71c19746 --- /dev/null +++ b/codenet/public_test_cases/p01564/output.2.txt @@ -0,0 +1,10 @@ +20 +9 +29 +27 +10 +12 +1 +18 +-2 +-3 diff --git a/codenet/public_test_cases/p01564/output.3.txt b/codenet/public_test_cases/p01564/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f43a16f22a69935dc005050c49caf4ec9ab41f3 --- /dev/null +++ b/codenet/public_test_cases/p01564/output.3.txt @@ -0,0 +1,3 @@ +6 +3 +-4 diff --git a/codenet/public_test_cases/p01565/input.0.txt b/codenet/public_test_cases/p01565/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..159f3af0ccc32ed051d15c0d6116623943a604ac --- /dev/null +++ b/codenet/public_test_cases/p01565/input.0.txt @@ -0,0 +1,10 @@ +1 3 ++++ +6 +5 +4 +3 +2 +1 +1 3 +1 1 diff --git a/codenet/public_test_cases/p01565/input.1.txt b/codenet/public_test_cases/p01565/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf1bdce7a644c58fb31834ba0d38f9320942fcbc --- /dev/null +++ b/codenet/public_test_cases/p01565/input.1.txt @@ -0,0 +1,12 @@ +3 3 +->| +..v +.^< +JAG +2012 +SUMMER +HOGE +HOGE +CAMP +1 1 +2 2 diff --git a/codenet/public_test_cases/p01565/input.2.txt b/codenet/public_test_cases/p01565/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..27e12d63de358a073764de215b153d1f70385be3 --- /dev/null +++ b/codenet/public_test_cases/p01565/input.2.txt @@ -0,0 +1,10 @@ +1 3 ++++ +1 +2 +3 +4 +5 +6 +1 3 +1 1 diff --git a/codenet/public_test_cases/p01565/input.3.txt b/codenet/public_test_cases/p01565/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..159f3af0ccc32ed051d15c0d6116623943a604ac --- /dev/null +++ b/codenet/public_test_cases/p01565/input.3.txt @@ -0,0 +1,10 @@ +1 3 ++++ +6 +5 +4 +3 +2 +1 +1 3 +1 1 diff --git a/codenet/public_test_cases/p01565/input.4.txt b/codenet/public_test_cases/p01565/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4955a98f48223b955655285cadcb086239b40ba --- /dev/null +++ b/codenet/public_test_cases/p01565/input.4.txt @@ -0,0 +1,10 @@ +1 3 +... +1 +2 +3 +4 +5 +6 +1 3 +1 1 diff --git a/codenet/public_test_cases/p01565/output.0.txt b/codenet/public_test_cases/p01565/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e1aa32192b67217772ba258842c25eff63c3da2 --- /dev/null +++ b/codenet/public_test_cases/p01565/output.0.txt @@ -0,0 +1 @@ +621 diff --git a/codenet/public_test_cases/p01565/output.1.txt b/codenet/public_test_cases/p01565/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6f05c7db4564b15fcf94577d2524ac1b2420c3d --- /dev/null +++ b/codenet/public_test_cases/p01565/output.1.txt @@ -0,0 +1 @@ +JAGSUMMERCAMP2012JAGSUMMER2012 diff --git a/codenet/public_test_cases/p01565/output.2.txt b/codenet/public_test_cases/p01565/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8b599f5c1f952c74f898f0cb600847542ac4aa1 --- /dev/null +++ b/codenet/public_test_cases/p01565/output.2.txt @@ -0,0 +1 @@ +infinite diff --git a/codenet/public_test_cases/p01565/output.3.txt b/codenet/public_test_cases/p01565/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e1aa32192b67217772ba258842c25eff63c3da2 --- /dev/null +++ b/codenet/public_test_cases/p01565/output.3.txt @@ -0,0 +1 @@ +621 diff --git a/codenet/public_test_cases/p01565/output.4.txt b/codenet/public_test_cases/p01565/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p01565/output.4.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p01566/input.0.txt b/codenet/public_test_cases/p01566/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..179d032b109ac0fd4a62d4694b5d0a08fec3a1e2 --- /dev/null +++ b/codenet/public_test_cases/p01566/input.0.txt @@ -0,0 +1,2 @@ +3 3 +4 2 2 0 0 0 0 0 0 0 0 1 diff --git a/codenet/public_test_cases/p01566/input.1.txt b/codenet/public_test_cases/p01566/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a5f96fa021908b8e4647d730795399da7d549f1 --- /dev/null +++ b/codenet/public_test_cases/p01566/input.1.txt @@ -0,0 +1,2 @@ +3 3 +0 1 1 0 0 0 0 0 0 0 0 7 diff --git a/codenet/public_test_cases/p01566/input.2.txt b/codenet/public_test_cases/p01566/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..83e9ddd00dba74721b6e5031bcb3604fd178085d --- /dev/null +++ b/codenet/public_test_cases/p01566/input.2.txt @@ -0,0 +1,2 @@ +2 4 +0 0 1 1 1 2 0 1 0 0 1 1 diff --git a/codenet/public_test_cases/p01566/input.3.txt b/codenet/public_test_cases/p01566/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5e40a0cd23572ed50d5bc52dbc5d0bd187ddaeb --- /dev/null +++ b/codenet/public_test_cases/p01566/input.3.txt @@ -0,0 +1,2 @@ +3 3 +0 0 0 0 0 0 0 0 0 0 0 10 diff --git a/codenet/public_test_cases/p01566/input.4.txt b/codenet/public_test_cases/p01566/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..179d032b109ac0fd4a62d4694b5d0a08fec3a1e2 --- /dev/null +++ b/codenet/public_test_cases/p01566/input.4.txt @@ -0,0 +1,2 @@ +3 3 +4 2 2 0 0 0 0 0 0 0 0 1 diff --git a/codenet/public_test_cases/p01566/input.5.txt b/codenet/public_test_cases/p01566/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..e264930968f36add27ff91f3e267d0e7c4a16168 --- /dev/null +++ b/codenet/public_test_cases/p01566/input.5.txt @@ -0,0 +1,2 @@ +5 2 +0 1 1 1 0 1 2 1 2 0 0 1 diff --git a/codenet/public_test_cases/p01566/output.0.txt b/codenet/public_test_cases/p01566/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01566/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01566/output.1.txt b/codenet/public_test_cases/p01566/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69a893aa31141827125ddaaee26966b7aed3de74 --- /dev/null +++ b/codenet/public_test_cases/p01566/output.1.txt @@ -0,0 +1 @@ +66 diff --git a/codenet/public_test_cases/p01566/output.2.txt b/codenet/public_test_cases/p01566/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a43b7bf6621a3e17298441fcd441759abe35cb82 --- /dev/null +++ b/codenet/public_test_cases/p01566/output.2.txt @@ -0,0 +1 @@ +2012 diff --git a/codenet/public_test_cases/p01566/output.3.txt b/codenet/public_test_cases/p01566/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01566/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01566/output.4.txt b/codenet/public_test_cases/p01566/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01566/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01566/output.5.txt b/codenet/public_test_cases/p01566/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bbc9494d783fdd3e20c1e1d00aba40f345b7c69 --- /dev/null +++ b/codenet/public_test_cases/p01566/output.5.txt @@ -0,0 +1 @@ +8512 diff --git a/codenet/public_test_cases/p01567/input.0.txt b/codenet/public_test_cases/p01567/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d73b0046ce4b462e95a51aefc5085b94e343a9d --- /dev/null +++ b/codenet/public_test_cases/p01567/input.0.txt @@ -0,0 +1 @@ +((()())(((()())(()()))())) diff --git a/codenet/public_test_cases/p01567/input.1.txt b/codenet/public_test_cases/p01567/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c41a81fc3a0ac16acef6036197b9906e919f003d --- /dev/null +++ b/codenet/public_test_cases/p01567/input.1.txt @@ -0,0 +1 @@ +((()(()()))((()(()()))())) diff --git a/codenet/public_test_cases/p01567/input.2.txt b/codenet/public_test_cases/p01567/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0f3165b01e104673f5c019edbe5b50b3f20125a --- /dev/null +++ b/codenet/public_test_cases/p01567/input.2.txt @@ -0,0 +1 @@ +(()()) diff --git a/codenet/public_test_cases/p01567/input.3.txt b/codenet/public_test_cases/p01567/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f36fed1d268451ef599858c0b1ed816c53271693 --- /dev/null +++ b/codenet/public_test_cases/p01567/input.3.txt @@ -0,0 +1 @@ +(((()())(()()))(()())) diff --git a/codenet/public_test_cases/p01567/input.4.txt b/codenet/public_test_cases/p01567/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d73b0046ce4b462e95a51aefc5085b94e343a9d --- /dev/null +++ b/codenet/public_test_cases/p01567/input.4.txt @@ -0,0 +1 @@ +((()())(((()())(()()))())) diff --git a/codenet/public_test_cases/p01567/output.0.txt b/codenet/public_test_cases/p01567/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01567/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01567/output.1.txt b/codenet/public_test_cases/p01567/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01567/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01567/output.2.txt b/codenet/public_test_cases/p01567/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01567/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01567/output.3.txt b/codenet/public_test_cases/p01567/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01567/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01567/output.4.txt b/codenet/public_test_cases/p01567/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01567/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01568/input.0.txt b/codenet/public_test_cases/p01568/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99f22eb74c8e92a27c92fe4bc5927ddf73916b63 --- /dev/null +++ b/codenet/public_test_cases/p01568/input.0.txt @@ -0,0 +1,6 @@ +1 2 +0 0 10 0 +1 0 +9 0 +0 0 +5 0 diff --git a/codenet/public_test_cases/p01568/input.1.txt b/codenet/public_test_cases/p01568/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6449c4db1f5d5046d81dec1e628df7c363380883 --- /dev/null +++ b/codenet/public_test_cases/p01568/input.1.txt @@ -0,0 +1,6 @@ +2 1 +0 0 0 4 +0 2 2 2 +1 2 +0 1 +0 3 diff --git a/codenet/public_test_cases/p01568/input.2.txt b/codenet/public_test_cases/p01568/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c70273d646db52ed0b44cdba9f6c9e465937bd26 --- /dev/null +++ b/codenet/public_test_cases/p01568/input.2.txt @@ -0,0 +1,11 @@ +5 3 +0 4 2 4 +0 2 2 2 +0 0 2 0 +0 0 0 4 +2 0 2 4 +0 2 +1 0 +2 2 +1 4 +2 1 diff --git a/codenet/public_test_cases/p01568/input.3.txt b/codenet/public_test_cases/p01568/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99f22eb74c8e92a27c92fe4bc5927ddf73916b63 --- /dev/null +++ b/codenet/public_test_cases/p01568/input.3.txt @@ -0,0 +1,6 @@ +1 2 +0 0 10 0 +1 0 +9 0 +0 0 +5 0 diff --git a/codenet/public_test_cases/p01568/output.0.txt b/codenet/public_test_cases/p01568/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd98ee6cb6411dcd240ba4a6b54d71c7f6da23c1 --- /dev/null +++ b/codenet/public_test_cases/p01568/output.0.txt @@ -0,0 +1 @@ +9.0 diff --git a/codenet/public_test_cases/p01568/output.1.txt b/codenet/public_test_cases/p01568/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01568/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01568/output.2.txt b/codenet/public_test_cases/p01568/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f55b2ccb5f234fc6b87ada62389a3d73815d0d1 --- /dev/null +++ b/codenet/public_test_cases/p01568/output.2.txt @@ -0,0 +1 @@ +3.0 diff --git a/codenet/public_test_cases/p01568/output.3.txt b/codenet/public_test_cases/p01568/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd98ee6cb6411dcd240ba4a6b54d71c7f6da23c1 --- /dev/null +++ b/codenet/public_test_cases/p01568/output.3.txt @@ -0,0 +1 @@ +9.0 diff --git a/codenet/public_test_cases/p01569/input.0.txt b/codenet/public_test_cases/p01569/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aedb6abf40a2119de24afef19e16cff1b2827f4c --- /dev/null +++ b/codenet/public_test_cases/p01569/input.0.txt @@ -0,0 +1,10 @@ +9 +2 1 +1 -1 +1 -1 +1 -1 +1 -1 +0 1 +0 1 +0 1 +0 1 diff --git a/codenet/public_test_cases/p01569/input.1.txt b/codenet/public_test_cases/p01569/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..597d05a6b5e2f55cf184ef4499e2c5ef5d62a838 --- /dev/null +++ b/codenet/public_test_cases/p01569/input.1.txt @@ -0,0 +1,3 @@ +2 +1 1 +0 -1 diff --git a/codenet/public_test_cases/p01569/input.2.txt b/codenet/public_test_cases/p01569/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aedb6abf40a2119de24afef19e16cff1b2827f4c --- /dev/null +++ b/codenet/public_test_cases/p01569/input.2.txt @@ -0,0 +1,10 @@ +9 +2 1 +1 -1 +1 -1 +1 -1 +1 -1 +0 1 +0 1 +0 1 +0 1 diff --git a/codenet/public_test_cases/p01569/output.0.txt b/codenet/public_test_cases/p01569/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8163297e8be6c70b86617cd2d2e2c7cfccb68a5e --- /dev/null +++ b/codenet/public_test_cases/p01569/output.0.txt @@ -0,0 +1 @@ +Yes 2 diff --git a/codenet/public_test_cases/p01569/output.1.txt b/codenet/public_test_cases/p01569/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01569/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01569/output.2.txt b/codenet/public_test_cases/p01569/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8163297e8be6c70b86617cd2d2e2c7cfccb68a5e --- /dev/null +++ b/codenet/public_test_cases/p01569/output.2.txt @@ -0,0 +1 @@ +Yes 2 diff --git a/codenet/public_test_cases/p01570/input.0.txt b/codenet/public_test_cases/p01570/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..816a00d2a5d4b3f586f7d2601f02d59a80083ebd --- /dev/null +++ b/codenet/public_test_cases/p01570/input.0.txt @@ -0,0 +1,4 @@ +3 +3 -1 +4 0 +5 0 diff --git a/codenet/public_test_cases/p01570/input.1.txt b/codenet/public_test_cases/p01570/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..816a00d2a5d4b3f586f7d2601f02d59a80083ebd --- /dev/null +++ b/codenet/public_test_cases/p01570/input.1.txt @@ -0,0 +1,4 @@ +3 +3 -1 +4 0 +5 0 diff --git a/codenet/public_test_cases/p01570/input.2.txt b/codenet/public_test_cases/p01570/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8aa08a5a4e11fbeb9c6988a3c4f9fe3b95c83b9 --- /dev/null +++ b/codenet/public_test_cases/p01570/input.2.txt @@ -0,0 +1,4 @@ +3 +10 -1 +10 0 +10 1 diff --git a/codenet/public_test_cases/p01570/input.3.txt b/codenet/public_test_cases/p01570/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9b56d571ea0d67f755b608863afc45906eb4680 --- /dev/null +++ b/codenet/public_test_cases/p01570/input.3.txt @@ -0,0 +1,5 @@ +4 +1 -1 +1 0 +1 1 +1 0 diff --git a/codenet/public_test_cases/p01570/output.0.txt b/codenet/public_test_cases/p01570/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01570/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01570/output.1.txt b/codenet/public_test_cases/p01570/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01570/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01570/output.2.txt b/codenet/public_test_cases/p01570/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01570/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01570/output.3.txt b/codenet/public_test_cases/p01570/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01570/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01571/input.0.txt b/codenet/public_test_cases/p01571/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00782449a3b3a2bf145ffb9406f0559a5a0e7098 --- /dev/null +++ b/codenet/public_test_cases/p01571/input.0.txt @@ -0,0 +1,7 @@ +1 5 +qwerty asdf zxcv +qwert +asf +tyui +zxcvb +ghjk diff --git a/codenet/public_test_cases/p01571/input.1.txt b/codenet/public_test_cases/p01571/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00782449a3b3a2bf145ffb9406f0559a5a0e7098 --- /dev/null +++ b/codenet/public_test_cases/p01571/input.1.txt @@ -0,0 +1,7 @@ +1 5 +qwerty asdf zxcv +qwert +asf +tyui +zxcvb +ghjk diff --git a/codenet/public_test_cases/p01571/output.0.txt b/codenet/public_test_cases/p01571/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01571/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01571/output.1.txt b/codenet/public_test_cases/p01571/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01571/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01572/input.0.txt b/codenet/public_test_cases/p01572/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f03196b689fff57002b4f33d84dd7799d666044 --- /dev/null +++ b/codenet/public_test_cases/p01572/input.0.txt @@ -0,0 +1,2 @@ +2 +8 -1 2 1 2 1 -3 2 -3 2 3 -2 3 -2 -3 -1 -3 diff --git a/codenet/public_test_cases/p01572/input.1.txt b/codenet/public_test_cases/p01572/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f03196b689fff57002b4f33d84dd7799d666044 --- /dev/null +++ b/codenet/public_test_cases/p01572/input.1.txt @@ -0,0 +1,2 @@ +2 +8 -1 2 1 2 1 -3 2 -3 2 3 -2 3 -2 -3 -1 -3 diff --git a/codenet/public_test_cases/p01572/output.0.txt b/codenet/public_test_cases/p01572/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be3438bcc020242363479c4a4ac4c315bdd61403 --- /dev/null +++ b/codenet/public_test_cases/p01572/output.0.txt @@ -0,0 +1 @@ +22.6303 diff --git a/codenet/public_test_cases/p01572/output.1.txt b/codenet/public_test_cases/p01572/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..be3438bcc020242363479c4a4ac4c315bdd61403 --- /dev/null +++ b/codenet/public_test_cases/p01572/output.1.txt @@ -0,0 +1 @@ +22.6303 diff --git a/codenet/public_test_cases/p01573/input.0.txt b/codenet/public_test_cases/p01573/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8ce6e7048a9f1fc56181358e685666810f7a238 --- /dev/null +++ b/codenet/public_test_cases/p01573/input.0.txt @@ -0,0 +1,2 @@ +4 +-2 0 0 0 2 diff --git a/codenet/public_test_cases/p01573/input.1.txt b/codenet/public_test_cases/p01573/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8ce6e7048a9f1fc56181358e685666810f7a238 --- /dev/null +++ b/codenet/public_test_cases/p01573/input.1.txt @@ -0,0 +1,2 @@ +4 +-2 0 0 0 2 diff --git a/codenet/public_test_cases/p01573/input.2.txt b/codenet/public_test_cases/p01573/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ae4e8daa11ea97dfd953ceb7016df2325dedab5 --- /dev/null +++ b/codenet/public_test_cases/p01573/input.2.txt @@ -0,0 +1,2 @@ +8 +0 0 25 15 17 -10 1 -1 1 diff --git a/codenet/public_test_cases/p01573/output.0.txt b/codenet/public_test_cases/p01573/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa5ab1c454c6dec2be67a1a1fce6a0c2bc7fc1d1 --- /dev/null +++ b/codenet/public_test_cases/p01573/output.0.txt @@ -0,0 +1,2 @@ +4 +-1 -i i 1 diff --git a/codenet/public_test_cases/p01573/output.1.txt b/codenet/public_test_cases/p01573/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa5ab1c454c6dec2be67a1a1fce6a0c2bc7fc1d1 --- /dev/null +++ b/codenet/public_test_cases/p01573/output.1.txt @@ -0,0 +1,2 @@ +4 +-1 -i i 1 diff --git a/codenet/public_test_cases/p01573/output.2.txt b/codenet/public_test_cases/p01573/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8fce64aef7a43fbfd17655cc7b8b0abbe409e8f --- /dev/null +++ b/codenet/public_test_cases/p01573/output.2.txt @@ -0,0 +1,2 @@ +5 +-1-2i -1+2i 0 2-i 2+i diff --git a/codenet/public_test_cases/p01574/input.0.txt b/codenet/public_test_cases/p01574/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..437a94acc9755bc9a10bc9cf260007c5fadde474 --- /dev/null +++ b/codenet/public_test_cases/p01574/input.0.txt @@ -0,0 +1,3 @@ +6 2 +2 +5 diff --git a/codenet/public_test_cases/p01574/input.1.txt b/codenet/public_test_cases/p01574/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b0f64d2656348969d15eddf6b8eee8de4b0dfed --- /dev/null +++ b/codenet/public_test_cases/p01574/input.1.txt @@ -0,0 +1,2 @@ +3 1 +1 diff --git a/codenet/public_test_cases/p01574/input.2.txt b/codenet/public_test_cases/p01574/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..437a94acc9755bc9a10bc9cf260007c5fadde474 --- /dev/null +++ b/codenet/public_test_cases/p01574/input.2.txt @@ -0,0 +1,3 @@ +6 2 +2 +5 diff --git a/codenet/public_test_cases/p01574/input.3.txt b/codenet/public_test_cases/p01574/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29ac846ecbcb1e669ca9cc4265db8d4f2693389f --- /dev/null +++ b/codenet/public_test_cases/p01574/input.3.txt @@ -0,0 +1,3 @@ +4 2 +2 +4 diff --git a/codenet/public_test_cases/p01574/output.0.txt b/codenet/public_test_cases/p01574/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01574/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01574/output.1.txt b/codenet/public_test_cases/p01574/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01574/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01574/output.2.txt b/codenet/public_test_cases/p01574/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01574/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01574/output.3.txt b/codenet/public_test_cases/p01574/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01574/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01575/input.0.txt b/codenet/public_test_cases/p01575/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p01575/input.0.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p01575/input.1.txt b/codenet/public_test_cases/p01575/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p01575/input.1.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p01575/input.2.txt b/codenet/public_test_cases/p01575/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac06d91d8aecaaf1ed168da3b63333dfc2e26e6d --- /dev/null +++ b/codenet/public_test_cases/p01575/input.2.txt @@ -0,0 +1 @@ +2 2 1 diff --git a/codenet/public_test_cases/p01575/output.0.txt b/codenet/public_test_cases/p01575/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01575/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01575/output.1.txt b/codenet/public_test_cases/p01575/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01575/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01575/output.2.txt b/codenet/public_test_cases/p01575/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01575/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01576/input.0.txt b/codenet/public_test_cases/p01576/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1aa4ba93302a1ab12aa548c6e1ce6b5e46803bd3 --- /dev/null +++ b/codenet/public_test_cases/p01576/input.0.txt @@ -0,0 +1,6 @@ +5 10 +0 0 +10 10 +20 0 +30 10 +40 0 diff --git a/codenet/public_test_cases/p01576/input.1.txt b/codenet/public_test_cases/p01576/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6824494a5bf534a0a4e598f716e605627c2a7b4a --- /dev/null +++ b/codenet/public_test_cases/p01576/input.1.txt @@ -0,0 +1,3 @@ +2 10 +0 0 +10000 0 diff --git a/codenet/public_test_cases/p01576/input.2.txt b/codenet/public_test_cases/p01576/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7d71c068748c2de3c27bddaef0071d47a741bec --- /dev/null +++ b/codenet/public_test_cases/p01576/input.2.txt @@ -0,0 +1,5 @@ +4 50 +0 10000 +1 10000 +2 0 +10000 0 diff --git a/codenet/public_test_cases/p01576/input.3.txt b/codenet/public_test_cases/p01576/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1aa4ba93302a1ab12aa548c6e1ce6b5e46803bd3 --- /dev/null +++ b/codenet/public_test_cases/p01576/input.3.txt @@ -0,0 +1,6 @@ +5 10 +0 0 +10 10 +20 0 +30 10 +40 0 diff --git a/codenet/public_test_cases/p01576/input.4.txt b/codenet/public_test_cases/p01576/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..95773f8bcad071f2f648b350f782eedfdc32209c --- /dev/null +++ b/codenet/public_test_cases/p01576/input.4.txt @@ -0,0 +1,5 @@ +4 10000 +0 0 +1 1 +9999 0 +10000 10000 diff --git a/codenet/public_test_cases/p01576/output.0.txt b/codenet/public_test_cases/p01576/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..03e392d783aea73463e7b39732d17d3340091ad5 --- /dev/null +++ b/codenet/public_test_cases/p01576/output.0.txt @@ -0,0 +1 @@ +22.22335598 diff --git a/codenet/public_test_cases/p01576/output.1.txt b/codenet/public_test_cases/p01576/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b756f0cf8f9dcf491dba5e82580c90ffeef4359 --- /dev/null +++ b/codenet/public_test_cases/p01576/output.1.txt @@ -0,0 +1 @@ +10000.00000000 diff --git a/codenet/public_test_cases/p01576/output.2.txt b/codenet/public_test_cases/p01576/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f31f3cda27cb275ca809651db8bdde3b6d1c61f --- /dev/null +++ b/codenet/public_test_cases/p01576/output.2.txt @@ -0,0 +1 @@ +7741.23024274 diff --git a/codenet/public_test_cases/p01576/output.3.txt b/codenet/public_test_cases/p01576/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..03e392d783aea73463e7b39732d17d3340091ad5 --- /dev/null +++ b/codenet/public_test_cases/p01576/output.3.txt @@ -0,0 +1 @@ +22.22335598 diff --git a/codenet/public_test_cases/p01576/output.4.txt b/codenet/public_test_cases/p01576/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..21e6f85dca1df289d2a54b71c8cf4be3e4d79006 --- /dev/null +++ b/codenet/public_test_cases/p01576/output.4.txt @@ -0,0 +1 @@ +11.21323169 diff --git a/codenet/public_test_cases/p01577/input.0.txt b/codenet/public_test_cases/p01577/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f442d8b9b51d95430ad2793b95ebe93936b70194 --- /dev/null +++ b/codenet/public_test_cases/p01577/input.0.txt @@ -0,0 +1,6 @@ +5 +2 0 +0 1 +1 3 +4 2 +3 4 diff --git a/codenet/public_test_cases/p01577/input.1.txt b/codenet/public_test_cases/p01577/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0116bee7072b9bc7bb99792d3d7a6aa2533e5c20 --- /dev/null +++ b/codenet/public_test_cases/p01577/input.1.txt @@ -0,0 +1,5 @@ +4 +0 0 +0 3 +1 1 +3 0 diff --git a/codenet/public_test_cases/p01577/input.2.txt b/codenet/public_test_cases/p01577/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f442d8b9b51d95430ad2793b95ebe93936b70194 --- /dev/null +++ b/codenet/public_test_cases/p01577/input.2.txt @@ -0,0 +1,6 @@ +5 +2 0 +0 1 +1 3 +4 2 +3 4 diff --git a/codenet/public_test_cases/p01577/output.0.txt b/codenet/public_test_cases/p01577/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c382960e38796254910dcdfb506d19fcf1685cf4 --- /dev/null +++ b/codenet/public_test_cases/p01577/output.0.txt @@ -0,0 +1 @@ +7.5 diff --git a/codenet/public_test_cases/p01577/output.1.txt b/codenet/public_test_cases/p01577/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f55b2ccb5f234fc6b87ada62389a3d73815d0d1 --- /dev/null +++ b/codenet/public_test_cases/p01577/output.1.txt @@ -0,0 +1 @@ +3.0 diff --git a/codenet/public_test_cases/p01577/output.2.txt b/codenet/public_test_cases/p01577/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c382960e38796254910dcdfb506d19fcf1685cf4 --- /dev/null +++ b/codenet/public_test_cases/p01577/output.2.txt @@ -0,0 +1 @@ +7.5 diff --git a/codenet/public_test_cases/p01578/input.0.txt b/codenet/public_test_cases/p01578/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p01578/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p01578/output.0.txt b/codenet/public_test_cases/p01578/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01578/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01579/input.0.txt b/codenet/public_test_cases/p01579/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7948c169b8028fed66f19c81417e6b6a26b154f3 --- /dev/null +++ b/codenet/public_test_cases/p01579/input.0.txt @@ -0,0 +1 @@ +((()())()) diff --git a/codenet/public_test_cases/p01579/input.1.txt b/codenet/public_test_cases/p01579/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7948c169b8028fed66f19c81417e6b6a26b154f3 --- /dev/null +++ b/codenet/public_test_cases/p01579/input.1.txt @@ -0,0 +1 @@ +((()())()) diff --git a/codenet/public_test_cases/p01579/output.0.txt b/codenet/public_test_cases/p01579/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01579/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01579/output.1.txt b/codenet/public_test_cases/p01579/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01579/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01580/input.0.txt b/codenet/public_test_cases/p01580/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a75515c1d034b0b8ac597e5683e511d4faf4497 --- /dev/null +++ b/codenet/public_test_cases/p01580/input.0.txt @@ -0,0 +1,4 @@ +2 +1 0 0 +0 1 0 +40 diff --git a/codenet/public_test_cases/p01580/output.0.txt b/codenet/public_test_cases/p01580/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01580/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01581/input.1.txt b/codenet/public_test_cases/p01581/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01581/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01581/output.1.txt b/codenet/public_test_cases/p01581/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01581/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01582/input.1.txt b/codenet/public_test_cases/p01582/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01582/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01582/output.1.txt b/codenet/public_test_cases/p01582/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01582/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01584/input.1.txt b/codenet/public_test_cases/p01584/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01584/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01584/output.1.txt b/codenet/public_test_cases/p01584/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01584/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01585/input.1.txt b/codenet/public_test_cases/p01585/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01585/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01585/output.1.txt b/codenet/public_test_cases/p01585/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01585/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01588/input.1.txt b/codenet/public_test_cases/p01588/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01588/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01588/output.1.txt b/codenet/public_test_cases/p01588/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01588/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01589/input.1.txt b/codenet/public_test_cases/p01589/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01589/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01589/output.1.txt b/codenet/public_test_cases/p01589/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01589/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01590/input.1.txt b/codenet/public_test_cases/p01590/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01590/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01590/output.1.txt b/codenet/public_test_cases/p01590/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01590/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01591/input.0.txt b/codenet/public_test_cases/p01591/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6dbeb901ccdb80144b7771a9794d826822547e1 --- /dev/null +++ b/codenet/public_test_cases/p01591/input.0.txt @@ -0,0 +1,5 @@ +4 +0 0 +100 0 +100 100 +0 100 diff --git a/codenet/public_test_cases/p01591/input.1.txt b/codenet/public_test_cases/p01591/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6dbeb901ccdb80144b7771a9794d826822547e1 --- /dev/null +++ b/codenet/public_test_cases/p01591/input.1.txt @@ -0,0 +1,5 @@ +4 +0 0 +100 0 +100 100 +0 100 diff --git a/codenet/public_test_cases/p01591/input.2.txt b/codenet/public_test_cases/p01591/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1786150ad4ef72f0dc239823e4cf53f67feb2031 --- /dev/null +++ b/codenet/public_test_cases/p01591/input.2.txt @@ -0,0 +1,4 @@ +3 +0 0 +10 0 +5 100 diff --git a/codenet/public_test_cases/p01591/output.0.txt b/codenet/public_test_cases/p01591/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d3959d789bf20163af9d4c62f72748f4375f186 --- /dev/null +++ b/codenet/public_test_cases/p01591/output.0.txt @@ -0,0 +1 @@ +-100.000 -100.000 0.000 diff --git a/codenet/public_test_cases/p01591/output.1.txt b/codenet/public_test_cases/p01591/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d3959d789bf20163af9d4c62f72748f4375f186 --- /dev/null +++ b/codenet/public_test_cases/p01591/output.1.txt @@ -0,0 +1 @@ +-100.000 -100.000 0.000 diff --git a/codenet/public_test_cases/p01591/output.2.txt b/codenet/public_test_cases/p01591/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f77bba137469037deafca263e1c7d9b2c52b0486 --- /dev/null +++ b/codenet/public_test_cases/p01591/output.2.txt @@ -0,0 +1 @@ +-10.000 -99.750 0.000 diff --git a/codenet/public_test_cases/p01592/input.0.txt b/codenet/public_test_cases/p01592/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c2442fcc20e13c591c895f87547b150a8f1360a --- /dev/null +++ b/codenet/public_test_cases/p01592/input.0.txt @@ -0,0 +1,2 @@ +1 1 +1 1 diff --git a/codenet/public_test_cases/p01592/input.1.txt b/codenet/public_test_cases/p01592/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c2442fcc20e13c591c895f87547b150a8f1360a --- /dev/null +++ b/codenet/public_test_cases/p01592/input.1.txt @@ -0,0 +1,2 @@ +1 1 +1 1 diff --git a/codenet/public_test_cases/p01592/input.2.txt b/codenet/public_test_cases/p01592/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..49bd53e9e9e30a0a572bcb8f7af2414a91bf8fb9 --- /dev/null +++ b/codenet/public_test_cases/p01592/input.2.txt @@ -0,0 +1,4 @@ +3 3 +3 1 2 3 +1 3 +1 3 diff --git a/codenet/public_test_cases/p01592/output.0.txt b/codenet/public_test_cases/p01592/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p01592/output.0.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p01592/output.1.txt b/codenet/public_test_cases/p01592/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p01592/output.1.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p01592/output.2.txt b/codenet/public_test_cases/p01592/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p01592/output.2.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p01593/input.0.txt b/codenet/public_test_cases/p01593/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p01593/input.0.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p01593/input.1.txt b/codenet/public_test_cases/p01593/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p01593/input.1.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p01593/input.2.txt b/codenet/public_test_cases/p01593/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7a0cd9a94fb04cb3474cbb41495f5afa4827e80 --- /dev/null +++ b/codenet/public_test_cases/p01593/input.2.txt @@ -0,0 +1 @@ +100 50 diff --git a/codenet/public_test_cases/p01593/output.0.txt b/codenet/public_test_cases/p01593/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c132d9d97c017819fb23d51bf1dc8e5942899e2 --- /dev/null +++ b/codenet/public_test_cases/p01593/output.0.txt @@ -0,0 +1 @@ +0.50000000 diff --git a/codenet/public_test_cases/p01593/output.1.txt b/codenet/public_test_cases/p01593/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c132d9d97c017819fb23d51bf1dc8e5942899e2 --- /dev/null +++ b/codenet/public_test_cases/p01593/output.1.txt @@ -0,0 +1 @@ +0.50000000 diff --git a/codenet/public_test_cases/p01593/output.2.txt b/codenet/public_test_cases/p01593/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd33dd5961d124041fa190c21a73e9375b342afe --- /dev/null +++ b/codenet/public_test_cases/p01593/output.2.txt @@ -0,0 +1 @@ +0.31182782 diff --git a/codenet/public_test_cases/p01594/input.0.txt b/codenet/public_test_cases/p01594/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d5d092f984288a74d7799b887b14ba43e2a01ba --- /dev/null +++ b/codenet/public_test_cases/p01594/input.0.txt @@ -0,0 +1,5 @@ +4 +0 0 0 +0 0 1 +0 1 0 +1 0 0 diff --git a/codenet/public_test_cases/p01594/input.1.txt b/codenet/public_test_cases/p01594/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d5d092f984288a74d7799b887b14ba43e2a01ba --- /dev/null +++ b/codenet/public_test_cases/p01594/input.1.txt @@ -0,0 +1,5 @@ +4 +0 0 0 +0 0 1 +0 1 0 +1 0 0 diff --git a/codenet/public_test_cases/p01594/input.2.txt b/codenet/public_test_cases/p01594/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f9e1bb310f5e5637f9fe894e89a6dd0b9186585 --- /dev/null +++ b/codenet/public_test_cases/p01594/input.2.txt @@ -0,0 +1,9 @@ +8 +0 0 0 +0 0 1 +0 1 0 +0 1 1 +1 0 0 +1 0 1 +1 1 0 +1 1 1 diff --git a/codenet/public_test_cases/p01594/output.0.txt b/codenet/public_test_cases/p01594/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0f66d8f52267b32184ed8994f0af17af707beb0 --- /dev/null +++ b/codenet/public_test_cases/p01594/output.0.txt @@ -0,0 +1 @@ +2.366 diff --git a/codenet/public_test_cases/p01594/output.1.txt b/codenet/public_test_cases/p01594/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0f66d8f52267b32184ed8994f0af17af707beb0 --- /dev/null +++ b/codenet/public_test_cases/p01594/output.1.txt @@ -0,0 +1 @@ +2.366 diff --git a/codenet/public_test_cases/p01594/output.2.txt b/codenet/public_test_cases/p01594/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3bbf7f41953302dab4fd6cbe9d615c0e4069263 --- /dev/null +++ b/codenet/public_test_cases/p01594/output.2.txt @@ -0,0 +1 @@ +6.000 diff --git a/codenet/public_test_cases/p01595/input.0.txt b/codenet/public_test_cases/p01595/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..120a2d363f83d69146c073e9c9403d5badc367da --- /dev/null +++ b/codenet/public_test_cases/p01595/input.0.txt @@ -0,0 +1,9 @@ +7 8 +##S#### +#.....# +S.O...# +#.*|..# +L..*..# +#.O*..D +#.@...# +####### diff --git a/codenet/public_test_cases/p01595/input.1.txt b/codenet/public_test_cases/p01595/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51c84cb1d27524862a58afc6bdb3e031b59603c4 --- /dev/null +++ b/codenet/public_test_cases/p01595/input.1.txt @@ -0,0 +1,4 @@ +8 3 +L#### +S.../@.# +D# diff --git a/codenet/public_test_cases/p01595/input.2.txt b/codenet/public_test_cases/p01595/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef9ead268a08865793da2eb8e0eddc230d055411 --- /dev/null +++ b/codenet/public_test_cases/p01595/input.2.txt @@ -0,0 +1,4 @@ +8 3 +L##### +S...@.# +D# diff --git a/codenet/public_test_cases/p01595/input.3.txt b/codenet/public_test_cases/p01595/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..120a2d363f83d69146c073e9c9403d5badc367da --- /dev/null +++ b/codenet/public_test_cases/p01595/input.3.txt @@ -0,0 +1,9 @@ +7 8 +##S#### +#.....# +S.O...# +#.*|..# +L..*..# +#.O*..D +#.@...# +####### diff --git a/codenet/public_test_cases/p01595/input.4.txt b/codenet/public_test_cases/p01595/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4799a9923c1e37053f100e0ecd6c0eddcc75b408 --- /dev/null +++ b/codenet/public_test_cases/p01595/input.4.txt @@ -0,0 +1,8 @@ +7 8 +S#### +.....# +S.O...# +.*|..# +L..*..# +.O*..D +.@...# diff --git a/codenet/public_test_cases/p01595/output.0.txt b/codenet/public_test_cases/p01595/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01595/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01595/output.1.txt b/codenet/public_test_cases/p01595/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01595/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01595/output.2.txt b/codenet/public_test_cases/p01595/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01595/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01595/output.3.txt b/codenet/public_test_cases/p01595/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01595/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01595/output.4.txt b/codenet/public_test_cases/p01595/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01595/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01596/input.0.txt b/codenet/public_test_cases/p01596/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a408a5ac32ce6beb09c70608b7129e3a71c198d --- /dev/null +++ b/codenet/public_test_cases/p01596/input.0.txt @@ -0,0 +1,6 @@ +5 +0 1 0 2 +1 3 2 3 +2 2 1 2 +1 1 2 1 +2 0 1 0 diff --git a/codenet/public_test_cases/p01596/input.1.txt b/codenet/public_test_cases/p01596/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a408a5ac32ce6beb09c70608b7129e3a71c198d --- /dev/null +++ b/codenet/public_test_cases/p01596/input.1.txt @@ -0,0 +1,6 @@ +5 +0 1 0 2 +1 3 2 3 +2 2 1 2 +1 1 2 1 +2 0 1 0 diff --git a/codenet/public_test_cases/p01596/input.2.txt b/codenet/public_test_cases/p01596/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9170182788d779cde0c77de2b3df0c1d837f0b92 --- /dev/null +++ b/codenet/public_test_cases/p01596/input.2.txt @@ -0,0 +1,13 @@ +12 +4 5 4 6 +3 7 1 7 +0 8 0 10 +1 11 3 11 +4 10 4 9 +5 8 99 8 +100 7 100 4 +99 3 4 3 +3 2 3 1 +2 0 1 0 +0 1 0 3 +1 4 3 4 diff --git a/codenet/public_test_cases/p01596/output.0.txt b/codenet/public_test_cases/p01596/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3dba6b3eaeb76fb36f603372d172fc51cc79371f --- /dev/null +++ b/codenet/public_test_cases/p01596/output.0.txt @@ -0,0 +1 @@ +9.712 diff --git a/codenet/public_test_cases/p01596/output.1.txt b/codenet/public_test_cases/p01596/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3dba6b3eaeb76fb36f603372d172fc51cc79371f --- /dev/null +++ b/codenet/public_test_cases/p01596/output.1.txt @@ -0,0 +1 @@ +9.712 diff --git a/codenet/public_test_cases/p01596/output.2.txt b/codenet/public_test_cases/p01596/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..32aed9f8bb20f279d314dfa3820fd0852ae0705c --- /dev/null +++ b/codenet/public_test_cases/p01596/output.2.txt @@ -0,0 +1 @@ +27.406 diff --git a/codenet/public_test_cases/p01597/input.0.txt b/codenet/public_test_cases/p01597/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..def3e35c68a225ba69f493f0a4e519928feac169 --- /dev/null +++ b/codenet/public_test_cases/p01597/input.0.txt @@ -0,0 +1,5 @@ +4 +0 0 2 1 +3 0 4 2 +0 2 1 4 +2 3 4 4 diff --git a/codenet/public_test_cases/p01597/input.1.txt b/codenet/public_test_cases/p01597/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d1b0a53bd58ab14d702bf5681526c946ff26ab6 --- /dev/null +++ b/codenet/public_test_cases/p01597/input.1.txt @@ -0,0 +1,9 @@ +8 +0 0 2 1 +2 2 4 3 +5 3 7 4 +7 5 9 6 +0 2 1 4 +2 4 3 6 +6 0 7 2 +8 2 9 4 diff --git a/codenet/public_test_cases/p01597/input.2.txt b/codenet/public_test_cases/p01597/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..def3e35c68a225ba69f493f0a4e519928feac169 --- /dev/null +++ b/codenet/public_test_cases/p01597/input.2.txt @@ -0,0 +1,5 @@ +4 +0 0 2 1 +3 0 4 2 +0 2 1 4 +2 3 4 4 diff --git a/codenet/public_test_cases/p01597/output.0.txt b/codenet/public_test_cases/p01597/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01597/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01597/output.1.txt b/codenet/public_test_cases/p01597/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01597/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01597/output.2.txt b/codenet/public_test_cases/p01597/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01597/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01598/input.0.txt b/codenet/public_test_cases/p01598/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c64dbe20bc4435429eb1ad860c41c49675dc5c45 --- /dev/null +++ b/codenet/public_test_cases/p01598/input.0.txt @@ -0,0 +1,4 @@ +4 4 +1 3 4 2 +1 4 2 3 +1 3 2 4 diff --git a/codenet/public_test_cases/p01598/output.0.txt b/codenet/public_test_cases/p01598/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01598/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01599/input.0.txt b/codenet/public_test_cases/p01599/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e28907ce06df6c00e3175bf6a7150ad69765dda --- /dev/null +++ b/codenet/public_test_cases/p01599/input.0.txt @@ -0,0 +1,3 @@ +1 1 +10 100 0 +10 100 0 diff --git a/codenet/public_test_cases/p01599/input.1.txt b/codenet/public_test_cases/p01599/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..47ca5cc00c7cf28579f64ff45b1bc30623220f0e --- /dev/null +++ b/codenet/public_test_cases/p01599/input.1.txt @@ -0,0 +1,11 @@ +5 5 +10 0 100 +10 200 300 +10 400 500 +10 600 700 +10 800 900 +10 100 200 +10 300 400 +10 500 600 +10 700 800 +10 900 1000 diff --git a/codenet/public_test_cases/p01599/input.2.txt b/codenet/public_test_cases/p01599/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e28907ce06df6c00e3175bf6a7150ad69765dda --- /dev/null +++ b/codenet/public_test_cases/p01599/input.2.txt @@ -0,0 +1,3 @@ +1 1 +10 100 0 +10 100 0 diff --git a/codenet/public_test_cases/p01599/output.0.txt b/codenet/public_test_cases/p01599/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01599/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01599/output.1.txt b/codenet/public_test_cases/p01599/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01599/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01599/output.2.txt b/codenet/public_test_cases/p01599/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01599/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01600/input.0.txt b/codenet/public_test_cases/p01600/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2072965c94828c89f81d4a943e80f619638dd658 --- /dev/null +++ b/codenet/public_test_cases/p01600/input.0.txt @@ -0,0 +1,6 @@ +5 +1 5 +2 4 +3 3 +4 2 +5 1 diff --git a/codenet/public_test_cases/p01600/input.1.txt b/codenet/public_test_cases/p01600/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2072965c94828c89f81d4a943e80f619638dd658 --- /dev/null +++ b/codenet/public_test_cases/p01600/input.1.txt @@ -0,0 +1,6 @@ +5 +1 5 +2 4 +3 3 +4 2 +5 1 diff --git a/codenet/public_test_cases/p01600/input.2.txt b/codenet/public_test_cases/p01600/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed1390a2e73865afda263505dd50936749804e8 --- /dev/null +++ b/codenet/public_test_cases/p01600/input.2.txt @@ -0,0 +1,2 @@ +1 +10000 0 diff --git a/codenet/public_test_cases/p01600/output.0.txt b/codenet/public_test_cases/p01600/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p01600/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p01600/output.1.txt b/codenet/public_test_cases/p01600/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p01600/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p01600/output.2.txt b/codenet/public_test_cases/p01600/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01600/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01601/input.0.txt b/codenet/public_test_cases/p01601/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p01601/input.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p01601/input.1.txt b/codenet/public_test_cases/p01601/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p01601/input.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p01601/input.2.txt b/codenet/public_test_cases/p01601/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe4afb0df8641d6de901cdde04199e4507534d0d --- /dev/null +++ b/codenet/public_test_cases/p01601/input.2.txt @@ -0,0 +1 @@ +106 diff --git a/codenet/public_test_cases/p01601/input.3.txt b/codenet/public_test_cases/p01601/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c811106baec2018adc3a5ec2c92d55c23007f742 --- /dev/null +++ b/codenet/public_test_cases/p01601/input.3.txt @@ -0,0 +1 @@ +7447 diff --git a/codenet/public_test_cases/p01601/output.0.txt b/codenet/public_test_cases/p01601/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01601/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01601/output.1.txt b/codenet/public_test_cases/p01601/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01601/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01601/output.2.txt b/codenet/public_test_cases/p01601/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..398050c62c882fa5ebc8d8aaa2e730e70790beeb --- /dev/null +++ b/codenet/public_test_cases/p01601/output.2.txt @@ -0,0 +1 @@ +101 diff --git a/codenet/public_test_cases/p01601/output.3.txt b/codenet/public_test_cases/p01601/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c811106baec2018adc3a5ec2c92d55c23007f742 --- /dev/null +++ b/codenet/public_test_cases/p01601/output.3.txt @@ -0,0 +1 @@ +7447 diff --git a/codenet/public_test_cases/p01602/input.0.txt b/codenet/public_test_cases/p01602/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e454f65e8692c56cbede4e548b36240b46ced268 --- /dev/null +++ b/codenet/public_test_cases/p01602/input.0.txt @@ -0,0 +1,4 @@ +3 +( 5 +) 4 +) 1 diff --git a/codenet/public_test_cases/p01602/input.1.txt b/codenet/public_test_cases/p01602/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8e6633e214613d634be5df0a3da39ae7a215553 --- /dev/null +++ b/codenet/public_test_cases/p01602/input.1.txt @@ -0,0 +1,3 @@ +2 +) 1 +( 1 diff --git a/codenet/public_test_cases/p01602/input.2.txt b/codenet/public_test_cases/p01602/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e454f65e8692c56cbede4e548b36240b46ced268 --- /dev/null +++ b/codenet/public_test_cases/p01602/input.2.txt @@ -0,0 +1,4 @@ +3 +( 5 +) 4 +) 1 diff --git a/codenet/public_test_cases/p01602/input.3.txt b/codenet/public_test_cases/p01602/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ff01f8d1b660f3ceec013112ec55a541fced44f --- /dev/null +++ b/codenet/public_test_cases/p01602/input.3.txt @@ -0,0 +1,6 @@ +5 +( 2 +) 2 +( 3 +) 1 +) 2 diff --git a/codenet/public_test_cases/p01602/output.0.txt b/codenet/public_test_cases/p01602/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01602/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01602/output.1.txt b/codenet/public_test_cases/p01602/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p01602/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p01602/output.2.txt b/codenet/public_test_cases/p01602/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01602/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01602/output.3.txt b/codenet/public_test_cases/p01602/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01602/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01603/input.0.txt b/codenet/public_test_cases/p01603/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..091411f899efc002c7e973b230322d065d2ca355 --- /dev/null +++ b/codenet/public_test_cases/p01603/input.0.txt @@ -0,0 +1,4 @@ +4 5 +1 2 1 4 7 +2 3 1 2 77 +2 4 1 2 777 diff --git a/codenet/public_test_cases/p01603/input.1.txt b/codenet/public_test_cases/p01603/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dac25ddd66bc5edf7c765399dde64ad78ea8ab10 --- /dev/null +++ b/codenet/public_test_cases/p01603/input.1.txt @@ -0,0 +1,2 @@ +2 10000 +1 2 1 10 1 diff --git a/codenet/public_test_cases/p01603/input.2.txt b/codenet/public_test_cases/p01603/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..091411f899efc002c7e973b230322d065d2ca355 --- /dev/null +++ b/codenet/public_test_cases/p01603/input.2.txt @@ -0,0 +1,4 @@ +4 5 +1 2 1 4 7 +2 3 1 2 77 +2 4 1 2 777 diff --git a/codenet/public_test_cases/p01603/input.3.txt b/codenet/public_test_cases/p01603/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..089e9334ffd371f4124d690f11b2532bc435ba8c --- /dev/null +++ b/codenet/public_test_cases/p01603/input.3.txt @@ -0,0 +1,5 @@ +5 15 +1 2 3 2 1 +2 3 3 2 1 +1 4 8 2 777 +1 5 1 3 10 diff --git a/codenet/public_test_cases/p01603/output.0.txt b/codenet/public_test_cases/p01603/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c631e1e4ce7e5243d19cb698b655ab771aeeead --- /dev/null +++ b/codenet/public_test_cases/p01603/output.0.txt @@ -0,0 +1 @@ +1568 diff --git a/codenet/public_test_cases/p01603/output.1.txt b/codenet/public_test_cases/p01603/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01603/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01603/output.2.txt b/codenet/public_test_cases/p01603/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c631e1e4ce7e5243d19cb698b655ab771aeeead --- /dev/null +++ b/codenet/public_test_cases/p01603/output.2.txt @@ -0,0 +1 @@ +1568 diff --git a/codenet/public_test_cases/p01603/output.3.txt b/codenet/public_test_cases/p01603/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p01603/output.3.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p01604/input.0.txt b/codenet/public_test_cases/p01604/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..46a0c77bac3c57cec5054a33eea821de3060949a --- /dev/null +++ b/codenet/public_test_cases/p01604/input.0.txt @@ -0,0 +1,3 @@ +2 +LOOP: +goto LOOP; diff --git a/codenet/public_test_cases/p01604/output.0.txt b/codenet/public_test_cases/p01604/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01604/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01605/input.0.txt b/codenet/public_test_cases/p01605/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13b5a918a723a04bcad563c84f8436dfa3af7a0e --- /dev/null +++ b/codenet/public_test_cases/p01605/input.0.txt @@ -0,0 +1,5 @@ +abaz +3 1 5 +a cab +b . +c x diff --git a/codenet/public_test_cases/p01605/input.1.txt b/codenet/public_test_cases/p01605/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db91b04b80ac4a2140679b0d417ac4d6bde9f1cf --- /dev/null +++ b/codenet/public_test_cases/p01605/input.1.txt @@ -0,0 +1,4 @@ +aaaa +2 1 1 +a . +a nothing diff --git a/codenet/public_test_cases/p01605/input.2.txt b/codenet/public_test_cases/p01605/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab36b13795e239006b43f7cb929c0d980a9ad225 --- /dev/null +++ b/codenet/public_test_cases/p01605/input.2.txt @@ -0,0 +1,3 @@ +original +1 2 5 +x notchange diff --git a/codenet/public_test_cases/p01605/input.3.txt b/codenet/public_test_cases/p01605/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..13b5a918a723a04bcad563c84f8436dfa3af7a0e --- /dev/null +++ b/codenet/public_test_cases/p01605/input.3.txt @@ -0,0 +1,5 @@ +abaz +3 1 5 +a cab +b . +c x diff --git a/codenet/public_test_cases/p01605/output.0.txt b/codenet/public_test_cases/p01605/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0aa5afd0e2d22e6f18aebd1712c88034a77f63d5 --- /dev/null +++ b/codenet/public_test_cases/p01605/output.0.txt @@ -0,0 +1 @@ +xaxaz diff --git a/codenet/public_test_cases/p01605/output.1.txt b/codenet/public_test_cases/p01605/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c558e357c41674e39880abb6c3209e539de42e2 --- /dev/null +++ b/codenet/public_test_cases/p01605/output.1.txt @@ -0,0 +1 @@ +. diff --git a/codenet/public_test_cases/p01605/output.2.txt b/codenet/public_test_cases/p01605/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfe23822668cb04e0c258ae530d14caf2ab2833f --- /dev/null +++ b/codenet/public_test_cases/p01605/output.2.txt @@ -0,0 +1 @@ +rigi diff --git a/codenet/public_test_cases/p01605/output.3.txt b/codenet/public_test_cases/p01605/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0aa5afd0e2d22e6f18aebd1712c88034a77f63d5 --- /dev/null +++ b/codenet/public_test_cases/p01605/output.3.txt @@ -0,0 +1 @@ +xaxaz diff --git a/codenet/public_test_cases/p01606/input.0.txt b/codenet/public_test_cases/p01606/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd64ae0403c3dcbf893963e75f433dbfad8230bb --- /dev/null +++ b/codenet/public_test_cases/p01606/input.0.txt @@ -0,0 +1 @@ +10 2 diff --git a/codenet/public_test_cases/p01606/input.1.txt b/codenet/public_test_cases/p01606/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd64ae0403c3dcbf893963e75f433dbfad8230bb --- /dev/null +++ b/codenet/public_test_cases/p01606/input.1.txt @@ -0,0 +1 @@ +10 2 diff --git a/codenet/public_test_cases/p01606/input.2.txt b/codenet/public_test_cases/p01606/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..352175128355e309922ea78d873061472882116d --- /dev/null +++ b/codenet/public_test_cases/p01606/input.2.txt @@ -0,0 +1 @@ +30 7 diff --git a/codenet/public_test_cases/p01606/output.0.txt b/codenet/public_test_cases/p01606/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd48cc0b0a0539ef6205e54eba1264cd7062a6ae --- /dev/null +++ b/codenet/public_test_cases/p01606/output.0.txt @@ -0,0 +1 @@ +2 3 3 3 3 3 3 3 3 diff --git a/codenet/public_test_cases/p01606/output.1.txt b/codenet/public_test_cases/p01606/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd48cc0b0a0539ef6205e54eba1264cd7062a6ae --- /dev/null +++ b/codenet/public_test_cases/p01606/output.1.txt @@ -0,0 +1 @@ +2 3 3 3 3 3 3 3 3 diff --git a/codenet/public_test_cases/p01606/output.2.txt b/codenet/public_test_cases/p01606/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e33b675d365d6347a7381de78d94103c6895dfa2 --- /dev/null +++ b/codenet/public_test_cases/p01606/output.2.txt @@ -0,0 +1 @@ +7 8 9 10 10 11 11 11 11 12 11 12 10 12 12 11 10 12 12 12 10 11 11 13 diff --git a/codenet/public_test_cases/p01607/input.0.txt b/codenet/public_test_cases/p01607/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d87faa96d2c57069e879f51ea5133aeebb86fb38 --- /dev/null +++ b/codenet/public_test_cases/p01607/input.0.txt @@ -0,0 +1,4 @@ +3 1 +0 0 +1 0 +0 1 diff --git a/codenet/public_test_cases/p01607/input.1.txt b/codenet/public_test_cases/p01607/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51e987d7d89b71395864fc44d6f3868fbd45e819 --- /dev/null +++ b/codenet/public_test_cases/p01607/input.1.txt @@ -0,0 +1,5 @@ +4 3 +1 1 +-1 1 +-1 -1 +1 -1 diff --git a/codenet/public_test_cases/p01607/input.2.txt b/codenet/public_test_cases/p01607/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d87faa96d2c57069e879f51ea5133aeebb86fb38 --- /dev/null +++ b/codenet/public_test_cases/p01607/input.2.txt @@ -0,0 +1,4 @@ +3 1 +0 0 +1 0 +0 1 diff --git a/codenet/public_test_cases/p01607/input.3.txt b/codenet/public_test_cases/p01607/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff0abbdf48f2ca0dd6d16417b9ba94e2e298ebff --- /dev/null +++ b/codenet/public_test_cases/p01607/input.3.txt @@ -0,0 +1,4 @@ +3 2 +0 0 +2 0 +0 2 diff --git a/codenet/public_test_cases/p01607/input.4.txt b/codenet/public_test_cases/p01607/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..691b6cbf517ab92b1aed05ac185a82b352c887b6 --- /dev/null +++ b/codenet/public_test_cases/p01607/input.4.txt @@ -0,0 +1,4 @@ +3 2 +1 -1 +1 1 +-2 0 diff --git a/codenet/public_test_cases/p01607/output.0.txt b/codenet/public_test_cases/p01607/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9168c21f4617d88740b21e342ab47d3e9ffad30 --- /dev/null +++ b/codenet/public_test_cases/p01607/output.0.txt @@ -0,0 +1 @@ +0.500000000 diff --git a/codenet/public_test_cases/p01607/output.1.txt b/codenet/public_test_cases/p01607/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..336e09985b1da5af1920eb5dd3836a7acdb0973e --- /dev/null +++ b/codenet/public_test_cases/p01607/output.1.txt @@ -0,0 +1 @@ +11.707963268 diff --git a/codenet/public_test_cases/p01607/output.2.txt b/codenet/public_test_cases/p01607/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9168c21f4617d88740b21e342ab47d3e9ffad30 --- /dev/null +++ b/codenet/public_test_cases/p01607/output.2.txt @@ -0,0 +1 @@ +0.500000000 diff --git a/codenet/public_test_cases/p01607/output.3.txt b/codenet/public_test_cases/p01607/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b322c5abfee4922723254e593f32ab0d788c31f8 --- /dev/null +++ b/codenet/public_test_cases/p01607/output.3.txt @@ -0,0 +1 @@ +8.995574288 diff --git a/codenet/public_test_cases/p01607/output.4.txt b/codenet/public_test_cases/p01607/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b95afafb4b4ac423d5f18462c4f768ec5754b2d --- /dev/null +++ b/codenet/public_test_cases/p01607/output.4.txt @@ -0,0 +1 @@ +11.123246567 diff --git a/codenet/public_test_cases/p01608/input.0.txt b/codenet/public_test_cases/p01608/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e14b248525231018a52035761a7b11c1db41ef83 --- /dev/null +++ b/codenet/public_test_cases/p01608/input.0.txt @@ -0,0 +1,3 @@ +4 1 +3 1 2 7 +13 8 25 9 diff --git a/codenet/public_test_cases/p01608/input.1.txt b/codenet/public_test_cases/p01608/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e14b248525231018a52035761a7b11c1db41ef83 --- /dev/null +++ b/codenet/public_test_cases/p01608/input.1.txt @@ -0,0 +1,3 @@ +4 1 +3 1 2 7 +13 8 25 9 diff --git a/codenet/public_test_cases/p01608/input.2.txt b/codenet/public_test_cases/p01608/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a9162f0c5c413321fe7292ab48cac4faf51bae9 --- /dev/null +++ b/codenet/public_test_cases/p01608/input.2.txt @@ -0,0 +1,3 @@ +2 1 +1 1 +3 3 diff --git a/codenet/public_test_cases/p01608/output.0.txt b/codenet/public_test_cases/p01608/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd11724042e28f013e4fee09715b24c1b9ab10d1 --- /dev/null +++ b/codenet/public_test_cases/p01608/output.0.txt @@ -0,0 +1 @@ +1001 diff --git a/codenet/public_test_cases/p01608/output.1.txt b/codenet/public_test_cases/p01608/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd11724042e28f013e4fee09715b24c1b9ab10d1 --- /dev/null +++ b/codenet/public_test_cases/p01608/output.1.txt @@ -0,0 +1 @@ +1001 diff --git a/codenet/public_test_cases/p01608/output.2.txt b/codenet/public_test_cases/p01608/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01608/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01609/input.0.txt b/codenet/public_test_cases/p01609/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..79a454c6eba3267f14d3f137a8c1fdf0405e83c1 --- /dev/null +++ b/codenet/public_test_cases/p01609/input.0.txt @@ -0,0 +1,2 @@ +20 20 1 +-1 10 10 diff --git a/codenet/public_test_cases/p01609/input.1.txt b/codenet/public_test_cases/p01609/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..66d0aaae2ba8e517707f59dea934e56cef40617e --- /dev/null +++ b/codenet/public_test_cases/p01609/input.1.txt @@ -0,0 +1,3 @@ +20 20 2 +-1 10 10 +-2 10 5 diff --git a/codenet/public_test_cases/p01609/input.2.txt b/codenet/public_test_cases/p01609/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab65429c2bf7e36cc33539e57a7aca7cc4e2fb8d --- /dev/null +++ b/codenet/public_test_cases/p01609/input.2.txt @@ -0,0 +1,3 @@ +15 100 2 +-2 5 100 +-2 10 100 diff --git a/codenet/public_test_cases/p01609/input.3.txt b/codenet/public_test_cases/p01609/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..79a454c6eba3267f14d3f137a8c1fdf0405e83c1 --- /dev/null +++ b/codenet/public_test_cases/p01609/input.3.txt @@ -0,0 +1,2 @@ +20 20 1 +-1 10 10 diff --git a/codenet/public_test_cases/p01609/output.0.txt b/codenet/public_test_cases/p01609/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4405a37cc8a5d5959029ddc7c1fb67f506fb23f5 --- /dev/null +++ b/codenet/public_test_cases/p01609/output.0.txt @@ -0,0 +1 @@ +21.520346288593280 diff --git a/codenet/public_test_cases/p01609/output.1.txt b/codenet/public_test_cases/p01609/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4405a37cc8a5d5959029ddc7c1fb67f506fb23f5 --- /dev/null +++ b/codenet/public_test_cases/p01609/output.1.txt @@ -0,0 +1 @@ +21.520346288593280 diff --git a/codenet/public_test_cases/p01609/output.2.txt b/codenet/public_test_cases/p01609/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..890605da46dcf686a09615949dc26d7a0b71ceb2 --- /dev/null +++ b/codenet/public_test_cases/p01609/output.2.txt @@ -0,0 +1 @@ +126.921542730127873 diff --git a/codenet/public_test_cases/p01609/output.3.txt b/codenet/public_test_cases/p01609/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4405a37cc8a5d5959029ddc7c1fb67f506fb23f5 --- /dev/null +++ b/codenet/public_test_cases/p01609/output.3.txt @@ -0,0 +1 @@ +21.520346288593280 diff --git a/codenet/public_test_cases/p01610/input.0.txt b/codenet/public_test_cases/p01610/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..331bae08fb73b73f95252c1cf434d8b2b3a01d4b --- /dev/null +++ b/codenet/public_test_cases/p01610/input.0.txt @@ -0,0 +1 @@ +R diff --git a/codenet/public_test_cases/p01610/output.0.txt b/codenet/public_test_cases/p01610/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd972584ecafe130bcce0c9a57d319249c027853 --- /dev/null +++ b/codenet/public_test_cases/p01610/output.0.txt @@ -0,0 +1,6 @@ +..ry.... +..ry.... +ggyobbrw +ggyobbrw +..ow.... +..ow.... diff --git a/codenet/public_test_cases/p01611/input.0.txt b/codenet/public_test_cases/p01611/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63fea00a0baecb5b5935c4270dea3a1a23548388 --- /dev/null +++ b/codenet/public_test_cases/p01611/input.0.txt @@ -0,0 +1,4 @@ +3 4 2 +2 +1 +3 diff --git a/codenet/public_test_cases/p01611/input.1.txt b/codenet/public_test_cases/p01611/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63fea00a0baecb5b5935c4270dea3a1a23548388 --- /dev/null +++ b/codenet/public_test_cases/p01611/input.1.txt @@ -0,0 +1,4 @@ +3 4 2 +2 +1 +3 diff --git a/codenet/public_test_cases/p01611/input.2.txt b/codenet/public_test_cases/p01611/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd2a92ed9fbe6def32b6bc5cf4e680a409a1371f --- /dev/null +++ b/codenet/public_test_cases/p01611/input.2.txt @@ -0,0 +1,19 @@ +18 26 10275802967 +10 +14 +9 +13 +7 +8 +2 +6 +11 +18 +12 +1 +4 +3 +16 +5 +17 +15 diff --git a/codenet/public_test_cases/p01611/output.0.txt b/codenet/public_test_cases/p01611/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..67be85f1274474029aad8a75b823592324305aa4 --- /dev/null +++ b/codenet/public_test_cases/p01611/output.0.txt @@ -0,0 +1 @@ +bad diff --git a/codenet/public_test_cases/p01611/output.1.txt b/codenet/public_test_cases/p01611/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67be85f1274474029aad8a75b823592324305aa4 --- /dev/null +++ b/codenet/public_test_cases/p01611/output.1.txt @@ -0,0 +1 @@ +bad diff --git a/codenet/public_test_cases/p01611/output.2.txt b/codenet/public_test_cases/p01611/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9ce8cd15250ea8876f2f81d3e18706e209c6c5d --- /dev/null +++ b/codenet/public_test_cases/p01611/output.2.txt @@ -0,0 +1 @@ +ritsumeicampdaytwo diff --git a/codenet/public_test_cases/p01612/input.0.txt b/codenet/public_test_cases/p01612/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..528e7ebad4042345b98253344ec4487010139594 --- /dev/null +++ b/codenet/public_test_cases/p01612/input.0.txt @@ -0,0 +1,5 @@ +5 4 +1 2 +2 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p01612/input.1.txt b/codenet/public_test_cases/p01612/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..528e7ebad4042345b98253344ec4487010139594 --- /dev/null +++ b/codenet/public_test_cases/p01612/input.1.txt @@ -0,0 +1,5 @@ +5 4 +1 2 +2 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p01612/output.0.txt b/codenet/public_test_cases/p01612/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p01612/output.0.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p01612/output.1.txt b/codenet/public_test_cases/p01612/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p01612/output.1.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p01620/input.0.txt b/codenet/public_test_cases/p01620/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66162f903c603ebeb2e2763b2cdf2ef24949a510 --- /dev/null +++ b/codenet/public_test_cases/p01620/input.0.txt @@ -0,0 +1,10 @@ +2 +1 2 +bdd +3 +3 2 1 +DDDA +5 +3 1 4 5 3 +dcdkIlkP +0 diff --git a/codenet/public_test_cases/p01620/input.1.txt b/codenet/public_test_cases/p01620/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..66162f903c603ebeb2e2763b2cdf2ef24949a510 --- /dev/null +++ b/codenet/public_test_cases/p01620/input.1.txt @@ -0,0 +1,10 @@ +2 +1 2 +bdd +3 +3 2 1 +DDDA +5 +3 1 4 5 3 +dcdkIlkP +0 diff --git a/codenet/public_test_cases/p01620/output.0.txt b/codenet/public_test_cases/p01620/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f79fa84b4fe8f32f6964e4f173d4d8e5363e508 --- /dev/null +++ b/codenet/public_test_cases/p01620/output.0.txt @@ -0,0 +1,3 @@ +abc +ABCx +abZfFijL diff --git a/codenet/public_test_cases/p01620/output.1.txt b/codenet/public_test_cases/p01620/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f79fa84b4fe8f32f6964e4f173d4d8e5363e508 --- /dev/null +++ b/codenet/public_test_cases/p01620/output.1.txt @@ -0,0 +1,3 @@ +abc +ABCx +abZfFijL diff --git a/codenet/public_test_cases/p01621/input.0.txt b/codenet/public_test_cases/p01621/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81eb7fe6126b37a7cefe0e06fecf1dd9c325a1bf --- /dev/null +++ b/codenet/public_test_cases/p01621/input.0.txt @@ -0,0 +1,5 @@ +1 1 3 All All 1 1 +2 37 5 All Night 150 1 +16 2 20 All Day 5 10 +1 14 15 Mon All 20000 100 +0 0 0 None None 0 0 diff --git a/codenet/public_test_cases/p01621/input.1.txt b/codenet/public_test_cases/p01621/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81eb7fe6126b37a7cefe0e06fecf1dd9c325a1bf --- /dev/null +++ b/codenet/public_test_cases/p01621/input.1.txt @@ -0,0 +1,5 @@ +1 1 3 All All 1 1 +2 37 5 All Night 150 1 +16 2 20 All Day 5 10 +1 14 15 Mon All 20000 100 +0 0 0 None None 0 0 diff --git a/codenet/public_test_cases/p01621/output.0.txt b/codenet/public_test_cases/p01621/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..03ed970eb93525b33de10e54b02ccd46c3c8b6b1 --- /dev/null +++ b/codenet/public_test_cases/p01621/output.0.txt @@ -0,0 +1,4 @@ +1.0000000000 +0.2192439716 +0.9884707850 +0.0649933899 diff --git a/codenet/public_test_cases/p01621/output.1.txt b/codenet/public_test_cases/p01621/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03ed970eb93525b33de10e54b02ccd46c3c8b6b1 --- /dev/null +++ b/codenet/public_test_cases/p01621/output.1.txt @@ -0,0 +1,4 @@ +1.0000000000 +0.2192439716 +0.9884707850 +0.0649933899 diff --git a/codenet/public_test_cases/p01622/input.0.txt b/codenet/public_test_cases/p01622/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6d834b543c470ac13849aa06e076c8381b83b13 --- /dev/null +++ b/codenet/public_test_cases/p01622/input.0.txt @@ -0,0 +1,30 @@ +4 +1 1 +3 1 +4 1 +2 1 +3 +5 3 +1 2 +1 2 +1 +1000 1000 +10 +5 62 +10 68 +15 72 +20 73 +25 75 +30 77 +35 79 +40 82 +45 100 +815 283 +6 +74 78 +53 55 +77 77 +12 13 +39 42 +1 1 +0 diff --git a/codenet/public_test_cases/p01622/input.1.txt b/codenet/public_test_cases/p01622/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6d834b543c470ac13849aa06e076c8381b83b13 --- /dev/null +++ b/codenet/public_test_cases/p01622/input.1.txt @@ -0,0 +1,30 @@ +4 +1 1 +3 1 +4 1 +2 1 +3 +5 3 +1 2 +1 2 +1 +1000 1000 +10 +5 62 +10 68 +15 72 +20 73 +25 75 +30 77 +35 79 +40 82 +45 100 +815 283 +6 +74 78 +53 55 +77 77 +12 13 +39 42 +1 1 +0 diff --git a/codenet/public_test_cases/p01622/output.0.txt b/codenet/public_test_cases/p01622/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce2ffb988025629bd736df1eccd411640632ab91 --- /dev/null +++ b/codenet/public_test_cases/p01622/output.0.txt @@ -0,0 +1,5 @@ +14 +15 +3000 +2013 +522 diff --git a/codenet/public_test_cases/p01622/output.1.txt b/codenet/public_test_cases/p01622/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce2ffb988025629bd736df1eccd411640632ab91 --- /dev/null +++ b/codenet/public_test_cases/p01622/output.1.txt @@ -0,0 +1,5 @@ +14 +15 +3000 +2013 +522 diff --git a/codenet/public_test_cases/p01624/input.0.txt b/codenet/public_test_cases/p01624/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..464072893806725388e632ae1fba257afd244221 --- /dev/null +++ b/codenet/public_test_cases/p01624/input.0.txt @@ -0,0 +1,7 @@ +1 1 +2 2 +3 1+2*3-4 +3 1|2^3&4 +3 (1+2)*3 +3 1-1-1-1 +0 # diff --git a/codenet/public_test_cases/p01624/input.1.txt b/codenet/public_test_cases/p01624/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..464072893806725388e632ae1fba257afd244221 --- /dev/null +++ b/codenet/public_test_cases/p01624/input.1.txt @@ -0,0 +1,7 @@ +1 1 +2 2 +3 1+2*3-4 +3 1|2^3&4 +3 (1+2)*3 +3 1-1-1-1 +0 # diff --git a/codenet/public_test_cases/p01624/output.0.txt b/codenet/public_test_cases/p01624/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75898b83a644330a5f0c6b554321c26882ef3aa5 --- /dev/null +++ b/codenet/public_test_cases/p01624/output.0.txt @@ -0,0 +1,6 @@ +91 +2 +273 +93 +279 +88 diff --git a/codenet/public_test_cases/p01624/output.1.txt b/codenet/public_test_cases/p01624/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75898b83a644330a5f0c6b554321c26882ef3aa5 --- /dev/null +++ b/codenet/public_test_cases/p01624/output.1.txt @@ -0,0 +1,6 @@ +91 +2 +273 +93 +279 +88 diff --git a/codenet/public_test_cases/p01625/input.0.txt b/codenet/public_test_cases/p01625/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4df346941c727cebcaa7efbda3dfa70a75f56c62 --- /dev/null +++ b/codenet/public_test_cases/p01625/input.0.txt @@ -0,0 +1,29 @@ +3 +2 3 2 2 2 1 +2 0 1 -1 2 -1 +-2 -1 -1 -1 -2 0 +6 +-1 0 1 0 0 -1 +-2 -1 -3 -2 -4 -2 +2 -1 2 0 1 -1 +4 -2 3 -2 3 -1 +1 1 0 1 -1 1 +-3 -1 -1 -1 -2 0 +5 +-1 2 0 2 1 2 +-3 1 -2 1 -2 2 +-2 0 -2 -1 -3 0 +1 -1 0 -1 -1 -1 +1 0 2 0 2 -1 +4 +-2 0 -2 -1 -3 -1 +-1 -1 0 -1 1 -1 +2 -1 2 0 3 -1 +-1 0 0 0 1 0 +5 +-2 1 3 -1 2 1 +-5 2 -5 3 -4 2 +-2 -1 0 -1 -3 -1 +4 2 5 2 5 3 +1 -1 2 -1 -1 -1 +0 diff --git a/codenet/public_test_cases/p01625/input.1.txt b/codenet/public_test_cases/p01625/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4df346941c727cebcaa7efbda3dfa70a75f56c62 --- /dev/null +++ b/codenet/public_test_cases/p01625/input.1.txt @@ -0,0 +1,29 @@ +3 +2 3 2 2 2 1 +2 0 1 -1 2 -1 +-2 -1 -1 -1 -2 0 +6 +-1 0 1 0 0 -1 +-2 -1 -3 -2 -4 -2 +2 -1 2 0 1 -1 +4 -2 3 -2 3 -1 +1 1 0 1 -1 1 +-3 -1 -1 -1 -2 0 +5 +-1 2 0 2 1 2 +-3 1 -2 1 -2 2 +-2 0 -2 -1 -3 0 +1 -1 0 -1 -1 -1 +1 0 2 0 2 -1 +4 +-2 0 -2 -1 -3 -1 +-1 -1 0 -1 1 -1 +2 -1 2 0 3 -1 +-1 0 0 0 1 0 +5 +-2 1 3 -1 2 1 +-5 2 -5 3 -4 2 +-2 -1 0 -1 -3 -1 +4 2 5 2 5 3 +1 -1 2 -1 -1 -1 +0 diff --git a/codenet/public_test_cases/p01625/output.0.txt b/codenet/public_test_cases/p01625/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9c0782e22fa3c8276d8bd139a1e822dadbca497 --- /dev/null +++ b/codenet/public_test_cases/p01625/output.0.txt @@ -0,0 +1,12 @@ +Remove +1 +Remove +2 +6 +Valid +Remove +1 +2 +3 +4 +Invalid diff --git a/codenet/public_test_cases/p01625/output.1.txt b/codenet/public_test_cases/p01625/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9c0782e22fa3c8276d8bd139a1e822dadbca497 --- /dev/null +++ b/codenet/public_test_cases/p01625/output.1.txt @@ -0,0 +1,12 @@ +Remove +1 +Remove +2 +6 +Valid +Remove +1 +2 +3 +4 +Invalid diff --git a/codenet/public_test_cases/p01626/input.0.txt b/codenet/public_test_cases/p01626/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56cc415a076ede80d993e22fcf7072361408a17a --- /dev/null +++ b/codenet/public_test_cases/p01626/input.0.txt @@ -0,0 +1,52 @@ +2 +3 +1 1 +2 2 +1 2 +3 +-1 1 +-1 2 +-2 2 +1 1 2 2 +0 0 0 1 +2 +10 +1 1 +7 1 +7 5 +5 5 +5 3 +6 3 +6 2 +3 2 +3 5 +1 5 +10 +-1 1 +-1 5 +-3 5 +-3 3 +-2 3 +-2 2 +-5 2 +-5 5 +-7 5 +-7 1 +2 4 6 4 +0 0 0 1 +2 +7 +-7 0 +-5 0 +-4 3 +-3 0 +-1 0 +-1 4 +-7 4 +3 +1 0 +7 0 +7 4 +3 1 5 2 +0 0 0 1 +0 diff --git a/codenet/public_test_cases/p01626/input.1.txt b/codenet/public_test_cases/p01626/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..56cc415a076ede80d993e22fcf7072361408a17a --- /dev/null +++ b/codenet/public_test_cases/p01626/input.1.txt @@ -0,0 +1,52 @@ +2 +3 +1 1 +2 2 +1 2 +3 +-1 1 +-1 2 +-2 2 +1 1 2 2 +0 0 0 1 +2 +10 +1 1 +7 1 +7 5 +5 5 +5 3 +6 3 +6 2 +3 2 +3 5 +1 5 +10 +-1 1 +-1 5 +-3 5 +-3 3 +-2 3 +-2 2 +-5 2 +-5 5 +-7 5 +-7 1 +2 4 6 4 +0 0 0 1 +2 +7 +-7 0 +-5 0 +-4 3 +-3 0 +-1 0 +-1 4 +-7 4 +3 +1 0 +7 0 +7 4 +3 1 5 2 +0 0 0 1 +0 diff --git a/codenet/public_test_cases/p01626/output.0.txt b/codenet/public_test_cases/p01626/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b84e3310b05c7b39e60fb2cb119e36ac3d24f52 --- /dev/null +++ b/codenet/public_test_cases/p01626/output.0.txt @@ -0,0 +1,3 @@ +1.4142135623730951 +8.0 +impossible diff --git a/codenet/public_test_cases/p01626/output.1.txt b/codenet/public_test_cases/p01626/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b84e3310b05c7b39e60fb2cb119e36ac3d24f52 --- /dev/null +++ b/codenet/public_test_cases/p01626/output.1.txt @@ -0,0 +1,3 @@ +1.4142135623730951 +8.0 +impossible diff --git a/codenet/public_test_cases/p01627/input.0.txt b/codenet/public_test_cases/p01627/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81ee72763d758c25b8544bf5c2b13e73ce7788c3 --- /dev/null +++ b/codenet/public_test_cases/p01627/input.0.txt @@ -0,0 +1,5 @@ +N T +st_time1 st_name1 ar_time1 ar_name1 +st_time2 st_name2 ar_time2 ar_name2 +... +st_timeN st_nameN ar_timeN ar_nameN diff --git a/codenet/public_test_cases/p01627/input.1.txt b/codenet/public_test_cases/p01627/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11464547313cbadd8322c812e837472f86c677fc --- /dev/null +++ b/codenet/public_test_cases/p01627/input.1.txt @@ -0,0 +1,9 @@ +8 24 +05:30 Kyoto 06:37 Maibara +06:50 Maibara 07:36 Tsuruga +07:42 Tsuruga 10:03 Kanazawa +10:58 Kanazawa 12:07 Toyama +12:15 Toyama 14:12 Naoetsu +14:29 Naoetsu 15:57 Nagaoka +16:11 Nagaoka 17:14 Niitsu +17:38 Niitsu 20:06 AizuWakamatsu diff --git a/codenet/public_test_cases/p01627/input.2.txt b/codenet/public_test_cases/p01627/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..81ee72763d758c25b8544bf5c2b13e73ce7788c3 --- /dev/null +++ b/codenet/public_test_cases/p01627/input.2.txt @@ -0,0 +1,5 @@ +N T +st_time1 st_name1 ar_time1 ar_name1 +st_time2 st_name2 ar_time2 ar_name2 +... +st_timeN st_nameN ar_timeN ar_nameN diff --git a/codenet/public_test_cases/p01627/input.3.txt b/codenet/public_test_cases/p01627/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c35346ec4ad4cfdae52c9a1353765e50d5cd5229 --- /dev/null +++ b/codenet/public_test_cases/p01627/input.3.txt @@ -0,0 +1,2 @@ +1 180 +10:44 Koriyama 11:52 AizuWakamatsu diff --git a/codenet/public_test_cases/p01627/output.0.txt b/codenet/public_test_cases/p01627/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc8d354aaa4240b52844b69ba461f5c6aa196022 --- /dev/null +++ b/codenet/public_test_cases/p01627/output.0.txt @@ -0,0 +1,3 @@ +2 +Kanazawa 55 +Niitsu 24 diff --git a/codenet/public_test_cases/p01627/output.1.txt b/codenet/public_test_cases/p01627/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc8d354aaa4240b52844b69ba461f5c6aa196022 --- /dev/null +++ b/codenet/public_test_cases/p01627/output.1.txt @@ -0,0 +1,3 @@ +2 +Kanazawa 55 +Niitsu 24 diff --git a/codenet/public_test_cases/p01627/output.2.txt b/codenet/public_test_cases/p01627/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc8d354aaa4240b52844b69ba461f5c6aa196022 --- /dev/null +++ b/codenet/public_test_cases/p01627/output.2.txt @@ -0,0 +1,3 @@ +2 +Kanazawa 55 +Niitsu 24 diff --git a/codenet/public_test_cases/p01627/output.3.txt b/codenet/public_test_cases/p01627/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01627/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01628/input.0.txt b/codenet/public_test_cases/p01628/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e87350bea3702e10b6820f6e82b64dc6138ced90 --- /dev/null +++ b/codenet/public_test_cases/p01628/input.0.txt @@ -0,0 +1,5 @@ +5 4 +4 +3 +1 +2 diff --git a/codenet/public_test_cases/p01628/input.1.txt b/codenet/public_test_cases/p01628/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e87350bea3702e10b6820f6e82b64dc6138ced90 --- /dev/null +++ b/codenet/public_test_cases/p01628/input.1.txt @@ -0,0 +1,5 @@ +5 4 +4 +3 +1 +2 diff --git a/codenet/public_test_cases/p01628/input.2.txt b/codenet/public_test_cases/p01628/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c8f712b21c51c471449bd1cd6688a705666e9b9 --- /dev/null +++ b/codenet/public_test_cases/p01628/input.2.txt @@ -0,0 +1,4 @@ +4 3 +1 +2 +3 diff --git a/codenet/public_test_cases/p01628/output.0.txt b/codenet/public_test_cases/p01628/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01628/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01628/output.1.txt b/codenet/public_test_cases/p01628/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01628/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01628/output.2.txt b/codenet/public_test_cases/p01628/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01628/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01629/input.0.txt b/codenet/public_test_cases/p01629/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe82bd2044bc3af9caec45aeaf9cc7b8be1a0994 --- /dev/null +++ b/codenet/public_test_cases/p01629/input.0.txt @@ -0,0 +1,3 @@ +2 3 +3000 6000 3000 +4000 5500 4500 diff --git a/codenet/public_test_cases/p01629/input.1.txt b/codenet/public_test_cases/p01629/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7aed639b4e7eea153d60cbd1e780ca4d226b888e --- /dev/null +++ b/codenet/public_test_cases/p01629/input.1.txt @@ -0,0 +1,4 @@ +3 4 +5500 5500 5500 5500 +5480 5780 5980 5980 +5500 5500 5500 5500 diff --git a/codenet/public_test_cases/p01629/input.2.txt b/codenet/public_test_cases/p01629/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe82bd2044bc3af9caec45aeaf9cc7b8be1a0994 --- /dev/null +++ b/codenet/public_test_cases/p01629/input.2.txt @@ -0,0 +1,3 @@ +2 3 +3000 6000 3000 +4000 5500 4500 diff --git a/codenet/public_test_cases/p01629/output.0.txt b/codenet/public_test_cases/p01629/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cfafda41f778b3b9f1cf2b52f6949df3684c66f --- /dev/null +++ b/codenet/public_test_cases/p01629/output.0.txt @@ -0,0 +1,4 @@ +11500 2 +1 +2 +1 diff --git a/codenet/public_test_cases/p01629/output.1.txt b/codenet/public_test_cases/p01629/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d2a7b47004556351162cfa3e60bca5bda8e9a27 --- /dev/null +++ b/codenet/public_test_cases/p01629/output.1.txt @@ -0,0 +1,5 @@ +21980 1 +2 +1 +1 +1 diff --git a/codenet/public_test_cases/p01629/output.2.txt b/codenet/public_test_cases/p01629/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cfafda41f778b3b9f1cf2b52f6949df3684c66f --- /dev/null +++ b/codenet/public_test_cases/p01629/output.2.txt @@ -0,0 +1,4 @@ +11500 2 +1 +2 +1 diff --git a/codenet/public_test_cases/p01630/input.0.txt b/codenet/public_test_cases/p01630/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb123cbc61e1547c640601a3ab1ee11dc62fad8b --- /dev/null +++ b/codenet/public_test_cases/p01630/input.0.txt @@ -0,0 +1,2 @@ +N +bit_line diff --git a/codenet/public_test_cases/p01630/input.1.txt b/codenet/public_test_cases/p01630/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4042c5240d86722207f8f4635f4d524f147d740 --- /dev/null +++ b/codenet/public_test_cases/p01630/input.1.txt @@ -0,0 +1,2 @@ +2 +0000 diff --git a/codenet/public_test_cases/p01630/input.2.txt b/codenet/public_test_cases/p01630/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..23b029a3e1c498fee17fd50bd3d0e55721671df6 --- /dev/null +++ b/codenet/public_test_cases/p01630/input.2.txt @@ -0,0 +1,2 @@ +5 +11110101011100110010111100010001 diff --git a/codenet/public_test_cases/p01630/input.3.txt b/codenet/public_test_cases/p01630/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..811e334b8bcce31ce6a340efe479c93e3cef8d9a --- /dev/null +++ b/codenet/public_test_cases/p01630/input.3.txt @@ -0,0 +1,2 @@ +3 +01100110 diff --git a/codenet/public_test_cases/p01630/input.4.txt b/codenet/public_test_cases/p01630/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa95c46a8374663443a2b42d0b4eec95f18da335 --- /dev/null +++ b/codenet/public_test_cases/p01630/input.4.txt @@ -0,0 +1,2 @@ +2 +0110 diff --git a/codenet/public_test_cases/p01630/input.5.txt b/codenet/public_test_cases/p01630/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb123cbc61e1547c640601a3ab1ee11dc62fad8b --- /dev/null +++ b/codenet/public_test_cases/p01630/input.5.txt @@ -0,0 +1,2 @@ +N +bit_line diff --git a/codenet/public_test_cases/p01630/output.0.txt b/codenet/public_test_cases/p01630/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01630/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01630/output.1.txt b/codenet/public_test_cases/p01630/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01630/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01630/output.2.txt b/codenet/public_test_cases/p01630/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p01630/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p01630/output.3.txt b/codenet/public_test_cases/p01630/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01630/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01630/output.4.txt b/codenet/public_test_cases/p01630/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01630/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01630/output.5.txt b/codenet/public_test_cases/p01630/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01630/output.5.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01631/input.0.txt b/codenet/public_test_cases/p01631/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..47eb1f6962bc83d4eed64f60b6bec0d4aa28aa6b --- /dev/null +++ b/codenet/public_test_cases/p01631/input.0.txt @@ -0,0 +1,12 @@ +6 +AIZU 10 +LINER 6 +LINE 4 +ALL 2 +AS 1 +CIEL 10 +ASLA +CILI +IRZN +ELEU +21 diff --git a/codenet/public_test_cases/p01631/input.1.txt b/codenet/public_test_cases/p01631/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..47eb1f6962bc83d4eed64f60b6bec0d4aa28aa6b --- /dev/null +++ b/codenet/public_test_cases/p01631/input.1.txt @@ -0,0 +1,12 @@ +6 +AIZU 10 +LINER 6 +LINE 4 +ALL 2 +AS 1 +CIEL 10 +ASLA +CILI +IRZN +ELEU +21 diff --git a/codenet/public_test_cases/p01631/output.0.txt b/codenet/public_test_cases/p01631/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p01631/output.0.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p01631/output.1.txt b/codenet/public_test_cases/p01631/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p01631/output.1.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p01632/input.0.txt b/codenet/public_test_cases/p01632/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..57b9c358b596a57fe065011680d481a8d16e7691 --- /dev/null +++ b/codenet/public_test_cases/p01632/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01632/input.1.txt b/codenet/public_test_cases/p01632/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57b9c358b596a57fe065011680d481a8d16e7691 --- /dev/null +++ b/codenet/public_test_cases/p01632/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01632/input.2.txt b/codenet/public_test_cases/p01632/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8b7e712cd363a91a7e70ed9d0d1df2aa0312b12 --- /dev/null +++ b/codenet/public_test_cases/p01632/input.2.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 3 +2 4 +3 4 diff --git a/codenet/public_test_cases/p01632/output.0.txt b/codenet/public_test_cases/p01632/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..464d18dabd8db5efc162bbdc98b6fbe51d6d78dc --- /dev/null +++ b/codenet/public_test_cases/p01632/output.0.txt @@ -0,0 +1,3 @@ +No +No +Yes diff --git a/codenet/public_test_cases/p01632/output.1.txt b/codenet/public_test_cases/p01632/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..464d18dabd8db5efc162bbdc98b6fbe51d6d78dc --- /dev/null +++ b/codenet/public_test_cases/p01632/output.1.txt @@ -0,0 +1,3 @@ +No +No +Yes diff --git a/codenet/public_test_cases/p01632/output.2.txt b/codenet/public_test_cases/p01632/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b58086fb8f5b53616ec3f311d3aef86624abd037 --- /dev/null +++ b/codenet/public_test_cases/p01632/output.2.txt @@ -0,0 +1,4 @@ +No +No +No +No diff --git a/codenet/public_test_cases/p01633/input.0.txt b/codenet/public_test_cases/p01633/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..742727b1366c968e5fef9df5a876db521cb1891c --- /dev/null +++ b/codenet/public_test_cases/p01633/input.0.txt @@ -0,0 +1,9 @@ +8 +5 0 5 10 +5 10 0 5 +0 5 5 0 +10 0 10 10 +10 10 5 5 +5 5 10 0 +10 2 15 5 +15 5 10 8 diff --git a/codenet/public_test_cases/p01633/input.1.txt b/codenet/public_test_cases/p01633/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97675be7453b99587d1e6e4d9c6c3ae19386c21c --- /dev/null +++ b/codenet/public_test_cases/p01633/input.1.txt @@ -0,0 +1,12 @@ +11 +0 0 10 0 +10 0 10 10 +10 10 0 10 +0 10 0 0 +1 2 9 2 +8 1 8 9 +9 8 1 8 +2 9 2 1 +8 11 11 8 +8 11 14 10 +11 8 10 14 diff --git a/codenet/public_test_cases/p01633/input.2.txt b/codenet/public_test_cases/p01633/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..742727b1366c968e5fef9df5a876db521cb1891c --- /dev/null +++ b/codenet/public_test_cases/p01633/input.2.txt @@ -0,0 +1,9 @@ +8 +5 0 5 10 +5 10 0 5 +0 5 5 0 +10 0 10 10 +10 10 5 5 +5 5 10 0 +10 2 15 5 +15 5 10 8 diff --git a/codenet/public_test_cases/p01633/output.0.txt b/codenet/public_test_cases/p01633/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01633/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01633/output.1.txt b/codenet/public_test_cases/p01633/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01633/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01633/output.2.txt b/codenet/public_test_cases/p01633/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01633/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01634/input.0.txt b/codenet/public_test_cases/p01634/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3097ab13082b70f67202aab7dd9d1b35b7ceac2 --- /dev/null +++ b/codenet/public_test_cases/p01634/input.0.txt @@ -0,0 +1 @@ +password diff --git a/codenet/public_test_cases/p01634/input.1.txt b/codenet/public_test_cases/p01634/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3097ab13082b70f67202aab7dd9d1b35b7ceac2 --- /dev/null +++ b/codenet/public_test_cases/p01634/input.1.txt @@ -0,0 +1 @@ +password diff --git a/codenet/public_test_cases/p01634/output.0.txt b/codenet/public_test_cases/p01634/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e420fe4d295c56f1421cd40965e9634958f984cf --- /dev/null +++ b/codenet/public_test_cases/p01634/output.0.txt @@ -0,0 +1 @@ +INVALID diff --git a/codenet/public_test_cases/p01634/output.1.txt b/codenet/public_test_cases/p01634/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e420fe4d295c56f1421cd40965e9634958f984cf --- /dev/null +++ b/codenet/public_test_cases/p01634/output.1.txt @@ -0,0 +1 @@ +INVALID diff --git a/codenet/public_test_cases/p01635/input.0.txt b/codenet/public_test_cases/p01635/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8345d47bc06bebb01a142a7fa6e0b191735df64 --- /dev/null +++ b/codenet/public_test_cases/p01635/input.0.txt @@ -0,0 +1,2 @@ +n T +f(n) diff --git a/codenet/public_test_cases/p01635/input.1.txt b/codenet/public_test_cases/p01635/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8345d47bc06bebb01a142a7fa6e0b191735df64 --- /dev/null +++ b/codenet/public_test_cases/p01635/input.1.txt @@ -0,0 +1,2 @@ +n T +f(n) diff --git a/codenet/public_test_cases/p01635/output.0.txt b/codenet/public_test_cases/p01635/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f82a3d5e99787cec6e8803490ff3a46cf84ae37c --- /dev/null +++ b/codenet/public_test_cases/p01635/output.0.txt @@ -0,0 +1 @@ +101010000 diff --git a/codenet/public_test_cases/p01635/output.1.txt b/codenet/public_test_cases/p01635/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f82a3d5e99787cec6e8803490ff3a46cf84ae37c --- /dev/null +++ b/codenet/public_test_cases/p01635/output.1.txt @@ -0,0 +1 @@ +101010000 diff --git a/codenet/public_test_cases/p01636/input.0.txt b/codenet/public_test_cases/p01636/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p01636/input.0.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p01636/input.1.txt b/codenet/public_test_cases/p01636/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p01636/input.1.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p01636/output.0.txt b/codenet/public_test_cases/p01636/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01636/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01636/output.1.txt b/codenet/public_test_cases/p01636/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01636/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01637/input.0.txt b/codenet/public_test_cases/p01637/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e2027b94cfc4d5424d54d0088d7c59b43bc63f0 --- /dev/null +++ b/codenet/public_test_cases/p01637/input.0.txt @@ -0,0 +1 @@ +M r diff --git a/codenet/public_test_cases/p01637/input.1.txt b/codenet/public_test_cases/p01637/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e2027b94cfc4d5424d54d0088d7c59b43bc63f0 --- /dev/null +++ b/codenet/public_test_cases/p01637/input.1.txt @@ -0,0 +1 @@ +M r diff --git a/codenet/public_test_cases/p01637/output.0.txt b/codenet/public_test_cases/p01637/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ac4d4ff91d271451cecf96c5cee4b4317525175 --- /dev/null +++ b/codenet/public_test_cases/p01637/output.0.txt @@ -0,0 +1 @@ +9333 diff --git a/codenet/public_test_cases/p01637/output.1.txt b/codenet/public_test_cases/p01637/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ac4d4ff91d271451cecf96c5cee4b4317525175 --- /dev/null +++ b/codenet/public_test_cases/p01637/output.1.txt @@ -0,0 +1 @@ +9333 diff --git a/codenet/public_test_cases/p01638/input.0.txt b/codenet/public_test_cases/p01638/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..627effef2e1fed0ee1c7654cf84d53e0682da5ae --- /dev/null +++ b/codenet/public_test_cases/p01638/input.0.txt @@ -0,0 +1,2 @@ +r x y n +p diff --git a/codenet/public_test_cases/p01638/input.1.txt b/codenet/public_test_cases/p01638/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..627effef2e1fed0ee1c7654cf84d53e0682da5ae --- /dev/null +++ b/codenet/public_test_cases/p01638/input.1.txt @@ -0,0 +1,2 @@ +r x y n +p diff --git a/codenet/public_test_cases/p01638/output.0.txt b/codenet/public_test_cases/p01638/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2de7b4da7aec3113f20b48a2ea046afc58041380 --- /dev/null +++ b/codenet/public_test_cases/p01638/output.0.txt @@ -0,0 +1 @@ +71 156 diff --git a/codenet/public_test_cases/p01638/output.1.txt b/codenet/public_test_cases/p01638/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2de7b4da7aec3113f20b48a2ea046afc58041380 --- /dev/null +++ b/codenet/public_test_cases/p01638/output.1.txt @@ -0,0 +1 @@ +71 156 diff --git a/codenet/public_test_cases/p01639/input.0.txt b/codenet/public_test_cases/p01639/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca040fc48fe165651aad1b84a27d26514a5e144e --- /dev/null +++ b/codenet/public_test_cases/p01639/input.0.txt @@ -0,0 +1 @@ +n k x0 diff --git a/codenet/public_test_cases/p01639/output.0.txt b/codenet/public_test_cases/p01639/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d566f49bc436e438c4d26a807898304be3a0cdc6 --- /dev/null +++ b/codenet/public_test_cases/p01639/output.0.txt @@ -0,0 +1 @@ +-768720241707614171 diff --git a/codenet/public_test_cases/p01640/input.0.txt b/codenet/public_test_cases/p01640/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74484187f63166e6880baabbb081e1fd4743c85f --- /dev/null +++ b/codenet/public_test_cases/p01640/input.0.txt @@ -0,0 +1 @@ +w h g diff --git a/codenet/public_test_cases/p01640/input.1.txt b/codenet/public_test_cases/p01640/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74484187f63166e6880baabbb081e1fd4743c85f --- /dev/null +++ b/codenet/public_test_cases/p01640/input.1.txt @@ -0,0 +1 @@ +w h g diff --git a/codenet/public_test_cases/p01640/output.0.txt b/codenet/public_test_cases/p01640/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01640/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01640/output.1.txt b/codenet/public_test_cases/p01640/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01640/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01641/input.0.txt b/codenet/public_test_cases/p01641/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p01641/input.0.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p01641/input.1.txt b/codenet/public_test_cases/p01641/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p01641/input.1.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p01641/output.0.txt b/codenet/public_test_cases/p01641/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..759febcd8a5d75e37cf9ac5cd0899579c3979480 --- /dev/null +++ b/codenet/public_test_cases/p01641/output.0.txt @@ -0,0 +1 @@ +++++++++[>++++++++<-]>+.+.+. diff --git a/codenet/public_test_cases/p01641/output.1.txt b/codenet/public_test_cases/p01641/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..759febcd8a5d75e37cf9ac5cd0899579c3979480 --- /dev/null +++ b/codenet/public_test_cases/p01641/output.1.txt @@ -0,0 +1 @@ +++++++++[>++++++++<-]>+.+.+. diff --git a/codenet/public_test_cases/p01642/input.0.txt b/codenet/public_test_cases/p01642/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fe0da7d93d56564fdedb0f560488dabfe250011 --- /dev/null +++ b/codenet/public_test_cases/p01642/input.0.txt @@ -0,0 +1,2 @@ +1 3 +1 1 1 diff --git a/codenet/public_test_cases/p01642/input.1.txt b/codenet/public_test_cases/p01642/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fe0da7d93d56564fdedb0f560488dabfe250011 --- /dev/null +++ b/codenet/public_test_cases/p01642/input.1.txt @@ -0,0 +1,2 @@ +1 3 +1 1 1 diff --git a/codenet/public_test_cases/p01642/output.0.txt b/codenet/public_test_cases/p01642/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01642/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01642/output.1.txt b/codenet/public_test_cases/p01642/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01642/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01643/input.0.txt b/codenet/public_test_cases/p01643/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c69f2dfeef95446a37c2deaeaab9bb80ebe9b5e --- /dev/null +++ b/codenet/public_test_cases/p01643/input.0.txt @@ -0,0 +1,2 @@ +n k +a diff --git a/codenet/public_test_cases/p01643/input.1.txt b/codenet/public_test_cases/p01643/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c69f2dfeef95446a37c2deaeaab9bb80ebe9b5e --- /dev/null +++ b/codenet/public_test_cases/p01643/input.1.txt @@ -0,0 +1,2 @@ +n k +a diff --git a/codenet/public_test_cases/p01643/output.0.txt b/codenet/public_test_cases/p01643/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01643/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01643/output.1.txt b/codenet/public_test_cases/p01643/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01643/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01644/input.0.txt b/codenet/public_test_cases/p01644/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7798af80d5c30d570574e50f39d1f76837c3d4a --- /dev/null +++ b/codenet/public_test_cases/p01644/input.0.txt @@ -0,0 +1,5 @@ +N (Sレアカードの種類) +P_1 (カード1が好きな人の割合) +P_2 (カード2が好きな人の割合) +... +P_N (カードNが好きな人の割合) diff --git a/codenet/public_test_cases/p01644/input.1.txt b/codenet/public_test_cases/p01644/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7798af80d5c30d570574e50f39d1f76837c3d4a --- /dev/null +++ b/codenet/public_test_cases/p01644/input.1.txt @@ -0,0 +1,5 @@ +N (Sレアカードの種類) +P_1 (カード1が好きな人の割合) +P_2 (カード2が好きな人の割合) +... +P_N (カードNが好きな人の割合) diff --git a/codenet/public_test_cases/p01644/output.0.txt b/codenet/public_test_cases/p01644/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5caff40c4a0ce4ed0dcb3aa983da623641af1b06 --- /dev/null +++ b/codenet/public_test_cases/p01644/output.0.txt @@ -0,0 +1 @@ +10000 diff --git a/codenet/public_test_cases/p01644/output.1.txt b/codenet/public_test_cases/p01644/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5caff40c4a0ce4ed0dcb3aa983da623641af1b06 --- /dev/null +++ b/codenet/public_test_cases/p01644/output.1.txt @@ -0,0 +1 @@ +10000 diff --git a/codenet/public_test_cases/p01645/input.0.txt b/codenet/public_test_cases/p01645/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4267a1720ca7d592132b7b7612c2e7b561f11d9c --- /dev/null +++ b/codenet/public_test_cases/p01645/input.0.txt @@ -0,0 +1,2 @@ +n +s diff --git a/codenet/public_test_cases/p01645/output.0.txt b/codenet/public_test_cases/p01645/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..126cacb73e317ba75ba7b7a8b55a2fa2c1bf7e2a --- /dev/null +++ b/codenet/public_test_cases/p01645/output.0.txt @@ -0,0 +1,6 @@ +16 +304 +18 +-1 +7703703700 +7795884765 diff --git a/codenet/public_test_cases/p01646/input.0.txt b/codenet/public_test_cases/p01646/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..126cbf9338f76889053b2ff68ed3f1b2643dde8b --- /dev/null +++ b/codenet/public_test_cases/p01646/input.0.txt @@ -0,0 +1,22 @@ +4 +cba +cab +b +a +3 +bca +ab +a +5 +abc +acb +b +c +c +5 +abc +acb +c +b +b +0 diff --git a/codenet/public_test_cases/p01646/input.1.txt b/codenet/public_test_cases/p01646/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..126cbf9338f76889053b2ff68ed3f1b2643dde8b --- /dev/null +++ b/codenet/public_test_cases/p01646/input.1.txt @@ -0,0 +1,22 @@ +4 +cba +cab +b +a +3 +bca +ab +a +5 +abc +acb +b +c +c +5 +abc +acb +c +b +b +0 diff --git a/codenet/public_test_cases/p01646/output.0.txt b/codenet/public_test_cases/p01646/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33cc71c5a381b565c5ca891299202b8cf724680a --- /dev/null +++ b/codenet/public_test_cases/p01646/output.0.txt @@ -0,0 +1,4 @@ +yes +no +yes +no diff --git a/codenet/public_test_cases/p01646/output.1.txt b/codenet/public_test_cases/p01646/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..33cc71c5a381b565c5ca891299202b8cf724680a --- /dev/null +++ b/codenet/public_test_cases/p01646/output.1.txt @@ -0,0 +1,4 @@ +yes +no +yes +no diff --git a/codenet/public_test_cases/p01647/input.0.txt b/codenet/public_test_cases/p01647/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9db4e04d34137c985b1cd2c274bde8be455bcde9 --- /dev/null +++ b/codenet/public_test_cases/p01647/input.0.txt @@ -0,0 +1,10 @@ +SA SK +DA CA +SQ SJ ST +SA HA +D2 C3 +H4 S5 DA +HA D9 +H6 C9 +H3 H4 H5 +# diff --git a/codenet/public_test_cases/p01647/input.1.txt b/codenet/public_test_cases/p01647/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9db4e04d34137c985b1cd2c274bde8be455bcde9 --- /dev/null +++ b/codenet/public_test_cases/p01647/input.1.txt @@ -0,0 +1,10 @@ +SA SK +DA CA +SQ SJ ST +SA HA +D2 C3 +H4 S5 DA +HA D9 +H6 C9 +H3 H4 H5 +# diff --git a/codenet/public_test_cases/p01647/output.0.txt b/codenet/public_test_cases/p01647/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..10798846f1b7b0737e6b958dafda49a2303b72c1 --- /dev/null +++ b/codenet/public_test_cases/p01647/output.0.txt @@ -0,0 +1,3 @@ +1.00000000000000000000 +0.34444444444444444198 +0.63030303030303025391 diff --git a/codenet/public_test_cases/p01647/output.1.txt b/codenet/public_test_cases/p01647/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..10798846f1b7b0737e6b958dafda49a2303b72c1 --- /dev/null +++ b/codenet/public_test_cases/p01647/output.1.txt @@ -0,0 +1,3 @@ +1.00000000000000000000 +0.34444444444444444198 +0.63030303030303025391 diff --git a/codenet/public_test_cases/p01648/input.0.txt b/codenet/public_test_cases/p01648/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..22c120e839fe1e016a14e34a9ff3db51331d4b9e --- /dev/null +++ b/codenet/public_test_cases/p01648/input.0.txt @@ -0,0 +1,28 @@ +2 1 +1 2 5 +4 6 +1 2 1 +1 3 2 +1 4 3 +2 3 4 +2 4 5 +3 4 6 +8 17 +1 4 767 +3 1 609 +8 3 426 +6 5 972 +8 1 607 +6 4 51 +5 1 683 +3 6 451 +3 4 630 +8 7 912 +3 7 43 +4 7 421 +3 5 582 +8 4 538 +5 7 832 +1 6 345 +8 2 608 +0 0 diff --git a/codenet/public_test_cases/p01648/input.1.txt b/codenet/public_test_cases/p01648/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..22c120e839fe1e016a14e34a9ff3db51331d4b9e --- /dev/null +++ b/codenet/public_test_cases/p01648/input.1.txt @@ -0,0 +1,28 @@ +2 1 +1 2 5 +4 6 +1 2 1 +1 3 2 +1 4 3 +2 3 4 +2 4 5 +3 4 6 +8 17 +1 4 767 +3 1 609 +8 3 426 +6 5 972 +8 1 607 +6 4 51 +5 1 683 +3 6 451 +3 4 630 +8 7 912 +3 7 43 +4 7 421 +3 5 582 +8 4 538 +5 7 832 +1 6 345 +8 2 608 +0 0 diff --git a/codenet/public_test_cases/p01648/output.0.txt b/codenet/public_test_cases/p01648/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd76561c6394f948187c95ac097d4340f9e8778 --- /dev/null +++ b/codenet/public_test_cases/p01648/output.0.txt @@ -0,0 +1,3 @@ +5 +2 +421 diff --git a/codenet/public_test_cases/p01648/output.1.txt b/codenet/public_test_cases/p01648/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd76561c6394f948187c95ac097d4340f9e8778 --- /dev/null +++ b/codenet/public_test_cases/p01648/output.1.txt @@ -0,0 +1,3 @@ +5 +2 +421 diff --git a/codenet/public_test_cases/p01649/input.0.txt b/codenet/public_test_cases/p01649/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9831f4c122ecac5c23745ed51361c81c5b6f5fa --- /dev/null +++ b/codenet/public_test_cases/p01649/input.0.txt @@ -0,0 +1,11 @@ +3 +26 16 1 8 4 +10 6 +9 2 +9 10 +3 +71 363 4 8 0 +52 238 +25 33 +59 288 +0 diff --git a/codenet/public_test_cases/p01649/input.1.txt b/codenet/public_test_cases/p01649/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9831f4c122ecac5c23745ed51361c81c5b6f5fa --- /dev/null +++ b/codenet/public_test_cases/p01649/input.1.txt @@ -0,0 +1,11 @@ +3 +26 16 1 8 4 +10 6 +9 2 +9 10 +3 +71 363 4 8 0 +52 238 +25 33 +59 288 +0 diff --git a/codenet/public_test_cases/p01649/output.0.txt b/codenet/public_test_cases/p01649/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81d7aba8aeacef28e577af1cc8bf39168aaa09b1 --- /dev/null +++ b/codenet/public_test_cases/p01649/output.0.txt @@ -0,0 +1,2 @@ +3 +-1 diff --git a/codenet/public_test_cases/p01649/output.1.txt b/codenet/public_test_cases/p01649/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81d7aba8aeacef28e577af1cc8bf39168aaa09b1 --- /dev/null +++ b/codenet/public_test_cases/p01649/output.1.txt @@ -0,0 +1,2 @@ +3 +-1 diff --git a/codenet/public_test_cases/p01650/input.0.txt b/codenet/public_test_cases/p01650/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3dc800c8ec00714b5e300510d945058b8045b391 --- /dev/null +++ b/codenet/public_test_cases/p01650/input.0.txt @@ -0,0 +1,32 @@ +3 3 +ac# +b#C +.BA +3 3 +aaZ +a#Z +aZZ +3 3 +..# +.#. +#.. +1 50 +abcdefghijklmnopqrstuvwxyYXWVUTSRQPONMLKJIHGFEDCBA +1 50 +aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyY +1 50 +abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXY +1 50 +aaaaaaaaaabbbbbbbbbbcccccCCCCCBBBBBBBBBBAAAAAAAAAA +10 10 +...#...... +a###.##### +.bc...A... +##.#C#d#.# +.#B#.#.### +.#...#e.D. +.#A..###.# +..e.c#..E. +####d###.# +##E...D.C. +0 0 diff --git a/codenet/public_test_cases/p01650/input.1.txt b/codenet/public_test_cases/p01650/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3dc800c8ec00714b5e300510d945058b8045b391 --- /dev/null +++ b/codenet/public_test_cases/p01650/input.1.txt @@ -0,0 +1,32 @@ +3 3 +ac# +b#C +.BA +3 3 +aaZ +a#Z +aZZ +3 3 +..# +.#. +#.. +1 50 +abcdefghijklmnopqrstuvwxyYXWVUTSRQPONMLKJIHGFEDCBA +1 50 +aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyY +1 50 +abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXY +1 50 +aaaaaaaaaabbbbbbbbbbcccccCCCCCBBBBBBBBBBAAAAAAAAAA +10 10 +...#...... +a###.##### +.bc...A... +##.#C#d#.# +.#B#.#.### +.#...#e.D. +.#A..###.# +..e.c#..E. +####d###.# +##E...D.C. +0 0 diff --git a/codenet/public_test_cases/p01650/input.2.txt b/codenet/public_test_cases/p01650/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b372bef5c3d06b2ad4870ae961c2574d9d26d1bc --- /dev/null +++ b/codenet/public_test_cases/p01650/input.2.txt @@ -0,0 +1,32 @@ +3 3 +ac# +b#C +.BA +3 3 +aaZ +a#Z +aZZ +3 3 +..# +.#. +.. +1 50 +abcdefghijklmnopqrstuvwxyYXWVUTSRQPONMLKJIHGFEDCBA +1 50 +aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyY +1 50 +abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXY +1 50 +aaaaaaaaaabbbbbbbbbbcccccCCCCCBBBBBBBBBBAAAAAAAAAA +10 10 +...#...... +a###.##### +.bc...A... +.#C#d#.# +.#B#.#.### +.#...#e.D. +.#A..###.# +..e.c#..E. +d###.# +E...D.C. +0 0 diff --git a/codenet/public_test_cases/p01650/output.0.txt b/codenet/public_test_cases/p01650/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce086164a52cc595764abc822af43fe653e041a4 --- /dev/null +++ b/codenet/public_test_cases/p01650/output.0.txt @@ -0,0 +1,8 @@ +2 +0 +-1 +25 +25 +1 +25 +4 diff --git a/codenet/public_test_cases/p01650/output.1.txt b/codenet/public_test_cases/p01650/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce086164a52cc595764abc822af43fe653e041a4 --- /dev/null +++ b/codenet/public_test_cases/p01650/output.1.txt @@ -0,0 +1,8 @@ +2 +0 +-1 +25 +25 +1 +25 +4 diff --git a/codenet/public_test_cases/p01650/output.2.txt b/codenet/public_test_cases/p01650/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce086164a52cc595764abc822af43fe653e041a4 --- /dev/null +++ b/codenet/public_test_cases/p01650/output.2.txt @@ -0,0 +1,8 @@ +2 +0 +-1 +25 +25 +1 +25 +4 diff --git a/codenet/public_test_cases/p01651/input.0.txt b/codenet/public_test_cases/p01651/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc632a161dcc38df58de68132e1b865badd20cf9 --- /dev/null +++ b/codenet/public_test_cases/p01651/input.0.txt @@ -0,0 +1,201 @@ +3 +2 +2 +1 +49 +95351238128934 +95351238128934 +95351238128932 +95351238128936 +95351238128936 +95351238128936 +95351238128960 +95351238128900 +95351238128896 +95351238129096 +95351238128772 +95351238129096 +95351238129096 +95351238126156 +95351238131712 +95351238131712 +95351238149576 +95351238093388 +95351238084040 +95351237962316 +95351238295552 +95351237911684 +95351237911684 +95351235149824 +95351233717380 +95351249496652 +95351249496652 +95351226761216 +95351226761216 +95351082722436 +95351082722436 +95352054803020 +95352156464260 +95348273971200 +95348273971200 +95354202286668 +95356451431556 +95356451431556 +95346024826312 +95356451431556 +95356451431556 +94557999988736 +94256939803780 +94256939803780 +102741546035788 +87649443431880 +87649443431880 +140737488355328 +32684288648324 +64 +0 +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 +11 +0 +0 +1 +1 +1 +0 +1 +1 +1 +1 +1 +63 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1 +4 +1 +1 +1 +1 +0 diff --git a/codenet/public_test_cases/p01651/input.1.txt b/codenet/public_test_cases/p01651/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc632a161dcc38df58de68132e1b865badd20cf9 --- /dev/null +++ b/codenet/public_test_cases/p01651/input.1.txt @@ -0,0 +1,201 @@ +3 +2 +2 +1 +49 +95351238128934 +95351238128934 +95351238128932 +95351238128936 +95351238128936 +95351238128936 +95351238128960 +95351238128900 +95351238128896 +95351238129096 +95351238128772 +95351238129096 +95351238129096 +95351238126156 +95351238131712 +95351238131712 +95351238149576 +95351238093388 +95351238084040 +95351237962316 +95351238295552 +95351237911684 +95351237911684 +95351235149824 +95351233717380 +95351249496652 +95351249496652 +95351226761216 +95351226761216 +95351082722436 +95351082722436 +95352054803020 +95352156464260 +95348273971200 +95348273971200 +95354202286668 +95356451431556 +95356451431556 +95346024826312 +95356451431556 +95356451431556 +94557999988736 +94256939803780 +94256939803780 +102741546035788 +87649443431880 +87649443431880 +140737488355328 +32684288648324 +64 +0 +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 +11 +0 +0 +1 +1 +1 +0 +1 +1 +1 +1 +1 +63 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1 +4 +1 +1 +1 +1 +0 diff --git a/codenet/public_test_cases/p01651/output.0.txt b/codenet/public_test_cases/p01651/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..805ef58d7953efcfdb6d323abae9c2eb87e041ac --- /dev/null +++ b/codenet/public_test_cases/p01651/output.0.txt @@ -0,0 +1,6 @@ +1 4 +123456789101112 314159265358979 +None +2012 2012 +None +Many diff --git a/codenet/public_test_cases/p01651/output.1.txt b/codenet/public_test_cases/p01651/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..805ef58d7953efcfdb6d323abae9c2eb87e041ac --- /dev/null +++ b/codenet/public_test_cases/p01651/output.1.txt @@ -0,0 +1,6 @@ +1 4 +123456789101112 314159265358979 +None +2012 2012 +None +Many diff --git a/codenet/public_test_cases/p01652/input.0.txt b/codenet/public_test_cases/p01652/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e24594959753bfa0b5b159c63c37a99fb33c887a --- /dev/null +++ b/codenet/public_test_cases/p01652/input.0.txt @@ -0,0 +1,94 @@ +2 1 +a 11 9 +****..... +.*.*..... +.*.*..... +.*..*.... +.**..*... +..**..*.. +..*.*.... +..**.*.*. +..*..*.*. +..*****.* +******.** +b 10 6 +....*. +....*. +....*. +....*. +....*. +....*. +....*. +....*. +.**..* +*****. +19 55 +******************************************************* +*.....................................................* +*.********************.********************...........* +*.*..................*.*..................*...........* +*.*.****.............*.*.............****.*.****......* +*.*..*.*..........*..*.*..*..........*.*..*..*.*......* +*.*..*.*..........*..*.*..*..........*.*..*..*.*......* +*.*..*..*.........*..*.*..*.........*..*..*..*..*.....* +*.*..**..*........*..*.*..*........*..**..*..**..*....* +*.*...**..*.......*..*.*..*.......*..**...*...**..*...* +*.*...*.*.........*..*.*..*.........*.*...*...*.*.....* +*.*...**.*.*......*..*.*..*......*.*.**...*...**.*.*..* +*.*...*..*.*......*..*.*..*......*.*..*...*...*..*.*..* +*.*...*****.*..**..*.*.*.*..**..*.*****...*...*****.*.* +*.*.******.**.*****..*.*..*****.**.******.*.******.**.* +*.*..................*.*..................*...........* +*.********************.********************...........* +*.....................................................* +******************************************************* +2 3 +a 2 3 +.*. +*** +b 3 3 +.*. +*** +.*. +2 3 +.*. +*** +4 3 +*** +*.* +*.* +*** +9 13 +************. +*..........*. +*.......*..*. +*...*..***.*. +*..***.....*. +*...*......*. +*..........*. +************. +............. +3 1 +a 2 2 +.* +** +b 2 1 +* +* +c 3 3 +*** +*.* +*** +11 16 +**************** +*..............* +*....*********.* +*....*.......*.* +*.*..*.***...*.* +*.**.*.*.*.*.*.* +*....*.***.*.*.* +*....*.......*.* +*....*********.* +*..............* +**************** +0 0 diff --git a/codenet/public_test_cases/p01652/input.1.txt b/codenet/public_test_cases/p01652/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e24594959753bfa0b5b159c63c37a99fb33c887a --- /dev/null +++ b/codenet/public_test_cases/p01652/input.1.txt @@ -0,0 +1,94 @@ +2 1 +a 11 9 +****..... +.*.*..... +.*.*..... +.*..*.... +.**..*... +..**..*.. +..*.*.... +..**.*.*. +..*..*.*. +..*****.* +******.** +b 10 6 +....*. +....*. +....*. +....*. +....*. +....*. +....*. +....*. +.**..* +*****. +19 55 +******************************************************* +*.....................................................* +*.********************.********************...........* +*.*..................*.*..................*...........* +*.*.****.............*.*.............****.*.****......* +*.*..*.*..........*..*.*..*..........*.*..*..*.*......* +*.*..*.*..........*..*.*..*..........*.*..*..*.*......* +*.*..*..*.........*..*.*..*.........*..*..*..*..*.....* +*.*..**..*........*..*.*..*........*..**..*..**..*....* +*.*...**..*.......*..*.*..*.......*..**...*...**..*...* +*.*...*.*.........*..*.*..*.........*.*...*...*.*.....* +*.*...**.*.*......*..*.*..*......*.*.**...*...**.*.*..* +*.*...*..*.*......*..*.*..*......*.*..*...*...*..*.*..* +*.*...*****.*..**..*.*.*.*..**..*.*****...*...*****.*.* +*.*.******.**.*****..*.*..*****.**.******.*.******.**.* +*.*..................*.*..................*...........* +*.********************.********************...........* +*.....................................................* +******************************************************* +2 3 +a 2 3 +.*. +*** +b 3 3 +.*. +*** +.*. +2 3 +.*. +*** +4 3 +*** +*.* +*.* +*** +9 13 +************. +*..........*. +*.......*..*. +*...*..***.*. +*..***.....*. +*...*......*. +*..........*. +************. +............. +3 1 +a 2 2 +.* +** +b 2 1 +* +* +c 3 3 +*** +*.* +*** +11 16 +**************** +*..............* +*....*********.* +*....*.......*.* +*.*..*.***...*.* +*.**.*.*.*.*.*.* +*....*.***.*.*.* +*....*.......*.* +*....*********.* +*..............* +**************** +0 0 diff --git a/codenet/public_test_cases/p01652/output.0.txt b/codenet/public_test_cases/p01652/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d976a321b6636724605430faf670b923ec69b43 --- /dev/null +++ b/codenet/public_test_cases/p01652/output.0.txt @@ -0,0 +1,8 @@ +[[ab][ab]a] +# +a +[] +[ba] +# +[[cb]a] +# diff --git a/codenet/public_test_cases/p01652/output.1.txt b/codenet/public_test_cases/p01652/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d976a321b6636724605430faf670b923ec69b43 --- /dev/null +++ b/codenet/public_test_cases/p01652/output.1.txt @@ -0,0 +1,8 @@ +[[ab][ab]a] +# +a +[] +[ba] +# +[[cb]a] +# diff --git a/codenet/public_test_cases/p01653/input.0.txt b/codenet/public_test_cases/p01653/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bdaf51ca9983fa33cd8669e483f0c6866902657 --- /dev/null +++ b/codenet/public_test_cases/p01653/input.0.txt @@ -0,0 +1,8 @@ +3 2 2 3 1 +1 2 1 +1 3 2 +4 3 1 4 2 +2 1 3 +2 3 x +4 3 x +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01653/input.1.txt b/codenet/public_test_cases/p01653/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bdaf51ca9983fa33cd8669e483f0c6866902657 --- /dev/null +++ b/codenet/public_test_cases/p01653/input.1.txt @@ -0,0 +1,8 @@ +3 2 2 3 1 +1 2 1 +1 3 2 +4 3 1 4 2 +2 1 3 +2 3 x +4 3 x +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01653/output.0.txt b/codenet/public_test_cases/p01653/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p01653/output.0.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p01653/output.1.txt b/codenet/public_test_cases/p01653/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p01653/output.1.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p01654/input.0.txt b/codenet/public_test_cases/p01654/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63e7091ef1799e887d68bef2e46a262d13f36ed4 --- /dev/null +++ b/codenet/public_test_cases/p01654/input.0.txt @@ -0,0 +1,22 @@ +1 5 +2 +3 7 +2 3 1 +0 1 1 0 +1 2 2 0 +2 8 +5 6 +0 2 1 2 +2 8 +1 1 +0 0 1 0 +2 2 +2 2 +0 1 1 0 +2 3 +3 3 +0 2 1 1 +2 4 +3 1 +1 0 0 1 +0 0 diff --git a/codenet/public_test_cases/p01654/input.1.txt b/codenet/public_test_cases/p01654/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63e7091ef1799e887d68bef2e46a262d13f36ed4 --- /dev/null +++ b/codenet/public_test_cases/p01654/input.1.txt @@ -0,0 +1,22 @@ +1 5 +2 +3 7 +2 3 1 +0 1 1 0 +1 2 2 0 +2 8 +5 6 +0 2 1 2 +2 8 +1 1 +0 0 1 0 +2 2 +2 2 +0 1 1 0 +2 3 +3 3 +0 2 1 1 +2 4 +3 1 +1 0 0 1 +0 0 diff --git a/codenet/public_test_cases/p01654/output.0.txt b/codenet/public_test_cases/p01654/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..247b75208e20067a4f81033fd77b63641477cea9 --- /dev/null +++ b/codenet/public_test_cases/p01654/output.0.txt @@ -0,0 +1,7 @@ +708 +1900484 +438404500 +3878 +496 +14246 +9768 diff --git a/codenet/public_test_cases/p01654/output.1.txt b/codenet/public_test_cases/p01654/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..247b75208e20067a4f81033fd77b63641477cea9 --- /dev/null +++ b/codenet/public_test_cases/p01654/output.1.txt @@ -0,0 +1,7 @@ +708 +1900484 +438404500 +3878 +496 +14246 +9768 diff --git a/codenet/public_test_cases/p01655/input.0.txt b/codenet/public_test_cases/p01655/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..77680aa7b0b6f47fc0f12e5c4662b56fa738f65b --- /dev/null +++ b/codenet/public_test_cases/p01655/input.0.txt @@ -0,0 +1,17 @@ +3 1 +ACM +IBM +ICM +5 2 +iwzwz +iziwi +zwizi +1 0 +A +B +C +10 5 +jLRNlNyGWx +yyLnlyyGDA +yLRnvyyGDA +0 0 diff --git a/codenet/public_test_cases/p01655/input.1.txt b/codenet/public_test_cases/p01655/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..77680aa7b0b6f47fc0f12e5c4662b56fa738f65b --- /dev/null +++ b/codenet/public_test_cases/p01655/input.1.txt @@ -0,0 +1,17 @@ +3 1 +ACM +IBM +ICM +5 2 +iwzwz +iziwi +zwizi +1 0 +A +B +C +10 5 +jLRNlNyGWx +yyLnlyyGDA +yLRnvyyGDA +0 0 diff --git a/codenet/public_test_cases/p01655/output.0.txt b/codenet/public_test_cases/p01655/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ca9473e482746336a7e92f959d808d91c1cbbea --- /dev/null +++ b/codenet/public_test_cases/p01655/output.0.txt @@ -0,0 +1,4 @@ +ICM +iwiwi +-1 +AARAlNyGDA diff --git a/codenet/public_test_cases/p01655/output.1.txt b/codenet/public_test_cases/p01655/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ca9473e482746336a7e92f959d808d91c1cbbea --- /dev/null +++ b/codenet/public_test_cases/p01655/output.1.txt @@ -0,0 +1,4 @@ +ICM +iwiwi +-1 +AARAlNyGDA diff --git a/codenet/public_test_cases/p01656/input.0.txt b/codenet/public_test_cases/p01656/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef6f8d95ef758023dafe4e8349d3fcc471b5a3e9 --- /dev/null +++ b/codenet/public_test_cases/p01656/input.0.txt @@ -0,0 +1,4 @@ +3 12 +5 sogo5gokan +10 sogo10gokan +15 sogo15gokan diff --git a/codenet/public_test_cases/p01656/output.0.txt b/codenet/public_test_cases/p01656/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e0c388f682cd67b9fc82af5bd49dd313e9d6585 --- /dev/null +++ b/codenet/public_test_cases/p01656/output.0.txt @@ -0,0 +1 @@ +sogo10gokan diff --git a/codenet/public_test_cases/p01657/input.0.txt b/codenet/public_test_cases/p01657/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..face79053ca326b20acc621a8f7008f84bcc8463 --- /dev/null +++ b/codenet/public_test_cases/p01657/input.0.txt @@ -0,0 +1,2 @@ +3 5 1 +1 2 5 diff --git a/codenet/public_test_cases/p01657/output.0.txt b/codenet/public_test_cases/p01657/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80bc4aac6edc439097726320cc0fd569093f1cd2 --- /dev/null +++ b/codenet/public_test_cases/p01657/output.0.txt @@ -0,0 +1 @@ +2 3 5 diff --git a/codenet/public_test_cases/p01658/input.0.txt b/codenet/public_test_cases/p01658/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b40bfd8c889c575f7bce443635f4e272f7316761 --- /dev/null +++ b/codenet/public_test_cases/p01658/input.0.txt @@ -0,0 +1,3 @@ +2 3 +1 1 1 +1 1 1 diff --git a/codenet/public_test_cases/p01658/output.0.txt b/codenet/public_test_cases/p01658/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01658/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01659/input.0.txt b/codenet/public_test_cases/p01659/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56221aadc5dfac666c62fd57ad1536458c512851 --- /dev/null +++ b/codenet/public_test_cases/p01659/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 1 diff --git a/codenet/public_test_cases/p01659/output.0.txt b/codenet/public_test_cases/p01659/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01659/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01660/input.1.txt b/codenet/public_test_cases/p01660/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01660/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01660/output.1.txt b/codenet/public_test_cases/p01660/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01660/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01661/input.0.txt b/codenet/public_test_cases/p01661/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f788f895b9ff134a3848547c2ce2d39f7cc7b54 --- /dev/null +++ b/codenet/public_test_cases/p01661/input.0.txt @@ -0,0 +1,5 @@ +2 1 +0 100 +150 250 +0 100 +100 0 diff --git a/codenet/public_test_cases/p01661/output.0.txt b/codenet/public_test_cases/p01661/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa8f08cb6ff8a30dd34a3b442009bdfc798a7316 --- /dev/null +++ b/codenet/public_test_cases/p01661/output.0.txt @@ -0,0 +1 @@ +150 diff --git a/codenet/public_test_cases/p01663/input.0.txt b/codenet/public_test_cases/p01663/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..704efd280dfdd88a4eda0dfa56c9e81130f6b687 --- /dev/null +++ b/codenet/public_test_cases/p01663/input.0.txt @@ -0,0 +1,6 @@ +5 +3 2 +5 2 +8 3 +10 1 +18 12 diff --git a/codenet/public_test_cases/p01663/input.1.txt b/codenet/public_test_cases/p01663/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..704efd280dfdd88a4eda0dfa56c9e81130f6b687 --- /dev/null +++ b/codenet/public_test_cases/p01663/input.1.txt @@ -0,0 +1,6 @@ +5 +3 2 +5 2 +8 3 +10 1 +18 12 diff --git a/codenet/public_test_cases/p01663/output.0.txt b/codenet/public_test_cases/p01663/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5696b72d73f5a4450a759b9b3d48c277806468b2 --- /dev/null +++ b/codenet/public_test_cases/p01663/output.0.txt @@ -0,0 +1,5 @@ +3 +3 +5 +4 +-1 diff --git a/codenet/public_test_cases/p01663/output.1.txt b/codenet/public_test_cases/p01663/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5696b72d73f5a4450a759b9b3d48c277806468b2 --- /dev/null +++ b/codenet/public_test_cases/p01663/output.1.txt @@ -0,0 +1,5 @@ +3 +3 +5 +4 +-1 diff --git a/codenet/public_test_cases/p01664/input.1.txt b/codenet/public_test_cases/p01664/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01664/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01664/output.1.txt b/codenet/public_test_cases/p01664/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01664/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01665/input.0.txt b/codenet/public_test_cases/p01665/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac06d91d8aecaaf1ed168da3b63333dfc2e26e6d --- /dev/null +++ b/codenet/public_test_cases/p01665/input.0.txt @@ -0,0 +1 @@ +2 2 1 diff --git a/codenet/public_test_cases/p01665/output.0.txt b/codenet/public_test_cases/p01665/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01665/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01667/input.0.txt b/codenet/public_test_cases/p01667/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a74c2ba9599fb80b2f01c2bade473f66f25749a --- /dev/null +++ b/codenet/public_test_cases/p01667/input.0.txt @@ -0,0 +1,4 @@ +2 2 +2 +1 >= 3 +2 diff --git a/codenet/public_test_cases/p01667/input.1.txt b/codenet/public_test_cases/p01667/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a74c2ba9599fb80b2f01c2bade473f66f25749a --- /dev/null +++ b/codenet/public_test_cases/p01667/input.1.txt @@ -0,0 +1,4 @@ +2 2 +2 +1 >= 3 +2 diff --git a/codenet/public_test_cases/p01667/output.0.txt b/codenet/public_test_cases/p01667/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01667/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01667/output.1.txt b/codenet/public_test_cases/p01667/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01667/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01668/input.0.txt b/codenet/public_test_cases/p01668/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d849ff9fbc8ef5b5ece8947aedea2c693179e497 --- /dev/null +++ b/codenet/public_test_cases/p01668/input.0.txt @@ -0,0 +1 @@ +1 3 2 diff --git a/codenet/public_test_cases/p01668/output.0.txt b/codenet/public_test_cases/p01668/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01668/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01669/input.0.txt b/codenet/public_test_cases/p01669/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b218b5f0267d2a0a49c9a2c1af122a80f7bc59f5 --- /dev/null +++ b/codenet/public_test_cases/p01669/input.0.txt @@ -0,0 +1,4 @@ +3 2 1 3 2 1 3 2 1 3 2 1 +1 1 +1 1 +1 1 diff --git a/codenet/public_test_cases/p01669/input.1.txt b/codenet/public_test_cases/p01669/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b218b5f0267d2a0a49c9a2c1af122a80f7bc59f5 --- /dev/null +++ b/codenet/public_test_cases/p01669/input.1.txt @@ -0,0 +1,4 @@ +3 2 1 3 2 1 3 2 1 3 2 1 +1 1 +1 1 +1 1 diff --git a/codenet/public_test_cases/p01669/output.0.txt b/codenet/public_test_cases/p01669/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2b8df90b143ee93588c9cfc0225c9203027b21f --- /dev/null +++ b/codenet/public_test_cases/p01669/output.0.txt @@ -0,0 +1 @@ +4 8 12 diff --git a/codenet/public_test_cases/p01669/output.1.txt b/codenet/public_test_cases/p01669/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2b8df90b143ee93588c9cfc0225c9203027b21f --- /dev/null +++ b/codenet/public_test_cases/p01669/output.1.txt @@ -0,0 +1 @@ +4 8 12 diff --git a/codenet/public_test_cases/p01670/input.0.txt b/codenet/public_test_cases/p01670/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fac41c35610736b5896be681e834622f2362326d --- /dev/null +++ b/codenet/public_test_cases/p01670/input.0.txt @@ -0,0 +1,4 @@ +3 3 2 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01670/input.1.txt b/codenet/public_test_cases/p01670/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fac41c35610736b5896be681e834622f2362326d --- /dev/null +++ b/codenet/public_test_cases/p01670/input.1.txt @@ -0,0 +1,4 @@ +3 3 2 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01670/output.0.txt b/codenet/public_test_cases/p01670/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01670/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01670/output.1.txt b/codenet/public_test_cases/p01670/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01670/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01671/input.0.txt b/codenet/public_test_cases/p01671/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4337ed0072855d2406c16c302d9c09bbee328661 --- /dev/null +++ b/codenet/public_test_cases/p01671/input.0.txt @@ -0,0 +1,7 @@ +4 6 +1 2 2 +1 3 6 +1 4 3 +2 3 1 +2 4 4 +3 4 5 diff --git a/codenet/public_test_cases/p01671/input.1.txt b/codenet/public_test_cases/p01671/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4337ed0072855d2406c16c302d9c09bbee328661 --- /dev/null +++ b/codenet/public_test_cases/p01671/input.1.txt @@ -0,0 +1,7 @@ +4 6 +1 2 2 +1 3 6 +1 4 3 +2 3 1 +2 4 4 +3 4 5 diff --git a/codenet/public_test_cases/p01671/output.0.txt b/codenet/public_test_cases/p01671/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..047d5342ba172ce092bef0f6cdc81f1c20623054 --- /dev/null +++ b/codenet/public_test_cases/p01671/output.0.txt @@ -0,0 +1,6 @@ +8 +6 +7 +10 +6 +6 diff --git a/codenet/public_test_cases/p01671/output.1.txt b/codenet/public_test_cases/p01671/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..047d5342ba172ce092bef0f6cdc81f1c20623054 --- /dev/null +++ b/codenet/public_test_cases/p01671/output.1.txt @@ -0,0 +1,6 @@ +8 +6 +7 +10 +6 +6 diff --git a/codenet/public_test_cases/p01672/input.0.txt b/codenet/public_test_cases/p01672/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..157189fda42532d6a47765be5bb514577ac032f2 --- /dev/null +++ b/codenet/public_test_cases/p01672/input.0.txt @@ -0,0 +1,3 @@ +2 +1 0 +0 1 diff --git a/codenet/public_test_cases/p01672/input.1.txt b/codenet/public_test_cases/p01672/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..157189fda42532d6a47765be5bb514577ac032f2 --- /dev/null +++ b/codenet/public_test_cases/p01672/input.1.txt @@ -0,0 +1,3 @@ +2 +1 0 +0 1 diff --git a/codenet/public_test_cases/p01672/output.0.txt b/codenet/public_test_cases/p01672/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57e126068b6a47c3e64407e3eae9118149fb4ae --- /dev/null +++ b/codenet/public_test_cases/p01672/output.0.txt @@ -0,0 +1,2 @@ +1.4142135624 +2 1 diff --git a/codenet/public_test_cases/p01672/output.1.txt b/codenet/public_test_cases/p01672/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57e126068b6a47c3e64407e3eae9118149fb4ae --- /dev/null +++ b/codenet/public_test_cases/p01672/output.1.txt @@ -0,0 +1,2 @@ +1.4142135624 +2 1 diff --git a/codenet/public_test_cases/p01673/input.0.txt b/codenet/public_test_cases/p01673/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c22267eee7fd8aff2359aa0f5bf2237fff59da0b --- /dev/null +++ b/codenet/public_test_cases/p01673/input.0.txt @@ -0,0 +1,3 @@ +2 2 0 1 5 +0 1 3 0 3 +0 1 2 1 6 diff --git a/codenet/public_test_cases/p01673/input.1.txt b/codenet/public_test_cases/p01673/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c22267eee7fd8aff2359aa0f5bf2237fff59da0b --- /dev/null +++ b/codenet/public_test_cases/p01673/input.1.txt @@ -0,0 +1,3 @@ +2 2 0 1 5 +0 1 3 0 3 +0 1 2 1 6 diff --git a/codenet/public_test_cases/p01673/output.0.txt b/codenet/public_test_cases/p01673/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01673/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01673/output.1.txt b/codenet/public_test_cases/p01673/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01673/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01674/input.0.txt b/codenet/public_test_cases/p01674/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e07b6fb79c90718aa8efbab29145a4ec1e9f68d --- /dev/null +++ b/codenet/public_test_cases/p01674/input.0.txt @@ -0,0 +1,4 @@ +0.0 0.0 0.0 +1.0 0.0 0.0 0.0 1.0 0.0 +1.0 0.0 0.5 +1.0 0.0 0.0 0.0 0.0 1.0 diff --git a/codenet/public_test_cases/p01674/input.1.txt b/codenet/public_test_cases/p01674/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e07b6fb79c90718aa8efbab29145a4ec1e9f68d --- /dev/null +++ b/codenet/public_test_cases/p01674/input.1.txt @@ -0,0 +1,4 @@ +0.0 0.0 0.0 +1.0 0.0 0.0 0.0 1.0 0.0 +1.0 0.0 0.5 +1.0 0.0 0.0 0.0 0.0 1.0 diff --git a/codenet/public_test_cases/p01674/output.0.txt b/codenet/public_test_cases/p01674/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01674/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01674/output.1.txt b/codenet/public_test_cases/p01674/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01674/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01675/input.0.txt b/codenet/public_test_cases/p01675/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..365115e2e3d3f2958aee5ca60ff97e19d23e0870 --- /dev/null +++ b/codenet/public_test_cases/p01675/input.0.txt @@ -0,0 +1,6 @@ +5 4 1 +1 5 1 +1 1 3 +4 5 1 +3 4 2 +1 3 4 diff --git a/codenet/public_test_cases/p01675/input.1.txt b/codenet/public_test_cases/p01675/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..365115e2e3d3f2958aee5ca60ff97e19d23e0870 --- /dev/null +++ b/codenet/public_test_cases/p01675/input.1.txt @@ -0,0 +1,6 @@ +5 4 1 +1 5 1 +1 1 3 +4 5 1 +3 4 2 +1 3 4 diff --git a/codenet/public_test_cases/p01675/output.0.txt b/codenet/public_test_cases/p01675/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01675/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01675/output.1.txt b/codenet/public_test_cases/p01675/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01675/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01676/input.0.txt b/codenet/public_test_cases/p01676/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..92fd402ea5c9b713eeaf13bba1d2e05729b568d4 --- /dev/null +++ b/codenet/public_test_cases/p01676/input.0.txt @@ -0,0 +1,14 @@ +9 13 +1 2 +1 3 +2 9 +3 4 +3 5 +3 6 +4 9 +5 7 +6 7 +6 8 +7 9 +8 9 +9 1 diff --git a/codenet/public_test_cases/p01676/input.1.txt b/codenet/public_test_cases/p01676/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..92fd402ea5c9b713eeaf13bba1d2e05729b568d4 --- /dev/null +++ b/codenet/public_test_cases/p01676/input.1.txt @@ -0,0 +1,14 @@ +9 13 +1 2 +1 3 +2 9 +3 4 +3 5 +3 6 +4 9 +5 7 +6 7 +6 8 +7 9 +8 9 +9 1 diff --git a/codenet/public_test_cases/p01676/output.0.txt b/codenet/public_test_cases/p01676/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01676/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01676/output.1.txt b/codenet/public_test_cases/p01676/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01676/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01677/input.0.txt b/codenet/public_test_cases/p01677/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c081d484eee289dcb7487bd1a796e8257d1c280 --- /dev/null +++ b/codenet/public_test_cases/p01677/input.0.txt @@ -0,0 +1,13 @@ +5 +1 x 2 4 x +2 +x x +2 +1 2 +2 +2 1 +2 +1000000000 x +4 +x 2 1 x +0 diff --git a/codenet/public_test_cases/p01677/input.1.txt b/codenet/public_test_cases/p01677/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c081d484eee289dcb7487bd1a796e8257d1c280 --- /dev/null +++ b/codenet/public_test_cases/p01677/input.1.txt @@ -0,0 +1,13 @@ +5 +1 x 2 4 x +2 +x x +2 +1 2 +2 +2 1 +2 +1000000000 x +4 +x 2 1 x +0 diff --git a/codenet/public_test_cases/p01677/output.0.txt b/codenet/public_test_cases/p01677/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1b86847564e0a1fb57a08c87d7036ddd8d7daf0 --- /dev/null +++ b/codenet/public_test_cases/p01677/output.0.txt @@ -0,0 +1,6 @@ +3 +none +ambiguous +none +ambiguous +none diff --git a/codenet/public_test_cases/p01677/output.1.txt b/codenet/public_test_cases/p01677/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1b86847564e0a1fb57a08c87d7036ddd8d7daf0 --- /dev/null +++ b/codenet/public_test_cases/p01677/output.1.txt @@ -0,0 +1,6 @@ +3 +none +ambiguous +none +ambiguous +none diff --git a/codenet/public_test_cases/p01678/input.0.txt b/codenet/public_test_cases/p01678/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aada363cbd30421419a160ad7af0f294d866441b --- /dev/null +++ b/codenet/public_test_cases/p01678/input.0.txt @@ -0,0 +1,10 @@ +3?4 +12? +5?6 +?2?4 +5?7? +?9?2 +????? +????? +????? +0 diff --git a/codenet/public_test_cases/p01678/input.1.txt b/codenet/public_test_cases/p01678/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aada363cbd30421419a160ad7af0f294d866441b --- /dev/null +++ b/codenet/public_test_cases/p01678/input.1.txt @@ -0,0 +1,10 @@ +3?4 +12? +5?6 +?2?4 +5?7? +?9?2 +????? +????? +????? +0 diff --git a/codenet/public_test_cases/p01678/output.0.txt b/codenet/public_test_cases/p01678/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..707aeae17e7da99bda049f58a0e80efaa6bd41f5 --- /dev/null +++ b/codenet/public_test_cases/p01678/output.0.txt @@ -0,0 +1,3 @@ +2 +40 +200039979 diff --git a/codenet/public_test_cases/p01678/output.1.txt b/codenet/public_test_cases/p01678/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..707aeae17e7da99bda049f58a0e80efaa6bd41f5 --- /dev/null +++ b/codenet/public_test_cases/p01678/output.1.txt @@ -0,0 +1,3 @@ +2 +40 +200039979 diff --git a/codenet/public_test_cases/p01679/input.0.txt b/codenet/public_test_cases/p01679/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..554fc6ffb1ea59fbd330b1ccf09e84fdc4d1c6f1 --- /dev/null +++ b/codenet/public_test_cases/p01679/input.0.txt @@ -0,0 +1,22 @@ +2 1 1 1 10 +1 2 3 +2 4 +2 1 1 1 9 +1 2 3 +2 4 +4 2 2 4 50 +1 2 5 +3 4 5 +2 15 +3 15 +4 6 3 1 29 +1 2 20 +3 2 10 +4 1 5 +3 1 5 +2 4 3 +3 4 4 +2 1 +4 5 +3 3 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01679/input.1.txt b/codenet/public_test_cases/p01679/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..554fc6ffb1ea59fbd330b1ccf09e84fdc4d1c6f1 --- /dev/null +++ b/codenet/public_test_cases/p01679/input.1.txt @@ -0,0 +1,22 @@ +2 1 1 1 10 +1 2 3 +2 4 +2 1 1 1 9 +1 2 3 +2 4 +4 2 2 4 50 +1 2 5 +3 4 5 +2 15 +3 15 +4 6 3 1 29 +1 2 20 +3 2 10 +4 1 5 +3 1 5 +2 4 3 +3 4 4 +2 1 +4 5 +3 3 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01679/output.0.txt b/codenet/public_test_cases/p01679/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59ea73c7c13aef64b759c813f78872bd5dd49966 --- /dev/null +++ b/codenet/public_test_cases/p01679/output.0.txt @@ -0,0 +1,4 @@ +1 +0 +1 +3 diff --git a/codenet/public_test_cases/p01679/output.1.txt b/codenet/public_test_cases/p01679/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59ea73c7c13aef64b759c813f78872bd5dd49966 --- /dev/null +++ b/codenet/public_test_cases/p01679/output.1.txt @@ -0,0 +1,4 @@ +1 +0 +1 +3 diff --git a/codenet/public_test_cases/p01680/input.0.txt b/codenet/public_test_cases/p01680/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..16dc495284a889251210b6dfc7162794c8ab3451 --- /dev/null +++ b/codenet/public_test_cases/p01680/input.0.txt @@ -0,0 +1,6 @@ +3 2 +1 2 +2 3 +5 0 +100000 0 +0 0 diff --git a/codenet/public_test_cases/p01680/input.1.txt b/codenet/public_test_cases/p01680/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..16dc495284a889251210b6dfc7162794c8ab3451 --- /dev/null +++ b/codenet/public_test_cases/p01680/input.1.txt @@ -0,0 +1,6 @@ +3 2 +1 2 +2 3 +5 0 +100000 0 +0 0 diff --git a/codenet/public_test_cases/p01680/output.0.txt b/codenet/public_test_cases/p01680/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3966d66ac33b9e7fd09b643b84750ff8c90f25c --- /dev/null +++ b/codenet/public_test_cases/p01680/output.0.txt @@ -0,0 +1,3 @@ +3 +32 +607723520 diff --git a/codenet/public_test_cases/p01680/output.1.txt b/codenet/public_test_cases/p01680/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3966d66ac33b9e7fd09b643b84750ff8c90f25c --- /dev/null +++ b/codenet/public_test_cases/p01680/output.1.txt @@ -0,0 +1,3 @@ +3 +32 +607723520 diff --git a/codenet/public_test_cases/p01681/input.0.txt b/codenet/public_test_cases/p01681/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae1da9438a457edf2569ca7cf0c232701ab59053 --- /dev/null +++ b/codenet/public_test_cases/p01681/input.0.txt @@ -0,0 +1,7 @@ +4 +0 0 +-10 -10 +10 -10 +10 10 +-10 10 +0 diff --git a/codenet/public_test_cases/p01681/input.1.txt b/codenet/public_test_cases/p01681/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae1da9438a457edf2569ca7cf0c232701ab59053 --- /dev/null +++ b/codenet/public_test_cases/p01681/input.1.txt @@ -0,0 +1,7 @@ +4 +0 0 +-10 -10 +10 -10 +10 10 +-10 10 +0 diff --git a/codenet/public_test_cases/p01681/output.0.txt b/codenet/public_test_cases/p01681/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01681/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01681/output.1.txt b/codenet/public_test_cases/p01681/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01681/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01682/input.0.txt b/codenet/public_test_cases/p01682/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7db16c5c812d9f458e277144c4e0a4c11d5f35c --- /dev/null +++ b/codenet/public_test_cases/p01682/input.0.txt @@ -0,0 +1,6 @@ +S< S< 12 >> 2 > > +123 >> 1 >> 1 +1000000000 >>129 +S>>>> +S >> 11 >>> 10 > +# diff --git a/codenet/public_test_cases/p01682/input.1.txt b/codenet/public_test_cases/p01682/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7db16c5c812d9f458e277144c4e0a4c11d5f35c --- /dev/null +++ b/codenet/public_test_cases/p01682/input.1.txt @@ -0,0 +1,6 @@ +S< S< 12 >> 2 > > +123 >> 1 >> 1 +1000000000 >>129 +S>>>> +S >> 11 >>> 10 > +# diff --git a/codenet/public_test_cases/p01682/output.0.txt b/codenet/public_test_cases/p01682/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0ead9507f6d840a320918d29ce374270dd3d31d --- /dev/null +++ b/codenet/public_test_cases/p01682/output.0.txt @@ -0,0 +1,5 @@ +81 +30 +0 +294967268 +14592400 diff --git a/codenet/public_test_cases/p01682/output.1.txt b/codenet/public_test_cases/p01682/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0ead9507f6d840a320918d29ce374270dd3d31d --- /dev/null +++ b/codenet/public_test_cases/p01682/output.1.txt @@ -0,0 +1,5 @@ +81 +30 +0 +294967268 +14592400 diff --git a/codenet/public_test_cases/p01683/input.0.txt b/codenet/public_test_cases/p01683/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b10c77236290c7e3d5b2abb7c7669baa7fb54be --- /dev/null +++ b/codenet/public_test_cases/p01683/input.0.txt @@ -0,0 +1,27 @@ +4 +1 1 +8 2 +9 1 +14 2 +4 +181 4 +815 4 +634 4 +370 4 +4 +52 1 +40 1 +81 2 +73 1 +10 +330 1 +665 3 +260 1 +287 2 +196 3 +243 1 +815 1 +287 3 +330 1 +473 4 +0 diff --git a/codenet/public_test_cases/p01683/input.1.txt b/codenet/public_test_cases/p01683/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b10c77236290c7e3d5b2abb7c7669baa7fb54be --- /dev/null +++ b/codenet/public_test_cases/p01683/input.1.txt @@ -0,0 +1,27 @@ +4 +1 1 +8 2 +9 1 +14 2 +4 +181 4 +815 4 +634 4 +370 4 +4 +52 1 +40 1 +81 2 +73 1 +10 +330 1 +665 3 +260 1 +287 2 +196 3 +243 1 +815 1 +287 3 +330 1 +473 4 +0 diff --git a/codenet/public_test_cases/p01683/output.0.txt b/codenet/public_test_cases/p01683/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7900a6cca081188c20eec3dec629d6d8a355179f --- /dev/null +++ b/codenet/public_test_cases/p01683/output.0.txt @@ -0,0 +1,4 @@ +18 +634 +-1 +916 diff --git a/codenet/public_test_cases/p01683/output.1.txt b/codenet/public_test_cases/p01683/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7900a6cca081188c20eec3dec629d6d8a355179f --- /dev/null +++ b/codenet/public_test_cases/p01683/output.1.txt @@ -0,0 +1,4 @@ +18 +634 +-1 +916 diff --git a/codenet/public_test_cases/p01684/input.0.txt b/codenet/public_test_cases/p01684/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8d36f1f778d7cb1e0934dfcee38423f07c8a40b --- /dev/null +++ b/codenet/public_test_cases/p01684/input.0.txt @@ -0,0 +1,4 @@ +10 5 1 1 0 +10 5 2 2 1 +10 10 70 70 20 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01684/input.1.txt b/codenet/public_test_cases/p01684/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8d36f1f778d7cb1e0934dfcee38423f07c8a40b --- /dev/null +++ b/codenet/public_test_cases/p01684/input.1.txt @@ -0,0 +1,4 @@ +10 5 1 1 0 +10 5 2 2 1 +10 10 70 70 20 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01684/output.0.txt b/codenet/public_test_cases/p01684/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e30c4092eeabad392a98edfe8ba8ecd2497884b2 --- /dev/null +++ b/codenet/public_test_cases/p01684/output.0.txt @@ -0,0 +1,3 @@ +1 1 0.564189584 3 1 0.564189584 +1 1 0.797884561 1.644647246 1 0.797884561 +impossible diff --git a/codenet/public_test_cases/p01684/output.1.txt b/codenet/public_test_cases/p01684/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e30c4092eeabad392a98edfe8ba8ecd2497884b2 --- /dev/null +++ b/codenet/public_test_cases/p01684/output.1.txt @@ -0,0 +1,3 @@ +1 1 0.564189584 3 1 0.564189584 +1 1 0.797884561 1.644647246 1 0.797884561 +impossible diff --git a/codenet/public_test_cases/p01685/input.0.txt b/codenet/public_test_cases/p01685/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e112ab76dd59438a22ee39e9bc9838e302afc03f --- /dev/null +++ b/codenet/public_test_cases/p01685/input.0.txt @@ -0,0 +1,42 @@ +1 2 +BB + +WW + +2 1 +B +W + +B +W + +2 2 +BW +BW + +WW +WW + +3 4 +BBBB +BBBB +BBBB + +WWWW +WWWW +WWWW + +5 5 +BBBBB +BBBBB +BBBBB +BBBBB +BBBBB + +BBBBB +BBBWB +BBBBB +BWBBB +BBBBB + +0 0 diff --git a/codenet/public_test_cases/p01685/input.1.txt b/codenet/public_test_cases/p01685/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e112ab76dd59438a22ee39e9bc9838e302afc03f --- /dev/null +++ b/codenet/public_test_cases/p01685/input.1.txt @@ -0,0 +1,42 @@ +1 2 +BB + +WW + +2 1 +B +W + +B +W + +2 2 +BW +BW + +WW +WW + +3 4 +BBBB +BBBB +BBBB + +WWWW +WWWW +WWWW + +5 5 +BBBBB +BBBBB +BBBBB +BBBBB +BBBBB + +BBBBB +BBBWB +BBBBB +BWBBB +BBBBB + +0 0 diff --git a/codenet/public_test_cases/p01685/output.0.txt b/codenet/public_test_cases/p01685/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d78a4ba85e9119ca4adc9a2d30e48117772d65f --- /dev/null +++ b/codenet/public_test_cases/p01685/output.0.txt @@ -0,0 +1,5 @@ +6.0000000000 +0.0000000000 +12.8571428571 +120.0000000000 +23795493.8449918639 diff --git a/codenet/public_test_cases/p01685/output.1.txt b/codenet/public_test_cases/p01685/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d78a4ba85e9119ca4adc9a2d30e48117772d65f --- /dev/null +++ b/codenet/public_test_cases/p01685/output.1.txt @@ -0,0 +1,5 @@ +6.0000000000 +0.0000000000 +12.8571428571 +120.0000000000 +23795493.8449918639 diff --git a/codenet/public_test_cases/p01686/input.0.txt b/codenet/public_test_cases/p01686/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cd4e139f190a674e1133773ded4eafd4aa0ac52 --- /dev/null +++ b/codenet/public_test_cases/p01686/input.0.txt @@ -0,0 +1,25 @@ +3 +.aa.cA.Cc. +.bb.Bb.AC. +.cc.ac.Ab. +1 +.Xx. +.Yy. +.Zz. +6 +.Aj.fA.aW.zA.Jf.Gz. +.gW.GW.Fw.ZJ.AG.JW. +.bZ.jZ.Ga.Fj.gF.Za. +9 +.ab.gh.mn.st.yz.EF.KL.QR.WA. +.cd.ij.op.uv.AB.GH.MN.ST.XB. +.ef.kl.qr.wx.CD.IJ.OP.UV.yz. +2 +.AC.Mo. +.IC.PC. +.oA.CM. +20 +.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.qb. +.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb. +.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.qb. +0 diff --git a/codenet/public_test_cases/p01686/input.1.txt b/codenet/public_test_cases/p01686/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cd4e139f190a674e1133773ded4eafd4aa0ac52 --- /dev/null +++ b/codenet/public_test_cases/p01686/input.1.txt @@ -0,0 +1,25 @@ +3 +.aa.cA.Cc. +.bb.Bb.AC. +.cc.ac.Ab. +1 +.Xx. +.Yy. +.Zz. +6 +.Aj.fA.aW.zA.Jf.Gz. +.gW.GW.Fw.ZJ.AG.JW. +.bZ.jZ.Ga.Fj.gF.Za. +9 +.ab.gh.mn.st.yz.EF.KL.QR.WA. +.cd.ij.op.uv.AB.GH.MN.ST.XB. +.ef.kl.qr.wx.CD.IJ.OP.UV.yz. +2 +.AC.Mo. +.IC.PC. +.oA.CM. +20 +.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.qb. +.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb.qb. +.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.QB.qb. +0 diff --git a/codenet/public_test_cases/p01686/output.0.txt b/codenet/public_test_cases/p01686/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4979be47458b4476fec3faac6c3241b44b1e3f6 --- /dev/null +++ b/codenet/public_test_cases/p01686/output.0.txt @@ -0,0 +1,6 @@ +3 B C E +-1 +3 J A G +10 A B G H M N S T Y Z +0 +2 Q B diff --git a/codenet/public_test_cases/p01686/output.1.txt b/codenet/public_test_cases/p01686/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4979be47458b4476fec3faac6c3241b44b1e3f6 --- /dev/null +++ b/codenet/public_test_cases/p01686/output.1.txt @@ -0,0 +1,6 @@ +3 B C E +-1 +3 J A G +10 A B G H M N S T Y Z +0 +2 Q B diff --git a/codenet/public_test_cases/p01687/input.0.txt b/codenet/public_test_cases/p01687/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9139ca75d60396dc93e690e534bbcc554f1c608 --- /dev/null +++ b/codenet/public_test_cases/p01687/input.0.txt @@ -0,0 +1 @@ +AIDUNYAN diff --git a/codenet/public_test_cases/p01687/input.1.txt b/codenet/public_test_cases/p01687/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9139ca75d60396dc93e690e534bbcc554f1c608 --- /dev/null +++ b/codenet/public_test_cases/p01687/input.1.txt @@ -0,0 +1 @@ +AIDUNYAN diff --git a/codenet/public_test_cases/p01687/output.0.txt b/codenet/public_test_cases/p01687/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bd6e3ed4d025b9aedfe8ebdcc3543460ec50914 --- /dev/null +++ b/codenet/public_test_cases/p01687/output.0.txt @@ -0,0 +1 @@ +AIZUNYAN diff --git a/codenet/public_test_cases/p01687/output.1.txt b/codenet/public_test_cases/p01687/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bd6e3ed4d025b9aedfe8ebdcc3543460ec50914 --- /dev/null +++ b/codenet/public_test_cases/p01687/output.1.txt @@ -0,0 +1 @@ +AIZUNYAN diff --git a/codenet/public_test_cases/p01688/input.0.txt b/codenet/public_test_cases/p01688/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c8ea72405b4429594991b36b187152bd021f781 --- /dev/null +++ b/codenet/public_test_cases/p01688/input.0.txt @@ -0,0 +1,6 @@ +2 +3 +D 30 +D 50 +D 20 +0 diff --git a/codenet/public_test_cases/p01688/input.1.txt b/codenet/public_test_cases/p01688/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c8ea72405b4429594991b36b187152bd021f781 --- /dev/null +++ b/codenet/public_test_cases/p01688/input.1.txt @@ -0,0 +1,6 @@ +2 +3 +D 30 +D 50 +D 20 +0 diff --git a/codenet/public_test_cases/p01688/output.0.txt b/codenet/public_test_cases/p01688/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p01688/output.0.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p01688/output.1.txt b/codenet/public_test_cases/p01688/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p01688/output.1.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p01689/input.0.txt b/codenet/public_test_cases/p01689/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a980f3bcfc332cfe89569b329ecb63504c217589 --- /dev/null +++ b/codenet/public_test_cases/p01689/input.0.txt @@ -0,0 +1,12 @@ +6 10 3 4 +########## +#........# +#...D....# +#........# +#........# +########## +2 4 6 +3 2 0 +7 4 2 +8 4 3 +1 4 1 diff --git a/codenet/public_test_cases/p01689/input.1.txt b/codenet/public_test_cases/p01689/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a980f3bcfc332cfe89569b329ecb63504c217589 --- /dev/null +++ b/codenet/public_test_cases/p01689/input.1.txt @@ -0,0 +1,12 @@ +6 10 3 4 +########## +#........# +#...D....# +#........# +#........# +########## +2 4 6 +3 2 0 +7 4 2 +8 4 3 +1 4 1 diff --git a/codenet/public_test_cases/p01689/output.0.txt b/codenet/public_test_cases/p01689/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01689/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01689/output.1.txt b/codenet/public_test_cases/p01689/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01689/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01690/input.0.txt b/codenet/public_test_cases/p01690/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef854371f21ac20484f93d18c880b4d20d6c368f --- /dev/null +++ b/codenet/public_test_cases/p01690/input.0.txt @@ -0,0 +1,3 @@ +10 1 1 1 4 3 +6 10 +5 8 diff --git a/codenet/public_test_cases/p01690/input.1.txt b/codenet/public_test_cases/p01690/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef854371f21ac20484f93d18c880b4d20d6c368f --- /dev/null +++ b/codenet/public_test_cases/p01690/input.1.txt @@ -0,0 +1,3 @@ +10 1 1 1 4 3 +6 10 +5 8 diff --git a/codenet/public_test_cases/p01690/output.0.txt b/codenet/public_test_cases/p01690/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01690/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01690/output.1.txt b/codenet/public_test_cases/p01690/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01690/output.1.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01691/input.0.txt b/codenet/public_test_cases/p01691/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3341d214f25efc49c9e203417aeac31de06b4c2d --- /dev/null +++ b/codenet/public_test_cases/p01691/input.0.txt @@ -0,0 +1,2 @@ +1 0 +25 47 10 diff --git a/codenet/public_test_cases/p01691/input.1.txt b/codenet/public_test_cases/p01691/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3341d214f25efc49c9e203417aeac31de06b4c2d --- /dev/null +++ b/codenet/public_test_cases/p01691/input.1.txt @@ -0,0 +1,2 @@ +1 0 +25 47 10 diff --git a/codenet/public_test_cases/p01691/output.0.txt b/codenet/public_test_cases/p01691/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8a29e16aeb425352c667305012602e28fa52924 --- /dev/null +++ b/codenet/public_test_cases/p01691/output.0.txt @@ -0,0 +1 @@ +96.2027355887 diff --git a/codenet/public_test_cases/p01691/output.1.txt b/codenet/public_test_cases/p01691/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8a29e16aeb425352c667305012602e28fa52924 --- /dev/null +++ b/codenet/public_test_cases/p01691/output.1.txt @@ -0,0 +1 @@ +96.2027355887 diff --git a/codenet/public_test_cases/p01692/input.0.txt b/codenet/public_test_cases/p01692/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..40f5f434028697552673a03c85cae13cfa7f6a13 --- /dev/null +++ b/codenet/public_test_cases/p01692/input.0.txt @@ -0,0 +1,4 @@ +3 2 2 1 +0 3 6 +1 1 +3 -2 diff --git a/codenet/public_test_cases/p01692/input.1.txt b/codenet/public_test_cases/p01692/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..40f5f434028697552673a03c85cae13cfa7f6a13 --- /dev/null +++ b/codenet/public_test_cases/p01692/input.1.txt @@ -0,0 +1,4 @@ +3 2 2 1 +0 3 6 +1 1 +3 -2 diff --git a/codenet/public_test_cases/p01692/output.0.txt b/codenet/public_test_cases/p01692/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01692/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01692/output.1.txt b/codenet/public_test_cases/p01692/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01692/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01693/input.0.txt b/codenet/public_test_cases/p01693/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1441a89af9d89b59ae5d73b397b73fab6029596d --- /dev/null +++ b/codenet/public_test_cases/p01693/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 3 5 4 diff --git a/codenet/public_test_cases/p01693/input.1.txt b/codenet/public_test_cases/p01693/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1441a89af9d89b59ae5d73b397b73fab6029596d --- /dev/null +++ b/codenet/public_test_cases/p01693/input.1.txt @@ -0,0 +1,2 @@ +5 +1 2 3 5 4 diff --git a/codenet/public_test_cases/p01693/output.0.txt b/codenet/public_test_cases/p01693/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01693/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01693/output.1.txt b/codenet/public_test_cases/p01693/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01693/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01694/input.0.txt b/codenet/public_test_cases/p01694/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..421f78be72813e7fb87ad4ee6748926df4c0ec9c --- /dev/null +++ b/codenet/public_test_cases/p01694/input.0.txt @@ -0,0 +1,9 @@ +4 +lu ru ld rd +4 +lu ld lu ru +1 +lu +10 +ru lu ld rd ru rd ru lu rd ld +0 diff --git a/codenet/public_test_cases/p01694/input.1.txt b/codenet/public_test_cases/p01694/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..421f78be72813e7fb87ad4ee6748926df4c0ec9c --- /dev/null +++ b/codenet/public_test_cases/p01694/input.1.txt @@ -0,0 +1,9 @@ +4 +lu ru ld rd +4 +lu ld lu ru +1 +lu +10 +ru lu ld rd ru rd ru lu rd ld +0 diff --git a/codenet/public_test_cases/p01694/output.0.txt b/codenet/public_test_cases/p01694/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13e47a1323d9e9c2f67053865bbcd836746619f9 --- /dev/null +++ b/codenet/public_test_cases/p01694/output.0.txt @@ -0,0 +1,4 @@ +2 +1 +0 +4 diff --git a/codenet/public_test_cases/p01694/output.1.txt b/codenet/public_test_cases/p01694/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..13e47a1323d9e9c2f67053865bbcd836746619f9 --- /dev/null +++ b/codenet/public_test_cases/p01694/output.1.txt @@ -0,0 +1,4 @@ +2 +1 +0 +4 diff --git a/codenet/public_test_cases/p01695/input.0.txt b/codenet/public_test_cases/p01695/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..771760c377d4812d9fbe67445c41ea78dabfb422 --- /dev/null +++ b/codenet/public_test_cases/p01695/input.0.txt @@ -0,0 +1,30 @@ +6 +hoge +.fuga +..foobar +..jagjag +...zigzag +.piyo +8 +jagjag +.hogehoge +..fugafuga +...ponyoponyo +....evaeva +....pokemon +...nowawa +.buhihi +8 +hello +.goodmorning +..howareyou +.goodafternoon +..letshavealunch +.goodevening +.goodnight +..gotobed +3 +caution +.themessagelengthislessthanorequaltofifty +..sothelengthoftheentirelinecanexceedfiftycharacters +0 diff --git a/codenet/public_test_cases/p01695/input.1.txt b/codenet/public_test_cases/p01695/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..771760c377d4812d9fbe67445c41ea78dabfb422 --- /dev/null +++ b/codenet/public_test_cases/p01695/input.1.txt @@ -0,0 +1,30 @@ +6 +hoge +.fuga +..foobar +..jagjag +...zigzag +.piyo +8 +jagjag +.hogehoge +..fugafuga +...ponyoponyo +....evaeva +....pokemon +...nowawa +.buhihi +8 +hello +.goodmorning +..howareyou +.goodafternoon +..letshavealunch +.goodevening +.goodnight +..gotobed +3 +caution +.themessagelengthislessthanorequaltofifty +..sothelengthoftheentirelinecanexceedfiftycharacters +0 diff --git a/codenet/public_test_cases/p01695/output.0.txt b/codenet/public_test_cases/p01695/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0944af2cfca1a4b722bae46cd482e75af8d7ae80 --- /dev/null +++ b/codenet/public_test_cases/p01695/output.0.txt @@ -0,0 +1,25 @@ +hoge ++fuga +|+foobar +|+jagjag +| +zigzag ++piyo +jagjag ++hogehoge +|+fugafuga +| +ponyoponyo +| |+evaeva +| |+pokemon +| +nowawa ++buhihi +hello ++goodmorning +|+howareyou ++goodafternoon +|+letshavealunch ++goodevening ++goodnight + +gotobed +caution ++themessagelengthislessthanorequaltofifty + +sothelengthoftheentirelinecanexceedfiftycharacters diff --git a/codenet/public_test_cases/p01695/output.1.txt b/codenet/public_test_cases/p01695/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0944af2cfca1a4b722bae46cd482e75af8d7ae80 --- /dev/null +++ b/codenet/public_test_cases/p01695/output.1.txt @@ -0,0 +1,25 @@ +hoge ++fuga +|+foobar +|+jagjag +| +zigzag ++piyo +jagjag ++hogehoge +|+fugafuga +| +ponyoponyo +| |+evaeva +| |+pokemon +| +nowawa ++buhihi +hello ++goodmorning +|+howareyou ++goodafternoon +|+letshavealunch ++goodevening ++goodnight + +gotobed +caution ++themessagelengthislessthanorequaltofifty + +sothelengthoftheentirelinecanexceedfiftycharacters diff --git a/codenet/public_test_cases/p01696/input.0.txt b/codenet/public_test_cases/p01696/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc07027f1ab070880205b65283cf2e3990e960f8 --- /dev/null +++ b/codenet/public_test_cases/p01696/input.0.txt @@ -0,0 +1,7 @@ +A+A++A +Z-Z--Z+-Z +[ESREVER] +J---?---J +++++++++A+++Z-----------A+++Z +[[++-+--?[--++-?++-+++L]][-+-----+-O]]++++---+L +. diff --git a/codenet/public_test_cases/p01696/input.1.txt b/codenet/public_test_cases/p01696/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc07027f1ab070880205b65283cf2e3990e960f8 --- /dev/null +++ b/codenet/public_test_cases/p01696/input.1.txt @@ -0,0 +1,7 @@ +A+A++A +Z-Z--Z+-Z +[ESREVER] +J---?---J +++++++++A+++Z-----------A+++Z +[[++-+--?[--++-?++-+++L]][-+-----+-O]]++++---+L +. diff --git a/codenet/public_test_cases/p01696/output.0.txt b/codenet/public_test_cases/p01696/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d84bd5d36adf93d3437001b4b402f070373a6ea --- /dev/null +++ b/codenet/public_test_cases/p01696/output.0.txt @@ -0,0 +1,6 @@ +ABC +ZYXZ +REVERSE +JAG +ICPC +JAPAN diff --git a/codenet/public_test_cases/p01696/output.1.txt b/codenet/public_test_cases/p01696/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d84bd5d36adf93d3437001b4b402f070373a6ea --- /dev/null +++ b/codenet/public_test_cases/p01696/output.1.txt @@ -0,0 +1,6 @@ +ABC +ZYXZ +REVERSE +JAG +ICPC +JAPAN diff --git a/codenet/public_test_cases/p01697/input.0.txt b/codenet/public_test_cases/p01697/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3f747683af75d9712669170efc14e1fc4f83b1a --- /dev/null +++ b/codenet/public_test_cases/p01697/input.0.txt @@ -0,0 +1,53 @@ +3 3 3 2 +1 2 3 1 1 +1 3 8 1 1 +2 3 3 2 2 +1 3 +0 +3 3 2 2 +1 2 3 1 1 +1 3 8 1 1 +2 3 3 2 2 +1 3 +0 +6 4 3 2 +1 2 3 1 1 +1 3 8 1 1 +4 6 3 2 2 +5 6 7 2 2 +1 6 +0 +3 3 3 2 +1 2 3 1 1 +1 3 8 1 1 +2 3 3 2 2 +1 3 +2 +2 6 1 2 +1 2 2 +3 3 2 2 +1 2 3 1 1 +1 3 8 1 1 +2 3 3 2 2 +1 3 +2 +2 6 1 2 +1 2 2 +3 2 2 2 +1 2 3 1 1 +2 3 3 2 2 +1 3 +2 +2 6 1 2 +1 2 2 +5 4 20 4 +2 4 100 5 1 +1 4 100 5 3 +1 5 100 5 4 +3 5 100 5 2 +3 2 +3 +2 80 1 2 +2 60 1 3 +2 40 2 3 +0 0 0 0 diff --git a/codenet/public_test_cases/p01697/input.1.txt b/codenet/public_test_cases/p01697/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3f747683af75d9712669170efc14e1fc4f83b1a --- /dev/null +++ b/codenet/public_test_cases/p01697/input.1.txt @@ -0,0 +1,53 @@ +3 3 3 2 +1 2 3 1 1 +1 3 8 1 1 +2 3 3 2 2 +1 3 +0 +3 3 2 2 +1 2 3 1 1 +1 3 8 1 1 +2 3 3 2 2 +1 3 +0 +6 4 3 2 +1 2 3 1 1 +1 3 8 1 1 +4 6 3 2 2 +5 6 7 2 2 +1 6 +0 +3 3 3 2 +1 2 3 1 1 +1 3 8 1 1 +2 3 3 2 2 +1 3 +2 +2 6 1 2 +1 2 2 +3 3 2 2 +1 2 3 1 1 +1 3 8 1 1 +2 3 3 2 2 +1 3 +2 +2 6 1 2 +1 2 2 +3 2 2 2 +1 2 3 1 1 +2 3 3 2 2 +1 3 +2 +2 6 1 2 +1 2 2 +5 4 20 4 +2 4 100 5 1 +1 4 100 5 3 +1 5 100 5 4 +3 5 100 5 2 +3 2 +3 +2 80 1 2 +2 60 1 3 +2 40 2 3 +0 0 0 0 diff --git a/codenet/public_test_cases/p01697/output.0.txt b/codenet/public_test_cases/p01697/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e966247ab5878914a93ff45e2b9aa5e7077efb4e --- /dev/null +++ b/codenet/public_test_cases/p01697/output.0.txt @@ -0,0 +1,7 @@ +6 +8 +-1 +5 +6 +-1 +200 diff --git a/codenet/public_test_cases/p01697/output.1.txt b/codenet/public_test_cases/p01697/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e966247ab5878914a93ff45e2b9aa5e7077efb4e --- /dev/null +++ b/codenet/public_test_cases/p01697/output.1.txt @@ -0,0 +1,7 @@ +6 +8 +-1 +5 +6 +-1 +200 diff --git a/codenet/public_test_cases/p01698/input.0.txt b/codenet/public_test_cases/p01698/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d829169e9122dd9f385935206552461b4da24d4 --- /dev/null +++ b/codenet/public_test_cases/p01698/input.0.txt @@ -0,0 +1,40 @@ +1 +0.0000 0.0000 0.0000 2.0000 0.0000 0.0000 4.0000 1.0000 +2 +0.0000 0.0000 0.0000 2.0000 0.0000 0.0000 4.0000 1.0000 +10.0000 0.0000 0.0000 -2.0000 0.0000 0.0000 4.0000 1.0000 +5 +-10.0000 0.0000 0.0000 10.0000 0.0000 0.0000 2.0000 1.0000 +-5.0000 0.0000 0.0000 10.0000 0.0000 0.0000 2.0000 1.0000 +0.0000 0.0000 0.0000 10.0000 0.0000 0.0000 2.0000 1.0000 +11.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 100.0000 +15.0000 0.0000 0.0000 -10.0000 0.0000 0.0000 2.0000 1.0000 +27 +-45.6243 -40.4815 42.0513 -0.8380 -6.3628 4.5484 12.0279 2.2721 +8.7056 -9.8256 34.1560 6.0068 6.2527 -6.8506 28.9807 1.5037 +30.1481 29.9591 -46.2881 6.7611 8.6669 1.5629 14.5578 1.3181 +24.2927 8.3779 -21.8931 0.7074 0.1879 -8.9742 5.5877 2.6893 +25.3009 -42.9168 10.7480 -7.2477 -8.5507 7.7846 13.7923 2.8726 +17.6938 42.3577 -5.0334 6.4949 -2.1472 -5.3101 23.3066 1.4769 +-7.9296 -29.6442 -24.2157 -1.1064 -9.5802 6.5858 12.4250 2.3816 +9.5851 -20.0455 -35.1885 5.7477 -1.0622 2.5211 3.5233 1.2466 +-35.5762 44.5412 -46.7816 3.6053 0.4991 4.3470 20.6922 2.8529 +-44.9386 -48.0381 -43.6877 7.4101 3.9491 7.1619 10.4301 2.4920 +-49.9870 -28.6276 -2.6522 5.8008 -1.0054 -4.9061 25.1188 1.4916 +45.0228 31.3811 29.2546 -8.7777 -3.7836 -7.7180 17.4361 1.8706 +35.5553 45.8774 -29.8025 -7.3596 -9.2114 -3.5987 6.8841 2.6143 +19.9857 34.3874 42.5551 5.2133 -5.5350 -7.6617 2.9294 1.4026 +23.5109 18.1633 -34.8265 7.3260 -4.1912 5.3518 3.0036 1.5027 +43.5134 -27.5238 49.4679 -4.5986 1.8410 6.8741 2.2009 1.4525 +-28.8994 23.2934 -6.1914 5.7985 -6.2129 -8.2882 16.1683 1.7463 +3.6721 38.2528 -38.7741 4.5115 6.6442 6.4406 10.7555 1.0971 +17.4488 -12.6965 -23.1293 2.8257 6.3319 -1.5368 7.3785 2.9350 +33.2708 -17.9437 -0.5347 8.7428 7.3193 5.9738 6.2292 2.6210 +-14.4660 -25.1449 -4.4191 -9.4843 -6.6439 -4.7330 7.7910 2.1659 +32.4428 -24.2605 48.1228 -5.2396 1.5916 -5.9552 1.1760 1.3618 +-21.9088 43.6286 -8.8286 6.4641 0.5554 -4.6827 1.2504 1.4718 +-0.1784 -42.1729 -2.7193 5.3741 0.9098 9.7622 1.4764 1.2611 +29.3245 -33.2298 -26.3824 -8.4192 -2.9427 -7.3759 9.6346 1.7490 +-35.1767 35.9652 33.4779 4.0088 2.4579 2.0981 19.2565 1.7121 +-17.5530 1.4161 -14.0271 6.4564 -4.8261 -8.7461 3.0566 1.5906 +0 diff --git a/codenet/public_test_cases/p01698/input.1.txt b/codenet/public_test_cases/p01698/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d829169e9122dd9f385935206552461b4da24d4 --- /dev/null +++ b/codenet/public_test_cases/p01698/input.1.txt @@ -0,0 +1,40 @@ +1 +0.0000 0.0000 0.0000 2.0000 0.0000 0.0000 4.0000 1.0000 +2 +0.0000 0.0000 0.0000 2.0000 0.0000 0.0000 4.0000 1.0000 +10.0000 0.0000 0.0000 -2.0000 0.0000 0.0000 4.0000 1.0000 +5 +-10.0000 0.0000 0.0000 10.0000 0.0000 0.0000 2.0000 1.0000 +-5.0000 0.0000 0.0000 10.0000 0.0000 0.0000 2.0000 1.0000 +0.0000 0.0000 0.0000 10.0000 0.0000 0.0000 2.0000 1.0000 +11.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 100.0000 +15.0000 0.0000 0.0000 -10.0000 0.0000 0.0000 2.0000 1.0000 +27 +-45.6243 -40.4815 42.0513 -0.8380 -6.3628 4.5484 12.0279 2.2721 +8.7056 -9.8256 34.1560 6.0068 6.2527 -6.8506 28.9807 1.5037 +30.1481 29.9591 -46.2881 6.7611 8.6669 1.5629 14.5578 1.3181 +24.2927 8.3779 -21.8931 0.7074 0.1879 -8.9742 5.5877 2.6893 +25.3009 -42.9168 10.7480 -7.2477 -8.5507 7.7846 13.7923 2.8726 +17.6938 42.3577 -5.0334 6.4949 -2.1472 -5.3101 23.3066 1.4769 +-7.9296 -29.6442 -24.2157 -1.1064 -9.5802 6.5858 12.4250 2.3816 +9.5851 -20.0455 -35.1885 5.7477 -1.0622 2.5211 3.5233 1.2466 +-35.5762 44.5412 -46.7816 3.6053 0.4991 4.3470 20.6922 2.8529 +-44.9386 -48.0381 -43.6877 7.4101 3.9491 7.1619 10.4301 2.4920 +-49.9870 -28.6276 -2.6522 5.8008 -1.0054 -4.9061 25.1188 1.4916 +45.0228 31.3811 29.2546 -8.7777 -3.7836 -7.7180 17.4361 1.8706 +35.5553 45.8774 -29.8025 -7.3596 -9.2114 -3.5987 6.8841 2.6143 +19.9857 34.3874 42.5551 5.2133 -5.5350 -7.6617 2.9294 1.4026 +23.5109 18.1633 -34.8265 7.3260 -4.1912 5.3518 3.0036 1.5027 +43.5134 -27.5238 49.4679 -4.5986 1.8410 6.8741 2.2009 1.4525 +-28.8994 23.2934 -6.1914 5.7985 -6.2129 -8.2882 16.1683 1.7463 +3.6721 38.2528 -38.7741 4.5115 6.6442 6.4406 10.7555 1.0971 +17.4488 -12.6965 -23.1293 2.8257 6.3319 -1.5368 7.3785 2.9350 +33.2708 -17.9437 -0.5347 8.7428 7.3193 5.9738 6.2292 2.6210 +-14.4660 -25.1449 -4.4191 -9.4843 -6.6439 -4.7330 7.7910 2.1659 +32.4428 -24.2605 48.1228 -5.2396 1.5916 -5.9552 1.1760 1.3618 +-21.9088 43.6286 -8.8286 6.4641 0.5554 -4.6827 1.2504 1.4718 +-0.1784 -42.1729 -2.7193 5.3741 0.9098 9.7622 1.4764 1.2611 +29.3245 -33.2298 -26.3824 -8.4192 -2.9427 -7.3759 9.6346 1.7490 +-35.1767 35.9652 33.4779 4.0088 2.4579 2.0981 19.2565 1.7121 +-17.5530 1.4161 -14.0271 6.4564 -4.8261 -8.7461 3.0566 1.5906 +0 diff --git a/codenet/public_test_cases/p01698/output.0.txt b/codenet/public_test_cases/p01698/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d019ddecc1e8084c3d2729d606206f42a0c5165 --- /dev/null +++ b/codenet/public_test_cases/p01698/output.0.txt @@ -0,0 +1,35 @@ +4.0000000000 +1.0000000000 +1.0000000000 +2.0000000000 +2.0000000000 +0.6111111111 +0.0100000000 +0.6111111111 +5.2937370714 +0.3931996496 +11.0445337986 +2.0777525750 +4.8013298058 +0.0925901184 +5.2170809540 +2.8263276111 +7.2530407655 +4.1854333868 +0.2348376111 +1.0517364512 +0.0925901184 +1.0517364512 +1.9988021561 +1.5152495697 +9.2586039054 +9.8035730562 +2.5139693356 +2.3766501335 +0.2348376111 +0.3931996496 +0.8495719527 +1.1707239711 +5.5086335049 +11.2472986391 +1.9216647806 diff --git a/codenet/public_test_cases/p01698/output.1.txt b/codenet/public_test_cases/p01698/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d019ddecc1e8084c3d2729d606206f42a0c5165 --- /dev/null +++ b/codenet/public_test_cases/p01698/output.1.txt @@ -0,0 +1,35 @@ +4.0000000000 +1.0000000000 +1.0000000000 +2.0000000000 +2.0000000000 +0.6111111111 +0.0100000000 +0.6111111111 +5.2937370714 +0.3931996496 +11.0445337986 +2.0777525750 +4.8013298058 +0.0925901184 +5.2170809540 +2.8263276111 +7.2530407655 +4.1854333868 +0.2348376111 +1.0517364512 +0.0925901184 +1.0517364512 +1.9988021561 +1.5152495697 +9.2586039054 +9.8035730562 +2.5139693356 +2.3766501335 +0.2348376111 +0.3931996496 +0.8495719527 +1.1707239711 +5.5086335049 +11.2472986391 +1.9216647806 diff --git a/codenet/public_test_cases/p01699/input.0.txt b/codenet/public_test_cases/p01699/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4523319e153ceb52e0a220090f4deea10dc67c8 --- /dev/null +++ b/codenet/public_test_cases/p01699/input.0.txt @@ -0,0 +1,26 @@ +2 +1 11 +1 11 +3 +10 10 +2 2 +11 11 +4 +89 91 +1 12 +1 12 +89 91 +5 +1 8 +2 76 +10 19 +6 16 +33 42 +6 +10 59 +20 69 +30 79 +40 89 +50 99 +50 99 +0 diff --git a/codenet/public_test_cases/p01699/input.1.txt b/codenet/public_test_cases/p01699/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4523319e153ceb52e0a220090f4deea10dc67c8 --- /dev/null +++ b/codenet/public_test_cases/p01699/input.1.txt @@ -0,0 +1,26 @@ +2 +1 11 +1 11 +3 +10 10 +2 2 +11 11 +4 +89 91 +1 12 +1 12 +89 91 +5 +1 8 +2 76 +10 19 +6 16 +33 42 +6 +10 59 +20 69 +30 79 +40 89 +50 99 +50 99 +0 diff --git a/codenet/public_test_cases/p01699/output.0.txt b/codenet/public_test_cases/p01699/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ec64e8c03456d55961e5c4011fe65da8a1c4d3a --- /dev/null +++ b/codenet/public_test_cases/p01699/output.0.txt @@ -0,0 +1,5 @@ +120 +1 +1278 +659520 +15625000000 diff --git a/codenet/public_test_cases/p01699/output.1.txt b/codenet/public_test_cases/p01699/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ec64e8c03456d55961e5c4011fe65da8a1c4d3a --- /dev/null +++ b/codenet/public_test_cases/p01699/output.1.txt @@ -0,0 +1,5 @@ +120 +1 +1278 +659520 +15625000000 diff --git a/codenet/public_test_cases/p01700/input.0.txt b/codenet/public_test_cases/p01700/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc7f8f92fc0dcdd98c6a4373fcf48d9c12a73898 --- /dev/null +++ b/codenet/public_test_cases/p01700/input.0.txt @@ -0,0 +1,6 @@ +117649 +1 +125000 +1610612736 +68719476636 +-1 diff --git a/codenet/public_test_cases/p01700/input.1.txt b/codenet/public_test_cases/p01700/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc7f8f92fc0dcdd98c6a4373fcf48d9c12a73898 --- /dev/null +++ b/codenet/public_test_cases/p01700/input.1.txt @@ -0,0 +1,6 @@ +117649 +1 +125000 +1610612736 +68719476636 +-1 diff --git a/codenet/public_test_cases/p01700/output.0.txt b/codenet/public_test_cases/p01700/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3facbcf4adfce761280fd7b4e833ffa382e0bc54 --- /dev/null +++ b/codenet/public_test_cases/p01700/output.0.txt @@ -0,0 +1,5 @@ +3 +1 +4 +6 +11 diff --git a/codenet/public_test_cases/p01700/output.1.txt b/codenet/public_test_cases/p01700/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3facbcf4adfce761280fd7b4e833ffa382e0bc54 --- /dev/null +++ b/codenet/public_test_cases/p01700/output.1.txt @@ -0,0 +1,5 @@ +3 +1 +4 +6 +11 diff --git a/codenet/public_test_cases/p01701/input.0.txt b/codenet/public_test_cases/p01701/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4873de2ebc07e6612f42dc48456460c584dc89aa --- /dev/null +++ b/codenet/public_test_cases/p01701/input.0.txt @@ -0,0 +1,6 @@ +north +west +northwest +northnorthwest +westwestwestnorth +# diff --git a/codenet/public_test_cases/p01701/input.1.txt b/codenet/public_test_cases/p01701/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4873de2ebc07e6612f42dc48456460c584dc89aa --- /dev/null +++ b/codenet/public_test_cases/p01701/input.1.txt @@ -0,0 +1,6 @@ +north +west +northwest +northnorthwest +westwestwestnorth +# diff --git a/codenet/public_test_cases/p01701/output.0.txt b/codenet/public_test_cases/p01701/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa96e67ccbbfc3f91e42b29e35becc2b0ed406f2 --- /dev/null +++ b/codenet/public_test_cases/p01701/output.0.txt @@ -0,0 +1,5 @@ +0 +90 +45 +45/2 +315/4 diff --git a/codenet/public_test_cases/p01701/output.1.txt b/codenet/public_test_cases/p01701/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa96e67ccbbfc3f91e42b29e35becc2b0ed406f2 --- /dev/null +++ b/codenet/public_test_cases/p01701/output.1.txt @@ -0,0 +1,5 @@ +0 +90 +45 +45/2 +315/4 diff --git a/codenet/public_test_cases/p01702/input.0.txt b/codenet/public_test_cases/p01702/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a860567602025d4a14121f91dcfdedd864cb4010 --- /dev/null +++ b/codenet/public_test_cases/p01702/input.0.txt @@ -0,0 +1,20 @@ +3 10 3 +000 0000000000 +110 0000001111 +101 1111111100 +2 2 0 +1 1 0 +2 1 1 +01 1 +11 11 10 +10000000000 10000000000 +11000000000 01000000000 +01100000000 00100000000 +00110000000 00010000000 +00011000000 00001000000 +00001100000 00000100000 +00000110000 00000010000 +00000011000 00000001000 +00000001100 00000000100 +00000000110 00000000010 +0 0 0 diff --git a/codenet/public_test_cases/p01702/input.1.txt b/codenet/public_test_cases/p01702/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a860567602025d4a14121f91dcfdedd864cb4010 --- /dev/null +++ b/codenet/public_test_cases/p01702/input.1.txt @@ -0,0 +1,20 @@ +3 10 3 +000 0000000000 +110 0000001111 +101 1111111100 +2 2 0 +1 1 0 +2 1 1 +01 1 +11 11 10 +10000000000 10000000000 +11000000000 01000000000 +01100000000 00100000000 +00110000000 00010000000 +00011000000 00001000000 +00001100000 00000100000 +00000110000 00000010000 +00000011000 00000001000 +00000001100 00000000100 +00000000110 00000000010 +0 0 0 diff --git a/codenet/public_test_cases/p01702/output.0.txt b/codenet/public_test_cases/p01702/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1cc89510b50dc47f5a0c3f3f070a4e82e1b0fc7f --- /dev/null +++ b/codenet/public_test_cases/p01702/output.0.txt @@ -0,0 +1,5 @@ +2222221100 +?? +0 +1 +0123456789A diff --git a/codenet/public_test_cases/p01702/output.1.txt b/codenet/public_test_cases/p01702/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1cc89510b50dc47f5a0c3f3f070a4e82e1b0fc7f --- /dev/null +++ b/codenet/public_test_cases/p01702/output.1.txt @@ -0,0 +1,5 @@ +2222221100 +?? +0 +1 +0123456789A diff --git a/codenet/public_test_cases/p01703/input.0.txt b/codenet/public_test_cases/p01703/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12bf0f14f3a187bbe97b8e90d52149c802d6f3e2 --- /dev/null +++ b/codenet/public_test_cases/p01703/input.0.txt @@ -0,0 +1,7 @@ +2 +0.50 0.40 +2 +0.70 0.60 +4 +0.99 1.00 1.00 0.01 +0 diff --git a/codenet/public_test_cases/p01703/input.1.txt b/codenet/public_test_cases/p01703/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12bf0f14f3a187bbe97b8e90d52149c802d6f3e2 --- /dev/null +++ b/codenet/public_test_cases/p01703/input.1.txt @@ -0,0 +1,7 @@ +2 +0.50 0.40 +2 +0.70 0.60 +4 +0.99 1.00 1.00 0.01 +0 diff --git a/codenet/public_test_cases/p01703/output.0.txt b/codenet/public_test_cases/p01703/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52384092606d81109f8b31ee4bbf4c89a87b81a4 --- /dev/null +++ b/codenet/public_test_cases/p01703/output.0.txt @@ -0,0 +1,3 @@ +5.5000000000 +4.0476190476 +104.0101010101 diff --git a/codenet/public_test_cases/p01703/output.1.txt b/codenet/public_test_cases/p01703/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..52384092606d81109f8b31ee4bbf4c89a87b81a4 --- /dev/null +++ b/codenet/public_test_cases/p01703/output.1.txt @@ -0,0 +1,3 @@ +5.5000000000 +4.0476190476 +104.0101010101 diff --git a/codenet/public_test_cases/p01704/input.0.txt b/codenet/public_test_cases/p01704/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..201915467b92cd748e560383c6490e58809ef7ec --- /dev/null +++ b/codenet/public_test_cases/p01704/input.0.txt @@ -0,0 +1,21 @@ +3 +10 +4 3 4 10 +5 4 5 20 +6 5 6 30 +3 +7 +-4 3 4 -10 +5 4 5 20 +6 5 6 30 +3 +1 +-4 3 4 -10 +-5 4 5 -20 +6 5 6 30 +3 +10 +-4 3 4 -10 +-5 4 5 -20 +-6 5 6 -30 +0 diff --git a/codenet/public_test_cases/p01704/input.1.txt b/codenet/public_test_cases/p01704/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..201915467b92cd748e560383c6490e58809ef7ec --- /dev/null +++ b/codenet/public_test_cases/p01704/input.1.txt @@ -0,0 +1,21 @@ +3 +10 +4 3 4 10 +5 4 5 20 +6 5 6 30 +3 +7 +-4 3 4 -10 +5 4 5 20 +6 5 6 30 +3 +1 +-4 3 4 -10 +-5 4 5 -20 +6 5 6 30 +3 +10 +-4 3 4 -10 +-5 4 5 -20 +-6 5 6 -30 +0 diff --git a/codenet/public_test_cases/p01704/output.0.txt b/codenet/public_test_cases/p01704/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..68721034e3f79aec19dfe7f3b0d3e5655c6d78ed --- /dev/null +++ b/codenet/public_test_cases/p01704/output.0.txt @@ -0,0 +1,4 @@ +43.5 +36 +13.5 +0 diff --git a/codenet/public_test_cases/p01704/output.1.txt b/codenet/public_test_cases/p01704/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..68721034e3f79aec19dfe7f3b0d3e5655c6d78ed --- /dev/null +++ b/codenet/public_test_cases/p01704/output.1.txt @@ -0,0 +1,4 @@ +43.5 +36 +13.5 +0 diff --git a/codenet/public_test_cases/p01705/input.0.txt b/codenet/public_test_cases/p01705/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2634017b3d6f0f65ca93993b0ff83ef2bc948fad --- /dev/null +++ b/codenet/public_test_cases/p01705/input.0.txt @@ -0,0 +1,7 @@ +2 +0 8 +10 8 +2 +0 7 +10 7 +0 diff --git a/codenet/public_test_cases/p01705/input.1.txt b/codenet/public_test_cases/p01705/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2634017b3d6f0f65ca93993b0ff83ef2bc948fad --- /dev/null +++ b/codenet/public_test_cases/p01705/input.1.txt @@ -0,0 +1,7 @@ +2 +0 8 +10 8 +2 +0 7 +10 7 +0 diff --git a/codenet/public_test_cases/p01705/output.0.txt b/codenet/public_test_cases/p01705/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0233d28c22449202cc5e41759ba1bbaac6120c0d --- /dev/null +++ b/codenet/public_test_cases/p01705/output.0.txt @@ -0,0 +1,2 @@ +12.489995996796796 +9.899494936611665 diff --git a/codenet/public_test_cases/p01705/output.1.txt b/codenet/public_test_cases/p01705/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0233d28c22449202cc5e41759ba1bbaac6120c0d --- /dev/null +++ b/codenet/public_test_cases/p01705/output.1.txt @@ -0,0 +1,2 @@ +12.489995996796796 +9.899494936611665 diff --git a/codenet/public_test_cases/p01706/input.0.txt b/codenet/public_test_cases/p01706/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..43987b9193c93dc8b44d360ebe5f8a544986c9d9 --- /dev/null +++ b/codenet/public_test_cases/p01706/input.0.txt @@ -0,0 +1,58 @@ +4 4 1 4 +1 2 +3 1 +4 2 +3 4 +7 8 1 7 +1 2 +1 3 +2 4 +3 4 +4 5 +4 6 +5 7 +7 6 +6 4 5 2 +1 2 +1 3 +4 5 +5 6 +10 21 9 10 +9 1 +9 2 +9 3 +9 4 +10 1 +10 2 +10 3 +10 4 +1 5 +2 5 +2 6 +3 6 +3 7 +4 7 +4 8 +1 8 +5 10 +6 10 +7 10 +10 8 +10 9 +2 15 1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +0 0 0 0 diff --git a/codenet/public_test_cases/p01706/input.1.txt b/codenet/public_test_cases/p01706/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..43987b9193c93dc8b44d360ebe5f8a544986c9d9 --- /dev/null +++ b/codenet/public_test_cases/p01706/input.1.txt @@ -0,0 +1,58 @@ +4 4 1 4 +1 2 +3 1 +4 2 +3 4 +7 8 1 7 +1 2 +1 3 +2 4 +3 4 +4 5 +4 6 +5 7 +7 6 +6 4 5 2 +1 2 +1 3 +4 5 +5 6 +10 21 9 10 +9 1 +9 2 +9 3 +9 4 +10 1 +10 2 +10 3 +10 4 +1 5 +2 5 +2 6 +3 6 +3 7 +4 7 +4 8 +1 8 +5 10 +6 10 +7 10 +10 8 +10 9 +2 15 1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +1 2 +0 0 0 0 diff --git a/codenet/public_test_cases/p01706/output.0.txt b/codenet/public_test_cases/p01706/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8424b26b65eb99f64804146bfff668984ffdffc3 --- /dev/null +++ b/codenet/public_test_cases/p01706/output.0.txt @@ -0,0 +1,5 @@ +1 2 +2 1 +0 0 +4 6 +15 0 diff --git a/codenet/public_test_cases/p01706/output.1.txt b/codenet/public_test_cases/p01706/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8424b26b65eb99f64804146bfff668984ffdffc3 --- /dev/null +++ b/codenet/public_test_cases/p01706/output.1.txt @@ -0,0 +1,5 @@ +1 2 +2 1 +0 0 +4 6 +15 0 diff --git a/codenet/public_test_cases/p01707/input.0.txt b/codenet/public_test_cases/p01707/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..722b51b56c7e3d9d7d61b65422c58fb0c2257c52 --- /dev/null +++ b/codenet/public_test_cases/p01707/input.0.txt @@ -0,0 +1,7 @@ +5 2 5 +3 3 3 +5 4 5 +4 1 2 +1 5 1 +1250 50 50 +0 0 0 diff --git a/codenet/public_test_cases/p01707/input.1.txt b/codenet/public_test_cases/p01707/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..722b51b56c7e3d9d7d61b65422c58fb0c2257c52 --- /dev/null +++ b/codenet/public_test_cases/p01707/input.1.txt @@ -0,0 +1,7 @@ +5 2 5 +3 3 3 +5 4 5 +4 1 2 +1 5 1 +1250 50 50 +0 0 0 diff --git a/codenet/public_test_cases/p01707/output.0.txt b/codenet/public_test_cases/p01707/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..180b3467d88dbe6ab494c8dbe5ad18940b81b06e --- /dev/null +++ b/codenet/public_test_cases/p01707/output.0.txt @@ -0,0 +1,6 @@ +4 +7 +52 +0 +0 +563144298 diff --git a/codenet/public_test_cases/p01707/output.1.txt b/codenet/public_test_cases/p01707/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..180b3467d88dbe6ab494c8dbe5ad18940b81b06e --- /dev/null +++ b/codenet/public_test_cases/p01707/output.1.txt @@ -0,0 +1,6 @@ +4 +7 +52 +0 +0 +563144298 diff --git a/codenet/public_test_cases/p01708/input.0.txt b/codenet/public_test_cases/p01708/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d870f39051f593b4527715c913503928a9110599 --- /dev/null +++ b/codenet/public_test_cases/p01708/input.0.txt @@ -0,0 +1,7 @@ +((0,0)@(1,1))@((4,1)@(2,5)) +((0,0)@(3,1))@((1,-3)@(2,-1)) +(0,0)@(1,1)@(4,1) +(0,0)@((1,1)@(4,1)) +(((0,0)@((10,20)@(((30,40)))))) +((0,0)@(3,1))@((1,-3)@(2,-1))@(100,-100)@(100,100) +# diff --git a/codenet/public_test_cases/p01708/input.1.txt b/codenet/public_test_cases/p01708/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d870f39051f593b4527715c913503928a9110599 --- /dev/null +++ b/codenet/public_test_cases/p01708/input.1.txt @@ -0,0 +1,7 @@ +((0,0)@(1,1))@((4,1)@(2,5)) +((0,0)@(3,1))@((1,-3)@(2,-1)) +(0,0)@(1,1)@(4,1) +(0,0)@((1,1)@(4,1)) +(((0,0)@((10,20)@(((30,40)))))) +((0,0)@(3,1))@((1,-3)@(2,-1))@(100,-100)@(100,100) +# diff --git a/codenet/public_test_cases/p01708/output.0.txt b/codenet/public_test_cases/p01708/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb46be3ba4c6454d8f04aa8baf19cfa66c6da3fa --- /dev/null +++ b/codenet/public_test_cases/p01708/output.0.txt @@ -0,0 +1,6 @@ +3.00000000 3.00000000 +3.00000000 1.00000000 +1.00000000 4.00000000 +0.00000000 2.00000000 +-10.00000000 10.00000000 +-99.83681795 -91.92248853 diff --git a/codenet/public_test_cases/p01708/output.1.txt b/codenet/public_test_cases/p01708/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb46be3ba4c6454d8f04aa8baf19cfa66c6da3fa --- /dev/null +++ b/codenet/public_test_cases/p01708/output.1.txt @@ -0,0 +1,6 @@ +3.00000000 3.00000000 +3.00000000 1.00000000 +1.00000000 4.00000000 +0.00000000 2.00000000 +-10.00000000 10.00000000 +-99.83681795 -91.92248853 diff --git a/codenet/public_test_cases/p01709/input.0.txt b/codenet/public_test_cases/p01709/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7cced8febbfaf100022ce1e055bb29672c30a44 --- /dev/null +++ b/codenet/public_test_cases/p01709/input.0.txt @@ -0,0 +1,174 @@ +1 +3 +0 0 +1 0 +0 1 +4 +4 +0 0 +10 0 +10 10 +0 10 +4 +10 0 +20 0 +20 10 +10 10 +4 +0 10 +10 10 +10 20 +0 20 +4 +10 10 +20 10 +20 20 +10 20 +3 +4 +-10 -10 +2 2 +10 10 +-11 7 +3 +-1 -1 +1 -1 +0 0 +3 +0 0 +3 -3 +20 20 +7 +4 +46 12 +52 12 +53 15 +45 15 +32 +67 1 +70 0 +73 1 +77 3 +79 5 +80 8 +77 8 +76 5 +74 4 +71 3 +70 3 +67 4 +65 6 +63 8 +62 14 +64 19 +66 21 +70 22 +75 21 +78 16 +80 16 +80 17 +79 20 +78 22 +74 24 +67 24 +63 22 +61 19 +60 15 +60 10 +62 5 +64 3 +5 +74 14 +80 14 +80 16 +78 16 +74 16 +19 +34 0 +37 0 +37 19 +36 22 +35 23 +32 24 +30 24 +27 24 +25 23 +23 20 +23 18 +23 15 +26 15 +26 18 +27 20 +29 21 +32 21 +34 20 +34 18 +4 +47 0 +50 0 +42 24 +39 24 +4 +79 20 +80 17 +80 22 +78 22 +4 +50 0 +58 24 +56 24 +49 3 +4 +10 +34 21 +34 14 +35 14 +35 19 +40 19 +40 20 +35 20 +35 22 +30 22 +30 21 +16 +20 24 +21 24 +21 33 +42 33 +42 20 +40 20 +40 19 +45 19 +45 5 +40 5 +40 4 +46 4 +46 20 +43 20 +43 34 +20 34 +10 +26 21 +26 14 +27 14 +27 21 +30 21 +30 22 +21 22 +21 24 +20 24 +20 21 +12 +34 8 +34 4 +40 4 +40 5 +35 5 +35 14 +34 14 +34 9 +27 9 +27 14 +26 14 +26 8 +0 diff --git a/codenet/public_test_cases/p01709/input.1.txt b/codenet/public_test_cases/p01709/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7cced8febbfaf100022ce1e055bb29672c30a44 --- /dev/null +++ b/codenet/public_test_cases/p01709/input.1.txt @@ -0,0 +1,174 @@ +1 +3 +0 0 +1 0 +0 1 +4 +4 +0 0 +10 0 +10 10 +0 10 +4 +10 0 +20 0 +20 10 +10 10 +4 +0 10 +10 10 +10 20 +0 20 +4 +10 10 +20 10 +20 20 +10 20 +3 +4 +-10 -10 +2 2 +10 10 +-11 7 +3 +-1 -1 +1 -1 +0 0 +3 +0 0 +3 -3 +20 20 +7 +4 +46 12 +52 12 +53 15 +45 15 +32 +67 1 +70 0 +73 1 +77 3 +79 5 +80 8 +77 8 +76 5 +74 4 +71 3 +70 3 +67 4 +65 6 +63 8 +62 14 +64 19 +66 21 +70 22 +75 21 +78 16 +80 16 +80 17 +79 20 +78 22 +74 24 +67 24 +63 22 +61 19 +60 15 +60 10 +62 5 +64 3 +5 +74 14 +80 14 +80 16 +78 16 +74 16 +19 +34 0 +37 0 +37 19 +36 22 +35 23 +32 24 +30 24 +27 24 +25 23 +23 20 +23 18 +23 15 +26 15 +26 18 +27 20 +29 21 +32 21 +34 20 +34 18 +4 +47 0 +50 0 +42 24 +39 24 +4 +79 20 +80 17 +80 22 +78 22 +4 +50 0 +58 24 +56 24 +49 3 +4 +10 +34 21 +34 14 +35 14 +35 19 +40 19 +40 20 +35 20 +35 22 +30 22 +30 21 +16 +20 24 +21 24 +21 33 +42 33 +42 20 +40 20 +40 19 +45 19 +45 5 +40 5 +40 4 +46 4 +46 20 +43 20 +43 34 +20 34 +10 +26 21 +26 14 +27 14 +27 21 +30 21 +30 22 +21 22 +21 24 +20 24 +20 21 +12 +34 8 +34 4 +40 4 +40 5 +35 5 +35 14 +34 14 +34 9 +27 9 +27 14 +26 14 +26 8 +0 diff --git a/codenet/public_test_cases/p01709/output.0.txt b/codenet/public_test_cases/p01709/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de670dc1c44d369020a645d30fa494e93f831077 --- /dev/null +++ b/codenet/public_test_cases/p01709/output.0.txt @@ -0,0 +1,5 @@ +1 +2 +3 +3 +4 diff --git a/codenet/public_test_cases/p01709/output.1.txt b/codenet/public_test_cases/p01709/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de670dc1c44d369020a645d30fa494e93f831077 --- /dev/null +++ b/codenet/public_test_cases/p01709/output.1.txt @@ -0,0 +1,5 @@ +1 +2 +3 +3 +4 diff --git a/codenet/public_test_cases/p01710/input.0.txt b/codenet/public_test_cases/p01710/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c78e62431627001f4b971b7064a8b24783e6c64d --- /dev/null +++ b/codenet/public_test_cases/p01710/input.0.txt @@ -0,0 +1,40 @@ +5 4 10 +4 3 1 +6 4 3 +3 2 4 +2 2 1 +8 5 3 +1 2 +2 3 +3 4 +4 5 +3 3 1000 +1000 1 100 +1 7 100 +10 9 100 +1 2 +2 3 +3 2 +1 0 5 +25 25 2 +1 0 25 +25 25 2 +5 5 100 +1 1 20 +1 1 20 +10 1 1 +10 1 1 +10 1 1 +1 2 +2 1 +3 4 +4 5 +5 3 +3 3 100 +70 20 10 +50 15 20 +90 10 10 +1 2 +2 2 +2 3 +0 0 0 diff --git a/codenet/public_test_cases/p01710/input.1.txt b/codenet/public_test_cases/p01710/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c78e62431627001f4b971b7064a8b24783e6c64d --- /dev/null +++ b/codenet/public_test_cases/p01710/input.1.txt @@ -0,0 +1,40 @@ +5 4 10 +4 3 1 +6 4 3 +3 2 4 +2 2 1 +8 5 3 +1 2 +2 3 +3 4 +4 5 +3 3 1000 +1000 1 100 +1 7 100 +10 9 100 +1 2 +2 3 +3 2 +1 0 5 +25 25 2 +1 0 25 +25 25 2 +5 5 100 +1 1 20 +1 1 20 +10 1 1 +10 1 1 +10 1 1 +1 2 +2 1 +3 4 +4 5 +5 3 +3 3 100 +70 20 10 +50 15 20 +90 10 10 +1 2 +2 2 +2 3 +0 0 0 diff --git a/codenet/public_test_cases/p01710/output.0.txt b/codenet/public_test_cases/p01710/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd47c41f69d48ae3c9099772b5ae5f1b01698920 --- /dev/null +++ b/codenet/public_test_cases/p01710/output.0.txt @@ -0,0 +1,6 @@ +15 +2014 +0 +25 +40 +390 diff --git a/codenet/public_test_cases/p01710/output.1.txt b/codenet/public_test_cases/p01710/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd47c41f69d48ae3c9099772b5ae5f1b01698920 --- /dev/null +++ b/codenet/public_test_cases/p01710/output.1.txt @@ -0,0 +1,6 @@ +15 +2014 +0 +25 +40 +390 diff --git a/codenet/public_test_cases/p01711/input.0.txt b/codenet/public_test_cases/p01711/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4af121361fcb274536cebdd0a5669da0360fbd72 --- /dev/null +++ b/codenet/public_test_cases/p01711/input.0.txt @@ -0,0 +1,4 @@ +00000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000111111111 +10000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111 +01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 +# diff --git a/codenet/public_test_cases/p01711/input.1.txt b/codenet/public_test_cases/p01711/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4af121361fcb274536cebdd0a5669da0360fbd72 --- /dev/null +++ b/codenet/public_test_cases/p01711/input.1.txt @@ -0,0 +1,4 @@ +00000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000111111111 +10000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111 +01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 +# diff --git a/codenet/public_test_cases/p01711/output.0.txt b/codenet/public_test_cases/p01711/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..07d92f55e50e8b2e1dc8d6ab8474727be13423d2 --- /dev/null +++ b/codenet/public_test_cases/p01711/output.0.txt @@ -0,0 +1,3 @@ +yes +yes +no diff --git a/codenet/public_test_cases/p01711/output.1.txt b/codenet/public_test_cases/p01711/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..07d92f55e50e8b2e1dc8d6ab8474727be13423d2 --- /dev/null +++ b/codenet/public_test_cases/p01711/output.1.txt @@ -0,0 +1,3 @@ +yes +yes +no diff --git a/codenet/public_test_cases/p01712/input.0.txt b/codenet/public_test_cases/p01712/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..89d68a73be094a183ca400cdc6800987fe7482e3 --- /dev/null +++ b/codenet/public_test_cases/p01712/input.0.txt @@ -0,0 +1,4 @@ +3 9 9 +2 2 2 +5 5 2 +8 8 2 diff --git a/codenet/public_test_cases/p01712/output.0.txt b/codenet/public_test_cases/p01712/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01712/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01713/input.0.txt b/codenet/public_test_cases/p01713/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c489cc09738285cd679474eb23e9f340b28b3f1 --- /dev/null +++ b/codenet/public_test_cases/p01713/input.0.txt @@ -0,0 +1,2 @@ +7 +2 0 -2 3 2 -2 0 diff --git a/codenet/public_test_cases/p01713/output.0.txt b/codenet/public_test_cases/p01713/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01713/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01714/input.0.txt b/codenet/public_test_cases/p01714/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b42234e052c040e20c69326637d1fe3f742f1159 --- /dev/null +++ b/codenet/public_test_cases/p01714/input.0.txt @@ -0,0 +1,6 @@ +5 +0 0 0 0 +1 0 -1 1 +-1 0 1 -1 +1 1 -1 1 +-1 -1 1 -1 diff --git a/codenet/public_test_cases/p01714/output.0.txt b/codenet/public_test_cases/p01714/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01714/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01715/input.0.txt b/codenet/public_test_cases/p01715/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5013de0465aa01c5ecf48f6bbdf67fae2af3d81 --- /dev/null +++ b/codenet/public_test_cases/p01715/input.0.txt @@ -0,0 +1,4 @@ +2 2 1 +1 5 +0 1 +0 2 diff --git a/codenet/public_test_cases/p01715/output.0.txt b/codenet/public_test_cases/p01715/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01715/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01716/input.0.txt b/codenet/public_test_cases/p01716/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc5a5304b4476190e87efd92a2218ed3ff3eed50 --- /dev/null +++ b/codenet/public_test_cases/p01716/input.0.txt @@ -0,0 +1,3 @@ +3 1 +a1a +a 99 diff --git a/codenet/public_test_cases/p01716/output.0.txt b/codenet/public_test_cases/p01716/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p01716/output.0.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p01717/input.0.txt b/codenet/public_test_cases/p01717/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83c4832c5826be6d766932d8972e50e917914753 --- /dev/null +++ b/codenet/public_test_cases/p01717/input.0.txt @@ -0,0 +1,6 @@ +6 5 4 +2 1 1 +2 5 2 +5 1 1 +4 3 2 +3 6 -1 diff --git a/codenet/public_test_cases/p01717/output.0.txt b/codenet/public_test_cases/p01717/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01717/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01718/input.0.txt b/codenet/public_test_cases/p01718/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca1d95ebdd7a3a85e1e997d857b032f4e42e9aca --- /dev/null +++ b/codenet/public_test_cases/p01718/input.0.txt @@ -0,0 +1,4 @@ +5 2 +5 1 2 3 4 +1 1 +2 4 diff --git a/codenet/public_test_cases/p01718/output.0.txt b/codenet/public_test_cases/p01718/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaee3d96eb61e035efe8dc4bb04579bfa8eb72e8 --- /dev/null +++ b/codenet/public_test_cases/p01718/output.0.txt @@ -0,0 +1,2 @@ +15 +45 diff --git a/codenet/public_test_cases/p01719/input.0.txt b/codenet/public_test_cases/p01719/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..914d5ddd5c70a886bbd37968131c76d0a10bd00e --- /dev/null +++ b/codenet/public_test_cases/p01719/input.0.txt @@ -0,0 +1,3 @@ +2 2 5 +3 2 +5 4 diff --git a/codenet/public_test_cases/p01719/input.1.txt b/codenet/public_test_cases/p01719/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d36819e64423bf15d7e51f6d560d35060a3750d2 --- /dev/null +++ b/codenet/public_test_cases/p01719/input.1.txt @@ -0,0 +1,3 @@ +1 2 5 +6 +10000 diff --git a/codenet/public_test_cases/p01719/input.2.txt b/codenet/public_test_cases/p01719/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6923c6dec9ea5e8365091414ebea6b663b459b1d --- /dev/null +++ b/codenet/public_test_cases/p01719/input.2.txt @@ -0,0 +1,4 @@ +2 3 5 +4 5 +6 3 +8 5 diff --git a/codenet/public_test_cases/p01719/input.3.txt b/codenet/public_test_cases/p01719/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3e33724c3558a1cd3afa6bdea2f9d4920de8fc1 --- /dev/null +++ b/codenet/public_test_cases/p01719/input.3.txt @@ -0,0 +1,4 @@ +3 3 10 +10 9 6 +8 7 3 +7 5 1 diff --git a/codenet/public_test_cases/p01719/input.4.txt b/codenet/public_test_cases/p01719/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..914d5ddd5c70a886bbd37968131c76d0a10bd00e --- /dev/null +++ b/codenet/public_test_cases/p01719/input.4.txt @@ -0,0 +1,3 @@ +2 2 5 +3 2 +5 4 diff --git a/codenet/public_test_cases/p01719/output.0.txt b/codenet/public_test_cases/p01719/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01719/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01719/output.1.txt b/codenet/public_test_cases/p01719/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01719/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01719/output.2.txt b/codenet/public_test_cases/p01719/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p01719/output.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p01719/output.3.txt b/codenet/public_test_cases/p01719/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01719/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01719/output.4.txt b/codenet/public_test_cases/p01719/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01719/output.4.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01720/input.0.txt b/codenet/public_test_cases/p01720/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..908f2b3e6e94a3c846527c327c896e77d19a614d --- /dev/null +++ b/codenet/public_test_cases/p01720/input.0.txt @@ -0,0 +1,3 @@ +3 2 1 3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p01720/input.1.txt b/codenet/public_test_cases/p01720/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c2e34d6da450b72a4e0b019b3a8faebe7fb1172 --- /dev/null +++ b/codenet/public_test_cases/p01720/input.1.txt @@ -0,0 +1,4 @@ +4 3 1 4 +1 2 +3 4 +4 1 diff --git a/codenet/public_test_cases/p01720/input.2.txt b/codenet/public_test_cases/p01720/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d3d22a0c27e5422a2c31b6872d59411c08f9ed9 --- /dev/null +++ b/codenet/public_test_cases/p01720/input.2.txt @@ -0,0 +1,8 @@ +9 7 8 9 +9 6 +6 5 +3 6 +3 7 +2 5 +8 5 +1 4 diff --git a/codenet/public_test_cases/p01720/input.3.txt b/codenet/public_test_cases/p01720/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..346e265ee42f519eff500e8be9390812711ca458 --- /dev/null +++ b/codenet/public_test_cases/p01720/input.3.txt @@ -0,0 +1,9 @@ +9 8 7 8 +2 6 +4 9 +8 6 +9 2 +3 8 +1 8 +8 5 +7 9 diff --git a/codenet/public_test_cases/p01720/input.4.txt b/codenet/public_test_cases/p01720/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..908f2b3e6e94a3c846527c327c896e77d19a614d --- /dev/null +++ b/codenet/public_test_cases/p01720/input.4.txt @@ -0,0 +1,3 @@ +3 2 1 3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p01720/output.0.txt b/codenet/public_test_cases/p01720/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01720/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01720/output.1.txt b/codenet/public_test_cases/p01720/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01720/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01720/output.2.txt b/codenet/public_test_cases/p01720/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01720/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01720/output.3.txt b/codenet/public_test_cases/p01720/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01720/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01720/output.4.txt b/codenet/public_test_cases/p01720/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01720/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01721/input.0.txt b/codenet/public_test_cases/p01721/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80300f6da3863ab12cb8310c6e08dbbbc921cd74 --- /dev/null +++ b/codenet/public_test_cases/p01721/input.0.txt @@ -0,0 +1 @@ +10 10 1 10 3 3 7 7 diff --git a/codenet/public_test_cases/p01721/input.1.txt b/codenet/public_test_cases/p01721/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3ad10f2e778286e04764711691f74e389698ce7 --- /dev/null +++ b/codenet/public_test_cases/p01721/input.1.txt @@ -0,0 +1 @@ +2 3 1000 1000 1 1 1 2 diff --git a/codenet/public_test_cases/p01721/input.2.txt b/codenet/public_test_cases/p01721/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d69a944a97eb8f19bd0afa8e2e318c719794c579 --- /dev/null +++ b/codenet/public_test_cases/p01721/input.2.txt @@ -0,0 +1 @@ +10 10 1 11 3 3 7 7 diff --git a/codenet/public_test_cases/p01721/input.3.txt b/codenet/public_test_cases/p01721/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..80300f6da3863ab12cb8310c6e08dbbbc921cd74 --- /dev/null +++ b/codenet/public_test_cases/p01721/input.3.txt @@ -0,0 +1 @@ +10 10 1 10 3 3 7 7 diff --git a/codenet/public_test_cases/p01721/output.0.txt b/codenet/public_test_cases/p01721/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01721/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01721/output.1.txt b/codenet/public_test_cases/p01721/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8328d52d36be8a1d38a4d3137446ec090d0cd28d --- /dev/null +++ b/codenet/public_test_cases/p01721/output.1.txt @@ -0,0 +1 @@ +523598775681 diff --git a/codenet/public_test_cases/p01721/output.2.txt b/codenet/public_test_cases/p01721/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01721/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01721/output.3.txt b/codenet/public_test_cases/p01721/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01721/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01722/input.0.txt b/codenet/public_test_cases/p01722/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01722/input.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01722/input.1.txt b/codenet/public_test_cases/p01722/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01722/input.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01722/input.2.txt b/codenet/public_test_cases/p01722/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01722/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01722/input.3.txt b/codenet/public_test_cases/p01722/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01722/input.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01722/output.0.txt b/codenet/public_test_cases/p01722/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01722/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01722/output.1.txt b/codenet/public_test_cases/p01722/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01722/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01722/output.2.txt b/codenet/public_test_cases/p01722/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01722/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01722/output.3.txt b/codenet/public_test_cases/p01722/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01722/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01723/input.0.txt b/codenet/public_test_cases/p01723/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba9779434586e5ff69d9adf12ef034606095b476 --- /dev/null +++ b/codenet/public_test_cases/p01723/input.0.txt @@ -0,0 +1,3 @@ +3 +0 1 +1 2 diff --git a/codenet/public_test_cases/p01723/input.1.txt b/codenet/public_test_cases/p01723/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01723/input.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01723/input.2.txt b/codenet/public_test_cases/p01723/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..50af179477f031a88b9b6012bd8cefd7068f9ed0 --- /dev/null +++ b/codenet/public_test_cases/p01723/input.2.txt @@ -0,0 +1,3 @@ +3 +0 1 +0 2 diff --git a/codenet/public_test_cases/p01723/input.3.txt b/codenet/public_test_cases/p01723/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3bf5e51d16f5f9d5f482f579399ae46bd188023 --- /dev/null +++ b/codenet/public_test_cases/p01723/input.3.txt @@ -0,0 +1,7 @@ +7 +0 1 +1 2 +2 3 +3 4 +0 5 +0 6 diff --git a/codenet/public_test_cases/p01723/input.4.txt b/codenet/public_test_cases/p01723/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba9779434586e5ff69d9adf12ef034606095b476 --- /dev/null +++ b/codenet/public_test_cases/p01723/input.4.txt @@ -0,0 +1,3 @@ +3 +0 1 +1 2 diff --git a/codenet/public_test_cases/p01723/output.0.txt b/codenet/public_test_cases/p01723/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01723/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01723/output.1.txt b/codenet/public_test_cases/p01723/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01723/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01723/output.2.txt b/codenet/public_test_cases/p01723/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01723/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01723/output.3.txt b/codenet/public_test_cases/p01723/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fe4e495fed81a962c91dde803eb5bbe3aa14261 --- /dev/null +++ b/codenet/public_test_cases/p01723/output.3.txt @@ -0,0 +1 @@ +91 diff --git a/codenet/public_test_cases/p01723/output.4.txt b/codenet/public_test_cases/p01723/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01723/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01724/input.0.txt b/codenet/public_test_cases/p01724/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a009a38990b9e41d5807c5475600a0b9891052 --- /dev/null +++ b/codenet/public_test_cases/p01724/input.0.txt @@ -0,0 +1,19 @@ +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +......O........ +......X........ diff --git a/codenet/public_test_cases/p01724/input.1.txt b/codenet/public_test_cases/p01724/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38f71c39b9f62ccc219df4cc26c846cd3274a1b1 --- /dev/null +++ b/codenet/public_test_cases/p01724/input.1.txt @@ -0,0 +1,19 @@ +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +.....XX........ +.....XXXO...... +......X........ diff --git a/codenet/public_test_cases/p01724/input.2.txt b/codenet/public_test_cases/p01724/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac818bd2fc64dbfb60d28a7797c59fcf0dce223 --- /dev/null +++ b/codenet/public_test_cases/p01724/input.2.txt @@ -0,0 +1,19 @@ +............... +............... +............... +............... +............... +............... +............... +............... +...........O... +............X.. +.............X. +.............X. +.............X. +............... +..............X +.........X..... +.............X. +......X....X..X +.....X.X.XX.X.. diff --git a/codenet/public_test_cases/p01724/input.3.txt b/codenet/public_test_cases/p01724/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a009a38990b9e41d5807c5475600a0b9891052 --- /dev/null +++ b/codenet/public_test_cases/p01724/input.3.txt @@ -0,0 +1,19 @@ +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +......O........ +......X........ diff --git a/codenet/public_test_cases/p01724/input.4.txt b/codenet/public_test_cases/p01724/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a083ceec48991ca6dd324cdff04424252ad4bcd --- /dev/null +++ b/codenet/public_test_cases/p01724/input.4.txt @@ -0,0 +1,19 @@ +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +......O........ +............... diff --git a/codenet/public_test_cases/p01724/output.0.txt b/codenet/public_test_cases/p01724/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01724/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01724/output.1.txt b/codenet/public_test_cases/p01724/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01724/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01724/output.2.txt b/codenet/public_test_cases/p01724/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01724/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01724/output.3.txt b/codenet/public_test_cases/p01724/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01724/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01724/output.4.txt b/codenet/public_test_cases/p01724/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01724/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01725/input.0.txt b/codenet/public_test_cases/p01725/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d27923491e4756694dfff9a0c6d22a67fc0a1fa5 --- /dev/null +++ b/codenet/public_test_cases/p01725/input.0.txt @@ -0,0 +1 @@ +3-2*3 diff --git a/codenet/public_test_cases/p01725/input.1.txt b/codenet/public_test_cases/p01725/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6020ca84320c97810158841c43a4904b4a94ce3 --- /dev/null +++ b/codenet/public_test_cases/p01725/input.1.txt @@ -0,0 +1 @@ +1-2+3-4+5-6*0 diff --git a/codenet/public_test_cases/p01725/input.2.txt b/codenet/public_test_cases/p01725/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..06de3ebe124646d3fa21407b9c8bea7723c9eca5 --- /dev/null +++ b/codenet/public_test_cases/p01725/input.2.txt @@ -0,0 +1 @@ +(1989967-3*1-211+4487) diff --git a/codenet/public_test_cases/p01725/input.3.txt b/codenet/public_test_cases/p01725/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d27923491e4756694dfff9a0c6d22a67fc0a1fa5 --- /dev/null +++ b/codenet/public_test_cases/p01725/input.3.txt @@ -0,0 +1 @@ +3-2*3 diff --git a/codenet/public_test_cases/p01725/input.4.txt b/codenet/public_test_cases/p01725/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ddcfe59365679f5915afddff1e84627d74a60cd --- /dev/null +++ b/codenet/public_test_cases/p01725/input.4.txt @@ -0,0 +1 @@ +(5-3*4)*(0-2+1) diff --git a/codenet/public_test_cases/p01725/output.0.txt b/codenet/public_test_cases/p01725/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01725/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01725/output.1.txt b/codenet/public_test_cases/p01725/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01725/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01725/output.2.txt b/codenet/public_test_cases/p01725/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab05da30a58db5a76e2045616bc3d026d06047ff --- /dev/null +++ b/codenet/public_test_cases/p01725/output.2.txt @@ -0,0 +1 @@ +8511076028 diff --git a/codenet/public_test_cases/p01725/output.3.txt b/codenet/public_test_cases/p01725/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01725/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01725/output.4.txt b/codenet/public_test_cases/p01725/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p01725/output.4.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p01726/input.0.txt b/codenet/public_test_cases/p01726/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e21338cea37342fc9ea73204295c0f3380b46b87 --- /dev/null +++ b/codenet/public_test_cases/p01726/input.0.txt @@ -0,0 +1,2 @@ +abcbcdbc +abc diff --git a/codenet/public_test_cases/p01726/input.1.txt b/codenet/public_test_cases/p01726/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af2a7e7afb019f5c95a385bc0fc066b013dd28f6 --- /dev/null +++ b/codenet/public_test_cases/p01726/input.1.txt @@ -0,0 +1,2 @@ +aaaaaa +aaaaaa diff --git a/codenet/public_test_cases/p01726/input.2.txt b/codenet/public_test_cases/p01726/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e21338cea37342fc9ea73204295c0f3380b46b87 --- /dev/null +++ b/codenet/public_test_cases/p01726/input.2.txt @@ -0,0 +1,2 @@ +abcbcdbc +abc diff --git a/codenet/public_test_cases/p01726/input.3.txt b/codenet/public_test_cases/p01726/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f2f6958cf1d804349a6b6e4872bb79de42cae97 --- /dev/null +++ b/codenet/public_test_cases/p01726/input.3.txt @@ -0,0 +1,2 @@ +baaaaaaaa +b diff --git a/codenet/public_test_cases/p01726/output.0.txt b/codenet/public_test_cases/p01726/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01726/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01726/output.1.txt b/codenet/public_test_cases/p01726/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01726/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01726/output.2.txt b/codenet/public_test_cases/p01726/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01726/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01726/output.3.txt b/codenet/public_test_cases/p01726/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01726/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01727/input.0.txt b/codenet/public_test_cases/p01727/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1665fd756b8290984b9c5ec495ef90b1522f8900 --- /dev/null +++ b/codenet/public_test_cases/p01727/input.0.txt @@ -0,0 +1,5 @@ +4 10000 00101 +Q +A 0 +B 1 +Q diff --git a/codenet/public_test_cases/p01727/input.1.txt b/codenet/public_test_cases/p01727/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..901e69fde20b334d774fb28051f994df72d3f5fb --- /dev/null +++ b/codenet/public_test_cases/p01727/input.1.txt @@ -0,0 +1,10 @@ +9 0110111101 0010100111 +Q +B 4 +Q +A 4 +Q +B 9 +Q +A 8 +Q diff --git a/codenet/public_test_cases/p01727/input.2.txt b/codenet/public_test_cases/p01727/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1665fd756b8290984b9c5ec495ef90b1522f8900 --- /dev/null +++ b/codenet/public_test_cases/p01727/input.2.txt @@ -0,0 +1,5 @@ +4 10000 00101 +Q +A 0 +B 1 +Q diff --git a/codenet/public_test_cases/p01727/output.0.txt b/codenet/public_test_cases/p01727/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b94473479cd96f84ea5fdd389a9f4f9d3786b8c1 --- /dev/null +++ b/codenet/public_test_cases/p01727/output.0.txt @@ -0,0 +1,2 @@ +3 +4 diff --git a/codenet/public_test_cases/p01727/output.1.txt b/codenet/public_test_cases/p01727/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..21787c5d3947aadba4d191ba83fafe9f3fbe4355 --- /dev/null +++ b/codenet/public_test_cases/p01727/output.1.txt @@ -0,0 +1,5 @@ +9 +9 +9 +10 +9 diff --git a/codenet/public_test_cases/p01727/output.2.txt b/codenet/public_test_cases/p01727/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b94473479cd96f84ea5fdd389a9f4f9d3786b8c1 --- /dev/null +++ b/codenet/public_test_cases/p01727/output.2.txt @@ -0,0 +1,2 @@ +3 +4 diff --git a/codenet/public_test_cases/p01728/input.0.txt b/codenet/public_test_cases/p01728/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b028bab9b9839b31cc32ec425a4d1db0f3e75dc --- /dev/null +++ b/codenet/public_test_cases/p01728/input.0.txt @@ -0,0 +1,8 @@ +1 2 +3 3 +2 -1 +4 +1 0 1 5 +0 1 4 1 +0 4 6 4 +5 0 5 5 diff --git a/codenet/public_test_cases/p01728/input.1.txt b/codenet/public_test_cases/p01728/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed2ba5dce2b750ce39d79fed9285a03962954ab --- /dev/null +++ b/codenet/public_test_cases/p01728/input.1.txt @@ -0,0 +1,8 @@ +1 2 +3 3 +2 -1 +4 +1 0 1 5 +0 1 6 1 +0 4 6 4 +5 0 5 5 diff --git a/codenet/public_test_cases/p01728/input.2.txt b/codenet/public_test_cases/p01728/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..056cb5d4c535d679ad0c650e04133ad07de14288 --- /dev/null +++ b/codenet/public_test_cases/p01728/input.2.txt @@ -0,0 +1,9 @@ +1 4 +3 3 +7 0 +5 +1 0 1 5 +0 1 6 1 +0 4 6 4 +8 0 2 5 +6 0 4 2 diff --git a/codenet/public_test_cases/p01728/input.3.txt b/codenet/public_test_cases/p01728/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..872859ece37a7ab31fcd2fcc48eb1ff922f9055d --- /dev/null +++ b/codenet/public_test_cases/p01728/input.3.txt @@ -0,0 +1,9 @@ +2 2 +4 2 +4 5 +5 +1 5 2 0 +0 4 3 4 +0 1 8 1 +7 0 7 5 +8 4 5 4 diff --git a/codenet/public_test_cases/p01728/input.4.txt b/codenet/public_test_cases/p01728/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b028bab9b9839b31cc32ec425a4d1db0f3e75dc --- /dev/null +++ b/codenet/public_test_cases/p01728/input.4.txt @@ -0,0 +1,8 @@ +1 2 +3 3 +2 -1 +4 +1 0 1 5 +0 1 4 1 +0 4 6 4 +5 0 5 5 diff --git a/codenet/public_test_cases/p01728/output.0.txt b/codenet/public_test_cases/p01728/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01728/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01728/output.1.txt b/codenet/public_test_cases/p01728/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01728/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01728/output.2.txt b/codenet/public_test_cases/p01728/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01728/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01728/output.3.txt b/codenet/public_test_cases/p01728/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01728/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01728/output.4.txt b/codenet/public_test_cases/p01728/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01728/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01729/input.0.txt b/codenet/public_test_cases/p01729/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3d120ea7ddbbdc245618987915ee96a89fe6f6b --- /dev/null +++ b/codenet/public_test_cases/p01729/input.0.txt @@ -0,0 +1,3 @@ +3 +3 -1 4 +2 1 3 diff --git a/codenet/public_test_cases/p01729/input.1.txt b/codenet/public_test_cases/p01729/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3d120ea7ddbbdc245618987915ee96a89fe6f6b --- /dev/null +++ b/codenet/public_test_cases/p01729/input.1.txt @@ -0,0 +1,3 @@ +3 +3 -1 4 +2 1 3 diff --git a/codenet/public_test_cases/p01729/input.2.txt b/codenet/public_test_cases/p01729/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b50cd574d02508d433cadcce9da0e790d9e46752 --- /dev/null +++ b/codenet/public_test_cases/p01729/input.2.txt @@ -0,0 +1,3 @@ +4 +3 -1 -1 3 +1 1 1 1 diff --git a/codenet/public_test_cases/p01729/input.3.txt b/codenet/public_test_cases/p01729/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..63d8306c3ce6f7836757884f32165a3e56ac37a4 --- /dev/null +++ b/codenet/public_test_cases/p01729/input.3.txt @@ -0,0 +1,3 @@ +3 +3 -1 4 +2 1 5 diff --git a/codenet/public_test_cases/p01729/output.0.txt b/codenet/public_test_cases/p01729/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01729/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01729/output.1.txt b/codenet/public_test_cases/p01729/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01729/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01729/output.2.txt b/codenet/public_test_cases/p01729/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01729/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01729/output.3.txt b/codenet/public_test_cases/p01729/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01729/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01730/input.0.txt b/codenet/public_test_cases/p01730/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6344f0c69b5665d264b445b5a6ab0be4bb2f01d1 --- /dev/null +++ b/codenet/public_test_cases/p01730/input.0.txt @@ -0,0 +1,4 @@ +3 +5 10 +-10 0 +3 -10 diff --git a/codenet/public_test_cases/p01730/input.1.txt b/codenet/public_test_cases/p01730/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff249d6bf33bc320728da8ed80dafca181d6b9ee --- /dev/null +++ b/codenet/public_test_cases/p01730/input.1.txt @@ -0,0 +1,5 @@ +4 +100000000 100000000 +100000000 -100000000 +-100000000 100000000 +-100000000 -100000000 diff --git a/codenet/public_test_cases/p01730/input.2.txt b/codenet/public_test_cases/p01730/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..87b4f446d515929ffb3246b749b159523f726e20 --- /dev/null +++ b/codenet/public_test_cases/p01730/input.2.txt @@ -0,0 +1,3 @@ +2 +0 0 +0 1 diff --git a/codenet/public_test_cases/p01730/input.3.txt b/codenet/public_test_cases/p01730/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6344f0c69b5665d264b445b5a6ab0be4bb2f01d1 --- /dev/null +++ b/codenet/public_test_cases/p01730/input.3.txt @@ -0,0 +1,4 @@ +3 +5 10 +-10 0 +3 -10 diff --git a/codenet/public_test_cases/p01730/output.0.txt b/codenet/public_test_cases/p01730/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01730/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01730/output.1.txt b/codenet/public_test_cases/p01730/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c3c110b3563bd0fda8762ea7a3225a367e845cf --- /dev/null +++ b/codenet/public_test_cases/p01730/output.1.txt @@ -0,0 +1 @@ +200000000 diff --git a/codenet/public_test_cases/p01730/output.2.txt b/codenet/public_test_cases/p01730/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb3c4fe4eebcdea3da0790cc0ba74cb286ec4f4 --- /dev/null +++ b/codenet/public_test_cases/p01730/output.2.txt @@ -0,0 +1 @@ +0.5 diff --git a/codenet/public_test_cases/p01730/output.3.txt b/codenet/public_test_cases/p01730/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01730/output.3.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01731/input.0.txt b/codenet/public_test_cases/p01731/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ff05f0de897a32e47abcb49a661fa4e52fd4cb9 --- /dev/null +++ b/codenet/public_test_cases/p01731/input.0.txt @@ -0,0 +1,3 @@ +1 +0 +icpc diff --git a/codenet/public_test_cases/p01731/input.1.txt b/codenet/public_test_cases/p01731/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ff05f0de897a32e47abcb49a661fa4e52fd4cb9 --- /dev/null +++ b/codenet/public_test_cases/p01731/input.1.txt @@ -0,0 +1,3 @@ +1 +0 +icpc diff --git a/codenet/public_test_cases/p01731/output.0.txt b/codenet/public_test_cases/p01731/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64018ccc57118406dba49cf6f0ce63ae2466b806 --- /dev/null +++ b/codenet/public_test_cases/p01731/output.0.txt @@ -0,0 +1 @@ +icpc diff --git a/codenet/public_test_cases/p01731/output.1.txt b/codenet/public_test_cases/p01731/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64018ccc57118406dba49cf6f0ce63ae2466b806 --- /dev/null +++ b/codenet/public_test_cases/p01731/output.1.txt @@ -0,0 +1 @@ +icpc diff --git a/codenet/public_test_cases/p01732/input.0.txt b/codenet/public_test_cases/p01732/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aec7a2c3b4e8572c8b431c04cbf4ef04f1977c3d --- /dev/null +++ b/codenet/public_test_cases/p01732/input.0.txt @@ -0,0 +1,4 @@ +3 3 1 +1 1 3 3 +0 0 +1 RRDDLLUU diff --git a/codenet/public_test_cases/p01732/input.1.txt b/codenet/public_test_cases/p01732/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aec7a2c3b4e8572c8b431c04cbf4ef04f1977c3d --- /dev/null +++ b/codenet/public_test_cases/p01732/input.1.txt @@ -0,0 +1,4 @@ +3 3 1 +1 1 3 3 +0 0 +1 RRDDLLUU diff --git a/codenet/public_test_cases/p01732/output.0.txt b/codenet/public_test_cases/p01732/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01732/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01732/output.1.txt b/codenet/public_test_cases/p01732/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01732/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01733/input.0.txt b/codenet/public_test_cases/p01733/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2216a78668e233923fbcd0273215d8ba9fe6e1b --- /dev/null +++ b/codenet/public_test_cases/p01733/input.0.txt @@ -0,0 +1,3 @@ +2 +1 1 2 +2 2 3 diff --git a/codenet/public_test_cases/p01733/input.1.txt b/codenet/public_test_cases/p01733/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2216a78668e233923fbcd0273215d8ba9fe6e1b --- /dev/null +++ b/codenet/public_test_cases/p01733/input.1.txt @@ -0,0 +1,3 @@ +2 +1 1 2 +2 2 3 diff --git a/codenet/public_test_cases/p01733/output.0.txt b/codenet/public_test_cases/p01733/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30991c6153f990a4294990dead241f308937d741 --- /dev/null +++ b/codenet/public_test_cases/p01733/output.0.txt @@ -0,0 +1 @@ +5 / 1 diff --git a/codenet/public_test_cases/p01733/output.1.txt b/codenet/public_test_cases/p01733/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..30991c6153f990a4294990dead241f308937d741 --- /dev/null +++ b/codenet/public_test_cases/p01733/output.1.txt @@ -0,0 +1 @@ +5 / 1 diff --git a/codenet/public_test_cases/p01734/input.0.txt b/codenet/public_test_cases/p01734/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c533dfcaaa367d6a08bb06ed9c6cb0d264421a0 --- /dev/null +++ b/codenet/public_test_cases/p01734/input.0.txt @@ -0,0 +1,4 @@ +3 +26 29 9 12 +6 10 15 16 +8 17 18 19 diff --git a/codenet/public_test_cases/p01734/input.1.txt b/codenet/public_test_cases/p01734/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c533dfcaaa367d6a08bb06ed9c6cb0d264421a0 --- /dev/null +++ b/codenet/public_test_cases/p01734/input.1.txt @@ -0,0 +1,4 @@ +3 +26 29 9 12 +6 10 15 16 +8 17 18 19 diff --git a/codenet/public_test_cases/p01734/output.0.txt b/codenet/public_test_cases/p01734/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01734/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01734/output.1.txt b/codenet/public_test_cases/p01734/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01734/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01735/input.0.txt b/codenet/public_test_cases/p01735/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8042e5db220ad41644d92ec418af32c922651b82 --- /dev/null +++ b/codenet/public_test_cases/p01735/input.0.txt @@ -0,0 +1,5 @@ +3 +0 1 1 +2 2 3 +0 +0 diff --git a/codenet/public_test_cases/p01735/input.1.txt b/codenet/public_test_cases/p01735/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8042e5db220ad41644d92ec418af32c922651b82 --- /dev/null +++ b/codenet/public_test_cases/p01735/input.1.txt @@ -0,0 +1,5 @@ +3 +0 1 1 +2 2 3 +0 +0 diff --git a/codenet/public_test_cases/p01735/output.0.txt b/codenet/public_test_cases/p01735/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p01735/output.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p01735/output.1.txt b/codenet/public_test_cases/p01735/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p01735/output.1.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p01736/input.0.txt b/codenet/public_test_cases/p01736/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f5e141ebd10af6ee078f4edfe55ca86c755d513 --- /dev/null +++ b/codenet/public_test_cases/p01736/input.0.txt @@ -0,0 +1,6 @@ +2 +1 1 +0 1 +1 +1 +1 diff --git a/codenet/public_test_cases/p01736/input.1.txt b/codenet/public_test_cases/p01736/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f5e141ebd10af6ee078f4edfe55ca86c755d513 --- /dev/null +++ b/codenet/public_test_cases/p01736/input.1.txt @@ -0,0 +1,6 @@ +2 +1 1 +0 1 +1 +1 +1 diff --git a/codenet/public_test_cases/p01736/output.0.txt b/codenet/public_test_cases/p01736/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e8183b72e5ed9b26e9e2c64bb6bc849b23b0690 --- /dev/null +++ b/codenet/public_test_cases/p01736/output.0.txt @@ -0,0 +1 @@ +0 1 diff --git a/codenet/public_test_cases/p01736/output.1.txt b/codenet/public_test_cases/p01736/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e8183b72e5ed9b26e9e2c64bb6bc849b23b0690 --- /dev/null +++ b/codenet/public_test_cases/p01736/output.1.txt @@ -0,0 +1 @@ +0 1 diff --git a/codenet/public_test_cases/p01737/input.0.txt b/codenet/public_test_cases/p01737/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7d765dac1b40890eb5e010f4a317760e56c16e7 --- /dev/null +++ b/codenet/public_test_cases/p01737/input.0.txt @@ -0,0 +1,3 @@ +2 1 1 9 -1 +2 2 1 1 -9 1 +1 2 -1 -1 9 -1 diff --git a/codenet/public_test_cases/p01737/input.1.txt b/codenet/public_test_cases/p01737/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7d765dac1b40890eb5e010f4a317760e56c16e7 --- /dev/null +++ b/codenet/public_test_cases/p01737/input.1.txt @@ -0,0 +1,3 @@ +2 1 1 9 -1 +2 2 1 1 -9 1 +1 2 -1 -1 9 -1 diff --git a/codenet/public_test_cases/p01737/output.0.txt b/codenet/public_test_cases/p01737/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01737/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01737/output.1.txt b/codenet/public_test_cases/p01737/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01737/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01738/input.0.txt b/codenet/public_test_cases/p01738/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b652e7bcf0eb3bacefb65f2c9c35d7dcb4ccece4 --- /dev/null +++ b/codenet/public_test_cases/p01738/input.0.txt @@ -0,0 +1,5 @@ +3 3 +2 4 1 2 1 +XAX +B.B +XAX diff --git a/codenet/public_test_cases/p01738/input.1.txt b/codenet/public_test_cases/p01738/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b652e7bcf0eb3bacefb65f2c9c35d7dcb4ccece4 --- /dev/null +++ b/codenet/public_test_cases/p01738/input.1.txt @@ -0,0 +1,5 @@ +3 3 +2 4 1 2 1 +XAX +B.B +XAX diff --git a/codenet/public_test_cases/p01738/output.0.txt b/codenet/public_test_cases/p01738/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..510f863f6c30012c106afaf93b3d4d40fef0a6d0 --- /dev/null +++ b/codenet/public_test_cases/p01738/output.0.txt @@ -0,0 +1 @@ +0.0000000000000 diff --git a/codenet/public_test_cases/p01738/output.1.txt b/codenet/public_test_cases/p01738/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..510f863f6c30012c106afaf93b3d4d40fef0a6d0 --- /dev/null +++ b/codenet/public_test_cases/p01738/output.1.txt @@ -0,0 +1 @@ +0.0000000000000 diff --git a/codenet/public_test_cases/p01739/input.0.txt b/codenet/public_test_cases/p01739/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..edc0c8f6d12ebcc6e367c6416ce16668fd40b926 --- /dev/null +++ b/codenet/public_test_cases/p01739/input.0.txt @@ -0,0 +1,3 @@ +2 +1 2 2 +0 diff --git a/codenet/public_test_cases/p01739/input.1.txt b/codenet/public_test_cases/p01739/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..edc0c8f6d12ebcc6e367c6416ce16668fd40b926 --- /dev/null +++ b/codenet/public_test_cases/p01739/input.1.txt @@ -0,0 +1,3 @@ +2 +1 2 2 +0 diff --git a/codenet/public_test_cases/p01739/output.0.txt b/codenet/public_test_cases/p01739/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01739/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01739/output.1.txt b/codenet/public_test_cases/p01739/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01739/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01740/input.0.txt b/codenet/public_test_cases/p01740/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..faf572502b6ba129259401b6ba398fc9447ffa54 --- /dev/null +++ b/codenet/public_test_cases/p01740/input.0.txt @@ -0,0 +1,6 @@ +3 +.oo +o.. + +o.o +o.. diff --git a/codenet/public_test_cases/p01740/input.1.txt b/codenet/public_test_cases/p01740/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..faf572502b6ba129259401b6ba398fc9447ffa54 --- /dev/null +++ b/codenet/public_test_cases/p01740/input.1.txt @@ -0,0 +1,6 @@ +3 +.oo +o.. + +o.o +o.. diff --git a/codenet/public_test_cases/p01740/output.0.txt b/codenet/public_test_cases/p01740/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01740/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01740/output.1.txt b/codenet/public_test_cases/p01740/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01740/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01741/input.0.txt b/codenet/public_test_cases/p01741/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3db567e036fb210cd8f3cde455bb8d00d5e460ee --- /dev/null +++ b/codenet/public_test_cases/p01741/input.0.txt @@ -0,0 +1 @@ +1.000 diff --git a/codenet/public_test_cases/p01741/input.1.txt b/codenet/public_test_cases/p01741/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3db567e036fb210cd8f3cde455bb8d00d5e460ee --- /dev/null +++ b/codenet/public_test_cases/p01741/input.1.txt @@ -0,0 +1 @@ +1.000 diff --git a/codenet/public_test_cases/p01741/input.2.txt b/codenet/public_test_cases/p01741/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..058d74bf00a24a8166fdfd6f2e3efd7939ee33d0 --- /dev/null +++ b/codenet/public_test_cases/p01741/input.2.txt @@ -0,0 +1 @@ +2.345 diff --git a/codenet/public_test_cases/p01741/output.0.txt b/codenet/public_test_cases/p01741/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4334303ce77e6db2a8781ed7290433fbe585583e --- /dev/null +++ b/codenet/public_test_cases/p01741/output.0.txt @@ -0,0 +1 @@ +2.000000000000 diff --git a/codenet/public_test_cases/p01741/output.1.txt b/codenet/public_test_cases/p01741/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4334303ce77e6db2a8781ed7290433fbe585583e --- /dev/null +++ b/codenet/public_test_cases/p01741/output.1.txt @@ -0,0 +1 @@ +2.000000000000 diff --git a/codenet/public_test_cases/p01741/output.2.txt b/codenet/public_test_cases/p01741/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c6165f668c08102e5e356d9e3ca368c9be1ecda --- /dev/null +++ b/codenet/public_test_cases/p01741/output.2.txt @@ -0,0 +1 @@ +3.316330803765 diff --git a/codenet/public_test_cases/p01742/input.0.txt b/codenet/public_test_cases/p01742/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f870600832c40ecd190035f34074e3a63a1f7e7 --- /dev/null +++ b/codenet/public_test_cases/p01742/input.0.txt @@ -0,0 +1,3 @@ +2 +?sum??mer +c??a??mp diff --git a/codenet/public_test_cases/p01742/input.1.txt b/codenet/public_test_cases/p01742/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f870600832c40ecd190035f34074e3a63a1f7e7 --- /dev/null +++ b/codenet/public_test_cases/p01742/input.1.txt @@ -0,0 +1,3 @@ +2 +?sum??mer +c??a??mp diff --git a/codenet/public_test_cases/p01742/input.2.txt b/codenet/public_test_cases/p01742/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ebbb6b53fc58ac2f34de3dba470e2c1e330b315 --- /dev/null +++ b/codenet/public_test_cases/p01742/input.2.txt @@ -0,0 +1,4 @@ +3 +snuje +????e +snule diff --git a/codenet/public_test_cases/p01742/output.0.txt b/codenet/public_test_cases/p01742/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d98c4fe4471d5fae622dc102324a6606a4c3ed89 --- /dev/null +++ b/codenet/public_test_cases/p01742/output.0.txt @@ -0,0 +1 @@ +703286064 diff --git a/codenet/public_test_cases/p01742/output.1.txt b/codenet/public_test_cases/p01742/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d98c4fe4471d5fae622dc102324a6606a4c3ed89 --- /dev/null +++ b/codenet/public_test_cases/p01742/output.1.txt @@ -0,0 +1 @@ +703286064 diff --git a/codenet/public_test_cases/p01742/output.2.txt b/codenet/public_test_cases/p01742/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01742/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01743/input.0.txt b/codenet/public_test_cases/p01743/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e8a2de2dbc74e6f8e500591f14858fef93ccd1b --- /dev/null +++ b/codenet/public_test_cases/p01743/input.0.txt @@ -0,0 +1,3 @@ +2 +3 +3 diff --git a/codenet/public_test_cases/p01743/input.1.txt b/codenet/public_test_cases/p01743/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a984100568ed886ced74081caac838e0892f8bf --- /dev/null +++ b/codenet/public_test_cases/p01743/input.1.txt @@ -0,0 +1,6 @@ +5 +2 +3 +4 +5 +6 diff --git a/codenet/public_test_cases/p01743/input.2.txt b/codenet/public_test_cases/p01743/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e8a2de2dbc74e6f8e500591f14858fef93ccd1b --- /dev/null +++ b/codenet/public_test_cases/p01743/input.2.txt @@ -0,0 +1,3 @@ +2 +3 +3 diff --git a/codenet/public_test_cases/p01743/output.0.txt b/codenet/public_test_cases/p01743/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01743/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01743/output.1.txt b/codenet/public_test_cases/p01743/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p01743/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p01743/output.2.txt b/codenet/public_test_cases/p01743/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01743/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01744/input.0.txt b/codenet/public_test_cases/p01744/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6e6afb1312ef1404fa7d5713d2ab5201ae5e1b2 --- /dev/null +++ b/codenet/public_test_cases/p01744/input.0.txt @@ -0,0 +1,2 @@ +4 4 1 +3 3 diff --git a/codenet/public_test_cases/p01744/input.1.txt b/codenet/public_test_cases/p01744/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6e6afb1312ef1404fa7d5713d2ab5201ae5e1b2 --- /dev/null +++ b/codenet/public_test_cases/p01744/input.1.txt @@ -0,0 +1,2 @@ +4 4 1 +3 3 diff --git a/codenet/public_test_cases/p01744/input.2.txt b/codenet/public_test_cases/p01744/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe0d2b95b67446da6035774bf09d1caffabb0928 --- /dev/null +++ b/codenet/public_test_cases/p01744/input.2.txt @@ -0,0 +1,11 @@ +10 6 10 +10 4 +4 4 +5 1 +4 2 +7 3 +1 3 +2 4 +8 2 +7 5 +7 1 diff --git a/codenet/public_test_cases/p01744/output.0.txt b/codenet/public_test_cases/p01744/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..966a0980e59147e79c6ed153bbe801baacfcf47f --- /dev/null +++ b/codenet/public_test_cases/p01744/output.0.txt @@ -0,0 +1,4 @@ +2 +3 +4 +1 diff --git a/codenet/public_test_cases/p01744/output.1.txt b/codenet/public_test_cases/p01744/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..966a0980e59147e79c6ed153bbe801baacfcf47f --- /dev/null +++ b/codenet/public_test_cases/p01744/output.1.txt @@ -0,0 +1,4 @@ +2 +3 +4 +1 diff --git a/codenet/public_test_cases/p01744/output.2.txt b/codenet/public_test_cases/p01744/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..25dc85a60324d88009a13e7cd8c8ce7e768e8d2f --- /dev/null +++ b/codenet/public_test_cases/p01744/output.2.txt @@ -0,0 +1,6 @@ +1 +4 +3 +2 +5 +6 diff --git a/codenet/public_test_cases/p01745/input.0.txt b/codenet/public_test_cases/p01745/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4b2097b5794f37c3cf48cd83766a3b2916b7ede --- /dev/null +++ b/codenet/public_test_cases/p01745/input.0.txt @@ -0,0 +1,2 @@ +1 +00011000 diff --git a/codenet/public_test_cases/p01745/input.1.txt b/codenet/public_test_cases/p01745/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..420a155be9a6d469df59a2bf2c2ae1d0a1a11eab --- /dev/null +++ b/codenet/public_test_cases/p01745/input.1.txt @@ -0,0 +1,2 @@ +1 +11111111 diff --git a/codenet/public_test_cases/p01745/input.2.txt b/codenet/public_test_cases/p01745/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4b2097b5794f37c3cf48cd83766a3b2916b7ede --- /dev/null +++ b/codenet/public_test_cases/p01745/input.2.txt @@ -0,0 +1,2 @@ +1 +00011000 diff --git a/codenet/public_test_cases/p01745/output.0.txt b/codenet/public_test_cases/p01745/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d049912cb6e9963d468ae602be37d55de588517c --- /dev/null +++ b/codenet/public_test_cases/p01745/output.0.txt @@ -0,0 +1 @@ +00011101 diff --git a/codenet/public_test_cases/p01745/output.1.txt b/codenet/public_test_cases/p01745/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p01745/output.1.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p01745/output.2.txt b/codenet/public_test_cases/p01745/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d049912cb6e9963d468ae602be37d55de588517c --- /dev/null +++ b/codenet/public_test_cases/p01745/output.2.txt @@ -0,0 +1 @@ +00011101 diff --git a/codenet/public_test_cases/p01746/input.0.txt b/codenet/public_test_cases/p01746/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2628cf66432f859f8d5f17e44d57397d455bb17 --- /dev/null +++ b/codenet/public_test_cases/p01746/input.0.txt @@ -0,0 +1,8 @@ +7 +0 3 1 +0 3 2 +1 -1 2 +0 0 1 +-2 4 1 +-4 0 1 +2 1 2 diff --git a/codenet/public_test_cases/p01746/input.1.txt b/codenet/public_test_cases/p01746/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..311a7a276f2bccd648c9e2131b78de13fbac2b44 --- /dev/null +++ b/codenet/public_test_cases/p01746/input.1.txt @@ -0,0 +1,3 @@ +2 +1 2 3 +4 5 6 diff --git a/codenet/public_test_cases/p01746/input.2.txt b/codenet/public_test_cases/p01746/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2628cf66432f859f8d5f17e44d57397d455bb17 --- /dev/null +++ b/codenet/public_test_cases/p01746/input.2.txt @@ -0,0 +1,8 @@ +7 +0 3 1 +0 3 2 +1 -1 2 +0 0 1 +-2 4 1 +-4 0 1 +2 1 2 diff --git a/codenet/public_test_cases/p01746/output.0.txt b/codenet/public_test_cases/p01746/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01746/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01746/output.1.txt b/codenet/public_test_cases/p01746/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01746/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01746/output.2.txt b/codenet/public_test_cases/p01746/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01746/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01747/input.0.txt b/codenet/public_test_cases/p01747/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cdbc020b0651cde3c67d7134c654e08d163a2a8 --- /dev/null +++ b/codenet/public_test_cases/p01747/input.0.txt @@ -0,0 +1,5 @@ +4 +0 1 +1 1 +1 2 +2 2 diff --git a/codenet/public_test_cases/p01747/input.1.txt b/codenet/public_test_cases/p01747/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cdbc020b0651cde3c67d7134c654e08d163a2a8 --- /dev/null +++ b/codenet/public_test_cases/p01747/input.1.txt @@ -0,0 +1,5 @@ +4 +0 1 +1 1 +1 2 +2 2 diff --git a/codenet/public_test_cases/p01747/input.2.txt b/codenet/public_test_cases/p01747/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2fe0ae654fa166b405f535dffec5cbbd60f00e6 --- /dev/null +++ b/codenet/public_test_cases/p01747/input.2.txt @@ -0,0 +1,12 @@ +11 +63 106 +87 143 +102 132 +115 169 +74 145 +41 177 +56 130 +28 141 +19 124 +0 156 +22 183 diff --git a/codenet/public_test_cases/p01747/output.0.txt b/codenet/public_test_cases/p01747/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p01747/output.0.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p01747/output.1.txt b/codenet/public_test_cases/p01747/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p01747/output.1.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p01747/output.2.txt b/codenet/public_test_cases/p01747/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p01747/output.2.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p01748/input.0.txt b/codenet/public_test_cases/p01748/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..057c3dabf9b62b580b44b560ded06da73829287e --- /dev/null +++ b/codenet/public_test_cases/p01748/input.0.txt @@ -0,0 +1,10 @@ +10 +4 1 +1 1 +3 1 +3 1 +5 1 +6 1 +6 1 +8 1 +4 1 diff --git a/codenet/public_test_cases/p01748/input.1.txt b/codenet/public_test_cases/p01748/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..057c3dabf9b62b580b44b560ded06da73829287e --- /dev/null +++ b/codenet/public_test_cases/p01748/input.1.txt @@ -0,0 +1,10 @@ +10 +4 1 +1 1 +3 1 +3 1 +5 1 +6 1 +6 1 +8 1 +4 1 diff --git a/codenet/public_test_cases/p01748/input.2.txt b/codenet/public_test_cases/p01748/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fa81d5dac429862253ee9536be0f639e62cd4ef --- /dev/null +++ b/codenet/public_test_cases/p01748/input.2.txt @@ -0,0 +1,15 @@ +15 +1 3 +12 5 +5 2 +12 1 +7 5 +5 1 +6 1 +12 1 +11 1 +12 4 +1 1 +5 5 +10 4 +1 2 diff --git a/codenet/public_test_cases/p01748/output.0.txt b/codenet/public_test_cases/p01748/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2061ac6c8901d850b49149621bb9121983224550 --- /dev/null +++ b/codenet/public_test_cases/p01748/output.0.txt @@ -0,0 +1,10 @@ +0 +3 +3 +4 +5 +7 +10 +13 +16 +19 diff --git a/codenet/public_test_cases/p01748/output.1.txt b/codenet/public_test_cases/p01748/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2061ac6c8901d850b49149621bb9121983224550 --- /dev/null +++ b/codenet/public_test_cases/p01748/output.1.txt @@ -0,0 +1,10 @@ +0 +3 +3 +4 +5 +7 +10 +13 +16 +19 diff --git a/codenet/public_test_cases/p01748/output.2.txt b/codenet/public_test_cases/p01748/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..32dcb7193f94e0efc8d69005e84487e94183c2de --- /dev/null +++ b/codenet/public_test_cases/p01748/output.2.txt @@ -0,0 +1,15 @@ +0 +3 +9 +13 +14 +21 +22 +29 +31 +37 +41 +41 +47 +56 +59 diff --git a/codenet/public_test_cases/p01749/input.0.txt b/codenet/public_test_cases/p01749/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e4dc80e7b8d937ce55fe0f8d160d37e4ce407e6 --- /dev/null +++ b/codenet/public_test_cases/p01749/input.0.txt @@ -0,0 +1 @@ +3 2 2 diff --git a/codenet/public_test_cases/p01749/input.1.txt b/codenet/public_test_cases/p01749/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e4dc80e7b8d937ce55fe0f8d160d37e4ce407e6 --- /dev/null +++ b/codenet/public_test_cases/p01749/input.1.txt @@ -0,0 +1 @@ +3 2 2 diff --git a/codenet/public_test_cases/p01749/input.2.txt b/codenet/public_test_cases/p01749/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdb5f07166e563a892514cfcc76a4bd724164327 --- /dev/null +++ b/codenet/public_test_cases/p01749/input.2.txt @@ -0,0 +1 @@ +200 50 1000 diff --git a/codenet/public_test_cases/p01749/output.0.txt b/codenet/public_test_cases/p01749/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01749/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01749/output.1.txt b/codenet/public_test_cases/p01749/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p01749/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p01749/output.2.txt b/codenet/public_test_cases/p01749/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c52fa9a27d8fc7ee842f5a90c1f9208e75b6f594 --- /dev/null +++ b/codenet/public_test_cases/p01749/output.2.txt @@ -0,0 +1 @@ +678200960 diff --git a/codenet/public_test_cases/p01750/input.0.txt b/codenet/public_test_cases/p01750/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18c3d91cbd3b6c14ce36d3f29e82895e8a3afc1f --- /dev/null +++ b/codenet/public_test_cases/p01750/input.0.txt @@ -0,0 +1,4 @@ +2 +6 +3 +4 diff --git a/codenet/public_test_cases/p01750/input.1.txt b/codenet/public_test_cases/p01750/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f6d9861c822385aacb755a6f98592cf7ae7b367 --- /dev/null +++ b/codenet/public_test_cases/p01750/input.1.txt @@ -0,0 +1,7 @@ +5 +12 +34 +56 +78 +90 +123 diff --git a/codenet/public_test_cases/p01750/input.2.txt b/codenet/public_test_cases/p01750/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..18c3d91cbd3b6c14ce36d3f29e82895e8a3afc1f --- /dev/null +++ b/codenet/public_test_cases/p01750/input.2.txt @@ -0,0 +1,4 @@ +2 +6 +3 +4 diff --git a/codenet/public_test_cases/p01750/output.0.txt b/codenet/public_test_cases/p01750/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01750/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01750/output.1.txt b/codenet/public_test_cases/p01750/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..619a5fd6deb278a602860070642f4db2a090c1e0 --- /dev/null +++ b/codenet/public_test_cases/p01750/output.1.txt @@ -0,0 +1 @@ +433127538 diff --git a/codenet/public_test_cases/p01750/output.2.txt b/codenet/public_test_cases/p01750/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01750/output.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01751/input.0.txt b/codenet/public_test_cases/p01751/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32a8ad0c28032e5f33544ba0acf2a120b16a0394 --- /dev/null +++ b/codenet/public_test_cases/p01751/input.0.txt @@ -0,0 +1 @@ +10 10 5 diff --git a/codenet/public_test_cases/p01751/input.1.txt b/codenet/public_test_cases/p01751/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209134e1f1df3ee9441fd12ad26e8f016d728581 --- /dev/null +++ b/codenet/public_test_cases/p01751/input.1.txt @@ -0,0 +1 @@ +20 20 20 diff --git a/codenet/public_test_cases/p01751/input.2.txt b/codenet/public_test_cases/p01751/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0a600d14bc57a6e38483799f644c8c00d8e6eda --- /dev/null +++ b/codenet/public_test_cases/p01751/input.2.txt @@ -0,0 +1 @@ +50 40 51 diff --git a/codenet/public_test_cases/p01751/input.3.txt b/codenet/public_test_cases/p01751/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..32a8ad0c28032e5f33544ba0acf2a120b16a0394 --- /dev/null +++ b/codenet/public_test_cases/p01751/input.3.txt @@ -0,0 +1 @@ +10 10 5 diff --git a/codenet/public_test_cases/p01751/input.4.txt b/codenet/public_test_cases/p01751/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc21012c03d50dcd9c90183a5abceb80f581538f --- /dev/null +++ b/codenet/public_test_cases/p01751/input.4.txt @@ -0,0 +1 @@ +30 30 40 diff --git a/codenet/public_test_cases/p01751/output.0.txt b/codenet/public_test_cases/p01751/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01751/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01751/output.1.txt b/codenet/public_test_cases/p01751/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p01751/output.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p01751/output.2.txt b/codenet/public_test_cases/p01751/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p01751/output.2.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p01751/output.3.txt b/codenet/public_test_cases/p01751/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01751/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01751/output.4.txt b/codenet/public_test_cases/p01751/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01751/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01752/input.0.txt b/codenet/public_test_cases/p01752/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a80e99609825b0572f41f2295b402707a0af590 --- /dev/null +++ b/codenet/public_test_cases/p01752/input.0.txt @@ -0,0 +1,4 @@ +3 3 +G## +.#. +. diff --git a/codenet/public_test_cases/p01752/input.1.txt b/codenet/public_test_cases/p01752/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..811a0c82ebcb4c71b75d4dd28e04f8e061f191ab --- /dev/null +++ b/codenet/public_test_cases/p01752/input.1.txt @@ -0,0 +1,5 @@ +4 4 +.... +.#.G +...# +^#.. diff --git a/codenet/public_test_cases/p01752/input.2.txt b/codenet/public_test_cases/p01752/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c56e33b2937f281643314817c8cc7209446f92ba --- /dev/null +++ b/codenet/public_test_cases/p01752/input.2.txt @@ -0,0 +1,4 @@ +3 3 +... +.G. +.>. diff --git a/codenet/public_test_cases/p01752/input.3.txt b/codenet/public_test_cases/p01752/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a80e99609825b0572f41f2295b402707a0af590 --- /dev/null +++ b/codenet/public_test_cases/p01752/input.3.txt @@ -0,0 +1,4 @@ +3 3 +G## +.#. +. diff --git a/codenet/public_test_cases/p01752/input.4.txt b/codenet/public_test_cases/p01752/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b16de568a347b1d9f0d420e89633f83ab7d7e80 --- /dev/null +++ b/codenet/public_test_cases/p01752/input.4.txt @@ -0,0 +1,4 @@ +3 3 +G## +.#. +.>. diff --git a/codenet/public_test_cases/p01752/input.5.txt b/codenet/public_test_cases/p01752/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3060e610319bd58f1b8e8a5483ddd3c8011e4e5c --- /dev/null +++ b/codenet/public_test_cases/p01752/input.5.txt @@ -0,0 +1,4 @@ +3 3 +G## +.#. +.<. diff --git a/codenet/public_test_cases/p01752/output.0.txt b/codenet/public_test_cases/p01752/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01752/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01752/output.1.txt b/codenet/public_test_cases/p01752/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01752/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01752/output.2.txt b/codenet/public_test_cases/p01752/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01752/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01752/output.3.txt b/codenet/public_test_cases/p01752/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01752/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01752/output.4.txt b/codenet/public_test_cases/p01752/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01752/output.4.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01752/output.5.txt b/codenet/public_test_cases/p01752/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01752/output.5.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01753/input.0.txt b/codenet/public_test_cases/p01753/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58a69a81806bafdf4240a25256a66859d713284d --- /dev/null +++ b/codenet/public_test_cases/p01753/input.0.txt @@ -0,0 +1,7 @@ +5 1 +0 10 0 5 2 +0 20 0 5 12 +0 30 0 5 22 +0 40 0 5 32 +0 50 0 5 42 +0 0 0 0 60 0 diff --git a/codenet/public_test_cases/p01753/input.1.txt b/codenet/public_test_cases/p01753/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7bc23b4b06e3553ae59d8f42966907b4cdd2c68 --- /dev/null +++ b/codenet/public_test_cases/p01753/input.1.txt @@ -0,0 +1,11 @@ +5 5 +-38 -71 -293 75 1 +-158 -38 -405 66 1 +-236 -303 157 266 1 +316 26 411 190 1 +207 -312 -27 196 1 +-50 292 -375 -401 389 -389 +460 278 409 -329 -303 411 +215 -220 -200 309 -474 300 +261 -494 -87 -300 123 -463 +386 378 486 -443 -64 299 diff --git a/codenet/public_test_cases/p01753/input.2.txt b/codenet/public_test_cases/p01753/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58a69a81806bafdf4240a25256a66859d713284d --- /dev/null +++ b/codenet/public_test_cases/p01753/input.2.txt @@ -0,0 +1,7 @@ +5 1 +0 10 0 5 2 +0 20 0 5 12 +0 30 0 5 22 +0 40 0 5 32 +0 50 0 5 42 +0 0 0 0 60 0 diff --git a/codenet/public_test_cases/p01753/input.3.txt b/codenet/public_test_cases/p01753/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff8b600f8cd91d141840e3a7d1fabbe46361a72f --- /dev/null +++ b/codenet/public_test_cases/p01753/input.3.txt @@ -0,0 +1,3 @@ +1 1 +10 5 0 5 9 +0 0 0 9 12 0 diff --git a/codenet/public_test_cases/p01753/output.0.txt b/codenet/public_test_cases/p01753/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p01753/output.0.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p01753/output.1.txt b/codenet/public_test_cases/p01753/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..06b6286976ba88e23d6caf7377b0d62ebbad7529 --- /dev/null +++ b/codenet/public_test_cases/p01753/output.1.txt @@ -0,0 +1,5 @@ +0 +2 +1 +3 +0 diff --git a/codenet/public_test_cases/p01753/output.2.txt b/codenet/public_test_cases/p01753/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p01753/output.2.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p01753/output.3.txt b/codenet/public_test_cases/p01753/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01753/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01754/input.0.txt b/codenet/public_test_cases/p01754/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f77a2e4600888c347e2c396fbd4fcc960e862385 --- /dev/null +++ b/codenet/public_test_cases/p01754/input.0.txt @@ -0,0 +1,2 @@ +1 1 1 +2 diff --git a/codenet/public_test_cases/p01754/input.1.txt b/codenet/public_test_cases/p01754/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f77a2e4600888c347e2c396fbd4fcc960e862385 --- /dev/null +++ b/codenet/public_test_cases/p01754/input.1.txt @@ -0,0 +1,2 @@ +1 1 1 +2 diff --git a/codenet/public_test_cases/p01754/input.2.txt b/codenet/public_test_cases/p01754/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3697e515fa4da391591c8246fd41a46aa34e4b91 --- /dev/null +++ b/codenet/public_test_cases/p01754/input.2.txt @@ -0,0 +1,4 @@ +3 2 1 +3 +3 +3 diff --git a/codenet/public_test_cases/p01754/input.3.txt b/codenet/public_test_cases/p01754/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9edd8cd888aebe27aa813523140a5ae5f73e657c --- /dev/null +++ b/codenet/public_test_cases/p01754/input.3.txt @@ -0,0 +1,4 @@ +3 1 -1 +2 +-3 +2 diff --git a/codenet/public_test_cases/p01754/input.4.txt b/codenet/public_test_cases/p01754/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e33a58dc5373b7d446960823f92d30564a8d106d --- /dev/null +++ b/codenet/public_test_cases/p01754/input.4.txt @@ -0,0 +1,4 @@ +3 1 -10 +-10 +-10 +-10 diff --git a/codenet/public_test_cases/p01754/output.0.txt b/codenet/public_test_cases/p01754/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01754/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01754/output.1.txt b/codenet/public_test_cases/p01754/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01754/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01754/output.2.txt b/codenet/public_test_cases/p01754/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p01754/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p01754/output.3.txt b/codenet/public_test_cases/p01754/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01754/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01754/output.4.txt b/codenet/public_test_cases/p01754/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9980536f09e7492111ec070bf08caf6bab748db --- /dev/null +++ b/codenet/public_test_cases/p01754/output.4.txt @@ -0,0 +1 @@ +-27 diff --git a/codenet/public_test_cases/p01755/input.0.txt b/codenet/public_test_cases/p01755/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11b2bf1d892b953d69b9be703438a3386c988ec0 --- /dev/null +++ b/codenet/public_test_cases/p01755/input.0.txt @@ -0,0 +1,7 @@ +5 3 +### +#g# +#.# +#s# +### +^<^} diff --git a/codenet/public_test_cases/p01755/input.2.txt b/codenet/public_test_cases/p01755/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..11b2bf1d892b953d69b9be703438a3386c988ec0 --- /dev/null +++ b/codenet/public_test_cases/p01755/input.2.txt @@ -0,0 +1,7 @@ +5 3 +### +#g# +#.# +#s# +### +^<^ +2 0 diff --git a/codenet/public_test_cases/p01820/input.1.txt b/codenet/public_test_cases/p01820/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..997ebf2a1406a406dd38b423e5356146cac40370 --- /dev/null +++ b/codenet/public_test_cases/p01820/input.1.txt @@ -0,0 +1,4 @@ +9 +0 0 v +1 0 > +2 0 diff --git a/codenet/public_test_cases/p01820/output.0.txt b/codenet/public_test_cases/p01820/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01820/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01820/output.1.txt b/codenet/public_test_cases/p01820/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01820/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01821/input.0.txt b/codenet/public_test_cases/p01821/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01821/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01821/input.1.txt b/codenet/public_test_cases/p01821/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01821/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01821/output.0.txt b/codenet/public_test_cases/p01821/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01821/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01821/output.1.txt b/codenet/public_test_cases/p01821/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01821/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01822/input.0.txt b/codenet/public_test_cases/p01822/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ca4b432e2913a81c9f25c5a03cec18eb78dce69 --- /dev/null +++ b/codenet/public_test_cases/p01822/input.0.txt @@ -0,0 +1,13 @@ +4 5 3 +-10 -10 +10 -10 +10 10 +-10 10 +1 2 +1 3 +1 4 +2 3 +3 4 +-20 0 +1 0 +20 0 diff --git a/codenet/public_test_cases/p01822/input.1.txt b/codenet/public_test_cases/p01822/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ca4b432e2913a81c9f25c5a03cec18eb78dce69 --- /dev/null +++ b/codenet/public_test_cases/p01822/input.1.txt @@ -0,0 +1,13 @@ +4 5 3 +-10 -10 +10 -10 +10 10 +-10 10 +1 2 +1 3 +1 4 +2 3 +3 4 +-20 0 +1 0 +20 0 diff --git a/codenet/public_test_cases/p01822/output.0.txt b/codenet/public_test_cases/p01822/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37b1e008ebc0ae964f7ec6e6bfbbb05fa1b7598e --- /dev/null +++ b/codenet/public_test_cases/p01822/output.0.txt @@ -0,0 +1,3 @@ +No +Yes +No diff --git a/codenet/public_test_cases/p01822/output.1.txt b/codenet/public_test_cases/p01822/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37b1e008ebc0ae964f7ec6e6bfbbb05fa1b7598e --- /dev/null +++ b/codenet/public_test_cases/p01822/output.1.txt @@ -0,0 +1,3 @@ +No +Yes +No diff --git a/codenet/public_test_cases/p01823/input.0.txt b/codenet/public_test_cases/p01823/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a76e6b37bb5f48a9bc78e70a61298aa3e451565a --- /dev/null +++ b/codenet/public_test_cases/p01823/input.0.txt @@ -0,0 +1,4 @@ +3 3 4 +1 2 1 1 +2 3 2 4 +3 1 1 1 diff --git a/codenet/public_test_cases/p01823/input.1.txt b/codenet/public_test_cases/p01823/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a76e6b37bb5f48a9bc78e70a61298aa3e451565a --- /dev/null +++ b/codenet/public_test_cases/p01823/input.1.txt @@ -0,0 +1,4 @@ +3 3 4 +1 2 1 1 +2 3 2 4 +3 1 1 1 diff --git a/codenet/public_test_cases/p01823/output.0.txt b/codenet/public_test_cases/p01823/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01823/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01823/output.1.txt b/codenet/public_test_cases/p01823/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01823/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01824/input.0.txt b/codenet/public_test_cases/p01824/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a414350c0341ac69c54def720f935de528bb889 --- /dev/null +++ b/codenet/public_test_cases/p01824/input.0.txt @@ -0,0 +1,2 @@ +2 2 2 1 +0 0 0 diff --git a/codenet/public_test_cases/p01824/input.1.txt b/codenet/public_test_cases/p01824/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a414350c0341ac69c54def720f935de528bb889 --- /dev/null +++ b/codenet/public_test_cases/p01824/input.1.txt @@ -0,0 +1,2 @@ +2 2 2 1 +0 0 0 diff --git a/codenet/public_test_cases/p01824/output.0.txt b/codenet/public_test_cases/p01824/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p01824/output.0.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p01824/output.1.txt b/codenet/public_test_cases/p01824/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p01824/output.1.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p01825/input.0.txt b/codenet/public_test_cases/p01825/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c116c87354273ed4ecbffd0db764e33308e33854 --- /dev/null +++ b/codenet/public_test_cases/p01825/input.0.txt @@ -0,0 +1,5 @@ +3 +0 1 +0 0 0 1 +0 1 0 2 +0 2 0 3 diff --git a/codenet/public_test_cases/p01825/input.1.txt b/codenet/public_test_cases/p01825/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c116c87354273ed4ecbffd0db764e33308e33854 --- /dev/null +++ b/codenet/public_test_cases/p01825/input.1.txt @@ -0,0 +1,5 @@ +3 +0 1 +0 0 0 1 +0 1 0 2 +0 2 0 3 diff --git a/codenet/public_test_cases/p01825/output.0.txt b/codenet/public_test_cases/p01825/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bae0eaa83000993d9bc4b524052ef87d19b2ba1 --- /dev/null +++ b/codenet/public_test_cases/p01825/output.0.txt @@ -0,0 +1 @@ +6.0000000000000000 diff --git a/codenet/public_test_cases/p01825/output.1.txt b/codenet/public_test_cases/p01825/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bae0eaa83000993d9bc4b524052ef87d19b2ba1 --- /dev/null +++ b/codenet/public_test_cases/p01825/output.1.txt @@ -0,0 +1 @@ +6.0000000000000000 diff --git a/codenet/public_test_cases/p01826/input.0.txt b/codenet/public_test_cases/p01826/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..488c08afb292d9c40600b15d81abd7d0f1b826f9 --- /dev/null +++ b/codenet/public_test_cases/p01826/input.0.txt @@ -0,0 +1,3 @@ +2 10 +10 200 1 +10 100 100 diff --git a/codenet/public_test_cases/p01826/input.1.txt b/codenet/public_test_cases/p01826/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..488c08afb292d9c40600b15d81abd7d0f1b826f9 --- /dev/null +++ b/codenet/public_test_cases/p01826/input.1.txt @@ -0,0 +1,3 @@ +2 10 +10 200 1 +10 100 100 diff --git a/codenet/public_test_cases/p01826/output.0.txt b/codenet/public_test_cases/p01826/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08839f6bb296e888d311d8ea2f35f7ff82dd3f2d --- /dev/null +++ b/codenet/public_test_cases/p01826/output.0.txt @@ -0,0 +1 @@ +200 diff --git a/codenet/public_test_cases/p01826/output.1.txt b/codenet/public_test_cases/p01826/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08839f6bb296e888d311d8ea2f35f7ff82dd3f2d --- /dev/null +++ b/codenet/public_test_cases/p01826/output.1.txt @@ -0,0 +1 @@ +200 diff --git a/codenet/public_test_cases/p01827/input.0.txt b/codenet/public_test_cases/p01827/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..06917fc9a4452b9d0565fac3e842e6a34b5273ed --- /dev/null +++ b/codenet/public_test_cases/p01827/input.0.txt @@ -0,0 +1,5 @@ +3 +1 3 3 +2 +1 2 +1 3 diff --git a/codenet/public_test_cases/p01827/input.1.txt b/codenet/public_test_cases/p01827/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..06917fc9a4452b9d0565fac3e842e6a34b5273ed --- /dev/null +++ b/codenet/public_test_cases/p01827/input.1.txt @@ -0,0 +1,5 @@ +3 +1 3 3 +2 +1 2 +1 3 diff --git a/codenet/public_test_cases/p01827/output.0.txt b/codenet/public_test_cases/p01827/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01827/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01827/output.1.txt b/codenet/public_test_cases/p01827/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01827/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01828/input.0.txt b/codenet/public_test_cases/p01828/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dca3455a8345a97b32ae3de07bf6de302af67d72 --- /dev/null +++ b/codenet/public_test_cases/p01828/input.0.txt @@ -0,0 +1,2 @@ +acmicpc +tsukuba diff --git a/codenet/public_test_cases/p01828/input.1.txt b/codenet/public_test_cases/p01828/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dca3455a8345a97b32ae3de07bf6de302af67d72 --- /dev/null +++ b/codenet/public_test_cases/p01828/input.1.txt @@ -0,0 +1,2 @@ +acmicpc +tsukuba diff --git a/codenet/public_test_cases/p01828/output.0.txt b/codenet/public_test_cases/p01828/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01828/output.0.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01828/output.1.txt b/codenet/public_test_cases/p01828/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01828/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01829/input.0.txt b/codenet/public_test_cases/p01829/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bc92d44ac9d8a185fa33dec183c593d71d79372 --- /dev/null +++ b/codenet/public_test_cases/p01829/input.0.txt @@ -0,0 +1 @@ +201 diff --git a/codenet/public_test_cases/p01829/input.1.txt b/codenet/public_test_cases/p01829/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bc92d44ac9d8a185fa33dec183c593d71d79372 --- /dev/null +++ b/codenet/public_test_cases/p01829/input.1.txt @@ -0,0 +1 @@ +201 diff --git a/codenet/public_test_cases/p01829/output.0.txt b/codenet/public_test_cases/p01829/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca18985532409a1a1f467d517a59227c2dbbe14d --- /dev/null +++ b/codenet/public_test_cases/p01829/output.0.txt @@ -0,0 +1 @@ +701 diff --git a/codenet/public_test_cases/p01829/output.1.txt b/codenet/public_test_cases/p01829/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca18985532409a1a1f467d517a59227c2dbbe14d --- /dev/null +++ b/codenet/public_test_cases/p01829/output.1.txt @@ -0,0 +1 @@ +701 diff --git a/codenet/public_test_cases/p01830/input.0.txt b/codenet/public_test_cases/p01830/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec3e12fa03f83d14e7519de9cd494dad36345377 --- /dev/null +++ b/codenet/public_test_cases/p01830/input.0.txt @@ -0,0 +1,4 @@ +3 +y 7 +y 6 +n 5 diff --git a/codenet/public_test_cases/p01830/input.1.txt b/codenet/public_test_cases/p01830/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec3e12fa03f83d14e7519de9cd494dad36345377 --- /dev/null +++ b/codenet/public_test_cases/p01830/input.1.txt @@ -0,0 +1,4 @@ +3 +y 7 +y 6 +n 5 diff --git a/codenet/public_test_cases/p01830/output.0.txt b/codenet/public_test_cases/p01830/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01830/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01830/output.1.txt b/codenet/public_test_cases/p01830/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01830/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01831/input.0.txt b/codenet/public_test_cases/p01831/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c2f4756e50988f4ff630997da28b42bdb1177ae --- /dev/null +++ b/codenet/public_test_cases/p01831/input.0.txt @@ -0,0 +1,2 @@ +7 +>> diff --git a/codenet/public_test_cases/p01831/input.1.txt b/codenet/public_test_cases/p01831/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c2f4756e50988f4ff630997da28b42bdb1177ae --- /dev/null +++ b/codenet/public_test_cases/p01831/input.1.txt @@ -0,0 +1,2 @@ +7 +>> diff --git a/codenet/public_test_cases/p01831/output.0.txt b/codenet/public_test_cases/p01831/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01831/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01831/output.1.txt b/codenet/public_test_cases/p01831/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01831/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01832/input.0.txt b/codenet/public_test_cases/p01832/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff469a899576ef8e98b08e470e5e6cc432a0516f --- /dev/null +++ b/codenet/public_test_cases/p01832/input.0.txt @@ -0,0 +1,2 @@ +3 2 +R1 diff --git a/codenet/public_test_cases/p01832/input.1.txt b/codenet/public_test_cases/p01832/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff469a899576ef8e98b08e470e5e6cc432a0516f --- /dev/null +++ b/codenet/public_test_cases/p01832/input.1.txt @@ -0,0 +1,2 @@ +3 2 +R1 diff --git a/codenet/public_test_cases/p01832/output.0.txt b/codenet/public_test_cases/p01832/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccb8f8a66ce17101fadd3ab5289e0dd9667f26d5 --- /dev/null +++ b/codenet/public_test_cases/p01832/output.0.txt @@ -0,0 +1,3 @@ +3 1 2 +4 5 6 +7 8 9 diff --git a/codenet/public_test_cases/p01832/output.1.txt b/codenet/public_test_cases/p01832/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccb8f8a66ce17101fadd3ab5289e0dd9667f26d5 --- /dev/null +++ b/codenet/public_test_cases/p01832/output.1.txt @@ -0,0 +1,3 @@ +3 1 2 +4 5 6 +7 8 9 diff --git a/codenet/public_test_cases/p01833/input.0.txt b/codenet/public_test_cases/p01833/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b442668b1a9533f88489e941fc203a2d35ba8a1 --- /dev/null +++ b/codenet/public_test_cases/p01833/input.0.txt @@ -0,0 +1,8 @@ +4 2 1 1 +1 2 +3 +4 +3 +1 2 +2 4 +3 4 diff --git a/codenet/public_test_cases/p01833/input.1.txt b/codenet/public_test_cases/p01833/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b442668b1a9533f88489e941fc203a2d35ba8a1 --- /dev/null +++ b/codenet/public_test_cases/p01833/input.1.txt @@ -0,0 +1,8 @@ +4 2 1 1 +1 2 +3 +4 +3 +1 2 +2 4 +3 4 diff --git a/codenet/public_test_cases/p01833/output.0.txt b/codenet/public_test_cases/p01833/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p01833/output.0.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p01833/output.1.txt b/codenet/public_test_cases/p01833/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p01833/output.1.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p01834/input.0.txt b/codenet/public_test_cases/p01834/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e59f2ff9c5e1ca3c8fafe6d9304e8adefe48fe80 --- /dev/null +++ b/codenet/public_test_cases/p01834/input.0.txt @@ -0,0 +1,5 @@ +2 2 2 4 +0 0 0 +1 1 0 +1 0 1 +0 1 1 diff --git a/codenet/public_test_cases/p01834/input.1.txt b/codenet/public_test_cases/p01834/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e59f2ff9c5e1ca3c8fafe6d9304e8adefe48fe80 --- /dev/null +++ b/codenet/public_test_cases/p01834/input.1.txt @@ -0,0 +1,5 @@ +2 2 2 4 +0 0 0 +1 1 0 +1 0 1 +0 1 1 diff --git a/codenet/public_test_cases/p01834/output.0.txt b/codenet/public_test_cases/p01834/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01834/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01834/output.1.txt b/codenet/public_test_cases/p01834/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01834/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01835/input.0.txt b/codenet/public_test_cases/p01835/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f922d3f60854f319425a91f28e7f118a557824f --- /dev/null +++ b/codenet/public_test_cases/p01835/input.0.txt @@ -0,0 +1,5 @@ +3 2 +3 +1 2 1 +2 3 2 +3 3 1 diff --git a/codenet/public_test_cases/p01835/input.1.txt b/codenet/public_test_cases/p01835/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f922d3f60854f319425a91f28e7f118a557824f --- /dev/null +++ b/codenet/public_test_cases/p01835/input.1.txt @@ -0,0 +1,5 @@ +3 2 +3 +1 2 1 +2 3 2 +3 3 1 diff --git a/codenet/public_test_cases/p01835/output.0.txt b/codenet/public_test_cases/p01835/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01835/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01835/output.1.txt b/codenet/public_test_cases/p01835/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01835/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01836/input.0.txt b/codenet/public_test_cases/p01836/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b326ad5bb3f2412cbd770df25d7658dc2cfc591 --- /dev/null +++ b/codenet/public_test_cases/p01836/input.0.txt @@ -0,0 +1,9 @@ +200 500 800 500 +3 +400 0 +450 500 +400 1000 +3 +600 0 +550 500 +600 1000 diff --git a/codenet/public_test_cases/p01836/input.1.txt b/codenet/public_test_cases/p01836/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b326ad5bb3f2412cbd770df25d7658dc2cfc591 --- /dev/null +++ b/codenet/public_test_cases/p01836/input.1.txt @@ -0,0 +1,9 @@ +200 500 800 500 +3 +400 0 +450 500 +400 1000 +3 +600 0 +550 500 +600 1000 diff --git a/codenet/public_test_cases/p01836/output.0.txt b/codenet/public_test_cases/p01836/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3bf898992d03cb33689f252071a959c240019e4 --- /dev/null +++ b/codenet/public_test_cases/p01836/output.0.txt @@ -0,0 +1 @@ +100 600 diff --git a/codenet/public_test_cases/p01836/output.1.txt b/codenet/public_test_cases/p01836/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3bf898992d03cb33689f252071a959c240019e4 --- /dev/null +++ b/codenet/public_test_cases/p01836/output.1.txt @@ -0,0 +1 @@ +100 600 diff --git a/codenet/public_test_cases/p01837/input.0.txt b/codenet/public_test_cases/p01837/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76dce9f24f80659fc2377e4eb87ff11fc62f377a --- /dev/null +++ b/codenet/public_test_cases/p01837/input.0.txt @@ -0,0 +1,3 @@ +3 2 3 1 3 +1 2 2 1 +2 3 1 2 diff --git a/codenet/public_test_cases/p01837/input.1.txt b/codenet/public_test_cases/p01837/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76dce9f24f80659fc2377e4eb87ff11fc62f377a --- /dev/null +++ b/codenet/public_test_cases/p01837/input.1.txt @@ -0,0 +1,3 @@ +3 2 3 1 3 +1 2 2 1 +2 3 1 2 diff --git a/codenet/public_test_cases/p01837/output.0.txt b/codenet/public_test_cases/p01837/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..885acc7558a5ea32a930a399cf8717f87be0b5d7 --- /dev/null +++ b/codenet/public_test_cases/p01837/output.0.txt @@ -0,0 +1 @@ +6.0000000 diff --git a/codenet/public_test_cases/p01837/output.1.txt b/codenet/public_test_cases/p01837/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..885acc7558a5ea32a930a399cf8717f87be0b5d7 --- /dev/null +++ b/codenet/public_test_cases/p01837/output.1.txt @@ -0,0 +1 @@ +6.0000000 diff --git a/codenet/public_test_cases/p01838/input.0.txt b/codenet/public_test_cases/p01838/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8931bc97fba983a5f7ce713117830ce061cb8c56 --- /dev/null +++ b/codenet/public_test_cases/p01838/input.0.txt @@ -0,0 +1,2 @@ +4 3 +1 3 4 7 diff --git a/codenet/public_test_cases/p01838/input.1.txt b/codenet/public_test_cases/p01838/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8931bc97fba983a5f7ce713117830ce061cb8c56 --- /dev/null +++ b/codenet/public_test_cases/p01838/input.1.txt @@ -0,0 +1,2 @@ +4 3 +1 3 4 7 diff --git a/codenet/public_test_cases/p01838/output.0.txt b/codenet/public_test_cases/p01838/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01838/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01838/output.1.txt b/codenet/public_test_cases/p01838/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01838/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01839/input.0.txt b/codenet/public_test_cases/p01839/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..310b4e77df2b7c149f1f4a58ef57f5b848511738 --- /dev/null +++ b/codenet/public_test_cases/p01839/input.0.txt @@ -0,0 +1,5 @@ +4 +A +Un +A +Un diff --git a/codenet/public_test_cases/p01839/input.1.txt b/codenet/public_test_cases/p01839/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..310b4e77df2b7c149f1f4a58ef57f5b848511738 --- /dev/null +++ b/codenet/public_test_cases/p01839/input.1.txt @@ -0,0 +1,5 @@ +4 +A +Un +A +Un diff --git a/codenet/public_test_cases/p01839/output.0.txt b/codenet/public_test_cases/p01839/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01839/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01839/output.1.txt b/codenet/public_test_cases/p01839/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01839/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01840/input.0.txt b/codenet/public_test_cases/p01840/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dc7254d2d0ddfe05182db9f9a69473a8d7e73c3 --- /dev/null +++ b/codenet/public_test_cases/p01840/input.0.txt @@ -0,0 +1,2 @@ +1 1 5 +3 diff --git a/codenet/public_test_cases/p01840/input.1.txt b/codenet/public_test_cases/p01840/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dc7254d2d0ddfe05182db9f9a69473a8d7e73c3 --- /dev/null +++ b/codenet/public_test_cases/p01840/input.1.txt @@ -0,0 +1,2 @@ +1 1 5 +3 diff --git a/codenet/public_test_cases/p01840/output.0.txt b/codenet/public_test_cases/p01840/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01840/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01840/output.1.txt b/codenet/public_test_cases/p01840/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01840/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01841/input.0.txt b/codenet/public_test_cases/p01841/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09a29e25c1193bcb8c35de82c8237cf743875144 --- /dev/null +++ b/codenet/public_test_cases/p01841/input.0.txt @@ -0,0 +1,2 @@ +((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()) +(()[4]())[3](((()[2]())[1]())[8](()[3]())) diff --git a/codenet/public_test_cases/p01841/input.1.txt b/codenet/public_test_cases/p01841/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09a29e25c1193bcb8c35de82c8237cf743875144 --- /dev/null +++ b/codenet/public_test_cases/p01841/input.1.txt @@ -0,0 +1,2 @@ +((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()) +(()[4]())[3](((()[2]())[1]())[8](()[3]())) diff --git a/codenet/public_test_cases/p01841/output.0.txt b/codenet/public_test_cases/p01841/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaeb34985e30acf0c9266ed2941e5f04b4ea5530 --- /dev/null +++ b/codenet/public_test_cases/p01841/output.0.txt @@ -0,0 +1 @@ +(()[6]())[8](((()[4]())[7]())[9]()) diff --git a/codenet/public_test_cases/p01841/output.1.txt b/codenet/public_test_cases/p01841/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaeb34985e30acf0c9266ed2941e5f04b4ea5530 --- /dev/null +++ b/codenet/public_test_cases/p01841/output.1.txt @@ -0,0 +1 @@ +(()[6]())[8](((()[4]())[7]())[9]()) diff --git a/codenet/public_test_cases/p01842/input.0.txt b/codenet/public_test_cases/p01842/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8620af15ce3e795467e6e3416876f660de1e367 --- /dev/null +++ b/codenet/public_test_cases/p01842/input.0.txt @@ -0,0 +1,3 @@ +2 2 +100 -1 +200 300 diff --git a/codenet/public_test_cases/p01842/input.1.txt b/codenet/public_test_cases/p01842/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8620af15ce3e795467e6e3416876f660de1e367 --- /dev/null +++ b/codenet/public_test_cases/p01842/input.1.txt @@ -0,0 +1,3 @@ +2 2 +100 -1 +200 300 diff --git a/codenet/public_test_cases/p01842/output.0.txt b/codenet/public_test_cases/p01842/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e96acb9254becae7d57c63a77897b49f2688c9e1 --- /dev/null +++ b/codenet/public_test_cases/p01842/output.0.txt @@ -0,0 +1 @@ +-100 diff --git a/codenet/public_test_cases/p01842/output.1.txt b/codenet/public_test_cases/p01842/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e96acb9254becae7d57c63a77897b49f2688c9e1 --- /dev/null +++ b/codenet/public_test_cases/p01842/output.1.txt @@ -0,0 +1 @@ +-100 diff --git a/codenet/public_test_cases/p01843/input.0.txt b/codenet/public_test_cases/p01843/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78faa381aa916f9205714ceaf8094e20adee107b --- /dev/null +++ b/codenet/public_test_cases/p01843/input.0.txt @@ -0,0 +1,8 @@ +1 2 +4 +5 5 +15 5 +15 15 +5 15 +0 10 +20 10 diff --git a/codenet/public_test_cases/p01843/input.1.txt b/codenet/public_test_cases/p01843/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78faa381aa916f9205714ceaf8094e20adee107b --- /dev/null +++ b/codenet/public_test_cases/p01843/input.1.txt @@ -0,0 +1,8 @@ +1 2 +4 +5 5 +15 5 +15 15 +5 15 +0 10 +20 10 diff --git a/codenet/public_test_cases/p01843/output.0.txt b/codenet/public_test_cases/p01843/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01843/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01843/output.1.txt b/codenet/public_test_cases/p01843/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01843/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01844/input.0.txt b/codenet/public_test_cases/p01844/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d01aee26cf3fc82888f52d2dca4c3e45ca1bfd65 --- /dev/null +++ b/codenet/public_test_cases/p01844/input.0.txt @@ -0,0 +1,4 @@ +3 3 2 +1 2 2 +3 1 0 +0 4 3 diff --git a/codenet/public_test_cases/p01844/input.1.txt b/codenet/public_test_cases/p01844/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d01aee26cf3fc82888f52d2dca4c3e45ca1bfd65 --- /dev/null +++ b/codenet/public_test_cases/p01844/input.1.txt @@ -0,0 +1,4 @@ +3 3 2 +1 2 2 +3 1 0 +0 4 3 diff --git a/codenet/public_test_cases/p01844/output.0.txt b/codenet/public_test_cases/p01844/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01844/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01844/output.1.txt b/codenet/public_test_cases/p01844/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01844/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01845/input.0.txt b/codenet/public_test_cases/p01845/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d1883618e327b1b0f4e2688e927176dff48a719 --- /dev/null +++ b/codenet/public_test_cases/p01845/input.0.txt @@ -0,0 +1,7 @@ +10 5 3 4 +2 5 2 3 +91 13 7 62 +10 1 3 5 +20 100 2 20 +2 14 7 1 +0 0 0 0 diff --git a/codenet/public_test_cases/p01845/input.1.txt b/codenet/public_test_cases/p01845/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d1883618e327b1b0f4e2688e927176dff48a719 --- /dev/null +++ b/codenet/public_test_cases/p01845/input.1.txt @@ -0,0 +1,7 @@ +10 5 3 4 +2 5 2 3 +91 13 7 62 +10 1 3 5 +20 100 2 20 +2 14 7 1 +0 0 0 0 diff --git a/codenet/public_test_cases/p01845/output.0.txt b/codenet/public_test_cases/p01845/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff6069a7f8207289d74996db4ff899001922ebab --- /dev/null +++ b/codenet/public_test_cases/p01845/output.0.txt @@ -0,0 +1,6 @@ +2 +3 +0 +0 +9 +96 diff --git a/codenet/public_test_cases/p01845/output.1.txt b/codenet/public_test_cases/p01845/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff6069a7f8207289d74996db4ff899001922ebab --- /dev/null +++ b/codenet/public_test_cases/p01845/output.1.txt @@ -0,0 +1,6 @@ +2 +3 +0 +0 +9 +96 diff --git a/codenet/public_test_cases/p01846/input.0.txt b/codenet/public_test_cases/p01846/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2812daa7379f65ab89d0e73b694d978baa2c6fc0 --- /dev/null +++ b/codenet/public_test_cases/p01846/input.0.txt @@ -0,0 +1,7 @@ +b1/1b +1 1 1 2 +b5/bbbbbb +2 4 1 4 +b2b2b/7 +1 4 2 4 +# diff --git a/codenet/public_test_cases/p01846/input.1.txt b/codenet/public_test_cases/p01846/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2812daa7379f65ab89d0e73b694d978baa2c6fc0 --- /dev/null +++ b/codenet/public_test_cases/p01846/input.1.txt @@ -0,0 +1,7 @@ +b1/1b +1 1 1 2 +b5/bbbbbb +2 4 1 4 +b2b2b/7 +1 4 2 4 +# diff --git a/codenet/public_test_cases/p01846/output.0.txt b/codenet/public_test_cases/p01846/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb9135134bc054b657469919800e01db7fc9d749 --- /dev/null +++ b/codenet/public_test_cases/p01846/output.0.txt @@ -0,0 +1,3 @@ +1b/1b +b2b2/bbb1bb +b5b/3b3 diff --git a/codenet/public_test_cases/p01846/output.1.txt b/codenet/public_test_cases/p01846/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb9135134bc054b657469919800e01db7fc9d749 --- /dev/null +++ b/codenet/public_test_cases/p01846/output.1.txt @@ -0,0 +1,3 @@ +1b/1b +b2b2/bbb1bb +b5b/3b3 diff --git a/codenet/public_test_cases/p01847/input.0.txt b/codenet/public_test_cases/p01847/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e565b4ef15aa4b9429ef2567577df4300723ef3c --- /dev/null +++ b/codenet/public_test_cases/p01847/input.0.txt @@ -0,0 +1,65 @@ +4 +0 0 +10 0 +10 10 +0 10 +0 0 +5 0 +5 10 +0 10 +6 +0 0 +10 0 +10 5 +5 5 +5 10 +0 10 +2 0 +8 0 +8 10 +2 10 +12 +1 1 +1 3 +-1 3 +-1 1 +-3 1 +-3 -1 +-1 -1 +-1 -3 +1 -3 +1 -1 +3 -1 +3 1 +2 2 +-2 2 +-2 -2 +2 -2 +4 +20000 20000 +-20000 20000 +-20000 -20000 +20000 -20000 +1000 1000 +-1000 1000 +-1000 -1000 +1000 -1000 +4 +1000 1000 +-1000 1000 +-1000 -1000 +1000 -1000 +20000 20000 +-20000 20000 +-20000 -20000 +20000 -20000 +4 +0 0 +10 0 +10 10 +0 10 +20 0 +30 0 +30 10 +20 10 +0 diff --git a/codenet/public_test_cases/p01847/input.1.txt b/codenet/public_test_cases/p01847/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e565b4ef15aa4b9429ef2567577df4300723ef3c --- /dev/null +++ b/codenet/public_test_cases/p01847/input.1.txt @@ -0,0 +1,65 @@ +4 +0 0 +10 0 +10 10 +0 10 +0 0 +5 0 +5 10 +0 10 +6 +0 0 +10 0 +10 5 +5 5 +5 10 +0 10 +2 0 +8 0 +8 10 +2 10 +12 +1 1 +1 3 +-1 3 +-1 1 +-3 1 +-3 -1 +-1 -1 +-1 -3 +1 -3 +1 -1 +3 -1 +3 1 +2 2 +-2 2 +-2 -2 +2 -2 +4 +20000 20000 +-20000 20000 +-20000 -20000 +20000 -20000 +1000 1000 +-1000 1000 +-1000 -1000 +1000 -1000 +4 +1000 1000 +-1000 1000 +-1000 -1000 +1000 -1000 +20000 20000 +-20000 20000 +-20000 -20000 +20000 -20000 +4 +0 0 +10 0 +10 10 +0 10 +20 0 +30 0 +30 10 +20 10 +0 diff --git a/codenet/public_test_cases/p01847/output.0.txt b/codenet/public_test_cases/p01847/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a4f23fe9fc8e8c3c523480ed08c6bb9712d3d6a --- /dev/null +++ b/codenet/public_test_cases/p01847/output.0.txt @@ -0,0 +1,6 @@ +50 +30 +8 +1596000000 +0 +100 diff --git a/codenet/public_test_cases/p01847/output.1.txt b/codenet/public_test_cases/p01847/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a4f23fe9fc8e8c3c523480ed08c6bb9712d3d6a --- /dev/null +++ b/codenet/public_test_cases/p01847/output.1.txt @@ -0,0 +1,6 @@ +50 +30 +8 +1596000000 +0 +100 diff --git a/codenet/public_test_cases/p01848/input.0.txt b/codenet/public_test_cases/p01848/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a46ee07c1edf08b69fa754c10722d629e3bbac2 --- /dev/null +++ b/codenet/public_test_cases/p01848/input.0.txt @@ -0,0 +1,36 @@ +2 +0.60 1 2 +0.60 0 +2 +0.60 1 2 +0.60 1 1 +5 +0.10 1 2 +0.20 1 3 +0.30 1 4 +0.40 1 5 +0.50 1 1 +5 +0.10 0 +0.20 1 1 +0.30 1 1 +0.40 1 1 +0.50 1 1 +5 +0.10 4 2 3 4 5 +0.20 0 +0.30 0 +0.40 0 +0.50 0 +4 +0.10 1 2 +0.20 0 +0.30 1 4 +0.40 1 3 +5 +0.10 0 +0.20 0 +0.30 0 +0.40 0 +0.50 0 +0 diff --git a/codenet/public_test_cases/p01848/input.1.txt b/codenet/public_test_cases/p01848/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a46ee07c1edf08b69fa754c10722d629e3bbac2 --- /dev/null +++ b/codenet/public_test_cases/p01848/input.1.txt @@ -0,0 +1,36 @@ +2 +0.60 1 2 +0.60 0 +2 +0.60 1 2 +0.60 1 1 +5 +0.10 1 2 +0.20 1 3 +0.30 1 4 +0.40 1 5 +0.50 1 1 +5 +0.10 0 +0.20 1 1 +0.30 1 1 +0.40 1 1 +0.50 1 1 +5 +0.10 4 2 3 4 5 +0.20 0 +0.30 0 +0.40 0 +0.50 0 +4 +0.10 1 2 +0.20 0 +0.30 1 4 +0.40 1 3 +5 +0.10 0 +0.20 0 +0.30 0 +0.40 0 +0.50 0 +0 diff --git a/codenet/public_test_cases/p01848/output.0.txt b/codenet/public_test_cases/p01848/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a31521cb913f5192f6d0312d2f48576ed940383 --- /dev/null +++ b/codenet/public_test_cases/p01848/output.0.txt @@ -0,0 +1,7 @@ +0.400000000 +0.640000000 +0.998800000 +0.168000000 +0.900000000 +0.792000000 +0.151200000 diff --git a/codenet/public_test_cases/p01848/output.1.txt b/codenet/public_test_cases/p01848/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a31521cb913f5192f6d0312d2f48576ed940383 --- /dev/null +++ b/codenet/public_test_cases/p01848/output.1.txt @@ -0,0 +1,7 @@ +0.400000000 +0.640000000 +0.998800000 +0.168000000 +0.900000000 +0.792000000 +0.151200000 diff --git a/codenet/public_test_cases/p01849/input.0.txt b/codenet/public_test_cases/p01849/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb7974d1d7dfdacd355029e6d8add8471565b3e0 --- /dev/null +++ b/codenet/public_test_cases/p01849/input.0.txt @@ -0,0 +1,22 @@ +1 1 +5 +6 +1 1 +5 +2 +1 1 +20 +5 +4 1 +2 4 5 9 +8 +4 3 +3 5 2 1 +10 4 7 +5 5 +2 2 2 2 2 +1 3 5 7 9 +2 5 +2 5 +2 5 2 5 2 +0 0 diff --git a/codenet/public_test_cases/p01849/input.1.txt b/codenet/public_test_cases/p01849/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb7974d1d7dfdacd355029e6d8add8471565b3e0 --- /dev/null +++ b/codenet/public_test_cases/p01849/input.1.txt @@ -0,0 +1,22 @@ +1 1 +5 +6 +1 1 +5 +2 +1 1 +20 +5 +4 1 +2 4 5 9 +8 +4 3 +3 5 2 1 +10 4 7 +5 5 +2 2 2 2 2 +1 3 5 7 9 +2 5 +2 5 +2 5 2 5 2 +0 0 diff --git a/codenet/public_test_cases/p01849/output.0.txt b/codenet/public_test_cases/p01849/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb27b55d94fe888820d201d6e7268bb850e086f4 --- /dev/null +++ b/codenet/public_test_cases/p01849/output.0.txt @@ -0,0 +1,7 @@ +1 +2 +5 +1 +1 +5 +4 diff --git a/codenet/public_test_cases/p01849/output.1.txt b/codenet/public_test_cases/p01849/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb27b55d94fe888820d201d6e7268bb850e086f4 --- /dev/null +++ b/codenet/public_test_cases/p01849/output.1.txt @@ -0,0 +1,7 @@ +1 +2 +5 +1 +1 +5 +4 diff --git a/codenet/public_test_cases/p01850/input.0.txt b/codenet/public_test_cases/p01850/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af2be93da95f4a3037586a56c4d28fe2b7c7ab9e --- /dev/null +++ b/codenet/public_test_cases/p01850/input.0.txt @@ -0,0 +1,19 @@ +3 +icpc +icfp +topcoder +4 +apple +application +appointment +acmicpc +3 +a +aa +aaa +4 +a +aza +azb +b +0 diff --git a/codenet/public_test_cases/p01850/output.0.txt b/codenet/public_test_cases/p01850/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5610c24582a5430bf412c8a73c2005fcc1f6e2d --- /dev/null +++ b/codenet/public_test_cases/p01850/output.0.txt @@ -0,0 +1,14 @@ +icfp +topcoder +icpc +apple +acmicpc +application +appointment +aa +a +aaa +a +aza +b +azb diff --git a/codenet/public_test_cases/p01851/input.0.txt b/codenet/public_test_cases/p01851/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..001b0af769a9a6fde368890719cb9a7a393f08b9 --- /dev/null +++ b/codenet/public_test_cases/p01851/input.0.txt @@ -0,0 +1,7 @@ +1 1 0 1 1 +0 0 2 3 2 +4 0 0 33 4 +5 4 2 20 25 +4726 87361 2742 23497 162843 +328324 420923 12782 834286 538297 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01851/input.1.txt b/codenet/public_test_cases/p01851/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..001b0af769a9a6fde368890719cb9a7a393f08b9 --- /dev/null +++ b/codenet/public_test_cases/p01851/input.1.txt @@ -0,0 +1,7 @@ +1 1 0 1 1 +0 0 2 3 2 +4 0 0 33 4 +5 4 2 20 25 +4726 87361 2742 23497 162843 +328324 420923 12782 834286 538297 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01851/output.0.txt b/codenet/public_test_cases/p01851/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00a07caf79635145d5fa1920c70bf8a72d564554 --- /dev/null +++ b/codenet/public_test_cases/p01851/output.0.txt @@ -0,0 +1,6 @@ +2 +0 +114660 +512095631 +673703234 +166259450 diff --git a/codenet/public_test_cases/p01851/output.1.txt b/codenet/public_test_cases/p01851/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00a07caf79635145d5fa1920c70bf8a72d564554 --- /dev/null +++ b/codenet/public_test_cases/p01851/output.1.txt @@ -0,0 +1,6 @@ +2 +0 +114660 +512095631 +673703234 +166259450 diff --git a/codenet/public_test_cases/p01852/input.0.txt b/codenet/public_test_cases/p01852/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01852/input.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01852/input.1.txt b/codenet/public_test_cases/p01852/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01852/input.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01852/output.0.txt b/codenet/public_test_cases/p01852/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01852/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01852/output.1.txt b/codenet/public_test_cases/p01852/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01852/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01853/input.0.txt b/codenet/public_test_cases/p01853/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..df46cb4798925a9805ba8b055a43fb20741f5ca7 --- /dev/null +++ b/codenet/public_test_cases/p01853/input.0.txt @@ -0,0 +1 @@ +3 100 diff --git a/codenet/public_test_cases/p01853/input.1.txt b/codenet/public_test_cases/p01853/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..df46cb4798925a9805ba8b055a43fb20741f5ca7 --- /dev/null +++ b/codenet/public_test_cases/p01853/input.1.txt @@ -0,0 +1 @@ +3 100 diff --git a/codenet/public_test_cases/p01853/output.0.txt b/codenet/public_test_cases/p01853/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45bc3d6dc22c5a70fe6bc70d32b06a73b5aab9db --- /dev/null +++ b/codenet/public_test_cases/p01853/output.0.txt @@ -0,0 +1 @@ +0 0 100 diff --git a/codenet/public_test_cases/p01853/output.1.txt b/codenet/public_test_cases/p01853/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45bc3d6dc22c5a70fe6bc70d32b06a73b5aab9db --- /dev/null +++ b/codenet/public_test_cases/p01853/output.1.txt @@ -0,0 +1 @@ +0 0 100 diff --git a/codenet/public_test_cases/p01854/input.0.txt b/codenet/public_test_cases/p01854/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c78c20faf0422e550b4b351b23e0f7737cbc9b2 --- /dev/null +++ b/codenet/public_test_cases/p01854/input.0.txt @@ -0,0 +1,3 @@ +2 15 +2 3 3 7 2 +2 7 1 1 4 diff --git a/codenet/public_test_cases/p01854/input.1.txt b/codenet/public_test_cases/p01854/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c78c20faf0422e550b4b351b23e0f7737cbc9b2 --- /dev/null +++ b/codenet/public_test_cases/p01854/input.1.txt @@ -0,0 +1,3 @@ +2 15 +2 3 3 7 2 +2 7 1 1 4 diff --git a/codenet/public_test_cases/p01854/output.0.txt b/codenet/public_test_cases/p01854/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28d210823adac6fc9b1e82af3a4c7472769259f5 --- /dev/null +++ b/codenet/public_test_cases/p01854/output.0.txt @@ -0,0 +1 @@ +6.33333333 diff --git a/codenet/public_test_cases/p01854/output.1.txt b/codenet/public_test_cases/p01854/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28d210823adac6fc9b1e82af3a4c7472769259f5 --- /dev/null +++ b/codenet/public_test_cases/p01854/output.1.txt @@ -0,0 +1 @@ +6.33333333 diff --git a/codenet/public_test_cases/p01855/input.0.txt b/codenet/public_test_cases/p01855/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..203127ae6898aa4d06fc80f1817577e9badfff48 --- /dev/null +++ b/codenet/public_test_cases/p01855/input.0.txt @@ -0,0 +1,4 @@ +3 +2 3 +3 3 +4 3 diff --git a/codenet/public_test_cases/p01855/input.1.txt b/codenet/public_test_cases/p01855/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..203127ae6898aa4d06fc80f1817577e9badfff48 --- /dev/null +++ b/codenet/public_test_cases/p01855/input.1.txt @@ -0,0 +1,4 @@ +3 +2 3 +3 3 +4 3 diff --git a/codenet/public_test_cases/p01855/output.0.txt b/codenet/public_test_cases/p01855/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..39259b34c0cb46fa70d529b5a548ba76dfceb782 --- /dev/null +++ b/codenet/public_test_cases/p01855/output.0.txt @@ -0,0 +1,3 @@ +1 1 +1 0 +1 1 diff --git a/codenet/public_test_cases/p01855/output.1.txt b/codenet/public_test_cases/p01855/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..39259b34c0cb46fa70d529b5a548ba76dfceb782 --- /dev/null +++ b/codenet/public_test_cases/p01855/output.1.txt @@ -0,0 +1,3 @@ +1 1 +1 0 +1 1 diff --git a/codenet/public_test_cases/p01856/input.0.txt b/codenet/public_test_cases/p01856/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e17357b88652bea8f9b61044e09a068925662286 --- /dev/null +++ b/codenet/public_test_cases/p01856/input.0.txt @@ -0,0 +1,8 @@ +7 5 +0 0 0 0 0 +0 1 1 1 0 +0 2 2 2 0 +0 3 3 3 0 +0 2 2 2 0 +0 1 1 1 0 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01856/input.1.txt b/codenet/public_test_cases/p01856/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e17357b88652bea8f9b61044e09a068925662286 --- /dev/null +++ b/codenet/public_test_cases/p01856/input.1.txt @@ -0,0 +1,8 @@ +7 5 +0 0 0 0 0 +0 1 1 1 0 +0 2 2 2 0 +0 3 3 3 0 +0 2 2 2 0 +0 1 1 1 0 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p01856/output.0.txt b/codenet/public_test_cases/p01856/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..015c28d3ea40c5c2a82a9cc9ccc6c3f08e743d4c --- /dev/null +++ b/codenet/public_test_cases/p01856/output.0.txt @@ -0,0 +1 @@ +4 2 2 2 diff --git a/codenet/public_test_cases/p01856/output.1.txt b/codenet/public_test_cases/p01856/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..015c28d3ea40c5c2a82a9cc9ccc6c3f08e743d4c --- /dev/null +++ b/codenet/public_test_cases/p01856/output.1.txt @@ -0,0 +1 @@ +4 2 2 2 diff --git a/codenet/public_test_cases/p01857/input.0.txt b/codenet/public_test_cases/p01857/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5b8c3d42d0e30b414feb98336d2557f999e1ecb --- /dev/null +++ b/codenet/public_test_cases/p01857/input.0.txt @@ -0,0 +1,4 @@ +3 +5 1 +5 2 +1 2 diff --git a/codenet/public_test_cases/p01857/input.1.txt b/codenet/public_test_cases/p01857/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5b8c3d42d0e30b414feb98336d2557f999e1ecb --- /dev/null +++ b/codenet/public_test_cases/p01857/input.1.txt @@ -0,0 +1,4 @@ +3 +5 1 +5 2 +1 2 diff --git a/codenet/public_test_cases/p01857/output.0.txt b/codenet/public_test_cases/p01857/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23871f2bf37a70ff624f9eca05f5130dffa6a0d0 --- /dev/null +++ b/codenet/public_test_cases/p01857/output.0.txt @@ -0,0 +1,3 @@ +5 +3 +1 diff --git a/codenet/public_test_cases/p01857/output.1.txt b/codenet/public_test_cases/p01857/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..23871f2bf37a70ff624f9eca05f5130dffa6a0d0 --- /dev/null +++ b/codenet/public_test_cases/p01857/output.1.txt @@ -0,0 +1,3 @@ +5 +3 +1 diff --git a/codenet/public_test_cases/p01858/input.0.txt b/codenet/public_test_cases/p01858/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d87de0cc5dd3a9807cf9f444c0d1b5b630773f1 --- /dev/null +++ b/codenet/public_test_cases/p01858/input.0.txt @@ -0,0 +1,7 @@ +3 +tameru +tameru +tameru +tameru +kougekida +tameru diff --git a/codenet/public_test_cases/p01858/input.1.txt b/codenet/public_test_cases/p01858/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d87de0cc5dd3a9807cf9f444c0d1b5b630773f1 --- /dev/null +++ b/codenet/public_test_cases/p01858/input.1.txt @@ -0,0 +1,7 @@ +3 +tameru +tameru +tameru +tameru +kougekida +tameru diff --git a/codenet/public_test_cases/p01858/output.0.txt b/codenet/public_test_cases/p01858/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a50f683e444b221ac40aed0ee5fca686880b0833 --- /dev/null +++ b/codenet/public_test_cases/p01858/output.0.txt @@ -0,0 +1 @@ +Nakajima-kun diff --git a/codenet/public_test_cases/p01858/output.1.txt b/codenet/public_test_cases/p01858/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a50f683e444b221ac40aed0ee5fca686880b0833 --- /dev/null +++ b/codenet/public_test_cases/p01858/output.1.txt @@ -0,0 +1 @@ +Nakajima-kun diff --git a/codenet/public_test_cases/p01859/input.0.txt b/codenet/public_test_cases/p01859/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58aeac61f396326d1f20628583d940bae9e48b7c --- /dev/null +++ b/codenet/public_test_cases/p01859/input.0.txt @@ -0,0 +1,2 @@ +3 2 +2 2 diff --git a/codenet/public_test_cases/p01859/input.1.txt b/codenet/public_test_cases/p01859/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58aeac61f396326d1f20628583d940bae9e48b7c --- /dev/null +++ b/codenet/public_test_cases/p01859/input.1.txt @@ -0,0 +1,2 @@ +3 2 +2 2 diff --git a/codenet/public_test_cases/p01859/output.0.txt b/codenet/public_test_cases/p01859/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9073279cf0f6fa900458ea8afd0dbebb091634c6 --- /dev/null +++ b/codenet/public_test_cases/p01859/output.0.txt @@ -0,0 +1 @@ +NAKAJIMA diff --git a/codenet/public_test_cases/p01859/output.1.txt b/codenet/public_test_cases/p01859/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9073279cf0f6fa900458ea8afd0dbebb091634c6 --- /dev/null +++ b/codenet/public_test_cases/p01859/output.1.txt @@ -0,0 +1 @@ +NAKAJIMA diff --git a/codenet/public_test_cases/p01860/input.0.txt b/codenet/public_test_cases/p01860/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a2231d9670d8b2a41eca48742ecba0504954da5 --- /dev/null +++ b/codenet/public_test_cases/p01860/input.0.txt @@ -0,0 +1,10 @@ +3 9 3 2 3 +1 2 3 +1 1 2 +2 3 1 +3 4 2 +4 1 3 +4 1 1 +5 1 1 +6 2 3 +7 2 2 diff --git a/codenet/public_test_cases/p01860/input.1.txt b/codenet/public_test_cases/p01860/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a2231d9670d8b2a41eca48742ecba0504954da5 --- /dev/null +++ b/codenet/public_test_cases/p01860/input.1.txt @@ -0,0 +1,10 @@ +3 9 3 2 3 +1 2 3 +1 1 2 +2 3 1 +3 4 2 +4 1 3 +4 1 1 +5 1 1 +6 2 3 +7 2 2 diff --git a/codenet/public_test_cases/p01860/output.0.txt b/codenet/public_test_cases/p01860/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01860/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01860/output.1.txt b/codenet/public_test_cases/p01860/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01860/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01861/input.0.txt b/codenet/public_test_cases/p01861/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d87eb5f58194429a363f140544916f3c0d500184 --- /dev/null +++ b/codenet/public_test_cases/p01861/input.0.txt @@ -0,0 +1,6 @@ +3 +3 5 3 +3 +5 2 3 +3 3 1 +7 1 2 diff --git a/codenet/public_test_cases/p01861/input.1.txt b/codenet/public_test_cases/p01861/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d87eb5f58194429a363f140544916f3c0d500184 --- /dev/null +++ b/codenet/public_test_cases/p01861/input.1.txt @@ -0,0 +1,6 @@ +3 +3 5 3 +3 +5 2 3 +3 3 1 +7 1 2 diff --git a/codenet/public_test_cases/p01861/output.0.txt b/codenet/public_test_cases/p01861/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01861/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01861/output.1.txt b/codenet/public_test_cases/p01861/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01861/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01862/input.0.txt b/codenet/public_test_cases/p01862/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37a08adf99c0e1e9da11c2c8ba30090e5efd58dc --- /dev/null +++ b/codenet/public_test_cases/p01862/input.0.txt @@ -0,0 +1,2 @@ +2 +10 5 diff --git a/codenet/public_test_cases/p01862/input.1.txt b/codenet/public_test_cases/p01862/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37a08adf99c0e1e9da11c2c8ba30090e5efd58dc --- /dev/null +++ b/codenet/public_test_cases/p01862/input.1.txt @@ -0,0 +1,2 @@ +2 +10 5 diff --git a/codenet/public_test_cases/p01862/output.0.txt b/codenet/public_test_cases/p01862/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..20a69cffcbee9830e3ffebe4a771394110317160 --- /dev/null +++ b/codenet/public_test_cases/p01862/output.0.txt @@ -0,0 +1,22 @@ +1 +-10.00 -6.48 +-10.79 -8.91 +-13.34 -8.91 +-11.28 -10.41 +-12.07 -12.84 +-10.00 -11.34 +-7.93 -12.84 +-8.72 -10.41 +-6.66 -8.91 +-9.21 -8.91 +2 +10.00 12.34 +9.47 10.72 +7.77 10.72 +9.15 9.72 +8.62 8.10 +10.00 9.10 +11.38 8.10 +10.85 9.72 +12.23 10.72 +10.53 10.72 diff --git a/codenet/public_test_cases/p01862/output.1.txt b/codenet/public_test_cases/p01862/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..20a69cffcbee9830e3ffebe4a771394110317160 --- /dev/null +++ b/codenet/public_test_cases/p01862/output.1.txt @@ -0,0 +1,22 @@ +1 +-10.00 -6.48 +-10.79 -8.91 +-13.34 -8.91 +-11.28 -10.41 +-12.07 -12.84 +-10.00 -11.34 +-7.93 -12.84 +-8.72 -10.41 +-6.66 -8.91 +-9.21 -8.91 +2 +10.00 12.34 +9.47 10.72 +7.77 10.72 +9.15 9.72 +8.62 8.10 +10.00 9.10 +11.38 8.10 +10.85 9.72 +12.23 10.72 +10.53 10.72 diff --git a/codenet/public_test_cases/p01863/input.0.txt b/codenet/public_test_cases/p01863/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32cb429cd72dec99d19a80f7885d106677e6aa98 --- /dev/null +++ b/codenet/public_test_cases/p01863/input.0.txt @@ -0,0 +1 @@ +NicoNicoNi diff --git a/codenet/public_test_cases/p01863/input.1.txt b/codenet/public_test_cases/p01863/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32cb429cd72dec99d19a80f7885d106677e6aa98 --- /dev/null +++ b/codenet/public_test_cases/p01863/input.1.txt @@ -0,0 +1 @@ +NicoNicoNi diff --git a/codenet/public_test_cases/p01863/output.0.txt b/codenet/public_test_cases/p01863/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b9923c9d76119cd381af61cd86d46c6c58e2597 --- /dev/null +++ b/codenet/public_test_cases/p01863/output.0.txt @@ -0,0 +1 @@ +Love Nico! diff --git a/codenet/public_test_cases/p01863/output.1.txt b/codenet/public_test_cases/p01863/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b9923c9d76119cd381af61cd86d46c6c58e2597 --- /dev/null +++ b/codenet/public_test_cases/p01863/output.1.txt @@ -0,0 +1 @@ +Love Nico! diff --git a/codenet/public_test_cases/p01864/input.0.txt b/codenet/public_test_cases/p01864/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31492008db653f25648bd17d299fb357e7bfbc1b --- /dev/null +++ b/codenet/public_test_cases/p01864/input.0.txt @@ -0,0 +1,10 @@ +5 6 +100 80 70 60 50 +1 2 500 +2 5 100 +1 3 400 +1 4 200 +3 5 700 +4 5 800 +1 +5 3 600 diff --git a/codenet/public_test_cases/p01864/input.1.txt b/codenet/public_test_cases/p01864/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31492008db653f25648bd17d299fb357e7bfbc1b --- /dev/null +++ b/codenet/public_test_cases/p01864/input.1.txt @@ -0,0 +1,10 @@ +5 6 +100 80 70 60 50 +1 2 500 +2 5 100 +1 3 400 +1 4 200 +3 5 700 +4 5 800 +1 +5 3 600 diff --git a/codenet/public_test_cases/p01864/output.0.txt b/codenet/public_test_cases/p01864/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01864/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01864/output.1.txt b/codenet/public_test_cases/p01864/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01864/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01865/input.0.txt b/codenet/public_test_cases/p01865/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f93ce3cba5964c3e906ab964d4725bc577daee2 --- /dev/null +++ b/codenet/public_test_cases/p01865/input.0.txt @@ -0,0 +1,5 @@ +3 +3 +1 1 +2 1 +3 1 diff --git a/codenet/public_test_cases/p01865/input.1.txt b/codenet/public_test_cases/p01865/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f93ce3cba5964c3e906ab964d4725bc577daee2 --- /dev/null +++ b/codenet/public_test_cases/p01865/input.1.txt @@ -0,0 +1,5 @@ +3 +3 +1 1 +2 1 +3 1 diff --git a/codenet/public_test_cases/p01865/output.0.txt b/codenet/public_test_cases/p01865/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30427f13f882dfd57862d0a28b8a4d1e84f4d09a --- /dev/null +++ b/codenet/public_test_cases/p01865/output.0.txt @@ -0,0 +1,2 @@ +1 +-3 2 diff --git a/codenet/public_test_cases/p01865/output.1.txt b/codenet/public_test_cases/p01865/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..30427f13f882dfd57862d0a28b8a4d1e84f4d09a --- /dev/null +++ b/codenet/public_test_cases/p01865/output.1.txt @@ -0,0 +1,2 @@ +1 +-3 2 diff --git a/codenet/public_test_cases/p01866/input.0.txt b/codenet/public_test_cases/p01866/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fad70d8023b88c1f92eea7f42b356e2c6c827366 --- /dev/null +++ b/codenet/public_test_cases/p01866/input.0.txt @@ -0,0 +1,3 @@ +5 +00001 +3 diff --git a/codenet/public_test_cases/p01866/input.1.txt b/codenet/public_test_cases/p01866/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fad70d8023b88c1f92eea7f42b356e2c6c827366 --- /dev/null +++ b/codenet/public_test_cases/p01866/input.1.txt @@ -0,0 +1,3 @@ +5 +00001 +3 diff --git a/codenet/public_test_cases/p01866/output.0.txt b/codenet/public_test_cases/p01866/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e33602193dad1fc59ab42c1dedcdc9f1d47c6fd8 --- /dev/null +++ b/codenet/public_test_cases/p01866/output.0.txt @@ -0,0 +1 @@ +11101 diff --git a/codenet/public_test_cases/p01866/output.1.txt b/codenet/public_test_cases/p01866/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e33602193dad1fc59ab42c1dedcdc9f1d47c6fd8 --- /dev/null +++ b/codenet/public_test_cases/p01866/output.1.txt @@ -0,0 +1 @@ +11101 diff --git a/codenet/public_test_cases/p01867/input.0.txt b/codenet/public_test_cases/p01867/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b606669574ba98b811e07f861671b8166c2d7e9a --- /dev/null +++ b/codenet/public_test_cases/p01867/input.0.txt @@ -0,0 +1,2 @@ +5 +a+a+a diff --git a/codenet/public_test_cases/p01867/input.1.txt b/codenet/public_test_cases/p01867/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b606669574ba98b811e07f861671b8166c2d7e9a --- /dev/null +++ b/codenet/public_test_cases/p01867/input.1.txt @@ -0,0 +1,2 @@ +5 +a+a+a diff --git a/codenet/public_test_cases/p01867/output.0.txt b/codenet/public_test_cases/p01867/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01867/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01867/output.1.txt b/codenet/public_test_cases/p01867/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01867/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01868/input.0.txt b/codenet/public_test_cases/p01868/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11f217775c0da58060668ed3c0cf477a9e6d9df6 --- /dev/null +++ b/codenet/public_test_cases/p01868/input.0.txt @@ -0,0 +1,5 @@ +4 +1 +1 +1 +1 diff --git a/codenet/public_test_cases/p01868/input.1.txt b/codenet/public_test_cases/p01868/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11f217775c0da58060668ed3c0cf477a9e6d9df6 --- /dev/null +++ b/codenet/public_test_cases/p01868/input.1.txt @@ -0,0 +1,5 @@ +4 +1 +1 +1 +1 diff --git a/codenet/public_test_cases/p01868/output.0.txt b/codenet/public_test_cases/p01868/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01868/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01868/output.1.txt b/codenet/public_test_cases/p01868/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01868/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01869/input.0.txt b/codenet/public_test_cases/p01869/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01869/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01869/input.1.txt b/codenet/public_test_cases/p01869/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01869/input.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01869/output.0.txt b/codenet/public_test_cases/p01869/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01869/output.0.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01869/output.1.txt b/codenet/public_test_cases/p01869/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01869/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01870/input.0.txt b/codenet/public_test_cases/p01870/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ad2245245edead13ba6e28084034085b27541aa --- /dev/null +++ b/codenet/public_test_cases/p01870/input.0.txt @@ -0,0 +1,5 @@ +5 +0 1 +0 2 +0 3 +0 4 diff --git a/codenet/public_test_cases/p01870/input.1.txt b/codenet/public_test_cases/p01870/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ad2245245edead13ba6e28084034085b27541aa --- /dev/null +++ b/codenet/public_test_cases/p01870/input.1.txt @@ -0,0 +1,5 @@ +5 +0 1 +0 2 +0 3 +0 4 diff --git a/codenet/public_test_cases/p01870/output.0.txt b/codenet/public_test_cases/p01870/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01870/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01870/output.1.txt b/codenet/public_test_cases/p01870/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01870/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01871/input.0.txt b/codenet/public_test_cases/p01871/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..434c372735cc0a4c9a91b21ddbff436d56863902 --- /dev/null +++ b/codenet/public_test_cases/p01871/input.0.txt @@ -0,0 +1,5 @@ +4 +0 0 +0 1 +1 1 +1 0 diff --git a/codenet/public_test_cases/p01871/output.0.txt b/codenet/public_test_cases/p01871/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01871/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01872/input.0.txt b/codenet/public_test_cases/p01872/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cf28ff1c0b795984c9d92a5d9bc2a7c3f9066a2 --- /dev/null +++ b/codenet/public_test_cases/p01872/input.0.txt @@ -0,0 +1 @@ +?12345678901 diff --git a/codenet/public_test_cases/p01872/input.1.txt b/codenet/public_test_cases/p01872/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cf28ff1c0b795984c9d92a5d9bc2a7c3f9066a2 --- /dev/null +++ b/codenet/public_test_cases/p01872/input.1.txt @@ -0,0 +1 @@ +?12345678901 diff --git a/codenet/public_test_cases/p01872/output.0.txt b/codenet/public_test_cases/p01872/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01872/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01872/output.1.txt b/codenet/public_test_cases/p01872/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01872/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01873/input.0.txt b/codenet/public_test_cases/p01873/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fc951fa890e12bb8c9791b96920a9f3e937b1a3 --- /dev/null +++ b/codenet/public_test_cases/p01873/input.0.txt @@ -0,0 +1,2 @@ +6 +1 2 3 1 2 3 diff --git a/codenet/public_test_cases/p01873/input.1.txt b/codenet/public_test_cases/p01873/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fc951fa890e12bb8c9791b96920a9f3e937b1a3 --- /dev/null +++ b/codenet/public_test_cases/p01873/input.1.txt @@ -0,0 +1,2 @@ +6 +1 2 3 1 2 3 diff --git a/codenet/public_test_cases/p01873/output.0.txt b/codenet/public_test_cases/p01873/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01873/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01873/output.1.txt b/codenet/public_test_cases/p01873/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01873/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01874/input.0.txt b/codenet/public_test_cases/p01874/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64983a355e83b5325e8aa7d194c23208c23e4883 --- /dev/null +++ b/codenet/public_test_cases/p01874/input.0.txt @@ -0,0 +1,3 @@ +2 2 0 0 +3 3 +4 0 diff --git a/codenet/public_test_cases/p01874/output.0.txt b/codenet/public_test_cases/p01874/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..43f1215f394cca5eefe6910ac0b9b725e485c97f --- /dev/null +++ b/codenet/public_test_cases/p01874/output.0.txt @@ -0,0 +1 @@ +7.16227766017 diff --git a/codenet/public_test_cases/p01875/input.1.txt b/codenet/public_test_cases/p01875/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01875/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01875/output.1.txt b/codenet/public_test_cases/p01875/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01875/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01876/input.0.txt b/codenet/public_test_cases/p01876/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea18bbed200672f460ced87f6ff7b57f9c5d5eaf --- /dev/null +++ b/codenet/public_test_cases/p01876/input.0.txt @@ -0,0 +1,7 @@ +3 3 4 +111 +111 +111 +111 +111 +111 diff --git a/codenet/public_test_cases/p01876/input.1.txt b/codenet/public_test_cases/p01876/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea18bbed200672f460ced87f6ff7b57f9c5d5eaf --- /dev/null +++ b/codenet/public_test_cases/p01876/input.1.txt @@ -0,0 +1,7 @@ +3 3 4 +111 +111 +111 +111 +111 +111 diff --git a/codenet/public_test_cases/p01876/output.0.txt b/codenet/public_test_cases/p01876/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01876/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01876/output.1.txt b/codenet/public_test_cases/p01876/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01876/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01877/input.0.txt b/codenet/public_test_cases/p01877/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19107170e588bb992e0b9fc3ffc2b7dc6ac5ff3f --- /dev/null +++ b/codenet/public_test_cases/p01877/input.0.txt @@ -0,0 +1,10 @@ +10 +0 1 2 3 4 4 3 2 1 0 +7 +2 6 0 +2 4 5 +7 9 10 +2 4 5 +3 8 100 +4 6 1000 +7 7 1000 diff --git a/codenet/public_test_cases/p01877/input.1.txt b/codenet/public_test_cases/p01877/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19107170e588bb992e0b9fc3ffc2b7dc6ac5ff3f --- /dev/null +++ b/codenet/public_test_cases/p01877/input.1.txt @@ -0,0 +1,10 @@ +10 +0 1 2 3 4 4 3 2 1 0 +7 +2 6 0 +2 4 5 +7 9 10 +2 4 5 +3 8 100 +4 6 1000 +7 7 1000 diff --git a/codenet/public_test_cases/p01877/output.0.txt b/codenet/public_test_cases/p01877/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..03350295484e4b612d485a2b61890963ffa2233c --- /dev/null +++ b/codenet/public_test_cases/p01877/output.0.txt @@ -0,0 +1,7 @@ +1 +0 +0 +1 +1 +0 +1 diff --git a/codenet/public_test_cases/p01877/output.1.txt b/codenet/public_test_cases/p01877/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03350295484e4b612d485a2b61890963ffa2233c --- /dev/null +++ b/codenet/public_test_cases/p01877/output.1.txt @@ -0,0 +1,7 @@ +1 +0 +0 +1 +1 +0 +1 diff --git a/codenet/public_test_cases/p01878/input.0.txt b/codenet/public_test_cases/p01878/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c074016fc295d1e0a0d1f6a6d30f292e76b60be3 --- /dev/null +++ b/codenet/public_test_cases/p01878/input.0.txt @@ -0,0 +1,2 @@ +4 1 1 6 +3 2 3 diff --git a/codenet/public_test_cases/p01878/input.1.txt b/codenet/public_test_cases/p01878/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c074016fc295d1e0a0d1f6a6d30f292e76b60be3 --- /dev/null +++ b/codenet/public_test_cases/p01878/input.1.txt @@ -0,0 +1,2 @@ +4 1 1 6 +3 2 3 diff --git a/codenet/public_test_cases/p01878/output.0.txt b/codenet/public_test_cases/p01878/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01878/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01878/output.1.txt b/codenet/public_test_cases/p01878/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01878/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01879/input.0.txt b/codenet/public_test_cases/p01879/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b9eee2dee6e5ee444fc9d473502b454a2e9c4d --- /dev/null +++ b/codenet/public_test_cases/p01879/input.0.txt @@ -0,0 +1,5 @@ +4 +4 1 3 2 +2 +1 3 +2 4 diff --git a/codenet/public_test_cases/p01879/input.1.txt b/codenet/public_test_cases/p01879/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b9eee2dee6e5ee444fc9d473502b454a2e9c4d --- /dev/null +++ b/codenet/public_test_cases/p01879/input.1.txt @@ -0,0 +1,5 @@ +4 +4 1 3 2 +2 +1 3 +2 4 diff --git a/codenet/public_test_cases/p01879/output.0.txt b/codenet/public_test_cases/p01879/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p01879/output.0.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p01879/output.1.txt b/codenet/public_test_cases/p01879/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p01879/output.1.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p01880/input.0.txt b/codenet/public_test_cases/p01880/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p01880/input.0.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p01880/input.1.txt b/codenet/public_test_cases/p01880/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p01880/input.1.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p01880/output.0.txt b/codenet/public_test_cases/p01880/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01880/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01880/output.1.txt b/codenet/public_test_cases/p01880/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01880/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01881/input.0.txt b/codenet/public_test_cases/p01881/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c215ce15446b7a8bea7bcad1c34ae0b9f0556195 --- /dev/null +++ b/codenet/public_test_cases/p01881/input.0.txt @@ -0,0 +1,3 @@ +2 4 +%.@\$ +..\$\$ diff --git a/codenet/public_test_cases/p01881/input.1.txt b/codenet/public_test_cases/p01881/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c215ce15446b7a8bea7bcad1c34ae0b9f0556195 --- /dev/null +++ b/codenet/public_test_cases/p01881/input.1.txt @@ -0,0 +1,3 @@ +2 4 +%.@\$ +..\$\$ diff --git a/codenet/public_test_cases/p01881/output.0.txt b/codenet/public_test_cases/p01881/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01881/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01881/output.1.txt b/codenet/public_test_cases/p01881/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01881/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01882/input.0.txt b/codenet/public_test_cases/p01882/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fb59fadc676decab7794e6cf80cf4b4b95e91b1 --- /dev/null +++ b/codenet/public_test_cases/p01882/input.0.txt @@ -0,0 +1,7 @@ +4 +Durett 7 +Gayles 3 +Facenda 6 +Daughtery 0 +1 ++ Mccourtney 2 diff --git a/codenet/public_test_cases/p01882/input.1.txt b/codenet/public_test_cases/p01882/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fb59fadc676decab7794e6cf80cf4b4b95e91b1 --- /dev/null +++ b/codenet/public_test_cases/p01882/input.1.txt @@ -0,0 +1,7 @@ +4 +Durett 7 +Gayles 3 +Facenda 6 +Daughtery 0 +1 ++ Mccourtney 2 diff --git a/codenet/public_test_cases/p01882/output.0.txt b/codenet/public_test_cases/p01882/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b0ccfab710fcba5a268de98acef7edd77e15a08 --- /dev/null +++ b/codenet/public_test_cases/p01882/output.0.txt @@ -0,0 +1,2 @@ +Mccourtney is not working now. +Durett is working hard now. diff --git a/codenet/public_test_cases/p01882/output.1.txt b/codenet/public_test_cases/p01882/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b0ccfab710fcba5a268de98acef7edd77e15a08 --- /dev/null +++ b/codenet/public_test_cases/p01882/output.1.txt @@ -0,0 +1,2 @@ +Mccourtney is not working now. +Durett is working hard now. diff --git a/codenet/public_test_cases/p01883/input.0.txt b/codenet/public_test_cases/p01883/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01883/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01883/input.1.txt b/codenet/public_test_cases/p01883/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01883/input.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01883/output.0.txt b/codenet/public_test_cases/p01883/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..71497e5d3c40c0f26ec02a376dd21b6deaafac28 --- /dev/null +++ b/codenet/public_test_cases/p01883/output.0.txt @@ -0,0 +1 @@ +)( diff --git a/codenet/public_test_cases/p01883/output.1.txt b/codenet/public_test_cases/p01883/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..71497e5d3c40c0f26ec02a376dd21b6deaafac28 --- /dev/null +++ b/codenet/public_test_cases/p01883/output.1.txt @@ -0,0 +1 @@ +)( diff --git a/codenet/public_test_cases/p01884/input.0.txt b/codenet/public_test_cases/p01884/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c72b3da306856365ee286decd1b683a1a728c54 --- /dev/null +++ b/codenet/public_test_cases/p01884/input.0.txt @@ -0,0 +1,5 @@ +5 +1 2 +1 3 +1 4 +1 5 diff --git a/codenet/public_test_cases/p01884/input.1.txt b/codenet/public_test_cases/p01884/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c72b3da306856365ee286decd1b683a1a728c54 --- /dev/null +++ b/codenet/public_test_cases/p01884/input.1.txt @@ -0,0 +1,5 @@ +5 +1 2 +1 3 +1 4 +1 5 diff --git a/codenet/public_test_cases/p01884/output.0.txt b/codenet/public_test_cases/p01884/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01884/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01884/output.1.txt b/codenet/public_test_cases/p01884/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01884/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01885/input.0.txt b/codenet/public_test_cases/p01885/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f0d231458773cefb8cf1c6bbfffb2a19b4768fc --- /dev/null +++ b/codenet/public_test_cases/p01885/input.0.txt @@ -0,0 +1,7 @@ +3 9 +6 3 +5 2 +3 1 +2 +2 +2 diff --git a/codenet/public_test_cases/p01885/input.1.txt b/codenet/public_test_cases/p01885/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f0d231458773cefb8cf1c6bbfffb2a19b4768fc --- /dev/null +++ b/codenet/public_test_cases/p01885/input.1.txt @@ -0,0 +1,7 @@ +3 9 +6 3 +5 2 +3 1 +2 +2 +2 diff --git a/codenet/public_test_cases/p01885/output.0.txt b/codenet/public_test_cases/p01885/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01885/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01885/output.1.txt b/codenet/public_test_cases/p01885/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01885/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01886/input.0.txt b/codenet/public_test_cases/p01886/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12401cb1aaf7c026e68a46010a443f1bf83d67ad --- /dev/null +++ b/codenet/public_test_cases/p01886/input.0.txt @@ -0,0 +1,9 @@ +8 +-10 0 +-10 5 +-5 5 +-5 0 +10 0 +10 -5 +5 -5 +5 0 diff --git a/codenet/public_test_cases/p01886/input.1.txt b/codenet/public_test_cases/p01886/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12401cb1aaf7c026e68a46010a443f1bf83d67ad --- /dev/null +++ b/codenet/public_test_cases/p01886/input.1.txt @@ -0,0 +1,9 @@ +8 +-10 0 +-10 5 +-5 5 +-5 0 +10 0 +10 -5 +5 -5 +5 0 diff --git a/codenet/public_test_cases/p01886/output.0.txt b/codenet/public_test_cases/p01886/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p01886/output.0.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p01886/output.1.txt b/codenet/public_test_cases/p01886/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p01886/output.1.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p01887/input.0.txt b/codenet/public_test_cases/p01887/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fdc53daf47d153ee9473e179b1fe36b1c233852 --- /dev/null +++ b/codenet/public_test_cases/p01887/input.0.txt @@ -0,0 +1,8 @@ +5 5 4 +6 +3 2 +4 2 +5 2 +1 4 +3 4 +5 4 diff --git a/codenet/public_test_cases/p01887/input.1.txt b/codenet/public_test_cases/p01887/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fdc53daf47d153ee9473e179b1fe36b1c233852 --- /dev/null +++ b/codenet/public_test_cases/p01887/input.1.txt @@ -0,0 +1,8 @@ +5 5 4 +6 +3 2 +4 2 +5 2 +1 4 +3 4 +5 4 diff --git a/codenet/public_test_cases/p01887/output.0.txt b/codenet/public_test_cases/p01887/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01887/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01887/output.1.txt b/codenet/public_test_cases/p01887/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01887/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01888/input.0.txt b/codenet/public_test_cases/p01888/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90f50401f5b8360f7899606f42a2fb631c3e7ff1 --- /dev/null +++ b/codenet/public_test_cases/p01888/input.0.txt @@ -0,0 +1,2 @@ +1 10 2 +1 1 1 diff --git a/codenet/public_test_cases/p01888/input.1.txt b/codenet/public_test_cases/p01888/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..90f50401f5b8360f7899606f42a2fb631c3e7ff1 --- /dev/null +++ b/codenet/public_test_cases/p01888/input.1.txt @@ -0,0 +1,2 @@ +1 10 2 +1 1 1 diff --git a/codenet/public_test_cases/p01888/output.0.txt b/codenet/public_test_cases/p01888/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd5ac039d67e0bdadb17976e4ac39f0ffe6bb6e4 --- /dev/null +++ b/codenet/public_test_cases/p01888/output.0.txt @@ -0,0 +1 @@ +2.0 diff --git a/codenet/public_test_cases/p01888/output.1.txt b/codenet/public_test_cases/p01888/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd5ac039d67e0bdadb17976e4ac39f0ffe6bb6e4 --- /dev/null +++ b/codenet/public_test_cases/p01888/output.1.txt @@ -0,0 +1 @@ +2.0 diff --git a/codenet/public_test_cases/p01889/input.0.txt b/codenet/public_test_cases/p01889/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b06ea24e087a868013b011812e364fcf7a83b3ea --- /dev/null +++ b/codenet/public_test_cases/p01889/input.0.txt @@ -0,0 +1,2 @@ +1 +5 1 diff --git a/codenet/public_test_cases/p01889/input.1.txt b/codenet/public_test_cases/p01889/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b06ea24e087a868013b011812e364fcf7a83b3ea --- /dev/null +++ b/codenet/public_test_cases/p01889/input.1.txt @@ -0,0 +1,2 @@ +1 +5 1 diff --git a/codenet/public_test_cases/p01889/output.0.txt b/codenet/public_test_cases/p01889/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7c6dd0164fe0eb4fde767f9e731a6c8ade0b69f --- /dev/null +++ b/codenet/public_test_cases/p01889/output.0.txt @@ -0,0 +1 @@ +11111 diff --git a/codenet/public_test_cases/p01889/output.1.txt b/codenet/public_test_cases/p01889/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7c6dd0164fe0eb4fde767f9e731a6c8ade0b69f --- /dev/null +++ b/codenet/public_test_cases/p01889/output.1.txt @@ -0,0 +1 @@ +11111 diff --git a/codenet/public_test_cases/p01890/input.0.txt b/codenet/public_test_cases/p01890/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a52c380b38bc0b40dca39e475e5b0df381eaa9f0 --- /dev/null +++ b/codenet/public_test_cases/p01890/input.0.txt @@ -0,0 +1,6 @@ +5 +5 8 1 3 5 +1 2 4 +2 3 3 +2 4 3 +1 5 7 diff --git a/codenet/public_test_cases/p01890/input.1.txt b/codenet/public_test_cases/p01890/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a52c380b38bc0b40dca39e475e5b0df381eaa9f0 --- /dev/null +++ b/codenet/public_test_cases/p01890/input.1.txt @@ -0,0 +1,6 @@ +5 +5 8 1 3 5 +1 2 4 +2 3 3 +2 4 3 +1 5 7 diff --git a/codenet/public_test_cases/p01890/output.0.txt b/codenet/public_test_cases/p01890/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01890/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01890/output.1.txt b/codenet/public_test_cases/p01890/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01890/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01891/input.0.txt b/codenet/public_test_cases/p01891/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61bb39070d2e9b2b5852218480daa25ef312e15e --- /dev/null +++ b/codenet/public_test_cases/p01891/input.0.txt @@ -0,0 +1,2 @@ +5 3 6 9 +9 7 5 3 1 diff --git a/codenet/public_test_cases/p01891/input.1.txt b/codenet/public_test_cases/p01891/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..61bb39070d2e9b2b5852218480daa25ef312e15e --- /dev/null +++ b/codenet/public_test_cases/p01891/input.1.txt @@ -0,0 +1,2 @@ +5 3 6 9 +9 7 5 3 1 diff --git a/codenet/public_test_cases/p01891/output.0.txt b/codenet/public_test_cases/p01891/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01891/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01891/output.1.txt b/codenet/public_test_cases/p01891/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01891/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01892/input.0.txt b/codenet/public_test_cases/p01892/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad688cd1cc0c00a0cd91e01d4d2bdf854792f701 --- /dev/null +++ b/codenet/public_test_cases/p01892/input.0.txt @@ -0,0 +1 @@ +19 30 3 diff --git a/codenet/public_test_cases/p01892/input.1.txt b/codenet/public_test_cases/p01892/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad688cd1cc0c00a0cd91e01d4d2bdf854792f701 --- /dev/null +++ b/codenet/public_test_cases/p01892/input.1.txt @@ -0,0 +1 @@ +19 30 3 diff --git a/codenet/public_test_cases/p01892/output.0.txt b/codenet/public_test_cases/p01892/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01892/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01892/output.1.txt b/codenet/public_test_cases/p01892/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01892/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01893/input.0.txt b/codenet/public_test_cases/p01893/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e406c25e3486c91d3e6492e2748c7fdf304591ce --- /dev/null +++ b/codenet/public_test_cases/p01893/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 0 0 +1 2 0 0 diff --git a/codenet/public_test_cases/p01893/input.1.txt b/codenet/public_test_cases/p01893/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e406c25e3486c91d3e6492e2748c7fdf304591ce --- /dev/null +++ b/codenet/public_test_cases/p01893/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 0 0 +1 2 0 0 diff --git a/codenet/public_test_cases/p01893/output.0.txt b/codenet/public_test_cases/p01893/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ca33ce15d016381fff70f1fcb6bde9fadf1756c --- /dev/null +++ b/codenet/public_test_cases/p01893/output.0.txt @@ -0,0 +1,4 @@ +YES +0 1 0 +0 0 1 +0 0 0 diff --git a/codenet/public_test_cases/p01893/output.1.txt b/codenet/public_test_cases/p01893/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ca33ce15d016381fff70f1fcb6bde9fadf1756c --- /dev/null +++ b/codenet/public_test_cases/p01893/output.1.txt @@ -0,0 +1,4 @@ +YES +0 1 0 +0 0 1 +0 0 0 diff --git a/codenet/public_test_cases/p01894/input.0.txt b/codenet/public_test_cases/p01894/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..57b9c358b596a57fe065011680d481a8d16e7691 --- /dev/null +++ b/codenet/public_test_cases/p01894/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01894/input.1.txt b/codenet/public_test_cases/p01894/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57b9c358b596a57fe065011680d481a8d16e7691 --- /dev/null +++ b/codenet/public_test_cases/p01894/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01894/output.0.txt b/codenet/public_test_cases/p01894/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01894/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01894/output.1.txt b/codenet/public_test_cases/p01894/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01894/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01895/input.1.txt b/codenet/public_test_cases/p01895/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01895/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01895/output.1.txt b/codenet/public_test_cases/p01895/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01895/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01896/input.0.txt b/codenet/public_test_cases/p01896/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..580c339538e5623f1d06c7317471d3583df52345 --- /dev/null +++ b/codenet/public_test_cases/p01896/input.0.txt @@ -0,0 +1,2 @@ +1 4 +0 1 2 3 diff --git a/codenet/public_test_cases/p01896/input.1.txt b/codenet/public_test_cases/p01896/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..580c339538e5623f1d06c7317471d3583df52345 --- /dev/null +++ b/codenet/public_test_cases/p01896/input.1.txt @@ -0,0 +1,2 @@ +1 4 +0 1 2 3 diff --git a/codenet/public_test_cases/p01896/output.0.txt b/codenet/public_test_cases/p01896/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01896/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01896/output.1.txt b/codenet/public_test_cases/p01896/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01896/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01897/input.0.txt b/codenet/public_test_cases/p01897/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..57b9c358b596a57fe065011680d481a8d16e7691 --- /dev/null +++ b/codenet/public_test_cases/p01897/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01897/input.1.txt b/codenet/public_test_cases/p01897/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57b9c358b596a57fe065011680d481a8d16e7691 --- /dev/null +++ b/codenet/public_test_cases/p01897/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p01897/output.0.txt b/codenet/public_test_cases/p01897/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01897/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01897/output.1.txt b/codenet/public_test_cases/p01897/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p01897/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p01898/input.0.txt b/codenet/public_test_cases/p01898/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a6b5b7f29050fccbcee03f84cd7ee88a1979c7e --- /dev/null +++ b/codenet/public_test_cases/p01898/input.0.txt @@ -0,0 +1,6 @@ +5 5 +--o-- +--xo- +--x-- +o---x +--xoo diff --git a/codenet/public_test_cases/p01898/input.1.txt b/codenet/public_test_cases/p01898/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a6b5b7f29050fccbcee03f84cd7ee88a1979c7e --- /dev/null +++ b/codenet/public_test_cases/p01898/input.1.txt @@ -0,0 +1,6 @@ +5 5 +--o-- +--xo- +--x-- +o---x +--xoo diff --git a/codenet/public_test_cases/p01898/output.0.txt b/codenet/public_test_cases/p01898/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01898/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01898/output.1.txt b/codenet/public_test_cases/p01898/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01898/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01899/input.0.txt b/codenet/public_test_cases/p01899/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2566b4d166edbecf5ab1cebda3ba1f6ea5464f48 --- /dev/null +++ b/codenet/public_test_cases/p01899/input.0.txt @@ -0,0 +1,2 @@ +5 130 +130 170 100 120 140 diff --git a/codenet/public_test_cases/p01899/input.1.txt b/codenet/public_test_cases/p01899/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2566b4d166edbecf5ab1cebda3ba1f6ea5464f48 --- /dev/null +++ b/codenet/public_test_cases/p01899/input.1.txt @@ -0,0 +1,2 @@ +5 130 +130 170 100 120 140 diff --git a/codenet/public_test_cases/p01899/output.0.txt b/codenet/public_test_cases/p01899/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p01899/output.0.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p01899/output.1.txt b/codenet/public_test_cases/p01899/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p01899/output.1.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p01900/input.0.txt b/codenet/public_test_cases/p01900/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2a3698f49db65bb351e57a3eab72a7acee71d5f --- /dev/null +++ b/codenet/public_test_cases/p01900/input.0.txt @@ -0,0 +1,2 @@ +6 +2 5 2 5 2 1 diff --git a/codenet/public_test_cases/p01900/input.1.txt b/codenet/public_test_cases/p01900/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2a3698f49db65bb351e57a3eab72a7acee71d5f --- /dev/null +++ b/codenet/public_test_cases/p01900/input.1.txt @@ -0,0 +1,2 @@ +6 +2 5 2 5 2 1 diff --git a/codenet/public_test_cases/p01900/output.0.txt b/codenet/public_test_cases/p01900/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01900/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01900/output.1.txt b/codenet/public_test_cases/p01900/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01900/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01901/input.0.txt b/codenet/public_test_cases/p01901/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..833147746e719c7086b24dd9d6815fbfb059ce57 --- /dev/null +++ b/codenet/public_test_cases/p01901/input.0.txt @@ -0,0 +1,3 @@ +20 +1 +0 10 diff --git a/codenet/public_test_cases/p01901/input.1.txt b/codenet/public_test_cases/p01901/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..833147746e719c7086b24dd9d6815fbfb059ce57 --- /dev/null +++ b/codenet/public_test_cases/p01901/input.1.txt @@ -0,0 +1,3 @@ +20 +1 +0 10 diff --git a/codenet/public_test_cases/p01901/output.0.txt b/codenet/public_test_cases/p01901/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01901/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01901/output.1.txt b/codenet/public_test_cases/p01901/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01901/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01902/input.0.txt b/codenet/public_test_cases/p01902/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc5373600e3af8e99fa3035092ff1469ccef1685 --- /dev/null +++ b/codenet/public_test_cases/p01902/input.0.txt @@ -0,0 +1,4 @@ +1 +1 1 +3 0 1 1 +1 1 diff --git a/codenet/public_test_cases/p01902/input.1.txt b/codenet/public_test_cases/p01902/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc5373600e3af8e99fa3035092ff1469ccef1685 --- /dev/null +++ b/codenet/public_test_cases/p01902/input.1.txt @@ -0,0 +1,4 @@ +1 +1 1 +3 0 1 1 +1 1 diff --git a/codenet/public_test_cases/p01902/output.0.txt b/codenet/public_test_cases/p01902/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba66466c2a0d0a1080ad71d8e1a67a97f336c384 --- /dev/null +++ b/codenet/public_test_cases/p01902/output.0.txt @@ -0,0 +1 @@ +0.0 diff --git a/codenet/public_test_cases/p01902/output.1.txt b/codenet/public_test_cases/p01902/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba66466c2a0d0a1080ad71d8e1a67a97f336c384 --- /dev/null +++ b/codenet/public_test_cases/p01902/output.1.txt @@ -0,0 +1 @@ +0.0 diff --git a/codenet/public_test_cases/p01903/input.0.txt b/codenet/public_test_cases/p01903/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c8824b960f75f35dd7dd6665fe4ebe0422859dd --- /dev/null +++ b/codenet/public_test_cases/p01903/input.0.txt @@ -0,0 +1,5 @@ +2 2 4 +1 3 4 +2 4 2 +0 3 3 +4 0 5 diff --git a/codenet/public_test_cases/p01903/input.1.txt b/codenet/public_test_cases/p01903/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c8824b960f75f35dd7dd6665fe4ebe0422859dd --- /dev/null +++ b/codenet/public_test_cases/p01903/input.1.txt @@ -0,0 +1,5 @@ +2 2 4 +1 3 4 +2 4 2 +0 3 3 +4 0 5 diff --git a/codenet/public_test_cases/p01903/output.0.txt b/codenet/public_test_cases/p01903/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01903/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01903/output.1.txt b/codenet/public_test_cases/p01903/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01903/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01904/input.0.txt b/codenet/public_test_cases/p01904/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01904/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01904/input.1.txt b/codenet/public_test_cases/p01904/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01904/input.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01904/output.0.txt b/codenet/public_test_cases/p01904/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01904/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01904/output.1.txt b/codenet/public_test_cases/p01904/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01904/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01905/input.0.txt b/codenet/public_test_cases/p01905/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a74b3c2309d5dee0e16c0639409cbe4bfd6f1f9e --- /dev/null +++ b/codenet/public_test_cases/p01905/input.0.txt @@ -0,0 +1 @@ +2 0 diff --git a/codenet/public_test_cases/p01905/input.1.txt b/codenet/public_test_cases/p01905/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a74b3c2309d5dee0e16c0639409cbe4bfd6f1f9e --- /dev/null +++ b/codenet/public_test_cases/p01905/input.1.txt @@ -0,0 +1 @@ +2 0 diff --git a/codenet/public_test_cases/p01905/output.0.txt b/codenet/public_test_cases/p01905/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01905/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01905/output.1.txt b/codenet/public_test_cases/p01905/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01905/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01906/input.0.txt b/codenet/public_test_cases/p01906/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d863f6b9f5cc5a4ee14e9b3511335036bc91a8a9 --- /dev/null +++ b/codenet/public_test_cases/p01906/input.0.txt @@ -0,0 +1,2 @@ +8 2 +23 61 57 13 91 41 79 41 diff --git a/codenet/public_test_cases/p01906/input.1.txt b/codenet/public_test_cases/p01906/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d863f6b9f5cc5a4ee14e9b3511335036bc91a8a9 --- /dev/null +++ b/codenet/public_test_cases/p01906/input.1.txt @@ -0,0 +1,2 @@ +8 2 +23 61 57 13 91 41 79 41 diff --git a/codenet/public_test_cases/p01906/output.0.txt b/codenet/public_test_cases/p01906/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cd1cfa2cfe0f845d31839e6c8500e55df8fad41 --- /dev/null +++ b/codenet/public_test_cases/p01906/output.0.txt @@ -0,0 +1 @@ +170 diff --git a/codenet/public_test_cases/p01906/output.1.txt b/codenet/public_test_cases/p01906/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cd1cfa2cfe0f845d31839e6c8500e55df8fad41 --- /dev/null +++ b/codenet/public_test_cases/p01906/output.1.txt @@ -0,0 +1 @@ +170 diff --git a/codenet/public_test_cases/p01907/input.0.txt b/codenet/public_test_cases/p01907/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..223a798543ab777a8ebe23f2bdbade4f8c70c914 --- /dev/null +++ b/codenet/public_test_cases/p01907/input.0.txt @@ -0,0 +1,5 @@ +0.75 +4 +1 2 1 +2 3 3 +3 4 10 diff --git a/codenet/public_test_cases/p01907/input.1.txt b/codenet/public_test_cases/p01907/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..223a798543ab777a8ebe23f2bdbade4f8c70c914 --- /dev/null +++ b/codenet/public_test_cases/p01907/input.1.txt @@ -0,0 +1,5 @@ +0.75 +4 +1 2 1 +2 3 3 +3 4 10 diff --git a/codenet/public_test_cases/p01907/output.0.txt b/codenet/public_test_cases/p01907/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b45d359a2b8ead6faaf7190967a9f69dddd0c1d --- /dev/null +++ b/codenet/public_test_cases/p01907/output.0.txt @@ -0,0 +1 @@ +24.8569335938 diff --git a/codenet/public_test_cases/p01907/output.1.txt b/codenet/public_test_cases/p01907/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b45d359a2b8ead6faaf7190967a9f69dddd0c1d --- /dev/null +++ b/codenet/public_test_cases/p01907/output.1.txt @@ -0,0 +1 @@ +24.8569335938 diff --git a/codenet/public_test_cases/p01908/input.0.txt b/codenet/public_test_cases/p01908/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..77e4e8fc999c8ad5c5b511953d04529b7bc5f169 --- /dev/null +++ b/codenet/public_test_cases/p01908/input.0.txt @@ -0,0 +1,6 @@ +5 +password +login +admin +root +master diff --git a/codenet/public_test_cases/p01908/input.1.txt b/codenet/public_test_cases/p01908/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..77e4e8fc999c8ad5c5b511953d04529b7bc5f169 --- /dev/null +++ b/codenet/public_test_cases/p01908/input.1.txt @@ -0,0 +1,6 @@ +5 +password +login +admin +root +master diff --git a/codenet/public_test_cases/p01908/output.0.txt b/codenet/public_test_cases/p01908/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p01908/output.0.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p01908/output.1.txt b/codenet/public_test_cases/p01908/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p01908/output.1.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p01909/input.0.txt b/codenet/public_test_cases/p01909/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9ad3634cdaf27386c1d4aa6e744801cbf98bbc8 --- /dev/null +++ b/codenet/public_test_cases/p01909/input.0.txt @@ -0,0 +1,2 @@ +RRLUDDD +2 diff --git a/codenet/public_test_cases/p01909/input.1.txt b/codenet/public_test_cases/p01909/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9ad3634cdaf27386c1d4aa6e744801cbf98bbc8 --- /dev/null +++ b/codenet/public_test_cases/p01909/input.1.txt @@ -0,0 +1,2 @@ +RRLUDDD +2 diff --git a/codenet/public_test_cases/p01909/output.0.txt b/codenet/public_test_cases/p01909/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01909/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01909/output.1.txt b/codenet/public_test_cases/p01909/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01909/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01910/input.0.txt b/codenet/public_test_cases/p01910/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9babbcd3bffa056c2509a3d98a07a6dea1229ed --- /dev/null +++ b/codenet/public_test_cases/p01910/input.0.txt @@ -0,0 +1,7 @@ +4 4 2 2 +1 2 1 +2 3 1 +3 4 5 +4 1 7 +1 4 5 +2 4 3 diff --git a/codenet/public_test_cases/p01910/input.1.txt b/codenet/public_test_cases/p01910/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9babbcd3bffa056c2509a3d98a07a6dea1229ed --- /dev/null +++ b/codenet/public_test_cases/p01910/input.1.txt @@ -0,0 +1,7 @@ +4 4 2 2 +1 2 1 +2 3 1 +3 4 5 +4 1 7 +1 4 5 +2 4 3 diff --git a/codenet/public_test_cases/p01910/output.0.txt b/codenet/public_test_cases/p01910/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01910/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01910/output.1.txt b/codenet/public_test_cases/p01910/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01910/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01911/input.0.txt b/codenet/public_test_cases/p01911/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..53ff10394b6a2fc3df04d100530fdd3e4211b242 --- /dev/null +++ b/codenet/public_test_cases/p01911/input.0.txt @@ -0,0 +1,3 @@ +2 2 1 2 +1 2 10 100 +1 2 5 500 diff --git a/codenet/public_test_cases/p01911/input.1.txt b/codenet/public_test_cases/p01911/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..53ff10394b6a2fc3df04d100530fdd3e4211b242 --- /dev/null +++ b/codenet/public_test_cases/p01911/input.1.txt @@ -0,0 +1,3 @@ +2 2 1 2 +1 2 10 100 +1 2 5 500 diff --git a/codenet/public_test_cases/p01911/output.0.txt b/codenet/public_test_cases/p01911/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01911/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01911/output.1.txt b/codenet/public_test_cases/p01911/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01911/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01912/input.0.txt b/codenet/public_test_cases/p01912/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..472b649024d21b2b50c31b181c8a6cffc7ac933d --- /dev/null +++ b/codenet/public_test_cases/p01912/input.0.txt @@ -0,0 +1,5 @@ +2 2 2 +1 0 0 1 +0 0 1 0 +0 0 +0 1 diff --git a/codenet/public_test_cases/p01912/input.1.txt b/codenet/public_test_cases/p01912/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..472b649024d21b2b50c31b181c8a6cffc7ac933d --- /dev/null +++ b/codenet/public_test_cases/p01912/input.1.txt @@ -0,0 +1,5 @@ +2 2 2 +1 0 0 1 +0 0 1 0 +0 0 +0 1 diff --git a/codenet/public_test_cases/p01912/output.0.txt b/codenet/public_test_cases/p01912/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01912/output.0.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01912/output.1.txt b/codenet/public_test_cases/p01912/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01912/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01913/input.0.txt b/codenet/public_test_cases/p01913/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da124372a0293306ceec035f46daef689af8844 --- /dev/null +++ b/codenet/public_test_cases/p01913/input.0.txt @@ -0,0 +1,5 @@ +5 4 2 +1 2 2 +2 3 1 +1 4 2 +4 5 1 diff --git a/codenet/public_test_cases/p01913/input.1.txt b/codenet/public_test_cases/p01913/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da124372a0293306ceec035f46daef689af8844 --- /dev/null +++ b/codenet/public_test_cases/p01913/input.1.txt @@ -0,0 +1,5 @@ +5 4 2 +1 2 2 +2 3 1 +1 4 2 +4 5 1 diff --git a/codenet/public_test_cases/p01913/output.0.txt b/codenet/public_test_cases/p01913/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01913/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01913/output.1.txt b/codenet/public_test_cases/p01913/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01913/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01914/input.0.txt b/codenet/public_test_cases/p01914/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c726086897279c1cf54d4ece41ad3d78b456567 --- /dev/null +++ b/codenet/public_test_cases/p01914/input.0.txt @@ -0,0 +1,6 @@ +5 +3 5 +7 4 +11 9 +3 7 +7 8 diff --git a/codenet/public_test_cases/p01914/output.0.txt b/codenet/public_test_cases/p01914/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01914/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01915/input.0.txt b/codenet/public_test_cases/p01915/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2650ccf89f8b5638e3267fc60a1dc641fd6a238 --- /dev/null +++ b/codenet/public_test_cases/p01915/input.0.txt @@ -0,0 +1,5 @@ +3 2 2 +50 65 70 +80 100 80 +90 65 45 +1 1 diff --git a/codenet/public_test_cases/p01915/input.1.txt b/codenet/public_test_cases/p01915/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2650ccf89f8b5638e3267fc60a1dc641fd6a238 --- /dev/null +++ b/codenet/public_test_cases/p01915/input.1.txt @@ -0,0 +1,5 @@ +3 2 2 +50 65 70 +80 100 80 +90 65 45 +1 1 diff --git a/codenet/public_test_cases/p01915/output.0.txt b/codenet/public_test_cases/p01915/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..188ccfe56495a62c5492ae41e8147c5123e25562 --- /dev/null +++ b/codenet/public_test_cases/p01915/output.0.txt @@ -0,0 +1 @@ +225 diff --git a/codenet/public_test_cases/p01915/output.1.txt b/codenet/public_test_cases/p01915/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..188ccfe56495a62c5492ae41e8147c5123e25562 --- /dev/null +++ b/codenet/public_test_cases/p01915/output.1.txt @@ -0,0 +1 @@ +225 diff --git a/codenet/public_test_cases/p01916/input.0.txt b/codenet/public_test_cases/p01916/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1ac4b5588b8f72838fbac0e6307f795e05a1b42 --- /dev/null +++ b/codenet/public_test_cases/p01916/input.0.txt @@ -0,0 +1 @@ +hcpc diff --git a/codenet/public_test_cases/p01916/input.1.txt b/codenet/public_test_cases/p01916/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1ac4b5588b8f72838fbac0e6307f795e05a1b42 --- /dev/null +++ b/codenet/public_test_cases/p01916/input.1.txt @@ -0,0 +1 @@ +hcpc diff --git a/codenet/public_test_cases/p01916/output.0.txt b/codenet/public_test_cases/p01916/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01916/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01916/output.1.txt b/codenet/public_test_cases/p01916/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01916/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01917/input.0.txt b/codenet/public_test_cases/p01917/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c2c0b92b74ac5ee672622146d25569f149a0515 --- /dev/null +++ b/codenet/public_test_cases/p01917/input.0.txt @@ -0,0 +1,11 @@ +9 +9 8 7 6 5 4 3 2 1 +1 1 1 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +7 7 7 +8 8 8 +9 9 9 diff --git a/codenet/public_test_cases/p01917/input.1.txt b/codenet/public_test_cases/p01917/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c2c0b92b74ac5ee672622146d25569f149a0515 --- /dev/null +++ b/codenet/public_test_cases/p01917/input.1.txt @@ -0,0 +1,11 @@ +9 +9 8 7 6 5 4 3 2 1 +1 1 1 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +6 6 6 +7 7 7 +8 8 8 +9 9 9 diff --git a/codenet/public_test_cases/p01917/output.0.txt b/codenet/public_test_cases/p01917/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01917/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01917/output.1.txt b/codenet/public_test_cases/p01917/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01917/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01918/input.1.txt b/codenet/public_test_cases/p01918/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01918/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01918/output.1.txt b/codenet/public_test_cases/p01918/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01918/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01919/input.0.txt b/codenet/public_test_cases/p01919/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0deec6fcc66b102ff7353519ccebd9e938ef2d6 --- /dev/null +++ b/codenet/public_test_cases/p01919/input.0.txt @@ -0,0 +1,7 @@ +4 4 +1 2 3 +2 3 1 +2 4 5 +3 4 2 +5 +4 5 6 diff --git a/codenet/public_test_cases/p01919/input.1.txt b/codenet/public_test_cases/p01919/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0deec6fcc66b102ff7353519ccebd9e938ef2d6 --- /dev/null +++ b/codenet/public_test_cases/p01919/input.1.txt @@ -0,0 +1,7 @@ +4 4 +1 2 3 +2 3 1 +2 4 5 +3 4 2 +5 +4 5 6 diff --git a/codenet/public_test_cases/p01919/output.0.txt b/codenet/public_test_cases/p01919/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p01919/output.0.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p01919/output.1.txt b/codenet/public_test_cases/p01919/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p01919/output.1.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p01920/input.0.txt b/codenet/public_test_cases/p01920/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2a06c6c1ec401acf3a31fe6718fab0f4585c5b8 --- /dev/null +++ b/codenet/public_test_cases/p01920/input.0.txt @@ -0,0 +1,6 @@ +10 +0101100110 +3 +3 3 1 +1 6 0 +2 5 1 diff --git a/codenet/public_test_cases/p01920/input.1.txt b/codenet/public_test_cases/p01920/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2a06c6c1ec401acf3a31fe6718fab0f4585c5b8 --- /dev/null +++ b/codenet/public_test_cases/p01920/input.1.txt @@ -0,0 +1,6 @@ +10 +0101100110 +3 +3 3 1 +1 6 0 +2 5 1 diff --git a/codenet/public_test_cases/p01920/output.0.txt b/codenet/public_test_cases/p01920/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p01920/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p01920/output.1.txt b/codenet/public_test_cases/p01920/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p01920/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p01921/input.0.txt b/codenet/public_test_cases/p01921/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cea2b75b65fe293834f406708c28448964bd10aa --- /dev/null +++ b/codenet/public_test_cases/p01921/input.0.txt @@ -0,0 +1,9 @@ +6 4 +1 2 +2 3 +2 4 +5 6 +4 +2 3 +3 1 +3 4 diff --git a/codenet/public_test_cases/p01921/input.1.txt b/codenet/public_test_cases/p01921/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cea2b75b65fe293834f406708c28448964bd10aa --- /dev/null +++ b/codenet/public_test_cases/p01921/input.1.txt @@ -0,0 +1,9 @@ +6 4 +1 2 +2 3 +2 4 +5 6 +4 +2 3 +3 1 +3 4 diff --git a/codenet/public_test_cases/p01921/output.0.txt b/codenet/public_test_cases/p01921/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01921/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01921/output.1.txt b/codenet/public_test_cases/p01921/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01921/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01922/input.0.txt b/codenet/public_test_cases/p01922/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0905b124efff5d89e46313458b57528d04ab2e63 --- /dev/null +++ b/codenet/public_test_cases/p01922/input.0.txt @@ -0,0 +1,4 @@ +5 +3 4 2 1 5 +3 +1 2 3 diff --git a/codenet/public_test_cases/p01922/input.1.txt b/codenet/public_test_cases/p01922/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0905b124efff5d89e46313458b57528d04ab2e63 --- /dev/null +++ b/codenet/public_test_cases/p01922/input.1.txt @@ -0,0 +1,4 @@ +5 +3 4 2 1 5 +3 +1 2 3 diff --git a/codenet/public_test_cases/p01922/output.0.txt b/codenet/public_test_cases/p01922/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01922/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01922/output.1.txt b/codenet/public_test_cases/p01922/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01922/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01923/input.0.txt b/codenet/public_test_cases/p01923/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c32c0543ef6bdb410a252c2f67bce1f1284be900 --- /dev/null +++ b/codenet/public_test_cases/p01923/input.0.txt @@ -0,0 +1,60 @@ +5 3 +1 1 +2 3 +3 2 +3 5 +2 1 +4 2 +1 7 +2 1 +1 3 +1 5 +6 1 +1 3 +1 2 +1 8 +1 2 +1 7 +1 6 +20 9 +4 10 +2 4 +5 3 +6 6 +6 3 +7 4 +8 10 +4 6 +7 5 +1 8 +5 7 +1 5 +6 6 +9 9 +5 8 +6 7 +1 4 +6 4 +7 10 +3 5 +19 6 +4 1 +6 5 +5 10 +1 10 +3 10 +4 6 +2 3 +5 4 +2 10 +1 8 +3 4 +3 1 +5 4 +1 10 +1 3 +5 6 +5 2 +1 10 +2 3 +0 0 diff --git a/codenet/public_test_cases/p01923/input.1.txt b/codenet/public_test_cases/p01923/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c32c0543ef6bdb410a252c2f67bce1f1284be900 --- /dev/null +++ b/codenet/public_test_cases/p01923/input.1.txt @@ -0,0 +1,60 @@ +5 3 +1 1 +2 3 +3 2 +3 5 +2 1 +4 2 +1 7 +2 1 +1 3 +1 5 +6 1 +1 3 +1 2 +1 8 +1 2 +1 7 +1 6 +20 9 +4 10 +2 4 +5 3 +6 6 +6 3 +7 4 +8 10 +4 6 +7 5 +1 8 +5 7 +1 5 +6 6 +9 9 +5 8 +6 7 +1 4 +6 4 +7 10 +3 5 +19 6 +4 1 +6 5 +5 10 +1 10 +3 10 +4 6 +2 3 +5 4 +2 10 +1 8 +3 4 +3 1 +5 4 +1 10 +1 3 +5 6 +5 2 +1 10 +2 3 +0 0 diff --git a/codenet/public_test_cases/p01923/output.0.txt b/codenet/public_test_cases/p01923/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76c0c68183fedadf22b8c32154da38ca63978ac5 --- /dev/null +++ b/codenet/public_test_cases/p01923/output.0.txt @@ -0,0 +1,5 @@ +9 +8 +8 +71 +51 diff --git a/codenet/public_test_cases/p01923/output.1.txt b/codenet/public_test_cases/p01923/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76c0c68183fedadf22b8c32154da38ca63978ac5 --- /dev/null +++ b/codenet/public_test_cases/p01923/output.1.txt @@ -0,0 +1,5 @@ +9 +8 +8 +71 +51 diff --git a/codenet/public_test_cases/p01924/input.0.txt b/codenet/public_test_cases/p01924/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7ec46dfeb16b9891435b2054f7fa0816d1dcd3e --- /dev/null +++ b/codenet/public_test_cases/p01924/input.0.txt @@ -0,0 +1,40 @@ +5 2 3 +3 +5 +1 +2 +3 +3 100 100 +3 +3 +4 +20 3 8 +3 +2 +6 +1 +9 +1 +8 +4 +2 +2 +8 +1 +8 +8 +2 +5 +3 +4 +3 +8 +7 2 2 +0 +2 +5 +2 +5 +2 +1 +0 0 0 diff --git a/codenet/public_test_cases/p01924/input.1.txt b/codenet/public_test_cases/p01924/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7ec46dfeb16b9891435b2054f7fa0816d1dcd3e --- /dev/null +++ b/codenet/public_test_cases/p01924/input.1.txt @@ -0,0 +1,40 @@ +5 2 3 +3 +5 +1 +2 +3 +3 100 100 +3 +3 +4 +20 3 8 +3 +2 +6 +1 +9 +1 +8 +4 +2 +2 +8 +1 +8 +8 +2 +5 +3 +4 +3 +8 +7 2 2 +0 +2 +5 +2 +5 +2 +1 +0 0 0 diff --git a/codenet/public_test_cases/p01924/output.0.txt b/codenet/public_test_cases/p01924/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..044c9d5af28d7fdbace639d177cb6f46eb0ec4ae --- /dev/null +++ b/codenet/public_test_cases/p01924/output.0.txt @@ -0,0 +1,4 @@ +3 +0 +11 +5 diff --git a/codenet/public_test_cases/p01924/output.1.txt b/codenet/public_test_cases/p01924/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..044c9d5af28d7fdbace639d177cb6f46eb0ec4ae --- /dev/null +++ b/codenet/public_test_cases/p01924/output.1.txt @@ -0,0 +1,4 @@ +3 +0 +11 +5 diff --git a/codenet/public_test_cases/p01925/input.0.txt b/codenet/public_test_cases/p01925/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdce3d929a478d0db656a0b683ad5c3bab0dc7d8 --- /dev/null +++ b/codenet/public_test_cases/p01925/input.0.txt @@ -0,0 +1,19 @@ +3 2 +5 2 1 3 +8 2 2 3 +2 3 +8 2 1 2 +3 1 1 +5 1 2 +2 5 +100 1 1 +100 1 1 +100 1 1 +100 1 1 +100 1 1 +3 4 +5 1 1 +5 1 2 +100 2 1 3 +100 2 2 3 +0 0 diff --git a/codenet/public_test_cases/p01925/input.1.txt b/codenet/public_test_cases/p01925/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdce3d929a478d0db656a0b683ad5c3bab0dc7d8 --- /dev/null +++ b/codenet/public_test_cases/p01925/input.1.txt @@ -0,0 +1,19 @@ +3 2 +5 2 1 3 +8 2 2 3 +2 3 +8 2 1 2 +3 1 1 +5 1 2 +2 5 +100 1 1 +100 1 1 +100 1 1 +100 1 1 +100 1 1 +3 4 +5 1 1 +5 1 2 +100 2 1 3 +100 2 2 3 +0 0 diff --git a/codenet/public_test_cases/p01925/output.0.txt b/codenet/public_test_cases/p01925/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87bad9f21aa06c0f0ce39e7f324d9c03ab1215a8 --- /dev/null +++ b/codenet/public_test_cases/p01925/output.0.txt @@ -0,0 +1,4 @@ +14 +11 +501 +196 diff --git a/codenet/public_test_cases/p01925/output.1.txt b/codenet/public_test_cases/p01925/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87bad9f21aa06c0f0ce39e7f324d9c03ab1215a8 --- /dev/null +++ b/codenet/public_test_cases/p01925/output.1.txt @@ -0,0 +1,4 @@ +14 +11 +501 +196 diff --git a/codenet/public_test_cases/p01926/input.0.txt b/codenet/public_test_cases/p01926/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dbb9f0b67d721465f81d76b442b030f42305f87 --- /dev/null +++ b/codenet/public_test_cases/p01926/input.0.txt @@ -0,0 +1,9 @@ +3 4 +1 5 9 +1 2 +1 +2 10 +1 1000000 +2 4 +1 10 +0 0 diff --git a/codenet/public_test_cases/p01926/input.1.txt b/codenet/public_test_cases/p01926/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dbb9f0b67d721465f81d76b442b030f42305f87 --- /dev/null +++ b/codenet/public_test_cases/p01926/input.1.txt @@ -0,0 +1,9 @@ +3 4 +1 5 9 +1 2 +1 +2 10 +1 1000000 +2 4 +1 10 +0 0 diff --git a/codenet/public_test_cases/p01926/output.0.txt b/codenet/public_test_cases/p01926/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc79f16af730be6a0464b62d1a7ab2c3f3f32826 --- /dev/null +++ b/codenet/public_test_cases/p01926/output.0.txt @@ -0,0 +1,4 @@ +3 +-1 +499996 +4 diff --git a/codenet/public_test_cases/p01926/output.1.txt b/codenet/public_test_cases/p01926/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc79f16af730be6a0464b62d1a7ab2c3f3f32826 --- /dev/null +++ b/codenet/public_test_cases/p01926/output.1.txt @@ -0,0 +1,4 @@ +3 +-1 +499996 +4 diff --git a/codenet/public_test_cases/p01927/input.0.txt b/codenet/public_test_cases/p01927/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c11651f2d054b390ffc6faf0bddda0b0cf573549 --- /dev/null +++ b/codenet/public_test_cases/p01927/input.0.txt @@ -0,0 +1,28 @@ +2 +4 1 0 0 1 0 1 1 0 1 +4 2 2 2 3 2 3 3 2 3 +60 45 +-1 -1 4 4 +4 +4 1 0 0 3 1 1 2 0 1 +3 2 10 7 8 2 12 4 +6 8 7 12 8 13 9 15 10 19 11 24 10 25 +5 4 16 2 16 4 12 8 14 2 15 0 +167 38 +3 3 15 21 +12 +4 3 -8 -3 -9 -3 -9 -5 -8 -6 +4 5 -4 -5 -7 -5 -7 -6 -5 -6 +4 2 -4 1 -5 1 -5 -4 -4 -4 +4 1 -1 1 -2 1 -2 -4 -1 -3 +4 2 2 3 -1 3 -2 2 3 2 +4 1 3 1 2 1 2 -3 3 -4 +4 7 1 0 0 0 0 -1 1 -1 +4 4 9 5 7 5 7 4 10 4 +4 3 6 5 5 4 5 0 6 0 +4 5 8 -1 5 -1 6 -2 8 -2 +4 1 10 0 9 0 9 -2 10 -1 +4 6 10 2 8 2 8 1 10 1 +131 78 +-10 10 10 -10 +0 diff --git a/codenet/public_test_cases/p01927/input.1.txt b/codenet/public_test_cases/p01927/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c11651f2d054b390ffc6faf0bddda0b0cf573549 --- /dev/null +++ b/codenet/public_test_cases/p01927/input.1.txt @@ -0,0 +1,28 @@ +2 +4 1 0 0 1 0 1 1 0 1 +4 2 2 2 3 2 3 3 2 3 +60 45 +-1 -1 4 4 +4 +4 1 0 0 3 1 1 2 0 1 +3 2 10 7 8 2 12 4 +6 8 7 12 8 13 9 15 10 19 11 24 10 25 +5 4 16 2 16 4 12 8 14 2 15 0 +167 38 +3 3 15 21 +12 +4 3 -8 -3 -9 -3 -9 -5 -8 -6 +4 5 -4 -5 -7 -5 -7 -6 -5 -6 +4 2 -4 1 -5 1 -5 -4 -4 -4 +4 1 -1 1 -2 1 -2 -4 -1 -3 +4 2 2 3 -1 3 -2 2 3 2 +4 1 3 1 2 1 2 -3 3 -4 +4 7 1 0 0 0 0 -1 1 -1 +4 4 9 5 7 5 7 4 10 4 +4 3 6 5 5 4 5 0 6 0 +4 5 8 -1 5 -1 6 -2 8 -2 +4 1 10 0 9 0 9 -2 10 -1 +4 6 10 2 8 2 8 1 10 1 +131 78 +-10 10 10 -10 +0 diff --git a/codenet/public_test_cases/p01927/output.0.txt b/codenet/public_test_cases/p01927/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af2953525a6f9d45d6229574e24773986d017675 --- /dev/null +++ b/codenet/public_test_cases/p01927/output.0.txt @@ -0,0 +1,3 @@ +1.93185 +7.87174 +20.86840 diff --git a/codenet/public_test_cases/p01927/output.1.txt b/codenet/public_test_cases/p01927/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af2953525a6f9d45d6229574e24773986d017675 --- /dev/null +++ b/codenet/public_test_cases/p01927/output.1.txt @@ -0,0 +1,3 @@ +1.93185 +7.87174 +20.86840 diff --git a/codenet/public_test_cases/p01928/input.0.txt b/codenet/public_test_cases/p01928/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..173db2cbbacfb345ff62a664c53d453252fd9796 --- /dev/null +++ b/codenet/public_test_cases/p01928/input.0.txt @@ -0,0 +1,31 @@ +2 +1 2 3 +4 2 3 +3 +2 5 2 +3 3 4 +5 5 5 +5 +1 1 1 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +5 +1 1 1 +2 1 1 +3 1 1 +4 1 1 +5 1 1 +10 +3 1 4 +1 5 9 +2 6 5 +3 5 8 +9 7 9 +3 2 3 +8 4 6 +2 6 4 +3 3 8 +3 2 7 +0 diff --git a/codenet/public_test_cases/p01928/input.1.txt b/codenet/public_test_cases/p01928/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..173db2cbbacfb345ff62a664c53d453252fd9796 --- /dev/null +++ b/codenet/public_test_cases/p01928/input.1.txt @@ -0,0 +1,31 @@ +2 +1 2 3 +4 2 3 +3 +2 5 2 +3 3 4 +5 5 5 +5 +1 1 1 +2 2 2 +3 3 3 +4 4 4 +5 5 5 +5 +1 1 1 +2 1 1 +3 1 1 +4 1 1 +5 1 1 +10 +3 1 4 +1 5 9 +2 6 5 +3 5 8 +9 7 9 +3 2 3 +8 4 6 +2 6 4 +3 3 8 +3 2 7 +0 diff --git a/codenet/public_test_cases/p01928/output.0.txt b/codenet/public_test_cases/p01928/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa056ff5bd556b78bdb49de3bd2cef129ec4c334 --- /dev/null +++ b/codenet/public_test_cases/p01928/output.0.txt @@ -0,0 +1,5 @@ +24 +145 +125 +15 +864 diff --git a/codenet/public_test_cases/p01928/output.1.txt b/codenet/public_test_cases/p01928/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa056ff5bd556b78bdb49de3bd2cef129ec4c334 --- /dev/null +++ b/codenet/public_test_cases/p01928/output.1.txt @@ -0,0 +1,5 @@ +24 +145 +125 +15 +864 diff --git a/codenet/public_test_cases/p01929/input.0.txt b/codenet/public_test_cases/p01929/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fef1169f7908b7337a7631c9a164c640fb8a2143 --- /dev/null +++ b/codenet/public_test_cases/p01929/input.0.txt @@ -0,0 +1,13 @@ +2 +2 1 +3 +3 1 2 +10 +2 1 1 1 1 1 1 1 1 1 +8 +2 1 4 3 3 7 6 6 +25 +2 3 2 5 4 5 8 7 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 +10 +2 1 4 3 6 5 8 7 10 9 +0 diff --git a/codenet/public_test_cases/p01929/input.1.txt b/codenet/public_test_cases/p01929/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fef1169f7908b7337a7631c9a164c640fb8a2143 --- /dev/null +++ b/codenet/public_test_cases/p01929/input.1.txt @@ -0,0 +1,13 @@ +2 +2 1 +3 +3 1 2 +10 +2 1 1 1 1 1 1 1 1 1 +8 +2 1 4 3 3 7 6 6 +25 +2 3 2 5 4 5 8 7 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 +10 +2 1 4 3 6 5 8 7 10 9 +0 diff --git a/codenet/public_test_cases/p01929/output.0.txt b/codenet/public_test_cases/p01929/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..95b249863d089b8b2576ef54a66b30b96a2964ad --- /dev/null +++ b/codenet/public_test_cases/p01929/output.0.txt @@ -0,0 +1,6 @@ +2 +0 +0 +144 +633544712 +11520 diff --git a/codenet/public_test_cases/p01929/output.1.txt b/codenet/public_test_cases/p01929/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..95b249863d089b8b2576ef54a66b30b96a2964ad --- /dev/null +++ b/codenet/public_test_cases/p01929/output.1.txt @@ -0,0 +1,6 @@ +2 +0 +0 +144 +633544712 +11520 diff --git a/codenet/public_test_cases/p01930/input.0.txt b/codenet/public_test_cases/p01930/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d51a01e074773cecb752c7ade2bb9db4b70e7313 --- /dev/null +++ b/codenet/public_test_cases/p01930/input.0.txt @@ -0,0 +1,48 @@ +3 2 +#.# +... +#.# +### +... +### +3 2 +#.# +... +#.# +### +#.# +### +3 3 +#.. +..# +### +..# +#.# +#.. +#.. +..# +### +5 3 +..... +##### +##... +##.## +##... +..... +##### +..... +##### +..... +...## +##.## +...## +##### +..... +3 2 +#.# +... +#.# +#.# +#.# +#.# +0 0 diff --git a/codenet/public_test_cases/p01930/input.1.txt b/codenet/public_test_cases/p01930/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d51a01e074773cecb752c7ade2bb9db4b70e7313 --- /dev/null +++ b/codenet/public_test_cases/p01930/input.1.txt @@ -0,0 +1,48 @@ +3 2 +#.# +... +#.# +### +... +### +3 2 +#.# +... +#.# +### +#.# +### +3 3 +#.. +..# +### +..# +#.# +#.. +#.. +..# +### +5 3 +..... +##### +##... +##.## +##... +..... +##### +..... +##### +..... +...## +##.## +...## +##### +..... +3 2 +#.# +... +#.# +#.# +#.# +#.# +0 0 diff --git a/codenet/public_test_cases/p01930/output.0.txt b/codenet/public_test_cases/p01930/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3eaaa976a12419d5482e7c274428d53fd513fbd9 --- /dev/null +++ b/codenet/public_test_cases/p01930/output.0.txt @@ -0,0 +1,5 @@ +Yes +No +Yes +Yes +Yes diff --git a/codenet/public_test_cases/p01930/output.1.txt b/codenet/public_test_cases/p01930/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3eaaa976a12419d5482e7c274428d53fd513fbd9 --- /dev/null +++ b/codenet/public_test_cases/p01930/output.1.txt @@ -0,0 +1,5 @@ +Yes +No +Yes +Yes +Yes diff --git a/codenet/public_test_cases/p01931/input.0.txt b/codenet/public_test_cases/p01931/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb0b071202cf6e76e2166e1d3fc804898085fe1e --- /dev/null +++ b/codenet/public_test_cases/p01931/input.0.txt @@ -0,0 +1,2 @@ +3 +oxx diff --git a/codenet/public_test_cases/p01931/input.1.txt b/codenet/public_test_cases/p01931/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb0b071202cf6e76e2166e1d3fc804898085fe1e --- /dev/null +++ b/codenet/public_test_cases/p01931/input.1.txt @@ -0,0 +1,2 @@ +3 +oxx diff --git a/codenet/public_test_cases/p01931/output.0.txt b/codenet/public_test_cases/p01931/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01931/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01931/output.1.txt b/codenet/public_test_cases/p01931/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01931/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01932/input.0.txt b/codenet/public_test_cases/p01932/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3c72cdbdf428c2db340126290d6bc0c97af350a --- /dev/null +++ b/codenet/public_test_cases/p01932/input.0.txt @@ -0,0 +1,3 @@ +2 2 +2 2 +3 3 diff --git a/codenet/public_test_cases/p01932/input.1.txt b/codenet/public_test_cases/p01932/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3c72cdbdf428c2db340126290d6bc0c97af350a --- /dev/null +++ b/codenet/public_test_cases/p01932/input.1.txt @@ -0,0 +1,3 @@ +2 2 +2 2 +3 3 diff --git a/codenet/public_test_cases/p01932/output.0.txt b/codenet/public_test_cases/p01932/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01932/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01932/output.1.txt b/codenet/public_test_cases/p01932/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01932/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01933/input.0.txt b/codenet/public_test_cases/p01933/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd2e84906e098f19b9565cc906c64c28ac4faa7d --- /dev/null +++ b/codenet/public_test_cases/p01933/input.0.txt @@ -0,0 +1,7 @@ +6 3 +0 +0 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p01933/input.1.txt b/codenet/public_test_cases/p01933/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd2e84906e098f19b9565cc906c64c28ac4faa7d --- /dev/null +++ b/codenet/public_test_cases/p01933/input.1.txt @@ -0,0 +1,7 @@ +6 3 +0 +0 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p01933/output.0.txt b/codenet/public_test_cases/p01933/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01933/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01933/output.1.txt b/codenet/public_test_cases/p01933/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01933/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01934/input.0.txt b/codenet/public_test_cases/p01934/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..769dd5481d9086b9c0a974d1478f23f6efaef1e5 --- /dev/null +++ b/codenet/public_test_cases/p01934/input.0.txt @@ -0,0 +1,3 @@ +3 1 2 3 +1 2 3 +1 3 diff --git a/codenet/public_test_cases/p01934/input.1.txt b/codenet/public_test_cases/p01934/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..769dd5481d9086b9c0a974d1478f23f6efaef1e5 --- /dev/null +++ b/codenet/public_test_cases/p01934/input.1.txt @@ -0,0 +1,3 @@ +3 1 2 3 +1 2 3 +1 3 diff --git a/codenet/public_test_cases/p01934/output.0.txt b/codenet/public_test_cases/p01934/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01934/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01934/output.1.txt b/codenet/public_test_cases/p01934/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01934/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01935/input.0.txt b/codenet/public_test_cases/p01935/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f52febe3f211db846060157b4ea8bbd1024d170 --- /dev/null +++ b/codenet/public_test_cases/p01935/input.0.txt @@ -0,0 +1,5 @@ +4 4 +0 1 3 +0 2 4 +1 3 1 +2 3 5 diff --git a/codenet/public_test_cases/p01935/input.1.txt b/codenet/public_test_cases/p01935/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f52febe3f211db846060157b4ea8bbd1024d170 --- /dev/null +++ b/codenet/public_test_cases/p01935/input.1.txt @@ -0,0 +1,5 @@ +4 4 +0 1 3 +0 2 4 +1 3 1 +2 3 5 diff --git a/codenet/public_test_cases/p01935/output.0.txt b/codenet/public_test_cases/p01935/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01935/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01935/output.1.txt b/codenet/public_test_cases/p01935/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01935/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01936/input.0.txt b/codenet/public_test_cases/p01936/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p01936/input.0.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p01936/input.1.txt b/codenet/public_test_cases/p01936/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p01936/input.1.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p01936/output.0.txt b/codenet/public_test_cases/p01936/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01936/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01936/output.1.txt b/codenet/public_test_cases/p01936/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01936/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01937/input.0.txt b/codenet/public_test_cases/p01937/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f411292201defd20f4fb760b4e6042083aa0cc5 --- /dev/null +++ b/codenet/public_test_cases/p01937/input.0.txt @@ -0,0 +1,2 @@ +2 3 +0 1 diff --git a/codenet/public_test_cases/p01937/output.0.txt b/codenet/public_test_cases/p01937/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01937/output.0.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01938/input.0.txt b/codenet/public_test_cases/p01938/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b038ea6336851987bb5eb97323ed2ebd029d1c3 --- /dev/null +++ b/codenet/public_test_cases/p01938/input.0.txt @@ -0,0 +1 @@ +AIZU diff --git a/codenet/public_test_cases/p01938/input.1.txt b/codenet/public_test_cases/p01938/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b038ea6336851987bb5eb97323ed2ebd029d1c3 --- /dev/null +++ b/codenet/public_test_cases/p01938/input.1.txt @@ -0,0 +1 @@ +AIZU diff --git a/codenet/public_test_cases/p01938/output.0.txt b/codenet/public_test_cases/p01938/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01938/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01938/output.1.txt b/codenet/public_test_cases/p01938/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01938/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01939/input.0.txt b/codenet/public_test_cases/p01939/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d39e5c5feac60fd373e005bd07a76a84ac645906 --- /dev/null +++ b/codenet/public_test_cases/p01939/input.0.txt @@ -0,0 +1 @@ +3 9 diff --git a/codenet/public_test_cases/p01939/input.1.txt b/codenet/public_test_cases/p01939/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d39e5c5feac60fd373e005bd07a76a84ac645906 --- /dev/null +++ b/codenet/public_test_cases/p01939/input.1.txt @@ -0,0 +1 @@ +3 9 diff --git a/codenet/public_test_cases/p01939/output.0.txt b/codenet/public_test_cases/p01939/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p01939/output.0.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p01939/output.1.txt b/codenet/public_test_cases/p01939/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p01939/output.1.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p01940/input.0.txt b/codenet/public_test_cases/p01940/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d45d8c486e4d78951d65679c33428e858ad5d9e --- /dev/null +++ b/codenet/public_test_cases/p01940/input.0.txt @@ -0,0 +1,2 @@ +aizucamp +azu diff --git a/codenet/public_test_cases/p01940/input.1.txt b/codenet/public_test_cases/p01940/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d45d8c486e4d78951d65679c33428e858ad5d9e --- /dev/null +++ b/codenet/public_test_cases/p01940/input.1.txt @@ -0,0 +1,2 @@ +aizucamp +azu diff --git a/codenet/public_test_cases/p01940/output.0.txt b/codenet/public_test_cases/p01940/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p01940/output.0.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p01940/output.1.txt b/codenet/public_test_cases/p01940/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p01940/output.1.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p01941/input.0.txt b/codenet/public_test_cases/p01941/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6dfdf8756a26baea975c6265a50c445751eb47b --- /dev/null +++ b/codenet/public_test_cases/p01941/input.0.txt @@ -0,0 +1,4 @@ +3 4 +3 2 2 +2 1 1 +2 1 1 diff --git a/codenet/public_test_cases/p01941/input.1.txt b/codenet/public_test_cases/p01941/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6dfdf8756a26baea975c6265a50c445751eb47b --- /dev/null +++ b/codenet/public_test_cases/p01941/input.1.txt @@ -0,0 +1,4 @@ +3 4 +3 2 2 +2 1 1 +2 1 1 diff --git a/codenet/public_test_cases/p01941/output.0.txt b/codenet/public_test_cases/p01941/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01941/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01941/output.1.txt b/codenet/public_test_cases/p01941/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01941/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01942/input.0.txt b/codenet/public_test_cases/p01942/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50a21259ef4f150b0f098f52fab2a019dd5092ea --- /dev/null +++ b/codenet/public_test_cases/p01942/input.0.txt @@ -0,0 +1,7 @@ +3 3 3 6 +1 0 1 1 +2 2 1 1 2 2 +3 1 1 1 +4 0 2 1 +5 2 1 1 2 2 +6 2 2 1 3 3 diff --git a/codenet/public_test_cases/p01942/input.1.txt b/codenet/public_test_cases/p01942/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..50a21259ef4f150b0f098f52fab2a019dd5092ea --- /dev/null +++ b/codenet/public_test_cases/p01942/input.1.txt @@ -0,0 +1,7 @@ +3 3 3 6 +1 0 1 1 +2 2 1 1 2 2 +3 1 1 1 +4 0 2 1 +5 2 1 1 2 2 +6 2 2 1 3 3 diff --git a/codenet/public_test_cases/p01942/output.0.txt b/codenet/public_test_cases/p01942/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdc2fe4d72cec2f877d8b5383ca313365ba637ad --- /dev/null +++ b/codenet/public_test_cases/p01942/output.0.txt @@ -0,0 +1,3 @@ +0 1 +1 1 +0 1 diff --git a/codenet/public_test_cases/p01942/output.1.txt b/codenet/public_test_cases/p01942/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdc2fe4d72cec2f877d8b5383ca313365ba637ad --- /dev/null +++ b/codenet/public_test_cases/p01942/output.1.txt @@ -0,0 +1,3 @@ +0 1 +1 1 +0 1 diff --git a/codenet/public_test_cases/p01943/input.0.txt b/codenet/public_test_cases/p01943/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..496d66a31864e06a4889ef004a5ab09b3c392a84 --- /dev/null +++ b/codenet/public_test_cases/p01943/input.0.txt @@ -0,0 +1,7 @@ +6 2.01 +1.10 +1.44 +0.91 +2.00 +1.12 +1.55 diff --git a/codenet/public_test_cases/p01943/input.1.txt b/codenet/public_test_cases/p01943/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..496d66a31864e06a4889ef004a5ab09b3c392a84 --- /dev/null +++ b/codenet/public_test_cases/p01943/input.1.txt @@ -0,0 +1,7 @@ +6 2.01 +1.10 +1.44 +0.91 +2.00 +1.12 +1.55 diff --git a/codenet/public_test_cases/p01943/output.0.txt b/codenet/public_test_cases/p01943/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01943/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01943/output.1.txt b/codenet/public_test_cases/p01943/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01943/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01944/input.0.txt b/codenet/public_test_cases/p01944/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..907f2902889c6b089a49a0305bbad4bcbbf7692b --- /dev/null +++ b/codenet/public_test_cases/p01944/input.0.txt @@ -0,0 +1,4 @@ +10 3 2 +3 +6 +6 diff --git a/codenet/public_test_cases/p01944/input.1.txt b/codenet/public_test_cases/p01944/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..907f2902889c6b089a49a0305bbad4bcbbf7692b --- /dev/null +++ b/codenet/public_test_cases/p01944/input.1.txt @@ -0,0 +1,4 @@ +10 3 2 +3 +6 +6 diff --git a/codenet/public_test_cases/p01944/output.0.txt b/codenet/public_test_cases/p01944/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aedefeabcfa0bedc1510b11e38ca8839f5466c97 --- /dev/null +++ b/codenet/public_test_cases/p01944/output.0.txt @@ -0,0 +1,10 @@ +1 +0 +4 +2 +0 +0 +5 +0 +0 +4 diff --git a/codenet/public_test_cases/p01944/output.1.txt b/codenet/public_test_cases/p01944/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aedefeabcfa0bedc1510b11e38ca8839f5466c97 --- /dev/null +++ b/codenet/public_test_cases/p01944/output.1.txt @@ -0,0 +1,10 @@ +1 +0 +4 +2 +0 +0 +5 +0 +0 +4 diff --git a/codenet/public_test_cases/p01945/input.0.txt b/codenet/public_test_cases/p01945/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c47afa871a3d1fc88990f80db1af350f40f3d5fd --- /dev/null +++ b/codenet/public_test_cases/p01945/input.0.txt @@ -0,0 +1 @@ +((*)()) diff --git a/codenet/public_test_cases/p01945/input.1.txt b/codenet/public_test_cases/p01945/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..72e8ffc0db8aad71a934dd11e5968bd5109e54b4 --- /dev/null +++ b/codenet/public_test_cases/p01945/input.1.txt @@ -0,0 +1 @@ +* diff --git a/codenet/public_test_cases/p01945/input.2.txt b/codenet/public_test_cases/p01945/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fb4b9aa3db8f270a5de985602c98b54cde7b8df --- /dev/null +++ b/codenet/public_test_cases/p01945/input.2.txt @@ -0,0 +1 @@ +((((((((((*)))))))))) diff --git a/codenet/public_test_cases/p01945/input.3.txt b/codenet/public_test_cases/p01945/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c47afa871a3d1fc88990f80db1af350f40f3d5fd --- /dev/null +++ b/codenet/public_test_cases/p01945/input.3.txt @@ -0,0 +1 @@ +((*)()) diff --git a/codenet/public_test_cases/p01945/input.4.txt b/codenet/public_test_cases/p01945/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d71687e03d0a624381de0a64653eb6ef1f44cc4 --- /dev/null +++ b/codenet/public_test_cases/p01945/input.4.txt @@ -0,0 +1 @@ +(*) diff --git a/codenet/public_test_cases/p01945/input.5.txt b/codenet/public_test_cases/p01945/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..a219bc5909c6467fd9d84625fde23ee7edbff4af --- /dev/null +++ b/codenet/public_test_cases/p01945/input.5.txt @@ -0,0 +1 @@ +()*() diff --git a/codenet/public_test_cases/p01945/input.6.txt b/codenet/public_test_cases/p01945/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..303af8607c42b655f10acad00393e208869b58ed --- /dev/null +++ b/codenet/public_test_cases/p01945/input.6.txt @@ -0,0 +1 @@ +(()())* diff --git a/codenet/public_test_cases/p01945/output.0.txt b/codenet/public_test_cases/p01945/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01945/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01945/output.1.txt b/codenet/public_test_cases/p01945/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01945/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01945/output.2.txt b/codenet/public_test_cases/p01945/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01945/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01945/output.3.txt b/codenet/public_test_cases/p01945/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01945/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01945/output.4.txt b/codenet/public_test_cases/p01945/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01945/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01945/output.5.txt b/codenet/public_test_cases/p01945/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01945/output.5.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01945/output.6.txt b/codenet/public_test_cases/p01945/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01945/output.6.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01946/input.0.txt b/codenet/public_test_cases/p01946/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..669457ccfa878c863561f866c9b7fea0f3d19e0a --- /dev/null +++ b/codenet/public_test_cases/p01946/input.0.txt @@ -0,0 +1,2 @@ +65 60 3 +-2 3 -4 diff --git a/codenet/public_test_cases/p01946/input.1.txt b/codenet/public_test_cases/p01946/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8bfb4ffdca647c9b4721a0cfdd6ab212365c108 --- /dev/null +++ b/codenet/public_test_cases/p01946/input.1.txt @@ -0,0 +1,2 @@ +100000 1 1 +-1 diff --git a/codenet/public_test_cases/p01946/input.2.txt b/codenet/public_test_cases/p01946/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..669457ccfa878c863561f866c9b7fea0f3d19e0a --- /dev/null +++ b/codenet/public_test_cases/p01946/input.2.txt @@ -0,0 +1,2 @@ +65 60 3 +-2 3 -4 diff --git a/codenet/public_test_cases/p01946/input.3.txt b/codenet/public_test_cases/p01946/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..eef2b867cc2c631c35da3b90187d12cce0f005a8 --- /dev/null +++ b/codenet/public_test_cases/p01946/input.3.txt @@ -0,0 +1,2 @@ +60 59 1 +-123 diff --git a/codenet/public_test_cases/p01946/input.4.txt b/codenet/public_test_cases/p01946/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dfec965a7c4264c2e1e580f9115c3e3362892d0 --- /dev/null +++ b/codenet/public_test_cases/p01946/input.4.txt @@ -0,0 +1,2 @@ +65 60 3 +-2 10 -3 diff --git a/codenet/public_test_cases/p01946/output.0.txt b/codenet/public_test_cases/p01946/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01946/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01946/output.1.txt b/codenet/public_test_cases/p01946/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..90ef1ea404f5aeb59bc233448c4e724c91f3fff8 --- /dev/null +++ b/codenet/public_test_cases/p01946/output.1.txt @@ -0,0 +1 @@ +99999 diff --git a/codenet/public_test_cases/p01946/output.2.txt b/codenet/public_test_cases/p01946/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01946/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01946/output.3.txt b/codenet/public_test_cases/p01946/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01946/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01946/output.4.txt b/codenet/public_test_cases/p01946/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01946/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01947/input.0.txt b/codenet/public_test_cases/p01947/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6fb4129d3510a1bb46e556d9f19aa52bb200231 --- /dev/null +++ b/codenet/public_test_cases/p01947/input.0.txt @@ -0,0 +1,13 @@ +3 +1 2 +4 7 +8 6 +2 3 +8 9 +5 3 +4 6 +5 6 +7 8 +1 4 +2 6 +5 9 diff --git a/codenet/public_test_cases/p01947/input.1.txt b/codenet/public_test_cases/p01947/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf4743512467c4b5e2e5b0185b5a397a41aad6a6 --- /dev/null +++ b/codenet/public_test_cases/p01947/input.1.txt @@ -0,0 +1,25 @@ +4 +12 1 +3 8 +10 7 +13 14 +8 2 +9 12 +6 14 +11 3 +3 13 +1 10 +11 15 +4 15 +4 9 +14 10 +5 7 +2 5 +6 1 +14 5 +16 11 +15 6 +15 13 +9 6 +16 4 +13 2 diff --git a/codenet/public_test_cases/p01947/input.2.txt b/codenet/public_test_cases/p01947/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6fb4129d3510a1bb46e556d9f19aa52bb200231 --- /dev/null +++ b/codenet/public_test_cases/p01947/input.2.txt @@ -0,0 +1,13 @@ +3 +1 2 +4 7 +8 6 +2 3 +8 9 +5 3 +4 6 +5 6 +7 8 +1 4 +2 6 +5 9 diff --git a/codenet/public_test_cases/p01947/output.0.txt b/codenet/public_test_cases/p01947/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d337ccbb6f7dc025fdb447ea52c69bb8ef78366 --- /dev/null +++ b/codenet/public_test_cases/p01947/output.0.txt @@ -0,0 +1,3 @@ +7 4 1 +8 6 2 +9 5 3 diff --git a/codenet/public_test_cases/p01947/output.1.txt b/codenet/public_test_cases/p01947/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e20a835cbef8bef1df383b1f6238099a32c9b801 --- /dev/null +++ b/codenet/public_test_cases/p01947/output.1.txt @@ -0,0 +1,4 @@ +8 2 5 7 +3 13 14 10 +11 15 6 1 +16 4 9 12 diff --git a/codenet/public_test_cases/p01947/output.2.txt b/codenet/public_test_cases/p01947/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d337ccbb6f7dc025fdb447ea52c69bb8ef78366 --- /dev/null +++ b/codenet/public_test_cases/p01947/output.2.txt @@ -0,0 +1,3 @@ +7 4 1 +8 6 2 +9 5 3 diff --git a/codenet/public_test_cases/p01948/input.0.txt b/codenet/public_test_cases/p01948/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1543f4c6674477b39db8596305540662731ad3e --- /dev/null +++ b/codenet/public_test_cases/p01948/input.0.txt @@ -0,0 +1,3 @@ +2 +2 +1 40 40 20 diff --git a/codenet/public_test_cases/p01948/input.1.txt b/codenet/public_test_cases/p01948/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1543f4c6674477b39db8596305540662731ad3e --- /dev/null +++ b/codenet/public_test_cases/p01948/input.1.txt @@ -0,0 +1,3 @@ +2 +2 +1 40 40 20 diff --git a/codenet/public_test_cases/p01948/input.2.txt b/codenet/public_test_cases/p01948/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..85772cd476dfd5e0d045b7d4096caed2211e5b1c --- /dev/null +++ b/codenet/public_test_cases/p01948/input.2.txt @@ -0,0 +1,5 @@ +4 +4 +1 34 33 33 +2 33 34 33 +3 33 33 34 diff --git a/codenet/public_test_cases/p01948/input.3.txt b/codenet/public_test_cases/p01948/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c61f8998b567174c805b6b64927d9c982a71625 --- /dev/null +++ b/codenet/public_test_cases/p01948/input.3.txt @@ -0,0 +1,3 @@ +2 +1 +2 50 50 0 diff --git a/codenet/public_test_cases/p01948/input.4.txt b/codenet/public_test_cases/p01948/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8367d07a2b738c26f2d361a0bd3052d54cc036ae --- /dev/null +++ b/codenet/public_test_cases/p01948/input.4.txt @@ -0,0 +1,4 @@ +3 +2 +1 50 0 50 +3 0 0 100 diff --git a/codenet/public_test_cases/p01948/input.5.txt b/codenet/public_test_cases/p01948/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..e834d4ef328422fa629335ebfe24ebf87a7986ec --- /dev/null +++ b/codenet/public_test_cases/p01948/input.5.txt @@ -0,0 +1,4 @@ +3 +2 +3 40 40 20 +1 30 10 60 diff --git a/codenet/public_test_cases/p01948/output.0.txt b/codenet/public_test_cases/p01948/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aec258df73d39d2122706793921981f4a0f672f8 --- /dev/null +++ b/codenet/public_test_cases/p01948/output.0.txt @@ -0,0 +1 @@ +0.8 diff --git a/codenet/public_test_cases/p01948/output.1.txt b/codenet/public_test_cases/p01948/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aec258df73d39d2122706793921981f4a0f672f8 --- /dev/null +++ b/codenet/public_test_cases/p01948/output.1.txt @@ -0,0 +1 @@ +0.8 diff --git a/codenet/public_test_cases/p01948/output.2.txt b/codenet/public_test_cases/p01948/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2af596e4381be571fab707008a197f30fe476863 --- /dev/null +++ b/codenet/public_test_cases/p01948/output.2.txt @@ -0,0 +1 @@ +0.6591870816 diff --git a/codenet/public_test_cases/p01948/output.3.txt b/codenet/public_test_cases/p01948/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb3c4fe4eebcdea3da0790cc0ba74cb286ec4f4 --- /dev/null +++ b/codenet/public_test_cases/p01948/output.3.txt @@ -0,0 +1 @@ +0.5 diff --git a/codenet/public_test_cases/p01948/output.4.txt b/codenet/public_test_cases/p01948/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01948/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01948/output.5.txt b/codenet/public_test_cases/p01948/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a9e6bda259d91234404902623fbf7367f54f350 --- /dev/null +++ b/codenet/public_test_cases/p01948/output.5.txt @@ -0,0 +1 @@ +0.27 diff --git a/codenet/public_test_cases/p01949/input.0.txt b/codenet/public_test_cases/p01949/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f5a495016ce063b5cb8e3d94c23dba2df9088b3 --- /dev/null +++ b/codenet/public_test_cases/p01949/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1+2 ++9* +1*5 diff --git a/codenet/public_test_cases/p01949/input.1.txt b/codenet/public_test_cases/p01949/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..26ba746fb9cbb2907e72b1a65c971c46cf06ae5a --- /dev/null +++ b/codenet/public_test_cases/p01949/input.1.txt @@ -0,0 +1,6 @@ +5 5 +2+2+1 ++1+1+ +1+2+2 ++1+1+ +1+1+2 diff --git a/codenet/public_test_cases/p01949/input.2.txt b/codenet/public_test_cases/p01949/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f5a495016ce063b5cb8e3d94c23dba2df9088b3 --- /dev/null +++ b/codenet/public_test_cases/p01949/input.2.txt @@ -0,0 +1,4 @@ +3 3 +1+2 ++9* +1*5 diff --git a/codenet/public_test_cases/p01949/input.3.txt b/codenet/public_test_cases/p01949/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..be93f7a8c3156e11e688d61d16c99d6ac159cdfb --- /dev/null +++ b/codenet/public_test_cases/p01949/input.3.txt @@ -0,0 +1,2 @@ +1 31 +9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9 diff --git a/codenet/public_test_cases/p01949/input.4.txt b/codenet/public_test_cases/p01949/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..63abf3b81b0bba9e6d0e43efe84d5b4003c43fa6 --- /dev/null +++ b/codenet/public_test_cases/p01949/input.4.txt @@ -0,0 +1,10 @@ +9 7 +8+9*4*8 +*5*2+3+ +1*3*2*2 +*5*1+9+ +1+2*2*2 +*3*6*2* +7*7+6*5 +*5+7*2+ +3+3*6+8 diff --git a/codenet/public_test_cases/p01949/output.0.txt b/codenet/public_test_cases/p01949/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e5feb5256930f3cae636754eef8a244ede164eb --- /dev/null +++ b/codenet/public_test_cases/p01949/output.0.txt @@ -0,0 +1 @@ +46 diff --git a/codenet/public_test_cases/p01949/output.1.txt b/codenet/public_test_cases/p01949/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p01949/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p01949/output.2.txt b/codenet/public_test_cases/p01949/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e5feb5256930f3cae636754eef8a244ede164eb --- /dev/null +++ b/codenet/public_test_cases/p01949/output.2.txt @@ -0,0 +1 @@ +46 diff --git a/codenet/public_test_cases/p01949/output.3.txt b/codenet/public_test_cases/p01949/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01949/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01949/output.4.txt b/codenet/public_test_cases/p01949/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e181e392f3f4335f715471be2c5b7f4678abe8a --- /dev/null +++ b/codenet/public_test_cases/p01949/output.4.txt @@ -0,0 +1 @@ +86408 diff --git a/codenet/public_test_cases/p01950/input.0.txt b/codenet/public_test_cases/p01950/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc88773658f25592fbc224fa48bd285513c79119 --- /dev/null +++ b/codenet/public_test_cases/p01950/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p01950/input.1.txt b/codenet/public_test_cases/p01950/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e5b02d4ce0ae2d57ab906325e55bf8f13d9caca --- /dev/null +++ b/codenet/public_test_cases/p01950/input.1.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 3 +3 4 +4 1 diff --git a/codenet/public_test_cases/p01950/input.2.txt b/codenet/public_test_cases/p01950/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60fdf3feec682bec0be8b20e3d7ac2805bf0c2e0 --- /dev/null +++ b/codenet/public_test_cases/p01950/input.2.txt @@ -0,0 +1,4 @@ +4 3 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p01950/input.3.txt b/codenet/public_test_cases/p01950/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc88773658f25592fbc224fa48bd285513c79119 --- /dev/null +++ b/codenet/public_test_cases/p01950/input.3.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p01950/input.4.txt b/codenet/public_test_cases/p01950/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..858b6d34dab18272b8312dcc7cf26dde380206f4 --- /dev/null +++ b/codenet/public_test_cases/p01950/input.4.txt @@ -0,0 +1,10 @@ +8 9 +2 1 +3 5 +1 6 +2 5 +3 1 +8 4 +2 7 +7 1 +7 4 diff --git a/codenet/public_test_cases/p01950/output.0.txt b/codenet/public_test_cases/p01950/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01950/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01950/output.1.txt b/codenet/public_test_cases/p01950/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01950/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01950/output.2.txt b/codenet/public_test_cases/p01950/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01950/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01950/output.3.txt b/codenet/public_test_cases/p01950/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01950/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01950/output.4.txt b/codenet/public_test_cases/p01950/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01950/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01951/input.0.txt b/codenet/public_test_cases/p01951/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fa7c687ea05ea41fd8d7a4ed02878cff52eb68c --- /dev/null +++ b/codenet/public_test_cases/p01951/input.0.txt @@ -0,0 +1,4 @@ +3 3 2 10 +5 3 7 +2 6 1 +3 4 1 diff --git a/codenet/public_test_cases/p01951/input.1.txt b/codenet/public_test_cases/p01951/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d69df8cd3a92f86e208772791c2348aecf72520f --- /dev/null +++ b/codenet/public_test_cases/p01951/input.1.txt @@ -0,0 +1,3 @@ +2 2 3 100 +0 0 +0 0 diff --git a/codenet/public_test_cases/p01951/input.2.txt b/codenet/public_test_cases/p01951/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fa7c687ea05ea41fd8d7a4ed02878cff52eb68c --- /dev/null +++ b/codenet/public_test_cases/p01951/input.2.txt @@ -0,0 +1,4 @@ +3 3 2 10 +5 3 7 +2 6 1 +3 4 1 diff --git a/codenet/public_test_cases/p01951/input.3.txt b/codenet/public_test_cases/p01951/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..402a3fa698ef7bef0d84a44c8e16159181384a2b --- /dev/null +++ b/codenet/public_test_cases/p01951/input.3.txt @@ -0,0 +1,3 @@ +2 3 1 5 +4 8 -2 +-2 -5 -3 diff --git a/codenet/public_test_cases/p01951/input.4.txt b/codenet/public_test_cases/p01951/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3d993947aa38a48f3c9f464448e924d93a693c1 --- /dev/null +++ b/codenet/public_test_cases/p01951/input.4.txt @@ -0,0 +1,3 @@ +2 3 1 5 +9 8 -2 +-2 -5 -3 diff --git a/codenet/public_test_cases/p01951/output.0.txt b/codenet/public_test_cases/p01951/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01951/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01951/output.1.txt b/codenet/public_test_cases/p01951/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01951/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01951/output.2.txt b/codenet/public_test_cases/p01951/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01951/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01951/output.3.txt b/codenet/public_test_cases/p01951/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01951/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01951/output.4.txt b/codenet/public_test_cases/p01951/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01951/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01952/input.0.txt b/codenet/public_test_cases/p01952/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d388b4eadff276798da2f43164ccc3ea05a6638d --- /dev/null +++ b/codenet/public_test_cases/p01952/input.0.txt @@ -0,0 +1,5 @@ +4 20 20 1 +10 0 +20 10 +10 20 +0 10 diff --git a/codenet/public_test_cases/p01952/input.1.txt b/codenet/public_test_cases/p01952/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d388b4eadff276798da2f43164ccc3ea05a6638d --- /dev/null +++ b/codenet/public_test_cases/p01952/input.1.txt @@ -0,0 +1,5 @@ +4 20 20 1 +10 0 +20 10 +10 20 +0 10 diff --git a/codenet/public_test_cases/p01952/input.2.txt b/codenet/public_test_cases/p01952/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..82f77eb92b499e332f76548c269cf282f5247bae --- /dev/null +++ b/codenet/public_test_cases/p01952/input.2.txt @@ -0,0 +1,2 @@ +1 3 3 1 +114 514 diff --git a/codenet/public_test_cases/p01952/input.3.txt b/codenet/public_test_cases/p01952/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..47cfd251930b93cb2ec30b04d2ac448b7eb4bd09 --- /dev/null +++ b/codenet/public_test_cases/p01952/input.3.txt @@ -0,0 +1,3 @@ +2 5 55 1 +0 0 +30 40 diff --git a/codenet/public_test_cases/p01952/input.4.txt b/codenet/public_test_cases/p01952/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e07bbb9afb1282201ae3d84e24e5143e9f1be5c7 --- /dev/null +++ b/codenet/public_test_cases/p01952/input.4.txt @@ -0,0 +1,3 @@ +2 5 49 1 +0 0 +30 40 diff --git a/codenet/public_test_cases/p01952/output.0.txt b/codenet/public_test_cases/p01952/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01952/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01952/output.1.txt b/codenet/public_test_cases/p01952/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01952/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01952/output.2.txt b/codenet/public_test_cases/p01952/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01952/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01952/output.3.txt b/codenet/public_test_cases/p01952/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01952/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01952/output.4.txt b/codenet/public_test_cases/p01952/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01952/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01953/input.0.txt b/codenet/public_test_cases/p01953/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fa3c9a23c2eb2bd033c225d710cbb7e44c4fab5 --- /dev/null +++ b/codenet/public_test_cases/p01953/input.0.txt @@ -0,0 +1,4 @@ +3 2 +2 3 +3 4 +1 2 diff --git a/codenet/public_test_cases/p01953/input.1.txt b/codenet/public_test_cases/p01953/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fa3c9a23c2eb2bd033c225d710cbb7e44c4fab5 --- /dev/null +++ b/codenet/public_test_cases/p01953/input.1.txt @@ -0,0 +1,4 @@ +3 2 +2 3 +3 4 +1 2 diff --git a/codenet/public_test_cases/p01953/input.2.txt b/codenet/public_test_cases/p01953/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a4991803b010ef25fdced6ca6135f4893e17612 --- /dev/null +++ b/codenet/public_test_cases/p01953/input.2.txt @@ -0,0 +1,4 @@ +3 2 +1 2 +2 3 +3 3 diff --git a/codenet/public_test_cases/p01953/input.3.txt b/codenet/public_test_cases/p01953/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..67433e21440b1ade46ad574e049c06b0eb5a1702 --- /dev/null +++ b/codenet/public_test_cases/p01953/input.3.txt @@ -0,0 +1,11 @@ +10 5 +8 3 +10 6 +5 8 +2 7 +7 6 +1 9 +9 3 +6 2 +4 5 +3 5 diff --git a/codenet/public_test_cases/p01953/output.0.txt b/codenet/public_test_cases/p01953/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01953/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01953/output.1.txt b/codenet/public_test_cases/p01953/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p01953/output.1.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p01953/output.2.txt b/codenet/public_test_cases/p01953/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01953/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01953/output.3.txt b/codenet/public_test_cases/p01953/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a83cc2149104b8a747d6e244678d888ad668719 --- /dev/null +++ b/codenet/public_test_cases/p01953/output.3.txt @@ -0,0 +1 @@ +824 diff --git a/codenet/public_test_cases/p01954/input.0.txt b/codenet/public_test_cases/p01954/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ca1cce1f5e8e85e9a2df9b3526cff428f8fed95 --- /dev/null +++ b/codenet/public_test_cases/p01954/input.0.txt @@ -0,0 +1,3 @@ +2 2 23 2 +7 10 +9 10 diff --git a/codenet/public_test_cases/p01954/output.0.txt b/codenet/public_test_cases/p01954/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94d36aad18523dd282e91587eaf1a1777fb668fc --- /dev/null +++ b/codenet/public_test_cases/p01954/output.0.txt @@ -0,0 +1,2 @@ +1 +-1 diff --git a/codenet/public_test_cases/p01955/input.0.txt b/codenet/public_test_cases/p01955/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9dbf780d5ad89326fc3032b04f479c15504d750 --- /dev/null +++ b/codenet/public_test_cases/p01955/input.0.txt @@ -0,0 +1,5 @@ +5 4 +2 5 +2 4 +1 3 +1 2 diff --git a/codenet/public_test_cases/p01955/output.0.txt b/codenet/public_test_cases/p01955/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a825dc69e3cfda6edec6a429bb5216ef4a974ba7 --- /dev/null +++ b/codenet/public_test_cases/p01955/output.0.txt @@ -0,0 +1,4 @@ +2 +3 +6 +5 diff --git a/codenet/public_test_cases/p01956/input.0.txt b/codenet/public_test_cases/p01956/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..633ad538253835b590d83f697a47f8a749264817 --- /dev/null +++ b/codenet/public_test_cases/p01956/input.0.txt @@ -0,0 +1,2 @@ +4 3 3 +1 1 2 3 diff --git a/codenet/public_test_cases/p01956/input.1.txt b/codenet/public_test_cases/p01956/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..633ad538253835b590d83f697a47f8a749264817 --- /dev/null +++ b/codenet/public_test_cases/p01956/input.1.txt @@ -0,0 +1,2 @@ +4 3 3 +1 1 2 3 diff --git a/codenet/public_test_cases/p01956/input.2.txt b/codenet/public_test_cases/p01956/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e21094b59bb0a30ec6608ff710e141165b63d91 --- /dev/null +++ b/codenet/public_test_cases/p01956/input.2.txt @@ -0,0 +1,2 @@ +4 1 4 +3 3 2 2 diff --git a/codenet/public_test_cases/p01956/input.3.txt b/codenet/public_test_cases/p01956/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..649981c34a049add6de109445452e146e7a44263 --- /dev/null +++ b/codenet/public_test_cases/p01956/input.3.txt @@ -0,0 +1,2 @@ +6 2 2 +0 2 2 2 2 0 diff --git a/codenet/public_test_cases/p01956/input.4.txt b/codenet/public_test_cases/p01956/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..48983665f1adb9a653f0eaac2a67896dc0be8cdd --- /dev/null +++ b/codenet/public_test_cases/p01956/input.4.txt @@ -0,0 +1,2 @@ +8 7 15 +5 0 9 14 0 4 4 15 diff --git a/codenet/public_test_cases/p01956/input.5.txt b/codenet/public_test_cases/p01956/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..327753ca07946a7dd20e5280681cd8d2e9629843 --- /dev/null +++ b/codenet/public_test_cases/p01956/input.5.txt @@ -0,0 +1,2 @@ +8 10 18 +2 12 16 14 18 4 17 16 diff --git a/codenet/public_test_cases/p01956/output.0.txt b/codenet/public_test_cases/p01956/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01956/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01956/output.1.txt b/codenet/public_test_cases/p01956/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p01956/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p01956/output.2.txt b/codenet/public_test_cases/p01956/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01956/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01956/output.3.txt b/codenet/public_test_cases/p01956/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p01956/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p01956/output.4.txt b/codenet/public_test_cases/p01956/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c412452bcfc9cbc73c6192ccfd05f645660af96 --- /dev/null +++ b/codenet/public_test_cases/p01956/output.4.txt @@ -0,0 +1 @@ +189 diff --git a/codenet/public_test_cases/p01956/output.5.txt b/codenet/public_test_cases/p01956/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b0cffbc0d7de40e36731a5d9d259e3d31195262 --- /dev/null +++ b/codenet/public_test_cases/p01956/output.5.txt @@ -0,0 +1 @@ +370 diff --git a/codenet/public_test_cases/p01957/input.0.txt b/codenet/public_test_cases/p01957/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eced92523f443619679576dcebe8ad21c99a23b9 --- /dev/null +++ b/codenet/public_test_cases/p01957/input.0.txt @@ -0,0 +1,5 @@ +[[m-y]-[a-o]] +o 0 +a 1 +y 2 +m 0 diff --git a/codenet/public_test_cases/p01957/input.1.txt b/codenet/public_test_cases/p01957/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eced92523f443619679576dcebe8ad21c99a23b9 --- /dev/null +++ b/codenet/public_test_cases/p01957/input.1.txt @@ -0,0 +1,5 @@ +[[m-y]-[a-o]] +o 0 +a 1 +y 2 +m 0 diff --git a/codenet/public_test_cases/p01957/input.2.txt b/codenet/public_test_cases/p01957/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d57b8d7f874ef080370c1e94c24e9610a01fa7e0 --- /dev/null +++ b/codenet/public_test_cases/p01957/input.2.txt @@ -0,0 +1,5 @@ +[[r-i]-[m-e]] +e 0 +r 1 +i 1 +m 2 diff --git a/codenet/public_test_cases/p01957/output.0.txt b/codenet/public_test_cases/p01957/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01957/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01957/output.1.txt b/codenet/public_test_cases/p01957/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01957/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01957/output.2.txt b/codenet/public_test_cases/p01957/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p01957/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p01958/input.0.txt b/codenet/public_test_cases/p01958/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0531b1e0cd73f5ab2f39c779a702dc3545029df5 --- /dev/null +++ b/codenet/public_test_cases/p01958/input.0.txt @@ -0,0 +1 @@ +1 9 diff --git a/codenet/public_test_cases/p01958/input.1.txt b/codenet/public_test_cases/p01958/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a479b8a5479bbd920d7582921326ed00dfdd75fa --- /dev/null +++ b/codenet/public_test_cases/p01958/input.1.txt @@ -0,0 +1 @@ +180 180 diff --git a/codenet/public_test_cases/p01958/input.2.txt b/codenet/public_test_cases/p01958/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d22f9e08719128d7ddc9ff8c6b03769224129850 --- /dev/null +++ b/codenet/public_test_cases/p01958/input.2.txt @@ -0,0 +1 @@ +999000001 1000000000 diff --git a/codenet/public_test_cases/p01958/input.3.txt b/codenet/public_test_cases/p01958/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f602801fb25e839b870e19c713ed5c10e0df45b --- /dev/null +++ b/codenet/public_test_cases/p01958/input.3.txt @@ -0,0 +1 @@ +575 57577 diff --git a/codenet/public_test_cases/p01958/input.4.txt b/codenet/public_test_cases/p01958/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f47271a268f55c4a903abeaea71f0efdbfd334a --- /dev/null +++ b/codenet/public_test_cases/p01958/input.4.txt @@ -0,0 +1 @@ +9900001 10000000 diff --git a/codenet/public_test_cases/p01958/input.5.txt b/codenet/public_test_cases/p01958/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0531b1e0cd73f5ab2f39c779a702dc3545029df5 --- /dev/null +++ b/codenet/public_test_cases/p01958/input.5.txt @@ -0,0 +1 @@ +1 9 diff --git a/codenet/public_test_cases/p01958/input.6.txt b/codenet/public_test_cases/p01958/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed40cec79baa7d9dbb01e18ad634edd038ad2259 --- /dev/null +++ b/codenet/public_test_cases/p01958/input.6.txt @@ -0,0 +1 @@ +10 20 diff --git a/codenet/public_test_cases/p01958/output.0.txt b/codenet/public_test_cases/p01958/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01958/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01958/output.1.txt b/codenet/public_test_cases/p01958/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01958/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01958/output.2.txt b/codenet/public_test_cases/p01958/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0edbf1e5d1453b18ec729a95fe712e07ae2a0e6 --- /dev/null +++ b/codenet/public_test_cases/p01958/output.2.txt @@ -0,0 +1 @@ +592955 diff --git a/codenet/public_test_cases/p01958/output.3.txt b/codenet/public_test_cases/p01958/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7b5bacab45b9ec55e29cc500fc4d56cef5046db --- /dev/null +++ b/codenet/public_test_cases/p01958/output.3.txt @@ -0,0 +1 @@ +36172 diff --git a/codenet/public_test_cases/p01958/output.4.txt b/codenet/public_test_cases/p01958/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..21067ceaae348347bb65f8e7dcb95d26a003b539 --- /dev/null +++ b/codenet/public_test_cases/p01958/output.4.txt @@ -0,0 +1 @@ +60997 diff --git a/codenet/public_test_cases/p01958/output.5.txt b/codenet/public_test_cases/p01958/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01958/output.5.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01958/output.6.txt b/codenet/public_test_cases/p01958/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01958/output.6.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01959/input.0.txt b/codenet/public_test_cases/p01959/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94955a1a7a8c8e1b1757bcbbf84f48730d143e4a --- /dev/null +++ b/codenet/public_test_cases/p01959/input.0.txt @@ -0,0 +1,4 @@ +3 3 1 3 +1 2 1 +2 3 5 +1 3 3 diff --git a/codenet/public_test_cases/p01959/input.1.txt b/codenet/public_test_cases/p01959/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94955a1a7a8c8e1b1757bcbbf84f48730d143e4a --- /dev/null +++ b/codenet/public_test_cases/p01959/input.1.txt @@ -0,0 +1,4 @@ +3 3 1 3 +1 2 1 +2 3 5 +1 3 3 diff --git a/codenet/public_test_cases/p01959/input.2.txt b/codenet/public_test_cases/p01959/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc92081ec410c15c832e3ad5e5ec08ee86f84d1c --- /dev/null +++ b/codenet/public_test_cases/p01959/input.2.txt @@ -0,0 +1,5 @@ +4 4 1 4 +1 2 1 +2 4 1 +1 3 1 +3 4 1 diff --git a/codenet/public_test_cases/p01959/input.3.txt b/codenet/public_test_cases/p01959/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c6918bb978584c6096ff3ba1281776ccfdbcd73 --- /dev/null +++ b/codenet/public_test_cases/p01959/input.3.txt @@ -0,0 +1,5 @@ +5 4 4 1 +1 2 3 +2 3 4 +3 4 5 +4 5 6 diff --git a/codenet/public_test_cases/p01959/output.0.txt b/codenet/public_test_cases/p01959/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01959/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01959/output.1.txt b/codenet/public_test_cases/p01959/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01959/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01959/output.2.txt b/codenet/public_test_cases/p01959/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01959/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01959/output.3.txt b/codenet/public_test_cases/p01959/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01959/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01960/input.0.txt b/codenet/public_test_cases/p01960/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fa10279583c299e9d987e8a5ad331bc6c8704d --- /dev/null +++ b/codenet/public_test_cases/p01960/input.0.txt @@ -0,0 +1,2 @@ +2 1 +1 2 diff --git a/codenet/public_test_cases/p01960/input.1.txt b/codenet/public_test_cases/p01960/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p01960/input.1.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p01960/input.2.txt b/codenet/public_test_cases/p01960/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dd5792039cef9143d065edba4ed3834d31aef3e --- /dev/null +++ b/codenet/public_test_cases/p01960/input.2.txt @@ -0,0 +1,12 @@ +12 2 +1 2 +2 3 +3 4 +4 5 +3 6 +6 7 +7 8 +8 9 +6 10 +10 11 +11 12 diff --git a/codenet/public_test_cases/p01960/input.3.txt b/codenet/public_test_cases/p01960/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1d25e95a4318578d9c477b4494c903d130698cf --- /dev/null +++ b/codenet/public_test_cases/p01960/input.3.txt @@ -0,0 +1,9 @@ +9 3 +1 2 +1 3 +1 4 +4 5 +4 6 +4 7 +7 8 +7 9 diff --git a/codenet/public_test_cases/p01960/input.4.txt b/codenet/public_test_cases/p01960/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fa10279583c299e9d987e8a5ad331bc6c8704d --- /dev/null +++ b/codenet/public_test_cases/p01960/input.4.txt @@ -0,0 +1,2 @@ +2 1 +1 2 diff --git a/codenet/public_test_cases/p01960/input.5.txt b/codenet/public_test_cases/p01960/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fe35d674515c5762c29108af7db213639d15471 --- /dev/null +++ b/codenet/public_test_cases/p01960/input.5.txt @@ -0,0 +1,7 @@ +7 3 +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 diff --git a/codenet/public_test_cases/p01960/input.6.txt b/codenet/public_test_cases/p01960/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e332269a3cb7ab40bdf12a2bc73a868339ba842 --- /dev/null +++ b/codenet/public_test_cases/p01960/input.6.txt @@ -0,0 +1,3 @@ +3 1 +1 2 +2 3 diff --git a/codenet/public_test_cases/p01960/output.0.txt b/codenet/public_test_cases/p01960/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01960/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01960/output.1.txt b/codenet/public_test_cases/p01960/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01960/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01960/output.2.txt b/codenet/public_test_cases/p01960/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01960/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01960/output.3.txt b/codenet/public_test_cases/p01960/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01960/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01960/output.4.txt b/codenet/public_test_cases/p01960/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01960/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01960/output.5.txt b/codenet/public_test_cases/p01960/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01960/output.5.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01960/output.6.txt b/codenet/public_test_cases/p01960/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01960/output.6.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01961/input.0.txt b/codenet/public_test_cases/p01961/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0dca9b86cd61cf775896e15b6017ee15f6f7245 --- /dev/null +++ b/codenet/public_test_cases/p01961/input.0.txt @@ -0,0 +1,12 @@ +11 7 +....... +....... +*.....* +....... +..@.... +....... +*...... +....... +....*.. +....... +....... diff --git a/codenet/public_test_cases/p01961/input.1.txt b/codenet/public_test_cases/p01961/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0dca9b86cd61cf775896e15b6017ee15f6f7245 --- /dev/null +++ b/codenet/public_test_cases/p01961/input.1.txt @@ -0,0 +1,12 @@ +11 7 +....... +....... +*.....* +....... +..@.... +....... +*...... +....... +....*.. +....... +....... diff --git a/codenet/public_test_cases/p01961/input.2.txt b/codenet/public_test_cases/p01961/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c34543f9a879c4e2bb47531b8ca379c6f8f317be --- /dev/null +++ b/codenet/public_test_cases/p01961/input.2.txt @@ -0,0 +1,8 @@ +7 11 +........*.. +........... +........... +........... +....*...*.. +........... +..*.@...*.. diff --git a/codenet/public_test_cases/p01961/output.0.txt b/codenet/public_test_cases/p01961/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..021e7f0eb6c3ae716607e685c97a28782d8766d1 --- /dev/null +++ b/codenet/public_test_cases/p01961/output.0.txt @@ -0,0 +1,11 @@ +....... +....... +*#####* +......# +..@...# +..#.### +*##.#.. +#...#.. +####*.. +....... +....... diff --git a/codenet/public_test_cases/p01961/output.1.txt b/codenet/public_test_cases/p01961/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..021e7f0eb6c3ae716607e685c97a28782d8766d1 --- /dev/null +++ b/codenet/public_test_cases/p01961/output.1.txt @@ -0,0 +1,11 @@ +....... +....... +*#####* +......# +..@...# +..#.### +*##.#.. +#...#.. +####*.. +....... +....... diff --git a/codenet/public_test_cases/p01961/output.2.txt b/codenet/public_test_cases/p01961/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..10948996220820c44a44b3584010343c9fbfe89d --- /dev/null +++ b/codenet/public_test_cases/p01961/output.2.txt @@ -0,0 +1,7 @@ +........*.. +........#.. +........#.. +........#.. +..##*##.*.. +..#...#.#.. +..*#@.##*.. diff --git a/codenet/public_test_cases/p01962/input.0.txt b/codenet/public_test_cases/p01962/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..67df85ca1edf7ffcc863a06eaf74a7f16b0b2a33 --- /dev/null +++ b/codenet/public_test_cases/p01962/input.0.txt @@ -0,0 +1,4 @@ +3 +2 0 0 1 0 +2 0 5 1 5 +4 1 -10 -5 10 diff --git a/codenet/public_test_cases/p01962/input.1.txt b/codenet/public_test_cases/p01962/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4f2cade6caeb4de9edb6a45847fbeb02598c57b --- /dev/null +++ b/codenet/public_test_cases/p01962/input.1.txt @@ -0,0 +1,5 @@ +4 +1 0 0 5 0 +1 0 5 0 0 +1 5 5 0 5 +1 5 0 0 0 diff --git a/codenet/public_test_cases/p01962/input.2.txt b/codenet/public_test_cases/p01962/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..67df85ca1edf7ffcc863a06eaf74a7f16b0b2a33 --- /dev/null +++ b/codenet/public_test_cases/p01962/input.2.txt @@ -0,0 +1,4 @@ +3 +2 0 0 1 0 +2 0 5 1 5 +4 1 -10 -5 10 diff --git a/codenet/public_test_cases/p01962/input.3.txt b/codenet/public_test_cases/p01962/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd901b5dc81a1b723a590e77575cd4fa840117c9 --- /dev/null +++ b/codenet/public_test_cases/p01962/input.3.txt @@ -0,0 +1,4 @@ +3 +1 0 0 5 0 +1 0 5 0 0 +1 5 5 0 5 diff --git a/codenet/public_test_cases/p01962/output.0.txt b/codenet/public_test_cases/p01962/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01962/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01962/output.1.txt b/codenet/public_test_cases/p01962/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01962/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01962/output.2.txt b/codenet/public_test_cases/p01962/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01962/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01962/output.3.txt b/codenet/public_test_cases/p01962/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01962/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01963/input.0.txt b/codenet/public_test_cases/p01963/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8850200815f3d17703e3d04a6a8989a8afb8c1f6 --- /dev/null +++ b/codenet/public_test_cases/p01963/input.0.txt @@ -0,0 +1,5 @@ +3 +a +b +ab +abab diff --git a/codenet/public_test_cases/p01963/input.1.txt b/codenet/public_test_cases/p01963/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8850200815f3d17703e3d04a6a8989a8afb8c1f6 --- /dev/null +++ b/codenet/public_test_cases/p01963/input.1.txt @@ -0,0 +1,5 @@ +3 +a +b +ab +abab diff --git a/codenet/public_test_cases/p01963/input.2.txt b/codenet/public_test_cases/p01963/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e4b2fac062e9e85a33aace2028aa3be655305e8 --- /dev/null +++ b/codenet/public_test_cases/p01963/input.2.txt @@ -0,0 +1,5 @@ +3 +a +b +c +xyz diff --git a/codenet/public_test_cases/p01963/input.3.txt b/codenet/public_test_cases/p01963/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc26e27d8769748a09248f3772db344a479b67e3 --- /dev/null +++ b/codenet/public_test_cases/p01963/input.3.txt @@ -0,0 +1,12 @@ +10 +a +aa +aaa +aaaa +aaaaa +aaaaaa +aaaaaaa +aaaaaaaa +aaaaaaaaa +aaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa diff --git a/codenet/public_test_cases/p01963/input.4.txt b/codenet/public_test_cases/p01963/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..630939168e4d6446fbc85210758457eecd41d0bb --- /dev/null +++ b/codenet/public_test_cases/p01963/input.4.txt @@ -0,0 +1,9 @@ +7 +abc +ab +bc +a +b +c +aa +aaabcbccababbc diff --git a/codenet/public_test_cases/p01963/output.0.txt b/codenet/public_test_cases/p01963/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01963/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01963/output.1.txt b/codenet/public_test_cases/p01963/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p01963/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p01963/output.2.txt b/codenet/public_test_cases/p01963/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p01963/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p01963/output.3.txt b/codenet/public_test_cases/p01963/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bd76f8525b0cb259824e130119ad22f131a8287 --- /dev/null +++ b/codenet/public_test_cases/p01963/output.3.txt @@ -0,0 +1 @@ +461695029 diff --git a/codenet/public_test_cases/p01963/output.4.txt b/codenet/public_test_cases/p01963/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a76256037d61ef7aed02f761d7673513e814e747 --- /dev/null +++ b/codenet/public_test_cases/p01963/output.4.txt @@ -0,0 +1 @@ +160 diff --git a/codenet/public_test_cases/p01964/input.0.txt b/codenet/public_test_cases/p01964/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e5b02d4ce0ae2d57ab906325e55bf8f13d9caca --- /dev/null +++ b/codenet/public_test_cases/p01964/input.0.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 3 +3 4 +4 1 diff --git a/codenet/public_test_cases/p01964/input.1.txt b/codenet/public_test_cases/p01964/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e5b02d4ce0ae2d57ab906325e55bf8f13d9caca --- /dev/null +++ b/codenet/public_test_cases/p01964/input.1.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 3 +3 4 +4 1 diff --git a/codenet/public_test_cases/p01964/input.2.txt b/codenet/public_test_cases/p01964/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f1da6cc5432201d804dfcd82f56f5a028cd2619 --- /dev/null +++ b/codenet/public_test_cases/p01964/input.2.txt @@ -0,0 +1,6 @@ +4 5 +1 2 +2 3 +3 4 +4 1 +1 3 diff --git a/codenet/public_test_cases/p01964/input.3.txt b/codenet/public_test_cases/p01964/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..20e2573c7dbae5f9ea77c75984fd374daf81a326 --- /dev/null +++ b/codenet/public_test_cases/p01964/input.3.txt @@ -0,0 +1,14 @@ +5 13 +4 2 +2 4 +1 2 +5 4 +5 1 +2 1 +5 3 +4 3 +1 5 +4 5 +2 3 +5 2 +1 3 diff --git a/codenet/public_test_cases/p01964/output.0.txt b/codenet/public_test_cases/p01964/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01964/output.0.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01964/output.1.txt b/codenet/public_test_cases/p01964/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p01964/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p01964/output.2.txt b/codenet/public_test_cases/p01964/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01964/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01964/output.3.txt b/codenet/public_test_cases/p01964/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01964/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01965/input.0.txt b/codenet/public_test_cases/p01965/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87f0d85f51053c310ee23baefd95f899d9cdc647 --- /dev/null +++ b/codenet/public_test_cases/p01965/input.0.txt @@ -0,0 +1,3 @@ +2 +3 +1 5 diff --git a/codenet/public_test_cases/p01965/input.1.txt b/codenet/public_test_cases/p01965/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87f0d85f51053c310ee23baefd95f899d9cdc647 --- /dev/null +++ b/codenet/public_test_cases/p01965/input.1.txt @@ -0,0 +1,3 @@ +2 +3 +1 5 diff --git a/codenet/public_test_cases/p01965/input.2.txt b/codenet/public_test_cases/p01965/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a62937b1b7c4ca1e2ede61412e6d46151c854fd5 --- /dev/null +++ b/codenet/public_test_cases/p01965/input.2.txt @@ -0,0 +1,3 @@ +3 +100 100 +1 2 3 diff --git a/codenet/public_test_cases/p01965/input.3.txt b/codenet/public_test_cases/p01965/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4898948ae94c1d5ad0accb26d9fe843eee0a4d1a --- /dev/null +++ b/codenet/public_test_cases/p01965/input.3.txt @@ -0,0 +1,3 @@ +4 +1 2 3 +1 1 100 100 diff --git a/codenet/public_test_cases/p01965/output.0.txt b/codenet/public_test_cases/p01965/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01965/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01965/output.1.txt b/codenet/public_test_cases/p01965/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01965/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01965/output.2.txt b/codenet/public_test_cases/p01965/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p01965/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p01965/output.3.txt b/codenet/public_test_cases/p01965/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p01965/output.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p01966/input.0.txt b/codenet/public_test_cases/p01966/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fe1acf65f7309fd2905aee83c0cec4ece94267d --- /dev/null +++ b/codenet/public_test_cases/p01966/input.0.txt @@ -0,0 +1,3 @@ +5 2 +1 4 1 +2 3 1 diff --git a/codenet/public_test_cases/p01966/input.1.txt b/codenet/public_test_cases/p01966/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fe1acf65f7309fd2905aee83c0cec4ece94267d --- /dev/null +++ b/codenet/public_test_cases/p01966/input.1.txt @@ -0,0 +1,3 @@ +5 2 +1 4 1 +2 3 1 diff --git a/codenet/public_test_cases/p01966/input.2.txt b/codenet/public_test_cases/p01966/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a587f1d0ed733b635d48cf07e142e9e2d6d0466a --- /dev/null +++ b/codenet/public_test_cases/p01966/input.2.txt @@ -0,0 +1,3 @@ +5 2 +1 3 3 +3 5 1 diff --git a/codenet/public_test_cases/p01966/input.3.txt b/codenet/public_test_cases/p01966/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..889337c26c0eac0041495ad377aa2598e207fe07 --- /dev/null +++ b/codenet/public_test_cases/p01966/input.3.txt @@ -0,0 +1,3 @@ +5 2 +1 4 1 +2 3 5 diff --git a/codenet/public_test_cases/p01966/input.4.txt b/codenet/public_test_cases/p01966/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e622f24fc8e05bdddbbc3d17050dca53e97f674 --- /dev/null +++ b/codenet/public_test_cases/p01966/input.4.txt @@ -0,0 +1,5 @@ +10 4 +3 5 2 +5 7 5 +8 9 2 +1 7 5 diff --git a/codenet/public_test_cases/p01966/output.0.txt b/codenet/public_test_cases/p01966/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7290ba859f4adbf90d68526fe0ab1f8cbcf65098 --- /dev/null +++ b/codenet/public_test_cases/p01966/output.0.txt @@ -0,0 +1,2 @@ +4 +4 diff --git a/codenet/public_test_cases/p01966/output.1.txt b/codenet/public_test_cases/p01966/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7290ba859f4adbf90d68526fe0ab1f8cbcf65098 --- /dev/null +++ b/codenet/public_test_cases/p01966/output.1.txt @@ -0,0 +1,2 @@ +4 +4 diff --git a/codenet/public_test_cases/p01966/output.2.txt b/codenet/public_test_cases/p01966/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6613b568867eb6fb5247be321a988fb430e4d3ad --- /dev/null +++ b/codenet/public_test_cases/p01966/output.2.txt @@ -0,0 +1,2 @@ +5 +6 diff --git a/codenet/public_test_cases/p01966/output.3.txt b/codenet/public_test_cases/p01966/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..de78180725a82141b5064f9715b66b2956856254 --- /dev/null +++ b/codenet/public_test_cases/p01966/output.3.txt @@ -0,0 +1,2 @@ +4 +8 diff --git a/codenet/public_test_cases/p01966/output.4.txt b/codenet/public_test_cases/p01966/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f78a0f237e83639aa968e3a2c469b90fd628a48b --- /dev/null +++ b/codenet/public_test_cases/p01966/output.4.txt @@ -0,0 +1,4 @@ +6 +11 +11 +16 diff --git a/codenet/public_test_cases/p01967/input.0.txt b/codenet/public_test_cases/p01967/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23a24c1169142ef942a9fb275ebcdb00b46d6eb1 --- /dev/null +++ b/codenet/public_test_cases/p01967/input.0.txt @@ -0,0 +1,7 @@ +2 +3 3 +4 +1 1 2 +1 2 3 +2 1 3 +2 2 3 diff --git a/codenet/public_test_cases/p01967/input.1.txt b/codenet/public_test_cases/p01967/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..23a24c1169142ef942a9fb275ebcdb00b46d6eb1 --- /dev/null +++ b/codenet/public_test_cases/p01967/input.1.txt @@ -0,0 +1,7 @@ +2 +3 3 +4 +1 1 2 +1 2 3 +2 1 3 +2 2 3 diff --git a/codenet/public_test_cases/p01967/output.0.txt b/codenet/public_test_cases/p01967/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01967/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01967/output.1.txt b/codenet/public_test_cases/p01967/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01967/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01968/input.0.txt b/codenet/public_test_cases/p01968/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..886d7400ee0429b91b212725de269c5fb9d90a2c --- /dev/null +++ b/codenet/public_test_cases/p01968/input.0.txt @@ -0,0 +1,2 @@ +4 +2 0 -2 1 diff --git a/codenet/public_test_cases/p01968/input.1.txt b/codenet/public_test_cases/p01968/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..886d7400ee0429b91b212725de269c5fb9d90a2c --- /dev/null +++ b/codenet/public_test_cases/p01968/input.1.txt @@ -0,0 +1,2 @@ +4 +2 0 -2 1 diff --git a/codenet/public_test_cases/p01968/output.0.txt b/codenet/public_test_cases/p01968/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p01968/output.0.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p01968/output.1.txt b/codenet/public_test_cases/p01968/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p01968/output.1.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p01969/input.1.txt b/codenet/public_test_cases/p01969/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01969/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01969/output.1.txt b/codenet/public_test_cases/p01969/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01969/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01970/input.0.txt b/codenet/public_test_cases/p01970/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90a24e94a60392348447c993aafd563a9a740eed --- /dev/null +++ b/codenet/public_test_cases/p01970/input.0.txt @@ -0,0 +1,2 @@ +3 +2 3 3 diff --git a/codenet/public_test_cases/p01970/input.1.txt b/codenet/public_test_cases/p01970/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..90a24e94a60392348447c993aafd563a9a740eed --- /dev/null +++ b/codenet/public_test_cases/p01970/input.1.txt @@ -0,0 +1,2 @@ +3 +2 3 3 diff --git a/codenet/public_test_cases/p01970/output.0.txt b/codenet/public_test_cases/p01970/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01970/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01970/output.1.txt b/codenet/public_test_cases/p01970/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01970/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01972/input.1.txt b/codenet/public_test_cases/p01972/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01972/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01972/output.1.txt b/codenet/public_test_cases/p01972/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p01972/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p01973/input.0.txt b/codenet/public_test_cases/p01973/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7efcccd5057c48b81cfeb67e6e3c223b7561d520 --- /dev/null +++ b/codenet/public_test_cases/p01973/input.0.txt @@ -0,0 +1,3 @@ +brainfuck +1 +fuck diff --git a/codenet/public_test_cases/p01973/input.1.txt b/codenet/public_test_cases/p01973/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7efcccd5057c48b81cfeb67e6e3c223b7561d520 --- /dev/null +++ b/codenet/public_test_cases/p01973/input.1.txt @@ -0,0 +1,3 @@ +brainfuck +1 +fuck diff --git a/codenet/public_test_cases/p01973/output.0.txt b/codenet/public_test_cases/p01973/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01973/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01973/output.1.txt b/codenet/public_test_cases/p01973/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01973/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01974/input.0.txt b/codenet/public_test_cases/p01974/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b167c3eecb2a31b66956388b791af09c5456189 --- /dev/null +++ b/codenet/public_test_cases/p01974/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 4 7 10 diff --git a/codenet/public_test_cases/p01974/input.1.txt b/codenet/public_test_cases/p01974/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b167c3eecb2a31b66956388b791af09c5456189 --- /dev/null +++ b/codenet/public_test_cases/p01974/input.1.txt @@ -0,0 +1,2 @@ +5 +1 2 4 7 10 diff --git a/codenet/public_test_cases/p01974/output.0.txt b/codenet/public_test_cases/p01974/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f9d3d3eb0246971318bae23c972bdc1422e3277 --- /dev/null +++ b/codenet/public_test_cases/p01974/output.0.txt @@ -0,0 +1 @@ +2 10 diff --git a/codenet/public_test_cases/p01974/output.1.txt b/codenet/public_test_cases/p01974/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f9d3d3eb0246971318bae23c972bdc1422e3277 --- /dev/null +++ b/codenet/public_test_cases/p01974/output.1.txt @@ -0,0 +1 @@ +2 10 diff --git a/codenet/public_test_cases/p01975/input.0.txt b/codenet/public_test_cases/p01975/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db19b242c5013e1fcafee57a7a486407b6693d1f --- /dev/null +++ b/codenet/public_test_cases/p01975/input.0.txt @@ -0,0 +1,3 @@ +5 +1 2 3 4 5 +3 4 2 5 1 diff --git a/codenet/public_test_cases/p01975/input.1.txt b/codenet/public_test_cases/p01975/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db19b242c5013e1fcafee57a7a486407b6693d1f --- /dev/null +++ b/codenet/public_test_cases/p01975/input.1.txt @@ -0,0 +1,3 @@ +5 +1 2 3 4 5 +3 4 2 5 1 diff --git a/codenet/public_test_cases/p01975/output.0.txt b/codenet/public_test_cases/p01975/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01975/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01975/output.1.txt b/codenet/public_test_cases/p01975/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p01975/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p01976/input.0.txt b/codenet/public_test_cases/p01976/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5b3772c7391669b8b5d018e17aa018b3fc9b8b9 --- /dev/null +++ b/codenet/public_test_cases/p01976/input.0.txt @@ -0,0 +1,2 @@ +8 +5 2 4 9 4 9 2 5 diff --git a/codenet/public_test_cases/p01976/input.1.txt b/codenet/public_test_cases/p01976/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5b3772c7391669b8b5d018e17aa018b3fc9b8b9 --- /dev/null +++ b/codenet/public_test_cases/p01976/input.1.txt @@ -0,0 +1,2 @@ +8 +5 2 4 9 4 9 2 5 diff --git a/codenet/public_test_cases/p01976/output.0.txt b/codenet/public_test_cases/p01976/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa231f8e103ef38b8a45f057dd863e215bb7a16e --- /dev/null +++ b/codenet/public_test_cases/p01976/output.0.txt @@ -0,0 +1 @@ +1 2 4 6 7 8 diff --git a/codenet/public_test_cases/p01976/output.1.txt b/codenet/public_test_cases/p01976/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa231f8e103ef38b8a45f057dd863e215bb7a16e --- /dev/null +++ b/codenet/public_test_cases/p01976/output.1.txt @@ -0,0 +1 @@ +1 2 4 6 7 8 diff --git a/codenet/public_test_cases/p01977/input.0.txt b/codenet/public_test_cases/p01977/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5ad35350044029d52a95f312fa04dba91d07555 --- /dev/null +++ b/codenet/public_test_cases/p01977/input.0.txt @@ -0,0 +1,2 @@ +5 3 +9 1 2 3 9 diff --git a/codenet/public_test_cases/p01977/input.1.txt b/codenet/public_test_cases/p01977/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5ad35350044029d52a95f312fa04dba91d07555 --- /dev/null +++ b/codenet/public_test_cases/p01977/input.1.txt @@ -0,0 +1,2 @@ +5 3 +9 1 2 3 9 diff --git a/codenet/public_test_cases/p01977/output.0.txt b/codenet/public_test_cases/p01977/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2187894e06ddf0fb02294736f3d8a145c0e45f3 --- /dev/null +++ b/codenet/public_test_cases/p01977/output.0.txt @@ -0,0 +1 @@ +20.000000 diff --git a/codenet/public_test_cases/p01977/output.1.txt b/codenet/public_test_cases/p01977/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2187894e06ddf0fb02294736f3d8a145c0e45f3 --- /dev/null +++ b/codenet/public_test_cases/p01977/output.1.txt @@ -0,0 +1 @@ +20.000000 diff --git a/codenet/public_test_cases/p01978/input.0.txt b/codenet/public_test_cases/p01978/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d278ac2d772d15280518837029488932edab304a --- /dev/null +++ b/codenet/public_test_cases/p01978/input.0.txt @@ -0,0 +1,4 @@ +5 3 1 4 +3 1 2 5 +3 4 2 3 +5 4 2 2 diff --git a/codenet/public_test_cases/p01978/input.1.txt b/codenet/public_test_cases/p01978/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d278ac2d772d15280518837029488932edab304a --- /dev/null +++ b/codenet/public_test_cases/p01978/input.1.txt @@ -0,0 +1,4 @@ +5 3 1 4 +3 1 2 5 +3 4 2 3 +5 4 2 2 diff --git a/codenet/public_test_cases/p01978/output.0.txt b/codenet/public_test_cases/p01978/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01978/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01978/output.1.txt b/codenet/public_test_cases/p01978/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p01978/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p01979/input.0.txt b/codenet/public_test_cases/p01979/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..03aa28e2afa42d7c5b2699a02938027f15ac1829 --- /dev/null +++ b/codenet/public_test_cases/p01979/input.0.txt @@ -0,0 +1 @@ +5124 diff --git a/codenet/public_test_cases/p01979/input.1.txt b/codenet/public_test_cases/p01979/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03aa28e2afa42d7c5b2699a02938027f15ac1829 --- /dev/null +++ b/codenet/public_test_cases/p01979/input.1.txt @@ -0,0 +1 @@ +5124 diff --git a/codenet/public_test_cases/p01979/output.0.txt b/codenet/public_test_cases/p01979/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01979/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01979/output.1.txt b/codenet/public_test_cases/p01979/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01979/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01980/input.0.txt b/codenet/public_test_cases/p01980/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99a841c9b42da0220d0f9546905827bb2936c0d6 --- /dev/null +++ b/codenet/public_test_cases/p01980/input.0.txt @@ -0,0 +1,4 @@ +5 1 2 +3 1 5 +3 1 5 +4 1 5 diff --git a/codenet/public_test_cases/p01980/input.1.txt b/codenet/public_test_cases/p01980/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99a841c9b42da0220d0f9546905827bb2936c0d6 --- /dev/null +++ b/codenet/public_test_cases/p01980/input.1.txt @@ -0,0 +1,4 @@ +5 1 2 +3 1 5 +3 1 5 +4 1 5 diff --git a/codenet/public_test_cases/p01980/output.0.txt b/codenet/public_test_cases/p01980/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6631b22779376d4c1b0470c35390d511ec268e3c --- /dev/null +++ b/codenet/public_test_cases/p01980/output.0.txt @@ -0,0 +1,2 @@ +No +Yes diff --git a/codenet/public_test_cases/p01980/output.1.txt b/codenet/public_test_cases/p01980/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6631b22779376d4c1b0470c35390d511ec268e3c --- /dev/null +++ b/codenet/public_test_cases/p01980/output.1.txt @@ -0,0 +1,2 @@ +No +Yes diff --git a/codenet/public_test_cases/p01981/input.0.txt b/codenet/public_test_cases/p01981/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f591b9770252d2cfaf623a138cb2e602e7228fd --- /dev/null +++ b/codenet/public_test_cases/p01981/input.0.txt @@ -0,0 +1,9 @@ +HEISEI 1 1 8 +HEISEI 31 4 30 +HEISEI 31 5 1 +HEISEI 99 12 31 +HEISEI 38 8 30 +HEISEI 98 2 22 +HEISEI 2 3 26 +HEISEI 28 4 23 +# diff --git a/codenet/public_test_cases/p01981/input.1.txt b/codenet/public_test_cases/p01981/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f591b9770252d2cfaf623a138cb2e602e7228fd --- /dev/null +++ b/codenet/public_test_cases/p01981/input.1.txt @@ -0,0 +1,9 @@ +HEISEI 1 1 8 +HEISEI 31 4 30 +HEISEI 31 5 1 +HEISEI 99 12 31 +HEISEI 38 8 30 +HEISEI 98 2 22 +HEISEI 2 3 26 +HEISEI 28 4 23 +# diff --git a/codenet/public_test_cases/p01981/output.0.txt b/codenet/public_test_cases/p01981/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8925f817c606ff1f3444ece7900f521af28d774e --- /dev/null +++ b/codenet/public_test_cases/p01981/output.0.txt @@ -0,0 +1,8 @@ +HEISEI 1 1 8 +HEISEI 31 4 30 +? 1 5 1 +? 69 12 31 +? 8 8 30 +? 68 2 22 +HEISEI 2 3 26 +HEISEI 28 4 23 diff --git a/codenet/public_test_cases/p01981/output.1.txt b/codenet/public_test_cases/p01981/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8925f817c606ff1f3444ece7900f521af28d774e --- /dev/null +++ b/codenet/public_test_cases/p01981/output.1.txt @@ -0,0 +1,8 @@ +HEISEI 1 1 8 +HEISEI 31 4 30 +? 1 5 1 +? 69 12 31 +? 8 8 30 +? 68 2 22 +HEISEI 2 3 26 +HEISEI 28 4 23 diff --git a/codenet/public_test_cases/p01982/input.0.txt b/codenet/public_test_cases/p01982/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..332b1b3555a6c7ee6d38f2c81acd26e307d90eb5 --- /dev/null +++ b/codenet/public_test_cases/p01982/input.0.txt @@ -0,0 +1,17 @@ +3 1988 2014 +400 +100 +4 +1 1000 1999 +1 +2 1111 3333 +2 +2 +6 2000 3000 +5 +7 +11 +9 +3 +13 +0 0 0 diff --git a/codenet/public_test_cases/p01982/input.1.txt b/codenet/public_test_cases/p01982/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..332b1b3555a6c7ee6d38f2c81acd26e307d90eb5 --- /dev/null +++ b/codenet/public_test_cases/p01982/input.1.txt @@ -0,0 +1,17 @@ +3 1988 2014 +400 +100 +4 +1 1000 1999 +1 +2 1111 3333 +2 +2 +6 2000 3000 +5 +7 +11 +9 +3 +13 +0 0 0 diff --git a/codenet/public_test_cases/p01982/output.0.txt b/codenet/public_test_cases/p01982/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5de28d1173c094ff95be48a2b6d34d51863ee686 --- /dev/null +++ b/codenet/public_test_cases/p01982/output.0.txt @@ -0,0 +1,4 @@ +7 +1000 +2223 +785 diff --git a/codenet/public_test_cases/p01982/output.1.txt b/codenet/public_test_cases/p01982/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5de28d1173c094ff95be48a2b6d34d51863ee686 --- /dev/null +++ b/codenet/public_test_cases/p01982/output.1.txt @@ -0,0 +1,4 @@ +7 +1000 +2223 +785 diff --git a/codenet/public_test_cases/p01983/input.0.txt b/codenet/public_test_cases/p01983/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ebd127d4afe6c34b0b42efc3590e8d73b4a6632 --- /dev/null +++ b/codenet/public_test_cases/p01983/input.0.txt @@ -0,0 +1,11 @@ +[+c[+a[^bd]]] +0404 +[*b[*[*cd]a]] +7777 +[^[^ab][^cd]] +1295 +a +9876 +[^dd] +9090 +. diff --git a/codenet/public_test_cases/p01983/input.1.txt b/codenet/public_test_cases/p01983/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ebd127d4afe6c34b0b42efc3590e8d73b4a6632 --- /dev/null +++ b/codenet/public_test_cases/p01983/input.1.txt @@ -0,0 +1,11 @@ +[+c[+a[^bd]]] +0404 +[*b[*[*cd]a]] +7777 +[^[^ab][^cd]] +1295 +a +9876 +[^dd] +9090 +. diff --git a/codenet/public_test_cases/p01983/output.0.txt b/codenet/public_test_cases/p01983/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5cf9b38c5dd7a8636722c860c452bf3b167e6b7 --- /dev/null +++ b/codenet/public_test_cases/p01983/output.0.txt @@ -0,0 +1,5 @@ +0 10 +7 1 +15 544 +9 1000 +0 10000 diff --git a/codenet/public_test_cases/p01983/output.1.txt b/codenet/public_test_cases/p01983/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5cf9b38c5dd7a8636722c860c452bf3b167e6b7 --- /dev/null +++ b/codenet/public_test_cases/p01983/output.1.txt @@ -0,0 +1,5 @@ +0 10 +7 1 +15 544 +9 1000 +0 10000 diff --git a/codenet/public_test_cases/p01984/input.0.txt b/codenet/public_test_cases/p01984/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29a6b244c16308513def06789eccca07fd098b99 --- /dev/null +++ b/codenet/public_test_cases/p01984/input.0.txt @@ -0,0 +1,8 @@ +1 +2 +3 +390 +1124 +1546 +314159265358979323 +0 diff --git a/codenet/public_test_cases/p01984/input.1.txt b/codenet/public_test_cases/p01984/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29a6b244c16308513def06789eccca07fd098b99 --- /dev/null +++ b/codenet/public_test_cases/p01984/input.1.txt @@ -0,0 +1,8 @@ +1 +2 +3 +390 +1124 +1546 +314159265358979323 +0 diff --git a/codenet/public_test_cases/p01984/output.0.txt b/codenet/public_test_cases/p01984/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..73452670856b92790e0f7e70c64d98a1858990c8 --- /dev/null +++ b/codenet/public_test_cases/p01984/output.0.txt @@ -0,0 +1,7 @@ +10 +12 +13 +2020 +25252 +57577 +7744444777744474777777774774744777747477444774744744 diff --git a/codenet/public_test_cases/p01984/output.1.txt b/codenet/public_test_cases/p01984/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..73452670856b92790e0f7e70c64d98a1858990c8 --- /dev/null +++ b/codenet/public_test_cases/p01984/output.1.txt @@ -0,0 +1,7 @@ +10 +12 +13 +2020 +25252 +57577 +7744444777744474777777774774744777747477444774744744 diff --git a/codenet/public_test_cases/p01985/input.0.txt b/codenet/public_test_cases/p01985/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c066123fcf8b1dea79603607f88077548533a020 --- /dev/null +++ b/codenet/public_test_cases/p01985/input.0.txt @@ -0,0 +1,24 @@ +6 7 +1 2 +1 4 +2 3 +2 5 +3 4 +4 5 +4 6 +2 1 +1 2 +3 3 +1 2 +1 3 +2 3 +4 3 +1 2 +2 3 +3 4 +5 4 +1 2 +2 3 +3 4 +4 5 +0 0 diff --git a/codenet/public_test_cases/p01985/input.1.txt b/codenet/public_test_cases/p01985/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c066123fcf8b1dea79603607f88077548533a020 --- /dev/null +++ b/codenet/public_test_cases/p01985/input.1.txt @@ -0,0 +1,24 @@ +6 7 +1 2 +1 4 +2 3 +2 5 +3 4 +4 5 +4 6 +2 1 +1 2 +3 3 +1 2 +1 3 +2 3 +4 3 +1 2 +2 3 +3 4 +5 4 +1 2 +2 3 +3 4 +4 5 +0 0 diff --git a/codenet/public_test_cases/p01985/output.0.txt b/codenet/public_test_cases/p01985/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dff51a30e3d42f5d84aefb36baa7924e002416ff --- /dev/null +++ b/codenet/public_test_cases/p01985/output.0.txt @@ -0,0 +1,9 @@ +2 +1 +2 +0 +0 +1 +1 +1 +1 diff --git a/codenet/public_test_cases/p01985/output.1.txt b/codenet/public_test_cases/p01985/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dff51a30e3d42f5d84aefb36baa7924e002416ff --- /dev/null +++ b/codenet/public_test_cases/p01985/output.1.txt @@ -0,0 +1,9 @@ +2 +1 +2 +0 +0 +1 +1 +1 +1 diff --git a/codenet/public_test_cases/p01986/input.0.txt b/codenet/public_test_cases/p01986/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e9ad6e94fcab81331a0d64806beffedf24d7227 --- /dev/null +++ b/codenet/public_test_cases/p01986/input.0.txt @@ -0,0 +1,45 @@ +3 3 +2 1 +2 2 +10 +10 4 +1 1 +1 5 +1 9 +1 +5 7 +1000000000 1 +1000000000 1 +1000000000 3 +1000000000 3 +1000000000 5 +1000000000 5 +1 +10000 11 +10934235 560 +3155907 1508 +10901182 2457 +3471816 3590 +10087848 4417 +16876957 5583 +23145027 6540 +15162205 7454 +1749653 8481 +6216466 9554 +7198514 +701 14 +8181 636 +4942 273 +1706 282 +6758 20 +7139 148 +6055 629 +8765 369 +5487 95 +6111 77 +2302 419 +9974 699 +108 444 +1136 495 +2443 +0 0 diff --git a/codenet/public_test_cases/p01986/input.1.txt b/codenet/public_test_cases/p01986/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e9ad6e94fcab81331a0d64806beffedf24d7227 --- /dev/null +++ b/codenet/public_test_cases/p01986/input.1.txt @@ -0,0 +1,45 @@ +3 3 +2 1 +2 2 +10 +10 4 +1 1 +1 5 +1 9 +1 +5 7 +1000000000 1 +1000000000 1 +1000000000 3 +1000000000 3 +1000000000 5 +1000000000 5 +1 +10000 11 +10934235 560 +3155907 1508 +10901182 2457 +3471816 3590 +10087848 4417 +16876957 5583 +23145027 6540 +15162205 7454 +1749653 8481 +6216466 9554 +7198514 +701 14 +8181 636 +4942 273 +1706 282 +6758 20 +7139 148 +6055 629 +8765 369 +5487 95 +6111 77 +2302 419 +9974 699 +108 444 +1136 495 +2443 +0 0 diff --git a/codenet/public_test_cases/p01986/output.0.txt b/codenet/public_test_cases/p01986/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0493d6909ffc8293815db59ba596c8c6420263d3 --- /dev/null +++ b/codenet/public_test_cases/p01986/output.0.txt @@ -0,0 +1,5 @@ +10 +0 +5999999960 +23574372 +985 diff --git a/codenet/public_test_cases/p01986/output.1.txt b/codenet/public_test_cases/p01986/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0493d6909ffc8293815db59ba596c8c6420263d3 --- /dev/null +++ b/codenet/public_test_cases/p01986/output.1.txt @@ -0,0 +1,5 @@ +10 +0 +5999999960 +23574372 +985 diff --git a/codenet/public_test_cases/p01987/input.0.txt b/codenet/public_test_cases/p01987/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..333549386334a59cf675e68c157d739ff18c08b2 --- /dev/null +++ b/codenet/public_test_cases/p01987/input.0.txt @@ -0,0 +1,4 @@ +1 2 +2 1 +2 2 +0 0 diff --git a/codenet/public_test_cases/p01987/input.1.txt b/codenet/public_test_cases/p01987/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..333549386334a59cf675e68c157d739ff18c08b2 --- /dev/null +++ b/codenet/public_test_cases/p01987/input.1.txt @@ -0,0 +1,4 @@ +1 2 +2 1 +2 2 +0 0 diff --git a/codenet/public_test_cases/p01987/output.0.txt b/codenet/public_test_cases/p01987/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2b0a4f207af3cc9d94b5df1bd84cd22e9268224 --- /dev/null +++ b/codenet/public_test_cases/p01987/output.0.txt @@ -0,0 +1,3 @@ +4.25 +7 +7.9722222222 diff --git a/codenet/public_test_cases/p01987/output.1.txt b/codenet/public_test_cases/p01987/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2b0a4f207af3cc9d94b5df1bd84cd22e9268224 --- /dev/null +++ b/codenet/public_test_cases/p01987/output.1.txt @@ -0,0 +1,3 @@ +4.25 +7 +7.9722222222 diff --git a/codenet/public_test_cases/p01988/input.0.txt b/codenet/public_test_cases/p01988/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6201bd56b8552957508794854bba8c40dd4ef3d4 --- /dev/null +++ b/codenet/public_test_cases/p01988/input.0.txt @@ -0,0 +1,39 @@ +8 +1 1 2 2 +0 2 +0 0 +2 0 +2 1 +3 1 +3 3 +1 3 +1 2 +12 +-9 5 9 -9 +0 0 +0 -13 +3 -13 +3 -10 +10 -10 +10 10 +-1 10 +-1 13 +-4 13 +-4 10 +-10 10 +-10 0 +12 +3 57 53 2 +0 0 +64 0 +64 18 +47 18 +47 39 +64 39 +64 60 +0 60 +0 44 +33 44 +33 30 +0 30 +0 diff --git a/codenet/public_test_cases/p01988/input.1.txt b/codenet/public_test_cases/p01988/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6201bd56b8552957508794854bba8c40dd4ef3d4 --- /dev/null +++ b/codenet/public_test_cases/p01988/input.1.txt @@ -0,0 +1,39 @@ +8 +1 1 2 2 +0 2 +0 0 +2 0 +2 1 +3 1 +3 3 +1 3 +1 2 +12 +-9 5 9 -9 +0 0 +0 -13 +3 -13 +3 -10 +10 -10 +10 10 +-1 10 +-1 13 +-4 13 +-4 10 +-10 10 +-10 0 +12 +3 57 53 2 +0 0 +64 0 +64 18 +47 18 +47 39 +64 39 +64 60 +0 60 +0 44 +33 44 +33 30 +0 30 +0 diff --git a/codenet/public_test_cases/p01988/output.0.txt b/codenet/public_test_cases/p01988/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33280629d45d42f53ada4c621ad788fb72c9c09c --- /dev/null +++ b/codenet/public_test_cases/p01988/output.0.txt @@ -0,0 +1,3 @@ +1 +1 +2 diff --git a/codenet/public_test_cases/p01988/output.1.txt b/codenet/public_test_cases/p01988/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..33280629d45d42f53ada4c621ad788fb72c9c09c --- /dev/null +++ b/codenet/public_test_cases/p01988/output.1.txt @@ -0,0 +1,3 @@ +1 +1 +2 diff --git a/codenet/public_test_cases/p01989/input.0.txt b/codenet/public_test_cases/p01989/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28d14454c380441fa2b6f562072a1cd641c06e22 --- /dev/null +++ b/codenet/public_test_cases/p01989/input.0.txt @@ -0,0 +1 @@ +123456789 diff --git a/codenet/public_test_cases/p01989/input.1.txt b/codenet/public_test_cases/p01989/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28d14454c380441fa2b6f562072a1cd641c06e22 --- /dev/null +++ b/codenet/public_test_cases/p01989/input.1.txt @@ -0,0 +1 @@ +123456789 diff --git a/codenet/public_test_cases/p01989/output.0.txt b/codenet/public_test_cases/p01989/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01989/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01989/output.1.txt b/codenet/public_test_cases/p01989/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p01989/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p01990/input.0.txt b/codenet/public_test_cases/p01990/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0804e3f9a627efa7113c4058bdb3eeb03f9f96ee --- /dev/null +++ b/codenet/public_test_cases/p01990/input.0.txt @@ -0,0 +1,3 @@ +5 2 +1 5 3 2 4 +5 2 diff --git a/codenet/public_test_cases/p01990/input.1.txt b/codenet/public_test_cases/p01990/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0804e3f9a627efa7113c4058bdb3eeb03f9f96ee --- /dev/null +++ b/codenet/public_test_cases/p01990/input.1.txt @@ -0,0 +1,3 @@ +5 2 +1 5 3 2 4 +5 2 diff --git a/codenet/public_test_cases/p01990/output.0.txt b/codenet/public_test_cases/p01990/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14502ba49316818cc14b6ccf579f21d1c97855e7 --- /dev/null +++ b/codenet/public_test_cases/p01990/output.0.txt @@ -0,0 +1 @@ +4 5 1 2 3 diff --git a/codenet/public_test_cases/p01990/output.1.txt b/codenet/public_test_cases/p01990/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14502ba49316818cc14b6ccf579f21d1c97855e7 --- /dev/null +++ b/codenet/public_test_cases/p01990/output.1.txt @@ -0,0 +1 @@ +4 5 1 2 3 diff --git a/codenet/public_test_cases/p01991/input.0.txt b/codenet/public_test_cases/p01991/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..77e106f54611506bed3b1576669c71ead0e9a41d --- /dev/null +++ b/codenet/public_test_cases/p01991/input.0.txt @@ -0,0 +1,6 @@ +3 +1 2 +1 3 +2 3 +1 +1 3 diff --git a/codenet/public_test_cases/p01991/input.1.txt b/codenet/public_test_cases/p01991/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..77e106f54611506bed3b1576669c71ead0e9a41d --- /dev/null +++ b/codenet/public_test_cases/p01991/input.1.txt @@ -0,0 +1,6 @@ +3 +1 2 +1 3 +2 3 +1 +1 3 diff --git a/codenet/public_test_cases/p01991/output.0.txt b/codenet/public_test_cases/p01991/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01991/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01991/output.1.txt b/codenet/public_test_cases/p01991/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01991/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01992/input.0.txt b/codenet/public_test_cases/p01992/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..84812661be42cedfd3faa6f8d173c655bb5e3e80 --- /dev/null +++ b/codenet/public_test_cases/p01992/input.0.txt @@ -0,0 +1,8 @@ +7 +banana +at +tomb +bus +sound +does +some diff --git a/codenet/public_test_cases/p01992/input.1.txt b/codenet/public_test_cases/p01992/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..84812661be42cedfd3faa6f8d173c655bb5e3e80 --- /dev/null +++ b/codenet/public_test_cases/p01992/input.1.txt @@ -0,0 +1,8 @@ +7 +banana +at +tomb +bus +sound +does +some diff --git a/codenet/public_test_cases/p01992/output.0.txt b/codenet/public_test_cases/p01992/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01992/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01992/output.1.txt b/codenet/public_test_cases/p01992/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01992/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01993/input.0.txt b/codenet/public_test_cases/p01993/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8effaed246b81cb7d1c963523f5fa3220bc9b83a --- /dev/null +++ b/codenet/public_test_cases/p01993/input.0.txt @@ -0,0 +1,5 @@ +5 4 +1 2 1 +2 3 10 +3 4 5 +4 5 1 diff --git a/codenet/public_test_cases/p01993/input.1.txt b/codenet/public_test_cases/p01993/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8effaed246b81cb7d1c963523f5fa3220bc9b83a --- /dev/null +++ b/codenet/public_test_cases/p01993/input.1.txt @@ -0,0 +1,5 @@ +5 4 +1 2 1 +2 3 10 +3 4 5 +4 5 1 diff --git a/codenet/public_test_cases/p01993/output.0.txt b/codenet/public_test_cases/p01993/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p01993/output.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p01993/output.1.txt b/codenet/public_test_cases/p01993/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p01993/output.1.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p01994/input.0.txt b/codenet/public_test_cases/p01994/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e912ad99f9acdd1ff56e1e9e00ff342f68559fa --- /dev/null +++ b/codenet/public_test_cases/p01994/input.0.txt @@ -0,0 +1,5 @@ +4 +101 110 +101 101 +1010 1101 +11011001 10010101 diff --git a/codenet/public_test_cases/p01994/input.1.txt b/codenet/public_test_cases/p01994/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e912ad99f9acdd1ff56e1e9e00ff342f68559fa --- /dev/null +++ b/codenet/public_test_cases/p01994/input.1.txt @@ -0,0 +1,5 @@ +4 +101 110 +101 101 +1010 1101 +11011001 10010101 diff --git a/codenet/public_test_cases/p01994/output.0.txt b/codenet/public_test_cases/p01994/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..451b757a4b1e7c7d41f6882f1a8bc40ab9ea9d73 --- /dev/null +++ b/codenet/public_test_cases/p01994/output.0.txt @@ -0,0 +1,4 @@ +1 +0 +3 +12 diff --git a/codenet/public_test_cases/p01994/output.1.txt b/codenet/public_test_cases/p01994/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..451b757a4b1e7c7d41f6882f1a8bc40ab9ea9d73 --- /dev/null +++ b/codenet/public_test_cases/p01994/output.1.txt @@ -0,0 +1,4 @@ +1 +0 +3 +12 diff --git a/codenet/public_test_cases/p01995/input.0.txt b/codenet/public_test_cases/p01995/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca6a119d52b2c37dcefbcabfc1e4f32d3cea7b05 --- /dev/null +++ b/codenet/public_test_cases/p01995/input.0.txt @@ -0,0 +1 @@ +acpc diff --git a/codenet/public_test_cases/p01995/input.1.txt b/codenet/public_test_cases/p01995/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca6a119d52b2c37dcefbcabfc1e4f32d3cea7b05 --- /dev/null +++ b/codenet/public_test_cases/p01995/input.1.txt @@ -0,0 +1 @@ +acpc diff --git a/codenet/public_test_cases/p01995/output.0.txt b/codenet/public_test_cases/p01995/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01995/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01995/output.1.txt b/codenet/public_test_cases/p01995/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p01995/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p01996/input.0.txt b/codenet/public_test_cases/p01996/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..921024dbd576d2fff6b2d993e97d485d925d460f --- /dev/null +++ b/codenet/public_test_cases/p01996/input.0.txt @@ -0,0 +1,2 @@ +6 4 +1 4 5 6 diff --git a/codenet/public_test_cases/p01996/input.1.txt b/codenet/public_test_cases/p01996/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..921024dbd576d2fff6b2d993e97d485d925d460f --- /dev/null +++ b/codenet/public_test_cases/p01996/input.1.txt @@ -0,0 +1,2 @@ +6 4 +1 4 5 6 diff --git a/codenet/public_test_cases/p01996/output.0.txt b/codenet/public_test_cases/p01996/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01996/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01996/output.1.txt b/codenet/public_test_cases/p01996/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01996/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01997/input.0.txt b/codenet/public_test_cases/p01997/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p01997/input.0.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p01997/input.1.txt b/codenet/public_test_cases/p01997/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p01997/input.1.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p01997/output.0.txt b/codenet/public_test_cases/p01997/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d77555190c1dee19e5697129cdc93a55def6436 --- /dev/null +++ b/codenet/public_test_cases/p01997/output.0.txt @@ -0,0 +1 @@ +33.510322 diff --git a/codenet/public_test_cases/p01997/output.1.txt b/codenet/public_test_cases/p01997/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d77555190c1dee19e5697129cdc93a55def6436 --- /dev/null +++ b/codenet/public_test_cases/p01997/output.1.txt @@ -0,0 +1 @@ +33.510322 diff --git a/codenet/public_test_cases/p01998/input.0.txt b/codenet/public_test_cases/p01998/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01998/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01998/input.1.txt b/codenet/public_test_cases/p01998/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p01998/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p01998/output.0.txt b/codenet/public_test_cases/p01998/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01998/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p01998/output.1.txt b/codenet/public_test_cases/p01998/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p01998/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02000/input.0.txt b/codenet/public_test_cases/p02000/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p02000/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02000/input.1.txt b/codenet/public_test_cases/p02000/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p02000/input.1.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02000/output.0.txt b/codenet/public_test_cases/p02000/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02000/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02000/output.1.txt b/codenet/public_test_cases/p02000/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02000/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02001/input.0.txt b/codenet/public_test_cases/p02001/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e95bbca832aab21806003a48490ea707401029b2 --- /dev/null +++ b/codenet/public_test_cases/p02001/input.0.txt @@ -0,0 +1,3 @@ +8 +.oo.ooo. +o.o.oo.o diff --git a/codenet/public_test_cases/p02001/output.0.txt b/codenet/public_test_cases/p02001/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02001/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02002/input.0.txt b/codenet/public_test_cases/p02002/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1eede75290e754755205d93d600a0ab492347819 --- /dev/null +++ b/codenet/public_test_cases/p02002/input.0.txt @@ -0,0 +1,7 @@ +7 +9^2&1|2 +4 +0 6 +0 2 +2 6 +4 4 diff --git a/codenet/public_test_cases/p02002/input.1.txt b/codenet/public_test_cases/p02002/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1eede75290e754755205d93d600a0ab492347819 --- /dev/null +++ b/codenet/public_test_cases/p02002/input.1.txt @@ -0,0 +1,7 @@ +7 +9^2&1|2 +4 +0 6 +0 2 +2 6 +4 4 diff --git a/codenet/public_test_cases/p02002/output.0.txt b/codenet/public_test_cases/p02002/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0479fbbd284e1cae2cdb0935d23766d4b16be1bd --- /dev/null +++ b/codenet/public_test_cases/p02002/output.0.txt @@ -0,0 +1,4 @@ +3 +11 +2 +1 diff --git a/codenet/public_test_cases/p02002/output.1.txt b/codenet/public_test_cases/p02002/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0479fbbd284e1cae2cdb0935d23766d4b16be1bd --- /dev/null +++ b/codenet/public_test_cases/p02002/output.1.txt @@ -0,0 +1,4 @@ +3 +11 +2 +1 diff --git a/codenet/public_test_cases/p02003/input.0.txt b/codenet/public_test_cases/p02003/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb0c37ff4d10f39eb9ca6fa39140560104e13020 --- /dev/null +++ b/codenet/public_test_cases/p02003/input.0.txt @@ -0,0 +1,6 @@ +5 5 +..... +.#.#. +.###. +.#.#. +..... diff --git a/codenet/public_test_cases/p02003/input.1.txt b/codenet/public_test_cases/p02003/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb0c37ff4d10f39eb9ca6fa39140560104e13020 --- /dev/null +++ b/codenet/public_test_cases/p02003/input.1.txt @@ -0,0 +1,6 @@ +5 5 +..... +.#.#. +.###. +.#.#. +..... diff --git a/codenet/public_test_cases/p02003/output.0.txt b/codenet/public_test_cases/p02003/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02003/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02003/output.1.txt b/codenet/public_test_cases/p02003/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02003/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02004/input.0.txt b/codenet/public_test_cases/p02004/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7adb732195f5a907c64b0c66d77a828257658f1 --- /dev/null +++ b/codenet/public_test_cases/p02004/input.0.txt @@ -0,0 +1 @@ +RRRRLLLLRRRR diff --git a/codenet/public_test_cases/p02004/input.1.txt b/codenet/public_test_cases/p02004/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a271c90d4f590f3f806f6685c6e30e00cba8cff8 --- /dev/null +++ b/codenet/public_test_cases/p02004/input.1.txt @@ -0,0 +1 @@ +LR diff --git a/codenet/public_test_cases/p02004/input.2.txt b/codenet/public_test_cases/p02004/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7adb732195f5a907c64b0c66d77a828257658f1 --- /dev/null +++ b/codenet/public_test_cases/p02004/input.2.txt @@ -0,0 +1 @@ +RRRRLLLLRRRR diff --git a/codenet/public_test_cases/p02004/input.3.txt b/codenet/public_test_cases/p02004/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6fea62462b58b478d7322199ae2d265ee000407 --- /dev/null +++ b/codenet/public_test_cases/p02004/input.3.txt @@ -0,0 +1 @@ +RLLRLLLLRRRLLLRRR diff --git a/codenet/public_test_cases/p02004/input.4.txt b/codenet/public_test_cases/p02004/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5177fe9d37f89afa86bd2bd29983b6c16ff14921 --- /dev/null +++ b/codenet/public_test_cases/p02004/input.4.txt @@ -0,0 +1 @@ +RRLRRLRRRRLRRLRRRRLRRLRRRRLRRLRR diff --git a/codenet/public_test_cases/p02004/output.0.txt b/codenet/public_test_cases/p02004/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02004/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02004/output.1.txt b/codenet/public_test_cases/p02004/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02004/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02004/output.2.txt b/codenet/public_test_cases/p02004/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02004/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02004/output.3.txt b/codenet/public_test_cases/p02004/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02004/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02004/output.4.txt b/codenet/public_test_cases/p02004/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02004/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02005/input.0.txt b/codenet/public_test_cases/p02005/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ddfffe434af8243c169a1036ba19718cb48446a --- /dev/null +++ b/codenet/public_test_cases/p02005/input.0.txt @@ -0,0 +1,6 @@ +2 +white 20 +black 10 +2 +black +white diff --git a/codenet/public_test_cases/p02005/input.1.txt b/codenet/public_test_cases/p02005/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ddadf93a717e4678121d4aab50e7e63ce45915f --- /dev/null +++ b/codenet/public_test_cases/p02005/input.1.txt @@ -0,0 +1,6 @@ +2 +white 10 +black 10 +2 +black +white diff --git a/codenet/public_test_cases/p02005/input.2.txt b/codenet/public_test_cases/p02005/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..50c6b6f7bb119db57a0f8ee1d7161311121bdfa2 --- /dev/null +++ b/codenet/public_test_cases/p02005/input.2.txt @@ -0,0 +1,6 @@ +2 +white 20 +black 10 +2 +black +orange diff --git a/codenet/public_test_cases/p02005/input.3.txt b/codenet/public_test_cases/p02005/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ddfffe434af8243c169a1036ba19718cb48446a --- /dev/null +++ b/codenet/public_test_cases/p02005/input.3.txt @@ -0,0 +1,6 @@ +2 +white 20 +black 10 +2 +black +white diff --git a/codenet/public_test_cases/p02005/input.4.txt b/codenet/public_test_cases/p02005/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..42905c52d211f8c2c435e61e66c879abd83db94b --- /dev/null +++ b/codenet/public_test_cases/p02005/input.4.txt @@ -0,0 +1,10 @@ +4 +red 3444 +red 3018 +red 3098 +red 3319 +4 +red +red +red +red diff --git a/codenet/public_test_cases/p02005/input.5.txt b/codenet/public_test_cases/p02005/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b13bb364dde3f4d0c48390e3403f143109c3568c --- /dev/null +++ b/codenet/public_test_cases/p02005/input.5.txt @@ -0,0 +1,8 @@ +3 +white 10 +red 20 +white 30 +3 +white +red +white diff --git a/codenet/public_test_cases/p02005/output.0.txt b/codenet/public_test_cases/p02005/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02005/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02005/output.1.txt b/codenet/public_test_cases/p02005/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02005/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02005/output.2.txt b/codenet/public_test_cases/p02005/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02005/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02005/output.3.txt b/codenet/public_test_cases/p02005/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02005/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02005/output.4.txt b/codenet/public_test_cases/p02005/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02005/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02005/output.5.txt b/codenet/public_test_cases/p02005/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02005/output.5.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02006/input.0.txt b/codenet/public_test_cases/p02006/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..014593e0b7afcc6cfae2518fca70db27709903d8 --- /dev/null +++ b/codenet/public_test_cases/p02006/input.0.txt @@ -0,0 +1,4 @@ +6 3 2 +1 2 +2 10 +3 5 diff --git a/codenet/public_test_cases/p02006/input.1.txt b/codenet/public_test_cases/p02006/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..07f622177db488658e9a0ad8f4afc27048dddf93 --- /dev/null +++ b/codenet/public_test_cases/p02006/input.1.txt @@ -0,0 +1,2 @@ +1 1 2 +1 1 diff --git a/codenet/public_test_cases/p02006/input.2.txt b/codenet/public_test_cases/p02006/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..014593e0b7afcc6cfae2518fca70db27709903d8 --- /dev/null +++ b/codenet/public_test_cases/p02006/input.2.txt @@ -0,0 +1,4 @@ +6 3 2 +1 2 +2 10 +3 5 diff --git a/codenet/public_test_cases/p02006/input.3.txt b/codenet/public_test_cases/p02006/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb2c0a2fca3362e1258a86101bec7214c9e0a06d --- /dev/null +++ b/codenet/public_test_cases/p02006/input.3.txt @@ -0,0 +1,3 @@ +2 2 2 +1 1 +2 100 diff --git a/codenet/public_test_cases/p02006/input.4.txt b/codenet/public_test_cases/p02006/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5de94485d286e8b97147d6702e81c6db2ff7348d --- /dev/null +++ b/codenet/public_test_cases/p02006/input.4.txt @@ -0,0 +1,6 @@ +200 5 5 +31 41 +59 26 +53 58 +97 93 +23 84 diff --git a/codenet/public_test_cases/p02006/output.0.txt b/codenet/public_test_cases/p02006/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e57511324ad6c275763d40f3041b34ac66ddb234 --- /dev/null +++ b/codenet/public_test_cases/p02006/output.0.txt @@ -0,0 +1,2 @@ +17 +24 diff --git a/codenet/public_test_cases/p02006/output.1.txt b/codenet/public_test_cases/p02006/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b261da18d51a39dc2cf0d156791e9c0b35dd83f4 --- /dev/null +++ b/codenet/public_test_cases/p02006/output.1.txt @@ -0,0 +1,2 @@ +1 +0 diff --git a/codenet/public_test_cases/p02006/output.2.txt b/codenet/public_test_cases/p02006/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e57511324ad6c275763d40f3041b34ac66ddb234 --- /dev/null +++ b/codenet/public_test_cases/p02006/output.2.txt @@ -0,0 +1,2 @@ +17 +24 diff --git a/codenet/public_test_cases/p02006/output.3.txt b/codenet/public_test_cases/p02006/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e8b2a9105105dfa2eb665ec7f4f5f8b3ff699b4 --- /dev/null +++ b/codenet/public_test_cases/p02006/output.3.txt @@ -0,0 +1,2 @@ +100 +2 diff --git a/codenet/public_test_cases/p02006/output.4.txt b/codenet/public_test_cases/p02006/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..36058281c90aa7ff994f71a041ca706e4caeddf6 --- /dev/null +++ b/codenet/public_test_cases/p02006/output.4.txt @@ -0,0 +1,5 @@ +235 +284 +375 +336 +420 diff --git a/codenet/public_test_cases/p02007/input.0.txt b/codenet/public_test_cases/p02007/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..973cd06ba4ef554912ca4e596646b94eb0816ad4 --- /dev/null +++ b/codenet/public_test_cases/p02007/input.0.txt @@ -0,0 +1,14 @@ +6 7 +appreciate +appropriate +acceptance +ace +acm +acetylene +appr iate +a e +a a +ac ce +ace e +acceptance acceptance +no match diff --git a/codenet/public_test_cases/p02007/input.1.txt b/codenet/public_test_cases/p02007/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0331c5ae397ed4d73451ae2e3b85c6760960d540 --- /dev/null +++ b/codenet/public_test_cases/p02007/input.1.txt @@ -0,0 +1,12 @@ +7 4 +connected +disconnected +graph +directed +diameter +distance +minor +c ed +di ed +dis ed +dis e diff --git a/codenet/public_test_cases/p02007/input.2.txt b/codenet/public_test_cases/p02007/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..973cd06ba4ef554912ca4e596646b94eb0816ad4 --- /dev/null +++ b/codenet/public_test_cases/p02007/input.2.txt @@ -0,0 +1,14 @@ +6 7 +appreciate +appropriate +acceptance +ace +acm +acetylene +appr iate +a e +a a +ac ce +ace e +acceptance acceptance +no match diff --git a/codenet/public_test_cases/p02007/input.3.txt b/codenet/public_test_cases/p02007/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e649e82f05d62368f616e1a5d70e9943f54e09c7 --- /dev/null +++ b/codenet/public_test_cases/p02007/input.3.txt @@ -0,0 +1,11 @@ +5 5 +d +dd +ddd +dddd +ddddd +d d +dd dd +ddd ddd +d dddd +ddddd dd diff --git a/codenet/public_test_cases/p02007/output.0.txt b/codenet/public_test_cases/p02007/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee71cf4eabc6963ebd175b69028912fbb2f13da3 --- /dev/null +++ b/codenet/public_test_cases/p02007/output.0.txt @@ -0,0 +1,7 @@ +2 +5 +0 +2 +2 +1 +0 diff --git a/codenet/public_test_cases/p02007/output.1.txt b/codenet/public_test_cases/p02007/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..541800d03622ef1f5a9e133ccb79914e4190a8b2 --- /dev/null +++ b/codenet/public_test_cases/p02007/output.1.txt @@ -0,0 +1,4 @@ +1 +2 +1 +1 diff --git a/codenet/public_test_cases/p02007/output.2.txt b/codenet/public_test_cases/p02007/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee71cf4eabc6963ebd175b69028912fbb2f13da3 --- /dev/null +++ b/codenet/public_test_cases/p02007/output.2.txt @@ -0,0 +1,7 @@ +2 +5 +0 +2 +2 +1 +0 diff --git a/codenet/public_test_cases/p02007/output.3.txt b/codenet/public_test_cases/p02007/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..86e24d1b4c3fb30080acde6f9c98a24bac0d47c7 --- /dev/null +++ b/codenet/public_test_cases/p02007/output.3.txt @@ -0,0 +1,5 @@ +5 +4 +3 +2 +1 diff --git a/codenet/public_test_cases/p02008/input.0.txt b/codenet/public_test_cases/p02008/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28b024bf39671e0c6e72553d898da0ef3112659d --- /dev/null +++ b/codenet/public_test_cases/p02008/input.0.txt @@ -0,0 +1,3 @@ +2 +0 0 2 0 0 2 +0 1 2 1 0 3 diff --git a/codenet/public_test_cases/p02008/output.0.txt b/codenet/public_test_cases/p02008/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb3c4fe4eebcdea3da0790cc0ba74cb286ec4f4 --- /dev/null +++ b/codenet/public_test_cases/p02008/output.0.txt @@ -0,0 +1 @@ +0.5 diff --git a/codenet/public_test_cases/p02009/input.0.txt b/codenet/public_test_cases/p02009/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe234be093e7ad8424af41b8a2162a42d19b3e9 --- /dev/null +++ b/codenet/public_test_cases/p02009/input.0.txt @@ -0,0 +1,3 @@ +2 +1 +1 diff --git a/codenet/public_test_cases/p02009/input.1.txt b/codenet/public_test_cases/p02009/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe234be093e7ad8424af41b8a2162a42d19b3e9 --- /dev/null +++ b/codenet/public_test_cases/p02009/input.1.txt @@ -0,0 +1,3 @@ +2 +1 +1 diff --git a/codenet/public_test_cases/p02009/input.2.txt b/codenet/public_test_cases/p02009/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4396284e17ba3f2be10dac282ef14130323a69f8 --- /dev/null +++ b/codenet/public_test_cases/p02009/input.2.txt @@ -0,0 +1,11 @@ +10 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 diff --git a/codenet/public_test_cases/p02009/input.3.txt b/codenet/public_test_cases/p02009/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..74fc6f901f7e14b2a1243ec3e8ab6c3e49b438f6 --- /dev/null +++ b/codenet/public_test_cases/p02009/input.3.txt @@ -0,0 +1,6 @@ +5 +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02009/output.0.txt b/codenet/public_test_cases/p02009/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p02009/output.0.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p02009/output.1.txt b/codenet/public_test_cases/p02009/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p02009/output.1.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p02009/output.2.txt b/codenet/public_test_cases/p02009/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p02009/output.2.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p02009/output.3.txt b/codenet/public_test_cases/p02009/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p02009/output.3.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p02010/input.0.txt b/codenet/public_test_cases/p02010/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d0cf20b36ed28e22a1b510f52916dc8d4cd930a --- /dev/null +++ b/codenet/public_test_cases/p02010/input.0.txt @@ -0,0 +1,2 @@ +100 ++123 diff --git a/codenet/public_test_cases/p02010/input.1.txt b/codenet/public_test_cases/p02010/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c985da08482285ca3e4c3bebd0731456417bea12 --- /dev/null +++ b/codenet/public_test_cases/p02010/input.1.txt @@ -0,0 +1,2 @@ +2000 +1234++7890 diff --git a/codenet/public_test_cases/p02010/input.2.txt b/codenet/public_test_cases/p02010/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1eef2bdbf43387c17517ff47367e3607e3d890e --- /dev/null +++ b/codenet/public_test_cases/p02010/input.2.txt @@ -0,0 +1,2 @@ +1 ++123 diff --git a/codenet/public_test_cases/p02010/input.3.txt b/codenet/public_test_cases/p02010/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d0cf20b36ed28e22a1b510f52916dc8d4cd930a --- /dev/null +++ b/codenet/public_test_cases/p02010/input.3.txt @@ -0,0 +1,2 @@ +100 ++123 diff --git a/codenet/public_test_cases/p02010/input.4.txt b/codenet/public_test_cases/p02010/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ed1d97eb4b931e4056e6419e9834cf5a6a74c86 --- /dev/null +++ b/codenet/public_test_cases/p02010/input.4.txt @@ -0,0 +1,2 @@ +10 +++1+ diff --git a/codenet/public_test_cases/p02010/input.5.txt b/codenet/public_test_cases/p02010/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f47313862c765e17841dd5d4452880b73183151 --- /dev/null +++ b/codenet/public_test_cases/p02010/input.5.txt @@ -0,0 +1,2 @@ +10 ++123 diff --git a/codenet/public_test_cases/p02010/output.0.txt b/codenet/public_test_cases/p02010/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02010/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02010/output.1.txt b/codenet/public_test_cases/p02010/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02010/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02010/output.2.txt b/codenet/public_test_cases/p02010/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02010/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02010/output.3.txt b/codenet/public_test_cases/p02010/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02010/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02010/output.4.txt b/codenet/public_test_cases/p02010/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02010/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02010/output.5.txt b/codenet/public_test_cases/p02010/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02010/output.5.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02011/input.0.txt b/codenet/public_test_cases/p02011/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ab082cde1f681fccc83b258bf1ddc2a1e279a12 --- /dev/null +++ b/codenet/public_test_cases/p02011/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 +3 0 +5 0 diff --git a/codenet/public_test_cases/p02011/input.1.txt b/codenet/public_test_cases/p02011/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38decb33ce988fdaef4f4ceae9fea74bdf8c4465 --- /dev/null +++ b/codenet/public_test_cases/p02011/input.1.txt @@ -0,0 +1,10 @@ +9 +91 -18 +13 93 +73 -34 +15 2 +-46 0 +69 -42 +-23 -13 +-87 41 +38 68 diff --git a/codenet/public_test_cases/p02011/input.2.txt b/codenet/public_test_cases/p02011/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aef4659ccdd540056d91c44e305dfe62b3391e93 --- /dev/null +++ b/codenet/public_test_cases/p02011/input.2.txt @@ -0,0 +1,4 @@ +3 +0 0 +5 0 +0 5 diff --git a/codenet/public_test_cases/p02011/input.3.txt b/codenet/public_test_cases/p02011/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ab082cde1f681fccc83b258bf1ddc2a1e279a12 --- /dev/null +++ b/codenet/public_test_cases/p02011/input.3.txt @@ -0,0 +1,4 @@ +3 +0 0 +3 0 +5 0 diff --git a/codenet/public_test_cases/p02011/output.0.txt b/codenet/public_test_cases/p02011/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d8d8ad37c62f88fad82269c35d740aeba909cae --- /dev/null +++ b/codenet/public_test_cases/p02011/output.0.txt @@ -0,0 +1 @@ +31.415926535 diff --git a/codenet/public_test_cases/p02011/output.1.txt b/codenet/public_test_cases/p02011/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b447c1c10d5e45da1cfbf4d7eac80985c848000 --- /dev/null +++ b/codenet/public_test_cases/p02011/output.1.txt @@ -0,0 +1 @@ +1049.191683488 diff --git a/codenet/public_test_cases/p02011/output.2.txt b/codenet/public_test_cases/p02011/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0eb8de9e4060b04e3166c29ec2cc90ad5d08f40 --- /dev/null +++ b/codenet/public_test_cases/p02011/output.2.txt @@ -0,0 +1 @@ +53.630341225 diff --git a/codenet/public_test_cases/p02011/output.3.txt b/codenet/public_test_cases/p02011/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d8d8ad37c62f88fad82269c35d740aeba909cae --- /dev/null +++ b/codenet/public_test_cases/p02011/output.3.txt @@ -0,0 +1 @@ +31.415926535 diff --git a/codenet/public_test_cases/p02012/input.0.txt b/codenet/public_test_cases/p02012/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02012/input.0.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02012/input.1.txt b/codenet/public_test_cases/p02012/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02012/input.1.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02012/input.2.txt b/codenet/public_test_cases/p02012/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02012/input.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02012/input.3.txt b/codenet/public_test_cases/p02012/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02012/input.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02012/input.4.txt b/codenet/public_test_cases/p02012/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..bda2537a3f899ef4a5cd4ebb6c3e229b990388ea --- /dev/null +++ b/codenet/public_test_cases/p02012/input.4.txt @@ -0,0 +1 @@ +83160 diff --git a/codenet/public_test_cases/p02012/output.0.txt b/codenet/public_test_cases/p02012/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02012/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02012/output.1.txt b/codenet/public_test_cases/p02012/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02012/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02012/output.2.txt b/codenet/public_test_cases/p02012/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02012/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02012/output.3.txt b/codenet/public_test_cases/p02012/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02012/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02012/output.4.txt b/codenet/public_test_cases/p02012/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..52a00b0840bd79bb55b69bf0bf76185d6c40fbc1 --- /dev/null +++ b/codenet/public_test_cases/p02012/output.4.txt @@ -0,0 +1 @@ +5120 diff --git a/codenet/public_test_cases/p02013/input.0.txt b/codenet/public_test_cases/p02013/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e93e7df594a1e0a4dd00ffc9e645a6640ebab772 --- /dev/null +++ b/codenet/public_test_cases/p02013/input.0.txt @@ -0,0 +1,6 @@ +5 5 1 5 +1 2 +1 4 +2 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p02013/input.1.txt b/codenet/public_test_cases/p02013/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b70faef65de0024ffe8cabe8c1f3b1ccf7eae59 --- /dev/null +++ b/codenet/public_test_cases/p02013/input.1.txt @@ -0,0 +1,2 @@ +2 1 1 2 +1 2 diff --git a/codenet/public_test_cases/p02013/input.2.txt b/codenet/public_test_cases/p02013/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e93e7df594a1e0a4dd00ffc9e645a6640ebab772 --- /dev/null +++ b/codenet/public_test_cases/p02013/input.2.txt @@ -0,0 +1,6 @@ +5 5 1 5 +1 2 +1 4 +2 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p02013/input.3.txt b/codenet/public_test_cases/p02013/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c173650c0fd04ea9960402a1b4e828fdb163508 --- /dev/null +++ b/codenet/public_test_cases/p02013/input.3.txt @@ -0,0 +1,4 @@ +3 3 1 2 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p02013/input.4.txt b/codenet/public_test_cases/p02013/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5b3aae27630faa7946b484eedada16de7809583 --- /dev/null +++ b/codenet/public_test_cases/p02013/input.4.txt @@ -0,0 +1,5 @@ +5 4 1 5 +1 2 +2 3 +3 4 +4 5 diff --git a/codenet/public_test_cases/p02013/output.0.txt b/codenet/public_test_cases/p02013/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02013/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02013/output.1.txt b/codenet/public_test_cases/p02013/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02013/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02013/output.2.txt b/codenet/public_test_cases/p02013/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02013/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02013/output.3.txt b/codenet/public_test_cases/p02013/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02013/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02013/output.4.txt b/codenet/public_test_cases/p02013/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02013/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02014/input.0.txt b/codenet/public_test_cases/p02014/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45f04b2771b7d734df841d12bae487af04ff9c0b --- /dev/null +++ b/codenet/public_test_cases/p02014/input.0.txt @@ -0,0 +1,4 @@ +3 1 +3 +2 +1 diff --git a/codenet/public_test_cases/p02014/input.1.txt b/codenet/public_test_cases/p02014/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64db5debf99cf9f684d6a45ea99a34ebdf4ca443 --- /dev/null +++ b/codenet/public_test_cases/p02014/input.1.txt @@ -0,0 +1,4 @@ +3 100 +3 +2 +1 diff --git a/codenet/public_test_cases/p02014/input.2.txt b/codenet/public_test_cases/p02014/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45f04b2771b7d734df841d12bae487af04ff9c0b --- /dev/null +++ b/codenet/public_test_cases/p02014/input.2.txt @@ -0,0 +1,4 @@ +3 1 +3 +2 +1 diff --git a/codenet/public_test_cases/p02014/input.3.txt b/codenet/public_test_cases/p02014/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f8c7ad9c7a92163119712244c760f2c763c3292 --- /dev/null +++ b/codenet/public_test_cases/p02014/input.3.txt @@ -0,0 +1,6 @@ +5 3 +5 +3 +2 +1 +4 diff --git a/codenet/public_test_cases/p02014/input.4.txt b/codenet/public_test_cases/p02014/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bfeb828c7ca3577383c1352d06bb260066612ec --- /dev/null +++ b/codenet/public_test_cases/p02014/input.4.txt @@ -0,0 +1,6 @@ +5 3 +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02014/output.0.txt b/codenet/public_test_cases/p02014/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1d0ff9b7d7d46dd2db8d33c537cdb4bf7422851 --- /dev/null +++ b/codenet/public_test_cases/p02014/output.0.txt @@ -0,0 +1,3 @@ +1 +3 +2 diff --git a/codenet/public_test_cases/p02014/output.1.txt b/codenet/public_test_cases/p02014/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d6976f9b54866fa6afeb9080bfd843098f107bb --- /dev/null +++ b/codenet/public_test_cases/p02014/output.1.txt @@ -0,0 +1,3 @@ +3 +2 +1 diff --git a/codenet/public_test_cases/p02014/output.2.txt b/codenet/public_test_cases/p02014/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1d0ff9b7d7d46dd2db8d33c537cdb4bf7422851 --- /dev/null +++ b/codenet/public_test_cases/p02014/output.2.txt @@ -0,0 +1,3 @@ +1 +3 +2 diff --git a/codenet/public_test_cases/p02014/output.3.txt b/codenet/public_test_cases/p02014/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e38f68c59a663dfe363e0daa2315a993382f171 --- /dev/null +++ b/codenet/public_test_cases/p02014/output.3.txt @@ -0,0 +1,5 @@ +1 +3 +5 +2 +4 diff --git a/codenet/public_test_cases/p02014/output.4.txt b/codenet/public_test_cases/p02014/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a1218a1024a212bb3db30becd860315f9f3ac52 --- /dev/null +++ b/codenet/public_test_cases/p02014/output.4.txt @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02015/input.0.txt b/codenet/public_test_cases/p02015/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0136d90d2ddbba045c69e3554f79ed9898993e3 --- /dev/null +++ b/codenet/public_test_cases/p02015/input.0.txt @@ -0,0 +1 @@ +(No input) diff --git a/codenet/public_test_cases/p02015/output.0.txt b/codenet/public_test_cases/p02015/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce8f4ee8e8dfa828747c43a200aef6c0588f3999 --- /dev/null +++ b/codenet/public_test_cases/p02015/output.0.txt @@ -0,0 +1 @@ +Paken diff --git a/codenet/public_test_cases/p02016/input.0.txt b/codenet/public_test_cases/p02016/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dedec4d3750f5258221bbb38355f042bd7d9db2 --- /dev/null +++ b/codenet/public_test_cases/p02016/input.0.txt @@ -0,0 +1 @@ +ani diff --git a/codenet/public_test_cases/p02016/input.1.txt b/codenet/public_test_cases/p02016/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dedec4d3750f5258221bbb38355f042bd7d9db2 --- /dev/null +++ b/codenet/public_test_cases/p02016/input.1.txt @@ -0,0 +1 @@ +ani diff --git a/codenet/public_test_cases/p02016/output.0.txt b/codenet/public_test_cases/p02016/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1a7d7819be759a3d46a02b36a306d15be79ce8b --- /dev/null +++ b/codenet/public_test_cases/p02016/output.0.txt @@ -0,0 +1 @@ +square1001 diff --git a/codenet/public_test_cases/p02016/output.1.txt b/codenet/public_test_cases/p02016/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1a7d7819be759a3d46a02b36a306d15be79ce8b --- /dev/null +++ b/codenet/public_test_cases/p02016/output.1.txt @@ -0,0 +1 @@ +square1001 diff --git a/codenet/public_test_cases/p02017/input.0.txt b/codenet/public_test_cases/p02017/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7545bbcedfe41aead40e423af5f8235b8e2c25e8 --- /dev/null +++ b/codenet/public_test_cases/p02017/input.0.txt @@ -0,0 +1 @@ +3 5 1 4 diff --git a/codenet/public_test_cases/p02017/input.1.txt b/codenet/public_test_cases/p02017/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7545bbcedfe41aead40e423af5f8235b8e2c25e8 --- /dev/null +++ b/codenet/public_test_cases/p02017/input.1.txt @@ -0,0 +1 @@ +3 5 1 4 diff --git a/codenet/public_test_cases/p02017/output.0.txt b/codenet/public_test_cases/p02017/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02017/output.0.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02017/output.1.txt b/codenet/public_test_cases/p02017/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02017/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02018/input.0.txt b/codenet/public_test_cases/p02018/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d30c9fd6dec8ce0c4bc489e2bd9d008b71443d2b --- /dev/null +++ b/codenet/public_test_cases/p02018/input.0.txt @@ -0,0 +1,2 @@ +5 +4 3 5 2 6 diff --git a/codenet/public_test_cases/p02018/input.1.txt b/codenet/public_test_cases/p02018/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d30c9fd6dec8ce0c4bc489e2bd9d008b71443d2b --- /dev/null +++ b/codenet/public_test_cases/p02018/input.1.txt @@ -0,0 +1,2 @@ +5 +4 3 5 2 6 diff --git a/codenet/public_test_cases/p02018/output.0.txt b/codenet/public_test_cases/p02018/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02018/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02018/output.1.txt b/codenet/public_test_cases/p02018/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02018/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02019/input.0.txt b/codenet/public_test_cases/p02019/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4088780bb744201fe48df9e0c63465b4911b66be --- /dev/null +++ b/codenet/public_test_cases/p02019/input.0.txt @@ -0,0 +1 @@ +6 3 2 1 diff --git a/codenet/public_test_cases/p02019/input.1.txt b/codenet/public_test_cases/p02019/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4088780bb744201fe48df9e0c63465b4911b66be --- /dev/null +++ b/codenet/public_test_cases/p02019/input.1.txt @@ -0,0 +1 @@ +6 3 2 1 diff --git a/codenet/public_test_cases/p02019/output.0.txt b/codenet/public_test_cases/p02019/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02019/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02019/output.1.txt b/codenet/public_test_cases/p02019/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02019/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02020/input.0.txt b/codenet/public_test_cases/p02020/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91c3508acfe84d227d59ed0428587f625b3f8d7e --- /dev/null +++ b/codenet/public_test_cases/p02020/input.0.txt @@ -0,0 +1,2 @@ +5 +2 3 5 6 7 diff --git a/codenet/public_test_cases/p02020/input.1.txt b/codenet/public_test_cases/p02020/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91c3508acfe84d227d59ed0428587f625b3f8d7e --- /dev/null +++ b/codenet/public_test_cases/p02020/input.1.txt @@ -0,0 +1,2 @@ +5 +2 3 5 6 7 diff --git a/codenet/public_test_cases/p02020/output.0.txt b/codenet/public_test_cases/p02020/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02020/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02020/output.1.txt b/codenet/public_test_cases/p02020/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02020/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02021/input.0.txt b/codenet/public_test_cases/p02021/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..594941d1930cc7104f304f8d073505172ae22b93 --- /dev/null +++ b/codenet/public_test_cases/p02021/input.0.txt @@ -0,0 +1,2 @@ +5 +4 2 5 3 1 diff --git a/codenet/public_test_cases/p02021/input.1.txt b/codenet/public_test_cases/p02021/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..594941d1930cc7104f304f8d073505172ae22b93 --- /dev/null +++ b/codenet/public_test_cases/p02021/input.1.txt @@ -0,0 +1,2 @@ +5 +4 2 5 3 1 diff --git a/codenet/public_test_cases/p02021/output.0.txt b/codenet/public_test_cases/p02021/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02021/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02021/output.1.txt b/codenet/public_test_cases/p02021/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02021/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02022/input.0.txt b/codenet/public_test_cases/p02022/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31d6a80986275f4ac95b36f3087876b9e3d84461 --- /dev/null +++ b/codenet/public_test_cases/p02022/input.0.txt @@ -0,0 +1,3 @@ +3 2 +3 1 5 +2 4 diff --git a/codenet/public_test_cases/p02022/input.1.txt b/codenet/public_test_cases/p02022/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31d6a80986275f4ac95b36f3087876b9e3d84461 --- /dev/null +++ b/codenet/public_test_cases/p02022/input.1.txt @@ -0,0 +1,3 @@ +3 2 +3 1 5 +2 4 diff --git a/codenet/public_test_cases/p02022/output.0.txt b/codenet/public_test_cases/p02022/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb1e7bc86996a80d4a16529b990adda1d3434c92 --- /dev/null +++ b/codenet/public_test_cases/p02022/output.0.txt @@ -0,0 +1 @@ +54 diff --git a/codenet/public_test_cases/p02022/output.1.txt b/codenet/public_test_cases/p02022/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb1e7bc86996a80d4a16529b990adda1d3434c92 --- /dev/null +++ b/codenet/public_test_cases/p02022/output.1.txt @@ -0,0 +1 @@ +54 diff --git a/codenet/public_test_cases/p02023/input.0.txt b/codenet/public_test_cases/p02023/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b07af5eda2ae01b6a8b08f54441ff3b291646c8 --- /dev/null +++ b/codenet/public_test_cases/p02023/input.0.txt @@ -0,0 +1,5 @@ +4 +1 4 +3 6 +2 7 +5 8 diff --git a/codenet/public_test_cases/p02023/input.1.txt b/codenet/public_test_cases/p02023/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b07af5eda2ae01b6a8b08f54441ff3b291646c8 --- /dev/null +++ b/codenet/public_test_cases/p02023/input.1.txt @@ -0,0 +1,5 @@ +4 +1 4 +3 6 +2 7 +5 8 diff --git a/codenet/public_test_cases/p02023/output.0.txt b/codenet/public_test_cases/p02023/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02023/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02023/output.1.txt b/codenet/public_test_cases/p02023/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02023/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02024/input.0.txt b/codenet/public_test_cases/p02024/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ccb39e49f5b766ea3dd111a618e37efdae4122d --- /dev/null +++ b/codenet/public_test_cases/p02024/input.0.txt @@ -0,0 +1 @@ +4 5 2 3 diff --git a/codenet/public_test_cases/p02024/input.1.txt b/codenet/public_test_cases/p02024/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ccb39e49f5b766ea3dd111a618e37efdae4122d --- /dev/null +++ b/codenet/public_test_cases/p02024/input.1.txt @@ -0,0 +1 @@ +4 5 2 3 diff --git a/codenet/public_test_cases/p02024/output.0.txt b/codenet/public_test_cases/p02024/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02024/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02024/output.1.txt b/codenet/public_test_cases/p02024/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02024/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02025/input.0.txt b/codenet/public_test_cases/p02025/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b56a27fd8cdb7e824a788fd7fc8f465a71b3173c --- /dev/null +++ b/codenet/public_test_cases/p02025/input.0.txt @@ -0,0 +1,3 @@ +2 2 +1 2 +4 8 diff --git a/codenet/public_test_cases/p02025/input.1.txt b/codenet/public_test_cases/p02025/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b56a27fd8cdb7e824a788fd7fc8f465a71b3173c --- /dev/null +++ b/codenet/public_test_cases/p02025/input.1.txt @@ -0,0 +1,3 @@ +2 2 +1 2 +4 8 diff --git a/codenet/public_test_cases/p02025/output.0.txt b/codenet/public_test_cases/p02025/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p02025/output.0.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p02025/output.1.txt b/codenet/public_test_cases/p02025/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p02025/output.1.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p02026/input.0.txt b/codenet/public_test_cases/p02026/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e3514ace0bd016839ade74e8b165f3e841c295 --- /dev/null +++ b/codenet/public_test_cases/p02026/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 5 +6 3 4 diff --git a/codenet/public_test_cases/p02026/input.1.txt b/codenet/public_test_cases/p02026/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e3514ace0bd016839ade74e8b165f3e841c295 --- /dev/null +++ b/codenet/public_test_cases/p02026/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 5 +6 3 4 diff --git a/codenet/public_test_cases/p02026/output.0.txt b/codenet/public_test_cases/p02026/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4539bbf2d22d5c3b4227859ff854eda060a687fb --- /dev/null +++ b/codenet/public_test_cases/p02026/output.0.txt @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/codenet/public_test_cases/p02026/output.1.txt b/codenet/public_test_cases/p02026/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4539bbf2d22d5c3b4227859ff854eda060a687fb --- /dev/null +++ b/codenet/public_test_cases/p02026/output.1.txt @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/codenet/public_test_cases/p02027/input.0.txt b/codenet/public_test_cases/p02027/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0dc5f67e18feaa8ac385a23e46b2594040b228c --- /dev/null +++ b/codenet/public_test_cases/p02027/input.0.txt @@ -0,0 +1 @@ +6 3 diff --git a/codenet/public_test_cases/p02027/input.1.txt b/codenet/public_test_cases/p02027/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0dc5f67e18feaa8ac385a23e46b2594040b228c --- /dev/null +++ b/codenet/public_test_cases/p02027/input.1.txt @@ -0,0 +1 @@ +6 3 diff --git a/codenet/public_test_cases/p02027/output.0.txt b/codenet/public_test_cases/p02027/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02027/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02027/output.1.txt b/codenet/public_test_cases/p02027/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02027/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02028/input.0.txt b/codenet/public_test_cases/p02028/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dee28b4c39b2da756eb3a7fded1ed3fa94817588 --- /dev/null +++ b/codenet/public_test_cases/p02028/input.0.txt @@ -0,0 +1,3 @@ +2 2 +1 5 +1 5 diff --git a/codenet/public_test_cases/p02028/input.1.txt b/codenet/public_test_cases/p02028/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dee28b4c39b2da756eb3a7fded1ed3fa94817588 --- /dev/null +++ b/codenet/public_test_cases/p02028/input.1.txt @@ -0,0 +1,3 @@ +2 2 +1 5 +1 5 diff --git a/codenet/public_test_cases/p02028/output.0.txt b/codenet/public_test_cases/p02028/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02028/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02028/output.1.txt b/codenet/public_test_cases/p02028/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02028/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02029/input.0.txt b/codenet/public_test_cases/p02029/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..72b4010b48201eb1cd800dde67b6743239b59b23 --- /dev/null +++ b/codenet/public_test_cases/p02029/input.0.txt @@ -0,0 +1,5 @@ +3 1 +10 1 +20 2 +30 3 +20 2 diff --git a/codenet/public_test_cases/p02029/input.1.txt b/codenet/public_test_cases/p02029/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..72b4010b48201eb1cd800dde67b6743239b59b23 --- /dev/null +++ b/codenet/public_test_cases/p02029/input.1.txt @@ -0,0 +1,5 @@ +3 1 +10 1 +20 2 +30 3 +20 2 diff --git a/codenet/public_test_cases/p02029/output.0.txt b/codenet/public_test_cases/p02029/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02029/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02029/output.1.txt b/codenet/public_test_cases/p02029/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02029/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02030/input.0.txt b/codenet/public_test_cases/p02030/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..39e00534dcddbf133b7371afd3124990caaf7d55 --- /dev/null +++ b/codenet/public_test_cases/p02030/input.0.txt @@ -0,0 +1,3 @@ +4 4 +1 2 4 9 +1 3 4 7 diff --git a/codenet/public_test_cases/p02030/input.1.txt b/codenet/public_test_cases/p02030/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..39e00534dcddbf133b7371afd3124990caaf7d55 --- /dev/null +++ b/codenet/public_test_cases/p02030/input.1.txt @@ -0,0 +1,3 @@ +4 4 +1 2 4 9 +1 3 4 7 diff --git a/codenet/public_test_cases/p02030/output.0.txt b/codenet/public_test_cases/p02030/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c244a0c140e7b8f82bfd81c9d599ffc38c20a122 --- /dev/null +++ b/codenet/public_test_cases/p02030/output.0.txt @@ -0,0 +1,9 @@ +2 6 +1 +4 +1 +2 +3 +4 +7 +9 diff --git a/codenet/public_test_cases/p02030/output.1.txt b/codenet/public_test_cases/p02030/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c244a0c140e7b8f82bfd81c9d599ffc38c20a122 --- /dev/null +++ b/codenet/public_test_cases/p02030/output.1.txt @@ -0,0 +1,9 @@ +2 6 +1 +4 +1 +2 +3 +4 +7 +9 diff --git a/codenet/public_test_cases/p02031/input.0.txt b/codenet/public_test_cases/p02031/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cd4f58526b6a547080920f1f04b3d3a58b80b1 --- /dev/null +++ b/codenet/public_test_cases/p02031/input.0.txt @@ -0,0 +1,2 @@ +2 +2 1 diff --git a/codenet/public_test_cases/p02031/input.1.txt b/codenet/public_test_cases/p02031/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cd4f58526b6a547080920f1f04b3d3a58b80b1 --- /dev/null +++ b/codenet/public_test_cases/p02031/input.1.txt @@ -0,0 +1,2 @@ +2 +2 1 diff --git a/codenet/public_test_cases/p02031/output.0.txt b/codenet/public_test_cases/p02031/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbb2ed7bd9e0c917fd90e69d3401e6ebf43f30c4 --- /dev/null +++ b/codenet/public_test_cases/p02031/output.0.txt @@ -0,0 +1 @@ +(()) diff --git a/codenet/public_test_cases/p02031/output.1.txt b/codenet/public_test_cases/p02031/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbb2ed7bd9e0c917fd90e69d3401e6ebf43f30c4 --- /dev/null +++ b/codenet/public_test_cases/p02031/output.1.txt @@ -0,0 +1 @@ +(()) diff --git a/codenet/public_test_cases/p02032/input.0.txt b/codenet/public_test_cases/p02032/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p02032/input.0.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p02032/input.1.txt b/codenet/public_test_cases/p02032/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p02032/input.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p02032/output.0.txt b/codenet/public_test_cases/p02032/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p02032/output.0.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p02032/output.1.txt b/codenet/public_test_cases/p02032/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p02032/output.1.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p02033/input.0.txt b/codenet/public_test_cases/p02033/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e17e785b8970b1b37e35ffb038da934bdeb445d1 --- /dev/null +++ b/codenet/public_test_cases/p02033/input.0.txt @@ -0,0 +1,4 @@ +5 1 +2 +1 +3 diff --git a/codenet/public_test_cases/p02033/input.1.txt b/codenet/public_test_cases/p02033/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e17e785b8970b1b37e35ffb038da934bdeb445d1 --- /dev/null +++ b/codenet/public_test_cases/p02033/input.1.txt @@ -0,0 +1,4 @@ +5 1 +2 +1 +3 diff --git a/codenet/public_test_cases/p02033/output.0.txt b/codenet/public_test_cases/p02033/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02033/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02033/output.1.txt b/codenet/public_test_cases/p02033/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02033/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02034/input.0.txt b/codenet/public_test_cases/p02034/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1e3e0dd5fbbc7920d224570facaaf24bb20a434 --- /dev/null +++ b/codenet/public_test_cases/p02034/input.0.txt @@ -0,0 +1,2 @@ +6 +tabata diff --git a/codenet/public_test_cases/p02034/input.1.txt b/codenet/public_test_cases/p02034/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1e3e0dd5fbbc7920d224570facaaf24bb20a434 --- /dev/null +++ b/codenet/public_test_cases/p02034/input.1.txt @@ -0,0 +1,2 @@ +6 +tabata diff --git a/codenet/public_test_cases/p02034/output.0.txt b/codenet/public_test_cases/p02034/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02034/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02034/output.1.txt b/codenet/public_test_cases/p02034/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02034/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02035/input.0.txt b/codenet/public_test_cases/p02035/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23a8eb5f27366159dc5eb22b5fac6f27ce4b0442 --- /dev/null +++ b/codenet/public_test_cases/p02035/input.0.txt @@ -0,0 +1 @@ +3 310779401 diff --git a/codenet/public_test_cases/p02035/input.1.txt b/codenet/public_test_cases/p02035/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..23a8eb5f27366159dc5eb22b5fac6f27ce4b0442 --- /dev/null +++ b/codenet/public_test_cases/p02035/input.1.txt @@ -0,0 +1 @@ +3 310779401 diff --git a/codenet/public_test_cases/p02035/output.0.txt b/codenet/public_test_cases/p02035/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02035/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02035/output.1.txt b/codenet/public_test_cases/p02035/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02035/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02036/input.0.txt b/codenet/public_test_cases/p02036/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0f2456f302d06ba159811dab43bc6e12cd68a5b --- /dev/null +++ b/codenet/public_test_cases/p02036/input.0.txt @@ -0,0 +1 @@ +3 1000000007 diff --git a/codenet/public_test_cases/p02036/input.1.txt b/codenet/public_test_cases/p02036/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0f2456f302d06ba159811dab43bc6e12cd68a5b --- /dev/null +++ b/codenet/public_test_cases/p02036/input.1.txt @@ -0,0 +1 @@ +3 1000000007 diff --git a/codenet/public_test_cases/p02036/output.0.txt b/codenet/public_test_cases/p02036/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad03f7c5a871d69ea237b7ad0cbff1b20d6db654 --- /dev/null +++ b/codenet/public_test_cases/p02036/output.0.txt @@ -0,0 +1 @@ +204 diff --git a/codenet/public_test_cases/p02036/output.1.txt b/codenet/public_test_cases/p02036/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad03f7c5a871d69ea237b7ad0cbff1b20d6db654 --- /dev/null +++ b/codenet/public_test_cases/p02036/output.1.txt @@ -0,0 +1 @@ +204 diff --git a/codenet/public_test_cases/p02037/input.0.txt b/codenet/public_test_cases/p02037/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fed9e9547de525ca746d1560bed315243e013d4 --- /dev/null +++ b/codenet/public_test_cases/p02037/input.0.txt @@ -0,0 +1,2 @@ +5 8 +2 2 diff --git a/codenet/public_test_cases/p02037/input.1.txt b/codenet/public_test_cases/p02037/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fed9e9547de525ca746d1560bed315243e013d4 --- /dev/null +++ b/codenet/public_test_cases/p02037/input.1.txt @@ -0,0 +1,2 @@ +5 8 +2 2 diff --git a/codenet/public_test_cases/p02037/output.0.txt b/codenet/public_test_cases/p02037/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02037/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02037/output.1.txt b/codenet/public_test_cases/p02037/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02037/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02038/input.0.txt b/codenet/public_test_cases/p02038/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..39956e29a91b3936f0fb2eab7d1889ce90107e77 --- /dev/null +++ b/codenet/public_test_cases/p02038/input.0.txt @@ -0,0 +1,2 @@ +3 +F T T diff --git a/codenet/public_test_cases/p02038/input.1.txt b/codenet/public_test_cases/p02038/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..39956e29a91b3936f0fb2eab7d1889ce90107e77 --- /dev/null +++ b/codenet/public_test_cases/p02038/input.1.txt @@ -0,0 +1,2 @@ +3 +F T T diff --git a/codenet/public_test_cases/p02038/output.0.txt b/codenet/public_test_cases/p02038/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62a6e3c9dfcb5f2a009cb85d9562145c1ea803a1 --- /dev/null +++ b/codenet/public_test_cases/p02038/output.0.txt @@ -0,0 +1 @@ +T diff --git a/codenet/public_test_cases/p02038/output.1.txt b/codenet/public_test_cases/p02038/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..62a6e3c9dfcb5f2a009cb85d9562145c1ea803a1 --- /dev/null +++ b/codenet/public_test_cases/p02038/output.1.txt @@ -0,0 +1 @@ +T diff --git a/codenet/public_test_cases/p02039/input.0.txt b/codenet/public_test_cases/p02039/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..884e65584ad93655393d4a9ef0c3c591dce2cfd5 --- /dev/null +++ b/codenet/public_test_cases/p02039/input.0.txt @@ -0,0 +1,4 @@ +3 +1 1 8 8 +2 4 3 8 +8 8 8 8 diff --git a/codenet/public_test_cases/p02039/input.1.txt b/codenet/public_test_cases/p02039/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..884e65584ad93655393d4a9ef0c3c591dce2cfd5 --- /dev/null +++ b/codenet/public_test_cases/p02039/input.1.txt @@ -0,0 +1,4 @@ +3 +1 1 8 8 +2 4 3 8 +8 8 8 8 diff --git a/codenet/public_test_cases/p02039/output.0.txt b/codenet/public_test_cases/p02039/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa17b9e207e7878ac5f573a3fdb1d0a68ff851db --- /dev/null +++ b/codenet/public_test_cases/p02039/output.0.txt @@ -0,0 +1,3 @@ +48 +7 +1 diff --git a/codenet/public_test_cases/p02039/output.1.txt b/codenet/public_test_cases/p02039/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa17b9e207e7878ac5f573a3fdb1d0a68ff851db --- /dev/null +++ b/codenet/public_test_cases/p02039/output.1.txt @@ -0,0 +1,3 @@ +48 +7 +1 diff --git a/codenet/public_test_cases/p02041/input.0.txt b/codenet/public_test_cases/p02041/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32b8523fd5758096a2fd201252978b73e02c89a7 --- /dev/null +++ b/codenet/public_test_cases/p02041/input.0.txt @@ -0,0 +1,2 @@ +4 +6 4 7 8 diff --git a/codenet/public_test_cases/p02041/input.1.txt b/codenet/public_test_cases/p02041/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32b8523fd5758096a2fd201252978b73e02c89a7 --- /dev/null +++ b/codenet/public_test_cases/p02041/input.1.txt @@ -0,0 +1,2 @@ +4 +6 4 7 8 diff --git a/codenet/public_test_cases/p02041/output.0.txt b/codenet/public_test_cases/p02041/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p02041/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p02041/output.1.txt b/codenet/public_test_cases/p02041/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p02041/output.1.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p02042/input.0.txt b/codenet/public_test_cases/p02042/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25cb906735e5d6375a274d55932cfecc15245194 --- /dev/null +++ b/codenet/public_test_cases/p02042/input.0.txt @@ -0,0 +1,2 @@ +5 2 +0 3 2 1 4 diff --git a/codenet/public_test_cases/p02042/input.1.txt b/codenet/public_test_cases/p02042/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..25cb906735e5d6375a274d55932cfecc15245194 --- /dev/null +++ b/codenet/public_test_cases/p02042/input.1.txt @@ -0,0 +1,2 @@ +5 2 +0 3 2 1 4 diff --git a/codenet/public_test_cases/p02042/output.0.txt b/codenet/public_test_cases/p02042/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02042/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02042/output.1.txt b/codenet/public_test_cases/p02042/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02042/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02043/input.0.txt b/codenet/public_test_cases/p02043/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ac1fe3c17752020ea5a1328faf7ca4bc83f9946 --- /dev/null +++ b/codenet/public_test_cases/p02043/input.0.txt @@ -0,0 +1,5 @@ +4 4 10 +100 100 100 100 +100 100 100 100 +1 100 100 1 +1 1 1 1 diff --git a/codenet/public_test_cases/p02043/input.1.txt b/codenet/public_test_cases/p02043/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ac1fe3c17752020ea5a1328faf7ca4bc83f9946 --- /dev/null +++ b/codenet/public_test_cases/p02043/input.1.txt @@ -0,0 +1,5 @@ +4 4 10 +100 100 100 100 +100 100 100 100 +1 100 100 1 +1 1 1 1 diff --git a/codenet/public_test_cases/p02043/output.0.txt b/codenet/public_test_cases/p02043/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e59798702d1dcb2edfd785bda32bc90386f95e56 --- /dev/null +++ b/codenet/public_test_cases/p02043/output.0.txt @@ -0,0 +1 @@ +970 diff --git a/codenet/public_test_cases/p02043/output.1.txt b/codenet/public_test_cases/p02043/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e59798702d1dcb2edfd785bda32bc90386f95e56 --- /dev/null +++ b/codenet/public_test_cases/p02043/output.1.txt @@ -0,0 +1 @@ +970 diff --git a/codenet/public_test_cases/p02044/input.0.txt b/codenet/public_test_cases/p02044/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a21e7576401a4592e7fc10feb4684170b944fe4a --- /dev/null +++ b/codenet/public_test_cases/p02044/input.0.txt @@ -0,0 +1,9 @@ +3 300 +120 100 80 +3 30 +10 20 5 +4 1000 +100 200 300 400 +5 5 +2523 8430 3 4199 632 +0 0 diff --git a/codenet/public_test_cases/p02044/input.1.txt b/codenet/public_test_cases/p02044/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a21e7576401a4592e7fc10feb4684170b944fe4a --- /dev/null +++ b/codenet/public_test_cases/p02044/input.1.txt @@ -0,0 +1,9 @@ +3 300 +120 100 80 +3 30 +10 20 5 +4 1000 +100 200 300 400 +5 5 +2523 8430 3 4199 632 +0 0 diff --git a/codenet/public_test_cases/p02044/output.0.txt b/codenet/public_test_cases/p02044/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13eb37ea517c3e21e677b930cb1ae7ccb270f92f --- /dev/null +++ b/codenet/public_test_cases/p02044/output.0.txt @@ -0,0 +1,4 @@ +280 +25 +800 +5 diff --git a/codenet/public_test_cases/p02044/output.1.txt b/codenet/public_test_cases/p02044/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..13eb37ea517c3e21e677b930cb1ae7ccb270f92f --- /dev/null +++ b/codenet/public_test_cases/p02044/output.1.txt @@ -0,0 +1,4 @@ +280 +25 +800 +5 diff --git a/codenet/public_test_cases/p02045/input.0.txt b/codenet/public_test_cases/p02045/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..71280256376401f16fb941b0b6eac09a67c1a285 --- /dev/null +++ b/codenet/public_test_cases/p02045/input.0.txt @@ -0,0 +1,14 @@ +2 +3 3 5 7 +3 3 +7 3 +7 7 +5 +1 10 100 10 +1 1 +100 1 +50 20 +50 80 +51 21 +51 1 +0 diff --git a/codenet/public_test_cases/p02045/input.1.txt b/codenet/public_test_cases/p02045/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..71280256376401f16fb941b0b6eac09a67c1a285 --- /dev/null +++ b/codenet/public_test_cases/p02045/input.1.txt @@ -0,0 +1,14 @@ +2 +3 3 5 7 +3 3 +7 3 +7 7 +5 +1 10 100 10 +1 1 +100 1 +50 20 +50 80 +51 21 +51 1 +0 diff --git a/codenet/public_test_cases/p02045/output.0.txt b/codenet/public_test_cases/p02045/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa79327f23a2277c309348db26beaa579e24f277 --- /dev/null +++ b/codenet/public_test_cases/p02045/output.0.txt @@ -0,0 +1,2 @@ +5 +174 diff --git a/codenet/public_test_cases/p02045/output.1.txt b/codenet/public_test_cases/p02045/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa79327f23a2277c309348db26beaa579e24f277 --- /dev/null +++ b/codenet/public_test_cases/p02045/output.1.txt @@ -0,0 +1,2 @@ +5 +174 diff --git a/codenet/public_test_cases/p02046/input.0.txt b/codenet/public_test_cases/p02046/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2e7415a3b335be482fe7a279df8070663801157 --- /dev/null +++ b/codenet/public_test_cases/p02046/input.0.txt @@ -0,0 +1,6 @@ +2 0 +2 2 +1 -1 +0 0 +0 -5 +173 207 diff --git a/codenet/public_test_cases/p02046/output.0.txt b/codenet/public_test_cases/p02046/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b16dc6e5cd6b18157b016a61f0166c68753779d2 --- /dev/null +++ b/codenet/public_test_cases/p02046/output.0.txt @@ -0,0 +1,6 @@ +2 +4 +1 +0 +6 +379 diff --git a/codenet/public_test_cases/p02047/input.0.txt b/codenet/public_test_cases/p02047/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2788348474bfdded1dec9d36445937a3e345670 --- /dev/null +++ b/codenet/public_test_cases/p02047/input.0.txt @@ -0,0 +1,25 @@ +typewriter +periodicity +100010 +100100 +101000 +110000 +periodicity +typewriter +100010 +100100 +101000 +110000 +periodicity +typewriter +100010 +100100 +101000 +1 +domestic +contest +100010 +100100 +101000 +110000 +# diff --git a/codenet/public_test_cases/p02047/input.1.txt b/codenet/public_test_cases/p02047/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2788348474bfdded1dec9d36445937a3e345670 --- /dev/null +++ b/codenet/public_test_cases/p02047/input.1.txt @@ -0,0 +1,25 @@ +typewriter +periodicity +100010 +100100 +101000 +110000 +periodicity +typewriter +100010 +100100 +101000 +110000 +periodicity +typewriter +100010 +100100 +101000 +1 +domestic +contest +100010 +100100 +101000 +110000 +# diff --git a/codenet/public_test_cases/p02047/output.0.txt b/codenet/public_test_cases/p02047/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..088e3075c8e54249d785dd86d36d9110eac70e84 --- /dev/null +++ b/codenet/public_test_cases/p02047/output.0.txt @@ -0,0 +1,4 @@ +823120 +1001540 +603217 +502210 diff --git a/codenet/public_test_cases/p02047/output.1.txt b/codenet/public_test_cases/p02047/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..088e3075c8e54249d785dd86d36d9110eac70e84 --- /dev/null +++ b/codenet/public_test_cases/p02047/output.1.txt @@ -0,0 +1,4 @@ +823120 +1001540 +603217 +502210 diff --git a/codenet/public_test_cases/p02048/input.0.txt b/codenet/public_test_cases/p02048/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..119087754121592a3d4ebb50ea2763bfac375108 --- /dev/null +++ b/codenet/public_test_cases/p02048/input.0.txt @@ -0,0 +1,26 @@ +3 3 +1 2 3 +2 1 3 +3 3 3 +8 5 +3 3 4 3 4 +2 1 2 3 2 +7 9 7 8 7 +3 4 3 3 4 +1 2 2 3 2 +4 5 6 5 6 +7 9 7 7 8 +4 5 5 6 6 +5 5 +1 2 3 4 5 +2 3 4 5 1 +3 4 5 1 2 +4 5 1 2 3 +5 1 2 3 4 +5 9 +1 1 1 1 1 1 1 1 1 +2 2 2 2 2 2 2 2 2 +3 3 3 3 3 3 3 3 3 +4 4 4 4 4 4 4 4 4 +5 5 5 5 5 5 5 5 5 +0 0 diff --git a/codenet/public_test_cases/p02048/input.1.txt b/codenet/public_test_cases/p02048/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..119087754121592a3d4ebb50ea2763bfac375108 --- /dev/null +++ b/codenet/public_test_cases/p02048/input.1.txt @@ -0,0 +1,26 @@ +3 3 +1 2 3 +2 1 3 +3 3 3 +8 5 +3 3 4 3 4 +2 1 2 3 2 +7 9 7 8 7 +3 4 3 3 4 +1 2 2 3 2 +4 5 6 5 6 +7 9 7 7 8 +4 5 5 6 6 +5 5 +1 2 3 4 5 +2 3 4 5 1 +3 4 5 1 2 +4 5 1 2 3 +5 1 2 3 4 +5 9 +1 1 1 1 1 1 1 1 1 +2 2 2 2 2 2 2 2 2 +3 3 3 3 3 3 3 3 3 +4 4 4 4 4 4 4 4 4 +5 5 5 5 5 5 5 5 5 +0 0 diff --git a/codenet/public_test_cases/p02048/output.0.txt b/codenet/public_test_cases/p02048/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b46c96795ef8d543a7e92dd8df57743a34f71372 --- /dev/null +++ b/codenet/public_test_cases/p02048/output.0.txt @@ -0,0 +1,4 @@ +2 +3 +1 +9 diff --git a/codenet/public_test_cases/p02048/output.1.txt b/codenet/public_test_cases/p02048/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b46c96795ef8d543a7e92dd8df57743a34f71372 --- /dev/null +++ b/codenet/public_test_cases/p02048/output.1.txt @@ -0,0 +1,4 @@ +2 +3 +1 +9 diff --git a/codenet/public_test_cases/p02049/input.0.txt b/codenet/public_test_cases/p02049/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..790bd32c6f315001009593d51170f958fb77ddcb --- /dev/null +++ b/codenet/public_test_cases/p02049/input.0.txt @@ -0,0 +1,7 @@ +MI2(2SI)2PI +ISSI +100(100(JAG)) +JAG +1000000000000000000A +AAAAA +# diff --git a/codenet/public_test_cases/p02049/input.1.txt b/codenet/public_test_cases/p02049/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..790bd32c6f315001009593d51170f958fb77ddcb --- /dev/null +++ b/codenet/public_test_cases/p02049/input.1.txt @@ -0,0 +1,7 @@ +MI2(2SI)2PI +ISSI +100(100(JAG)) +JAG +1000000000000000000A +AAAAA +# diff --git a/codenet/public_test_cases/p02049/output.0.txt b/codenet/public_test_cases/p02049/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..136066d774039a683a84be81e588d608e5e3a076 --- /dev/null +++ b/codenet/public_test_cases/p02049/output.0.txt @@ -0,0 +1,3 @@ +2 +10000 +999999999999999996 diff --git a/codenet/public_test_cases/p02049/output.1.txt b/codenet/public_test_cases/p02049/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..136066d774039a683a84be81e588d608e5e3a076 --- /dev/null +++ b/codenet/public_test_cases/p02049/output.1.txt @@ -0,0 +1,3 @@ +2 +10000 +999999999999999996 diff --git a/codenet/public_test_cases/p02050/input.0.txt b/codenet/public_test_cases/p02050/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be6c7c47a304fd4443bcb67fb0804fa150ed69c8 --- /dev/null +++ b/codenet/public_test_cases/p02050/input.0.txt @@ -0,0 +1,25 @@ +5 2 +1 1 +1 4 +2 2 +3 1 +3 5 +3 1 +0 2 +1 0 +-1 0 +3 2 +0 2 +1 0 +-1 0 +9 10 +8 1 +9 19 +2 10 +1 1 +4 17 +7 13 +3 4 +6 13 +9 21 +0 0 diff --git a/codenet/public_test_cases/p02050/input.1.txt b/codenet/public_test_cases/p02050/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..be6c7c47a304fd4443bcb67fb0804fa150ed69c8 --- /dev/null +++ b/codenet/public_test_cases/p02050/input.1.txt @@ -0,0 +1,25 @@ +5 2 +1 1 +1 4 +2 2 +3 1 +3 5 +3 1 +0 2 +1 0 +-1 0 +3 2 +0 2 +1 0 +-1 0 +9 10 +8 1 +9 19 +2 10 +1 1 +4 17 +7 13 +3 4 +6 13 +9 21 +0 0 diff --git a/codenet/public_test_cases/p02050/output.0.txt b/codenet/public_test_cases/p02050/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d5975542342d07222b7004168665bbea799ace5 --- /dev/null +++ b/codenet/public_test_cases/p02050/output.0.txt @@ -0,0 +1,4 @@ +11.812559200041266 +6.472135954999580 +-1 +52.202878812480016 diff --git a/codenet/public_test_cases/p02050/output.1.txt b/codenet/public_test_cases/p02050/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d5975542342d07222b7004168665bbea799ace5 --- /dev/null +++ b/codenet/public_test_cases/p02050/output.1.txt @@ -0,0 +1,4 @@ +11.812559200041266 +6.472135954999580 +-1 +52.202878812480016 diff --git a/codenet/public_test_cases/p02051/input.0.txt b/codenet/public_test_cases/p02051/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9222961375745e76c2bee54f85459e7ff2191 --- /dev/null +++ b/codenet/public_test_cases/p02051/input.0.txt @@ -0,0 +1,38 @@ +4 9 +1 2 1 +1 2 2 +1 3 1 +1 3 2 +1 3 3 +2 3 1 +2 3 2 +1 4 1 +3 4 2 +8 +1 5 +2 5 +3 5 +4 5 +1 1234567 +2 1234567 +3 1234567 +4 1234567 +4 8 +1 2 1 +1 2 1 +1 2 3 +3 4 3 +1 4 2 +2 4 1 +2 4 3 +2 4 3 +8 +1 3 +2 6 +3 8 +4 12 +1 31415926 +2 53589793 +3 23846 +4 26433832 +0 0 diff --git a/codenet/public_test_cases/p02051/input.1.txt b/codenet/public_test_cases/p02051/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9222961375745e76c2bee54f85459e7ff2191 --- /dev/null +++ b/codenet/public_test_cases/p02051/input.1.txt @@ -0,0 +1,38 @@ +4 9 +1 2 1 +1 2 2 +1 3 1 +1 3 2 +1 3 3 +2 3 1 +2 3 2 +1 4 1 +3 4 2 +8 +1 5 +2 5 +3 5 +4 5 +1 1234567 +2 1234567 +3 1234567 +4 1234567 +4 8 +1 2 1 +1 2 1 +1 2 3 +3 4 3 +1 4 2 +2 4 1 +2 4 3 +2 4 3 +8 +1 3 +2 6 +3 8 +4 12 +1 31415926 +2 53589793 +3 23846 +4 26433832 +0 0 diff --git a/codenet/public_test_cases/p02051/output.0.txt b/codenet/public_test_cases/p02051/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e4d505e54fb58bbf45f72b3749052778f15c1e --- /dev/null +++ b/codenet/public_test_cases/p02051/output.0.txt @@ -0,0 +1,16 @@ +1 +9 +37 +21 +1 +2469133 +307629943 +60012504 +1 +16 +0 +424 +1 +160769377 +0 +43581113 diff --git a/codenet/public_test_cases/p02051/output.1.txt b/codenet/public_test_cases/p02051/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e4d505e54fb58bbf45f72b3749052778f15c1e --- /dev/null +++ b/codenet/public_test_cases/p02051/output.1.txt @@ -0,0 +1,16 @@ +1 +9 +37 +21 +1 +2469133 +307629943 +60012504 +1 +16 +0 +424 +1 +160769377 +0 +43581113 diff --git a/codenet/public_test_cases/p02052/input.0.txt b/codenet/public_test_cases/p02052/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5aed2bdafbfa171ee8b7339b16b16d23442a029 --- /dev/null +++ b/codenet/public_test_cases/p02052/input.0.txt @@ -0,0 +1,4 @@ +3 3 +B.B +..B +.BB diff --git a/codenet/public_test_cases/p02052/input.1.txt b/codenet/public_test_cases/p02052/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5aed2bdafbfa171ee8b7339b16b16d23442a029 --- /dev/null +++ b/codenet/public_test_cases/p02052/input.1.txt @@ -0,0 +1,4 @@ +3 3 +B.B +..B +.BB diff --git a/codenet/public_test_cases/p02052/output.0.txt b/codenet/public_test_cases/p02052/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02052/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02052/output.1.txt b/codenet/public_test_cases/p02052/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02052/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02053/input.0.txt b/codenet/public_test_cases/p02053/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5aed2bdafbfa171ee8b7339b16b16d23442a029 --- /dev/null +++ b/codenet/public_test_cases/p02053/input.0.txt @@ -0,0 +1,4 @@ +3 3 +B.B +..B +.BB diff --git a/codenet/public_test_cases/p02053/input.1.txt b/codenet/public_test_cases/p02053/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5aed2bdafbfa171ee8b7339b16b16d23442a029 --- /dev/null +++ b/codenet/public_test_cases/p02053/input.1.txt @@ -0,0 +1,4 @@ +3 3 +B.B +..B +.BB diff --git a/codenet/public_test_cases/p02053/output.0.txt b/codenet/public_test_cases/p02053/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02053/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02053/output.1.txt b/codenet/public_test_cases/p02053/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02053/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02054/input.0.txt b/codenet/public_test_cases/p02054/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ab67d044361595c506dd20b08e62e48d27e3422 --- /dev/null +++ b/codenet/public_test_cases/p02054/input.0.txt @@ -0,0 +1 @@ +1 1 10 diff --git a/codenet/public_test_cases/p02054/input.1.txt b/codenet/public_test_cases/p02054/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ab67d044361595c506dd20b08e62e48d27e3422 --- /dev/null +++ b/codenet/public_test_cases/p02054/input.1.txt @@ -0,0 +1 @@ +1 1 10 diff --git a/codenet/public_test_cases/p02054/output.0.txt b/codenet/public_test_cases/p02054/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..486fae5587174b2ea71fb160cba85931005604b7 --- /dev/null +++ b/codenet/public_test_cases/p02054/output.0.txt @@ -0,0 +1 @@ +Hom diff --git a/codenet/public_test_cases/p02054/output.1.txt b/codenet/public_test_cases/p02054/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..486fae5587174b2ea71fb160cba85931005604b7 --- /dev/null +++ b/codenet/public_test_cases/p02054/output.1.txt @@ -0,0 +1 @@ +Hom diff --git a/codenet/public_test_cases/p02055/input.0.txt b/codenet/public_test_cases/p02055/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2acf95554bf070f8c772d281919b47ff80b4fc3 --- /dev/null +++ b/codenet/public_test_cases/p02055/input.0.txt @@ -0,0 +1,2 @@ +3 2 +1 3 2 diff --git a/codenet/public_test_cases/p02055/input.1.txt b/codenet/public_test_cases/p02055/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2acf95554bf070f8c772d281919b47ff80b4fc3 --- /dev/null +++ b/codenet/public_test_cases/p02055/input.1.txt @@ -0,0 +1,2 @@ +3 2 +1 3 2 diff --git a/codenet/public_test_cases/p02055/output.0.txt b/codenet/public_test_cases/p02055/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02055/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02055/output.1.txt b/codenet/public_test_cases/p02055/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02055/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02056/input.0.txt b/codenet/public_test_cases/p02056/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37dc4815e473cd2dbcacd750f0bf7a43632c8606 --- /dev/null +++ b/codenet/public_test_cases/p02056/input.0.txt @@ -0,0 +1,8 @@ +4 4 3 +3 6 1 6 +1 1 2 3 +6 1 5 5 +1 2 1 +2 3 1 +1 3 1 +1 4 1 diff --git a/codenet/public_test_cases/p02056/input.1.txt b/codenet/public_test_cases/p02056/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37dc4815e473cd2dbcacd750f0bf7a43632c8606 --- /dev/null +++ b/codenet/public_test_cases/p02056/input.1.txt @@ -0,0 +1,8 @@ +4 4 3 +3 6 1 6 +1 1 2 3 +6 1 5 5 +1 2 1 +2 3 1 +1 3 1 +1 4 1 diff --git a/codenet/public_test_cases/p02056/output.0.txt b/codenet/public_test_cases/p02056/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d4a7ed065380652036cd70f2932c8d17c5b08f7 --- /dev/null +++ b/codenet/public_test_cases/p02056/output.0.txt @@ -0,0 +1,3 @@ +10 +8 +9 diff --git a/codenet/public_test_cases/p02056/output.1.txt b/codenet/public_test_cases/p02056/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d4a7ed065380652036cd70f2932c8d17c5b08f7 --- /dev/null +++ b/codenet/public_test_cases/p02056/output.1.txt @@ -0,0 +1,3 @@ +10 +8 +9 diff --git a/codenet/public_test_cases/p02057/input.0.txt b/codenet/public_test_cases/p02057/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f3af26e2fc2d40976b6f549a551b2c092211dab --- /dev/null +++ b/codenet/public_test_cases/p02057/input.0.txt @@ -0,0 +1,3 @@ +3 3 +5 1 6 +2 3 4 diff --git a/codenet/public_test_cases/p02057/input.1.txt b/codenet/public_test_cases/p02057/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f3af26e2fc2d40976b6f549a551b2c092211dab --- /dev/null +++ b/codenet/public_test_cases/p02057/input.1.txt @@ -0,0 +1,3 @@ +3 3 +5 1 6 +2 3 4 diff --git a/codenet/public_test_cases/p02057/output.0.txt b/codenet/public_test_cases/p02057/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02057/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02057/output.1.txt b/codenet/public_test_cases/p02057/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02057/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02058/input.0.txt b/codenet/public_test_cases/p02058/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2df73e53c6f553fdd9759d55214b313a800ca8a8 --- /dev/null +++ b/codenet/public_test_cases/p02058/input.0.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02058/input.1.txt b/codenet/public_test_cases/p02058/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2df73e53c6f553fdd9759d55214b313a800ca8a8 --- /dev/null +++ b/codenet/public_test_cases/p02058/input.1.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02058/output.0.txt b/codenet/public_test_cases/p02058/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02058/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02058/output.1.txt b/codenet/public_test_cases/p02058/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02058/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02059/input.0.txt b/codenet/public_test_cases/p02059/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f1f02a598d9f3ccd487555126b986f5628c8c08 --- /dev/null +++ b/codenet/public_test_cases/p02059/input.0.txt @@ -0,0 +1 @@ +?MG? diff --git a/codenet/public_test_cases/p02059/input.1.txt b/codenet/public_test_cases/p02059/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f1f02a598d9f3ccd487555126b986f5628c8c08 --- /dev/null +++ b/codenet/public_test_cases/p02059/input.1.txt @@ -0,0 +1 @@ +?MG? diff --git a/codenet/public_test_cases/p02059/output.0.txt b/codenet/public_test_cases/p02059/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02059/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02059/output.1.txt b/codenet/public_test_cases/p02059/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02059/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02060/input.0.txt b/codenet/public_test_cases/p02060/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4db62e04623d028731b6ad7f65de3428a40ba393 --- /dev/null +++ b/codenet/public_test_cases/p02060/input.0.txt @@ -0,0 +1,3 @@ +10 +1 2 3 4 +1 2 4 8 diff --git a/codenet/public_test_cases/p02060/input.1.txt b/codenet/public_test_cases/p02060/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4db62e04623d028731b6ad7f65de3428a40ba393 --- /dev/null +++ b/codenet/public_test_cases/p02060/input.1.txt @@ -0,0 +1,3 @@ +10 +1 2 3 4 +1 2 4 8 diff --git a/codenet/public_test_cases/p02060/output.0.txt b/codenet/public_test_cases/p02060/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02060/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02060/output.1.txt b/codenet/public_test_cases/p02060/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02060/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02061/input.0.txt b/codenet/public_test_cases/p02061/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de797c246343c556e36ed631c2f93dca1b586a9d --- /dev/null +++ b/codenet/public_test_cases/p02061/input.0.txt @@ -0,0 +1,4 @@ +3 +43 +9 +24 diff --git a/codenet/public_test_cases/p02061/input.1.txt b/codenet/public_test_cases/p02061/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de797c246343c556e36ed631c2f93dca1b586a9d --- /dev/null +++ b/codenet/public_test_cases/p02061/input.1.txt @@ -0,0 +1,4 @@ +3 +43 +9 +24 diff --git a/codenet/public_test_cases/p02061/output.0.txt b/codenet/public_test_cases/p02061/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a422a0a88b53c86b27b1d5362863fc11ad296b1 --- /dev/null +++ b/codenet/public_test_cases/p02061/output.0.txt @@ -0,0 +1,3 @@ +11 +0 +5 diff --git a/codenet/public_test_cases/p02061/output.1.txt b/codenet/public_test_cases/p02061/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a422a0a88b53c86b27b1d5362863fc11ad296b1 --- /dev/null +++ b/codenet/public_test_cases/p02061/output.1.txt @@ -0,0 +1,3 @@ +11 +0 +5 diff --git a/codenet/public_test_cases/p02062/input.0.txt b/codenet/public_test_cases/p02062/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd08883455f5f592fb244bc693e4380701b2d851 --- /dev/null +++ b/codenet/public_test_cases/p02062/input.0.txt @@ -0,0 +1 @@ +?&?|?&?|?&? diff --git a/codenet/public_test_cases/p02062/input.1.txt b/codenet/public_test_cases/p02062/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd08883455f5f592fb244bc693e4380701b2d851 --- /dev/null +++ b/codenet/public_test_cases/p02062/input.1.txt @@ -0,0 +1 @@ +?&?|?&?|?&? diff --git a/codenet/public_test_cases/p02062/output.0.txt b/codenet/public_test_cases/p02062/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02062/output.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02062/output.1.txt b/codenet/public_test_cases/p02062/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02062/output.1.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02063/input.0.txt b/codenet/public_test_cases/p02063/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9290688fa7995d643a841e69083fc3f1316a0ef8 --- /dev/null +++ b/codenet/public_test_cases/p02063/input.0.txt @@ -0,0 +1 @@ +4 6 diff --git a/codenet/public_test_cases/p02063/input.1.txt b/codenet/public_test_cases/p02063/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9290688fa7995d643a841e69083fc3f1316a0ef8 --- /dev/null +++ b/codenet/public_test_cases/p02063/input.1.txt @@ -0,0 +1 @@ +4 6 diff --git a/codenet/public_test_cases/p02063/output.0.txt b/codenet/public_test_cases/p02063/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02063/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02063/output.1.txt b/codenet/public_test_cases/p02063/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02063/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02064/input.1.txt b/codenet/public_test_cases/p02064/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02064/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02064/output.1.txt b/codenet/public_test_cases/p02064/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02064/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02065/input.0.txt b/codenet/public_test_cases/p02065/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fe8599ef7865c23e1e83d128bb28f15bc028c04 --- /dev/null +++ b/codenet/public_test_cases/p02065/input.0.txt @@ -0,0 +1 @@ +3 2 7 diff --git a/codenet/public_test_cases/p02065/input.1.txt b/codenet/public_test_cases/p02065/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fe8599ef7865c23e1e83d128bb28f15bc028c04 --- /dev/null +++ b/codenet/public_test_cases/p02065/input.1.txt @@ -0,0 +1 @@ +3 2 7 diff --git a/codenet/public_test_cases/p02065/output.0.txt b/codenet/public_test_cases/p02065/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02065/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02065/output.1.txt b/codenet/public_test_cases/p02065/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02065/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02066/input.0.txt b/codenet/public_test_cases/p02066/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eb07f261121e4c88b1d67de7c6ece90c4ccc5ea --- /dev/null +++ b/codenet/public_test_cases/p02066/input.0.txt @@ -0,0 +1,4 @@ +3 10 +6 8 2 +1 2 3 +2 3 8 diff --git a/codenet/public_test_cases/p02066/input.1.txt b/codenet/public_test_cases/p02066/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eb07f261121e4c88b1d67de7c6ece90c4ccc5ea --- /dev/null +++ b/codenet/public_test_cases/p02066/input.1.txt @@ -0,0 +1,4 @@ +3 10 +6 8 2 +1 2 3 +2 3 8 diff --git a/codenet/public_test_cases/p02066/output.0.txt b/codenet/public_test_cases/p02066/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02066/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02066/output.1.txt b/codenet/public_test_cases/p02066/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02066/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02067/input.1.txt b/codenet/public_test_cases/p02067/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02067/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02067/output.1.txt b/codenet/public_test_cases/p02067/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02067/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02068/input.1.txt b/codenet/public_test_cases/p02068/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02068/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02068/output.1.txt b/codenet/public_test_cases/p02068/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02068/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02069/input.1.txt b/codenet/public_test_cases/p02069/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02069/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02069/output.1.txt b/codenet/public_test_cases/p02069/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02069/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02070/input.1.txt b/codenet/public_test_cases/p02070/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02070/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02070/output.1.txt b/codenet/public_test_cases/p02070/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02070/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02071/input.1.txt b/codenet/public_test_cases/p02071/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02071/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02071/output.1.txt b/codenet/public_test_cases/p02071/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02071/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02072/input.1.txt b/codenet/public_test_cases/p02072/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02072/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02072/output.1.txt b/codenet/public_test_cases/p02072/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02072/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02074/input.1.txt b/codenet/public_test_cases/p02074/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02074/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02074/output.1.txt b/codenet/public_test_cases/p02074/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02074/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02076/input.1.txt b/codenet/public_test_cases/p02076/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02076/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02076/output.1.txt b/codenet/public_test_cases/p02076/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02076/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02077/input.1.txt b/codenet/public_test_cases/p02077/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02077/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02077/output.1.txt b/codenet/public_test_cases/p02077/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02077/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02078/input.0.txt b/codenet/public_test_cases/p02078/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f1978611d62395b4987164a275afb0cdc379e92 --- /dev/null +++ b/codenet/public_test_cases/p02078/input.0.txt @@ -0,0 +1,4 @@ +3 +2 1 +3 2 +1 3 diff --git a/codenet/public_test_cases/p02078/output.0.txt b/codenet/public_test_cases/p02078/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02078/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02079/input.0.txt b/codenet/public_test_cases/p02079/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c9b5fca352569f60bb38dbf790b362822e4ec59 --- /dev/null +++ b/codenet/public_test_cases/p02079/input.0.txt @@ -0,0 +1,7 @@ +5 6 1 4 2 3 +1 2 +2 3 +3 4 +4 5 +3 5 +1 5 diff --git a/codenet/public_test_cases/p02079/output.0.txt b/codenet/public_test_cases/p02079/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02079/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02080/input.0.txt b/codenet/public_test_cases/p02080/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ffdbb0355169696571b64f577254ea313c16461 --- /dev/null +++ b/codenet/public_test_cases/p02080/input.0.txt @@ -0,0 +1,4 @@ +3 +dea +xxx +abcd diff --git a/codenet/public_test_cases/p02080/output.0.txt b/codenet/public_test_cases/p02080/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02080/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02081/input.0.txt b/codenet/public_test_cases/p02081/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d33f03a034d66f1bcd1aecce926b70a14a4db8c --- /dev/null +++ b/codenet/public_test_cases/p02081/input.0.txt @@ -0,0 +1,5 @@ +2 +0 +1 +0 +1 diff --git a/codenet/public_test_cases/p02081/output.0.txt b/codenet/public_test_cases/p02081/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02081/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02082/input.0.txt b/codenet/public_test_cases/p02082/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18c3fb4b8fef1460323d4af41a678a71221cbccb --- /dev/null +++ b/codenet/public_test_cases/p02082/input.0.txt @@ -0,0 +1,3 @@ +0 15656 +3 7 13333 +0 diff --git a/codenet/public_test_cases/p02082/output.0.txt b/codenet/public_test_cases/p02082/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13584a95e8750ba03c3805c31ff9f0bf76362d1d --- /dev/null +++ b/codenet/public_test_cases/p02082/output.0.txt @@ -0,0 +1 @@ +15656 diff --git a/codenet/public_test_cases/p02083/input.0.txt b/codenet/public_test_cases/p02083/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2414f130ec6707a3a94d1f7dea80c12976bc3f34 --- /dev/null +++ b/codenet/public_test_cases/p02083/input.0.txt @@ -0,0 +1,2 @@ +2 1 +2 1 2 diff --git a/codenet/public_test_cases/p02083/output.0.txt b/codenet/public_test_cases/p02083/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02083/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02084/input.0.txt b/codenet/public_test_cases/p02084/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62a25f87bc9da4028b89e7ded07e26079166518f --- /dev/null +++ b/codenet/public_test_cases/p02084/input.0.txt @@ -0,0 +1,2 @@ +1 +0 500000 diff --git a/codenet/public_test_cases/p02084/output.0.txt b/codenet/public_test_cases/p02084/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02084/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02085/input.0.txt b/codenet/public_test_cases/p02085/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02085/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02085/output.0.txt b/codenet/public_test_cases/p02085/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02085/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02086/input.0.txt b/codenet/public_test_cases/p02086/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..065c23b3ec93bba6ef4f54c16003f8ed6af64d94 --- /dev/null +++ b/codenet/public_test_cases/p02086/input.0.txt @@ -0,0 +1,3 @@ +zaki +o +4 diff --git a/codenet/public_test_cases/p02086/output.0.txt b/codenet/public_test_cases/p02086/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02086/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02087/input.0.txt b/codenet/public_test_cases/p02087/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p02087/input.0.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p02087/output.0.txt b/codenet/public_test_cases/p02087/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02087/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02088/input.0.txt b/codenet/public_test_cases/p02088/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37b6ba6423995c21922acd59b5e9f66bb6c3822c --- /dev/null +++ b/codenet/public_test_cases/p02088/input.0.txt @@ -0,0 +1,2 @@ +3 +4 5 6 diff --git a/codenet/public_test_cases/p02088/input.1.txt b/codenet/public_test_cases/p02088/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37b6ba6423995c21922acd59b5e9f66bb6c3822c --- /dev/null +++ b/codenet/public_test_cases/p02088/input.1.txt @@ -0,0 +1,2 @@ +3 +4 5 6 diff --git a/codenet/public_test_cases/p02088/output.0.txt b/codenet/public_test_cases/p02088/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02088/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02088/output.1.txt b/codenet/public_test_cases/p02088/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02088/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02089/input.0.txt b/codenet/public_test_cases/p02089/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fad9caf8edb8cc4f6f7b398b0647bd6e5750a1d1 --- /dev/null +++ b/codenet/public_test_cases/p02089/input.0.txt @@ -0,0 +1,5 @@ +3 3 3 10 +1 -2 3 +1 2 2 3 +2 20 1 3 +2 1 20 5 diff --git a/codenet/public_test_cases/p02089/input.1.txt b/codenet/public_test_cases/p02089/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fad9caf8edb8cc4f6f7b398b0647bd6e5750a1d1 --- /dev/null +++ b/codenet/public_test_cases/p02089/input.1.txt @@ -0,0 +1,5 @@ +3 3 3 10 +1 -2 3 +1 2 2 3 +2 20 1 3 +2 1 20 5 diff --git a/codenet/public_test_cases/p02089/output.0.txt b/codenet/public_test_cases/p02089/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02089/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02089/output.1.txt b/codenet/public_test_cases/p02089/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02089/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02090/input.0.txt b/codenet/public_test_cases/p02090/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5ee783881f7f9410e769d18cdfa6498878df44b --- /dev/null +++ b/codenet/public_test_cases/p02090/input.0.txt @@ -0,0 +1,2 @@ +1 3 +1 2 diff --git a/codenet/public_test_cases/p02090/input.1.txt b/codenet/public_test_cases/p02090/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5ee783881f7f9410e769d18cdfa6498878df44b --- /dev/null +++ b/codenet/public_test_cases/p02090/input.1.txt @@ -0,0 +1,2 @@ +1 3 +1 2 diff --git a/codenet/public_test_cases/p02090/output.0.txt b/codenet/public_test_cases/p02090/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02090/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02090/output.1.txt b/codenet/public_test_cases/p02090/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02090/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02091/input.0.txt b/codenet/public_test_cases/p02091/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3327d98b06c3479303f045f8826f9a126f02e846 --- /dev/null +++ b/codenet/public_test_cases/p02091/input.0.txt @@ -0,0 +1 @@ +2 6 1 5 diff --git a/codenet/public_test_cases/p02091/input.1.txt b/codenet/public_test_cases/p02091/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3327d98b06c3479303f045f8826f9a126f02e846 --- /dev/null +++ b/codenet/public_test_cases/p02091/input.1.txt @@ -0,0 +1 @@ +2 6 1 5 diff --git a/codenet/public_test_cases/p02091/output.0.txt b/codenet/public_test_cases/p02091/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1479e8964e6230d8daa250f319e64cdbf08fc67f --- /dev/null +++ b/codenet/public_test_cases/p02091/output.0.txt @@ -0,0 +1,2 @@ +Yes +0 3 4 7 diff --git a/codenet/public_test_cases/p02091/output.1.txt b/codenet/public_test_cases/p02091/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1479e8964e6230d8daa250f319e64cdbf08fc67f --- /dev/null +++ b/codenet/public_test_cases/p02091/output.1.txt @@ -0,0 +1,2 @@ +Yes +0 3 4 7 diff --git a/codenet/public_test_cases/p02092/input.0.txt b/codenet/public_test_cases/p02092/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a2f9fe2880602f10b11f567ca0d5ea4c8ba7010 --- /dev/null +++ b/codenet/public_test_cases/p02092/input.0.txt @@ -0,0 +1,4 @@ +3 2 +6 5 4 +8 1 +7 1 diff --git a/codenet/public_test_cases/p02092/input.1.txt b/codenet/public_test_cases/p02092/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a2f9fe2880602f10b11f567ca0d5ea4c8ba7010 --- /dev/null +++ b/codenet/public_test_cases/p02092/input.1.txt @@ -0,0 +1,4 @@ +3 2 +6 5 4 +8 1 +7 1 diff --git a/codenet/public_test_cases/p02092/output.0.txt b/codenet/public_test_cases/p02092/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02092/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02092/output.1.txt b/codenet/public_test_cases/p02092/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02092/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02093/input.0.txt b/codenet/public_test_cases/p02093/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99499867d9a792adf26ec05dd5ce7536d885d371 --- /dev/null +++ b/codenet/public_test_cases/p02093/input.0.txt @@ -0,0 +1,2 @@ +4 +2 1 4 3 diff --git a/codenet/public_test_cases/p02093/input.1.txt b/codenet/public_test_cases/p02093/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99499867d9a792adf26ec05dd5ce7536d885d371 --- /dev/null +++ b/codenet/public_test_cases/p02093/input.1.txt @@ -0,0 +1,2 @@ +4 +2 1 4 3 diff --git a/codenet/public_test_cases/p02093/output.0.txt b/codenet/public_test_cases/p02093/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02093/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02093/output.1.txt b/codenet/public_test_cases/p02093/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02093/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02094/input.0.txt b/codenet/public_test_cases/p02094/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ccfca80152cfea69db4d60bc06be5eab4655287 --- /dev/null +++ b/codenet/public_test_cases/p02094/input.0.txt @@ -0,0 +1,5 @@ +3 +1 2 +2 3 +1 2 +3 1 diff --git a/codenet/public_test_cases/p02094/input.1.txt b/codenet/public_test_cases/p02094/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ccfca80152cfea69db4d60bc06be5eab4655287 --- /dev/null +++ b/codenet/public_test_cases/p02094/input.1.txt @@ -0,0 +1,5 @@ +3 +1 2 +2 3 +1 2 +3 1 diff --git a/codenet/public_test_cases/p02094/output.0.txt b/codenet/public_test_cases/p02094/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02094/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02094/output.1.txt b/codenet/public_test_cases/p02094/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02094/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02095/input.0.txt b/codenet/public_test_cases/p02095/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09196f9f16249f77735fae47aba5afa2738af2dc --- /dev/null +++ b/codenet/public_test_cases/p02095/input.0.txt @@ -0,0 +1,4 @@ +2 10 +1 2 +1 9 +8 7 diff --git a/codenet/public_test_cases/p02095/input.1.txt b/codenet/public_test_cases/p02095/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09196f9f16249f77735fae47aba5afa2738af2dc --- /dev/null +++ b/codenet/public_test_cases/p02095/input.1.txt @@ -0,0 +1,4 @@ +2 10 +1 2 +1 9 +8 7 diff --git a/codenet/public_test_cases/p02095/output.0.txt b/codenet/public_test_cases/p02095/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p02095/output.0.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p02095/output.1.txt b/codenet/public_test_cases/p02095/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p02095/output.1.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p02096/input.0.txt b/codenet/public_test_cases/p02096/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fff03f2e6759e5e9fbdea81ca9548812831a0ce1 --- /dev/null +++ b/codenet/public_test_cases/p02096/input.0.txt @@ -0,0 +1,5 @@ +2 +3 0 +1 2 3 +3 1 +1 2 3 diff --git a/codenet/public_test_cases/p02096/input.1.txt b/codenet/public_test_cases/p02096/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fff03f2e6759e5e9fbdea81ca9548812831a0ce1 --- /dev/null +++ b/codenet/public_test_cases/p02096/input.1.txt @@ -0,0 +1,5 @@ +2 +3 0 +1 2 3 +3 1 +1 2 3 diff --git a/codenet/public_test_cases/p02096/output.0.txt b/codenet/public_test_cases/p02096/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93d39f05c837cf2177cd1d9f0b745693db9ce4fb --- /dev/null +++ b/codenet/public_test_cases/p02096/output.0.txt @@ -0,0 +1,2 @@ +3 2 1 +3 65536 0 diff --git a/codenet/public_test_cases/p02096/output.1.txt b/codenet/public_test_cases/p02096/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..93d39f05c837cf2177cd1d9f0b745693db9ce4fb --- /dev/null +++ b/codenet/public_test_cases/p02096/output.1.txt @@ -0,0 +1,2 @@ +3 2 1 +3 65536 0 diff --git a/codenet/public_test_cases/p02097/input.0.txt b/codenet/public_test_cases/p02097/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02097/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02097/input.1.txt b/codenet/public_test_cases/p02097/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02097/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02097/output.0.txt b/codenet/public_test_cases/p02097/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6d60977072732e377d417f541f2ad2907b61aa5 --- /dev/null +++ b/codenet/public_test_cases/p02097/output.0.txt @@ -0,0 +1,5 @@ +Yes +2 6 3 7 +4 5 2 1 +1 7 5 6 +5 3 4 2 diff --git a/codenet/public_test_cases/p02097/output.1.txt b/codenet/public_test_cases/p02097/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6d60977072732e377d417f541f2ad2907b61aa5 --- /dev/null +++ b/codenet/public_test_cases/p02097/output.1.txt @@ -0,0 +1,5 @@ +Yes +2 6 3 7 +4 5 2 1 +1 7 5 6 +5 3 4 2 diff --git a/codenet/public_test_cases/p02098/input.0.txt b/codenet/public_test_cases/p02098/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b86147b3542fae0e5e4cdb03bd17a50cf7e758f --- /dev/null +++ b/codenet/public_test_cases/p02098/input.0.txt @@ -0,0 +1,2 @@ +10 +20 diff --git a/codenet/public_test_cases/p02098/input.1.txt b/codenet/public_test_cases/p02098/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ec029e3bfa9b8ca94fdfde1f9213e92a8ac6a92 --- /dev/null +++ b/codenet/public_test_cases/p02098/input.1.txt @@ -0,0 +1,2 @@ +20 +350 diff --git a/codenet/public_test_cases/p02098/input.2.txt b/codenet/public_test_cases/p02098/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b86147b3542fae0e5e4cdb03bd17a50cf7e758f --- /dev/null +++ b/codenet/public_test_cases/p02098/input.2.txt @@ -0,0 +1,2 @@ +10 +20 diff --git a/codenet/public_test_cases/p02098/output.0.txt b/codenet/public_test_cases/p02098/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe6b09a7d14ccc307ab278380b4c9506395755ac --- /dev/null +++ b/codenet/public_test_cases/p02098/output.0.txt @@ -0,0 +1 @@ +15.0 diff --git a/codenet/public_test_cases/p02098/output.1.txt b/codenet/public_test_cases/p02098/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..819e07a22435f1e8efcbdd1d1c062deef0e501b1 --- /dev/null +++ b/codenet/public_test_cases/p02098/output.1.txt @@ -0,0 +1 @@ +5.0 diff --git a/codenet/public_test_cases/p02098/output.2.txt b/codenet/public_test_cases/p02098/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe6b09a7d14ccc307ab278380b4c9506395755ac --- /dev/null +++ b/codenet/public_test_cases/p02098/output.2.txt @@ -0,0 +1 @@ +15.0 diff --git a/codenet/public_test_cases/p02099/input.0.txt b/codenet/public_test_cases/p02099/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b9fd23e172f0bf7bb2fcf736e245583c1d77196 --- /dev/null +++ b/codenet/public_test_cases/p02099/input.0.txt @@ -0,0 +1,4 @@ +3 +1.000 +3.000 +3.000 diff --git a/codenet/public_test_cases/p02099/input.1.txt b/codenet/public_test_cases/p02099/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7e9f815e379ed6a3e9a5d814b49037d2408519e --- /dev/null +++ b/codenet/public_test_cases/p02099/input.1.txt @@ -0,0 +1,4 @@ +3 +1.000 +2.000 +3.000 diff --git a/codenet/public_test_cases/p02099/input.2.txt b/codenet/public_test_cases/p02099/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b9fd23e172f0bf7bb2fcf736e245583c1d77196 --- /dev/null +++ b/codenet/public_test_cases/p02099/input.2.txt @@ -0,0 +1,4 @@ +3 +1.000 +3.000 +3.000 diff --git a/codenet/public_test_cases/p02099/output.0.txt b/codenet/public_test_cases/p02099/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..731f5f1231b5de264127d244adbf6f8c52d33c46 --- /dev/null +++ b/codenet/public_test_cases/p02099/output.0.txt @@ -0,0 +1,3 @@ +0 +4 +4 diff --git a/codenet/public_test_cases/p02099/output.1.txt b/codenet/public_test_cases/p02099/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d59af9d115841524a145484decdbec5839e97515 --- /dev/null +++ b/codenet/public_test_cases/p02099/output.1.txt @@ -0,0 +1,3 @@ +0 +3 +6 diff --git a/codenet/public_test_cases/p02099/output.2.txt b/codenet/public_test_cases/p02099/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..731f5f1231b5de264127d244adbf6f8c52d33c46 --- /dev/null +++ b/codenet/public_test_cases/p02099/output.2.txt @@ -0,0 +1,3 @@ +0 +4 +4 diff --git a/codenet/public_test_cases/p02100/input.0.txt b/codenet/public_test_cases/p02100/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee0b4b4e84867e8f18e8ef632f87109abce3f0bc --- /dev/null +++ b/codenet/public_test_cases/p02100/input.0.txt @@ -0,0 +1 @@ +x^2+3x+2 diff --git a/codenet/public_test_cases/p02100/input.1.txt b/codenet/public_test_cases/p02100/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bee922be29fb517f53ce69f089839be11cdd20a3 --- /dev/null +++ b/codenet/public_test_cases/p02100/input.1.txt @@ -0,0 +1 @@ +x^5+15x^4+85x^3+225x^2+274x+120 diff --git a/codenet/public_test_cases/p02100/input.2.txt b/codenet/public_test_cases/p02100/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee0b4b4e84867e8f18e8ef632f87109abce3f0bc --- /dev/null +++ b/codenet/public_test_cases/p02100/input.2.txt @@ -0,0 +1 @@ +x^2+3x+2 diff --git a/codenet/public_test_cases/p02100/input.3.txt b/codenet/public_test_cases/p02100/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc77f10d4a7b6476df42e327be20254665ccfce4 --- /dev/null +++ b/codenet/public_test_cases/p02100/input.3.txt @@ -0,0 +1 @@ +x^3-81x^2-1882x-1800 diff --git a/codenet/public_test_cases/p02100/input.4.txt b/codenet/public_test_cases/p02100/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..90560f1a130054c205272780abac02b54ed3a9f3 --- /dev/null +++ b/codenet/public_test_cases/p02100/input.4.txt @@ -0,0 +1 @@ +x^2-1 diff --git a/codenet/public_test_cases/p02100/output.0.txt b/codenet/public_test_cases/p02100/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3de48097c2c310bbce4707a3143587fcaedb39e0 --- /dev/null +++ b/codenet/public_test_cases/p02100/output.0.txt @@ -0,0 +1 @@ +(x+1)(x+2) diff --git a/codenet/public_test_cases/p02100/output.1.txt b/codenet/public_test_cases/p02100/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a4f10bf6cef82704f821f0bc96f746f9082b420 --- /dev/null +++ b/codenet/public_test_cases/p02100/output.1.txt @@ -0,0 +1 @@ +(x+1)(x+2)(x+3)(x+4)(x+5) diff --git a/codenet/public_test_cases/p02100/output.2.txt b/codenet/public_test_cases/p02100/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3de48097c2c310bbce4707a3143587fcaedb39e0 --- /dev/null +++ b/codenet/public_test_cases/p02100/output.2.txt @@ -0,0 +1 @@ +(x+1)(x+2) diff --git a/codenet/public_test_cases/p02100/output.3.txt b/codenet/public_test_cases/p02100/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bca4baafb41174624be03f968f733dd2041a3626 --- /dev/null +++ b/codenet/public_test_cases/p02100/output.3.txt @@ -0,0 +1 @@ +(x-100)(x+1)(x+18) diff --git a/codenet/public_test_cases/p02100/output.4.txt b/codenet/public_test_cases/p02100/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a5676c22b66b9b6df8d3f822e6a5efcea1f079e --- /dev/null +++ b/codenet/public_test_cases/p02100/output.4.txt @@ -0,0 +1 @@ +(x-1)(x+1) diff --git a/codenet/public_test_cases/p02101/input.0.txt b/codenet/public_test_cases/p02101/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb30a0bec7fe2ad65d290f5576492d4352ee8a4d --- /dev/null +++ b/codenet/public_test_cases/p02101/input.0.txt @@ -0,0 +1,4 @@ +3 10 +1 6 +5 10 +0 5 diff --git a/codenet/public_test_cases/p02101/input.1.txt b/codenet/public_test_cases/p02101/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6909826c9af214db31fc05034f7a2cfebbaf920 --- /dev/null +++ b/codenet/public_test_cases/p02101/input.1.txt @@ -0,0 +1,6 @@ +5 5 +1 1 +1 2 +1 2 +1 3 +1 3 diff --git a/codenet/public_test_cases/p02101/input.2.txt b/codenet/public_test_cases/p02101/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb30a0bec7fe2ad65d290f5576492d4352ee8a4d --- /dev/null +++ b/codenet/public_test_cases/p02101/input.2.txt @@ -0,0 +1,4 @@ +3 10 +1 6 +5 10 +0 5 diff --git a/codenet/public_test_cases/p02101/output.0.txt b/codenet/public_test_cases/p02101/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02101/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02101/output.1.txt b/codenet/public_test_cases/p02101/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02101/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02101/output.2.txt b/codenet/public_test_cases/p02101/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02101/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02102/input.0.txt b/codenet/public_test_cases/p02102/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..96a8479dd6da63df361152a05e72ff7f42dc4bf2 --- /dev/null +++ b/codenet/public_test_cases/p02102/input.0.txt @@ -0,0 +1,6 @@ +4 5 +0 2 22 13 +0 3 15 25 +1 2 3 3 +1 3 28 5 +2 3 5 22 diff --git a/codenet/public_test_cases/p02102/input.1.txt b/codenet/public_test_cases/p02102/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..96a8479dd6da63df361152a05e72ff7f42dc4bf2 --- /dev/null +++ b/codenet/public_test_cases/p02102/input.1.txt @@ -0,0 +1,6 @@ +4 5 +0 2 22 13 +0 3 15 25 +1 2 3 3 +1 3 28 5 +2 3 5 22 diff --git a/codenet/public_test_cases/p02102/input.2.txt b/codenet/public_test_cases/p02102/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..80eb05ac1b2909e8eeb18a16149ab43062413ff4 --- /dev/null +++ b/codenet/public_test_cases/p02102/input.2.txt @@ -0,0 +1,2 @@ +2 1 +0 1 1 1 diff --git a/codenet/public_test_cases/p02102/input.3.txt b/codenet/public_test_cases/p02102/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..78685af7bd41015e744a936fa4c7b9338f209efc --- /dev/null +++ b/codenet/public_test_cases/p02102/input.3.txt @@ -0,0 +1,7 @@ +5 6 +0 1 22 33 +0 2 43 11 +0 3 92 10 +1 3 50 12 +2 3 88 2 +3 4 58 89 diff --git a/codenet/public_test_cases/p02102/output.0.txt b/codenet/public_test_cases/p02102/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dbfa35c63ced30c64258888cd57d0c6a2a82ae6 --- /dev/null +++ b/codenet/public_test_cases/p02102/output.0.txt @@ -0,0 +1 @@ +0.36000 diff --git a/codenet/public_test_cases/p02102/output.1.txt b/codenet/public_test_cases/p02102/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dbfa35c63ced30c64258888cd57d0c6a2a82ae6 --- /dev/null +++ b/codenet/public_test_cases/p02102/output.1.txt @@ -0,0 +1 @@ +0.36000 diff --git a/codenet/public_test_cases/p02102/output.2.txt b/codenet/public_test_cases/p02102/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02102/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02102/output.3.txt b/codenet/public_test_cases/p02102/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b46349f99b69b371349abc234960100aa3d2177 --- /dev/null +++ b/codenet/public_test_cases/p02102/output.3.txt @@ -0,0 +1 @@ +0.06667 diff --git a/codenet/public_test_cases/p02103/input.0.txt b/codenet/public_test_cases/p02103/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a16e2efab6429765912a08ec8c2215e62f854966 --- /dev/null +++ b/codenet/public_test_cases/p02103/input.0.txt @@ -0,0 +1,3 @@ +3 5 2 +0 2 +2 2 diff --git a/codenet/public_test_cases/p02103/input.1.txt b/codenet/public_test_cases/p02103/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58b9549b9043841eb8bd7d08485f367ab5300135 --- /dev/null +++ b/codenet/public_test_cases/p02103/input.1.txt @@ -0,0 +1,4 @@ +5 5 3 +0 2 +2 2 +4 1 diff --git a/codenet/public_test_cases/p02103/input.2.txt b/codenet/public_test_cases/p02103/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a16e2efab6429765912a08ec8c2215e62f854966 --- /dev/null +++ b/codenet/public_test_cases/p02103/input.2.txt @@ -0,0 +1,3 @@ +3 5 2 +0 2 +2 2 diff --git a/codenet/public_test_cases/p02103/output.0.txt b/codenet/public_test_cases/p02103/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02103/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02103/output.1.txt b/codenet/public_test_cases/p02103/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02103/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02103/output.2.txt b/codenet/public_test_cases/p02103/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02103/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02104/input.0.txt b/codenet/public_test_cases/p02104/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p02104/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02104/input.1.txt b/codenet/public_test_cases/p02104/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4103012e50b578aad0335b479567b97e48bab1ca --- /dev/null +++ b/codenet/public_test_cases/p02104/input.1.txt @@ -0,0 +1,2 @@ +5 +3 3 4 4 5 diff --git a/codenet/public_test_cases/p02104/input.2.txt b/codenet/public_test_cases/p02104/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p02104/input.2.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02104/output.0.txt b/codenet/public_test_cases/p02104/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a1218a1024a212bb3db30becd860315f9f3ac52 --- /dev/null +++ b/codenet/public_test_cases/p02104/output.0.txt @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02104/output.1.txt b/codenet/public_test_cases/p02104/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8872275ea867a0d092930b009a2aef954f5f4139 --- /dev/null +++ b/codenet/public_test_cases/p02104/output.1.txt @@ -0,0 +1,5 @@ +4 +2 +1 +3 +5 diff --git a/codenet/public_test_cases/p02104/output.2.txt b/codenet/public_test_cases/p02104/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a1218a1024a212bb3db30becd860315f9f3ac52 --- /dev/null +++ b/codenet/public_test_cases/p02104/output.2.txt @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02105/input.0.txt b/codenet/public_test_cases/p02105/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b194e75d0592b18a027e3bc12f8d55949b027f4 --- /dev/null +++ b/codenet/public_test_cases/p02105/input.0.txt @@ -0,0 +1,8 @@ +7 10 11 +1 1 0 +1 0 1 +2 2 2 +3 3 5 +4 1 3 +5 1 3 +5 5 -1 diff --git a/codenet/public_test_cases/p02105/input.1.txt b/codenet/public_test_cases/p02105/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b194e75d0592b18a027e3bc12f8d55949b027f4 --- /dev/null +++ b/codenet/public_test_cases/p02105/input.1.txt @@ -0,0 +1,8 @@ +7 10 11 +1 1 0 +1 0 1 +2 2 2 +3 3 5 +4 1 3 +5 1 3 +5 5 -1 diff --git a/codenet/public_test_cases/p02105/input.2.txt b/codenet/public_test_cases/p02105/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1093c337730c98b2a71b7b6e92e6151e924dc26 --- /dev/null +++ b/codenet/public_test_cases/p02105/input.2.txt @@ -0,0 +1,8 @@ +7 10 10 +1 1 0 +1 0 1 +2 2 2 +3 3 5 +4 1 3 +5 1 3 +5 5 -1 diff --git a/codenet/public_test_cases/p02105/output.0.txt b/codenet/public_test_cases/p02105/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02105/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02105/output.1.txt b/codenet/public_test_cases/p02105/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02105/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02105/output.2.txt b/codenet/public_test_cases/p02105/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02105/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02106/input.0.txt b/codenet/public_test_cases/p02106/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3dcc633141f41ba6050d0a935472e51653e3233 --- /dev/null +++ b/codenet/public_test_cases/p02106/input.0.txt @@ -0,0 +1,12 @@ +7 5 +0 1 +1 2 +1 3 +0 4 +4 5 +4 6 +1 0 0 9 +2 0 0 5 +2 1 5 8 +1 0 5 8 +1 0 8 8 diff --git a/codenet/public_test_cases/p02106/input.1.txt b/codenet/public_test_cases/p02106/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3dcc633141f41ba6050d0a935472e51653e3233 --- /dev/null +++ b/codenet/public_test_cases/p02106/input.1.txt @@ -0,0 +1,12 @@ +7 5 +0 1 +1 2 +1 3 +0 4 +4 5 +4 6 +1 0 0 9 +2 0 0 5 +2 1 5 8 +1 0 5 8 +1 0 8 8 diff --git a/codenet/public_test_cases/p02106/input.2.txt b/codenet/public_test_cases/p02106/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e52e198b6eb15e304c948279eec5c5dfb7273f42 --- /dev/null +++ b/codenet/public_test_cases/p02106/input.2.txt @@ -0,0 +1,12 @@ +7 5 +0 1 +1 2 +2 3 +0 4 +4 5 +5 6 +2 1 0 5 +2 4 0 6 +2 3 5 6 +2 5 6 5 +1 0 0 5 diff --git a/codenet/public_test_cases/p02106/output.0.txt b/codenet/public_test_cases/p02106/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..661f86c089a5ad333a54719738ea67bdd912579a --- /dev/null +++ b/codenet/public_test_cases/p02106/output.0.txt @@ -0,0 +1,3 @@ +7 +7 +3 diff --git a/codenet/public_test_cases/p02106/output.1.txt b/codenet/public_test_cases/p02106/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..661f86c089a5ad333a54719738ea67bdd912579a --- /dev/null +++ b/codenet/public_test_cases/p02106/output.1.txt @@ -0,0 +1,3 @@ +7 +7 +3 diff --git a/codenet/public_test_cases/p02106/output.2.txt b/codenet/public_test_cases/p02106/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02106/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02107/input.0.txt b/codenet/public_test_cases/p02107/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d662091c30415efa371802ea917fcff7017f7f4c --- /dev/null +++ b/codenet/public_test_cases/p02107/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 3 +2 1 2 +3 2 1 diff --git a/codenet/public_test_cases/p02107/input.1.txt b/codenet/public_test_cases/p02107/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d662091c30415efa371802ea917fcff7017f7f4c --- /dev/null +++ b/codenet/public_test_cases/p02107/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 3 +2 1 2 +3 2 1 diff --git a/codenet/public_test_cases/p02107/input.2.txt b/codenet/public_test_cases/p02107/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e03c915ca7a802c707576edf8bbea8b7ea460f02 --- /dev/null +++ b/codenet/public_test_cases/p02107/input.2.txt @@ -0,0 +1,4 @@ +3 5 +1 2 3 4 5 +5 4 3 2 1 +4 3 2 1 5 diff --git a/codenet/public_test_cases/p02107/output.0.txt b/codenet/public_test_cases/p02107/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d66ea1aee9527bfa39185ead1f9cdbd96bba88c --- /dev/null +++ b/codenet/public_test_cases/p02107/output.0.txt @@ -0,0 +1,2 @@ +0 +1 diff --git a/codenet/public_test_cases/p02107/output.1.txt b/codenet/public_test_cases/p02107/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d66ea1aee9527bfa39185ead1f9cdbd96bba88c --- /dev/null +++ b/codenet/public_test_cases/p02107/output.1.txt @@ -0,0 +1,2 @@ +0 +1 diff --git a/codenet/public_test_cases/p02107/output.2.txt b/codenet/public_test_cases/p02107/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p02107/output.2.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p02108/input.0.txt b/codenet/public_test_cases/p02108/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a5e238c95d18b90bde3e8d30c2e74d1f705dd75 --- /dev/null +++ b/codenet/public_test_cases/p02108/input.0.txt @@ -0,0 +1,3 @@ +2 1 +1 2 +0 1 diff --git a/codenet/public_test_cases/p02108/input.1.txt b/codenet/public_test_cases/p02108/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a5e238c95d18b90bde3e8d30c2e74d1f705dd75 --- /dev/null +++ b/codenet/public_test_cases/p02108/input.1.txt @@ -0,0 +1,3 @@ +2 1 +1 2 +0 1 diff --git a/codenet/public_test_cases/p02108/input.2.txt b/codenet/public_test_cases/p02108/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b278b44437fa25fdbe0bc091bb05bfb2c208e2b --- /dev/null +++ b/codenet/public_test_cases/p02108/input.2.txt @@ -0,0 +1,7 @@ +5 5 +1 1 1 1 1 +0 1 +1 2 +2 3 +3 0 +3 4 diff --git a/codenet/public_test_cases/p02108/input.3.txt b/codenet/public_test_cases/p02108/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9ad8ef2dccc8adffd2b3c269f92f0f332fc4e91 --- /dev/null +++ b/codenet/public_test_cases/p02108/input.3.txt @@ -0,0 +1,6 @@ +4 4 +1 1 1 1 +0 1 +1 2 +2 0 +2 3 diff --git a/codenet/public_test_cases/p02108/output.0.txt b/codenet/public_test_cases/p02108/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02108/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02108/output.1.txt b/codenet/public_test_cases/p02108/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02108/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02108/output.2.txt b/codenet/public_test_cases/p02108/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02108/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02108/output.3.txt b/codenet/public_test_cases/p02108/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02108/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02109/input.0.txt b/codenet/public_test_cases/p02109/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9265bfda67283dee47f7734bd83ef6fa3a17ba9e --- /dev/null +++ b/codenet/public_test_cases/p02109/input.0.txt @@ -0,0 +1,5 @@ +4 +1 5 +2 3 5 +3 3 5 7 +4 3 5 7 9 diff --git a/codenet/public_test_cases/p02109/input.1.txt b/codenet/public_test_cases/p02109/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b8d9e4cb509c075a2e9047380ff574d79cb9bbe --- /dev/null +++ b/codenet/public_test_cases/p02109/input.1.txt @@ -0,0 +1,6 @@ +5 +4 1 4 5 6 +4 1 7 8 9 +3 1 2 3 +3 1 2 3 +3 1 2 3 diff --git a/codenet/public_test_cases/p02109/input.2.txt b/codenet/public_test_cases/p02109/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..df1fdce4cc94a27be151e403cbf323b8c5f21be4 --- /dev/null +++ b/codenet/public_test_cases/p02109/input.2.txt @@ -0,0 +1,4 @@ +3 +2 3 4 +2 2 5 +2 1 6 diff --git a/codenet/public_test_cases/p02109/input.3.txt b/codenet/public_test_cases/p02109/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9265bfda67283dee47f7734bd83ef6fa3a17ba9e --- /dev/null +++ b/codenet/public_test_cases/p02109/input.3.txt @@ -0,0 +1,5 @@ +4 +1 5 +2 3 5 +3 3 5 7 +4 3 5 7 9 diff --git a/codenet/public_test_cases/p02109/output.0.txt b/codenet/public_test_cases/p02109/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02109/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02109/output.1.txt b/codenet/public_test_cases/p02109/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02109/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02109/output.2.txt b/codenet/public_test_cases/p02109/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02109/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02109/output.3.txt b/codenet/public_test_cases/p02109/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02109/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02110/input.0.txt b/codenet/public_test_cases/p02110/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09ffac972180dbb72a6f34ab8acde1c321be28d2 --- /dev/null +++ b/codenet/public_test_cases/p02110/input.0.txt @@ -0,0 +1,4 @@ +3 2 +2 1 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02110/input.1.txt b/codenet/public_test_cases/p02110/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31ff6b46461aa65f13ded6568530ca9be914384f --- /dev/null +++ b/codenet/public_test_cases/p02110/input.1.txt @@ -0,0 +1,5 @@ +4 3 +2 1 +1 2 +1 3 +2 4 diff --git a/codenet/public_test_cases/p02110/input.2.txt b/codenet/public_test_cases/p02110/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..67f2e63b3e372ad8b06230ef55801d92e448c187 --- /dev/null +++ b/codenet/public_test_cases/p02110/input.2.txt @@ -0,0 +1,6 @@ +5 3 +5 7 +5 6 +6 8 +20 20 +4 8 diff --git a/codenet/public_test_cases/p02110/input.3.txt b/codenet/public_test_cases/p02110/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..09ffac972180dbb72a6f34ab8acde1c321be28d2 --- /dev/null +++ b/codenet/public_test_cases/p02110/input.3.txt @@ -0,0 +1,4 @@ +3 2 +2 1 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02110/output.0.txt b/codenet/public_test_cases/p02110/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p02110/output.0.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p02110/output.1.txt b/codenet/public_test_cases/p02110/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02110/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02110/output.2.txt b/codenet/public_test_cases/p02110/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcf37cd5e26203dc0a9570d26b7a5074049d4c9c --- /dev/null +++ b/codenet/public_test_cases/p02110/output.2.txt @@ -0,0 +1,3 @@ +2 +3 +4 diff --git a/codenet/public_test_cases/p02110/output.3.txt b/codenet/public_test_cases/p02110/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p02110/output.3.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p02111/input.0.txt b/codenet/public_test_cases/p02111/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02111/input.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02111/input.1.txt b/codenet/public_test_cases/p02111/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02111/input.1.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02111/input.2.txt b/codenet/public_test_cases/p02111/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02111/input.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02111/input.3.txt b/codenet/public_test_cases/p02111/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea90ee31980757b2e469741512bcb39e73494e78 --- /dev/null +++ b/codenet/public_test_cases/p02111/input.3.txt @@ -0,0 +1 @@ +45 diff --git a/codenet/public_test_cases/p02111/output.0.txt b/codenet/public_test_cases/p02111/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b748e2dcfcbc7db3aae214293cef6cb2afbd0a65 --- /dev/null +++ b/codenet/public_test_cases/p02111/output.0.txt @@ -0,0 +1 @@ +0 0 diff --git a/codenet/public_test_cases/p02111/output.1.txt b/codenet/public_test_cases/p02111/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5610a8eca0188ab1ee55642852bbd299a586a9f --- /dev/null +++ b/codenet/public_test_cases/p02111/output.1.txt @@ -0,0 +1 @@ +3 20 diff --git a/codenet/public_test_cases/p02111/output.2.txt b/codenet/public_test_cases/p02111/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b748e2dcfcbc7db3aae214293cef6cb2afbd0a65 --- /dev/null +++ b/codenet/public_test_cases/p02111/output.2.txt @@ -0,0 +1 @@ +0 0 diff --git a/codenet/public_test_cases/p02111/output.3.txt b/codenet/public_test_cases/p02111/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcefd2e58854c2438089e15907481d73ee141e9d --- /dev/null +++ b/codenet/public_test_cases/p02111/output.3.txt @@ -0,0 +1 @@ +1 30 diff --git a/codenet/public_test_cases/p02112/input.0.txt b/codenet/public_test_cases/p02112/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9138a68cb43ed6f53d6d6bc70b9f493b017e041 --- /dev/null +++ b/codenet/public_test_cases/p02112/input.0.txt @@ -0,0 +1,2 @@ +1 +1 1 359 1 diff --git a/codenet/public_test_cases/p02112/input.1.txt b/codenet/public_test_cases/p02112/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9138a68cb43ed6f53d6d6bc70b9f493b017e041 --- /dev/null +++ b/codenet/public_test_cases/p02112/input.1.txt @@ -0,0 +1,2 @@ +1 +1 1 359 1 diff --git a/codenet/public_test_cases/p02112/input.2.txt b/codenet/public_test_cases/p02112/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b917729a35f4b7761a07cb426081766e4f5025a8 --- /dev/null +++ b/codenet/public_test_cases/p02112/input.2.txt @@ -0,0 +1,3 @@ +2 +2 4 25 306 +1 9 7 321 diff --git a/codenet/public_test_cases/p02112/input.3.txt b/codenet/public_test_cases/p02112/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..871a2243629803bb35d718d1c0c9f24f5c75009e --- /dev/null +++ b/codenet/public_test_cases/p02112/input.3.txt @@ -0,0 +1,9 @@ +8 +2 9 297 297 +8 6 359 211 +8 16 28 288 +7 9 113 143 +3 18 315 190 +10 18 277 300 +9 5 276 88 +3 5 322 40 diff --git a/codenet/public_test_cases/p02112/output.0.txt b/codenet/public_test_cases/p02112/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02112/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02112/output.1.txt b/codenet/public_test_cases/p02112/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02112/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02112/output.2.txt b/codenet/public_test_cases/p02112/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c5c8078521783358203b859d5c7e9b7d9d524d4 --- /dev/null +++ b/codenet/public_test_cases/p02112/output.2.txt @@ -0,0 +1 @@ +158 diff --git a/codenet/public_test_cases/p02112/output.3.txt b/codenet/public_test_cases/p02112/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..95de1eedbcd3823b898e2638db9157a37c00f5e5 --- /dev/null +++ b/codenet/public_test_cases/p02112/output.3.txt @@ -0,0 +1 @@ +297 diff --git a/codenet/public_test_cases/p02113/input.0.txt b/codenet/public_test_cases/p02113/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..10236c6a9554e1998bf2247df7352a3b2d134192 --- /dev/null +++ b/codenet/public_test_cases/p02113/input.0.txt @@ -0,0 +1,5 @@ +4 2 +oi +io +rr +rr diff --git a/codenet/public_test_cases/p02113/input.1.txt b/codenet/public_test_cases/p02113/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..470dfdedcf670bc4306f790616f6d8156dcf3b91 --- /dev/null +++ b/codenet/public_test_cases/p02113/input.1.txt @@ -0,0 +1,6 @@ +5 1 +a +b +c +a +c diff --git a/codenet/public_test_cases/p02113/input.2.txt b/codenet/public_test_cases/p02113/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e24038048b662c2ca83b710d2686e290bfd5576 --- /dev/null +++ b/codenet/public_test_cases/p02113/input.2.txt @@ -0,0 +1,4 @@ +3 3 +uki +uku +uke diff --git a/codenet/public_test_cases/p02113/input.3.txt b/codenet/public_test_cases/p02113/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..10236c6a9554e1998bf2247df7352a3b2d134192 --- /dev/null +++ b/codenet/public_test_cases/p02113/input.3.txt @@ -0,0 +1,5 @@ +4 2 +oi +io +rr +rr diff --git a/codenet/public_test_cases/p02113/output.0.txt b/codenet/public_test_cases/p02113/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cfe2f459699092519f916010101815e4e8fb2e5 --- /dev/null +++ b/codenet/public_test_cases/p02113/output.0.txt @@ -0,0 +1 @@ +iorrrroi diff --git a/codenet/public_test_cases/p02113/output.1.txt b/codenet/public_test_cases/p02113/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..15a190192eaa5018b0a5c64f96a38b7505b0863a --- /dev/null +++ b/codenet/public_test_cases/p02113/output.1.txt @@ -0,0 +1 @@ +acbca diff --git a/codenet/public_test_cases/p02113/output.2.txt b/codenet/public_test_cases/p02113/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..442ed88a0548f9ec29defbe1d494776f9b01c64b --- /dev/null +++ b/codenet/public_test_cases/p02113/output.2.txt @@ -0,0 +1 @@ +uku diff --git a/codenet/public_test_cases/p02113/output.3.txt b/codenet/public_test_cases/p02113/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cfe2f459699092519f916010101815e4e8fb2e5 --- /dev/null +++ b/codenet/public_test_cases/p02113/output.3.txt @@ -0,0 +1 @@ +iorrrroi diff --git a/codenet/public_test_cases/p02114/input.0.txt b/codenet/public_test_cases/p02114/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..06f0b212d25a93b46c0b91c813d0e054a17dc060 --- /dev/null +++ b/codenet/public_test_cases/p02114/input.0.txt @@ -0,0 +1,6 @@ +5 +oxooo +oxooo +oxooo +xxxxx +oxooo diff --git a/codenet/public_test_cases/p02114/input.1.txt b/codenet/public_test_cases/p02114/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..06f0b212d25a93b46c0b91c813d0e054a17dc060 --- /dev/null +++ b/codenet/public_test_cases/p02114/input.1.txt @@ -0,0 +1,6 @@ +5 +oxooo +oxooo +oxooo +xxxxx +oxooo diff --git a/codenet/public_test_cases/p02114/input.2.txt b/codenet/public_test_cases/p02114/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd84b35a98aa025e571a571862ab4b6e2b332fa7 --- /dev/null +++ b/codenet/public_test_cases/p02114/input.2.txt @@ -0,0 +1,10 @@ +9 +oxoooooxo +oxxxxxxxx +oxoooooxo +xxxxxxxxx +oxoxooooo +oxxxxxxxx +oxoxoxooo +oxoxxxxxx +oxoxoxooo diff --git a/codenet/public_test_cases/p02114/output.0.txt b/codenet/public_test_cases/p02114/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02114/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02114/output.1.txt b/codenet/public_test_cases/p02114/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02114/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02114/output.2.txt b/codenet/public_test_cases/p02114/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02114/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02115/input.0.txt b/codenet/public_test_cases/p02115/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..805642e7bd7c6cabce79d004fbcff5c16807a5c1 --- /dev/null +++ b/codenet/public_test_cases/p02115/input.0.txt @@ -0,0 +1,4 @@ +3 +2 +5 +1 diff --git a/codenet/public_test_cases/p02115/input.1.txt b/codenet/public_test_cases/p02115/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cccbafe8be819965313f966056e008fefac41e23 --- /dev/null +++ b/codenet/public_test_cases/p02115/input.1.txt @@ -0,0 +1,6 @@ +5 +4 +5 +2 +1 +3 diff --git a/codenet/public_test_cases/p02115/input.2.txt b/codenet/public_test_cases/p02115/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3369e14fd0e1f31d4c8e5376435d28a19320249 --- /dev/null +++ b/codenet/public_test_cases/p02115/input.2.txt @@ -0,0 +1,4 @@ +3 +4 +4 +4 diff --git a/codenet/public_test_cases/p02115/input.3.txt b/codenet/public_test_cases/p02115/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..805642e7bd7c6cabce79d004fbcff5c16807a5c1 --- /dev/null +++ b/codenet/public_test_cases/p02115/input.3.txt @@ -0,0 +1,4 @@ +3 +2 +5 +1 diff --git a/codenet/public_test_cases/p02115/output.0.txt b/codenet/public_test_cases/p02115/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02115/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02115/output.1.txt b/codenet/public_test_cases/p02115/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02115/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02115/output.2.txt b/codenet/public_test_cases/p02115/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02115/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02115/output.3.txt b/codenet/public_test_cases/p02115/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02115/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02116/input.0.txt b/codenet/public_test_cases/p02116/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02116/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02116/input.1.txt b/codenet/public_test_cases/p02116/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02116/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02116/input.2.txt b/codenet/public_test_cases/p02116/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02116/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02116/input.3.txt b/codenet/public_test_cases/p02116/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p02116/input.3.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p02116/output.0.txt b/codenet/public_test_cases/p02116/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02116/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02116/output.1.txt b/codenet/public_test_cases/p02116/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02116/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02116/output.2.txt b/codenet/public_test_cases/p02116/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02116/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02116/output.3.txt b/codenet/public_test_cases/p02116/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p02116/output.3.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p02117/input.0.txt b/codenet/public_test_cases/p02117/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..506e915fffba4fe5c40d02c4dbffb0939b7b1d86 --- /dev/null +++ b/codenet/public_test_cases/p02117/input.0.txt @@ -0,0 +1,6 @@ +1 10 10 +3 +1 10 1 +2 20 2 +3 30 3 +0 diff --git a/codenet/public_test_cases/p02117/input.1.txt b/codenet/public_test_cases/p02117/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..92eebf7d6373c2e75f609e2433d807be854d56af --- /dev/null +++ b/codenet/public_test_cases/p02117/input.1.txt @@ -0,0 +1,10 @@ +3 10 10 +1 +1 1 1 +1 +3 3 3 +1 +5 5 5 +0 1 0 +1 0 0 +0 1 0 diff --git a/codenet/public_test_cases/p02117/input.2.txt b/codenet/public_test_cases/p02117/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc33387ad2fc4ee070f8afe6a02435c494c0a44c --- /dev/null +++ b/codenet/public_test_cases/p02117/input.2.txt @@ -0,0 +1,17 @@ +4 59 40 +1 +7 6 3 +1 +10 3 9 +2 +9 8 5 +7 6 10 +4 +8 2 9 +1 7 1 +7 7 9 +1 2 3 +0 28 7 26 +14 0 10 24 +9 6 0 21 +9 24 14 0 diff --git a/codenet/public_test_cases/p02117/input.3.txt b/codenet/public_test_cases/p02117/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..506e915fffba4fe5c40d02c4dbffb0939b7b1d86 --- /dev/null +++ b/codenet/public_test_cases/p02117/input.3.txt @@ -0,0 +1,6 @@ +1 10 10 +3 +1 10 1 +2 20 2 +3 30 3 +0 diff --git a/codenet/public_test_cases/p02117/input.4.txt b/codenet/public_test_cases/p02117/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1bd41d23a830a0f295ce48d6ffae608ff1d4d71 --- /dev/null +++ b/codenet/public_test_cases/p02117/input.4.txt @@ -0,0 +1,9 @@ +2 10 10 +3 +1 10 1 +2 20 2 +3 30 3 +1 +5 200 1 +0 2 +3 0 diff --git a/codenet/public_test_cases/p02117/output.0.txt b/codenet/public_test_cases/p02117/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02117/output.0.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02117/output.1.txt b/codenet/public_test_cases/p02117/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02117/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02117/output.2.txt b/codenet/public_test_cases/p02117/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p02117/output.2.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p02117/output.3.txt b/codenet/public_test_cases/p02117/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02117/output.3.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02117/output.4.txt b/codenet/public_test_cases/p02117/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..08839f6bb296e888d311d8ea2f35f7ff82dd3f2d --- /dev/null +++ b/codenet/public_test_cases/p02117/output.4.txt @@ -0,0 +1 @@ +200 diff --git a/codenet/public_test_cases/p02118/input.0.txt b/codenet/public_test_cases/p02118/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d6e0614c6819d7e9afaea908fb0bf15ac93a890 --- /dev/null +++ b/codenet/public_test_cases/p02118/input.0.txt @@ -0,0 +1,4 @@ +3 3 5 +0 3 +2 2 +4 1 diff --git a/codenet/public_test_cases/p02118/input.1.txt b/codenet/public_test_cases/p02118/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05aba2909dd0d3957d56893713c326a60b5ddf39 --- /dev/null +++ b/codenet/public_test_cases/p02118/input.1.txt @@ -0,0 +1,4 @@ +3 3 5 +0 10 +8 1 +11 1 diff --git a/codenet/public_test_cases/p02118/input.2.txt b/codenet/public_test_cases/p02118/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d6e0614c6819d7e9afaea908fb0bf15ac93a890 --- /dev/null +++ b/codenet/public_test_cases/p02118/input.2.txt @@ -0,0 +1,4 @@ +3 3 5 +0 3 +2 2 +4 1 diff --git a/codenet/public_test_cases/p02118/output.0.txt b/codenet/public_test_cases/p02118/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02118/output.0.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02118/output.1.txt b/codenet/public_test_cases/p02118/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c61d23e125b800e69cb950b09e23c06f728fff9 --- /dev/null +++ b/codenet/public_test_cases/p02118/output.1.txt @@ -0,0 +1 @@ +58 diff --git a/codenet/public_test_cases/p02118/output.2.txt b/codenet/public_test_cases/p02118/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02118/output.2.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02119/input.0.txt b/codenet/public_test_cases/p02119/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8704b307374bb058db586bfc21b7d5a13f357182 --- /dev/null +++ b/codenet/public_test_cases/p02119/input.0.txt @@ -0,0 +1,4 @@ +3 +0 +0 +2 diff --git a/codenet/public_test_cases/p02119/input.1.txt b/codenet/public_test_cases/p02119/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8704b307374bb058db586bfc21b7d5a13f357182 --- /dev/null +++ b/codenet/public_test_cases/p02119/input.1.txt @@ -0,0 +1,4 @@ +3 +0 +0 +2 diff --git a/codenet/public_test_cases/p02119/input.2.txt b/codenet/public_test_cases/p02119/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d2ffdabe4af426bef187e22e0d9b1e9346732d1 --- /dev/null +++ b/codenet/public_test_cases/p02119/input.2.txt @@ -0,0 +1,6 @@ +5 +0 +1 +2 +3 +4 diff --git a/codenet/public_test_cases/p02119/output.0.txt b/codenet/public_test_cases/p02119/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33280629d45d42f53ada4c621ad788fb72c9c09c --- /dev/null +++ b/codenet/public_test_cases/p02119/output.0.txt @@ -0,0 +1,3 @@ +1 +1 +2 diff --git a/codenet/public_test_cases/p02119/output.1.txt b/codenet/public_test_cases/p02119/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..33280629d45d42f53ada4c621ad788fb72c9c09c --- /dev/null +++ b/codenet/public_test_cases/p02119/output.1.txt @@ -0,0 +1,3 @@ +1 +1 +2 diff --git a/codenet/public_test_cases/p02119/output.2.txt b/codenet/public_test_cases/p02119/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9e71554d659e3d3b9f9578a2b4a59c3c17fe836 --- /dev/null +++ b/codenet/public_test_cases/p02119/output.2.txt @@ -0,0 +1,5 @@ +1 +1 +2 +2 +3 diff --git a/codenet/public_test_cases/p02120/input.0.txt b/codenet/public_test_cases/p02120/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f7a78fbeab6e1d1d3df06a78982ec9151fc0fbb --- /dev/null +++ b/codenet/public_test_cases/p02120/input.0.txt @@ -0,0 +1,12 @@ +9 10 +1 2 3 4 5 6 7 8 9 +1 2 +2 3 +2 4 +3 4 +4 5 +4 6 +2 7 +7 8 +7 9 +9 1 diff --git a/codenet/public_test_cases/p02120/input.1.txt b/codenet/public_test_cases/p02120/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f7a78fbeab6e1d1d3df06a78982ec9151fc0fbb --- /dev/null +++ b/codenet/public_test_cases/p02120/input.1.txt @@ -0,0 +1,12 @@ +9 10 +1 2 3 4 5 6 7 8 9 +1 2 +2 3 +2 4 +3 4 +4 5 +4 6 +2 7 +7 8 +7 9 +9 1 diff --git a/codenet/public_test_cases/p02120/input.2.txt b/codenet/public_test_cases/p02120/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..682baaad8df83335f5a672ea72df7d1f56bc2f23 --- /dev/null +++ b/codenet/public_test_cases/p02120/input.2.txt @@ -0,0 +1,3 @@ +2 1 +1 2 +1 2 diff --git a/codenet/public_test_cases/p02120/input.3.txt b/codenet/public_test_cases/p02120/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9ce7bcd402dbda71733418553ed092f906e4867 --- /dev/null +++ b/codenet/public_test_cases/p02120/input.3.txt @@ -0,0 +1,21 @@ +16 19 +1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 +1 2 +2 3 +3 4 +3 5 +1 6 +6 7 +6 8 +7 8 +8 9 +8 10 +10 11 +11 12 +12 10 +1 13 +13 14 +14 15 +15 13 +14 16 +15 16 diff --git a/codenet/public_test_cases/p02120/output.0.txt b/codenet/public_test_cases/p02120/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33b744451969fad668d4dd45296afb66626695b1 --- /dev/null +++ b/codenet/public_test_cases/p02120/output.0.txt @@ -0,0 +1,9 @@ +44 +25 +42 +30 +40 +39 +30 +37 +36 diff --git a/codenet/public_test_cases/p02120/output.1.txt b/codenet/public_test_cases/p02120/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..33b744451969fad668d4dd45296afb66626695b1 --- /dev/null +++ b/codenet/public_test_cases/p02120/output.1.txt @@ -0,0 +1,9 @@ +44 +25 +42 +30 +40 +39 +30 +37 +36 diff --git a/codenet/public_test_cases/p02120/output.2.txt b/codenet/public_test_cases/p02120/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p02120/output.2.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p02120/output.3.txt b/codenet/public_test_cases/p02120/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..642f63315a03e46e56ff42ee995ca9186690d26b --- /dev/null +++ b/codenet/public_test_cases/p02120/output.3.txt @@ -0,0 +1,16 @@ +63 +122 +124 +132 +131 +73 +129 +86 +127 +103 +125 +124 +78 +122 +121 +120 diff --git a/codenet/public_test_cases/p02121/input.0.txt b/codenet/public_test_cases/p02121/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9efb6b771cbb012c8c92a698ab2cc04eb2218361 --- /dev/null +++ b/codenet/public_test_cases/p02121/input.0.txt @@ -0,0 +1,4 @@ +2 1 +0 0 5 5 +3 3 6 6 +2 2 diff --git a/codenet/public_test_cases/p02121/input.1.txt b/codenet/public_test_cases/p02121/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6777022667314b74dec25135bb5f7f07d6e40617 --- /dev/null +++ b/codenet/public_test_cases/p02121/input.1.txt @@ -0,0 +1,5 @@ +2 2 +0 0 6 0 +7 0 3 0 +4 0 +5 0 diff --git a/codenet/public_test_cases/p02121/input.2.txt b/codenet/public_test_cases/p02121/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9efb6b771cbb012c8c92a698ab2cc04eb2218361 --- /dev/null +++ b/codenet/public_test_cases/p02121/input.2.txt @@ -0,0 +1,4 @@ +2 1 +0 0 5 5 +3 3 6 6 +2 2 diff --git a/codenet/public_test_cases/p02121/output.0.txt b/codenet/public_test_cases/p02121/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f13fa8ecc36104fcceae210914fbca7ea5baab8a --- /dev/null +++ b/codenet/public_test_cases/p02121/output.0.txt @@ -0,0 +1 @@ +4.2426406871 diff --git a/codenet/public_test_cases/p02121/output.1.txt b/codenet/public_test_cases/p02121/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75cdb2ecbd6b9039c0268600e995366c5680b332 --- /dev/null +++ b/codenet/public_test_cases/p02121/output.1.txt @@ -0,0 +1 @@ +3.0000000000 diff --git a/codenet/public_test_cases/p02121/output.2.txt b/codenet/public_test_cases/p02121/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f13fa8ecc36104fcceae210914fbca7ea5baab8a --- /dev/null +++ b/codenet/public_test_cases/p02121/output.2.txt @@ -0,0 +1 @@ +4.2426406871 diff --git a/codenet/public_test_cases/p02122/input.0.txt b/codenet/public_test_cases/p02122/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9447e1146ef428d2013f210498e98b3e45916052 --- /dev/null +++ b/codenet/public_test_cases/p02122/input.0.txt @@ -0,0 +1,14 @@ +5 +1 3 5 7 9 +6 2 3 2 6 +10 +1 3 4 +3 4 5 +4 2 3 +5 -1 -1 +2 3 8 +3 2 5 +4 3 3 +1 1 1 +6 -1 -1 +3 1 5 diff --git a/codenet/public_test_cases/p02122/input.1.txt b/codenet/public_test_cases/p02122/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9447e1146ef428d2013f210498e98b3e45916052 --- /dev/null +++ b/codenet/public_test_cases/p02122/input.1.txt @@ -0,0 +1,14 @@ +5 +1 3 5 7 9 +6 2 3 2 6 +10 +1 3 4 +3 4 5 +4 2 3 +5 -1 -1 +2 3 8 +3 2 5 +4 3 3 +1 1 1 +6 -1 -1 +3 1 5 diff --git a/codenet/public_test_cases/p02122/output.0.txt b/codenet/public_test_cases/p02122/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae8f23c4a2cdefac252e1cab6ce1b3b54a3b5848 --- /dev/null +++ b/codenet/public_test_cases/p02122/output.0.txt @@ -0,0 +1,5 @@ +7 +2 +2 +8 +1 diff --git a/codenet/public_test_cases/p02122/output.1.txt b/codenet/public_test_cases/p02122/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae8f23c4a2cdefac252e1cab6ce1b3b54a3b5848 --- /dev/null +++ b/codenet/public_test_cases/p02122/output.1.txt @@ -0,0 +1,5 @@ +7 +2 +2 +8 +1 diff --git a/codenet/public_test_cases/p02123/input.0.txt b/codenet/public_test_cases/p02123/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..06f0b212d25a93b46c0b91c813d0e054a17dc060 --- /dev/null +++ b/codenet/public_test_cases/p02123/input.0.txt @@ -0,0 +1,6 @@ +5 +oxooo +oxooo +oxooo +xxxxx +oxooo diff --git a/codenet/public_test_cases/p02123/input.1.txt b/codenet/public_test_cases/p02123/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..391a17db00116efd72df4fe1d9861f9693d8c389 --- /dev/null +++ b/codenet/public_test_cases/p02123/input.1.txt @@ -0,0 +1,4 @@ +3 +oxx +oxx +ooo diff --git a/codenet/public_test_cases/p02123/input.2.txt b/codenet/public_test_cases/p02123/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..06f0b212d25a93b46c0b91c813d0e054a17dc060 --- /dev/null +++ b/codenet/public_test_cases/p02123/input.2.txt @@ -0,0 +1,6 @@ +5 +oxooo +oxooo +oxooo +xxxxx +oxooo diff --git a/codenet/public_test_cases/p02123/input.3.txt b/codenet/public_test_cases/p02123/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd84b35a98aa025e571a571862ab4b6e2b332fa7 --- /dev/null +++ b/codenet/public_test_cases/p02123/input.3.txt @@ -0,0 +1,10 @@ +9 +oxoooooxo +oxxxxxxxx +oxoooooxo +xxxxxxxxx +oxoxooooo +oxxxxxxxx +oxoxoxooo +oxoxxxxxx +oxoxoxooo diff --git a/codenet/public_test_cases/p02123/output.0.txt b/codenet/public_test_cases/p02123/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6327ccae6ea416db6a05fa5bcd08aff5f90c5c79 --- /dev/null +++ b/codenet/public_test_cases/p02123/output.0.txt @@ -0,0 +1,3 @@ +1 +4 +2 diff --git a/codenet/public_test_cases/p02123/output.1.txt b/codenet/public_test_cases/p02123/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02123/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02123/output.2.txt b/codenet/public_test_cases/p02123/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6327ccae6ea416db6a05fa5bcd08aff5f90c5c79 --- /dev/null +++ b/codenet/public_test_cases/p02123/output.2.txt @@ -0,0 +1,3 @@ +1 +4 +2 diff --git a/codenet/public_test_cases/p02123/output.3.txt b/codenet/public_test_cases/p02123/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3c2cf42a1f10567887093ed63cae891af9e34b0 --- /dev/null +++ b/codenet/public_test_cases/p02123/output.3.txt @@ -0,0 +1,9 @@ +4 +4 +2 +2 +8 +6 +4 +8 +6 diff --git a/codenet/public_test_cases/p02124/input.0.txt b/codenet/public_test_cases/p02124/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02124/input.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02124/input.1.txt b/codenet/public_test_cases/p02124/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02124/input.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02124/input.2.txt b/codenet/public_test_cases/p02124/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..697cb3a26d77d1625ea445520e6e1e7bae966fe1 --- /dev/null +++ b/codenet/public_test_cases/p02124/input.2.txt @@ -0,0 +1 @@ +300 diff --git a/codenet/public_test_cases/p02124/output.0.txt b/codenet/public_test_cases/p02124/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1752b0015f8067c04c8e15036020ad927fdba99c --- /dev/null +++ b/codenet/public_test_cases/p02124/output.0.txt @@ -0,0 +1 @@ +ai1333 diff --git a/codenet/public_test_cases/p02124/output.1.txt b/codenet/public_test_cases/p02124/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1752b0015f8067c04c8e15036020ad927fdba99c --- /dev/null +++ b/codenet/public_test_cases/p02124/output.1.txt @@ -0,0 +1 @@ +ai1333 diff --git a/codenet/public_test_cases/p02124/output.2.txt b/codenet/public_test_cases/p02124/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..39cb9a89e615001ddfcdd2b812c9ba0bea0fd088 --- /dev/null +++ b/codenet/public_test_cases/p02124/output.2.txt @@ -0,0 +1 @@ +ai1333333 diff --git a/codenet/public_test_cases/p02125/input.0.txt b/codenet/public_test_cases/p02125/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02125/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02125/input.1.txt b/codenet/public_test_cases/p02125/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02125/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02125/input.2.txt b/codenet/public_test_cases/p02125/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02125/input.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02125/output.0.txt b/codenet/public_test_cases/p02125/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02125/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02125/output.1.txt b/codenet/public_test_cases/p02125/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02125/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02125/output.2.txt b/codenet/public_test_cases/p02125/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02125/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02126/input.0.txt b/codenet/public_test_cases/p02126/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d20b6743efde662e717bf97297d165f6531f37b6 --- /dev/null +++ b/codenet/public_test_cases/p02126/input.0.txt @@ -0,0 +1,5 @@ +3 3 2 +1 1 +1 1 +1 100 +2 10 diff --git a/codenet/public_test_cases/p02126/input.1.txt b/codenet/public_test_cases/p02126/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7aa717c1ef58cd042dde33c3ae2653c3f05c27bd --- /dev/null +++ b/codenet/public_test_cases/p02126/input.1.txt @@ -0,0 +1,24 @@ +22 7 26 +11 14 15 3 11 7 16 17 1 4 2 19 4 14 16 16 3 13 17 12 7 11 2 20 12 22 +6 10 +1 3 +13 1 +16 5 +4 1 +20 7 +18 4 +26 6 +9 1 +12 2 +21 1 +21 7 +18 1 +14 5 +24 5 +6 1 +3 1 +2 5 +21 2 +7 6 +10 9 +15 7 diff --git a/codenet/public_test_cases/p02126/input.2.txt b/codenet/public_test_cases/p02126/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d20b6743efde662e717bf97297d165f6531f37b6 --- /dev/null +++ b/codenet/public_test_cases/p02126/input.2.txt @@ -0,0 +1,5 @@ +3 3 2 +1 1 +1 1 +1 100 +2 10 diff --git a/codenet/public_test_cases/p02126/input.3.txt b/codenet/public_test_cases/p02126/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a8c42ee571a55bb4332810fa4961ebe2aa0fdb4 --- /dev/null +++ b/codenet/public_test_cases/p02126/input.3.txt @@ -0,0 +1,5 @@ +3 3 3 +1 0 1 +1 1 +2 100 +3 1 diff --git a/codenet/public_test_cases/p02126/output.0.txt b/codenet/public_test_cases/p02126/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p02126/output.0.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p02126/output.1.txt b/codenet/public_test_cases/p02126/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0691f67b202a873c99bdb9b99e15a667cb916a5b --- /dev/null +++ b/codenet/public_test_cases/p02126/output.1.txt @@ -0,0 +1 @@ +52 diff --git a/codenet/public_test_cases/p02126/output.2.txt b/codenet/public_test_cases/p02126/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p02126/output.2.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p02126/output.3.txt b/codenet/public_test_cases/p02126/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02126/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02127/input.0.txt b/codenet/public_test_cases/p02127/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d82a8d2887c156c0b7010da8c5e10dc0e13333cc --- /dev/null +++ b/codenet/public_test_cases/p02127/input.0.txt @@ -0,0 +1,2 @@ +AABABCAC +A diff --git a/codenet/public_test_cases/p02127/input.1.txt b/codenet/public_test_cases/p02127/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b647747c96e53767e94bc60ac2564c3bffde318f --- /dev/null +++ b/codenet/public_test_cases/p02127/input.1.txt @@ -0,0 +1,2 @@ +abaabbabaabaabbabbabaabbab +ab diff --git a/codenet/public_test_cases/p02127/input.2.txt b/codenet/public_test_cases/p02127/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d82a8d2887c156c0b7010da8c5e10dc0e13333cc --- /dev/null +++ b/codenet/public_test_cases/p02127/input.2.txt @@ -0,0 +1,2 @@ +AABABCAC +A diff --git a/codenet/public_test_cases/p02127/input.3.txt b/codenet/public_test_cases/p02127/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cee8e7a5d273377ad9117b5da3650f6cfab62d18 --- /dev/null +++ b/codenet/public_test_cases/p02127/input.3.txt @@ -0,0 +1,2 @@ +AbCdEfG +aBcDeFg diff --git a/codenet/public_test_cases/p02127/output.0.txt b/codenet/public_test_cases/p02127/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02127/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02127/output.1.txt b/codenet/public_test_cases/p02127/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02127/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02127/output.2.txt b/codenet/public_test_cases/p02127/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02127/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02127/output.3.txt b/codenet/public_test_cases/p02127/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02127/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02128/input.0.txt b/codenet/public_test_cases/p02128/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12717dcb7d284edf23b673bbbb3964d678509383 --- /dev/null +++ b/codenet/public_test_cases/p02128/input.0.txt @@ -0,0 +1,2 @@ +10 10 1 +6 6 diff --git a/codenet/public_test_cases/p02128/input.1.txt b/codenet/public_test_cases/p02128/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46b206baeac2eedb49ae7c2aea80920b600f1ab0 --- /dev/null +++ b/codenet/public_test_cases/p02128/input.1.txt @@ -0,0 +1,2 @@ +1 1 1 +1 1 diff --git a/codenet/public_test_cases/p02128/input.2.txt b/codenet/public_test_cases/p02128/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7b2adc79afd2fd13af1b3b9575d8d3604fe4cdb --- /dev/null +++ b/codenet/public_test_cases/p02128/input.2.txt @@ -0,0 +1,4 @@ +5 10 3 +3 9 +2 8 +5 1 diff --git a/codenet/public_test_cases/p02128/input.3.txt b/codenet/public_test_cases/p02128/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..12717dcb7d284edf23b673bbbb3964d678509383 --- /dev/null +++ b/codenet/public_test_cases/p02128/input.3.txt @@ -0,0 +1,2 @@ +10 10 1 +6 6 diff --git a/codenet/public_test_cases/p02128/output.0.txt b/codenet/public_test_cases/p02128/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02128/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02128/output.1.txt b/codenet/public_test_cases/p02128/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02128/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02128/output.2.txt b/codenet/public_test_cases/p02128/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02128/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02128/output.3.txt b/codenet/public_test_cases/p02128/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02128/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02129/input.0.txt b/codenet/public_test_cases/p02129/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f823fbde359856574db78ab866b50b9c197d015 --- /dev/null +++ b/codenet/public_test_cases/p02129/input.0.txt @@ -0,0 +1,4 @@ +3 +2 0 0 +1 1 +5 1 0 0 1 0 diff --git a/codenet/public_test_cases/p02129/input.1.txt b/codenet/public_test_cases/p02129/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f823fbde359856574db78ab866b50b9c197d015 --- /dev/null +++ b/codenet/public_test_cases/p02129/input.1.txt @@ -0,0 +1,4 @@ +3 +2 0 0 +1 1 +5 1 0 0 1 0 diff --git a/codenet/public_test_cases/p02129/input.2.txt b/codenet/public_test_cases/p02129/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d254849806dc3495b820e8553f8f77cba42c6c93 --- /dev/null +++ b/codenet/public_test_cases/p02129/input.2.txt @@ -0,0 +1,3 @@ +2 +1 1 +1 0 diff --git a/codenet/public_test_cases/p02129/output.0.txt b/codenet/public_test_cases/p02129/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p02129/output.0.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p02129/output.1.txt b/codenet/public_test_cases/p02129/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p02129/output.1.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p02129/output.2.txt b/codenet/public_test_cases/p02129/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p02129/output.2.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p02130/input.0.txt b/codenet/public_test_cases/p02130/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc5655fa40b1dbbd5787b5c5245a5409f34081fa --- /dev/null +++ b/codenet/public_test_cases/p02130/input.0.txt @@ -0,0 +1,6 @@ +5 3 5 +7 2 +13 1 +1 1 +2 9 +2 4 diff --git a/codenet/public_test_cases/p02130/input.1.txt b/codenet/public_test_cases/p02130/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae496653fac83c2903d4c794aa29ce56b1cf672f --- /dev/null +++ b/codenet/public_test_cases/p02130/input.1.txt @@ -0,0 +1,11 @@ +10 7 12 +34 70 +36 0 +12 50 +76 46 +33 45 +61 21 +0 1 +24 3 +98 41 +23 84 diff --git a/codenet/public_test_cases/p02130/input.2.txt b/codenet/public_test_cases/p02130/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc5655fa40b1dbbd5787b5c5245a5409f34081fa --- /dev/null +++ b/codenet/public_test_cases/p02130/input.2.txt @@ -0,0 +1,6 @@ +5 3 5 +7 2 +13 1 +1 1 +2 9 +2 4 diff --git a/codenet/public_test_cases/p02130/output.0.txt b/codenet/public_test_cases/p02130/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02130/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02130/output.1.txt b/codenet/public_test_cases/p02130/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02130/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02130/output.2.txt b/codenet/public_test_cases/p02130/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02130/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02131/input.0.txt b/codenet/public_test_cases/p02131/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e8ff57fab9834fe3c2da25bc9f7b8a8e0ad1d1 --- /dev/null +++ b/codenet/public_test_cases/p02131/input.0.txt @@ -0,0 +1,2 @@ +2 3 +00 diff --git a/codenet/public_test_cases/p02131/input.1.txt b/codenet/public_test_cases/p02131/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2355d4c8daa9fcc9ea240f7b3c16e57b33aed40d --- /dev/null +++ b/codenet/public_test_cases/p02131/input.1.txt @@ -0,0 +1,2 @@ +5 13 +10031 diff --git a/codenet/public_test_cases/p02131/input.2.txt b/codenet/public_test_cases/p02131/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e8ff57fab9834fe3c2da25bc9f7b8a8e0ad1d1 --- /dev/null +++ b/codenet/public_test_cases/p02131/input.2.txt @@ -0,0 +1,2 @@ +2 3 +00 diff --git a/codenet/public_test_cases/p02131/input.3.txt b/codenet/public_test_cases/p02131/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe4a26898ee2ce9e42693f03ec0ec06d2a1232fc --- /dev/null +++ b/codenet/public_test_cases/p02131/input.3.txt @@ -0,0 +1,2 @@ +4 9 +0012 diff --git a/codenet/public_test_cases/p02131/output.0.txt b/codenet/public_test_cases/p02131/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02131/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02131/output.1.txt b/codenet/public_test_cases/p02131/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02131/output.1.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02131/output.2.txt b/codenet/public_test_cases/p02131/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02131/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02131/output.3.txt b/codenet/public_test_cases/p02131/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02131/output.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02132/input.0.txt b/codenet/public_test_cases/p02132/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f79a178ced818ca2aea73ab9938224e5ca4d2dc --- /dev/null +++ b/codenet/public_test_cases/p02132/input.0.txt @@ -0,0 +1,6 @@ +5 2 +0 0 +5 5 +10 10 +100 100 +200 200 diff --git a/codenet/public_test_cases/p02132/input.1.txt b/codenet/public_test_cases/p02132/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..43d14b8e0932e3a159c2d4fb087a99fff4dd365a --- /dev/null +++ b/codenet/public_test_cases/p02132/input.1.txt @@ -0,0 +1,11 @@ +10 5 +321 675 +4312 6534 +312 532 +412 6543 +21 43 +654 321 +543 0 +32 5 +41 76 +5 1 diff --git a/codenet/public_test_cases/p02132/input.2.txt b/codenet/public_test_cases/p02132/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2f8f0dee9e4336432ed0839d4d6ac634aa6da4c --- /dev/null +++ b/codenet/public_test_cases/p02132/input.2.txt @@ -0,0 +1,6 @@ +5 2 +0 0 +0 0 +0 0 +0 0 +0 0 diff --git a/codenet/public_test_cases/p02132/input.3.txt b/codenet/public_test_cases/p02132/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f79a178ced818ca2aea73ab9938224e5ca4d2dc --- /dev/null +++ b/codenet/public_test_cases/p02132/input.3.txt @@ -0,0 +1,6 @@ +5 2 +0 0 +5 5 +10 10 +100 100 +200 200 diff --git a/codenet/public_test_cases/p02132/input.4.txt b/codenet/public_test_cases/p02132/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..236d4cedc4de826d927e834392b57c078fee30a9 --- /dev/null +++ b/codenet/public_test_cases/p02132/input.4.txt @@ -0,0 +1,15 @@ +14 3 +312 342 +4893 432 +321 4 +389 4 +23 543 +0 0 +1 1 +2 2 +432 12 +435 32 +1 5 +2 10 +100 100 +20 50 diff --git a/codenet/public_test_cases/p02132/output.0.txt b/codenet/public_test_cases/p02132/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8192f6dadde2446b6f10234eee998333e53a6fd1 --- /dev/null +++ b/codenet/public_test_cases/p02132/output.0.txt @@ -0,0 +1 @@ +70.710678118755 diff --git a/codenet/public_test_cases/p02132/output.1.txt b/codenet/public_test_cases/p02132/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c07055ab0b66959d28bea576d14ab62656deb46f --- /dev/null +++ b/codenet/public_test_cases/p02132/output.1.txt @@ -0,0 +1 @@ +169.824909833728 diff --git a/codenet/public_test_cases/p02132/output.2.txt b/codenet/public_test_cases/p02132/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..285d72370e79639c8b95e3c96204191b3229dd6c --- /dev/null +++ b/codenet/public_test_cases/p02132/output.2.txt @@ -0,0 +1 @@ +0.000000000001 diff --git a/codenet/public_test_cases/p02132/output.3.txt b/codenet/public_test_cases/p02132/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8192f6dadde2446b6f10234eee998333e53a6fd1 --- /dev/null +++ b/codenet/public_test_cases/p02132/output.3.txt @@ -0,0 +1 @@ +70.710678118755 diff --git a/codenet/public_test_cases/p02132/output.4.txt b/codenet/public_test_cases/p02132/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5e26df68bfe8f9d4cb1435e9bc34951fc15890e --- /dev/null +++ b/codenet/public_test_cases/p02132/output.4.txt @@ -0,0 +1 @@ +218.087711712613 diff --git a/codenet/public_test_cases/p02133/input.0.txt b/codenet/public_test_cases/p02133/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7040518f79bad90cb1b0ca8ccf37cc2952cfe038 --- /dev/null +++ b/codenet/public_test_cases/p02133/input.0.txt @@ -0,0 +1,10 @@ +4 4 7 +1 2 3 4 +1 2 3 4 +3 2 3 2 3 +4 2 3 2 3 +3 1 1 1 1 +4 1 1 1 1 +1 1 1 1 +3 1 4 1 2 +4 2 3 2 4 diff --git a/codenet/public_test_cases/p02133/input.1.txt b/codenet/public_test_cases/p02133/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7040518f79bad90cb1b0ca8ccf37cc2952cfe038 --- /dev/null +++ b/codenet/public_test_cases/p02133/input.1.txt @@ -0,0 +1,10 @@ +4 4 7 +1 2 3 4 +1 2 3 4 +3 2 3 2 3 +4 2 3 2 3 +3 1 1 1 1 +4 1 1 1 1 +1 1 1 1 +3 1 4 1 2 +4 2 3 2 4 diff --git a/codenet/public_test_cases/p02133/input.2.txt b/codenet/public_test_cases/p02133/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed8ead91c142bd7383ca9f0cd79ec9eee8644164 --- /dev/null +++ b/codenet/public_test_cases/p02133/input.2.txt @@ -0,0 +1,10 @@ +4 4 7 +0 1 0 1 +1 0 1 0 +3 2 4 1 3 +4 1 4 1 4 +1 1 4 -1 +3 1 3 1 3 +1 3 3 2 +2 3 3 -2 +3 2 4 2 4 diff --git a/codenet/public_test_cases/p02133/input.3.txt b/codenet/public_test_cases/p02133/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4314af3ead7a5166ac87791c1a0fcd321b372bc7 --- /dev/null +++ b/codenet/public_test_cases/p02133/input.3.txt @@ -0,0 +1,23 @@ +36 4 20 +-523 -460 -536 -885 652 782 513 -558 -521 -808 124 -708 -943 52 -856 -755 -958 913 380 -767 373 -731 -492 213 538 392 -39 509 -840 135 78 -285 -241 522 -572 -915 +-691 -16 812 -385 +4 7 17 4 4 +3 24 33 1 1 +4 3 35 2 4 +3 28 32 4 4 +2 3 3 438 +3 7 15 1 1 +4 2 17 4 4 +3 24 28 2 4 +4 15 16 4 4 +4 18 29 1 1 +3 24 27 2 4 +2 2 3 -828 +3 18 23 3 3 +1 27 31 -701 +2 2 3 298 +1 21 32 237 +2 3 3 -71 +1 14 29 772 +4 13 19 3 3 +3 19 34 1 2 diff --git a/codenet/public_test_cases/p02133/input.4.txt b/codenet/public_test_cases/p02133/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c0a55abbec463b32be0e9f147f68aa3be982b8f --- /dev/null +++ b/codenet/public_test_cases/p02133/input.4.txt @@ -0,0 +1,9 @@ +4 4 6 +1 1 1 1 +1 1 1 1 +3 1 4 1 4 +4 1 4 1 4 +1 2 3 1 +2 2 3 1 +3 1 4 1 4 +4 1 4 1 4 diff --git a/codenet/public_test_cases/p02133/output.0.txt b/codenet/public_test_cases/p02133/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f072d31bb200c82b27a520b5694a0c9bdf434a6f --- /dev/null +++ b/codenet/public_test_cases/p02133/output.0.txt @@ -0,0 +1,6 @@ +4 1 +9 1 +1 1 +1 1 +2 2 +12 1 diff --git a/codenet/public_test_cases/p02133/output.1.txt b/codenet/public_test_cases/p02133/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f072d31bb200c82b27a520b5694a0c9bdf434a6f --- /dev/null +++ b/codenet/public_test_cases/p02133/output.1.txt @@ -0,0 +1,6 @@ +4 1 +9 1 +1 1 +1 1 +2 2 +12 1 diff --git a/codenet/public_test_cases/p02133/output.2.txt b/codenet/public_test_cases/p02133/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac31e6d599496e466fcf6057c09bbf9d24acdb9b --- /dev/null +++ b/codenet/public_test_cases/p02133/output.2.txt @@ -0,0 +1,4 @@ +0 5 +1 4 +-1 4 +-1 1 diff --git a/codenet/public_test_cases/p02133/output.3.txt b/codenet/public_test_cases/p02133/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a02031e0b0605d6991a76cf6cd8453884bbb1d90 --- /dev/null +++ b/codenet/public_test_cases/p02133/output.3.txt @@ -0,0 +1,13 @@ +368830 1 +-371758 1 +741356 1 +-195965 1 +-354483 1 +368830 1 +-207130 1 +329560 1 +580440 1 +-207130 1 +-323674 1 +1093565 1 +-1068977 1 diff --git a/codenet/public_test_cases/p02133/output.4.txt b/codenet/public_test_cases/p02133/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccd22735cefa418b2457d4ecb031cacd2d052c50 --- /dev/null +++ b/codenet/public_test_cases/p02133/output.4.txt @@ -0,0 +1,4 @@ +1 16 +1 16 +1 4 +4 4 diff --git a/codenet/public_test_cases/p02134/input.0.txt b/codenet/public_test_cases/p02134/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13ca94a9c706a231508d601478f9cd4f7073b0ce --- /dev/null +++ b/codenet/public_test_cases/p02134/input.0.txt @@ -0,0 +1,5 @@ +0 0 +13 33 +2 +0 34 +14 0 diff --git a/codenet/public_test_cases/p02134/input.1.txt b/codenet/public_test_cases/p02134/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7aba3c7c751d4ca3dffae30d52f68c2012396508 --- /dev/null +++ b/codenet/public_test_cases/p02134/input.1.txt @@ -0,0 +1,4 @@ +0 0 +0 2 +1 +0 1 diff --git a/codenet/public_test_cases/p02134/input.2.txt b/codenet/public_test_cases/p02134/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb236d8bbe143718100b2c2189b8e380879534a2 --- /dev/null +++ b/codenet/public_test_cases/p02134/input.2.txt @@ -0,0 +1,7 @@ +0 1 +5 0 +4 +2 1 +1 3 +4 2 +3 0 diff --git a/codenet/public_test_cases/p02134/input.3.txt b/codenet/public_test_cases/p02134/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..13ca94a9c706a231508d601478f9cd4f7073b0ce --- /dev/null +++ b/codenet/public_test_cases/p02134/input.3.txt @@ -0,0 +1,5 @@ +0 0 +13 33 +2 +0 34 +14 0 diff --git a/codenet/public_test_cases/p02134/output.0.txt b/codenet/public_test_cases/p02134/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02134/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02134/output.1.txt b/codenet/public_test_cases/p02134/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02134/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02134/output.2.txt b/codenet/public_test_cases/p02134/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02134/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02134/output.3.txt b/codenet/public_test_cases/p02134/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02134/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02135/input.0.txt b/codenet/public_test_cases/p02135/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69433d22c4697c533534ece3ffa13817ecaf2f9d --- /dev/null +++ b/codenet/public_test_cases/p02135/input.0.txt @@ -0,0 +1,15 @@ +10 +1 2 3 4 5 6 7 8 9 10 +1 2 +2 3 +3 4 +3 5 +2 6 +6 7 +2 8 +8 9 +8 10 +3 +3 8 +7 1 +7 10 diff --git a/codenet/public_test_cases/p02135/input.1.txt b/codenet/public_test_cases/p02135/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69433d22c4697c533534ece3ffa13817ecaf2f9d --- /dev/null +++ b/codenet/public_test_cases/p02135/input.1.txt @@ -0,0 +1,15 @@ +10 +1 2 3 4 5 6 7 8 9 10 +1 2 +2 3 +3 4 +3 5 +2 6 +6 7 +2 8 +8 9 +8 10 +3 +3 8 +7 1 +7 10 diff --git a/codenet/public_test_cases/p02135/input.2.txt b/codenet/public_test_cases/p02135/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a9bcd5bb896133c0f1096725f29a88721f4fefb --- /dev/null +++ b/codenet/public_test_cases/p02135/input.2.txt @@ -0,0 +1,10 @@ +5 +1 2 3 4 5 +1 2 +2 3 +3 4 +4 5 +3 +1 2 +1 5 +2 4 diff --git a/codenet/public_test_cases/p02135/input.3.txt b/codenet/public_test_cases/p02135/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..09cb5c3e29b6f4e7ccedcb0f928ca76f243ace45 --- /dev/null +++ b/codenet/public_test_cases/p02135/input.3.txt @@ -0,0 +1,22 @@ +15 +3 8 4 2 6 5 1 2 10 3 4 2 6 1 1 +1 2 +2 3 +3 4 +3 5 +2 6 +6 7 +6 8 +1 9 +9 10 +10 11 +10 12 +9 13 +13 14 +13 15 +5 +1 1 +2 7 +6 10 +1 15 +3 4 diff --git a/codenet/public_test_cases/p02135/output.0.txt b/codenet/public_test_cases/p02135/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2afae0ed8bf029f8914d2d7d7fee6f80e643256b --- /dev/null +++ b/codenet/public_test_cases/p02135/output.0.txt @@ -0,0 +1,3 @@ +13 +27 +12 diff --git a/codenet/public_test_cases/p02135/output.1.txt b/codenet/public_test_cases/p02135/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2afae0ed8bf029f8914d2d7d7fee6f80e643256b --- /dev/null +++ b/codenet/public_test_cases/p02135/output.1.txt @@ -0,0 +1,3 @@ +13 +27 +12 diff --git a/codenet/public_test_cases/p02135/output.2.txt b/codenet/public_test_cases/p02135/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1abba1034347d02110610de543b9c6b4f01bcd7 --- /dev/null +++ b/codenet/public_test_cases/p02135/output.2.txt @@ -0,0 +1,3 @@ +12 +0 +5 diff --git a/codenet/public_test_cases/p02135/output.3.txt b/codenet/public_test_cases/p02135/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d7457fb9a27a64e39b43d5f75fedf80cdac3917 --- /dev/null +++ b/codenet/public_test_cases/p02135/output.3.txt @@ -0,0 +1,5 @@ +28 +30 +12 +28 +46 diff --git a/codenet/public_test_cases/p02136/input.0.txt b/codenet/public_test_cases/p02136/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..716010e5319a69d3d73d6d9d385270298b928daf --- /dev/null +++ b/codenet/public_test_cases/p02136/input.0.txt @@ -0,0 +1,3 @@ +2 +-1 -1 10 +1 1 1 diff --git a/codenet/public_test_cases/p02136/input.1.txt b/codenet/public_test_cases/p02136/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..716010e5319a69d3d73d6d9d385270298b928daf --- /dev/null +++ b/codenet/public_test_cases/p02136/input.1.txt @@ -0,0 +1,3 @@ +2 +-1 -1 10 +1 1 1 diff --git a/codenet/public_test_cases/p02136/input.2.txt b/codenet/public_test_cases/p02136/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..76c901763f69bca1b89689c7f217ef421020d858 --- /dev/null +++ b/codenet/public_test_cases/p02136/input.2.txt @@ -0,0 +1,4 @@ +3 +3 2 2 +4 -1 4 +1 -4 7 diff --git a/codenet/public_test_cases/p02136/output.0.txt b/codenet/public_test_cases/p02136/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d66ea1aee9527bfa39185ead1f9cdbd96bba88c --- /dev/null +++ b/codenet/public_test_cases/p02136/output.0.txt @@ -0,0 +1,2 @@ +0 +1 diff --git a/codenet/public_test_cases/p02136/output.1.txt b/codenet/public_test_cases/p02136/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d66ea1aee9527bfa39185ead1f9cdbd96bba88c --- /dev/null +++ b/codenet/public_test_cases/p02136/output.1.txt @@ -0,0 +1,2 @@ +0 +1 diff --git a/codenet/public_test_cases/p02136/output.2.txt b/codenet/public_test_cases/p02136/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p02136/output.2.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p02137/input.0.txt b/codenet/public_test_cases/p02137/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a1f00d8f61bc2898e976fb2c80c74003aec1e8e --- /dev/null +++ b/codenet/public_test_cases/p02137/input.0.txt @@ -0,0 +1 @@ +5700 diff --git a/codenet/public_test_cases/p02137/input.1.txt b/codenet/public_test_cases/p02137/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8735ed157e661a1f9ad281ec960ddf0aec64d292 --- /dev/null +++ b/codenet/public_test_cases/p02137/input.1.txt @@ -0,0 +1 @@ +1333 diff --git a/codenet/public_test_cases/p02137/input.2.txt b/codenet/public_test_cases/p02137/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a1f00d8f61bc2898e976fb2c80c74003aec1e8e --- /dev/null +++ b/codenet/public_test_cases/p02137/input.2.txt @@ -0,0 +1 @@ +5700 diff --git a/codenet/public_test_cases/p02137/input.3.txt b/codenet/public_test_cases/p02137/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7393e847d34d19031ee0ba57df63e4d0ccb4fb2 --- /dev/null +++ b/codenet/public_test_cases/p02137/input.3.txt @@ -0,0 +1 @@ +100000 diff --git a/codenet/public_test_cases/p02137/output.0.txt b/codenet/public_test_cases/p02137/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ddc9de2f5c53c8bfb0237112d3b1f940ea9cf2f --- /dev/null +++ b/codenet/public_test_cases/p02137/output.0.txt @@ -0,0 +1 @@ +5500 diff --git a/codenet/public_test_cases/p02137/output.1.txt b/codenet/public_test_cases/p02137/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b33d238dab9943201aaf267f701e8ea5fc9268 --- /dev/null +++ b/codenet/public_test_cases/p02137/output.1.txt @@ -0,0 +1 @@ +1000 diff --git a/codenet/public_test_cases/p02137/output.2.txt b/codenet/public_test_cases/p02137/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ddc9de2f5c53c8bfb0237112d3b1f940ea9cf2f --- /dev/null +++ b/codenet/public_test_cases/p02137/output.2.txt @@ -0,0 +1 @@ +5500 diff --git a/codenet/public_test_cases/p02137/output.3.txt b/codenet/public_test_cases/p02137/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7393e847d34d19031ee0ba57df63e4d0ccb4fb2 --- /dev/null +++ b/codenet/public_test_cases/p02137/output.3.txt @@ -0,0 +1 @@ +100000 diff --git a/codenet/public_test_cases/p02138/input.0.txt b/codenet/public_test_cases/p02138/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..df502ea9515dea46b9d8c379f37811ae8d2f9bc7 --- /dev/null +++ b/codenet/public_test_cases/p02138/input.0.txt @@ -0,0 +1 @@ +20 10 diff --git a/codenet/public_test_cases/p02138/input.1.txt b/codenet/public_test_cases/p02138/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a77f4ad1992d5724d421b7212aeea7be308c1bae --- /dev/null +++ b/codenet/public_test_cases/p02138/input.1.txt @@ -0,0 +1 @@ +64783 68943 diff --git a/codenet/public_test_cases/p02138/input.2.txt b/codenet/public_test_cases/p02138/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..df502ea9515dea46b9d8c379f37811ae8d2f9bc7 --- /dev/null +++ b/codenet/public_test_cases/p02138/input.2.txt @@ -0,0 +1 @@ +20 10 diff --git a/codenet/public_test_cases/p02138/input.3.txt b/codenet/public_test_cases/p02138/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1883fc43702d44c04e40861628d42417d05a1f4e --- /dev/null +++ b/codenet/public_test_cases/p02138/input.3.txt @@ -0,0 +1 @@ +1000000000000000000 1000000000000000000 diff --git a/codenet/public_test_cases/p02138/input.4.txt b/codenet/public_test_cases/p02138/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed40cec79baa7d9dbb01e18ad634edd038ad2259 --- /dev/null +++ b/codenet/public_test_cases/p02138/input.4.txt @@ -0,0 +1 @@ +10 20 diff --git a/codenet/public_test_cases/p02138/output.0.txt b/codenet/public_test_cases/p02138/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02138/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02138/output.1.txt b/codenet/public_test_cases/p02138/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02138/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02138/output.2.txt b/codenet/public_test_cases/p02138/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02138/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02138/output.3.txt b/codenet/public_test_cases/p02138/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02138/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02138/output.4.txt b/codenet/public_test_cases/p02138/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02138/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02139/input.0.txt b/codenet/public_test_cases/p02139/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d276e87677070193137f6cc53f4c8af6720f095a --- /dev/null +++ b/codenet/public_test_cases/p02139/input.0.txt @@ -0,0 +1,5 @@ +5 4 +1 2 +0 2 +1 1 +0 3 diff --git a/codenet/public_test_cases/p02139/input.1.txt b/codenet/public_test_cases/p02139/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d276e87677070193137f6cc53f4c8af6720f095a --- /dev/null +++ b/codenet/public_test_cases/p02139/input.1.txt @@ -0,0 +1,5 @@ +5 4 +1 2 +0 2 +1 1 +0 3 diff --git a/codenet/public_test_cases/p02139/input.2.txt b/codenet/public_test_cases/p02139/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd5117b2e4a8949c0d45661a177a7e099edf3320 --- /dev/null +++ b/codenet/public_test_cases/p02139/input.2.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +1 1 +0 1 +0 4 diff --git a/codenet/public_test_cases/p02139/input.3.txt b/codenet/public_test_cases/p02139/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5022b7069997632bf032219e33107ffef079d4ef --- /dev/null +++ b/codenet/public_test_cases/p02139/input.3.txt @@ -0,0 +1,7 @@ +10 6 +1 1 +0 1 +1 9 +0 5 +1 1 +0 10 diff --git a/codenet/public_test_cases/p02139/output.0.txt b/codenet/public_test_cases/p02139/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcb4347b4fab3d27bb7140fed351e3dd09765561 --- /dev/null +++ b/codenet/public_test_cases/p02139/output.0.txt @@ -0,0 +1,2 @@ +4 +1 diff --git a/codenet/public_test_cases/p02139/output.1.txt b/codenet/public_test_cases/p02139/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcb4347b4fab3d27bb7140fed351e3dd09765561 --- /dev/null +++ b/codenet/public_test_cases/p02139/output.1.txt @@ -0,0 +1,2 @@ +4 +1 diff --git a/codenet/public_test_cases/p02139/output.2.txt b/codenet/public_test_cases/p02139/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..81450f3d334f886509a186abffcf1a1aee0866a5 --- /dev/null +++ b/codenet/public_test_cases/p02139/output.2.txt @@ -0,0 +1,2 @@ +4 +3 diff --git a/codenet/public_test_cases/p02139/output.3.txt b/codenet/public_test_cases/p02139/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..147741ff50104dd90af01ec3bfbb0bf9a753b77f --- /dev/null +++ b/codenet/public_test_cases/p02139/output.3.txt @@ -0,0 +1,3 @@ +2 +5 +1 diff --git a/codenet/public_test_cases/p02140/input.0.txt b/codenet/public_test_cases/p02140/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ee3e8756e3ae23c97e0d956e535b5bc120d8cdf --- /dev/null +++ b/codenet/public_test_cases/p02140/input.0.txt @@ -0,0 +1 @@ +2 2 0 0 1 1 diff --git a/codenet/public_test_cases/p02140/input.1.txt b/codenet/public_test_cases/p02140/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..71907b8d39eb18cba5422ef4d61f064e79d3f43c --- /dev/null +++ b/codenet/public_test_cases/p02140/input.1.txt @@ -0,0 +1 @@ +5 5 0 0 4 4 diff --git a/codenet/public_test_cases/p02140/input.2.txt b/codenet/public_test_cases/p02140/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2aaf46d86d4b354f73868820564a64424c37eff1 --- /dev/null +++ b/codenet/public_test_cases/p02140/input.2.txt @@ -0,0 +1 @@ +1 1 0 0 0 0 diff --git a/codenet/public_test_cases/p02140/input.3.txt b/codenet/public_test_cases/p02140/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..68526bb10fed44b4fdd59123f1e32aeb9446adf3 --- /dev/null +++ b/codenet/public_test_cases/p02140/input.3.txt @@ -0,0 +1 @@ +1 10 0 0 0 9 diff --git a/codenet/public_test_cases/p02140/input.4.txt b/codenet/public_test_cases/p02140/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ee3e8756e3ae23c97e0d956e535b5bc120d8cdf --- /dev/null +++ b/codenet/public_test_cases/p02140/input.4.txt @@ -0,0 +1 @@ +2 2 0 0 1 1 diff --git a/codenet/public_test_cases/p02140/input.5.txt b/codenet/public_test_cases/p02140/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b880d875f687ea0f40f380b6c7f95f215925c82 --- /dev/null +++ b/codenet/public_test_cases/p02140/input.5.txt @@ -0,0 +1 @@ +421 435 196 169 388 9 diff --git a/codenet/public_test_cases/p02140/output.0.txt b/codenet/public_test_cases/p02140/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0be89e24c500a563a7ef1ede92c28641efbfecb --- /dev/null +++ b/codenet/public_test_cases/p02140/output.0.txt @@ -0,0 +1 @@ +2 8 diff --git a/codenet/public_test_cases/p02140/output.1.txt b/codenet/public_test_cases/p02140/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p02140/output.1.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p02140/output.2.txt b/codenet/public_test_cases/p02140/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e8183b72e5ed9b26e9e2c64bb6bc849b23b0690 --- /dev/null +++ b/codenet/public_test_cases/p02140/output.2.txt @@ -0,0 +1 @@ +0 1 diff --git a/codenet/public_test_cases/p02140/output.3.txt b/codenet/public_test_cases/p02140/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02140/output.3.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02140/output.4.txt b/codenet/public_test_cases/p02140/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0be89e24c500a563a7ef1ede92c28641efbfecb --- /dev/null +++ b/codenet/public_test_cases/p02140/output.4.txt @@ -0,0 +1 @@ +2 8 diff --git a/codenet/public_test_cases/p02140/output.5.txt b/codenet/public_test_cases/p02140/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a7ceea7e4a73bfa6a6057e8af118e1f00a4d81c --- /dev/null +++ b/codenet/public_test_cases/p02140/output.5.txt @@ -0,0 +1 @@ +43 917334776 diff --git a/codenet/public_test_cases/p02141/input.0.txt b/codenet/public_test_cases/p02141/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..daa977dd9f11674689d4075ae637342742161ec0 --- /dev/null +++ b/codenet/public_test_cases/p02141/input.0.txt @@ -0,0 +1 @@ +6000 5000 20 10 400 300 diff --git a/codenet/public_test_cases/p02141/input.1.txt b/codenet/public_test_cases/p02141/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..daa977dd9f11674689d4075ae637342742161ec0 --- /dev/null +++ b/codenet/public_test_cases/p02141/input.1.txt @@ -0,0 +1 @@ +6000 5000 20 10 400 300 diff --git a/codenet/public_test_cases/p02141/input.2.txt b/codenet/public_test_cases/p02141/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf72bf16e9f544d30063061b6ba86bf9218860fb --- /dev/null +++ b/codenet/public_test_cases/p02141/input.2.txt @@ -0,0 +1 @@ +10 10 8 8 8 8 diff --git a/codenet/public_test_cases/p02141/output.0.txt b/codenet/public_test_cases/p02141/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..39c64a9f26e9c671497e5ad55583caecd1413dbc --- /dev/null +++ b/codenet/public_test_cases/p02141/output.0.txt @@ -0,0 +1 @@ +0.75 diff --git a/codenet/public_test_cases/p02141/output.1.txt b/codenet/public_test_cases/p02141/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..39c64a9f26e9c671497e5ad55583caecd1413dbc --- /dev/null +++ b/codenet/public_test_cases/p02141/output.1.txt @@ -0,0 +1 @@ +0.75 diff --git a/codenet/public_test_cases/p02141/output.2.txt b/codenet/public_test_cases/p02141/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02141/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02142/input.0.txt b/codenet/public_test_cases/p02142/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9537ecd70e8be57a5a12b97f42aeefa05c828b72 --- /dev/null +++ b/codenet/public_test_cases/p02142/input.0.txt @@ -0,0 +1,2 @@ +2 1 1 2 +1 2 1 100 diff --git a/codenet/public_test_cases/p02142/input.1.txt b/codenet/public_test_cases/p02142/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9537ecd70e8be57a5a12b97f42aeefa05c828b72 --- /dev/null +++ b/codenet/public_test_cases/p02142/input.1.txt @@ -0,0 +1,2 @@ +2 1 1 2 +1 2 1 100 diff --git a/codenet/public_test_cases/p02142/input.2.txt b/codenet/public_test_cases/p02142/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..73b56e066874c79c694e977a0afd69d79cb31384 --- /dev/null +++ b/codenet/public_test_cases/p02142/input.2.txt @@ -0,0 +1,2 @@ +3 1 1 3 +1 2 1 1 diff --git a/codenet/public_test_cases/p02142/input.3.txt b/codenet/public_test_cases/p02142/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d375d9f17ebcb8dd60cab26101355604df17f5 --- /dev/null +++ b/codenet/public_test_cases/p02142/input.3.txt @@ -0,0 +1,4 @@ +3 3 1 3 +1 2 1 1 +2 3 1 6 +2 3 50 100 diff --git a/codenet/public_test_cases/p02142/input.4.txt b/codenet/public_test_cases/p02142/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffd6be0314c1f9c87074649dec96ab661f2f5029 --- /dev/null +++ b/codenet/public_test_cases/p02142/input.4.txt @@ -0,0 +1,2 @@ +2 1 1 2 +1 2 50 100 diff --git a/codenet/public_test_cases/p02142/input.5.txt b/codenet/public_test_cases/p02142/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ac497cdded74584d4f8bf12e544c6b05080e75b --- /dev/null +++ b/codenet/public_test_cases/p02142/input.5.txt @@ -0,0 +1,4 @@ +3 3 1 3 +1 2 10 100 +2 3 1 6 +2 3 50 100 diff --git a/codenet/public_test_cases/p02142/output.0.txt b/codenet/public_test_cases/p02142/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p02142/output.0.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p02142/output.1.txt b/codenet/public_test_cases/p02142/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p02142/output.1.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p02142/output.2.txt b/codenet/public_test_cases/p02142/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02142/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02142/output.3.txt b/codenet/public_test_cases/p02142/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02142/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02142/output.4.txt b/codenet/public_test_cases/p02142/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02142/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02142/output.5.txt b/codenet/public_test_cases/p02142/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02142/output.5.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02143/input.0.txt b/codenet/public_test_cases/p02143/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e73a8ef8f849ba98947a35d58491e17b825668cd --- /dev/null +++ b/codenet/public_test_cases/p02143/input.0.txt @@ -0,0 +1,4 @@ +5 3 +1 4 +3 7 +0 1000 diff --git a/codenet/public_test_cases/p02143/input.1.txt b/codenet/public_test_cases/p02143/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d36d999d22ad57318bf0d42c1f467a2f6d75b01 --- /dev/null +++ b/codenet/public_test_cases/p02143/input.1.txt @@ -0,0 +1,13 @@ +14 12 +1 4 +2 3 +0 5 +1 4 +1 2 +0 8 +0 2 +0 10 +0 1 +0 8 +3 10 +1 10 diff --git a/codenet/public_test_cases/p02143/input.2.txt b/codenet/public_test_cases/p02143/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e73a8ef8f849ba98947a35d58491e17b825668cd --- /dev/null +++ b/codenet/public_test_cases/p02143/input.2.txt @@ -0,0 +1,4 @@ +5 3 +1 4 +3 7 +0 1000 diff --git a/codenet/public_test_cases/p02143/output.0.txt b/codenet/public_test_cases/p02143/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38a838ceb59edb7dcf3177ea88273f992704f04c --- /dev/null +++ b/codenet/public_test_cases/p02143/output.0.txt @@ -0,0 +1,5 @@ +7 +10 +9 +5 +8 diff --git a/codenet/public_test_cases/p02143/output.1.txt b/codenet/public_test_cases/p02143/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a8b9fca9ef04b3a19829308568d4a408c0dfeaa --- /dev/null +++ b/codenet/public_test_cases/p02143/output.1.txt @@ -0,0 +1,14 @@ +15 +24 +25 +31 +35 +44 +32 +25 +24 +15 +16 +25 +31 +40 diff --git a/codenet/public_test_cases/p02143/output.2.txt b/codenet/public_test_cases/p02143/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..38a838ceb59edb7dcf3177ea88273f992704f04c --- /dev/null +++ b/codenet/public_test_cases/p02143/output.2.txt @@ -0,0 +1,5 @@ +7 +10 +9 +5 +8 diff --git a/codenet/public_test_cases/p02144/input.0.txt b/codenet/public_test_cases/p02144/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88432e68c0b9c7687aeeb6a5c537d637dbe9e865 --- /dev/null +++ b/codenet/public_test_cases/p02144/input.0.txt @@ -0,0 +1,3 @@ +2 +1 1 +0 diff --git a/codenet/public_test_cases/p02144/input.1.txt b/codenet/public_test_cases/p02144/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1485556d60c6aa84d8a0334e931ae6cfdaa3ddc --- /dev/null +++ b/codenet/public_test_cases/p02144/input.1.txt @@ -0,0 +1,6 @@ +5 +1 2 +1 3 +2 1 2 +3 1 3 5 +0 diff --git a/codenet/public_test_cases/p02144/input.2.txt b/codenet/public_test_cases/p02144/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..88432e68c0b9c7687aeeb6a5c537d637dbe9e865 --- /dev/null +++ b/codenet/public_test_cases/p02144/input.2.txt @@ -0,0 +1,3 @@ +2 +1 1 +0 diff --git a/codenet/public_test_cases/p02144/input.3.txt b/codenet/public_test_cases/p02144/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9007f5c0a4dc441d8db80533af84e0b2e1bc1e5 --- /dev/null +++ b/codenet/public_test_cases/p02144/input.3.txt @@ -0,0 +1,4 @@ +3 +3 2 1 2 +0 +1 2 diff --git a/codenet/public_test_cases/p02144/output.0.txt b/codenet/public_test_cases/p02144/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02144/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02144/output.1.txt b/codenet/public_test_cases/p02144/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02144/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02144/output.2.txt b/codenet/public_test_cases/p02144/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02144/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02144/output.3.txt b/codenet/public_test_cases/p02144/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02144/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02145/input.0.txt b/codenet/public_test_cases/p02145/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf298e83bbac984727f7719a46529464c432382b --- /dev/null +++ b/codenet/public_test_cases/p02145/input.0.txt @@ -0,0 +1,6 @@ +5 +you +ate +my +hum +toast diff --git a/codenet/public_test_cases/p02145/input.1.txt b/codenet/public_test_cases/p02145/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf298e83bbac984727f7719a46529464c432382b --- /dev/null +++ b/codenet/public_test_cases/p02145/input.1.txt @@ -0,0 +1,6 @@ +5 +you +ate +my +hum +toast diff --git a/codenet/public_test_cases/p02145/input.2.txt b/codenet/public_test_cases/p02145/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5440c308a166d3f145b467b6c115d0678f05a2a2 --- /dev/null +++ b/codenet/public_test_cases/p02145/input.2.txt @@ -0,0 +1,8 @@ +7 +she +sells +sea +shells +by +the +seashore diff --git a/codenet/public_test_cases/p02145/output.0.txt b/codenet/public_test_cases/p02145/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e76536d672fec89e0fc7923f4b6ea3323828ad8 --- /dev/null +++ b/codenet/public_test_cases/p02145/output.0.txt @@ -0,0 +1,3 @@ +e +t +u diff --git a/codenet/public_test_cases/p02145/output.1.txt b/codenet/public_test_cases/p02145/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e76536d672fec89e0fc7923f4b6ea3323828ad8 --- /dev/null +++ b/codenet/public_test_cases/p02145/output.1.txt @@ -0,0 +1,3 @@ +e +t +u diff --git a/codenet/public_test_cases/p02145/output.2.txt b/codenet/public_test_cases/p02145/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cba1724e0c7e5feb7797b358ae5da3068b02174 --- /dev/null +++ b/codenet/public_test_cases/p02145/output.2.txt @@ -0,0 +1,3 @@ +a +e +y diff --git a/codenet/public_test_cases/p02146/input.0.txt b/codenet/public_test_cases/p02146/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8099cc1c989fe890351cc302cf59ef67c98b1fe1 --- /dev/null +++ b/codenet/public_test_cases/p02146/input.0.txt @@ -0,0 +1,6 @@ +5 +4 0 4 0 0 +1 2 +1 3 +1 4 +2 5 diff --git a/codenet/public_test_cases/p02146/input.1.txt b/codenet/public_test_cases/p02146/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8099cc1c989fe890351cc302cf59ef67c98b1fe1 --- /dev/null +++ b/codenet/public_test_cases/p02146/input.1.txt @@ -0,0 +1,6 @@ +5 +4 0 4 0 0 +1 2 +1 3 +1 4 +2 5 diff --git a/codenet/public_test_cases/p02146/input.2.txt b/codenet/public_test_cases/p02146/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..567736aa8da41b98659f3a31919d852496a888c8 --- /dev/null +++ b/codenet/public_test_cases/p02146/input.2.txt @@ -0,0 +1,8 @@ +7 +0 7 2 5 0 3 0 +1 2 +1 3 +1 4 +2 5 +3 6 +3 7 diff --git a/codenet/public_test_cases/p02146/output.0.txt b/codenet/public_test_cases/p02146/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02146/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02146/output.1.txt b/codenet/public_test_cases/p02146/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02146/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02146/output.2.txt b/codenet/public_test_cases/p02146/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02146/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02147/input.0.txt b/codenet/public_test_cases/p02147/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9ea5a4307e6a8957c7d54645c6cd52cf972fb3e --- /dev/null +++ b/codenet/public_test_cases/p02147/input.0.txt @@ -0,0 +1,10 @@ +4 +2 3 +1 2 +2 1 +3 2 +4 +1 3 +1 1 +3 3 +3 1 diff --git a/codenet/public_test_cases/p02147/input.1.txt b/codenet/public_test_cases/p02147/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9ea5a4307e6a8957c7d54645c6cd52cf972fb3e --- /dev/null +++ b/codenet/public_test_cases/p02147/input.1.txt @@ -0,0 +1,10 @@ +4 +2 3 +1 2 +2 1 +3 2 +4 +1 3 +1 1 +3 3 +3 1 diff --git a/codenet/public_test_cases/p02147/input.2.txt b/codenet/public_test_cases/p02147/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bbd459797d3b747de774e4ba0b4a3c819f897576 --- /dev/null +++ b/codenet/public_test_cases/p02147/input.2.txt @@ -0,0 +1,26 @@ +7 +-96469 25422 +-55204 -45592 +-29140 -72981 +98837 -86795 +92303 63297 +19059 96012 +-67980 70342 +17 +-4265 -14331 +33561 72343 +52055 98952 +-71189 60872 +10459 -7512 +-11981 57756 +-78228 -28044 +37397 -69980 +-27527 -51966 +22661 -16694 +13759 -59976 +86539 -47703 +17098 31709 +-62497 -70998 +-57608 59799 +-1904 -35574 +-73860 121 diff --git a/codenet/public_test_cases/p02147/output.0.txt b/codenet/public_test_cases/p02147/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f912f7ce818c32feaf4683cd68955ccea4738c1 --- /dev/null +++ b/codenet/public_test_cases/p02147/output.0.txt @@ -0,0 +1 @@ +1.414213562373 diff --git a/codenet/public_test_cases/p02147/output.1.txt b/codenet/public_test_cases/p02147/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f912f7ce818c32feaf4683cd68955ccea4738c1 --- /dev/null +++ b/codenet/public_test_cases/p02147/output.1.txt @@ -0,0 +1 @@ +1.414213562373 diff --git a/codenet/public_test_cases/p02147/output.2.txt b/codenet/public_test_cases/p02147/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f5c5e5725594133b5bb27a6a86d02f3582bd117 --- /dev/null +++ b/codenet/public_test_cases/p02147/output.2.txt @@ -0,0 +1 @@ +75307.220122044484 diff --git a/codenet/public_test_cases/p02148/input.0.txt b/codenet/public_test_cases/p02148/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bdb58a8dd80603bfbffff261189dbd1c2ae6ed1 --- /dev/null +++ b/codenet/public_test_cases/p02148/input.0.txt @@ -0,0 +1,6 @@ +3 3 +0 2 +1 2 +1 1 0 0 1 +0 0 2 +0 0 1 diff --git a/codenet/public_test_cases/p02148/input.1.txt b/codenet/public_test_cases/p02148/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2dfdbffeaeacf409b2b0aa8791ab731b083dd2d3 --- /dev/null +++ b/codenet/public_test_cases/p02148/input.1.txt @@ -0,0 +1,11 @@ +5 6 +1 0 +2 0 +3 2 +4 1 +1 1 4 0 4 +0 4 1 +1 3 0 7 3 +0 2 2 +1 4 1 8 0 +0 4 2 diff --git a/codenet/public_test_cases/p02148/input.2.txt b/codenet/public_test_cases/p02148/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bdb58a8dd80603bfbffff261189dbd1c2ae6ed1 --- /dev/null +++ b/codenet/public_test_cases/p02148/input.2.txt @@ -0,0 +1,6 @@ +3 3 +0 2 +1 2 +1 1 0 0 1 +0 0 2 +0 0 1 diff --git a/codenet/public_test_cases/p02148/output.0.txt b/codenet/public_test_cases/p02148/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c8806279fa7d6b7d04418a47e21b7e89ab18f8 --- /dev/null +++ b/codenet/public_test_cases/p02148/output.0.txt @@ -0,0 +1,2 @@ +3 +3 diff --git a/codenet/public_test_cases/p02148/output.1.txt b/codenet/public_test_cases/p02148/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..36f8b28742d77586dfe0f6605833d5c4fff9e3e5 --- /dev/null +++ b/codenet/public_test_cases/p02148/output.1.txt @@ -0,0 +1,3 @@ +4 +10 +43 diff --git a/codenet/public_test_cases/p02148/output.2.txt b/codenet/public_test_cases/p02148/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c8806279fa7d6b7d04418a47e21b7e89ab18f8 --- /dev/null +++ b/codenet/public_test_cases/p02148/output.2.txt @@ -0,0 +1,2 @@ +3 +3 diff --git a/codenet/public_test_cases/p02149/input.0.txt b/codenet/public_test_cases/p02149/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc08d380a0df0e3aad592e546f98b5699bba79f5 --- /dev/null +++ b/codenet/public_test_cases/p02149/input.0.txt @@ -0,0 +1 @@ +1000 900 850 diff --git a/codenet/public_test_cases/p02149/input.1.txt b/codenet/public_test_cases/p02149/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d482309211f7f4234976aa93b75308fbcd23405 --- /dev/null +++ b/codenet/public_test_cases/p02149/input.1.txt @@ -0,0 +1 @@ +1000 800 1200 diff --git a/codenet/public_test_cases/p02149/input.2.txt b/codenet/public_test_cases/p02149/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc08d380a0df0e3aad592e546f98b5699bba79f5 --- /dev/null +++ b/codenet/public_test_cases/p02149/input.2.txt @@ -0,0 +1 @@ +1000 900 850 diff --git a/codenet/public_test_cases/p02149/output.0.txt b/codenet/public_test_cases/p02149/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70f10e4db19068f79bc43844b49f3eece45c4e8 --- /dev/null +++ b/codenet/public_test_cases/p02149/output.0.txt @@ -0,0 +1 @@ +A diff --git a/codenet/public_test_cases/p02149/output.1.txt b/codenet/public_test_cases/p02149/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cc58df83752123644fef39faab2393af643b1d2 --- /dev/null +++ b/codenet/public_test_cases/p02149/output.1.txt @@ -0,0 +1 @@ +C diff --git a/codenet/public_test_cases/p02149/output.2.txt b/codenet/public_test_cases/p02149/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70f10e4db19068f79bc43844b49f3eece45c4e8 --- /dev/null +++ b/codenet/public_test_cases/p02149/output.2.txt @@ -0,0 +1 @@ +A diff --git a/codenet/public_test_cases/p02150/input.0.txt b/codenet/public_test_cases/p02150/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac99b57fb36f4cfbc71cf64e84ca4189bf95314 --- /dev/null +++ b/codenet/public_test_cases/p02150/input.0.txt @@ -0,0 +1 @@ +3 1 5 diff --git a/codenet/public_test_cases/p02150/input.1.txt b/codenet/public_test_cases/p02150/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e44829d23a48d389d263f7b02e3e6fb4229405e5 --- /dev/null +++ b/codenet/public_test_cases/p02150/input.1.txt @@ -0,0 +1 @@ +316250877917604 316250877917599 681260158257385 diff --git a/codenet/public_test_cases/p02150/input.2.txt b/codenet/public_test_cases/p02150/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac99b57fb36f4cfbc71cf64e84ca4189bf95314 --- /dev/null +++ b/codenet/public_test_cases/p02150/input.2.txt @@ -0,0 +1 @@ +3 1 5 diff --git a/codenet/public_test_cases/p02150/input.3.txt b/codenet/public_test_cases/p02150/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..174db49ad5f4d79ba00459004c57f496c3625b1d --- /dev/null +++ b/codenet/public_test_cases/p02150/input.3.txt @@ -0,0 +1 @@ +82 69 64 diff --git a/codenet/public_test_cases/p02150/input.4.txt b/codenet/public_test_cases/p02150/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c60e9bd8d9006eff867c0f6b801f777f0e7e0e55 --- /dev/null +++ b/codenet/public_test_cases/p02150/input.4.txt @@ -0,0 +1 @@ +3 2 5 diff --git a/codenet/public_test_cases/p02150/output.0.txt b/codenet/public_test_cases/p02150/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02150/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02150/output.1.txt b/codenet/public_test_cases/p02150/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12637fd3793671a45d5e102eef799e51c7738245 --- /dev/null +++ b/codenet/public_test_cases/p02150/output.1.txt @@ -0,0 +1 @@ +62687552 diff --git a/codenet/public_test_cases/p02150/output.2.txt b/codenet/public_test_cases/p02150/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02150/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02150/output.3.txt b/codenet/public_test_cases/p02150/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p02150/output.3.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p02150/output.4.txt b/codenet/public_test_cases/p02150/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02150/output.4.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02151/input.0.txt b/codenet/public_test_cases/p02151/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..10927ce80fe725150778889fb2e573626b52c266 --- /dev/null +++ b/codenet/public_test_cases/p02151/input.0.txt @@ -0,0 +1,2 @@ +10 +1236547896 diff --git a/codenet/public_test_cases/p02151/input.1.txt b/codenet/public_test_cases/p02151/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..10927ce80fe725150778889fb2e573626b52c266 --- /dev/null +++ b/codenet/public_test_cases/p02151/input.1.txt @@ -0,0 +1,2 @@ +10 +1236547896 diff --git a/codenet/public_test_cases/p02151/input.2.txt b/codenet/public_test_cases/p02151/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..badb3c79707d950e401d420990563f556f1524c3 --- /dev/null +++ b/codenet/public_test_cases/p02151/input.2.txt @@ -0,0 +1,2 @@ +11 +31415926535 diff --git a/codenet/public_test_cases/p02151/output.0.txt b/codenet/public_test_cases/p02151/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af7864ba2f0389876c025ba98a11cc2a7e8d139e --- /dev/null +++ b/codenet/public_test_cases/p02151/output.0.txt @@ -0,0 +1,3 @@ +123 +456 +789 diff --git a/codenet/public_test_cases/p02151/output.1.txt b/codenet/public_test_cases/p02151/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af7864ba2f0389876c025ba98a11cc2a7e8d139e --- /dev/null +++ b/codenet/public_test_cases/p02151/output.1.txt @@ -0,0 +1,3 @@ +123 +456 +789 diff --git a/codenet/public_test_cases/p02151/output.2.txt b/codenet/public_test_cases/p02151/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cac6ad4cd4c9850da3be00e38ccb30abdff25b8 --- /dev/null +++ b/codenet/public_test_cases/p02151/output.2.txt @@ -0,0 +1,3 @@ +137 +456 +892 diff --git a/codenet/public_test_cases/p02152/input.0.txt b/codenet/public_test_cases/p02152/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0537d56687614227fe372e25c7d285efd469124f --- /dev/null +++ b/codenet/public_test_cases/p02152/input.0.txt @@ -0,0 +1,2 @@ +2 +5 3 diff --git a/codenet/public_test_cases/p02152/input.1.txt b/codenet/public_test_cases/p02152/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58770b707cf81eb57e6a22743892cf8c9a107bc5 --- /dev/null +++ b/codenet/public_test_cases/p02152/input.1.txt @@ -0,0 +1,2 @@ +7 +3 1 9 2 2 5 1 diff --git a/codenet/public_test_cases/p02152/input.2.txt b/codenet/public_test_cases/p02152/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe766fec0daa79362fc3590c7c0dfd15a00ddb0f --- /dev/null +++ b/codenet/public_test_cases/p02152/input.2.txt @@ -0,0 +1,2 @@ +3 +6 1 4 diff --git a/codenet/public_test_cases/p02152/input.3.txt b/codenet/public_test_cases/p02152/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0537d56687614227fe372e25c7d285efd469124f --- /dev/null +++ b/codenet/public_test_cases/p02152/input.3.txt @@ -0,0 +1,2 @@ +2 +5 3 diff --git a/codenet/public_test_cases/p02152/output.0.txt b/codenet/public_test_cases/p02152/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7e94d8b4cd750e7a8d5e3f4879da3470870e3a9 --- /dev/null +++ b/codenet/public_test_cases/p02152/output.0.txt @@ -0,0 +1 @@ +2.83333333 diff --git a/codenet/public_test_cases/p02152/output.1.txt b/codenet/public_test_cases/p02152/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b8efac17e8f128523fc902beb029855dc77fcd7 --- /dev/null +++ b/codenet/public_test_cases/p02152/output.1.txt @@ -0,0 +1 @@ +12.37500000 diff --git a/codenet/public_test_cases/p02152/output.2.txt b/codenet/public_test_cases/p02152/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..02d2312c51391b0727c23564c4a078e447eb5c68 --- /dev/null +++ b/codenet/public_test_cases/p02152/output.2.txt @@ -0,0 +1 @@ +6.25000000 diff --git a/codenet/public_test_cases/p02152/output.3.txt b/codenet/public_test_cases/p02152/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7e94d8b4cd750e7a8d5e3f4879da3470870e3a9 --- /dev/null +++ b/codenet/public_test_cases/p02152/output.3.txt @@ -0,0 +1 @@ +2.83333333 diff --git a/codenet/public_test_cases/p02153/input.0.txt b/codenet/public_test_cases/p02153/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3122fef4e24f3f24f7677c8ee93c8c5ca5c11b57 --- /dev/null +++ b/codenet/public_test_cases/p02153/input.0.txt @@ -0,0 +1,5 @@ +4 4 1 1 +g#.. +#... +.*.. +...s diff --git a/codenet/public_test_cases/p02153/input.1.txt b/codenet/public_test_cases/p02153/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d29e3447f73d325941fa8a8e74208aec450e9f1f --- /dev/null +++ b/codenet/public_test_cases/p02153/input.1.txt @@ -0,0 +1,3 @@ +2 4 1 1 +g +s### diff --git a/codenet/public_test_cases/p02153/input.2.txt b/codenet/public_test_cases/p02153/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4e9231dd0c13341dbc44e44cf9ed16aed7ea10 --- /dev/null +++ b/codenet/public_test_cases/p02153/input.2.txt @@ -0,0 +1,5 @@ +4 4 1 1 +g#.. +... +.*.. +...s diff --git a/codenet/public_test_cases/p02153/input.3.txt b/codenet/public_test_cases/p02153/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..86af6e394628e990fc8e18c52505569daea61dbb --- /dev/null +++ b/codenet/public_test_cases/p02153/input.3.txt @@ -0,0 +1,4 @@ +3 3 10 1 +g.. +. +s.. diff --git a/codenet/public_test_cases/p02153/input.4.txt b/codenet/public_test_cases/p02153/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0f45d35a0d87460ee6ae1fc493f6b6c5974b075 --- /dev/null +++ b/codenet/public_test_cases/p02153/input.4.txt @@ -0,0 +1,5 @@ +4 4 1 1 +g#.. +*.. +.... +...s diff --git a/codenet/public_test_cases/p02153/input.5.txt b/codenet/public_test_cases/p02153/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3122fef4e24f3f24f7677c8ee93c8c5ca5c11b57 --- /dev/null +++ b/codenet/public_test_cases/p02153/input.5.txt @@ -0,0 +1,5 @@ +4 4 1 1 +g#.. +#... +.*.. +...s diff --git a/codenet/public_test_cases/p02153/input.6.txt b/codenet/public_test_cases/p02153/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaeb7b190e27c6e485e091fa207db5ec45b482ed --- /dev/null +++ b/codenet/public_test_cases/p02153/input.6.txt @@ -0,0 +1,4 @@ +3 3 1 10 +g.. +. +s.. diff --git a/codenet/public_test_cases/p02153/output.0.txt b/codenet/public_test_cases/p02153/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02153/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02153/output.1.txt b/codenet/public_test_cases/p02153/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02153/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02153/output.2.txt b/codenet/public_test_cases/p02153/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02153/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02153/output.3.txt b/codenet/public_test_cases/p02153/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p02153/output.3.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p02153/output.4.txt b/codenet/public_test_cases/p02153/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..771404d0bcf5f089a5a3cac0e2acb23b5f3bda92 --- /dev/null +++ b/codenet/public_test_cases/p02153/output.4.txt @@ -0,0 +1 @@ +INF diff --git a/codenet/public_test_cases/p02153/output.5.txt b/codenet/public_test_cases/p02153/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02153/output.5.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02153/output.6.txt b/codenet/public_test_cases/p02153/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02153/output.6.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02154/input.0.txt b/codenet/public_test_cases/p02154/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..868d164e618dae0aa5925f7ef26e1c5a20d466e5 --- /dev/null +++ b/codenet/public_test_cases/p02154/input.0.txt @@ -0,0 +1,5 @@ +4 +2 3 +1 2 +2 1 +3 2 diff --git a/codenet/public_test_cases/p02154/input.1.txt b/codenet/public_test_cases/p02154/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..868d164e618dae0aa5925f7ef26e1c5a20d466e5 --- /dev/null +++ b/codenet/public_test_cases/p02154/input.1.txt @@ -0,0 +1,5 @@ +4 +2 3 +1 2 +2 1 +3 2 diff --git a/codenet/public_test_cases/p02154/input.2.txt b/codenet/public_test_cases/p02154/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48b2d939d9d24a8f717f43d08f0f2200752e4a42 --- /dev/null +++ b/codenet/public_test_cases/p02154/input.2.txt @@ -0,0 +1,8 @@ +7 +-96469 25422 +-55204 -45592 +-29140 -72981 +98837 -86795 +92303 63297 +19059 96012 +-67980 70342 diff --git a/codenet/public_test_cases/p02154/output.0.txt b/codenet/public_test_cases/p02154/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b3e6ed2a0da055c958941328e0d754b987847b7 --- /dev/null +++ b/codenet/public_test_cases/p02154/output.0.txt @@ -0,0 +1 @@ +3.04720672 diff --git a/codenet/public_test_cases/p02154/output.1.txt b/codenet/public_test_cases/p02154/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b3e6ed2a0da055c958941328e0d754b987847b7 --- /dev/null +++ b/codenet/public_test_cases/p02154/output.1.txt @@ -0,0 +1 @@ +3.04720672 diff --git a/codenet/public_test_cases/p02154/output.2.txt b/codenet/public_test_cases/p02154/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..19936edec28a18e2a7d7db3c0eaabc41e8aa67df --- /dev/null +++ b/codenet/public_test_cases/p02154/output.2.txt @@ -0,0 +1 @@ +310622.35426197 diff --git a/codenet/public_test_cases/p02155/input.0.txt b/codenet/public_test_cases/p02155/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6041d9e33df95aa22e6af7aa7d5ec6cb4666e08a --- /dev/null +++ b/codenet/public_test_cases/p02155/input.0.txt @@ -0,0 +1,2 @@ +1 1 +2 diff --git a/codenet/public_test_cases/p02155/input.1.txt b/codenet/public_test_cases/p02155/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..93e7d893641408862ffe16f620a479526924c75f --- /dev/null +++ b/codenet/public_test_cases/p02155/input.1.txt @@ -0,0 +1,2 @@ +3 5 +10 8 4 diff --git a/codenet/public_test_cases/p02155/input.2.txt b/codenet/public_test_cases/p02155/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee21ef4a21a5c3aaa548b3ca560eb7318bf19cee --- /dev/null +++ b/codenet/public_test_cases/p02155/input.2.txt @@ -0,0 +1,2 @@ +4 10 +3 8 5 2 diff --git a/codenet/public_test_cases/p02155/input.3.txt b/codenet/public_test_cases/p02155/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1906082e317c9c0b83a4d25e72f24458ea9f6844 --- /dev/null +++ b/codenet/public_test_cases/p02155/input.3.txt @@ -0,0 +1,2 @@ +2 25 +19 19 diff --git a/codenet/public_test_cases/p02155/input.4.txt b/codenet/public_test_cases/p02155/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6041d9e33df95aa22e6af7aa7d5ec6cb4666e08a --- /dev/null +++ b/codenet/public_test_cases/p02155/input.4.txt @@ -0,0 +1,2 @@ +1 1 +2 diff --git a/codenet/public_test_cases/p02155/output.0.txt b/codenet/public_test_cases/p02155/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p02155/output.0.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p02155/output.1.txt b/codenet/public_test_cases/p02155/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p02155/output.1.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p02155/output.2.txt b/codenet/public_test_cases/p02155/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p02155/output.2.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p02155/output.3.txt b/codenet/public_test_cases/p02155/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p02155/output.3.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p02155/output.4.txt b/codenet/public_test_cases/p02155/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p02155/output.4.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p02156/input.0.txt b/codenet/public_test_cases/p02156/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f028bcfdc25b235693ce2cf94699e0e51b2ab693 --- /dev/null +++ b/codenet/public_test_cases/p02156/input.0.txt @@ -0,0 +1,4 @@ +3 1 +RRL +5 5 1 +3 1 10 diff --git a/codenet/public_test_cases/p02156/input.1.txt b/codenet/public_test_cases/p02156/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f028bcfdc25b235693ce2cf94699e0e51b2ab693 --- /dev/null +++ b/codenet/public_test_cases/p02156/input.1.txt @@ -0,0 +1,4 @@ +3 1 +RRL +5 5 1 +3 1 10 diff --git a/codenet/public_test_cases/p02156/input.2.txt b/codenet/public_test_cases/p02156/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..19703281c52d394d3e9f39b3e609b40d5b11f619 --- /dev/null +++ b/codenet/public_test_cases/p02156/input.2.txt @@ -0,0 +1,8 @@ +5 5 +RLRLL +9 5 1 3 10 +1 3 5 +2 4 9 +4 2 16 +1 5 2 +3 5 10 diff --git a/codenet/public_test_cases/p02156/output.0.txt b/codenet/public_test_cases/p02156/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02156/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02156/output.1.txt b/codenet/public_test_cases/p02156/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02156/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02156/output.2.txt b/codenet/public_test_cases/p02156/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02156/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02157/input.0.txt b/codenet/public_test_cases/p02157/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33a89f520491be5c77afa362ab4eb83f1ccdbc45 --- /dev/null +++ b/codenet/public_test_cases/p02157/input.0.txt @@ -0,0 +1 @@ +4 2 1 1 diff --git a/codenet/public_test_cases/p02157/input.1.txt b/codenet/public_test_cases/p02157/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3d90b3507ccd73ed8092a0b9ca3ec57b9909efc --- /dev/null +++ b/codenet/public_test_cases/p02157/input.1.txt @@ -0,0 +1 @@ +4 2 3 1 diff --git a/codenet/public_test_cases/p02157/input.2.txt b/codenet/public_test_cases/p02157/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..89504a3f8d573b9598988f71ff51d7011ce77633 --- /dev/null +++ b/codenet/public_test_cases/p02157/input.2.txt @@ -0,0 +1 @@ +7834164883628 15 2189823423122 5771212644938 diff --git a/codenet/public_test_cases/p02157/input.3.txt b/codenet/public_test_cases/p02157/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..33a89f520491be5c77afa362ab4eb83f1ccdbc45 --- /dev/null +++ b/codenet/public_test_cases/p02157/input.3.txt @@ -0,0 +1 @@ +4 2 1 1 diff --git a/codenet/public_test_cases/p02157/input.4.txt b/codenet/public_test_cases/p02157/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..335e6105ba5ca48ff49c55dc3ecccbc7b1acd39e --- /dev/null +++ b/codenet/public_test_cases/p02157/input.4.txt @@ -0,0 +1 @@ +4 1 1 4 diff --git a/codenet/public_test_cases/p02157/output.0.txt b/codenet/public_test_cases/p02157/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa47d0d46d47a06090f436b0b851b76bb6f3b6e2 --- /dev/null +++ b/codenet/public_test_cases/p02157/output.0.txt @@ -0,0 +1,2 @@ +0 +0 diff --git a/codenet/public_test_cases/p02157/output.1.txt b/codenet/public_test_cases/p02157/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d66ea1aee9527bfa39185ead1f9cdbd96bba88c --- /dev/null +++ b/codenet/public_test_cases/p02157/output.1.txt @@ -0,0 +1,2 @@ +0 +1 diff --git a/codenet/public_test_cases/p02157/output.2.txt b/codenet/public_test_cases/p02157/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d6457d15c22df994f500edfe4097c3fc0de2360 --- /dev/null +++ b/codenet/public_test_cases/p02157/output.2.txt @@ -0,0 +1,15 @@ +0 +1 +1 +1 +1 +1 +0 +1 +0 +1 +0 +0 +0 +0 +0 diff --git a/codenet/public_test_cases/p02157/output.3.txt b/codenet/public_test_cases/p02157/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa47d0d46d47a06090f436b0b851b76bb6f3b6e2 --- /dev/null +++ b/codenet/public_test_cases/p02157/output.3.txt @@ -0,0 +1,2 @@ +0 +0 diff --git a/codenet/public_test_cases/p02157/output.4.txt b/codenet/public_test_cases/p02157/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02157/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02158/input.0.txt b/codenet/public_test_cases/p02158/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2b4bdadeb6b86bba38ef8cd75c4d2069bd93b5d --- /dev/null +++ b/codenet/public_test_cases/p02158/input.0.txt @@ -0,0 +1,6 @@ +100 5 +50 1 5 +50 5 10 +50 20 30 +50 40 60 +50 61 1000000 diff --git a/codenet/public_test_cases/p02158/input.1.txt b/codenet/public_test_cases/p02158/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2e870753bb3477a6f8486ef9ff0a9a5ac7505a6 --- /dev/null +++ b/codenet/public_test_cases/p02158/input.1.txt @@ -0,0 +1,16 @@ +64 15 +38 133177 927361 +48 177920 668766 +12 680425 790550 +43 6853 384115 +17 214954 723798 +62 63843 153825 +28 399349 482937 +2 336136 367001 +33 138008 733496 +6 203462 911631 +58 321974 527734 +17 696940 781678 +55 265874 507640 +41 56037 880001 +34 279422 528651 diff --git a/codenet/public_test_cases/p02158/input.2.txt b/codenet/public_test_cases/p02158/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2b4bdadeb6b86bba38ef8cd75c4d2069bd93b5d --- /dev/null +++ b/codenet/public_test_cases/p02158/input.2.txt @@ -0,0 +1,6 @@ +100 5 +50 1 5 +50 5 10 +50 20 30 +50 40 60 +50 61 1000000 diff --git a/codenet/public_test_cases/p02158/output.0.txt b/codenet/public_test_cases/p02158/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af720ead216517143bb09d799f434dcf274f3c2e --- /dev/null +++ b/codenet/public_test_cases/p02158/output.0.txt @@ -0,0 +1 @@ +48.6090201099 diff --git a/codenet/public_test_cases/p02158/output.1.txt b/codenet/public_test_cases/p02158/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..092c82a61f411b9046776d6788e0ec5ba171a942 --- /dev/null +++ b/codenet/public_test_cases/p02158/output.1.txt @@ -0,0 +1 @@ +6087.909851326286 diff --git a/codenet/public_test_cases/p02158/output.2.txt b/codenet/public_test_cases/p02158/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..af720ead216517143bb09d799f434dcf274f3c2e --- /dev/null +++ b/codenet/public_test_cases/p02158/output.2.txt @@ -0,0 +1 @@ +48.6090201099 diff --git a/codenet/public_test_cases/p02159/input.0.txt b/codenet/public_test_cases/p02159/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p02159/input.0.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p02159/input.1.txt b/codenet/public_test_cases/p02159/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..535057cd75d5577666ec41d58575f37ac4033b55 --- /dev/null +++ b/codenet/public_test_cases/p02159/input.1.txt @@ -0,0 +1,6 @@ +6 +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p02159/input.2.txt b/codenet/public_test_cases/p02159/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p02159/input.2.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p02159/input.3.txt b/codenet/public_test_cases/p02159/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f84044869b6f77845ae4206e50212d586c8a6ab --- /dev/null +++ b/codenet/public_test_cases/p02159/input.3.txt @@ -0,0 +1,20 @@ +20 +14 1 +2 1 +18 14 +10 1 +12 10 +5 1 +17 5 +7 1 +11 17 +4 1 +19 2 +15 1 +3 19 +8 15 +9 8 +20 8 +6 1 +16 15 +13 7 diff --git a/codenet/public_test_cases/p02159/input.4.txt b/codenet/public_test_cases/p02159/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1afd0a528043139ffda69e48f586095ea445862a --- /dev/null +++ b/codenet/public_test_cases/p02159/input.4.txt @@ -0,0 +1,5 @@ +5 +1 2 +1 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p02159/output.0.txt b/codenet/public_test_cases/p02159/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02159/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02159/output.1.txt b/codenet/public_test_cases/p02159/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02159/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02159/output.2.txt b/codenet/public_test_cases/p02159/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02159/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02159/output.3.txt b/codenet/public_test_cases/p02159/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..77f83230f66a0fdcfb20aea384553e2910f87712 --- /dev/null +++ b/codenet/public_test_cases/p02159/output.3.txt @@ -0,0 +1 @@ +243 diff --git a/codenet/public_test_cases/p02159/output.4.txt b/codenet/public_test_cases/p02159/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02159/output.4.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02160/input.0.txt b/codenet/public_test_cases/p02160/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1080f3168e1b6b01baa8840ea5f371d89aaf8f6 --- /dev/null +++ b/codenet/public_test_cases/p02160/input.0.txt @@ -0,0 +1,4 @@ +7 3 +1 1 2 +1 2 1 +3 1 2 4 5 diff --git a/codenet/public_test_cases/p02160/input.1.txt b/codenet/public_test_cases/p02160/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3690f76af31b705f573a7b81f5edc0d4345f3898 --- /dev/null +++ b/codenet/public_test_cases/p02160/input.1.txt @@ -0,0 +1,9 @@ +1000000007 8 +3 2 9 7 5 +3 2 9 5 1000001 +3 39 1002 65537 12 +2 1000000006 518012930 793649232 +10 459268180 313723762 835892239 612038995 90424474 366392946 38051435 854115735 5132833 320534710 421820264 +1 1 1 +1 1 1000000006 +1 1000000006 1 diff --git a/codenet/public_test_cases/p02160/input.2.txt b/codenet/public_test_cases/p02160/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1080f3168e1b6b01baa8840ea5f371d89aaf8f6 --- /dev/null +++ b/codenet/public_test_cases/p02160/input.2.txt @@ -0,0 +1,4 @@ +7 3 +1 1 2 +1 2 1 +3 1 2 4 5 diff --git a/codenet/public_test_cases/p02160/output.0.txt b/codenet/public_test_cases/p02160/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7938dcdde861e064110513be9b948f63d726d024 --- /dev/null +++ b/codenet/public_test_cases/p02160/output.0.txt @@ -0,0 +1,3 @@ +0 +1 +0 diff --git a/codenet/public_test_cases/p02160/output.1.txt b/codenet/public_test_cases/p02160/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d99961f5c6ad9d8a9084b2c518365cad8043a7ff --- /dev/null +++ b/codenet/public_test_cases/p02160/output.1.txt @@ -0,0 +1,8 @@ +0 +1 +1 +1 +0 +1 +0 +1 diff --git a/codenet/public_test_cases/p02160/output.2.txt b/codenet/public_test_cases/p02160/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7938dcdde861e064110513be9b948f63d726d024 --- /dev/null +++ b/codenet/public_test_cases/p02160/output.2.txt @@ -0,0 +1,3 @@ +0 +1 +0 diff --git a/codenet/public_test_cases/p02161/input.0.txt b/codenet/public_test_cases/p02161/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0ad187ac8d50eafd3f5c8368af9904b5ee80532 --- /dev/null +++ b/codenet/public_test_cases/p02161/input.0.txt @@ -0,0 +1,5 @@ +12 3 +itisansansan +1 12 +5 12 +6 7 diff --git a/codenet/public_test_cases/p02161/input.1.txt b/codenet/public_test_cases/p02161/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0ad187ac8d50eafd3f5c8368af9904b5ee80532 --- /dev/null +++ b/codenet/public_test_cases/p02161/input.1.txt @@ -0,0 +1,5 @@ +12 3 +itisansansan +1 12 +5 12 +6 7 diff --git a/codenet/public_test_cases/p02161/input.2.txt b/codenet/public_test_cases/p02161/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..76e71d5c803b7acbc1c661726dca22af75fa337d --- /dev/null +++ b/codenet/public_test_cases/p02161/input.2.txt @@ -0,0 +1,8 @@ +21 6 +aaaabaaaabaaaaaaaaaab +1 21 +10 21 +10 18 +4 16 +11 21 +1 6 diff --git a/codenet/public_test_cases/p02161/input.3.txt b/codenet/public_test_cases/p02161/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d87e85423c85ec4db93fe849141bfe3c6f13e60 --- /dev/null +++ b/codenet/public_test_cases/p02161/input.3.txt @@ -0,0 +1,4 @@ +20 2 +sensanbyakusanjuusan +1 20 +1 14 diff --git a/codenet/public_test_cases/p02161/output.0.txt b/codenet/public_test_cases/p02161/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p02161/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p02161/output.1.txt b/codenet/public_test_cases/p02161/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p02161/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p02161/output.2.txt b/codenet/public_test_cases/p02161/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c46498af02f16e6ed8c495772a1ce4c1e55b378 --- /dev/null +++ b/codenet/public_test_cases/p02161/output.2.txt @@ -0,0 +1,6 @@ +4 +0 +2 +2 +0 +1 diff --git a/codenet/public_test_cases/p02161/output.3.txt b/codenet/public_test_cases/p02161/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p02161/output.3.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p02162/input.0.txt b/codenet/public_test_cases/p02162/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5a8a19c40b45ef8b02e3fc8fc87cf25f9f35269 --- /dev/null +++ b/codenet/public_test_cases/p02162/input.0.txt @@ -0,0 +1 @@ +9 8 1000 999 diff --git a/codenet/public_test_cases/p02162/input.1.txt b/codenet/public_test_cases/p02162/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5a8a19c40b45ef8b02e3fc8fc87cf25f9f35269 --- /dev/null +++ b/codenet/public_test_cases/p02162/input.1.txt @@ -0,0 +1 @@ +9 8 1000 999 diff --git a/codenet/public_test_cases/p02162/input.2.txt b/codenet/public_test_cases/p02162/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..11a633316c44888ae19c6c66ae88629bf132047f --- /dev/null +++ b/codenet/public_test_cases/p02162/input.2.txt @@ -0,0 +1 @@ +9 8 2849 -1 diff --git a/codenet/public_test_cases/p02162/input.3.txt b/codenet/public_test_cases/p02162/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..105c441e037875f04cc2d63b833e4261624957c1 --- /dev/null +++ b/codenet/public_test_cases/p02162/input.3.txt @@ -0,0 +1 @@ +9 8 1000 1000 diff --git a/codenet/public_test_cases/p02162/output.0.txt b/codenet/public_test_cases/p02162/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p02162/output.0.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p02162/output.1.txt b/codenet/public_test_cases/p02162/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p02162/output.1.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p02162/output.2.txt b/codenet/public_test_cases/p02162/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p02162/output.2.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p02162/output.3.txt b/codenet/public_test_cases/p02162/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e3aa57d754e218f35f415900ed803f94c09b3df --- /dev/null +++ b/codenet/public_test_cases/p02162/output.3.txt @@ -0,0 +1 @@ +Draw diff --git a/codenet/public_test_cases/p02163/input.0.txt b/codenet/public_test_cases/p02163/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..150a8ed49603ae530776f3bd00c5ed8149f813e1 --- /dev/null +++ b/codenet/public_test_cases/p02163/input.0.txt @@ -0,0 +1,4 @@ +3 +1 2 +2 10 +3 8 diff --git a/codenet/public_test_cases/p02163/input.1.txt b/codenet/public_test_cases/p02163/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..150a8ed49603ae530776f3bd00c5ed8149f813e1 --- /dev/null +++ b/codenet/public_test_cases/p02163/input.1.txt @@ -0,0 +1,4 @@ +3 +1 2 +2 10 +3 8 diff --git a/codenet/public_test_cases/p02163/input.2.txt b/codenet/public_test_cases/p02163/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dac9b8aa7f32d7d65bb9e3073b00d46aff62101 --- /dev/null +++ b/codenet/public_test_cases/p02163/input.2.txt @@ -0,0 +1,11 @@ +10 +1 10 +1 10 +1 10 +1 10 +1 10 +1 10 +1 10 +1 10 +1 10 +1 10 diff --git a/codenet/public_test_cases/p02163/output.0.txt b/codenet/public_test_cases/p02163/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b489133c350b7e415f583fc00966212430f786f2 --- /dev/null +++ b/codenet/public_test_cases/p02163/output.0.txt @@ -0,0 +1 @@ +-2 2 diff --git a/codenet/public_test_cases/p02163/output.1.txt b/codenet/public_test_cases/p02163/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b489133c350b7e415f583fc00966212430f786f2 --- /dev/null +++ b/codenet/public_test_cases/p02163/output.1.txt @@ -0,0 +1 @@ +-2 2 diff --git a/codenet/public_test_cases/p02163/output.2.txt b/codenet/public_test_cases/p02163/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..276f392b1daebe540d170fc00da24be080ba2efc --- /dev/null +++ b/codenet/public_test_cases/p02163/output.2.txt @@ -0,0 +1 @@ +0 10000000000 diff --git a/codenet/public_test_cases/p02164/input.0.txt b/codenet/public_test_cases/p02164/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb4c11e1ab6ca3cd28e82eed47d43c297d26adf0 --- /dev/null +++ b/codenet/public_test_cases/p02164/input.0.txt @@ -0,0 +1,3 @@ +2 +0 1 +0 -1 diff --git a/codenet/public_test_cases/p02164/input.1.txt b/codenet/public_test_cases/p02164/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ff5ae097f3c2f7f4df939ca262f64a20ac4563d --- /dev/null +++ b/codenet/public_test_cases/p02164/input.1.txt @@ -0,0 +1,4 @@ +3 +1 0 +0 1 +-2 -1 diff --git a/codenet/public_test_cases/p02164/input.2.txt b/codenet/public_test_cases/p02164/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb4c11e1ab6ca3cd28e82eed47d43c297d26adf0 --- /dev/null +++ b/codenet/public_test_cases/p02164/input.2.txt @@ -0,0 +1,3 @@ +2 +0 1 +0 -1 diff --git a/codenet/public_test_cases/p02164/output.0.txt b/codenet/public_test_cases/p02164/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08854c5cc0fde4d063b8bdce7077d3a78d4ccbd8 --- /dev/null +++ b/codenet/public_test_cases/p02164/output.0.txt @@ -0,0 +1 @@ +450.00000000 diff --git a/codenet/public_test_cases/p02164/output.1.txt b/codenet/public_test_cases/p02164/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1f6d7885482ed16a5fefe1af753ec7c240ca07d --- /dev/null +++ b/codenet/public_test_cases/p02164/output.1.txt @@ -0,0 +1 @@ +386.565051 diff --git a/codenet/public_test_cases/p02164/output.2.txt b/codenet/public_test_cases/p02164/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..08854c5cc0fde4d063b8bdce7077d3a78d4ccbd8 --- /dev/null +++ b/codenet/public_test_cases/p02164/output.2.txt @@ -0,0 +1 @@ +450.00000000 diff --git a/codenet/public_test_cases/p02165/input.0.txt b/codenet/public_test_cases/p02165/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a22c32fecb0351f5eff08427a0c596133e4ae6fc --- /dev/null +++ b/codenet/public_test_cases/p02165/input.0.txt @@ -0,0 +1,9 @@ +8 5 +_###_ +_#_B# +_#### +____# +###_# +##### +###_# +####_ diff --git a/codenet/public_test_cases/p02165/input.1.txt b/codenet/public_test_cases/p02165/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba5aab0d7eba02e72cae4ff1d62cad29192561f2 --- /dev/null +++ b/codenet/public_test_cases/p02165/input.1.txt @@ -0,0 +1,5 @@ +4 5 +_#### +B## +_#### +_###_ diff --git a/codenet/public_test_cases/p02165/input.2.txt b/codenet/public_test_cases/p02165/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcc07bb197c2638044df366c9400e9348479bb0e --- /dev/null +++ b/codenet/public_test_cases/p02165/input.2.txt @@ -0,0 +1,5 @@ +4 5 +_#B## + +B## +_ diff --git a/codenet/public_test_cases/p02165/input.3.txt b/codenet/public_test_cases/p02165/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b93ce4194893dc75b365c8434662e6073a098c0 --- /dev/null +++ b/codenet/public_test_cases/p02165/input.3.txt @@ -0,0 +1,9 @@ +8 5 +_###_ +_#_B# +_#### +____# +_# + +_# +_ diff --git a/codenet/public_test_cases/p02165/input.4.txt b/codenet/public_test_cases/p02165/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a22c32fecb0351f5eff08427a0c596133e4ae6fc --- /dev/null +++ b/codenet/public_test_cases/p02165/input.4.txt @@ -0,0 +1,9 @@ +8 5 +_###_ +_#_B# +_#### +____# +###_# +##### +###_# +####_ diff --git a/codenet/public_test_cases/p02165/input.5.txt b/codenet/public_test_cases/p02165/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cd81464d9968f8fd0a38383e608aa5b0d4f9ba3 --- /dev/null +++ b/codenet/public_test_cases/p02165/input.5.txt @@ -0,0 +1,6 @@ +5 5 +_____ +_____ +_____ +_____ +_____ diff --git a/codenet/public_test_cases/p02165/output.0.txt b/codenet/public_test_cases/p02165/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02165/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02165/output.1.txt b/codenet/public_test_cases/p02165/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02165/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02165/output.2.txt b/codenet/public_test_cases/p02165/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02165/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02165/output.3.txt b/codenet/public_test_cases/p02165/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02165/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02165/output.4.txt b/codenet/public_test_cases/p02165/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02165/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02165/output.5.txt b/codenet/public_test_cases/p02165/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02165/output.5.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02166/input.0.txt b/codenet/public_test_cases/p02166/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0e3e0aa6956da383065b1492c1fa03fc9bde4b5 --- /dev/null +++ b/codenet/public_test_cases/p02166/input.0.txt @@ -0,0 +1,2 @@ +3 3 +2 3 1 diff --git a/codenet/public_test_cases/p02166/input.1.txt b/codenet/public_test_cases/p02166/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9449aaf96205d69e1287aa4d54e666c05b1e25a1 --- /dev/null +++ b/codenet/public_test_cases/p02166/input.1.txt @@ -0,0 +1,2 @@ +3 2 +1 2 3 diff --git a/codenet/public_test_cases/p02166/input.2.txt b/codenet/public_test_cases/p02166/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..15adb264c527982ce6d7a213f8051ed3107f9dd0 --- /dev/null +++ b/codenet/public_test_cases/p02166/input.2.txt @@ -0,0 +1,2 @@ +3 3 +3 2 1 diff --git a/codenet/public_test_cases/p02166/input.3.txt b/codenet/public_test_cases/p02166/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0e3e0aa6956da383065b1492c1fa03fc9bde4b5 --- /dev/null +++ b/codenet/public_test_cases/p02166/input.3.txt @@ -0,0 +1,2 @@ +3 3 +2 3 1 diff --git a/codenet/public_test_cases/p02166/output.0.txt b/codenet/public_test_cases/p02166/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02166/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02166/output.1.txt b/codenet/public_test_cases/p02166/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02166/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02166/output.2.txt b/codenet/public_test_cases/p02166/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02166/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02166/output.3.txt b/codenet/public_test_cases/p02166/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02166/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02167/input.0.txt b/codenet/public_test_cases/p02167/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c2e8e267c3658ae8e68a1f2fc29c7db6c8e57de --- /dev/null +++ b/codenet/public_test_cases/p02167/input.0.txt @@ -0,0 +1,9 @@ +3 1 6 +1 2 3 +R 1 1 +1 2 +1 3 +2 1 +2 3 +3 1 +3 2 diff --git a/codenet/public_test_cases/p02167/input.1.txt b/codenet/public_test_cases/p02167/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ec91a5bed3e89792d5115cacd57d4b05831eceb --- /dev/null +++ b/codenet/public_test_cases/p02167/input.1.txt @@ -0,0 +1,15 @@ +4 6 7 +45 72 81 47 +R 1 47202 +L 1 2156 +L 2 95728 +R 1 30739 +L 3 39679 +L 4 86568 +3 2 +3 4 +1 2 +2 4 +4 3 +1 4 +2 1 diff --git a/codenet/public_test_cases/p02167/input.2.txt b/codenet/public_test_cases/p02167/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c2e8e267c3658ae8e68a1f2fc29c7db6c8e57de --- /dev/null +++ b/codenet/public_test_cases/p02167/input.2.txt @@ -0,0 +1,9 @@ +3 1 6 +1 2 3 +R 1 1 +1 2 +1 3 +2 1 +2 3 +3 1 +3 2 diff --git a/codenet/public_test_cases/p02167/output.0.txt b/codenet/public_test_cases/p02167/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2372667839eafd9c63b95acb460bad05b6679382 --- /dev/null +++ b/codenet/public_test_cases/p02167/output.0.txt @@ -0,0 +1,6 @@ +1 +3 +6 +3 +6 +7 diff --git a/codenet/public_test_cases/p02167/output.1.txt b/codenet/public_test_cases/p02167/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..971c0db9cf1b67b75ba2de32851441864b389efd --- /dev/null +++ b/codenet/public_test_cases/p02167/output.1.txt @@ -0,0 +1,7 @@ +431200 +629552 +431200 +629552 +275968 +101332 +528220 diff --git a/codenet/public_test_cases/p02167/output.2.txt b/codenet/public_test_cases/p02167/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2372667839eafd9c63b95acb460bad05b6679382 --- /dev/null +++ b/codenet/public_test_cases/p02167/output.2.txt @@ -0,0 +1,6 @@ +1 +3 +6 +3 +6 +7 diff --git a/codenet/public_test_cases/p02168/input.0.txt b/codenet/public_test_cases/p02168/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0fe29e3e1c0dbaef5bd2e9ebacc0ef94054c0c1 --- /dev/null +++ b/codenet/public_test_cases/p02168/input.0.txt @@ -0,0 +1,2 @@ +1 +2 4 diff --git a/codenet/public_test_cases/p02168/input.1.txt b/codenet/public_test_cases/p02168/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0fe29e3e1c0dbaef5bd2e9ebacc0ef94054c0c1 --- /dev/null +++ b/codenet/public_test_cases/p02168/input.1.txt @@ -0,0 +1,2 @@ +1 +2 4 diff --git a/codenet/public_test_cases/p02168/input.2.txt b/codenet/public_test_cases/p02168/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1081a5cd188b6ff6db25415a39bacb112ba224a2 --- /dev/null +++ b/codenet/public_test_cases/p02168/input.2.txt @@ -0,0 +1,3 @@ +2 +2 3 +3 8 diff --git a/codenet/public_test_cases/p02168/input.3.txt b/codenet/public_test_cases/p02168/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..987d51e926de7cdfa77fdd594c90133f0e96e38b --- /dev/null +++ b/codenet/public_test_cases/p02168/input.3.txt @@ -0,0 +1,11 @@ +10 +2 8 +5 9 +7 20 +8 41 +23 48 +90 112 +4 5 +7 7 +2344 8923 +1 29 diff --git a/codenet/public_test_cases/p02168/output.0.txt b/codenet/public_test_cases/p02168/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7fa51572ff85b63bc5ca7c6268fdaa3b407ced7 --- /dev/null +++ b/codenet/public_test_cases/p02168/output.0.txt @@ -0,0 +1 @@ +mo3tthi diff --git a/codenet/public_test_cases/p02168/output.1.txt b/codenet/public_test_cases/p02168/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7fa51572ff85b63bc5ca7c6268fdaa3b407ced7 --- /dev/null +++ b/codenet/public_test_cases/p02168/output.1.txt @@ -0,0 +1 @@ +mo3tthi diff --git a/codenet/public_test_cases/p02168/output.2.txt b/codenet/public_test_cases/p02168/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e139ec3e0967388a4ebbc75f4336264825785844 --- /dev/null +++ b/codenet/public_test_cases/p02168/output.2.txt @@ -0,0 +1 @@ +tubuann diff --git a/codenet/public_test_cases/p02168/output.3.txt b/codenet/public_test_cases/p02168/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7fa51572ff85b63bc5ca7c6268fdaa3b407ced7 --- /dev/null +++ b/codenet/public_test_cases/p02168/output.3.txt @@ -0,0 +1 @@ +mo3tthi diff --git a/codenet/public_test_cases/p02169/input.0.txt b/codenet/public_test_cases/p02169/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..248d98c7dd9f4945da77cef819b38f82497dd7bb --- /dev/null +++ b/codenet/public_test_cases/p02169/input.0.txt @@ -0,0 +1 @@ +2 10 1 diff --git a/codenet/public_test_cases/p02169/input.1.txt b/codenet/public_test_cases/p02169/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9aca244c36820d3675b7bf06b25cf98431773d6 --- /dev/null +++ b/codenet/public_test_cases/p02169/input.1.txt @@ -0,0 +1 @@ +7 8 3 diff --git a/codenet/public_test_cases/p02169/input.2.txt b/codenet/public_test_cases/p02169/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce7d5eb7582a54899757bef957507ba7bf260982 --- /dev/null +++ b/codenet/public_test_cases/p02169/input.2.txt @@ -0,0 +1 @@ +1000000000000000000 1000000000000000000 1000 diff --git a/codenet/public_test_cases/p02169/input.3.txt b/codenet/public_test_cases/p02169/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..66fa693ce033a89f26351f2630788283230d90b6 --- /dev/null +++ b/codenet/public_test_cases/p02169/input.3.txt @@ -0,0 +1 @@ +5 10 3 diff --git a/codenet/public_test_cases/p02169/input.4.txt b/codenet/public_test_cases/p02169/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0586d9f1556dacb97f07f1951aec985277cf7d82 --- /dev/null +++ b/codenet/public_test_cases/p02169/input.4.txt @@ -0,0 +1 @@ +1 1 2 diff --git a/codenet/public_test_cases/p02169/input.5.txt b/codenet/public_test_cases/p02169/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..248d98c7dd9f4945da77cef819b38f82497dd7bb --- /dev/null +++ b/codenet/public_test_cases/p02169/input.5.txt @@ -0,0 +1 @@ +2 10 1 diff --git a/codenet/public_test_cases/p02169/output.0.txt b/codenet/public_test_cases/p02169/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7b1c440c0f3f8d42eff097800b88ac5d40263d3 --- /dev/null +++ b/codenet/public_test_cases/p02169/output.0.txt @@ -0,0 +1 @@ +1024 diff --git a/codenet/public_test_cases/p02169/output.1.txt b/codenet/public_test_cases/p02169/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..138c5bf46a7144b3401712545473fb7bac90846c --- /dev/null +++ b/codenet/public_test_cases/p02169/output.1.txt @@ -0,0 +1 @@ +5759460 diff --git a/codenet/public_test_cases/p02169/output.2.txt b/codenet/public_test_cases/p02169/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fdfa0be4d6618cded06b3391f319fec0a999c7f --- /dev/null +++ b/codenet/public_test_cases/p02169/output.2.txt @@ -0,0 +1 @@ +133611974 diff --git a/codenet/public_test_cases/p02169/output.3.txt b/codenet/public_test_cases/p02169/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..73021b546db5c7881cdcd68265f0eba1309409f8 --- /dev/null +++ b/codenet/public_test_cases/p02169/output.3.txt @@ -0,0 +1 @@ +9755400 diff --git a/codenet/public_test_cases/p02169/output.4.txt b/codenet/public_test_cases/p02169/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02169/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02169/output.5.txt b/codenet/public_test_cases/p02169/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7b1c440c0f3f8d42eff097800b88ac5d40263d3 --- /dev/null +++ b/codenet/public_test_cases/p02169/output.5.txt @@ -0,0 +1 @@ +1024 diff --git a/codenet/public_test_cases/p02170/input.0.txt b/codenet/public_test_cases/p02170/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d27e9ea291bad8e0221fe2fd8e3b3161155b66a2 --- /dev/null +++ b/codenet/public_test_cases/p02170/input.0.txt @@ -0,0 +1 @@ +1 1 50 diff --git a/codenet/public_test_cases/p02170/input.1.txt b/codenet/public_test_cases/p02170/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d27e9ea291bad8e0221fe2fd8e3b3161155b66a2 --- /dev/null +++ b/codenet/public_test_cases/p02170/input.1.txt @@ -0,0 +1 @@ +1 1 50 diff --git a/codenet/public_test_cases/p02170/input.2.txt b/codenet/public_test_cases/p02170/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff0a7ef1194aed15fc68c7181b5d8bd13b8980d0 --- /dev/null +++ b/codenet/public_test_cases/p02170/input.2.txt @@ -0,0 +1 @@ +6 10 99 diff --git a/codenet/public_test_cases/p02170/input.3.txt b/codenet/public_test_cases/p02170/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..deb694fb3282c3096b5068e5d7b9df7a2b4ed7f6 --- /dev/null +++ b/codenet/public_test_cases/p02170/input.3.txt @@ -0,0 +1 @@ +2 2 10 diff --git a/codenet/public_test_cases/p02170/output.0.txt b/codenet/public_test_cases/p02170/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02170/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02170/output.1.txt b/codenet/public_test_cases/p02170/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02170/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02170/output.2.txt b/codenet/public_test_cases/p02170/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..89793b1f82202034fc7c205a2e5de9d77d96c100 --- /dev/null +++ b/codenet/public_test_cases/p02170/output.2.txt @@ -0,0 +1 @@ +650893870 diff --git a/codenet/public_test_cases/p02170/output.3.txt b/codenet/public_test_cases/p02170/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1acc79faa6388b989c03f9ae5c8848d990fb1f0a --- /dev/null +++ b/codenet/public_test_cases/p02170/output.3.txt @@ -0,0 +1 @@ +648858830 diff --git a/codenet/public_test_cases/p02171/input.0.txt b/codenet/public_test_cases/p02171/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d280bc891a2fab0f7daf5e548da1daa18f944845 --- /dev/null +++ b/codenet/public_test_cases/p02171/input.0.txt @@ -0,0 +1,7 @@ +abab +5 5 +2 2 4 +1 1 5 abab +2 3 5 +1 3 3 a +2 1 5 diff --git a/codenet/public_test_cases/p02171/input.1.txt b/codenet/public_test_cases/p02171/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d280bc891a2fab0f7daf5e548da1daa18f944845 --- /dev/null +++ b/codenet/public_test_cases/p02171/input.1.txt @@ -0,0 +1,7 @@ +abab +5 5 +2 2 4 +1 1 5 abab +2 3 5 +1 3 3 a +2 1 5 diff --git a/codenet/public_test_cases/p02171/input.2.txt b/codenet/public_test_cases/p02171/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..741afd63961fc7de0b7dc00eb830a007a75970fc --- /dev/null +++ b/codenet/public_test_cases/p02171/input.2.txt @@ -0,0 +1,7 @@ +uku +1333 5 +2 232 423 +1 13 532 uku +2 322 567 +1 3 33 ku +2 1 333 diff --git a/codenet/public_test_cases/p02171/input.3.txt b/codenet/public_test_cases/p02171/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cf18880486d5612595d9f94ffc874732d53f621 --- /dev/null +++ b/codenet/public_test_cases/p02171/input.3.txt @@ -0,0 +1,22 @@ +aabb +1879 20 +2 69 1585 +1 415 1680 aabb +1 756 1628 abbabbaa +1 849 1273 abba +2 418 1172 +2 1063 1164 +2 203 623 +2 481 1209 +1 107 110 ababaaaab +1 857 985 bbbbabbbaa +1 868 947 aaa +1 1619 1789 aabab +2 204 844 +2 493 1422 +2 821 1499 +1 757 1817 abbabbb +2 232 911 +1 653 797 aaabaaaab +2 701 1657 +1 868 940 aaabbbaaa diff --git a/codenet/public_test_cases/p02171/output.0.txt b/codenet/public_test_cases/p02171/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5826f5ccc726de50bc8f88f04a9c688c007e216f --- /dev/null +++ b/codenet/public_test_cases/p02171/output.0.txt @@ -0,0 +1,3 @@ +0 +3 +4 diff --git a/codenet/public_test_cases/p02171/output.1.txt b/codenet/public_test_cases/p02171/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5826f5ccc726de50bc8f88f04a9c688c007e216f --- /dev/null +++ b/codenet/public_test_cases/p02171/output.1.txt @@ -0,0 +1,3 @@ +0 +3 +4 diff --git a/codenet/public_test_cases/p02171/output.2.txt b/codenet/public_test_cases/p02171/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..01f8db1fcaa8d0a173427f26a23ca87981cd506a --- /dev/null +++ b/codenet/public_test_cases/p02171/output.2.txt @@ -0,0 +1,3 @@ +0 +211 +321 diff --git a/codenet/public_test_cases/p02171/output.3.txt b/codenet/public_test_cases/p02171/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..927d5ac0f2db68715511190e2d93359c06a3587c --- /dev/null +++ b/codenet/public_test_cases/p02171/output.3.txt @@ -0,0 +1,10 @@ +0 +338 +0 +209 +275 +341 +263 +0 +341 +0 diff --git a/codenet/public_test_cases/p02172/input.0.txt b/codenet/public_test_cases/p02172/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f43c1901c737bea31691c09638adbb991a9c8166 --- /dev/null +++ b/codenet/public_test_cases/p02172/input.0.txt @@ -0,0 +1,3 @@ +0 0 10 +1 +2 diff --git a/codenet/public_test_cases/p02172/output.0.txt b/codenet/public_test_cases/p02172/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..534a21edd7244e9db55d46372c9665683c036a5d --- /dev/null +++ b/codenet/public_test_cases/p02172/output.0.txt @@ -0,0 +1 @@ +440 diff --git a/codenet/public_test_cases/p02173/input.0.txt b/codenet/public_test_cases/p02173/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12ef2b07b4f372cba614e580422dfcb76b6f83b4 --- /dev/null +++ b/codenet/public_test_cases/p02173/input.0.txt @@ -0,0 +1,4 @@ +2 1 +1 1 1 +2 2 2 +1 2 diff --git a/codenet/public_test_cases/p02173/input.1.txt b/codenet/public_test_cases/p02173/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..552b8fbaf68353861a1822df17a4729b78cf1cf8 --- /dev/null +++ b/codenet/public_test_cases/p02173/input.1.txt @@ -0,0 +1,13 @@ +6 6 +0 8 0 +2 3 0 +2 5 0 +4 3 0 +4 5 0 +6 0 0 +1 3 +2 3 +3 5 +5 4 +4 2 +4 6 diff --git a/codenet/public_test_cases/p02173/input.2.txt b/codenet/public_test_cases/p02173/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..12ef2b07b4f372cba614e580422dfcb76b6f83b4 --- /dev/null +++ b/codenet/public_test_cases/p02173/input.2.txt @@ -0,0 +1,4 @@ +2 1 +1 1 1 +2 2 2 +1 2 diff --git a/codenet/public_test_cases/p02173/input.3.txt b/codenet/public_test_cases/p02173/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6058a0f9a8300a04e987db810881fa960c9af502 --- /dev/null +++ b/codenet/public_test_cases/p02173/input.3.txt @@ -0,0 +1,5 @@ +2 2 +1 1 1 +2 2 2 +1 2 +2 1 diff --git a/codenet/public_test_cases/p02173/input.4.txt b/codenet/public_test_cases/p02173/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..682057fb2b938655ce322cc64b8009173bf53ab8 --- /dev/null +++ b/codenet/public_test_cases/p02173/input.4.txt @@ -0,0 +1,18 @@ +10 7 +-65870833 -68119923 -51337277 +-59513976 -24997697 -46968492 +-37069671 -90713666 -45043609 +-31144219 43731960 -5258464 +-27501033 90001758 13168637 +-96651565 -67773915 56786711 +44851572 -29156912 28758396 +16384813 -79097935 7386228 +88805434 -79256976 31470860 +92682611 32019492 -87335887 +6 7 +7 9 +6 5 +1 2 +2 4 +4 1 +9 8 diff --git a/codenet/public_test_cases/p02173/output.0.txt b/codenet/public_test_cases/p02173/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p02173/output.0.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p02173/output.1.txt b/codenet/public_test_cases/p02173/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd9c0565a3a33ff1ab118cb9d42dc603b567a0cd --- /dev/null +++ b/codenet/public_test_cases/p02173/output.1.txt @@ -0,0 +1,6 @@ +14 +7 +9 +5 +7 +0 diff --git a/codenet/public_test_cases/p02173/output.2.txt b/codenet/public_test_cases/p02173/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p02173/output.2.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p02173/output.3.txt b/codenet/public_test_cases/p02173/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c8806279fa7d6b7d04418a47e21b7e89ab18f8 --- /dev/null +++ b/codenet/public_test_cases/p02173/output.3.txt @@ -0,0 +1,2 @@ +3 +3 diff --git a/codenet/public_test_cases/p02173/output.4.txt b/codenet/public_test_cases/p02173/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e61ad39f8d7359ace88c1b2fd3a92c3573cc5551 --- /dev/null +++ b/codenet/public_test_cases/p02173/output.4.txt @@ -0,0 +1,10 @@ +192657310 +138809442 +0 +192657310 +0 +270544279 +99779950 +0 +96664294 +0 diff --git a/codenet/public_test_cases/p02174/input.0.txt b/codenet/public_test_cases/p02174/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02174/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02174/input.1.txt b/codenet/public_test_cases/p02174/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..727dea9e06c080b8b2ed75c265cdfa5068172976 --- /dev/null +++ b/codenet/public_test_cases/p02174/input.1.txt @@ -0,0 +1,2 @@ +5 +100 200 300 400 500 diff --git a/codenet/public_test_cases/p02174/input.2.txt b/codenet/public_test_cases/p02174/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02174/input.2.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02174/output.0.txt b/codenet/public_test_cases/p02174/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p02174/output.0.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p02174/output.1.txt b/codenet/public_test_cases/p02174/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf3165c471f3a40762ff2c88ccaeacb89fb594d5 --- /dev/null +++ b/codenet/public_test_cases/p02174/output.1.txt @@ -0,0 +1 @@ +935740429 diff --git a/codenet/public_test_cases/p02174/output.2.txt b/codenet/public_test_cases/p02174/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p02174/output.2.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p02175/input.0.txt b/codenet/public_test_cases/p02175/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78c94debb94d1f3e03b99a380c7f1543e7d6a780 --- /dev/null +++ b/codenet/public_test_cases/p02175/input.0.txt @@ -0,0 +1,5 @@ +10 30 10 +3 +nobiro +nobiro +tidime diff --git a/codenet/public_test_cases/p02175/input.1.txt b/codenet/public_test_cases/p02175/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78c94debb94d1f3e03b99a380c7f1543e7d6a780 --- /dev/null +++ b/codenet/public_test_cases/p02175/input.1.txt @@ -0,0 +1,5 @@ +10 30 10 +3 +nobiro +nobiro +tidime diff --git a/codenet/public_test_cases/p02175/output.0.txt b/codenet/public_test_cases/p02175/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p02175/output.0.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p02175/output.1.txt b/codenet/public_test_cases/p02175/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p02175/output.1.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p02176/input.0.txt b/codenet/public_test_cases/p02176/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d429516a81a669871fc24c681de897dfa04cf840 --- /dev/null +++ b/codenet/public_test_cases/p02176/input.0.txt @@ -0,0 +1,2 @@ +5 +ANazA diff --git a/codenet/public_test_cases/p02176/input.1.txt b/codenet/public_test_cases/p02176/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d429516a81a669871fc24c681de897dfa04cf840 --- /dev/null +++ b/codenet/public_test_cases/p02176/input.1.txt @@ -0,0 +1,2 @@ +5 +ANazA diff --git a/codenet/public_test_cases/p02176/output.0.txt b/codenet/public_test_cases/p02176/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc17e3f9a7b11ddd8b8e26e6dc6cc718c2c8eb2f --- /dev/null +++ b/codenet/public_test_cases/p02176/output.0.txt @@ -0,0 +1,2 @@ +1 +A diff --git a/codenet/public_test_cases/p02176/output.1.txt b/codenet/public_test_cases/p02176/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc17e3f9a7b11ddd8b8e26e6dc6cc718c2c8eb2f --- /dev/null +++ b/codenet/public_test_cases/p02176/output.1.txt @@ -0,0 +1,2 @@ +1 +A diff --git a/codenet/public_test_cases/p02177/input.0.txt b/codenet/public_test_cases/p02177/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e216f089adc53e3d5382a789e7a9d9c8e99d556 --- /dev/null +++ b/codenet/public_test_cases/p02177/input.0.txt @@ -0,0 +1,3 @@ +5 2 +1 2 +2 1 diff --git a/codenet/public_test_cases/p02177/input.1.txt b/codenet/public_test_cases/p02177/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e216f089adc53e3d5382a789e7a9d9c8e99d556 --- /dev/null +++ b/codenet/public_test_cases/p02177/input.1.txt @@ -0,0 +1,3 @@ +5 2 +1 2 +2 1 diff --git a/codenet/public_test_cases/p02177/output.0.txt b/codenet/public_test_cases/p02177/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56889ba08ed1b94f8496d76cc4f5f42197cb3213 --- /dev/null +++ b/codenet/public_test_cases/p02177/output.0.txt @@ -0,0 +1,5 @@ +1 2 +1 2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02177/output.1.txt b/codenet/public_test_cases/p02177/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..56889ba08ed1b94f8496d76cc4f5f42197cb3213 --- /dev/null +++ b/codenet/public_test_cases/p02177/output.1.txt @@ -0,0 +1,5 @@ +1 2 +1 2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02178/input.0.txt b/codenet/public_test_cases/p02178/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63b110aea07335279d7736bc5d0d977635bcf6d1 --- /dev/null +++ b/codenet/public_test_cases/p02178/input.0.txt @@ -0,0 +1,4 @@ +4 10 1 4 +1 2 52 +1 3 68 +3 4 45 diff --git a/codenet/public_test_cases/p02178/input.1.txt b/codenet/public_test_cases/p02178/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63b110aea07335279d7736bc5d0d977635bcf6d1 --- /dev/null +++ b/codenet/public_test_cases/p02178/input.1.txt @@ -0,0 +1,4 @@ +4 10 1 4 +1 2 52 +1 3 68 +3 4 45 diff --git a/codenet/public_test_cases/p02178/output.0.txt b/codenet/public_test_cases/p02178/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02178/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02178/output.1.txt b/codenet/public_test_cases/p02178/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02178/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02179/input.0.txt b/codenet/public_test_cases/p02179/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..137919b74d6e763630d15980ef1d5f1b09f658d1 --- /dev/null +++ b/codenet/public_test_cases/p02179/input.0.txt @@ -0,0 +1,3 @@ +2 +5 10 5 5 +4 4 2 2 diff --git a/codenet/public_test_cases/p02179/input.1.txt b/codenet/public_test_cases/p02179/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..137919b74d6e763630d15980ef1d5f1b09f658d1 --- /dev/null +++ b/codenet/public_test_cases/p02179/input.1.txt @@ -0,0 +1,3 @@ +2 +5 10 5 5 +4 4 2 2 diff --git a/codenet/public_test_cases/p02179/output.0.txt b/codenet/public_test_cases/p02179/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02179/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02179/output.1.txt b/codenet/public_test_cases/p02179/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02179/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02180/input.0.txt b/codenet/public_test_cases/p02180/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..307e10dbbd3d94d5b3d353258910ae7e03b1f6d9 --- /dev/null +++ b/codenet/public_test_cases/p02180/input.0.txt @@ -0,0 +1,7 @@ +3 6 10 +1 1 1 +2 2 1 +4 3 1 +5 1 0 +6 2 0 +6 3 0 diff --git a/codenet/public_test_cases/p02180/output.0.txt b/codenet/public_test_cases/p02180/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p02180/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p02181/input.0.txt b/codenet/public_test_cases/p02181/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60cc33743a37f1c5790c4ed3d62813c4bd26c73c --- /dev/null +++ b/codenet/public_test_cases/p02181/input.0.txt @@ -0,0 +1,3 @@ +2 +AORA +OR diff --git a/codenet/public_test_cases/p02181/input.1.txt b/codenet/public_test_cases/p02181/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60cc33743a37f1c5790c4ed3d62813c4bd26c73c --- /dev/null +++ b/codenet/public_test_cases/p02181/input.1.txt @@ -0,0 +1,3 @@ +2 +AORA +OR diff --git a/codenet/public_test_cases/p02181/output.0.txt b/codenet/public_test_cases/p02181/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02181/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02181/output.1.txt b/codenet/public_test_cases/p02181/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02181/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02182/input.0.txt b/codenet/public_test_cases/p02182/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f881090f3859a9b341f11a0905afde93ee9fe75 --- /dev/null +++ b/codenet/public_test_cases/p02182/input.0.txt @@ -0,0 +1,5 @@ +2 3 +..# +##. +.## +#.. diff --git a/codenet/public_test_cases/p02182/input.1.txt b/codenet/public_test_cases/p02182/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f881090f3859a9b341f11a0905afde93ee9fe75 --- /dev/null +++ b/codenet/public_test_cases/p02182/input.1.txt @@ -0,0 +1,5 @@ +2 3 +..# +##. +.## +#.. diff --git a/codenet/public_test_cases/p02182/output.0.txt b/codenet/public_test_cases/p02182/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02182/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02182/output.1.txt b/codenet/public_test_cases/p02182/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02182/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02183/input.0.txt b/codenet/public_test_cases/p02183/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b181d4b32480361864d1a5353e2dcb720d59c87 --- /dev/null +++ b/codenet/public_test_cases/p02183/input.0.txt @@ -0,0 +1,20 @@ +2 3 +##. +.## +2 3 +#.. +### +1 4 +#### +2 3 +### +.#. +2 +####....## +####...### +####..#### +####...### +###..##### +###...#### +###...#### +###....### diff --git a/codenet/public_test_cases/p02183/input.1.txt b/codenet/public_test_cases/p02183/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b181d4b32480361864d1a5353e2dcb720d59c87 --- /dev/null +++ b/codenet/public_test_cases/p02183/input.1.txt @@ -0,0 +1,20 @@ +2 3 +##. +.## +2 3 +#.. +### +1 4 +#### +2 3 +### +.#. +2 +####....## +####...### +####..#### +####...### +###..##### +###...#### +###...#### +###....### diff --git a/codenet/public_test_cases/p02183/output.0.txt b/codenet/public_test_cases/p02183/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93da7ca4cb57b281a2b6f201a967d11a0c0634cb --- /dev/null +++ b/codenet/public_test_cases/p02183/output.0.txt @@ -0,0 +1,2 @@ +Yes +Yes diff --git a/codenet/public_test_cases/p02183/output.1.txt b/codenet/public_test_cases/p02183/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..93da7ca4cb57b281a2b6f201a967d11a0c0634cb --- /dev/null +++ b/codenet/public_test_cases/p02183/output.1.txt @@ -0,0 +1,2 @@ +Yes +Yes diff --git a/codenet/public_test_cases/p02184/input.0.txt b/codenet/public_test_cases/p02184/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..51fd1fc0a1b6cadaa93d5bac952d93c2918437fe --- /dev/null +++ b/codenet/public_test_cases/p02184/input.0.txt @@ -0,0 +1,2 @@ +2 +1000000007 diff --git a/codenet/public_test_cases/p02184/input.1.txt b/codenet/public_test_cases/p02184/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51fd1fc0a1b6cadaa93d5bac952d93c2918437fe --- /dev/null +++ b/codenet/public_test_cases/p02184/input.1.txt @@ -0,0 +1,2 @@ +2 +1000000007 diff --git a/codenet/public_test_cases/p02184/output.0.txt b/codenet/public_test_cases/p02184/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d84118515a8bb8be116bc4ee4469d2afc0b3b66 --- /dev/null +++ b/codenet/public_test_cases/p02184/output.0.txt @@ -0,0 +1 @@ +1000000009 diff --git a/codenet/public_test_cases/p02184/output.1.txt b/codenet/public_test_cases/p02184/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d84118515a8bb8be116bc4ee4469d2afc0b3b66 --- /dev/null +++ b/codenet/public_test_cases/p02184/output.1.txt @@ -0,0 +1 @@ +1000000009 diff --git a/codenet/public_test_cases/p02185/input.0.txt b/codenet/public_test_cases/p02185/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9e10366c4862af4b8f1d89b8f6de16686ce01b6 --- /dev/null +++ b/codenet/public_test_cases/p02185/input.0.txt @@ -0,0 +1,2 @@ +73 +6? diff --git a/codenet/public_test_cases/p02185/input.1.txt b/codenet/public_test_cases/p02185/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9e10366c4862af4b8f1d89b8f6de16686ce01b6 --- /dev/null +++ b/codenet/public_test_cases/p02185/input.1.txt @@ -0,0 +1,2 @@ +73 +6? diff --git a/codenet/public_test_cases/p02185/output.0.txt b/codenet/public_test_cases/p02185/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc056efe6094ef8cf9f8c810b80732daeaef2c20 --- /dev/null +++ b/codenet/public_test_cases/p02185/output.0.txt @@ -0,0 +1 @@ +645 diff --git a/codenet/public_test_cases/p02185/output.1.txt b/codenet/public_test_cases/p02185/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc056efe6094ef8cf9f8c810b80732daeaef2c20 --- /dev/null +++ b/codenet/public_test_cases/p02185/output.1.txt @@ -0,0 +1 @@ +645 diff --git a/codenet/public_test_cases/p02186/input.0.txt b/codenet/public_test_cases/p02186/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2543bb18918cd55f66760e262b0a277ceb54f81 --- /dev/null +++ b/codenet/public_test_cases/p02186/input.0.txt @@ -0,0 +1,4 @@ +5 2 +1 2 -3 4 -5 +3 3 +2 -6 diff --git a/codenet/public_test_cases/p02186/input.1.txt b/codenet/public_test_cases/p02186/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2543bb18918cd55f66760e262b0a277ceb54f81 --- /dev/null +++ b/codenet/public_test_cases/p02186/input.1.txt @@ -0,0 +1,4 @@ +5 2 +1 2 -3 4 -5 +3 3 +2 -6 diff --git a/codenet/public_test_cases/p02186/output.0.txt b/codenet/public_test_cases/p02186/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb74175cb4a1eb8a2aa05d3f85b525797384fca9 --- /dev/null +++ b/codenet/public_test_cases/p02186/output.0.txt @@ -0,0 +1,3 @@ +4 +10 +7 diff --git a/codenet/public_test_cases/p02186/output.1.txt b/codenet/public_test_cases/p02186/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb74175cb4a1eb8a2aa05d3f85b525797384fca9 --- /dev/null +++ b/codenet/public_test_cases/p02186/output.1.txt @@ -0,0 +1,3 @@ +4 +10 +7 diff --git a/codenet/public_test_cases/p02187/input.0.txt b/codenet/public_test_cases/p02187/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e50e01b3d8d81bacc8cc590464c61d2aa9e9756 --- /dev/null +++ b/codenet/public_test_cases/p02187/input.0.txt @@ -0,0 +1,3 @@ +abracadabra +cadabra +4 diff --git a/codenet/public_test_cases/p02187/input.1.txt b/codenet/public_test_cases/p02187/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e50e01b3d8d81bacc8cc590464c61d2aa9e9756 --- /dev/null +++ b/codenet/public_test_cases/p02187/input.1.txt @@ -0,0 +1,3 @@ +abracadabra +cadabra +4 diff --git a/codenet/public_test_cases/p02187/output.0.txt b/codenet/public_test_cases/p02187/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02187/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02187/output.1.txt b/codenet/public_test_cases/p02187/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02187/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02188/input.0.txt b/codenet/public_test_cases/p02188/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..926ecb44b459d1f98fdf989476251dfb1422da50 --- /dev/null +++ b/codenet/public_test_cases/p02188/input.0.txt @@ -0,0 +1,4 @@ +3 +1 2 3 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02188/input.1.txt b/codenet/public_test_cases/p02188/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..926ecb44b459d1f98fdf989476251dfb1422da50 --- /dev/null +++ b/codenet/public_test_cases/p02188/input.1.txt @@ -0,0 +1,4 @@ +3 +1 2 3 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02188/output.0.txt b/codenet/public_test_cases/p02188/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e8a2de2dbc74e6f8e500591f14858fef93ccd1b --- /dev/null +++ b/codenet/public_test_cases/p02188/output.0.txt @@ -0,0 +1,3 @@ +2 +3 +3 diff --git a/codenet/public_test_cases/p02188/output.1.txt b/codenet/public_test_cases/p02188/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e8a2de2dbc74e6f8e500591f14858fef93ccd1b --- /dev/null +++ b/codenet/public_test_cases/p02188/output.1.txt @@ -0,0 +1,3 @@ +2 +3 +3 diff --git a/codenet/public_test_cases/p02189/input.0.txt b/codenet/public_test_cases/p02189/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d938d473ab41e37e42e85357c9d03efc6d0a84 --- /dev/null +++ b/codenet/public_test_cases/p02189/input.0.txt @@ -0,0 +1,2 @@ +6 +8 6 9 1 2 1 diff --git a/codenet/public_test_cases/p02189/input.1.txt b/codenet/public_test_cases/p02189/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d938d473ab41e37e42e85357c9d03efc6d0a84 --- /dev/null +++ b/codenet/public_test_cases/p02189/input.1.txt @@ -0,0 +1,2 @@ +6 +8 6 9 1 2 1 diff --git a/codenet/public_test_cases/p02189/output.0.txt b/codenet/public_test_cases/p02189/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02189/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02189/output.1.txt b/codenet/public_test_cases/p02189/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02189/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02190/input.0.txt b/codenet/public_test_cases/p02190/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d938d473ab41e37e42e85357c9d03efc6d0a84 --- /dev/null +++ b/codenet/public_test_cases/p02190/input.0.txt @@ -0,0 +1,2 @@ +6 +8 6 9 1 2 1 diff --git a/codenet/public_test_cases/p02190/input.1.txt b/codenet/public_test_cases/p02190/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d938d473ab41e37e42e85357c9d03efc6d0a84 --- /dev/null +++ b/codenet/public_test_cases/p02190/input.1.txt @@ -0,0 +1,2 @@ +6 +8 6 9 1 2 1 diff --git a/codenet/public_test_cases/p02190/output.0.txt b/codenet/public_test_cases/p02190/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02190/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02190/output.1.txt b/codenet/public_test_cases/p02190/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02190/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02191/input.0.txt b/codenet/public_test_cases/p02191/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1c4cd4b053b3d884e27536310def57a5dc7647d --- /dev/null +++ b/codenet/public_test_cases/p02191/input.0.txt @@ -0,0 +1,5 @@ +6 3 +8 6 9 1 2 1 +2 8 +1 7 +3 5 diff --git a/codenet/public_test_cases/p02191/input.1.txt b/codenet/public_test_cases/p02191/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1c4cd4b053b3d884e27536310def57a5dc7647d --- /dev/null +++ b/codenet/public_test_cases/p02191/input.1.txt @@ -0,0 +1,5 @@ +6 3 +8 6 9 1 2 1 +2 8 +1 7 +3 5 diff --git a/codenet/public_test_cases/p02191/output.0.txt b/codenet/public_test_cases/p02191/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b22b448c0fd52cae4d6fa4e8f396e5dfb83734ef --- /dev/null +++ b/codenet/public_test_cases/p02191/output.0.txt @@ -0,0 +1,3 @@ +3 +4 +0 diff --git a/codenet/public_test_cases/p02191/output.1.txt b/codenet/public_test_cases/p02191/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b22b448c0fd52cae4d6fa4e8f396e5dfb83734ef --- /dev/null +++ b/codenet/public_test_cases/p02191/output.1.txt @@ -0,0 +1,3 @@ +3 +4 +0 diff --git a/codenet/public_test_cases/p02192/input.0.txt b/codenet/public_test_cases/p02192/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f749f796b31b0e0524c634713f304868a718f95 --- /dev/null +++ b/codenet/public_test_cases/p02192/input.0.txt @@ -0,0 +1,2 @@ +6 6 +8 6 9 1 2 1 diff --git a/codenet/public_test_cases/p02192/input.1.txt b/codenet/public_test_cases/p02192/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f749f796b31b0e0524c634713f304868a718f95 --- /dev/null +++ b/codenet/public_test_cases/p02192/input.1.txt @@ -0,0 +1,2 @@ +6 6 +8 6 9 1 2 1 diff --git a/codenet/public_test_cases/p02192/output.0.txt b/codenet/public_test_cases/p02192/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02192/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02192/output.1.txt b/codenet/public_test_cases/p02192/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02192/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02193/input.0.txt b/codenet/public_test_cases/p02193/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a20510c9744e498a76407f1fe17df6ec22197d10 --- /dev/null +++ b/codenet/public_test_cases/p02193/input.0.txt @@ -0,0 +1,13 @@ +6 6 +8 1 +6 1 +9 4 +1 5 +2 1 +1 4 +2 1 3 +1 1 3 3 +2 1 3 +2 4 6 +1 4 6 3 +2 4 6 diff --git a/codenet/public_test_cases/p02193/input.1.txt b/codenet/public_test_cases/p02193/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a20510c9744e498a76407f1fe17df6ec22197d10 --- /dev/null +++ b/codenet/public_test_cases/p02193/input.1.txt @@ -0,0 +1,13 @@ +6 6 +8 1 +6 1 +9 4 +1 5 +2 1 +1 4 +2 1 3 +1 1 3 3 +2 1 3 +2 4 6 +1 4 6 3 +2 4 6 diff --git a/codenet/public_test_cases/p02193/output.0.txt b/codenet/public_test_cases/p02193/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..392d69e91d285f6ec3ab31b4f540e48a29a500f2 --- /dev/null +++ b/codenet/public_test_cases/p02193/output.0.txt @@ -0,0 +1,4 @@ +6 +9 +2 +4 diff --git a/codenet/public_test_cases/p02193/output.1.txt b/codenet/public_test_cases/p02193/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..392d69e91d285f6ec3ab31b4f540e48a29a500f2 --- /dev/null +++ b/codenet/public_test_cases/p02193/output.1.txt @@ -0,0 +1,4 @@ +6 +9 +2 +4 diff --git a/codenet/public_test_cases/p02194/input.0.txt b/codenet/public_test_cases/p02194/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d938d473ab41e37e42e85357c9d03efc6d0a84 --- /dev/null +++ b/codenet/public_test_cases/p02194/input.0.txt @@ -0,0 +1,2 @@ +6 +8 6 9 1 2 1 diff --git a/codenet/public_test_cases/p02194/input.1.txt b/codenet/public_test_cases/p02194/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d938d473ab41e37e42e85357c9d03efc6d0a84 --- /dev/null +++ b/codenet/public_test_cases/p02194/input.1.txt @@ -0,0 +1,2 @@ +6 +8 6 9 1 2 1 diff --git a/codenet/public_test_cases/p02194/output.0.txt b/codenet/public_test_cases/p02194/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82cced27d7be32719d009707139bd949ad6263c9 --- /dev/null +++ b/codenet/public_test_cases/p02194/output.0.txt @@ -0,0 +1 @@ +51 diff --git a/codenet/public_test_cases/p02194/output.1.txt b/codenet/public_test_cases/p02194/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..82cced27d7be32719d009707139bd949ad6263c9 --- /dev/null +++ b/codenet/public_test_cases/p02194/output.1.txt @@ -0,0 +1 @@ +51 diff --git a/codenet/public_test_cases/p02195/input.0.txt b/codenet/public_test_cases/p02195/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ea21a4434d71f4ffece0dee4bb8dbdf53e534c2 --- /dev/null +++ b/codenet/public_test_cases/p02195/input.0.txt @@ -0,0 +1,13 @@ +10 3 +1 2 +2 5 +2 6 +1 4 +1 3 +3 7 +3 8 +3 9 +9 10 +1 3 +2 1 +2 8 diff --git a/codenet/public_test_cases/p02195/input.1.txt b/codenet/public_test_cases/p02195/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ea21a4434d71f4ffece0dee4bb8dbdf53e534c2 --- /dev/null +++ b/codenet/public_test_cases/p02195/input.1.txt @@ -0,0 +1,13 @@ +10 3 +1 2 +2 5 +2 6 +1 4 +1 3 +3 7 +3 8 +3 9 +9 10 +1 3 +2 1 +2 8 diff --git a/codenet/public_test_cases/p02195/output.0.txt b/codenet/public_test_cases/p02195/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af74fdcd71a03732095b62ca716ac02310b9fa71 --- /dev/null +++ b/codenet/public_test_cases/p02195/output.0.txt @@ -0,0 +1,2 @@ +5 +1 diff --git a/codenet/public_test_cases/p02195/output.1.txt b/codenet/public_test_cases/p02195/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af74fdcd71a03732095b62ca716ac02310b9fa71 --- /dev/null +++ b/codenet/public_test_cases/p02195/output.1.txt @@ -0,0 +1,2 @@ +5 +1 diff --git a/codenet/public_test_cases/p02196/input.0.txt b/codenet/public_test_cases/p02196/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d069c92d3476922299df06bff11a03802aa8cb1 --- /dev/null +++ b/codenet/public_test_cases/p02196/input.0.txt @@ -0,0 +1,5 @@ +2 2 +14 86 9 121 +3 34 3 34 +1 14 5 14 +1 9 1 9 diff --git a/codenet/public_test_cases/p02196/input.1.txt b/codenet/public_test_cases/p02196/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d069c92d3476922299df06bff11a03802aa8cb1 --- /dev/null +++ b/codenet/public_test_cases/p02196/input.1.txt @@ -0,0 +1,5 @@ +2 2 +14 86 9 121 +3 34 3 34 +1 14 5 14 +1 9 1 9 diff --git a/codenet/public_test_cases/p02196/output.0.txt b/codenet/public_test_cases/p02196/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6631b22779376d4c1b0470c35390d511ec268e3c --- /dev/null +++ b/codenet/public_test_cases/p02196/output.0.txt @@ -0,0 +1,2 @@ +No +Yes diff --git a/codenet/public_test_cases/p02196/output.1.txt b/codenet/public_test_cases/p02196/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6631b22779376d4c1b0470c35390d511ec268e3c --- /dev/null +++ b/codenet/public_test_cases/p02196/output.1.txt @@ -0,0 +1,2 @@ +No +Yes diff --git a/codenet/public_test_cases/p02197/input.1.txt b/codenet/public_test_cases/p02197/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02197/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02197/output.1.txt b/codenet/public_test_cases/p02197/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02197/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02198/input.0.txt b/codenet/public_test_cases/p02198/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebcee1a506db729ea7b0e0b6e9b0be36806d16bd --- /dev/null +++ b/codenet/public_test_cases/p02198/input.0.txt @@ -0,0 +1 @@ +3 4 diff --git a/codenet/public_test_cases/p02198/input.1.txt b/codenet/public_test_cases/p02198/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebcee1a506db729ea7b0e0b6e9b0be36806d16bd --- /dev/null +++ b/codenet/public_test_cases/p02198/input.1.txt @@ -0,0 +1 @@ +3 4 diff --git a/codenet/public_test_cases/p02198/output.0.txt b/codenet/public_test_cases/p02198/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02198/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02198/output.1.txt b/codenet/public_test_cases/p02198/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02198/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02199/input.0.txt b/codenet/public_test_cases/p02199/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b83c08d2e004353ad1b69db5caddebb8dca116b2 --- /dev/null +++ b/codenet/public_test_cases/p02199/input.0.txt @@ -0,0 +1,2 @@ +14 86 +9 1 20 diff --git a/codenet/public_test_cases/p02199/input.1.txt b/codenet/public_test_cases/p02199/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b83c08d2e004353ad1b69db5caddebb8dca116b2 --- /dev/null +++ b/codenet/public_test_cases/p02199/input.1.txt @@ -0,0 +1,2 @@ +14 86 +9 1 20 diff --git a/codenet/public_test_cases/p02199/output.0.txt b/codenet/public_test_cases/p02199/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..feec4c2fe419f0fc95dd37584d9a98ece948d5a6 --- /dev/null +++ b/codenet/public_test_cases/p02199/output.0.txt @@ -0,0 +1 @@ +119.428571428571 diff --git a/codenet/public_test_cases/p02199/output.1.txt b/codenet/public_test_cases/p02199/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..feec4c2fe419f0fc95dd37584d9a98ece948d5a6 --- /dev/null +++ b/codenet/public_test_cases/p02199/output.1.txt @@ -0,0 +1 @@ +119.428571428571 diff --git a/codenet/public_test_cases/p02200/input.0.txt b/codenet/public_test_cases/p02200/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b4839259dc1efe821c247a24a6967bd93150a43 --- /dev/null +++ b/codenet/public_test_cases/p02200/input.0.txt @@ -0,0 +1,2 @@ +5 +8 6 9 1 20 diff --git a/codenet/public_test_cases/p02200/input.1.txt b/codenet/public_test_cases/p02200/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b4839259dc1efe821c247a24a6967bd93150a43 --- /dev/null +++ b/codenet/public_test_cases/p02200/input.1.txt @@ -0,0 +1,2 @@ +5 +8 6 9 1 20 diff --git a/codenet/public_test_cases/p02200/output.0.txt b/codenet/public_test_cases/p02200/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02200/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02200/output.1.txt b/codenet/public_test_cases/p02200/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02200/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02201/input.0.txt b/codenet/public_test_cases/p02201/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b18c754d3332d5db8d7e09e8db26530887edebf1 --- /dev/null +++ b/codenet/public_test_cases/p02201/input.0.txt @@ -0,0 +1,6 @@ +5 +E869120 +TMJN +E869120 +TAISA +YNYMXIAOLONGBAO diff --git a/codenet/public_test_cases/p02201/input.1.txt b/codenet/public_test_cases/p02201/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b18c754d3332d5db8d7e09e8db26530887edebf1 --- /dev/null +++ b/codenet/public_test_cases/p02201/input.1.txt @@ -0,0 +1,6 @@ +5 +E869120 +TMJN +E869120 +TAISA +YNYMXIAOLONGBAO diff --git a/codenet/public_test_cases/p02201/output.0.txt b/codenet/public_test_cases/p02201/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02201/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02201/output.1.txt b/codenet/public_test_cases/p02201/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02201/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02202/input.0.txt b/codenet/public_test_cases/p02202/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6778db0108b7678cde97e796f8045b4d99ced25e --- /dev/null +++ b/codenet/public_test_cases/p02202/input.0.txt @@ -0,0 +1,2 @@ +1 +59549 diff --git a/codenet/public_test_cases/p02202/input.1.txt b/codenet/public_test_cases/p02202/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6778db0108b7678cde97e796f8045b4d99ced25e --- /dev/null +++ b/codenet/public_test_cases/p02202/input.1.txt @@ -0,0 +1,2 @@ +1 +59549 diff --git a/codenet/public_test_cases/p02202/output.0.txt b/codenet/public_test_cases/p02202/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e14831b48356527f0ffe5eef8f3110154348ec15 --- /dev/null +++ b/codenet/public_test_cases/p02202/output.0.txt @@ -0,0 +1 @@ +59548 diff --git a/codenet/public_test_cases/p02202/output.1.txt b/codenet/public_test_cases/p02202/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e14831b48356527f0ffe5eef8f3110154348ec15 --- /dev/null +++ b/codenet/public_test_cases/p02202/output.1.txt @@ -0,0 +1 @@ +59548 diff --git a/codenet/public_test_cases/p02203/input.0.txt b/codenet/public_test_cases/p02203/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b4839259dc1efe821c247a24a6967bd93150a43 --- /dev/null +++ b/codenet/public_test_cases/p02203/input.0.txt @@ -0,0 +1,2 @@ +5 +8 6 9 1 20 diff --git a/codenet/public_test_cases/p02203/input.1.txt b/codenet/public_test_cases/p02203/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b4839259dc1efe821c247a24a6967bd93150a43 --- /dev/null +++ b/codenet/public_test_cases/p02203/input.1.txt @@ -0,0 +1,2 @@ +5 +8 6 9 1 20 diff --git a/codenet/public_test_cases/p02203/output.0.txt b/codenet/public_test_cases/p02203/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ee0007bf1f1aaeab67e3ea1c9ae21003171a460 --- /dev/null +++ b/codenet/public_test_cases/p02203/output.0.txt @@ -0,0 +1,2 @@ +3 +5 diff --git a/codenet/public_test_cases/p02203/output.1.txt b/codenet/public_test_cases/p02203/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ee0007bf1f1aaeab67e3ea1c9ae21003171a460 --- /dev/null +++ b/codenet/public_test_cases/p02203/output.1.txt @@ -0,0 +1,2 @@ +3 +5 diff --git a/codenet/public_test_cases/p02204/input.0.txt b/codenet/public_test_cases/p02204/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..451357d7caa45354e0ba4cbdd037b93023c58079 --- /dev/null +++ b/codenet/public_test_cases/p02204/input.0.txt @@ -0,0 +1,2 @@ +2 3 +2 2 1 diff --git a/codenet/public_test_cases/p02204/input.1.txt b/codenet/public_test_cases/p02204/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..451357d7caa45354e0ba4cbdd037b93023c58079 --- /dev/null +++ b/codenet/public_test_cases/p02204/input.1.txt @@ -0,0 +1,2 @@ +2 3 +2 2 1 diff --git a/codenet/public_test_cases/p02204/output.0.txt b/codenet/public_test_cases/p02204/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02204/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02204/output.1.txt b/codenet/public_test_cases/p02204/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02204/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02205/input.0.txt b/codenet/public_test_cases/p02205/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef4d8d8b00a5abc74abdf7202830b335b86a2f2e --- /dev/null +++ b/codenet/public_test_cases/p02205/input.0.txt @@ -0,0 +1,2 @@ +3 +3 4 diff --git a/codenet/public_test_cases/p02205/input.1.txt b/codenet/public_test_cases/p02205/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef4d8d8b00a5abc74abdf7202830b335b86a2f2e --- /dev/null +++ b/codenet/public_test_cases/p02205/input.1.txt @@ -0,0 +1,2 @@ +3 +3 4 diff --git a/codenet/public_test_cases/p02205/output.0.txt b/codenet/public_test_cases/p02205/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..344022bab630b416efec48499d42991e9e17be7e --- /dev/null +++ b/codenet/public_test_cases/p02205/output.0.txt @@ -0,0 +1 @@ +-4 3 diff --git a/codenet/public_test_cases/p02205/output.1.txt b/codenet/public_test_cases/p02205/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..344022bab630b416efec48499d42991e9e17be7e --- /dev/null +++ b/codenet/public_test_cases/p02205/output.1.txt @@ -0,0 +1 @@ +-4 3 diff --git a/codenet/public_test_cases/p02206/input.0.txt b/codenet/public_test_cases/p02206/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02206/input.0.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02206/input.1.txt b/codenet/public_test_cases/p02206/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02206/input.1.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02206/output.0.txt b/codenet/public_test_cases/p02206/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02206/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02206/output.1.txt b/codenet/public_test_cases/p02206/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02206/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02207/input.0.txt b/codenet/public_test_cases/p02207/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f310026f1f1da7cd6bbd60ae6d35ac471232cd0d --- /dev/null +++ b/codenet/public_test_cases/p02207/input.0.txt @@ -0,0 +1,7 @@ +3 +3 3 +5 4 +8 1 +2 +1 4 +4 9 diff --git a/codenet/public_test_cases/p02207/input.1.txt b/codenet/public_test_cases/p02207/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f310026f1f1da7cd6bbd60ae6d35ac471232cd0d --- /dev/null +++ b/codenet/public_test_cases/p02207/input.1.txt @@ -0,0 +1,7 @@ +3 +3 3 +5 4 +8 1 +2 +1 4 +4 9 diff --git a/codenet/public_test_cases/p02207/output.0.txt b/codenet/public_test_cases/p02207/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb21ea45dc8ef47ef2eb9d0f7a99f20db6c33a33 --- /dev/null +++ b/codenet/public_test_cases/p02207/output.0.txt @@ -0,0 +1,2 @@ +700000000.000000000000 +539999999.999999880791 diff --git a/codenet/public_test_cases/p02207/output.1.txt b/codenet/public_test_cases/p02207/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb21ea45dc8ef47ef2eb9d0f7a99f20db6c33a33 --- /dev/null +++ b/codenet/public_test_cases/p02207/output.1.txt @@ -0,0 +1,2 @@ +700000000.000000000000 +539999999.999999880791 diff --git a/codenet/public_test_cases/p02208/input.0.txt b/codenet/public_test_cases/p02208/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f1c4fe41550ab54101523133bbe6b81a44dd11 --- /dev/null +++ b/codenet/public_test_cases/p02208/input.0.txt @@ -0,0 +1,3 @@ +1 1 1 1 1 1 1 +1 1 +1 1 diff --git a/codenet/public_test_cases/p02208/input.1.txt b/codenet/public_test_cases/p02208/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f1c4fe41550ab54101523133bbe6b81a44dd11 --- /dev/null +++ b/codenet/public_test_cases/p02208/input.1.txt @@ -0,0 +1,3 @@ +1 1 1 1 1 1 1 +1 1 +1 1 diff --git a/codenet/public_test_cases/p02208/output.0.txt b/codenet/public_test_cases/p02208/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02208/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02208/output.1.txt b/codenet/public_test_cases/p02208/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02208/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02209/input.0.txt b/codenet/public_test_cases/p02209/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9237d82485ddb65586007f987e9bdf30080b4acf --- /dev/null +++ b/codenet/public_test_cases/p02209/input.0.txt @@ -0,0 +1,2 @@ +5 9 +8 6 9 1 2 diff --git a/codenet/public_test_cases/p02209/input.1.txt b/codenet/public_test_cases/p02209/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9237d82485ddb65586007f987e9bdf30080b4acf --- /dev/null +++ b/codenet/public_test_cases/p02209/input.1.txt @@ -0,0 +1,2 @@ +5 9 +8 6 9 1 2 diff --git a/codenet/public_test_cases/p02209/output.0.txt b/codenet/public_test_cases/p02209/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02209/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02209/output.1.txt b/codenet/public_test_cases/p02209/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02209/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02210/input.0.txt b/codenet/public_test_cases/p02210/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1048ff25cdc3dbb087662150a594c802f790ea12 --- /dev/null +++ b/codenet/public_test_cases/p02210/input.0.txt @@ -0,0 +1,2 @@ +5 0 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p02210/input.1.txt b/codenet/public_test_cases/p02210/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1048ff25cdc3dbb087662150a594c802f790ea12 --- /dev/null +++ b/codenet/public_test_cases/p02210/input.1.txt @@ -0,0 +1,2 @@ +5 0 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p02210/output.0.txt b/codenet/public_test_cases/p02210/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02210/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02210/output.1.txt b/codenet/public_test_cases/p02210/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02210/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02211/input.0.txt b/codenet/public_test_cases/p02211/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90d139dd12dba51ff83f68c785e2aad2ed2b972c --- /dev/null +++ b/codenet/public_test_cases/p02211/input.0.txt @@ -0,0 +1,6 @@ +5 5 2 +s..#a +.#... +a#e.# +...#a +.#... diff --git a/codenet/public_test_cases/p02211/input.1.txt b/codenet/public_test_cases/p02211/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..90d139dd12dba51ff83f68c785e2aad2ed2b972c --- /dev/null +++ b/codenet/public_test_cases/p02211/input.1.txt @@ -0,0 +1,6 @@ +5 5 2 +s..#a +.#... +a#e.# +...#a +.#... diff --git a/codenet/public_test_cases/p02211/output.0.txt b/codenet/public_test_cases/p02211/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02211/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02211/output.1.txt b/codenet/public_test_cases/p02211/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02211/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02212/input.0.txt b/codenet/public_test_cases/p02212/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c62ce008e71a858b2da2e134fa1d61f04e5e617 --- /dev/null +++ b/codenet/public_test_cases/p02212/input.0.txt @@ -0,0 +1 @@ +2 1 3 4 diff --git a/codenet/public_test_cases/p02212/input.1.txt b/codenet/public_test_cases/p02212/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c62ce008e71a858b2da2e134fa1d61f04e5e617 --- /dev/null +++ b/codenet/public_test_cases/p02212/input.1.txt @@ -0,0 +1 @@ +2 1 3 4 diff --git a/codenet/public_test_cases/p02212/output.0.txt b/codenet/public_test_cases/p02212/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02212/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02212/output.1.txt b/codenet/public_test_cases/p02212/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02212/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02213/input.0.txt b/codenet/public_test_cases/p02213/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bb15c301bcb662b72f59f9ca7775061e7a6af4e --- /dev/null +++ b/codenet/public_test_cases/p02213/input.0.txt @@ -0,0 +1,4 @@ +3 3 +631 +4#2 +516 diff --git a/codenet/public_test_cases/p02213/input.1.txt b/codenet/public_test_cases/p02213/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bb15c301bcb662b72f59f9ca7775061e7a6af4e --- /dev/null +++ b/codenet/public_test_cases/p02213/input.1.txt @@ -0,0 +1,4 @@ +3 3 +631 +4#2 +516 diff --git a/codenet/public_test_cases/p02213/output.0.txt b/codenet/public_test_cases/p02213/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p02213/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p02213/output.1.txt b/codenet/public_test_cases/p02213/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p02213/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p02214/input.0.txt b/codenet/public_test_cases/p02214/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..223f1d6ad7ce1863fecce9b82eac90c927dd8b32 --- /dev/null +++ b/codenet/public_test_cases/p02214/input.0.txt @@ -0,0 +1,10 @@ +4 4 +1 2 1 +1 3 8 +3 2 0 +1 4 7 +4 +1 2 1 +2 1 2 +1 4 1 +3 4 1073741824 diff --git a/codenet/public_test_cases/p02214/output.0.txt b/codenet/public_test_cases/p02214/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c937a1aed0144c60ef3bb76e788f23db4bb2618 --- /dev/null +++ b/codenet/public_test_cases/p02214/output.0.txt @@ -0,0 +1,4 @@ +1 +8 +7 +-1 diff --git a/codenet/public_test_cases/p02215/input.0.txt b/codenet/public_test_cases/p02215/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02215/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02215/input.1.txt b/codenet/public_test_cases/p02215/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02215/input.1.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02215/output.0.txt b/codenet/public_test_cases/p02215/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02215/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02215/output.1.txt b/codenet/public_test_cases/p02215/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02215/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02216/input.0.txt b/codenet/public_test_cases/p02216/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p02216/input.0.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p02216/input.1.txt b/codenet/public_test_cases/p02216/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p02216/input.1.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p02216/output.0.txt b/codenet/public_test_cases/p02216/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p02216/output.0.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p02216/output.1.txt b/codenet/public_test_cases/p02216/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p02216/output.1.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p02217/input.0.txt b/codenet/public_test_cases/p02217/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f247925990be71dd414fd747d21262272a20c752 --- /dev/null +++ b/codenet/public_test_cases/p02217/input.0.txt @@ -0,0 +1,6 @@ +4 +1 2 +1 3 +3 4 +0 3 2 0 +-3 4 5 -1 diff --git a/codenet/public_test_cases/p02217/input.1.txt b/codenet/public_test_cases/p02217/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f247925990be71dd414fd747d21262272a20c752 --- /dev/null +++ b/codenet/public_test_cases/p02217/input.1.txt @@ -0,0 +1,6 @@ +4 +1 2 +1 3 +3 4 +0 3 2 0 +-3 4 5 -1 diff --git a/codenet/public_test_cases/p02217/output.0.txt b/codenet/public_test_cases/p02217/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02217/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02217/output.1.txt b/codenet/public_test_cases/p02217/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02217/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02218/input.0.txt b/codenet/public_test_cases/p02218/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13453c05471caed495718f15c05bb9d6e93a5d81 --- /dev/null +++ b/codenet/public_test_cases/p02218/input.0.txt @@ -0,0 +1,12 @@ +6 +2 4 1 +1 2 1 +4 6 1 +2 3 1 +4 5 1 +5 +2 5 +2 3 +1 2 +3 5 +1 4 diff --git a/codenet/public_test_cases/p02218/output.0.txt b/codenet/public_test_cases/p02218/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..858f48993ba25596d3cc1c8fea3896c0cedb6f7d --- /dev/null +++ b/codenet/public_test_cases/p02218/output.0.txt @@ -0,0 +1,5 @@ +1 6 +2 3 4 +3 1 3 4 +1 5 +2 1 3 diff --git a/codenet/public_test_cases/p02219/input.0.txt b/codenet/public_test_cases/p02219/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b814787fb77973e07520a4930b66174dd5663e24 --- /dev/null +++ b/codenet/public_test_cases/p02219/input.0.txt @@ -0,0 +1,2 @@ +2 4 0 +2 4 diff --git a/codenet/public_test_cases/p02219/input.1.txt b/codenet/public_test_cases/p02219/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b814787fb77973e07520a4930b66174dd5663e24 --- /dev/null +++ b/codenet/public_test_cases/p02219/input.1.txt @@ -0,0 +1,2 @@ +2 4 0 +2 4 diff --git a/codenet/public_test_cases/p02219/output.0.txt b/codenet/public_test_cases/p02219/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02219/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02219/output.1.txt b/codenet/public_test_cases/p02219/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02219/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02220/input.0.txt b/codenet/public_test_cases/p02220/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..234ae7c2facdd15547f4ab1aa5c0217c6038381d --- /dev/null +++ b/codenet/public_test_cases/p02220/input.0.txt @@ -0,0 +1,2 @@ +7 +0 4 2 3 6 5 1 diff --git a/codenet/public_test_cases/p02220/input.1.txt b/codenet/public_test_cases/p02220/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..234ae7c2facdd15547f4ab1aa5c0217c6038381d --- /dev/null +++ b/codenet/public_test_cases/p02220/input.1.txt @@ -0,0 +1,2 @@ +7 +0 4 2 3 6 5 1 diff --git a/codenet/public_test_cases/p02220/output.0.txt b/codenet/public_test_cases/p02220/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5e30b037073aeba5656fdabcc2709f2cbc104d1 --- /dev/null +++ b/codenet/public_test_cases/p02220/output.0.txt @@ -0,0 +1,2 @@ +1 +1 0100101 diff --git a/codenet/public_test_cases/p02220/output.1.txt b/codenet/public_test_cases/p02220/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5e30b037073aeba5656fdabcc2709f2cbc104d1 --- /dev/null +++ b/codenet/public_test_cases/p02220/output.1.txt @@ -0,0 +1,2 @@ +1 +1 0100101 diff --git a/codenet/public_test_cases/p02221/input.0.txt b/codenet/public_test_cases/p02221/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37fc80f27dee150830cf4d5682e0daaa406cae06 --- /dev/null +++ b/codenet/public_test_cases/p02221/input.0.txt @@ -0,0 +1,3 @@ +2 +100 +1 4 2 3 diff --git a/codenet/public_test_cases/p02221/input.1.txt b/codenet/public_test_cases/p02221/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37fc80f27dee150830cf4d5682e0daaa406cae06 --- /dev/null +++ b/codenet/public_test_cases/p02221/input.1.txt @@ -0,0 +1,3 @@ +2 +100 +1 4 2 3 diff --git a/codenet/public_test_cases/p02221/output.0.txt b/codenet/public_test_cases/p02221/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..099b7d91c923c6fc0fdaaea4be224d5d9d4fcfca --- /dev/null +++ b/codenet/public_test_cases/p02221/output.0.txt @@ -0,0 +1,4 @@ +1 +2 +1 +2 diff --git a/codenet/public_test_cases/p02221/output.1.txt b/codenet/public_test_cases/p02221/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..099b7d91c923c6fc0fdaaea4be224d5d9d4fcfca --- /dev/null +++ b/codenet/public_test_cases/p02221/output.1.txt @@ -0,0 +1,4 @@ +1 +2 +1 +2 diff --git a/codenet/public_test_cases/p02222/input.0.txt b/codenet/public_test_cases/p02222/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..44d7b521886fc41cd0bffdcf57bcc5f129f001d8 --- /dev/null +++ b/codenet/public_test_cases/p02222/input.0.txt @@ -0,0 +1,7 @@ +7 +1 3 +2 3 +3 4 +4 5 +4 6 +6 7 diff --git a/codenet/public_test_cases/p02222/input.1.txt b/codenet/public_test_cases/p02222/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..44d7b521886fc41cd0bffdcf57bcc5f129f001d8 --- /dev/null +++ b/codenet/public_test_cases/p02222/input.1.txt @@ -0,0 +1,7 @@ +7 +1 3 +2 3 +3 4 +4 5 +4 6 +6 7 diff --git a/codenet/public_test_cases/p02222/output.0.txt b/codenet/public_test_cases/p02222/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3624cbbf71920ff538ebae5037b8745687a00235 --- /dev/null +++ b/codenet/public_test_cases/p02222/output.0.txt @@ -0,0 +1 @@ +1100111 diff --git a/codenet/public_test_cases/p02222/output.1.txt b/codenet/public_test_cases/p02222/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3624cbbf71920ff538ebae5037b8745687a00235 --- /dev/null +++ b/codenet/public_test_cases/p02222/output.1.txt @@ -0,0 +1 @@ +1100111 diff --git a/codenet/public_test_cases/p02223/input.0.txt b/codenet/public_test_cases/p02223/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02223/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02223/input.1.txt b/codenet/public_test_cases/p02223/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02223/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02223/output.0.txt b/codenet/public_test_cases/p02223/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..371b620c62ecc0622b5a29bc5dac3f6e0581465c --- /dev/null +++ b/codenet/public_test_cases/p02223/output.0.txt @@ -0,0 +1,3 @@ +2 +0 +11 diff --git a/codenet/public_test_cases/p02223/output.1.txt b/codenet/public_test_cases/p02223/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..371b620c62ecc0622b5a29bc5dac3f6e0581465c --- /dev/null +++ b/codenet/public_test_cases/p02223/output.1.txt @@ -0,0 +1,3 @@ +2 +0 +11 diff --git a/codenet/public_test_cases/p02224/input.1.txt b/codenet/public_test_cases/p02224/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02224/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02224/output.1.txt b/codenet/public_test_cases/p02224/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02224/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02226/input.1.txt b/codenet/public_test_cases/p02226/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02226/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02226/output.1.txt b/codenet/public_test_cases/p02226/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02226/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02227/input.1.txt b/codenet/public_test_cases/p02227/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02227/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02227/output.1.txt b/codenet/public_test_cases/p02227/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02227/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02233/input.0.txt b/codenet/public_test_cases/p02233/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02233/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02233/input.1.txt b/codenet/public_test_cases/p02233/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02233/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02233/output.0.txt b/codenet/public_test_cases/p02233/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02233/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02233/output.1.txt b/codenet/public_test_cases/p02233/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02233/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02234/input.0.txt b/codenet/public_test_cases/p02234/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98861b5e4533a1ce6e3cc6bee6ad71fc877a9d84 --- /dev/null +++ b/codenet/public_test_cases/p02234/input.0.txt @@ -0,0 +1,7 @@ +6 +30 35 +35 15 +15 5 +5 10 +10 20 +20 25 diff --git a/codenet/public_test_cases/p02234/input.1.txt b/codenet/public_test_cases/p02234/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98861b5e4533a1ce6e3cc6bee6ad71fc877a9d84 --- /dev/null +++ b/codenet/public_test_cases/p02234/input.1.txt @@ -0,0 +1,7 @@ +6 +30 35 +35 15 +15 5 +5 10 +10 20 +20 25 diff --git a/codenet/public_test_cases/p02234/output.0.txt b/codenet/public_test_cases/p02234/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..738a78fb56c7d6ba7845ba688ec256eb35787e3f --- /dev/null +++ b/codenet/public_test_cases/p02234/output.0.txt @@ -0,0 +1 @@ +15125 diff --git a/codenet/public_test_cases/p02234/output.1.txt b/codenet/public_test_cases/p02234/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..738a78fb56c7d6ba7845ba688ec256eb35787e3f --- /dev/null +++ b/codenet/public_test_cases/p02234/output.1.txt @@ -0,0 +1 @@ +15125 diff --git a/codenet/public_test_cases/p02235/input.0.txt b/codenet/public_test_cases/p02235/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ffd08df43a313875dccaa34581b91d5d4f7a61e --- /dev/null +++ b/codenet/public_test_cases/p02235/input.0.txt @@ -0,0 +1,7 @@ +3 +abcbdab +bdcaba +abc +abc +abc +bc diff --git a/codenet/public_test_cases/p02235/input.1.txt b/codenet/public_test_cases/p02235/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ffd08df43a313875dccaa34581b91d5d4f7a61e --- /dev/null +++ b/codenet/public_test_cases/p02235/input.1.txt @@ -0,0 +1,7 @@ +3 +abcbdab +bdcaba +abc +abc +abc +bc diff --git a/codenet/public_test_cases/p02235/output.0.txt b/codenet/public_test_cases/p02235/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d184fef8644fcfa658534369afa9ebb5894d4af1 --- /dev/null +++ b/codenet/public_test_cases/p02235/output.0.txt @@ -0,0 +1,3 @@ +4 +3 +2 diff --git a/codenet/public_test_cases/p02235/output.1.txt b/codenet/public_test_cases/p02235/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d184fef8644fcfa658534369afa9ebb5894d4af1 --- /dev/null +++ b/codenet/public_test_cases/p02235/output.1.txt @@ -0,0 +1,3 @@ +4 +3 +2 diff --git a/codenet/public_test_cases/p02236/input.0.txt b/codenet/public_test_cases/p02236/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c2db02dbc00dfffeaebfbaef8921c8906b4a269 --- /dev/null +++ b/codenet/public_test_cases/p02236/input.0.txt @@ -0,0 +1,3 @@ +5 +0.1500 0.1000 0.0500 0.1000 0.2000 +0.0500 0.1000 0.0500 0.0500 0.0500 0.1000 diff --git a/codenet/public_test_cases/p02236/input.1.txt b/codenet/public_test_cases/p02236/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c2db02dbc00dfffeaebfbaef8921c8906b4a269 --- /dev/null +++ b/codenet/public_test_cases/p02236/input.1.txt @@ -0,0 +1,3 @@ +5 +0.1500 0.1000 0.0500 0.1000 0.2000 +0.0500 0.1000 0.0500 0.0500 0.0500 0.1000 diff --git a/codenet/public_test_cases/p02236/input.2.txt b/codenet/public_test_cases/p02236/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6305e6739f1a38e56931ea4b683242bddcd0947a --- /dev/null +++ b/codenet/public_test_cases/p02236/input.2.txt @@ -0,0 +1,3 @@ +7 +0.0400 0.0600 0.0800 0.0200 0.1000 0.1200 0.1400 +0.0600 0.0600 0.0600 0.0600 0.0500 0.0500 0.0500 0.0500 diff --git a/codenet/public_test_cases/p02236/output.0.txt b/codenet/public_test_cases/p02236/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4aecd67c58e34b073547683ce7e167f7f6060da8 --- /dev/null +++ b/codenet/public_test_cases/p02236/output.0.txt @@ -0,0 +1 @@ +2.75000000 diff --git a/codenet/public_test_cases/p02236/output.1.txt b/codenet/public_test_cases/p02236/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4aecd67c58e34b073547683ce7e167f7f6060da8 --- /dev/null +++ b/codenet/public_test_cases/p02236/output.1.txt @@ -0,0 +1 @@ +2.75000000 diff --git a/codenet/public_test_cases/p02236/output.2.txt b/codenet/public_test_cases/p02236/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..47ca16601ffa43ca8940db7ab7b3c5d808c21e2d --- /dev/null +++ b/codenet/public_test_cases/p02236/output.2.txt @@ -0,0 +1 @@ +3.12000000 diff --git a/codenet/public_test_cases/p02237/input.0.txt b/codenet/public_test_cases/p02237/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12e61a4cb63bc99191a767a085b131ce90d64234 --- /dev/null +++ b/codenet/public_test_cases/p02237/input.0.txt @@ -0,0 +1,5 @@ +4 +1 2 2 4 +2 1 4 +3 0 +4 1 3 diff --git a/codenet/public_test_cases/p02237/input.1.txt b/codenet/public_test_cases/p02237/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12e61a4cb63bc99191a767a085b131ce90d64234 --- /dev/null +++ b/codenet/public_test_cases/p02237/input.1.txt @@ -0,0 +1,5 @@ +4 +1 2 2 4 +2 1 4 +3 0 +4 1 3 diff --git a/codenet/public_test_cases/p02237/output.0.txt b/codenet/public_test_cases/p02237/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e58b90c8c8dde6c0cc6c51a409653c5261a7eb0b --- /dev/null +++ b/codenet/public_test_cases/p02237/output.0.txt @@ -0,0 +1,4 @@ +0 1 0 1 +0 0 0 1 +0 0 0 0 +0 0 1 0 diff --git a/codenet/public_test_cases/p02237/output.1.txt b/codenet/public_test_cases/p02237/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e58b90c8c8dde6c0cc6c51a409653c5261a7eb0b --- /dev/null +++ b/codenet/public_test_cases/p02237/output.1.txt @@ -0,0 +1,4 @@ +0 1 0 1 +0 0 0 1 +0 0 0 0 +0 0 1 0 diff --git a/codenet/public_test_cases/p02238/input.0.txt b/codenet/public_test_cases/p02238/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21cbbc4f61136ab0a9fc9d6efbb49f5d9afa66aa --- /dev/null +++ b/codenet/public_test_cases/p02238/input.0.txt @@ -0,0 +1,5 @@ +4 +1 1 2 +2 1 4 +3 0 +4 1 3 diff --git a/codenet/public_test_cases/p02238/input.1.txt b/codenet/public_test_cases/p02238/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..21cbbc4f61136ab0a9fc9d6efbb49f5d9afa66aa --- /dev/null +++ b/codenet/public_test_cases/p02238/input.1.txt @@ -0,0 +1,5 @@ +4 +1 1 2 +2 1 4 +3 0 +4 1 3 diff --git a/codenet/public_test_cases/p02238/input.2.txt b/codenet/public_test_cases/p02238/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ebc47e489d61007c063b378468b26e711258670 --- /dev/null +++ b/codenet/public_test_cases/p02238/input.2.txt @@ -0,0 +1,7 @@ +6 +1 2 2 3 +2 2 3 4 +3 1 5 +4 1 6 +5 1 6 +6 0 diff --git a/codenet/public_test_cases/p02238/output.0.txt b/codenet/public_test_cases/p02238/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d68c13822bc3b14544ead4b6e8d0bd5354e5d60 --- /dev/null +++ b/codenet/public_test_cases/p02238/output.0.txt @@ -0,0 +1,4 @@ +1 1 8 +2 2 7 +3 4 5 +4 3 6 diff --git a/codenet/public_test_cases/p02238/output.1.txt b/codenet/public_test_cases/p02238/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d68c13822bc3b14544ead4b6e8d0bd5354e5d60 --- /dev/null +++ b/codenet/public_test_cases/p02238/output.1.txt @@ -0,0 +1,4 @@ +1 1 8 +2 2 7 +3 4 5 +4 3 6 diff --git a/codenet/public_test_cases/p02238/output.2.txt b/codenet/public_test_cases/p02238/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f56272ea6c343f8dfa21c9d81bee37b27f056430 --- /dev/null +++ b/codenet/public_test_cases/p02238/output.2.txt @@ -0,0 +1,6 @@ +1 1 12 +2 2 11 +3 3 8 +4 9 10 +5 4 7 +6 5 6 diff --git a/codenet/public_test_cases/p02239/input.0.txt b/codenet/public_test_cases/p02239/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12e61a4cb63bc99191a767a085b131ce90d64234 --- /dev/null +++ b/codenet/public_test_cases/p02239/input.0.txt @@ -0,0 +1,5 @@ +4 +1 2 2 4 +2 1 4 +3 0 +4 1 3 diff --git a/codenet/public_test_cases/p02239/input.1.txt b/codenet/public_test_cases/p02239/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12e61a4cb63bc99191a767a085b131ce90d64234 --- /dev/null +++ b/codenet/public_test_cases/p02239/input.1.txt @@ -0,0 +1,5 @@ +4 +1 2 2 4 +2 1 4 +3 0 +4 1 3 diff --git a/codenet/public_test_cases/p02239/output.0.txt b/codenet/public_test_cases/p02239/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..308004b61ec8ffdc66dd57201d4cbee121b1b6ac --- /dev/null +++ b/codenet/public_test_cases/p02239/output.0.txt @@ -0,0 +1,4 @@ +1 0 +2 1 +3 2 +4 1 diff --git a/codenet/public_test_cases/p02239/output.1.txt b/codenet/public_test_cases/p02239/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..308004b61ec8ffdc66dd57201d4cbee121b1b6ac --- /dev/null +++ b/codenet/public_test_cases/p02239/output.1.txt @@ -0,0 +1,4 @@ +1 0 +2 1 +3 2 +4 1 diff --git a/codenet/public_test_cases/p02240/input.0.txt b/codenet/public_test_cases/p02240/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df34c2c72deb205d147847155604ca6974aa84e --- /dev/null +++ b/codenet/public_test_cases/p02240/input.0.txt @@ -0,0 +1,14 @@ +10 9 +0 1 +0 2 +3 4 +5 7 +5 6 +6 7 +6 8 +7 8 +8 9 +3 +0 1 +5 9 +1 3 diff --git a/codenet/public_test_cases/p02240/input.1.txt b/codenet/public_test_cases/p02240/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df34c2c72deb205d147847155604ca6974aa84e --- /dev/null +++ b/codenet/public_test_cases/p02240/input.1.txt @@ -0,0 +1,14 @@ +10 9 +0 1 +0 2 +3 4 +5 7 +5 6 +6 7 +6 8 +7 8 +8 9 +3 +0 1 +5 9 +1 3 diff --git a/codenet/public_test_cases/p02240/output.0.txt b/codenet/public_test_cases/p02240/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..07d92f55e50e8b2e1dc8d6ab8474727be13423d2 --- /dev/null +++ b/codenet/public_test_cases/p02240/output.0.txt @@ -0,0 +1,3 @@ +yes +yes +no diff --git a/codenet/public_test_cases/p02240/output.1.txt b/codenet/public_test_cases/p02240/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..07d92f55e50e8b2e1dc8d6ab8474727be13423d2 --- /dev/null +++ b/codenet/public_test_cases/p02240/output.1.txt @@ -0,0 +1,3 @@ +yes +yes +no diff --git a/codenet/public_test_cases/p02241/input.0.txt b/codenet/public_test_cases/p02241/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdf23658a6a48321bf7056687ae270429f4429bf --- /dev/null +++ b/codenet/public_test_cases/p02241/input.0.txt @@ -0,0 +1,6 @@ +5 + -1 2 3 1 -1 + 2 -1 -1 4 -1 + 3 -1 -1 1 1 + 1 4 1 -1 3 + -1 -1 1 3 -1 diff --git a/codenet/public_test_cases/p02241/output.0.txt b/codenet/public_test_cases/p02241/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02241/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02242/input.0.txt b/codenet/public_test_cases/p02242/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2363053ff9085754fd2d0a3b03b891a17a8be4b7 --- /dev/null +++ b/codenet/public_test_cases/p02242/input.0.txt @@ -0,0 +1,6 @@ +5 +0 3 2 3 3 1 1 2 +1 2 0 2 3 4 +2 3 0 3 3 1 4 1 +3 4 2 1 0 1 1 4 4 3 +4 2 2 1 3 3 diff --git a/codenet/public_test_cases/p02242/output.0.txt b/codenet/public_test_cases/p02242/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8710059f906056bef3f3f48235cbd1a4f1c50402 --- /dev/null +++ b/codenet/public_test_cases/p02242/output.0.txt @@ -0,0 +1,5 @@ +0 0 +1 2 +2 2 +3 1 +4 3 diff --git a/codenet/public_test_cases/p02243/input.0.txt b/codenet/public_test_cases/p02243/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2363053ff9085754fd2d0a3b03b891a17a8be4b7 --- /dev/null +++ b/codenet/public_test_cases/p02243/input.0.txt @@ -0,0 +1,6 @@ +5 +0 3 2 3 3 1 1 2 +1 2 0 2 3 4 +2 3 0 3 3 1 4 1 +3 4 2 1 0 1 1 4 4 3 +4 2 2 1 3 3 diff --git a/codenet/public_test_cases/p02243/input.1.txt b/codenet/public_test_cases/p02243/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2363053ff9085754fd2d0a3b03b891a17a8be4b7 --- /dev/null +++ b/codenet/public_test_cases/p02243/input.1.txt @@ -0,0 +1,6 @@ +5 +0 3 2 3 3 1 1 2 +1 2 0 2 3 4 +2 3 0 3 3 1 4 1 +3 4 2 1 0 1 1 4 4 3 +4 2 2 1 3 3 diff --git a/codenet/public_test_cases/p02243/output.0.txt b/codenet/public_test_cases/p02243/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8710059f906056bef3f3f48235cbd1a4f1c50402 --- /dev/null +++ b/codenet/public_test_cases/p02243/output.0.txt @@ -0,0 +1,5 @@ +0 0 +1 2 +2 2 +3 1 +4 3 diff --git a/codenet/public_test_cases/p02243/output.1.txt b/codenet/public_test_cases/p02243/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8710059f906056bef3f3f48235cbd1a4f1c50402 --- /dev/null +++ b/codenet/public_test_cases/p02243/output.1.txt @@ -0,0 +1,5 @@ +0 0 +1 2 +2 2 +3 1 +4 3 diff --git a/codenet/public_test_cases/p02244/input.0.txt b/codenet/public_test_cases/p02244/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6134e1a339a770a16b91606d899068deaf5b0bdb --- /dev/null +++ b/codenet/public_test_cases/p02244/input.0.txt @@ -0,0 +1,3 @@ +2 +2 2 +5 3 diff --git a/codenet/public_test_cases/p02244/input.1.txt b/codenet/public_test_cases/p02244/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6134e1a339a770a16b91606d899068deaf5b0bdb --- /dev/null +++ b/codenet/public_test_cases/p02244/input.1.txt @@ -0,0 +1,3 @@ +2 +2 2 +5 3 diff --git a/codenet/public_test_cases/p02244/output.0.txt b/codenet/public_test_cases/p02244/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3d775933f43060952b4293eacd60cfd894cdebb --- /dev/null +++ b/codenet/public_test_cases/p02244/output.0.txt @@ -0,0 +1,8 @@ +......Q. +Q....... +..Q..... +.......Q +.....Q.. +...Q.... +.Q...... +....Q... diff --git a/codenet/public_test_cases/p02244/output.1.txt b/codenet/public_test_cases/p02244/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3d775933f43060952b4293eacd60cfd894cdebb --- /dev/null +++ b/codenet/public_test_cases/p02244/output.1.txt @@ -0,0 +1,8 @@ +......Q. +Q....... +..Q..... +.......Q +.....Q.. +...Q.... +.Q...... +....Q... diff --git a/codenet/public_test_cases/p02245/input.0.txt b/codenet/public_test_cases/p02245/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5ffad55e689c0cd55479185a848b2eda345ab86 --- /dev/null +++ b/codenet/public_test_cases/p02245/input.0.txt @@ -0,0 +1,3 @@ +1 3 0 +4 2 5 +7 8 6 diff --git a/codenet/public_test_cases/p02245/input.1.txt b/codenet/public_test_cases/p02245/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5ffad55e689c0cd55479185a848b2eda345ab86 --- /dev/null +++ b/codenet/public_test_cases/p02245/input.1.txt @@ -0,0 +1,3 @@ +1 3 0 +4 2 5 +7 8 6 diff --git a/codenet/public_test_cases/p02245/output.0.txt b/codenet/public_test_cases/p02245/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02245/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02245/output.1.txt b/codenet/public_test_cases/p02245/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02245/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02246/input.0.txt b/codenet/public_test_cases/p02246/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48f1892cac825c5eefcd14e2f6074c1ee009af5f --- /dev/null +++ b/codenet/public_test_cases/p02246/input.0.txt @@ -0,0 +1,4 @@ +1 2 3 4 +6 7 8 0 +5 10 11 12 +9 13 14 15 diff --git a/codenet/public_test_cases/p02246/input.1.txt b/codenet/public_test_cases/p02246/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48f1892cac825c5eefcd14e2f6074c1ee009af5f --- /dev/null +++ b/codenet/public_test_cases/p02246/input.1.txt @@ -0,0 +1,4 @@ +1 2 3 4 +6 7 8 0 +5 10 11 12 +9 13 14 15 diff --git a/codenet/public_test_cases/p02246/output.0.txt b/codenet/public_test_cases/p02246/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02246/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02246/output.1.txt b/codenet/public_test_cases/p02246/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02246/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02247/input.0.txt b/codenet/public_test_cases/p02247/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e5c92804a71803efca1371afa09b236fa91efb1 --- /dev/null +++ b/codenet/public_test_cases/p02247/input.0.txt @@ -0,0 +1,2 @@ +aabaaa +aa diff --git a/codenet/public_test_cases/p02247/input.1.txt b/codenet/public_test_cases/p02247/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e5c92804a71803efca1371afa09b236fa91efb1 --- /dev/null +++ b/codenet/public_test_cases/p02247/input.1.txt @@ -0,0 +1,2 @@ +aabaaa +aa diff --git a/codenet/public_test_cases/p02247/input.2.txt b/codenet/public_test_cases/p02247/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3980dc87db11b185a5ea00ffd7c684242201c178 --- /dev/null +++ b/codenet/public_test_cases/p02247/input.2.txt @@ -0,0 +1,2 @@ +xyzz +yz diff --git a/codenet/public_test_cases/p02247/output.0.txt b/codenet/public_test_cases/p02247/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5826f5ccc726de50bc8f88f04a9c688c007e216f --- /dev/null +++ b/codenet/public_test_cases/p02247/output.0.txt @@ -0,0 +1,3 @@ +0 +3 +4 diff --git a/codenet/public_test_cases/p02247/output.1.txt b/codenet/public_test_cases/p02247/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5826f5ccc726de50bc8f88f04a9c688c007e216f --- /dev/null +++ b/codenet/public_test_cases/p02247/output.1.txt @@ -0,0 +1,3 @@ +0 +3 +4 diff --git a/codenet/public_test_cases/p02247/output.2.txt b/codenet/public_test_cases/p02247/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02247/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02248/input.0.txt b/codenet/public_test_cases/p02248/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e5c92804a71803efca1371afa09b236fa91efb1 --- /dev/null +++ b/codenet/public_test_cases/p02248/input.0.txt @@ -0,0 +1,2 @@ +aabaaa +aa diff --git a/codenet/public_test_cases/p02248/input.1.txt b/codenet/public_test_cases/p02248/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3980dc87db11b185a5ea00ffd7c684242201c178 --- /dev/null +++ b/codenet/public_test_cases/p02248/input.1.txt @@ -0,0 +1,2 @@ +xyzz +yz diff --git a/codenet/public_test_cases/p02248/input.2.txt b/codenet/public_test_cases/p02248/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e5c92804a71803efca1371afa09b236fa91efb1 --- /dev/null +++ b/codenet/public_test_cases/p02248/input.2.txt @@ -0,0 +1,2 @@ +aabaaa +aa diff --git a/codenet/public_test_cases/p02248/output.0.txt b/codenet/public_test_cases/p02248/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5826f5ccc726de50bc8f88f04a9c688c007e216f --- /dev/null +++ b/codenet/public_test_cases/p02248/output.0.txt @@ -0,0 +1,3 @@ +0 +3 +4 diff --git a/codenet/public_test_cases/p02248/output.1.txt b/codenet/public_test_cases/p02248/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02248/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02248/output.2.txt b/codenet/public_test_cases/p02248/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5826f5ccc726de50bc8f88f04a9c688c007e216f --- /dev/null +++ b/codenet/public_test_cases/p02248/output.2.txt @@ -0,0 +1,3 @@ +0 +3 +4 diff --git a/codenet/public_test_cases/p02249/input.0.txt b/codenet/public_test_cases/p02249/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ebdebe36cc53a56fef2d1765f81b2726f02fafa --- /dev/null +++ b/codenet/public_test_cases/p02249/input.0.txt @@ -0,0 +1,9 @@ +4 5 +00010 +00101 +00010 +00100 +3 2 +10 +01 +10 diff --git a/codenet/public_test_cases/p02249/input.1.txt b/codenet/public_test_cases/p02249/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ebdebe36cc53a56fef2d1765f81b2726f02fafa --- /dev/null +++ b/codenet/public_test_cases/p02249/input.1.txt @@ -0,0 +1,9 @@ +4 5 +00010 +00101 +00010 +00100 +3 2 +10 +01 +10 diff --git a/codenet/public_test_cases/p02249/output.0.txt b/codenet/public_test_cases/p02249/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..53db4a5d60aa5daa774bfda02ce7e1925287e793 --- /dev/null +++ b/codenet/public_test_cases/p02249/output.0.txt @@ -0,0 +1,2 @@ +0 3 +1 2 diff --git a/codenet/public_test_cases/p02249/output.1.txt b/codenet/public_test_cases/p02249/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..53db4a5d60aa5daa774bfda02ce7e1925287e793 --- /dev/null +++ b/codenet/public_test_cases/p02249/output.1.txt @@ -0,0 +1,2 @@ +0 3 +1 2 diff --git a/codenet/public_test_cases/p02250/input.0.txt b/codenet/public_test_cases/p02250/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c3680fd466d55baba67ae649d6df8934f666454 --- /dev/null +++ b/codenet/public_test_cases/p02250/input.0.txt @@ -0,0 +1,6 @@ +aabaaa +4 +aa +ba +bb +xyz diff --git a/codenet/public_test_cases/p02250/input.1.txt b/codenet/public_test_cases/p02250/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c3680fd466d55baba67ae649d6df8934f666454 --- /dev/null +++ b/codenet/public_test_cases/p02250/input.1.txt @@ -0,0 +1,6 @@ +aabaaa +4 +aa +ba +bb +xyz diff --git a/codenet/public_test_cases/p02250/output.0.txt b/codenet/public_test_cases/p02250/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9ff83f194985daf47a3f5f8160f991b8feab351 --- /dev/null +++ b/codenet/public_test_cases/p02250/output.0.txt @@ -0,0 +1,4 @@ +1 +1 +0 +0 diff --git a/codenet/public_test_cases/p02250/output.1.txt b/codenet/public_test_cases/p02250/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9ff83f194985daf47a3f5f8160f991b8feab351 --- /dev/null +++ b/codenet/public_test_cases/p02250/output.1.txt @@ -0,0 +1,4 @@ +1 +1 +0 +0 diff --git a/codenet/public_test_cases/p02251/input.0.txt b/codenet/public_test_cases/p02251/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02251/input.0.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02251/input.1.txt b/codenet/public_test_cases/p02251/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02251/input.1.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02251/input.2.txt b/codenet/public_test_cases/p02251/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..67c05795893f2a21a02ebf48fbed2cbe2a9db9c8 --- /dev/null +++ b/codenet/public_test_cases/p02251/input.2.txt @@ -0,0 +1 @@ +54321 diff --git a/codenet/public_test_cases/p02251/output.0.txt b/codenet/public_test_cases/p02251/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02251/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02251/output.1.txt b/codenet/public_test_cases/p02251/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02251/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02251/output.2.txt b/codenet/public_test_cases/p02251/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..491c450e95ca77836ecdc38db55738bc7983edb6 --- /dev/null +++ b/codenet/public_test_cases/p02251/output.2.txt @@ -0,0 +1 @@ +2175 diff --git a/codenet/public_test_cases/p02252/input.0.txt b/codenet/public_test_cases/p02252/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8218dc7e9071f6a568508168fe371f858d820316 --- /dev/null +++ b/codenet/public_test_cases/p02252/input.0.txt @@ -0,0 +1,4 @@ +3 50 +60 10 +100 20 +120 30 diff --git a/codenet/public_test_cases/p02252/input.1.txt b/codenet/public_test_cases/p02252/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f303e2951e7f747b6aaf90156eec10fdf0e411d8 --- /dev/null +++ b/codenet/public_test_cases/p02252/input.1.txt @@ -0,0 +1,2 @@ +1 100 +100000 100000 diff --git a/codenet/public_test_cases/p02252/input.2.txt b/codenet/public_test_cases/p02252/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8218dc7e9071f6a568508168fe371f858d820316 --- /dev/null +++ b/codenet/public_test_cases/p02252/input.2.txt @@ -0,0 +1,4 @@ +3 50 +60 10 +100 20 +120 30 diff --git a/codenet/public_test_cases/p02252/input.3.txt b/codenet/public_test_cases/p02252/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3dd21d66ef7cac6d1f6744ef688f037afa09bda1 --- /dev/null +++ b/codenet/public_test_cases/p02252/input.3.txt @@ -0,0 +1,4 @@ +3 50 +60 13 +100 23 +120 33 diff --git a/codenet/public_test_cases/p02252/output.0.txt b/codenet/public_test_cases/p02252/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb08bc0b0bc3abec5c48e80643fc18fb4ced16a0 --- /dev/null +++ b/codenet/public_test_cases/p02252/output.0.txt @@ -0,0 +1 @@ +240 diff --git a/codenet/public_test_cases/p02252/output.1.txt b/codenet/public_test_cases/p02252/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02252/output.1.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02252/output.2.txt b/codenet/public_test_cases/p02252/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb08bc0b0bc3abec5c48e80643fc18fb4ced16a0 --- /dev/null +++ b/codenet/public_test_cases/p02252/output.2.txt @@ -0,0 +1 @@ +240 diff --git a/codenet/public_test_cases/p02252/output.3.txt b/codenet/public_test_cases/p02252/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a67262d1cb5aa049dd9330431f1abe42666c9f45 --- /dev/null +++ b/codenet/public_test_cases/p02252/output.3.txt @@ -0,0 +1 @@ +210.90909091 diff --git a/codenet/public_test_cases/p02253/input.0.txt b/codenet/public_test_cases/p02253/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..081b70d5d7c5cb0a9e170100ec12a192065ef2fc --- /dev/null +++ b/codenet/public_test_cases/p02253/input.0.txt @@ -0,0 +1,6 @@ +5 +1 2 +3 9 +3 5 +5 9 +6 8 diff --git a/codenet/public_test_cases/p02253/input.1.txt b/codenet/public_test_cases/p02253/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..081b70d5d7c5cb0a9e170100ec12a192065ef2fc --- /dev/null +++ b/codenet/public_test_cases/p02253/input.1.txt @@ -0,0 +1,6 @@ +5 +1 2 +3 9 +3 5 +5 9 +6 8 diff --git a/codenet/public_test_cases/p02253/input.2.txt b/codenet/public_test_cases/p02253/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9bc75ec8c30854877c396cb380e765719cd0776 --- /dev/null +++ b/codenet/public_test_cases/p02253/input.2.txt @@ -0,0 +1,4 @@ +3 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p02253/input.3.txt b/codenet/public_test_cases/p02253/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..161d7759143d8f8e6c72056a39ff3ec113029dbc --- /dev/null +++ b/codenet/public_test_cases/p02253/input.3.txt @@ -0,0 +1,4 @@ +3 +1 5 +3 4 +2 5 diff --git a/codenet/public_test_cases/p02253/output.0.txt b/codenet/public_test_cases/p02253/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02253/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02253/output.1.txt b/codenet/public_test_cases/p02253/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02253/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02253/output.2.txt b/codenet/public_test_cases/p02253/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02253/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02253/output.3.txt b/codenet/public_test_cases/p02253/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02253/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02254/input.0.txt b/codenet/public_test_cases/p02254/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..011bc89a518400bfecfa398c6b40a29fdc9958fe --- /dev/null +++ b/codenet/public_test_cases/p02254/input.0.txt @@ -0,0 +1 @@ +abca diff --git a/codenet/public_test_cases/p02254/input.1.txt b/codenet/public_test_cases/p02254/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b68025345d5301abad4d9ec9166f455243a0d746 --- /dev/null +++ b/codenet/public_test_cases/p02254/input.1.txt @@ -0,0 +1 @@ +z diff --git a/codenet/public_test_cases/p02254/input.2.txt b/codenet/public_test_cases/p02254/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..524ecb9d347cf0ad1b714a599ce4ee81d147e3bb --- /dev/null +++ b/codenet/public_test_cases/p02254/input.2.txt @@ -0,0 +1 @@ +aaabbcccdeeeffg diff --git a/codenet/public_test_cases/p02254/input.3.txt b/codenet/public_test_cases/p02254/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..011bc89a518400bfecfa398c6b40a29fdc9958fe --- /dev/null +++ b/codenet/public_test_cases/p02254/input.3.txt @@ -0,0 +1 @@ +abca diff --git a/codenet/public_test_cases/p02254/output.0.txt b/codenet/public_test_cases/p02254/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02254/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02254/output.1.txt b/codenet/public_test_cases/p02254/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02254/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02254/output.2.txt b/codenet/public_test_cases/p02254/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..87523dd7a0632907d61799465827c3f08825fa47 --- /dev/null +++ b/codenet/public_test_cases/p02254/output.2.txt @@ -0,0 +1 @@ +41 diff --git a/codenet/public_test_cases/p02254/output.3.txt b/codenet/public_test_cases/p02254/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02254/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02255/input.0.txt b/codenet/public_test_cases/p02255/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..205a8456f0ef1b75a5141ea4d73708d7b989e6be --- /dev/null +++ b/codenet/public_test_cases/p02255/input.0.txt @@ -0,0 +1,2 @@ +6 +5 2 4 6 1 3 diff --git a/codenet/public_test_cases/p02255/input.1.txt b/codenet/public_test_cases/p02255/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02255/input.1.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02255/input.2.txt b/codenet/public_test_cases/p02255/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..205a8456f0ef1b75a5141ea4d73708d7b989e6be --- /dev/null +++ b/codenet/public_test_cases/p02255/input.2.txt @@ -0,0 +1,2 @@ +6 +5 2 4 6 1 3 diff --git a/codenet/public_test_cases/p02255/output.0.txt b/codenet/public_test_cases/p02255/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2240d1b14abc9c48522d671c00b21d78c10dd901 --- /dev/null +++ b/codenet/public_test_cases/p02255/output.0.txt @@ -0,0 +1,6 @@ +5 2 4 6 1 3 +2 5 4 6 1 3 +2 4 5 6 1 3 +2 4 5 6 1 3 +1 2 4 5 6 3 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p02255/output.1.txt b/codenet/public_test_cases/p02255/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db087e10025c78b24a09b83df50d42d8b9b1c326 --- /dev/null +++ b/codenet/public_test_cases/p02255/output.1.txt @@ -0,0 +1,3 @@ +1 2 3 +1 2 3 +1 2 3 diff --git a/codenet/public_test_cases/p02255/output.2.txt b/codenet/public_test_cases/p02255/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2240d1b14abc9c48522d671c00b21d78c10dd901 --- /dev/null +++ b/codenet/public_test_cases/p02255/output.2.txt @@ -0,0 +1,6 @@ +5 2 4 6 1 3 +2 5 4 6 1 3 +2 4 5 6 1 3 +2 4 5 6 1 3 +1 2 4 5 6 3 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p02256/input.0.txt b/codenet/public_test_cases/p02256/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcd42d846c5d5053e7f61db9b8f2b45e7f838bfe --- /dev/null +++ b/codenet/public_test_cases/p02256/input.0.txt @@ -0,0 +1 @@ +54 20 diff --git a/codenet/public_test_cases/p02256/input.1.txt b/codenet/public_test_cases/p02256/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcd42d846c5d5053e7f61db9b8f2b45e7f838bfe --- /dev/null +++ b/codenet/public_test_cases/p02256/input.1.txt @@ -0,0 +1 @@ +54 20 diff --git a/codenet/public_test_cases/p02256/input.2.txt b/codenet/public_test_cases/p02256/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00a6ef46f01ad60ffe9569a7d1cda4dff5064781 --- /dev/null +++ b/codenet/public_test_cases/p02256/input.2.txt @@ -0,0 +1 @@ +147 105 diff --git a/codenet/public_test_cases/p02256/output.0.txt b/codenet/public_test_cases/p02256/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02256/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02256/output.1.txt b/codenet/public_test_cases/p02256/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02256/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02256/output.2.txt b/codenet/public_test_cases/p02256/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p02256/output.2.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p02257/input.0.txt b/codenet/public_test_cases/p02257/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a984100568ed886ced74081caac838e0892f8bf --- /dev/null +++ b/codenet/public_test_cases/p02257/input.0.txt @@ -0,0 +1,6 @@ +5 +2 +3 +4 +5 +6 diff --git a/codenet/public_test_cases/p02257/input.1.txt b/codenet/public_test_cases/p02257/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a984100568ed886ced74081caac838e0892f8bf --- /dev/null +++ b/codenet/public_test_cases/p02257/input.1.txt @@ -0,0 +1,6 @@ +5 +2 +3 +4 +5 +6 diff --git a/codenet/public_test_cases/p02257/input.2.txt b/codenet/public_test_cases/p02257/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7922d01e74551ba0e388834c7d4ab5231eecca66 --- /dev/null +++ b/codenet/public_test_cases/p02257/input.2.txt @@ -0,0 +1,12 @@ +11 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 diff --git a/codenet/public_test_cases/p02257/output.0.txt b/codenet/public_test_cases/p02257/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02257/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02257/output.1.txt b/codenet/public_test_cases/p02257/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02257/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02257/output.2.txt b/codenet/public_test_cases/p02257/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02257/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02258/input.0.txt b/codenet/public_test_cases/p02258/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b231bbc6465f6fbec4d372fe46b3f26a3cf39e8 --- /dev/null +++ b/codenet/public_test_cases/p02258/input.0.txt @@ -0,0 +1,7 @@ +6 +5 +3 +1 +3 +4 +3 diff --git a/codenet/public_test_cases/p02258/input.1.txt b/codenet/public_test_cases/p02258/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c8320cabf78ba7a2c41cb8071f73ff9f762e65b --- /dev/null +++ b/codenet/public_test_cases/p02258/input.1.txt @@ -0,0 +1,4 @@ +3 +4 +3 +2 diff --git a/codenet/public_test_cases/p02258/input.2.txt b/codenet/public_test_cases/p02258/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b231bbc6465f6fbec4d372fe46b3f26a3cf39e8 --- /dev/null +++ b/codenet/public_test_cases/p02258/input.2.txt @@ -0,0 +1,7 @@ +6 +5 +3 +1 +3 +4 +3 diff --git a/codenet/public_test_cases/p02258/output.0.txt b/codenet/public_test_cases/p02258/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02258/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02258/output.1.txt b/codenet/public_test_cases/p02258/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02258/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02258/output.2.txt b/codenet/public_test_cases/p02258/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02258/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02259/input.0.txt b/codenet/public_test_cases/p02259/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fcc1d018350e38589cfc742f85fcb049d85187a --- /dev/null +++ b/codenet/public_test_cases/p02259/input.0.txt @@ -0,0 +1,2 @@ +5 +5 3 2 4 1 diff --git a/codenet/public_test_cases/p02259/input.1.txt b/codenet/public_test_cases/p02259/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fcc1d018350e38589cfc742f85fcb049d85187a --- /dev/null +++ b/codenet/public_test_cases/p02259/input.1.txt @@ -0,0 +1,2 @@ +5 +5 3 2 4 1 diff --git a/codenet/public_test_cases/p02259/input.2.txt b/codenet/public_test_cases/p02259/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..205a8456f0ef1b75a5141ea4d73708d7b989e6be --- /dev/null +++ b/codenet/public_test_cases/p02259/input.2.txt @@ -0,0 +1,2 @@ +6 +5 2 4 6 1 3 diff --git a/codenet/public_test_cases/p02259/output.0.txt b/codenet/public_test_cases/p02259/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e0d90d484fd4f33df6046e64b7b1d0af4144173 --- /dev/null +++ b/codenet/public_test_cases/p02259/output.0.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 +8 diff --git a/codenet/public_test_cases/p02259/output.1.txt b/codenet/public_test_cases/p02259/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e0d90d484fd4f33df6046e64b7b1d0af4144173 --- /dev/null +++ b/codenet/public_test_cases/p02259/output.1.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 +8 diff --git a/codenet/public_test_cases/p02259/output.2.txt b/codenet/public_test_cases/p02259/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..897fcd27aa2c2680517fb41bd25a4b6119c4b902 --- /dev/null +++ b/codenet/public_test_cases/p02259/output.2.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +9 diff --git a/codenet/public_test_cases/p02260/input.0.txt b/codenet/public_test_cases/p02260/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ee26715a7f607fb8368047002f53a7ed254c54c --- /dev/null +++ b/codenet/public_test_cases/p02260/input.0.txt @@ -0,0 +1,2 @@ +6 +5 6 4 2 1 3 diff --git a/codenet/public_test_cases/p02260/input.1.txt b/codenet/public_test_cases/p02260/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..205a8456f0ef1b75a5141ea4d73708d7b989e6be --- /dev/null +++ b/codenet/public_test_cases/p02260/input.1.txt @@ -0,0 +1,2 @@ +6 +5 2 4 6 1 3 diff --git a/codenet/public_test_cases/p02260/input.2.txt b/codenet/public_test_cases/p02260/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ee26715a7f607fb8368047002f53a7ed254c54c --- /dev/null +++ b/codenet/public_test_cases/p02260/input.2.txt @@ -0,0 +1,2 @@ +6 +5 6 4 2 1 3 diff --git a/codenet/public_test_cases/p02260/output.0.txt b/codenet/public_test_cases/p02260/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec7ec13d1b6b919fc29d03d40e0d4312f5daca9d --- /dev/null +++ b/codenet/public_test_cases/p02260/output.0.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +4 diff --git a/codenet/public_test_cases/p02260/output.1.txt b/codenet/public_test_cases/p02260/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d31d16a9cf364a11419b901481007522d1f6ee0 --- /dev/null +++ b/codenet/public_test_cases/p02260/output.1.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +3 diff --git a/codenet/public_test_cases/p02260/output.2.txt b/codenet/public_test_cases/p02260/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec7ec13d1b6b919fc29d03d40e0d4312f5daca9d --- /dev/null +++ b/codenet/public_test_cases/p02260/output.2.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +4 diff --git a/codenet/public_test_cases/p02261/input.0.txt b/codenet/public_test_cases/p02261/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae53bc9b1fa219df3f343500e921678336286b3f --- /dev/null +++ b/codenet/public_test_cases/p02261/input.0.txt @@ -0,0 +1,2 @@ +5 +H4 C9 S4 D2 C3 diff --git a/codenet/public_test_cases/p02261/input.1.txt b/codenet/public_test_cases/p02261/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..859d809af202ef1c0778c6b33bb784e76b676e59 --- /dev/null +++ b/codenet/public_test_cases/p02261/input.1.txt @@ -0,0 +1,2 @@ +2 +S1 H1 diff --git a/codenet/public_test_cases/p02261/input.2.txt b/codenet/public_test_cases/p02261/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae53bc9b1fa219df3f343500e921678336286b3f --- /dev/null +++ b/codenet/public_test_cases/p02261/input.2.txt @@ -0,0 +1,2 @@ +5 +H4 C9 S4 D2 C3 diff --git a/codenet/public_test_cases/p02261/output.0.txt b/codenet/public_test_cases/p02261/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69d030913abb1f27940eaccc6786dfda7f3167a6 --- /dev/null +++ b/codenet/public_test_cases/p02261/output.0.txt @@ -0,0 +1,4 @@ +D2 C3 H4 S4 C9 +Stable +D2 C3 S4 H4 C9 +Not stable diff --git a/codenet/public_test_cases/p02261/output.1.txt b/codenet/public_test_cases/p02261/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ba6de21807dbe9bedd1ef5a7fd3c981e5fb015d --- /dev/null +++ b/codenet/public_test_cases/p02261/output.1.txt @@ -0,0 +1,4 @@ +S1 H1 +Stable +S1 H1 +Stable diff --git a/codenet/public_test_cases/p02261/output.2.txt b/codenet/public_test_cases/p02261/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..69d030913abb1f27940eaccc6786dfda7f3167a6 --- /dev/null +++ b/codenet/public_test_cases/p02261/output.2.txt @@ -0,0 +1,4 @@ +D2 C3 H4 S4 C9 +Stable +D2 C3 S4 H4 C9 +Not stable diff --git a/codenet/public_test_cases/p02262/input.0.txt b/codenet/public_test_cases/p02262/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a9154c971cd5bdacee65b7265d6ec6aa0a9e709 --- /dev/null +++ b/codenet/public_test_cases/p02262/input.0.txt @@ -0,0 +1,6 @@ +5 +5 +1 +4 +3 +2 diff --git a/codenet/public_test_cases/p02262/input.1.txt b/codenet/public_test_cases/p02262/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a9154c971cd5bdacee65b7265d6ec6aa0a9e709 --- /dev/null +++ b/codenet/public_test_cases/p02262/input.1.txt @@ -0,0 +1,6 @@ +5 +5 +1 +4 +3 +2 diff --git a/codenet/public_test_cases/p02262/input.2.txt b/codenet/public_test_cases/p02262/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6cae439c6b7cbaa85e66510f1d02262b47f2444 --- /dev/null +++ b/codenet/public_test_cases/p02262/input.2.txt @@ -0,0 +1,4 @@ +3 +3 +2 +1 diff --git a/codenet/public_test_cases/p02262/output.0.txt b/codenet/public_test_cases/p02262/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9983fcea782a465f3590f6e7d8411800217dea14 --- /dev/null +++ b/codenet/public_test_cases/p02262/output.0.txt @@ -0,0 +1,8 @@ +2 +4 1 +3 +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02262/output.1.txt b/codenet/public_test_cases/p02262/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9983fcea782a465f3590f6e7d8411800217dea14 --- /dev/null +++ b/codenet/public_test_cases/p02262/output.1.txt @@ -0,0 +1,8 @@ +2 +4 1 +3 +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02262/output.2.txt b/codenet/public_test_cases/p02262/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..608d8385b26494770f35baf50211dabbd6239b48 --- /dev/null +++ b/codenet/public_test_cases/p02262/output.2.txt @@ -0,0 +1,6 @@ +1 +1 +3 +1 +2 +3 diff --git a/codenet/public_test_cases/p02263/input.0.txt b/codenet/public_test_cases/p02263/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2beabee3386a8619e3e7fb3394eb37c8073decdd --- /dev/null +++ b/codenet/public_test_cases/p02263/input.0.txt @@ -0,0 +1 @@ +1 2 + diff --git a/codenet/public_test_cases/p02263/input.1.txt b/codenet/public_test_cases/p02263/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9589ce113ec7587b37b11a971d1331ee944e1f1b --- /dev/null +++ b/codenet/public_test_cases/p02263/input.1.txt @@ -0,0 +1 @@ +1 2 + 3 4 - * diff --git a/codenet/public_test_cases/p02263/input.2.txt b/codenet/public_test_cases/p02263/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2beabee3386a8619e3e7fb3394eb37c8073decdd --- /dev/null +++ b/codenet/public_test_cases/p02263/input.2.txt @@ -0,0 +1 @@ +1 2 + diff --git a/codenet/public_test_cases/p02263/output.0.txt b/codenet/public_test_cases/p02263/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02263/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02263/output.1.txt b/codenet/public_test_cases/p02263/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a83d1d524c8bb033d6d2bc907474dbebd8b57b72 --- /dev/null +++ b/codenet/public_test_cases/p02263/output.1.txt @@ -0,0 +1 @@ +-3 diff --git a/codenet/public_test_cases/p02263/output.2.txt b/codenet/public_test_cases/p02263/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02263/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02264/input.0.txt b/codenet/public_test_cases/p02264/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a74452784cb962690d35e4160bbef001771f98c --- /dev/null +++ b/codenet/public_test_cases/p02264/input.0.txt @@ -0,0 +1,6 @@ +5 100 +p1 150 +p2 80 +p3 200 +p4 350 +p5 20 diff --git a/codenet/public_test_cases/p02264/input.1.txt b/codenet/public_test_cases/p02264/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a74452784cb962690d35e4160bbef001771f98c --- /dev/null +++ b/codenet/public_test_cases/p02264/input.1.txt @@ -0,0 +1,6 @@ +5 100 +p1 150 +p2 80 +p3 200 +p4 350 +p5 20 diff --git a/codenet/public_test_cases/p02264/output.0.txt b/codenet/public_test_cases/p02264/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31543f448504b3c43b496990633cf717da0a8856 --- /dev/null +++ b/codenet/public_test_cases/p02264/output.0.txt @@ -0,0 +1,5 @@ +p2 180 +p5 400 +p1 450 +p3 550 +p4 800 diff --git a/codenet/public_test_cases/p02264/output.1.txt b/codenet/public_test_cases/p02264/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31543f448504b3c43b496990633cf717da0a8856 --- /dev/null +++ b/codenet/public_test_cases/p02264/output.1.txt @@ -0,0 +1,5 @@ +p2 180 +p5 400 +p1 450 +p3 550 +p4 800 diff --git a/codenet/public_test_cases/p02265/input.0.txt b/codenet/public_test_cases/p02265/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af83e9a5397de56b65d2f6288dca3e1eb310f83b --- /dev/null +++ b/codenet/public_test_cases/p02265/input.0.txt @@ -0,0 +1,8 @@ +7 +insert 5 +insert 2 +insert 3 +insert 1 +delete 3 +insert 6 +delete 5 diff --git a/codenet/public_test_cases/p02265/input.1.txt b/codenet/public_test_cases/p02265/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c09d37be4c87696493e18504ac44e580310545b --- /dev/null +++ b/codenet/public_test_cases/p02265/input.1.txt @@ -0,0 +1,10 @@ +9 +insert 5 +insert 2 +insert 3 +insert 1 +delete 3 +insert 6 +delete 5 +deleteFirst +deleteLast diff --git a/codenet/public_test_cases/p02265/input.2.txt b/codenet/public_test_cases/p02265/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..af83e9a5397de56b65d2f6288dca3e1eb310f83b --- /dev/null +++ b/codenet/public_test_cases/p02265/input.2.txt @@ -0,0 +1,8 @@ +7 +insert 5 +insert 2 +insert 3 +insert 1 +delete 3 +insert 6 +delete 5 diff --git a/codenet/public_test_cases/p02265/output.0.txt b/codenet/public_test_cases/p02265/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28afdf1a3d85a83a684032b835b37589f1c00daf --- /dev/null +++ b/codenet/public_test_cases/p02265/output.0.txt @@ -0,0 +1 @@ +6 1 2 diff --git a/codenet/public_test_cases/p02265/output.1.txt b/codenet/public_test_cases/p02265/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02265/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02265/output.2.txt b/codenet/public_test_cases/p02265/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..28afdf1a3d85a83a684032b835b37589f1c00daf --- /dev/null +++ b/codenet/public_test_cases/p02265/output.2.txt @@ -0,0 +1 @@ +6 1 2 diff --git a/codenet/public_test_cases/p02266/input.0.txt b/codenet/public_test_cases/p02266/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13b9ca8b9946a0e3bed9a073520e0a3d4d66f505 --- /dev/null +++ b/codenet/public_test_cases/p02266/input.0.txt @@ -0,0 +1 @@ +\\// diff --git a/codenet/public_test_cases/p02266/input.1.txt b/codenet/public_test_cases/p02266/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f035f568b5b81e21c739c0305083b0f816f5a4a --- /dev/null +++ b/codenet/public_test_cases/p02266/input.1.txt @@ -0,0 +1 @@ +\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/\ diff --git a/codenet/public_test_cases/p02266/input.2.txt b/codenet/public_test_cases/p02266/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..13b9ca8b9946a0e3bed9a073520e0a3d4d66f505 --- /dev/null +++ b/codenet/public_test_cases/p02266/input.2.txt @@ -0,0 +1 @@ +\\// diff --git a/codenet/public_test_cases/p02266/output.0.txt b/codenet/public_test_cases/p02266/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf7c9b7ea724575ed6d0f7ca51509237d174bbc7 --- /dev/null +++ b/codenet/public_test_cases/p02266/output.0.txt @@ -0,0 +1,2 @@ +4 +1 4 diff --git a/codenet/public_test_cases/p02266/output.1.txt b/codenet/public_test_cases/p02266/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69dba870828fea2cceaa2822a59c92bb2149747 --- /dev/null +++ b/codenet/public_test_cases/p02266/output.1.txt @@ -0,0 +1,2 @@ +35 +5 4 2 1 19 9 diff --git a/codenet/public_test_cases/p02266/output.2.txt b/codenet/public_test_cases/p02266/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf7c9b7ea724575ed6d0f7ca51509237d174bbc7 --- /dev/null +++ b/codenet/public_test_cases/p02266/output.2.txt @@ -0,0 +1,2 @@ +4 +1 4 diff --git a/codenet/public_test_cases/p02267/input.0.txt b/codenet/public_test_cases/p02267/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00140762c13f313339277e6ead4994642089a16b --- /dev/null +++ b/codenet/public_test_cases/p02267/input.0.txt @@ -0,0 +1,4 @@ +5 +1 2 3 4 5 +3 +3 4 1 diff --git a/codenet/public_test_cases/p02267/output.0.txt b/codenet/public_test_cases/p02267/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02267/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02268/input.0.txt b/codenet/public_test_cases/p02268/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00140762c13f313339277e6ead4994642089a16b --- /dev/null +++ b/codenet/public_test_cases/p02268/input.0.txt @@ -0,0 +1,4 @@ +5 +1 2 3 4 5 +3 +3 4 1 diff --git a/codenet/public_test_cases/p02268/input.1.txt b/codenet/public_test_cases/p02268/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3012bf970c06a5ac48a769089f0e9d12b5735f82 --- /dev/null +++ b/codenet/public_test_cases/p02268/input.1.txt @@ -0,0 +1,4 @@ +5 +1 1 2 2 3 +2 +1 2 diff --git a/codenet/public_test_cases/p02268/input.2.txt b/codenet/public_test_cases/p02268/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1d0b8b58d48b918cb6c73c384fce5fec637059f --- /dev/null +++ b/codenet/public_test_cases/p02268/input.2.txt @@ -0,0 +1,4 @@ +3 +1 2 3 +1 +5 diff --git a/codenet/public_test_cases/p02268/input.3.txt b/codenet/public_test_cases/p02268/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00140762c13f313339277e6ead4994642089a16b --- /dev/null +++ b/codenet/public_test_cases/p02268/input.3.txt @@ -0,0 +1,4 @@ +5 +1 2 3 4 5 +3 +3 4 1 diff --git a/codenet/public_test_cases/p02268/output.0.txt b/codenet/public_test_cases/p02268/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02268/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02268/output.1.txt b/codenet/public_test_cases/p02268/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02268/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02268/output.2.txt b/codenet/public_test_cases/p02268/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02268/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02268/output.3.txt b/codenet/public_test_cases/p02268/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02268/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02269/input.0.txt b/codenet/public_test_cases/p02269/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f82d79326a9b0186a4b7bb6743758f5d1b6ee6ab --- /dev/null +++ b/codenet/public_test_cases/p02269/input.0.txt @@ -0,0 +1,6 @@ +5 +insert A +insert T +insert C +find G +find A diff --git a/codenet/public_test_cases/p02269/input.1.txt b/codenet/public_test_cases/p02269/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f82d79326a9b0186a4b7bb6743758f5d1b6ee6ab --- /dev/null +++ b/codenet/public_test_cases/p02269/input.1.txt @@ -0,0 +1,6 @@ +5 +insert A +insert T +insert C +find G +find A diff --git a/codenet/public_test_cases/p02269/input.2.txt b/codenet/public_test_cases/p02269/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b29313e21d46f21c876da7b6f4f99453ce50a1c --- /dev/null +++ b/codenet/public_test_cases/p02269/input.2.txt @@ -0,0 +1,14 @@ +13 +insert AAA +insert AAC +insert AGA +insert AGG +insert TTT +find AAA +find CCC +find CCC +insert CCC +find CCC +insert T +find TTT +find T diff --git a/codenet/public_test_cases/p02269/output.0.txt b/codenet/public_test_cases/p02269/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ce46e2638ea0f64c92ba9f99b358ab371d889fa --- /dev/null +++ b/codenet/public_test_cases/p02269/output.0.txt @@ -0,0 +1,2 @@ +no +yes diff --git a/codenet/public_test_cases/p02269/output.1.txt b/codenet/public_test_cases/p02269/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ce46e2638ea0f64c92ba9f99b358ab371d889fa --- /dev/null +++ b/codenet/public_test_cases/p02269/output.1.txt @@ -0,0 +1,2 @@ +no +yes diff --git a/codenet/public_test_cases/p02269/output.2.txt b/codenet/public_test_cases/p02269/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc1efb9cbb86ea90df7da089880728f139729b31 --- /dev/null +++ b/codenet/public_test_cases/p02269/output.2.txt @@ -0,0 +1,6 @@ +yes +no +no +yes +yes +yes diff --git a/codenet/public_test_cases/p02270/input.0.txt b/codenet/public_test_cases/p02270/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fab9fe7f56dce848d4dda55daa842c312164eef --- /dev/null +++ b/codenet/public_test_cases/p02270/input.0.txt @@ -0,0 +1,6 @@ +5 3 +8 +1 +7 +3 +9 diff --git a/codenet/public_test_cases/p02270/input.1.txt b/codenet/public_test_cases/p02270/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fab9fe7f56dce848d4dda55daa842c312164eef --- /dev/null +++ b/codenet/public_test_cases/p02270/input.1.txt @@ -0,0 +1,6 @@ +5 3 +8 +1 +7 +3 +9 diff --git a/codenet/public_test_cases/p02270/input.2.txt b/codenet/public_test_cases/p02270/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5aaf4caf716efa6a29f8dc29367cca34703dd1a --- /dev/null +++ b/codenet/public_test_cases/p02270/input.2.txt @@ -0,0 +1,5 @@ +4 2 +1 +2 +2 +6 diff --git a/codenet/public_test_cases/p02270/output.0.txt b/codenet/public_test_cases/p02270/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02270/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02270/output.1.txt b/codenet/public_test_cases/p02270/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02270/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02270/output.2.txt b/codenet/public_test_cases/p02270/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02270/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02271/input.0.txt b/codenet/public_test_cases/p02271/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bcc15f764b4c3db9d0226018e4b4e885a4fc2a8 --- /dev/null +++ b/codenet/public_test_cases/p02271/input.0.txt @@ -0,0 +1,4 @@ +5 +1 5 7 10 21 +8 +2 4 17 8 22 21 100 35 diff --git a/codenet/public_test_cases/p02271/input.1.txt b/codenet/public_test_cases/p02271/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bcc15f764b4c3db9d0226018e4b4e885a4fc2a8 --- /dev/null +++ b/codenet/public_test_cases/p02271/input.1.txt @@ -0,0 +1,4 @@ +5 +1 5 7 10 21 +8 +2 4 17 8 22 21 100 35 diff --git a/codenet/public_test_cases/p02271/output.0.txt b/codenet/public_test_cases/p02271/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5c4817d053fb6459a62c1342c873d9fd27e8690 --- /dev/null +++ b/codenet/public_test_cases/p02271/output.0.txt @@ -0,0 +1,8 @@ +no +no +yes +yes +yes +yes +no +no diff --git a/codenet/public_test_cases/p02271/output.1.txt b/codenet/public_test_cases/p02271/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5c4817d053fb6459a62c1342c873d9fd27e8690 --- /dev/null +++ b/codenet/public_test_cases/p02271/output.1.txt @@ -0,0 +1,8 @@ +no +no +yes +yes +yes +yes +no +no diff --git a/codenet/public_test_cases/p02272/input.0.txt b/codenet/public_test_cases/p02272/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c06cd48bcde4e616f472fa63329c7710ccb1887c --- /dev/null +++ b/codenet/public_test_cases/p02272/input.0.txt @@ -0,0 +1,2 @@ +10 +8 5 9 2 6 3 7 1 10 4 diff --git a/codenet/public_test_cases/p02272/input.1.txt b/codenet/public_test_cases/p02272/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c06cd48bcde4e616f472fa63329c7710ccb1887c --- /dev/null +++ b/codenet/public_test_cases/p02272/input.1.txt @@ -0,0 +1,2 @@ +10 +8 5 9 2 6 3 7 1 10 4 diff --git a/codenet/public_test_cases/p02272/output.0.txt b/codenet/public_test_cases/p02272/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25ed45fc6f225f7cc1c63d25e58f8f49eeef9720 --- /dev/null +++ b/codenet/public_test_cases/p02272/output.0.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 7 8 9 10 +34 diff --git a/codenet/public_test_cases/p02272/output.1.txt b/codenet/public_test_cases/p02272/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..25ed45fc6f225f7cc1c63d25e58f8f49eeef9720 --- /dev/null +++ b/codenet/public_test_cases/p02272/output.1.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 7 8 9 10 +34 diff --git a/codenet/public_test_cases/p02273/input.0.txt b/codenet/public_test_cases/p02273/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02273/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02273/input.1.txt b/codenet/public_test_cases/p02273/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02273/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02273/input.2.txt b/codenet/public_test_cases/p02273/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02273/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02273/output.0.txt b/codenet/public_test_cases/p02273/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaf6f487e3c514bfc7b0f0a367693fae51cedcfd --- /dev/null +++ b/codenet/public_test_cases/p02273/output.0.txt @@ -0,0 +1,5 @@ +0.00000000 0.00000000 +33.33333333 0.00000000 +50.00000000 28.86751346 +66.66666667 0.00000000 +100.00000000 0.00000000 diff --git a/codenet/public_test_cases/p02273/output.1.txt b/codenet/public_test_cases/p02273/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d90b99ca4c39202658dc8def3233ad6efc973058 --- /dev/null +++ b/codenet/public_test_cases/p02273/output.1.txt @@ -0,0 +1,17 @@ +0.00000000 0.00000000 +11.11111111 0.00000000 +16.66666667 9.62250449 +22.22222222 0.00000000 +33.33333333 0.00000000 +38.88888889 9.62250449 +33.33333333 19.24500897 +44.44444444 19.24500897 +50.00000000 28.86751346 +55.55555556 19.24500897 +66.66666667 19.24500897 +61.11111111 9.62250449 +66.66666667 0.00000000 +77.77777778 0.00000000 +83.33333333 9.62250449 +88.88888889 0.00000000 +100.00000000 0.00000000 diff --git a/codenet/public_test_cases/p02273/output.2.txt b/codenet/public_test_cases/p02273/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaf6f487e3c514bfc7b0f0a367693fae51cedcfd --- /dev/null +++ b/codenet/public_test_cases/p02273/output.2.txt @@ -0,0 +1,5 @@ +0.00000000 0.00000000 +33.33333333 0.00000000 +50.00000000 28.86751346 +66.66666667 0.00000000 +100.00000000 0.00000000 diff --git a/codenet/public_test_cases/p02274/input.0.txt b/codenet/public_test_cases/p02274/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dd6654beb736bfc26c53959c8bd5307cd3a892e --- /dev/null +++ b/codenet/public_test_cases/p02274/input.0.txt @@ -0,0 +1,2 @@ +5 +3 5 2 1 4 diff --git a/codenet/public_test_cases/p02274/input.1.txt b/codenet/public_test_cases/p02274/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01bb4fbbea6da8df33c21f7a2e91032e7167cee8 --- /dev/null +++ b/codenet/public_test_cases/p02274/input.1.txt @@ -0,0 +1,2 @@ +3 +3 1 2 diff --git a/codenet/public_test_cases/p02274/input.2.txt b/codenet/public_test_cases/p02274/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dd6654beb736bfc26c53959c8bd5307cd3a892e --- /dev/null +++ b/codenet/public_test_cases/p02274/input.2.txt @@ -0,0 +1,2 @@ +5 +3 5 2 1 4 diff --git a/codenet/public_test_cases/p02274/output.0.txt b/codenet/public_test_cases/p02274/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02274/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02274/output.1.txt b/codenet/public_test_cases/p02274/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02274/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02274/output.2.txt b/codenet/public_test_cases/p02274/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02274/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02275/input.0.txt b/codenet/public_test_cases/p02275/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82d4047013e2472e9d04076aa5bc750b3565ba67 --- /dev/null +++ b/codenet/public_test_cases/p02275/input.0.txt @@ -0,0 +1,2 @@ +7 +2 5 1 3 2 3 0 diff --git a/codenet/public_test_cases/p02275/input.1.txt b/codenet/public_test_cases/p02275/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..82d4047013e2472e9d04076aa5bc750b3565ba67 --- /dev/null +++ b/codenet/public_test_cases/p02275/input.1.txt @@ -0,0 +1,2 @@ +7 +2 5 1 3 2 3 0 diff --git a/codenet/public_test_cases/p02275/output.0.txt b/codenet/public_test_cases/p02275/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e1001f4fbdf60440c762b35b2c5b627e55c1ee3 --- /dev/null +++ b/codenet/public_test_cases/p02275/output.0.txt @@ -0,0 +1 @@ +0 1 2 2 3 3 5 diff --git a/codenet/public_test_cases/p02275/output.1.txt b/codenet/public_test_cases/p02275/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e1001f4fbdf60440c762b35b2c5b627e55c1ee3 --- /dev/null +++ b/codenet/public_test_cases/p02275/output.1.txt @@ -0,0 +1 @@ +0 1 2 2 3 3 5 diff --git a/codenet/public_test_cases/p02276/input.0.txt b/codenet/public_test_cases/p02276/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cf8c43b017c554360f65f4272f7591a8346a3a2 --- /dev/null +++ b/codenet/public_test_cases/p02276/input.0.txt @@ -0,0 +1,2 @@ +12 +13 19 9 5 12 8 7 4 21 2 6 11 diff --git a/codenet/public_test_cases/p02276/input.1.txt b/codenet/public_test_cases/p02276/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cf8c43b017c554360f65f4272f7591a8346a3a2 --- /dev/null +++ b/codenet/public_test_cases/p02276/input.1.txt @@ -0,0 +1,2 @@ +12 +13 19 9 5 12 8 7 4 21 2 6 11 diff --git a/codenet/public_test_cases/p02276/output.0.txt b/codenet/public_test_cases/p02276/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c41b27721ab9ad9dae8ac669467af511c30076cf --- /dev/null +++ b/codenet/public_test_cases/p02276/output.0.txt @@ -0,0 +1 @@ +9 5 8 7 4 2 6 [11] 21 13 19 12 diff --git a/codenet/public_test_cases/p02276/output.1.txt b/codenet/public_test_cases/p02276/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c41b27721ab9ad9dae8ac669467af511c30076cf --- /dev/null +++ b/codenet/public_test_cases/p02276/output.1.txt @@ -0,0 +1 @@ +9 5 8 7 4 2 6 [11] 21 13 19 12 diff --git a/codenet/public_test_cases/p02277/input.0.txt b/codenet/public_test_cases/p02277/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f31758e4a6f178092f95cf24abe3227ecc52965 --- /dev/null +++ b/codenet/public_test_cases/p02277/input.0.txt @@ -0,0 +1,7 @@ +6 +D 3 +H 2 +D 1 +S 3 +D 2 +C 1 diff --git a/codenet/public_test_cases/p02277/input.1.txt b/codenet/public_test_cases/p02277/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..467a0465cfe2acbd4ab4d51a7339f97f2619e221 --- /dev/null +++ b/codenet/public_test_cases/p02277/input.1.txt @@ -0,0 +1,3 @@ +2 +S 1 +H 1 diff --git a/codenet/public_test_cases/p02277/input.2.txt b/codenet/public_test_cases/p02277/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f31758e4a6f178092f95cf24abe3227ecc52965 --- /dev/null +++ b/codenet/public_test_cases/p02277/input.2.txt @@ -0,0 +1,7 @@ +6 +D 3 +H 2 +D 1 +S 3 +D 2 +C 1 diff --git a/codenet/public_test_cases/p02277/output.0.txt b/codenet/public_test_cases/p02277/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..609e4426b41861229d2ff5c89f8bf0bcf3cdc8bc --- /dev/null +++ b/codenet/public_test_cases/p02277/output.0.txt @@ -0,0 +1,7 @@ +Not stable +D 1 +C 1 +D 2 +H 2 +D 3 +S 3 diff --git a/codenet/public_test_cases/p02277/output.1.txt b/codenet/public_test_cases/p02277/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98102dc5b3b38d337f565506d38c0c448f3c7840 --- /dev/null +++ b/codenet/public_test_cases/p02277/output.1.txt @@ -0,0 +1,3 @@ +Stable +S 1 +H 1 diff --git a/codenet/public_test_cases/p02277/output.2.txt b/codenet/public_test_cases/p02277/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..609e4426b41861229d2ff5c89f8bf0bcf3cdc8bc --- /dev/null +++ b/codenet/public_test_cases/p02277/output.2.txt @@ -0,0 +1,7 @@ +Not stable +D 1 +C 1 +D 2 +H 2 +D 3 +S 3 diff --git a/codenet/public_test_cases/p02278/input.0.txt b/codenet/public_test_cases/p02278/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7881425110def0d9b2cea6c302592f8beca4dccc --- /dev/null +++ b/codenet/public_test_cases/p02278/input.0.txt @@ -0,0 +1,2 @@ +5 +1 5 3 4 2 diff --git a/codenet/public_test_cases/p02278/input.1.txt b/codenet/public_test_cases/p02278/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c72001f2e8f93d6c45f22c3c37e0b3bded52287 --- /dev/null +++ b/codenet/public_test_cases/p02278/input.1.txt @@ -0,0 +1,2 @@ +4 +4 3 2 1 diff --git a/codenet/public_test_cases/p02278/input.2.txt b/codenet/public_test_cases/p02278/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7881425110def0d9b2cea6c302592f8beca4dccc --- /dev/null +++ b/codenet/public_test_cases/p02278/input.2.txt @@ -0,0 +1,2 @@ +5 +1 5 3 4 2 diff --git a/codenet/public_test_cases/p02278/output.0.txt b/codenet/public_test_cases/p02278/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02278/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02278/output.1.txt b/codenet/public_test_cases/p02278/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02278/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02278/output.2.txt b/codenet/public_test_cases/p02278/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02278/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02279/input.0.txt b/codenet/public_test_cases/p02279/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca74f490ae8e22b62ea5de047498b32e10fbf7f7 --- /dev/null +++ b/codenet/public_test_cases/p02279/input.0.txt @@ -0,0 +1,14 @@ +13 +0 3 1 4 10 +1 2 2 3 +2 0 +3 0 +4 3 5 6 7 +5 0 +6 0 +7 2 8 9 +8 0 +9 0 +10 2 11 12 +11 0 +12 0 diff --git a/codenet/public_test_cases/p02279/input.1.txt b/codenet/public_test_cases/p02279/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca74f490ae8e22b62ea5de047498b32e10fbf7f7 --- /dev/null +++ b/codenet/public_test_cases/p02279/input.1.txt @@ -0,0 +1,14 @@ +13 +0 3 1 4 10 +1 2 2 3 +2 0 +3 0 +4 3 5 6 7 +5 0 +6 0 +7 2 8 9 +8 0 +9 0 +10 2 11 12 +11 0 +12 0 diff --git a/codenet/public_test_cases/p02279/input.2.txt b/codenet/public_test_cases/p02279/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f107e5977e828b27badaac8bf88e8b4afc47f919 --- /dev/null +++ b/codenet/public_test_cases/p02279/input.2.txt @@ -0,0 +1,5 @@ +4 +1 3 3 2 0 +0 0 +3 0 +2 0 diff --git a/codenet/public_test_cases/p02279/output.0.txt b/codenet/public_test_cases/p02279/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..04f0d4d8954967fc86ee0b848ec47ad5ca793c86 --- /dev/null +++ b/codenet/public_test_cases/p02279/output.0.txt @@ -0,0 +1,13 @@ +node 0: parent = -1, depth = 0, root, [1, 4, 10] +node 1: parent = 0, depth = 1, internal node, [2, 3] +node 2: parent = 1, depth = 2, leaf, [] +node 3: parent = 1, depth = 2, leaf, [] +node 4: parent = 0, depth = 1, internal node, [5, 6, 7] +node 5: parent = 4, depth = 2, leaf, [] +node 6: parent = 4, depth = 2, leaf, [] +node 7: parent = 4, depth = 2, internal node, [8, 9] +node 8: parent = 7, depth = 3, leaf, [] +node 9: parent = 7, depth = 3, leaf, [] +node 10: parent = 0, depth = 1, internal node, [11, 12] +node 11: parent = 10, depth = 2, leaf, [] +node 12: parent = 10, depth = 2, leaf, [] diff --git a/codenet/public_test_cases/p02279/output.1.txt b/codenet/public_test_cases/p02279/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..04f0d4d8954967fc86ee0b848ec47ad5ca793c86 --- /dev/null +++ b/codenet/public_test_cases/p02279/output.1.txt @@ -0,0 +1,13 @@ +node 0: parent = -1, depth = 0, root, [1, 4, 10] +node 1: parent = 0, depth = 1, internal node, [2, 3] +node 2: parent = 1, depth = 2, leaf, [] +node 3: parent = 1, depth = 2, leaf, [] +node 4: parent = 0, depth = 1, internal node, [5, 6, 7] +node 5: parent = 4, depth = 2, leaf, [] +node 6: parent = 4, depth = 2, leaf, [] +node 7: parent = 4, depth = 2, internal node, [8, 9] +node 8: parent = 7, depth = 3, leaf, [] +node 9: parent = 7, depth = 3, leaf, [] +node 10: parent = 0, depth = 1, internal node, [11, 12] +node 11: parent = 10, depth = 2, leaf, [] +node 12: parent = 10, depth = 2, leaf, [] diff --git a/codenet/public_test_cases/p02279/output.2.txt b/codenet/public_test_cases/p02279/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b6a2237f84f0519aa8abcad2c19c8467b4d19a0 --- /dev/null +++ b/codenet/public_test_cases/p02279/output.2.txt @@ -0,0 +1,4 @@ +node 0: parent = 1, depth = 1, leaf, [] +node 1: parent = -1, depth = 0, root, [3, 2, 0] +node 2: parent = 1, depth = 1, leaf, [] +node 3: parent = 1, depth = 1, leaf, [] diff --git a/codenet/public_test_cases/p02280/input.0.txt b/codenet/public_test_cases/p02280/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2381ae1a9c8bb9d11278eba20284837b376e5172 --- /dev/null +++ b/codenet/public_test_cases/p02280/input.0.txt @@ -0,0 +1,10 @@ +9 +0 1 4 +1 2 3 +2 -1 -1 +3 -1 -1 +4 5 8 +5 6 7 +6 -1 -1 +7 -1 -1 +8 -1 -1 diff --git a/codenet/public_test_cases/p02280/input.1.txt b/codenet/public_test_cases/p02280/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2381ae1a9c8bb9d11278eba20284837b376e5172 --- /dev/null +++ b/codenet/public_test_cases/p02280/input.1.txt @@ -0,0 +1,10 @@ +9 +0 1 4 +1 2 3 +2 -1 -1 +3 -1 -1 +4 5 8 +5 6 7 +6 -1 -1 +7 -1 -1 +8 -1 -1 diff --git a/codenet/public_test_cases/p02280/output.0.txt b/codenet/public_test_cases/p02280/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eb124023664660233dc3494aa96bcc85f354b36 --- /dev/null +++ b/codenet/public_test_cases/p02280/output.0.txt @@ -0,0 +1,9 @@ +node 0: parent = -1, sibling = -1, degree = 2, depth = 0, height = 3, root +node 1: parent = 0, sibling = 4, degree = 2, depth = 1, height = 1, internal node +node 2: parent = 1, sibling = 3, degree = 0, depth = 2, height = 0, leaf +node 3: parent = 1, sibling = 2, degree = 0, depth = 2, height = 0, leaf +node 4: parent = 0, sibling = 1, degree = 2, depth = 1, height = 2, internal node +node 5: parent = 4, sibling = 8, degree = 2, depth = 2, height = 1, internal node +node 6: parent = 5, sibling = 7, degree = 0, depth = 3, height = 0, leaf +node 7: parent = 5, sibling = 6, degree = 0, depth = 3, height = 0, leaf +node 8: parent = 4, sibling = 5, degree = 0, depth = 2, height = 0, leaf diff --git a/codenet/public_test_cases/p02280/output.1.txt b/codenet/public_test_cases/p02280/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eb124023664660233dc3494aa96bcc85f354b36 --- /dev/null +++ b/codenet/public_test_cases/p02280/output.1.txt @@ -0,0 +1,9 @@ +node 0: parent = -1, sibling = -1, degree = 2, depth = 0, height = 3, root +node 1: parent = 0, sibling = 4, degree = 2, depth = 1, height = 1, internal node +node 2: parent = 1, sibling = 3, degree = 0, depth = 2, height = 0, leaf +node 3: parent = 1, sibling = 2, degree = 0, depth = 2, height = 0, leaf +node 4: parent = 0, sibling = 1, degree = 2, depth = 1, height = 2, internal node +node 5: parent = 4, sibling = 8, degree = 2, depth = 2, height = 1, internal node +node 6: parent = 5, sibling = 7, degree = 0, depth = 3, height = 0, leaf +node 7: parent = 5, sibling = 6, degree = 0, depth = 3, height = 0, leaf +node 8: parent = 4, sibling = 5, degree = 0, depth = 2, height = 0, leaf diff --git a/codenet/public_test_cases/p02281/input.0.txt b/codenet/public_test_cases/p02281/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2381ae1a9c8bb9d11278eba20284837b376e5172 --- /dev/null +++ b/codenet/public_test_cases/p02281/input.0.txt @@ -0,0 +1,10 @@ +9 +0 1 4 +1 2 3 +2 -1 -1 +3 -1 -1 +4 5 8 +5 6 7 +6 -1 -1 +7 -1 -1 +8 -1 -1 diff --git a/codenet/public_test_cases/p02281/input.1.txt b/codenet/public_test_cases/p02281/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2381ae1a9c8bb9d11278eba20284837b376e5172 --- /dev/null +++ b/codenet/public_test_cases/p02281/input.1.txt @@ -0,0 +1,10 @@ +9 +0 1 4 +1 2 3 +2 -1 -1 +3 -1 -1 +4 5 8 +5 6 7 +6 -1 -1 +7 -1 -1 +8 -1 -1 diff --git a/codenet/public_test_cases/p02281/output.0.txt b/codenet/public_test_cases/p02281/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf076db752b62a19fde47217b64efed2a00f6a4f --- /dev/null +++ b/codenet/public_test_cases/p02281/output.0.txt @@ -0,0 +1,6 @@ +Preorder + 0 1 2 3 4 5 6 7 8 +Inorder + 2 1 3 0 6 5 7 4 8 +Postorder + 2 3 1 6 7 5 8 4 0 diff --git a/codenet/public_test_cases/p02281/output.1.txt b/codenet/public_test_cases/p02281/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf076db752b62a19fde47217b64efed2a00f6a4f --- /dev/null +++ b/codenet/public_test_cases/p02281/output.1.txt @@ -0,0 +1,6 @@ +Preorder + 0 1 2 3 4 5 6 7 8 +Inorder + 2 1 3 0 6 5 7 4 8 +Postorder + 2 3 1 6 7 5 8 4 0 diff --git a/codenet/public_test_cases/p02282/input.0.txt b/codenet/public_test_cases/p02282/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00e263dbcad4bbb8716f0071215fc1728efedad5 --- /dev/null +++ b/codenet/public_test_cases/p02282/input.0.txt @@ -0,0 +1,3 @@ +5 +1 2 3 4 5 +3 2 4 1 5 diff --git a/codenet/public_test_cases/p02282/input.1.txt b/codenet/public_test_cases/p02282/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00e263dbcad4bbb8716f0071215fc1728efedad5 --- /dev/null +++ b/codenet/public_test_cases/p02282/input.1.txt @@ -0,0 +1,3 @@ +5 +1 2 3 4 5 +3 2 4 1 5 diff --git a/codenet/public_test_cases/p02282/input.2.txt b/codenet/public_test_cases/p02282/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..08a482aa690d3f2404079723243eb76ebe7cbae3 --- /dev/null +++ b/codenet/public_test_cases/p02282/input.2.txt @@ -0,0 +1,3 @@ +4 +1 2 3 4 +1 2 3 4 diff --git a/codenet/public_test_cases/p02282/output.0.txt b/codenet/public_test_cases/p02282/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1eb703ed39db702f195386233f78ab4ba43dcf88 --- /dev/null +++ b/codenet/public_test_cases/p02282/output.0.txt @@ -0,0 +1 @@ +3 4 2 5 1 diff --git a/codenet/public_test_cases/p02282/output.1.txt b/codenet/public_test_cases/p02282/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1eb703ed39db702f195386233f78ab4ba43dcf88 --- /dev/null +++ b/codenet/public_test_cases/p02282/output.1.txt @@ -0,0 +1 @@ +3 4 2 5 1 diff --git a/codenet/public_test_cases/p02282/output.2.txt b/codenet/public_test_cases/p02282/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c27c8afcf6bf0f2ea46bc6f3f43a09bcc86b0a68 --- /dev/null +++ b/codenet/public_test_cases/p02282/output.2.txt @@ -0,0 +1 @@ +4 3 2 1 diff --git a/codenet/public_test_cases/p02283/input.0.txt b/codenet/public_test_cases/p02283/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7d04694522861c67f85e534e06092930067fed8 --- /dev/null +++ b/codenet/public_test_cases/p02283/input.0.txt @@ -0,0 +1,9 @@ +8 +insert 30 +insert 88 +insert 12 +insert 1 +insert 20 +insert 17 +insert 25 +print diff --git a/codenet/public_test_cases/p02283/input.1.txt b/codenet/public_test_cases/p02283/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7d04694522861c67f85e534e06092930067fed8 --- /dev/null +++ b/codenet/public_test_cases/p02283/input.1.txt @@ -0,0 +1,9 @@ +8 +insert 30 +insert 88 +insert 12 +insert 1 +insert 20 +insert 17 +insert 25 +print diff --git a/codenet/public_test_cases/p02283/output.0.txt b/codenet/public_test_cases/p02283/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cbff9115e4004aa9761c5a2bcc861543a4ffd42 --- /dev/null +++ b/codenet/public_test_cases/p02283/output.0.txt @@ -0,0 +1,2 @@ + 1 12 17 20 25 30 88 + 30 12 1 20 17 25 88 diff --git a/codenet/public_test_cases/p02283/output.1.txt b/codenet/public_test_cases/p02283/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..84c1dc8f4f7dead106a0148189060a77141bd11d --- /dev/null +++ b/codenet/public_test_cases/p02283/output.1.txt @@ -0,0 +1,2 @@ +1 12 17 20 25 30 88 + 30 12 1 20 17 25 88 diff --git a/codenet/public_test_cases/p02284/input.0.txt b/codenet/public_test_cases/p02284/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cb6f01c6de0e6b665ef7d08d68e338356872f8a --- /dev/null +++ b/codenet/public_test_cases/p02284/input.0.txt @@ -0,0 +1,11 @@ +10 +insert 30 +insert 88 +insert 12 +insert 1 +insert 20 +find 12 +insert 17 +insert 25 +find 16 +print diff --git a/codenet/public_test_cases/p02284/input.1.txt b/codenet/public_test_cases/p02284/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cb6f01c6de0e6b665ef7d08d68e338356872f8a --- /dev/null +++ b/codenet/public_test_cases/p02284/input.1.txt @@ -0,0 +1,11 @@ +10 +insert 30 +insert 88 +insert 12 +insert 1 +insert 20 +find 12 +insert 17 +insert 25 +find 16 +print diff --git a/codenet/public_test_cases/p02284/output.0.txt b/codenet/public_test_cases/p02284/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..815a54c786d47eb4795569ba18dc909aed2da811 --- /dev/null +++ b/codenet/public_test_cases/p02284/output.0.txt @@ -0,0 +1,4 @@ +yes +no + 1 12 17 20 25 30 88 + 30 12 1 20 17 25 88 diff --git a/codenet/public_test_cases/p02284/output.1.txt b/codenet/public_test_cases/p02284/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..815a54c786d47eb4795569ba18dc909aed2da811 --- /dev/null +++ b/codenet/public_test_cases/p02284/output.1.txt @@ -0,0 +1,4 @@ +yes +no + 1 12 17 20 25 30 88 + 30 12 1 20 17 25 88 diff --git a/codenet/public_test_cases/p02285/input.0.txt b/codenet/public_test_cases/p02285/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b1afa8451b7af08dfeaf9740dcda2ad6721e34c --- /dev/null +++ b/codenet/public_test_cases/p02285/input.0.txt @@ -0,0 +1,19 @@ +18 +insert 8 +insert 2 +insert 3 +insert 7 +insert 22 +insert 1 +find 1 +find 2 +find 3 +find 4 +find 5 +find 6 +find 7 +find 8 +print +delete 3 +delete 7 +print diff --git a/codenet/public_test_cases/p02285/input.1.txt b/codenet/public_test_cases/p02285/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b1afa8451b7af08dfeaf9740dcda2ad6721e34c --- /dev/null +++ b/codenet/public_test_cases/p02285/input.1.txt @@ -0,0 +1,19 @@ +18 +insert 8 +insert 2 +insert 3 +insert 7 +insert 22 +insert 1 +find 1 +find 2 +find 3 +find 4 +find 5 +find 6 +find 7 +find 8 +print +delete 3 +delete 7 +print diff --git a/codenet/public_test_cases/p02285/output.0.txt b/codenet/public_test_cases/p02285/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bd034c35e8b67ec26649cc6c3425b8f0c8c375e --- /dev/null +++ b/codenet/public_test_cases/p02285/output.0.txt @@ -0,0 +1,12 @@ +yes +yes +yes +no +no +no +yes +yes + 1 2 3 7 8 22 + 8 2 1 3 7 22 + 1 2 8 22 + 8 2 1 22 diff --git a/codenet/public_test_cases/p02285/output.1.txt b/codenet/public_test_cases/p02285/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bd034c35e8b67ec26649cc6c3425b8f0c8c375e --- /dev/null +++ b/codenet/public_test_cases/p02285/output.1.txt @@ -0,0 +1,12 @@ +yes +yes +yes +no +no +no +yes +yes + 1 2 3 7 8 22 + 8 2 1 3 7 22 + 1 2 8 22 + 8 2 1 22 diff --git a/codenet/public_test_cases/p02286/input.0.txt b/codenet/public_test_cases/p02286/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32eae51b1a213acc3a75510c18b2221de7035d6c --- /dev/null +++ b/codenet/public_test_cases/p02286/input.0.txt @@ -0,0 +1,17 @@ +16 +insert 35 99 +insert 3 80 +insert 1 53 +insert 14 25 +insert 80 76 +insert 42 3 +insert 86 47 +insert 21 12 +insert 7 10 +insert 6 90 +print +find 21 +find 22 +delete 35 +delete 99 +print diff --git a/codenet/public_test_cases/p02286/input.1.txt b/codenet/public_test_cases/p02286/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32eae51b1a213acc3a75510c18b2221de7035d6c --- /dev/null +++ b/codenet/public_test_cases/p02286/input.1.txt @@ -0,0 +1,17 @@ +16 +insert 35 99 +insert 3 80 +insert 1 53 +insert 14 25 +insert 80 76 +insert 42 3 +insert 86 47 +insert 21 12 +insert 7 10 +insert 6 90 +print +find 21 +find 22 +delete 35 +delete 99 +print diff --git a/codenet/public_test_cases/p02286/output.0.txt b/codenet/public_test_cases/p02286/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..553dd92febb907e0bdc6e4202055e89d897b0880 --- /dev/null +++ b/codenet/public_test_cases/p02286/output.0.txt @@ -0,0 +1,6 @@ + 1 3 6 7 14 21 35 42 80 86 + 35 6 3 1 14 7 21 80 42 86 +yes +no + 1 3 6 7 14 21 42 80 86 + 6 3 1 80 14 7 21 42 86 diff --git a/codenet/public_test_cases/p02286/output.1.txt b/codenet/public_test_cases/p02286/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc718c14f8f7f94d4dd7e2b3185ce093861e1ebf --- /dev/null +++ b/codenet/public_test_cases/p02286/output.1.txt @@ -0,0 +1,6 @@ +1 3 6 7 14 21 35 42 80 86 + 35 6 3 1 14 7 21 80 42 86 +yes +no + 1 3 6 7 14 21 42 80 86 + 6 3 1 80 14 7 21 42 86 diff --git a/codenet/public_test_cases/p02287/input.0.txt b/codenet/public_test_cases/p02287/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37666bfa68e465681e7ac02b74bcd7cd81ab0cda --- /dev/null +++ b/codenet/public_test_cases/p02287/input.0.txt @@ -0,0 +1,2 @@ +5 +7 8 1 2 3 diff --git a/codenet/public_test_cases/p02287/input.1.txt b/codenet/public_test_cases/p02287/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37666bfa68e465681e7ac02b74bcd7cd81ab0cda --- /dev/null +++ b/codenet/public_test_cases/p02287/input.1.txt @@ -0,0 +1,2 @@ +5 +7 8 1 2 3 diff --git a/codenet/public_test_cases/p02287/output.0.txt b/codenet/public_test_cases/p02287/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2b7761fad13a5175356f37eafe03b328ec96342 --- /dev/null +++ b/codenet/public_test_cases/p02287/output.0.txt @@ -0,0 +1,5 @@ +node 1: key = 7, left key = 8, right key = 1, +node 2: key = 8, parent key = 7, left key = 2, right key = 3, +node 3: key = 1, parent key = 7, +node 4: key = 2, parent key = 8, +node 5: key = 3, parent key = 8, diff --git a/codenet/public_test_cases/p02287/output.1.txt b/codenet/public_test_cases/p02287/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2b7761fad13a5175356f37eafe03b328ec96342 --- /dev/null +++ b/codenet/public_test_cases/p02287/output.1.txt @@ -0,0 +1,5 @@ +node 1: key = 7, left key = 8, right key = 1, +node 2: key = 8, parent key = 7, left key = 2, right key = 3, +node 3: key = 1, parent key = 7, +node 4: key = 2, parent key = 8, +node 5: key = 3, parent key = 8, diff --git a/codenet/public_test_cases/p02288/input.0.txt b/codenet/public_test_cases/p02288/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14d66392bf87925982bb8775b4603d81536a718f --- /dev/null +++ b/codenet/public_test_cases/p02288/input.0.txt @@ -0,0 +1,2 @@ +10 +4 1 3 2 16 9 10 14 8 7 diff --git a/codenet/public_test_cases/p02288/input.1.txt b/codenet/public_test_cases/p02288/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14d66392bf87925982bb8775b4603d81536a718f --- /dev/null +++ b/codenet/public_test_cases/p02288/input.1.txt @@ -0,0 +1,2 @@ +10 +4 1 3 2 16 9 10 14 8 7 diff --git a/codenet/public_test_cases/p02288/output.0.txt b/codenet/public_test_cases/p02288/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33ddd23077bd74d65e471c132b9e42f88cb14696 --- /dev/null +++ b/codenet/public_test_cases/p02288/output.0.txt @@ -0,0 +1 @@ + 16 14 10 8 7 9 3 2 4 1 diff --git a/codenet/public_test_cases/p02288/output.1.txt b/codenet/public_test_cases/p02288/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..be765f0d67f051062f8923029d0406072a834463 --- /dev/null +++ b/codenet/public_test_cases/p02288/output.1.txt @@ -0,0 +1 @@ +16 14 10 8 7 9 3 2 4 1 diff --git a/codenet/public_test_cases/p02289/input.0.txt b/codenet/public_test_cases/p02289/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba7c0e76e954d677c98ecd933d1f04f648c93c84 --- /dev/null +++ b/codenet/public_test_cases/p02289/input.0.txt @@ -0,0 +1,9 @@ +insert 8 +insert 2 +extract +insert 10 +extract +insert 11 +extract +extract +end diff --git a/codenet/public_test_cases/p02289/input.1.txt b/codenet/public_test_cases/p02289/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba7c0e76e954d677c98ecd933d1f04f648c93c84 --- /dev/null +++ b/codenet/public_test_cases/p02289/input.1.txt @@ -0,0 +1,9 @@ +insert 8 +insert 2 +extract +insert 10 +extract +insert 11 +extract +extract +end diff --git a/codenet/public_test_cases/p02289/output.0.txt b/codenet/public_test_cases/p02289/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cac17459294d6f57964d6a018e5fe2f99e607d --- /dev/null +++ b/codenet/public_test_cases/p02289/output.0.txt @@ -0,0 +1,4 @@ +8 +10 +11 +2 diff --git a/codenet/public_test_cases/p02289/output.1.txt b/codenet/public_test_cases/p02289/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cac17459294d6f57964d6a018e5fe2f99e607d --- /dev/null +++ b/codenet/public_test_cases/p02289/output.1.txt @@ -0,0 +1,4 @@ +8 +10 +11 +2 diff --git a/codenet/public_test_cases/p02290/input.0.txt b/codenet/public_test_cases/p02290/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e7aaea9d8086c854f021ab210507e697062927f --- /dev/null +++ b/codenet/public_test_cases/p02290/input.0.txt @@ -0,0 +1,5 @@ +0 0 2 0 +3 +-1 1 +0 1 +1 1 diff --git a/codenet/public_test_cases/p02290/input.1.txt b/codenet/public_test_cases/p02290/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15e592ccb6af81f95e02d0fdf7ae803c07fbd8c --- /dev/null +++ b/codenet/public_test_cases/p02290/input.1.txt @@ -0,0 +1,3 @@ +0 0 3 4 +1 +2 5 diff --git a/codenet/public_test_cases/p02290/input.2.txt b/codenet/public_test_cases/p02290/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e7aaea9d8086c854f021ab210507e697062927f --- /dev/null +++ b/codenet/public_test_cases/p02290/input.2.txt @@ -0,0 +1,5 @@ +0 0 2 0 +3 +-1 1 +0 1 +1 1 diff --git a/codenet/public_test_cases/p02290/output.0.txt b/codenet/public_test_cases/p02290/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..70b08b0fb5ac788b053359fe458d1e6436e6fca8 --- /dev/null +++ b/codenet/public_test_cases/p02290/output.0.txt @@ -0,0 +1,3 @@ +-1.0000000000 0.0000000000 +0.0000000000 0.0000000000 +1.0000000000 0.0000000000 diff --git a/codenet/public_test_cases/p02290/output.1.txt b/codenet/public_test_cases/p02290/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f91d1484f9c2ac934dcb274c2412515d0ed607d7 --- /dev/null +++ b/codenet/public_test_cases/p02290/output.1.txt @@ -0,0 +1 @@ +3.1200000000 4.1600000000 diff --git a/codenet/public_test_cases/p02290/output.2.txt b/codenet/public_test_cases/p02290/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..70b08b0fb5ac788b053359fe458d1e6436e6fca8 --- /dev/null +++ b/codenet/public_test_cases/p02290/output.2.txt @@ -0,0 +1,3 @@ +-1.0000000000 0.0000000000 +0.0000000000 0.0000000000 +1.0000000000 0.0000000000 diff --git a/codenet/public_test_cases/p02291/input.0.txt b/codenet/public_test_cases/p02291/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e7aaea9d8086c854f021ab210507e697062927f --- /dev/null +++ b/codenet/public_test_cases/p02291/input.0.txt @@ -0,0 +1,5 @@ +0 0 2 0 +3 +-1 1 +0 1 +1 1 diff --git a/codenet/public_test_cases/p02291/input.1.txt b/codenet/public_test_cases/p02291/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51a0cbaefcdadb3f1b449a8fa5dd42dfb5bc4ea8 --- /dev/null +++ b/codenet/public_test_cases/p02291/input.1.txt @@ -0,0 +1,5 @@ +0 0 3 4 +3 +2 5 +1 4 +0 3 diff --git a/codenet/public_test_cases/p02291/input.2.txt b/codenet/public_test_cases/p02291/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e7aaea9d8086c854f021ab210507e697062927f --- /dev/null +++ b/codenet/public_test_cases/p02291/input.2.txt @@ -0,0 +1,5 @@ +0 0 2 0 +3 +-1 1 +0 1 +1 1 diff --git a/codenet/public_test_cases/p02291/output.0.txt b/codenet/public_test_cases/p02291/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a2521ba585bf99a3a1972a36f835dd0fca30306 --- /dev/null +++ b/codenet/public_test_cases/p02291/output.0.txt @@ -0,0 +1,3 @@ +-1.0000000000 -1.0000000000 +0.0000000000 -1.0000000000 +1.0000000000 -1.0000000000 diff --git a/codenet/public_test_cases/p02291/output.1.txt b/codenet/public_test_cases/p02291/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..163e15b5550c745f0ada877f2e67f230dee1b9a4 --- /dev/null +++ b/codenet/public_test_cases/p02291/output.1.txt @@ -0,0 +1,3 @@ +4.2400000000 3.3200000000 +3.5600000000 2.0800000000 +2.8800000000 0.8400000000 diff --git a/codenet/public_test_cases/p02291/output.2.txt b/codenet/public_test_cases/p02291/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a2521ba585bf99a3a1972a36f835dd0fca30306 --- /dev/null +++ b/codenet/public_test_cases/p02291/output.2.txt @@ -0,0 +1,3 @@ +-1.0000000000 -1.0000000000 +0.0000000000 -1.0000000000 +1.0000000000 -1.0000000000 diff --git a/codenet/public_test_cases/p02292/input.0.txt b/codenet/public_test_cases/p02292/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f72d717be5343c7e056c4d00399b7c56ddbce9dc --- /dev/null +++ b/codenet/public_test_cases/p02292/input.0.txt @@ -0,0 +1,4 @@ +0 0 2 0 +2 +-1 1 +-1 -1 diff --git a/codenet/public_test_cases/p02292/input.1.txt b/codenet/public_test_cases/p02292/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c4aa315964c8c0719c2ad287f0293d79fac7a22 --- /dev/null +++ b/codenet/public_test_cases/p02292/input.1.txt @@ -0,0 +1,5 @@ +0 0 2 0 +3 +-1 0 +0 0 +3 0 diff --git a/codenet/public_test_cases/p02292/input.2.txt b/codenet/public_test_cases/p02292/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f72d717be5343c7e056c4d00399b7c56ddbce9dc --- /dev/null +++ b/codenet/public_test_cases/p02292/input.2.txt @@ -0,0 +1,4 @@ +0 0 2 0 +2 +-1 1 +-1 -1 diff --git a/codenet/public_test_cases/p02292/output.0.txt b/codenet/public_test_cases/p02292/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4080dab3563858c7d3cc00c752ad67ebf9560dd0 --- /dev/null +++ b/codenet/public_test_cases/p02292/output.0.txt @@ -0,0 +1,2 @@ +COUNTER_CLOCKWISE +CLOCKWISE diff --git a/codenet/public_test_cases/p02292/output.1.txt b/codenet/public_test_cases/p02292/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b34a1f21ebe45dbb1167c8d0d2535a546126dca --- /dev/null +++ b/codenet/public_test_cases/p02292/output.1.txt @@ -0,0 +1,3 @@ +ONLINE_BACK +ON_SEGMENT +ONLINE_FRONT diff --git a/codenet/public_test_cases/p02292/output.2.txt b/codenet/public_test_cases/p02292/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4080dab3563858c7d3cc00c752ad67ebf9560dd0 --- /dev/null +++ b/codenet/public_test_cases/p02292/output.2.txt @@ -0,0 +1,2 @@ +COUNTER_CLOCKWISE +CLOCKWISE diff --git a/codenet/public_test_cases/p02293/input.0.txt b/codenet/public_test_cases/p02293/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5289a33c9709dfcf93c89a086e63fa8efc920117 --- /dev/null +++ b/codenet/public_test_cases/p02293/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 3 0 0 2 3 2 +0 0 3 0 1 1 1 4 +0 0 3 0 1 1 2 2 diff --git a/codenet/public_test_cases/p02293/input.1.txt b/codenet/public_test_cases/p02293/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5289a33c9709dfcf93c89a086e63fa8efc920117 --- /dev/null +++ b/codenet/public_test_cases/p02293/input.1.txt @@ -0,0 +1,4 @@ +3 +0 0 3 0 0 2 3 2 +0 0 3 0 1 1 1 4 +0 0 3 0 1 1 2 2 diff --git a/codenet/public_test_cases/p02293/output.0.txt b/codenet/public_test_cases/p02293/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p02293/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p02293/output.1.txt b/codenet/public_test_cases/p02293/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p02293/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p02294/input.0.txt b/codenet/public_test_cases/p02294/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..57f80dc3c828367ff72412be60851b6d186d36af --- /dev/null +++ b/codenet/public_test_cases/p02294/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 3 0 1 1 2 -1 +0 0 3 0 3 1 3 -1 +0 0 3 0 3 -2 5 0 diff --git a/codenet/public_test_cases/p02294/input.1.txt b/codenet/public_test_cases/p02294/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57f80dc3c828367ff72412be60851b6d186d36af --- /dev/null +++ b/codenet/public_test_cases/p02294/input.1.txt @@ -0,0 +1,4 @@ +3 +0 0 3 0 1 1 2 -1 +0 0 3 0 3 1 3 -1 +0 0 3 0 3 -2 5 0 diff --git a/codenet/public_test_cases/p02294/output.0.txt b/codenet/public_test_cases/p02294/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f1465d1598d82611e4e9081f6a149dcaf57f937 --- /dev/null +++ b/codenet/public_test_cases/p02294/output.0.txt @@ -0,0 +1,3 @@ +1 +1 +0 diff --git a/codenet/public_test_cases/p02294/output.1.txt b/codenet/public_test_cases/p02294/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f1465d1598d82611e4e9081f6a149dcaf57f937 --- /dev/null +++ b/codenet/public_test_cases/p02294/output.1.txt @@ -0,0 +1,3 @@ +1 +1 +0 diff --git a/codenet/public_test_cases/p02295/input.0.txt b/codenet/public_test_cases/p02295/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d95e18b1a32344b2653c17468beed7d9e37f61e4 --- /dev/null +++ b/codenet/public_test_cases/p02295/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 2 0 1 1 1 -1 +0 0 1 1 0 1 1 0 +0 0 1 1 1 0 0 1 diff --git a/codenet/public_test_cases/p02295/input.1.txt b/codenet/public_test_cases/p02295/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d95e18b1a32344b2653c17468beed7d9e37f61e4 --- /dev/null +++ b/codenet/public_test_cases/p02295/input.1.txt @@ -0,0 +1,4 @@ +3 +0 0 2 0 1 1 1 -1 +0 0 1 1 0 1 1 0 +0 0 1 1 1 0 0 1 diff --git a/codenet/public_test_cases/p02295/output.0.txt b/codenet/public_test_cases/p02295/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a74c9c778aa09f023b1d97dd9df896320c68bbd --- /dev/null +++ b/codenet/public_test_cases/p02295/output.0.txt @@ -0,0 +1,3 @@ +1.0000000000 0.0000000000 +0.5000000000 0.5000000000 +0.5000000000 0.5000000000 diff --git a/codenet/public_test_cases/p02295/output.1.txt b/codenet/public_test_cases/p02295/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a74c9c778aa09f023b1d97dd9df896320c68bbd --- /dev/null +++ b/codenet/public_test_cases/p02295/output.1.txt @@ -0,0 +1,3 @@ +1.0000000000 0.0000000000 +0.5000000000 0.5000000000 +0.5000000000 0.5000000000 diff --git a/codenet/public_test_cases/p02296/input.0.txt b/codenet/public_test_cases/p02296/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64109280ceb953bb3d4695d5d2afbddb9ab4c1b6 --- /dev/null +++ b/codenet/public_test_cases/p02296/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 1 0 0 1 1 1 +0 0 1 0 2 1 1 2 +-1 0 1 0 0 1 0 -1 diff --git a/codenet/public_test_cases/p02296/input.1.txt b/codenet/public_test_cases/p02296/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64109280ceb953bb3d4695d5d2afbddb9ab4c1b6 --- /dev/null +++ b/codenet/public_test_cases/p02296/input.1.txt @@ -0,0 +1,4 @@ +3 +0 0 1 0 0 1 1 1 +0 0 1 0 2 1 1 2 +-1 0 1 0 0 1 0 -1 diff --git a/codenet/public_test_cases/p02296/output.0.txt b/codenet/public_test_cases/p02296/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29666cf3656330c806b6c255dc91d35c2cc32d30 --- /dev/null +++ b/codenet/public_test_cases/p02296/output.0.txt @@ -0,0 +1,3 @@ +1.0000000000 +1.4142135624 +0.0000000000 diff --git a/codenet/public_test_cases/p02296/output.1.txt b/codenet/public_test_cases/p02296/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29666cf3656330c806b6c255dc91d35c2cc32d30 --- /dev/null +++ b/codenet/public_test_cases/p02296/output.1.txt @@ -0,0 +1,3 @@ +1.0000000000 +1.4142135624 +0.0000000000 diff --git a/codenet/public_test_cases/p02297/input.0.txt b/codenet/public_test_cases/p02297/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2467968eb54f7a8af90aefe499ce12124b064fa1 --- /dev/null +++ b/codenet/public_test_cases/p02297/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 +2 2 +-1 1 diff --git a/codenet/public_test_cases/p02297/input.1.txt b/codenet/public_test_cases/p02297/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..566d2a0762a8d7b1232b3592c929579cfa39b817 --- /dev/null +++ b/codenet/public_test_cases/p02297/input.1.txt @@ -0,0 +1,5 @@ +4 +0 0 +1 1 +1 2 +0 2 diff --git a/codenet/public_test_cases/p02297/input.2.txt b/codenet/public_test_cases/p02297/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2467968eb54f7a8af90aefe499ce12124b064fa1 --- /dev/null +++ b/codenet/public_test_cases/p02297/input.2.txt @@ -0,0 +1,4 @@ +3 +0 0 +2 2 +-1 1 diff --git a/codenet/public_test_cases/p02297/output.0.txt b/codenet/public_test_cases/p02297/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd5ac039d67e0bdadb17976e4ac39f0ffe6bb6e4 --- /dev/null +++ b/codenet/public_test_cases/p02297/output.0.txt @@ -0,0 +1 @@ +2.0 diff --git a/codenet/public_test_cases/p02297/output.1.txt b/codenet/public_test_cases/p02297/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c239c60cba28a79a295acb60a122b8c46eb57271 --- /dev/null +++ b/codenet/public_test_cases/p02297/output.1.txt @@ -0,0 +1 @@ +1.5 diff --git a/codenet/public_test_cases/p02297/output.2.txt b/codenet/public_test_cases/p02297/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd5ac039d67e0bdadb17976e4ac39f0ffe6bb6e4 --- /dev/null +++ b/codenet/public_test_cases/p02297/output.2.txt @@ -0,0 +1 @@ +2.0 diff --git a/codenet/public_test_cases/p02298/input.0.txt b/codenet/public_test_cases/p02298/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..893b452957f37c0a51376dddf10570c5127debe7 --- /dev/null +++ b/codenet/public_test_cases/p02298/input.0.txt @@ -0,0 +1,5 @@ +4 +0 0 +3 1 +2 3 +0 3 diff --git a/codenet/public_test_cases/p02298/input.1.txt b/codenet/public_test_cases/p02298/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f1b7f8065712c075fdd1e364cf5dd6a2ea38524 --- /dev/null +++ b/codenet/public_test_cases/p02298/input.1.txt @@ -0,0 +1,6 @@ +5 +0 0 +2 0 +1 1 +2 2 +0 2 diff --git a/codenet/public_test_cases/p02298/input.2.txt b/codenet/public_test_cases/p02298/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..893b452957f37c0a51376dddf10570c5127debe7 --- /dev/null +++ b/codenet/public_test_cases/p02298/input.2.txt @@ -0,0 +1,5 @@ +4 +0 0 +3 1 +2 3 +0 3 diff --git a/codenet/public_test_cases/p02298/output.0.txt b/codenet/public_test_cases/p02298/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02298/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02298/output.1.txt b/codenet/public_test_cases/p02298/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02298/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02298/output.2.txt b/codenet/public_test_cases/p02298/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02298/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02299/input.0.txt b/codenet/public_test_cases/p02299/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe7367fe71de452330b062ea72c06d48c7a2437c --- /dev/null +++ b/codenet/public_test_cases/p02299/input.0.txt @@ -0,0 +1,9 @@ +4 +0 0 +3 1 +2 3 +0 3 +3 +2 1 +0 2 +3 2 diff --git a/codenet/public_test_cases/p02299/input.1.txt b/codenet/public_test_cases/p02299/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe7367fe71de452330b062ea72c06d48c7a2437c --- /dev/null +++ b/codenet/public_test_cases/p02299/input.1.txt @@ -0,0 +1,9 @@ +4 +0 0 +3 1 +2 3 +0 3 +3 +2 1 +0 2 +3 2 diff --git a/codenet/public_test_cases/p02299/output.0.txt b/codenet/public_test_cases/p02299/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p02299/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p02299/output.1.txt b/codenet/public_test_cases/p02299/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae136939b6458299c7b446764a479033f16adf8c --- /dev/null +++ b/codenet/public_test_cases/p02299/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/codenet/public_test_cases/p02300/input.0.txt b/codenet/public_test_cases/p02300/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1abf4cda4d0fa68c5beb679e335699fe476d1624 --- /dev/null +++ b/codenet/public_test_cases/p02300/input.0.txt @@ -0,0 +1,8 @@ +7 +2 1 +0 0 +1 2 +2 2 +4 2 +1 3 +3 3 diff --git a/codenet/public_test_cases/p02300/input.1.txt b/codenet/public_test_cases/p02300/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..709b47270284a92883dbcfcdb2567934be92564c --- /dev/null +++ b/codenet/public_test_cases/p02300/input.1.txt @@ -0,0 +1,5 @@ +4 +0 0 +2 2 +0 2 +0 1 diff --git a/codenet/public_test_cases/p02300/input.2.txt b/codenet/public_test_cases/p02300/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1abf4cda4d0fa68c5beb679e335699fe476d1624 --- /dev/null +++ b/codenet/public_test_cases/p02300/input.2.txt @@ -0,0 +1,8 @@ +7 +2 1 +0 0 +1 2 +2 2 +4 2 +1 3 +3 3 diff --git a/codenet/public_test_cases/p02300/output.0.txt b/codenet/public_test_cases/p02300/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56ecfda7b845451d6db0e5ecad867be8d3bad1f5 --- /dev/null +++ b/codenet/public_test_cases/p02300/output.0.txt @@ -0,0 +1,6 @@ +5 +0 0 +2 1 +4 2 +3 3 +1 3 diff --git a/codenet/public_test_cases/p02300/output.1.txt b/codenet/public_test_cases/p02300/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..709b47270284a92883dbcfcdb2567934be92564c --- /dev/null +++ b/codenet/public_test_cases/p02300/output.1.txt @@ -0,0 +1,5 @@ +4 +0 0 +2 2 +0 2 +0 1 diff --git a/codenet/public_test_cases/p02300/output.2.txt b/codenet/public_test_cases/p02300/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..56ecfda7b845451d6db0e5ecad867be8d3bad1f5 --- /dev/null +++ b/codenet/public_test_cases/p02300/output.2.txt @@ -0,0 +1,6 @@ +5 +0 0 +2 1 +4 2 +3 3 +1 3 diff --git a/codenet/public_test_cases/p02301/input.0.txt b/codenet/public_test_cases/p02301/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..04b1ba04c38afab7f41902822a1292d71c153ae8 --- /dev/null +++ b/codenet/public_test_cases/p02301/input.0.txt @@ -0,0 +1,4 @@ +3 +0.0 0.0 +4.0 0.0 +2.0 2.0 diff --git a/codenet/public_test_cases/p02301/input.1.txt b/codenet/public_test_cases/p02301/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..77c79e4829b71bb66fcb5e55991cbd05d3544241 --- /dev/null +++ b/codenet/public_test_cases/p02301/input.1.txt @@ -0,0 +1,5 @@ +4 +0.0 0.0 +1.0 0.0 +1.0 1.0 +0.0 1.0 diff --git a/codenet/public_test_cases/p02301/input.2.txt b/codenet/public_test_cases/p02301/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..04b1ba04c38afab7f41902822a1292d71c153ae8 --- /dev/null +++ b/codenet/public_test_cases/p02301/input.2.txt @@ -0,0 +1,4 @@ +3 +0.0 0.0 +4.0 0.0 +2.0 2.0 diff --git a/codenet/public_test_cases/p02301/output.0.txt b/codenet/public_test_cases/p02301/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7371a1fd76056b4800c4d03be25faae45ed88b65 --- /dev/null +++ b/codenet/public_test_cases/p02301/output.0.txt @@ -0,0 +1 @@ +4.00 diff --git a/codenet/public_test_cases/p02301/output.1.txt b/codenet/public_test_cases/p02301/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f912f7ce818c32feaf4683cd68955ccea4738c1 --- /dev/null +++ b/codenet/public_test_cases/p02301/output.1.txt @@ -0,0 +1 @@ +1.414213562373 diff --git a/codenet/public_test_cases/p02301/output.2.txt b/codenet/public_test_cases/p02301/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7371a1fd76056b4800c4d03be25faae45ed88b65 --- /dev/null +++ b/codenet/public_test_cases/p02301/output.2.txt @@ -0,0 +1 @@ +4.00 diff --git a/codenet/public_test_cases/p02302/input.0.txt b/codenet/public_test_cases/p02302/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d96fc61dc8742279256ce00901708e11d06f9b4f --- /dev/null +++ b/codenet/public_test_cases/p02302/input.0.txt @@ -0,0 +1,8 @@ +4 +1 1 +4 1 +4 3 +1 3 +2 +2 0 2 4 +2 4 2 0 diff --git a/codenet/public_test_cases/p02302/input.1.txt b/codenet/public_test_cases/p02302/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d96fc61dc8742279256ce00901708e11d06f9b4f --- /dev/null +++ b/codenet/public_test_cases/p02302/input.1.txt @@ -0,0 +1,8 @@ +4 +1 1 +4 1 +4 3 +1 3 +2 +2 0 2 4 +2 4 2 0 diff --git a/codenet/public_test_cases/p02302/output.0.txt b/codenet/public_test_cases/p02302/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cb34a5a48046176c75771626138432a1eaa9fc5 --- /dev/null +++ b/codenet/public_test_cases/p02302/output.0.txt @@ -0,0 +1,2 @@ +2.00000000 +4.00000000 diff --git a/codenet/public_test_cases/p02302/output.1.txt b/codenet/public_test_cases/p02302/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cb34a5a48046176c75771626138432a1eaa9fc5 --- /dev/null +++ b/codenet/public_test_cases/p02302/output.1.txt @@ -0,0 +1,2 @@ +2.00000000 +4.00000000 diff --git a/codenet/public_test_cases/p02303/input.0.txt b/codenet/public_test_cases/p02303/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4235350564a4d71a443106563ade6684bf7a6717 --- /dev/null +++ b/codenet/public_test_cases/p02303/input.0.txt @@ -0,0 +1,3 @@ +2 +0.0 0.0 +1.0 0.0 diff --git a/codenet/public_test_cases/p02303/input.1.txt b/codenet/public_test_cases/p02303/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc6e110c63f72bdfb1a8cc563b87a4160fe47fc9 --- /dev/null +++ b/codenet/public_test_cases/p02303/input.1.txt @@ -0,0 +1,4 @@ +3 +0.0 0.0 +2.0 0.0 +1.0 1.0 diff --git a/codenet/public_test_cases/p02303/input.2.txt b/codenet/public_test_cases/p02303/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4235350564a4d71a443106563ade6684bf7a6717 --- /dev/null +++ b/codenet/public_test_cases/p02303/input.2.txt @@ -0,0 +1,3 @@ +2 +0.0 0.0 +1.0 0.0 diff --git a/codenet/public_test_cases/p02303/output.0.txt b/codenet/public_test_cases/p02303/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..961b372472a1809353ba4658ea88ca265d88b75c --- /dev/null +++ b/codenet/public_test_cases/p02303/output.0.txt @@ -0,0 +1 @@ +1.000000 diff --git a/codenet/public_test_cases/p02303/output.1.txt b/codenet/public_test_cases/p02303/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4436f858383de2766ddb01bb7b5d4518e16743f7 --- /dev/null +++ b/codenet/public_test_cases/p02303/output.1.txt @@ -0,0 +1 @@ +1.41421356237 diff --git a/codenet/public_test_cases/p02303/output.2.txt b/codenet/public_test_cases/p02303/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..961b372472a1809353ba4658ea88ca265d88b75c --- /dev/null +++ b/codenet/public_test_cases/p02303/output.2.txt @@ -0,0 +1 @@ +1.000000 diff --git a/codenet/public_test_cases/p02304/input.0.txt b/codenet/public_test_cases/p02304/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82fcea038a215bf3151bbe74c6ad801c88d7ed4e --- /dev/null +++ b/codenet/public_test_cases/p02304/input.0.txt @@ -0,0 +1,7 @@ +6 +2 2 2 5 +1 3 5 3 +4 1 4 4 +5 2 7 2 +6 1 6 3 +6 5 6 7 diff --git a/codenet/public_test_cases/p02304/input.1.txt b/codenet/public_test_cases/p02304/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..82fcea038a215bf3151bbe74c6ad801c88d7ed4e --- /dev/null +++ b/codenet/public_test_cases/p02304/input.1.txt @@ -0,0 +1,7 @@ +6 +2 2 2 5 +1 3 5 3 +4 1 4 4 +5 2 7 2 +6 1 6 3 +6 5 6 7 diff --git a/codenet/public_test_cases/p02304/output.0.txt b/codenet/public_test_cases/p02304/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02304/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02304/output.1.txt b/codenet/public_test_cases/p02304/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02304/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02305/input.0.txt b/codenet/public_test_cases/p02305/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e29239987be561be7fd3fafdd6ebacf5b6ce37aa --- /dev/null +++ b/codenet/public_test_cases/p02305/input.0.txt @@ -0,0 +1,2 @@ +1 1 1 +6 2 2 diff --git a/codenet/public_test_cases/p02305/input.1.txt b/codenet/public_test_cases/p02305/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..95941653a2e546765842d8ecb20ef822bcc4f35f --- /dev/null +++ b/codenet/public_test_cases/p02305/input.1.txt @@ -0,0 +1,2 @@ +0 0 1 +1 0 2 diff --git a/codenet/public_test_cases/p02305/input.2.txt b/codenet/public_test_cases/p02305/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc704680981f5401735a1b211f140e7553e3126f --- /dev/null +++ b/codenet/public_test_cases/p02305/input.2.txt @@ -0,0 +1,2 @@ +1 2 1 +3 2 2 diff --git a/codenet/public_test_cases/p02305/input.3.txt b/codenet/public_test_cases/p02305/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3123e4f517bb1befa416a6b1a5b2816531959b7 --- /dev/null +++ b/codenet/public_test_cases/p02305/input.3.txt @@ -0,0 +1,2 @@ +0 0 1 +0 0 2 diff --git a/codenet/public_test_cases/p02305/input.4.txt b/codenet/public_test_cases/p02305/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccfc6958895fbd35fe90c66aa546baae98716ccd --- /dev/null +++ b/codenet/public_test_cases/p02305/input.4.txt @@ -0,0 +1,2 @@ +1 2 1 +4 2 2 diff --git a/codenet/public_test_cases/p02305/input.5.txt b/codenet/public_test_cases/p02305/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..e29239987be561be7fd3fafdd6ebacf5b6ce37aa --- /dev/null +++ b/codenet/public_test_cases/p02305/input.5.txt @@ -0,0 +1,2 @@ +1 1 1 +6 2 2 diff --git a/codenet/public_test_cases/p02305/output.0.txt b/codenet/public_test_cases/p02305/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02305/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02305/output.1.txt b/codenet/public_test_cases/p02305/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02305/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02305/output.2.txt b/codenet/public_test_cases/p02305/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02305/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02305/output.3.txt b/codenet/public_test_cases/p02305/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02305/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02305/output.4.txt b/codenet/public_test_cases/p02305/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02305/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02305/output.5.txt b/codenet/public_test_cases/p02305/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02305/output.5.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02306/input.0.txt b/codenet/public_test_cases/p02306/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9595c1db829917ad8f98d7c398c21e7a4a6d4300 --- /dev/null +++ b/codenet/public_test_cases/p02306/input.0.txt @@ -0,0 +1,3 @@ +1 -2 +3 2 +-2 0 diff --git a/codenet/public_test_cases/p02306/input.1.txt b/codenet/public_test_cases/p02306/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0dfa60eef33574d0eebce73b9bcd3ba56f05963 --- /dev/null +++ b/codenet/public_test_cases/p02306/input.1.txt @@ -0,0 +1,3 @@ +0 3 +4 0 +0 0 diff --git a/codenet/public_test_cases/p02306/input.2.txt b/codenet/public_test_cases/p02306/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9595c1db829917ad8f98d7c398c21e7a4a6d4300 --- /dev/null +++ b/codenet/public_test_cases/p02306/input.2.txt @@ -0,0 +1,3 @@ +1 -2 +3 2 +-2 0 diff --git a/codenet/public_test_cases/p02306/output.0.txt b/codenet/public_test_cases/p02306/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9282b30b6745c5eca23d3bd4db7f66c3559f1769 --- /dev/null +++ b/codenet/public_test_cases/p02306/output.0.txt @@ -0,0 +1 @@ +0.53907943898209422325 -0.26437392711448356856 1.18845545916395465278 diff --git a/codenet/public_test_cases/p02306/output.1.txt b/codenet/public_test_cases/p02306/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b4abbd3e8c0955cdab19faaf154aa2e4b09bdac --- /dev/null +++ b/codenet/public_test_cases/p02306/output.1.txt @@ -0,0 +1 @@ +1.00000000000000000000 1.00000000000000000000 1.00000000000000000000 diff --git a/codenet/public_test_cases/p02306/output.2.txt b/codenet/public_test_cases/p02306/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9282b30b6745c5eca23d3bd4db7f66c3559f1769 --- /dev/null +++ b/codenet/public_test_cases/p02306/output.2.txt @@ -0,0 +1 @@ +0.53907943898209422325 -0.26437392711448356856 1.18845545916395465278 diff --git a/codenet/public_test_cases/p02307/input.0.txt b/codenet/public_test_cases/p02307/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9595c1db829917ad8f98d7c398c21e7a4a6d4300 --- /dev/null +++ b/codenet/public_test_cases/p02307/input.0.txt @@ -0,0 +1,3 @@ +1 -2 +3 2 +-2 0 diff --git a/codenet/public_test_cases/p02307/input.1.txt b/codenet/public_test_cases/p02307/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9595c1db829917ad8f98d7c398c21e7a4a6d4300 --- /dev/null +++ b/codenet/public_test_cases/p02307/input.1.txt @@ -0,0 +1,3 @@ +1 -2 +3 2 +-2 0 diff --git a/codenet/public_test_cases/p02307/input.2.txt b/codenet/public_test_cases/p02307/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0dfa60eef33574d0eebce73b9bcd3ba56f05963 --- /dev/null +++ b/codenet/public_test_cases/p02307/input.2.txt @@ -0,0 +1,3 @@ +0 3 +4 0 +0 0 diff --git a/codenet/public_test_cases/p02307/output.0.txt b/codenet/public_test_cases/p02307/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61a5b2cfccdf9d98f3e5413837b2db20f209da1b --- /dev/null +++ b/codenet/public_test_cases/p02307/output.0.txt @@ -0,0 +1 @@ +0.62500000000000000000 0.68750000000000000000 2.71353666826155124291 diff --git a/codenet/public_test_cases/p02307/output.1.txt b/codenet/public_test_cases/p02307/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..61a5b2cfccdf9d98f3e5413837b2db20f209da1b --- /dev/null +++ b/codenet/public_test_cases/p02307/output.1.txt @@ -0,0 +1 @@ +0.62500000000000000000 0.68750000000000000000 2.71353666826155124291 diff --git a/codenet/public_test_cases/p02307/output.2.txt b/codenet/public_test_cases/p02307/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0daba0d446304469978a70895bd078d5cfb0719 --- /dev/null +++ b/codenet/public_test_cases/p02307/output.2.txt @@ -0,0 +1 @@ +2.00000000000000000000 1.50000000000000000000 2.50000000000000000000 diff --git a/codenet/public_test_cases/p02308/input.0.txt b/codenet/public_test_cases/p02308/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76586d29653a7dd3961059bd01bb08eca5129d11 --- /dev/null +++ b/codenet/public_test_cases/p02308/input.0.txt @@ -0,0 +1,4 @@ +2 1 1 +2 +0 1 4 1 +3 0 3 3 diff --git a/codenet/public_test_cases/p02308/input.1.txt b/codenet/public_test_cases/p02308/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76586d29653a7dd3961059bd01bb08eca5129d11 --- /dev/null +++ b/codenet/public_test_cases/p02308/input.1.txt @@ -0,0 +1,4 @@ +2 1 1 +2 +0 1 4 1 +3 0 3 3 diff --git a/codenet/public_test_cases/p02308/output.0.txt b/codenet/public_test_cases/p02308/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..782fd5be60ce915300ac42f0431729d04df2f43d --- /dev/null +++ b/codenet/public_test_cases/p02308/output.0.txt @@ -0,0 +1,2 @@ +1.00000000 1.00000000 3.00000000 1.00000000 +3.00000000 1.00000000 3.00000000 1.00000000 diff --git a/codenet/public_test_cases/p02308/output.1.txt b/codenet/public_test_cases/p02308/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..782fd5be60ce915300ac42f0431729d04df2f43d --- /dev/null +++ b/codenet/public_test_cases/p02308/output.1.txt @@ -0,0 +1,2 @@ +1.00000000 1.00000000 3.00000000 1.00000000 +3.00000000 1.00000000 3.00000000 1.00000000 diff --git a/codenet/public_test_cases/p02309/input.0.txt b/codenet/public_test_cases/p02309/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18f489e434ccbd1713d7475b4ee969d1b03f506d --- /dev/null +++ b/codenet/public_test_cases/p02309/input.0.txt @@ -0,0 +1,2 @@ +0 0 2 +2 0 2 diff --git a/codenet/public_test_cases/p02309/input.1.txt b/codenet/public_test_cases/p02309/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18f489e434ccbd1713d7475b4ee969d1b03f506d --- /dev/null +++ b/codenet/public_test_cases/p02309/input.1.txt @@ -0,0 +1,2 @@ +0 0 2 +2 0 2 diff --git a/codenet/public_test_cases/p02309/input.2.txt b/codenet/public_test_cases/p02309/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f82d0743d6bd29187ae8213c92eb0e23b3f7c6d --- /dev/null +++ b/codenet/public_test_cases/p02309/input.2.txt @@ -0,0 +1,2 @@ +0 0 2 +0 3 1 diff --git a/codenet/public_test_cases/p02309/output.0.txt b/codenet/public_test_cases/p02309/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bb867c9cdc37f89d802412c593212e7367a3e37 --- /dev/null +++ b/codenet/public_test_cases/p02309/output.0.txt @@ -0,0 +1 @@ +1.00000000 -1.73205080 1.00000000 1.73205080 diff --git a/codenet/public_test_cases/p02309/output.1.txt b/codenet/public_test_cases/p02309/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bb867c9cdc37f89d802412c593212e7367a3e37 --- /dev/null +++ b/codenet/public_test_cases/p02309/output.1.txt @@ -0,0 +1 @@ +1.00000000 -1.73205080 1.00000000 1.73205080 diff --git a/codenet/public_test_cases/p02309/output.2.txt b/codenet/public_test_cases/p02309/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..32b70d17921fa3605f856a2893d3476d5c973517 --- /dev/null +++ b/codenet/public_test_cases/p02309/output.2.txt @@ -0,0 +1 @@ +0.00000000 2.00000000 0.00000000 2.00000000 diff --git a/codenet/public_test_cases/p02310/input.0.txt b/codenet/public_test_cases/p02310/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91cd77ee6068a73771872abaf88e6b2fc693398e --- /dev/null +++ b/codenet/public_test_cases/p02310/input.0.txt @@ -0,0 +1,2 @@ +0 0 +2 2 2 diff --git a/codenet/public_test_cases/p02310/input.1.txt b/codenet/public_test_cases/p02310/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..68fdc62e37721187193de25a1b86b8bae49efc45 --- /dev/null +++ b/codenet/public_test_cases/p02310/input.1.txt @@ -0,0 +1,2 @@ +-3 0 +2 2 2 diff --git a/codenet/public_test_cases/p02310/input.2.txt b/codenet/public_test_cases/p02310/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..91cd77ee6068a73771872abaf88e6b2fc693398e --- /dev/null +++ b/codenet/public_test_cases/p02310/input.2.txt @@ -0,0 +1,2 @@ +0 0 +2 2 2 diff --git a/codenet/public_test_cases/p02310/output.0.txt b/codenet/public_test_cases/p02310/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37bcb8ec957b365a97cb2f9cda0d7fd10aeeb001 --- /dev/null +++ b/codenet/public_test_cases/p02310/output.0.txt @@ -0,0 +1,2 @@ +0.0000000000 2.0000000000 +2.0000000000 0.0000000000 diff --git a/codenet/public_test_cases/p02310/output.1.txt b/codenet/public_test_cases/p02310/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6533371370d3b6470dfb1f601ec2478ee80c8bf0 --- /dev/null +++ b/codenet/public_test_cases/p02310/output.1.txt @@ -0,0 +1,2 @@ +0.6206896552 3.4482758621 +2.0000000000 0.0000000000 diff --git a/codenet/public_test_cases/p02310/output.2.txt b/codenet/public_test_cases/p02310/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..37bcb8ec957b365a97cb2f9cda0d7fd10aeeb001 --- /dev/null +++ b/codenet/public_test_cases/p02310/output.2.txt @@ -0,0 +1,2 @@ +0.0000000000 2.0000000000 +2.0000000000 0.0000000000 diff --git a/codenet/public_test_cases/p02311/input.0.txt b/codenet/public_test_cases/p02311/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e29239987be561be7fd3fafdd6ebacf5b6ce37aa --- /dev/null +++ b/codenet/public_test_cases/p02311/input.0.txt @@ -0,0 +1,2 @@ +1 1 1 +6 2 2 diff --git a/codenet/public_test_cases/p02311/input.1.txt b/codenet/public_test_cases/p02311/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccfc6958895fbd35fe90c66aa546baae98716ccd --- /dev/null +++ b/codenet/public_test_cases/p02311/input.1.txt @@ -0,0 +1,2 @@ +1 2 1 +4 2 2 diff --git a/codenet/public_test_cases/p02311/input.2.txt b/codenet/public_test_cases/p02311/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc704680981f5401735a1b211f140e7553e3126f --- /dev/null +++ b/codenet/public_test_cases/p02311/input.2.txt @@ -0,0 +1,2 @@ +1 2 1 +3 2 2 diff --git a/codenet/public_test_cases/p02311/input.3.txt b/codenet/public_test_cases/p02311/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..95941653a2e546765842d8ecb20ef822bcc4f35f --- /dev/null +++ b/codenet/public_test_cases/p02311/input.3.txt @@ -0,0 +1,2 @@ +0 0 1 +1 0 2 diff --git a/codenet/public_test_cases/p02311/input.4.txt b/codenet/public_test_cases/p02311/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e29239987be561be7fd3fafdd6ebacf5b6ce37aa --- /dev/null +++ b/codenet/public_test_cases/p02311/input.4.txt @@ -0,0 +1,2 @@ +1 1 1 +6 2 2 diff --git a/codenet/public_test_cases/p02311/output.0.txt b/codenet/public_test_cases/p02311/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ae85759a1b9768289e8fb6b3ce9f3a35078f3cf --- /dev/null +++ b/codenet/public_test_cases/p02311/output.0.txt @@ -0,0 +1,4 @@ +0.6153846154 1.9230769231 +1.0000000000 0.0000000000 +1.4183420913 1.9082895434 +1.7355040625 0.3224796874 diff --git a/codenet/public_test_cases/p02311/output.1.txt b/codenet/public_test_cases/p02311/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0dee1beed9b8f91d94a6f95a46e6fdad6e214f6c --- /dev/null +++ b/codenet/public_test_cases/p02311/output.1.txt @@ -0,0 +1,3 @@ +0.6666666667 1.0571909584 +0.6666666667 2.9428090416 +2.0000000000 2.0000000000 diff --git a/codenet/public_test_cases/p02311/output.2.txt b/codenet/public_test_cases/p02311/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..97da67cd8137811a9d0857bcb27ae3b1f6a99533 --- /dev/null +++ b/codenet/public_test_cases/p02311/output.2.txt @@ -0,0 +1,2 @@ +0.5000000000 1.1339745962 +0.5000000000 2.8660254038 diff --git a/codenet/public_test_cases/p02311/output.3.txt b/codenet/public_test_cases/p02311/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bda7db851b060669dbe6a3520cf7c4e9fe7a8462 --- /dev/null +++ b/codenet/public_test_cases/p02311/output.3.txt @@ -0,0 +1 @@ +-1.0000000000 0.0000000000 diff --git a/codenet/public_test_cases/p02311/output.4.txt b/codenet/public_test_cases/p02311/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ae85759a1b9768289e8fb6b3ce9f3a35078f3cf --- /dev/null +++ b/codenet/public_test_cases/p02311/output.4.txt @@ -0,0 +1,4 @@ +0.6153846154 1.9230769231 +1.0000000000 0.0000000000 +1.4183420913 1.9082895434 +1.7355040625 0.3224796874 diff --git a/codenet/public_test_cases/p02312/input.0.txt b/codenet/public_test_cases/p02312/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dc82a13c4ae95bf0abeb8b4da52bbdf2841fa43 --- /dev/null +++ b/codenet/public_test_cases/p02312/input.0.txt @@ -0,0 +1,4 @@ +3 5 +1 1 +4 1 +5 5 diff --git a/codenet/public_test_cases/p02312/input.1.txt b/codenet/public_test_cases/p02312/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8f3acbc37fec69b9b9741825644ac4986182636 --- /dev/null +++ b/codenet/public_test_cases/p02312/input.1.txt @@ -0,0 +1,5 @@ +4 5 +0 0 +-3 -6 +1 -3 +5 -4 diff --git a/codenet/public_test_cases/p02312/input.2.txt b/codenet/public_test_cases/p02312/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dc82a13c4ae95bf0abeb8b4da52bbdf2841fa43 --- /dev/null +++ b/codenet/public_test_cases/p02312/input.2.txt @@ -0,0 +1,4 @@ +3 5 +1 1 +4 1 +5 5 diff --git a/codenet/public_test_cases/p02312/output.0.txt b/codenet/public_test_cases/p02312/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52ce0b812a480108cb8b5f28789b6383ae872d5e --- /dev/null +++ b/codenet/public_test_cases/p02312/output.0.txt @@ -0,0 +1 @@ +4.639858417607 diff --git a/codenet/public_test_cases/p02312/output.1.txt b/codenet/public_test_cases/p02312/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4677e89f8568cfc4898897208762d647584dce9e --- /dev/null +++ b/codenet/public_test_cases/p02312/output.1.txt @@ -0,0 +1 @@ +11.787686807576 diff --git a/codenet/public_test_cases/p02312/output.2.txt b/codenet/public_test_cases/p02312/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..52ce0b812a480108cb8b5f28789b6383ae872d5e --- /dev/null +++ b/codenet/public_test_cases/p02312/output.2.txt @@ -0,0 +1 @@ +4.639858417607 diff --git a/codenet/public_test_cases/p02313/input.0.txt b/codenet/public_test_cases/p02313/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88e5702f650bab7eafeed6d16d7bfa86ecc33184 --- /dev/null +++ b/codenet/public_test_cases/p02313/input.0.txt @@ -0,0 +1,2 @@ +0 0 1 +2 0 2 diff --git a/codenet/public_test_cases/p02313/input.1.txt b/codenet/public_test_cases/p02313/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0895b9c64f9a8c04c184c6700cccb0321349a576 --- /dev/null +++ b/codenet/public_test_cases/p02313/input.1.txt @@ -0,0 +1,2 @@ +1 0 1 +0 0 3 diff --git a/codenet/public_test_cases/p02313/input.2.txt b/codenet/public_test_cases/p02313/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..88e5702f650bab7eafeed6d16d7bfa86ecc33184 --- /dev/null +++ b/codenet/public_test_cases/p02313/input.2.txt @@ -0,0 +1,2 @@ +0 0 1 +2 0 2 diff --git a/codenet/public_test_cases/p02313/output.0.txt b/codenet/public_test_cases/p02313/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8aa41e2ffa3ae286d570ac6fbc39e9ed01097a83 --- /dev/null +++ b/codenet/public_test_cases/p02313/output.0.txt @@ -0,0 +1 @@ +1.40306643968573875104 diff --git a/codenet/public_test_cases/p02313/output.1.txt b/codenet/public_test_cases/p02313/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2835ad5c6d933fcd643f1c61c80d8d5a9a3f6dc9 --- /dev/null +++ b/codenet/public_test_cases/p02313/output.1.txt @@ -0,0 +1 @@ +3.14159265358979311600 diff --git a/codenet/public_test_cases/p02313/output.2.txt b/codenet/public_test_cases/p02313/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8aa41e2ffa3ae286d570ac6fbc39e9ed01097a83 --- /dev/null +++ b/codenet/public_test_cases/p02313/output.2.txt @@ -0,0 +1 @@ +1.40306643968573875104 diff --git a/codenet/public_test_cases/p02314/input.0.txt b/codenet/public_test_cases/p02314/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93598206c03693fb2ebebcf3b8796c21651ae241 --- /dev/null +++ b/codenet/public_test_cases/p02314/input.0.txt @@ -0,0 +1,2 @@ +55 4 +1 5 10 50 diff --git a/codenet/public_test_cases/p02314/output.0.txt b/codenet/public_test_cases/p02314/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02314/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02315/input.0.txt b/codenet/public_test_cases/p02315/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb569793a4e9ddf3bf1b1e48bad84ed6ac3a161c --- /dev/null +++ b/codenet/public_test_cases/p02315/input.0.txt @@ -0,0 +1,5 @@ +4 5 +4 2 +5 2 +2 1 +8 3 diff --git a/codenet/public_test_cases/p02315/output.0.txt b/codenet/public_test_cases/p02315/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02315/output.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02316/input.0.txt b/codenet/public_test_cases/p02316/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66fc8a86f9abd5c7c69879ae27e8120f9a46cde5 --- /dev/null +++ b/codenet/public_test_cases/p02316/input.0.txt @@ -0,0 +1,5 @@ +4 8 +4 2 +5 2 +2 1 +8 3 diff --git a/codenet/public_test_cases/p02316/output.0.txt b/codenet/public_test_cases/p02316/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p02316/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p02317/input.0.txt b/codenet/public_test_cases/p02317/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..517ea76f1b346eca3ef92cc3e02e9e5e78b469e7 --- /dev/null +++ b/codenet/public_test_cases/p02317/input.0.txt @@ -0,0 +1,6 @@ +5 +5 +1 +3 +2 +4 diff --git a/codenet/public_test_cases/p02317/input.1.txt b/codenet/public_test_cases/p02317/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..517ea76f1b346eca3ef92cc3e02e9e5e78b469e7 --- /dev/null +++ b/codenet/public_test_cases/p02317/input.1.txt @@ -0,0 +1,6 @@ +5 +5 +1 +3 +2 +4 diff --git a/codenet/public_test_cases/p02317/input.2.txt b/codenet/public_test_cases/p02317/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..575c8010c20dc4b93b9e7a109380bc16b3e4663d --- /dev/null +++ b/codenet/public_test_cases/p02317/input.2.txt @@ -0,0 +1,4 @@ +3 +1 +1 +1 diff --git a/codenet/public_test_cases/p02317/output.0.txt b/codenet/public_test_cases/p02317/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02317/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02317/output.1.txt b/codenet/public_test_cases/p02317/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02317/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02317/output.2.txt b/codenet/public_test_cases/p02317/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02317/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02318/input.0.txt b/codenet/public_test_cases/p02318/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28a7685a97ecdd5a42076617c5ddef4f77bf3325 --- /dev/null +++ b/codenet/public_test_cases/p02318/input.0.txt @@ -0,0 +1,2 @@ +acac +acm diff --git a/codenet/public_test_cases/p02318/input.1.txt b/codenet/public_test_cases/p02318/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8b955de5e5283a6a9b000e3b5fc834d05f5ef9 --- /dev/null +++ b/codenet/public_test_cases/p02318/input.1.txt @@ -0,0 +1,2 @@ +icpc +icpc diff --git a/codenet/public_test_cases/p02318/input.2.txt b/codenet/public_test_cases/p02318/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..28a7685a97ecdd5a42076617c5ddef4f77bf3325 --- /dev/null +++ b/codenet/public_test_cases/p02318/input.2.txt @@ -0,0 +1,2 @@ +acac +acm diff --git a/codenet/public_test_cases/p02318/output.0.txt b/codenet/public_test_cases/p02318/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02318/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02318/output.1.txt b/codenet/public_test_cases/p02318/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02318/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02318/output.2.txt b/codenet/public_test_cases/p02318/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02318/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02319/input.0.txt b/codenet/public_test_cases/p02319/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb569793a4e9ddf3bf1b1e48bad84ed6ac3a161c --- /dev/null +++ b/codenet/public_test_cases/p02319/input.0.txt @@ -0,0 +1,5 @@ +4 5 +4 2 +5 2 +2 1 +8 3 diff --git a/codenet/public_test_cases/p02319/input.1.txt b/codenet/public_test_cases/p02319/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb569793a4e9ddf3bf1b1e48bad84ed6ac3a161c --- /dev/null +++ b/codenet/public_test_cases/p02319/input.1.txt @@ -0,0 +1,5 @@ +4 5 +4 2 +5 2 +2 1 +8 3 diff --git a/codenet/public_test_cases/p02319/input.2.txt b/codenet/public_test_cases/p02319/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea8ebf1dd10f7cada2444b0ba032a3f169396cd1 --- /dev/null +++ b/codenet/public_test_cases/p02319/input.2.txt @@ -0,0 +1,3 @@ +2 20 +5 9 +4 10 diff --git a/codenet/public_test_cases/p02319/output.0.txt b/codenet/public_test_cases/p02319/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02319/output.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02319/output.1.txt b/codenet/public_test_cases/p02319/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02319/output.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02319/output.2.txt b/codenet/public_test_cases/p02319/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02319/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02320/input.0.txt b/codenet/public_test_cases/p02320/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1ee2ba2edeecd4db9f4b27c3a0cf65c5ebaa47a --- /dev/null +++ b/codenet/public_test_cases/p02320/input.0.txt @@ -0,0 +1,5 @@ +4 8 +4 3 2 +2 1 1 +1 2 4 +3 2 2 diff --git a/codenet/public_test_cases/p02320/input.1.txt b/codenet/public_test_cases/p02320/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..545b04986b0b954b8af24ca6d510490b732997b8 --- /dev/null +++ b/codenet/public_test_cases/p02320/input.1.txt @@ -0,0 +1,3 @@ +2 100 +1 1 100 +2 1 50 diff --git a/codenet/public_test_cases/p02320/input.2.txt b/codenet/public_test_cases/p02320/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1ee2ba2edeecd4db9f4b27c3a0cf65c5ebaa47a --- /dev/null +++ b/codenet/public_test_cases/p02320/input.2.txt @@ -0,0 +1,5 @@ +4 8 +4 3 2 +2 1 1 +1 2 4 +3 2 2 diff --git a/codenet/public_test_cases/p02320/output.0.txt b/codenet/public_test_cases/p02320/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02320/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02320/output.1.txt b/codenet/public_test_cases/p02320/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa8f08cb6ff8a30dd34a3b442009bdfc798a7316 --- /dev/null +++ b/codenet/public_test_cases/p02320/output.1.txt @@ -0,0 +1 @@ +150 diff --git a/codenet/public_test_cases/p02320/output.2.txt b/codenet/public_test_cases/p02320/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02320/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02321/input.0.txt b/codenet/public_test_cases/p02321/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb569793a4e9ddf3bf1b1e48bad84ed6ac3a161c --- /dev/null +++ b/codenet/public_test_cases/p02321/input.0.txt @@ -0,0 +1,5 @@ +4 5 +4 2 +5 2 +2 1 +8 3 diff --git a/codenet/public_test_cases/p02321/input.1.txt b/codenet/public_test_cases/p02321/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb569793a4e9ddf3bf1b1e48bad84ed6ac3a161c --- /dev/null +++ b/codenet/public_test_cases/p02321/input.1.txt @@ -0,0 +1,5 @@ +4 5 +4 2 +5 2 +2 1 +8 3 diff --git a/codenet/public_test_cases/p02321/input.2.txt b/codenet/public_test_cases/p02321/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea8ebf1dd10f7cada2444b0ba032a3f169396cd1 --- /dev/null +++ b/codenet/public_test_cases/p02321/input.2.txt @@ -0,0 +1,3 @@ +2 20 +5 9 +4 10 diff --git a/codenet/public_test_cases/p02321/output.0.txt b/codenet/public_test_cases/p02321/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02321/output.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02321/output.1.txt b/codenet/public_test_cases/p02321/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02321/output.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02321/output.2.txt b/codenet/public_test_cases/p02321/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02321/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02322/input.0.txt b/codenet/public_test_cases/p02322/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1ee2ba2edeecd4db9f4b27c3a0cf65c5ebaa47a --- /dev/null +++ b/codenet/public_test_cases/p02322/input.0.txt @@ -0,0 +1,5 @@ +4 8 +4 3 2 +2 1 1 +1 2 4 +3 2 2 diff --git a/codenet/public_test_cases/p02322/input.1.txt b/codenet/public_test_cases/p02322/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..545b04986b0b954b8af24ca6d510490b732997b8 --- /dev/null +++ b/codenet/public_test_cases/p02322/input.1.txt @@ -0,0 +1,3 @@ +2 100 +1 1 100 +2 1 50 diff --git a/codenet/public_test_cases/p02322/input.2.txt b/codenet/public_test_cases/p02322/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..83cc0fc6b876ca4bc21b37738d6fc2da4acb94b9 --- /dev/null +++ b/codenet/public_test_cases/p02322/input.2.txt @@ -0,0 +1,6 @@ +5 1000000000 +3 5 1000000000 +7 6 1000000000 +4 4 1000000000 +6 8 1000000000 +2 5 1000000000 diff --git a/codenet/public_test_cases/p02322/input.3.txt b/codenet/public_test_cases/p02322/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1ee2ba2edeecd4db9f4b27c3a0cf65c5ebaa47a --- /dev/null +++ b/codenet/public_test_cases/p02322/input.3.txt @@ -0,0 +1,5 @@ +4 8 +4 3 2 +2 1 1 +1 2 4 +3 2 2 diff --git a/codenet/public_test_cases/p02322/output.0.txt b/codenet/public_test_cases/p02322/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02322/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02322/output.1.txt b/codenet/public_test_cases/p02322/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa8f08cb6ff8a30dd34a3b442009bdfc798a7316 --- /dev/null +++ b/codenet/public_test_cases/p02322/output.1.txt @@ -0,0 +1 @@ +150 diff --git a/codenet/public_test_cases/p02322/output.2.txt b/codenet/public_test_cases/p02322/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..26e0d00f5c5250dcd7e9110d9ff6e483d907e984 --- /dev/null +++ b/codenet/public_test_cases/p02322/output.2.txt @@ -0,0 +1 @@ +1166666666 diff --git a/codenet/public_test_cases/p02322/output.3.txt b/codenet/public_test_cases/p02322/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02322/output.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02323/input.0.txt b/codenet/public_test_cases/p02323/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..217c039dce44fdc678141c526d80fb65e5733a41 --- /dev/null +++ b/codenet/public_test_cases/p02323/input.0.txt @@ -0,0 +1,7 @@ +4 6 +0 1 2 +1 2 3 +1 3 9 +2 0 1 +2 3 6 +3 2 4 diff --git a/codenet/public_test_cases/p02323/input.1.txt b/codenet/public_test_cases/p02323/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6990c6a713973ebbbfd7646360c539777e672cc2 --- /dev/null +++ b/codenet/public_test_cases/p02323/input.1.txt @@ -0,0 +1,4 @@ +3 3 +0 1 1 +1 2 1 +0 2 1 diff --git a/codenet/public_test_cases/p02323/input.2.txt b/codenet/public_test_cases/p02323/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..217c039dce44fdc678141c526d80fb65e5733a41 --- /dev/null +++ b/codenet/public_test_cases/p02323/input.2.txt @@ -0,0 +1,7 @@ +4 6 +0 1 2 +1 2 3 +1 3 9 +2 0 1 +2 3 6 +3 2 4 diff --git a/codenet/public_test_cases/p02323/output.0.txt b/codenet/public_test_cases/p02323/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p02323/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p02323/output.1.txt b/codenet/public_test_cases/p02323/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02323/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02323/output.2.txt b/codenet/public_test_cases/p02323/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p02323/output.2.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p02324/input.0.txt b/codenet/public_test_cases/p02324/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f52680207eebfdb54bb9d7fc84e606c92b093ee --- /dev/null +++ b/codenet/public_test_cases/p02324/input.0.txt @@ -0,0 +1,5 @@ +4 4 +0 1 1 +0 2 2 +1 3 3 +2 3 4 diff --git a/codenet/public_test_cases/p02324/input.1.txt b/codenet/public_test_cases/p02324/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfae929bb59482b08961c76221657a742ce78632 --- /dev/null +++ b/codenet/public_test_cases/p02324/input.1.txt @@ -0,0 +1,6 @@ +4 5 +0 1 1 +0 2 2 +1 3 3 +2 3 4 +1 2 5 diff --git a/codenet/public_test_cases/p02324/input.2.txt b/codenet/public_test_cases/p02324/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f52680207eebfdb54bb9d7fc84e606c92b093ee --- /dev/null +++ b/codenet/public_test_cases/p02324/input.2.txt @@ -0,0 +1,5 @@ +4 4 +0 1 1 +0 2 2 +1 3 3 +2 3 4 diff --git a/codenet/public_test_cases/p02324/input.3.txt b/codenet/public_test_cases/p02324/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..077cde4b995260248125b0086a41b87472743b5e --- /dev/null +++ b/codenet/public_test_cases/p02324/input.3.txt @@ -0,0 +1,4 @@ +2 3 +0 1 1 +0 1 2 +0 1 3 diff --git a/codenet/public_test_cases/p02324/output.0.txt b/codenet/public_test_cases/p02324/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02324/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02324/output.1.txt b/codenet/public_test_cases/p02324/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p02324/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p02324/output.2.txt b/codenet/public_test_cases/p02324/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02324/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02324/output.3.txt b/codenet/public_test_cases/p02324/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02324/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02325/input.0.txt b/codenet/public_test_cases/p02325/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c51ee9807a3f6cdae1642095e97b05f5a2a506d --- /dev/null +++ b/codenet/public_test_cases/p02325/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 +1 1 +2 0 diff --git a/codenet/public_test_cases/p02325/input.1.txt b/codenet/public_test_cases/p02325/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c51ee9807a3f6cdae1642095e97b05f5a2a506d --- /dev/null +++ b/codenet/public_test_cases/p02325/input.1.txt @@ -0,0 +1,4 @@ +3 +0 0 +1 1 +2 0 diff --git a/codenet/public_test_cases/p02325/input.2.txt b/codenet/public_test_cases/p02325/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7332ad91fa3701b312416bc249834b47d905ea3b --- /dev/null +++ b/codenet/public_test_cases/p02325/input.2.txt @@ -0,0 +1,6 @@ +5 +0 0 +1 2 +2 1 +3 2 +4 0 diff --git a/codenet/public_test_cases/p02325/input.3.txt b/codenet/public_test_cases/p02325/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffeace4aff83d490685e549ae4288c0022f9d466 --- /dev/null +++ b/codenet/public_test_cases/p02325/input.3.txt @@ -0,0 +1,5 @@ +4 +0 1 +1 2 +2 0 +3 1 diff --git a/codenet/public_test_cases/p02325/output.0.txt b/codenet/public_test_cases/p02325/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27005323b5bd3feb9e0a21a087b51fe1e60ce468 --- /dev/null +++ b/codenet/public_test_cases/p02325/output.0.txt @@ -0,0 +1 @@ +4.82842712 diff --git a/codenet/public_test_cases/p02325/output.1.txt b/codenet/public_test_cases/p02325/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27005323b5bd3feb9e0a21a087b51fe1e60ce468 --- /dev/null +++ b/codenet/public_test_cases/p02325/output.1.txt @@ -0,0 +1 @@ +4.82842712 diff --git a/codenet/public_test_cases/p02325/output.2.txt b/codenet/public_test_cases/p02325/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bbd30d7a12aaf10cdc55adf4ae8afc5bb29cd48 --- /dev/null +++ b/codenet/public_test_cases/p02325/output.2.txt @@ -0,0 +1 @@ +10.94427191 diff --git a/codenet/public_test_cases/p02325/output.3.txt b/codenet/public_test_cases/p02325/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..311780dac96c411353cf65d643e6e5471abcd020 --- /dev/null +++ b/codenet/public_test_cases/p02325/output.3.txt @@ -0,0 +1 @@ +7.30056308 diff --git a/codenet/public_test_cases/p02326/input.0.txt b/codenet/public_test_cases/p02326/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d7bd9bfaf3ded71844de5a052f0f955fc43a177 --- /dev/null +++ b/codenet/public_test_cases/p02326/input.0.txt @@ -0,0 +1,5 @@ +4 5 +0 0 1 0 0 +1 0 0 0 0 +0 0 0 1 0 +0 0 0 1 0 diff --git a/codenet/public_test_cases/p02326/input.1.txt b/codenet/public_test_cases/p02326/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d7bd9bfaf3ded71844de5a052f0f955fc43a177 --- /dev/null +++ b/codenet/public_test_cases/p02326/input.1.txt @@ -0,0 +1,5 @@ +4 5 +0 0 1 0 0 +1 0 0 0 0 +0 0 0 1 0 +0 0 0 1 0 diff --git a/codenet/public_test_cases/p02326/output.0.txt b/codenet/public_test_cases/p02326/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02326/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02326/output.1.txt b/codenet/public_test_cases/p02326/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02326/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02327/input.0.txt b/codenet/public_test_cases/p02327/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d7bd9bfaf3ded71844de5a052f0f955fc43a177 --- /dev/null +++ b/codenet/public_test_cases/p02327/input.0.txt @@ -0,0 +1,5 @@ +4 5 +0 0 1 0 0 +1 0 0 0 0 +0 0 0 1 0 +0 0 0 1 0 diff --git a/codenet/public_test_cases/p02327/input.1.txt b/codenet/public_test_cases/p02327/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d7bd9bfaf3ded71844de5a052f0f955fc43a177 --- /dev/null +++ b/codenet/public_test_cases/p02327/input.1.txt @@ -0,0 +1,5 @@ +4 5 +0 0 1 0 0 +1 0 0 0 0 +0 0 0 1 0 +0 0 0 1 0 diff --git a/codenet/public_test_cases/p02327/output.0.txt b/codenet/public_test_cases/p02327/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02327/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02327/output.1.txt b/codenet/public_test_cases/p02327/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02327/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02328/input.0.txt b/codenet/public_test_cases/p02328/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1a61df111df99c4a211fc088318b1756b1099d6 --- /dev/null +++ b/codenet/public_test_cases/p02328/input.0.txt @@ -0,0 +1,2 @@ +8 +2 1 3 5 3 4 2 1 diff --git a/codenet/public_test_cases/p02328/input.1.txt b/codenet/public_test_cases/p02328/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1a61df111df99c4a211fc088318b1756b1099d6 --- /dev/null +++ b/codenet/public_test_cases/p02328/input.1.txt @@ -0,0 +1,2 @@ +8 +2 1 3 5 3 4 2 1 diff --git a/codenet/public_test_cases/p02328/input.2.txt b/codenet/public_test_cases/p02328/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5c2c53b733ef694e89c98e67ee800c707ca0d51 --- /dev/null +++ b/codenet/public_test_cases/p02328/input.2.txt @@ -0,0 +1,2 @@ +3 +2 0 1 diff --git a/codenet/public_test_cases/p02328/output.0.txt b/codenet/public_test_cases/p02328/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02328/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02328/output.1.txt b/codenet/public_test_cases/p02328/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02328/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02328/output.2.txt b/codenet/public_test_cases/p02328/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02328/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02329/input.0.txt b/codenet/public_test_cases/p02329/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4262ae3c806f49a58418c0121b1407055a3c2c9a --- /dev/null +++ b/codenet/public_test_cases/p02329/input.0.txt @@ -0,0 +1,5 @@ +3 14 +3 1 2 +4 8 2 +1 2 3 +7 3 2 diff --git a/codenet/public_test_cases/p02329/input.1.txt b/codenet/public_test_cases/p02329/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4262ae3c806f49a58418c0121b1407055a3c2c9a --- /dev/null +++ b/codenet/public_test_cases/p02329/input.1.txt @@ -0,0 +1,5 @@ +3 14 +3 1 2 +4 8 2 +1 2 3 +7 3 2 diff --git a/codenet/public_test_cases/p02329/input.2.txt b/codenet/public_test_cases/p02329/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7481c2a8e25cc1979ab0e53bc5fde347719cbf57 --- /dev/null +++ b/codenet/public_test_cases/p02329/input.2.txt @@ -0,0 +1,5 @@ +5 4 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p02329/output.0.txt b/codenet/public_test_cases/p02329/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02329/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02329/output.1.txt b/codenet/public_test_cases/p02329/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02329/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02329/output.2.txt b/codenet/public_test_cases/p02329/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..67ac2bbd74f2abf30ba6b4cb6e015e88d41e3d2d --- /dev/null +++ b/codenet/public_test_cases/p02329/output.2.txt @@ -0,0 +1 @@ +625 diff --git a/codenet/public_test_cases/p02330/input.0.txt b/codenet/public_test_cases/p02330/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f72b1551b4915804c344214464aeea0c45bf9527 --- /dev/null +++ b/codenet/public_test_cases/p02330/input.0.txt @@ -0,0 +1,2 @@ +2 2 1 9 +5 1 diff --git a/codenet/public_test_cases/p02330/input.1.txt b/codenet/public_test_cases/p02330/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b30b28c330ea0ab3e826cef8e1a938e21b1960f5 --- /dev/null +++ b/codenet/public_test_cases/p02330/input.1.txt @@ -0,0 +1,2 @@ +5 2 7 19 +3 5 4 2 2 diff --git a/codenet/public_test_cases/p02330/input.2.txt b/codenet/public_test_cases/p02330/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f72b1551b4915804c344214464aeea0c45bf9527 --- /dev/null +++ b/codenet/public_test_cases/p02330/input.2.txt @@ -0,0 +1,2 @@ +2 2 1 9 +5 1 diff --git a/codenet/public_test_cases/p02330/output.0.txt b/codenet/public_test_cases/p02330/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02330/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02330/output.1.txt b/codenet/public_test_cases/p02330/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02330/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02330/output.2.txt b/codenet/public_test_cases/p02330/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02330/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02331/input.0.txt b/codenet/public_test_cases/p02331/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02331/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02331/output.0.txt b/codenet/public_test_cases/p02331/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02331/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02332/input.0.txt b/codenet/public_test_cases/p02332/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02332/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02332/output.0.txt b/codenet/public_test_cases/p02332/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02332/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02333/input.0.txt b/codenet/public_test_cases/p02333/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p02333/input.0.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p02333/output.0.txt b/codenet/public_test_cases/p02333/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p02333/output.0.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p02334/input.0.txt b/codenet/public_test_cases/p02334/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p02334/input.0.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p02334/output.0.txt b/codenet/public_test_cases/p02334/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p02334/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p02335/input.0.txt b/codenet/public_test_cases/p02335/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p02335/input.0.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p02335/output.0.txt b/codenet/public_test_cases/p02335/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02335/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02336/input.0.txt b/codenet/public_test_cases/p02336/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p02336/input.0.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p02336/output.0.txt b/codenet/public_test_cases/p02336/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02336/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02337/input.0.txt b/codenet/public_test_cases/p02337/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p02337/input.0.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p02337/output.0.txt b/codenet/public_test_cases/p02337/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02337/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02338/input.0.txt b/codenet/public_test_cases/p02338/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..795ed346d0db02e9292e1c9c4e690016ce174cda --- /dev/null +++ b/codenet/public_test_cases/p02338/input.0.txt @@ -0,0 +1 @@ +5 10 diff --git a/codenet/public_test_cases/p02338/output.0.txt b/codenet/public_test_cases/p02338/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02338/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02339/input.0.txt b/codenet/public_test_cases/p02339/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p02339/input.0.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p02339/output.0.txt b/codenet/public_test_cases/p02339/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02339/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02340/input.0.txt b/codenet/public_test_cases/p02340/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p02340/input.0.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p02340/output.0.txt b/codenet/public_test_cases/p02340/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02340/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02341/input.0.txt b/codenet/public_test_cases/p02341/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..795ed346d0db02e9292e1c9c4e690016ce174cda --- /dev/null +++ b/codenet/public_test_cases/p02341/input.0.txt @@ -0,0 +1 @@ +5 10 diff --git a/codenet/public_test_cases/p02341/output.0.txt b/codenet/public_test_cases/p02341/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02341/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02342/input.0.txt b/codenet/public_test_cases/p02342/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2deca7fbadd84a9ab0a54387a6aef25603311e73 --- /dev/null +++ b/codenet/public_test_cases/p02342/input.0.txt @@ -0,0 +1 @@ +10 5 diff --git a/codenet/public_test_cases/p02342/output.0.txt b/codenet/public_test_cases/p02342/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02342/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02343/input.0.txt b/codenet/public_test_cases/p02343/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..731c0d4c58ff711ec256f710c508ff2a2f6bd6b5 --- /dev/null +++ b/codenet/public_test_cases/p02343/input.0.txt @@ -0,0 +1,13 @@ +5 12 +0 1 4 +0 2 3 +1 1 2 +1 3 4 +1 1 4 +1 3 2 +0 1 3 +1 2 4 +1 3 0 +0 0 4 +1 0 2 +1 3 0 diff --git a/codenet/public_test_cases/p02343/input.1.txt b/codenet/public_test_cases/p02343/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..731c0d4c58ff711ec256f710c508ff2a2f6bd6b5 --- /dev/null +++ b/codenet/public_test_cases/p02343/input.1.txt @@ -0,0 +1,13 @@ +5 12 +0 1 4 +0 2 3 +1 1 2 +1 3 4 +1 1 4 +1 3 2 +0 1 3 +1 2 4 +1 3 0 +0 0 4 +1 0 2 +1 3 0 diff --git a/codenet/public_test_cases/p02343/output.0.txt b/codenet/public_test_cases/p02343/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..debc7215661334a428d145eaa4aadf436359f6b3 --- /dev/null +++ b/codenet/public_test_cases/p02343/output.0.txt @@ -0,0 +1,8 @@ +0 +0 +1 +1 +1 +0 +1 +1 diff --git a/codenet/public_test_cases/p02343/output.1.txt b/codenet/public_test_cases/p02343/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..debc7215661334a428d145eaa4aadf436359f6b3 --- /dev/null +++ b/codenet/public_test_cases/p02343/output.1.txt @@ -0,0 +1,8 @@ +0 +0 +1 +1 +1 +0 +1 +1 diff --git a/codenet/public_test_cases/p02344/input.0.txt b/codenet/public_test_cases/p02344/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dba687d0d81ff2e95c34b124766327390d52b549 --- /dev/null +++ b/codenet/public_test_cases/p02344/input.0.txt @@ -0,0 +1,7 @@ +5 6 +0 0 2 5 +0 1 2 3 +1 0 1 +1 1 3 +0 1 4 8 +1 0 4 diff --git a/codenet/public_test_cases/p02344/input.1.txt b/codenet/public_test_cases/p02344/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dba687d0d81ff2e95c34b124766327390d52b549 --- /dev/null +++ b/codenet/public_test_cases/p02344/input.1.txt @@ -0,0 +1,7 @@ +5 6 +0 0 2 5 +0 1 2 3 +1 0 1 +1 1 3 +0 1 4 8 +1 0 4 diff --git a/codenet/public_test_cases/p02344/output.0.txt b/codenet/public_test_cases/p02344/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..647938606f5ef576d8e4d1417cffc3a9526e048e --- /dev/null +++ b/codenet/public_test_cases/p02344/output.0.txt @@ -0,0 +1,3 @@ +2 +? +10 diff --git a/codenet/public_test_cases/p02344/output.1.txt b/codenet/public_test_cases/p02344/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..647938606f5ef576d8e4d1417cffc3a9526e048e --- /dev/null +++ b/codenet/public_test_cases/p02344/output.1.txt @@ -0,0 +1,3 @@ +2 +? +10 diff --git a/codenet/public_test_cases/p02345/input.0.txt b/codenet/public_test_cases/p02345/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fb618c632b6eceae9b1d57bd45769a139c801ac --- /dev/null +++ b/codenet/public_test_cases/p02345/input.0.txt @@ -0,0 +1,6 @@ +3 5 +0 0 1 +0 1 2 +0 2 3 +1 0 2 +1 1 2 diff --git a/codenet/public_test_cases/p02345/input.1.txt b/codenet/public_test_cases/p02345/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fb618c632b6eceae9b1d57bd45769a139c801ac --- /dev/null +++ b/codenet/public_test_cases/p02345/input.1.txt @@ -0,0 +1,6 @@ +3 5 +0 0 1 +0 1 2 +0 2 3 +1 0 2 +1 1 2 diff --git a/codenet/public_test_cases/p02345/input.2.txt b/codenet/public_test_cases/p02345/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3acebcde613ec73838ee1143ebd58352e2324621 --- /dev/null +++ b/codenet/public_test_cases/p02345/input.2.txt @@ -0,0 +1,4 @@ +1 3 +1 0 0 +0 0 5 +1 0 0 diff --git a/codenet/public_test_cases/p02345/output.0.txt b/codenet/public_test_cases/p02345/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p02345/output.0.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p02345/output.1.txt b/codenet/public_test_cases/p02345/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p02345/output.1.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p02345/output.2.txt b/codenet/public_test_cases/p02345/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78670f2d468a1cbee5f1c5fc97ea07f93969f923 --- /dev/null +++ b/codenet/public_test_cases/p02345/output.2.txt @@ -0,0 +1,2 @@ +2147483647 +5 diff --git a/codenet/public_test_cases/p02346/input.0.txt b/codenet/public_test_cases/p02346/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14c2b271adf36267ff233993450a047260b938bc --- /dev/null +++ b/codenet/public_test_cases/p02346/input.0.txt @@ -0,0 +1,6 @@ +3 5 +0 1 1 +0 2 2 +0 3 3 +1 1 2 +1 2 2 diff --git a/codenet/public_test_cases/p02346/input.1.txt b/codenet/public_test_cases/p02346/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14c2b271adf36267ff233993450a047260b938bc --- /dev/null +++ b/codenet/public_test_cases/p02346/input.1.txt @@ -0,0 +1,6 @@ +3 5 +0 1 1 +0 2 2 +0 3 3 +1 1 2 +1 2 2 diff --git a/codenet/public_test_cases/p02346/output.0.txt b/codenet/public_test_cases/p02346/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e5eeed2d935fb330d6755eeb3e46d18fa7aac1 --- /dev/null +++ b/codenet/public_test_cases/p02346/output.0.txt @@ -0,0 +1,2 @@ +3 +2 diff --git a/codenet/public_test_cases/p02346/output.1.txt b/codenet/public_test_cases/p02346/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e5eeed2d935fb330d6755eeb3e46d18fa7aac1 --- /dev/null +++ b/codenet/public_test_cases/p02346/output.1.txt @@ -0,0 +1,2 @@ +3 +2 diff --git a/codenet/public_test_cases/p02347/input.0.txt b/codenet/public_test_cases/p02347/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d2679b0249c7265d66e123b3b839e81f538fb13 --- /dev/null +++ b/codenet/public_test_cases/p02347/input.0.txt @@ -0,0 +1,10 @@ +6 +2 1 +2 2 +4 2 +6 2 +3 3 +5 4 +2 +2 4 0 4 +4 10 2 5 diff --git a/codenet/public_test_cases/p02347/input.1.txt b/codenet/public_test_cases/p02347/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d2679b0249c7265d66e123b3b839e81f538fb13 --- /dev/null +++ b/codenet/public_test_cases/p02347/input.1.txt @@ -0,0 +1,10 @@ +6 +2 1 +2 2 +4 2 +6 2 +3 3 +5 4 +2 +2 4 0 4 +4 10 2 5 diff --git a/codenet/public_test_cases/p02347/output.0.txt b/codenet/public_test_cases/p02347/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dedf0a4823927d629e7531bf86652600426af7a6 --- /dev/null +++ b/codenet/public_test_cases/p02347/output.0.txt @@ -0,0 +1,8 @@ +0 +1 +2 +4 + +2 +3 +5 diff --git a/codenet/public_test_cases/p02347/output.1.txt b/codenet/public_test_cases/p02347/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dedf0a4823927d629e7531bf86652600426af7a6 --- /dev/null +++ b/codenet/public_test_cases/p02347/output.1.txt @@ -0,0 +1,8 @@ +0 +1 +2 +4 + +2 +3 +5 diff --git a/codenet/public_test_cases/p02348/input.0.txt b/codenet/public_test_cases/p02348/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87718aee5a96494675c17185d3510096375ddf89 --- /dev/null +++ b/codenet/public_test_cases/p02348/input.0.txt @@ -0,0 +1,6 @@ +3 5 +0 0 1 1 +0 1 2 3 +0 2 2 2 +1 0 +1 1 diff --git a/codenet/public_test_cases/p02348/input.1.txt b/codenet/public_test_cases/p02348/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87718aee5a96494675c17185d3510096375ddf89 --- /dev/null +++ b/codenet/public_test_cases/p02348/input.1.txt @@ -0,0 +1,6 @@ +3 5 +0 0 1 1 +0 1 2 3 +0 2 2 2 +1 0 +1 1 diff --git a/codenet/public_test_cases/p02348/input.2.txt b/codenet/public_test_cases/p02348/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b425a9b65949f8e3326babb25848a1db964b1c55 --- /dev/null +++ b/codenet/public_test_cases/p02348/input.2.txt @@ -0,0 +1,4 @@ +1 3 +1 0 +0 0 0 5 +1 0 diff --git a/codenet/public_test_cases/p02348/output.0.txt b/codenet/public_test_cases/p02348/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p02348/output.0.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p02348/output.1.txt b/codenet/public_test_cases/p02348/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p02348/output.1.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p02348/output.2.txt b/codenet/public_test_cases/p02348/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78670f2d468a1cbee5f1c5fc97ea07f93969f923 --- /dev/null +++ b/codenet/public_test_cases/p02348/output.2.txt @@ -0,0 +1,2 @@ +2147483647 +5 diff --git a/codenet/public_test_cases/p02349/input.0.txt b/codenet/public_test_cases/p02349/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a58c7a1073520d39bbbeda2bf8c66ab890ffa71 --- /dev/null +++ b/codenet/public_test_cases/p02349/input.0.txt @@ -0,0 +1,6 @@ +3 5 +0 1 2 1 +0 2 3 2 +0 3 3 3 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02349/input.1.txt b/codenet/public_test_cases/p02349/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a58c7a1073520d39bbbeda2bf8c66ab890ffa71 --- /dev/null +++ b/codenet/public_test_cases/p02349/input.1.txt @@ -0,0 +1,6 @@ +3 5 +0 1 2 1 +0 2 3 2 +0 3 3 3 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02349/input.2.txt b/codenet/public_test_cases/p02349/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6aaad615a0d7b29c0a69322bd0864dfb33e6c8e5 --- /dev/null +++ b/codenet/public_test_cases/p02349/input.2.txt @@ -0,0 +1,4 @@ +4 3 +1 2 +0 1 4 1 +1 2 diff --git a/codenet/public_test_cases/p02349/output.0.txt b/codenet/public_test_cases/p02349/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ee0007bf1f1aaeab67e3ea1c9ae21003171a460 --- /dev/null +++ b/codenet/public_test_cases/p02349/output.0.txt @@ -0,0 +1,2 @@ +3 +5 diff --git a/codenet/public_test_cases/p02349/output.1.txt b/codenet/public_test_cases/p02349/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ee0007bf1f1aaeab67e3ea1c9ae21003171a460 --- /dev/null +++ b/codenet/public_test_cases/p02349/output.1.txt @@ -0,0 +1,2 @@ +3 +5 diff --git a/codenet/public_test_cases/p02349/output.2.txt b/codenet/public_test_cases/p02349/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d66ea1aee9527bfa39185ead1f9cdbd96bba88c --- /dev/null +++ b/codenet/public_test_cases/p02349/output.2.txt @@ -0,0 +1,2 @@ +0 +1 diff --git a/codenet/public_test_cases/p02350/input.0.txt b/codenet/public_test_cases/p02350/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..289e5083602c97d68c41b43051dcdcb092aebda6 --- /dev/null +++ b/codenet/public_test_cases/p02350/input.0.txt @@ -0,0 +1,6 @@ +3 5 +0 0 1 1 +0 1 2 3 +0 2 2 2 +1 0 2 +1 1 2 diff --git a/codenet/public_test_cases/p02350/input.1.txt b/codenet/public_test_cases/p02350/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9201f8227dd1f077b02814eb27c1a6aa4f5a6d6b --- /dev/null +++ b/codenet/public_test_cases/p02350/input.1.txt @@ -0,0 +1,4 @@ +1 3 +1 0 0 +0 0 0 5 +1 0 0 diff --git a/codenet/public_test_cases/p02350/input.2.txt b/codenet/public_test_cases/p02350/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..289e5083602c97d68c41b43051dcdcb092aebda6 --- /dev/null +++ b/codenet/public_test_cases/p02350/input.2.txt @@ -0,0 +1,6 @@ +3 5 +0 0 1 1 +0 1 2 3 +0 2 2 2 +1 0 2 +1 1 2 diff --git a/codenet/public_test_cases/p02350/output.0.txt b/codenet/public_test_cases/p02350/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p02350/output.0.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p02350/output.1.txt b/codenet/public_test_cases/p02350/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78670f2d468a1cbee5f1c5fc97ea07f93969f923 --- /dev/null +++ b/codenet/public_test_cases/p02350/output.1.txt @@ -0,0 +1,2 @@ +2147483647 +5 diff --git a/codenet/public_test_cases/p02350/output.2.txt b/codenet/public_test_cases/p02350/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p02350/output.2.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p02351/input.0.txt b/codenet/public_test_cases/p02351/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cb0b1793176156f37a8900b0685bb84e03c4d8d --- /dev/null +++ b/codenet/public_test_cases/p02351/input.0.txt @@ -0,0 +1,6 @@ +3 5 +0 1 2 1 +0 2 3 2 +0 3 3 3 +1 1 2 +1 2 3 diff --git a/codenet/public_test_cases/p02351/input.1.txt b/codenet/public_test_cases/p02351/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c8811299dab991ea5e55a57a9c1df37cbbab7d7 --- /dev/null +++ b/codenet/public_test_cases/p02351/input.1.txt @@ -0,0 +1,4 @@ +4 3 +1 1 4 +0 1 4 1 +1 1 4 diff --git a/codenet/public_test_cases/p02351/input.2.txt b/codenet/public_test_cases/p02351/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cb0b1793176156f37a8900b0685bb84e03c4d8d --- /dev/null +++ b/codenet/public_test_cases/p02351/input.2.txt @@ -0,0 +1,6 @@ +3 5 +0 1 2 1 +0 2 3 2 +0 3 3 3 +1 1 2 +1 2 3 diff --git a/codenet/public_test_cases/p02351/output.0.txt b/codenet/public_test_cases/p02351/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de78180725a82141b5064f9715b66b2956856254 --- /dev/null +++ b/codenet/public_test_cases/p02351/output.0.txt @@ -0,0 +1,2 @@ +4 +8 diff --git a/codenet/public_test_cases/p02351/output.1.txt b/codenet/public_test_cases/p02351/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f1d7cd301262e994b4343b2d4b3494063c05642 --- /dev/null +++ b/codenet/public_test_cases/p02351/output.1.txt @@ -0,0 +1,2 @@ +0 +4 diff --git a/codenet/public_test_cases/p02351/output.2.txt b/codenet/public_test_cases/p02351/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..de78180725a82141b5064f9715b66b2956856254 --- /dev/null +++ b/codenet/public_test_cases/p02351/output.2.txt @@ -0,0 +1,2 @@ +4 +8 diff --git a/codenet/public_test_cases/p02352/input.0.txt b/codenet/public_test_cases/p02352/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b6a616876177289c09e03ecf160aba16877ac4b --- /dev/null +++ b/codenet/public_test_cases/p02352/input.0.txt @@ -0,0 +1,8 @@ +6 7 +0 1 3 1 +0 2 4 -2 +1 0 5 +1 0 1 +0 3 5 3 +1 3 4 +1 0 5 diff --git a/codenet/public_test_cases/p02352/input.1.txt b/codenet/public_test_cases/p02352/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b6a616876177289c09e03ecf160aba16877ac4b --- /dev/null +++ b/codenet/public_test_cases/p02352/input.1.txt @@ -0,0 +1,8 @@ +6 7 +0 1 3 1 +0 2 4 -2 +1 0 5 +1 0 1 +0 3 5 3 +1 3 4 +1 0 5 diff --git a/codenet/public_test_cases/p02352/output.0.txt b/codenet/public_test_cases/p02352/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb490be68886cbb9e76f9a43476f4a93a2598610 --- /dev/null +++ b/codenet/public_test_cases/p02352/output.0.txt @@ -0,0 +1,4 @@ +-2 +0 +1 +-1 diff --git a/codenet/public_test_cases/p02352/output.1.txt b/codenet/public_test_cases/p02352/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb490be68886cbb9e76f9a43476f4a93a2598610 --- /dev/null +++ b/codenet/public_test_cases/p02352/output.1.txt @@ -0,0 +1,4 @@ +-2 +0 +1 +-1 diff --git a/codenet/public_test_cases/p02353/input.0.txt b/codenet/public_test_cases/p02353/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b6a616876177289c09e03ecf160aba16877ac4b --- /dev/null +++ b/codenet/public_test_cases/p02353/input.0.txt @@ -0,0 +1,8 @@ +6 7 +0 1 3 1 +0 2 4 -2 +1 0 5 +1 0 1 +0 3 5 3 +1 3 4 +1 0 5 diff --git a/codenet/public_test_cases/p02353/input.1.txt b/codenet/public_test_cases/p02353/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b6a616876177289c09e03ecf160aba16877ac4b --- /dev/null +++ b/codenet/public_test_cases/p02353/input.1.txt @@ -0,0 +1,8 @@ +6 7 +0 1 3 1 +0 2 4 -2 +1 0 5 +1 0 1 +0 3 5 3 +1 3 4 +1 0 5 diff --git a/codenet/public_test_cases/p02353/output.0.txt b/codenet/public_test_cases/p02353/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85f701962a4c9f041f1083680db370d981c7b162 --- /dev/null +++ b/codenet/public_test_cases/p02353/output.0.txt @@ -0,0 +1,4 @@ +-5 +1 +6 +8 diff --git a/codenet/public_test_cases/p02353/output.1.txt b/codenet/public_test_cases/p02353/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85f701962a4c9f041f1083680db370d981c7b162 --- /dev/null +++ b/codenet/public_test_cases/p02353/output.1.txt @@ -0,0 +1,4 @@ +-5 +1 +6 +8 diff --git a/codenet/public_test_cases/p02354/input.0.txt b/codenet/public_test_cases/p02354/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e97204f395b9e2d4949bd4eb8e156eb292fe374 --- /dev/null +++ b/codenet/public_test_cases/p02354/input.0.txt @@ -0,0 +1,2 @@ +6 4 +1 2 1 2 3 2 diff --git a/codenet/public_test_cases/p02354/input.1.txt b/codenet/public_test_cases/p02354/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e97204f395b9e2d4949bd4eb8e156eb292fe374 --- /dev/null +++ b/codenet/public_test_cases/p02354/input.1.txt @@ -0,0 +1,2 @@ +6 4 +1 2 1 2 3 2 diff --git a/codenet/public_test_cases/p02354/input.2.txt b/codenet/public_test_cases/p02354/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce76351838068d6dea9ec28e633a2a010ade90f9 --- /dev/null +++ b/codenet/public_test_cases/p02354/input.2.txt @@ -0,0 +1,2 @@ +6 6 +1 2 1 2 3 2 diff --git a/codenet/public_test_cases/p02354/input.3.txt b/codenet/public_test_cases/p02354/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..42c2f875150642c9da668609b3682a3ede8af304 --- /dev/null +++ b/codenet/public_test_cases/p02354/input.3.txt @@ -0,0 +1,2 @@ +3 7 +1 2 3 diff --git a/codenet/public_test_cases/p02354/output.0.txt b/codenet/public_test_cases/p02354/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02354/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02354/output.1.txt b/codenet/public_test_cases/p02354/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02354/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02354/output.2.txt b/codenet/public_test_cases/p02354/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02354/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02354/output.3.txt b/codenet/public_test_cases/p02354/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02354/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02355/input.0.txt b/codenet/public_test_cases/p02355/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..907f4152587fae9c00d7a24f6df3714f81e4cf90 --- /dev/null +++ b/codenet/public_test_cases/p02355/input.0.txt @@ -0,0 +1,2 @@ +6 2 +4 1 2 1 3 5 diff --git a/codenet/public_test_cases/p02355/input.1.txt b/codenet/public_test_cases/p02355/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c2bdbca01eb168789afdc8a94a4c680a7d48e28 --- /dev/null +++ b/codenet/public_test_cases/p02355/input.1.txt @@ -0,0 +1,2 @@ +3 4 +1 2 3 diff --git a/codenet/public_test_cases/p02355/input.2.txt b/codenet/public_test_cases/p02355/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0e02c5b82320b3a7e8910dae6a98b54391c3a8a --- /dev/null +++ b/codenet/public_test_cases/p02355/input.2.txt @@ -0,0 +1,2 @@ +6 3 +4 1 2 1 3 5 diff --git a/codenet/public_test_cases/p02355/input.3.txt b/codenet/public_test_cases/p02355/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..907f4152587fae9c00d7a24f6df3714f81e4cf90 --- /dev/null +++ b/codenet/public_test_cases/p02355/input.3.txt @@ -0,0 +1,2 @@ +6 2 +4 1 2 1 3 5 diff --git a/codenet/public_test_cases/p02355/output.0.txt b/codenet/public_test_cases/p02355/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02355/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02355/output.1.txt b/codenet/public_test_cases/p02355/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02355/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02355/output.2.txt b/codenet/public_test_cases/p02355/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02355/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02355/output.3.txt b/codenet/public_test_cases/p02355/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02355/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02356/input.0.txt b/codenet/public_test_cases/p02356/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae83d6139bd8531a34fb9a6e9be881e9c6a67061 --- /dev/null +++ b/codenet/public_test_cases/p02356/input.0.txt @@ -0,0 +1,3 @@ +6 5 +1 2 3 4 5 6 +6 9 12 21 15 diff --git a/codenet/public_test_cases/p02356/input.1.txt b/codenet/public_test_cases/p02356/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae83d6139bd8531a34fb9a6e9be881e9c6a67061 --- /dev/null +++ b/codenet/public_test_cases/p02356/input.1.txt @@ -0,0 +1,3 @@ +6 5 +1 2 3 4 5 6 +6 9 12 21 15 diff --git a/codenet/public_test_cases/p02356/output.0.txt b/codenet/public_test_cases/p02356/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..70feb2cf311c2e98936ce8a4785145b41624caa6 --- /dev/null +++ b/codenet/public_test_cases/p02356/output.0.txt @@ -0,0 +1,5 @@ +9 +12 +15 +21 +18 diff --git a/codenet/public_test_cases/p02356/output.1.txt b/codenet/public_test_cases/p02356/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..70feb2cf311c2e98936ce8a4785145b41624caa6 --- /dev/null +++ b/codenet/public_test_cases/p02356/output.1.txt @@ -0,0 +1,5 @@ +9 +12 +15 +21 +18 diff --git a/codenet/public_test_cases/p02357/input.0.txt b/codenet/public_test_cases/p02357/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b3cd95bd801459fdf4edad7605fd9ccd79e4eb2 --- /dev/null +++ b/codenet/public_test_cases/p02357/input.0.txt @@ -0,0 +1,2 @@ +7 3 +1 7 7 4 8 1 6 diff --git a/codenet/public_test_cases/p02357/input.1.txt b/codenet/public_test_cases/p02357/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b3cd95bd801459fdf4edad7605fd9ccd79e4eb2 --- /dev/null +++ b/codenet/public_test_cases/p02357/input.1.txt @@ -0,0 +1,2 @@ +7 3 +1 7 7 4 8 1 6 diff --git a/codenet/public_test_cases/p02357/output.0.txt b/codenet/public_test_cases/p02357/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..72a4db1a66086b1a09adf97211968d7a08039125 --- /dev/null +++ b/codenet/public_test_cases/p02357/output.0.txt @@ -0,0 +1 @@ +1 4 4 1 1 diff --git a/codenet/public_test_cases/p02357/output.1.txt b/codenet/public_test_cases/p02357/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..72a4db1a66086b1a09adf97211968d7a08039125 --- /dev/null +++ b/codenet/public_test_cases/p02357/output.1.txt @@ -0,0 +1 @@ +1 4 4 1 1 diff --git a/codenet/public_test_cases/p02358/input.0.txt b/codenet/public_test_cases/p02358/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4706a0f4d2240b2af804d8e572b73c26fce34362 --- /dev/null +++ b/codenet/public_test_cases/p02358/input.0.txt @@ -0,0 +1,3 @@ +2 +0 0 3 4 +1 2 4 3 diff --git a/codenet/public_test_cases/p02358/input.1.txt b/codenet/public_test_cases/p02358/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9214fc12ad6a9bdd461fae8eab9f1da7ee8740c --- /dev/null +++ b/codenet/public_test_cases/p02358/input.1.txt @@ -0,0 +1,5 @@ +4 +0 0 3 1 +0 0 1 3 +0 2 3 3 +2 0 3 3 diff --git a/codenet/public_test_cases/p02358/input.2.txt b/codenet/public_test_cases/p02358/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..424a5152acb052dd93134e18c550e5a16743714b --- /dev/null +++ b/codenet/public_test_cases/p02358/input.2.txt @@ -0,0 +1,4 @@ +3 +1 1 2 5 +2 1 5 2 +1 2 2 5 diff --git a/codenet/public_test_cases/p02358/input.3.txt b/codenet/public_test_cases/p02358/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4706a0f4d2240b2af804d8e572b73c26fce34362 --- /dev/null +++ b/codenet/public_test_cases/p02358/input.3.txt @@ -0,0 +1,3 @@ +2 +0 0 3 4 +1 2 4 3 diff --git a/codenet/public_test_cases/p02358/output.0.txt b/codenet/public_test_cases/p02358/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02358/output.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02358/output.1.txt b/codenet/public_test_cases/p02358/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02358/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02358/output.2.txt b/codenet/public_test_cases/p02358/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02358/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02358/output.3.txt b/codenet/public_test_cases/p02358/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02358/output.3.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02359/input.0.txt b/codenet/public_test_cases/p02359/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d338e9b146206622e443d1d80c5b434a302ff60 --- /dev/null +++ b/codenet/public_test_cases/p02359/input.0.txt @@ -0,0 +1,7 @@ +6 10 +0 2 +1 3 +2 6 +3 8 +4 10 +5 10 diff --git a/codenet/public_test_cases/p02359/input.1.txt b/codenet/public_test_cases/p02359/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86a3e455afd683e56060d976a9527f505e9fbcf7 --- /dev/null +++ b/codenet/public_test_cases/p02359/input.1.txt @@ -0,0 +1,3 @@ +2 2 +0 1 +1 2 diff --git a/codenet/public_test_cases/p02359/input.2.txt b/codenet/public_test_cases/p02359/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d338e9b146206622e443d1d80c5b434a302ff60 --- /dev/null +++ b/codenet/public_test_cases/p02359/input.2.txt @@ -0,0 +1,7 @@ +6 10 +0 2 +1 3 +2 6 +3 8 +4 10 +5 10 diff --git a/codenet/public_test_cases/p02359/output.0.txt b/codenet/public_test_cases/p02359/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02359/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02359/output.1.txt b/codenet/public_test_cases/p02359/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02359/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02359/output.2.txt b/codenet/public_test_cases/p02359/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02359/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02360/input.0.txt b/codenet/public_test_cases/p02360/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ae636826d317f0593fd2f0359e6bd1e5fa944a2 --- /dev/null +++ b/codenet/public_test_cases/p02360/input.0.txt @@ -0,0 +1,3 @@ +2 +0 0 3 2 +2 1 4 3 diff --git a/codenet/public_test_cases/p02360/input.1.txt b/codenet/public_test_cases/p02360/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f416fdbc4ae2558d28a90d96ee520ad52095a720 --- /dev/null +++ b/codenet/public_test_cases/p02360/input.1.txt @@ -0,0 +1,3 @@ +2 +0 0 2 2 +2 0 4 2 diff --git a/codenet/public_test_cases/p02360/input.2.txt b/codenet/public_test_cases/p02360/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b45406cd8c61cf11061dfcda6bb25583cf36f30a --- /dev/null +++ b/codenet/public_test_cases/p02360/input.2.txt @@ -0,0 +1,4 @@ +3 +0 0 2 2 +0 0 2 2 +0 0 2 2 diff --git a/codenet/public_test_cases/p02360/input.3.txt b/codenet/public_test_cases/p02360/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ae636826d317f0593fd2f0359e6bd1e5fa944a2 --- /dev/null +++ b/codenet/public_test_cases/p02360/input.3.txt @@ -0,0 +1,3 @@ +2 +0 0 3 2 +2 1 4 3 diff --git a/codenet/public_test_cases/p02360/output.0.txt b/codenet/public_test_cases/p02360/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02360/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02360/output.1.txt b/codenet/public_test_cases/p02360/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02360/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02360/output.2.txt b/codenet/public_test_cases/p02360/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02360/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02360/output.3.txt b/codenet/public_test_cases/p02360/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02360/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02361/input.0.txt b/codenet/public_test_cases/p02361/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00a418a3ba125b55933ae1e320462c942b919c8b --- /dev/null +++ b/codenet/public_test_cases/p02361/input.0.txt @@ -0,0 +1,6 @@ +4 5 0 +0 1 1 +0 2 4 +1 2 2 +2 3 1 +1 3 5 diff --git a/codenet/public_test_cases/p02361/input.1.txt b/codenet/public_test_cases/p02361/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec2146490fa52aa153caf53bdf05a79d4752bd67 --- /dev/null +++ b/codenet/public_test_cases/p02361/input.1.txt @@ -0,0 +1,7 @@ +4 6 1 +0 1 1 +0 2 4 +2 0 1 +1 2 2 +3 1 1 +3 2 5 diff --git a/codenet/public_test_cases/p02361/input.2.txt b/codenet/public_test_cases/p02361/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00a418a3ba125b55933ae1e320462c942b919c8b --- /dev/null +++ b/codenet/public_test_cases/p02361/input.2.txt @@ -0,0 +1,6 @@ +4 5 0 +0 1 1 +0 2 4 +1 2 2 +2 3 1 +1 3 5 diff --git a/codenet/public_test_cases/p02361/output.0.txt b/codenet/public_test_cases/p02361/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dded5207a179057d57642898d4cba08c476437b5 --- /dev/null +++ b/codenet/public_test_cases/p02361/output.0.txt @@ -0,0 +1,4 @@ +0 +1 +3 +4 diff --git a/codenet/public_test_cases/p02361/output.1.txt b/codenet/public_test_cases/p02361/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d90de2da25627b98f714fd032665b94ceae40b8 --- /dev/null +++ b/codenet/public_test_cases/p02361/output.1.txt @@ -0,0 +1,4 @@ +3 +0 +2 +INF diff --git a/codenet/public_test_cases/p02361/output.2.txt b/codenet/public_test_cases/p02361/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dded5207a179057d57642898d4cba08c476437b5 --- /dev/null +++ b/codenet/public_test_cases/p02361/output.2.txt @@ -0,0 +1,4 @@ +0 +1 +3 +4 diff --git a/codenet/public_test_cases/p02362/input.0.txt b/codenet/public_test_cases/p02362/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..53c915194113074bb06ff3e91789e7cd91d5677f --- /dev/null +++ b/codenet/public_test_cases/p02362/input.0.txt @@ -0,0 +1,6 @@ +4 5 0 +0 1 2 +0 2 3 +1 2 -5 +1 3 1 +2 3 2 diff --git a/codenet/public_test_cases/p02362/input.1.txt b/codenet/public_test_cases/p02362/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..312b839cca42825da33016624574f2b4101078fa --- /dev/null +++ b/codenet/public_test_cases/p02362/input.1.txt @@ -0,0 +1,6 @@ +4 5 1 +0 1 2 +0 2 3 +1 2 -5 +1 3 1 +2 3 2 diff --git a/codenet/public_test_cases/p02362/input.2.txt b/codenet/public_test_cases/p02362/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..53c915194113074bb06ff3e91789e7cd91d5677f --- /dev/null +++ b/codenet/public_test_cases/p02362/input.2.txt @@ -0,0 +1,6 @@ +4 5 0 +0 1 2 +0 2 3 +1 2 -5 +1 3 1 +2 3 2 diff --git a/codenet/public_test_cases/p02362/input.3.txt b/codenet/public_test_cases/p02362/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c10688078273f3ada685cdf38625e98aba6f6802 --- /dev/null +++ b/codenet/public_test_cases/p02362/input.3.txt @@ -0,0 +1,7 @@ +4 6 0 +0 1 2 +0 2 3 +1 2 -5 +1 3 1 +2 3 2 +3 1 0 diff --git a/codenet/public_test_cases/p02362/output.0.txt b/codenet/public_test_cases/p02362/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..06de90abf5503d38bb7ed9a313778a05cf6f2f14 --- /dev/null +++ b/codenet/public_test_cases/p02362/output.0.txt @@ -0,0 +1,4 @@ +0 +2 +-3 +-1 diff --git a/codenet/public_test_cases/p02362/output.1.txt b/codenet/public_test_cases/p02362/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6f8a8a263f6df8706cfad88cbac0824b6a5d080 --- /dev/null +++ b/codenet/public_test_cases/p02362/output.1.txt @@ -0,0 +1,4 @@ +INF +0 +-5 +-3 diff --git a/codenet/public_test_cases/p02362/output.2.txt b/codenet/public_test_cases/p02362/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..06de90abf5503d38bb7ed9a313778a05cf6f2f14 --- /dev/null +++ b/codenet/public_test_cases/p02362/output.2.txt @@ -0,0 +1,4 @@ +0 +2 +-3 +-1 diff --git a/codenet/public_test_cases/p02362/output.3.txt b/codenet/public_test_cases/p02362/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0079c26dcf9fa6ac1828e5b771e9c805bbe28297 --- /dev/null +++ b/codenet/public_test_cases/p02362/output.3.txt @@ -0,0 +1 @@ +NEGATIVE CYCLE diff --git a/codenet/public_test_cases/p02363/input.0.txt b/codenet/public_test_cases/p02363/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7011823d1a8675d97a405f17dec07bb4786a3b10 --- /dev/null +++ b/codenet/public_test_cases/p02363/input.0.txt @@ -0,0 +1,7 @@ +4 6 +0 1 1 +0 2 5 +1 2 2 +1 3 4 +2 3 1 +3 2 7 diff --git a/codenet/public_test_cases/p02363/input.1.txt b/codenet/public_test_cases/p02363/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c341e5ca3b427b678d538a54b5cc05384cff18b --- /dev/null +++ b/codenet/public_test_cases/p02363/input.1.txt @@ -0,0 +1,7 @@ +4 6 +0 1 1 +0 2 -5 +1 2 2 +1 3 4 +2 3 1 +3 2 7 diff --git a/codenet/public_test_cases/p02363/input.2.txt b/codenet/public_test_cases/p02363/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3cc51962f1efb36de25bd971d66d4a5f9520541 --- /dev/null +++ b/codenet/public_test_cases/p02363/input.2.txt @@ -0,0 +1,7 @@ +4 6 +0 1 1 +0 2 5 +1 2 2 +1 3 4 +2 3 1 +3 2 -7 diff --git a/codenet/public_test_cases/p02363/input.3.txt b/codenet/public_test_cases/p02363/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7011823d1a8675d97a405f17dec07bb4786a3b10 --- /dev/null +++ b/codenet/public_test_cases/p02363/input.3.txt @@ -0,0 +1,7 @@ +4 6 +0 1 1 +0 2 5 +1 2 2 +1 3 4 +2 3 1 +3 2 7 diff --git a/codenet/public_test_cases/p02363/output.0.txt b/codenet/public_test_cases/p02363/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c138ee166f1a216cdd796d3bb3b904b68c53288 --- /dev/null +++ b/codenet/public_test_cases/p02363/output.0.txt @@ -0,0 +1,4 @@ +0 1 3 4 +INF 0 2 3 +INF INF 0 1 +INF INF 7 0 diff --git a/codenet/public_test_cases/p02363/output.1.txt b/codenet/public_test_cases/p02363/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57ad76ca1a89e306346273fd420eba186bdd3e59 --- /dev/null +++ b/codenet/public_test_cases/p02363/output.1.txt @@ -0,0 +1,4 @@ +0 1 -5 -4 +INF 0 2 3 +INF INF 0 1 +INF INF 7 0 diff --git a/codenet/public_test_cases/p02363/output.2.txt b/codenet/public_test_cases/p02363/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0079c26dcf9fa6ac1828e5b771e9c805bbe28297 --- /dev/null +++ b/codenet/public_test_cases/p02363/output.2.txt @@ -0,0 +1 @@ +NEGATIVE CYCLE diff --git a/codenet/public_test_cases/p02363/output.3.txt b/codenet/public_test_cases/p02363/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c138ee166f1a216cdd796d3bb3b904b68c53288 --- /dev/null +++ b/codenet/public_test_cases/p02363/output.3.txt @@ -0,0 +1,4 @@ +0 1 3 4 +INF 0 2 3 +INF INF 0 1 +INF INF 7 0 diff --git a/codenet/public_test_cases/p02364/input.0.txt b/codenet/public_test_cases/p02364/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1fcedbc6df9d789d9c07317e7d7dd12e564e839 --- /dev/null +++ b/codenet/public_test_cases/p02364/input.0.txt @@ -0,0 +1,7 @@ +4 6 +0 1 2 +1 2 1 +2 3 1 +3 0 1 +0 2 3 +1 3 5 diff --git a/codenet/public_test_cases/p02364/input.1.txt b/codenet/public_test_cases/p02364/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51807fe1520d2c85389b6a3169abc16ab265967c --- /dev/null +++ b/codenet/public_test_cases/p02364/input.1.txt @@ -0,0 +1,10 @@ +6 9 +0 1 1 +0 2 3 +1 2 1 +1 3 7 +2 4 1 +1 4 3 +3 4 1 +3 5 1 +4 5 6 diff --git a/codenet/public_test_cases/p02364/input.2.txt b/codenet/public_test_cases/p02364/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1fcedbc6df9d789d9c07317e7d7dd12e564e839 --- /dev/null +++ b/codenet/public_test_cases/p02364/input.2.txt @@ -0,0 +1,7 @@ +4 6 +0 1 2 +1 2 1 +2 3 1 +3 0 1 +0 2 3 +1 3 5 diff --git a/codenet/public_test_cases/p02364/output.0.txt b/codenet/public_test_cases/p02364/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02364/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02364/output.1.txt b/codenet/public_test_cases/p02364/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02364/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02364/output.2.txt b/codenet/public_test_cases/p02364/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02364/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02365/input.0.txt b/codenet/public_test_cases/p02365/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b259a1419ec704925119b11c8723c77c916772d --- /dev/null +++ b/codenet/public_test_cases/p02365/input.0.txt @@ -0,0 +1,7 @@ +4 6 0 +0 1 3 +0 2 2 +2 0 1 +2 3 1 +3 0 1 +3 1 5 diff --git a/codenet/public_test_cases/p02365/input.1.txt b/codenet/public_test_cases/p02365/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b259a1419ec704925119b11c8723c77c916772d --- /dev/null +++ b/codenet/public_test_cases/p02365/input.1.txt @@ -0,0 +1,7 @@ +4 6 0 +0 1 3 +0 2 2 +2 0 1 +2 3 1 +3 0 1 +3 1 5 diff --git a/codenet/public_test_cases/p02365/input.2.txt b/codenet/public_test_cases/p02365/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8edbf66e054d404a9818d4411e4d029c552e770c --- /dev/null +++ b/codenet/public_test_cases/p02365/input.2.txt @@ -0,0 +1,11 @@ +6 10 0 +0 2 7 +0 1 1 +0 3 5 +1 4 9 +2 1 6 +1 3 2 +3 4 3 +4 2 2 +2 5 8 +3 5 3 diff --git a/codenet/public_test_cases/p02365/output.0.txt b/codenet/public_test_cases/p02365/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02365/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02365/output.1.txt b/codenet/public_test_cases/p02365/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02365/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02365/output.2.txt b/codenet/public_test_cases/p02365/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02365/output.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02366/input.0.txt b/codenet/public_test_cases/p02366/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b4c83e12d82b7ad497a23cbfa55580530cb793f --- /dev/null +++ b/codenet/public_test_cases/p02366/input.0.txt @@ -0,0 +1,5 @@ +4 4 +0 1 +0 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02366/input.1.txt b/codenet/public_test_cases/p02366/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c888fbd593a573a68eacab4d20803b73231f0fa --- /dev/null +++ b/codenet/public_test_cases/p02366/input.1.txt @@ -0,0 +1,5 @@ +5 4 +0 1 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p02366/input.2.txt b/codenet/public_test_cases/p02366/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b4c83e12d82b7ad497a23cbfa55580530cb793f --- /dev/null +++ b/codenet/public_test_cases/p02366/input.2.txt @@ -0,0 +1,5 @@ +4 4 +0 1 +0 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02366/output.0.txt b/codenet/public_test_cases/p02366/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02366/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02366/output.1.txt b/codenet/public_test_cases/p02366/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01e79c32a8c99c557f0757da7cb6d65b3414466d --- /dev/null +++ b/codenet/public_test_cases/p02366/output.1.txt @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/codenet/public_test_cases/p02366/output.2.txt b/codenet/public_test_cases/p02366/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02366/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02367/input.0.txt b/codenet/public_test_cases/p02367/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b4c83e12d82b7ad497a23cbfa55580530cb793f --- /dev/null +++ b/codenet/public_test_cases/p02367/input.0.txt @@ -0,0 +1,5 @@ +4 4 +0 1 +0 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02367/input.1.txt b/codenet/public_test_cases/p02367/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c888fbd593a573a68eacab4d20803b73231f0fa --- /dev/null +++ b/codenet/public_test_cases/p02367/input.1.txt @@ -0,0 +1,5 @@ +5 4 +0 1 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p02367/input.2.txt b/codenet/public_test_cases/p02367/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b4c83e12d82b7ad497a23cbfa55580530cb793f --- /dev/null +++ b/codenet/public_test_cases/p02367/input.2.txt @@ -0,0 +1,5 @@ +4 4 +0 1 +0 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02367/output.0.txt b/codenet/public_test_cases/p02367/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02367/output.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02367/output.1.txt b/codenet/public_test_cases/p02367/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ac2df7fdce5820e5530173ebc7a377d8224bf31 --- /dev/null +++ b/codenet/public_test_cases/p02367/output.1.txt @@ -0,0 +1,4 @@ +0 1 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p02367/output.2.txt b/codenet/public_test_cases/p02367/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02367/output.2.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02368/input.0.txt b/codenet/public_test_cases/p02368/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..24ea64d10663d2e07f3806d357c7b88ef9dcfaae --- /dev/null +++ b/codenet/public_test_cases/p02368/input.0.txt @@ -0,0 +1,12 @@ +5 6 +0 1 +1 0 +1 2 +2 4 +4 3 +3 2 +4 +0 1 +0 3 +2 3 +3 4 diff --git a/codenet/public_test_cases/p02368/input.1.txt b/codenet/public_test_cases/p02368/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..24ea64d10663d2e07f3806d357c7b88ef9dcfaae --- /dev/null +++ b/codenet/public_test_cases/p02368/input.1.txt @@ -0,0 +1,12 @@ +5 6 +0 1 +1 0 +1 2 +2 4 +4 3 +3 2 +4 +0 1 +0 3 +2 3 +3 4 diff --git a/codenet/public_test_cases/p02368/output.0.txt b/codenet/public_test_cases/p02368/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76c775cb28ef9faa336fcf0b7b2b086256de6baf --- /dev/null +++ b/codenet/public_test_cases/p02368/output.0.txt @@ -0,0 +1,4 @@ +1 +0 +1 +1 diff --git a/codenet/public_test_cases/p02368/output.1.txt b/codenet/public_test_cases/p02368/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76c775cb28ef9faa336fcf0b7b2b086256de6baf --- /dev/null +++ b/codenet/public_test_cases/p02368/output.1.txt @@ -0,0 +1,4 @@ +1 +0 +1 +1 diff --git a/codenet/public_test_cases/p02369/input.0.txt b/codenet/public_test_cases/p02369/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8ec25ced2cbdd356f416a92ddbadb36d8d68d23 --- /dev/null +++ b/codenet/public_test_cases/p02369/input.0.txt @@ -0,0 +1,4 @@ +3 3 +0 1 +0 2 +1 2 diff --git a/codenet/public_test_cases/p02369/input.1.txt b/codenet/public_test_cases/p02369/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8ec25ced2cbdd356f416a92ddbadb36d8d68d23 --- /dev/null +++ b/codenet/public_test_cases/p02369/input.1.txt @@ -0,0 +1,4 @@ +3 3 +0 1 +0 2 +1 2 diff --git a/codenet/public_test_cases/p02369/input.2.txt b/codenet/public_test_cases/p02369/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7895ea18034938460ac0c64f934889d2a22df03a --- /dev/null +++ b/codenet/public_test_cases/p02369/input.2.txt @@ -0,0 +1,4 @@ +3 3 +0 1 +1 2 +2 0 diff --git a/codenet/public_test_cases/p02369/output.0.txt b/codenet/public_test_cases/p02369/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02369/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02369/output.1.txt b/codenet/public_test_cases/p02369/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02369/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02369/output.2.txt b/codenet/public_test_cases/p02369/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02369/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02370/input.0.txt b/codenet/public_test_cases/p02370/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddc1cf3518bc481a0146ec1edb7d34bcff72df73 --- /dev/null +++ b/codenet/public_test_cases/p02370/input.0.txt @@ -0,0 +1,7 @@ +6 6 +0 1 +1 2 +3 1 +3 4 +4 5 +5 2 diff --git a/codenet/public_test_cases/p02370/input.1.txt b/codenet/public_test_cases/p02370/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddc1cf3518bc481a0146ec1edb7d34bcff72df73 --- /dev/null +++ b/codenet/public_test_cases/p02370/input.1.txt @@ -0,0 +1,7 @@ +6 6 +0 1 +1 2 +3 1 +3 4 +4 5 +5 2 diff --git a/codenet/public_test_cases/p02370/output.0.txt b/codenet/public_test_cases/p02370/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b2fb6015069a11f8cc2cfbcd59620d55be0670b --- /dev/null +++ b/codenet/public_test_cases/p02370/output.0.txt @@ -0,0 +1,6 @@ +0 +3 +1 +4 +5 +2 diff --git a/codenet/public_test_cases/p02370/output.1.txt b/codenet/public_test_cases/p02370/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b2fb6015069a11f8cc2cfbcd59620d55be0670b --- /dev/null +++ b/codenet/public_test_cases/p02370/output.1.txt @@ -0,0 +1,6 @@ +0 +3 +1 +4 +5 +2 diff --git a/codenet/public_test_cases/p02371/input.0.txt b/codenet/public_test_cases/p02371/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b570830d03135d3034c87c6b2d7e7ce0286c5462 --- /dev/null +++ b/codenet/public_test_cases/p02371/input.0.txt @@ -0,0 +1,4 @@ +4 +0 1 2 +1 2 1 +1 3 3 diff --git a/codenet/public_test_cases/p02371/input.1.txt b/codenet/public_test_cases/p02371/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a5f1fae7bb2738782803df4d6ad4d003db45437 --- /dev/null +++ b/codenet/public_test_cases/p02371/input.1.txt @@ -0,0 +1,4 @@ +4 +0 1 1 +1 2 2 +2 3 4 diff --git a/codenet/public_test_cases/p02371/input.2.txt b/codenet/public_test_cases/p02371/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b570830d03135d3034c87c6b2d7e7ce0286c5462 --- /dev/null +++ b/codenet/public_test_cases/p02371/input.2.txt @@ -0,0 +1,4 @@ +4 +0 1 2 +1 2 1 +1 3 3 diff --git a/codenet/public_test_cases/p02371/output.0.txt b/codenet/public_test_cases/p02371/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02371/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02371/output.1.txt b/codenet/public_test_cases/p02371/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02371/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02371/output.2.txt b/codenet/public_test_cases/p02371/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02371/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02372/input.0.txt b/codenet/public_test_cases/p02372/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b570830d03135d3034c87c6b2d7e7ce0286c5462 --- /dev/null +++ b/codenet/public_test_cases/p02372/input.0.txt @@ -0,0 +1,4 @@ +4 +0 1 2 +1 2 1 +1 3 3 diff --git a/codenet/public_test_cases/p02372/input.1.txt b/codenet/public_test_cases/p02372/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b570830d03135d3034c87c6b2d7e7ce0286c5462 --- /dev/null +++ b/codenet/public_test_cases/p02372/input.1.txt @@ -0,0 +1,4 @@ +4 +0 1 2 +1 2 1 +1 3 3 diff --git a/codenet/public_test_cases/p02372/output.0.txt b/codenet/public_test_cases/p02372/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c43d4dfa7061cbf6fe7df69c38c41e23fdb320ea --- /dev/null +++ b/codenet/public_test_cases/p02372/output.0.txt @@ -0,0 +1,4 @@ +5 +3 +4 +5 diff --git a/codenet/public_test_cases/p02372/output.1.txt b/codenet/public_test_cases/p02372/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c43d4dfa7061cbf6fe7df69c38c41e23fdb320ea --- /dev/null +++ b/codenet/public_test_cases/p02372/output.1.txt @@ -0,0 +1,4 @@ +5 +3 +4 +5 diff --git a/codenet/public_test_cases/p02373/input.0.txt b/codenet/public_test_cases/p02373/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..642cdc69aab0084c1bd7795e4256ad2748c03162 --- /dev/null +++ b/codenet/public_test_cases/p02373/input.0.txt @@ -0,0 +1,14 @@ +8 +3 1 2 3 +2 4 5 +0 +0 +0 +2 6 7 +0 +0 +4 +4 6 +4 7 +4 3 +5 2 diff --git a/codenet/public_test_cases/p02373/input.1.txt b/codenet/public_test_cases/p02373/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..642cdc69aab0084c1bd7795e4256ad2748c03162 --- /dev/null +++ b/codenet/public_test_cases/p02373/input.1.txt @@ -0,0 +1,14 @@ +8 +3 1 2 3 +2 4 5 +0 +0 +0 +2 6 7 +0 +0 +4 +4 6 +4 7 +4 3 +5 2 diff --git a/codenet/public_test_cases/p02373/output.0.txt b/codenet/public_test_cases/p02373/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9ff83f194985daf47a3f5f8160f991b8feab351 --- /dev/null +++ b/codenet/public_test_cases/p02373/output.0.txt @@ -0,0 +1,4 @@ +1 +1 +0 +0 diff --git a/codenet/public_test_cases/p02373/output.1.txt b/codenet/public_test_cases/p02373/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9ff83f194985daf47a3f5f8160f991b8feab351 --- /dev/null +++ b/codenet/public_test_cases/p02373/output.1.txt @@ -0,0 +1,4 @@ +1 +1 +0 +0 diff --git a/codenet/public_test_cases/p02374/input.0.txt b/codenet/public_test_cases/p02374/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3292329d2b7195f00812c05119bff8b126bb430 --- /dev/null +++ b/codenet/public_test_cases/p02374/input.0.txt @@ -0,0 +1,15 @@ +6 +2 1 2 +2 3 5 +0 +0 +0 +1 4 +7 +1 1 +0 3 10 +1 2 +0 4 20 +1 3 +0 5 40 +1 4 diff --git a/codenet/public_test_cases/p02374/input.1.txt b/codenet/public_test_cases/p02374/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3292329d2b7195f00812c05119bff8b126bb430 --- /dev/null +++ b/codenet/public_test_cases/p02374/input.1.txt @@ -0,0 +1,15 @@ +6 +2 1 2 +2 3 5 +0 +0 +0 +1 4 +7 +1 1 +0 3 10 +1 2 +0 4 20 +1 3 +0 5 40 +1 4 diff --git a/codenet/public_test_cases/p02374/input.2.txt b/codenet/public_test_cases/p02374/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..badc04dc6be49f64e8b4c57565ca3165bff9607b --- /dev/null +++ b/codenet/public_test_cases/p02374/input.2.txt @@ -0,0 +1,8 @@ +2 +1 1 +0 +4 +0 1 1 +1 1 +0 1 1 +1 1 diff --git a/codenet/public_test_cases/p02374/input.3.txt b/codenet/public_test_cases/p02374/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..136504fdd6a38c6e31bd00bc7aa22971ddfc2dee --- /dev/null +++ b/codenet/public_test_cases/p02374/input.3.txt @@ -0,0 +1,12 @@ +4 +1 1 +1 2 +1 3 +0 +6 +0 3 1000 +0 2 1000 +0 1 1000 +1 1 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02374/output.0.txt b/codenet/public_test_cases/p02374/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ad9ca20f1637dd0c94019325cc4e83459477f5a --- /dev/null +++ b/codenet/public_test_cases/p02374/output.0.txt @@ -0,0 +1,4 @@ +0 +0 +10 +60 diff --git a/codenet/public_test_cases/p02374/output.1.txt b/codenet/public_test_cases/p02374/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ad9ca20f1637dd0c94019325cc4e83459477f5a --- /dev/null +++ b/codenet/public_test_cases/p02374/output.1.txt @@ -0,0 +1,4 @@ +0 +0 +10 +60 diff --git a/codenet/public_test_cases/p02374/output.2.txt b/codenet/public_test_cases/p02374/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p02374/output.2.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p02374/output.3.txt b/codenet/public_test_cases/p02374/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..46f1b0f150a73dd23fab265868e53517c8d00cc0 --- /dev/null +++ b/codenet/public_test_cases/p02374/output.3.txt @@ -0,0 +1,3 @@ +1000 +2000 +3000 diff --git a/codenet/public_test_cases/p02375/input.0.txt b/codenet/public_test_cases/p02375/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3292329d2b7195f00812c05119bff8b126bb430 --- /dev/null +++ b/codenet/public_test_cases/p02375/input.0.txt @@ -0,0 +1,15 @@ +6 +2 1 2 +2 3 5 +0 +0 +0 +1 4 +7 +1 1 +0 3 10 +1 2 +0 4 20 +1 3 +0 5 40 +1 4 diff --git a/codenet/public_test_cases/p02375/input.1.txt b/codenet/public_test_cases/p02375/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..136504fdd6a38c6e31bd00bc7aa22971ddfc2dee --- /dev/null +++ b/codenet/public_test_cases/p02375/input.1.txt @@ -0,0 +1,12 @@ +4 +1 1 +1 2 +1 3 +0 +6 +0 3 1000 +0 2 1000 +0 1 1000 +1 1 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02375/input.2.txt b/codenet/public_test_cases/p02375/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3292329d2b7195f00812c05119bff8b126bb430 --- /dev/null +++ b/codenet/public_test_cases/p02375/input.2.txt @@ -0,0 +1,15 @@ +6 +2 1 2 +2 3 5 +0 +0 +0 +1 4 +7 +1 1 +0 3 10 +1 2 +0 4 20 +1 3 +0 5 40 +1 4 diff --git a/codenet/public_test_cases/p02375/output.0.txt b/codenet/public_test_cases/p02375/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d57b7d9c7014311e6818108f07ca0609370f5e5e --- /dev/null +++ b/codenet/public_test_cases/p02375/output.0.txt @@ -0,0 +1,4 @@ +0 +0 +40 +150 diff --git a/codenet/public_test_cases/p02375/output.1.txt b/codenet/public_test_cases/p02375/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..15488a310b674e9d9d337b6a14de0ce2fce31f82 --- /dev/null +++ b/codenet/public_test_cases/p02375/output.1.txt @@ -0,0 +1,3 @@ +3000 +5000 +6000 diff --git a/codenet/public_test_cases/p02375/output.2.txt b/codenet/public_test_cases/p02375/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d57b7d9c7014311e6818108f07ca0609370f5e5e --- /dev/null +++ b/codenet/public_test_cases/p02375/output.2.txt @@ -0,0 +1,4 @@ +0 +0 +40 +150 diff --git a/codenet/public_test_cases/p02376/input.0.txt b/codenet/public_test_cases/p02376/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3102d1e8de919050625399dd1875b6f4519f973b --- /dev/null +++ b/codenet/public_test_cases/p02376/input.0.txt @@ -0,0 +1,6 @@ +4 5 +0 1 2 +0 2 1 +1 2 1 +1 3 1 +2 3 2 diff --git a/codenet/public_test_cases/p02376/input.1.txt b/codenet/public_test_cases/p02376/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3102d1e8de919050625399dd1875b6f4519f973b --- /dev/null +++ b/codenet/public_test_cases/p02376/input.1.txt @@ -0,0 +1,6 @@ +4 5 +0 1 2 +0 2 1 +1 2 1 +1 3 1 +2 3 2 diff --git a/codenet/public_test_cases/p02376/output.0.txt b/codenet/public_test_cases/p02376/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02376/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02376/output.1.txt b/codenet/public_test_cases/p02376/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02376/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02377/input.0.txt b/codenet/public_test_cases/p02377/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eac4c1a3001230f1cd1845a208c270366389617e --- /dev/null +++ b/codenet/public_test_cases/p02377/input.0.txt @@ -0,0 +1,6 @@ +4 5 2 +0 1 2 1 +0 2 1 2 +1 2 1 1 +1 3 1 3 +2 3 2 1 diff --git a/codenet/public_test_cases/p02377/input.1.txt b/codenet/public_test_cases/p02377/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eac4c1a3001230f1cd1845a208c270366389617e --- /dev/null +++ b/codenet/public_test_cases/p02377/input.1.txt @@ -0,0 +1,6 @@ +4 5 2 +0 1 2 1 +0 2 1 2 +1 2 1 1 +1 3 1 3 +2 3 2 1 diff --git a/codenet/public_test_cases/p02377/input.2.txt b/codenet/public_test_cases/p02377/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02377/input.2.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02377/output.0.txt b/codenet/public_test_cases/p02377/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02377/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02377/output.1.txt b/codenet/public_test_cases/p02377/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02377/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02377/output.2.txt b/codenet/public_test_cases/p02377/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02377/output.2.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02378/input.0.txt b/codenet/public_test_cases/p02378/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2002c309bcf4dba796c00b0280f7aabbefc48960 --- /dev/null +++ b/codenet/public_test_cases/p02378/input.0.txt @@ -0,0 +1,7 @@ +3 4 6 +0 0 +0 2 +0 3 +1 1 +2 1 +2 3 diff --git a/codenet/public_test_cases/p02378/input.1.txt b/codenet/public_test_cases/p02378/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2002c309bcf4dba796c00b0280f7aabbefc48960 --- /dev/null +++ b/codenet/public_test_cases/p02378/input.1.txt @@ -0,0 +1,7 @@ +3 4 6 +0 0 +0 2 +0 3 +1 1 +2 1 +2 3 diff --git a/codenet/public_test_cases/p02378/output.0.txt b/codenet/public_test_cases/p02378/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02378/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02378/output.1.txt b/codenet/public_test_cases/p02378/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02378/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02379/input.0.txt b/codenet/public_test_cases/p02379/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cf0ee603ad600c5d207a467a6b17521adb91109 --- /dev/null +++ b/codenet/public_test_cases/p02379/input.0.txt @@ -0,0 +1 @@ +0 0 1 1 diff --git a/codenet/public_test_cases/p02379/input.1.txt b/codenet/public_test_cases/p02379/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cf0ee603ad600c5d207a467a6b17521adb91109 --- /dev/null +++ b/codenet/public_test_cases/p02379/input.1.txt @@ -0,0 +1 @@ +0 0 1 1 diff --git a/codenet/public_test_cases/p02379/output.0.txt b/codenet/public_test_cases/p02379/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e188b9921c9d07e6958397e3e7745e07bf2dc814 --- /dev/null +++ b/codenet/public_test_cases/p02379/output.0.txt @@ -0,0 +1 @@ +1.41421356 diff --git a/codenet/public_test_cases/p02379/output.1.txt b/codenet/public_test_cases/p02379/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e188b9921c9d07e6958397e3e7745e07bf2dc814 --- /dev/null +++ b/codenet/public_test_cases/p02379/output.1.txt @@ -0,0 +1 @@ +1.41421356 diff --git a/codenet/public_test_cases/p02380/input.0.txt b/codenet/public_test_cases/p02380/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb5ee715f171dd00161d5918bbfd2d42bd597d99 --- /dev/null +++ b/codenet/public_test_cases/p02380/input.0.txt @@ -0,0 +1 @@ +4 3 90 diff --git a/codenet/public_test_cases/p02380/input.1.txt b/codenet/public_test_cases/p02380/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb5ee715f171dd00161d5918bbfd2d42bd597d99 --- /dev/null +++ b/codenet/public_test_cases/p02380/input.1.txt @@ -0,0 +1 @@ +4 3 90 diff --git a/codenet/public_test_cases/p02380/output.0.txt b/codenet/public_test_cases/p02380/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a86ff5a9fd307d57d2b26eb201579978e99e67ee --- /dev/null +++ b/codenet/public_test_cases/p02380/output.0.txt @@ -0,0 +1,3 @@ +6.00000000 +12.00000000 +3.00000000 diff --git a/codenet/public_test_cases/p02380/output.1.txt b/codenet/public_test_cases/p02380/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a86ff5a9fd307d57d2b26eb201579978e99e67ee --- /dev/null +++ b/codenet/public_test_cases/p02380/output.1.txt @@ -0,0 +1,3 @@ +6.00000000 +12.00000000 +3.00000000 diff --git a/codenet/public_test_cases/p02381/input.0.txt b/codenet/public_test_cases/p02381/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abe2f4c00b73eb60920972956d6d57747c3452ff --- /dev/null +++ b/codenet/public_test_cases/p02381/input.0.txt @@ -0,0 +1,5 @@ +5 +70 80 100 90 20 +3 +80 80 80 +0 diff --git a/codenet/public_test_cases/p02381/input.1.txt b/codenet/public_test_cases/p02381/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abe2f4c00b73eb60920972956d6d57747c3452ff --- /dev/null +++ b/codenet/public_test_cases/p02381/input.1.txt @@ -0,0 +1,5 @@ +5 +70 80 100 90 20 +3 +80 80 80 +0 diff --git a/codenet/public_test_cases/p02381/output.0.txt b/codenet/public_test_cases/p02381/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab6691d2d567370a2c30cc6857242f26e05a43f4 --- /dev/null +++ b/codenet/public_test_cases/p02381/output.0.txt @@ -0,0 +1,2 @@ +27.85677655 +0.00000000 diff --git a/codenet/public_test_cases/p02381/output.1.txt b/codenet/public_test_cases/p02381/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab6691d2d567370a2c30cc6857242f26e05a43f4 --- /dev/null +++ b/codenet/public_test_cases/p02381/output.1.txt @@ -0,0 +1,2 @@ +27.85677655 +0.00000000 diff --git a/codenet/public_test_cases/p02382/input.0.txt b/codenet/public_test_cases/p02382/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..026124581ecc3773b6efff37c7d8bcc4f6f1f6ce --- /dev/null +++ b/codenet/public_test_cases/p02382/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 3 +2 0 4 diff --git a/codenet/public_test_cases/p02382/input.1.txt b/codenet/public_test_cases/p02382/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..026124581ecc3773b6efff37c7d8bcc4f6f1f6ce --- /dev/null +++ b/codenet/public_test_cases/p02382/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 3 +2 0 4 diff --git a/codenet/public_test_cases/p02382/output.0.txt b/codenet/public_test_cases/p02382/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..299cb9796527665a5edccec71a69db0b28795d65 --- /dev/null +++ b/codenet/public_test_cases/p02382/output.0.txt @@ -0,0 +1,4 @@ +4.000000 +2.449490 +2.154435 +2.000000 diff --git a/codenet/public_test_cases/p02382/output.1.txt b/codenet/public_test_cases/p02382/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..299cb9796527665a5edccec71a69db0b28795d65 --- /dev/null +++ b/codenet/public_test_cases/p02382/output.1.txt @@ -0,0 +1,4 @@ +4.000000 +2.449490 +2.154435 +2.000000 diff --git a/codenet/public_test_cases/p02383/input.0.txt b/codenet/public_test_cases/p02383/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c973886e851e46baee1a751781e145c668499261 --- /dev/null +++ b/codenet/public_test_cases/p02383/input.0.txt @@ -0,0 +1,2 @@ +1 2 4 8 16 32 +SE diff --git a/codenet/public_test_cases/p02383/input.1.txt b/codenet/public_test_cases/p02383/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4ad1af2e9c172bb6c2c6f2a0124a9d9fbcfbe15 --- /dev/null +++ b/codenet/public_test_cases/p02383/input.1.txt @@ -0,0 +1,2 @@ +1 2 4 8 16 32 +EESWN diff --git a/codenet/public_test_cases/p02383/input.2.txt b/codenet/public_test_cases/p02383/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c973886e851e46baee1a751781e145c668499261 --- /dev/null +++ b/codenet/public_test_cases/p02383/input.2.txt @@ -0,0 +1,2 @@ +1 2 4 8 16 32 +SE diff --git a/codenet/public_test_cases/p02383/output.0.txt b/codenet/public_test_cases/p02383/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02383/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02383/output.1.txt b/codenet/public_test_cases/p02383/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p02383/output.1.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p02383/output.2.txt b/codenet/public_test_cases/p02383/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02383/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02384/input.0.txt b/codenet/public_test_cases/p02384/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e56043332c3cfb2e621036224855644f50e4e17 --- /dev/null +++ b/codenet/public_test_cases/p02384/input.0.txt @@ -0,0 +1,5 @@ +1 2 3 4 5 6 +3 +6 5 +1 3 +3 2 diff --git a/codenet/public_test_cases/p02384/input.1.txt b/codenet/public_test_cases/p02384/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e56043332c3cfb2e621036224855644f50e4e17 --- /dev/null +++ b/codenet/public_test_cases/p02384/input.1.txt @@ -0,0 +1,5 @@ +1 2 3 4 5 6 +3 +6 5 +1 3 +3 2 diff --git a/codenet/public_test_cases/p02384/output.0.txt b/codenet/public_test_cases/p02384/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..014bb3872322bf4745e6180edae62f32a10798b3 --- /dev/null +++ b/codenet/public_test_cases/p02384/output.0.txt @@ -0,0 +1,3 @@ +3 +5 +6 diff --git a/codenet/public_test_cases/p02384/output.1.txt b/codenet/public_test_cases/p02384/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..014bb3872322bf4745e6180edae62f32a10798b3 --- /dev/null +++ b/codenet/public_test_cases/p02384/output.1.txt @@ -0,0 +1,3 @@ +3 +5 +6 diff --git a/codenet/public_test_cases/p02385/input.0.txt b/codenet/public_test_cases/p02385/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e43f81f3fd0297f63d6a238b7a3e4128789fef5d --- /dev/null +++ b/codenet/public_test_cases/p02385/input.0.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +6 2 4 3 5 1 diff --git a/codenet/public_test_cases/p02385/input.1.txt b/codenet/public_test_cases/p02385/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3006e68e4bd3442b5dc2ba56b69464bb58cf04c --- /dev/null +++ b/codenet/public_test_cases/p02385/input.1.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +6 5 4 3 2 1 diff --git a/codenet/public_test_cases/p02385/input.2.txt b/codenet/public_test_cases/p02385/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e43f81f3fd0297f63d6a238b7a3e4128789fef5d --- /dev/null +++ b/codenet/public_test_cases/p02385/input.2.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +6 2 4 3 5 1 diff --git a/codenet/public_test_cases/p02385/output.0.txt b/codenet/public_test_cases/p02385/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02385/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02385/output.1.txt b/codenet/public_test_cases/p02385/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02385/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02385/output.2.txt b/codenet/public_test_cases/p02385/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02385/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02386/input.0.txt b/codenet/public_test_cases/p02386/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..17a584cc9fd4c634ea4002ae8801abad4a445478 --- /dev/null +++ b/codenet/public_test_cases/p02386/input.0.txt @@ -0,0 +1,4 @@ +3 +1 2 3 4 5 6 +6 2 4 3 5 1 +6 5 4 3 2 1 diff --git a/codenet/public_test_cases/p02386/input.1.txt b/codenet/public_test_cases/p02386/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea164fb5e1a3e2bc1427057caa08ce4ffa46f208 --- /dev/null +++ b/codenet/public_test_cases/p02386/input.1.txt @@ -0,0 +1,4 @@ +3 +1 2 3 4 5 6 +6 5 4 3 2 1 +5 4 3 2 1 6 diff --git a/codenet/public_test_cases/p02386/input.2.txt b/codenet/public_test_cases/p02386/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..17a584cc9fd4c634ea4002ae8801abad4a445478 --- /dev/null +++ b/codenet/public_test_cases/p02386/input.2.txt @@ -0,0 +1,4 @@ +3 +1 2 3 4 5 6 +6 2 4 3 5 1 +6 5 4 3 2 1 diff --git a/codenet/public_test_cases/p02386/output.0.txt b/codenet/public_test_cases/p02386/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02386/output.0.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02386/output.1.txt b/codenet/public_test_cases/p02386/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02386/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02386/output.2.txt b/codenet/public_test_cases/p02386/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02386/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02387/input.0.txt b/codenet/public_test_cases/p02387/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85df1d84287cd217b9cc86dc195be99872464b63 --- /dev/null +++ b/codenet/public_test_cases/p02387/input.0.txt @@ -0,0 +1 @@ +No input diff --git a/codenet/public_test_cases/p02387/output.0.txt b/codenet/public_test_cases/p02387/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..557db03de997c86a4a028e1ebd3a1ceb225be238 --- /dev/null +++ b/codenet/public_test_cases/p02387/output.0.txt @@ -0,0 +1 @@ +Hello World diff --git a/codenet/public_test_cases/p02388/input.0.txt b/codenet/public_test_cases/p02388/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02388/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02388/output.0.txt b/codenet/public_test_cases/p02388/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02388/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02389/input.0.txt b/codenet/public_test_cases/p02389/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p02389/input.0.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p02389/input.1.txt b/codenet/public_test_cases/p02389/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p02389/input.1.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p02389/output.0.txt b/codenet/public_test_cases/p02389/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5262923fb010ca39d4934bc81da9078100e1bae5 --- /dev/null +++ b/codenet/public_test_cases/p02389/output.0.txt @@ -0,0 +1 @@ +15 16 diff --git a/codenet/public_test_cases/p02389/output.1.txt b/codenet/public_test_cases/p02389/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5262923fb010ca39d4934bc81da9078100e1bae5 --- /dev/null +++ b/codenet/public_test_cases/p02389/output.1.txt @@ -0,0 +1 @@ +15 16 diff --git a/codenet/public_test_cases/p02390/input.0.txt b/codenet/public_test_cases/p02390/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4f60faf0b07c4e52dcea7a2ad152c061ff7147b --- /dev/null +++ b/codenet/public_test_cases/p02390/input.0.txt @@ -0,0 +1 @@ +46979 diff --git a/codenet/public_test_cases/p02390/input.1.txt b/codenet/public_test_cases/p02390/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4f60faf0b07c4e52dcea7a2ad152c061ff7147b --- /dev/null +++ b/codenet/public_test_cases/p02390/input.1.txt @@ -0,0 +1 @@ +46979 diff --git a/codenet/public_test_cases/p02390/output.0.txt b/codenet/public_test_cases/p02390/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de24a9749cb4b12701bfdff2b05b3aa6b7aa06e6 --- /dev/null +++ b/codenet/public_test_cases/p02390/output.0.txt @@ -0,0 +1 @@ +13:2:59 diff --git a/codenet/public_test_cases/p02390/output.1.txt b/codenet/public_test_cases/p02390/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de24a9749cb4b12701bfdff2b05b3aa6b7aa06e6 --- /dev/null +++ b/codenet/public_test_cases/p02390/output.1.txt @@ -0,0 +1 @@ +13:2:59 diff --git a/codenet/public_test_cases/p02391/input.0.txt b/codenet/public_test_cases/p02391/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p02391/input.0.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p02391/input.1.txt b/codenet/public_test_cases/p02391/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..299a71f3fe47862a2e17f69e981e7ad8beff4e53 --- /dev/null +++ b/codenet/public_test_cases/p02391/input.1.txt @@ -0,0 +1 @@ +5 5 diff --git a/codenet/public_test_cases/p02391/input.2.txt b/codenet/public_test_cases/p02391/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p02391/input.2.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p02391/input.3.txt b/codenet/public_test_cases/p02391/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p02391/input.3.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p02391/output.0.txt b/codenet/public_test_cases/p02391/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p02391/output.0.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p02391/output.1.txt b/codenet/public_test_cases/p02391/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3868da7afe3622db78a2b9217632a3b6931d0a92 --- /dev/null +++ b/codenet/public_test_cases/p02391/output.1.txt @@ -0,0 +1 @@ +a == b diff --git a/codenet/public_test_cases/p02391/output.2.txt b/codenet/public_test_cases/p02391/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p02391/output.2.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p02391/output.3.txt b/codenet/public_test_cases/p02391/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fb63b4b13d1da09d30eece9e6a44d2a9721a869 --- /dev/null +++ b/codenet/public_test_cases/p02391/output.3.txt @@ -0,0 +1 @@ +a > b diff --git a/codenet/public_test_cases/p02392/input.0.txt b/codenet/public_test_cases/p02392/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bb8a739e6e68ac3df1be2d1367392cc2a4874cb --- /dev/null +++ b/codenet/public_test_cases/p02392/input.0.txt @@ -0,0 +1 @@ +1 3 8 diff --git a/codenet/public_test_cases/p02392/input.1.txt b/codenet/public_test_cases/p02392/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bb8a739e6e68ac3df1be2d1367392cc2a4874cb --- /dev/null +++ b/codenet/public_test_cases/p02392/input.1.txt @@ -0,0 +1 @@ +1 3 8 diff --git a/codenet/public_test_cases/p02392/input.2.txt b/codenet/public_test_cases/p02392/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..42329210db0d16bdf757b5587a33e6952bd89095 --- /dev/null +++ b/codenet/public_test_cases/p02392/input.2.txt @@ -0,0 +1 @@ +3 8 1 diff --git a/codenet/public_test_cases/p02392/output.0.txt b/codenet/public_test_cases/p02392/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02392/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02392/output.1.txt b/codenet/public_test_cases/p02392/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02392/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02392/output.2.txt b/codenet/public_test_cases/p02392/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02392/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02393/input.0.txt b/codenet/public_test_cases/p02393/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..42329210db0d16bdf757b5587a33e6952bd89095 --- /dev/null +++ b/codenet/public_test_cases/p02393/input.0.txt @@ -0,0 +1 @@ +3 8 1 diff --git a/codenet/public_test_cases/p02393/output.0.txt b/codenet/public_test_cases/p02393/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bb8a739e6e68ac3df1be2d1367392cc2a4874cb --- /dev/null +++ b/codenet/public_test_cases/p02393/output.0.txt @@ -0,0 +1 @@ +1 3 8 diff --git a/codenet/public_test_cases/p02394/input.0.txt b/codenet/public_test_cases/p02394/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94a3649b620a414b47313e4803e39cffb7fbea82 --- /dev/null +++ b/codenet/public_test_cases/p02394/input.0.txt @@ -0,0 +1 @@ +5 4 2 2 1 diff --git a/codenet/public_test_cases/p02394/input.1.txt b/codenet/public_test_cases/p02394/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94a3649b620a414b47313e4803e39cffb7fbea82 --- /dev/null +++ b/codenet/public_test_cases/p02394/input.1.txt @@ -0,0 +1 @@ +5 4 2 2 1 diff --git a/codenet/public_test_cases/p02394/input.2.txt b/codenet/public_test_cases/p02394/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d34d0a94b8c866e133582e114969443bf302175 --- /dev/null +++ b/codenet/public_test_cases/p02394/input.2.txt @@ -0,0 +1 @@ +5 4 2 4 1 diff --git a/codenet/public_test_cases/p02394/output.0.txt b/codenet/public_test_cases/p02394/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02394/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02394/output.1.txt b/codenet/public_test_cases/p02394/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02394/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02394/output.2.txt b/codenet/public_test_cases/p02394/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02394/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02395/input.0.txt b/codenet/public_test_cases/p02395/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85df1d84287cd217b9cc86dc195be99872464b63 --- /dev/null +++ b/codenet/public_test_cases/p02395/input.0.txt @@ -0,0 +1 @@ +No input diff --git a/codenet/public_test_cases/p02395/output.0.txt b/codenet/public_test_cases/p02395/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8691fa84aa92c5f8bf2de1fe5d791463152d64a2 --- /dev/null +++ b/codenet/public_test_cases/p02395/output.0.txt @@ -0,0 +1,14 @@ +Hello World +Hello World +Hello World +Hello World +Hello World +Hello World +Hello World +. +. +. +. +. +. +Hello World diff --git a/codenet/public_test_cases/p02396/input.0.txt b/codenet/public_test_cases/p02396/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e37b724871dc7194540cccd5fdf13da56d1df6ec --- /dev/null +++ b/codenet/public_test_cases/p02396/input.0.txt @@ -0,0 +1,7 @@ +3 +5 +11 +7 +8 +19 +0 diff --git a/codenet/public_test_cases/p02396/input.1.txt b/codenet/public_test_cases/p02396/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e37b724871dc7194540cccd5fdf13da56d1df6ec --- /dev/null +++ b/codenet/public_test_cases/p02396/input.1.txt @@ -0,0 +1,7 @@ +3 +5 +11 +7 +8 +19 +0 diff --git a/codenet/public_test_cases/p02396/output.0.txt b/codenet/public_test_cases/p02396/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4dc7ef070cd67b13460962345b024799f7f3cd6 --- /dev/null +++ b/codenet/public_test_cases/p02396/output.0.txt @@ -0,0 +1,6 @@ +Case 1: 3 +Case 2: 5 +Case 3: 11 +Case 4: 7 +Case 5: 8 +Case 6: 19 diff --git a/codenet/public_test_cases/p02396/output.1.txt b/codenet/public_test_cases/p02396/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4dc7ef070cd67b13460962345b024799f7f3cd6 --- /dev/null +++ b/codenet/public_test_cases/p02396/output.1.txt @@ -0,0 +1,6 @@ +Case 1: 3 +Case 2: 5 +Case 3: 11 +Case 4: 7 +Case 5: 8 +Case 6: 19 diff --git a/codenet/public_test_cases/p02397/input.0.txt b/codenet/public_test_cases/p02397/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573b0cf321338336d36a5680699d3734ef582a5f --- /dev/null +++ b/codenet/public_test_cases/p02397/input.0.txt @@ -0,0 +1,4 @@ +3 2 +2 2 +5 3 +0 0 diff --git a/codenet/public_test_cases/p02397/input.1.txt b/codenet/public_test_cases/p02397/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573b0cf321338336d36a5680699d3734ef582a5f --- /dev/null +++ b/codenet/public_test_cases/p02397/input.1.txt @@ -0,0 +1,4 @@ +3 2 +2 2 +5 3 +0 0 diff --git a/codenet/public_test_cases/p02397/output.0.txt b/codenet/public_test_cases/p02397/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..15df8c659fbe78629d6563e74cd39652a23a9d1f --- /dev/null +++ b/codenet/public_test_cases/p02397/output.0.txt @@ -0,0 +1,3 @@ +2 3 +2 2 +3 5 diff --git a/codenet/public_test_cases/p02397/output.1.txt b/codenet/public_test_cases/p02397/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..15df8c659fbe78629d6563e74cd39652a23a9d1f --- /dev/null +++ b/codenet/public_test_cases/p02397/output.1.txt @@ -0,0 +1,3 @@ +2 3 +2 2 +3 5 diff --git a/codenet/public_test_cases/p02398/input.0.txt b/codenet/public_test_cases/p02398/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..70ce7b2b192d839d66222f462f67f97ea23134c4 --- /dev/null +++ b/codenet/public_test_cases/p02398/input.0.txt @@ -0,0 +1 @@ +5 14 80 diff --git a/codenet/public_test_cases/p02398/input.1.txt b/codenet/public_test_cases/p02398/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..70ce7b2b192d839d66222f462f67f97ea23134c4 --- /dev/null +++ b/codenet/public_test_cases/p02398/input.1.txt @@ -0,0 +1 @@ +5 14 80 diff --git a/codenet/public_test_cases/p02398/output.0.txt b/codenet/public_test_cases/p02398/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02398/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02398/output.1.txt b/codenet/public_test_cases/p02398/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02398/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02399/input.0.txt b/codenet/public_test_cases/p02399/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02399/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02399/input.1.txt b/codenet/public_test_cases/p02399/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02399/input.1.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02399/output.0.txt b/codenet/public_test_cases/p02399/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d114e32fad9a568cc26dfb32a60bb5054055a47 --- /dev/null +++ b/codenet/public_test_cases/p02399/output.0.txt @@ -0,0 +1 @@ +1 1 1.50000 diff --git a/codenet/public_test_cases/p02399/output.1.txt b/codenet/public_test_cases/p02399/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d114e32fad9a568cc26dfb32a60bb5054055a47 --- /dev/null +++ b/codenet/public_test_cases/p02399/output.1.txt @@ -0,0 +1 @@ +1 1 1.50000 diff --git a/codenet/public_test_cases/p02400/input.0.txt b/codenet/public_test_cases/p02400/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02400/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02400/input.1.txt b/codenet/public_test_cases/p02400/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02400/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02400/input.2.txt b/codenet/public_test_cases/p02400/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02400/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02400/output.0.txt b/codenet/public_test_cases/p02400/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80184bae95b3ece75164a6570adf30ad0bf43ad7 --- /dev/null +++ b/codenet/public_test_cases/p02400/output.0.txt @@ -0,0 +1 @@ +12.566371 12.566371 diff --git a/codenet/public_test_cases/p02400/output.1.txt b/codenet/public_test_cases/p02400/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..80184bae95b3ece75164a6570adf30ad0bf43ad7 --- /dev/null +++ b/codenet/public_test_cases/p02400/output.1.txt @@ -0,0 +1 @@ +12.566371 12.566371 diff --git a/codenet/public_test_cases/p02400/output.2.txt b/codenet/public_test_cases/p02400/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..080052b382b9413038543b9a4e95789155a8e8a8 --- /dev/null +++ b/codenet/public_test_cases/p02400/output.2.txt @@ -0,0 +1 @@ +28.274334 18.849556 diff --git a/codenet/public_test_cases/p02401/input.0.txt b/codenet/public_test_cases/p02401/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fe0be112228cb7a6af05b0f98bc679829bc1048 --- /dev/null +++ b/codenet/public_test_cases/p02401/input.0.txt @@ -0,0 +1,6 @@ +1 + 2 +56 - 18 +13 * 2 +100 / 10 +27 + 81 +0 ? 0 diff --git a/codenet/public_test_cases/p02401/input.1.txt b/codenet/public_test_cases/p02401/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fe0be112228cb7a6af05b0f98bc679829bc1048 --- /dev/null +++ b/codenet/public_test_cases/p02401/input.1.txt @@ -0,0 +1,6 @@ +1 + 2 +56 - 18 +13 * 2 +100 / 10 +27 + 81 +0 ? 0 diff --git a/codenet/public_test_cases/p02401/output.0.txt b/codenet/public_test_cases/p02401/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc3544a5e801ea8b7b85313acc1d0d83463552aa --- /dev/null +++ b/codenet/public_test_cases/p02401/output.0.txt @@ -0,0 +1,5 @@ +3 +38 +26 +10 +108 diff --git a/codenet/public_test_cases/p02401/output.1.txt b/codenet/public_test_cases/p02401/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc3544a5e801ea8b7b85313acc1d0d83463552aa --- /dev/null +++ b/codenet/public_test_cases/p02401/output.1.txt @@ -0,0 +1,5 @@ +3 +38 +26 +10 +108 diff --git a/codenet/public_test_cases/p02402/input.0.txt b/codenet/public_test_cases/p02402/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ffccac4104f00294a9999b36d3cb1665456b054 --- /dev/null +++ b/codenet/public_test_cases/p02402/input.0.txt @@ -0,0 +1,2 @@ +5 +10 1 5 4 17 diff --git a/codenet/public_test_cases/p02402/input.1.txt b/codenet/public_test_cases/p02402/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ffccac4104f00294a9999b36d3cb1665456b054 --- /dev/null +++ b/codenet/public_test_cases/p02402/input.1.txt @@ -0,0 +1,2 @@ +5 +10 1 5 4 17 diff --git a/codenet/public_test_cases/p02402/output.0.txt b/codenet/public_test_cases/p02402/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b61adbe1c379b397ed628b2d6ae68b79f68c6325 --- /dev/null +++ b/codenet/public_test_cases/p02402/output.0.txt @@ -0,0 +1 @@ +1 17 37 diff --git a/codenet/public_test_cases/p02402/output.1.txt b/codenet/public_test_cases/p02402/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b61adbe1c379b397ed628b2d6ae68b79f68c6325 --- /dev/null +++ b/codenet/public_test_cases/p02402/output.1.txt @@ -0,0 +1 @@ +1 17 37 diff --git a/codenet/public_test_cases/p02403/input.0.txt b/codenet/public_test_cases/p02403/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..edeb306520d16d0dad06af443477ddf425df982c --- /dev/null +++ b/codenet/public_test_cases/p02403/input.0.txt @@ -0,0 +1,4 @@ +3 4 +5 6 +2 2 +0 0 diff --git a/codenet/public_test_cases/p02403/input.1.txt b/codenet/public_test_cases/p02403/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..edeb306520d16d0dad06af443477ddf425df982c --- /dev/null +++ b/codenet/public_test_cases/p02403/input.1.txt @@ -0,0 +1,4 @@ +3 4 +5 6 +2 2 +0 0 diff --git a/codenet/public_test_cases/p02403/output.0.txt b/codenet/public_test_cases/p02403/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3defb1369fcb604dc7480b1d8113c1cbc0f3b311 --- /dev/null +++ b/codenet/public_test_cases/p02403/output.0.txt @@ -0,0 +1,12 @@ +#### +#### +#### + +###### +###### +###### +###### +###### + +## +## diff --git a/codenet/public_test_cases/p02403/output.1.txt b/codenet/public_test_cases/p02403/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3defb1369fcb604dc7480b1d8113c1cbc0f3b311 --- /dev/null +++ b/codenet/public_test_cases/p02403/output.1.txt @@ -0,0 +1,12 @@ +#### +#### +#### + +###### +###### +###### +###### +###### + +## +## diff --git a/codenet/public_test_cases/p02404/input.0.txt b/codenet/public_test_cases/p02404/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ad0b5346650fefdac941b35bb4e166522ce3cf0 --- /dev/null +++ b/codenet/public_test_cases/p02404/input.0.txt @@ -0,0 +1,4 @@ +3 4 +5 6 +3 3 +0 0 diff --git a/codenet/public_test_cases/p02404/input.1.txt b/codenet/public_test_cases/p02404/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ad0b5346650fefdac941b35bb4e166522ce3cf0 --- /dev/null +++ b/codenet/public_test_cases/p02404/input.1.txt @@ -0,0 +1,4 @@ +3 4 +5 6 +3 3 +0 0 diff --git a/codenet/public_test_cases/p02404/output.0.txt b/codenet/public_test_cases/p02404/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1bd965f944a9c8189997e61b293c4082995201c --- /dev/null +++ b/codenet/public_test_cases/p02404/output.0.txt @@ -0,0 +1,13 @@ +#### +#..# +#### + +###### +#....# +#....# +#....# +###### + +### +#.# +### diff --git a/codenet/public_test_cases/p02404/output.1.txt b/codenet/public_test_cases/p02404/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1bd965f944a9c8189997e61b293c4082995201c --- /dev/null +++ b/codenet/public_test_cases/p02404/output.1.txt @@ -0,0 +1,13 @@ +#### +#..# +#### + +###### +#....# +#....# +#....# +###### + +### +#.# +### diff --git a/codenet/public_test_cases/p02405/input.0.txt b/codenet/public_test_cases/p02405/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb6ac8749a71af1de16d5309addfefd0cd4aa88e --- /dev/null +++ b/codenet/public_test_cases/p02405/input.0.txt @@ -0,0 +1,6 @@ +3 4 +5 6 +3 3 +2 2 +1 1 +0 0 diff --git a/codenet/public_test_cases/p02405/input.1.txt b/codenet/public_test_cases/p02405/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb6ac8749a71af1de16d5309addfefd0cd4aa88e --- /dev/null +++ b/codenet/public_test_cases/p02405/input.1.txt @@ -0,0 +1,6 @@ +3 4 +5 6 +3 3 +2 2 +1 1 +0 0 diff --git a/codenet/public_test_cases/p02405/output.0.txt b/codenet/public_test_cases/p02405/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63ac321a9292c4092406b028022b39483b80349b --- /dev/null +++ b/codenet/public_test_cases/p02405/output.0.txt @@ -0,0 +1,18 @@ +#.#. +.#.# +#.#. + +#.#.#. +.#.#.# +#.#.#. +.#.#.# +#.#.#. + +#.# +.#. +#.# + +#. +.# + +# diff --git a/codenet/public_test_cases/p02405/output.1.txt b/codenet/public_test_cases/p02405/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63ac321a9292c4092406b028022b39483b80349b --- /dev/null +++ b/codenet/public_test_cases/p02405/output.1.txt @@ -0,0 +1,18 @@ +#.#. +.#.# +#.#. + +#.#.#. +.#.#.# +#.#.#. +.#.#.# +#.#.#. + +#.# +.#. +#.# + +#. +.# + +# diff --git a/codenet/public_test_cases/p02406/input.0.txt b/codenet/public_test_cases/p02406/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p02406/input.0.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p02406/input.1.txt b/codenet/public_test_cases/p02406/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p02406/input.1.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p02406/output.0.txt b/codenet/public_test_cases/p02406/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e17e5f36ee147d8c9af85b5c2f156f2836152c74 --- /dev/null +++ b/codenet/public_test_cases/p02406/output.0.txt @@ -0,0 +1 @@ + 3 6 9 12 13 15 18 21 23 24 27 30 diff --git a/codenet/public_test_cases/p02406/output.1.txt b/codenet/public_test_cases/p02406/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..679e8d7bbf2c2f607d8e6683c2b2906c202383fa --- /dev/null +++ b/codenet/public_test_cases/p02406/output.1.txt @@ -0,0 +1 @@ +3 6 9 12 13 15 18 21 23 24 27 30 diff --git a/codenet/public_test_cases/p02407/input.0.txt b/codenet/public_test_cases/p02407/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p02407/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02407/input.1.txt b/codenet/public_test_cases/p02407/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f06483e2da9a4a822bf45ab3df462f92356579f2 --- /dev/null +++ b/codenet/public_test_cases/p02407/input.1.txt @@ -0,0 +1,2 @@ +8 +3 3 4 4 5 8 7 9 diff --git a/codenet/public_test_cases/p02407/input.2.txt b/codenet/public_test_cases/p02407/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p02407/input.2.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02407/output.0.txt b/codenet/public_test_cases/p02407/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9298f622aa1f3d1304ab2dc84278cc03653cfe4 --- /dev/null +++ b/codenet/public_test_cases/p02407/output.0.txt @@ -0,0 +1 @@ +5 4 3 2 1 diff --git a/codenet/public_test_cases/p02407/output.1.txt b/codenet/public_test_cases/p02407/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c56df445fc300512b48ef0f234b710abedd65fb0 --- /dev/null +++ b/codenet/public_test_cases/p02407/output.1.txt @@ -0,0 +1 @@ +9 7 8 5 4 4 3 3 diff --git a/codenet/public_test_cases/p02407/output.2.txt b/codenet/public_test_cases/p02407/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9298f622aa1f3d1304ab2dc84278cc03653cfe4 --- /dev/null +++ b/codenet/public_test_cases/p02407/output.2.txt @@ -0,0 +1 @@ +5 4 3 2 1 diff --git a/codenet/public_test_cases/p02408/input.0.txt b/codenet/public_test_cases/p02408/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55cdaa74c2efbac5c5c2d016f883fbabb53ec0b8 --- /dev/null +++ b/codenet/public_test_cases/p02408/input.0.txt @@ -0,0 +1,48 @@ +47 +S 10 +S 11 +S 12 +S 13 +H 1 +H 2 +S 6 +S 7 +S 8 +S 9 +H 6 +H 8 +H 9 +H 10 +H 11 +H 4 +H 5 +S 2 +S 3 +S 4 +S 5 +H 12 +H 13 +C 1 +C 2 +D 1 +D 2 +D 3 +D 4 +D 5 +D 6 +D 7 +C 3 +C 4 +C 5 +C 6 +C 7 +C 8 +C 9 +C 10 +C 11 +C 13 +D 9 +D 10 +D 11 +D 12 +D 13 diff --git a/codenet/public_test_cases/p02408/input.1.txt b/codenet/public_test_cases/p02408/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..55cdaa74c2efbac5c5c2d016f883fbabb53ec0b8 --- /dev/null +++ b/codenet/public_test_cases/p02408/input.1.txt @@ -0,0 +1,48 @@ +47 +S 10 +S 11 +S 12 +S 13 +H 1 +H 2 +S 6 +S 7 +S 8 +S 9 +H 6 +H 8 +H 9 +H 10 +H 11 +H 4 +H 5 +S 2 +S 3 +S 4 +S 5 +H 12 +H 13 +C 1 +C 2 +D 1 +D 2 +D 3 +D 4 +D 5 +D 6 +D 7 +C 3 +C 4 +C 5 +C 6 +C 7 +C 8 +C 9 +C 10 +C 11 +C 13 +D 9 +D 10 +D 11 +D 12 +D 13 diff --git a/codenet/public_test_cases/p02408/output.0.txt b/codenet/public_test_cases/p02408/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..16c17b724ba308a09963065fc24ad45142eada4b --- /dev/null +++ b/codenet/public_test_cases/p02408/output.0.txt @@ -0,0 +1,5 @@ +S 1 +H 3 +H 7 +C 12 +D 8 diff --git a/codenet/public_test_cases/p02408/output.1.txt b/codenet/public_test_cases/p02408/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..16c17b724ba308a09963065fc24ad45142eada4b --- /dev/null +++ b/codenet/public_test_cases/p02408/output.1.txt @@ -0,0 +1,5 @@ +S 1 +H 3 +H 7 +C 12 +D 8 diff --git a/codenet/public_test_cases/p02409/input.0.txt b/codenet/public_test_cases/p02409/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..641e3f3fdc5fa8dec69790d09f6f18f9c1db762a --- /dev/null +++ b/codenet/public_test_cases/p02409/input.0.txt @@ -0,0 +1,4 @@ +3 +1 1 3 8 +3 2 2 7 +4 3 8 1 diff --git a/codenet/public_test_cases/p02409/input.1.txt b/codenet/public_test_cases/p02409/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..641e3f3fdc5fa8dec69790d09f6f18f9c1db762a --- /dev/null +++ b/codenet/public_test_cases/p02409/input.1.txt @@ -0,0 +1,4 @@ +3 +1 1 3 8 +3 2 2 7 +4 3 8 1 diff --git a/codenet/public_test_cases/p02409/output.0.txt b/codenet/public_test_cases/p02409/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fa41596239ebf06f92a1a2efde0442a9d1799a9 --- /dev/null +++ b/codenet/public_test_cases/p02409/output.0.txt @@ -0,0 +1,15 @@ + 0 0 8 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 +#################### + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 +#################### + 0 0 0 0 0 0 0 0 0 0 + 0 7 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 +#################### + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 1 0 0 diff --git a/codenet/public_test_cases/p02409/output.1.txt b/codenet/public_test_cases/p02409/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f46ed7b177cc10e791f594da17a1f8e17dd0d53 --- /dev/null +++ b/codenet/public_test_cases/p02409/output.1.txt @@ -0,0 +1,15 @@ +0 0 8 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 +#################### + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 +#################### + 0 0 0 0 0 0 0 0 0 0 + 0 7 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 +#################### + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 1 0 0 diff --git a/codenet/public_test_cases/p02410/input.0.txt b/codenet/public_test_cases/p02410/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf8786c6dbfa25f4902fb5fab80ed71943e783e2 --- /dev/null +++ b/codenet/public_test_cases/p02410/input.0.txt @@ -0,0 +1,8 @@ +3 4 +1 2 0 1 +0 3 0 1 +4 1 1 0 +1 +2 +3 +0 diff --git a/codenet/public_test_cases/p02410/input.1.txt b/codenet/public_test_cases/p02410/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf8786c6dbfa25f4902fb5fab80ed71943e783e2 --- /dev/null +++ b/codenet/public_test_cases/p02410/input.1.txt @@ -0,0 +1,8 @@ +3 4 +1 2 0 1 +0 3 0 1 +4 1 1 0 +1 +2 +3 +0 diff --git a/codenet/public_test_cases/p02410/output.0.txt b/codenet/public_test_cases/p02410/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1f5ca6e1a8ee8e3e3828333de170fead801c153 --- /dev/null +++ b/codenet/public_test_cases/p02410/output.0.txt @@ -0,0 +1,3 @@ +5 +6 +9 diff --git a/codenet/public_test_cases/p02410/output.1.txt b/codenet/public_test_cases/p02410/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1f5ca6e1a8ee8e3e3828333de170fead801c153 --- /dev/null +++ b/codenet/public_test_cases/p02410/output.1.txt @@ -0,0 +1,3 @@ +5 +6 +9 diff --git a/codenet/public_test_cases/p02411/input.0.txt b/codenet/public_test_cases/p02411/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98b03e5d46739b5b7769f09d0834842cb857fade --- /dev/null +++ b/codenet/public_test_cases/p02411/input.0.txt @@ -0,0 +1,4 @@ +40 42 -1 +20 30 -1 +0 2 -1 +-1 -1 -1 diff --git a/codenet/public_test_cases/p02411/input.1.txt b/codenet/public_test_cases/p02411/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98b03e5d46739b5b7769f09d0834842cb857fade --- /dev/null +++ b/codenet/public_test_cases/p02411/input.1.txt @@ -0,0 +1,4 @@ +40 42 -1 +20 30 -1 +0 2 -1 +-1 -1 -1 diff --git a/codenet/public_test_cases/p02411/output.0.txt b/codenet/public_test_cases/p02411/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..181b7d7267cee452016e274258480cbc16484432 --- /dev/null +++ b/codenet/public_test_cases/p02411/output.0.txt @@ -0,0 +1,3 @@ +A +C +F diff --git a/codenet/public_test_cases/p02411/output.1.txt b/codenet/public_test_cases/p02411/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..181b7d7267cee452016e274258480cbc16484432 --- /dev/null +++ b/codenet/public_test_cases/p02411/output.1.txt @@ -0,0 +1,3 @@ +A +C +F diff --git a/codenet/public_test_cases/p02412/input.0.txt b/codenet/public_test_cases/p02412/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3d7f54811799bacfdc5497eae2222b1a617fbec --- /dev/null +++ b/codenet/public_test_cases/p02412/input.0.txt @@ -0,0 +1,2 @@ +5 9 +0 0 diff --git a/codenet/public_test_cases/p02412/input.1.txt b/codenet/public_test_cases/p02412/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3d7f54811799bacfdc5497eae2222b1a617fbec --- /dev/null +++ b/codenet/public_test_cases/p02412/input.1.txt @@ -0,0 +1,2 @@ +5 9 +0 0 diff --git a/codenet/public_test_cases/p02412/output.0.txt b/codenet/public_test_cases/p02412/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02412/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02412/output.1.txt b/codenet/public_test_cases/p02412/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02412/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02413/input.0.txt b/codenet/public_test_cases/p02413/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30c41b407887408ed0fa61a3389b521e57ad64a3 --- /dev/null +++ b/codenet/public_test_cases/p02413/input.0.txt @@ -0,0 +1,5 @@ +4 5 +1 1 3 4 5 +2 2 2 4 5 +3 3 0 1 1 +2 3 4 4 6 diff --git a/codenet/public_test_cases/p02413/input.1.txt b/codenet/public_test_cases/p02413/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..30c41b407887408ed0fa61a3389b521e57ad64a3 --- /dev/null +++ b/codenet/public_test_cases/p02413/input.1.txt @@ -0,0 +1,5 @@ +4 5 +1 1 3 4 5 +2 2 2 4 5 +3 3 0 1 1 +2 3 4 4 6 diff --git a/codenet/public_test_cases/p02413/output.0.txt b/codenet/public_test_cases/p02413/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0e0e7f019d4de6c0d87f226198f7dc136f08aad --- /dev/null +++ b/codenet/public_test_cases/p02413/output.0.txt @@ -0,0 +1,5 @@ +1 1 3 4 5 14 +2 2 2 4 5 15 +3 3 0 1 1 8 +2 3 4 4 6 19 +8 9 9 13 17 56 diff --git a/codenet/public_test_cases/p02413/output.1.txt b/codenet/public_test_cases/p02413/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0e0e7f019d4de6c0d87f226198f7dc136f08aad --- /dev/null +++ b/codenet/public_test_cases/p02413/output.1.txt @@ -0,0 +1,5 @@ +1 1 3 4 5 14 +2 2 2 4 5 15 +3 3 0 1 1 8 +2 3 4 4 6 19 +8 9 9 13 17 56 diff --git a/codenet/public_test_cases/p02414/input.0.txt b/codenet/public_test_cases/p02414/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f6381bee8678b44662a5450d4ea82395da1973a --- /dev/null +++ b/codenet/public_test_cases/p02414/input.0.txt @@ -0,0 +1,6 @@ +3 2 3 +1 2 +0 3 +4 5 +1 2 1 +0 3 2 diff --git a/codenet/public_test_cases/p02414/input.1.txt b/codenet/public_test_cases/p02414/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f6381bee8678b44662a5450d4ea82395da1973a --- /dev/null +++ b/codenet/public_test_cases/p02414/input.1.txt @@ -0,0 +1,6 @@ +3 2 3 +1 2 +0 3 +4 5 +1 2 1 +0 3 2 diff --git a/codenet/public_test_cases/p02414/output.0.txt b/codenet/public_test_cases/p02414/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74eec2f4b3340dbdb6a76ad41e1c876dc579bcfb --- /dev/null +++ b/codenet/public_test_cases/p02414/output.0.txt @@ -0,0 +1,3 @@ +1 8 5 +0 9 6 +4 23 14 diff --git a/codenet/public_test_cases/p02414/output.1.txt b/codenet/public_test_cases/p02414/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74eec2f4b3340dbdb6a76ad41e1c876dc579bcfb --- /dev/null +++ b/codenet/public_test_cases/p02414/output.1.txt @@ -0,0 +1,3 @@ +1 8 5 +0 9 6 +4 23 14 diff --git a/codenet/public_test_cases/p02415/input.0.txt b/codenet/public_test_cases/p02415/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58b46ce924c7c099409195c1c690493e51cb3944 --- /dev/null +++ b/codenet/public_test_cases/p02415/input.0.txt @@ -0,0 +1 @@ +fAIR, LATER, OCCASIONALLY CLOUDY. diff --git a/codenet/public_test_cases/p02415/input.1.txt b/codenet/public_test_cases/p02415/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58b46ce924c7c099409195c1c690493e51cb3944 --- /dev/null +++ b/codenet/public_test_cases/p02415/input.1.txt @@ -0,0 +1 @@ +fAIR, LATER, OCCASIONALLY CLOUDY. diff --git a/codenet/public_test_cases/p02415/output.0.txt b/codenet/public_test_cases/p02415/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7b0a4adf8dc90b1a366eeea1bf6d71e692bd8af --- /dev/null +++ b/codenet/public_test_cases/p02415/output.0.txt @@ -0,0 +1 @@ +Fair, later, occasionally cloudy. diff --git a/codenet/public_test_cases/p02415/output.1.txt b/codenet/public_test_cases/p02415/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7b0a4adf8dc90b1a366eeea1bf6d71e692bd8af --- /dev/null +++ b/codenet/public_test_cases/p02415/output.1.txt @@ -0,0 +1 @@ +Fair, later, occasionally cloudy. diff --git a/codenet/public_test_cases/p02416/input.0.txt b/codenet/public_test_cases/p02416/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..159049df480bb1e8f04a811f78dac9b71414680a --- /dev/null +++ b/codenet/public_test_cases/p02416/input.0.txt @@ -0,0 +1,4 @@ +123 +55 +1000 +0 diff --git a/codenet/public_test_cases/p02416/input.1.txt b/codenet/public_test_cases/p02416/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..159049df480bb1e8f04a811f78dac9b71414680a --- /dev/null +++ b/codenet/public_test_cases/p02416/input.1.txt @@ -0,0 +1,4 @@ +123 +55 +1000 +0 diff --git a/codenet/public_test_cases/p02416/output.0.txt b/codenet/public_test_cases/p02416/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8b7fd21c03e8b21974a936a793f992baec5ce9c --- /dev/null +++ b/codenet/public_test_cases/p02416/output.0.txt @@ -0,0 +1,3 @@ +6 +10 +1 diff --git a/codenet/public_test_cases/p02416/output.1.txt b/codenet/public_test_cases/p02416/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8b7fd21c03e8b21974a936a793f992baec5ce9c --- /dev/null +++ b/codenet/public_test_cases/p02416/output.1.txt @@ -0,0 +1,3 @@ +6 +10 +1 diff --git a/codenet/public_test_cases/p02417/input.0.txt b/codenet/public_test_cases/p02417/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..149bbea034f3175067f1ad64dd8155a19d581221 --- /dev/null +++ b/codenet/public_test_cases/p02417/input.0.txt @@ -0,0 +1 @@ +This is a pen. diff --git a/codenet/public_test_cases/p02417/input.1.txt b/codenet/public_test_cases/p02417/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..149bbea034f3175067f1ad64dd8155a19d581221 --- /dev/null +++ b/codenet/public_test_cases/p02417/input.1.txt @@ -0,0 +1 @@ +This is a pen. diff --git a/codenet/public_test_cases/p02417/output.0.txt b/codenet/public_test_cases/p02417/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27a5aad868582101d7027b8628be6bee9f5e70fc --- /dev/null +++ b/codenet/public_test_cases/p02417/output.0.txt @@ -0,0 +1,26 @@ +a : 1 +b : 0 +c : 0 +d : 0 +e : 1 +f : 0 +g : 0 +h : 1 +i : 2 +j : 0 +k : 0 +l : 0 +m : 0 +n : 1 +o : 0 +p : 1 +q : 0 +r : 0 +s : 2 +t : 1 +u : 0 +v : 0 +w : 0 +x : 0 +y : 0 +z : 0 diff --git a/codenet/public_test_cases/p02417/output.1.txt b/codenet/public_test_cases/p02417/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27a5aad868582101d7027b8628be6bee9f5e70fc --- /dev/null +++ b/codenet/public_test_cases/p02417/output.1.txt @@ -0,0 +1,26 @@ +a : 1 +b : 0 +c : 0 +d : 0 +e : 1 +f : 0 +g : 0 +h : 1 +i : 2 +j : 0 +k : 0 +l : 0 +m : 0 +n : 1 +o : 0 +p : 1 +q : 0 +r : 0 +s : 2 +t : 1 +u : 0 +v : 0 +w : 0 +x : 0 +y : 0 +z : 0 diff --git a/codenet/public_test_cases/p02418/input.0.txt b/codenet/public_test_cases/p02418/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..421998b9e694aa5636fb05f9864469cd746b1527 --- /dev/null +++ b/codenet/public_test_cases/p02418/input.0.txt @@ -0,0 +1,2 @@ +vanceknowledgetoad +advance diff --git a/codenet/public_test_cases/p02418/input.1.txt b/codenet/public_test_cases/p02418/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..421998b9e694aa5636fb05f9864469cd746b1527 --- /dev/null +++ b/codenet/public_test_cases/p02418/input.1.txt @@ -0,0 +1,2 @@ +vanceknowledgetoad +advance diff --git a/codenet/public_test_cases/p02418/input.2.txt b/codenet/public_test_cases/p02418/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b03cf4a49d982472d999a4a19b89a61dbb1a110b --- /dev/null +++ b/codenet/public_test_cases/p02418/input.2.txt @@ -0,0 +1,2 @@ +vanceknowledgetoad +advanced diff --git a/codenet/public_test_cases/p02418/output.0.txt b/codenet/public_test_cases/p02418/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02418/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02418/output.1.txt b/codenet/public_test_cases/p02418/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02418/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02418/output.2.txt b/codenet/public_test_cases/p02418/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02418/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02419/input.0.txt b/codenet/public_test_cases/p02419/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a5208d34a2ae02f12f88a80066ef470de2036d0 --- /dev/null +++ b/codenet/public_test_cases/p02419/input.0.txt @@ -0,0 +1,5 @@ +computer +Nurtures computer scientists and highly-skilled computer engineers +who will create and exploit "knowledge" for the new era. +Provides an outstanding computer environment. +END_OF_TEXT diff --git a/codenet/public_test_cases/p02419/input.1.txt b/codenet/public_test_cases/p02419/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a5208d34a2ae02f12f88a80066ef470de2036d0 --- /dev/null +++ b/codenet/public_test_cases/p02419/input.1.txt @@ -0,0 +1,5 @@ +computer +Nurtures computer scientists and highly-skilled computer engineers +who will create and exploit "knowledge" for the new era. +Provides an outstanding computer environment. +END_OF_TEXT diff --git a/codenet/public_test_cases/p02419/output.0.txt b/codenet/public_test_cases/p02419/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02419/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02419/output.1.txt b/codenet/public_test_cases/p02419/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02419/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02420/input.0.txt b/codenet/public_test_cases/p02420/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b4e5af8367159bf43d535ef6ab3e5555f877082 --- /dev/null +++ b/codenet/public_test_cases/p02420/input.0.txt @@ -0,0 +1,10 @@ +aabc +3 +1 +2 +1 +vwxyz +2 +3 +4 +- diff --git a/codenet/public_test_cases/p02420/input.1.txt b/codenet/public_test_cases/p02420/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b4e5af8367159bf43d535ef6ab3e5555f877082 --- /dev/null +++ b/codenet/public_test_cases/p02420/input.1.txt @@ -0,0 +1,10 @@ +aabc +3 +1 +2 +1 +vwxyz +2 +3 +4 +- diff --git a/codenet/public_test_cases/p02420/output.0.txt b/codenet/public_test_cases/p02420/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3415eab70cbdec17820ae4dc67876b2c78c52d84 --- /dev/null +++ b/codenet/public_test_cases/p02420/output.0.txt @@ -0,0 +1,2 @@ +aabc +xyzvw diff --git a/codenet/public_test_cases/p02420/output.1.txt b/codenet/public_test_cases/p02420/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3415eab70cbdec17820ae4dc67876b2c78c52d84 --- /dev/null +++ b/codenet/public_test_cases/p02420/output.1.txt @@ -0,0 +1,2 @@ +aabc +xyzvw diff --git a/codenet/public_test_cases/p02421/input.0.txt b/codenet/public_test_cases/p02421/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..038fa9d90c516e0ff46ed96d55467c88cbc1cfac --- /dev/null +++ b/codenet/public_test_cases/p02421/input.0.txt @@ -0,0 +1,4 @@ +3 +cat dog +fish fish +lion tiger diff --git a/codenet/public_test_cases/p02421/input.1.txt b/codenet/public_test_cases/p02421/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..038fa9d90c516e0ff46ed96d55467c88cbc1cfac --- /dev/null +++ b/codenet/public_test_cases/p02421/input.1.txt @@ -0,0 +1,4 @@ +3 +cat dog +fish fish +lion tiger diff --git a/codenet/public_test_cases/p02421/output.0.txt b/codenet/public_test_cases/p02421/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c15dab81887ba3cead7b6a121c63e52c1792a2da --- /dev/null +++ b/codenet/public_test_cases/p02421/output.0.txt @@ -0,0 +1 @@ +1 7 diff --git a/codenet/public_test_cases/p02421/output.1.txt b/codenet/public_test_cases/p02421/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c15dab81887ba3cead7b6a121c63e52c1792a2da --- /dev/null +++ b/codenet/public_test_cases/p02421/output.1.txt @@ -0,0 +1 @@ +1 7 diff --git a/codenet/public_test_cases/p02422/input.0.txt b/codenet/public_test_cases/p02422/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9effdb3a9da6ca64fd35eba7f02ec7855134d22 --- /dev/null +++ b/codenet/public_test_cases/p02422/input.0.txt @@ -0,0 +1,5 @@ +abcde +3 +replace 1 3 xyz +reverse 0 2 +print 1 4 diff --git a/codenet/public_test_cases/p02422/input.1.txt b/codenet/public_test_cases/p02422/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9effdb3a9da6ca64fd35eba7f02ec7855134d22 --- /dev/null +++ b/codenet/public_test_cases/p02422/input.1.txt @@ -0,0 +1,5 @@ +abcde +3 +replace 1 3 xyz +reverse 0 2 +print 1 4 diff --git a/codenet/public_test_cases/p02422/input.2.txt b/codenet/public_test_cases/p02422/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..16da19ed352ba17f7ca232729ba29a885897bb6a --- /dev/null +++ b/codenet/public_test_cases/p02422/input.2.txt @@ -0,0 +1,5 @@ +xyz +3 +print 0 2 +replace 0 2 abc +print 0 2 diff --git a/codenet/public_test_cases/p02422/output.0.txt b/codenet/public_test_cases/p02422/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..39ba33f569d7507aa513d3a3a6e81bff085fa464 --- /dev/null +++ b/codenet/public_test_cases/p02422/output.0.txt @@ -0,0 +1 @@ +xaze diff --git a/codenet/public_test_cases/p02422/output.1.txt b/codenet/public_test_cases/p02422/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..39ba33f569d7507aa513d3a3a6e81bff085fa464 --- /dev/null +++ b/codenet/public_test_cases/p02422/output.1.txt @@ -0,0 +1 @@ +xaze diff --git a/codenet/public_test_cases/p02422/output.2.txt b/codenet/public_test_cases/p02422/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc404011c75d8d2ca96a18d6c290a701cd9cce0b --- /dev/null +++ b/codenet/public_test_cases/p02422/output.2.txt @@ -0,0 +1,2 @@ +xyz +abc diff --git a/codenet/public_test_cases/p02423/input.0.txt b/codenet/public_test_cases/p02423/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02423/input.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02423/input.1.txt b/codenet/public_test_cases/p02423/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02423/input.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02423/input.2.txt b/codenet/public_test_cases/p02423/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02423/input.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02423/output.0.txt b/codenet/public_test_cases/p02423/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b88da970680feec2326cbe885888cc62c2af7354 --- /dev/null +++ b/codenet/public_test_cases/p02423/output.0.txt @@ -0,0 +1,4 @@ +00000000000000000000000000001000 +11111111111111111111111111110111 +00000000000000000000000000010000 +00000000000000000000000000000100 diff --git a/codenet/public_test_cases/p02423/output.1.txt b/codenet/public_test_cases/p02423/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37b1a12af9b1949101e007d34005dc71c3bbc3ff --- /dev/null +++ b/codenet/public_test_cases/p02423/output.1.txt @@ -0,0 +1,4 @@ +00000000000000000000000000001101 +11111111111111111111111111110010 +00000000000000000000000000011010 +00000000000000000000000000000110 diff --git a/codenet/public_test_cases/p02423/output.2.txt b/codenet/public_test_cases/p02423/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b88da970680feec2326cbe885888cc62c2af7354 --- /dev/null +++ b/codenet/public_test_cases/p02423/output.2.txt @@ -0,0 +1,4 @@ +00000000000000000000000000001000 +11111111111111111111111111110111 +00000000000000000000000000010000 +00000000000000000000000000000100 diff --git a/codenet/public_test_cases/p02424/input.0.txt b/codenet/public_test_cases/p02424/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3933c1f854201be886d45544b1716c9fba0c69a0 --- /dev/null +++ b/codenet/public_test_cases/p02424/input.0.txt @@ -0,0 +1 @@ +8 10 diff --git a/codenet/public_test_cases/p02424/input.1.txt b/codenet/public_test_cases/p02424/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3933c1f854201be886d45544b1716c9fba0c69a0 --- /dev/null +++ b/codenet/public_test_cases/p02424/input.1.txt @@ -0,0 +1 @@ +8 10 diff --git a/codenet/public_test_cases/p02424/output.0.txt b/codenet/public_test_cases/p02424/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..84227df0c537a9d59ab751d36b1d3c4856d44808 --- /dev/null +++ b/codenet/public_test_cases/p02424/output.0.txt @@ -0,0 +1,3 @@ +00000000000000000000000000001000 +00000000000000000000000000001010 +00000000000000000000000000000010 diff --git a/codenet/public_test_cases/p02424/output.1.txt b/codenet/public_test_cases/p02424/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..84227df0c537a9d59ab751d36b1d3c4856d44808 --- /dev/null +++ b/codenet/public_test_cases/p02424/output.1.txt @@ -0,0 +1,3 @@ +00000000000000000000000000001000 +00000000000000000000000000001010 +00000000000000000000000000000010 diff --git a/codenet/public_test_cases/p02425/input.0.txt b/codenet/public_test_cases/p02425/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5745397bcb452872f0091f6a94155082b175aba1 --- /dev/null +++ b/codenet/public_test_cases/p02425/input.0.txt @@ -0,0 +1,15 @@ +14 +1 0 +1 1 +1 2 +2 1 +0 0 +0 1 +0 2 +0 3 +3 3 +4 +5 +6 +7 +8 diff --git a/codenet/public_test_cases/p02425/input.1.txt b/codenet/public_test_cases/p02425/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5745397bcb452872f0091f6a94155082b175aba1 --- /dev/null +++ b/codenet/public_test_cases/p02425/input.1.txt @@ -0,0 +1,15 @@ +14 +1 0 +1 1 +1 2 +2 1 +0 0 +0 1 +0 2 +0 3 +3 3 +4 +5 +6 +7 +8 diff --git a/codenet/public_test_cases/p02425/output.0.txt b/codenet/public_test_cases/p02425/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88f0b4df85bfcdab6fef013f07a6aada012f01f7 --- /dev/null +++ b/codenet/public_test_cases/p02425/output.0.txt @@ -0,0 +1,9 @@ +1 +0 +1 +0 +0 +1 +0 +3 +13 diff --git a/codenet/public_test_cases/p02425/output.1.txt b/codenet/public_test_cases/p02425/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..88f0b4df85bfcdab6fef013f07a6aada012f01f7 --- /dev/null +++ b/codenet/public_test_cases/p02425/output.1.txt @@ -0,0 +1,9 @@ +1 +0 +1 +0 +0 +1 +0 +3 +13 diff --git a/codenet/public_test_cases/p02426/input.0.txt b/codenet/public_test_cases/p02426/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3162161f78efe4ca664dd5a1afb205a8bcc331d3 --- /dev/null +++ b/codenet/public_test_cases/p02426/input.0.txt @@ -0,0 +1,13 @@ +3 +3 0 1 3 +1 3 +3 0 1 2 +8 +1 0 +2 1 +3 1 +4 2 +5 2 +6 2 +7 2 +8 2 diff --git a/codenet/public_test_cases/p02426/input.1.txt b/codenet/public_test_cases/p02426/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3162161f78efe4ca664dd5a1afb205a8bcc331d3 --- /dev/null +++ b/codenet/public_test_cases/p02426/input.1.txt @@ -0,0 +1,13 @@ +3 +3 0 1 3 +1 3 +3 0 1 2 +8 +1 0 +2 1 +3 1 +4 2 +5 2 +6 2 +7 2 +8 2 diff --git a/codenet/public_test_cases/p02426/output.0.txt b/codenet/public_test_cases/p02426/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..179c2f1bd276a36970e46552f863a083d517be43 --- /dev/null +++ b/codenet/public_test_cases/p02426/output.0.txt @@ -0,0 +1,5 @@ +0 +1 +0 +2 +3 diff --git a/codenet/public_test_cases/p02426/output.1.txt b/codenet/public_test_cases/p02426/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..179c2f1bd276a36970e46552f863a083d517be43 --- /dev/null +++ b/codenet/public_test_cases/p02426/output.1.txt @@ -0,0 +1,5 @@ +0 +1 +0 +2 +3 diff --git a/codenet/public_test_cases/p02427/input.0.txt b/codenet/public_test_cases/p02427/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02427/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02427/input.1.txt b/codenet/public_test_cases/p02427/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02427/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02427/output.0.txt b/codenet/public_test_cases/p02427/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e51ec153ac5dff4d40621e648a9a32953b3b737f --- /dev/null +++ b/codenet/public_test_cases/p02427/output.0.txt @@ -0,0 +1,16 @@ +0: +1: 0 +2: 1 +3: 0 1 +4: 2 +5: 0 2 +6: 1 2 +7: 0 1 2 +8: 3 +9: 0 3 +10: 1 3 +11: 0 1 3 +12: 2 3 +13: 0 2 3 +14: 1 2 3 +15: 0 1 2 3 diff --git a/codenet/public_test_cases/p02427/output.1.txt b/codenet/public_test_cases/p02427/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e51ec153ac5dff4d40621e648a9a32953b3b737f --- /dev/null +++ b/codenet/public_test_cases/p02427/output.1.txt @@ -0,0 +1,16 @@ +0: +1: 0 +2: 1 +3: 0 1 +4: 2 +5: 0 2 +6: 1 2 +7: 0 1 2 +8: 3 +9: 0 3 +10: 1 3 +11: 0 1 3 +12: 2 3 +13: 0 2 3 +14: 1 2 3 +15: 0 1 2 3 diff --git a/codenet/public_test_cases/p02428/input.0.txt b/codenet/public_test_cases/p02428/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63bbc5b762bf421508f0a7601aaba339b063e05c --- /dev/null +++ b/codenet/public_test_cases/p02428/input.0.txt @@ -0,0 +1,2 @@ +4 +2 0 2 diff --git a/codenet/public_test_cases/p02428/input.1.txt b/codenet/public_test_cases/p02428/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63bbc5b762bf421508f0a7601aaba339b063e05c --- /dev/null +++ b/codenet/public_test_cases/p02428/input.1.txt @@ -0,0 +1,2 @@ +4 +2 0 2 diff --git a/codenet/public_test_cases/p02428/output.0.txt b/codenet/public_test_cases/p02428/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..04e47f58d9c1dae36ac640ef07ac16c7c7c608a8 --- /dev/null +++ b/codenet/public_test_cases/p02428/output.0.txt @@ -0,0 +1,4 @@ +5: 0 2 +7: 0 1 2 +13: 0 2 3 +15: 0 1 2 3 diff --git a/codenet/public_test_cases/p02428/output.1.txt b/codenet/public_test_cases/p02428/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..04e47f58d9c1dae36ac640ef07ac16c7c7c608a8 --- /dev/null +++ b/codenet/public_test_cases/p02428/output.1.txt @@ -0,0 +1,4 @@ +5: 0 2 +7: 0 1 2 +13: 0 2 3 +15: 0 1 2 3 diff --git a/codenet/public_test_cases/p02429/input.0.txt b/codenet/public_test_cases/p02429/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63bbc5b762bf421508f0a7601aaba339b063e05c --- /dev/null +++ b/codenet/public_test_cases/p02429/input.0.txt @@ -0,0 +1,2 @@ +4 +2 0 2 diff --git a/codenet/public_test_cases/p02429/input.1.txt b/codenet/public_test_cases/p02429/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63bbc5b762bf421508f0a7601aaba339b063e05c --- /dev/null +++ b/codenet/public_test_cases/p02429/input.1.txt @@ -0,0 +1,2 @@ +4 +2 0 2 diff --git a/codenet/public_test_cases/p02429/output.0.txt b/codenet/public_test_cases/p02429/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..448a2cbd18cb2181f251d6e39c0fffcacbad1ee4 --- /dev/null +++ b/codenet/public_test_cases/p02429/output.0.txt @@ -0,0 +1,4 @@ +0: +1: 0 +4: 2 +5: 0 2 diff --git a/codenet/public_test_cases/p02429/output.1.txt b/codenet/public_test_cases/p02429/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..448a2cbd18cb2181f251d6e39c0fffcacbad1ee4 --- /dev/null +++ b/codenet/public_test_cases/p02429/output.1.txt @@ -0,0 +1,4 @@ +0: +1: 0 +4: 2 +5: 0 2 diff --git a/codenet/public_test_cases/p02430/input.0.txt b/codenet/public_test_cases/p02430/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p02430/input.0.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p02430/input.1.txt b/codenet/public_test_cases/p02430/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p02430/input.1.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p02430/output.0.txt b/codenet/public_test_cases/p02430/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbc3710a8fd2c5eb0c624fde4d6743ddf058adff --- /dev/null +++ b/codenet/public_test_cases/p02430/output.0.txt @@ -0,0 +1,10 @@ +7: 0 1 2 +11: 0 1 3 +13: 0 2 3 +14: 1 2 3 +19: 0 1 4 +21: 0 2 4 +22: 1 2 4 +25: 0 3 4 +26: 1 3 4 +28: 2 3 4 diff --git a/codenet/public_test_cases/p02430/output.1.txt b/codenet/public_test_cases/p02430/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbc3710a8fd2c5eb0c624fde4d6743ddf058adff --- /dev/null +++ b/codenet/public_test_cases/p02430/output.1.txt @@ -0,0 +1,10 @@ +7: 0 1 2 +11: 0 1 3 +13: 0 2 3 +14: 1 2 3 +19: 0 1 4 +21: 0 2 4 +22: 1 2 4 +25: 0 3 4 +26: 1 3 4 +28: 2 3 4 diff --git a/codenet/public_test_cases/p02431/input.0.txt b/codenet/public_test_cases/p02431/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38bb49a5b057634920c9274c8ac801500e6db4bc --- /dev/null +++ b/codenet/public_test_cases/p02431/input.0.txt @@ -0,0 +1,9 @@ +8 +0 1 +0 2 +0 3 +2 +0 4 +1 0 +1 1 +1 2 diff --git a/codenet/public_test_cases/p02431/input.1.txt b/codenet/public_test_cases/p02431/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38bb49a5b057634920c9274c8ac801500e6db4bc --- /dev/null +++ b/codenet/public_test_cases/p02431/input.1.txt @@ -0,0 +1,9 @@ +8 +0 1 +0 2 +0 3 +2 +0 4 +1 0 +1 1 +1 2 diff --git a/codenet/public_test_cases/p02431/output.0.txt b/codenet/public_test_cases/p02431/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8a01cd985125a824409ef6b2f264c76b54ffe6a --- /dev/null +++ b/codenet/public_test_cases/p02431/output.0.txt @@ -0,0 +1,3 @@ +1 +2 +4 diff --git a/codenet/public_test_cases/p02431/output.1.txt b/codenet/public_test_cases/p02431/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8a01cd985125a824409ef6b2f264c76b54ffe6a --- /dev/null +++ b/codenet/public_test_cases/p02431/output.1.txt @@ -0,0 +1,3 @@ +1 +2 +4 diff --git a/codenet/public_test_cases/p02432/input.0.txt b/codenet/public_test_cases/p02432/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2030267de86315dbc3c232cac8cc002aad1d9b82 --- /dev/null +++ b/codenet/public_test_cases/p02432/input.0.txt @@ -0,0 +1,12 @@ +11 +0 0 1 +0 0 2 +0 1 3 +1 0 +1 1 +1 2 +2 0 +2 1 +0 0 4 +1 0 +1 1 diff --git a/codenet/public_test_cases/p02432/input.1.txt b/codenet/public_test_cases/p02432/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2030267de86315dbc3c232cac8cc002aad1d9b82 --- /dev/null +++ b/codenet/public_test_cases/p02432/input.1.txt @@ -0,0 +1,12 @@ +11 +0 0 1 +0 0 2 +0 1 3 +1 0 +1 1 +1 2 +2 0 +2 1 +0 0 4 +1 0 +1 1 diff --git a/codenet/public_test_cases/p02432/output.0.txt b/codenet/public_test_cases/p02432/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b8862e4fdfa2c7f7dce20cc37f5438b9cb061bc --- /dev/null +++ b/codenet/public_test_cases/p02432/output.0.txt @@ -0,0 +1,5 @@ +2 +1 +3 +4 +1 diff --git a/codenet/public_test_cases/p02432/output.1.txt b/codenet/public_test_cases/p02432/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b8862e4fdfa2c7f7dce20cc37f5438b9cb061bc --- /dev/null +++ b/codenet/public_test_cases/p02432/output.1.txt @@ -0,0 +1,5 @@ +2 +1 +3 +4 +1 diff --git a/codenet/public_test_cases/p02433/input.0.txt b/codenet/public_test_cases/p02433/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e79894c422151a3c3afc0605bf2020eeb25affa7 --- /dev/null +++ b/codenet/public_test_cases/p02433/input.0.txt @@ -0,0 +1,6 @@ +5 +0 1 +0 2 +0 3 +1 1 +2 diff --git a/codenet/public_test_cases/p02433/input.1.txt b/codenet/public_test_cases/p02433/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e79894c422151a3c3afc0605bf2020eeb25affa7 --- /dev/null +++ b/codenet/public_test_cases/p02433/input.1.txt @@ -0,0 +1,6 @@ +5 +0 1 +0 2 +0 3 +1 1 +2 diff --git a/codenet/public_test_cases/p02433/output.0.txt b/codenet/public_test_cases/p02433/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p02433/output.0.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p02433/output.1.txt b/codenet/public_test_cases/p02433/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p02433/output.1.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p02434/input.0.txt b/codenet/public_test_cases/p02434/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02ef53ba62a1c3f4b003e158bf4ac7df8f8a0d87 --- /dev/null +++ b/codenet/public_test_cases/p02434/input.0.txt @@ -0,0 +1,14 @@ +3 13 +0 0 1 +0 0 2 +0 0 3 +0 1 -1 +0 2 4 +0 2 5 +1 0 +1 1 +1 2 +2 1 +1 0 +1 1 +1 2 diff --git a/codenet/public_test_cases/p02434/input.1.txt b/codenet/public_test_cases/p02434/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..02ef53ba62a1c3f4b003e158bf4ac7df8f8a0d87 --- /dev/null +++ b/codenet/public_test_cases/p02434/input.1.txt @@ -0,0 +1,14 @@ +3 13 +0 0 1 +0 0 2 +0 0 3 +0 1 -1 +0 2 4 +0 2 5 +1 0 +1 1 +1 2 +2 1 +1 0 +1 1 +1 2 diff --git a/codenet/public_test_cases/p02434/output.0.txt b/codenet/public_test_cases/p02434/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae9e5a5adc980f217e80827c1e116e306811485e --- /dev/null +++ b/codenet/public_test_cases/p02434/output.0.txt @@ -0,0 +1,6 @@ +1 2 3 +-1 +4 5 +1 2 3 + +4 5 diff --git a/codenet/public_test_cases/p02434/output.1.txt b/codenet/public_test_cases/p02434/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae9e5a5adc980f217e80827c1e116e306811485e --- /dev/null +++ b/codenet/public_test_cases/p02434/output.1.txt @@ -0,0 +1,6 @@ +1 2 3 +-1 +4 5 +1 2 3 + +4 5 diff --git a/codenet/public_test_cases/p02435/input.0.txt b/codenet/public_test_cases/p02435/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddb74f29dc452049f61d8769f0af456aeef843e7 --- /dev/null +++ b/codenet/public_test_cases/p02435/input.0.txt @@ -0,0 +1,10 @@ +3 9 +0 0 1 +0 0 2 +0 0 3 +0 2 4 +0 2 5 +1 0 +1 2 +2 0 +1 0 diff --git a/codenet/public_test_cases/p02435/input.1.txt b/codenet/public_test_cases/p02435/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddb74f29dc452049f61d8769f0af456aeef843e7 --- /dev/null +++ b/codenet/public_test_cases/p02435/input.1.txt @@ -0,0 +1,10 @@ +3 9 +0 0 1 +0 0 2 +0 0 3 +0 2 4 +0 2 5 +1 0 +1 2 +2 0 +1 0 diff --git a/codenet/public_test_cases/p02435/output.0.txt b/codenet/public_test_cases/p02435/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8a484dff28cae0c34492cf680c19730201ec247 --- /dev/null +++ b/codenet/public_test_cases/p02435/output.0.txt @@ -0,0 +1,3 @@ +3 +5 +2 diff --git a/codenet/public_test_cases/p02435/output.1.txt b/codenet/public_test_cases/p02435/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8a484dff28cae0c34492cf680c19730201ec247 --- /dev/null +++ b/codenet/public_test_cases/p02435/output.1.txt @@ -0,0 +1,3 @@ +3 +5 +2 diff --git a/codenet/public_test_cases/p02436/input.0.txt b/codenet/public_test_cases/p02436/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddb74f29dc452049f61d8769f0af456aeef843e7 --- /dev/null +++ b/codenet/public_test_cases/p02436/input.0.txt @@ -0,0 +1,10 @@ +3 9 +0 0 1 +0 0 2 +0 0 3 +0 2 4 +0 2 5 +1 0 +1 2 +2 0 +1 0 diff --git a/codenet/public_test_cases/p02436/input.1.txt b/codenet/public_test_cases/p02436/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddb74f29dc452049f61d8769f0af456aeef843e7 --- /dev/null +++ b/codenet/public_test_cases/p02436/input.1.txt @@ -0,0 +1,10 @@ +3 9 +0 0 1 +0 0 2 +0 0 3 +0 2 4 +0 2 5 +1 0 +1 2 +2 0 +1 0 diff --git a/codenet/public_test_cases/p02436/output.0.txt b/codenet/public_test_cases/p02436/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6327ccae6ea416db6a05fa5bcd08aff5f90c5c79 --- /dev/null +++ b/codenet/public_test_cases/p02436/output.0.txt @@ -0,0 +1,3 @@ +1 +4 +2 diff --git a/codenet/public_test_cases/p02436/output.1.txt b/codenet/public_test_cases/p02436/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6327ccae6ea416db6a05fa5bcd08aff5f90c5c79 --- /dev/null +++ b/codenet/public_test_cases/p02436/output.1.txt @@ -0,0 +1,3 @@ +1 +4 +2 diff --git a/codenet/public_test_cases/p02437/input.0.txt b/codenet/public_test_cases/p02437/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b2e88114ae1fbe1bad175187834b2601b91da2f --- /dev/null +++ b/codenet/public_test_cases/p02437/input.0.txt @@ -0,0 +1,11 @@ +2 10 +0 0 3 +0 0 9 +0 0 1 +1 0 +2 0 +1 0 +0 0 4 +1 0 +0 1 8 +1 1 diff --git a/codenet/public_test_cases/p02437/input.1.txt b/codenet/public_test_cases/p02437/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b2e88114ae1fbe1bad175187834b2601b91da2f --- /dev/null +++ b/codenet/public_test_cases/p02437/input.1.txt @@ -0,0 +1,11 @@ +2 10 +0 0 3 +0 0 9 +0 0 1 +1 0 +2 0 +1 0 +0 0 4 +1 0 +0 1 8 +1 1 diff --git a/codenet/public_test_cases/p02437/output.0.txt b/codenet/public_test_cases/p02437/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7946ee421e195baa64c53aa72ffefa60ee5c3584 --- /dev/null +++ b/codenet/public_test_cases/p02437/output.0.txt @@ -0,0 +1,4 @@ +9 +3 +4 +8 diff --git a/codenet/public_test_cases/p02437/output.1.txt b/codenet/public_test_cases/p02437/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7946ee421e195baa64c53aa72ffefa60ee5c3584 --- /dev/null +++ b/codenet/public_test_cases/p02437/output.1.txt @@ -0,0 +1,4 @@ +9 +3 +4 +8 diff --git a/codenet/public_test_cases/p02438/input.0.txt b/codenet/public_test_cases/p02438/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f148f299aab1e4e890dca6a0aa7c83ae84ff2df6 --- /dev/null +++ b/codenet/public_test_cases/p02438/input.0.txt @@ -0,0 +1,11 @@ +3 10 +0 0 1 +0 0 2 +0 0 3 +0 1 4 +0 1 5 +2 1 0 +0 2 6 +1 0 +1 1 +1 2 diff --git a/codenet/public_test_cases/p02438/input.1.txt b/codenet/public_test_cases/p02438/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f148f299aab1e4e890dca6a0aa7c83ae84ff2df6 --- /dev/null +++ b/codenet/public_test_cases/p02438/input.1.txt @@ -0,0 +1,11 @@ +3 10 +0 0 1 +0 0 2 +0 0 3 +0 1 4 +0 1 5 +2 1 0 +0 2 6 +1 0 +1 1 +1 2 diff --git a/codenet/public_test_cases/p02438/output.0.txt b/codenet/public_test_cases/p02438/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3048c0112cc20e720bc0838071e25d171559cdd --- /dev/null +++ b/codenet/public_test_cases/p02438/output.0.txt @@ -0,0 +1,3 @@ +1 2 3 4 5 + +6 diff --git a/codenet/public_test_cases/p02438/output.1.txt b/codenet/public_test_cases/p02438/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3048c0112cc20e720bc0838071e25d171559cdd --- /dev/null +++ b/codenet/public_test_cases/p02438/output.1.txt @@ -0,0 +1,3 @@ +1 2 3 4 5 + +6 diff --git a/codenet/public_test_cases/p02439/input.0.txt b/codenet/public_test_cases/p02439/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5037240a7e32ce21261f3ce2cbbfdb6f3d59233c --- /dev/null +++ b/codenet/public_test_cases/p02439/input.0.txt @@ -0,0 +1 @@ +4 5 3 diff --git a/codenet/public_test_cases/p02439/input.1.txt b/codenet/public_test_cases/p02439/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5037240a7e32ce21261f3ce2cbbfdb6f3d59233c --- /dev/null +++ b/codenet/public_test_cases/p02439/input.1.txt @@ -0,0 +1 @@ +4 5 3 diff --git a/codenet/public_test_cases/p02439/output.0.txt b/codenet/public_test_cases/p02439/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p02439/output.0.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p02439/output.1.txt b/codenet/public_test_cases/p02439/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p02439/output.1.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p02440/input.0.txt b/codenet/public_test_cases/p02440/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a557b6fcf083f0fa93e2f4ac5eae63b8958bd46 --- /dev/null +++ b/codenet/public_test_cases/p02440/input.0.txt @@ -0,0 +1,6 @@ +7 +8 3 7 1 9 1 4 +3 +0 0 3 +0 1 5 +1 0 7 diff --git a/codenet/public_test_cases/p02440/input.1.txt b/codenet/public_test_cases/p02440/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a557b6fcf083f0fa93e2f4ac5eae63b8958bd46 --- /dev/null +++ b/codenet/public_test_cases/p02440/input.1.txt @@ -0,0 +1,6 @@ +7 +8 3 7 1 9 1 4 +3 +0 0 3 +0 1 5 +1 0 7 diff --git a/codenet/public_test_cases/p02440/output.0.txt b/codenet/public_test_cases/p02440/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c33bcedf89b1b86e3c330ba2f9fa0ea5be58995 --- /dev/null +++ b/codenet/public_test_cases/p02440/output.0.txt @@ -0,0 +1,3 @@ +3 +1 +9 diff --git a/codenet/public_test_cases/p02440/output.1.txt b/codenet/public_test_cases/p02440/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c33bcedf89b1b86e3c330ba2f9fa0ea5be58995 --- /dev/null +++ b/codenet/public_test_cases/p02440/output.1.txt @@ -0,0 +1,3 @@ +3 +1 +9 diff --git a/codenet/public_test_cases/p02441/input.0.txt b/codenet/public_test_cases/p02441/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a59ce4541bc6674a05fb042f3356c2d0edcc6d8 --- /dev/null +++ b/codenet/public_test_cases/p02441/input.0.txt @@ -0,0 +1,6 @@ +9 +1 4 1 4 2 1 3 5 6 +3 +0 9 1 +1 6 1 +3 7 5 diff --git a/codenet/public_test_cases/p02441/input.1.txt b/codenet/public_test_cases/p02441/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a59ce4541bc6674a05fb042f3356c2d0edcc6d8 --- /dev/null +++ b/codenet/public_test_cases/p02441/input.1.txt @@ -0,0 +1,6 @@ +9 +1 4 1 4 2 1 3 5 6 +3 +0 9 1 +1 6 1 +3 7 5 diff --git a/codenet/public_test_cases/p02441/output.0.txt b/codenet/public_test_cases/p02441/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd3f9dbe6b39e425b0a349c4e04369ad4f6593ad --- /dev/null +++ b/codenet/public_test_cases/p02441/output.0.txt @@ -0,0 +1,3 @@ +3 +2 +0 diff --git a/codenet/public_test_cases/p02441/output.1.txt b/codenet/public_test_cases/p02441/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd3f9dbe6b39e425b0a349c4e04369ad4f6593ad --- /dev/null +++ b/codenet/public_test_cases/p02441/output.1.txt @@ -0,0 +1,3 @@ +3 +2 +0 diff --git a/codenet/public_test_cases/p02442/input.0.txt b/codenet/public_test_cases/p02442/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ce814dec151a59be3f6eb0504f92f640fe4589d --- /dev/null +++ b/codenet/public_test_cases/p02442/input.0.txt @@ -0,0 +1,4 @@ +3 +1 2 3 +2 +2 4 diff --git a/codenet/public_test_cases/p02442/input.1.txt b/codenet/public_test_cases/p02442/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b08ff86efc6b6d47178c343cbd87798baabe42e --- /dev/null +++ b/codenet/public_test_cases/p02442/input.1.txt @@ -0,0 +1,4 @@ +3 +1 1 2 +4 +1 1 2 2 diff --git a/codenet/public_test_cases/p02442/input.2.txt b/codenet/public_test_cases/p02442/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ce814dec151a59be3f6eb0504f92f640fe4589d --- /dev/null +++ b/codenet/public_test_cases/p02442/input.2.txt @@ -0,0 +1,4 @@ +3 +1 2 3 +2 +2 4 diff --git a/codenet/public_test_cases/p02442/input.3.txt b/codenet/public_test_cases/p02442/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c46a441acf3c0553aab7a556f2d5b4b493cd1e5 --- /dev/null +++ b/codenet/public_test_cases/p02442/input.3.txt @@ -0,0 +1,4 @@ +4 +5 4 7 0 +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02442/output.0.txt b/codenet/public_test_cases/p02442/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02442/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02442/output.1.txt b/codenet/public_test_cases/p02442/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02442/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02442/output.2.txt b/codenet/public_test_cases/p02442/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02442/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02442/output.3.txt b/codenet/public_test_cases/p02442/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02442/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02443/input.0.txt b/codenet/public_test_cases/p02443/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..103139c2b4becb9b19be6d9a313a35083a66bdbd --- /dev/null +++ b/codenet/public_test_cases/p02443/input.0.txt @@ -0,0 +1,5 @@ +8 +1 2 3 4 5 6 7 8 +2 +1 6 +3 8 diff --git a/codenet/public_test_cases/p02443/input.1.txt b/codenet/public_test_cases/p02443/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..103139c2b4becb9b19be6d9a313a35083a66bdbd --- /dev/null +++ b/codenet/public_test_cases/p02443/input.1.txt @@ -0,0 +1,5 @@ +8 +1 2 3 4 5 6 7 8 +2 +1 6 +3 8 diff --git a/codenet/public_test_cases/p02443/output.0.txt b/codenet/public_test_cases/p02443/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe503d4fc7fe0282ebe42facf00ddf25bff38de --- /dev/null +++ b/codenet/public_test_cases/p02443/output.0.txt @@ -0,0 +1 @@ +1 6 5 8 7 2 3 4 diff --git a/codenet/public_test_cases/p02443/output.1.txt b/codenet/public_test_cases/p02443/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe503d4fc7fe0282ebe42facf00ddf25bff38de --- /dev/null +++ b/codenet/public_test_cases/p02443/output.1.txt @@ -0,0 +1 @@ +1 6 5 8 7 2 3 4 diff --git a/codenet/public_test_cases/p02444/input.0.txt b/codenet/public_test_cases/p02444/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e30032fcfe0645e01c5d35dd85ff5f98a29ceb33 --- /dev/null +++ b/codenet/public_test_cases/p02444/input.0.txt @@ -0,0 +1,4 @@ +11 +1 2 3 4 5 6 7 8 9 10 11 +1 +2 6 9 diff --git a/codenet/public_test_cases/p02444/input.1.txt b/codenet/public_test_cases/p02444/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e30032fcfe0645e01c5d35dd85ff5f98a29ceb33 --- /dev/null +++ b/codenet/public_test_cases/p02444/input.1.txt @@ -0,0 +1,4 @@ +11 +1 2 3 4 5 6 7 8 9 10 11 +1 +2 6 9 diff --git a/codenet/public_test_cases/p02444/output.0.txt b/codenet/public_test_cases/p02444/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8e5269a2ef44a8c27c554c657bcbb5bf2852643 --- /dev/null +++ b/codenet/public_test_cases/p02444/output.0.txt @@ -0,0 +1 @@ +1 2 7 8 9 3 4 5 6 10 11 diff --git a/codenet/public_test_cases/p02444/output.1.txt b/codenet/public_test_cases/p02444/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8e5269a2ef44a8c27c554c657bcbb5bf2852643 --- /dev/null +++ b/codenet/public_test_cases/p02444/output.1.txt @@ -0,0 +1 @@ +1 2 7 8 9 3 4 5 6 10 11 diff --git a/codenet/public_test_cases/p02445/input.0.txt b/codenet/public_test_cases/p02445/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe0da53c9e90a018edfaa86cdb988cb00e2b4f9 --- /dev/null +++ b/codenet/public_test_cases/p02445/input.0.txt @@ -0,0 +1,4 @@ +11 +1 2 3 4 5 6 7 8 9 10 11 +1 +1 4 7 diff --git a/codenet/public_test_cases/p02445/input.1.txt b/codenet/public_test_cases/p02445/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..efe0da53c9e90a018edfaa86cdb988cb00e2b4f9 --- /dev/null +++ b/codenet/public_test_cases/p02445/input.1.txt @@ -0,0 +1,4 @@ +11 +1 2 3 4 5 6 7 8 9 10 11 +1 +1 4 7 diff --git a/codenet/public_test_cases/p02445/output.0.txt b/codenet/public_test_cases/p02445/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab789464e1f732b5d90cddac58349631540901ea --- /dev/null +++ b/codenet/public_test_cases/p02445/output.0.txt @@ -0,0 +1 @@ +1 8 9 10 5 6 7 2 3 4 11 diff --git a/codenet/public_test_cases/p02445/output.1.txt b/codenet/public_test_cases/p02445/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab789464e1f732b5d90cddac58349631540901ea --- /dev/null +++ b/codenet/public_test_cases/p02445/output.1.txt @@ -0,0 +1 @@ +1 8 9 10 5 6 7 2 3 4 11 diff --git a/codenet/public_test_cases/p02446/input.0.txt b/codenet/public_test_cases/p02446/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e568ef14b5f0d9f411328d886e3c9e69c336cb6e --- /dev/null +++ b/codenet/public_test_cases/p02446/input.0.txt @@ -0,0 +1,2 @@ +4 +1 2 2 4 diff --git a/codenet/public_test_cases/p02446/input.1.txt b/codenet/public_test_cases/p02446/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e568ef14b5f0d9f411328d886e3c9e69c336cb6e --- /dev/null +++ b/codenet/public_test_cases/p02446/input.1.txt @@ -0,0 +1,2 @@ +4 +1 2 2 4 diff --git a/codenet/public_test_cases/p02446/output.0.txt b/codenet/public_test_cases/p02446/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b068020d532dbaa5155f4958e1aa943bacc822d --- /dev/null +++ b/codenet/public_test_cases/p02446/output.0.txt @@ -0,0 +1 @@ +1 2 4 diff --git a/codenet/public_test_cases/p02446/output.1.txt b/codenet/public_test_cases/p02446/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b068020d532dbaa5155f4958e1aa943bacc822d --- /dev/null +++ b/codenet/public_test_cases/p02446/output.1.txt @@ -0,0 +1 @@ +1 2 4 diff --git a/codenet/public_test_cases/p02447/input.0.txt b/codenet/public_test_cases/p02447/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d704ef2adfff8e2519240a8a483bbf1a86b157ec --- /dev/null +++ b/codenet/public_test_cases/p02447/input.0.txt @@ -0,0 +1,6 @@ +5 +4 7 +5 5 +2 3 +6 8 +2 1 diff --git a/codenet/public_test_cases/p02447/input.1.txt b/codenet/public_test_cases/p02447/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d704ef2adfff8e2519240a8a483bbf1a86b157ec --- /dev/null +++ b/codenet/public_test_cases/p02447/input.1.txt @@ -0,0 +1,6 @@ +5 +4 7 +5 5 +2 3 +6 8 +2 1 diff --git a/codenet/public_test_cases/p02447/output.0.txt b/codenet/public_test_cases/p02447/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83a086b84108e5505c60424f59dbed4958bdd31b --- /dev/null +++ b/codenet/public_test_cases/p02447/output.0.txt @@ -0,0 +1,5 @@ +2 1 +2 3 +4 7 +5 5 +6 8 diff --git a/codenet/public_test_cases/p02447/output.1.txt b/codenet/public_test_cases/p02447/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83a086b84108e5505c60424f59dbed4958bdd31b --- /dev/null +++ b/codenet/public_test_cases/p02447/output.1.txt @@ -0,0 +1,5 @@ +2 1 +2 3 +4 7 +5 5 +6 8 diff --git a/codenet/public_test_cases/p02448/input.0.txt b/codenet/public_test_cases/p02448/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27244abcda9995ef8cd809094cf9f870e96438f2 --- /dev/null +++ b/codenet/public_test_cases/p02448/input.0.txt @@ -0,0 +1,6 @@ +5 +105 24 C 1500000000000 white +100 23 C 1500000000000 blue +105 23 A 1480000000000 pink +110 25 B 1500000000000 black +110 20 A 1300000000000 gree diff --git a/codenet/public_test_cases/p02448/input.1.txt b/codenet/public_test_cases/p02448/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27244abcda9995ef8cd809094cf9f870e96438f2 --- /dev/null +++ b/codenet/public_test_cases/p02448/input.1.txt @@ -0,0 +1,6 @@ +5 +105 24 C 1500000000000 white +100 23 C 1500000000000 blue +105 23 A 1480000000000 pink +110 25 B 1500000000000 black +110 20 A 1300000000000 gree diff --git a/codenet/public_test_cases/p02448/output.0.txt b/codenet/public_test_cases/p02448/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1afb0b3a09462c8dbf9c827be8dae7bb65e65adb --- /dev/null +++ b/codenet/public_test_cases/p02448/output.0.txt @@ -0,0 +1,5 @@ +100 23 C 1500000000000 blue +105 23 A 1480000000000 pink +105 24 C 1500000000000 white +110 20 A 1300000000000 gree +110 25 B 1500000000000 black diff --git a/codenet/public_test_cases/p02448/output.1.txt b/codenet/public_test_cases/p02448/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1afb0b3a09462c8dbf9c827be8dae7bb65e65adb --- /dev/null +++ b/codenet/public_test_cases/p02448/output.1.txt @@ -0,0 +1,5 @@ +100 23 C 1500000000000 blue +105 23 A 1480000000000 pink +105 24 C 1500000000000 white +110 20 A 1300000000000 gree +110 25 B 1500000000000 black diff --git a/codenet/public_test_cases/p02449/input.0.txt b/codenet/public_test_cases/p02449/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0be9b31f60716a41721b53522fbabb7dd714eee7 --- /dev/null +++ b/codenet/public_test_cases/p02449/input.0.txt @@ -0,0 +1,2 @@ +3 +2 1 3 diff --git a/codenet/public_test_cases/p02449/input.1.txt b/codenet/public_test_cases/p02449/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5898906cc695e2f596c5a2686fef39f0284514c0 --- /dev/null +++ b/codenet/public_test_cases/p02449/input.1.txt @@ -0,0 +1,2 @@ +3 +3 2 1 diff --git a/codenet/public_test_cases/p02449/input.2.txt b/codenet/public_test_cases/p02449/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0be9b31f60716a41721b53522fbabb7dd714eee7 --- /dev/null +++ b/codenet/public_test_cases/p02449/input.2.txt @@ -0,0 +1,2 @@ +3 +2 1 3 diff --git a/codenet/public_test_cases/p02449/output.0.txt b/codenet/public_test_cases/p02449/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c6462b6aedd4114e2be74ea88150c080edfb4fe --- /dev/null +++ b/codenet/public_test_cases/p02449/output.0.txt @@ -0,0 +1,3 @@ +1 3 2 +2 1 3 +2 3 1 diff --git a/codenet/public_test_cases/p02449/output.1.txt b/codenet/public_test_cases/p02449/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03bcc7e37e2ea0193539198a1a5bb95e530b27c0 --- /dev/null +++ b/codenet/public_test_cases/p02449/output.1.txt @@ -0,0 +1,2 @@ +3 1 2 +3 2 1 diff --git a/codenet/public_test_cases/p02449/output.2.txt b/codenet/public_test_cases/p02449/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c6462b6aedd4114e2be74ea88150c080edfb4fe --- /dev/null +++ b/codenet/public_test_cases/p02449/output.2.txt @@ -0,0 +1,3 @@ +1 3 2 +2 1 3 +2 3 1 diff --git a/codenet/public_test_cases/p02450/input.0.txt b/codenet/public_test_cases/p02450/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02450/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02450/input.1.txt b/codenet/public_test_cases/p02450/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02450/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02450/input.2.txt b/codenet/public_test_cases/p02450/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02450/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02450/output.0.txt b/codenet/public_test_cases/p02450/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d9f00ddb91dbfc5fdc768932af0c73af361fb85 --- /dev/null +++ b/codenet/public_test_cases/p02450/output.0.txt @@ -0,0 +1,2 @@ +1 2 +2 1 diff --git a/codenet/public_test_cases/p02450/output.1.txt b/codenet/public_test_cases/p02450/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00495edf01a9bac3ec99beb8d69df1fcdd28bb8a --- /dev/null +++ b/codenet/public_test_cases/p02450/output.1.txt @@ -0,0 +1,6 @@ +1 2 3 +1 3 2 +2 1 3 +2 3 1 +3 1 2 +3 2 1 diff --git a/codenet/public_test_cases/p02450/output.2.txt b/codenet/public_test_cases/p02450/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d9f00ddb91dbfc5fdc768932af0c73af361fb85 --- /dev/null +++ b/codenet/public_test_cases/p02450/output.2.txt @@ -0,0 +1,2 @@ +1 2 +2 1 diff --git a/codenet/public_test_cases/p02451/input.0.txt b/codenet/public_test_cases/p02451/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00072c92633fb1a671d76408f52e6586153e3924 --- /dev/null +++ b/codenet/public_test_cases/p02451/input.0.txt @@ -0,0 +1,6 @@ +4 +1 2 2 4 +3 +2 +3 +5 diff --git a/codenet/public_test_cases/p02451/input.1.txt b/codenet/public_test_cases/p02451/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00072c92633fb1a671d76408f52e6586153e3924 --- /dev/null +++ b/codenet/public_test_cases/p02451/input.1.txt @@ -0,0 +1,6 @@ +4 +1 2 2 4 +3 +2 +3 +5 diff --git a/codenet/public_test_cases/p02451/output.0.txt b/codenet/public_test_cases/p02451/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e22493782f088a61eee427426ee46732c94f5238 --- /dev/null +++ b/codenet/public_test_cases/p02451/output.0.txt @@ -0,0 +1,3 @@ +1 +0 +0 diff --git a/codenet/public_test_cases/p02451/output.1.txt b/codenet/public_test_cases/p02451/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e22493782f088a61eee427426ee46732c94f5238 --- /dev/null +++ b/codenet/public_test_cases/p02451/output.1.txt @@ -0,0 +1,3 @@ +1 +0 +0 diff --git a/codenet/public_test_cases/p02452/input.0.txt b/codenet/public_test_cases/p02452/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee7c78395ecd2689cad6e22228a8b791b5e39cda --- /dev/null +++ b/codenet/public_test_cases/p02452/input.0.txt @@ -0,0 +1,4 @@ +4 +1 2 3 4 +2 +2 4 diff --git a/codenet/public_test_cases/p02452/input.1.txt b/codenet/public_test_cases/p02452/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee7c78395ecd2689cad6e22228a8b791b5e39cda --- /dev/null +++ b/codenet/public_test_cases/p02452/input.1.txt @@ -0,0 +1,4 @@ +4 +1 2 3 4 +2 +2 4 diff --git a/codenet/public_test_cases/p02452/input.2.txt b/codenet/public_test_cases/p02452/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..089d583b38c910c5efd5d9f39db71e5a6c9a47bf --- /dev/null +++ b/codenet/public_test_cases/p02452/input.2.txt @@ -0,0 +1,4 @@ +4 +1 2 3 4 +3 +1 2 5 diff --git a/codenet/public_test_cases/p02452/output.0.txt b/codenet/public_test_cases/p02452/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02452/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02452/output.1.txt b/codenet/public_test_cases/p02452/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02452/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02452/output.2.txt b/codenet/public_test_cases/p02452/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02452/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02453/input.0.txt b/codenet/public_test_cases/p02453/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00072c92633fb1a671d76408f52e6586153e3924 --- /dev/null +++ b/codenet/public_test_cases/p02453/input.0.txt @@ -0,0 +1,6 @@ +4 +1 2 2 4 +3 +2 +3 +5 diff --git a/codenet/public_test_cases/p02453/input.1.txt b/codenet/public_test_cases/p02453/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00072c92633fb1a671d76408f52e6586153e3924 --- /dev/null +++ b/codenet/public_test_cases/p02453/input.1.txt @@ -0,0 +1,6 @@ +4 +1 2 2 4 +3 +2 +3 +5 diff --git a/codenet/public_test_cases/p02453/output.0.txt b/codenet/public_test_cases/p02453/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9364ec4f3096241617749a28040e17145fa03f32 --- /dev/null +++ b/codenet/public_test_cases/p02453/output.0.txt @@ -0,0 +1,3 @@ +1 +3 +4 diff --git a/codenet/public_test_cases/p02453/output.1.txt b/codenet/public_test_cases/p02453/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9364ec4f3096241617749a28040e17145fa03f32 --- /dev/null +++ b/codenet/public_test_cases/p02453/output.1.txt @@ -0,0 +1,3 @@ +1 +3 +4 diff --git a/codenet/public_test_cases/p02454/input.0.txt b/codenet/public_test_cases/p02454/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00072c92633fb1a671d76408f52e6586153e3924 --- /dev/null +++ b/codenet/public_test_cases/p02454/input.0.txt @@ -0,0 +1,6 @@ +4 +1 2 2 4 +3 +2 +3 +5 diff --git a/codenet/public_test_cases/p02454/output.0.txt b/codenet/public_test_cases/p02454/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..060785e2c3dd2fe6a40efc2183304302584645e9 --- /dev/null +++ b/codenet/public_test_cases/p02454/output.0.txt @@ -0,0 +1,3 @@ +1 3 +3 3 +4 4 diff --git a/codenet/public_test_cases/p02455/input.0.txt b/codenet/public_test_cases/p02455/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa2a0d1d56867fbe58117d7cd7f6bf5aa5615f5e --- /dev/null +++ b/codenet/public_test_cases/p02455/input.0.txt @@ -0,0 +1,8 @@ +7 +0 1 +0 2 +0 3 +0 2 +0 4 +1 3 +1 10 diff --git a/codenet/public_test_cases/p02455/input.1.txt b/codenet/public_test_cases/p02455/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa2a0d1d56867fbe58117d7cd7f6bf5aa5615f5e --- /dev/null +++ b/codenet/public_test_cases/p02455/input.1.txt @@ -0,0 +1,8 @@ +7 +0 1 +0 2 +0 3 +0 2 +0 4 +1 3 +1 10 diff --git a/codenet/public_test_cases/p02455/output.0.txt b/codenet/public_test_cases/p02455/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef271b706b841f4fa07a58000a52b2099df53597 --- /dev/null +++ b/codenet/public_test_cases/p02455/output.0.txt @@ -0,0 +1,7 @@ +1 +2 +3 +3 +4 +1 +0 diff --git a/codenet/public_test_cases/p02455/output.1.txt b/codenet/public_test_cases/p02455/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef271b706b841f4fa07a58000a52b2099df53597 --- /dev/null +++ b/codenet/public_test_cases/p02455/output.1.txt @@ -0,0 +1,7 @@ +1 +2 +3 +3 +4 +1 +0 diff --git a/codenet/public_test_cases/p02456/input.0.txt b/codenet/public_test_cases/p02456/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..195aa8b60ad64f55dcbd11509aba8ac066a6c3bc --- /dev/null +++ b/codenet/public_test_cases/p02456/input.0.txt @@ -0,0 +1,9 @@ +8 +0 1 +0 2 +0 3 +2 2 +1 1 +1 2 +1 3 +0 2 diff --git a/codenet/public_test_cases/p02456/input.1.txt b/codenet/public_test_cases/p02456/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..195aa8b60ad64f55dcbd11509aba8ac066a6c3bc --- /dev/null +++ b/codenet/public_test_cases/p02456/input.1.txt @@ -0,0 +1,9 @@ +8 +0 1 +0 2 +0 3 +2 2 +1 1 +1 2 +1 3 +0 2 diff --git a/codenet/public_test_cases/p02456/output.0.txt b/codenet/public_test_cases/p02456/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91f562c3956f759ab67249e3fbda80fd6d1d20db --- /dev/null +++ b/codenet/public_test_cases/p02456/output.0.txt @@ -0,0 +1,7 @@ +1 +2 +3 +1 +0 +1 +3 diff --git a/codenet/public_test_cases/p02456/output.1.txt b/codenet/public_test_cases/p02456/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91f562c3956f759ab67249e3fbda80fd6d1d20db --- /dev/null +++ b/codenet/public_test_cases/p02456/output.1.txt @@ -0,0 +1,7 @@ +1 +2 +3 +1 +0 +1 +3 diff --git a/codenet/public_test_cases/p02457/input.0.txt b/codenet/public_test_cases/p02457/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd38a4384fd162b3034c0e55bc0d95beeb259db0 --- /dev/null +++ b/codenet/public_test_cases/p02457/input.0.txt @@ -0,0 +1,10 @@ +9 +0 1 +0 2 +0 3 +2 2 +1 1 +1 2 +1 3 +0 4 +3 2 4 diff --git a/codenet/public_test_cases/p02457/input.1.txt b/codenet/public_test_cases/p02457/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd38a4384fd162b3034c0e55bc0d95beeb259db0 --- /dev/null +++ b/codenet/public_test_cases/p02457/input.1.txt @@ -0,0 +1,10 @@ +9 +0 1 +0 2 +0 3 +2 2 +1 1 +1 2 +1 3 +0 4 +3 2 4 diff --git a/codenet/public_test_cases/p02457/output.0.txt b/codenet/public_test_cases/p02457/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5042156beb6dc41b5a3433181a759f4b81e0718c --- /dev/null +++ b/codenet/public_test_cases/p02457/output.0.txt @@ -0,0 +1,9 @@ +1 +2 +3 +1 +0 +1 +3 +3 +4 diff --git a/codenet/public_test_cases/p02457/output.1.txt b/codenet/public_test_cases/p02457/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5042156beb6dc41b5a3433181a759f4b81e0718c --- /dev/null +++ b/codenet/public_test_cases/p02457/output.1.txt @@ -0,0 +1,9 @@ +1 +2 +3 +1 +0 +1 +3 +3 +4 diff --git a/codenet/public_test_cases/p02458/input.0.txt b/codenet/public_test_cases/p02458/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..04ef2c247f3122a440710b7022e7a4eec39a892e --- /dev/null +++ b/codenet/public_test_cases/p02458/input.0.txt @@ -0,0 +1,11 @@ +10 +0 1 +0 1 +0 2 +0 3 +2 2 +1 1 +1 2 +1 3 +0 4 +3 1 4 diff --git a/codenet/public_test_cases/p02458/input.1.txt b/codenet/public_test_cases/p02458/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..04ef2c247f3122a440710b7022e7a4eec39a892e --- /dev/null +++ b/codenet/public_test_cases/p02458/input.1.txt @@ -0,0 +1,11 @@ +10 +0 1 +0 1 +0 2 +0 3 +2 2 +1 1 +1 2 +1 3 +0 4 +3 1 4 diff --git a/codenet/public_test_cases/p02458/output.0.txt b/codenet/public_test_cases/p02458/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75d2be8b3280ed0d740a0382da3a3d90c89f0e5f --- /dev/null +++ b/codenet/public_test_cases/p02458/output.0.txt @@ -0,0 +1,12 @@ +1 +2 +3 +4 +2 +0 +1 +4 +1 +1 +3 +4 diff --git a/codenet/public_test_cases/p02458/output.1.txt b/codenet/public_test_cases/p02458/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75d2be8b3280ed0d740a0382da3a3d90c89f0e5f --- /dev/null +++ b/codenet/public_test_cases/p02458/output.1.txt @@ -0,0 +1,12 @@ +1 +2 +3 +4 +2 +0 +1 +4 +1 +1 +3 +4 diff --git a/codenet/public_test_cases/p02459/input.0.txt b/codenet/public_test_cases/p02459/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..51668d21c17d41c2bc4751ed8b0909a32b6f1b4e --- /dev/null +++ b/codenet/public_test_cases/p02459/input.0.txt @@ -0,0 +1,8 @@ +7 +0 blue 4 +0 red 1 +0 white 5 +1 red +1 blue +0 black 8 +1 black diff --git a/codenet/public_test_cases/p02459/input.1.txt b/codenet/public_test_cases/p02459/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51668d21c17d41c2bc4751ed8b0909a32b6f1b4e --- /dev/null +++ b/codenet/public_test_cases/p02459/input.1.txt @@ -0,0 +1,8 @@ +7 +0 blue 4 +0 red 1 +0 white 5 +1 red +1 blue +0 black 8 +1 black diff --git a/codenet/public_test_cases/p02459/output.0.txt b/codenet/public_test_cases/p02459/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7329e00f56d1467133012a2edce5be85a9186f9d --- /dev/null +++ b/codenet/public_test_cases/p02459/output.0.txt @@ -0,0 +1,3 @@ +1 +4 +8 diff --git a/codenet/public_test_cases/p02459/output.1.txt b/codenet/public_test_cases/p02459/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7329e00f56d1467133012a2edce5be85a9186f9d --- /dev/null +++ b/codenet/public_test_cases/p02459/output.1.txt @@ -0,0 +1,3 @@ +1 +4 +8 diff --git a/codenet/public_test_cases/p02460/input.0.txt b/codenet/public_test_cases/p02460/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61882099376b557381600619586ded46f50da7bd --- /dev/null +++ b/codenet/public_test_cases/p02460/input.0.txt @@ -0,0 +1,9 @@ +8 +0 blue 4 +0 red 1 +0 white 5 +1 red +1 blue +2 red +1 black +1 red diff --git a/codenet/public_test_cases/p02460/input.1.txt b/codenet/public_test_cases/p02460/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..61882099376b557381600619586ded46f50da7bd --- /dev/null +++ b/codenet/public_test_cases/p02460/input.1.txt @@ -0,0 +1,9 @@ +8 +0 blue 4 +0 red 1 +0 white 5 +1 red +1 blue +2 red +1 black +1 red diff --git a/codenet/public_test_cases/p02460/output.0.txt b/codenet/public_test_cases/p02460/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e14030f6fabdf382ef47771a51ed220102898be --- /dev/null +++ b/codenet/public_test_cases/p02460/output.0.txt @@ -0,0 +1,4 @@ +1 +4 +0 +0 diff --git a/codenet/public_test_cases/p02460/output.1.txt b/codenet/public_test_cases/p02460/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e14030f6fabdf382ef47771a51ed220102898be --- /dev/null +++ b/codenet/public_test_cases/p02460/output.1.txt @@ -0,0 +1,4 @@ +1 +4 +0 +0 diff --git a/codenet/public_test_cases/p02461/input.0.txt b/codenet/public_test_cases/p02461/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d617ca0fa3276462941285f65120ab608a261d9f --- /dev/null +++ b/codenet/public_test_cases/p02461/input.0.txt @@ -0,0 +1,10 @@ +9 +0 blue 4 +0 red 1 +0 white 5 +1 red +1 blue +2 red +1 black +1 red +3 w z diff --git a/codenet/public_test_cases/p02461/input.1.txt b/codenet/public_test_cases/p02461/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d617ca0fa3276462941285f65120ab608a261d9f --- /dev/null +++ b/codenet/public_test_cases/p02461/input.1.txt @@ -0,0 +1,10 @@ +9 +0 blue 4 +0 red 1 +0 white 5 +1 red +1 blue +2 red +1 black +1 red +3 w z diff --git a/codenet/public_test_cases/p02461/output.0.txt b/codenet/public_test_cases/p02461/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e009fd815f635eeea16c0d4010029ffdbd211ec --- /dev/null +++ b/codenet/public_test_cases/p02461/output.0.txt @@ -0,0 +1,5 @@ +1 +4 +0 +0 +white 5 diff --git a/codenet/public_test_cases/p02461/output.1.txt b/codenet/public_test_cases/p02461/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e009fd815f635eeea16c0d4010029ffdbd211ec --- /dev/null +++ b/codenet/public_test_cases/p02461/output.1.txt @@ -0,0 +1,5 @@ +1 +4 +0 +0 +white 5 diff --git a/codenet/public_test_cases/p02462/input.0.txt b/codenet/public_test_cases/p02462/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7a5a40469509d31485862351d866569f0ce6e03 --- /dev/null +++ b/codenet/public_test_cases/p02462/input.0.txt @@ -0,0 +1,11 @@ +10 +0 blue 6 +0 red 1 +0 blue 4 +0 white 5 +1 red +1 blue +2 red +1 black +1 red +3 w z diff --git a/codenet/public_test_cases/p02462/input.1.txt b/codenet/public_test_cases/p02462/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7a5a40469509d31485862351d866569f0ce6e03 --- /dev/null +++ b/codenet/public_test_cases/p02462/input.1.txt @@ -0,0 +1,11 @@ +10 +0 blue 6 +0 red 1 +0 blue 4 +0 white 5 +1 red +1 blue +2 red +1 black +1 red +3 w z diff --git a/codenet/public_test_cases/p02462/output.0.txt b/codenet/public_test_cases/p02462/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb95edbff89ad8358301c1f4d6e840361e28ea0a --- /dev/null +++ b/codenet/public_test_cases/p02462/output.0.txt @@ -0,0 +1,4 @@ +1 +6 +4 +white 5 diff --git a/codenet/public_test_cases/p02462/output.1.txt b/codenet/public_test_cases/p02462/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb95edbff89ad8358301c1f4d6e840361e28ea0a --- /dev/null +++ b/codenet/public_test_cases/p02462/output.1.txt @@ -0,0 +1,4 @@ +1 +6 +4 +white 5 diff --git a/codenet/public_test_cases/p02463/input.0.txt b/codenet/public_test_cases/p02463/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a6dff977996444563a993a30c481681994c4ae7 --- /dev/null +++ b/codenet/public_test_cases/p02463/input.0.txt @@ -0,0 +1,4 @@ +3 +1 5 8 +2 +5 9 diff --git a/codenet/public_test_cases/p02463/input.1.txt b/codenet/public_test_cases/p02463/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a6dff977996444563a993a30c481681994c4ae7 --- /dev/null +++ b/codenet/public_test_cases/p02463/input.1.txt @@ -0,0 +1,4 @@ +3 +1 5 8 +2 +5 9 diff --git a/codenet/public_test_cases/p02463/output.0.txt b/codenet/public_test_cases/p02463/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..589cf1393bda1fcc45e2183caabd5b3e75b869d9 --- /dev/null +++ b/codenet/public_test_cases/p02463/output.0.txt @@ -0,0 +1,4 @@ +1 +5 +8 +9 diff --git a/codenet/public_test_cases/p02463/output.1.txt b/codenet/public_test_cases/p02463/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..589cf1393bda1fcc45e2183caabd5b3e75b869d9 --- /dev/null +++ b/codenet/public_test_cases/p02463/output.1.txt @@ -0,0 +1,4 @@ +1 +5 +8 +9 diff --git a/codenet/public_test_cases/p02464/input.0.txt b/codenet/public_test_cases/p02464/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2f46d7dd14a847302a123b242661085fadd7455 --- /dev/null +++ b/codenet/public_test_cases/p02464/input.0.txt @@ -0,0 +1,4 @@ +4 +1 2 5 8 +5 +2 3 5 9 11 diff --git a/codenet/public_test_cases/p02464/input.1.txt b/codenet/public_test_cases/p02464/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2f46d7dd14a847302a123b242661085fadd7455 --- /dev/null +++ b/codenet/public_test_cases/p02464/input.1.txt @@ -0,0 +1,4 @@ +4 +1 2 5 8 +5 +2 3 5 9 11 diff --git a/codenet/public_test_cases/p02464/output.0.txt b/codenet/public_test_cases/p02464/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..49ae94bb33c86281c34caecdc96fc1cbb8336fe6 --- /dev/null +++ b/codenet/public_test_cases/p02464/output.0.txt @@ -0,0 +1,2 @@ +2 +5 diff --git a/codenet/public_test_cases/p02464/output.1.txt b/codenet/public_test_cases/p02464/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..49ae94bb33c86281c34caecdc96fc1cbb8336fe6 --- /dev/null +++ b/codenet/public_test_cases/p02464/output.1.txt @@ -0,0 +1,2 @@ +2 +5 diff --git a/codenet/public_test_cases/p02465/input.0.txt b/codenet/public_test_cases/p02465/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1354b529588bd2b7ee4bbf1d34fecb9aee3eef1 --- /dev/null +++ b/codenet/public_test_cases/p02465/input.0.txt @@ -0,0 +1,4 @@ +5 +1 2 3 5 8 +2 +2 5 diff --git a/codenet/public_test_cases/p02465/input.1.txt b/codenet/public_test_cases/p02465/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1354b529588bd2b7ee4bbf1d34fecb9aee3eef1 --- /dev/null +++ b/codenet/public_test_cases/p02465/input.1.txt @@ -0,0 +1,4 @@ +5 +1 2 3 5 8 +2 +2 5 diff --git a/codenet/public_test_cases/p02465/output.0.txt b/codenet/public_test_cases/p02465/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d0c016c00625ce5df85e7dba0d23122a2826163 --- /dev/null +++ b/codenet/public_test_cases/p02465/output.0.txt @@ -0,0 +1,3 @@ +1 +3 +8 diff --git a/codenet/public_test_cases/p02465/output.1.txt b/codenet/public_test_cases/p02465/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d0c016c00625ce5df85e7dba0d23122a2826163 --- /dev/null +++ b/codenet/public_test_cases/p02465/output.1.txt @@ -0,0 +1,3 @@ +1 +3 +8 diff --git a/codenet/public_test_cases/p02466/input.0.txt b/codenet/public_test_cases/p02466/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23446a5f02d5d2d43e6e7741b3b1793381863376 --- /dev/null +++ b/codenet/public_test_cases/p02466/input.0.txt @@ -0,0 +1,4 @@ +7 +1 2 3 4 5 6 7 +4 +2 4 6 8 diff --git a/codenet/public_test_cases/p02466/input.1.txt b/codenet/public_test_cases/p02466/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..23446a5f02d5d2d43e6e7741b3b1793381863376 --- /dev/null +++ b/codenet/public_test_cases/p02466/input.1.txt @@ -0,0 +1,4 @@ +7 +1 2 3 4 5 6 7 +4 +2 4 6 8 diff --git a/codenet/public_test_cases/p02466/output.0.txt b/codenet/public_test_cases/p02466/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6cf4116dc3cb323632207fc3e5f091d2a53e646 --- /dev/null +++ b/codenet/public_test_cases/p02466/output.0.txt @@ -0,0 +1,5 @@ +1 +3 +5 +7 +8 diff --git a/codenet/public_test_cases/p02466/output.1.txt b/codenet/public_test_cases/p02466/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6cf4116dc3cb323632207fc3e5f091d2a53e646 --- /dev/null +++ b/codenet/public_test_cases/p02466/output.1.txt @@ -0,0 +1,5 @@ +1 +3 +5 +7 +8 diff --git a/codenet/public_test_cases/p02467/input.0.txt b/codenet/public_test_cases/p02467/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02467/input.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02467/input.1.txt b/codenet/public_test_cases/p02467/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02467/input.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02467/input.2.txt b/codenet/public_test_cases/p02467/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a3e7b0422507efb9694c02c3266b4220b3c37ff --- /dev/null +++ b/codenet/public_test_cases/p02467/input.2.txt @@ -0,0 +1 @@ +126 diff --git a/codenet/public_test_cases/p02467/output.0.txt b/codenet/public_test_cases/p02467/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02bb268fd9e74b891cedd9615bac2ebd6ab9d5e5 --- /dev/null +++ b/codenet/public_test_cases/p02467/output.0.txt @@ -0,0 +1 @@ +12: 2 2 3 diff --git a/codenet/public_test_cases/p02467/output.1.txt b/codenet/public_test_cases/p02467/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..02bb268fd9e74b891cedd9615bac2ebd6ab9d5e5 --- /dev/null +++ b/codenet/public_test_cases/p02467/output.1.txt @@ -0,0 +1 @@ +12: 2 2 3 diff --git a/codenet/public_test_cases/p02467/output.2.txt b/codenet/public_test_cases/p02467/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..554fa905e1a0a2c52f4f922a7875e94a43a02de5 --- /dev/null +++ b/codenet/public_test_cases/p02467/output.2.txt @@ -0,0 +1 @@ +126: 2 3 3 7 diff --git a/codenet/public_test_cases/p02468/input.0.txt b/codenet/public_test_cases/p02468/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02468/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02468/input.1.txt b/codenet/public_test_cases/p02468/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02468/input.1.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02468/input.2.txt b/codenet/public_test_cases/p02468/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02468/input.2.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02468/output.0.txt b/codenet/public_test_cases/p02468/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02468/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02468/output.1.txt b/codenet/public_test_cases/p02468/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02468/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02468/output.2.txt b/codenet/public_test_cases/p02468/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0801866ceec8d5e849405827fb7662c6ec405123 --- /dev/null +++ b/codenet/public_test_cases/p02468/output.2.txt @@ -0,0 +1 @@ +390625 diff --git a/codenet/public_test_cases/p02469/input.0.txt b/codenet/public_test_cases/p02469/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..07a82d02f93d87ba5fc789af1ef2812c15472de6 --- /dev/null +++ b/codenet/public_test_cases/p02469/input.0.txt @@ -0,0 +1,2 @@ +3 +3 4 6 diff --git a/codenet/public_test_cases/p02469/input.1.txt b/codenet/public_test_cases/p02469/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceea5c44b1c42c39160f515f8d879033b43ed628 --- /dev/null +++ b/codenet/public_test_cases/p02469/input.1.txt @@ -0,0 +1,2 @@ +4 +1 2 3 5 diff --git a/codenet/public_test_cases/p02469/input.2.txt b/codenet/public_test_cases/p02469/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..07a82d02f93d87ba5fc789af1ef2812c15472de6 --- /dev/null +++ b/codenet/public_test_cases/p02469/input.2.txt @@ -0,0 +1,2 @@ +3 +3 4 6 diff --git a/codenet/public_test_cases/p02469/output.0.txt b/codenet/public_test_cases/p02469/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02469/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02469/output.1.txt b/codenet/public_test_cases/p02469/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p02469/output.1.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p02469/output.2.txt b/codenet/public_test_cases/p02469/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02469/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02470/input.0.txt b/codenet/public_test_cases/p02470/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02470/input.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02470/input.1.txt b/codenet/public_test_cases/p02470/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..749fce669df1b51cae4a71dc130b2a14807829f0 --- /dev/null +++ b/codenet/public_test_cases/p02470/input.1.txt @@ -0,0 +1 @@ +1000000 diff --git a/codenet/public_test_cases/p02470/input.2.txt b/codenet/public_test_cases/p02470/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02470/input.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02470/output.0.txt b/codenet/public_test_cases/p02470/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02470/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02470/output.1.txt b/codenet/public_test_cases/p02470/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..004d15285e7271daae908ab07bd461bf160399e3 --- /dev/null +++ b/codenet/public_test_cases/p02470/output.1.txt @@ -0,0 +1 @@ +400000 diff --git a/codenet/public_test_cases/p02470/output.2.txt b/codenet/public_test_cases/p02470/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02470/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02471/input.0.txt b/codenet/public_test_cases/p02471/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e18a59c6f617145ff60c20773faa83e86c12ffe --- /dev/null +++ b/codenet/public_test_cases/p02471/input.0.txt @@ -0,0 +1 @@ +4 12 diff --git a/codenet/public_test_cases/p02471/input.1.txt b/codenet/public_test_cases/p02471/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2dc2f56a9bc897dbf64266196e6173cc2a98edf --- /dev/null +++ b/codenet/public_test_cases/p02471/input.1.txt @@ -0,0 +1 @@ +3 8 diff --git a/codenet/public_test_cases/p02471/input.2.txt b/codenet/public_test_cases/p02471/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e18a59c6f617145ff60c20773faa83e86c12ffe --- /dev/null +++ b/codenet/public_test_cases/p02471/input.2.txt @@ -0,0 +1 @@ +4 12 diff --git a/codenet/public_test_cases/p02471/output.0.txt b/codenet/public_test_cases/p02471/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80c0cc79aabb27a7894c5795860fa87c6473f004 --- /dev/null +++ b/codenet/public_test_cases/p02471/output.0.txt @@ -0,0 +1 @@ +1 0 diff --git a/codenet/public_test_cases/p02471/output.1.txt b/codenet/public_test_cases/p02471/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..786d61b8a9512231d67746a19a63f880f88d39ea --- /dev/null +++ b/codenet/public_test_cases/p02471/output.1.txt @@ -0,0 +1 @@ +3 -1 diff --git a/codenet/public_test_cases/p02471/output.2.txt b/codenet/public_test_cases/p02471/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..80c0cc79aabb27a7894c5795860fa87c6473f004 --- /dev/null +++ b/codenet/public_test_cases/p02471/output.2.txt @@ -0,0 +1 @@ +1 0 diff --git a/codenet/public_test_cases/p02472/input.0.txt b/codenet/public_test_cases/p02472/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02472/input.0.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02472/input.1.txt b/codenet/public_test_cases/p02472/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02472/input.1.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02472/output.0.txt b/codenet/public_test_cases/p02472/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02472/output.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02472/output.1.txt b/codenet/public_test_cases/p02472/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02472/output.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02473/input.0.txt b/codenet/public_test_cases/p02473/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02473/input.0.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02473/input.1.txt b/codenet/public_test_cases/p02473/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02473/input.1.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02473/output.0.txt b/codenet/public_test_cases/p02473/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a83d1d524c8bb033d6d2bc907474dbebd8b57b72 --- /dev/null +++ b/codenet/public_test_cases/p02473/output.0.txt @@ -0,0 +1 @@ +-3 diff --git a/codenet/public_test_cases/p02473/output.1.txt b/codenet/public_test_cases/p02473/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a83d1d524c8bb033d6d2bc907474dbebd8b57b72 --- /dev/null +++ b/codenet/public_test_cases/p02473/output.1.txt @@ -0,0 +1 @@ +-3 diff --git a/codenet/public_test_cases/p02474/input.0.txt b/codenet/public_test_cases/p02474/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02474/input.0.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02474/input.1.txt b/codenet/public_test_cases/p02474/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02474/input.1.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02474/output.0.txt b/codenet/public_test_cases/p02474/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p02474/output.0.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p02474/output.1.txt b/codenet/public_test_cases/p02474/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p02474/output.1.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p02475/input.0.txt b/codenet/public_test_cases/p02475/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02475/input.0.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02475/input.1.txt b/codenet/public_test_cases/p02475/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02475/input.1.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02475/output.0.txt b/codenet/public_test_cases/p02475/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02475/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02475/output.1.txt b/codenet/public_test_cases/p02475/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02475/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02476/input.0.txt b/codenet/public_test_cases/p02476/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02476/input.0.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02476/input.1.txt b/codenet/public_test_cases/p02476/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02476/input.1.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02476/output.0.txt b/codenet/public_test_cases/p02476/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02476/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02476/output.1.txt b/codenet/public_test_cases/p02476/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02476/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02477/input.0.txt b/codenet/public_test_cases/p02477/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02477/input.0.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02477/input.1.txt b/codenet/public_test_cases/p02477/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1dc547ae1e6af058132b0452c42d35102e2e7f3 --- /dev/null +++ b/codenet/public_test_cases/p02477/input.1.txt @@ -0,0 +1 @@ +5 8 diff --git a/codenet/public_test_cases/p02477/output.0.txt b/codenet/public_test_cases/p02477/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p02477/output.0.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p02477/output.1.txt b/codenet/public_test_cases/p02477/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p02477/output.1.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p02534/input.0.txt b/codenet/public_test_cases/p02534/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02534/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02534/input.1.txt b/codenet/public_test_cases/p02534/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02534/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02534/output.0.txt b/codenet/public_test_cases/p02534/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..096ff35b12d6205287637a719d8df1d394f9b821 --- /dev/null +++ b/codenet/public_test_cases/p02534/output.0.txt @@ -0,0 +1 @@ +ACLACLACL diff --git a/codenet/public_test_cases/p02534/output.1.txt b/codenet/public_test_cases/p02534/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..096ff35b12d6205287637a719d8df1d394f9b821 --- /dev/null +++ b/codenet/public_test_cases/p02534/output.1.txt @@ -0,0 +1 @@ +ACLACLACL diff --git a/codenet/public_test_cases/p02535/input.0.txt b/codenet/public_test_cases/p02535/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a8079f47749f8bb89adb7679e839de5d5849a4c --- /dev/null +++ b/codenet/public_test_cases/p02535/input.0.txt @@ -0,0 +1 @@ +10 30 20 40 diff --git a/codenet/public_test_cases/p02535/output.0.txt b/codenet/public_test_cases/p02535/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02535/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02536/input.0.txt b/codenet/public_test_cases/p02536/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fa34b26edbf5a028e89c0ad87b196b184ac114a --- /dev/null +++ b/codenet/public_test_cases/p02536/input.0.txt @@ -0,0 +1,2 @@ +3 1 +1 2 diff --git a/codenet/public_test_cases/p02536/input.1.txt b/codenet/public_test_cases/p02536/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fa34b26edbf5a028e89c0ad87b196b184ac114a --- /dev/null +++ b/codenet/public_test_cases/p02536/input.1.txt @@ -0,0 +1,2 @@ +3 1 +1 2 diff --git a/codenet/public_test_cases/p02536/output.0.txt b/codenet/public_test_cases/p02536/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02536/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02536/output.1.txt b/codenet/public_test_cases/p02536/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02536/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02537/input.0.txt b/codenet/public_test_cases/p02537/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a7f469b1bfbc3c691c9f0e27cb03f9a38bb09ad --- /dev/null +++ b/codenet/public_test_cases/p02537/input.0.txt @@ -0,0 +1,11 @@ +10 3 +1 +5 +4 +3 +8 +6 +9 +7 +2 +4 diff --git a/codenet/public_test_cases/p02537/input.1.txt b/codenet/public_test_cases/p02537/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a7f469b1bfbc3c691c9f0e27cb03f9a38bb09ad --- /dev/null +++ b/codenet/public_test_cases/p02537/input.1.txt @@ -0,0 +1,11 @@ +10 3 +1 +5 +4 +3 +8 +6 +9 +7 +2 +4 diff --git a/codenet/public_test_cases/p02537/output.0.txt b/codenet/public_test_cases/p02537/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02537/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02537/output.1.txt b/codenet/public_test_cases/p02537/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02537/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02538/input.0.txt b/codenet/public_test_cases/p02538/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d3dc7f09dd44360571514c012f0db944a5a3a64 --- /dev/null +++ b/codenet/public_test_cases/p02538/input.0.txt @@ -0,0 +1,6 @@ +8 5 +3 6 2 +1 4 7 +3 8 3 +2 2 2 +4 5 1 diff --git a/codenet/public_test_cases/p02538/input.1.txt b/codenet/public_test_cases/p02538/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d3dc7f09dd44360571514c012f0db944a5a3a64 --- /dev/null +++ b/codenet/public_test_cases/p02538/input.1.txt @@ -0,0 +1,6 @@ +8 5 +3 6 2 +1 4 7 +3 8 3 +2 2 2 +4 5 1 diff --git a/codenet/public_test_cases/p02538/input.2.txt b/codenet/public_test_cases/p02538/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbe0cdfb4feb57098175a78e639bfff43ae54b7f --- /dev/null +++ b/codenet/public_test_cases/p02538/input.2.txt @@ -0,0 +1,2 @@ +200000 1 +123 456 7 diff --git a/codenet/public_test_cases/p02538/output.0.txt b/codenet/public_test_cases/p02538/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..46f9c8c84cee92685e088f4e84b2a96ffbc6c484 --- /dev/null +++ b/codenet/public_test_cases/p02538/output.0.txt @@ -0,0 +1,5 @@ +11222211 +77772211 +77333333 +72333333 +72311333 diff --git a/codenet/public_test_cases/p02538/output.1.txt b/codenet/public_test_cases/p02538/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46f9c8c84cee92685e088f4e84b2a96ffbc6c484 --- /dev/null +++ b/codenet/public_test_cases/p02538/output.1.txt @@ -0,0 +1,5 @@ +11222211 +77772211 +77333333 +72333333 +72311333 diff --git a/codenet/public_test_cases/p02538/output.2.txt b/codenet/public_test_cases/p02538/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..25b4043227ecb3c0ffff670102c0992bd1e6845a --- /dev/null +++ b/codenet/public_test_cases/p02538/output.2.txt @@ -0,0 +1 @@ +641437905 diff --git a/codenet/public_test_cases/p02539/input.0.txt b/codenet/public_test_cases/p02539/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aa43e67cd6844ea03f0c04b54e061e874e8aaf6 --- /dev/null +++ b/codenet/public_test_cases/p02539/input.0.txt @@ -0,0 +1,5 @@ +2 +1 +1 +2 +3 diff --git a/codenet/public_test_cases/p02539/input.1.txt b/codenet/public_test_cases/p02539/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aa43e67cd6844ea03f0c04b54e061e874e8aaf6 --- /dev/null +++ b/codenet/public_test_cases/p02539/input.1.txt @@ -0,0 +1,5 @@ +2 +1 +1 +2 +3 diff --git a/codenet/public_test_cases/p02539/input.2.txt b/codenet/public_test_cases/p02539/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6ee220bdd6579328c53d76c35d0ab239534910b --- /dev/null +++ b/codenet/public_test_cases/p02539/input.2.txt @@ -0,0 +1,11 @@ +5 +30 +10 +20 +40 +20 +10 +10 +30 +50 +60 diff --git a/codenet/public_test_cases/p02539/output.0.txt b/codenet/public_test_cases/p02539/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02539/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02539/output.1.txt b/codenet/public_test_cases/p02539/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02539/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02539/output.2.txt b/codenet/public_test_cases/p02539/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c599d4ff3cb498803c345b49db70fca22e8ba41 --- /dev/null +++ b/codenet/public_test_cases/p02539/output.2.txt @@ -0,0 +1 @@ +516 diff --git a/codenet/public_test_cases/p02540/input.0.txt b/codenet/public_test_cases/p02540/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a366812ca5d74b6a84ca6d2ee634d98cec63357 --- /dev/null +++ b/codenet/public_test_cases/p02540/input.0.txt @@ -0,0 +1,5 @@ +4 +1 4 +2 3 +3 1 +4 2 diff --git a/codenet/public_test_cases/p02540/input.1.txt b/codenet/public_test_cases/p02540/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aec303625b8995034bb889c5211593143879f892 --- /dev/null +++ b/codenet/public_test_cases/p02540/input.1.txt @@ -0,0 +1,8 @@ +7 +6 4 +4 3 +3 5 +7 1 +2 7 +5 2 +1 6 diff --git a/codenet/public_test_cases/p02540/input.2.txt b/codenet/public_test_cases/p02540/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a366812ca5d74b6a84ca6d2ee634d98cec63357 --- /dev/null +++ b/codenet/public_test_cases/p02540/input.2.txt @@ -0,0 +1,5 @@ +4 +1 4 +2 3 +3 1 +4 2 diff --git a/codenet/public_test_cases/p02540/output.0.txt b/codenet/public_test_cases/p02540/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be589c9ceb00f0f5aa61730e4a70bd0730c8b26d --- /dev/null +++ b/codenet/public_test_cases/p02540/output.0.txt @@ -0,0 +1,4 @@ +1 +1 +2 +2 diff --git a/codenet/public_test_cases/p02540/output.1.txt b/codenet/public_test_cases/p02540/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab08f87b5a9b26bbe24f2d88fca78b325ae3fcc5 --- /dev/null +++ b/codenet/public_test_cases/p02540/output.1.txt @@ -0,0 +1,7 @@ +3 +3 +1 +1 +2 +3 +2 diff --git a/codenet/public_test_cases/p02540/output.2.txt b/codenet/public_test_cases/p02540/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..be589c9ceb00f0f5aa61730e4a70bd0730c8b26d --- /dev/null +++ b/codenet/public_test_cases/p02540/output.2.txt @@ -0,0 +1,4 @@ +1 +1 +2 +2 diff --git a/codenet/public_test_cases/p02541/input.0.txt b/codenet/public_test_cases/p02541/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02541/input.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02541/input.1.txt b/codenet/public_test_cases/p02541/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2225e4604f0ff9e2f582da229ed79355155ccb64 --- /dev/null +++ b/codenet/public_test_cases/p02541/input.1.txt @@ -0,0 +1 @@ +20200920 diff --git a/codenet/public_test_cases/p02541/input.2.txt b/codenet/public_test_cases/p02541/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02541/input.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02541/output.0.txt b/codenet/public_test_cases/p02541/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02541/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02541/output.1.txt b/codenet/public_test_cases/p02541/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f3df35d0496219dfa2de1028ac39ab4b752130e --- /dev/null +++ b/codenet/public_test_cases/p02541/output.1.txt @@ -0,0 +1 @@ +1100144 diff --git a/codenet/public_test_cases/p02541/output.2.txt b/codenet/public_test_cases/p02541/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02541/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02542/input.0.txt b/codenet/public_test_cases/p02542/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..84cf4d9893ac0190bf9358399551b8ad200a9ad2 --- /dev/null +++ b/codenet/public_test_cases/p02542/input.0.txt @@ -0,0 +1,4 @@ +3 3 +o.. +... +o.# diff --git a/codenet/public_test_cases/p02542/output.0.txt b/codenet/public_test_cases/p02542/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02542/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02543/input.0.txt b/codenet/public_test_cases/p02543/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80e8165e025ede8638cb4dda0b1f2e7cb58460da --- /dev/null +++ b/codenet/public_test_cases/p02543/input.0.txt @@ -0,0 +1,5 @@ +5 3 +1 2 4 7 8 +2 +1 5 +1 2 diff --git a/codenet/public_test_cases/p02543/input.1.txt b/codenet/public_test_cases/p02543/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..80e8165e025ede8638cb4dda0b1f2e7cb58460da --- /dev/null +++ b/codenet/public_test_cases/p02543/input.1.txt @@ -0,0 +1,5 @@ +5 3 +1 2 4 7 8 +2 +1 5 +1 2 diff --git a/codenet/public_test_cases/p02543/input.2.txt b/codenet/public_test_cases/p02543/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..66cd5a96d26dfcbb0aeae46bd1c78b14a4e93db0 --- /dev/null +++ b/codenet/public_test_cases/p02543/input.2.txt @@ -0,0 +1,8 @@ +15 220492538 +4452279 12864090 23146757 31318558 133073771 141315707 263239555 350278176 401243954 418305779 450172439 560311491 625900495 626194585 891960194 +5 +6 14 +1 8 +1 13 +7 12 +4 12 diff --git a/codenet/public_test_cases/p02543/output.0.txt b/codenet/public_test_cases/p02543/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc7fa75e6a7bc42f0431e7fa75b59e3ddc4dc40f --- /dev/null +++ b/codenet/public_test_cases/p02543/output.0.txt @@ -0,0 +1,2 @@ +4 +2 diff --git a/codenet/public_test_cases/p02543/output.1.txt b/codenet/public_test_cases/p02543/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc7fa75e6a7bc42f0431e7fa75b59e3ddc4dc40f --- /dev/null +++ b/codenet/public_test_cases/p02543/output.1.txt @@ -0,0 +1,2 @@ +4 +2 diff --git a/codenet/public_test_cases/p02543/output.2.txt b/codenet/public_test_cases/p02543/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3470920dda4eb1dd90f80ddd8f43a32ab77028e --- /dev/null +++ b/codenet/public_test_cases/p02543/output.2.txt @@ -0,0 +1,5 @@ +4 +6 +11 +2 +3 diff --git a/codenet/public_test_cases/p02544/input.0.txt b/codenet/public_test_cases/p02544/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9449aaf96205d69e1287aa4d54e666c05b1e25a1 --- /dev/null +++ b/codenet/public_test_cases/p02544/input.0.txt @@ -0,0 +1,2 @@ +3 2 +1 2 3 diff --git a/codenet/public_test_cases/p02544/input.1.txt b/codenet/public_test_cases/p02544/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..16959ef766e542aa6daf68f4d2dd8ab700543f08 --- /dev/null +++ b/codenet/public_test_cases/p02544/input.1.txt @@ -0,0 +1,2 @@ +10 3 +1 8 4 9 2 3 7 10 5 6 diff --git a/codenet/public_test_cases/p02544/input.2.txt b/codenet/public_test_cases/p02544/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9449aaf96205d69e1287aa4d54e666c05b1e25a1 --- /dev/null +++ b/codenet/public_test_cases/p02544/input.2.txt @@ -0,0 +1,2 @@ +3 2 +1 2 3 diff --git a/codenet/public_test_cases/p02544/output.0.txt b/codenet/public_test_cases/p02544/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02544/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02544/output.1.txt b/codenet/public_test_cases/p02544/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2e0f6c70ad5283445fe3db9e66d777aafdbbcd4 --- /dev/null +++ b/codenet/public_test_cases/p02544/output.1.txt @@ -0,0 +1 @@ +164091855 diff --git a/codenet/public_test_cases/p02544/output.2.txt b/codenet/public_test_cases/p02544/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02544/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02545/input.0.txt b/codenet/public_test_cases/p02545/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8ec0ae0835334ca6ab9d606d4abba8ae981f2a6 --- /dev/null +++ b/codenet/public_test_cases/p02545/input.0.txt @@ -0,0 +1,3 @@ +3 +2 3 1 1 3 2 2 1 3 +1 2 2 3 1 2 3 1 3 diff --git a/codenet/public_test_cases/p02545/input.1.txt b/codenet/public_test_cases/p02545/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3796e122a0be0d3a99e6694d69680e57f891410d --- /dev/null +++ b/codenet/public_test_cases/p02545/input.1.txt @@ -0,0 +1,3 @@ +8 +3 6 7 5 4 8 4 1 1 3 8 7 3 8 2 4 7 5 2 2 6 5 6 1 +7 5 8 1 3 6 7 5 4 8 1 3 3 8 2 4 2 6 5 6 1 4 7 2 diff --git a/codenet/public_test_cases/p02545/input.2.txt b/codenet/public_test_cases/p02545/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..319d16cebf73cb6806d8d432bbeeb4513bc8ea3c --- /dev/null +++ b/codenet/public_test_cases/p02545/input.2.txt @@ -0,0 +1,3 @@ +3 +1 1 1 2 2 2 3 3 3 +1 1 1 2 2 2 3 3 3 diff --git a/codenet/public_test_cases/p02545/input.3.txt b/codenet/public_test_cases/p02545/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..933263088c29f5b66dd70e7fecddd1dab02eda51 --- /dev/null +++ b/codenet/public_test_cases/p02545/input.3.txt @@ -0,0 +1,3 @@ +3 +2 3 3 1 1 1 2 2 3 +3 2 2 1 1 1 3 3 2 diff --git a/codenet/public_test_cases/p02545/input.4.txt b/codenet/public_test_cases/p02545/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8ec0ae0835334ca6ab9d606d4abba8ae981f2a6 --- /dev/null +++ b/codenet/public_test_cases/p02545/input.4.txt @@ -0,0 +1,3 @@ +3 +2 3 1 1 3 2 2 1 3 +1 2 2 3 1 2 3 1 3 diff --git a/codenet/public_test_cases/p02545/output.0.txt b/codenet/public_test_cases/p02545/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02545/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02545/output.1.txt b/codenet/public_test_cases/p02545/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02545/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02545/output.2.txt b/codenet/public_test_cases/p02545/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02545/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02545/output.3.txt b/codenet/public_test_cases/p02545/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02545/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02545/output.4.txt b/codenet/public_test_cases/p02545/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02545/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02546/input.0.txt b/codenet/public_test_cases/p02546/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c479defff9a675f4fa1a8867096d90733e9b769 --- /dev/null +++ b/codenet/public_test_cases/p02546/input.0.txt @@ -0,0 +1 @@ +apple diff --git a/codenet/public_test_cases/p02546/input.1.txt b/codenet/public_test_cases/p02546/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d591a2710eb6ec0dc090ed021171bc58abca0f95 --- /dev/null +++ b/codenet/public_test_cases/p02546/input.1.txt @@ -0,0 +1 @@ +box diff --git a/codenet/public_test_cases/p02546/input.2.txt b/codenet/public_test_cases/p02546/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed6e126068cc48b735c064bb3b4bea2e6d375cd3 --- /dev/null +++ b/codenet/public_test_cases/p02546/input.2.txt @@ -0,0 +1 @@ +bus diff --git a/codenet/public_test_cases/p02546/input.3.txt b/codenet/public_test_cases/p02546/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c479defff9a675f4fa1a8867096d90733e9b769 --- /dev/null +++ b/codenet/public_test_cases/p02546/input.3.txt @@ -0,0 +1 @@ +apple diff --git a/codenet/public_test_cases/p02546/output.0.txt b/codenet/public_test_cases/p02546/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..950a188f0a4224ce6a1ac710915113df972aeb2c --- /dev/null +++ b/codenet/public_test_cases/p02546/output.0.txt @@ -0,0 +1 @@ +apples diff --git a/codenet/public_test_cases/p02546/output.1.txt b/codenet/public_test_cases/p02546/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0b529c6f76d39fe759149211f4aaa19cb63617e --- /dev/null +++ b/codenet/public_test_cases/p02546/output.1.txt @@ -0,0 +1 @@ +boxs diff --git a/codenet/public_test_cases/p02546/output.2.txt b/codenet/public_test_cases/p02546/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..761d4e721025b5b6af56133516179ae9847da803 --- /dev/null +++ b/codenet/public_test_cases/p02546/output.2.txt @@ -0,0 +1 @@ +buses diff --git a/codenet/public_test_cases/p02546/output.3.txt b/codenet/public_test_cases/p02546/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..950a188f0a4224ce6a1ac710915113df972aeb2c --- /dev/null +++ b/codenet/public_test_cases/p02546/output.3.txt @@ -0,0 +1 @@ +apples diff --git a/codenet/public_test_cases/p02547/input.0.txt b/codenet/public_test_cases/p02547/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f50c4522d6e546982bf647273182b6f255d7a864 --- /dev/null +++ b/codenet/public_test_cases/p02547/input.0.txt @@ -0,0 +1,6 @@ +5 +1 2 +6 6 +4 4 +3 3 +3 2 diff --git a/codenet/public_test_cases/p02547/input.1.txt b/codenet/public_test_cases/p02547/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f50c4522d6e546982bf647273182b6f255d7a864 --- /dev/null +++ b/codenet/public_test_cases/p02547/input.1.txt @@ -0,0 +1,6 @@ +5 +1 2 +6 6 +4 4 +3 3 +3 2 diff --git a/codenet/public_test_cases/p02547/input.2.txt b/codenet/public_test_cases/p02547/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1fb63f445c2e234b47891e6546af071217b5e09 --- /dev/null +++ b/codenet/public_test_cases/p02547/input.2.txt @@ -0,0 +1,6 @@ +5 +1 1 +2 2 +3 4 +5 5 +6 6 diff --git a/codenet/public_test_cases/p02547/input.3.txt b/codenet/public_test_cases/p02547/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..21aedd71cae12ea6d6292daf21a88790d9e7dfe9 --- /dev/null +++ b/codenet/public_test_cases/p02547/input.3.txt @@ -0,0 +1,7 @@ +6 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 diff --git a/codenet/public_test_cases/p02547/output.0.txt b/codenet/public_test_cases/p02547/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02547/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02547/output.1.txt b/codenet/public_test_cases/p02547/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02547/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02547/output.2.txt b/codenet/public_test_cases/p02547/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02547/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02547/output.3.txt b/codenet/public_test_cases/p02547/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02547/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02548/input.0.txt b/codenet/public_test_cases/p02548/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02548/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02548/input.1.txt b/codenet/public_test_cases/p02548/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02548/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02548/input.2.txt b/codenet/public_test_cases/p02548/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02548/input.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02548/input.3.txt b/codenet/public_test_cases/p02548/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..749fce669df1b51cae4a71dc130b2a14807829f0 --- /dev/null +++ b/codenet/public_test_cases/p02548/input.3.txt @@ -0,0 +1 @@ +1000000 diff --git a/codenet/public_test_cases/p02548/output.0.txt b/codenet/public_test_cases/p02548/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02548/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02548/output.1.txt b/codenet/public_test_cases/p02548/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02548/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02548/output.2.txt b/codenet/public_test_cases/p02548/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8410b8b89123a6fa77d0dfac8be2229a34566ff8 --- /dev/null +++ b/codenet/public_test_cases/p02548/output.2.txt @@ -0,0 +1 @@ +473 diff --git a/codenet/public_test_cases/p02548/output.3.txt b/codenet/public_test_cases/p02548/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3f26f7758595569dfef7569f0308fc3f74b0d85 --- /dev/null +++ b/codenet/public_test_cases/p02548/output.3.txt @@ -0,0 +1 @@ +13969985 diff --git a/codenet/public_test_cases/p02549/input.0.txt b/codenet/public_test_cases/p02549/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c96b242cd0f7516fd5324e78b09f967d7333345 --- /dev/null +++ b/codenet/public_test_cases/p02549/input.0.txt @@ -0,0 +1,3 @@ +5 2 +1 1 +3 4 diff --git a/codenet/public_test_cases/p02549/input.1.txt b/codenet/public_test_cases/p02549/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd075171a1be594ad0312e0a2541f1b1b5e0740d --- /dev/null +++ b/codenet/public_test_cases/p02549/input.1.txt @@ -0,0 +1,3 @@ +5 2 +3 3 +5 5 diff --git a/codenet/public_test_cases/p02549/input.2.txt b/codenet/public_test_cases/p02549/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3c7fe7e3f23ecf11ebd912c3b48e86f9b11da99 --- /dev/null +++ b/codenet/public_test_cases/p02549/input.2.txt @@ -0,0 +1,2 @@ +5 1 +1 2 diff --git a/codenet/public_test_cases/p02549/input.3.txt b/codenet/public_test_cases/p02549/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b25f9960f7a9102e9541b40e699433f267c09f9 --- /dev/null +++ b/codenet/public_test_cases/p02549/input.3.txt @@ -0,0 +1,4 @@ +60 3 +5 8 +1 3 +10 15 diff --git a/codenet/public_test_cases/p02549/input.4.txt b/codenet/public_test_cases/p02549/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c96b242cd0f7516fd5324e78b09f967d7333345 --- /dev/null +++ b/codenet/public_test_cases/p02549/input.4.txt @@ -0,0 +1,3 @@ +5 2 +1 1 +3 4 diff --git a/codenet/public_test_cases/p02549/output.0.txt b/codenet/public_test_cases/p02549/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02549/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02549/output.1.txt b/codenet/public_test_cases/p02549/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02549/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02549/output.2.txt b/codenet/public_test_cases/p02549/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02549/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02549/output.3.txt b/codenet/public_test_cases/p02549/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a54bc1a9e13ec497c7a61f92455db2ca71788d4 --- /dev/null +++ b/codenet/public_test_cases/p02549/output.3.txt @@ -0,0 +1 @@ +221823067 diff --git a/codenet/public_test_cases/p02549/output.4.txt b/codenet/public_test_cases/p02549/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02549/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02550/input.0.txt b/codenet/public_test_cases/p02550/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2acecf8937607729955f37b0f013a39512313e0e --- /dev/null +++ b/codenet/public_test_cases/p02550/input.0.txt @@ -0,0 +1 @@ +6 2 1001 diff --git a/codenet/public_test_cases/p02550/input.1.txt b/codenet/public_test_cases/p02550/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0973d52018a59c1f55a04bf20087b3f6c676811b --- /dev/null +++ b/codenet/public_test_cases/p02550/input.1.txt @@ -0,0 +1 @@ +10000000000 10 99959 diff --git a/codenet/public_test_cases/p02550/input.2.txt b/codenet/public_test_cases/p02550/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2acecf8937607729955f37b0f013a39512313e0e --- /dev/null +++ b/codenet/public_test_cases/p02550/input.2.txt @@ -0,0 +1 @@ +6 2 1001 diff --git a/codenet/public_test_cases/p02550/input.3.txt b/codenet/public_test_cases/p02550/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b969a3c04b8826d740c84c57f5eaa623de81848b --- /dev/null +++ b/codenet/public_test_cases/p02550/input.3.txt @@ -0,0 +1 @@ +1000 2 16 diff --git a/codenet/public_test_cases/p02550/output.0.txt b/codenet/public_test_cases/p02550/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66227acdb340d1424ec6b05457b274fe91667fee --- /dev/null +++ b/codenet/public_test_cases/p02550/output.0.txt @@ -0,0 +1 @@ +1369 diff --git a/codenet/public_test_cases/p02550/output.1.txt b/codenet/public_test_cases/p02550/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9a0a3048288a2c587f064a6be7559e26b7a2d42 --- /dev/null +++ b/codenet/public_test_cases/p02550/output.1.txt @@ -0,0 +1 @@ +492443256176507 diff --git a/codenet/public_test_cases/p02550/output.2.txt b/codenet/public_test_cases/p02550/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..66227acdb340d1424ec6b05457b274fe91667fee --- /dev/null +++ b/codenet/public_test_cases/p02550/output.2.txt @@ -0,0 +1 @@ +1369 diff --git a/codenet/public_test_cases/p02550/output.3.txt b/codenet/public_test_cases/p02550/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02550/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02551/input.0.txt b/codenet/public_test_cases/p02551/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..114b5c07ba3726dfdf0f0098de020c2189b78505 --- /dev/null +++ b/codenet/public_test_cases/p02551/input.0.txt @@ -0,0 +1,6 @@ +5 5 +1 3 +2 3 +1 4 +2 2 +1 2 diff --git a/codenet/public_test_cases/p02551/input.1.txt b/codenet/public_test_cases/p02551/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..114b5c07ba3726dfdf0f0098de020c2189b78505 --- /dev/null +++ b/codenet/public_test_cases/p02551/input.1.txt @@ -0,0 +1,6 @@ +5 5 +1 3 +2 3 +1 4 +2 2 +1 2 diff --git a/codenet/public_test_cases/p02551/input.2.txt b/codenet/public_test_cases/p02551/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6763fcd6d92fc670ae79f1cc383b03a09f795da8 --- /dev/null +++ b/codenet/public_test_cases/p02551/input.2.txt @@ -0,0 +1 @@ +200000 0 diff --git a/codenet/public_test_cases/p02551/input.3.txt b/codenet/public_test_cases/p02551/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..18ff5f5ab16ae15a4697db751a321c5da25187da --- /dev/null +++ b/codenet/public_test_cases/p02551/input.3.txt @@ -0,0 +1,16 @@ +176527 15 +1 81279 +2 22308 +2 133061 +1 80744 +2 44603 +1 170938 +2 139754 +2 15220 +1 172794 +1 159290 +2 156968 +1 56426 +2 77429 +1 97459 +2 71282 diff --git a/codenet/public_test_cases/p02551/output.0.txt b/codenet/public_test_cases/p02551/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02551/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02551/output.1.txt b/codenet/public_test_cases/p02551/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02551/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02551/output.2.txt b/codenet/public_test_cases/p02551/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4991fa4b605a538d3e5f661742edd7aa7283c733 --- /dev/null +++ b/codenet/public_test_cases/p02551/output.2.txt @@ -0,0 +1 @@ +39999200004 diff --git a/codenet/public_test_cases/p02551/output.3.txt b/codenet/public_test_cases/p02551/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..74847cf2b6f2b836f039bd05dbeadeab3f4bb140 --- /dev/null +++ b/codenet/public_test_cases/p02551/output.3.txt @@ -0,0 +1 @@ +31159505795 diff --git a/codenet/public_test_cases/p02552/input.0.txt b/codenet/public_test_cases/p02552/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02552/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02552/input.1.txt b/codenet/public_test_cases/p02552/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02552/input.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02552/input.2.txt b/codenet/public_test_cases/p02552/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02552/input.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02552/output.0.txt b/codenet/public_test_cases/p02552/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02552/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02552/output.1.txt b/codenet/public_test_cases/p02552/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02552/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02552/output.2.txt b/codenet/public_test_cases/p02552/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02552/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02553/input.0.txt b/codenet/public_test_cases/p02553/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6221a642ec4db544f0275dcb97199f1081d5593 --- /dev/null +++ b/codenet/public_test_cases/p02553/input.0.txt @@ -0,0 +1 @@ +1 2 1 1 diff --git a/codenet/public_test_cases/p02553/input.1.txt b/codenet/public_test_cases/p02553/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7c908d125d4361157f77f347b3772e9699803b4 --- /dev/null +++ b/codenet/public_test_cases/p02553/input.1.txt @@ -0,0 +1 @@ +-1000000000 0 -1000000000 0 diff --git a/codenet/public_test_cases/p02553/input.2.txt b/codenet/public_test_cases/p02553/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6221a642ec4db544f0275dcb97199f1081d5593 --- /dev/null +++ b/codenet/public_test_cases/p02553/input.2.txt @@ -0,0 +1 @@ +1 2 1 1 diff --git a/codenet/public_test_cases/p02553/input.3.txt b/codenet/public_test_cases/p02553/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8968e47f8121e642afae928815e3f48f2a99c882 --- /dev/null +++ b/codenet/public_test_cases/p02553/input.3.txt @@ -0,0 +1 @@ +3 5 -4 -2 diff --git a/codenet/public_test_cases/p02553/output.0.txt b/codenet/public_test_cases/p02553/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02553/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02553/output.1.txt b/codenet/public_test_cases/p02553/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a4149f568ebd1c601c9657a0e51a097d0c2703 --- /dev/null +++ b/codenet/public_test_cases/p02553/output.1.txt @@ -0,0 +1 @@ +1000000000000000000 diff --git a/codenet/public_test_cases/p02553/output.2.txt b/codenet/public_test_cases/p02553/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02553/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02553/output.3.txt b/codenet/public_test_cases/p02553/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cfb5efd665ffa9372e6df49fdce0242d0156991 --- /dev/null +++ b/codenet/public_test_cases/p02553/output.3.txt @@ -0,0 +1 @@ +-6 diff --git a/codenet/public_test_cases/p02554/input.0.txt b/codenet/public_test_cases/p02554/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02554/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02554/input.1.txt b/codenet/public_test_cases/p02554/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09f48c5d791945a0383de4e9373bd75ef8e1d14a --- /dev/null +++ b/codenet/public_test_cases/p02554/input.1.txt @@ -0,0 +1 @@ +869121 diff --git a/codenet/public_test_cases/p02554/input.2.txt b/codenet/public_test_cases/p02554/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02554/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02554/input.3.txt b/codenet/public_test_cases/p02554/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02554/input.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02554/output.0.txt b/codenet/public_test_cases/p02554/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02554/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02554/output.1.txt b/codenet/public_test_cases/p02554/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c926dcbd29f7c94ca2ae1d903513900064752791 --- /dev/null +++ b/codenet/public_test_cases/p02554/output.1.txt @@ -0,0 +1 @@ +2511445 diff --git a/codenet/public_test_cases/p02554/output.2.txt b/codenet/public_test_cases/p02554/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02554/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02554/output.3.txt b/codenet/public_test_cases/p02554/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02554/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02555/input.0.txt b/codenet/public_test_cases/p02555/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02555/input.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02555/input.1.txt b/codenet/public_test_cases/p02555/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02555/input.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02555/input.2.txt b/codenet/public_test_cases/p02555/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..32bb421c624168cd17d29596a84b7a5f4a6bd8c7 --- /dev/null +++ b/codenet/public_test_cases/p02555/input.2.txt @@ -0,0 +1 @@ +1729 diff --git a/codenet/public_test_cases/p02555/input.3.txt b/codenet/public_test_cases/p02555/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02555/input.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02555/output.0.txt b/codenet/public_test_cases/p02555/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02555/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02555/output.1.txt b/codenet/public_test_cases/p02555/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02555/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02555/output.2.txt b/codenet/public_test_cases/p02555/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a97aad16b77d54808c084596d0317f14a77770f --- /dev/null +++ b/codenet/public_test_cases/p02555/output.2.txt @@ -0,0 +1 @@ +294867501 diff --git a/codenet/public_test_cases/p02555/output.3.txt b/codenet/public_test_cases/p02555/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02555/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02556/input.0.txt b/codenet/public_test_cases/p02556/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..42862994ff18022455f77bbd068f6440b91c3aaf --- /dev/null +++ b/codenet/public_test_cases/p02556/input.0.txt @@ -0,0 +1,4 @@ +3 +1 1 +2 4 +3 2 diff --git a/codenet/public_test_cases/p02556/input.1.txt b/codenet/public_test_cases/p02556/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..42862994ff18022455f77bbd068f6440b91c3aaf --- /dev/null +++ b/codenet/public_test_cases/p02556/input.1.txt @@ -0,0 +1,4 @@ +3 +1 1 +2 4 +3 2 diff --git a/codenet/public_test_cases/p02556/input.2.txt b/codenet/public_test_cases/p02556/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd29bee20df23dd8c9c7b5df08c2fffa67dc3a0 --- /dev/null +++ b/codenet/public_test_cases/p02556/input.2.txt @@ -0,0 +1,3 @@ +2 +1 1 +1 1 diff --git a/codenet/public_test_cases/p02556/output.0.txt b/codenet/public_test_cases/p02556/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02556/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02556/output.1.txt b/codenet/public_test_cases/p02556/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02556/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02556/output.2.txt b/codenet/public_test_cases/p02556/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02556/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02557/input.0.txt b/codenet/public_test_cases/p02557/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cb0b88054ab7872e68badb8ce3e27ac44921b81 --- /dev/null +++ b/codenet/public_test_cases/p02557/input.0.txt @@ -0,0 +1,3 @@ +6 +1 1 1 2 2 3 +1 1 1 2 2 3 diff --git a/codenet/public_test_cases/p02557/input.1.txt b/codenet/public_test_cases/p02557/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..298f550c9ea774bdd545c9cef4d24cb417a9b7a6 --- /dev/null +++ b/codenet/public_test_cases/p02557/input.1.txt @@ -0,0 +1,3 @@ +3 +1 1 2 +1 1 3 diff --git a/codenet/public_test_cases/p02557/input.2.txt b/codenet/public_test_cases/p02557/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2190df5ec744c18f228894dbefdf6a5bdf9548e --- /dev/null +++ b/codenet/public_test_cases/p02557/input.2.txt @@ -0,0 +1,3 @@ +4 +1 1 2 3 +1 2 3 3 diff --git a/codenet/public_test_cases/p02557/input.3.txt b/codenet/public_test_cases/p02557/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cb0b88054ab7872e68badb8ce3e27ac44921b81 --- /dev/null +++ b/codenet/public_test_cases/p02557/input.3.txt @@ -0,0 +1,3 @@ +6 +1 1 1 2 2 3 +1 1 1 2 2 3 diff --git a/codenet/public_test_cases/p02557/output.0.txt b/codenet/public_test_cases/p02557/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..adfee44d39b38ed603065ce17486f73caebe899a --- /dev/null +++ b/codenet/public_test_cases/p02557/output.0.txt @@ -0,0 +1,2 @@ +Yes +2 2 3 1 1 1 diff --git a/codenet/public_test_cases/p02557/output.1.txt b/codenet/public_test_cases/p02557/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02557/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02557/output.2.txt b/codenet/public_test_cases/p02557/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6ecd12f2555a5ae049f7396a47dc1f5ee1ecce4 --- /dev/null +++ b/codenet/public_test_cases/p02557/output.2.txt @@ -0,0 +1,2 @@ +Yes +3 3 1 2 diff --git a/codenet/public_test_cases/p02557/output.3.txt b/codenet/public_test_cases/p02557/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..adfee44d39b38ed603065ce17486f73caebe899a --- /dev/null +++ b/codenet/public_test_cases/p02557/output.3.txt @@ -0,0 +1,2 @@ +Yes +2 2 3 1 1 1 diff --git a/codenet/public_test_cases/p02558/input.0.txt b/codenet/public_test_cases/p02558/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab1339aab3d59ea50141540dd336dfcce3c60707 --- /dev/null +++ b/codenet/public_test_cases/p02558/input.0.txt @@ -0,0 +1,8 @@ +4 7 +1 0 1 +0 0 1 +0 2 3 +1 0 1 +1 1 2 +0 0 2 +1 1 3 diff --git a/codenet/public_test_cases/p02558/input.1.txt b/codenet/public_test_cases/p02558/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab1339aab3d59ea50141540dd336dfcce3c60707 --- /dev/null +++ b/codenet/public_test_cases/p02558/input.1.txt @@ -0,0 +1,8 @@ +4 7 +1 0 1 +0 0 1 +0 2 3 +1 0 1 +1 1 2 +0 0 2 +1 1 3 diff --git a/codenet/public_test_cases/p02558/output.0.txt b/codenet/public_test_cases/p02558/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5565ed6787ffbbdfdde23a1dd76682900001d005 --- /dev/null +++ b/codenet/public_test_cases/p02558/output.0.txt @@ -0,0 +1,4 @@ +0 +1 +0 +1 diff --git a/codenet/public_test_cases/p02558/output.1.txt b/codenet/public_test_cases/p02558/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5565ed6787ffbbdfdde23a1dd76682900001d005 --- /dev/null +++ b/codenet/public_test_cases/p02558/output.1.txt @@ -0,0 +1,4 @@ +0 +1 +0 +1 diff --git a/codenet/public_test_cases/p02559/input.0.txt b/codenet/public_test_cases/p02559/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..291b92d10f79d35fd3b1da41f600bae4d0db9c8b --- /dev/null +++ b/codenet/public_test_cases/p02559/input.0.txt @@ -0,0 +1,7 @@ +5 5 +1 2 3 4 5 +1 0 5 +1 2 4 +0 3 10 +1 0 5 +1 0 3 diff --git a/codenet/public_test_cases/p02559/input.1.txt b/codenet/public_test_cases/p02559/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..291b92d10f79d35fd3b1da41f600bae4d0db9c8b --- /dev/null +++ b/codenet/public_test_cases/p02559/input.1.txt @@ -0,0 +1,7 @@ +5 5 +1 2 3 4 5 +1 0 5 +1 2 4 +0 3 10 +1 0 5 +1 0 3 diff --git a/codenet/public_test_cases/p02559/output.0.txt b/codenet/public_test_cases/p02559/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcc0016c65b99e596a7c741d8b88462c50767c91 --- /dev/null +++ b/codenet/public_test_cases/p02559/output.0.txt @@ -0,0 +1,4 @@ +15 +7 +25 +6 diff --git a/codenet/public_test_cases/p02559/output.1.txt b/codenet/public_test_cases/p02559/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcc0016c65b99e596a7c741d8b88462c50767c91 --- /dev/null +++ b/codenet/public_test_cases/p02559/output.1.txt @@ -0,0 +1,4 @@ +15 +7 +25 +6 diff --git a/codenet/public_test_cases/p02560/input.0.txt b/codenet/public_test_cases/p02560/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8c18db396e072a22534f82a8e81e25007f3f897 --- /dev/null +++ b/codenet/public_test_cases/p02560/input.0.txt @@ -0,0 +1,6 @@ +5 +4 10 6 3 +6 5 4 3 +1 1 0 0 +31415 92653 58979 32384 +1000000000 1000000000 999999999 999999999 diff --git a/codenet/public_test_cases/p02560/input.1.txt b/codenet/public_test_cases/p02560/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8c18db396e072a22534f82a8e81e25007f3f897 --- /dev/null +++ b/codenet/public_test_cases/p02560/input.1.txt @@ -0,0 +1,6 @@ +5 +4 10 6 3 +6 5 4 3 +1 1 0 0 +31415 92653 58979 32384 +1000000000 1000000000 999999999 999999999 diff --git a/codenet/public_test_cases/p02560/output.0.txt b/codenet/public_test_cases/p02560/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bf207b766ecc2551b5264e4afff47591e86c128 --- /dev/null +++ b/codenet/public_test_cases/p02560/output.0.txt @@ -0,0 +1,5 @@ +3 +13 +0 +314095480 +499999999500000000 diff --git a/codenet/public_test_cases/p02560/output.1.txt b/codenet/public_test_cases/p02560/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bf207b766ecc2551b5264e4afff47591e86c128 --- /dev/null +++ b/codenet/public_test_cases/p02560/output.1.txt @@ -0,0 +1,5 @@ +3 +13 +0 +314095480 +499999999500000000 diff --git a/codenet/public_test_cases/p02561/input.0.txt b/codenet/public_test_cases/p02561/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8beef8d4fc68006f96657a30e04b70712918cf98 --- /dev/null +++ b/codenet/public_test_cases/p02561/input.0.txt @@ -0,0 +1,4 @@ +3 3 +#.. +..# +... diff --git a/codenet/public_test_cases/p02561/input.1.txt b/codenet/public_test_cases/p02561/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8beef8d4fc68006f96657a30e04b70712918cf98 --- /dev/null +++ b/codenet/public_test_cases/p02561/input.1.txt @@ -0,0 +1,4 @@ +3 3 +#.. +..# +... diff --git a/codenet/public_test_cases/p02561/input.2.txt b/codenet/public_test_cases/p02561/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9294fd2849df040b470fcf43aecbbceaa7aff9b4 --- /dev/null +++ b/codenet/public_test_cases/p02561/input.2.txt @@ -0,0 +1,4 @@ +3 3 +.. +..# +... diff --git a/codenet/public_test_cases/p02561/output.0.txt b/codenet/public_test_cases/p02561/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80bd112c376ee3586aba341358e20ea8d5fbed89 --- /dev/null +++ b/codenet/public_test_cases/p02561/output.0.txt @@ -0,0 +1,4 @@ +3 +#>< +vv# +^^. diff --git a/codenet/public_test_cases/p02561/output.1.txt b/codenet/public_test_cases/p02561/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..80bd112c376ee3586aba341358e20ea8d5fbed89 --- /dev/null +++ b/codenet/public_test_cases/p02561/output.1.txt @@ -0,0 +1,4 @@ +3 +#>< +vv# +^^. diff --git a/codenet/public_test_cases/p02561/output.2.txt b/codenet/public_test_cases/p02561/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7798ff2fd913c225606b5acec48d3a27067ace64 --- /dev/null +++ b/codenet/public_test_cases/p02561/output.2.txt @@ -0,0 +1,4 @@ +3 +>< +vv# +^^. diff --git a/codenet/public_test_cases/p02562/input.0.txt b/codenet/public_test_cases/p02562/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef48fa05a240d12beaa1f58f46fb1336ab723db5 --- /dev/null +++ b/codenet/public_test_cases/p02562/input.0.txt @@ -0,0 +1,4 @@ +3 1 +5 3 2 +1 4 8 +7 6 9 diff --git a/codenet/public_test_cases/p02562/input.1.txt b/codenet/public_test_cases/p02562/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..168348969d0bea853a624b65e82f171d8e1d28f0 --- /dev/null +++ b/codenet/public_test_cases/p02562/input.1.txt @@ -0,0 +1,4 @@ +3 2 +10 10 1 +10 10 1 +1 1 10 diff --git a/codenet/public_test_cases/p02562/input.2.txt b/codenet/public_test_cases/p02562/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef48fa05a240d12beaa1f58f46fb1336ab723db5 --- /dev/null +++ b/codenet/public_test_cases/p02562/input.2.txt @@ -0,0 +1,4 @@ +3 1 +5 3 2 +1 4 8 +7 6 9 diff --git a/codenet/public_test_cases/p02562/output.0.txt b/codenet/public_test_cases/p02562/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..275818ac4ef5ce3e3512e4754fd1a757487a3a5e --- /dev/null +++ b/codenet/public_test_cases/p02562/output.0.txt @@ -0,0 +1,4 @@ +19 +X.. +..X +.X. diff --git a/codenet/public_test_cases/p02562/output.1.txt b/codenet/public_test_cases/p02562/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a338cbf1aa8111fa52098ac4bbd49430493a570c --- /dev/null +++ b/codenet/public_test_cases/p02562/output.1.txt @@ -0,0 +1,4 @@ +50 +XX. +XX. +..X diff --git a/codenet/public_test_cases/p02562/output.2.txt b/codenet/public_test_cases/p02562/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..275818ac4ef5ce3e3512e4754fd1a757487a3a5e --- /dev/null +++ b/codenet/public_test_cases/p02562/output.2.txt @@ -0,0 +1,4 @@ +19 +X.. +..X +.X. diff --git a/codenet/public_test_cases/p02563/input.0.txt b/codenet/public_test_cases/p02563/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c43d449f4a5273e7c2cf36a49dfe2d4f6122301 --- /dev/null +++ b/codenet/public_test_cases/p02563/input.0.txt @@ -0,0 +1,3 @@ +4 5 +1 2 3 4 +5 6 7 8 9 diff --git a/codenet/public_test_cases/p02563/input.1.txt b/codenet/public_test_cases/p02563/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c43d449f4a5273e7c2cf36a49dfe2d4f6122301 --- /dev/null +++ b/codenet/public_test_cases/p02563/input.1.txt @@ -0,0 +1,3 @@ +4 5 +1 2 3 4 +5 6 7 8 9 diff --git a/codenet/public_test_cases/p02563/input.2.txt b/codenet/public_test_cases/p02563/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7d6b964b67aee6fdd5a57d3a19071c7478cd4fb --- /dev/null +++ b/codenet/public_test_cases/p02563/input.2.txt @@ -0,0 +1,3 @@ +1 1 +10000000 +10000000 diff --git a/codenet/public_test_cases/p02563/output.0.txt b/codenet/public_test_cases/p02563/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..472de40002dfb5a2b5fd6fd5df9cc78056a5f88a --- /dev/null +++ b/codenet/public_test_cases/p02563/output.0.txt @@ -0,0 +1 @@ +5 16 34 60 70 70 59 36 diff --git a/codenet/public_test_cases/p02563/output.1.txt b/codenet/public_test_cases/p02563/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..472de40002dfb5a2b5fd6fd5df9cc78056a5f88a --- /dev/null +++ b/codenet/public_test_cases/p02563/output.1.txt @@ -0,0 +1 @@ +5 16 34 60 70 70 59 36 diff --git a/codenet/public_test_cases/p02563/output.2.txt b/codenet/public_test_cases/p02563/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6329546d8542647c56e07d75d67bce5ad1263d5 --- /dev/null +++ b/codenet/public_test_cases/p02563/output.2.txt @@ -0,0 +1 @@ +871938225 diff --git a/codenet/public_test_cases/p02564/input.0.txt b/codenet/public_test_cases/p02564/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d45ca1a183d65cd7fcc0c5054d8cfeedcf24c1b7 --- /dev/null +++ b/codenet/public_test_cases/p02564/input.0.txt @@ -0,0 +1,8 @@ +6 7 +1 4 +5 2 +3 0 +5 5 +4 1 +0 3 +4 2 diff --git a/codenet/public_test_cases/p02564/input.1.txt b/codenet/public_test_cases/p02564/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d45ca1a183d65cd7fcc0c5054d8cfeedcf24c1b7 --- /dev/null +++ b/codenet/public_test_cases/p02564/input.1.txt @@ -0,0 +1,8 @@ +6 7 +1 4 +5 2 +3 0 +5 5 +4 1 +0 3 +4 2 diff --git a/codenet/public_test_cases/p02564/output.0.txt b/codenet/public_test_cases/p02564/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6946f2fff48e9bb02858166d2d10d70492a48564 --- /dev/null +++ b/codenet/public_test_cases/p02564/output.0.txt @@ -0,0 +1,5 @@ +4 +1 5 +2 4 1 +1 2 +2 3 0 diff --git a/codenet/public_test_cases/p02564/output.1.txt b/codenet/public_test_cases/p02564/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6946f2fff48e9bb02858166d2d10d70492a48564 --- /dev/null +++ b/codenet/public_test_cases/p02564/output.1.txt @@ -0,0 +1,5 @@ +4 +1 5 +2 4 1 +1 2 +2 3 0 diff --git a/codenet/public_test_cases/p02565/input.0.txt b/codenet/public_test_cases/p02565/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b606d4f29679d5073916277b99d90f913ccec4fd --- /dev/null +++ b/codenet/public_test_cases/p02565/input.0.txt @@ -0,0 +1,4 @@ +3 2 +1 4 +2 5 +0 6 diff --git a/codenet/public_test_cases/p02565/input.1.txt b/codenet/public_test_cases/p02565/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31d62cc5e4fdcd76d8ab2556cbf34c8d7de52d90 --- /dev/null +++ b/codenet/public_test_cases/p02565/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 4 +2 5 +0 6 diff --git a/codenet/public_test_cases/p02565/input.2.txt b/codenet/public_test_cases/p02565/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b606d4f29679d5073916277b99d90f913ccec4fd --- /dev/null +++ b/codenet/public_test_cases/p02565/input.2.txt @@ -0,0 +1,4 @@ +3 2 +1 4 +2 5 +0 6 diff --git a/codenet/public_test_cases/p02565/output.0.txt b/codenet/public_test_cases/p02565/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ecfb0f660467c528d65c1ef42ac57554362ae6b --- /dev/null +++ b/codenet/public_test_cases/p02565/output.0.txt @@ -0,0 +1,4 @@ +Yes +4 +2 +0 diff --git a/codenet/public_test_cases/p02565/output.1.txt b/codenet/public_test_cases/p02565/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02565/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02565/output.2.txt b/codenet/public_test_cases/p02565/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ecfb0f660467c528d65c1ef42ac57554362ae6b --- /dev/null +++ b/codenet/public_test_cases/p02565/output.2.txt @@ -0,0 +1,4 @@ +Yes +4 +2 +0 diff --git a/codenet/public_test_cases/p02566/input.0.txt b/codenet/public_test_cases/p02566/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a647f8965bf763c028cf90f2b37f13a55f1464a2 --- /dev/null +++ b/codenet/public_test_cases/p02566/input.0.txt @@ -0,0 +1 @@ +abcbcba diff --git a/codenet/public_test_cases/p02566/input.1.txt b/codenet/public_test_cases/p02566/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a647f8965bf763c028cf90f2b37f13a55f1464a2 --- /dev/null +++ b/codenet/public_test_cases/p02566/input.1.txt @@ -0,0 +1 @@ +abcbcba diff --git a/codenet/public_test_cases/p02566/input.2.txt b/codenet/public_test_cases/p02566/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccc3e7b48da0932cc0f7c4ce7b4fd834c7032fe1 --- /dev/null +++ b/codenet/public_test_cases/p02566/input.2.txt @@ -0,0 +1 @@ +aaaaa diff --git a/codenet/public_test_cases/p02566/input.3.txt b/codenet/public_test_cases/p02566/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e57708b04717a7dc10818e58b484b810b901f1f4 --- /dev/null +++ b/codenet/public_test_cases/p02566/input.3.txt @@ -0,0 +1 @@ +ababacaca diff --git a/codenet/public_test_cases/p02566/input.4.txt b/codenet/public_test_cases/p02566/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f4f5feeab89fc344e70302011d6efd2897140ec --- /dev/null +++ b/codenet/public_test_cases/p02566/input.4.txt @@ -0,0 +1 @@ +mississippi diff --git a/codenet/public_test_cases/p02566/output.0.txt b/codenet/public_test_cases/p02566/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p02566/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p02566/output.1.txt b/codenet/public_test_cases/p02566/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p02566/output.1.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p02566/output.2.txt b/codenet/public_test_cases/p02566/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02566/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02566/output.3.txt b/codenet/public_test_cases/p02566/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb95160cb6e07358f54a28a208ae41e69889c97b --- /dev/null +++ b/codenet/public_test_cases/p02566/output.3.txt @@ -0,0 +1 @@ +33 diff --git a/codenet/public_test_cases/p02566/output.4.txt b/codenet/public_test_cases/p02566/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..59343b09ec765366a5b0ac04196385079acd864e --- /dev/null +++ b/codenet/public_test_cases/p02566/output.4.txt @@ -0,0 +1 @@ +53 diff --git a/codenet/public_test_cases/p02567/input.0.txt b/codenet/public_test_cases/p02567/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ead868d4541d3b08d26f38b078ad1719b164a36f --- /dev/null +++ b/codenet/public_test_cases/p02567/input.0.txt @@ -0,0 +1,7 @@ +5 5 +1 2 3 2 1 +2 1 5 +3 2 3 +1 3 1 +2 2 4 +3 1 3 diff --git a/codenet/public_test_cases/p02567/input.1.txt b/codenet/public_test_cases/p02567/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ead868d4541d3b08d26f38b078ad1719b164a36f --- /dev/null +++ b/codenet/public_test_cases/p02567/input.1.txt @@ -0,0 +1,7 @@ +5 5 +1 2 3 2 1 +2 1 5 +3 2 3 +1 3 1 +2 2 4 +3 1 3 diff --git a/codenet/public_test_cases/p02567/output.0.txt b/codenet/public_test_cases/p02567/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64e864553094fca79ef1cf5435fa7c489f2fd2a1 --- /dev/null +++ b/codenet/public_test_cases/p02567/output.0.txt @@ -0,0 +1,4 @@ +3 +3 +2 +6 diff --git a/codenet/public_test_cases/p02567/output.1.txt b/codenet/public_test_cases/p02567/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64e864553094fca79ef1cf5435fa7c489f2fd2a1 --- /dev/null +++ b/codenet/public_test_cases/p02567/output.1.txt @@ -0,0 +1,4 @@ +3 +3 +2 +6 diff --git a/codenet/public_test_cases/p02568/input.0.txt b/codenet/public_test_cases/p02568/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8268178c96359f56ecaa8b36a0d9bbd72ad8b40d --- /dev/null +++ b/codenet/public_test_cases/p02568/input.0.txt @@ -0,0 +1,9 @@ +5 7 +1 2 3 4 5 +1 0 5 +0 2 4 100 101 +1 0 3 +0 1 3 102 103 +1 2 5 +0 2 5 104 105 +1 0 5 diff --git a/codenet/public_test_cases/p02568/input.1.txt b/codenet/public_test_cases/p02568/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8268178c96359f56ecaa8b36a0d9bbd72ad8b40d --- /dev/null +++ b/codenet/public_test_cases/p02568/input.1.txt @@ -0,0 +1,9 @@ +5 7 +1 2 3 4 5 +1 0 5 +0 2 4 100 101 +1 0 3 +0 1 3 102 103 +1 2 5 +0 2 5 104 105 +1 0 5 diff --git a/codenet/public_test_cases/p02568/output.0.txt b/codenet/public_test_cases/p02568/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19aafcd522036cdbf1160fa09617bc1a5679523f --- /dev/null +++ b/codenet/public_test_cases/p02568/output.0.txt @@ -0,0 +1,4 @@ +15 +404 +41511 +4317767 diff --git a/codenet/public_test_cases/p02568/output.1.txt b/codenet/public_test_cases/p02568/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19aafcd522036cdbf1160fa09617bc1a5679523f --- /dev/null +++ b/codenet/public_test_cases/p02568/output.1.txt @@ -0,0 +1,4 @@ +15 +404 +41511 +4317767 diff --git a/codenet/public_test_cases/p02569/input.0.txt b/codenet/public_test_cases/p02569/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a23c033883973c72f97f8cacba0dd20a51a21ec --- /dev/null +++ b/codenet/public_test_cases/p02569/input.0.txt @@ -0,0 +1,7 @@ +5 5 +0 1 0 0 1 +2 1 5 +1 3 4 +2 2 5 +1 1 3 +2 1 2 diff --git a/codenet/public_test_cases/p02569/input.1.txt b/codenet/public_test_cases/p02569/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a23c033883973c72f97f8cacba0dd20a51a21ec --- /dev/null +++ b/codenet/public_test_cases/p02569/input.1.txt @@ -0,0 +1,7 @@ +5 5 +0 1 0 0 1 +2 1 5 +1 3 4 +2 2 5 +1 1 3 +2 1 2 diff --git a/codenet/public_test_cases/p02569/output.0.txt b/codenet/public_test_cases/p02569/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c5d59c22d950fa76f38be7a24322e7f028f18e6 --- /dev/null +++ b/codenet/public_test_cases/p02569/output.0.txt @@ -0,0 +1,3 @@ +2 +0 +1 diff --git a/codenet/public_test_cases/p02569/output.1.txt b/codenet/public_test_cases/p02569/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c5d59c22d950fa76f38be7a24322e7f028f18e6 --- /dev/null +++ b/codenet/public_test_cases/p02569/output.1.txt @@ -0,0 +1,3 @@ +2 +0 +1 diff --git a/codenet/public_test_cases/p02570/input.0.txt b/codenet/public_test_cases/p02570/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59b0d3058f541c24b051fdc3bebe3d52381ba706 --- /dev/null +++ b/codenet/public_test_cases/p02570/input.0.txt @@ -0,0 +1 @@ +1000 15 80 diff --git a/codenet/public_test_cases/p02570/input.1.txt b/codenet/public_test_cases/p02570/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78a387588fdee94d37f63b3dfd52d421076fe1ed --- /dev/null +++ b/codenet/public_test_cases/p02570/input.1.txt @@ -0,0 +1 @@ +2000 20 100 diff --git a/codenet/public_test_cases/p02570/input.2.txt b/codenet/public_test_cases/p02570/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..46031632436e28ac8c56e4cd282549618de2c310 --- /dev/null +++ b/codenet/public_test_cases/p02570/input.2.txt @@ -0,0 +1 @@ +10000 1 1 diff --git a/codenet/public_test_cases/p02570/input.3.txt b/codenet/public_test_cases/p02570/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..59b0d3058f541c24b051fdc3bebe3d52381ba706 --- /dev/null +++ b/codenet/public_test_cases/p02570/input.3.txt @@ -0,0 +1 @@ +1000 15 80 diff --git a/codenet/public_test_cases/p02570/output.0.txt b/codenet/public_test_cases/p02570/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02570/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02570/output.1.txt b/codenet/public_test_cases/p02570/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02570/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02570/output.2.txt b/codenet/public_test_cases/p02570/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02570/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02570/output.3.txt b/codenet/public_test_cases/p02570/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02570/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02571/input.0.txt b/codenet/public_test_cases/p02571/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60cf4407fd4e5e6be271b01d429e77efe5f61a68 --- /dev/null +++ b/codenet/public_test_cases/p02571/input.0.txt @@ -0,0 +1,2 @@ +cabacc +abc diff --git a/codenet/public_test_cases/p02571/input.1.txt b/codenet/public_test_cases/p02571/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec061b50247a288f5a1bf5b3c824393d9405b810 --- /dev/null +++ b/codenet/public_test_cases/p02571/input.1.txt @@ -0,0 +1,2 @@ +codeforces +atcoder diff --git a/codenet/public_test_cases/p02571/input.2.txt b/codenet/public_test_cases/p02571/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60cf4407fd4e5e6be271b01d429e77efe5f61a68 --- /dev/null +++ b/codenet/public_test_cases/p02571/input.2.txt @@ -0,0 +1,2 @@ +cabacc +abc diff --git a/codenet/public_test_cases/p02571/output.0.txt b/codenet/public_test_cases/p02571/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02571/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02571/output.1.txt b/codenet/public_test_cases/p02571/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02571/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02571/output.2.txt b/codenet/public_test_cases/p02571/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02571/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02572/input.0.txt b/codenet/public_test_cases/p02572/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02572/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02572/input.1.txt b/codenet/public_test_cases/p02572/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02572/input.1.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02572/input.2.txt b/codenet/public_test_cases/p02572/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..371a5a36533dc93a1a5cfca08166a87d0e2a8423 --- /dev/null +++ b/codenet/public_test_cases/p02572/input.2.txt @@ -0,0 +1,2 @@ +4 +141421356 17320508 22360679 244949 diff --git a/codenet/public_test_cases/p02572/output.0.txt b/codenet/public_test_cases/p02572/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02572/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02572/output.1.txt b/codenet/public_test_cases/p02572/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02572/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02572/output.2.txt b/codenet/public_test_cases/p02572/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e38736c1cd1ff5251e6a55a88913f47343862c5 --- /dev/null +++ b/codenet/public_test_cases/p02572/output.2.txt @@ -0,0 +1 @@ +437235829 diff --git a/codenet/public_test_cases/p02573/input.0.txt b/codenet/public_test_cases/p02573/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62f5daccf4bf46672cebc89a0c0b1f37b86d49ea --- /dev/null +++ b/codenet/public_test_cases/p02573/input.0.txt @@ -0,0 +1,4 @@ +5 3 +1 2 +3 4 +5 1 diff --git a/codenet/public_test_cases/p02573/input.1.txt b/codenet/public_test_cases/p02573/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2407a7b775b2b3c10333c898d5f44b074247b19e --- /dev/null +++ b/codenet/public_test_cases/p02573/input.1.txt @@ -0,0 +1,5 @@ +10 4 +3 1 +4 1 +5 9 +2 6 diff --git a/codenet/public_test_cases/p02573/input.2.txt b/codenet/public_test_cases/p02573/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..62f5daccf4bf46672cebc89a0c0b1f37b86d49ea --- /dev/null +++ b/codenet/public_test_cases/p02573/input.2.txt @@ -0,0 +1,4 @@ +5 3 +1 2 +3 4 +5 1 diff --git a/codenet/public_test_cases/p02573/input.3.txt b/codenet/public_test_cases/p02573/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc2feaab2f5f57e28805f67fa3ce9d85ee136342 --- /dev/null +++ b/codenet/public_test_cases/p02573/input.3.txt @@ -0,0 +1,11 @@ +4 10 +1 2 +2 1 +1 2 +2 1 +1 2 +1 3 +1 4 +2 3 +2 4 +3 4 diff --git a/codenet/public_test_cases/p02573/output.0.txt b/codenet/public_test_cases/p02573/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02573/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02573/output.1.txt b/codenet/public_test_cases/p02573/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02573/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02573/output.2.txt b/codenet/public_test_cases/p02573/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02573/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02573/output.3.txt b/codenet/public_test_cases/p02573/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02573/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02574/input.0.txt b/codenet/public_test_cases/p02574/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc5cf6c0f2cae79a18a7030537db80e73d4ba0a5 --- /dev/null +++ b/codenet/public_test_cases/p02574/input.0.txt @@ -0,0 +1,2 @@ +3 +3 4 5 diff --git a/codenet/public_test_cases/p02574/input.1.txt b/codenet/public_test_cases/p02574/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdc5c1e46ae800a40161853bc3beb8474cb8ae5c --- /dev/null +++ b/codenet/public_test_cases/p02574/input.1.txt @@ -0,0 +1,2 @@ +3 +6 10 16 diff --git a/codenet/public_test_cases/p02574/input.2.txt b/codenet/public_test_cases/p02574/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a88514878c4957cc7c5bbbe79ed7f9a413628b71 --- /dev/null +++ b/codenet/public_test_cases/p02574/input.2.txt @@ -0,0 +1,2 @@ +3 +6 10 15 diff --git a/codenet/public_test_cases/p02574/input.3.txt b/codenet/public_test_cases/p02574/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc5cf6c0f2cae79a18a7030537db80e73d4ba0a5 --- /dev/null +++ b/codenet/public_test_cases/p02574/input.3.txt @@ -0,0 +1,2 @@ +3 +3 4 5 diff --git a/codenet/public_test_cases/p02574/output.0.txt b/codenet/public_test_cases/p02574/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f4dcad5a2acff7450802a9ca0d7616d8490fe69 --- /dev/null +++ b/codenet/public_test_cases/p02574/output.0.txt @@ -0,0 +1 @@ +pairwise coprime diff --git a/codenet/public_test_cases/p02574/output.1.txt b/codenet/public_test_cases/p02574/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..807b87a1d202d1ce8445a45e908db2d31f26d03a --- /dev/null +++ b/codenet/public_test_cases/p02574/output.1.txt @@ -0,0 +1 @@ +not coprime diff --git a/codenet/public_test_cases/p02574/output.2.txt b/codenet/public_test_cases/p02574/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2b05ff6461cdf3dabad56cc10bad591c3a47132 --- /dev/null +++ b/codenet/public_test_cases/p02574/output.2.txt @@ -0,0 +1 @@ +setwise coprime diff --git a/codenet/public_test_cases/p02574/output.3.txt b/codenet/public_test_cases/p02574/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f4dcad5a2acff7450802a9ca0d7616d8490fe69 --- /dev/null +++ b/codenet/public_test_cases/p02574/output.3.txt @@ -0,0 +1 @@ +pairwise coprime diff --git a/codenet/public_test_cases/p02575/input.0.txt b/codenet/public_test_cases/p02575/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a5bbd917ae29df1b50aa7d473b0ce8b0acee805 --- /dev/null +++ b/codenet/public_test_cases/p02575/input.0.txt @@ -0,0 +1,5 @@ +4 4 +2 4 +1 1 +2 3 +2 4 diff --git a/codenet/public_test_cases/p02575/input.1.txt b/codenet/public_test_cases/p02575/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a5bbd917ae29df1b50aa7d473b0ce8b0acee805 --- /dev/null +++ b/codenet/public_test_cases/p02575/input.1.txt @@ -0,0 +1,5 @@ +4 4 +2 4 +1 1 +2 3 +2 4 diff --git a/codenet/public_test_cases/p02575/output.0.txt b/codenet/public_test_cases/p02575/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9424e83d1e1e00d20fad8db6829ec1ca1eed4062 --- /dev/null +++ b/codenet/public_test_cases/p02575/output.0.txt @@ -0,0 +1,4 @@ +1 +3 +6 +-1 diff --git a/codenet/public_test_cases/p02575/output.1.txt b/codenet/public_test_cases/p02575/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9424e83d1e1e00d20fad8db6829ec1ca1eed4062 --- /dev/null +++ b/codenet/public_test_cases/p02575/output.1.txt @@ -0,0 +1,4 @@ +1 +3 +6 +-1 diff --git a/codenet/public_test_cases/p02576/input.0.txt b/codenet/public_test_cases/p02576/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ba9afb2b70a775acd57f8bb92a381e85877058b --- /dev/null +++ b/codenet/public_test_cases/p02576/input.0.txt @@ -0,0 +1 @@ +20 12 6 diff --git a/codenet/public_test_cases/p02576/input.1.txt b/codenet/public_test_cases/p02576/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..22c2913b55126e071f9201068e6592bd31a14f42 --- /dev/null +++ b/codenet/public_test_cases/p02576/input.1.txt @@ -0,0 +1 @@ +1000 1 1000 diff --git a/codenet/public_test_cases/p02576/input.2.txt b/codenet/public_test_cases/p02576/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ba9afb2b70a775acd57f8bb92a381e85877058b --- /dev/null +++ b/codenet/public_test_cases/p02576/input.2.txt @@ -0,0 +1 @@ +20 12 6 diff --git a/codenet/public_test_cases/p02576/output.0.txt b/codenet/public_test_cases/p02576/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02576/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02576/output.1.txt b/codenet/public_test_cases/p02576/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..749fce669df1b51cae4a71dc130b2a14807829f0 --- /dev/null +++ b/codenet/public_test_cases/p02576/output.1.txt @@ -0,0 +1 @@ +1000000 diff --git a/codenet/public_test_cases/p02576/output.2.txt b/codenet/public_test_cases/p02576/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02576/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02577/input.0.txt b/codenet/public_test_cases/p02577/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28d14454c380441fa2b6f562072a1cd641c06e22 --- /dev/null +++ b/codenet/public_test_cases/p02577/input.0.txt @@ -0,0 +1 @@ +123456789 diff --git a/codenet/public_test_cases/p02577/input.1.txt b/codenet/public_test_cases/p02577/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28d14454c380441fa2b6f562072a1cd641c06e22 --- /dev/null +++ b/codenet/public_test_cases/p02577/input.1.txt @@ -0,0 +1 @@ +123456789 diff --git a/codenet/public_test_cases/p02577/input.2.txt b/codenet/public_test_cases/p02577/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02577/input.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02577/input.3.txt b/codenet/public_test_cases/p02577/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0b71d24da109bc05e4a81ca4221d5e530dd3962 --- /dev/null +++ b/codenet/public_test_cases/p02577/input.3.txt @@ -0,0 +1 @@ +31415926535897932384626433832795028841971693993751058209749445923078164062862089986280 diff --git a/codenet/public_test_cases/p02577/output.0.txt b/codenet/public_test_cases/p02577/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02577/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02577/output.1.txt b/codenet/public_test_cases/p02577/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02577/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02577/output.2.txt b/codenet/public_test_cases/p02577/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02577/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02577/output.3.txt b/codenet/public_test_cases/p02577/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02577/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02578/input.0.txt b/codenet/public_test_cases/p02578/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd1164cf00bdd57661e3c6b2216c9d3f6c4fd226 --- /dev/null +++ b/codenet/public_test_cases/p02578/input.0.txt @@ -0,0 +1,2 @@ +5 +2 1 5 4 3 diff --git a/codenet/public_test_cases/p02578/input.1.txt b/codenet/public_test_cases/p02578/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6ad0ca15d6caa972e6ddf0d652c404bffd885a2 --- /dev/null +++ b/codenet/public_test_cases/p02578/input.1.txt @@ -0,0 +1,2 @@ +5 +3 3 3 3 3 diff --git a/codenet/public_test_cases/p02578/input.2.txt b/codenet/public_test_cases/p02578/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd1164cf00bdd57661e3c6b2216c9d3f6c4fd226 --- /dev/null +++ b/codenet/public_test_cases/p02578/input.2.txt @@ -0,0 +1,2 @@ +5 +2 1 5 4 3 diff --git a/codenet/public_test_cases/p02578/output.0.txt b/codenet/public_test_cases/p02578/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02578/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02578/output.1.txt b/codenet/public_test_cases/p02578/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02578/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02578/output.2.txt b/codenet/public_test_cases/p02578/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02578/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02579/input.0.txt b/codenet/public_test_cases/p02579/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85e87db7b6617ddc98fc35bef406049ee468d3ea --- /dev/null +++ b/codenet/public_test_cases/p02579/input.0.txt @@ -0,0 +1,7 @@ +4 4 +1 1 +4 4 +..#. +..#. +.#.. +.#.. diff --git a/codenet/public_test_cases/p02579/input.1.txt b/codenet/public_test_cases/p02579/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85e87db7b6617ddc98fc35bef406049ee468d3ea --- /dev/null +++ b/codenet/public_test_cases/p02579/input.1.txt @@ -0,0 +1,7 @@ +4 4 +1 1 +4 4 +..#. +..#. +.#.. +.#.. diff --git a/codenet/public_test_cases/p02579/input.2.txt b/codenet/public_test_cases/p02579/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..272b0282742fd405c09e4ec2dcf81d64d440a578 --- /dev/null +++ b/codenet/public_test_cases/p02579/input.2.txt @@ -0,0 +1,7 @@ +4 4 +1 4 +4 1 +.##. + + +.##. diff --git a/codenet/public_test_cases/p02579/input.3.txt b/codenet/public_test_cases/p02579/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d647df550fd6d84a0ccdd6ec9780d3a3d399bfb1 --- /dev/null +++ b/codenet/public_test_cases/p02579/input.3.txt @@ -0,0 +1,7 @@ +4 5 +1 2 +2 5 +.### +. +..## +..## diff --git a/codenet/public_test_cases/p02579/input.4.txt b/codenet/public_test_cases/p02579/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a1c14d8ed92edc45753994963fc34a51ceb2e18 --- /dev/null +++ b/codenet/public_test_cases/p02579/input.4.txt @@ -0,0 +1,7 @@ +4 4 +2 2 +3 3 +.... +.... +.... +.... diff --git a/codenet/public_test_cases/p02579/output.0.txt b/codenet/public_test_cases/p02579/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02579/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02579/output.1.txt b/codenet/public_test_cases/p02579/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02579/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02579/output.2.txt b/codenet/public_test_cases/p02579/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02579/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02579/output.3.txt b/codenet/public_test_cases/p02579/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02579/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02579/output.4.txt b/codenet/public_test_cases/p02579/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02579/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02580/input.0.txt b/codenet/public_test_cases/p02580/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62eca2298b7ebbef39dea0bb8c88067bc3f97173 --- /dev/null +++ b/codenet/public_test_cases/p02580/input.0.txt @@ -0,0 +1,4 @@ +2 3 3 +2 2 +1 1 +1 3 diff --git a/codenet/public_test_cases/p02580/input.1.txt b/codenet/public_test_cases/p02580/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..62eca2298b7ebbef39dea0bb8c88067bc3f97173 --- /dev/null +++ b/codenet/public_test_cases/p02580/input.1.txt @@ -0,0 +1,4 @@ +2 3 3 +2 2 +1 1 +1 3 diff --git a/codenet/public_test_cases/p02580/input.2.txt b/codenet/public_test_cases/p02580/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..02698c06dec6abd1ad559f75b8f588dfdba95ab2 --- /dev/null +++ b/codenet/public_test_cases/p02580/input.2.txt @@ -0,0 +1,5 @@ +3 3 4 +3 3 +3 1 +1 1 +1 2 diff --git a/codenet/public_test_cases/p02580/input.3.txt b/codenet/public_test_cases/p02580/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45438c77c5b32354197f07a9251bb1626ed0e28c --- /dev/null +++ b/codenet/public_test_cases/p02580/input.3.txt @@ -0,0 +1,11 @@ +5 5 10 +2 5 +4 3 +2 3 +5 5 +2 2 +5 4 +5 3 +5 1 +3 5 +1 4 diff --git a/codenet/public_test_cases/p02580/output.0.txt b/codenet/public_test_cases/p02580/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02580/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02580/output.1.txt b/codenet/public_test_cases/p02580/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02580/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02580/output.2.txt b/codenet/public_test_cases/p02580/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02580/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02580/output.3.txt b/codenet/public_test_cases/p02580/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02580/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02581/input.0.txt b/codenet/public_test_cases/p02581/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4438980af89ecfe9802302edaf7bda20f8a6014b --- /dev/null +++ b/codenet/public_test_cases/p02581/input.0.txt @@ -0,0 +1,2 @@ +2 +1 2 1 2 2 1 diff --git a/codenet/public_test_cases/p02581/input.1.txt b/codenet/public_test_cases/p02581/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc3b35984d2f63b4e695a4d707b2852898520c08 --- /dev/null +++ b/codenet/public_test_cases/p02581/input.1.txt @@ -0,0 +1,2 @@ +3 +1 1 2 2 2 3 3 3 1 diff --git a/codenet/public_test_cases/p02581/input.2.txt b/codenet/public_test_cases/p02581/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..65b4eafc94292199cdef9bde65793de22cf530b0 --- /dev/null +++ b/codenet/public_test_cases/p02581/input.2.txt @@ -0,0 +1,2 @@ +3 +1 1 2 2 3 3 3 2 1 diff --git a/codenet/public_test_cases/p02581/input.3.txt b/codenet/public_test_cases/p02581/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4438980af89ecfe9802302edaf7bda20f8a6014b --- /dev/null +++ b/codenet/public_test_cases/p02581/input.3.txt @@ -0,0 +1,2 @@ +2 +1 2 1 2 2 1 diff --git a/codenet/public_test_cases/p02581/output.0.txt b/codenet/public_test_cases/p02581/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02581/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02581/output.1.txt b/codenet/public_test_cases/p02581/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02581/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02581/output.2.txt b/codenet/public_test_cases/p02581/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02581/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02581/output.3.txt b/codenet/public_test_cases/p02581/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02581/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02582/input.0.txt b/codenet/public_test_cases/p02582/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6936a9bd46e3c82a3f9bcce8b884ea11d82762ac --- /dev/null +++ b/codenet/public_test_cases/p02582/input.0.txt @@ -0,0 +1 @@ +RRS diff --git a/codenet/public_test_cases/p02582/input.1.txt b/codenet/public_test_cases/p02582/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..de461aeae96755c12da51c3638737e3ee8799b7d --- /dev/null +++ b/codenet/public_test_cases/p02582/input.1.txt @@ -0,0 +1 @@ +RSR diff --git a/codenet/public_test_cases/p02582/input.2.txt b/codenet/public_test_cases/p02582/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6936a9bd46e3c82a3f9bcce8b884ea11d82762ac --- /dev/null +++ b/codenet/public_test_cases/p02582/input.2.txt @@ -0,0 +1 @@ +RRS diff --git a/codenet/public_test_cases/p02582/input.3.txt b/codenet/public_test_cases/p02582/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..db490b3b6a52a2ab9f6fcdce6a6078b6616f7b3c --- /dev/null +++ b/codenet/public_test_cases/p02582/input.3.txt @@ -0,0 +1 @@ +SSS diff --git a/codenet/public_test_cases/p02582/output.0.txt b/codenet/public_test_cases/p02582/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02582/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02582/output.1.txt b/codenet/public_test_cases/p02582/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02582/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02582/output.2.txt b/codenet/public_test_cases/p02582/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02582/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02582/output.3.txt b/codenet/public_test_cases/p02582/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02582/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02583/input.0.txt b/codenet/public_test_cases/p02583/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..454fff4e688c5f550a9c845bf2b31eb1ba73e33e --- /dev/null +++ b/codenet/public_test_cases/p02583/input.0.txt @@ -0,0 +1,2 @@ +5 +4 4 9 7 5 diff --git a/codenet/public_test_cases/p02583/input.1.txt b/codenet/public_test_cases/p02583/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..811797a5438c685df3973fb0fb0d816b7750605b --- /dev/null +++ b/codenet/public_test_cases/p02583/input.1.txt @@ -0,0 +1,2 @@ +2 +1 1 diff --git a/codenet/public_test_cases/p02583/input.2.txt b/codenet/public_test_cases/p02583/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..32351f9afae6ae3a5d1e55d675ee15d76812673c --- /dev/null +++ b/codenet/public_test_cases/p02583/input.2.txt @@ -0,0 +1,2 @@ +10 +9 4 6 1 9 6 10 6 6 8 diff --git a/codenet/public_test_cases/p02583/input.3.txt b/codenet/public_test_cases/p02583/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..60b114014350a3327f72f0c037fe347eecd801f7 --- /dev/null +++ b/codenet/public_test_cases/p02583/input.3.txt @@ -0,0 +1,2 @@ +6 +4 5 4 3 3 5 diff --git a/codenet/public_test_cases/p02583/input.4.txt b/codenet/public_test_cases/p02583/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..454fff4e688c5f550a9c845bf2b31eb1ba73e33e --- /dev/null +++ b/codenet/public_test_cases/p02583/input.4.txt @@ -0,0 +1,2 @@ +5 +4 4 9 7 5 diff --git a/codenet/public_test_cases/p02583/output.0.txt b/codenet/public_test_cases/p02583/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02583/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02583/output.1.txt b/codenet/public_test_cases/p02583/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02583/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02583/output.2.txt b/codenet/public_test_cases/p02583/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2720097dccb441015beb4f75766b9908ad46f5a --- /dev/null +++ b/codenet/public_test_cases/p02583/output.2.txt @@ -0,0 +1 @@ +39 diff --git a/codenet/public_test_cases/p02583/output.3.txt b/codenet/public_test_cases/p02583/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02583/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02583/output.4.txt b/codenet/public_test_cases/p02583/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02583/output.4.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02584/input.0.txt b/codenet/public_test_cases/p02584/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2602c8fd130acb24f62a5546d5d92c094ea93879 --- /dev/null +++ b/codenet/public_test_cases/p02584/input.0.txt @@ -0,0 +1 @@ +6 2 4 diff --git a/codenet/public_test_cases/p02584/input.1.txt b/codenet/public_test_cases/p02584/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d42c17717bb43285132e9dd4fb56fffbaa5a1d25 --- /dev/null +++ b/codenet/public_test_cases/p02584/input.1.txt @@ -0,0 +1 @@ +1000000000000000 1000000000000000 1000000000000000 diff --git a/codenet/public_test_cases/p02584/input.2.txt b/codenet/public_test_cases/p02584/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2602c8fd130acb24f62a5546d5d92c094ea93879 --- /dev/null +++ b/codenet/public_test_cases/p02584/input.2.txt @@ -0,0 +1 @@ +6 2 4 diff --git a/codenet/public_test_cases/p02584/input.3.txt b/codenet/public_test_cases/p02584/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8a79e2fe3adc6011533af5b1c2c87113ebfc5b9 --- /dev/null +++ b/codenet/public_test_cases/p02584/input.3.txt @@ -0,0 +1 @@ +10 1 2 diff --git a/codenet/public_test_cases/p02584/input.4.txt b/codenet/public_test_cases/p02584/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00b345f2ca09b703eb891d8b624d09dbf7167fb2 --- /dev/null +++ b/codenet/public_test_cases/p02584/input.4.txt @@ -0,0 +1 @@ +7 4 3 diff --git a/codenet/public_test_cases/p02584/output.0.txt b/codenet/public_test_cases/p02584/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02584/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02584/output.1.txt b/codenet/public_test_cases/p02584/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e19179d1f4498c45176c91ff570243171e71b925 --- /dev/null +++ b/codenet/public_test_cases/p02584/output.1.txt @@ -0,0 +1 @@ +1000000000000000 diff --git a/codenet/public_test_cases/p02584/output.2.txt b/codenet/public_test_cases/p02584/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02584/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02584/output.3.txt b/codenet/public_test_cases/p02584/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02584/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02584/output.4.txt b/codenet/public_test_cases/p02584/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02584/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02585/input.0.txt b/codenet/public_test_cases/p02585/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b26d0f9b4e269245864575d3baf3a5dcdf4d27 --- /dev/null +++ b/codenet/public_test_cases/p02585/input.0.txt @@ -0,0 +1,3 @@ +5 2 +2 4 5 1 3 +3 4 -10 -8 8 diff --git a/codenet/public_test_cases/p02585/input.1.txt b/codenet/public_test_cases/p02585/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1abb88aa2aafaf24b337798319fc89afd446ec91 --- /dev/null +++ b/codenet/public_test_cases/p02585/input.1.txt @@ -0,0 +1,3 @@ +10 58 +9 1 6 7 8 4 3 2 10 5 +695279662 988782657 -119067776 382975538 -151885171 -177220596 -169777795 37619092 389386780 980092719 diff --git a/codenet/public_test_cases/p02585/input.2.txt b/codenet/public_test_cases/p02585/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6dc57f6b99fdb74c33207a68314babb47e13ab0 --- /dev/null +++ b/codenet/public_test_cases/p02585/input.2.txt @@ -0,0 +1,3 @@ +3 3 +3 1 2 +-1000 -2000 -3000 diff --git a/codenet/public_test_cases/p02585/input.3.txt b/codenet/public_test_cases/p02585/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b26d0f9b4e269245864575d3baf3a5dcdf4d27 --- /dev/null +++ b/codenet/public_test_cases/p02585/input.3.txt @@ -0,0 +1,3 @@ +5 2 +2 4 5 1 3 +3 4 -10 -8 8 diff --git a/codenet/public_test_cases/p02585/input.4.txt b/codenet/public_test_cases/p02585/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfb8c8eefd37db97d8298e9c28b01c0a51ce48cc --- /dev/null +++ b/codenet/public_test_cases/p02585/input.4.txt @@ -0,0 +1,3 @@ +2 3 +2 1 +10 -7 diff --git a/codenet/public_test_cases/p02585/output.0.txt b/codenet/public_test_cases/p02585/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02585/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02585/output.1.txt b/codenet/public_test_cases/p02585/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc8b02a10e2fc6e4bf20b8ade0509a2e4cb797ea --- /dev/null +++ b/codenet/public_test_cases/p02585/output.1.txt @@ -0,0 +1 @@ +29507023469 diff --git a/codenet/public_test_cases/p02585/output.2.txt b/codenet/public_test_cases/p02585/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58fe91b0350048d23bd035a39afafebded76103f --- /dev/null +++ b/codenet/public_test_cases/p02585/output.2.txt @@ -0,0 +1 @@ +-1000 diff --git a/codenet/public_test_cases/p02585/output.3.txt b/codenet/public_test_cases/p02585/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02585/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02585/output.4.txt b/codenet/public_test_cases/p02585/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02585/output.4.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02586/input.0.txt b/codenet/public_test_cases/p02586/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..51f6d17cc07e790a5463122a0441f2157745efd2 --- /dev/null +++ b/codenet/public_test_cases/p02586/input.0.txt @@ -0,0 +1,4 @@ +2 2 3 +1 1 3 +2 1 4 +1 2 5 diff --git a/codenet/public_test_cases/p02586/input.1.txt b/codenet/public_test_cases/p02586/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..259bfb78e200181ddfe8e204b697193b96d032c9 --- /dev/null +++ b/codenet/public_test_cases/p02586/input.1.txt @@ -0,0 +1,6 @@ +2 5 5 +1 1 3 +2 4 20 +1 2 1 +1 3 4 +1 4 2 diff --git a/codenet/public_test_cases/p02586/input.2.txt b/codenet/public_test_cases/p02586/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..51f6d17cc07e790a5463122a0441f2157745efd2 --- /dev/null +++ b/codenet/public_test_cases/p02586/input.2.txt @@ -0,0 +1,4 @@ +2 2 3 +1 1 3 +2 1 4 +1 2 5 diff --git a/codenet/public_test_cases/p02586/input.3.txt b/codenet/public_test_cases/p02586/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..04a649366c974f582fc5059912ea1209f729b1ec --- /dev/null +++ b/codenet/public_test_cases/p02586/input.3.txt @@ -0,0 +1,11 @@ +4 5 10 +2 5 12 +1 5 12 +2 3 15 +1 2 20 +1 1 28 +2 4 26 +3 2 27 +4 5 21 +3 5 10 +1 3 10 diff --git a/codenet/public_test_cases/p02586/output.0.txt b/codenet/public_test_cases/p02586/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02586/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02586/output.1.txt b/codenet/public_test_cases/p02586/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f04c001f3f7fd5d290d0264b4a2c35f7b159ac42 --- /dev/null +++ b/codenet/public_test_cases/p02586/output.1.txt @@ -0,0 +1 @@ +29 diff --git a/codenet/public_test_cases/p02586/output.2.txt b/codenet/public_test_cases/p02586/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02586/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02586/output.3.txt b/codenet/public_test_cases/p02586/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaacbe6629108f0606d35f58a53c9f4e2f49405a --- /dev/null +++ b/codenet/public_test_cases/p02586/output.3.txt @@ -0,0 +1 @@ +142 diff --git a/codenet/public_test_cases/p02587/input.0.txt b/codenet/public_test_cases/p02587/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f7d50e6530519132f10d3aab3bcb32f285b03ed --- /dev/null +++ b/codenet/public_test_cases/p02587/input.0.txt @@ -0,0 +1,4 @@ +3 +ba 3 +abc 4 +cbaa 5 diff --git a/codenet/public_test_cases/p02587/input.1.txt b/codenet/public_test_cases/p02587/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3840680a41291d0b435447455c327faf10879cc4 --- /dev/null +++ b/codenet/public_test_cases/p02587/input.1.txt @@ -0,0 +1,3 @@ +2 +abc 1 +ab 2 diff --git a/codenet/public_test_cases/p02587/input.2.txt b/codenet/public_test_cases/p02587/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4b4c4de8c668ba7e2ba6b3144de2d7c62f96ccc --- /dev/null +++ b/codenet/public_test_cases/p02587/input.2.txt @@ -0,0 +1,5 @@ +4 +ab 5 +cba 3 +a 12 +ab 10 diff --git a/codenet/public_test_cases/p02587/input.3.txt b/codenet/public_test_cases/p02587/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..de05cc6e32e71a4cd6df88bbc28d9de6605be32f --- /dev/null +++ b/codenet/public_test_cases/p02587/input.3.txt @@ -0,0 +1,3 @@ +2 +abcab 5 +cba 3 diff --git a/codenet/public_test_cases/p02587/input.4.txt b/codenet/public_test_cases/p02587/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f7d50e6530519132f10d3aab3bcb32f285b03ed --- /dev/null +++ b/codenet/public_test_cases/p02587/input.4.txt @@ -0,0 +1,4 @@ +3 +ba 3 +abc 4 +cbaa 5 diff --git a/codenet/public_test_cases/p02587/output.0.txt b/codenet/public_test_cases/p02587/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02587/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02587/output.1.txt b/codenet/public_test_cases/p02587/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02587/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02587/output.2.txt b/codenet/public_test_cases/p02587/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02587/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02587/output.3.txt b/codenet/public_test_cases/p02587/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02587/output.3.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02587/output.4.txt b/codenet/public_test_cases/p02587/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02587/output.4.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02588/input.0.txt b/codenet/public_test_cases/p02588/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b6f816306e6e1eeeff71bf6343171ab4bce6834 --- /dev/null +++ b/codenet/public_test_cases/p02588/input.0.txt @@ -0,0 +1,6 @@ +5 +7.5 +2.4 +17.000000001 +17 +16.000000000 diff --git a/codenet/public_test_cases/p02588/input.1.txt b/codenet/public_test_cases/p02588/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b6f816306e6e1eeeff71bf6343171ab4bce6834 --- /dev/null +++ b/codenet/public_test_cases/p02588/input.1.txt @@ -0,0 +1,6 @@ +5 +7.5 +2.4 +17.000000001 +17 +16.000000000 diff --git a/codenet/public_test_cases/p02588/input.2.txt b/codenet/public_test_cases/p02588/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a07273827197fa71d0169e67bd245d07cc1e643 --- /dev/null +++ b/codenet/public_test_cases/p02588/input.2.txt @@ -0,0 +1,12 @@ +11 +0.9 +1 +1 +1.25 +2.30000 +5 +70 +0.000000001 +9999.999999999 +0.999999999 +1.000000001 diff --git a/codenet/public_test_cases/p02588/output.0.txt b/codenet/public_test_cases/p02588/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02588/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02588/output.1.txt b/codenet/public_test_cases/p02588/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02588/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02588/output.2.txt b/codenet/public_test_cases/p02588/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02588/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02589/input.0.txt b/codenet/public_test_cases/p02589/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bc1f50d49d6503f7ebd3533fe6e182259b5a480 --- /dev/null +++ b/codenet/public_test_cases/p02589/input.0.txt @@ -0,0 +1,4 @@ +3 +abcxyx +cyx +abc diff --git a/codenet/public_test_cases/p02589/input.1.txt b/codenet/public_test_cases/p02589/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c60b2cc483c358aadc6c8d76939d2ce4681b8337 --- /dev/null +++ b/codenet/public_test_cases/p02589/input.1.txt @@ -0,0 +1,7 @@ +6 +b +a +abc +c +d +ab diff --git a/codenet/public_test_cases/p02589/input.2.txt b/codenet/public_test_cases/p02589/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bc1f50d49d6503f7ebd3533fe6e182259b5a480 --- /dev/null +++ b/codenet/public_test_cases/p02589/input.2.txt @@ -0,0 +1,4 @@ +3 +abcxyx +cyx +abc diff --git a/codenet/public_test_cases/p02589/output.0.txt b/codenet/public_test_cases/p02589/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02589/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02589/output.1.txt b/codenet/public_test_cases/p02589/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02589/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02589/output.2.txt b/codenet/public_test_cases/p02589/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02589/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02590/input.0.txt b/codenet/public_test_cases/p02590/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ad97b5bdc95256e02ebcda2eafb9b509a510ec4 --- /dev/null +++ b/codenet/public_test_cases/p02590/input.0.txt @@ -0,0 +1,2 @@ +4 +2019 0 2020 200002 diff --git a/codenet/public_test_cases/p02590/input.1.txt b/codenet/public_test_cases/p02590/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ad97b5bdc95256e02ebcda2eafb9b509a510ec4 --- /dev/null +++ b/codenet/public_test_cases/p02590/input.1.txt @@ -0,0 +1,2 @@ +4 +2019 0 2020 200002 diff --git a/codenet/public_test_cases/p02590/input.2.txt b/codenet/public_test_cases/p02590/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..969296862cbffaa5d17a866014169d7b5bd35d49 --- /dev/null +++ b/codenet/public_test_cases/p02590/input.2.txt @@ -0,0 +1,2 @@ +5 +1 1 2 2 100000 diff --git a/codenet/public_test_cases/p02590/output.0.txt b/codenet/public_test_cases/p02590/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..961558b5f0929a52990cb036f86077ba14481ad9 --- /dev/null +++ b/codenet/public_test_cases/p02590/output.0.txt @@ -0,0 +1 @@ +474287 diff --git a/codenet/public_test_cases/p02590/output.1.txt b/codenet/public_test_cases/p02590/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..961558b5f0929a52990cb036f86077ba14481ad9 --- /dev/null +++ b/codenet/public_test_cases/p02590/output.1.txt @@ -0,0 +1 @@ +474287 diff --git a/codenet/public_test_cases/p02590/output.2.txt b/codenet/public_test_cases/p02590/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eebf85bf7b8f677b836a84e0720f26699c7a65e7 --- /dev/null +++ b/codenet/public_test_cases/p02590/output.2.txt @@ -0,0 +1 @@ +600013 diff --git a/codenet/public_test_cases/p02591/input.0.txt b/codenet/public_test_cases/p02591/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bceac7f5281acd3a58edc1b0c442832cb547743 --- /dev/null +++ b/codenet/public_test_cases/p02591/input.0.txt @@ -0,0 +1,2 @@ +3 +2 3 1 4 diff --git a/codenet/public_test_cases/p02591/input.1.txt b/codenet/public_test_cases/p02591/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p02591/input.1.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p02591/input.2.txt b/codenet/public_test_cases/p02591/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bceac7f5281acd3a58edc1b0c442832cb547743 --- /dev/null +++ b/codenet/public_test_cases/p02591/input.2.txt @@ -0,0 +1,2 @@ +3 +2 3 1 4 diff --git a/codenet/public_test_cases/p02591/input.3.txt b/codenet/public_test_cases/p02591/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..94e83ec0d1a311b4437b4be32c7956b60deae514 --- /dev/null +++ b/codenet/public_test_cases/p02591/input.3.txt @@ -0,0 +1,2 @@ +5 +6 14 15 7 12 16 5 4 11 9 3 10 8 2 13 1 diff --git a/codenet/public_test_cases/p02591/output.0.txt b/codenet/public_test_cases/p02591/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04ac8ccee01e61d3268a7e42a459a8b8fed136 --- /dev/null +++ b/codenet/public_test_cases/p02591/output.0.txt @@ -0,0 +1 @@ +121788 diff --git a/codenet/public_test_cases/p02591/output.1.txt b/codenet/public_test_cases/p02591/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p02591/output.1.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p02591/output.2.txt b/codenet/public_test_cases/p02591/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04ac8ccee01e61d3268a7e42a459a8b8fed136 --- /dev/null +++ b/codenet/public_test_cases/p02591/output.2.txt @@ -0,0 +1 @@ +121788 diff --git a/codenet/public_test_cases/p02591/output.3.txt b/codenet/public_test_cases/p02591/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f8e24f49e04768905b67481225338a7cfde33b1 --- /dev/null +++ b/codenet/public_test_cases/p02591/output.3.txt @@ -0,0 +1 @@ +10199246 diff --git a/codenet/public_test_cases/p02592/input.1.txt b/codenet/public_test_cases/p02592/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02592/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02592/output.1.txt b/codenet/public_test_cases/p02592/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02592/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02593/input.0.txt b/codenet/public_test_cases/p02593/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14619e899af331f86bfdd47ba6ae33599c152ddb --- /dev/null +++ b/codenet/public_test_cases/p02593/input.0.txt @@ -0,0 +1,7 @@ +6 +1 8 +6 10 +2 7 +4 4 +9 3 +5 1 diff --git a/codenet/public_test_cases/p02593/input.1.txt b/codenet/public_test_cases/p02593/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14619e899af331f86bfdd47ba6ae33599c152ddb --- /dev/null +++ b/codenet/public_test_cases/p02593/input.1.txt @@ -0,0 +1,7 @@ +6 +1 8 +6 10 +2 7 +4 4 +9 3 +5 1 diff --git a/codenet/public_test_cases/p02593/input.2.txt b/codenet/public_test_cases/p02593/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8072bb7585c68c8d5adf54ab22c43eda7a101f0e --- /dev/null +++ b/codenet/public_test_cases/p02593/input.2.txt @@ -0,0 +1,6 @@ +5 +5 5 +100 100 +70 20 +81 70 +800 1 diff --git a/codenet/public_test_cases/p02593/input.3.txt b/codenet/public_test_cases/p02593/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..080296ea9c1c344694a042a3ee75ff731e876edc --- /dev/null +++ b/codenet/public_test_cases/p02593/input.3.txt @@ -0,0 +1,11 @@ +10 +2 5 +4 4 +13 12 +12 13 +14 17 +17 19 +22 22 +16 18 +19 27 +25 26 diff --git a/codenet/public_test_cases/p02593/output.0.txt b/codenet/public_test_cases/p02593/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d30a0b069b8ffe1d1d3e960bc600bf73f8597f65 --- /dev/null +++ b/codenet/public_test_cases/p02593/output.0.txt @@ -0,0 +1,6 @@ +5 +0 +7 +5 +0 +0 diff --git a/codenet/public_test_cases/p02593/output.1.txt b/codenet/public_test_cases/p02593/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d30a0b069b8ffe1d1d3e960bc600bf73f8597f65 --- /dev/null +++ b/codenet/public_test_cases/p02593/output.1.txt @@ -0,0 +1,6 @@ +5 +0 +7 +5 +0 +0 diff --git a/codenet/public_test_cases/p02593/output.2.txt b/codenet/public_test_cases/p02593/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9aab818ae32d6b34520dec19701aa1f5fa156c5 --- /dev/null +++ b/codenet/public_test_cases/p02593/output.2.txt @@ -0,0 +1,5 @@ +985 +985 +1065 +1034 +0 diff --git a/codenet/public_test_cases/p02593/output.3.txt b/codenet/public_test_cases/p02593/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5f407f832a423e4b9730cd0da5a7b460c0d0ff7 --- /dev/null +++ b/codenet/public_test_cases/p02593/output.3.txt @@ -0,0 +1,10 @@ +2 +2 +9 +9 +3 +3 +24 +5 +0 +25 diff --git a/codenet/public_test_cases/p02594/input.0.txt b/codenet/public_test_cases/p02594/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02594/input.0.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02594/input.1.txt b/codenet/public_test_cases/p02594/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02594/input.1.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02594/input.2.txt b/codenet/public_test_cases/p02594/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p02594/input.2.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p02594/output.0.txt b/codenet/public_test_cases/p02594/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02594/output.0.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02594/output.1.txt b/codenet/public_test_cases/p02594/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02594/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02594/output.2.txt b/codenet/public_test_cases/p02594/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02594/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02595/input.0.txt b/codenet/public_test_cases/p02595/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5ed69a100a599ef1ab24ae7906bfb4267a7757a --- /dev/null +++ b/codenet/public_test_cases/p02595/input.0.txt @@ -0,0 +1,5 @@ +4 5 +0 5 +-2 4 +3 4 +4 -4 diff --git a/codenet/public_test_cases/p02595/input.1.txt b/codenet/public_test_cases/p02595/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3663054bb0d601e84841c07896eeedd2177d4006 --- /dev/null +++ b/codenet/public_test_cases/p02595/input.1.txt @@ -0,0 +1,13 @@ +12 3 +1 1 +1 1 +1 1 +1 1 +1 2 +1 3 +2 1 +2 2 +2 3 +3 1 +3 2 +3 3 diff --git a/codenet/public_test_cases/p02595/input.2.txt b/codenet/public_test_cases/p02595/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5ed69a100a599ef1ab24ae7906bfb4267a7757a --- /dev/null +++ b/codenet/public_test_cases/p02595/input.2.txt @@ -0,0 +1,5 @@ +4 5 +0 5 +-2 4 +3 4 +4 -4 diff --git a/codenet/public_test_cases/p02595/input.3.txt b/codenet/public_test_cases/p02595/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bfd4e08af05b33a1ee1c6237568b7644049a0e5 --- /dev/null +++ b/codenet/public_test_cases/p02595/input.3.txt @@ -0,0 +1,21 @@ +20 100000 +14309 -32939 +-56855 100340 +151364 25430 +103789 -113141 +147404 -136977 +-37006 -30929 +188810 -49557 +13419 70401 +-88280 165170 +-196399 137941 +-176527 -61904 +46659 115261 +-153551 114185 +98784 -6820 +94111 -86268 +-30401 61477 +-55056 7872 +5901 -163796 +138819 -185986 +-69848 -96669 diff --git a/codenet/public_test_cases/p02595/output.0.txt b/codenet/public_test_cases/p02595/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02595/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02595/output.1.txt b/codenet/public_test_cases/p02595/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02595/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02595/output.2.txt b/codenet/public_test_cases/p02595/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02595/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02595/output.3.txt b/codenet/public_test_cases/p02595/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02595/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02596/input.0.txt b/codenet/public_test_cases/p02596/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..398050c62c882fa5ebc8d8aaa2e730e70790beeb --- /dev/null +++ b/codenet/public_test_cases/p02596/input.0.txt @@ -0,0 +1 @@ +101 diff --git a/codenet/public_test_cases/p02596/input.1.txt b/codenet/public_test_cases/p02596/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02596/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02596/input.2.txt b/codenet/public_test_cases/p02596/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..853886599ba67625c4c0a7866a91b8ff405ca9dd --- /dev/null +++ b/codenet/public_test_cases/p02596/input.2.txt @@ -0,0 +1 @@ +999983 diff --git a/codenet/public_test_cases/p02596/input.3.txt b/codenet/public_test_cases/p02596/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..398050c62c882fa5ebc8d8aaa2e730e70790beeb --- /dev/null +++ b/codenet/public_test_cases/p02596/input.3.txt @@ -0,0 +1 @@ +101 diff --git a/codenet/public_test_cases/p02596/output.0.txt b/codenet/public_test_cases/p02596/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02596/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02596/output.1.txt b/codenet/public_test_cases/p02596/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02596/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02596/output.2.txt b/codenet/public_test_cases/p02596/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1038b75d12f2a05e0eef03a309d0848a3e85a13d --- /dev/null +++ b/codenet/public_test_cases/p02596/output.2.txt @@ -0,0 +1 @@ +999982 diff --git a/codenet/public_test_cases/p02596/output.3.txt b/codenet/public_test_cases/p02596/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02596/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02597/input.0.txt b/codenet/public_test_cases/p02597/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2a2bd29440de2c3a1c031976185cdd36f17b114 --- /dev/null +++ b/codenet/public_test_cases/p02597/input.0.txt @@ -0,0 +1,2 @@ +4 +WWRR diff --git a/codenet/public_test_cases/p02597/input.1.txt b/codenet/public_test_cases/p02597/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..52ac81bee35a27662e73b9291055a3b7112db594 --- /dev/null +++ b/codenet/public_test_cases/p02597/input.1.txt @@ -0,0 +1,2 @@ +2 +RR diff --git a/codenet/public_test_cases/p02597/input.2.txt b/codenet/public_test_cases/p02597/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2a2bd29440de2c3a1c031976185cdd36f17b114 --- /dev/null +++ b/codenet/public_test_cases/p02597/input.2.txt @@ -0,0 +1,2 @@ +4 +WWRR diff --git a/codenet/public_test_cases/p02597/input.3.txt b/codenet/public_test_cases/p02597/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffc309811f63cefaf9ef88dd30ba4c805609f6c5 --- /dev/null +++ b/codenet/public_test_cases/p02597/input.3.txt @@ -0,0 +1,2 @@ +8 +WRWWRWRR diff --git a/codenet/public_test_cases/p02597/output.0.txt b/codenet/public_test_cases/p02597/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02597/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02597/output.1.txt b/codenet/public_test_cases/p02597/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02597/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02597/output.2.txt b/codenet/public_test_cases/p02597/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02597/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02597/output.3.txt b/codenet/public_test_cases/p02597/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02597/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02598/input.0.txt b/codenet/public_test_cases/p02598/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..917dc9f2c29aa764b7dafd8b7acd1a73f340b05d --- /dev/null +++ b/codenet/public_test_cases/p02598/input.0.txt @@ -0,0 +1,2 @@ +2 3 +7 9 diff --git a/codenet/public_test_cases/p02598/input.1.txt b/codenet/public_test_cases/p02598/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5d279cd3df212605b268426c661517510dd0bd1 --- /dev/null +++ b/codenet/public_test_cases/p02598/input.1.txt @@ -0,0 +1,2 @@ +3 0 +3 4 5 diff --git a/codenet/public_test_cases/p02598/input.2.txt b/codenet/public_test_cases/p02598/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..917dc9f2c29aa764b7dafd8b7acd1a73f340b05d --- /dev/null +++ b/codenet/public_test_cases/p02598/input.2.txt @@ -0,0 +1,2 @@ +2 3 +7 9 diff --git a/codenet/public_test_cases/p02598/input.3.txt b/codenet/public_test_cases/p02598/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8118a9bb9156013b5f4af1060aab714803e85185 --- /dev/null +++ b/codenet/public_test_cases/p02598/input.3.txt @@ -0,0 +1,2 @@ +10 10 +158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202 diff --git a/codenet/public_test_cases/p02598/output.0.txt b/codenet/public_test_cases/p02598/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02598/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02598/output.1.txt b/codenet/public_test_cases/p02598/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02598/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02598/output.2.txt b/codenet/public_test_cases/p02598/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02598/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02598/output.3.txt b/codenet/public_test_cases/p02598/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..57363d0669935d8e4f452d4ffa99fc2ab6cc7525 --- /dev/null +++ b/codenet/public_test_cases/p02598/output.3.txt @@ -0,0 +1 @@ +292638192 diff --git a/codenet/public_test_cases/p02599/input.0.txt b/codenet/public_test_cases/p02599/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcd60de6af9fa8d973da4b5c7d3190dd06824e22 --- /dev/null +++ b/codenet/public_test_cases/p02599/input.0.txt @@ -0,0 +1,5 @@ +4 3 +1 2 1 3 +1 3 +2 4 +3 3 diff --git a/codenet/public_test_cases/p02599/input.1.txt b/codenet/public_test_cases/p02599/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcd60de6af9fa8d973da4b5c7d3190dd06824e22 --- /dev/null +++ b/codenet/public_test_cases/p02599/input.1.txt @@ -0,0 +1,5 @@ +4 3 +1 2 1 3 +1 3 +2 4 +3 3 diff --git a/codenet/public_test_cases/p02599/input.2.txt b/codenet/public_test_cases/p02599/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..64e2a8ce5f6643703a72bde560ae8a04bc5d70f7 --- /dev/null +++ b/codenet/public_test_cases/p02599/input.2.txt @@ -0,0 +1,12 @@ +10 10 +2 5 6 5 2 1 7 9 7 2 +5 5 +2 4 +6 7 +2 2 +7 8 +7 9 +1 8 +6 9 +8 10 +6 8 diff --git a/codenet/public_test_cases/p02599/output.0.txt b/codenet/public_test_cases/p02599/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..17435e586d4e2ca33fd1d88b9e75f547d157aaa8 --- /dev/null +++ b/codenet/public_test_cases/p02599/output.0.txt @@ -0,0 +1,3 @@ +2 +3 +1 diff --git a/codenet/public_test_cases/p02599/output.1.txt b/codenet/public_test_cases/p02599/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..17435e586d4e2ca33fd1d88b9e75f547d157aaa8 --- /dev/null +++ b/codenet/public_test_cases/p02599/output.1.txt @@ -0,0 +1,3 @@ +2 +3 +1 diff --git a/codenet/public_test_cases/p02599/output.2.txt b/codenet/public_test_cases/p02599/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d10fdceabe7bd2f2fd83f8f39818c2dbcdc07c3b --- /dev/null +++ b/codenet/public_test_cases/p02599/output.2.txt @@ -0,0 +1,10 @@ +1 +2 +2 +1 +2 +2 +6 +3 +3 +3 diff --git a/codenet/public_test_cases/p02600/input.0.txt b/codenet/public_test_cases/p02600/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8c40655eeeb8396127ea5e606a79df650b125e2 --- /dev/null +++ b/codenet/public_test_cases/p02600/input.0.txt @@ -0,0 +1 @@ +725 diff --git a/codenet/public_test_cases/p02600/input.1.txt b/codenet/public_test_cases/p02600/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8c40655eeeb8396127ea5e606a79df650b125e2 --- /dev/null +++ b/codenet/public_test_cases/p02600/input.1.txt @@ -0,0 +1 @@ +725 diff --git a/codenet/public_test_cases/p02600/input.2.txt b/codenet/public_test_cases/p02600/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b67470f1dcac75b24dd729807911b72b0d052cb3 --- /dev/null +++ b/codenet/public_test_cases/p02600/input.2.txt @@ -0,0 +1 @@ +1600 diff --git a/codenet/public_test_cases/p02600/output.0.txt b/codenet/public_test_cases/p02600/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02600/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02600/output.1.txt b/codenet/public_test_cases/p02600/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02600/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02600/output.2.txt b/codenet/public_test_cases/p02600/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02600/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02601/input.0.txt b/codenet/public_test_cases/p02601/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d544b611f7f815d4ffcf4d5b1e17050bbb6682a --- /dev/null +++ b/codenet/public_test_cases/p02601/input.0.txt @@ -0,0 +1,2 @@ +7 2 5 +3 diff --git a/codenet/public_test_cases/p02601/input.1.txt b/codenet/public_test_cases/p02601/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e5f9b4df6d55901fbcfbcf09a528bd6f449a212 --- /dev/null +++ b/codenet/public_test_cases/p02601/input.1.txt @@ -0,0 +1,2 @@ +7 4 2 +3 diff --git a/codenet/public_test_cases/p02601/input.2.txt b/codenet/public_test_cases/p02601/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d544b611f7f815d4ffcf4d5b1e17050bbb6682a --- /dev/null +++ b/codenet/public_test_cases/p02601/input.2.txt @@ -0,0 +1,2 @@ +7 2 5 +3 diff --git a/codenet/public_test_cases/p02601/output.0.txt b/codenet/public_test_cases/p02601/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02601/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02601/output.1.txt b/codenet/public_test_cases/p02601/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02601/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02601/output.2.txt b/codenet/public_test_cases/p02601/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02601/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02602/input.0.txt b/codenet/public_test_cases/p02602/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6c2a4f265c4671c024d93548c9adf05bc8def36 --- /dev/null +++ b/codenet/public_test_cases/p02602/input.0.txt @@ -0,0 +1,2 @@ +5 3 +96 98 95 100 20 diff --git a/codenet/public_test_cases/p02602/input.1.txt b/codenet/public_test_cases/p02602/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c521c43f6ad6e2f297795421d02dc417f6f626c6 --- /dev/null +++ b/codenet/public_test_cases/p02602/input.1.txt @@ -0,0 +1,2 @@ +3 2 +1001 869120 1001 diff --git a/codenet/public_test_cases/p02602/input.2.txt b/codenet/public_test_cases/p02602/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d173b8b7b17d8992a3e8f62a02701ee0edd979d --- /dev/null +++ b/codenet/public_test_cases/p02602/input.2.txt @@ -0,0 +1,2 @@ +15 7 +3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 diff --git a/codenet/public_test_cases/p02602/input.3.txt b/codenet/public_test_cases/p02602/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6c2a4f265c4671c024d93548c9adf05bc8def36 --- /dev/null +++ b/codenet/public_test_cases/p02602/input.3.txt @@ -0,0 +1,2 @@ +5 3 +96 98 95 100 20 diff --git a/codenet/public_test_cases/p02602/output.0.txt b/codenet/public_test_cases/p02602/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p02602/output.0.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p02602/output.1.txt b/codenet/public_test_cases/p02602/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02602/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02602/output.2.txt b/codenet/public_test_cases/p02602/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..39c2a7d2cc2523de4a075a2eaa972ab8e1622186 --- /dev/null +++ b/codenet/public_test_cases/p02602/output.2.txt @@ -0,0 +1,8 @@ +Yes +Yes +No +Yes +Yes +No +Yes +Yes diff --git a/codenet/public_test_cases/p02602/output.3.txt b/codenet/public_test_cases/p02602/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae3bc8e3d735ce4d53ce0b1a3355508929035da --- /dev/null +++ b/codenet/public_test_cases/p02602/output.3.txt @@ -0,0 +1,2 @@ +Yes +No diff --git a/codenet/public_test_cases/p02603/input.0.txt b/codenet/public_test_cases/p02603/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be941ecafa0f269bdf86be0028072f050bebb123 --- /dev/null +++ b/codenet/public_test_cases/p02603/input.0.txt @@ -0,0 +1,2 @@ +7 +100 130 130 130 115 115 150 diff --git a/codenet/public_test_cases/p02603/input.1.txt b/codenet/public_test_cases/p02603/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c64869313dc49bf24ef163a646a81b6af666362 --- /dev/null +++ b/codenet/public_test_cases/p02603/input.1.txt @@ -0,0 +1,2 @@ +2 +157 193 diff --git a/codenet/public_test_cases/p02603/input.2.txt b/codenet/public_test_cases/p02603/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..be941ecafa0f269bdf86be0028072f050bebb123 --- /dev/null +++ b/codenet/public_test_cases/p02603/input.2.txt @@ -0,0 +1,2 @@ +7 +100 130 130 130 115 115 150 diff --git a/codenet/public_test_cases/p02603/input.3.txt b/codenet/public_test_cases/p02603/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c4f583bfd988b84cf6590ead45ba1534351561f --- /dev/null +++ b/codenet/public_test_cases/p02603/input.3.txt @@ -0,0 +1,2 @@ +6 +200 180 160 140 120 100 diff --git a/codenet/public_test_cases/p02603/output.0.txt b/codenet/public_test_cases/p02603/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e41cd7af590171037af34321d044d3e5954ed300 --- /dev/null +++ b/codenet/public_test_cases/p02603/output.0.txt @@ -0,0 +1 @@ +1685 diff --git a/codenet/public_test_cases/p02603/output.1.txt b/codenet/public_test_cases/p02603/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc7bb991e4e161d1b33f46d0796d54fec72bdb95 --- /dev/null +++ b/codenet/public_test_cases/p02603/output.1.txt @@ -0,0 +1 @@ +1216 diff --git a/codenet/public_test_cases/p02603/output.2.txt b/codenet/public_test_cases/p02603/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e41cd7af590171037af34321d044d3e5954ed300 --- /dev/null +++ b/codenet/public_test_cases/p02603/output.2.txt @@ -0,0 +1 @@ +1685 diff --git a/codenet/public_test_cases/p02603/output.3.txt b/codenet/public_test_cases/p02603/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b33d238dab9943201aaf267f701e8ea5fc9268 --- /dev/null +++ b/codenet/public_test_cases/p02603/output.3.txt @@ -0,0 +1 @@ +1000 diff --git a/codenet/public_test_cases/p02604/input.0.txt b/codenet/public_test_cases/p02604/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..671bd03885251858ca83f83a6dc30ee3c3faeb54 --- /dev/null +++ b/codenet/public_test_cases/p02604/input.0.txt @@ -0,0 +1,4 @@ +3 +1 2 300 +3 3 600 +1 4 800 diff --git a/codenet/public_test_cases/p02604/input.1.txt b/codenet/public_test_cases/p02604/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5e789dd2b8adad159f8c432232081043dc999b2 --- /dev/null +++ b/codenet/public_test_cases/p02604/input.1.txt @@ -0,0 +1,9 @@ +8 +2 2 286017 +3 1 262355 +2 -2 213815 +1 -3 224435 +-2 -2 136860 +-3 -1 239338 +-2 2 217647 +-1 3 141903 diff --git a/codenet/public_test_cases/p02604/input.2.txt b/codenet/public_test_cases/p02604/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d062232a3bcfedc12b270a5d6446212cb51b9cd9 --- /dev/null +++ b/codenet/public_test_cases/p02604/input.2.txt @@ -0,0 +1,6 @@ +5 +3 5 400 +5 3 700 +5 5 1000 +5 7 700 +7 5 400 diff --git a/codenet/public_test_cases/p02604/input.3.txt b/codenet/public_test_cases/p02604/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e821f8bea4cc8922da69c5a487d87499b93c48f7 --- /dev/null +++ b/codenet/public_test_cases/p02604/input.3.txt @@ -0,0 +1,7 @@ +6 +2 5 1000 +5 2 1100 +5 5 1700 +-2 -5 900 +-5 -2 600 +-5 -5 2200 diff --git a/codenet/public_test_cases/p02604/input.4.txt b/codenet/public_test_cases/p02604/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..671bd03885251858ca83f83a6dc30ee3c3faeb54 --- /dev/null +++ b/codenet/public_test_cases/p02604/input.4.txt @@ -0,0 +1,4 @@ +3 +1 2 300 +3 3 600 +1 4 800 diff --git a/codenet/public_test_cases/p02604/output.0.txt b/codenet/public_test_cases/p02604/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..43a806a253c77877ce3b6792b51cb49ff763dc28 --- /dev/null +++ b/codenet/public_test_cases/p02604/output.0.txt @@ -0,0 +1,4 @@ +2900 +900 +0 +0 diff --git a/codenet/public_test_cases/p02604/output.1.txt b/codenet/public_test_cases/p02604/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bf1e35dccdb336fe9a25c7a9d5271fee4da522c --- /dev/null +++ b/codenet/public_test_cases/p02604/output.1.txt @@ -0,0 +1,9 @@ +2576709 +1569381 +868031 +605676 +366338 +141903 +0 +0 +0 diff --git a/codenet/public_test_cases/p02604/output.2.txt b/codenet/public_test_cases/p02604/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..873083433e2dc9f31676ff1a0b2bfb1850829e76 --- /dev/null +++ b/codenet/public_test_cases/p02604/output.2.txt @@ -0,0 +1,6 @@ +13800 +1600 +0 +0 +0 +0 diff --git a/codenet/public_test_cases/p02604/output.3.txt b/codenet/public_test_cases/p02604/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e282da986e6bbe506af30cccb07057308060533 --- /dev/null +++ b/codenet/public_test_cases/p02604/output.3.txt @@ -0,0 +1,7 @@ +26700 +13900 +3200 +1200 +0 +0 +0 diff --git a/codenet/public_test_cases/p02604/output.4.txt b/codenet/public_test_cases/p02604/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..43a806a253c77877ce3b6792b51cb49ff763dc28 --- /dev/null +++ b/codenet/public_test_cases/p02604/output.4.txt @@ -0,0 +1,4 @@ +2900 +900 +0 +0 diff --git a/codenet/public_test_cases/p02605/input.0.txt b/codenet/public_test_cases/p02605/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6919a63054b2be491ff8e2ef0294f09d8792c71 --- /dev/null +++ b/codenet/public_test_cases/p02605/input.0.txt @@ -0,0 +1,3 @@ +2 +11 1 U +11 47 D diff --git a/codenet/public_test_cases/p02605/input.1.txt b/codenet/public_test_cases/p02605/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e38746a445ec23a90c83ff632f54405b2f748ab --- /dev/null +++ b/codenet/public_test_cases/p02605/input.1.txt @@ -0,0 +1,9 @@ +8 +168 224 U +130 175 R +111 198 D +121 188 L +201 116 U +112 121 R +145 239 D +185 107 L diff --git a/codenet/public_test_cases/p02605/input.2.txt b/codenet/public_test_cases/p02605/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..df16fead7f52d38201003f36f9c823b26b7f2e12 --- /dev/null +++ b/codenet/public_test_cases/p02605/input.2.txt @@ -0,0 +1,5 @@ +4 +20 30 U +30 20 R +20 10 D +10 20 L diff --git a/codenet/public_test_cases/p02605/input.3.txt b/codenet/public_test_cases/p02605/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6919a63054b2be491ff8e2ef0294f09d8792c71 --- /dev/null +++ b/codenet/public_test_cases/p02605/input.3.txt @@ -0,0 +1,3 @@ +2 +11 1 U +11 47 D diff --git a/codenet/public_test_cases/p02605/output.0.txt b/codenet/public_test_cases/p02605/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcb6b5baa1d74755be849bad4c15f5b269ef4b4c --- /dev/null +++ b/codenet/public_test_cases/p02605/output.0.txt @@ -0,0 +1 @@ +230 diff --git a/codenet/public_test_cases/p02605/output.1.txt b/codenet/public_test_cases/p02605/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02605/output.1.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02605/output.2.txt b/codenet/public_test_cases/p02605/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2992ee7d2dfaa81f3f94109fb7bc8a7c06b9f42 --- /dev/null +++ b/codenet/public_test_cases/p02605/output.2.txt @@ -0,0 +1 @@ +SAFE diff --git a/codenet/public_test_cases/p02605/output.3.txt b/codenet/public_test_cases/p02605/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcb6b5baa1d74755be849bad4c15f5b269ef4b4c --- /dev/null +++ b/codenet/public_test_cases/p02605/output.3.txt @@ -0,0 +1 @@ +230 diff --git a/codenet/public_test_cases/p02606/input.0.txt b/codenet/public_test_cases/p02606/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ba5ae193fcd3c0fdff145997b8f8b04ea6d7261 --- /dev/null +++ b/codenet/public_test_cases/p02606/input.0.txt @@ -0,0 +1 @@ +5 10 2 diff --git a/codenet/public_test_cases/p02606/input.1.txt b/codenet/public_test_cases/p02606/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec0b3630c6bae4a6bd246a231cfd39694b2ff261 --- /dev/null +++ b/codenet/public_test_cases/p02606/input.1.txt @@ -0,0 +1 @@ +1 100 1 diff --git a/codenet/public_test_cases/p02606/input.2.txt b/codenet/public_test_cases/p02606/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9e4815548a06cb4391d6bae942ee5fd11a1dc55 --- /dev/null +++ b/codenet/public_test_cases/p02606/input.2.txt @@ -0,0 +1 @@ +6 20 7 diff --git a/codenet/public_test_cases/p02606/input.3.txt b/codenet/public_test_cases/p02606/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ba5ae193fcd3c0fdff145997b8f8b04ea6d7261 --- /dev/null +++ b/codenet/public_test_cases/p02606/input.3.txt @@ -0,0 +1 @@ +5 10 2 diff --git a/codenet/public_test_cases/p02606/output.0.txt b/codenet/public_test_cases/p02606/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02606/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02606/output.1.txt b/codenet/public_test_cases/p02606/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02606/output.1.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02606/output.2.txt b/codenet/public_test_cases/p02606/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02606/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02606/output.3.txt b/codenet/public_test_cases/p02606/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02606/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02607/input.0.txt b/codenet/public_test_cases/p02607/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b887a2dc2118d780025828da1260cea59e77c5 --- /dev/null +++ b/codenet/public_test_cases/p02607/input.0.txt @@ -0,0 +1,2 @@ +5 +1 3 4 5 7 diff --git a/codenet/public_test_cases/p02607/input.1.txt b/codenet/public_test_cases/p02607/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a81a781f0329a521cb916796c2cf2c2aa369a175 --- /dev/null +++ b/codenet/public_test_cases/p02607/input.1.txt @@ -0,0 +1,2 @@ +15 +13 76 46 15 50 98 93 77 31 43 84 90 6 24 14 diff --git a/codenet/public_test_cases/p02607/input.2.txt b/codenet/public_test_cases/p02607/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b887a2dc2118d780025828da1260cea59e77c5 --- /dev/null +++ b/codenet/public_test_cases/p02607/input.2.txt @@ -0,0 +1,2 @@ +5 +1 3 4 5 7 diff --git a/codenet/public_test_cases/p02607/output.0.txt b/codenet/public_test_cases/p02607/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02607/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02607/output.1.txt b/codenet/public_test_cases/p02607/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02607/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02607/output.2.txt b/codenet/public_test_cases/p02607/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02607/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02608/input.0.txt b/codenet/public_test_cases/p02608/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p02608/input.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p02608/input.1.txt b/codenet/public_test_cases/p02608/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p02608/input.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p02608/output.0.txt b/codenet/public_test_cases/p02608/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33a384de798515e4cec2d7b792b94aadcdbfb568 --- /dev/null +++ b/codenet/public_test_cases/p02608/output.0.txt @@ -0,0 +1,20 @@ +0 +0 +0 +0 +0 +1 +0 +0 +0 +0 +3 +0 +0 +0 +0 +0 +3 +3 +0 +0 diff --git a/codenet/public_test_cases/p02608/output.1.txt b/codenet/public_test_cases/p02608/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..33a384de798515e4cec2d7b792b94aadcdbfb568 --- /dev/null +++ b/codenet/public_test_cases/p02608/output.1.txt @@ -0,0 +1,20 @@ +0 +0 +0 +0 +0 +1 +0 +0 +0 +0 +3 +0 +0 +0 +0 +0 +3 +3 +0 +0 diff --git a/codenet/public_test_cases/p02609/input.0.txt b/codenet/public_test_cases/p02609/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4da94101e6b455aea54f5ef3454cf56820cf406e --- /dev/null +++ b/codenet/public_test_cases/p02609/input.0.txt @@ -0,0 +1,2 @@ +3 +011 diff --git a/codenet/public_test_cases/p02609/input.1.txt b/codenet/public_test_cases/p02609/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d416c4a9758e1c80c29a5d7cd63eff9a80659e3 --- /dev/null +++ b/codenet/public_test_cases/p02609/input.1.txt @@ -0,0 +1,2 @@ +23 +00110111001011011001110 diff --git a/codenet/public_test_cases/p02609/input.2.txt b/codenet/public_test_cases/p02609/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4da94101e6b455aea54f5ef3454cf56820cf406e --- /dev/null +++ b/codenet/public_test_cases/p02609/input.2.txt @@ -0,0 +1,2 @@ +3 +011 diff --git a/codenet/public_test_cases/p02609/output.0.txt b/codenet/public_test_cases/p02609/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe234be093e7ad8424af41b8a2162a42d19b3e9 --- /dev/null +++ b/codenet/public_test_cases/p02609/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +1 diff --git a/codenet/public_test_cases/p02609/output.1.txt b/codenet/public_test_cases/p02609/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea256e578f54ef6ea9fb3ac217751c2633834988 --- /dev/null +++ b/codenet/public_test_cases/p02609/output.1.txt @@ -0,0 +1,23 @@ +2 +1 +2 +2 +1 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +1 +3 diff --git a/codenet/public_test_cases/p02609/output.2.txt b/codenet/public_test_cases/p02609/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe234be093e7ad8424af41b8a2162a42d19b3e9 --- /dev/null +++ b/codenet/public_test_cases/p02609/output.2.txt @@ -0,0 +1,3 @@ +2 +1 +1 diff --git a/codenet/public_test_cases/p02610/input.0.txt b/codenet/public_test_cases/p02610/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b70b6383501cb62779bc5414c00fb1ffc0d6b6ff --- /dev/null +++ b/codenet/public_test_cases/p02610/input.0.txt @@ -0,0 +1,28 @@ +3 +2 +1 5 10 +2 15 5 +3 +2 93 78 +1 71 59 +3 57 96 +19 +19 23 16 +5 90 13 +12 85 70 +19 67 78 +12 16 60 +18 48 28 +5 4 24 +12 97 97 +4 57 87 +19 91 74 +18 100 76 +7 86 46 +9 100 57 +3 76 73 +6 84 93 +1 6 84 +11 75 94 +19 15 3 +12 11 34 diff --git a/codenet/public_test_cases/p02610/input.1.txt b/codenet/public_test_cases/p02610/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b70b6383501cb62779bc5414c00fb1ffc0d6b6ff --- /dev/null +++ b/codenet/public_test_cases/p02610/input.1.txt @@ -0,0 +1,28 @@ +3 +2 +1 5 10 +2 15 5 +3 +2 93 78 +1 71 59 +3 57 96 +19 +19 23 16 +5 90 13 +12 85 70 +19 67 78 +12 16 60 +18 48 28 +5 4 24 +12 97 97 +4 57 87 +19 91 74 +18 100 76 +7 86 46 +9 100 57 +3 76 73 +6 84 93 +1 6 84 +11 75 94 +19 15 3 +12 11 34 diff --git a/codenet/public_test_cases/p02610/output.0.txt b/codenet/public_test_cases/p02610/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d90ce79222cd31fad8890a1c0a870b39221d26a4 --- /dev/null +++ b/codenet/public_test_cases/p02610/output.0.txt @@ -0,0 +1,3 @@ +25 +221 +1354 diff --git a/codenet/public_test_cases/p02610/output.1.txt b/codenet/public_test_cases/p02610/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d90ce79222cd31fad8890a1c0a870b39221d26a4 --- /dev/null +++ b/codenet/public_test_cases/p02610/output.1.txt @@ -0,0 +1,3 @@ +25 +221 +1354 diff --git a/codenet/public_test_cases/p02611/input.0.txt b/codenet/public_test_cases/p02611/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..49f83cef0ff7b6cdb7a3ab3dffa5d52dcf416467 --- /dev/null +++ b/codenet/public_test_cases/p02611/input.0.txt @@ -0,0 +1,5 @@ +4 +4 +6 +10 +1000000000 diff --git a/codenet/public_test_cases/p02611/input.1.txt b/codenet/public_test_cases/p02611/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..49f83cef0ff7b6cdb7a3ab3dffa5d52dcf416467 --- /dev/null +++ b/codenet/public_test_cases/p02611/input.1.txt @@ -0,0 +1,5 @@ +4 +4 +6 +10 +1000000000 diff --git a/codenet/public_test_cases/p02611/output.0.txt b/codenet/public_test_cases/p02611/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4139e68c69496bfbbc40e72346544ed400ddf6b0 --- /dev/null +++ b/codenet/public_test_cases/p02611/output.0.txt @@ -0,0 +1,4 @@ +0 +11 +4598 +257255556 diff --git a/codenet/public_test_cases/p02611/output.1.txt b/codenet/public_test_cases/p02611/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4139e68c69496bfbbc40e72346544ed400ddf6b0 --- /dev/null +++ b/codenet/public_test_cases/p02611/output.1.txt @@ -0,0 +1,4 @@ +0 +11 +4598 +257255556 diff --git a/codenet/public_test_cases/p02612/input.0.txt b/codenet/public_test_cases/p02612/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62a85b862fd04a2a458ba976f3ca820481aa89b7 --- /dev/null +++ b/codenet/public_test_cases/p02612/input.0.txt @@ -0,0 +1 @@ +1900 diff --git a/codenet/public_test_cases/p02612/input.1.txt b/codenet/public_test_cases/p02612/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..13de30f45d1a183bfc67d7f3c660dfce3dfee9e4 --- /dev/null +++ b/codenet/public_test_cases/p02612/input.1.txt @@ -0,0 +1 @@ +3000 diff --git a/codenet/public_test_cases/p02612/input.2.txt b/codenet/public_test_cases/p02612/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..62a85b862fd04a2a458ba976f3ca820481aa89b7 --- /dev/null +++ b/codenet/public_test_cases/p02612/input.2.txt @@ -0,0 +1 @@ +1900 diff --git a/codenet/public_test_cases/p02612/output.0.txt b/codenet/public_test_cases/p02612/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02612/output.0.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02612/output.1.txt b/codenet/public_test_cases/p02612/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02612/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02612/output.2.txt b/codenet/public_test_cases/p02612/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02612/output.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02613/input.0.txt b/codenet/public_test_cases/p02613/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2666914d5a7a63fd45f884320099c4504b1e113 --- /dev/null +++ b/codenet/public_test_cases/p02613/input.0.txt @@ -0,0 +1,7 @@ +6 +AC +TLE +AC +AC +WA +TLE diff --git a/codenet/public_test_cases/p02613/input.1.txt b/codenet/public_test_cases/p02613/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2666914d5a7a63fd45f884320099c4504b1e113 --- /dev/null +++ b/codenet/public_test_cases/p02613/input.1.txt @@ -0,0 +1,7 @@ +6 +AC +TLE +AC +AC +WA +TLE diff --git a/codenet/public_test_cases/p02613/input.2.txt b/codenet/public_test_cases/p02613/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9000e632fc6a98ebb261b86e58cdaf9031b8a9e4 --- /dev/null +++ b/codenet/public_test_cases/p02613/input.2.txt @@ -0,0 +1,11 @@ +10 +AC +AC +AC +AC +AC +AC +AC +AC +AC +AC diff --git a/codenet/public_test_cases/p02613/output.0.txt b/codenet/public_test_cases/p02613/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8004a39b0ee05ed69a7a2a6baeae1050c3d0d257 --- /dev/null +++ b/codenet/public_test_cases/p02613/output.0.txt @@ -0,0 +1,4 @@ +AC x 3 +WA x 1 +TLE x 2 +RE x 0 diff --git a/codenet/public_test_cases/p02613/output.1.txt b/codenet/public_test_cases/p02613/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8004a39b0ee05ed69a7a2a6baeae1050c3d0d257 --- /dev/null +++ b/codenet/public_test_cases/p02613/output.1.txt @@ -0,0 +1,4 @@ +AC x 3 +WA x 1 +TLE x 2 +RE x 0 diff --git a/codenet/public_test_cases/p02613/output.2.txt b/codenet/public_test_cases/p02613/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..72f6225522598969971d852477eee9738f35813d --- /dev/null +++ b/codenet/public_test_cases/p02613/output.2.txt @@ -0,0 +1,4 @@ +AC x 10 +WA x 0 +TLE x 0 +RE x 0 diff --git a/codenet/public_test_cases/p02614/input.0.txt b/codenet/public_test_cases/p02614/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d524c9d6b833f79551883036d1360df0246dfe87 --- /dev/null +++ b/codenet/public_test_cases/p02614/input.0.txt @@ -0,0 +1,3 @@ +2 3 2 +..# +### diff --git a/codenet/public_test_cases/p02614/input.1.txt b/codenet/public_test_cases/p02614/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b94d119d5c43f569338289a3dfa3292e1889778 --- /dev/null +++ b/codenet/public_test_cases/p02614/input.1.txt @@ -0,0 +1,2 @@ +2 3 4 +..# diff --git a/codenet/public_test_cases/p02614/input.2.txt b/codenet/public_test_cases/p02614/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7399ef870bbb0130a65416857960baa48cc0366 --- /dev/null +++ b/codenet/public_test_cases/p02614/input.2.txt @@ -0,0 +1,7 @@ +6 6 8 +..##.. +.#..#. +....# + +....# +....# diff --git a/codenet/public_test_cases/p02614/input.3.txt b/codenet/public_test_cases/p02614/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3bf8e4a94bcfe594a86cd6a7b68bb460019925f --- /dev/null +++ b/codenet/public_test_cases/p02614/input.3.txt @@ -0,0 +1,2 @@ +2 3 2 +..# diff --git a/codenet/public_test_cases/p02614/input.4.txt b/codenet/public_test_cases/p02614/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..12883b08ef1d1496f287ed85dc18e50fbefc23ea --- /dev/null +++ b/codenet/public_test_cases/p02614/input.4.txt @@ -0,0 +1 @@ +2 2 3 diff --git a/codenet/public_test_cases/p02614/input.5.txt b/codenet/public_test_cases/p02614/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d524c9d6b833f79551883036d1360df0246dfe87 --- /dev/null +++ b/codenet/public_test_cases/p02614/input.5.txt @@ -0,0 +1,3 @@ +2 3 2 +..# +### diff --git a/codenet/public_test_cases/p02614/output.0.txt b/codenet/public_test_cases/p02614/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02614/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02614/output.1.txt b/codenet/public_test_cases/p02614/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02614/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02614/output.2.txt b/codenet/public_test_cases/p02614/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d645f58935469157114c6660026c958c992c92d --- /dev/null +++ b/codenet/public_test_cases/p02614/output.2.txt @@ -0,0 +1 @@ +208 diff --git a/codenet/public_test_cases/p02614/output.3.txt b/codenet/public_test_cases/p02614/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02614/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02614/output.4.txt b/codenet/public_test_cases/p02614/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02614/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02614/output.5.txt b/codenet/public_test_cases/p02614/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02614/output.5.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02615/input.0.txt b/codenet/public_test_cases/p02615/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a497fbbc1d7c77d65711d5f9c4ba16e07271dddb --- /dev/null +++ b/codenet/public_test_cases/p02615/input.0.txt @@ -0,0 +1,2 @@ +4 +2 2 1 3 diff --git a/codenet/public_test_cases/p02615/input.1.txt b/codenet/public_test_cases/p02615/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a497fbbc1d7c77d65711d5f9c4ba16e07271dddb --- /dev/null +++ b/codenet/public_test_cases/p02615/input.1.txt @@ -0,0 +1,2 @@ +4 +2 2 1 3 diff --git a/codenet/public_test_cases/p02615/input.2.txt b/codenet/public_test_cases/p02615/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..394f394f8500f0458b67e455e64b143782b432d0 --- /dev/null +++ b/codenet/public_test_cases/p02615/input.2.txt @@ -0,0 +1,2 @@ +7 +1 1 1 1 1 1 1 diff --git a/codenet/public_test_cases/p02615/output.0.txt b/codenet/public_test_cases/p02615/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02615/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02615/output.1.txt b/codenet/public_test_cases/p02615/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02615/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02615/output.2.txt b/codenet/public_test_cases/p02615/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02615/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02616/input.0.txt b/codenet/public_test_cases/p02616/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d31c35604ac9ab71eb06d5b84a51a89306b0a7f --- /dev/null +++ b/codenet/public_test_cases/p02616/input.0.txt @@ -0,0 +1,2 @@ +4 2 +1 2 -3 -4 diff --git a/codenet/public_test_cases/p02616/input.1.txt b/codenet/public_test_cases/p02616/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d31c35604ac9ab71eb06d5b84a51a89306b0a7f --- /dev/null +++ b/codenet/public_test_cases/p02616/input.1.txt @@ -0,0 +1,2 @@ +4 2 +1 2 -3 -4 diff --git a/codenet/public_test_cases/p02616/input.2.txt b/codenet/public_test_cases/p02616/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c689b94323a8b206e25944007a8f5537d29a0271 --- /dev/null +++ b/codenet/public_test_cases/p02616/input.2.txt @@ -0,0 +1,2 @@ +10 10 +1000000000 100000000 10000000 1000000 100000 10000 1000 100 10 1 diff --git a/codenet/public_test_cases/p02616/input.3.txt b/codenet/public_test_cases/p02616/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5c50e75b4e2557475a6f9d4e5c1083da41d16e7 --- /dev/null +++ b/codenet/public_test_cases/p02616/input.3.txt @@ -0,0 +1,2 @@ +4 3 +-1 -2 -3 -4 diff --git a/codenet/public_test_cases/p02616/input.4.txt b/codenet/public_test_cases/p02616/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..566ebaca9bb0f1fc791233f8902de6b84e03bd91 --- /dev/null +++ b/codenet/public_test_cases/p02616/input.4.txt @@ -0,0 +1,2 @@ +2 1 +-1 1000000000 diff --git a/codenet/public_test_cases/p02616/output.0.txt b/codenet/public_test_cases/p02616/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02616/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02616/output.1.txt b/codenet/public_test_cases/p02616/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02616/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02616/output.2.txt b/codenet/public_test_cases/p02616/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6afa3ae64f78be2c8da3db572e037f09edc67eb6 --- /dev/null +++ b/codenet/public_test_cases/p02616/output.2.txt @@ -0,0 +1 @@ +999983200 diff --git a/codenet/public_test_cases/p02616/output.3.txt b/codenet/public_test_cases/p02616/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a528ed87320071ba84058bf3cd59e85b5bb7fd7d --- /dev/null +++ b/codenet/public_test_cases/p02616/output.3.txt @@ -0,0 +1 @@ +1000000001 diff --git a/codenet/public_test_cases/p02616/output.4.txt b/codenet/public_test_cases/p02616/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..770fdcfb4b7d03520f649b7f7ca20e2546bdb41f --- /dev/null +++ b/codenet/public_test_cases/p02616/output.4.txt @@ -0,0 +1 @@ +1000000000 diff --git a/codenet/public_test_cases/p02617/input.0.txt b/codenet/public_test_cases/p02617/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75cb4f08a15a97e472cb7544897bd6f10a348d61 --- /dev/null +++ b/codenet/public_test_cases/p02617/input.0.txt @@ -0,0 +1,3 @@ +3 +1 3 +2 3 diff --git a/codenet/public_test_cases/p02617/input.1.txt b/codenet/public_test_cases/p02617/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p02617/input.1.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p02617/input.2.txt b/codenet/public_test_cases/p02617/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..604ef2e40433241293d9215cc104beb691ea5540 --- /dev/null +++ b/codenet/public_test_cases/p02617/input.2.txt @@ -0,0 +1,10 @@ +10 +5 3 +5 7 +8 9 +1 9 +9 10 +8 4 +7 4 +6 10 +7 2 diff --git a/codenet/public_test_cases/p02617/input.3.txt b/codenet/public_test_cases/p02617/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..75cb4f08a15a97e472cb7544897bd6f10a348d61 --- /dev/null +++ b/codenet/public_test_cases/p02617/input.3.txt @@ -0,0 +1,3 @@ +3 +1 3 +2 3 diff --git a/codenet/public_test_cases/p02617/output.0.txt b/codenet/public_test_cases/p02617/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02617/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02617/output.1.txt b/codenet/public_test_cases/p02617/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02617/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02617/output.2.txt b/codenet/public_test_cases/p02617/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b252fd0902c7ca46ba8f6cd905d06880b0efb85 --- /dev/null +++ b/codenet/public_test_cases/p02617/output.2.txt @@ -0,0 +1 @@ +113 diff --git a/codenet/public_test_cases/p02617/output.3.txt b/codenet/public_test_cases/p02617/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02617/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02618/input.0.txt b/codenet/public_test_cases/p02618/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..464597fa57d3a3bb6bffec1b84b5bdad9480ef6e --- /dev/null +++ b/codenet/public_test_cases/p02618/input.0.txt @@ -0,0 +1,7 @@ +5 +86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82 +19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424 +6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570 +6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256 +8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452 +19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192 diff --git a/codenet/public_test_cases/p02618/input.1.txt b/codenet/public_test_cases/p02618/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..464597fa57d3a3bb6bffec1b84b5bdad9480ef6e --- /dev/null +++ b/codenet/public_test_cases/p02618/input.1.txt @@ -0,0 +1,7 @@ +5 +86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82 +19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424 +6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570 +6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256 +8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452 +19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192 diff --git a/codenet/public_test_cases/p02618/output.0.txt b/codenet/public_test_cases/p02618/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9823560f67f155214d6e5e8a03236f43fbbf9906 --- /dev/null +++ b/codenet/public_test_cases/p02618/output.0.txt @@ -0,0 +1,5 @@ +1 +17 +13 +14 +13 diff --git a/codenet/public_test_cases/p02618/output.1.txt b/codenet/public_test_cases/p02618/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9823560f67f155214d6e5e8a03236f43fbbf9906 --- /dev/null +++ b/codenet/public_test_cases/p02618/output.1.txt @@ -0,0 +1,5 @@ +1 +17 +13 +14 +13 diff --git a/codenet/public_test_cases/p02619/input.0.txt b/codenet/public_test_cases/p02619/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..998cfb02e64c23518c088de5ba9b06e82fcbf1e2 --- /dev/null +++ b/codenet/public_test_cases/p02619/input.0.txt @@ -0,0 +1,12 @@ +5 +86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82 +19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424 +6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570 +6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256 +8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452 +19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192 +1 +17 +13 +14 +13 diff --git a/codenet/public_test_cases/p02619/input.1.txt b/codenet/public_test_cases/p02619/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..998cfb02e64c23518c088de5ba9b06e82fcbf1e2 --- /dev/null +++ b/codenet/public_test_cases/p02619/input.1.txt @@ -0,0 +1,12 @@ +5 +86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82 +19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424 +6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570 +6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256 +8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452 +19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192 +1 +17 +13 +14 +13 diff --git a/codenet/public_test_cases/p02619/output.0.txt b/codenet/public_test_cases/p02619/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9b908e03a603d28595a227ee2310d089c537a0d --- /dev/null +++ b/codenet/public_test_cases/p02619/output.0.txt @@ -0,0 +1,5 @@ +18398 +35037 +51140 +65837 +79325 diff --git a/codenet/public_test_cases/p02619/output.1.txt b/codenet/public_test_cases/p02619/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9b908e03a603d28595a227ee2310d089c537a0d --- /dev/null +++ b/codenet/public_test_cases/p02619/output.1.txt @@ -0,0 +1,5 @@ +18398 +35037 +51140 +65837 +79325 diff --git a/codenet/public_test_cases/p02620/input.0.txt b/codenet/public_test_cases/p02620/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f110a2bb3cd822dcb26baf6dfcd70671497bca1f --- /dev/null +++ b/codenet/public_test_cases/p02620/input.0.txt @@ -0,0 +1,18 @@ +5 +86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82 +19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424 +6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570 +6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256 +8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452 +19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192 +1 +17 +13 +14 +13 +5 +1 7 +4 11 +3 4 +5 24 +4 19 diff --git a/codenet/public_test_cases/p02620/input.1.txt b/codenet/public_test_cases/p02620/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f110a2bb3cd822dcb26baf6dfcd70671497bca1f --- /dev/null +++ b/codenet/public_test_cases/p02620/input.1.txt @@ -0,0 +1,18 @@ +5 +86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82 +19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424 +6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570 +6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256 +8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452 +19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192 +1 +17 +13 +14 +13 +5 +1 7 +4 11 +3 4 +5 24 +4 19 diff --git a/codenet/public_test_cases/p02620/output.0.txt b/codenet/public_test_cases/p02620/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4651191ea0a7768d9da24640e7a65caeb740a08 --- /dev/null +++ b/codenet/public_test_cases/p02620/output.0.txt @@ -0,0 +1,5 @@ +72882 +56634 +38425 +27930 +42884 diff --git a/codenet/public_test_cases/p02620/output.1.txt b/codenet/public_test_cases/p02620/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4651191ea0a7768d9da24640e7a65caeb740a08 --- /dev/null +++ b/codenet/public_test_cases/p02620/output.1.txt @@ -0,0 +1,5 @@ +72882 +56634 +38425 +27930 +42884 diff --git a/codenet/public_test_cases/p02621/input.0.txt b/codenet/public_test_cases/p02621/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02621/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02621/input.1.txt b/codenet/public_test_cases/p02621/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02621/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02621/input.2.txt b/codenet/public_test_cases/p02621/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02621/input.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02621/output.0.txt b/codenet/public_test_cases/p02621/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02621/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02621/output.1.txt b/codenet/public_test_cases/p02621/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02621/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02621/output.2.txt b/codenet/public_test_cases/p02621/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a75ff76190b66939608d9c42715f8d2bcbcd059 --- /dev/null +++ b/codenet/public_test_cases/p02621/output.2.txt @@ -0,0 +1 @@ +1110 diff --git a/codenet/public_test_cases/p02622/input.0.txt b/codenet/public_test_cases/p02622/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..977e042d1ba14c5bf9471337af0b9309a4225760 --- /dev/null +++ b/codenet/public_test_cases/p02622/input.0.txt @@ -0,0 +1,2 @@ +cupofcoffee +cupofhottea diff --git a/codenet/public_test_cases/p02622/input.1.txt b/codenet/public_test_cases/p02622/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4eeff4b1cdc73fdf51abb6907bd45851f47d8dd3 --- /dev/null +++ b/codenet/public_test_cases/p02622/input.1.txt @@ -0,0 +1,2 @@ +apple +apple diff --git a/codenet/public_test_cases/p02622/input.2.txt b/codenet/public_test_cases/p02622/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..16ad0642f58c4bd2b00fb03beabf541df7532459 --- /dev/null +++ b/codenet/public_test_cases/p02622/input.2.txt @@ -0,0 +1,2 @@ +abcde +bcdea diff --git a/codenet/public_test_cases/p02622/input.3.txt b/codenet/public_test_cases/p02622/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..977e042d1ba14c5bf9471337af0b9309a4225760 --- /dev/null +++ b/codenet/public_test_cases/p02622/input.3.txt @@ -0,0 +1,2 @@ +cupofcoffee +cupofhottea diff --git a/codenet/public_test_cases/p02622/output.0.txt b/codenet/public_test_cases/p02622/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02622/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02622/output.1.txt b/codenet/public_test_cases/p02622/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02622/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02622/output.2.txt b/codenet/public_test_cases/p02622/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02622/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02622/output.3.txt b/codenet/public_test_cases/p02622/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02622/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02623/input.0.txt b/codenet/public_test_cases/p02623/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eded8dcf21a6288f8285b8fa192444f1c0ca7e52 --- /dev/null +++ b/codenet/public_test_cases/p02623/input.0.txt @@ -0,0 +1,3 @@ +3 4 240 +60 90 120 +80 150 80 150 diff --git a/codenet/public_test_cases/p02623/input.1.txt b/codenet/public_test_cases/p02623/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a1ce684f872dd7bd00b95924f6bd03ce8442dba --- /dev/null +++ b/codenet/public_test_cases/p02623/input.1.txt @@ -0,0 +1,3 @@ +5 4 1 +1000000000 1000000000 1000000000 1000000000 1000000000 +1000000000 1000000000 1000000000 1000000000 diff --git a/codenet/public_test_cases/p02623/input.2.txt b/codenet/public_test_cases/p02623/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eded8dcf21a6288f8285b8fa192444f1c0ca7e52 --- /dev/null +++ b/codenet/public_test_cases/p02623/input.2.txt @@ -0,0 +1,3 @@ +3 4 240 +60 90 120 +80 150 80 150 diff --git a/codenet/public_test_cases/p02623/input.3.txt b/codenet/public_test_cases/p02623/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4047695a81844f9d1a28400c69092f44cf7e65b4 --- /dev/null +++ b/codenet/public_test_cases/p02623/input.3.txt @@ -0,0 +1,3 @@ +3 4 730 +60 90 120 +80 150 80 150 diff --git a/codenet/public_test_cases/p02623/output.0.txt b/codenet/public_test_cases/p02623/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02623/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02623/output.1.txt b/codenet/public_test_cases/p02623/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02623/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02623/output.2.txt b/codenet/public_test_cases/p02623/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02623/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02623/output.3.txt b/codenet/public_test_cases/p02623/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02623/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02624/input.0.txt b/codenet/public_test_cases/p02624/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02624/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02624/input.1.txt b/codenet/public_test_cases/p02624/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02624/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02624/input.2.txt b/codenet/public_test_cases/p02624/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02624/input.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02624/input.3.txt b/codenet/public_test_cases/p02624/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..825319e1c5ba81838b263acdf53ff35d2bb19f11 --- /dev/null +++ b/codenet/public_test_cases/p02624/input.3.txt @@ -0,0 +1 @@ +10000000 diff --git a/codenet/public_test_cases/p02624/output.0.txt b/codenet/public_test_cases/p02624/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p02624/output.0.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p02624/output.1.txt b/codenet/public_test_cases/p02624/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p02624/output.1.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p02624/output.2.txt b/codenet/public_test_cases/p02624/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9064cd9a5061c63da8c86197fefff533330fe758 --- /dev/null +++ b/codenet/public_test_cases/p02624/output.2.txt @@ -0,0 +1 @@ +26879 diff --git a/codenet/public_test_cases/p02624/output.3.txt b/codenet/public_test_cases/p02624/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c01ac5cf843a65eb039ebef7eda5df69ff8a49c5 --- /dev/null +++ b/codenet/public_test_cases/p02624/output.3.txt @@ -0,0 +1 @@ +838627288460105 diff --git a/codenet/public_test_cases/p02625/input.0.txt b/codenet/public_test_cases/p02625/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p02625/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p02625/input.1.txt b/codenet/public_test_cases/p02625/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..73260e25ec727a971e874e6c60ab0b7b1ffcc1db --- /dev/null +++ b/codenet/public_test_cases/p02625/input.1.txt @@ -0,0 +1 @@ +141421 356237 diff --git a/codenet/public_test_cases/p02625/input.2.txt b/codenet/public_test_cases/p02625/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p02625/input.2.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p02625/input.3.txt b/codenet/public_test_cases/p02625/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02625/input.3.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02625/output.0.txt b/codenet/public_test_cases/p02625/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02625/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02625/output.1.txt b/codenet/public_test_cases/p02625/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..495cce011b5ca9e7c198469ea5210715989c0be5 --- /dev/null +++ b/codenet/public_test_cases/p02625/output.1.txt @@ -0,0 +1 @@ +881613484 diff --git a/codenet/public_test_cases/p02625/output.2.txt b/codenet/public_test_cases/p02625/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02625/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02625/output.3.txt b/codenet/public_test_cases/p02625/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p02625/output.3.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p02626/input.0.txt b/codenet/public_test_cases/p02626/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0537d56687614227fe372e25c7d285efd469124f --- /dev/null +++ b/codenet/public_test_cases/p02626/input.0.txt @@ -0,0 +1,2 @@ +2 +5 3 diff --git a/codenet/public_test_cases/p02626/input.1.txt b/codenet/public_test_cases/p02626/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7189afa4e1229f418d3fa246f90a3c701b9e9ea --- /dev/null +++ b/codenet/public_test_cases/p02626/input.1.txt @@ -0,0 +1,2 @@ +2 +3 5 diff --git a/codenet/public_test_cases/p02626/input.2.txt b/codenet/public_test_cases/p02626/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c7a656a8a22fff2ad8f684e817330b3437fb29f --- /dev/null +++ b/codenet/public_test_cases/p02626/input.2.txt @@ -0,0 +1,2 @@ +3 +4294967297 8589934593 12884901890 diff --git a/codenet/public_test_cases/p02626/input.3.txt b/codenet/public_test_cases/p02626/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..85cfdbc836661ee215b169065355693f7c39e73c --- /dev/null +++ b/codenet/public_test_cases/p02626/input.3.txt @@ -0,0 +1,2 @@ +8 +10 9 8 7 6 5 4 3 diff --git a/codenet/public_test_cases/p02626/input.4.txt b/codenet/public_test_cases/p02626/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0537d56687614227fe372e25c7d285efd469124f --- /dev/null +++ b/codenet/public_test_cases/p02626/input.4.txt @@ -0,0 +1,2 @@ +2 +5 3 diff --git a/codenet/public_test_cases/p02626/input.5.txt b/codenet/public_test_cases/p02626/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..c54d55a8d166e20db07dc7c7ab25cb293a0c3cfd --- /dev/null +++ b/codenet/public_test_cases/p02626/input.5.txt @@ -0,0 +1,2 @@ +3 +1 1 2 diff --git a/codenet/public_test_cases/p02626/output.0.txt b/codenet/public_test_cases/p02626/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02626/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02626/output.1.txt b/codenet/public_test_cases/p02626/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02626/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02626/output.2.txt b/codenet/public_test_cases/p02626/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02626/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02626/output.3.txt b/codenet/public_test_cases/p02626/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02626/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02626/output.4.txt b/codenet/public_test_cases/p02626/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02626/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02626/output.5.txt b/codenet/public_test_cases/p02626/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02626/output.5.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02627/input.0.txt b/codenet/public_test_cases/p02627/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..223b7836fb19fdf64ba2d3cd6173c6a283141f78 --- /dev/null +++ b/codenet/public_test_cases/p02627/input.0.txt @@ -0,0 +1 @@ +B diff --git a/codenet/public_test_cases/p02627/input.1.txt b/codenet/public_test_cases/p02627/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p02627/input.1.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p02627/input.2.txt b/codenet/public_test_cases/p02627/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..223b7836fb19fdf64ba2d3cd6173c6a283141f78 --- /dev/null +++ b/codenet/public_test_cases/p02627/input.2.txt @@ -0,0 +1 @@ +B diff --git a/codenet/public_test_cases/p02627/output.0.txt b/codenet/public_test_cases/p02627/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70f10e4db19068f79bc43844b49f3eece45c4e8 --- /dev/null +++ b/codenet/public_test_cases/p02627/output.0.txt @@ -0,0 +1 @@ +A diff --git a/codenet/public_test_cases/p02627/output.1.txt b/codenet/public_test_cases/p02627/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p02627/output.1.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p02627/output.2.txt b/codenet/public_test_cases/p02627/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70f10e4db19068f79bc43844b49f3eece45c4e8 --- /dev/null +++ b/codenet/public_test_cases/p02627/output.2.txt @@ -0,0 +1 @@ +A diff --git a/codenet/public_test_cases/p02628/input.0.txt b/codenet/public_test_cases/p02628/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f11a5f7b4875b03ed4d49d9afe431331e344634f --- /dev/null +++ b/codenet/public_test_cases/p02628/input.0.txt @@ -0,0 +1,2 @@ +5 3 +50 100 80 120 80 diff --git a/codenet/public_test_cases/p02628/input.1.txt b/codenet/public_test_cases/p02628/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc405bc11558e8129001a39e8c3ef3e3479c257e --- /dev/null +++ b/codenet/public_test_cases/p02628/input.1.txt @@ -0,0 +1,2 @@ +1 1 +1000 diff --git a/codenet/public_test_cases/p02628/input.2.txt b/codenet/public_test_cases/p02628/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f11a5f7b4875b03ed4d49d9afe431331e344634f --- /dev/null +++ b/codenet/public_test_cases/p02628/input.2.txt @@ -0,0 +1,2 @@ +5 3 +50 100 80 120 80 diff --git a/codenet/public_test_cases/p02628/output.0.txt b/codenet/public_test_cases/p02628/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd7da05e3d264bd30a49a5f2c4c647a4ee0d3ec3 --- /dev/null +++ b/codenet/public_test_cases/p02628/output.0.txt @@ -0,0 +1 @@ +210 diff --git a/codenet/public_test_cases/p02628/output.1.txt b/codenet/public_test_cases/p02628/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b33d238dab9943201aaf267f701e8ea5fc9268 --- /dev/null +++ b/codenet/public_test_cases/p02628/output.1.txt @@ -0,0 +1 @@ +1000 diff --git a/codenet/public_test_cases/p02628/output.2.txt b/codenet/public_test_cases/p02628/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd7da05e3d264bd30a49a5f2c4c647a4ee0d3ec3 --- /dev/null +++ b/codenet/public_test_cases/p02628/output.2.txt @@ -0,0 +1 @@ +210 diff --git a/codenet/public_test_cases/p02629/input.0.txt b/codenet/public_test_cases/p02629/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02629/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02629/input.1.txt b/codenet/public_test_cases/p02629/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p02629/input.1.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p02629/input.2.txt b/codenet/public_test_cases/p02629/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02629/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02629/input.3.txt b/codenet/public_test_cases/p02629/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..28d14454c380441fa2b6f562072a1cd641c06e22 --- /dev/null +++ b/codenet/public_test_cases/p02629/input.3.txt @@ -0,0 +1 @@ +123456789 diff --git a/codenet/public_test_cases/p02629/output.0.txt b/codenet/public_test_cases/p02629/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p02629/output.0.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p02629/output.1.txt b/codenet/public_test_cases/p02629/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e61ef7b965e17c62ca23b6ff5f0aaf09586e10e9 --- /dev/null +++ b/codenet/public_test_cases/p02629/output.1.txt @@ -0,0 +1 @@ +aa diff --git a/codenet/public_test_cases/p02629/output.2.txt b/codenet/public_test_cases/p02629/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p02629/output.2.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p02629/output.3.txt b/codenet/public_test_cases/p02629/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c546b5d52b3b5db18bc05cd28ff41757510b0ac --- /dev/null +++ b/codenet/public_test_cases/p02629/output.3.txt @@ -0,0 +1 @@ +jjddja diff --git a/codenet/public_test_cases/p02630/input.0.txt b/codenet/public_test_cases/p02630/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f204cc5f88d35de2dbd0700991d810ad13ac475 --- /dev/null +++ b/codenet/public_test_cases/p02630/input.0.txt @@ -0,0 +1,6 @@ +4 +1 2 3 4 +3 +1 2 +3 4 +2 4 diff --git a/codenet/public_test_cases/p02630/input.1.txt b/codenet/public_test_cases/p02630/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba4cae918c90c1a5d5e43930a9d1d8e585dbf32 --- /dev/null +++ b/codenet/public_test_cases/p02630/input.1.txt @@ -0,0 +1,6 @@ +2 +1 2 +3 +1 100 +2 100 +100 1000 diff --git a/codenet/public_test_cases/p02630/input.2.txt b/codenet/public_test_cases/p02630/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f204cc5f88d35de2dbd0700991d810ad13ac475 --- /dev/null +++ b/codenet/public_test_cases/p02630/input.2.txt @@ -0,0 +1,6 @@ +4 +1 2 3 4 +3 +1 2 +3 4 +2 4 diff --git a/codenet/public_test_cases/p02630/input.3.txt b/codenet/public_test_cases/p02630/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..74bc749ad3417bd32500570f7221f4e6e3c3c05f --- /dev/null +++ b/codenet/public_test_cases/p02630/input.3.txt @@ -0,0 +1,6 @@ +4 +1 1 1 1 +3 +1 2 +2 1 +3 5 diff --git a/codenet/public_test_cases/p02630/output.0.txt b/codenet/public_test_cases/p02630/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..369f6fc0301e0913b98c353667aca6b7ca0489d3 --- /dev/null +++ b/codenet/public_test_cases/p02630/output.0.txt @@ -0,0 +1,3 @@ +11 +12 +16 diff --git a/codenet/public_test_cases/p02630/output.1.txt b/codenet/public_test_cases/p02630/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c739ca1428b5de63f5f3732e85c70cf9ad83506e --- /dev/null +++ b/codenet/public_test_cases/p02630/output.1.txt @@ -0,0 +1,3 @@ +102 +200 +2000 diff --git a/codenet/public_test_cases/p02630/output.2.txt b/codenet/public_test_cases/p02630/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..369f6fc0301e0913b98c353667aca6b7ca0489d3 --- /dev/null +++ b/codenet/public_test_cases/p02630/output.2.txt @@ -0,0 +1,3 @@ +11 +12 +16 diff --git a/codenet/public_test_cases/p02630/output.3.txt b/codenet/public_test_cases/p02630/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b70a1cb7c75203fe2fe543bcae6a76f00fc40a0e --- /dev/null +++ b/codenet/public_test_cases/p02630/output.3.txt @@ -0,0 +1,3 @@ +8 +4 +4 diff --git a/codenet/public_test_cases/p02631/input.0.txt b/codenet/public_test_cases/p02631/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25addd806bd623679bc01218d814aadb55efc372 --- /dev/null +++ b/codenet/public_test_cases/p02631/input.0.txt @@ -0,0 +1,2 @@ +4 +20 11 9 24 diff --git a/codenet/public_test_cases/p02631/input.1.txt b/codenet/public_test_cases/p02631/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..25addd806bd623679bc01218d814aadb55efc372 --- /dev/null +++ b/codenet/public_test_cases/p02631/input.1.txt @@ -0,0 +1,2 @@ +4 +20 11 9 24 diff --git a/codenet/public_test_cases/p02631/output.0.txt b/codenet/public_test_cases/p02631/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a32863a598d10f238db78d23aebf1d6ca099ffe --- /dev/null +++ b/codenet/public_test_cases/p02631/output.0.txt @@ -0,0 +1 @@ +26 5 7 22 diff --git a/codenet/public_test_cases/p02631/output.1.txt b/codenet/public_test_cases/p02631/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a32863a598d10f238db78d23aebf1d6ca099ffe --- /dev/null +++ b/codenet/public_test_cases/p02631/output.1.txt @@ -0,0 +1 @@ +26 5 7 22 diff --git a/codenet/public_test_cases/p02632/input.0.txt b/codenet/public_test_cases/p02632/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c10c1b4487e71df0ab2a1f2e4d964d8e348c1f5c --- /dev/null +++ b/codenet/public_test_cases/p02632/input.0.txt @@ -0,0 +1,2 @@ +5 +oof diff --git a/codenet/public_test_cases/p02632/input.1.txt b/codenet/public_test_cases/p02632/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c10c1b4487e71df0ab2a1f2e4d964d8e348c1f5c --- /dev/null +++ b/codenet/public_test_cases/p02632/input.1.txt @@ -0,0 +1,2 @@ +5 +oof diff --git a/codenet/public_test_cases/p02632/input.2.txt b/codenet/public_test_cases/p02632/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c6558f8d5987c573732a59c6cd384f4f110f2c6 --- /dev/null +++ b/codenet/public_test_cases/p02632/input.2.txt @@ -0,0 +1,2 @@ +37564 +whydidyoudesertme diff --git a/codenet/public_test_cases/p02632/output.0.txt b/codenet/public_test_cases/p02632/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4bcd0388cf99ab7460865e75b4548596643bcccc --- /dev/null +++ b/codenet/public_test_cases/p02632/output.0.txt @@ -0,0 +1 @@ +575111451 diff --git a/codenet/public_test_cases/p02632/output.1.txt b/codenet/public_test_cases/p02632/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4bcd0388cf99ab7460865e75b4548596643bcccc --- /dev/null +++ b/codenet/public_test_cases/p02632/output.1.txt @@ -0,0 +1 @@ +575111451 diff --git a/codenet/public_test_cases/p02632/output.2.txt b/codenet/public_test_cases/p02632/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ffb30a0a7d1b35442749a3391ed902f5988f381 --- /dev/null +++ b/codenet/public_test_cases/p02632/output.2.txt @@ -0,0 +1 @@ +318008117 diff --git a/codenet/public_test_cases/p02633/input.0.txt b/codenet/public_test_cases/p02633/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61f00d8cad3920809f4d992ac3031b3f32e7f10 --- /dev/null +++ b/codenet/public_test_cases/p02633/input.0.txt @@ -0,0 +1 @@ +90 diff --git a/codenet/public_test_cases/p02633/input.1.txt b/codenet/public_test_cases/p02633/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61f00d8cad3920809f4d992ac3031b3f32e7f10 --- /dev/null +++ b/codenet/public_test_cases/p02633/input.1.txt @@ -0,0 +1 @@ +90 diff --git a/codenet/public_test_cases/p02633/input.2.txt b/codenet/public_test_cases/p02633/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02633/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02633/output.0.txt b/codenet/public_test_cases/p02633/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02633/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02633/output.1.txt b/codenet/public_test_cases/p02633/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02633/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02633/output.2.txt b/codenet/public_test_cases/p02633/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2921a1584c758640f843bd701a9ef6a811dcac49 --- /dev/null +++ b/codenet/public_test_cases/p02633/output.2.txt @@ -0,0 +1 @@ +360 diff --git a/codenet/public_test_cases/p02634/input.0.txt b/codenet/public_test_cases/p02634/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1409b1c7c807c83489d56f470457810e6c246c59 --- /dev/null +++ b/codenet/public_test_cases/p02634/input.0.txt @@ -0,0 +1 @@ +1 1 2 2 diff --git a/codenet/public_test_cases/p02634/input.1.txt b/codenet/public_test_cases/p02634/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c62ce008e71a858b2da2e134fa1d61f04e5e617 --- /dev/null +++ b/codenet/public_test_cases/p02634/input.1.txt @@ -0,0 +1 @@ +2 1 3 4 diff --git a/codenet/public_test_cases/p02634/input.2.txt b/codenet/public_test_cases/p02634/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a1fc1a52b89b5268cce7a9f6407311411fc14f4 --- /dev/null +++ b/codenet/public_test_cases/p02634/input.2.txt @@ -0,0 +1 @@ +31 41 59 265 diff --git a/codenet/public_test_cases/p02634/input.3.txt b/codenet/public_test_cases/p02634/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1409b1c7c807c83489d56f470457810e6c246c59 --- /dev/null +++ b/codenet/public_test_cases/p02634/input.3.txt @@ -0,0 +1 @@ +1 1 2 2 diff --git a/codenet/public_test_cases/p02634/output.0.txt b/codenet/public_test_cases/p02634/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02634/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02634/output.1.txt b/codenet/public_test_cases/p02634/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1479e19b5fdf6c32d2eb41dad16203706f7d663d --- /dev/null +++ b/codenet/public_test_cases/p02634/output.1.txt @@ -0,0 +1 @@ +65 diff --git a/codenet/public_test_cases/p02634/output.2.txt b/codenet/public_test_cases/p02634/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..27fd9c696f3980f7b07b27647196363a6b22c19a --- /dev/null +++ b/codenet/public_test_cases/p02634/output.2.txt @@ -0,0 +1 @@ +387222020 diff --git a/codenet/public_test_cases/p02634/output.3.txt b/codenet/public_test_cases/p02634/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02634/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02635/input.0.txt b/codenet/public_test_cases/p02635/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8c06e0cd4856cc52c286bd37154b1e5a1884fe6 --- /dev/null +++ b/codenet/public_test_cases/p02635/input.0.txt @@ -0,0 +1 @@ +0101 1 diff --git a/codenet/public_test_cases/p02635/input.1.txt b/codenet/public_test_cases/p02635/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8c06e0cd4856cc52c286bd37154b1e5a1884fe6 --- /dev/null +++ b/codenet/public_test_cases/p02635/input.1.txt @@ -0,0 +1 @@ +0101 1 diff --git a/codenet/public_test_cases/p02635/input.2.txt b/codenet/public_test_cases/p02635/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8d43f0c5c3eac0ff140dc6fd7dbc5f68342c0b9 --- /dev/null +++ b/codenet/public_test_cases/p02635/input.2.txt @@ -0,0 +1 @@ +01100110 2 diff --git a/codenet/public_test_cases/p02635/input.3.txt b/codenet/public_test_cases/p02635/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bbe1ed0cdb1286f985705bbf28f7ba0d356895c2 --- /dev/null +++ b/codenet/public_test_cases/p02635/input.3.txt @@ -0,0 +1 @@ +1101010010101101110111100011011111011000111101110101010010101010101 20 diff --git a/codenet/public_test_cases/p02635/output.0.txt b/codenet/public_test_cases/p02635/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02635/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02635/output.1.txt b/codenet/public_test_cases/p02635/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02635/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02635/output.2.txt b/codenet/public_test_cases/p02635/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02635/output.2.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02635/output.3.txt b/codenet/public_test_cases/p02635/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0226ea1332d406fe27dbfd37da78631f33f9043d --- /dev/null +++ b/codenet/public_test_cases/p02635/output.3.txt @@ -0,0 +1 @@ +113434815 diff --git a/codenet/public_test_cases/p02636/input.0.txt b/codenet/public_test_cases/p02636/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..635047563b4812151aeb5e6c82ae10c2327932c1 --- /dev/null +++ b/codenet/public_test_cases/p02636/input.0.txt @@ -0,0 +1 @@ +0001 diff --git a/codenet/public_test_cases/p02636/input.1.txt b/codenet/public_test_cases/p02636/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5eadb09051a1187f8dda9214d83f1bf1acc7f897 --- /dev/null +++ b/codenet/public_test_cases/p02636/input.1.txt @@ -0,0 +1 @@ +110001 diff --git a/codenet/public_test_cases/p02636/input.2.txt b/codenet/public_test_cases/p02636/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4519f10860a6b0e09a785a39f01b9abd2ac63726 --- /dev/null +++ b/codenet/public_test_cases/p02636/input.2.txt @@ -0,0 +1 @@ +11101111011111000000000110000001111100011111000000001111111110000000111111111 diff --git a/codenet/public_test_cases/p02636/input.3.txt b/codenet/public_test_cases/p02636/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..635047563b4812151aeb5e6c82ae10c2327932c1 --- /dev/null +++ b/codenet/public_test_cases/p02636/input.3.txt @@ -0,0 +1 @@ +0001 diff --git a/codenet/public_test_cases/p02636/output.0.txt b/codenet/public_test_cases/p02636/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02636/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02636/output.1.txt b/codenet/public_test_cases/p02636/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p02636/output.1.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p02636/output.2.txt b/codenet/public_test_cases/p02636/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..156768d0c03c59bb730cc99aab1f3bdb1db257ed --- /dev/null +++ b/codenet/public_test_cases/p02636/output.2.txt @@ -0,0 +1 @@ +697354558 diff --git a/codenet/public_test_cases/p02636/output.3.txt b/codenet/public_test_cases/p02636/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02636/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02637/input.0.txt b/codenet/public_test_cases/p02637/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b03af9bfb308f556b09e9921bb1f321abd14452c --- /dev/null +++ b/codenet/public_test_cases/p02637/input.0.txt @@ -0,0 +1,2 @@ +3 +2 4 3 diff --git a/codenet/public_test_cases/p02637/input.1.txt b/codenet/public_test_cases/p02637/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0236378dae5df00920c28688eddd435c2e5c08e6 --- /dev/null +++ b/codenet/public_test_cases/p02637/input.1.txt @@ -0,0 +1,2 @@ +5 +3 1 4 1 5 diff --git a/codenet/public_test_cases/p02637/input.2.txt b/codenet/public_test_cases/p02637/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b03af9bfb308f556b09e9921bb1f321abd14452c --- /dev/null +++ b/codenet/public_test_cases/p02637/input.2.txt @@ -0,0 +1,2 @@ +3 +2 4 3 diff --git a/codenet/public_test_cases/p02637/input.3.txt b/codenet/public_test_cases/p02637/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..49dd93c29c1bc0afa5614ac516da90bf17bb16ad --- /dev/null +++ b/codenet/public_test_cases/p02637/input.3.txt @@ -0,0 +1,2 @@ +4 +3 2 3 2 diff --git a/codenet/public_test_cases/p02637/output.0.txt b/codenet/public_test_cases/p02637/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7400506fb4ff15db116d4be007ffd48f0f83b5e9 --- /dev/null +++ b/codenet/public_test_cases/p02637/output.0.txt @@ -0,0 +1 @@ +2 1 3 2 2 3 1 2 3 diff --git a/codenet/public_test_cases/p02637/output.1.txt b/codenet/public_test_cases/p02637/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02637/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02637/output.2.txt b/codenet/public_test_cases/p02637/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7400506fb4ff15db116d4be007ffd48f0f83b5e9 --- /dev/null +++ b/codenet/public_test_cases/p02637/output.2.txt @@ -0,0 +1 @@ +2 1 3 2 2 3 1 2 3 diff --git a/codenet/public_test_cases/p02637/output.3.txt b/codenet/public_test_cases/p02637/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4642df8464926ea83290e38b8c6342dd42f56945 --- /dev/null +++ b/codenet/public_test_cases/p02637/output.3.txt @@ -0,0 +1 @@ +1 2 3 4 1 3 1 2 4 3 diff --git a/codenet/public_test_cases/p02638/input.0.txt b/codenet/public_test_cases/p02638/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78420e9611b56cdaa7dc49b15e7f890fd8515dfd --- /dev/null +++ b/codenet/public_test_cases/p02638/input.0.txt @@ -0,0 +1 @@ +4 3 998244353 diff --git a/codenet/public_test_cases/p02638/input.1.txt b/codenet/public_test_cases/p02638/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..79a4a565c6803c1aeb4d4125112a8408edf42025 --- /dev/null +++ b/codenet/public_test_cases/p02638/input.1.txt @@ -0,0 +1 @@ +7 3 998244353 diff --git a/codenet/public_test_cases/p02638/input.2.txt b/codenet/public_test_cases/p02638/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5107f8eff25b4eaf6f937ceb4b8f6d91f6b4cfce --- /dev/null +++ b/codenet/public_test_cases/p02638/input.2.txt @@ -0,0 +1 @@ +50 37 998244353 diff --git a/codenet/public_test_cases/p02638/input.3.txt b/codenet/public_test_cases/p02638/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..78420e9611b56cdaa7dc49b15e7f890fd8515dfd --- /dev/null +++ b/codenet/public_test_cases/p02638/input.3.txt @@ -0,0 +1 @@ +4 3 998244353 diff --git a/codenet/public_test_cases/p02638/output.0.txt b/codenet/public_test_cases/p02638/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b91e0e1f8dddaac700b51aa7a66f29fc135a02 --- /dev/null +++ b/codenet/public_test_cases/p02638/output.0.txt @@ -0,0 +1 @@ +56 diff --git a/codenet/public_test_cases/p02638/output.1.txt b/codenet/public_test_cases/p02638/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1708fb1ce41f448a900be7508aeaa82d6c4708a --- /dev/null +++ b/codenet/public_test_cases/p02638/output.1.txt @@ -0,0 +1 @@ +720 diff --git a/codenet/public_test_cases/p02638/output.2.txt b/codenet/public_test_cases/p02638/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d20ec888cc0c25f11b4b2606e8e88c9b24531df9 --- /dev/null +++ b/codenet/public_test_cases/p02638/output.2.txt @@ -0,0 +1 @@ +495799508 diff --git a/codenet/public_test_cases/p02638/output.3.txt b/codenet/public_test_cases/p02638/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b91e0e1f8dddaac700b51aa7a66f29fc135a02 --- /dev/null +++ b/codenet/public_test_cases/p02638/output.3.txt @@ -0,0 +1 @@ +56 diff --git a/codenet/public_test_cases/p02639/input.0.txt b/codenet/public_test_cases/p02639/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad24b08601ff679ff2342d513229b5b0b6541d02 --- /dev/null +++ b/codenet/public_test_cases/p02639/input.0.txt @@ -0,0 +1 @@ +0 2 3 4 5 diff --git a/codenet/public_test_cases/p02639/output.0.txt b/codenet/public_test_cases/p02639/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02639/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02640/input.0.txt b/codenet/public_test_cases/p02640/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2dc2f56a9bc897dbf64266196e6173cc2a98edf --- /dev/null +++ b/codenet/public_test_cases/p02640/input.0.txt @@ -0,0 +1 @@ +3 8 diff --git a/codenet/public_test_cases/p02640/input.1.txt b/codenet/public_test_cases/p02640/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p02640/input.1.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p02640/input.2.txt b/codenet/public_test_cases/p02640/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2dc2f56a9bc897dbf64266196e6173cc2a98edf --- /dev/null +++ b/codenet/public_test_cases/p02640/input.2.txt @@ -0,0 +1 @@ +3 8 diff --git a/codenet/public_test_cases/p02640/input.3.txt b/codenet/public_test_cases/p02640/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..11a0a477e642357dd32621e6bc2bb78f85075b57 --- /dev/null +++ b/codenet/public_test_cases/p02640/input.3.txt @@ -0,0 +1 @@ +2 100 diff --git a/codenet/public_test_cases/p02640/output.0.txt b/codenet/public_test_cases/p02640/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02640/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02640/output.1.txt b/codenet/public_test_cases/p02640/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02640/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02640/output.2.txt b/codenet/public_test_cases/p02640/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02640/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02640/output.3.txt b/codenet/public_test_cases/p02640/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02640/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02641/input.0.txt b/codenet/public_test_cases/p02641/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63c3c52dc94d52bf11457386c1b482566c927d14 --- /dev/null +++ b/codenet/public_test_cases/p02641/input.0.txt @@ -0,0 +1,2 @@ +6 5 +4 7 10 6 5 diff --git a/codenet/public_test_cases/p02641/input.1.txt b/codenet/public_test_cases/p02641/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63c3c52dc94d52bf11457386c1b482566c927d14 --- /dev/null +++ b/codenet/public_test_cases/p02641/input.1.txt @@ -0,0 +1,2 @@ +6 5 +4 7 10 6 5 diff --git a/codenet/public_test_cases/p02641/input.2.txt b/codenet/public_test_cases/p02641/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..37432ec2ff4b098f6468135b01f7447ed1e05cf8 --- /dev/null +++ b/codenet/public_test_cases/p02641/input.2.txt @@ -0,0 +1,2 @@ +10 5 +4 7 10 6 5 diff --git a/codenet/public_test_cases/p02641/input.3.txt b/codenet/public_test_cases/p02641/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45d4794c122865f3d0b54adfddf0b0f30f96c4ff --- /dev/null +++ b/codenet/public_test_cases/p02641/input.3.txt @@ -0,0 +1 @@ +100 0 diff --git a/codenet/public_test_cases/p02641/output.0.txt b/codenet/public_test_cases/p02641/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02641/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02641/output.1.txt b/codenet/public_test_cases/p02641/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02641/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02641/output.2.txt b/codenet/public_test_cases/p02641/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02641/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02641/output.3.txt b/codenet/public_test_cases/p02641/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02641/output.3.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02642/input.0.txt b/codenet/public_test_cases/p02642/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63225412ce9c48c68ed852a60067799cf90e3b39 --- /dev/null +++ b/codenet/public_test_cases/p02642/input.0.txt @@ -0,0 +1,2 @@ +5 +24 11 8 3 16 diff --git a/codenet/public_test_cases/p02642/input.1.txt b/codenet/public_test_cases/p02642/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63225412ce9c48c68ed852a60067799cf90e3b39 --- /dev/null +++ b/codenet/public_test_cases/p02642/input.1.txt @@ -0,0 +1,2 @@ +5 +24 11 8 3 16 diff --git a/codenet/public_test_cases/p02642/input.2.txt b/codenet/public_test_cases/p02642/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1ce297b6718163b87d6a01833200104a831c730 --- /dev/null +++ b/codenet/public_test_cases/p02642/input.2.txt @@ -0,0 +1,2 @@ +10 +33 18 45 28 8 19 89 86 2 4 diff --git a/codenet/public_test_cases/p02642/input.3.txt b/codenet/public_test_cases/p02642/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aed51c9aec99e106e034a27cb7cc39d8e11bbe8f --- /dev/null +++ b/codenet/public_test_cases/p02642/input.3.txt @@ -0,0 +1,2 @@ +4 +5 5 5 5 diff --git a/codenet/public_test_cases/p02642/output.0.txt b/codenet/public_test_cases/p02642/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02642/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02642/output.1.txt b/codenet/public_test_cases/p02642/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02642/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02642/output.2.txt b/codenet/public_test_cases/p02642/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02642/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02642/output.3.txt b/codenet/public_test_cases/p02642/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02642/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02643/input.0.txt b/codenet/public_test_cases/p02643/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1999607bb4977772ceae3e3ac7bdedb837f40cdd --- /dev/null +++ b/codenet/public_test_cases/p02643/input.0.txt @@ -0,0 +1,10 @@ +6 3 +8 1 +6 2 +9 3 +1 1 +2 2 +1 3 +4 3 +2 1 +1 2 diff --git a/codenet/public_test_cases/p02643/output.0.txt b/codenet/public_test_cases/p02643/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d0b1ba6307dcebd82758a559986eb9ec2237011 --- /dev/null +++ b/codenet/public_test_cases/p02643/output.0.txt @@ -0,0 +1,3 @@ +6 +2 +6 diff --git a/codenet/public_test_cases/p02644/input.0.txt b/codenet/public_test_cases/p02644/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3112ecbd36db4d49a2d169f8edc35ebc19a86b --- /dev/null +++ b/codenet/public_test_cases/p02644/input.0.txt @@ -0,0 +1,5 @@ +3 5 2 +3 2 3 4 +..... +.@..@ +..@.. diff --git a/codenet/public_test_cases/p02644/input.1.txt b/codenet/public_test_cases/p02644/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c3112ecbd36db4d49a2d169f8edc35ebc19a86b --- /dev/null +++ b/codenet/public_test_cases/p02644/input.1.txt @@ -0,0 +1,5 @@ +3 5 2 +3 2 3 4 +..... +.@..@ +..@.. diff --git a/codenet/public_test_cases/p02644/input.2.txt b/codenet/public_test_cases/p02644/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9869982fd020594c6ccb63166b03fd24c93d3287 --- /dev/null +++ b/codenet/public_test_cases/p02644/input.2.txt @@ -0,0 +1,5 @@ +3 3 1 +2 1 2 3 +.@. +.@. +.@. diff --git a/codenet/public_test_cases/p02644/input.3.txt b/codenet/public_test_cases/p02644/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4e613680fcfb69a30a582cb88eb88ec35d235fe --- /dev/null +++ b/codenet/public_test_cases/p02644/input.3.txt @@ -0,0 +1,3 @@ +1 6 4 +1 1 1 6 +...... diff --git a/codenet/public_test_cases/p02644/output.0.txt b/codenet/public_test_cases/p02644/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02644/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02644/output.1.txt b/codenet/public_test_cases/p02644/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02644/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02644/output.2.txt b/codenet/public_test_cases/p02644/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02644/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02644/output.3.txt b/codenet/public_test_cases/p02644/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02644/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02645/input.0.txt b/codenet/public_test_cases/p02645/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e420516e269420197bb8d0fb615f30911f0c4212 --- /dev/null +++ b/codenet/public_test_cases/p02645/input.0.txt @@ -0,0 +1 @@ +takahashi diff --git a/codenet/public_test_cases/p02645/input.1.txt b/codenet/public_test_cases/p02645/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1abf5467d03369658f3627455d26a14456b552fa --- /dev/null +++ b/codenet/public_test_cases/p02645/input.1.txt @@ -0,0 +1 @@ +naohiro diff --git a/codenet/public_test_cases/p02645/input.2.txt b/codenet/public_test_cases/p02645/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e420516e269420197bb8d0fb615f30911f0c4212 --- /dev/null +++ b/codenet/public_test_cases/p02645/input.2.txt @@ -0,0 +1 @@ +takahashi diff --git a/codenet/public_test_cases/p02645/output.0.txt b/codenet/public_test_cases/p02645/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2caaa8bc32b9c3e6d8f27d64e5eb02633e8301e --- /dev/null +++ b/codenet/public_test_cases/p02645/output.0.txt @@ -0,0 +1 @@ +tak diff --git a/codenet/public_test_cases/p02645/output.1.txt b/codenet/public_test_cases/p02645/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca58d3e807df518abc910bbd0332ccae7c649386 --- /dev/null +++ b/codenet/public_test_cases/p02645/output.1.txt @@ -0,0 +1 @@ +nao diff --git a/codenet/public_test_cases/p02645/output.2.txt b/codenet/public_test_cases/p02645/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2caaa8bc32b9c3e6d8f27d64e5eb02633e8301e --- /dev/null +++ b/codenet/public_test_cases/p02645/output.2.txt @@ -0,0 +1 @@ +tak diff --git a/codenet/public_test_cases/p02646/input.0.txt b/codenet/public_test_cases/p02646/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0ddba1906d2568ad1d71c59a85ccb6bfd75c46d --- /dev/null +++ b/codenet/public_test_cases/p02646/input.0.txt @@ -0,0 +1,3 @@ +1 2 +3 1 +3 diff --git a/codenet/public_test_cases/p02646/input.1.txt b/codenet/public_test_cases/p02646/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f3332e48939e71657b319430d0d013a8a625bae --- /dev/null +++ b/codenet/public_test_cases/p02646/input.1.txt @@ -0,0 +1,3 @@ +1 2 +3 3 +3 diff --git a/codenet/public_test_cases/p02646/input.2.txt b/codenet/public_test_cases/p02646/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a7e3a4fa4cd8ad6f2ce4254de3cd6cfde5daedb --- /dev/null +++ b/codenet/public_test_cases/p02646/input.2.txt @@ -0,0 +1,3 @@ +1 2 +3 2 +3 diff --git a/codenet/public_test_cases/p02646/input.3.txt b/codenet/public_test_cases/p02646/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0ddba1906d2568ad1d71c59a85ccb6bfd75c46d --- /dev/null +++ b/codenet/public_test_cases/p02646/input.3.txt @@ -0,0 +1,3 @@ +1 2 +3 1 +3 diff --git a/codenet/public_test_cases/p02646/output.0.txt b/codenet/public_test_cases/p02646/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p02646/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p02646/output.1.txt b/codenet/public_test_cases/p02646/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p02646/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p02646/output.2.txt b/codenet/public_test_cases/p02646/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p02646/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p02646/output.3.txt b/codenet/public_test_cases/p02646/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p02646/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p02647/input.0.txt b/codenet/public_test_cases/p02647/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecfc2e397225096d9e7d867497b982d27e9edb8a --- /dev/null +++ b/codenet/public_test_cases/p02647/input.0.txt @@ -0,0 +1,2 @@ +5 1 +1 0 0 1 0 diff --git a/codenet/public_test_cases/p02647/input.1.txt b/codenet/public_test_cases/p02647/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecfc2e397225096d9e7d867497b982d27e9edb8a --- /dev/null +++ b/codenet/public_test_cases/p02647/input.1.txt @@ -0,0 +1,2 @@ +5 1 +1 0 0 1 0 diff --git a/codenet/public_test_cases/p02647/input.2.txt b/codenet/public_test_cases/p02647/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8eac7e58ed8ad45be1228cfc7c9cf21934a1c60 --- /dev/null +++ b/codenet/public_test_cases/p02647/input.2.txt @@ -0,0 +1,2 @@ +5 2 +1 0 0 1 0 diff --git a/codenet/public_test_cases/p02647/output.0.txt b/codenet/public_test_cases/p02647/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cf86adc4f50f5a4eadb42e383712c737a335986 --- /dev/null +++ b/codenet/public_test_cases/p02647/output.0.txt @@ -0,0 +1 @@ +1 2 2 1 2 diff --git a/codenet/public_test_cases/p02647/output.1.txt b/codenet/public_test_cases/p02647/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cf86adc4f50f5a4eadb42e383712c737a335986 --- /dev/null +++ b/codenet/public_test_cases/p02647/output.1.txt @@ -0,0 +1 @@ +1 2 2 1 2 diff --git a/codenet/public_test_cases/p02647/output.2.txt b/codenet/public_test_cases/p02647/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4898fed7ee2e2329633fccbac8eb79ff0ff0fc34 --- /dev/null +++ b/codenet/public_test_cases/p02647/output.2.txt @@ -0,0 +1 @@ +3 3 4 4 3 diff --git a/codenet/public_test_cases/p02648/input.0.txt b/codenet/public_test_cases/p02648/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..541911adb543d8f0c0d942784acc0953935b9f5f --- /dev/null +++ b/codenet/public_test_cases/p02648/input.0.txt @@ -0,0 +1,8 @@ +3 +1 2 +2 3 +3 4 +3 +1 1 +2 5 +3 5 diff --git a/codenet/public_test_cases/p02648/input.1.txt b/codenet/public_test_cases/p02648/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c329965fe4ed9f5c77872393c6c4af4fe16b046a --- /dev/null +++ b/codenet/public_test_cases/p02648/input.1.txt @@ -0,0 +1,25 @@ +15 +123 119 +129 120 +132 112 +126 109 +118 103 +115 109 +102 100 +130 120 +105 105 +132 115 +104 102 +107 107 +127 116 +121 104 +121 115 +8 +8 234 +9 244 +10 226 +11 227 +12 240 +13 237 +14 206 +15 227 diff --git a/codenet/public_test_cases/p02648/input.2.txt b/codenet/public_test_cases/p02648/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..541911adb543d8f0c0d942784acc0953935b9f5f --- /dev/null +++ b/codenet/public_test_cases/p02648/input.2.txt @@ -0,0 +1,8 @@ +3 +1 2 +2 3 +3 4 +3 +1 1 +2 5 +3 5 diff --git a/codenet/public_test_cases/p02648/output.0.txt b/codenet/public_test_cases/p02648/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..34f748e1c217cd8eae5a7804cdc0222be96c0232 --- /dev/null +++ b/codenet/public_test_cases/p02648/output.0.txt @@ -0,0 +1,3 @@ +0 +3 +3 diff --git a/codenet/public_test_cases/p02648/output.1.txt b/codenet/public_test_cases/p02648/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b380444296d29dddadaa8fd441a0a57e8396a9bd --- /dev/null +++ b/codenet/public_test_cases/p02648/output.1.txt @@ -0,0 +1,8 @@ +256 +255 +250 +247 +255 +259 +223 +253 diff --git a/codenet/public_test_cases/p02648/output.2.txt b/codenet/public_test_cases/p02648/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..34f748e1c217cd8eae5a7804cdc0222be96c0232 --- /dev/null +++ b/codenet/public_test_cases/p02648/output.2.txt @@ -0,0 +1,3 @@ +0 +3 +3 diff --git a/codenet/public_test_cases/p02649/input.0.txt b/codenet/public_test_cases/p02649/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61db0f613f0208b69a8a7c928f26e8e450702249 --- /dev/null +++ b/codenet/public_test_cases/p02649/input.0.txt @@ -0,0 +1,2 @@ +3 3 0 3 +1 2 3 diff --git a/codenet/public_test_cases/p02649/input.1.txt b/codenet/public_test_cases/p02649/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..61db0f613f0208b69a8a7c928f26e8e450702249 --- /dev/null +++ b/codenet/public_test_cases/p02649/input.1.txt @@ -0,0 +1,2 @@ +3 3 0 3 +1 2 3 diff --git a/codenet/public_test_cases/p02649/input.2.txt b/codenet/public_test_cases/p02649/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..af80700b9bb95dbe385024d236dbf09213d845b4 --- /dev/null +++ b/codenet/public_test_cases/p02649/input.2.txt @@ -0,0 +1,2 @@ +5 3 1 7 +3 4 9 1 5 diff --git a/codenet/public_test_cases/p02649/input.3.txt b/codenet/public_test_cases/p02649/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..56eb62f57b9668226d0b91fc51e49af1dc1056a5 --- /dev/null +++ b/codenet/public_test_cases/p02649/input.3.txt @@ -0,0 +1,2 @@ +5 4 0 15 +3 4 9 1 5 diff --git a/codenet/public_test_cases/p02649/output.0.txt b/codenet/public_test_cases/p02649/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02649/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02649/output.1.txt b/codenet/public_test_cases/p02649/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02649/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02649/output.2.txt b/codenet/public_test_cases/p02649/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02649/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02649/output.3.txt b/codenet/public_test_cases/p02649/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02649/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02650/input.0.txt b/codenet/public_test_cases/p02650/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bafe88d75575352861ed5f2a438df237bed39211 --- /dev/null +++ b/codenet/public_test_cases/p02650/input.0.txt @@ -0,0 +1 @@ +2 3 1 diff --git a/codenet/public_test_cases/p02650/input.1.txt b/codenet/public_test_cases/p02650/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bafe88d75575352861ed5f2a438df237bed39211 --- /dev/null +++ b/codenet/public_test_cases/p02650/input.1.txt @@ -0,0 +1 @@ +2 3 1 diff --git a/codenet/public_test_cases/p02650/input.2.txt b/codenet/public_test_cases/p02650/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a93b4836e343f6ce0eaac00079e80641de00fd1 --- /dev/null +++ b/codenet/public_test_cases/p02650/input.2.txt @@ -0,0 +1 @@ +100 100 1000 diff --git a/codenet/public_test_cases/p02650/input.3.txt b/codenet/public_test_cases/p02650/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6df4d3d24c3ddf4b447b03d9980579b8df2b3139 --- /dev/null +++ b/codenet/public_test_cases/p02650/input.3.txt @@ -0,0 +1 @@ +5 4 5 diff --git a/codenet/public_test_cases/p02650/output.0.txt b/codenet/public_test_cases/p02650/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02650/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02650/output.1.txt b/codenet/public_test_cases/p02650/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02650/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02650/output.2.txt b/codenet/public_test_cases/p02650/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..693db006a0e91d8dbe072cc36f00ba8e0fe9085b --- /dev/null +++ b/codenet/public_test_cases/p02650/output.2.txt @@ -0,0 +1 @@ +461316 diff --git a/codenet/public_test_cases/p02650/output.3.txt b/codenet/public_test_cases/p02650/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..94361d49fd91ff9629fe80ddd10a5cb5581cbb0d --- /dev/null +++ b/codenet/public_test_cases/p02650/output.3.txt @@ -0,0 +1 @@ +132 diff --git a/codenet/public_test_cases/p02651/input.0.txt b/codenet/public_test_cases/p02651/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba9048c07a40f4cc5b30d4b16451326fe44a92a8 --- /dev/null +++ b/codenet/public_test_cases/p02651/input.0.txt @@ -0,0 +1,10 @@ +3 +2 +1 2 +10 +2 +1 1 +10 +6 +2 3 4 5 6 7 +111000 diff --git a/codenet/public_test_cases/p02651/input.1.txt b/codenet/public_test_cases/p02651/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba9048c07a40f4cc5b30d4b16451326fe44a92a8 --- /dev/null +++ b/codenet/public_test_cases/p02651/input.1.txt @@ -0,0 +1,10 @@ +3 +2 +1 2 +10 +2 +1 1 +10 +6 +2 3 4 5 6 7 +111000 diff --git a/codenet/public_test_cases/p02651/output.0.txt b/codenet/public_test_cases/p02651/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e22493782f088a61eee427426ee46732c94f5238 --- /dev/null +++ b/codenet/public_test_cases/p02651/output.0.txt @@ -0,0 +1,3 @@ +1 +0 +0 diff --git a/codenet/public_test_cases/p02651/output.1.txt b/codenet/public_test_cases/p02651/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e22493782f088a61eee427426ee46732c94f5238 --- /dev/null +++ b/codenet/public_test_cases/p02651/output.1.txt @@ -0,0 +1,3 @@ +1 +0 +0 diff --git a/codenet/public_test_cases/p02652/input.0.txt b/codenet/public_test_cases/p02652/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9056ac75f1803f8885d551335384830b682f01f5 --- /dev/null +++ b/codenet/public_test_cases/p02652/input.0.txt @@ -0,0 +1 @@ +0?? diff --git a/codenet/public_test_cases/p02652/input.1.txt b/codenet/public_test_cases/p02652/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..173e7628ed38b22420ef40bee7773fb1e876130d --- /dev/null +++ b/codenet/public_test_cases/p02652/input.1.txt @@ -0,0 +1 @@ +??00????0??0????0?0??00??1???11?1?1???1?11?111???1 diff --git a/codenet/public_test_cases/p02652/input.2.txt b/codenet/public_test_cases/p02652/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..91aa0938476a75e2ace78c9e5066a12356eca9a3 --- /dev/null +++ b/codenet/public_test_cases/p02652/input.2.txt @@ -0,0 +1 @@ +0??0 diff --git a/codenet/public_test_cases/p02652/input.3.txt b/codenet/public_test_cases/p02652/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9056ac75f1803f8885d551335384830b682f01f5 --- /dev/null +++ b/codenet/public_test_cases/p02652/input.3.txt @@ -0,0 +1 @@ +0?? diff --git a/codenet/public_test_cases/p02652/output.0.txt b/codenet/public_test_cases/p02652/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02652/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02652/output.1.txt b/codenet/public_test_cases/p02652/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02652/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02652/output.2.txt b/codenet/public_test_cases/p02652/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02652/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02652/output.3.txt b/codenet/public_test_cases/p02652/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02652/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02653/input.0.txt b/codenet/public_test_cases/p02653/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce28b14c5fb7efa72f16989b86cbeb028ae8ca88 --- /dev/null +++ b/codenet/public_test_cases/p02653/input.0.txt @@ -0,0 +1 @@ +4 2 3 diff --git a/codenet/public_test_cases/p02653/input.1.txt b/codenet/public_test_cases/p02653/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce28b14c5fb7efa72f16989b86cbeb028ae8ca88 --- /dev/null +++ b/codenet/public_test_cases/p02653/input.1.txt @@ -0,0 +1 @@ +4 2 3 diff --git a/codenet/public_test_cases/p02653/input.2.txt b/codenet/public_test_cases/p02653/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..36b3f3f686efd482d755256fcae19a5cd81f4f7f --- /dev/null +++ b/codenet/public_test_cases/p02653/input.2.txt @@ -0,0 +1 @@ +10 7 2 diff --git a/codenet/public_test_cases/p02653/input.3.txt b/codenet/public_test_cases/p02653/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b9805aa15277dfdb7ee0c0dec4baffceae8c716 --- /dev/null +++ b/codenet/public_test_cases/p02653/input.3.txt @@ -0,0 +1 @@ +1000 100 10 diff --git a/codenet/public_test_cases/p02653/output.0.txt b/codenet/public_test_cases/p02653/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02653/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02653/output.1.txt b/codenet/public_test_cases/p02653/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02653/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02653/output.2.txt b/codenet/public_test_cases/p02653/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..910fbe3bdd220018a099036b5b3b7069b7d312f3 --- /dev/null +++ b/codenet/public_test_cases/p02653/output.2.txt @@ -0,0 +1 @@ +533 diff --git a/codenet/public_test_cases/p02653/output.3.txt b/codenet/public_test_cases/p02653/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00430ebb81dee5770ba0b3931f96497fc6bd938 --- /dev/null +++ b/codenet/public_test_cases/p02653/output.3.txt @@ -0,0 +1 @@ +828178524 diff --git a/codenet/public_test_cases/p02654/input.0.txt b/codenet/public_test_cases/p02654/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p02654/input.0.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p02654/input.1.txt b/codenet/public_test_cases/p02654/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p02654/input.1.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p02654/input.2.txt b/codenet/public_test_cases/p02654/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02654/input.2.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02654/input.3.txt b/codenet/public_test_cases/p02654/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..18bc02678d193629d8fd901fd613aa2668086a88 --- /dev/null +++ b/codenet/public_test_cases/p02654/input.3.txt @@ -0,0 +1 @@ +8 4 diff --git a/codenet/public_test_cases/p02654/input.4.txt b/codenet/public_test_cases/p02654/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a2f082baadc9101ae31976f6070174096e8a9d3 --- /dev/null +++ b/codenet/public_test_cases/p02654/input.4.txt @@ -0,0 +1 @@ +9999999 4999 diff --git a/codenet/public_test_cases/p02654/output.0.txt b/codenet/public_test_cases/p02654/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02654/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02654/output.1.txt b/codenet/public_test_cases/p02654/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02654/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02654/output.2.txt b/codenet/public_test_cases/p02654/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02654/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02654/output.3.txt b/codenet/public_test_cases/p02654/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9557d41903e69f02f1022a354ebd64e18c0da82 --- /dev/null +++ b/codenet/public_test_cases/p02654/output.3.txt @@ -0,0 +1 @@ +16776 diff --git a/codenet/public_test_cases/p02654/output.4.txt b/codenet/public_test_cases/p02654/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6be59f61f9483f20576f0adf8174c36055314c37 --- /dev/null +++ b/codenet/public_test_cases/p02654/output.4.txt @@ -0,0 +1 @@ +90395416 diff --git a/codenet/public_test_cases/p02655/input.0.txt b/codenet/public_test_cases/p02655/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf635687be6a5b02dd1c2f5912bfdf5357872fec --- /dev/null +++ b/codenet/public_test_cases/p02655/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 +2 1 1 +1 3 2 diff --git a/codenet/public_test_cases/p02655/input.1.txt b/codenet/public_test_cases/p02655/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf635687be6a5b02dd1c2f5912bfdf5357872fec --- /dev/null +++ b/codenet/public_test_cases/p02655/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 +2 1 1 +1 3 2 diff --git a/codenet/public_test_cases/p02655/input.2.txt b/codenet/public_test_cases/p02655/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..840397fa54005456e19b06911facbc1c095b8a33 --- /dev/null +++ b/codenet/public_test_cases/p02655/input.2.txt @@ -0,0 +1,2 @@ +1 1 +1 1 1 diff --git a/codenet/public_test_cases/p02655/input.3.txt b/codenet/public_test_cases/p02655/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..14a08ad68b20fee28c83a586cdc42f957e4a7614 --- /dev/null +++ b/codenet/public_test_cases/p02655/input.3.txt @@ -0,0 +1,3 @@ +2 2 +1 2 1 +2 1 1 diff --git a/codenet/public_test_cases/p02655/input.4.txt b/codenet/public_test_cases/p02655/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee7d35687de1b593489a664ce2c1efe17aed4ce9 --- /dev/null +++ b/codenet/public_test_cases/p02655/input.4.txt @@ -0,0 +1,6 @@ +5 5 +1 2 1 +2 1 1 +1 3 2 +4 5 1 +5 4 1 diff --git a/codenet/public_test_cases/p02655/output.0.txt b/codenet/public_test_cases/p02655/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02655/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02655/output.1.txt b/codenet/public_test_cases/p02655/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02655/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02655/output.2.txt b/codenet/public_test_cases/p02655/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02655/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02655/output.3.txt b/codenet/public_test_cases/p02655/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02655/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02655/output.4.txt b/codenet/public_test_cases/p02655/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02655/output.4.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02656/input.0.txt b/codenet/public_test_cases/p02656/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca3391758e69f72712026250f3aaa5cfe27b6c4a --- /dev/null +++ b/codenet/public_test_cases/p02656/input.0.txt @@ -0,0 +1,4 @@ +3 +3 3 4 4 5 +2 1 1 5 3 +3 1 4 2 5 diff --git a/codenet/public_test_cases/p02656/input.1.txt b/codenet/public_test_cases/p02656/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca3391758e69f72712026250f3aaa5cfe27b6c4a --- /dev/null +++ b/codenet/public_test_cases/p02656/input.1.txt @@ -0,0 +1,4 @@ +3 +3 3 4 4 5 +2 1 1 5 3 +3 1 4 2 5 diff --git a/codenet/public_test_cases/p02656/output.0.txt b/codenet/public_test_cases/p02656/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..073f6a1f4553b50607f473c89c54ef74adab11c4 --- /dev/null +++ b/codenet/public_test_cases/p02656/output.0.txt @@ -0,0 +1,3 @@ +2 +2 +0 diff --git a/codenet/public_test_cases/p02656/output.1.txt b/codenet/public_test_cases/p02656/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..073f6a1f4553b50607f473c89c54ef74adab11c4 --- /dev/null +++ b/codenet/public_test_cases/p02656/output.1.txt @@ -0,0 +1,3 @@ +2 +2 +0 diff --git a/codenet/public_test_cases/p02657/input.0.txt b/codenet/public_test_cases/p02657/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p02657/input.0.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p02657/input.1.txt b/codenet/public_test_cases/p02657/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p02657/input.1.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p02657/input.2.txt b/codenet/public_test_cases/p02657/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9732b55455bca575261eac1a6a7082c96223368d --- /dev/null +++ b/codenet/public_test_cases/p02657/input.2.txt @@ -0,0 +1 @@ +100 100 diff --git a/codenet/public_test_cases/p02657/output.0.txt b/codenet/public_test_cases/p02657/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02657/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02657/output.1.txt b/codenet/public_test_cases/p02657/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02657/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02657/output.2.txt b/codenet/public_test_cases/p02657/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5caff40c4a0ce4ed0dcb3aa983da623641af1b06 --- /dev/null +++ b/codenet/public_test_cases/p02657/output.2.txt @@ -0,0 +1 @@ +10000 diff --git a/codenet/public_test_cases/p02658/input.0.txt b/codenet/public_test_cases/p02658/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..958790da0178594a1d5db96f99abc60a97971d89 --- /dev/null +++ b/codenet/public_test_cases/p02658/input.0.txt @@ -0,0 +1,2 @@ +2 +1000000000 1000000000 diff --git a/codenet/public_test_cases/p02658/input.1.txt b/codenet/public_test_cases/p02658/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa338a9b97778811fbe3e8f28861af4a3a20d764 --- /dev/null +++ b/codenet/public_test_cases/p02658/input.1.txt @@ -0,0 +1,2 @@ +3 +101 9901 999999000001 diff --git a/codenet/public_test_cases/p02658/input.2.txt b/codenet/public_test_cases/p02658/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..958790da0178594a1d5db96f99abc60a97971d89 --- /dev/null +++ b/codenet/public_test_cases/p02658/input.2.txt @@ -0,0 +1,2 @@ +2 +1000000000 1000000000 diff --git a/codenet/public_test_cases/p02658/input.3.txt b/codenet/public_test_cases/p02658/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9dc47b040b25636f53758fd0512363519357b426 --- /dev/null +++ b/codenet/public_test_cases/p02658/input.3.txt @@ -0,0 +1,2 @@ +31 +4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 diff --git a/codenet/public_test_cases/p02658/output.0.txt b/codenet/public_test_cases/p02658/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a4149f568ebd1c601c9657a0e51a097d0c2703 --- /dev/null +++ b/codenet/public_test_cases/p02658/output.0.txt @@ -0,0 +1 @@ +1000000000000000000 diff --git a/codenet/public_test_cases/p02658/output.1.txt b/codenet/public_test_cases/p02658/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02658/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02658/output.2.txt b/codenet/public_test_cases/p02658/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a4149f568ebd1c601c9657a0e51a097d0c2703 --- /dev/null +++ b/codenet/public_test_cases/p02658/output.2.txt @@ -0,0 +1 @@ +1000000000000000000 diff --git a/codenet/public_test_cases/p02658/output.3.txt b/codenet/public_test_cases/p02658/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02658/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02659/input.0.txt b/codenet/public_test_cases/p02659/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a25fce5a60aae7477a3d03b41a893e68e0175c56 --- /dev/null +++ b/codenet/public_test_cases/p02659/input.0.txt @@ -0,0 +1 @@ +198 1.10 diff --git a/codenet/public_test_cases/p02659/input.1.txt b/codenet/public_test_cases/p02659/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6836fcb1a73747262f8183e48fc7b8afce55d557 --- /dev/null +++ b/codenet/public_test_cases/p02659/input.1.txt @@ -0,0 +1 @@ +1000000000000000 9.99 diff --git a/codenet/public_test_cases/p02659/input.2.txt b/codenet/public_test_cases/p02659/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2a381a5304929fbafde87bad2100932bbd0a780 --- /dev/null +++ b/codenet/public_test_cases/p02659/input.2.txt @@ -0,0 +1 @@ +1 0.01 diff --git a/codenet/public_test_cases/p02659/input.3.txt b/codenet/public_test_cases/p02659/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a25fce5a60aae7477a3d03b41a893e68e0175c56 --- /dev/null +++ b/codenet/public_test_cases/p02659/input.3.txt @@ -0,0 +1 @@ +198 1.10 diff --git a/codenet/public_test_cases/p02659/output.0.txt b/codenet/public_test_cases/p02659/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ddd619ce324e5504d2b8485e18bded06360cc35 --- /dev/null +++ b/codenet/public_test_cases/p02659/output.0.txt @@ -0,0 +1 @@ +217 diff --git a/codenet/public_test_cases/p02659/output.1.txt b/codenet/public_test_cases/p02659/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38fbcc95013f213ddc698a7c620782340dfd0f1b --- /dev/null +++ b/codenet/public_test_cases/p02659/output.1.txt @@ -0,0 +1 @@ +9990000000000000 diff --git a/codenet/public_test_cases/p02659/output.2.txt b/codenet/public_test_cases/p02659/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02659/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02659/output.3.txt b/codenet/public_test_cases/p02659/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ddd619ce324e5504d2b8485e18bded06360cc35 --- /dev/null +++ b/codenet/public_test_cases/p02659/output.3.txt @@ -0,0 +1 @@ +217 diff --git a/codenet/public_test_cases/p02660/input.0.txt b/codenet/public_test_cases/p02660/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p02660/input.0.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p02660/input.1.txt b/codenet/public_test_cases/p02660/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1501caaab3fd24cb4dbb9b42270fc8a07edb389d --- /dev/null +++ b/codenet/public_test_cases/p02660/input.1.txt @@ -0,0 +1 @@ +997764507000 diff --git a/codenet/public_test_cases/p02660/input.2.txt b/codenet/public_test_cases/p02660/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02660/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02660/input.3.txt b/codenet/public_test_cases/p02660/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6faa9c9d6e7bf9bf3e68e8b43b085dd9e59f8f25 --- /dev/null +++ b/codenet/public_test_cases/p02660/input.3.txt @@ -0,0 +1 @@ +1000000007 diff --git a/codenet/public_test_cases/p02660/input.4.txt b/codenet/public_test_cases/p02660/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p02660/input.4.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p02660/input.5.txt b/codenet/public_test_cases/p02660/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p02660/input.5.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p02660/output.0.txt b/codenet/public_test_cases/p02660/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02660/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02660/output.1.txt b/codenet/public_test_cases/p02660/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02660/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02660/output.2.txt b/codenet/public_test_cases/p02660/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02660/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02660/output.3.txt b/codenet/public_test_cases/p02660/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02660/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02660/output.4.txt b/codenet/public_test_cases/p02660/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02660/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02660/output.5.txt b/codenet/public_test_cases/p02660/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02660/output.5.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02661/input.0.txt b/codenet/public_test_cases/p02661/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b748c75bb4ea25e912f969605091597490b9e01 --- /dev/null +++ b/codenet/public_test_cases/p02661/input.0.txt @@ -0,0 +1,3 @@ +2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02661/input.1.txt b/codenet/public_test_cases/p02661/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..461135a422cd44043f6f18d751317a2b38ba159e --- /dev/null +++ b/codenet/public_test_cases/p02661/input.1.txt @@ -0,0 +1,4 @@ +3 +100 100 +10 10000 +1 1000000000 diff --git a/codenet/public_test_cases/p02661/input.2.txt b/codenet/public_test_cases/p02661/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b748c75bb4ea25e912f969605091597490b9e01 --- /dev/null +++ b/codenet/public_test_cases/p02661/input.2.txt @@ -0,0 +1,3 @@ +2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02661/output.0.txt b/codenet/public_test_cases/p02661/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02661/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02661/output.1.txt b/codenet/public_test_cases/p02661/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c98046776faff65457a63da4b52fb2c77f430c41 --- /dev/null +++ b/codenet/public_test_cases/p02661/output.1.txt @@ -0,0 +1 @@ +9991 diff --git a/codenet/public_test_cases/p02661/output.2.txt b/codenet/public_test_cases/p02661/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02661/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02662/input.0.txt b/codenet/public_test_cases/p02662/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cfac9da29c4563d40b86107c4635d07f7b200c2 --- /dev/null +++ b/codenet/public_test_cases/p02662/input.0.txt @@ -0,0 +1,2 @@ +3 4 +2 2 4 diff --git a/codenet/public_test_cases/p02662/input.1.txt b/codenet/public_test_cases/p02662/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b484ef92ca890ff8d2558c090bcfc742f658059 --- /dev/null +++ b/codenet/public_test_cases/p02662/input.1.txt @@ -0,0 +1,2 @@ +5 8 +9 9 9 9 9 diff --git a/codenet/public_test_cases/p02662/input.2.txt b/codenet/public_test_cases/p02662/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cfac9da29c4563d40b86107c4635d07f7b200c2 --- /dev/null +++ b/codenet/public_test_cases/p02662/input.2.txt @@ -0,0 +1,2 @@ +3 4 +2 2 4 diff --git a/codenet/public_test_cases/p02662/input.3.txt b/codenet/public_test_cases/p02662/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e67e50d46739e1e9ffb6a9587cd74f3217a17eaa --- /dev/null +++ b/codenet/public_test_cases/p02662/input.3.txt @@ -0,0 +1,2 @@ +10 10 +3 1 4 1 5 9 2 6 5 3 diff --git a/codenet/public_test_cases/p02662/output.0.txt b/codenet/public_test_cases/p02662/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02662/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02662/output.1.txt b/codenet/public_test_cases/p02662/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02662/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02662/output.2.txt b/codenet/public_test_cases/p02662/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02662/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02662/output.3.txt b/codenet/public_test_cases/p02662/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5fba7f86827c3d37848a6034ace7749fb453140 --- /dev/null +++ b/codenet/public_test_cases/p02662/output.3.txt @@ -0,0 +1 @@ +3296 diff --git a/codenet/public_test_cases/p02663/input.0.txt b/codenet/public_test_cases/p02663/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12827c1cef558443d8eaaae16feb77e7f246b920 --- /dev/null +++ b/codenet/public_test_cases/p02663/input.0.txt @@ -0,0 +1 @@ +10 0 15 0 30 diff --git a/codenet/public_test_cases/p02663/input.1.txt b/codenet/public_test_cases/p02663/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12827c1cef558443d8eaaae16feb77e7f246b920 --- /dev/null +++ b/codenet/public_test_cases/p02663/input.1.txt @@ -0,0 +1 @@ +10 0 15 0 30 diff --git a/codenet/public_test_cases/p02663/input.2.txt b/codenet/public_test_cases/p02663/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..95347f9a0cd0a571a6d2da9e5dc94c345c233cb2 --- /dev/null +++ b/codenet/public_test_cases/p02663/input.2.txt @@ -0,0 +1 @@ +10 0 12 0 120 diff --git a/codenet/public_test_cases/p02663/output.0.txt b/codenet/public_test_cases/p02663/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..67f3f23eca8eac181c5a0e2f8da2a535eba9f5a3 --- /dev/null +++ b/codenet/public_test_cases/p02663/output.0.txt @@ -0,0 +1 @@ +270 diff --git a/codenet/public_test_cases/p02663/output.1.txt b/codenet/public_test_cases/p02663/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67f3f23eca8eac181c5a0e2f8da2a535eba9f5a3 --- /dev/null +++ b/codenet/public_test_cases/p02663/output.1.txt @@ -0,0 +1 @@ +270 diff --git a/codenet/public_test_cases/p02663/output.2.txt b/codenet/public_test_cases/p02663/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02663/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02664/input.0.txt b/codenet/public_test_cases/p02664/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9762693f3e668d3d71ca9abf61ae66b8d43368c9 --- /dev/null +++ b/codenet/public_test_cases/p02664/input.0.txt @@ -0,0 +1 @@ +PD?D??P diff --git a/codenet/public_test_cases/p02664/input.1.txt b/codenet/public_test_cases/p02664/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9762693f3e668d3d71ca9abf61ae66b8d43368c9 --- /dev/null +++ b/codenet/public_test_cases/p02664/input.1.txt @@ -0,0 +1 @@ +PD?D??P diff --git a/codenet/public_test_cases/p02664/input.2.txt b/codenet/public_test_cases/p02664/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..31589adfb9b799f87cd091778a3bc05a08646377 --- /dev/null +++ b/codenet/public_test_cases/p02664/input.2.txt @@ -0,0 +1 @@ +P?P? diff --git a/codenet/public_test_cases/p02664/output.0.txt b/codenet/public_test_cases/p02664/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6687bb7508641056f91547de9933295590f64fdf --- /dev/null +++ b/codenet/public_test_cases/p02664/output.0.txt @@ -0,0 +1 @@ +PDPDPDP diff --git a/codenet/public_test_cases/p02664/output.1.txt b/codenet/public_test_cases/p02664/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6687bb7508641056f91547de9933295590f64fdf --- /dev/null +++ b/codenet/public_test_cases/p02664/output.1.txt @@ -0,0 +1 @@ +PDPDPDP diff --git a/codenet/public_test_cases/p02664/output.2.txt b/codenet/public_test_cases/p02664/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..44ad9a5f3768df7961298c5c25eafe028773d16d --- /dev/null +++ b/codenet/public_test_cases/p02664/output.2.txt @@ -0,0 +1 @@ +PDPD diff --git a/codenet/public_test_cases/p02665/input.0.txt b/codenet/public_test_cases/p02665/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f4dc83d1b081d2982b97ec3efaa592e14fdae6e --- /dev/null +++ b/codenet/public_test_cases/p02665/input.0.txt @@ -0,0 +1,2 @@ +3 +0 1 1 2 diff --git a/codenet/public_test_cases/p02665/input.1.txt b/codenet/public_test_cases/p02665/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..96c1f393362ffd498576d09c4a70099d6c9da02b --- /dev/null +++ b/codenet/public_test_cases/p02665/input.1.txt @@ -0,0 +1,2 @@ +4 +0 0 1 0 2 diff --git a/codenet/public_test_cases/p02665/input.2.txt b/codenet/public_test_cases/p02665/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f4dc83d1b081d2982b97ec3efaa592e14fdae6e --- /dev/null +++ b/codenet/public_test_cases/p02665/input.2.txt @@ -0,0 +1,2 @@ +3 +0 1 1 2 diff --git a/codenet/public_test_cases/p02665/input.3.txt b/codenet/public_test_cases/p02665/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9413e1501225a94d9036518f3b624d7561963540 --- /dev/null +++ b/codenet/public_test_cases/p02665/input.3.txt @@ -0,0 +1,2 @@ +10 +0 0 1 1 2 3 5 8 13 21 34 diff --git a/codenet/public_test_cases/p02665/input.4.txt b/codenet/public_test_cases/p02665/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00fb619a2e9017d71163f7b5987c0f3fc8d4ad85 --- /dev/null +++ b/codenet/public_test_cases/p02665/input.4.txt @@ -0,0 +1,2 @@ +2 +0 3 1 diff --git a/codenet/public_test_cases/p02665/input.5.txt b/codenet/public_test_cases/p02665/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..20478c63e5f63708f9e029bd32f2a98cf73cbd6b --- /dev/null +++ b/codenet/public_test_cases/p02665/input.5.txt @@ -0,0 +1,2 @@ +1 +1 1 diff --git a/codenet/public_test_cases/p02665/output.0.txt b/codenet/public_test_cases/p02665/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02665/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02665/output.1.txt b/codenet/public_test_cases/p02665/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02665/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02665/output.2.txt b/codenet/public_test_cases/p02665/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02665/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02665/output.3.txt b/codenet/public_test_cases/p02665/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..10b0c0dbc88781b180c5100d48bf19c4bbe4c4b4 --- /dev/null +++ b/codenet/public_test_cases/p02665/output.3.txt @@ -0,0 +1 @@ +264 diff --git a/codenet/public_test_cases/p02665/output.4.txt b/codenet/public_test_cases/p02665/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02665/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02665/output.5.txt b/codenet/public_test_cases/p02665/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02665/output.5.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02666/input.0.txt b/codenet/public_test_cases/p02666/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecd6dc3cd48e7f82766747b8883acdb037d2b33e --- /dev/null +++ b/codenet/public_test_cases/p02666/input.0.txt @@ -0,0 +1,2 @@ +4 +2 1 -1 3 diff --git a/codenet/public_test_cases/p02666/input.1.txt b/codenet/public_test_cases/p02666/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecd6dc3cd48e7f82766747b8883acdb037d2b33e --- /dev/null +++ b/codenet/public_test_cases/p02666/input.1.txt @@ -0,0 +1,2 @@ +4 +2 1 -1 3 diff --git a/codenet/public_test_cases/p02666/input.2.txt b/codenet/public_test_cases/p02666/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cd4f58526b6a547080920f1f04b3d3a58b80b1 --- /dev/null +++ b/codenet/public_test_cases/p02666/input.2.txt @@ -0,0 +1,2 @@ +2 +2 1 diff --git a/codenet/public_test_cases/p02666/input.3.txt b/codenet/public_test_cases/p02666/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d4723245789ebcd9b3484ba90f24de4784c5c1a --- /dev/null +++ b/codenet/public_test_cases/p02666/input.3.txt @@ -0,0 +1,2 @@ +10 +2 6 9 -1 6 9 -1 -1 -1 -1 diff --git a/codenet/public_test_cases/p02666/output.0.txt b/codenet/public_test_cases/p02666/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02666/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02666/output.1.txt b/codenet/public_test_cases/p02666/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02666/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02666/output.2.txt b/codenet/public_test_cases/p02666/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02666/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02666/output.3.txt b/codenet/public_test_cases/p02666/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab54db12e3fe1628a93e28fa937a1db1d2e23751 --- /dev/null +++ b/codenet/public_test_cases/p02666/output.3.txt @@ -0,0 +1 @@ +527841 diff --git a/codenet/public_test_cases/p02667/input.0.txt b/codenet/public_test_cases/p02667/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f1e6aa1b1da556eb4bba41c501eaaf8fccf28e8 --- /dev/null +++ b/codenet/public_test_cases/p02667/input.0.txt @@ -0,0 +1 @@ +1101 diff --git a/codenet/public_test_cases/p02667/input.1.txt b/codenet/public_test_cases/p02667/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f1e6aa1b1da556eb4bba41c501eaaf8fccf28e8 --- /dev/null +++ b/codenet/public_test_cases/p02667/input.1.txt @@ -0,0 +1 @@ +1101 diff --git a/codenet/public_test_cases/p02667/input.2.txt b/codenet/public_test_cases/p02667/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e119817d4403fca10b6242592abb8c88de6dd945 --- /dev/null +++ b/codenet/public_test_cases/p02667/input.2.txt @@ -0,0 +1 @@ +0111101101 diff --git a/codenet/public_test_cases/p02667/output.0.txt b/codenet/public_test_cases/p02667/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02667/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02667/output.1.txt b/codenet/public_test_cases/p02667/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02667/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02667/output.2.txt b/codenet/public_test_cases/p02667/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p02667/output.2.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p02668/input.0.txt b/codenet/public_test_cases/p02668/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p02668/input.0.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p02668/input.1.txt b/codenet/public_test_cases/p02668/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c1492f7070afe8253310751e1273c2ea8084305 --- /dev/null +++ b/codenet/public_test_cases/p02668/input.1.txt @@ -0,0 +1 @@ +2020 530 diff --git a/codenet/public_test_cases/p02668/input.2.txt b/codenet/public_test_cases/p02668/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p02668/input.2.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p02668/output.0.txt b/codenet/public_test_cases/p02668/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec9163d78c530c9b0829d46e02a460165df99fd2 --- /dev/null +++ b/codenet/public_test_cases/p02668/output.0.txt @@ -0,0 +1 @@ +352 diff --git a/codenet/public_test_cases/p02668/output.1.txt b/codenet/public_test_cases/p02668/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5c39b5041c335cbc649fd0ef95fc1dfd8c9a60 --- /dev/null +++ b/codenet/public_test_cases/p02668/output.1.txt @@ -0,0 +1 @@ +823277409 diff --git a/codenet/public_test_cases/p02668/output.2.txt b/codenet/public_test_cases/p02668/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec9163d78c530c9b0829d46e02a460165df99fd2 --- /dev/null +++ b/codenet/public_test_cases/p02668/output.2.txt @@ -0,0 +1 @@ +352 diff --git a/codenet/public_test_cases/p02669/input.0.txt b/codenet/public_test_cases/p02669/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f997b43b8bf9ebeb0c93ecb030709dc9a064f86c --- /dev/null +++ b/codenet/public_test_cases/p02669/input.0.txt @@ -0,0 +1,6 @@ +5 +11 1 2 4 8 +11 1 2 2 8 +32 10 8 5 4 +29384293847243 454353412 332423423 934923490 1 +900000000000000000 332423423 454353412 934923490 987654321 diff --git a/codenet/public_test_cases/p02669/input.1.txt b/codenet/public_test_cases/p02669/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f997b43b8bf9ebeb0c93ecb030709dc9a064f86c --- /dev/null +++ b/codenet/public_test_cases/p02669/input.1.txt @@ -0,0 +1,6 @@ +5 +11 1 2 4 8 +11 1 2 2 8 +32 10 8 5 4 +29384293847243 454353412 332423423 934923490 1 +900000000000000000 332423423 454353412 934923490 987654321 diff --git a/codenet/public_test_cases/p02669/output.0.txt b/codenet/public_test_cases/p02669/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d86f79a930b1c2f373ef3bfaa4e9bcf0c6610a0a --- /dev/null +++ b/codenet/public_test_cases/p02669/output.0.txt @@ -0,0 +1,5 @@ +20 +19 +26 +3821859835 +23441258666 diff --git a/codenet/public_test_cases/p02669/output.1.txt b/codenet/public_test_cases/p02669/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d86f79a930b1c2f373ef3bfaa4e9bcf0c6610a0a --- /dev/null +++ b/codenet/public_test_cases/p02669/output.1.txt @@ -0,0 +1,5 @@ +20 +19 +26 +3821859835 +23441258666 diff --git a/codenet/public_test_cases/p02670/input.0.txt b/codenet/public_test_cases/p02670/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fa1dfb3b98054ceb2b157364b5e481a0bc5f155 --- /dev/null +++ b/codenet/public_test_cases/p02670/input.0.txt @@ -0,0 +1,2 @@ +3 +1 3 7 9 5 4 8 6 2 diff --git a/codenet/public_test_cases/p02670/input.1.txt b/codenet/public_test_cases/p02670/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..41af82aabf9fb996c92a9dc8e5598fef3739eb2f --- /dev/null +++ b/codenet/public_test_cases/p02670/input.1.txt @@ -0,0 +1,2 @@ +4 +6 7 1 4 13 16 10 9 5 11 12 14 15 2 3 8 diff --git a/codenet/public_test_cases/p02670/input.2.txt b/codenet/public_test_cases/p02670/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a92657df9314c2770c77b4f9b62b0c771fe161be --- /dev/null +++ b/codenet/public_test_cases/p02670/input.2.txt @@ -0,0 +1,2 @@ +6 +11 21 35 22 7 36 27 34 8 20 15 13 16 1 24 3 2 17 26 9 18 32 31 23 19 14 4 25 10 29 28 33 12 6 5 30 diff --git a/codenet/public_test_cases/p02670/input.3.txt b/codenet/public_test_cases/p02670/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fa1dfb3b98054ceb2b157364b5e481a0bc5f155 --- /dev/null +++ b/codenet/public_test_cases/p02670/input.3.txt @@ -0,0 +1,2 @@ +3 +1 3 7 9 5 4 8 6 2 diff --git a/codenet/public_test_cases/p02670/output.0.txt b/codenet/public_test_cases/p02670/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02670/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02670/output.1.txt b/codenet/public_test_cases/p02670/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02670/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02670/output.2.txt b/codenet/public_test_cases/p02670/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02670/output.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02670/output.3.txt b/codenet/public_test_cases/p02670/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02670/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02671/input.0.txt b/codenet/public_test_cases/p02671/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e96cb6aaa85eaac400bfc9eba4bad71df6b3d27c --- /dev/null +++ b/codenet/public_test_cases/p02671/input.0.txt @@ -0,0 +1,2 @@ +1 +SRS diff --git a/codenet/public_test_cases/p02671/input.1.txt b/codenet/public_test_cases/p02671/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..719da7aef4c104a49c0bcc759c7645992d3265b5 --- /dev/null +++ b/codenet/public_test_cases/p02671/input.1.txt @@ -0,0 +1,2 @@ +3 +SRSRRSRRRSRRRR diff --git a/codenet/public_test_cases/p02671/input.2.txt b/codenet/public_test_cases/p02671/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7a17edfd0e28bbf5eeff0555880b10676310d6c --- /dev/null +++ b/codenet/public_test_cases/p02671/input.2.txt @@ -0,0 +1,2 @@ +2 +RRSRSSSSR diff --git a/codenet/public_test_cases/p02671/input.3.txt b/codenet/public_test_cases/p02671/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e96cb6aaa85eaac400bfc9eba4bad71df6b3d27c --- /dev/null +++ b/codenet/public_test_cases/p02671/input.3.txt @@ -0,0 +1,2 @@ +1 +SRS diff --git a/codenet/public_test_cases/p02671/output.0.txt b/codenet/public_test_cases/p02671/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..73c24018a0866d8a224f58f77b2dc95913c24333 --- /dev/null +++ b/codenet/public_test_cases/p02671/output.0.txt @@ -0,0 +1 @@ +2 0 1 diff --git a/codenet/public_test_cases/p02671/output.1.txt b/codenet/public_test_cases/p02671/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d172f594b1f7a0993967745163ac8ac124462258 --- /dev/null +++ b/codenet/public_test_cases/p02671/output.1.txt @@ -0,0 +1 @@ +23 9 22 8 3 7 20 24 19 5 18 4 17 12 16 2 6 1 14 0 13 26 21 25 11 15 10 diff --git a/codenet/public_test_cases/p02671/output.2.txt b/codenet/public_test_cases/p02671/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..72ad8858358be48b60ec2679a763163cc387d488 --- /dev/null +++ b/codenet/public_test_cases/p02671/output.2.txt @@ -0,0 +1 @@ +3 8 1 0 5 7 6 2 4 diff --git a/codenet/public_test_cases/p02671/output.3.txt b/codenet/public_test_cases/p02671/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..73c24018a0866d8a224f58f77b2dc95913c24333 --- /dev/null +++ b/codenet/public_test_cases/p02671/output.3.txt @@ -0,0 +1 @@ +2 0 1 diff --git a/codenet/public_test_cases/p02673/input.0.txt b/codenet/public_test_cases/p02673/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc42edaf05a9f724be1840255d8583b479142e0 --- /dev/null +++ b/codenet/public_test_cases/p02673/input.0.txt @@ -0,0 +1,3 @@ +5 +4 2 6 3 5 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p02673/input.1.txt b/codenet/public_test_cases/p02673/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..df251e3c93a430bcaae52858a0cbd0a984865ef6 --- /dev/null +++ b/codenet/public_test_cases/p02673/input.1.txt @@ -0,0 +1,3 @@ +10 +470606482521 533212137322 116718867454 746976621474 457112271419 815899162072 641324977314 88281100571 9231169966 455007126951 +26 83 30 59 100 88 84 91 54 61 diff --git a/codenet/public_test_cases/p02673/input.2.txt b/codenet/public_test_cases/p02673/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bee5f16d14c950a78f8db36347f83cf77ae8bb2 --- /dev/null +++ b/codenet/public_test_cases/p02673/input.2.txt @@ -0,0 +1,3 @@ +14 +4839 5400 6231 5800 6001 5200 6350 7133 7986 8012 7537 7013 6477 5912 +34 54 61 32 52 61 21 43 65 12 45 21 1 4 diff --git a/codenet/public_test_cases/p02673/input.3.txt b/codenet/public_test_cases/p02673/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc42edaf05a9f724be1840255d8583b479142e0 --- /dev/null +++ b/codenet/public_test_cases/p02673/input.3.txt @@ -0,0 +1,3 @@ +5 +4 2 6 3 5 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p02673/input.4.txt b/codenet/public_test_cases/p02673/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..32e4be4e1423951469361f031aa2e64f9130f246 --- /dev/null +++ b/codenet/public_test_cases/p02673/input.4.txt @@ -0,0 +1,3 @@ +4 +100 0 100 0 +0 100 0 100 diff --git a/codenet/public_test_cases/p02673/output.0.txt b/codenet/public_test_cases/p02673/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6f8d723e9a8a9b3240af0c1d20ec09c0d27f588 --- /dev/null +++ b/codenet/public_test_cases/p02673/output.0.txt @@ -0,0 +1 @@ +4.700000000000 diff --git a/codenet/public_test_cases/p02673/output.1.txt b/codenet/public_test_cases/p02673/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..80070d87a2b15a2f0fda18194fccd213bbcd9f2c --- /dev/null +++ b/codenet/public_test_cases/p02673/output.1.txt @@ -0,0 +1 @@ +815899161079.400024414062 diff --git a/codenet/public_test_cases/p02673/output.2.txt b/codenet/public_test_cases/p02673/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a17c92380830246d3a246fa0502dd990ac74f5fc --- /dev/null +++ b/codenet/public_test_cases/p02673/output.2.txt @@ -0,0 +1 @@ +7047.142857142857 diff --git a/codenet/public_test_cases/p02673/output.3.txt b/codenet/public_test_cases/p02673/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6f8d723e9a8a9b3240af0c1d20ec09c0d27f588 --- /dev/null +++ b/codenet/public_test_cases/p02673/output.3.txt @@ -0,0 +1 @@ +4.700000000000 diff --git a/codenet/public_test_cases/p02673/output.4.txt b/codenet/public_test_cases/p02673/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4a1229b0e7934be68753bfa0285c4f80ef5aff0 --- /dev/null +++ b/codenet/public_test_cases/p02673/output.4.txt @@ -0,0 +1 @@ +50.000000000000 diff --git a/codenet/public_test_cases/p02674/input.0.txt b/codenet/public_test_cases/p02674/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02674/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02674/input.1.txt b/codenet/public_test_cases/p02674/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..966414b6685a936ff70d8bcaa4def33cfe657e3e --- /dev/null +++ b/codenet/public_test_cases/p02674/input.1.txt @@ -0,0 +1 @@ +123456789123456789 diff --git a/codenet/public_test_cases/p02674/input.2.txt b/codenet/public_test_cases/p02674/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02674/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02674/input.3.txt b/codenet/public_test_cases/p02674/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p02674/input.3.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p02674/input.4.txt b/codenet/public_test_cases/p02674/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02674/input.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02674/input.5.txt b/codenet/public_test_cases/p02674/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02674/input.5.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02674/input.6.txt b/codenet/public_test_cases/p02674/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02674/input.6.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02674/output.0.txt b/codenet/public_test_cases/p02674/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02674/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02674/output.1.txt b/codenet/public_test_cases/p02674/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02674/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02674/output.2.txt b/codenet/public_test_cases/p02674/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02674/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02674/output.3.txt b/codenet/public_test_cases/p02674/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02674/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02674/output.4.txt b/codenet/public_test_cases/p02674/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02674/output.4.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02674/output.5.txt b/codenet/public_test_cases/p02674/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02674/output.5.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02674/output.6.txt b/codenet/public_test_cases/p02674/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02674/output.6.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02675/input.0.txt b/codenet/public_test_cases/p02675/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p02675/input.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p02675/input.1.txt b/codenet/public_test_cases/p02675/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p02675/input.1.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p02675/input.2.txt b/codenet/public_test_cases/p02675/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02675/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02675/input.3.txt b/codenet/public_test_cases/p02675/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..90afb3e998fd880687c5db3cfb3c166313f2483c --- /dev/null +++ b/codenet/public_test_cases/p02675/input.3.txt @@ -0,0 +1 @@ +183 diff --git a/codenet/public_test_cases/p02675/output.0.txt b/codenet/public_test_cases/p02675/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1a7e04442dbca558d90ad615e0f91beb3d1e190 --- /dev/null +++ b/codenet/public_test_cases/p02675/output.0.txt @@ -0,0 +1 @@ +pon diff --git a/codenet/public_test_cases/p02675/output.1.txt b/codenet/public_test_cases/p02675/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1a7e04442dbca558d90ad615e0f91beb3d1e190 --- /dev/null +++ b/codenet/public_test_cases/p02675/output.1.txt @@ -0,0 +1 @@ +pon diff --git a/codenet/public_test_cases/p02675/output.2.txt b/codenet/public_test_cases/p02675/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e2055ed053a75b73ec0412c68791fbe9e9984fa --- /dev/null +++ b/codenet/public_test_cases/p02675/output.2.txt @@ -0,0 +1 @@ +hon diff --git a/codenet/public_test_cases/p02675/output.3.txt b/codenet/public_test_cases/p02675/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4db24d1f4931c5355f8199247a9dbd15648a9516 --- /dev/null +++ b/codenet/public_test_cases/p02675/output.3.txt @@ -0,0 +1 @@ +bon diff --git a/codenet/public_test_cases/p02676/input.0.txt b/codenet/public_test_cases/p02676/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3ccc9620873bdca71e042cfefa2d87b21826a59 --- /dev/null +++ b/codenet/public_test_cases/p02676/input.0.txt @@ -0,0 +1,2 @@ +7 +nikoandsolstice diff --git a/codenet/public_test_cases/p02676/input.1.txt b/codenet/public_test_cases/p02676/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3ccc9620873bdca71e042cfefa2d87b21826a59 --- /dev/null +++ b/codenet/public_test_cases/p02676/input.1.txt @@ -0,0 +1,2 @@ +7 +nikoandsolstice diff --git a/codenet/public_test_cases/p02676/input.2.txt b/codenet/public_test_cases/p02676/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..34dfceecc58c2524e872129885201e24c803eac5 --- /dev/null +++ b/codenet/public_test_cases/p02676/input.2.txt @@ -0,0 +1,2 @@ +40 +ferelibenterhominesidquodvoluntcredunt diff --git a/codenet/public_test_cases/p02676/output.0.txt b/codenet/public_test_cases/p02676/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..72743c769c0ca42b2bf6a30057895d9a5e9b5392 --- /dev/null +++ b/codenet/public_test_cases/p02676/output.0.txt @@ -0,0 +1 @@ +nikoand... diff --git a/codenet/public_test_cases/p02676/output.1.txt b/codenet/public_test_cases/p02676/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..72743c769c0ca42b2bf6a30057895d9a5e9b5392 --- /dev/null +++ b/codenet/public_test_cases/p02676/output.1.txt @@ -0,0 +1 @@ +nikoand... diff --git a/codenet/public_test_cases/p02676/output.2.txt b/codenet/public_test_cases/p02676/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..050cab7d149081fa001809e9f56e152838acb472 --- /dev/null +++ b/codenet/public_test_cases/p02676/output.2.txt @@ -0,0 +1 @@ +ferelibenterhominesidquodvoluntcredunt diff --git a/codenet/public_test_cases/p02677/input.0.txt b/codenet/public_test_cases/p02677/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a035b4e82b510b17bcf9f9fb98173aa2ae30f209 --- /dev/null +++ b/codenet/public_test_cases/p02677/input.0.txt @@ -0,0 +1 @@ +3 4 9 0 diff --git a/codenet/public_test_cases/p02677/input.1.txt b/codenet/public_test_cases/p02677/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a035b4e82b510b17bcf9f9fb98173aa2ae30f209 --- /dev/null +++ b/codenet/public_test_cases/p02677/input.1.txt @@ -0,0 +1 @@ +3 4 9 0 diff --git a/codenet/public_test_cases/p02677/input.2.txt b/codenet/public_test_cases/p02677/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a15cec702ed3eb00c995df3e10fd985955b87a6 --- /dev/null +++ b/codenet/public_test_cases/p02677/input.2.txt @@ -0,0 +1 @@ +3 4 10 40 diff --git a/codenet/public_test_cases/p02677/output.0.txt b/codenet/public_test_cases/p02677/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2531f31c2b7094733591f323d8b6a0d42f52e975 --- /dev/null +++ b/codenet/public_test_cases/p02677/output.0.txt @@ -0,0 +1 @@ +5.00000000000000000000 diff --git a/codenet/public_test_cases/p02677/output.1.txt b/codenet/public_test_cases/p02677/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2531f31c2b7094733591f323d8b6a0d42f52e975 --- /dev/null +++ b/codenet/public_test_cases/p02677/output.1.txt @@ -0,0 +1 @@ +5.00000000000000000000 diff --git a/codenet/public_test_cases/p02677/output.2.txt b/codenet/public_test_cases/p02677/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ff12406b24becde2842cc0f08ca0469a5f2265d --- /dev/null +++ b/codenet/public_test_cases/p02677/output.2.txt @@ -0,0 +1 @@ +4.56425719433005567605 diff --git a/codenet/public_test_cases/p02678/input.0.txt b/codenet/public_test_cases/p02678/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5700e783c27d7925fec5f2034cb9923eae2b649f --- /dev/null +++ b/codenet/public_test_cases/p02678/input.0.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 3 +3 4 +4 2 diff --git a/codenet/public_test_cases/p02678/input.1.txt b/codenet/public_test_cases/p02678/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e31b748ce69927f6ee9817c701f1c017e762a545 --- /dev/null +++ b/codenet/public_test_cases/p02678/input.1.txt @@ -0,0 +1,10 @@ +6 9 +3 4 +6 1 +2 4 +5 3 +4 6 +1 5 +6 2 +4 5 +5 6 diff --git a/codenet/public_test_cases/p02678/input.2.txt b/codenet/public_test_cases/p02678/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5700e783c27d7925fec5f2034cb9923eae2b649f --- /dev/null +++ b/codenet/public_test_cases/p02678/input.2.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 3 +3 4 +4 2 diff --git a/codenet/public_test_cases/p02678/output.0.txt b/codenet/public_test_cases/p02678/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50249c40ced56eca4e702752968b467616a5541f --- /dev/null +++ b/codenet/public_test_cases/p02678/output.0.txt @@ -0,0 +1,4 @@ +Yes +1 +2 +2 diff --git a/codenet/public_test_cases/p02678/output.1.txt b/codenet/public_test_cases/p02678/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9768c815f1f3258858958f750322171e79402ef --- /dev/null +++ b/codenet/public_test_cases/p02678/output.1.txt @@ -0,0 +1,6 @@ +Yes +6 +5 +5 +1 +1 diff --git a/codenet/public_test_cases/p02678/output.2.txt b/codenet/public_test_cases/p02678/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..50249c40ced56eca4e702752968b467616a5541f --- /dev/null +++ b/codenet/public_test_cases/p02678/output.2.txt @@ -0,0 +1,4 @@ +Yes +1 +2 +2 diff --git a/codenet/public_test_cases/p02679/input.0.txt b/codenet/public_test_cases/p02679/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..84a90559df3e3d9b9c08d9ba730a80da97c153c3 --- /dev/null +++ b/codenet/public_test_cases/p02679/input.0.txt @@ -0,0 +1,4 @@ +3 +1 2 +-1 1 +2 -1 diff --git a/codenet/public_test_cases/p02679/input.1.txt b/codenet/public_test_cases/p02679/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..84a90559df3e3d9b9c08d9ba730a80da97c153c3 --- /dev/null +++ b/codenet/public_test_cases/p02679/input.1.txt @@ -0,0 +1,4 @@ +3 +1 2 +-1 1 +2 -1 diff --git a/codenet/public_test_cases/p02679/input.2.txt b/codenet/public_test_cases/p02679/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c80ed6a3b65c334b038dc5e32b5a274ce3ba63ee --- /dev/null +++ b/codenet/public_test_cases/p02679/input.2.txt @@ -0,0 +1,11 @@ +10 +3 2 +3 2 +-1 1 +2 -1 +-3 -9 +-8 12 +7 7 +8 1 +8 2 +8 4 diff --git a/codenet/public_test_cases/p02679/output.0.txt b/codenet/public_test_cases/p02679/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02679/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02679/output.1.txt b/codenet/public_test_cases/p02679/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02679/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02679/output.2.txt b/codenet/public_test_cases/p02679/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf110299d8fe0fa514c8beba874de24711a44bfe --- /dev/null +++ b/codenet/public_test_cases/p02679/output.2.txt @@ -0,0 +1 @@ +479 diff --git a/codenet/public_test_cases/p02680/input.0.txt b/codenet/public_test_cases/p02680/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d94d4ea24ba7a1a1fa70101692b04d3182ca328 --- /dev/null +++ b/codenet/public_test_cases/p02680/input.0.txt @@ -0,0 +1,12 @@ +5 6 +1 2 0 +0 1 1 +0 2 2 +-3 4 -1 +-2 6 3 +1 0 1 +0 1 2 +2 0 2 +-1 -4 5 +3 -2 4 +1 2 4 diff --git a/codenet/public_test_cases/p02680/input.1.txt b/codenet/public_test_cases/p02680/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..26dc74ecb925412afa4b17310679c59b870c5f3c --- /dev/null +++ b/codenet/public_test_cases/p02680/input.1.txt @@ -0,0 +1,8 @@ +6 1 +-3 -1 -2 +-3 -1 1 +-2 -1 2 +1 4 -2 +1 4 -1 +1 4 1 +3 1 4 diff --git a/codenet/public_test_cases/p02680/input.2.txt b/codenet/public_test_cases/p02680/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d94d4ea24ba7a1a1fa70101692b04d3182ca328 --- /dev/null +++ b/codenet/public_test_cases/p02680/input.2.txt @@ -0,0 +1,12 @@ +5 6 +1 2 0 +0 1 1 +0 2 2 +-3 4 -1 +-2 6 3 +1 0 1 +0 1 2 +2 0 2 +-1 -4 5 +3 -2 4 +1 2 4 diff --git a/codenet/public_test_cases/p02680/output.0.txt b/codenet/public_test_cases/p02680/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02680/output.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02680/output.1.txt b/codenet/public_test_cases/p02680/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..771404d0bcf5f089a5a3cac0e2acb23b5f3bda92 --- /dev/null +++ b/codenet/public_test_cases/p02680/output.1.txt @@ -0,0 +1 @@ +INF diff --git a/codenet/public_test_cases/p02680/output.2.txt b/codenet/public_test_cases/p02680/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02680/output.2.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02681/input.0.txt b/codenet/public_test_cases/p02681/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d187e18c84e65cff3b1c886a13c825e747678577 --- /dev/null +++ b/codenet/public_test_cases/p02681/input.0.txt @@ -0,0 +1,2 @@ +chokudai +chokudaiz diff --git a/codenet/public_test_cases/p02681/input.1.txt b/codenet/public_test_cases/p02681/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..848058b698eab13edc4a3e56a00da9a852333fd5 --- /dev/null +++ b/codenet/public_test_cases/p02681/input.1.txt @@ -0,0 +1,2 @@ +snuke +snekee diff --git a/codenet/public_test_cases/p02681/input.2.txt b/codenet/public_test_cases/p02681/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..204dd92b61ad8d300efe79df681287af1074b3eb --- /dev/null +++ b/codenet/public_test_cases/p02681/input.2.txt @@ -0,0 +1,2 @@ +a +aa diff --git a/codenet/public_test_cases/p02681/input.3.txt b/codenet/public_test_cases/p02681/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d187e18c84e65cff3b1c886a13c825e747678577 --- /dev/null +++ b/codenet/public_test_cases/p02681/input.3.txt @@ -0,0 +1,2 @@ +chokudai +chokudaiz diff --git a/codenet/public_test_cases/p02681/output.0.txt b/codenet/public_test_cases/p02681/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02681/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02681/output.1.txt b/codenet/public_test_cases/p02681/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02681/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02681/output.2.txt b/codenet/public_test_cases/p02681/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02681/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02681/output.3.txt b/codenet/public_test_cases/p02681/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02681/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02682/input.0.txt b/codenet/public_test_cases/p02682/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbb6fba7cacfc15382f98729a493a938f9ac0d8b --- /dev/null +++ b/codenet/public_test_cases/p02682/input.0.txt @@ -0,0 +1 @@ +2 1 1 3 diff --git a/codenet/public_test_cases/p02682/input.1.txt b/codenet/public_test_cases/p02682/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a587c46ff65d6c901dcb6eec231d52ffd2735315 --- /dev/null +++ b/codenet/public_test_cases/p02682/input.1.txt @@ -0,0 +1 @@ +2000000000 0 0 2000000000 diff --git a/codenet/public_test_cases/p02682/input.2.txt b/codenet/public_test_cases/p02682/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..93a48451c357d2efc0215caef8334af6b6b8dacf --- /dev/null +++ b/codenet/public_test_cases/p02682/input.2.txt @@ -0,0 +1 @@ +1 2 3 4 diff --git a/codenet/public_test_cases/p02682/input.3.txt b/codenet/public_test_cases/p02682/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbb6fba7cacfc15382f98729a493a938f9ac0d8b --- /dev/null +++ b/codenet/public_test_cases/p02682/input.3.txt @@ -0,0 +1 @@ +2 1 1 3 diff --git a/codenet/public_test_cases/p02682/output.0.txt b/codenet/public_test_cases/p02682/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02682/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02682/output.1.txt b/codenet/public_test_cases/p02682/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..04b2646e30b0383d7bab169b05c1edc80feed7b0 --- /dev/null +++ b/codenet/public_test_cases/p02682/output.1.txt @@ -0,0 +1 @@ +2000000000 diff --git a/codenet/public_test_cases/p02682/output.2.txt b/codenet/public_test_cases/p02682/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02682/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02682/output.3.txt b/codenet/public_test_cases/p02682/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02682/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02683/input.0.txt b/codenet/public_test_cases/p02683/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef0a197bd2e3078723eedee8f0cc42bc6127cf85 --- /dev/null +++ b/codenet/public_test_cases/p02683/input.0.txt @@ -0,0 +1,4 @@ +3 3 10 +60 2 2 4 +70 8 7 9 +50 2 3 9 diff --git a/codenet/public_test_cases/p02683/input.1.txt b/codenet/public_test_cases/p02683/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fb66e95edfe90c13f88a08d33a8cc6aaa8db13c --- /dev/null +++ b/codenet/public_test_cases/p02683/input.1.txt @@ -0,0 +1,4 @@ +3 3 10 +100 3 1 4 +100 1 5 9 +100 2 6 5 diff --git a/codenet/public_test_cases/p02683/input.2.txt b/codenet/public_test_cases/p02683/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef0a197bd2e3078723eedee8f0cc42bc6127cf85 --- /dev/null +++ b/codenet/public_test_cases/p02683/input.2.txt @@ -0,0 +1,4 @@ +3 3 10 +60 2 2 4 +70 8 7 9 +50 2 3 9 diff --git a/codenet/public_test_cases/p02683/input.3.txt b/codenet/public_test_cases/p02683/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a616e7b3701e5b034f16f36c8e62679f1125e0f7 --- /dev/null +++ b/codenet/public_test_cases/p02683/input.3.txt @@ -0,0 +1,9 @@ +8 5 22 +100 3 7 5 3 1 +164 4 5 2 7 8 +334 7 2 7 2 9 +234 4 7 2 8 2 +541 5 4 3 3 6 +235 4 8 6 9 7 +394 3 6 1 6 2 +872 8 4 3 7 2 diff --git a/codenet/public_test_cases/p02683/output.0.txt b/codenet/public_test_cases/p02683/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52bd8e43afb01d0c9747f1fedf2fc94684ee4cc4 --- /dev/null +++ b/codenet/public_test_cases/p02683/output.0.txt @@ -0,0 +1 @@ +120 diff --git a/codenet/public_test_cases/p02683/output.1.txt b/codenet/public_test_cases/p02683/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02683/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02683/output.2.txt b/codenet/public_test_cases/p02683/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..52bd8e43afb01d0c9747f1fedf2fc94684ee4cc4 --- /dev/null +++ b/codenet/public_test_cases/p02683/output.2.txt @@ -0,0 +1 @@ +120 diff --git a/codenet/public_test_cases/p02683/output.3.txt b/codenet/public_test_cases/p02683/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ab2c45b32fd9a79ab9d7c0a8109b9e2df67178c --- /dev/null +++ b/codenet/public_test_cases/p02683/output.3.txt @@ -0,0 +1 @@ +1067 diff --git a/codenet/public_test_cases/p02684/input.0.txt b/codenet/public_test_cases/p02684/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa3a7ae2bd2a227fa3895d210fa97cc04140e624 --- /dev/null +++ b/codenet/public_test_cases/p02684/input.0.txt @@ -0,0 +1,2 @@ +4 5 +3 2 4 1 diff --git a/codenet/public_test_cases/p02684/input.1.txt b/codenet/public_test_cases/p02684/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6671b210b3a2cc7dcd7180178eec157d26415492 --- /dev/null +++ b/codenet/public_test_cases/p02684/input.1.txt @@ -0,0 +1,2 @@ +6 727202214173249351 +6 5 2 5 3 2 diff --git a/codenet/public_test_cases/p02684/input.2.txt b/codenet/public_test_cases/p02684/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa3a7ae2bd2a227fa3895d210fa97cc04140e624 --- /dev/null +++ b/codenet/public_test_cases/p02684/input.2.txt @@ -0,0 +1,2 @@ +4 5 +3 2 4 1 diff --git a/codenet/public_test_cases/p02684/output.0.txt b/codenet/public_test_cases/p02684/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02684/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02684/output.1.txt b/codenet/public_test_cases/p02684/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02684/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02684/output.2.txt b/codenet/public_test_cases/p02684/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02684/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02685/input.0.txt b/codenet/public_test_cases/p02685/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d03090e700f3bac824c9d4299ee554a97e685319 --- /dev/null +++ b/codenet/public_test_cases/p02685/input.0.txt @@ -0,0 +1 @@ +3 2 1 diff --git a/codenet/public_test_cases/p02685/input.1.txt b/codenet/public_test_cases/p02685/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9f12c7f9240ddc0a7d00593777fec86cc90544a --- /dev/null +++ b/codenet/public_test_cases/p02685/input.1.txt @@ -0,0 +1 @@ +100 100 0 diff --git a/codenet/public_test_cases/p02685/input.2.txt b/codenet/public_test_cases/p02685/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d03090e700f3bac824c9d4299ee554a97e685319 --- /dev/null +++ b/codenet/public_test_cases/p02685/input.2.txt @@ -0,0 +1 @@ +3 2 1 diff --git a/codenet/public_test_cases/p02685/input.3.txt b/codenet/public_test_cases/p02685/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ec1c4d276c3d0f9c889faaedb719866f2608878 --- /dev/null +++ b/codenet/public_test_cases/p02685/input.3.txt @@ -0,0 +1 @@ +60522 114575 7559 diff --git a/codenet/public_test_cases/p02685/output.0.txt b/codenet/public_test_cases/p02685/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02685/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02685/output.1.txt b/codenet/public_test_cases/p02685/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9267184d3919b4baa957bf5062400c5f0a5dcf1 --- /dev/null +++ b/codenet/public_test_cases/p02685/output.1.txt @@ -0,0 +1 @@ +73074801 diff --git a/codenet/public_test_cases/p02685/output.2.txt b/codenet/public_test_cases/p02685/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02685/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02685/output.3.txt b/codenet/public_test_cases/p02685/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..751db0bdbc735a25daaaa9a8f181d76b012e3c6d --- /dev/null +++ b/codenet/public_test_cases/p02685/output.3.txt @@ -0,0 +1 @@ +479519525 diff --git a/codenet/public_test_cases/p02686/input.0.txt b/codenet/public_test_cases/p02686/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a3d84944080e213b66dd74883193f93fe0a71d5 --- /dev/null +++ b/codenet/public_test_cases/p02686/input.0.txt @@ -0,0 +1,3 @@ +2 +) +(() diff --git a/codenet/public_test_cases/p02686/input.1.txt b/codenet/public_test_cases/p02686/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8979491d432f30bc2dcbe2d3f816e4d2dddf7656 --- /dev/null +++ b/codenet/public_test_cases/p02686/input.1.txt @@ -0,0 +1,4 @@ +3 +((( +) +) diff --git a/codenet/public_test_cases/p02686/input.2.txt b/codenet/public_test_cases/p02686/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a3d84944080e213b66dd74883193f93fe0a71d5 --- /dev/null +++ b/codenet/public_test_cases/p02686/input.2.txt @@ -0,0 +1,3 @@ +2 +) +(() diff --git a/codenet/public_test_cases/p02686/input.3.txt b/codenet/public_test_cases/p02686/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..47c4278a731dc8a6e3d91d0cab8b78ed809a75bf --- /dev/null +++ b/codenet/public_test_cases/p02686/input.3.txt @@ -0,0 +1,5 @@ +4 +((())) +(((((( +)))))) +()()() diff --git a/codenet/public_test_cases/p02686/input.4.txt b/codenet/public_test_cases/p02686/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..63f5b7778b15a74935e000a864d19cb3bfce009c --- /dev/null +++ b/codenet/public_test_cases/p02686/input.4.txt @@ -0,0 +1,3 @@ +2 +)( +() diff --git a/codenet/public_test_cases/p02686/output.0.txt b/codenet/public_test_cases/p02686/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02686/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02686/output.1.txt b/codenet/public_test_cases/p02686/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02686/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02686/output.2.txt b/codenet/public_test_cases/p02686/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02686/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02686/output.3.txt b/codenet/public_test_cases/p02686/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02686/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02686/output.4.txt b/codenet/public_test_cases/p02686/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02686/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02687/input.0.txt b/codenet/public_test_cases/p02687/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p02687/input.0.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p02687/input.1.txt b/codenet/public_test_cases/p02687/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p02687/input.1.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p02687/output.0.txt b/codenet/public_test_cases/p02687/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c4fba4f9ae03ed0aeddbb3fe0ff90f5684e90bb --- /dev/null +++ b/codenet/public_test_cases/p02687/output.0.txt @@ -0,0 +1 @@ +ARC diff --git a/codenet/public_test_cases/p02687/output.1.txt b/codenet/public_test_cases/p02687/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c4fba4f9ae03ed0aeddbb3fe0ff90f5684e90bb --- /dev/null +++ b/codenet/public_test_cases/p02687/output.1.txt @@ -0,0 +1 @@ +ARC diff --git a/codenet/public_test_cases/p02688/input.0.txt b/codenet/public_test_cases/p02688/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2207cc9f1f3d17c63d3b68ab24e5866b1b13fcd4 --- /dev/null +++ b/codenet/public_test_cases/p02688/input.0.txt @@ -0,0 +1,5 @@ +3 2 +2 +1 3 +1 +3 diff --git a/codenet/public_test_cases/p02688/input.1.txt b/codenet/public_test_cases/p02688/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2207cc9f1f3d17c63d3b68ab24e5866b1b13fcd4 --- /dev/null +++ b/codenet/public_test_cases/p02688/input.1.txt @@ -0,0 +1,5 @@ +3 2 +2 +1 3 +1 +3 diff --git a/codenet/public_test_cases/p02688/input.2.txt b/codenet/public_test_cases/p02688/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..35125fe46ba718d35c0677cacee45db698b64532 --- /dev/null +++ b/codenet/public_test_cases/p02688/input.2.txt @@ -0,0 +1,7 @@ +3 3 +1 +3 +1 +3 +1 +3 diff --git a/codenet/public_test_cases/p02688/output.0.txt b/codenet/public_test_cases/p02688/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02688/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02688/output.1.txt b/codenet/public_test_cases/p02688/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02688/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02688/output.2.txt b/codenet/public_test_cases/p02688/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02688/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02689/input.0.txt b/codenet/public_test_cases/p02689/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9539c55ea4f88806a704877a477335ad46bfdeb --- /dev/null +++ b/codenet/public_test_cases/p02689/input.0.txt @@ -0,0 +1,5 @@ +4 3 +1 2 3 4 +1 3 +2 3 +2 4 diff --git a/codenet/public_test_cases/p02689/input.1.txt b/codenet/public_test_cases/p02689/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..40bab36dd24aac008bf9854d3a3adcb9dfccbf44 --- /dev/null +++ b/codenet/public_test_cases/p02689/input.1.txt @@ -0,0 +1,7 @@ +6 5 +8 6 9 1 2 1 +1 3 +4 2 +4 3 +4 6 +4 6 diff --git a/codenet/public_test_cases/p02689/input.2.txt b/codenet/public_test_cases/p02689/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9539c55ea4f88806a704877a477335ad46bfdeb --- /dev/null +++ b/codenet/public_test_cases/p02689/input.2.txt @@ -0,0 +1,5 @@ +4 3 +1 2 3 4 +1 3 +2 3 +2 4 diff --git a/codenet/public_test_cases/p02689/output.0.txt b/codenet/public_test_cases/p02689/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02689/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02689/output.1.txt b/codenet/public_test_cases/p02689/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02689/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02689/output.2.txt b/codenet/public_test_cases/p02689/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02689/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02690/input.0.txt b/codenet/public_test_cases/p02690/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb95160cb6e07358f54a28a208ae41e69889c97b --- /dev/null +++ b/codenet/public_test_cases/p02690/input.0.txt @@ -0,0 +1 @@ +33 diff --git a/codenet/public_test_cases/p02690/input.1.txt b/codenet/public_test_cases/p02690/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb95160cb6e07358f54a28a208ae41e69889c97b --- /dev/null +++ b/codenet/public_test_cases/p02690/input.1.txt @@ -0,0 +1 @@ +33 diff --git a/codenet/public_test_cases/p02690/input.2.txt b/codenet/public_test_cases/p02690/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02690/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02690/output.0.txt b/codenet/public_test_cases/p02690/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..97940c7da227c77fc90a20b71c0d766cf627d276 --- /dev/null +++ b/codenet/public_test_cases/p02690/output.0.txt @@ -0,0 +1 @@ +2 -1 diff --git a/codenet/public_test_cases/p02690/output.1.txt b/codenet/public_test_cases/p02690/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97940c7da227c77fc90a20b71c0d766cf627d276 --- /dev/null +++ b/codenet/public_test_cases/p02690/output.1.txt @@ -0,0 +1 @@ +2 -1 diff --git a/codenet/public_test_cases/p02690/output.2.txt b/codenet/public_test_cases/p02690/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..93c924c21d3fed94b400b355dd0a3724a8e72e62 --- /dev/null +++ b/codenet/public_test_cases/p02690/output.2.txt @@ -0,0 +1 @@ +0 -1 diff --git a/codenet/public_test_cases/p02691/input.0.txt b/codenet/public_test_cases/p02691/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6608af98aebdddd93f07931d48501efd7f8faa01 --- /dev/null +++ b/codenet/public_test_cases/p02691/input.0.txt @@ -0,0 +1,2 @@ +6 +2 3 3 1 3 1 diff --git a/codenet/public_test_cases/p02691/input.1.txt b/codenet/public_test_cases/p02691/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29e4910366c46fae2c94367114a77e6f26ff010c --- /dev/null +++ b/codenet/public_test_cases/p02691/input.1.txt @@ -0,0 +1,2 @@ +6 +5 2 4 2 8 8 diff --git a/codenet/public_test_cases/p02691/input.2.txt b/codenet/public_test_cases/p02691/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6608af98aebdddd93f07931d48501efd7f8faa01 --- /dev/null +++ b/codenet/public_test_cases/p02691/input.2.txt @@ -0,0 +1,2 @@ +6 +2 3 3 1 3 1 diff --git a/codenet/public_test_cases/p02691/input.3.txt b/codenet/public_test_cases/p02691/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcd001515a1dacc5f4c187e561beb70d3f324afd --- /dev/null +++ b/codenet/public_test_cases/p02691/input.3.txt @@ -0,0 +1,2 @@ +32 +3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 diff --git a/codenet/public_test_cases/p02691/output.0.txt b/codenet/public_test_cases/p02691/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02691/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02691/output.1.txt b/codenet/public_test_cases/p02691/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02691/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02691/output.2.txt b/codenet/public_test_cases/p02691/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02691/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02691/output.3.txt b/codenet/public_test_cases/p02691/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p02691/output.3.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p02692/input.0.txt b/codenet/public_test_cases/p02692/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11fcd44f553a3d0d00248e5f7fda962a7f9919be --- /dev/null +++ b/codenet/public_test_cases/p02692/input.0.txt @@ -0,0 +1,3 @@ +2 1 3 0 +AB +AC diff --git a/codenet/public_test_cases/p02692/input.1.txt b/codenet/public_test_cases/p02692/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11fcd44f553a3d0d00248e5f7fda962a7f9919be --- /dev/null +++ b/codenet/public_test_cases/p02692/input.1.txt @@ -0,0 +1,3 @@ +2 1 3 0 +AB +AC diff --git a/codenet/public_test_cases/p02692/input.2.txt b/codenet/public_test_cases/p02692/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..30ca731e9b0580c1d11a152e6fbeb48f71c32805 --- /dev/null +++ b/codenet/public_test_cases/p02692/input.2.txt @@ -0,0 +1,2 @@ +1 0 9 0 +AC diff --git a/codenet/public_test_cases/p02692/input.3.txt b/codenet/public_test_cases/p02692/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df041887b3f09e69356bf6b878e37c68073a9a9 --- /dev/null +++ b/codenet/public_test_cases/p02692/input.3.txt @@ -0,0 +1,9 @@ +8 6 9 1 +AC +BC +AB +BC +AC +BC +AB +AB diff --git a/codenet/public_test_cases/p02692/input.4.txt b/codenet/public_test_cases/p02692/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e96a801b9ae19f90e7acbbeef1208beb2db5bc76 --- /dev/null +++ b/codenet/public_test_cases/p02692/input.4.txt @@ -0,0 +1,4 @@ +3 1 0 0 +AB +BC +AB diff --git a/codenet/public_test_cases/p02692/output.0.txt b/codenet/public_test_cases/p02692/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b9e7bb14c2471c996e1ca0392687afa835e55b4 --- /dev/null +++ b/codenet/public_test_cases/p02692/output.0.txt @@ -0,0 +1,3 @@ +Yes +A +C diff --git a/codenet/public_test_cases/p02692/output.1.txt b/codenet/public_test_cases/p02692/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b9e7bb14c2471c996e1ca0392687afa835e55b4 --- /dev/null +++ b/codenet/public_test_cases/p02692/output.1.txt @@ -0,0 +1,3 @@ +Yes +A +C diff --git a/codenet/public_test_cases/p02692/output.2.txt b/codenet/public_test_cases/p02692/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02692/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02692/output.3.txt b/codenet/public_test_cases/p02692/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbd32d89d5bc10b9f3225a7df1870c52e87f1408 --- /dev/null +++ b/codenet/public_test_cases/p02692/output.3.txt @@ -0,0 +1,9 @@ +Yes +C +B +B +C +C +B +A +A diff --git a/codenet/public_test_cases/p02692/output.4.txt b/codenet/public_test_cases/p02692/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02692/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02693/input.0.txt b/codenet/public_test_cases/p02693/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc6ce23dccde62c58c285439c23e372966c92ddc --- /dev/null +++ b/codenet/public_test_cases/p02693/input.0.txt @@ -0,0 +1,2 @@ +7 +500 600 diff --git a/codenet/public_test_cases/p02693/input.1.txt b/codenet/public_test_cases/p02693/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64814032b4ffde9efce32e9b3327ca640a7358b5 --- /dev/null +++ b/codenet/public_test_cases/p02693/input.1.txt @@ -0,0 +1,2 @@ +4 +5 7 diff --git a/codenet/public_test_cases/p02693/input.2.txt b/codenet/public_test_cases/p02693/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc6ce23dccde62c58c285439c23e372966c92ddc --- /dev/null +++ b/codenet/public_test_cases/p02693/input.2.txt @@ -0,0 +1,2 @@ +7 +500 600 diff --git a/codenet/public_test_cases/p02693/input.3.txt b/codenet/public_test_cases/p02693/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6472354683058e5f0a3942b39b4d2db9dea5d4f2 --- /dev/null +++ b/codenet/public_test_cases/p02693/input.3.txt @@ -0,0 +1,2 @@ +1 +11 11 diff --git a/codenet/public_test_cases/p02693/output.0.txt b/codenet/public_test_cases/p02693/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d86bac9de59abcc26bc7956c1e842237c7581859 --- /dev/null +++ b/codenet/public_test_cases/p02693/output.0.txt @@ -0,0 +1 @@ +OK diff --git a/codenet/public_test_cases/p02693/output.1.txt b/codenet/public_test_cases/p02693/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4aeef268f14f293e1737e30f12e891dbf6358f0 --- /dev/null +++ b/codenet/public_test_cases/p02693/output.1.txt @@ -0,0 +1 @@ +NG diff --git a/codenet/public_test_cases/p02693/output.2.txt b/codenet/public_test_cases/p02693/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d86bac9de59abcc26bc7956c1e842237c7581859 --- /dev/null +++ b/codenet/public_test_cases/p02693/output.2.txt @@ -0,0 +1 @@ +OK diff --git a/codenet/public_test_cases/p02693/output.3.txt b/codenet/public_test_cases/p02693/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d86bac9de59abcc26bc7956c1e842237c7581859 --- /dev/null +++ b/codenet/public_test_cases/p02693/output.3.txt @@ -0,0 +1 @@ +OK diff --git a/codenet/public_test_cases/p02694/input.0.txt b/codenet/public_test_cases/p02694/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9c8fe82922543b5971697f798999b086470857f --- /dev/null +++ b/codenet/public_test_cases/p02694/input.0.txt @@ -0,0 +1 @@ +103 diff --git a/codenet/public_test_cases/p02694/input.1.txt b/codenet/public_test_cases/p02694/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..392d3e4a329af779dd3f5352f94327d78e578285 --- /dev/null +++ b/codenet/public_test_cases/p02694/input.1.txt @@ -0,0 +1 @@ +1333333333 diff --git a/codenet/public_test_cases/p02694/input.2.txt b/codenet/public_test_cases/p02694/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9c8fe82922543b5971697f798999b086470857f --- /dev/null +++ b/codenet/public_test_cases/p02694/input.2.txt @@ -0,0 +1 @@ +103 diff --git a/codenet/public_test_cases/p02694/input.3.txt b/codenet/public_test_cases/p02694/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a4149f568ebd1c601c9657a0e51a097d0c2703 --- /dev/null +++ b/codenet/public_test_cases/p02694/input.3.txt @@ -0,0 +1 @@ +1000000000000000000 diff --git a/codenet/public_test_cases/p02694/output.0.txt b/codenet/public_test_cases/p02694/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02694/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02694/output.1.txt b/codenet/public_test_cases/p02694/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..859a8b222aac96a4330a50775302c04f48c4c9d4 --- /dev/null +++ b/codenet/public_test_cases/p02694/output.1.txt @@ -0,0 +1 @@ +1706 diff --git a/codenet/public_test_cases/p02694/output.2.txt b/codenet/public_test_cases/p02694/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02694/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02694/output.3.txt b/codenet/public_test_cases/p02694/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..db606a3345d7f70404f45df0da1c98b7935d7770 --- /dev/null +++ b/codenet/public_test_cases/p02694/output.3.txt @@ -0,0 +1 @@ +3760 diff --git a/codenet/public_test_cases/p02695/input.0.txt b/codenet/public_test_cases/p02695/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5503c2069a92824e0217d9cf7d2051a07c1639d2 --- /dev/null +++ b/codenet/public_test_cases/p02695/input.0.txt @@ -0,0 +1,4 @@ +3 4 3 +1 3 3 100 +1 2 2 10 +2 3 2 10 diff --git a/codenet/public_test_cases/p02695/input.1.txt b/codenet/public_test_cases/p02695/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5503c2069a92824e0217d9cf7d2051a07c1639d2 --- /dev/null +++ b/codenet/public_test_cases/p02695/input.1.txt @@ -0,0 +1,4 @@ +3 4 3 +1 3 3 100 +1 2 2 10 +2 3 2 10 diff --git a/codenet/public_test_cases/p02695/input.2.txt b/codenet/public_test_cases/p02695/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cef2fd5cd632111066d4df93f1098405582b319c --- /dev/null +++ b/codenet/public_test_cases/p02695/input.2.txt @@ -0,0 +1,2 @@ +10 10 1 +1 10 9 1 diff --git a/codenet/public_test_cases/p02695/input.3.txt b/codenet/public_test_cases/p02695/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..53f9e5419008bc25bc7f81c72ae2dc69d086a373 --- /dev/null +++ b/codenet/public_test_cases/p02695/input.3.txt @@ -0,0 +1,11 @@ +4 6 10 +2 4 1 86568 +1 4 0 90629 +2 3 0 90310 +3 4 1 29211 +3 4 3 78537 +3 4 2 8580 +1 2 1 96263 +1 4 2 2156 +1 2 0 94325 +1 4 3 94328 diff --git a/codenet/public_test_cases/p02695/output.0.txt b/codenet/public_test_cases/p02695/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p02695/output.0.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p02695/output.1.txt b/codenet/public_test_cases/p02695/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p02695/output.1.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p02695/output.2.txt b/codenet/public_test_cases/p02695/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02695/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02695/output.3.txt b/codenet/public_test_cases/p02695/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..21ddc2a53de3dfab71130ee980c624b69d545cd6 --- /dev/null +++ b/codenet/public_test_cases/p02695/output.3.txt @@ -0,0 +1 @@ +357500 diff --git a/codenet/public_test_cases/p02696/input.0.txt b/codenet/public_test_cases/p02696/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..301b4f5aa0616a19ded51807348ed2a305a5c6ae --- /dev/null +++ b/codenet/public_test_cases/p02696/input.0.txt @@ -0,0 +1 @@ +5 7 4 diff --git a/codenet/public_test_cases/p02696/input.1.txt b/codenet/public_test_cases/p02696/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..301b4f5aa0616a19ded51807348ed2a305a5c6ae --- /dev/null +++ b/codenet/public_test_cases/p02696/input.1.txt @@ -0,0 +1 @@ +5 7 4 diff --git a/codenet/public_test_cases/p02696/input.2.txt b/codenet/public_test_cases/p02696/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1edc740ec6d19e960db70986837f1b0b5a0a4332 --- /dev/null +++ b/codenet/public_test_cases/p02696/input.2.txt @@ -0,0 +1 @@ +11 10 9 diff --git a/codenet/public_test_cases/p02696/output.0.txt b/codenet/public_test_cases/p02696/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02696/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02696/output.1.txt b/codenet/public_test_cases/p02696/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02696/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02696/output.2.txt b/codenet/public_test_cases/p02696/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02696/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02697/input.0.txt b/codenet/public_test_cases/p02697/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b05461b1ba727d91054ac49487ae1ab1ceeb4967 --- /dev/null +++ b/codenet/public_test_cases/p02697/input.0.txt @@ -0,0 +1 @@ +4 1 diff --git a/codenet/public_test_cases/p02697/input.1.txt b/codenet/public_test_cases/p02697/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f036e7ba038ea9020e90a29f669ac3db830dd66 --- /dev/null +++ b/codenet/public_test_cases/p02697/input.1.txt @@ -0,0 +1 @@ +7 3 diff --git a/codenet/public_test_cases/p02697/input.2.txt b/codenet/public_test_cases/p02697/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b05461b1ba727d91054ac49487ae1ab1ceeb4967 --- /dev/null +++ b/codenet/public_test_cases/p02697/input.2.txt @@ -0,0 +1 @@ +4 1 diff --git a/codenet/public_test_cases/p02697/output.0.txt b/codenet/public_test_cases/p02697/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02697/output.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02697/output.1.txt b/codenet/public_test_cases/p02697/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f15ff51bc89b6f160f819101a368d15a25d39ad2 --- /dev/null +++ b/codenet/public_test_cases/p02697/output.1.txt @@ -0,0 +1,3 @@ +1 6 +2 5 +3 4 diff --git a/codenet/public_test_cases/p02697/output.2.txt b/codenet/public_test_cases/p02697/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02697/output.2.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02698/input.0.txt b/codenet/public_test_cases/p02698/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02c579fc51f7c534501f87cbcfb96b9628a64210 --- /dev/null +++ b/codenet/public_test_cases/p02698/input.0.txt @@ -0,0 +1,11 @@ +10 +1 2 5 3 4 6 7 3 2 4 +1 2 +2 3 +3 4 +4 5 +3 6 +6 7 +1 8 +8 9 +9 10 diff --git a/codenet/public_test_cases/p02698/input.1.txt b/codenet/public_test_cases/p02698/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..02c579fc51f7c534501f87cbcfb96b9628a64210 --- /dev/null +++ b/codenet/public_test_cases/p02698/input.1.txt @@ -0,0 +1,11 @@ +10 +1 2 5 3 4 6 7 3 2 4 +1 2 +2 3 +3 4 +4 5 +3 6 +6 7 +1 8 +8 9 +9 10 diff --git a/codenet/public_test_cases/p02698/output.0.txt b/codenet/public_test_cases/p02698/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83ac004e263994bc214e1bd97eaa79709fbfa228 --- /dev/null +++ b/codenet/public_test_cases/p02698/output.0.txt @@ -0,0 +1,10 @@ +1 +2 +3 +3 +4 +4 +5 +2 +2 +3 diff --git a/codenet/public_test_cases/p02698/output.1.txt b/codenet/public_test_cases/p02698/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83ac004e263994bc214e1bd97eaa79709fbfa228 --- /dev/null +++ b/codenet/public_test_cases/p02698/output.1.txt @@ -0,0 +1,10 @@ +1 +2 +3 +3 +4 +4 +5 +2 +2 +3 diff --git a/codenet/public_test_cases/p02699/input.0.txt b/codenet/public_test_cases/p02699/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a99162ed9cdd1b90006cbd4f07e2a2bd3f404d4 --- /dev/null +++ b/codenet/public_test_cases/p02699/input.0.txt @@ -0,0 +1 @@ +4 5 diff --git a/codenet/public_test_cases/p02699/input.1.txt b/codenet/public_test_cases/p02699/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a99162ed9cdd1b90006cbd4f07e2a2bd3f404d4 --- /dev/null +++ b/codenet/public_test_cases/p02699/input.1.txt @@ -0,0 +1 @@ +4 5 diff --git a/codenet/public_test_cases/p02699/input.2.txt b/codenet/public_test_cases/p02699/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b75515d6b08bf96e42ade56e367845a658f09fd --- /dev/null +++ b/codenet/public_test_cases/p02699/input.2.txt @@ -0,0 +1 @@ +100 2 diff --git a/codenet/public_test_cases/p02699/input.3.txt b/codenet/public_test_cases/p02699/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6bc7799eba513be6b20846b727f864fb7acabcd --- /dev/null +++ b/codenet/public_test_cases/p02699/input.3.txt @@ -0,0 +1 @@ +10 10 diff --git a/codenet/public_test_cases/p02699/output.0.txt b/codenet/public_test_cases/p02699/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe927c63b37c92e1411a8306be4315df4111d122 --- /dev/null +++ b/codenet/public_test_cases/p02699/output.0.txt @@ -0,0 +1 @@ +unsafe diff --git a/codenet/public_test_cases/p02699/output.1.txt b/codenet/public_test_cases/p02699/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe927c63b37c92e1411a8306be4315df4111d122 --- /dev/null +++ b/codenet/public_test_cases/p02699/output.1.txt @@ -0,0 +1 @@ +unsafe diff --git a/codenet/public_test_cases/p02699/output.2.txt b/codenet/public_test_cases/p02699/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7767f67d3494c9c8df2deaac7129f48ce33d2f7 --- /dev/null +++ b/codenet/public_test_cases/p02699/output.2.txt @@ -0,0 +1 @@ +safe diff --git a/codenet/public_test_cases/p02699/output.3.txt b/codenet/public_test_cases/p02699/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe927c63b37c92e1411a8306be4315df4111d122 --- /dev/null +++ b/codenet/public_test_cases/p02699/output.3.txt @@ -0,0 +1 @@ +unsafe diff --git a/codenet/public_test_cases/p02700/input.0.txt b/codenet/public_test_cases/p02700/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba9ef0611ac09bee6bd5d3edba63c2c0d066e449 --- /dev/null +++ b/codenet/public_test_cases/p02700/input.0.txt @@ -0,0 +1 @@ +10 9 10 10 diff --git a/codenet/public_test_cases/p02700/input.1.txt b/codenet/public_test_cases/p02700/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..951630f940828e2a592ab59d1643948fc1860896 --- /dev/null +++ b/codenet/public_test_cases/p02700/input.1.txt @@ -0,0 +1 @@ +46 4 40 5 diff --git a/codenet/public_test_cases/p02700/input.2.txt b/codenet/public_test_cases/p02700/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba9ef0611ac09bee6bd5d3edba63c2c0d066e449 --- /dev/null +++ b/codenet/public_test_cases/p02700/input.2.txt @@ -0,0 +1 @@ +10 9 10 10 diff --git a/codenet/public_test_cases/p02700/output.0.txt b/codenet/public_test_cases/p02700/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02700/output.0.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02700/output.1.txt b/codenet/public_test_cases/p02700/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02700/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02700/output.2.txt b/codenet/public_test_cases/p02700/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02700/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02701/input.0.txt b/codenet/public_test_cases/p02701/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0646178a707ce1d780f4f9ddfb483cd4a82ca66 --- /dev/null +++ b/codenet/public_test_cases/p02701/input.0.txt @@ -0,0 +1,4 @@ +3 +apple +orange +apple diff --git a/codenet/public_test_cases/p02701/input.1.txt b/codenet/public_test_cases/p02701/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0d9c3374fc38736406fef5b9477f82bf0b1fe30 --- /dev/null +++ b/codenet/public_test_cases/p02701/input.1.txt @@ -0,0 +1,5 @@ +4 +aaaa +a +aaa +aa diff --git a/codenet/public_test_cases/p02701/input.2.txt b/codenet/public_test_cases/p02701/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0646178a707ce1d780f4f9ddfb483cd4a82ca66 --- /dev/null +++ b/codenet/public_test_cases/p02701/input.2.txt @@ -0,0 +1,4 @@ +3 +apple +orange +apple diff --git a/codenet/public_test_cases/p02701/input.3.txt b/codenet/public_test_cases/p02701/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c45ad2e95558e6ab4dd041e649df14bb6616da9 --- /dev/null +++ b/codenet/public_test_cases/p02701/input.3.txt @@ -0,0 +1,6 @@ +5 +grape +grape +grape +grape +grape diff --git a/codenet/public_test_cases/p02701/output.0.txt b/codenet/public_test_cases/p02701/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02701/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02701/output.1.txt b/codenet/public_test_cases/p02701/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02701/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02701/output.2.txt b/codenet/public_test_cases/p02701/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02701/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02701/output.3.txt b/codenet/public_test_cases/p02701/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02701/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02702/input.0.txt b/codenet/public_test_cases/p02702/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c56104122f0a839277223e11975a9d76ca1e34d --- /dev/null +++ b/codenet/public_test_cases/p02702/input.0.txt @@ -0,0 +1 @@ +1817181712114 diff --git a/codenet/public_test_cases/p02702/input.1.txt b/codenet/public_test_cases/p02702/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c56104122f0a839277223e11975a9d76ca1e34d --- /dev/null +++ b/codenet/public_test_cases/p02702/input.1.txt @@ -0,0 +1 @@ +1817181712114 diff --git a/codenet/public_test_cases/p02702/input.2.txt b/codenet/public_test_cases/p02702/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b9be0d42126bf8ac417ba3b696727f7105bb195 --- /dev/null +++ b/codenet/public_test_cases/p02702/input.2.txt @@ -0,0 +1 @@ +2119 diff --git a/codenet/public_test_cases/p02702/input.3.txt b/codenet/public_test_cases/p02702/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b23a733bb289dc32565f54ba8e83ca4f11363a04 --- /dev/null +++ b/codenet/public_test_cases/p02702/input.3.txt @@ -0,0 +1 @@ +14282668646 diff --git a/codenet/public_test_cases/p02702/output.0.txt b/codenet/public_test_cases/p02702/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02702/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02702/output.1.txt b/codenet/public_test_cases/p02702/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02702/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02702/output.2.txt b/codenet/public_test_cases/p02702/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02702/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02702/output.3.txt b/codenet/public_test_cases/p02702/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02702/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02703/input.0.txt b/codenet/public_test_cases/p02703/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f98aea74ef1c8c191bbbdeab4cd80511e1e6dc47 --- /dev/null +++ b/codenet/public_test_cases/p02703/input.0.txt @@ -0,0 +1,6 @@ +3 2 1 +1 2 1 2 +1 3 2 4 +1 11 +1 2 +2 5 diff --git a/codenet/public_test_cases/p02703/input.1.txt b/codenet/public_test_cases/p02703/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..20590f61e093122420680c0e8e0aeffd444be0e3 --- /dev/null +++ b/codenet/public_test_cases/p02703/input.1.txt @@ -0,0 +1,4 @@ +2 1 0 +1 2 1 1 +1 1000000000 +1 1 diff --git a/codenet/public_test_cases/p02703/input.2.txt b/codenet/public_test_cases/p02703/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f98aea74ef1c8c191bbbdeab4cd80511e1e6dc47 --- /dev/null +++ b/codenet/public_test_cases/p02703/input.2.txt @@ -0,0 +1,6 @@ +3 2 1 +1 2 1 2 +1 3 2 4 +1 11 +1 2 +2 5 diff --git a/codenet/public_test_cases/p02703/input.3.txt b/codenet/public_test_cases/p02703/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc222a550bc612bca2a2e77043bc47b54fcf1017 --- /dev/null +++ b/codenet/public_test_cases/p02703/input.3.txt @@ -0,0 +1,11 @@ +4 6 1000000000 +1 2 50 1 +1 3 50 5 +1 4 50 7 +2 3 50 2 +2 4 50 4 +3 4 50 3 +10 2 +4 4 +5 5 +7 7 diff --git a/codenet/public_test_cases/p02703/input.4.txt b/codenet/public_test_cases/p02703/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e04cccdb52fa7f858fd662282a5569e11bb4c3f3 --- /dev/null +++ b/codenet/public_test_cases/p02703/input.4.txt @@ -0,0 +1,12 @@ +6 5 1 +1 2 1 1 +1 3 2 1 +2 4 5 1 +3 5 11 1 +1 6 50 1 +1 10000 +1 3000 +1 700 +1 100 +1 1 +100 1 diff --git a/codenet/public_test_cases/p02703/input.5.txt b/codenet/public_test_cases/p02703/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..817787c1085b0a2d1b5bd6e65f8b045bbda8fa44 --- /dev/null +++ b/codenet/public_test_cases/p02703/input.5.txt @@ -0,0 +1,9 @@ +4 4 1 +1 2 1 5 +1 3 4 4 +2 4 2 2 +3 4 1 1 +3 1 +3 1 +5 2 +6 4 diff --git a/codenet/public_test_cases/p02703/output.0.txt b/codenet/public_test_cases/p02703/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8d101298ee5e5f81b20f0c41350df1604f56006 --- /dev/null +++ b/codenet/public_test_cases/p02703/output.0.txt @@ -0,0 +1,2 @@ +2 +14 diff --git a/codenet/public_test_cases/p02703/output.1.txt b/codenet/public_test_cases/p02703/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a528ed87320071ba84058bf3cd59e85b5bb7fd7d --- /dev/null +++ b/codenet/public_test_cases/p02703/output.1.txt @@ -0,0 +1 @@ +1000000001 diff --git a/codenet/public_test_cases/p02703/output.2.txt b/codenet/public_test_cases/p02703/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8d101298ee5e5f81b20f0c41350df1604f56006 --- /dev/null +++ b/codenet/public_test_cases/p02703/output.2.txt @@ -0,0 +1,2 @@ +2 +14 diff --git a/codenet/public_test_cases/p02703/output.3.txt b/codenet/public_test_cases/p02703/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..403ec31f0a10be94cad6ab8663f2d508869a06b0 --- /dev/null +++ b/codenet/public_test_cases/p02703/output.3.txt @@ -0,0 +1,3 @@ +1 +3 +5 diff --git a/codenet/public_test_cases/p02703/output.4.txt b/codenet/public_test_cases/p02703/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..171176fcefa313a1e5ecc27647a5a31b50cb1e47 --- /dev/null +++ b/codenet/public_test_cases/p02703/output.4.txt @@ -0,0 +1,5 @@ +1 +9003 +14606 +16510 +16576 diff --git a/codenet/public_test_cases/p02703/output.5.txt b/codenet/public_test_cases/p02703/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccb15eb7f7b343f7b7d584d3a2e5339bc3837c5e --- /dev/null +++ b/codenet/public_test_cases/p02703/output.5.txt @@ -0,0 +1,3 @@ +5 +5 +7 diff --git a/codenet/public_test_cases/p02704/input.0.txt b/codenet/public_test_cases/p02704/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..408911164518ff028c160d2378721bd7e5c38f57 --- /dev/null +++ b/codenet/public_test_cases/p02704/input.0.txt @@ -0,0 +1,5 @@ +2 +0 1 +1 0 +1 1 +1 0 diff --git a/codenet/public_test_cases/p02704/input.1.txt b/codenet/public_test_cases/p02704/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad8a30b8eb134a4ee97285575925797f743cbc66 --- /dev/null +++ b/codenet/public_test_cases/p02704/input.1.txt @@ -0,0 +1,5 @@ +2 +1 1 +1 0 +15 15 +15 11 diff --git a/codenet/public_test_cases/p02704/input.2.txt b/codenet/public_test_cases/p02704/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..408911164518ff028c160d2378721bd7e5c38f57 --- /dev/null +++ b/codenet/public_test_cases/p02704/input.2.txt @@ -0,0 +1,5 @@ +2 +0 1 +1 0 +1 1 +1 0 diff --git a/codenet/public_test_cases/p02704/output.0.txt b/codenet/public_test_cases/p02704/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21358c3b5902b3ef0a1dd212594ef4bcd055e3da --- /dev/null +++ b/codenet/public_test_cases/p02704/output.0.txt @@ -0,0 +1,2 @@ +1 1 +1 0 diff --git a/codenet/public_test_cases/p02704/output.1.txt b/codenet/public_test_cases/p02704/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67073579352819bd6696d91d8711b8175548b103 --- /dev/null +++ b/codenet/public_test_cases/p02704/output.1.txt @@ -0,0 +1,2 @@ +15 11 +15 11 diff --git a/codenet/public_test_cases/p02704/output.2.txt b/codenet/public_test_cases/p02704/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..21358c3b5902b3ef0a1dd212594ef4bcd055e3da --- /dev/null +++ b/codenet/public_test_cases/p02704/output.2.txt @@ -0,0 +1,2 @@ +1 1 +1 0 diff --git a/codenet/public_test_cases/p02705/input.0.txt b/codenet/public_test_cases/p02705/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02705/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02705/input.1.txt b/codenet/public_test_cases/p02705/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d69c74c8b95c8c0574cec707ab1a39d5926b9398 --- /dev/null +++ b/codenet/public_test_cases/p02705/input.1.txt @@ -0,0 +1 @@ +73 diff --git a/codenet/public_test_cases/p02705/input.2.txt b/codenet/public_test_cases/p02705/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02705/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02705/output.0.txt b/codenet/public_test_cases/p02705/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5013ded4cef2354dfeffe1cfc9bd118561c8a2c9 --- /dev/null +++ b/codenet/public_test_cases/p02705/output.0.txt @@ -0,0 +1 @@ +6.28318530717958623200 diff --git a/codenet/public_test_cases/p02705/output.1.txt b/codenet/public_test_cases/p02705/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..631c3fbc16ef15f323b426b86c3e12d215e7256f --- /dev/null +++ b/codenet/public_test_cases/p02705/output.1.txt @@ -0,0 +1 @@ +458.67252742410977361942 diff --git a/codenet/public_test_cases/p02705/output.2.txt b/codenet/public_test_cases/p02705/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5013ded4cef2354dfeffe1cfc9bd118561c8a2c9 --- /dev/null +++ b/codenet/public_test_cases/p02705/output.2.txt @@ -0,0 +1 @@ +6.28318530717958623200 diff --git a/codenet/public_test_cases/p02706/input.0.txt b/codenet/public_test_cases/p02706/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13c113d17f00dbe908caa4581b36119392814b82 --- /dev/null +++ b/codenet/public_test_cases/p02706/input.0.txt @@ -0,0 +1,2 @@ +41 2 +5 6 diff --git a/codenet/public_test_cases/p02706/input.1.txt b/codenet/public_test_cases/p02706/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bf2e5813eea5cefc919755e22d9cee2c4f61389 --- /dev/null +++ b/codenet/public_test_cases/p02706/input.1.txt @@ -0,0 +1,2 @@ +10 2 +5 6 diff --git a/codenet/public_test_cases/p02706/input.2.txt b/codenet/public_test_cases/p02706/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2dc7926dfb7c23a3a61cb2e72913fee4dd65cca --- /dev/null +++ b/codenet/public_test_cases/p02706/input.2.txt @@ -0,0 +1,2 @@ +314 15 +9 26 5 35 8 9 79 3 23 8 46 2 6 43 3 diff --git a/codenet/public_test_cases/p02706/input.3.txt b/codenet/public_test_cases/p02706/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..13c113d17f00dbe908caa4581b36119392814b82 --- /dev/null +++ b/codenet/public_test_cases/p02706/input.3.txt @@ -0,0 +1,2 @@ +41 2 +5 6 diff --git a/codenet/public_test_cases/p02706/input.4.txt b/codenet/public_test_cases/p02706/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bda97bb968c7d4a23ca3fb3af13269724f1984b --- /dev/null +++ b/codenet/public_test_cases/p02706/input.4.txt @@ -0,0 +1,2 @@ +11 2 +5 6 diff --git a/codenet/public_test_cases/p02706/output.0.txt b/codenet/public_test_cases/p02706/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p02706/output.0.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p02706/output.1.txt b/codenet/public_test_cases/p02706/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02706/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02706/output.2.txt b/codenet/public_test_cases/p02706/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02706/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02706/output.3.txt b/codenet/public_test_cases/p02706/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p02706/output.3.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p02706/output.4.txt b/codenet/public_test_cases/p02706/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02706/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02707/input.0.txt b/codenet/public_test_cases/p02707/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2d77d71a89d487bd6327f989a3a703c251f3a5f --- /dev/null +++ b/codenet/public_test_cases/p02707/input.0.txt @@ -0,0 +1,2 @@ +5 +1 1 2 2 diff --git a/codenet/public_test_cases/p02707/input.1.txt b/codenet/public_test_cases/p02707/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cedccba257992dada040290dc09bc6549e4e19a2 --- /dev/null +++ b/codenet/public_test_cases/p02707/input.1.txt @@ -0,0 +1,2 @@ +7 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p02707/input.2.txt b/codenet/public_test_cases/p02707/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2d77d71a89d487bd6327f989a3a703c251f3a5f --- /dev/null +++ b/codenet/public_test_cases/p02707/input.2.txt @@ -0,0 +1,2 @@ +5 +1 1 2 2 diff --git a/codenet/public_test_cases/p02707/input.3.txt b/codenet/public_test_cases/p02707/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..14208dc12d1fc88065f5c521b0b01280c49c55e0 --- /dev/null +++ b/codenet/public_test_cases/p02707/input.3.txt @@ -0,0 +1,2 @@ +10 +1 1 1 1 1 1 1 1 1 diff --git a/codenet/public_test_cases/p02707/output.0.txt b/codenet/public_test_cases/p02707/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8843e8de1f383a8ffc232ad21185c49cf98bf335 --- /dev/null +++ b/codenet/public_test_cases/p02707/output.0.txt @@ -0,0 +1,5 @@ +2 +2 +0 +0 +0 diff --git a/codenet/public_test_cases/p02707/output.1.txt b/codenet/public_test_cases/p02707/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e0c21979dd92fc1ea2cecbff606b64fa01c324a --- /dev/null +++ b/codenet/public_test_cases/p02707/output.1.txt @@ -0,0 +1,7 @@ +1 +1 +1 +1 +1 +1 +0 diff --git a/codenet/public_test_cases/p02707/output.2.txt b/codenet/public_test_cases/p02707/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8843e8de1f383a8ffc232ad21185c49cf98bf335 --- /dev/null +++ b/codenet/public_test_cases/p02707/output.2.txt @@ -0,0 +1,5 @@ +2 +2 +0 +0 +0 diff --git a/codenet/public_test_cases/p02707/output.3.txt b/codenet/public_test_cases/p02707/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..80782f11644dff71f04cc32feac8e433812f24c1 --- /dev/null +++ b/codenet/public_test_cases/p02707/output.3.txt @@ -0,0 +1,10 @@ +9 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/codenet/public_test_cases/p02708/input.0.txt b/codenet/public_test_cases/p02708/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02708/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02708/input.1.txt b/codenet/public_test_cases/p02708/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d64ec278f8225bf014a8e602f9c73dabfab7b146 --- /dev/null +++ b/codenet/public_test_cases/p02708/input.1.txt @@ -0,0 +1 @@ +141421 35623 diff --git a/codenet/public_test_cases/p02708/input.2.txt b/codenet/public_test_cases/p02708/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..740948957bd998d4ccb361589012504e85325f04 --- /dev/null +++ b/codenet/public_test_cases/p02708/input.2.txt @@ -0,0 +1 @@ +200000 200001 diff --git a/codenet/public_test_cases/p02708/input.3.txt b/codenet/public_test_cases/p02708/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02708/input.3.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02708/output.0.txt b/codenet/public_test_cases/p02708/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02708/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02708/output.1.txt b/codenet/public_test_cases/p02708/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab2722a24d0729cac8ef55e4a8a1aa043c3a3792 --- /dev/null +++ b/codenet/public_test_cases/p02708/output.1.txt @@ -0,0 +1 @@ +220280457 diff --git a/codenet/public_test_cases/p02708/output.2.txt b/codenet/public_test_cases/p02708/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02708/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02708/output.3.txt b/codenet/public_test_cases/p02708/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02708/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02709/input.0.txt b/codenet/public_test_cases/p02709/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..41cfb33f03ba4e82214bf2cf1b3efea61294504d --- /dev/null +++ b/codenet/public_test_cases/p02709/input.0.txt @@ -0,0 +1,2 @@ +4 +1 3 4 2 diff --git a/codenet/public_test_cases/p02709/input.1.txt b/codenet/public_test_cases/p02709/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..41cfb33f03ba4e82214bf2cf1b3efea61294504d --- /dev/null +++ b/codenet/public_test_cases/p02709/input.1.txt @@ -0,0 +1,2 @@ +4 +1 3 4 2 diff --git a/codenet/public_test_cases/p02709/input.2.txt b/codenet/public_test_cases/p02709/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d938d473ab41e37e42e85357c9d03efc6d0a84 --- /dev/null +++ b/codenet/public_test_cases/p02709/input.2.txt @@ -0,0 +1,2 @@ +6 +8 6 9 1 2 1 diff --git a/codenet/public_test_cases/p02709/input.3.txt b/codenet/public_test_cases/p02709/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cccfdfbd7b702f859d67fcc44290f81fcbff4ccb --- /dev/null +++ b/codenet/public_test_cases/p02709/input.3.txt @@ -0,0 +1,2 @@ +6 +5 5 6 1 1 1 diff --git a/codenet/public_test_cases/p02709/output.0.txt b/codenet/public_test_cases/p02709/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p02709/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p02709/output.1.txt b/codenet/public_test_cases/p02709/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p02709/output.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p02709/output.2.txt b/codenet/public_test_cases/p02709/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a862eb8444d443dbaf5db59f7e27d956cd7691d5 --- /dev/null +++ b/codenet/public_test_cases/p02709/output.2.txt @@ -0,0 +1 @@ +85 diff --git a/codenet/public_test_cases/p02709/output.3.txt b/codenet/public_test_cases/p02709/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c61d23e125b800e69cb950b09e23c06f728fff9 --- /dev/null +++ b/codenet/public_test_cases/p02709/output.3.txt @@ -0,0 +1 @@ +58 diff --git a/codenet/public_test_cases/p02710/input.0.txt b/codenet/public_test_cases/p02710/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38205e0b9319c256d50c6d19be05f078624e51bf --- /dev/null +++ b/codenet/public_test_cases/p02710/input.0.txt @@ -0,0 +1,4 @@ +3 +1 2 1 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02710/input.1.txt b/codenet/public_test_cases/p02710/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38205e0b9319c256d50c6d19be05f078624e51bf --- /dev/null +++ b/codenet/public_test_cases/p02710/input.1.txt @@ -0,0 +1,4 @@ +3 +1 2 1 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02710/input.2.txt b/codenet/public_test_cases/p02710/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p02710/input.2.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p02710/input.3.txt b/codenet/public_test_cases/p02710/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0777210f96902d28ec11fae15aa7191bdb1c2778 --- /dev/null +++ b/codenet/public_test_cases/p02710/input.3.txt @@ -0,0 +1,3 @@ +2 +1 2 +1 2 diff --git a/codenet/public_test_cases/p02710/input.4.txt b/codenet/public_test_cases/p02710/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec29fa3d7b607c9fbb58e82162121d05dcbc872b --- /dev/null +++ b/codenet/public_test_cases/p02710/input.4.txt @@ -0,0 +1,9 @@ +8 +2 7 2 5 4 1 7 5 +3 1 +1 2 +2 7 +4 5 +5 6 +6 8 +7 8 diff --git a/codenet/public_test_cases/p02710/input.5.txt b/codenet/public_test_cases/p02710/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c3b2d0c33293985fd0c5392d73ecc5cf0c7a28f --- /dev/null +++ b/codenet/public_test_cases/p02710/input.5.txt @@ -0,0 +1,6 @@ +5 +1 2 3 4 5 +1 2 +2 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p02710/output.0.txt b/codenet/public_test_cases/p02710/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..47babbe9dd490dba384dcdd13275fd4e5104cbf8 --- /dev/null +++ b/codenet/public_test_cases/p02710/output.0.txt @@ -0,0 +1,3 @@ +5 +4 +0 diff --git a/codenet/public_test_cases/p02710/output.1.txt b/codenet/public_test_cases/p02710/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..47babbe9dd490dba384dcdd13275fd4e5104cbf8 --- /dev/null +++ b/codenet/public_test_cases/p02710/output.1.txt @@ -0,0 +1,3 @@ +5 +4 +0 diff --git a/codenet/public_test_cases/p02710/output.2.txt b/codenet/public_test_cases/p02710/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02710/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02710/output.3.txt b/codenet/public_test_cases/p02710/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..51993f072d5832f20b98b6bd0cf763fb8b4c8a1b --- /dev/null +++ b/codenet/public_test_cases/p02710/output.3.txt @@ -0,0 +1,2 @@ +2 +2 diff --git a/codenet/public_test_cases/p02710/output.4.txt b/codenet/public_test_cases/p02710/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebeac4b56492d190f90ac6831b6cd94cfb1e1ddd --- /dev/null +++ b/codenet/public_test_cases/p02710/output.4.txt @@ -0,0 +1,8 @@ +18 +15 +0 +14 +23 +0 +23 +0 diff --git a/codenet/public_test_cases/p02710/output.5.txt b/codenet/public_test_cases/p02710/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bd188acbd45951e548e93eea4229ffc8bff3660 --- /dev/null +++ b/codenet/public_test_cases/p02710/output.5.txt @@ -0,0 +1,5 @@ +5 +8 +10 +5 +5 diff --git a/codenet/public_test_cases/p02711/input.0.txt b/codenet/public_test_cases/p02711/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bc6609e3d8512746dffd4a783cc4b428dfe5dc7 --- /dev/null +++ b/codenet/public_test_cases/p02711/input.0.txt @@ -0,0 +1 @@ +117 diff --git a/codenet/public_test_cases/p02711/input.1.txt b/codenet/public_test_cases/p02711/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e68a0f7e9e1d2da6cdabd3d1588fc2eaa0c9e64 --- /dev/null +++ b/codenet/public_test_cases/p02711/input.1.txt @@ -0,0 +1 @@ +777 diff --git a/codenet/public_test_cases/p02711/input.2.txt b/codenet/public_test_cases/p02711/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..190a18037c64c43e6b11489df4bf0b9eb6d2c9bf --- /dev/null +++ b/codenet/public_test_cases/p02711/input.2.txt @@ -0,0 +1 @@ +123 diff --git a/codenet/public_test_cases/p02711/input.3.txt b/codenet/public_test_cases/p02711/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bc6609e3d8512746dffd4a783cc4b428dfe5dc7 --- /dev/null +++ b/codenet/public_test_cases/p02711/input.3.txt @@ -0,0 +1 @@ +117 diff --git a/codenet/public_test_cases/p02711/output.0.txt b/codenet/public_test_cases/p02711/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02711/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02711/output.1.txt b/codenet/public_test_cases/p02711/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02711/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02711/output.2.txt b/codenet/public_test_cases/p02711/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02711/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02711/output.3.txt b/codenet/public_test_cases/p02711/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02711/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02712/input.0.txt b/codenet/public_test_cases/p02712/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p02712/input.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p02712/input.1.txt b/codenet/public_test_cases/p02712/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..749fce669df1b51cae4a71dc130b2a14807829f0 --- /dev/null +++ b/codenet/public_test_cases/p02712/input.1.txt @@ -0,0 +1 @@ +1000000 diff --git a/codenet/public_test_cases/p02712/input.2.txt b/codenet/public_test_cases/p02712/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p02712/input.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p02712/output.0.txt b/codenet/public_test_cases/p02712/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p02712/output.0.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p02712/output.1.txt b/codenet/public_test_cases/p02712/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14dcec26962ca78793041d88479ff7d6c180e98a --- /dev/null +++ b/codenet/public_test_cases/p02712/output.1.txt @@ -0,0 +1 @@ +266666333332 diff --git a/codenet/public_test_cases/p02712/output.2.txt b/codenet/public_test_cases/p02712/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p02712/output.2.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p02713/input.0.txt b/codenet/public_test_cases/p02713/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02713/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02713/input.1.txt b/codenet/public_test_cases/p02713/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02713/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02713/output.0.txt b/codenet/public_test_cases/p02713/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02713/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02713/output.1.txt b/codenet/public_test_cases/p02713/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02713/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02714/input.0.txt b/codenet/public_test_cases/p02714/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..270abac3bf08b94303de01cb094b168d03ed2578 --- /dev/null +++ b/codenet/public_test_cases/p02714/input.0.txt @@ -0,0 +1,2 @@ +4 +RRGB diff --git a/codenet/public_test_cases/p02714/input.1.txt b/codenet/public_test_cases/p02714/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..270abac3bf08b94303de01cb094b168d03ed2578 --- /dev/null +++ b/codenet/public_test_cases/p02714/input.1.txt @@ -0,0 +1,2 @@ +4 +RRGB diff --git a/codenet/public_test_cases/p02714/input.2.txt b/codenet/public_test_cases/p02714/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d534a4514dbd98832729b3d482c8a6d1493ebf2 --- /dev/null +++ b/codenet/public_test_cases/p02714/input.2.txt @@ -0,0 +1,2 @@ +39 +RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB diff --git a/codenet/public_test_cases/p02714/output.0.txt b/codenet/public_test_cases/p02714/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02714/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02714/output.1.txt b/codenet/public_test_cases/p02714/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02714/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02714/output.2.txt b/codenet/public_test_cases/p02714/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb08106db05e908c6bca41665d2f6d746dd9f9ac --- /dev/null +++ b/codenet/public_test_cases/p02714/output.2.txt @@ -0,0 +1 @@ +1800 diff --git a/codenet/public_test_cases/p02715/input.0.txt b/codenet/public_test_cases/p02715/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02715/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02715/input.1.txt b/codenet/public_test_cases/p02715/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bfd8643e47256f0fce54761d9cc9e58d209aebc --- /dev/null +++ b/codenet/public_test_cases/p02715/input.1.txt @@ -0,0 +1 @@ +100000 100000 diff --git a/codenet/public_test_cases/p02715/input.2.txt b/codenet/public_test_cases/p02715/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dce934f4bef7018feb40fe2b47ab30b892c68bd --- /dev/null +++ b/codenet/public_test_cases/p02715/input.2.txt @@ -0,0 +1 @@ +3 200 diff --git a/codenet/public_test_cases/p02715/input.3.txt b/codenet/public_test_cases/p02715/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02715/input.3.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02715/output.0.txt b/codenet/public_test_cases/p02715/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02715/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02715/output.1.txt b/codenet/public_test_cases/p02715/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..230e8c87473f57143c663168f3f9f7529cc962c3 --- /dev/null +++ b/codenet/public_test_cases/p02715/output.1.txt @@ -0,0 +1 @@ +742202979 diff --git a/codenet/public_test_cases/p02715/output.2.txt b/codenet/public_test_cases/p02715/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d139de5afc262a27016e7c73933536d21ceb5ae --- /dev/null +++ b/codenet/public_test_cases/p02715/output.2.txt @@ -0,0 +1 @@ +10813692 diff --git a/codenet/public_test_cases/p02715/output.3.txt b/codenet/public_test_cases/p02715/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02715/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02716/input.0.txt b/codenet/public_test_cases/p02716/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee886e113fb8e0c61426795b71508f0130a4438 --- /dev/null +++ b/codenet/public_test_cases/p02716/input.0.txt @@ -0,0 +1,2 @@ +6 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p02716/input.1.txt b/codenet/public_test_cases/p02716/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7586711588d1edb799f945a09a746ab4e417e3d5 --- /dev/null +++ b/codenet/public_test_cases/p02716/input.1.txt @@ -0,0 +1,2 @@ +27 +18 -28 18 28 -45 90 -45 23 -53 60 28 -74 -71 35 -26 -62 49 -77 57 24 -70 -93 69 -99 59 57 -49 diff --git a/codenet/public_test_cases/p02716/input.2.txt b/codenet/public_test_cases/p02716/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fb75b5b65973151d24eb6a8a374d533994aa6cd --- /dev/null +++ b/codenet/public_test_cases/p02716/input.2.txt @@ -0,0 +1,2 @@ +5 +-1000 -100 -10 0 10 diff --git a/codenet/public_test_cases/p02716/input.3.txt b/codenet/public_test_cases/p02716/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee886e113fb8e0c61426795b71508f0130a4438 --- /dev/null +++ b/codenet/public_test_cases/p02716/input.3.txt @@ -0,0 +1,2 @@ +6 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p02716/input.4.txt b/codenet/public_test_cases/p02716/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b9b223e4bc3e9ecde8f9236e40fc7b5da20391d --- /dev/null +++ b/codenet/public_test_cases/p02716/input.4.txt @@ -0,0 +1,2 @@ +10 +1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 diff --git a/codenet/public_test_cases/p02716/output.0.txt b/codenet/public_test_cases/p02716/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02716/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02716/output.1.txt b/codenet/public_test_cases/p02716/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..594cd09d3241efdb8f995d576e41fab5509e731e --- /dev/null +++ b/codenet/public_test_cases/p02716/output.1.txt @@ -0,0 +1 @@ +295 diff --git a/codenet/public_test_cases/p02716/output.2.txt b/codenet/public_test_cases/p02716/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02716/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02716/output.3.txt b/codenet/public_test_cases/p02716/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02716/output.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02716/output.4.txt b/codenet/public_test_cases/p02716/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d007f6b285ebc6d303e5e7e879d03901ba847a5e --- /dev/null +++ b/codenet/public_test_cases/p02716/output.4.txt @@ -0,0 +1 @@ +5000000000 diff --git a/codenet/public_test_cases/p02717/input.0.txt b/codenet/public_test_cases/p02717/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b85905ec0b994f1e5797d58ffefed89ff54d6b51 --- /dev/null +++ b/codenet/public_test_cases/p02717/input.0.txt @@ -0,0 +1 @@ +1 2 3 diff --git a/codenet/public_test_cases/p02717/input.1.txt b/codenet/public_test_cases/p02717/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa64af6e1d1f16e45cad3c4a007d1dfb602bbef5 --- /dev/null +++ b/codenet/public_test_cases/p02717/input.1.txt @@ -0,0 +1 @@ +100 100 100 diff --git a/codenet/public_test_cases/p02717/input.2.txt b/codenet/public_test_cases/p02717/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..163a122a6a18bfe7886ae7259e9ab02b802ce634 --- /dev/null +++ b/codenet/public_test_cases/p02717/input.2.txt @@ -0,0 +1 @@ +41 59 31 diff --git a/codenet/public_test_cases/p02717/input.3.txt b/codenet/public_test_cases/p02717/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b85905ec0b994f1e5797d58ffefed89ff54d6b51 --- /dev/null +++ b/codenet/public_test_cases/p02717/input.3.txt @@ -0,0 +1 @@ +1 2 3 diff --git a/codenet/public_test_cases/p02717/output.0.txt b/codenet/public_test_cases/p02717/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4c3b6fa8ddc94fc44ce15c6da3720c1f07040ba --- /dev/null +++ b/codenet/public_test_cases/p02717/output.0.txt @@ -0,0 +1 @@ +3 1 2 diff --git a/codenet/public_test_cases/p02717/output.1.txt b/codenet/public_test_cases/p02717/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa64af6e1d1f16e45cad3c4a007d1dfb602bbef5 --- /dev/null +++ b/codenet/public_test_cases/p02717/output.1.txt @@ -0,0 +1 @@ +100 100 100 diff --git a/codenet/public_test_cases/p02717/output.2.txt b/codenet/public_test_cases/p02717/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99d753b224734934253a7865c50157bb9087520c --- /dev/null +++ b/codenet/public_test_cases/p02717/output.2.txt @@ -0,0 +1 @@ +31 41 59 diff --git a/codenet/public_test_cases/p02717/output.3.txt b/codenet/public_test_cases/p02717/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4c3b6fa8ddc94fc44ce15c6da3720c1f07040ba --- /dev/null +++ b/codenet/public_test_cases/p02717/output.3.txt @@ -0,0 +1 @@ +3 1 2 diff --git a/codenet/public_test_cases/p02718/input.0.txt b/codenet/public_test_cases/p02718/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac7a6107ad164a84880cddb21549ae1d74d872d --- /dev/null +++ b/codenet/public_test_cases/p02718/input.0.txt @@ -0,0 +1,2 @@ +4 1 +5 4 2 1 diff --git a/codenet/public_test_cases/p02718/input.1.txt b/codenet/public_test_cases/p02718/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac7a6107ad164a84880cddb21549ae1d74d872d --- /dev/null +++ b/codenet/public_test_cases/p02718/input.1.txt @@ -0,0 +1,2 @@ +4 1 +5 4 2 1 diff --git a/codenet/public_test_cases/p02718/input.2.txt b/codenet/public_test_cases/p02718/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c01ae9a5f02dadc68276610fe0364b1b0dd25d7a --- /dev/null +++ b/codenet/public_test_cases/p02718/input.2.txt @@ -0,0 +1,2 @@ +12 3 +4 56 78 901 2 345 67 890 123 45 6 789 diff --git a/codenet/public_test_cases/p02718/input.3.txt b/codenet/public_test_cases/p02718/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7380fc09572bd4a6a7a6ddd1ea056d4fe0aed47 --- /dev/null +++ b/codenet/public_test_cases/p02718/input.3.txt @@ -0,0 +1,2 @@ +3 2 +380 19 1 diff --git a/codenet/public_test_cases/p02718/output.0.txt b/codenet/public_test_cases/p02718/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02718/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02718/output.1.txt b/codenet/public_test_cases/p02718/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02718/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02718/output.2.txt b/codenet/public_test_cases/p02718/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02718/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02718/output.3.txt b/codenet/public_test_cases/p02718/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02718/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02719/input.0.txt b/codenet/public_test_cases/p02719/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..883251633a21a0f0722f7aa96da5ae023fa2df5c --- /dev/null +++ b/codenet/public_test_cases/p02719/input.0.txt @@ -0,0 +1 @@ +7 4 diff --git a/codenet/public_test_cases/p02719/input.1.txt b/codenet/public_test_cases/p02719/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8ce17f2b3429d37a649b01d0d9a322e3d42a325 --- /dev/null +++ b/codenet/public_test_cases/p02719/input.1.txt @@ -0,0 +1 @@ +1000000000000000000 1 diff --git a/codenet/public_test_cases/p02719/input.2.txt b/codenet/public_test_cases/p02719/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..883251633a21a0f0722f7aa96da5ae023fa2df5c --- /dev/null +++ b/codenet/public_test_cases/p02719/input.2.txt @@ -0,0 +1 @@ +7 4 diff --git a/codenet/public_test_cases/p02719/input.3.txt b/codenet/public_test_cases/p02719/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d69ecad4f4c9b19aa64952e3ea2a201bc20cbc2c --- /dev/null +++ b/codenet/public_test_cases/p02719/input.3.txt @@ -0,0 +1 @@ +2 6 diff --git a/codenet/public_test_cases/p02719/output.0.txt b/codenet/public_test_cases/p02719/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02719/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02719/output.1.txt b/codenet/public_test_cases/p02719/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02719/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02719/output.2.txt b/codenet/public_test_cases/p02719/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02719/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02719/output.3.txt b/codenet/public_test_cases/p02719/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02719/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02720/input.0.txt b/codenet/public_test_cases/p02720/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p02720/input.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p02720/input.1.txt b/codenet/public_test_cases/p02720/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02720/input.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02720/input.2.txt b/codenet/public_test_cases/p02720/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02720/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02720/input.3.txt b/codenet/public_test_cases/p02720/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p02720/input.3.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p02720/input.4.txt b/codenet/public_test_cases/p02720/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7393e847d34d19031ee0ba57df63e4d0ccb4fb2 --- /dev/null +++ b/codenet/public_test_cases/p02720/input.4.txt @@ -0,0 +1 @@ +100000 diff --git a/codenet/public_test_cases/p02720/output.0.txt b/codenet/public_test_cases/p02720/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p02720/output.0.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p02720/output.1.txt b/codenet/public_test_cases/p02720/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p02720/output.1.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p02720/output.2.txt b/codenet/public_test_cases/p02720/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02720/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02720/output.3.txt b/codenet/public_test_cases/p02720/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p02720/output.3.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p02720/output.4.txt b/codenet/public_test_cases/p02720/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7c83bd0c665654d7bc839cd1c719d7e848e66bf --- /dev/null +++ b/codenet/public_test_cases/p02720/output.4.txt @@ -0,0 +1 @@ +3234566667 diff --git a/codenet/public_test_cases/p02721/input.0.txt b/codenet/public_test_cases/p02721/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eda0191577aec924963625287c24835f34e73d93 --- /dev/null +++ b/codenet/public_test_cases/p02721/input.0.txt @@ -0,0 +1,2 @@ +11 3 2 +ooxxxoxxxoo diff --git a/codenet/public_test_cases/p02721/input.1.txt b/codenet/public_test_cases/p02721/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c98a7ecb62f1cb84db4f7e967ac4131ab0db337c --- /dev/null +++ b/codenet/public_test_cases/p02721/input.1.txt @@ -0,0 +1,2 @@ +5 2 3 +ooxoo diff --git a/codenet/public_test_cases/p02721/input.2.txt b/codenet/public_test_cases/p02721/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eda0191577aec924963625287c24835f34e73d93 --- /dev/null +++ b/codenet/public_test_cases/p02721/input.2.txt @@ -0,0 +1,2 @@ +11 3 2 +ooxxxoxxxoo diff --git a/codenet/public_test_cases/p02721/input.3.txt b/codenet/public_test_cases/p02721/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e47b3345967643fbed4f35f4d6764c066c86cdff --- /dev/null +++ b/codenet/public_test_cases/p02721/input.3.txt @@ -0,0 +1,2 @@ +16 4 3 +ooxxoxoxxxoxoxxo diff --git a/codenet/public_test_cases/p02721/output.0.txt b/codenet/public_test_cases/p02721/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02721/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02721/output.1.txt b/codenet/public_test_cases/p02721/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..26b37d07facfc371afa61dac1dc310e2d7c02597 --- /dev/null +++ b/codenet/public_test_cases/p02721/output.1.txt @@ -0,0 +1,2 @@ +1 +5 diff --git a/codenet/public_test_cases/p02721/output.2.txt b/codenet/public_test_cases/p02721/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02721/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02721/output.3.txt b/codenet/public_test_cases/p02721/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..03c19c33865a3d7ece312a77dedd42907f723a8f --- /dev/null +++ b/codenet/public_test_cases/p02721/output.3.txt @@ -0,0 +1,2 @@ +11 +16 diff --git a/codenet/public_test_cases/p02722/input.0.txt b/codenet/public_test_cases/p02722/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02722/input.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02722/input.1.txt b/codenet/public_test_cases/p02722/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca9937c8f968abe951cf89991f552805222aa1ee --- /dev/null +++ b/codenet/public_test_cases/p02722/input.1.txt @@ -0,0 +1 @@ +314159265358 diff --git a/codenet/public_test_cases/p02722/input.2.txt b/codenet/public_test_cases/p02722/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02722/input.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02722/input.3.txt b/codenet/public_test_cases/p02722/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d7bf7aa2ecb852b8e1d7e2b8b57cacdf4aaf867 --- /dev/null +++ b/codenet/public_test_cases/p02722/input.3.txt @@ -0,0 +1 @@ +3141 diff --git a/codenet/public_test_cases/p02722/output.0.txt b/codenet/public_test_cases/p02722/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02722/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02722/output.1.txt b/codenet/public_test_cases/p02722/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02722/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02722/output.2.txt b/codenet/public_test_cases/p02722/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02722/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02722/output.3.txt b/codenet/public_test_cases/p02722/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02722/output.3.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02723/input.0.txt b/codenet/public_test_cases/p02723/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed680939d115aad037d5d83379982d9e60e38ed --- /dev/null +++ b/codenet/public_test_cases/p02723/input.0.txt @@ -0,0 +1 @@ +sippuu diff --git a/codenet/public_test_cases/p02723/input.1.txt b/codenet/public_test_cases/p02723/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32e1a738d6860b81d732b8f652f2bc2426da2e5b --- /dev/null +++ b/codenet/public_test_cases/p02723/input.1.txt @@ -0,0 +1 @@ +coffee diff --git a/codenet/public_test_cases/p02723/input.2.txt b/codenet/public_test_cases/p02723/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed680939d115aad037d5d83379982d9e60e38ed --- /dev/null +++ b/codenet/public_test_cases/p02723/input.2.txt @@ -0,0 +1 @@ +sippuu diff --git a/codenet/public_test_cases/p02723/input.3.txt b/codenet/public_test_cases/p02723/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..11961dbf54250277297bb5833b8d37b12eea0cf3 --- /dev/null +++ b/codenet/public_test_cases/p02723/input.3.txt @@ -0,0 +1 @@ +iphone diff --git a/codenet/public_test_cases/p02723/output.0.txt b/codenet/public_test_cases/p02723/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02723/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02723/output.1.txt b/codenet/public_test_cases/p02723/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02723/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02723/output.2.txt b/codenet/public_test_cases/p02723/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02723/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02723/output.3.txt b/codenet/public_test_cases/p02723/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02723/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02724/input.0.txt b/codenet/public_test_cases/p02724/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7b1c440c0f3f8d42eff097800b88ac5d40263d3 --- /dev/null +++ b/codenet/public_test_cases/p02724/input.0.txt @@ -0,0 +1 @@ +1024 diff --git a/codenet/public_test_cases/p02724/input.1.txt b/codenet/public_test_cases/p02724/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02724/input.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02724/input.2.txt b/codenet/public_test_cases/p02724/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..770fdcfb4b7d03520f649b7f7ca20e2546bdb41f --- /dev/null +++ b/codenet/public_test_cases/p02724/input.2.txt @@ -0,0 +1 @@ +1000000000 diff --git a/codenet/public_test_cases/p02724/input.3.txt b/codenet/public_test_cases/p02724/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7b1c440c0f3f8d42eff097800b88ac5d40263d3 --- /dev/null +++ b/codenet/public_test_cases/p02724/input.3.txt @@ -0,0 +1 @@ +1024 diff --git a/codenet/public_test_cases/p02724/output.0.txt b/codenet/public_test_cases/p02724/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0fbadda96193e45ce6b910f2d13837323894356 --- /dev/null +++ b/codenet/public_test_cases/p02724/output.0.txt @@ -0,0 +1 @@ +2020 diff --git a/codenet/public_test_cases/p02724/output.1.txt b/codenet/public_test_cases/p02724/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02724/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02724/output.2.txt b/codenet/public_test_cases/p02724/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..04b2646e30b0383d7bab169b05c1edc80feed7b0 --- /dev/null +++ b/codenet/public_test_cases/p02724/output.2.txt @@ -0,0 +1 @@ +2000000000 diff --git a/codenet/public_test_cases/p02724/output.3.txt b/codenet/public_test_cases/p02724/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0fbadda96193e45ce6b910f2d13837323894356 --- /dev/null +++ b/codenet/public_test_cases/p02724/output.3.txt @@ -0,0 +1 @@ +2020 diff --git a/codenet/public_test_cases/p02725/input.0.txt b/codenet/public_test_cases/p02725/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fc4538411d7c953f4a0c9dbc22293eb9d1c8917 --- /dev/null +++ b/codenet/public_test_cases/p02725/input.0.txt @@ -0,0 +1,2 @@ +20 3 +5 10 15 diff --git a/codenet/public_test_cases/p02725/input.1.txt b/codenet/public_test_cases/p02725/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fc4538411d7c953f4a0c9dbc22293eb9d1c8917 --- /dev/null +++ b/codenet/public_test_cases/p02725/input.1.txt @@ -0,0 +1,2 @@ +20 3 +5 10 15 diff --git a/codenet/public_test_cases/p02725/input.2.txt b/codenet/public_test_cases/p02725/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f51c33a70521053efc920cb0020a95d582ae54a7 --- /dev/null +++ b/codenet/public_test_cases/p02725/input.2.txt @@ -0,0 +1,2 @@ +20 3 +0 5 15 diff --git a/codenet/public_test_cases/p02725/output.0.txt b/codenet/public_test_cases/p02725/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02725/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02725/output.1.txt b/codenet/public_test_cases/p02725/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02725/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02725/output.2.txt b/codenet/public_test_cases/p02725/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02725/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02726/input.0.txt b/codenet/public_test_cases/p02726/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37122f4bb8da7cdc63b02195266c286138058939 --- /dev/null +++ b/codenet/public_test_cases/p02726/input.0.txt @@ -0,0 +1 @@ +5 2 4 diff --git a/codenet/public_test_cases/p02726/input.1.txt b/codenet/public_test_cases/p02726/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6344fed540b79888e96e2998e124a1a2fdafa163 --- /dev/null +++ b/codenet/public_test_cases/p02726/input.1.txt @@ -0,0 +1 @@ +7 3 7 diff --git a/codenet/public_test_cases/p02726/input.2.txt b/codenet/public_test_cases/p02726/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c99d323974cc06de986e83c244cfc4976da3a586 --- /dev/null +++ b/codenet/public_test_cases/p02726/input.2.txt @@ -0,0 +1 @@ +10 4 8 diff --git a/codenet/public_test_cases/p02726/input.3.txt b/codenet/public_test_cases/p02726/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd44576efdb1644f37860091ca301a02d1d8c54d --- /dev/null +++ b/codenet/public_test_cases/p02726/input.3.txt @@ -0,0 +1 @@ +3 1 3 diff --git a/codenet/public_test_cases/p02726/input.4.txt b/codenet/public_test_cases/p02726/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..37122f4bb8da7cdc63b02195266c286138058939 --- /dev/null +++ b/codenet/public_test_cases/p02726/input.4.txt @@ -0,0 +1 @@ +5 2 4 diff --git a/codenet/public_test_cases/p02726/output.0.txt b/codenet/public_test_cases/p02726/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a1e1617ae901c405cf68c8d5943bdef64865f2b --- /dev/null +++ b/codenet/public_test_cases/p02726/output.0.txt @@ -0,0 +1,4 @@ +5 +4 +1 +0 diff --git a/codenet/public_test_cases/p02726/output.1.txt b/codenet/public_test_cases/p02726/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a36c01d2b5197b43f235eb23c2f5da61f71af9c1 --- /dev/null +++ b/codenet/public_test_cases/p02726/output.1.txt @@ -0,0 +1,6 @@ +7 +8 +4 +2 +0 +0 diff --git a/codenet/public_test_cases/p02726/output.2.txt b/codenet/public_test_cases/p02726/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..89650762f1fcf43d12e9d5b5a3b27555c4de120f --- /dev/null +++ b/codenet/public_test_cases/p02726/output.2.txt @@ -0,0 +1,9 @@ +10 +12 +10 +8 +4 +1 +0 +0 +0 diff --git a/codenet/public_test_cases/p02726/output.3.txt b/codenet/public_test_cases/p02726/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p02726/output.3.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p02726/output.4.txt b/codenet/public_test_cases/p02726/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a1e1617ae901c405cf68c8d5943bdef64865f2b --- /dev/null +++ b/codenet/public_test_cases/p02726/output.4.txt @@ -0,0 +1,4 @@ +5 +4 +1 +0 diff --git a/codenet/public_test_cases/p02727/input.0.txt b/codenet/public_test_cases/p02727/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83d6dc42aceddb9e6b56b6ee01134550b5ebf7c8 --- /dev/null +++ b/codenet/public_test_cases/p02727/input.0.txt @@ -0,0 +1,4 @@ +1 2 2 2 1 +2 4 +5 1 +3 diff --git a/codenet/public_test_cases/p02727/input.1.txt b/codenet/public_test_cases/p02727/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e3f7f8d56f5baf8f5d6979b7bbcc41c2088b7fa --- /dev/null +++ b/codenet/public_test_cases/p02727/input.1.txt @@ -0,0 +1,4 @@ +2 2 2 2 2 +8 6 +9 1 +2 1 diff --git a/codenet/public_test_cases/p02727/input.2.txt b/codenet/public_test_cases/p02727/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..83d6dc42aceddb9e6b56b6ee01134550b5ebf7c8 --- /dev/null +++ b/codenet/public_test_cases/p02727/input.2.txt @@ -0,0 +1,4 @@ +1 2 2 2 1 +2 4 +5 1 +3 diff --git a/codenet/public_test_cases/p02727/input.3.txt b/codenet/public_test_cases/p02727/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..354a7f9320977f6588b62067383b4075cd4309b0 --- /dev/null +++ b/codenet/public_test_cases/p02727/input.3.txt @@ -0,0 +1,4 @@ +2 2 4 4 4 +11 12 13 14 +21 22 23 24 +1 2 3 4 diff --git a/codenet/public_test_cases/p02727/output.0.txt b/codenet/public_test_cases/p02727/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02727/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02727/output.1.txt b/codenet/public_test_cases/p02727/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02727/output.1.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02727/output.2.txt b/codenet/public_test_cases/p02727/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02727/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02727/output.3.txt b/codenet/public_test_cases/p02727/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fff0a2476aa5c8e60a3ef21cfc66e0cc670920be --- /dev/null +++ b/codenet/public_test_cases/p02727/output.3.txt @@ -0,0 +1 @@ +74 diff --git a/codenet/public_test_cases/p02728/input.0.txt b/codenet/public_test_cases/p02728/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4af6367f0bdccd94780713d85e9aaec7d6842d6c --- /dev/null +++ b/codenet/public_test_cases/p02728/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02728/input.1.txt b/codenet/public_test_cases/p02728/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4af6367f0bdccd94780713d85e9aaec7d6842d6c --- /dev/null +++ b/codenet/public_test_cases/p02728/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 +1 3 diff --git a/codenet/public_test_cases/p02728/input.2.txt b/codenet/public_test_cases/p02728/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p02728/input.2.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p02728/input.3.txt b/codenet/public_test_cases/p02728/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec1c340feac463e5e3b91fee553af0432ee9a2bd --- /dev/null +++ b/codenet/public_test_cases/p02728/input.3.txt @@ -0,0 +1,5 @@ +5 +1 2 +2 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p02728/input.4.txt b/codenet/public_test_cases/p02728/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..96102ae9d20ce78762687478b17be33159e4d3e6 --- /dev/null +++ b/codenet/public_test_cases/p02728/input.4.txt @@ -0,0 +1,8 @@ +8 +1 2 +2 3 +3 4 +3 5 +3 6 +6 7 +6 8 diff --git a/codenet/public_test_cases/p02728/output.0.txt b/codenet/public_test_cases/p02728/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe234be093e7ad8424af41b8a2162a42d19b3e9 --- /dev/null +++ b/codenet/public_test_cases/p02728/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +1 diff --git a/codenet/public_test_cases/p02728/output.1.txt b/codenet/public_test_cases/p02728/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe234be093e7ad8424af41b8a2162a42d19b3e9 --- /dev/null +++ b/codenet/public_test_cases/p02728/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +1 diff --git a/codenet/public_test_cases/p02728/output.2.txt b/codenet/public_test_cases/p02728/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p02728/output.2.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p02728/output.3.txt b/codenet/public_test_cases/p02728/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..59c996bcbcd839a94bb50573f5556ed05384b0c5 --- /dev/null +++ b/codenet/public_test_cases/p02728/output.3.txt @@ -0,0 +1,5 @@ +2 +8 +12 +3 +3 diff --git a/codenet/public_test_cases/p02728/output.4.txt b/codenet/public_test_cases/p02728/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7748fb7bb6ecc7c67eed48895e5c7d557b69dbeb --- /dev/null +++ b/codenet/public_test_cases/p02728/output.4.txt @@ -0,0 +1,8 @@ +40 +280 +840 +120 +120 +504 +72 +72 diff --git a/codenet/public_test_cases/p02729/input.0.txt b/codenet/public_test_cases/p02729/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p02729/input.0.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p02729/input.1.txt b/codenet/public_test_cases/p02729/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1237b57d68e751d4cb03af542a102444e5ca2c96 --- /dev/null +++ b/codenet/public_test_cases/p02729/input.1.txt @@ -0,0 +1 @@ +13 3 diff --git a/codenet/public_test_cases/p02729/input.2.txt b/codenet/public_test_cases/p02729/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02729/input.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02729/input.3.txt b/codenet/public_test_cases/p02729/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p02729/input.3.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p02729/input.4.txt b/codenet/public_test_cases/p02729/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p02729/input.4.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p02729/input.5.txt b/codenet/public_test_cases/p02729/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..65c9b94edf74d6d9deb325c42d8a874189c9f202 --- /dev/null +++ b/codenet/public_test_cases/p02729/input.5.txt @@ -0,0 +1 @@ +0 3 diff --git a/codenet/public_test_cases/p02729/output.0.txt b/codenet/public_test_cases/p02729/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02729/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02729/output.1.txt b/codenet/public_test_cases/p02729/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d88e313699871a6c780316c8df7479aebe6999c0 --- /dev/null +++ b/codenet/public_test_cases/p02729/output.1.txt @@ -0,0 +1 @@ +81 diff --git a/codenet/public_test_cases/p02729/output.2.txt b/codenet/public_test_cases/p02729/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02729/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02729/output.3.txt b/codenet/public_test_cases/p02729/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02729/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02729/output.4.txt b/codenet/public_test_cases/p02729/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02729/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02729/output.5.txt b/codenet/public_test_cases/p02729/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02729/output.5.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02730/input.0.txt b/codenet/public_test_cases/p02730/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1734a6ccd53ab26e88ebe943effcca8cacf6ac89 --- /dev/null +++ b/codenet/public_test_cases/p02730/input.0.txt @@ -0,0 +1 @@ +akasaka diff --git a/codenet/public_test_cases/p02730/input.1.txt b/codenet/public_test_cases/p02730/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1734a6ccd53ab26e88ebe943effcca8cacf6ac89 --- /dev/null +++ b/codenet/public_test_cases/p02730/input.1.txt @@ -0,0 +1 @@ +akasaka diff --git a/codenet/public_test_cases/p02730/input.2.txt b/codenet/public_test_cases/p02730/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ef13d11d0bc8c8cde49253ea4a0cdbea2c9416 --- /dev/null +++ b/codenet/public_test_cases/p02730/input.2.txt @@ -0,0 +1 @@ +atcoder diff --git a/codenet/public_test_cases/p02730/input.3.txt b/codenet/public_test_cases/p02730/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..af0f6302db9523d1d0ec35be63b64b4567451818 --- /dev/null +++ b/codenet/public_test_cases/p02730/input.3.txt @@ -0,0 +1 @@ +level diff --git a/codenet/public_test_cases/p02730/output.0.txt b/codenet/public_test_cases/p02730/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02730/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02730/output.1.txt b/codenet/public_test_cases/p02730/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02730/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02730/output.2.txt b/codenet/public_test_cases/p02730/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02730/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02730/output.3.txt b/codenet/public_test_cases/p02730/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02730/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02731/input.0.txt b/codenet/public_test_cases/p02731/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02731/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02731/input.1.txt b/codenet/public_test_cases/p02731/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6905f8ba447c0116590e38b2430151b506b1611 --- /dev/null +++ b/codenet/public_test_cases/p02731/input.1.txt @@ -0,0 +1 @@ +999 diff --git a/codenet/public_test_cases/p02731/input.2.txt b/codenet/public_test_cases/p02731/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02731/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02731/output.0.txt b/codenet/public_test_cases/p02731/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b43b2ec6156b9a6e96f1152dd5c48c3b433ab05a --- /dev/null +++ b/codenet/public_test_cases/p02731/output.0.txt @@ -0,0 +1 @@ +1.000000000000 diff --git a/codenet/public_test_cases/p02731/output.1.txt b/codenet/public_test_cases/p02731/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e60ffc5d61dadc77eb27bd962fcedf59f9a09ee7 --- /dev/null +++ b/codenet/public_test_cases/p02731/output.1.txt @@ -0,0 +1 @@ +36926037.000000000000 diff --git a/codenet/public_test_cases/p02731/output.2.txt b/codenet/public_test_cases/p02731/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b43b2ec6156b9a6e96f1152dd5c48c3b433ab05a --- /dev/null +++ b/codenet/public_test_cases/p02731/output.2.txt @@ -0,0 +1 @@ +1.000000000000 diff --git a/codenet/public_test_cases/p02732/input.0.txt b/codenet/public_test_cases/p02732/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef974d0b881f30259094151f83d425f06d61f2bb --- /dev/null +++ b/codenet/public_test_cases/p02732/input.0.txt @@ -0,0 +1,2 @@ +5 +1 1 2 1 2 diff --git a/codenet/public_test_cases/p02732/input.1.txt b/codenet/public_test_cases/p02732/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bfb6437bc1ef13c4cfbb637d7a3742c832d289c --- /dev/null +++ b/codenet/public_test_cases/p02732/input.1.txt @@ -0,0 +1,2 @@ +8 +1 2 1 4 2 1 4 1 diff --git a/codenet/public_test_cases/p02732/input.2.txt b/codenet/public_test_cases/p02732/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef974d0b881f30259094151f83d425f06d61f2bb --- /dev/null +++ b/codenet/public_test_cases/p02732/input.2.txt @@ -0,0 +1,2 @@ +5 +1 1 2 1 2 diff --git a/codenet/public_test_cases/p02732/input.3.txt b/codenet/public_test_cases/p02732/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a4d515660c3c567ab07859fc5e252f8c966e46 --- /dev/null +++ b/codenet/public_test_cases/p02732/input.3.txt @@ -0,0 +1,2 @@ +4 +1 2 3 4 diff --git a/codenet/public_test_cases/p02732/input.4.txt b/codenet/public_test_cases/p02732/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6ad0ca15d6caa972e6ddf0d652c404bffd885a2 --- /dev/null +++ b/codenet/public_test_cases/p02732/input.4.txt @@ -0,0 +1,2 @@ +5 +3 3 3 3 3 diff --git a/codenet/public_test_cases/p02732/output.0.txt b/codenet/public_test_cases/p02732/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7b958f741b55ffeb19549cbeab7b289987e164f --- /dev/null +++ b/codenet/public_test_cases/p02732/output.0.txt @@ -0,0 +1,5 @@ +2 +2 +3 +2 +3 diff --git a/codenet/public_test_cases/p02732/output.1.txt b/codenet/public_test_cases/p02732/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94eacaa4db87bf6f9ba87727e788eee03b7d5a6f --- /dev/null +++ b/codenet/public_test_cases/p02732/output.1.txt @@ -0,0 +1,8 @@ +5 +7 +5 +7 +7 +5 +7 +5 diff --git a/codenet/public_test_cases/p02732/output.2.txt b/codenet/public_test_cases/p02732/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7b958f741b55ffeb19549cbeab7b289987e164f --- /dev/null +++ b/codenet/public_test_cases/p02732/output.2.txt @@ -0,0 +1,5 @@ +2 +2 +3 +2 +3 diff --git a/codenet/public_test_cases/p02732/output.3.txt b/codenet/public_test_cases/p02732/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..44e0be8e3569542122ae0a5b046af7f8fe713943 --- /dev/null +++ b/codenet/public_test_cases/p02732/output.3.txt @@ -0,0 +1,4 @@ +0 +0 +0 +0 diff --git a/codenet/public_test_cases/p02732/output.4.txt b/codenet/public_test_cases/p02732/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..bab74a88390c6830618aefe565f78d58e9301c40 --- /dev/null +++ b/codenet/public_test_cases/p02732/output.4.txt @@ -0,0 +1,5 @@ +6 +6 +6 +6 +6 diff --git a/codenet/public_test_cases/p02733/input.0.txt b/codenet/public_test_cases/p02733/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d937b7049ee2311ddc384975a4a6e74c2ed483f1 --- /dev/null +++ b/codenet/public_test_cases/p02733/input.0.txt @@ -0,0 +1,4 @@ +3 5 4 +11100 +10001 +00111 diff --git a/codenet/public_test_cases/p02733/input.1.txt b/codenet/public_test_cases/p02733/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b00ae61f91292769cdcbb4b490b5d450658fdfb --- /dev/null +++ b/codenet/public_test_cases/p02733/input.1.txt @@ -0,0 +1,5 @@ +4 10 4 +1110010010 +1000101110 +0011101001 +1101000111 diff --git a/codenet/public_test_cases/p02733/input.2.txt b/codenet/public_test_cases/p02733/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6138b847920f94268f464b37799bb19d81fee93f --- /dev/null +++ b/codenet/public_test_cases/p02733/input.2.txt @@ -0,0 +1,4 @@ +3 5 8 +11100 +10001 +00111 diff --git a/codenet/public_test_cases/p02733/input.3.txt b/codenet/public_test_cases/p02733/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d937b7049ee2311ddc384975a4a6e74c2ed483f1 --- /dev/null +++ b/codenet/public_test_cases/p02733/input.3.txt @@ -0,0 +1,4 @@ +3 5 4 +11100 +10001 +00111 diff --git a/codenet/public_test_cases/p02733/output.0.txt b/codenet/public_test_cases/p02733/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02733/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02733/output.1.txt b/codenet/public_test_cases/p02733/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02733/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02733/output.2.txt b/codenet/public_test_cases/p02733/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02733/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02733/output.3.txt b/codenet/public_test_cases/p02733/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02733/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02734/input.0.txt b/codenet/public_test_cases/p02734/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cfac9da29c4563d40b86107c4635d07f7b200c2 --- /dev/null +++ b/codenet/public_test_cases/p02734/input.0.txt @@ -0,0 +1,2 @@ +3 4 +2 2 4 diff --git a/codenet/public_test_cases/p02734/input.1.txt b/codenet/public_test_cases/p02734/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e67e50d46739e1e9ffb6a9587cd74f3217a17eaa --- /dev/null +++ b/codenet/public_test_cases/p02734/input.1.txt @@ -0,0 +1,2 @@ +10 10 +3 1 4 1 5 9 2 6 5 3 diff --git a/codenet/public_test_cases/p02734/input.2.txt b/codenet/public_test_cases/p02734/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b484ef92ca890ff8d2558c090bcfc742f658059 --- /dev/null +++ b/codenet/public_test_cases/p02734/input.2.txt @@ -0,0 +1,2 @@ +5 8 +9 9 9 9 9 diff --git a/codenet/public_test_cases/p02734/input.3.txt b/codenet/public_test_cases/p02734/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cfac9da29c4563d40b86107c4635d07f7b200c2 --- /dev/null +++ b/codenet/public_test_cases/p02734/input.3.txt @@ -0,0 +1,2 @@ +3 4 +2 2 4 diff --git a/codenet/public_test_cases/p02734/output.0.txt b/codenet/public_test_cases/p02734/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02734/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02734/output.1.txt b/codenet/public_test_cases/p02734/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..492dff089afe4c5aaa55abe406b1f1169db21a13 --- /dev/null +++ b/codenet/public_test_cases/p02734/output.1.txt @@ -0,0 +1 @@ +152 diff --git a/codenet/public_test_cases/p02734/output.2.txt b/codenet/public_test_cases/p02734/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02734/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02734/output.3.txt b/codenet/public_test_cases/p02734/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02734/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02735/input.0.txt b/codenet/public_test_cases/p02735/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d03c9a39fcdea68ca8450cbb71855000c010a22 --- /dev/null +++ b/codenet/public_test_cases/p02735/input.0.txt @@ -0,0 +1,4 @@ +3 3 +.## +.#. +##. diff --git a/codenet/public_test_cases/p02735/input.1.txt b/codenet/public_test_cases/p02735/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19bc8b703d7ecb12e802c46abcae9e7fbfe06765 --- /dev/null +++ b/codenet/public_test_cases/p02735/input.1.txt @@ -0,0 +1,3 @@ +2 2 +. +.# diff --git a/codenet/public_test_cases/p02735/input.2.txt b/codenet/public_test_cases/p02735/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..96889e81558eb9a3a43500415129d8f6728b0e9b --- /dev/null +++ b/codenet/public_test_cases/p02735/input.2.txt @@ -0,0 +1,5 @@ +4 4 +..## +... +. +. diff --git a/codenet/public_test_cases/p02735/input.3.txt b/codenet/public_test_cases/p02735/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..73ee148ba42b8838c8d2fc46debb1d4b2b4b97b5 --- /dev/null +++ b/codenet/public_test_cases/p02735/input.3.txt @@ -0,0 +1,6 @@ +5 5 +.#.#. +.#.# +.#.#. +.#.# +.#.#. diff --git a/codenet/public_test_cases/p02735/input.4.txt b/codenet/public_test_cases/p02735/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d03c9a39fcdea68ca8450cbb71855000c010a22 --- /dev/null +++ b/codenet/public_test_cases/p02735/input.4.txt @@ -0,0 +1,4 @@ +3 3 +.## +.#. +##. diff --git a/codenet/public_test_cases/p02735/input.5.txt b/codenet/public_test_cases/p02735/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..957331430b1fcd1d02edd6286a387a4a0be21b71 --- /dev/null +++ b/codenet/public_test_cases/p02735/input.5.txt @@ -0,0 +1,4 @@ +3 3 +.## +.#. +. diff --git a/codenet/public_test_cases/p02735/output.0.txt b/codenet/public_test_cases/p02735/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02735/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02735/output.1.txt b/codenet/public_test_cases/p02735/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02735/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02735/output.2.txt b/codenet/public_test_cases/p02735/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02735/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02735/output.3.txt b/codenet/public_test_cases/p02735/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02735/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02735/output.4.txt b/codenet/public_test_cases/p02735/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02735/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02735/output.5.txt b/codenet/public_test_cases/p02735/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02735/output.5.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02736/input.0.txt b/codenet/public_test_cases/p02736/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5eae2a48a1bfeb9bfe3724860b2b0425fa0da89e --- /dev/null +++ b/codenet/public_test_cases/p02736/input.0.txt @@ -0,0 +1,2 @@ +4 +1231 diff --git a/codenet/public_test_cases/p02736/input.1.txt b/codenet/public_test_cases/p02736/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6016879a5c0ae0d07e8b28d67618b7e6a15d824c --- /dev/null +++ b/codenet/public_test_cases/p02736/input.1.txt @@ -0,0 +1,2 @@ +10 +2311312312 diff --git a/codenet/public_test_cases/p02736/input.2.txt b/codenet/public_test_cases/p02736/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5eae2a48a1bfeb9bfe3724860b2b0425fa0da89e --- /dev/null +++ b/codenet/public_test_cases/p02736/input.2.txt @@ -0,0 +1,2 @@ +4 +1231 diff --git a/codenet/public_test_cases/p02736/output.0.txt b/codenet/public_test_cases/p02736/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02736/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02736/output.1.txt b/codenet/public_test_cases/p02736/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02736/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02736/output.2.txt b/codenet/public_test_cases/p02736/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02736/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02737/input.0.txt b/codenet/public_test_cases/p02737/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..95922a59822f152b1b57af8840079bc88016c591 --- /dev/null +++ b/codenet/public_test_cases/p02737/input.0.txt @@ -0,0 +1,7 @@ +2 +1 +1 2 +1 +1 2 +1 +1 2 diff --git a/codenet/public_test_cases/p02737/input.1.txt b/codenet/public_test_cases/p02737/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fcdeb06aad03787b0ec53876695b1faf8a553e6 --- /dev/null +++ b/codenet/public_test_cases/p02737/input.1.txt @@ -0,0 +1,10 @@ +3 +3 +1 3 +1 2 +3 2 +2 +2 1 +2 3 +1 +2 1 diff --git a/codenet/public_test_cases/p02737/input.2.txt b/codenet/public_test_cases/p02737/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b446d52478841c235c3af9b2a3ee9876b85786fb --- /dev/null +++ b/codenet/public_test_cases/p02737/input.2.txt @@ -0,0 +1,7 @@ +100000 +1 +1 2 +1 +99999 100000 +1 +1 100000 diff --git a/codenet/public_test_cases/p02737/input.3.txt b/codenet/public_test_cases/p02737/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..95922a59822f152b1b57af8840079bc88016c591 --- /dev/null +++ b/codenet/public_test_cases/p02737/input.3.txt @@ -0,0 +1,7 @@ +2 +1 +1 2 +1 +1 2 +1 +1 2 diff --git a/codenet/public_test_cases/p02737/output.0.txt b/codenet/public_test_cases/p02737/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3940c16d6edee50657d163668e52975771a76af4 --- /dev/null +++ b/codenet/public_test_cases/p02737/output.0.txt @@ -0,0 +1 @@ +46494701 diff --git a/codenet/public_test_cases/p02737/output.1.txt b/codenet/public_test_cases/p02737/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..837ac61cf58e4d82a5f6da543e406ca15affccf1 --- /dev/null +++ b/codenet/public_test_cases/p02737/output.1.txt @@ -0,0 +1 @@ +883188316 diff --git a/codenet/public_test_cases/p02737/output.2.txt b/codenet/public_test_cases/p02737/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..687ce1c64626ed8b2067912c8967d3b363528fc3 --- /dev/null +++ b/codenet/public_test_cases/p02737/output.2.txt @@ -0,0 +1 @@ +318525248 diff --git a/codenet/public_test_cases/p02737/output.3.txt b/codenet/public_test_cases/p02737/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3940c16d6edee50657d163668e52975771a76af4 --- /dev/null +++ b/codenet/public_test_cases/p02737/output.3.txt @@ -0,0 +1 @@ +46494701 diff --git a/codenet/public_test_cases/p02738/input.0.txt b/codenet/public_test_cases/p02738/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..367e427e7c6aa9d8f164583ba512c23ee7f0538d --- /dev/null +++ b/codenet/public_test_cases/p02738/input.0.txt @@ -0,0 +1 @@ +1 998244353 diff --git a/codenet/public_test_cases/p02738/input.1.txt b/codenet/public_test_cases/p02738/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad4b1abd7b7bce1c82c04345a102cb153fe9c2d0 --- /dev/null +++ b/codenet/public_test_cases/p02738/input.1.txt @@ -0,0 +1 @@ +314 1000000007 diff --git a/codenet/public_test_cases/p02738/input.2.txt b/codenet/public_test_cases/p02738/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..367e427e7c6aa9d8f164583ba512c23ee7f0538d --- /dev/null +++ b/codenet/public_test_cases/p02738/input.2.txt @@ -0,0 +1 @@ +1 998244353 diff --git a/codenet/public_test_cases/p02738/input.3.txt b/codenet/public_test_cases/p02738/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd977a1d53bc1506bc30ab6d858da4e6d725c307 --- /dev/null +++ b/codenet/public_test_cases/p02738/input.3.txt @@ -0,0 +1 @@ +2 998244353 diff --git a/codenet/public_test_cases/p02738/output.0.txt b/codenet/public_test_cases/p02738/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02738/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02738/output.1.txt b/codenet/public_test_cases/p02738/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18d4f9cfe5a5ce9f4fe2f5c961efada0acda093c --- /dev/null +++ b/codenet/public_test_cases/p02738/output.1.txt @@ -0,0 +1 @@ +182908545 diff --git a/codenet/public_test_cases/p02738/output.2.txt b/codenet/public_test_cases/p02738/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02738/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02738/output.3.txt b/codenet/public_test_cases/p02738/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fc233b7abc7e73aab2d968759841218fde09dfb --- /dev/null +++ b/codenet/public_test_cases/p02738/output.3.txt @@ -0,0 +1 @@ +261 diff --git a/codenet/public_test_cases/p02739/input.0.txt b/codenet/public_test_cases/p02739/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b258dc3d8a70dfd158dac8e5a6905f41cadd45f4 --- /dev/null +++ b/codenet/public_test_cases/p02739/input.0.txt @@ -0,0 +1,2 @@ +1 +10 diff --git a/codenet/public_test_cases/p02739/input.1.txt b/codenet/public_test_cases/p02739/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4278ab15284c942b4ef1136e0e2a5cd4c553629 --- /dev/null +++ b/codenet/public_test_cases/p02739/input.1.txt @@ -0,0 +1,2 @@ +2 +1000 diff --git a/codenet/public_test_cases/p02739/input.2.txt b/codenet/public_test_cases/p02739/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b258dc3d8a70dfd158dac8e5a6905f41cadd45f4 --- /dev/null +++ b/codenet/public_test_cases/p02739/input.2.txt @@ -0,0 +1,2 @@ +1 +10 diff --git a/codenet/public_test_cases/p02739/input.3.txt b/codenet/public_test_cases/p02739/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..64a5af4d708bfa4d6735d4123f929d577429035a --- /dev/null +++ b/codenet/public_test_cases/p02739/input.3.txt @@ -0,0 +1,2 @@ +2 +1001 diff --git a/codenet/public_test_cases/p02739/input.4.txt b/codenet/public_test_cases/p02739/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5f1cf8ac646b5e0efc71eee00c20bd20289f363 --- /dev/null +++ b/codenet/public_test_cases/p02739/input.4.txt @@ -0,0 +1,2 @@ +1 +11 diff --git a/codenet/public_test_cases/p02739/output.0.txt b/codenet/public_test_cases/p02739/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a16c5723cd0475345393e9f3f53e71548580602 --- /dev/null +++ b/codenet/public_test_cases/p02739/output.0.txt @@ -0,0 +1,7 @@ +Possible +4 +0 0 +0 1 +1 1 +1 0 +0 0 diff --git a/codenet/public_test_cases/p02739/output.1.txt b/codenet/public_test_cases/p02739/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60ab325e1a1249b5bd4e26d2fc6be4ab985c28cd --- /dev/null +++ b/codenet/public_test_cases/p02739/output.1.txt @@ -0,0 +1,9 @@ +Possible +6 +1 0 +2 0 +2 1 +1 1 +0 1 +0 0 +1 0 diff --git a/codenet/public_test_cases/p02739/output.2.txt b/codenet/public_test_cases/p02739/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a16c5723cd0475345393e9f3f53e71548580602 --- /dev/null +++ b/codenet/public_test_cases/p02739/output.2.txt @@ -0,0 +1,7 @@ +Possible +4 +0 0 +0 1 +1 1 +1 0 +0 0 diff --git a/codenet/public_test_cases/p02739/output.3.txt b/codenet/public_test_cases/p02739/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p02739/output.3.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p02739/output.4.txt b/codenet/public_test_cases/p02739/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..53a92a2aa57484e187e263520613d50687d29d9a --- /dev/null +++ b/codenet/public_test_cases/p02739/output.4.txt @@ -0,0 +1,3 @@ +Possible +0 +1 1 diff --git a/codenet/public_test_cases/p02740/input.0.txt b/codenet/public_test_cases/p02740/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c61ba99d6bd826db5f1acf40215f56344fce185d --- /dev/null +++ b/codenet/public_test_cases/p02740/input.0.txt @@ -0,0 +1,18 @@ +3 +2 +1 10 1 +3 1 1 +3 +1 10 1 +2 1 1 +3 10 1 +2 +1 1 1 +3 10 1 +2 +1 2 0 +2 3 0 +3 +1 +2 +3 diff --git a/codenet/public_test_cases/p02740/input.1.txt b/codenet/public_test_cases/p02740/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a18e9b62d5727581c1e74f1028491973924f516f --- /dev/null +++ b/codenet/public_test_cases/p02740/input.1.txt @@ -0,0 +1,53 @@ +5 +5 +86849520 30 272477201869 +968023357 28 539131386006 +478355090 8 194500792721 +298572419 6 894877901270 +203794105 25 594579473837 +5 +730211794 22 225797976416 +842538552 9 420531931830 +871332982 26 81253086754 +553846923 29 89734736118 +731788040 13 241088716205 +5 +903534485 22 140045153776 +187101906 8 145639722124 +513502442 9 227445343895 +499446330 6 719254728400 +564106748 20 333423097859 +5 +332809289 8 640911722470 +969492694 21 937931959818 +207959501 11 217019915462 +726936503 12 382527525674 +887971218 17 552919286358 +5 +444983655 13 487875689585 +855863581 6 625608576077 +885012925 10 105520979776 +980933856 1 711474069172 +653022356 19 977887412815 +10 +1 2 231274893 +2 3 829836076 +3 4 745221482 +4 5 935448462 +5 1 819308546 +3 5 815839350 +5 3 513188748 +3 1 968283437 +2 3 202352515 +4 3 292999238 +10 +510266667947 +252899314976 +510266667948 +374155726828 +628866122125 +628866122123 +1 +628866122124 +510266667949 +30000000000000 diff --git a/codenet/public_test_cases/p02740/input.2.txt b/codenet/public_test_cases/p02740/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c61ba99d6bd826db5f1acf40215f56344fce185d --- /dev/null +++ b/codenet/public_test_cases/p02740/input.2.txt @@ -0,0 +1,18 @@ +3 +2 +1 10 1 +3 1 1 +3 +1 10 1 +2 1 1 +3 10 1 +2 +1 1 1 +3 10 1 +2 +1 2 0 +2 3 0 +3 +1 +2 +3 diff --git a/codenet/public_test_cases/p02740/output.0.txt b/codenet/public_test_cases/p02740/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a3498fd5ab21933954293ff08f11459642d7eae --- /dev/null +++ b/codenet/public_test_cases/p02740/output.0.txt @@ -0,0 +1,3 @@ +3 +42 +-1 diff --git a/codenet/public_test_cases/p02740/output.1.txt b/codenet/public_test_cases/p02740/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3df6f4f5349c9f1b7bfcf08435fc2a964e275dd9 --- /dev/null +++ b/codenet/public_test_cases/p02740/output.1.txt @@ -0,0 +1,10 @@ +26533866733244 +13150764378752 +26533866733296 +19456097795056 +-1 +33175436167096 +52 +33175436167152 +26533866733352 +-1 diff --git a/codenet/public_test_cases/p02740/output.2.txt b/codenet/public_test_cases/p02740/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a3498fd5ab21933954293ff08f11459642d7eae --- /dev/null +++ b/codenet/public_test_cases/p02740/output.2.txt @@ -0,0 +1,3 @@ +3 +42 +-1 diff --git a/codenet/public_test_cases/p02741/input.0.txt b/codenet/public_test_cases/p02741/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02741/input.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02741/input.1.txt b/codenet/public_test_cases/p02741/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p02741/input.1.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p02741/input.2.txt b/codenet/public_test_cases/p02741/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02741/input.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02741/output.0.txt b/codenet/public_test_cases/p02741/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02741/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02741/output.1.txt b/codenet/public_test_cases/p02741/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02741/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02741/output.2.txt b/codenet/public_test_cases/p02741/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02741/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02742/input.0.txt b/codenet/public_test_cases/p02742/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a99162ed9cdd1b90006cbd4f07e2a2bd3f404d4 --- /dev/null +++ b/codenet/public_test_cases/p02742/input.0.txt @@ -0,0 +1 @@ +4 5 diff --git a/codenet/public_test_cases/p02742/input.1.txt b/codenet/public_test_cases/p02742/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f036e7ba038ea9020e90a29f669ac3db830dd66 --- /dev/null +++ b/codenet/public_test_cases/p02742/input.1.txt @@ -0,0 +1 @@ +7 3 diff --git a/codenet/public_test_cases/p02742/input.2.txt b/codenet/public_test_cases/p02742/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..caf89741fceaaa4127b0607f26763103dc3d00ca --- /dev/null +++ b/codenet/public_test_cases/p02742/input.2.txt @@ -0,0 +1 @@ +1000000000 1000000000 diff --git a/codenet/public_test_cases/p02742/input.3.txt b/codenet/public_test_cases/p02742/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a99162ed9cdd1b90006cbd4f07e2a2bd3f404d4 --- /dev/null +++ b/codenet/public_test_cases/p02742/input.3.txt @@ -0,0 +1 @@ +4 5 diff --git a/codenet/public_test_cases/p02742/output.0.txt b/codenet/public_test_cases/p02742/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02742/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02742/output.1.txt b/codenet/public_test_cases/p02742/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02742/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02742/output.2.txt b/codenet/public_test_cases/p02742/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..170daeee3cb83e5ea9471403475436d00332ee8d --- /dev/null +++ b/codenet/public_test_cases/p02742/output.2.txt @@ -0,0 +1 @@ +500000000000000000 diff --git a/codenet/public_test_cases/p02742/output.3.txt b/codenet/public_test_cases/p02742/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02742/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02743/input.0.txt b/codenet/public_test_cases/p02743/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c12281c343c929ed01faf5f1378b2d342112873 --- /dev/null +++ b/codenet/public_test_cases/p02743/input.0.txt @@ -0,0 +1 @@ +2 3 9 diff --git a/codenet/public_test_cases/p02743/input.1.txt b/codenet/public_test_cases/p02743/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05b32e14fdb8a5204562a6bd044e682bf305b245 --- /dev/null +++ b/codenet/public_test_cases/p02743/input.1.txt @@ -0,0 +1 @@ +2 3 10 diff --git a/codenet/public_test_cases/p02743/input.2.txt b/codenet/public_test_cases/p02743/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c12281c343c929ed01faf5f1378b2d342112873 --- /dev/null +++ b/codenet/public_test_cases/p02743/input.2.txt @@ -0,0 +1 @@ +2 3 9 diff --git a/codenet/public_test_cases/p02743/output.0.txt b/codenet/public_test_cases/p02743/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02743/output.0.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02743/output.1.txt b/codenet/public_test_cases/p02743/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02743/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02743/output.2.txt b/codenet/public_test_cases/p02743/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02743/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02744/input.0.txt b/codenet/public_test_cases/p02744/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02744/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02744/input.1.txt b/codenet/public_test_cases/p02744/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02744/input.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02744/input.2.txt b/codenet/public_test_cases/p02744/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02744/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02744/output.0.txt b/codenet/public_test_cases/p02744/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p02744/output.0.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p02744/output.1.txt b/codenet/public_test_cases/p02744/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p02744/output.1.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p02744/output.2.txt b/codenet/public_test_cases/p02744/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..85541c6764891cfe233b711fb8a0615eeca86d52 --- /dev/null +++ b/codenet/public_test_cases/p02744/output.2.txt @@ -0,0 +1,2 @@ +aa +ab diff --git a/codenet/public_test_cases/p02745/input.0.txt b/codenet/public_test_cases/p02745/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6090feb206f1e303650256958b7cb5656c37ea58 --- /dev/null +++ b/codenet/public_test_cases/p02745/input.0.txt @@ -0,0 +1,3 @@ +a?c +der +cod diff --git a/codenet/public_test_cases/p02745/input.1.txt b/codenet/public_test_cases/p02745/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6090feb206f1e303650256958b7cb5656c37ea58 --- /dev/null +++ b/codenet/public_test_cases/p02745/input.1.txt @@ -0,0 +1,3 @@ +a?c +der +cod diff --git a/codenet/public_test_cases/p02745/input.2.txt b/codenet/public_test_cases/p02745/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f39f58a9c1fd4742705d52209fedfff0d13de9ac --- /dev/null +++ b/codenet/public_test_cases/p02745/input.2.txt @@ -0,0 +1,3 @@ +atcoder +atcoder +??????? diff --git a/codenet/public_test_cases/p02745/output.0.txt b/codenet/public_test_cases/p02745/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02745/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02745/output.1.txt b/codenet/public_test_cases/p02745/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02745/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02745/output.2.txt b/codenet/public_test_cases/p02745/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02745/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02746/input.0.txt b/codenet/public_test_cases/p02746/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18e0577211c9baaaf05055be6db4a19fb7182997 --- /dev/null +++ b/codenet/public_test_cases/p02746/input.0.txt @@ -0,0 +1,3 @@ +2 +4 2 7 4 +9 9 1 9 diff --git a/codenet/public_test_cases/p02746/input.1.txt b/codenet/public_test_cases/p02746/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18e0577211c9baaaf05055be6db4a19fb7182997 --- /dev/null +++ b/codenet/public_test_cases/p02746/input.1.txt @@ -0,0 +1,3 @@ +2 +4 2 7 4 +9 9 1 9 diff --git a/codenet/public_test_cases/p02746/output.0.txt b/codenet/public_test_cases/p02746/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2050fde75a00b930d8590b42b634b1ebbe3bc6b4 --- /dev/null +++ b/codenet/public_test_cases/p02746/output.0.txt @@ -0,0 +1,2 @@ +5 +8 diff --git a/codenet/public_test_cases/p02746/output.1.txt b/codenet/public_test_cases/p02746/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2050fde75a00b930d8590b42b634b1ebbe3bc6b4 --- /dev/null +++ b/codenet/public_test_cases/p02746/output.1.txt @@ -0,0 +1,2 @@ +5 +8 diff --git a/codenet/public_test_cases/p02747/input.0.txt b/codenet/public_test_cases/p02747/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..623d98c32b812204d9604a401dacbd095b68977c --- /dev/null +++ b/codenet/public_test_cases/p02747/input.0.txt @@ -0,0 +1 @@ +hihi diff --git a/codenet/public_test_cases/p02747/input.1.txt b/codenet/public_test_cases/p02747/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05a98d59e6f083f194480efd00062071a01e54d8 --- /dev/null +++ b/codenet/public_test_cases/p02747/input.1.txt @@ -0,0 +1 @@ +ha diff --git a/codenet/public_test_cases/p02747/input.2.txt b/codenet/public_test_cases/p02747/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45b983be36b73c0788dc9cbcb76cbb80fc7bb057 --- /dev/null +++ b/codenet/public_test_cases/p02747/input.2.txt @@ -0,0 +1 @@ +hi diff --git a/codenet/public_test_cases/p02747/input.3.txt b/codenet/public_test_cases/p02747/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..623d98c32b812204d9604a401dacbd095b68977c --- /dev/null +++ b/codenet/public_test_cases/p02747/input.3.txt @@ -0,0 +1 @@ +hihi diff --git a/codenet/public_test_cases/p02747/output.0.txt b/codenet/public_test_cases/p02747/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02747/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02747/output.1.txt b/codenet/public_test_cases/p02747/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02747/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02747/output.2.txt b/codenet/public_test_cases/p02747/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02747/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02747/output.3.txt b/codenet/public_test_cases/p02747/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02747/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02748/input.0.txt b/codenet/public_test_cases/p02748/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e01786f230f28a105d3109643709ca85051e749b --- /dev/null +++ b/codenet/public_test_cases/p02748/input.0.txt @@ -0,0 +1,4 @@ +2 3 1 +3 3 +3 3 3 +1 2 1 diff --git a/codenet/public_test_cases/p02748/input.1.txt b/codenet/public_test_cases/p02748/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..074fa1abf56600770cd8d73427b4dfb0ee04822f --- /dev/null +++ b/codenet/public_test_cases/p02748/input.1.txt @@ -0,0 +1,5 @@ +1 1 2 +10 +10 +1 1 5 +1 1 10 diff --git a/codenet/public_test_cases/p02748/input.2.txt b/codenet/public_test_cases/p02748/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a12e49ce0b333081a2d46d142ffa9e9e0c6b149 --- /dev/null +++ b/codenet/public_test_cases/p02748/input.2.txt @@ -0,0 +1,4 @@ +2 2 1 +3 5 +3 5 +2 2 2 diff --git a/codenet/public_test_cases/p02748/input.3.txt b/codenet/public_test_cases/p02748/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e01786f230f28a105d3109643709ca85051e749b --- /dev/null +++ b/codenet/public_test_cases/p02748/input.3.txt @@ -0,0 +1,4 @@ +2 3 1 +3 3 +3 3 3 +1 2 1 diff --git a/codenet/public_test_cases/p02748/output.0.txt b/codenet/public_test_cases/p02748/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02748/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02748/output.1.txt b/codenet/public_test_cases/p02748/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02748/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02748/output.2.txt b/codenet/public_test_cases/p02748/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02748/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02748/output.3.txt b/codenet/public_test_cases/p02748/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02748/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02749/input.0.txt b/codenet/public_test_cases/p02749/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1afd0a528043139ffda69e48f586095ea445862a --- /dev/null +++ b/codenet/public_test_cases/p02749/input.0.txt @@ -0,0 +1,5 @@ +5 +1 2 +1 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p02749/input.1.txt b/codenet/public_test_cases/p02749/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1afd0a528043139ffda69e48f586095ea445862a --- /dev/null +++ b/codenet/public_test_cases/p02749/input.1.txt @@ -0,0 +1,5 @@ +5 +1 2 +1 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p02749/output.0.txt b/codenet/public_test_cases/p02749/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2aa5e979754617cdd7823a4dd4315a48db7ccc7c --- /dev/null +++ b/codenet/public_test_cases/p02749/output.0.txt @@ -0,0 +1 @@ +1 2 5 4 3 diff --git a/codenet/public_test_cases/p02749/output.1.txt b/codenet/public_test_cases/p02749/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2aa5e979754617cdd7823a4dd4315a48db7ccc7c --- /dev/null +++ b/codenet/public_test_cases/p02749/output.1.txt @@ -0,0 +1 @@ +1 2 5 4 3 diff --git a/codenet/public_test_cases/p02750/input.0.txt b/codenet/public_test_cases/p02750/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..794abbcee0cc7a4a5442fd69001c710d25398997 --- /dev/null +++ b/codenet/public_test_cases/p02750/input.0.txt @@ -0,0 +1,4 @@ +3 7 +2 0 +3 2 +0 3 diff --git a/codenet/public_test_cases/p02750/input.1.txt b/codenet/public_test_cases/p02750/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d46cb0db6ffbba3e29818e9e03045b590108df5b --- /dev/null +++ b/codenet/public_test_cases/p02750/input.1.txt @@ -0,0 +1,2 @@ +1 3 +0 3 diff --git a/codenet/public_test_cases/p02750/input.2.txt b/codenet/public_test_cases/p02750/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7962d8b57d58c9524eccb6eb0deff6cfe545334 --- /dev/null +++ b/codenet/public_test_cases/p02750/input.2.txt @@ -0,0 +1,6 @@ +5 21600 +2 14 +3 22 +1 3 +1 10 +1 9 diff --git a/codenet/public_test_cases/p02750/input.3.txt b/codenet/public_test_cases/p02750/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..794abbcee0cc7a4a5442fd69001c710d25398997 --- /dev/null +++ b/codenet/public_test_cases/p02750/input.3.txt @@ -0,0 +1,4 @@ +3 7 +2 0 +3 2 +0 3 diff --git a/codenet/public_test_cases/p02750/input.4.txt b/codenet/public_test_cases/p02750/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..70c7b76b46e578f92cbc322c33a60f2a9ee4027e --- /dev/null +++ b/codenet/public_test_cases/p02750/input.4.txt @@ -0,0 +1,8 @@ +7 57 +0 25 +3 10 +2 4 +5 15 +3 22 +2 14 +1 15 diff --git a/codenet/public_test_cases/p02750/output.0.txt b/codenet/public_test_cases/p02750/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02750/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02750/output.1.txt b/codenet/public_test_cases/p02750/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02750/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02750/output.2.txt b/codenet/public_test_cases/p02750/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02750/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02750/output.3.txt b/codenet/public_test_cases/p02750/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02750/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02750/output.4.txt b/codenet/public_test_cases/p02750/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02750/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02751/input.0.txt b/codenet/public_test_cases/p02751/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p02751/input.0.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p02751/input.1.txt b/codenet/public_test_cases/p02751/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p02751/input.1.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p02751/output.0.txt b/codenet/public_test_cases/p02751/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p02751/output.0.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p02751/output.1.txt b/codenet/public_test_cases/p02751/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p02751/output.1.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p02752/input.0.txt b/codenet/public_test_cases/p02752/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b0704ba694f598d9483987099ecbc787f05c7a4 --- /dev/null +++ b/codenet/public_test_cases/p02752/input.0.txt @@ -0,0 +1,6 @@ +6 +1 6 +2 1 +5 2 +3 4 +2 3 diff --git a/codenet/public_test_cases/p02752/input.1.txt b/codenet/public_test_cases/p02752/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d5172e669d4fac45306a96cc74ad5ea104e1122 --- /dev/null +++ b/codenet/public_test_cases/p02752/input.1.txt @@ -0,0 +1,9 @@ +9 +1 2 +2 3 +4 2 +1 7 +6 1 +2 5 +5 9 +6 8 diff --git a/codenet/public_test_cases/p02752/input.2.txt b/codenet/public_test_cases/p02752/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b0704ba694f598d9483987099ecbc787f05c7a4 --- /dev/null +++ b/codenet/public_test_cases/p02752/input.2.txt @@ -0,0 +1,6 @@ +6 +1 6 +2 1 +5 2 +3 4 +2 3 diff --git a/codenet/public_test_cases/p02752/input.3.txt b/codenet/public_test_cases/p02752/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc6323c06e23a08fabbd590a15bc78c1c06c9daa --- /dev/null +++ b/codenet/public_test_cases/p02752/input.3.txt @@ -0,0 +1,19 @@ +19 +2 4 +15 8 +1 16 +1 3 +12 19 +1 18 +7 11 +11 15 +12 9 +1 6 +7 14 +18 2 +13 12 +13 5 +16 13 +7 1 +11 10 +7 17 diff --git a/codenet/public_test_cases/p02752/input.4.txt b/codenet/public_test_cases/p02752/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p02752/input.4.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02752/output.0.txt b/codenet/public_test_cases/p02752/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02752/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02752/output.1.txt b/codenet/public_test_cases/p02752/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p02752/output.1.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p02752/output.2.txt b/codenet/public_test_cases/p02752/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02752/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02752/output.3.txt b/codenet/public_test_cases/p02752/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1162c24267271e43213a66302f58db4e06380982 --- /dev/null +++ b/codenet/public_test_cases/p02752/output.3.txt @@ -0,0 +1 @@ +78732 diff --git a/codenet/public_test_cases/p02752/output.4.txt b/codenet/public_test_cases/p02752/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02752/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02753/input.0.txt b/codenet/public_test_cases/p02753/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56fdc2f87dc927a3d921c0da7baeb30cc01a4b55 --- /dev/null +++ b/codenet/public_test_cases/p02753/input.0.txt @@ -0,0 +1 @@ +ABA diff --git a/codenet/public_test_cases/p02753/input.1.txt b/codenet/public_test_cases/p02753/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..56fdc2f87dc927a3d921c0da7baeb30cc01a4b55 --- /dev/null +++ b/codenet/public_test_cases/p02753/input.1.txt @@ -0,0 +1 @@ +ABA diff --git a/codenet/public_test_cases/p02753/input.2.txt b/codenet/public_test_cases/p02753/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dd27df9288c13083eb2be5c9f3aa23441ebd4c0 --- /dev/null +++ b/codenet/public_test_cases/p02753/input.2.txt @@ -0,0 +1 @@ +BBA diff --git a/codenet/public_test_cases/p02753/input.3.txt b/codenet/public_test_cases/p02753/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba629238ca89489f2b350e196ca445e09d8bb834 --- /dev/null +++ b/codenet/public_test_cases/p02753/input.3.txt @@ -0,0 +1 @@ +BBB diff --git a/codenet/public_test_cases/p02753/output.0.txt b/codenet/public_test_cases/p02753/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02753/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02753/output.1.txt b/codenet/public_test_cases/p02753/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02753/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02753/output.2.txt b/codenet/public_test_cases/p02753/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02753/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02753/output.3.txt b/codenet/public_test_cases/p02753/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02753/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02754/input.0.txt b/codenet/public_test_cases/p02754/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca44bedcbcf79abadfc45995e5a827f672f04704 --- /dev/null +++ b/codenet/public_test_cases/p02754/input.0.txt @@ -0,0 +1 @@ +8 3 4 diff --git a/codenet/public_test_cases/p02754/input.1.txt b/codenet/public_test_cases/p02754/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce33f508ca9e4bfa46dc63479c17bd8011690236 --- /dev/null +++ b/codenet/public_test_cases/p02754/input.1.txt @@ -0,0 +1 @@ +8 0 4 diff --git a/codenet/public_test_cases/p02754/input.2.txt b/codenet/public_test_cases/p02754/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca44bedcbcf79abadfc45995e5a827f672f04704 --- /dev/null +++ b/codenet/public_test_cases/p02754/input.2.txt @@ -0,0 +1 @@ +8 3 4 diff --git a/codenet/public_test_cases/p02754/input.3.txt b/codenet/public_test_cases/p02754/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2602c8fd130acb24f62a5546d5d92c094ea93879 --- /dev/null +++ b/codenet/public_test_cases/p02754/input.3.txt @@ -0,0 +1 @@ +6 2 4 diff --git a/codenet/public_test_cases/p02754/output.0.txt b/codenet/public_test_cases/p02754/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02754/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02754/output.1.txt b/codenet/public_test_cases/p02754/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02754/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02754/output.2.txt b/codenet/public_test_cases/p02754/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02754/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02754/output.3.txt b/codenet/public_test_cases/p02754/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02754/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02755/input.0.txt b/codenet/public_test_cases/p02755/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p02755/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p02755/input.1.txt b/codenet/public_test_cases/p02755/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..245ffd7a13911032a727b1f47443eabb97c4a7e7 --- /dev/null +++ b/codenet/public_test_cases/p02755/input.1.txt @@ -0,0 +1 @@ +19 99 diff --git a/codenet/public_test_cases/p02755/input.2.txt b/codenet/public_test_cases/p02755/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p02755/input.2.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p02755/input.3.txt b/codenet/public_test_cases/p02755/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3933c1f854201be886d45544b1716c9fba0c69a0 --- /dev/null +++ b/codenet/public_test_cases/p02755/input.3.txt @@ -0,0 +1 @@ +8 10 diff --git a/codenet/public_test_cases/p02755/output.0.txt b/codenet/public_test_cases/p02755/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02755/output.0.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02755/output.1.txt b/codenet/public_test_cases/p02755/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02755/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02755/output.2.txt b/codenet/public_test_cases/p02755/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02755/output.2.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02755/output.3.txt b/codenet/public_test_cases/p02755/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02755/output.3.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02756/input.0.txt b/codenet/public_test_cases/p02756/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfcb764596e0502b1b3c0aa785c74d77c66aaa19 --- /dev/null +++ b/codenet/public_test_cases/p02756/input.0.txt @@ -0,0 +1,6 @@ +a +4 +2 1 p +1 +2 2 c +1 diff --git a/codenet/public_test_cases/p02756/input.1.txt b/codenet/public_test_cases/p02756/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f393c2c426d261efe717ea63e8b718062088d3c7 --- /dev/null +++ b/codenet/public_test_cases/p02756/input.1.txt @@ -0,0 +1,3 @@ +y +1 +2 1 x diff --git a/codenet/public_test_cases/p02756/input.2.txt b/codenet/public_test_cases/p02756/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfcb764596e0502b1b3c0aa785c74d77c66aaa19 --- /dev/null +++ b/codenet/public_test_cases/p02756/input.2.txt @@ -0,0 +1,6 @@ +a +4 +2 1 p +1 +2 2 c +1 diff --git a/codenet/public_test_cases/p02756/input.3.txt b/codenet/public_test_cases/p02756/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0627fdc9e962a4267d78d4c8ddf52123e53ecdc --- /dev/null +++ b/codenet/public_test_cases/p02756/input.3.txt @@ -0,0 +1,8 @@ +a +6 +2 2 a +2 1 b +1 +2 2 c +1 +1 diff --git a/codenet/public_test_cases/p02756/output.0.txt b/codenet/public_test_cases/p02756/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bff21a7f27faa64ea1c3a876570458ae4646a313 --- /dev/null +++ b/codenet/public_test_cases/p02756/output.0.txt @@ -0,0 +1 @@ +cpa diff --git a/codenet/public_test_cases/p02756/output.1.txt b/codenet/public_test_cases/p02756/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5aad9376af82d7b98a34f95fb0f298a162f52656 --- /dev/null +++ b/codenet/public_test_cases/p02756/output.1.txt @@ -0,0 +1 @@ +xy diff --git a/codenet/public_test_cases/p02756/output.2.txt b/codenet/public_test_cases/p02756/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bff21a7f27faa64ea1c3a876570458ae4646a313 --- /dev/null +++ b/codenet/public_test_cases/p02756/output.2.txt @@ -0,0 +1 @@ +cpa diff --git a/codenet/public_test_cases/p02756/output.3.txt b/codenet/public_test_cases/p02756/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ba25c859c2d56b79d7e889c886c7f0106878935 --- /dev/null +++ b/codenet/public_test_cases/p02756/output.3.txt @@ -0,0 +1 @@ +aabc diff --git a/codenet/public_test_cases/p02757/input.0.txt b/codenet/public_test_cases/p02757/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c65d18b3bb22b9188c3f921c84379154be751486 --- /dev/null +++ b/codenet/public_test_cases/p02757/input.0.txt @@ -0,0 +1,2 @@ +4 3 +3543 diff --git a/codenet/public_test_cases/p02757/input.1.txt b/codenet/public_test_cases/p02757/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c65d18b3bb22b9188c3f921c84379154be751486 --- /dev/null +++ b/codenet/public_test_cases/p02757/input.1.txt @@ -0,0 +1,2 @@ +4 3 +3543 diff --git a/codenet/public_test_cases/p02757/input.2.txt b/codenet/public_test_cases/p02757/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b69061fc625028146e1d6c41590461c642457e2d --- /dev/null +++ b/codenet/public_test_cases/p02757/input.2.txt @@ -0,0 +1,2 @@ +20 11 +33883322005544116655 diff --git a/codenet/public_test_cases/p02757/input.3.txt b/codenet/public_test_cases/p02757/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..69ea1beabbf621c03d51cbb0dd8c17c728d095ec --- /dev/null +++ b/codenet/public_test_cases/p02757/input.3.txt @@ -0,0 +1,2 @@ +4 2 +2020 diff --git a/codenet/public_test_cases/p02757/output.0.txt b/codenet/public_test_cases/p02757/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02757/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02757/output.1.txt b/codenet/public_test_cases/p02757/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02757/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02757/output.2.txt b/codenet/public_test_cases/p02757/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..38b10c1b2badd802b554ecc944a7a40c5f055d47 --- /dev/null +++ b/codenet/public_test_cases/p02757/output.2.txt @@ -0,0 +1 @@ +68 diff --git a/codenet/public_test_cases/p02757/output.3.txt b/codenet/public_test_cases/p02757/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02757/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02758/input.0.txt b/codenet/public_test_cases/p02758/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eeba8bf046b9c05163de35fce269c7a3a4816e7 --- /dev/null +++ b/codenet/public_test_cases/p02758/input.0.txt @@ -0,0 +1,3 @@ +2 +1 5 +3 3 diff --git a/codenet/public_test_cases/p02758/input.1.txt b/codenet/public_test_cases/p02758/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eeba8bf046b9c05163de35fce269c7a3a4816e7 --- /dev/null +++ b/codenet/public_test_cases/p02758/input.1.txt @@ -0,0 +1,3 @@ +2 +1 5 +3 3 diff --git a/codenet/public_test_cases/p02758/input.2.txt b/codenet/public_test_cases/p02758/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..35dfb513916885c47dfb3d2ea4ffaa6c4419ef4d --- /dev/null +++ b/codenet/public_test_cases/p02758/input.2.txt @@ -0,0 +1,4 @@ +3 +6 5 +-1 10 +3 3 diff --git a/codenet/public_test_cases/p02758/input.3.txt b/codenet/public_test_cases/p02758/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..806ca88e05949888f2798a9fa682a5d35659b1d1 --- /dev/null +++ b/codenet/public_test_cases/p02758/input.3.txt @@ -0,0 +1,21 @@ +20 +-8 1 +26 4 +0 5 +9 1 +19 4 +22 20 +28 27 +11 8 +-3 20 +-25 17 +10 4 +-18 27 +24 28 +-11 19 +2 27 +-2 18 +-1 12 +-24 29 +31 29 +29 7 diff --git a/codenet/public_test_cases/p02758/input.4.txt b/codenet/public_test_cases/p02758/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c7d763d27895cbfa2668c62df689f7bd612a860 --- /dev/null +++ b/codenet/public_test_cases/p02758/input.4.txt @@ -0,0 +1,5 @@ +4 +7 10 +-10 3 +4 3 +-4 3 diff --git a/codenet/public_test_cases/p02758/output.0.txt b/codenet/public_test_cases/p02758/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02758/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02758/output.1.txt b/codenet/public_test_cases/p02758/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02758/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02758/output.2.txt b/codenet/public_test_cases/p02758/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02758/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02758/output.3.txt b/codenet/public_test_cases/p02758/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p02758/output.3.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p02758/output.4.txt b/codenet/public_test_cases/p02758/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p02758/output.4.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p02759/input.0.txt b/codenet/public_test_cases/p02759/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02759/input.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02759/input.1.txt b/codenet/public_test_cases/p02759/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02759/input.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02759/input.2.txt b/codenet/public_test_cases/p02759/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02759/input.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02759/input.3.txt b/codenet/public_test_cases/p02759/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02759/input.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02759/output.0.txt b/codenet/public_test_cases/p02759/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02759/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02759/output.1.txt b/codenet/public_test_cases/p02759/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02759/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02759/output.2.txt b/codenet/public_test_cases/p02759/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p02759/output.2.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p02759/output.3.txt b/codenet/public_test_cases/p02759/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02759/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02760/input.0.txt b/codenet/public_test_cases/p02760/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21de50a889eec85e28e6298d8dbf0ce23718acea --- /dev/null +++ b/codenet/public_test_cases/p02760/input.0.txt @@ -0,0 +1,11 @@ +84 97 66 +79 89 11 +61 59 7 +7 +89 +7 +87 +79 +24 +84 +30 diff --git a/codenet/public_test_cases/p02760/input.1.txt b/codenet/public_test_cases/p02760/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9e20fcaf8016a0b47720ec57391c1e89bef3ace --- /dev/null +++ b/codenet/public_test_cases/p02760/input.1.txt @@ -0,0 +1,14 @@ +60 88 34 +92 41 43 +65 73 48 +10 +60 +43 +88 +11 +48 +73 +65 +41 +92 +34 diff --git a/codenet/public_test_cases/p02760/input.2.txt b/codenet/public_test_cases/p02760/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..21de50a889eec85e28e6298d8dbf0ce23718acea --- /dev/null +++ b/codenet/public_test_cases/p02760/input.2.txt @@ -0,0 +1,11 @@ +84 97 66 +79 89 11 +61 59 7 +7 +89 +7 +87 +79 +24 +84 +30 diff --git a/codenet/public_test_cases/p02760/input.3.txt b/codenet/public_test_cases/p02760/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fa25526d73a7dd7c50cb2004412944c13f4c2e3 --- /dev/null +++ b/codenet/public_test_cases/p02760/input.3.txt @@ -0,0 +1,9 @@ +41 7 46 +26 89 2 +78 92 8 +5 +6 +45 +16 +57 +17 diff --git a/codenet/public_test_cases/p02760/output.0.txt b/codenet/public_test_cases/p02760/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02760/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02760/output.1.txt b/codenet/public_test_cases/p02760/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02760/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02760/output.2.txt b/codenet/public_test_cases/p02760/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02760/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02760/output.3.txt b/codenet/public_test_cases/p02760/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02760/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02761/input.0.txt b/codenet/public_test_cases/p02761/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bcb24b622ecabf74196c44c9d3930961918fde8 --- /dev/null +++ b/codenet/public_test_cases/p02761/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 7 +3 2 +1 7 diff --git a/codenet/public_test_cases/p02761/input.1.txt b/codenet/public_test_cases/p02761/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..92ec9d57ad1f64e311514ff11a21b48c7b9b1d4d --- /dev/null +++ b/codenet/public_test_cases/p02761/input.1.txt @@ -0,0 +1,2 @@ +3 1 +1 0 diff --git a/codenet/public_test_cases/p02761/input.2.txt b/codenet/public_test_cases/p02761/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bcb24b622ecabf74196c44c9d3930961918fde8 --- /dev/null +++ b/codenet/public_test_cases/p02761/input.2.txt @@ -0,0 +1,4 @@ +3 3 +1 7 +3 2 +1 7 diff --git a/codenet/public_test_cases/p02761/input.3.txt b/codenet/public_test_cases/p02761/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..445bb015cea0ebf931dbd9eb551e2668ae67c1ba --- /dev/null +++ b/codenet/public_test_cases/p02761/input.3.txt @@ -0,0 +1,3 @@ +3 2 +2 1 +2 3 diff --git a/codenet/public_test_cases/p02761/output.0.txt b/codenet/public_test_cases/p02761/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88eafce37832a1e00f7fd24cc04e75b7afa4123a --- /dev/null +++ b/codenet/public_test_cases/p02761/output.0.txt @@ -0,0 +1 @@ +702 diff --git a/codenet/public_test_cases/p02761/output.1.txt b/codenet/public_test_cases/p02761/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02761/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02761/output.2.txt b/codenet/public_test_cases/p02761/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..88eafce37832a1e00f7fd24cc04e75b7afa4123a --- /dev/null +++ b/codenet/public_test_cases/p02761/output.2.txt @@ -0,0 +1 @@ +702 diff --git a/codenet/public_test_cases/p02761/output.3.txt b/codenet/public_test_cases/p02761/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02761/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02762/input.0.txt b/codenet/public_test_cases/p02762/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a798d38a622f47a7cfdbd9a8db23320ded6b2c7 --- /dev/null +++ b/codenet/public_test_cases/p02762/input.0.txt @@ -0,0 +1,6 @@ +4 4 1 +2 1 +1 3 +3 2 +3 4 +4 1 diff --git a/codenet/public_test_cases/p02762/input.1.txt b/codenet/public_test_cases/p02762/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a798d38a622f47a7cfdbd9a8db23320ded6b2c7 --- /dev/null +++ b/codenet/public_test_cases/p02762/input.1.txt @@ -0,0 +1,6 @@ +4 4 1 +2 1 +1 3 +3 2 +3 4 +4 1 diff --git a/codenet/public_test_cases/p02762/input.2.txt b/codenet/public_test_cases/p02762/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..935411af7594b07d59ec9a864830d384dcc1ea84 --- /dev/null +++ b/codenet/public_test_cases/p02762/input.2.txt @@ -0,0 +1,11 @@ +5 10 0 +1 2 +1 3 +1 4 +1 5 +3 2 +2 4 +2 5 +4 3 +5 3 +4 5 diff --git a/codenet/public_test_cases/p02762/input.3.txt b/codenet/public_test_cases/p02762/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9364f949d858d485de413733124a9f1458777059 --- /dev/null +++ b/codenet/public_test_cases/p02762/input.3.txt @@ -0,0 +1,13 @@ +10 9 3 +10 1 +6 7 +8 2 +2 5 +8 4 +7 3 +10 9 +6 4 +5 8 +2 6 +7 5 +3 1 diff --git a/codenet/public_test_cases/p02762/output.0.txt b/codenet/public_test_cases/p02762/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a358e134856474d31a359fd309f11a64f24d9fdd --- /dev/null +++ b/codenet/public_test_cases/p02762/output.0.txt @@ -0,0 +1 @@ +0 1 0 1 diff --git a/codenet/public_test_cases/p02762/output.1.txt b/codenet/public_test_cases/p02762/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a358e134856474d31a359fd309f11a64f24d9fdd --- /dev/null +++ b/codenet/public_test_cases/p02762/output.1.txt @@ -0,0 +1 @@ +0 1 0 1 diff --git a/codenet/public_test_cases/p02762/output.2.txt b/codenet/public_test_cases/p02762/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..88b14b24dad3c4eeacd577e1317468b16718ae5d --- /dev/null +++ b/codenet/public_test_cases/p02762/output.2.txt @@ -0,0 +1 @@ +0 0 0 0 0 diff --git a/codenet/public_test_cases/p02762/output.3.txt b/codenet/public_test_cases/p02762/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fb94e7bb021876c4ab55cd7741d4d3eb031d46a --- /dev/null +++ b/codenet/public_test_cases/p02762/output.3.txt @@ -0,0 +1 @@ +1 3 5 4 3 3 3 3 1 0 diff --git a/codenet/public_test_cases/p02763/input.0.txt b/codenet/public_test_cases/p02763/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfea789652f09220a9f665b34a62aae8ed09a9a8 --- /dev/null +++ b/codenet/public_test_cases/p02763/input.0.txt @@ -0,0 +1,9 @@ +7 +abcdbbd +6 +2 3 6 +1 5 z +2 1 1 +1 4 a +1 7 d +2 1 7 diff --git a/codenet/public_test_cases/p02763/input.1.txt b/codenet/public_test_cases/p02763/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfea789652f09220a9f665b34a62aae8ed09a9a8 --- /dev/null +++ b/codenet/public_test_cases/p02763/input.1.txt @@ -0,0 +1,9 @@ +7 +abcdbbd +6 +2 3 6 +1 5 z +2 1 1 +1 4 a +1 7 d +2 1 7 diff --git a/codenet/public_test_cases/p02763/output.0.txt b/codenet/public_test_cases/p02763/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59535778f1f47f4f49244ea775282f12cd3132fc --- /dev/null +++ b/codenet/public_test_cases/p02763/output.0.txt @@ -0,0 +1,3 @@ +3 +1 +5 diff --git a/codenet/public_test_cases/p02763/output.1.txt b/codenet/public_test_cases/p02763/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59535778f1f47f4f49244ea775282f12cd3132fc --- /dev/null +++ b/codenet/public_test_cases/p02763/output.1.txt @@ -0,0 +1,3 @@ +3 +1 +5 diff --git a/codenet/public_test_cases/p02764/input.0.txt b/codenet/public_test_cases/p02764/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c818a58236f68d1c65fa5498e00dd621ca8ea1f --- /dev/null +++ b/codenet/public_test_cases/p02764/input.0.txt @@ -0,0 +1,5 @@ +4 3 +-1 0 3 +0 0 3 +1 0 2 +1 1 40 diff --git a/codenet/public_test_cases/p02764/input.1.txt b/codenet/public_test_cases/p02764/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..77e1e534bcd50e70215560c91e5562cd36c267b4 --- /dev/null +++ b/codenet/public_test_cases/p02764/input.1.txt @@ -0,0 +1,11 @@ +10 5 +-879 981 26 +890 -406 81 +512 859 97 +362 -955 25 +128 553 17 +-885 763 2 +449 310 57 +-656 -204 11 +-270 76 40 +184 170 16 diff --git a/codenet/public_test_cases/p02764/input.2.txt b/codenet/public_test_cases/p02764/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c818a58236f68d1c65fa5498e00dd621ca8ea1f --- /dev/null +++ b/codenet/public_test_cases/p02764/input.2.txt @@ -0,0 +1,5 @@ +4 3 +-1 0 3 +0 0 3 +1 0 2 +1 1 40 diff --git a/codenet/public_test_cases/p02764/output.0.txt b/codenet/public_test_cases/p02764/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b4950e3de2f6c99801a4f5e2ffa01669f358572 --- /dev/null +++ b/codenet/public_test_cases/p02764/output.0.txt @@ -0,0 +1 @@ +2.4 diff --git a/codenet/public_test_cases/p02764/output.1.txt b/codenet/public_test_cases/p02764/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e13916cb6a9a91a0e42d9e68eb0a965dc2e9ca8 --- /dev/null +++ b/codenet/public_test_cases/p02764/output.1.txt @@ -0,0 +1 @@ +7411.2252 diff --git a/codenet/public_test_cases/p02764/output.2.txt b/codenet/public_test_cases/p02764/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b4950e3de2f6c99801a4f5e2ffa01669f358572 --- /dev/null +++ b/codenet/public_test_cases/p02764/output.2.txt @@ -0,0 +1 @@ +2.4 diff --git a/codenet/public_test_cases/p02765/input.0.txt b/codenet/public_test_cases/p02765/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11c54ad70f6b3af5c67200dfd34bcd8fe8f5c920 --- /dev/null +++ b/codenet/public_test_cases/p02765/input.0.txt @@ -0,0 +1 @@ +2 2919 diff --git a/codenet/public_test_cases/p02765/input.1.txt b/codenet/public_test_cases/p02765/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11c54ad70f6b3af5c67200dfd34bcd8fe8f5c920 --- /dev/null +++ b/codenet/public_test_cases/p02765/input.1.txt @@ -0,0 +1 @@ +2 2919 diff --git a/codenet/public_test_cases/p02765/input.2.txt b/codenet/public_test_cases/p02765/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8b5cd18a21d05a8dbd77ef20aa9bc3fdc50d434 --- /dev/null +++ b/codenet/public_test_cases/p02765/input.2.txt @@ -0,0 +1 @@ +22 3051 diff --git a/codenet/public_test_cases/p02765/output.0.txt b/codenet/public_test_cases/p02765/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea64d45ce681f9121aba2cba22b59be8a881e4aa --- /dev/null +++ b/codenet/public_test_cases/p02765/output.0.txt @@ -0,0 +1 @@ +3719 diff --git a/codenet/public_test_cases/p02765/output.1.txt b/codenet/public_test_cases/p02765/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea64d45ce681f9121aba2cba22b59be8a881e4aa --- /dev/null +++ b/codenet/public_test_cases/p02765/output.1.txt @@ -0,0 +1 @@ +3719 diff --git a/codenet/public_test_cases/p02765/output.2.txt b/codenet/public_test_cases/p02765/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..08022a4c714b289e9f11bb709b57ee6433cb9ff9 --- /dev/null +++ b/codenet/public_test_cases/p02765/output.2.txt @@ -0,0 +1 @@ +3051 diff --git a/codenet/public_test_cases/p02766/input.0.txt b/codenet/public_test_cases/p02766/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b942b8669a31d714e4370a8a3ea04f293d52e06 --- /dev/null +++ b/codenet/public_test_cases/p02766/input.0.txt @@ -0,0 +1 @@ +11 2 diff --git a/codenet/public_test_cases/p02766/input.1.txt b/codenet/public_test_cases/p02766/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b942b8669a31d714e4370a8a3ea04f293d52e06 --- /dev/null +++ b/codenet/public_test_cases/p02766/input.1.txt @@ -0,0 +1 @@ +11 2 diff --git a/codenet/public_test_cases/p02766/input.2.txt b/codenet/public_test_cases/p02766/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa6aaafbdcdf337e3cc90b032ba85060eab66f9c --- /dev/null +++ b/codenet/public_test_cases/p02766/input.2.txt @@ -0,0 +1 @@ +314159265 3 diff --git a/codenet/public_test_cases/p02766/input.3.txt b/codenet/public_test_cases/p02766/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dee66dc380de581fcf704a6757e0da9a29d10eb9 --- /dev/null +++ b/codenet/public_test_cases/p02766/input.3.txt @@ -0,0 +1 @@ +1010101 10 diff --git a/codenet/public_test_cases/p02766/output.0.txt b/codenet/public_test_cases/p02766/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02766/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02766/output.1.txt b/codenet/public_test_cases/p02766/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02766/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02766/output.2.txt b/codenet/public_test_cases/p02766/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p02766/output.2.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p02766/output.3.txt b/codenet/public_test_cases/p02766/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02766/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02767/input.0.txt b/codenet/public_test_cases/p02767/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..44a7e9578101ef768b0bde87ca56ddb4228b8bbf --- /dev/null +++ b/codenet/public_test_cases/p02767/input.0.txt @@ -0,0 +1,2 @@ +2 +1 4 diff --git a/codenet/public_test_cases/p02767/input.1.txt b/codenet/public_test_cases/p02767/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ba1707fbbfc940601412180b3d9d1d8a232b91b --- /dev/null +++ b/codenet/public_test_cases/p02767/input.1.txt @@ -0,0 +1,2 @@ +7 +14 14 2 13 56 2 37 diff --git a/codenet/public_test_cases/p02767/input.2.txt b/codenet/public_test_cases/p02767/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..44a7e9578101ef768b0bde87ca56ddb4228b8bbf --- /dev/null +++ b/codenet/public_test_cases/p02767/input.2.txt @@ -0,0 +1,2 @@ +2 +1 4 diff --git a/codenet/public_test_cases/p02767/output.0.txt b/codenet/public_test_cases/p02767/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02767/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02767/output.1.txt b/codenet/public_test_cases/p02767/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf97139540b7d7a91dc58b9d54e1fc77110b6e2a --- /dev/null +++ b/codenet/public_test_cases/p02767/output.1.txt @@ -0,0 +1 @@ +2354 diff --git a/codenet/public_test_cases/p02767/output.2.txt b/codenet/public_test_cases/p02767/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02767/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02768/input.0.txt b/codenet/public_test_cases/p02768/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6572bad30d7e88a32d9dabe7a74b0da42da8bed8 --- /dev/null +++ b/codenet/public_test_cases/p02768/input.0.txt @@ -0,0 +1 @@ +4 1 3 diff --git a/codenet/public_test_cases/p02768/input.1.txt b/codenet/public_test_cases/p02768/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6572bad30d7e88a32d9dabe7a74b0da42da8bed8 --- /dev/null +++ b/codenet/public_test_cases/p02768/input.1.txt @@ -0,0 +1 @@ +4 1 3 diff --git a/codenet/public_test_cases/p02768/input.2.txt b/codenet/public_test_cases/p02768/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffb8fd8a87afc583070d3fb3110a802e5cfcfc6e --- /dev/null +++ b/codenet/public_test_cases/p02768/input.2.txt @@ -0,0 +1 @@ +1000000000 141421 173205 diff --git a/codenet/public_test_cases/p02768/output.0.txt b/codenet/public_test_cases/p02768/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02768/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02768/output.1.txt b/codenet/public_test_cases/p02768/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02768/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02768/output.2.txt b/codenet/public_test_cases/p02768/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a980a0cc68a5647ece3ac9f42f09c12c096b9996 --- /dev/null +++ b/codenet/public_test_cases/p02768/output.2.txt @@ -0,0 +1 @@ +34076506 diff --git a/codenet/public_test_cases/p02769/input.0.txt b/codenet/public_test_cases/p02769/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02769/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02769/input.1.txt b/codenet/public_test_cases/p02769/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02769/input.1.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02769/input.2.txt b/codenet/public_test_cases/p02769/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..945e3f6c8dea4b8c995eadcd36c085102eaf8dd4 --- /dev/null +++ b/codenet/public_test_cases/p02769/input.2.txt @@ -0,0 +1 @@ +200000 1000000000 diff --git a/codenet/public_test_cases/p02769/input.3.txt b/codenet/public_test_cases/p02769/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea54b0e834cc909585de8b28ec4cb9ec6093390f --- /dev/null +++ b/codenet/public_test_cases/p02769/input.3.txt @@ -0,0 +1 @@ +15 6 diff --git a/codenet/public_test_cases/p02769/output.0.txt b/codenet/public_test_cases/p02769/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02769/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02769/output.1.txt b/codenet/public_test_cases/p02769/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02769/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02769/output.2.txt b/codenet/public_test_cases/p02769/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3fffdde6cdb9f3d91c1cc9eb225ecdf20baffaa --- /dev/null +++ b/codenet/public_test_cases/p02769/output.2.txt @@ -0,0 +1 @@ +607923868 diff --git a/codenet/public_test_cases/p02769/output.3.txt b/codenet/public_test_cases/p02769/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5b5f579c6b97b8cef643e6e4f9a453a06be4922 --- /dev/null +++ b/codenet/public_test_cases/p02769/output.3.txt @@ -0,0 +1 @@ +22583772 diff --git a/codenet/public_test_cases/p02770/input.0.txt b/codenet/public_test_cases/p02770/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c473699b33a9f077a34f481f260c3203ebe9e57f --- /dev/null +++ b/codenet/public_test_cases/p02770/input.0.txt @@ -0,0 +1,3 @@ +3 1 +3 1 4 +5 3 2 diff --git a/codenet/public_test_cases/p02770/input.1.txt b/codenet/public_test_cases/p02770/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c473699b33a9f077a34f481f260c3203ebe9e57f --- /dev/null +++ b/codenet/public_test_cases/p02770/input.1.txt @@ -0,0 +1,3 @@ +3 1 +3 1 4 +5 3 2 diff --git a/codenet/public_test_cases/p02770/input.2.txt b/codenet/public_test_cases/p02770/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..848fca6a5184903bc193e80a15b063f9fef6cc7d --- /dev/null +++ b/codenet/public_test_cases/p02770/input.2.txt @@ -0,0 +1,5 @@ +7 3 +27 18 28 18 28 46 1000000000 +1000000000 1 7 +1000000000 2 10 +1000000000 3 12 diff --git a/codenet/public_test_cases/p02770/output.0.txt b/codenet/public_test_cases/p02770/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02770/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02770/output.1.txt b/codenet/public_test_cases/p02770/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02770/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02770/output.2.txt b/codenet/public_test_cases/p02770/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..787e164ed94e94217018d697379afefdf11e3ef3 --- /dev/null +++ b/codenet/public_test_cases/p02770/output.2.txt @@ -0,0 +1,3 @@ +224489796 +214285714 +559523809 diff --git a/codenet/public_test_cases/p02771/input.0.txt b/codenet/public_test_cases/p02771/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f1497a8f8479aa395017cb862f6aecb9445987e --- /dev/null +++ b/codenet/public_test_cases/p02771/input.0.txt @@ -0,0 +1 @@ +5 7 5 diff --git a/codenet/public_test_cases/p02771/input.1.txt b/codenet/public_test_cases/p02771/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..96324aad0afe402debc0da12f72e3d34a9b6c6ee --- /dev/null +++ b/codenet/public_test_cases/p02771/input.1.txt @@ -0,0 +1 @@ +3 3 4 diff --git a/codenet/public_test_cases/p02771/input.2.txt b/codenet/public_test_cases/p02771/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..57a0944dcc9a59621a706de6494752511ce111a6 --- /dev/null +++ b/codenet/public_test_cases/p02771/input.2.txt @@ -0,0 +1 @@ +4 4 4 diff --git a/codenet/public_test_cases/p02771/input.3.txt b/codenet/public_test_cases/p02771/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f1497a8f8479aa395017cb862f6aecb9445987e --- /dev/null +++ b/codenet/public_test_cases/p02771/input.3.txt @@ -0,0 +1 @@ +5 7 5 diff --git a/codenet/public_test_cases/p02771/input.4.txt b/codenet/public_test_cases/p02771/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e41870191cfb6607f2cd71911ce46d4f4e1b72e --- /dev/null +++ b/codenet/public_test_cases/p02771/input.4.txt @@ -0,0 +1 @@ +4 9 6 diff --git a/codenet/public_test_cases/p02771/output.0.txt b/codenet/public_test_cases/p02771/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02771/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02771/output.1.txt b/codenet/public_test_cases/p02771/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02771/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02771/output.2.txt b/codenet/public_test_cases/p02771/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02771/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02771/output.3.txt b/codenet/public_test_cases/p02771/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02771/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02771/output.4.txt b/codenet/public_test_cases/p02771/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02771/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02772/input.0.txt b/codenet/public_test_cases/p02772/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85afb59e747d7a23573dd404955417b64dcc24c9 --- /dev/null +++ b/codenet/public_test_cases/p02772/input.0.txt @@ -0,0 +1,2 @@ +5 +6 7 9 10 31 diff --git a/codenet/public_test_cases/p02772/input.1.txt b/codenet/public_test_cases/p02772/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85afb59e747d7a23573dd404955417b64dcc24c9 --- /dev/null +++ b/codenet/public_test_cases/p02772/input.1.txt @@ -0,0 +1,2 @@ +5 +6 7 9 10 31 diff --git a/codenet/public_test_cases/p02772/input.2.txt b/codenet/public_test_cases/p02772/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfd4596de8369996eb15812642820e7e294d346e --- /dev/null +++ b/codenet/public_test_cases/p02772/input.2.txt @@ -0,0 +1,2 @@ +3 +28 27 24 diff --git a/codenet/public_test_cases/p02772/output.0.txt b/codenet/public_test_cases/p02772/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a965b823936cf1dce0f422702396320e0a103b53 --- /dev/null +++ b/codenet/public_test_cases/p02772/output.0.txt @@ -0,0 +1 @@ +APPROVED diff --git a/codenet/public_test_cases/p02772/output.1.txt b/codenet/public_test_cases/p02772/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a965b823936cf1dce0f422702396320e0a103b53 --- /dev/null +++ b/codenet/public_test_cases/p02772/output.1.txt @@ -0,0 +1 @@ +APPROVED diff --git a/codenet/public_test_cases/p02772/output.2.txt b/codenet/public_test_cases/p02772/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb4c4e7c6170c3aca021a1010a2982fa89e5b7a1 --- /dev/null +++ b/codenet/public_test_cases/p02772/output.2.txt @@ -0,0 +1 @@ +DENIED diff --git a/codenet/public_test_cases/p02773/input.0.txt b/codenet/public_test_cases/p02773/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9addedad575c63f5a4c1d14a0d96c8b82950ffdd --- /dev/null +++ b/codenet/public_test_cases/p02773/input.0.txt @@ -0,0 +1,8 @@ +7 +beat +vet +beet +bed +vet +bet +beet diff --git a/codenet/public_test_cases/p02773/input.1.txt b/codenet/public_test_cases/p02773/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8278af1692489c584cdc15e3c7e8c748c9c8e21c --- /dev/null +++ b/codenet/public_test_cases/p02773/input.1.txt @@ -0,0 +1,9 @@ +8 +buffalo +buffalo +buffalo +buffalo +buffalo +buffalo +buffalo +buffalo diff --git a/codenet/public_test_cases/p02773/input.2.txt b/codenet/public_test_cases/p02773/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9addedad575c63f5a4c1d14a0d96c8b82950ffdd --- /dev/null +++ b/codenet/public_test_cases/p02773/input.2.txt @@ -0,0 +1,8 @@ +7 +beat +vet +beet +bed +vet +bet +beet diff --git a/codenet/public_test_cases/p02773/input.3.txt b/codenet/public_test_cases/p02773/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2418405b65183c0b3c40d06b5327e44ba411d773 --- /dev/null +++ b/codenet/public_test_cases/p02773/input.3.txt @@ -0,0 +1,8 @@ +7 +bass +bass +kick +kick +bass +kick +kick diff --git a/codenet/public_test_cases/p02773/input.4.txt b/codenet/public_test_cases/p02773/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..906542499df980fb956e210e7e87dcd50542a302 --- /dev/null +++ b/codenet/public_test_cases/p02773/input.4.txt @@ -0,0 +1,5 @@ +4 +ushi +tapu +nichia +kun diff --git a/codenet/public_test_cases/p02773/output.0.txt b/codenet/public_test_cases/p02773/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45135ef521163198564932f11550ef7bd42559c8 --- /dev/null +++ b/codenet/public_test_cases/p02773/output.0.txt @@ -0,0 +1,2 @@ +beet +vet diff --git a/codenet/public_test_cases/p02773/output.1.txt b/codenet/public_test_cases/p02773/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb8b96a05ba09bbc423e7425be37e972db9e89b1 --- /dev/null +++ b/codenet/public_test_cases/p02773/output.1.txt @@ -0,0 +1 @@ +buffalo diff --git a/codenet/public_test_cases/p02773/output.2.txt b/codenet/public_test_cases/p02773/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45135ef521163198564932f11550ef7bd42559c8 --- /dev/null +++ b/codenet/public_test_cases/p02773/output.2.txt @@ -0,0 +1,2 @@ +beet +vet diff --git a/codenet/public_test_cases/p02773/output.3.txt b/codenet/public_test_cases/p02773/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4062e34e42d8c44daeaa4b9cbd77a1461cf274be --- /dev/null +++ b/codenet/public_test_cases/p02773/output.3.txt @@ -0,0 +1 @@ +kick diff --git a/codenet/public_test_cases/p02773/output.4.txt b/codenet/public_test_cases/p02773/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..74323525278d3a957b1f0c4beab4c1c7c3b22e4f --- /dev/null +++ b/codenet/public_test_cases/p02773/output.4.txt @@ -0,0 +1,4 @@ +kun +nichia +tapu +ushi diff --git a/codenet/public_test_cases/p02774/input.0.txt b/codenet/public_test_cases/p02774/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c84fa2e364961adccdbd47d12af72f06de9aa0be --- /dev/null +++ b/codenet/public_test_cases/p02774/input.0.txt @@ -0,0 +1,2 @@ +4 3 +3 3 -4 -2 diff --git a/codenet/public_test_cases/p02774/input.1.txt b/codenet/public_test_cases/p02774/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78f3aeb51c0d487f0e3900d8f847312a1efdf1a7 --- /dev/null +++ b/codenet/public_test_cases/p02774/input.1.txt @@ -0,0 +1,2 @@ +10 40 +5 4 3 2 -1 0 0 0 0 0 diff --git a/codenet/public_test_cases/p02774/input.2.txt b/codenet/public_test_cases/p02774/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c84fa2e364961adccdbd47d12af72f06de9aa0be --- /dev/null +++ b/codenet/public_test_cases/p02774/input.2.txt @@ -0,0 +1,2 @@ +4 3 +3 3 -4 -2 diff --git a/codenet/public_test_cases/p02774/input.3.txt b/codenet/public_test_cases/p02774/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ea8721fa2ff975036624dff53c42cdda72f49ba --- /dev/null +++ b/codenet/public_test_cases/p02774/input.3.txt @@ -0,0 +1,2 @@ +30 413 +-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0 diff --git a/codenet/public_test_cases/p02774/output.0.txt b/codenet/public_test_cases/p02774/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cfb5efd665ffa9372e6df49fdce0242d0156991 --- /dev/null +++ b/codenet/public_test_cases/p02774/output.0.txt @@ -0,0 +1 @@ +-6 diff --git a/codenet/public_test_cases/p02774/output.1.txt b/codenet/public_test_cases/p02774/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02774/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02774/output.2.txt b/codenet/public_test_cases/p02774/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cfb5efd665ffa9372e6df49fdce0242d0156991 --- /dev/null +++ b/codenet/public_test_cases/p02774/output.2.txt @@ -0,0 +1 @@ +-6 diff --git a/codenet/public_test_cases/p02774/output.3.txt b/codenet/public_test_cases/p02774/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5592d30dfd66ea54600f443e0e37e6f52f41597 --- /dev/null +++ b/codenet/public_test_cases/p02774/output.3.txt @@ -0,0 +1 @@ +448283280358331064 diff --git a/codenet/public_test_cases/p02775/input.0.txt b/codenet/public_test_cases/p02775/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p02775/input.0.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p02775/input.1.txt b/codenet/public_test_cases/p02775/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fe4e495fed81a962c91dde803eb5bbe3aa14261 --- /dev/null +++ b/codenet/public_test_cases/p02775/input.1.txt @@ -0,0 +1 @@ +91 diff --git a/codenet/public_test_cases/p02775/input.2.txt b/codenet/public_test_cases/p02775/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2b32106b8f8c6642be44eba0f7e0c55e8dced2d --- /dev/null +++ b/codenet/public_test_cases/p02775/input.2.txt @@ -0,0 +1 @@ +314159265358979323846264338327950288419716939937551058209749445923078164062862089986280348253421170 diff --git a/codenet/public_test_cases/p02775/input.3.txt b/codenet/public_test_cases/p02775/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p02775/input.3.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p02775/output.0.txt b/codenet/public_test_cases/p02775/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02775/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02775/output.1.txt b/codenet/public_test_cases/p02775/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02775/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02775/output.2.txt b/codenet/public_test_cases/p02775/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..77f83230f66a0fdcfb20aea384553e2910f87712 --- /dev/null +++ b/codenet/public_test_cases/p02775/output.2.txt @@ -0,0 +1 @@ +243 diff --git a/codenet/public_test_cases/p02775/output.3.txt b/codenet/public_test_cases/p02775/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02775/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02776/input.0.txt b/codenet/public_test_cases/p02776/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8172bec7d98b8334189fed494bc3e994ba1c3f74 --- /dev/null +++ b/codenet/public_test_cases/p02776/input.0.txt @@ -0,0 +1,8 @@ +3 4 +5 1 +10 1 +8 0 +1 10 +4 5 +6 7 +8 9 diff --git a/codenet/public_test_cases/p02776/input.1.txt b/codenet/public_test_cases/p02776/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf25c6dd479320b26c0534e76e0446d5ab350514 --- /dev/null +++ b/codenet/public_test_cases/p02776/input.1.txt @@ -0,0 +1,7 @@ +4 2 +2 0 +3 1 +5 1 +7 0 +1 4 +4 7 diff --git a/codenet/public_test_cases/p02776/input.2.txt b/codenet/public_test_cases/p02776/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..233763832db66a238193fdf76bad08f39eb3364f --- /dev/null +++ b/codenet/public_test_cases/p02776/input.2.txt @@ -0,0 +1,6 @@ +3 2 +5 0 +10 0 +8 0 +6 9 +66 99 diff --git a/codenet/public_test_cases/p02776/input.3.txt b/codenet/public_test_cases/p02776/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8172bec7d98b8334189fed494bc3e994ba1c3f74 --- /dev/null +++ b/codenet/public_test_cases/p02776/input.3.txt @@ -0,0 +1,8 @@ +3 4 +5 1 +10 1 +8 0 +1 10 +4 5 +6 7 +8 9 diff --git a/codenet/public_test_cases/p02776/input.4.txt b/codenet/public_test_cases/p02776/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..712d6eae4055d1385763a2d8172da2dc270cb241 --- /dev/null +++ b/codenet/public_test_cases/p02776/input.4.txt @@ -0,0 +1,33 @@ +12 20 +536130100 1 +150049660 1 +79245447 1 +132551741 0 +89484841 1 +328129089 0 +623467741 0 +248785745 0 +421631475 0 +498966877 0 +43768791 1 +112237273 0 +21499042 142460201 +58176487 384985131 +88563042 144788076 +120198276 497115965 +134867387 563350571 +211946499 458996604 +233934566 297258009 +335674184 555985828 +414601661 520203502 +101135608 501051309 +90972258 300372385 +255474956 630621190 +436210625 517850028 +145652401 192476406 +377607297 520655694 +244404406 304034433 +112237273 359737255 +392593015 463983307 +150586788 504362212 +54772353 83124235 diff --git a/codenet/public_test_cases/p02776/output.0.txt b/codenet/public_test_cases/p02776/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..44a7e9578101ef768b0bde87ca56ddb4228b8bbf --- /dev/null +++ b/codenet/public_test_cases/p02776/output.0.txt @@ -0,0 +1,2 @@ +2 +1 4 diff --git a/codenet/public_test_cases/p02776/output.1.txt b/codenet/public_test_cases/p02776/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02776/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02776/output.2.txt b/codenet/public_test_cases/p02776/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02776/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02776/output.3.txt b/codenet/public_test_cases/p02776/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..44a7e9578101ef768b0bde87ca56ddb4228b8bbf --- /dev/null +++ b/codenet/public_test_cases/p02776/output.3.txt @@ -0,0 +1,2 @@ +2 +1 4 diff --git a/codenet/public_test_cases/p02776/output.4.txt b/codenet/public_test_cases/p02776/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2223131f5e2c99b23ef41de77634d2fc5a6b410d --- /dev/null +++ b/codenet/public_test_cases/p02776/output.4.txt @@ -0,0 +1,2 @@ +5 +1 7 8 9 11 diff --git a/codenet/public_test_cases/p02777/input.0.txt b/codenet/public_test_cases/p02777/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5d41b6a884e7474241adabb5117908e0fb93733 --- /dev/null +++ b/codenet/public_test_cases/p02777/input.0.txt @@ -0,0 +1,3 @@ +red blue +3 4 +red diff --git a/codenet/public_test_cases/p02777/input.1.txt b/codenet/public_test_cases/p02777/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5d41b6a884e7474241adabb5117908e0fb93733 --- /dev/null +++ b/codenet/public_test_cases/p02777/input.1.txt @@ -0,0 +1,3 @@ +red blue +3 4 +red diff --git a/codenet/public_test_cases/p02777/input.2.txt b/codenet/public_test_cases/p02777/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7caadc86ff7737dcc9a48fc7d43e8e4850be9b3c --- /dev/null +++ b/codenet/public_test_cases/p02777/input.2.txt @@ -0,0 +1,3 @@ +red blue +5 5 +blue diff --git a/codenet/public_test_cases/p02777/output.0.txt b/codenet/public_test_cases/p02777/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0efd67f9502e63cb033cb651e65e025b6e3a5cb2 --- /dev/null +++ b/codenet/public_test_cases/p02777/output.0.txt @@ -0,0 +1 @@ +2 4 diff --git a/codenet/public_test_cases/p02777/output.1.txt b/codenet/public_test_cases/p02777/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0efd67f9502e63cb033cb651e65e025b6e3a5cb2 --- /dev/null +++ b/codenet/public_test_cases/p02777/output.1.txt @@ -0,0 +1 @@ +2 4 diff --git a/codenet/public_test_cases/p02777/output.2.txt b/codenet/public_test_cases/p02777/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f64a0cb9f54508ddc866bfe93dac511a5f10974 --- /dev/null +++ b/codenet/public_test_cases/p02777/output.2.txt @@ -0,0 +1 @@ +5 4 diff --git a/codenet/public_test_cases/p02778/input.0.txt b/codenet/public_test_cases/p02778/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ec8acca4addbb1a44dc7f4ff70e63e26956b1a4 --- /dev/null +++ b/codenet/public_test_cases/p02778/input.0.txt @@ -0,0 +1 @@ +sardine diff --git a/codenet/public_test_cases/p02778/input.1.txt b/codenet/public_test_cases/p02778/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ec8acca4addbb1a44dc7f4ff70e63e26956b1a4 --- /dev/null +++ b/codenet/public_test_cases/p02778/input.1.txt @@ -0,0 +1 @@ +sardine diff --git a/codenet/public_test_cases/p02778/input.2.txt b/codenet/public_test_cases/p02778/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..63fc8131d563e4c067404cb42d39eb293952bd51 --- /dev/null +++ b/codenet/public_test_cases/p02778/input.2.txt @@ -0,0 +1 @@ +xxxx diff --git a/codenet/public_test_cases/p02778/input.3.txt b/codenet/public_test_cases/p02778/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..286c5f5776916d7d7d5849988ca9d83e722cf9c2 --- /dev/null +++ b/codenet/public_test_cases/p02778/input.3.txt @@ -0,0 +1 @@ +gone diff --git a/codenet/public_test_cases/p02778/output.0.txt b/codenet/public_test_cases/p02778/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ca842fc19e4ca09fc590cca98441612e5d853b6 --- /dev/null +++ b/codenet/public_test_cases/p02778/output.0.txt @@ -0,0 +1 @@ +xxxxxxx diff --git a/codenet/public_test_cases/p02778/output.1.txt b/codenet/public_test_cases/p02778/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ca842fc19e4ca09fc590cca98441612e5d853b6 --- /dev/null +++ b/codenet/public_test_cases/p02778/output.1.txt @@ -0,0 +1 @@ +xxxxxxx diff --git a/codenet/public_test_cases/p02778/output.2.txt b/codenet/public_test_cases/p02778/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..63fc8131d563e4c067404cb42d39eb293952bd51 --- /dev/null +++ b/codenet/public_test_cases/p02778/output.2.txt @@ -0,0 +1 @@ +xxxx diff --git a/codenet/public_test_cases/p02778/output.3.txt b/codenet/public_test_cases/p02778/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..63fc8131d563e4c067404cb42d39eb293952bd51 --- /dev/null +++ b/codenet/public_test_cases/p02778/output.3.txt @@ -0,0 +1 @@ +xxxx diff --git a/codenet/public_test_cases/p02779/input.0.txt b/codenet/public_test_cases/p02779/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..709c22db545314e5c87dd61286e8624ddfea1db8 --- /dev/null +++ b/codenet/public_test_cases/p02779/input.0.txt @@ -0,0 +1,2 @@ +5 +2 6 1 4 5 diff --git a/codenet/public_test_cases/p02779/input.1.txt b/codenet/public_test_cases/p02779/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ea65baf6cbc9dec1e443780d6a1700884d83951 --- /dev/null +++ b/codenet/public_test_cases/p02779/input.1.txt @@ -0,0 +1,2 @@ +6 +4 1 3 1 6 2 diff --git a/codenet/public_test_cases/p02779/input.2.txt b/codenet/public_test_cases/p02779/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b91a23e08b6ccfa5d77df8d71454bc9b24eece4 --- /dev/null +++ b/codenet/public_test_cases/p02779/input.2.txt @@ -0,0 +1,2 @@ +2 +10000000 10000000 diff --git a/codenet/public_test_cases/p02779/input.3.txt b/codenet/public_test_cases/p02779/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..709c22db545314e5c87dd61286e8624ddfea1db8 --- /dev/null +++ b/codenet/public_test_cases/p02779/input.3.txt @@ -0,0 +1,2 @@ +5 +2 6 1 4 5 diff --git a/codenet/public_test_cases/p02779/output.0.txt b/codenet/public_test_cases/p02779/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p02779/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p02779/output.1.txt b/codenet/public_test_cases/p02779/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p02779/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p02779/output.2.txt b/codenet/public_test_cases/p02779/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p02779/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p02779/output.3.txt b/codenet/public_test_cases/p02779/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p02779/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p02780/input.0.txt b/codenet/public_test_cases/p02780/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5ed745a069b118155c8e3d56a1b65a87fab8e63 --- /dev/null +++ b/codenet/public_test_cases/p02780/input.0.txt @@ -0,0 +1,2 @@ +5 3 +1 2 2 4 5 diff --git a/codenet/public_test_cases/p02780/input.1.txt b/codenet/public_test_cases/p02780/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5ed745a069b118155c8e3d56a1b65a87fab8e63 --- /dev/null +++ b/codenet/public_test_cases/p02780/input.1.txt @@ -0,0 +1,2 @@ +5 3 +1 2 2 4 5 diff --git a/codenet/public_test_cases/p02780/input.2.txt b/codenet/public_test_cases/p02780/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2e210d442efaf1942292e5cb64dfd53f0c0c674 --- /dev/null +++ b/codenet/public_test_cases/p02780/input.2.txt @@ -0,0 +1,2 @@ +10 4 +17 13 13 12 15 20 10 13 17 11 diff --git a/codenet/public_test_cases/p02780/input.3.txt b/codenet/public_test_cases/p02780/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce9c8a4ecbb99f5bd066fbf6aa8548293b3bc6bb --- /dev/null +++ b/codenet/public_test_cases/p02780/input.3.txt @@ -0,0 +1,2 @@ +4 1 +6 6 6 6 diff --git a/codenet/public_test_cases/p02780/output.0.txt b/codenet/public_test_cases/p02780/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87a27b41ca93da63ef03eae50c5143ef0bdc2be0 --- /dev/null +++ b/codenet/public_test_cases/p02780/output.0.txt @@ -0,0 +1 @@ +7.000000000000 diff --git a/codenet/public_test_cases/p02780/output.1.txt b/codenet/public_test_cases/p02780/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87a27b41ca93da63ef03eae50c5143ef0bdc2be0 --- /dev/null +++ b/codenet/public_test_cases/p02780/output.1.txt @@ -0,0 +1 @@ +7.000000000000 diff --git a/codenet/public_test_cases/p02780/output.2.txt b/codenet/public_test_cases/p02780/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..83736faf0f47e656d297a014a38f9bc4d12236d6 --- /dev/null +++ b/codenet/public_test_cases/p02780/output.2.txt @@ -0,0 +1 @@ +32.000000000000 diff --git a/codenet/public_test_cases/p02780/output.3.txt b/codenet/public_test_cases/p02780/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..98f48bd636d0f9029838e63ddcbf99cbc2fbb35a --- /dev/null +++ b/codenet/public_test_cases/p02780/output.3.txt @@ -0,0 +1 @@ +3.500000000000 diff --git a/codenet/public_test_cases/p02781/input.0.txt b/codenet/public_test_cases/p02781/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30a4d52afe1f49fba0e76a509179b1791064457c --- /dev/null +++ b/codenet/public_test_cases/p02781/input.0.txt @@ -0,0 +1,2 @@ +100 +1 diff --git a/codenet/public_test_cases/p02781/input.1.txt b/codenet/public_test_cases/p02781/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ede2eacec7761829bfd622e0f166f4e5071d4c1d --- /dev/null +++ b/codenet/public_test_cases/p02781/input.1.txt @@ -0,0 +1,2 @@ +9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 +3 diff --git a/codenet/public_test_cases/p02781/input.2.txt b/codenet/public_test_cases/p02781/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8d233bbbecc04f8d46291afb617a951aa73e2d9 --- /dev/null +++ b/codenet/public_test_cases/p02781/input.2.txt @@ -0,0 +1,2 @@ +314159 +2 diff --git a/codenet/public_test_cases/p02781/input.3.txt b/codenet/public_test_cases/p02781/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..61ac7862149e331b4ca71f115533a1ecf23d5b9e --- /dev/null +++ b/codenet/public_test_cases/p02781/input.3.txt @@ -0,0 +1,2 @@ +25 +2 diff --git a/codenet/public_test_cases/p02781/input.4.txt b/codenet/public_test_cases/p02781/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..30a4d52afe1f49fba0e76a509179b1791064457c --- /dev/null +++ b/codenet/public_test_cases/p02781/input.4.txt @@ -0,0 +1,2 @@ +100 +1 diff --git a/codenet/public_test_cases/p02781/output.0.txt b/codenet/public_test_cases/p02781/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p02781/output.0.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p02781/output.1.txt b/codenet/public_test_cases/p02781/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0be48e1e09a494b088ce8f873816bd93ce38d85 --- /dev/null +++ b/codenet/public_test_cases/p02781/output.1.txt @@ -0,0 +1 @@ +117879300 diff --git a/codenet/public_test_cases/p02781/output.2.txt b/codenet/public_test_cases/p02781/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..df43bf46e18f835919caa1518a5368a583594179 --- /dev/null +++ b/codenet/public_test_cases/p02781/output.2.txt @@ -0,0 +1 @@ +937 diff --git a/codenet/public_test_cases/p02781/output.3.txt b/codenet/public_test_cases/p02781/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02781/output.3.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02781/output.4.txt b/codenet/public_test_cases/p02781/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p02781/output.4.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p02782/input.0.txt b/codenet/public_test_cases/p02782/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1409b1c7c807c83489d56f470457810e6c246c59 --- /dev/null +++ b/codenet/public_test_cases/p02782/input.0.txt @@ -0,0 +1 @@ +1 1 2 2 diff --git a/codenet/public_test_cases/p02782/input.1.txt b/codenet/public_test_cases/p02782/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..96966ec9988921f4ee6c77a52b14bdf2393ce904 --- /dev/null +++ b/codenet/public_test_cases/p02782/input.1.txt @@ -0,0 +1 @@ +314 159 2653 589 diff --git a/codenet/public_test_cases/p02782/input.2.txt b/codenet/public_test_cases/p02782/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1409b1c7c807c83489d56f470457810e6c246c59 --- /dev/null +++ b/codenet/public_test_cases/p02782/input.2.txt @@ -0,0 +1 @@ +1 1 2 2 diff --git a/codenet/public_test_cases/p02782/output.0.txt b/codenet/public_test_cases/p02782/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02782/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02782/output.1.txt b/codenet/public_test_cases/p02782/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8def42443e0968716527414f2fe43f288b40e820 --- /dev/null +++ b/codenet/public_test_cases/p02782/output.1.txt @@ -0,0 +1 @@ +602215194 diff --git a/codenet/public_test_cases/p02782/output.2.txt b/codenet/public_test_cases/p02782/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02782/output.2.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02783/input.0.txt b/codenet/public_test_cases/p02783/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6a20510c439699c56dc13f31db00f9c75d87625 --- /dev/null +++ b/codenet/public_test_cases/p02783/input.0.txt @@ -0,0 +1 @@ +10 4 diff --git a/codenet/public_test_cases/p02783/input.1.txt b/codenet/public_test_cases/p02783/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6a20510c439699c56dc13f31db00f9c75d87625 --- /dev/null +++ b/codenet/public_test_cases/p02783/input.1.txt @@ -0,0 +1 @@ +10 4 diff --git a/codenet/public_test_cases/p02783/input.2.txt b/codenet/public_test_cases/p02783/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..224871f187347b50ffd0345a11254a6ec69588d8 --- /dev/null +++ b/codenet/public_test_cases/p02783/input.2.txt @@ -0,0 +1 @@ +1 10000 diff --git a/codenet/public_test_cases/p02783/input.3.txt b/codenet/public_test_cases/p02783/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..28ba9b116277226da7090852a0e428f5eecbbf2b --- /dev/null +++ b/codenet/public_test_cases/p02783/input.3.txt @@ -0,0 +1 @@ +10000 1 diff --git a/codenet/public_test_cases/p02783/output.0.txt b/codenet/public_test_cases/p02783/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02783/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02783/output.1.txt b/codenet/public_test_cases/p02783/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02783/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02783/output.2.txt b/codenet/public_test_cases/p02783/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02783/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02783/output.3.txt b/codenet/public_test_cases/p02783/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5caff40c4a0ce4ed0dcb3aa983da623641af1b06 --- /dev/null +++ b/codenet/public_test_cases/p02783/output.3.txt @@ -0,0 +1 @@ +10000 diff --git a/codenet/public_test_cases/p02784/input.0.txt b/codenet/public_test_cases/p02784/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a0fa9222a068872bc0203b2d3245c71a9fc5e24 --- /dev/null +++ b/codenet/public_test_cases/p02784/input.0.txt @@ -0,0 +1,2 @@ +10 3 +4 5 6 diff --git a/codenet/public_test_cases/p02784/input.1.txt b/codenet/public_test_cases/p02784/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b932763dfa82dc7e5b8c0101724bfb990674130 --- /dev/null +++ b/codenet/public_test_cases/p02784/input.1.txt @@ -0,0 +1,2 @@ +211 5 +31 41 59 26 53 diff --git a/codenet/public_test_cases/p02784/input.2.txt b/codenet/public_test_cases/p02784/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a0fa9222a068872bc0203b2d3245c71a9fc5e24 --- /dev/null +++ b/codenet/public_test_cases/p02784/input.2.txt @@ -0,0 +1,2 @@ +10 3 +4 5 6 diff --git a/codenet/public_test_cases/p02784/input.3.txt b/codenet/public_test_cases/p02784/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..975b9f27de2d2c124def72f9b978baa12b8b0e53 --- /dev/null +++ b/codenet/public_test_cases/p02784/input.3.txt @@ -0,0 +1,2 @@ +20 3 +4 5 6 diff --git a/codenet/public_test_cases/p02784/input.4.txt b/codenet/public_test_cases/p02784/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3993bafda49f3b792d76bce3343743ad1974ebad --- /dev/null +++ b/codenet/public_test_cases/p02784/input.4.txt @@ -0,0 +1,2 @@ +210 5 +31 41 59 26 53 diff --git a/codenet/public_test_cases/p02784/output.0.txt b/codenet/public_test_cases/p02784/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02784/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02784/output.1.txt b/codenet/public_test_cases/p02784/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02784/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02784/output.2.txt b/codenet/public_test_cases/p02784/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02784/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02784/output.3.txt b/codenet/public_test_cases/p02784/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02784/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02784/output.4.txt b/codenet/public_test_cases/p02784/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02784/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02785/input.0.txt b/codenet/public_test_cases/p02785/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..680ee270bf1b94fef984accc7df38d8aad28e2a1 --- /dev/null +++ b/codenet/public_test_cases/p02785/input.0.txt @@ -0,0 +1,2 @@ +3 1 +4 1 5 diff --git a/codenet/public_test_cases/p02785/input.1.txt b/codenet/public_test_cases/p02785/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a24b89e5bb8859acb18b610aebf5d400c859f944 --- /dev/null +++ b/codenet/public_test_cases/p02785/input.1.txt @@ -0,0 +1,2 @@ +3 0 +1000000000 1000000000 1000000000 diff --git a/codenet/public_test_cases/p02785/input.2.txt b/codenet/public_test_cases/p02785/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..26c5f569da5a1287053c5e098d67552449ce36de --- /dev/null +++ b/codenet/public_test_cases/p02785/input.2.txt @@ -0,0 +1,2 @@ +8 9 +7 9 3 2 3 8 4 6 diff --git a/codenet/public_test_cases/p02785/input.3.txt b/codenet/public_test_cases/p02785/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..680ee270bf1b94fef984accc7df38d8aad28e2a1 --- /dev/null +++ b/codenet/public_test_cases/p02785/input.3.txt @@ -0,0 +1,2 @@ +3 1 +4 1 5 diff --git a/codenet/public_test_cases/p02785/output.0.txt b/codenet/public_test_cases/p02785/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02785/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02785/output.1.txt b/codenet/public_test_cases/p02785/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1911b6e1e0b6ba372db173e7dcb15d7f609827d2 --- /dev/null +++ b/codenet/public_test_cases/p02785/output.1.txt @@ -0,0 +1 @@ +3000000000 diff --git a/codenet/public_test_cases/p02785/output.2.txt b/codenet/public_test_cases/p02785/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02785/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02785/output.3.txt b/codenet/public_test_cases/p02785/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02785/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02786/input.0.txt b/codenet/public_test_cases/p02786/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02786/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02786/input.1.txt b/codenet/public_test_cases/p02786/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02786/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02786/input.2.txt b/codenet/public_test_cases/p02786/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6ee9012f2ab8aa0961ad84e2066b4518eafea4f --- /dev/null +++ b/codenet/public_test_cases/p02786/input.2.txt @@ -0,0 +1 @@ +1000000000000 diff --git a/codenet/public_test_cases/p02786/input.3.txt b/codenet/public_test_cases/p02786/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02786/input.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02786/output.0.txt b/codenet/public_test_cases/p02786/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02786/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02786/output.1.txt b/codenet/public_test_cases/p02786/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02786/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02786/output.2.txt b/codenet/public_test_cases/p02786/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ebb060a36f2b78dee8059c427b146769d746e81 --- /dev/null +++ b/codenet/public_test_cases/p02786/output.2.txt @@ -0,0 +1 @@ +1099511627775 diff --git a/codenet/public_test_cases/p02786/output.3.txt b/codenet/public_test_cases/p02786/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02786/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02787/input.0.txt b/codenet/public_test_cases/p02787/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..39e538ae8c0c9125c1fcb2470381bf6358d021e7 --- /dev/null +++ b/codenet/public_test_cases/p02787/input.0.txt @@ -0,0 +1,4 @@ +9 3 +8 3 +4 2 +2 1 diff --git a/codenet/public_test_cases/p02787/input.1.txt b/codenet/public_test_cases/p02787/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..39e538ae8c0c9125c1fcb2470381bf6358d021e7 --- /dev/null +++ b/codenet/public_test_cases/p02787/input.1.txt @@ -0,0 +1,4 @@ +9 3 +8 3 +4 2 +2 1 diff --git a/codenet/public_test_cases/p02787/input.2.txt b/codenet/public_test_cases/p02787/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c77edc0b525bdf8fcc1c1f78d6fdc9712b24e77 --- /dev/null +++ b/codenet/public_test_cases/p02787/input.2.txt @@ -0,0 +1,11 @@ +9999 10 +540 7550 +691 9680 +700 9790 +510 7150 +415 5818 +551 7712 +587 8227 +619 8671 +588 8228 +176 2461 diff --git a/codenet/public_test_cases/p02787/input.3.txt b/codenet/public_test_cases/p02787/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c035e383b50af6952c04b5018cd54ff9f0d47659 --- /dev/null +++ b/codenet/public_test_cases/p02787/input.3.txt @@ -0,0 +1,7 @@ +100 6 +1 1 +2 3 +3 9 +4 27 +5 81 +6 243 diff --git a/codenet/public_test_cases/p02787/output.0.txt b/codenet/public_test_cases/p02787/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02787/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02787/output.1.txt b/codenet/public_test_cases/p02787/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02787/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02787/output.2.txt b/codenet/public_test_cases/p02787/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db0f2a8a51523f828919d2566dfd34118f12b84b --- /dev/null +++ b/codenet/public_test_cases/p02787/output.2.txt @@ -0,0 +1 @@ +139815 diff --git a/codenet/public_test_cases/p02787/output.3.txt b/codenet/public_test_cases/p02787/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02787/output.3.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02788/input.0.txt b/codenet/public_test_cases/p02788/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..060f4a3da7572847c523c4426068343dc313399e --- /dev/null +++ b/codenet/public_test_cases/p02788/input.0.txt @@ -0,0 +1,4 @@ +3 3 2 +1 2 +5 4 +9 2 diff --git a/codenet/public_test_cases/p02788/input.1.txt b/codenet/public_test_cases/p02788/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ed34a192f3b52962b2c2892dace263c10cfa8c9 --- /dev/null +++ b/codenet/public_test_cases/p02788/input.1.txt @@ -0,0 +1,10 @@ +9 4 1 +1 5 +2 4 +3 3 +4 2 +5 1 +6 2 +7 3 +8 4 +9 5 diff --git a/codenet/public_test_cases/p02788/input.2.txt b/codenet/public_test_cases/p02788/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..060f4a3da7572847c523c4426068343dc313399e --- /dev/null +++ b/codenet/public_test_cases/p02788/input.2.txt @@ -0,0 +1,4 @@ +3 3 2 +1 2 +5 4 +9 2 diff --git a/codenet/public_test_cases/p02788/input.3.txt b/codenet/public_test_cases/p02788/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1fa669395802d5f4fa42b4434448008cfaadfa93 --- /dev/null +++ b/codenet/public_test_cases/p02788/input.3.txt @@ -0,0 +1,4 @@ +3 0 1 +300000000 1000000000 +100000000 1000000000 +200000000 1000000000 diff --git a/codenet/public_test_cases/p02788/output.0.txt b/codenet/public_test_cases/p02788/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02788/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02788/output.1.txt b/codenet/public_test_cases/p02788/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02788/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02788/output.2.txt b/codenet/public_test_cases/p02788/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02788/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02788/output.3.txt b/codenet/public_test_cases/p02788/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1911b6e1e0b6ba372db173e7dcb15d7f609827d2 --- /dev/null +++ b/codenet/public_test_cases/p02788/output.3.txt @@ -0,0 +1 @@ +3000000000 diff --git a/codenet/public_test_cases/p02789/input.0.txt b/codenet/public_test_cases/p02789/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p02789/input.0.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p02789/input.1.txt b/codenet/public_test_cases/p02789/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p02789/input.1.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p02789/input.2.txt b/codenet/public_test_cases/p02789/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02789/input.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02789/input.3.txt b/codenet/public_test_cases/p02789/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02789/input.3.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02789/output.0.txt b/codenet/public_test_cases/p02789/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02789/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02789/output.1.txt b/codenet/public_test_cases/p02789/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02789/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02789/output.2.txt b/codenet/public_test_cases/p02789/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02789/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02789/output.3.txt b/codenet/public_test_cases/p02789/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02789/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02790/input.0.txt b/codenet/public_test_cases/p02790/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p02790/input.0.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p02790/input.1.txt b/codenet/public_test_cases/p02790/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11c8dd7f2c36bdd2f4603cd9e82c497036c78f61 --- /dev/null +++ b/codenet/public_test_cases/p02790/input.1.txt @@ -0,0 +1 @@ +7 7 diff --git a/codenet/public_test_cases/p02790/input.2.txt b/codenet/public_test_cases/p02790/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p02790/input.2.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p02790/output.0.txt b/codenet/public_test_cases/p02790/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bd9bce7058fdf7b9809c5a87053a5270c6a75ea --- /dev/null +++ b/codenet/public_test_cases/p02790/output.0.txt @@ -0,0 +1 @@ +3333 diff --git a/codenet/public_test_cases/p02790/output.1.txt b/codenet/public_test_cases/p02790/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f0353b22e2e61578251f93429bd9bc010c11028 --- /dev/null +++ b/codenet/public_test_cases/p02790/output.1.txt @@ -0,0 +1 @@ +7777777 diff --git a/codenet/public_test_cases/p02790/output.2.txt b/codenet/public_test_cases/p02790/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bd9bce7058fdf7b9809c5a87053a5270c6a75ea --- /dev/null +++ b/codenet/public_test_cases/p02790/output.2.txt @@ -0,0 +1 @@ +3333 diff --git a/codenet/public_test_cases/p02791/input.0.txt b/codenet/public_test_cases/p02791/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ed8e2d82389ae25d8e611e01919bd3bbe040a28 --- /dev/null +++ b/codenet/public_test_cases/p02791/input.0.txt @@ -0,0 +1,2 @@ +5 +4 2 5 1 3 diff --git a/codenet/public_test_cases/p02791/input.1.txt b/codenet/public_test_cases/p02791/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..73c1d16159231443a4598258520599893c2277d9 --- /dev/null +++ b/codenet/public_test_cases/p02791/input.1.txt @@ -0,0 +1,2 @@ +8 +5 7 4 2 6 8 1 3 diff --git a/codenet/public_test_cases/p02791/input.2.txt b/codenet/public_test_cases/p02791/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c72001f2e8f93d6c45f22c3c37e0b3bded52287 --- /dev/null +++ b/codenet/public_test_cases/p02791/input.2.txt @@ -0,0 +1,2 @@ +4 +4 3 2 1 diff --git a/codenet/public_test_cases/p02791/input.3.txt b/codenet/public_test_cases/p02791/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee886e113fb8e0c61426795b71508f0130a4438 --- /dev/null +++ b/codenet/public_test_cases/p02791/input.3.txt @@ -0,0 +1,2 @@ +6 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p02791/input.4.txt b/codenet/public_test_cases/p02791/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ed8e2d82389ae25d8e611e01919bd3bbe040a28 --- /dev/null +++ b/codenet/public_test_cases/p02791/input.4.txt @@ -0,0 +1,2 @@ +5 +4 2 5 1 3 diff --git a/codenet/public_test_cases/p02791/input.5.txt b/codenet/public_test_cases/p02791/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p02791/input.5.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p02791/output.0.txt b/codenet/public_test_cases/p02791/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02791/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02791/output.1.txt b/codenet/public_test_cases/p02791/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02791/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02791/output.2.txt b/codenet/public_test_cases/p02791/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02791/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02791/output.3.txt b/codenet/public_test_cases/p02791/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02791/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02791/output.4.txt b/codenet/public_test_cases/p02791/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02791/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02791/output.5.txt b/codenet/public_test_cases/p02791/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02791/output.5.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02792/input.0.txt b/codenet/public_test_cases/p02792/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02792/input.0.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02792/input.1.txt b/codenet/public_test_cases/p02792/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0fbadda96193e45ce6b910f2d13837323894356 --- /dev/null +++ b/codenet/public_test_cases/p02792/input.1.txt @@ -0,0 +1 @@ +2020 diff --git a/codenet/public_test_cases/p02792/input.2.txt b/codenet/public_test_cases/p02792/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..87766d889a3b6e931e06acce671d69b85757f3c7 --- /dev/null +++ b/codenet/public_test_cases/p02792/input.2.txt @@ -0,0 +1 @@ +200000 diff --git a/codenet/public_test_cases/p02792/input.3.txt b/codenet/public_test_cases/p02792/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02792/input.3.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02792/input.4.txt b/codenet/public_test_cases/p02792/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02792/input.4.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02792/input.5.txt b/codenet/public_test_cases/p02792/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02792/input.5.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02792/output.0.txt b/codenet/public_test_cases/p02792/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p02792/output.0.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p02792/output.1.txt b/codenet/public_test_cases/p02792/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a61b615114ceb1f3430820e0b199d021f90ae86 --- /dev/null +++ b/codenet/public_test_cases/p02792/output.1.txt @@ -0,0 +1 @@ +40812 diff --git a/codenet/public_test_cases/p02792/output.2.txt b/codenet/public_test_cases/p02792/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..09fcc5d4d642f9dd5901b53448b180b084baaf88 --- /dev/null +++ b/codenet/public_test_cases/p02792/output.2.txt @@ -0,0 +1 @@ +400000008 diff --git a/codenet/public_test_cases/p02792/output.3.txt b/codenet/public_test_cases/p02792/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p02792/output.3.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p02792/output.4.txt b/codenet/public_test_cases/p02792/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b20426c05051ed8bd8c8cc632573c194e57809c --- /dev/null +++ b/codenet/public_test_cases/p02792/output.4.txt @@ -0,0 +1 @@ +108 diff --git a/codenet/public_test_cases/p02792/output.5.txt b/codenet/public_test_cases/p02792/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02792/output.5.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02793/input.0.txt b/codenet/public_test_cases/p02793/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88820dc653221aac1f701c46e60afd7bd3b7f745 --- /dev/null +++ b/codenet/public_test_cases/p02793/input.0.txt @@ -0,0 +1,2 @@ +3 +2 3 4 diff --git a/codenet/public_test_cases/p02793/input.1.txt b/codenet/public_test_cases/p02793/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..88820dc653221aac1f701c46e60afd7bd3b7f745 --- /dev/null +++ b/codenet/public_test_cases/p02793/input.1.txt @@ -0,0 +1,2 @@ +3 +2 3 4 diff --git a/codenet/public_test_cases/p02793/input.2.txt b/codenet/public_test_cases/p02793/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f92d8dd9a1897dc0e1d8d79254d11ec15c4fbd05 --- /dev/null +++ b/codenet/public_test_cases/p02793/input.2.txt @@ -0,0 +1,2 @@ +3 +1000000 999999 999998 diff --git a/codenet/public_test_cases/p02793/input.3.txt b/codenet/public_test_cases/p02793/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..07700aec44ae5ddbf60d0ad4ae6ef186d65640ab --- /dev/null +++ b/codenet/public_test_cases/p02793/input.3.txt @@ -0,0 +1,2 @@ +5 +12 12 12 12 12 diff --git a/codenet/public_test_cases/p02793/output.0.txt b/codenet/public_test_cases/p02793/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02793/output.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02793/output.1.txt b/codenet/public_test_cases/p02793/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02793/output.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02793/output.2.txt b/codenet/public_test_cases/p02793/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a448cf2329d3adf853bb4c75744e6c570349c72d --- /dev/null +++ b/codenet/public_test_cases/p02793/output.2.txt @@ -0,0 +1 @@ +996989508 diff --git a/codenet/public_test_cases/p02793/output.3.txt b/codenet/public_test_cases/p02793/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02793/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02794/input.0.txt b/codenet/public_test_cases/p02794/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0df04b784aacda1dfff44923164275dadf01f763 --- /dev/null +++ b/codenet/public_test_cases/p02794/input.0.txt @@ -0,0 +1,5 @@ +3 +1 2 +2 3 +1 +1 3 diff --git a/codenet/public_test_cases/p02794/input.1.txt b/codenet/public_test_cases/p02794/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f17833845d6f76a807ac499664a38a0edc369aa --- /dev/null +++ b/codenet/public_test_cases/p02794/input.1.txt @@ -0,0 +1,4 @@ +2 +1 2 +1 +1 2 diff --git a/codenet/public_test_cases/p02794/input.2.txt b/codenet/public_test_cases/p02794/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab9564428640c5ce8235bcf5f00d0e45ed0cd7d5 --- /dev/null +++ b/codenet/public_test_cases/p02794/input.2.txt @@ -0,0 +1,9 @@ +5 +1 2 +3 2 +3 4 +5 3 +3 +1 3 +2 4 +2 5 diff --git a/codenet/public_test_cases/p02794/input.3.txt b/codenet/public_test_cases/p02794/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0df04b784aacda1dfff44923164275dadf01f763 --- /dev/null +++ b/codenet/public_test_cases/p02794/input.3.txt @@ -0,0 +1,5 @@ +3 +1 2 +2 3 +1 +1 3 diff --git a/codenet/public_test_cases/p02794/input.4.txt b/codenet/public_test_cases/p02794/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0e8f97dd5a8bd43686f6218f278bafa18f9210c --- /dev/null +++ b/codenet/public_test_cases/p02794/input.4.txt @@ -0,0 +1,14 @@ +8 +1 2 +2 3 +4 3 +2 5 +6 3 +6 7 +8 6 +5 +2 7 +3 5 +1 6 +2 8 +7 8 diff --git a/codenet/public_test_cases/p02794/output.0.txt b/codenet/public_test_cases/p02794/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02794/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02794/output.1.txt b/codenet/public_test_cases/p02794/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02794/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02794/output.2.txt b/codenet/public_test_cases/p02794/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02794/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02794/output.3.txt b/codenet/public_test_cases/p02794/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02794/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02794/output.4.txt b/codenet/public_test_cases/p02794/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8fa06e1be7da01425d2be19da24595de2fa02c2 --- /dev/null +++ b/codenet/public_test_cases/p02794/output.4.txt @@ -0,0 +1 @@ +62 diff --git a/codenet/public_test_cases/p02795/input.0.txt b/codenet/public_test_cases/p02795/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b51057219e1fe4e413ebe6b3e7f4eeceefb2d7d --- /dev/null +++ b/codenet/public_test_cases/p02795/input.0.txt @@ -0,0 +1,3 @@ +3 +7 +10 diff --git a/codenet/public_test_cases/p02795/input.1.txt b/codenet/public_test_cases/p02795/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b51057219e1fe4e413ebe6b3e7f4eeceefb2d7d --- /dev/null +++ b/codenet/public_test_cases/p02795/input.1.txt @@ -0,0 +1,3 @@ +3 +7 +10 diff --git a/codenet/public_test_cases/p02795/input.2.txt b/codenet/public_test_cases/p02795/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..939760f9fdb3334339bb24425f0325537aab6d53 --- /dev/null +++ b/codenet/public_test_cases/p02795/input.2.txt @@ -0,0 +1,3 @@ +2 +100 +200 diff --git a/codenet/public_test_cases/p02795/input.3.txt b/codenet/public_test_cases/p02795/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e26f4c0d0cb950000fbcea6740ed48bd2d9e7c6a --- /dev/null +++ b/codenet/public_test_cases/p02795/input.3.txt @@ -0,0 +1,3 @@ +14 +12 +112 diff --git a/codenet/public_test_cases/p02795/output.0.txt b/codenet/public_test_cases/p02795/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02795/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02795/output.1.txt b/codenet/public_test_cases/p02795/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02795/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02795/output.2.txt b/codenet/public_test_cases/p02795/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02795/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02795/output.3.txt b/codenet/public_test_cases/p02795/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02795/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02796/input.0.txt b/codenet/public_test_cases/p02796/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..20ddda0041b80e0802fdbdb1e682d9aa19d7a768 --- /dev/null +++ b/codenet/public_test_cases/p02796/input.0.txt @@ -0,0 +1,5 @@ +4 +2 4 +4 3 +9 3 +100 5 diff --git a/codenet/public_test_cases/p02796/input.1.txt b/codenet/public_test_cases/p02796/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a9874efe0e1ca7d06ea4112a83c160f2c5bce2d --- /dev/null +++ b/codenet/public_test_cases/p02796/input.1.txt @@ -0,0 +1,6 @@ +5 +10 1 +2 1 +4 1 +6 1 +8 1 diff --git a/codenet/public_test_cases/p02796/input.2.txt b/codenet/public_test_cases/p02796/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f5eacbfe3426a72f314380c88bd046143e590c8 --- /dev/null +++ b/codenet/public_test_cases/p02796/input.2.txt @@ -0,0 +1,3 @@ +2 +8 20 +1 10 diff --git a/codenet/public_test_cases/p02796/input.3.txt b/codenet/public_test_cases/p02796/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..20ddda0041b80e0802fdbdb1e682d9aa19d7a768 --- /dev/null +++ b/codenet/public_test_cases/p02796/input.3.txt @@ -0,0 +1,5 @@ +4 +2 4 +4 3 +9 3 +100 5 diff --git a/codenet/public_test_cases/p02796/output.0.txt b/codenet/public_test_cases/p02796/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02796/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02796/output.1.txt b/codenet/public_test_cases/p02796/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02796/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02796/output.2.txt b/codenet/public_test_cases/p02796/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02796/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02796/output.3.txt b/codenet/public_test_cases/p02796/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02796/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02797/input.0.txt b/codenet/public_test_cases/p02797/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce28b14c5fb7efa72f16989b86cbeb028ae8ca88 --- /dev/null +++ b/codenet/public_test_cases/p02797/input.0.txt @@ -0,0 +1 @@ +4 2 3 diff --git a/codenet/public_test_cases/p02797/input.1.txt b/codenet/public_test_cases/p02797/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..303738e0c33da46b0eae90235714ad49f8bfb03d --- /dev/null +++ b/codenet/public_test_cases/p02797/input.1.txt @@ -0,0 +1 @@ +5 3 100 diff --git a/codenet/public_test_cases/p02797/input.2.txt b/codenet/public_test_cases/p02797/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce28b14c5fb7efa72f16989b86cbeb028ae8ca88 --- /dev/null +++ b/codenet/public_test_cases/p02797/input.2.txt @@ -0,0 +1 @@ +4 2 3 diff --git a/codenet/public_test_cases/p02797/output.0.txt b/codenet/public_test_cases/p02797/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93a48451c357d2efc0215caef8334af6b6b8dacf --- /dev/null +++ b/codenet/public_test_cases/p02797/output.0.txt @@ -0,0 +1 @@ +1 2 3 4 diff --git a/codenet/public_test_cases/p02797/output.1.txt b/codenet/public_test_cases/p02797/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..379ff3d688475b1aa9cd17b38de75403b3de0b99 --- /dev/null +++ b/codenet/public_test_cases/p02797/output.1.txt @@ -0,0 +1 @@ +50 50 50 30 70 diff --git a/codenet/public_test_cases/p02797/output.2.txt b/codenet/public_test_cases/p02797/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..93a48451c357d2efc0215caef8334af6b6b8dacf --- /dev/null +++ b/codenet/public_test_cases/p02797/output.2.txt @@ -0,0 +1 @@ +1 2 3 4 diff --git a/codenet/public_test_cases/p02798/input.0.txt b/codenet/public_test_cases/p02798/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3065ce261591f7b78a7a893adcb09ab49f410c6b --- /dev/null +++ b/codenet/public_test_cases/p02798/input.0.txt @@ -0,0 +1,3 @@ +3 +3 4 3 +3 2 3 diff --git a/codenet/public_test_cases/p02798/input.1.txt b/codenet/public_test_cases/p02798/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0927bfd621f252919d2be6228551cf72d05a111d --- /dev/null +++ b/codenet/public_test_cases/p02798/input.1.txt @@ -0,0 +1,3 @@ +5 +28 15 22 43 31 +20 22 43 33 32 diff --git a/codenet/public_test_cases/p02798/input.2.txt b/codenet/public_test_cases/p02798/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3e5d19ab0a73efcd362bac661bb96d33b2689be --- /dev/null +++ b/codenet/public_test_cases/p02798/input.2.txt @@ -0,0 +1,3 @@ +4 +1 2 3 4 +5 6 7 8 diff --git a/codenet/public_test_cases/p02798/input.3.txt b/codenet/public_test_cases/p02798/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3065ce261591f7b78a7a893adcb09ab49f410c6b --- /dev/null +++ b/codenet/public_test_cases/p02798/input.3.txt @@ -0,0 +1,3 @@ +3 +3 4 3 +3 2 3 diff --git a/codenet/public_test_cases/p02798/input.4.txt b/codenet/public_test_cases/p02798/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e637615aadc3c32a225f272569aad6e83ea2f7b2 --- /dev/null +++ b/codenet/public_test_cases/p02798/input.4.txt @@ -0,0 +1,3 @@ +5 +4 46 6 38 43 +33 15 18 27 37 diff --git a/codenet/public_test_cases/p02798/input.5.txt b/codenet/public_test_cases/p02798/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..8da1102443fc9c77ca4cd7fbea5f777076f9ad02 --- /dev/null +++ b/codenet/public_test_cases/p02798/input.5.txt @@ -0,0 +1,3 @@ +2 +2 1 +1 2 diff --git a/codenet/public_test_cases/p02798/output.0.txt b/codenet/public_test_cases/p02798/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02798/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02798/output.1.txt b/codenet/public_test_cases/p02798/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02798/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02798/output.2.txt b/codenet/public_test_cases/p02798/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02798/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02798/output.3.txt b/codenet/public_test_cases/p02798/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02798/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02798/output.4.txt b/codenet/public_test_cases/p02798/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02798/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02798/output.5.txt b/codenet/public_test_cases/p02798/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02798/output.5.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02799/input.0.txt b/codenet/public_test_cases/p02799/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1abfa12fe5984f47d872145e4321d16a13295089 --- /dev/null +++ b/codenet/public_test_cases/p02799/input.0.txt @@ -0,0 +1,7 @@ +5 5 +3 4 3 5 7 +1 2 +1 3 +3 2 +4 2 +4 5 diff --git a/codenet/public_test_cases/p02799/input.1.txt b/codenet/public_test_cases/p02799/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1abfa12fe5984f47d872145e4321d16a13295089 --- /dev/null +++ b/codenet/public_test_cases/p02799/input.1.txt @@ -0,0 +1,7 @@ +5 5 +3 4 3 5 7 +1 2 +1 3 +3 2 +4 2 +4 5 diff --git a/codenet/public_test_cases/p02799/input.2.txt b/codenet/public_test_cases/p02799/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b6e45914c6d6a47b88ecaedcdd0557c6b1cdc8e --- /dev/null +++ b/codenet/public_test_cases/p02799/input.2.txt @@ -0,0 +1,8 @@ +4 6 +1 1 1 1 +1 2 +1 3 +1 4 +2 3 +2 4 +3 4 diff --git a/codenet/public_test_cases/p02799/input.3.txt b/codenet/public_test_cases/p02799/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..483f0c682faa659e78e65a32691d71ece951a905 --- /dev/null +++ b/codenet/public_test_cases/p02799/input.3.txt @@ -0,0 +1,9 @@ +5 7 +1 2 3 4 5 +1 2 +1 3 +1 4 +2 3 +2 5 +3 5 +4 5 diff --git a/codenet/public_test_cases/p02799/output.0.txt b/codenet/public_test_cases/p02799/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..998fd11ab97f1d7f2de482e90361b4ec07402966 --- /dev/null +++ b/codenet/public_test_cases/p02799/output.0.txt @@ -0,0 +1,6 @@ +BWWBB +4 +3 +1 +5 +2 diff --git a/codenet/public_test_cases/p02799/output.1.txt b/codenet/public_test_cases/p02799/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..998fd11ab97f1d7f2de482e90361b4ec07402966 --- /dev/null +++ b/codenet/public_test_cases/p02799/output.1.txt @@ -0,0 +1,6 @@ +BWWBB +4 +3 +1 +5 +2 diff --git a/codenet/public_test_cases/p02799/output.2.txt b/codenet/public_test_cases/p02799/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ee79b2cdf311647af82b950fb0cd674fc5ffc53 --- /dev/null +++ b/codenet/public_test_cases/p02799/output.2.txt @@ -0,0 +1,7 @@ +BBBW +1 +1 +1 +2 +1 +1 diff --git a/codenet/public_test_cases/p02799/output.3.txt b/codenet/public_test_cases/p02799/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02799/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02800/input.0.txt b/codenet/public_test_cases/p02800/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa57422f1db707c6a85418fb54e6cd206aafb9e3 --- /dev/null +++ b/codenet/public_test_cases/p02800/input.0.txt @@ -0,0 +1,3 @@ +2 2 +#. +.# diff --git a/codenet/public_test_cases/p02800/input.1.txt b/codenet/public_test_cases/p02800/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63412e064995ed6250d00cbfe549ad14b1c75ee5 --- /dev/null +++ b/codenet/public_test_cases/p02800/input.1.txt @@ -0,0 +1,4 @@ +3 3 +... +... +... diff --git a/codenet/public_test_cases/p02800/input.2.txt b/codenet/public_test_cases/p02800/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa57422f1db707c6a85418fb54e6cd206aafb9e3 --- /dev/null +++ b/codenet/public_test_cases/p02800/input.2.txt @@ -0,0 +1,3 @@ +2 2 +#. +.# diff --git a/codenet/public_test_cases/p02800/input.3.txt b/codenet/public_test_cases/p02800/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..75f759bd90f7ef634634fa015da30e75fa1d8c26 --- /dev/null +++ b/codenet/public_test_cases/p02800/input.3.txt @@ -0,0 +1,3 @@ +2 4 +... +...# diff --git a/codenet/public_test_cases/p02800/input.4.txt b/codenet/public_test_cases/p02800/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8700013d3f583ef5dc5f8fbab53b889999cace5a --- /dev/null +++ b/codenet/public_test_cases/p02800/input.4.txt @@ -0,0 +1,7 @@ +6 7 +....... +....... +.#..... +..#.... +.#.#... +....... diff --git a/codenet/public_test_cases/p02800/input.5.txt b/codenet/public_test_cases/p02800/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..19bc8b703d7ecb12e802c46abcae9e7fbfe06765 --- /dev/null +++ b/codenet/public_test_cases/p02800/input.5.txt @@ -0,0 +1,3 @@ +2 2 +. +.# diff --git a/codenet/public_test_cases/p02800/output.0.txt b/codenet/public_test_cases/p02800/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p02800/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p02800/output.1.txt b/codenet/public_test_cases/p02800/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcb6b5baa1d74755be849bad4c15f5b269ef4b4c --- /dev/null +++ b/codenet/public_test_cases/p02800/output.1.txt @@ -0,0 +1 @@ +230 diff --git a/codenet/public_test_cases/p02800/output.2.txt b/codenet/public_test_cases/p02800/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p02800/output.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p02800/output.3.txt b/codenet/public_test_cases/p02800/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa8f08cb6ff8a30dd34a3b442009bdfc798a7316 --- /dev/null +++ b/codenet/public_test_cases/p02800/output.3.txt @@ -0,0 +1 @@ +150 diff --git a/codenet/public_test_cases/p02800/output.4.txt b/codenet/public_test_cases/p02800/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..23114667a914dd189ec665257604acb7fe940539 --- /dev/null +++ b/codenet/public_test_cases/p02800/output.4.txt @@ -0,0 +1 @@ +203949910 diff --git a/codenet/public_test_cases/p02800/output.5.txt b/codenet/public_test_cases/p02800/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p02800/output.5.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p02801/input.0.txt b/codenet/public_test_cases/p02801/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p02801/input.0.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p02801/input.1.txt b/codenet/public_test_cases/p02801/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..975fbec8256d3e8a3797e7a3611380f27c49f4ac --- /dev/null +++ b/codenet/public_test_cases/p02801/input.1.txt @@ -0,0 +1 @@ +y diff --git a/codenet/public_test_cases/p02801/input.2.txt b/codenet/public_test_cases/p02801/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p02801/input.2.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p02801/output.0.txt b/codenet/public_test_cases/p02801/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p02801/output.0.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p02801/output.1.txt b/codenet/public_test_cases/p02801/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b68025345d5301abad4d9ec9166f455243a0d746 --- /dev/null +++ b/codenet/public_test_cases/p02801/output.1.txt @@ -0,0 +1 @@ +z diff --git a/codenet/public_test_cases/p02801/output.2.txt b/codenet/public_test_cases/p02801/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p02801/output.2.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p02802/input.0.txt b/codenet/public_test_cases/p02802/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54eaaccd162bcf49dc4e647fb555f5ea5aa6da57 --- /dev/null +++ b/codenet/public_test_cases/p02802/input.0.txt @@ -0,0 +1,6 @@ +2 5 +1 WA +1 AC +2 WA +2 AC +2 WA diff --git a/codenet/public_test_cases/p02802/input.1.txt b/codenet/public_test_cases/p02802/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c12f8e66df2d2eaa570d8b17e0c5359714740595 --- /dev/null +++ b/codenet/public_test_cases/p02802/input.1.txt @@ -0,0 +1 @@ +6 0 diff --git a/codenet/public_test_cases/p02802/input.2.txt b/codenet/public_test_cases/p02802/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..54eaaccd162bcf49dc4e647fb555f5ea5aa6da57 --- /dev/null +++ b/codenet/public_test_cases/p02802/input.2.txt @@ -0,0 +1,6 @@ +2 5 +1 WA +1 AC +2 WA +2 AC +2 WA diff --git a/codenet/public_test_cases/p02802/input.3.txt b/codenet/public_test_cases/p02802/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a8168357f8ec3ec8079ae54df66c3849f81a21f --- /dev/null +++ b/codenet/public_test_cases/p02802/input.3.txt @@ -0,0 +1,4 @@ +100000 3 +7777 AC +7777 AC +7777 AC diff --git a/codenet/public_test_cases/p02802/output.0.txt b/codenet/public_test_cases/p02802/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p02802/output.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p02802/output.1.txt b/codenet/public_test_cases/p02802/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b748e2dcfcbc7db3aae214293cef6cb2afbd0a65 --- /dev/null +++ b/codenet/public_test_cases/p02802/output.1.txt @@ -0,0 +1 @@ +0 0 diff --git a/codenet/public_test_cases/p02802/output.2.txt b/codenet/public_test_cases/p02802/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p02802/output.2.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p02802/output.3.txt b/codenet/public_test_cases/p02802/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..80c0cc79aabb27a7894c5795860fa87c6473f004 --- /dev/null +++ b/codenet/public_test_cases/p02802/output.3.txt @@ -0,0 +1 @@ +1 0 diff --git a/codenet/public_test_cases/p02803/input.0.txt b/codenet/public_test_cases/p02803/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63412e064995ed6250d00cbfe549ad14b1c75ee5 --- /dev/null +++ b/codenet/public_test_cases/p02803/input.0.txt @@ -0,0 +1,4 @@ +3 3 +... +... +... diff --git a/codenet/public_test_cases/p02803/input.1.txt b/codenet/public_test_cases/p02803/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63412e064995ed6250d00cbfe549ad14b1c75ee5 --- /dev/null +++ b/codenet/public_test_cases/p02803/input.1.txt @@ -0,0 +1,4 @@ +3 3 +... +... +... diff --git a/codenet/public_test_cases/p02803/input.2.txt b/codenet/public_test_cases/p02803/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ab8c843542795dd2e00fd645dce1ccb03ab93b3 --- /dev/null +++ b/codenet/public_test_cases/p02803/input.2.txt @@ -0,0 +1,4 @@ +3 5 +...#. +.#.#. +.#... diff --git a/codenet/public_test_cases/p02803/output.0.txt b/codenet/public_test_cases/p02803/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02803/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02803/output.1.txt b/codenet/public_test_cases/p02803/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02803/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02803/output.2.txt b/codenet/public_test_cases/p02803/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02803/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02804/input.0.txt b/codenet/public_test_cases/p02804/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74a7fec8758b34199cf1fc91ed94878f8e9b0ca3 --- /dev/null +++ b/codenet/public_test_cases/p02804/input.0.txt @@ -0,0 +1,2 @@ +4 2 +1 1 3 4 diff --git a/codenet/public_test_cases/p02804/input.1.txt b/codenet/public_test_cases/p02804/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a3cb9deb1f1eec4c5a3ca630865c8cb5dc11bc7 --- /dev/null +++ b/codenet/public_test_cases/p02804/input.1.txt @@ -0,0 +1,2 @@ +3 1 +1 1 1 diff --git a/codenet/public_test_cases/p02804/input.2.txt b/codenet/public_test_cases/p02804/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74a7fec8758b34199cf1fc91ed94878f8e9b0ca3 --- /dev/null +++ b/codenet/public_test_cases/p02804/input.2.txt @@ -0,0 +1,2 @@ +4 2 +1 1 3 4 diff --git a/codenet/public_test_cases/p02804/input.3.txt b/codenet/public_test_cases/p02804/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..698ed17170ad355f589e2a377e77c2c94620c852 --- /dev/null +++ b/codenet/public_test_cases/p02804/input.3.txt @@ -0,0 +1,2 @@ +10 6 +1000000000 1000000000 1000000000 1000000000 1000000000 0 0 0 0 0 diff --git a/codenet/public_test_cases/p02804/input.4.txt b/codenet/public_test_cases/p02804/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d029c886c7618018fb1a1f1d815b9204f6698f4 --- /dev/null +++ b/codenet/public_test_cases/p02804/input.4.txt @@ -0,0 +1,2 @@ +6 3 +10 10 10 -10 -10 -10 diff --git a/codenet/public_test_cases/p02804/output.0.txt b/codenet/public_test_cases/p02804/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02804/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02804/output.1.txt b/codenet/public_test_cases/p02804/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02804/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02804/output.2.txt b/codenet/public_test_cases/p02804/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02804/output.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02804/output.3.txt b/codenet/public_test_cases/p02804/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8794cc3e36fd12e4ade62bd09ae5eb0f916c96fd --- /dev/null +++ b/codenet/public_test_cases/p02804/output.3.txt @@ -0,0 +1 @@ +999998537 diff --git a/codenet/public_test_cases/p02804/output.4.txt b/codenet/public_test_cases/p02804/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2921a1584c758640f843bd701a9ef6a811dcac49 --- /dev/null +++ b/codenet/public_test_cases/p02804/output.4.txt @@ -0,0 +1 @@ +360 diff --git a/codenet/public_test_cases/p02805/input.0.txt b/codenet/public_test_cases/p02805/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b33e4a0d165defb199b74b1f461b8e41b20cd45 --- /dev/null +++ b/codenet/public_test_cases/p02805/input.0.txt @@ -0,0 +1,3 @@ +2 +0 0 +1 0 diff --git a/codenet/public_test_cases/p02805/input.1.txt b/codenet/public_test_cases/p02805/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea858fa58f0a5657638c17a89379c3474218e764 --- /dev/null +++ b/codenet/public_test_cases/p02805/input.1.txt @@ -0,0 +1,4 @@ +3 +0 0 +0 1 +1 0 diff --git a/codenet/public_test_cases/p02805/input.2.txt b/codenet/public_test_cases/p02805/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b33e4a0d165defb199b74b1f461b8e41b20cd45 --- /dev/null +++ b/codenet/public_test_cases/p02805/input.2.txt @@ -0,0 +1,3 @@ +2 +0 0 +1 0 diff --git a/codenet/public_test_cases/p02805/input.3.txt b/codenet/public_test_cases/p02805/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..421b96797a8ea5c8d8ec0c416375325a82b848d3 --- /dev/null +++ b/codenet/public_test_cases/p02805/input.3.txt @@ -0,0 +1,11 @@ +10 +10 9 +5 9 +2 0 +0 0 +2 7 +3 3 +2 5 +10 0 +3 7 +1 9 diff --git a/codenet/public_test_cases/p02805/output.0.txt b/codenet/public_test_cases/p02805/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d32f569ec745ec4199664968f9e2a1cb65400b8e --- /dev/null +++ b/codenet/public_test_cases/p02805/output.0.txt @@ -0,0 +1 @@ +0.500000000000000000 diff --git a/codenet/public_test_cases/p02805/output.1.txt b/codenet/public_test_cases/p02805/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..52867e4c88096c33e4a21b44ce201ad54cd6a4bb --- /dev/null +++ b/codenet/public_test_cases/p02805/output.1.txt @@ -0,0 +1 @@ +0.707106781186497524 diff --git a/codenet/public_test_cases/p02805/output.2.txt b/codenet/public_test_cases/p02805/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d32f569ec745ec4199664968f9e2a1cb65400b8e --- /dev/null +++ b/codenet/public_test_cases/p02805/output.2.txt @@ -0,0 +1 @@ +0.500000000000000000 diff --git a/codenet/public_test_cases/p02805/output.3.txt b/codenet/public_test_cases/p02805/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..eac1ac39a1cd4323509c0820d00f1f64f0c67bd0 --- /dev/null +++ b/codenet/public_test_cases/p02805/output.3.txt @@ -0,0 +1 @@ +6.726812023536805158 diff --git a/codenet/public_test_cases/p02806/input.0.txt b/codenet/public_test_cases/p02806/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0801415aea176aab1d9bbd3feda54f73a25c6d7b --- /dev/null +++ b/codenet/public_test_cases/p02806/input.0.txt @@ -0,0 +1,5 @@ +3 +dwango 2 +sixth 5 +prelims 25 +dwango diff --git a/codenet/public_test_cases/p02806/input.1.txt b/codenet/public_test_cases/p02806/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c156985013d2355fad5085f19e0ee77191a3352 --- /dev/null +++ b/codenet/public_test_cases/p02806/input.1.txt @@ -0,0 +1,17 @@ +15 +ypnxn 279 +kgjgwx 464 +qquhuwq 327 +rxing 549 +pmuduhznoaqu 832 +dagktgdarveusju 595 +wunfagppcoi 200 +dhavrncwfw 720 +jpcmigg 658 +wrczqxycivdqn 639 +mcmkkbnjfeod 992 +htqvkgkbhtytsz 130 +twflegsjz 467 +dswxxrxuzzfhkp 989 +szfwtzfpnscgue 958 +pmuduhznoaqu diff --git a/codenet/public_test_cases/p02806/input.2.txt b/codenet/public_test_cases/p02806/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0801415aea176aab1d9bbd3feda54f73a25c6d7b --- /dev/null +++ b/codenet/public_test_cases/p02806/input.2.txt @@ -0,0 +1,5 @@ +3 +dwango 2 +sixth 5 +prelims 25 +dwango diff --git a/codenet/public_test_cases/p02806/input.3.txt b/codenet/public_test_cases/p02806/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f26b50578ec335e650365c9efa33cd8e62ee8d42 --- /dev/null +++ b/codenet/public_test_cases/p02806/input.3.txt @@ -0,0 +1,3 @@ +1 +abcde 1000 +abcde diff --git a/codenet/public_test_cases/p02806/output.0.txt b/codenet/public_test_cases/p02806/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p02806/output.0.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p02806/output.1.txt b/codenet/public_test_cases/p02806/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dddbc7d813ade0eedb24dbbb6c5e99dbd03e8341 --- /dev/null +++ b/codenet/public_test_cases/p02806/output.1.txt @@ -0,0 +1 @@ +6348 diff --git a/codenet/public_test_cases/p02806/output.2.txt b/codenet/public_test_cases/p02806/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p02806/output.2.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p02806/output.3.txt b/codenet/public_test_cases/p02806/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02806/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02807/input.0.txt b/codenet/public_test_cases/p02807/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02807/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02807/input.1.txt b/codenet/public_test_cases/p02807/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..deb7d12371815744a08bb624b0c6d498be14cedf --- /dev/null +++ b/codenet/public_test_cases/p02807/input.1.txt @@ -0,0 +1,2 @@ +12 +161735902 211047202 430302156 450968417 628894325 707723857 731963982 822804784 880895728 923078537 971407775 982631932 diff --git a/codenet/public_test_cases/p02807/input.2.txt b/codenet/public_test_cases/p02807/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02807/input.2.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02807/output.0.txt b/codenet/public_test_cases/p02807/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02807/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02807/output.1.txt b/codenet/public_test_cases/p02807/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f835cfdf2e122cbfd499efba50b63fba98fbdd99 --- /dev/null +++ b/codenet/public_test_cases/p02807/output.1.txt @@ -0,0 +1 @@ +750927044 diff --git a/codenet/public_test_cases/p02807/output.2.txt b/codenet/public_test_cases/p02807/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02807/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02808/input.0.txt b/codenet/public_test_cases/p02808/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7df0488fce5e2fe7b80b6ffcca4e3d6ba3f17421 --- /dev/null +++ b/codenet/public_test_cases/p02808/input.0.txt @@ -0,0 +1,2 @@ +3 2 +3 2 diff --git a/codenet/public_test_cases/p02808/input.1.txt b/codenet/public_test_cases/p02808/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7df0488fce5e2fe7b80b6ffcca4e3d6ba3f17421 --- /dev/null +++ b/codenet/public_test_cases/p02808/input.1.txt @@ -0,0 +1,2 @@ +3 2 +3 2 diff --git a/codenet/public_test_cases/p02808/input.2.txt b/codenet/public_test_cases/p02808/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d470cc239cd9af6221a8ee3d25a13b13b845b5a7 --- /dev/null +++ b/codenet/public_test_cases/p02808/input.2.txt @@ -0,0 +1,2 @@ +856 16 +399 263 665 432 206 61 784 548 422 313 848 478 827 26 398 63 diff --git a/codenet/public_test_cases/p02808/output.0.txt b/codenet/public_test_cases/p02808/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02808/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02808/output.1.txt b/codenet/public_test_cases/p02808/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02808/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02808/output.2.txt b/codenet/public_test_cases/p02808/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f91c2c33f1588c615e0cce12bd1e6ad091cf395 --- /dev/null +++ b/codenet/public_test_cases/p02808/output.2.txt @@ -0,0 +1 @@ +337587117 diff --git a/codenet/public_test_cases/p02809/input.0.txt b/codenet/public_test_cases/p02809/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65c8e6bc51b9b68d4c4cc97544660e27a2dedd3d --- /dev/null +++ b/codenet/public_test_cases/p02809/input.0.txt @@ -0,0 +1,2 @@ +4 +2 3 4 1 diff --git a/codenet/public_test_cases/p02809/input.1.txt b/codenet/public_test_cases/p02809/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..65c8e6bc51b9b68d4c4cc97544660e27a2dedd3d --- /dev/null +++ b/codenet/public_test_cases/p02809/input.1.txt @@ -0,0 +1,2 @@ +4 +2 3 4 1 diff --git a/codenet/public_test_cases/p02809/input.2.txt b/codenet/public_test_cases/p02809/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cd4f58526b6a547080920f1f04b3d3a58b80b1 --- /dev/null +++ b/codenet/public_test_cases/p02809/input.2.txt @@ -0,0 +1,2 @@ +2 +2 1 diff --git a/codenet/public_test_cases/p02809/input.3.txt b/codenet/public_test_cases/p02809/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..12b3a9718e393c35eea34753d9b01311beee4308 --- /dev/null +++ b/codenet/public_test_cases/p02809/input.3.txt @@ -0,0 +1,2 @@ +13 +2 3 4 5 6 7 8 9 10 11 12 13 12 diff --git a/codenet/public_test_cases/p02809/output.0.txt b/codenet/public_test_cases/p02809/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1ad1e090b85316220fb5d57769b90e017a7d932 --- /dev/null +++ b/codenet/public_test_cases/p02809/output.0.txt @@ -0,0 +1 @@ +1 3 2 4 diff --git a/codenet/public_test_cases/p02809/output.1.txt b/codenet/public_test_cases/p02809/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1ad1e090b85316220fb5d57769b90e017a7d932 --- /dev/null +++ b/codenet/public_test_cases/p02809/output.1.txt @@ -0,0 +1 @@ +1 3 2 4 diff --git a/codenet/public_test_cases/p02809/output.2.txt b/codenet/public_test_cases/p02809/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02809/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02809/output.3.txt b/codenet/public_test_cases/p02809/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..71262d7713888f5ba3f50296e1c4da527bc1580b --- /dev/null +++ b/codenet/public_test_cases/p02809/output.3.txt @@ -0,0 +1 @@ +1 3 2 4 6 5 7 9 8 10 12 11 13 diff --git a/codenet/public_test_cases/p02810/input.0.txt b/codenet/public_test_cases/p02810/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d92de78bf202e3a75662041e24e992f85f327ff7 --- /dev/null +++ b/codenet/public_test_cases/p02810/input.0.txt @@ -0,0 +1,2 @@ +3 3 +1 1 2 diff --git a/codenet/public_test_cases/p02810/input.1.txt b/codenet/public_test_cases/p02810/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d92de78bf202e3a75662041e24e992f85f327ff7 --- /dev/null +++ b/codenet/public_test_cases/p02810/input.1.txt @@ -0,0 +1,2 @@ +3 3 +1 1 2 diff --git a/codenet/public_test_cases/p02810/input.2.txt b/codenet/public_test_cases/p02810/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b4a6681cba5d29a194f3d87840b1edb18fe3e33 --- /dev/null +++ b/codenet/public_test_cases/p02810/input.2.txt @@ -0,0 +1,2 @@ +18 477 +324 31 27 227 9 21 41 29 50 34 2 362 92 11 13 17 183 119 diff --git a/codenet/public_test_cases/p02810/output.0.txt b/codenet/public_test_cases/p02810/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02810/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02810/output.1.txt b/codenet/public_test_cases/p02810/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02810/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02810/output.2.txt b/codenet/public_test_cases/p02810/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3973f1e9e15a4fd431dbd38d9816c2ef186f3d9f --- /dev/null +++ b/codenet/public_test_cases/p02810/output.2.txt @@ -0,0 +1 @@ +134796357 diff --git a/codenet/public_test_cases/p02811/input.0.txt b/codenet/public_test_cases/p02811/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc445a88c751da8cf4dc1374e4b8db6cf329c45e --- /dev/null +++ b/codenet/public_test_cases/p02811/input.0.txt @@ -0,0 +1 @@ +2 900 diff --git a/codenet/public_test_cases/p02811/input.1.txt b/codenet/public_test_cases/p02811/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a035397251d2dc5405e8c83157f108bc0050d9b --- /dev/null +++ b/codenet/public_test_cases/p02811/input.1.txt @@ -0,0 +1 @@ +1 501 diff --git a/codenet/public_test_cases/p02811/input.2.txt b/codenet/public_test_cases/p02811/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d34db9fa6540966d0582d9a3ddff841679d1c34 --- /dev/null +++ b/codenet/public_test_cases/p02811/input.2.txt @@ -0,0 +1 @@ +4 2000 diff --git a/codenet/public_test_cases/p02811/input.3.txt b/codenet/public_test_cases/p02811/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc445a88c751da8cf4dc1374e4b8db6cf329c45e --- /dev/null +++ b/codenet/public_test_cases/p02811/input.3.txt @@ -0,0 +1 @@ +2 900 diff --git a/codenet/public_test_cases/p02811/output.0.txt b/codenet/public_test_cases/p02811/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02811/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02811/output.1.txt b/codenet/public_test_cases/p02811/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02811/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02811/output.2.txt b/codenet/public_test_cases/p02811/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02811/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02811/output.3.txt b/codenet/public_test_cases/p02811/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02811/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02812/input.0.txt b/codenet/public_test_cases/p02812/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2faa6e8d9ce5e88a3ef05fbaebe9f51e7edf4d62 --- /dev/null +++ b/codenet/public_test_cases/p02812/input.0.txt @@ -0,0 +1,2 @@ +10 +ZABCDBABCQ diff --git a/codenet/public_test_cases/p02812/input.1.txt b/codenet/public_test_cases/p02812/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..358f48d2a0c6bbe8d4dfc3b5cb2d047563e852c9 --- /dev/null +++ b/codenet/public_test_cases/p02812/input.1.txt @@ -0,0 +1,2 @@ +19 +THREEONEFOURONEFIVE diff --git a/codenet/public_test_cases/p02812/input.2.txt b/codenet/public_test_cases/p02812/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f52e5b056fac35f552ad0fa26faf522f26b517d --- /dev/null +++ b/codenet/public_test_cases/p02812/input.2.txt @@ -0,0 +1,2 @@ +33 +ABCCABCBABCCABACBCBBABCBCBCBCABCB diff --git a/codenet/public_test_cases/p02812/input.3.txt b/codenet/public_test_cases/p02812/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2faa6e8d9ce5e88a3ef05fbaebe9f51e7edf4d62 --- /dev/null +++ b/codenet/public_test_cases/p02812/input.3.txt @@ -0,0 +1,2 @@ +10 +ZABCDBABCQ diff --git a/codenet/public_test_cases/p02812/output.0.txt b/codenet/public_test_cases/p02812/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02812/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02812/output.1.txt b/codenet/public_test_cases/p02812/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02812/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02812/output.2.txt b/codenet/public_test_cases/p02812/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02812/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02812/output.3.txt b/codenet/public_test_cases/p02812/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02812/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02813/input.0.txt b/codenet/public_test_cases/p02813/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7d7c54611f9ce56140667255eb64bf55da8c78d --- /dev/null +++ b/codenet/public_test_cases/p02813/input.0.txt @@ -0,0 +1,3 @@ +3 +1 3 2 +3 1 2 diff --git a/codenet/public_test_cases/p02813/output.0.txt b/codenet/public_test_cases/p02813/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02813/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02814/input.0.txt b/codenet/public_test_cases/p02814/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f4ecffb45f12228d2e02654d99a43f43260cb07 --- /dev/null +++ b/codenet/public_test_cases/p02814/input.0.txt @@ -0,0 +1,2 @@ +2 50 +6 10 diff --git a/codenet/public_test_cases/p02814/input.1.txt b/codenet/public_test_cases/p02814/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..35004d8d62b87851d7eb8c5a437643f130c534bb --- /dev/null +++ b/codenet/public_test_cases/p02814/input.1.txt @@ -0,0 +1,2 @@ +3 100 +14 22 40 diff --git a/codenet/public_test_cases/p02814/input.2.txt b/codenet/public_test_cases/p02814/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f4ecffb45f12228d2e02654d99a43f43260cb07 --- /dev/null +++ b/codenet/public_test_cases/p02814/input.2.txt @@ -0,0 +1,2 @@ +2 50 +6 10 diff --git a/codenet/public_test_cases/p02814/input.3.txt b/codenet/public_test_cases/p02814/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8859f6fe0871f96e486141a60f2800ed3c2b0ff --- /dev/null +++ b/codenet/public_test_cases/p02814/input.3.txt @@ -0,0 +1,2 @@ +5 1000000000 +6 6 2 6 2 diff --git a/codenet/public_test_cases/p02814/output.0.txt b/codenet/public_test_cases/p02814/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02814/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02814/output.1.txt b/codenet/public_test_cases/p02814/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02814/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02814/output.2.txt b/codenet/public_test_cases/p02814/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02814/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02814/output.3.txt b/codenet/public_test_cases/p02814/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..71e7a829dc81e1b76e07c2095c00542cfb6a9d37 --- /dev/null +++ b/codenet/public_test_cases/p02814/output.3.txt @@ -0,0 +1 @@ +166666667 diff --git a/codenet/public_test_cases/p02815/input.0.txt b/codenet/public_test_cases/p02815/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8faee6e444a239b1e46632078e2c9378479346c1 --- /dev/null +++ b/codenet/public_test_cases/p02815/input.0.txt @@ -0,0 +1,2 @@ +1 +1000000000 diff --git a/codenet/public_test_cases/p02815/input.1.txt b/codenet/public_test_cases/p02815/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..06be5ff5a7b63a4b714d8d623e51e011f3b395e4 --- /dev/null +++ b/codenet/public_test_cases/p02815/input.1.txt @@ -0,0 +1,2 @@ +2 +5 8 diff --git a/codenet/public_test_cases/p02815/input.2.txt b/codenet/public_test_cases/p02815/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8faee6e444a239b1e46632078e2c9378479346c1 --- /dev/null +++ b/codenet/public_test_cases/p02815/input.2.txt @@ -0,0 +1,2 @@ +1 +1000000000 diff --git a/codenet/public_test_cases/p02815/input.3.txt b/codenet/public_test_cases/p02815/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3542695da84beb79bc43f3108485ed2b18f8476 --- /dev/null +++ b/codenet/public_test_cases/p02815/input.3.txt @@ -0,0 +1,2 @@ +5 +52 67 72 25 79 diff --git a/codenet/public_test_cases/p02815/output.0.txt b/codenet/public_test_cases/p02815/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..669ee40d523464ab418d5be1064a6f0b06833a56 --- /dev/null +++ b/codenet/public_test_cases/p02815/output.0.txt @@ -0,0 +1 @@ +999999993 diff --git a/codenet/public_test_cases/p02815/output.1.txt b/codenet/public_test_cases/p02815/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc902f4f956b349ac5763a01f37a53ee607614d5 --- /dev/null +++ b/codenet/public_test_cases/p02815/output.1.txt @@ -0,0 +1 @@ +124 diff --git a/codenet/public_test_cases/p02815/output.2.txt b/codenet/public_test_cases/p02815/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..669ee40d523464ab418d5be1064a6f0b06833a56 --- /dev/null +++ b/codenet/public_test_cases/p02815/output.2.txt @@ -0,0 +1 @@ +999999993 diff --git a/codenet/public_test_cases/p02815/output.3.txt b/codenet/public_test_cases/p02815/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1cefc0f91e327145e8e18ad4c37e0f9b35866b52 --- /dev/null +++ b/codenet/public_test_cases/p02815/output.3.txt @@ -0,0 +1 @@ +269312 diff --git a/codenet/public_test_cases/p02816/input.0.txt b/codenet/public_test_cases/p02816/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..222f8925a23a796d8f6e5c0bea8c8eb42d7ae908 --- /dev/null +++ b/codenet/public_test_cases/p02816/input.0.txt @@ -0,0 +1,3 @@ +3 +0 2 1 +1 2 3 diff --git a/codenet/public_test_cases/p02816/input.1.txt b/codenet/public_test_cases/p02816/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8b39eb8ae2d4f11ba3793fb8648b439047543a4 --- /dev/null +++ b/codenet/public_test_cases/p02816/input.1.txt @@ -0,0 +1,3 @@ +6 +0 1 3 7 6 4 +1 5 4 6 2 3 diff --git a/codenet/public_test_cases/p02816/input.2.txt b/codenet/public_test_cases/p02816/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..222f8925a23a796d8f6e5c0bea8c8eb42d7ae908 --- /dev/null +++ b/codenet/public_test_cases/p02816/input.2.txt @@ -0,0 +1,3 @@ +3 +0 2 1 +1 2 3 diff --git a/codenet/public_test_cases/p02816/input.3.txt b/codenet/public_test_cases/p02816/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ab46a6fb2f201e9f5bb16e6ce42833898409441 --- /dev/null +++ b/codenet/public_test_cases/p02816/input.3.txt @@ -0,0 +1,3 @@ +5 +0 0 0 0 0 +2 2 2 2 2 diff --git a/codenet/public_test_cases/p02816/output.0.txt b/codenet/public_test_cases/p02816/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p02816/output.0.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p02816/output.1.txt b/codenet/public_test_cases/p02816/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76d07f2a7b2c13688916ea592af1472c31ef3825 --- /dev/null +++ b/codenet/public_test_cases/p02816/output.1.txt @@ -0,0 +1,2 @@ +2 2 +5 5 diff --git a/codenet/public_test_cases/p02816/output.2.txt b/codenet/public_test_cases/p02816/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p02816/output.2.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p02816/output.3.txt b/codenet/public_test_cases/p02816/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..432a57266baa7e14e32941a593674660b9dd7ff3 --- /dev/null +++ b/codenet/public_test_cases/p02816/output.3.txt @@ -0,0 +1,5 @@ +0 2 +1 2 +2 2 +3 2 +4 2 diff --git a/codenet/public_test_cases/p02817/input.0.txt b/codenet/public_test_cases/p02817/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1875b1a8b6e7678507cb55545e66bddd8e78038b --- /dev/null +++ b/codenet/public_test_cases/p02817/input.0.txt @@ -0,0 +1 @@ +oder atc diff --git a/codenet/public_test_cases/p02817/input.1.txt b/codenet/public_test_cases/p02817/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9ce9aeedb93373aa4dd584b25b50bb56c3e399c --- /dev/null +++ b/codenet/public_test_cases/p02817/input.1.txt @@ -0,0 +1 @@ +humu humu diff --git a/codenet/public_test_cases/p02817/input.2.txt b/codenet/public_test_cases/p02817/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1875b1a8b6e7678507cb55545e66bddd8e78038b --- /dev/null +++ b/codenet/public_test_cases/p02817/input.2.txt @@ -0,0 +1 @@ +oder atc diff --git a/codenet/public_test_cases/p02817/output.0.txt b/codenet/public_test_cases/p02817/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ef13d11d0bc8c8cde49253ea4a0cdbea2c9416 --- /dev/null +++ b/codenet/public_test_cases/p02817/output.0.txt @@ -0,0 +1 @@ +atcoder diff --git a/codenet/public_test_cases/p02817/output.1.txt b/codenet/public_test_cases/p02817/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e7c459a9550bfdc6e9e33318eeddcaa2ce9d3d1 --- /dev/null +++ b/codenet/public_test_cases/p02817/output.1.txt @@ -0,0 +1 @@ +humuhumu diff --git a/codenet/public_test_cases/p02817/output.2.txt b/codenet/public_test_cases/p02817/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ef13d11d0bc8c8cde49253ea4a0cdbea2c9416 --- /dev/null +++ b/codenet/public_test_cases/p02817/output.2.txt @@ -0,0 +1 @@ +atcoder diff --git a/codenet/public_test_cases/p02818/input.0.txt b/codenet/public_test_cases/p02818/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87b289ecc8a6f6cbc339aa2359c84f4dd2f5afb1 --- /dev/null +++ b/codenet/public_test_cases/p02818/input.0.txt @@ -0,0 +1 @@ +2 3 3 diff --git a/codenet/public_test_cases/p02818/input.1.txt b/codenet/public_test_cases/p02818/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..84b895839b6e5ee4ba3f1e9e079600b45678bf99 --- /dev/null +++ b/codenet/public_test_cases/p02818/input.1.txt @@ -0,0 +1 @@ +500000000000 500000000000 1000000000000 diff --git a/codenet/public_test_cases/p02818/input.2.txt b/codenet/public_test_cases/p02818/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..87b289ecc8a6f6cbc339aa2359c84f4dd2f5afb1 --- /dev/null +++ b/codenet/public_test_cases/p02818/input.2.txt @@ -0,0 +1 @@ +2 3 3 diff --git a/codenet/public_test_cases/p02818/output.0.txt b/codenet/public_test_cases/p02818/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cd68b0dd8e84dec5d3cd53fda7e48b685be1b5 --- /dev/null +++ b/codenet/public_test_cases/p02818/output.0.txt @@ -0,0 +1 @@ +0 2 diff --git a/codenet/public_test_cases/p02818/output.1.txt b/codenet/public_test_cases/p02818/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b748e2dcfcbc7db3aae214293cef6cb2afbd0a65 --- /dev/null +++ b/codenet/public_test_cases/p02818/output.1.txt @@ -0,0 +1 @@ +0 0 diff --git a/codenet/public_test_cases/p02818/output.2.txt b/codenet/public_test_cases/p02818/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cd68b0dd8e84dec5d3cd53fda7e48b685be1b5 --- /dev/null +++ b/codenet/public_test_cases/p02818/output.2.txt @@ -0,0 +1 @@ +0 2 diff --git a/codenet/public_test_cases/p02819/input.0.txt b/codenet/public_test_cases/p02819/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p02819/input.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p02819/input.1.txt b/codenet/public_test_cases/p02819/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2aa8c1de3c5898b838a4d7d54dff6f17ebeba3c --- /dev/null +++ b/codenet/public_test_cases/p02819/input.1.txt @@ -0,0 +1 @@ +99992 diff --git a/codenet/public_test_cases/p02819/input.2.txt b/codenet/public_test_cases/p02819/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p02819/input.2.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p02819/input.3.txt b/codenet/public_test_cases/p02819/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02819/input.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02819/output.0.txt b/codenet/public_test_cases/p02819/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p02819/output.0.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p02819/output.1.txt b/codenet/public_test_cases/p02819/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8995c8026a78612e379cf6d5f97e98e86bdff5f6 --- /dev/null +++ b/codenet/public_test_cases/p02819/output.1.txt @@ -0,0 +1 @@ +100003 diff --git a/codenet/public_test_cases/p02819/output.2.txt b/codenet/public_test_cases/p02819/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p02819/output.2.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p02819/output.3.txt b/codenet/public_test_cases/p02819/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02819/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02820/input.0.txt b/codenet/public_test_cases/p02820/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91c4e506dfe6a6ba6a199ffcc1f715726498dfbe --- /dev/null +++ b/codenet/public_test_cases/p02820/input.0.txt @@ -0,0 +1,3 @@ +5 2 +8 7 6 +rsrpr diff --git a/codenet/public_test_cases/p02820/input.1.txt b/codenet/public_test_cases/p02820/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91c4e506dfe6a6ba6a199ffcc1f715726498dfbe --- /dev/null +++ b/codenet/public_test_cases/p02820/input.1.txt @@ -0,0 +1,3 @@ +5 2 +8 7 6 +rsrpr diff --git a/codenet/public_test_cases/p02820/input.2.txt b/codenet/public_test_cases/p02820/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..31c6461a65446afdae1227c246d252e6b1273ba0 --- /dev/null +++ b/codenet/public_test_cases/p02820/input.2.txt @@ -0,0 +1,3 @@ +7 1 +100 10 1 +ssssppr diff --git a/codenet/public_test_cases/p02820/input.3.txt b/codenet/public_test_cases/p02820/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..07d053068cf54ec9159d22fe92cb852122f7da3f --- /dev/null +++ b/codenet/public_test_cases/p02820/input.3.txt @@ -0,0 +1,3 @@ +30 5 +325 234 123 +rspsspspsrpspsppprpsprpssprpsr diff --git a/codenet/public_test_cases/p02820/output.0.txt b/codenet/public_test_cases/p02820/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p02820/output.0.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p02820/output.1.txt b/codenet/public_test_cases/p02820/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p02820/output.1.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p02820/output.2.txt b/codenet/public_test_cases/p02820/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dba40afcf75565d1816fae073dc8cd586aa8ab9c --- /dev/null +++ b/codenet/public_test_cases/p02820/output.2.txt @@ -0,0 +1 @@ +211 diff --git a/codenet/public_test_cases/p02820/output.3.txt b/codenet/public_test_cases/p02820/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1e5e60a1981ae608b66d47d18deb5ff4a4b4569 --- /dev/null +++ b/codenet/public_test_cases/p02820/output.3.txt @@ -0,0 +1 @@ +4996 diff --git a/codenet/public_test_cases/p02821/input.0.txt b/codenet/public_test_cases/p02821/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19b400438b17ae340aaadcb13a45ea2d56eca9ae --- /dev/null +++ b/codenet/public_test_cases/p02821/input.0.txt @@ -0,0 +1,2 @@ +5 3 +10 14 19 34 33 diff --git a/codenet/public_test_cases/p02821/input.1.txt b/codenet/public_test_cases/p02821/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19b400438b17ae340aaadcb13a45ea2d56eca9ae --- /dev/null +++ b/codenet/public_test_cases/p02821/input.1.txt @@ -0,0 +1,2 @@ +5 3 +10 14 19 34 33 diff --git a/codenet/public_test_cases/p02821/input.2.txt b/codenet/public_test_cases/p02821/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b470b6663a5d3c460816d4c1422672c34e76f4f --- /dev/null +++ b/codenet/public_test_cases/p02821/input.2.txt @@ -0,0 +1,2 @@ +9 14 +1 3 5 110 24 21 34 5 3 diff --git a/codenet/public_test_cases/p02821/input.3.txt b/codenet/public_test_cases/p02821/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5266a17923eee6ffbf51edf9ced4a423d57590b --- /dev/null +++ b/codenet/public_test_cases/p02821/input.3.txt @@ -0,0 +1,2 @@ +9 73 +67597 52981 5828 66249 75177 64141 40773 79105 16076 diff --git a/codenet/public_test_cases/p02821/output.0.txt b/codenet/public_test_cases/p02821/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f897c857d268654f8a6bd27629c6f809232e21d --- /dev/null +++ b/codenet/public_test_cases/p02821/output.0.txt @@ -0,0 +1 @@ +202 diff --git a/codenet/public_test_cases/p02821/output.1.txt b/codenet/public_test_cases/p02821/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f897c857d268654f8a6bd27629c6f809232e21d --- /dev/null +++ b/codenet/public_test_cases/p02821/output.1.txt @@ -0,0 +1 @@ +202 diff --git a/codenet/public_test_cases/p02821/output.2.txt b/codenet/public_test_cases/p02821/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..81435abd7870489c9fa642fab0eafce2b8c61995 --- /dev/null +++ b/codenet/public_test_cases/p02821/output.2.txt @@ -0,0 +1 @@ +1837 diff --git a/codenet/public_test_cases/p02821/output.3.txt b/codenet/public_test_cases/p02821/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a482a907c08921c2f9139ce1a759e44d79ff6c91 --- /dev/null +++ b/codenet/public_test_cases/p02821/output.3.txt @@ -0,0 +1 @@ +8128170 diff --git a/codenet/public_test_cases/p02822/input.0.txt b/codenet/public_test_cases/p02822/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p02822/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02822/input.1.txt b/codenet/public_test_cases/p02822/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..604c7b32caf077c090d1e568da712399ae45734a --- /dev/null +++ b/codenet/public_test_cases/p02822/input.1.txt @@ -0,0 +1,4 @@ +4 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p02822/input.2.txt b/codenet/public_test_cases/p02822/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e7e919d9086f19d0faf1800efb363a22b6e6b8 --- /dev/null +++ b/codenet/public_test_cases/p02822/input.2.txt @@ -0,0 +1,4 @@ +4 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p02822/input.3.txt b/codenet/public_test_cases/p02822/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..03fde12487278f7b8295fa574c09ed7e327040b2 --- /dev/null +++ b/codenet/public_test_cases/p02822/input.3.txt @@ -0,0 +1,7 @@ +7 +4 7 +3 1 +2 6 +5 2 +7 1 +2 7 diff --git a/codenet/public_test_cases/p02822/input.4.txt b/codenet/public_test_cases/p02822/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p02822/input.4.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02822/output.0.txt b/codenet/public_test_cases/p02822/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..610dc2827fbb62616b18323fe87d184bd497e73f --- /dev/null +++ b/codenet/public_test_cases/p02822/output.0.txt @@ -0,0 +1 @@ +125000001 diff --git a/codenet/public_test_cases/p02822/output.1.txt b/codenet/public_test_cases/p02822/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a28f7e08da6e53573636c06d59464eb13d6513c7 --- /dev/null +++ b/codenet/public_test_cases/p02822/output.1.txt @@ -0,0 +1 @@ +375000003 diff --git a/codenet/public_test_cases/p02822/output.2.txt b/codenet/public_test_cases/p02822/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c747149404e7d9b255bab8ef20dbbc78abfe01b --- /dev/null +++ b/codenet/public_test_cases/p02822/output.2.txt @@ -0,0 +1 @@ +250000002 diff --git a/codenet/public_test_cases/p02822/output.3.txt b/codenet/public_test_cases/p02822/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2023404afd6d62e2f23c6b9138f36e8969988d0a --- /dev/null +++ b/codenet/public_test_cases/p02822/output.3.txt @@ -0,0 +1 @@ +570312505 diff --git a/codenet/public_test_cases/p02822/output.4.txt b/codenet/public_test_cases/p02822/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..610dc2827fbb62616b18323fe87d184bd497e73f --- /dev/null +++ b/codenet/public_test_cases/p02822/output.4.txt @@ -0,0 +1 @@ +125000001 diff --git a/codenet/public_test_cases/p02823/input.0.txt b/codenet/public_test_cases/p02823/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37122f4bb8da7cdc63b02195266c286138058939 --- /dev/null +++ b/codenet/public_test_cases/p02823/input.0.txt @@ -0,0 +1 @@ +5 2 4 diff --git a/codenet/public_test_cases/p02823/input.1.txt b/codenet/public_test_cases/p02823/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bbd3b678987c5e8d18d7b434254bada5f2c9af48 --- /dev/null +++ b/codenet/public_test_cases/p02823/input.1.txt @@ -0,0 +1 @@ +5 2 3 diff --git a/codenet/public_test_cases/p02823/input.2.txt b/codenet/public_test_cases/p02823/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..37122f4bb8da7cdc63b02195266c286138058939 --- /dev/null +++ b/codenet/public_test_cases/p02823/input.2.txt @@ -0,0 +1 @@ +5 2 4 diff --git a/codenet/public_test_cases/p02823/output.0.txt b/codenet/public_test_cases/p02823/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02823/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02823/output.1.txt b/codenet/public_test_cases/p02823/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02823/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02823/output.2.txt b/codenet/public_test_cases/p02823/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02823/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02824/input.0.txt b/codenet/public_test_cases/p02824/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..145db6ad64b0f57707287fb33f756b4a102d5aa7 --- /dev/null +++ b/codenet/public_test_cases/p02824/input.0.txt @@ -0,0 +1,2 @@ +6 1 2 2 +2 1 1 3 0 2 diff --git a/codenet/public_test_cases/p02824/input.1.txt b/codenet/public_test_cases/p02824/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..145db6ad64b0f57707287fb33f756b4a102d5aa7 --- /dev/null +++ b/codenet/public_test_cases/p02824/input.1.txt @@ -0,0 +1,2 @@ +6 1 2 2 +2 1 1 3 0 2 diff --git a/codenet/public_test_cases/p02824/input.2.txt b/codenet/public_test_cases/p02824/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..459037509f005a826938d995b3a8db385d1d664d --- /dev/null +++ b/codenet/public_test_cases/p02824/input.2.txt @@ -0,0 +1,2 @@ +10 4 8 5 +7 2 3 6 1 6 5 4 6 5 diff --git a/codenet/public_test_cases/p02824/input.3.txt b/codenet/public_test_cases/p02824/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c055f08b4a2826138a0a73e8d527ef9bd41183f2 --- /dev/null +++ b/codenet/public_test_cases/p02824/input.3.txt @@ -0,0 +1,2 @@ +6 1 5 2 +2 1 1 3 0 2 diff --git a/codenet/public_test_cases/p02824/output.0.txt b/codenet/public_test_cases/p02824/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02824/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02824/output.1.txt b/codenet/public_test_cases/p02824/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02824/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02824/output.2.txt b/codenet/public_test_cases/p02824/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02824/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02824/output.3.txt b/codenet/public_test_cases/p02824/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02824/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02825/input.0.txt b/codenet/public_test_cases/p02825/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02825/input.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02825/input.1.txt b/codenet/public_test_cases/p02825/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02825/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02825/input.2.txt b/codenet/public_test_cases/p02825/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02825/input.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02825/output.0.txt b/codenet/public_test_cases/p02825/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9728dd0585249865772d538925ad299ca8fcf0e1 --- /dev/null +++ b/codenet/public_test_cases/p02825/output.0.txt @@ -0,0 +1,6 @@ +aabb.. +b..zz. +ba.... +.a..aa +..a..b +..a..b diff --git a/codenet/public_test_cases/p02825/output.1.txt b/codenet/public_test_cases/p02825/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02825/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02825/output.2.txt b/codenet/public_test_cases/p02825/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9728dd0585249865772d538925ad299ca8fcf0e1 --- /dev/null +++ b/codenet/public_test_cases/p02825/output.2.txt @@ -0,0 +1,6 @@ +aabb.. +b..zz. +ba.... +.a..aa +..a..b +..a..b diff --git a/codenet/public_test_cases/p02826/input.0.txt b/codenet/public_test_cases/p02826/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd977a1d53bc1506bc30ab6d858da4e6d725c307 --- /dev/null +++ b/codenet/public_test_cases/p02826/input.0.txt @@ -0,0 +1 @@ +2 998244353 diff --git a/codenet/public_test_cases/p02826/input.1.txt b/codenet/public_test_cases/p02826/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a5a407148d11e5f0b89b7f0fcb0a428c6a2db5d --- /dev/null +++ b/codenet/public_test_cases/p02826/input.1.txt @@ -0,0 +1 @@ +3 998244353 diff --git a/codenet/public_test_cases/p02826/input.2.txt b/codenet/public_test_cases/p02826/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..029a5aa0ceac729942cd494d4eaa51b162127178 --- /dev/null +++ b/codenet/public_test_cases/p02826/input.2.txt @@ -0,0 +1 @@ +96 925309799 diff --git a/codenet/public_test_cases/p02826/input.3.txt b/codenet/public_test_cases/p02826/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e19696c44748f57cf782d373d00ca120926fa72 --- /dev/null +++ b/codenet/public_test_cases/p02826/input.3.txt @@ -0,0 +1 @@ +6 966666661 diff --git a/codenet/public_test_cases/p02826/input.4.txt b/codenet/public_test_cases/p02826/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd977a1d53bc1506bc30ab6d858da4e6d725c307 --- /dev/null +++ b/codenet/public_test_cases/p02826/input.4.txt @@ -0,0 +1 @@ +2 998244353 diff --git a/codenet/public_test_cases/p02826/output.0.txt b/codenet/public_test_cases/p02826/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02826/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02826/output.1.txt b/codenet/public_test_cases/p02826/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02826/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02826/output.2.txt b/codenet/public_test_cases/p02826/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d5bebc5aa8319d615f6b98a1203390deda5b945 --- /dev/null +++ b/codenet/public_test_cases/p02826/output.2.txt @@ -0,0 +1 @@ +83779 diff --git a/codenet/public_test_cases/p02826/output.3.txt b/codenet/public_test_cases/p02826/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..69a893aa31141827125ddaaee26966b7aed3de74 --- /dev/null +++ b/codenet/public_test_cases/p02826/output.3.txt @@ -0,0 +1 @@ +66 diff --git a/codenet/public_test_cases/p02826/output.4.txt b/codenet/public_test_cases/p02826/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02826/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02827/input.0.txt b/codenet/public_test_cases/p02827/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cf27ad26c90b24f0255b626f0c55d10fbcf99c6 --- /dev/null +++ b/codenet/public_test_cases/p02827/input.0.txt @@ -0,0 +1,6 @@ +4 5 1 +1 3 +2 4 +1 2 +3 4 +2 3 diff --git a/codenet/public_test_cases/p02827/input.1.txt b/codenet/public_test_cases/p02827/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e60d196061117ea9ed1f630c1b5773d1931675af --- /dev/null +++ b/codenet/public_test_cases/p02827/input.1.txt @@ -0,0 +1,6 @@ +4 5 2 +1 3 +2 4 +1 2 +3 4 +2 3 diff --git a/codenet/public_test_cases/p02827/input.2.txt b/codenet/public_test_cases/p02827/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b9af3ed477376954f940bdbe40392f4b776431c --- /dev/null +++ b/codenet/public_test_cases/p02827/input.2.txt @@ -0,0 +1,2 @@ +3 1 1 +1 2 diff --git a/codenet/public_test_cases/p02827/input.3.txt b/codenet/public_test_cases/p02827/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..36a7afba5ee5de7ab56ca787ec49f5bb84bc4846 --- /dev/null +++ b/codenet/public_test_cases/p02827/input.3.txt @@ -0,0 +1,2 @@ +2 1 2 +1 2 diff --git a/codenet/public_test_cases/p02827/input.4.txt b/codenet/public_test_cases/p02827/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cf27ad26c90b24f0255b626f0c55d10fbcf99c6 --- /dev/null +++ b/codenet/public_test_cases/p02827/input.4.txt @@ -0,0 +1,6 @@ +4 5 1 +1 3 +2 4 +1 2 +3 4 +2 3 diff --git a/codenet/public_test_cases/p02827/output.0.txt b/codenet/public_test_cases/p02827/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32480a4ad8c3f0ccfe4fdcc0675d1d0c4dc861fe --- /dev/null +++ b/codenet/public_test_cases/p02827/output.0.txt @@ -0,0 +1 @@ +^^^^^ diff --git a/codenet/public_test_cases/p02827/output.1.txt b/codenet/public_test_cases/p02827/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b5063f976fdb9dd4c316424da78aa3c80b55e82 --- /dev/null +++ b/codenet/public_test_cases/p02827/output.1.txt @@ -0,0 +1 @@ +v^^^^ diff --git a/codenet/public_test_cases/p02827/output.2.txt b/codenet/public_test_cases/p02827/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02827/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02827/output.3.txt b/codenet/public_test_cases/p02827/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02827/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02827/output.4.txt b/codenet/public_test_cases/p02827/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..32480a4ad8c3f0ccfe4fdcc0675d1d0c4dc861fe --- /dev/null +++ b/codenet/public_test_cases/p02827/output.4.txt @@ -0,0 +1 @@ +^^^^^ diff --git a/codenet/public_test_cases/p02828/input.0.txt b/codenet/public_test_cases/p02828/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d7778566a9ec2edc1aef3405376f39389487c9f --- /dev/null +++ b/codenet/public_test_cases/p02828/input.0.txt @@ -0,0 +1,2 @@ +2 +2 2 diff --git a/codenet/public_test_cases/p02828/input.1.txt b/codenet/public_test_cases/p02828/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a13dca6f4fb565d941862eeb0f5d91542ae335e7 --- /dev/null +++ b/codenet/public_test_cases/p02828/input.1.txt @@ -0,0 +1,2 @@ +10 +4 7 4 8 4 6 8 2 3 6 diff --git a/codenet/public_test_cases/p02828/input.2.txt b/codenet/public_test_cases/p02828/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b98c7f17e7bf6f9308820cb5bd0a09248347a1d --- /dev/null +++ b/codenet/public_test_cases/p02828/input.2.txt @@ -0,0 +1,2 @@ +3 +2 1 2 diff --git a/codenet/public_test_cases/p02828/input.3.txt b/codenet/public_test_cases/p02828/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d7778566a9ec2edc1aef3405376f39389487c9f --- /dev/null +++ b/codenet/public_test_cases/p02828/input.3.txt @@ -0,0 +1,2 @@ +2 +2 2 diff --git a/codenet/public_test_cases/p02828/input.4.txt b/codenet/public_test_cases/p02828/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..99abac0fbdd8b65da75ebdf15db89f3fabb0b601 --- /dev/null +++ b/codenet/public_test_cases/p02828/input.4.txt @@ -0,0 +1,2 @@ +4 +1 2 4 1 diff --git a/codenet/public_test_cases/p02828/output.0.txt b/codenet/public_test_cases/p02828/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02828/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02828/output.1.txt b/codenet/public_test_cases/p02828/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76542df7eea1d5684bbe81ef30f625f1bd723f8f --- /dev/null +++ b/codenet/public_test_cases/p02828/output.1.txt @@ -0,0 +1 @@ +263244071 diff --git a/codenet/public_test_cases/p02828/output.2.txt b/codenet/public_test_cases/p02828/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p02828/output.2.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p02828/output.3.txt b/codenet/public_test_cases/p02828/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02828/output.3.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02828/output.4.txt b/codenet/public_test_cases/p02828/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bc92d44ac9d8a185fa33dec183c593d71d79372 --- /dev/null +++ b/codenet/public_test_cases/p02828/output.4.txt @@ -0,0 +1 @@ +201 diff --git a/codenet/public_test_cases/p02829/input.0.txt b/codenet/public_test_cases/p02829/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p02829/input.0.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p02829/input.1.txt b/codenet/public_test_cases/p02829/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1191247b6d9a206f6ba3d8ac79e26d041dd86941 --- /dev/null +++ b/codenet/public_test_cases/p02829/input.1.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/codenet/public_test_cases/p02829/input.2.txt b/codenet/public_test_cases/p02829/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p02829/input.2.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p02829/output.0.txt b/codenet/public_test_cases/p02829/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02829/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02829/output.1.txt b/codenet/public_test_cases/p02829/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02829/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02829/output.2.txt b/codenet/public_test_cases/p02829/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02829/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02830/input.0.txt b/codenet/public_test_cases/p02830/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7991245a0312e8ac7eff18d81a6ee53c71780ff5 --- /dev/null +++ b/codenet/public_test_cases/p02830/input.0.txt @@ -0,0 +1,2 @@ +2 +ip cc diff --git a/codenet/public_test_cases/p02830/input.1.txt b/codenet/public_test_cases/p02830/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7991245a0312e8ac7eff18d81a6ee53c71780ff5 --- /dev/null +++ b/codenet/public_test_cases/p02830/input.1.txt @@ -0,0 +1,2 @@ +2 +ip cc diff --git a/codenet/public_test_cases/p02830/input.2.txt b/codenet/public_test_cases/p02830/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee26e5b1fa2d2dea2503c593de0439f7c5271e1f --- /dev/null +++ b/codenet/public_test_cases/p02830/input.2.txt @@ -0,0 +1,2 @@ +8 +hmhmnknk uuuuuuuu diff --git a/codenet/public_test_cases/p02830/input.3.txt b/codenet/public_test_cases/p02830/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d18859107c366211c6966a49b61f3d515c36f9a7 --- /dev/null +++ b/codenet/public_test_cases/p02830/input.3.txt @@ -0,0 +1,2 @@ +5 +aaaaa aaaaa diff --git a/codenet/public_test_cases/p02830/output.0.txt b/codenet/public_test_cases/p02830/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64018ccc57118406dba49cf6f0ce63ae2466b806 --- /dev/null +++ b/codenet/public_test_cases/p02830/output.0.txt @@ -0,0 +1 @@ +icpc diff --git a/codenet/public_test_cases/p02830/output.1.txt b/codenet/public_test_cases/p02830/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64018ccc57118406dba49cf6f0ce63ae2466b806 --- /dev/null +++ b/codenet/public_test_cases/p02830/output.1.txt @@ -0,0 +1 @@ +icpc diff --git a/codenet/public_test_cases/p02830/output.2.txt b/codenet/public_test_cases/p02830/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8b78937502fc7fca4450de7b05a510012caaf58 --- /dev/null +++ b/codenet/public_test_cases/p02830/output.2.txt @@ -0,0 +1 @@ +humuhumunukunuku diff --git a/codenet/public_test_cases/p02830/output.3.txt b/codenet/public_test_cases/p02830/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..69dd9b9dc4d109a772ad9c6fc66548f9130cd487 --- /dev/null +++ b/codenet/public_test_cases/p02830/output.3.txt @@ -0,0 +1 @@ +aaaaaaaaaa diff --git a/codenet/public_test_cases/p02831/input.0.txt b/codenet/public_test_cases/p02831/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02831/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02831/input.1.txt b/codenet/public_test_cases/p02831/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..940dd55810ca6f32fe5c6d9962ad1f72899c3c0d --- /dev/null +++ b/codenet/public_test_cases/p02831/input.1.txt @@ -0,0 +1 @@ +100000 99999 diff --git a/codenet/public_test_cases/p02831/input.2.txt b/codenet/public_test_cases/p02831/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..04fc88335369301f43329074a6a6c2bd97cd7d1f --- /dev/null +++ b/codenet/public_test_cases/p02831/input.2.txt @@ -0,0 +1 @@ +123 456 diff --git a/codenet/public_test_cases/p02831/input.3.txt b/codenet/public_test_cases/p02831/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02831/input.3.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02831/output.0.txt b/codenet/public_test_cases/p02831/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02831/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02831/output.1.txt b/codenet/public_test_cases/p02831/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c5b24fca1eb8075ec8e5bc963e55733925c341e --- /dev/null +++ b/codenet/public_test_cases/p02831/output.1.txt @@ -0,0 +1 @@ +9999900000 diff --git a/codenet/public_test_cases/p02831/output.2.txt b/codenet/public_test_cases/p02831/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8688021bf46f7d61a8dc73e35ac6cba460d4bb0d --- /dev/null +++ b/codenet/public_test_cases/p02831/output.2.txt @@ -0,0 +1 @@ +18696 diff --git a/codenet/public_test_cases/p02831/output.3.txt b/codenet/public_test_cases/p02831/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02831/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02832/input.0.txt b/codenet/public_test_cases/p02832/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b98c7f17e7bf6f9308820cb5bd0a09248347a1d --- /dev/null +++ b/codenet/public_test_cases/p02832/input.0.txt @@ -0,0 +1,2 @@ +3 +2 1 2 diff --git a/codenet/public_test_cases/p02832/input.1.txt b/codenet/public_test_cases/p02832/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7de66e6d61c2f227c6978ef84b34d8e28eeb6bfe --- /dev/null +++ b/codenet/public_test_cases/p02832/input.1.txt @@ -0,0 +1,2 @@ +3 +2 2 2 diff --git a/codenet/public_test_cases/p02832/input.2.txt b/codenet/public_test_cases/p02832/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f63eb2bbdec3e47773eb4084d4df93d9305f9655 --- /dev/null +++ b/codenet/public_test_cases/p02832/input.2.txt @@ -0,0 +1,2 @@ +10 +3 1 4 1 5 9 2 6 5 3 diff --git a/codenet/public_test_cases/p02832/input.3.txt b/codenet/public_test_cases/p02832/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p02832/input.3.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p02832/input.4.txt b/codenet/public_test_cases/p02832/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b98c7f17e7bf6f9308820cb5bd0a09248347a1d --- /dev/null +++ b/codenet/public_test_cases/p02832/input.4.txt @@ -0,0 +1,2 @@ +3 +2 1 2 diff --git a/codenet/public_test_cases/p02832/output.0.txt b/codenet/public_test_cases/p02832/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02832/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02832/output.1.txt b/codenet/public_test_cases/p02832/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02832/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02832/output.2.txt b/codenet/public_test_cases/p02832/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02832/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02832/output.3.txt b/codenet/public_test_cases/p02832/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02832/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02832/output.4.txt b/codenet/public_test_cases/p02832/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02832/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02833/input.0.txt b/codenet/public_test_cases/p02833/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02833/input.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02833/input.1.txt b/codenet/public_test_cases/p02833/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a4149f568ebd1c601c9657a0e51a097d0c2703 --- /dev/null +++ b/codenet/public_test_cases/p02833/input.1.txt @@ -0,0 +1 @@ +1000000000000000000 diff --git a/codenet/public_test_cases/p02833/input.2.txt b/codenet/public_test_cases/p02833/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02833/input.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02833/input.3.txt b/codenet/public_test_cases/p02833/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02833/input.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02833/output.0.txt b/codenet/public_test_cases/p02833/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02833/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02833/output.1.txt b/codenet/public_test_cases/p02833/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..22eb5d726676c91a20efe67bba084df69976fcbd --- /dev/null +++ b/codenet/public_test_cases/p02833/output.1.txt @@ -0,0 +1 @@ +124999999999999995 diff --git a/codenet/public_test_cases/p02833/output.2.txt b/codenet/public_test_cases/p02833/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02833/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02833/output.3.txt b/codenet/public_test_cases/p02833/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02833/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02834/input.0.txt b/codenet/public_test_cases/p02834/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de056cb6d97caaf6d20a6a10c7bbbfd558ca17e3 --- /dev/null +++ b/codenet/public_test_cases/p02834/input.0.txt @@ -0,0 +1,5 @@ +5 4 1 +1 2 +2 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p02834/input.1.txt b/codenet/public_test_cases/p02834/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..36a7afba5ee5de7ab56ca787ec49f5bb84bc4846 --- /dev/null +++ b/codenet/public_test_cases/p02834/input.1.txt @@ -0,0 +1,2 @@ +2 1 2 +1 2 diff --git a/codenet/public_test_cases/p02834/input.2.txt b/codenet/public_test_cases/p02834/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0af6c235f08ae17c85692a7709e09f5ed11d212 --- /dev/null +++ b/codenet/public_test_cases/p02834/input.2.txt @@ -0,0 +1,5 @@ +5 4 5 +1 2 +1 3 +1 4 +1 5 diff --git a/codenet/public_test_cases/p02834/input.3.txt b/codenet/public_test_cases/p02834/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..de056cb6d97caaf6d20a6a10c7bbbfd558ca17e3 --- /dev/null +++ b/codenet/public_test_cases/p02834/input.3.txt @@ -0,0 +1,5 @@ +5 4 1 +1 2 +2 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p02834/input.4.txt b/codenet/public_test_cases/p02834/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..125dfe72a1b0414181a29599dfa7db6112b77e90 --- /dev/null +++ b/codenet/public_test_cases/p02834/input.4.txt @@ -0,0 +1,9 @@ +9 6 1 +1 2 +2 3 +3 4 +4 5 +5 6 +4 7 +7 8 +8 9 diff --git a/codenet/public_test_cases/p02834/output.0.txt b/codenet/public_test_cases/p02834/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02834/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02834/output.1.txt b/codenet/public_test_cases/p02834/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02834/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02834/output.2.txt b/codenet/public_test_cases/p02834/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02834/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02834/output.3.txt b/codenet/public_test_cases/p02834/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02834/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02834/output.4.txt b/codenet/public_test_cases/p02834/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02834/output.4.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02835/input.0.txt b/codenet/public_test_cases/p02835/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2739135cb555fba8650c355efc7c7fd11522f6c6 --- /dev/null +++ b/codenet/public_test_cases/p02835/input.0.txt @@ -0,0 +1 @@ +5 7 9 diff --git a/codenet/public_test_cases/p02835/input.1.txt b/codenet/public_test_cases/p02835/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2739135cb555fba8650c355efc7c7fd11522f6c6 --- /dev/null +++ b/codenet/public_test_cases/p02835/input.1.txt @@ -0,0 +1 @@ +5 7 9 diff --git a/codenet/public_test_cases/p02835/input.2.txt b/codenet/public_test_cases/p02835/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa6412567deb8e01cf8ae777f28305369d748a0e --- /dev/null +++ b/codenet/public_test_cases/p02835/input.2.txt @@ -0,0 +1 @@ +13 7 2 diff --git a/codenet/public_test_cases/p02835/output.0.txt b/codenet/public_test_cases/p02835/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58382f8c03ab8e8d916fca122e8a0f36d7fd4b7b --- /dev/null +++ b/codenet/public_test_cases/p02835/output.0.txt @@ -0,0 +1 @@ +win diff --git a/codenet/public_test_cases/p02835/output.1.txt b/codenet/public_test_cases/p02835/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58382f8c03ab8e8d916fca122e8a0f36d7fd4b7b --- /dev/null +++ b/codenet/public_test_cases/p02835/output.1.txt @@ -0,0 +1 @@ +win diff --git a/codenet/public_test_cases/p02835/output.2.txt b/codenet/public_test_cases/p02835/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd8220a266228e5ced3e8d06dcd134bccef857c4 --- /dev/null +++ b/codenet/public_test_cases/p02835/output.2.txt @@ -0,0 +1 @@ +bust diff --git a/codenet/public_test_cases/p02836/input.0.txt b/codenet/public_test_cases/p02836/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fa37f33479cf2a9899c24a7806295fca45e2de6 --- /dev/null +++ b/codenet/public_test_cases/p02836/input.0.txt @@ -0,0 +1 @@ +redcoder diff --git a/codenet/public_test_cases/p02836/input.1.txt b/codenet/public_test_cases/p02836/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..591d0285c49517c647fed28c697ca8e15afa5f67 --- /dev/null +++ b/codenet/public_test_cases/p02836/input.1.txt @@ -0,0 +1 @@ +abcdabc diff --git a/codenet/public_test_cases/p02836/input.2.txt b/codenet/public_test_cases/p02836/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fa37f33479cf2a9899c24a7806295fca45e2de6 --- /dev/null +++ b/codenet/public_test_cases/p02836/input.2.txt @@ -0,0 +1 @@ +redcoder diff --git a/codenet/public_test_cases/p02836/input.3.txt b/codenet/public_test_cases/p02836/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7d30e2e97be1786017c33711dda17bb01ef5c60 --- /dev/null +++ b/codenet/public_test_cases/p02836/input.3.txt @@ -0,0 +1 @@ +vvvvvv diff --git a/codenet/public_test_cases/p02836/output.0.txt b/codenet/public_test_cases/p02836/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02836/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02836/output.1.txt b/codenet/public_test_cases/p02836/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02836/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02836/output.2.txt b/codenet/public_test_cases/p02836/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02836/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02836/output.3.txt b/codenet/public_test_cases/p02836/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02836/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02837/input.0.txt b/codenet/public_test_cases/p02837/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4fb51e8bd07d7aef52762ef325378eeccc085dd --- /dev/null +++ b/codenet/public_test_cases/p02837/input.0.txt @@ -0,0 +1,7 @@ +3 +1 +2 1 +1 +1 1 +1 +2 0 diff --git a/codenet/public_test_cases/p02837/input.1.txt b/codenet/public_test_cases/p02837/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12e46999c87fb2c9081a739449dc3cd67f4d5ff9 --- /dev/null +++ b/codenet/public_test_cases/p02837/input.1.txt @@ -0,0 +1,10 @@ +3 +2 +2 1 +3 0 +2 +3 1 +1 0 +2 +1 1 +2 0 diff --git a/codenet/public_test_cases/p02837/input.2.txt b/codenet/public_test_cases/p02837/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4fb51e8bd07d7aef52762ef325378eeccc085dd --- /dev/null +++ b/codenet/public_test_cases/p02837/input.2.txt @@ -0,0 +1,7 @@ +3 +1 +2 1 +1 +1 1 +1 +2 0 diff --git a/codenet/public_test_cases/p02837/input.3.txt b/codenet/public_test_cases/p02837/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4711c6dc7a197e5569f370075efbf8e2e0b52b19 --- /dev/null +++ b/codenet/public_test_cases/p02837/input.3.txt @@ -0,0 +1,5 @@ +2 +1 +2 0 +1 +1 0 diff --git a/codenet/public_test_cases/p02837/output.0.txt b/codenet/public_test_cases/p02837/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02837/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02837/output.1.txt b/codenet/public_test_cases/p02837/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02837/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02837/output.2.txt b/codenet/public_test_cases/p02837/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02837/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02837/output.3.txt b/codenet/public_test_cases/p02837/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02837/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02838/input.0.txt b/codenet/public_test_cases/p02838/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02838/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02838/input.1.txt b/codenet/public_test_cases/p02838/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02838/input.1.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02838/input.2.txt b/codenet/public_test_cases/p02838/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45c8ae40a93b05debb8ad01172446868df122fa3 --- /dev/null +++ b/codenet/public_test_cases/p02838/input.2.txt @@ -0,0 +1,2 @@ +10 +3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820 diff --git a/codenet/public_test_cases/p02838/input.3.txt b/codenet/public_test_cases/p02838/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f63eb2bbdec3e47773eb4084d4df93d9305f9655 --- /dev/null +++ b/codenet/public_test_cases/p02838/input.3.txt @@ -0,0 +1,2 @@ +10 +3 1 4 1 5 9 2 6 5 3 diff --git a/codenet/public_test_cases/p02838/output.0.txt b/codenet/public_test_cases/p02838/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02838/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02838/output.1.txt b/codenet/public_test_cases/p02838/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02838/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02838/output.2.txt b/codenet/public_test_cases/p02838/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd5cf5f915129470e7649276aad3578d0fb87e0 --- /dev/null +++ b/codenet/public_test_cases/p02838/output.2.txt @@ -0,0 +1 @@ +103715602 diff --git a/codenet/public_test_cases/p02838/output.3.txt b/codenet/public_test_cases/p02838/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..997def452ad96d87b7f147a20cc4bd3e9a084996 --- /dev/null +++ b/codenet/public_test_cases/p02838/output.3.txt @@ -0,0 +1 @@ +237 diff --git a/codenet/public_test_cases/p02839/input.0.txt b/codenet/public_test_cases/p02839/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..16f9f3f5f2f39b2757e9d75849eacda3aa6023aa --- /dev/null +++ b/codenet/public_test_cases/p02839/input.0.txt @@ -0,0 +1,5 @@ +2 2 +1 2 +3 4 +3 4 +2 1 diff --git a/codenet/public_test_cases/p02839/input.1.txt b/codenet/public_test_cases/p02839/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..16f9f3f5f2f39b2757e9d75849eacda3aa6023aa --- /dev/null +++ b/codenet/public_test_cases/p02839/input.1.txt @@ -0,0 +1,5 @@ +2 2 +1 2 +3 4 +3 4 +2 1 diff --git a/codenet/public_test_cases/p02839/input.2.txt b/codenet/public_test_cases/p02839/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..51d06be724fcb986fe7c19bacf323cbdf727d48f --- /dev/null +++ b/codenet/public_test_cases/p02839/input.2.txt @@ -0,0 +1,5 @@ +2 3 +1 10 80 +80 10 1 +1 2 3 +4 5 6 diff --git a/codenet/public_test_cases/p02839/output.0.txt b/codenet/public_test_cases/p02839/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02839/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02839/output.1.txt b/codenet/public_test_cases/p02839/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02839/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02839/output.2.txt b/codenet/public_test_cases/p02839/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02839/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02840/input.0.txt b/codenet/public_test_cases/p02840/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21cac6eb038393006667bf4fe7ef61b730aeadb1 --- /dev/null +++ b/codenet/public_test_cases/p02840/input.0.txt @@ -0,0 +1 @@ +3 4 2 diff --git a/codenet/public_test_cases/p02840/input.1.txt b/codenet/public_test_cases/p02840/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7f33c529ee8671bee2a34883a1e4226146b39d6 --- /dev/null +++ b/codenet/public_test_cases/p02840/input.1.txt @@ -0,0 +1 @@ +2 3 -3 diff --git a/codenet/public_test_cases/p02840/input.2.txt b/codenet/public_test_cases/p02840/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..21cac6eb038393006667bf4fe7ef61b730aeadb1 --- /dev/null +++ b/codenet/public_test_cases/p02840/input.2.txt @@ -0,0 +1 @@ +3 4 2 diff --git a/codenet/public_test_cases/p02840/input.3.txt b/codenet/public_test_cases/p02840/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf1171dd5d0f024c5bcc269d3f6c612a17a2bd5f --- /dev/null +++ b/codenet/public_test_cases/p02840/input.3.txt @@ -0,0 +1 @@ +100 14 20 diff --git a/codenet/public_test_cases/p02840/output.0.txt b/codenet/public_test_cases/p02840/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02840/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02840/output.1.txt b/codenet/public_test_cases/p02840/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02840/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02840/output.2.txt b/codenet/public_test_cases/p02840/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02840/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02840/output.3.txt b/codenet/public_test_cases/p02840/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..85d09bd083d4929462e6c49dab56c74b8c99b454 --- /dev/null +++ b/codenet/public_test_cases/p02840/output.3.txt @@ -0,0 +1 @@ +49805 diff --git a/codenet/public_test_cases/p02841/input.0.txt b/codenet/public_test_cases/p02841/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb06f227c5b9bf96cfcd0c04eba57fdb4d6e4614 --- /dev/null +++ b/codenet/public_test_cases/p02841/input.0.txt @@ -0,0 +1,2 @@ +11 16 +11 17 diff --git a/codenet/public_test_cases/p02841/input.1.txt b/codenet/public_test_cases/p02841/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb06f227c5b9bf96cfcd0c04eba57fdb4d6e4614 --- /dev/null +++ b/codenet/public_test_cases/p02841/input.1.txt @@ -0,0 +1,2 @@ +11 16 +11 17 diff --git a/codenet/public_test_cases/p02841/input.2.txt b/codenet/public_test_cases/p02841/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0391a13c834cef18b5c1633e37f9a7387947e0f --- /dev/null +++ b/codenet/public_test_cases/p02841/input.2.txt @@ -0,0 +1,2 @@ +11 30 +12 1 diff --git a/codenet/public_test_cases/p02841/output.0.txt b/codenet/public_test_cases/p02841/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02841/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02841/output.1.txt b/codenet/public_test_cases/p02841/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02841/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02841/output.2.txt b/codenet/public_test_cases/p02841/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02841/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02842/input.0.txt b/codenet/public_test_cases/p02842/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..84796bf1c0b277179fedb404aece03a9267a53d9 --- /dev/null +++ b/codenet/public_test_cases/p02842/input.0.txt @@ -0,0 +1 @@ +432 diff --git a/codenet/public_test_cases/p02842/input.1.txt b/codenet/public_test_cases/p02842/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd11724042e28f013e4fee09715b24c1b9ab10d1 --- /dev/null +++ b/codenet/public_test_cases/p02842/input.1.txt @@ -0,0 +1 @@ +1001 diff --git a/codenet/public_test_cases/p02842/input.2.txt b/codenet/public_test_cases/p02842/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..41495a483551d7c6e8a598e9f66d11a7c195d870 --- /dev/null +++ b/codenet/public_test_cases/p02842/input.2.txt @@ -0,0 +1 @@ +1079 diff --git a/codenet/public_test_cases/p02842/input.3.txt b/codenet/public_test_cases/p02842/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..84796bf1c0b277179fedb404aece03a9267a53d9 --- /dev/null +++ b/codenet/public_test_cases/p02842/input.3.txt @@ -0,0 +1 @@ +432 diff --git a/codenet/public_test_cases/p02842/output.0.txt b/codenet/public_test_cases/p02842/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d411bb7c1acabe5edc652eb910b74ab77be9dd3d --- /dev/null +++ b/codenet/public_test_cases/p02842/output.0.txt @@ -0,0 +1 @@ +400 diff --git a/codenet/public_test_cases/p02842/output.1.txt b/codenet/public_test_cases/p02842/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..866faa8c21470bb6754ae850acb54fca4afd6e0d --- /dev/null +++ b/codenet/public_test_cases/p02842/output.1.txt @@ -0,0 +1 @@ +927 diff --git a/codenet/public_test_cases/p02842/output.2.txt b/codenet/public_test_cases/p02842/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1504ea7bfc17cea50e6965a20bcd0579931ce040 --- /dev/null +++ b/codenet/public_test_cases/p02842/output.2.txt @@ -0,0 +1 @@ +:( diff --git a/codenet/public_test_cases/p02842/output.3.txt b/codenet/public_test_cases/p02842/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d411bb7c1acabe5edc652eb910b74ab77be9dd3d --- /dev/null +++ b/codenet/public_test_cases/p02842/output.3.txt @@ -0,0 +1 @@ +400 diff --git a/codenet/public_test_cases/p02843/input.0.txt b/codenet/public_test_cases/p02843/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11a42ac27e35129220c2dc82cec6cf9c5e9f7e89 --- /dev/null +++ b/codenet/public_test_cases/p02843/input.0.txt @@ -0,0 +1 @@ +615 diff --git a/codenet/public_test_cases/p02843/input.1.txt b/codenet/public_test_cases/p02843/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11a42ac27e35129220c2dc82cec6cf9c5e9f7e89 --- /dev/null +++ b/codenet/public_test_cases/p02843/input.1.txt @@ -0,0 +1 @@ +615 diff --git a/codenet/public_test_cases/p02843/input.2.txt b/codenet/public_test_cases/p02843/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ddd619ce324e5504d2b8485e18bded06360cc35 --- /dev/null +++ b/codenet/public_test_cases/p02843/input.2.txt @@ -0,0 +1 @@ +217 diff --git a/codenet/public_test_cases/p02843/output.0.txt b/codenet/public_test_cases/p02843/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02843/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02843/output.1.txt b/codenet/public_test_cases/p02843/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02843/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02843/output.2.txt b/codenet/public_test_cases/p02843/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02843/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02844/input.0.txt b/codenet/public_test_cases/p02844/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05923e68c7f30c3e8cd99a936c34040ec748c2ec --- /dev/null +++ b/codenet/public_test_cases/p02844/input.0.txt @@ -0,0 +1,2 @@ +4 +0224 diff --git a/codenet/public_test_cases/p02844/input.1.txt b/codenet/public_test_cases/p02844/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05923e68c7f30c3e8cd99a936c34040ec748c2ec --- /dev/null +++ b/codenet/public_test_cases/p02844/input.1.txt @@ -0,0 +1,2 @@ +4 +0224 diff --git a/codenet/public_test_cases/p02844/input.2.txt b/codenet/public_test_cases/p02844/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c266d08bc97e278bfd08f3c04bc12d868b0162b2 --- /dev/null +++ b/codenet/public_test_cases/p02844/input.2.txt @@ -0,0 +1,2 @@ +6 +123123 diff --git a/codenet/public_test_cases/p02844/input.3.txt b/codenet/public_test_cases/p02844/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..28cf1f362d9b305168c30a15154e4dbe96542505 --- /dev/null +++ b/codenet/public_test_cases/p02844/input.3.txt @@ -0,0 +1,2 @@ +19 +3141592653589793238 diff --git a/codenet/public_test_cases/p02844/output.0.txt b/codenet/public_test_cases/p02844/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02844/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02844/output.1.txt b/codenet/public_test_cases/p02844/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02844/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02844/output.2.txt b/codenet/public_test_cases/p02844/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p02844/output.2.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p02844/output.3.txt b/codenet/public_test_cases/p02844/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6489928e1273782de84316de45c70ef79a8a97c1 --- /dev/null +++ b/codenet/public_test_cases/p02844/output.3.txt @@ -0,0 +1 @@ +329 diff --git a/codenet/public_test_cases/p02845/input.0.txt b/codenet/public_test_cases/p02845/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..742ab725196072d93af450011707ed9862365e4e --- /dev/null +++ b/codenet/public_test_cases/p02845/input.0.txt @@ -0,0 +1,2 @@ +6 +0 1 2 3 4 5 diff --git a/codenet/public_test_cases/p02845/input.1.txt b/codenet/public_test_cases/p02845/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..644aa61f52ef2f05aba74210d762fb0fdb3b4c30 --- /dev/null +++ b/codenet/public_test_cases/p02845/input.1.txt @@ -0,0 +1,2 @@ +54 +0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17 diff --git a/codenet/public_test_cases/p02845/input.2.txt b/codenet/public_test_cases/p02845/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2edfca631f6b221d5a1dfd1f79e5a63d755b7b9d --- /dev/null +++ b/codenet/public_test_cases/p02845/input.2.txt @@ -0,0 +1,2 @@ +3 +0 0 0 diff --git a/codenet/public_test_cases/p02845/input.3.txt b/codenet/public_test_cases/p02845/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..742ab725196072d93af450011707ed9862365e4e --- /dev/null +++ b/codenet/public_test_cases/p02845/input.3.txt @@ -0,0 +1,2 @@ +6 +0 1 2 3 4 5 diff --git a/codenet/public_test_cases/p02845/output.0.txt b/codenet/public_test_cases/p02845/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02845/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02845/output.1.txt b/codenet/public_test_cases/p02845/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5faf41bb64b227b42ff46faaa6bec4930e4c5f4 --- /dev/null +++ b/codenet/public_test_cases/p02845/output.1.txt @@ -0,0 +1 @@ +115295190 diff --git a/codenet/public_test_cases/p02845/output.2.txt b/codenet/public_test_cases/p02845/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02845/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02845/output.3.txt b/codenet/public_test_cases/p02845/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02845/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02846/input.0.txt b/codenet/public_test_cases/p02846/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac702f474b1f222509ec073fa952b1ec6eb64e2b --- /dev/null +++ b/codenet/public_test_cases/p02846/input.0.txt @@ -0,0 +1,3 @@ +1 2 +10 10 +12 4 diff --git a/codenet/public_test_cases/p02846/input.1.txt b/codenet/public_test_cases/p02846/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac702f474b1f222509ec073fa952b1ec6eb64e2b --- /dev/null +++ b/codenet/public_test_cases/p02846/input.1.txt @@ -0,0 +1,3 @@ +1 2 +10 10 +12 4 diff --git a/codenet/public_test_cases/p02846/input.2.txt b/codenet/public_test_cases/p02846/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc60f6829d6eb96d5fd0fd829eea326ea922206b --- /dev/null +++ b/codenet/public_test_cases/p02846/input.2.txt @@ -0,0 +1,3 @@ +100 1 +101 101 +102 1 diff --git a/codenet/public_test_cases/p02846/input.3.txt b/codenet/public_test_cases/p02846/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea8537541f2c1a787a55d55b48b0f57454648981 --- /dev/null +++ b/codenet/public_test_cases/p02846/input.3.txt @@ -0,0 +1,3 @@ +12000 15700 +3390000000 3810000000 +5550000000 2130000000 diff --git a/codenet/public_test_cases/p02846/output.0.txt b/codenet/public_test_cases/p02846/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02846/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02846/output.1.txt b/codenet/public_test_cases/p02846/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02846/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02846/output.2.txt b/codenet/public_test_cases/p02846/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d53cdab48de667f590ed6d6ad953efead15ba20 --- /dev/null +++ b/codenet/public_test_cases/p02846/output.2.txt @@ -0,0 +1 @@ +infinity diff --git a/codenet/public_test_cases/p02846/output.3.txt b/codenet/public_test_cases/p02846/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b252fd0902c7ca46ba8f6cd905d06880b0efb85 --- /dev/null +++ b/codenet/public_test_cases/p02846/output.3.txt @@ -0,0 +1 @@ +113 diff --git a/codenet/public_test_cases/p02847/input.0.txt b/codenet/public_test_cases/p02847/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..501c3aca5c101bcf366a1a4f0edadb564a7dd4d1 --- /dev/null +++ b/codenet/public_test_cases/p02847/input.0.txt @@ -0,0 +1 @@ +SAT diff --git a/codenet/public_test_cases/p02847/input.1.txt b/codenet/public_test_cases/p02847/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4a9eede06328d35d16c6a47fed5a404a49790d3 --- /dev/null +++ b/codenet/public_test_cases/p02847/input.1.txt @@ -0,0 +1 @@ +SUN diff --git a/codenet/public_test_cases/p02847/input.2.txt b/codenet/public_test_cases/p02847/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..501c3aca5c101bcf366a1a4f0edadb564a7dd4d1 --- /dev/null +++ b/codenet/public_test_cases/p02847/input.2.txt @@ -0,0 +1 @@ +SAT diff --git a/codenet/public_test_cases/p02847/output.0.txt b/codenet/public_test_cases/p02847/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02847/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02847/output.1.txt b/codenet/public_test_cases/p02847/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02847/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02847/output.2.txt b/codenet/public_test_cases/p02847/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02847/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02848/input.0.txt b/codenet/public_test_cases/p02848/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63949d0a62da640202be4916eefa5be1f60ab703 --- /dev/null +++ b/codenet/public_test_cases/p02848/input.0.txt @@ -0,0 +1,2 @@ +2 +ABCXYZ diff --git a/codenet/public_test_cases/p02848/input.1.txt b/codenet/public_test_cases/p02848/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddeb5b5af6d756402e7af86223a46e3e13d0691a --- /dev/null +++ b/codenet/public_test_cases/p02848/input.1.txt @@ -0,0 +1,2 @@ +13 +ABCDEFGHIJKLMNOPQRSTUVWXYZ diff --git a/codenet/public_test_cases/p02848/input.2.txt b/codenet/public_test_cases/p02848/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c2d3ed83b487b7b3ca124163299655306046b5b --- /dev/null +++ b/codenet/public_test_cases/p02848/input.2.txt @@ -0,0 +1,2 @@ +0 +ABCXYZ diff --git a/codenet/public_test_cases/p02848/input.3.txt b/codenet/public_test_cases/p02848/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..63949d0a62da640202be4916eefa5be1f60ab703 --- /dev/null +++ b/codenet/public_test_cases/p02848/input.3.txt @@ -0,0 +1,2 @@ +2 +ABCXYZ diff --git a/codenet/public_test_cases/p02848/output.0.txt b/codenet/public_test_cases/p02848/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce129281742cf677292599b5267d538114ffe524 --- /dev/null +++ b/codenet/public_test_cases/p02848/output.0.txt @@ -0,0 +1 @@ +CDEZAB diff --git a/codenet/public_test_cases/p02848/output.1.txt b/codenet/public_test_cases/p02848/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6847be69df5d1d3b9bd1fce37e56dee4d24f49d9 --- /dev/null +++ b/codenet/public_test_cases/p02848/output.1.txt @@ -0,0 +1 @@ +NOPQRSTUVWXYZABCDEFGHIJKLM diff --git a/codenet/public_test_cases/p02848/output.2.txt b/codenet/public_test_cases/p02848/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1c09fd9c7e959491497f2b7a1d44448996dc10b --- /dev/null +++ b/codenet/public_test_cases/p02848/output.2.txt @@ -0,0 +1 @@ +ABCXYZ diff --git a/codenet/public_test_cases/p02848/output.3.txt b/codenet/public_test_cases/p02848/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce129281742cf677292599b5267d538114ffe524 --- /dev/null +++ b/codenet/public_test_cases/p02848/output.3.txt @@ -0,0 +1 @@ +CDEZAB diff --git a/codenet/public_test_cases/p02849/input.0.txt b/codenet/public_test_cases/p02849/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cb8109b1db856e9d15762c4a3e440bd9e730b0c --- /dev/null +++ b/codenet/public_test_cases/p02849/input.0.txt @@ -0,0 +1 @@ +10 7 100 diff --git a/codenet/public_test_cases/p02849/output.0.txt b/codenet/public_test_cases/p02849/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02849/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02850/input.0.txt b/codenet/public_test_cases/p02850/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p02850/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02850/input.1.txt b/codenet/public_test_cases/p02850/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p02850/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02850/input.2.txt b/codenet/public_test_cases/p02850/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9130c062ec57655cf816f25f5ca850ae5ff2e6c3 --- /dev/null +++ b/codenet/public_test_cases/p02850/input.2.txt @@ -0,0 +1,6 @@ +6 +1 2 +1 3 +1 4 +1 5 +1 6 diff --git a/codenet/public_test_cases/p02850/input.3.txt b/codenet/public_test_cases/p02850/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eee5a51590f580e05c9e6c805ee8ef762ae5f58 --- /dev/null +++ b/codenet/public_test_cases/p02850/input.3.txt @@ -0,0 +1,8 @@ +8 +1 2 +2 3 +2 4 +2 5 +4 7 +5 6 +6 8 diff --git a/codenet/public_test_cases/p02850/output.0.txt b/codenet/public_test_cases/p02850/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p02850/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p02850/output.1.txt b/codenet/public_test_cases/p02850/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p02850/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p02850/output.2.txt b/codenet/public_test_cases/p02850/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74fc6f901f7e14b2a1243ec3e8ab6c3e49b438f6 --- /dev/null +++ b/codenet/public_test_cases/p02850/output.2.txt @@ -0,0 +1,6 @@ +5 +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02850/output.3.txt b/codenet/public_test_cases/p02850/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9f8d3e1c1acfa49437cad81e9d26dfe22610179 --- /dev/null +++ b/codenet/public_test_cases/p02850/output.3.txt @@ -0,0 +1,8 @@ +4 +1 +2 +3 +4 +1 +1 +2 diff --git a/codenet/public_test_cases/p02851/input.0.txt b/codenet/public_test_cases/p02851/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..84619933aee0daa45efeff2d79b80f05debaf064 --- /dev/null +++ b/codenet/public_test_cases/p02851/input.0.txt @@ -0,0 +1,2 @@ +5 4 +1 4 2 3 5 diff --git a/codenet/public_test_cases/p02851/input.1.txt b/codenet/public_test_cases/p02851/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..84619933aee0daa45efeff2d79b80f05debaf064 --- /dev/null +++ b/codenet/public_test_cases/p02851/input.1.txt @@ -0,0 +1,2 @@ +5 4 +1 4 2 3 5 diff --git a/codenet/public_test_cases/p02851/input.2.txt b/codenet/public_test_cases/p02851/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7d6cef3b6fea95b4fbac281b49648eaef951cf0 --- /dev/null +++ b/codenet/public_test_cases/p02851/input.2.txt @@ -0,0 +1,2 @@ +10 7 +14 15 92 65 35 89 79 32 38 46 diff --git a/codenet/public_test_cases/p02851/input.3.txt b/codenet/public_test_cases/p02851/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aeafb09bbd43449d2822e5bcd398d353b5afee4f --- /dev/null +++ b/codenet/public_test_cases/p02851/input.3.txt @@ -0,0 +1,2 @@ +8 4 +4 2 4 2 4 2 4 2 diff --git a/codenet/public_test_cases/p02851/output.0.txt b/codenet/public_test_cases/p02851/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02851/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02851/output.1.txt b/codenet/public_test_cases/p02851/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02851/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02851/output.2.txt b/codenet/public_test_cases/p02851/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02851/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02851/output.3.txt b/codenet/public_test_cases/p02851/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02851/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02852/input.0.txt b/codenet/public_test_cases/p02852/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..215c9565bc49863352c7aa7be4bdef023f7cde8b --- /dev/null +++ b/codenet/public_test_cases/p02852/input.0.txt @@ -0,0 +1,2 @@ +9 3 +0001000100 diff --git a/codenet/public_test_cases/p02852/output.0.txt b/codenet/public_test_cases/p02852/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de9a816afbbc11edc5657e452e6cd175e7908587 --- /dev/null +++ b/codenet/public_test_cases/p02852/output.0.txt @@ -0,0 +1 @@ +1 3 2 3 diff --git a/codenet/public_test_cases/p02853/input.0.txt b/codenet/public_test_cases/p02853/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02853/input.0.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02853/input.1.txt b/codenet/public_test_cases/p02853/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..476374dfb61d7d11ce9d9fb914c508a400878031 --- /dev/null +++ b/codenet/public_test_cases/p02853/input.1.txt @@ -0,0 +1 @@ +3 101 diff --git a/codenet/public_test_cases/p02853/input.2.txt b/codenet/public_test_cases/p02853/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02853/input.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02853/input.3.txt b/codenet/public_test_cases/p02853/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8835c0701f66f328251eac951d4278ae8acd00a1 --- /dev/null +++ b/codenet/public_test_cases/p02853/input.3.txt @@ -0,0 +1 @@ +4 4 diff --git a/codenet/public_test_cases/p02853/output.0.txt b/codenet/public_test_cases/p02853/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..749fce669df1b51cae4a71dc130b2a14807829f0 --- /dev/null +++ b/codenet/public_test_cases/p02853/output.0.txt @@ -0,0 +1 @@ +1000000 diff --git a/codenet/public_test_cases/p02853/output.1.txt b/codenet/public_test_cases/p02853/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7393e847d34d19031ee0ba57df63e4d0ccb4fb2 --- /dev/null +++ b/codenet/public_test_cases/p02853/output.1.txt @@ -0,0 +1 @@ +100000 diff --git a/codenet/public_test_cases/p02853/output.2.txt b/codenet/public_test_cases/p02853/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..749fce669df1b51cae4a71dc130b2a14807829f0 --- /dev/null +++ b/codenet/public_test_cases/p02853/output.2.txt @@ -0,0 +1 @@ +1000000 diff --git a/codenet/public_test_cases/p02853/output.3.txt b/codenet/public_test_cases/p02853/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02853/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02854/input.0.txt b/codenet/public_test_cases/p02854/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b03af9bfb308f556b09e9921bb1f321abd14452c --- /dev/null +++ b/codenet/public_test_cases/p02854/input.0.txt @@ -0,0 +1,2 @@ +3 +2 4 3 diff --git a/codenet/public_test_cases/p02854/input.1.txt b/codenet/public_test_cases/p02854/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b03af9bfb308f556b09e9921bb1f321abd14452c --- /dev/null +++ b/codenet/public_test_cases/p02854/input.1.txt @@ -0,0 +1,2 @@ +3 +2 4 3 diff --git a/codenet/public_test_cases/p02854/input.2.txt b/codenet/public_test_cases/p02854/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bfedd18dde43e0f4ad5f4687e683d0d684de127 --- /dev/null +++ b/codenet/public_test_cases/p02854/input.2.txt @@ -0,0 +1,2 @@ +12 +100 104 102 105 103 103 101 105 104 102 104 101 diff --git a/codenet/public_test_cases/p02854/output.0.txt b/codenet/public_test_cases/p02854/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02854/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02854/output.1.txt b/codenet/public_test_cases/p02854/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02854/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02854/output.2.txt b/codenet/public_test_cases/p02854/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02854/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02855/input.0.txt b/codenet/public_test_cases/p02855/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..325d3f86fd8dfe227846f913d41d005dcc4a002a --- /dev/null +++ b/codenet/public_test_cases/p02855/input.0.txt @@ -0,0 +1,4 @@ +3 3 5 +#.# +.#. +#.# diff --git a/codenet/public_test_cases/p02855/input.1.txt b/codenet/public_test_cases/p02855/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..325d3f86fd8dfe227846f913d41d005dcc4a002a --- /dev/null +++ b/codenet/public_test_cases/p02855/input.1.txt @@ -0,0 +1,4 @@ +3 3 5 +#.# +.#. +#.# diff --git a/codenet/public_test_cases/p02855/input.2.txt b/codenet/public_test_cases/p02855/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f803c13b74458f1ae4f4527e7f5b613e6ed987bc --- /dev/null +++ b/codenet/public_test_cases/p02855/input.2.txt @@ -0,0 +1,14 @@ +13 21 106 +..................... +.####.####.####.####. +..#.#..#.#.#....#.... +..#.#..#.#.#....#.... +..#.#..#.#.#....#.... +.####.####.####.####. +..................... +.####.####.####.####. +....#.#..#....#.#..#. +.####.#..#.####.#..#. +.#....#..#.#....#..#. +.####.####.####.####. +..................... diff --git a/codenet/public_test_cases/p02855/input.3.txt b/codenet/public_test_cases/p02855/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1eda2bffa729b1f8509bca98e8d3f710aae2871 --- /dev/null +++ b/codenet/public_test_cases/p02855/input.3.txt @@ -0,0 +1,4 @@ +3 7 7 +...#.# +..#...# +.#..#.. diff --git a/codenet/public_test_cases/p02855/input.4.txt b/codenet/public_test_cases/p02855/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..232c81f112ddd4f25a85965a09dd2654daa44d20 --- /dev/null +++ b/codenet/public_test_cases/p02855/input.4.txt @@ -0,0 +1,4 @@ +3 3 5 +.# +.#. +.# diff --git a/codenet/public_test_cases/p02855/output.0.txt b/codenet/public_test_cases/p02855/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..253884c015c41a38019451179514553cc376d975 --- /dev/null +++ b/codenet/public_test_cases/p02855/output.0.txt @@ -0,0 +1,3 @@ +1 2 2 +1 3 4 +5 5 4 diff --git a/codenet/public_test_cases/p02855/output.1.txt b/codenet/public_test_cases/p02855/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..253884c015c41a38019451179514553cc376d975 --- /dev/null +++ b/codenet/public_test_cases/p02855/output.1.txt @@ -0,0 +1,3 @@ +1 2 2 +1 3 4 +5 5 4 diff --git a/codenet/public_test_cases/p02855/output.2.txt b/codenet/public_test_cases/p02855/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..630e754d16d0717d2f5f25e6ed6b2f90a38cb460 --- /dev/null +++ b/codenet/public_test_cases/p02855/output.2.txt @@ -0,0 +1,13 @@ +12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50 +12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50 +12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50 +12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72 +12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83 +16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21 +16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21 +32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85 +32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74 +14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63 +25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52 +36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41 +36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41 diff --git a/codenet/public_test_cases/p02855/output.3.txt b/codenet/public_test_cases/p02855/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..78199be1700594d641779606223716dd75b34675 --- /dev/null +++ b/codenet/public_test_cases/p02855/output.3.txt @@ -0,0 +1,3 @@ +1 1 2 2 3 4 4 +6 6 2 2 3 5 5 +6 6 7 7 7 7 7 diff --git a/codenet/public_test_cases/p02855/output.4.txt b/codenet/public_test_cases/p02855/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..253884c015c41a38019451179514553cc376d975 --- /dev/null +++ b/codenet/public_test_cases/p02855/output.4.txt @@ -0,0 +1,3 @@ +1 2 2 +1 3 4 +5 5 4 diff --git a/codenet/public_test_cases/p02856/input.0.txt b/codenet/public_test_cases/p02856/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd5bf4900ce79667e7416f5941f64909772c4c6f --- /dev/null +++ b/codenet/public_test_cases/p02856/input.0.txt @@ -0,0 +1,3 @@ +2 +2 2 +9 1 diff --git a/codenet/public_test_cases/p02856/input.1.txt b/codenet/public_test_cases/p02856/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac867138a95fca85d2bbbe8c964e61c63c21d48c --- /dev/null +++ b/codenet/public_test_cases/p02856/input.1.txt @@ -0,0 +1,4 @@ +3 +1 1 +0 8 +7 1 diff --git a/codenet/public_test_cases/p02856/input.2.txt b/codenet/public_test_cases/p02856/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd5bf4900ce79667e7416f5941f64909772c4c6f --- /dev/null +++ b/codenet/public_test_cases/p02856/input.2.txt @@ -0,0 +1,3 @@ +2 +2 2 +9 1 diff --git a/codenet/public_test_cases/p02856/output.0.txt b/codenet/public_test_cases/p02856/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02856/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02856/output.1.txt b/codenet/public_test_cases/p02856/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02856/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02856/output.2.txt b/codenet/public_test_cases/p02856/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02856/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02857/input.1.txt b/codenet/public_test_cases/p02857/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02857/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02857/output.1.txt b/codenet/public_test_cases/p02857/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02857/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02858/input.0.txt b/codenet/public_test_cases/p02858/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac06d91d8aecaaf1ed168da3b63333dfc2e26e6d --- /dev/null +++ b/codenet/public_test_cases/p02858/input.0.txt @@ -0,0 +1 @@ +2 2 1 diff --git a/codenet/public_test_cases/p02858/input.1.txt b/codenet/public_test_cases/p02858/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7d42d1c32bc0591a44a448f008d8d3b9a7c0291 --- /dev/null +++ b/codenet/public_test_cases/p02858/input.1.txt @@ -0,0 +1 @@ +869 120 1001 diff --git a/codenet/public_test_cases/p02858/input.2.txt b/codenet/public_test_cases/p02858/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac06d91d8aecaaf1ed168da3b63333dfc2e26e6d --- /dev/null +++ b/codenet/public_test_cases/p02858/input.2.txt @@ -0,0 +1 @@ +2 2 1 diff --git a/codenet/public_test_cases/p02858/output.0.txt b/codenet/public_test_cases/p02858/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02858/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02858/output.1.txt b/codenet/public_test_cases/p02858/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9050ac01e8ac1a0233ca9bd0b1792d2b994953a --- /dev/null +++ b/codenet/public_test_cases/p02858/output.1.txt @@ -0,0 +1 @@ +672919729 diff --git a/codenet/public_test_cases/p02858/output.2.txt b/codenet/public_test_cases/p02858/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02858/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02859/input.0.txt b/codenet/public_test_cases/p02859/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02859/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02859/output.0.txt b/codenet/public_test_cases/p02859/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02859/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02860/input.0.txt b/codenet/public_test_cases/p02860/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddc838c901080a9d2ad7dd83439febb2859c9949 --- /dev/null +++ b/codenet/public_test_cases/p02860/input.0.txt @@ -0,0 +1,2 @@ +6 +abcabc diff --git a/codenet/public_test_cases/p02860/input.1.txt b/codenet/public_test_cases/p02860/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59f9cdfcddd2c40483bb0ac0ad42e3b65f563fd9 --- /dev/null +++ b/codenet/public_test_cases/p02860/input.1.txt @@ -0,0 +1,2 @@ +6 +abcadc diff --git a/codenet/public_test_cases/p02860/input.2.txt b/codenet/public_test_cases/p02860/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddc838c901080a9d2ad7dd83439febb2859c9949 --- /dev/null +++ b/codenet/public_test_cases/p02860/input.2.txt @@ -0,0 +1,2 @@ +6 +abcabc diff --git a/codenet/public_test_cases/p02860/input.3.txt b/codenet/public_test_cases/p02860/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd805a7784c7da6590963a4f06c443b39bed59fc --- /dev/null +++ b/codenet/public_test_cases/p02860/input.3.txt @@ -0,0 +1,2 @@ +1 +z diff --git a/codenet/public_test_cases/p02860/output.0.txt b/codenet/public_test_cases/p02860/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02860/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02860/output.1.txt b/codenet/public_test_cases/p02860/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02860/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02860/output.2.txt b/codenet/public_test_cases/p02860/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02860/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02860/output.3.txt b/codenet/public_test_cases/p02860/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02860/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02861/input.0.txt b/codenet/public_test_cases/p02861/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18c47c701f6ce42a3c923b494b1e7a31572ea695 --- /dev/null +++ b/codenet/public_test_cases/p02861/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 +1 0 +0 1 diff --git a/codenet/public_test_cases/p02861/output.0.txt b/codenet/public_test_cases/p02861/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32f1b25b78ee8195ee57e0426a887dc8239d4f57 --- /dev/null +++ b/codenet/public_test_cases/p02861/output.0.txt @@ -0,0 +1 @@ +2.2761423749 diff --git a/codenet/public_test_cases/p02862/input.0.txt b/codenet/public_test_cases/p02862/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p02862/input.0.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p02862/input.1.txt b/codenet/public_test_cases/p02862/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a7eb98530a553cb17eeaf5567136be4d5f972f5 --- /dev/null +++ b/codenet/public_test_cases/p02862/input.1.txt @@ -0,0 +1 @@ +999999 999999 diff --git a/codenet/public_test_cases/p02862/input.2.txt b/codenet/public_test_cases/p02862/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p02862/input.2.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p02862/input.3.txt b/codenet/public_test_cases/p02862/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p02862/input.3.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p02862/output.0.txt b/codenet/public_test_cases/p02862/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02862/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02862/output.1.txt b/codenet/public_test_cases/p02862/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c02c56cec8996d0536967b077e15dded77e288a --- /dev/null +++ b/codenet/public_test_cases/p02862/output.1.txt @@ -0,0 +1 @@ +151840682 diff --git a/codenet/public_test_cases/p02862/output.2.txt b/codenet/public_test_cases/p02862/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02862/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02862/output.3.txt b/codenet/public_test_cases/p02862/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02862/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02863/input.0.txt b/codenet/public_test_cases/p02863/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..893c02c36d0f0242f8291441f717f1fe4080bf17 --- /dev/null +++ b/codenet/public_test_cases/p02863/input.0.txt @@ -0,0 +1,3 @@ +2 60 +10 10 +100 100 diff --git a/codenet/public_test_cases/p02863/input.1.txt b/codenet/public_test_cases/p02863/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc467b2284bf282c0cab25a4660899cf94ea5081 --- /dev/null +++ b/codenet/public_test_cases/p02863/input.1.txt @@ -0,0 +1,4 @@ +3 60 +10 10 +10 20 +10 30 diff --git a/codenet/public_test_cases/p02863/input.2.txt b/codenet/public_test_cases/p02863/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae991b0c05813ce250cb8866ad8f0e3cbc3d4e71 --- /dev/null +++ b/codenet/public_test_cases/p02863/input.2.txt @@ -0,0 +1,11 @@ +10 100 +15 23 +20 18 +13 17 +24 12 +18 29 +19 27 +23 21 +18 20 +27 15 +22 25 diff --git a/codenet/public_test_cases/p02863/input.3.txt b/codenet/public_test_cases/p02863/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..514a1f6407f32749f9b7236806bcfbaddd3a15a6 --- /dev/null +++ b/codenet/public_test_cases/p02863/input.3.txt @@ -0,0 +1,4 @@ +3 60 +30 10 +30 20 +30 30 diff --git a/codenet/public_test_cases/p02863/input.4.txt b/codenet/public_test_cases/p02863/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..893c02c36d0f0242f8291441f717f1fe4080bf17 --- /dev/null +++ b/codenet/public_test_cases/p02863/input.4.txt @@ -0,0 +1,3 @@ +2 60 +10 10 +100 100 diff --git a/codenet/public_test_cases/p02863/output.0.txt b/codenet/public_test_cases/p02863/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p02863/output.0.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p02863/output.1.txt b/codenet/public_test_cases/p02863/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p02863/output.1.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p02863/output.2.txt b/codenet/public_test_cases/p02863/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..13c09a007eb0a76d4ed37d96a9b870c3f4434be8 --- /dev/null +++ b/codenet/public_test_cases/p02863/output.2.txt @@ -0,0 +1 @@ +145 diff --git a/codenet/public_test_cases/p02863/output.3.txt b/codenet/public_test_cases/p02863/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p02863/output.3.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p02863/output.4.txt b/codenet/public_test_cases/p02863/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p02863/output.4.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p02864/input.0.txt b/codenet/public_test_cases/p02864/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..67247045f181adf57e6353795e6a172565afc87d --- /dev/null +++ b/codenet/public_test_cases/p02864/input.0.txt @@ -0,0 +1,2 @@ +4 1 +2 3 4 1 diff --git a/codenet/public_test_cases/p02864/input.1.txt b/codenet/public_test_cases/p02864/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ff2e6bd70771ba529dbc8982923b022164758f0 --- /dev/null +++ b/codenet/public_test_cases/p02864/input.1.txt @@ -0,0 +1,2 @@ +10 0 +1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 diff --git a/codenet/public_test_cases/p02864/input.2.txt b/codenet/public_test_cases/p02864/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..15701fbedba08345299ce1ca662ea401e5cdf353 --- /dev/null +++ b/codenet/public_test_cases/p02864/input.2.txt @@ -0,0 +1,2 @@ +6 2 +8 6 9 1 2 1 diff --git a/codenet/public_test_cases/p02864/input.3.txt b/codenet/public_test_cases/p02864/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..67247045f181adf57e6353795e6a172565afc87d --- /dev/null +++ b/codenet/public_test_cases/p02864/input.3.txt @@ -0,0 +1,2 @@ +4 1 +2 3 4 1 diff --git a/codenet/public_test_cases/p02864/output.0.txt b/codenet/public_test_cases/p02864/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02864/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02864/output.1.txt b/codenet/public_test_cases/p02864/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfcf556af357a8208efb6d7209ff5cd1f0c461f7 --- /dev/null +++ b/codenet/public_test_cases/p02864/output.1.txt @@ -0,0 +1 @@ +4999999996 diff --git a/codenet/public_test_cases/p02864/output.2.txt b/codenet/public_test_cases/p02864/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02864/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02864/output.3.txt b/codenet/public_test_cases/p02864/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02864/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02865/input.0.txt b/codenet/public_test_cases/p02865/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02865/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02865/input.1.txt b/codenet/public_test_cases/p02865/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02865/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02865/input.2.txt b/codenet/public_test_cases/p02865/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8694f4002550978d0f96c5b25ca7d0fc2833047d --- /dev/null +++ b/codenet/public_test_cases/p02865/input.2.txt @@ -0,0 +1 @@ +999999 diff --git a/codenet/public_test_cases/p02865/output.0.txt b/codenet/public_test_cases/p02865/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02865/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02865/output.1.txt b/codenet/public_test_cases/p02865/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02865/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02865/output.2.txt b/codenet/public_test_cases/p02865/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a8ae131ab5973845a21b489db13e048376d4342 --- /dev/null +++ b/codenet/public_test_cases/p02865/output.2.txt @@ -0,0 +1 @@ +499999 diff --git a/codenet/public_test_cases/p02866/input.0.txt b/codenet/public_test_cases/p02866/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13116db42c3d445e9c8c522469a150fce23822cb --- /dev/null +++ b/codenet/public_test_cases/p02866/input.0.txt @@ -0,0 +1,2 @@ +4 +0 1 1 2 diff --git a/codenet/public_test_cases/p02866/output.0.txt b/codenet/public_test_cases/p02866/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02866/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02867/input.0.txt b/codenet/public_test_cases/p02867/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afd245c88041f7fe60a58aa059dfc90414a893f3 --- /dev/null +++ b/codenet/public_test_cases/p02867/input.0.txt @@ -0,0 +1,3 @@ +3 +1 3 2 +1 2 3 diff --git a/codenet/public_test_cases/p02867/input.1.txt b/codenet/public_test_cases/p02867/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..df32e721c5e6c4d66ee5f386a70bc39c05c23407 --- /dev/null +++ b/codenet/public_test_cases/p02867/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 3 +2 2 2 diff --git a/codenet/public_test_cases/p02867/input.2.txt b/codenet/public_test_cases/p02867/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d78e612d30bba985bd08840c25ff8d6aba13b73 --- /dev/null +++ b/codenet/public_test_cases/p02867/input.2.txt @@ -0,0 +1,3 @@ +6 +3 1 2 6 3 4 +2 2 8 3 4 3 diff --git a/codenet/public_test_cases/p02867/input.3.txt b/codenet/public_test_cases/p02867/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..afd245c88041f7fe60a58aa059dfc90414a893f3 --- /dev/null +++ b/codenet/public_test_cases/p02867/input.3.txt @@ -0,0 +1,3 @@ +3 +1 3 2 +1 2 3 diff --git a/codenet/public_test_cases/p02867/output.0.txt b/codenet/public_test_cases/p02867/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02867/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02867/output.1.txt b/codenet/public_test_cases/p02867/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02867/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02867/output.2.txt b/codenet/public_test_cases/p02867/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02867/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02867/output.3.txt b/codenet/public_test_cases/p02867/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02867/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02868/input.0.txt b/codenet/public_test_cases/p02868/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5ae42e2670db4b937361bfd5446d6e45eeab187 --- /dev/null +++ b/codenet/public_test_cases/p02868/input.0.txt @@ -0,0 +1,4 @@ +4 3 +1 3 2 +2 4 3 +1 4 6 diff --git a/codenet/public_test_cases/p02868/input.1.txt b/codenet/public_test_cases/p02868/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5ae42e2670db4b937361bfd5446d6e45eeab187 --- /dev/null +++ b/codenet/public_test_cases/p02868/input.1.txt @@ -0,0 +1,4 @@ +4 3 +1 3 2 +2 4 3 +1 4 6 diff --git a/codenet/public_test_cases/p02868/input.2.txt b/codenet/public_test_cases/p02868/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..88f1c98da9440af214841af4603f644a94cd5f19 --- /dev/null +++ b/codenet/public_test_cases/p02868/input.2.txt @@ -0,0 +1,8 @@ +10 7 +1 5 18 +3 4 8 +1 3 5 +4 7 10 +5 9 8 +6 10 5 +8 10 3 diff --git a/codenet/public_test_cases/p02868/input.3.txt b/codenet/public_test_cases/p02868/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f10d27bdee7618bddc80d021279f1635707bea8 --- /dev/null +++ b/codenet/public_test_cases/p02868/input.3.txt @@ -0,0 +1,3 @@ +4 2 +1 2 1 +3 4 2 diff --git a/codenet/public_test_cases/p02868/output.0.txt b/codenet/public_test_cases/p02868/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02868/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02868/output.1.txt b/codenet/public_test_cases/p02868/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02868/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02868/output.2.txt b/codenet/public_test_cases/p02868/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9902f17848a8974ab57d57999b74a63198fe6e23 --- /dev/null +++ b/codenet/public_test_cases/p02868/output.2.txt @@ -0,0 +1 @@ +28 diff --git a/codenet/public_test_cases/p02868/output.3.txt b/codenet/public_test_cases/p02868/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02868/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02869/input.0.txt b/codenet/public_test_cases/p02869/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02869/input.0.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02869/input.1.txt b/codenet/public_test_cases/p02869/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p02869/input.1.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p02869/input.2.txt b/codenet/public_test_cases/p02869/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02869/input.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02869/output.0.txt b/codenet/public_test_cases/p02869/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b85905ec0b994f1e5797d58ffefed89ff54d6b51 --- /dev/null +++ b/codenet/public_test_cases/p02869/output.0.txt @@ -0,0 +1 @@ +1 2 3 diff --git a/codenet/public_test_cases/p02869/output.1.txt b/codenet/public_test_cases/p02869/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02869/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02869/output.2.txt b/codenet/public_test_cases/p02869/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b85905ec0b994f1e5797d58ffefed89ff54d6b51 --- /dev/null +++ b/codenet/public_test_cases/p02869/output.2.txt @@ -0,0 +1 @@ +1 2 3 diff --git a/codenet/public_test_cases/p02870/input.0.txt b/codenet/public_test_cases/p02870/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09ee3fda232eff3910f8fa6999f13c672ee92d93 --- /dev/null +++ b/codenet/public_test_cases/p02870/input.0.txt @@ -0,0 +1,4 @@ +4 +o?o +??? +?x? diff --git a/codenet/public_test_cases/p02870/input.1.txt b/codenet/public_test_cases/p02870/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a395e9955255dd5f606728e955a82756bace1a86 --- /dev/null +++ b/codenet/public_test_cases/p02870/input.1.txt @@ -0,0 +1,6 @@ +6 +?o??? +????o +??x?? +o???? +???o? diff --git a/codenet/public_test_cases/p02870/input.2.txt b/codenet/public_test_cases/p02870/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bba6be0dab8227e85ea3edbfd27bb0c4dce56896 --- /dev/null +++ b/codenet/public_test_cases/p02870/input.2.txt @@ -0,0 +1,5 @@ +5 +o?o? +???? +o?x? +???? diff --git a/codenet/public_test_cases/p02870/input.3.txt b/codenet/public_test_cases/p02870/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..09ee3fda232eff3910f8fa6999f13c672ee92d93 --- /dev/null +++ b/codenet/public_test_cases/p02870/input.3.txt @@ -0,0 +1,4 @@ +4 +o?o +??? +?x? diff --git a/codenet/public_test_cases/p02870/input.4.txt b/codenet/public_test_cases/p02870/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9baaefc88454a84f7bf4e3d069240fdc7b8a7a2e --- /dev/null +++ b/codenet/public_test_cases/p02870/input.4.txt @@ -0,0 +1,9 @@ +9 +????o??x +?????x?? +??o?o??? +?o?x???? +???????x +x?o?o??? +???????? +x?????x? diff --git a/codenet/public_test_cases/p02870/output.0.txt b/codenet/public_test_cases/p02870/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02870/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02870/output.1.txt b/codenet/public_test_cases/p02870/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p02870/output.1.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p02870/output.2.txt b/codenet/public_test_cases/p02870/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02870/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02870/output.3.txt b/codenet/public_test_cases/p02870/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02870/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02870/output.4.txt b/codenet/public_test_cases/p02870/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02870/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02871/input.1.txt b/codenet/public_test_cases/p02871/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e75f8cf68f2fda252885a64bb9bac7f7ce59343 --- /dev/null +++ b/codenet/public_test_cases/p02871/input.1.txt @@ -0,0 +1,16 @@ +5 7 +1 2 5 +5 3 4 +2 4 8 +1 5 1 +2 3 3 +4 5 3 +4 3 9 +4 +1 +1 2 +1 +2 5 +1 +3 4 +0 diff --git a/codenet/public_test_cases/p02871/output.1.txt b/codenet/public_test_cases/p02871/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee5e1737761956eee668cae66f0f79515991f4dc --- /dev/null +++ b/codenet/public_test_cases/p02871/output.1.txt @@ -0,0 +1,4 @@ +2 +-1 +1 +5 diff --git a/codenet/public_test_cases/p02873/input.0.txt b/codenet/public_test_cases/p02873/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..87d0336a3c7c232924c3149b74535e23bfe0cd99 --- /dev/null +++ b/codenet/public_test_cases/p02873/input.0.txt @@ -0,0 +1 @@ +<>> diff --git a/codenet/public_test_cases/p02873/input.1.txt b/codenet/public_test_cases/p02873/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5f4b6f3fa0707103ddf1a7533cb02c60d441841 --- /dev/null +++ b/codenet/public_test_cases/p02873/input.1.txt @@ -0,0 +1 @@ +<>>><<><<<<<>>>< diff --git a/codenet/public_test_cases/p02873/input.2.txt b/codenet/public_test_cases/p02873/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..87d0336a3c7c232924c3149b74535e23bfe0cd99 --- /dev/null +++ b/codenet/public_test_cases/p02873/input.2.txt @@ -0,0 +1 @@ +<>> diff --git a/codenet/public_test_cases/p02873/output.0.txt b/codenet/public_test_cases/p02873/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02873/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02873/output.1.txt b/codenet/public_test_cases/p02873/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9902f17848a8974ab57d57999b74a63198fe6e23 --- /dev/null +++ b/codenet/public_test_cases/p02873/output.1.txt @@ -0,0 +1 @@ +28 diff --git a/codenet/public_test_cases/p02873/output.2.txt b/codenet/public_test_cases/p02873/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02873/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02874/input.0.txt b/codenet/public_test_cases/p02874/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1971fad61874f24da7603a8a2a0abc4fb1165a73 --- /dev/null +++ b/codenet/public_test_cases/p02874/input.0.txt @@ -0,0 +1,5 @@ +4 +4 7 +1 4 +5 8 +2 5 diff --git a/codenet/public_test_cases/p02874/input.1.txt b/codenet/public_test_cases/p02874/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3239f996cf05d8592b24bf98cfaacdcc2fd58503 --- /dev/null +++ b/codenet/public_test_cases/p02874/input.1.txt @@ -0,0 +1,5 @@ +4 +1 20 +2 19 +3 18 +4 17 diff --git a/codenet/public_test_cases/p02874/input.2.txt b/codenet/public_test_cases/p02874/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1971fad61874f24da7603a8a2a0abc4fb1165a73 --- /dev/null +++ b/codenet/public_test_cases/p02874/input.2.txt @@ -0,0 +1,5 @@ +4 +4 7 +1 4 +5 8 +2 5 diff --git a/codenet/public_test_cases/p02874/input.3.txt b/codenet/public_test_cases/p02874/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..081558951ddca27462abca79a99be82356ade104 --- /dev/null +++ b/codenet/public_test_cases/p02874/input.3.txt @@ -0,0 +1,11 @@ +10 +457835016 996058008 +456475528 529149798 +455108441 512701454 +455817105 523506955 +457368248 814532746 +455073228 459494089 +456651538 774276744 +457667152 974637457 +457293701 800549465 +456580262 636471526 diff --git a/codenet/public_test_cases/p02874/output.0.txt b/codenet/public_test_cases/p02874/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02874/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02874/output.1.txt b/codenet/public_test_cases/p02874/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p02874/output.1.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p02874/output.2.txt b/codenet/public_test_cases/p02874/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02874/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02874/output.3.txt b/codenet/public_test_cases/p02874/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4aa9a6d2c01a32f4bdcf78b54187c740a9096b93 --- /dev/null +++ b/codenet/public_test_cases/p02874/output.3.txt @@ -0,0 +1 @@ +540049931 diff --git a/codenet/public_test_cases/p02875/input.0.txt b/codenet/public_test_cases/p02875/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02875/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02875/input.1.txt b/codenet/public_test_cases/p02875/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02875/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02875/input.2.txt b/codenet/public_test_cases/p02875/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..749fce669df1b51cae4a71dc130b2a14807829f0 --- /dev/null +++ b/codenet/public_test_cases/p02875/input.2.txt @@ -0,0 +1 @@ +1000000 diff --git a/codenet/public_test_cases/p02875/input.3.txt b/codenet/public_test_cases/p02875/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02875/input.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02875/output.0.txt b/codenet/public_test_cases/p02875/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02875/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02875/output.1.txt b/codenet/public_test_cases/p02875/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02875/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02875/output.2.txt b/codenet/public_test_cases/p02875/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8f53e528e76ae68bbcd3e8f39a8ccb10c30546b --- /dev/null +++ b/codenet/public_test_cases/p02875/output.2.txt @@ -0,0 +1 @@ +210055358 diff --git a/codenet/public_test_cases/p02875/output.3.txt b/codenet/public_test_cases/p02875/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d04fa8f3d49beb4626f7cae645044e33c5b901e9 --- /dev/null +++ b/codenet/public_test_cases/p02875/output.3.txt @@ -0,0 +1 @@ +50007 diff --git a/codenet/public_test_cases/p02876/input.0.txt b/codenet/public_test_cases/p02876/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50f8332165a1b6fcf008ee98767223dcd068d316 --- /dev/null +++ b/codenet/public_test_cases/p02876/input.0.txt @@ -0,0 +1,3 @@ +2 +3 2 +1 2 diff --git a/codenet/public_test_cases/p02876/input.1.txt b/codenet/public_test_cases/p02876/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69c8d28db25ab234fc6d5379ca5b48d144268564 --- /dev/null +++ b/codenet/public_test_cases/p02876/input.1.txt @@ -0,0 +1,4 @@ +3 +4 1 +5 2 +6 3 diff --git a/codenet/public_test_cases/p02876/input.2.txt b/codenet/public_test_cases/p02876/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..028a868f080e9c0bc873ea7a90f2196d65f648d8 --- /dev/null +++ b/codenet/public_test_cases/p02876/input.2.txt @@ -0,0 +1,5 @@ +4 +1 5 +4 7 +2 1 +8 4 diff --git a/codenet/public_test_cases/p02876/input.3.txt b/codenet/public_test_cases/p02876/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..50f8332165a1b6fcf008ee98767223dcd068d316 --- /dev/null +++ b/codenet/public_test_cases/p02876/input.3.txt @@ -0,0 +1,3 @@ +2 +3 2 +1 2 diff --git a/codenet/public_test_cases/p02876/input.4.txt b/codenet/public_test_cases/p02876/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..267bab848da6901e0f4798eb9588d8d3113000e1 --- /dev/null +++ b/codenet/public_test_cases/p02876/input.4.txt @@ -0,0 +1,11 @@ +10 +866111664 178537096 +705445072 318106937 +472381277 579910117 +353498483 865935868 +383133839 231371336 +378371075 681212831 +304570952 16537461 +955719384 267238505 +844917655 218662351 +550309930 62731178 diff --git a/codenet/public_test_cases/p02876/output.0.txt b/codenet/public_test_cases/p02876/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c67935b4f7ea6b9e676e8dae3b32b6f5aa810ee --- /dev/null +++ b/codenet/public_test_cases/p02876/output.0.txt @@ -0,0 +1 @@ +1 4 diff --git a/codenet/public_test_cases/p02876/output.1.txt b/codenet/public_test_cases/p02876/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e8183b72e5ed9b26e9e2c64bb6bc849b23b0690 --- /dev/null +++ b/codenet/public_test_cases/p02876/output.1.txt @@ -0,0 +1 @@ +0 1 diff --git a/codenet/public_test_cases/p02876/output.2.txt b/codenet/public_test_cases/p02876/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p02876/output.2.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p02876/output.3.txt b/codenet/public_test_cases/p02876/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c67935b4f7ea6b9e676e8dae3b32b6f5aa810ee --- /dev/null +++ b/codenet/public_test_cases/p02876/output.3.txt @@ -0,0 +1 @@ +1 4 diff --git a/codenet/public_test_cases/p02876/output.4.txt b/codenet/public_test_cases/p02876/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dccb8d7b56e092b98c1182d5b8c7579142d1ab18 --- /dev/null +++ b/codenet/public_test_cases/p02876/output.4.txt @@ -0,0 +1 @@ +697461712 2899550585 diff --git a/codenet/public_test_cases/p02877/input.0.txt b/codenet/public_test_cases/p02877/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0f9422c2af2449798d771eb8593e0efe8c4ee79 --- /dev/null +++ b/codenet/public_test_cases/p02877/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 1 2 1 diff --git a/codenet/public_test_cases/p02877/input.1.txt b/codenet/public_test_cases/p02877/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb909d5008e298386625b549e0dd49714a60f61f --- /dev/null +++ b/codenet/public_test_cases/p02877/input.1.txt @@ -0,0 +1,2 @@ +15 +541962451 761940280 182215520 378290929 211514670 802103642 28942109 641621418 380343684 526398645 81993818 14709769 139483158 444795625 40343083 diff --git a/codenet/public_test_cases/p02877/input.2.txt b/codenet/public_test_cases/p02877/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0f9422c2af2449798d771eb8593e0efe8c4ee79 --- /dev/null +++ b/codenet/public_test_cases/p02877/input.2.txt @@ -0,0 +1,2 @@ +5 +1 2 1 2 1 diff --git a/codenet/public_test_cases/p02877/input.3.txt b/codenet/public_test_cases/p02877/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..46dcc49a2e12db7593ef436b425d1f89b66bcfb9 --- /dev/null +++ b/codenet/public_test_cases/p02877/input.3.txt @@ -0,0 +1,2 @@ +5 +2 1 2 1 2 diff --git a/codenet/public_test_cases/p02877/output.0.txt b/codenet/public_test_cases/p02877/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02877/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02877/output.1.txt b/codenet/public_test_cases/p02877/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02877/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02877/output.2.txt b/codenet/public_test_cases/p02877/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02877/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02877/output.3.txt b/codenet/public_test_cases/p02877/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02877/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02878/input.0.txt b/codenet/public_test_cases/p02878/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e8e1cc805cd29e8d105a940dff9161dea69637a --- /dev/null +++ b/codenet/public_test_cases/p02878/input.0.txt @@ -0,0 +1 @@ +5 1 3 diff --git a/codenet/public_test_cases/p02878/input.1.txt b/codenet/public_test_cases/p02878/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e8e1cc805cd29e8d105a940dff9161dea69637a --- /dev/null +++ b/codenet/public_test_cases/p02878/input.1.txt @@ -0,0 +1 @@ +5 1 3 diff --git a/codenet/public_test_cases/p02878/input.2.txt b/codenet/public_test_cases/p02878/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..89c4f674f7769f7bfcb759d05dda765e58a50ff7 --- /dev/null +++ b/codenet/public_test_cases/p02878/input.2.txt @@ -0,0 +1 @@ +1000000 100000 200000 diff --git a/codenet/public_test_cases/p02878/input.3.txt b/codenet/public_test_cases/p02878/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0b30bc3843614541894c291b2a56c7ebc829bcd --- /dev/null +++ b/codenet/public_test_cases/p02878/input.3.txt @@ -0,0 +1 @@ +10 4 6 diff --git a/codenet/public_test_cases/p02878/input.4.txt b/codenet/public_test_cases/p02878/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..203d77b5602d9d44adaf0a22021ef750ac3ec3b3 --- /dev/null +++ b/codenet/public_test_cases/p02878/input.4.txt @@ -0,0 +1 @@ +10 0 0 diff --git a/codenet/public_test_cases/p02878/output.0.txt b/codenet/public_test_cases/p02878/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02878/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02878/output.1.txt b/codenet/public_test_cases/p02878/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02878/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02878/output.2.txt b/codenet/public_test_cases/p02878/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a23e9537df49e8f9104740c6f94e2cdd68edb3ec --- /dev/null +++ b/codenet/public_test_cases/p02878/output.2.txt @@ -0,0 +1 @@ +758840509 diff --git a/codenet/public_test_cases/p02878/output.3.txt b/codenet/public_test_cases/p02878/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..538165229c7218b9aff6eb21037b85dd3b77612b --- /dev/null +++ b/codenet/public_test_cases/p02878/output.3.txt @@ -0,0 +1 @@ +197 diff --git a/codenet/public_test_cases/p02878/output.4.txt b/codenet/public_test_cases/p02878/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02878/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02879/input.0.txt b/codenet/public_test_cases/p02879/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p02879/input.0.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p02879/input.1.txt b/codenet/public_test_cases/p02879/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p02879/input.1.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p02879/input.2.txt b/codenet/public_test_cases/p02879/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0735df076db346a0535cd123ba6b42f99531a74 --- /dev/null +++ b/codenet/public_test_cases/p02879/input.2.txt @@ -0,0 +1 @@ +9 9 diff --git a/codenet/public_test_cases/p02879/input.3.txt b/codenet/public_test_cases/p02879/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..795ed346d0db02e9292e1c9c4e690016ce174cda --- /dev/null +++ b/codenet/public_test_cases/p02879/input.3.txt @@ -0,0 +1 @@ +5 10 diff --git a/codenet/public_test_cases/p02879/output.0.txt b/codenet/public_test_cases/p02879/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02879/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02879/output.1.txt b/codenet/public_test_cases/p02879/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02879/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02879/output.2.txt b/codenet/public_test_cases/p02879/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d88e313699871a6c780316c8df7479aebe6999c0 --- /dev/null +++ b/codenet/public_test_cases/p02879/output.2.txt @@ -0,0 +1 @@ +81 diff --git a/codenet/public_test_cases/p02879/output.3.txt b/codenet/public_test_cases/p02879/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02879/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02880/input.0.txt b/codenet/public_test_cases/p02880/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02880/input.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02880/input.1.txt b/codenet/public_test_cases/p02880/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02880/input.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02880/input.2.txt b/codenet/public_test_cases/p02880/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d88e313699871a6c780316c8df7479aebe6999c0 --- /dev/null +++ b/codenet/public_test_cases/p02880/input.2.txt @@ -0,0 +1 @@ +81 diff --git a/codenet/public_test_cases/p02880/input.3.txt b/codenet/public_test_cases/p02880/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p02880/input.3.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p02880/output.0.txt b/codenet/public_test_cases/p02880/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02880/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02880/output.1.txt b/codenet/public_test_cases/p02880/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02880/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02880/output.2.txt b/codenet/public_test_cases/p02880/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02880/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02880/output.3.txt b/codenet/public_test_cases/p02880/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02880/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02881/input.0.txt b/codenet/public_test_cases/p02881/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02881/input.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02881/input.1.txt b/codenet/public_test_cases/p02881/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7b35fbfd504b2315bdc3cb7a007d6416c2e5f19 --- /dev/null +++ b/codenet/public_test_cases/p02881/input.1.txt @@ -0,0 +1 @@ +10000000019 diff --git a/codenet/public_test_cases/p02881/input.2.txt b/codenet/public_test_cases/p02881/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p02881/input.2.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p02881/input.3.txt b/codenet/public_test_cases/p02881/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02881/input.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02881/output.0.txt b/codenet/public_test_cases/p02881/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02881/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02881/output.1.txt b/codenet/public_test_cases/p02881/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..77d182c0487ac4b385ace2679769f1a553c80dbc --- /dev/null +++ b/codenet/public_test_cases/p02881/output.1.txt @@ -0,0 +1 @@ +10000000018 diff --git a/codenet/public_test_cases/p02881/output.2.txt b/codenet/public_test_cases/p02881/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02881/output.2.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02881/output.3.txt b/codenet/public_test_cases/p02881/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02881/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02882/input.0.txt b/codenet/public_test_cases/p02882/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f50aaec4daf65c6d1b8b27ee9252b0ded2352265 --- /dev/null +++ b/codenet/public_test_cases/p02882/input.0.txt @@ -0,0 +1 @@ +2 2 4 diff --git a/codenet/public_test_cases/p02882/input.1.txt b/codenet/public_test_cases/p02882/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f50aaec4daf65c6d1b8b27ee9252b0ded2352265 --- /dev/null +++ b/codenet/public_test_cases/p02882/input.1.txt @@ -0,0 +1 @@ +2 2 4 diff --git a/codenet/public_test_cases/p02882/input.2.txt b/codenet/public_test_cases/p02882/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fe94666c6518ff67e260bd26e5abe14fd177548 --- /dev/null +++ b/codenet/public_test_cases/p02882/input.2.txt @@ -0,0 +1 @@ +12 21 10 diff --git a/codenet/public_test_cases/p02882/input.3.txt b/codenet/public_test_cases/p02882/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..469cc0f07ba15d2e4ab7685d335430ea7b487677 --- /dev/null +++ b/codenet/public_test_cases/p02882/input.3.txt @@ -0,0 +1 @@ +3 1 8 diff --git a/codenet/public_test_cases/p02882/output.0.txt b/codenet/public_test_cases/p02882/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d8641918d296a6b8b52443b9f1fc5bf32c2b856 --- /dev/null +++ b/codenet/public_test_cases/p02882/output.0.txt @@ -0,0 +1 @@ +45.0000000000 diff --git a/codenet/public_test_cases/p02882/output.1.txt b/codenet/public_test_cases/p02882/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d8641918d296a6b8b52443b9f1fc5bf32c2b856 --- /dev/null +++ b/codenet/public_test_cases/p02882/output.1.txt @@ -0,0 +1 @@ +45.0000000000 diff --git a/codenet/public_test_cases/p02882/output.2.txt b/codenet/public_test_cases/p02882/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..09c2e945c05d8ae793813fab5842a5956b6314ac --- /dev/null +++ b/codenet/public_test_cases/p02882/output.2.txt @@ -0,0 +1 @@ +89.7834636934 diff --git a/codenet/public_test_cases/p02882/output.3.txt b/codenet/public_test_cases/p02882/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3b8514057af57498705b66513ae94b0e479d1b5 --- /dev/null +++ b/codenet/public_test_cases/p02882/output.3.txt @@ -0,0 +1 @@ +4.2363947991 diff --git a/codenet/public_test_cases/p02883/input.0.txt b/codenet/public_test_cases/p02883/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e6ca41eb80d9e5916eeb3213c0bbf59929f5f92 --- /dev/null +++ b/codenet/public_test_cases/p02883/input.0.txt @@ -0,0 +1,3 @@ +3 5 +4 2 1 +2 3 1 diff --git a/codenet/public_test_cases/p02883/input.1.txt b/codenet/public_test_cases/p02883/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0b25bc215b1b035f33d8bac30ac160248326fa7 --- /dev/null +++ b/codenet/public_test_cases/p02883/input.1.txt @@ -0,0 +1,3 @@ +3 8 +4 2 1 +2 3 1 diff --git a/codenet/public_test_cases/p02883/input.2.txt b/codenet/public_test_cases/p02883/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e6ca41eb80d9e5916eeb3213c0bbf59929f5f92 --- /dev/null +++ b/codenet/public_test_cases/p02883/input.2.txt @@ -0,0 +1,3 @@ +3 5 +4 2 1 +2 3 1 diff --git a/codenet/public_test_cases/p02883/input.3.txt b/codenet/public_test_cases/p02883/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..07def6dc617e92236d0ca4f1b74465eb53d280df --- /dev/null +++ b/codenet/public_test_cases/p02883/input.3.txt @@ -0,0 +1,3 @@ +11 14 +3 1 4 1 5 9 2 6 5 3 5 +8 9 7 9 3 2 3 8 4 6 2 diff --git a/codenet/public_test_cases/p02883/output.0.txt b/codenet/public_test_cases/p02883/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02883/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02883/output.1.txt b/codenet/public_test_cases/p02883/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02883/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02883/output.2.txt b/codenet/public_test_cases/p02883/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02883/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02883/output.3.txt b/codenet/public_test_cases/p02883/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02883/output.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02884/input.0.txt b/codenet/public_test_cases/p02884/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c40f124ace66dce07723a8f05d62f2fe011c113 --- /dev/null +++ b/codenet/public_test_cases/p02884/input.0.txt @@ -0,0 +1,7 @@ +4 6 +1 4 +2 3 +1 3 +1 2 +3 4 +2 4 diff --git a/codenet/public_test_cases/p02884/input.1.txt b/codenet/public_test_cases/p02884/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c40f124ace66dce07723a8f05d62f2fe011c113 --- /dev/null +++ b/codenet/public_test_cases/p02884/input.1.txt @@ -0,0 +1,7 @@ +4 6 +1 4 +2 3 +1 3 +1 2 +3 4 +2 4 diff --git a/codenet/public_test_cases/p02884/input.2.txt b/codenet/public_test_cases/p02884/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p02884/input.2.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p02884/input.3.txt b/codenet/public_test_cases/p02884/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..84b1145e43353537c7fe9757d1fe4614806d6148 --- /dev/null +++ b/codenet/public_test_cases/p02884/input.3.txt @@ -0,0 +1,34 @@ +10 33 +3 7 +5 10 +8 9 +1 10 +4 6 +2 5 +1 7 +6 10 +1 4 +1 3 +8 10 +1 5 +2 6 +6 9 +5 6 +5 8 +3 6 +4 8 +2 7 +2 9 +6 7 +1 2 +5 9 +6 8 +9 10 +3 9 +7 8 +4 5 +2 10 +5 7 +3 5 +4 7 +4 9 diff --git a/codenet/public_test_cases/p02884/output.0.txt b/codenet/public_test_cases/p02884/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..24ee91d9b02e05f13952ae5231a7643a073292b3 --- /dev/null +++ b/codenet/public_test_cases/p02884/output.0.txt @@ -0,0 +1 @@ +1.5000000000 diff --git a/codenet/public_test_cases/p02884/output.1.txt b/codenet/public_test_cases/p02884/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..24ee91d9b02e05f13952ae5231a7643a073292b3 --- /dev/null +++ b/codenet/public_test_cases/p02884/output.1.txt @@ -0,0 +1 @@ +1.5000000000 diff --git a/codenet/public_test_cases/p02884/output.2.txt b/codenet/public_test_cases/p02884/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b79fe6d0e019db65d91d38d05cb8616be73a00a --- /dev/null +++ b/codenet/public_test_cases/p02884/output.2.txt @@ -0,0 +1 @@ +2.0000000000 diff --git a/codenet/public_test_cases/p02884/output.3.txt b/codenet/public_test_cases/p02884/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6a160f513f68c42a2dfaf2c2f402601f8ee95f9 --- /dev/null +++ b/codenet/public_test_cases/p02884/output.3.txt @@ -0,0 +1 @@ +3.0133333333 diff --git a/codenet/public_test_cases/p02885/input.0.txt b/codenet/public_test_cases/p02885/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..402a8cae801d0d5d4a06b1fee162760e058f73ff --- /dev/null +++ b/codenet/public_test_cases/p02885/input.0.txt @@ -0,0 +1 @@ +12 4 diff --git a/codenet/public_test_cases/p02885/input.1.txt b/codenet/public_test_cases/p02885/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0060859b452a59e54223686d6c4afba11c2dddf9 --- /dev/null +++ b/codenet/public_test_cases/p02885/input.1.txt @@ -0,0 +1 @@ +20 30 diff --git a/codenet/public_test_cases/p02885/input.2.txt b/codenet/public_test_cases/p02885/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..402a8cae801d0d5d4a06b1fee162760e058f73ff --- /dev/null +++ b/codenet/public_test_cases/p02885/input.2.txt @@ -0,0 +1 @@ +12 4 diff --git a/codenet/public_test_cases/p02885/input.3.txt b/codenet/public_test_cases/p02885/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0ac26d0b1a6c295ee112721b82427228c0d18aa --- /dev/null +++ b/codenet/public_test_cases/p02885/input.3.txt @@ -0,0 +1 @@ +20 15 diff --git a/codenet/public_test_cases/p02885/output.0.txt b/codenet/public_test_cases/p02885/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02885/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02885/output.1.txt b/codenet/public_test_cases/p02885/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02885/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02885/output.2.txt b/codenet/public_test_cases/p02885/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02885/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02885/output.3.txt b/codenet/public_test_cases/p02885/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02885/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02886/input.0.txt b/codenet/public_test_cases/p02886/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01bb4fbbea6da8df33c21f7a2e91032e7167cee8 --- /dev/null +++ b/codenet/public_test_cases/p02886/input.0.txt @@ -0,0 +1,2 @@ +3 +3 1 2 diff --git a/codenet/public_test_cases/p02886/input.1.txt b/codenet/public_test_cases/p02886/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01bb4fbbea6da8df33c21f7a2e91032e7167cee8 --- /dev/null +++ b/codenet/public_test_cases/p02886/input.1.txt @@ -0,0 +1,2 @@ +3 +3 1 2 diff --git a/codenet/public_test_cases/p02886/input.2.txt b/codenet/public_test_cases/p02886/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b04cbc5928b33de1e50e1429851f2c8186e31c6 --- /dev/null +++ b/codenet/public_test_cases/p02886/input.2.txt @@ -0,0 +1,2 @@ +7 +5 0 7 8 3 3 2 diff --git a/codenet/public_test_cases/p02886/output.0.txt b/codenet/public_test_cases/p02886/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02886/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02886/output.1.txt b/codenet/public_test_cases/p02886/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02886/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02886/output.2.txt b/codenet/public_test_cases/p02886/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1e0432c9a7d553d7b06d64216b464bc80b234bc --- /dev/null +++ b/codenet/public_test_cases/p02886/output.2.txt @@ -0,0 +1 @@ +312 diff --git a/codenet/public_test_cases/p02887/input.0.txt b/codenet/public_test_cases/p02887/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0220e204e56635fd741e653acd10f34842781b4 --- /dev/null +++ b/codenet/public_test_cases/p02887/input.0.txt @@ -0,0 +1,2 @@ +10 +aabbbbaaca diff --git a/codenet/public_test_cases/p02887/input.1.txt b/codenet/public_test_cases/p02887/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afb1dd3dbd6437efa17313ba6b4c3bcba7c12fc7 --- /dev/null +++ b/codenet/public_test_cases/p02887/input.1.txt @@ -0,0 +1,2 @@ +20 +xxzaffeeeeddfkkkkllq diff --git a/codenet/public_test_cases/p02887/input.2.txt b/codenet/public_test_cases/p02887/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..046200748a4c9cf16940185e23ba701f40df465d --- /dev/null +++ b/codenet/public_test_cases/p02887/input.2.txt @@ -0,0 +1,2 @@ +5 +aaaaa diff --git a/codenet/public_test_cases/p02887/input.3.txt b/codenet/public_test_cases/p02887/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0220e204e56635fd741e653acd10f34842781b4 --- /dev/null +++ b/codenet/public_test_cases/p02887/input.3.txt @@ -0,0 +1,2 @@ +10 +aabbbbaaca diff --git a/codenet/public_test_cases/p02887/output.0.txt b/codenet/public_test_cases/p02887/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02887/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02887/output.1.txt b/codenet/public_test_cases/p02887/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02887/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02887/output.2.txt b/codenet/public_test_cases/p02887/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02887/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02887/output.3.txt b/codenet/public_test_cases/p02887/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02887/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02888/input.0.txt b/codenet/public_test_cases/p02888/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a743c62d9727c4232090a046e55db58c9249cd9a --- /dev/null +++ b/codenet/public_test_cases/p02888/input.0.txt @@ -0,0 +1,2 @@ +4 +3 4 2 1 diff --git a/codenet/public_test_cases/p02888/input.1.txt b/codenet/public_test_cases/p02888/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a743c62d9727c4232090a046e55db58c9249cd9a --- /dev/null +++ b/codenet/public_test_cases/p02888/input.1.txt @@ -0,0 +1,2 @@ +4 +3 4 2 1 diff --git a/codenet/public_test_cases/p02888/input.2.txt b/codenet/public_test_cases/p02888/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b857cc273584e303412d7c1a23f8d7b87ba7c8da --- /dev/null +++ b/codenet/public_test_cases/p02888/input.2.txt @@ -0,0 +1,2 @@ +7 +218 786 704 233 645 728 389 diff --git a/codenet/public_test_cases/p02888/input.3.txt b/codenet/public_test_cases/p02888/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ca1f7e317dd62d8ea7c9bd966b801f79eb8792f --- /dev/null +++ b/codenet/public_test_cases/p02888/input.3.txt @@ -0,0 +1,2 @@ +3 +1 1000 1 diff --git a/codenet/public_test_cases/p02888/output.0.txt b/codenet/public_test_cases/p02888/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02888/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02888/output.1.txt b/codenet/public_test_cases/p02888/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02888/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02888/output.2.txt b/codenet/public_test_cases/p02888/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p02888/output.2.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p02888/output.3.txt b/codenet/public_test_cases/p02888/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02888/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02889/input.0.txt b/codenet/public_test_cases/p02889/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5cbcfd7d13b1b5284d7cf891851255622534ec3 --- /dev/null +++ b/codenet/public_test_cases/p02889/input.0.txt @@ -0,0 +1,6 @@ +3 2 5 +1 2 3 +2 3 3 +2 +3 2 +1 3 diff --git a/codenet/public_test_cases/p02889/input.1.txt b/codenet/public_test_cases/p02889/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aeb506d7d4cddddab3783e733ea6f04da9c9eb4e --- /dev/null +++ b/codenet/public_test_cases/p02889/input.1.txt @@ -0,0 +1,3 @@ +4 0 1 +1 +2 1 diff --git a/codenet/public_test_cases/p02889/input.2.txt b/codenet/public_test_cases/p02889/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb7ea0a56bd35fa090681fd90a9a1cd2ed7c99b --- /dev/null +++ b/codenet/public_test_cases/p02889/input.2.txt @@ -0,0 +1,26 @@ +5 4 4 +1 2 2 +2 3 2 +3 4 3 +4 5 2 +20 +2 1 +3 1 +4 1 +5 1 +1 2 +3 2 +4 2 +5 2 +1 3 +2 3 +4 3 +5 3 +1 4 +2 4 +3 4 +5 4 +1 5 +2 5 +3 5 +4 5 diff --git a/codenet/public_test_cases/p02889/input.3.txt b/codenet/public_test_cases/p02889/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5cbcfd7d13b1b5284d7cf891851255622534ec3 --- /dev/null +++ b/codenet/public_test_cases/p02889/input.3.txt @@ -0,0 +1,6 @@ +3 2 5 +1 2 3 +2 3 3 +2 +3 2 +1 3 diff --git a/codenet/public_test_cases/p02889/output.0.txt b/codenet/public_test_cases/p02889/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d66ea1aee9527bfa39185ead1f9cdbd96bba88c --- /dev/null +++ b/codenet/public_test_cases/p02889/output.0.txt @@ -0,0 +1,2 @@ +0 +1 diff --git a/codenet/public_test_cases/p02889/output.1.txt b/codenet/public_test_cases/p02889/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02889/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02889/output.2.txt b/codenet/public_test_cases/p02889/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..79be95da517940eb40363962f7f3dc5c178174ef --- /dev/null +++ b/codenet/public_test_cases/p02889/output.2.txt @@ -0,0 +1,20 @@ +0 +0 +1 +2 +0 +0 +1 +2 +0 +0 +0 +1 +1 +1 +0 +0 +2 +2 +1 +0 diff --git a/codenet/public_test_cases/p02889/output.3.txt b/codenet/public_test_cases/p02889/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d66ea1aee9527bfa39185ead1f9cdbd96bba88c --- /dev/null +++ b/codenet/public_test_cases/p02889/output.3.txt @@ -0,0 +1,2 @@ +0 +1 diff --git a/codenet/public_test_cases/p02890/input.0.txt b/codenet/public_test_cases/p02890/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b98c7f17e7bf6f9308820cb5bd0a09248347a1d --- /dev/null +++ b/codenet/public_test_cases/p02890/input.0.txt @@ -0,0 +1,2 @@ +3 +2 1 2 diff --git a/codenet/public_test_cases/p02890/input.1.txt b/codenet/public_test_cases/p02890/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p02890/input.1.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02890/input.2.txt b/codenet/public_test_cases/p02890/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c10d370b400dd9c3cda34fa40a2414bb474d5d26 --- /dev/null +++ b/codenet/public_test_cases/p02890/input.2.txt @@ -0,0 +1,2 @@ +4 +1 3 3 3 diff --git a/codenet/public_test_cases/p02890/input.3.txt b/codenet/public_test_cases/p02890/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b98c7f17e7bf6f9308820cb5bd0a09248347a1d --- /dev/null +++ b/codenet/public_test_cases/p02890/input.3.txt @@ -0,0 +1,2 @@ +3 +2 1 2 diff --git a/codenet/public_test_cases/p02890/output.0.txt b/codenet/public_test_cases/p02890/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b90379abb74e1fddf978dc94ff316bc2412331c --- /dev/null +++ b/codenet/public_test_cases/p02890/output.0.txt @@ -0,0 +1,3 @@ +3 +1 +0 diff --git a/codenet/public_test_cases/p02890/output.1.txt b/codenet/public_test_cases/p02890/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d55dd1bbf774ba7743038c6535195383cf480e29 --- /dev/null +++ b/codenet/public_test_cases/p02890/output.1.txt @@ -0,0 +1,5 @@ +5 +2 +1 +1 +1 diff --git a/codenet/public_test_cases/p02890/output.2.txt b/codenet/public_test_cases/p02890/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a991da4e4da3ac835dea054243dce00681605fa --- /dev/null +++ b/codenet/public_test_cases/p02890/output.2.txt @@ -0,0 +1,4 @@ +4 +1 +0 +0 diff --git a/codenet/public_test_cases/p02890/output.3.txt b/codenet/public_test_cases/p02890/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b90379abb74e1fddf978dc94ff316bc2412331c --- /dev/null +++ b/codenet/public_test_cases/p02890/output.3.txt @@ -0,0 +1,3 @@ +3 +1 +0 diff --git a/codenet/public_test_cases/p02891/input.0.txt b/codenet/public_test_cases/p02891/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d46386467537d89dfa15f5605467aabec52b9a19 --- /dev/null +++ b/codenet/public_test_cases/p02891/input.0.txt @@ -0,0 +1,2 @@ +issii +2 diff --git a/codenet/public_test_cases/p02891/input.1.txt b/codenet/public_test_cases/p02891/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e675ff9cad5b3aaebc5085e35deb4e8e2859124 --- /dev/null +++ b/codenet/public_test_cases/p02891/input.1.txt @@ -0,0 +1,2 @@ +cooooooooonteeeeeeeeeest +999993333 diff --git a/codenet/public_test_cases/p02891/input.2.txt b/codenet/public_test_cases/p02891/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d46386467537d89dfa15f5605467aabec52b9a19 --- /dev/null +++ b/codenet/public_test_cases/p02891/input.2.txt @@ -0,0 +1,2 @@ +issii +2 diff --git a/codenet/public_test_cases/p02891/input.3.txt b/codenet/public_test_cases/p02891/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..71d62daca249c0d6064c7cf3f6c964fe4c742b44 --- /dev/null +++ b/codenet/public_test_cases/p02891/input.3.txt @@ -0,0 +1,2 @@ +qq +81 diff --git a/codenet/public_test_cases/p02891/output.0.txt b/codenet/public_test_cases/p02891/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02891/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02891/output.1.txt b/codenet/public_test_cases/p02891/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3827e7289640592de317d3175caf53b02ccd02f5 --- /dev/null +++ b/codenet/public_test_cases/p02891/output.1.txt @@ -0,0 +1 @@ +8999939997 diff --git a/codenet/public_test_cases/p02891/output.2.txt b/codenet/public_test_cases/p02891/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02891/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02891/output.3.txt b/codenet/public_test_cases/p02891/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d88e313699871a6c780316c8df7479aebe6999c0 --- /dev/null +++ b/codenet/public_test_cases/p02891/output.3.txt @@ -0,0 +1 @@ +81 diff --git a/codenet/public_test_cases/p02892/input.0.txt b/codenet/public_test_cases/p02892/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4e855b546d321aa5c0de763a1ccf550f6daa124 --- /dev/null +++ b/codenet/public_test_cases/p02892/input.0.txt @@ -0,0 +1,3 @@ +2 +01 +10 diff --git a/codenet/public_test_cases/p02892/input.1.txt b/codenet/public_test_cases/p02892/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4e855b546d321aa5c0de763a1ccf550f6daa124 --- /dev/null +++ b/codenet/public_test_cases/p02892/input.1.txt @@ -0,0 +1,3 @@ +2 +01 +10 diff --git a/codenet/public_test_cases/p02892/input.2.txt b/codenet/public_test_cases/p02892/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f6f26d4b011b1df64152785a40a33869b8a952c --- /dev/null +++ b/codenet/public_test_cases/p02892/input.2.txt @@ -0,0 +1,7 @@ +6 +010110 +101001 +010100 +101000 +100000 +010000 diff --git a/codenet/public_test_cases/p02892/input.3.txt b/codenet/public_test_cases/p02892/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc3c472c7fde6596c703d8bbbcd93970763c1721 --- /dev/null +++ b/codenet/public_test_cases/p02892/input.3.txt @@ -0,0 +1,4 @@ +3 +011 +101 +110 diff --git a/codenet/public_test_cases/p02892/output.0.txt b/codenet/public_test_cases/p02892/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02892/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02892/output.1.txt b/codenet/public_test_cases/p02892/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02892/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02892/output.2.txt b/codenet/public_test_cases/p02892/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02892/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02892/output.3.txt b/codenet/public_test_cases/p02892/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02892/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02893/input.0.txt b/codenet/public_test_cases/p02893/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a33976e5579efb56c480a4b6f431ad8e136a8238 --- /dev/null +++ b/codenet/public_test_cases/p02893/input.0.txt @@ -0,0 +1,2 @@ +3 +111 diff --git a/codenet/public_test_cases/p02893/input.1.txt b/codenet/public_test_cases/p02893/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e802124d0e41fc9706e73eee35b930cb4bcc800 --- /dev/null +++ b/codenet/public_test_cases/p02893/input.1.txt @@ -0,0 +1,2 @@ +30 +001110011011011101010111011100 diff --git a/codenet/public_test_cases/p02893/input.2.txt b/codenet/public_test_cases/p02893/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a33976e5579efb56c480a4b6f431ad8e136a8238 --- /dev/null +++ b/codenet/public_test_cases/p02893/input.2.txt @@ -0,0 +1,2 @@ +3 +111 diff --git a/codenet/public_test_cases/p02893/input.3.txt b/codenet/public_test_cases/p02893/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9cf7f95b44789e23ccc8214434a8f54f044af93 --- /dev/null +++ b/codenet/public_test_cases/p02893/input.3.txt @@ -0,0 +1,2 @@ +6 +110101 diff --git a/codenet/public_test_cases/p02893/output.0.txt b/codenet/public_test_cases/p02893/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p02893/output.0.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p02893/output.1.txt b/codenet/public_test_cases/p02893/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..42322b69210dc7e9419efc172dea3f812852aed8 --- /dev/null +++ b/codenet/public_test_cases/p02893/output.1.txt @@ -0,0 +1 @@ +549320998 diff --git a/codenet/public_test_cases/p02893/output.2.txt b/codenet/public_test_cases/p02893/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p02893/output.2.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p02893/output.3.txt b/codenet/public_test_cases/p02893/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac62e9337c2a3384827faf14ec82d6b81bf4ca14 --- /dev/null +++ b/codenet/public_test_cases/p02893/output.3.txt @@ -0,0 +1 @@ +616 diff --git a/codenet/public_test_cases/p02894/input.0.txt b/codenet/public_test_cases/p02894/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f15674a5f5ea645fa65ad723c91fd6e42020aa18 --- /dev/null +++ b/codenet/public_test_cases/p02894/input.0.txt @@ -0,0 +1,4 @@ +3 4 +0 +1 +3 diff --git a/codenet/public_test_cases/p02894/input.1.txt b/codenet/public_test_cases/p02894/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f15674a5f5ea645fa65ad723c91fd6e42020aa18 --- /dev/null +++ b/codenet/public_test_cases/p02894/input.1.txt @@ -0,0 +1,4 @@ +3 4 +0 +1 +3 diff --git a/codenet/public_test_cases/p02894/input.2.txt b/codenet/public_test_cases/p02894/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..640e0a9db7d73fce606e7c86afc99b008f367ac1 --- /dev/null +++ b/codenet/public_test_cases/p02894/input.2.txt @@ -0,0 +1,11 @@ +10 100 +2 +11 +35 +42 +54 +69 +89 +91 +93 +99 diff --git a/codenet/public_test_cases/p02894/input.3.txt b/codenet/public_test_cases/p02894/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d5e96f8c24f32e505443d9d1ba72d3a0ccbf477 --- /dev/null +++ b/codenet/public_test_cases/p02894/input.3.txt @@ -0,0 +1,5 @@ +4 8 +1 +3 +5 +6 diff --git a/codenet/public_test_cases/p02894/output.0.txt b/codenet/public_test_cases/p02894/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5fb3c8378082efd66be91467198c250503ee9bf --- /dev/null +++ b/codenet/public_test_cases/p02894/output.0.txt @@ -0,0 +1 @@ +0.414213562373095 -0.000000000000000 diff --git a/codenet/public_test_cases/p02894/output.1.txt b/codenet/public_test_cases/p02894/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5fb3c8378082efd66be91467198c250503ee9bf --- /dev/null +++ b/codenet/public_test_cases/p02894/output.1.txt @@ -0,0 +1 @@ +0.414213562373095 -0.000000000000000 diff --git a/codenet/public_test_cases/p02894/output.2.txt b/codenet/public_test_cases/p02894/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f258c15bf41aad6c980d0dbd16c5b6addac3f96f --- /dev/null +++ b/codenet/public_test_cases/p02894/output.2.txt @@ -0,0 +1 @@ +0.352886583546338 -0.109065017701873 diff --git a/codenet/public_test_cases/p02894/output.3.txt b/codenet/public_test_cases/p02894/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb92a0013c4428d981ce14d02c9c8fbf160179f4 --- /dev/null +++ b/codenet/public_test_cases/p02894/output.3.txt @@ -0,0 +1 @@ +-0.229401949926902 -0.153281482438188 diff --git a/codenet/public_test_cases/p02895/input.0.txt b/codenet/public_test_cases/p02895/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1913959efa8280e7613e5dc90f37e0723937139e --- /dev/null +++ b/codenet/public_test_cases/p02895/input.0.txt @@ -0,0 +1,7 @@ +3 +011111 +101111 +110111 +111011 +111101 +111110 diff --git a/codenet/public_test_cases/p02895/input.1.txt b/codenet/public_test_cases/p02895/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf3b1f2c33a4581567c9bb4aa1d2938839e240a9 --- /dev/null +++ b/codenet/public_test_cases/p02895/input.1.txt @@ -0,0 +1,9 @@ +4 +01111100 +10011111 +10011100 +11101111 +11110111 +11111011 +01011101 +01011110 diff --git a/codenet/public_test_cases/p02895/input.2.txt b/codenet/public_test_cases/p02895/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1913959efa8280e7613e5dc90f37e0723937139e --- /dev/null +++ b/codenet/public_test_cases/p02895/input.2.txt @@ -0,0 +1,7 @@ +3 +011111 +101111 +110111 +111011 +111101 +111110 diff --git a/codenet/public_test_cases/p02895/input.3.txt b/codenet/public_test_cases/p02895/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..37b678bdb173b5b2cf9582f4ea71ace163edf82b --- /dev/null +++ b/codenet/public_test_cases/p02895/input.3.txt @@ -0,0 +1,17 @@ +8 +0111101111111111 +1011101111111111 +1101101111011101 +1110111111111111 +1111011111110111 +0001101111111111 +1111110111011111 +1111111011111111 +1111111101111111 +1111111110111111 +1101110111011111 +1111111111101111 +1111011111110111 +1111111111111011 +1101111111111101 +1111111111111110 diff --git a/codenet/public_test_cases/p02895/output.0.txt b/codenet/public_test_cases/p02895/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02895/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02895/output.1.txt b/codenet/public_test_cases/p02895/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02895/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02895/output.2.txt b/codenet/public_test_cases/p02895/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02895/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02895/output.3.txt b/codenet/public_test_cases/p02895/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d85e44b306b4d057a5c52226bd0ada1f703ae41 --- /dev/null +++ b/codenet/public_test_cases/p02895/output.3.txt @@ -0,0 +1 @@ +4762 diff --git a/codenet/public_test_cases/p02896/input.0.txt b/codenet/public_test_cases/p02896/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..346f4f102f3e9ac8a6c78d7c74d4586e5287e560 --- /dev/null +++ b/codenet/public_test_cases/p02896/input.0.txt @@ -0,0 +1 @@ +2 2 2 998244353 diff --git a/codenet/public_test_cases/p02896/input.1.txt b/codenet/public_test_cases/p02896/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32350ff791d1cab2741e08ad4080b6375016edfe --- /dev/null +++ b/codenet/public_test_cases/p02896/input.1.txt @@ -0,0 +1 @@ +2 3 4 998244353 diff --git a/codenet/public_test_cases/p02896/input.2.txt b/codenet/public_test_cases/p02896/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b4534b2a574f1119a96526efecbb6a1a886304a --- /dev/null +++ b/codenet/public_test_cases/p02896/input.2.txt @@ -0,0 +1 @@ +31 41 59 998244353 diff --git a/codenet/public_test_cases/p02896/input.3.txt b/codenet/public_test_cases/p02896/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..346f4f102f3e9ac8a6c78d7c74d4586e5287e560 --- /dev/null +++ b/codenet/public_test_cases/p02896/input.3.txt @@ -0,0 +1 @@ +2 2 2 998244353 diff --git a/codenet/public_test_cases/p02896/output.0.txt b/codenet/public_test_cases/p02896/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f92bfdd49766b1907d4aec8d3b0f9ed6129d0e6 --- /dev/null +++ b/codenet/public_test_cases/p02896/output.0.txt @@ -0,0 +1 @@ +35 diff --git a/codenet/public_test_cases/p02896/output.1.txt b/codenet/public_test_cases/p02896/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8648a3b2a1f24fe645f0c7150c6c9f07f7539a2 --- /dev/null +++ b/codenet/public_test_cases/p02896/output.1.txt @@ -0,0 +1 @@ +127090 diff --git a/codenet/public_test_cases/p02896/output.2.txt b/codenet/public_test_cases/p02896/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b9004b46e6f91d986a65aa35a67fdf4b28e3968 --- /dev/null +++ b/codenet/public_test_cases/p02896/output.2.txt @@ -0,0 +1 @@ +827794103 diff --git a/codenet/public_test_cases/p02896/output.3.txt b/codenet/public_test_cases/p02896/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f92bfdd49766b1907d4aec8d3b0f9ed6129d0e6 --- /dev/null +++ b/codenet/public_test_cases/p02896/output.3.txt @@ -0,0 +1 @@ +35 diff --git a/codenet/public_test_cases/p02897/input.0.txt b/codenet/public_test_cases/p02897/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02897/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02897/input.1.txt b/codenet/public_test_cases/p02897/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02897/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02897/input.2.txt b/codenet/public_test_cases/p02897/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02897/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02897/input.3.txt b/codenet/public_test_cases/p02897/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02897/input.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02897/output.0.txt b/codenet/public_test_cases/p02897/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..424a46662e8732f48f13c07cfdeb25cf2c09637f --- /dev/null +++ b/codenet/public_test_cases/p02897/output.0.txt @@ -0,0 +1 @@ +0.5000000000 diff --git a/codenet/public_test_cases/p02897/output.1.txt b/codenet/public_test_cases/p02897/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..424a46662e8732f48f13c07cfdeb25cf2c09637f --- /dev/null +++ b/codenet/public_test_cases/p02897/output.1.txt @@ -0,0 +1 @@ +0.5000000000 diff --git a/codenet/public_test_cases/p02897/output.2.txt b/codenet/public_test_cases/p02897/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..487cbbc74cbdc97e962d1773d88da2ca4f560520 --- /dev/null +++ b/codenet/public_test_cases/p02897/output.2.txt @@ -0,0 +1 @@ +1.0000000000 diff --git a/codenet/public_test_cases/p02897/output.3.txt b/codenet/public_test_cases/p02897/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5618026d7566e6945dd7d652b019f9ee35bee12e --- /dev/null +++ b/codenet/public_test_cases/p02897/output.3.txt @@ -0,0 +1 @@ +0.6000000000 diff --git a/codenet/public_test_cases/p02898/input.0.txt b/codenet/public_test_cases/p02898/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..acc640dc44efb5448c9913c8f4d4ad81b6a5697d --- /dev/null +++ b/codenet/public_test_cases/p02898/input.0.txt @@ -0,0 +1,2 @@ +4 150 +150 140 100 200 diff --git a/codenet/public_test_cases/p02898/input.1.txt b/codenet/public_test_cases/p02898/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14fe3a628bb95e59f60bca2482f7c429a66e13f6 --- /dev/null +++ b/codenet/public_test_cases/p02898/input.1.txt @@ -0,0 +1,2 @@ +5 1 +100 200 300 400 500 diff --git a/codenet/public_test_cases/p02898/input.2.txt b/codenet/public_test_cases/p02898/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..acc640dc44efb5448c9913c8f4d4ad81b6a5697d --- /dev/null +++ b/codenet/public_test_cases/p02898/input.2.txt @@ -0,0 +1,2 @@ +4 150 +150 140 100 200 diff --git a/codenet/public_test_cases/p02898/input.3.txt b/codenet/public_test_cases/p02898/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..97511b2bc885071a8db9c8c6a0faced7b1501686 --- /dev/null +++ b/codenet/public_test_cases/p02898/input.3.txt @@ -0,0 +1,2 @@ +1 500 +499 diff --git a/codenet/public_test_cases/p02898/output.0.txt b/codenet/public_test_cases/p02898/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02898/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02898/output.1.txt b/codenet/public_test_cases/p02898/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02898/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02898/output.2.txt b/codenet/public_test_cases/p02898/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02898/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02898/output.3.txt b/codenet/public_test_cases/p02898/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02898/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02899/input.0.txt b/codenet/public_test_cases/p02899/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b29044c7562263214ba07e95181d4fffa71da483 --- /dev/null +++ b/codenet/public_test_cases/p02899/input.0.txt @@ -0,0 +1,2 @@ +3 +2 3 1 diff --git a/codenet/public_test_cases/p02899/input.1.txt b/codenet/public_test_cases/p02899/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p02899/input.1.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02899/input.2.txt b/codenet/public_test_cases/p02899/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b29044c7562263214ba07e95181d4fffa71da483 --- /dev/null +++ b/codenet/public_test_cases/p02899/input.2.txt @@ -0,0 +1,2 @@ +3 +2 3 1 diff --git a/codenet/public_test_cases/p02899/input.3.txt b/codenet/public_test_cases/p02899/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae58efe8c81a532601e977d7f2b342f6147b3915 --- /dev/null +++ b/codenet/public_test_cases/p02899/input.3.txt @@ -0,0 +1,2 @@ +8 +8 2 7 3 4 5 6 1 diff --git a/codenet/public_test_cases/p02899/output.0.txt b/codenet/public_test_cases/p02899/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4c3b6fa8ddc94fc44ce15c6da3720c1f07040ba --- /dev/null +++ b/codenet/public_test_cases/p02899/output.0.txt @@ -0,0 +1 @@ +3 1 2 diff --git a/codenet/public_test_cases/p02899/output.1.txt b/codenet/public_test_cases/p02899/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aacb59525ae5e32096372e24707fe291c5a4dae4 --- /dev/null +++ b/codenet/public_test_cases/p02899/output.1.txt @@ -0,0 +1 @@ +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02899/output.2.txt b/codenet/public_test_cases/p02899/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4c3b6fa8ddc94fc44ce15c6da3720c1f07040ba --- /dev/null +++ b/codenet/public_test_cases/p02899/output.2.txt @@ -0,0 +1 @@ +3 1 2 diff --git a/codenet/public_test_cases/p02899/output.3.txt b/codenet/public_test_cases/p02899/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..db829c1d67dd72fee5a34c2505252130089eb796 --- /dev/null +++ b/codenet/public_test_cases/p02899/output.3.txt @@ -0,0 +1 @@ +8 2 4 5 6 7 3 1 diff --git a/codenet/public_test_cases/p02900/input.0.txt b/codenet/public_test_cases/p02900/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f86db24ee85ee7dd0e36e640ecf4771786c21d8a --- /dev/null +++ b/codenet/public_test_cases/p02900/input.0.txt @@ -0,0 +1 @@ +12 18 diff --git a/codenet/public_test_cases/p02900/input.1.txt b/codenet/public_test_cases/p02900/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..381ada10867f6bfc3059a38543f797bd14398849 --- /dev/null +++ b/codenet/public_test_cases/p02900/input.1.txt @@ -0,0 +1 @@ +1 2019 diff --git a/codenet/public_test_cases/p02900/input.2.txt b/codenet/public_test_cases/p02900/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f86db24ee85ee7dd0e36e640ecf4771786c21d8a --- /dev/null +++ b/codenet/public_test_cases/p02900/input.2.txt @@ -0,0 +1 @@ +12 18 diff --git a/codenet/public_test_cases/p02900/input.3.txt b/codenet/public_test_cases/p02900/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b55e5275e760140aab34082ff1e95b7a141a599 --- /dev/null +++ b/codenet/public_test_cases/p02900/input.3.txt @@ -0,0 +1 @@ +420 660 diff --git a/codenet/public_test_cases/p02900/output.0.txt b/codenet/public_test_cases/p02900/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02900/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02900/output.1.txt b/codenet/public_test_cases/p02900/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02900/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02900/output.2.txt b/codenet/public_test_cases/p02900/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02900/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02900/output.3.txt b/codenet/public_test_cases/p02900/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02900/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02901/input.0.txt b/codenet/public_test_cases/p02901/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa33036fd215a0719bf4877f5cc10dfca1e37c2e --- /dev/null +++ b/codenet/public_test_cases/p02901/input.0.txt @@ -0,0 +1,7 @@ +2 3 +10 1 +1 +15 1 +2 +30 2 +1 2 diff --git a/codenet/public_test_cases/p02901/input.1.txt b/codenet/public_test_cases/p02901/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac3e2359e65629a3db901febe6d86b3c181d3d9b --- /dev/null +++ b/codenet/public_test_cases/p02901/input.1.txt @@ -0,0 +1,13 @@ +4 6 +67786 3 +1 3 4 +3497 1 +2 +44908 3 +2 3 4 +2156 3 +2 3 4 +26230 1 +2 +86918 1 +3 diff --git a/codenet/public_test_cases/p02901/input.2.txt b/codenet/public_test_cases/p02901/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..65ec7d4640270b63481ad4ad82ab1a4bf2185d69 --- /dev/null +++ b/codenet/public_test_cases/p02901/input.2.txt @@ -0,0 +1,3 @@ +12 1 +100000 1 +2 diff --git a/codenet/public_test_cases/p02901/input.3.txt b/codenet/public_test_cases/p02901/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa33036fd215a0719bf4877f5cc10dfca1e37c2e --- /dev/null +++ b/codenet/public_test_cases/p02901/input.3.txt @@ -0,0 +1,7 @@ +2 3 +10 1 +1 +15 1 +2 +30 2 +1 2 diff --git a/codenet/public_test_cases/p02901/output.0.txt b/codenet/public_test_cases/p02901/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02901/output.0.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02901/output.1.txt b/codenet/public_test_cases/p02901/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0855d68d485e1c31ce23f47408b4fc14406ddebd --- /dev/null +++ b/codenet/public_test_cases/p02901/output.1.txt @@ -0,0 +1 @@ +69942 diff --git a/codenet/public_test_cases/p02901/output.2.txt b/codenet/public_test_cases/p02901/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02901/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02901/output.3.txt b/codenet/public_test_cases/p02901/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02901/output.3.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02902/input.0.txt b/codenet/public_test_cases/p02902/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..085a14e9962c2ce26f3acd5d0b3c0eafc5cfde00 --- /dev/null +++ b/codenet/public_test_cases/p02902/input.0.txt @@ -0,0 +1,6 @@ +4 5 +1 2 +2 3 +2 4 +4 1 +4 3 diff --git a/codenet/public_test_cases/p02902/input.1.txt b/codenet/public_test_cases/p02902/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..389b6c3227c5a47c42039941373061547f004e14 --- /dev/null +++ b/codenet/public_test_cases/p02902/input.1.txt @@ -0,0 +1,10 @@ +6 9 +1 2 +2 3 +3 4 +4 5 +5 6 +5 1 +5 2 +6 1 +6 2 diff --git a/codenet/public_test_cases/p02902/input.2.txt b/codenet/public_test_cases/p02902/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..085a14e9962c2ce26f3acd5d0b3c0eafc5cfde00 --- /dev/null +++ b/codenet/public_test_cases/p02902/input.2.txt @@ -0,0 +1,6 @@ +4 5 +1 2 +2 3 +2 4 +4 1 +4 3 diff --git a/codenet/public_test_cases/p02902/input.3.txt b/codenet/public_test_cases/p02902/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..610f55732851b4d577585f566d888961252920dd --- /dev/null +++ b/codenet/public_test_cases/p02902/input.3.txt @@ -0,0 +1,6 @@ +4 5 +1 2 +2 3 +2 4 +1 4 +4 3 diff --git a/codenet/public_test_cases/p02902/output.0.txt b/codenet/public_test_cases/p02902/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb25ab683c82bc3289c24336d1b3cd8a711b58c9 --- /dev/null +++ b/codenet/public_test_cases/p02902/output.0.txt @@ -0,0 +1,4 @@ +3 +1 +2 +4 diff --git a/codenet/public_test_cases/p02902/output.1.txt b/codenet/public_test_cases/p02902/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f844cb037ba9c6fd0531443645f21b231ce0737c --- /dev/null +++ b/codenet/public_test_cases/p02902/output.1.txt @@ -0,0 +1,5 @@ +4 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02902/output.2.txt b/codenet/public_test_cases/p02902/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb25ab683c82bc3289c24336d1b3cd8a711b58c9 --- /dev/null +++ b/codenet/public_test_cases/p02902/output.2.txt @@ -0,0 +1,4 @@ +3 +1 +2 +4 diff --git a/codenet/public_test_cases/p02902/output.3.txt b/codenet/public_test_cases/p02902/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02902/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02903/input.0.txt b/codenet/public_test_cases/p02903/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf494ba7fe3e060f8524866cc896f2d62115469d --- /dev/null +++ b/codenet/public_test_cases/p02903/input.0.txt @@ -0,0 +1 @@ +3 3 1 1 diff --git a/codenet/public_test_cases/p02903/input.1.txt b/codenet/public_test_cases/p02903/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf494ba7fe3e060f8524866cc896f2d62115469d --- /dev/null +++ b/codenet/public_test_cases/p02903/input.1.txt @@ -0,0 +1 @@ +3 3 1 1 diff --git a/codenet/public_test_cases/p02903/input.2.txt b/codenet/public_test_cases/p02903/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..232effcda065d5b593afd74f8f0ff8aebdb99a3b --- /dev/null +++ b/codenet/public_test_cases/p02903/input.2.txt @@ -0,0 +1 @@ +1 5 2 0 diff --git a/codenet/public_test_cases/p02903/output.0.txt b/codenet/public_test_cases/p02903/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31289f5df02607a39a3b0d295678b5ac5ba35dff --- /dev/null +++ b/codenet/public_test_cases/p02903/output.0.txt @@ -0,0 +1,3 @@ +100 +010 +001 diff --git a/codenet/public_test_cases/p02903/output.1.txt b/codenet/public_test_cases/p02903/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31289f5df02607a39a3b0d295678b5ac5ba35dff --- /dev/null +++ b/codenet/public_test_cases/p02903/output.1.txt @@ -0,0 +1,3 @@ +100 +010 +001 diff --git a/codenet/public_test_cases/p02903/output.2.txt b/codenet/public_test_cases/p02903/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7afa0a3c7e03e36350769d90ffe8bd97a55cba8 --- /dev/null +++ b/codenet/public_test_cases/p02903/output.2.txt @@ -0,0 +1 @@ +01010 diff --git a/codenet/public_test_cases/p02904/input.0.txt b/codenet/public_test_cases/p02904/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..732413dbbf554fe77472f555b99dc10357add402 --- /dev/null +++ b/codenet/public_test_cases/p02904/input.0.txt @@ -0,0 +1,2 @@ +5 3 +0 2 1 4 3 diff --git a/codenet/public_test_cases/p02904/input.1.txt b/codenet/public_test_cases/p02904/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..30b351487462daae580a76a43a83379503862de5 --- /dev/null +++ b/codenet/public_test_cases/p02904/input.1.txt @@ -0,0 +1,2 @@ +10 4 +2 0 1 3 7 5 4 6 8 9 diff --git a/codenet/public_test_cases/p02904/input.2.txt b/codenet/public_test_cases/p02904/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..732413dbbf554fe77472f555b99dc10357add402 --- /dev/null +++ b/codenet/public_test_cases/p02904/input.2.txt @@ -0,0 +1,2 @@ +5 3 +0 2 1 4 3 diff --git a/codenet/public_test_cases/p02904/input.3.txt b/codenet/public_test_cases/p02904/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7502278f6dfb0c0fb5bf12c40ffdc5afac22a5a3 --- /dev/null +++ b/codenet/public_test_cases/p02904/input.3.txt @@ -0,0 +1,2 @@ +4 4 +0 1 2 3 diff --git a/codenet/public_test_cases/p02904/output.0.txt b/codenet/public_test_cases/p02904/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02904/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02904/output.1.txt b/codenet/public_test_cases/p02904/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02904/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02904/output.2.txt b/codenet/public_test_cases/p02904/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02904/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02904/output.3.txt b/codenet/public_test_cases/p02904/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02904/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02905/input.0.txt b/codenet/public_test_cases/p02905/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bb30f58bb34822d3e7a849be9581684c1dbc119 --- /dev/null +++ b/codenet/public_test_cases/p02905/input.0.txt @@ -0,0 +1,2 @@ +3 +2 4 6 diff --git a/codenet/public_test_cases/p02905/input.1.txt b/codenet/public_test_cases/p02905/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bb30f58bb34822d3e7a849be9581684c1dbc119 --- /dev/null +++ b/codenet/public_test_cases/p02905/input.1.txt @@ -0,0 +1,2 @@ +3 +2 4 6 diff --git a/codenet/public_test_cases/p02905/input.2.txt b/codenet/public_test_cases/p02905/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..defad667cd916cf0fd974ede291ee4e84c4fe194 --- /dev/null +++ b/codenet/public_test_cases/p02905/input.2.txt @@ -0,0 +1,2 @@ +8 +1 2 3 4 6 8 12 12 diff --git a/codenet/public_test_cases/p02905/input.3.txt b/codenet/public_test_cases/p02905/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..455a2151ce4eb0fe2b83eb6032beea17953ac97f --- /dev/null +++ b/codenet/public_test_cases/p02905/input.3.txt @@ -0,0 +1,2 @@ +10 +356822 296174 484500 710640 518322 888250 259161 609120 592348 713644 diff --git a/codenet/public_test_cases/p02905/output.0.txt b/codenet/public_test_cases/p02905/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p02905/output.0.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p02905/output.1.txt b/codenet/public_test_cases/p02905/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p02905/output.1.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p02905/output.2.txt b/codenet/public_test_cases/p02905/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5478c714f35ec8a758321acd39af9b29a58f6ede --- /dev/null +++ b/codenet/public_test_cases/p02905/output.2.txt @@ -0,0 +1 @@ +313 diff --git a/codenet/public_test_cases/p02905/output.3.txt b/codenet/public_test_cases/p02905/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3afdf1a3c363bf4d5f9f3e6b3392d76ee5ed0ef1 --- /dev/null +++ b/codenet/public_test_cases/p02905/output.3.txt @@ -0,0 +1 @@ +353891724 diff --git a/codenet/public_test_cases/p02906/input.0.txt b/codenet/public_test_cases/p02906/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac13b994f522472e4759fb3711d5e36f4dbb0ea7 --- /dev/null +++ b/codenet/public_test_cases/p02906/input.0.txt @@ -0,0 +1,4 @@ +5 5 3 +0 1 0 +1 2 1 +2 3 0 diff --git a/codenet/public_test_cases/p02906/input.1.txt b/codenet/public_test_cases/p02906/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29c66b43537a3299da1e2a1d4bc4f548c35a2a34 --- /dev/null +++ b/codenet/public_test_cases/p02906/input.1.txt @@ -0,0 +1,4 @@ +4 4 3 +0 1 0 +1 2 1 +2 3 0 diff --git a/codenet/public_test_cases/p02906/input.2.txt b/codenet/public_test_cases/p02906/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60a34d953476fc3647fc544dd07ca312580822a8 --- /dev/null +++ b/codenet/public_test_cases/p02906/input.2.txt @@ -0,0 +1,10 @@ +10 9 9 +7 6 0 +4 5 1 +9 7 0 +2 9 0 +2 3 0 +4 1 0 +8 0 0 +9 1 0 +3 0 0 diff --git a/codenet/public_test_cases/p02906/input.3.txt b/codenet/public_test_cases/p02906/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac13b994f522472e4759fb3711d5e36f4dbb0ea7 --- /dev/null +++ b/codenet/public_test_cases/p02906/input.3.txt @@ -0,0 +1,4 @@ +5 5 3 +0 1 0 +1 2 1 +2 3 0 diff --git a/codenet/public_test_cases/p02906/output.0.txt b/codenet/public_test_cases/p02906/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02906/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02906/output.1.txt b/codenet/public_test_cases/p02906/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02906/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02906/output.2.txt b/codenet/public_test_cases/p02906/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02906/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02906/output.3.txt b/codenet/public_test_cases/p02906/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02906/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02907/input.0.txt b/codenet/public_test_cases/p02907/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd29bee20df23dd8c9c7b5df08c2fffa67dc3a0 --- /dev/null +++ b/codenet/public_test_cases/p02907/input.0.txt @@ -0,0 +1,3 @@ +2 +1 1 +1 1 diff --git a/codenet/public_test_cases/p02907/input.1.txt b/codenet/public_test_cases/p02907/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..39fcc18c5a1cf7b713e1b96d06325bd9ed4ab5dd --- /dev/null +++ b/codenet/public_test_cases/p02907/input.1.txt @@ -0,0 +1,4 @@ +3 +1 3 +2 2 +3 1 diff --git a/codenet/public_test_cases/p02907/input.2.txt b/codenet/public_test_cases/p02907/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd29bee20df23dd8c9c7b5df08c2fffa67dc3a0 --- /dev/null +++ b/codenet/public_test_cases/p02907/input.2.txt @@ -0,0 +1,3 @@ +2 +1 1 +1 1 diff --git a/codenet/public_test_cases/p02907/input.3.txt b/codenet/public_test_cases/p02907/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..acb7a562e9f7d304e6f93fd5e6c404b0cbe53b55 --- /dev/null +++ b/codenet/public_test_cases/p02907/input.3.txt @@ -0,0 +1,16 @@ +15 +29 3 +78 69 +19 15 +82 14 +9 120 +14 51 +3 7 +6 14 +28 4 +13 12 +1 5 +32 30 +49 24 +35 23 +2 9 diff --git a/codenet/public_test_cases/p02907/output.0.txt b/codenet/public_test_cases/p02907/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02907/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02907/output.1.txt b/codenet/public_test_cases/p02907/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3a846fb96ab443a8844a6bc9d4433356bbc0ec7 --- /dev/null +++ b/codenet/public_test_cases/p02907/output.1.txt @@ -0,0 +1 @@ +971485877 diff --git a/codenet/public_test_cases/p02907/output.2.txt b/codenet/public_test_cases/p02907/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02907/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02907/output.3.txt b/codenet/public_test_cases/p02907/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4515431c70241437907303b257fa2592c8b16243 --- /dev/null +++ b/codenet/public_test_cases/p02907/output.3.txt @@ -0,0 +1 @@ +371626143 diff --git a/codenet/public_test_cases/p02908/input.0.txt b/codenet/public_test_cases/p02908/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fc552f1c7ecdf578d14bff3da65c0b9d321dfae --- /dev/null +++ b/codenet/public_test_cases/p02908/input.0.txt @@ -0,0 +1,3 @@ +4 +2 1 3 0 +0 2 3 1 diff --git a/codenet/public_test_cases/p02908/input.1.txt b/codenet/public_test_cases/p02908/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..acefcabd31515bc6519242a818ea153a871938ec --- /dev/null +++ b/codenet/public_test_cases/p02908/input.1.txt @@ -0,0 +1,3 @@ +32 +22 31 30 29 7 17 16 3 14 9 19 11 2 5 10 1 25 18 15 24 20 0 12 21 27 4 26 28 8 6 23 13 +22 3 2 7 17 9 16 4 14 8 19 26 28 5 10 1 25 18 15 13 11 0 12 23 21 20 29 24 27 6 30 31 diff --git a/codenet/public_test_cases/p02908/input.2.txt b/codenet/public_test_cases/p02908/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fc552f1c7ecdf578d14bff3da65c0b9d321dfae --- /dev/null +++ b/codenet/public_test_cases/p02908/input.2.txt @@ -0,0 +1,3 @@ +4 +2 1 3 0 +0 2 3 1 diff --git a/codenet/public_test_cases/p02908/input.3.txt b/codenet/public_test_cases/p02908/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..260cfebf8cfad850113b12de24e6986ffa2c7db7 --- /dev/null +++ b/codenet/public_test_cases/p02908/input.3.txt @@ -0,0 +1,3 @@ +10 +0 4 5 3 7 8 2 1 9 6 +3 8 5 6 4 0 2 1 7 9 diff --git a/codenet/public_test_cases/p02908/output.0.txt b/codenet/public_test_cases/p02908/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02908/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02908/output.1.txt b/codenet/public_test_cases/p02908/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9902f17848a8974ab57d57999b74a63198fe6e23 --- /dev/null +++ b/codenet/public_test_cases/p02908/output.1.txt @@ -0,0 +1 @@ +28 diff --git a/codenet/public_test_cases/p02908/output.2.txt b/codenet/public_test_cases/p02908/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02908/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02908/output.3.txt b/codenet/public_test_cases/p02908/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02908/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02909/input.0.txt b/codenet/public_test_cases/p02909/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f8780dea90c88de56adaf192cf5572437667a63 --- /dev/null +++ b/codenet/public_test_cases/p02909/input.0.txt @@ -0,0 +1 @@ +Sunny diff --git a/codenet/public_test_cases/p02909/input.1.txt b/codenet/public_test_cases/p02909/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5cb3c1eaeab86f91d88a934e7f6d064871f9443 --- /dev/null +++ b/codenet/public_test_cases/p02909/input.1.txt @@ -0,0 +1 @@ +Rainy diff --git a/codenet/public_test_cases/p02909/input.2.txt b/codenet/public_test_cases/p02909/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f8780dea90c88de56adaf192cf5572437667a63 --- /dev/null +++ b/codenet/public_test_cases/p02909/input.2.txt @@ -0,0 +1 @@ +Sunny diff --git a/codenet/public_test_cases/p02909/output.0.txt b/codenet/public_test_cases/p02909/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cd27edc67f81c67ef2518743578f082716fd263 --- /dev/null +++ b/codenet/public_test_cases/p02909/output.0.txt @@ -0,0 +1 @@ +Cloudy diff --git a/codenet/public_test_cases/p02909/output.1.txt b/codenet/public_test_cases/p02909/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f8780dea90c88de56adaf192cf5572437667a63 --- /dev/null +++ b/codenet/public_test_cases/p02909/output.1.txt @@ -0,0 +1 @@ +Sunny diff --git a/codenet/public_test_cases/p02909/output.2.txt b/codenet/public_test_cases/p02909/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cd27edc67f81c67ef2518743578f082716fd263 --- /dev/null +++ b/codenet/public_test_cases/p02909/output.2.txt @@ -0,0 +1 @@ +Cloudy diff --git a/codenet/public_test_cases/p02910/input.0.txt b/codenet/public_test_cases/p02910/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a095f5988eab22c45af6d9dee1f22337a3efb948 --- /dev/null +++ b/codenet/public_test_cases/p02910/input.0.txt @@ -0,0 +1 @@ +RUDLUDR diff --git a/codenet/public_test_cases/p02910/input.1.txt b/codenet/public_test_cases/p02910/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a095f5988eab22c45af6d9dee1f22337a3efb948 --- /dev/null +++ b/codenet/public_test_cases/p02910/input.1.txt @@ -0,0 +1 @@ +RUDLUDR diff --git a/codenet/public_test_cases/p02910/input.2.txt b/codenet/public_test_cases/p02910/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3ee66df05cafd82fadb4f59a03e922eb00bc72e --- /dev/null +++ b/codenet/public_test_cases/p02910/input.2.txt @@ -0,0 +1 @@ +DULL diff --git a/codenet/public_test_cases/p02910/input.3.txt b/codenet/public_test_cases/p02910/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5514c4fc6d25d41db7b98e7b654a0483d636bd5b --- /dev/null +++ b/codenet/public_test_cases/p02910/input.3.txt @@ -0,0 +1 @@ +RDULULDURURLRDULRLR diff --git a/codenet/public_test_cases/p02910/input.4.txt b/codenet/public_test_cases/p02910/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..269acaed85f1214186a7ed4982cb5164958c2bd0 --- /dev/null +++ b/codenet/public_test_cases/p02910/input.4.txt @@ -0,0 +1 @@ +UUUUUUUUUUUUUUU diff --git a/codenet/public_test_cases/p02910/input.5.txt b/codenet/public_test_cases/p02910/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2b68f76b0cb01268e8ccc39c4e0b16eba6a72ef --- /dev/null +++ b/codenet/public_test_cases/p02910/input.5.txt @@ -0,0 +1 @@ +ULURU diff --git a/codenet/public_test_cases/p02910/output.0.txt b/codenet/public_test_cases/p02910/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02910/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02910/output.1.txt b/codenet/public_test_cases/p02910/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02910/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02910/output.2.txt b/codenet/public_test_cases/p02910/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02910/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02910/output.3.txt b/codenet/public_test_cases/p02910/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02910/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02910/output.4.txt b/codenet/public_test_cases/p02910/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02910/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02910/output.5.txt b/codenet/public_test_cases/p02910/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02910/output.5.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02911/input.0.txt b/codenet/public_test_cases/p02911/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6d079213186f521bf545fa9cc2214d38ca18531 --- /dev/null +++ b/codenet/public_test_cases/p02911/input.0.txt @@ -0,0 +1,5 @@ +6 3 4 +3 +1 +3 +2 diff --git a/codenet/public_test_cases/p02911/input.1.txt b/codenet/public_test_cases/p02911/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fd362cd43151df0b6754975b6b46c6a902ed6de --- /dev/null +++ b/codenet/public_test_cases/p02911/input.1.txt @@ -0,0 +1,5 @@ +6 5 4 +3 +1 +3 +2 diff --git a/codenet/public_test_cases/p02911/input.2.txt b/codenet/public_test_cases/p02911/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..77dcfbc313f3766893ac5d6e272be6a0075d03fd --- /dev/null +++ b/codenet/public_test_cases/p02911/input.2.txt @@ -0,0 +1,16 @@ +10 13 15 +3 +1 +4 +1 +5 +9 +2 +6 +5 +3 +5 +8 +9 +7 +9 diff --git a/codenet/public_test_cases/p02911/input.3.txt b/codenet/public_test_cases/p02911/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6d079213186f521bf545fa9cc2214d38ca18531 --- /dev/null +++ b/codenet/public_test_cases/p02911/input.3.txt @@ -0,0 +1,5 @@ +6 3 4 +3 +1 +3 +2 diff --git a/codenet/public_test_cases/p02911/output.0.txt b/codenet/public_test_cases/p02911/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1760c7ebd381442facc338cc970ab023e90b2c21 --- /dev/null +++ b/codenet/public_test_cases/p02911/output.0.txt @@ -0,0 +1,6 @@ +No +No +Yes +No +No +No diff --git a/codenet/public_test_cases/p02911/output.1.txt b/codenet/public_test_cases/p02911/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ca6d24c9c27a898c47a3e78d17dfcc5e409b270 --- /dev/null +++ b/codenet/public_test_cases/p02911/output.1.txt @@ -0,0 +1,6 @@ +Yes +Yes +Yes +Yes +Yes +Yes diff --git a/codenet/public_test_cases/p02911/output.2.txt b/codenet/public_test_cases/p02911/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..da4030f5d26cf058478153ecbd878bfb88ed7b35 --- /dev/null +++ b/codenet/public_test_cases/p02911/output.2.txt @@ -0,0 +1,10 @@ +No +No +No +No +Yes +No +No +No +Yes +No diff --git a/codenet/public_test_cases/p02911/output.3.txt b/codenet/public_test_cases/p02911/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1760c7ebd381442facc338cc970ab023e90b2c21 --- /dev/null +++ b/codenet/public_test_cases/p02911/output.3.txt @@ -0,0 +1,6 @@ +No +No +Yes +No +No +No diff --git a/codenet/public_test_cases/p02912/input.0.txt b/codenet/public_test_cases/p02912/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..391d67b9dcd124858c2dc6fa6b2648c4ec9ecf75 --- /dev/null +++ b/codenet/public_test_cases/p02912/input.0.txt @@ -0,0 +1,2 @@ +3 3 +2 13 8 diff --git a/codenet/public_test_cases/p02912/input.1.txt b/codenet/public_test_cases/p02912/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8311d7c09775b0da7e915f72b593aa2c722592d --- /dev/null +++ b/codenet/public_test_cases/p02912/input.1.txt @@ -0,0 +1,2 @@ +1 100000 +1000000000 diff --git a/codenet/public_test_cases/p02912/input.2.txt b/codenet/public_test_cases/p02912/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3391ab07e81954f1cce36417c75c4b025243ce58 --- /dev/null +++ b/codenet/public_test_cases/p02912/input.2.txt @@ -0,0 +1,2 @@ +10 1 +1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 diff --git a/codenet/public_test_cases/p02912/input.3.txt b/codenet/public_test_cases/p02912/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf6abfe7302b947068d2f05d3b51eaeca71d88f2 --- /dev/null +++ b/codenet/public_test_cases/p02912/input.3.txt @@ -0,0 +1,2 @@ +4 4 +1 9 3 5 diff --git a/codenet/public_test_cases/p02912/input.4.txt b/codenet/public_test_cases/p02912/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..391d67b9dcd124858c2dc6fa6b2648c4ec9ecf75 --- /dev/null +++ b/codenet/public_test_cases/p02912/input.4.txt @@ -0,0 +1,2 @@ +3 3 +2 13 8 diff --git a/codenet/public_test_cases/p02912/output.0.txt b/codenet/public_test_cases/p02912/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02912/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02912/output.1.txt b/codenet/public_test_cases/p02912/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02912/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02912/output.2.txt b/codenet/public_test_cases/p02912/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..64031a60e6d8780095625dc7aa391f22e31a1fc8 --- /dev/null +++ b/codenet/public_test_cases/p02912/output.2.txt @@ -0,0 +1 @@ +9500000000 diff --git a/codenet/public_test_cases/p02912/output.3.txt b/codenet/public_test_cases/p02912/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02912/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02912/output.4.txt b/codenet/public_test_cases/p02912/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02912/output.4.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02913/input.0.txt b/codenet/public_test_cases/p02913/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..484b93e02b125f88a45b2280dba7028557f3af13 --- /dev/null +++ b/codenet/public_test_cases/p02913/input.0.txt @@ -0,0 +1,2 @@ +5 +ababa diff --git a/codenet/public_test_cases/p02913/input.1.txt b/codenet/public_test_cases/p02913/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f83855c9c37e38bd616b4de309d87ffb9f6918b --- /dev/null +++ b/codenet/public_test_cases/p02913/input.1.txt @@ -0,0 +1,2 @@ +13 +strangeorange diff --git a/codenet/public_test_cases/p02913/input.2.txt b/codenet/public_test_cases/p02913/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..872843ffcb73386454c244c5366ca0d243431bba --- /dev/null +++ b/codenet/public_test_cases/p02913/input.2.txt @@ -0,0 +1,2 @@ +2 +xy diff --git a/codenet/public_test_cases/p02913/input.3.txt b/codenet/public_test_cases/p02913/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..484b93e02b125f88a45b2280dba7028557f3af13 --- /dev/null +++ b/codenet/public_test_cases/p02913/input.3.txt @@ -0,0 +1,2 @@ +5 +ababa diff --git a/codenet/public_test_cases/p02913/output.0.txt b/codenet/public_test_cases/p02913/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02913/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02913/output.1.txt b/codenet/public_test_cases/p02913/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02913/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02913/output.2.txt b/codenet/public_test_cases/p02913/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02913/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02913/output.3.txt b/codenet/public_test_cases/p02913/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02913/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02914/input.0.txt b/codenet/public_test_cases/p02914/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8ef497141fb3e2986b180469085611635d8dc18 --- /dev/null +++ b/codenet/public_test_cases/p02914/input.0.txt @@ -0,0 +1,2 @@ +3 +3 6 5 diff --git a/codenet/public_test_cases/p02914/input.1.txt b/codenet/public_test_cases/p02914/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7603829860eae6423bf2d83c048359f91e1a381b --- /dev/null +++ b/codenet/public_test_cases/p02914/input.1.txt @@ -0,0 +1,2 @@ +20 +1008288677408720767 539403903321871999 1044301017184589821 215886900497862655 504277496111605629 972104334925272829 792625803473366909 972333547668684797 467386965442856573 755861732751878143 1151846447448561405 467257771752201853 683930041385277311 432010719984459389 319104378117934975 611451291444233983 647509226592964607 251832107792119421 827811265410084479 864032478037725181 diff --git a/codenet/public_test_cases/p02914/input.2.txt b/codenet/public_test_cases/p02914/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8ef497141fb3e2986b180469085611635d8dc18 --- /dev/null +++ b/codenet/public_test_cases/p02914/input.2.txt @@ -0,0 +1,2 @@ +3 +3 6 5 diff --git a/codenet/public_test_cases/p02914/input.3.txt b/codenet/public_test_cases/p02914/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e10f14cd96c78786010cd890302d1d4a3fd3df31 --- /dev/null +++ b/codenet/public_test_cases/p02914/input.3.txt @@ -0,0 +1,2 @@ +4 +23 36 66 65 diff --git a/codenet/public_test_cases/p02914/output.0.txt b/codenet/public_test_cases/p02914/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02914/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02914/output.1.txt b/codenet/public_test_cases/p02914/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1ec9662082166ed06a791a921fdf3e12919e5f4 --- /dev/null +++ b/codenet/public_test_cases/p02914/output.1.txt @@ -0,0 +1 @@ +2012721721873704572 diff --git a/codenet/public_test_cases/p02914/output.2.txt b/codenet/public_test_cases/p02914/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02914/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02914/output.3.txt b/codenet/public_test_cases/p02914/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e702a30b33b0d510da43b5348fb9c1ef43e39dd2 --- /dev/null +++ b/codenet/public_test_cases/p02914/output.3.txt @@ -0,0 +1 @@ +188 diff --git a/codenet/public_test_cases/p02915/input.0.txt b/codenet/public_test_cases/p02915/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02915/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02915/input.1.txt b/codenet/public_test_cases/p02915/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02915/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02915/input.2.txt b/codenet/public_test_cases/p02915/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02915/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02915/output.0.txt b/codenet/public_test_cases/p02915/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02915/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02915/output.1.txt b/codenet/public_test_cases/p02915/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02915/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02915/output.2.txt b/codenet/public_test_cases/p02915/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02915/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02916/input.0.txt b/codenet/public_test_cases/p02916/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afa9aeaabc3b9faf59c7b0e456f4670081dad1c2 --- /dev/null +++ b/codenet/public_test_cases/p02916/input.0.txt @@ -0,0 +1,4 @@ +3 +3 1 2 +2 5 4 +3 6 diff --git a/codenet/public_test_cases/p02916/input.1.txt b/codenet/public_test_cases/p02916/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc3c5f7afd1d62575fab6a0c7dbd99d51a5d47fb --- /dev/null +++ b/codenet/public_test_cases/p02916/input.1.txt @@ -0,0 +1,4 @@ +2 +1 2 +50 50 +50 diff --git a/codenet/public_test_cases/p02916/input.2.txt b/codenet/public_test_cases/p02916/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..599fa8b68357e76b05a8d7656b1af43c608704d2 --- /dev/null +++ b/codenet/public_test_cases/p02916/input.2.txt @@ -0,0 +1,4 @@ +4 +2 3 4 1 +13 5 8 24 +45 9 15 diff --git a/codenet/public_test_cases/p02916/input.3.txt b/codenet/public_test_cases/p02916/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..afa9aeaabc3b9faf59c7b0e456f4670081dad1c2 --- /dev/null +++ b/codenet/public_test_cases/p02916/input.3.txt @@ -0,0 +1,4 @@ +3 +3 1 2 +2 5 4 +3 6 diff --git a/codenet/public_test_cases/p02916/output.0.txt b/codenet/public_test_cases/p02916/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02916/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02916/output.1.txt b/codenet/public_test_cases/p02916/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa8f08cb6ff8a30dd34a3b442009bdfc798a7316 --- /dev/null +++ b/codenet/public_test_cases/p02916/output.1.txt @@ -0,0 +1 @@ +150 diff --git a/codenet/public_test_cases/p02916/output.2.txt b/codenet/public_test_cases/p02916/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fff0a2476aa5c8e60a3ef21cfc66e0cc670920be --- /dev/null +++ b/codenet/public_test_cases/p02916/output.2.txt @@ -0,0 +1 @@ +74 diff --git a/codenet/public_test_cases/p02916/output.3.txt b/codenet/public_test_cases/p02916/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p02916/output.3.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p02917/input.0.txt b/codenet/public_test_cases/p02917/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4916e8a92869255f5e170c843755f8ea1dff2f79 --- /dev/null +++ b/codenet/public_test_cases/p02917/input.0.txt @@ -0,0 +1,2 @@ +3 +2 5 diff --git a/codenet/public_test_cases/p02917/input.1.txt b/codenet/public_test_cases/p02917/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4792e70f333077a81456ca2bc74e492ab8bb58c3 --- /dev/null +++ b/codenet/public_test_cases/p02917/input.1.txt @@ -0,0 +1,2 @@ +2 +3 diff --git a/codenet/public_test_cases/p02917/input.2.txt b/codenet/public_test_cases/p02917/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4546cc99e30a161a5b48bc945409d7905101c13a --- /dev/null +++ b/codenet/public_test_cases/p02917/input.2.txt @@ -0,0 +1,2 @@ +6 +0 153 10 10 23 diff --git a/codenet/public_test_cases/p02917/input.3.txt b/codenet/public_test_cases/p02917/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4916e8a92869255f5e170c843755f8ea1dff2f79 --- /dev/null +++ b/codenet/public_test_cases/p02917/input.3.txt @@ -0,0 +1,2 @@ +3 +2 5 diff --git a/codenet/public_test_cases/p02917/output.0.txt b/codenet/public_test_cases/p02917/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02917/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02917/output.1.txt b/codenet/public_test_cases/p02917/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p02917/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p02917/output.2.txt b/codenet/public_test_cases/p02917/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..59343b09ec765366a5b0ac04196385079acd864e --- /dev/null +++ b/codenet/public_test_cases/p02917/output.2.txt @@ -0,0 +1 @@ +53 diff --git a/codenet/public_test_cases/p02917/output.3.txt b/codenet/public_test_cases/p02917/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02917/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02918/input.0.txt b/codenet/public_test_cases/p02918/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba78e60d425ffaf81ad017b0528d876f995440de --- /dev/null +++ b/codenet/public_test_cases/p02918/input.0.txt @@ -0,0 +1,2 @@ +6 1 +LRLRRL diff --git a/codenet/public_test_cases/p02918/input.1.txt b/codenet/public_test_cases/p02918/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba78e60d425ffaf81ad017b0528d876f995440de --- /dev/null +++ b/codenet/public_test_cases/p02918/input.1.txt @@ -0,0 +1,2 @@ +6 1 +LRLRRL diff --git a/codenet/public_test_cases/p02918/input.2.txt b/codenet/public_test_cases/p02918/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..710a222bef94219e149a18b5c7dae3231697aca8 --- /dev/null +++ b/codenet/public_test_cases/p02918/input.2.txt @@ -0,0 +1,2 @@ +9 2 +RRRLRLRLL diff --git a/codenet/public_test_cases/p02918/input.3.txt b/codenet/public_test_cases/p02918/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e36ce8cf397a4ab287fe9f5d89dbd8b04102c495 --- /dev/null +++ b/codenet/public_test_cases/p02918/input.3.txt @@ -0,0 +1,2 @@ +13 3 +LRRLRLRRLRLLR diff --git a/codenet/public_test_cases/p02918/input.4.txt b/codenet/public_test_cases/p02918/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a6082e31c0904e4b7407d4030b3e9c6ee14c2b6 --- /dev/null +++ b/codenet/public_test_cases/p02918/input.4.txt @@ -0,0 +1,2 @@ +10 1 +LLLLLRRRRR diff --git a/codenet/public_test_cases/p02918/output.0.txt b/codenet/public_test_cases/p02918/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02918/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02918/output.1.txt b/codenet/public_test_cases/p02918/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02918/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02918/output.2.txt b/codenet/public_test_cases/p02918/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02918/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02918/output.3.txt b/codenet/public_test_cases/p02918/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02918/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02918/output.4.txt b/codenet/public_test_cases/p02918/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02918/output.4.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02919/input.0.txt b/codenet/public_test_cases/p02919/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b29044c7562263214ba07e95181d4fffa71da483 --- /dev/null +++ b/codenet/public_test_cases/p02919/input.0.txt @@ -0,0 +1,2 @@ +3 +2 3 1 diff --git a/codenet/public_test_cases/p02919/input.1.txt b/codenet/public_test_cases/p02919/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p02919/input.1.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02919/input.2.txt b/codenet/public_test_cases/p02919/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b29044c7562263214ba07e95181d4fffa71da483 --- /dev/null +++ b/codenet/public_test_cases/p02919/input.2.txt @@ -0,0 +1,2 @@ +3 +2 3 1 diff --git a/codenet/public_test_cases/p02919/input.3.txt b/codenet/public_test_cases/p02919/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae58efe8c81a532601e977d7f2b342f6147b3915 --- /dev/null +++ b/codenet/public_test_cases/p02919/input.3.txt @@ -0,0 +1,2 @@ +8 +8 2 7 3 4 5 6 1 diff --git a/codenet/public_test_cases/p02919/output.0.txt b/codenet/public_test_cases/p02919/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02919/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02919/output.1.txt b/codenet/public_test_cases/p02919/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p02919/output.1.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p02919/output.2.txt b/codenet/public_test_cases/p02919/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02919/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02919/output.3.txt b/codenet/public_test_cases/p02919/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7296f257eb19026f79767a2458bdf63ff9c29e51 --- /dev/null +++ b/codenet/public_test_cases/p02919/output.3.txt @@ -0,0 +1 @@ +136 diff --git a/codenet/public_test_cases/p02920/input.0.txt b/codenet/public_test_cases/p02920/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad3e92ba7867d0947c7694a0c70e06854a5e1825 --- /dev/null +++ b/codenet/public_test_cases/p02920/input.0.txt @@ -0,0 +1,2 @@ +2 +4 2 3 1 diff --git a/codenet/public_test_cases/p02920/output.0.txt b/codenet/public_test_cases/p02920/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02920/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02921/input.0.txt b/codenet/public_test_cases/p02921/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2887f171d9d2fe0322a70003020b212f7c9b6e98 --- /dev/null +++ b/codenet/public_test_cases/p02921/input.0.txt @@ -0,0 +1,2 @@ +CSS +CSR diff --git a/codenet/public_test_cases/p02921/input.1.txt b/codenet/public_test_cases/p02921/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2887f171d9d2fe0322a70003020b212f7c9b6e98 --- /dev/null +++ b/codenet/public_test_cases/p02921/input.1.txt @@ -0,0 +1,2 @@ +CSS +CSR diff --git a/codenet/public_test_cases/p02921/input.2.txt b/codenet/public_test_cases/p02921/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9df4740b1a768f93188258596a6f32ca288bc78c --- /dev/null +++ b/codenet/public_test_cases/p02921/input.2.txt @@ -0,0 +1,2 @@ +RRR +SSS diff --git a/codenet/public_test_cases/p02921/input.3.txt b/codenet/public_test_cases/p02921/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3d293ce494a69673eb4f17abbcba19a28e6a911 --- /dev/null +++ b/codenet/public_test_cases/p02921/input.3.txt @@ -0,0 +1,2 @@ +SSR +SSR diff --git a/codenet/public_test_cases/p02921/output.0.txt b/codenet/public_test_cases/p02921/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02921/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02921/output.1.txt b/codenet/public_test_cases/p02921/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02921/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02921/output.2.txt b/codenet/public_test_cases/p02921/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02921/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02921/output.3.txt b/codenet/public_test_cases/p02921/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02921/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02922/input.0.txt b/codenet/public_test_cases/p02922/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6af3f94382e9642d1772a8f149e6f2600f572f76 --- /dev/null +++ b/codenet/public_test_cases/p02922/input.0.txt @@ -0,0 +1 @@ +4 10 diff --git a/codenet/public_test_cases/p02922/input.1.txt b/codenet/public_test_cases/p02922/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6af3f94382e9642d1772a8f149e6f2600f572f76 --- /dev/null +++ b/codenet/public_test_cases/p02922/input.1.txt @@ -0,0 +1 @@ +4 10 diff --git a/codenet/public_test_cases/p02922/input.2.txt b/codenet/public_test_cases/p02922/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99ca15399f960d2c36bd34b24db2178857aca917 --- /dev/null +++ b/codenet/public_test_cases/p02922/input.2.txt @@ -0,0 +1 @@ +8 8 diff --git a/codenet/public_test_cases/p02922/input.3.txt b/codenet/public_test_cases/p02922/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5438c83d4e9e8a3ae6f48151bdcc401241a6e261 --- /dev/null +++ b/codenet/public_test_cases/p02922/input.3.txt @@ -0,0 +1 @@ +8 9 diff --git a/codenet/public_test_cases/p02922/output.0.txt b/codenet/public_test_cases/p02922/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02922/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02922/output.1.txt b/codenet/public_test_cases/p02922/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02922/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02922/output.2.txt b/codenet/public_test_cases/p02922/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02922/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02922/output.3.txt b/codenet/public_test_cases/p02922/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02922/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02923/input.0.txt b/codenet/public_test_cases/p02923/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f2a70e81b2438076ee51b590e51ef613e095ccd --- /dev/null +++ b/codenet/public_test_cases/p02923/input.0.txt @@ -0,0 +1,2 @@ +5 +10 4 8 7 3 diff --git a/codenet/public_test_cases/p02923/input.1.txt b/codenet/public_test_cases/p02923/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f2a70e81b2438076ee51b590e51ef613e095ccd --- /dev/null +++ b/codenet/public_test_cases/p02923/input.1.txt @@ -0,0 +1,2 @@ +5 +10 4 8 7 3 diff --git a/codenet/public_test_cases/p02923/input.2.txt b/codenet/public_test_cases/p02923/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a4d515660c3c567ab07859fc5e252f8c966e46 --- /dev/null +++ b/codenet/public_test_cases/p02923/input.2.txt @@ -0,0 +1,2 @@ +4 +1 2 3 4 diff --git a/codenet/public_test_cases/p02923/input.3.txt b/codenet/public_test_cases/p02923/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7e1322f84711155c77130f65e85f81df3b46129 --- /dev/null +++ b/codenet/public_test_cases/p02923/input.3.txt @@ -0,0 +1,2 @@ +7 +4 4 5 6 6 5 5 diff --git a/codenet/public_test_cases/p02923/output.0.txt b/codenet/public_test_cases/p02923/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02923/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02923/output.1.txt b/codenet/public_test_cases/p02923/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02923/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02923/output.2.txt b/codenet/public_test_cases/p02923/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02923/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02923/output.3.txt b/codenet/public_test_cases/p02923/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02923/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02924/input.0.txt b/codenet/public_test_cases/p02924/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02924/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02924/input.1.txt b/codenet/public_test_cases/p02924/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02924/input.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02924/input.2.txt b/codenet/public_test_cases/p02924/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02924/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02924/input.3.txt b/codenet/public_test_cases/p02924/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02924/input.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02924/output.0.txt b/codenet/public_test_cases/p02924/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02924/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02924/output.1.txt b/codenet/public_test_cases/p02924/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e14edce9ccd63cedb63bd0c07f8b829438a6c8a --- /dev/null +++ b/codenet/public_test_cases/p02924/output.1.txt @@ -0,0 +1 @@ +78 diff --git a/codenet/public_test_cases/p02924/output.2.txt b/codenet/public_test_cases/p02924/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02924/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02924/output.3.txt b/codenet/public_test_cases/p02924/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02924/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02925/input.0.txt b/codenet/public_test_cases/p02925/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f45540436115a05b2d0b0b4e84ce4f92afde2f41 --- /dev/null +++ b/codenet/public_test_cases/p02925/input.0.txt @@ -0,0 +1,4 @@ +3 +2 3 +1 3 +1 2 diff --git a/codenet/public_test_cases/p02925/input.1.txt b/codenet/public_test_cases/p02925/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccad4a35dc12bff343f8de4179e599949aed71ce --- /dev/null +++ b/codenet/public_test_cases/p02925/input.1.txt @@ -0,0 +1,5 @@ +4 +2 3 4 +1 3 4 +4 1 2 +3 1 2 diff --git a/codenet/public_test_cases/p02925/input.2.txt b/codenet/public_test_cases/p02925/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f45540436115a05b2d0b0b4e84ce4f92afde2f41 --- /dev/null +++ b/codenet/public_test_cases/p02925/input.2.txt @@ -0,0 +1,4 @@ +3 +2 3 +1 3 +1 2 diff --git a/codenet/public_test_cases/p02925/input.3.txt b/codenet/public_test_cases/p02925/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2374ea3ace11a2c88f1d6309ec6120fdda31aa3 --- /dev/null +++ b/codenet/public_test_cases/p02925/input.3.txt @@ -0,0 +1,4 @@ +3 +2 3 +3 1 +1 2 diff --git a/codenet/public_test_cases/p02925/output.0.txt b/codenet/public_test_cases/p02925/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02925/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02925/output.1.txt b/codenet/public_test_cases/p02925/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02925/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02925/output.2.txt b/codenet/public_test_cases/p02925/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02925/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02925/output.3.txt b/codenet/public_test_cases/p02925/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02925/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02926/input.0.txt b/codenet/public_test_cases/p02926/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de03fc27057f11ab7af242fb6ff327dd2e499b2d --- /dev/null +++ b/codenet/public_test_cases/p02926/input.0.txt @@ -0,0 +1,4 @@ +3 +0 10 +5 -5 +-5 -5 diff --git a/codenet/public_test_cases/p02926/input.1.txt b/codenet/public_test_cases/p02926/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0385e43a0e5c4125a0e3e2fa9acf0568fb19d976 --- /dev/null +++ b/codenet/public_test_cases/p02926/input.1.txt @@ -0,0 +1,2 @@ +1 +90447 91000 diff --git a/codenet/public_test_cases/p02926/input.2.txt b/codenet/public_test_cases/p02926/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9192c07ccc340d77c5ce857e718742c1e34cfcfd --- /dev/null +++ b/codenet/public_test_cases/p02926/input.2.txt @@ -0,0 +1,3 @@ +2 +96000 -72000 +-72000 54000 diff --git a/codenet/public_test_cases/p02926/input.3.txt b/codenet/public_test_cases/p02926/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..de03fc27057f11ab7af242fb6ff327dd2e499b2d --- /dev/null +++ b/codenet/public_test_cases/p02926/input.3.txt @@ -0,0 +1,4 @@ +3 +0 10 +5 -5 +-5 -5 diff --git a/codenet/public_test_cases/p02926/input.4.txt b/codenet/public_test_cases/p02926/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9ede1a6e39b714ae9b8d2bee84ae01cd8eaaf93 --- /dev/null +++ b/codenet/public_test_cases/p02926/input.4.txt @@ -0,0 +1,11 @@ +10 +1 2 +3 4 +5 6 +7 8 +9 10 +11 12 +13 14 +15 16 +17 18 +19 20 diff --git a/codenet/public_test_cases/p02926/input.5.txt b/codenet/public_test_cases/p02926/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..7da6e77df1ea4200e6cd0a9c510c43458d9a06b6 --- /dev/null +++ b/codenet/public_test_cases/p02926/input.5.txt @@ -0,0 +1,6 @@ +5 +1 1 +1 0 +0 1 +-1 0 +0 -1 diff --git a/codenet/public_test_cases/p02926/input.6.txt b/codenet/public_test_cases/p02926/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea858fa58f0a5657638c17a89379c3474218e764 --- /dev/null +++ b/codenet/public_test_cases/p02926/input.6.txt @@ -0,0 +1,4 @@ +3 +0 0 +0 1 +1 0 diff --git a/codenet/public_test_cases/p02926/input.7.txt b/codenet/public_test_cases/p02926/input.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..217068e9378e15e5d0eaaf98fae279016b7af89e --- /dev/null +++ b/codenet/public_test_cases/p02926/input.7.txt @@ -0,0 +1,6 @@ +5 +1 1 +2 2 +3 3 +4 4 +5 5 diff --git a/codenet/public_test_cases/p02926/output.0.txt b/codenet/public_test_cases/p02926/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6a471c6603e21352834a47e1c1a9e5fecc1da9b --- /dev/null +++ b/codenet/public_test_cases/p02926/output.0.txt @@ -0,0 +1 @@ +10.000000000000000000000000000000000000000000000000 diff --git a/codenet/public_test_cases/p02926/output.1.txt b/codenet/public_test_cases/p02926/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..908ea96cc956f5b999031ef8ed40ed6598fe4e18 --- /dev/null +++ b/codenet/public_test_cases/p02926/output.1.txt @@ -0,0 +1 @@ +128303.000000000000000000000000000000000000000000000000 diff --git a/codenet/public_test_cases/p02926/output.2.txt b/codenet/public_test_cases/p02926/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bba98ff6eff59423c2ae7322b36a4449c3ad8228 --- /dev/null +++ b/codenet/public_test_cases/p02926/output.2.txt @@ -0,0 +1 @@ +120000.000000000000000000000000000000000000000000000000 diff --git a/codenet/public_test_cases/p02926/output.3.txt b/codenet/public_test_cases/p02926/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6a471c6603e21352834a47e1c1a9e5fecc1da9b --- /dev/null +++ b/codenet/public_test_cases/p02926/output.3.txt @@ -0,0 +1 @@ +10.000000000000000000000000000000000000000000000000 diff --git a/codenet/public_test_cases/p02926/output.4.txt b/codenet/public_test_cases/p02926/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e6704d4f111caedfff32b229ac5c47d68b8fbbb --- /dev/null +++ b/codenet/public_test_cases/p02926/output.4.txt @@ -0,0 +1 @@ +148.660687473185055226120082139313966514489855137208 diff --git a/codenet/public_test_cases/p02926/output.5.txt b/codenet/public_test_cases/p02926/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff3f5b20c4f71710c51210eeb6339c3dd2555f0e --- /dev/null +++ b/codenet/public_test_cases/p02926/output.5.txt @@ -0,0 +1 @@ +2.828427124746190097603377448419396157139343750753 diff --git a/codenet/public_test_cases/p02926/output.6.txt b/codenet/public_test_cases/p02926/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..836ba1ade25694ed9c4b5c15046d5dbf71fb001a --- /dev/null +++ b/codenet/public_test_cases/p02926/output.6.txt @@ -0,0 +1 @@ +1.414213562373095048801688724209698078569671875376 diff --git a/codenet/public_test_cases/p02926/output.7.txt b/codenet/public_test_cases/p02926/output.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..53718a960a4c18226028f86b7c6036326df9675b --- /dev/null +++ b/codenet/public_test_cases/p02926/output.7.txt @@ -0,0 +1 @@ +21.213203435596425732025330863145471178545078130654 diff --git a/codenet/public_test_cases/p02927/input.0.txt b/codenet/public_test_cases/p02927/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..34948dd3f1121d7e7e3dac65a4131b3bf0815546 --- /dev/null +++ b/codenet/public_test_cases/p02927/input.0.txt @@ -0,0 +1 @@ +15 40 diff --git a/codenet/public_test_cases/p02927/input.1.txt b/codenet/public_test_cases/p02927/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..34948dd3f1121d7e7e3dac65a4131b3bf0815546 --- /dev/null +++ b/codenet/public_test_cases/p02927/input.1.txt @@ -0,0 +1 @@ +15 40 diff --git a/codenet/public_test_cases/p02927/input.2.txt b/codenet/public_test_cases/p02927/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02927/input.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02927/input.3.txt b/codenet/public_test_cases/p02927/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b51db4d0e111c87924ea29197485607c784c6253 --- /dev/null +++ b/codenet/public_test_cases/p02927/input.3.txt @@ -0,0 +1 @@ +12 31 diff --git a/codenet/public_test_cases/p02927/output.0.txt b/codenet/public_test_cases/p02927/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02927/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02927/output.1.txt b/codenet/public_test_cases/p02927/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02927/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02927/output.2.txt b/codenet/public_test_cases/p02927/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02927/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02927/output.3.txt b/codenet/public_test_cases/p02927/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02927/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02928/input.0.txt b/codenet/public_test_cases/p02928/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b6bd7c6a725f4906de6151e0731e38aa1be40b9 --- /dev/null +++ b/codenet/public_test_cases/p02928/input.0.txt @@ -0,0 +1,2 @@ +2 2 +2 1 diff --git a/codenet/public_test_cases/p02928/input.1.txt b/codenet/public_test_cases/p02928/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b6bd7c6a725f4906de6151e0731e38aa1be40b9 --- /dev/null +++ b/codenet/public_test_cases/p02928/input.1.txt @@ -0,0 +1,2 @@ +2 2 +2 1 diff --git a/codenet/public_test_cases/p02928/input.2.txt b/codenet/public_test_cases/p02928/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bbe74e2c1b9c4b86386a1b9f68e8c2379fa5c71f --- /dev/null +++ b/codenet/public_test_cases/p02928/input.2.txt @@ -0,0 +1,2 @@ +10 998244353 +10 9 8 7 5 6 3 4 2 1 diff --git a/codenet/public_test_cases/p02928/input.3.txt b/codenet/public_test_cases/p02928/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..06546571e61a8eaffd5394c4021590ca4c22f881 --- /dev/null +++ b/codenet/public_test_cases/p02928/input.3.txt @@ -0,0 +1,2 @@ +3 5 +1 1 1 diff --git a/codenet/public_test_cases/p02928/output.0.txt b/codenet/public_test_cases/p02928/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02928/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02928/output.1.txt b/codenet/public_test_cases/p02928/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02928/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02928/output.2.txt b/codenet/public_test_cases/p02928/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7acdc9473703a7749a6e0c6e0e44e2f8a415b99c --- /dev/null +++ b/codenet/public_test_cases/p02928/output.2.txt @@ -0,0 +1 @@ +185297239 diff --git a/codenet/public_test_cases/p02928/output.3.txt b/codenet/public_test_cases/p02928/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02928/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02929/input.0.txt b/codenet/public_test_cases/p02929/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac3f5baca267d1b4948657db367268a63810a7f6 --- /dev/null +++ b/codenet/public_test_cases/p02929/input.0.txt @@ -0,0 +1,2 @@ +2 +BWWB diff --git a/codenet/public_test_cases/p02929/input.1.txt b/codenet/public_test_cases/p02929/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac3f5baca267d1b4948657db367268a63810a7f6 --- /dev/null +++ b/codenet/public_test_cases/p02929/input.1.txt @@ -0,0 +1,2 @@ +2 +BWWB diff --git a/codenet/public_test_cases/p02929/input.2.txt b/codenet/public_test_cases/p02929/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6641b89f292d085cf3a360a4653c399906ab7a7 --- /dev/null +++ b/codenet/public_test_cases/p02929/input.2.txt @@ -0,0 +1,2 @@ +5 +WWWWWWWWWW diff --git a/codenet/public_test_cases/p02929/input.3.txt b/codenet/public_test_cases/p02929/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5de47e20703186114d9297120e1c3692ef9dd4a --- /dev/null +++ b/codenet/public_test_cases/p02929/input.3.txt @@ -0,0 +1,2 @@ +4 +BWBBWWWB diff --git a/codenet/public_test_cases/p02929/output.0.txt b/codenet/public_test_cases/p02929/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02929/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02929/output.1.txt b/codenet/public_test_cases/p02929/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02929/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02929/output.2.txt b/codenet/public_test_cases/p02929/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02929/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02929/output.3.txt b/codenet/public_test_cases/p02929/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea809473360353797c26dc0220e70087639dfe54 --- /dev/null +++ b/codenet/public_test_cases/p02929/output.3.txt @@ -0,0 +1 @@ +288 diff --git a/codenet/public_test_cases/p02930/input.0.txt b/codenet/public_test_cases/p02930/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02930/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02930/input.1.txt b/codenet/public_test_cases/p02930/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02930/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02930/output.0.txt b/codenet/public_test_cases/p02930/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11f162df37eb603c6bc8320a10e36affe66f9118 --- /dev/null +++ b/codenet/public_test_cases/p02930/output.0.txt @@ -0,0 +1,2 @@ +1 2 +1 diff --git a/codenet/public_test_cases/p02930/output.1.txt b/codenet/public_test_cases/p02930/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11f162df37eb603c6bc8320a10e36affe66f9118 --- /dev/null +++ b/codenet/public_test_cases/p02930/output.1.txt @@ -0,0 +1,2 @@ +1 2 +1 diff --git a/codenet/public_test_cases/p02931/input.0.txt b/codenet/public_test_cases/p02931/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69722a2a76a0a71cb553d77bbb1b4da2406a31fa --- /dev/null +++ b/codenet/public_test_cases/p02931/input.0.txt @@ -0,0 +1,7 @@ +6 2 2 +2 2 2 +1 1 8 +1 1 5 +1 2 9 +1 2 7 +2 1 4 diff --git a/codenet/public_test_cases/p02931/input.1.txt b/codenet/public_test_cases/p02931/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef03f4e0e17509e9bcd9f3e8f506f2af3a7aa7d0 --- /dev/null +++ b/codenet/public_test_cases/p02931/input.1.txt @@ -0,0 +1,2 @@ +1 100000 100000 +1 1 1 diff --git a/codenet/public_test_cases/p02931/input.2.txt b/codenet/public_test_cases/p02931/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a2372dc2976cbaef80bc599fd5f5a39d6b40e89 --- /dev/null +++ b/codenet/public_test_cases/p02931/input.2.txt @@ -0,0 +1,14 @@ +13 5 6 +1 3 35902 +4 6 19698 +4 6 73389 +3 6 3031 +3 1 4771 +1 4 4784 +2 1 36357 +2 1 24830 +5 6 50219 +4 6 22645 +1 2 30739 +1 4 68417 +1 5 78537 diff --git a/codenet/public_test_cases/p02931/input.3.txt b/codenet/public_test_cases/p02931/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..69722a2a76a0a71cb553d77bbb1b4da2406a31fa --- /dev/null +++ b/codenet/public_test_cases/p02931/input.3.txt @@ -0,0 +1,7 @@ +6 2 2 +2 2 2 +1 1 8 +1 1 5 +1 2 9 +1 2 7 +2 1 4 diff --git a/codenet/public_test_cases/p02931/output.0.txt b/codenet/public_test_cases/p02931/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9902f17848a8974ab57d57999b74a63198fe6e23 --- /dev/null +++ b/codenet/public_test_cases/p02931/output.0.txt @@ -0,0 +1 @@ +28 diff --git a/codenet/public_test_cases/p02931/output.1.txt b/codenet/public_test_cases/p02931/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02931/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02931/output.2.txt b/codenet/public_test_cases/p02931/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c103096298d527df5e3749899d9ee281ab56e5fd --- /dev/null +++ b/codenet/public_test_cases/p02931/output.2.txt @@ -0,0 +1 @@ +430590 diff --git a/codenet/public_test_cases/p02931/output.3.txt b/codenet/public_test_cases/p02931/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9902f17848a8974ab57d57999b74a63198fe6e23 --- /dev/null +++ b/codenet/public_test_cases/p02931/output.3.txt @@ -0,0 +1 @@ +28 diff --git a/codenet/public_test_cases/p02932/input.0.txt b/codenet/public_test_cases/p02932/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c66022fb99ec1cd8db16540ce791f0d8e6947d52 --- /dev/null +++ b/codenet/public_test_cases/p02932/input.0.txt @@ -0,0 +1 @@ +4 2 3 7 diff --git a/codenet/public_test_cases/p02932/input.1.txt b/codenet/public_test_cases/p02932/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c66022fb99ec1cd8db16540ce791f0d8e6947d52 --- /dev/null +++ b/codenet/public_test_cases/p02932/input.1.txt @@ -0,0 +1 @@ +4 2 3 7 diff --git a/codenet/public_test_cases/p02932/input.2.txt b/codenet/public_test_cases/p02932/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4604f717e444cc2d639ebe7debcf78f806787de --- /dev/null +++ b/codenet/public_test_cases/p02932/input.2.txt @@ -0,0 +1 @@ +141592 6535 89793 238462 diff --git a/codenet/public_test_cases/p02932/input.3.txt b/codenet/public_test_cases/p02932/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfa537a1bf97b760888a9c0fde283553e3b322ab --- /dev/null +++ b/codenet/public_test_cases/p02932/input.3.txt @@ -0,0 +1 @@ +2 1 4 8 diff --git a/codenet/public_test_cases/p02932/output.0.txt b/codenet/public_test_cases/p02932/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f96ac06721837aa6a644a580c03c76f304e81db0 --- /dev/null +++ b/codenet/public_test_cases/p02932/output.0.txt @@ -0,0 +1 @@ +105 diff --git a/codenet/public_test_cases/p02932/output.1.txt b/codenet/public_test_cases/p02932/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f96ac06721837aa6a644a580c03c76f304e81db0 --- /dev/null +++ b/codenet/public_test_cases/p02932/output.1.txt @@ -0,0 +1 @@ +105 diff --git a/codenet/public_test_cases/p02932/output.2.txt b/codenet/public_test_cases/p02932/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3ad1442c059f60b4add6176d196d38abc89fa9d --- /dev/null +++ b/codenet/public_test_cases/p02932/output.2.txt @@ -0,0 +1 @@ +933832916 diff --git a/codenet/public_test_cases/p02932/output.3.txt b/codenet/public_test_cases/p02932/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02932/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02933/input.0.txt b/codenet/public_test_cases/p02933/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23aa4eb68647961e0c729aba28c6116094910dea --- /dev/null +++ b/codenet/public_test_cases/p02933/input.0.txt @@ -0,0 +1,2 @@ +3200 +pink diff --git a/codenet/public_test_cases/p02933/input.1.txt b/codenet/public_test_cases/p02933/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b05dde3b460c18bc9ce0f2e234f182c9fe6c48b --- /dev/null +++ b/codenet/public_test_cases/p02933/input.1.txt @@ -0,0 +1,2 @@ +4049 +red diff --git a/codenet/public_test_cases/p02933/input.2.txt b/codenet/public_test_cases/p02933/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f71de9268d605b5ef2bbfc2e25001db266fba9f --- /dev/null +++ b/codenet/public_test_cases/p02933/input.2.txt @@ -0,0 +1,2 @@ +3199 +pink diff --git a/codenet/public_test_cases/p02933/input.3.txt b/codenet/public_test_cases/p02933/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..23aa4eb68647961e0c729aba28c6116094910dea --- /dev/null +++ b/codenet/public_test_cases/p02933/input.3.txt @@ -0,0 +1,2 @@ +3200 +pink diff --git a/codenet/public_test_cases/p02933/output.0.txt b/codenet/public_test_cases/p02933/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08d69ebaa34044d6a5dd18cfbcb590d50ba5a6a3 --- /dev/null +++ b/codenet/public_test_cases/p02933/output.0.txt @@ -0,0 +1 @@ +pink diff --git a/codenet/public_test_cases/p02933/output.1.txt b/codenet/public_test_cases/p02933/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9d1386a1d99728de010ad4044fb984886b57f33 --- /dev/null +++ b/codenet/public_test_cases/p02933/output.1.txt @@ -0,0 +1 @@ +red diff --git a/codenet/public_test_cases/p02933/output.2.txt b/codenet/public_test_cases/p02933/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9d1386a1d99728de010ad4044fb984886b57f33 --- /dev/null +++ b/codenet/public_test_cases/p02933/output.2.txt @@ -0,0 +1 @@ +red diff --git a/codenet/public_test_cases/p02933/output.3.txt b/codenet/public_test_cases/p02933/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..08d69ebaa34044d6a5dd18cfbcb590d50ba5a6a3 --- /dev/null +++ b/codenet/public_test_cases/p02933/output.3.txt @@ -0,0 +1 @@ +pink diff --git a/codenet/public_test_cases/p02934/input.0.txt b/codenet/public_test_cases/p02934/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d55a9d88e4cf67ad687f0638c20a9fc862ef7b3b --- /dev/null +++ b/codenet/public_test_cases/p02934/input.0.txt @@ -0,0 +1,2 @@ +2 +10 30 diff --git a/codenet/public_test_cases/p02934/input.1.txt b/codenet/public_test_cases/p02934/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d55a9d88e4cf67ad687f0638c20a9fc862ef7b3b --- /dev/null +++ b/codenet/public_test_cases/p02934/input.1.txt @@ -0,0 +1,2 @@ +2 +10 30 diff --git a/codenet/public_test_cases/p02934/input.2.txt b/codenet/public_test_cases/p02934/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f887434aa82a20c45214d3646af5af6d05fcca5 --- /dev/null +++ b/codenet/public_test_cases/p02934/input.2.txt @@ -0,0 +1,2 @@ +1 +1000 diff --git a/codenet/public_test_cases/p02934/input.3.txt b/codenet/public_test_cases/p02934/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e5d65ad0e78a9628275d7e65f773994cf621647 --- /dev/null +++ b/codenet/public_test_cases/p02934/input.3.txt @@ -0,0 +1,2 @@ +3 +200 200 200 diff --git a/codenet/public_test_cases/p02934/output.0.txt b/codenet/public_test_cases/p02934/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c382960e38796254910dcdfb506d19fcf1685cf4 --- /dev/null +++ b/codenet/public_test_cases/p02934/output.0.txt @@ -0,0 +1 @@ +7.5 diff --git a/codenet/public_test_cases/p02934/output.1.txt b/codenet/public_test_cases/p02934/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c382960e38796254910dcdfb506d19fcf1685cf4 --- /dev/null +++ b/codenet/public_test_cases/p02934/output.1.txt @@ -0,0 +1 @@ +7.5 diff --git a/codenet/public_test_cases/p02934/output.2.txt b/codenet/public_test_cases/p02934/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b33d238dab9943201aaf267f701e8ea5fc9268 --- /dev/null +++ b/codenet/public_test_cases/p02934/output.2.txt @@ -0,0 +1 @@ +1000 diff --git a/codenet/public_test_cases/p02934/output.3.txt b/codenet/public_test_cases/p02934/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b9dd4ec698eab1e10fac96bf5e185c37d9674da --- /dev/null +++ b/codenet/public_test_cases/p02934/output.3.txt @@ -0,0 +1 @@ +66.66666666666667 diff --git a/codenet/public_test_cases/p02935/input.0.txt b/codenet/public_test_cases/p02935/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4aae7e90d80ea4162dc4ddff3725f97b4741225 --- /dev/null +++ b/codenet/public_test_cases/p02935/input.0.txt @@ -0,0 +1,2 @@ +2 +3 4 diff --git a/codenet/public_test_cases/p02935/input.1.txt b/codenet/public_test_cases/p02935/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4aae7e90d80ea4162dc4ddff3725f97b4741225 --- /dev/null +++ b/codenet/public_test_cases/p02935/input.1.txt @@ -0,0 +1,2 @@ +2 +3 4 diff --git a/codenet/public_test_cases/p02935/input.2.txt b/codenet/public_test_cases/p02935/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1528e0a5a3db0164d8c5e3cc987660fe864e5dae --- /dev/null +++ b/codenet/public_test_cases/p02935/input.2.txt @@ -0,0 +1,2 @@ +3 +500 300 200 diff --git a/codenet/public_test_cases/p02935/input.3.txt b/codenet/public_test_cases/p02935/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d76ce0d7a0b27cf422cc0a7eff613f79b5d41b34 --- /dev/null +++ b/codenet/public_test_cases/p02935/input.3.txt @@ -0,0 +1,2 @@ +5 +138 138 138 138 138 diff --git a/codenet/public_test_cases/p02935/output.0.txt b/codenet/public_test_cases/p02935/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a958026daa3208cb329c403433beb56abd5c036 --- /dev/null +++ b/codenet/public_test_cases/p02935/output.0.txt @@ -0,0 +1 @@ +3.5 diff --git a/codenet/public_test_cases/p02935/output.1.txt b/codenet/public_test_cases/p02935/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a958026daa3208cb329c403433beb56abd5c036 --- /dev/null +++ b/codenet/public_test_cases/p02935/output.1.txt @@ -0,0 +1 @@ +3.5 diff --git a/codenet/public_test_cases/p02935/output.2.txt b/codenet/public_test_cases/p02935/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9061d95de9d31740c4e77082c7b52d63b5622fb --- /dev/null +++ b/codenet/public_test_cases/p02935/output.2.txt @@ -0,0 +1 @@ +375 diff --git a/codenet/public_test_cases/p02935/output.3.txt b/codenet/public_test_cases/p02935/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..93e7803245e457a68d3feb62b2d7040ee8b6dd28 --- /dev/null +++ b/codenet/public_test_cases/p02935/output.3.txt @@ -0,0 +1 @@ +138 diff --git a/codenet/public_test_cases/p02936/input.0.txt b/codenet/public_test_cases/p02936/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50e51dce52d561d4690f8f56d01c966f188fdcc6 --- /dev/null +++ b/codenet/public_test_cases/p02936/input.0.txt @@ -0,0 +1,7 @@ +4 3 +1 2 +2 3 +2 4 +2 10 +1 100 +3 1 diff --git a/codenet/public_test_cases/p02936/input.1.txt b/codenet/public_test_cases/p02936/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e7f17477f2c472e3e6a7e5f92c38e15d5436422 --- /dev/null +++ b/codenet/public_test_cases/p02936/input.1.txt @@ -0,0 +1,8 @@ +6 2 +1 2 +1 3 +2 4 +3 6 +2 5 +1 10 +1 10 diff --git a/codenet/public_test_cases/p02936/input.2.txt b/codenet/public_test_cases/p02936/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..50e51dce52d561d4690f8f56d01c966f188fdcc6 --- /dev/null +++ b/codenet/public_test_cases/p02936/input.2.txt @@ -0,0 +1,7 @@ +4 3 +1 2 +2 3 +2 4 +2 10 +1 100 +3 1 diff --git a/codenet/public_test_cases/p02936/output.0.txt b/codenet/public_test_cases/p02936/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..283985c79ab065debf56814d820ca0e896d2209c --- /dev/null +++ b/codenet/public_test_cases/p02936/output.0.txt @@ -0,0 +1 @@ +100 110 111 110 diff --git a/codenet/public_test_cases/p02936/output.1.txt b/codenet/public_test_cases/p02936/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..93e42503decc11f289e67f9caaccf717fdafaab1 --- /dev/null +++ b/codenet/public_test_cases/p02936/output.1.txt @@ -0,0 +1 @@ +20 20 20 20 20 20 diff --git a/codenet/public_test_cases/p02936/output.2.txt b/codenet/public_test_cases/p02936/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..283985c79ab065debf56814d820ca0e896d2209c --- /dev/null +++ b/codenet/public_test_cases/p02936/output.2.txt @@ -0,0 +1 @@ +100 110 111 110 diff --git a/codenet/public_test_cases/p02937/input.0.txt b/codenet/public_test_cases/p02937/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d15d3c58fca229afe0101e3a78777fc15a1984c --- /dev/null +++ b/codenet/public_test_cases/p02937/input.0.txt @@ -0,0 +1,2 @@ +contest +son diff --git a/codenet/public_test_cases/p02937/input.1.txt b/codenet/public_test_cases/p02937/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8137baebb8aa65a0b8b4b5101640ff2f7e1483b3 --- /dev/null +++ b/codenet/public_test_cases/p02937/input.1.txt @@ -0,0 +1,2 @@ +contest +sentence diff --git a/codenet/public_test_cases/p02937/input.2.txt b/codenet/public_test_cases/p02937/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d15d3c58fca229afe0101e3a78777fc15a1984c --- /dev/null +++ b/codenet/public_test_cases/p02937/input.2.txt @@ -0,0 +1,2 @@ +contest +son diff --git a/codenet/public_test_cases/p02937/input.3.txt b/codenet/public_test_cases/p02937/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1a11d64282bc5919708de537a71ebae910439b2 --- /dev/null +++ b/codenet/public_test_cases/p02937/input.3.txt @@ -0,0 +1,2 @@ +contest +programming diff --git a/codenet/public_test_cases/p02937/output.0.txt b/codenet/public_test_cases/p02937/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02937/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02937/output.1.txt b/codenet/public_test_cases/p02937/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb95160cb6e07358f54a28a208ae41e69889c97b --- /dev/null +++ b/codenet/public_test_cases/p02937/output.1.txt @@ -0,0 +1 @@ +33 diff --git a/codenet/public_test_cases/p02937/output.2.txt b/codenet/public_test_cases/p02937/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02937/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02937/output.3.txt b/codenet/public_test_cases/p02937/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02937/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02938/input.0.txt b/codenet/public_test_cases/p02938/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02938/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02938/input.1.txt b/codenet/public_test_cases/p02938/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02938/input.1.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02938/input.2.txt b/codenet/public_test_cases/p02938/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c60636f9ce8130379a7fe48df8e8f87e9951e3a7 --- /dev/null +++ b/codenet/public_test_cases/p02938/input.2.txt @@ -0,0 +1 @@ +10 100 diff --git a/codenet/public_test_cases/p02938/input.3.txt b/codenet/public_test_cases/p02938/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b73472cc7c76fad488ec1318cfc095fef860138 --- /dev/null +++ b/codenet/public_test_cases/p02938/input.3.txt @@ -0,0 +1 @@ +1 1000000000000000000 diff --git a/codenet/public_test_cases/p02938/output.0.txt b/codenet/public_test_cases/p02938/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02938/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02938/output.1.txt b/codenet/public_test_cases/p02938/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02938/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02938/output.2.txt b/codenet/public_test_cases/p02938/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..103a99dd857b51bdf6544358c7efcd8dc070c239 --- /dev/null +++ b/codenet/public_test_cases/p02938/output.2.txt @@ -0,0 +1 @@ +604 diff --git a/codenet/public_test_cases/p02938/output.3.txt b/codenet/public_test_cases/p02938/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..554f7a44ace2703999e0fe028b4ba0c029e43884 --- /dev/null +++ b/codenet/public_test_cases/p02938/output.3.txt @@ -0,0 +1 @@ +68038601 diff --git a/codenet/public_test_cases/p02939/input.0.txt b/codenet/public_test_cases/p02939/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b274a66824f8675a6e0cb3af35c78cc5fd709634 --- /dev/null +++ b/codenet/public_test_cases/p02939/input.0.txt @@ -0,0 +1 @@ +aabbaa diff --git a/codenet/public_test_cases/p02939/input.1.txt b/codenet/public_test_cases/p02939/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..16443074f11c56410ae88ff68f82b14554e45d64 --- /dev/null +++ b/codenet/public_test_cases/p02939/input.1.txt @@ -0,0 +1 @@ +aaaccacabaababc diff --git a/codenet/public_test_cases/p02939/input.2.txt b/codenet/public_test_cases/p02939/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b274a66824f8675a6e0cb3af35c78cc5fd709634 --- /dev/null +++ b/codenet/public_test_cases/p02939/input.2.txt @@ -0,0 +1 @@ +aabbaa diff --git a/codenet/public_test_cases/p02939/output.0.txt b/codenet/public_test_cases/p02939/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02939/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02939/output.1.txt b/codenet/public_test_cases/p02939/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p02939/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p02939/output.2.txt b/codenet/public_test_cases/p02939/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02939/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02940/input.0.txt b/codenet/public_test_cases/p02940/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fb6a5f079daed876c456c42ad8b03a4926a31a0 --- /dev/null +++ b/codenet/public_test_cases/p02940/input.0.txt @@ -0,0 +1,2 @@ +3 +RRRGGGBBB diff --git a/codenet/public_test_cases/p02940/input.1.txt b/codenet/public_test_cases/p02940/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fb6a5f079daed876c456c42ad8b03a4926a31a0 --- /dev/null +++ b/codenet/public_test_cases/p02940/input.1.txt @@ -0,0 +1,2 @@ +3 +RRRGGGBBB diff --git a/codenet/public_test_cases/p02940/input.2.txt b/codenet/public_test_cases/p02940/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5d03457d1ea97d44d287bbb00d97ab27b24ddcc --- /dev/null +++ b/codenet/public_test_cases/p02940/input.2.txt @@ -0,0 +1,2 @@ +5 +BBRGRRGRGGRBBGB diff --git a/codenet/public_test_cases/p02940/output.0.txt b/codenet/public_test_cases/p02940/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a817176f4a68f229aed5e26b9ffb3470b6262f32 --- /dev/null +++ b/codenet/public_test_cases/p02940/output.0.txt @@ -0,0 +1 @@ +216 diff --git a/codenet/public_test_cases/p02940/output.1.txt b/codenet/public_test_cases/p02940/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a817176f4a68f229aed5e26b9ffb3470b6262f32 --- /dev/null +++ b/codenet/public_test_cases/p02940/output.1.txt @@ -0,0 +1 @@ +216 diff --git a/codenet/public_test_cases/p02940/output.2.txt b/codenet/public_test_cases/p02940/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6edead7ce20589531af96a24cc178a3a0183dc83 --- /dev/null +++ b/codenet/public_test_cases/p02940/output.2.txt @@ -0,0 +1 @@ +960 diff --git a/codenet/public_test_cases/p02941/input.0.txt b/codenet/public_test_cases/p02941/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d95b9bdb8314953e3b386e36280e75f5acdc0db --- /dev/null +++ b/codenet/public_test_cases/p02941/input.0.txt @@ -0,0 +1,3 @@ +3 +1 1 1 +13 5 7 diff --git a/codenet/public_test_cases/p02941/input.1.txt b/codenet/public_test_cases/p02941/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86bc97915345cf7f17ef37550527cadae679c23f --- /dev/null +++ b/codenet/public_test_cases/p02941/input.1.txt @@ -0,0 +1,3 @@ +5 +5 6 5 2 1 +9817 1108 6890 4343 8704 diff --git a/codenet/public_test_cases/p02941/input.2.txt b/codenet/public_test_cases/p02941/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9754af6f9b034aabee58de532f2d8a5c7ef17d4 --- /dev/null +++ b/codenet/public_test_cases/p02941/input.2.txt @@ -0,0 +1,3 @@ +4 +1 2 3 4 +2 3 4 5 diff --git a/codenet/public_test_cases/p02941/input.3.txt b/codenet/public_test_cases/p02941/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d95b9bdb8314953e3b386e36280e75f5acdc0db --- /dev/null +++ b/codenet/public_test_cases/p02941/input.3.txt @@ -0,0 +1,3 @@ +3 +1 1 1 +13 5 7 diff --git a/codenet/public_test_cases/p02941/output.0.txt b/codenet/public_test_cases/p02941/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02941/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02941/output.1.txt b/codenet/public_test_cases/p02941/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p02941/output.1.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p02941/output.2.txt b/codenet/public_test_cases/p02941/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02941/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02941/output.3.txt b/codenet/public_test_cases/p02941/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02941/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02942/input.0.txt b/codenet/public_test_cases/p02942/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e29f67d5ae3ab4ffb6596074ccd8f6a3b551768 --- /dev/null +++ b/codenet/public_test_cases/p02942/input.0.txt @@ -0,0 +1,4 @@ +3 2 +2 6 +4 3 +1 5 diff --git a/codenet/public_test_cases/p02942/input.1.txt b/codenet/public_test_cases/p02942/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e29f67d5ae3ab4ffb6596074ccd8f6a3b551768 --- /dev/null +++ b/codenet/public_test_cases/p02942/input.1.txt @@ -0,0 +1,4 @@ +3 2 +2 6 +4 3 +1 5 diff --git a/codenet/public_test_cases/p02942/input.2.txt b/codenet/public_test_cases/p02942/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a278470e90ebef5fd8c80f107e3a53ca1b8207a --- /dev/null +++ b/codenet/public_test_cases/p02942/input.2.txt @@ -0,0 +1,4 @@ +3 4 +1 4 7 10 +2 5 8 11 +3 6 9 12 diff --git a/codenet/public_test_cases/p02942/output.0.txt b/codenet/public_test_cases/p02942/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a1d228de9d4317fb290462a481ef82295e41c4a --- /dev/null +++ b/codenet/public_test_cases/p02942/output.0.txt @@ -0,0 +1,6 @@ +2 6 +4 3 +5 1 +2 1 +4 3 +5 6 diff --git a/codenet/public_test_cases/p02942/output.1.txt b/codenet/public_test_cases/p02942/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a1d228de9d4317fb290462a481ef82295e41c4a --- /dev/null +++ b/codenet/public_test_cases/p02942/output.1.txt @@ -0,0 +1,6 @@ +2 6 +4 3 +5 1 +2 1 +4 3 +5 6 diff --git a/codenet/public_test_cases/p02942/output.2.txt b/codenet/public_test_cases/p02942/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ed6a2cc790dcf3280f4e46cf1211907f64672ee --- /dev/null +++ b/codenet/public_test_cases/p02942/output.2.txt @@ -0,0 +1,6 @@ +1 4 7 10 +5 8 11 2 +9 12 3 6 +1 4 3 2 +5 8 7 6 +9 12 11 10 diff --git a/codenet/public_test_cases/p02943/input.0.txt b/codenet/public_test_cases/p02943/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..79a4a0387bc675f80627c3d68b40a578747bf8fe --- /dev/null +++ b/codenet/public_test_cases/p02943/input.0.txt @@ -0,0 +1,2 @@ +5 1 +bacba diff --git a/codenet/public_test_cases/p02943/input.1.txt b/codenet/public_test_cases/p02943/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..79a4a0387bc675f80627c3d68b40a578747bf8fe --- /dev/null +++ b/codenet/public_test_cases/p02943/input.1.txt @@ -0,0 +1,2 @@ +5 1 +bacba diff --git a/codenet/public_test_cases/p02943/input.2.txt b/codenet/public_test_cases/p02943/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c60fb87385de24166d423710000bfeda06743bf3 --- /dev/null +++ b/codenet/public_test_cases/p02943/input.2.txt @@ -0,0 +1,2 @@ +10 2 +bbaabbbaab diff --git a/codenet/public_test_cases/p02943/output.0.txt b/codenet/public_test_cases/p02943/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8614cd1ee55c5fb8f3578114a5a26e7b2f756084 --- /dev/null +++ b/codenet/public_test_cases/p02943/output.0.txt @@ -0,0 +1 @@ +aabca diff --git a/codenet/public_test_cases/p02943/output.1.txt b/codenet/public_test_cases/p02943/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8614cd1ee55c5fb8f3578114a5a26e7b2f756084 --- /dev/null +++ b/codenet/public_test_cases/p02943/output.1.txt @@ -0,0 +1 @@ +aabca diff --git a/codenet/public_test_cases/p02943/output.2.txt b/codenet/public_test_cases/p02943/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..012f903ae19109aee01a9f097a2249268e7e48a9 --- /dev/null +++ b/codenet/public_test_cases/p02943/output.2.txt @@ -0,0 +1 @@ +aaaabbaabb diff --git a/codenet/public_test_cases/p02944/input.0.txt b/codenet/public_test_cases/p02944/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e2e3515b42443cd6559c2c06fe8da353f24b86a --- /dev/null +++ b/codenet/public_test_cases/p02944/input.0.txt @@ -0,0 +1,2 @@ +9 3 +2 1 1 1 1 1 1 2 3 diff --git a/codenet/public_test_cases/p02944/input.1.txt b/codenet/public_test_cases/p02944/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4978f8fe5e0307545e93afc9bb9650f1dac139f --- /dev/null +++ b/codenet/public_test_cases/p02944/input.1.txt @@ -0,0 +1,2 @@ +15 3 +4 3 2 1 1 1 2 3 2 2 1 1 1 2 2 diff --git a/codenet/public_test_cases/p02944/input.2.txt b/codenet/public_test_cases/p02944/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5706e6b99bcfc9d429e43af6057873412cdfc94b --- /dev/null +++ b/codenet/public_test_cases/p02944/input.2.txt @@ -0,0 +1,2 @@ +9 2 +2 1 1 1 1 1 1 2 3 diff --git a/codenet/public_test_cases/p02944/input.3.txt b/codenet/public_test_cases/p02944/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e2e3515b42443cd6559c2c06fe8da353f24b86a --- /dev/null +++ b/codenet/public_test_cases/p02944/input.3.txt @@ -0,0 +1,2 @@ +9 3 +2 1 1 1 1 1 1 2 3 diff --git a/codenet/public_test_cases/p02944/output.0.txt b/codenet/public_test_cases/p02944/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p02944/output.0.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p02944/output.1.txt b/codenet/public_test_cases/p02944/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e85087affded170efcbc6f9672a6fc671d839ed0 --- /dev/null +++ b/codenet/public_test_cases/p02944/output.1.txt @@ -0,0 +1 @@ +31 diff --git a/codenet/public_test_cases/p02944/output.2.txt b/codenet/public_test_cases/p02944/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..87523dd7a0632907d61799465827c3f08825fa47 --- /dev/null +++ b/codenet/public_test_cases/p02944/output.2.txt @@ -0,0 +1 @@ +41 diff --git a/codenet/public_test_cases/p02944/output.3.txt b/codenet/public_test_cases/p02944/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p02944/output.3.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p02945/input.0.txt b/codenet/public_test_cases/p02945/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a55824625c8bbf8f726b0b91a706f9bdc7eaa754 --- /dev/null +++ b/codenet/public_test_cases/p02945/input.0.txt @@ -0,0 +1 @@ +-13 3 diff --git a/codenet/public_test_cases/p02945/output.0.txt b/codenet/public_test_cases/p02945/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..291670352e5a6c9aa5fff035ad4554e55c0daf7f --- /dev/null +++ b/codenet/public_test_cases/p02945/output.0.txt @@ -0,0 +1 @@ +-10 diff --git a/codenet/public_test_cases/p02946/input.0.txt b/codenet/public_test_cases/p02946/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0871b0b46ec9fe33d7a99d3608001b41d41374a5 --- /dev/null +++ b/codenet/public_test_cases/p02946/input.0.txt @@ -0,0 +1 @@ +3 7 diff --git a/codenet/public_test_cases/p02946/input.1.txt b/codenet/public_test_cases/p02946/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f879177cd5cd90ab792439e8b42ec76439336971 --- /dev/null +++ b/codenet/public_test_cases/p02946/input.1.txt @@ -0,0 +1 @@ +4 0 diff --git a/codenet/public_test_cases/p02946/input.2.txt b/codenet/public_test_cases/p02946/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eee8d43e090864f4135ce0d23adc39dcfa2cc180 --- /dev/null +++ b/codenet/public_test_cases/p02946/input.2.txt @@ -0,0 +1 @@ +1 100 diff --git a/codenet/public_test_cases/p02946/input.3.txt b/codenet/public_test_cases/p02946/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0871b0b46ec9fe33d7a99d3608001b41d41374a5 --- /dev/null +++ b/codenet/public_test_cases/p02946/input.3.txt @@ -0,0 +1 @@ +3 7 diff --git a/codenet/public_test_cases/p02946/output.0.txt b/codenet/public_test_cases/p02946/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e82aa2b5cc02b26ca22c8ba156ecf982685087e3 --- /dev/null +++ b/codenet/public_test_cases/p02946/output.0.txt @@ -0,0 +1 @@ +5 6 7 8 9 diff --git a/codenet/public_test_cases/p02946/output.1.txt b/codenet/public_test_cases/p02946/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dcf83ef8bf6ed9386bf7dc7d04ceeeb69b54002 --- /dev/null +++ b/codenet/public_test_cases/p02946/output.1.txt @@ -0,0 +1 @@ +-3 -2 -1 0 1 2 3 diff --git a/codenet/public_test_cases/p02946/output.2.txt b/codenet/public_test_cases/p02946/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02946/output.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02946/output.3.txt b/codenet/public_test_cases/p02946/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e82aa2b5cc02b26ca22c8ba156ecf982685087e3 --- /dev/null +++ b/codenet/public_test_cases/p02946/output.3.txt @@ -0,0 +1 @@ +5 6 7 8 9 diff --git a/codenet/public_test_cases/p02947/input.0.txt b/codenet/public_test_cases/p02947/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18e09b537f591d41e2d1219b6693f3600437423f --- /dev/null +++ b/codenet/public_test_cases/p02947/input.0.txt @@ -0,0 +1,4 @@ +3 +acornistnt +peanutbomb +constraint diff --git a/codenet/public_test_cases/p02947/input.1.txt b/codenet/public_test_cases/p02947/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d496f33fa3c9dd79b832c437c3d3e9f6ed0086fa --- /dev/null +++ b/codenet/public_test_cases/p02947/input.1.txt @@ -0,0 +1,6 @@ +5 +abaaaaaaaa +oneplustwo +aaaaaaaaba +twoplusone +aaaabaaaaa diff --git a/codenet/public_test_cases/p02947/input.2.txt b/codenet/public_test_cases/p02947/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7804300702748282457fa26983f10f08bfb48ef2 --- /dev/null +++ b/codenet/public_test_cases/p02947/input.2.txt @@ -0,0 +1,3 @@ +2 +oneplustwo +ninemodsix diff --git a/codenet/public_test_cases/p02947/input.3.txt b/codenet/public_test_cases/p02947/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..18e09b537f591d41e2d1219b6693f3600437423f --- /dev/null +++ b/codenet/public_test_cases/p02947/input.3.txt @@ -0,0 +1,4 @@ +3 +acornistnt +peanutbomb +constraint diff --git a/codenet/public_test_cases/p02947/output.0.txt b/codenet/public_test_cases/p02947/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02947/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02947/output.1.txt b/codenet/public_test_cases/p02947/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02947/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02947/output.2.txt b/codenet/public_test_cases/p02947/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02947/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02947/output.3.txt b/codenet/public_test_cases/p02947/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02947/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02948/input.0.txt b/codenet/public_test_cases/p02948/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afbf8ad5a36285797e023ce41a73befd92420ba2 --- /dev/null +++ b/codenet/public_test_cases/p02948/input.0.txt @@ -0,0 +1,4 @@ +3 4 +4 3 +4 1 +2 2 diff --git a/codenet/public_test_cases/p02948/input.1.txt b/codenet/public_test_cases/p02948/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..344af1440ecdeaa6872dc250d0fab74a96a740c0 --- /dev/null +++ b/codenet/public_test_cases/p02948/input.1.txt @@ -0,0 +1,6 @@ +5 3 +1 2 +1 3 +1 4 +2 1 +2 3 diff --git a/codenet/public_test_cases/p02948/input.2.txt b/codenet/public_test_cases/p02948/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e86f0948edbc67e069290fee9e3292dc41985bfc --- /dev/null +++ b/codenet/public_test_cases/p02948/input.2.txt @@ -0,0 +1,2 @@ +1 1 +2 1 diff --git a/codenet/public_test_cases/p02948/input.3.txt b/codenet/public_test_cases/p02948/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..afbf8ad5a36285797e023ce41a73befd92420ba2 --- /dev/null +++ b/codenet/public_test_cases/p02948/input.3.txt @@ -0,0 +1,4 @@ +3 4 +4 3 +4 1 +2 2 diff --git a/codenet/public_test_cases/p02948/output.0.txt b/codenet/public_test_cases/p02948/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02948/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02948/output.1.txt b/codenet/public_test_cases/p02948/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02948/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02948/output.2.txt b/codenet/public_test_cases/p02948/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02948/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02948/output.3.txt b/codenet/public_test_cases/p02948/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02948/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02949/input.0.txt b/codenet/public_test_cases/p02949/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c35a48fab428d51ba4b7eca39fe5ff42823d2b3e --- /dev/null +++ b/codenet/public_test_cases/p02949/input.0.txt @@ -0,0 +1,4 @@ +3 3 10 +1 2 20 +2 3 30 +1 3 45 diff --git a/codenet/public_test_cases/p02949/input.1.txt b/codenet/public_test_cases/p02949/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..769916d2deda9eb8dbe4528198a54bb1e1acacd5 --- /dev/null +++ b/codenet/public_test_cases/p02949/input.1.txt @@ -0,0 +1,3 @@ +2 2 10 +1 2 100 +2 2 100 diff --git a/codenet/public_test_cases/p02949/input.2.txt b/codenet/public_test_cases/p02949/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b93927c5f833d77f5ff4579d94918c4815092162 --- /dev/null +++ b/codenet/public_test_cases/p02949/input.2.txt @@ -0,0 +1,6 @@ +4 5 10 +1 2 1 +1 4 1 +3 4 1 +2 2 100 +3 3 100 diff --git a/codenet/public_test_cases/p02949/input.3.txt b/codenet/public_test_cases/p02949/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c35a48fab428d51ba4b7eca39fe5ff42823d2b3e --- /dev/null +++ b/codenet/public_test_cases/p02949/input.3.txt @@ -0,0 +1,4 @@ +3 3 10 +1 2 20 +2 3 30 +1 3 45 diff --git a/codenet/public_test_cases/p02949/output.0.txt b/codenet/public_test_cases/p02949/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f92bfdd49766b1907d4aec8d3b0f9ed6129d0e6 --- /dev/null +++ b/codenet/public_test_cases/p02949/output.0.txt @@ -0,0 +1 @@ +35 diff --git a/codenet/public_test_cases/p02949/output.1.txt b/codenet/public_test_cases/p02949/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02949/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02949/output.2.txt b/codenet/public_test_cases/p02949/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02949/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02949/output.3.txt b/codenet/public_test_cases/p02949/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f92bfdd49766b1907d4aec8d3b0f9ed6129d0e6 --- /dev/null +++ b/codenet/public_test_cases/p02949/output.3.txt @@ -0,0 +1 @@ +35 diff --git a/codenet/public_test_cases/p02950/input.0.txt b/codenet/public_test_cases/p02950/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddc3c1999db7e43440e1656e263f439ae6955d01 --- /dev/null +++ b/codenet/public_test_cases/p02950/input.0.txt @@ -0,0 +1,2 @@ +2 +1 0 diff --git a/codenet/public_test_cases/p02950/input.1.txt b/codenet/public_test_cases/p02950/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddc3c1999db7e43440e1656e263f439ae6955d01 --- /dev/null +++ b/codenet/public_test_cases/p02950/input.1.txt @@ -0,0 +1,2 @@ +2 +1 0 diff --git a/codenet/public_test_cases/p02950/input.2.txt b/codenet/public_test_cases/p02950/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2edfca631f6b221d5a1dfd1f79e5a63d755b7b9d --- /dev/null +++ b/codenet/public_test_cases/p02950/input.2.txt @@ -0,0 +1,2 @@ +3 +0 0 0 diff --git a/codenet/public_test_cases/p02950/input.3.txt b/codenet/public_test_cases/p02950/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9733d5f4081b110c4bebd17c398b6c1b4dc118c9 --- /dev/null +++ b/codenet/public_test_cases/p02950/input.3.txt @@ -0,0 +1,2 @@ +5 +0 1 0 1 0 diff --git a/codenet/public_test_cases/p02950/output.0.txt b/codenet/public_test_cases/p02950/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02950/output.0.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02950/output.1.txt b/codenet/public_test_cases/p02950/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p02950/output.1.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p02950/output.2.txt b/codenet/public_test_cases/p02950/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c7b77a21ad082741847f21e69d14e14c082a73 --- /dev/null +++ b/codenet/public_test_cases/p02950/output.2.txt @@ -0,0 +1 @@ +0 0 0 diff --git a/codenet/public_test_cases/p02950/output.3.txt b/codenet/public_test_cases/p02950/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a167449540c115e4258d63ffcc7b28bf98b2d82 --- /dev/null +++ b/codenet/public_test_cases/p02950/output.3.txt @@ -0,0 +1 @@ +0 2 0 1 3 diff --git a/codenet/public_test_cases/p02951/input.0.txt b/codenet/public_test_cases/p02951/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a4397a75e45e63706e546e7258d83fc2c94bb2e --- /dev/null +++ b/codenet/public_test_cases/p02951/input.0.txt @@ -0,0 +1 @@ +6 4 3 diff --git a/codenet/public_test_cases/p02951/input.1.txt b/codenet/public_test_cases/p02951/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e63cb8edae60e235902a95927be5faa727b26a9 --- /dev/null +++ b/codenet/public_test_cases/p02951/input.1.txt @@ -0,0 +1 @@ +12 3 7 diff --git a/codenet/public_test_cases/p02951/input.2.txt b/codenet/public_test_cases/p02951/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7b51de501aba69a19ade9bcc466ab7d562476d4 --- /dev/null +++ b/codenet/public_test_cases/p02951/input.2.txt @@ -0,0 +1 @@ +8 3 9 diff --git a/codenet/public_test_cases/p02951/input.3.txt b/codenet/public_test_cases/p02951/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a4397a75e45e63706e546e7258d83fc2c94bb2e --- /dev/null +++ b/codenet/public_test_cases/p02951/input.3.txt @@ -0,0 +1 @@ +6 4 3 diff --git a/codenet/public_test_cases/p02951/output.0.txt b/codenet/public_test_cases/p02951/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02951/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02951/output.1.txt b/codenet/public_test_cases/p02951/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02951/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02951/output.2.txt b/codenet/public_test_cases/p02951/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02951/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02951/output.3.txt b/codenet/public_test_cases/p02951/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02951/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02952/input.0.txt b/codenet/public_test_cases/p02952/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02952/input.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02952/input.1.txt b/codenet/public_test_cases/p02952/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p02952/input.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p02952/input.2.txt b/codenet/public_test_cases/p02952/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7393e847d34d19031ee0ba57df63e4d0ccb4fb2 --- /dev/null +++ b/codenet/public_test_cases/p02952/input.2.txt @@ -0,0 +1 @@ +100000 diff --git a/codenet/public_test_cases/p02952/input.3.txt b/codenet/public_test_cases/p02952/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7296f257eb19026f79767a2458bdf63ff9c29e51 --- /dev/null +++ b/codenet/public_test_cases/p02952/input.3.txt @@ -0,0 +1 @@ +136 diff --git a/codenet/public_test_cases/p02952/output.0.txt b/codenet/public_test_cases/p02952/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02952/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02952/output.1.txt b/codenet/public_test_cases/p02952/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02952/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02952/output.2.txt b/codenet/public_test_cases/p02952/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a69c3b255c6e354ce1ef27327197495258311cd3 --- /dev/null +++ b/codenet/public_test_cases/p02952/output.2.txt @@ -0,0 +1 @@ +90909 diff --git a/codenet/public_test_cases/p02952/output.3.txt b/codenet/public_test_cases/p02952/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e5feb5256930f3cae636754eef8a244ede164eb --- /dev/null +++ b/codenet/public_test_cases/p02952/output.3.txt @@ -0,0 +1 @@ +46 diff --git a/codenet/public_test_cases/p02953/input.0.txt b/codenet/public_test_cases/p02953/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee2350d31ff0cff4b367c8b6abc5e66ce06d1e52 --- /dev/null +++ b/codenet/public_test_cases/p02953/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 1 1 3 diff --git a/codenet/public_test_cases/p02953/input.1.txt b/codenet/public_test_cases/p02953/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8faee6e444a239b1e46632078e2c9378479346c1 --- /dev/null +++ b/codenet/public_test_cases/p02953/input.1.txt @@ -0,0 +1,2 @@ +1 +1000000000 diff --git a/codenet/public_test_cases/p02953/input.2.txt b/codenet/public_test_cases/p02953/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a25459fc2e0af102d924738ea0a953ea3f0e22f9 --- /dev/null +++ b/codenet/public_test_cases/p02953/input.2.txt @@ -0,0 +1,2 @@ +4 +1 3 2 1 diff --git a/codenet/public_test_cases/p02953/input.3.txt b/codenet/public_test_cases/p02953/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p02953/input.3.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p02953/input.4.txt b/codenet/public_test_cases/p02953/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee2350d31ff0cff4b367c8b6abc5e66ce06d1e52 --- /dev/null +++ b/codenet/public_test_cases/p02953/input.4.txt @@ -0,0 +1,2 @@ +5 +1 2 1 1 3 diff --git a/codenet/public_test_cases/p02953/output.0.txt b/codenet/public_test_cases/p02953/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02953/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02953/output.1.txt b/codenet/public_test_cases/p02953/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02953/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02953/output.2.txt b/codenet/public_test_cases/p02953/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02953/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02953/output.3.txt b/codenet/public_test_cases/p02953/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02953/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02953/output.4.txt b/codenet/public_test_cases/p02953/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02953/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02954/input.0.txt b/codenet/public_test_cases/p02954/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c739d5d75c0ee634b549dcdb8bf5444a52c29e73 --- /dev/null +++ b/codenet/public_test_cases/p02954/input.0.txt @@ -0,0 +1 @@ +RRLRL diff --git a/codenet/public_test_cases/p02954/input.1.txt b/codenet/public_test_cases/p02954/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bda8a855cff4c4e8085f8990911999cf589adf5 --- /dev/null +++ b/codenet/public_test_cases/p02954/input.1.txt @@ -0,0 +1 @@ +RRLLLLRLRRLL diff --git a/codenet/public_test_cases/p02954/input.2.txt b/codenet/public_test_cases/p02954/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..83be6e8bd78e570d4e45e57d105a72f07b4d81ac --- /dev/null +++ b/codenet/public_test_cases/p02954/input.2.txt @@ -0,0 +1 @@ +RRRLLRLLRRRLLLLL diff --git a/codenet/public_test_cases/p02954/input.3.txt b/codenet/public_test_cases/p02954/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c739d5d75c0ee634b549dcdb8bf5444a52c29e73 --- /dev/null +++ b/codenet/public_test_cases/p02954/input.3.txt @@ -0,0 +1 @@ +RRLRL diff --git a/codenet/public_test_cases/p02954/output.0.txt b/codenet/public_test_cases/p02954/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d0c1642fa467cd5b53500c25c61511ae40ea3af --- /dev/null +++ b/codenet/public_test_cases/p02954/output.0.txt @@ -0,0 +1 @@ +0 1 2 1 1 diff --git a/codenet/public_test_cases/p02954/output.1.txt b/codenet/public_test_cases/p02954/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4437ab4f7b78a5ce56863f883e43c33718eb5af --- /dev/null +++ b/codenet/public_test_cases/p02954/output.1.txt @@ -0,0 +1 @@ +0 3 3 0 0 0 1 1 0 2 2 0 diff --git a/codenet/public_test_cases/p02954/output.2.txt b/codenet/public_test_cases/p02954/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6aa923cd1c7cfee75e921d3c994db85e538e32a5 --- /dev/null +++ b/codenet/public_test_cases/p02954/output.2.txt @@ -0,0 +1 @@ +0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0 diff --git a/codenet/public_test_cases/p02954/output.3.txt b/codenet/public_test_cases/p02954/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d0c1642fa467cd5b53500c25c61511ae40ea3af --- /dev/null +++ b/codenet/public_test_cases/p02954/output.3.txt @@ -0,0 +1 @@ +0 1 2 1 1 diff --git a/codenet/public_test_cases/p02955/input.0.txt b/codenet/public_test_cases/p02955/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..881f192061d51ce9e8935bc63de1f5b44a7bed18 --- /dev/null +++ b/codenet/public_test_cases/p02955/input.0.txt @@ -0,0 +1,2 @@ +2 3 +8 20 diff --git a/codenet/public_test_cases/p02955/input.1.txt b/codenet/public_test_cases/p02955/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bcc7b088085ebbcf7f54b3a3907b41127e4fd78 --- /dev/null +++ b/codenet/public_test_cases/p02955/input.1.txt @@ -0,0 +1,2 @@ +8 7 +1 7 5 6 8 2 6 5 diff --git a/codenet/public_test_cases/p02955/input.2.txt b/codenet/public_test_cases/p02955/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..46448584a757d718c9e0836373e2496f85abb741 --- /dev/null +++ b/codenet/public_test_cases/p02955/input.2.txt @@ -0,0 +1,2 @@ +2 10 +3 5 diff --git a/codenet/public_test_cases/p02955/input.3.txt b/codenet/public_test_cases/p02955/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..881f192061d51ce9e8935bc63de1f5b44a7bed18 --- /dev/null +++ b/codenet/public_test_cases/p02955/input.3.txt @@ -0,0 +1,2 @@ +2 3 +8 20 diff --git a/codenet/public_test_cases/p02955/input.4.txt b/codenet/public_test_cases/p02955/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..01048315a2ad8e042273bf90e9bd1409c856587f --- /dev/null +++ b/codenet/public_test_cases/p02955/input.4.txt @@ -0,0 +1,2 @@ +4 5 +10 1 2 22 diff --git a/codenet/public_test_cases/p02955/output.0.txt b/codenet/public_test_cases/p02955/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02955/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02955/output.1.txt b/codenet/public_test_cases/p02955/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02955/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02955/output.2.txt b/codenet/public_test_cases/p02955/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02955/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02955/output.3.txt b/codenet/public_test_cases/p02955/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02955/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02955/output.4.txt b/codenet/public_test_cases/p02955/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02955/output.4.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02956/input.0.txt b/codenet/public_test_cases/p02956/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08e9684260274c277e7d333cc778665147c3e880 --- /dev/null +++ b/codenet/public_test_cases/p02956/input.0.txt @@ -0,0 +1,4 @@ +3 +-1 3 +2 1 +3 -2 diff --git a/codenet/public_test_cases/p02956/input.1.txt b/codenet/public_test_cases/p02956/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08e9684260274c277e7d333cc778665147c3e880 --- /dev/null +++ b/codenet/public_test_cases/p02956/input.1.txt @@ -0,0 +1,4 @@ +3 +-1 3 +2 1 +3 -2 diff --git a/codenet/public_test_cases/p02956/input.2.txt b/codenet/public_test_cases/p02956/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..77a2369603a77baf0a20419be5051e31a29ae3e5 --- /dev/null +++ b/codenet/public_test_cases/p02956/input.2.txt @@ -0,0 +1,11 @@ +10 +19 -11 +-3 -12 +5 3 +3 -15 +8 -14 +-9 -20 +10 -9 +0 2 +-7 17 +6 -6 diff --git a/codenet/public_test_cases/p02956/input.3.txt b/codenet/public_test_cases/p02956/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..50f25e02a6904a39de0ad93222c510f93b582656 --- /dev/null +++ b/codenet/public_test_cases/p02956/input.3.txt @@ -0,0 +1,5 @@ +4 +1 4 +2 1 +3 3 +4 2 diff --git a/codenet/public_test_cases/p02956/output.0.txt b/codenet/public_test_cases/p02956/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02956/output.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02956/output.1.txt b/codenet/public_test_cases/p02956/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p02956/output.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p02956/output.2.txt b/codenet/public_test_cases/p02956/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ae19a1b29949253be0bbfcfc8bc5ffd908501f7 --- /dev/null +++ b/codenet/public_test_cases/p02956/output.2.txt @@ -0,0 +1 @@ +7222 diff --git a/codenet/public_test_cases/p02956/output.3.txt b/codenet/public_test_cases/p02956/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p02956/output.3.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p02957/input.0.txt b/codenet/public_test_cases/p02957/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ec49ebe9f5515dba17c808d9b91af0f209165a3 --- /dev/null +++ b/codenet/public_test_cases/p02957/input.0.txt @@ -0,0 +1 @@ +2 16 diff --git a/codenet/public_test_cases/p02957/input.1.txt b/codenet/public_test_cases/p02957/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf9767cc80ee543f2fa226b5d80185a2cf73ed75 --- /dev/null +++ b/codenet/public_test_cases/p02957/input.1.txt @@ -0,0 +1 @@ +998244353 99824435 diff --git a/codenet/public_test_cases/p02957/input.2.txt b/codenet/public_test_cases/p02957/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..65c9b94edf74d6d9deb325c42d8a874189c9f202 --- /dev/null +++ b/codenet/public_test_cases/p02957/input.2.txt @@ -0,0 +1 @@ +0 3 diff --git a/codenet/public_test_cases/p02957/input.3.txt b/codenet/public_test_cases/p02957/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ec49ebe9f5515dba17c808d9b91af0f209165a3 --- /dev/null +++ b/codenet/public_test_cases/p02957/input.3.txt @@ -0,0 +1 @@ +2 16 diff --git a/codenet/public_test_cases/p02957/output.0.txt b/codenet/public_test_cases/p02957/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02957/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02957/output.1.txt b/codenet/public_test_cases/p02957/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4b789d4791c5535d37ea76258a242475f0cd776 --- /dev/null +++ b/codenet/public_test_cases/p02957/output.1.txt @@ -0,0 +1 @@ +549034394 diff --git a/codenet/public_test_cases/p02957/output.2.txt b/codenet/public_test_cases/p02957/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p02957/output.2.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p02957/output.3.txt b/codenet/public_test_cases/p02957/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02957/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02958/input.0.txt b/codenet/public_test_cases/p02958/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be94e4904467751ef2c45cb4f80f856c70e7c099 --- /dev/null +++ b/codenet/public_test_cases/p02958/input.0.txt @@ -0,0 +1,2 @@ +5 +5 2 3 4 1 diff --git a/codenet/public_test_cases/p02958/input.1.txt b/codenet/public_test_cases/p02958/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..357cfe1f795f845bf78b71ad9fdb199f026cc60e --- /dev/null +++ b/codenet/public_test_cases/p02958/input.1.txt @@ -0,0 +1,2 @@ +5 +2 4 3 5 1 diff --git a/codenet/public_test_cases/p02958/input.2.txt b/codenet/public_test_cases/p02958/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1867bcc2bb2dbdce09956ca9bd917b085cfdda7b --- /dev/null +++ b/codenet/public_test_cases/p02958/input.2.txt @@ -0,0 +1,2 @@ +7 +1 2 3 4 5 6 7 diff --git a/codenet/public_test_cases/p02958/input.3.txt b/codenet/public_test_cases/p02958/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..be94e4904467751ef2c45cb4f80f856c70e7c099 --- /dev/null +++ b/codenet/public_test_cases/p02958/input.3.txt @@ -0,0 +1,2 @@ +5 +5 2 3 4 1 diff --git a/codenet/public_test_cases/p02958/output.0.txt b/codenet/public_test_cases/p02958/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p02958/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p02958/output.1.txt b/codenet/public_test_cases/p02958/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p02958/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p02958/output.2.txt b/codenet/public_test_cases/p02958/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p02958/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p02958/output.3.txt b/codenet/public_test_cases/p02958/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p02958/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p02959/input.0.txt b/codenet/public_test_cases/p02959/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9fd5c99953b21b82ffe1c90719e788a8d2072ab --- /dev/null +++ b/codenet/public_test_cases/p02959/input.0.txt @@ -0,0 +1,3 @@ +2 +3 5 2 +4 5 diff --git a/codenet/public_test_cases/p02959/input.1.txt b/codenet/public_test_cases/p02959/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee583d499df942baae43f0422192f4bee2f9935c --- /dev/null +++ b/codenet/public_test_cases/p02959/input.1.txt @@ -0,0 +1,3 @@ +3 +5 6 3 8 +5 100 8 diff --git a/codenet/public_test_cases/p02959/input.2.txt b/codenet/public_test_cases/p02959/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..451769752d64bce42c07155dd59884c1775bf7e0 --- /dev/null +++ b/codenet/public_test_cases/p02959/input.2.txt @@ -0,0 +1,3 @@ +2 +100 1 1 +1 100 diff --git a/codenet/public_test_cases/p02959/input.3.txt b/codenet/public_test_cases/p02959/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9fd5c99953b21b82ffe1c90719e788a8d2072ab --- /dev/null +++ b/codenet/public_test_cases/p02959/input.3.txt @@ -0,0 +1,3 @@ +2 +3 5 2 +4 5 diff --git a/codenet/public_test_cases/p02959/output.0.txt b/codenet/public_test_cases/p02959/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02959/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02959/output.1.txt b/codenet/public_test_cases/p02959/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p02959/output.1.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p02959/output.2.txt b/codenet/public_test_cases/p02959/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02959/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02959/output.3.txt b/codenet/public_test_cases/p02959/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p02959/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p02960/input.0.txt b/codenet/public_test_cases/p02960/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2956a0356303fecd38ec2e291db37620c142436 --- /dev/null +++ b/codenet/public_test_cases/p02960/input.0.txt @@ -0,0 +1 @@ +??2??5 diff --git a/codenet/public_test_cases/p02960/input.1.txt b/codenet/public_test_cases/p02960/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d44f0561c94593900260b358ce7c55b7e9d1855 --- /dev/null +++ b/codenet/public_test_cases/p02960/input.1.txt @@ -0,0 +1 @@ +7?4 diff --git a/codenet/public_test_cases/p02960/input.2.txt b/codenet/public_test_cases/p02960/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2956a0356303fecd38ec2e291db37620c142436 --- /dev/null +++ b/codenet/public_test_cases/p02960/input.2.txt @@ -0,0 +1 @@ +??2??5 diff --git a/codenet/public_test_cases/p02960/input.3.txt b/codenet/public_test_cases/p02960/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..611a2a3999869a9a386a0d4dd3add3981641cc38 --- /dev/null +++ b/codenet/public_test_cases/p02960/input.3.txt @@ -0,0 +1 @@ +?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76??? diff --git a/codenet/public_test_cases/p02960/input.4.txt b/codenet/public_test_cases/p02960/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2e475020e12431c0891195f1fba60645b8b69a3 --- /dev/null +++ b/codenet/public_test_cases/p02960/input.4.txt @@ -0,0 +1 @@ +?44 diff --git a/codenet/public_test_cases/p02960/output.0.txt b/codenet/public_test_cases/p02960/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc763b654ed0a41e0a856ff31ee0c0447d29dca4 --- /dev/null +++ b/codenet/public_test_cases/p02960/output.0.txt @@ -0,0 +1 @@ +768 diff --git a/codenet/public_test_cases/p02960/output.1.txt b/codenet/public_test_cases/p02960/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02960/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02960/output.2.txt b/codenet/public_test_cases/p02960/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc763b654ed0a41e0a856ff31ee0c0447d29dca4 --- /dev/null +++ b/codenet/public_test_cases/p02960/output.2.txt @@ -0,0 +1 @@ +768 diff --git a/codenet/public_test_cases/p02960/output.3.txt b/codenet/public_test_cases/p02960/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..82bdff1ed455a3716690516618f38df5f01b70b4 --- /dev/null +++ b/codenet/public_test_cases/p02960/output.3.txt @@ -0,0 +1 @@ +153716888 diff --git a/codenet/public_test_cases/p02960/output.4.txt b/codenet/public_test_cases/p02960/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02960/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02962/input.0.txt b/codenet/public_test_cases/p02962/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00e07fae87553e15e888c587877bc689fd5d4991 --- /dev/null +++ b/codenet/public_test_cases/p02962/input.0.txt @@ -0,0 +1,2 @@ +abcabab +ab diff --git a/codenet/public_test_cases/p02962/input.1.txt b/codenet/public_test_cases/p02962/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac70c93aec18338d399109066392f23b4f2700ae --- /dev/null +++ b/codenet/public_test_cases/p02962/input.1.txt @@ -0,0 +1,2 @@ +aa +aaaaaaa diff --git a/codenet/public_test_cases/p02962/input.2.txt b/codenet/public_test_cases/p02962/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a957f2802f2237c9b79370811abdc9bffa456ec2 --- /dev/null +++ b/codenet/public_test_cases/p02962/input.2.txt @@ -0,0 +1,2 @@ +aba +baaab diff --git a/codenet/public_test_cases/p02962/input.3.txt b/codenet/public_test_cases/p02962/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00e07fae87553e15e888c587877bc689fd5d4991 --- /dev/null +++ b/codenet/public_test_cases/p02962/input.3.txt @@ -0,0 +1,2 @@ +abcabab +ab diff --git a/codenet/public_test_cases/p02962/output.0.txt b/codenet/public_test_cases/p02962/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02962/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02962/output.1.txt b/codenet/public_test_cases/p02962/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02962/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02962/output.2.txt b/codenet/public_test_cases/p02962/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02962/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02962/output.3.txt b/codenet/public_test_cases/p02962/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02962/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02963/input.0.txt b/codenet/public_test_cases/p02963/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02963/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02963/input.1.txt b/codenet/public_test_cases/p02963/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p02963/input.1.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p02963/input.2.txt b/codenet/public_test_cases/p02963/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d3101890d2179ae82878597e13ec724677f1063 --- /dev/null +++ b/codenet/public_test_cases/p02963/input.2.txt @@ -0,0 +1 @@ +311114770564041497 diff --git a/codenet/public_test_cases/p02963/input.3.txt b/codenet/public_test_cases/p02963/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02963/input.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02963/output.0.txt b/codenet/public_test_cases/p02963/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..706287a5fadfc8005e572e6dd27589e52d4222ed --- /dev/null +++ b/codenet/public_test_cases/p02963/output.0.txt @@ -0,0 +1 @@ +1 0 2 2 0 1 diff --git a/codenet/public_test_cases/p02963/output.1.txt b/codenet/public_test_cases/p02963/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aae8f7c5b211a1a02fc21712237474b0645178a4 --- /dev/null +++ b/codenet/public_test_cases/p02963/output.1.txt @@ -0,0 +1 @@ +0 0 10 0 0 10 diff --git a/codenet/public_test_cases/p02963/output.2.txt b/codenet/public_test_cases/p02963/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bed34a5b9a9bda954a8ab5f7302fda3c32b58c51 --- /dev/null +++ b/codenet/public_test_cases/p02963/output.2.txt @@ -0,0 +1 @@ +314159265 358979323 846264338 327950288 419716939 937510582 diff --git a/codenet/public_test_cases/p02963/output.3.txt b/codenet/public_test_cases/p02963/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..706287a5fadfc8005e572e6dd27589e52d4222ed --- /dev/null +++ b/codenet/public_test_cases/p02963/output.3.txt @@ -0,0 +1 @@ +1 0 2 2 0 1 diff --git a/codenet/public_test_cases/p02964/input.0.txt b/codenet/public_test_cases/p02964/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9449aaf96205d69e1287aa4d54e666c05b1e25a1 --- /dev/null +++ b/codenet/public_test_cases/p02964/input.0.txt @@ -0,0 +1,2 @@ +3 2 +1 2 3 diff --git a/codenet/public_test_cases/p02964/input.1.txt b/codenet/public_test_cases/p02964/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6c5201213021e05ce3bdec91f24abbe4aedefe1 --- /dev/null +++ b/codenet/public_test_cases/p02964/input.1.txt @@ -0,0 +1,2 @@ +11 97 +3 1 4 1 5 9 2 6 5 3 5 diff --git a/codenet/public_test_cases/p02964/input.2.txt b/codenet/public_test_cases/p02964/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..336453338000ea49ff62305e75c2edbb3c97782f --- /dev/null +++ b/codenet/public_test_cases/p02964/input.2.txt @@ -0,0 +1,2 @@ +5 10 +1 2 3 2 3 diff --git a/codenet/public_test_cases/p02964/input.3.txt b/codenet/public_test_cases/p02964/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..68e2e35b8f2f1cb3275519a00c6091a14e0b37fc --- /dev/null +++ b/codenet/public_test_cases/p02964/input.3.txt @@ -0,0 +1,2 @@ +6 1000000000000 +1 1 2 2 3 3 diff --git a/codenet/public_test_cases/p02964/input.4.txt b/codenet/public_test_cases/p02964/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9449aaf96205d69e1287aa4d54e666c05b1e25a1 --- /dev/null +++ b/codenet/public_test_cases/p02964/input.4.txt @@ -0,0 +1,2 @@ +3 2 +1 2 3 diff --git a/codenet/public_test_cases/p02964/output.0.txt b/codenet/public_test_cases/p02964/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02964/output.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02964/output.1.txt b/codenet/public_test_cases/p02964/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5ab51e16b96f2680f7071b751735e7534f9aa1c --- /dev/null +++ b/codenet/public_test_cases/p02964/output.1.txt @@ -0,0 +1 @@ +9 2 6 diff --git a/codenet/public_test_cases/p02964/output.2.txt b/codenet/public_test_cases/p02964/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02964/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02964/output.3.txt b/codenet/public_test_cases/p02964/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02964/output.3.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02964/output.4.txt b/codenet/public_test_cases/p02964/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02964/output.4.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02965/input.0.txt b/codenet/public_test_cases/p02965/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p02965/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p02965/input.1.txt b/codenet/public_test_cases/p02965/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02965/input.1.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02965/input.2.txt b/codenet/public_test_cases/p02965/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9883ff3b05848d6fcf90358a9ec7d1638df9236f --- /dev/null +++ b/codenet/public_test_cases/p02965/input.2.txt @@ -0,0 +1 @@ +100000 50000 diff --git a/codenet/public_test_cases/p02965/input.3.txt b/codenet/public_test_cases/p02965/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6bc7799eba513be6b20846b727f864fb7acabcd --- /dev/null +++ b/codenet/public_test_cases/p02965/input.3.txt @@ -0,0 +1 @@ +10 10 diff --git a/codenet/public_test_cases/p02965/input.4.txt b/codenet/public_test_cases/p02965/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p02965/input.4.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p02965/output.0.txt b/codenet/public_test_cases/p02965/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02965/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02965/output.1.txt b/codenet/public_test_cases/p02965/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p02965/output.1.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p02965/output.2.txt b/codenet/public_test_cases/p02965/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cf00c7b9f355e72c1f62e6cc18b7280664203ab --- /dev/null +++ b/codenet/public_test_cases/p02965/output.2.txt @@ -0,0 +1 @@ +3463133 diff --git a/codenet/public_test_cases/p02965/output.3.txt b/codenet/public_test_cases/p02965/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fa69b7641caf41e71d0ce9d001e9ac2b0d3e81a --- /dev/null +++ b/codenet/public_test_cases/p02965/output.3.txt @@ -0,0 +1 @@ +211428932 diff --git a/codenet/public_test_cases/p02965/output.4.txt b/codenet/public_test_cases/p02965/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02965/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02966/input.0.txt b/codenet/public_test_cases/p02966/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c2cc60932882fdaffc1a6ab4bcbc6792a98a782 --- /dev/null +++ b/codenet/public_test_cases/p02966/input.0.txt @@ -0,0 +1,4 @@ +3 +2 1 +1 4 +3 3 diff --git a/codenet/public_test_cases/p02966/input.1.txt b/codenet/public_test_cases/p02966/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..170c93e8d3e978697d4ef3ef015dbab7e81366f3 --- /dev/null +++ b/codenet/public_test_cases/p02966/input.1.txt @@ -0,0 +1,5 @@ +4 +1 1 1 +1 1 1 +1 1 1 +1 1 1 diff --git a/codenet/public_test_cases/p02966/input.2.txt b/codenet/public_test_cases/p02966/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c2cc60932882fdaffc1a6ab4bcbc6792a98a782 --- /dev/null +++ b/codenet/public_test_cases/p02966/input.2.txt @@ -0,0 +1,4 @@ +3 +2 1 +1 4 +3 3 diff --git a/codenet/public_test_cases/p02966/input.3.txt b/codenet/public_test_cases/p02966/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f45f9d961ff87a83b8359a9c22a42c7d82ecaf6f --- /dev/null +++ b/codenet/public_test_cases/p02966/input.3.txt @@ -0,0 +1,11 @@ +10 +190587 2038070 142162180 88207341 215145790 38 2 5 20 +32047998 21426 4177178 52 734621629 2596 102224223 5 1864 +41 481241221 1518272 51 772 146 8805349 3243297 449 +918151 126080576 5186563 46354 6646 491776 5750138 2897 161 +3656 7551068 2919714 43035419 495 3408 26 3317 2698 +455357 3 12 1857 5459 7870 4123856 2402 258 +3 25700 16191 102120 971821039 52375 40449 20548149 16186673 +2 16 130300357 18 6574485 29175 179 1693 2681 +99 833 131 2 414045824 57357 56 302669472 95 +8408 7 1266941 60620177 129747 41382505 38966 187 5151064 diff --git a/codenet/public_test_cases/p02966/output.0.txt b/codenet/public_test_cases/p02966/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02966/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02966/output.1.txt b/codenet/public_test_cases/p02966/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02966/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02966/output.2.txt b/codenet/public_test_cases/p02966/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02966/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02966/output.3.txt b/codenet/public_test_cases/p02966/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..017c9e82791d0763bb3dfab257703434fbc502ec --- /dev/null +++ b/codenet/public_test_cases/p02966/output.3.txt @@ -0,0 +1 @@ +2280211 diff --git a/codenet/public_test_cases/p02967/input.0.txt b/codenet/public_test_cases/p02967/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2f94180dbeb2696d41a56dacb3c59cd7c344702 --- /dev/null +++ b/codenet/public_test_cases/p02967/input.0.txt @@ -0,0 +1 @@ +ABBCBCAB diff --git a/codenet/public_test_cases/p02967/input.1.txt b/codenet/public_test_cases/p02967/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e723c5b3a50a4be39ebda405bb7bec7d311a3487 --- /dev/null +++ b/codenet/public_test_cases/p02967/input.1.txt @@ -0,0 +1 @@ +ABABABABACACACAC diff --git a/codenet/public_test_cases/p02967/input.2.txt b/codenet/public_test_cases/p02967/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2f94180dbeb2696d41a56dacb3c59cd7c344702 --- /dev/null +++ b/codenet/public_test_cases/p02967/input.2.txt @@ -0,0 +1 @@ +ABBCBCAB diff --git a/codenet/public_test_cases/p02967/input.3.txt b/codenet/public_test_cases/p02967/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9780810a05270030d9ff66e8698f6f767461ee4f --- /dev/null +++ b/codenet/public_test_cases/p02967/input.3.txt @@ -0,0 +1 @@ +ABCABACBCBABABACBCBCBCBCBCAB diff --git a/codenet/public_test_cases/p02967/input.4.txt b/codenet/public_test_cases/p02967/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..43d5a8ed6ef6c00ff775008633f95787d088285d --- /dev/null +++ b/codenet/public_test_cases/p02967/input.4.txt @@ -0,0 +1 @@ +AAA diff --git a/codenet/public_test_cases/p02967/output.0.txt b/codenet/public_test_cases/p02967/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..03dadd7b431f9f607940d146b523dfb5d84d6f3d --- /dev/null +++ b/codenet/public_test_cases/p02967/output.0.txt @@ -0,0 +1 @@ +ACBCAB diff --git a/codenet/public_test_cases/p02967/output.1.txt b/codenet/public_test_cases/p02967/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9eace2730e30650383fdebf79377812e196a1ebd --- /dev/null +++ b/codenet/public_test_cases/p02967/output.1.txt @@ -0,0 +1 @@ +BABCAC diff --git a/codenet/public_test_cases/p02967/output.2.txt b/codenet/public_test_cases/p02967/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..03dadd7b431f9f607940d146b523dfb5d84d6f3d --- /dev/null +++ b/codenet/public_test_cases/p02967/output.2.txt @@ -0,0 +1 @@ +ACBCAB diff --git a/codenet/public_test_cases/p02967/output.3.txt b/codenet/public_test_cases/p02967/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2773b7d34c5f8e616f975989914a6a396585372c --- /dev/null +++ b/codenet/public_test_cases/p02967/output.3.txt @@ -0,0 +1 @@ +ACABACABABACBCBCBCBCA diff --git a/codenet/public_test_cases/p02967/output.4.txt b/codenet/public_test_cases/p02967/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p02967/output.4.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p02968/input.0.txt b/codenet/public_test_cases/p02968/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd977a1d53bc1506bc30ab6d858da4e6d725c307 --- /dev/null +++ b/codenet/public_test_cases/p02968/input.0.txt @@ -0,0 +1 @@ +2 998244353 diff --git a/codenet/public_test_cases/p02968/input.1.txt b/codenet/public_test_cases/p02968/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..33fd552d2f1ce1e75be76f3955ad25169d87e713 --- /dev/null +++ b/codenet/public_test_cases/p02968/input.1.txt @@ -0,0 +1 @@ +10 998244353 diff --git a/codenet/public_test_cases/p02968/input.2.txt b/codenet/public_test_cases/p02968/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd977a1d53bc1506bc30ab6d858da4e6d725c307 --- /dev/null +++ b/codenet/public_test_cases/p02968/input.2.txt @@ -0,0 +1 @@ +2 998244353 diff --git a/codenet/public_test_cases/p02968/input.3.txt b/codenet/public_test_cases/p02968/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f40113ffe59914555ec4423d0a4edb4bdff76989 --- /dev/null +++ b/codenet/public_test_cases/p02968/input.3.txt @@ -0,0 +1 @@ +200 998244353 diff --git a/codenet/public_test_cases/p02968/output.0.txt b/codenet/public_test_cases/p02968/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02968/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02968/output.1.txt b/codenet/public_test_cases/p02968/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ba882458f550d47d81de1b56ee7bac70a0c746b --- /dev/null +++ b/codenet/public_test_cases/p02968/output.1.txt @@ -0,0 +1 @@ +53999264 diff --git a/codenet/public_test_cases/p02968/output.2.txt b/codenet/public_test_cases/p02968/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02968/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02968/output.3.txt b/codenet/public_test_cases/p02968/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..96ae987365fb998d9dbdbfd2c9e27889f40b42ac --- /dev/null +++ b/codenet/public_test_cases/p02968/output.3.txt @@ -0,0 +1 @@ +112633322 diff --git a/codenet/public_test_cases/p02969/input.0.txt b/codenet/public_test_cases/p02969/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02969/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02969/input.1.txt b/codenet/public_test_cases/p02969/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02969/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02969/input.2.txt b/codenet/public_test_cases/p02969/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p02969/input.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p02969/input.3.txt b/codenet/public_test_cases/p02969/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p02969/input.3.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p02969/output.0.txt b/codenet/public_test_cases/p02969/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21e72e8ac3d7e23bd6532b5f1f4a6bdf8362e6cf --- /dev/null +++ b/codenet/public_test_cases/p02969/output.0.txt @@ -0,0 +1 @@ +48 diff --git a/codenet/public_test_cases/p02969/output.1.txt b/codenet/public_test_cases/p02969/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..21e72e8ac3d7e23bd6532b5f1f4a6bdf8362e6cf --- /dev/null +++ b/codenet/public_test_cases/p02969/output.1.txt @@ -0,0 +1 @@ +48 diff --git a/codenet/public_test_cases/p02969/output.2.txt b/codenet/public_test_cases/p02969/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5b667a16c49f6a1cd6228dbcfd9fceb40358ba4 --- /dev/null +++ b/codenet/public_test_cases/p02969/output.2.txt @@ -0,0 +1 @@ +675 diff --git a/codenet/public_test_cases/p02969/output.3.txt b/codenet/public_test_cases/p02969/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca5632cc10bfbffd86c943da866db98b4da97269 --- /dev/null +++ b/codenet/public_test_cases/p02969/output.3.txt @@ -0,0 +1 @@ +19200 diff --git a/codenet/public_test_cases/p02970/input.0.txt b/codenet/public_test_cases/p02970/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..edce53aaab07d1e84cae7cb3ada36005ca0e255f --- /dev/null +++ b/codenet/public_test_cases/p02970/input.0.txt @@ -0,0 +1 @@ +6 2 diff --git a/codenet/public_test_cases/p02970/input.1.txt b/codenet/public_test_cases/p02970/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5125487c8c7266376d97926ef7da7ad74c29f6de --- /dev/null +++ b/codenet/public_test_cases/p02970/input.1.txt @@ -0,0 +1 @@ +20 4 diff --git a/codenet/public_test_cases/p02970/input.2.txt b/codenet/public_test_cases/p02970/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8cfc358cbd67c190388a8978829c5192f602f6a --- /dev/null +++ b/codenet/public_test_cases/p02970/input.2.txt @@ -0,0 +1 @@ +14 3 diff --git a/codenet/public_test_cases/p02970/input.3.txt b/codenet/public_test_cases/p02970/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..edce53aaab07d1e84cae7cb3ada36005ca0e255f --- /dev/null +++ b/codenet/public_test_cases/p02970/input.3.txt @@ -0,0 +1 @@ +6 2 diff --git a/codenet/public_test_cases/p02970/output.0.txt b/codenet/public_test_cases/p02970/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02970/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02970/output.1.txt b/codenet/public_test_cases/p02970/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02970/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02970/output.2.txt b/codenet/public_test_cases/p02970/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02970/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02970/output.3.txt b/codenet/public_test_cases/p02970/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02970/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02971/input.0.txt b/codenet/public_test_cases/p02971/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f175ca084850746eb06699e3f0171c0d82d3622 --- /dev/null +++ b/codenet/public_test_cases/p02971/input.0.txt @@ -0,0 +1,4 @@ +3 +1 +4 +3 diff --git a/codenet/public_test_cases/p02971/input.1.txt b/codenet/public_test_cases/p02971/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..43ef02e3de6652847b39caafa66b03c7897b9e7a --- /dev/null +++ b/codenet/public_test_cases/p02971/input.1.txt @@ -0,0 +1,3 @@ +2 +5 +5 diff --git a/codenet/public_test_cases/p02971/input.2.txt b/codenet/public_test_cases/p02971/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f175ca084850746eb06699e3f0171c0d82d3622 --- /dev/null +++ b/codenet/public_test_cases/p02971/input.2.txt @@ -0,0 +1,4 @@ +3 +1 +4 +3 diff --git a/codenet/public_test_cases/p02971/output.0.txt b/codenet/public_test_cases/p02971/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..634c9ab0d87cd3be98dd77aafa6bc07f238340e0 --- /dev/null +++ b/codenet/public_test_cases/p02971/output.0.txt @@ -0,0 +1,3 @@ +4 +3 +4 diff --git a/codenet/public_test_cases/p02971/output.1.txt b/codenet/public_test_cases/p02971/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd3c81a4d763121f1827c8b4bbdd0cef674c30f9 --- /dev/null +++ b/codenet/public_test_cases/p02971/output.1.txt @@ -0,0 +1,2 @@ +5 +5 diff --git a/codenet/public_test_cases/p02971/output.2.txt b/codenet/public_test_cases/p02971/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..634c9ab0d87cd3be98dd77aafa6bc07f238340e0 --- /dev/null +++ b/codenet/public_test_cases/p02971/output.2.txt @@ -0,0 +1,3 @@ +4 +3 +4 diff --git a/codenet/public_test_cases/p02972/input.0.txt b/codenet/public_test_cases/p02972/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0182861e889d13c8dc23c98b8a78ccc741550894 --- /dev/null +++ b/codenet/public_test_cases/p02972/input.0.txt @@ -0,0 +1,2 @@ +3 +1 0 0 diff --git a/codenet/public_test_cases/p02972/input.1.txt b/codenet/public_test_cases/p02972/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b541ffb87392aae1f65a1d55b69720c286393883 --- /dev/null +++ b/codenet/public_test_cases/p02972/input.1.txt @@ -0,0 +1,2 @@ +5 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p02972/input.2.txt b/codenet/public_test_cases/p02972/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0182861e889d13c8dc23c98b8a78ccc741550894 --- /dev/null +++ b/codenet/public_test_cases/p02972/input.2.txt @@ -0,0 +1,2 @@ +3 +1 0 0 diff --git a/codenet/public_test_cases/p02972/output.0.txt b/codenet/public_test_cases/p02972/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p02972/output.0.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p02972/output.1.txt b/codenet/public_test_cases/p02972/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02972/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02972/output.2.txt b/codenet/public_test_cases/p02972/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p02972/output.2.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p02973/input.0.txt b/codenet/public_test_cases/p02973/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..13070f11190ab92a512e803d048ee2d318090926 --- /dev/null +++ b/codenet/public_test_cases/p02973/input.0.txt @@ -0,0 +1,6 @@ +5 +2 +1 +4 +5 +3 diff --git a/codenet/public_test_cases/p02973/input.1.txt b/codenet/public_test_cases/p02973/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b52b627805c6c5fe8c763170f22d11641af8c6c9 --- /dev/null +++ b/codenet/public_test_cases/p02973/input.1.txt @@ -0,0 +1,5 @@ +4 +0 +0 +0 +0 diff --git a/codenet/public_test_cases/p02973/input.2.txt b/codenet/public_test_cases/p02973/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..13070f11190ab92a512e803d048ee2d318090926 --- /dev/null +++ b/codenet/public_test_cases/p02973/input.2.txt @@ -0,0 +1,6 @@ +5 +2 +1 +4 +5 +3 diff --git a/codenet/public_test_cases/p02973/output.0.txt b/codenet/public_test_cases/p02973/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02973/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02973/output.1.txt b/codenet/public_test_cases/p02973/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p02973/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p02973/output.2.txt b/codenet/public_test_cases/p02973/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02973/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02974/input.0.txt b/codenet/public_test_cases/p02974/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02974/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02974/input.1.txt b/codenet/public_test_cases/p02974/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..68d8e3b5e8ffe4ca0c20f3b8d966d97ed3cfdb09 --- /dev/null +++ b/codenet/public_test_cases/p02974/input.1.txt @@ -0,0 +1 @@ +39 14 diff --git a/codenet/public_test_cases/p02974/input.2.txt b/codenet/public_test_cases/p02974/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02974/input.2.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02974/output.0.txt b/codenet/public_test_cases/p02974/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02974/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02974/output.1.txt b/codenet/public_test_cases/p02974/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4f2694d6ae077b9f467b2cbbe480035ac71444e --- /dev/null +++ b/codenet/public_test_cases/p02974/output.1.txt @@ -0,0 +1 @@ +74764168 diff --git a/codenet/public_test_cases/p02974/output.2.txt b/codenet/public_test_cases/p02974/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02974/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02975/input.0.txt b/codenet/public_test_cases/p02975/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02975/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02975/input.1.txt b/codenet/public_test_cases/p02975/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p02975/input.1.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p02975/input.2.txt b/codenet/public_test_cases/p02975/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcd4007f47f8446e2d03da988c565e8a99c2bd86 --- /dev/null +++ b/codenet/public_test_cases/p02975/input.2.txt @@ -0,0 +1,2 @@ +4 +1 2 4 8 diff --git a/codenet/public_test_cases/p02975/output.0.txt b/codenet/public_test_cases/p02975/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02975/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02975/output.1.txt b/codenet/public_test_cases/p02975/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02975/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02975/output.2.txt b/codenet/public_test_cases/p02975/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02975/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02976/input.0.txt b/codenet/public_test_cases/p02976/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e5b02d4ce0ae2d57ab906325e55bf8f13d9caca --- /dev/null +++ b/codenet/public_test_cases/p02976/input.0.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 3 +3 4 +4 1 diff --git a/codenet/public_test_cases/p02976/input.1.txt b/codenet/public_test_cases/p02976/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6685be15107c879bf3e4a65aa63726abbe9db0b --- /dev/null +++ b/codenet/public_test_cases/p02976/input.1.txt @@ -0,0 +1,6 @@ +5 5 +1 2 +2 3 +3 4 +2 5 +4 5 diff --git a/codenet/public_test_cases/p02976/input.2.txt b/codenet/public_test_cases/p02976/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e5b02d4ce0ae2d57ab906325e55bf8f13d9caca --- /dev/null +++ b/codenet/public_test_cases/p02976/input.2.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 3 +3 4 +4 1 diff --git a/codenet/public_test_cases/p02976/output.0.txt b/codenet/public_test_cases/p02976/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..47d5a464b321097d5d00e442de181834532d9bee --- /dev/null +++ b/codenet/public_test_cases/p02976/output.0.txt @@ -0,0 +1,4 @@ +1 2 +1 4 +3 2 +3 4 diff --git a/codenet/public_test_cases/p02976/output.1.txt b/codenet/public_test_cases/p02976/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02976/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02976/output.2.txt b/codenet/public_test_cases/p02976/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..47d5a464b321097d5d00e442de181834532d9bee --- /dev/null +++ b/codenet/public_test_cases/p02976/output.2.txt @@ -0,0 +1,4 @@ +1 2 +1 4 +3 2 +3 4 diff --git a/codenet/public_test_cases/p02977/input.0.txt b/codenet/public_test_cases/p02977/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02977/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02977/input.1.txt b/codenet/public_test_cases/p02977/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02977/input.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02977/input.2.txt b/codenet/public_test_cases/p02977/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p02977/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p02977/output.0.txt b/codenet/public_test_cases/p02977/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a768008b49e86f045dc2e66accb8edba284af82d --- /dev/null +++ b/codenet/public_test_cases/p02977/output.0.txt @@ -0,0 +1,6 @@ +Yes +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p02977/output.1.txt b/codenet/public_test_cases/p02977/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02977/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02977/output.2.txt b/codenet/public_test_cases/p02977/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a768008b49e86f045dc2e66accb8edba284af82d --- /dev/null +++ b/codenet/public_test_cases/p02977/output.2.txt @@ -0,0 +1,6 @@ +Yes +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p02978/input.0.txt b/codenet/public_test_cases/p02978/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..68987dd7c65edd294da8ba1f3ec99f9ebf42f8ef --- /dev/null +++ b/codenet/public_test_cases/p02978/input.0.txt @@ -0,0 +1,2 @@ +4 +3 1 4 2 diff --git a/codenet/public_test_cases/p02978/input.1.txt b/codenet/public_test_cases/p02978/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f63eb2bbdec3e47773eb4084d4df93d9305f9655 --- /dev/null +++ b/codenet/public_test_cases/p02978/input.1.txt @@ -0,0 +1,2 @@ +10 +3 1 4 1 5 9 2 6 5 3 diff --git a/codenet/public_test_cases/p02978/input.2.txt b/codenet/public_test_cases/p02978/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7507e71112066d3d939feef893cbd2c96c00183c --- /dev/null +++ b/codenet/public_test_cases/p02978/input.2.txt @@ -0,0 +1,2 @@ +6 +5 2 4 1 6 9 diff --git a/codenet/public_test_cases/p02978/input.3.txt b/codenet/public_test_cases/p02978/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..68987dd7c65edd294da8ba1f3ec99f9ebf42f8ef --- /dev/null +++ b/codenet/public_test_cases/p02978/input.3.txt @@ -0,0 +1,2 @@ +4 +3 1 4 2 diff --git a/codenet/public_test_cases/p02978/output.0.txt b/codenet/public_test_cases/p02978/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p02978/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p02978/output.1.txt b/codenet/public_test_cases/p02978/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee977b5ecd771ba136572d97b7457d6d2d2e4c0d --- /dev/null +++ b/codenet/public_test_cases/p02978/output.1.txt @@ -0,0 +1 @@ +115 diff --git a/codenet/public_test_cases/p02978/output.2.txt b/codenet/public_test_cases/p02978/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..82cced27d7be32719d009707139bd949ad6263c9 --- /dev/null +++ b/codenet/public_test_cases/p02978/output.2.txt @@ -0,0 +1 @@ +51 diff --git a/codenet/public_test_cases/p02978/output.3.txt b/codenet/public_test_cases/p02978/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p02978/output.3.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p02979/input.0.txt b/codenet/public_test_cases/p02979/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a84a607c7fdcd14b403a1574b0b3d51db8e44033 --- /dev/null +++ b/codenet/public_test_cases/p02979/input.0.txt @@ -0,0 +1 @@ +3 1 998244353 diff --git a/codenet/public_test_cases/p02979/input.1.txt b/codenet/public_test_cases/p02979/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee6ebc154b8328e47fe7ef45941d41cdeac00d69 --- /dev/null +++ b/codenet/public_test_cases/p02979/input.1.txt @@ -0,0 +1 @@ +17 7 208992811 diff --git a/codenet/public_test_cases/p02979/input.2.txt b/codenet/public_test_cases/p02979/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1588d460137e196b2681e760abbcaadc27eebd13 --- /dev/null +++ b/codenet/public_test_cases/p02979/input.2.txt @@ -0,0 +1 @@ +123 45 678901234 diff --git a/codenet/public_test_cases/p02979/input.3.txt b/codenet/public_test_cases/p02979/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e968624957e3025e1911dc1ad0bc64e2e8eddb3 --- /dev/null +++ b/codenet/public_test_cases/p02979/input.3.txt @@ -0,0 +1 @@ +9 4 702443618 diff --git a/codenet/public_test_cases/p02979/input.4.txt b/codenet/public_test_cases/p02979/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a84a607c7fdcd14b403a1574b0b3d51db8e44033 --- /dev/null +++ b/codenet/public_test_cases/p02979/input.4.txt @@ -0,0 +1 @@ +3 1 998244353 diff --git a/codenet/public_test_cases/p02979/input.5.txt b/codenet/public_test_cases/p02979/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..2feb7ab81899f8314f4a13a34f6db0ed95ab3f2d --- /dev/null +++ b/codenet/public_test_cases/p02979/input.5.txt @@ -0,0 +1 @@ +6 3 998244353 diff --git a/codenet/public_test_cases/p02979/output.0.txt b/codenet/public_test_cases/p02979/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02979/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02979/output.1.txt b/codenet/public_test_cases/p02979/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0da045df231b6b183ec5beb13493b7aba5ceb61 --- /dev/null +++ b/codenet/public_test_cases/p02979/output.1.txt @@ -0,0 +1 @@ +128832 diff --git a/codenet/public_test_cases/p02979/output.2.txt b/codenet/public_test_cases/p02979/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9048a3ece55c72be97d58e0f7b820c2e3f3fe41 --- /dev/null +++ b/codenet/public_test_cases/p02979/output.2.txt @@ -0,0 +1 @@ +256109226 diff --git a/codenet/public_test_cases/p02979/output.3.txt b/codenet/public_test_cases/p02979/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1e0432c9a7d553d7b06d64216b464bc80b234bc --- /dev/null +++ b/codenet/public_test_cases/p02979/output.3.txt @@ -0,0 +1 @@ +312 diff --git a/codenet/public_test_cases/p02979/output.4.txt b/codenet/public_test_cases/p02979/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02979/output.4.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02979/output.5.txt b/codenet/public_test_cases/p02979/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1e7d265fcc1d93320d7446fa1755892417f1f90 --- /dev/null +++ b/codenet/public_test_cases/p02979/output.5.txt @@ -0,0 +1 @@ +61 diff --git a/codenet/public_test_cases/p02980/input.0.txt b/codenet/public_test_cases/p02980/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p02980/input.0.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p02980/input.1.txt b/codenet/public_test_cases/p02980/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e9a360d9ec3f274b2491ac5a45d8095d9fc2d8b --- /dev/null +++ b/codenet/public_test_cases/p02980/input.1.txt @@ -0,0 +1 @@ +10 7 diff --git a/codenet/public_test_cases/p02980/input.2.txt b/codenet/public_test_cases/p02980/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p02980/input.2.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p02980/input.3.txt b/codenet/public_test_cases/p02980/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p02980/input.3.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p02980/input.4.txt b/codenet/public_test_cases/p02980/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8238c5f38ef0a08032556e77c8f41b909004c33d --- /dev/null +++ b/codenet/public_test_cases/p02980/input.4.txt @@ -0,0 +1 @@ +314159 265358 diff --git a/codenet/public_test_cases/p02980/output.0.txt b/codenet/public_test_cases/p02980/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02980/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02980/output.1.txt b/codenet/public_test_cases/p02980/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f031851bd0902b927adcb0f04025b1c7c2473dfa --- /dev/null +++ b/codenet/public_test_cases/p02980/output.1.txt @@ -0,0 +1 @@ +995651918 diff --git a/codenet/public_test_cases/p02980/output.2.txt b/codenet/public_test_cases/p02980/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b5813c6a7ebef887d9dc34812413e64603bc838 --- /dev/null +++ b/codenet/public_test_cases/p02980/output.2.txt @@ -0,0 +1 @@ +234 diff --git a/codenet/public_test_cases/p02980/output.3.txt b/codenet/public_test_cases/p02980/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02980/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02980/output.4.txt b/codenet/public_test_cases/p02980/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b06787975c198f306469272068399b9bee4743aa --- /dev/null +++ b/codenet/public_test_cases/p02980/output.4.txt @@ -0,0 +1 @@ +70273732 diff --git a/codenet/public_test_cases/p02981/input.0.txt b/codenet/public_test_cases/p02981/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef464f8f2f8b54b85b03d0159b05cd8c349075b5 --- /dev/null +++ b/codenet/public_test_cases/p02981/input.0.txt @@ -0,0 +1 @@ +4 2 9 diff --git a/codenet/public_test_cases/p02981/input.1.txt b/codenet/public_test_cases/p02981/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4f92d35ac7faefdab15269febcae78e04c34b77 --- /dev/null +++ b/codenet/public_test_cases/p02981/input.1.txt @@ -0,0 +1 @@ +4 2 7 diff --git a/codenet/public_test_cases/p02981/input.2.txt b/codenet/public_test_cases/p02981/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef464f8f2f8b54b85b03d0159b05cd8c349075b5 --- /dev/null +++ b/codenet/public_test_cases/p02981/input.2.txt @@ -0,0 +1 @@ +4 2 9 diff --git a/codenet/public_test_cases/p02981/input.3.txt b/codenet/public_test_cases/p02981/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccfd4f5fc496134ed6da2fb806e08f295b9b3d45 --- /dev/null +++ b/codenet/public_test_cases/p02981/input.3.txt @@ -0,0 +1 @@ +4 2 8 diff --git a/codenet/public_test_cases/p02981/output.0.txt b/codenet/public_test_cases/p02981/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02981/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02981/output.1.txt b/codenet/public_test_cases/p02981/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p02981/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p02981/output.2.txt b/codenet/public_test_cases/p02981/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02981/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02981/output.3.txt b/codenet/public_test_cases/p02981/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p02981/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p02982/input.0.txt b/codenet/public_test_cases/p02982/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2753316226bbc42611e2610d7159f62002f9c8f --- /dev/null +++ b/codenet/public_test_cases/p02982/input.0.txt @@ -0,0 +1,4 @@ +3 2 +1 2 +5 5 +-2 8 diff --git a/codenet/public_test_cases/p02982/input.1.txt b/codenet/public_test_cases/p02982/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9904a59b57730edb53428e21499fc6350e5dfcda --- /dev/null +++ b/codenet/public_test_cases/p02982/input.1.txt @@ -0,0 +1,4 @@ +3 4 +-3 7 8 2 +-12 1 10 2 +-2 8 9 3 diff --git a/codenet/public_test_cases/p02982/input.2.txt b/codenet/public_test_cases/p02982/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2753316226bbc42611e2610d7159f62002f9c8f --- /dev/null +++ b/codenet/public_test_cases/p02982/input.2.txt @@ -0,0 +1,4 @@ +3 2 +1 2 +5 5 +-2 8 diff --git a/codenet/public_test_cases/p02982/input.3.txt b/codenet/public_test_cases/p02982/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..83fc8665b74408d1b0a06296d048371d0ed0c27b --- /dev/null +++ b/codenet/public_test_cases/p02982/input.3.txt @@ -0,0 +1,6 @@ +5 1 +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p02982/output.0.txt b/codenet/public_test_cases/p02982/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02982/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02982/output.1.txt b/codenet/public_test_cases/p02982/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02982/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02982/output.2.txt b/codenet/public_test_cases/p02982/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02982/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02982/output.3.txt b/codenet/public_test_cases/p02982/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02982/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02983/input.0.txt b/codenet/public_test_cases/p02983/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecfc321db876c8660427a4232d0a6169686a0006 --- /dev/null +++ b/codenet/public_test_cases/p02983/input.0.txt @@ -0,0 +1 @@ +2020 2040 diff --git a/codenet/public_test_cases/p02983/input.1.txt b/codenet/public_test_cases/p02983/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a99162ed9cdd1b90006cbd4f07e2a2bd3f404d4 --- /dev/null +++ b/codenet/public_test_cases/p02983/input.1.txt @@ -0,0 +1 @@ +4 5 diff --git a/codenet/public_test_cases/p02983/input.2.txt b/codenet/public_test_cases/p02983/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecfc321db876c8660427a4232d0a6169686a0006 --- /dev/null +++ b/codenet/public_test_cases/p02983/input.2.txt @@ -0,0 +1 @@ +2020 2040 diff --git a/codenet/public_test_cases/p02983/output.0.txt b/codenet/public_test_cases/p02983/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02983/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02983/output.1.txt b/codenet/public_test_cases/p02983/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p02983/output.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p02983/output.2.txt b/codenet/public_test_cases/p02983/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02983/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02984/input.0.txt b/codenet/public_test_cases/p02984/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0c8f81bdb79301ef2824c994952cc382441c973 --- /dev/null +++ b/codenet/public_test_cases/p02984/input.0.txt @@ -0,0 +1,2 @@ +3 +2 2 4 diff --git a/codenet/public_test_cases/p02984/input.1.txt b/codenet/public_test_cases/p02984/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e00a3bee50d0a6f9f676e8ec071e6a64afdf7ba4 --- /dev/null +++ b/codenet/public_test_cases/p02984/input.1.txt @@ -0,0 +1,2 @@ +3 +1000000000 1000000000 0 diff --git a/codenet/public_test_cases/p02984/input.2.txt b/codenet/public_test_cases/p02984/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..af7fb4d7093ee4fef2598b68674b64bb640ebde9 --- /dev/null +++ b/codenet/public_test_cases/p02984/input.2.txt @@ -0,0 +1,2 @@ +5 +3 8 7 5 5 diff --git a/codenet/public_test_cases/p02984/input.3.txt b/codenet/public_test_cases/p02984/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0c8f81bdb79301ef2824c994952cc382441c973 --- /dev/null +++ b/codenet/public_test_cases/p02984/input.3.txt @@ -0,0 +1,2 @@ +3 +2 2 4 diff --git a/codenet/public_test_cases/p02984/output.0.txt b/codenet/public_test_cases/p02984/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6ebc1ec4bc3e9158aecaf9684b81e68cdc4c391 --- /dev/null +++ b/codenet/public_test_cases/p02984/output.0.txt @@ -0,0 +1 @@ +4 0 4 diff --git a/codenet/public_test_cases/p02984/output.1.txt b/codenet/public_test_cases/p02984/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b548488c83bf8e570123df9237d3085fada019ef --- /dev/null +++ b/codenet/public_test_cases/p02984/output.1.txt @@ -0,0 +1 @@ +0 2000000000 0 diff --git a/codenet/public_test_cases/p02984/output.2.txt b/codenet/public_test_cases/p02984/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa1bc6d7f5d60cb586ab989664edf17fac436c43 --- /dev/null +++ b/codenet/public_test_cases/p02984/output.2.txt @@ -0,0 +1 @@ +2 4 12 2 8 diff --git a/codenet/public_test_cases/p02984/output.3.txt b/codenet/public_test_cases/p02984/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6ebc1ec4bc3e9158aecaf9684b81e68cdc4c391 --- /dev/null +++ b/codenet/public_test_cases/p02984/output.3.txt @@ -0,0 +1 @@ +4 0 4 diff --git a/codenet/public_test_cases/p02986/input.0.txt b/codenet/public_test_cases/p02986/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a69d864959644d3b971e4e094f6af0261a810968 --- /dev/null +++ b/codenet/public_test_cases/p02986/input.0.txt @@ -0,0 +1,8 @@ +5 3 +1 2 1 10 +1 3 2 20 +2 4 4 30 +5 2 1 40 +1 100 1 4 +1 100 1 5 +3 1000 3 4 diff --git a/codenet/public_test_cases/p02986/input.1.txt b/codenet/public_test_cases/p02986/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a69d864959644d3b971e4e094f6af0261a810968 --- /dev/null +++ b/codenet/public_test_cases/p02986/input.1.txt @@ -0,0 +1,8 @@ +5 3 +1 2 1 10 +1 3 2 20 +2 4 4 30 +5 2 1 40 +1 100 1 4 +1 100 1 5 +3 1000 3 4 diff --git a/codenet/public_test_cases/p02986/output.0.txt b/codenet/public_test_cases/p02986/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b97e4a78ddaf847ea93668ea79ac4fb50f89bce --- /dev/null +++ b/codenet/public_test_cases/p02986/output.0.txt @@ -0,0 +1,3 @@ +130 +200 +60 diff --git a/codenet/public_test_cases/p02986/output.1.txt b/codenet/public_test_cases/p02986/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b97e4a78ddaf847ea93668ea79ac4fb50f89bce --- /dev/null +++ b/codenet/public_test_cases/p02986/output.1.txt @@ -0,0 +1,3 @@ +130 +200 +60 diff --git a/codenet/public_test_cases/p02987/input.0.txt b/codenet/public_test_cases/p02987/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4456e589e2b048f6cbffe702cd1f91d755fe3f6d --- /dev/null +++ b/codenet/public_test_cases/p02987/input.0.txt @@ -0,0 +1 @@ +ASSA diff --git a/codenet/public_test_cases/p02987/input.1.txt b/codenet/public_test_cases/p02987/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6fa5e893b4e9db21bd5d1e5c2abd6692cb47788 --- /dev/null +++ b/codenet/public_test_cases/p02987/input.1.txt @@ -0,0 +1 @@ +FFEE diff --git a/codenet/public_test_cases/p02987/input.2.txt b/codenet/public_test_cases/p02987/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..26a5d93719d72a16133cce6510d15a228b931f08 --- /dev/null +++ b/codenet/public_test_cases/p02987/input.2.txt @@ -0,0 +1 @@ +FREE diff --git a/codenet/public_test_cases/p02987/input.3.txt b/codenet/public_test_cases/p02987/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b13a38f4eb96d6e100eaa5400a1033827ec0a557 --- /dev/null +++ b/codenet/public_test_cases/p02987/input.3.txt @@ -0,0 +1 @@ +STOP diff --git a/codenet/public_test_cases/p02987/input.4.txt b/codenet/public_test_cases/p02987/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4456e589e2b048f6cbffe702cd1f91d755fe3f6d --- /dev/null +++ b/codenet/public_test_cases/p02987/input.4.txt @@ -0,0 +1 @@ +ASSA diff --git a/codenet/public_test_cases/p02987/output.0.txt b/codenet/public_test_cases/p02987/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02987/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02987/output.1.txt b/codenet/public_test_cases/p02987/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02987/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02987/output.2.txt b/codenet/public_test_cases/p02987/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02987/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02987/output.3.txt b/codenet/public_test_cases/p02987/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02987/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02987/output.4.txt b/codenet/public_test_cases/p02987/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02987/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02988/input.0.txt b/codenet/public_test_cases/p02988/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed129e88fdf9f75dae3811f00cb9c2736f1cb05e --- /dev/null +++ b/codenet/public_test_cases/p02988/input.0.txt @@ -0,0 +1,2 @@ +5 +1 3 5 4 2 diff --git a/codenet/public_test_cases/p02988/input.1.txt b/codenet/public_test_cases/p02988/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef3261668c3cd0b75b01aefb9f65166a8b79c1fe --- /dev/null +++ b/codenet/public_test_cases/p02988/input.1.txt @@ -0,0 +1,2 @@ +9 +9 6 3 2 5 8 7 4 1 diff --git a/codenet/public_test_cases/p02988/input.2.txt b/codenet/public_test_cases/p02988/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed129e88fdf9f75dae3811f00cb9c2736f1cb05e --- /dev/null +++ b/codenet/public_test_cases/p02988/input.2.txt @@ -0,0 +1,2 @@ +5 +1 3 5 4 2 diff --git a/codenet/public_test_cases/p02988/output.0.txt b/codenet/public_test_cases/p02988/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02988/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02988/output.1.txt b/codenet/public_test_cases/p02988/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02988/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02988/output.2.txt b/codenet/public_test_cases/p02988/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02988/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02989/input.0.txt b/codenet/public_test_cases/p02989/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..73d1847ae7b32fc4a8a062c098ed7d3c424d48ff --- /dev/null +++ b/codenet/public_test_cases/p02989/input.0.txt @@ -0,0 +1,2 @@ +6 +9 1 4 4 6 7 diff --git a/codenet/public_test_cases/p02989/input.1.txt b/codenet/public_test_cases/p02989/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7875e4cb6c207a83d9746ff885ccfdbfcdd853a5 --- /dev/null +++ b/codenet/public_test_cases/p02989/input.1.txt @@ -0,0 +1,2 @@ +8 +9 1 14 5 5 4 4 14 diff --git a/codenet/public_test_cases/p02989/input.2.txt b/codenet/public_test_cases/p02989/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..73d1847ae7b32fc4a8a062c098ed7d3c424d48ff --- /dev/null +++ b/codenet/public_test_cases/p02989/input.2.txt @@ -0,0 +1,2 @@ +6 +9 1 4 4 6 7 diff --git a/codenet/public_test_cases/p02989/input.3.txt b/codenet/public_test_cases/p02989/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef1a9e387d7c3ffc3f4e3c621028831339e3d3a0 --- /dev/null +++ b/codenet/public_test_cases/p02989/input.3.txt @@ -0,0 +1,2 @@ +14 +99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1 diff --git a/codenet/public_test_cases/p02989/output.0.txt b/codenet/public_test_cases/p02989/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02989/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02989/output.1.txt b/codenet/public_test_cases/p02989/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02989/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02989/output.2.txt b/codenet/public_test_cases/p02989/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02989/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02989/output.3.txt b/codenet/public_test_cases/p02989/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5004c4d28afca3fdb474c4085348de2054aaa98a --- /dev/null +++ b/codenet/public_test_cases/p02989/output.3.txt @@ -0,0 +1 @@ +42685 diff --git a/codenet/public_test_cases/p02990/input.0.txt b/codenet/public_test_cases/p02990/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p02990/input.0.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p02990/input.1.txt b/codenet/public_test_cases/p02990/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p02990/input.1.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p02990/input.2.txt b/codenet/public_test_cases/p02990/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d145d585987d0b53cb2f4b96e8d2dea560578da0 --- /dev/null +++ b/codenet/public_test_cases/p02990/input.2.txt @@ -0,0 +1 @@ +2000 3 diff --git a/codenet/public_test_cases/p02990/output.0.txt b/codenet/public_test_cases/p02990/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..38d6ec2d61307874433494dd1e74989ad1b9cf78 --- /dev/null +++ b/codenet/public_test_cases/p02990/output.0.txt @@ -0,0 +1,3 @@ +3 +6 +1 diff --git a/codenet/public_test_cases/p02990/output.1.txt b/codenet/public_test_cases/p02990/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38d6ec2d61307874433494dd1e74989ad1b9cf78 --- /dev/null +++ b/codenet/public_test_cases/p02990/output.1.txt @@ -0,0 +1,3 @@ +3 +6 +1 diff --git a/codenet/public_test_cases/p02990/output.2.txt b/codenet/public_test_cases/p02990/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..298b6da61fe2d75e34a44004808e2d1afb308455 --- /dev/null +++ b/codenet/public_test_cases/p02990/output.2.txt @@ -0,0 +1,3 @@ +1998 +3990006 +327341989 diff --git a/codenet/public_test_cases/p02991/input.0.txt b/codenet/public_test_cases/p02991/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdb72fd77b2ad8626fc7c6a36abe8d18812e6a89 --- /dev/null +++ b/codenet/public_test_cases/p02991/input.0.txt @@ -0,0 +1,6 @@ +4 4 +1 2 +2 3 +3 4 +4 1 +1 3 diff --git a/codenet/public_test_cases/p02991/input.1.txt b/codenet/public_test_cases/p02991/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdb72fd77b2ad8626fc7c6a36abe8d18812e6a89 --- /dev/null +++ b/codenet/public_test_cases/p02991/input.1.txt @@ -0,0 +1,6 @@ +4 4 +1 2 +2 3 +3 4 +4 1 +1 3 diff --git a/codenet/public_test_cases/p02991/input.2.txt b/codenet/public_test_cases/p02991/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..27c816be37e78e8eeed9845417b654005f7a311a --- /dev/null +++ b/codenet/public_test_cases/p02991/input.2.txt @@ -0,0 +1,10 @@ +6 8 +1 2 +2 3 +3 4 +4 5 +5 1 +1 4 +1 5 +4 6 +1 6 diff --git a/codenet/public_test_cases/p02991/input.3.txt b/codenet/public_test_cases/p02991/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..68d16c645851cf2a22799d7823a2b7464757b7af --- /dev/null +++ b/codenet/public_test_cases/p02991/input.3.txt @@ -0,0 +1,5 @@ +3 3 +1 2 +2 3 +3 1 +1 2 diff --git a/codenet/public_test_cases/p02991/input.4.txt b/codenet/public_test_cases/p02991/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e103273bbc4654f3a9eaa6e7ea117bdfbc9a20c1 --- /dev/null +++ b/codenet/public_test_cases/p02991/input.4.txt @@ -0,0 +1,2 @@ +2 0 +1 2 diff --git a/codenet/public_test_cases/p02991/output.0.txt b/codenet/public_test_cases/p02991/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02991/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02991/output.1.txt b/codenet/public_test_cases/p02991/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02991/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02991/output.2.txt b/codenet/public_test_cases/p02991/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02991/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02991/output.3.txt b/codenet/public_test_cases/p02991/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02991/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02991/output.4.txt b/codenet/public_test_cases/p02991/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p02991/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p02992/input.0.txt b/codenet/public_test_cases/p02992/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02992/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02992/input.1.txt b/codenet/public_test_cases/p02992/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..395f206dc64a1aafdbc3fcedb5780ce26c6c1784 --- /dev/null +++ b/codenet/public_test_cases/p02992/input.1.txt @@ -0,0 +1 @@ +10 3 diff --git a/codenet/public_test_cases/p02992/input.2.txt b/codenet/public_test_cases/p02992/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..92fb3e8f515e46ed92e0a78c9af086a00c6428a3 --- /dev/null +++ b/codenet/public_test_cases/p02992/input.2.txt @@ -0,0 +1 @@ +314159265 35 diff --git a/codenet/public_test_cases/p02992/input.3.txt b/codenet/public_test_cases/p02992/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p02992/input.3.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p02992/output.0.txt b/codenet/public_test_cases/p02992/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02992/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02992/output.1.txt b/codenet/public_test_cases/p02992/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c748b568f7661fed8665b73fb46a0492ea5eeebe --- /dev/null +++ b/codenet/public_test_cases/p02992/output.1.txt @@ -0,0 +1 @@ +147 diff --git a/codenet/public_test_cases/p02992/output.2.txt b/codenet/public_test_cases/p02992/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..908911661074bfa51a655fa4e1b7150a96649237 --- /dev/null +++ b/codenet/public_test_cases/p02992/output.2.txt @@ -0,0 +1 @@ +457397712 diff --git a/codenet/public_test_cases/p02992/output.3.txt b/codenet/public_test_cases/p02992/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p02992/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p02993/input.0.txt b/codenet/public_test_cases/p02993/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01ebb85361d037759607c3e36391e5778551b925 --- /dev/null +++ b/codenet/public_test_cases/p02993/input.0.txt @@ -0,0 +1 @@ +3776 diff --git a/codenet/public_test_cases/p02993/input.1.txt b/codenet/public_test_cases/p02993/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8735ed157e661a1f9ad281ec960ddf0aec64d292 --- /dev/null +++ b/codenet/public_test_cases/p02993/input.1.txt @@ -0,0 +1 @@ +1333 diff --git a/codenet/public_test_cases/p02993/input.2.txt b/codenet/public_test_cases/p02993/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfa435771ec74922b4cbefe3854d813206f8701 --- /dev/null +++ b/codenet/public_test_cases/p02993/input.2.txt @@ -0,0 +1 @@ +8080 diff --git a/codenet/public_test_cases/p02993/input.3.txt b/codenet/public_test_cases/p02993/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..01ebb85361d037759607c3e36391e5778551b925 --- /dev/null +++ b/codenet/public_test_cases/p02993/input.3.txt @@ -0,0 +1 @@ +3776 diff --git a/codenet/public_test_cases/p02993/input.4.txt b/codenet/public_test_cases/p02993/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a55ce18bd56e9e9f981a6af120046f87f15e678d --- /dev/null +++ b/codenet/public_test_cases/p02993/input.4.txt @@ -0,0 +1 @@ +0024 diff --git a/codenet/public_test_cases/p02993/output.0.txt b/codenet/public_test_cases/p02993/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6258a58f245ee89b99317dab51a766d81ea864ca --- /dev/null +++ b/codenet/public_test_cases/p02993/output.0.txt @@ -0,0 +1 @@ +Bad diff --git a/codenet/public_test_cases/p02993/output.1.txt b/codenet/public_test_cases/p02993/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6258a58f245ee89b99317dab51a766d81ea864ca --- /dev/null +++ b/codenet/public_test_cases/p02993/output.1.txt @@ -0,0 +1 @@ +Bad diff --git a/codenet/public_test_cases/p02993/output.2.txt b/codenet/public_test_cases/p02993/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd9dd73b78cf79e797c97b8fd5d8b92e28d4437f --- /dev/null +++ b/codenet/public_test_cases/p02993/output.2.txt @@ -0,0 +1 @@ +Good diff --git a/codenet/public_test_cases/p02993/output.3.txt b/codenet/public_test_cases/p02993/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6258a58f245ee89b99317dab51a766d81ea864ca --- /dev/null +++ b/codenet/public_test_cases/p02993/output.3.txt @@ -0,0 +1 @@ +Bad diff --git a/codenet/public_test_cases/p02993/output.4.txt b/codenet/public_test_cases/p02993/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6258a58f245ee89b99317dab51a766d81ea864ca --- /dev/null +++ b/codenet/public_test_cases/p02993/output.4.txt @@ -0,0 +1 @@ +Bad diff --git a/codenet/public_test_cases/p02994/input.0.txt b/codenet/public_test_cases/p02994/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p02994/input.0.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p02994/input.1.txt b/codenet/public_test_cases/p02994/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p02994/input.1.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p02994/input.2.txt b/codenet/public_test_cases/p02994/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..870867d64ba368051ee5607e0963eca94775b7c9 --- /dev/null +++ b/codenet/public_test_cases/p02994/input.2.txt @@ -0,0 +1 @@ +30 -50 diff --git a/codenet/public_test_cases/p02994/input.3.txt b/codenet/public_test_cases/p02994/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..786d61b8a9512231d67746a19a63f880f88d39ea --- /dev/null +++ b/codenet/public_test_cases/p02994/input.3.txt @@ -0,0 +1 @@ +3 -1 diff --git a/codenet/public_test_cases/p02994/output.0.txt b/codenet/public_test_cases/p02994/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p02994/output.0.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p02994/output.1.txt b/codenet/public_test_cases/p02994/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p02994/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p02994/output.2.txt b/codenet/public_test_cases/p02994/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5573cc81fdbda9d50cf992803f495a4c4b72bea9 --- /dev/null +++ b/codenet/public_test_cases/p02994/output.2.txt @@ -0,0 +1 @@ +-1044 diff --git a/codenet/public_test_cases/p02994/output.3.txt b/codenet/public_test_cases/p02994/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02994/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02995/input.0.txt b/codenet/public_test_cases/p02995/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30728f5a77234b3e3e99caa2fba917429194196e --- /dev/null +++ b/codenet/public_test_cases/p02995/input.0.txt @@ -0,0 +1 @@ +4 9 2 3 diff --git a/codenet/public_test_cases/p02995/input.1.txt b/codenet/public_test_cases/p02995/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..928bb022333b6a9d5150cf7f1a0d012f27ef8a9b --- /dev/null +++ b/codenet/public_test_cases/p02995/input.1.txt @@ -0,0 +1 @@ +314159265358979323 846264338327950288 419716939 937510582 diff --git a/codenet/public_test_cases/p02995/input.2.txt b/codenet/public_test_cases/p02995/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d21e3f96ccb42a6fbbf0b868822144daf0baa2 --- /dev/null +++ b/codenet/public_test_cases/p02995/input.2.txt @@ -0,0 +1 @@ +10 40 6 8 diff --git a/codenet/public_test_cases/p02995/input.3.txt b/codenet/public_test_cases/p02995/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..30728f5a77234b3e3e99caa2fba917429194196e --- /dev/null +++ b/codenet/public_test_cases/p02995/input.3.txt @@ -0,0 +1 @@ +4 9 2 3 diff --git a/codenet/public_test_cases/p02995/output.0.txt b/codenet/public_test_cases/p02995/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02995/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02995/output.1.txt b/codenet/public_test_cases/p02995/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..990f4db334e7a082cf88d4d3ba5b781e485943fc --- /dev/null +++ b/codenet/public_test_cases/p02995/output.1.txt @@ -0,0 +1 @@ +532105071133627368 diff --git a/codenet/public_test_cases/p02995/output.2.txt b/codenet/public_test_cases/p02995/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p02995/output.2.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p02995/output.3.txt b/codenet/public_test_cases/p02995/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p02995/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p02996/input.0.txt b/codenet/public_test_cases/p02996/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11676994f6424915e5c11afdab170eb81040e122 --- /dev/null +++ b/codenet/public_test_cases/p02996/input.0.txt @@ -0,0 +1,6 @@ +5 +2 4 +1 9 +1 8 +4 9 +3 12 diff --git a/codenet/public_test_cases/p02996/input.1.txt b/codenet/public_test_cases/p02996/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3d8efeb60fd02a01c3872da1267ab086ec24ce8 --- /dev/null +++ b/codenet/public_test_cases/p02996/input.1.txt @@ -0,0 +1,4 @@ +3 +334 1000 +334 1000 +334 1000 diff --git a/codenet/public_test_cases/p02996/input.2.txt b/codenet/public_test_cases/p02996/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..11676994f6424915e5c11afdab170eb81040e122 --- /dev/null +++ b/codenet/public_test_cases/p02996/input.2.txt @@ -0,0 +1,6 @@ +5 +2 4 +1 9 +1 8 +4 9 +3 12 diff --git a/codenet/public_test_cases/p02996/input.3.txt b/codenet/public_test_cases/p02996/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b93e6a3a2443d788c67c5e6e9d50fe4a4aed3142 --- /dev/null +++ b/codenet/public_test_cases/p02996/input.3.txt @@ -0,0 +1,31 @@ +30 +384 8895 +1725 9791 +170 1024 +4 11105 +2 6 +578 1815 +702 3352 +143 5141 +1420 6980 +24 1602 +849 999 +76 7586 +85 5570 +444 4991 +719 11090 +470 10708 +1137 4547 +455 9003 +110 9901 +15 8578 +368 3692 +104 1286 +3 4 +366 12143 +7 6649 +610 2374 +152 7324 +4 7042 +292 11386 +334 5720 diff --git a/codenet/public_test_cases/p02996/output.0.txt b/codenet/public_test_cases/p02996/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02996/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02996/output.1.txt b/codenet/public_test_cases/p02996/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p02996/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p02996/output.2.txt b/codenet/public_test_cases/p02996/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02996/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02996/output.3.txt b/codenet/public_test_cases/p02996/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p02996/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p02997/input.0.txt b/codenet/public_test_cases/p02997/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p02997/input.0.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p02997/output.0.txt b/codenet/public_test_cases/p02997/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8681cc275cc19cc89ff8b90ef9114c85d7bcb648 --- /dev/null +++ b/codenet/public_test_cases/p02997/output.0.txt @@ -0,0 +1,6 @@ +5 +4 3 +1 2 +3 1 +4 5 +2 3 diff --git a/codenet/public_test_cases/p02998/input.0.txt b/codenet/public_test_cases/p02998/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b06e0f809354baf3cd98e66971a0a1d483e2d28a --- /dev/null +++ b/codenet/public_test_cases/p02998/input.0.txt @@ -0,0 +1,4 @@ +3 +1 1 +5 1 +5 5 diff --git a/codenet/public_test_cases/p02998/input.1.txt b/codenet/public_test_cases/p02998/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b06e0f809354baf3cd98e66971a0a1d483e2d28a --- /dev/null +++ b/codenet/public_test_cases/p02998/input.1.txt @@ -0,0 +1,4 @@ +3 +1 1 +5 1 +5 5 diff --git a/codenet/public_test_cases/p02998/input.2.txt b/codenet/public_test_cases/p02998/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..03a9d12e4b72bb9b60ffb0e4c76777d320b23eda --- /dev/null +++ b/codenet/public_test_cases/p02998/input.2.txt @@ -0,0 +1,10 @@ +9 +1 1 +2 1 +3 1 +4 1 +5 1 +1 2 +1 3 +1 4 +1 5 diff --git a/codenet/public_test_cases/p02998/input.3.txt b/codenet/public_test_cases/p02998/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1798f57afe2ec408d1cf2edd1f11d22b08a5fcba --- /dev/null +++ b/codenet/public_test_cases/p02998/input.3.txt @@ -0,0 +1,3 @@ +2 +10 10 +20 20 diff --git a/codenet/public_test_cases/p02998/output.0.txt b/codenet/public_test_cases/p02998/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02998/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02998/output.1.txt b/codenet/public_test_cases/p02998/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p02998/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p02998/output.2.txt b/codenet/public_test_cases/p02998/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p02998/output.2.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p02998/output.3.txt b/codenet/public_test_cases/p02998/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02998/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02999/input.0.txt b/codenet/public_test_cases/p02999/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p02999/input.0.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p02999/input.1.txt b/codenet/public_test_cases/p02999/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..558161a5efe98affb4b85e05b11fb1e8eca52001 --- /dev/null +++ b/codenet/public_test_cases/p02999/input.1.txt @@ -0,0 +1 @@ +6 6 diff --git a/codenet/public_test_cases/p02999/input.2.txt b/codenet/public_test_cases/p02999/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5a3ec49418e6bf3b4c330fbd798b8077295142e --- /dev/null +++ b/codenet/public_test_cases/p02999/input.2.txt @@ -0,0 +1 @@ +7 5 diff --git a/codenet/public_test_cases/p02999/input.3.txt b/codenet/public_test_cases/p02999/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p02999/input.3.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p02999/output.0.txt b/codenet/public_test_cases/p02999/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02999/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p02999/output.1.txt b/codenet/public_test_cases/p02999/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02999/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02999/output.2.txt b/codenet/public_test_cases/p02999/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p02999/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p02999/output.3.txt b/codenet/public_test_cases/p02999/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p02999/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03000/input.0.txt b/codenet/public_test_cases/p03000/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da15edb504d2532c1759990e9ef9333395171627 --- /dev/null +++ b/codenet/public_test_cases/p03000/input.0.txt @@ -0,0 +1,2 @@ +3 6 +3 4 5 diff --git a/codenet/public_test_cases/p03000/input.1.txt b/codenet/public_test_cases/p03000/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eed51c3889caade3cffaae38838add2cd773902a --- /dev/null +++ b/codenet/public_test_cases/p03000/input.1.txt @@ -0,0 +1,2 @@ +4 9 +3 3 3 3 diff --git a/codenet/public_test_cases/p03000/input.2.txt b/codenet/public_test_cases/p03000/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..da15edb504d2532c1759990e9ef9333395171627 --- /dev/null +++ b/codenet/public_test_cases/p03000/input.2.txt @@ -0,0 +1,2 @@ +3 6 +3 4 5 diff --git a/codenet/public_test_cases/p03000/output.0.txt b/codenet/public_test_cases/p03000/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03000/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03000/output.1.txt b/codenet/public_test_cases/p03000/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03000/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03000/output.2.txt b/codenet/public_test_cases/p03000/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03000/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03001/input.0.txt b/codenet/public_test_cases/p03001/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5689590bbeb9cacb685f229bafdaaf1dd912ee85 --- /dev/null +++ b/codenet/public_test_cases/p03001/input.0.txt @@ -0,0 +1 @@ +2 3 1 2 diff --git a/codenet/public_test_cases/p03001/input.1.txt b/codenet/public_test_cases/p03001/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5689590bbeb9cacb685f229bafdaaf1dd912ee85 --- /dev/null +++ b/codenet/public_test_cases/p03001/input.1.txt @@ -0,0 +1 @@ +2 3 1 2 diff --git a/codenet/public_test_cases/p03001/input.2.txt b/codenet/public_test_cases/p03001/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c9db2e08c5aa8a1b16e3dde75556fffaa15cb30 --- /dev/null +++ b/codenet/public_test_cases/p03001/input.2.txt @@ -0,0 +1 @@ +2 2 1 1 diff --git a/codenet/public_test_cases/p03001/output.0.txt b/codenet/public_test_cases/p03001/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e7aa6879c819cfcb24df457a363091b263b93cb --- /dev/null +++ b/codenet/public_test_cases/p03001/output.0.txt @@ -0,0 +1 @@ +3.000000 0 diff --git a/codenet/public_test_cases/p03001/output.1.txt b/codenet/public_test_cases/p03001/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e7aa6879c819cfcb24df457a363091b263b93cb --- /dev/null +++ b/codenet/public_test_cases/p03001/output.1.txt @@ -0,0 +1 @@ +3.000000 0 diff --git a/codenet/public_test_cases/p03001/output.2.txt b/codenet/public_test_cases/p03001/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f25f7da23d0afe3cd8d4fd8465976e138d5f123 --- /dev/null +++ b/codenet/public_test_cases/p03001/output.2.txt @@ -0,0 +1 @@ +2.000000 1 diff --git a/codenet/public_test_cases/p03002/input.0.txt b/codenet/public_test_cases/p03002/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..785e667fbc3da4b1c332079a8e67dc0afa9c1018 --- /dev/null +++ b/codenet/public_test_cases/p03002/input.0.txt @@ -0,0 +1,2 @@ +4 10 +6 1 2 7 diff --git a/codenet/public_test_cases/p03002/output.0.txt b/codenet/public_test_cases/p03002/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03002/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03003/input.0.txt b/codenet/public_test_cases/p03003/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62600d5daa8daf4ac0cdc8b8f7c575d5267126e9 --- /dev/null +++ b/codenet/public_test_cases/p03003/input.0.txt @@ -0,0 +1,3 @@ +2 2 +1 3 +3 1 diff --git a/codenet/public_test_cases/p03003/input.1.txt b/codenet/public_test_cases/p03003/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d84b20ef44a463f8df03cf1dd477bdc65c895c16 --- /dev/null +++ b/codenet/public_test_cases/p03003/input.1.txt @@ -0,0 +1,3 @@ +10 9 +9 6 5 7 5 9 8 5 6 7 +8 6 8 5 5 7 9 9 7 diff --git a/codenet/public_test_cases/p03003/input.2.txt b/codenet/public_test_cases/p03003/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..247add9317ec1252d514eb88322a66f4ee9fdcb3 --- /dev/null +++ b/codenet/public_test_cases/p03003/input.2.txt @@ -0,0 +1,3 @@ +20 20 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 diff --git a/codenet/public_test_cases/p03003/input.3.txt b/codenet/public_test_cases/p03003/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9152a16c21e3e256af1d5e65b2d605cc87ac722a --- /dev/null +++ b/codenet/public_test_cases/p03003/input.3.txt @@ -0,0 +1,3 @@ +4 4 +3 4 5 6 +3 4 5 6 diff --git a/codenet/public_test_cases/p03003/input.4.txt b/codenet/public_test_cases/p03003/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..076a2f05d8b750cd8ecf1d28c94468bc5d31c163 --- /dev/null +++ b/codenet/public_test_cases/p03003/input.4.txt @@ -0,0 +1,3 @@ +2 2 +1 1 +1 1 diff --git a/codenet/public_test_cases/p03003/input.5.txt b/codenet/public_test_cases/p03003/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..62600d5daa8daf4ac0cdc8b8f7c575d5267126e9 --- /dev/null +++ b/codenet/public_test_cases/p03003/input.5.txt @@ -0,0 +1,3 @@ +2 2 +1 3 +3 1 diff --git a/codenet/public_test_cases/p03003/output.0.txt b/codenet/public_test_cases/p03003/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03003/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03003/output.1.txt b/codenet/public_test_cases/p03003/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..88b2e78342d56f05c2cf57c289329a19342fb5f9 --- /dev/null +++ b/codenet/public_test_cases/p03003/output.1.txt @@ -0,0 +1 @@ +191 diff --git a/codenet/public_test_cases/p03003/output.2.txt b/codenet/public_test_cases/p03003/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..916cb7e77e215ae8cf4e4519272d38c9735f8bf5 --- /dev/null +++ b/codenet/public_test_cases/p03003/output.2.txt @@ -0,0 +1 @@ +846527861 diff --git a/codenet/public_test_cases/p03003/output.3.txt b/codenet/public_test_cases/p03003/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03003/output.3.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03003/output.4.txt b/codenet/public_test_cases/p03003/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03003/output.4.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03003/output.5.txt b/codenet/public_test_cases/p03003/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03003/output.5.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03004/input.0.txt b/codenet/public_test_cases/p03004/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85628f830b4d336b0396d920abd4a08f7347003e --- /dev/null +++ b/codenet/public_test_cases/p03004/input.0.txt @@ -0,0 +1,3 @@ +2 +0 3 D +3 0 L diff --git a/codenet/public_test_cases/p03004/input.1.txt b/codenet/public_test_cases/p03004/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85628f830b4d336b0396d920abd4a08f7347003e --- /dev/null +++ b/codenet/public_test_cases/p03004/input.1.txt @@ -0,0 +1,3 @@ +2 +0 3 D +3 0 L diff --git a/codenet/public_test_cases/p03004/input.2.txt b/codenet/public_test_cases/p03004/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e78ad36e23e20f4c86ced3776c28ae386132a07c --- /dev/null +++ b/codenet/public_test_cases/p03004/input.2.txt @@ -0,0 +1,21 @@ +20 +6 -10 R +-4 -9 U +9 6 D +-3 -2 R +0 7 D +4 5 D +10 -10 U +-1 -8 U +10 -6 D +8 -5 U +6 4 D +0 3 D +7 9 R +9 -4 R +3 10 D +1 9 U +1 -6 U +9 -8 R +6 7 D +7 -3 D diff --git a/codenet/public_test_cases/p03004/input.3.txt b/codenet/public_test_cases/p03004/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3487a8a11f050525afd2e8ea3faf387ad6c4df04 --- /dev/null +++ b/codenet/public_test_cases/p03004/input.3.txt @@ -0,0 +1,6 @@ +5 +-7 -10 U +7 -6 U +-8 7 D +-3 3 D +0 -6 R diff --git a/codenet/public_test_cases/p03004/output.0.txt b/codenet/public_test_cases/p03004/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03004/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03004/output.1.txt b/codenet/public_test_cases/p03004/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03004/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03004/output.2.txt b/codenet/public_test_cases/p03004/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..305aa985702a5d9dee861080db95f95d82d43a8c --- /dev/null +++ b/codenet/public_test_cases/p03004/output.2.txt @@ -0,0 +1 @@ +273 diff --git a/codenet/public_test_cases/p03004/output.3.txt b/codenet/public_test_cases/p03004/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..faafaab8950b6d0395e7aa43bc594bb3f7a9cf07 --- /dev/null +++ b/codenet/public_test_cases/p03004/output.3.txt @@ -0,0 +1 @@ +97.5 diff --git a/codenet/public_test_cases/p03005/input.0.txt b/codenet/public_test_cases/p03005/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03005/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03005/input.1.txt b/codenet/public_test_cases/p03005/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfe1ce6be153750877a93771c2183ae2dd5cba83 --- /dev/null +++ b/codenet/public_test_cases/p03005/input.1.txt @@ -0,0 +1 @@ +8 5 diff --git a/codenet/public_test_cases/p03005/input.2.txt b/codenet/public_test_cases/p03005/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p03005/input.2.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p03005/input.3.txt b/codenet/public_test_cases/p03005/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03005/input.3.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03005/output.0.txt b/codenet/public_test_cases/p03005/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03005/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03005/output.1.txt b/codenet/public_test_cases/p03005/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03005/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03005/output.2.txt b/codenet/public_test_cases/p03005/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03005/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03005/output.3.txt b/codenet/public_test_cases/p03005/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03005/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03006/input.0.txt b/codenet/public_test_cases/p03006/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5464338616bfb7f9e7beae3b39041d7ec10aaff2 --- /dev/null +++ b/codenet/public_test_cases/p03006/input.0.txt @@ -0,0 +1,3 @@ +2 +1 1 +2 2 diff --git a/codenet/public_test_cases/p03006/input.1.txt b/codenet/public_test_cases/p03006/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b53fa94b17493abd5fb033e09227cd415607fd86 --- /dev/null +++ b/codenet/public_test_cases/p03006/input.1.txt @@ -0,0 +1,4 @@ +3 +1 4 +4 6 +7 8 diff --git a/codenet/public_test_cases/p03006/input.2.txt b/codenet/public_test_cases/p03006/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d313ca2564d8f20d0a454419ad7a1232d14448b --- /dev/null +++ b/codenet/public_test_cases/p03006/input.2.txt @@ -0,0 +1,5 @@ +4 +1 1 +1 2 +2 1 +2 2 diff --git a/codenet/public_test_cases/p03006/input.3.txt b/codenet/public_test_cases/p03006/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5464338616bfb7f9e7beae3b39041d7ec10aaff2 --- /dev/null +++ b/codenet/public_test_cases/p03006/input.3.txt @@ -0,0 +1,3 @@ +2 +1 1 +2 2 diff --git a/codenet/public_test_cases/p03006/output.0.txt b/codenet/public_test_cases/p03006/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03006/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03006/output.1.txt b/codenet/public_test_cases/p03006/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03006/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03006/output.2.txt b/codenet/public_test_cases/p03006/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03006/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03006/output.3.txt b/codenet/public_test_cases/p03006/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03006/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03007/input.0.txt b/codenet/public_test_cases/p03007/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9829c717ea531d7f041789e44718e440d0bf4792 --- /dev/null +++ b/codenet/public_test_cases/p03007/input.0.txt @@ -0,0 +1,2 @@ +3 +1 -1 2 diff --git a/codenet/public_test_cases/p03007/input.1.txt b/codenet/public_test_cases/p03007/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d86050b0e039e215b0da8a93663a9bb6efd092a --- /dev/null +++ b/codenet/public_test_cases/p03007/input.1.txt @@ -0,0 +1,2 @@ +3 +1 1 1 diff --git a/codenet/public_test_cases/p03007/input.2.txt b/codenet/public_test_cases/p03007/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9829c717ea531d7f041789e44718e440d0bf4792 --- /dev/null +++ b/codenet/public_test_cases/p03007/input.2.txt @@ -0,0 +1,2 @@ +3 +1 -1 2 diff --git a/codenet/public_test_cases/p03007/output.0.txt b/codenet/public_test_cases/p03007/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ea9491f9acbc4da9e569b0953cbfaf5ed8d28e9 --- /dev/null +++ b/codenet/public_test_cases/p03007/output.0.txt @@ -0,0 +1,3 @@ +4 +-1 1 +2 -2 diff --git a/codenet/public_test_cases/p03007/output.1.txt b/codenet/public_test_cases/p03007/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b6a62ea4669665cb8f5e813d3b455cd353d9565 --- /dev/null +++ b/codenet/public_test_cases/p03007/output.1.txt @@ -0,0 +1,3 @@ +1 +1 1 +1 0 diff --git a/codenet/public_test_cases/p03007/output.2.txt b/codenet/public_test_cases/p03007/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ea9491f9acbc4da9e569b0953cbfaf5ed8d28e9 --- /dev/null +++ b/codenet/public_test_cases/p03007/output.2.txt @@ -0,0 +1,3 @@ +4 +-1 1 +2 -2 diff --git a/codenet/public_test_cases/p03008/input.0.txt b/codenet/public_test_cases/p03008/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..24faa173e447f59559c1cc88011327d778448553 --- /dev/null +++ b/codenet/public_test_cases/p03008/input.0.txt @@ -0,0 +1,3 @@ +23 +1 1 1 +2 1 1 diff --git a/codenet/public_test_cases/p03008/input.1.txt b/codenet/public_test_cases/p03008/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..24faa173e447f59559c1cc88011327d778448553 --- /dev/null +++ b/codenet/public_test_cases/p03008/input.1.txt @@ -0,0 +1,3 @@ +23 +1 1 1 +2 1 1 diff --git a/codenet/public_test_cases/p03008/output.0.txt b/codenet/public_test_cases/p03008/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e5feb5256930f3cae636754eef8a244ede164eb --- /dev/null +++ b/codenet/public_test_cases/p03008/output.0.txt @@ -0,0 +1 @@ +46 diff --git a/codenet/public_test_cases/p03008/output.1.txt b/codenet/public_test_cases/p03008/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e5feb5256930f3cae636754eef8a244ede164eb --- /dev/null +++ b/codenet/public_test_cases/p03008/output.1.txt @@ -0,0 +1 @@ +46 diff --git a/codenet/public_test_cases/p03009/input.0.txt b/codenet/public_test_cases/p03009/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac06d91d8aecaaf1ed168da3b63333dfc2e26e6d --- /dev/null +++ b/codenet/public_test_cases/p03009/input.0.txt @@ -0,0 +1 @@ +2 2 1 diff --git a/codenet/public_test_cases/p03009/input.1.txt b/codenet/public_test_cases/p03009/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..26c924b325e18ee1d9ca500b649776dedc838501 --- /dev/null +++ b/codenet/public_test_cases/p03009/input.1.txt @@ -0,0 +1 @@ +31415 9265 3589 diff --git a/codenet/public_test_cases/p03009/input.2.txt b/codenet/public_test_cases/p03009/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6501800dcfa32cb153eda364254c2f9d392e0b8 --- /dev/null +++ b/codenet/public_test_cases/p03009/input.2.txt @@ -0,0 +1 @@ +2 30 15 diff --git a/codenet/public_test_cases/p03009/input.3.txt b/codenet/public_test_cases/p03009/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac06d91d8aecaaf1ed168da3b63333dfc2e26e6d --- /dev/null +++ b/codenet/public_test_cases/p03009/input.3.txt @@ -0,0 +1 @@ +2 2 1 diff --git a/codenet/public_test_cases/p03009/output.0.txt b/codenet/public_test_cases/p03009/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03009/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03009/output.1.txt b/codenet/public_test_cases/p03009/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..89a506597aae424842d464bdaed130c198eea859 --- /dev/null +++ b/codenet/public_test_cases/p03009/output.1.txt @@ -0,0 +1 @@ +312069529 diff --git a/codenet/public_test_cases/p03009/output.2.txt b/codenet/public_test_cases/p03009/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..59245defe7459a188a10b8238162967dd1bad1b2 --- /dev/null +++ b/codenet/public_test_cases/p03009/output.2.txt @@ -0,0 +1 @@ +94182806 diff --git a/codenet/public_test_cases/p03009/output.3.txt b/codenet/public_test_cases/p03009/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03009/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03010/input.0.txt b/codenet/public_test_cases/p03010/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03010/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03010/input.1.txt b/codenet/public_test_cases/p03010/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03010/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03010/input.2.txt b/codenet/public_test_cases/p03010/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03010/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03010/output.0.txt b/codenet/public_test_cases/p03010/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e1e9ce3c9a45b829ace59135aac613067304a8f --- /dev/null +++ b/codenet/public_test_cases/p03010/output.0.txt @@ -0,0 +1,3 @@ +0 6 15 +6 0 21 +15 21 0 diff --git a/codenet/public_test_cases/p03010/output.1.txt b/codenet/public_test_cases/p03010/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb7f65b1900ec6313b2895009c6f38f5fc9af036 --- /dev/null +++ b/codenet/public_test_cases/p03010/output.1.txt @@ -0,0 +1,4 @@ +0 111 157 193 +111 0 224 239 +157 224 0 258 +193 239 258 0 diff --git a/codenet/public_test_cases/p03010/output.2.txt b/codenet/public_test_cases/p03010/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e1e9ce3c9a45b829ace59135aac613067304a8f --- /dev/null +++ b/codenet/public_test_cases/p03010/output.2.txt @@ -0,0 +1,3 @@ +0 6 15 +6 0 21 +15 21 0 diff --git a/codenet/public_test_cases/p03011/input.0.txt b/codenet/public_test_cases/p03011/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..41023d1991080489ea84e78f3d3381ee728505b3 --- /dev/null +++ b/codenet/public_test_cases/p03011/input.0.txt @@ -0,0 +1 @@ +1 3 4 diff --git a/codenet/public_test_cases/p03011/input.1.txt b/codenet/public_test_cases/p03011/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7bb294ade13bb6a8850854adda1f4213b34a6a1 --- /dev/null +++ b/codenet/public_test_cases/p03011/input.1.txt @@ -0,0 +1 @@ +3 2 3 diff --git a/codenet/public_test_cases/p03011/input.2.txt b/codenet/public_test_cases/p03011/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..41023d1991080489ea84e78f3d3381ee728505b3 --- /dev/null +++ b/codenet/public_test_cases/p03011/input.2.txt @@ -0,0 +1 @@ +1 3 4 diff --git a/codenet/public_test_cases/p03011/output.0.txt b/codenet/public_test_cases/p03011/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03011/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03011/output.1.txt b/codenet/public_test_cases/p03011/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03011/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03011/output.2.txt b/codenet/public_test_cases/p03011/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03011/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03012/input.0.txt b/codenet/public_test_cases/p03012/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03012/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03012/input.1.txt b/codenet/public_test_cases/p03012/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03012/input.1.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03012/input.2.txt b/codenet/public_test_cases/p03012/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f32b5a57af7fbade48a5191b909e111c443312ba --- /dev/null +++ b/codenet/public_test_cases/p03012/input.2.txt @@ -0,0 +1,2 @@ +4 +1 3 1 1 diff --git a/codenet/public_test_cases/p03012/input.3.txt b/codenet/public_test_cases/p03012/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3df4aec3c03f30d6ee944e48c6fd52ba743f8c5 --- /dev/null +++ b/codenet/public_test_cases/p03012/input.3.txt @@ -0,0 +1,2 @@ +8 +27 23 76 2 3 5 62 52 diff --git a/codenet/public_test_cases/p03012/output.0.txt b/codenet/public_test_cases/p03012/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03012/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03012/output.1.txt b/codenet/public_test_cases/p03012/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03012/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03012/output.2.txt b/codenet/public_test_cases/p03012/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03012/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03012/output.3.txt b/codenet/public_test_cases/p03012/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03012/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03013/input.0.txt b/codenet/public_test_cases/p03013/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48993e5073a122e9709c06afade6bfc8e221b74a --- /dev/null +++ b/codenet/public_test_cases/p03013/input.0.txt @@ -0,0 +1,2 @@ +6 1 +3 diff --git a/codenet/public_test_cases/p03013/input.1.txt b/codenet/public_test_cases/p03013/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b5d04a7665a76a9a137ac8d26ccb10336de79aa --- /dev/null +++ b/codenet/public_test_cases/p03013/input.1.txt @@ -0,0 +1,6 @@ +100 5 +1 +23 +45 +67 +89 diff --git a/codenet/public_test_cases/p03013/input.2.txt b/codenet/public_test_cases/p03013/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4551d319cbaa81eb948a8e3e717c0caaba2a0df2 --- /dev/null +++ b/codenet/public_test_cases/p03013/input.2.txt @@ -0,0 +1,3 @@ +10 2 +4 +5 diff --git a/codenet/public_test_cases/p03013/input.3.txt b/codenet/public_test_cases/p03013/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48993e5073a122e9709c06afade6bfc8e221b74a --- /dev/null +++ b/codenet/public_test_cases/p03013/input.3.txt @@ -0,0 +1,2 @@ +6 1 +3 diff --git a/codenet/public_test_cases/p03013/output.0.txt b/codenet/public_test_cases/p03013/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03013/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03013/output.1.txt b/codenet/public_test_cases/p03013/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaa3600230706977e8fba11c3811922c07efd601 --- /dev/null +++ b/codenet/public_test_cases/p03013/output.1.txt @@ -0,0 +1 @@ +608200469 diff --git a/codenet/public_test_cases/p03013/output.2.txt b/codenet/public_test_cases/p03013/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03013/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03013/output.3.txt b/codenet/public_test_cases/p03013/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03013/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03014/input.0.txt b/codenet/public_test_cases/p03014/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..73e22fb3abcc2de11f031954acdbcc3a75c318c6 --- /dev/null +++ b/codenet/public_test_cases/p03014/input.0.txt @@ -0,0 +1,5 @@ +4 6 +#..#.. +.....# +....#. +#.#... diff --git a/codenet/public_test_cases/p03014/input.1.txt b/codenet/public_test_cases/p03014/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..73e22fb3abcc2de11f031954acdbcc3a75c318c6 --- /dev/null +++ b/codenet/public_test_cases/p03014/input.1.txt @@ -0,0 +1,5 @@ +4 6 +#..#.. +.....# +....#. +#.#... diff --git a/codenet/public_test_cases/p03014/input.2.txt b/codenet/public_test_cases/p03014/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3af9284b5ee3e2eb586ebe5cde0ae959bfcc6d47 --- /dev/null +++ b/codenet/public_test_cases/p03014/input.2.txt @@ -0,0 +1,5 @@ +4 6 +..#.. +.....# +....#. +.#... diff --git a/codenet/public_test_cases/p03014/input.3.txt b/codenet/public_test_cases/p03014/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ca2b2db2e7a01ba739956f214042eef7c4ddba6 --- /dev/null +++ b/codenet/public_test_cases/p03014/input.3.txt @@ -0,0 +1,9 @@ +8 8 +..#...#. +....#... +...... +..###..# +...#..#. +....#. +...#... +.#..# diff --git a/codenet/public_test_cases/p03014/output.0.txt b/codenet/public_test_cases/p03014/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03014/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03014/output.1.txt b/codenet/public_test_cases/p03014/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03014/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03014/output.2.txt b/codenet/public_test_cases/p03014/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03014/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03014/output.3.txt b/codenet/public_test_cases/p03014/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03014/output.3.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03016/input.0.txt b/codenet/public_test_cases/p03016/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..42e1211be8c7bd3439a130c9274f2271c642f472 --- /dev/null +++ b/codenet/public_test_cases/p03016/input.0.txt @@ -0,0 +1 @@ +5 3 4 10007 diff --git a/codenet/public_test_cases/p03016/input.1.txt b/codenet/public_test_cases/p03016/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..969f9fc503cdd8aece6b9b2c37594ae3d423c43e --- /dev/null +++ b/codenet/public_test_cases/p03016/input.1.txt @@ -0,0 +1 @@ +4 8 1 1000000 diff --git a/codenet/public_test_cases/p03016/input.2.txt b/codenet/public_test_cases/p03016/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cb7ba459ad4c1abae0515072550d652653283ab --- /dev/null +++ b/codenet/public_test_cases/p03016/input.2.txt @@ -0,0 +1 @@ +107 10000000000007 1000000000000007 998244353 diff --git a/codenet/public_test_cases/p03016/input.3.txt b/codenet/public_test_cases/p03016/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..42e1211be8c7bd3439a130c9274f2271c642f472 --- /dev/null +++ b/codenet/public_test_cases/p03016/input.3.txt @@ -0,0 +1 @@ +5 3 4 10007 diff --git a/codenet/public_test_cases/p03016/output.0.txt b/codenet/public_test_cases/p03016/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3e5209c963c2d08a6cc4a5f153b188bea525f44 --- /dev/null +++ b/codenet/public_test_cases/p03016/output.0.txt @@ -0,0 +1 @@ +5563 diff --git a/codenet/public_test_cases/p03016/output.1.txt b/codenet/public_test_cases/p03016/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebe706b71ae2d30a7c896f1f17a412e755b81d73 --- /dev/null +++ b/codenet/public_test_cases/p03016/output.1.txt @@ -0,0 +1 @@ +891011 diff --git a/codenet/public_test_cases/p03016/output.2.txt b/codenet/public_test_cases/p03016/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7e18ae289ff3a33754c0c7b6ee9af323f100edd --- /dev/null +++ b/codenet/public_test_cases/p03016/output.2.txt @@ -0,0 +1 @@ +39122908 diff --git a/codenet/public_test_cases/p03016/output.3.txt b/codenet/public_test_cases/p03016/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3e5209c963c2d08a6cc4a5f153b188bea525f44 --- /dev/null +++ b/codenet/public_test_cases/p03016/output.3.txt @@ -0,0 +1 @@ +5563 diff --git a/codenet/public_test_cases/p03017/input.0.txt b/codenet/public_test_cases/p03017/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..257cbaef65420a1899d8798f66a3d573ec86494a --- /dev/null +++ b/codenet/public_test_cases/p03017/input.0.txt @@ -0,0 +1,2 @@ +7 1 3 6 7 +.#..#.. diff --git a/codenet/public_test_cases/p03017/input.1.txt b/codenet/public_test_cases/p03017/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..603d6e47802fefea15c314c473b11785e901929c --- /dev/null +++ b/codenet/public_test_cases/p03017/input.1.txt @@ -0,0 +1,2 @@ +7 1 3 7 6 +.#..#.. diff --git a/codenet/public_test_cases/p03017/input.2.txt b/codenet/public_test_cases/p03017/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..257cbaef65420a1899d8798f66a3d573ec86494a --- /dev/null +++ b/codenet/public_test_cases/p03017/input.2.txt @@ -0,0 +1,2 @@ +7 1 3 6 7 +.#..#.. diff --git a/codenet/public_test_cases/p03017/input.3.txt b/codenet/public_test_cases/p03017/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaee3a1fd21142163649316bd1789d5b4e46852e --- /dev/null +++ b/codenet/public_test_cases/p03017/input.3.txt @@ -0,0 +1,2 @@ +15 1 3 15 13 +...#.#...#.#... diff --git a/codenet/public_test_cases/p03017/output.0.txt b/codenet/public_test_cases/p03017/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03017/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03017/output.1.txt b/codenet/public_test_cases/p03017/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03017/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03017/output.2.txt b/codenet/public_test_cases/p03017/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03017/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03017/output.3.txt b/codenet/public_test_cases/p03017/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03017/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03018/input.0.txt b/codenet/public_test_cases/p03018/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c92d9ab274ff9fb445da2457cf6d4d69da4180d --- /dev/null +++ b/codenet/public_test_cases/p03018/input.0.txt @@ -0,0 +1 @@ +ABCABC diff --git a/codenet/public_test_cases/p03018/input.1.txt b/codenet/public_test_cases/p03018/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98551653d3074b4dee471e394d4649fecf7357a4 --- /dev/null +++ b/codenet/public_test_cases/p03018/input.1.txt @@ -0,0 +1 @@ +ABCACCBABCBCAABCB diff --git a/codenet/public_test_cases/p03018/input.2.txt b/codenet/public_test_cases/p03018/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cc58df83752123644fef39faab2393af643b1d2 --- /dev/null +++ b/codenet/public_test_cases/p03018/input.2.txt @@ -0,0 +1 @@ +C diff --git a/codenet/public_test_cases/p03018/input.3.txt b/codenet/public_test_cases/p03018/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c92d9ab274ff9fb445da2457cf6d4d69da4180d --- /dev/null +++ b/codenet/public_test_cases/p03018/input.3.txt @@ -0,0 +1 @@ +ABCABC diff --git a/codenet/public_test_cases/p03018/output.0.txt b/codenet/public_test_cases/p03018/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03018/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03018/output.1.txt b/codenet/public_test_cases/p03018/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03018/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03018/output.2.txt b/codenet/public_test_cases/p03018/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03018/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03018/output.3.txt b/codenet/public_test_cases/p03018/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03018/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03019/input.0.txt b/codenet/public_test_cases/p03019/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90c06e660d92137285a60b3208200f76a97bd140 --- /dev/null +++ b/codenet/public_test_cases/p03019/input.0.txt @@ -0,0 +1,3 @@ +2 100 +85 2 3 +60 1 1 diff --git a/codenet/public_test_cases/p03019/input.1.txt b/codenet/public_test_cases/p03019/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..90c06e660d92137285a60b3208200f76a97bd140 --- /dev/null +++ b/codenet/public_test_cases/p03019/input.1.txt @@ -0,0 +1,3 @@ +2 100 +85 2 3 +60 1 1 diff --git a/codenet/public_test_cases/p03019/input.2.txt b/codenet/public_test_cases/p03019/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0daff4490fdce1f15db27d7c99b09e30ea13ddf7 --- /dev/null +++ b/codenet/public_test_cases/p03019/input.2.txt @@ -0,0 +1,11 @@ +10 1000 +451 4593 6263 +324 310 6991 +378 1431 7068 +71 1757 9218 +204 3676 4328 +840 6221 9080 +684 1545 8511 +709 5467 8674 +862 6504 9835 +283 4965 9980 diff --git a/codenet/public_test_cases/p03019/input.3.txt b/codenet/public_test_cases/p03019/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d176cc00dc35f1a24f81ad554882c0cee9313d5d --- /dev/null +++ b/codenet/public_test_cases/p03019/input.3.txt @@ -0,0 +1,3 @@ +2 100 +85 2 3 +60 10 10 diff --git a/codenet/public_test_cases/p03019/input.4.txt b/codenet/public_test_cases/p03019/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7cd0cbc6b6486ee8ebc6c0b45cb32b7feb188a1 --- /dev/null +++ b/codenet/public_test_cases/p03019/input.4.txt @@ -0,0 +1,2 @@ +1 100000 +31415 2718 2818 diff --git a/codenet/public_test_cases/p03019/output.0.txt b/codenet/public_test_cases/p03019/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee977b5ecd771ba136572d97b7457d6d2d2e4c0d --- /dev/null +++ b/codenet/public_test_cases/p03019/output.0.txt @@ -0,0 +1 @@ +115 diff --git a/codenet/public_test_cases/p03019/output.1.txt b/codenet/public_test_cases/p03019/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee977b5ecd771ba136572d97b7457d6d2d2e4c0d --- /dev/null +++ b/codenet/public_test_cases/p03019/output.1.txt @@ -0,0 +1 @@ +115 diff --git a/codenet/public_test_cases/p03019/output.2.txt b/codenet/public_test_cases/p03019/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..983711d6f2db911df8c65703989a914dedb3ea98 --- /dev/null +++ b/codenet/public_test_cases/p03019/output.2.txt @@ -0,0 +1 @@ +2540 diff --git a/codenet/public_test_cases/p03019/output.3.txt b/codenet/public_test_cases/p03019/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..987e7ca9a76df749c99da91a829e772e9aa622f6 --- /dev/null +++ b/codenet/public_test_cases/p03019/output.3.txt @@ -0,0 +1 @@ +77 diff --git a/codenet/public_test_cases/p03019/output.4.txt b/codenet/public_test_cases/p03019/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..72cf3f07b1e3da6df28d83f3a8f7716b25d69d4e --- /dev/null +++ b/codenet/public_test_cases/p03019/output.4.txt @@ -0,0 +1 @@ +31415 diff --git a/codenet/public_test_cases/p03020/input.0.txt b/codenet/public_test_cases/p03020/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..789827cadc5b4cc0db8f96ae6d344d7d711f474d --- /dev/null +++ b/codenet/public_test_cases/p03020/input.0.txt @@ -0,0 +1,5 @@ +2 +0 0 1 +3 2 1 +2 2 1 +5 0 1 diff --git a/codenet/public_test_cases/p03020/input.1.txt b/codenet/public_test_cases/p03020/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..069b416183c6f05e204ddaef5a09c021d17c0b12 --- /dev/null +++ b/codenet/public_test_cases/p03020/input.1.txt @@ -0,0 +1,7 @@ +3 +0 0 1 +2 2 1 +0 0 2 +1 1 1 +1 1 1 +3 3 2 diff --git a/codenet/public_test_cases/p03020/input.2.txt b/codenet/public_test_cases/p03020/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a780a3929c8c12e6d3e00304f4114a71c0ecc979 --- /dev/null +++ b/codenet/public_test_cases/p03020/input.2.txt @@ -0,0 +1,21 @@ +10 +582463373 690528069 8 +621230322 318051944 4 +356524296 974059503 6 +372751381 111542460 9 +392867214 581476334 6 +606955458 513028121 5 +882201596 791660614 9 +250465517 91918758 3 +618624774 406956634 6 +426294747 736401096 5 +974896051 888765942 5 +726682138 336960821 3 +715144179 82444709 6 +599055841 501257806 6 +390484433 962747856 4 +912334580 219343832 8 +570458984 648862300 6 +638017635 572157978 10 +435958984 585073520 7 +445612658 234265014 6 diff --git a/codenet/public_test_cases/p03020/input.3.txt b/codenet/public_test_cases/p03020/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..789827cadc5b4cc0db8f96ae6d344d7d711f474d --- /dev/null +++ b/codenet/public_test_cases/p03020/input.3.txt @@ -0,0 +1,5 @@ +2 +0 0 1 +3 2 1 +2 2 1 +5 0 1 diff --git a/codenet/public_test_cases/p03020/output.0.txt b/codenet/public_test_cases/p03020/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03020/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03020/output.1.txt b/codenet/public_test_cases/p03020/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03020/output.1.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03020/output.2.txt b/codenet/public_test_cases/p03020/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8535bc4d53c2a488de4c10b5841523f0fe1589f --- /dev/null +++ b/codenet/public_test_cases/p03020/output.2.txt @@ -0,0 +1 @@ +45152033546 diff --git a/codenet/public_test_cases/p03020/output.3.txt b/codenet/public_test_cases/p03020/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03020/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03021/input.0.txt b/codenet/public_test_cases/p03021/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9d17866c8b7d87e92339072a2bca17f3c676065 --- /dev/null +++ b/codenet/public_test_cases/p03021/input.0.txt @@ -0,0 +1,8 @@ +7 +0010101 +1 2 +2 3 +1 4 +4 5 +1 6 +6 7 diff --git a/codenet/public_test_cases/p03021/input.1.txt b/codenet/public_test_cases/p03021/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9d17866c8b7d87e92339072a2bca17f3c676065 --- /dev/null +++ b/codenet/public_test_cases/p03021/input.1.txt @@ -0,0 +1,8 @@ +7 +0010101 +1 2 +2 3 +1 4 +4 5 +1 6 +6 7 diff --git a/codenet/public_test_cases/p03021/input.2.txt b/codenet/public_test_cases/p03021/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d90f35cad49f7d1190cd6fd67747d151904f4acf --- /dev/null +++ b/codenet/public_test_cases/p03021/input.2.txt @@ -0,0 +1,8 @@ +7 +0010110 +1 2 +2 3 +1 4 +4 5 +1 6 +6 7 diff --git a/codenet/public_test_cases/p03021/input.3.txt b/codenet/public_test_cases/p03021/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabfe7b1913247d845153b7091df3df0c8bd08ae --- /dev/null +++ b/codenet/public_test_cases/p03021/input.3.txt @@ -0,0 +1,3 @@ +2 +01 +1 2 diff --git a/codenet/public_test_cases/p03021/output.0.txt b/codenet/public_test_cases/p03021/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03021/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03021/output.1.txt b/codenet/public_test_cases/p03021/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03021/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03021/output.2.txt b/codenet/public_test_cases/p03021/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03021/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03021/output.3.txt b/codenet/public_test_cases/p03021/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03021/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03022/input.0.txt b/codenet/public_test_cases/p03022/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9fc4e4fa016de0eb90971efab61914b663f4722 --- /dev/null +++ b/codenet/public_test_cases/p03022/input.0.txt @@ -0,0 +1,2 @@ +2 +1 1 1 1 diff --git a/codenet/public_test_cases/p03022/input.1.txt b/codenet/public_test_cases/p03022/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e96d581ff5c4aef3aeccea1660fdbba559271c4d --- /dev/null +++ b/codenet/public_test_cases/p03022/input.1.txt @@ -0,0 +1,2 @@ +4 +337 780 799 10 796 875 331 223 941 67 148 483 390 565 116 355 diff --git a/codenet/public_test_cases/p03022/input.2.txt b/codenet/public_test_cases/p03022/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9fc4e4fa016de0eb90971efab61914b663f4722 --- /dev/null +++ b/codenet/public_test_cases/p03022/input.2.txt @@ -0,0 +1,2 @@ +2 +1 1 1 1 diff --git a/codenet/public_test_cases/p03022/input.3.txt b/codenet/public_test_cases/p03022/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e0d3844d1e07c9d318581e2c05bc7729ef3926c --- /dev/null +++ b/codenet/public_test_cases/p03022/input.3.txt @@ -0,0 +1,2 @@ +2 +1 2 1 2 diff --git a/codenet/public_test_cases/p03022/output.0.txt b/codenet/public_test_cases/p03022/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aa2ea1acbd3a5ed741e1f25046be746dd5c4c0f --- /dev/null +++ b/codenet/public_test_cases/p03022/output.0.txt @@ -0,0 +1,4 @@ +0 +4 +4 +4 diff --git a/codenet/public_test_cases/p03022/output.1.txt b/codenet/public_test_cases/p03022/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09d4433262e1da801dc90fc08dbdc78859bfbe0c --- /dev/null +++ b/codenet/public_test_cases/p03022/output.1.txt @@ -0,0 +1,16 @@ +0 +468683018 +635850749 +96019779 +657074071 +24757563 +745107950 +665159588 +551278361 +143136064 +557841197 +185790407 +988018173 +247117461 +129098626 +789682908 diff --git a/codenet/public_test_cases/p03022/output.2.txt b/codenet/public_test_cases/p03022/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aa2ea1acbd3a5ed741e1f25046be746dd5c4c0f --- /dev/null +++ b/codenet/public_test_cases/p03022/output.2.txt @@ -0,0 +1,4 @@ +0 +4 +4 +4 diff --git a/codenet/public_test_cases/p03022/output.3.txt b/codenet/public_test_cases/p03022/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7aa32306f1a23c01ee9405591b83328f71039f28 --- /dev/null +++ b/codenet/public_test_cases/p03022/output.3.txt @@ -0,0 +1,4 @@ +0 +499122180 +4 +499122180 diff --git a/codenet/public_test_cases/p03023/input.0.txt b/codenet/public_test_cases/p03023/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03023/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03023/input.1.txt b/codenet/public_test_cases/p03023/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03023/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03023/input.2.txt b/codenet/public_test_cases/p03023/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03023/input.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03023/output.0.txt b/codenet/public_test_cases/p03023/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3af99eeec11bbfeb1fc5514129c2cd6e97503dbd --- /dev/null +++ b/codenet/public_test_cases/p03023/output.0.txt @@ -0,0 +1 @@ +180 diff --git a/codenet/public_test_cases/p03023/output.1.txt b/codenet/public_test_cases/p03023/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3af99eeec11bbfeb1fc5514129c2cd6e97503dbd --- /dev/null +++ b/codenet/public_test_cases/p03023/output.1.txt @@ -0,0 +1 @@ +180 diff --git a/codenet/public_test_cases/p03023/output.2.txt b/codenet/public_test_cases/p03023/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba91c32fd82036e2001815b3f9c9ce2a9dc01cc8 --- /dev/null +++ b/codenet/public_test_cases/p03023/output.2.txt @@ -0,0 +1 @@ +17640 diff --git a/codenet/public_test_cases/p03024/input.0.txt b/codenet/public_test_cases/p03024/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a336c4f816433e9bdf0ba7b568e69019dc242166 --- /dev/null +++ b/codenet/public_test_cases/p03024/input.0.txt @@ -0,0 +1 @@ +oxoxoxoxoxoxox diff --git a/codenet/public_test_cases/p03024/input.1.txt b/codenet/public_test_cases/p03024/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a336c4f816433e9bdf0ba7b568e69019dc242166 --- /dev/null +++ b/codenet/public_test_cases/p03024/input.1.txt @@ -0,0 +1 @@ +oxoxoxoxoxoxox diff --git a/codenet/public_test_cases/p03024/input.2.txt b/codenet/public_test_cases/p03024/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..42119b822347cc560fc2fc94bd1e9b5ccc959e74 --- /dev/null +++ b/codenet/public_test_cases/p03024/input.2.txt @@ -0,0 +1 @@ +xxxxxxxx diff --git a/codenet/public_test_cases/p03024/output.0.txt b/codenet/public_test_cases/p03024/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03024/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03024/output.1.txt b/codenet/public_test_cases/p03024/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03024/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03024/output.2.txt b/codenet/public_test_cases/p03024/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03024/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03025/input.0.txt b/codenet/public_test_cases/p03025/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8302e44e7afe50d7107c66c647fe966aa8ca49fe --- /dev/null +++ b/codenet/public_test_cases/p03025/input.0.txt @@ -0,0 +1 @@ +1 25 25 50 diff --git a/codenet/public_test_cases/p03025/input.1.txt b/codenet/public_test_cases/p03025/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e84b9762fd45754cd66e3136ce293b5df82d283 --- /dev/null +++ b/codenet/public_test_cases/p03025/input.1.txt @@ -0,0 +1 @@ +4 50 50 0 diff --git a/codenet/public_test_cases/p03025/input.2.txt b/codenet/public_test_cases/p03025/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8302e44e7afe50d7107c66c647fe966aa8ca49fe --- /dev/null +++ b/codenet/public_test_cases/p03025/input.2.txt @@ -0,0 +1 @@ +1 25 25 50 diff --git a/codenet/public_test_cases/p03025/input.3.txt b/codenet/public_test_cases/p03025/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb3a397fe23cd6620fd5ca99c4ba770b1a063dbd --- /dev/null +++ b/codenet/public_test_cases/p03025/input.3.txt @@ -0,0 +1 @@ +1 100 0 0 diff --git a/codenet/public_test_cases/p03025/input.4.txt b/codenet/public_test_cases/p03025/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5570f8d2036e2fd49125110fb72e18466895e1e7 --- /dev/null +++ b/codenet/public_test_cases/p03025/input.4.txt @@ -0,0 +1 @@ +100000 31 41 28 diff --git a/codenet/public_test_cases/p03025/output.0.txt b/codenet/public_test_cases/p03025/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03025/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03025/output.1.txt b/codenet/public_test_cases/p03025/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea08a37ed1c2a7366a6b78a8fe1ccf60323ed84b --- /dev/null +++ b/codenet/public_test_cases/p03025/output.1.txt @@ -0,0 +1 @@ +312500008 diff --git a/codenet/public_test_cases/p03025/output.2.txt b/codenet/public_test_cases/p03025/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03025/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03025/output.3.txt b/codenet/public_test_cases/p03025/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03025/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03025/output.4.txt b/codenet/public_test_cases/p03025/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..912e7bb2598a280ca71186767f99d3ece7e3b3f6 --- /dev/null +++ b/codenet/public_test_cases/p03025/output.4.txt @@ -0,0 +1 @@ +104136146 diff --git a/codenet/public_test_cases/p03026/input.0.txt b/codenet/public_test_cases/p03026/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4766b989869cd6931aba2f558be7564ee1fcf689 --- /dev/null +++ b/codenet/public_test_cases/p03026/input.0.txt @@ -0,0 +1,6 @@ +5 +1 2 +2 3 +3 4 +4 5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03026/input.1.txt b/codenet/public_test_cases/p03026/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cd868b2fd341e525c2cef150e41fb79e004ba92 --- /dev/null +++ b/codenet/public_test_cases/p03026/input.1.txt @@ -0,0 +1,6 @@ +5 +1 2 +1 3 +1 4 +1 5 +3141 59 26 53 59 diff --git a/codenet/public_test_cases/p03026/input.2.txt b/codenet/public_test_cases/p03026/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4766b989869cd6931aba2f558be7564ee1fcf689 --- /dev/null +++ b/codenet/public_test_cases/p03026/input.2.txt @@ -0,0 +1,6 @@ +5 +1 2 +2 3 +3 4 +4 5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03026/output.0.txt b/codenet/public_test_cases/p03026/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d499691c33650d06ee718c01a004c174ef1f42f --- /dev/null +++ b/codenet/public_test_cases/p03026/output.0.txt @@ -0,0 +1,2 @@ +10 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03026/output.1.txt b/codenet/public_test_cases/p03026/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e11b0dc470e7b4a8951aaaa5a499062573c7ec2 --- /dev/null +++ b/codenet/public_test_cases/p03026/output.1.txt @@ -0,0 +1,2 @@ +197 +59 26 3141 59 53 diff --git a/codenet/public_test_cases/p03026/output.2.txt b/codenet/public_test_cases/p03026/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d499691c33650d06ee718c01a004c174ef1f42f --- /dev/null +++ b/codenet/public_test_cases/p03026/output.2.txt @@ -0,0 +1,2 @@ +10 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03027/input.0.txt b/codenet/public_test_cases/p03027/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c34fef4d8478eadc01f87197b7b66b0d8c83602 --- /dev/null +++ b/codenet/public_test_cases/p03027/input.0.txt @@ -0,0 +1,3 @@ +2 +7 2 4 +12345 67890 2019 diff --git a/codenet/public_test_cases/p03027/input.1.txt b/codenet/public_test_cases/p03027/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c34fef4d8478eadc01f87197b7b66b0d8c83602 --- /dev/null +++ b/codenet/public_test_cases/p03027/input.1.txt @@ -0,0 +1,3 @@ +2 +7 2 4 +12345 67890 2019 diff --git a/codenet/public_test_cases/p03027/output.0.txt b/codenet/public_test_cases/p03027/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd166fb797faca1f239f84c2e09642b5d7b661f3 --- /dev/null +++ b/codenet/public_test_cases/p03027/output.0.txt @@ -0,0 +1,2 @@ +9009 +916936 diff --git a/codenet/public_test_cases/p03027/output.1.txt b/codenet/public_test_cases/p03027/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd166fb797faca1f239f84c2e09642b5d7b661f3 --- /dev/null +++ b/codenet/public_test_cases/p03027/output.1.txt @@ -0,0 +1,2 @@ +9009 +916936 diff --git a/codenet/public_test_cases/p03028/input.0.txt b/codenet/public_test_cases/p03028/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9524af46f93a3ede4bd47aa9025ecf1725b29c30 --- /dev/null +++ b/codenet/public_test_cases/p03028/input.0.txt @@ -0,0 +1,3 @@ +3 +0 +10 diff --git a/codenet/public_test_cases/p03028/input.1.txt b/codenet/public_test_cases/p03028/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b7c40bb33d1d035a71ba88da09289d8d5b5890e --- /dev/null +++ b/codenet/public_test_cases/p03028/input.1.txt @@ -0,0 +1,6 @@ +6 +0 +11 +111 +1111 +11001 diff --git a/codenet/public_test_cases/p03028/input.2.txt b/codenet/public_test_cases/p03028/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9524af46f93a3ede4bd47aa9025ecf1725b29c30 --- /dev/null +++ b/codenet/public_test_cases/p03028/input.2.txt @@ -0,0 +1,3 @@ +3 +0 +10 diff --git a/codenet/public_test_cases/p03028/output.0.txt b/codenet/public_test_cases/p03028/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03028/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03028/output.1.txt b/codenet/public_test_cases/p03028/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03028/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03028/output.2.txt b/codenet/public_test_cases/p03028/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03028/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03029/input.0.txt b/codenet/public_test_cases/p03029/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p03029/input.0.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p03029/input.1.txt b/codenet/public_test_cases/p03029/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p03029/input.1.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p03029/input.2.txt b/codenet/public_test_cases/p03029/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b72580e0aced9af0da0dbd13b80363195a4b8e7a --- /dev/null +++ b/codenet/public_test_cases/p03029/input.2.txt @@ -0,0 +1 @@ +32 21 diff --git a/codenet/public_test_cases/p03029/input.3.txt b/codenet/public_test_cases/p03029/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e8183b72e5ed9b26e9e2c64bb6bc849b23b0690 --- /dev/null +++ b/codenet/public_test_cases/p03029/input.3.txt @@ -0,0 +1 @@ +0 1 diff --git a/codenet/public_test_cases/p03029/output.0.txt b/codenet/public_test_cases/p03029/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03029/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03029/output.1.txt b/codenet/public_test_cases/p03029/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03029/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03029/output.2.txt b/codenet/public_test_cases/p03029/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c61d23e125b800e69cb950b09e23c06f728fff9 --- /dev/null +++ b/codenet/public_test_cases/p03029/output.2.txt @@ -0,0 +1 @@ +58 diff --git a/codenet/public_test_cases/p03029/output.3.txt b/codenet/public_test_cases/p03029/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03029/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03030/input.0.txt b/codenet/public_test_cases/p03030/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..34ba58afd92b9b8c81a2e842ad2a47960bebf201 --- /dev/null +++ b/codenet/public_test_cases/p03030/input.0.txt @@ -0,0 +1,7 @@ +6 +khabarovsk 20 +moscow 10 +kazan 50 +kazan 35 +moscow 60 +khabarovsk 40 diff --git a/codenet/public_test_cases/p03030/input.1.txt b/codenet/public_test_cases/p03030/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..34ba58afd92b9b8c81a2e842ad2a47960bebf201 --- /dev/null +++ b/codenet/public_test_cases/p03030/input.1.txt @@ -0,0 +1,7 @@ +6 +khabarovsk 20 +moscow 10 +kazan 50 +kazan 35 +moscow 60 +khabarovsk 40 diff --git a/codenet/public_test_cases/p03030/input.2.txt b/codenet/public_test_cases/p03030/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e4898347269c3bedf618fd17d354bf06eb3fdb3 --- /dev/null +++ b/codenet/public_test_cases/p03030/input.2.txt @@ -0,0 +1,11 @@ +10 +yakutsk 10 +yakutsk 20 +yakutsk 30 +yakutsk 40 +yakutsk 50 +yakutsk 60 +yakutsk 70 +yakutsk 80 +yakutsk 90 +yakutsk 100 diff --git a/codenet/public_test_cases/p03030/output.0.txt b/codenet/public_test_cases/p03030/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85b89b68b0d78a1dfa77d5bae829431a7b6a05f1 --- /dev/null +++ b/codenet/public_test_cases/p03030/output.0.txt @@ -0,0 +1,6 @@ +3 +4 +6 +1 +5 +2 diff --git a/codenet/public_test_cases/p03030/output.1.txt b/codenet/public_test_cases/p03030/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85b89b68b0d78a1dfa77d5bae829431a7b6a05f1 --- /dev/null +++ b/codenet/public_test_cases/p03030/output.1.txt @@ -0,0 +1,6 @@ +3 +4 +6 +1 +5 +2 diff --git a/codenet/public_test_cases/p03030/output.2.txt b/codenet/public_test_cases/p03030/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4c0c86b6fd53583791a06fd72c2e2c67e231bf9 --- /dev/null +++ b/codenet/public_test_cases/p03030/output.2.txt @@ -0,0 +1,10 @@ +10 +9 +8 +7 +6 +5 +4 +3 +2 +1 diff --git a/codenet/public_test_cases/p03031/input.0.txt b/codenet/public_test_cases/p03031/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..42a528f187c67edc2e558cb87a8dd4cccd914425 --- /dev/null +++ b/codenet/public_test_cases/p03031/input.0.txt @@ -0,0 +1,4 @@ +2 2 +2 1 2 +1 2 +0 1 diff --git a/codenet/public_test_cases/p03031/input.1.txt b/codenet/public_test_cases/p03031/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..42a528f187c67edc2e558cb87a8dd4cccd914425 --- /dev/null +++ b/codenet/public_test_cases/p03031/input.1.txt @@ -0,0 +1,4 @@ +2 2 +2 1 2 +1 2 +0 1 diff --git a/codenet/public_test_cases/p03031/input.2.txt b/codenet/public_test_cases/p03031/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..82be3d754951c5387c3b6127c13be55a4b3c7719 --- /dev/null +++ b/codenet/public_test_cases/p03031/input.2.txt @@ -0,0 +1,4 @@ +5 2 +3 1 2 5 +2 2 3 +1 0 diff --git a/codenet/public_test_cases/p03031/input.3.txt b/codenet/public_test_cases/p03031/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad0f3a2856132964644cf3dae2226f62a1dec4ce --- /dev/null +++ b/codenet/public_test_cases/p03031/input.3.txt @@ -0,0 +1,5 @@ +2 3 +2 1 2 +1 1 +1 2 +0 0 1 diff --git a/codenet/public_test_cases/p03031/output.0.txt b/codenet/public_test_cases/p03031/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03031/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03031/output.1.txt b/codenet/public_test_cases/p03031/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03031/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03031/output.2.txt b/codenet/public_test_cases/p03031/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03031/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03031/output.3.txt b/codenet/public_test_cases/p03031/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03031/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03032/input.0.txt b/codenet/public_test_cases/p03032/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e20c989d2f658a5bc41a14da6904d6336a49b44c --- /dev/null +++ b/codenet/public_test_cases/p03032/input.0.txt @@ -0,0 +1,2 @@ +6 4 +-10 8 2 1 2 6 diff --git a/codenet/public_test_cases/p03032/input.1.txt b/codenet/public_test_cases/p03032/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e20c989d2f658a5bc41a14da6904d6336a49b44c --- /dev/null +++ b/codenet/public_test_cases/p03032/input.1.txt @@ -0,0 +1,2 @@ +6 4 +-10 8 2 1 2 6 diff --git a/codenet/public_test_cases/p03032/input.2.txt b/codenet/public_test_cases/p03032/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff0abce3d4579bf5f2e98921b14ef7f5857cd217 --- /dev/null +++ b/codenet/public_test_cases/p03032/input.2.txt @@ -0,0 +1,2 @@ +6 4 +-6 -100 50 -2 -5 -3 diff --git a/codenet/public_test_cases/p03032/input.3.txt b/codenet/public_test_cases/p03032/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7002d3dd46386f0bd39359a8c5e687fdefc7d0e2 --- /dev/null +++ b/codenet/public_test_cases/p03032/input.3.txt @@ -0,0 +1,2 @@ +6 3 +-6 -100 50 -2 -5 -3 diff --git a/codenet/public_test_cases/p03032/output.0.txt b/codenet/public_test_cases/p03032/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03032/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03032/output.1.txt b/codenet/public_test_cases/p03032/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03032/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03032/output.2.txt b/codenet/public_test_cases/p03032/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c739b42c4d2ce23786c5350641d0adbf5fa7d6b2 --- /dev/null +++ b/codenet/public_test_cases/p03032/output.2.txt @@ -0,0 +1 @@ +44 diff --git a/codenet/public_test_cases/p03032/output.3.txt b/codenet/public_test_cases/p03032/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03032/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03033/input.0.txt b/codenet/public_test_cases/p03033/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfc4193d8686f16a3bbe7bb368c8d609be8567f1 --- /dev/null +++ b/codenet/public_test_cases/p03033/input.0.txt @@ -0,0 +1,11 @@ +4 6 +1 3 2 +7 13 10 +18 20 13 +3 4 2 +0 +1 +2 +3 +5 +8 diff --git a/codenet/public_test_cases/p03033/input.1.txt b/codenet/public_test_cases/p03033/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfc4193d8686f16a3bbe7bb368c8d609be8567f1 --- /dev/null +++ b/codenet/public_test_cases/p03033/input.1.txt @@ -0,0 +1,11 @@ +4 6 +1 3 2 +7 13 10 +18 20 13 +3 4 2 +0 +1 +2 +3 +5 +8 diff --git a/codenet/public_test_cases/p03033/output.0.txt b/codenet/public_test_cases/p03033/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a8a458a63d9d4a313baccce3636a600fc09fd27 --- /dev/null +++ b/codenet/public_test_cases/p03033/output.0.txt @@ -0,0 +1,6 @@ +2 +2 +10 +-1 +13 +-1 diff --git a/codenet/public_test_cases/p03033/output.1.txt b/codenet/public_test_cases/p03033/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a8a458a63d9d4a313baccce3636a600fc09fd27 --- /dev/null +++ b/codenet/public_test_cases/p03033/output.1.txt @@ -0,0 +1,6 @@ +2 +2 +10 +-1 +13 +-1 diff --git a/codenet/public_test_cases/p03034/input.0.txt b/codenet/public_test_cases/p03034/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2971986bf79a4bb054b681a9c9cc63f6df66b13e --- /dev/null +++ b/codenet/public_test_cases/p03034/input.0.txt @@ -0,0 +1,2 @@ +5 +0 2 5 1 0 diff --git a/codenet/public_test_cases/p03034/input.1.txt b/codenet/public_test_cases/p03034/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fbbd44152d1c46227731ea6350a1ef23c61eaaa --- /dev/null +++ b/codenet/public_test_cases/p03034/input.1.txt @@ -0,0 +1,2 @@ +6 +0 10 -7 -4 -13 0 diff --git a/codenet/public_test_cases/p03034/input.2.txt b/codenet/public_test_cases/p03034/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2971986bf79a4bb054b681a9c9cc63f6df66b13e --- /dev/null +++ b/codenet/public_test_cases/p03034/input.2.txt @@ -0,0 +1,2 @@ +5 +0 2 5 1 0 diff --git a/codenet/public_test_cases/p03034/input.3.txt b/codenet/public_test_cases/p03034/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec5248cca211e4bbc5a0bffeaaadaf30410ee667 --- /dev/null +++ b/codenet/public_test_cases/p03034/input.3.txt @@ -0,0 +1,2 @@ +11 +0 -4 0 -99 31 14 -15 -39 43 18 0 diff --git a/codenet/public_test_cases/p03034/output.0.txt b/codenet/public_test_cases/p03034/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03034/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03034/output.1.txt b/codenet/public_test_cases/p03034/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03034/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03034/output.2.txt b/codenet/public_test_cases/p03034/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03034/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03034/output.3.txt b/codenet/public_test_cases/p03034/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..04f9fe46068b397a6fc24d647b7e3ec4315c15e7 --- /dev/null +++ b/codenet/public_test_cases/p03034/output.3.txt @@ -0,0 +1 @@ +59 diff --git a/codenet/public_test_cases/p03035/input.0.txt b/codenet/public_test_cases/p03035/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a32305319648e445aa8a2abba6aa08e722ea0a22 --- /dev/null +++ b/codenet/public_test_cases/p03035/input.0.txt @@ -0,0 +1 @@ +30 100 diff --git a/codenet/public_test_cases/p03035/input.1.txt b/codenet/public_test_cases/p03035/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08cd8a9aca2ee1ec5f5f01c8e9500c60bcd7e308 --- /dev/null +++ b/codenet/public_test_cases/p03035/input.1.txt @@ -0,0 +1 @@ +0 100 diff --git a/codenet/public_test_cases/p03035/input.2.txt b/codenet/public_test_cases/p03035/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a32305319648e445aa8a2abba6aa08e722ea0a22 --- /dev/null +++ b/codenet/public_test_cases/p03035/input.2.txt @@ -0,0 +1 @@ +30 100 diff --git a/codenet/public_test_cases/p03035/input.3.txt b/codenet/public_test_cases/p03035/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..14667c8c86df8fd978c3132f5b85ec00383f8a8b --- /dev/null +++ b/codenet/public_test_cases/p03035/input.3.txt @@ -0,0 +1 @@ +12 100 diff --git a/codenet/public_test_cases/p03035/output.0.txt b/codenet/public_test_cases/p03035/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03035/output.0.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03035/output.1.txt b/codenet/public_test_cases/p03035/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03035/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03035/output.2.txt b/codenet/public_test_cases/p03035/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03035/output.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03035/output.3.txt b/codenet/public_test_cases/p03035/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p03035/output.3.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p03036/input.0.txt b/codenet/public_test_cases/p03036/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f916338b91913b11f689ff1966b6189f7cb3d94c --- /dev/null +++ b/codenet/public_test_cases/p03036/input.0.txt @@ -0,0 +1 @@ +2 10 20 diff --git a/codenet/public_test_cases/p03036/input.1.txt b/codenet/public_test_cases/p03036/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f916338b91913b11f689ff1966b6189f7cb3d94c --- /dev/null +++ b/codenet/public_test_cases/p03036/input.1.txt @@ -0,0 +1 @@ +2 10 20 diff --git a/codenet/public_test_cases/p03036/input.2.txt b/codenet/public_test_cases/p03036/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cce6494d7af8a0522ff3cd4f4f0028f4a2fc6a13 --- /dev/null +++ b/codenet/public_test_cases/p03036/input.2.txt @@ -0,0 +1 @@ +4 40 60 diff --git a/codenet/public_test_cases/p03036/output.0.txt b/codenet/public_test_cases/p03036/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a24cbe8eedab90ab6691310f573e582baf3d3d11 --- /dev/null +++ b/codenet/public_test_cases/p03036/output.0.txt @@ -0,0 +1,10 @@ +30 +50 +90 +170 +330 +650 +1290 +2570 +5130 +10250 diff --git a/codenet/public_test_cases/p03036/output.1.txt b/codenet/public_test_cases/p03036/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a24cbe8eedab90ab6691310f573e582baf3d3d11 --- /dev/null +++ b/codenet/public_test_cases/p03036/output.1.txt @@ -0,0 +1,10 @@ +30 +50 +90 +170 +330 +650 +1290 +2570 +5130 +10250 diff --git a/codenet/public_test_cases/p03036/output.2.txt b/codenet/public_test_cases/p03036/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..761abdd5395167393578c4db7f9f3d9ad9d5ed24 --- /dev/null +++ b/codenet/public_test_cases/p03036/output.2.txt @@ -0,0 +1,10 @@ +200 +760 +3000 +11960 +47800 +191160 +764600 +3058360 +12233400 +48933560 diff --git a/codenet/public_test_cases/p03037/input.0.txt b/codenet/public_test_cases/p03037/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..938abf4cc84ac0f75d8470678b365b734c5a9076 --- /dev/null +++ b/codenet/public_test_cases/p03037/input.0.txt @@ -0,0 +1,3 @@ +4 2 +1 3 +2 4 diff --git a/codenet/public_test_cases/p03037/input.1.txt b/codenet/public_test_cases/p03037/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9176afd91b4f6fe694759568f4f764f05aa88c29 --- /dev/null +++ b/codenet/public_test_cases/p03037/input.1.txt @@ -0,0 +1,2 @@ +100000 1 +1 100000 diff --git a/codenet/public_test_cases/p03037/input.2.txt b/codenet/public_test_cases/p03037/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..938abf4cc84ac0f75d8470678b365b734c5a9076 --- /dev/null +++ b/codenet/public_test_cases/p03037/input.2.txt @@ -0,0 +1,3 @@ +4 2 +1 3 +2 4 diff --git a/codenet/public_test_cases/p03037/input.3.txt b/codenet/public_test_cases/p03037/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3cf315f29710d81181866bc9d97912a36fa0d0b --- /dev/null +++ b/codenet/public_test_cases/p03037/input.3.txt @@ -0,0 +1,4 @@ +10 3 +3 6 +5 7 +6 9 diff --git a/codenet/public_test_cases/p03037/output.0.txt b/codenet/public_test_cases/p03037/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03037/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03037/output.1.txt b/codenet/public_test_cases/p03037/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7393e847d34d19031ee0ba57df63e4d0ccb4fb2 --- /dev/null +++ b/codenet/public_test_cases/p03037/output.1.txt @@ -0,0 +1 @@ +100000 diff --git a/codenet/public_test_cases/p03037/output.2.txt b/codenet/public_test_cases/p03037/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03037/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03037/output.3.txt b/codenet/public_test_cases/p03037/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03037/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03038/input.0.txt b/codenet/public_test_cases/p03038/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75cee51b4f0518bb4312d5f89933453a7fbf46dc --- /dev/null +++ b/codenet/public_test_cases/p03038/input.0.txt @@ -0,0 +1,4 @@ +3 2 +5 1 4 +2 3 +1 5 diff --git a/codenet/public_test_cases/p03038/input.1.txt b/codenet/public_test_cases/p03038/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a88b2a087654108dedf9a8f50b83c171aba52b95 --- /dev/null +++ b/codenet/public_test_cases/p03038/input.1.txt @@ -0,0 +1,5 @@ +10 3 +1 8 5 7 100 4 52 33 13 5 +3 10 +4 30 +1 4 diff --git a/codenet/public_test_cases/p03038/input.2.txt b/codenet/public_test_cases/p03038/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..75cee51b4f0518bb4312d5f89933453a7fbf46dc --- /dev/null +++ b/codenet/public_test_cases/p03038/input.2.txt @@ -0,0 +1,4 @@ +3 2 +5 1 4 +2 3 +1 5 diff --git a/codenet/public_test_cases/p03038/input.3.txt b/codenet/public_test_cases/p03038/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8001c38b0b6ae0346a3ca17b1b66d4ecce493aee --- /dev/null +++ b/codenet/public_test_cases/p03038/input.3.txt @@ -0,0 +1,4 @@ +3 2 +100 100 100 +3 99 +3 99 diff --git a/codenet/public_test_cases/p03038/input.4.txt b/codenet/public_test_cases/p03038/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..21dc5b34f54ad5645ffe551681c49c22a363ab8c --- /dev/null +++ b/codenet/public_test_cases/p03038/input.4.txt @@ -0,0 +1,5 @@ +11 3 +1 1 1 1 1 1 1 1 1 1 1 +3 1000000000 +4 1000000000 +3 1000000000 diff --git a/codenet/public_test_cases/p03038/output.0.txt b/codenet/public_test_cases/p03038/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03038/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03038/output.1.txt b/codenet/public_test_cases/p03038/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87537f4926d09d70aa77bba6525729da8852da57 --- /dev/null +++ b/codenet/public_test_cases/p03038/output.1.txt @@ -0,0 +1 @@ +338 diff --git a/codenet/public_test_cases/p03038/output.2.txt b/codenet/public_test_cases/p03038/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03038/output.2.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03038/output.3.txt b/codenet/public_test_cases/p03038/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..697cb3a26d77d1625ea445520e6e1e7bae966fe1 --- /dev/null +++ b/codenet/public_test_cases/p03038/output.3.txt @@ -0,0 +1 @@ +300 diff --git a/codenet/public_test_cases/p03038/output.4.txt b/codenet/public_test_cases/p03038/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cbc45860d56b67c3e706c6cb7d25fb57759d109 --- /dev/null +++ b/codenet/public_test_cases/p03038/output.4.txt @@ -0,0 +1 @@ +10000000001 diff --git a/codenet/public_test_cases/p03039/input.0.txt b/codenet/public_test_cases/p03039/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p03039/input.0.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p03039/input.1.txt b/codenet/public_test_cases/p03039/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p03039/input.1.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p03039/input.2.txt b/codenet/public_test_cases/p03039/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..37935e9784bc1cdc800342b0e030805e56939a25 --- /dev/null +++ b/codenet/public_test_cases/p03039/input.2.txt @@ -0,0 +1 @@ +100 100 5000 diff --git a/codenet/public_test_cases/p03039/input.3.txt b/codenet/public_test_cases/p03039/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0e3ad72a3c5aa053bec949230b5b0caa6a0db01 --- /dev/null +++ b/codenet/public_test_cases/p03039/input.3.txt @@ -0,0 +1 @@ +4 5 4 diff --git a/codenet/public_test_cases/p03039/output.0.txt b/codenet/public_test_cases/p03039/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03039/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03039/output.1.txt b/codenet/public_test_cases/p03039/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03039/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03039/output.2.txt b/codenet/public_test_cases/p03039/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5268f67ccd0ce74a800e811731fb25768158a715 --- /dev/null +++ b/codenet/public_test_cases/p03039/output.2.txt @@ -0,0 +1 @@ +817260251 diff --git a/codenet/public_test_cases/p03039/output.3.txt b/codenet/public_test_cases/p03039/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfae3e0ad8fd4ddd73e9de345cda367ed2cc6f3f --- /dev/null +++ b/codenet/public_test_cases/p03039/output.3.txt @@ -0,0 +1 @@ +87210 diff --git a/codenet/public_test_cases/p03040/input.0.txt b/codenet/public_test_cases/p03040/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8258ccd9f6ecf90e9e58b98e804f97fa7d8ef7d4 --- /dev/null +++ b/codenet/public_test_cases/p03040/input.0.txt @@ -0,0 +1,5 @@ +4 +1 4 2 +2 +1 1 -8 +2 diff --git a/codenet/public_test_cases/p03040/input.1.txt b/codenet/public_test_cases/p03040/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37af1e4f65e6921908e2feb100d686416b224ca9 --- /dev/null +++ b/codenet/public_test_cases/p03040/input.1.txt @@ -0,0 +1,5 @@ +4 +1 -1000000000 1000000000 +1 -1000000000 1000000000 +1 -1000000000 1000000000 +2 diff --git a/codenet/public_test_cases/p03040/input.2.txt b/codenet/public_test_cases/p03040/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8258ccd9f6ecf90e9e58b98e804f97fa7d8ef7d4 --- /dev/null +++ b/codenet/public_test_cases/p03040/input.2.txt @@ -0,0 +1,5 @@ +4 +1 4 2 +2 +1 1 -8 +2 diff --git a/codenet/public_test_cases/p03040/output.0.txt b/codenet/public_test_cases/p03040/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11d64d567e04238949c42d8b375a0609119475c3 --- /dev/null +++ b/codenet/public_test_cases/p03040/output.0.txt @@ -0,0 +1,2 @@ +4 2 +1 -3 diff --git a/codenet/public_test_cases/p03040/output.1.txt b/codenet/public_test_cases/p03040/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..998ba994e47d18f52afb87435639c653b154e83d --- /dev/null +++ b/codenet/public_test_cases/p03040/output.1.txt @@ -0,0 +1 @@ +-1000000000 3000000000 diff --git a/codenet/public_test_cases/p03040/output.2.txt b/codenet/public_test_cases/p03040/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..11d64d567e04238949c42d8b375a0609119475c3 --- /dev/null +++ b/codenet/public_test_cases/p03040/output.2.txt @@ -0,0 +1,2 @@ +4 2 +1 -3 diff --git a/codenet/public_test_cases/p03041/input.0.txt b/codenet/public_test_cases/p03041/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e30eb47149f88bb5505e044ff79f9b7e3821045e --- /dev/null +++ b/codenet/public_test_cases/p03041/input.0.txt @@ -0,0 +1,2 @@ +3 1 +ABC diff --git a/codenet/public_test_cases/p03041/input.1.txt b/codenet/public_test_cases/p03041/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1593bb602034386821f3d3b58e7f9b8f23e9baf7 --- /dev/null +++ b/codenet/public_test_cases/p03041/input.1.txt @@ -0,0 +1,2 @@ +4 3 +CABA diff --git a/codenet/public_test_cases/p03041/input.2.txt b/codenet/public_test_cases/p03041/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e30eb47149f88bb5505e044ff79f9b7e3821045e --- /dev/null +++ b/codenet/public_test_cases/p03041/input.2.txt @@ -0,0 +1,2 @@ +3 1 +ABC diff --git a/codenet/public_test_cases/p03041/output.0.txt b/codenet/public_test_cases/p03041/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc6b068e1c8226c1c2a5443c146c7edd7cddb6dc --- /dev/null +++ b/codenet/public_test_cases/p03041/output.0.txt @@ -0,0 +1 @@ +aBC diff --git a/codenet/public_test_cases/p03041/output.1.txt b/codenet/public_test_cases/p03041/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05578e4b9e5cc6beecd85880ce25b0fe27c2e3bd --- /dev/null +++ b/codenet/public_test_cases/p03041/output.1.txt @@ -0,0 +1 @@ +CAbA diff --git a/codenet/public_test_cases/p03041/output.2.txt b/codenet/public_test_cases/p03041/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc6b068e1c8226c1c2a5443c146c7edd7cddb6dc --- /dev/null +++ b/codenet/public_test_cases/p03041/output.2.txt @@ -0,0 +1 @@ +aBC diff --git a/codenet/public_test_cases/p03042/input.0.txt b/codenet/public_test_cases/p03042/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eec1f493a8c3fe911cdafb9c49e83cccddd4f3ef --- /dev/null +++ b/codenet/public_test_cases/p03042/input.0.txt @@ -0,0 +1 @@ +1905 diff --git a/codenet/public_test_cases/p03042/input.1.txt b/codenet/public_test_cases/p03042/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eec1f493a8c3fe911cdafb9c49e83cccddd4f3ef --- /dev/null +++ b/codenet/public_test_cases/p03042/input.1.txt @@ -0,0 +1 @@ +1905 diff --git a/codenet/public_test_cases/p03042/input.2.txt b/codenet/public_test_cases/p03042/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9eea8f079dcc914d9ddbaf169fc05433d03a862 --- /dev/null +++ b/codenet/public_test_cases/p03042/input.2.txt @@ -0,0 +1 @@ +1700 diff --git a/codenet/public_test_cases/p03042/input.3.txt b/codenet/public_test_cases/p03042/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9cf73487351860134cab09e972a795d629d1688 --- /dev/null +++ b/codenet/public_test_cases/p03042/input.3.txt @@ -0,0 +1 @@ +0112 diff --git a/codenet/public_test_cases/p03042/output.0.txt b/codenet/public_test_cases/p03042/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f5fc08b2a50ee09217b17bc985b4b638508f4ee --- /dev/null +++ b/codenet/public_test_cases/p03042/output.0.txt @@ -0,0 +1 @@ +YYMM diff --git a/codenet/public_test_cases/p03042/output.1.txt b/codenet/public_test_cases/p03042/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f5fc08b2a50ee09217b17bc985b4b638508f4ee --- /dev/null +++ b/codenet/public_test_cases/p03042/output.1.txt @@ -0,0 +1 @@ +YYMM diff --git a/codenet/public_test_cases/p03042/output.2.txt b/codenet/public_test_cases/p03042/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..69fc4ef2be0c2550c183850902cb55dbf3d37b30 --- /dev/null +++ b/codenet/public_test_cases/p03042/output.2.txt @@ -0,0 +1 @@ +NA diff --git a/codenet/public_test_cases/p03042/output.3.txt b/codenet/public_test_cases/p03042/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a5da5f6d4419ff51fad66eae4820376e081b4eb --- /dev/null +++ b/codenet/public_test_cases/p03042/output.3.txt @@ -0,0 +1 @@ +AMBIGUOUS diff --git a/codenet/public_test_cases/p03043/input.0.txt b/codenet/public_test_cases/p03043/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d737c73be4cb3412b0523fe3eb1e51236019e56 --- /dev/null +++ b/codenet/public_test_cases/p03043/input.0.txt @@ -0,0 +1 @@ +3 10 diff --git a/codenet/public_test_cases/p03043/input.1.txt b/codenet/public_test_cases/p03043/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d737c73be4cb3412b0523fe3eb1e51236019e56 --- /dev/null +++ b/codenet/public_test_cases/p03043/input.1.txt @@ -0,0 +1 @@ +3 10 diff --git a/codenet/public_test_cases/p03043/input.2.txt b/codenet/public_test_cases/p03043/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d38ebc4d3c2094492be232cdb2c61859cab06cfd --- /dev/null +++ b/codenet/public_test_cases/p03043/input.2.txt @@ -0,0 +1 @@ +100000 5 diff --git a/codenet/public_test_cases/p03043/output.0.txt b/codenet/public_test_cases/p03043/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..86abdb3acc301f956b5ad3493bae3c5356702b10 --- /dev/null +++ b/codenet/public_test_cases/p03043/output.0.txt @@ -0,0 +1 @@ +0.145833333333 diff --git a/codenet/public_test_cases/p03043/output.1.txt b/codenet/public_test_cases/p03043/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86abdb3acc301f956b5ad3493bae3c5356702b10 --- /dev/null +++ b/codenet/public_test_cases/p03043/output.1.txt @@ -0,0 +1 @@ +0.145833333333 diff --git a/codenet/public_test_cases/p03043/output.2.txt b/codenet/public_test_cases/p03043/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..22714110b9bf53fa64d3c1805287f84d8bff6591 --- /dev/null +++ b/codenet/public_test_cases/p03043/output.2.txt @@ -0,0 +1 @@ +0.999973749998 diff --git a/codenet/public_test_cases/p03044/input.0.txt b/codenet/public_test_cases/p03044/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25942053a5d5382961b5c8fa6cbcc2f1756a3b78 --- /dev/null +++ b/codenet/public_test_cases/p03044/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 2 +2 3 1 diff --git a/codenet/public_test_cases/p03044/input.1.txt b/codenet/public_test_cases/p03044/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c46e3824596d40027cb87334c5223c384a518000 --- /dev/null +++ b/codenet/public_test_cases/p03044/input.1.txt @@ -0,0 +1,5 @@ +5 +2 5 2 +2 3 10 +1 3 8 +3 4 2 diff --git a/codenet/public_test_cases/p03044/input.2.txt b/codenet/public_test_cases/p03044/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..25942053a5d5382961b5c8fa6cbcc2f1756a3b78 --- /dev/null +++ b/codenet/public_test_cases/p03044/input.2.txt @@ -0,0 +1,3 @@ +3 +1 2 2 +2 3 1 diff --git a/codenet/public_test_cases/p03044/output.0.txt b/codenet/public_test_cases/p03044/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5ee5c21ebeadb60f37f55e05206c18a219be58 --- /dev/null +++ b/codenet/public_test_cases/p03044/output.0.txt @@ -0,0 +1,3 @@ +0 +0 +1 diff --git a/codenet/public_test_cases/p03044/output.1.txt b/codenet/public_test_cases/p03044/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..33f911e8c07e6771a281331a87c1b0d08859afa2 --- /dev/null +++ b/codenet/public_test_cases/p03044/output.1.txt @@ -0,0 +1,5 @@ +1 +0 +1 +0 +1 diff --git a/codenet/public_test_cases/p03044/output.2.txt b/codenet/public_test_cases/p03044/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5ee5c21ebeadb60f37f55e05206c18a219be58 --- /dev/null +++ b/codenet/public_test_cases/p03044/output.2.txt @@ -0,0 +1,3 @@ +0 +0 +1 diff --git a/codenet/public_test_cases/p03045/input.0.txt b/codenet/public_test_cases/p03045/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a6c3987722ae84bfd2bf0ef693877c72c319bb8 --- /dev/null +++ b/codenet/public_test_cases/p03045/input.0.txt @@ -0,0 +1,2 @@ +3 1 +1 2 1 diff --git a/codenet/public_test_cases/p03045/input.1.txt b/codenet/public_test_cases/p03045/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cae98e9bdb0693f914a34e702dc68da23338a50 --- /dev/null +++ b/codenet/public_test_cases/p03045/input.1.txt @@ -0,0 +1,2 @@ +100000 1 +1 100000 100 diff --git a/codenet/public_test_cases/p03045/input.2.txt b/codenet/public_test_cases/p03045/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a83682456e3c80202872855ac3b64ea4fd0ae94b --- /dev/null +++ b/codenet/public_test_cases/p03045/input.2.txt @@ -0,0 +1,6 @@ +6 5 +1 2 1 +2 3 2 +1 3 3 +4 5 4 +5 6 5 diff --git a/codenet/public_test_cases/p03045/input.3.txt b/codenet/public_test_cases/p03045/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a6c3987722ae84bfd2bf0ef693877c72c319bb8 --- /dev/null +++ b/codenet/public_test_cases/p03045/input.3.txt @@ -0,0 +1,2 @@ +3 1 +1 2 1 diff --git a/codenet/public_test_cases/p03045/output.0.txt b/codenet/public_test_cases/p03045/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03045/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03045/output.1.txt b/codenet/public_test_cases/p03045/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..90ef1ea404f5aeb59bc233448c4e724c91f3fff8 --- /dev/null +++ b/codenet/public_test_cases/p03045/output.1.txt @@ -0,0 +1 @@ +99999 diff --git a/codenet/public_test_cases/p03045/output.2.txt b/codenet/public_test_cases/p03045/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03045/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03045/output.3.txt b/codenet/public_test_cases/p03045/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03045/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03047/input.0.txt b/codenet/public_test_cases/p03047/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03047/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03047/input.1.txt b/codenet/public_test_cases/p03047/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1237b57d68e751d4cb03af542a102444e5ca2c96 --- /dev/null +++ b/codenet/public_test_cases/p03047/input.1.txt @@ -0,0 +1 @@ +13 3 diff --git a/codenet/public_test_cases/p03047/input.2.txt b/codenet/public_test_cases/p03047/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03047/input.2.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03047/output.0.txt b/codenet/public_test_cases/p03047/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03047/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03047/output.1.txt b/codenet/public_test_cases/p03047/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03047/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03047/output.2.txt b/codenet/public_test_cases/p03047/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03047/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03048/input.0.txt b/codenet/public_test_cases/p03048/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93a48451c357d2efc0215caef8334af6b6b8dacf --- /dev/null +++ b/codenet/public_test_cases/p03048/input.0.txt @@ -0,0 +1 @@ +1 2 3 4 diff --git a/codenet/public_test_cases/p03048/input.1.txt b/codenet/public_test_cases/p03048/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..93a48451c357d2efc0215caef8334af6b6b8dacf --- /dev/null +++ b/codenet/public_test_cases/p03048/input.1.txt @@ -0,0 +1 @@ +1 2 3 4 diff --git a/codenet/public_test_cases/p03048/input.2.txt b/codenet/public_test_cases/p03048/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c78bfb8cc6b2072f330d96a50ae95ef6f65a9008 --- /dev/null +++ b/codenet/public_test_cases/p03048/input.2.txt @@ -0,0 +1 @@ +13 1 4 3000 diff --git a/codenet/public_test_cases/p03048/output.0.txt b/codenet/public_test_cases/p03048/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03048/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03048/output.1.txt b/codenet/public_test_cases/p03048/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03048/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03048/output.2.txt b/codenet/public_test_cases/p03048/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ea52930feb497cc1d96f7626ece59330baba2a0 --- /dev/null +++ b/codenet/public_test_cases/p03048/output.2.txt @@ -0,0 +1 @@ +87058 diff --git a/codenet/public_test_cases/p03049/input.0.txt b/codenet/public_test_cases/p03049/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..818d5824131403639e13bb723ede63bd8aa540d0 --- /dev/null +++ b/codenet/public_test_cases/p03049/input.0.txt @@ -0,0 +1,4 @@ +3 +ABCA +XBAZ +BAD diff --git a/codenet/public_test_cases/p03049/input.1.txt b/codenet/public_test_cases/p03049/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a400b3214023ba1ab6297ff25ce52e51de3324f4 --- /dev/null +++ b/codenet/public_test_cases/p03049/input.1.txt @@ -0,0 +1,10 @@ +9 +BEWPVCRWH +ZZNQYIJX +BAVREA +PA +HJMYITEOX +BCJHMRMNK +BP +QVFABZ +PRGKSPUNA diff --git a/codenet/public_test_cases/p03049/input.2.txt b/codenet/public_test_cases/p03049/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74b22e3fcaec932129df78a5730199350cc80115 --- /dev/null +++ b/codenet/public_test_cases/p03049/input.2.txt @@ -0,0 +1,8 @@ +7 +RABYBBE +JOZ +BMHQUVA +BPA +ISU +MCMABAOBHZ +SZMEHMA diff --git a/codenet/public_test_cases/p03049/input.3.txt b/codenet/public_test_cases/p03049/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..818d5824131403639e13bb723ede63bd8aa540d0 --- /dev/null +++ b/codenet/public_test_cases/p03049/input.3.txt @@ -0,0 +1,4 @@ +3 +ABCA +XBAZ +BAD diff --git a/codenet/public_test_cases/p03049/output.0.txt b/codenet/public_test_cases/p03049/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03049/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03049/output.1.txt b/codenet/public_test_cases/p03049/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03049/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03049/output.2.txt b/codenet/public_test_cases/p03049/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03049/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03049/output.3.txt b/codenet/public_test_cases/p03049/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03049/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03050/input.0.txt b/codenet/public_test_cases/p03050/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03050/input.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03050/input.1.txt b/codenet/public_test_cases/p03050/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03050/input.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03050/input.2.txt b/codenet/public_test_cases/p03050/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6ee9012f2ab8aa0961ad84e2066b4518eafea4f --- /dev/null +++ b/codenet/public_test_cases/p03050/input.2.txt @@ -0,0 +1 @@ +1000000000000 diff --git a/codenet/public_test_cases/p03050/output.0.txt b/codenet/public_test_cases/p03050/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03050/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03050/output.1.txt b/codenet/public_test_cases/p03050/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03050/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03050/output.2.txt b/codenet/public_test_cases/p03050/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..50a43fa4d6a9e70604a364edf6532bba997adc3d --- /dev/null +++ b/codenet/public_test_cases/p03050/output.2.txt @@ -0,0 +1 @@ +2499686339916 diff --git a/codenet/public_test_cases/p03051/input.0.txt b/codenet/public_test_cases/p03051/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03051/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03051/input.1.txt b/codenet/public_test_cases/p03051/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0becb1637def82dd6d451192a4b59835911bd179 --- /dev/null +++ b/codenet/public_test_cases/p03051/input.1.txt @@ -0,0 +1,2 @@ +32 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p03051/input.2.txt b/codenet/public_test_cases/p03051/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1a3ea4e326f8121a99b2057e7f2b8c9b0c2119f --- /dev/null +++ b/codenet/public_test_cases/p03051/input.2.txt @@ -0,0 +1,2 @@ +3 +1 2 2 diff --git a/codenet/public_test_cases/p03051/input.3.txt b/codenet/public_test_cases/p03051/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03051/input.3.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03051/input.4.txt b/codenet/public_test_cases/p03051/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d3073bc54d184da4e077648445dc0b2ebdd8c73 --- /dev/null +++ b/codenet/public_test_cases/p03051/input.4.txt @@ -0,0 +1,2 @@ +24 +1 2 5 3 3 6 1 1 8 8 0 3 3 4 6 6 4 0 7 2 5 4 6 2 diff --git a/codenet/public_test_cases/p03051/output.0.txt b/codenet/public_test_cases/p03051/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03051/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03051/output.1.txt b/codenet/public_test_cases/p03051/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f8fcb8dd295298411948dddbcebc37f7af3160a --- /dev/null +++ b/codenet/public_test_cases/p03051/output.1.txt @@ -0,0 +1 @@ +147483634 diff --git a/codenet/public_test_cases/p03051/output.2.txt b/codenet/public_test_cases/p03051/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03051/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03051/output.3.txt b/codenet/public_test_cases/p03051/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03051/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03051/output.4.txt b/codenet/public_test_cases/p03051/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f20bd4efea55d184a634e417338291a94563d22a --- /dev/null +++ b/codenet/public_test_cases/p03051/output.4.txt @@ -0,0 +1 @@ +292 diff --git a/codenet/public_test_cases/p03052/input.0.txt b/codenet/public_test_cases/p03052/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..350277fad26b30c3901bbc1ed06ba092af0dbf76 --- /dev/null +++ b/codenet/public_test_cases/p03052/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +1 3 diff --git a/codenet/public_test_cases/p03052/input.1.txt b/codenet/public_test_cases/p03052/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..edef9bfd8c7730d275c8d3d077281deb4d81cdd6 --- /dev/null +++ b/codenet/public_test_cases/p03052/input.1.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +3 2 +3 4 +1 3 diff --git a/codenet/public_test_cases/p03052/input.2.txt b/codenet/public_test_cases/p03052/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d4df17e79c0aae49d5f9ca28e60c6486b1bf545 --- /dev/null +++ b/codenet/public_test_cases/p03052/input.2.txt @@ -0,0 +1,29 @@ +15 28 +10 7 +5 9 +2 13 +2 14 +6 1 +5 12 +2 10 +3 9 +10 15 +11 12 +12 6 +2 12 +12 8 +4 10 +15 3 +13 14 +1 15 +15 12 +4 14 +1 7 +5 11 +7 13 +9 10 +2 7 +1 9 +5 6 +12 14 +5 2 diff --git a/codenet/public_test_cases/p03052/input.3.txt b/codenet/public_test_cases/p03052/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..350277fad26b30c3901bbc1ed06ba092af0dbf76 --- /dev/null +++ b/codenet/public_test_cases/p03052/input.3.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +1 3 diff --git a/codenet/public_test_cases/p03052/output.0.txt b/codenet/public_test_cases/p03052/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03052/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03052/output.1.txt b/codenet/public_test_cases/p03052/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p03052/output.1.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p03052/output.2.txt b/codenet/public_test_cases/p03052/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e867975868ba2b013b67b435d40e1bfa4179e6db --- /dev/null +++ b/codenet/public_test_cases/p03052/output.2.txt @@ -0,0 +1 @@ +657573092 diff --git a/codenet/public_test_cases/p03052/output.3.txt b/codenet/public_test_cases/p03052/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03052/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03053/input.0.txt b/codenet/public_test_cases/p03053/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c69ed0d4a514d28e0531fdeaaf20848df3b534e --- /dev/null +++ b/codenet/public_test_cases/p03053/input.0.txt @@ -0,0 +1,4 @@ +3 3 +... +.#. +... diff --git a/codenet/public_test_cases/p03053/input.1.txt b/codenet/public_test_cases/p03053/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c69ed0d4a514d28e0531fdeaaf20848df3b534e --- /dev/null +++ b/codenet/public_test_cases/p03053/input.1.txt @@ -0,0 +1,4 @@ +3 3 +... +.#. +... diff --git a/codenet/public_test_cases/p03053/input.2.txt b/codenet/public_test_cases/p03053/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..66022a58925d18ebfa2bea242d50f36e5c8abd81 --- /dev/null +++ b/codenet/public_test_cases/p03053/input.2.txt @@ -0,0 +1,7 @@ +6 6 +..#..# +...... +..#.. +...... +.#.... +....#. diff --git a/codenet/public_test_cases/p03053/output.0.txt b/codenet/public_test_cases/p03053/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03053/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03053/output.1.txt b/codenet/public_test_cases/p03053/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03053/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03053/output.2.txt b/codenet/public_test_cases/p03053/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03053/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03054/input.0.txt b/codenet/public_test_cases/p03054/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..977b8774a7955aaea6c806a1acbc7f912a881756 --- /dev/null +++ b/codenet/public_test_cases/p03054/input.0.txt @@ -0,0 +1,4 @@ +2 3 3 +2 2 +RRL +LUD diff --git a/codenet/public_test_cases/p03054/input.1.txt b/codenet/public_test_cases/p03054/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..977b8774a7955aaea6c806a1acbc7f912a881756 --- /dev/null +++ b/codenet/public_test_cases/p03054/input.1.txt @@ -0,0 +1,4 @@ +2 3 3 +2 2 +RRL +LUD diff --git a/codenet/public_test_cases/p03054/input.2.txt b/codenet/public_test_cases/p03054/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c33e8a344c89d24864acc9abb18eb6b9560673d --- /dev/null +++ b/codenet/public_test_cases/p03054/input.2.txt @@ -0,0 +1,4 @@ +4 3 5 +2 2 +UDRRR +LLDUD diff --git a/codenet/public_test_cases/p03054/input.3.txt b/codenet/public_test_cases/p03054/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..67b96ba2b3b4dc7b641df85325e05b689b604f9f --- /dev/null +++ b/codenet/public_test_cases/p03054/input.3.txt @@ -0,0 +1,4 @@ +5 6 11 +2 1 +RLDRRUDDLRL +URRDRLLDLRD diff --git a/codenet/public_test_cases/p03054/output.0.txt b/codenet/public_test_cases/p03054/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03054/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03054/output.1.txt b/codenet/public_test_cases/p03054/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03054/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03054/output.2.txt b/codenet/public_test_cases/p03054/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03054/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03054/output.3.txt b/codenet/public_test_cases/p03054/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03054/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03055/input.0.txt b/codenet/public_test_cases/p03055/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p03055/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03055/input.1.txt b/codenet/public_test_cases/p03055/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac72dfca48d29d851c52e242c22cb721224f8bb4 --- /dev/null +++ b/codenet/public_test_cases/p03055/input.1.txt @@ -0,0 +1,7 @@ +7 +1 7 +7 4 +3 4 +7 5 +6 3 +2 1 diff --git a/codenet/public_test_cases/p03055/input.2.txt b/codenet/public_test_cases/p03055/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p03055/input.2.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03055/input.3.txt b/codenet/public_test_cases/p03055/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bea4716efb5fd2368fb3aca9b5413f7447113a1 --- /dev/null +++ b/codenet/public_test_cases/p03055/input.3.txt @@ -0,0 +1,6 @@ +6 +1 2 +2 3 +2 4 +4 6 +5 6 diff --git a/codenet/public_test_cases/p03055/output.0.txt b/codenet/public_test_cases/p03055/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03055/output.0.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03055/output.1.txt b/codenet/public_test_cases/p03055/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03055/output.1.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03055/output.2.txt b/codenet/public_test_cases/p03055/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03055/output.2.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03055/output.3.txt b/codenet/public_test_cases/p03055/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p03055/output.3.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p03056/input.0.txt b/codenet/public_test_cases/p03056/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7064821ce7839614d8ce0e3a5e59abbe6460b216 --- /dev/null +++ b/codenet/public_test_cases/p03056/input.0.txt @@ -0,0 +1,4 @@ +3 3 +... +.## +.## diff --git a/codenet/public_test_cases/p03056/input.1.txt b/codenet/public_test_cases/p03056/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7064821ce7839614d8ce0e3a5e59abbe6460b216 --- /dev/null +++ b/codenet/public_test_cases/p03056/input.1.txt @@ -0,0 +1,4 @@ +3 3 +... +.## +.## diff --git a/codenet/public_test_cases/p03056/input.2.txt b/codenet/public_test_cases/p03056/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..def5ebe3599e256871f8a4950eceecea50b93393 --- /dev/null +++ b/codenet/public_test_cases/p03056/input.2.txt @@ -0,0 +1,7 @@ +6 7 +.####.# +....#. +....#. +....#. +.####.# +....## diff --git a/codenet/public_test_cases/p03056/output.0.txt b/codenet/public_test_cases/p03056/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03056/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03056/output.1.txt b/codenet/public_test_cases/p03056/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03056/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03056/output.2.txt b/codenet/public_test_cases/p03056/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03056/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03057/input.0.txt b/codenet/public_test_cases/p03057/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6b85e1bec4329864912fdda03f695cc9973068a --- /dev/null +++ b/codenet/public_test_cases/p03057/input.0.txt @@ -0,0 +1,2 @@ +4 7 +RBRRBRR diff --git a/codenet/public_test_cases/p03057/input.1.txt b/codenet/public_test_cases/p03057/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6b85e1bec4329864912fdda03f695cc9973068a --- /dev/null +++ b/codenet/public_test_cases/p03057/input.1.txt @@ -0,0 +1,2 @@ +4 7 +RBRRBRR diff --git a/codenet/public_test_cases/p03057/input.2.txt b/codenet/public_test_cases/p03057/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0dea53705435794156c6d59c28e34b8324eb9328 --- /dev/null +++ b/codenet/public_test_cases/p03057/input.2.txt @@ -0,0 +1,2 @@ +12 10 +RRRRBRRRRB diff --git a/codenet/public_test_cases/p03057/input.3.txt b/codenet/public_test_cases/p03057/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e5b3a5cadefe6e085616670e45fef6741dea102 --- /dev/null +++ b/codenet/public_test_cases/p03057/input.3.txt @@ -0,0 +1,2 @@ +3 3 +BBB diff --git a/codenet/public_test_cases/p03057/output.0.txt b/codenet/public_test_cases/p03057/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03057/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03057/output.1.txt b/codenet/public_test_cases/p03057/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03057/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03057/output.2.txt b/codenet/public_test_cases/p03057/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e14edce9ccd63cedb63bd0c07f8b829438a6c8a --- /dev/null +++ b/codenet/public_test_cases/p03057/output.2.txt @@ -0,0 +1 @@ +78 diff --git a/codenet/public_test_cases/p03057/output.3.txt b/codenet/public_test_cases/p03057/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03057/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03058/input.0.txt b/codenet/public_test_cases/p03058/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd2fd07ca5bc3eabd46c0640d0fb4036d214670a --- /dev/null +++ b/codenet/public_test_cases/p03058/input.0.txt @@ -0,0 +1,8 @@ +5 3 +1 2 +1 3 +3 4 +1 5 +5 4 +2 5 +1 5 diff --git a/codenet/public_test_cases/p03058/input.1.txt b/codenet/public_test_cases/p03058/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..092bb3fcf25191bae70fb76a439f993fdc9c60f7 --- /dev/null +++ b/codenet/public_test_cases/p03058/input.1.txt @@ -0,0 +1,24 @@ +13 11 +6 13 +1 2 +5 1 +8 4 +9 7 +12 2 +10 11 +1 9 +13 7 +13 11 +8 10 +3 8 +4 13 +8 12 +4 7 +2 3 +5 11 +1 4 +2 11 +8 10 +3 5 +6 9 +4 10 diff --git a/codenet/public_test_cases/p03058/input.2.txt b/codenet/public_test_cases/p03058/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd2fd07ca5bc3eabd46c0640d0fb4036d214670a --- /dev/null +++ b/codenet/public_test_cases/p03058/input.2.txt @@ -0,0 +1,8 @@ +5 3 +1 2 +1 3 +3 4 +1 5 +5 4 +2 5 +1 5 diff --git a/codenet/public_test_cases/p03058/input.3.txt b/codenet/public_test_cases/p03058/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce3acf659cb48df5c88c6786129c69be3f7fa264 --- /dev/null +++ b/codenet/public_test_cases/p03058/input.3.txt @@ -0,0 +1,12 @@ +7 5 +1 5 +1 4 +1 7 +1 2 +2 6 +6 3 +2 5 +1 3 +1 6 +4 6 +4 7 diff --git a/codenet/public_test_cases/p03058/output.0.txt b/codenet/public_test_cases/p03058/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03058/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03058/output.1.txt b/codenet/public_test_cases/p03058/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p03058/output.1.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p03058/output.2.txt b/codenet/public_test_cases/p03058/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03058/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03058/output.3.txt b/codenet/public_test_cases/p03058/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03058/output.3.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03059/input.0.txt b/codenet/public_test_cases/p03059/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3dd94e0ce34fa563f5bf161230a501d7356ff92 --- /dev/null +++ b/codenet/public_test_cases/p03059/input.0.txt @@ -0,0 +1 @@ +3 5 7 diff --git a/codenet/public_test_cases/p03059/input.1.txt b/codenet/public_test_cases/p03059/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3dd94e0ce34fa563f5bf161230a501d7356ff92 --- /dev/null +++ b/codenet/public_test_cases/p03059/input.1.txt @@ -0,0 +1 @@ +3 5 7 diff --git a/codenet/public_test_cases/p03059/input.2.txt b/codenet/public_test_cases/p03059/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ca112e1d3c123dbeb6b0fc0f5b206629e7770f4 --- /dev/null +++ b/codenet/public_test_cases/p03059/input.2.txt @@ -0,0 +1 @@ +20 20 19 diff --git a/codenet/public_test_cases/p03059/input.3.txt b/codenet/public_test_cases/p03059/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfd381a3d8a3770b4e51b63ea77f2f89d578f613 --- /dev/null +++ b/codenet/public_test_cases/p03059/input.3.txt @@ -0,0 +1 @@ +3 2 9 diff --git a/codenet/public_test_cases/p03059/output.0.txt b/codenet/public_test_cases/p03059/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03059/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03059/output.1.txt b/codenet/public_test_cases/p03059/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03059/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03059/output.2.txt b/codenet/public_test_cases/p03059/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03059/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03059/output.3.txt b/codenet/public_test_cases/p03059/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03059/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03060/input.0.txt b/codenet/public_test_cases/p03060/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f58aab71e53543c1f7f0e93aa5e0c9752da292b8 --- /dev/null +++ b/codenet/public_test_cases/p03060/input.0.txt @@ -0,0 +1,3 @@ +3 +10 2 5 +6 3 4 diff --git a/codenet/public_test_cases/p03060/input.1.txt b/codenet/public_test_cases/p03060/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e08084a1fd9a26c4c970a9909cebda058a1f5048 --- /dev/null +++ b/codenet/public_test_cases/p03060/input.1.txt @@ -0,0 +1,3 @@ +4 +13 21 6 19 +11 30 6 15 diff --git a/codenet/public_test_cases/p03060/input.2.txt b/codenet/public_test_cases/p03060/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f58aab71e53543c1f7f0e93aa5e0c9752da292b8 --- /dev/null +++ b/codenet/public_test_cases/p03060/input.2.txt @@ -0,0 +1,3 @@ +3 +10 2 5 +6 3 4 diff --git a/codenet/public_test_cases/p03060/input.3.txt b/codenet/public_test_cases/p03060/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2f698b82bad126c48acf1b9383d37b69ac802c3 --- /dev/null +++ b/codenet/public_test_cases/p03060/input.3.txt @@ -0,0 +1,3 @@ +1 +1 +50 diff --git a/codenet/public_test_cases/p03060/output.0.txt b/codenet/public_test_cases/p03060/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03060/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03060/output.1.txt b/codenet/public_test_cases/p03060/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03060/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03060/output.2.txt b/codenet/public_test_cases/p03060/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03060/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03060/output.3.txt b/codenet/public_test_cases/p03060/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03060/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03061/input.0.txt b/codenet/public_test_cases/p03061/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdc9628ba260294245fda324b15b8cd0a361f190 --- /dev/null +++ b/codenet/public_test_cases/p03061/input.0.txt @@ -0,0 +1,2 @@ +3 +7 6 8 diff --git a/codenet/public_test_cases/p03061/input.1.txt b/codenet/public_test_cases/p03061/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdc9628ba260294245fda324b15b8cd0a361f190 --- /dev/null +++ b/codenet/public_test_cases/p03061/input.1.txt @@ -0,0 +1,2 @@ +3 +7 6 8 diff --git a/codenet/public_test_cases/p03061/input.2.txt b/codenet/public_test_cases/p03061/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..958790da0178594a1d5db96f99abc60a97971d89 --- /dev/null +++ b/codenet/public_test_cases/p03061/input.2.txt @@ -0,0 +1,2 @@ +2 +1000000000 1000000000 diff --git a/codenet/public_test_cases/p03061/input.3.txt b/codenet/public_test_cases/p03061/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4789d9edbf23d6fd89407d1dce7b54321fc9acb --- /dev/null +++ b/codenet/public_test_cases/p03061/input.3.txt @@ -0,0 +1,2 @@ +3 +12 15 18 diff --git a/codenet/public_test_cases/p03061/output.0.txt b/codenet/public_test_cases/p03061/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03061/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03061/output.1.txt b/codenet/public_test_cases/p03061/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03061/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03061/output.2.txt b/codenet/public_test_cases/p03061/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..770fdcfb4b7d03520f649b7f7ca20e2546bdb41f --- /dev/null +++ b/codenet/public_test_cases/p03061/output.2.txt @@ -0,0 +1 @@ +1000000000 diff --git a/codenet/public_test_cases/p03061/output.3.txt b/codenet/public_test_cases/p03061/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03061/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03062/input.0.txt b/codenet/public_test_cases/p03062/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c91629730305013700646c59d292b0062ff2a122 --- /dev/null +++ b/codenet/public_test_cases/p03062/input.0.txt @@ -0,0 +1,2 @@ +3 +-10 5 -4 diff --git a/codenet/public_test_cases/p03062/input.1.txt b/codenet/public_test_cases/p03062/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7d1b3e785404ede7fd536cfce35cbd2e56a08c8 --- /dev/null +++ b/codenet/public_test_cases/p03062/input.1.txt @@ -0,0 +1,2 @@ +11 +-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000 diff --git a/codenet/public_test_cases/p03062/input.2.txt b/codenet/public_test_cases/p03062/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d309fbca6e6b71c68535ce0520ae5ca3c2f71e7e --- /dev/null +++ b/codenet/public_test_cases/p03062/input.2.txt @@ -0,0 +1,2 @@ +5 +10 -4 -8 -11 3 diff --git a/codenet/public_test_cases/p03062/input.3.txt b/codenet/public_test_cases/p03062/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c91629730305013700646c59d292b0062ff2a122 --- /dev/null +++ b/codenet/public_test_cases/p03062/input.3.txt @@ -0,0 +1,2 @@ +3 +-10 5 -4 diff --git a/codenet/public_test_cases/p03062/output.0.txt b/codenet/public_test_cases/p03062/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p03062/output.0.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p03062/output.1.txt b/codenet/public_test_cases/p03062/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa70b89f2419392b9755e77e59b6b93b424cca9a --- /dev/null +++ b/codenet/public_test_cases/p03062/output.1.txt @@ -0,0 +1 @@ +10000000000 diff --git a/codenet/public_test_cases/p03062/output.2.txt b/codenet/public_test_cases/p03062/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03062/output.2.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03062/output.3.txt b/codenet/public_test_cases/p03062/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p03062/output.3.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p03063/input.0.txt b/codenet/public_test_cases/p03063/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3793fad0917fe5fb1bea8d9117390fbd8c700459 --- /dev/null +++ b/codenet/public_test_cases/p03063/input.0.txt @@ -0,0 +1,2 @@ +3 +#.# diff --git a/codenet/public_test_cases/p03063/output.0.txt b/codenet/public_test_cases/p03063/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03063/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03064/input.0.txt b/codenet/public_test_cases/p03064/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccbc362f8d848020273503e854d6b9c131ff9209 --- /dev/null +++ b/codenet/public_test_cases/p03064/input.0.txt @@ -0,0 +1,5 @@ +4 +1 +1 +1 +2 diff --git a/codenet/public_test_cases/p03064/input.1.txt b/codenet/public_test_cases/p03064/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccbc362f8d848020273503e854d6b9c131ff9209 --- /dev/null +++ b/codenet/public_test_cases/p03064/input.1.txt @@ -0,0 +1,5 @@ +4 +1 +1 +1 +2 diff --git a/codenet/public_test_cases/p03064/input.2.txt b/codenet/public_test_cases/p03064/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cd739e60cf7255f0caec27c860cbbb9608d7a48 --- /dev/null +++ b/codenet/public_test_cases/p03064/input.2.txt @@ -0,0 +1,7 @@ +6 +1 +3 +2 +3 +5 +2 diff --git a/codenet/public_test_cases/p03064/input.3.txt b/codenet/public_test_cases/p03064/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..98644099c0c5d20f57ac963584b605124ef071cb --- /dev/null +++ b/codenet/public_test_cases/p03064/input.3.txt @@ -0,0 +1,21 @@ +20 +3 +1 +4 +1 +5 +9 +2 +6 +5 +3 +5 +8 +9 +7 +9 +3 +2 +3 +8 +4 diff --git a/codenet/public_test_cases/p03064/output.0.txt b/codenet/public_test_cases/p03064/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03064/output.0.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03064/output.1.txt b/codenet/public_test_cases/p03064/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03064/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03064/output.2.txt b/codenet/public_test_cases/p03064/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa8f08cb6ff8a30dd34a3b442009bdfc798a7316 --- /dev/null +++ b/codenet/public_test_cases/p03064/output.2.txt @@ -0,0 +1 @@ +150 diff --git a/codenet/public_test_cases/p03064/output.3.txt b/codenet/public_test_cases/p03064/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5bbe47aeef554c49942414808c14b3ef35302ad --- /dev/null +++ b/codenet/public_test_cases/p03064/output.3.txt @@ -0,0 +1 @@ +563038556 diff --git a/codenet/public_test_cases/p03065/input.0.txt b/codenet/public_test_cases/p03065/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55aaf2a0d0fb6ff02f2736a5fe07b5ef4fc6d312 --- /dev/null +++ b/codenet/public_test_cases/p03065/input.0.txt @@ -0,0 +1,4 @@ +2 +7 +-7 +14 diff --git a/codenet/public_test_cases/p03065/input.1.txt b/codenet/public_test_cases/p03065/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..55aaf2a0d0fb6ff02f2736a5fe07b5ef4fc6d312 --- /dev/null +++ b/codenet/public_test_cases/p03065/input.1.txt @@ -0,0 +1,4 @@ +2 +7 +-7 +14 diff --git a/codenet/public_test_cases/p03065/input.2.txt b/codenet/public_test_cases/p03065/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..11f53cbce2990d5f7fbce3c91098e687c5d4156b --- /dev/null +++ b/codenet/public_test_cases/p03065/input.2.txt @@ -0,0 +1,2 @@ +0 +998244353 diff --git a/codenet/public_test_cases/p03065/output.0.txt b/codenet/public_test_cases/p03065/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e15ee42734b17a6e148d79be947360671597e2f --- /dev/null +++ b/codenet/public_test_cases/p03065/output.0.txt @@ -0,0 +1,2 @@ +2 +7 diff --git a/codenet/public_test_cases/p03065/output.1.txt b/codenet/public_test_cases/p03065/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e15ee42734b17a6e148d79be947360671597e2f --- /dev/null +++ b/codenet/public_test_cases/p03065/output.1.txt @@ -0,0 +1,2 @@ +2 +7 diff --git a/codenet/public_test_cases/p03065/output.2.txt b/codenet/public_test_cases/p03065/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..313a14023ee06d3cb4ab29d1623467c3b45496c8 --- /dev/null +++ b/codenet/public_test_cases/p03065/output.2.txt @@ -0,0 +1 @@ +998244353 diff --git a/codenet/public_test_cases/p03066/input.0.txt b/codenet/public_test_cases/p03066/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p03066/input.0.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p03066/input.1.txt b/codenet/public_test_cases/p03066/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p03066/input.1.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p03066/input.2.txt b/codenet/public_test_cases/p03066/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..25bf1347ee5411deaaf3532637d6568e29bdb7b6 --- /dev/null +++ b/codenet/public_test_cases/p03066/input.2.txt @@ -0,0 +1 @@ +8 6 diff --git a/codenet/public_test_cases/p03066/input.3.txt b/codenet/public_test_cases/p03066/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd9be2244324b53395871b0704708e27c3a8d20b --- /dev/null +++ b/codenet/public_test_cases/p03066/input.3.txt @@ -0,0 +1 @@ +9 13 diff --git a/codenet/public_test_cases/p03066/input.4.txt b/codenet/public_test_cases/p03066/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4cc033e099af2942f9668256bbfc5a649489ec13 --- /dev/null +++ b/codenet/public_test_cases/p03066/input.4.txt @@ -0,0 +1 @@ +10 1 diff --git a/codenet/public_test_cases/p03066/input.5.txt b/codenet/public_test_cases/p03066/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..478915aae0267e3733129147f7041e7d7a9a7a85 --- /dev/null +++ b/codenet/public_test_cases/p03066/input.5.txt @@ -0,0 +1 @@ +314 159 diff --git a/codenet/public_test_cases/p03066/output.0.txt b/codenet/public_test_cases/p03066/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03066/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03066/output.1.txt b/codenet/public_test_cases/p03066/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03066/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03066/output.2.txt b/codenet/public_test_cases/p03066/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c8b8bca0d278ea0b7fc94523a233c4ff9367f2d --- /dev/null +++ b/codenet/public_test_cases/p03066/output.2.txt @@ -0,0 +1 @@ +1179 diff --git a/codenet/public_test_cases/p03066/output.3.txt b/codenet/public_test_cases/p03066/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..32ed7f8a5ea161df087821c932e4ab0ccceb5d55 --- /dev/null +++ b/codenet/public_test_cases/p03066/output.3.txt @@ -0,0 +1 @@ +18402 diff --git a/codenet/public_test_cases/p03066/output.4.txt b/codenet/public_test_cases/p03066/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7b1c440c0f3f8d42eff097800b88ac5d40263d3 --- /dev/null +++ b/codenet/public_test_cases/p03066/output.4.txt @@ -0,0 +1 @@ +1024 diff --git a/codenet/public_test_cases/p03066/output.5.txt b/codenet/public_test_cases/p03066/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7f0bd705313e7bcceaaf707091a961ed98681fd --- /dev/null +++ b/codenet/public_test_cases/p03066/output.5.txt @@ -0,0 +1 @@ +459765451 diff --git a/codenet/public_test_cases/p03067/input.0.txt b/codenet/public_test_cases/p03067/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5599a0fbc3b3cf8d8e627451ff96ac50618e90d6 --- /dev/null +++ b/codenet/public_test_cases/p03067/input.0.txt @@ -0,0 +1 @@ +3 8 5 diff --git a/codenet/public_test_cases/p03067/input.1.txt b/codenet/public_test_cases/p03067/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8650be156c65b26c08d5a7a1ed45705fb07f4034 --- /dev/null +++ b/codenet/public_test_cases/p03067/input.1.txt @@ -0,0 +1 @@ +10 2 4 diff --git a/codenet/public_test_cases/p03067/input.2.txt b/codenet/public_test_cases/p03067/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..35081b3547be43dfe9d4a5b2103e433dceafbf60 --- /dev/null +++ b/codenet/public_test_cases/p03067/input.2.txt @@ -0,0 +1 @@ +7 3 1 diff --git a/codenet/public_test_cases/p03067/input.3.txt b/codenet/public_test_cases/p03067/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99d753b224734934253a7865c50157bb9087520c --- /dev/null +++ b/codenet/public_test_cases/p03067/input.3.txt @@ -0,0 +1 @@ +31 41 59 diff --git a/codenet/public_test_cases/p03067/input.4.txt b/codenet/public_test_cases/p03067/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5599a0fbc3b3cf8d8e627451ff96ac50618e90d6 --- /dev/null +++ b/codenet/public_test_cases/p03067/input.4.txt @@ -0,0 +1 @@ +3 8 5 diff --git a/codenet/public_test_cases/p03067/output.0.txt b/codenet/public_test_cases/p03067/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03067/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03067/output.1.txt b/codenet/public_test_cases/p03067/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03067/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03067/output.2.txt b/codenet/public_test_cases/p03067/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03067/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03067/output.3.txt b/codenet/public_test_cases/p03067/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03067/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03067/output.4.txt b/codenet/public_test_cases/p03067/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03067/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03068/input.0.txt b/codenet/public_test_cases/p03068/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2022bdcaefe3105f127f9e50900b87342ddf6aa --- /dev/null +++ b/codenet/public_test_cases/p03068/input.0.txt @@ -0,0 +1,3 @@ +5 +error +2 diff --git a/codenet/public_test_cases/p03068/input.1.txt b/codenet/public_test_cases/p03068/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d897ba68c4af3c66422555c1c53cf40748b75ce8 --- /dev/null +++ b/codenet/public_test_cases/p03068/input.1.txt @@ -0,0 +1,3 @@ +6 +eleven +5 diff --git a/codenet/public_test_cases/p03068/input.2.txt b/codenet/public_test_cases/p03068/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b8d30fe793ed1fa23e8bc66d35183f464abcfff --- /dev/null +++ b/codenet/public_test_cases/p03068/input.2.txt @@ -0,0 +1,3 @@ +9 +education +7 diff --git a/codenet/public_test_cases/p03068/input.3.txt b/codenet/public_test_cases/p03068/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2022bdcaefe3105f127f9e50900b87342ddf6aa --- /dev/null +++ b/codenet/public_test_cases/p03068/input.3.txt @@ -0,0 +1,3 @@ +5 +error +2 diff --git a/codenet/public_test_cases/p03068/output.0.txt b/codenet/public_test_cases/p03068/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bf0322a49e0e09ca49e382090c926a17d43a1f7 --- /dev/null +++ b/codenet/public_test_cases/p03068/output.0.txt @@ -0,0 +1 @@ +*rr*r diff --git a/codenet/public_test_cases/p03068/output.1.txt b/codenet/public_test_cases/p03068/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cec10ec12e863947325e77c241a68557844aee08 --- /dev/null +++ b/codenet/public_test_cases/p03068/output.1.txt @@ -0,0 +1 @@ +e*e*e* diff --git a/codenet/public_test_cases/p03068/output.2.txt b/codenet/public_test_cases/p03068/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e459331b6006667613849dd4214bfce64a5f2d45 --- /dev/null +++ b/codenet/public_test_cases/p03068/output.2.txt @@ -0,0 +1 @@ +******i** diff --git a/codenet/public_test_cases/p03068/output.3.txt b/codenet/public_test_cases/p03068/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bf0322a49e0e09ca49e382090c926a17d43a1f7 --- /dev/null +++ b/codenet/public_test_cases/p03068/output.3.txt @@ -0,0 +1 @@ +*rr*r diff --git a/codenet/public_test_cases/p03069/input.0.txt b/codenet/public_test_cases/p03069/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3793fad0917fe5fb1bea8d9117390fbd8c700459 --- /dev/null +++ b/codenet/public_test_cases/p03069/input.0.txt @@ -0,0 +1,2 @@ +3 +#.# diff --git a/codenet/public_test_cases/p03069/input.1.txt b/codenet/public_test_cases/p03069/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..713ccee472f8adc1619348c8765e60806c0d3f1a --- /dev/null +++ b/codenet/public_test_cases/p03069/input.1.txt @@ -0,0 +1,2 @@ +3 +.# diff --git a/codenet/public_test_cases/p03069/input.2.txt b/codenet/public_test_cases/p03069/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e87c2d3e9444f41e6c3a302899b27aace98b52e2 --- /dev/null +++ b/codenet/public_test_cases/p03069/input.2.txt @@ -0,0 +1,2 @@ +5 +.##. diff --git a/codenet/public_test_cases/p03069/input.3.txt b/codenet/public_test_cases/p03069/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8cc412de4d4e4a445aa00daccbad4ea74c1a581 --- /dev/null +++ b/codenet/public_test_cases/p03069/input.3.txt @@ -0,0 +1,2 @@ +9 +......... diff --git a/codenet/public_test_cases/p03069/input.4.txt b/codenet/public_test_cases/p03069/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3793fad0917fe5fb1bea8d9117390fbd8c700459 --- /dev/null +++ b/codenet/public_test_cases/p03069/input.4.txt @@ -0,0 +1,2 @@ +3 +#.# diff --git a/codenet/public_test_cases/p03069/output.0.txt b/codenet/public_test_cases/p03069/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03069/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03069/output.1.txt b/codenet/public_test_cases/p03069/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03069/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03069/output.2.txt b/codenet/public_test_cases/p03069/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03069/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03069/output.3.txt b/codenet/public_test_cases/p03069/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03069/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03069/output.4.txt b/codenet/public_test_cases/p03069/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03069/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03070/input.0.txt b/codenet/public_test_cases/p03070/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccbc362f8d848020273503e854d6b9c131ff9209 --- /dev/null +++ b/codenet/public_test_cases/p03070/input.0.txt @@ -0,0 +1,5 @@ +4 +1 +1 +1 +2 diff --git a/codenet/public_test_cases/p03070/output.0.txt b/codenet/public_test_cases/p03070/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03070/output.0.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03071/input.0.txt b/codenet/public_test_cases/p03071/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p03071/input.0.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p03071/input.1.txt b/codenet/public_test_cases/p03071/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebcee1a506db729ea7b0e0b6e9b0be36806d16bd --- /dev/null +++ b/codenet/public_test_cases/p03071/input.1.txt @@ -0,0 +1 @@ +3 4 diff --git a/codenet/public_test_cases/p03071/input.2.txt b/codenet/public_test_cases/p03071/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p03071/input.2.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p03071/input.3.txt b/codenet/public_test_cases/p03071/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..558161a5efe98affb4b85e05b11fb1e8eca52001 --- /dev/null +++ b/codenet/public_test_cases/p03071/input.3.txt @@ -0,0 +1 @@ +6 6 diff --git a/codenet/public_test_cases/p03071/output.0.txt b/codenet/public_test_cases/p03071/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03071/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03071/output.1.txt b/codenet/public_test_cases/p03071/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03071/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03071/output.2.txt b/codenet/public_test_cases/p03071/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03071/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03071/output.3.txt b/codenet/public_test_cases/p03071/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03071/output.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03072/input.0.txt b/codenet/public_test_cases/p03072/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f731fcc14f797911ab51f64682a0390ccae4a18 --- /dev/null +++ b/codenet/public_test_cases/p03072/input.0.txt @@ -0,0 +1,2 @@ +4 +6 5 6 8 diff --git a/codenet/public_test_cases/p03072/input.1.txt b/codenet/public_test_cases/p03072/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f731fcc14f797911ab51f64682a0390ccae4a18 --- /dev/null +++ b/codenet/public_test_cases/p03072/input.1.txt @@ -0,0 +1,2 @@ +4 +6 5 6 8 diff --git a/codenet/public_test_cases/p03072/input.2.txt b/codenet/public_test_cases/p03072/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58bcb568d547bc2160c9c20fa218edaaa9e33835 --- /dev/null +++ b/codenet/public_test_cases/p03072/input.2.txt @@ -0,0 +1,2 @@ +5 +9 5 6 8 4 diff --git a/codenet/public_test_cases/p03072/input.3.txt b/codenet/public_test_cases/p03072/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..57cf01209a061b869f79c5633b6409ed6f7f2b0d --- /dev/null +++ b/codenet/public_test_cases/p03072/input.3.txt @@ -0,0 +1,2 @@ +5 +4 5 3 5 4 diff --git a/codenet/public_test_cases/p03072/output.0.txt b/codenet/public_test_cases/p03072/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03072/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03072/output.1.txt b/codenet/public_test_cases/p03072/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03072/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03072/output.2.txt b/codenet/public_test_cases/p03072/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03072/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03072/output.3.txt b/codenet/public_test_cases/p03072/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03072/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03073/input.0.txt b/codenet/public_test_cases/p03073/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f087a34c80c2123f05aae01e910c871b9e23773 --- /dev/null +++ b/codenet/public_test_cases/p03073/input.0.txt @@ -0,0 +1 @@ +000 diff --git a/codenet/public_test_cases/p03073/input.1.txt b/codenet/public_test_cases/p03073/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc199a026c707ff9c11fe4c65a5cb86100dd7f26 --- /dev/null +++ b/codenet/public_test_cases/p03073/input.1.txt @@ -0,0 +1 @@ +10010010 diff --git a/codenet/public_test_cases/p03073/input.2.txt b/codenet/public_test_cases/p03073/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03073/input.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03073/input.3.txt b/codenet/public_test_cases/p03073/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f087a34c80c2123f05aae01e910c871b9e23773 --- /dev/null +++ b/codenet/public_test_cases/p03073/input.3.txt @@ -0,0 +1 @@ +000 diff --git a/codenet/public_test_cases/p03073/output.0.txt b/codenet/public_test_cases/p03073/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03073/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03073/output.1.txt b/codenet/public_test_cases/p03073/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03073/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03073/output.2.txt b/codenet/public_test_cases/p03073/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03073/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03073/output.3.txt b/codenet/public_test_cases/p03073/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03073/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03074/input.0.txt b/codenet/public_test_cases/p03074/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82fb3cd9ef0117974181b73cb8c5f0f3fa8393c4 --- /dev/null +++ b/codenet/public_test_cases/p03074/input.0.txt @@ -0,0 +1,2 @@ +5 1 +00010 diff --git a/codenet/public_test_cases/p03074/input.1.txt b/codenet/public_test_cases/p03074/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..82fb3cd9ef0117974181b73cb8c5f0f3fa8393c4 --- /dev/null +++ b/codenet/public_test_cases/p03074/input.1.txt @@ -0,0 +1,2 @@ +5 1 +00010 diff --git a/codenet/public_test_cases/p03074/input.2.txt b/codenet/public_test_cases/p03074/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c8f67345dc0733270c06550b563b1a23243d582 --- /dev/null +++ b/codenet/public_test_cases/p03074/input.2.txt @@ -0,0 +1,2 @@ +1 1 +1 diff --git a/codenet/public_test_cases/p03074/input.3.txt b/codenet/public_test_cases/p03074/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..07d1c0300e616ce2f6faabfa0b43b62953b75c4e --- /dev/null +++ b/codenet/public_test_cases/p03074/input.3.txt @@ -0,0 +1,2 @@ +14 2 +11101010110011 diff --git a/codenet/public_test_cases/p03074/output.0.txt b/codenet/public_test_cases/p03074/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03074/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03074/output.1.txt b/codenet/public_test_cases/p03074/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03074/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03074/output.2.txt b/codenet/public_test_cases/p03074/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03074/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03074/output.3.txt b/codenet/public_test_cases/p03074/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03074/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03075/input.0.txt b/codenet/public_test_cases/p03075/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a72db9786780ecaef8f698a0ea5f2b4a192df8d --- /dev/null +++ b/codenet/public_test_cases/p03075/input.0.txt @@ -0,0 +1,6 @@ +1 +2 +4 +8 +9 +15 diff --git a/codenet/public_test_cases/p03075/input.1.txt b/codenet/public_test_cases/p03075/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a72db9786780ecaef8f698a0ea5f2b4a192df8d --- /dev/null +++ b/codenet/public_test_cases/p03075/input.1.txt @@ -0,0 +1,6 @@ +1 +2 +4 +8 +9 +15 diff --git a/codenet/public_test_cases/p03075/input.2.txt b/codenet/public_test_cases/p03075/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf2409bcdc157d9c8ce3dbefe38ea117346cec0c --- /dev/null +++ b/codenet/public_test_cases/p03075/input.2.txt @@ -0,0 +1,6 @@ +15 +18 +26 +35 +36 +18 diff --git a/codenet/public_test_cases/p03075/output.0.txt b/codenet/public_test_cases/p03075/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54183385deb59b25453c38ce72f56b662fb4c600 --- /dev/null +++ b/codenet/public_test_cases/p03075/output.0.txt @@ -0,0 +1 @@ +Yay! diff --git a/codenet/public_test_cases/p03075/output.1.txt b/codenet/public_test_cases/p03075/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..54183385deb59b25453c38ce72f56b662fb4c600 --- /dev/null +++ b/codenet/public_test_cases/p03075/output.1.txt @@ -0,0 +1 @@ +Yay! diff --git a/codenet/public_test_cases/p03075/output.2.txt b/codenet/public_test_cases/p03075/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1504ea7bfc17cea50e6965a20bcd0579931ce040 --- /dev/null +++ b/codenet/public_test_cases/p03075/output.2.txt @@ -0,0 +1 @@ +:( diff --git a/codenet/public_test_cases/p03076/input.0.txt b/codenet/public_test_cases/p03076/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f700249327c7fd2c6af31b15e7dc09a5de31148 --- /dev/null +++ b/codenet/public_test_cases/p03076/input.0.txt @@ -0,0 +1,5 @@ +29 +20 +7 +35 +120 diff --git a/codenet/public_test_cases/p03076/input.1.txt b/codenet/public_test_cases/p03076/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a699d6584f8fdac70ee4b44122fc52fb31aeead --- /dev/null +++ b/codenet/public_test_cases/p03076/input.1.txt @@ -0,0 +1,5 @@ +123 +123 +123 +123 +123 diff --git a/codenet/public_test_cases/p03076/input.2.txt b/codenet/public_test_cases/p03076/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f700249327c7fd2c6af31b15e7dc09a5de31148 --- /dev/null +++ b/codenet/public_test_cases/p03076/input.2.txt @@ -0,0 +1,5 @@ +29 +20 +7 +35 +120 diff --git a/codenet/public_test_cases/p03076/input.3.txt b/codenet/public_test_cases/p03076/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d40240fd051163dd3928414cd2c4d4f02df5bc1 --- /dev/null +++ b/codenet/public_test_cases/p03076/input.3.txt @@ -0,0 +1,5 @@ +101 +86 +119 +108 +57 diff --git a/codenet/public_test_cases/p03076/output.0.txt b/codenet/public_test_cases/p03076/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c34a8046fa35e9cec76905037d0e5727b11386b6 --- /dev/null +++ b/codenet/public_test_cases/p03076/output.0.txt @@ -0,0 +1 @@ +215 diff --git a/codenet/public_test_cases/p03076/output.1.txt b/codenet/public_test_cases/p03076/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb8477e537c9fbdf123d0d53042a3817c8de0508 --- /dev/null +++ b/codenet/public_test_cases/p03076/output.1.txt @@ -0,0 +1 @@ +643 diff --git a/codenet/public_test_cases/p03076/output.2.txt b/codenet/public_test_cases/p03076/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c34a8046fa35e9cec76905037d0e5727b11386b6 --- /dev/null +++ b/codenet/public_test_cases/p03076/output.2.txt @@ -0,0 +1 @@ +215 diff --git a/codenet/public_test_cases/p03076/output.3.txt b/codenet/public_test_cases/p03076/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff5670fb004fb272046f1d083fe1d8f5f3cf69dc --- /dev/null +++ b/codenet/public_test_cases/p03076/output.3.txt @@ -0,0 +1 @@ +481 diff --git a/codenet/public_test_cases/p03077/input.0.txt b/codenet/public_test_cases/p03077/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4e3a81405d6f2cc29d926ba0485c54d7a8b03eb --- /dev/null +++ b/codenet/public_test_cases/p03077/input.0.txt @@ -0,0 +1,6 @@ +5 +3 +2 +4 +3 +5 diff --git a/codenet/public_test_cases/p03077/input.1.txt b/codenet/public_test_cases/p03077/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4e3a81405d6f2cc29d926ba0485c54d7a8b03eb --- /dev/null +++ b/codenet/public_test_cases/p03077/input.1.txt @@ -0,0 +1,6 @@ +5 +3 +2 +4 +3 +5 diff --git a/codenet/public_test_cases/p03077/input.2.txt b/codenet/public_test_cases/p03077/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..de429c15546defea2b423839b6788e69426e0ecb --- /dev/null +++ b/codenet/public_test_cases/p03077/input.2.txt @@ -0,0 +1,6 @@ +10 +123 +123 +123 +123 +123 diff --git a/codenet/public_test_cases/p03077/input.3.txt b/codenet/public_test_cases/p03077/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e5f3a33fe574b1319e5f19772befff4737e1b00 --- /dev/null +++ b/codenet/public_test_cases/p03077/input.3.txt @@ -0,0 +1,6 @@ +10000000007 +2 +3 +5 +7 +11 diff --git a/codenet/public_test_cases/p03077/output.0.txt b/codenet/public_test_cases/p03077/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03077/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03077/output.1.txt b/codenet/public_test_cases/p03077/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03077/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03077/output.2.txt b/codenet/public_test_cases/p03077/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03077/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03077/output.3.txt b/codenet/public_test_cases/p03077/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..de36a9cb70e7944697cb48e6e24af588a3ab368e --- /dev/null +++ b/codenet/public_test_cases/p03077/output.3.txt @@ -0,0 +1 @@ +5000000008 diff --git a/codenet/public_test_cases/p03078/input.0.txt b/codenet/public_test_cases/p03078/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64091f7a05ec77903b818dd2753417fb515a9fd9 --- /dev/null +++ b/codenet/public_test_cases/p03078/input.0.txt @@ -0,0 +1,4 @@ +2 2 2 8 +4 6 +1 5 +3 8 diff --git a/codenet/public_test_cases/p03078/input.1.txt b/codenet/public_test_cases/p03078/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64091f7a05ec77903b818dd2753417fb515a9fd9 --- /dev/null +++ b/codenet/public_test_cases/p03078/input.1.txt @@ -0,0 +1,4 @@ +2 2 2 8 +4 6 +1 5 +3 8 diff --git a/codenet/public_test_cases/p03078/input.2.txt b/codenet/public_test_cases/p03078/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..728fc4a15fee71c88162c2fd6d95db4393983b56 --- /dev/null +++ b/codenet/public_test_cases/p03078/input.2.txt @@ -0,0 +1,4 @@ +10 10 10 20 +7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488 +1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338 +4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736 diff --git a/codenet/public_test_cases/p03078/input.3.txt b/codenet/public_test_cases/p03078/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0589ed6725bb61484c436978d19057ebcd2c96a --- /dev/null +++ b/codenet/public_test_cases/p03078/input.3.txt @@ -0,0 +1,4 @@ +3 3 3 5 +1 10 100 +2 20 200 +1 10 100 diff --git a/codenet/public_test_cases/p03078/output.0.txt b/codenet/public_test_cases/p03078/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd489dc9ad7da5b567122aca66d9881257f41e47 --- /dev/null +++ b/codenet/public_test_cases/p03078/output.0.txt @@ -0,0 +1,8 @@ +19 +17 +15 +14 +13 +12 +10 +8 diff --git a/codenet/public_test_cases/p03078/output.1.txt b/codenet/public_test_cases/p03078/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd489dc9ad7da5b567122aca66d9881257f41e47 --- /dev/null +++ b/codenet/public_test_cases/p03078/output.1.txt @@ -0,0 +1,8 @@ +19 +17 +15 +14 +13 +12 +10 +8 diff --git a/codenet/public_test_cases/p03078/output.2.txt b/codenet/public_test_cases/p03078/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3c2019512280d5d93116721df3f5f0a3005d810 --- /dev/null +++ b/codenet/public_test_cases/p03078/output.2.txt @@ -0,0 +1,20 @@ +23379871545 +22444657051 +22302177772 +22095691512 +21667941469 +21366963278 +21287912315 +21279176669 +21160477018 +21085311041 +21059876163 +21017997739 +20703329561 +20702387965 +20590247696 +20383761436 +20343962175 +20254073196 +20210218542 +20150096547 diff --git a/codenet/public_test_cases/p03078/output.3.txt b/codenet/public_test_cases/p03078/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8785ba952da83509ae1d4cc72311f8073e165e0 --- /dev/null +++ b/codenet/public_test_cases/p03078/output.3.txt @@ -0,0 +1,5 @@ +400 +310 +310 +301 +301 diff --git a/codenet/public_test_cases/p03079/input.0.txt b/codenet/public_test_cases/p03079/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p03079/input.0.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p03079/input.1.txt b/codenet/public_test_cases/p03079/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p03079/input.1.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p03079/input.2.txt b/codenet/public_test_cases/p03079/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..02c7bd24aa45794a7dcca4b690e2437e7f9b2e48 --- /dev/null +++ b/codenet/public_test_cases/p03079/input.2.txt @@ -0,0 +1 @@ +3 4 5 diff --git a/codenet/public_test_cases/p03079/output.0.txt b/codenet/public_test_cases/p03079/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03079/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03079/output.1.txt b/codenet/public_test_cases/p03079/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03079/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03079/output.2.txt b/codenet/public_test_cases/p03079/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03079/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03080/input.0.txt b/codenet/public_test_cases/p03080/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f3d2d59f3e61f6875c9129509ee39857b38da41 --- /dev/null +++ b/codenet/public_test_cases/p03080/input.0.txt @@ -0,0 +1,2 @@ +4 +RRBR diff --git a/codenet/public_test_cases/p03080/input.1.txt b/codenet/public_test_cases/p03080/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f3d2d59f3e61f6875c9129509ee39857b38da41 --- /dev/null +++ b/codenet/public_test_cases/p03080/input.1.txt @@ -0,0 +1,2 @@ +4 +RRBR diff --git a/codenet/public_test_cases/p03080/input.2.txt b/codenet/public_test_cases/p03080/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f4648c519f0fde8fee0aa3cd776eb974fa5d57a --- /dev/null +++ b/codenet/public_test_cases/p03080/input.2.txt @@ -0,0 +1,2 @@ +4 +BRBR diff --git a/codenet/public_test_cases/p03080/output.0.txt b/codenet/public_test_cases/p03080/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03080/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03080/output.1.txt b/codenet/public_test_cases/p03080/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03080/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03080/output.2.txt b/codenet/public_test_cases/p03080/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03080/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03081/input.0.txt b/codenet/public_test_cases/p03081/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..26ee8898878ad1cb3def06ef08cc7c03fae325cd --- /dev/null +++ b/codenet/public_test_cases/p03081/input.0.txt @@ -0,0 +1,6 @@ +3 4 +ABC +A L +B L +B R +A R diff --git a/codenet/public_test_cases/p03081/input.1.txt b/codenet/public_test_cases/p03081/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0165d1a0b537b47e14e1e4cf42a0c91abbc66150 --- /dev/null +++ b/codenet/public_test_cases/p03081/input.1.txt @@ -0,0 +1,17 @@ +10 15 +SNCZWRCEWB +B R +R R +E R +W R +Z L +S R +Q L +W L +B R +C L +A L +N L +E R +Z L +S L diff --git a/codenet/public_test_cases/p03081/input.2.txt b/codenet/public_test_cases/p03081/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..26ee8898878ad1cb3def06ef08cc7c03fae325cd --- /dev/null +++ b/codenet/public_test_cases/p03081/input.2.txt @@ -0,0 +1,6 @@ +3 4 +ABC +A L +B L +B R +A R diff --git a/codenet/public_test_cases/p03081/input.3.txt b/codenet/public_test_cases/p03081/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ef11d2958592944ced84aa7df2261275c0f6090 --- /dev/null +++ b/codenet/public_test_cases/p03081/input.3.txt @@ -0,0 +1,5 @@ +8 3 +AABCBDBA +A L +B R +A R diff --git a/codenet/public_test_cases/p03081/output.0.txt b/codenet/public_test_cases/p03081/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03081/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03081/output.1.txt b/codenet/public_test_cases/p03081/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03081/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03081/output.2.txt b/codenet/public_test_cases/p03081/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03081/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03081/output.3.txt b/codenet/public_test_cases/p03081/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03081/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03082/input.0.txt b/codenet/public_test_cases/p03082/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..637344812d6d9a8c5984c036235a9b9cb5435956 --- /dev/null +++ b/codenet/public_test_cases/p03082/input.0.txt @@ -0,0 +1,2 @@ +2 19 +3 7 diff --git a/codenet/public_test_cases/p03082/input.1.txt b/codenet/public_test_cases/p03082/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7012ad0b360d127d887e70721095fb9b074e3e1f --- /dev/null +++ b/codenet/public_test_cases/p03082/input.1.txt @@ -0,0 +1,2 @@ +5 82 +22 11 6 5 13 diff --git a/codenet/public_test_cases/p03082/input.2.txt b/codenet/public_test_cases/p03082/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2e047ec05e64e907ae1a6ec2f6d6330cb49edab --- /dev/null +++ b/codenet/public_test_cases/p03082/input.2.txt @@ -0,0 +1,2 @@ +10 100000 +50000 50001 50002 50003 50004 50005 50006 50007 50008 50009 diff --git a/codenet/public_test_cases/p03082/input.3.txt b/codenet/public_test_cases/p03082/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..637344812d6d9a8c5984c036235a9b9cb5435956 --- /dev/null +++ b/codenet/public_test_cases/p03082/input.3.txt @@ -0,0 +1,2 @@ +2 19 +3 7 diff --git a/codenet/public_test_cases/p03082/output.0.txt b/codenet/public_test_cases/p03082/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03082/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03082/output.1.txt b/codenet/public_test_cases/p03082/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea809473360353797c26dc0220e70087639dfe54 --- /dev/null +++ b/codenet/public_test_cases/p03082/output.1.txt @@ -0,0 +1 @@ +288 diff --git a/codenet/public_test_cases/p03082/output.2.txt b/codenet/public_test_cases/p03082/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f2d145e72bdecc0b401896cafd006ccda60baba --- /dev/null +++ b/codenet/public_test_cases/p03082/output.2.txt @@ -0,0 +1 @@ +279669259 diff --git a/codenet/public_test_cases/p03082/output.3.txt b/codenet/public_test_cases/p03082/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03082/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03083/input.0.txt b/codenet/public_test_cases/p03083/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03083/input.0.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03083/input.1.txt b/codenet/public_test_cases/p03083/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03083/input.1.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03083/input.2.txt b/codenet/public_test_cases/p03083/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03083/input.2.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03083/input.3.txt b/codenet/public_test_cases/p03083/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c7907f9ed995225a618e238435cf68b9cf6cd06 --- /dev/null +++ b/codenet/public_test_cases/p03083/input.3.txt @@ -0,0 +1 @@ +6 9 diff --git a/codenet/public_test_cases/p03083/output.0.txt b/codenet/public_test_cases/p03083/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d79044fed13f187aae46280881cc1dfd0a90befe --- /dev/null +++ b/codenet/public_test_cases/p03083/output.0.txt @@ -0,0 +1,3 @@ +500000004 +750000006 +750000006 diff --git a/codenet/public_test_cases/p03083/output.1.txt b/codenet/public_test_cases/p03083/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d79044fed13f187aae46280881cc1dfd0a90befe --- /dev/null +++ b/codenet/public_test_cases/p03083/output.1.txt @@ -0,0 +1,3 @@ +500000004 +750000006 +750000006 diff --git a/codenet/public_test_cases/p03083/output.2.txt b/codenet/public_test_cases/p03083/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2879cdec5fe970c9ee09b9026bcef7862dd770a --- /dev/null +++ b/codenet/public_test_cases/p03083/output.2.txt @@ -0,0 +1,5 @@ +500000004 +500000004 +625000005 +187500002 +187500002 diff --git a/codenet/public_test_cases/p03083/output.3.txt b/codenet/public_test_cases/p03083/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4512b4d5ef72bfda1d63d7268d2b0004e5d780a0 --- /dev/null +++ b/codenet/public_test_cases/p03083/output.3.txt @@ -0,0 +1,15 @@ +500000004 +500000004 +500000004 +500000004 +500000004 +500000004 +929687507 +218750002 +224609377 +303710940 +633300786 +694091802 +172485353 +411682132 +411682132 diff --git a/codenet/public_test_cases/p03084/input.0.txt b/codenet/public_test_cases/p03084/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..124ae5876ee3dbe4e80464cef3c01a9f85af18dc --- /dev/null +++ b/codenet/public_test_cases/p03084/input.0.txt @@ -0,0 +1,7 @@ +4 5 4 +EEWW +NSNNS +4 1 1 4 +1 3 1 2 +4 2 3 2 +3 3 3 5 diff --git a/codenet/public_test_cases/p03084/input.1.txt b/codenet/public_test_cases/p03084/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ec3c4343b8817224c8ce89b0e14c26cf6860d15 --- /dev/null +++ b/codenet/public_test_cases/p03084/input.1.txt @@ -0,0 +1,13 @@ +9 7 10 +EEEEEWEWW +NSSSNSN +4 6 9 2 +3 7 6 7 +7 5 3 5 +1 1 8 1 +4 3 5 4 +7 4 6 4 +2 5 8 6 +6 6 2 7 +2 4 7 5 +7 2 9 7 diff --git a/codenet/public_test_cases/p03084/input.2.txt b/codenet/public_test_cases/p03084/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..124ae5876ee3dbe4e80464cef3c01a9f85af18dc --- /dev/null +++ b/codenet/public_test_cases/p03084/input.2.txt @@ -0,0 +1,7 @@ +4 5 4 +EEWW +NSNNS +4 1 1 4 +1 3 1 2 +4 2 3 2 +3 3 3 5 diff --git a/codenet/public_test_cases/p03084/input.3.txt b/codenet/public_test_cases/p03084/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..91f25b2d19c26b99661914c0c01adcd4c52f1248 --- /dev/null +++ b/codenet/public_test_cases/p03084/input.3.txt @@ -0,0 +1,5 @@ +3 3 2 +EEE +SSS +1 1 3 3 +3 3 1 1 diff --git a/codenet/public_test_cases/p03084/output.0.txt b/codenet/public_test_cases/p03084/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cb446e8d6528a9203815cd9e4d12245d3350a57 --- /dev/null +++ b/codenet/public_test_cases/p03084/output.0.txt @@ -0,0 +1,4 @@ +6 +11 +5 +4 diff --git a/codenet/public_test_cases/p03084/output.1.txt b/codenet/public_test_cases/p03084/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..20129a945cb6b75f8b4dcf20f1c1b75ed0def762 --- /dev/null +++ b/codenet/public_test_cases/p03084/output.1.txt @@ -0,0 +1,10 @@ +9 +-1 +4 +9 +2 +3 +7 +7 +6 +-1 diff --git a/codenet/public_test_cases/p03084/output.2.txt b/codenet/public_test_cases/p03084/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cb446e8d6528a9203815cd9e4d12245d3350a57 --- /dev/null +++ b/codenet/public_test_cases/p03084/output.2.txt @@ -0,0 +1,4 @@ +6 +11 +5 +4 diff --git a/codenet/public_test_cases/p03084/output.3.txt b/codenet/public_test_cases/p03084/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..058d0bb3afef67d72e3bf618b902963cf82bfddc --- /dev/null +++ b/codenet/public_test_cases/p03084/output.3.txt @@ -0,0 +1,2 @@ +4 +-1 diff --git a/codenet/public_test_cases/p03085/input.0.txt b/codenet/public_test_cases/p03085/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70f10e4db19068f79bc43844b49f3eece45c4e8 --- /dev/null +++ b/codenet/public_test_cases/p03085/input.0.txt @@ -0,0 +1 @@ +A diff --git a/codenet/public_test_cases/p03085/input.1.txt b/codenet/public_test_cases/p03085/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd7923529855d0b274795ae3349c5e0438333979 --- /dev/null +++ b/codenet/public_test_cases/p03085/input.1.txt @@ -0,0 +1 @@ +G diff --git a/codenet/public_test_cases/p03085/input.2.txt b/codenet/public_test_cases/p03085/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70f10e4db19068f79bc43844b49f3eece45c4e8 --- /dev/null +++ b/codenet/public_test_cases/p03085/input.2.txt @@ -0,0 +1 @@ +A diff --git a/codenet/public_test_cases/p03085/output.0.txt b/codenet/public_test_cases/p03085/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62a6e3c9dfcb5f2a009cb85d9562145c1ea803a1 --- /dev/null +++ b/codenet/public_test_cases/p03085/output.0.txt @@ -0,0 +1 @@ +T diff --git a/codenet/public_test_cases/p03085/output.1.txt b/codenet/public_test_cases/p03085/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cc58df83752123644fef39faab2393af643b1d2 --- /dev/null +++ b/codenet/public_test_cases/p03085/output.1.txt @@ -0,0 +1 @@ +C diff --git a/codenet/public_test_cases/p03085/output.2.txt b/codenet/public_test_cases/p03085/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..62a6e3c9dfcb5f2a009cb85d9562145c1ea803a1 --- /dev/null +++ b/codenet/public_test_cases/p03085/output.2.txt @@ -0,0 +1 @@ +T diff --git a/codenet/public_test_cases/p03086/input.0.txt b/codenet/public_test_cases/p03086/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..24a97f07bc4971b4bf4eb03a16a99832b0722d9f --- /dev/null +++ b/codenet/public_test_cases/p03086/input.0.txt @@ -0,0 +1 @@ +ATCODER diff --git a/codenet/public_test_cases/p03086/input.1.txt b/codenet/public_test_cases/p03086/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..659dd27e7d11dddd8421167ce2b789f713ae377a --- /dev/null +++ b/codenet/public_test_cases/p03086/input.1.txt @@ -0,0 +1 @@ +SHINJUKU diff --git a/codenet/public_test_cases/p03086/input.2.txt b/codenet/public_test_cases/p03086/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..24a97f07bc4971b4bf4eb03a16a99832b0722d9f --- /dev/null +++ b/codenet/public_test_cases/p03086/input.2.txt @@ -0,0 +1 @@ +ATCODER diff --git a/codenet/public_test_cases/p03086/input.3.txt b/codenet/public_test_cases/p03086/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a0c57d389956deffd198d5c33ece11971144b77 --- /dev/null +++ b/codenet/public_test_cases/p03086/input.3.txt @@ -0,0 +1 @@ +HATAGAYA diff --git a/codenet/public_test_cases/p03086/output.0.txt b/codenet/public_test_cases/p03086/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03086/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03086/output.1.txt b/codenet/public_test_cases/p03086/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03086/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03086/output.2.txt b/codenet/public_test_cases/p03086/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03086/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03086/output.3.txt b/codenet/public_test_cases/p03086/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03086/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03087/input.0.txt b/codenet/public_test_cases/p03087/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd639bc7c086ad335f9ada6093252e1c32645280 --- /dev/null +++ b/codenet/public_test_cases/p03087/input.0.txt @@ -0,0 +1,5 @@ +8 3 +ACACTACG +3 7 +2 3 +1 8 diff --git a/codenet/public_test_cases/p03087/input.1.txt b/codenet/public_test_cases/p03087/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd639bc7c086ad335f9ada6093252e1c32645280 --- /dev/null +++ b/codenet/public_test_cases/p03087/input.1.txt @@ -0,0 +1,5 @@ +8 3 +ACACTACG +3 7 +2 3 +1 8 diff --git a/codenet/public_test_cases/p03087/output.0.txt b/codenet/public_test_cases/p03087/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08287418d28be82b43eb2f9c0cc7e159010e2461 --- /dev/null +++ b/codenet/public_test_cases/p03087/output.0.txt @@ -0,0 +1,3 @@ +2 +0 +3 diff --git a/codenet/public_test_cases/p03087/output.1.txt b/codenet/public_test_cases/p03087/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08287418d28be82b43eb2f9c0cc7e159010e2461 --- /dev/null +++ b/codenet/public_test_cases/p03087/output.1.txt @@ -0,0 +1,3 @@ +2 +0 +3 diff --git a/codenet/public_test_cases/p03088/input.0.txt b/codenet/public_test_cases/p03088/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03088/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03088/input.1.txt b/codenet/public_test_cases/p03088/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03088/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03088/input.2.txt b/codenet/public_test_cases/p03088/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03088/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03088/input.3.txt b/codenet/public_test_cases/p03088/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03088/input.3.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03088/output.0.txt b/codenet/public_test_cases/p03088/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1e7d265fcc1d93320d7446fa1755892417f1f90 --- /dev/null +++ b/codenet/public_test_cases/p03088/output.0.txt @@ -0,0 +1 @@ +61 diff --git a/codenet/public_test_cases/p03088/output.1.txt b/codenet/public_test_cases/p03088/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcb6b5baa1d74755be849bad4c15f5b269ef4b4c --- /dev/null +++ b/codenet/public_test_cases/p03088/output.1.txt @@ -0,0 +1 @@ +230 diff --git a/codenet/public_test_cases/p03088/output.2.txt b/codenet/public_test_cases/p03088/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1e7d265fcc1d93320d7446fa1755892417f1f90 --- /dev/null +++ b/codenet/public_test_cases/p03088/output.2.txt @@ -0,0 +1 @@ +61 diff --git a/codenet/public_test_cases/p03088/output.3.txt b/codenet/public_test_cases/p03088/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..56afcd64a4b7458522f8c46f812073fa1ddd5360 --- /dev/null +++ b/codenet/public_test_cases/p03088/output.3.txt @@ -0,0 +1 @@ +388130742 diff --git a/codenet/public_test_cases/p03089/input.0.txt b/codenet/public_test_cases/p03089/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56221aadc5dfac666c62fd57ad1536458c512851 --- /dev/null +++ b/codenet/public_test_cases/p03089/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 1 diff --git a/codenet/public_test_cases/p03089/input.1.txt b/codenet/public_test_cases/p03089/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2e8289164b89838ea6491b122ffe34d86681b7d --- /dev/null +++ b/codenet/public_test_cases/p03089/input.1.txt @@ -0,0 +1,2 @@ +9 +1 1 1 2 2 1 2 3 2 diff --git a/codenet/public_test_cases/p03089/input.2.txt b/codenet/public_test_cases/p03089/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d7778566a9ec2edc1aef3405376f39389487c9f --- /dev/null +++ b/codenet/public_test_cases/p03089/input.2.txt @@ -0,0 +1,2 @@ +2 +2 2 diff --git a/codenet/public_test_cases/p03089/input.3.txt b/codenet/public_test_cases/p03089/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..56221aadc5dfac666c62fd57ad1536458c512851 --- /dev/null +++ b/codenet/public_test_cases/p03089/input.3.txt @@ -0,0 +1,2 @@ +3 +1 2 1 diff --git a/codenet/public_test_cases/p03089/output.0.txt b/codenet/public_test_cases/p03089/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..33280629d45d42f53ada4c621ad788fb72c9c09c --- /dev/null +++ b/codenet/public_test_cases/p03089/output.0.txt @@ -0,0 +1,3 @@ +1 +1 +2 diff --git a/codenet/public_test_cases/p03089/output.1.txt b/codenet/public_test_cases/p03089/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f16845bee17ab9ed7d3f538b17d86871da75d3c --- /dev/null +++ b/codenet/public_test_cases/p03089/output.1.txt @@ -0,0 +1,9 @@ +1 +2 +2 +3 +1 +2 +2 +1 +1 diff --git a/codenet/public_test_cases/p03089/output.2.txt b/codenet/public_test_cases/p03089/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03089/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03089/output.3.txt b/codenet/public_test_cases/p03089/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..33280629d45d42f53ada4c621ad788fb72c9c09c --- /dev/null +++ b/codenet/public_test_cases/p03089/output.3.txt @@ -0,0 +1,3 @@ +1 +1 +2 diff --git a/codenet/public_test_cases/p03090/input.0.txt b/codenet/public_test_cases/p03090/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03090/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03090/input.1.txt b/codenet/public_test_cases/p03090/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03090/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03090/output.0.txt b/codenet/public_test_cases/p03090/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfb186712c0b1893a63d8206c742242b978cd79 --- /dev/null +++ b/codenet/public_test_cases/p03090/output.0.txt @@ -0,0 +1,3 @@ +2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03090/output.1.txt b/codenet/public_test_cases/p03090/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dfb186712c0b1893a63d8206c742242b978cd79 --- /dev/null +++ b/codenet/public_test_cases/p03090/output.1.txt @@ -0,0 +1,3 @@ +2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03091/input.0.txt b/codenet/public_test_cases/p03091/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc7c032462e24ff6c861dffee0e5d2c0cefe3c85 --- /dev/null +++ b/codenet/public_test_cases/p03091/input.0.txt @@ -0,0 +1,10 @@ +7 9 +1 2 +1 3 +2 3 +1 4 +1 5 +4 5 +1 6 +1 7 +6 7 diff --git a/codenet/public_test_cases/p03091/input.1.txt b/codenet/public_test_cases/p03091/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57b9c358b596a57fe065011680d481a8d16e7691 --- /dev/null +++ b/codenet/public_test_cases/p03091/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p03091/input.2.txt b/codenet/public_test_cases/p03091/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd866ab6e7089c725498e49d025a3778e4824da7 --- /dev/null +++ b/codenet/public_test_cases/p03091/input.2.txt @@ -0,0 +1,28 @@ +18 27 +17 7 +12 15 +18 17 +13 18 +13 6 +5 7 +7 1 +14 5 +15 11 +7 6 +1 9 +5 4 +18 16 +4 6 +7 2 +7 11 +6 3 +12 14 +5 2 +10 5 +7 8 +10 15 +3 15 +9 8 +7 15 +5 16 +18 15 diff --git a/codenet/public_test_cases/p03091/input.3.txt b/codenet/public_test_cases/p03091/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc7c032462e24ff6c861dffee0e5d2c0cefe3c85 --- /dev/null +++ b/codenet/public_test_cases/p03091/input.3.txt @@ -0,0 +1,10 @@ +7 9 +1 2 +1 3 +2 3 +1 4 +1 5 +4 5 +1 6 +1 7 +6 7 diff --git a/codenet/public_test_cases/p03091/output.0.txt b/codenet/public_test_cases/p03091/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03091/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03091/output.1.txt b/codenet/public_test_cases/p03091/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03091/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03091/output.2.txt b/codenet/public_test_cases/p03091/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03091/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03091/output.3.txt b/codenet/public_test_cases/p03091/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03091/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03092/input.0.txt b/codenet/public_test_cases/p03092/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..67d78da0564f7a763142a75545d6ba7cb74e36b4 --- /dev/null +++ b/codenet/public_test_cases/p03092/input.0.txt @@ -0,0 +1,2 @@ +3 20 30 +3 1 2 diff --git a/codenet/public_test_cases/p03092/input.1.txt b/codenet/public_test_cases/p03092/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67d78da0564f7a763142a75545d6ba7cb74e36b4 --- /dev/null +++ b/codenet/public_test_cases/p03092/input.1.txt @@ -0,0 +1,2 @@ +3 20 30 +3 1 2 diff --git a/codenet/public_test_cases/p03092/input.2.txt b/codenet/public_test_cases/p03092/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..52ad3dc385cce533838bb70596a2eeb288d752c8 --- /dev/null +++ b/codenet/public_test_cases/p03092/input.2.txt @@ -0,0 +1,2 @@ +1 10 10 +1 diff --git a/codenet/public_test_cases/p03092/input.3.txt b/codenet/public_test_cases/p03092/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bd555e8012f777137d5c8e1ba73a5e738e8250e --- /dev/null +++ b/codenet/public_test_cases/p03092/input.3.txt @@ -0,0 +1,2 @@ +4 20 30 +4 2 3 1 diff --git a/codenet/public_test_cases/p03092/input.4.txt b/codenet/public_test_cases/p03092/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d71a6310724355204956726f91571b541b37a3c4 --- /dev/null +++ b/codenet/public_test_cases/p03092/input.4.txt @@ -0,0 +1,2 @@ +4 1000000000 1000000000 +4 3 2 1 diff --git a/codenet/public_test_cases/p03092/input.5.txt b/codenet/public_test_cases/p03092/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ee106baf968b8a2014ab422596297a4664af54b --- /dev/null +++ b/codenet/public_test_cases/p03092/input.5.txt @@ -0,0 +1,2 @@ +9 40 50 +5 3 4 7 6 1 2 9 8 diff --git a/codenet/public_test_cases/p03092/output.0.txt b/codenet/public_test_cases/p03092/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03092/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03092/output.1.txt b/codenet/public_test_cases/p03092/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03092/output.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03092/output.2.txt b/codenet/public_test_cases/p03092/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03092/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03092/output.3.txt b/codenet/public_test_cases/p03092/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p03092/output.3.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p03092/output.4.txt b/codenet/public_test_cases/p03092/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1911b6e1e0b6ba372db173e7dcb15d7f609827d2 --- /dev/null +++ b/codenet/public_test_cases/p03092/output.4.txt @@ -0,0 +1 @@ +3000000000 diff --git a/codenet/public_test_cases/p03092/output.5.txt b/codenet/public_test_cases/p03092/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d4c7bfe8ef4faa50e08985a712bd8d8a36ffdda --- /dev/null +++ b/codenet/public_test_cases/p03092/output.5.txt @@ -0,0 +1 @@ +220 diff --git a/codenet/public_test_cases/p03093/input.0.txt b/codenet/public_test_cases/p03093/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..331594101ada37ac39c8e408c1eb6d0a87518a7f --- /dev/null +++ b/codenet/public_test_cases/p03093/input.0.txt @@ -0,0 +1,2 @@ +3 10 +0 2 3 4 5 9 diff --git a/codenet/public_test_cases/p03093/input.1.txt b/codenet/public_test_cases/p03093/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..331594101ada37ac39c8e408c1eb6d0a87518a7f --- /dev/null +++ b/codenet/public_test_cases/p03093/input.1.txt @@ -0,0 +1,2 @@ +3 10 +0 2 3 4 5 9 diff --git a/codenet/public_test_cases/p03093/input.2.txt b/codenet/public_test_cases/p03093/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..546f39af0052f80336d8dfab8f67f24287ed4d23 --- /dev/null +++ b/codenet/public_test_cases/p03093/input.2.txt @@ -0,0 +1,2 @@ +2 10 +1 9 1 9 diff --git a/codenet/public_test_cases/p03093/output.0.txt b/codenet/public_test_cases/p03093/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03093/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03093/output.1.txt b/codenet/public_test_cases/p03093/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03093/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03093/output.2.txt b/codenet/public_test_cases/p03093/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03093/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03094/input.0.txt b/codenet/public_test_cases/p03094/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03094/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03094/input.1.txt b/codenet/public_test_cases/p03094/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03094/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03094/input.2.txt b/codenet/public_test_cases/p03094/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03094/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03094/input.3.txt b/codenet/public_test_cases/p03094/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03094/input.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03094/input.4.txt b/codenet/public_test_cases/p03094/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..749fce669df1b51cae4a71dc130b2a14807829f0 --- /dev/null +++ b/codenet/public_test_cases/p03094/input.4.txt @@ -0,0 +1 @@ +1000000 diff --git a/codenet/public_test_cases/p03094/output.0.txt b/codenet/public_test_cases/p03094/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..86f97d5c572be2495d1f70ac027af1ce3001f802 --- /dev/null +++ b/codenet/public_test_cases/p03094/output.0.txt @@ -0,0 +1 @@ +138888890 diff --git a/codenet/public_test_cases/p03094/output.1.txt b/codenet/public_test_cases/p03094/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86f97d5c572be2495d1f70ac027af1ce3001f802 --- /dev/null +++ b/codenet/public_test_cases/p03094/output.1.txt @@ -0,0 +1 @@ +138888890 diff --git a/codenet/public_test_cases/p03094/output.2.txt b/codenet/public_test_cases/p03094/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cc35fa25e91c8acaa6e137d19721b78fabc92f7 --- /dev/null +++ b/codenet/public_test_cases/p03094/output.2.txt @@ -0,0 +1 @@ +179012347 diff --git a/codenet/public_test_cases/p03094/output.3.txt b/codenet/public_test_cases/p03094/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..95e0a2a1894fc384d01fded66c407aafe01c8ec3 --- /dev/null +++ b/codenet/public_test_cases/p03094/output.3.txt @@ -0,0 +1 @@ +954859137 diff --git a/codenet/public_test_cases/p03094/output.4.txt b/codenet/public_test_cases/p03094/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3b051bf2308a50e21a4ea5ce3d4d72b7e44c56b --- /dev/null +++ b/codenet/public_test_cases/p03094/output.4.txt @@ -0,0 +1 @@ +44679646 diff --git a/codenet/public_test_cases/p03095/input.0.txt b/codenet/public_test_cases/p03095/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55bd2ec8418d7871f5ca717e38518326f6ef844f --- /dev/null +++ b/codenet/public_test_cases/p03095/input.0.txt @@ -0,0 +1,2 @@ +4 +abcd diff --git a/codenet/public_test_cases/p03095/input.1.txt b/codenet/public_test_cases/p03095/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f87feae531f3ee34b7c2a81fa64904cc8c78b6f --- /dev/null +++ b/codenet/public_test_cases/p03095/input.1.txt @@ -0,0 +1,2 @@ +3 +baa diff --git a/codenet/public_test_cases/p03095/input.2.txt b/codenet/public_test_cases/p03095/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..55bd2ec8418d7871f5ca717e38518326f6ef844f --- /dev/null +++ b/codenet/public_test_cases/p03095/input.2.txt @@ -0,0 +1,2 @@ +4 +abcd diff --git a/codenet/public_test_cases/p03095/input.3.txt b/codenet/public_test_cases/p03095/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb509d63d6346835b57c469092b38759c3e6fd33 --- /dev/null +++ b/codenet/public_test_cases/p03095/input.3.txt @@ -0,0 +1,2 @@ +5 +abcab diff --git a/codenet/public_test_cases/p03095/output.0.txt b/codenet/public_test_cases/p03095/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03095/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03095/output.1.txt b/codenet/public_test_cases/p03095/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03095/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03095/output.2.txt b/codenet/public_test_cases/p03095/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03095/output.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03095/output.3.txt b/codenet/public_test_cases/p03095/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p03095/output.3.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p03096/input.0.txt b/codenet/public_test_cases/p03096/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b377a72858ea907ce6abf34d038d2f23c4a871d7 --- /dev/null +++ b/codenet/public_test_cases/p03096/input.0.txt @@ -0,0 +1,6 @@ +5 +1 +2 +1 +2 +2 diff --git a/codenet/public_test_cases/p03096/input.1.txt b/codenet/public_test_cases/p03096/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0665c196b68df48210c6304b744ba21d9994a78b --- /dev/null +++ b/codenet/public_test_cases/p03096/input.1.txt @@ -0,0 +1,7 @@ +6 +4 +2 +5 +4 +2 +4 diff --git a/codenet/public_test_cases/p03096/input.2.txt b/codenet/public_test_cases/p03096/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b377a72858ea907ce6abf34d038d2f23c4a871d7 --- /dev/null +++ b/codenet/public_test_cases/p03096/input.2.txt @@ -0,0 +1,6 @@ +5 +1 +2 +1 +2 +2 diff --git a/codenet/public_test_cases/p03096/input.3.txt b/codenet/public_test_cases/p03096/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7673d21e6c6596af50de601bac119adc5501f4d --- /dev/null +++ b/codenet/public_test_cases/p03096/input.3.txt @@ -0,0 +1,8 @@ +7 +1 +3 +1 +2 +3 +3 +2 diff --git a/codenet/public_test_cases/p03096/output.0.txt b/codenet/public_test_cases/p03096/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03096/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03096/output.1.txt b/codenet/public_test_cases/p03096/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03096/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03096/output.2.txt b/codenet/public_test_cases/p03096/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03096/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03096/output.3.txt b/codenet/public_test_cases/p03096/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03096/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03097/input.0.txt b/codenet/public_test_cases/p03097/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaee162b8456e2053528a953d12c3db963e8c3b0 --- /dev/null +++ b/codenet/public_test_cases/p03097/input.0.txt @@ -0,0 +1 @@ +2 1 3 diff --git a/codenet/public_test_cases/p03097/input.1.txt b/codenet/public_test_cases/p03097/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d03090e700f3bac824c9d4299ee554a97e685319 --- /dev/null +++ b/codenet/public_test_cases/p03097/input.1.txt @@ -0,0 +1 @@ +3 2 1 diff --git a/codenet/public_test_cases/p03097/input.2.txt b/codenet/public_test_cases/p03097/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaee162b8456e2053528a953d12c3db963e8c3b0 --- /dev/null +++ b/codenet/public_test_cases/p03097/input.2.txt @@ -0,0 +1 @@ +2 1 3 diff --git a/codenet/public_test_cases/p03097/output.0.txt b/codenet/public_test_cases/p03097/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d84c1c6dfb87b0d04c517baeb1ba9c8fee9a263a --- /dev/null +++ b/codenet/public_test_cases/p03097/output.0.txt @@ -0,0 +1,2 @@ +YES +1 0 2 3 diff --git a/codenet/public_test_cases/p03097/output.1.txt b/codenet/public_test_cases/p03097/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03097/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03097/output.2.txt b/codenet/public_test_cases/p03097/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d84c1c6dfb87b0d04c517baeb1ba9c8fee9a263a --- /dev/null +++ b/codenet/public_test_cases/p03097/output.2.txt @@ -0,0 +1,2 @@ +YES +1 0 2 3 diff --git a/codenet/public_test_cases/p03098/input.0.txt b/codenet/public_test_cases/p03098/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc0cbb1a07437001076deac4a5fc42e49ae4a9c6 --- /dev/null +++ b/codenet/public_test_cases/p03098/input.0.txt @@ -0,0 +1,3 @@ +3 3 +1 2 3 +3 2 1 diff --git a/codenet/public_test_cases/p03098/input.1.txt b/codenet/public_test_cases/p03098/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..72007f78ac35af6374ea41cd29dcfa4b098361bd --- /dev/null +++ b/codenet/public_test_cases/p03098/input.1.txt @@ -0,0 +1,3 @@ +5 5 +4 5 1 2 3 +3 2 1 5 4 diff --git a/codenet/public_test_cases/p03098/input.2.txt b/codenet/public_test_cases/p03098/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe7887ff827aef1b83d52f1794f6677ea3ca670 --- /dev/null +++ b/codenet/public_test_cases/p03098/input.2.txt @@ -0,0 +1,3 @@ +10 1000000000 +7 10 6 5 4 2 9 1 3 8 +4 1 9 2 3 7 8 10 6 5 diff --git a/codenet/public_test_cases/p03098/input.3.txt b/codenet/public_test_cases/p03098/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc0cbb1a07437001076deac4a5fc42e49ae4a9c6 --- /dev/null +++ b/codenet/public_test_cases/p03098/input.3.txt @@ -0,0 +1,3 @@ +3 3 +1 2 3 +3 2 1 diff --git a/codenet/public_test_cases/p03098/output.0.txt b/codenet/public_test_cases/p03098/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d03090e700f3bac824c9d4299ee554a97e685319 --- /dev/null +++ b/codenet/public_test_cases/p03098/output.0.txt @@ -0,0 +1 @@ +3 2 1 diff --git a/codenet/public_test_cases/p03098/output.1.txt b/codenet/public_test_cases/p03098/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c1eb6ef709edd705830a19470ea41a9cd0f3ce1 --- /dev/null +++ b/codenet/public_test_cases/p03098/output.1.txt @@ -0,0 +1 @@ +4 3 2 1 5 diff --git a/codenet/public_test_cases/p03098/output.2.txt b/codenet/public_test_cases/p03098/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6cecb05b56724b04aa16a546489b067c6a4e1ff --- /dev/null +++ b/codenet/public_test_cases/p03098/output.2.txt @@ -0,0 +1 @@ +7 9 4 8 2 5 1 6 10 3 diff --git a/codenet/public_test_cases/p03098/output.3.txt b/codenet/public_test_cases/p03098/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d03090e700f3bac824c9d4299ee554a97e685319 --- /dev/null +++ b/codenet/public_test_cases/p03098/output.3.txt @@ -0,0 +1 @@ +3 2 1 diff --git a/codenet/public_test_cases/p03099/input.0.txt b/codenet/public_test_cases/p03099/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f87f2280b7b7f980404de833845891d469d11486 --- /dev/null +++ b/codenet/public_test_cases/p03099/input.0.txt @@ -0,0 +1,13 @@ +7 +1 3 6 +1 5 9 +3 1 8 +4 3 8 +6 2 9 +5 4 11 +5 7 10 +4 +L 3 1 +R 2 3 +D 5 3 +U 4 2 diff --git a/codenet/public_test_cases/p03099/input.1.txt b/codenet/public_test_cases/p03099/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb14f3a021b96dcfd9a0c812556bbf4191472b77 --- /dev/null +++ b/codenet/public_test_cases/p03099/input.1.txt @@ -0,0 +1,33 @@ +10 +66 47 71040136000 +65 77 74799603000 +80 53 91192869000 +24 34 24931901000 +91 78 49867703000 +68 71 46108236000 +46 73 74799603000 +56 63 93122668000 +32 51 71030136000 +51 26 70912345000 +21 +L 51 1 +L 7 0 +U 47 4 +R 92 0 +R 91 1 +D 53 2 +R 65 3 +D 13 0 +U 63 3 +L 68 3 +D 47 1 +L 91 5 +R 32 4 +L 66 2 +L 80 4 +D 77 4 +U 73 1 +D 78 5 +U 26 5 +R 80 2 +R 24 5 diff --git a/codenet/public_test_cases/p03099/input.2.txt b/codenet/public_test_cases/p03099/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..69df9df2cefc991810252a44f611196e5cb22d7e --- /dev/null +++ b/codenet/public_test_cases/p03099/input.2.txt @@ -0,0 +1,6 @@ +3 +1 2 3 +4 5 6 +7 8 9 +1 +L 100 0 diff --git a/codenet/public_test_cases/p03099/input.3.txt b/codenet/public_test_cases/p03099/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec41471b15d92f245eebdad0fec894e471a3339a --- /dev/null +++ b/codenet/public_test_cases/p03099/input.3.txt @@ -0,0 +1,9 @@ +4 +1 1 10 +1 2 11 +2 1 12 +2 2 13 +3 +L 8 3 +L 9 2 +L 10 1 diff --git a/codenet/public_test_cases/p03099/input.4.txt b/codenet/public_test_cases/p03099/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f87f2280b7b7f980404de833845891d469d11486 --- /dev/null +++ b/codenet/public_test_cases/p03099/input.4.txt @@ -0,0 +1,13 @@ +7 +1 3 6 +1 5 9 +3 1 8 +4 3 8 +6 2 9 +5 4 11 +5 7 10 +4 +L 3 1 +R 2 3 +D 5 3 +U 4 2 diff --git a/codenet/public_test_cases/p03099/output.0.txt b/codenet/public_test_cases/p03099/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p03099/output.0.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p03099/output.1.txt b/codenet/public_test_cases/p03099/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c638b9f44c5693f1f2e0656b35e426927e4b9cb4 --- /dev/null +++ b/codenet/public_test_cases/p03099/output.1.txt @@ -0,0 +1 @@ +305223377000 diff --git a/codenet/public_test_cases/p03099/output.2.txt b/codenet/public_test_cases/p03099/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03099/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03099/output.3.txt b/codenet/public_test_cases/p03099/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03099/output.3.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03099/output.4.txt b/codenet/public_test_cases/p03099/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p03099/output.4.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p03100/input.0.txt b/codenet/public_test_cases/p03100/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..09186253b2aa8ea5158e8dd5dcabc7914f2dff0a --- /dev/null +++ b/codenet/public_test_cases/p03100/input.0.txt @@ -0,0 +1,5 @@ +3 2 2 2019 +1 2 1 +2 3 2 +1 3 5 +1 3 4 diff --git a/codenet/public_test_cases/p03100/input.1.txt b/codenet/public_test_cases/p03100/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..09186253b2aa8ea5158e8dd5dcabc7914f2dff0a --- /dev/null +++ b/codenet/public_test_cases/p03100/input.1.txt @@ -0,0 +1,5 @@ +3 2 2 2019 +1 2 1 +2 3 2 +1 3 5 +1 3 4 diff --git a/codenet/public_test_cases/p03100/input.2.txt b/codenet/public_test_cases/p03100/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8dbe44d92318188ed176eed533419fcc49ba41c --- /dev/null +++ b/codenet/public_test_cases/p03100/input.2.txt @@ -0,0 +1,6 @@ +1 2 3 25 +1 1 1 +1 1 2 +1 1 13 +1 1 6 +1 1 14 diff --git a/codenet/public_test_cases/p03100/input.3.txt b/codenet/public_test_cases/p03100/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c23280e2c86e54b9aeedfbe4b676e714f15c9226 --- /dev/null +++ b/codenet/public_test_cases/p03100/input.3.txt @@ -0,0 +1,26 @@ +10 15 10 15 +1 2 1 +2 3 6 +3 4 6 +2 5 1 +5 6 1 +4 7 6 +1 8 11 +2 9 6 +5 10 11 +9 10 11 +3 6 1 +2 5 1 +2 7 11 +9 10 11 +5 6 11 +1 3 5 +9 8 3 +7 7 7 +7 10 13 +4 1 10 +9 3 12 +10 10 14 +9 2 1 +6 6 5 +8 8 4 diff --git a/codenet/public_test_cases/p03100/input.4.txt b/codenet/public_test_cases/p03100/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..eba285110c2325c09c0710ce8a9a5ac737a012bd --- /dev/null +++ b/codenet/public_test_cases/p03100/input.4.txt @@ -0,0 +1,10 @@ +6 6 3 2019 +1 2 4 +2 3 4 +3 4 4 +4 5 4 +5 6 4 +6 1 4 +2 6 1110 +3 1 1111 +4 5 1112 diff --git a/codenet/public_test_cases/p03100/output.0.txt b/codenet/public_test_cases/p03100/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p03100/output.0.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p03100/output.1.txt b/codenet/public_test_cases/p03100/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..823d3f69d3a96f5f59af56f67d8b845e58a568f1 --- /dev/null +++ b/codenet/public_test_cases/p03100/output.1.txt @@ -0,0 +1,2 @@ +YES +NO diff --git a/codenet/public_test_cases/p03100/output.2.txt b/codenet/public_test_cases/p03100/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf934da2dcf5b6e3b25ae6bef0672ca197d67b66 --- /dev/null +++ b/codenet/public_test_cases/p03100/output.2.txt @@ -0,0 +1,3 @@ +YES +YES +YES diff --git a/codenet/public_test_cases/p03100/output.3.txt b/codenet/public_test_cases/p03100/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1a07e472e926597d95e15bfd746f38b8f493d5c --- /dev/null +++ b/codenet/public_test_cases/p03100/output.3.txt @@ -0,0 +1,10 @@ +YES +NO +NO +NO +NO +NO +NO +YES +YES +NO diff --git a/codenet/public_test_cases/p03100/output.4.txt b/codenet/public_test_cases/p03100/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6e03a3424cbc9fd3c1c5139fbef28b53ec422af --- /dev/null +++ b/codenet/public_test_cases/p03100/output.4.txt @@ -0,0 +1,3 @@ +YES +NO +NO diff --git a/codenet/public_test_cases/p03101/input.0.txt b/codenet/public_test_cases/p03101/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..735564ef4e99e0d6b0747d87932b5088397f9cb8 --- /dev/null +++ b/codenet/public_test_cases/p03101/input.0.txt @@ -0,0 +1,2 @@ +3 2 +2 1 diff --git a/codenet/public_test_cases/p03101/input.1.txt b/codenet/public_test_cases/p03101/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb17595f10b2a4ace1c379a7fa9b2645f9598836 --- /dev/null +++ b/codenet/public_test_cases/p03101/input.1.txt @@ -0,0 +1,2 @@ +2 4 +2 4 diff --git a/codenet/public_test_cases/p03101/input.2.txt b/codenet/public_test_cases/p03101/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7206222474955b4dbdb77160c53c04b77b3f3ab3 --- /dev/null +++ b/codenet/public_test_cases/p03101/input.2.txt @@ -0,0 +1,2 @@ +5 5 +2 3 diff --git a/codenet/public_test_cases/p03101/input.3.txt b/codenet/public_test_cases/p03101/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..735564ef4e99e0d6b0747d87932b5088397f9cb8 --- /dev/null +++ b/codenet/public_test_cases/p03101/input.3.txt @@ -0,0 +1,2 @@ +3 2 +2 1 diff --git a/codenet/public_test_cases/p03101/output.0.txt b/codenet/public_test_cases/p03101/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03101/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03101/output.1.txt b/codenet/public_test_cases/p03101/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03101/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03101/output.2.txt b/codenet/public_test_cases/p03101/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03101/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03101/output.3.txt b/codenet/public_test_cases/p03101/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03101/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03102/input.0.txt b/codenet/public_test_cases/p03102/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27c8ec24895a29225aa7108295dfab68361e7e89 --- /dev/null +++ b/codenet/public_test_cases/p03102/input.0.txt @@ -0,0 +1,4 @@ +2 3 -10 +1 2 3 +3 2 1 +1 2 2 diff --git a/codenet/public_test_cases/p03102/input.1.txt b/codenet/public_test_cases/p03102/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..819f8c3757902b3bfb3a7e5a145c7c2227e307ab --- /dev/null +++ b/codenet/public_test_cases/p03102/input.1.txt @@ -0,0 +1,5 @@ +3 3 0 +100 -100 0 +0 100 100 +100 100 100 +-100 100 100 diff --git a/codenet/public_test_cases/p03102/input.2.txt b/codenet/public_test_cases/p03102/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b47a11ce20bef1f056ba821e43c0ec0c34b789c5 --- /dev/null +++ b/codenet/public_test_cases/p03102/input.2.txt @@ -0,0 +1,7 @@ +5 2 -4 +-2 5 +100 41 +100 40 +-3 0 +-6 -2 +18 -13 diff --git a/codenet/public_test_cases/p03102/input.3.txt b/codenet/public_test_cases/p03102/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..27c8ec24895a29225aa7108295dfab68361e7e89 --- /dev/null +++ b/codenet/public_test_cases/p03102/input.3.txt @@ -0,0 +1,4 @@ +2 3 -10 +1 2 3 +3 2 1 +1 2 2 diff --git a/codenet/public_test_cases/p03102/output.0.txt b/codenet/public_test_cases/p03102/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03102/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03102/output.1.txt b/codenet/public_test_cases/p03102/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03102/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03102/output.2.txt b/codenet/public_test_cases/p03102/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03102/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03102/output.3.txt b/codenet/public_test_cases/p03102/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03102/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03103/input.0.txt b/codenet/public_test_cases/p03103/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..456b23560ce1df3f02e635d91bd7ddb6b2836c34 --- /dev/null +++ b/codenet/public_test_cases/p03103/input.0.txt @@ -0,0 +1,3 @@ +2 5 +4 9 +2 4 diff --git a/codenet/public_test_cases/p03103/input.1.txt b/codenet/public_test_cases/p03103/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b84767e32969b98664bfcf6c075b12d963bddbe --- /dev/null +++ b/codenet/public_test_cases/p03103/input.1.txt @@ -0,0 +1,5 @@ +4 30 +6 18 +2 5 +3 10 +7 9 diff --git a/codenet/public_test_cases/p03103/input.2.txt b/codenet/public_test_cases/p03103/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..11ef8397de177418477fddcca73a093ceaa59b7f --- /dev/null +++ b/codenet/public_test_cases/p03103/input.2.txt @@ -0,0 +1,2 @@ +1 100000 +1000000000 100000 diff --git a/codenet/public_test_cases/p03103/input.3.txt b/codenet/public_test_cases/p03103/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..456b23560ce1df3f02e635d91bd7ddb6b2836c34 --- /dev/null +++ b/codenet/public_test_cases/p03103/input.3.txt @@ -0,0 +1,3 @@ +2 5 +4 9 +2 4 diff --git a/codenet/public_test_cases/p03103/output.0.txt b/codenet/public_test_cases/p03103/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03103/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03103/output.1.txt b/codenet/public_test_cases/p03103/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd03ab2a61f407d4bd9068d6faf07cb898805cc0 --- /dev/null +++ b/codenet/public_test_cases/p03103/output.1.txt @@ -0,0 +1 @@ +130 diff --git a/codenet/public_test_cases/p03103/output.2.txt b/codenet/public_test_cases/p03103/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..69a9eac11a3e0092b85f871f7380100de2e95643 --- /dev/null +++ b/codenet/public_test_cases/p03103/output.2.txt @@ -0,0 +1 @@ +100000000000000 diff --git a/codenet/public_test_cases/p03103/output.3.txt b/codenet/public_test_cases/p03103/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03103/output.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03105/input.0.txt b/codenet/public_test_cases/p03105/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1397130f54ff26a32a36e5b24b74f1acc99847dc --- /dev/null +++ b/codenet/public_test_cases/p03105/input.0.txt @@ -0,0 +1 @@ +2 11 4 diff --git a/codenet/public_test_cases/p03105/input.1.txt b/codenet/public_test_cases/p03105/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..656a26845b8b15140abe4a874be2d8be7bff8daa --- /dev/null +++ b/codenet/public_test_cases/p03105/input.1.txt @@ -0,0 +1 @@ +3 9 5 diff --git a/codenet/public_test_cases/p03105/input.2.txt b/codenet/public_test_cases/p03105/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1397130f54ff26a32a36e5b24b74f1acc99847dc --- /dev/null +++ b/codenet/public_test_cases/p03105/input.2.txt @@ -0,0 +1 @@ +2 11 4 diff --git a/codenet/public_test_cases/p03105/input.3.txt b/codenet/public_test_cases/p03105/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0b019bc5c99355ed946f520d6a1f6ff66b6b6c5 --- /dev/null +++ b/codenet/public_test_cases/p03105/input.3.txt @@ -0,0 +1 @@ +100 1 10 diff --git a/codenet/public_test_cases/p03105/output.0.txt b/codenet/public_test_cases/p03105/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03105/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03105/output.1.txt b/codenet/public_test_cases/p03105/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03105/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03105/output.2.txt b/codenet/public_test_cases/p03105/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03105/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03105/output.3.txt b/codenet/public_test_cases/p03105/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03105/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03106/input.0.txt b/codenet/public_test_cases/p03106/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5ffe87f2506a70a8aa7ef688d1c8298abc828d5 --- /dev/null +++ b/codenet/public_test_cases/p03106/input.0.txt @@ -0,0 +1 @@ +8 12 2 diff --git a/codenet/public_test_cases/p03106/input.1.txt b/codenet/public_test_cases/p03106/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc3759002bf5280e344eeadc5dbf9ea31b3e0b78 --- /dev/null +++ b/codenet/public_test_cases/p03106/input.1.txt @@ -0,0 +1 @@ +1 1 1 diff --git a/codenet/public_test_cases/p03106/input.2.txt b/codenet/public_test_cases/p03106/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a08294f580c52168668fe23524dcfef794599b65 --- /dev/null +++ b/codenet/public_test_cases/p03106/input.2.txt @@ -0,0 +1 @@ +100 50 4 diff --git a/codenet/public_test_cases/p03106/input.3.txt b/codenet/public_test_cases/p03106/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5ffe87f2506a70a8aa7ef688d1c8298abc828d5 --- /dev/null +++ b/codenet/public_test_cases/p03106/input.3.txt @@ -0,0 +1 @@ +8 12 2 diff --git a/codenet/public_test_cases/p03106/output.0.txt b/codenet/public_test_cases/p03106/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03106/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03106/output.1.txt b/codenet/public_test_cases/p03106/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03106/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03106/output.2.txt b/codenet/public_test_cases/p03106/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03106/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03106/output.3.txt b/codenet/public_test_cases/p03106/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03106/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03107/input.0.txt b/codenet/public_test_cases/p03107/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af68ed919d472cbf6e7aaee9c89d006324bb6ed5 --- /dev/null +++ b/codenet/public_test_cases/p03107/input.0.txt @@ -0,0 +1 @@ +0011 diff --git a/codenet/public_test_cases/p03107/input.1.txt b/codenet/public_test_cases/p03107/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03107/input.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03107/input.2.txt b/codenet/public_test_cases/p03107/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..af68ed919d472cbf6e7aaee9c89d006324bb6ed5 --- /dev/null +++ b/codenet/public_test_cases/p03107/input.2.txt @@ -0,0 +1 @@ +0011 diff --git a/codenet/public_test_cases/p03107/input.3.txt b/codenet/public_test_cases/p03107/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdaf1da76d8d2d77c5d7feb5534168f2df7305fe --- /dev/null +++ b/codenet/public_test_cases/p03107/input.3.txt @@ -0,0 +1 @@ +11011010001011 diff --git a/codenet/public_test_cases/p03107/output.0.txt b/codenet/public_test_cases/p03107/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03107/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03107/output.1.txt b/codenet/public_test_cases/p03107/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03107/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03107/output.2.txt b/codenet/public_test_cases/p03107/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03107/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03107/output.3.txt b/codenet/public_test_cases/p03107/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03107/output.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03108/input.0.txt b/codenet/public_test_cases/p03108/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8881ee2784d3fcf65549d77ed940999500e27c93 --- /dev/null +++ b/codenet/public_test_cases/p03108/input.0.txt @@ -0,0 +1,6 @@ +4 5 +1 2 +3 4 +1 3 +2 3 +1 4 diff --git a/codenet/public_test_cases/p03108/input.1.txt b/codenet/public_test_cases/p03108/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..23a7d587e469dc8eea51d309e248bbdfbf4169fa --- /dev/null +++ b/codenet/public_test_cases/p03108/input.1.txt @@ -0,0 +1,6 @@ +6 5 +2 3 +1 2 +5 6 +3 4 +4 5 diff --git a/codenet/public_test_cases/p03108/input.2.txt b/codenet/public_test_cases/p03108/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8881ee2784d3fcf65549d77ed940999500e27c93 --- /dev/null +++ b/codenet/public_test_cases/p03108/input.2.txt @@ -0,0 +1,6 @@ +4 5 +1 2 +3 4 +1 3 +2 3 +1 4 diff --git a/codenet/public_test_cases/p03108/input.3.txt b/codenet/public_test_cases/p03108/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fa10279583c299e9d987e8a5ad331bc6c8704d --- /dev/null +++ b/codenet/public_test_cases/p03108/input.3.txt @@ -0,0 +1,2 @@ +2 1 +1 2 diff --git a/codenet/public_test_cases/p03108/output.0.txt b/codenet/public_test_cases/p03108/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce5618383f6e6db292e34afa696f1d282fd85a01 --- /dev/null +++ b/codenet/public_test_cases/p03108/output.0.txt @@ -0,0 +1,5 @@ +0 +0 +4 +5 +6 diff --git a/codenet/public_test_cases/p03108/output.1.txt b/codenet/public_test_cases/p03108/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83dd8d4f1b7deee7a7260c5eed338efba31150c7 --- /dev/null +++ b/codenet/public_test_cases/p03108/output.1.txt @@ -0,0 +1,5 @@ +8 +9 +12 +14 +15 diff --git a/codenet/public_test_cases/p03108/output.2.txt b/codenet/public_test_cases/p03108/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce5618383f6e6db292e34afa696f1d282fd85a01 --- /dev/null +++ b/codenet/public_test_cases/p03108/output.2.txt @@ -0,0 +1,5 @@ +0 +0 +4 +5 +6 diff --git a/codenet/public_test_cases/p03108/output.3.txt b/codenet/public_test_cases/p03108/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03108/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03109/input.0.txt b/codenet/public_test_cases/p03109/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e10bbe9009c5cf4c6adbb42f0ae0f4f8dde03e --- /dev/null +++ b/codenet/public_test_cases/p03109/input.0.txt @@ -0,0 +1 @@ +2019/04/30 diff --git a/codenet/public_test_cases/p03109/input.1.txt b/codenet/public_test_cases/p03109/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e10bbe9009c5cf4c6adbb42f0ae0f4f8dde03e --- /dev/null +++ b/codenet/public_test_cases/p03109/input.1.txt @@ -0,0 +1 @@ +2019/04/30 diff --git a/codenet/public_test_cases/p03109/input.2.txt b/codenet/public_test_cases/p03109/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1480ba15790bc4422959a97f27f51c9f1bb7861 --- /dev/null +++ b/codenet/public_test_cases/p03109/input.2.txt @@ -0,0 +1 @@ +2019/11/01 diff --git a/codenet/public_test_cases/p03109/output.0.txt b/codenet/public_test_cases/p03109/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b15205f24fe2f18fc3e1a6c6490f6fe4fdfbe437 --- /dev/null +++ b/codenet/public_test_cases/p03109/output.0.txt @@ -0,0 +1 @@ +Heisei diff --git a/codenet/public_test_cases/p03109/output.1.txt b/codenet/public_test_cases/p03109/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b15205f24fe2f18fc3e1a6c6490f6fe4fdfbe437 --- /dev/null +++ b/codenet/public_test_cases/p03109/output.1.txt @@ -0,0 +1 @@ +Heisei diff --git a/codenet/public_test_cases/p03109/output.2.txt b/codenet/public_test_cases/p03109/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0990367ef8b03c70c29d285e22ef85907e1d0b7 --- /dev/null +++ b/codenet/public_test_cases/p03109/output.2.txt @@ -0,0 +1 @@ +TBD diff --git a/codenet/public_test_cases/p03110/input.0.txt b/codenet/public_test_cases/p03110/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a0ba38bf2ab7400ae3fd6057bbe0f9d2be53cad --- /dev/null +++ b/codenet/public_test_cases/p03110/input.0.txt @@ -0,0 +1,3 @@ +2 +10000 JPY +0.10000000 BTC diff --git a/codenet/public_test_cases/p03110/input.1.txt b/codenet/public_test_cases/p03110/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a0ba38bf2ab7400ae3fd6057bbe0f9d2be53cad --- /dev/null +++ b/codenet/public_test_cases/p03110/input.1.txt @@ -0,0 +1,3 @@ +2 +10000 JPY +0.10000000 BTC diff --git a/codenet/public_test_cases/p03110/input.2.txt b/codenet/public_test_cases/p03110/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ffc1541302790bdb9115cf5753e87bfe9c76196 --- /dev/null +++ b/codenet/public_test_cases/p03110/input.2.txt @@ -0,0 +1,4 @@ +3 +100000000 JPY +100.00000000 BTC +0.00000001 BTC diff --git a/codenet/public_test_cases/p03110/output.0.txt b/codenet/public_test_cases/p03110/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..810557c35b155da0929dbaaed544ae8c9d689c87 --- /dev/null +++ b/codenet/public_test_cases/p03110/output.0.txt @@ -0,0 +1 @@ +48000.0 diff --git a/codenet/public_test_cases/p03110/output.1.txt b/codenet/public_test_cases/p03110/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..810557c35b155da0929dbaaed544ae8c9d689c87 --- /dev/null +++ b/codenet/public_test_cases/p03110/output.1.txt @@ -0,0 +1 @@ +48000.0 diff --git a/codenet/public_test_cases/p03110/output.2.txt b/codenet/public_test_cases/p03110/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..317c653b53d65146b8abfedfa937d99d700f6cd9 --- /dev/null +++ b/codenet/public_test_cases/p03110/output.2.txt @@ -0,0 +1 @@ +138000000.0038 diff --git a/codenet/public_test_cases/p03111/input.0.txt b/codenet/public_test_cases/p03111/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be3325ad88f93c096a0a4d339553bfcb4d484416 --- /dev/null +++ b/codenet/public_test_cases/p03111/input.0.txt @@ -0,0 +1,6 @@ +5 100 90 80 +98 +40 +30 +21 +80 diff --git a/codenet/public_test_cases/p03111/input.1.txt b/codenet/public_test_cases/p03111/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb208b006ad389fba59a0c78d060b6367a42637a --- /dev/null +++ b/codenet/public_test_cases/p03111/input.1.txt @@ -0,0 +1,9 @@ +8 1000 800 100 +300 +333 +400 +444 +500 +555 +600 +666 diff --git a/codenet/public_test_cases/p03111/input.2.txt b/codenet/public_test_cases/p03111/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..be3325ad88f93c096a0a4d339553bfcb4d484416 --- /dev/null +++ b/codenet/public_test_cases/p03111/input.2.txt @@ -0,0 +1,6 @@ +5 100 90 80 +98 +40 +30 +21 +80 diff --git a/codenet/public_test_cases/p03111/input.3.txt b/codenet/public_test_cases/p03111/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4f0efb4cf7d259243c599c2f526302787db32af --- /dev/null +++ b/codenet/public_test_cases/p03111/input.3.txt @@ -0,0 +1,9 @@ +8 100 90 80 +100 +100 +90 +90 +90 +80 +80 +80 diff --git a/codenet/public_test_cases/p03111/output.0.txt b/codenet/public_test_cases/p03111/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p03111/output.0.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p03111/output.1.txt b/codenet/public_test_cases/p03111/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..77f83230f66a0fdcfb20aea384553e2910f87712 --- /dev/null +++ b/codenet/public_test_cases/p03111/output.1.txt @@ -0,0 +1 @@ +243 diff --git a/codenet/public_test_cases/p03111/output.2.txt b/codenet/public_test_cases/p03111/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p03111/output.2.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p03111/output.3.txt b/codenet/public_test_cases/p03111/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03111/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03112/input.0.txt b/codenet/public_test_cases/p03112/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..839871e6d0f1845e2507fa79061628fe52fb1ef7 --- /dev/null +++ b/codenet/public_test_cases/p03112/input.0.txt @@ -0,0 +1,10 @@ +2 3 4 +100 +600 +400 +900 +1000 +150 +2000 +899 +799 diff --git a/codenet/public_test_cases/p03112/input.1.txt b/codenet/public_test_cases/p03112/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..839871e6d0f1845e2507fa79061628fe52fb1ef7 --- /dev/null +++ b/codenet/public_test_cases/p03112/input.1.txt @@ -0,0 +1,10 @@ +2 3 4 +100 +600 +400 +900 +1000 +150 +2000 +899 +799 diff --git a/codenet/public_test_cases/p03112/input.2.txt b/codenet/public_test_cases/p03112/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..30ddf2999aa0cf45a7cdd20e36fdd3dccc78a768 --- /dev/null +++ b/codenet/public_test_cases/p03112/input.2.txt @@ -0,0 +1,6 @@ +1 1 3 +1 +10000000000 +2 +9999999999 +5000000000 diff --git a/codenet/public_test_cases/p03112/output.0.txt b/codenet/public_test_cases/p03112/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bc5fa8432f2096af50c138e0daa665636d1ffa6 --- /dev/null +++ b/codenet/public_test_cases/p03112/output.0.txt @@ -0,0 +1,4 @@ +350 +1400 +301 +399 diff --git a/codenet/public_test_cases/p03112/output.1.txt b/codenet/public_test_cases/p03112/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bc5fa8432f2096af50c138e0daa665636d1ffa6 --- /dev/null +++ b/codenet/public_test_cases/p03112/output.1.txt @@ -0,0 +1,4 @@ +350 +1400 +301 +399 diff --git a/codenet/public_test_cases/p03112/output.2.txt b/codenet/public_test_cases/p03112/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..da3044635718247f447dcf7a29f75a77bc320d13 --- /dev/null +++ b/codenet/public_test_cases/p03112/output.2.txt @@ -0,0 +1,3 @@ +10000000000 +10000000000 +14999999998 diff --git a/codenet/public_test_cases/p03113/input.0.txt b/codenet/public_test_cases/p03113/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31920ac7feef02d5bfdd6216b497b70f3ee86913 --- /dev/null +++ b/codenet/public_test_cases/p03113/input.0.txt @@ -0,0 +1,2 @@ +2 1 +5 5 diff --git a/codenet/public_test_cases/p03113/output.0.txt b/codenet/public_test_cases/p03113/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..57bb4cc30cb597344a21bc943355813b5f04dd5a --- /dev/null +++ b/codenet/public_test_cases/p03113/output.0.txt @@ -0,0 +1,2 @@ +7 +1 1 2 1 2 2 1 diff --git a/codenet/public_test_cases/p03114/input.0.txt b/codenet/public_test_cases/p03114/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bec171a81901e5c9d85e18442e01ee9603e6b16e --- /dev/null +++ b/codenet/public_test_cases/p03114/input.0.txt @@ -0,0 +1,4 @@ +4 +2 +1 2 +2 4 diff --git a/codenet/public_test_cases/p03114/input.1.txt b/codenet/public_test_cases/p03114/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a054772e25f91e1297dbb658414d12cd4f90649e --- /dev/null +++ b/codenet/public_test_cases/p03114/input.1.txt @@ -0,0 +1,5 @@ +6 +3 +2 5 +3 5 +1 3 diff --git a/codenet/public_test_cases/p03114/input.2.txt b/codenet/public_test_cases/p03114/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..25005cc223bd5423e974cfd71b00d415a09f01ae --- /dev/null +++ b/codenet/public_test_cases/p03114/input.2.txt @@ -0,0 +1,12 @@ +20 +10 +2 15 +5 6 +1 12 +7 9 +2 17 +5 15 +2 4 +16 17 +2 12 +8 17 diff --git a/codenet/public_test_cases/p03114/input.3.txt b/codenet/public_test_cases/p03114/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bec171a81901e5c9d85e18442e01ee9603e6b16e --- /dev/null +++ b/codenet/public_test_cases/p03114/input.3.txt @@ -0,0 +1,4 @@ +4 +2 +1 2 +2 4 diff --git a/codenet/public_test_cases/p03114/output.0.txt b/codenet/public_test_cases/p03114/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7296f257eb19026f79767a2458bdf63ff9c29e51 --- /dev/null +++ b/codenet/public_test_cases/p03114/output.0.txt @@ -0,0 +1 @@ +136 diff --git a/codenet/public_test_cases/p03114/output.1.txt b/codenet/public_test_cases/p03114/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..443b34dd0c1841a7b95ec88b51ffff9ba82492f9 --- /dev/null +++ b/codenet/public_test_cases/p03114/output.1.txt @@ -0,0 +1 @@ +2720 diff --git a/codenet/public_test_cases/p03114/output.2.txt b/codenet/public_test_cases/p03114/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a33d0755b2c03edb368ff6f4e352b1f50bebeced --- /dev/null +++ b/codenet/public_test_cases/p03114/output.2.txt @@ -0,0 +1 @@ +862268030 diff --git a/codenet/public_test_cases/p03114/output.3.txt b/codenet/public_test_cases/p03114/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7296f257eb19026f79767a2458bdf63ff9c29e51 --- /dev/null +++ b/codenet/public_test_cases/p03114/output.3.txt @@ -0,0 +1 @@ +136 diff --git a/codenet/public_test_cases/p03115/input.0.txt b/codenet/public_test_cases/p03115/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacc04d30d7a64f6bcea934463ff883aa6772322 --- /dev/null +++ b/codenet/public_test_cases/p03115/input.0.txt @@ -0,0 +1,5 @@ +4 +-2 1 +-2 2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03115/output.0.txt b/codenet/public_test_cases/p03115/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03115/output.0.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03116/input.0.txt b/codenet/public_test_cases/p03116/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacc04d30d7a64f6bcea934463ff883aa6772322 --- /dev/null +++ b/codenet/public_test_cases/p03116/input.0.txt @@ -0,0 +1,5 @@ +4 +-2 1 +-2 2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03116/output.0.txt b/codenet/public_test_cases/p03116/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..409d4d75ff3ba2411b6e6a39332f28e7b0362675 --- /dev/null +++ b/codenet/public_test_cases/p03116/output.0.txt @@ -0,0 +1 @@ +-1 0 diff --git a/codenet/public_test_cases/p03117/input.0.txt b/codenet/public_test_cases/p03117/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90619d0123d63a3a312a0496eaf752910f9d8154 --- /dev/null +++ b/codenet/public_test_cases/p03117/input.0.txt @@ -0,0 +1 @@ +8 3 diff --git a/codenet/public_test_cases/p03117/output.0.txt b/codenet/public_test_cases/p03117/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03117/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03118/input.0.txt b/codenet/public_test_cases/p03118/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..663904542e8f6f5866a3f222e57237f13073f0a5 --- /dev/null +++ b/codenet/public_test_cases/p03118/input.0.txt @@ -0,0 +1,2 @@ +1 +X diff --git a/codenet/public_test_cases/p03118/input.1.txt b/codenet/public_test_cases/p03118/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..41442e9d21d925d85017a1509902d6ff38bdb2ea --- /dev/null +++ b/codenet/public_test_cases/p03118/input.1.txt @@ -0,0 +1,2 @@ +5 +X--X- diff --git a/codenet/public_test_cases/p03118/input.2.txt b/codenet/public_test_cases/p03118/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e87bf451db7d24df0e9c77c0996a202a2e5b54d7 --- /dev/null +++ b/codenet/public_test_cases/p03118/input.2.txt @@ -0,0 +1,2 @@ +20 +-X--X--X-X--X--X-X-X diff --git a/codenet/public_test_cases/p03118/input.3.txt b/codenet/public_test_cases/p03118/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c528910cd1fcb12b1c1a058782642ac4a9163c4f --- /dev/null +++ b/codenet/public_test_cases/p03118/input.3.txt @@ -0,0 +1,2 @@ +100 +X-X-X-X-X-X-X-X-X-X--X-X-X-X-X-X-X-X-X-X-X-X-X-X-X--X--X-X-X-X--X--X-X-X--X-X-X--X-X--X--X-X--X-X-X- diff --git a/codenet/public_test_cases/p03118/input.4.txt b/codenet/public_test_cases/p03118/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00620cc24332fb374bf23d4c290d050def41f351 --- /dev/null +++ b/codenet/public_test_cases/p03118/input.4.txt @@ -0,0 +1,2 @@ +5 +X-X-X diff --git a/codenet/public_test_cases/p03118/input.5.txt b/codenet/public_test_cases/p03118/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c0a2d6f2ad68e879cae2e0c972551e69085648d --- /dev/null +++ b/codenet/public_test_cases/p03118/input.5.txt @@ -0,0 +1,2 @@ +3 +--- diff --git a/codenet/public_test_cases/p03118/input.6.txt b/codenet/public_test_cases/p03118/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..663904542e8f6f5866a3f222e57237f13073f0a5 --- /dev/null +++ b/codenet/public_test_cases/p03118/input.6.txt @@ -0,0 +1,2 @@ +1 +X diff --git a/codenet/public_test_cases/p03118/output.0.txt b/codenet/public_test_cases/p03118/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b84cef3f4635207b4275c327ddc66e754cd37d0 --- /dev/null +++ b/codenet/public_test_cases/p03118/output.0.txt @@ -0,0 +1 @@ +500000004 0 500000003 diff --git a/codenet/public_test_cases/p03118/output.1.txt b/codenet/public_test_cases/p03118/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..398641ed77732ea1055eccf06e7e4f6c00b7da49 --- /dev/null +++ b/codenet/public_test_cases/p03118/output.1.txt @@ -0,0 +1 @@ +0 0 1 diff --git a/codenet/public_test_cases/p03118/output.2.txt b/codenet/public_test_cases/p03118/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a82d1f55b2e17001a71bafa49872885d0544f42c --- /dev/null +++ b/codenet/public_test_cases/p03118/output.2.txt @@ -0,0 +1 @@ +0 0 183703705 diff --git a/codenet/public_test_cases/p03118/output.3.txt b/codenet/public_test_cases/p03118/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6118f14fb54c8de5d86c8fc7860c5210dcad0acf --- /dev/null +++ b/codenet/public_test_cases/p03118/output.3.txt @@ -0,0 +1 @@ +0 0 435664291 diff --git a/codenet/public_test_cases/p03118/output.4.txt b/codenet/public_test_cases/p03118/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e452f49ee94c3cd34ef69372969a74f3409d45f --- /dev/null +++ b/codenet/public_test_cases/p03118/output.4.txt @@ -0,0 +1 @@ +500000004 0 833333337 diff --git a/codenet/public_test_cases/p03118/output.5.txt b/codenet/public_test_cases/p03118/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c7b77a21ad082741847f21e69d14e14c082a73 --- /dev/null +++ b/codenet/public_test_cases/p03118/output.5.txt @@ -0,0 +1 @@ +0 0 0 diff --git a/codenet/public_test_cases/p03118/output.6.txt b/codenet/public_test_cases/p03118/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b84cef3f4635207b4275c327ddc66e754cd37d0 --- /dev/null +++ b/codenet/public_test_cases/p03118/output.6.txt @@ -0,0 +1 @@ +500000004 0 500000003 diff --git a/codenet/public_test_cases/p03119/input.0.txt b/codenet/public_test_cases/p03119/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31920ac7feef02d5bfdd6216b497b70f3ee86913 --- /dev/null +++ b/codenet/public_test_cases/p03119/input.0.txt @@ -0,0 +1,2 @@ +2 1 +5 5 diff --git a/codenet/public_test_cases/p03119/input.1.txt b/codenet/public_test_cases/p03119/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31920ac7feef02d5bfdd6216b497b70f3ee86913 --- /dev/null +++ b/codenet/public_test_cases/p03119/input.1.txt @@ -0,0 +1,2 @@ +2 1 +5 5 diff --git a/codenet/public_test_cases/p03119/input.2.txt b/codenet/public_test_cases/p03119/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..af9f8866ce4aa3a6fc213ea7fe4fb4e7155c02bb --- /dev/null +++ b/codenet/public_test_cases/p03119/input.2.txt @@ -0,0 +1,2 @@ +3 50 +5 10 15 diff --git a/codenet/public_test_cases/p03119/output.0.txt b/codenet/public_test_cases/p03119/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..57bb4cc30cb597344a21bc943355813b5f04dd5a --- /dev/null +++ b/codenet/public_test_cases/p03119/output.0.txt @@ -0,0 +1,2 @@ +7 +1 1 2 1 2 2 1 diff --git a/codenet/public_test_cases/p03119/output.1.txt b/codenet/public_test_cases/p03119/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57bb4cc30cb597344a21bc943355813b5f04dd5a --- /dev/null +++ b/codenet/public_test_cases/p03119/output.1.txt @@ -0,0 +1,2 @@ +7 +1 1 2 1 2 2 1 diff --git a/codenet/public_test_cases/p03119/output.2.txt b/codenet/public_test_cases/p03119/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03119/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03120/input.0.txt b/codenet/public_test_cases/p03120/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bec171a81901e5c9d85e18442e01ee9603e6b16e --- /dev/null +++ b/codenet/public_test_cases/p03120/input.0.txt @@ -0,0 +1,4 @@ +4 +2 +1 2 +2 4 diff --git a/codenet/public_test_cases/p03120/output.0.txt b/codenet/public_test_cases/p03120/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7296f257eb19026f79767a2458bdf63ff9c29e51 --- /dev/null +++ b/codenet/public_test_cases/p03120/output.0.txt @@ -0,0 +1 @@ +136 diff --git a/codenet/public_test_cases/p03121/input.0.txt b/codenet/public_test_cases/p03121/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacc04d30d7a64f6bcea934463ff883aa6772322 --- /dev/null +++ b/codenet/public_test_cases/p03121/input.0.txt @@ -0,0 +1,5 @@ +4 +-2 1 +-2 2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03121/input.1.txt b/codenet/public_test_cases/p03121/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacc04d30d7a64f6bcea934463ff883aa6772322 --- /dev/null +++ b/codenet/public_test_cases/p03121/input.1.txt @@ -0,0 +1,5 @@ +4 +-2 1 +-2 2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03121/output.0.txt b/codenet/public_test_cases/p03121/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03121/output.0.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03121/output.1.txt b/codenet/public_test_cases/p03121/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03121/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03122/input.0.txt b/codenet/public_test_cases/p03122/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacc04d30d7a64f6bcea934463ff883aa6772322 --- /dev/null +++ b/codenet/public_test_cases/p03122/input.0.txt @@ -0,0 +1,5 @@ +4 +-2 1 +-2 2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03122/input.1.txt b/codenet/public_test_cases/p03122/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacc04d30d7a64f6bcea934463ff883aa6772322 --- /dev/null +++ b/codenet/public_test_cases/p03122/input.1.txt @@ -0,0 +1,5 @@ +4 +-2 1 +-2 2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03122/output.0.txt b/codenet/public_test_cases/p03122/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..409d4d75ff3ba2411b6e6a39332f28e7b0362675 --- /dev/null +++ b/codenet/public_test_cases/p03122/output.0.txt @@ -0,0 +1 @@ +-1 0 diff --git a/codenet/public_test_cases/p03122/output.1.txt b/codenet/public_test_cases/p03122/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..409d4d75ff3ba2411b6e6a39332f28e7b0362675 --- /dev/null +++ b/codenet/public_test_cases/p03122/output.1.txt @@ -0,0 +1 @@ +-1 0 diff --git a/codenet/public_test_cases/p03123/input.0.txt b/codenet/public_test_cases/p03123/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90619d0123d63a3a312a0496eaf752910f9d8154 --- /dev/null +++ b/codenet/public_test_cases/p03123/input.0.txt @@ -0,0 +1 @@ +8 3 diff --git a/codenet/public_test_cases/p03123/input.1.txt b/codenet/public_test_cases/p03123/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..90619d0123d63a3a312a0496eaf752910f9d8154 --- /dev/null +++ b/codenet/public_test_cases/p03123/input.1.txt @@ -0,0 +1 @@ +8 3 diff --git a/codenet/public_test_cases/p03123/output.0.txt b/codenet/public_test_cases/p03123/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03123/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03123/output.1.txt b/codenet/public_test_cases/p03123/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03123/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03124/input.0.txt b/codenet/public_test_cases/p03124/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..663904542e8f6f5866a3f222e57237f13073f0a5 --- /dev/null +++ b/codenet/public_test_cases/p03124/input.0.txt @@ -0,0 +1,2 @@ +1 +X diff --git a/codenet/public_test_cases/p03124/output.0.txt b/codenet/public_test_cases/p03124/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b84cef3f4635207b4275c327ddc66e754cd37d0 --- /dev/null +++ b/codenet/public_test_cases/p03124/output.0.txt @@ -0,0 +1 @@ +500000004 0 500000003 diff --git a/codenet/public_test_cases/p03125/input.0.txt b/codenet/public_test_cases/p03125/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e18a59c6f617145ff60c20773faa83e86c12ffe --- /dev/null +++ b/codenet/public_test_cases/p03125/input.0.txt @@ -0,0 +1 @@ +4 12 diff --git a/codenet/public_test_cases/p03125/input.1.txt b/codenet/public_test_cases/p03125/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e18a59c6f617145ff60c20773faa83e86c12ffe --- /dev/null +++ b/codenet/public_test_cases/p03125/input.1.txt @@ -0,0 +1 @@ +4 12 diff --git a/codenet/public_test_cases/p03125/input.2.txt b/codenet/public_test_cases/p03125/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7671d72044a47615bb91a5c58199ad0d1b5205e --- /dev/null +++ b/codenet/public_test_cases/p03125/input.2.txt @@ -0,0 +1 @@ +8 20 diff --git a/codenet/public_test_cases/p03125/input.3.txt b/codenet/public_test_cases/p03125/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03125/input.3.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03125/output.0.txt b/codenet/public_test_cases/p03125/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03125/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03125/output.1.txt b/codenet/public_test_cases/p03125/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03125/output.1.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03125/output.2.txt b/codenet/public_test_cases/p03125/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03125/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03125/output.3.txt b/codenet/public_test_cases/p03125/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03125/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03126/input.0.txt b/codenet/public_test_cases/p03126/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6505e41f668e815590d9b32835ab0a0efa5d3fa --- /dev/null +++ b/codenet/public_test_cases/p03126/input.0.txt @@ -0,0 +1,4 @@ +3 4 +2 1 3 +3 1 2 3 +2 3 2 diff --git a/codenet/public_test_cases/p03126/input.1.txt b/codenet/public_test_cases/p03126/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6505e41f668e815590d9b32835ab0a0efa5d3fa --- /dev/null +++ b/codenet/public_test_cases/p03126/input.1.txt @@ -0,0 +1,4 @@ +3 4 +2 1 3 +3 1 2 3 +2 3 2 diff --git a/codenet/public_test_cases/p03126/input.2.txt b/codenet/public_test_cases/p03126/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e096c05722157d2bf5a21fe102d6be7f0522ca8 --- /dev/null +++ b/codenet/public_test_cases/p03126/input.2.txt @@ -0,0 +1,2 @@ +1 30 +3 5 10 30 diff --git a/codenet/public_test_cases/p03126/input.3.txt b/codenet/public_test_cases/p03126/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..993996b73dbb2d8a93ef0a0a528874f37ea90fa6 --- /dev/null +++ b/codenet/public_test_cases/p03126/input.3.txt @@ -0,0 +1,6 @@ +5 5 +4 2 3 4 5 +4 1 3 4 5 +4 1 2 4 5 +4 1 2 3 5 +4 1 2 3 4 diff --git a/codenet/public_test_cases/p03126/output.0.txt b/codenet/public_test_cases/p03126/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03126/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03126/output.1.txt b/codenet/public_test_cases/p03126/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03126/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03126/output.2.txt b/codenet/public_test_cases/p03126/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03126/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03126/output.3.txt b/codenet/public_test_cases/p03126/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03126/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03127/input.0.txt b/codenet/public_test_cases/p03127/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..489078bc541bdc3da9d79be9aa9b735bebe88898 --- /dev/null +++ b/codenet/public_test_cases/p03127/input.0.txt @@ -0,0 +1,2 @@ +4 +2 10 8 40 diff --git a/codenet/public_test_cases/p03127/input.1.txt b/codenet/public_test_cases/p03127/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4728e084a02b8f1b798e62b8e6a4aad344fcd11 --- /dev/null +++ b/codenet/public_test_cases/p03127/input.1.txt @@ -0,0 +1,2 @@ +3 +1000000000 1000000000 1000000000 diff --git a/codenet/public_test_cases/p03127/input.2.txt b/codenet/public_test_cases/p03127/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8463ea233c817dbdd49c2bb06d20548800f31bf9 --- /dev/null +++ b/codenet/public_test_cases/p03127/input.2.txt @@ -0,0 +1,2 @@ +4 +5 13 8 1000000000 diff --git a/codenet/public_test_cases/p03127/input.3.txt b/codenet/public_test_cases/p03127/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..489078bc541bdc3da9d79be9aa9b735bebe88898 --- /dev/null +++ b/codenet/public_test_cases/p03127/input.3.txt @@ -0,0 +1,2 @@ +4 +2 10 8 40 diff --git a/codenet/public_test_cases/p03127/output.0.txt b/codenet/public_test_cases/p03127/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03127/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03127/output.1.txt b/codenet/public_test_cases/p03127/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..770fdcfb4b7d03520f649b7f7ca20e2546bdb41f --- /dev/null +++ b/codenet/public_test_cases/p03127/output.1.txt @@ -0,0 +1 @@ +1000000000 diff --git a/codenet/public_test_cases/p03127/output.2.txt b/codenet/public_test_cases/p03127/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03127/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03127/output.3.txt b/codenet/public_test_cases/p03127/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03127/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03128/input.0.txt b/codenet/public_test_cases/p03128/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e02b259f8dbb1c8ed51a87a4cf5012b73c168d6f --- /dev/null +++ b/codenet/public_test_cases/p03128/input.0.txt @@ -0,0 +1,2 @@ +20 4 +3 7 8 4 diff --git a/codenet/public_test_cases/p03128/input.1.txt b/codenet/public_test_cases/p03128/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0857c9e90c5c0aab490f2eb5cd2077a1fb41e581 --- /dev/null +++ b/codenet/public_test_cases/p03128/input.1.txt @@ -0,0 +1,2 @@ +101 9 +9 8 7 6 5 4 3 2 1 diff --git a/codenet/public_test_cases/p03128/input.2.txt b/codenet/public_test_cases/p03128/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e02b259f8dbb1c8ed51a87a4cf5012b73c168d6f --- /dev/null +++ b/codenet/public_test_cases/p03128/input.2.txt @@ -0,0 +1,2 @@ +20 4 +3 7 8 4 diff --git a/codenet/public_test_cases/p03128/input.3.txt b/codenet/public_test_cases/p03128/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4200907cc424f46a3faf14c9c77949b92acf2a33 --- /dev/null +++ b/codenet/public_test_cases/p03128/input.3.txt @@ -0,0 +1,2 @@ +15 3 +5 4 6 diff --git a/codenet/public_test_cases/p03128/output.0.txt b/codenet/public_test_cases/p03128/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e5f951250f4323b2c6aaacc0405ea0d913d7dac --- /dev/null +++ b/codenet/public_test_cases/p03128/output.0.txt @@ -0,0 +1 @@ +777773 diff --git a/codenet/public_test_cases/p03128/output.1.txt b/codenet/public_test_cases/p03128/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a50d2de0258dc6ea7ae53667fe0d33261893078 --- /dev/null +++ b/codenet/public_test_cases/p03128/output.1.txt @@ -0,0 +1 @@ +71111111111111111111111111111111111111111111111111 diff --git a/codenet/public_test_cases/p03128/output.2.txt b/codenet/public_test_cases/p03128/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e5f951250f4323b2c6aaacc0405ea0d913d7dac --- /dev/null +++ b/codenet/public_test_cases/p03128/output.2.txt @@ -0,0 +1 @@ +777773 diff --git a/codenet/public_test_cases/p03128/output.3.txt b/codenet/public_test_cases/p03128/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a1183329240e53c648876eb041aa9ab010c55b2 --- /dev/null +++ b/codenet/public_test_cases/p03128/output.3.txt @@ -0,0 +1 @@ +654 diff --git a/codenet/public_test_cases/p03129/input.0.txt b/codenet/public_test_cases/p03129/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03129/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03129/input.1.txt b/codenet/public_test_cases/p03129/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfa7bc3d66ff32018fa9accfc67e1c3de4683c20 --- /dev/null +++ b/codenet/public_test_cases/p03129/input.1.txt @@ -0,0 +1 @@ +10 90 diff --git a/codenet/public_test_cases/p03129/input.2.txt b/codenet/public_test_cases/p03129/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d087b13cb724b5770209a4dd3df8a662ffc509a --- /dev/null +++ b/codenet/public_test_cases/p03129/input.2.txt @@ -0,0 +1 @@ +31 10 diff --git a/codenet/public_test_cases/p03129/input.3.txt b/codenet/public_test_cases/p03129/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03129/input.3.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03129/input.4.txt b/codenet/public_test_cases/p03129/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..299a71f3fe47862a2e17f69e981e7ad8beff4e53 --- /dev/null +++ b/codenet/public_test_cases/p03129/input.4.txt @@ -0,0 +1 @@ +5 5 diff --git a/codenet/public_test_cases/p03129/output.0.txt b/codenet/public_test_cases/p03129/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03129/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03129/output.1.txt b/codenet/public_test_cases/p03129/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03129/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03129/output.2.txt b/codenet/public_test_cases/p03129/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03129/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03129/output.3.txt b/codenet/public_test_cases/p03129/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03129/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03129/output.4.txt b/codenet/public_test_cases/p03129/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03129/output.4.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03130/input.0.txt b/codenet/public_test_cases/p03130/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..897b7ded00ff61ac39dcce730bc44b9954cb6c39 --- /dev/null +++ b/codenet/public_test_cases/p03130/input.0.txt @@ -0,0 +1,3 @@ +4 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03130/input.1.txt b/codenet/public_test_cases/p03130/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..897b7ded00ff61ac39dcce730bc44b9954cb6c39 --- /dev/null +++ b/codenet/public_test_cases/p03130/input.1.txt @@ -0,0 +1,3 @@ +4 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03130/input.2.txt b/codenet/public_test_cases/p03130/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8933fa648e6f87e3302aa8aa9e44d759f17fcf3 --- /dev/null +++ b/codenet/public_test_cases/p03130/input.2.txt @@ -0,0 +1,3 @@ +2 1 +3 2 +4 3 diff --git a/codenet/public_test_cases/p03130/input.3.txt b/codenet/public_test_cases/p03130/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d07bea858b5ac9f9354c017d5b4359cb544cc3f1 --- /dev/null +++ b/codenet/public_test_cases/p03130/input.3.txt @@ -0,0 +1,3 @@ +3 2 +2 4 +1 2 diff --git a/codenet/public_test_cases/p03130/output.0.txt b/codenet/public_test_cases/p03130/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03130/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03130/output.1.txt b/codenet/public_test_cases/p03130/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03130/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03130/output.2.txt b/codenet/public_test_cases/p03130/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03130/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03130/output.3.txt b/codenet/public_test_cases/p03130/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03130/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03131/input.0.txt b/codenet/public_test_cases/p03131/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f465bc798d97b7b6e0b7fb8a794fde8b3d466914 --- /dev/null +++ b/codenet/public_test_cases/p03131/input.0.txt @@ -0,0 +1 @@ +4 2 6 diff --git a/codenet/public_test_cases/p03131/input.1.txt b/codenet/public_test_cases/p03131/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f465bc798d97b7b6e0b7fb8a794fde8b3d466914 --- /dev/null +++ b/codenet/public_test_cases/p03131/input.1.txt @@ -0,0 +1 @@ +4 2 6 diff --git a/codenet/public_test_cases/p03131/input.2.txt b/codenet/public_test_cases/p03131/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..96651943300be62ae321bf693bbed5bc5a5d3728 --- /dev/null +++ b/codenet/public_test_cases/p03131/input.2.txt @@ -0,0 +1 @@ +7 3 4 diff --git a/codenet/public_test_cases/p03131/input.3.txt b/codenet/public_test_cases/p03131/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0e63f03a0693f420e57e198eae3382ef948a320 --- /dev/null +++ b/codenet/public_test_cases/p03131/input.3.txt @@ -0,0 +1 @@ +314159265 35897932 384626433 diff --git a/codenet/public_test_cases/p03131/output.0.txt b/codenet/public_test_cases/p03131/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03131/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03131/output.1.txt b/codenet/public_test_cases/p03131/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03131/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03131/output.2.txt b/codenet/public_test_cases/p03131/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03131/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03131/output.3.txt b/codenet/public_test_cases/p03131/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fabc7b0e957c53dc3029d26df3c458bae6c01ca8 --- /dev/null +++ b/codenet/public_test_cases/p03131/output.3.txt @@ -0,0 +1 @@ +48518828981938099 diff --git a/codenet/public_test_cases/p03132/input.0.txt b/codenet/public_test_cases/p03132/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af7791f0e57bf6cd48899232fde8396254397a81 --- /dev/null +++ b/codenet/public_test_cases/p03132/input.0.txt @@ -0,0 +1,5 @@ +4 +1 +0 +2 +3 diff --git a/codenet/public_test_cases/p03132/input.1.txt b/codenet/public_test_cases/p03132/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af7791f0e57bf6cd48899232fde8396254397a81 --- /dev/null +++ b/codenet/public_test_cases/p03132/input.1.txt @@ -0,0 +1,5 @@ +4 +1 +0 +2 +3 diff --git a/codenet/public_test_cases/p03132/input.2.txt b/codenet/public_test_cases/p03132/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..15cff1e64bc02ff6b2108aca73f5c87f57ac78a1 --- /dev/null +++ b/codenet/public_test_cases/p03132/input.2.txt @@ -0,0 +1,9 @@ +8 +2 +0 +0 +2 +1 +3 +4 +1 diff --git a/codenet/public_test_cases/p03132/input.3.txt b/codenet/public_test_cases/p03132/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2bde2c283a4e6f00e3b6d48549bcaf88614a70b --- /dev/null +++ b/codenet/public_test_cases/p03132/input.3.txt @@ -0,0 +1,8 @@ +7 +314159265 +358979323 +846264338 +327950288 +419716939 +937510582 +0 diff --git a/codenet/public_test_cases/p03132/output.0.txt b/codenet/public_test_cases/p03132/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03132/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03132/output.1.txt b/codenet/public_test_cases/p03132/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03132/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03132/output.2.txt b/codenet/public_test_cases/p03132/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03132/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03132/output.3.txt b/codenet/public_test_cases/p03132/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03132/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03133/input.0.txt b/codenet/public_test_cases/p03133/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12736f4ee0e3064ed5808320cc287991121ee840 --- /dev/null +++ b/codenet/public_test_cases/p03133/input.0.txt @@ -0,0 +1,3 @@ +2 2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03133/input.1.txt b/codenet/public_test_cases/p03133/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12736f4ee0e3064ed5808320cc287991121ee840 --- /dev/null +++ b/codenet/public_test_cases/p03133/input.1.txt @@ -0,0 +1,3 @@ +2 2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03133/input.2.txt b/codenet/public_test_cases/p03133/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a0fee5fae659702ab448f6237410f7f054eabf0 --- /dev/null +++ b/codenet/public_test_cases/p03133/input.2.txt @@ -0,0 +1,3 @@ +2 3 +0 0 0 +0 1 0 diff --git a/codenet/public_test_cases/p03133/output.0.txt b/codenet/public_test_cases/p03133/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03133/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03133/output.1.txt b/codenet/public_test_cases/p03133/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03133/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03133/output.2.txt b/codenet/public_test_cases/p03133/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03133/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03134/input.0.txt b/codenet/public_test_cases/p03134/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e22bcb8e3440869e9e1303f3b7045d1fc8e58c5 --- /dev/null +++ b/codenet/public_test_cases/p03134/input.0.txt @@ -0,0 +1 @@ +02 diff --git a/codenet/public_test_cases/p03134/input.1.txt b/codenet/public_test_cases/p03134/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c2de766050416c51f86c5d99807cbb9e6eafd26 --- /dev/null +++ b/codenet/public_test_cases/p03134/input.1.txt @@ -0,0 +1 @@ +1210 diff --git a/codenet/public_test_cases/p03134/input.2.txt b/codenet/public_test_cases/p03134/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e22bcb8e3440869e9e1303f3b7045d1fc8e58c5 --- /dev/null +++ b/codenet/public_test_cases/p03134/input.2.txt @@ -0,0 +1 @@ +02 diff --git a/codenet/public_test_cases/p03134/input.3.txt b/codenet/public_test_cases/p03134/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5800ffa8639d2ed677dc54d40c1e110617db168c --- /dev/null +++ b/codenet/public_test_cases/p03134/input.3.txt @@ -0,0 +1 @@ +12001021211100201020 diff --git a/codenet/public_test_cases/p03134/output.0.txt b/codenet/public_test_cases/p03134/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03134/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03134/output.1.txt b/codenet/public_test_cases/p03134/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3f407c0955bb5738e40a82664c79b63f04a9adb --- /dev/null +++ b/codenet/public_test_cases/p03134/output.1.txt @@ -0,0 +1 @@ +55 diff --git a/codenet/public_test_cases/p03134/output.2.txt b/codenet/public_test_cases/p03134/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03134/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03134/output.3.txt b/codenet/public_test_cases/p03134/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..05048181d05691071ba67e4d21cbb9f38eb51923 --- /dev/null +++ b/codenet/public_test_cases/p03134/output.3.txt @@ -0,0 +1 @@ +543589959 diff --git a/codenet/public_test_cases/p03135/input.0.txt b/codenet/public_test_cases/p03135/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90619d0123d63a3a312a0496eaf752910f9d8154 --- /dev/null +++ b/codenet/public_test_cases/p03135/input.0.txt @@ -0,0 +1 @@ +8 3 diff --git a/codenet/public_test_cases/p03135/input.1.txt b/codenet/public_test_cases/p03135/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eee8d43e090864f4135ce0d23adc39dcfa2cc180 --- /dev/null +++ b/codenet/public_test_cases/p03135/input.1.txt @@ -0,0 +1 @@ +1 100 diff --git a/codenet/public_test_cases/p03135/input.2.txt b/codenet/public_test_cases/p03135/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb88727720258197190f5f39503edc46f39668c8 --- /dev/null +++ b/codenet/public_test_cases/p03135/input.2.txt @@ -0,0 +1 @@ +99 1 diff --git a/codenet/public_test_cases/p03135/input.3.txt b/codenet/public_test_cases/p03135/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..90619d0123d63a3a312a0496eaf752910f9d8154 --- /dev/null +++ b/codenet/public_test_cases/p03135/input.3.txt @@ -0,0 +1 @@ +8 3 diff --git a/codenet/public_test_cases/p03135/output.0.txt b/codenet/public_test_cases/p03135/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..efa77253299b4eb36a05d7f9da23779cf955031e --- /dev/null +++ b/codenet/public_test_cases/p03135/output.0.txt @@ -0,0 +1 @@ +2.6666666667 diff --git a/codenet/public_test_cases/p03135/output.1.txt b/codenet/public_test_cases/p03135/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48539e09ad655112e972a9c73b2237427187707b --- /dev/null +++ b/codenet/public_test_cases/p03135/output.1.txt @@ -0,0 +1 @@ +0.0100000000 diff --git a/codenet/public_test_cases/p03135/output.2.txt b/codenet/public_test_cases/p03135/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0de029f4f42a31cb2695aae4ba1bafaf180ff255 --- /dev/null +++ b/codenet/public_test_cases/p03135/output.2.txt @@ -0,0 +1 @@ +99.0000000000 diff --git a/codenet/public_test_cases/p03135/output.3.txt b/codenet/public_test_cases/p03135/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..efa77253299b4eb36a05d7f9da23779cf955031e --- /dev/null +++ b/codenet/public_test_cases/p03135/output.3.txt @@ -0,0 +1 @@ +2.6666666667 diff --git a/codenet/public_test_cases/p03136/input.0.txt b/codenet/public_test_cases/p03136/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63be4afa68ed6230f06658ed220a405337992874 --- /dev/null +++ b/codenet/public_test_cases/p03136/input.0.txt @@ -0,0 +1,2 @@ +4 +3 8 5 1 diff --git a/codenet/public_test_cases/p03136/input.1.txt b/codenet/public_test_cases/p03136/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63be4afa68ed6230f06658ed220a405337992874 --- /dev/null +++ b/codenet/public_test_cases/p03136/input.1.txt @@ -0,0 +1,2 @@ +4 +3 8 5 1 diff --git a/codenet/public_test_cases/p03136/input.2.txt b/codenet/public_test_cases/p03136/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5601c0967e97d365ad1e28f56ddb72842cbc446c --- /dev/null +++ b/codenet/public_test_cases/p03136/input.2.txt @@ -0,0 +1,2 @@ +4 +3 8 4 1 diff --git a/codenet/public_test_cases/p03136/input.3.txt b/codenet/public_test_cases/p03136/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6da79ee4cd2a106054b5cab1395d16293efda75d --- /dev/null +++ b/codenet/public_test_cases/p03136/input.3.txt @@ -0,0 +1,2 @@ +10 +1 8 10 5 8 12 34 100 11 3 diff --git a/codenet/public_test_cases/p03136/output.0.txt b/codenet/public_test_cases/p03136/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03136/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03136/output.1.txt b/codenet/public_test_cases/p03136/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03136/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03136/output.2.txt b/codenet/public_test_cases/p03136/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03136/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03136/output.3.txt b/codenet/public_test_cases/p03136/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03136/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03137/input.0.txt b/codenet/public_test_cases/p03137/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52793c45c4707ed1ea9372a8af5048ccac11a6f9 --- /dev/null +++ b/codenet/public_test_cases/p03137/input.0.txt @@ -0,0 +1,2 @@ +2 5 +10 12 1 2 14 diff --git a/codenet/public_test_cases/p03137/input.1.txt b/codenet/public_test_cases/p03137/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46a21af575cc326e7cd75a525074429f2e5cf16d --- /dev/null +++ b/codenet/public_test_cases/p03137/input.1.txt @@ -0,0 +1,2 @@ +3 7 +-10 -3 0 9 -100 2 17 diff --git a/codenet/public_test_cases/p03137/input.2.txt b/codenet/public_test_cases/p03137/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..52793c45c4707ed1ea9372a8af5048ccac11a6f9 --- /dev/null +++ b/codenet/public_test_cases/p03137/input.2.txt @@ -0,0 +1,2 @@ +2 5 +10 12 1 2 14 diff --git a/codenet/public_test_cases/p03137/input.3.txt b/codenet/public_test_cases/p03137/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..64b4d25c2760aa6d7d5512dd00eaa52a5c6c91e1 --- /dev/null +++ b/codenet/public_test_cases/p03137/input.3.txt @@ -0,0 +1,2 @@ +100 1 +-100000 diff --git a/codenet/public_test_cases/p03137/output.0.txt b/codenet/public_test_cases/p03137/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03137/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03137/output.1.txt b/codenet/public_test_cases/p03137/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p03137/output.1.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p03137/output.2.txt b/codenet/public_test_cases/p03137/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03137/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03137/output.3.txt b/codenet/public_test_cases/p03137/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03137/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03139/input.0.txt b/codenet/public_test_cases/p03139/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05ce84c43fdadc81d26b6a8d04791d3e188ba790 --- /dev/null +++ b/codenet/public_test_cases/p03139/input.0.txt @@ -0,0 +1 @@ +10 3 5 diff --git a/codenet/public_test_cases/p03139/input.1.txt b/codenet/public_test_cases/p03139/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d91d85057e8fc0b45a7c9443eb965494962fcfaf --- /dev/null +++ b/codenet/public_test_cases/p03139/input.1.txt @@ -0,0 +1 @@ +10 7 5 diff --git a/codenet/public_test_cases/p03139/input.2.txt b/codenet/public_test_cases/p03139/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa64af6e1d1f16e45cad3c4a007d1dfb602bbef5 --- /dev/null +++ b/codenet/public_test_cases/p03139/input.2.txt @@ -0,0 +1 @@ +100 100 100 diff --git a/codenet/public_test_cases/p03139/input.3.txt b/codenet/public_test_cases/p03139/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..05ce84c43fdadc81d26b6a8d04791d3e188ba790 --- /dev/null +++ b/codenet/public_test_cases/p03139/input.3.txt @@ -0,0 +1 @@ +10 3 5 diff --git a/codenet/public_test_cases/p03139/output.0.txt b/codenet/public_test_cases/p03139/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c91fc456a55f62b231b0bb99a48540e5320a73b --- /dev/null +++ b/codenet/public_test_cases/p03139/output.0.txt @@ -0,0 +1 @@ +3 0 diff --git a/codenet/public_test_cases/p03139/output.1.txt b/codenet/public_test_cases/p03139/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p03139/output.1.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p03139/output.2.txt b/codenet/public_test_cases/p03139/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9732b55455bca575261eac1a6a7082c96223368d --- /dev/null +++ b/codenet/public_test_cases/p03139/output.2.txt @@ -0,0 +1 @@ +100 100 diff --git a/codenet/public_test_cases/p03139/output.3.txt b/codenet/public_test_cases/p03139/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c91fc456a55f62b231b0bb99a48540e5320a73b --- /dev/null +++ b/codenet/public_test_cases/p03139/output.3.txt @@ -0,0 +1 @@ +3 0 diff --git a/codenet/public_test_cases/p03140/input.0.txt b/codenet/public_test_cases/p03140/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63c7660a6f3ae78410dd3d71b231296a322b918b --- /dev/null +++ b/codenet/public_test_cases/p03140/input.0.txt @@ -0,0 +1,4 @@ +4 +west +east +wait diff --git a/codenet/public_test_cases/p03140/input.1.txt b/codenet/public_test_cases/p03140/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0be83a654cd05a4659ce06bb7e49d8bb4efed6cc --- /dev/null +++ b/codenet/public_test_cases/p03140/input.1.txt @@ -0,0 +1,4 @@ +9 +different +different +different diff --git a/codenet/public_test_cases/p03140/input.2.txt b/codenet/public_test_cases/p03140/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..63c7660a6f3ae78410dd3d71b231296a322b918b --- /dev/null +++ b/codenet/public_test_cases/p03140/input.2.txt @@ -0,0 +1,4 @@ +4 +west +east +wait diff --git a/codenet/public_test_cases/p03140/input.3.txt b/codenet/public_test_cases/p03140/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b2bee38ea5e512c608c599c905b54a0e9e8df47 --- /dev/null +++ b/codenet/public_test_cases/p03140/input.3.txt @@ -0,0 +1,4 @@ +7 +zenkoku +touitsu +program diff --git a/codenet/public_test_cases/p03140/output.0.txt b/codenet/public_test_cases/p03140/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03140/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03140/output.1.txt b/codenet/public_test_cases/p03140/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03140/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03140/output.2.txt b/codenet/public_test_cases/p03140/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03140/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03140/output.3.txt b/codenet/public_test_cases/p03140/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03140/output.3.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03141/input.0.txt b/codenet/public_test_cases/p03141/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..608314360d9af80b4062fcdf0b48a5697e941259 --- /dev/null +++ b/codenet/public_test_cases/p03141/input.0.txt @@ -0,0 +1,4 @@ +3 +10 10 +20 20 +30 30 diff --git a/codenet/public_test_cases/p03141/input.1.txt b/codenet/public_test_cases/p03141/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81a42f67c70a8c96d7346beccb12d0e2b85eb6d9 --- /dev/null +++ b/codenet/public_test_cases/p03141/input.1.txt @@ -0,0 +1,4 @@ +3 +20 10 +20 20 +20 30 diff --git a/codenet/public_test_cases/p03141/input.2.txt b/codenet/public_test_cases/p03141/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..608314360d9af80b4062fcdf0b48a5697e941259 --- /dev/null +++ b/codenet/public_test_cases/p03141/input.2.txt @@ -0,0 +1,4 @@ +3 +10 10 +20 20 +30 30 diff --git a/codenet/public_test_cases/p03141/input.3.txt b/codenet/public_test_cases/p03141/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..858b1125bedf2711e3874c3a60909ff7a27f45ba --- /dev/null +++ b/codenet/public_test_cases/p03141/input.3.txt @@ -0,0 +1,7 @@ +6 +1 1000000000 +1 1000000000 +1 1000000000 +1 1000000000 +1 1000000000 +1 1000000000 diff --git a/codenet/public_test_cases/p03141/output.0.txt b/codenet/public_test_cases/p03141/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03141/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03141/output.1.txt b/codenet/public_test_cases/p03141/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03141/output.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03141/output.2.txt b/codenet/public_test_cases/p03141/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03141/output.2.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03141/output.3.txt b/codenet/public_test_cases/p03141/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c19c82b93bb504115b6d2c0a39bd24dfc2451d --- /dev/null +++ b/codenet/public_test_cases/p03141/output.3.txt @@ -0,0 +1 @@ +-2999999997 diff --git a/codenet/public_test_cases/p03142/input.0.txt b/codenet/public_test_cases/p03142/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18868970a6cd5dfcc3c0647544935158a491e1c7 --- /dev/null +++ b/codenet/public_test_cases/p03142/input.0.txt @@ -0,0 +1,4 @@ +3 1 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03142/input.1.txt b/codenet/public_test_cases/p03142/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91fd7caeb523ddc117793f0f1a1736f04228afeb --- /dev/null +++ b/codenet/public_test_cases/p03142/input.1.txt @@ -0,0 +1,9 @@ +6 3 +2 1 +2 3 +4 1 +4 2 +6 1 +2 6 +4 6 +6 5 diff --git a/codenet/public_test_cases/p03142/input.2.txt b/codenet/public_test_cases/p03142/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..18868970a6cd5dfcc3c0647544935158a491e1c7 --- /dev/null +++ b/codenet/public_test_cases/p03142/input.2.txt @@ -0,0 +1,4 @@ +3 1 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03142/output.0.txt b/codenet/public_test_cases/p03142/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4539bbf2d22d5c3b4227859ff854eda060a687fb --- /dev/null +++ b/codenet/public_test_cases/p03142/output.0.txt @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/codenet/public_test_cases/p03142/output.1.txt b/codenet/public_test_cases/p03142/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..178c2259bae1cf488f70df364059cb35929c945b --- /dev/null +++ b/codenet/public_test_cases/p03142/output.1.txt @@ -0,0 +1,6 @@ +6 +4 +2 +0 +6 +2 diff --git a/codenet/public_test_cases/p03142/output.2.txt b/codenet/public_test_cases/p03142/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4539bbf2d22d5c3b4227859ff854eda060a687fb --- /dev/null +++ b/codenet/public_test_cases/p03142/output.2.txt @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/codenet/public_test_cases/p03143/input.0.txt b/codenet/public_test_cases/p03143/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a2736cf8dceaf1183a005cf49008e28f860b3b1 --- /dev/null +++ b/codenet/public_test_cases/p03143/input.0.txt @@ -0,0 +1,6 @@ +4 4 +2 3 5 7 +1 2 7 +1 3 9 +2 3 12 +3 4 18 diff --git a/codenet/public_test_cases/p03143/input.1.txt b/codenet/public_test_cases/p03143/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9a3dde1ab377167b8667366620c506e3f9edf88 --- /dev/null +++ b/codenet/public_test_cases/p03143/input.1.txt @@ -0,0 +1,11 @@ +10 9 +81 16 73 7 2 61 86 38 90 28 +6 8 725 +3 10 12 +1 4 558 +4 9 615 +5 6 942 +8 9 918 +2 7 720 +4 7 292 +7 10 414 diff --git a/codenet/public_test_cases/p03143/input.2.txt b/codenet/public_test_cases/p03143/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a2736cf8dceaf1183a005cf49008e28f860b3b1 --- /dev/null +++ b/codenet/public_test_cases/p03143/input.2.txt @@ -0,0 +1,6 @@ +4 4 +2 3 5 7 +1 2 7 +1 3 9 +2 3 12 +3 4 18 diff --git a/codenet/public_test_cases/p03143/input.3.txt b/codenet/public_test_cases/p03143/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f979ab5067c8d360c56a90ed6a3de26d39a73aa4 --- /dev/null +++ b/codenet/public_test_cases/p03143/input.3.txt @@ -0,0 +1,12 @@ +6 10 +4 4 1 1 1 7 +3 5 19 +2 5 20 +4 5 8 +1 6 16 +2 3 9 +3 6 16 +3 4 1 +2 6 20 +2 4 19 +1 2 9 diff --git a/codenet/public_test_cases/p03143/output.0.txt b/codenet/public_test_cases/p03143/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03143/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03143/output.1.txt b/codenet/public_test_cases/p03143/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03143/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03143/output.2.txt b/codenet/public_test_cases/p03143/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03143/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03143/output.3.txt b/codenet/public_test_cases/p03143/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03143/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03144/input.0.txt b/codenet/public_test_cases/p03144/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f1e76c894b772d69100fc85dd08a75ec931cd44 --- /dev/null +++ b/codenet/public_test_cases/p03144/input.0.txt @@ -0,0 +1,6 @@ +5 2 +1 1 +1 2 +1 3 +2 4 +2 5 diff --git a/codenet/public_test_cases/p03144/input.1.txt b/codenet/public_test_cases/p03144/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d03bb76685779586b07b1f57790f69e63ec5309a --- /dev/null +++ b/codenet/public_test_cases/p03144/input.1.txt @@ -0,0 +1,9 @@ +8 4 +3 2 +2 3 +4 5 +1 7 +3 11 +4 13 +1 17 +2 19 diff --git a/codenet/public_test_cases/p03144/input.2.txt b/codenet/public_test_cases/p03144/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd8910dbe937f729b7f9230ba76a91f2249b751d --- /dev/null +++ b/codenet/public_test_cases/p03144/input.2.txt @@ -0,0 +1,16 @@ +15 5 +3 87 +1 25 +1 27 +3 58 +2 85 +5 19 +5 39 +1 58 +3 12 +4 13 +5 54 +4 100 +2 33 +5 13 +2 55 diff --git a/codenet/public_test_cases/p03144/input.3.txt b/codenet/public_test_cases/p03144/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f1e76c894b772d69100fc85dd08a75ec931cd44 --- /dev/null +++ b/codenet/public_test_cases/p03144/input.3.txt @@ -0,0 +1,6 @@ +5 2 +1 1 +1 2 +1 3 +2 4 +2 5 diff --git a/codenet/public_test_cases/p03144/input.4.txt b/codenet/public_test_cases/p03144/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfe6fbb0527c3fbf820ab840f15e4ecd28f5b1ef --- /dev/null +++ b/codenet/public_test_cases/p03144/input.4.txt @@ -0,0 +1,6 @@ +5 2 +1 1 +1 2 +2 3 +2 4 +2 5 diff --git a/codenet/public_test_cases/p03144/output.0.txt b/codenet/public_test_cases/p03144/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6a77253d621f43a257547cda7b571fc6dd96d21 --- /dev/null +++ b/codenet/public_test_cases/p03144/output.0.txt @@ -0,0 +1,5 @@ +-1 +9 +6 +14 +15 diff --git a/codenet/public_test_cases/p03144/output.1.txt b/codenet/public_test_cases/p03144/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6666e80e5ced67f98be0b2fb4d94e913fb8fb424 --- /dev/null +++ b/codenet/public_test_cases/p03144/output.1.txt @@ -0,0 +1,8 @@ +-1 +24 +-1 +46 +-1 +64 +-1 +77 diff --git a/codenet/public_test_cases/p03144/output.2.txt b/codenet/public_test_cases/p03144/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..406a5f60936427e496f773a66bf347ebaac5274d --- /dev/null +++ b/codenet/public_test_cases/p03144/output.2.txt @@ -0,0 +1,15 @@ +-1 +145 +173 +285 +318 +398 +431 +491 +524 +576 +609 +634 +653 +666 +678 diff --git a/codenet/public_test_cases/p03144/output.3.txt b/codenet/public_test_cases/p03144/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6a77253d621f43a257547cda7b571fc6dd96d21 --- /dev/null +++ b/codenet/public_test_cases/p03144/output.3.txt @@ -0,0 +1,5 @@ +-1 +9 +6 +14 +15 diff --git a/codenet/public_test_cases/p03144/output.4.txt b/codenet/public_test_cases/p03144/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e35018103248f4196eea8773b5a96600af93775 --- /dev/null +++ b/codenet/public_test_cases/p03144/output.4.txt @@ -0,0 +1,5 @@ +-1 +9 +12 +12 +15 diff --git a/codenet/public_test_cases/p03145/input.0.txt b/codenet/public_test_cases/p03145/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02c7bd24aa45794a7dcca4b690e2437e7f9b2e48 --- /dev/null +++ b/codenet/public_test_cases/p03145/input.0.txt @@ -0,0 +1 @@ +3 4 5 diff --git a/codenet/public_test_cases/p03145/input.1.txt b/codenet/public_test_cases/p03145/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..02c7bd24aa45794a7dcca4b690e2437e7f9b2e48 --- /dev/null +++ b/codenet/public_test_cases/p03145/input.1.txt @@ -0,0 +1 @@ +3 4 5 diff --git a/codenet/public_test_cases/p03145/input.2.txt b/codenet/public_test_cases/p03145/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b92ee951ec3a37f4125ca5f0e1bc7735c30bc23e --- /dev/null +++ b/codenet/public_test_cases/p03145/input.2.txt @@ -0,0 +1 @@ +45 28 53 diff --git a/codenet/public_test_cases/p03145/input.3.txt b/codenet/public_test_cases/p03145/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c190ca7513b6625f34a77463f7a21653ff0ad4b8 --- /dev/null +++ b/codenet/public_test_cases/p03145/input.3.txt @@ -0,0 +1 @@ +5 12 13 diff --git a/codenet/public_test_cases/p03145/output.0.txt b/codenet/public_test_cases/p03145/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03145/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03145/output.1.txt b/codenet/public_test_cases/p03145/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03145/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03145/output.2.txt b/codenet/public_test_cases/p03145/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1217bfdb259b899d01556af4c5f685c65757e42a --- /dev/null +++ b/codenet/public_test_cases/p03145/output.2.txt @@ -0,0 +1 @@ +630 diff --git a/codenet/public_test_cases/p03145/output.3.txt b/codenet/public_test_cases/p03145/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03145/output.3.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03146/input.0.txt b/codenet/public_test_cases/p03146/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03146/input.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03146/input.1.txt b/codenet/public_test_cases/p03146/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb1e7bc86996a80d4a16529b990adda1d3434c92 --- /dev/null +++ b/codenet/public_test_cases/p03146/input.1.txt @@ -0,0 +1 @@ +54 diff --git a/codenet/public_test_cases/p03146/input.2.txt b/codenet/public_test_cases/p03146/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03146/input.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03146/input.3.txt b/codenet/public_test_cases/p03146/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03146/input.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03146/output.0.txt b/codenet/public_test_cases/p03146/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03146/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03146/output.1.txt b/codenet/public_test_cases/p03146/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dee79f109407cb2e27fe0399e8976556a3cba004 --- /dev/null +++ b/codenet/public_test_cases/p03146/output.1.txt @@ -0,0 +1 @@ +114 diff --git a/codenet/public_test_cases/p03146/output.2.txt b/codenet/public_test_cases/p03146/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03146/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03146/output.3.txt b/codenet/public_test_cases/p03146/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03146/output.3.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03147/input.0.txt b/codenet/public_test_cases/p03147/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e68918d68894215f1994b552b9c283d832d6c30 --- /dev/null +++ b/codenet/public_test_cases/p03147/input.0.txt @@ -0,0 +1,2 @@ +4 +1 2 2 1 diff --git a/codenet/public_test_cases/p03147/input.1.txt b/codenet/public_test_cases/p03147/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e68918d68894215f1994b552b9c283d832d6c30 --- /dev/null +++ b/codenet/public_test_cases/p03147/input.1.txt @@ -0,0 +1,2 @@ +4 +1 2 2 1 diff --git a/codenet/public_test_cases/p03147/input.2.txt b/codenet/public_test_cases/p03147/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5bc1de0b38c5bf75685e5edd69b5d4c17566f96 --- /dev/null +++ b/codenet/public_test_cases/p03147/input.2.txt @@ -0,0 +1,2 @@ +8 +4 23 75 0 23 96 50 100 diff --git a/codenet/public_test_cases/p03147/input.3.txt b/codenet/public_test_cases/p03147/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..38fc39c16ce4c33ccfb85086e2687b202cfd2050 --- /dev/null +++ b/codenet/public_test_cases/p03147/input.3.txt @@ -0,0 +1,2 @@ +5 +3 1 2 3 1 diff --git a/codenet/public_test_cases/p03147/output.0.txt b/codenet/public_test_cases/p03147/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03147/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03147/output.1.txt b/codenet/public_test_cases/p03147/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03147/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03147/output.2.txt b/codenet/public_test_cases/p03147/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b473380d9333e5af894cf6ef1b1d5d4c0c0beff --- /dev/null +++ b/codenet/public_test_cases/p03147/output.2.txt @@ -0,0 +1 @@ +221 diff --git a/codenet/public_test_cases/p03147/output.3.txt b/codenet/public_test_cases/p03147/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03147/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03148/input.0.txt b/codenet/public_test_cases/p03148/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93c2ab3579bfee7f09684a5b45c588e1c16cac64 --- /dev/null +++ b/codenet/public_test_cases/p03148/input.0.txt @@ -0,0 +1,6 @@ +5 3 +1 9 +1 7 +2 6 +2 5 +3 1 diff --git a/codenet/public_test_cases/p03148/input.1.txt b/codenet/public_test_cases/p03148/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..740f5234b6ea76314026a3910302672bc23438de --- /dev/null +++ b/codenet/public_test_cases/p03148/input.1.txt @@ -0,0 +1,7 @@ +6 5 +5 1000000000 +2 990000000 +3 980000000 +6 970000000 +6 960000000 +4 950000000 diff --git a/codenet/public_test_cases/p03148/input.2.txt b/codenet/public_test_cases/p03148/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fec24e14cc0d9b9674ad891b61e7b6f894a192bb --- /dev/null +++ b/codenet/public_test_cases/p03148/input.2.txt @@ -0,0 +1,8 @@ +7 4 +1 1 +2 1 +3 1 +4 6 +4 5 +4 5 +4 5 diff --git a/codenet/public_test_cases/p03148/input.3.txt b/codenet/public_test_cases/p03148/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..93c2ab3579bfee7f09684a5b45c588e1c16cac64 --- /dev/null +++ b/codenet/public_test_cases/p03148/input.3.txt @@ -0,0 +1,6 @@ +5 3 +1 9 +1 7 +2 6 +2 5 +3 1 diff --git a/codenet/public_test_cases/p03148/output.0.txt b/codenet/public_test_cases/p03148/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p03148/output.0.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p03148/output.1.txt b/codenet/public_test_cases/p03148/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ddf70649ad0a4b260c6c8b7d26ba73267a9e98c --- /dev/null +++ b/codenet/public_test_cases/p03148/output.1.txt @@ -0,0 +1 @@ +4900000016 diff --git a/codenet/public_test_cases/p03148/output.2.txt b/codenet/public_test_cases/p03148/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p03148/output.2.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p03148/output.3.txt b/codenet/public_test_cases/p03148/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p03148/output.3.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p03149/input.0.txt b/codenet/public_test_cases/p03149/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4868dae7fe6f07ef251153bb3030b1d4e97513af --- /dev/null +++ b/codenet/public_test_cases/p03149/input.0.txt @@ -0,0 +1 @@ +1 7 9 4 diff --git a/codenet/public_test_cases/p03149/input.1.txt b/codenet/public_test_cases/p03149/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63581915b87ab7b437bf581dcf09d6249ab2b612 --- /dev/null +++ b/codenet/public_test_cases/p03149/input.1.txt @@ -0,0 +1 @@ +1 9 7 4 diff --git a/codenet/public_test_cases/p03149/input.2.txt b/codenet/public_test_cases/p03149/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0636511cf3038947600741f4723bb466fe6a0e0 --- /dev/null +++ b/codenet/public_test_cases/p03149/input.2.txt @@ -0,0 +1 @@ +1 2 9 1 diff --git a/codenet/public_test_cases/p03149/input.3.txt b/codenet/public_test_cases/p03149/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a263de60bc4e52f17fcf1b3cb8b079913d309ea6 --- /dev/null +++ b/codenet/public_test_cases/p03149/input.3.txt @@ -0,0 +1 @@ +4 9 0 8 diff --git a/codenet/public_test_cases/p03149/input.4.txt b/codenet/public_test_cases/p03149/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4868dae7fe6f07ef251153bb3030b1d4e97513af --- /dev/null +++ b/codenet/public_test_cases/p03149/input.4.txt @@ -0,0 +1 @@ +1 7 9 4 diff --git a/codenet/public_test_cases/p03149/output.0.txt b/codenet/public_test_cases/p03149/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03149/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03149/output.1.txt b/codenet/public_test_cases/p03149/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03149/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03149/output.2.txt b/codenet/public_test_cases/p03149/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03149/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03149/output.3.txt b/codenet/public_test_cases/p03149/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03149/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03149/output.4.txt b/codenet/public_test_cases/p03149/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03149/output.4.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03150/input.0.txt b/codenet/public_test_cases/p03150/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..22fe1771d69523c12413d4844bfe75caece77dac --- /dev/null +++ b/codenet/public_test_cases/p03150/input.0.txt @@ -0,0 +1 @@ +keyofscience diff --git a/codenet/public_test_cases/p03150/input.1.txt b/codenet/public_test_cases/p03150/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f38e557a3b6717611af92853e9b7f1fa3fcbf8d --- /dev/null +++ b/codenet/public_test_cases/p03150/input.1.txt @@ -0,0 +1 @@ +keyence diff --git a/codenet/public_test_cases/p03150/input.2.txt b/codenet/public_test_cases/p03150/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..62b7a9ee1e20debaa16722b2b05f686a868b17a3 --- /dev/null +++ b/codenet/public_test_cases/p03150/input.2.txt @@ -0,0 +1 @@ +ashlfyha diff --git a/codenet/public_test_cases/p03150/input.3.txt b/codenet/public_test_cases/p03150/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..22fe1771d69523c12413d4844bfe75caece77dac --- /dev/null +++ b/codenet/public_test_cases/p03150/input.3.txt @@ -0,0 +1 @@ +keyofscience diff --git a/codenet/public_test_cases/p03150/input.4.txt b/codenet/public_test_cases/p03150/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce72b567e458fdb38845991e1a2bb7bc026f63c7 --- /dev/null +++ b/codenet/public_test_cases/p03150/input.4.txt @@ -0,0 +1 @@ +mpyszsbznf diff --git a/codenet/public_test_cases/p03150/output.0.txt b/codenet/public_test_cases/p03150/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03150/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03150/output.1.txt b/codenet/public_test_cases/p03150/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03150/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03150/output.2.txt b/codenet/public_test_cases/p03150/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03150/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03150/output.3.txt b/codenet/public_test_cases/p03150/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03150/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03150/output.4.txt b/codenet/public_test_cases/p03150/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03150/output.4.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03151/input.0.txt b/codenet/public_test_cases/p03151/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc4d6da39285319bd7a2b5226440482eb87fd89d --- /dev/null +++ b/codenet/public_test_cases/p03151/input.0.txt @@ -0,0 +1,3 @@ +3 +2 3 5 +3 4 1 diff --git a/codenet/public_test_cases/p03151/input.1.txt b/codenet/public_test_cases/p03151/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..965f92422d58badeaa7ea89b366064b0600dab2d --- /dev/null +++ b/codenet/public_test_cases/p03151/input.1.txt @@ -0,0 +1,3 @@ +12 +757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604 +74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212 diff --git a/codenet/public_test_cases/p03151/input.2.txt b/codenet/public_test_cases/p03151/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc4d6da39285319bd7a2b5226440482eb87fd89d --- /dev/null +++ b/codenet/public_test_cases/p03151/input.2.txt @@ -0,0 +1,3 @@ +3 +2 3 5 +3 4 1 diff --git a/codenet/public_test_cases/p03151/input.3.txt b/codenet/public_test_cases/p03151/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1f0c2bd037028fb65aaa817b646348d9c6304b4 --- /dev/null +++ b/codenet/public_test_cases/p03151/input.3.txt @@ -0,0 +1,3 @@ +3 +17 7 1 +25 6 14 diff --git a/codenet/public_test_cases/p03151/input.4.txt b/codenet/public_test_cases/p03151/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8c906a7706d8936876566b26e47e7ce2b624bd7 --- /dev/null +++ b/codenet/public_test_cases/p03151/input.4.txt @@ -0,0 +1,3 @@ +3 +2 3 3 +2 2 1 diff --git a/codenet/public_test_cases/p03151/output.0.txt b/codenet/public_test_cases/p03151/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03151/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03151/output.1.txt b/codenet/public_test_cases/p03151/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03151/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03151/output.2.txt b/codenet/public_test_cases/p03151/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03151/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03151/output.3.txt b/codenet/public_test_cases/p03151/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03151/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03151/output.4.txt b/codenet/public_test_cases/p03151/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03151/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03152/input.0.txt b/codenet/public_test_cases/p03152/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..41e681b85bb81f550fefaba275c23e61b955d970 --- /dev/null +++ b/codenet/public_test_cases/p03152/input.0.txt @@ -0,0 +1,3 @@ +2 2 +4 3 +3 4 diff --git a/codenet/public_test_cases/p03152/input.1.txt b/codenet/public_test_cases/p03152/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7f849d8f1177060f6c2e47a1394d44bd2e1ec7a --- /dev/null +++ b/codenet/public_test_cases/p03152/input.1.txt @@ -0,0 +1,3 @@ +3 3 +5 9 7 +3 6 9 diff --git a/codenet/public_test_cases/p03152/input.2.txt b/codenet/public_test_cases/p03152/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eef3e4039bd84b48622924acebe014a1d9c9541 --- /dev/null +++ b/codenet/public_test_cases/p03152/input.2.txt @@ -0,0 +1,3 @@ +14 13 +158 167 181 147 178 151 179 182 176 169 180 129 175 168 +181 150 178 179 167 180 176 169 182 177 175 159 173 diff --git a/codenet/public_test_cases/p03152/input.3.txt b/codenet/public_test_cases/p03152/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..27f27784331cf2099b2dc49bf9d4a1660e53ecb5 --- /dev/null +++ b/codenet/public_test_cases/p03152/input.3.txt @@ -0,0 +1,3 @@ +2 2 +4 4 +4 4 diff --git a/codenet/public_test_cases/p03152/input.4.txt b/codenet/public_test_cases/p03152/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..41e681b85bb81f550fefaba275c23e61b955d970 --- /dev/null +++ b/codenet/public_test_cases/p03152/input.4.txt @@ -0,0 +1,3 @@ +2 2 +4 3 +3 4 diff --git a/codenet/public_test_cases/p03152/output.0.txt b/codenet/public_test_cases/p03152/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03152/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03152/output.1.txt b/codenet/public_test_cases/p03152/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03152/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03152/output.2.txt b/codenet/public_test_cases/p03152/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8407c21926eef44aef23acaf74c7801cdf853da --- /dev/null +++ b/codenet/public_test_cases/p03152/output.2.txt @@ -0,0 +1 @@ +343772227 diff --git a/codenet/public_test_cases/p03152/output.3.txt b/codenet/public_test_cases/p03152/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03152/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03152/output.4.txt b/codenet/public_test_cases/p03152/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03152/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03153/input.0.txt b/codenet/public_test_cases/p03153/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ecc514cbc8b6a6c2ad4c9c5a13eb94c5d29b001 --- /dev/null +++ b/codenet/public_test_cases/p03153/input.0.txt @@ -0,0 +1,2 @@ +3 1 +1 100 1 diff --git a/codenet/public_test_cases/p03153/input.1.txt b/codenet/public_test_cases/p03153/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ecc514cbc8b6a6c2ad4c9c5a13eb94c5d29b001 --- /dev/null +++ b/codenet/public_test_cases/p03153/input.1.txt @@ -0,0 +1,2 @@ +3 1 +1 100 1 diff --git a/codenet/public_test_cases/p03153/input.2.txt b/codenet/public_test_cases/p03153/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1226143fa8742d68afbf28e45b2cc11916838901 --- /dev/null +++ b/codenet/public_test_cases/p03153/input.2.txt @@ -0,0 +1,2 @@ +12 5 +43 94 27 3 69 99 56 25 8 15 46 8 diff --git a/codenet/public_test_cases/p03153/input.3.txt b/codenet/public_test_cases/p03153/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf8d891ba1590522860eed503128cf64c6939a85 --- /dev/null +++ b/codenet/public_test_cases/p03153/input.3.txt @@ -0,0 +1,2 @@ +3 1000 +1 100 1 diff --git a/codenet/public_test_cases/p03153/input.4.txt b/codenet/public_test_cases/p03153/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd410d0c1e2b2a8929e39ab9c4cebe8aecc324f3 --- /dev/null +++ b/codenet/public_test_cases/p03153/input.4.txt @@ -0,0 +1,2 @@ +6 14 +25 171 7 1 17 162 diff --git a/codenet/public_test_cases/p03153/output.0.txt b/codenet/public_test_cases/p03153/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe4afb0df8641d6de901cdde04199e4507534d0d --- /dev/null +++ b/codenet/public_test_cases/p03153/output.0.txt @@ -0,0 +1 @@ +106 diff --git a/codenet/public_test_cases/p03153/output.1.txt b/codenet/public_test_cases/p03153/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe4afb0df8641d6de901cdde04199e4507534d0d --- /dev/null +++ b/codenet/public_test_cases/p03153/output.1.txt @@ -0,0 +1 @@ +106 diff --git a/codenet/public_test_cases/p03153/output.2.txt b/codenet/public_test_cases/p03153/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4932818c5afe78cfe53f7902e6ddaab9a554d9db --- /dev/null +++ b/codenet/public_test_cases/p03153/output.2.txt @@ -0,0 +1 @@ +658 diff --git a/codenet/public_test_cases/p03153/output.3.txt b/codenet/public_test_cases/p03153/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..06f43a4271d0e7ab3d92bde72dfbc7fcff06a188 --- /dev/null +++ b/codenet/public_test_cases/p03153/output.3.txt @@ -0,0 +1 @@ +2202 diff --git a/codenet/public_test_cases/p03153/output.4.txt b/codenet/public_test_cases/p03153/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1303c35cc5aeb69468ccacb352e39aa09b44fe2e --- /dev/null +++ b/codenet/public_test_cases/p03153/output.4.txt @@ -0,0 +1 @@ +497 diff --git a/codenet/public_test_cases/p03154/input.0.txt b/codenet/public_test_cases/p03154/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3b04ccdba4df31d78b9f5f65b0d7f77ce8b40d7 --- /dev/null +++ b/codenet/public_test_cases/p03154/input.0.txt @@ -0,0 +1 @@ +2 1 2 diff --git a/codenet/public_test_cases/p03154/output.0.txt b/codenet/public_test_cases/p03154/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p03154/output.0.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p03155/input.0.txt b/codenet/public_test_cases/p03155/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61150aca43cf75015ed78b69d3d6ba9e5e134934 --- /dev/null +++ b/codenet/public_test_cases/p03155/input.0.txt @@ -0,0 +1,3 @@ +3 +2 +3 diff --git a/codenet/public_test_cases/p03155/input.1.txt b/codenet/public_test_cases/p03155/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bfccc39dc44d84b1b2bf8d5804d9a1798e9a6aa --- /dev/null +++ b/codenet/public_test_cases/p03155/input.1.txt @@ -0,0 +1,3 @@ +5 +4 +2 diff --git a/codenet/public_test_cases/p03155/input.2.txt b/codenet/public_test_cases/p03155/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..61150aca43cf75015ed78b69d3d6ba9e5e134934 --- /dev/null +++ b/codenet/public_test_cases/p03155/input.2.txt @@ -0,0 +1,3 @@ +3 +2 +3 diff --git a/codenet/public_test_cases/p03155/input.3.txt b/codenet/public_test_cases/p03155/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bbb5605256c2d1fe799d308ff815a99c430b1a48 --- /dev/null +++ b/codenet/public_test_cases/p03155/input.3.txt @@ -0,0 +1,3 @@ +100 +1 +1 diff --git a/codenet/public_test_cases/p03155/output.0.txt b/codenet/public_test_cases/p03155/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03155/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03155/output.1.txt b/codenet/public_test_cases/p03155/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03155/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03155/output.2.txt b/codenet/public_test_cases/p03155/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03155/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03155/output.3.txt b/codenet/public_test_cases/p03155/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5caff40c4a0ce4ed0dcb3aa983da623641af1b06 --- /dev/null +++ b/codenet/public_test_cases/p03155/output.3.txt @@ -0,0 +1 @@ +10000 diff --git a/codenet/public_test_cases/p03156/input.0.txt b/codenet/public_test_cases/p03156/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fad386ac1500006019d6c6ee95ccdd82b726edd --- /dev/null +++ b/codenet/public_test_cases/p03156/input.0.txt @@ -0,0 +1,3 @@ +7 +5 15 +1 10 16 2 7 20 12 diff --git a/codenet/public_test_cases/p03156/input.1.txt b/codenet/public_test_cases/p03156/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e45f64cb23d2d6861ad10f00361acee19e47cae8 --- /dev/null +++ b/codenet/public_test_cases/p03156/input.1.txt @@ -0,0 +1,3 @@ +3 +5 6 +5 6 10 diff --git a/codenet/public_test_cases/p03156/input.2.txt b/codenet/public_test_cases/p03156/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fad386ac1500006019d6c6ee95ccdd82b726edd --- /dev/null +++ b/codenet/public_test_cases/p03156/input.2.txt @@ -0,0 +1,3 @@ +7 +5 15 +1 10 16 2 7 20 12 diff --git a/codenet/public_test_cases/p03156/input.3.txt b/codenet/public_test_cases/p03156/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5c94e679e84e827aee20138c15c4bc5f945aba7 --- /dev/null +++ b/codenet/public_test_cases/p03156/input.3.txt @@ -0,0 +1,3 @@ +8 +3 8 +5 5 5 10 10 10 15 20 diff --git a/codenet/public_test_cases/p03156/output.0.txt b/codenet/public_test_cases/p03156/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03156/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03156/output.1.txt b/codenet/public_test_cases/p03156/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03156/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03156/output.2.txt b/codenet/public_test_cases/p03156/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03156/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03156/output.3.txt b/codenet/public_test_cases/p03156/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03156/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03157/input.0.txt b/codenet/public_test_cases/p03157/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f02226878110ba0d65c96c326e91e15b2cfb7935 --- /dev/null +++ b/codenet/public_test_cases/p03157/input.0.txt @@ -0,0 +1,4 @@ +3 3 +.#. +..# +#.. diff --git a/codenet/public_test_cases/p03157/input.1.txt b/codenet/public_test_cases/p03157/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f02226878110ba0d65c96c326e91e15b2cfb7935 --- /dev/null +++ b/codenet/public_test_cases/p03157/input.1.txt @@ -0,0 +1,4 @@ +3 3 +.#. +..# +#.. diff --git a/codenet/public_test_cases/p03157/input.2.txt b/codenet/public_test_cases/p03157/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfee2536569ee0829c32480b2c9df1bea27e8bc3 --- /dev/null +++ b/codenet/public_test_cases/p03157/input.2.txt @@ -0,0 +1,4 @@ +4 3 + + +... diff --git a/codenet/public_test_cases/p03157/input.3.txt b/codenet/public_test_cases/p03157/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..324d693ed08f522c02c395c3551e686ab0acd84d --- /dev/null +++ b/codenet/public_test_cases/p03157/input.3.txt @@ -0,0 +1,4 @@ +3 3 +.#. +..# +.. diff --git a/codenet/public_test_cases/p03157/input.4.txt b/codenet/public_test_cases/p03157/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bc24ee28e211db81c952526ef7806e1beb3c467 --- /dev/null +++ b/codenet/public_test_cases/p03157/input.4.txt @@ -0,0 +1,3 @@ +2 4 +.... +.... diff --git a/codenet/public_test_cases/p03157/output.0.txt b/codenet/public_test_cases/p03157/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03157/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03157/output.1.txt b/codenet/public_test_cases/p03157/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03157/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03157/output.2.txt b/codenet/public_test_cases/p03157/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03157/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03157/output.3.txt b/codenet/public_test_cases/p03157/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03157/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03157/output.4.txt b/codenet/public_test_cases/p03157/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03157/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03158/input.0.txt b/codenet/public_test_cases/p03158/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c430c7bd8189cfffdccaa91d29136485e0963671 --- /dev/null +++ b/codenet/public_test_cases/p03158/input.0.txt @@ -0,0 +1,7 @@ +5 5 +3 5 7 11 13 +1 +4 +9 +10 +13 diff --git a/codenet/public_test_cases/p03158/input.1.txt b/codenet/public_test_cases/p03158/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c430c7bd8189cfffdccaa91d29136485e0963671 --- /dev/null +++ b/codenet/public_test_cases/p03158/input.1.txt @@ -0,0 +1,7 @@ +5 5 +3 5 7 11 13 +1 +4 +9 +10 +13 diff --git a/codenet/public_test_cases/p03158/input.2.txt b/codenet/public_test_cases/p03158/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e16530d72151f7336037ec3ff59da1029638f0c5 --- /dev/null +++ b/codenet/public_test_cases/p03158/input.2.txt @@ -0,0 +1,5 @@ +4 3 +10 20 30 40 +2 +34 +34 diff --git a/codenet/public_test_cases/p03158/output.0.txt b/codenet/public_test_cases/p03158/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fbaf9131009f5f648b97215612f0851843b647 --- /dev/null +++ b/codenet/public_test_cases/p03158/output.0.txt @@ -0,0 +1,5 @@ +31 +31 +27 +23 +23 diff --git a/codenet/public_test_cases/p03158/output.1.txt b/codenet/public_test_cases/p03158/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fbaf9131009f5f648b97215612f0851843b647 --- /dev/null +++ b/codenet/public_test_cases/p03158/output.1.txt @@ -0,0 +1,5 @@ +31 +31 +27 +23 +23 diff --git a/codenet/public_test_cases/p03158/output.2.txt b/codenet/public_test_cases/p03158/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..15f28bff670c99568e002cbe3d806c29e3d6b414 --- /dev/null +++ b/codenet/public_test_cases/p03158/output.2.txt @@ -0,0 +1,3 @@ +70 +60 +60 diff --git a/codenet/public_test_cases/p03159/input.0.txt b/codenet/public_test_cases/p03159/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb19cdf6dc0ad44b010b09e43f3df1fea288524f --- /dev/null +++ b/codenet/public_test_cases/p03159/input.0.txt @@ -0,0 +1,8 @@ +7 +-2 7 5 6 -8 3 4 +1 2 +2 3 +2 4 +1 5 +5 6 +5 7 diff --git a/codenet/public_test_cases/p03159/input.1.txt b/codenet/public_test_cases/p03159/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..44a1ad848b32783c3fd9e0f49371962a0067d25b --- /dev/null +++ b/codenet/public_test_cases/p03159/input.1.txt @@ -0,0 +1,5 @@ +4 +1 2 3 4 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p03159/input.2.txt b/codenet/public_test_cases/p03159/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb19cdf6dc0ad44b010b09e43f3df1fea288524f --- /dev/null +++ b/codenet/public_test_cases/p03159/input.2.txt @@ -0,0 +1,8 @@ +7 +-2 7 5 6 -8 3 4 +1 2 +2 3 +2 4 +1 5 +5 6 +5 7 diff --git a/codenet/public_test_cases/p03159/input.3.txt b/codenet/public_test_cases/p03159/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbcfbf52cd4d70ebdbe7200cec24ebed522e4ab5 --- /dev/null +++ b/codenet/public_test_cases/p03159/input.3.txt @@ -0,0 +1,11 @@ +10 +3 4 9 6 1 5 -1 10 -10 -10 +7 4 +5 6 +8 1 +9 5 +7 1 +10 3 +2 8 +4 10 +9 2 diff --git a/codenet/public_test_cases/p03159/input.4.txt b/codenet/public_test_cases/p03159/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cd5e89c012ea58467290a0fb3c21871e8f9b556 --- /dev/null +++ b/codenet/public_test_cases/p03159/input.4.txt @@ -0,0 +1,7 @@ +6 +10 -1 10 -1 10 -1 +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p03159/input.5.txt b/codenet/public_test_cases/p03159/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..14e19a08f7adb418b40eb39afd6a3463bea081ed --- /dev/null +++ b/codenet/public_test_cases/p03159/input.5.txt @@ -0,0 +1,9 @@ +8 +-2 3 6 -2 -2 -5 3 2 +3 4 +7 6 +6 2 +8 2 +5 3 +1 8 +3 7 diff --git a/codenet/public_test_cases/p03159/output.0.txt b/codenet/public_test_cases/p03159/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03159/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03159/output.1.txt b/codenet/public_test_cases/p03159/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03159/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03159/output.2.txt b/codenet/public_test_cases/p03159/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03159/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03159/output.3.txt b/codenet/public_test_cases/p03159/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03159/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03159/output.4.txt b/codenet/public_test_cases/p03159/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03159/output.4.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03159/output.5.txt b/codenet/public_test_cases/p03159/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03159/output.5.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03160/input.0.txt b/codenet/public_test_cases/p03160/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..46c51e99e1600e6cc103848509f56605d109d0cd --- /dev/null +++ b/codenet/public_test_cases/p03160/input.0.txt @@ -0,0 +1,2 @@ +4 +10 30 40 20 diff --git a/codenet/public_test_cases/p03160/input.1.txt b/codenet/public_test_cases/p03160/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4bbc78d423cee19e6395606245dd1d34cd0f23a --- /dev/null +++ b/codenet/public_test_cases/p03160/input.1.txt @@ -0,0 +1,2 @@ +6 +30 10 60 10 60 50 diff --git a/codenet/public_test_cases/p03160/input.2.txt b/codenet/public_test_cases/p03160/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..46c51e99e1600e6cc103848509f56605d109d0cd --- /dev/null +++ b/codenet/public_test_cases/p03160/input.2.txt @@ -0,0 +1,2 @@ +4 +10 30 40 20 diff --git a/codenet/public_test_cases/p03160/input.3.txt b/codenet/public_test_cases/p03160/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3314d15e70c1c64f25f278a70ac685bc43dca403 --- /dev/null +++ b/codenet/public_test_cases/p03160/input.3.txt @@ -0,0 +1,2 @@ +2 +10 10 diff --git a/codenet/public_test_cases/p03160/output.0.txt b/codenet/public_test_cases/p03160/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03160/output.0.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03160/output.1.txt b/codenet/public_test_cases/p03160/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03160/output.1.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03160/output.2.txt b/codenet/public_test_cases/p03160/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03160/output.2.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03160/output.3.txt b/codenet/public_test_cases/p03160/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03160/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03161/input.0.txt b/codenet/public_test_cases/p03161/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6fc23cd05665febcdf2df0403a1ec17efa39f4b --- /dev/null +++ b/codenet/public_test_cases/p03161/input.0.txt @@ -0,0 +1,2 @@ +5 3 +10 30 40 50 20 diff --git a/codenet/public_test_cases/p03161/input.1.txt b/codenet/public_test_cases/p03161/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6b4d8bf25be3470b93c157b4242f2d2fa976e13 --- /dev/null +++ b/codenet/public_test_cases/p03161/input.1.txt @@ -0,0 +1,2 @@ +2 100 +10 10 diff --git a/codenet/public_test_cases/p03161/input.2.txt b/codenet/public_test_cases/p03161/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6fc23cd05665febcdf2df0403a1ec17efa39f4b --- /dev/null +++ b/codenet/public_test_cases/p03161/input.2.txt @@ -0,0 +1,2 @@ +5 3 +10 30 40 50 20 diff --git a/codenet/public_test_cases/p03161/input.3.txt b/codenet/public_test_cases/p03161/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b30f36e32a991618d3753e3ecc171169ec42adc --- /dev/null +++ b/codenet/public_test_cases/p03161/input.3.txt @@ -0,0 +1,2 @@ +10 4 +40 10 20 70 80 10 20 70 80 60 diff --git a/codenet/public_test_cases/p03161/input.4.txt b/codenet/public_test_cases/p03161/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..37de48f034ec69e5aa009037fdef3f599814e186 --- /dev/null +++ b/codenet/public_test_cases/p03161/input.4.txt @@ -0,0 +1,2 @@ +3 1 +10 20 10 diff --git a/codenet/public_test_cases/p03161/output.0.txt b/codenet/public_test_cases/p03161/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03161/output.0.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03161/output.1.txt b/codenet/public_test_cases/p03161/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03161/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03161/output.2.txt b/codenet/public_test_cases/p03161/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03161/output.2.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03161/output.3.txt b/codenet/public_test_cases/p03161/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03161/output.3.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03161/output.4.txt b/codenet/public_test_cases/p03161/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03161/output.4.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03162/input.0.txt b/codenet/public_test_cases/p03162/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5090fa9914523abb5597e0a162432de05e7f84c --- /dev/null +++ b/codenet/public_test_cases/p03162/input.0.txt @@ -0,0 +1,4 @@ +3 +10 40 70 +20 50 80 +30 60 90 diff --git a/codenet/public_test_cases/p03162/input.1.txt b/codenet/public_test_cases/p03162/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5090fa9914523abb5597e0a162432de05e7f84c --- /dev/null +++ b/codenet/public_test_cases/p03162/input.1.txt @@ -0,0 +1,4 @@ +3 +10 40 70 +20 50 80 +30 60 90 diff --git a/codenet/public_test_cases/p03162/input.2.txt b/codenet/public_test_cases/p03162/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b27462bd73d5d8792e74ff0adf45e23949edb0a --- /dev/null +++ b/codenet/public_test_cases/p03162/input.2.txt @@ -0,0 +1,2 @@ +1 +100 10 1 diff --git a/codenet/public_test_cases/p03162/input.3.txt b/codenet/public_test_cases/p03162/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc5631f9146f7c80617e7dfb2fd840a1e66da0ce --- /dev/null +++ b/codenet/public_test_cases/p03162/input.3.txt @@ -0,0 +1,8 @@ +7 +6 7 8 +8 8 3 +2 5 2 +7 8 6 +4 6 8 +2 3 4 +7 5 1 diff --git a/codenet/public_test_cases/p03162/output.0.txt b/codenet/public_test_cases/p03162/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd7da05e3d264bd30a49a5f2c4c647a4ee0d3ec3 --- /dev/null +++ b/codenet/public_test_cases/p03162/output.0.txt @@ -0,0 +1 @@ +210 diff --git a/codenet/public_test_cases/p03162/output.1.txt b/codenet/public_test_cases/p03162/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd7da05e3d264bd30a49a5f2c4c647a4ee0d3ec3 --- /dev/null +++ b/codenet/public_test_cases/p03162/output.1.txt @@ -0,0 +1 @@ +210 diff --git a/codenet/public_test_cases/p03162/output.2.txt b/codenet/public_test_cases/p03162/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03162/output.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03162/output.3.txt b/codenet/public_test_cases/p03162/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e5feb5256930f3cae636754eef8a244ede164eb --- /dev/null +++ b/codenet/public_test_cases/p03162/output.3.txt @@ -0,0 +1 @@ +46 diff --git a/codenet/public_test_cases/p03163/input.0.txt b/codenet/public_test_cases/p03163/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..449292e55ed3404fffa9c1ea6694c0df50c42a52 --- /dev/null +++ b/codenet/public_test_cases/p03163/input.0.txt @@ -0,0 +1,4 @@ +3 8 +3 30 +4 50 +5 60 diff --git a/codenet/public_test_cases/p03163/output.0.txt b/codenet/public_test_cases/p03163/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61f00d8cad3920809f4d992ac3031b3f32e7f10 --- /dev/null +++ b/codenet/public_test_cases/p03163/output.0.txt @@ -0,0 +1 @@ +90 diff --git a/codenet/public_test_cases/p03164/input.0.txt b/codenet/public_test_cases/p03164/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..449292e55ed3404fffa9c1ea6694c0df50c42a52 --- /dev/null +++ b/codenet/public_test_cases/p03164/input.0.txt @@ -0,0 +1,4 @@ +3 8 +3 30 +4 50 +5 60 diff --git a/codenet/public_test_cases/p03164/input.1.txt b/codenet/public_test_cases/p03164/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9362de2aff1e3968e8c5db985ec81f20c7c86f4e --- /dev/null +++ b/codenet/public_test_cases/p03164/input.1.txt @@ -0,0 +1,2 @@ +1 1000000000 +1000000000 10 diff --git a/codenet/public_test_cases/p03164/input.2.txt b/codenet/public_test_cases/p03164/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e66b6c538c0ac0ff44f8646b78f14b3c8033dfd --- /dev/null +++ b/codenet/public_test_cases/p03164/input.2.txt @@ -0,0 +1,7 @@ +6 15 +6 5 +5 6 +6 4 +6 6 +3 5 +7 2 diff --git a/codenet/public_test_cases/p03164/input.3.txt b/codenet/public_test_cases/p03164/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..449292e55ed3404fffa9c1ea6694c0df50c42a52 --- /dev/null +++ b/codenet/public_test_cases/p03164/input.3.txt @@ -0,0 +1,4 @@ +3 8 +3 30 +4 50 +5 60 diff --git a/codenet/public_test_cases/p03164/output.0.txt b/codenet/public_test_cases/p03164/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61f00d8cad3920809f4d992ac3031b3f32e7f10 --- /dev/null +++ b/codenet/public_test_cases/p03164/output.0.txt @@ -0,0 +1 @@ +90 diff --git a/codenet/public_test_cases/p03164/output.1.txt b/codenet/public_test_cases/p03164/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03164/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03164/output.2.txt b/codenet/public_test_cases/p03164/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p03164/output.2.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p03164/output.3.txt b/codenet/public_test_cases/p03164/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61f00d8cad3920809f4d992ac3031b3f32e7f10 --- /dev/null +++ b/codenet/public_test_cases/p03164/output.3.txt @@ -0,0 +1 @@ +90 diff --git a/codenet/public_test_cases/p03165/input.0.txt b/codenet/public_test_cases/p03165/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d5a1cb766cc402218fa0705f9b24be48fa624f1 --- /dev/null +++ b/codenet/public_test_cases/p03165/input.0.txt @@ -0,0 +1,2 @@ +axyb +abyxb diff --git a/codenet/public_test_cases/p03165/input.1.txt b/codenet/public_test_cases/p03165/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..40f7007d8888470fd020bda01f3e8aa1da75d458 --- /dev/null +++ b/codenet/public_test_cases/p03165/input.1.txt @@ -0,0 +1,2 @@ +abracadabra +avadakedavra diff --git a/codenet/public_test_cases/p03165/input.2.txt b/codenet/public_test_cases/p03165/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58f424cdb4f2b274988707a0cf0b1f464aa04acc --- /dev/null +++ b/codenet/public_test_cases/p03165/input.2.txt @@ -0,0 +1,2 @@ +a +z diff --git a/codenet/public_test_cases/p03165/input.3.txt b/codenet/public_test_cases/p03165/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d5a1cb766cc402218fa0705f9b24be48fa624f1 --- /dev/null +++ b/codenet/public_test_cases/p03165/input.3.txt @@ -0,0 +1,2 @@ +axyb +abyxb diff --git a/codenet/public_test_cases/p03165/input.4.txt b/codenet/public_test_cases/p03165/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..facf207fabdb0de6d532a940040d5d896ba7731e --- /dev/null +++ b/codenet/public_test_cases/p03165/input.4.txt @@ -0,0 +1,2 @@ +aa +xayaz diff --git a/codenet/public_test_cases/p03165/output.0.txt b/codenet/public_test_cases/p03165/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..280b0f72052d1afb830d0fba0c03e02b5df8cb09 --- /dev/null +++ b/codenet/public_test_cases/p03165/output.0.txt @@ -0,0 +1 @@ +axb diff --git a/codenet/public_test_cases/p03165/output.1.txt b/codenet/public_test_cases/p03165/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5473e4a607a1a115a1d8407725f8f280216b98a --- /dev/null +++ b/codenet/public_test_cases/p03165/output.1.txt @@ -0,0 +1 @@ +aaadara diff --git a/codenet/public_test_cases/p03165/output.2.txt b/codenet/public_test_cases/p03165/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p03165/output.2.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p03165/output.3.txt b/codenet/public_test_cases/p03165/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..280b0f72052d1afb830d0fba0c03e02b5df8cb09 --- /dev/null +++ b/codenet/public_test_cases/p03165/output.3.txt @@ -0,0 +1 @@ +axb diff --git a/codenet/public_test_cases/p03165/output.4.txt b/codenet/public_test_cases/p03165/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e61ef7b965e17c62ca23b6ff5f0aaf09586e10e9 --- /dev/null +++ b/codenet/public_test_cases/p03165/output.4.txt @@ -0,0 +1 @@ +aa diff --git a/codenet/public_test_cases/p03166/input.0.txt b/codenet/public_test_cases/p03166/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..376e41c1a2d542f45a64ba93ef7443bbf0fcd6c7 --- /dev/null +++ b/codenet/public_test_cases/p03166/input.0.txt @@ -0,0 +1,6 @@ +4 5 +1 2 +1 3 +3 2 +2 4 +3 4 diff --git a/codenet/public_test_cases/p03166/input.1.txt b/codenet/public_test_cases/p03166/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46e088c9ccacc69306d20e64f6aab6588266ab4a --- /dev/null +++ b/codenet/public_test_cases/p03166/input.1.txt @@ -0,0 +1,4 @@ +6 3 +2 3 +4 5 +5 6 diff --git a/codenet/public_test_cases/p03166/input.2.txt b/codenet/public_test_cases/p03166/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9532bf950c381e0368fd7b42f872c7f44a371b3 --- /dev/null +++ b/codenet/public_test_cases/p03166/input.2.txt @@ -0,0 +1,9 @@ +5 8 +5 3 +2 3 +2 4 +5 2 +5 1 +1 4 +4 3 +1 3 diff --git a/codenet/public_test_cases/p03166/input.3.txt b/codenet/public_test_cases/p03166/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..376e41c1a2d542f45a64ba93ef7443bbf0fcd6c7 --- /dev/null +++ b/codenet/public_test_cases/p03166/input.3.txt @@ -0,0 +1,6 @@ +4 5 +1 2 +1 3 +3 2 +2 4 +3 4 diff --git a/codenet/public_test_cases/p03166/output.0.txt b/codenet/public_test_cases/p03166/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03166/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03166/output.1.txt b/codenet/public_test_cases/p03166/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03166/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03166/output.2.txt b/codenet/public_test_cases/p03166/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03166/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03166/output.3.txt b/codenet/public_test_cases/p03166/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03166/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03167/input.0.txt b/codenet/public_test_cases/p03167/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e975d4bce4af7d5c49bd6a7fa4fcd41aae9f6318 --- /dev/null +++ b/codenet/public_test_cases/p03167/input.0.txt @@ -0,0 +1,4 @@ +3 4 +...# +.#.. +.... diff --git a/codenet/public_test_cases/p03167/input.1.txt b/codenet/public_test_cases/p03167/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7cf35851c89a6dab92f3d5ed76de0e6c6668aa4 --- /dev/null +++ b/codenet/public_test_cases/p03167/input.1.txt @@ -0,0 +1,6 @@ +5 5 +..#.. +..... +...# +..... +..#.. diff --git a/codenet/public_test_cases/p03167/input.2.txt b/codenet/public_test_cases/p03167/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4a87caaef14f85427a75ad2a87ad129c3c9892c --- /dev/null +++ b/codenet/public_test_cases/p03167/input.2.txt @@ -0,0 +1,6 @@ +5 2 +.. +. +.. +.# +.. diff --git a/codenet/public_test_cases/p03167/input.3.txt b/codenet/public_test_cases/p03167/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e975d4bce4af7d5c49bd6a7fa4fcd41aae9f6318 --- /dev/null +++ b/codenet/public_test_cases/p03167/input.3.txt @@ -0,0 +1,4 @@ +3 4 +...# +.#.. +.... diff --git a/codenet/public_test_cases/p03167/input.4.txt b/codenet/public_test_cases/p03167/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..77ff7363b17dbf3c466f79d433dae23c260aa263 --- /dev/null +++ b/codenet/public_test_cases/p03167/input.4.txt @@ -0,0 +1,21 @@ +20 20 +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... diff --git a/codenet/public_test_cases/p03167/output.0.txt b/codenet/public_test_cases/p03167/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03167/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03167/output.1.txt b/codenet/public_test_cases/p03167/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p03167/output.1.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p03167/output.2.txt b/codenet/public_test_cases/p03167/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03167/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03167/output.3.txt b/codenet/public_test_cases/p03167/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03167/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03167/output.4.txt b/codenet/public_test_cases/p03167/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3b946d71da2e5a4363641995604042a121dd62e --- /dev/null +++ b/codenet/public_test_cases/p03167/output.4.txt @@ -0,0 +1 @@ +345263555 diff --git a/codenet/public_test_cases/p03168/input.0.txt b/codenet/public_test_cases/p03168/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..21e797b90a133dc01743c414a692e8cf561f2221 --- /dev/null +++ b/codenet/public_test_cases/p03168/input.0.txt @@ -0,0 +1,2 @@ +3 +0.30 0.60 0.80 diff --git a/codenet/public_test_cases/p03168/input.1.txt b/codenet/public_test_cases/p03168/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b446c4c0c8e43e2fc1e6ea9f74868677e03c8544 --- /dev/null +++ b/codenet/public_test_cases/p03168/input.1.txt @@ -0,0 +1,2 @@ +5 +0.42 0.01 0.42 0.99 0.42 diff --git a/codenet/public_test_cases/p03168/input.2.txt b/codenet/public_test_cases/p03168/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b922d241c58b4d680060721408d9d4827317d015 --- /dev/null +++ b/codenet/public_test_cases/p03168/input.2.txt @@ -0,0 +1,2 @@ +1 +0.50 diff --git a/codenet/public_test_cases/p03168/input.3.txt b/codenet/public_test_cases/p03168/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..21e797b90a133dc01743c414a692e8cf561f2221 --- /dev/null +++ b/codenet/public_test_cases/p03168/input.3.txt @@ -0,0 +1,2 @@ +3 +0.30 0.60 0.80 diff --git a/codenet/public_test_cases/p03168/output.0.txt b/codenet/public_test_cases/p03168/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5bdaa81030a0f39a50486c4495706ffc9901ee6 --- /dev/null +++ b/codenet/public_test_cases/p03168/output.0.txt @@ -0,0 +1 @@ +0.612 diff --git a/codenet/public_test_cases/p03168/output.1.txt b/codenet/public_test_cases/p03168/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e9378c0e85576fcd9f693adde6ea5d1de5c6eb1 --- /dev/null +++ b/codenet/public_test_cases/p03168/output.1.txt @@ -0,0 +1 @@ +0.3821815872 diff --git a/codenet/public_test_cases/p03168/output.2.txt b/codenet/public_test_cases/p03168/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb3c4fe4eebcdea3da0790cc0ba74cb286ec4f4 --- /dev/null +++ b/codenet/public_test_cases/p03168/output.2.txt @@ -0,0 +1 @@ +0.5 diff --git a/codenet/public_test_cases/p03168/output.3.txt b/codenet/public_test_cases/p03168/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5bdaa81030a0f39a50486c4495706ffc9901ee6 --- /dev/null +++ b/codenet/public_test_cases/p03168/output.3.txt @@ -0,0 +1 @@ +0.612 diff --git a/codenet/public_test_cases/p03169/input.0.txt b/codenet/public_test_cases/p03169/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d86050b0e039e215b0da8a93663a9bb6efd092a --- /dev/null +++ b/codenet/public_test_cases/p03169/input.0.txt @@ -0,0 +1,2 @@ +3 +1 1 1 diff --git a/codenet/public_test_cases/p03169/input.1.txt b/codenet/public_test_cases/p03169/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p03169/input.1.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p03169/input.2.txt b/codenet/public_test_cases/p03169/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p03169/input.2.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p03169/input.3.txt b/codenet/public_test_cases/p03169/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d86050b0e039e215b0da8a93663a9bb6efd092a --- /dev/null +++ b/codenet/public_test_cases/p03169/input.3.txt @@ -0,0 +1,2 @@ +3 +1 1 1 diff --git a/codenet/public_test_cases/p03169/input.4.txt b/codenet/public_test_cases/p03169/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..61b4bb54b456923e6509103c6dcc0e07e6bb2d28 --- /dev/null +++ b/codenet/public_test_cases/p03169/input.4.txt @@ -0,0 +1,2 @@ +10 +1 3 2 3 3 2 3 2 1 3 diff --git a/codenet/public_test_cases/p03169/output.0.txt b/codenet/public_test_cases/p03169/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ad974f6109e4bf8a9c47b6d1870e2b4990d9841 --- /dev/null +++ b/codenet/public_test_cases/p03169/output.0.txt @@ -0,0 +1 @@ +5.5 diff --git a/codenet/public_test_cases/p03169/output.1.txt b/codenet/public_test_cases/p03169/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03169/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03169/output.2.txt b/codenet/public_test_cases/p03169/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4caecc733e6bc437e8afacd9a27cd84edd18a5bc --- /dev/null +++ b/codenet/public_test_cases/p03169/output.2.txt @@ -0,0 +1 @@ +4.5 diff --git a/codenet/public_test_cases/p03169/output.3.txt b/codenet/public_test_cases/p03169/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ad974f6109e4bf8a9c47b6d1870e2b4990d9841 --- /dev/null +++ b/codenet/public_test_cases/p03169/output.3.txt @@ -0,0 +1 @@ +5.5 diff --git a/codenet/public_test_cases/p03169/output.4.txt b/codenet/public_test_cases/p03169/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1036ee6fc4c1e4a750e5e9b68d3766401c52c5b3 --- /dev/null +++ b/codenet/public_test_cases/p03169/output.4.txt @@ -0,0 +1 @@ +54.48064457488221 diff --git a/codenet/public_test_cases/p03170/input.0.txt b/codenet/public_test_cases/p03170/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4c1aca9b8ece5eccb4ac65567ddd03f92fc720a --- /dev/null +++ b/codenet/public_test_cases/p03170/input.0.txt @@ -0,0 +1,2 @@ +2 4 +2 3 diff --git a/codenet/public_test_cases/p03170/input.1.txt b/codenet/public_test_cases/p03170/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e99d4c597e0421be0378274107d3a1d49c60b51 --- /dev/null +++ b/codenet/public_test_cases/p03170/input.1.txt @@ -0,0 +1,2 @@ +1 100000 +1 diff --git a/codenet/public_test_cases/p03170/input.2.txt b/codenet/public_test_cases/p03170/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c81eeb04483e1f488f3ad8331093ce6de60dde4 --- /dev/null +++ b/codenet/public_test_cases/p03170/input.2.txt @@ -0,0 +1,2 @@ +3 21 +1 2 3 diff --git a/codenet/public_test_cases/p03170/input.3.txt b/codenet/public_test_cases/p03170/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2c643635c1b3b3cc8908bbadd15c687dedca803 --- /dev/null +++ b/codenet/public_test_cases/p03170/input.3.txt @@ -0,0 +1,2 @@ +2 5 +2 3 diff --git a/codenet/public_test_cases/p03170/input.4.txt b/codenet/public_test_cases/p03170/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4c1aca9b8ece5eccb4ac65567ddd03f92fc720a --- /dev/null +++ b/codenet/public_test_cases/p03170/input.4.txt @@ -0,0 +1,2 @@ +2 4 +2 3 diff --git a/codenet/public_test_cases/p03170/input.5.txt b/codenet/public_test_cases/p03170/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..79ccbdde8dd4e9eb4c9763238b7f354ca13842b9 --- /dev/null +++ b/codenet/public_test_cases/p03170/input.5.txt @@ -0,0 +1,2 @@ +2 7 +2 3 diff --git a/codenet/public_test_cases/p03170/input.6.txt b/codenet/public_test_cases/p03170/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..5881577ad8ae5b9f1b0c08316e72c6543a6316cf --- /dev/null +++ b/codenet/public_test_cases/p03170/input.6.txt @@ -0,0 +1,2 @@ +3 20 +1 2 3 diff --git a/codenet/public_test_cases/p03170/output.0.txt b/codenet/public_test_cases/p03170/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03170/output.0.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03170/output.1.txt b/codenet/public_test_cases/p03170/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p03170/output.1.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p03170/output.2.txt b/codenet/public_test_cases/p03170/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03170/output.2.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03170/output.3.txt b/codenet/public_test_cases/p03170/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p03170/output.3.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p03170/output.4.txt b/codenet/public_test_cases/p03170/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03170/output.4.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03170/output.5.txt b/codenet/public_test_cases/p03170/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03170/output.5.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03170/output.6.txt b/codenet/public_test_cases/p03170/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p03170/output.6.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p03171/input.0.txt b/codenet/public_test_cases/p03171/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d3d23a3209b552e2eed5d9269f43d85aad073ab --- /dev/null +++ b/codenet/public_test_cases/p03171/input.0.txt @@ -0,0 +1,2 @@ +4 +10 80 90 30 diff --git a/codenet/public_test_cases/p03171/input.1.txt b/codenet/public_test_cases/p03171/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d3d23a3209b552e2eed5d9269f43d85aad073ab --- /dev/null +++ b/codenet/public_test_cases/p03171/input.1.txt @@ -0,0 +1,2 @@ +4 +10 80 90 30 diff --git a/codenet/public_test_cases/p03171/input.2.txt b/codenet/public_test_cases/p03171/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..235bbbc6e5a8c05398bc8ef6e22590ad94e5d7f2 --- /dev/null +++ b/codenet/public_test_cases/p03171/input.2.txt @@ -0,0 +1,2 @@ +10 +1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 diff --git a/codenet/public_test_cases/p03171/input.3.txt b/codenet/public_test_cases/p03171/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2a030c4a731d35d875039b7199ea2f14ee38792 --- /dev/null +++ b/codenet/public_test_cases/p03171/input.3.txt @@ -0,0 +1,2 @@ +3 +10 100 10 diff --git a/codenet/public_test_cases/p03171/input.4.txt b/codenet/public_test_cases/p03171/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b258dc3d8a70dfd158dac8e5a6905f41cadd45f4 --- /dev/null +++ b/codenet/public_test_cases/p03171/input.4.txt @@ -0,0 +1,2 @@ +1 +10 diff --git a/codenet/public_test_cases/p03171/input.5.txt b/codenet/public_test_cases/p03171/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a9fd3459e409e05cd6968c20197fe5d8d2b6db7 --- /dev/null +++ b/codenet/public_test_cases/p03171/input.5.txt @@ -0,0 +1,2 @@ +6 +4 2 9 7 1 5 diff --git a/codenet/public_test_cases/p03171/output.0.txt b/codenet/public_test_cases/p03171/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03171/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03171/output.1.txt b/codenet/public_test_cases/p03171/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03171/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03171/output.2.txt b/codenet/public_test_cases/p03171/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ae47d83131453682fb9135f6ef9e2b12113a034 --- /dev/null +++ b/codenet/public_test_cases/p03171/output.2.txt @@ -0,0 +1 @@ +4999999995 diff --git a/codenet/public_test_cases/p03171/output.3.txt b/codenet/public_test_cases/p03171/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e547f5ab41141ffc6402e2ea8e804ea3ec9debce --- /dev/null +++ b/codenet/public_test_cases/p03171/output.3.txt @@ -0,0 +1 @@ +-80 diff --git a/codenet/public_test_cases/p03171/output.4.txt b/codenet/public_test_cases/p03171/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03171/output.4.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03171/output.5.txt b/codenet/public_test_cases/p03171/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03171/output.5.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03172/input.0.txt b/codenet/public_test_cases/p03172/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c2bdbca01eb168789afdc8a94a4c680a7d48e28 --- /dev/null +++ b/codenet/public_test_cases/p03172/input.0.txt @@ -0,0 +1,2 @@ +3 4 +1 2 3 diff --git a/codenet/public_test_cases/p03172/input.1.txt b/codenet/public_test_cases/p03172/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6d4d34f52a656b267330a4d87c212c0404b2708 --- /dev/null +++ b/codenet/public_test_cases/p03172/input.1.txt @@ -0,0 +1,2 @@ +2 0 +0 0 diff --git a/codenet/public_test_cases/p03172/input.2.txt b/codenet/public_test_cases/p03172/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3b505b4d3ab677b1646c1f69f96dc6fc7e1a80f --- /dev/null +++ b/codenet/public_test_cases/p03172/input.2.txt @@ -0,0 +1,2 @@ +1 10 +9 diff --git a/codenet/public_test_cases/p03172/input.3.txt b/codenet/public_test_cases/p03172/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ec6143f567c129557c61bbf7bba7d9100892ec8 --- /dev/null +++ b/codenet/public_test_cases/p03172/input.3.txt @@ -0,0 +1,2 @@ +4 100000 +100000 100000 100000 100000 diff --git a/codenet/public_test_cases/p03172/input.4.txt b/codenet/public_test_cases/p03172/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c2bdbca01eb168789afdc8a94a4c680a7d48e28 --- /dev/null +++ b/codenet/public_test_cases/p03172/input.4.txt @@ -0,0 +1,2 @@ +3 4 +1 2 3 diff --git a/codenet/public_test_cases/p03172/output.0.txt b/codenet/public_test_cases/p03172/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03172/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03172/output.1.txt b/codenet/public_test_cases/p03172/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03172/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03172/output.2.txt b/codenet/public_test_cases/p03172/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03172/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03172/output.3.txt b/codenet/public_test_cases/p03172/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d4bee1bdd5afdc33233220a3c9fdb9436263f17 --- /dev/null +++ b/codenet/public_test_cases/p03172/output.3.txt @@ -0,0 +1 @@ +665683269 diff --git a/codenet/public_test_cases/p03172/output.4.txt b/codenet/public_test_cases/p03172/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03172/output.4.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03173/input.0.txt b/codenet/public_test_cases/p03173/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69566f1b33339d9254b16d95bb3a6cfa646a44b8 --- /dev/null +++ b/codenet/public_test_cases/p03173/input.0.txt @@ -0,0 +1,2 @@ +4 +10 20 30 40 diff --git a/codenet/public_test_cases/p03173/input.1.txt b/codenet/public_test_cases/p03173/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e625e17845d199d077b582593d8f3a78020a001 --- /dev/null +++ b/codenet/public_test_cases/p03173/input.1.txt @@ -0,0 +1,2 @@ +6 +7 6 8 6 1 1 diff --git a/codenet/public_test_cases/p03173/input.2.txt b/codenet/public_test_cases/p03173/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58000f0a13730a76373d14c900ba28d7fe94c04f --- /dev/null +++ b/codenet/public_test_cases/p03173/input.2.txt @@ -0,0 +1,2 @@ +5 +10 10 10 10 10 diff --git a/codenet/public_test_cases/p03173/input.3.txt b/codenet/public_test_cases/p03173/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4728e084a02b8f1b798e62b8e6a4aad344fcd11 --- /dev/null +++ b/codenet/public_test_cases/p03173/input.3.txt @@ -0,0 +1,2 @@ +3 +1000000000 1000000000 1000000000 diff --git a/codenet/public_test_cases/p03173/input.4.txt b/codenet/public_test_cases/p03173/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..69566f1b33339d9254b16d95bb3a6cfa646a44b8 --- /dev/null +++ b/codenet/public_test_cases/p03173/input.4.txt @@ -0,0 +1,2 @@ +4 +10 20 30 40 diff --git a/codenet/public_test_cases/p03173/output.0.txt b/codenet/public_test_cases/p03173/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..598ed30e89eae2dd245fbeb4558c57a57e10ea6d --- /dev/null +++ b/codenet/public_test_cases/p03173/output.0.txt @@ -0,0 +1 @@ +190 diff --git a/codenet/public_test_cases/p03173/output.1.txt b/codenet/public_test_cases/p03173/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..38b10c1b2badd802b554ecc944a7a40c5f055d47 --- /dev/null +++ b/codenet/public_test_cases/p03173/output.1.txt @@ -0,0 +1 @@ +68 diff --git a/codenet/public_test_cases/p03173/output.2.txt b/codenet/public_test_cases/p03173/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..52bd8e43afb01d0c9747f1fedf2fc94684ee4cc4 --- /dev/null +++ b/codenet/public_test_cases/p03173/output.2.txt @@ -0,0 +1 @@ +120 diff --git a/codenet/public_test_cases/p03173/output.3.txt b/codenet/public_test_cases/p03173/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d007f6b285ebc6d303e5e7e879d03901ba847a5e --- /dev/null +++ b/codenet/public_test_cases/p03173/output.3.txt @@ -0,0 +1 @@ +5000000000 diff --git a/codenet/public_test_cases/p03173/output.4.txt b/codenet/public_test_cases/p03173/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..598ed30e89eae2dd245fbeb4558c57a57e10ea6d --- /dev/null +++ b/codenet/public_test_cases/p03173/output.4.txt @@ -0,0 +1 @@ +190 diff --git a/codenet/public_test_cases/p03174/input.0.txt b/codenet/public_test_cases/p03174/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..920819dce19d2b6cdfedccc901b043d6ba690e7b --- /dev/null +++ b/codenet/public_test_cases/p03174/input.0.txt @@ -0,0 +1,4 @@ +3 +0 1 1 +1 0 1 +1 1 1 diff --git a/codenet/public_test_cases/p03174/input.1.txt b/codenet/public_test_cases/p03174/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b261da18d51a39dc2cf0d156791e9c0b35dd83f4 --- /dev/null +++ b/codenet/public_test_cases/p03174/input.1.txt @@ -0,0 +1,2 @@ +1 +0 diff --git a/codenet/public_test_cases/p03174/input.2.txt b/codenet/public_test_cases/p03174/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78c66ef78d1a455e7210c06b9ff74c8540f0e7ca --- /dev/null +++ b/codenet/public_test_cases/p03174/input.2.txt @@ -0,0 +1,5 @@ +4 +0 1 0 0 +0 0 0 1 +1 0 0 0 +0 0 1 0 diff --git a/codenet/public_test_cases/p03174/input.3.txt b/codenet/public_test_cases/p03174/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b00abfc5b79df038cee863790fe1de2a29d28986 --- /dev/null +++ b/codenet/public_test_cases/p03174/input.3.txt @@ -0,0 +1,22 @@ +21 +0 0 0 0 0 0 0 1 1 0 1 1 1 1 0 0 0 1 0 0 1 +1 1 1 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 1 1 0 +0 0 1 1 1 1 0 1 1 0 0 1 0 0 1 1 0 0 0 1 1 +0 1 1 0 1 1 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0 +1 1 0 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 +0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 1 1 1 0 0 1 +0 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 1 1 0 1 0 +0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 1 1 1 1 1 1 +0 0 1 0 0 1 0 0 1 0 1 1 0 0 1 0 1 0 1 1 1 +0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 +0 1 1 0 1 1 0 0 1 1 0 0 0 1 1 1 1 0 1 1 0 +0 0 1 0 0 1 1 1 1 0 1 1 0 1 1 1 0 0 0 0 1 +0 1 1 0 0 1 1 1 1 0 0 0 1 0 1 1 0 1 0 1 1 +1 1 1 1 1 0 0 0 0 1 0 0 1 1 0 1 1 1 0 0 1 +0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 +1 0 1 1 0 1 0 1 0 0 1 0 0 1 1 0 1 0 1 1 0 +0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 +0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 0 1 1 0 1 +0 0 0 0 1 1 1 0 1 0 1 1 1 0 1 1 0 0 1 1 0 +1 1 0 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 0 1 0 +1 0 0 1 1 0 1 1 1 1 1 0 1 0 1 1 0 0 0 0 0 diff --git a/codenet/public_test_cases/p03174/input.4.txt b/codenet/public_test_cases/p03174/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..920819dce19d2b6cdfedccc901b043d6ba690e7b --- /dev/null +++ b/codenet/public_test_cases/p03174/input.4.txt @@ -0,0 +1,4 @@ +3 +0 1 1 +1 0 1 +1 1 1 diff --git a/codenet/public_test_cases/p03174/output.0.txt b/codenet/public_test_cases/p03174/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03174/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03174/output.1.txt b/codenet/public_test_cases/p03174/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03174/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03174/output.2.txt b/codenet/public_test_cases/p03174/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03174/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03174/output.3.txt b/codenet/public_test_cases/p03174/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bc28c4355253e227809d4788ab672db879c3374 --- /dev/null +++ b/codenet/public_test_cases/p03174/output.3.txt @@ -0,0 +1 @@ +102515160 diff --git a/codenet/public_test_cases/p03174/output.4.txt b/codenet/public_test_cases/p03174/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03174/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03175/input.0.txt b/codenet/public_test_cases/p03175/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p03175/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03175/input.1.txt b/codenet/public_test_cases/p03175/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p03175/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03175/input.2.txt b/codenet/public_test_cases/p03175/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4834d4e23a86db13492ec18b6c68bba11132751a --- /dev/null +++ b/codenet/public_test_cases/p03175/input.2.txt @@ -0,0 +1,10 @@ +10 +8 5 +10 8 +6 5 +1 5 +4 8 +2 10 +3 6 +9 2 +1 7 diff --git a/codenet/public_test_cases/p03175/input.3.txt b/codenet/public_test_cases/p03175/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03175/input.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03175/input.4.txt b/codenet/public_test_cases/p03175/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e7e919d9086f19d0faf1800efb363a22b6e6b8 --- /dev/null +++ b/codenet/public_test_cases/p03175/input.4.txt @@ -0,0 +1,4 @@ +4 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p03175/output.0.txt b/codenet/public_test_cases/p03175/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03175/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03175/output.1.txt b/codenet/public_test_cases/p03175/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03175/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03175/output.2.txt b/codenet/public_test_cases/p03175/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29e49a01179147c8d27c44241212965aed8633af --- /dev/null +++ b/codenet/public_test_cases/p03175/output.2.txt @@ -0,0 +1 @@ +157 diff --git a/codenet/public_test_cases/p03175/output.3.txt b/codenet/public_test_cases/p03175/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03175/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03175/output.4.txt b/codenet/public_test_cases/p03175/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03175/output.4.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03176/input.0.txt b/codenet/public_test_cases/p03176/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56d902e134fd7099a4f64896bd00bf7f0bc57cd5 --- /dev/null +++ b/codenet/public_test_cases/p03176/input.0.txt @@ -0,0 +1,3 @@ +4 +3 1 4 2 +10 20 30 40 diff --git a/codenet/public_test_cases/p03176/input.1.txt b/codenet/public_test_cases/p03176/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9912646286ceaa7b5cfa8a4aa206a0ba31abaa5d --- /dev/null +++ b/codenet/public_test_cases/p03176/input.1.txt @@ -0,0 +1,3 @@ +5 +1 2 3 4 5 +1000000000 1000000000 1000000000 1000000000 1000000000 diff --git a/codenet/public_test_cases/p03176/input.2.txt b/codenet/public_test_cases/p03176/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..56d902e134fd7099a4f64896bd00bf7f0bc57cd5 --- /dev/null +++ b/codenet/public_test_cases/p03176/input.2.txt @@ -0,0 +1,3 @@ +4 +3 1 4 2 +10 20 30 40 diff --git a/codenet/public_test_cases/p03176/input.3.txt b/codenet/public_test_cases/p03176/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2049ba26379b1b79873aa790829999080f7f7da7 --- /dev/null +++ b/codenet/public_test_cases/p03176/input.3.txt @@ -0,0 +1,3 @@ +1 +1 +10 diff --git a/codenet/public_test_cases/p03176/input.4.txt b/codenet/public_test_cases/p03176/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0664679d468249698d33a37f4a7428ee0a453f83 --- /dev/null +++ b/codenet/public_test_cases/p03176/input.4.txt @@ -0,0 +1,3 @@ +9 +4 2 5 8 3 6 1 7 9 +6 8 8 4 6 3 5 7 5 diff --git a/codenet/public_test_cases/p03176/output.0.txt b/codenet/public_test_cases/p03176/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p03176/output.0.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p03176/output.1.txt b/codenet/public_test_cases/p03176/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d007f6b285ebc6d303e5e7e879d03901ba847a5e --- /dev/null +++ b/codenet/public_test_cases/p03176/output.1.txt @@ -0,0 +1 @@ +5000000000 diff --git a/codenet/public_test_cases/p03176/output.2.txt b/codenet/public_test_cases/p03176/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p03176/output.2.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p03176/output.3.txt b/codenet/public_test_cases/p03176/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03176/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03176/output.4.txt b/codenet/public_test_cases/p03176/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e85087affded170efcbc6f9672a6fc671d839ed0 --- /dev/null +++ b/codenet/public_test_cases/p03176/output.4.txt @@ -0,0 +1 @@ +31 diff --git a/codenet/public_test_cases/p03177/input.0.txt b/codenet/public_test_cases/p03177/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7243f668759d58289b051cb78f45e065ecdeaac3 --- /dev/null +++ b/codenet/public_test_cases/p03177/input.0.txt @@ -0,0 +1,5 @@ +4 2 +0 1 0 0 +0 0 1 1 +0 0 0 1 +1 0 0 0 diff --git a/codenet/public_test_cases/p03177/input.1.txt b/codenet/public_test_cases/p03177/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b774dab2b2a8a99b5977390fb9d06e6fcaae52e --- /dev/null +++ b/codenet/public_test_cases/p03177/input.1.txt @@ -0,0 +1,2 @@ +1 1 +0 diff --git a/codenet/public_test_cases/p03177/input.2.txt b/codenet/public_test_cases/p03177/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7243f668759d58289b051cb78f45e065ecdeaac3 --- /dev/null +++ b/codenet/public_test_cases/p03177/input.2.txt @@ -0,0 +1,5 @@ +4 2 +0 1 0 0 +0 0 1 1 +0 0 0 1 +1 0 0 0 diff --git a/codenet/public_test_cases/p03177/input.3.txt b/codenet/public_test_cases/p03177/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c9037950a81704cb8b97fb30f073fd3b38dfcce --- /dev/null +++ b/codenet/public_test_cases/p03177/input.3.txt @@ -0,0 +1,4 @@ +3 3 +0 1 0 +1 0 1 +0 0 0 diff --git a/codenet/public_test_cases/p03177/input.4.txt b/codenet/public_test_cases/p03177/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2ed5baffa20c07f6a558e585e32607c39f24437 --- /dev/null +++ b/codenet/public_test_cases/p03177/input.4.txt @@ -0,0 +1,11 @@ +10 1000000000000000000 +0 0 1 1 0 0 0 1 1 0 +0 0 0 0 0 1 1 1 0 0 +0 1 0 0 0 1 0 1 0 1 +1 1 1 0 1 1 0 1 1 0 +0 1 1 1 0 1 0 1 1 1 +0 0 0 1 0 0 1 0 1 0 +0 0 0 1 1 0 0 1 0 1 +1 0 0 0 1 0 1 0 0 0 +0 0 0 0 0 1 0 0 0 0 +1 0 1 1 1 0 1 1 1 0 diff --git a/codenet/public_test_cases/p03177/input.5.txt b/codenet/public_test_cases/p03177/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..85d5801208225dcb35ee295a726be33a5ea74e53 --- /dev/null +++ b/codenet/public_test_cases/p03177/input.5.txt @@ -0,0 +1,7 @@ +6 2 +0 0 0 0 0 0 +0 0 1 0 0 0 +0 0 0 0 0 0 +0 0 0 0 1 0 +0 0 0 0 0 1 +0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p03177/output.0.txt b/codenet/public_test_cases/p03177/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03177/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03177/output.1.txt b/codenet/public_test_cases/p03177/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03177/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03177/output.2.txt b/codenet/public_test_cases/p03177/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03177/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03177/output.3.txt b/codenet/public_test_cases/p03177/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03177/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03177/output.4.txt b/codenet/public_test_cases/p03177/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed1742f9bce5add560fcfedec91d69f202ab63dc --- /dev/null +++ b/codenet/public_test_cases/p03177/output.4.txt @@ -0,0 +1 @@ +957538352 diff --git a/codenet/public_test_cases/p03177/output.5.txt b/codenet/public_test_cases/p03177/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03177/output.5.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03178/input.0.txt b/codenet/public_test_cases/p03178/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e634e1925bc4697f8b17fbf62b53585437b7e01b --- /dev/null +++ b/codenet/public_test_cases/p03178/input.0.txt @@ -0,0 +1,2 @@ +30 +4 diff --git a/codenet/public_test_cases/p03178/input.1.txt b/codenet/public_test_cases/p03178/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b47c55a05052ff87191ef4fbc22107c8c4601b66 --- /dev/null +++ b/codenet/public_test_cases/p03178/input.1.txt @@ -0,0 +1,2 @@ +98765432109876543210 +58 diff --git a/codenet/public_test_cases/p03178/input.2.txt b/codenet/public_test_cases/p03178/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e634e1925bc4697f8b17fbf62b53585437b7e01b --- /dev/null +++ b/codenet/public_test_cases/p03178/input.2.txt @@ -0,0 +1,2 @@ +30 +4 diff --git a/codenet/public_test_cases/p03178/input.3.txt b/codenet/public_test_cases/p03178/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..900d9b1f197b20615b66cf7a39b346e54e38d624 --- /dev/null +++ b/codenet/public_test_cases/p03178/input.3.txt @@ -0,0 +1,2 @@ +1000000009 +1 diff --git a/codenet/public_test_cases/p03178/output.0.txt b/codenet/public_test_cases/p03178/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03178/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03178/output.1.txt b/codenet/public_test_cases/p03178/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bf1729a98d5e9456f7c59c98274d814cf58e2b5 --- /dev/null +++ b/codenet/public_test_cases/p03178/output.1.txt @@ -0,0 +1 @@ +635270834 diff --git a/codenet/public_test_cases/p03178/output.2.txt b/codenet/public_test_cases/p03178/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03178/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03178/output.3.txt b/codenet/public_test_cases/p03178/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03178/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03179/input.0.txt b/codenet/public_test_cases/p03179/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab73e3143d3f3bbfe3ee6a38d5c962143a63a4cd --- /dev/null +++ b/codenet/public_test_cases/p03179/input.0.txt @@ -0,0 +1,2 @@ +4 +<>< diff --git a/codenet/public_test_cases/p03179/input.1.txt b/codenet/public_test_cases/p03179/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdbcab6f97f02919e8af86de92cd2e7833a2bcca --- /dev/null +++ b/codenet/public_test_cases/p03179/input.1.txt @@ -0,0 +1,2 @@ +20 +>>>><>>><>><>>><<>> diff --git a/codenet/public_test_cases/p03179/input.2.txt b/codenet/public_test_cases/p03179/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..46348fc2357fbcb1ca3c1525eb7e8591946cf0b1 --- /dev/null +++ b/codenet/public_test_cases/p03179/input.2.txt @@ -0,0 +1,2 @@ +5 +<<<< diff --git a/codenet/public_test_cases/p03179/input.3.txt b/codenet/public_test_cases/p03179/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab73e3143d3f3bbfe3ee6a38d5c962143a63a4cd --- /dev/null +++ b/codenet/public_test_cases/p03179/input.3.txt @@ -0,0 +1,2 @@ +4 +<>< diff --git a/codenet/public_test_cases/p03179/output.0.txt b/codenet/public_test_cases/p03179/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03179/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03179/output.1.txt b/codenet/public_test_cases/p03179/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7301956bb1715415b9c88ed011e8571b28109812 --- /dev/null +++ b/codenet/public_test_cases/p03179/output.1.txt @@ -0,0 +1 @@ +217136290 diff --git a/codenet/public_test_cases/p03179/output.2.txt b/codenet/public_test_cases/p03179/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03179/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03179/output.3.txt b/codenet/public_test_cases/p03179/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03179/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03180/input.0.txt b/codenet/public_test_cases/p03180/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f39a3e05cd006401c542a42f2d05881aecc549aa --- /dev/null +++ b/codenet/public_test_cases/p03180/input.0.txt @@ -0,0 +1,4 @@ +3 +0 10 20 +10 0 -100 +20 -100 0 diff --git a/codenet/public_test_cases/p03180/input.1.txt b/codenet/public_test_cases/p03180/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f39a3e05cd006401c542a42f2d05881aecc549aa --- /dev/null +++ b/codenet/public_test_cases/p03180/input.1.txt @@ -0,0 +1,4 @@ +3 +0 10 20 +10 0 -100 +20 -100 0 diff --git a/codenet/public_test_cases/p03180/input.2.txt b/codenet/public_test_cases/p03180/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ee526205c647e38cd09cb697f38fa37b47b09b9 --- /dev/null +++ b/codenet/public_test_cases/p03180/input.2.txt @@ -0,0 +1,5 @@ +4 +0 1000000000 1000000000 1000000000 +1000000000 0 1000000000 1000000000 +1000000000 1000000000 0 -1 +1000000000 1000000000 -1 0 diff --git a/codenet/public_test_cases/p03180/input.3.txt b/codenet/public_test_cases/p03180/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c4a9a64332bdba5e2c10262490309faaad1cdf2 --- /dev/null +++ b/codenet/public_test_cases/p03180/input.3.txt @@ -0,0 +1,17 @@ +16 +0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7 +5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9 +-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9 +-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1 +-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3 +-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2 +7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5 +2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8 +-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7 +0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6 +7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3 +0 -1 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0 +2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1 +-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8 +7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9 +7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0 diff --git a/codenet/public_test_cases/p03180/input.4.txt b/codenet/public_test_cases/p03180/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f58bae159446bda9889473055f3b162f7b85b51 --- /dev/null +++ b/codenet/public_test_cases/p03180/input.4.txt @@ -0,0 +1,3 @@ +2 +0 -10 +-10 0 diff --git a/codenet/public_test_cases/p03180/output.0.txt b/codenet/public_test_cases/p03180/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03180/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03180/output.1.txt b/codenet/public_test_cases/p03180/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03180/output.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03180/output.2.txt b/codenet/public_test_cases/p03180/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a37684037827cf0d483095c50d0edd14d7bf2744 --- /dev/null +++ b/codenet/public_test_cases/p03180/output.2.txt @@ -0,0 +1 @@ +4999999999 diff --git a/codenet/public_test_cases/p03180/output.3.txt b/codenet/public_test_cases/p03180/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..94361d49fd91ff9629fe80ddd10a5cb5581cbb0d --- /dev/null +++ b/codenet/public_test_cases/p03180/output.3.txt @@ -0,0 +1 @@ +132 diff --git a/codenet/public_test_cases/p03180/output.4.txt b/codenet/public_test_cases/p03180/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03180/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03181/input.0.txt b/codenet/public_test_cases/p03181/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8660c854634f87ce663404a6e358b5f85fe807c8 --- /dev/null +++ b/codenet/public_test_cases/p03181/input.0.txt @@ -0,0 +1,3 @@ +3 100 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03181/input.1.txt b/codenet/public_test_cases/p03181/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8660c854634f87ce663404a6e358b5f85fe807c8 --- /dev/null +++ b/codenet/public_test_cases/p03181/input.1.txt @@ -0,0 +1,3 @@ +3 100 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03181/input.2.txt b/codenet/public_test_cases/p03181/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eee8d43e090864f4135ce0d23adc39dcfa2cc180 --- /dev/null +++ b/codenet/public_test_cases/p03181/input.2.txt @@ -0,0 +1 @@ +1 100 diff --git a/codenet/public_test_cases/p03181/input.3.txt b/codenet/public_test_cases/p03181/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..72b28f11c37136f7a281ed4dcf66be5f786b1b53 --- /dev/null +++ b/codenet/public_test_cases/p03181/input.3.txt @@ -0,0 +1,10 @@ +10 2 +8 5 +10 8 +6 5 +1 5 +4 8 +2 10 +3 6 +9 2 +1 7 diff --git a/codenet/public_test_cases/p03181/input.4.txt b/codenet/public_test_cases/p03181/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..bcd5e3f8bcfbace42f8ec4acae2f7ffe5420dcc7 --- /dev/null +++ b/codenet/public_test_cases/p03181/input.4.txt @@ -0,0 +1,4 @@ +4 100 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p03181/output.0.txt b/codenet/public_test_cases/p03181/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4b39f0f4104b146b7484db30bc157618e8eb98e --- /dev/null +++ b/codenet/public_test_cases/p03181/output.0.txt @@ -0,0 +1,3 @@ +3 +4 +3 diff --git a/codenet/public_test_cases/p03181/output.1.txt b/codenet/public_test_cases/p03181/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4b39f0f4104b146b7484db30bc157618e8eb98e --- /dev/null +++ b/codenet/public_test_cases/p03181/output.1.txt @@ -0,0 +1,3 @@ +3 +4 +3 diff --git a/codenet/public_test_cases/p03181/output.2.txt b/codenet/public_test_cases/p03181/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03181/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03181/output.3.txt b/codenet/public_test_cases/p03181/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3461dc41b56f2da00ff24d4c721bfa6662eace53 --- /dev/null +++ b/codenet/public_test_cases/p03181/output.3.txt @@ -0,0 +1,10 @@ +0 +0 +1 +1 +1 +0 +1 +0 +1 +1 diff --git a/codenet/public_test_cases/p03181/output.4.txt b/codenet/public_test_cases/p03181/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9229c9932a178f4a1b8bd83ae868198464ec2c76 --- /dev/null +++ b/codenet/public_test_cases/p03181/output.4.txt @@ -0,0 +1,4 @@ +8 +5 +5 +5 diff --git a/codenet/public_test_cases/p03182/input.0.txt b/codenet/public_test_cases/p03182/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa7c627907490bb780ba06a69b632d897dd88c1e --- /dev/null +++ b/codenet/public_test_cases/p03182/input.0.txt @@ -0,0 +1,4 @@ +5 3 +1 3 10 +2 4 -10 +3 5 10 diff --git a/codenet/public_test_cases/p03182/output.0.txt b/codenet/public_test_cases/p03182/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03182/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03183/input.0.txt b/codenet/public_test_cases/p03183/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1fdce173def5b4ddeb4434bca814a10840ae67c --- /dev/null +++ b/codenet/public_test_cases/p03183/input.0.txt @@ -0,0 +1,4 @@ +3 +2 2 20 +2 1 30 +3 1 40 diff --git a/codenet/public_test_cases/p03183/input.1.txt b/codenet/public_test_cases/p03183/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a03ae12012e0f147229d30152d346eb424a19e39 --- /dev/null +++ b/codenet/public_test_cases/p03183/input.1.txt @@ -0,0 +1,6 @@ +5 +1 10000 1000000000 +1 10000 1000000000 +1 10000 1000000000 +1 10000 1000000000 +1 10000 1000000000 diff --git a/codenet/public_test_cases/p03183/input.2.txt b/codenet/public_test_cases/p03183/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1fdce173def5b4ddeb4434bca814a10840ae67c --- /dev/null +++ b/codenet/public_test_cases/p03183/input.2.txt @@ -0,0 +1,4 @@ +3 +2 2 20 +2 1 30 +3 1 40 diff --git a/codenet/public_test_cases/p03183/input.3.txt b/codenet/public_test_cases/p03183/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..34e833fb00b73f59673c61d21074d2fb27c85aa6 --- /dev/null +++ b/codenet/public_test_cases/p03183/input.3.txt @@ -0,0 +1,5 @@ +4 +1 2 10 +3 1 10 +2 4 10 +1 6 10 diff --git a/codenet/public_test_cases/p03183/input.4.txt b/codenet/public_test_cases/p03183/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d884a6495d4cf6cf0fd1f24735e0498aa0784986 --- /dev/null +++ b/codenet/public_test_cases/p03183/input.4.txt @@ -0,0 +1,9 @@ +8 +9 5 7 +6 2 7 +5 7 3 +7 8 8 +1 9 6 +3 3 3 +4 1 7 +4 5 5 diff --git a/codenet/public_test_cases/p03183/output.0.txt b/codenet/public_test_cases/p03183/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p03183/output.0.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p03183/output.1.txt b/codenet/public_test_cases/p03183/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d007f6b285ebc6d303e5e7e879d03901ba847a5e --- /dev/null +++ b/codenet/public_test_cases/p03183/output.1.txt @@ -0,0 +1 @@ +5000000000 diff --git a/codenet/public_test_cases/p03183/output.2.txt b/codenet/public_test_cases/p03183/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p03183/output.2.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p03183/output.3.txt b/codenet/public_test_cases/p03183/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03183/output.3.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03183/output.4.txt b/codenet/public_test_cases/p03183/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03183/output.4.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03184/input.0.txt b/codenet/public_test_cases/p03184/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..291b14122a19fa1f55271978e486c4c124e2b37d --- /dev/null +++ b/codenet/public_test_cases/p03184/input.0.txt @@ -0,0 +1,3 @@ +3 4 2 +2 2 +1 4 diff --git a/codenet/public_test_cases/p03184/input.1.txt b/codenet/public_test_cases/p03184/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e530e0868b2668989d68a2a62ebf1beef69f7aed --- /dev/null +++ b/codenet/public_test_cases/p03184/input.1.txt @@ -0,0 +1,3 @@ +5 2 2 +2 1 +4 2 diff --git a/codenet/public_test_cases/p03184/input.2.txt b/codenet/public_test_cases/p03184/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9d0ad0ad3cf2fbefa5146f9307a2758f02928ca --- /dev/null +++ b/codenet/public_test_cases/p03184/input.2.txt @@ -0,0 +1,2 @@ +100000 100000 1 +50000 50000 diff --git a/codenet/public_test_cases/p03184/input.3.txt b/codenet/public_test_cases/p03184/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..291b14122a19fa1f55271978e486c4c124e2b37d --- /dev/null +++ b/codenet/public_test_cases/p03184/input.3.txt @@ -0,0 +1,3 @@ +3 4 2 +2 2 +1 4 diff --git a/codenet/public_test_cases/p03184/input.4.txt b/codenet/public_test_cases/p03184/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaaa7899c20db934d1d360e8f439c115994c4df1 --- /dev/null +++ b/codenet/public_test_cases/p03184/input.4.txt @@ -0,0 +1,5 @@ +5 5 4 +3 1 +3 5 +1 3 +5 3 diff --git a/codenet/public_test_cases/p03184/output.0.txt b/codenet/public_test_cases/p03184/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03184/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03184/output.1.txt b/codenet/public_test_cases/p03184/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03184/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03184/output.2.txt b/codenet/public_test_cases/p03184/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f88258def0afa32bdfeaee6bbb6198134a507b5 --- /dev/null +++ b/codenet/public_test_cases/p03184/output.2.txt @@ -0,0 +1 @@ +123445622 diff --git a/codenet/public_test_cases/p03184/output.3.txt b/codenet/public_test_cases/p03184/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03184/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03184/output.4.txt b/codenet/public_test_cases/p03184/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p03184/output.4.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p03185/input.0.txt b/codenet/public_test_cases/p03185/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..815909026294417f198dce0b93f9a63cb8cbb046 --- /dev/null +++ b/codenet/public_test_cases/p03185/input.0.txt @@ -0,0 +1,2 @@ +5 6 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03185/input.1.txt b/codenet/public_test_cases/p03185/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..972cbddb64be6ab9de2fda749fa995d815a308c7 --- /dev/null +++ b/codenet/public_test_cases/p03185/input.1.txt @@ -0,0 +1,2 @@ +8 5 +1 3 4 5 10 11 12 13 diff --git a/codenet/public_test_cases/p03185/input.2.txt b/codenet/public_test_cases/p03185/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..68ed0e5c4a3db2ba1bba61cc9bda014d638b05ab --- /dev/null +++ b/codenet/public_test_cases/p03185/input.2.txt @@ -0,0 +1,2 @@ +2 1000000000000 +500000 1000000 diff --git a/codenet/public_test_cases/p03185/input.3.txt b/codenet/public_test_cases/p03185/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..815909026294417f198dce0b93f9a63cb8cbb046 --- /dev/null +++ b/codenet/public_test_cases/p03185/input.3.txt @@ -0,0 +1,2 @@ +5 6 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03185/output.0.txt b/codenet/public_test_cases/p03185/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03185/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03185/output.1.txt b/codenet/public_test_cases/p03185/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8fa06e1be7da01425d2be19da24595de2fa02c2 --- /dev/null +++ b/codenet/public_test_cases/p03185/output.1.txt @@ -0,0 +1 @@ +62 diff --git a/codenet/public_test_cases/p03185/output.2.txt b/codenet/public_test_cases/p03185/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8c958bc3f50055ee4d0ebba551339f67d7ad4d9 --- /dev/null +++ b/codenet/public_test_cases/p03185/output.2.txt @@ -0,0 +1 @@ +1250000000000 diff --git a/codenet/public_test_cases/p03185/output.3.txt b/codenet/public_test_cases/p03185/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03185/output.3.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03186/input.0.txt b/codenet/public_test_cases/p03186/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a46f5080b5038d22913c906f987ba65fb8fa7ed1 --- /dev/null +++ b/codenet/public_test_cases/p03186/input.0.txt @@ -0,0 +1 @@ +3 1 4 diff --git a/codenet/public_test_cases/p03186/input.1.txt b/codenet/public_test_cases/p03186/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a46f5080b5038d22913c906f987ba65fb8fa7ed1 --- /dev/null +++ b/codenet/public_test_cases/p03186/input.1.txt @@ -0,0 +1 @@ +3 1 4 diff --git a/codenet/public_test_cases/p03186/input.2.txt b/codenet/public_test_cases/p03186/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bbb2c95ebcfa96e879c3a8038938ebe79b6ba9a --- /dev/null +++ b/codenet/public_test_cases/p03186/input.2.txt @@ -0,0 +1 @@ +8 8 1 diff --git a/codenet/public_test_cases/p03186/input.3.txt b/codenet/public_test_cases/p03186/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..09bb20c8014f2d5c30da66249ac944225259047a --- /dev/null +++ b/codenet/public_test_cases/p03186/input.3.txt @@ -0,0 +1 @@ +5 2 9 diff --git a/codenet/public_test_cases/p03186/output.0.txt b/codenet/public_test_cases/p03186/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03186/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03186/output.1.txt b/codenet/public_test_cases/p03186/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03186/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03186/output.2.txt b/codenet/public_test_cases/p03186/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03186/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03186/output.3.txt b/codenet/public_test_cases/p03186/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03186/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03187/input.0.txt b/codenet/public_test_cases/p03187/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..163f1d772e27d316c0a5722f6eb367b237b0cb68 --- /dev/null +++ b/codenet/public_test_cases/p03187/input.0.txt @@ -0,0 +1,4 @@ +10 3 +2 +7 +9 diff --git a/codenet/public_test_cases/p03187/input.1.txt b/codenet/public_test_cases/p03187/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9b6cb64236686ea7e9425bbfa9e944d58be579c --- /dev/null +++ b/codenet/public_test_cases/p03187/input.1.txt @@ -0,0 +1,8 @@ +314159265 7 +21662711 +77271666 +89022761 +156626166 +160332356 +166902656 +298992265 diff --git a/codenet/public_test_cases/p03187/input.2.txt b/codenet/public_test_cases/p03187/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..64c735f0a590eab73ccc9e5705314c7dc31e837d --- /dev/null +++ b/codenet/public_test_cases/p03187/input.2.txt @@ -0,0 +1,7 @@ +10 6 +1 +2 +3 +6 +7 +9 diff --git a/codenet/public_test_cases/p03187/input.3.txt b/codenet/public_test_cases/p03187/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..163f1d772e27d316c0a5722f6eb367b237b0cb68 --- /dev/null +++ b/codenet/public_test_cases/p03187/input.3.txt @@ -0,0 +1,4 @@ +10 3 +2 +7 +9 diff --git a/codenet/public_test_cases/p03187/output.0.txt b/codenet/public_test_cases/p03187/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03187/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03187/output.1.txt b/codenet/public_test_cases/p03187/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd4b74cedf52c67f4e97e97e1a01fc45259ef945 --- /dev/null +++ b/codenet/public_test_cases/p03187/output.1.txt @@ -0,0 +1 @@ +1204124749 diff --git a/codenet/public_test_cases/p03187/output.2.txt b/codenet/public_test_cases/p03187/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p03187/output.2.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p03187/output.3.txt b/codenet/public_test_cases/p03187/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03187/output.3.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03188/input.0.txt b/codenet/public_test_cases/p03188/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03188/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03188/input.1.txt b/codenet/public_test_cases/p03188/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03188/input.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03188/input.2.txt b/codenet/public_test_cases/p03188/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03188/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03188/output.0.txt b/codenet/public_test_cases/p03188/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4177c616631212bab2cd51c13d254621f79f3805 --- /dev/null +++ b/codenet/public_test_cases/p03188/output.0.txt @@ -0,0 +1,4 @@ +3 +1 1 1 +1 1 1 +2 2 2 diff --git a/codenet/public_test_cases/p03188/output.1.txt b/codenet/public_test_cases/p03188/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c767933a3f06fb7986da4408669a0bfe7594ea58 --- /dev/null +++ b/codenet/public_test_cases/p03188/output.1.txt @@ -0,0 +1,4 @@ +3 +1 2 3 +4 5 6 +7 8 9 diff --git a/codenet/public_test_cases/p03188/output.2.txt b/codenet/public_test_cases/p03188/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4177c616631212bab2cd51c13d254621f79f3805 --- /dev/null +++ b/codenet/public_test_cases/p03188/output.2.txt @@ -0,0 +1,4 @@ +3 +1 1 1 +1 1 1 +2 2 2 diff --git a/codenet/public_test_cases/p03189/input.0.txt b/codenet/public_test_cases/p03189/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e253938b6b879a09d7262c39a2394a35638ae8a1 --- /dev/null +++ b/codenet/public_test_cases/p03189/input.0.txt @@ -0,0 +1,6 @@ +3 2 +1 +2 +3 +1 2 +1 3 diff --git a/codenet/public_test_cases/p03189/input.1.txt b/codenet/public_test_cases/p03189/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e253938b6b879a09d7262c39a2394a35638ae8a1 --- /dev/null +++ b/codenet/public_test_cases/p03189/input.1.txt @@ -0,0 +1,6 @@ +3 2 +1 +2 +3 +1 2 +1 3 diff --git a/codenet/public_test_cases/p03189/input.2.txt b/codenet/public_test_cases/p03189/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2adbdbb44eb37b1299840b799fbed70521d8da52 --- /dev/null +++ b/codenet/public_test_cases/p03189/input.2.txt @@ -0,0 +1,9 @@ +5 3 +3 +2 +3 +1 +4 +1 5 +2 3 +4 2 diff --git a/codenet/public_test_cases/p03189/input.3.txt b/codenet/public_test_cases/p03189/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3bc5d0faec67478bfa99e9a480fab0fd6d69ad9 --- /dev/null +++ b/codenet/public_test_cases/p03189/input.3.txt @@ -0,0 +1,15 @@ +9 5 +3 +1 +4 +1 +5 +9 +2 +6 +5 +3 5 +8 9 +7 9 +3 2 +3 8 diff --git a/codenet/public_test_cases/p03189/output.0.txt b/codenet/public_test_cases/p03189/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03189/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03189/output.1.txt b/codenet/public_test_cases/p03189/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03189/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03189/output.2.txt b/codenet/public_test_cases/p03189/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p03189/output.2.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p03189/output.3.txt b/codenet/public_test_cases/p03189/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e4a5228abc4023f3ec178d58a0fefd20c97e61e --- /dev/null +++ b/codenet/public_test_cases/p03189/output.3.txt @@ -0,0 +1 @@ +425 diff --git a/codenet/public_test_cases/p03190/input.0.txt b/codenet/public_test_cases/p03190/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..831a73ecfc2e30d801050ee8b8b370004c0b784e --- /dev/null +++ b/codenet/public_test_cases/p03190/input.0.txt @@ -0,0 +1,3 @@ +4 +0011 +0101 diff --git a/codenet/public_test_cases/p03190/input.1.txt b/codenet/public_test_cases/p03190/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e22493782f088a61eee427426ee46732c94f5238 --- /dev/null +++ b/codenet/public_test_cases/p03190/input.1.txt @@ -0,0 +1,3 @@ +1 +0 +0 diff --git a/codenet/public_test_cases/p03190/input.2.txt b/codenet/public_test_cases/p03190/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d425f66320b752ccfaba5d2afd095888034b912 --- /dev/null +++ b/codenet/public_test_cases/p03190/input.2.txt @@ -0,0 +1,3 @@ +8 +00110011 +10101010 diff --git a/codenet/public_test_cases/p03190/input.3.txt b/codenet/public_test_cases/p03190/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..831a73ecfc2e30d801050ee8b8b370004c0b784e --- /dev/null +++ b/codenet/public_test_cases/p03190/input.3.txt @@ -0,0 +1,3 @@ +4 +0011 +0101 diff --git a/codenet/public_test_cases/p03190/output.0.txt b/codenet/public_test_cases/p03190/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03190/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03190/output.1.txt b/codenet/public_test_cases/p03190/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03190/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03190/output.2.txt b/codenet/public_test_cases/p03190/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03190/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03190/output.3.txt b/codenet/public_test_cases/p03190/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03190/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03191/input.0.txt b/codenet/public_test_cases/p03191/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..967d30069584d1677f82d31fbb7cc412f702bbcd --- /dev/null +++ b/codenet/public_test_cases/p03191/input.0.txt @@ -0,0 +1,2 @@ +3 +1 -1 -1 3 6 -1 diff --git a/codenet/public_test_cases/p03191/input.1.txt b/codenet/public_test_cases/p03191/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..967d30069584d1677f82d31fbb7cc412f702bbcd --- /dev/null +++ b/codenet/public_test_cases/p03191/input.1.txt @@ -0,0 +1,2 @@ +3 +1 -1 -1 3 6 -1 diff --git a/codenet/public_test_cases/p03191/input.2.txt b/codenet/public_test_cases/p03191/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f7ad30b8b63d5c98a07390a1a8336ac9b11a5e9 --- /dev/null +++ b/codenet/public_test_cases/p03191/input.2.txt @@ -0,0 +1,2 @@ +4 +7 1 8 3 5 2 6 4 diff --git a/codenet/public_test_cases/p03191/input.3.txt b/codenet/public_test_cases/p03191/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e42897d732da162ba6df64234bf6bc8e5c3d2c4c --- /dev/null +++ b/codenet/public_test_cases/p03191/input.3.txt @@ -0,0 +1,2 @@ +10 +7 -1 -1 -1 -1 -1 -1 6 14 12 13 -1 15 -1 -1 -1 -1 20 -1 -1 diff --git a/codenet/public_test_cases/p03191/input.4.txt b/codenet/public_test_cases/p03191/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e8d942221046a7f5de43d757215e388af194274 --- /dev/null +++ b/codenet/public_test_cases/p03191/input.4.txt @@ -0,0 +1,2 @@ +20 +-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 -1 -1 -1 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 34 -1 -1 -1 -1 31 -1 -1 -1 -1 -1 -1 -1 -1 diff --git a/codenet/public_test_cases/p03191/output.0.txt b/codenet/public_test_cases/p03191/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03191/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03191/output.1.txt b/codenet/public_test_cases/p03191/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03191/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03191/output.2.txt b/codenet/public_test_cases/p03191/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03191/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03191/output.3.txt b/codenet/public_test_cases/p03191/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f84bd4dc87a48520a0bdc8c25601878e480e61b --- /dev/null +++ b/codenet/public_test_cases/p03191/output.3.txt @@ -0,0 +1 @@ +9540576 diff --git a/codenet/public_test_cases/p03191/output.4.txt b/codenet/public_test_cases/p03191/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..33aa33f2b30dfa6c3a729371761cb83efe8cf26e --- /dev/null +++ b/codenet/public_test_cases/p03191/output.4.txt @@ -0,0 +1 @@ +374984201 diff --git a/codenet/public_test_cases/p03192/input.0.txt b/codenet/public_test_cases/p03192/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d63033fa51d4833e6c07e9836674f1e25ce95e2 --- /dev/null +++ b/codenet/public_test_cases/p03192/input.0.txt @@ -0,0 +1 @@ +1222 diff --git a/codenet/public_test_cases/p03192/input.1.txt b/codenet/public_test_cases/p03192/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e07ca2495f2081f4b9bec101cb2a705fc9b6f4ca --- /dev/null +++ b/codenet/public_test_cases/p03192/input.1.txt @@ -0,0 +1 @@ +9592 diff --git a/codenet/public_test_cases/p03192/input.2.txt b/codenet/public_test_cases/p03192/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..169efa8bd26e4837bafefa6e14c2abee4541f6bc --- /dev/null +++ b/codenet/public_test_cases/p03192/input.2.txt @@ -0,0 +1 @@ +3456 diff --git a/codenet/public_test_cases/p03192/input.3.txt b/codenet/public_test_cases/p03192/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d63033fa51d4833e6c07e9836674f1e25ce95e2 --- /dev/null +++ b/codenet/public_test_cases/p03192/input.3.txt @@ -0,0 +1 @@ +1222 diff --git a/codenet/public_test_cases/p03192/output.0.txt b/codenet/public_test_cases/p03192/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03192/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03192/output.1.txt b/codenet/public_test_cases/p03192/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03192/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03192/output.2.txt b/codenet/public_test_cases/p03192/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03192/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03192/output.3.txt b/codenet/public_test_cases/p03192/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03192/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03193/input.0.txt b/codenet/public_test_cases/p03193/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e965758a744c02d8f7614530458068187350465 --- /dev/null +++ b/codenet/public_test_cases/p03193/input.0.txt @@ -0,0 +1,4 @@ +3 5 2 +10 3 +5 2 +2 5 diff --git a/codenet/public_test_cases/p03193/output.0.txt b/codenet/public_test_cases/p03193/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03193/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03194/input.0.txt b/codenet/public_test_cases/p03194/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f2c3444e4ee1267154d1af953a451981d520491 --- /dev/null +++ b/codenet/public_test_cases/p03194/input.0.txt @@ -0,0 +1 @@ +3 24 diff --git a/codenet/public_test_cases/p03194/input.1.txt b/codenet/public_test_cases/p03194/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c3e36b56c13943c0b4452e45c0f58d406a76285 --- /dev/null +++ b/codenet/public_test_cases/p03194/input.1.txt @@ -0,0 +1 @@ +5 1 diff --git a/codenet/public_test_cases/p03194/input.2.txt b/codenet/public_test_cases/p03194/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2389c0eea727b285f212c6bdc9365983a6d90ade --- /dev/null +++ b/codenet/public_test_cases/p03194/input.2.txt @@ -0,0 +1 @@ +4 972439611840 diff --git a/codenet/public_test_cases/p03194/input.3.txt b/codenet/public_test_cases/p03194/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f2c3444e4ee1267154d1af953a451981d520491 --- /dev/null +++ b/codenet/public_test_cases/p03194/input.3.txt @@ -0,0 +1 @@ +3 24 diff --git a/codenet/public_test_cases/p03194/input.4.txt b/codenet/public_test_cases/p03194/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f6af7d1407699c37529a0cef4df8148335d98cc --- /dev/null +++ b/codenet/public_test_cases/p03194/input.4.txt @@ -0,0 +1 @@ +1 111 diff --git a/codenet/public_test_cases/p03194/output.0.txt b/codenet/public_test_cases/p03194/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03194/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03194/output.1.txt b/codenet/public_test_cases/p03194/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03194/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03194/output.2.txt b/codenet/public_test_cases/p03194/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b35cfafd269f3d6871bf59e319b1810b42c0d76a --- /dev/null +++ b/codenet/public_test_cases/p03194/output.2.txt @@ -0,0 +1 @@ +206 diff --git a/codenet/public_test_cases/p03194/output.3.txt b/codenet/public_test_cases/p03194/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03194/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03194/output.4.txt b/codenet/public_test_cases/p03194/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p03194/output.4.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p03195/input.0.txt b/codenet/public_test_cases/p03195/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p03195/input.0.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p03195/output.0.txt b/codenet/public_test_cases/p03195/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c59e24b8393179a5d712de4f990178df5734d99 --- /dev/null +++ b/codenet/public_test_cases/p03195/output.0.txt @@ -0,0 +1 @@ +first diff --git a/codenet/public_test_cases/p03196/input.0.txt b/codenet/public_test_cases/p03196/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f2c3444e4ee1267154d1af953a451981d520491 --- /dev/null +++ b/codenet/public_test_cases/p03196/input.0.txt @@ -0,0 +1 @@ +3 24 diff --git a/codenet/public_test_cases/p03196/output.0.txt b/codenet/public_test_cases/p03196/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03196/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03197/input.0.txt b/codenet/public_test_cases/p03197/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p03197/input.0.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p03197/input.1.txt b/codenet/public_test_cases/p03197/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6793307d4dec5a8f38d912e26cd1db11c831eab3 --- /dev/null +++ b/codenet/public_test_cases/p03197/input.1.txt @@ -0,0 +1,4 @@ +3 +100000 +30000 +20000 diff --git a/codenet/public_test_cases/p03197/input.2.txt b/codenet/public_test_cases/p03197/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p03197/input.2.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p03197/output.0.txt b/codenet/public_test_cases/p03197/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c59e24b8393179a5d712de4f990178df5734d99 --- /dev/null +++ b/codenet/public_test_cases/p03197/output.0.txt @@ -0,0 +1 @@ +first diff --git a/codenet/public_test_cases/p03197/output.1.txt b/codenet/public_test_cases/p03197/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e019be006cf33489e2d0177a3837a2384eddebc5 --- /dev/null +++ b/codenet/public_test_cases/p03197/output.1.txt @@ -0,0 +1 @@ +second diff --git a/codenet/public_test_cases/p03197/output.2.txt b/codenet/public_test_cases/p03197/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c59e24b8393179a5d712de4f990178df5734d99 --- /dev/null +++ b/codenet/public_test_cases/p03197/output.2.txt @@ -0,0 +1 @@ +first diff --git a/codenet/public_test_cases/p03198/input.0.txt b/codenet/public_test_cases/p03198/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d460fb031911463923f8936d5e3e082d9ea32bc --- /dev/null +++ b/codenet/public_test_cases/p03198/input.0.txt @@ -0,0 +1,2 @@ +4 +3 1 4 1 diff --git a/codenet/public_test_cases/p03198/input.1.txt b/codenet/public_test_cases/p03198/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d460fb031911463923f8936d5e3e082d9ea32bc --- /dev/null +++ b/codenet/public_test_cases/p03198/input.1.txt @@ -0,0 +1,2 @@ +4 +3 1 4 1 diff --git a/codenet/public_test_cases/p03198/input.2.txt b/codenet/public_test_cases/p03198/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfd1d37a5378654a030d7c2f904fbb4e33073f26 --- /dev/null +++ b/codenet/public_test_cases/p03198/input.2.txt @@ -0,0 +1,2 @@ +8 +657312726 129662684 181537270 324043958 468214806 916875077 825989291 319670097 diff --git a/codenet/public_test_cases/p03198/input.3.txt b/codenet/public_test_cases/p03198/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p03198/input.3.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03198/output.0.txt b/codenet/public_test_cases/p03198/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03198/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03198/output.1.txt b/codenet/public_test_cases/p03198/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03198/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03198/output.2.txt b/codenet/public_test_cases/p03198/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03198/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03198/output.3.txt b/codenet/public_test_cases/p03198/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03198/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03199/input.0.txt b/codenet/public_test_cases/p03199/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c49bff6d233997c66eb03bfa4da4c339c14a8819 --- /dev/null +++ b/codenet/public_test_cases/p03199/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 1 1 +3 1 0 +2 3 1 diff --git a/codenet/public_test_cases/p03199/input.1.txt b/codenet/public_test_cases/p03199/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a224b5df2a6b6f45d9e52db4db970c3fea5e1c7e --- /dev/null +++ b/codenet/public_test_cases/p03199/input.1.txt @@ -0,0 +1 @@ +100000 0 diff --git a/codenet/public_test_cases/p03199/input.2.txt b/codenet/public_test_cases/p03199/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29ea577bf513ef47c479ecd337ce9efa2e054846 --- /dev/null +++ b/codenet/public_test_cases/p03199/input.2.txt @@ -0,0 +1,9 @@ +4 8 +1 1 1 +1 2 0 +3 2 1 +1 4 0 +2 1 1 +1 3 0 +3 4 1 +4 4 1 diff --git a/codenet/public_test_cases/p03199/input.3.txt b/codenet/public_test_cases/p03199/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..455c58edc4bd2520d1993b657bb7013a8db159c5 --- /dev/null +++ b/codenet/public_test_cases/p03199/input.3.txt @@ -0,0 +1,6 @@ +4 5 +1 3 1 +2 4 0 +2 3 1 +4 2 1 +4 4 1 diff --git a/codenet/public_test_cases/p03199/input.4.txt b/codenet/public_test_cases/p03199/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..983a817186c0e703bad733ff875dabfec6c03865 --- /dev/null +++ b/codenet/public_test_cases/p03199/input.4.txt @@ -0,0 +1,6 @@ +3 5 +1 3 1 +3 3 0 +3 1 0 +2 3 1 +3 2 1 diff --git a/codenet/public_test_cases/p03199/input.5.txt b/codenet/public_test_cases/p03199/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..c49bff6d233997c66eb03bfa4da4c339c14a8819 --- /dev/null +++ b/codenet/public_test_cases/p03199/input.5.txt @@ -0,0 +1,4 @@ +3 3 +1 1 1 +3 1 0 +2 3 1 diff --git a/codenet/public_test_cases/p03199/output.0.txt b/codenet/public_test_cases/p03199/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03199/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03199/output.1.txt b/codenet/public_test_cases/p03199/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dceab880320aba63003dd8639ab70302ef8a95fa --- /dev/null +++ b/codenet/public_test_cases/p03199/output.1.txt @@ -0,0 +1 @@ +342016343 diff --git a/codenet/public_test_cases/p03199/output.2.txt b/codenet/public_test_cases/p03199/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03199/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03199/output.3.txt b/codenet/public_test_cases/p03199/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p03199/output.3.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p03199/output.4.txt b/codenet/public_test_cases/p03199/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03199/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03199/output.5.txt b/codenet/public_test_cases/p03199/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03199/output.5.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03200/input.0.txt b/codenet/public_test_cases/p03200/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fec61e36b531c48791debd010e17bbb9ff95d9df --- /dev/null +++ b/codenet/public_test_cases/p03200/input.0.txt @@ -0,0 +1 @@ +BBW diff --git a/codenet/public_test_cases/p03200/input.1.txt b/codenet/public_test_cases/p03200/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c51da1c41b2af108620354f97627b33387ab4d1 --- /dev/null +++ b/codenet/public_test_cases/p03200/input.1.txt @@ -0,0 +1 @@ +BWBWBW diff --git a/codenet/public_test_cases/p03200/input.2.txt b/codenet/public_test_cases/p03200/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fec61e36b531c48791debd010e17bbb9ff95d9df --- /dev/null +++ b/codenet/public_test_cases/p03200/input.2.txt @@ -0,0 +1 @@ +BBW diff --git a/codenet/public_test_cases/p03200/output.0.txt b/codenet/public_test_cases/p03200/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03200/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03200/output.1.txt b/codenet/public_test_cases/p03200/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03200/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03200/output.2.txt b/codenet/public_test_cases/p03200/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03200/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03201/input.0.txt b/codenet/public_test_cases/p03201/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03201/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03201/input.1.txt b/codenet/public_test_cases/p03201/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03201/input.1.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03201/input.2.txt b/codenet/public_test_cases/p03201/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec0e220a5755f5060772571d4fa5c268b64e2553 --- /dev/null +++ b/codenet/public_test_cases/p03201/input.2.txt @@ -0,0 +1,2 @@ +5 +3 11 14 5 13 diff --git a/codenet/public_test_cases/p03201/output.0.txt b/codenet/public_test_cases/p03201/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03201/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03201/output.1.txt b/codenet/public_test_cases/p03201/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03201/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03201/output.2.txt b/codenet/public_test_cases/p03201/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03201/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03202/input.0.txt b/codenet/public_test_cases/p03202/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5898906cc695e2f596c5a2686fef39f0284514c0 --- /dev/null +++ b/codenet/public_test_cases/p03202/input.0.txt @@ -0,0 +1,2 @@ +3 +3 2 1 diff --git a/codenet/public_test_cases/p03202/input.1.txt b/codenet/public_test_cases/p03202/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5898906cc695e2f596c5a2686fef39f0284514c0 --- /dev/null +++ b/codenet/public_test_cases/p03202/input.1.txt @@ -0,0 +1,2 @@ +3 +3 2 1 diff --git a/codenet/public_test_cases/p03202/input.2.txt b/codenet/public_test_cases/p03202/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..23e7861f9bf2f23814606f38b37e8bd969746c76 --- /dev/null +++ b/codenet/public_test_cases/p03202/input.2.txt @@ -0,0 +1,2 @@ +5 +2 3 2 1 2 diff --git a/codenet/public_test_cases/p03202/output.0.txt b/codenet/public_test_cases/p03202/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03202/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03202/output.1.txt b/codenet/public_test_cases/p03202/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03202/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03202/output.2.txt b/codenet/public_test_cases/p03202/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03202/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03203/input.0.txt b/codenet/public_test_cases/p03203/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..68341981dead0923043d77a51cbbec13db93ea23 --- /dev/null +++ b/codenet/public_test_cases/p03203/input.0.txt @@ -0,0 +1,2 @@ +3 3 1 +3 2 diff --git a/codenet/public_test_cases/p03203/input.1.txt b/codenet/public_test_cases/p03203/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..68341981dead0923043d77a51cbbec13db93ea23 --- /dev/null +++ b/codenet/public_test_cases/p03203/input.1.txt @@ -0,0 +1,2 @@ +3 3 1 +3 2 diff --git a/codenet/public_test_cases/p03203/input.2.txt b/codenet/public_test_cases/p03203/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..96ad7bbb057beb445707b2044048df02cce52e1c --- /dev/null +++ b/codenet/public_test_cases/p03203/input.2.txt @@ -0,0 +1 @@ +100000 100000 0 diff --git a/codenet/public_test_cases/p03203/input.3.txt b/codenet/public_test_cases/p03203/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..656ac90d74ee1d765a68ec3b615332ac4e8081ac --- /dev/null +++ b/codenet/public_test_cases/p03203/input.3.txt @@ -0,0 +1,15 @@ +10 10 14 +4 3 +2 2 +7 3 +9 10 +7 7 +8 1 +10 10 +5 4 +3 4 +2 8 +6 4 +4 4 +5 8 +9 2 diff --git a/codenet/public_test_cases/p03203/output.0.txt b/codenet/public_test_cases/p03203/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03203/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03203/output.1.txt b/codenet/public_test_cases/p03203/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03203/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03203/output.2.txt b/codenet/public_test_cases/p03203/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7393e847d34d19031ee0ba57df63e4d0ccb4fb2 --- /dev/null +++ b/codenet/public_test_cases/p03203/output.2.txt @@ -0,0 +1 @@ +100000 diff --git a/codenet/public_test_cases/p03203/output.3.txt b/codenet/public_test_cases/p03203/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03203/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03204/input.0.txt b/codenet/public_test_cases/p03204/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..86b853330e9d4d02af33acc44b5a2cabf56a29f8 --- /dev/null +++ b/codenet/public_test_cases/p03204/input.0.txt @@ -0,0 +1,6 @@ +6 +1 5 +5 6 +6 2 +6 3 +6 4 diff --git a/codenet/public_test_cases/p03204/input.1.txt b/codenet/public_test_cases/p03204/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..535057cd75d5577666ec41d58575f37ac4033b55 --- /dev/null +++ b/codenet/public_test_cases/p03204/input.1.txt @@ -0,0 +1,6 @@ +6 +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p03204/input.2.txt b/codenet/public_test_cases/p03204/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..86b853330e9d4d02af33acc44b5a2cabf56a29f8 --- /dev/null +++ b/codenet/public_test_cases/p03204/input.2.txt @@ -0,0 +1,6 @@ +6 +1 5 +5 6 +6 2 +6 3 +6 4 diff --git a/codenet/public_test_cases/p03204/input.3.txt b/codenet/public_test_cases/p03204/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5f96c881a82c51af3ccb9d512e9df22887b20d1 --- /dev/null +++ b/codenet/public_test_cases/p03204/input.3.txt @@ -0,0 +1,10 @@ +10 +1 5 +5 6 +6 10 +6 4 +10 3 +10 8 +8 2 +4 7 +4 9 diff --git a/codenet/public_test_cases/p03204/output.0.txt b/codenet/public_test_cases/p03204/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccf68ff10442ede7cb5479695e6978e4f5d37708 --- /dev/null +++ b/codenet/public_test_cases/p03204/output.0.txt @@ -0,0 +1 @@ +5 5 5 1 5 diff --git a/codenet/public_test_cases/p03204/output.1.txt b/codenet/public_test_cases/p03204/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aacb59525ae5e32096372e24707fe291c5a4dae4 --- /dev/null +++ b/codenet/public_test_cases/p03204/output.1.txt @@ -0,0 +1 @@ +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03204/output.2.txt b/codenet/public_test_cases/p03204/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccf68ff10442ede7cb5479695e6978e4f5d37708 --- /dev/null +++ b/codenet/public_test_cases/p03204/output.2.txt @@ -0,0 +1 @@ +5 5 5 1 5 diff --git a/codenet/public_test_cases/p03204/output.3.txt b/codenet/public_test_cases/p03204/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c3e5b35543228e00faa9cb5dcc23e0df6e00f7f --- /dev/null +++ b/codenet/public_test_cases/p03204/output.3.txt @@ -0,0 +1 @@ +7 5 3 1 3 4 7 4 5 diff --git a/codenet/public_test_cases/p03205/input.0.txt b/codenet/public_test_cases/p03205/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3eb5778d6073fc1d628e4e52acf553a1c8c4e8b --- /dev/null +++ b/codenet/public_test_cases/p03205/input.0.txt @@ -0,0 +1,5 @@ +5 +2 1 2 +3 1 2 3 +3 3 4 5 +2 4 5 diff --git a/codenet/public_test_cases/p03205/input.1.txt b/codenet/public_test_cases/p03205/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b048fcb21ca971a4fded7530a5f81050622d026a --- /dev/null +++ b/codenet/public_test_cases/p03205/input.1.txt @@ -0,0 +1,6 @@ +6 +3 1 2 3 +3 2 3 4 +3 1 3 4 +3 1 2 4 +3 4 5 6 diff --git a/codenet/public_test_cases/p03205/input.2.txt b/codenet/public_test_cases/p03205/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3eb5778d6073fc1d628e4e52acf553a1c8c4e8b --- /dev/null +++ b/codenet/public_test_cases/p03205/input.2.txt @@ -0,0 +1,5 @@ +5 +2 1 2 +3 1 2 3 +3 3 4 5 +2 4 5 diff --git a/codenet/public_test_cases/p03205/input.3.txt b/codenet/public_test_cases/p03205/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..97d727f207bdfa5083d6dee6cbe2157fc0d09216 --- /dev/null +++ b/codenet/public_test_cases/p03205/input.3.txt @@ -0,0 +1,10 @@ +10 +5 1 2 3 4 5 +5 2 3 4 5 6 +5 3 4 5 6 7 +5 4 5 6 7 8 +5 5 6 7 8 9 +5 6 7 8 9 10 +5 7 8 9 10 1 +5 8 9 10 1 2 +5 9 10 1 2 3 diff --git a/codenet/public_test_cases/p03205/output.0.txt b/codenet/public_test_cases/p03205/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cdb5d20856619990afae2e5ed64712852d9f19f --- /dev/null +++ b/codenet/public_test_cases/p03205/output.0.txt @@ -0,0 +1,4 @@ +1 2 +1 3 +3 4 +4 5 diff --git a/codenet/public_test_cases/p03205/output.1.txt b/codenet/public_test_cases/p03205/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03205/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03205/output.2.txt b/codenet/public_test_cases/p03205/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cdb5d20856619990afae2e5ed64712852d9f19f --- /dev/null +++ b/codenet/public_test_cases/p03205/output.2.txt @@ -0,0 +1,4 @@ +1 2 +1 3 +3 4 +4 5 diff --git a/codenet/public_test_cases/p03205/output.3.txt b/codenet/public_test_cases/p03205/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aefdc4e64a2c1cf46e91410db710229f1f8a951c --- /dev/null +++ b/codenet/public_test_cases/p03205/output.3.txt @@ -0,0 +1,9 @@ +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 diff --git a/codenet/public_test_cases/p03206/input.0.txt b/codenet/public_test_cases/p03206/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p03206/input.0.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p03206/input.1.txt b/codenet/public_test_cases/p03206/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p03206/input.1.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p03206/input.2.txt b/codenet/public_test_cases/p03206/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03206/input.2.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03206/output.0.txt b/codenet/public_test_cases/p03206/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..10562b505ff1d965e73f7d86c1134074325b64ec --- /dev/null +++ b/codenet/public_test_cases/p03206/output.0.txt @@ -0,0 +1 @@ +Christmas diff --git a/codenet/public_test_cases/p03206/output.1.txt b/codenet/public_test_cases/p03206/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..10562b505ff1d965e73f7d86c1134074325b64ec --- /dev/null +++ b/codenet/public_test_cases/p03206/output.1.txt @@ -0,0 +1 @@ +Christmas diff --git a/codenet/public_test_cases/p03206/output.2.txt b/codenet/public_test_cases/p03206/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e999811ec106d9e818df8e1c46fe0caa05fdf --- /dev/null +++ b/codenet/public_test_cases/p03206/output.2.txt @@ -0,0 +1 @@ +Christmas Eve Eve Eve diff --git a/codenet/public_test_cases/p03207/input.0.txt b/codenet/public_test_cases/p03207/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..398b71ecc9e9e80999051167707a45ec80646e83 --- /dev/null +++ b/codenet/public_test_cases/p03207/input.0.txt @@ -0,0 +1,4 @@ +3 +4980 +7980 +6980 diff --git a/codenet/public_test_cases/p03207/input.1.txt b/codenet/public_test_cases/p03207/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..035be0b4a35b444c08b05cb33a50fa7e42249d26 --- /dev/null +++ b/codenet/public_test_cases/p03207/input.1.txt @@ -0,0 +1,5 @@ +4 +4320 +4320 +4320 +4320 diff --git a/codenet/public_test_cases/p03207/input.2.txt b/codenet/public_test_cases/p03207/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..398b71ecc9e9e80999051167707a45ec80646e83 --- /dev/null +++ b/codenet/public_test_cases/p03207/input.2.txt @@ -0,0 +1,4 @@ +3 +4980 +7980 +6980 diff --git a/codenet/public_test_cases/p03207/output.0.txt b/codenet/public_test_cases/p03207/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba542378c41c9fd7c11a26466bb89ed63dca4468 --- /dev/null +++ b/codenet/public_test_cases/p03207/output.0.txt @@ -0,0 +1 @@ +15950 diff --git a/codenet/public_test_cases/p03207/output.1.txt b/codenet/public_test_cases/p03207/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9c326a038a4ce0b94946f92fd7219a8b6b7866e --- /dev/null +++ b/codenet/public_test_cases/p03207/output.1.txt @@ -0,0 +1 @@ +15120 diff --git a/codenet/public_test_cases/p03207/output.2.txt b/codenet/public_test_cases/p03207/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba542378c41c9fd7c11a26466bb89ed63dca4468 --- /dev/null +++ b/codenet/public_test_cases/p03207/output.2.txt @@ -0,0 +1 @@ +15950 diff --git a/codenet/public_test_cases/p03208/input.0.txt b/codenet/public_test_cases/p03208/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4286a23afef659762a8cb6d328a02861f80de99e --- /dev/null +++ b/codenet/public_test_cases/p03208/input.0.txt @@ -0,0 +1,6 @@ +5 3 +10 +15 +11 +14 +12 diff --git a/codenet/public_test_cases/p03208/input.1.txt b/codenet/public_test_cases/p03208/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4286a23afef659762a8cb6d328a02861f80de99e --- /dev/null +++ b/codenet/public_test_cases/p03208/input.1.txt @@ -0,0 +1,6 @@ +5 3 +10 +15 +11 +14 +12 diff --git a/codenet/public_test_cases/p03208/input.2.txt b/codenet/public_test_cases/p03208/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..976181bdd4dc13901f79fde551f6a1e1750dfe05 --- /dev/null +++ b/codenet/public_test_cases/p03208/input.2.txt @@ -0,0 +1,6 @@ +5 3 +5 +7 +5 +7 +7 diff --git a/codenet/public_test_cases/p03208/output.0.txt b/codenet/public_test_cases/p03208/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03208/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03208/output.1.txt b/codenet/public_test_cases/p03208/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03208/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03208/output.2.txt b/codenet/public_test_cases/p03208/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03208/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03209/input.0.txt b/codenet/public_test_cases/p03209/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8829253dbd6ca08ee43008f05d5622486462fe40 --- /dev/null +++ b/codenet/public_test_cases/p03209/input.0.txt @@ -0,0 +1 @@ +2 7 diff --git a/codenet/public_test_cases/p03209/input.1.txt b/codenet/public_test_cases/p03209/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8e403e9ed652bbb1e7b1502c4d05c8fb2e02da9 --- /dev/null +++ b/codenet/public_test_cases/p03209/input.1.txt @@ -0,0 +1 @@ +50 4321098765432109 diff --git a/codenet/public_test_cases/p03209/input.2.txt b/codenet/public_test_cases/p03209/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03209/input.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03209/input.3.txt b/codenet/public_test_cases/p03209/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8829253dbd6ca08ee43008f05d5622486462fe40 --- /dev/null +++ b/codenet/public_test_cases/p03209/input.3.txt @@ -0,0 +1 @@ +2 7 diff --git a/codenet/public_test_cases/p03209/output.0.txt b/codenet/public_test_cases/p03209/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03209/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03209/output.1.txt b/codenet/public_test_cases/p03209/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03a81f00ca8e1abaa590ab1169b9d161616ee08b --- /dev/null +++ b/codenet/public_test_cases/p03209/output.1.txt @@ -0,0 +1 @@ +2160549382716056 diff --git a/codenet/public_test_cases/p03209/output.2.txt b/codenet/public_test_cases/p03209/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03209/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03209/output.3.txt b/codenet/public_test_cases/p03209/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03209/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03210/input.0.txt b/codenet/public_test_cases/p03210/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03210/input.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03210/input.1.txt b/codenet/public_test_cases/p03210/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03210/input.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03210/input.2.txt b/codenet/public_test_cases/p03210/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03210/input.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03210/output.0.txt b/codenet/public_test_cases/p03210/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03210/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03210/output.1.txt b/codenet/public_test_cases/p03210/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03210/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03210/output.2.txt b/codenet/public_test_cases/p03210/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03210/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03211/input.0.txt b/codenet/public_test_cases/p03211/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ee63d0df367026e7e1b1a3071039df7c86e27c8 --- /dev/null +++ b/codenet/public_test_cases/p03211/input.0.txt @@ -0,0 +1 @@ +1234567876 diff --git a/codenet/public_test_cases/p03211/input.1.txt b/codenet/public_test_cases/p03211/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..528cfef8712ef3bc0207b7998216b01178caacd2 --- /dev/null +++ b/codenet/public_test_cases/p03211/input.1.txt @@ -0,0 +1 @@ +35753 diff --git a/codenet/public_test_cases/p03211/input.2.txt b/codenet/public_test_cases/p03211/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ee63d0df367026e7e1b1a3071039df7c86e27c8 --- /dev/null +++ b/codenet/public_test_cases/p03211/input.2.txt @@ -0,0 +1 @@ +1234567876 diff --git a/codenet/public_test_cases/p03211/input.3.txt b/codenet/public_test_cases/p03211/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..15c36bcdd204bb29a2392bbb808d45f813ad5c32 --- /dev/null +++ b/codenet/public_test_cases/p03211/input.3.txt @@ -0,0 +1 @@ +1111111111 diff --git a/codenet/public_test_cases/p03211/output.0.txt b/codenet/public_test_cases/p03211/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p03211/output.0.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p03211/output.1.txt b/codenet/public_test_cases/p03211/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03211/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03211/output.2.txt b/codenet/public_test_cases/p03211/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p03211/output.2.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p03211/output.3.txt b/codenet/public_test_cases/p03211/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3006dac01469048f5adbfbedfdab6286ca9b0bb8 --- /dev/null +++ b/codenet/public_test_cases/p03211/output.3.txt @@ -0,0 +1 @@ +642 diff --git a/codenet/public_test_cases/p03212/input.0.txt b/codenet/public_test_cases/p03212/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db08d2acf848400d68132e548a0dd7a6150da542 --- /dev/null +++ b/codenet/public_test_cases/p03212/input.0.txt @@ -0,0 +1 @@ +575 diff --git a/codenet/public_test_cases/p03212/input.1.txt b/codenet/public_test_cases/p03212/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db08d2acf848400d68132e548a0dd7a6150da542 --- /dev/null +++ b/codenet/public_test_cases/p03212/input.1.txt @@ -0,0 +1 @@ +575 diff --git a/codenet/public_test_cases/p03212/input.2.txt b/codenet/public_test_cases/p03212/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dc663e66f8edb6be98ede1bc12601fc5aa6352a --- /dev/null +++ b/codenet/public_test_cases/p03212/input.2.txt @@ -0,0 +1 @@ +3600 diff --git a/codenet/public_test_cases/p03212/input.3.txt b/codenet/public_test_cases/p03212/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..28e56d983ef928848a1b0cdae1fe481ad09143a2 --- /dev/null +++ b/codenet/public_test_cases/p03212/input.3.txt @@ -0,0 +1 @@ +999999999 diff --git a/codenet/public_test_cases/p03212/output.0.txt b/codenet/public_test_cases/p03212/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03212/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03212/output.1.txt b/codenet/public_test_cases/p03212/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03212/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03212/output.2.txt b/codenet/public_test_cases/p03212/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03212/output.2.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03212/output.3.txt b/codenet/public_test_cases/p03212/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5acc686dd689857f8c96c554c0cb70ee440b860 --- /dev/null +++ b/codenet/public_test_cases/p03212/output.3.txt @@ -0,0 +1 @@ +26484 diff --git a/codenet/public_test_cases/p03213/input.0.txt b/codenet/public_test_cases/p03213/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03213/input.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03213/input.1.txt b/codenet/public_test_cases/p03213/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03213/input.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03213/input.2.txt b/codenet/public_test_cases/p03213/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03213/input.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03213/input.3.txt b/codenet/public_test_cases/p03213/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03213/input.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03213/output.0.txt b/codenet/public_test_cases/p03213/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03213/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03213/output.1.txt b/codenet/public_test_cases/p03213/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03213/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03213/output.2.txt b/codenet/public_test_cases/p03213/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..849baeed65a7d4e512d8c4447a7e26eca35a607f --- /dev/null +++ b/codenet/public_test_cases/p03213/output.2.txt @@ -0,0 +1 @@ +543 diff --git a/codenet/public_test_cases/p03213/output.3.txt b/codenet/public_test_cases/p03213/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03213/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03214/input.0.txt b/codenet/public_test_cases/p03214/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03214/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03214/input.1.txt b/codenet/public_test_cases/p03214/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03214/input.1.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03214/input.2.txt b/codenet/public_test_cases/p03214/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..509bf9d4494502fee57b8da72af17c76e617b0c4 --- /dev/null +++ b/codenet/public_test_cases/p03214/input.2.txt @@ -0,0 +1,2 @@ +4 +2 5 2 5 diff --git a/codenet/public_test_cases/p03214/output.0.txt b/codenet/public_test_cases/p03214/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03214/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03214/output.1.txt b/codenet/public_test_cases/p03214/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03214/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03214/output.2.txt b/codenet/public_test_cases/p03214/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03214/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03215/input.0.txt b/codenet/public_test_cases/p03215/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..70ab672d1c5e598b80aa7a483f0d8e2cdf492e2a --- /dev/null +++ b/codenet/public_test_cases/p03215/input.0.txt @@ -0,0 +1,2 @@ +4 2 +2 5 2 5 diff --git a/codenet/public_test_cases/p03215/input.1.txt b/codenet/public_test_cases/p03215/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..70ab672d1c5e598b80aa7a483f0d8e2cdf492e2a --- /dev/null +++ b/codenet/public_test_cases/p03215/input.1.txt @@ -0,0 +1,2 @@ +4 2 +2 5 2 5 diff --git a/codenet/public_test_cases/p03215/input.2.txt b/codenet/public_test_cases/p03215/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1ab7cfe936b4b91ee35590828221575ed7522fa --- /dev/null +++ b/codenet/public_test_cases/p03215/input.2.txt @@ -0,0 +1,2 @@ +8 4 +9 1 8 2 7 5 6 4 diff --git a/codenet/public_test_cases/p03215/output.0.txt b/codenet/public_test_cases/p03215/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03215/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03215/output.1.txt b/codenet/public_test_cases/p03215/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03215/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03215/output.2.txt b/codenet/public_test_cases/p03215/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p03215/output.2.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p03216/input.0.txt b/codenet/public_test_cases/p03216/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..042cbaf1bf2ff913927f1718b020e1c2db3b6427 --- /dev/null +++ b/codenet/public_test_cases/p03216/input.0.txt @@ -0,0 +1,4 @@ +18 +DWANGOMEDIACLUSTER +1 +18 diff --git a/codenet/public_test_cases/p03216/input.1.txt b/codenet/public_test_cases/p03216/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..846d689513d64cf9e1eb5acf6a276186f70d12e9 --- /dev/null +++ b/codenet/public_test_cases/p03216/input.1.txt @@ -0,0 +1,4 @@ +54 +DIALUPWIDEAREANETWORKGAMINGOPERATIONCORPORATIONLIMITED +3 +20 30 40 diff --git a/codenet/public_test_cases/p03216/input.2.txt b/codenet/public_test_cases/p03216/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..042cbaf1bf2ff913927f1718b020e1c2db3b6427 --- /dev/null +++ b/codenet/public_test_cases/p03216/input.2.txt @@ -0,0 +1,4 @@ +18 +DWANGOMEDIACLUSTER +1 +18 diff --git a/codenet/public_test_cases/p03216/input.3.txt b/codenet/public_test_cases/p03216/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..861c4b42f13e113a51971a5db37b57fad463d028 --- /dev/null +++ b/codenet/public_test_cases/p03216/input.3.txt @@ -0,0 +1,4 @@ +18 +DDDDDDMMMMMCCCCCCC +1 +18 diff --git a/codenet/public_test_cases/p03216/input.4.txt b/codenet/public_test_cases/p03216/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..17de8c1c3cf5580e0c5c87edea3ef87a78178e9f --- /dev/null +++ b/codenet/public_test_cases/p03216/input.4.txt @@ -0,0 +1,4 @@ +30 +DMCDMCDMCDMCDMCDMCDMCDMCDMCDMC +4 +5 10 15 20 diff --git a/codenet/public_test_cases/p03216/output.0.txt b/codenet/public_test_cases/p03216/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03216/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03216/output.1.txt b/codenet/public_test_cases/p03216/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4539bbf2d22d5c3b4227859ff854eda060a687fb --- /dev/null +++ b/codenet/public_test_cases/p03216/output.1.txt @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/codenet/public_test_cases/p03216/output.2.txt b/codenet/public_test_cases/p03216/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03216/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03216/output.3.txt b/codenet/public_test_cases/p03216/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd7da05e3d264bd30a49a5f2c4c647a4ee0d3ec3 --- /dev/null +++ b/codenet/public_test_cases/p03216/output.3.txt @@ -0,0 +1 @@ +210 diff --git a/codenet/public_test_cases/p03216/output.4.txt b/codenet/public_test_cases/p03216/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..403a2851443d158e9b76f34516e07c08e827841e --- /dev/null +++ b/codenet/public_test_cases/p03216/output.4.txt @@ -0,0 +1,4 @@ +10 +52 +110 +140 diff --git a/codenet/public_test_cases/p03217/input.0.txt b/codenet/public_test_cases/p03217/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2d4b105fdeee65782427f9f13893ce5277bdeb7 --- /dev/null +++ b/codenet/public_test_cases/p03217/input.0.txt @@ -0,0 +1,4 @@ +3 1 +0 0 +1 0 +2 0 diff --git a/codenet/public_test_cases/p03217/input.1.txt b/codenet/public_test_cases/p03217/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6aebc141cc0d7b16af737279f4f2bb1ae4cd5f73 --- /dev/null +++ b/codenet/public_test_cases/p03217/input.1.txt @@ -0,0 +1,20 @@ +19 2 +1 3 +2 3 +0 1 +1 1 +2 1 +3 1 +4 4 +5 4 +6 4 +7 4 +8 4 +8 3 +8 2 +8 1 +8 0 +7 0 +6 0 +5 0 +4 0 diff --git a/codenet/public_test_cases/p03217/input.2.txt b/codenet/public_test_cases/p03217/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2d4b105fdeee65782427f9f13893ce5277bdeb7 --- /dev/null +++ b/codenet/public_test_cases/p03217/input.2.txt @@ -0,0 +1,4 @@ +3 1 +0 0 +1 0 +2 0 diff --git a/codenet/public_test_cases/p03217/input.3.txt b/codenet/public_test_cases/p03217/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..70ed5b1ce9d1380ed66afa9b86d4d0a97a6cc6e0 --- /dev/null +++ b/codenet/public_test_cases/p03217/input.3.txt @@ -0,0 +1,9 @@ +8 3 +0 0 +0 3 +3 0 +3 3 +2 2 +2 5 +5 2 +5 5 diff --git a/codenet/public_test_cases/p03217/output.0.txt b/codenet/public_test_cases/p03217/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03217/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03217/output.1.txt b/codenet/public_test_cases/p03217/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03217/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03217/output.2.txt b/codenet/public_test_cases/p03217/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03217/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03217/output.3.txt b/codenet/public_test_cases/p03217/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03217/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03218/input.0.txt b/codenet/public_test_cases/p03218/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4238a53f643f773837f0a62d6a47a6818700cbff --- /dev/null +++ b/codenet/public_test_cases/p03218/input.0.txt @@ -0,0 +1,2 @@ +2 +4 3 diff --git a/codenet/public_test_cases/p03218/input.1.txt b/codenet/public_test_cases/p03218/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..509bf9d4494502fee57b8da72af17c76e617b0c4 --- /dev/null +++ b/codenet/public_test_cases/p03218/input.1.txt @@ -0,0 +1,2 @@ +4 +2 5 2 5 diff --git a/codenet/public_test_cases/p03218/input.2.txt b/codenet/public_test_cases/p03218/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4238a53f643f773837f0a62d6a47a6818700cbff --- /dev/null +++ b/codenet/public_test_cases/p03218/input.2.txt @@ -0,0 +1,2 @@ +2 +4 3 diff --git a/codenet/public_test_cases/p03218/output.0.txt b/codenet/public_test_cases/p03218/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03218/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03218/output.1.txt b/codenet/public_test_cases/p03218/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03218/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03218/output.2.txt b/codenet/public_test_cases/p03218/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03218/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03219/input.0.txt b/codenet/public_test_cases/p03219/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3575b8c12e57c51533bdf7fe312268f8e1e9581 --- /dev/null +++ b/codenet/public_test_cases/p03219/input.0.txt @@ -0,0 +1 @@ +81 58 diff --git a/codenet/public_test_cases/p03219/input.1.txt b/codenet/public_test_cases/p03219/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3575b8c12e57c51533bdf7fe312268f8e1e9581 --- /dev/null +++ b/codenet/public_test_cases/p03219/input.1.txt @@ -0,0 +1 @@ +81 58 diff --git a/codenet/public_test_cases/p03219/input.2.txt b/codenet/public_test_cases/p03219/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4691921a55f52fe127e6f66318a0c316963fbb6 --- /dev/null +++ b/codenet/public_test_cases/p03219/input.2.txt @@ -0,0 +1 @@ +4 54 diff --git a/codenet/public_test_cases/p03219/output.0.txt b/codenet/public_test_cases/p03219/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p03219/output.0.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p03219/output.1.txt b/codenet/public_test_cases/p03219/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p03219/output.1.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p03219/output.2.txt b/codenet/public_test_cases/p03219/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e85087affded170efcbc6f9672a6fc671d839ed0 --- /dev/null +++ b/codenet/public_test_cases/p03219/output.2.txt @@ -0,0 +1 @@ +31 diff --git a/codenet/public_test_cases/p03220/input.0.txt b/codenet/public_test_cases/p03220/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74143c10e18770471002e27982fb731ad10a41bd --- /dev/null +++ b/codenet/public_test_cases/p03220/input.0.txt @@ -0,0 +1,3 @@ +2 +12 5 +1000 2000 diff --git a/codenet/public_test_cases/p03220/output.0.txt b/codenet/public_test_cases/p03220/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03220/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03221/input.0.txt b/codenet/public_test_cases/p03221/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a8ae09645a6b951f49386fbe075d0caf3ccfc07 --- /dev/null +++ b/codenet/public_test_cases/p03221/input.0.txt @@ -0,0 +1,4 @@ +2 3 +1 32 +2 63 +1 12 diff --git a/codenet/public_test_cases/p03221/input.1.txt b/codenet/public_test_cases/p03221/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a8ae09645a6b951f49386fbe075d0caf3ccfc07 --- /dev/null +++ b/codenet/public_test_cases/p03221/input.1.txt @@ -0,0 +1,4 @@ +2 3 +1 32 +2 63 +1 12 diff --git a/codenet/public_test_cases/p03221/input.2.txt b/codenet/public_test_cases/p03221/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e7122c919cf48caefdd05451005ce0e4b7241d8 --- /dev/null +++ b/codenet/public_test_cases/p03221/input.2.txt @@ -0,0 +1,4 @@ +2 3 +2 55 +2 77 +2 99 diff --git a/codenet/public_test_cases/p03221/output.0.txt b/codenet/public_test_cases/p03221/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdb2929b619f2b3239180738064fe53066d850fd --- /dev/null +++ b/codenet/public_test_cases/p03221/output.0.txt @@ -0,0 +1,3 @@ +000001000002 +000002000001 +000001000001 diff --git a/codenet/public_test_cases/p03221/output.1.txt b/codenet/public_test_cases/p03221/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdb2929b619f2b3239180738064fe53066d850fd --- /dev/null +++ b/codenet/public_test_cases/p03221/output.1.txt @@ -0,0 +1,3 @@ +000001000002 +000002000001 +000001000001 diff --git a/codenet/public_test_cases/p03221/output.2.txt b/codenet/public_test_cases/p03221/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3696888dd6f8fcd0fad28070740d4e49db9c8f20 --- /dev/null +++ b/codenet/public_test_cases/p03221/output.2.txt @@ -0,0 +1,3 @@ +000002000001 +000002000002 +000002000003 diff --git a/codenet/public_test_cases/p03222/input.0.txt b/codenet/public_test_cases/p03222/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d849ff9fbc8ef5b5ece8947aedea2c693179e497 --- /dev/null +++ b/codenet/public_test_cases/p03222/input.0.txt @@ -0,0 +1 @@ +1 3 2 diff --git a/codenet/public_test_cases/p03222/input.1.txt b/codenet/public_test_cases/p03222/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bafe88d75575352861ed5f2a438df237bed39211 --- /dev/null +++ b/codenet/public_test_cases/p03222/input.1.txt @@ -0,0 +1 @@ +2 3 1 diff --git a/codenet/public_test_cases/p03222/input.2.txt b/codenet/public_test_cases/p03222/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d849ff9fbc8ef5b5ece8947aedea2c693179e497 --- /dev/null +++ b/codenet/public_test_cases/p03222/input.2.txt @@ -0,0 +1 @@ +1 3 2 diff --git a/codenet/public_test_cases/p03222/input.3.txt b/codenet/public_test_cases/p03222/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ed57210360366b2c24137c43090bb72d75d46f4 --- /dev/null +++ b/codenet/public_test_cases/p03222/input.3.txt @@ -0,0 +1 @@ +1 3 1 diff --git a/codenet/public_test_cases/p03222/input.4.txt b/codenet/public_test_cases/p03222/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d354bc36bd250a32326f0081c1dcfd95b27c39fe --- /dev/null +++ b/codenet/public_test_cases/p03222/input.4.txt @@ -0,0 +1 @@ +7 1 1 diff --git a/codenet/public_test_cases/p03222/input.5.txt b/codenet/public_test_cases/p03222/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..87b289ecc8a6f6cbc339aa2359c84f4dd2f5afb1 --- /dev/null +++ b/codenet/public_test_cases/p03222/input.5.txt @@ -0,0 +1 @@ +2 3 3 diff --git a/codenet/public_test_cases/p03222/input.6.txt b/codenet/public_test_cases/p03222/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d48a61737178badcb207a224cd8444dc5d821a9 --- /dev/null +++ b/codenet/public_test_cases/p03222/input.6.txt @@ -0,0 +1 @@ +15 8 5 diff --git a/codenet/public_test_cases/p03222/output.0.txt b/codenet/public_test_cases/p03222/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03222/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03222/output.1.txt b/codenet/public_test_cases/p03222/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03222/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03222/output.2.txt b/codenet/public_test_cases/p03222/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03222/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03222/output.3.txt b/codenet/public_test_cases/p03222/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03222/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03222/output.4.txt b/codenet/public_test_cases/p03222/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03222/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03222/output.5.txt b/codenet/public_test_cases/p03222/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03222/output.5.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03222/output.6.txt b/codenet/public_test_cases/p03222/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3936dfbd1febe1ac0a6302251fff5c13a3b938e --- /dev/null +++ b/codenet/public_test_cases/p03222/output.6.txt @@ -0,0 +1 @@ +437760187 diff --git a/codenet/public_test_cases/p03223/input.0.txt b/codenet/public_test_cases/p03223/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30c09bd1e2079d94ca74563ec8af53a37e889f4b --- /dev/null +++ b/codenet/public_test_cases/p03223/input.0.txt @@ -0,0 +1,6 @@ +5 +6 +8 +1 +2 +3 diff --git a/codenet/public_test_cases/p03223/output.0.txt b/codenet/public_test_cases/p03223/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03223/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03224/input.0.txt b/codenet/public_test_cases/p03224/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03224/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03224/output.0.txt b/codenet/public_test_cases/p03224/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c74e3100be9687b4610a93788c090c5d7edec4a3 --- /dev/null +++ b/codenet/public_test_cases/p03224/output.0.txt @@ -0,0 +1,5 @@ +Yes +3 +2 1 2 +2 3 1 +2 2 3 diff --git a/codenet/public_test_cases/p03225/input.0.txt b/codenet/public_test_cases/p03225/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e22ebc99a6e394cc9e7e5c1eb438842a49723b9 --- /dev/null +++ b/codenet/public_test_cases/p03225/input.0.txt @@ -0,0 +1,6 @@ +5 4 +#.## +.##. +#... +..## +...# diff --git a/codenet/public_test_cases/p03225/input.1.txt b/codenet/public_test_cases/p03225/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e22ebc99a6e394cc9e7e5c1eb438842a49723b9 --- /dev/null +++ b/codenet/public_test_cases/p03225/input.1.txt @@ -0,0 +1,6 @@ +5 4 +#.## +.##. +#... +..## +...# diff --git a/codenet/public_test_cases/p03225/input.2.txt b/codenet/public_test_cases/p03225/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..916f6fa56b38492eb224ea3836279d37b87a57db --- /dev/null +++ b/codenet/public_test_cases/p03225/input.2.txt @@ -0,0 +1,14 @@ +13 27 +......#.........#.......#.. +...#.....###.. +..............#####...##... +...#######......#...####### +...#.....#.....###...#...#. +...#######....#.#.#.#.###.# +..............#.#.#...#.#.. +.#.#.#...###.. +...........#...#...####### +..#######..#...#...#.....# +..#.....#..#...#...#.###.# +..#######..#...#...#.#.#.# +..........##...#...#.##### diff --git a/codenet/public_test_cases/p03225/input.3.txt b/codenet/public_test_cases/p03225/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b92373893aff5ec6aff81377f34f59af0677708 --- /dev/null +++ b/codenet/public_test_cases/p03225/input.3.txt @@ -0,0 +1,6 @@ +5 4 +.## +.##. +... +..## +...# diff --git a/codenet/public_test_cases/p03225/output.0.txt b/codenet/public_test_cases/p03225/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03225/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03225/output.1.txt b/codenet/public_test_cases/p03225/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03225/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03225/output.2.txt b/codenet/public_test_cases/p03225/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..51270dafa4c356465de60875529551e72f8198f8 --- /dev/null +++ b/codenet/public_test_cases/p03225/output.2.txt @@ -0,0 +1 @@ +870 diff --git a/codenet/public_test_cases/p03225/output.3.txt b/codenet/public_test_cases/p03225/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03225/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03226/input.0.txt b/codenet/public_test_cases/p03226/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f63e15fc148c044ac1e72e369cb2f5bdb54da43b --- /dev/null +++ b/codenet/public_test_cases/p03226/input.0.txt @@ -0,0 +1,4 @@ +3 +1 +2 +1 diff --git a/codenet/public_test_cases/p03226/input.1.txt b/codenet/public_test_cases/p03226/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f63e15fc148c044ac1e72e369cb2f5bdb54da43b --- /dev/null +++ b/codenet/public_test_cases/p03226/input.1.txt @@ -0,0 +1,4 @@ +3 +1 +2 +1 diff --git a/codenet/public_test_cases/p03226/input.2.txt b/codenet/public_test_cases/p03226/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e504f2b037627deff26c438252c758dc9b4a1f6f --- /dev/null +++ b/codenet/public_test_cases/p03226/input.2.txt @@ -0,0 +1,9 @@ +8 +4 +4 +4 +1 +1 +1 +2 +2 diff --git a/codenet/public_test_cases/p03226/input.3.txt b/codenet/public_test_cases/p03226/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca6b3fb52683b220355b6512d089563d30ad2d2f --- /dev/null +++ b/codenet/public_test_cases/p03226/input.3.txt @@ -0,0 +1,7 @@ +6 +1 +1 +6 +2 +2 +2 diff --git a/codenet/public_test_cases/p03226/input.4.txt b/codenet/public_test_cases/p03226/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..32afbf07729ae708432efc646363fa7ef4c7b9da --- /dev/null +++ b/codenet/public_test_cases/p03226/input.4.txt @@ -0,0 +1,6 @@ +5 +3 +1 +4 +1 +5 diff --git a/codenet/public_test_cases/p03226/output.0.txt b/codenet/public_test_cases/p03226/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03226/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03226/output.1.txt b/codenet/public_test_cases/p03226/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03226/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03226/output.2.txt b/codenet/public_test_cases/p03226/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p03226/output.2.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p03226/output.3.txt b/codenet/public_test_cases/p03226/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03226/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03226/output.4.txt b/codenet/public_test_cases/p03226/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03226/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03227/input.0.txt b/codenet/public_test_cases/p03227/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8baef1b4abc478178b004d62031cf7fe6db6f903 --- /dev/null +++ b/codenet/public_test_cases/p03227/input.0.txt @@ -0,0 +1 @@ +abc diff --git a/codenet/public_test_cases/p03227/input.1.txt b/codenet/public_test_cases/p03227/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8baef1b4abc478178b004d62031cf7fe6db6f903 --- /dev/null +++ b/codenet/public_test_cases/p03227/input.1.txt @@ -0,0 +1 @@ +abc diff --git a/codenet/public_test_cases/p03227/input.2.txt b/codenet/public_test_cases/p03227/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9eb3bbf4e21a1823eb23fe497069343d76b44c5 --- /dev/null +++ b/codenet/public_test_cases/p03227/input.2.txt @@ -0,0 +1 @@ +ac diff --git a/codenet/public_test_cases/p03227/output.0.txt b/codenet/public_test_cases/p03227/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59d2d1ca67822ec79419ef58ee69e9f65d701788 --- /dev/null +++ b/codenet/public_test_cases/p03227/output.0.txt @@ -0,0 +1 @@ +cba diff --git a/codenet/public_test_cases/p03227/output.1.txt b/codenet/public_test_cases/p03227/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59d2d1ca67822ec79419ef58ee69e9f65d701788 --- /dev/null +++ b/codenet/public_test_cases/p03227/output.1.txt @@ -0,0 +1 @@ +cba diff --git a/codenet/public_test_cases/p03227/output.2.txt b/codenet/public_test_cases/p03227/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9eb3bbf4e21a1823eb23fe497069343d76b44c5 --- /dev/null +++ b/codenet/public_test_cases/p03227/output.2.txt @@ -0,0 +1 @@ +ac diff --git a/codenet/public_test_cases/p03228/input.0.txt b/codenet/public_test_cases/p03228/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4669e97437f8101576e9380066a9570b4720875 --- /dev/null +++ b/codenet/public_test_cases/p03228/input.0.txt @@ -0,0 +1 @@ +5 4 2 diff --git a/codenet/public_test_cases/p03228/input.1.txt b/codenet/public_test_cases/p03228/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..975b5b4edbcd4186641710d4e3ef291a40475f00 --- /dev/null +++ b/codenet/public_test_cases/p03228/input.1.txt @@ -0,0 +1 @@ +3 3 3 diff --git a/codenet/public_test_cases/p03228/input.2.txt b/codenet/public_test_cases/p03228/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4669e97437f8101576e9380066a9570b4720875 --- /dev/null +++ b/codenet/public_test_cases/p03228/input.2.txt @@ -0,0 +1 @@ +5 4 2 diff --git a/codenet/public_test_cases/p03228/input.3.txt b/codenet/public_test_cases/p03228/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e5acc4fea364f0742f50df4eb13af60d906b4ba --- /dev/null +++ b/codenet/public_test_cases/p03228/input.3.txt @@ -0,0 +1 @@ +314159265 358979323 84 diff --git a/codenet/public_test_cases/p03228/output.0.txt b/codenet/public_test_cases/p03228/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p03228/output.0.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p03228/output.1.txt b/codenet/public_test_cases/p03228/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p03228/output.1.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p03228/output.2.txt b/codenet/public_test_cases/p03228/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p03228/output.2.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p03228/output.3.txt b/codenet/public_test_cases/p03228/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5250e86ebd58e4ce706fdd54cd8627952064828e --- /dev/null +++ b/codenet/public_test_cases/p03228/output.3.txt @@ -0,0 +1 @@ +448759046 224379523 diff --git a/codenet/public_test_cases/p03229/input.0.txt b/codenet/public_test_cases/p03229/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..30c09bd1e2079d94ca74563ec8af53a37e889f4b --- /dev/null +++ b/codenet/public_test_cases/p03229/input.0.txt @@ -0,0 +1,6 @@ +5 +6 +8 +1 +2 +3 diff --git a/codenet/public_test_cases/p03229/input.1.txt b/codenet/public_test_cases/p03229/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..146bd4f5c376c0d7429fd69417303930f1a46b46 --- /dev/null +++ b/codenet/public_test_cases/p03229/input.1.txt @@ -0,0 +1,4 @@ +3 +5 +5 +1 diff --git a/codenet/public_test_cases/p03229/input.2.txt b/codenet/public_test_cases/p03229/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2d4b3254e9823c13838c6eecfd88b56e5abe26 --- /dev/null +++ b/codenet/public_test_cases/p03229/input.2.txt @@ -0,0 +1,7 @@ +6 +3 +1 +4 +1 +5 +9 diff --git a/codenet/public_test_cases/p03229/input.3.txt b/codenet/public_test_cases/p03229/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..30c09bd1e2079d94ca74563ec8af53a37e889f4b --- /dev/null +++ b/codenet/public_test_cases/p03229/input.3.txt @@ -0,0 +1,6 @@ +5 +6 +8 +1 +2 +3 diff --git a/codenet/public_test_cases/p03229/output.0.txt b/codenet/public_test_cases/p03229/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03229/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03229/output.1.txt b/codenet/public_test_cases/p03229/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03229/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03229/output.2.txt b/codenet/public_test_cases/p03229/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p03229/output.2.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p03229/output.3.txt b/codenet/public_test_cases/p03229/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03229/output.3.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03230/input.0.txt b/codenet/public_test_cases/p03230/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03230/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03230/input.1.txt b/codenet/public_test_cases/p03230/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03230/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03230/input.2.txt b/codenet/public_test_cases/p03230/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03230/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03230/output.0.txt b/codenet/public_test_cases/p03230/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c74e3100be9687b4610a93788c090c5d7edec4a3 --- /dev/null +++ b/codenet/public_test_cases/p03230/output.0.txt @@ -0,0 +1,5 @@ +Yes +3 +2 1 2 +2 3 1 +2 2 3 diff --git a/codenet/public_test_cases/p03230/output.1.txt b/codenet/public_test_cases/p03230/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03230/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03230/output.2.txt b/codenet/public_test_cases/p03230/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c74e3100be9687b4610a93788c090c5d7edec4a3 --- /dev/null +++ b/codenet/public_test_cases/p03230/output.2.txt @@ -0,0 +1,5 @@ +Yes +3 +2 1 2 +2 3 1 +2 2 3 diff --git a/codenet/public_test_cases/p03231/input.0.txt b/codenet/public_test_cases/p03231/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c49d1cb9e6e4611062803087bed1fc5b6f9303ef --- /dev/null +++ b/codenet/public_test_cases/p03231/input.0.txt @@ -0,0 +1,3 @@ +3 2 +acp +ae diff --git a/codenet/public_test_cases/p03231/input.1.txt b/codenet/public_test_cases/p03231/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c49d1cb9e6e4611062803087bed1fc5b6f9303ef --- /dev/null +++ b/codenet/public_test_cases/p03231/input.1.txt @@ -0,0 +1,3 @@ +3 2 +acp +ae diff --git a/codenet/public_test_cases/p03231/input.2.txt b/codenet/public_test_cases/p03231/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0173dd93b85df952d02becf81b89e6f29aa53007 --- /dev/null +++ b/codenet/public_test_cases/p03231/input.2.txt @@ -0,0 +1,3 @@ +6 3 +abcdef +abc diff --git a/codenet/public_test_cases/p03231/input.3.txt b/codenet/public_test_cases/p03231/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a7895793f6c6ba95d9b507db6cd241b3e258790 --- /dev/null +++ b/codenet/public_test_cases/p03231/input.3.txt @@ -0,0 +1,3 @@ +15 9 +dnsusrayukuaiia +dujrunuma diff --git a/codenet/public_test_cases/p03231/output.0.txt b/codenet/public_test_cases/p03231/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03231/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03231/output.1.txt b/codenet/public_test_cases/p03231/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03231/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03231/output.2.txt b/codenet/public_test_cases/p03231/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03231/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03231/output.3.txt b/codenet/public_test_cases/p03231/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea90ee31980757b2e469741512bcb39e73494e78 --- /dev/null +++ b/codenet/public_test_cases/p03231/output.3.txt @@ -0,0 +1 @@ +45 diff --git a/codenet/public_test_cases/p03232/input.0.txt b/codenet/public_test_cases/p03232/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p03232/input.0.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p03232/input.1.txt b/codenet/public_test_cases/p03232/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d2d6078efd8f25f9d3adabb3327e3ee4c1507ca --- /dev/null +++ b/codenet/public_test_cases/p03232/input.1.txt @@ -0,0 +1,2 @@ +10 +1 2 4 8 16 32 64 128 256 512 diff --git a/codenet/public_test_cases/p03232/input.2.txt b/codenet/public_test_cases/p03232/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p03232/input.2.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p03232/input.3.txt b/codenet/public_test_cases/p03232/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c95aee82892a809ab2db3e2c46a29df093e930e --- /dev/null +++ b/codenet/public_test_cases/p03232/input.3.txt @@ -0,0 +1,2 @@ +4 +1 1 1 1 diff --git a/codenet/public_test_cases/p03232/output.0.txt b/codenet/public_test_cases/p03232/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03232/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03232/output.1.txt b/codenet/public_test_cases/p03232/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e192446fb50f1d61a6d28970d3edfe39dfcd54e --- /dev/null +++ b/codenet/public_test_cases/p03232/output.1.txt @@ -0,0 +1 @@ +880971923 diff --git a/codenet/public_test_cases/p03232/output.2.txt b/codenet/public_test_cases/p03232/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03232/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03232/output.3.txt b/codenet/public_test_cases/p03232/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d389107a348aa189d7b862d7834120e53f2e3a5 --- /dev/null +++ b/codenet/public_test_cases/p03232/output.3.txt @@ -0,0 +1 @@ +212 diff --git a/codenet/public_test_cases/p03233/input.0.txt b/codenet/public_test_cases/p03233/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f908ca77cac93cb9623920ad5bb209f68496d6a9 --- /dev/null +++ b/codenet/public_test_cases/p03233/input.0.txt @@ -0,0 +1,4 @@ +3 +1 5 +4 2 +6 3 diff --git a/codenet/public_test_cases/p03233/input.1.txt b/codenet/public_test_cases/p03233/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f908ca77cac93cb9623920ad5bb209f68496d6a9 --- /dev/null +++ b/codenet/public_test_cases/p03233/input.1.txt @@ -0,0 +1,4 @@ +3 +1 5 +4 2 +6 3 diff --git a/codenet/public_test_cases/p03233/input.2.txt b/codenet/public_test_cases/p03233/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d8f0e3ce3b238f86a5959f56a763d9ed29d9bce --- /dev/null +++ b/codenet/public_test_cases/p03233/input.2.txt @@ -0,0 +1,7 @@ +6 +19 92 +64 64 +78 48 +57 33 +73 6 +95 73 diff --git a/codenet/public_test_cases/p03233/input.3.txt b/codenet/public_test_cases/p03233/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2453ced7f4cb340c311a80f80ac8792457f2ed4 --- /dev/null +++ b/codenet/public_test_cases/p03233/input.3.txt @@ -0,0 +1,5 @@ +4 +1 5 +2 6 +3 7 +4 8 diff --git a/codenet/public_test_cases/p03233/output.0.txt b/codenet/public_test_cases/p03233/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03233/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03233/output.1.txt b/codenet/public_test_cases/p03233/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03233/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03233/output.2.txt b/codenet/public_test_cases/p03233/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c36bbdaa0ad81ad9b599c57286acee8a036a787 --- /dev/null +++ b/codenet/public_test_cases/p03233/output.2.txt @@ -0,0 +1 @@ +227 diff --git a/codenet/public_test_cases/p03233/output.3.txt b/codenet/public_test_cases/p03233/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03233/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03234/input.0.txt b/codenet/public_test_cases/p03234/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a74b3c2309d5dee0e16c0639409cbe4bfd6f1f9e --- /dev/null +++ b/codenet/public_test_cases/p03234/input.0.txt @@ -0,0 +1 @@ +2 0 diff --git a/codenet/public_test_cases/p03234/input.1.txt b/codenet/public_test_cases/p03234/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a74b3c2309d5dee0e16c0639409cbe4bfd6f1f9e --- /dev/null +++ b/codenet/public_test_cases/p03234/input.1.txt @@ -0,0 +1 @@ +2 0 diff --git a/codenet/public_test_cases/p03234/input.2.txt b/codenet/public_test_cases/p03234/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8559b2a005a38655fd142d9b46eb02ac5ed181b --- /dev/null +++ b/codenet/public_test_cases/p03234/input.2.txt @@ -0,0 +1,11 @@ +20 10 +10 18 +11 17 +14 7 +4 6 +30 28 +19 24 +29 22 +25 32 +38 34 +36 39 diff --git a/codenet/public_test_cases/p03234/input.3.txt b/codenet/public_test_cases/p03234/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5ebb672b1c15c83a1c8798f857fa3eed3615cff --- /dev/null +++ b/codenet/public_test_cases/p03234/input.3.txt @@ -0,0 +1,3 @@ +4 2 +5 2 +6 1 diff --git a/codenet/public_test_cases/p03234/output.0.txt b/codenet/public_test_cases/p03234/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03234/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03234/output.1.txt b/codenet/public_test_cases/p03234/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03234/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03234/output.2.txt b/codenet/public_test_cases/p03234/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9eddccdf797858c9172b0b8beffe5fe12855beb --- /dev/null +++ b/codenet/public_test_cases/p03234/output.2.txt @@ -0,0 +1 @@ +27087418 diff --git a/codenet/public_test_cases/p03234/output.3.txt b/codenet/public_test_cases/p03234/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03234/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03235/input.0.txt b/codenet/public_test_cases/p03235/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..15fb63603e6b062e96a257aebd09e6ef4041626f --- /dev/null +++ b/codenet/public_test_cases/p03235/input.0.txt @@ -0,0 +1,2 @@ +6 +3 1 4 6 2 5 diff --git a/codenet/public_test_cases/p03235/input.1.txt b/codenet/public_test_cases/p03235/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..15fb63603e6b062e96a257aebd09e6ef4041626f --- /dev/null +++ b/codenet/public_test_cases/p03235/input.1.txt @@ -0,0 +1,2 @@ +6 +3 1 4 6 2 5 diff --git a/codenet/public_test_cases/p03235/input.2.txt b/codenet/public_test_cases/p03235/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..66836c1aaa8b67b22a51ece863e9879d602d56c9 --- /dev/null +++ b/codenet/public_test_cases/p03235/input.2.txt @@ -0,0 +1,2 @@ +7 +1 3 2 5 6 4 7 diff --git a/codenet/public_test_cases/p03235/input.3.txt b/codenet/public_test_cases/p03235/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p03235/input.3.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03235/input.4.txt b/codenet/public_test_cases/p03235/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..90a217e14a3c7b97963b1127004f420c1f67bebd --- /dev/null +++ b/codenet/public_test_cases/p03235/input.4.txt @@ -0,0 +1,2 @@ +30 +1 2 6 3 5 7 9 8 11 12 10 13 16 23 15 18 14 24 22 26 19 21 28 17 4 27 29 25 20 30 diff --git a/codenet/public_test_cases/p03235/output.0.txt b/codenet/public_test_cases/p03235/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b4c127d1d2f545cec1e200772b31526487baa6b --- /dev/null +++ b/codenet/public_test_cases/p03235/output.0.txt @@ -0,0 +1 @@ +001001 diff --git a/codenet/public_test_cases/p03235/output.1.txt b/codenet/public_test_cases/p03235/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b4c127d1d2f545cec1e200772b31526487baa6b --- /dev/null +++ b/codenet/public_test_cases/p03235/output.1.txt @@ -0,0 +1 @@ +001001 diff --git a/codenet/public_test_cases/p03235/output.2.txt b/codenet/public_test_cases/p03235/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..24a5c3c739e675ce2a03a77cdbcf48169bb07ea6 --- /dev/null +++ b/codenet/public_test_cases/p03235/output.2.txt @@ -0,0 +1 @@ +0001101 diff --git a/codenet/public_test_cases/p03235/output.3.txt b/codenet/public_test_cases/p03235/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03235/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03235/output.4.txt b/codenet/public_test_cases/p03235/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a197f3957087e4adb07b42efca7604eb2372acfa --- /dev/null +++ b/codenet/public_test_cases/p03235/output.4.txt @@ -0,0 +1 @@ +000000000001100101010010011101 diff --git a/codenet/public_test_cases/p03236/input.0.txt b/codenet/public_test_cases/p03236/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fa92d2137692b40ccc8c01d53ca5977ca44843b --- /dev/null +++ b/codenet/public_test_cases/p03236/input.0.txt @@ -0,0 +1,3 @@ +2 +11 +11 diff --git a/codenet/public_test_cases/p03236/input.1.txt b/codenet/public_test_cases/p03236/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b7899dc150fd28df1cf759c5d9a4a4067c73bc4 --- /dev/null +++ b/codenet/public_test_cases/p03236/input.1.txt @@ -0,0 +1,5 @@ +4 +1111 +11#1 +1#11 +1111 diff --git a/codenet/public_test_cases/p03236/input.2.txt b/codenet/public_test_cases/p03236/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb6cefea98b618ccdd5141a2c09fffcf47fe8eff --- /dev/null +++ b/codenet/public_test_cases/p03236/input.2.txt @@ -0,0 +1,11 @@ +10 +4177143673 +7######### +5#1716155# +6#4#####5# +2#3#597#6# +6#9#8#3#5# +5#2#899#9# +1#6#####6# +6#5359657# +5######### diff --git a/codenet/public_test_cases/p03236/input.3.txt b/codenet/public_test_cases/p03236/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cfb780db20c1607132d0eb52761fa02938f6c69 --- /dev/null +++ b/codenet/public_test_cases/p03236/input.3.txt @@ -0,0 +1,11 @@ +10 +76##63##3# +8445669721 +75#9542133 +3#285##445 +749632##89 +2458##9515 +5952578#77 +1#3#44196# +4355#99#1# +298#63587 diff --git a/codenet/public_test_cases/p03236/input.4.txt b/codenet/public_test_cases/p03236/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fa92d2137692b40ccc8c01d53ca5977ca44843b --- /dev/null +++ b/codenet/public_test_cases/p03236/input.4.txt @@ -0,0 +1,3 @@ +2 +11 +11 diff --git a/codenet/public_test_cases/p03236/output.0.txt b/codenet/public_test_cases/p03236/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03236/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03236/output.1.txt b/codenet/public_test_cases/p03236/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abac1ea7b759d8258c9ad9e5b450f782aaa33374 --- /dev/null +++ b/codenet/public_test_cases/p03236/output.1.txt @@ -0,0 +1 @@ +47 diff --git a/codenet/public_test_cases/p03236/output.2.txt b/codenet/public_test_cases/p03236/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dac21a5739ac8f9346c9ee568e38df7623358535 --- /dev/null +++ b/codenet/public_test_cases/p03236/output.2.txt @@ -0,0 +1 @@ +6525 diff --git a/codenet/public_test_cases/p03236/output.3.txt b/codenet/public_test_cases/p03236/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e7ebbeeece66d2c3e9a5429b9b4b5d911f32a37 --- /dev/null +++ b/codenet/public_test_cases/p03236/output.3.txt @@ -0,0 +1 @@ +36065 diff --git a/codenet/public_test_cases/p03236/output.4.txt b/codenet/public_test_cases/p03236/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03236/output.4.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03237/input.0.txt b/codenet/public_test_cases/p03237/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fa92d2137692b40ccc8c01d53ca5977ca44843b --- /dev/null +++ b/codenet/public_test_cases/p03237/input.0.txt @@ -0,0 +1,3 @@ +2 +11 +11 diff --git a/codenet/public_test_cases/p03237/output.0.txt b/codenet/public_test_cases/p03237/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03237/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03238/input.0.txt b/codenet/public_test_cases/p03238/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03238/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03238/input.1.txt b/codenet/public_test_cases/p03238/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03238/input.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03238/input.2.txt b/codenet/public_test_cases/p03238/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e543d3934759d715ac9ca39e71e2b14a992e64e0 --- /dev/null +++ b/codenet/public_test_cases/p03238/input.2.txt @@ -0,0 +1,3 @@ +2 +3 +5 diff --git a/codenet/public_test_cases/p03238/output.0.txt b/codenet/public_test_cases/p03238/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..557db03de997c86a4a028e1ebd3a1ceb225be238 --- /dev/null +++ b/codenet/public_test_cases/p03238/output.0.txt @@ -0,0 +1 @@ +Hello World diff --git a/codenet/public_test_cases/p03238/output.1.txt b/codenet/public_test_cases/p03238/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..557db03de997c86a4a028e1ebd3a1ceb225be238 --- /dev/null +++ b/codenet/public_test_cases/p03238/output.1.txt @@ -0,0 +1 @@ +Hello World diff --git a/codenet/public_test_cases/p03238/output.2.txt b/codenet/public_test_cases/p03238/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03238/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03239/input.0.txt b/codenet/public_test_cases/p03239/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..67634bfb2f0e2953fabb1d26f69599da22062b44 --- /dev/null +++ b/codenet/public_test_cases/p03239/input.0.txt @@ -0,0 +1,4 @@ +3 70 +7 60 +1 80 +4 50 diff --git a/codenet/public_test_cases/p03239/input.1.txt b/codenet/public_test_cases/p03239/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fda400e84eee96325bbce286ecaaa3a0faf25bc9 --- /dev/null +++ b/codenet/public_test_cases/p03239/input.1.txt @@ -0,0 +1,5 @@ +4 3 +1 1000 +2 4 +3 1000 +4 500 diff --git a/codenet/public_test_cases/p03239/input.2.txt b/codenet/public_test_cases/p03239/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..62d19bb4f1ba102353bbb3d35e6769421a9c6822 --- /dev/null +++ b/codenet/public_test_cases/p03239/input.2.txt @@ -0,0 +1,6 @@ +5 9 +25 8 +5 9 +4 10 +1000 1000 +6 1 diff --git a/codenet/public_test_cases/p03239/input.3.txt b/codenet/public_test_cases/p03239/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..67634bfb2f0e2953fabb1d26f69599da22062b44 --- /dev/null +++ b/codenet/public_test_cases/p03239/input.3.txt @@ -0,0 +1,4 @@ +3 70 +7 60 +1 80 +4 50 diff --git a/codenet/public_test_cases/p03239/output.0.txt b/codenet/public_test_cases/p03239/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03239/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03239/output.1.txt b/codenet/public_test_cases/p03239/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91ddb053fc4a95de53f0a59990dc9bcab464083c --- /dev/null +++ b/codenet/public_test_cases/p03239/output.1.txt @@ -0,0 +1 @@ +TLE diff --git a/codenet/public_test_cases/p03239/output.2.txt b/codenet/public_test_cases/p03239/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03239/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03239/output.3.txt b/codenet/public_test_cases/p03239/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03239/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03240/input.0.txt b/codenet/public_test_cases/p03240/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63032121c49804ad689c19108179089bc1138eee --- /dev/null +++ b/codenet/public_test_cases/p03240/input.0.txt @@ -0,0 +1,5 @@ +4 +2 3 5 +2 1 5 +1 2 5 +3 2 5 diff --git a/codenet/public_test_cases/p03240/input.1.txt b/codenet/public_test_cases/p03240/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..da51b2edb1f4cde56471062e8f3c7dc93d800cba --- /dev/null +++ b/codenet/public_test_cases/p03240/input.1.txt @@ -0,0 +1,3 @@ +2 +0 0 100 +1 1 98 diff --git a/codenet/public_test_cases/p03240/input.2.txt b/codenet/public_test_cases/p03240/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a05b1f074ab00cca332590fd2b8f3bd1088d8c73 --- /dev/null +++ b/codenet/public_test_cases/p03240/input.2.txt @@ -0,0 +1,4 @@ +3 +99 1 191 +100 1 192 +99 0 192 diff --git a/codenet/public_test_cases/p03240/input.3.txt b/codenet/public_test_cases/p03240/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..63032121c49804ad689c19108179089bc1138eee --- /dev/null +++ b/codenet/public_test_cases/p03240/input.3.txt @@ -0,0 +1,5 @@ +4 +2 3 5 +2 1 5 +1 2 5 +3 2 5 diff --git a/codenet/public_test_cases/p03240/output.0.txt b/codenet/public_test_cases/p03240/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a208c99c8afd9ba51e5e94d65219bc1c44556d20 --- /dev/null +++ b/codenet/public_test_cases/p03240/output.0.txt @@ -0,0 +1 @@ +2 2 6 diff --git a/codenet/public_test_cases/p03240/output.1.txt b/codenet/public_test_cases/p03240/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45bc3d6dc22c5a70fe6bc70d32b06a73b5aab9db --- /dev/null +++ b/codenet/public_test_cases/p03240/output.1.txt @@ -0,0 +1 @@ +0 0 100 diff --git a/codenet/public_test_cases/p03240/output.2.txt b/codenet/public_test_cases/p03240/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b7c9edd687117b85e5f30ac0381be735d20c563 --- /dev/null +++ b/codenet/public_test_cases/p03240/output.2.txt @@ -0,0 +1 @@ +100 0 193 diff --git a/codenet/public_test_cases/p03240/output.3.txt b/codenet/public_test_cases/p03240/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a208c99c8afd9ba51e5e94d65219bc1c44556d20 --- /dev/null +++ b/codenet/public_test_cases/p03240/output.3.txt @@ -0,0 +1 @@ +2 2 6 diff --git a/codenet/public_test_cases/p03241/input.0.txt b/codenet/public_test_cases/p03241/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9bc2800face87e33ba810a198560950690ca0e6 --- /dev/null +++ b/codenet/public_test_cases/p03241/input.0.txt @@ -0,0 +1 @@ +3 14 diff --git a/codenet/public_test_cases/p03241/input.1.txt b/codenet/public_test_cases/p03241/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9899c3bd1754fa01da000a33c17b695e3ceaa0f --- /dev/null +++ b/codenet/public_test_cases/p03241/input.1.txt @@ -0,0 +1 @@ +10 123 diff --git a/codenet/public_test_cases/p03241/input.2.txt b/codenet/public_test_cases/p03241/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9bc2800face87e33ba810a198560950690ca0e6 --- /dev/null +++ b/codenet/public_test_cases/p03241/input.2.txt @@ -0,0 +1 @@ +3 14 diff --git a/codenet/public_test_cases/p03241/input.3.txt b/codenet/public_test_cases/p03241/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d9e4c999f442f753c7031ae06a02ac94f70f80c --- /dev/null +++ b/codenet/public_test_cases/p03241/input.3.txt @@ -0,0 +1 @@ +100000 1000000000 diff --git a/codenet/public_test_cases/p03241/output.0.txt b/codenet/public_test_cases/p03241/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03241/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03241/output.1.txt b/codenet/public_test_cases/p03241/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03241/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03241/output.2.txt b/codenet/public_test_cases/p03241/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03241/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03241/output.3.txt b/codenet/public_test_cases/p03241/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5caff40c4a0ce4ed0dcb3aa983da623641af1b06 --- /dev/null +++ b/codenet/public_test_cases/p03241/output.3.txt @@ -0,0 +1 @@ +10000 diff --git a/codenet/public_test_cases/p03242/input.0.txt b/codenet/public_test_cases/p03242/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..078fa0fe576b141de649b5439c1fbebbb391dff4 --- /dev/null +++ b/codenet/public_test_cases/p03242/input.0.txt @@ -0,0 +1 @@ +119 diff --git a/codenet/public_test_cases/p03242/input.1.txt b/codenet/public_test_cases/p03242/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..078fa0fe576b141de649b5439c1fbebbb391dff4 --- /dev/null +++ b/codenet/public_test_cases/p03242/input.1.txt @@ -0,0 +1 @@ +119 diff --git a/codenet/public_test_cases/p03242/input.2.txt b/codenet/public_test_cases/p03242/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6905f8ba447c0116590e38b2430151b506b1611 --- /dev/null +++ b/codenet/public_test_cases/p03242/input.2.txt @@ -0,0 +1 @@ +999 diff --git a/codenet/public_test_cases/p03242/output.0.txt b/codenet/public_test_cases/p03242/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1724ded9d64c1d33bf4fb66198c1dcb6cf0f141 --- /dev/null +++ b/codenet/public_test_cases/p03242/output.0.txt @@ -0,0 +1 @@ +991 diff --git a/codenet/public_test_cases/p03242/output.1.txt b/codenet/public_test_cases/p03242/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1724ded9d64c1d33bf4fb66198c1dcb6cf0f141 --- /dev/null +++ b/codenet/public_test_cases/p03242/output.1.txt @@ -0,0 +1 @@ +991 diff --git a/codenet/public_test_cases/p03242/output.2.txt b/codenet/public_test_cases/p03242/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p03242/output.2.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p03243/input.0.txt b/codenet/public_test_cases/p03243/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p03243/input.0.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p03243/input.1.txt b/codenet/public_test_cases/p03243/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9beea1f9dc6e3e79bfb53017a387a2caf78cf203 --- /dev/null +++ b/codenet/public_test_cases/p03243/input.1.txt @@ -0,0 +1 @@ +750 diff --git a/codenet/public_test_cases/p03243/input.2.txt b/codenet/public_test_cases/p03243/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..194b81caae1cb16aa059ce147a1e2e74206999af --- /dev/null +++ b/codenet/public_test_cases/p03243/input.2.txt @@ -0,0 +1 @@ +112 diff --git a/codenet/public_test_cases/p03243/input.3.txt b/codenet/public_test_cases/p03243/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p03243/input.3.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p03243/output.0.txt b/codenet/public_test_cases/p03243/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p03243/output.0.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p03243/output.1.txt b/codenet/public_test_cases/p03243/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e68a0f7e9e1d2da6cdabd3d1588fc2eaa0c9e64 --- /dev/null +++ b/codenet/public_test_cases/p03243/output.1.txt @@ -0,0 +1 @@ +777 diff --git a/codenet/public_test_cases/p03243/output.2.txt b/codenet/public_test_cases/p03243/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c200906efd24ec5e783bee7f23b5d7c941b0c12c --- /dev/null +++ b/codenet/public_test_cases/p03243/output.2.txt @@ -0,0 +1 @@ +222 diff --git a/codenet/public_test_cases/p03243/output.3.txt b/codenet/public_test_cases/p03243/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9bdf9d017fcd178dc8c073cbfcbb7ff240d6c --- /dev/null +++ b/codenet/public_test_cases/p03243/output.3.txt @@ -0,0 +1 @@ +111 diff --git a/codenet/public_test_cases/p03244/input.0.txt b/codenet/public_test_cases/p03244/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..735df2c0fb36bccf1e31d09bf674e0e698da9de4 --- /dev/null +++ b/codenet/public_test_cases/p03244/input.0.txt @@ -0,0 +1,2 @@ +4 +3 1 3 2 diff --git a/codenet/public_test_cases/p03244/input.1.txt b/codenet/public_test_cases/p03244/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..735df2c0fb36bccf1e31d09bf674e0e698da9de4 --- /dev/null +++ b/codenet/public_test_cases/p03244/input.1.txt @@ -0,0 +1,2 @@ +4 +3 1 3 2 diff --git a/codenet/public_test_cases/p03244/input.2.txt b/codenet/public_test_cases/p03244/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c95aee82892a809ab2db3e2c46a29df093e930e --- /dev/null +++ b/codenet/public_test_cases/p03244/input.2.txt @@ -0,0 +1,2 @@ +4 +1 1 1 1 diff --git a/codenet/public_test_cases/p03244/input.3.txt b/codenet/public_test_cases/p03244/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff0e3528a59aa94ec4368d7a8b50e87577f8220d --- /dev/null +++ b/codenet/public_test_cases/p03244/input.3.txt @@ -0,0 +1,2 @@ +6 +105 119 105 119 105 119 diff --git a/codenet/public_test_cases/p03244/output.0.txt b/codenet/public_test_cases/p03244/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03244/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03244/output.1.txt b/codenet/public_test_cases/p03244/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03244/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03244/output.2.txt b/codenet/public_test_cases/p03244/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03244/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03244/output.3.txt b/codenet/public_test_cases/p03244/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03244/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03245/input.0.txt b/codenet/public_test_cases/p03245/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3e86896d106eb3646be66f92fa2d418f5c48704 --- /dev/null +++ b/codenet/public_test_cases/p03245/input.0.txt @@ -0,0 +1,4 @@ +3 +-1 0 +0 3 +2 -1 diff --git a/codenet/public_test_cases/p03245/input.1.txt b/codenet/public_test_cases/p03245/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd29bee20df23dd8c9c7b5df08c2fffa67dc3a0 --- /dev/null +++ b/codenet/public_test_cases/p03245/input.1.txt @@ -0,0 +1,3 @@ +2 +1 1 +1 1 diff --git a/codenet/public_test_cases/p03245/input.2.txt b/codenet/public_test_cases/p03245/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..adaf2fe5147529cc724e7474501754b9a861eca8 --- /dev/null +++ b/codenet/public_test_cases/p03245/input.2.txt @@ -0,0 +1,6 @@ +5 +0 0 +1 0 +2 0 +3 0 +4 0 diff --git a/codenet/public_test_cases/p03245/input.3.txt b/codenet/public_test_cases/p03245/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..37a4ccff852194eb838d0d63c3c041f3413fad1b --- /dev/null +++ b/codenet/public_test_cases/p03245/input.3.txt @@ -0,0 +1,4 @@ +3 +-7 -3 +7 3 +-3 -7 diff --git a/codenet/public_test_cases/p03245/input.4.txt b/codenet/public_test_cases/p03245/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3e86896d106eb3646be66f92fa2d418f5c48704 --- /dev/null +++ b/codenet/public_test_cases/p03245/input.4.txt @@ -0,0 +1,4 @@ +3 +-1 0 +0 3 +2 -1 diff --git a/codenet/public_test_cases/p03245/output.0.txt b/codenet/public_test_cases/p03245/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7df4b889998de484b858d4ba1284194fe717ad94 --- /dev/null +++ b/codenet/public_test_cases/p03245/output.0.txt @@ -0,0 +1,5 @@ +2 +1 2 +RL +UU +DR diff --git a/codenet/public_test_cases/p03245/output.1.txt b/codenet/public_test_cases/p03245/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d97be88735d3fc80f8f964d094dbd3c8d000ab57 --- /dev/null +++ b/codenet/public_test_cases/p03245/output.1.txt @@ -0,0 +1,4 @@ +2 +1 1 +RU +UR diff --git a/codenet/public_test_cases/p03245/output.2.txt b/codenet/public_test_cases/p03245/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03245/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03245/output.3.txt b/codenet/public_test_cases/p03245/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9438550b621a587448d7c913f6a49b8648228d4 --- /dev/null +++ b/codenet/public_test_cases/p03245/output.3.txt @@ -0,0 +1,5 @@ +5 +3 1 4 1 5 +LRDUL +RDULR +DULRD diff --git a/codenet/public_test_cases/p03245/output.4.txt b/codenet/public_test_cases/p03245/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7df4b889998de484b858d4ba1284194fe717ad94 --- /dev/null +++ b/codenet/public_test_cases/p03245/output.4.txt @@ -0,0 +1,5 @@ +2 +1 2 +RL +UU +DR diff --git a/codenet/public_test_cases/p03246/input.0.txt b/codenet/public_test_cases/p03246/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..735df2c0fb36bccf1e31d09bf674e0e698da9de4 --- /dev/null +++ b/codenet/public_test_cases/p03246/input.0.txt @@ -0,0 +1,2 @@ +4 +3 1 3 2 diff --git a/codenet/public_test_cases/p03246/output.0.txt b/codenet/public_test_cases/p03246/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03246/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03247/input.0.txt b/codenet/public_test_cases/p03247/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3e86896d106eb3646be66f92fa2d418f5c48704 --- /dev/null +++ b/codenet/public_test_cases/p03247/input.0.txt @@ -0,0 +1,4 @@ +3 +-1 0 +0 3 +2 -1 diff --git a/codenet/public_test_cases/p03247/output.0.txt b/codenet/public_test_cases/p03247/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7df4b889998de484b858d4ba1284194fe717ad94 --- /dev/null +++ b/codenet/public_test_cases/p03247/output.0.txt @@ -0,0 +1,5 @@ +2 +1 2 +RL +UU +DR diff --git a/codenet/public_test_cases/p03248/input.0.txt b/codenet/public_test_cases/p03248/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f2f16bfff90e6620509c0cf442e7a3586dad8fb --- /dev/null +++ b/codenet/public_test_cases/p03248/input.0.txt @@ -0,0 +1 @@ +1111 diff --git a/codenet/public_test_cases/p03248/input.1.txt b/codenet/public_test_cases/p03248/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a75ff76190b66939608d9c42715f8d2bcbcd059 --- /dev/null +++ b/codenet/public_test_cases/p03248/input.1.txt @@ -0,0 +1 @@ +1110 diff --git a/codenet/public_test_cases/p03248/input.2.txt b/codenet/public_test_cases/p03248/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f2f16bfff90e6620509c0cf442e7a3586dad8fb --- /dev/null +++ b/codenet/public_test_cases/p03248/input.2.txt @@ -0,0 +1 @@ +1111 diff --git a/codenet/public_test_cases/p03248/input.3.txt b/codenet/public_test_cases/p03248/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..52a9f4e2bf4dbf248ddc2526cfbf33a95f7d1c8a --- /dev/null +++ b/codenet/public_test_cases/p03248/input.3.txt @@ -0,0 +1 @@ +1010 diff --git a/codenet/public_test_cases/p03248/output.0.txt b/codenet/public_test_cases/p03248/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03248/output.0.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03248/output.1.txt b/codenet/public_test_cases/p03248/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b3ea1fba35fe7eadfb434fb32c48709e71523a4 --- /dev/null +++ b/codenet/public_test_cases/p03248/output.1.txt @@ -0,0 +1,3 @@ +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p03248/output.2.txt b/codenet/public_test_cases/p03248/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03248/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03248/output.3.txt b/codenet/public_test_cases/p03248/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8abf5b5fd0818df65517d3961a20b5c7b234f5ac --- /dev/null +++ b/codenet/public_test_cases/p03248/output.3.txt @@ -0,0 +1,3 @@ +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p03249/input.0.txt b/codenet/public_test_cases/p03249/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d99e6647d78802b137e877c898ebfe187607af6c --- /dev/null +++ b/codenet/public_test_cases/p03249/input.0.txt @@ -0,0 +1,8 @@ +7 +10 +15 +13 +18 +11 +14 +19 diff --git a/codenet/public_test_cases/p03249/input.1.txt b/codenet/public_test_cases/p03249/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4194e5816d3c3f3c75e17880d9d7f9a96e630bab --- /dev/null +++ b/codenet/public_test_cases/p03249/input.1.txt @@ -0,0 +1,16 @@ +15 +57 +62 +47 +45 +42 +74 +90 +75 +54 +50 +66 +63 +77 +87 +51 diff --git a/codenet/public_test_cases/p03249/input.2.txt b/codenet/public_test_cases/p03249/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5357a4ab725b414041284c4c3279bd75c1709068 --- /dev/null +++ b/codenet/public_test_cases/p03249/input.2.txt @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/codenet/public_test_cases/p03249/input.3.txt b/codenet/public_test_cases/p03249/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d99e6647d78802b137e877c898ebfe187607af6c --- /dev/null +++ b/codenet/public_test_cases/p03249/input.3.txt @@ -0,0 +1,8 @@ +7 +10 +15 +13 +18 +11 +14 +19 diff --git a/codenet/public_test_cases/p03249/output.0.txt b/codenet/public_test_cases/p03249/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f77c76347f2547d63b39da43f3c771d7ba478c2 --- /dev/null +++ b/codenet/public_test_cases/p03249/output.0.txt @@ -0,0 +1,6 @@ +1 2 +1 3 +1 5 +3 4 +5 6 +6 7 diff --git a/codenet/public_test_cases/p03249/output.1.txt b/codenet/public_test_cases/p03249/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af4ba370eb0de98b5fd92c72e420341498aa97a5 --- /dev/null +++ b/codenet/public_test_cases/p03249/output.1.txt @@ -0,0 +1,14 @@ +1 10 +1 11 +2 8 +2 15 +3 5 +3 9 +4 5 +4 10 +5 15 +6 12 +6 14 +7 13 +9 12 +11 13 diff --git a/codenet/public_test_cases/p03249/output.2.txt b/codenet/public_test_cases/p03249/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03249/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03249/output.3.txt b/codenet/public_test_cases/p03249/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f77c76347f2547d63b39da43f3c771d7ba478c2 --- /dev/null +++ b/codenet/public_test_cases/p03249/output.3.txt @@ -0,0 +1,6 @@ +1 2 +1 3 +1 5 +3 4 +5 6 +6 7 diff --git a/codenet/public_test_cases/p03250/input.0.txt b/codenet/public_test_cases/p03250/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2434f51bd5b2c6bc55c86f04e54e78d5e756eaba --- /dev/null +++ b/codenet/public_test_cases/p03250/input.0.txt @@ -0,0 +1 @@ +1 5 2 diff --git a/codenet/public_test_cases/p03250/input.1.txt b/codenet/public_test_cases/p03250/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01dcddcee7cf7ebf22f1897a92e8c041ffb8cdf7 --- /dev/null +++ b/codenet/public_test_cases/p03250/input.1.txt @@ -0,0 +1 @@ +9 9 9 diff --git a/codenet/public_test_cases/p03250/input.2.txt b/codenet/public_test_cases/p03250/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2434f51bd5b2c6bc55c86f04e54e78d5e756eaba --- /dev/null +++ b/codenet/public_test_cases/p03250/input.2.txt @@ -0,0 +1 @@ +1 5 2 diff --git a/codenet/public_test_cases/p03250/input.3.txt b/codenet/public_test_cases/p03250/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7a6d513c796b11c1b23d0369cb3689f6b86d9e1 --- /dev/null +++ b/codenet/public_test_cases/p03250/input.3.txt @@ -0,0 +1 @@ +6 6 7 diff --git a/codenet/public_test_cases/p03250/output.0.txt b/codenet/public_test_cases/p03250/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..59343b09ec765366a5b0ac04196385079acd864e --- /dev/null +++ b/codenet/public_test_cases/p03250/output.0.txt @@ -0,0 +1 @@ +53 diff --git a/codenet/public_test_cases/p03250/output.1.txt b/codenet/public_test_cases/p03250/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b20426c05051ed8bd8c8cc632573c194e57809c --- /dev/null +++ b/codenet/public_test_cases/p03250/output.1.txt @@ -0,0 +1 @@ +108 diff --git a/codenet/public_test_cases/p03250/output.2.txt b/codenet/public_test_cases/p03250/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..59343b09ec765366a5b0ac04196385079acd864e --- /dev/null +++ b/codenet/public_test_cases/p03250/output.2.txt @@ -0,0 +1 @@ +53 diff --git a/codenet/public_test_cases/p03250/output.3.txt b/codenet/public_test_cases/p03250/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dde92ddc1a594acd912b467305f36d9f26da45f3 --- /dev/null +++ b/codenet/public_test_cases/p03250/output.3.txt @@ -0,0 +1 @@ +82 diff --git a/codenet/public_test_cases/p03251/input.0.txt b/codenet/public_test_cases/p03251/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..666d3e09330af7aeb2701c3570591fe97d074504 --- /dev/null +++ b/codenet/public_test_cases/p03251/input.0.txt @@ -0,0 +1,3 @@ +3 2 10 20 +8 15 13 +16 22 diff --git a/codenet/public_test_cases/p03251/input.1.txt b/codenet/public_test_cases/p03251/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..666d3e09330af7aeb2701c3570591fe97d074504 --- /dev/null +++ b/codenet/public_test_cases/p03251/input.1.txt @@ -0,0 +1,3 @@ +3 2 10 20 +8 15 13 +16 22 diff --git a/codenet/public_test_cases/p03251/input.2.txt b/codenet/public_test_cases/p03251/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef7af75247af7207eee2f5e65f192584bc6b6d2b --- /dev/null +++ b/codenet/public_test_cases/p03251/input.2.txt @@ -0,0 +1,3 @@ +4 2 -48 -1 +-20 -35 -91 -23 +-22 66 diff --git a/codenet/public_test_cases/p03251/input.3.txt b/codenet/public_test_cases/p03251/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..941cdab31e802601338e080b7d9fc22336949b2b --- /dev/null +++ b/codenet/public_test_cases/p03251/input.3.txt @@ -0,0 +1,3 @@ +5 3 6 8 +-10 3 1 5 -100 +100 6 14 diff --git a/codenet/public_test_cases/p03251/output.0.txt b/codenet/public_test_cases/p03251/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5df93fee1e2b3a939720ffcc17aee84aea5ce85e --- /dev/null +++ b/codenet/public_test_cases/p03251/output.0.txt @@ -0,0 +1 @@ +No War diff --git a/codenet/public_test_cases/p03251/output.1.txt b/codenet/public_test_cases/p03251/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5df93fee1e2b3a939720ffcc17aee84aea5ce85e --- /dev/null +++ b/codenet/public_test_cases/p03251/output.1.txt @@ -0,0 +1 @@ +No War diff --git a/codenet/public_test_cases/p03251/output.2.txt b/codenet/public_test_cases/p03251/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb239f33ec8eeeb6c45fcdab382818af9786b514 --- /dev/null +++ b/codenet/public_test_cases/p03251/output.2.txt @@ -0,0 +1 @@ +War diff --git a/codenet/public_test_cases/p03251/output.3.txt b/codenet/public_test_cases/p03251/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb239f33ec8eeeb6c45fcdab382818af9786b514 --- /dev/null +++ b/codenet/public_test_cases/p03251/output.3.txt @@ -0,0 +1 @@ +War diff --git a/codenet/public_test_cases/p03252/input.0.txt b/codenet/public_test_cases/p03252/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b27567ef2afae6a0ea1fb28fe647889146a464a7 --- /dev/null +++ b/codenet/public_test_cases/p03252/input.0.txt @@ -0,0 +1,2 @@ +azzel +apple diff --git a/codenet/public_test_cases/p03252/input.1.txt b/codenet/public_test_cases/p03252/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b27567ef2afae6a0ea1fb28fe647889146a464a7 --- /dev/null +++ b/codenet/public_test_cases/p03252/input.1.txt @@ -0,0 +1,2 @@ +azzel +apple diff --git a/codenet/public_test_cases/p03252/input.2.txt b/codenet/public_test_cases/p03252/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb1fdb666f782e6e9b17f0820987aed0cc663914 --- /dev/null +++ b/codenet/public_test_cases/p03252/input.2.txt @@ -0,0 +1,2 @@ +abcdefghijklmnopqrstuvwxyz +ibyhqfrekavclxjstdwgpzmonu diff --git a/codenet/public_test_cases/p03252/input.3.txt b/codenet/public_test_cases/p03252/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..260634f6d4a27c636685fac40c717f5a6c5edae6 --- /dev/null +++ b/codenet/public_test_cases/p03252/input.3.txt @@ -0,0 +1,2 @@ +chokudai +redcoder diff --git a/codenet/public_test_cases/p03252/output.0.txt b/codenet/public_test_cases/p03252/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03252/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03252/output.1.txt b/codenet/public_test_cases/p03252/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03252/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03252/output.2.txt b/codenet/public_test_cases/p03252/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03252/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03252/output.3.txt b/codenet/public_test_cases/p03252/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03252/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03253/input.0.txt b/codenet/public_test_cases/p03253/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d69ecad4f4c9b19aa64952e3ea2a201bc20cbc2c --- /dev/null +++ b/codenet/public_test_cases/p03253/input.0.txt @@ -0,0 +1 @@ +2 6 diff --git a/codenet/public_test_cases/p03253/input.1.txt b/codenet/public_test_cases/p03253/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce3eb3a220b853cca5a8554639527a98a8613aae --- /dev/null +++ b/codenet/public_test_cases/p03253/input.1.txt @@ -0,0 +1 @@ +3 12 diff --git a/codenet/public_test_cases/p03253/input.2.txt b/codenet/public_test_cases/p03253/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d69ecad4f4c9b19aa64952e3ea2a201bc20cbc2c --- /dev/null +++ b/codenet/public_test_cases/p03253/input.2.txt @@ -0,0 +1 @@ +2 6 diff --git a/codenet/public_test_cases/p03253/input.3.txt b/codenet/public_test_cases/p03253/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d9e4c999f442f753c7031ae06a02ac94f70f80c --- /dev/null +++ b/codenet/public_test_cases/p03253/input.3.txt @@ -0,0 +1 @@ +100000 1000000000 diff --git a/codenet/public_test_cases/p03253/output.0.txt b/codenet/public_test_cases/p03253/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03253/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03253/output.1.txt b/codenet/public_test_cases/p03253/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03253/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03253/output.2.txt b/codenet/public_test_cases/p03253/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03253/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03253/output.3.txt b/codenet/public_test_cases/p03253/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc262d000ba1ceb367060f6a331f6e2f3eb23878 --- /dev/null +++ b/codenet/public_test_cases/p03253/output.3.txt @@ -0,0 +1 @@ +957870001 diff --git a/codenet/public_test_cases/p03254/input.0.txt b/codenet/public_test_cases/p03254/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7543258cd51e0b93932495012534052122f3aab1 --- /dev/null +++ b/codenet/public_test_cases/p03254/input.0.txt @@ -0,0 +1,2 @@ +3 70 +20 30 10 diff --git a/codenet/public_test_cases/p03254/input.1.txt b/codenet/public_test_cases/p03254/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b10b3866b4dbee2e395a1e7b3ed74d81a6061f52 --- /dev/null +++ b/codenet/public_test_cases/p03254/input.1.txt @@ -0,0 +1,2 @@ +4 1111 +1 10 100 1000 diff --git a/codenet/public_test_cases/p03254/input.2.txt b/codenet/public_test_cases/p03254/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7543258cd51e0b93932495012534052122f3aab1 --- /dev/null +++ b/codenet/public_test_cases/p03254/input.2.txt @@ -0,0 +1,2 @@ +3 70 +20 30 10 diff --git a/codenet/public_test_cases/p03254/input.3.txt b/codenet/public_test_cases/p03254/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d395d6c6d5ce924587c3fc66a9e1a12a68285c0 --- /dev/null +++ b/codenet/public_test_cases/p03254/input.3.txt @@ -0,0 +1,2 @@ +3 10 +20 30 10 diff --git a/codenet/public_test_cases/p03254/input.4.txt b/codenet/public_test_cases/p03254/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c00cd734851046e43f9c02824073e04cce22d19c --- /dev/null +++ b/codenet/public_test_cases/p03254/input.4.txt @@ -0,0 +1,2 @@ +2 10 +20 20 diff --git a/codenet/public_test_cases/p03254/output.0.txt b/codenet/public_test_cases/p03254/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03254/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03254/output.1.txt b/codenet/public_test_cases/p03254/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03254/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03254/output.2.txt b/codenet/public_test_cases/p03254/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03254/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03254/output.3.txt b/codenet/public_test_cases/p03254/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03254/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03254/output.4.txt b/codenet/public_test_cases/p03254/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03254/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03255/input.0.txt b/codenet/public_test_cases/p03255/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c50360ea4ff1a8b189e2aa5529c81b1bf298dd1 --- /dev/null +++ b/codenet/public_test_cases/p03255/input.0.txt @@ -0,0 +1,2 @@ +2 100 +1 10 diff --git a/codenet/public_test_cases/p03255/input.1.txt b/codenet/public_test_cases/p03255/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..53f8f936236bc9dc549c1b139945fa42812ba8e8 --- /dev/null +++ b/codenet/public_test_cases/p03255/input.1.txt @@ -0,0 +1,2 @@ +5 1 +1 999999997 999999998 999999999 1000000000 diff --git a/codenet/public_test_cases/p03255/input.2.txt b/codenet/public_test_cases/p03255/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0124283a24b1fa478d8b551617bcd108d8b04840 --- /dev/null +++ b/codenet/public_test_cases/p03255/input.2.txt @@ -0,0 +1,2 @@ +16 10 +1 7 12 27 52 75 731 13856 395504 534840 1276551 2356789 9384806 19108104 82684732 535447408 diff --git a/codenet/public_test_cases/p03255/input.3.txt b/codenet/public_test_cases/p03255/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c50360ea4ff1a8b189e2aa5529c81b1bf298dd1 --- /dev/null +++ b/codenet/public_test_cases/p03255/input.3.txt @@ -0,0 +1,2 @@ +2 100 +1 10 diff --git a/codenet/public_test_cases/p03255/input.4.txt b/codenet/public_test_cases/p03255/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd4de06f60e38aa22ebc33e827241770e2de9553 --- /dev/null +++ b/codenet/public_test_cases/p03255/input.4.txt @@ -0,0 +1,2 @@ +10 8851025 +38 87 668 3175 22601 65499 90236 790604 4290609 4894746 diff --git a/codenet/public_test_cases/p03255/output.0.txt b/codenet/public_test_cases/p03255/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8941db590596b8073da15204306ddb6ba40c3f0f --- /dev/null +++ b/codenet/public_test_cases/p03255/output.0.txt @@ -0,0 +1 @@ +355 diff --git a/codenet/public_test_cases/p03255/output.1.txt b/codenet/public_test_cases/p03255/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ce9aa7633a77c23f0bd3cd5ae5911f20092857f --- /dev/null +++ b/codenet/public_test_cases/p03255/output.1.txt @@ -0,0 +1 @@ +19999999983 diff --git a/codenet/public_test_cases/p03255/output.2.txt b/codenet/public_test_cases/p03255/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..67d31b2d27a6186bca8ae230736c7277afdfb20f --- /dev/null +++ b/codenet/public_test_cases/p03255/output.2.txt @@ -0,0 +1 @@ +3256017715 diff --git a/codenet/public_test_cases/p03255/output.3.txt b/codenet/public_test_cases/p03255/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8941db590596b8073da15204306ddb6ba40c3f0f --- /dev/null +++ b/codenet/public_test_cases/p03255/output.3.txt @@ -0,0 +1 @@ +355 diff --git a/codenet/public_test_cases/p03255/output.4.txt b/codenet/public_test_cases/p03255/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..27bdbad9b5fc16677c97e53941b8a1edccf83059 --- /dev/null +++ b/codenet/public_test_cases/p03255/output.4.txt @@ -0,0 +1 @@ +150710136 diff --git a/codenet/public_test_cases/p03256/input.0.txt b/codenet/public_test_cases/p03256/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5afbbb473d52a1b046639c3e6a68f920a46bfdb6 --- /dev/null +++ b/codenet/public_test_cases/p03256/input.0.txt @@ -0,0 +1,5 @@ +2 3 +AB +1 1 +1 2 +2 2 diff --git a/codenet/public_test_cases/p03256/input.1.txt b/codenet/public_test_cases/p03256/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ec2e708caf35b60a916d43e00d5e02db6cb096f --- /dev/null +++ b/codenet/public_test_cases/p03256/input.1.txt @@ -0,0 +1,19 @@ +13 17 +BBABBBAABABBA +7 1 +7 9 +11 12 +3 9 +11 9 +2 1 +11 5 +12 11 +10 8 +1 11 +1 8 +7 7 +9 10 +8 8 +8 12 +6 2 +13 11 diff --git a/codenet/public_test_cases/p03256/input.2.txt b/codenet/public_test_cases/p03256/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5afbbb473d52a1b046639c3e6a68f920a46bfdb6 --- /dev/null +++ b/codenet/public_test_cases/p03256/input.2.txt @@ -0,0 +1,5 @@ +2 3 +AB +1 1 +1 2 +2 2 diff --git a/codenet/public_test_cases/p03256/input.3.txt b/codenet/public_test_cases/p03256/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2905b0f8b5f70d2c45e44d6e58401fb11623be32 --- /dev/null +++ b/codenet/public_test_cases/p03256/input.3.txt @@ -0,0 +1,5 @@ +4 3 +ABAB +1 2 +2 3 +3 1 diff --git a/codenet/public_test_cases/p03256/input.4.txt b/codenet/public_test_cases/p03256/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..58780d369895c47f6e0015ab30f2567bbb2c0d94 --- /dev/null +++ b/codenet/public_test_cases/p03256/input.4.txt @@ -0,0 +1,25 @@ +13 23 +ABAAAABBBBAAB +7 1 +10 6 +1 11 +2 10 +2 8 +2 11 +11 12 +8 3 +7 12 +11 2 +13 13 +11 9 +4 1 +9 7 +9 6 +8 13 +8 6 +4 10 +8 7 +4 3 +2 1 +8 12 +6 9 diff --git a/codenet/public_test_cases/p03256/output.0.txt b/codenet/public_test_cases/p03256/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03256/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03256/output.1.txt b/codenet/public_test_cases/p03256/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03256/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03256/output.2.txt b/codenet/public_test_cases/p03256/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03256/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03256/output.3.txt b/codenet/public_test_cases/p03256/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03256/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03256/output.4.txt b/codenet/public_test_cases/p03256/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03256/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03257/input.0.txt b/codenet/public_test_cases/p03257/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03257/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03257/input.1.txt b/codenet/public_test_cases/p03257/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03257/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03257/output.0.txt b/codenet/public_test_cases/p03257/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..80f52af056daa29860f5b2d3632b58126fe6dc63 --- /dev/null +++ b/codenet/public_test_cases/p03257/output.0.txt @@ -0,0 +1,2 @@ +4 7 +23 10 diff --git a/codenet/public_test_cases/p03257/output.1.txt b/codenet/public_test_cases/p03257/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..80f52af056daa29860f5b2d3632b58126fe6dc63 --- /dev/null +++ b/codenet/public_test_cases/p03257/output.1.txt @@ -0,0 +1,2 @@ +4 7 +23 10 diff --git a/codenet/public_test_cases/p03258/input.0.txt b/codenet/public_test_cases/p03258/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d308e1d060b0c387d452cf4747f89ecb9935851 --- /dev/null +++ b/codenet/public_test_cases/p03258/input.0.txt @@ -0,0 +1 @@ +aaaa diff --git a/codenet/public_test_cases/p03258/input.1.txt b/codenet/public_test_cases/p03258/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f8d542b0a7598d47f992d480b3e48101d299b54 --- /dev/null +++ b/codenet/public_test_cases/p03258/input.1.txt @@ -0,0 +1 @@ +babbabaaba diff --git a/codenet/public_test_cases/p03258/input.2.txt b/codenet/public_test_cases/p03258/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d016a4338c4603d89fcd6bc0cace3d109b7f157b --- /dev/null +++ b/codenet/public_test_cases/p03258/input.2.txt @@ -0,0 +1 @@ +ababababa diff --git a/codenet/public_test_cases/p03258/input.3.txt b/codenet/public_test_cases/p03258/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d308e1d060b0c387d452cf4747f89ecb9935851 --- /dev/null +++ b/codenet/public_test_cases/p03258/input.3.txt @@ -0,0 +1 @@ +aaaa diff --git a/codenet/public_test_cases/p03258/input.4.txt b/codenet/public_test_cases/p03258/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf59612bf5a5d3a5d29dfd74708ba9f2318a8878 --- /dev/null +++ b/codenet/public_test_cases/p03258/input.4.txt @@ -0,0 +1 @@ +aabb diff --git a/codenet/public_test_cases/p03258/output.0.txt b/codenet/public_test_cases/p03258/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03258/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03258/output.1.txt b/codenet/public_test_cases/p03258/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f92bfdd49766b1907d4aec8d3b0f9ed6129d0e6 --- /dev/null +++ b/codenet/public_test_cases/p03258/output.1.txt @@ -0,0 +1 @@ +35 diff --git a/codenet/public_test_cases/p03258/output.2.txt b/codenet/public_test_cases/p03258/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03258/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03258/output.3.txt b/codenet/public_test_cases/p03258/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03258/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03258/output.4.txt b/codenet/public_test_cases/p03258/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03258/output.4.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03259/input.0.txt b/codenet/public_test_cases/p03259/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61d10fa3100a25a601338e9130c6191d5c408867 --- /dev/null +++ b/codenet/public_test_cases/p03259/input.0.txt @@ -0,0 +1,17 @@ +2 +3 +1 2 +2 3 +1 3 +3 2 +6 +1 2 +2 3 +3 4 +4 5 +5 6 +1 2 +2 4 +4 3 +3 5 +5 6 diff --git a/codenet/public_test_cases/p03259/input.1.txt b/codenet/public_test_cases/p03259/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6176e6457a92133d1226b973f76990aec0c2742 --- /dev/null +++ b/codenet/public_test_cases/p03259/input.1.txt @@ -0,0 +1,40 @@ +3 +8 +2 7 +4 8 +8 6 +7 1 +7 3 +5 7 +7 8 +4 2 +5 2 +1 2 +8 1 +3 2 +2 6 +2 7 +4 +1 2 +2 3 +3 4 +3 4 +2 1 +3 2 +9 +5 3 +4 3 +9 3 +6 8 +2 3 +1 3 +3 8 +1 7 +4 1 +2 8 +9 6 +3 6 +3 5 +1 8 +9 7 +1 6 diff --git a/codenet/public_test_cases/p03259/input.2.txt b/codenet/public_test_cases/p03259/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..61d10fa3100a25a601338e9130c6191d5c408867 --- /dev/null +++ b/codenet/public_test_cases/p03259/input.2.txt @@ -0,0 +1,17 @@ +2 +3 +1 2 +2 3 +1 3 +3 2 +6 +1 2 +2 3 +3 4 +4 5 +5 6 +1 2 +2 4 +4 3 +3 5 +5 6 diff --git a/codenet/public_test_cases/p03259/output.0.txt b/codenet/public_test_cases/p03259/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..94d36aad18523dd282e91587eaf1a1777fb668fc --- /dev/null +++ b/codenet/public_test_cases/p03259/output.0.txt @@ -0,0 +1,2 @@ +1 +-1 diff --git a/codenet/public_test_cases/p03259/output.1.txt b/codenet/public_test_cases/p03259/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e03ce8aed935108e03a3d2e60e3f9123ec107ff5 --- /dev/null +++ b/codenet/public_test_cases/p03259/output.1.txt @@ -0,0 +1,3 @@ +6 +0 +7 diff --git a/codenet/public_test_cases/p03259/output.2.txt b/codenet/public_test_cases/p03259/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..94d36aad18523dd282e91587eaf1a1777fb668fc --- /dev/null +++ b/codenet/public_test_cases/p03259/output.2.txt @@ -0,0 +1,2 @@ +1 +-1 diff --git a/codenet/public_test_cases/p03260/input.0.txt b/codenet/public_test_cases/p03260/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p03260/input.0.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p03260/input.1.txt b/codenet/public_test_cases/p03260/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p03260/input.1.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p03260/input.2.txt b/codenet/public_test_cases/p03260/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p03260/input.2.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p03260/input.3.txt b/codenet/public_test_cases/p03260/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03260/input.3.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03260/output.0.txt b/codenet/public_test_cases/p03260/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03260/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03260/output.1.txt b/codenet/public_test_cases/p03260/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03260/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03260/output.2.txt b/codenet/public_test_cases/p03260/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03260/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03260/output.3.txt b/codenet/public_test_cases/p03260/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03260/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03261/input.0.txt b/codenet/public_test_cases/p03261/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6ed8ba976febbacd96bd22a8302272749b4acda --- /dev/null +++ b/codenet/public_test_cases/p03261/input.0.txt @@ -0,0 +1,5 @@ +4 +hoge +english +hoge +enigma diff --git a/codenet/public_test_cases/p03261/input.1.txt b/codenet/public_test_cases/p03261/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6ed8ba976febbacd96bd22a8302272749b4acda --- /dev/null +++ b/codenet/public_test_cases/p03261/input.1.txt @@ -0,0 +1,5 @@ +4 +hoge +english +hoge +enigma diff --git a/codenet/public_test_cases/p03261/input.2.txt b/codenet/public_test_cases/p03261/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb5548533947d1709021f62a5dddaa93a73f8c2 --- /dev/null +++ b/codenet/public_test_cases/p03261/input.2.txt @@ -0,0 +1,10 @@ +9 +basic +c +cpp +php +python +nadesico +ocaml +lua +assembly diff --git a/codenet/public_test_cases/p03261/input.3.txt b/codenet/public_test_cases/p03261/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..587e9caf00cfa80fca55dd9779dfdb92e5ec0e41 --- /dev/null +++ b/codenet/public_test_cases/p03261/input.3.txt @@ -0,0 +1,4 @@ +3 +abc +arc +agc diff --git a/codenet/public_test_cases/p03261/input.4.txt b/codenet/public_test_cases/p03261/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8792d4c6103b7b8182160b972882f25e6fa33293 --- /dev/null +++ b/codenet/public_test_cases/p03261/input.4.txt @@ -0,0 +1,9 @@ +8 +a +aa +aaa +aaaa +aaaaa +aaaaaa +aaa +aaaaaaa diff --git a/codenet/public_test_cases/p03261/output.0.txt b/codenet/public_test_cases/p03261/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03261/output.0.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03261/output.1.txt b/codenet/public_test_cases/p03261/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03261/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03261/output.2.txt b/codenet/public_test_cases/p03261/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03261/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03261/output.3.txt b/codenet/public_test_cases/p03261/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03261/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03261/output.4.txt b/codenet/public_test_cases/p03261/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03261/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03262/input.0.txt b/codenet/public_test_cases/p03262/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6895a67682b917b3f2a456c681a018fa1f0bde7e --- /dev/null +++ b/codenet/public_test_cases/p03262/input.0.txt @@ -0,0 +1,2 @@ +3 3 +1 7 11 diff --git a/codenet/public_test_cases/p03262/input.1.txt b/codenet/public_test_cases/p03262/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a98e8aa79192b0c9ba4df8194daa87e0f45eea5 --- /dev/null +++ b/codenet/public_test_cases/p03262/input.1.txt @@ -0,0 +1,2 @@ +3 81 +33 105 57 diff --git a/codenet/public_test_cases/p03262/input.2.txt b/codenet/public_test_cases/p03262/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6895a67682b917b3f2a456c681a018fa1f0bde7e --- /dev/null +++ b/codenet/public_test_cases/p03262/input.2.txt @@ -0,0 +1,2 @@ +3 3 +1 7 11 diff --git a/codenet/public_test_cases/p03262/input.3.txt b/codenet/public_test_cases/p03262/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e3b5d7b0b1f0eff1b23dd98210a87fcc993b246 --- /dev/null +++ b/codenet/public_test_cases/p03262/input.3.txt @@ -0,0 +1,2 @@ +1 1 +1000000000 diff --git a/codenet/public_test_cases/p03262/output.0.txt b/codenet/public_test_cases/p03262/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03262/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03262/output.1.txt b/codenet/public_test_cases/p03262/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p03262/output.1.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p03262/output.2.txt b/codenet/public_test_cases/p03262/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03262/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03262/output.3.txt b/codenet/public_test_cases/p03262/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..28e56d983ef928848a1b0cdae1fe481ad09143a2 --- /dev/null +++ b/codenet/public_test_cases/p03262/output.3.txt @@ -0,0 +1 @@ +999999999 diff --git a/codenet/public_test_cases/p03263/input.0.txt b/codenet/public_test_cases/p03263/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf41eaa92a8329db04d0607846b8a60b3fd15516 --- /dev/null +++ b/codenet/public_test_cases/p03263/input.0.txt @@ -0,0 +1,3 @@ +2 3 +1 2 3 +0 1 1 diff --git a/codenet/public_test_cases/p03263/input.1.txt b/codenet/public_test_cases/p03263/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c502d0a29b58561705616ac98a6e9289fc904fb --- /dev/null +++ b/codenet/public_test_cases/p03263/input.1.txt @@ -0,0 +1,2 @@ +1 5 +9 9 9 9 9 diff --git a/codenet/public_test_cases/p03263/input.2.txt b/codenet/public_test_cases/p03263/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..37c888745d1cd93f63832188d1468abafc97448b --- /dev/null +++ b/codenet/public_test_cases/p03263/input.2.txt @@ -0,0 +1,4 @@ +3 2 +1 0 +2 1 +1 0 diff --git a/codenet/public_test_cases/p03263/input.3.txt b/codenet/public_test_cases/p03263/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf41eaa92a8329db04d0607846b8a60b3fd15516 --- /dev/null +++ b/codenet/public_test_cases/p03263/input.3.txt @@ -0,0 +1,3 @@ +2 3 +1 2 3 +0 1 1 diff --git a/codenet/public_test_cases/p03263/output.0.txt b/codenet/public_test_cases/p03263/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..77c122d0ab3c1b2bf09dc7569619b11492985b0c --- /dev/null +++ b/codenet/public_test_cases/p03263/output.0.txt @@ -0,0 +1,4 @@ +3 +2 2 2 3 +1 1 1 2 +1 3 1 2 diff --git a/codenet/public_test_cases/p03263/output.1.txt b/codenet/public_test_cases/p03263/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4764a9f64191876eb8c27143ec448b3ed4be4a5d --- /dev/null +++ b/codenet/public_test_cases/p03263/output.1.txt @@ -0,0 +1,3 @@ +2 +1 1 1 2 +1 3 1 4 diff --git a/codenet/public_test_cases/p03263/output.2.txt b/codenet/public_test_cases/p03263/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b035e6d14b29715f27ca00a1aea90bced62e4010 --- /dev/null +++ b/codenet/public_test_cases/p03263/output.2.txt @@ -0,0 +1,4 @@ +3 +1 1 1 2 +1 2 2 2 +3 1 3 2 diff --git a/codenet/public_test_cases/p03263/output.3.txt b/codenet/public_test_cases/p03263/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..77c122d0ab3c1b2bf09dc7569619b11492985b0c --- /dev/null +++ b/codenet/public_test_cases/p03263/output.3.txt @@ -0,0 +1,4 @@ +3 +2 2 2 3 +1 1 1 2 +1 3 1 2 diff --git a/codenet/public_test_cases/p03264/input.0.txt b/codenet/public_test_cases/p03264/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03264/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03264/input.1.txt b/codenet/public_test_cases/p03264/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03264/input.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03264/input.2.txt b/codenet/public_test_cases/p03264/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p03264/input.2.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p03264/input.3.txt b/codenet/public_test_cases/p03264/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03264/input.3.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03264/input.4.txt b/codenet/public_test_cases/p03264/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03264/input.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03264/output.0.txt b/codenet/public_test_cases/p03264/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03264/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03264/output.1.txt b/codenet/public_test_cases/p03264/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03264/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03264/output.2.txt b/codenet/public_test_cases/p03264/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..67ac2bbd74f2abf30ba6b4cb6e015e88d41e3d2d --- /dev/null +++ b/codenet/public_test_cases/p03264/output.2.txt @@ -0,0 +1 @@ +625 diff --git a/codenet/public_test_cases/p03264/output.3.txt b/codenet/public_test_cases/p03264/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03264/output.3.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03264/output.4.txt b/codenet/public_test_cases/p03264/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03264/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03265/input.0.txt b/codenet/public_test_cases/p03265/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c77a4c1a71b53d80b7a46493d7d23ca41597158a --- /dev/null +++ b/codenet/public_test_cases/p03265/input.0.txt @@ -0,0 +1 @@ +0 0 0 1 diff --git a/codenet/public_test_cases/p03265/input.1.txt b/codenet/public_test_cases/p03265/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5be5a5d3d90a68d7a6fbd8cf4906be64cfa0f6c8 --- /dev/null +++ b/codenet/public_test_cases/p03265/input.1.txt @@ -0,0 +1 @@ +2 3 6 6 diff --git a/codenet/public_test_cases/p03265/input.2.txt b/codenet/public_test_cases/p03265/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c77a4c1a71b53d80b7a46493d7d23ca41597158a --- /dev/null +++ b/codenet/public_test_cases/p03265/input.2.txt @@ -0,0 +1 @@ +0 0 0 1 diff --git a/codenet/public_test_cases/p03265/input.3.txt b/codenet/public_test_cases/p03265/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..caba57205c365e01b377c13aca554aaf7ccc698b --- /dev/null +++ b/codenet/public_test_cases/p03265/input.3.txt @@ -0,0 +1 @@ +31 -41 -59 26 diff --git a/codenet/public_test_cases/p03265/output.0.txt b/codenet/public_test_cases/p03265/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b08a5f7456c1ba76f4ccb33c962289e7bb87381c --- /dev/null +++ b/codenet/public_test_cases/p03265/output.0.txt @@ -0,0 +1 @@ +-1 1 -1 0 diff --git a/codenet/public_test_cases/p03265/output.1.txt b/codenet/public_test_cases/p03265/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a2f0995e54392946e3853333d80517bbfe3b333 --- /dev/null +++ b/codenet/public_test_cases/p03265/output.1.txt @@ -0,0 +1 @@ +3 10 -1 7 diff --git a/codenet/public_test_cases/p03265/output.2.txt b/codenet/public_test_cases/p03265/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b08a5f7456c1ba76f4ccb33c962289e7bb87381c --- /dev/null +++ b/codenet/public_test_cases/p03265/output.2.txt @@ -0,0 +1 @@ +-1 1 -1 0 diff --git a/codenet/public_test_cases/p03265/output.3.txt b/codenet/public_test_cases/p03265/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b84630dd655fd7148f9916fdd3131b64e0876fbe --- /dev/null +++ b/codenet/public_test_cases/p03265/output.3.txt @@ -0,0 +1 @@ +-126 -64 -36 -131 diff --git a/codenet/public_test_cases/p03266/input.0.txt b/codenet/public_test_cases/p03266/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03266/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03266/output.0.txt b/codenet/public_test_cases/p03266/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03266/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03267/input.0.txt b/codenet/public_test_cases/p03267/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03267/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03267/input.1.txt b/codenet/public_test_cases/p03267/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03267/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03267/input.2.txt b/codenet/public_test_cases/p03267/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03267/input.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03267/output.0.txt b/codenet/public_test_cases/p03267/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25d7a55c015c4f425e807a15c4df96d74c04c86a --- /dev/null +++ b/codenet/public_test_cases/p03267/output.0.txt @@ -0,0 +1,11 @@ +8 10 +1 2 0 +2 3 0 +3 4 0 +1 5 0 +2 6 0 +3 7 0 +4 8 0 +5 6 1 +6 7 1 +7 8 1 diff --git a/codenet/public_test_cases/p03267/output.1.txt b/codenet/public_test_cases/p03267/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..25d7a55c015c4f425e807a15c4df96d74c04c86a --- /dev/null +++ b/codenet/public_test_cases/p03267/output.1.txt @@ -0,0 +1,11 @@ +8 10 +1 2 0 +2 3 0 +3 4 0 +1 5 0 +2 6 0 +3 7 0 +4 8 0 +5 6 1 +6 7 1 +7 8 1 diff --git a/codenet/public_test_cases/p03267/output.2.txt b/codenet/public_test_cases/p03267/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74110ccfbff306bd3dea896262b5f8493ab437e6 --- /dev/null +++ b/codenet/public_test_cases/p03267/output.2.txt @@ -0,0 +1,8 @@ +5 7 +1 2 0 +2 3 1 +3 4 0 +4 5 0 +2 4 0 +1 3 3 +3 5 1 diff --git a/codenet/public_test_cases/p03268/input.0.txt b/codenet/public_test_cases/p03268/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03268/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03268/input.1.txt b/codenet/public_test_cases/p03268/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb00375829cc3c2f3a931782d3b492d206d28841 --- /dev/null +++ b/codenet/public_test_cases/p03268/input.1.txt @@ -0,0 +1 @@ +31415 9265 diff --git a/codenet/public_test_cases/p03268/input.2.txt b/codenet/public_test_cases/p03268/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03268/input.2.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03268/input.3.txt b/codenet/public_test_cases/p03268/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48034fe673f450e2a9e1d2c6c0dd2bbc76ac7210 --- /dev/null +++ b/codenet/public_test_cases/p03268/input.3.txt @@ -0,0 +1 @@ +35897 932 diff --git a/codenet/public_test_cases/p03268/input.4.txt b/codenet/public_test_cases/p03268/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303b14c866c1efcb0e7bf3ccc416e5a33d89af0 --- /dev/null +++ b/codenet/public_test_cases/p03268/input.4.txt @@ -0,0 +1 @@ +5 3 diff --git a/codenet/public_test_cases/p03268/output.0.txt b/codenet/public_test_cases/p03268/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03268/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03268/output.1.txt b/codenet/public_test_cases/p03268/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p03268/output.1.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p03268/output.2.txt b/codenet/public_test_cases/p03268/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03268/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03268/output.3.txt b/codenet/public_test_cases/p03268/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1be18efa3f7229948d055d2f42e37f41c7b91318 --- /dev/null +++ b/codenet/public_test_cases/p03268/output.3.txt @@ -0,0 +1 @@ +114191 diff --git a/codenet/public_test_cases/p03268/output.4.txt b/codenet/public_test_cases/p03268/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03268/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03269/input.0.txt b/codenet/public_test_cases/p03269/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03269/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03269/output.0.txt b/codenet/public_test_cases/p03269/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25d7a55c015c4f425e807a15c4df96d74c04c86a --- /dev/null +++ b/codenet/public_test_cases/p03269/output.0.txt @@ -0,0 +1,11 @@ +8 10 +1 2 0 +2 3 0 +3 4 0 +1 5 0 +2 6 0 +3 7 0 +4 8 0 +5 6 1 +6 7 1 +7 8 1 diff --git a/codenet/public_test_cases/p03270/input.0.txt b/codenet/public_test_cases/p03270/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p03270/input.0.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p03270/input.1.txt b/codenet/public_test_cases/p03270/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cb410637c2221881de0407452ad0e4382a728a8 --- /dev/null +++ b/codenet/public_test_cases/p03270/input.1.txt @@ -0,0 +1 @@ +6 1000 diff --git a/codenet/public_test_cases/p03270/input.2.txt b/codenet/public_test_cases/p03270/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p03270/input.2.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p03270/input.3.txt b/codenet/public_test_cases/p03270/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a99162ed9cdd1b90006cbd4f07e2a2bd3f404d4 --- /dev/null +++ b/codenet/public_test_cases/p03270/input.3.txt @@ -0,0 +1 @@ +4 5 diff --git a/codenet/public_test_cases/p03270/output.0.txt b/codenet/public_test_cases/p03270/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d9b69d0ddc88f2df1d93d52b1cfdbed00a4124d --- /dev/null +++ b/codenet/public_test_cases/p03270/output.0.txt @@ -0,0 +1,5 @@ +7 +7 +4 +7 +7 diff --git a/codenet/public_test_cases/p03270/output.1.txt b/codenet/public_test_cases/p03270/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e26dea21dac05ac49d2197a85480312fc3526d0 --- /dev/null +++ b/codenet/public_test_cases/p03270/output.1.txt @@ -0,0 +1,11 @@ +149393349 +149393349 +668669001 +668669001 +4000002 +4000002 +4000002 +668669001 +668669001 +149393349 +149393349 diff --git a/codenet/public_test_cases/p03270/output.2.txt b/codenet/public_test_cases/p03270/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d9b69d0ddc88f2df1d93d52b1cfdbed00a4124d --- /dev/null +++ b/codenet/public_test_cases/p03270/output.2.txt @@ -0,0 +1,5 @@ +7 +7 +4 +7 +7 diff --git a/codenet/public_test_cases/p03270/output.3.txt b/codenet/public_test_cases/p03270/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b455ff2421ca2ca95aa47a2bcc06c4a9454fb3d0 --- /dev/null +++ b/codenet/public_test_cases/p03270/output.3.txt @@ -0,0 +1,7 @@ +36 +36 +20 +20 +20 +36 +36 diff --git a/codenet/public_test_cases/p03271/input.0.txt b/codenet/public_test_cases/p03271/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a7c751d92fd1fb7845022a03fb01e7fc58c4da0 --- /dev/null +++ b/codenet/public_test_cases/p03271/input.0.txt @@ -0,0 +1,6 @@ +5 +5 +2 +1 +4 +3 diff --git a/codenet/public_test_cases/p03271/input.1.txt b/codenet/public_test_cases/p03271/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f86d5d040d25ccd261a44378d0e55c3e09b66a7 --- /dev/null +++ b/codenet/public_test_cases/p03271/input.1.txt @@ -0,0 +1,7 @@ +6 +5 +3 +4 +1 +2 +6 diff --git a/codenet/public_test_cases/p03271/input.2.txt b/codenet/public_test_cases/p03271/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a7c751d92fd1fb7845022a03fb01e7fc58c4da0 --- /dev/null +++ b/codenet/public_test_cases/p03271/input.2.txt @@ -0,0 +1,6 @@ +5 +5 +2 +1 +4 +3 diff --git a/codenet/public_test_cases/p03271/input.3.txt b/codenet/public_test_cases/p03271/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..385526b27aee1f59bd5f8ce1da5b927d659665b4 --- /dev/null +++ b/codenet/public_test_cases/p03271/input.3.txt @@ -0,0 +1,5 @@ +4 +3 +2 +4 +1 diff --git a/codenet/public_test_cases/p03271/input.4.txt b/codenet/public_test_cases/p03271/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..75e9b2de108fedfb2eed869722757157d7310b04 --- /dev/null +++ b/codenet/public_test_cases/p03271/input.4.txt @@ -0,0 +1,8 @@ +7 +3 +2 +1 +6 +5 +4 +7 diff --git a/codenet/public_test_cases/p03271/output.0.txt b/codenet/public_test_cases/p03271/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03271/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03271/output.1.txt b/codenet/public_test_cases/p03271/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03271/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03271/output.2.txt b/codenet/public_test_cases/p03271/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03271/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03271/output.3.txt b/codenet/public_test_cases/p03271/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03271/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03271/output.4.txt b/codenet/public_test_cases/p03271/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03271/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03272/input.0.txt b/codenet/public_test_cases/p03272/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..805e7f5a05abb0767d277398dd810d64910d282f --- /dev/null +++ b/codenet/public_test_cases/p03272/input.0.txt @@ -0,0 +1 @@ +4 2 diff --git a/codenet/public_test_cases/p03272/input.1.txt b/codenet/public_test_cases/p03272/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03272/input.1.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03272/input.2.txt b/codenet/public_test_cases/p03272/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..805e7f5a05abb0767d277398dd810d64910d282f --- /dev/null +++ b/codenet/public_test_cases/p03272/input.2.txt @@ -0,0 +1 @@ +4 2 diff --git a/codenet/public_test_cases/p03272/input.3.txt b/codenet/public_test_cases/p03272/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ae60938e9cd7dd0e804c0dd31fa44609008166f --- /dev/null +++ b/codenet/public_test_cases/p03272/input.3.txt @@ -0,0 +1 @@ +15 11 diff --git a/codenet/public_test_cases/p03272/output.0.txt b/codenet/public_test_cases/p03272/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03272/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03272/output.1.txt b/codenet/public_test_cases/p03272/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03272/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03272/output.2.txt b/codenet/public_test_cases/p03272/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03272/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03272/output.3.txt b/codenet/public_test_cases/p03272/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03272/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03273/input.0.txt b/codenet/public_test_cases/p03273/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..35aa0e983f90aaccdf9a048ae78fe2664aeaca0b --- /dev/null +++ b/codenet/public_test_cases/p03273/input.0.txt @@ -0,0 +1,5 @@ +4 4 +##.# +.... +##.# +.#.# diff --git a/codenet/public_test_cases/p03273/input.1.txt b/codenet/public_test_cases/p03273/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..35aa0e983f90aaccdf9a048ae78fe2664aeaca0b --- /dev/null +++ b/codenet/public_test_cases/p03273/input.1.txt @@ -0,0 +1,5 @@ +4 4 +##.# +.... +##.# +.#.# diff --git a/codenet/public_test_cases/p03273/input.2.txt b/codenet/public_test_cases/p03273/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6f6f90c5d0c961c4d7156da1c143e4c73dce616 --- /dev/null +++ b/codenet/public_test_cases/p03273/input.2.txt @@ -0,0 +1,5 @@ +4 5 +..... +..... +..#.. +..... diff --git a/codenet/public_test_cases/p03273/input.3.txt b/codenet/public_test_cases/p03273/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..42ac522da2c2699cdd088e875a79f7b7cf81b0f0 --- /dev/null +++ b/codenet/public_test_cases/p03273/input.3.txt @@ -0,0 +1,8 @@ +7 6 +...... +....#. +.#.... +..#... +..#... +...... +.#..#. diff --git a/codenet/public_test_cases/p03273/input.4.txt b/codenet/public_test_cases/p03273/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..99cfd809d19cf1152364a4d5a126b8ac68f3b9cb --- /dev/null +++ b/codenet/public_test_cases/p03273/input.4.txt @@ -0,0 +1,5 @@ +4 4 +.# +.... +.# +.#.# diff --git a/codenet/public_test_cases/p03273/input.5.txt b/codenet/public_test_cases/p03273/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0640e6df5d9c2374ec2d9d242a01fdff1d9dfaaf --- /dev/null +++ b/codenet/public_test_cases/p03273/input.5.txt @@ -0,0 +1,4 @@ +3 3 +.. +.#. +..# diff --git a/codenet/public_test_cases/p03273/output.0.txt b/codenet/public_test_cases/p03273/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..216ba4355db62d1d9eff752bc2ede94e334ff1e4 --- /dev/null +++ b/codenet/public_test_cases/p03273/output.0.txt @@ -0,0 +1,3 @@ +### +### +.## diff --git a/codenet/public_test_cases/p03273/output.1.txt b/codenet/public_test_cases/p03273/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..216ba4355db62d1d9eff752bc2ede94e334ff1e4 --- /dev/null +++ b/codenet/public_test_cases/p03273/output.1.txt @@ -0,0 +1,3 @@ +### +### +.## diff --git a/codenet/public_test_cases/p03273/output.2.txt b/codenet/public_test_cases/p03273/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p03273/output.2.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p03273/output.3.txt b/codenet/public_test_cases/p03273/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f26aad17e1acf6fd4c93a96d060cf8df1793bfc1 --- /dev/null +++ b/codenet/public_test_cases/p03273/output.3.txt @@ -0,0 +1,5 @@ +..# +.. +.#. +.#. +.# diff --git a/codenet/public_test_cases/p03273/output.4.txt b/codenet/public_test_cases/p03273/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae46755bf836e3668fe8433562c5ac06e808e3df --- /dev/null +++ b/codenet/public_test_cases/p03273/output.4.txt @@ -0,0 +1 @@ +.## diff --git a/codenet/public_test_cases/p03273/output.5.txt b/codenet/public_test_cases/p03273/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..8529be8b9aa9707e2801c8a70e6394e04296a072 --- /dev/null +++ b/codenet/public_test_cases/p03273/output.5.txt @@ -0,0 +1,3 @@ +.. +.#. +..# diff --git a/codenet/public_test_cases/p03274/input.0.txt b/codenet/public_test_cases/p03274/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6de14fc19e7a0fbae57adb4ad982612452747000 --- /dev/null +++ b/codenet/public_test_cases/p03274/input.0.txt @@ -0,0 +1,2 @@ +5 3 +-30 -10 10 20 50 diff --git a/codenet/public_test_cases/p03274/input.1.txt b/codenet/public_test_cases/p03274/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..100fd1837bd53ffe52ef7f896d97232a969a3922 --- /dev/null +++ b/codenet/public_test_cases/p03274/input.1.txt @@ -0,0 +1,2 @@ +8 5 +-9 -7 -4 -3 1 2 3 4 diff --git a/codenet/public_test_cases/p03274/input.2.txt b/codenet/public_test_cases/p03274/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6de14fc19e7a0fbae57adb4ad982612452747000 --- /dev/null +++ b/codenet/public_test_cases/p03274/input.2.txt @@ -0,0 +1,2 @@ +5 3 +-30 -10 10 20 50 diff --git a/codenet/public_test_cases/p03274/input.3.txt b/codenet/public_test_cases/p03274/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b774dab2b2a8a99b5977390fb9d06e6fcaae52e --- /dev/null +++ b/codenet/public_test_cases/p03274/input.3.txt @@ -0,0 +1,2 @@ +1 1 +0 diff --git a/codenet/public_test_cases/p03274/input.4.txt b/codenet/public_test_cases/p03274/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a790d83455edf9b2819cf6cc2ff1ba939e3d5a6e --- /dev/null +++ b/codenet/public_test_cases/p03274/input.4.txt @@ -0,0 +1,2 @@ +3 2 +10 20 30 diff --git a/codenet/public_test_cases/p03274/output.0.txt b/codenet/public_test_cases/p03274/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03274/output.0.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03274/output.1.txt b/codenet/public_test_cases/p03274/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03274/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03274/output.2.txt b/codenet/public_test_cases/p03274/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03274/output.2.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03274/output.3.txt b/codenet/public_test_cases/p03274/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03274/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03274/output.4.txt b/codenet/public_test_cases/p03274/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03274/output.4.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03275/input.0.txt b/codenet/public_test_cases/p03275/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..834b3db2b7687e668082d218c619aab173dc42f6 --- /dev/null +++ b/codenet/public_test_cases/p03275/input.0.txt @@ -0,0 +1,2 @@ +3 +10 30 20 diff --git a/codenet/public_test_cases/p03275/input.1.txt b/codenet/public_test_cases/p03275/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..834b3db2b7687e668082d218c619aab173dc42f6 --- /dev/null +++ b/codenet/public_test_cases/p03275/input.1.txt @@ -0,0 +1,2 @@ +3 +10 30 20 diff --git a/codenet/public_test_cases/p03275/input.2.txt b/codenet/public_test_cases/p03275/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c65e8819a54924e723e228c8b271e4045243296 --- /dev/null +++ b/codenet/public_test_cases/p03275/input.2.txt @@ -0,0 +1,2 @@ +10 +5 9 5 9 8 9 3 5 4 3 diff --git a/codenet/public_test_cases/p03275/input.3.txt b/codenet/public_test_cases/p03275/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b258dc3d8a70dfd158dac8e5a6905f41cadd45f4 --- /dev/null +++ b/codenet/public_test_cases/p03275/input.3.txt @@ -0,0 +1,2 @@ +1 +10 diff --git a/codenet/public_test_cases/p03275/output.0.txt b/codenet/public_test_cases/p03275/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03275/output.0.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03275/output.1.txt b/codenet/public_test_cases/p03275/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03275/output.1.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03275/output.2.txt b/codenet/public_test_cases/p03275/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03275/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03275/output.3.txt b/codenet/public_test_cases/p03275/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03275/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03276/input.0.txt b/codenet/public_test_cases/p03276/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6de14fc19e7a0fbae57adb4ad982612452747000 --- /dev/null +++ b/codenet/public_test_cases/p03276/input.0.txt @@ -0,0 +1,2 @@ +5 3 +-30 -10 10 20 50 diff --git a/codenet/public_test_cases/p03276/output.0.txt b/codenet/public_test_cases/p03276/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03276/output.0.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03277/input.0.txt b/codenet/public_test_cases/p03277/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..834b3db2b7687e668082d218c619aab173dc42f6 --- /dev/null +++ b/codenet/public_test_cases/p03277/input.0.txt @@ -0,0 +1,2 @@ +3 +10 30 20 diff --git a/codenet/public_test_cases/p03277/output.0.txt b/codenet/public_test_cases/p03277/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03277/output.0.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03278/input.0.txt b/codenet/public_test_cases/p03278/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..604c7b32caf077c090d1e568da712399ae45734a --- /dev/null +++ b/codenet/public_test_cases/p03278/input.0.txt @@ -0,0 +1,4 @@ +4 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p03278/input.1.txt b/codenet/public_test_cases/p03278/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..604c7b32caf077c090d1e568da712399ae45734a --- /dev/null +++ b/codenet/public_test_cases/p03278/input.1.txt @@ -0,0 +1,4 @@ +4 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p03278/input.2.txt b/codenet/public_test_cases/p03278/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcd5f8768c2971106a5490b3aa4336a3f2498e1a --- /dev/null +++ b/codenet/public_test_cases/p03278/input.2.txt @@ -0,0 +1,6 @@ +6 +1 2 +1 3 +3 4 +1 5 +5 6 diff --git a/codenet/public_test_cases/p03278/input.3.txt b/codenet/public_test_cases/p03278/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4834d4e23a86db13492ec18b6c68bba11132751a --- /dev/null +++ b/codenet/public_test_cases/p03278/input.3.txt @@ -0,0 +1,10 @@ +10 +8 5 +10 8 +6 5 +1 5 +4 8 +2 10 +3 6 +9 2 +1 7 diff --git a/codenet/public_test_cases/p03278/input.4.txt b/codenet/public_test_cases/p03278/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e7e919d9086f19d0faf1800efb363a22b6e6b8 --- /dev/null +++ b/codenet/public_test_cases/p03278/input.4.txt @@ -0,0 +1,4 @@ +4 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p03278/output.0.txt b/codenet/public_test_cases/p03278/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03278/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03278/output.1.txt b/codenet/public_test_cases/p03278/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03278/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03278/output.2.txt b/codenet/public_test_cases/p03278/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03278/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03278/output.3.txt b/codenet/public_test_cases/p03278/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..04226cf3c1192917de4b3144af9b9d14977370ce --- /dev/null +++ b/codenet/public_test_cases/p03278/output.3.txt @@ -0,0 +1 @@ +672 diff --git a/codenet/public_test_cases/p03278/output.4.txt b/codenet/public_test_cases/p03278/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03278/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03279/input.0.txt b/codenet/public_test_cases/p03279/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b94335e4b34dafeb72f2f7ceb937364f5994347 --- /dev/null +++ b/codenet/public_test_cases/p03279/input.0.txt @@ -0,0 +1,3 @@ +2 2 +2 3 +1 4 diff --git a/codenet/public_test_cases/p03279/input.1.txt b/codenet/public_test_cases/p03279/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..30b69f42049b050df927913cf95ad4f607a0697c --- /dev/null +++ b/codenet/public_test_cases/p03279/input.1.txt @@ -0,0 +1,3 @@ +4 1 +1 2 4 5 +3 diff --git a/codenet/public_test_cases/p03279/input.2.txt b/codenet/public_test_cases/p03279/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b8269a58abf4ebc2cec18b8768d5d8c0ed198d6 --- /dev/null +++ b/codenet/public_test_cases/p03279/input.2.txt @@ -0,0 +1,3 @@ +4 5 +2 5 7 11 +1 3 6 9 13 diff --git a/codenet/public_test_cases/p03279/input.3.txt b/codenet/public_test_cases/p03279/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..40c4d0ffacd8a395973bc518e0522744353ab4ff --- /dev/null +++ b/codenet/public_test_cases/p03279/input.3.txt @@ -0,0 +1,3 @@ +10 10 +4 13 15 18 19 20 21 22 25 27 +1 5 11 12 14 16 23 26 29 30 diff --git a/codenet/public_test_cases/p03279/input.4.txt b/codenet/public_test_cases/p03279/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..25ea2ad2c008bd3ac9d87c0ec44da1414c49ba9c --- /dev/null +++ b/codenet/public_test_cases/p03279/input.4.txt @@ -0,0 +1,3 @@ +3 4 +2 5 10 +1 3 7 13 diff --git a/codenet/public_test_cases/p03279/input.5.txt b/codenet/public_test_cases/p03279/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b94335e4b34dafeb72f2f7ceb937364f5994347 --- /dev/null +++ b/codenet/public_test_cases/p03279/input.5.txt @@ -0,0 +1,3 @@ +2 2 +2 3 +1 4 diff --git a/codenet/public_test_cases/p03279/output.0.txt b/codenet/public_test_cases/p03279/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03279/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03279/output.1.txt b/codenet/public_test_cases/p03279/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03279/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03279/output.2.txt b/codenet/public_test_cases/p03279/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03279/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03279/output.3.txt b/codenet/public_test_cases/p03279/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03279/output.3.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03279/output.4.txt b/codenet/public_test_cases/p03279/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03279/output.4.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03279/output.5.txt b/codenet/public_test_cases/p03279/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03279/output.5.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03280/input.0.txt b/codenet/public_test_cases/p03280/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03280/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03280/input.1.txt b/codenet/public_test_cases/p03280/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..149a6b3213f3e0a3e12ea4aac0776d890ff8b3e6 --- /dev/null +++ b/codenet/public_test_cases/p03280/input.1.txt @@ -0,0 +1 @@ +5 7 diff --git a/codenet/public_test_cases/p03280/input.2.txt b/codenet/public_test_cases/p03280/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03280/input.2.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03280/output.0.txt b/codenet/public_test_cases/p03280/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03280/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03280/output.1.txt b/codenet/public_test_cases/p03280/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a45fd52cc5891570d6299fab38643103c3955474 --- /dev/null +++ b/codenet/public_test_cases/p03280/output.1.txt @@ -0,0 +1 @@ +24 diff --git a/codenet/public_test_cases/p03280/output.2.txt b/codenet/public_test_cases/p03280/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03280/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03281/input.0.txt b/codenet/public_test_cases/p03281/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f96ac06721837aa6a644a580c03c76f304e81db0 --- /dev/null +++ b/codenet/public_test_cases/p03281/input.0.txt @@ -0,0 +1 @@ +105 diff --git a/codenet/public_test_cases/p03281/input.1.txt b/codenet/public_test_cases/p03281/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f96ac06721837aa6a644a580c03c76f304e81db0 --- /dev/null +++ b/codenet/public_test_cases/p03281/input.1.txt @@ -0,0 +1 @@ +105 diff --git a/codenet/public_test_cases/p03281/input.2.txt b/codenet/public_test_cases/p03281/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03281/input.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03281/output.0.txt b/codenet/public_test_cases/p03281/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03281/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03281/output.1.txt b/codenet/public_test_cases/p03281/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03281/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03281/output.2.txt b/codenet/public_test_cases/p03281/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03281/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03282/input.0.txt b/codenet/public_test_cases/p03282/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ec6a831352a878f10fbff1a2e8c37d0ce2171eb --- /dev/null +++ b/codenet/public_test_cases/p03282/input.0.txt @@ -0,0 +1,2 @@ +1214 +4 diff --git a/codenet/public_test_cases/p03282/input.1.txt b/codenet/public_test_cases/p03282/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a4d9d76dd89878ccd357ad7d39797920117fc8d --- /dev/null +++ b/codenet/public_test_cases/p03282/input.1.txt @@ -0,0 +1,2 @@ +299792458 +9460730472580800 diff --git a/codenet/public_test_cases/p03282/input.2.txt b/codenet/public_test_cases/p03282/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b55cf2c5b1591536ac996c1b5e1cb3317aa8dee --- /dev/null +++ b/codenet/public_test_cases/p03282/input.2.txt @@ -0,0 +1,2 @@ +3 +157 diff --git a/codenet/public_test_cases/p03282/input.3.txt b/codenet/public_test_cases/p03282/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ec6a831352a878f10fbff1a2e8c37d0ce2171eb --- /dev/null +++ b/codenet/public_test_cases/p03282/input.3.txt @@ -0,0 +1,2 @@ +1214 +4 diff --git a/codenet/public_test_cases/p03282/output.0.txt b/codenet/public_test_cases/p03282/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03282/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03282/output.1.txt b/codenet/public_test_cases/p03282/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03282/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03282/output.2.txt b/codenet/public_test_cases/p03282/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03282/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03282/output.3.txt b/codenet/public_test_cases/p03282/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03282/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03283/input.0.txt b/codenet/public_test_cases/p03283/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..36d429f4e17d750c70f356ca9fc5468222e3e172 --- /dev/null +++ b/codenet/public_test_cases/p03283/input.0.txt @@ -0,0 +1,5 @@ +2 3 1 +1 1 +1 2 +2 2 +1 2 diff --git a/codenet/public_test_cases/p03283/input.1.txt b/codenet/public_test_cases/p03283/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce339168838dae8341742e81b9d9a99d54b9afcf --- /dev/null +++ b/codenet/public_test_cases/p03283/input.1.txt @@ -0,0 +1,6 @@ +10 3 2 +1 5 +2 8 +7 10 +1 7 +3 10 diff --git a/codenet/public_test_cases/p03283/input.2.txt b/codenet/public_test_cases/p03283/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..36d429f4e17d750c70f356ca9fc5468222e3e172 --- /dev/null +++ b/codenet/public_test_cases/p03283/input.2.txt @@ -0,0 +1,5 @@ +2 3 1 +1 1 +1 2 +2 2 +1 2 diff --git a/codenet/public_test_cases/p03283/input.3.txt b/codenet/public_test_cases/p03283/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a3640814d29f050b9ca4a336470595233e3f264 --- /dev/null +++ b/codenet/public_test_cases/p03283/input.3.txt @@ -0,0 +1,21 @@ +10 10 10 +1 6 +2 9 +4 5 +4 7 +4 7 +5 8 +6 6 +6 7 +7 9 +10 10 +1 8 +1 9 +1 10 +2 8 +2 9 +2 10 +3 8 +3 9 +3 10 +1 10 diff --git a/codenet/public_test_cases/p03283/output.0.txt b/codenet/public_test_cases/p03283/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03283/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03283/output.1.txt b/codenet/public_test_cases/p03283/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p03283/output.1.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p03283/output.2.txt b/codenet/public_test_cases/p03283/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03283/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03283/output.3.txt b/codenet/public_test_cases/p03283/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..84102c612bcba4e23836f4ce06f0c95896040086 --- /dev/null +++ b/codenet/public_test_cases/p03283/output.3.txt @@ -0,0 +1,10 @@ +7 +9 +10 +6 +8 +9 +6 +7 +8 +10 diff --git a/codenet/public_test_cases/p03284/input.0.txt b/codenet/public_test_cases/p03284/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f036e7ba038ea9020e90a29f669ac3db830dd66 --- /dev/null +++ b/codenet/public_test_cases/p03284/input.0.txt @@ -0,0 +1 @@ +7 3 diff --git a/codenet/public_test_cases/p03284/input.1.txt b/codenet/public_test_cases/p03284/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..25c77a97862a6257b5c9264d0924066cd74d4048 --- /dev/null +++ b/codenet/public_test_cases/p03284/input.1.txt @@ -0,0 +1 @@ +100 10 diff --git a/codenet/public_test_cases/p03284/input.2.txt b/codenet/public_test_cases/p03284/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03284/input.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03284/input.3.txt b/codenet/public_test_cases/p03284/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f036e7ba038ea9020e90a29f669ac3db830dd66 --- /dev/null +++ b/codenet/public_test_cases/p03284/input.3.txt @@ -0,0 +1 @@ +7 3 diff --git a/codenet/public_test_cases/p03284/output.0.txt b/codenet/public_test_cases/p03284/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03284/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03284/output.1.txt b/codenet/public_test_cases/p03284/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03284/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03284/output.2.txt b/codenet/public_test_cases/p03284/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03284/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03284/output.3.txt b/codenet/public_test_cases/p03284/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03284/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03285/input.0.txt b/codenet/public_test_cases/p03285/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03285/input.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03285/input.1.txt b/codenet/public_test_cases/p03285/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03285/input.1.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03285/input.2.txt b/codenet/public_test_cases/p03285/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03285/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03285/input.3.txt b/codenet/public_test_cases/p03285/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03285/input.3.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03285/output.0.txt b/codenet/public_test_cases/p03285/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03285/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03285/output.1.txt b/codenet/public_test_cases/p03285/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03285/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03285/output.2.txt b/codenet/public_test_cases/p03285/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03285/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03285/output.3.txt b/codenet/public_test_cases/p03285/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03285/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03286/input.0.txt b/codenet/public_test_cases/p03286/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dc3a6a50cf6fecb08f7b1b2930ea5072247e819 --- /dev/null +++ b/codenet/public_test_cases/p03286/input.0.txt @@ -0,0 +1 @@ +-9 diff --git a/codenet/public_test_cases/p03286/input.1.txt b/codenet/public_test_cases/p03286/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03286/input.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03286/input.2.txt b/codenet/public_test_cases/p03286/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..28d14454c380441fa2b6f562072a1cd641c06e22 --- /dev/null +++ b/codenet/public_test_cases/p03286/input.2.txt @@ -0,0 +1 @@ +123456789 diff --git a/codenet/public_test_cases/p03286/input.3.txt b/codenet/public_test_cases/p03286/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dc3a6a50cf6fecb08f7b1b2930ea5072247e819 --- /dev/null +++ b/codenet/public_test_cases/p03286/input.3.txt @@ -0,0 +1 @@ +-9 diff --git a/codenet/public_test_cases/p03286/output.0.txt b/codenet/public_test_cases/p03286/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d488f1cf42ed17aae3ba8c1b2aa6d97716a44fa8 --- /dev/null +++ b/codenet/public_test_cases/p03286/output.0.txt @@ -0,0 +1 @@ +1011 diff --git a/codenet/public_test_cases/p03286/output.1.txt b/codenet/public_test_cases/p03286/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03286/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03286/output.2.txt b/codenet/public_test_cases/p03286/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..67e1485eb3e71c6688969b39bd226db0176b46fd --- /dev/null +++ b/codenet/public_test_cases/p03286/output.2.txt @@ -0,0 +1 @@ +11000101011001101110100010101 diff --git a/codenet/public_test_cases/p03286/output.3.txt b/codenet/public_test_cases/p03286/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d488f1cf42ed17aae3ba8c1b2aa6d97716a44fa8 --- /dev/null +++ b/codenet/public_test_cases/p03286/output.3.txt @@ -0,0 +1 @@ +1011 diff --git a/codenet/public_test_cases/p03287/input.0.txt b/codenet/public_test_cases/p03287/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6140a86bee72ec625dca1db11d4cabcb92614640 --- /dev/null +++ b/codenet/public_test_cases/p03287/input.0.txt @@ -0,0 +1,2 @@ +3 2 +4 1 5 diff --git a/codenet/public_test_cases/p03287/input.1.txt b/codenet/public_test_cases/p03287/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af10b530d571d38f0d809a1a437313f5bdf3ed69 --- /dev/null +++ b/codenet/public_test_cases/p03287/input.1.txt @@ -0,0 +1,2 @@ +10 400000000 +1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 diff --git a/codenet/public_test_cases/p03287/input.2.txt b/codenet/public_test_cases/p03287/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b2a3d1802e1d3f1b04ed26e160eba87459ec78b --- /dev/null +++ b/codenet/public_test_cases/p03287/input.2.txt @@ -0,0 +1,2 @@ +13 17 +29 7 5 7 9 51 7 13 8 55 42 9 81 diff --git a/codenet/public_test_cases/p03287/input.3.txt b/codenet/public_test_cases/p03287/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6140a86bee72ec625dca1db11d4cabcb92614640 --- /dev/null +++ b/codenet/public_test_cases/p03287/input.3.txt @@ -0,0 +1,2 @@ +3 2 +4 1 5 diff --git a/codenet/public_test_cases/p03287/output.0.txt b/codenet/public_test_cases/p03287/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03287/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03287/output.1.txt b/codenet/public_test_cases/p03287/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p03287/output.1.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p03287/output.2.txt b/codenet/public_test_cases/p03287/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03287/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03287/output.3.txt b/codenet/public_test_cases/p03287/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03287/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03288/input.0.txt b/codenet/public_test_cases/p03288/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad9544af516023c6c556bb08efdd244bb0c680ca --- /dev/null +++ b/codenet/public_test_cases/p03288/input.0.txt @@ -0,0 +1 @@ +1199 diff --git a/codenet/public_test_cases/p03288/input.1.txt b/codenet/public_test_cases/p03288/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad9544af516023c6c556bb08efdd244bb0c680ca --- /dev/null +++ b/codenet/public_test_cases/p03288/input.1.txt @@ -0,0 +1 @@ +1199 diff --git a/codenet/public_test_cases/p03288/input.2.txt b/codenet/public_test_cases/p03288/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..59a3ec59b53573619be25381cf973b173e2a60ba --- /dev/null +++ b/codenet/public_test_cases/p03288/input.2.txt @@ -0,0 +1 @@ +1200 diff --git a/codenet/public_test_cases/p03288/input.3.txt b/codenet/public_test_cases/p03288/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f12704884a5dd412be31c4c3add769089e82a52 --- /dev/null +++ b/codenet/public_test_cases/p03288/input.3.txt @@ -0,0 +1 @@ +4208 diff --git a/codenet/public_test_cases/p03288/output.0.txt b/codenet/public_test_cases/p03288/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p03288/output.0.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p03288/output.1.txt b/codenet/public_test_cases/p03288/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p03288/output.1.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p03288/output.2.txt b/codenet/public_test_cases/p03288/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c4fba4f9ae03ed0aeddbb3fe0ff90f5684e90bb --- /dev/null +++ b/codenet/public_test_cases/p03288/output.2.txt @@ -0,0 +1 @@ +ARC diff --git a/codenet/public_test_cases/p03288/output.3.txt b/codenet/public_test_cases/p03288/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8be9c4a48148b79b1f03180cb484dd3c476e2cd0 --- /dev/null +++ b/codenet/public_test_cases/p03288/output.3.txt @@ -0,0 +1 @@ +AGC diff --git a/codenet/public_test_cases/p03289/input.0.txt b/codenet/public_test_cases/p03289/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0084c2f125d7e9d5107f0435a1f8a54e5a9b1b22 --- /dev/null +++ b/codenet/public_test_cases/p03289/input.0.txt @@ -0,0 +1 @@ +AtCoder diff --git a/codenet/public_test_cases/p03289/input.1.txt b/codenet/public_test_cases/p03289/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c55d14505dae2268b791c751a86cc4b2aee277d --- /dev/null +++ b/codenet/public_test_cases/p03289/input.1.txt @@ -0,0 +1 @@ +AtCoCo diff --git a/codenet/public_test_cases/p03289/input.2.txt b/codenet/public_test_cases/p03289/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab4d15ea248944af06c832bef7274b12b2472c5f --- /dev/null +++ b/codenet/public_test_cases/p03289/input.2.txt @@ -0,0 +1 @@ +Atcoder diff --git a/codenet/public_test_cases/p03289/input.3.txt b/codenet/public_test_cases/p03289/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..baa0f86a0af349c4b8023b33329162c4bd794fc8 --- /dev/null +++ b/codenet/public_test_cases/p03289/input.3.txt @@ -0,0 +1 @@ +ACoder diff --git a/codenet/public_test_cases/p03289/input.4.txt b/codenet/public_test_cases/p03289/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..849d6c6ee854b79b4e8c3da8633fabf7bdc5158d --- /dev/null +++ b/codenet/public_test_cases/p03289/input.4.txt @@ -0,0 +1 @@ +AcycliC diff --git a/codenet/public_test_cases/p03289/input.5.txt b/codenet/public_test_cases/p03289/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0084c2f125d7e9d5107f0435a1f8a54e5a9b1b22 --- /dev/null +++ b/codenet/public_test_cases/p03289/input.5.txt @@ -0,0 +1 @@ +AtCoder diff --git a/codenet/public_test_cases/p03289/output.0.txt b/codenet/public_test_cases/p03289/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdd343bb8efd735e092defa5f1c0dd3d16e8ca0a --- /dev/null +++ b/codenet/public_test_cases/p03289/output.0.txt @@ -0,0 +1 @@ +AC diff --git a/codenet/public_test_cases/p03289/output.1.txt b/codenet/public_test_cases/p03289/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd9f23b7f8166772c0ddb18beccb83e328dae16f --- /dev/null +++ b/codenet/public_test_cases/p03289/output.1.txt @@ -0,0 +1 @@ +WA diff --git a/codenet/public_test_cases/p03289/output.2.txt b/codenet/public_test_cases/p03289/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd9f23b7f8166772c0ddb18beccb83e328dae16f --- /dev/null +++ b/codenet/public_test_cases/p03289/output.2.txt @@ -0,0 +1 @@ +WA diff --git a/codenet/public_test_cases/p03289/output.3.txt b/codenet/public_test_cases/p03289/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd9f23b7f8166772c0ddb18beccb83e328dae16f --- /dev/null +++ b/codenet/public_test_cases/p03289/output.3.txt @@ -0,0 +1 @@ +WA diff --git a/codenet/public_test_cases/p03289/output.4.txt b/codenet/public_test_cases/p03289/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd9f23b7f8166772c0ddb18beccb83e328dae16f --- /dev/null +++ b/codenet/public_test_cases/p03289/output.4.txt @@ -0,0 +1 @@ +WA diff --git a/codenet/public_test_cases/p03289/output.5.txt b/codenet/public_test_cases/p03289/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdd343bb8efd735e092defa5f1c0dd3d16e8ca0a --- /dev/null +++ b/codenet/public_test_cases/p03289/output.5.txt @@ -0,0 +1 @@ +AC diff --git a/codenet/public_test_cases/p03290/input.0.txt b/codenet/public_test_cases/p03290/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5be5722aada91e01050649c7323372644569165e --- /dev/null +++ b/codenet/public_test_cases/p03290/input.0.txt @@ -0,0 +1,3 @@ +2 700 +3 500 +5 800 diff --git a/codenet/public_test_cases/p03290/input.1.txt b/codenet/public_test_cases/p03290/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8a68961f15f1938279c20249b4c2ccac47b3c3a --- /dev/null +++ b/codenet/public_test_cases/p03290/input.1.txt @@ -0,0 +1,6 @@ +5 25000 +20 1000 +40 1000 +50 1000 +30 1000 +1 1000 diff --git a/codenet/public_test_cases/p03290/input.2.txt b/codenet/public_test_cases/p03290/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1c203782044a056525d44941bc17106ad371ace --- /dev/null +++ b/codenet/public_test_cases/p03290/input.2.txt @@ -0,0 +1,3 @@ +2 400 +3 500 +5 800 diff --git a/codenet/public_test_cases/p03290/input.3.txt b/codenet/public_test_cases/p03290/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5be5722aada91e01050649c7323372644569165e --- /dev/null +++ b/codenet/public_test_cases/p03290/input.3.txt @@ -0,0 +1,3 @@ +2 700 +3 500 +5 800 diff --git a/codenet/public_test_cases/p03290/input.4.txt b/codenet/public_test_cases/p03290/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..62bf3db4ec3166b3038a2494b4ff57054f1e2b3e --- /dev/null +++ b/codenet/public_test_cases/p03290/input.4.txt @@ -0,0 +1,3 @@ +2 2000 +3 500 +5 800 diff --git a/codenet/public_test_cases/p03290/output.0.txt b/codenet/public_test_cases/p03290/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03290/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03290/output.1.txt b/codenet/public_test_cases/p03290/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69a893aa31141827125ddaaee26966b7aed3de74 --- /dev/null +++ b/codenet/public_test_cases/p03290/output.1.txt @@ -0,0 +1 @@ +66 diff --git a/codenet/public_test_cases/p03290/output.2.txt b/codenet/public_test_cases/p03290/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03290/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03290/output.3.txt b/codenet/public_test_cases/p03290/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03290/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03290/output.4.txt b/codenet/public_test_cases/p03290/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03290/output.4.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03291/input.0.txt b/codenet/public_test_cases/p03291/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab7e974c0f01c881c302d77cc8f8dc4be0dcf434 --- /dev/null +++ b/codenet/public_test_cases/p03291/input.0.txt @@ -0,0 +1 @@ +A??C diff --git a/codenet/public_test_cases/p03291/input.1.txt b/codenet/public_test_cases/p03291/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1c3506b4ef81d5e06b9657de9c7598c9f399ca5 --- /dev/null +++ b/codenet/public_test_cases/p03291/input.1.txt @@ -0,0 +1 @@ +ABCBC diff --git a/codenet/public_test_cases/p03291/input.2.txt b/codenet/public_test_cases/p03291/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..80278741fe88981fe45fa320cc70a69a71e29852 --- /dev/null +++ b/codenet/public_test_cases/p03291/input.2.txt @@ -0,0 +1 @@ +????C?????B??????A??????? diff --git a/codenet/public_test_cases/p03291/input.3.txt b/codenet/public_test_cases/p03291/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab7e974c0f01c881c302d77cc8f8dc4be0dcf434 --- /dev/null +++ b/codenet/public_test_cases/p03291/input.3.txt @@ -0,0 +1 @@ +A??C diff --git a/codenet/public_test_cases/p03291/output.0.txt b/codenet/public_test_cases/p03291/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03291/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03291/output.1.txt b/codenet/public_test_cases/p03291/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03291/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03291/output.2.txt b/codenet/public_test_cases/p03291/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6735cd36606cf4489e2fee21eb26344422ac8ea --- /dev/null +++ b/codenet/public_test_cases/p03291/output.2.txt @@ -0,0 +1 @@ +979596887 diff --git a/codenet/public_test_cases/p03291/output.3.txt b/codenet/public_test_cases/p03291/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03291/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03292/input.0.txt b/codenet/public_test_cases/p03292/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d0fd1a1dfc7f356cb75e2ea2c814f9c3ad2016b --- /dev/null +++ b/codenet/public_test_cases/p03292/input.0.txt @@ -0,0 +1 @@ +1 6 3 diff --git a/codenet/public_test_cases/p03292/input.1.txt b/codenet/public_test_cases/p03292/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d0fd1a1dfc7f356cb75e2ea2c814f9c3ad2016b --- /dev/null +++ b/codenet/public_test_cases/p03292/input.1.txt @@ -0,0 +1 @@ +1 6 3 diff --git a/codenet/public_test_cases/p03292/input.2.txt b/codenet/public_test_cases/p03292/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa64af6e1d1f16e45cad3c4a007d1dfb602bbef5 --- /dev/null +++ b/codenet/public_test_cases/p03292/input.2.txt @@ -0,0 +1 @@ +100 100 100 diff --git a/codenet/public_test_cases/p03292/input.3.txt b/codenet/public_test_cases/p03292/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1bb7b04fa9fcede7905e94110bfc5b7c46e350c --- /dev/null +++ b/codenet/public_test_cases/p03292/input.3.txt @@ -0,0 +1 @@ +11 5 5 diff --git a/codenet/public_test_cases/p03292/output.0.txt b/codenet/public_test_cases/p03292/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03292/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03292/output.1.txt b/codenet/public_test_cases/p03292/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03292/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03292/output.2.txt b/codenet/public_test_cases/p03292/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03292/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03292/output.3.txt b/codenet/public_test_cases/p03292/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03292/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03293/input.0.txt b/codenet/public_test_cases/p03293/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62f2deae967fad9a9d29a0ec292ab1784cd5ae42 --- /dev/null +++ b/codenet/public_test_cases/p03293/input.0.txt @@ -0,0 +1,2 @@ +kyoto +tokyo diff --git a/codenet/public_test_cases/p03293/input.1.txt b/codenet/public_test_cases/p03293/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..25953b23bd27f2b74beff1513b3db2edd3b6e197 --- /dev/null +++ b/codenet/public_test_cases/p03293/input.1.txt @@ -0,0 +1,2 @@ +aaaaaaaaaaaaaaab +aaaaaaaaaaaaaaab diff --git a/codenet/public_test_cases/p03293/input.2.txt b/codenet/public_test_cases/p03293/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..62f2deae967fad9a9d29a0ec292ab1784cd5ae42 --- /dev/null +++ b/codenet/public_test_cases/p03293/input.2.txt @@ -0,0 +1,2 @@ +kyoto +tokyo diff --git a/codenet/public_test_cases/p03293/input.3.txt b/codenet/public_test_cases/p03293/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..383570422778d398892bd8b56ae0532fe08748d7 --- /dev/null +++ b/codenet/public_test_cases/p03293/input.3.txt @@ -0,0 +1,2 @@ +abc +arc diff --git a/codenet/public_test_cases/p03293/output.0.txt b/codenet/public_test_cases/p03293/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03293/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03293/output.1.txt b/codenet/public_test_cases/p03293/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03293/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03293/output.2.txt b/codenet/public_test_cases/p03293/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03293/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03293/output.3.txt b/codenet/public_test_cases/p03293/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03293/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03294/input.0.txt b/codenet/public_test_cases/p03294/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..07a82d02f93d87ba5fc789af1ef2812c15472de6 --- /dev/null +++ b/codenet/public_test_cases/p03294/input.0.txt @@ -0,0 +1,2 @@ +3 +3 4 6 diff --git a/codenet/public_test_cases/p03294/input.1.txt b/codenet/public_test_cases/p03294/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..36a7ed37735d2c0993db66f0c3795c033bfd92dc --- /dev/null +++ b/codenet/public_test_cases/p03294/input.1.txt @@ -0,0 +1,2 @@ +5 +7 46 11 20 11 diff --git a/codenet/public_test_cases/p03294/input.2.txt b/codenet/public_test_cases/p03294/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eee6de745b00f0c8266ae750a8a6a65336c92f42 --- /dev/null +++ b/codenet/public_test_cases/p03294/input.2.txt @@ -0,0 +1,2 @@ +7 +994 518 941 851 647 2 581 diff --git a/codenet/public_test_cases/p03294/input.3.txt b/codenet/public_test_cases/p03294/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..07a82d02f93d87ba5fc789af1ef2812c15472de6 --- /dev/null +++ b/codenet/public_test_cases/p03294/input.3.txt @@ -0,0 +1,2 @@ +3 +3 4 6 diff --git a/codenet/public_test_cases/p03294/output.0.txt b/codenet/public_test_cases/p03294/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03294/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03294/output.1.txt b/codenet/public_test_cases/p03294/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61f00d8cad3920809f4d992ac3031b3f32e7f10 --- /dev/null +++ b/codenet/public_test_cases/p03294/output.1.txt @@ -0,0 +1 @@ +90 diff --git a/codenet/public_test_cases/p03294/output.2.txt b/codenet/public_test_cases/p03294/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..992a491ef17926b3dbe32530ae13a5d7b834866d --- /dev/null +++ b/codenet/public_test_cases/p03294/output.2.txt @@ -0,0 +1 @@ +4527 diff --git a/codenet/public_test_cases/p03294/output.3.txt b/codenet/public_test_cases/p03294/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03294/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03295/input.0.txt b/codenet/public_test_cases/p03295/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b23fc33488a70906d592a14f36013a94f7a1272 --- /dev/null +++ b/codenet/public_test_cases/p03295/input.0.txt @@ -0,0 +1,3 @@ +5 2 +1 4 +2 5 diff --git a/codenet/public_test_cases/p03295/input.1.txt b/codenet/public_test_cases/p03295/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..007706b64ffe9c2a5f7fd8089be739dd06cde1b6 --- /dev/null +++ b/codenet/public_test_cases/p03295/input.1.txt @@ -0,0 +1,11 @@ +5 10 +1 2 +1 3 +1 4 +1 5 +2 3 +2 4 +2 5 +3 4 +3 5 +4 5 diff --git a/codenet/public_test_cases/p03295/input.2.txt b/codenet/public_test_cases/p03295/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b23fc33488a70906d592a14f36013a94f7a1272 --- /dev/null +++ b/codenet/public_test_cases/p03295/input.2.txt @@ -0,0 +1,3 @@ +5 2 +1 4 +2 5 diff --git a/codenet/public_test_cases/p03295/input.3.txt b/codenet/public_test_cases/p03295/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..42181691da055f23c4e7f6ed96f8251475c5aac8 --- /dev/null +++ b/codenet/public_test_cases/p03295/input.3.txt @@ -0,0 +1,6 @@ +9 5 +1 8 +2 7 +3 5 +4 6 +7 9 diff --git a/codenet/public_test_cases/p03295/output.0.txt b/codenet/public_test_cases/p03295/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03295/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03295/output.1.txt b/codenet/public_test_cases/p03295/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03295/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03295/output.2.txt b/codenet/public_test_cases/p03295/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03295/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03295/output.3.txt b/codenet/public_test_cases/p03295/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03295/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03296/input.0.txt b/codenet/public_test_cases/p03296/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f1ce342281385c09f0d9fd2ee727a024f0c1cb2 --- /dev/null +++ b/codenet/public_test_cases/p03296/input.0.txt @@ -0,0 +1,2 @@ +5 +1 1 2 2 2 diff --git a/codenet/public_test_cases/p03296/input.1.txt b/codenet/public_test_cases/p03296/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f1ce342281385c09f0d9fd2ee727a024f0c1cb2 --- /dev/null +++ b/codenet/public_test_cases/p03296/input.1.txt @@ -0,0 +1,2 @@ +5 +1 1 2 2 2 diff --git a/codenet/public_test_cases/p03296/input.2.txt b/codenet/public_test_cases/p03296/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..56221aadc5dfac666c62fd57ad1536458c512851 --- /dev/null +++ b/codenet/public_test_cases/p03296/input.2.txt @@ -0,0 +1,2 @@ +3 +1 2 1 diff --git a/codenet/public_test_cases/p03296/input.3.txt b/codenet/public_test_cases/p03296/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fc2525c31d242216cc0b4a7d5ee6a5c0af85fca --- /dev/null +++ b/codenet/public_test_cases/p03296/input.3.txt @@ -0,0 +1,2 @@ +14 +1 2 2 3 3 3 4 4 4 4 1 2 3 4 diff --git a/codenet/public_test_cases/p03296/input.4.txt b/codenet/public_test_cases/p03296/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5798ec63b3d84e04ace9c318af6eee1f3c36507 --- /dev/null +++ b/codenet/public_test_cases/p03296/input.4.txt @@ -0,0 +1,2 @@ +5 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p03296/output.0.txt b/codenet/public_test_cases/p03296/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03296/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03296/output.1.txt b/codenet/public_test_cases/p03296/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03296/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03296/output.2.txt b/codenet/public_test_cases/p03296/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03296/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03296/output.3.txt b/codenet/public_test_cases/p03296/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03296/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03296/output.4.txt b/codenet/public_test_cases/p03296/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03296/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03297/input.0.txt b/codenet/public_test_cases/p03297/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65e3a19dfed79bb1a29fbc79bbf4c01d3c8c309f --- /dev/null +++ b/codenet/public_test_cases/p03297/input.0.txt @@ -0,0 +1,15 @@ +14 +9 7 5 9 +9 7 6 9 +14 10 7 12 +14 10 8 12 +14 10 9 12 +14 10 7 11 +14 10 8 11 +14 10 9 11 +9 10 5 10 +10 10 5 10 +11 10 5 10 +16 10 5 10 +1000000000000000000 17 14 999999999999999985 +1000000000000000000 17 15 999999999999999985 diff --git a/codenet/public_test_cases/p03297/input.1.txt b/codenet/public_test_cases/p03297/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc3fd408b2736ef3e3a2f39389718607df82a44c --- /dev/null +++ b/codenet/public_test_cases/p03297/input.1.txt @@ -0,0 +1,25 @@ +24 +1 2 3 4 +1 2 4 3 +1 3 2 4 +1 3 4 2 +1 4 2 3 +1 4 3 2 +2 1 3 4 +2 1 4 3 +2 3 1 4 +2 3 4 1 +2 4 1 3 +2 4 3 1 +3 1 2 4 +3 1 4 2 +3 2 1 4 +3 2 4 1 +3 4 1 2 +3 4 2 1 +4 1 2 3 +4 1 3 2 +4 2 1 3 +4 2 3 1 +4 3 1 2 +4 3 2 1 diff --git a/codenet/public_test_cases/p03297/input.2.txt b/codenet/public_test_cases/p03297/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..65e3a19dfed79bb1a29fbc79bbf4c01d3c8c309f --- /dev/null +++ b/codenet/public_test_cases/p03297/input.2.txt @@ -0,0 +1,15 @@ +14 +9 7 5 9 +9 7 6 9 +14 10 7 12 +14 10 8 12 +14 10 9 12 +14 10 7 11 +14 10 8 11 +14 10 9 11 +9 10 5 10 +10 10 5 10 +11 10 5 10 +16 10 5 10 +1000000000000000000 17 14 999999999999999985 +1000000000000000000 17 15 999999999999999985 diff --git a/codenet/public_test_cases/p03297/output.0.txt b/codenet/public_test_cases/p03297/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fec519f89bacb02764ab64cbc1f72df931fdc352 --- /dev/null +++ b/codenet/public_test_cases/p03297/output.0.txt @@ -0,0 +1,14 @@ +No +Yes +No +Yes +Yes +No +No +Yes +No +Yes +Yes +No +No +Yes diff --git a/codenet/public_test_cases/p03297/output.1.txt b/codenet/public_test_cases/p03297/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..654e25607ac1e042b8e57adf8fb433247cdd2590 --- /dev/null +++ b/codenet/public_test_cases/p03297/output.1.txt @@ -0,0 +1,24 @@ +No +No +No +No +No +No +Yes +Yes +No +No +No +No +Yes +Yes +Yes +No +No +No +Yes +Yes +Yes +No +No +No diff --git a/codenet/public_test_cases/p03297/output.2.txt b/codenet/public_test_cases/p03297/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fec519f89bacb02764ab64cbc1f72df931fdc352 --- /dev/null +++ b/codenet/public_test_cases/p03297/output.2.txt @@ -0,0 +1,14 @@ +No +Yes +No +Yes +Yes +No +No +Yes +No +Yes +Yes +No +No +Yes diff --git a/codenet/public_test_cases/p03298/input.0.txt b/codenet/public_test_cases/p03298/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f9823fecef53b48b65c9b68f6b3e404e533ba8e --- /dev/null +++ b/codenet/public_test_cases/p03298/input.0.txt @@ -0,0 +1,2 @@ +4 +cabaacba diff --git a/codenet/public_test_cases/p03298/input.1.txt b/codenet/public_test_cases/p03298/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f9823fecef53b48b65c9b68f6b3e404e533ba8e --- /dev/null +++ b/codenet/public_test_cases/p03298/input.1.txt @@ -0,0 +1,2 @@ +4 +cabaacba diff --git a/codenet/public_test_cases/p03298/input.2.txt b/codenet/public_test_cases/p03298/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3511beb77ff915ce2623d37789861d3eea3a62a --- /dev/null +++ b/codenet/public_test_cases/p03298/input.2.txt @@ -0,0 +1,2 @@ +18 +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa diff --git a/codenet/public_test_cases/p03298/input.3.txt b/codenet/public_test_cases/p03298/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c4f10d7d9fc53ad6a4c5cb076fea3e1fe8d8a97 --- /dev/null +++ b/codenet/public_test_cases/p03298/input.3.txt @@ -0,0 +1,2 @@ +11 +mippiisssisssiipsspiim diff --git a/codenet/public_test_cases/p03298/input.4.txt b/codenet/public_test_cases/p03298/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea657989c347ddfbc2bda45c794cbb7149438d4d --- /dev/null +++ b/codenet/public_test_cases/p03298/input.4.txt @@ -0,0 +1,2 @@ +4 +abcdefgh diff --git a/codenet/public_test_cases/p03298/output.0.txt b/codenet/public_test_cases/p03298/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03298/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03298/output.1.txt b/codenet/public_test_cases/p03298/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03298/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03298/output.2.txt b/codenet/public_test_cases/p03298/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29ccdd063b2cfcda8c679a952a22cf8eccb8e5f6 --- /dev/null +++ b/codenet/public_test_cases/p03298/output.2.txt @@ -0,0 +1 @@ +9075135300 diff --git a/codenet/public_test_cases/p03298/output.3.txt b/codenet/public_test_cases/p03298/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3091e8eea2ff748bf47189885fb5df2feaf14de2 --- /dev/null +++ b/codenet/public_test_cases/p03298/output.3.txt @@ -0,0 +1 @@ +504 diff --git a/codenet/public_test_cases/p03298/output.4.txt b/codenet/public_test_cases/p03298/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03298/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03299/input.0.txt b/codenet/public_test_cases/p03299/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e0d5bac7d2099ba4fc086bf3b8e8536301b647e --- /dev/null +++ b/codenet/public_test_cases/p03299/input.0.txt @@ -0,0 +1,2 @@ +9 +2 3 5 4 1 2 4 2 1 diff --git a/codenet/public_test_cases/p03299/input.1.txt b/codenet/public_test_cases/p03299/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e0d5bac7d2099ba4fc086bf3b8e8536301b647e --- /dev/null +++ b/codenet/public_test_cases/p03299/input.1.txt @@ -0,0 +1,2 @@ +9 +2 3 5 4 1 2 4 2 1 diff --git a/codenet/public_test_cases/p03299/input.2.txt b/codenet/public_test_cases/p03299/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d7778566a9ec2edc1aef3405376f39389487c9f --- /dev/null +++ b/codenet/public_test_cases/p03299/input.2.txt @@ -0,0 +1,2 @@ +2 +2 2 diff --git a/codenet/public_test_cases/p03299/input.3.txt b/codenet/public_test_cases/p03299/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..61da9393aff67624c721832d2cdd5a995ae9cb2f --- /dev/null +++ b/codenet/public_test_cases/p03299/input.3.txt @@ -0,0 +1,2 @@ +9 +27 18 28 18 28 45 90 45 23 diff --git a/codenet/public_test_cases/p03299/input.4.txt b/codenet/public_test_cases/p03299/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..46dcc49a2e12db7593ef436b425d1f89b66bcfb9 --- /dev/null +++ b/codenet/public_test_cases/p03299/input.4.txt @@ -0,0 +1,2 @@ +5 +2 1 2 1 2 diff --git a/codenet/public_test_cases/p03299/output.0.txt b/codenet/public_test_cases/p03299/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba605fc0df7b657db495f4528cd0dba22540bf02 --- /dev/null +++ b/codenet/public_test_cases/p03299/output.0.txt @@ -0,0 +1 @@ +12800 diff --git a/codenet/public_test_cases/p03299/output.1.txt b/codenet/public_test_cases/p03299/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba605fc0df7b657db495f4528cd0dba22540bf02 --- /dev/null +++ b/codenet/public_test_cases/p03299/output.1.txt @@ -0,0 +1 @@ +12800 diff --git a/codenet/public_test_cases/p03299/output.2.txt b/codenet/public_test_cases/p03299/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03299/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03299/output.3.txt b/codenet/public_test_cases/p03299/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f719e0c4d08f2d06b60823792715d7c3738a764 --- /dev/null +++ b/codenet/public_test_cases/p03299/output.3.txt @@ -0,0 +1 @@ +844733013 diff --git a/codenet/public_test_cases/p03299/output.4.txt b/codenet/public_test_cases/p03299/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9183bf03fccab013c0805dd51f7ea97bbb86de5d --- /dev/null +++ b/codenet/public_test_cases/p03299/output.4.txt @@ -0,0 +1 @@ +256 diff --git a/codenet/public_test_cases/p03300/input.0.txt b/codenet/public_test_cases/p03300/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7092e6c89c8328ddbe0cacc49bb455b0172d3cef --- /dev/null +++ b/codenet/public_test_cases/p03300/input.0.txt @@ -0,0 +1,2 @@ +3 +aababb diff --git a/codenet/public_test_cases/p03300/input.1.txt b/codenet/public_test_cases/p03300/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e87ffa757adbd682050539592f1c45882cc8865 --- /dev/null +++ b/codenet/public_test_cases/p03300/input.1.txt @@ -0,0 +1,2 @@ +3 +bbabaa diff --git a/codenet/public_test_cases/p03300/input.2.txt b/codenet/public_test_cases/p03300/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7092e6c89c8328ddbe0cacc49bb455b0172d3cef --- /dev/null +++ b/codenet/public_test_cases/p03300/input.2.txt @@ -0,0 +1,2 @@ +3 +aababb diff --git a/codenet/public_test_cases/p03300/input.3.txt b/codenet/public_test_cases/p03300/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fcd5e1d066dc3d8dac65dd4546336b770807590 --- /dev/null +++ b/codenet/public_test_cases/p03300/input.3.txt @@ -0,0 +1,2 @@ +9 +abbbaababaababbaba diff --git a/codenet/public_test_cases/p03300/input.4.txt b/codenet/public_test_cases/p03300/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..605ca7b564e17df9e4c35ade731ef39aaf7f77f8 --- /dev/null +++ b/codenet/public_test_cases/p03300/input.4.txt @@ -0,0 +1,2 @@ +6 +bbbaabbabaaa diff --git a/codenet/public_test_cases/p03300/output.0.txt b/codenet/public_test_cases/p03300/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1790c8d8f24817257c4d9e9bfddcb7e7d001c208 --- /dev/null +++ b/codenet/public_test_cases/p03300/output.0.txt @@ -0,0 +1 @@ +abab diff --git a/codenet/public_test_cases/p03300/output.1.txt b/codenet/public_test_cases/p03300/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46ce007823318b7d7514e87cc8d0875e08c9eb1a --- /dev/null +++ b/codenet/public_test_cases/p03300/output.1.txt @@ -0,0 +1 @@ +bbabaa diff --git a/codenet/public_test_cases/p03300/output.2.txt b/codenet/public_test_cases/p03300/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1790c8d8f24817257c4d9e9bfddcb7e7d001c208 --- /dev/null +++ b/codenet/public_test_cases/p03300/output.2.txt @@ -0,0 +1 @@ +abab diff --git a/codenet/public_test_cases/p03300/output.3.txt b/codenet/public_test_cases/p03300/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..044e1facd501aeee102bd9891584d09a81e3df4f --- /dev/null +++ b/codenet/public_test_cases/p03300/output.3.txt @@ -0,0 +1 @@ +bbaababababa diff --git a/codenet/public_test_cases/p03300/output.4.txt b/codenet/public_test_cases/p03300/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a3e35517699ef79db68cfc2c5dc48c50c392794 --- /dev/null +++ b/codenet/public_test_cases/p03300/output.4.txt @@ -0,0 +1 @@ +bbbabaaa diff --git a/codenet/public_test_cases/p03301/input.0.txt b/codenet/public_test_cases/p03301/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9485a0735e2d2d5b62cc35a3fd1ab7e4f39c318f --- /dev/null +++ b/codenet/public_test_cases/p03301/input.0.txt @@ -0,0 +1,2 @@ +5 +20 100 10 1 10 diff --git a/codenet/public_test_cases/p03301/input.1.txt b/codenet/public_test_cases/p03301/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9485a0735e2d2d5b62cc35a3fd1ab7e4f39c318f --- /dev/null +++ b/codenet/public_test_cases/p03301/input.1.txt @@ -0,0 +1,2 @@ +5 +20 100 10 1 10 diff --git a/codenet/public_test_cases/p03301/input.2.txt b/codenet/public_test_cases/p03301/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7bfd1482e6c6a229341fe13a1f49507b42be258 --- /dev/null +++ b/codenet/public_test_cases/p03301/input.2.txt @@ -0,0 +1,2 @@ +6 +4 5 1 1 4 5 diff --git a/codenet/public_test_cases/p03301/input.3.txt b/codenet/public_test_cases/p03301/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..de612a7470a111c414289fee1719483cc79395e4 --- /dev/null +++ b/codenet/public_test_cases/p03301/input.3.txt @@ -0,0 +1,2 @@ +5 +1 10 100 10 1 diff --git a/codenet/public_test_cases/p03301/output.0.txt b/codenet/public_test_cases/p03301/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a29588c7d055d257eca73f824162f1c0a10f670 --- /dev/null +++ b/codenet/public_test_cases/p03301/output.0.txt @@ -0,0 +1 @@ +120 21 diff --git a/codenet/public_test_cases/p03301/output.1.txt b/codenet/public_test_cases/p03301/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a29588c7d055d257eca73f824162f1c0a10f670 --- /dev/null +++ b/codenet/public_test_cases/p03301/output.1.txt @@ -0,0 +1 @@ +120 21 diff --git a/codenet/public_test_cases/p03301/output.2.txt b/codenet/public_test_cases/p03301/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..148b5def626bce659fae2dedc75b76a72d04b821 --- /dev/null +++ b/codenet/public_test_cases/p03301/output.2.txt @@ -0,0 +1 @@ +11 9 diff --git a/codenet/public_test_cases/p03301/output.3.txt b/codenet/public_test_cases/p03301/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..56cfd8453a8afbec5af030b25033001cad38706b --- /dev/null +++ b/codenet/public_test_cases/p03301/output.3.txt @@ -0,0 +1 @@ +102 20 diff --git a/codenet/public_test_cases/p03302/input.0.txt b/codenet/public_test_cases/p03302/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1afc8a03f49a7a6f6036a9c037d35cde089ef5ce --- /dev/null +++ b/codenet/public_test_cases/p03302/input.0.txt @@ -0,0 +1 @@ +4 11 diff --git a/codenet/public_test_cases/p03302/input.1.txt b/codenet/public_test_cases/p03302/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1afc8a03f49a7a6f6036a9c037d35cde089ef5ce --- /dev/null +++ b/codenet/public_test_cases/p03302/input.1.txt @@ -0,0 +1 @@ +4 11 diff --git a/codenet/public_test_cases/p03302/input.2.txt b/codenet/public_test_cases/p03302/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p03302/input.2.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p03302/input.3.txt b/codenet/public_test_cases/p03302/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03302/input.3.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03302/output.0.txt b/codenet/public_test_cases/p03302/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd38861632cb2360cb5acb6253e7e281647f034a --- /dev/null +++ b/codenet/public_test_cases/p03302/output.0.txt @@ -0,0 +1 @@ ++ diff --git a/codenet/public_test_cases/p03302/output.1.txt b/codenet/public_test_cases/p03302/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd38861632cb2360cb5acb6253e7e281647f034a --- /dev/null +++ b/codenet/public_test_cases/p03302/output.1.txt @@ -0,0 +1 @@ ++ diff --git a/codenet/public_test_cases/p03302/output.2.txt b/codenet/public_test_cases/p03302/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..72e8ffc0db8aad71a934dd11e5968bd5109e54b4 --- /dev/null +++ b/codenet/public_test_cases/p03302/output.2.txt @@ -0,0 +1 @@ +* diff --git a/codenet/public_test_cases/p03302/output.3.txt b/codenet/public_test_cases/p03302/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..587be6b4c3f93f93c489c0111bba5596147a26cb --- /dev/null +++ b/codenet/public_test_cases/p03302/output.3.txt @@ -0,0 +1 @@ +x diff --git a/codenet/public_test_cases/p03303/input.0.txt b/codenet/public_test_cases/p03303/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6aeefcc7bc4205704815c55745311de957102c76 --- /dev/null +++ b/codenet/public_test_cases/p03303/input.0.txt @@ -0,0 +1,2 @@ +abcdefgh +3 diff --git a/codenet/public_test_cases/p03303/input.1.txt b/codenet/public_test_cases/p03303/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..530ea1440d2b27eafaa3987845ef41732c8a3852 --- /dev/null +++ b/codenet/public_test_cases/p03303/input.1.txt @@ -0,0 +1,2 @@ +lllll +1 diff --git a/codenet/public_test_cases/p03303/input.2.txt b/codenet/public_test_cases/p03303/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6aeefcc7bc4205704815c55745311de957102c76 --- /dev/null +++ b/codenet/public_test_cases/p03303/input.2.txt @@ -0,0 +1,2 @@ +abcdefgh +3 diff --git a/codenet/public_test_cases/p03303/input.3.txt b/codenet/public_test_cases/p03303/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d362afc49d73dd68c68946c11bd7024d6031fd54 --- /dev/null +++ b/codenet/public_test_cases/p03303/input.3.txt @@ -0,0 +1,2 @@ +souuundhound +2 diff --git a/codenet/public_test_cases/p03303/output.0.txt b/codenet/public_test_cases/p03303/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01ffc25f6c40eb12b361eb2938ae275d6a6b02cb --- /dev/null +++ b/codenet/public_test_cases/p03303/output.0.txt @@ -0,0 +1 @@ +adg diff --git a/codenet/public_test_cases/p03303/output.1.txt b/codenet/public_test_cases/p03303/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4a8dab3d5364300fa327ca26e6ea6da0244098f --- /dev/null +++ b/codenet/public_test_cases/p03303/output.1.txt @@ -0,0 +1 @@ +lllll diff --git a/codenet/public_test_cases/p03303/output.2.txt b/codenet/public_test_cases/p03303/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..01ffc25f6c40eb12b361eb2938ae275d6a6b02cb --- /dev/null +++ b/codenet/public_test_cases/p03303/output.2.txt @@ -0,0 +1 @@ +adg diff --git a/codenet/public_test_cases/p03303/output.3.txt b/codenet/public_test_cases/p03303/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..931f13e9f7bbf6a50f54b68bc2c74575d8039e64 --- /dev/null +++ b/codenet/public_test_cases/p03303/output.3.txt @@ -0,0 +1 @@ +suudon diff --git a/codenet/public_test_cases/p03304/input.0.txt b/codenet/public_test_cases/p03304/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bafe88d75575352861ed5f2a438df237bed39211 --- /dev/null +++ b/codenet/public_test_cases/p03304/input.0.txt @@ -0,0 +1 @@ +2 3 1 diff --git a/codenet/public_test_cases/p03304/input.1.txt b/codenet/public_test_cases/p03304/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bafe88d75575352861ed5f2a438df237bed39211 --- /dev/null +++ b/codenet/public_test_cases/p03304/input.1.txt @@ -0,0 +1 @@ +2 3 1 diff --git a/codenet/public_test_cases/p03304/input.2.txt b/codenet/public_test_cases/p03304/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..89f0e7ca86a3afa7704d0a08fe78a46fe7cfeb82 --- /dev/null +++ b/codenet/public_test_cases/p03304/input.2.txt @@ -0,0 +1 @@ +1000000000 180707 0 diff --git a/codenet/public_test_cases/p03304/output.0.txt b/codenet/public_test_cases/p03304/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..487cbbc74cbdc97e962d1773d88da2ca4f560520 --- /dev/null +++ b/codenet/public_test_cases/p03304/output.0.txt @@ -0,0 +1 @@ +1.0000000000 diff --git a/codenet/public_test_cases/p03304/output.1.txt b/codenet/public_test_cases/p03304/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..487cbbc74cbdc97e962d1773d88da2ca4f560520 --- /dev/null +++ b/codenet/public_test_cases/p03304/output.1.txt @@ -0,0 +1 @@ +1.0000000000 diff --git a/codenet/public_test_cases/p03304/output.2.txt b/codenet/public_test_cases/p03304/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a623dcaf07a532e3cdb6d30a1573fc6b6949cc8 --- /dev/null +++ b/codenet/public_test_cases/p03304/output.2.txt @@ -0,0 +1 @@ +0.0001807060 diff --git a/codenet/public_test_cases/p03305/input.0.txt b/codenet/public_test_cases/p03305/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d700f5dbab98a4ff39cdc961cffb7cdc20985802 --- /dev/null +++ b/codenet/public_test_cases/p03305/input.0.txt @@ -0,0 +1,4 @@ +4 3 2 3 +1 4 1 100 +1 2 1 10 +1 3 20 1 diff --git a/codenet/public_test_cases/p03305/input.1.txt b/codenet/public_test_cases/p03305/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b67281805b7394dd3f90c384b6c239f03703d1f2 --- /dev/null +++ b/codenet/public_test_cases/p03305/input.1.txt @@ -0,0 +1,13 @@ +8 12 3 8 +2 8 685087149 857180777 +6 7 298270585 209942236 +2 4 346080035 234079976 +2 5 131857300 22507157 +4 8 30723332 173476334 +2 6 480845267 448565596 +1 4 181424400 548830121 +4 5 57429995 195056405 +7 8 160277628 479932440 +1 6 475692952 203530153 +3 5 336869679 160714712 +2 7 389775999 199123879 diff --git a/codenet/public_test_cases/p03305/input.2.txt b/codenet/public_test_cases/p03305/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d700f5dbab98a4ff39cdc961cffb7cdc20985802 --- /dev/null +++ b/codenet/public_test_cases/p03305/input.2.txt @@ -0,0 +1,4 @@ +4 3 2 3 +1 4 1 100 +1 2 1 10 +1 3 20 1 diff --git a/codenet/public_test_cases/p03305/output.0.txt b/codenet/public_test_cases/p03305/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a46fb2ef1847c90bf457a991f3877953150afa04 --- /dev/null +++ b/codenet/public_test_cases/p03305/output.0.txt @@ -0,0 +1,4 @@ +999999999999998 +999999999999989 +999999999999979 +999999999999897 diff --git a/codenet/public_test_cases/p03305/output.1.txt b/codenet/public_test_cases/p03305/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d369359c32b8170a6c92503641f71deb5b13b66f --- /dev/null +++ b/codenet/public_test_cases/p03305/output.1.txt @@ -0,0 +1,8 @@ +999999574976994 +999999574976994 +999999574976994 +999999574976994 +999999574976994 +999999574976994 +999999574976994 +999999574976994 diff --git a/codenet/public_test_cases/p03305/output.2.txt b/codenet/public_test_cases/p03305/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a46fb2ef1847c90bf457a991f3877953150afa04 --- /dev/null +++ b/codenet/public_test_cases/p03305/output.2.txt @@ -0,0 +1,4 @@ +999999999999998 +999999999999989 +999999999999979 +999999999999897 diff --git a/codenet/public_test_cases/p03306/input.0.txt b/codenet/public_test_cases/p03306/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7c9877db32b24548870bc86584793c4899afd6f --- /dev/null +++ b/codenet/public_test_cases/p03306/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 3 +2 3 5 +1 3 4 diff --git a/codenet/public_test_cases/p03306/input.1.txt b/codenet/public_test_cases/p03306/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b11170afdb7860157c24b7fa013a2404db4c4eb --- /dev/null +++ b/codenet/public_test_cases/p03306/input.1.txt @@ -0,0 +1,4 @@ +4 3 +1 2 6 +2 3 7 +3 4 5 diff --git a/codenet/public_test_cases/p03306/input.2.txt b/codenet/public_test_cases/p03306/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7c9877db32b24548870bc86584793c4899afd6f --- /dev/null +++ b/codenet/public_test_cases/p03306/input.2.txt @@ -0,0 +1,4 @@ +3 3 +1 2 3 +2 3 5 +1 3 4 diff --git a/codenet/public_test_cases/p03306/input.3.txt b/codenet/public_test_cases/p03306/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1901de287ae950df004510d3bed455ed60ea8cef --- /dev/null +++ b/codenet/public_test_cases/p03306/input.3.txt @@ -0,0 +1,8 @@ +8 7 +1 2 1000000000 +2 3 2 +3 4 1000000000 +4 5 2 +5 6 1000000000 +6 7 2 +7 8 1000000000 diff --git a/codenet/public_test_cases/p03306/output.0.txt b/codenet/public_test_cases/p03306/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03306/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03306/output.1.txt b/codenet/public_test_cases/p03306/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03306/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03306/output.2.txt b/codenet/public_test_cases/p03306/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03306/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03306/output.3.txt b/codenet/public_test_cases/p03306/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03306/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03307/input.0.txt b/codenet/public_test_cases/p03307/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03307/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03307/input.1.txt b/codenet/public_test_cases/p03307/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28e56d983ef928848a1b0cdae1fe481ad09143a2 --- /dev/null +++ b/codenet/public_test_cases/p03307/input.1.txt @@ -0,0 +1 @@ +999999999 diff --git a/codenet/public_test_cases/p03307/input.2.txt b/codenet/public_test_cases/p03307/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03307/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03307/input.3.txt b/codenet/public_test_cases/p03307/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03307/input.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03307/output.0.txt b/codenet/public_test_cases/p03307/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03307/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03307/output.1.txt b/codenet/public_test_cases/p03307/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01484d37669d80fe274add6298b2132d173f137a --- /dev/null +++ b/codenet/public_test_cases/p03307/output.1.txt @@ -0,0 +1 @@ +1999999998 diff --git a/codenet/public_test_cases/p03307/output.2.txt b/codenet/public_test_cases/p03307/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03307/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03307/output.3.txt b/codenet/public_test_cases/p03307/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03307/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03308/input.0.txt b/codenet/public_test_cases/p03308/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef7d14bdc75425cdcf13ed55d092787c673ea15d --- /dev/null +++ b/codenet/public_test_cases/p03308/input.0.txt @@ -0,0 +1,2 @@ +4 +1 4 6 3 diff --git a/codenet/public_test_cases/p03308/output.0.txt b/codenet/public_test_cases/p03308/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03308/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03309/input.0.txt b/codenet/public_test_cases/p03309/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18882524da6c1d7cc2d63743af279793a0871d9a --- /dev/null +++ b/codenet/public_test_cases/p03309/input.0.txt @@ -0,0 +1,2 @@ +5 +2 2 3 5 5 diff --git a/codenet/public_test_cases/p03309/input.1.txt b/codenet/public_test_cases/p03309/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18882524da6c1d7cc2d63743af279793a0871d9a --- /dev/null +++ b/codenet/public_test_cases/p03309/input.1.txt @@ -0,0 +1,2 @@ +5 +2 2 3 5 5 diff --git a/codenet/public_test_cases/p03309/input.2.txt b/codenet/public_test_cases/p03309/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a3ff79dc95b51a1d8f27b79db2e1f2343369fe8 --- /dev/null +++ b/codenet/public_test_cases/p03309/input.2.txt @@ -0,0 +1,2 @@ +7 +1 1 1 1 2 3 4 diff --git a/codenet/public_test_cases/p03309/input.3.txt b/codenet/public_test_cases/p03309/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bbd6ae3a1f8c6414096b7a175fd70d13657f5b --- /dev/null +++ b/codenet/public_test_cases/p03309/input.3.txt @@ -0,0 +1,2 @@ +9 +1 2 3 4 5 6 7 8 9 diff --git a/codenet/public_test_cases/p03309/input.4.txt b/codenet/public_test_cases/p03309/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8db8ab6d8a65dd0691ca63947f38b74873b969ac --- /dev/null +++ b/codenet/public_test_cases/p03309/input.4.txt @@ -0,0 +1,2 @@ +6 +6 5 4 3 2 1 diff --git a/codenet/public_test_cases/p03309/output.0.txt b/codenet/public_test_cases/p03309/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03309/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03309/output.1.txt b/codenet/public_test_cases/p03309/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03309/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03309/output.2.txt b/codenet/public_test_cases/p03309/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03309/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03309/output.3.txt b/codenet/public_test_cases/p03309/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03309/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03309/output.4.txt b/codenet/public_test_cases/p03309/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03309/output.4.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03310/input.0.txt b/codenet/public_test_cases/p03310/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eef0e99088698dd532a6aad4e136d1de8f9ea1e5 --- /dev/null +++ b/codenet/public_test_cases/p03310/input.0.txt @@ -0,0 +1,2 @@ +5 +3 2 4 1 2 diff --git a/codenet/public_test_cases/p03310/output.0.txt b/codenet/public_test_cases/p03310/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03310/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03311/input.0.txt b/codenet/public_test_cases/p03311/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18882524da6c1d7cc2d63743af279793a0871d9a --- /dev/null +++ b/codenet/public_test_cases/p03311/input.0.txt @@ -0,0 +1,2 @@ +5 +2 2 3 5 5 diff --git a/codenet/public_test_cases/p03311/output.0.txt b/codenet/public_test_cases/p03311/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03311/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03312/input.0.txt b/codenet/public_test_cases/p03312/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eef0e99088698dd532a6aad4e136d1de8f9ea1e5 --- /dev/null +++ b/codenet/public_test_cases/p03312/input.0.txt @@ -0,0 +1,2 @@ +5 +3 2 4 1 2 diff --git a/codenet/public_test_cases/p03312/input.1.txt b/codenet/public_test_cases/p03312/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86ce8a951ce1b6d265d8a3121d482cef2ee70560 --- /dev/null +++ b/codenet/public_test_cases/p03312/input.1.txt @@ -0,0 +1,2 @@ +10 +10 71 84 33 6 47 23 25 52 64 diff --git a/codenet/public_test_cases/p03312/input.2.txt b/codenet/public_test_cases/p03312/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2859cc91932520a774bacb37ceaf9a5c42afbea --- /dev/null +++ b/codenet/public_test_cases/p03312/input.2.txt @@ -0,0 +1,2 @@ +7 +1 2 3 1000000000 4 5 6 diff --git a/codenet/public_test_cases/p03312/input.3.txt b/codenet/public_test_cases/p03312/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..eef0e99088698dd532a6aad4e136d1de8f9ea1e5 --- /dev/null +++ b/codenet/public_test_cases/p03312/input.3.txt @@ -0,0 +1,2 @@ +5 +3 2 4 1 2 diff --git a/codenet/public_test_cases/p03312/output.0.txt b/codenet/public_test_cases/p03312/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03312/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03312/output.1.txt b/codenet/public_test_cases/p03312/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p03312/output.1.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p03312/output.2.txt b/codenet/public_test_cases/p03312/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2eb623f6c553f7aa73c620f7fbf2de472fed0e4 --- /dev/null +++ b/codenet/public_test_cases/p03312/output.2.txt @@ -0,0 +1 @@ +999999994 diff --git a/codenet/public_test_cases/p03312/output.3.txt b/codenet/public_test_cases/p03312/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03312/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03313/input.0.txt b/codenet/public_test_cases/p03313/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83e9f6373b97d04a0accc95994cb186b28132804 --- /dev/null +++ b/codenet/public_test_cases/p03313/input.0.txt @@ -0,0 +1,2 @@ +2 +1 2 3 1 diff --git a/codenet/public_test_cases/p03313/input.1.txt b/codenet/public_test_cases/p03313/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83e9f6373b97d04a0accc95994cb186b28132804 --- /dev/null +++ b/codenet/public_test_cases/p03313/input.1.txt @@ -0,0 +1,2 @@ +2 +1 2 3 1 diff --git a/codenet/public_test_cases/p03313/input.2.txt b/codenet/public_test_cases/p03313/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a10e743c275280a713cf47f5076470c110e0eb10 --- /dev/null +++ b/codenet/public_test_cases/p03313/input.2.txt @@ -0,0 +1,2 @@ +3 +10 71 84 33 6 47 23 25 diff --git a/codenet/public_test_cases/p03313/input.3.txt b/codenet/public_test_cases/p03313/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..305f381b96082743084f41a175728192e698edfa --- /dev/null +++ b/codenet/public_test_cases/p03313/input.3.txt @@ -0,0 +1,2 @@ +4 +75 26 45 72 81 47 97 97 2 2 25 82 84 17 56 32 diff --git a/codenet/public_test_cases/p03313/output.0.txt b/codenet/public_test_cases/p03313/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2e8ea0904b0fdd2d02ac80f08d60c82e199e8a5 --- /dev/null +++ b/codenet/public_test_cases/p03313/output.0.txt @@ -0,0 +1,3 @@ +3 +4 +5 diff --git a/codenet/public_test_cases/p03313/output.1.txt b/codenet/public_test_cases/p03313/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2e8ea0904b0fdd2d02ac80f08d60c82e199e8a5 --- /dev/null +++ b/codenet/public_test_cases/p03313/output.1.txt @@ -0,0 +1,3 @@ +3 +4 +5 diff --git a/codenet/public_test_cases/p03313/output.2.txt b/codenet/public_test_cases/p03313/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5ec56b58d49f46d8f7f7cb830ff52467b885742 --- /dev/null +++ b/codenet/public_test_cases/p03313/output.2.txt @@ -0,0 +1,7 @@ +81 +94 +155 +155 +155 +155 +155 diff --git a/codenet/public_test_cases/p03313/output.3.txt b/codenet/public_test_cases/p03313/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6bb9a43507322d573ef0f99cef6a3a52ac02876 --- /dev/null +++ b/codenet/public_test_cases/p03313/output.3.txt @@ -0,0 +1,15 @@ +101 +120 +147 +156 +156 +178 +194 +194 +194 +194 +194 +194 +194 +194 +194 diff --git a/codenet/public_test_cases/p03314/input.0.txt b/codenet/public_test_cases/p03314/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..84dd496a5c3eb6aa2f1497d0aff95267d481f117 --- /dev/null +++ b/codenet/public_test_cases/p03314/input.0.txt @@ -0,0 +1,2 @@ +3 2 1 +1 diff --git a/codenet/public_test_cases/p03314/input.1.txt b/codenet/public_test_cases/p03314/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..84dd496a5c3eb6aa2f1497d0aff95267d481f117 --- /dev/null +++ b/codenet/public_test_cases/p03314/input.1.txt @@ -0,0 +1,2 @@ +3 2 1 +1 diff --git a/codenet/public_test_cases/p03314/input.2.txt b/codenet/public_test_cases/p03314/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7e50889f4de41ff8d34a2f5058dc550e40a6641 --- /dev/null +++ b/codenet/public_test_cases/p03314/input.2.txt @@ -0,0 +1,2 @@ +4 2 2 +1 2 diff --git a/codenet/public_test_cases/p03314/input.3.txt b/codenet/public_test_cases/p03314/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c6af0ea176c94b8a2c169771f544e76be9ac54b --- /dev/null +++ b/codenet/public_test_cases/p03314/input.3.txt @@ -0,0 +1,2 @@ +5 4 3 +1 1 1 diff --git a/codenet/public_test_cases/p03314/input.4.txt b/codenet/public_test_cases/p03314/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..73d296492ccbe2a05ad8225ccbae0fe4fbf4d823 --- /dev/null +++ b/codenet/public_test_cases/p03314/input.4.txt @@ -0,0 +1,2 @@ +25000 400 4 +3 7 31 127 diff --git a/codenet/public_test_cases/p03314/input.5.txt b/codenet/public_test_cases/p03314/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c46335264c9cc1e6e588122dd37dfe78902afd4 --- /dev/null +++ b/codenet/public_test_cases/p03314/input.5.txt @@ -0,0 +1,2 @@ +9954 310 12 +267 193 278 294 6 63 86 166 157 193 168 43 diff --git a/codenet/public_test_cases/p03314/input.6.txt b/codenet/public_test_cases/p03314/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..68e51ea407fd1be200d36f593289c75c2db2b8cb --- /dev/null +++ b/codenet/public_test_cases/p03314/input.6.txt @@ -0,0 +1,2 @@ +10 3 5 +1 1 2 3 3 diff --git a/codenet/public_test_cases/p03314/input.7.txt b/codenet/public_test_cases/p03314/input.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f25298e7908560ec9a4e963518162af1a0939d5 --- /dev/null +++ b/codenet/public_test_cases/p03314/input.7.txt @@ -0,0 +1,2 @@ +7 4 5 +1 2 3 1 2 diff --git a/codenet/public_test_cases/p03314/output.0.txt b/codenet/public_test_cases/p03314/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03314/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03314/output.1.txt b/codenet/public_test_cases/p03314/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03314/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03314/output.2.txt b/codenet/public_test_cases/p03314/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03314/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03314/output.3.txt b/codenet/public_test_cases/p03314/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03314/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03314/output.4.txt b/codenet/public_test_cases/p03314/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b89bb558b312ee46f7012f42a0c4dec84d8081a7 --- /dev/null +++ b/codenet/public_test_cases/p03314/output.4.txt @@ -0,0 +1 @@ +923966268 diff --git a/codenet/public_test_cases/p03314/output.5.txt b/codenet/public_test_cases/p03314/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ee660e2a438ea3ea790a4dd3049c93e7dcfa167 --- /dev/null +++ b/codenet/public_test_cases/p03314/output.5.txt @@ -0,0 +1 @@ +979180369 diff --git a/codenet/public_test_cases/p03314/output.6.txt b/codenet/public_test_cases/p03314/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..2794bbe069d76d27c545987b32738bfebce988d0 --- /dev/null +++ b/codenet/public_test_cases/p03314/output.6.txt @@ -0,0 +1 @@ +1458 diff --git a/codenet/public_test_cases/p03314/output.7.txt b/codenet/public_test_cases/p03314/output.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p03314/output.7.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p03315/input.0.txt b/codenet/public_test_cases/p03315/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..598cec5dac1cace461b98c2d1d12a36012a9c82d --- /dev/null +++ b/codenet/public_test_cases/p03315/input.0.txt @@ -0,0 +1 @@ ++-++ diff --git a/codenet/public_test_cases/p03315/input.1.txt b/codenet/public_test_cases/p03315/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..598cec5dac1cace461b98c2d1d12a36012a9c82d --- /dev/null +++ b/codenet/public_test_cases/p03315/input.1.txt @@ -0,0 +1 @@ ++-++ diff --git a/codenet/public_test_cases/p03315/input.2.txt b/codenet/public_test_cases/p03315/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3383539a6ede74fff78959ce670c5071eda46f68 --- /dev/null +++ b/codenet/public_test_cases/p03315/input.2.txt @@ -0,0 +1 @@ +-+-- diff --git a/codenet/public_test_cases/p03315/input.3.txt b/codenet/public_test_cases/p03315/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..87d43697f4110b9b1d8a738b2ab1e47c51db9db1 --- /dev/null +++ b/codenet/public_test_cases/p03315/input.3.txt @@ -0,0 +1 @@ +---- diff --git a/codenet/public_test_cases/p03315/output.0.txt b/codenet/public_test_cases/p03315/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03315/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03315/output.1.txt b/codenet/public_test_cases/p03315/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03315/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03315/output.2.txt b/codenet/public_test_cases/p03315/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fbedf693b51d80a9480634ff720815943de9889 --- /dev/null +++ b/codenet/public_test_cases/p03315/output.2.txt @@ -0,0 +1 @@ +-2 diff --git a/codenet/public_test_cases/p03315/output.3.txt b/codenet/public_test_cases/p03315/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bae29925cf01f8e876ee529f224635c00a865924 --- /dev/null +++ b/codenet/public_test_cases/p03315/output.3.txt @@ -0,0 +1 @@ +-4 diff --git a/codenet/public_test_cases/p03316/input.0.txt b/codenet/public_test_cases/p03316/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03316/input.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03316/output.0.txt b/codenet/public_test_cases/p03316/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03316/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03317/input.0.txt b/codenet/public_test_cases/p03317/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a86d88f9ad792f07c1786b5cc87bec3e254d46c --- /dev/null +++ b/codenet/public_test_cases/p03317/input.0.txt @@ -0,0 +1,2 @@ +4 3 +2 3 1 4 diff --git a/codenet/public_test_cases/p03317/input.1.txt b/codenet/public_test_cases/p03317/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81011f8acc96c80bda2d326c060335845cb16d08 --- /dev/null +++ b/codenet/public_test_cases/p03317/input.1.txt @@ -0,0 +1,2 @@ +8 3 +7 3 1 8 4 6 2 5 diff --git a/codenet/public_test_cases/p03317/input.2.txt b/codenet/public_test_cases/p03317/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a86d88f9ad792f07c1786b5cc87bec3e254d46c --- /dev/null +++ b/codenet/public_test_cases/p03317/input.2.txt @@ -0,0 +1,2 @@ +4 3 +2 3 1 4 diff --git a/codenet/public_test_cases/p03317/input.3.txt b/codenet/public_test_cases/p03317/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e6c03e4e6d4a7352717eb6d36ee63669371c68a --- /dev/null +++ b/codenet/public_test_cases/p03317/input.3.txt @@ -0,0 +1,2 @@ +3 3 +1 2 3 diff --git a/codenet/public_test_cases/p03317/output.0.txt b/codenet/public_test_cases/p03317/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03317/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03317/output.1.txt b/codenet/public_test_cases/p03317/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03317/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03317/output.2.txt b/codenet/public_test_cases/p03317/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03317/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03317/output.3.txt b/codenet/public_test_cases/p03317/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03317/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03318/input.0.txt b/codenet/public_test_cases/p03318/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03318/input.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03318/input.1.txt b/codenet/public_test_cases/p03318/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03318/input.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03318/output.0.txt b/codenet/public_test_cases/p03318/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcd3f64f3656e133bda10c9aaadf190d89c0a173 --- /dev/null +++ b/codenet/public_test_cases/p03318/output.0.txt @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +19 diff --git a/codenet/public_test_cases/p03318/output.1.txt b/codenet/public_test_cases/p03318/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcd3f64f3656e133bda10c9aaadf190d89c0a173 --- /dev/null +++ b/codenet/public_test_cases/p03318/output.1.txt @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +19 diff --git a/codenet/public_test_cases/p03319/input.0.txt b/codenet/public_test_cases/p03319/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a86d88f9ad792f07c1786b5cc87bec3e254d46c --- /dev/null +++ b/codenet/public_test_cases/p03319/input.0.txt @@ -0,0 +1,2 @@ +4 3 +2 3 1 4 diff --git a/codenet/public_test_cases/p03319/output.0.txt b/codenet/public_test_cases/p03319/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03319/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03320/input.0.txt b/codenet/public_test_cases/p03320/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03320/input.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03320/output.0.txt b/codenet/public_test_cases/p03320/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcd3f64f3656e133bda10c9aaadf190d89c0a173 --- /dev/null +++ b/codenet/public_test_cases/p03320/output.0.txt @@ -0,0 +1,10 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +19 diff --git a/codenet/public_test_cases/p03321/input.0.txt b/codenet/public_test_cases/p03321/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c7a862754ca2037b5cf4622cace2794909c3caa --- /dev/null +++ b/codenet/public_test_cases/p03321/input.0.txt @@ -0,0 +1,6 @@ +5 5 +1 2 +1 3 +3 4 +3 5 +4 5 diff --git a/codenet/public_test_cases/p03321/input.1.txt b/codenet/public_test_cases/p03321/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c7a862754ca2037b5cf4622cace2794909c3caa --- /dev/null +++ b/codenet/public_test_cases/p03321/input.1.txt @@ -0,0 +1,6 @@ +5 5 +1 2 +1 3 +3 4 +3 5 +4 5 diff --git a/codenet/public_test_cases/p03321/input.2.txt b/codenet/public_test_cases/p03321/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3c7fe7e3f23ecf11ebd912c3b48e86f9b11da99 --- /dev/null +++ b/codenet/public_test_cases/p03321/input.2.txt @@ -0,0 +1,2 @@ +5 1 +1 2 diff --git a/codenet/public_test_cases/p03321/input.3.txt b/codenet/public_test_cases/p03321/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e6c86ac51034c9265446bb0a6719b9c6212b2283 --- /dev/null +++ b/codenet/public_test_cases/p03321/input.3.txt @@ -0,0 +1,40 @@ +10 39 +7 2 +7 1 +5 6 +5 8 +9 10 +2 8 +8 7 +3 10 +10 1 +8 10 +2 3 +7 4 +3 9 +4 10 +3 4 +6 1 +6 7 +9 5 +9 7 +6 9 +9 4 +4 6 +7 5 +8 3 +2 5 +9 2 +10 7 +8 6 +8 9 +7 3 +5 3 +4 5 +6 3 +2 10 +5 10 +4 2 +6 2 +8 4 +10 6 diff --git a/codenet/public_test_cases/p03321/input.4.txt b/codenet/public_test_cases/p03321/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..605cb786f64eb0b1cf19292f4f46b4d4f6c8049b --- /dev/null +++ b/codenet/public_test_cases/p03321/input.4.txt @@ -0,0 +1,4 @@ +4 3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03321/output.0.txt b/codenet/public_test_cases/p03321/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03321/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03321/output.1.txt b/codenet/public_test_cases/p03321/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03321/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03321/output.2.txt b/codenet/public_test_cases/p03321/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03321/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03321/output.3.txt b/codenet/public_test_cases/p03321/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03321/output.3.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03321/output.4.txt b/codenet/public_test_cases/p03321/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03321/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03322/input.0.txt b/codenet/public_test_cases/p03322/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..42b12af0812f5b334997e8a9da0b25c882032356 --- /dev/null +++ b/codenet/public_test_cases/p03322/input.0.txt @@ -0,0 +1,2 @@ +5 ++>+<- diff --git a/codenet/public_test_cases/p03322/input.1.txt b/codenet/public_test_cases/p03322/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..42b12af0812f5b334997e8a9da0b25c882032356 --- /dev/null +++ b/codenet/public_test_cases/p03322/input.1.txt @@ -0,0 +1,2 @@ +5 ++>+<- diff --git a/codenet/public_test_cases/p03322/input.2.txt b/codenet/public_test_cases/p03322/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60e418509085d2a5b14e8b05e23fd1c89ea88d7c --- /dev/null +++ b/codenet/public_test_cases/p03322/input.2.txt @@ -0,0 +1,2 @@ +5 ++>+-< diff --git a/codenet/public_test_cases/p03322/input.3.txt b/codenet/public_test_cases/p03322/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbe01c2a12b755a75aac03fbb8d68fa0406fcce6 --- /dev/null +++ b/codenet/public_test_cases/p03322/input.3.txt @@ -0,0 +1,2 @@ +48 +-+><<><><><>>>+-<<>->>><<><<-+<>><+<<>+><-+->><< diff --git a/codenet/public_test_cases/p03322/output.0.txt b/codenet/public_test_cases/p03322/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03322/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03322/output.1.txt b/codenet/public_test_cases/p03322/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03322/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03322/output.2.txt b/codenet/public_test_cases/p03322/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03322/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03322/output.3.txt b/codenet/public_test_cases/p03322/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7573eff88e16d06e8be936ff5d8a005d39ad782f --- /dev/null +++ b/codenet/public_test_cases/p03322/output.3.txt @@ -0,0 +1 @@ +475 diff --git a/codenet/public_test_cases/p03323/input.0.txt b/codenet/public_test_cases/p03323/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f64a0cb9f54508ddc866bfe93dac511a5f10974 --- /dev/null +++ b/codenet/public_test_cases/p03323/input.0.txt @@ -0,0 +1 @@ +5 4 diff --git a/codenet/public_test_cases/p03323/input.1.txt b/codenet/public_test_cases/p03323/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0597be34a47ffd6931f649718e1472dc0dc26db --- /dev/null +++ b/codenet/public_test_cases/p03323/input.1.txt @@ -0,0 +1 @@ +11 4 diff --git a/codenet/public_test_cases/p03323/input.2.txt b/codenet/public_test_cases/p03323/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99ca15399f960d2c36bd34b24db2178857aca917 --- /dev/null +++ b/codenet/public_test_cases/p03323/input.2.txt @@ -0,0 +1 @@ +8 8 diff --git a/codenet/public_test_cases/p03323/input.3.txt b/codenet/public_test_cases/p03323/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f64a0cb9f54508ddc866bfe93dac511a5f10974 --- /dev/null +++ b/codenet/public_test_cases/p03323/input.3.txt @@ -0,0 +1 @@ +5 4 diff --git a/codenet/public_test_cases/p03323/output.0.txt b/codenet/public_test_cases/p03323/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54183385deb59b25453c38ce72f56b662fb4c600 --- /dev/null +++ b/codenet/public_test_cases/p03323/output.0.txt @@ -0,0 +1 @@ +Yay! diff --git a/codenet/public_test_cases/p03323/output.1.txt b/codenet/public_test_cases/p03323/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1504ea7bfc17cea50e6965a20bcd0579931ce040 --- /dev/null +++ b/codenet/public_test_cases/p03323/output.1.txt @@ -0,0 +1 @@ +:( diff --git a/codenet/public_test_cases/p03323/output.2.txt b/codenet/public_test_cases/p03323/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..54183385deb59b25453c38ce72f56b662fb4c600 --- /dev/null +++ b/codenet/public_test_cases/p03323/output.2.txt @@ -0,0 +1 @@ +Yay! diff --git a/codenet/public_test_cases/p03323/output.3.txt b/codenet/public_test_cases/p03323/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..54183385deb59b25453c38ce72f56b662fb4c600 --- /dev/null +++ b/codenet/public_test_cases/p03323/output.3.txt @@ -0,0 +1 @@ +Yay! diff --git a/codenet/public_test_cases/p03324/input.0.txt b/codenet/public_test_cases/p03324/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..22045a6074ab1cf173eb962eb580d1c8dfe8b730 --- /dev/null +++ b/codenet/public_test_cases/p03324/input.0.txt @@ -0,0 +1 @@ +0 5 diff --git a/codenet/public_test_cases/p03324/input.1.txt b/codenet/public_test_cases/p03324/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b7b5e51f3cce66a0573bd7da363eb6fc1e3df09 --- /dev/null +++ b/codenet/public_test_cases/p03324/input.1.txt @@ -0,0 +1 @@ +2 85 diff --git a/codenet/public_test_cases/p03324/input.2.txt b/codenet/public_test_cases/p03324/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea95df1358e5e36113f57071f8109f9f152e84a2 --- /dev/null +++ b/codenet/public_test_cases/p03324/input.2.txt @@ -0,0 +1 @@ +1 11 diff --git a/codenet/public_test_cases/p03324/input.3.txt b/codenet/public_test_cases/p03324/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..22045a6074ab1cf173eb962eb580d1c8dfe8b730 --- /dev/null +++ b/codenet/public_test_cases/p03324/input.3.txt @@ -0,0 +1 @@ +0 5 diff --git a/codenet/public_test_cases/p03324/output.0.txt b/codenet/public_test_cases/p03324/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03324/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03324/output.1.txt b/codenet/public_test_cases/p03324/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd45b853df5a7fa90ffe590b428a66cc3a52244d --- /dev/null +++ b/codenet/public_test_cases/p03324/output.1.txt @@ -0,0 +1 @@ +850000 diff --git a/codenet/public_test_cases/p03324/output.2.txt b/codenet/public_test_cases/p03324/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d878b321af84e332e6428a6f19225cd9ce24c176 --- /dev/null +++ b/codenet/public_test_cases/p03324/output.2.txt @@ -0,0 +1 @@ +1100 diff --git a/codenet/public_test_cases/p03324/output.3.txt b/codenet/public_test_cases/p03324/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03324/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03325/input.0.txt b/codenet/public_test_cases/p03325/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e22f6ae2e6bded2b1525d768e297bd006bd641a --- /dev/null +++ b/codenet/public_test_cases/p03325/input.0.txt @@ -0,0 +1,2 @@ +3 +5 2 4 diff --git a/codenet/public_test_cases/p03325/input.1.txt b/codenet/public_test_cases/p03325/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f72741eab0096b18b2ad55e19bd2c24088efbf9a --- /dev/null +++ b/codenet/public_test_cases/p03325/input.1.txt @@ -0,0 +1,2 @@ +10 +2184 2126 1721 1800 1024 2528 3360 1945 1280 1776 diff --git a/codenet/public_test_cases/p03325/input.2.txt b/codenet/public_test_cases/p03325/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0ef8f1fb9f451c553a3ec43ddca4550f6a0de21 --- /dev/null +++ b/codenet/public_test_cases/p03325/input.2.txt @@ -0,0 +1,2 @@ +4 +631 577 243 199 diff --git a/codenet/public_test_cases/p03325/input.3.txt b/codenet/public_test_cases/p03325/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e22f6ae2e6bded2b1525d768e297bd006bd641a --- /dev/null +++ b/codenet/public_test_cases/p03325/input.3.txt @@ -0,0 +1,2 @@ +3 +5 2 4 diff --git a/codenet/public_test_cases/p03325/output.0.txt b/codenet/public_test_cases/p03325/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03325/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03325/output.1.txt b/codenet/public_test_cases/p03325/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2720097dccb441015beb4f75766b9908ad46f5a --- /dev/null +++ b/codenet/public_test_cases/p03325/output.1.txt @@ -0,0 +1 @@ +39 diff --git a/codenet/public_test_cases/p03325/output.2.txt b/codenet/public_test_cases/p03325/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03325/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03325/output.3.txt b/codenet/public_test_cases/p03325/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03325/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03326/input.0.txt b/codenet/public_test_cases/p03326/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ffcb2f256d3622c0941fc2efbd908edb2744c70 --- /dev/null +++ b/codenet/public_test_cases/p03326/input.0.txt @@ -0,0 +1,6 @@ +5 3 +3 1 4 +1 5 9 +2 6 5 +3 5 8 +9 7 9 diff --git a/codenet/public_test_cases/p03326/input.1.txt b/codenet/public_test_cases/p03326/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a565204b1a498a41dd4eafc8f30be9c90380fa --- /dev/null +++ b/codenet/public_test_cases/p03326/input.1.txt @@ -0,0 +1,6 @@ +5 3 +1 -2 3 +-4 5 -6 +7 -8 -9 +-10 11 -12 +13 -14 15 diff --git a/codenet/public_test_cases/p03326/input.2.txt b/codenet/public_test_cases/p03326/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..da9e2e0f6ab9375f4b3cabb09756f0d347bc725a --- /dev/null +++ b/codenet/public_test_cases/p03326/input.2.txt @@ -0,0 +1,11 @@ +10 5 +10 -80 21 +23 8 38 +-94 28 11 +-26 -2 18 +-69 72 79 +-26 -86 -54 +-72 -50 59 +21 65 -32 +40 -94 87 +-62 18 82 diff --git a/codenet/public_test_cases/p03326/input.3.txt b/codenet/public_test_cases/p03326/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ffcb2f256d3622c0941fc2efbd908edb2744c70 --- /dev/null +++ b/codenet/public_test_cases/p03326/input.3.txt @@ -0,0 +1,6 @@ +5 3 +3 1 4 +1 5 9 +2 6 5 +3 5 8 +9 7 9 diff --git a/codenet/public_test_cases/p03326/input.4.txt b/codenet/public_test_cases/p03326/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..81873d4d1f0a4b0656797176c5a6b986f38d1df6 --- /dev/null +++ b/codenet/public_test_cases/p03326/input.4.txt @@ -0,0 +1,4 @@ +3 2 +2000000000 -9000000000 4000000000 +7000000000 -5000000000 3000000000 +6000000000 -1000000000 8000000000 diff --git a/codenet/public_test_cases/p03326/output.0.txt b/codenet/public_test_cases/p03326/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b91e0e1f8dddaac700b51aa7a66f29fc135a02 --- /dev/null +++ b/codenet/public_test_cases/p03326/output.0.txt @@ -0,0 +1 @@ +56 diff --git a/codenet/public_test_cases/p03326/output.1.txt b/codenet/public_test_cases/p03326/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb1e7bc86996a80d4a16529b990adda1d3434c92 --- /dev/null +++ b/codenet/public_test_cases/p03326/output.1.txt @@ -0,0 +1 @@ +54 diff --git a/codenet/public_test_cases/p03326/output.2.txt b/codenet/public_test_cases/p03326/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..231a7d578ebb904044b4edce8308d1d55545feda --- /dev/null +++ b/codenet/public_test_cases/p03326/output.2.txt @@ -0,0 +1 @@ +638 diff --git a/codenet/public_test_cases/p03326/output.3.txt b/codenet/public_test_cases/p03326/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b91e0e1f8dddaac700b51aa7a66f29fc135a02 --- /dev/null +++ b/codenet/public_test_cases/p03326/output.3.txt @@ -0,0 +1 @@ +56 diff --git a/codenet/public_test_cases/p03326/output.4.txt b/codenet/public_test_cases/p03326/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3064192cbf67d0fcae52f8cb4dae3e350008844 --- /dev/null +++ b/codenet/public_test_cases/p03326/output.4.txt @@ -0,0 +1 @@ +30000000000 diff --git a/codenet/public_test_cases/p03327/input.0.txt b/codenet/public_test_cases/p03327/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6905f8ba447c0116590e38b2430151b506b1611 --- /dev/null +++ b/codenet/public_test_cases/p03327/input.0.txt @@ -0,0 +1 @@ +999 diff --git a/codenet/public_test_cases/p03327/input.1.txt b/codenet/public_test_cases/p03327/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b33d238dab9943201aaf267f701e8ea5fc9268 --- /dev/null +++ b/codenet/public_test_cases/p03327/input.1.txt @@ -0,0 +1 @@ +1000 diff --git a/codenet/public_test_cases/p03327/input.2.txt b/codenet/public_test_cases/p03327/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c39429ed30fd40cf50c3e7815c081f88de7e657 --- /dev/null +++ b/codenet/public_test_cases/p03327/input.2.txt @@ -0,0 +1 @@ +1481 diff --git a/codenet/public_test_cases/p03327/input.3.txt b/codenet/public_test_cases/p03327/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6905f8ba447c0116590e38b2430151b506b1611 --- /dev/null +++ b/codenet/public_test_cases/p03327/input.3.txt @@ -0,0 +1 @@ +999 diff --git a/codenet/public_test_cases/p03327/output.0.txt b/codenet/public_test_cases/p03327/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p03327/output.0.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p03327/output.1.txt b/codenet/public_test_cases/p03327/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c4d2ac5df6f323a0f9da3acec98edf90e73a765 --- /dev/null +++ b/codenet/public_test_cases/p03327/output.1.txt @@ -0,0 +1 @@ +ABD diff --git a/codenet/public_test_cases/p03327/output.2.txt b/codenet/public_test_cases/p03327/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c4d2ac5df6f323a0f9da3acec98edf90e73a765 --- /dev/null +++ b/codenet/public_test_cases/p03327/output.2.txt @@ -0,0 +1 @@ +ABD diff --git a/codenet/public_test_cases/p03327/output.3.txt b/codenet/public_test_cases/p03327/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p03327/output.3.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p03328/input.0.txt b/codenet/public_test_cases/p03328/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d139cb85dcfdfef0020af1c86c56edc900e4c033 --- /dev/null +++ b/codenet/public_test_cases/p03328/input.0.txt @@ -0,0 +1 @@ +8 13 diff --git a/codenet/public_test_cases/p03328/input.1.txt b/codenet/public_test_cases/p03328/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..39b0fdf3d60cff61cb5aad927a480200051ca65f --- /dev/null +++ b/codenet/public_test_cases/p03328/input.1.txt @@ -0,0 +1 @@ +54 65 diff --git a/codenet/public_test_cases/p03328/input.2.txt b/codenet/public_test_cases/p03328/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d139cb85dcfdfef0020af1c86c56edc900e4c033 --- /dev/null +++ b/codenet/public_test_cases/p03328/input.2.txt @@ -0,0 +1 @@ +8 13 diff --git a/codenet/public_test_cases/p03328/output.0.txt b/codenet/public_test_cases/p03328/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03328/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03328/output.1.txt b/codenet/public_test_cases/p03328/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03328/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03328/output.2.txt b/codenet/public_test_cases/p03328/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03328/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03329/input.0.txt b/codenet/public_test_cases/p03329/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c75acbe2ff1053360e76c0ff6012517cbd1dec9b --- /dev/null +++ b/codenet/public_test_cases/p03329/input.0.txt @@ -0,0 +1 @@ +127 diff --git a/codenet/public_test_cases/p03329/input.1.txt b/codenet/public_test_cases/p03329/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03329/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03329/input.2.txt b/codenet/public_test_cases/p03329/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f48a7d086080b9388a70410d25ecee834176ed7 --- /dev/null +++ b/codenet/public_test_cases/p03329/input.2.txt @@ -0,0 +1 @@ +44852 diff --git a/codenet/public_test_cases/p03329/input.3.txt b/codenet/public_test_cases/p03329/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c75acbe2ff1053360e76c0ff6012517cbd1dec9b --- /dev/null +++ b/codenet/public_test_cases/p03329/input.3.txt @@ -0,0 +1 @@ +127 diff --git a/codenet/public_test_cases/p03329/output.0.txt b/codenet/public_test_cases/p03329/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03329/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03329/output.1.txt b/codenet/public_test_cases/p03329/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03329/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03329/output.2.txt b/codenet/public_test_cases/p03329/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03329/output.2.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03329/output.3.txt b/codenet/public_test_cases/p03329/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03329/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03330/input.0.txt b/codenet/public_test_cases/p03330/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d9af31cde37ac0977d6ce60a8c80f75825af63 --- /dev/null +++ b/codenet/public_test_cases/p03330/input.0.txt @@ -0,0 +1,6 @@ +2 3 +0 1 1 +1 0 1 +1 4 0 +1 2 +3 3 diff --git a/codenet/public_test_cases/p03330/input.1.txt b/codenet/public_test_cases/p03330/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99af356c3a769b75565ff9c31154bb2320069bed --- /dev/null +++ b/codenet/public_test_cases/p03330/input.1.txt @@ -0,0 +1,8 @@ +4 3 +0 12 71 +81 0 53 +14 92 0 +1 1 2 1 +2 1 1 2 +2 2 1 3 +1 1 2 2 diff --git a/codenet/public_test_cases/p03330/input.2.txt b/codenet/public_test_cases/p03330/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..26d9af31cde37ac0977d6ce60a8c80f75825af63 --- /dev/null +++ b/codenet/public_test_cases/p03330/input.2.txt @@ -0,0 +1,6 @@ +2 3 +0 1 1 +1 0 1 +1 4 0 +1 2 +3 3 diff --git a/codenet/public_test_cases/p03330/output.0.txt b/codenet/public_test_cases/p03330/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03330/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03330/output.1.txt b/codenet/public_test_cases/p03330/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..43d371afdd3dc0e2254a507b5a6d7371e10e9860 --- /dev/null +++ b/codenet/public_test_cases/p03330/output.1.txt @@ -0,0 +1 @@ +428 diff --git a/codenet/public_test_cases/p03330/output.2.txt b/codenet/public_test_cases/p03330/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03330/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03331/input.0.txt b/codenet/public_test_cases/p03331/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03331/input.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03331/input.1.txt b/codenet/public_test_cases/p03331/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03331/input.1.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03331/input.2.txt b/codenet/public_test_cases/p03331/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7393e847d34d19031ee0ba57df63e4d0ccb4fb2 --- /dev/null +++ b/codenet/public_test_cases/p03331/input.2.txt @@ -0,0 +1 @@ +100000 diff --git a/codenet/public_test_cases/p03331/output.0.txt b/codenet/public_test_cases/p03331/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03331/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03331/output.1.txt b/codenet/public_test_cases/p03331/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03331/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03331/output.2.txt b/codenet/public_test_cases/p03331/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03331/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03332/input.0.txt b/codenet/public_test_cases/p03332/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..872e540f7e551e7c34ec133e610c70688cd6569d --- /dev/null +++ b/codenet/public_test_cases/p03332/input.0.txt @@ -0,0 +1 @@ +4 1 2 5 diff --git a/codenet/public_test_cases/p03332/input.1.txt b/codenet/public_test_cases/p03332/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d90004750a81b4b15bf27033452943697b2df70d --- /dev/null +++ b/codenet/public_test_cases/p03332/input.1.txt @@ -0,0 +1 @@ +90081 33447 90629 6391049189 diff --git a/codenet/public_test_cases/p03332/input.2.txt b/codenet/public_test_cases/p03332/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..598f7c45d55becf52c24bee095f6df8b2d56f860 --- /dev/null +++ b/codenet/public_test_cases/p03332/input.2.txt @@ -0,0 +1 @@ +2 5 6 0 diff --git a/codenet/public_test_cases/p03332/input.3.txt b/codenet/public_test_cases/p03332/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..872e540f7e551e7c34ec133e610c70688cd6569d --- /dev/null +++ b/codenet/public_test_cases/p03332/input.3.txt @@ -0,0 +1 @@ +4 1 2 5 diff --git a/codenet/public_test_cases/p03332/output.0.txt b/codenet/public_test_cases/p03332/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03332/output.0.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03332/output.1.txt b/codenet/public_test_cases/p03332/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af7845e78e099ecf41ebd467b641d775e423169b --- /dev/null +++ b/codenet/public_test_cases/p03332/output.1.txt @@ -0,0 +1 @@ +577742975 diff --git a/codenet/public_test_cases/p03332/output.2.txt b/codenet/public_test_cases/p03332/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03332/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03332/output.3.txt b/codenet/public_test_cases/p03332/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03332/output.3.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03333/input.0.txt b/codenet/public_test_cases/p03333/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..550f6d32c31f065a252120cf337b44720e3372cd --- /dev/null +++ b/codenet/public_test_cases/p03333/input.0.txt @@ -0,0 +1,4 @@ +3 +-5 1 +3 7 +-4 -2 diff --git a/codenet/public_test_cases/p03333/input.1.txt b/codenet/public_test_cases/p03333/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf3de8936aec141cfc3745bbff8bf1b8ea264439 --- /dev/null +++ b/codenet/public_test_cases/p03333/input.1.txt @@ -0,0 +1,4 @@ +3 +1 2 +3 4 +5 6 diff --git a/codenet/public_test_cases/p03333/input.2.txt b/codenet/public_test_cases/p03333/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..550f6d32c31f065a252120cf337b44720e3372cd --- /dev/null +++ b/codenet/public_test_cases/p03333/input.2.txt @@ -0,0 +1,4 @@ +3 +-5 1 +3 7 +-4 -2 diff --git a/codenet/public_test_cases/p03333/input.3.txt b/codenet/public_test_cases/p03333/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..57302482ddca4c469d77a00191fbd37806772eaf --- /dev/null +++ b/codenet/public_test_cases/p03333/input.3.txt @@ -0,0 +1,6 @@ +5 +-2 0 +-2 0 +7 8 +9 10 +-2 -1 diff --git a/codenet/public_test_cases/p03333/output.0.txt b/codenet/public_test_cases/p03333/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03333/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03333/output.1.txt b/codenet/public_test_cases/p03333/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03333/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03333/output.2.txt b/codenet/public_test_cases/p03333/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03333/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03333/output.3.txt b/codenet/public_test_cases/p03333/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p03333/output.3.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p03334/input.0.txt b/codenet/public_test_cases/p03334/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3b04ccdba4df31d78b9f5f65b0d7f77ce8b40d7 --- /dev/null +++ b/codenet/public_test_cases/p03334/input.0.txt @@ -0,0 +1 @@ +2 1 2 diff --git a/codenet/public_test_cases/p03334/input.1.txt b/codenet/public_test_cases/p03334/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac99b57fb36f4cfbc71cf64e84ca4189bf95314 --- /dev/null +++ b/codenet/public_test_cases/p03334/input.1.txt @@ -0,0 +1 @@ +3 1 5 diff --git a/codenet/public_test_cases/p03334/input.2.txt b/codenet/public_test_cases/p03334/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3b04ccdba4df31d78b9f5f65b0d7f77ce8b40d7 --- /dev/null +++ b/codenet/public_test_cases/p03334/input.2.txt @@ -0,0 +1 @@ +2 1 2 diff --git a/codenet/public_test_cases/p03334/output.0.txt b/codenet/public_test_cases/p03334/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0a2a4bceadc92f70b9406f733126016de06309f --- /dev/null +++ b/codenet/public_test_cases/p03334/output.0.txt @@ -0,0 +1,4 @@ +0 0 +0 2 +2 0 +2 2 diff --git a/codenet/public_test_cases/p03334/output.1.txt b/codenet/public_test_cases/p03334/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e987a5d96aeb25f6d6d82a140df315c1bef39b2f --- /dev/null +++ b/codenet/public_test_cases/p03334/output.1.txt @@ -0,0 +1,9 @@ +0 0 +0 2 +0 4 +1 1 +1 3 +1 5 +2 0 +2 2 +2 4 diff --git a/codenet/public_test_cases/p03334/output.2.txt b/codenet/public_test_cases/p03334/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0a2a4bceadc92f70b9406f733126016de06309f --- /dev/null +++ b/codenet/public_test_cases/p03334/output.2.txt @@ -0,0 +1,4 @@ +0 0 +0 2 +2 0 +2 2 diff --git a/codenet/public_test_cases/p03335/input.0.txt b/codenet/public_test_cases/p03335/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd8d2849cae956cf83d02c85de1a890e5748dfbc --- /dev/null +++ b/codenet/public_test_cases/p03335/input.0.txt @@ -0,0 +1,7 @@ +4 3 +2 1 +3 1 +4 1 +2 3 +3 4 +4 2 diff --git a/codenet/public_test_cases/p03335/input.1.txt b/codenet/public_test_cases/p03335/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ebeb8254c7cea0781a9e8541d4af2c8d59628ad --- /dev/null +++ b/codenet/public_test_cases/p03335/input.1.txt @@ -0,0 +1,8 @@ +5 3 +1 2 +1 3 +3 4 +3 5 +2 4 +3 5 +1 5 diff --git a/codenet/public_test_cases/p03335/input.2.txt b/codenet/public_test_cases/p03335/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..811396824d153d706d7ffb9c01a71c39b7a373d5 --- /dev/null +++ b/codenet/public_test_cases/p03335/input.2.txt @@ -0,0 +1,10 @@ +6 4 +1 2 +2 3 +1 4 +4 5 +4 6 +2 4 +3 6 +5 6 +4 5 diff --git a/codenet/public_test_cases/p03335/input.3.txt b/codenet/public_test_cases/p03335/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd8d2849cae956cf83d02c85de1a890e5748dfbc --- /dev/null +++ b/codenet/public_test_cases/p03335/input.3.txt @@ -0,0 +1,7 @@ +4 3 +2 1 +3 1 +4 1 +2 3 +3 4 +4 2 diff --git a/codenet/public_test_cases/p03335/output.0.txt b/codenet/public_test_cases/p03335/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45376070850d658d8f14035bee9c1c9404e4e177 --- /dev/null +++ b/codenet/public_test_cases/p03335/output.0.txt @@ -0,0 +1,4 @@ +6 +2 3 +3 4 +4 2 diff --git a/codenet/public_test_cases/p03335/output.1.txt b/codenet/public_test_cases/p03335/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c963576c597bce8bfd7bdbaf120e5a0a5767b48a --- /dev/null +++ b/codenet/public_test_cases/p03335/output.1.txt @@ -0,0 +1,4 @@ +6 +2 4 +3 5 +5 1 diff --git a/codenet/public_test_cases/p03335/output.2.txt b/codenet/public_test_cases/p03335/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..66ff61bd538255e83e93ebfbf12fae2303f95c69 --- /dev/null +++ b/codenet/public_test_cases/p03335/output.2.txt @@ -0,0 +1,5 @@ +9 +2 4 +6 3 +5 6 +4 5 diff --git a/codenet/public_test_cases/p03335/output.3.txt b/codenet/public_test_cases/p03335/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45376070850d658d8f14035bee9c1c9404e4e177 --- /dev/null +++ b/codenet/public_test_cases/p03335/output.3.txt @@ -0,0 +1,4 @@ +6 +2 3 +3 4 +4 2 diff --git a/codenet/public_test_cases/p03336/input.0.txt b/codenet/public_test_cases/p03336/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c632a9169941ae7d02f4a6f2549e83489ab71ea9 --- /dev/null +++ b/codenet/public_test_cases/p03336/input.0.txt @@ -0,0 +1,3 @@ +2 3 3 +11 +101 diff --git a/codenet/public_test_cases/p03336/input.1.txt b/codenet/public_test_cases/p03336/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c632a9169941ae7d02f4a6f2549e83489ab71ea9 --- /dev/null +++ b/codenet/public_test_cases/p03336/input.1.txt @@ -0,0 +1,3 @@ +2 3 3 +11 +101 diff --git a/codenet/public_test_cases/p03336/input.2.txt b/codenet/public_test_cases/p03336/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..39212ecd3e69e4142a67dd10ccb300253e578da2 --- /dev/null +++ b/codenet/public_test_cases/p03336/input.2.txt @@ -0,0 +1,3 @@ +10 10 10 +1100110011 +1011001101 diff --git a/codenet/public_test_cases/p03336/input.3.txt b/codenet/public_test_cases/p03336/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..de4f653be2b3239d97f255b855638bc4e68915d0 --- /dev/null +++ b/codenet/public_test_cases/p03336/input.3.txt @@ -0,0 +1,3 @@ +5 8 3 +10101 +10101001 diff --git a/codenet/public_test_cases/p03336/output.0.txt b/codenet/public_test_cases/p03336/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a764b1586c1df5a10f8f476052b51a6d506a5e5a --- /dev/null +++ b/codenet/public_test_cases/p03336/output.0.txt @@ -0,0 +1,2 @@ +10000 +10010 diff --git a/codenet/public_test_cases/p03336/output.1.txt b/codenet/public_test_cases/p03336/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a764b1586c1df5a10f8f476052b51a6d506a5e5a --- /dev/null +++ b/codenet/public_test_cases/p03336/output.1.txt @@ -0,0 +1,2 @@ +10000 +10010 diff --git a/codenet/public_test_cases/p03336/output.2.txt b/codenet/public_test_cases/p03336/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b69f06aa0538148f7d4eaf9b569b7e16f2f029d5 --- /dev/null +++ b/codenet/public_test_cases/p03336/output.2.txt @@ -0,0 +1,2 @@ +10000100000010001000 +10000100000000100010 diff --git a/codenet/public_test_cases/p03336/output.3.txt b/codenet/public_test_cases/p03336/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f7a7722ba4ee07c6cc0af2188f09e5eb6eddd99 --- /dev/null +++ b/codenet/public_test_cases/p03336/output.3.txt @@ -0,0 +1,2 @@ +100000 +10110100 diff --git a/codenet/public_test_cases/p03337/input.0.txt b/codenet/public_test_cases/p03337/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p03337/input.0.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p03337/input.1.txt b/codenet/public_test_cases/p03337/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b748e2dcfcbc7db3aae214293cef6cb2afbd0a65 --- /dev/null +++ b/codenet/public_test_cases/p03337/input.1.txt @@ -0,0 +1 @@ +0 0 diff --git a/codenet/public_test_cases/p03337/input.2.txt b/codenet/public_test_cases/p03337/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p03337/input.2.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p03337/input.3.txt b/codenet/public_test_cases/p03337/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c88d2d4718379b02aed2e9752ed748500759856 --- /dev/null +++ b/codenet/public_test_cases/p03337/input.3.txt @@ -0,0 +1 @@ +4 -2 diff --git a/codenet/public_test_cases/p03337/output.0.txt b/codenet/public_test_cases/p03337/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03337/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03337/output.1.txt b/codenet/public_test_cases/p03337/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03337/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03337/output.2.txt b/codenet/public_test_cases/p03337/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03337/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03337/output.3.txt b/codenet/public_test_cases/p03337/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03337/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03338/input.0.txt b/codenet/public_test_cases/p03338/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c734ad4b60de4349d6de1d53831ce51c4521a17c --- /dev/null +++ b/codenet/public_test_cases/p03338/input.0.txt @@ -0,0 +1,2 @@ +6 +aabbca diff --git a/codenet/public_test_cases/p03338/input.1.txt b/codenet/public_test_cases/p03338/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..135919156dac0447eec875af9be68b79a9288add --- /dev/null +++ b/codenet/public_test_cases/p03338/input.1.txt @@ -0,0 +1,2 @@ +10 +aaaaaaaaaa diff --git a/codenet/public_test_cases/p03338/input.2.txt b/codenet/public_test_cases/p03338/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c734ad4b60de4349d6de1d53831ce51c4521a17c --- /dev/null +++ b/codenet/public_test_cases/p03338/input.2.txt @@ -0,0 +1,2 @@ +6 +aabbca diff --git a/codenet/public_test_cases/p03338/input.3.txt b/codenet/public_test_cases/p03338/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fb68e9369da90162c52271ed4d62a78a3db8f1c --- /dev/null +++ b/codenet/public_test_cases/p03338/input.3.txt @@ -0,0 +1,2 @@ +45 +tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir diff --git a/codenet/public_test_cases/p03338/output.0.txt b/codenet/public_test_cases/p03338/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03338/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03338/output.1.txt b/codenet/public_test_cases/p03338/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03338/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03338/output.2.txt b/codenet/public_test_cases/p03338/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03338/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03338/output.3.txt b/codenet/public_test_cases/p03338/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03338/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03339/input.0.txt b/codenet/public_test_cases/p03339/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c066074755dbcad5a6d765d4463fe27a3b3789c8 --- /dev/null +++ b/codenet/public_test_cases/p03339/input.0.txt @@ -0,0 +1,2 @@ +5 +WEEWW diff --git a/codenet/public_test_cases/p03339/output.0.txt b/codenet/public_test_cases/p03339/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03339/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03341/input.0.txt b/codenet/public_test_cases/p03341/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c066074755dbcad5a6d765d4463fe27a3b3789c8 --- /dev/null +++ b/codenet/public_test_cases/p03341/input.0.txt @@ -0,0 +1,2 @@ +5 +WEEWW diff --git a/codenet/public_test_cases/p03341/input.1.txt b/codenet/public_test_cases/p03341/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c56465da2254fd5069c1487b469cbc3c15e5cf12 --- /dev/null +++ b/codenet/public_test_cases/p03341/input.1.txt @@ -0,0 +1,2 @@ +12 +WEWEWEEEWWWE diff --git a/codenet/public_test_cases/p03341/input.2.txt b/codenet/public_test_cases/p03341/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c066074755dbcad5a6d765d4463fe27a3b3789c8 --- /dev/null +++ b/codenet/public_test_cases/p03341/input.2.txt @@ -0,0 +1,2 @@ +5 +WEEWW diff --git a/codenet/public_test_cases/p03341/input.3.txt b/codenet/public_test_cases/p03341/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd56439db90d79e0a9320bac7c2c06369051bb27 --- /dev/null +++ b/codenet/public_test_cases/p03341/input.3.txt @@ -0,0 +1,2 @@ +8 +WWWWWEEE diff --git a/codenet/public_test_cases/p03341/output.0.txt b/codenet/public_test_cases/p03341/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03341/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03341/output.1.txt b/codenet/public_test_cases/p03341/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03341/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03341/output.2.txt b/codenet/public_test_cases/p03341/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03341/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03341/output.3.txt b/codenet/public_test_cases/p03341/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03341/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03343/input.0.txt b/codenet/public_test_cases/p03343/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f8ccf4a5de66ef1f7bddec67fa2cd60ebb6d658 --- /dev/null +++ b/codenet/public_test_cases/p03343/input.0.txt @@ -0,0 +1,2 @@ +5 3 2 +4 3 1 5 2 diff --git a/codenet/public_test_cases/p03343/input.1.txt b/codenet/public_test_cases/p03343/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4aa190fcb1c1dbb0d7332de9d6f8b60caf01890b --- /dev/null +++ b/codenet/public_test_cases/p03343/input.1.txt @@ -0,0 +1,2 @@ +11 7 5 +24979445 861648772 623690081 433933447 476190629 262703497 211047202 971407775 628894325 731963982 822804784 diff --git a/codenet/public_test_cases/p03343/input.2.txt b/codenet/public_test_cases/p03343/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f8ccf4a5de66ef1f7bddec67fa2cd60ebb6d658 --- /dev/null +++ b/codenet/public_test_cases/p03343/input.2.txt @@ -0,0 +1,2 @@ +5 3 2 +4 3 1 5 2 diff --git a/codenet/public_test_cases/p03343/input.3.txt b/codenet/public_test_cases/p03343/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..127de9bfef75be460d72d203f8cdc8a194175b11 --- /dev/null +++ b/codenet/public_test_cases/p03343/input.3.txt @@ -0,0 +1,2 @@ +10 1 6 +1 1 2 3 5 8 13 21 34 55 diff --git a/codenet/public_test_cases/p03343/output.0.txt b/codenet/public_test_cases/p03343/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03343/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03343/output.1.txt b/codenet/public_test_cases/p03343/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed0506e198c0987cae4ab40d7a7195e6d3ed2538 --- /dev/null +++ b/codenet/public_test_cases/p03343/output.1.txt @@ -0,0 +1 @@ +451211184 diff --git a/codenet/public_test_cases/p03343/output.2.txt b/codenet/public_test_cases/p03343/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03343/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03343/output.3.txt b/codenet/public_test_cases/p03343/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03343/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03344/input.0.txt b/codenet/public_test_cases/p03344/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fc356fc1775ac8697bfdd457c4e78c7bc02c3e0 --- /dev/null +++ b/codenet/public_test_cases/p03344/input.0.txt @@ -0,0 +1,10 @@ +4 5 +3 1 +1 2 +4 1 +6 2 +1 2 +2 3 +2 4 +1 4 +3 4 diff --git a/codenet/public_test_cases/p03344/input.1.txt b/codenet/public_test_cases/p03344/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..926e65de65d1ca2dde5f82d6359e2607e6b7d489 --- /dev/null +++ b/codenet/public_test_cases/p03344/input.1.txt @@ -0,0 +1,14 @@ +5 8 +6 4 +15 13 +15 19 +15 1 +20 7 +1 3 +1 4 +1 5 +2 3 +2 4 +2 5 +3 5 +4 5 diff --git a/codenet/public_test_cases/p03344/input.2.txt b/codenet/public_test_cases/p03344/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d80887cff57850f7d2b7f277ec7f5d636ec74a6 --- /dev/null +++ b/codenet/public_test_cases/p03344/input.2.txt @@ -0,0 +1,20 @@ +9 10 +131 2 +98 79 +242 32 +231 38 +382 82 +224 22 +140 88 +209 70 +164 64 +6 8 +1 6 +1 4 +1 3 +4 7 +4 9 +3 7 +3 9 +5 9 +2 5 diff --git a/codenet/public_test_cases/p03344/input.3.txt b/codenet/public_test_cases/p03344/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fc356fc1775ac8697bfdd457c4e78c7bc02c3e0 --- /dev/null +++ b/codenet/public_test_cases/p03344/input.3.txt @@ -0,0 +1,10 @@ +4 5 +3 1 +1 2 +4 1 +6 2 +1 2 +2 3 +2 4 +1 4 +3 4 diff --git a/codenet/public_test_cases/p03344/output.0.txt b/codenet/public_test_cases/p03344/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03344/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03344/output.1.txt b/codenet/public_test_cases/p03344/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c739b42c4d2ce23786c5350641d0adbf5fa7d6b2 --- /dev/null +++ b/codenet/public_test_cases/p03344/output.1.txt @@ -0,0 +1 @@ +44 diff --git a/codenet/public_test_cases/p03344/output.2.txt b/codenet/public_test_cases/p03344/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..373892ba356c11210a3d520b39b203438a84da07 --- /dev/null +++ b/codenet/public_test_cases/p03344/output.2.txt @@ -0,0 +1 @@ +582 diff --git a/codenet/public_test_cases/p03344/output.3.txt b/codenet/public_test_cases/p03344/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03344/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03345/input.0.txt b/codenet/public_test_cases/p03345/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1d1c76e40ebc8469e98d3b6eaba358bc4a2f9e1 --- /dev/null +++ b/codenet/public_test_cases/p03345/input.0.txt @@ -0,0 +1 @@ +1 2 3 1 diff --git a/codenet/public_test_cases/p03345/input.1.txt b/codenet/public_test_cases/p03345/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1d1c76e40ebc8469e98d3b6eaba358bc4a2f9e1 --- /dev/null +++ b/codenet/public_test_cases/p03345/input.1.txt @@ -0,0 +1 @@ +1 2 3 1 diff --git a/codenet/public_test_cases/p03345/input.2.txt b/codenet/public_test_cases/p03345/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..51d1cafe1b5eb131ca0907de2abda83cdd237e7a --- /dev/null +++ b/codenet/public_test_cases/p03345/input.2.txt @@ -0,0 +1 @@ +2 3 2 0 diff --git a/codenet/public_test_cases/p03345/input.3.txt b/codenet/public_test_cases/p03345/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c4e430d0ce9570e61d76187960ef7f4d07e6507 --- /dev/null +++ b/codenet/public_test_cases/p03345/input.3.txt @@ -0,0 +1 @@ +1000000000 1000000000 1000000000 1000000000000000000 diff --git a/codenet/public_test_cases/p03345/output.0.txt b/codenet/public_test_cases/p03345/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03345/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03345/output.1.txt b/codenet/public_test_cases/p03345/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03345/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03345/output.2.txt b/codenet/public_test_cases/p03345/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03345/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03345/output.3.txt b/codenet/public_test_cases/p03345/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03345/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03346/input.0.txt b/codenet/public_test_cases/p03346/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db28a87b57b4005398b3a38ee235f7b94206c521 --- /dev/null +++ b/codenet/public_test_cases/p03346/input.0.txt @@ -0,0 +1,5 @@ +4 +1 +3 +2 +4 diff --git a/codenet/public_test_cases/p03346/input.1.txt b/codenet/public_test_cases/p03346/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db28a87b57b4005398b3a38ee235f7b94206c521 --- /dev/null +++ b/codenet/public_test_cases/p03346/input.1.txt @@ -0,0 +1,5 @@ +4 +1 +3 +2 +4 diff --git a/codenet/public_test_cases/p03346/input.2.txt b/codenet/public_test_cases/p03346/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..85fd6a14c44e69a7a49ccd4585e53f41fef0d2c0 --- /dev/null +++ b/codenet/public_test_cases/p03346/input.2.txt @@ -0,0 +1,7 @@ +6 +3 +2 +5 +1 +4 +6 diff --git a/codenet/public_test_cases/p03346/input.3.txt b/codenet/public_test_cases/p03346/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e1f35333069478223436b5205c435a6af90f560 --- /dev/null +++ b/codenet/public_test_cases/p03346/input.3.txt @@ -0,0 +1,9 @@ +8 +6 +3 +1 +2 +7 +4 +8 +5 diff --git a/codenet/public_test_cases/p03346/output.0.txt b/codenet/public_test_cases/p03346/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03346/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03346/output.1.txt b/codenet/public_test_cases/p03346/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03346/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03346/output.2.txt b/codenet/public_test_cases/p03346/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03346/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03346/output.3.txt b/codenet/public_test_cases/p03346/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03346/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03347/input.0.txt b/codenet/public_test_cases/p03347/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded0e7ca12440753282f05dcc8b5d8ca0903d9c7 --- /dev/null +++ b/codenet/public_test_cases/p03347/input.0.txt @@ -0,0 +1,5 @@ +4 +0 +1 +1 +2 diff --git a/codenet/public_test_cases/p03347/input.1.txt b/codenet/public_test_cases/p03347/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f63e15fc148c044ac1e72e369cb2f5bdb54da43b --- /dev/null +++ b/codenet/public_test_cases/p03347/input.1.txt @@ -0,0 +1,4 @@ +3 +1 +2 +1 diff --git a/codenet/public_test_cases/p03347/input.2.txt b/codenet/public_test_cases/p03347/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..be8a1757041023045428dfdcf201f68516595d3d --- /dev/null +++ b/codenet/public_test_cases/p03347/input.2.txt @@ -0,0 +1,10 @@ +9 +0 +1 +1 +0 +1 +2 +2 +1 +2 diff --git a/codenet/public_test_cases/p03347/input.3.txt b/codenet/public_test_cases/p03347/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded0e7ca12440753282f05dcc8b5d8ca0903d9c7 --- /dev/null +++ b/codenet/public_test_cases/p03347/input.3.txt @@ -0,0 +1,5 @@ +4 +0 +1 +1 +2 diff --git a/codenet/public_test_cases/p03347/output.0.txt b/codenet/public_test_cases/p03347/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03347/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03347/output.1.txt b/codenet/public_test_cases/p03347/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03347/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03347/output.2.txt b/codenet/public_test_cases/p03347/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03347/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03347/output.3.txt b/codenet/public_test_cases/p03347/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03347/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03348/input.0.txt b/codenet/public_test_cases/p03348/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec1c340feac463e5e3b91fee553af0432ee9a2bd --- /dev/null +++ b/codenet/public_test_cases/p03348/input.0.txt @@ -0,0 +1,5 @@ +5 +1 2 +2 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p03348/input.1.txt b/codenet/public_test_cases/p03348/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1041dbde674cc1b8261422378f982ba2e19c83c7 --- /dev/null +++ b/codenet/public_test_cases/p03348/input.1.txt @@ -0,0 +1,8 @@ +8 +1 2 +2 3 +4 3 +5 4 +6 7 +6 8 +3 6 diff --git a/codenet/public_test_cases/p03348/input.2.txt b/codenet/public_test_cases/p03348/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2c47975b2e67cbc613dbf116860d768c247b92b --- /dev/null +++ b/codenet/public_test_cases/p03348/input.2.txt @@ -0,0 +1,13 @@ +13 +5 6 +6 4 +2 8 +4 7 +8 9 +3 2 +10 4 +11 10 +2 4 +13 10 +1 8 +12 1 diff --git a/codenet/public_test_cases/p03348/input.3.txt b/codenet/public_test_cases/p03348/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec1c340feac463e5e3b91fee553af0432ee9a2bd --- /dev/null +++ b/codenet/public_test_cases/p03348/input.3.txt @@ -0,0 +1,5 @@ +5 +1 2 +2 3 +3 4 +3 5 diff --git a/codenet/public_test_cases/p03348/input.4.txt b/codenet/public_test_cases/p03348/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d7c4f1e58a0745b917b6266a4bd10c62a409e79 --- /dev/null +++ b/codenet/public_test_cases/p03348/input.4.txt @@ -0,0 +1,10 @@ +10 +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +3 8 +5 9 +3 10 diff --git a/codenet/public_test_cases/p03348/output.0.txt b/codenet/public_test_cases/p03348/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0efd67f9502e63cb033cb651e65e025b6e3a5cb2 --- /dev/null +++ b/codenet/public_test_cases/p03348/output.0.txt @@ -0,0 +1 @@ +2 4 diff --git a/codenet/public_test_cases/p03348/output.1.txt b/codenet/public_test_cases/p03348/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebcee1a506db729ea7b0e0b6e9b0be36806d16bd --- /dev/null +++ b/codenet/public_test_cases/p03348/output.1.txt @@ -0,0 +1 @@ +3 4 diff --git a/codenet/public_test_cases/p03348/output.2.txt b/codenet/public_test_cases/p03348/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e18a59c6f617145ff60c20773faa83e86c12ffe --- /dev/null +++ b/codenet/public_test_cases/p03348/output.2.txt @@ -0,0 +1 @@ +4 12 diff --git a/codenet/public_test_cases/p03348/output.3.txt b/codenet/public_test_cases/p03348/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0efd67f9502e63cb033cb651e65e025b6e3a5cb2 --- /dev/null +++ b/codenet/public_test_cases/p03348/output.3.txt @@ -0,0 +1 @@ +2 4 diff --git a/codenet/public_test_cases/p03348/output.4.txt b/codenet/public_test_cases/p03348/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9290688fa7995d643a841e69083fc3f1316a0ef8 --- /dev/null +++ b/codenet/public_test_cases/p03348/output.4.txt @@ -0,0 +1 @@ +4 6 diff --git a/codenet/public_test_cases/p03349/input.0.txt b/codenet/public_test_cases/p03349/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52fd35840f728b87398fa76c9b7f1b5ed3bb94ea --- /dev/null +++ b/codenet/public_test_cases/p03349/input.0.txt @@ -0,0 +1 @@ +2 2 100 diff --git a/codenet/public_test_cases/p03349/input.1.txt b/codenet/public_test_cases/p03349/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..52fd35840f728b87398fa76c9b7f1b5ed3bb94ea --- /dev/null +++ b/codenet/public_test_cases/p03349/input.1.txt @@ -0,0 +1 @@ +2 2 100 diff --git a/codenet/public_test_cases/p03349/input.2.txt b/codenet/public_test_cases/p03349/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a759c6bc9130b38d4c6e2c4b86d248491e8b73d7 --- /dev/null +++ b/codenet/public_test_cases/p03349/input.2.txt @@ -0,0 +1 @@ +4 3 999999999 diff --git a/codenet/public_test_cases/p03349/input.3.txt b/codenet/public_test_cases/p03349/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8b56c7af891332ce5acc1ba1a689ec664934a33 --- /dev/null +++ b/codenet/public_test_cases/p03349/input.3.txt @@ -0,0 +1 @@ +150 150 998244353 diff --git a/codenet/public_test_cases/p03349/output.0.txt b/codenet/public_test_cases/p03349/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03349/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03349/output.1.txt b/codenet/public_test_cases/p03349/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03349/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03349/output.2.txt b/codenet/public_test_cases/p03349/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4eed3b8aceac58897e4f8b9b5d61fe9980e970f --- /dev/null +++ b/codenet/public_test_cases/p03349/output.2.txt @@ -0,0 +1 @@ +358 diff --git a/codenet/public_test_cases/p03349/output.3.txt b/codenet/public_test_cases/p03349/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a739886b72f72b1c8d013b1b9784a1cf3b52c308 --- /dev/null +++ b/codenet/public_test_cases/p03349/output.3.txt @@ -0,0 +1 @@ +186248260 diff --git a/codenet/public_test_cases/p03350/input.0.txt b/codenet/public_test_cases/p03350/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0263f13a791a6b47117faa27335c9f5aef6be2f0 --- /dev/null +++ b/codenet/public_test_cases/p03350/input.0.txt @@ -0,0 +1,5 @@ +3 4 +1 +01 +1011 +01001110 diff --git a/codenet/public_test_cases/p03350/input.1.txt b/codenet/public_test_cases/p03350/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b569e9ba4fc29c471cca3cce8dda74a7eba441f3 --- /dev/null +++ b/codenet/public_test_cases/p03350/input.1.txt @@ -0,0 +1,6 @@ +4 6 +1 +01 +1011 +10111010 +1101110011111101 diff --git a/codenet/public_test_cases/p03350/input.2.txt b/codenet/public_test_cases/p03350/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0047becd16d3a74a97033730ab47696be6abe8c7 --- /dev/null +++ b/codenet/public_test_cases/p03350/input.2.txt @@ -0,0 +1,4 @@ +2 5 +0 +11 +1111 diff --git a/codenet/public_test_cases/p03350/input.3.txt b/codenet/public_test_cases/p03350/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0263f13a791a6b47117faa27335c9f5aef6be2f0 --- /dev/null +++ b/codenet/public_test_cases/p03350/input.3.txt @@ -0,0 +1,5 @@ +3 4 +1 +01 +1011 +01001110 diff --git a/codenet/public_test_cases/p03350/output.0.txt b/codenet/public_test_cases/p03350/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03350/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03350/output.1.txt b/codenet/public_test_cases/p03350/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03350/output.1.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03350/output.2.txt b/codenet/public_test_cases/p03350/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p03350/output.2.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p03350/output.3.txt b/codenet/public_test_cases/p03350/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03350/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03351/input.0.txt b/codenet/public_test_cases/p03351/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69ab4a71858d897dce9b60d46c34c37cff7f2860 --- /dev/null +++ b/codenet/public_test_cases/p03351/input.0.txt @@ -0,0 +1 @@ +4 7 9 3 diff --git a/codenet/public_test_cases/p03351/input.1.txt b/codenet/public_test_cases/p03351/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ca01a422ed005f0f8f3a221412ddeca690cf8a8 --- /dev/null +++ b/codenet/public_test_cases/p03351/input.1.txt @@ -0,0 +1 @@ +1 100 2 10 diff --git a/codenet/public_test_cases/p03351/input.2.txt b/codenet/public_test_cases/p03351/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c32ff2d17f7bb5b246e751ca5209d6413050638 --- /dev/null +++ b/codenet/public_test_cases/p03351/input.2.txt @@ -0,0 +1 @@ +100 10 1 2 diff --git a/codenet/public_test_cases/p03351/input.3.txt b/codenet/public_test_cases/p03351/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b48d644b63325028ae890c52ca81bad208a749c4 --- /dev/null +++ b/codenet/public_test_cases/p03351/input.3.txt @@ -0,0 +1 @@ +10 10 10 1 diff --git a/codenet/public_test_cases/p03351/input.4.txt b/codenet/public_test_cases/p03351/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..69ab4a71858d897dce9b60d46c34c37cff7f2860 --- /dev/null +++ b/codenet/public_test_cases/p03351/input.4.txt @@ -0,0 +1 @@ +4 7 9 3 diff --git a/codenet/public_test_cases/p03351/output.0.txt b/codenet/public_test_cases/p03351/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03351/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03351/output.1.txt b/codenet/public_test_cases/p03351/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03351/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03351/output.2.txt b/codenet/public_test_cases/p03351/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03351/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03351/output.3.txt b/codenet/public_test_cases/p03351/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03351/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03351/output.4.txt b/codenet/public_test_cases/p03351/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03351/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03352/input.0.txt b/codenet/public_test_cases/p03352/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03352/input.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03352/input.1.txt b/codenet/public_test_cases/p03352/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03352/input.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03352/input.2.txt b/codenet/public_test_cases/p03352/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03352/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03352/input.3.txt b/codenet/public_test_cases/p03352/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6905f8ba447c0116590e38b2430151b506b1611 --- /dev/null +++ b/codenet/public_test_cases/p03352/input.3.txt @@ -0,0 +1 @@ +999 diff --git a/codenet/public_test_cases/p03352/output.0.txt b/codenet/public_test_cases/p03352/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03352/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03352/output.1.txt b/codenet/public_test_cases/p03352/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03352/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03352/output.2.txt b/codenet/public_test_cases/p03352/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03352/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03352/output.3.txt b/codenet/public_test_cases/p03352/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..612eb51c3de985edb5a880ebc6df668f536d95ee --- /dev/null +++ b/codenet/public_test_cases/p03352/output.3.txt @@ -0,0 +1 @@ +961 diff --git a/codenet/public_test_cases/p03353/input.0.txt b/codenet/public_test_cases/p03353/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5bf0da633e8e9c52311f3e85c838b0218bfab7a --- /dev/null +++ b/codenet/public_test_cases/p03353/input.0.txt @@ -0,0 +1,2 @@ +aba +4 diff --git a/codenet/public_test_cases/p03353/input.1.txt b/codenet/public_test_cases/p03353/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5bf0da633e8e9c52311f3e85c838b0218bfab7a --- /dev/null +++ b/codenet/public_test_cases/p03353/input.1.txt @@ -0,0 +1,2 @@ +aba +4 diff --git a/codenet/public_test_cases/p03353/input.2.txt b/codenet/public_test_cases/p03353/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0493ee59c46996fb001b1647c863d80aa48e93a2 --- /dev/null +++ b/codenet/public_test_cases/p03353/input.2.txt @@ -0,0 +1,2 @@ +atcoderandatcodeer +5 diff --git a/codenet/public_test_cases/p03353/input.3.txt b/codenet/public_test_cases/p03353/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c2fc74ac319998db4fe6fed9979e0fbc2d7748b --- /dev/null +++ b/codenet/public_test_cases/p03353/input.3.txt @@ -0,0 +1,2 @@ +z +1 diff --git a/codenet/public_test_cases/p03353/output.0.txt b/codenet/public_test_cases/p03353/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p03353/output.0.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p03353/output.1.txt b/codenet/public_test_cases/p03353/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p03353/output.1.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p03353/output.2.txt b/codenet/public_test_cases/p03353/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c13db87d067afbe19cf500b6f03a7565d543184a --- /dev/null +++ b/codenet/public_test_cases/p03353/output.2.txt @@ -0,0 +1 @@ +andat diff --git a/codenet/public_test_cases/p03353/output.3.txt b/codenet/public_test_cases/p03353/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b68025345d5301abad4d9ec9166f455243a0d746 --- /dev/null +++ b/codenet/public_test_cases/p03353/output.3.txt @@ -0,0 +1 @@ +z diff --git a/codenet/public_test_cases/p03354/input.0.txt b/codenet/public_test_cases/p03354/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f2789d24296c602d83dabaaec9123e8f570a74 --- /dev/null +++ b/codenet/public_test_cases/p03354/input.0.txt @@ -0,0 +1,4 @@ +5 2 +5 3 1 4 2 +1 3 +5 4 diff --git a/codenet/public_test_cases/p03354/input.1.txt b/codenet/public_test_cases/p03354/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c694fbe69b8c89daee44a8fa87c0d9fe915fae1c --- /dev/null +++ b/codenet/public_test_cases/p03354/input.1.txt @@ -0,0 +1,3 @@ +5 1 +1 2 3 4 5 +1 5 diff --git a/codenet/public_test_cases/p03354/input.2.txt b/codenet/public_test_cases/p03354/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c31dd24deded1bbcc6eb30ae7d0cf92aa7ed424b --- /dev/null +++ b/codenet/public_test_cases/p03354/input.2.txt @@ -0,0 +1,10 @@ +10 8 +5 3 6 8 7 10 9 1 2 4 +3 1 +4 1 +5 9 +2 5 +6 5 +3 5 +8 9 +7 9 diff --git a/codenet/public_test_cases/p03354/input.3.txt b/codenet/public_test_cases/p03354/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..809a6086320b6a42b7e10cf3e99b8cdb636a7adb --- /dev/null +++ b/codenet/public_test_cases/p03354/input.3.txt @@ -0,0 +1,4 @@ +3 2 +3 2 1 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03354/input.4.txt b/codenet/public_test_cases/p03354/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f2789d24296c602d83dabaaec9123e8f570a74 --- /dev/null +++ b/codenet/public_test_cases/p03354/input.4.txt @@ -0,0 +1,4 @@ +5 2 +5 3 1 4 2 +1 3 +5 4 diff --git a/codenet/public_test_cases/p03354/output.0.txt b/codenet/public_test_cases/p03354/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03354/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03354/output.1.txt b/codenet/public_test_cases/p03354/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03354/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03354/output.2.txt b/codenet/public_test_cases/p03354/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03354/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03354/output.3.txt b/codenet/public_test_cases/p03354/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03354/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03354/output.4.txt b/codenet/public_test_cases/p03354/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03354/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03355/input.0.txt b/codenet/public_test_cases/p03355/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5bf0da633e8e9c52311f3e85c838b0218bfab7a --- /dev/null +++ b/codenet/public_test_cases/p03355/input.0.txt @@ -0,0 +1,2 @@ +aba +4 diff --git a/codenet/public_test_cases/p03355/output.0.txt b/codenet/public_test_cases/p03355/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p03355/output.0.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p03356/input.0.txt b/codenet/public_test_cases/p03356/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f2789d24296c602d83dabaaec9123e8f570a74 --- /dev/null +++ b/codenet/public_test_cases/p03356/input.0.txt @@ -0,0 +1,4 @@ +5 2 +5 3 1 4 2 +1 3 +5 4 diff --git a/codenet/public_test_cases/p03356/output.0.txt b/codenet/public_test_cases/p03356/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03356/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03357/input.0.txt b/codenet/public_test_cases/p03357/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6440f2c0c5fce50098a401e2e04e7338bd4fb19 --- /dev/null +++ b/codenet/public_test_cases/p03357/input.0.txt @@ -0,0 +1,7 @@ +3 +B 1 +W 2 +B 3 +W 1 +W 3 +B 2 diff --git a/codenet/public_test_cases/p03357/input.1.txt b/codenet/public_test_cases/p03357/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..000c25dfff6a0ad7cb7d3150e19a24201abf9671 --- /dev/null +++ b/codenet/public_test_cases/p03357/input.1.txt @@ -0,0 +1,19 @@ +9 +W 3 +B 1 +B 4 +W 1 +B 5 +W 9 +W 2 +B 6 +W 5 +B 3 +W 8 +B 9 +W 7 +B 2 +B 8 +W 4 +W 6 +B 7 diff --git a/codenet/public_test_cases/p03357/input.2.txt b/codenet/public_test_cases/p03357/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6440f2c0c5fce50098a401e2e04e7338bd4fb19 --- /dev/null +++ b/codenet/public_test_cases/p03357/input.2.txt @@ -0,0 +1,7 @@ +3 +B 1 +W 2 +B 3 +W 1 +W 3 +B 2 diff --git a/codenet/public_test_cases/p03357/input.3.txt b/codenet/public_test_cases/p03357/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..79b88b2d81e7dda7459678356aa5ff57d43d26ee --- /dev/null +++ b/codenet/public_test_cases/p03357/input.3.txt @@ -0,0 +1,9 @@ +4 +B 4 +W 4 +B 3 +W 3 +B 2 +W 2 +B 1 +W 1 diff --git a/codenet/public_test_cases/p03357/output.0.txt b/codenet/public_test_cases/p03357/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03357/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03357/output.1.txt b/codenet/public_test_cases/p03357/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87523dd7a0632907d61799465827c3f08825fa47 --- /dev/null +++ b/codenet/public_test_cases/p03357/output.1.txt @@ -0,0 +1 @@ +41 diff --git a/codenet/public_test_cases/p03357/output.2.txt b/codenet/public_test_cases/p03357/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03357/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03357/output.3.txt b/codenet/public_test_cases/p03357/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03357/output.3.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03358/input.0.txt b/codenet/public_test_cases/p03358/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f11a2f3abce7db3781b3b6d2560d641cb4b0fbd2 --- /dev/null +++ b/codenet/public_test_cases/p03358/input.0.txt @@ -0,0 +1,6 @@ +5 +1 2 +2 3 +2 4 +4 5 +WBBWW diff --git a/codenet/public_test_cases/p03358/input.1.txt b/codenet/public_test_cases/p03358/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..370cd6e7685d92a8b1724e1aa9f4962c1f8480fc --- /dev/null +++ b/codenet/public_test_cases/p03358/input.1.txt @@ -0,0 +1,21 @@ +20 +2 19 +5 13 +6 4 +15 6 +12 19 +13 19 +3 11 +8 3 +3 20 +16 13 +7 14 +3 17 +7 8 +10 20 +11 9 +8 18 +8 2 +10 1 +6 13 +WBWBWBBWWWBBWWBBBBBW diff --git a/codenet/public_test_cases/p03358/input.2.txt b/codenet/public_test_cases/p03358/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..91bbe4e7dd64e938f434992a6b588bb5ddf1f69c --- /dev/null +++ b/codenet/public_test_cases/p03358/input.2.txt @@ -0,0 +1,7 @@ +6 +3 1 +4 5 +2 6 +6 1 +3 4 +WWBWBB diff --git a/codenet/public_test_cases/p03358/input.3.txt b/codenet/public_test_cases/p03358/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f11a2f3abce7db3781b3b6d2560d641cb4b0fbd2 --- /dev/null +++ b/codenet/public_test_cases/p03358/input.3.txt @@ -0,0 +1,6 @@ +5 +1 2 +2 3 +2 4 +4 5 +WBBWW diff --git a/codenet/public_test_cases/p03358/input.4.txt b/codenet/public_test_cases/p03358/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ba6551eebfee9b538f12c885afb5780f604a6e8 --- /dev/null +++ b/codenet/public_test_cases/p03358/input.4.txt @@ -0,0 +1,2 @@ +1 +B diff --git a/codenet/public_test_cases/p03358/output.0.txt b/codenet/public_test_cases/p03358/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03358/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03358/output.1.txt b/codenet/public_test_cases/p03358/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03358/output.1.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03358/output.2.txt b/codenet/public_test_cases/p03358/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03358/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03358/output.3.txt b/codenet/public_test_cases/p03358/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03358/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03358/output.4.txt b/codenet/public_test_cases/p03358/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03358/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03359/input.0.txt b/codenet/public_test_cases/p03359/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..299a71f3fe47862a2e17f69e981e7ad8beff4e53 --- /dev/null +++ b/codenet/public_test_cases/p03359/input.0.txt @@ -0,0 +1 @@ +5 5 diff --git a/codenet/public_test_cases/p03359/input.1.txt b/codenet/public_test_cases/p03359/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c18b11fe74d2d48530a09b8071296755154acde4 --- /dev/null +++ b/codenet/public_test_cases/p03359/input.1.txt @@ -0,0 +1 @@ +11 30 diff --git a/codenet/public_test_cases/p03359/input.2.txt b/codenet/public_test_cases/p03359/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03359/input.2.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03359/input.3.txt b/codenet/public_test_cases/p03359/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..299a71f3fe47862a2e17f69e981e7ad8beff4e53 --- /dev/null +++ b/codenet/public_test_cases/p03359/input.3.txt @@ -0,0 +1 @@ +5 5 diff --git a/codenet/public_test_cases/p03359/output.0.txt b/codenet/public_test_cases/p03359/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03359/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03359/output.1.txt b/codenet/public_test_cases/p03359/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03359/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03359/output.2.txt b/codenet/public_test_cases/p03359/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03359/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03359/output.3.txt b/codenet/public_test_cases/p03359/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03359/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03360/input.0.txt b/codenet/public_test_cases/p03360/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f4c10f02755a6d91cf55dbd61f134ed4d458dd9 --- /dev/null +++ b/codenet/public_test_cases/p03360/input.0.txt @@ -0,0 +1,2 @@ +5 3 11 +1 diff --git a/codenet/public_test_cases/p03360/input.1.txt b/codenet/public_test_cases/p03360/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f4c10f02755a6d91cf55dbd61f134ed4d458dd9 --- /dev/null +++ b/codenet/public_test_cases/p03360/input.1.txt @@ -0,0 +1,2 @@ +5 3 11 +1 diff --git a/codenet/public_test_cases/p03360/input.2.txt b/codenet/public_test_cases/p03360/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..42e77eae0417e668e1f0222b91afdc55396d6b49 --- /dev/null +++ b/codenet/public_test_cases/p03360/input.2.txt @@ -0,0 +1,2 @@ +3 3 4 +2 diff --git a/codenet/public_test_cases/p03360/output.0.txt b/codenet/public_test_cases/p03360/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03360/output.0.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03360/output.1.txt b/codenet/public_test_cases/p03360/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03360/output.1.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03360/output.2.txt b/codenet/public_test_cases/p03360/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03360/output.2.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03361/input.0.txt b/codenet/public_test_cases/p03361/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ef579b6416f9b4723b057adfe7aab7d7c6e5100 --- /dev/null +++ b/codenet/public_test_cases/p03361/input.0.txt @@ -0,0 +1,4 @@ +3 3 +.#. +### +.#. diff --git a/codenet/public_test_cases/p03361/input.1.txt b/codenet/public_test_cases/p03361/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ef579b6416f9b4723b057adfe7aab7d7c6e5100 --- /dev/null +++ b/codenet/public_test_cases/p03361/input.1.txt @@ -0,0 +1,4 @@ +3 3 +.#. +### +.#. diff --git a/codenet/public_test_cases/p03361/input.2.txt b/codenet/public_test_cases/p03361/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f6f90f1dcff12ce600d10c0eded10a3fdef8c35 --- /dev/null +++ b/codenet/public_test_cases/p03361/input.2.txt @@ -0,0 +1,6 @@ +5 5 +.#.# +.#.#. +.#.# +.#.#. +.#.# diff --git a/codenet/public_test_cases/p03361/input.3.txt b/codenet/public_test_cases/p03361/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..67be65fcf455b7314e2e9d2723a68aded6934279 --- /dev/null +++ b/codenet/public_test_cases/p03361/input.3.txt @@ -0,0 +1,12 @@ +11 11 +...#####... +.##.....##. +..##.##..# +..##.##..# +.........# +...###...# +.#########. +.#.#.#.#.#. +.#.#.#.## +..##.#.##.. +.##..#..##. diff --git a/codenet/public_test_cases/p03361/input.4.txt b/codenet/public_test_cases/p03361/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca8e4aa9f8c6563ead69e30fbeda060172a55796 --- /dev/null +++ b/codenet/public_test_cases/p03361/input.4.txt @@ -0,0 +1,4 @@ +3 3 +.#. + +.#. diff --git a/codenet/public_test_cases/p03361/output.0.txt b/codenet/public_test_cases/p03361/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03361/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03361/output.1.txt b/codenet/public_test_cases/p03361/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03361/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03361/output.2.txt b/codenet/public_test_cases/p03361/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03361/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03361/output.3.txt b/codenet/public_test_cases/p03361/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03361/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03361/output.4.txt b/codenet/public_test_cases/p03361/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03361/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03362/input.0.txt b/codenet/public_test_cases/p03362/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03362/input.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03362/input.1.txt b/codenet/public_test_cases/p03362/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03362/input.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03362/input.2.txt b/codenet/public_test_cases/p03362/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03362/input.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03362/input.3.txt b/codenet/public_test_cases/p03362/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03362/input.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03362/output.0.txt b/codenet/public_test_cases/p03362/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fad62e6c0f22dc9bbc909af45d99c6385b6a721 --- /dev/null +++ b/codenet/public_test_cases/p03362/output.0.txt @@ -0,0 +1 @@ +3 5 7 11 31 diff --git a/codenet/public_test_cases/p03362/output.1.txt b/codenet/public_test_cases/p03362/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b4051a666df6d4935996b5ac6a7a82d8470a8af --- /dev/null +++ b/codenet/public_test_cases/p03362/output.1.txt @@ -0,0 +1 @@ +2 3 5 7 11 13 diff --git a/codenet/public_test_cases/p03362/output.2.txt b/codenet/public_test_cases/p03362/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4704dcdb97786e5e9139ebc21df22701e084c06c --- /dev/null +++ b/codenet/public_test_cases/p03362/output.2.txt @@ -0,0 +1 @@ +2 5 7 13 19 37 67 79 diff --git a/codenet/public_test_cases/p03362/output.3.txt b/codenet/public_test_cases/p03362/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fad62e6c0f22dc9bbc909af45d99c6385b6a721 --- /dev/null +++ b/codenet/public_test_cases/p03362/output.3.txt @@ -0,0 +1 @@ +3 5 7 11 31 diff --git a/codenet/public_test_cases/p03363/input.0.txt b/codenet/public_test_cases/p03363/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f17106b6113f53fffbe9e234d2af2b7016ace67 --- /dev/null +++ b/codenet/public_test_cases/p03363/input.0.txt @@ -0,0 +1,2 @@ +6 +1 3 -4 2 2 -2 diff --git a/codenet/public_test_cases/p03363/input.1.txt b/codenet/public_test_cases/p03363/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3657d0c8e7f05746708b49d4cf02d2358622669 --- /dev/null +++ b/codenet/public_test_cases/p03363/input.1.txt @@ -0,0 +1,2 @@ +7 +1 -1 1 -1 1 -1 1 diff --git a/codenet/public_test_cases/p03363/input.2.txt b/codenet/public_test_cases/p03363/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..618b120a6faefa7beb484aa7383aaefdd3f350b0 --- /dev/null +++ b/codenet/public_test_cases/p03363/input.2.txt @@ -0,0 +1,2 @@ +5 +1 -2 3 -4 5 diff --git a/codenet/public_test_cases/p03363/input.3.txt b/codenet/public_test_cases/p03363/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f17106b6113f53fffbe9e234d2af2b7016ace67 --- /dev/null +++ b/codenet/public_test_cases/p03363/input.3.txt @@ -0,0 +1,2 @@ +6 +1 3 -4 2 2 -2 diff --git a/codenet/public_test_cases/p03363/output.0.txt b/codenet/public_test_cases/p03363/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03363/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03363/output.1.txt b/codenet/public_test_cases/p03363/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03363/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03363/output.2.txt b/codenet/public_test_cases/p03363/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03363/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03363/output.3.txt b/codenet/public_test_cases/p03363/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03363/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03364/input.0.txt b/codenet/public_test_cases/p03364/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..052e5cb88bc005bf5c39cf957e478558b817abe9 --- /dev/null +++ b/codenet/public_test_cases/p03364/input.0.txt @@ -0,0 +1,3 @@ +2 +ab +ca diff --git a/codenet/public_test_cases/p03364/input.1.txt b/codenet/public_test_cases/p03364/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..052e5cb88bc005bf5c39cf957e478558b817abe9 --- /dev/null +++ b/codenet/public_test_cases/p03364/input.1.txt @@ -0,0 +1,3 @@ +2 +ab +ca diff --git a/codenet/public_test_cases/p03364/input.2.txt b/codenet/public_test_cases/p03364/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..494176e5dd4824496b798d0118a1e42665f5f890 --- /dev/null +++ b/codenet/public_test_cases/p03364/input.2.txt @@ -0,0 +1,6 @@ +5 +abcde +fghij +klmno +pqrst +uvwxy diff --git a/codenet/public_test_cases/p03364/input.3.txt b/codenet/public_test_cases/p03364/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b29a4b10615263fa5e365e7aeaf24ecd5e90746 --- /dev/null +++ b/codenet/public_test_cases/p03364/input.3.txt @@ -0,0 +1,5 @@ +4 +aaaa +aaaa +aaaa +aaaa diff --git a/codenet/public_test_cases/p03364/output.0.txt b/codenet/public_test_cases/p03364/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03364/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03364/output.1.txt b/codenet/public_test_cases/p03364/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03364/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03364/output.2.txt b/codenet/public_test_cases/p03364/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03364/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03364/output.3.txt b/codenet/public_test_cases/p03364/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03364/output.3.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03365/input.0.txt b/codenet/public_test_cases/p03365/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03365/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03365/input.1.txt b/codenet/public_test_cases/p03365/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03365/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03365/input.2.txt b/codenet/public_test_cases/p03365/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03365/input.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03365/input.3.txt b/codenet/public_test_cases/p03365/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03365/input.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03365/input.4.txt b/codenet/public_test_cases/p03365/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7393e847d34d19031ee0ba57df63e4d0ccb4fb2 --- /dev/null +++ b/codenet/public_test_cases/p03365/input.4.txt @@ -0,0 +1 @@ +100000 diff --git a/codenet/public_test_cases/p03365/output.0.txt b/codenet/public_test_cases/p03365/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03365/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03365/output.1.txt b/codenet/public_test_cases/p03365/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03365/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03365/output.2.txt b/codenet/public_test_cases/p03365/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03365/output.2.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03365/output.3.txt b/codenet/public_test_cases/p03365/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..871727de1fd703d0c4aab92017011c373e795b67 --- /dev/null +++ b/codenet/public_test_cases/p03365/output.3.txt @@ -0,0 +1 @@ +84 diff --git a/codenet/public_test_cases/p03365/output.4.txt b/codenet/public_test_cases/p03365/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6b4cceaacfb65fa97b33c0b6deb23e4bb9b8e8a --- /dev/null +++ b/codenet/public_test_cases/p03365/output.4.txt @@ -0,0 +1 @@ +341429644 diff --git a/codenet/public_test_cases/p03366/input.0.txt b/codenet/public_test_cases/p03366/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f1251ec99add63a080740da477d2ddfccf44b38 --- /dev/null +++ b/codenet/public_test_cases/p03366/input.0.txt @@ -0,0 +1,4 @@ +3 2 +1 3 +3 4 +4 2 diff --git a/codenet/public_test_cases/p03366/input.1.txt b/codenet/public_test_cases/p03366/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3956d4a98dbf30e9a80b3bd99000ed61578ac4e2 --- /dev/null +++ b/codenet/public_test_cases/p03366/input.1.txt @@ -0,0 +1,16 @@ +15 409904902 +94198000 15017 +117995501 7656764 +275583856 313263626 +284496300 356635175 +324233841 607 +360631781 148 +472103717 5224 +497641071 34695 +522945827 816241 +554305668 32 +623788284 22832 +667409501 124410641 +876731548 12078 +904557302 291749534 +918215789 5 diff --git a/codenet/public_test_cases/p03366/input.2.txt b/codenet/public_test_cases/p03366/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f1251ec99add63a080740da477d2ddfccf44b38 --- /dev/null +++ b/codenet/public_test_cases/p03366/input.2.txt @@ -0,0 +1,4 @@ +3 2 +1 3 +3 4 +4 2 diff --git a/codenet/public_test_cases/p03366/input.3.txt b/codenet/public_test_cases/p03366/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..568333f22482a376e209a33f451075ffd5ee478b --- /dev/null +++ b/codenet/public_test_cases/p03366/input.3.txt @@ -0,0 +1,7 @@ +6 4 +1 10 +2 1000 +3 100000 +5 1000000 +6 10000 +7 100 diff --git a/codenet/public_test_cases/p03366/output.0.txt b/codenet/public_test_cases/p03366/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03366/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03366/output.1.txt b/codenet/public_test_cases/p03366/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..53aeeb028de400f97e3c0ac232694749b3b985b3 --- /dev/null +++ b/codenet/public_test_cases/p03366/output.1.txt @@ -0,0 +1 @@ +2397671583 diff --git a/codenet/public_test_cases/p03366/output.2.txt b/codenet/public_test_cases/p03366/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03366/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03366/output.3.txt b/codenet/public_test_cases/p03366/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03366/output.3.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03367/input.0.txt b/codenet/public_test_cases/p03367/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90a24e94a60392348447c993aafd563a9a740eed --- /dev/null +++ b/codenet/public_test_cases/p03367/input.0.txt @@ -0,0 +1,2 @@ +3 +2 3 3 diff --git a/codenet/public_test_cases/p03367/input.1.txt b/codenet/public_test_cases/p03367/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9be0d5c92668fda4d697397d2b4935e218d02eba --- /dev/null +++ b/codenet/public_test_cases/p03367/input.1.txt @@ -0,0 +1,2 @@ +5 +4 4 4 4 4 diff --git a/codenet/public_test_cases/p03367/input.2.txt b/codenet/public_test_cases/p03367/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e65a3cd414a9bfe802a8c9dc6ea20d6b853967d --- /dev/null +++ b/codenet/public_test_cases/p03367/input.2.txt @@ -0,0 +1,2 @@ +30 +22 30 15 20 10 29 11 29 28 11 26 10 18 28 22 5 29 16 24 24 27 10 21 30 29 19 28 27 18 23 diff --git a/codenet/public_test_cases/p03367/input.3.txt b/codenet/public_test_cases/p03367/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..90a24e94a60392348447c993aafd563a9a740eed --- /dev/null +++ b/codenet/public_test_cases/p03367/input.3.txt @@ -0,0 +1,2 @@ +3 +2 3 3 diff --git a/codenet/public_test_cases/p03367/input.4.txt b/codenet/public_test_cases/p03367/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..968d462a84a48ce21017d2444510272ed359e775 --- /dev/null +++ b/codenet/public_test_cases/p03367/input.4.txt @@ -0,0 +1,2 @@ +6 +4 2 5 1 6 3 diff --git a/codenet/public_test_cases/p03367/output.0.txt b/codenet/public_test_cases/p03367/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03367/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03367/output.1.txt b/codenet/public_test_cases/p03367/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03367/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03367/output.2.txt b/codenet/public_test_cases/p03367/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab58af1cbcb9afbdca179242bd1524f0dbe30bad --- /dev/null +++ b/codenet/public_test_cases/p03367/output.2.txt @@ -0,0 +1 @@ +848414012 diff --git a/codenet/public_test_cases/p03367/output.3.txt b/codenet/public_test_cases/p03367/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03367/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03367/output.4.txt b/codenet/public_test_cases/p03367/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03367/output.4.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03368/input.0.txt b/codenet/public_test_cases/p03368/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2181810a6646a52cd80bec36dda635194a182a38 --- /dev/null +++ b/codenet/public_test_cases/p03368/input.0.txt @@ -0,0 +1,3 @@ +6 +1 1 2 3 3 +0 1 1 0 0 0 diff --git a/codenet/public_test_cases/p03368/input.1.txt b/codenet/public_test_cases/p03368/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d6451de9dafc8b5614d1c6a8097c1447a9c1826 --- /dev/null +++ b/codenet/public_test_cases/p03368/input.1.txt @@ -0,0 +1,3 @@ +15 +1 2 3 2 5 6 2 2 9 10 1 12 13 12 +1 1 1 0 1 1 0 0 1 0 0 1 1 0 0 diff --git a/codenet/public_test_cases/p03368/input.2.txt b/codenet/public_test_cases/p03368/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2181810a6646a52cd80bec36dda635194a182a38 --- /dev/null +++ b/codenet/public_test_cases/p03368/input.2.txt @@ -0,0 +1,3 @@ +6 +1 1 2 3 3 +0 1 1 0 0 0 diff --git a/codenet/public_test_cases/p03368/input.3.txt b/codenet/public_test_cases/p03368/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2c112f580567e7b059620337ff2ef1c7d142f81 --- /dev/null +++ b/codenet/public_test_cases/p03368/input.3.txt @@ -0,0 +1,3 @@ +1 + +0 diff --git a/codenet/public_test_cases/p03368/output.0.txt b/codenet/public_test_cases/p03368/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03368/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03368/output.1.txt b/codenet/public_test_cases/p03368/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e85087affded170efcbc6f9672a6fc671d839ed0 --- /dev/null +++ b/codenet/public_test_cases/p03368/output.1.txt @@ -0,0 +1 @@ +31 diff --git a/codenet/public_test_cases/p03368/output.2.txt b/codenet/public_test_cases/p03368/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03368/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03368/output.3.txt b/codenet/public_test_cases/p03368/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03368/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03369/input.0.txt b/codenet/public_test_cases/p03369/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b400ca7da865cee3674fc11ad6c42bc0c41dd46a --- /dev/null +++ b/codenet/public_test_cases/p03369/input.0.txt @@ -0,0 +1 @@ +oxo diff --git a/codenet/public_test_cases/p03369/input.1.txt b/codenet/public_test_cases/p03369/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b400ca7da865cee3674fc11ad6c42bc0c41dd46a --- /dev/null +++ b/codenet/public_test_cases/p03369/input.1.txt @@ -0,0 +1 @@ +oxo diff --git a/codenet/public_test_cases/p03369/input.2.txt b/codenet/public_test_cases/p03369/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6459e005434a49a66a3ddec92279a86160ad71f --- /dev/null +++ b/codenet/public_test_cases/p03369/input.2.txt @@ -0,0 +1 @@ +xxx diff --git a/codenet/public_test_cases/p03369/input.3.txt b/codenet/public_test_cases/p03369/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..82d35d93aaecd842f7b067ca1ed1dc2813afa1a3 --- /dev/null +++ b/codenet/public_test_cases/p03369/input.3.txt @@ -0,0 +1 @@ +ooo diff --git a/codenet/public_test_cases/p03369/output.0.txt b/codenet/public_test_cases/p03369/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b02a197f603b1424f13f8f5293cbf92417c1b00 --- /dev/null +++ b/codenet/public_test_cases/p03369/output.0.txt @@ -0,0 +1 @@ +900 diff --git a/codenet/public_test_cases/p03369/output.1.txt b/codenet/public_test_cases/p03369/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b02a197f603b1424f13f8f5293cbf92417c1b00 --- /dev/null +++ b/codenet/public_test_cases/p03369/output.1.txt @@ -0,0 +1 @@ +900 diff --git a/codenet/public_test_cases/p03369/output.2.txt b/codenet/public_test_cases/p03369/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4890ce57fed26f8237519931c4892b8d323d249 --- /dev/null +++ b/codenet/public_test_cases/p03369/output.2.txt @@ -0,0 +1 @@ +700 diff --git a/codenet/public_test_cases/p03369/output.3.txt b/codenet/public_test_cases/p03369/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b33d238dab9943201aaf267f701e8ea5fc9268 --- /dev/null +++ b/codenet/public_test_cases/p03369/output.3.txt @@ -0,0 +1 @@ +1000 diff --git a/codenet/public_test_cases/p03370/input.0.txt b/codenet/public_test_cases/p03370/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afc62c74fc7e30ce842e09a3daf24dd8150a0fa7 --- /dev/null +++ b/codenet/public_test_cases/p03370/input.0.txt @@ -0,0 +1,4 @@ +3 1000 +120 +100 +140 diff --git a/codenet/public_test_cases/p03370/input.1.txt b/codenet/public_test_cases/p03370/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afc62c74fc7e30ce842e09a3daf24dd8150a0fa7 --- /dev/null +++ b/codenet/public_test_cases/p03370/input.1.txt @@ -0,0 +1,4 @@ +3 1000 +120 +100 +140 diff --git a/codenet/public_test_cases/p03370/input.2.txt b/codenet/public_test_cases/p03370/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e199aec99ae3d434a7e26f60d2b39d84d66a690 --- /dev/null +++ b/codenet/public_test_cases/p03370/input.2.txt @@ -0,0 +1,6 @@ +5 3000 +150 +130 +150 +130 +110 diff --git a/codenet/public_test_cases/p03370/input.3.txt b/codenet/public_test_cases/p03370/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e598701d375e3d940405700467fed7e9d021c9f --- /dev/null +++ b/codenet/public_test_cases/p03370/input.3.txt @@ -0,0 +1,5 @@ +4 360 +90 +90 +90 +90 diff --git a/codenet/public_test_cases/p03370/output.0.txt b/codenet/public_test_cases/p03370/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03370/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03370/output.1.txt b/codenet/public_test_cases/p03370/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03370/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03370/output.2.txt b/codenet/public_test_cases/p03370/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p03370/output.2.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p03370/output.3.txt b/codenet/public_test_cases/p03370/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03370/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03371/input.0.txt b/codenet/public_test_cases/p03371/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f5f09024294858c8370a5f1f38f3b818154afc6 --- /dev/null +++ b/codenet/public_test_cases/p03371/input.0.txt @@ -0,0 +1 @@ +1500 2000 1600 3 2 diff --git a/codenet/public_test_cases/p03371/input.1.txt b/codenet/public_test_cases/p03371/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f5f09024294858c8370a5f1f38f3b818154afc6 --- /dev/null +++ b/codenet/public_test_cases/p03371/input.1.txt @@ -0,0 +1 @@ +1500 2000 1600 3 2 diff --git a/codenet/public_test_cases/p03371/input.2.txt b/codenet/public_test_cases/p03371/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bb39b0ec0ed63bc5ff1dfd882b4aa40e524ce6a --- /dev/null +++ b/codenet/public_test_cases/p03371/input.2.txt @@ -0,0 +1 @@ +1500 2000 500 90000 100000 diff --git a/codenet/public_test_cases/p03371/input.3.txt b/codenet/public_test_cases/p03371/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4d279290077ac6791208bc13454d681f3f246f6 --- /dev/null +++ b/codenet/public_test_cases/p03371/input.3.txt @@ -0,0 +1 @@ +1500 2000 1900 3 2 diff --git a/codenet/public_test_cases/p03371/output.0.txt b/codenet/public_test_cases/p03371/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..855f5f86a8de3069885ee24c85ff71e285be75b0 --- /dev/null +++ b/codenet/public_test_cases/p03371/output.0.txt @@ -0,0 +1 @@ +7900 diff --git a/codenet/public_test_cases/p03371/output.1.txt b/codenet/public_test_cases/p03371/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..855f5f86a8de3069885ee24c85ff71e285be75b0 --- /dev/null +++ b/codenet/public_test_cases/p03371/output.1.txt @@ -0,0 +1 @@ +7900 diff --git a/codenet/public_test_cases/p03371/output.2.txt b/codenet/public_test_cases/p03371/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea600cb61b366b723c6e331e118865642391327f --- /dev/null +++ b/codenet/public_test_cases/p03371/output.2.txt @@ -0,0 +1 @@ +100000000 diff --git a/codenet/public_test_cases/p03371/output.3.txt b/codenet/public_test_cases/p03371/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b28927a92197669e0a56fc70577492a1f91285e4 --- /dev/null +++ b/codenet/public_test_cases/p03371/output.3.txt @@ -0,0 +1 @@ +8500 diff --git a/codenet/public_test_cases/p03372/input.0.txt b/codenet/public_test_cases/p03372/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8185fbe4c08db8e9ad5049b63e4ac1ae5cc45b84 --- /dev/null +++ b/codenet/public_test_cases/p03372/input.0.txt @@ -0,0 +1,4 @@ +3 20 +2 80 +9 120 +16 1 diff --git a/codenet/public_test_cases/p03372/output.0.txt b/codenet/public_test_cases/p03372/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88b2e78342d56f05c2cf57c289329a19342fb5f9 --- /dev/null +++ b/codenet/public_test_cases/p03372/output.0.txt @@ -0,0 +1 @@ +191 diff --git a/codenet/public_test_cases/p03373/input.0.txt b/codenet/public_test_cases/p03373/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f5f09024294858c8370a5f1f38f3b818154afc6 --- /dev/null +++ b/codenet/public_test_cases/p03373/input.0.txt @@ -0,0 +1 @@ +1500 2000 1600 3 2 diff --git a/codenet/public_test_cases/p03373/output.0.txt b/codenet/public_test_cases/p03373/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..855f5f86a8de3069885ee24c85ff71e285be75b0 --- /dev/null +++ b/codenet/public_test_cases/p03373/output.0.txt @@ -0,0 +1 @@ +7900 diff --git a/codenet/public_test_cases/p03374/input.0.txt b/codenet/public_test_cases/p03374/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8185fbe4c08db8e9ad5049b63e4ac1ae5cc45b84 --- /dev/null +++ b/codenet/public_test_cases/p03374/input.0.txt @@ -0,0 +1,4 @@ +3 20 +2 80 +9 120 +16 1 diff --git a/codenet/public_test_cases/p03374/input.1.txt b/codenet/public_test_cases/p03374/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fc9caa06ab8915a3585268afb75bd6027cd8f42 --- /dev/null +++ b/codenet/public_test_cases/p03374/input.1.txt @@ -0,0 +1,16 @@ +15 10000000000 +400000000 1000000000 +800000000 1000000000 +1900000000 1000000000 +2400000000 1000000000 +2900000000 1000000000 +3300000000 1000000000 +3700000000 1000000000 +3800000000 1000000000 +4000000000 1000000000 +4100000000 1000000000 +5200000000 1000000000 +6600000000 1000000000 +8000000000 1000000000 +9300000000 1000000000 +9700000000 1000000000 diff --git a/codenet/public_test_cases/p03374/input.2.txt b/codenet/public_test_cases/p03374/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8185fbe4c08db8e9ad5049b63e4ac1ae5cc45b84 --- /dev/null +++ b/codenet/public_test_cases/p03374/input.2.txt @@ -0,0 +1,4 @@ +3 20 +2 80 +9 120 +16 1 diff --git a/codenet/public_test_cases/p03374/input.3.txt b/codenet/public_test_cases/p03374/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d28aafe7e2f966b1b466352e9885f383a335dbf5 --- /dev/null +++ b/codenet/public_test_cases/p03374/input.3.txt @@ -0,0 +1,4 @@ +3 20 +2 80 +9 1 +16 120 diff --git a/codenet/public_test_cases/p03374/input.4.txt b/codenet/public_test_cases/p03374/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0b62631fed6775c7d88889ab487701f489c5900 --- /dev/null +++ b/codenet/public_test_cases/p03374/input.4.txt @@ -0,0 +1,2 @@ +1 100000000000000 +50000000000000 1 diff --git a/codenet/public_test_cases/p03374/output.0.txt b/codenet/public_test_cases/p03374/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..88b2e78342d56f05c2cf57c289329a19342fb5f9 --- /dev/null +++ b/codenet/public_test_cases/p03374/output.0.txt @@ -0,0 +1 @@ +191 diff --git a/codenet/public_test_cases/p03374/output.1.txt b/codenet/public_test_cases/p03374/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2802b09198317fbbea9dc4b09a1f54e993a26002 --- /dev/null +++ b/codenet/public_test_cases/p03374/output.1.txt @@ -0,0 +1 @@ +6500000000 diff --git a/codenet/public_test_cases/p03374/output.2.txt b/codenet/public_test_cases/p03374/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..88b2e78342d56f05c2cf57c289329a19342fb5f9 --- /dev/null +++ b/codenet/public_test_cases/p03374/output.2.txt @@ -0,0 +1 @@ +191 diff --git a/codenet/public_test_cases/p03374/output.3.txt b/codenet/public_test_cases/p03374/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..86a0307199419a10492c4e4a044feb9f6580c607 --- /dev/null +++ b/codenet/public_test_cases/p03374/output.3.txt @@ -0,0 +1 @@ +192 diff --git a/codenet/public_test_cases/p03374/output.4.txt b/codenet/public_test_cases/p03374/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03374/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03375/input.0.txt b/codenet/public_test_cases/p03375/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98173dff48f2836a0440e388e92033f621c84a46 --- /dev/null +++ b/codenet/public_test_cases/p03375/input.0.txt @@ -0,0 +1 @@ +2 1000000007 diff --git a/codenet/public_test_cases/p03375/input.1.txt b/codenet/public_test_cases/p03375/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b76836087780374537c0cb5a0acc4393ccaacd4 --- /dev/null +++ b/codenet/public_test_cases/p03375/input.1.txt @@ -0,0 +1 @@ +3 1000000009 diff --git a/codenet/public_test_cases/p03375/input.2.txt b/codenet/public_test_cases/p03375/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..98173dff48f2836a0440e388e92033f621c84a46 --- /dev/null +++ b/codenet/public_test_cases/p03375/input.2.txt @@ -0,0 +1 @@ +2 1000000007 diff --git a/codenet/public_test_cases/p03375/input.3.txt b/codenet/public_test_cases/p03375/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..01bb66d47ad67075ee9d0a25f07ef9ff240e3caa --- /dev/null +++ b/codenet/public_test_cases/p03375/input.3.txt @@ -0,0 +1 @@ +3000 123456791 diff --git a/codenet/public_test_cases/p03375/input.4.txt b/codenet/public_test_cases/p03375/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ed01ea7c266588c708b2e9d25311f4b2384c564 --- /dev/null +++ b/codenet/public_test_cases/p03375/input.4.txt @@ -0,0 +1 @@ +50 111111113 diff --git a/codenet/public_test_cases/p03375/output.0.txt b/codenet/public_test_cases/p03375/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03375/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03375/output.1.txt b/codenet/public_test_cases/p03375/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..415196e47f5324354b6e706ca5813567fa6c3784 --- /dev/null +++ b/codenet/public_test_cases/p03375/output.1.txt @@ -0,0 +1 @@ +118 diff --git a/codenet/public_test_cases/p03375/output.2.txt b/codenet/public_test_cases/p03375/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03375/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03375/output.3.txt b/codenet/public_test_cases/p03375/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c23ed6da81707df0aa58d2a0935941df27456fd2 --- /dev/null +++ b/codenet/public_test_cases/p03375/output.3.txt @@ -0,0 +1 @@ +16369789 diff --git a/codenet/public_test_cases/p03375/output.4.txt b/codenet/public_test_cases/p03375/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ae9060b2676981f4b3bd4c95677ca6895916730 --- /dev/null +++ b/codenet/public_test_cases/p03375/output.4.txt @@ -0,0 +1 @@ +1456748 diff --git a/codenet/public_test_cases/p03376/input.0.txt b/codenet/public_test_cases/p03376/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7a396efa9be81eecc6feb15b018049a83271c29 --- /dev/null +++ b/codenet/public_test_cases/p03376/input.0.txt @@ -0,0 +1,4 @@ +3 100 1 +15 +10 1 +20 1 diff --git a/codenet/public_test_cases/p03376/input.1.txt b/codenet/public_test_cases/p03376/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8095693637afc7745d369896724e7cc5f7231bc5 --- /dev/null +++ b/codenet/public_test_cases/p03376/input.1.txt @@ -0,0 +1,4 @@ +3 100 10 +15 +10 1 +20 1 diff --git a/codenet/public_test_cases/p03376/input.2.txt b/codenet/public_test_cases/p03376/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..40dc61bed9cea9ad8f242cf19eab342ce220a94c --- /dev/null +++ b/codenet/public_test_cases/p03376/input.2.txt @@ -0,0 +1,6 @@ +5 1000000000 1000000 +123 +159 1 +111 1 +135 3 +147 3 diff --git a/codenet/public_test_cases/p03376/input.3.txt b/codenet/public_test_cases/p03376/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7a396efa9be81eecc6feb15b018049a83271c29 --- /dev/null +++ b/codenet/public_test_cases/p03376/input.3.txt @@ -0,0 +1,4 @@ +3 100 1 +15 +10 1 +20 1 diff --git a/codenet/public_test_cases/p03376/output.0.txt b/codenet/public_test_cases/p03376/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03376/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03376/output.1.txt b/codenet/public_test_cases/p03376/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03376/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03376/output.2.txt b/codenet/public_test_cases/p03376/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d74f80fb6f775ae26233b94a66f0f080038d5727 --- /dev/null +++ b/codenet/public_test_cases/p03376/output.2.txt @@ -0,0 +1 @@ +7496296 diff --git a/codenet/public_test_cases/p03376/output.3.txt b/codenet/public_test_cases/p03376/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03376/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03377/input.0.txt b/codenet/public_test_cases/p03377/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7139457f098c05fc4b67849edd90591ec6830b4 --- /dev/null +++ b/codenet/public_test_cases/p03377/input.0.txt @@ -0,0 +1 @@ +3 5 4 diff --git a/codenet/public_test_cases/p03377/input.1.txt b/codenet/public_test_cases/p03377/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a208c99c8afd9ba51e5e94d65219bc1c44556d20 --- /dev/null +++ b/codenet/public_test_cases/p03377/input.1.txt @@ -0,0 +1 @@ +2 2 6 diff --git a/codenet/public_test_cases/p03377/input.2.txt b/codenet/public_test_cases/p03377/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7139457f098c05fc4b67849edd90591ec6830b4 --- /dev/null +++ b/codenet/public_test_cases/p03377/input.2.txt @@ -0,0 +1 @@ +3 5 4 diff --git a/codenet/public_test_cases/p03377/input.3.txt b/codenet/public_test_cases/p03377/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad0d61ad00fde7baaad7c56f69635f64152ce966 --- /dev/null +++ b/codenet/public_test_cases/p03377/input.3.txt @@ -0,0 +1 @@ +5 3 2 diff --git a/codenet/public_test_cases/p03377/output.0.txt b/codenet/public_test_cases/p03377/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03377/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03377/output.1.txt b/codenet/public_test_cases/p03377/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03377/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03377/output.2.txt b/codenet/public_test_cases/p03377/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03377/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03377/output.3.txt b/codenet/public_test_cases/p03377/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03377/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03378/input.0.txt b/codenet/public_test_cases/p03378/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3db830e02472d13080b9168dfd95ed13b91b5af6 --- /dev/null +++ b/codenet/public_test_cases/p03378/input.0.txt @@ -0,0 +1,2 @@ +5 3 3 +1 2 4 diff --git a/codenet/public_test_cases/p03378/output.0.txt b/codenet/public_test_cases/p03378/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03378/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03379/input.0.txt b/codenet/public_test_cases/p03379/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..568b018286a4113ee3b6809de19688ff7566be5e --- /dev/null +++ b/codenet/public_test_cases/p03379/input.0.txt @@ -0,0 +1,2 @@ +4 +2 4 4 3 diff --git a/codenet/public_test_cases/p03379/output.0.txt b/codenet/public_test_cases/p03379/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9bfb3367e5f44c5c8301de8eaa527b358132c8b --- /dev/null +++ b/codenet/public_test_cases/p03379/output.0.txt @@ -0,0 +1,4 @@ +4 +3 +3 +4 diff --git a/codenet/public_test_cases/p03380/input.0.txt b/codenet/public_test_cases/p03380/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd91c974ab23b5c815ef231a5209b1e08ee21c5 --- /dev/null +++ b/codenet/public_test_cases/p03380/input.0.txt @@ -0,0 +1,2 @@ +5 +6 9 4 2 11 diff --git a/codenet/public_test_cases/p03380/input.1.txt b/codenet/public_test_cases/p03380/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd91c974ab23b5c815ef231a5209b1e08ee21c5 --- /dev/null +++ b/codenet/public_test_cases/p03380/input.1.txt @@ -0,0 +1,2 @@ +5 +6 9 4 2 11 diff --git a/codenet/public_test_cases/p03380/input.2.txt b/codenet/public_test_cases/p03380/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5a70c63e61f9da4947526127fbf1798c99ea51c --- /dev/null +++ b/codenet/public_test_cases/p03380/input.2.txt @@ -0,0 +1,2 @@ +2 +100 0 diff --git a/codenet/public_test_cases/p03380/output.0.txt b/codenet/public_test_cases/p03380/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5868379786bbebc13c2b0cc4f7d2bb412e28fbaa --- /dev/null +++ b/codenet/public_test_cases/p03380/output.0.txt @@ -0,0 +1 @@ +11 6 diff --git a/codenet/public_test_cases/p03380/output.1.txt b/codenet/public_test_cases/p03380/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5868379786bbebc13c2b0cc4f7d2bb412e28fbaa --- /dev/null +++ b/codenet/public_test_cases/p03380/output.1.txt @@ -0,0 +1 @@ +11 6 diff --git a/codenet/public_test_cases/p03380/output.2.txt b/codenet/public_test_cases/p03380/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45d4794c122865f3d0b54adfddf0b0f30f96c4ff --- /dev/null +++ b/codenet/public_test_cases/p03380/output.2.txt @@ -0,0 +1 @@ +100 0 diff --git a/codenet/public_test_cases/p03381/input.0.txt b/codenet/public_test_cases/p03381/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..568b018286a4113ee3b6809de19688ff7566be5e --- /dev/null +++ b/codenet/public_test_cases/p03381/input.0.txt @@ -0,0 +1,2 @@ +4 +2 4 4 3 diff --git a/codenet/public_test_cases/p03381/input.1.txt b/codenet/public_test_cases/p03381/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..efa0c2e614f6898a64f03220e1cfacb783bcf3e1 --- /dev/null +++ b/codenet/public_test_cases/p03381/input.1.txt @@ -0,0 +1,2 @@ +6 +5 5 4 4 3 3 diff --git a/codenet/public_test_cases/p03381/input.2.txt b/codenet/public_test_cases/p03381/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..568b018286a4113ee3b6809de19688ff7566be5e --- /dev/null +++ b/codenet/public_test_cases/p03381/input.2.txt @@ -0,0 +1,2 @@ +4 +2 4 4 3 diff --git a/codenet/public_test_cases/p03381/input.3.txt b/codenet/public_test_cases/p03381/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p03381/input.3.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p03381/output.0.txt b/codenet/public_test_cases/p03381/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9bfb3367e5f44c5c8301de8eaa527b358132c8b --- /dev/null +++ b/codenet/public_test_cases/p03381/output.0.txt @@ -0,0 +1,4 @@ +4 +3 +3 +4 diff --git a/codenet/public_test_cases/p03381/output.1.txt b/codenet/public_test_cases/p03381/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1c48292bda1f1daac48c6d4304f686513290981 --- /dev/null +++ b/codenet/public_test_cases/p03381/output.1.txt @@ -0,0 +1,6 @@ +4 +4 +4 +4 +4 +4 diff --git a/codenet/public_test_cases/p03381/output.2.txt b/codenet/public_test_cases/p03381/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9bfb3367e5f44c5c8301de8eaa527b358132c8b --- /dev/null +++ b/codenet/public_test_cases/p03381/output.2.txt @@ -0,0 +1,4 @@ +4 +3 +3 +4 diff --git a/codenet/public_test_cases/p03381/output.3.txt b/codenet/public_test_cases/p03381/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p03381/output.3.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p03382/input.0.txt b/codenet/public_test_cases/p03382/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd91c974ab23b5c815ef231a5209b1e08ee21c5 --- /dev/null +++ b/codenet/public_test_cases/p03382/input.0.txt @@ -0,0 +1,2 @@ +5 +6 9 4 2 11 diff --git a/codenet/public_test_cases/p03382/output.0.txt b/codenet/public_test_cases/p03382/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5868379786bbebc13c2b0cc4f7d2bb412e28fbaa --- /dev/null +++ b/codenet/public_test_cases/p03382/output.0.txt @@ -0,0 +1 @@ +11 6 diff --git a/codenet/public_test_cases/p03383/input.0.txt b/codenet/public_test_cases/p03383/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de086ed28217fb56b723e18184d1b959d5489680 --- /dev/null +++ b/codenet/public_test_cases/p03383/input.0.txt @@ -0,0 +1,3 @@ +2 3 +arc +rac diff --git a/codenet/public_test_cases/p03383/input.1.txt b/codenet/public_test_cases/p03383/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d774d11f724cf5a437c76a2eccfb2599cae86e4a --- /dev/null +++ b/codenet/public_test_cases/p03383/input.1.txt @@ -0,0 +1,4 @@ +3 7 +atcoder +regular +contest diff --git a/codenet/public_test_cases/p03383/input.2.txt b/codenet/public_test_cases/p03383/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..66449f022eb55d52e66db1a251763a2333c3f9fc --- /dev/null +++ b/codenet/public_test_cases/p03383/input.2.txt @@ -0,0 +1,13 @@ +12 12 +bimonigaloaf +faurwlkbleht +dexwimqxzxbb +lxdgyoifcxid +ydxiliocfdgx +nfoabgilamoi +ibxbdqmzxxwe +pqirylfrcrnf +wtehfkllbura +yfrnpflcrirq +wvcclwgiubrk +lkbrwgwuiccv diff --git a/codenet/public_test_cases/p03383/input.3.txt b/codenet/public_test_cases/p03383/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..de086ed28217fb56b723e18184d1b959d5489680 --- /dev/null +++ b/codenet/public_test_cases/p03383/input.3.txt @@ -0,0 +1,3 @@ +2 3 +arc +rac diff --git a/codenet/public_test_cases/p03383/output.0.txt b/codenet/public_test_cases/p03383/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03383/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03383/output.1.txt b/codenet/public_test_cases/p03383/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03383/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03383/output.2.txt b/codenet/public_test_cases/p03383/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03383/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03383/output.3.txt b/codenet/public_test_cases/p03383/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03383/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03384/input.0.txt b/codenet/public_test_cases/p03384/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd11afcecc80c2c2a2c7a69c4fe1435bfd567502 --- /dev/null +++ b/codenet/public_test_cases/p03384/input.0.txt @@ -0,0 +1,6 @@ +6 +1 2 +1 3 +1 4 +1 5 +5 6 diff --git a/codenet/public_test_cases/p03384/input.1.txt b/codenet/public_test_cases/p03384/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..db94cdfec39994f321becbaa7fc941b7132f32ff --- /dev/null +++ b/codenet/public_test_cases/p03384/input.1.txt @@ -0,0 +1,15 @@ +15 +1 2 +1 3 +2 4 +2 5 +3 6 +3 7 +4 8 +4 9 +5 10 +5 11 +6 12 +6 13 +7 14 +7 15 diff --git a/codenet/public_test_cases/p03384/input.2.txt b/codenet/public_test_cases/p03384/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd11afcecc80c2c2a2c7a69c4fe1435bfd567502 --- /dev/null +++ b/codenet/public_test_cases/p03384/input.2.txt @@ -0,0 +1,6 @@ +6 +1 2 +1 3 +1 4 +1 5 +5 6 diff --git a/codenet/public_test_cases/p03384/input.3.txt b/codenet/public_test_cases/p03384/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..062726584ce63455cb4eb674774c04531494cb80 --- /dev/null +++ b/codenet/public_test_cases/p03384/input.3.txt @@ -0,0 +1,6 @@ +6 +1 2 +2 3 +3 4 +1 5 +5 6 diff --git a/codenet/public_test_cases/p03384/output.0.txt b/codenet/public_test_cases/p03384/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d9c72f2d4f834ab630a6f7d2981408335dbbcf8 --- /dev/null +++ b/codenet/public_test_cases/p03384/output.0.txt @@ -0,0 +1 @@ +1 2 4 5 3 6 diff --git a/codenet/public_test_cases/p03384/output.1.txt b/codenet/public_test_cases/p03384/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03384/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03384/output.2.txt b/codenet/public_test_cases/p03384/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d9c72f2d4f834ab630a6f7d2981408335dbbcf8 --- /dev/null +++ b/codenet/public_test_cases/p03384/output.2.txt @@ -0,0 +1 @@ +1 2 4 5 3 6 diff --git a/codenet/public_test_cases/p03384/output.3.txt b/codenet/public_test_cases/p03384/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b61b7c26ca70f51b5480b0084e854ffbd1f9f264 --- /dev/null +++ b/codenet/public_test_cases/p03384/output.3.txt @@ -0,0 +1 @@ +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p03385/input.0.txt b/codenet/public_test_cases/p03385/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f536db4608f3afe1f22923d146b81abe4886dcb --- /dev/null +++ b/codenet/public_test_cases/p03385/input.0.txt @@ -0,0 +1 @@ +bac diff --git a/codenet/public_test_cases/p03385/input.1.txt b/codenet/public_test_cases/p03385/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aa4b504306ae8fd271fab2fdb4c70fb5e2e83a9 --- /dev/null +++ b/codenet/public_test_cases/p03385/input.1.txt @@ -0,0 +1 @@ +bab diff --git a/codenet/public_test_cases/p03385/input.2.txt b/codenet/public_test_cases/p03385/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8baef1b4abc478178b004d62031cf7fe6db6f903 --- /dev/null +++ b/codenet/public_test_cases/p03385/input.2.txt @@ -0,0 +1 @@ +abc diff --git a/codenet/public_test_cases/p03385/input.3.txt b/codenet/public_test_cases/p03385/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..72943a16fb2c8f38f9dde202b7a70ccc19c52f34 --- /dev/null +++ b/codenet/public_test_cases/p03385/input.3.txt @@ -0,0 +1 @@ +aaa diff --git a/codenet/public_test_cases/p03385/input.4.txt b/codenet/public_test_cases/p03385/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f536db4608f3afe1f22923d146b81abe4886dcb --- /dev/null +++ b/codenet/public_test_cases/p03385/input.4.txt @@ -0,0 +1 @@ +bac diff --git a/codenet/public_test_cases/p03385/output.0.txt b/codenet/public_test_cases/p03385/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03385/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03385/output.1.txt b/codenet/public_test_cases/p03385/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03385/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03385/output.2.txt b/codenet/public_test_cases/p03385/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03385/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03385/output.3.txt b/codenet/public_test_cases/p03385/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03385/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03385/output.4.txt b/codenet/public_test_cases/p03385/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03385/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03386/input.0.txt b/codenet/public_test_cases/p03386/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4ec18ee84df973b0c79c6c20da63c069a7447a6 --- /dev/null +++ b/codenet/public_test_cases/p03386/input.0.txt @@ -0,0 +1 @@ +3 8 2 diff --git a/codenet/public_test_cases/p03386/input.1.txt b/codenet/public_test_cases/p03386/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1037ea0abd77dd5d8fef0e2f784b0d336ac6805c --- /dev/null +++ b/codenet/public_test_cases/p03386/input.1.txt @@ -0,0 +1 @@ +2 9 100 diff --git a/codenet/public_test_cases/p03386/input.2.txt b/codenet/public_test_cases/p03386/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4ec18ee84df973b0c79c6c20da63c069a7447a6 --- /dev/null +++ b/codenet/public_test_cases/p03386/input.2.txt @@ -0,0 +1 @@ +3 8 2 diff --git a/codenet/public_test_cases/p03386/input.3.txt b/codenet/public_test_cases/p03386/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..270762e1ecefac63725c7c8d2f3e64b910a0329f --- /dev/null +++ b/codenet/public_test_cases/p03386/input.3.txt @@ -0,0 +1 @@ +4 8 3 diff --git a/codenet/public_test_cases/p03386/output.0.txt b/codenet/public_test_cases/p03386/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1454114473f6b57004a9e568b0871229708bab32 --- /dev/null +++ b/codenet/public_test_cases/p03386/output.0.txt @@ -0,0 +1,4 @@ +3 +4 +7 +8 diff --git a/codenet/public_test_cases/p03386/output.1.txt b/codenet/public_test_cases/p03386/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5617de67bc334ba753462ac8120427fe2ba2df80 --- /dev/null +++ b/codenet/public_test_cases/p03386/output.1.txt @@ -0,0 +1,8 @@ +2 +3 +4 +5 +6 +7 +8 +9 diff --git a/codenet/public_test_cases/p03386/output.2.txt b/codenet/public_test_cases/p03386/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1454114473f6b57004a9e568b0871229708bab32 --- /dev/null +++ b/codenet/public_test_cases/p03386/output.2.txt @@ -0,0 +1,4 @@ +3 +4 +7 +8 diff --git a/codenet/public_test_cases/p03386/output.3.txt b/codenet/public_test_cases/p03386/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7968e2a5f58fb703f373e09ab97a671434030a51 --- /dev/null +++ b/codenet/public_test_cases/p03386/output.3.txt @@ -0,0 +1,5 @@ +4 +5 +6 +7 +8 diff --git a/codenet/public_test_cases/p03387/input.0.txt b/codenet/public_test_cases/p03387/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f874fb1787a11c117415a7630996e04db4f7d3b --- /dev/null +++ b/codenet/public_test_cases/p03387/input.0.txt @@ -0,0 +1 @@ +2 5 4 diff --git a/codenet/public_test_cases/p03387/output.0.txt b/codenet/public_test_cases/p03387/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03387/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03388/input.0.txt b/codenet/public_test_cases/p03388/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75634f5cd785fd5c79a8393807414205fb0f8bf6 --- /dev/null +++ b/codenet/public_test_cases/p03388/input.0.txt @@ -0,0 +1,9 @@ +8 +1 4 +10 5 +3 3 +4 11 +8 9 +22 40 +8 36 +314159265 358979323 diff --git a/codenet/public_test_cases/p03388/input.1.txt b/codenet/public_test_cases/p03388/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..75634f5cd785fd5c79a8393807414205fb0f8bf6 --- /dev/null +++ b/codenet/public_test_cases/p03388/input.1.txt @@ -0,0 +1,9 @@ +8 +1 4 +10 5 +3 3 +4 11 +8 9 +22 40 +8 36 +314159265 358979323 diff --git a/codenet/public_test_cases/p03388/output.0.txt b/codenet/public_test_cases/p03388/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a441b4420805c99cdc61b098822101a8daf9a3bb --- /dev/null +++ b/codenet/public_test_cases/p03388/output.0.txt @@ -0,0 +1,8 @@ +1 +12 +4 +11 +14 +57 +31 +671644785 diff --git a/codenet/public_test_cases/p03388/output.1.txt b/codenet/public_test_cases/p03388/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a441b4420805c99cdc61b098822101a8daf9a3bb --- /dev/null +++ b/codenet/public_test_cases/p03388/output.1.txt @@ -0,0 +1,8 @@ +1 +12 +4 +11 +14 +57 +31 +671644785 diff --git a/codenet/public_test_cases/p03389/input.0.txt b/codenet/public_test_cases/p03389/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f874fb1787a11c117415a7630996e04db4f7d3b --- /dev/null +++ b/codenet/public_test_cases/p03389/input.0.txt @@ -0,0 +1 @@ +2 5 4 diff --git a/codenet/public_test_cases/p03389/output.0.txt b/codenet/public_test_cases/p03389/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03389/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03390/input.0.txt b/codenet/public_test_cases/p03390/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75634f5cd785fd5c79a8393807414205fb0f8bf6 --- /dev/null +++ b/codenet/public_test_cases/p03390/input.0.txt @@ -0,0 +1,9 @@ +8 +1 4 +10 5 +3 3 +4 11 +8 9 +22 40 +8 36 +314159265 358979323 diff --git a/codenet/public_test_cases/p03390/output.0.txt b/codenet/public_test_cases/p03390/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a441b4420805c99cdc61b098822101a8daf9a3bb --- /dev/null +++ b/codenet/public_test_cases/p03390/output.0.txt @@ -0,0 +1,8 @@ +1 +12 +4 +11 +14 +57 +31 +671644785 diff --git a/codenet/public_test_cases/p03391/input.0.txt b/codenet/public_test_cases/p03391/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cddb408d3053c71fef4e35a325b73a29bd20de68 --- /dev/null +++ b/codenet/public_test_cases/p03391/input.0.txt @@ -0,0 +1,3 @@ +2 +1 2 +3 2 diff --git a/codenet/public_test_cases/p03391/input.1.txt b/codenet/public_test_cases/p03391/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57f2f4f1ef927b5df058250434d022d49775aad4 --- /dev/null +++ b/codenet/public_test_cases/p03391/input.1.txt @@ -0,0 +1,4 @@ +3 +8 3 +0 1 +4 8 diff --git a/codenet/public_test_cases/p03391/input.2.txt b/codenet/public_test_cases/p03391/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..20478c63e5f63708f9e029bd32f2a98cf73cbd6b --- /dev/null +++ b/codenet/public_test_cases/p03391/input.2.txt @@ -0,0 +1,2 @@ +1 +1 1 diff --git a/codenet/public_test_cases/p03391/input.3.txt b/codenet/public_test_cases/p03391/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cddb408d3053c71fef4e35a325b73a29bd20de68 --- /dev/null +++ b/codenet/public_test_cases/p03391/input.3.txt @@ -0,0 +1,3 @@ +2 +1 2 +3 2 diff --git a/codenet/public_test_cases/p03391/output.0.txt b/codenet/public_test_cases/p03391/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03391/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03391/output.1.txt b/codenet/public_test_cases/p03391/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03391/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03391/output.2.txt b/codenet/public_test_cases/p03391/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03391/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03391/output.3.txt b/codenet/public_test_cases/p03391/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03391/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03392/input.0.txt b/codenet/public_test_cases/p03392/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8baef1b4abc478178b004d62031cf7fe6db6f903 --- /dev/null +++ b/codenet/public_test_cases/p03392/input.0.txt @@ -0,0 +1 @@ +abc diff --git a/codenet/public_test_cases/p03392/input.1.txt b/codenet/public_test_cases/p03392/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..607798036c180358c44a684d649284d5737beadd --- /dev/null +++ b/codenet/public_test_cases/p03392/input.1.txt @@ -0,0 +1 @@ +babacabac diff --git a/codenet/public_test_cases/p03392/input.2.txt b/codenet/public_test_cases/p03392/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa15d016e2f9d73c06643b385c7fb42d132e732b --- /dev/null +++ b/codenet/public_test_cases/p03392/input.2.txt @@ -0,0 +1 @@ +abbac diff --git a/codenet/public_test_cases/p03392/input.3.txt b/codenet/public_test_cases/p03392/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8baef1b4abc478178b004d62031cf7fe6db6f903 --- /dev/null +++ b/codenet/public_test_cases/p03392/input.3.txt @@ -0,0 +1 @@ +abc diff --git a/codenet/public_test_cases/p03392/input.4.txt b/codenet/public_test_cases/p03392/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6892e168c4a551d9f351dcf5654ffb23e2d98007 --- /dev/null +++ b/codenet/public_test_cases/p03392/input.4.txt @@ -0,0 +1 @@ +ababacbcacbacacbcbbcbbacbaccacbacbacba diff --git a/codenet/public_test_cases/p03392/output.0.txt b/codenet/public_test_cases/p03392/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03392/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03392/output.1.txt b/codenet/public_test_cases/p03392/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87fb4960b8024e33d3f4c5e2054c2593964ea2b2 --- /dev/null +++ b/codenet/public_test_cases/p03392/output.1.txt @@ -0,0 +1 @@ +6310 diff --git a/codenet/public_test_cases/p03392/output.2.txt b/codenet/public_test_cases/p03392/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1479e19b5fdf6c32d2eb41dad16203706f7d663d --- /dev/null +++ b/codenet/public_test_cases/p03392/output.2.txt @@ -0,0 +1 @@ +65 diff --git a/codenet/public_test_cases/p03392/output.3.txt b/codenet/public_test_cases/p03392/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03392/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03392/output.4.txt b/codenet/public_test_cases/p03392/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..70804d5416f5964d4feaeea032ac320a19ef1880 --- /dev/null +++ b/codenet/public_test_cases/p03392/output.4.txt @@ -0,0 +1 @@ +148010497 diff --git a/codenet/public_test_cases/p03393/input.0.txt b/codenet/public_test_cases/p03393/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ef13d11d0bc8c8cde49253ea4a0cdbea2c9416 --- /dev/null +++ b/codenet/public_test_cases/p03393/input.0.txt @@ -0,0 +1 @@ +atcoder diff --git a/codenet/public_test_cases/p03393/input.1.txt b/codenet/public_test_cases/p03393/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1993644d07fc23b02cf1c6e59d16bc0cc1a2cec --- /dev/null +++ b/codenet/public_test_cases/p03393/input.1.txt @@ -0,0 +1 @@ +zyxwvutsrqponmlkjihgfedcba diff --git a/codenet/public_test_cases/p03393/input.2.txt b/codenet/public_test_cases/p03393/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ef13d11d0bc8c8cde49253ea4a0cdbea2c9416 --- /dev/null +++ b/codenet/public_test_cases/p03393/input.2.txt @@ -0,0 +1 @@ +atcoder diff --git a/codenet/public_test_cases/p03393/input.3.txt b/codenet/public_test_cases/p03393/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cd85ae25f5715b96439d2e07c8608afc5215485 --- /dev/null +++ b/codenet/public_test_cases/p03393/input.3.txt @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwzyx diff --git a/codenet/public_test_cases/p03393/input.4.txt b/codenet/public_test_cases/p03393/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8baef1b4abc478178b004d62031cf7fe6db6f903 --- /dev/null +++ b/codenet/public_test_cases/p03393/input.4.txt @@ -0,0 +1 @@ +abc diff --git a/codenet/public_test_cases/p03393/output.0.txt b/codenet/public_test_cases/p03393/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eece1cefc1e0f47d8e22fe4b5cda976eb8d29ece --- /dev/null +++ b/codenet/public_test_cases/p03393/output.0.txt @@ -0,0 +1 @@ +atcoderb diff --git a/codenet/public_test_cases/p03393/output.1.txt b/codenet/public_test_cases/p03393/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03393/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03393/output.2.txt b/codenet/public_test_cases/p03393/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eece1cefc1e0f47d8e22fe4b5cda976eb8d29ece --- /dev/null +++ b/codenet/public_test_cases/p03393/output.2.txt @@ -0,0 +1 @@ +atcoderb diff --git a/codenet/public_test_cases/p03393/output.3.txt b/codenet/public_test_cases/p03393/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e46f4903ee612f28769122073a2fcd9f958599ae --- /dev/null +++ b/codenet/public_test_cases/p03393/output.3.txt @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvx diff --git a/codenet/public_test_cases/p03393/output.4.txt b/codenet/public_test_cases/p03393/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..acbe86c7c89586e0912a0a851bacf309c595c308 --- /dev/null +++ b/codenet/public_test_cases/p03393/output.4.txt @@ -0,0 +1 @@ +abcd diff --git a/codenet/public_test_cases/p03394/input.0.txt b/codenet/public_test_cases/p03394/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03394/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03394/input.1.txt b/codenet/public_test_cases/p03394/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03394/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03394/input.2.txt b/codenet/public_test_cases/p03394/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03394/input.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03394/output.0.txt b/codenet/public_test_cases/p03394/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9322dd1b3251f84a909fbc562c8474c3ec834e8f --- /dev/null +++ b/codenet/public_test_cases/p03394/output.0.txt @@ -0,0 +1 @@ +2 5 63 diff --git a/codenet/public_test_cases/p03394/output.1.txt b/codenet/public_test_cases/p03394/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9322dd1b3251f84a909fbc562c8474c3ec834e8f --- /dev/null +++ b/codenet/public_test_cases/p03394/output.1.txt @@ -0,0 +1 @@ +2 5 63 diff --git a/codenet/public_test_cases/p03394/output.2.txt b/codenet/public_test_cases/p03394/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..648717f8de9bf9f27d085d94735111c29a959cb7 --- /dev/null +++ b/codenet/public_test_cases/p03394/output.2.txt @@ -0,0 +1 @@ +2 5 20 63 diff --git a/codenet/public_test_cases/p03395/input.0.txt b/codenet/public_test_cases/p03395/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0668e09b0ad9383694adcbb0dc322cd5bc40590a --- /dev/null +++ b/codenet/public_test_cases/p03395/input.0.txt @@ -0,0 +1,3 @@ +3 +19 10 14 +0 3 4 diff --git a/codenet/public_test_cases/p03395/input.1.txt b/codenet/public_test_cases/p03395/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a6536b78abd91784ecf8a17461d28563496bb0b --- /dev/null +++ b/codenet/public_test_cases/p03395/input.1.txt @@ -0,0 +1,3 @@ +1 +50 +13 diff --git a/codenet/public_test_cases/p03395/input.2.txt b/codenet/public_test_cases/p03395/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..25091e1f75f09120b58af86aada4ed6bf285a5ac --- /dev/null +++ b/codenet/public_test_cases/p03395/input.2.txt @@ -0,0 +1,3 @@ +3 +19 15 14 +0 0 0 diff --git a/codenet/public_test_cases/p03395/input.3.txt b/codenet/public_test_cases/p03395/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0668e09b0ad9383694adcbb0dc322cd5bc40590a --- /dev/null +++ b/codenet/public_test_cases/p03395/input.3.txt @@ -0,0 +1,3 @@ +3 +19 10 14 +0 3 4 diff --git a/codenet/public_test_cases/p03395/input.4.txt b/codenet/public_test_cases/p03395/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b435552aa3f370d3fc1a52fd8e367f49cbc0874 --- /dev/null +++ b/codenet/public_test_cases/p03395/input.4.txt @@ -0,0 +1,3 @@ +4 +2 0 1 8 +2 0 1 8 diff --git a/codenet/public_test_cases/p03395/input.5.txt b/codenet/public_test_cases/p03395/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..1229bbaaf7c5b580f53970af6186313741c1aaa4 --- /dev/null +++ b/codenet/public_test_cases/p03395/input.5.txt @@ -0,0 +1,3 @@ +2 +8 13 +5 13 diff --git a/codenet/public_test_cases/p03395/output.0.txt b/codenet/public_test_cases/p03395/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a76256037d61ef7aed02f761d7673513e814e747 --- /dev/null +++ b/codenet/public_test_cases/p03395/output.0.txt @@ -0,0 +1 @@ +160 diff --git a/codenet/public_test_cases/p03395/output.1.txt b/codenet/public_test_cases/p03395/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee84a2d91ec47d5a0f4a234ac6fdc759abf41427 --- /dev/null +++ b/codenet/public_test_cases/p03395/output.1.txt @@ -0,0 +1 @@ +137438953472 diff --git a/codenet/public_test_cases/p03395/output.2.txt b/codenet/public_test_cases/p03395/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03395/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03395/output.3.txt b/codenet/public_test_cases/p03395/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a76256037d61ef7aed02f761d7673513e814e747 --- /dev/null +++ b/codenet/public_test_cases/p03395/output.3.txt @@ -0,0 +1 @@ +160 diff --git a/codenet/public_test_cases/p03395/output.4.txt b/codenet/public_test_cases/p03395/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03395/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03395/output.5.txt b/codenet/public_test_cases/p03395/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03395/output.5.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03396/input.0.txt b/codenet/public_test_cases/p03396/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcbef38bc84dfd25a4cb60f4f510e2750b4c387a --- /dev/null +++ b/codenet/public_test_cases/p03396/input.0.txt @@ -0,0 +1,3 @@ +2 10 +5 8 +10 4 diff --git a/codenet/public_test_cases/p03396/input.1.txt b/codenet/public_test_cases/p03396/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc7a5cfd1bc43aec524a4e3eba95a77eb067d2a8 --- /dev/null +++ b/codenet/public_test_cases/p03396/input.1.txt @@ -0,0 +1,3 @@ +5 100 +10 19 28 47 68 +200 200 200 200 200 diff --git a/codenet/public_test_cases/p03396/input.2.txt b/codenet/public_test_cases/p03396/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..66177d2a4f887202e540ca0a32fbea72c26218f6 --- /dev/null +++ b/codenet/public_test_cases/p03396/input.2.txt @@ -0,0 +1,3 @@ +2 10 +5 8 +10 5 diff --git a/codenet/public_test_cases/p03396/input.3.txt b/codenet/public_test_cases/p03396/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceb06284e023ae8fade79b2221cd706bae2493e8 --- /dev/null +++ b/codenet/public_test_cases/p03396/input.3.txt @@ -0,0 +1,3 @@ +8 1000000000 +2018 123456 1719128 1929183 9129198 10100101 77777777 120182018 +99999999 1000000000 1000000000 11291341 1 200 1 123812831 diff --git a/codenet/public_test_cases/p03396/input.4.txt b/codenet/public_test_cases/p03396/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcbef38bc84dfd25a4cb60f4f510e2750b4c387a --- /dev/null +++ b/codenet/public_test_cases/p03396/input.4.txt @@ -0,0 +1,3 @@ +2 10 +5 8 +10 4 diff --git a/codenet/public_test_cases/p03396/output.0.txt b/codenet/public_test_cases/p03396/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03396/output.0.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03396/output.1.txt b/codenet/public_test_cases/p03396/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59a3ec59b53573619be25381cf973b173e2a60ba --- /dev/null +++ b/codenet/public_test_cases/p03396/output.1.txt @@ -0,0 +1 @@ +1200 diff --git a/codenet/public_test_cases/p03396/output.2.txt b/codenet/public_test_cases/p03396/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p03396/output.2.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p03396/output.3.txt b/codenet/public_test_cases/p03396/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..558830c8e34aecc3697ce918d198ffe8a1685281 --- /dev/null +++ b/codenet/public_test_cases/p03396/output.3.txt @@ -0,0 +1 @@ +14000000000 diff --git a/codenet/public_test_cases/p03396/output.4.txt b/codenet/public_test_cases/p03396/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03396/output.4.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03397/input.0.txt b/codenet/public_test_cases/p03397/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c241ce0ad1db6d688c426c2289ab7a2d3a24eca --- /dev/null +++ b/codenet/public_test_cases/p03397/input.0.txt @@ -0,0 +1 @@ +1??00 diff --git a/codenet/public_test_cases/p03397/input.1.txt b/codenet/public_test_cases/p03397/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c241ce0ad1db6d688c426c2289ab7a2d3a24eca --- /dev/null +++ b/codenet/public_test_cases/p03397/input.1.txt @@ -0,0 +1 @@ +1??00 diff --git a/codenet/public_test_cases/p03397/input.2.txt b/codenet/public_test_cases/p03397/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..244331bec050b2d517680387ffaaea974504f7f2 --- /dev/null +++ b/codenet/public_test_cases/p03397/input.2.txt @@ -0,0 +1 @@ +?0101???10???00?1???????????????0????????????1????0 diff --git a/codenet/public_test_cases/p03397/input.3.txt b/codenet/public_test_cases/p03397/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1e2647d215e6f815cd5b3e1b7692197c26a8211 --- /dev/null +++ b/codenet/public_test_cases/p03397/input.3.txt @@ -0,0 +1 @@ +? diff --git a/codenet/public_test_cases/p03397/output.0.txt b/codenet/public_test_cases/p03397/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03397/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03397/output.1.txt b/codenet/public_test_cases/p03397/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03397/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03397/output.2.txt b/codenet/public_test_cases/p03397/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b6b75a4e23b18390de2ceabb9e331d1b23c385a --- /dev/null +++ b/codenet/public_test_cases/p03397/output.2.txt @@ -0,0 +1 @@ +402589311 diff --git a/codenet/public_test_cases/p03397/output.3.txt b/codenet/public_test_cases/p03397/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03397/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03398/input.0.txt b/codenet/public_test_cases/p03398/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03398/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03398/input.1.txt b/codenet/public_test_cases/p03398/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03398/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03398/input.2.txt b/codenet/public_test_cases/p03398/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03398/input.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03398/input.3.txt b/codenet/public_test_cases/p03398/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03398/input.3.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03398/output.0.txt b/codenet/public_test_cases/p03398/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03398/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03398/output.1.txt b/codenet/public_test_cases/p03398/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03398/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03398/output.2.txt b/codenet/public_test_cases/p03398/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..871727de1fd703d0c4aab92017011c373e795b67 --- /dev/null +++ b/codenet/public_test_cases/p03398/output.2.txt @@ -0,0 +1 @@ +84 diff --git a/codenet/public_test_cases/p03398/output.3.txt b/codenet/public_test_cases/p03398/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00dba995a9f91dc9e98416655afa35599aaeded3 --- /dev/null +++ b/codenet/public_test_cases/p03398/output.3.txt @@ -0,0 +1 @@ +487772376 diff --git a/codenet/public_test_cases/p03399/input.0.txt b/codenet/public_test_cases/p03399/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00fdd0aa2f7197523954619d97fb21b969a0efc3 --- /dev/null +++ b/codenet/public_test_cases/p03399/input.0.txt @@ -0,0 +1,4 @@ +600 +300 +220 +420 diff --git a/codenet/public_test_cases/p03399/input.1.txt b/codenet/public_test_cases/p03399/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ac8fa07150890de55686e4b169957901b4b85c4 --- /dev/null +++ b/codenet/public_test_cases/p03399/input.1.txt @@ -0,0 +1,4 @@ +549 +817 +715 +603 diff --git a/codenet/public_test_cases/p03399/input.2.txt b/codenet/public_test_cases/p03399/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2685621e480ca279b790e15d8a2ef323507c9ed5 --- /dev/null +++ b/codenet/public_test_cases/p03399/input.2.txt @@ -0,0 +1,4 @@ +555 +555 +400 +200 diff --git a/codenet/public_test_cases/p03399/input.3.txt b/codenet/public_test_cases/p03399/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00fdd0aa2f7197523954619d97fb21b969a0efc3 --- /dev/null +++ b/codenet/public_test_cases/p03399/input.3.txt @@ -0,0 +1,4 @@ +600 +300 +220 +420 diff --git a/codenet/public_test_cases/p03399/output.0.txt b/codenet/public_test_cases/p03399/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2596e4ad8c6f16a47bf4e33e8e2b291c89d40c88 --- /dev/null +++ b/codenet/public_test_cases/p03399/output.0.txt @@ -0,0 +1 @@ +520 diff --git a/codenet/public_test_cases/p03399/output.1.txt b/codenet/public_test_cases/p03399/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d98057a110d4093515a66f94858edc071b5cdf72 --- /dev/null +++ b/codenet/public_test_cases/p03399/output.1.txt @@ -0,0 +1 @@ +1152 diff --git a/codenet/public_test_cases/p03399/output.2.txt b/codenet/public_test_cases/p03399/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..20610ea7288b69eaa9fadc204f2feebef59b8226 --- /dev/null +++ b/codenet/public_test_cases/p03399/output.2.txt @@ -0,0 +1 @@ +755 diff --git a/codenet/public_test_cases/p03399/output.3.txt b/codenet/public_test_cases/p03399/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2596e4ad8c6f16a47bf4e33e8e2b291c89d40c88 --- /dev/null +++ b/codenet/public_test_cases/p03399/output.3.txt @@ -0,0 +1 @@ +520 diff --git a/codenet/public_test_cases/p03400/input.0.txt b/codenet/public_test_cases/p03400/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..04756e1cd9a20d6891a36ffef918c3b983941710 --- /dev/null +++ b/codenet/public_test_cases/p03400/input.0.txt @@ -0,0 +1,5 @@ +3 +7 1 +2 +5 +10 diff --git a/codenet/public_test_cases/p03400/input.1.txt b/codenet/public_test_cases/p03400/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..10e81f357f1d9422755fc405494dfeea801572b9 --- /dev/null +++ b/codenet/public_test_cases/p03400/input.1.txt @@ -0,0 +1,7 @@ +5 +30 44 +26 +18 +81 +18 +6 diff --git a/codenet/public_test_cases/p03400/input.2.txt b/codenet/public_test_cases/p03400/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..04756e1cd9a20d6891a36ffef918c3b983941710 --- /dev/null +++ b/codenet/public_test_cases/p03400/input.2.txt @@ -0,0 +1,5 @@ +3 +7 1 +2 +5 +10 diff --git a/codenet/public_test_cases/p03400/input.3.txt b/codenet/public_test_cases/p03400/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a025994494d6913f853bffd91c24a80c5ce713ec --- /dev/null +++ b/codenet/public_test_cases/p03400/input.3.txt @@ -0,0 +1,4 @@ +2 +8 20 +1 +10 diff --git a/codenet/public_test_cases/p03400/output.0.txt b/codenet/public_test_cases/p03400/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03400/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03400/output.1.txt b/codenet/public_test_cases/p03400/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b91e0e1f8dddaac700b51aa7a66f29fc135a02 --- /dev/null +++ b/codenet/public_test_cases/p03400/output.1.txt @@ -0,0 +1 @@ +56 diff --git a/codenet/public_test_cases/p03400/output.2.txt b/codenet/public_test_cases/p03400/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03400/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03400/output.3.txt b/codenet/public_test_cases/p03400/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f04c001f3f7fd5d290d0264b4a2c35f7b159ac42 --- /dev/null +++ b/codenet/public_test_cases/p03400/output.3.txt @@ -0,0 +1 @@ +29 diff --git a/codenet/public_test_cases/p03401/input.0.txt b/codenet/public_test_cases/p03401/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dc439f2eb0856f932a668e97d6e7348d42cecd8 --- /dev/null +++ b/codenet/public_test_cases/p03401/input.0.txt @@ -0,0 +1,2 @@ +3 +3 5 -1 diff --git a/codenet/public_test_cases/p03401/output.0.txt b/codenet/public_test_cases/p03401/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61106bad49b1b9d3e6936409cebbcb9e08629e10 --- /dev/null +++ b/codenet/public_test_cases/p03401/output.0.txt @@ -0,0 +1,3 @@ +12 +8 +10 diff --git a/codenet/public_test_cases/p03402/input.0.txt b/codenet/public_test_cases/p03402/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p03402/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p03402/output.0.txt b/codenet/public_test_cases/p03402/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..092d4bc252c7463f975a966da607162ac9bd33ad --- /dev/null +++ b/codenet/public_test_cases/p03402/output.0.txt @@ -0,0 +1,4 @@ +3 3 +##. +..# +#.# diff --git a/codenet/public_test_cases/p03403/input.0.txt b/codenet/public_test_cases/p03403/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dc439f2eb0856f932a668e97d6e7348d42cecd8 --- /dev/null +++ b/codenet/public_test_cases/p03403/input.0.txt @@ -0,0 +1,2 @@ +3 +3 5 -1 diff --git a/codenet/public_test_cases/p03403/input.1.txt b/codenet/public_test_cases/p03403/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5d24bc383ea33fca8835c4094aa3556d035ca92 --- /dev/null +++ b/codenet/public_test_cases/p03403/input.1.txt @@ -0,0 +1,2 @@ +6 +-679 -2409 -3258 3095 -3291 -4462 diff --git a/codenet/public_test_cases/p03403/input.2.txt b/codenet/public_test_cases/p03403/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaab4ebd1e4304cb89081074aec9012816261043 --- /dev/null +++ b/codenet/public_test_cases/p03403/input.2.txt @@ -0,0 +1,2 @@ +5 +1 1 1 2 0 diff --git a/codenet/public_test_cases/p03403/input.3.txt b/codenet/public_test_cases/p03403/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dc439f2eb0856f932a668e97d6e7348d42cecd8 --- /dev/null +++ b/codenet/public_test_cases/p03403/input.3.txt @@ -0,0 +1,2 @@ +3 +3 5 -1 diff --git a/codenet/public_test_cases/p03403/output.0.txt b/codenet/public_test_cases/p03403/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61106bad49b1b9d3e6936409cebbcb9e08629e10 --- /dev/null +++ b/codenet/public_test_cases/p03403/output.0.txt @@ -0,0 +1,3 @@ +12 +8 +10 diff --git a/codenet/public_test_cases/p03403/output.1.txt b/codenet/public_test_cases/p03403/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..677d532b9612a4cba8781927cd609b91e70221e9 --- /dev/null +++ b/codenet/public_test_cases/p03403/output.1.txt @@ -0,0 +1,6 @@ +21630 +21630 +19932 +8924 +21630 +19288 diff --git a/codenet/public_test_cases/p03403/output.2.txt b/codenet/public_test_cases/p03403/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0250ece50170aae2112fb508aafd3f21b727d9f0 --- /dev/null +++ b/codenet/public_test_cases/p03403/output.2.txt @@ -0,0 +1,5 @@ +4 +4 +4 +2 +4 diff --git a/codenet/public_test_cases/p03403/output.3.txt b/codenet/public_test_cases/p03403/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..61106bad49b1b9d3e6936409cebbcb9e08629e10 --- /dev/null +++ b/codenet/public_test_cases/p03403/output.3.txt @@ -0,0 +1,3 @@ +12 +8 +10 diff --git a/codenet/public_test_cases/p03404/input.0.txt b/codenet/public_test_cases/p03404/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p03404/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p03404/input.1.txt b/codenet/public_test_cases/p03404/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9bc2800face87e33ba810a198560950690ca0e6 --- /dev/null +++ b/codenet/public_test_cases/p03404/input.1.txt @@ -0,0 +1 @@ +3 14 diff --git a/codenet/public_test_cases/p03404/input.2.txt b/codenet/public_test_cases/p03404/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03404/input.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03404/input.3.txt b/codenet/public_test_cases/p03404/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p03404/input.3.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p03404/input.4.txt b/codenet/public_test_cases/p03404/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0f2aade42a279fe8df32c991ade97cd15afa097 --- /dev/null +++ b/codenet/public_test_cases/p03404/input.4.txt @@ -0,0 +1 @@ +7 8 diff --git a/codenet/public_test_cases/p03404/output.0.txt b/codenet/public_test_cases/p03404/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..092d4bc252c7463f975a966da607162ac9bd33ad --- /dev/null +++ b/codenet/public_test_cases/p03404/output.0.txt @@ -0,0 +1,4 @@ +3 3 +##. +..# +#.# diff --git a/codenet/public_test_cases/p03404/output.1.txt b/codenet/public_test_cases/p03404/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..66cdc307b5aaa1f11c25760125677d5131a328c5 --- /dev/null +++ b/codenet/public_test_cases/p03404/output.1.txt @@ -0,0 +1,9 @@ +8 18 +.................. +.................. +....##.......####. +....#.#.....#..... +...#...#....#..... +..#.###.#...#..... +.#.......#..#..... +.........#..####. diff --git a/codenet/public_test_cases/p03404/output.2.txt b/codenet/public_test_cases/p03404/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd392727d6cf11b92f2d39285ad39d54cdd654ac --- /dev/null +++ b/codenet/public_test_cases/p03404/output.2.txt @@ -0,0 +1,3 @@ +4 2 +.. +. diff --git a/codenet/public_test_cases/p03404/output.3.txt b/codenet/public_test_cases/p03404/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..092d4bc252c7463f975a966da607162ac9bd33ad --- /dev/null +++ b/codenet/public_test_cases/p03404/output.3.txt @@ -0,0 +1,4 @@ +3 3 +##. +..# +#.# diff --git a/codenet/public_test_cases/p03404/output.4.txt b/codenet/public_test_cases/p03404/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef8d7d345ca3b03cd45a792d81d4bdb326186553 --- /dev/null +++ b/codenet/public_test_cases/p03404/output.4.txt @@ -0,0 +1,4 @@ +3 5 +.#.# +.#.#. +.#.# diff --git a/codenet/public_test_cases/p03405/input.0.txt b/codenet/public_test_cases/p03405/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8ed633c035e6c011b87ff8dd34a9223a865539b --- /dev/null +++ b/codenet/public_test_cases/p03405/input.0.txt @@ -0,0 +1,5 @@ +3 3 +2 +1 2 1 +2 3 1 +3 1 1 diff --git a/codenet/public_test_cases/p03405/input.1.txt b/codenet/public_test_cases/p03405/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b6a2fad7ee2d029f2c0066be579ef813f396822 --- /dev/null +++ b/codenet/public_test_cases/p03405/input.1.txt @@ -0,0 +1,6 @@ +5 4 +1 +1 2 3 +1 3 3 +2 4 6 +2 5 8 diff --git a/codenet/public_test_cases/p03405/input.2.txt b/codenet/public_test_cases/p03405/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bd4d2585aa8a6a8495c96c49d719cfbf9299191 --- /dev/null +++ b/codenet/public_test_cases/p03405/input.2.txt @@ -0,0 +1,12 @@ +8 10 +49 +4 6 10 +8 4 11 +5 8 9 +1 8 10 +3 8 128773450 +7 8 10 +4 2 4 +3 4 1 +3 1 13 +5 2 2 diff --git a/codenet/public_test_cases/p03405/input.3.txt b/codenet/public_test_cases/p03405/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8ed633c035e6c011b87ff8dd34a9223a865539b --- /dev/null +++ b/codenet/public_test_cases/p03405/input.3.txt @@ -0,0 +1,5 @@ +3 3 +2 +1 2 1 +2 3 1 +3 1 1 diff --git a/codenet/public_test_cases/p03405/input.4.txt b/codenet/public_test_cases/p03405/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6dc4f0fca4e64d66fdb1729dc83a291f3a6e47a3 --- /dev/null +++ b/codenet/public_test_cases/p03405/input.4.txt @@ -0,0 +1,5 @@ +3 3 +3 +1 2 1 +2 3 1 +3 1 2 diff --git a/codenet/public_test_cases/p03405/output.0.txt b/codenet/public_test_cases/p03405/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03405/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03405/output.1.txt b/codenet/public_test_cases/p03405/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03405/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03405/output.2.txt b/codenet/public_test_cases/p03405/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03405/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03405/output.3.txt b/codenet/public_test_cases/p03405/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03405/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03405/output.4.txt b/codenet/public_test_cases/p03405/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03405/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03406/input.0.txt b/codenet/public_test_cases/p03406/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b228a8a8765df50079d8bf241122bd4acdde9ee --- /dev/null +++ b/codenet/public_test_cases/p03406/input.0.txt @@ -0,0 +1,2 @@ +2 1 +3 diff --git a/codenet/public_test_cases/p03406/input.1.txt b/codenet/public_test_cases/p03406/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..86c1be2917e2e793d86e3a05fbfb76d75290b10c --- /dev/null +++ b/codenet/public_test_cases/p03406/input.1.txt @@ -0,0 +1,2 @@ +4 3 +2 4 6 diff --git a/codenet/public_test_cases/p03406/input.2.txt b/codenet/public_test_cases/p03406/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c91fc456a55f62b231b0bb99a48540e5320a73b --- /dev/null +++ b/codenet/public_test_cases/p03406/input.2.txt @@ -0,0 +1 @@ +3 0 diff --git a/codenet/public_test_cases/p03406/input.3.txt b/codenet/public_test_cases/p03406/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b228a8a8765df50079d8bf241122bd4acdde9ee --- /dev/null +++ b/codenet/public_test_cases/p03406/input.3.txt @@ -0,0 +1,2 @@ +2 1 +3 diff --git a/codenet/public_test_cases/p03406/input.4.txt b/codenet/public_test_cases/p03406/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..39cea4dfe78f4f3265beb608fdc2de43d1405f4a --- /dev/null +++ b/codenet/public_test_cases/p03406/input.4.txt @@ -0,0 +1,2 @@ +16 16 +5489 5490 5491 5492 5493 5494 5495 5497 18993 18995 18997 18999 19000 19001 19002 19003 diff --git a/codenet/public_test_cases/p03406/input.5.txt b/codenet/public_test_cases/p03406/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d43e2ae3a35a39a0f05795fba6fbdd7a5f051727 --- /dev/null +++ b/codenet/public_test_cases/p03406/input.5.txt @@ -0,0 +1,2 @@ +3 3 +3 4 7 diff --git a/codenet/public_test_cases/p03406/output.0.txt b/codenet/public_test_cases/p03406/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03406/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03406/output.1.txt b/codenet/public_test_cases/p03406/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03406/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03406/output.2.txt b/codenet/public_test_cases/p03406/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..47ae14062c08ea3d66fbc0f4b639ff02364d6795 --- /dev/null +++ b/codenet/public_test_cases/p03406/output.2.txt @@ -0,0 +1 @@ +40320 diff --git a/codenet/public_test_cases/p03406/output.3.txt b/codenet/public_test_cases/p03406/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03406/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03406/output.4.txt b/codenet/public_test_cases/p03406/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..49cfd069eac9e4e3099b31166a6d2fdadce81adc --- /dev/null +++ b/codenet/public_test_cases/p03406/output.4.txt @@ -0,0 +1 @@ +816646464 diff --git a/codenet/public_test_cases/p03406/output.5.txt b/codenet/public_test_cases/p03406/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e46834fcb95642cbbf4e3ed93d3275d73eb2e57 --- /dev/null +++ b/codenet/public_test_cases/p03406/output.5.txt @@ -0,0 +1 @@ +2688 diff --git a/codenet/public_test_cases/p03407/input.0.txt b/codenet/public_test_cases/p03407/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3998a7768704301789cc488c2000978dfaf9dfe --- /dev/null +++ b/codenet/public_test_cases/p03407/input.0.txt @@ -0,0 +1 @@ +50 100 120 diff --git a/codenet/public_test_cases/p03407/input.1.txt b/codenet/public_test_cases/p03407/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b28ee049abcb4d8c81739ddec3b7e59392fd5827 --- /dev/null +++ b/codenet/public_test_cases/p03407/input.1.txt @@ -0,0 +1 @@ +500 100 1000 diff --git a/codenet/public_test_cases/p03407/input.2.txt b/codenet/public_test_cases/p03407/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfba0ee6ee03fa96c1366904355e3bfbc2b5102d --- /dev/null +++ b/codenet/public_test_cases/p03407/input.2.txt @@ -0,0 +1 @@ +19 123 143 diff --git a/codenet/public_test_cases/p03407/input.3.txt b/codenet/public_test_cases/p03407/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..92177e316354cc5abf6765eb123263291c115322 --- /dev/null +++ b/codenet/public_test_cases/p03407/input.3.txt @@ -0,0 +1 @@ +19 123 142 diff --git a/codenet/public_test_cases/p03407/input.4.txt b/codenet/public_test_cases/p03407/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3998a7768704301789cc488c2000978dfaf9dfe --- /dev/null +++ b/codenet/public_test_cases/p03407/input.4.txt @@ -0,0 +1 @@ +50 100 120 diff --git a/codenet/public_test_cases/p03407/output.0.txt b/codenet/public_test_cases/p03407/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03407/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03407/output.1.txt b/codenet/public_test_cases/p03407/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03407/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03407/output.2.txt b/codenet/public_test_cases/p03407/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03407/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03407/output.3.txt b/codenet/public_test_cases/p03407/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03407/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03407/output.4.txt b/codenet/public_test_cases/p03407/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03407/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03408/input.0.txt b/codenet/public_test_cases/p03408/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dade5022317f676d8d6c2cbcb3f86a9151310645 --- /dev/null +++ b/codenet/public_test_cases/p03408/input.0.txt @@ -0,0 +1,6 @@ +3 +apple +orange +apple +1 +grape diff --git a/codenet/public_test_cases/p03408/input.1.txt b/codenet/public_test_cases/p03408/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3e259e9d57ab82625427a7c49b6ab452e78b86a --- /dev/null +++ b/codenet/public_test_cases/p03408/input.1.txt @@ -0,0 +1,10 @@ +3 +apple +orange +apple +5 +apple +apple +apple +apple +apple diff --git a/codenet/public_test_cases/p03408/input.2.txt b/codenet/public_test_cases/p03408/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dade5022317f676d8d6c2cbcb3f86a9151310645 --- /dev/null +++ b/codenet/public_test_cases/p03408/input.2.txt @@ -0,0 +1,6 @@ +3 +apple +orange +apple +1 +grape diff --git a/codenet/public_test_cases/p03408/input.3.txt b/codenet/public_test_cases/p03408/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d1db09fff74dc655e5d554bc48e326ad0bae7bf --- /dev/null +++ b/codenet/public_test_cases/p03408/input.3.txt @@ -0,0 +1,13 @@ +6 +red +red +blue +yellow +yellow +red +5 +red +red +yellow +green +blue diff --git a/codenet/public_test_cases/p03408/input.4.txt b/codenet/public_test_cases/p03408/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e3f820709506d026fa3756faaea37870d49a90b --- /dev/null +++ b/codenet/public_test_cases/p03408/input.4.txt @@ -0,0 +1,13 @@ +1 +voldemort +10 +voldemort +voldemort +voldemort +voldemort +voldemort +voldemort +voldemort +voldemort +voldemort +voldemort diff --git a/codenet/public_test_cases/p03408/output.0.txt b/codenet/public_test_cases/p03408/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03408/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03408/output.1.txt b/codenet/public_test_cases/p03408/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03408/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03408/output.2.txt b/codenet/public_test_cases/p03408/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03408/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03408/output.3.txt b/codenet/public_test_cases/p03408/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03408/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03408/output.4.txt b/codenet/public_test_cases/p03408/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03408/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03409/input.0.txt b/codenet/public_test_cases/p03409/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa4f6ecb29fd886704c864e5382a28090d79e777 --- /dev/null +++ b/codenet/public_test_cases/p03409/input.0.txt @@ -0,0 +1,7 @@ +3 +2 0 +3 1 +1 3 +4 2 +0 4 +5 5 diff --git a/codenet/public_test_cases/p03409/input.1.txt b/codenet/public_test_cases/p03409/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a24277c905372847d921e20aa32c59832cb9ab8 --- /dev/null +++ b/codenet/public_test_cases/p03409/input.1.txt @@ -0,0 +1,5 @@ +2 +2 2 +3 3 +0 0 +1 1 diff --git a/codenet/public_test_cases/p03409/input.2.txt b/codenet/public_test_cases/p03409/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a289f752d6f5d1bbf3e372228fdf25e95f0d2f6 --- /dev/null +++ b/codenet/public_test_cases/p03409/input.2.txt @@ -0,0 +1,11 @@ +5 +0 0 +7 3 +2 2 +4 8 +1 6 +8 5 +6 9 +5 4 +9 1 +3 7 diff --git a/codenet/public_test_cases/p03409/input.3.txt b/codenet/public_test_cases/p03409/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc33f92b6b22ba15712901e38991c00283e374e9 --- /dev/null +++ b/codenet/public_test_cases/p03409/input.3.txt @@ -0,0 +1,11 @@ +5 +0 0 +1 1 +5 5 +6 6 +7 7 +2 2 +3 3 +4 4 +8 8 +9 9 diff --git a/codenet/public_test_cases/p03409/input.4.txt b/codenet/public_test_cases/p03409/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b400d78a9a475aa491b387e390d098d69ad6b17 --- /dev/null +++ b/codenet/public_test_cases/p03409/input.4.txt @@ -0,0 +1,7 @@ +3 +0 0 +1 1 +5 2 +2 3 +3 4 +4 5 diff --git a/codenet/public_test_cases/p03409/input.5.txt b/codenet/public_test_cases/p03409/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa4f6ecb29fd886704c864e5382a28090d79e777 --- /dev/null +++ b/codenet/public_test_cases/p03409/input.5.txt @@ -0,0 +1,7 @@ +3 +2 0 +3 1 +1 3 +4 2 +0 4 +5 5 diff --git a/codenet/public_test_cases/p03409/output.0.txt b/codenet/public_test_cases/p03409/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03409/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03409/output.1.txt b/codenet/public_test_cases/p03409/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03409/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03409/output.2.txt b/codenet/public_test_cases/p03409/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03409/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03409/output.3.txt b/codenet/public_test_cases/p03409/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03409/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03409/output.4.txt b/codenet/public_test_cases/p03409/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03409/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03409/output.5.txt b/codenet/public_test_cases/p03409/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03409/output.5.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03411/input.0.txt b/codenet/public_test_cases/p03411/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa4f6ecb29fd886704c864e5382a28090d79e777 --- /dev/null +++ b/codenet/public_test_cases/p03411/input.0.txt @@ -0,0 +1,7 @@ +3 +2 0 +3 1 +1 3 +4 2 +0 4 +5 5 diff --git a/codenet/public_test_cases/p03411/output.0.txt b/codenet/public_test_cases/p03411/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03411/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03413/input.0.txt b/codenet/public_test_cases/p03413/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1bc8f7d2eef622e7d87f02a25e6db05bb096580 --- /dev/null +++ b/codenet/public_test_cases/p03413/input.0.txt @@ -0,0 +1,2 @@ +5 +1 4 3 7 5 diff --git a/codenet/public_test_cases/p03413/input.1.txt b/codenet/public_test_cases/p03413/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1bc8f7d2eef622e7d87f02a25e6db05bb096580 --- /dev/null +++ b/codenet/public_test_cases/p03413/input.1.txt @@ -0,0 +1,2 @@ +5 +1 4 3 7 5 diff --git a/codenet/public_test_cases/p03413/input.2.txt b/codenet/public_test_cases/p03413/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d52e8fdb07d39ea74905c4875baa8b74eb7b88a --- /dev/null +++ b/codenet/public_test_cases/p03413/input.2.txt @@ -0,0 +1,2 @@ +6 +-1 -2 -3 1 2 3 diff --git a/codenet/public_test_cases/p03413/input.3.txt b/codenet/public_test_cases/p03413/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb89523406cd9c26d49e82d9eedfca2fcc19c703 --- /dev/null +++ b/codenet/public_test_cases/p03413/input.3.txt @@ -0,0 +1,2 @@ +4 +100 100 -1 100 diff --git a/codenet/public_test_cases/p03413/input.4.txt b/codenet/public_test_cases/p03413/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9238b74f92269d8617c866344d5fcc1b243abf1f --- /dev/null +++ b/codenet/public_test_cases/p03413/input.4.txt @@ -0,0 +1,2 @@ +9 +1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 diff --git a/codenet/public_test_cases/p03413/output.0.txt b/codenet/public_test_cases/p03413/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4455baa19c08d457f6b678d55e60715b75ee1757 --- /dev/null +++ b/codenet/public_test_cases/p03413/output.0.txt @@ -0,0 +1,5 @@ +11 +3 +1 +4 +2 diff --git a/codenet/public_test_cases/p03413/output.1.txt b/codenet/public_test_cases/p03413/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4455baa19c08d457f6b678d55e60715b75ee1757 --- /dev/null +++ b/codenet/public_test_cases/p03413/output.1.txt @@ -0,0 +1,5 @@ +11 +3 +1 +4 +2 diff --git a/codenet/public_test_cases/p03413/output.2.txt b/codenet/public_test_cases/p03413/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bacf65af6ecf75e2685d4f843673dff776a3e78 --- /dev/null +++ b/codenet/public_test_cases/p03413/output.2.txt @@ -0,0 +1,5 @@ +4 +3 +2 +1 +2 diff --git a/codenet/public_test_cases/p03413/output.3.txt b/codenet/public_test_cases/p03413/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d01d7fafe07d0cec92e4223545a613dc6c5b4f9 --- /dev/null +++ b/codenet/public_test_cases/p03413/output.3.txt @@ -0,0 +1,4 @@ +200 +2 +3 +1 diff --git a/codenet/public_test_cases/p03413/output.4.txt b/codenet/public_test_cases/p03413/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec2c60768331edfe7710ab3f4b03f7825dffec3a --- /dev/null +++ b/codenet/public_test_cases/p03413/output.4.txt @@ -0,0 +1,6 @@ +5000000000 +4 +2 +2 +2 +2 diff --git a/codenet/public_test_cases/p03414/input.0.txt b/codenet/public_test_cases/p03414/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc88773658f25592fbc224fa48bd285513c79119 --- /dev/null +++ b/codenet/public_test_cases/p03414/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03414/input.1.txt b/codenet/public_test_cases/p03414/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf26463ad0c816f4a3965504e371b6421ce43892 --- /dev/null +++ b/codenet/public_test_cases/p03414/input.1.txt @@ -0,0 +1,3 @@ +2 2 +1 2 +2 1 diff --git a/codenet/public_test_cases/p03414/input.2.txt b/codenet/public_test_cases/p03414/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad89de4f73c57c9b8de5b9861a71c5d09f6ee61a --- /dev/null +++ b/codenet/public_test_cases/p03414/input.2.txt @@ -0,0 +1,10 @@ +5 9 +3 2 +3 1 +4 1 +4 2 +3 5 +5 3 +3 4 +1 2 +2 5 diff --git a/codenet/public_test_cases/p03414/input.3.txt b/codenet/public_test_cases/p03414/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc88773658f25592fbc224fa48bd285513c79119 --- /dev/null +++ b/codenet/public_test_cases/p03414/input.3.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03414/output.0.txt b/codenet/public_test_cases/p03414/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b70316906487f63797257c15519d1bc4ca5ba5dc --- /dev/null +++ b/codenet/public_test_cases/p03414/output.0.txt @@ -0,0 +1,3 @@ +same +diff +same diff --git a/codenet/public_test_cases/p03414/output.1.txt b/codenet/public_test_cases/p03414/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac1722ac22d746beccc1ee4ed1d36eca9d5ed510 --- /dev/null +++ b/codenet/public_test_cases/p03414/output.1.txt @@ -0,0 +1,2 @@ +diff +diff diff --git a/codenet/public_test_cases/p03414/output.2.txt b/codenet/public_test_cases/p03414/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1922e21a34e644ad8afcf2f67edbffb7d215681b --- /dev/null +++ b/codenet/public_test_cases/p03414/output.2.txt @@ -0,0 +1,9 @@ +same +same +same +same +same +diff +diff +diff +diff diff --git a/codenet/public_test_cases/p03414/output.3.txt b/codenet/public_test_cases/p03414/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b70316906487f63797257c15519d1bc4ca5ba5dc --- /dev/null +++ b/codenet/public_test_cases/p03414/output.3.txt @@ -0,0 +1,3 @@ +same +diff +same diff --git a/codenet/public_test_cases/p03415/input.0.txt b/codenet/public_test_cases/p03415/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bbf266f932bfce59bb80af1bbc63c825dd12dc4 --- /dev/null +++ b/codenet/public_test_cases/p03415/input.0.txt @@ -0,0 +1,3 @@ +ant +obe +rec diff --git a/codenet/public_test_cases/p03415/input.1.txt b/codenet/public_test_cases/p03415/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bbf266f932bfce59bb80af1bbc63c825dd12dc4 --- /dev/null +++ b/codenet/public_test_cases/p03415/input.1.txt @@ -0,0 +1,3 @@ +ant +obe +rec diff --git a/codenet/public_test_cases/p03415/input.2.txt b/codenet/public_test_cases/p03415/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b9bf45fdb839d511af320c591e0ef78e2153583 --- /dev/null +++ b/codenet/public_test_cases/p03415/input.2.txt @@ -0,0 +1,3 @@ +edu +cat +ion diff --git a/codenet/public_test_cases/p03415/output.0.txt b/codenet/public_test_cases/p03415/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8baef1b4abc478178b004d62031cf7fe6db6f903 --- /dev/null +++ b/codenet/public_test_cases/p03415/output.0.txt @@ -0,0 +1 @@ +abc diff --git a/codenet/public_test_cases/p03415/output.1.txt b/codenet/public_test_cases/p03415/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8baef1b4abc478178b004d62031cf7fe6db6f903 --- /dev/null +++ b/codenet/public_test_cases/p03415/output.1.txt @@ -0,0 +1 @@ +abc diff --git a/codenet/public_test_cases/p03415/output.2.txt b/codenet/public_test_cases/p03415/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..839b2b5b6ea5416b1b8865f6355b13726b22b57c --- /dev/null +++ b/codenet/public_test_cases/p03415/output.2.txt @@ -0,0 +1 @@ +ean diff --git a/codenet/public_test_cases/p03416/input.0.txt b/codenet/public_test_cases/p03416/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a19342feb458b578623e743066cb44bb6a7bcf1d --- /dev/null +++ b/codenet/public_test_cases/p03416/input.0.txt @@ -0,0 +1 @@ +11009 11332 diff --git a/codenet/public_test_cases/p03416/input.1.txt b/codenet/public_test_cases/p03416/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a19342feb458b578623e743066cb44bb6a7bcf1d --- /dev/null +++ b/codenet/public_test_cases/p03416/input.1.txt @@ -0,0 +1 @@ +11009 11332 diff --git a/codenet/public_test_cases/p03416/input.2.txt b/codenet/public_test_cases/p03416/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff904126b615999b0706efbf2ad8d4a17d8e3ba8 --- /dev/null +++ b/codenet/public_test_cases/p03416/input.2.txt @@ -0,0 +1 @@ +31415 92653 diff --git a/codenet/public_test_cases/p03416/output.0.txt b/codenet/public_test_cases/p03416/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03416/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03416/output.1.txt b/codenet/public_test_cases/p03416/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03416/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03416/output.2.txt b/codenet/public_test_cases/p03416/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..282d20871cc15e3ba3484e25c322aba39a5a714c --- /dev/null +++ b/codenet/public_test_cases/p03416/output.2.txt @@ -0,0 +1 @@ +612 diff --git a/codenet/public_test_cases/p03417/input.0.txt b/codenet/public_test_cases/p03417/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03417/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03417/output.0.txt b/codenet/public_test_cases/p03417/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03417/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03418/input.0.txt b/codenet/public_test_cases/p03418/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p03418/input.0.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p03418/output.0.txt b/codenet/public_test_cases/p03418/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03418/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03419/input.0.txt b/codenet/public_test_cases/p03419/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03419/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03419/input.1.txt b/codenet/public_test_cases/p03419/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c15dab81887ba3cead7b6a121c63e52c1792a2da --- /dev/null +++ b/codenet/public_test_cases/p03419/input.1.txt @@ -0,0 +1 @@ +1 7 diff --git a/codenet/public_test_cases/p03419/input.2.txt b/codenet/public_test_cases/p03419/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03419/input.2.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03419/input.3.txt b/codenet/public_test_cases/p03419/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b6b48550ce9ae0eae3d26928cfd917c62bccc54 --- /dev/null +++ b/codenet/public_test_cases/p03419/input.3.txt @@ -0,0 +1 @@ +314 1592 diff --git a/codenet/public_test_cases/p03419/output.0.txt b/codenet/public_test_cases/p03419/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03419/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03419/output.1.txt b/codenet/public_test_cases/p03419/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03419/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03419/output.2.txt b/codenet/public_test_cases/p03419/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03419/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03419/output.3.txt b/codenet/public_test_cases/p03419/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..98e1391a75a579227c2994911b140716f445ad58 --- /dev/null +++ b/codenet/public_test_cases/p03419/output.3.txt @@ -0,0 +1 @@ +496080 diff --git a/codenet/public_test_cases/p03420/input.0.txt b/codenet/public_test_cases/p03420/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p03420/input.0.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p03420/input.1.txt b/codenet/public_test_cases/p03420/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p03420/input.1.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p03420/input.2.txt b/codenet/public_test_cases/p03420/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb00375829cc3c2f3a931782d3b492d206d28841 --- /dev/null +++ b/codenet/public_test_cases/p03420/input.2.txt @@ -0,0 +1 @@ +31415 9265 diff --git a/codenet/public_test_cases/p03420/input.3.txt b/codenet/public_test_cases/p03420/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..58d2fb649914c5494e6eb63f335cccb2606647fe --- /dev/null +++ b/codenet/public_test_cases/p03420/input.3.txt @@ -0,0 +1 @@ +10 0 diff --git a/codenet/public_test_cases/p03420/output.0.txt b/codenet/public_test_cases/p03420/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03420/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03420/output.1.txt b/codenet/public_test_cases/p03420/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03420/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03420/output.2.txt b/codenet/public_test_cases/p03420/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c12836dd024aeb42c427e2f07a20f0db24a662a9 --- /dev/null +++ b/codenet/public_test_cases/p03420/output.2.txt @@ -0,0 +1 @@ +287927211 diff --git a/codenet/public_test_cases/p03420/output.3.txt b/codenet/public_test_cases/p03420/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03420/output.3.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03421/input.0.txt b/codenet/public_test_cases/p03421/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad0d61ad00fde7baaad7c56f69635f64152ce966 --- /dev/null +++ b/codenet/public_test_cases/p03421/input.0.txt @@ -0,0 +1 @@ +5 3 2 diff --git a/codenet/public_test_cases/p03421/input.1.txt b/codenet/public_test_cases/p03421/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..504c5a4147569cc42cda85edf064232c62a7117f --- /dev/null +++ b/codenet/public_test_cases/p03421/input.1.txt @@ -0,0 +1 @@ +7 7 1 diff --git a/codenet/public_test_cases/p03421/input.2.txt b/codenet/public_test_cases/p03421/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..38102568b2e68f6a70c3233a4f665074375b9fc3 --- /dev/null +++ b/codenet/public_test_cases/p03421/input.2.txt @@ -0,0 +1 @@ +300000 300000 300000 diff --git a/codenet/public_test_cases/p03421/input.3.txt b/codenet/public_test_cases/p03421/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad0d61ad00fde7baaad7c56f69635f64152ce966 --- /dev/null +++ b/codenet/public_test_cases/p03421/input.3.txt @@ -0,0 +1 @@ +5 3 2 diff --git a/codenet/public_test_cases/p03421/output.0.txt b/codenet/public_test_cases/p03421/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e4d8855e32d7456c0d1fc9c1cf94e7ce9c66b7e --- /dev/null +++ b/codenet/public_test_cases/p03421/output.0.txt @@ -0,0 +1 @@ +2 4 1 5 3 diff --git a/codenet/public_test_cases/p03421/output.1.txt b/codenet/public_test_cases/p03421/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4457aae66f6b1e46122d724ea12e9fae956d392 --- /dev/null +++ b/codenet/public_test_cases/p03421/output.1.txt @@ -0,0 +1 @@ +1 2 3 4 5 6 7 diff --git a/codenet/public_test_cases/p03421/output.2.txt b/codenet/public_test_cases/p03421/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03421/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03421/output.3.txt b/codenet/public_test_cases/p03421/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e4d8855e32d7456c0d1fc9c1cf94e7ce9c66b7e --- /dev/null +++ b/codenet/public_test_cases/p03421/output.3.txt @@ -0,0 +1 @@ +2 4 1 5 3 diff --git a/codenet/public_test_cases/p03422/input.0.txt b/codenet/public_test_cases/p03422/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c03717e1b6f0ab375c468ad1ec7b008bebcaa74 --- /dev/null +++ b/codenet/public_test_cases/p03422/input.0.txt @@ -0,0 +1,3 @@ +2 +5 2 +3 3 diff --git a/codenet/public_test_cases/p03422/input.1.txt b/codenet/public_test_cases/p03422/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..983671b946a4d5e607d4032cb0fb66e8b9c93292 --- /dev/null +++ b/codenet/public_test_cases/p03422/input.1.txt @@ -0,0 +1,5 @@ +4 +3141 59 +26535 897 +93 23 +8462 64 diff --git a/codenet/public_test_cases/p03422/input.2.txt b/codenet/public_test_cases/p03422/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3055a4d3ce024317502b859ce8355c158d56892 --- /dev/null +++ b/codenet/public_test_cases/p03422/input.2.txt @@ -0,0 +1,4 @@ +3 +28 3 +16 4 +19 2 diff --git a/codenet/public_test_cases/p03422/input.3.txt b/codenet/public_test_cases/p03422/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..304494f2831e243c7c1c2709a7999ff63021e5f2 --- /dev/null +++ b/codenet/public_test_cases/p03422/input.3.txt @@ -0,0 +1,4 @@ +3 +3 2 +4 3 +5 1 diff --git a/codenet/public_test_cases/p03422/input.4.txt b/codenet/public_test_cases/p03422/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c03717e1b6f0ab375c468ad1ec7b008bebcaa74 --- /dev/null +++ b/codenet/public_test_cases/p03422/input.4.txt @@ -0,0 +1,3 @@ +2 +5 2 +3 3 diff --git a/codenet/public_test_cases/p03422/output.0.txt b/codenet/public_test_cases/p03422/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a3df71704d9a1237ac45b43f1f021f6d75f210a --- /dev/null +++ b/codenet/public_test_cases/p03422/output.0.txt @@ -0,0 +1 @@ +Aoki diff --git a/codenet/public_test_cases/p03422/output.1.txt b/codenet/public_test_cases/p03422/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ad9702b533f80b83cefed1fa780c5db95ca477e --- /dev/null +++ b/codenet/public_test_cases/p03422/output.1.txt @@ -0,0 +1 @@ +Takahashi diff --git a/codenet/public_test_cases/p03422/output.2.txt b/codenet/public_test_cases/p03422/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a3df71704d9a1237ac45b43f1f021f6d75f210a --- /dev/null +++ b/codenet/public_test_cases/p03422/output.2.txt @@ -0,0 +1 @@ +Aoki diff --git a/codenet/public_test_cases/p03422/output.3.txt b/codenet/public_test_cases/p03422/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ad9702b533f80b83cefed1fa780c5db95ca477e --- /dev/null +++ b/codenet/public_test_cases/p03422/output.3.txt @@ -0,0 +1 @@ +Takahashi diff --git a/codenet/public_test_cases/p03422/output.4.txt b/codenet/public_test_cases/p03422/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a3df71704d9a1237ac45b43f1f021f6d75f210a --- /dev/null +++ b/codenet/public_test_cases/p03422/output.4.txt @@ -0,0 +1 @@ +Aoki diff --git a/codenet/public_test_cases/p03423/input.0.txt b/codenet/public_test_cases/p03423/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03423/input.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03423/output.0.txt b/codenet/public_test_cases/p03423/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03423/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03424/input.0.txt b/codenet/public_test_cases/p03424/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4272d71d4358d6f7672c51d63b283443fbc484fd --- /dev/null +++ b/codenet/public_test_cases/p03424/input.0.txt @@ -0,0 +1,2 @@ +6 +G W Y P Y W diff --git a/codenet/public_test_cases/p03424/input.1.txt b/codenet/public_test_cases/p03424/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4272d71d4358d6f7672c51d63b283443fbc484fd --- /dev/null +++ b/codenet/public_test_cases/p03424/input.1.txt @@ -0,0 +1,2 @@ +6 +G W Y P Y W diff --git a/codenet/public_test_cases/p03424/input.2.txt b/codenet/public_test_cases/p03424/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3437dd8d19c93bef0f53e8e0cac3814c71ed90e4 --- /dev/null +++ b/codenet/public_test_cases/p03424/input.2.txt @@ -0,0 +1,2 @@ +9 +G W W G P W P G G diff --git a/codenet/public_test_cases/p03424/input.3.txt b/codenet/public_test_cases/p03424/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..74678f941c4647fd4802d1001c2117612cbd25a7 --- /dev/null +++ b/codenet/public_test_cases/p03424/input.3.txt @@ -0,0 +1,2 @@ +8 +P Y W G Y W Y Y diff --git a/codenet/public_test_cases/p03424/output.0.txt b/codenet/public_test_cases/p03424/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c1b97610a5a69e0a0d8ac5c31613668580de23c --- /dev/null +++ b/codenet/public_test_cases/p03424/output.0.txt @@ -0,0 +1 @@ +Four diff --git a/codenet/public_test_cases/p03424/output.1.txt b/codenet/public_test_cases/p03424/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c1b97610a5a69e0a0d8ac5c31613668580de23c --- /dev/null +++ b/codenet/public_test_cases/p03424/output.1.txt @@ -0,0 +1 @@ +Four diff --git a/codenet/public_test_cases/p03424/output.2.txt b/codenet/public_test_cases/p03424/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2cde1851fb7895abe2b793cbb71947c01e5c7fd --- /dev/null +++ b/codenet/public_test_cases/p03424/output.2.txt @@ -0,0 +1 @@ +Three diff --git a/codenet/public_test_cases/p03424/output.3.txt b/codenet/public_test_cases/p03424/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c1b97610a5a69e0a0d8ac5c31613668580de23c --- /dev/null +++ b/codenet/public_test_cases/p03424/output.3.txt @@ -0,0 +1 @@ +Four diff --git a/codenet/public_test_cases/p03425/input.0.txt b/codenet/public_test_cases/p03425/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ded017f663c93fc38223667499809f6d94097d2 --- /dev/null +++ b/codenet/public_test_cases/p03425/input.0.txt @@ -0,0 +1,6 @@ +5 +MASHIKE +RUMOI +OBIRA +HABORO +HOROKANAI diff --git a/codenet/public_test_cases/p03425/input.1.txt b/codenet/public_test_cases/p03425/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ded017f663c93fc38223667499809f6d94097d2 --- /dev/null +++ b/codenet/public_test_cases/p03425/input.1.txt @@ -0,0 +1,6 @@ +5 +MASHIKE +RUMOI +OBIRA +HABORO +HOROKANAI diff --git a/codenet/public_test_cases/p03425/input.2.txt b/codenet/public_test_cases/p03425/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb4b00161add09d69c1ce07de981d01027d4c78e --- /dev/null +++ b/codenet/public_test_cases/p03425/input.2.txt @@ -0,0 +1,6 @@ +5 +CHOKUDAI +RNG +MAKOTO +AOKI +RINGO diff --git a/codenet/public_test_cases/p03425/input.3.txt b/codenet/public_test_cases/p03425/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2c0984441675437010017b4bbc35e03ebbb69f7 --- /dev/null +++ b/codenet/public_test_cases/p03425/input.3.txt @@ -0,0 +1,5 @@ +4 +ZZ +ZZZ +Z +ZZZZZZZZZZ diff --git a/codenet/public_test_cases/p03425/output.0.txt b/codenet/public_test_cases/p03425/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03425/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03425/output.1.txt b/codenet/public_test_cases/p03425/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03425/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03425/output.2.txt b/codenet/public_test_cases/p03425/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03425/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03425/output.3.txt b/codenet/public_test_cases/p03425/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03425/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03426/input.0.txt b/codenet/public_test_cases/p03426/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d72386eef820a3710d999b4b3e6ea7af3cfc9a83 --- /dev/null +++ b/codenet/public_test_cases/p03426/input.0.txt @@ -0,0 +1,6 @@ +3 3 2 +1 4 3 +2 5 7 +8 9 6 +1 +4 8 diff --git a/codenet/public_test_cases/p03426/input.1.txt b/codenet/public_test_cases/p03426/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d72386eef820a3710d999b4b3e6ea7af3cfc9a83 --- /dev/null +++ b/codenet/public_test_cases/p03426/input.1.txt @@ -0,0 +1,6 @@ +3 3 2 +1 4 3 +2 5 7 +8 9 6 +1 +4 8 diff --git a/codenet/public_test_cases/p03426/input.2.txt b/codenet/public_test_cases/p03426/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..57858afc9a89b947796fe57a38b7e1b935cb3496 --- /dev/null +++ b/codenet/public_test_cases/p03426/input.2.txt @@ -0,0 +1,8 @@ +4 2 3 +3 7 +1 4 +5 2 +6 8 +2 +2 2 +2 2 diff --git a/codenet/public_test_cases/p03426/input.3.txt b/codenet/public_test_cases/p03426/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4bb0570b1f6119b4b413ba4b4d18aa5baf255f4 --- /dev/null +++ b/codenet/public_test_cases/p03426/input.3.txt @@ -0,0 +1,10 @@ +5 5 4 +13 25 7 15 17 +16 22 20 2 9 +14 11 12 1 19 +10 6 23 8 18 +3 21 5 24 4 +3 +13 13 +2 10 +13 13 diff --git a/codenet/public_test_cases/p03426/output.0.txt b/codenet/public_test_cases/p03426/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03426/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03426/output.1.txt b/codenet/public_test_cases/p03426/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03426/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03426/output.2.txt b/codenet/public_test_cases/p03426/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa47d0d46d47a06090f436b0b851b76bb6f3b6e2 --- /dev/null +++ b/codenet/public_test_cases/p03426/output.2.txt @@ -0,0 +1,2 @@ +0 +0 diff --git a/codenet/public_test_cases/p03426/output.3.txt b/codenet/public_test_cases/p03426/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..13008b4e446fdc97fc81152c1221bef0d4579653 --- /dev/null +++ b/codenet/public_test_cases/p03426/output.3.txt @@ -0,0 +1,3 @@ +0 +5 +0 diff --git a/codenet/public_test_cases/p03427/input.0.txt b/codenet/public_test_cases/p03427/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03427/input.0.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03427/input.1.txt b/codenet/public_test_cases/p03427/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60b56bdad103fe0ca958fdee8022936638069bc5 --- /dev/null +++ b/codenet/public_test_cases/p03427/input.1.txt @@ -0,0 +1 @@ +3141592653589793 diff --git a/codenet/public_test_cases/p03427/input.2.txt b/codenet/public_test_cases/p03427/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03427/input.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03427/input.3.txt b/codenet/public_test_cases/p03427/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..db39b737daa92aea7fbe58a13face8de2c81db7e --- /dev/null +++ b/codenet/public_test_cases/p03427/input.3.txt @@ -0,0 +1 @@ +9995 diff --git a/codenet/public_test_cases/p03427/output.0.txt b/codenet/public_test_cases/p03427/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03427/output.0.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03427/output.1.txt b/codenet/public_test_cases/p03427/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..065fd3e79c93500fd6b1588a36d15692c9ed1c8e --- /dev/null +++ b/codenet/public_test_cases/p03427/output.1.txt @@ -0,0 +1 @@ +137 diff --git a/codenet/public_test_cases/p03427/output.2.txt b/codenet/public_test_cases/p03427/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03427/output.2.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03427/output.3.txt b/codenet/public_test_cases/p03427/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f92bfdd49766b1907d4aec8d3b0f9ed6129d0e6 --- /dev/null +++ b/codenet/public_test_cases/p03427/output.3.txt @@ -0,0 +1 @@ +35 diff --git a/codenet/public_test_cases/p03428/input.0.txt b/codenet/public_test_cases/p03428/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..736b8244187c8d0a21bd7be834a4f2e1aff95c08 --- /dev/null +++ b/codenet/public_test_cases/p03428/input.0.txt @@ -0,0 +1,3 @@ +2 +0 0 +1 1 diff --git a/codenet/public_test_cases/p03428/input.1.txt b/codenet/public_test_cases/p03428/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..736b8244187c8d0a21bd7be834a4f2e1aff95c08 --- /dev/null +++ b/codenet/public_test_cases/p03428/input.1.txt @@ -0,0 +1,3 @@ +2 +0 0 +1 1 diff --git a/codenet/public_test_cases/p03428/input.2.txt b/codenet/public_test_cases/p03428/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..af07c83d47ae693c56bba0d0e1bff5d9c97a644c --- /dev/null +++ b/codenet/public_test_cases/p03428/input.2.txt @@ -0,0 +1,6 @@ +5 +0 0 +2 8 +4 5 +2 6 +3 10 diff --git a/codenet/public_test_cases/p03428/output.0.txt b/codenet/public_test_cases/p03428/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7905ff43d830425ca72a19a683335c1981712242 --- /dev/null +++ b/codenet/public_test_cases/p03428/output.0.txt @@ -0,0 +1,2 @@ +0.5 +0.5 diff --git a/codenet/public_test_cases/p03428/output.1.txt b/codenet/public_test_cases/p03428/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7905ff43d830425ca72a19a683335c1981712242 --- /dev/null +++ b/codenet/public_test_cases/p03428/output.1.txt @@ -0,0 +1,2 @@ +0.5 +0.5 diff --git a/codenet/public_test_cases/p03428/output.2.txt b/codenet/public_test_cases/p03428/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1eca61ca4e655f393353ca1446c70332ba919feb --- /dev/null +++ b/codenet/public_test_cases/p03428/output.2.txt @@ -0,0 +1,5 @@ +0.43160120892732328768 +0.03480224363653196956 +0.13880483535586193855 +0.00000000000000000000 +0.39479171208028279727 diff --git a/codenet/public_test_cases/p03429/input.0.txt b/codenet/public_test_cases/p03429/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c8494a94a1d1cd35485e20b42f9399874ad5251 --- /dev/null +++ b/codenet/public_test_cases/p03429/input.0.txt @@ -0,0 +1 @@ +3 4 4 2 diff --git a/codenet/public_test_cases/p03429/input.1.txt b/codenet/public_test_cases/p03429/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..41d39d6c0ddbf979c8403b2894480a5047fa29a9 --- /dev/null +++ b/codenet/public_test_cases/p03429/input.1.txt @@ -0,0 +1 @@ +4 5 5 3 diff --git a/codenet/public_test_cases/p03429/input.2.txt b/codenet/public_test_cases/p03429/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c8494a94a1d1cd35485e20b42f9399874ad5251 --- /dev/null +++ b/codenet/public_test_cases/p03429/input.2.txt @@ -0,0 +1 @@ +3 4 4 2 diff --git a/codenet/public_test_cases/p03429/input.3.txt b/codenet/public_test_cases/p03429/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb99f9cdbcb5ffef984bd4fb89859017ef8e5396 --- /dev/null +++ b/codenet/public_test_cases/p03429/input.3.txt @@ -0,0 +1 @@ +7 9 20 20 diff --git a/codenet/public_test_cases/p03429/output.0.txt b/codenet/public_test_cases/p03429/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..698be3eb8694bf6307d222e3eceddbfa8b05d474 --- /dev/null +++ b/codenet/public_test_cases/p03429/output.0.txt @@ -0,0 +1,4 @@ +YES +<><> +^<>^ +v<>v diff --git a/codenet/public_test_cases/p03429/output.1.txt b/codenet/public_test_cases/p03429/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bb14fab3b651721814e5a70de44bcdfd098d59b --- /dev/null +++ b/codenet/public_test_cases/p03429/output.1.txt @@ -0,0 +1,5 @@ +YES +<>..^ +^.<>v +v<>.^ +<><>v diff --git a/codenet/public_test_cases/p03429/output.2.txt b/codenet/public_test_cases/p03429/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..698be3eb8694bf6307d222e3eceddbfa8b05d474 --- /dev/null +++ b/codenet/public_test_cases/p03429/output.2.txt @@ -0,0 +1,4 @@ +YES +<><> +^<>^ +v<>v diff --git a/codenet/public_test_cases/p03429/output.3.txt b/codenet/public_test_cases/p03429/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03429/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03430/input.0.txt b/codenet/public_test_cases/p03430/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..57ef1c2a25b425c894cfa0cc8f6dd2c5f7ebbb8d --- /dev/null +++ b/codenet/public_test_cases/p03430/input.0.txt @@ -0,0 +1,2 @@ +abcabcabc +1 diff --git a/codenet/public_test_cases/p03430/input.1.txt b/codenet/public_test_cases/p03430/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..57ef1c2a25b425c894cfa0cc8f6dd2c5f7ebbb8d --- /dev/null +++ b/codenet/public_test_cases/p03430/input.1.txt @@ -0,0 +1,2 @@ +abcabcabc +1 diff --git a/codenet/public_test_cases/p03430/input.2.txt b/codenet/public_test_cases/p03430/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573747e88295c5e7a08819370da29ca09ad33185 --- /dev/null +++ b/codenet/public_test_cases/p03430/input.2.txt @@ -0,0 +1,2 @@ +atcodergrandcontest +3 diff --git a/codenet/public_test_cases/p03430/output.0.txt b/codenet/public_test_cases/p03430/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03430/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03430/output.1.txt b/codenet/public_test_cases/p03430/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03430/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03430/output.2.txt b/codenet/public_test_cases/p03430/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03430/output.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03431/input.0.txt b/codenet/public_test_cases/p03431/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0efd67f9502e63cb033cb651e65e025b6e3a5cb2 --- /dev/null +++ b/codenet/public_test_cases/p03431/input.0.txt @@ -0,0 +1 @@ +2 4 diff --git a/codenet/public_test_cases/p03431/input.1.txt b/codenet/public_test_cases/p03431/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3933c1f854201be886d45544b1716c9fba0c69a0 --- /dev/null +++ b/codenet/public_test_cases/p03431/input.1.txt @@ -0,0 +1 @@ +8 10 diff --git a/codenet/public_test_cases/p03431/input.2.txt b/codenet/public_test_cases/p03431/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0871b0b46ec9fe33d7a99d3608001b41d41374a5 --- /dev/null +++ b/codenet/public_test_cases/p03431/input.2.txt @@ -0,0 +1 @@ +3 7 diff --git a/codenet/public_test_cases/p03431/input.3.txt b/codenet/public_test_cases/p03431/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8cb67558c6382c9aac100f77901c0ecabad218 --- /dev/null +++ b/codenet/public_test_cases/p03431/input.3.txt @@ -0,0 +1 @@ +123456 234567 diff --git a/codenet/public_test_cases/p03431/input.4.txt b/codenet/public_test_cases/p03431/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..90619d0123d63a3a312a0496eaf752910f9d8154 --- /dev/null +++ b/codenet/public_test_cases/p03431/input.4.txt @@ -0,0 +1 @@ +8 3 diff --git a/codenet/public_test_cases/p03431/input.5.txt b/codenet/public_test_cases/p03431/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0efd67f9502e63cb033cb651e65e025b6e3a5cb2 --- /dev/null +++ b/codenet/public_test_cases/p03431/input.5.txt @@ -0,0 +1 @@ +2 4 diff --git a/codenet/public_test_cases/p03431/output.0.txt b/codenet/public_test_cases/p03431/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03431/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03431/output.1.txt b/codenet/public_test_cases/p03431/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e5feb5256930f3cae636754eef8a244ede164eb --- /dev/null +++ b/codenet/public_test_cases/p03431/output.1.txt @@ -0,0 +1 @@ +46 diff --git a/codenet/public_test_cases/p03431/output.2.txt b/codenet/public_test_cases/p03431/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1617e842ad9a038ec2d8332c6084300a43cb09d --- /dev/null +++ b/codenet/public_test_cases/p03431/output.2.txt @@ -0,0 +1 @@ +57 diff --git a/codenet/public_test_cases/p03431/output.3.txt b/codenet/public_test_cases/p03431/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f73eb7af74825d4c50df8ea778950fbbbf2c2a0 --- /dev/null +++ b/codenet/public_test_cases/p03431/output.3.txt @@ -0,0 +1 @@ +857617983 diff --git a/codenet/public_test_cases/p03431/output.4.txt b/codenet/public_test_cases/p03431/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03431/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03431/output.5.txt b/codenet/public_test_cases/p03431/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03431/output.5.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03432/input.0.txt b/codenet/public_test_cases/p03432/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p03432/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p03432/input.1.txt b/codenet/public_test_cases/p03432/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff0fb51eecff4000068de7065fa4b4d7b5da0153 --- /dev/null +++ b/codenet/public_test_cases/p03432/input.1.txt @@ -0,0 +1 @@ +5000 100 diff --git a/codenet/public_test_cases/p03432/input.2.txt b/codenet/public_test_cases/p03432/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..02903d78815e71fbac7e03b56a2833bfb663d6f4 --- /dev/null +++ b/codenet/public_test_cases/p03432/input.2.txt @@ -0,0 +1 @@ +17 13 diff --git a/codenet/public_test_cases/p03432/input.3.txt b/codenet/public_test_cases/p03432/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p03432/input.3.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p03432/input.4.txt b/codenet/public_test_cases/p03432/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p03432/input.4.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p03432/output.0.txt b/codenet/public_test_cases/p03432/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p03432/output.0.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p03432/output.1.txt b/codenet/public_test_cases/p03432/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..518fc338fe6268a1321070b8d3ee118efa953557 --- /dev/null +++ b/codenet/public_test_cases/p03432/output.1.txt @@ -0,0 +1 @@ +57613837 diff --git a/codenet/public_test_cases/p03432/output.2.txt b/codenet/public_test_cases/p03432/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..05a56dd6507afd6d105f3b53e62c46ee7c33c888 --- /dev/null +++ b/codenet/public_test_cases/p03432/output.2.txt @@ -0,0 +1 @@ +229876268 diff --git a/codenet/public_test_cases/p03432/output.3.txt b/codenet/public_test_cases/p03432/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c9a94ce98fd9cf1507e0867f2b7ac12a91365bd --- /dev/null +++ b/codenet/public_test_cases/p03432/output.3.txt @@ -0,0 +1 @@ +2588 diff --git a/codenet/public_test_cases/p03432/output.4.txt b/codenet/public_test_cases/p03432/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p03432/output.4.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p03433/input.0.txt b/codenet/public_test_cases/p03433/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e6bc7d28c161b9d0bedc349949806924580acd3 --- /dev/null +++ b/codenet/public_test_cases/p03433/input.0.txt @@ -0,0 +1,2 @@ +2018 +218 diff --git a/codenet/public_test_cases/p03433/input.1.txt b/codenet/public_test_cases/p03433/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7df7a12fe780c5cf45d9dba92747854e7d14183 --- /dev/null +++ b/codenet/public_test_cases/p03433/input.1.txt @@ -0,0 +1,2 @@ +2763 +0 diff --git a/codenet/public_test_cases/p03433/input.2.txt b/codenet/public_test_cases/p03433/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e6bc7d28c161b9d0bedc349949806924580acd3 --- /dev/null +++ b/codenet/public_test_cases/p03433/input.2.txt @@ -0,0 +1,2 @@ +2018 +218 diff --git a/codenet/public_test_cases/p03433/input.3.txt b/codenet/public_test_cases/p03433/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..beb32dab558d32b55885418c90ea4e960b3f2813 --- /dev/null +++ b/codenet/public_test_cases/p03433/input.3.txt @@ -0,0 +1,2 @@ +37 +514 diff --git a/codenet/public_test_cases/p03433/output.0.txt b/codenet/public_test_cases/p03433/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03433/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03433/output.1.txt b/codenet/public_test_cases/p03433/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03433/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03433/output.2.txt b/codenet/public_test_cases/p03433/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03433/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03433/output.3.txt b/codenet/public_test_cases/p03433/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03433/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03434/input.0.txt b/codenet/public_test_cases/p03434/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b9ff05be3e0c7ad337e362468f961df7ba98fd1 --- /dev/null +++ b/codenet/public_test_cases/p03434/input.0.txt @@ -0,0 +1,2 @@ +2 +3 1 diff --git a/codenet/public_test_cases/p03434/input.1.txt b/codenet/public_test_cases/p03434/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7a6cad908fb73c6ff0866e013567240039d3e1e --- /dev/null +++ b/codenet/public_test_cases/p03434/input.1.txt @@ -0,0 +1,2 @@ +4 +20 18 2 18 diff --git a/codenet/public_test_cases/p03434/input.2.txt b/codenet/public_test_cases/p03434/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b9ff05be3e0c7ad337e362468f961df7ba98fd1 --- /dev/null +++ b/codenet/public_test_cases/p03434/input.2.txt @@ -0,0 +1,2 @@ +2 +3 1 diff --git a/codenet/public_test_cases/p03434/input.3.txt b/codenet/public_test_cases/p03434/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b263942dc6434388ccc495888de4d1f80879730 --- /dev/null +++ b/codenet/public_test_cases/p03434/input.3.txt @@ -0,0 +1,2 @@ +3 +2 7 4 diff --git a/codenet/public_test_cases/p03434/output.0.txt b/codenet/public_test_cases/p03434/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03434/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03434/output.1.txt b/codenet/public_test_cases/p03434/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03434/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03434/output.2.txt b/codenet/public_test_cases/p03434/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03434/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03434/output.3.txt b/codenet/public_test_cases/p03434/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03434/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03435/input.0.txt b/codenet/public_test_cases/p03435/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..70c71aabc6f49831ca0845c94ae491b8d0a9084d --- /dev/null +++ b/codenet/public_test_cases/p03435/input.0.txt @@ -0,0 +1,3 @@ +1 0 1 +2 1 2 +1 0 1 diff --git a/codenet/public_test_cases/p03435/input.1.txt b/codenet/public_test_cases/p03435/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..70c71aabc6f49831ca0845c94ae491b8d0a9084d --- /dev/null +++ b/codenet/public_test_cases/p03435/input.1.txt @@ -0,0 +1,3 @@ +1 0 1 +2 1 2 +1 0 1 diff --git a/codenet/public_test_cases/p03435/input.2.txt b/codenet/public_test_cases/p03435/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b91ba510e879fa1d0a2abb7e50ce6234850b47f --- /dev/null +++ b/codenet/public_test_cases/p03435/input.2.txt @@ -0,0 +1,3 @@ +1 8 6 +2 9 7 +0 7 7 diff --git a/codenet/public_test_cases/p03435/input.3.txt b/codenet/public_test_cases/p03435/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..62cedc130f819a76ee953d9a6c97ba2daaa0c473 --- /dev/null +++ b/codenet/public_test_cases/p03435/input.3.txt @@ -0,0 +1,3 @@ +0 8 8 +0 8 8 +0 8 8 diff --git a/codenet/public_test_cases/p03435/input.4.txt b/codenet/public_test_cases/p03435/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6664337f7753637e0dcfdf8a870cc1e64683fb7 --- /dev/null +++ b/codenet/public_test_cases/p03435/input.4.txt @@ -0,0 +1,3 @@ +2 2 2 +2 1 2 +2 2 2 diff --git a/codenet/public_test_cases/p03435/output.0.txt b/codenet/public_test_cases/p03435/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03435/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03435/output.1.txt b/codenet/public_test_cases/p03435/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03435/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03435/output.2.txt b/codenet/public_test_cases/p03435/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03435/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03435/output.3.txt b/codenet/public_test_cases/p03435/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03435/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03435/output.4.txt b/codenet/public_test_cases/p03435/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03435/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03436/input.0.txt b/codenet/public_test_cases/p03436/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d50c85ba3a24f64cb763268bda943a767e88a68f --- /dev/null +++ b/codenet/public_test_cases/p03436/input.0.txt @@ -0,0 +1,4 @@ +3 3 +..# +#.. +... diff --git a/codenet/public_test_cases/p03436/input.1.txt b/codenet/public_test_cases/p03436/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f16a68f1ed19039144d033c233235cdcce21ed5 --- /dev/null +++ b/codenet/public_test_cases/p03436/input.1.txt @@ -0,0 +1,11 @@ +10 37 +..................................... +...#...####...####..###...###...###.. +..#.#..#...#.##....#...#.#...#.#...#. +..#.#..#...#.#.....#...#.#...#.#...#. +.#...#.#..##.#.....#...#.#.###.#.###. +.#####.####..#.....#...#..##....##... +.#...#.#...#.#.....#...#.#...#.#...#. +.#...#.#...#.##....#...#.#...#.#...#. +.#...#.####...####..###...###...###.. +..................................... diff --git a/codenet/public_test_cases/p03436/input.2.txt b/codenet/public_test_cases/p03436/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d50c85ba3a24f64cb763268bda943a767e88a68f --- /dev/null +++ b/codenet/public_test_cases/p03436/input.2.txt @@ -0,0 +1,4 @@ +3 3 +..# +#.. +... diff --git a/codenet/public_test_cases/p03436/input.3.txt b/codenet/public_test_cases/p03436/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0fb7d7a0731cb2ba9397232c362334c274c2056 --- /dev/null +++ b/codenet/public_test_cases/p03436/input.3.txt @@ -0,0 +1,4 @@ +3 3 +..# +.. +... diff --git a/codenet/public_test_cases/p03436/output.0.txt b/codenet/public_test_cases/p03436/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03436/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03436/output.1.txt b/codenet/public_test_cases/p03436/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fba2b43771eec7be9298f8336f9a6cf52f159b0 --- /dev/null +++ b/codenet/public_test_cases/p03436/output.1.txt @@ -0,0 +1 @@ +209 diff --git a/codenet/public_test_cases/p03436/output.2.txt b/codenet/public_test_cases/p03436/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03436/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03436/output.3.txt b/codenet/public_test_cases/p03436/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03436/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03437/input.0.txt b/codenet/public_test_cases/p03437/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25bf1347ee5411deaaf3532637d6568e29bdb7b6 --- /dev/null +++ b/codenet/public_test_cases/p03437/input.0.txt @@ -0,0 +1 @@ +8 6 diff --git a/codenet/public_test_cases/p03437/input.1.txt b/codenet/public_test_cases/p03437/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p03437/input.1.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p03437/input.2.txt b/codenet/public_test_cases/p03437/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..25bf1347ee5411deaaf3532637d6568e29bdb7b6 --- /dev/null +++ b/codenet/public_test_cases/p03437/input.2.txt @@ -0,0 +1 @@ +8 6 diff --git a/codenet/public_test_cases/p03437/output.0.txt b/codenet/public_test_cases/p03437/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03437/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03437/output.1.txt b/codenet/public_test_cases/p03437/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03437/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03437/output.2.txt b/codenet/public_test_cases/p03437/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03437/output.2.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03438/input.0.txt b/codenet/public_test_cases/p03438/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7162ddb33f570046e30ee0312b2a02fb85c9655 --- /dev/null +++ b/codenet/public_test_cases/p03438/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 3 +5 2 2 diff --git a/codenet/public_test_cases/p03438/input.1.txt b/codenet/public_test_cases/p03438/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dcb0add93a96a864334e9d485da1f6a6be932bb --- /dev/null +++ b/codenet/public_test_cases/p03438/input.1.txt @@ -0,0 +1,3 @@ +5 +3 1 4 1 5 +2 7 1 8 2 diff --git a/codenet/public_test_cases/p03438/input.2.txt b/codenet/public_test_cases/p03438/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e475da569f36cbc1317accaeb8d91dc9fee9f8cf --- /dev/null +++ b/codenet/public_test_cases/p03438/input.2.txt @@ -0,0 +1,3 @@ +5 +2 7 1 8 2 +3 1 4 1 5 diff --git a/codenet/public_test_cases/p03438/input.3.txt b/codenet/public_test_cases/p03438/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7162ddb33f570046e30ee0312b2a02fb85c9655 --- /dev/null +++ b/codenet/public_test_cases/p03438/input.3.txt @@ -0,0 +1,3 @@ +3 +1 2 3 +5 2 2 diff --git a/codenet/public_test_cases/p03438/output.0.txt b/codenet/public_test_cases/p03438/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03438/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03438/output.1.txt b/codenet/public_test_cases/p03438/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03438/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03438/output.2.txt b/codenet/public_test_cases/p03438/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03438/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03438/output.3.txt b/codenet/public_test_cases/p03438/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03438/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03440/input.0.txt b/codenet/public_test_cases/p03440/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ead752c7233c1857714509813c270be07438854c --- /dev/null +++ b/codenet/public_test_cases/p03440/input.0.txt @@ -0,0 +1,7 @@ +7 5 +1 2 3 4 5 6 7 +3 0 +4 0 +1 2 +1 3 +5 6 diff --git a/codenet/public_test_cases/p03440/input.1.txt b/codenet/public_test_cases/p03440/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a8fd70ecae51776b7590f5c222389f768a127b4 --- /dev/null +++ b/codenet/public_test_cases/p03440/input.1.txt @@ -0,0 +1,2 @@ +1 0 +5 diff --git a/codenet/public_test_cases/p03440/input.2.txt b/codenet/public_test_cases/p03440/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ead752c7233c1857714509813c270be07438854c --- /dev/null +++ b/codenet/public_test_cases/p03440/input.2.txt @@ -0,0 +1,7 @@ +7 5 +1 2 3 4 5 6 7 +3 0 +4 0 +1 2 +1 3 +5 6 diff --git a/codenet/public_test_cases/p03440/input.3.txt b/codenet/public_test_cases/p03440/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c4a2d70fa0d9607a72403888625f9a156433fc8 --- /dev/null +++ b/codenet/public_test_cases/p03440/input.3.txt @@ -0,0 +1,2 @@ +5 0 +3 1 4 1 5 diff --git a/codenet/public_test_cases/p03440/output.0.txt b/codenet/public_test_cases/p03440/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03440/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03440/output.1.txt b/codenet/public_test_cases/p03440/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03440/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03440/output.2.txt b/codenet/public_test_cases/p03440/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03440/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03440/output.3.txt b/codenet/public_test_cases/p03440/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p03440/output.3.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p03441/input.0.txt b/codenet/public_test_cases/p03441/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccf47c9894e43eb325bc040be60389f06ab92cbc --- /dev/null +++ b/codenet/public_test_cases/p03441/input.0.txt @@ -0,0 +1,5 @@ +5 +0 1 +0 2 +0 3 +3 4 diff --git a/codenet/public_test_cases/p03441/input.1.txt b/codenet/public_test_cases/p03441/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b544f7afafb6de1367ffe7dde1074b573c7d86e0 --- /dev/null +++ b/codenet/public_test_cases/p03441/input.1.txt @@ -0,0 +1,2 @@ +2 +0 1 diff --git a/codenet/public_test_cases/p03441/input.2.txt b/codenet/public_test_cases/p03441/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccf47c9894e43eb325bc040be60389f06ab92cbc --- /dev/null +++ b/codenet/public_test_cases/p03441/input.2.txt @@ -0,0 +1,5 @@ +5 +0 1 +0 2 +0 3 +3 4 diff --git a/codenet/public_test_cases/p03441/input.3.txt b/codenet/public_test_cases/p03441/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b13950d4476be73dd9cbd8188e1be9e1e4de4ad6 --- /dev/null +++ b/codenet/public_test_cases/p03441/input.3.txt @@ -0,0 +1,10 @@ +10 +2 8 +6 0 +4 1 +7 6 +2 3 +8 6 +6 9 +2 4 +5 8 diff --git a/codenet/public_test_cases/p03441/output.0.txt b/codenet/public_test_cases/p03441/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03441/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03441/output.1.txt b/codenet/public_test_cases/p03441/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03441/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03441/output.2.txt b/codenet/public_test_cases/p03441/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03441/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03441/output.3.txt b/codenet/public_test_cases/p03441/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03441/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03442/input.0.txt b/codenet/public_test_cases/p03442/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..34db5aba93cd49bd48787467d558cad6c76adf14 --- /dev/null +++ b/codenet/public_test_cases/p03442/input.0.txt @@ -0,0 +1,5 @@ +5 +0 1 1 +0 2 3 +0 3 6 +3 4 4 diff --git a/codenet/public_test_cases/p03442/input.1.txt b/codenet/public_test_cases/p03442/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..34db5aba93cd49bd48787467d558cad6c76adf14 --- /dev/null +++ b/codenet/public_test_cases/p03442/input.1.txt @@ -0,0 +1,5 @@ +5 +0 1 1 +0 2 3 +0 3 6 +3 4 4 diff --git a/codenet/public_test_cases/p03442/input.2.txt b/codenet/public_test_cases/p03442/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..596bf86560e4375c54f8048bf70ce5093b0799da --- /dev/null +++ b/codenet/public_test_cases/p03442/input.2.txt @@ -0,0 +1,2 @@ +2 +1 0 0 diff --git a/codenet/public_test_cases/p03442/output.0.txt b/codenet/public_test_cases/p03442/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03442/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03442/output.1.txt b/codenet/public_test_cases/p03442/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03442/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03442/output.2.txt b/codenet/public_test_cases/p03442/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03442/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03443/input.0.txt b/codenet/public_test_cases/p03443/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cfc3c2c50f7b48dd1f0801b3259f5ce1404fe86 --- /dev/null +++ b/codenet/public_test_cases/p03443/input.0.txt @@ -0,0 +1,2 @@ +2 +010 diff --git a/codenet/public_test_cases/p03443/input.1.txt b/codenet/public_test_cases/p03443/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cfc3c2c50f7b48dd1f0801b3259f5ce1404fe86 --- /dev/null +++ b/codenet/public_test_cases/p03443/input.1.txt @@ -0,0 +1,2 @@ +2 +010 diff --git a/codenet/public_test_cases/p03443/input.2.txt b/codenet/public_test_cases/p03443/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cb06ea89a3c3923da1b3b1a30379f2df8b5a8bd --- /dev/null +++ b/codenet/public_test_cases/p03443/input.2.txt @@ -0,0 +1,2 @@ +2 +001 diff --git a/codenet/public_test_cases/p03443/input.3.txt b/codenet/public_test_cases/p03443/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9540152ad45d323624ea95fcc1a7c07b6c8e6ef3 --- /dev/null +++ b/codenet/public_test_cases/p03443/input.3.txt @@ -0,0 +1,2 @@ +3 +10101 diff --git a/codenet/public_test_cases/p03443/input.4.txt b/codenet/public_test_cases/p03443/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..24ef2316d50c79e0169fb3aa80caaa2ab7630823 --- /dev/null +++ b/codenet/public_test_cases/p03443/input.4.txt @@ -0,0 +1,2 @@ +6 +00111011100 diff --git a/codenet/public_test_cases/p03443/input.5.txt b/codenet/public_test_cases/p03443/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6e89581809da6b5d53be9b8be78ab03aa147931 --- /dev/null +++ b/codenet/public_test_cases/p03443/input.5.txt @@ -0,0 +1,2 @@ +3 +10110 diff --git a/codenet/public_test_cases/p03443/output.0.txt b/codenet/public_test_cases/p03443/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7b161f9045977d1151203f81292cae89fa1e017 --- /dev/null +++ b/codenet/public_test_cases/p03443/output.0.txt @@ -0,0 +1,2 @@ +Yes +1 1 2 2 diff --git a/codenet/public_test_cases/p03443/output.1.txt b/codenet/public_test_cases/p03443/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7b161f9045977d1151203f81292cae89fa1e017 --- /dev/null +++ b/codenet/public_test_cases/p03443/output.1.txt @@ -0,0 +1,2 @@ +Yes +1 1 2 2 diff --git a/codenet/public_test_cases/p03443/output.2.txt b/codenet/public_test_cases/p03443/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03443/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03443/output.3.txt b/codenet/public_test_cases/p03443/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03443/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03443/output.4.txt b/codenet/public_test_cases/p03443/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5cc2a7f6dffab1626687a42f86e314d8d1380a4 --- /dev/null +++ b/codenet/public_test_cases/p03443/output.4.txt @@ -0,0 +1,2 @@ +Yes +1 6 1 2 3 4 4 2 3 5 6 5 diff --git a/codenet/public_test_cases/p03443/output.5.txt b/codenet/public_test_cases/p03443/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..2438a6aa83b407e30d1a204a5f3b0a069e4f08b9 --- /dev/null +++ b/codenet/public_test_cases/p03443/output.5.txt @@ -0,0 +1,2 @@ +Yes +1 3 2 1 2 3 diff --git a/codenet/public_test_cases/p03444/input.0.txt b/codenet/public_test_cases/p03444/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e702931b18fd64cb97b5e7560ff982060c77c0a --- /dev/null +++ b/codenet/public_test_cases/p03444/input.0.txt @@ -0,0 +1,3 @@ +5 +0 1 2 3 +2 4 0 1 3 diff --git a/codenet/public_test_cases/p03444/input.1.txt b/codenet/public_test_cases/p03444/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e702931b18fd64cb97b5e7560ff982060c77c0a --- /dev/null +++ b/codenet/public_test_cases/p03444/input.1.txt @@ -0,0 +1,3 @@ +5 +0 1 2 3 +2 4 0 1 3 diff --git a/codenet/public_test_cases/p03444/input.2.txt b/codenet/public_test_cases/p03444/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..da11103ebf40df2820d98d5a97c99a4468adb970 --- /dev/null +++ b/codenet/public_test_cases/p03444/input.2.txt @@ -0,0 +1,3 @@ +5 +0 1 2 2 +4 3 1 2 0 diff --git a/codenet/public_test_cases/p03444/output.0.txt b/codenet/public_test_cases/p03444/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcf37cd5e26203dc0a9570d26b7a5074049d4c9c --- /dev/null +++ b/codenet/public_test_cases/p03444/output.0.txt @@ -0,0 +1,3 @@ +2 +3 +4 diff --git a/codenet/public_test_cases/p03444/output.1.txt b/codenet/public_test_cases/p03444/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcf37cd5e26203dc0a9570d26b7a5074049d4c9c --- /dev/null +++ b/codenet/public_test_cases/p03444/output.1.txt @@ -0,0 +1,3 @@ +2 +3 +4 diff --git a/codenet/public_test_cases/p03444/output.2.txt b/codenet/public_test_cases/p03444/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e38d89fd17dc9bd05e22551f3c3ed03112cb112 --- /dev/null +++ b/codenet/public_test_cases/p03444/output.2.txt @@ -0,0 +1,4 @@ +3 +4 +3 +1 diff --git a/codenet/public_test_cases/p03445/input.0.txt b/codenet/public_test_cases/p03445/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cbfdc7445d2a519fa797f7212d97f802bfea133 --- /dev/null +++ b/codenet/public_test_cases/p03445/input.0.txt @@ -0,0 +1,3 @@ +2 3 +1 +1 1 diff --git a/codenet/public_test_cases/p03445/input.1.txt b/codenet/public_test_cases/p03445/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87e57a3a82ecc1aa5e37a94d9ce7641f6dd9ba59 --- /dev/null +++ b/codenet/public_test_cases/p03445/input.1.txt @@ -0,0 +1,3 @@ +2 3 +1 +1 2 diff --git a/codenet/public_test_cases/p03445/input.2.txt b/codenet/public_test_cases/p03445/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..54bb12804b90d9a7fba6ac1c281de4bf87055231 --- /dev/null +++ b/codenet/public_test_cases/p03445/input.2.txt @@ -0,0 +1,3 @@ +3 3 +1 +1 1 diff --git a/codenet/public_test_cases/p03445/input.3.txt b/codenet/public_test_cases/p03445/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..62b19090c4b37c06e2b2bbbf29c1567beed401c6 --- /dev/null +++ b/codenet/public_test_cases/p03445/input.3.txt @@ -0,0 +1,3 @@ +1000000 1000000 +1 +0 0 diff --git a/codenet/public_test_cases/p03445/input.4.txt b/codenet/public_test_cases/p03445/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a03983a21cb9092a3fef010b26aedbfdc936d01 --- /dev/null +++ b/codenet/public_test_cases/p03445/input.4.txt @@ -0,0 +1,6 @@ +4 4 +4 +0 1 +1 1 +2 1 +2 2 diff --git a/codenet/public_test_cases/p03445/input.5.txt b/codenet/public_test_cases/p03445/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cbfdc7445d2a519fa797f7212d97f802bfea133 --- /dev/null +++ b/codenet/public_test_cases/p03445/input.5.txt @@ -0,0 +1,3 @@ +2 3 +1 +1 1 diff --git a/codenet/public_test_cases/p03445/output.0.txt b/codenet/public_test_cases/p03445/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03445/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03445/output.1.txt b/codenet/public_test_cases/p03445/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03445/output.1.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03445/output.2.txt b/codenet/public_test_cases/p03445/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p03445/output.2.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p03445/output.3.txt b/codenet/public_test_cases/p03445/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..95ab42446c27b8b6f31319a755725603728ed2a8 --- /dev/null +++ b/codenet/public_test_cases/p03445/output.3.txt @@ -0,0 +1 @@ +333211937 diff --git a/codenet/public_test_cases/p03445/output.4.txt b/codenet/public_test_cases/p03445/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..864d5650ed9d29e2ce17b6914cc733e27432409b --- /dev/null +++ b/codenet/public_test_cases/p03445/output.4.txt @@ -0,0 +1 @@ +268 diff --git a/codenet/public_test_cases/p03445/output.5.txt b/codenet/public_test_cases/p03445/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03445/output.5.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03446/input.0.txt b/codenet/public_test_cases/p03446/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..baab52895f485ca144ff4f2b50fbf8df63f5d3cd --- /dev/null +++ b/codenet/public_test_cases/p03446/input.0.txt @@ -0,0 +1 @@ +1 1 1 2 2 2 diff --git a/codenet/public_test_cases/p03446/input.1.txt b/codenet/public_test_cases/p03446/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cefd04b7f7fe6c1538509db22d4e5226ca81675 --- /dev/null +++ b/codenet/public_test_cases/p03446/input.1.txt @@ -0,0 +1 @@ +2 2 2 4 4 4 diff --git a/codenet/public_test_cases/p03446/input.2.txt b/codenet/public_test_cases/p03446/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..221f1aa5cb4d957bf79c5f9041ac9ee7f5b1987f --- /dev/null +++ b/codenet/public_test_cases/p03446/input.2.txt @@ -0,0 +1 @@ +2 3 4 98 99 100 diff --git a/codenet/public_test_cases/p03446/input.3.txt b/codenet/public_test_cases/p03446/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..baab52895f485ca144ff4f2b50fbf8df63f5d3cd --- /dev/null +++ b/codenet/public_test_cases/p03446/input.3.txt @@ -0,0 +1 @@ +1 1 1 2 2 2 diff --git a/codenet/public_test_cases/p03446/input.4.txt b/codenet/public_test_cases/p03446/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..07238d762310123d39f95b518c52f21c045e657b --- /dev/null +++ b/codenet/public_test_cases/p03446/input.4.txt @@ -0,0 +1 @@ +2 3 4 6 7 8 diff --git a/codenet/public_test_cases/p03446/output.0.txt b/codenet/public_test_cases/p03446/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03446/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03446/output.1.txt b/codenet/public_test_cases/p03446/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..064c0200be2034c6c69792c8c6db23067e2715f7 --- /dev/null +++ b/codenet/public_test_cases/p03446/output.1.txt @@ -0,0 +1 @@ +744 diff --git a/codenet/public_test_cases/p03446/output.2.txt b/codenet/public_test_cases/p03446/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..71261235a686c214ec7cf4fa685caaf534ef72f3 --- /dev/null +++ b/codenet/public_test_cases/p03446/output.2.txt @@ -0,0 +1 @@ +471975164 diff --git a/codenet/public_test_cases/p03446/output.3.txt b/codenet/public_test_cases/p03446/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03446/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03446/output.4.txt b/codenet/public_test_cases/p03446/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03446/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03447/input.0.txt b/codenet/public_test_cases/p03447/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2e17ad368bbf72e6d25b4a94337ee503a8c25f1 --- /dev/null +++ b/codenet/public_test_cases/p03447/input.0.txt @@ -0,0 +1,3 @@ +1234 +150 +100 diff --git a/codenet/public_test_cases/p03447/input.1.txt b/codenet/public_test_cases/p03447/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1f776cf9606412bf8a746e745c53cfa11ec2366 --- /dev/null +++ b/codenet/public_test_cases/p03447/input.1.txt @@ -0,0 +1,3 @@ +1000 +108 +108 diff --git a/codenet/public_test_cases/p03447/input.2.txt b/codenet/public_test_cases/p03447/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2e17ad368bbf72e6d25b4a94337ee503a8c25f1 --- /dev/null +++ b/codenet/public_test_cases/p03447/input.2.txt @@ -0,0 +1,3 @@ +1234 +150 +100 diff --git a/codenet/public_test_cases/p03447/input.3.txt b/codenet/public_test_cases/p03447/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1c4c2278346958afd7a9b9d96ab09baaacea97a --- /dev/null +++ b/codenet/public_test_cases/p03447/input.3.txt @@ -0,0 +1,3 @@ +579 +123 +456 diff --git a/codenet/public_test_cases/p03447/input.4.txt b/codenet/public_test_cases/p03447/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b356ecb2913fd1d7ae3c0a39ce097cb79c9573d1 --- /dev/null +++ b/codenet/public_test_cases/p03447/input.4.txt @@ -0,0 +1,3 @@ +7477 +549 +593 diff --git a/codenet/public_test_cases/p03447/output.0.txt b/codenet/public_test_cases/p03447/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..871727de1fd703d0c4aab92017011c373e795b67 --- /dev/null +++ b/codenet/public_test_cases/p03447/output.0.txt @@ -0,0 +1 @@ +84 diff --git a/codenet/public_test_cases/p03447/output.1.txt b/codenet/public_test_cases/p03447/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9902f17848a8974ab57d57999b74a63198fe6e23 --- /dev/null +++ b/codenet/public_test_cases/p03447/output.1.txt @@ -0,0 +1 @@ +28 diff --git a/codenet/public_test_cases/p03447/output.2.txt b/codenet/public_test_cases/p03447/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..871727de1fd703d0c4aab92017011c373e795b67 --- /dev/null +++ b/codenet/public_test_cases/p03447/output.2.txt @@ -0,0 +1 @@ +84 diff --git a/codenet/public_test_cases/p03447/output.3.txt b/codenet/public_test_cases/p03447/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03447/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03447/output.4.txt b/codenet/public_test_cases/p03447/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec8785ec99e51e8f448e8c1af2fc98f4a36b6d07 --- /dev/null +++ b/codenet/public_test_cases/p03447/output.4.txt @@ -0,0 +1 @@ +405 diff --git a/codenet/public_test_cases/p03448/input.0.txt b/codenet/public_test_cases/p03448/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..36c96caba8fc2034e528dfe69e4a40882d714443 --- /dev/null +++ b/codenet/public_test_cases/p03448/input.0.txt @@ -0,0 +1,4 @@ +2 +2 +2 +100 diff --git a/codenet/public_test_cases/p03448/input.1.txt b/codenet/public_test_cases/p03448/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..36c96caba8fc2034e528dfe69e4a40882d714443 --- /dev/null +++ b/codenet/public_test_cases/p03448/input.1.txt @@ -0,0 +1,4 @@ +2 +2 +2 +100 diff --git a/codenet/public_test_cases/p03448/input.2.txt b/codenet/public_test_cases/p03448/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0de670ad6f10c6c997be40a4f1567e887b35b7f --- /dev/null +++ b/codenet/public_test_cases/p03448/input.2.txt @@ -0,0 +1,4 @@ +30 +40 +50 +6000 diff --git a/codenet/public_test_cases/p03448/input.3.txt b/codenet/public_test_cases/p03448/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b8e49cff87e76deb12ea1ba50fed9e411e3d993 --- /dev/null +++ b/codenet/public_test_cases/p03448/input.3.txt @@ -0,0 +1,4 @@ +5 +1 +0 +150 diff --git a/codenet/public_test_cases/p03448/output.0.txt b/codenet/public_test_cases/p03448/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03448/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03448/output.1.txt b/codenet/public_test_cases/p03448/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03448/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03448/output.2.txt b/codenet/public_test_cases/p03448/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..964480f63e4d594a56f6dc7e847da17f1a568eb1 --- /dev/null +++ b/codenet/public_test_cases/p03448/output.2.txt @@ -0,0 +1 @@ +213 diff --git a/codenet/public_test_cases/p03448/output.3.txt b/codenet/public_test_cases/p03448/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03448/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03449/input.0.txt b/codenet/public_test_cases/p03449/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd36ac5c61987bfc0d45e05bf4cb759f862e31e1 --- /dev/null +++ b/codenet/public_test_cases/p03449/input.0.txt @@ -0,0 +1,3 @@ +5 +3 2 2 4 1 +1 2 2 2 1 diff --git a/codenet/public_test_cases/p03449/input.1.txt b/codenet/public_test_cases/p03449/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2db165be6db3d9a808fddbb9ece77f590e4c243 --- /dev/null +++ b/codenet/public_test_cases/p03449/input.1.txt @@ -0,0 +1,3 @@ +7 +3 3 4 5 4 5 3 +5 3 4 4 2 3 2 diff --git a/codenet/public_test_cases/p03449/input.2.txt b/codenet/public_test_cases/p03449/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..01e79c32a8c99c557f0757da7cb6d65b3414466d --- /dev/null +++ b/codenet/public_test_cases/p03449/input.2.txt @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/codenet/public_test_cases/p03449/input.3.txt b/codenet/public_test_cases/p03449/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd36ac5c61987bfc0d45e05bf4cb759f862e31e1 --- /dev/null +++ b/codenet/public_test_cases/p03449/input.3.txt @@ -0,0 +1,3 @@ +5 +3 2 2 4 1 +1 2 2 2 1 diff --git a/codenet/public_test_cases/p03449/input.4.txt b/codenet/public_test_cases/p03449/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..776ca26d7957af03cec1baf9b38a9476715a69c0 --- /dev/null +++ b/codenet/public_test_cases/p03449/input.4.txt @@ -0,0 +1,3 @@ +4 +1 1 1 1 +1 1 1 1 diff --git a/codenet/public_test_cases/p03449/output.0.txt b/codenet/public_test_cases/p03449/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03449/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03449/output.1.txt b/codenet/public_test_cases/p03449/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f04c001f3f7fd5d290d0264b4a2c35f7b159ac42 --- /dev/null +++ b/codenet/public_test_cases/p03449/output.1.txt @@ -0,0 +1 @@ +29 diff --git a/codenet/public_test_cases/p03449/output.2.txt b/codenet/public_test_cases/p03449/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03449/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03449/output.3.txt b/codenet/public_test_cases/p03449/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03449/output.3.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03449/output.4.txt b/codenet/public_test_cases/p03449/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03449/output.4.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03450/input.0.txt b/codenet/public_test_cases/p03450/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e134717926eef6632de613fb4ead393d879b7060 --- /dev/null +++ b/codenet/public_test_cases/p03450/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 +2 3 1 +1 3 2 diff --git a/codenet/public_test_cases/p03450/output.0.txt b/codenet/public_test_cases/p03450/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03450/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03451/input.0.txt b/codenet/public_test_cases/p03451/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd36ac5c61987bfc0d45e05bf4cb759f862e31e1 --- /dev/null +++ b/codenet/public_test_cases/p03451/input.0.txt @@ -0,0 +1,3 @@ +5 +3 2 2 4 1 +1 2 2 2 1 diff --git a/codenet/public_test_cases/p03451/output.0.txt b/codenet/public_test_cases/p03451/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03451/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03452/input.0.txt b/codenet/public_test_cases/p03452/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e134717926eef6632de613fb4ead393d879b7060 --- /dev/null +++ b/codenet/public_test_cases/p03452/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 +2 3 1 +1 3 2 diff --git a/codenet/public_test_cases/p03452/input.1.txt b/codenet/public_test_cases/p03452/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6e5d17ebe1e32ba97b242bb424f3618bd44a84e --- /dev/null +++ b/codenet/public_test_cases/p03452/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 +2 3 1 +1 3 5 diff --git a/codenet/public_test_cases/p03452/input.2.txt b/codenet/public_test_cases/p03452/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45d4794c122865f3d0b54adfddf0b0f30f96c4ff --- /dev/null +++ b/codenet/public_test_cases/p03452/input.2.txt @@ -0,0 +1 @@ +100 0 diff --git a/codenet/public_test_cases/p03452/input.3.txt b/codenet/public_test_cases/p03452/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00363406b3005531afc41edc5ca44f5c98994b1c --- /dev/null +++ b/codenet/public_test_cases/p03452/input.3.txt @@ -0,0 +1,4 @@ +10 3 +8 7 100 +7 9 100 +9 8 100 diff --git a/codenet/public_test_cases/p03452/input.4.txt b/codenet/public_test_cases/p03452/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e134717926eef6632de613fb4ead393d879b7060 --- /dev/null +++ b/codenet/public_test_cases/p03452/input.4.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 +2 3 1 +1 3 2 diff --git a/codenet/public_test_cases/p03452/input.5.txt b/codenet/public_test_cases/p03452/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..ead1b92c3f0093b87665897e20fc08dad566e01f --- /dev/null +++ b/codenet/public_test_cases/p03452/input.5.txt @@ -0,0 +1,4 @@ +4 3 +2 1 1 +2 3 5 +3 4 2 diff --git a/codenet/public_test_cases/p03452/output.0.txt b/codenet/public_test_cases/p03452/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03452/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03452/output.1.txt b/codenet/public_test_cases/p03452/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03452/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03452/output.2.txt b/codenet/public_test_cases/p03452/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03452/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03452/output.3.txt b/codenet/public_test_cases/p03452/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03452/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03452/output.4.txt b/codenet/public_test_cases/p03452/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03452/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03452/output.5.txt b/codenet/public_test_cases/p03452/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03452/output.5.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03453/input.0.txt b/codenet/public_test_cases/p03453/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f34f473cb3eaf931a346ae9d419239b49712d23 --- /dev/null +++ b/codenet/public_test_cases/p03453/input.0.txt @@ -0,0 +1,6 @@ +4 4 +1 3 +1 2 1 +2 3 1 +3 4 1 +4 1 1 diff --git a/codenet/public_test_cases/p03453/input.1.txt b/codenet/public_test_cases/p03453/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f34f473cb3eaf931a346ae9d419239b49712d23 --- /dev/null +++ b/codenet/public_test_cases/p03453/input.1.txt @@ -0,0 +1,6 @@ +4 4 +1 3 +1 2 1 +2 3 1 +3 4 1 +4 1 1 diff --git a/codenet/public_test_cases/p03453/input.2.txt b/codenet/public_test_cases/p03453/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..95668e4cceff7c0f8ca6952e8ae3dbba53ddfed7 --- /dev/null +++ b/codenet/public_test_cases/p03453/input.2.txt @@ -0,0 +1,5 @@ +3 3 +1 3 +1 2 1 +2 3 1 +3 1 2 diff --git a/codenet/public_test_cases/p03453/input.3.txt b/codenet/public_test_cases/p03453/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaf2e9c60bea92e76e721d5c41394e8a51f9cb22 --- /dev/null +++ b/codenet/public_test_cases/p03453/input.3.txt @@ -0,0 +1,15 @@ +8 13 +4 2 +7 3 9 +6 2 3 +1 6 4 +7 6 9 +3 8 9 +1 2 2 +2 8 12 +8 6 9 +2 5 5 +4 2 18 +5 3 7 +5 1 515371567 +4 8 6 diff --git a/codenet/public_test_cases/p03453/output.0.txt b/codenet/public_test_cases/p03453/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03453/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03453/output.1.txt b/codenet/public_test_cases/p03453/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03453/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03453/output.2.txt b/codenet/public_test_cases/p03453/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03453/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03453/output.3.txt b/codenet/public_test_cases/p03453/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03453/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03454/input.0.txt b/codenet/public_test_cases/p03454/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03454/input.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03454/input.1.txt b/codenet/public_test_cases/p03454/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03454/input.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03454/input.2.txt b/codenet/public_test_cases/p03454/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03454/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03454/input.3.txt b/codenet/public_test_cases/p03454/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..190a18037c64c43e6b11489df4bf0b9eb6d2c9bf --- /dev/null +++ b/codenet/public_test_cases/p03454/input.3.txt @@ -0,0 +1 @@ +123 diff --git a/codenet/public_test_cases/p03454/input.4.txt b/codenet/public_test_cases/p03454/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e058c467362eea3457946af4a69b00be7ae6275 --- /dev/null +++ b/codenet/public_test_cases/p03454/input.4.txt @@ -0,0 +1 @@ +36018 diff --git a/codenet/public_test_cases/p03454/input.5.txt b/codenet/public_test_cases/p03454/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b33d238dab9943201aaf267f701e8ea5fc9268 --- /dev/null +++ b/codenet/public_test_cases/p03454/input.5.txt @@ -0,0 +1 @@ +1000 diff --git a/codenet/public_test_cases/p03454/output.0.txt b/codenet/public_test_cases/p03454/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03454/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03454/output.1.txt b/codenet/public_test_cases/p03454/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03454/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03454/output.2.txt b/codenet/public_test_cases/p03454/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6529ff889b0cc4d1ebe65cdc6a21ec584859d931 --- /dev/null +++ b/codenet/public_test_cases/p03454/output.2.txt @@ -0,0 +1 @@ +98 diff --git a/codenet/public_test_cases/p03454/output.3.txt b/codenet/public_test_cases/p03454/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bb22af04ac245fa77ff3157285939bc4465c12c --- /dev/null +++ b/codenet/public_test_cases/p03454/output.3.txt @@ -0,0 +1 @@ +460191684 diff --git a/codenet/public_test_cases/p03454/output.4.txt b/codenet/public_test_cases/p03454/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..93be451fa0bdb70301b64447e55e79be96c5876b --- /dev/null +++ b/codenet/public_test_cases/p03454/output.4.txt @@ -0,0 +1 @@ +966522825 diff --git a/codenet/public_test_cases/p03454/output.5.txt b/codenet/public_test_cases/p03454/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f3fecbad7701843077d1a533da9d0f940712f5d --- /dev/null +++ b/codenet/public_test_cases/p03454/output.5.txt @@ -0,0 +1 @@ +184984484 diff --git a/codenet/public_test_cases/p03455/input.0.txt b/codenet/public_test_cases/p03455/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebcee1a506db729ea7b0e0b6e9b0be36806d16bd --- /dev/null +++ b/codenet/public_test_cases/p03455/input.0.txt @@ -0,0 +1 @@ +3 4 diff --git a/codenet/public_test_cases/p03455/input.1.txt b/codenet/public_test_cases/p03455/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebcee1a506db729ea7b0e0b6e9b0be36806d16bd --- /dev/null +++ b/codenet/public_test_cases/p03455/input.1.txt @@ -0,0 +1 @@ +3 4 diff --git a/codenet/public_test_cases/p03455/input.2.txt b/codenet/public_test_cases/p03455/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce09ec98268fcebf9ac2e79f00c415849f2d7ade --- /dev/null +++ b/codenet/public_test_cases/p03455/input.2.txt @@ -0,0 +1 @@ +1 21 diff --git a/codenet/public_test_cases/p03455/output.0.txt b/codenet/public_test_cases/p03455/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ab77240feea900cd4688dfff566c60a1b0e7a0a --- /dev/null +++ b/codenet/public_test_cases/p03455/output.0.txt @@ -0,0 +1 @@ +Even diff --git a/codenet/public_test_cases/p03455/output.1.txt b/codenet/public_test_cases/p03455/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ab77240feea900cd4688dfff566c60a1b0e7a0a --- /dev/null +++ b/codenet/public_test_cases/p03455/output.1.txt @@ -0,0 +1 @@ +Even diff --git a/codenet/public_test_cases/p03455/output.2.txt b/codenet/public_test_cases/p03455/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6320bff5e4abc7b9660cda8b84027ac5ea1b5e17 --- /dev/null +++ b/codenet/public_test_cases/p03455/output.2.txt @@ -0,0 +1 @@ +Odd diff --git a/codenet/public_test_cases/p03456/input.0.txt b/codenet/public_test_cases/p03456/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce09ec98268fcebf9ac2e79f00c415849f2d7ade --- /dev/null +++ b/codenet/public_test_cases/p03456/input.0.txt @@ -0,0 +1 @@ +1 21 diff --git a/codenet/public_test_cases/p03456/input.1.txt b/codenet/public_test_cases/p03456/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce09ec98268fcebf9ac2e79f00c415849f2d7ade --- /dev/null +++ b/codenet/public_test_cases/p03456/input.1.txt @@ -0,0 +1 @@ +1 21 diff --git a/codenet/public_test_cases/p03456/input.2.txt b/codenet/public_test_cases/p03456/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e0707c2ccfb0176b0fa1cebeb20ca653f031a84 --- /dev/null +++ b/codenet/public_test_cases/p03456/input.2.txt @@ -0,0 +1 @@ +12 10 diff --git a/codenet/public_test_cases/p03456/input.3.txt b/codenet/public_test_cases/p03456/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9732b55455bca575261eac1a6a7082c96223368d --- /dev/null +++ b/codenet/public_test_cases/p03456/input.3.txt @@ -0,0 +1 @@ +100 100 diff --git a/codenet/public_test_cases/p03456/output.0.txt b/codenet/public_test_cases/p03456/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03456/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03456/output.1.txt b/codenet/public_test_cases/p03456/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03456/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03456/output.2.txt b/codenet/public_test_cases/p03456/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03456/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03456/output.3.txt b/codenet/public_test_cases/p03456/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03456/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03457/input.0.txt b/codenet/public_test_cases/p03457/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c19bcc7d50c8bfc1519fa90f3fcc6056e2520d8 --- /dev/null +++ b/codenet/public_test_cases/p03457/input.0.txt @@ -0,0 +1,3 @@ +2 +3 1 2 +6 1 1 diff --git a/codenet/public_test_cases/p03457/input.1.txt b/codenet/public_test_cases/p03457/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c19bcc7d50c8bfc1519fa90f3fcc6056e2520d8 --- /dev/null +++ b/codenet/public_test_cases/p03457/input.1.txt @@ -0,0 +1,3 @@ +2 +3 1 2 +6 1 1 diff --git a/codenet/public_test_cases/p03457/input.2.txt b/codenet/public_test_cases/p03457/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7dc9beff98740295d18087c439b9be137474855 --- /dev/null +++ b/codenet/public_test_cases/p03457/input.2.txt @@ -0,0 +1,3 @@ +2 +5 1 1 +100 1 1 diff --git a/codenet/public_test_cases/p03457/input.3.txt b/codenet/public_test_cases/p03457/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea3a4df4aceafe385630c0450dbaaa664b09048d --- /dev/null +++ b/codenet/public_test_cases/p03457/input.3.txt @@ -0,0 +1,2 @@ +1 +2 100 100 diff --git a/codenet/public_test_cases/p03457/output.0.txt b/codenet/public_test_cases/p03457/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03457/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03457/output.1.txt b/codenet/public_test_cases/p03457/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03457/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03457/output.2.txt b/codenet/public_test_cases/p03457/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03457/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03457/output.3.txt b/codenet/public_test_cases/p03457/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03457/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03458/input.0.txt b/codenet/public_test_cases/p03458/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5695521dac59c2417c5aeda494c24f46be2304f --- /dev/null +++ b/codenet/public_test_cases/p03458/input.0.txt @@ -0,0 +1,5 @@ +4 3 +0 1 W +1 2 W +5 3 B +5 4 B diff --git a/codenet/public_test_cases/p03458/input.1.txt b/codenet/public_test_cases/p03458/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0dd1fc338cda055f88fce91932660af74ae42e0 --- /dev/null +++ b/codenet/public_test_cases/p03458/input.1.txt @@ -0,0 +1,7 @@ +6 2 +1 2 B +2 1 W +2 2 B +1 0 B +0 6 W +4 5 W diff --git a/codenet/public_test_cases/p03458/input.2.txt b/codenet/public_test_cases/p03458/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5695521dac59c2417c5aeda494c24f46be2304f --- /dev/null +++ b/codenet/public_test_cases/p03458/input.2.txt @@ -0,0 +1,5 @@ +4 3 +0 1 W +1 2 W +5 3 B +5 4 B diff --git a/codenet/public_test_cases/p03458/input.3.txt b/codenet/public_test_cases/p03458/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4baf4fe0197f39f275ec5cfeae5924511eb3f6b --- /dev/null +++ b/codenet/public_test_cases/p03458/input.3.txt @@ -0,0 +1,3 @@ +2 1000 +0 0 B +0 1 W diff --git a/codenet/public_test_cases/p03458/output.0.txt b/codenet/public_test_cases/p03458/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03458/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03458/output.1.txt b/codenet/public_test_cases/p03458/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03458/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03458/output.2.txt b/codenet/public_test_cases/p03458/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03458/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03458/output.3.txt b/codenet/public_test_cases/p03458/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03458/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03459/input.0.txt b/codenet/public_test_cases/p03459/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c19bcc7d50c8bfc1519fa90f3fcc6056e2520d8 --- /dev/null +++ b/codenet/public_test_cases/p03459/input.0.txt @@ -0,0 +1,3 @@ +2 +3 1 2 +6 1 1 diff --git a/codenet/public_test_cases/p03459/output.0.txt b/codenet/public_test_cases/p03459/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03459/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03460/input.0.txt b/codenet/public_test_cases/p03460/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5695521dac59c2417c5aeda494c24f46be2304f --- /dev/null +++ b/codenet/public_test_cases/p03460/input.0.txt @@ -0,0 +1,5 @@ +4 3 +0 1 W +1 2 W +5 3 B +5 4 B diff --git a/codenet/public_test_cases/p03460/output.0.txt b/codenet/public_test_cases/p03460/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03460/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03461/input.0.txt b/codenet/public_test_cases/p03461/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4be66635ca10096939214e7cb4765409869911a3 --- /dev/null +++ b/codenet/public_test_cases/p03461/input.0.txt @@ -0,0 +1,3 @@ +2 3 +1 2 2 +1 2 3 diff --git a/codenet/public_test_cases/p03461/input.1.txt b/codenet/public_test_cases/p03461/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4be66635ca10096939214e7cb4765409869911a3 --- /dev/null +++ b/codenet/public_test_cases/p03461/input.1.txt @@ -0,0 +1,3 @@ +2 3 +1 2 2 +1 2 3 diff --git a/codenet/public_test_cases/p03461/input.2.txt b/codenet/public_test_cases/p03461/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d246f4e07ec8055a6fbcd8c506932c22c9461768 --- /dev/null +++ b/codenet/public_test_cases/p03461/input.2.txt @@ -0,0 +1,2 @@ +1 3 +100 50 1 diff --git a/codenet/public_test_cases/p03461/output.0.txt b/codenet/public_test_cases/p03461/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..650d046773140ffe74487ba5e7b7b65867945669 --- /dev/null +++ b/codenet/public_test_cases/p03461/output.0.txt @@ -0,0 +1,7 @@ +Possible +3 4 +1 2 X +2 3 1 +3 2 Y +1 3 Y +1 3 diff --git a/codenet/public_test_cases/p03461/output.1.txt b/codenet/public_test_cases/p03461/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..650d046773140ffe74487ba5e7b7b65867945669 --- /dev/null +++ b/codenet/public_test_cases/p03461/output.1.txt @@ -0,0 +1,7 @@ +Possible +3 4 +1 2 X +2 3 1 +3 2 Y +1 3 Y +1 3 diff --git a/codenet/public_test_cases/p03461/output.2.txt b/codenet/public_test_cases/p03461/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p03461/output.2.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p03462/input.0.txt b/codenet/public_test_cases/p03462/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..47d1a2897132c49a9cd951a0ceb5a458014a8cf1 --- /dev/null +++ b/codenet/public_test_cases/p03462/input.0.txt @@ -0,0 +1,2 @@ +2 2 +rb diff --git a/codenet/public_test_cases/p03462/input.1.txt b/codenet/public_test_cases/p03462/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..52036f59782e4980bc3961ccea9385e05b73e4c6 --- /dev/null +++ b/codenet/public_test_cases/p03462/input.1.txt @@ -0,0 +1,2 @@ +70 70 +bbrbrrbbrrbbbbrbbrbrrbbrrbbrbrrbrbrbbbbrbbrbrrbbrrbbbbrbbrbrrbbrrbbbbr diff --git a/codenet/public_test_cases/p03462/input.2.txt b/codenet/public_test_cases/p03462/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f36ae6ba5c0a84989d05b708c21438805c8751d6 --- /dev/null +++ b/codenet/public_test_cases/p03462/input.2.txt @@ -0,0 +1,2 @@ +7 4 +rbrb diff --git a/codenet/public_test_cases/p03462/input.3.txt b/codenet/public_test_cases/p03462/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..47d1a2897132c49a9cd951a0ceb5a458014a8cf1 --- /dev/null +++ b/codenet/public_test_cases/p03462/input.3.txt @@ -0,0 +1,2 @@ +2 2 +rb diff --git a/codenet/public_test_cases/p03462/input.4.txt b/codenet/public_test_cases/p03462/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..49a7b17315b5a67d986eedb09f5082acbeed8863 --- /dev/null +++ b/codenet/public_test_cases/p03462/input.4.txt @@ -0,0 +1,2 @@ +5 2 +br diff --git a/codenet/public_test_cases/p03462/output.0.txt b/codenet/public_test_cases/p03462/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03462/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03462/output.1.txt b/codenet/public_test_cases/p03462/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97e6df424afdb06274685ab080268860ceb98fe0 --- /dev/null +++ b/codenet/public_test_cases/p03462/output.1.txt @@ -0,0 +1 @@ +841634130 diff --git a/codenet/public_test_cases/p03462/output.2.txt b/codenet/public_test_cases/p03462/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..41cf401fee3b8ec71136c098880bf6b0e2ed0fb9 --- /dev/null +++ b/codenet/public_test_cases/p03462/output.2.txt @@ -0,0 +1 @@ +1569 diff --git a/codenet/public_test_cases/p03462/output.3.txt b/codenet/public_test_cases/p03462/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03462/output.3.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03462/output.4.txt b/codenet/public_test_cases/p03462/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03462/output.4.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03463/input.0.txt b/codenet/public_test_cases/p03463/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37122f4bb8da7cdc63b02195266c286138058939 --- /dev/null +++ b/codenet/public_test_cases/p03463/input.0.txt @@ -0,0 +1 @@ +5 2 4 diff --git a/codenet/public_test_cases/p03463/input.1.txt b/codenet/public_test_cases/p03463/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..96d1f5048ad697577551f52fece1e351c1a5d727 --- /dev/null +++ b/codenet/public_test_cases/p03463/input.1.txt @@ -0,0 +1 @@ +58 23 42 diff --git a/codenet/public_test_cases/p03463/input.2.txt b/codenet/public_test_cases/p03463/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3b04ccdba4df31d78b9f5f65b0d7f77ce8b40d7 --- /dev/null +++ b/codenet/public_test_cases/p03463/input.2.txt @@ -0,0 +1 @@ +2 1 2 diff --git a/codenet/public_test_cases/p03463/input.3.txt b/codenet/public_test_cases/p03463/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..37122f4bb8da7cdc63b02195266c286138058939 --- /dev/null +++ b/codenet/public_test_cases/p03463/input.3.txt @@ -0,0 +1 @@ +5 2 4 diff --git a/codenet/public_test_cases/p03463/output.0.txt b/codenet/public_test_cases/p03463/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03463/output.0.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03463/output.1.txt b/codenet/public_test_cases/p03463/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..948118fe5db924da15fcde341ca7776ca7c32957 --- /dev/null +++ b/codenet/public_test_cases/p03463/output.1.txt @@ -0,0 +1 @@ +Borys diff --git a/codenet/public_test_cases/p03463/output.2.txt b/codenet/public_test_cases/p03463/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..948118fe5db924da15fcde341ca7776ca7c32957 --- /dev/null +++ b/codenet/public_test_cases/p03463/output.2.txt @@ -0,0 +1 @@ +Borys diff --git a/codenet/public_test_cases/p03463/output.3.txt b/codenet/public_test_cases/p03463/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03463/output.3.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03464/input.0.txt b/codenet/public_test_cases/p03464/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ba418c00e9ce40880ad4deef598996eeb18d628 --- /dev/null +++ b/codenet/public_test_cases/p03464/input.0.txt @@ -0,0 +1,2 @@ +4 +3 4 3 2 diff --git a/codenet/public_test_cases/p03464/input.1.txt b/codenet/public_test_cases/p03464/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5210be1c3b20fdc502635d5f048ecd45200bb0c3 --- /dev/null +++ b/codenet/public_test_cases/p03464/input.1.txt @@ -0,0 +1,2 @@ +5 +3 4 100 3 2 diff --git a/codenet/public_test_cases/p03464/input.2.txt b/codenet/public_test_cases/p03464/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6c3431e054c67850ea223341a59b41bdf0859d5 --- /dev/null +++ b/codenet/public_test_cases/p03464/input.2.txt @@ -0,0 +1,2 @@ +10 +2 2 2 2 2 2 2 2 2 2 diff --git a/codenet/public_test_cases/p03464/input.3.txt b/codenet/public_test_cases/p03464/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ba418c00e9ce40880ad4deef598996eeb18d628 --- /dev/null +++ b/codenet/public_test_cases/p03464/input.3.txt @@ -0,0 +1,2 @@ +4 +3 4 3 2 diff --git a/codenet/public_test_cases/p03464/output.0.txt b/codenet/public_test_cases/p03464/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..20a8108cdfe136b0c97700da9a3f06a55bcb51fb --- /dev/null +++ b/codenet/public_test_cases/p03464/output.0.txt @@ -0,0 +1 @@ +6 8 diff --git a/codenet/public_test_cases/p03464/output.1.txt b/codenet/public_test_cases/p03464/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03464/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03464/output.2.txt b/codenet/public_test_cases/p03464/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p03464/output.2.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p03464/output.3.txt b/codenet/public_test_cases/p03464/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..20a8108cdfe136b0c97700da9a3f06a55bcb51fb --- /dev/null +++ b/codenet/public_test_cases/p03464/output.3.txt @@ -0,0 +1 @@ +6 8 diff --git a/codenet/public_test_cases/p03465/input.0.txt b/codenet/public_test_cases/p03465/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..56221aadc5dfac666c62fd57ad1536458c512851 --- /dev/null +++ b/codenet/public_test_cases/p03465/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 1 diff --git a/codenet/public_test_cases/p03465/input.1.txt b/codenet/public_test_cases/p03465/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..56221aadc5dfac666c62fd57ad1536458c512851 --- /dev/null +++ b/codenet/public_test_cases/p03465/input.1.txt @@ -0,0 +1,2 @@ +3 +1 2 1 diff --git a/codenet/public_test_cases/p03465/input.2.txt b/codenet/public_test_cases/p03465/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc2b5b23ffe16407c3e863020d1feef51dc28ab8 --- /dev/null +++ b/codenet/public_test_cases/p03465/input.2.txt @@ -0,0 +1,2 @@ +1 +58 diff --git a/codenet/public_test_cases/p03465/output.0.txt b/codenet/public_test_cases/p03465/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03465/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03465/output.1.txt b/codenet/public_test_cases/p03465/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03465/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03465/output.2.txt b/codenet/public_test_cases/p03465/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c61d23e125b800e69cb950b09e23c06f728fff9 --- /dev/null +++ b/codenet/public_test_cases/p03465/output.2.txt @@ -0,0 +1 @@ +58 diff --git a/codenet/public_test_cases/p03466/input.0.txt b/codenet/public_test_cases/p03466/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d594e7684e566dd4ecb485cc9b72289e680d3bc5 --- /dev/null +++ b/codenet/public_test_cases/p03466/input.0.txt @@ -0,0 +1,6 @@ +5 +2 3 1 5 +6 4 1 10 +2 3 4 4 +6 4 3 7 +8 10 5 8 diff --git a/codenet/public_test_cases/p03466/input.1.txt b/codenet/public_test_cases/p03466/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d594e7684e566dd4ecb485cc9b72289e680d3bc5 --- /dev/null +++ b/codenet/public_test_cases/p03466/input.1.txt @@ -0,0 +1,6 @@ +5 +2 3 1 5 +6 4 1 10 +2 3 4 4 +6 4 3 7 +8 10 5 8 diff --git a/codenet/public_test_cases/p03466/output.0.txt b/codenet/public_test_cases/p03466/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..49aa0b147ea693a3dee48c2ca0d3de6f7446fe9c --- /dev/null +++ b/codenet/public_test_cases/p03466/output.0.txt @@ -0,0 +1,5 @@ +BABAB +AABAABAABB +A +BAABA +ABAB diff --git a/codenet/public_test_cases/p03466/output.1.txt b/codenet/public_test_cases/p03466/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..49aa0b147ea693a3dee48c2ca0d3de6f7446fe9c --- /dev/null +++ b/codenet/public_test_cases/p03466/output.1.txt @@ -0,0 +1,5 @@ +BABAB +AABAABAABB +A +BAABA +ABAB diff --git a/codenet/public_test_cases/p03467/input.0.txt b/codenet/public_test_cases/p03467/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f7afa6beb18058f81d239d26d2b1a1386f8c186 --- /dev/null +++ b/codenet/public_test_cases/p03467/input.0.txt @@ -0,0 +1 @@ +011 diff --git a/codenet/public_test_cases/p03467/input.1.txt b/codenet/public_test_cases/p03467/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee071f8154aa3ae92f46bb56527c1f1e5545979 --- /dev/null +++ b/codenet/public_test_cases/p03467/input.1.txt @@ -0,0 +1 @@ +101110 diff --git a/codenet/public_test_cases/p03467/input.2.txt b/codenet/public_test_cases/p03467/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..739d79706d1a14642c4ce1c263a8760a2cf0d050 --- /dev/null +++ b/codenet/public_test_cases/p03467/input.2.txt @@ -0,0 +1 @@ +0000 diff --git a/codenet/public_test_cases/p03467/input.3.txt b/codenet/public_test_cases/p03467/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9bd97e77a61806ff1e46cf124f036dcf08f7f364 --- /dev/null +++ b/codenet/public_test_cases/p03467/input.3.txt @@ -0,0 +1 @@ +001110111010110001100000100111 diff --git a/codenet/public_test_cases/p03467/input.4.txt b/codenet/public_test_cases/p03467/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f7afa6beb18058f81d239d26d2b1a1386f8c186 --- /dev/null +++ b/codenet/public_test_cases/p03467/input.4.txt @@ -0,0 +1 @@ +011 diff --git a/codenet/public_test_cases/p03467/output.0.txt b/codenet/public_test_cases/p03467/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03467/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03467/output.1.txt b/codenet/public_test_cases/p03467/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..91b629b0fa997ff777a1d36357199b3b325d3012 --- /dev/null +++ b/codenet/public_test_cases/p03467/output.1.txt @@ -0,0 +1 @@ +156 diff --git a/codenet/public_test_cases/p03467/output.2.txt b/codenet/public_test_cases/p03467/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03467/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03467/output.3.txt b/codenet/public_test_cases/p03467/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4eb641ea9132680ab34fec4328e29a1160e53d0c --- /dev/null +++ b/codenet/public_test_cases/p03467/output.3.txt @@ -0,0 +1 @@ +363383189 diff --git a/codenet/public_test_cases/p03467/output.4.txt b/codenet/public_test_cases/p03467/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03467/output.4.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03468/input.0.txt b/codenet/public_test_cases/p03468/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..93645c09020ef841ec3e6934b67c5861073837fb --- /dev/null +++ b/codenet/public_test_cases/p03468/input.0.txt @@ -0,0 +1,2 @@ +2 3 +2 2 diff --git a/codenet/public_test_cases/p03468/input.1.txt b/codenet/public_test_cases/p03468/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e0cd5966ea49048a82499d6cfabb36d8db3a8aa --- /dev/null +++ b/codenet/public_test_cases/p03468/input.1.txt @@ -0,0 +1,2 @@ +4 6 +4 1 3 2 diff --git a/codenet/public_test_cases/p03468/input.2.txt b/codenet/public_test_cases/p03468/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f14f94140d0e8b24bd5469836fc29017292bc70f --- /dev/null +++ b/codenet/public_test_cases/p03468/input.2.txt @@ -0,0 +1,2 @@ +3 5 +2 2 4 diff --git a/codenet/public_test_cases/p03468/input.3.txt b/codenet/public_test_cases/p03468/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2be8564591f8a2f5dbab4d2db8629c9d6601cea2 --- /dev/null +++ b/codenet/public_test_cases/p03468/input.3.txt @@ -0,0 +1,2 @@ +4 2 +1 1 1 1 diff --git a/codenet/public_test_cases/p03468/input.4.txt b/codenet/public_test_cases/p03468/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..93645c09020ef841ec3e6934b67c5861073837fb --- /dev/null +++ b/codenet/public_test_cases/p03468/input.4.txt @@ -0,0 +1,2 @@ +2 3 +2 2 diff --git a/codenet/public_test_cases/p03468/input.5.txt b/codenet/public_test_cases/p03468/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7d0453234f0f0414b6ed368f9b00f8928e21a8a --- /dev/null +++ b/codenet/public_test_cases/p03468/input.5.txt @@ -0,0 +1,2 @@ +4 10 +1 2 3 4 diff --git a/codenet/public_test_cases/p03468/input.6.txt b/codenet/public_test_cases/p03468/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..59cb293e9417af37f6f7fb11acf594834ce55d00 --- /dev/null +++ b/codenet/public_test_cases/p03468/input.6.txt @@ -0,0 +1,2 @@ +6 49 +22 13 27 8 2 19 diff --git a/codenet/public_test_cases/p03468/output.0.txt b/codenet/public_test_cases/p03468/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02f284a60e5dcc580136e05e85e852eb2b87f985 --- /dev/null +++ b/codenet/public_test_cases/p03468/output.0.txt @@ -0,0 +1 @@ +0.3333333333333333 diff --git a/codenet/public_test_cases/p03468/output.1.txt b/codenet/public_test_cases/p03468/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3211604939da0e2e0732ce6d47d00e6337b20ae --- /dev/null +++ b/codenet/public_test_cases/p03468/output.1.txt @@ -0,0 +1 @@ +0.3148148148148148 diff --git a/codenet/public_test_cases/p03468/output.2.txt b/codenet/public_test_cases/p03468/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2f920941675f000dcd12fc1c739e003a05ecaa3 --- /dev/null +++ b/codenet/public_test_cases/p03468/output.2.txt @@ -0,0 +1 @@ +0.4000000000000000 diff --git a/codenet/public_test_cases/p03468/output.3.txt b/codenet/public_test_cases/p03468/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..18e68c0612fb897279506203da446d7ee269ab7b --- /dev/null +++ b/codenet/public_test_cases/p03468/output.3.txt @@ -0,0 +1 @@ +0.5000000000000000 diff --git a/codenet/public_test_cases/p03468/output.4.txt b/codenet/public_test_cases/p03468/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..02f284a60e5dcc580136e05e85e852eb2b87f985 --- /dev/null +++ b/codenet/public_test_cases/p03468/output.4.txt @@ -0,0 +1 @@ +0.3333333333333333 diff --git a/codenet/public_test_cases/p03468/output.5.txt b/codenet/public_test_cases/p03468/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..da5cfce855f8ad54c28d1fffda5420442d9efae4 --- /dev/null +++ b/codenet/public_test_cases/p03468/output.5.txt @@ -0,0 +1 @@ +0.0000000000000000 diff --git a/codenet/public_test_cases/p03468/output.6.txt b/codenet/public_test_cases/p03468/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..249bbb7c95db4a120445832994e02903ea63f743 --- /dev/null +++ b/codenet/public_test_cases/p03468/output.6.txt @@ -0,0 +1 @@ +0.2832340720702695 diff --git a/codenet/public_test_cases/p03469/input.0.txt b/codenet/public_test_cases/p03469/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98912d55fee54acc703f028a74c552e3635d86aa --- /dev/null +++ b/codenet/public_test_cases/p03469/input.0.txt @@ -0,0 +1 @@ +2017/01/07 diff --git a/codenet/public_test_cases/p03469/input.1.txt b/codenet/public_test_cases/p03469/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98912d55fee54acc703f028a74c552e3635d86aa --- /dev/null +++ b/codenet/public_test_cases/p03469/input.1.txt @@ -0,0 +1 @@ +2017/01/07 diff --git a/codenet/public_test_cases/p03469/input.2.txt b/codenet/public_test_cases/p03469/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2d56106cb3f16dc97e0cdf98f43e7453a0bedad --- /dev/null +++ b/codenet/public_test_cases/p03469/input.2.txt @@ -0,0 +1 @@ +2017/01/31 diff --git a/codenet/public_test_cases/p03469/output.0.txt b/codenet/public_test_cases/p03469/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3207f555eb518408e6c890a4a033f4cd3cc07b9b --- /dev/null +++ b/codenet/public_test_cases/p03469/output.0.txt @@ -0,0 +1 @@ +2018/01/07 diff --git a/codenet/public_test_cases/p03469/output.1.txt b/codenet/public_test_cases/p03469/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3207f555eb518408e6c890a4a033f4cd3cc07b9b --- /dev/null +++ b/codenet/public_test_cases/p03469/output.1.txt @@ -0,0 +1 @@ +2018/01/07 diff --git a/codenet/public_test_cases/p03469/output.2.txt b/codenet/public_test_cases/p03469/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dec13492d7ea23ee77b5a63fc28c05e4285b89f3 --- /dev/null +++ b/codenet/public_test_cases/p03469/output.2.txt @@ -0,0 +1 @@ +2018/01/31 diff --git a/codenet/public_test_cases/p03470/input.0.txt b/codenet/public_test_cases/p03470/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..555ff375f43944f44d474a857d46015209a027e7 --- /dev/null +++ b/codenet/public_test_cases/p03470/input.0.txt @@ -0,0 +1,5 @@ +4 +10 +8 +8 +6 diff --git a/codenet/public_test_cases/p03470/input.1.txt b/codenet/public_test_cases/p03470/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7ce81db8647ec1d03f3bfed29db810b35a9124a --- /dev/null +++ b/codenet/public_test_cases/p03470/input.1.txt @@ -0,0 +1,8 @@ +7 +50 +30 +50 +100 +50 +80 +30 diff --git a/codenet/public_test_cases/p03470/input.2.txt b/codenet/public_test_cases/p03470/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..775604ed529a965ec10027851a5dc59650343533 --- /dev/null +++ b/codenet/public_test_cases/p03470/input.2.txt @@ -0,0 +1,4 @@ +3 +15 +15 +15 diff --git a/codenet/public_test_cases/p03470/input.3.txt b/codenet/public_test_cases/p03470/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..555ff375f43944f44d474a857d46015209a027e7 --- /dev/null +++ b/codenet/public_test_cases/p03470/input.3.txt @@ -0,0 +1,5 @@ +4 +10 +8 +8 +6 diff --git a/codenet/public_test_cases/p03470/output.0.txt b/codenet/public_test_cases/p03470/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03470/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03470/output.1.txt b/codenet/public_test_cases/p03470/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03470/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03470/output.2.txt b/codenet/public_test_cases/p03470/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03470/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03470/output.3.txt b/codenet/public_test_cases/p03470/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03470/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03471/input.0.txt b/codenet/public_test_cases/p03471/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f839b6e5fab3592aa9d6067953e9a61a968e21ba --- /dev/null +++ b/codenet/public_test_cases/p03471/input.0.txt @@ -0,0 +1 @@ +9 45000 diff --git a/codenet/public_test_cases/p03471/input.1.txt b/codenet/public_test_cases/p03471/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eee91beec2f08c8a425d8f3b9f77523152aa771f --- /dev/null +++ b/codenet/public_test_cases/p03471/input.1.txt @@ -0,0 +1 @@ +1000 1234000 diff --git a/codenet/public_test_cases/p03471/input.2.txt b/codenet/public_test_cases/p03471/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f839b6e5fab3592aa9d6067953e9a61a968e21ba --- /dev/null +++ b/codenet/public_test_cases/p03471/input.2.txt @@ -0,0 +1 @@ +9 45000 diff --git a/codenet/public_test_cases/p03471/input.3.txt b/codenet/public_test_cases/p03471/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8aaef5533cfd6af67f4b03467ea02536119a450 --- /dev/null +++ b/codenet/public_test_cases/p03471/input.3.txt @@ -0,0 +1 @@ +20 196000 diff --git a/codenet/public_test_cases/p03471/input.4.txt b/codenet/public_test_cases/p03471/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0498bbe3676fb1f929c4d1d5e02eca2ec96a2937 --- /dev/null +++ b/codenet/public_test_cases/p03471/input.4.txt @@ -0,0 +1 @@ +2000 20000000 diff --git a/codenet/public_test_cases/p03471/output.0.txt b/codenet/public_test_cases/p03471/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f64984fb866e5376bac4ce01010b269f7d04587 --- /dev/null +++ b/codenet/public_test_cases/p03471/output.0.txt @@ -0,0 +1 @@ +4 0 5 diff --git a/codenet/public_test_cases/p03471/output.1.txt b/codenet/public_test_cases/p03471/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1f2c1b379b43cb719aa99c29892640cef15f471 --- /dev/null +++ b/codenet/public_test_cases/p03471/output.1.txt @@ -0,0 +1 @@ +14 27 959 diff --git a/codenet/public_test_cases/p03471/output.2.txt b/codenet/public_test_cases/p03471/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f64984fb866e5376bac4ce01010b269f7d04587 --- /dev/null +++ b/codenet/public_test_cases/p03471/output.2.txt @@ -0,0 +1 @@ +4 0 5 diff --git a/codenet/public_test_cases/p03471/output.3.txt b/codenet/public_test_cases/p03471/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3cd8d39aa08af2ed2f98dd33a58a9286b3dbc6b --- /dev/null +++ b/codenet/public_test_cases/p03471/output.3.txt @@ -0,0 +1 @@ +-1 -1 -1 diff --git a/codenet/public_test_cases/p03471/output.4.txt b/codenet/public_test_cases/p03471/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d3f7f3646590d873e30dc595af3dd8ec6c165f0 --- /dev/null +++ b/codenet/public_test_cases/p03471/output.4.txt @@ -0,0 +1 @@ +2000 0 0 diff --git a/codenet/public_test_cases/p03472/input.0.txt b/codenet/public_test_cases/p03472/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f01109ee998309939a8124686ccca8c71cf2cc0e --- /dev/null +++ b/codenet/public_test_cases/p03472/input.0.txt @@ -0,0 +1,2 @@ +1 10 +3 5 diff --git a/codenet/public_test_cases/p03472/input.1.txt b/codenet/public_test_cases/p03472/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..977aa2c3c48bd0a7d6c47cb7e2ca13ea2b715d98 --- /dev/null +++ b/codenet/public_test_cases/p03472/input.1.txt @@ -0,0 +1,5 @@ +4 1000000000 +1 1 +1 10000000 +1 30000000 +1 99999999 diff --git a/codenet/public_test_cases/p03472/input.2.txt b/codenet/public_test_cases/p03472/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f01109ee998309939a8124686ccca8c71cf2cc0e --- /dev/null +++ b/codenet/public_test_cases/p03472/input.2.txt @@ -0,0 +1,2 @@ +1 10 +3 5 diff --git a/codenet/public_test_cases/p03472/input.3.txt b/codenet/public_test_cases/p03472/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..234b312628e1e82edb838ad25714bf39727d1170 --- /dev/null +++ b/codenet/public_test_cases/p03472/input.3.txt @@ -0,0 +1,3 @@ +2 10 +3 5 +2 6 diff --git a/codenet/public_test_cases/p03472/input.4.txt b/codenet/public_test_cases/p03472/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8345af886e38bb0e5674d25c6ee62e91fd95be66 --- /dev/null +++ b/codenet/public_test_cases/p03472/input.4.txt @@ -0,0 +1,6 @@ +5 500 +35 44 +28 83 +46 62 +31 79 +40 43 diff --git a/codenet/public_test_cases/p03472/output.0.txt b/codenet/public_test_cases/p03472/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03472/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03472/output.1.txt b/codenet/public_test_cases/p03472/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5624d566c27bad0352fbce807374c993b19549a6 --- /dev/null +++ b/codenet/public_test_cases/p03472/output.1.txt @@ -0,0 +1 @@ +860000004 diff --git a/codenet/public_test_cases/p03472/output.2.txt b/codenet/public_test_cases/p03472/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03472/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03472/output.3.txt b/codenet/public_test_cases/p03472/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03472/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03472/output.4.txt b/codenet/public_test_cases/p03472/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03472/output.4.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03473/input.0.txt b/codenet/public_test_cases/p03473/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03473/input.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03473/input.1.txt b/codenet/public_test_cases/p03473/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03473/input.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03473/input.2.txt b/codenet/public_test_cases/p03473/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03473/input.2.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03473/output.0.txt b/codenet/public_test_cases/p03473/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p03473/output.0.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p03473/output.1.txt b/codenet/public_test_cases/p03473/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p03473/output.1.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p03473/output.2.txt b/codenet/public_test_cases/p03473/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p03473/output.2.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p03474/input.0.txt b/codenet/public_test_cases/p03474/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e98ab148bfbf1fb9e8ae7588cff61d37394f557 --- /dev/null +++ b/codenet/public_test_cases/p03474/input.0.txt @@ -0,0 +1,2 @@ +3 4 +269-6650 diff --git a/codenet/public_test_cases/p03474/input.1.txt b/codenet/public_test_cases/p03474/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d086907f282ebe1f0fb30e24742b530b8fb19f21 --- /dev/null +++ b/codenet/public_test_cases/p03474/input.1.txt @@ -0,0 +1,2 @@ +1 2 +7444 diff --git a/codenet/public_test_cases/p03474/input.2.txt b/codenet/public_test_cases/p03474/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e98ab148bfbf1fb9e8ae7588cff61d37394f557 --- /dev/null +++ b/codenet/public_test_cases/p03474/input.2.txt @@ -0,0 +1,2 @@ +3 4 +269-6650 diff --git a/codenet/public_test_cases/p03474/input.3.txt b/codenet/public_test_cases/p03474/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1afa5d5af5a6905e1ae99b7b45bf3b81b6445bba --- /dev/null +++ b/codenet/public_test_cases/p03474/input.3.txt @@ -0,0 +1,2 @@ +1 1 +--- diff --git a/codenet/public_test_cases/p03474/output.0.txt b/codenet/public_test_cases/p03474/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03474/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03474/output.1.txt b/codenet/public_test_cases/p03474/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03474/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03474/output.2.txt b/codenet/public_test_cases/p03474/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03474/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03474/output.3.txt b/codenet/public_test_cases/p03474/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03474/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03475/input.0.txt b/codenet/public_test_cases/p03475/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cf0576ed0ecbc909da7134cf8aef79922d5bc9b --- /dev/null +++ b/codenet/public_test_cases/p03475/input.0.txt @@ -0,0 +1,3 @@ +3 +6 5 1 +1 10 1 diff --git a/codenet/public_test_cases/p03475/input.1.txt b/codenet/public_test_cases/p03475/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cf0576ed0ecbc909da7134cf8aef79922d5bc9b --- /dev/null +++ b/codenet/public_test_cases/p03475/input.1.txt @@ -0,0 +1,3 @@ +3 +6 5 1 +1 10 1 diff --git a/codenet/public_test_cases/p03475/input.2.txt b/codenet/public_test_cases/p03475/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1a95b00ddcaada006b47a6937a044f41812d54d --- /dev/null +++ b/codenet/public_test_cases/p03475/input.2.txt @@ -0,0 +1,4 @@ +4 +12 13 1 +44 17 17 +66 4096 64 diff --git a/codenet/public_test_cases/p03475/input.3.txt b/codenet/public_test_cases/p03475/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..38d73e0da1948ae7ac96904cb8890361c68b0e84 --- /dev/null +++ b/codenet/public_test_cases/p03475/input.3.txt @@ -0,0 +1,4 @@ +4 +12 24 6 +52 16 4 +99 2 2 diff --git a/codenet/public_test_cases/p03475/output.0.txt b/codenet/public_test_cases/p03475/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..22c59fd4e05a6d716b766c4ca11cc276d5c6ae19 --- /dev/null +++ b/codenet/public_test_cases/p03475/output.0.txt @@ -0,0 +1,3 @@ +12 +11 +0 diff --git a/codenet/public_test_cases/p03475/output.1.txt b/codenet/public_test_cases/p03475/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..22c59fd4e05a6d716b766c4ca11cc276d5c6ae19 --- /dev/null +++ b/codenet/public_test_cases/p03475/output.1.txt @@ -0,0 +1,3 @@ +12 +11 +0 diff --git a/codenet/public_test_cases/p03475/output.2.txt b/codenet/public_test_cases/p03475/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5747cfbab79d6479b2dc60c19b8e6c0045eb773b --- /dev/null +++ b/codenet/public_test_cases/p03475/output.2.txt @@ -0,0 +1,4 @@ +4162 +4162 +4162 +0 diff --git a/codenet/public_test_cases/p03475/output.3.txt b/codenet/public_test_cases/p03475/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e73e3d63396d202a0e0345e77b1e52e591d07f62 --- /dev/null +++ b/codenet/public_test_cases/p03475/output.3.txt @@ -0,0 +1,4 @@ +187 +167 +101 +0 diff --git a/codenet/public_test_cases/p03476/input.0.txt b/codenet/public_test_cases/p03476/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6990404d4b88b097d7188992916d558f5dfbe4e5 --- /dev/null +++ b/codenet/public_test_cases/p03476/input.0.txt @@ -0,0 +1,2 @@ +1 +3 7 diff --git a/codenet/public_test_cases/p03476/input.1.txt b/codenet/public_test_cases/p03476/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6990404d4b88b097d7188992916d558f5dfbe4e5 --- /dev/null +++ b/codenet/public_test_cases/p03476/input.1.txt @@ -0,0 +1,2 @@ +1 +3 7 diff --git a/codenet/public_test_cases/p03476/input.2.txt b/codenet/public_test_cases/p03476/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..988378b391a304a4cab6d01ef684423b85d5e6c3 --- /dev/null +++ b/codenet/public_test_cases/p03476/input.2.txt @@ -0,0 +1,5 @@ +4 +13 13 +7 11 +7 11 +2017 2017 diff --git a/codenet/public_test_cases/p03476/input.3.txt b/codenet/public_test_cases/p03476/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..da66f27031a6584ac6e336cffc69188ea4ea7015 --- /dev/null +++ b/codenet/public_test_cases/p03476/input.3.txt @@ -0,0 +1,7 @@ +6 +1 53 +13 91 +37 55 +19 51 +73 91 +13 49 diff --git a/codenet/public_test_cases/p03476/output.0.txt b/codenet/public_test_cases/p03476/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03476/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03476/output.1.txt b/codenet/public_test_cases/p03476/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03476/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03476/output.2.txt b/codenet/public_test_cases/p03476/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..680eb502aaab592f5ffe958c241ee2f1de143aea --- /dev/null +++ b/codenet/public_test_cases/p03476/output.2.txt @@ -0,0 +1,4 @@ +1 +0 +0 +1 diff --git a/codenet/public_test_cases/p03476/output.3.txt b/codenet/public_test_cases/p03476/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..10cd9cad6c65cd2ed98c087f452e8c46b6e93e89 --- /dev/null +++ b/codenet/public_test_cases/p03476/output.3.txt @@ -0,0 +1,6 @@ +4 +4 +1 +1 +1 +2 diff --git a/codenet/public_test_cases/p03477/input.0.txt b/codenet/public_test_cases/p03477/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f49f804e8bc7161a03ee83227604d7939fcbed8 --- /dev/null +++ b/codenet/public_test_cases/p03477/input.0.txt @@ -0,0 +1 @@ +3 8 7 1 diff --git a/codenet/public_test_cases/p03477/input.1.txt b/codenet/public_test_cases/p03477/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f49f804e8bc7161a03ee83227604d7939fcbed8 --- /dev/null +++ b/codenet/public_test_cases/p03477/input.1.txt @@ -0,0 +1 @@ +3 8 7 1 diff --git a/codenet/public_test_cases/p03477/input.2.txt b/codenet/public_test_cases/p03477/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b07fe23239f6a9ea30c32050ab511fb6bc88ade --- /dev/null +++ b/codenet/public_test_cases/p03477/input.2.txt @@ -0,0 +1 @@ +1 7 6 4 diff --git a/codenet/public_test_cases/p03477/input.3.txt b/codenet/public_test_cases/p03477/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..98eaada3248e94e418b68627934d7925459775ea --- /dev/null +++ b/codenet/public_test_cases/p03477/input.3.txt @@ -0,0 +1 @@ +3 4 5 2 diff --git a/codenet/public_test_cases/p03477/output.0.txt b/codenet/public_test_cases/p03477/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2404dced08c72f0d5e6a1d20bae9ee747b64cd9e --- /dev/null +++ b/codenet/public_test_cases/p03477/output.0.txt @@ -0,0 +1 @@ +Left diff --git a/codenet/public_test_cases/p03477/output.1.txt b/codenet/public_test_cases/p03477/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2404dced08c72f0d5e6a1d20bae9ee747b64cd9e --- /dev/null +++ b/codenet/public_test_cases/p03477/output.1.txt @@ -0,0 +1 @@ +Left diff --git a/codenet/public_test_cases/p03477/output.2.txt b/codenet/public_test_cases/p03477/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e966fe0588086241555247b800b91a860b6ba9 --- /dev/null +++ b/codenet/public_test_cases/p03477/output.2.txt @@ -0,0 +1 @@ +Right diff --git a/codenet/public_test_cases/p03477/output.3.txt b/codenet/public_test_cases/p03477/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a7b71018a0d7eeb713418aad48653920e69454d --- /dev/null +++ b/codenet/public_test_cases/p03477/output.3.txt @@ -0,0 +1 @@ +Balanced diff --git a/codenet/public_test_cases/p03478/input.0.txt b/codenet/public_test_cases/p03478/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dff3d1092a3808b1c68b6f10b1190f757971cc09 --- /dev/null +++ b/codenet/public_test_cases/p03478/input.0.txt @@ -0,0 +1 @@ +20 2 5 diff --git a/codenet/public_test_cases/p03478/input.1.txt b/codenet/public_test_cases/p03478/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8a79e2fe3adc6011533af5b1c2c87113ebfc5b9 --- /dev/null +++ b/codenet/public_test_cases/p03478/input.1.txt @@ -0,0 +1 @@ +10 1 2 diff --git a/codenet/public_test_cases/p03478/input.2.txt b/codenet/public_test_cases/p03478/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dff3d1092a3808b1c68b6f10b1190f757971cc09 --- /dev/null +++ b/codenet/public_test_cases/p03478/input.2.txt @@ -0,0 +1 @@ +20 2 5 diff --git a/codenet/public_test_cases/p03478/input.3.txt b/codenet/public_test_cases/p03478/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c35f0baf03315d623383b194aac5e32045e97d2 --- /dev/null +++ b/codenet/public_test_cases/p03478/input.3.txt @@ -0,0 +1 @@ +100 4 16 diff --git a/codenet/public_test_cases/p03478/output.0.txt b/codenet/public_test_cases/p03478/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..871727de1fd703d0c4aab92017011c373e795b67 --- /dev/null +++ b/codenet/public_test_cases/p03478/output.0.txt @@ -0,0 +1 @@ +84 diff --git a/codenet/public_test_cases/p03478/output.1.txt b/codenet/public_test_cases/p03478/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03478/output.1.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03478/output.2.txt b/codenet/public_test_cases/p03478/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..871727de1fd703d0c4aab92017011c373e795b67 --- /dev/null +++ b/codenet/public_test_cases/p03478/output.2.txt @@ -0,0 +1 @@ +84 diff --git a/codenet/public_test_cases/p03478/output.3.txt b/codenet/public_test_cases/p03478/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0fabd4cea154ed852b603352718108f3a97d777 --- /dev/null +++ b/codenet/public_test_cases/p03478/output.3.txt @@ -0,0 +1 @@ +4554 diff --git a/codenet/public_test_cases/p03479/input.0.txt b/codenet/public_test_cases/p03479/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5610a8eca0188ab1ee55642852bbd299a586a9f --- /dev/null +++ b/codenet/public_test_cases/p03479/input.0.txt @@ -0,0 +1 @@ +3 20 diff --git a/codenet/public_test_cases/p03479/input.1.txt b/codenet/public_test_cases/p03479/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5610a8eca0188ab1ee55642852bbd299a586a9f --- /dev/null +++ b/codenet/public_test_cases/p03479/input.1.txt @@ -0,0 +1 @@ +3 20 diff --git a/codenet/public_test_cases/p03479/input.2.txt b/codenet/public_test_cases/p03479/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7adc5725bb71dd17295bb922477ae88a73bc4b85 --- /dev/null +++ b/codenet/public_test_cases/p03479/input.2.txt @@ -0,0 +1 @@ +314159265 358979323846264338 diff --git a/codenet/public_test_cases/p03479/input.3.txt b/codenet/public_test_cases/p03479/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cb60b71291b52f2caaa3ff535f3b2ba2c1d6df7 --- /dev/null +++ b/codenet/public_test_cases/p03479/input.3.txt @@ -0,0 +1 @@ +25 100 diff --git a/codenet/public_test_cases/p03479/output.0.txt b/codenet/public_test_cases/p03479/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03479/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03479/output.1.txt b/codenet/public_test_cases/p03479/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03479/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03479/output.2.txt b/codenet/public_test_cases/p03479/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e85087affded170efcbc6f9672a6fc671d839ed0 --- /dev/null +++ b/codenet/public_test_cases/p03479/output.2.txt @@ -0,0 +1 @@ +31 diff --git a/codenet/public_test_cases/p03479/output.3.txt b/codenet/public_test_cases/p03479/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03479/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03480/input.0.txt b/codenet/public_test_cases/p03480/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e8493eaee24931316636bac59fcf63e51482e1f --- /dev/null +++ b/codenet/public_test_cases/p03480/input.0.txt @@ -0,0 +1 @@ +010 diff --git a/codenet/public_test_cases/p03480/input.1.txt b/codenet/public_test_cases/p03480/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea600cb61b366b723c6e331e118865642391327f --- /dev/null +++ b/codenet/public_test_cases/p03480/input.1.txt @@ -0,0 +1 @@ +100000000 diff --git a/codenet/public_test_cases/p03480/input.2.txt b/codenet/public_test_cases/p03480/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e8493eaee24931316636bac59fcf63e51482e1f --- /dev/null +++ b/codenet/public_test_cases/p03480/input.2.txt @@ -0,0 +1 @@ +010 diff --git a/codenet/public_test_cases/p03480/input.3.txt b/codenet/public_test_cases/p03480/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a60ffe5535e3d6b294750c6433f834ae4b91f5e --- /dev/null +++ b/codenet/public_test_cases/p03480/input.3.txt @@ -0,0 +1 @@ +00001111 diff --git a/codenet/public_test_cases/p03480/output.0.txt b/codenet/public_test_cases/p03480/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03480/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03480/output.1.txt b/codenet/public_test_cases/p03480/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03480/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03480/output.2.txt b/codenet/public_test_cases/p03480/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03480/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03480/output.3.txt b/codenet/public_test_cases/p03480/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03480/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03481/input.0.txt b/codenet/public_test_cases/p03481/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5610a8eca0188ab1ee55642852bbd299a586a9f --- /dev/null +++ b/codenet/public_test_cases/p03481/input.0.txt @@ -0,0 +1 @@ +3 20 diff --git a/codenet/public_test_cases/p03481/output.0.txt b/codenet/public_test_cases/p03481/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03481/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03482/input.0.txt b/codenet/public_test_cases/p03482/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e8493eaee24931316636bac59fcf63e51482e1f --- /dev/null +++ b/codenet/public_test_cases/p03482/input.0.txt @@ -0,0 +1 @@ +010 diff --git a/codenet/public_test_cases/p03482/output.0.txt b/codenet/public_test_cases/p03482/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03482/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03483/input.0.txt b/codenet/public_test_cases/p03483/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..debd42be4d75866b71fd8f8b4d38b913cf489cb7 --- /dev/null +++ b/codenet/public_test_cases/p03483/input.0.txt @@ -0,0 +1 @@ +eel diff --git a/codenet/public_test_cases/p03483/input.1.txt b/codenet/public_test_cases/p03483/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..484bd2b8d4cd00915fe830d2fd5177307a08d125 --- /dev/null +++ b/codenet/public_test_cases/p03483/input.1.txt @@ -0,0 +1 @@ +snuke diff --git a/codenet/public_test_cases/p03483/input.2.txt b/codenet/public_test_cases/p03483/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60af058af593c7989c77e7117c3817f1c7541a49 --- /dev/null +++ b/codenet/public_test_cases/p03483/input.2.txt @@ -0,0 +1 @@ +ataatmma diff --git a/codenet/public_test_cases/p03483/input.3.txt b/codenet/public_test_cases/p03483/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..debd42be4d75866b71fd8f8b4d38b913cf489cb7 --- /dev/null +++ b/codenet/public_test_cases/p03483/input.3.txt @@ -0,0 +1 @@ +eel diff --git a/codenet/public_test_cases/p03483/output.0.txt b/codenet/public_test_cases/p03483/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03483/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03483/output.1.txt b/codenet/public_test_cases/p03483/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03483/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03483/output.2.txt b/codenet/public_test_cases/p03483/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03483/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03483/output.3.txt b/codenet/public_test_cases/p03483/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03483/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03484/input.0.txt b/codenet/public_test_cases/p03484/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d28f51cfbcaf47face8ddeace7069ce587dca10e --- /dev/null +++ b/codenet/public_test_cases/p03484/input.0.txt @@ -0,0 +1,7 @@ +7 +1 2 +2 3 +2 4 +4 5 +4 6 +6 7 diff --git a/codenet/public_test_cases/p03484/input.1.txt b/codenet/public_test_cases/p03484/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d28f51cfbcaf47face8ddeace7069ce587dca10e --- /dev/null +++ b/codenet/public_test_cases/p03484/input.1.txt @@ -0,0 +1,7 @@ +7 +1 2 +2 3 +2 4 +4 5 +4 6 +6 7 diff --git a/codenet/public_test_cases/p03484/input.2.txt b/codenet/public_test_cases/p03484/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..54aabbf1bcc66d652e3e816caa4f34ece45c4eec --- /dev/null +++ b/codenet/public_test_cases/p03484/input.2.txt @@ -0,0 +1,10 @@ +10 +1 2 +2 3 +3 4 +2 5 +6 5 +6 7 +7 8 +5 9 +10 5 diff --git a/codenet/public_test_cases/p03484/input.3.txt b/codenet/public_test_cases/p03484/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9611a27a925cf367f0f0e00ef9c903ecdf061368 --- /dev/null +++ b/codenet/public_test_cases/p03484/input.3.txt @@ -0,0 +1,8 @@ +8 +1 2 +2 3 +3 4 +4 5 +5 6 +5 7 +5 8 diff --git a/codenet/public_test_cases/p03484/output.0.txt b/codenet/public_test_cases/p03484/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03484/output.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03484/output.1.txt b/codenet/public_test_cases/p03484/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03484/output.1.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03484/output.2.txt b/codenet/public_test_cases/p03484/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebcee1a506db729ea7b0e0b6e9b0be36806d16bd --- /dev/null +++ b/codenet/public_test_cases/p03484/output.2.txt @@ -0,0 +1 @@ +3 4 diff --git a/codenet/public_test_cases/p03484/output.3.txt b/codenet/public_test_cases/p03484/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p03484/output.3.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p03485/input.0.txt b/codenet/public_test_cases/p03485/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p03485/input.0.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p03485/output.0.txt b/codenet/public_test_cases/p03485/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03485/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03486/input.0.txt b/codenet/public_test_cases/p03486/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbfae11b38c24e17cc6d0f84720e51ea20686a04 --- /dev/null +++ b/codenet/public_test_cases/p03486/input.0.txt @@ -0,0 +1,2 @@ +yx +axy diff --git a/codenet/public_test_cases/p03486/input.1.txt b/codenet/public_test_cases/p03486/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..80bee1ef336ae6e72b09277069da6da5706e8ff1 --- /dev/null +++ b/codenet/public_test_cases/p03486/input.1.txt @@ -0,0 +1,2 @@ +ratcode +atlas diff --git a/codenet/public_test_cases/p03486/input.2.txt b/codenet/public_test_cases/p03486/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..efc06dc45723bac27bcb6869878ad00c8e304d64 --- /dev/null +++ b/codenet/public_test_cases/p03486/input.2.txt @@ -0,0 +1,2 @@ +zzz +zzz diff --git a/codenet/public_test_cases/p03486/input.3.txt b/codenet/public_test_cases/p03486/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a22ca137193b549478c15134eaca9d53896d901b --- /dev/null +++ b/codenet/public_test_cases/p03486/input.3.txt @@ -0,0 +1,2 @@ +w +ww diff --git a/codenet/public_test_cases/p03486/input.4.txt b/codenet/public_test_cases/p03486/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..80c3a4b7888dd5f353d029024eb827f78c447df9 --- /dev/null +++ b/codenet/public_test_cases/p03486/input.4.txt @@ -0,0 +1,2 @@ +cd +abc diff --git a/codenet/public_test_cases/p03486/input.5.txt b/codenet/public_test_cases/p03486/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbfae11b38c24e17cc6d0f84720e51ea20686a04 --- /dev/null +++ b/codenet/public_test_cases/p03486/input.5.txt @@ -0,0 +1,2 @@ +yx +axy diff --git a/codenet/public_test_cases/p03486/output.0.txt b/codenet/public_test_cases/p03486/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03486/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03486/output.1.txt b/codenet/public_test_cases/p03486/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03486/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03486/output.2.txt b/codenet/public_test_cases/p03486/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03486/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03486/output.3.txt b/codenet/public_test_cases/p03486/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03486/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03486/output.4.txt b/codenet/public_test_cases/p03486/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03486/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03486/output.5.txt b/codenet/public_test_cases/p03486/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03486/output.5.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03487/input.0.txt b/codenet/public_test_cases/p03487/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c527d5403ccac6eb909516290ad2a34f0d99684b --- /dev/null +++ b/codenet/public_test_cases/p03487/input.0.txt @@ -0,0 +1,2 @@ +4 +3 3 3 3 diff --git a/codenet/public_test_cases/p03487/output.0.txt b/codenet/public_test_cases/p03487/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03487/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03488/input.0.txt b/codenet/public_test_cases/p03488/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c44ccfc3ff65d1a7b7cc30ef4a9ed7604a88512 --- /dev/null +++ b/codenet/public_test_cases/p03488/input.0.txt @@ -0,0 +1,2 @@ +FTFFTFFF +4 2 diff --git a/codenet/public_test_cases/p03488/output.0.txt b/codenet/public_test_cases/p03488/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03488/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03489/input.0.txt b/codenet/public_test_cases/p03489/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c527d5403ccac6eb909516290ad2a34f0d99684b --- /dev/null +++ b/codenet/public_test_cases/p03489/input.0.txt @@ -0,0 +1,2 @@ +4 +3 3 3 3 diff --git a/codenet/public_test_cases/p03489/input.1.txt b/codenet/public_test_cases/p03489/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d8f6bf8c2bc65f3d569e7bcec3500bd89632d72 --- /dev/null +++ b/codenet/public_test_cases/p03489/input.1.txt @@ -0,0 +1,2 @@ +8 +2 7 1 8 2 8 1 8 diff --git a/codenet/public_test_cases/p03489/input.2.txt b/codenet/public_test_cases/p03489/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8faee6e444a239b1e46632078e2c9378479346c1 --- /dev/null +++ b/codenet/public_test_cases/p03489/input.2.txt @@ -0,0 +1,2 @@ +1 +1000000000 diff --git a/codenet/public_test_cases/p03489/input.3.txt b/codenet/public_test_cases/p03489/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5af33054015cd452e8c2a733bfc072d517a634ab --- /dev/null +++ b/codenet/public_test_cases/p03489/input.3.txt @@ -0,0 +1,2 @@ +6 +1 2 2 3 3 3 diff --git a/codenet/public_test_cases/p03489/input.4.txt b/codenet/public_test_cases/p03489/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c527d5403ccac6eb909516290ad2a34f0d99684b --- /dev/null +++ b/codenet/public_test_cases/p03489/input.4.txt @@ -0,0 +1,2 @@ +4 +3 3 3 3 diff --git a/codenet/public_test_cases/p03489/input.5.txt b/codenet/public_test_cases/p03489/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..97482d68edadbbdcc5aec97719ca05f267af9dc0 --- /dev/null +++ b/codenet/public_test_cases/p03489/input.5.txt @@ -0,0 +1,2 @@ +5 +2 4 1 4 2 diff --git a/codenet/public_test_cases/p03489/output.0.txt b/codenet/public_test_cases/p03489/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03489/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03489/output.1.txt b/codenet/public_test_cases/p03489/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03489/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03489/output.2.txt b/codenet/public_test_cases/p03489/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03489/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03489/output.3.txt b/codenet/public_test_cases/p03489/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03489/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03489/output.4.txt b/codenet/public_test_cases/p03489/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03489/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03489/output.5.txt b/codenet/public_test_cases/p03489/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03489/output.5.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03490/input.0.txt b/codenet/public_test_cases/p03490/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c44ccfc3ff65d1a7b7cc30ef4a9ed7604a88512 --- /dev/null +++ b/codenet/public_test_cases/p03490/input.0.txt @@ -0,0 +1,2 @@ +FTFFTFFF +4 2 diff --git a/codenet/public_test_cases/p03490/input.1.txt b/codenet/public_test_cases/p03490/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f412caddb6150baa9d58a4448bf278d5a6ba7e68 --- /dev/null +++ b/codenet/public_test_cases/p03490/input.1.txt @@ -0,0 +1,2 @@ +TF +1 0 diff --git a/codenet/public_test_cases/p03490/input.2.txt b/codenet/public_test_cases/p03490/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c73464a0f4b9ddc041997c88948652a98445ae5b --- /dev/null +++ b/codenet/public_test_cases/p03490/input.2.txt @@ -0,0 +1,2 @@ +FF +1 0 diff --git a/codenet/public_test_cases/p03490/input.3.txt b/codenet/public_test_cases/p03490/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e282a3020ebece1b1ce6dc8dc950f2c60cf8e1af --- /dev/null +++ b/codenet/public_test_cases/p03490/input.3.txt @@ -0,0 +1,2 @@ +FFTTFF +0 0 diff --git a/codenet/public_test_cases/p03490/input.4.txt b/codenet/public_test_cases/p03490/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a19f7f23108676fde2812fc04f4d23511b24a7e --- /dev/null +++ b/codenet/public_test_cases/p03490/input.4.txt @@ -0,0 +1,2 @@ +FTFFTFFF +-2 -2 diff --git a/codenet/public_test_cases/p03490/input.5.txt b/codenet/public_test_cases/p03490/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9f20fc2890ef3e3063c950eec572af83fd80866 --- /dev/null +++ b/codenet/public_test_cases/p03490/input.5.txt @@ -0,0 +1,2 @@ +TTTT +1 0 diff --git a/codenet/public_test_cases/p03490/input.6.txt b/codenet/public_test_cases/p03490/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c44ccfc3ff65d1a7b7cc30ef4a9ed7604a88512 --- /dev/null +++ b/codenet/public_test_cases/p03490/input.6.txt @@ -0,0 +1,2 @@ +FTFFTFFF +4 2 diff --git a/codenet/public_test_cases/p03490/output.0.txt b/codenet/public_test_cases/p03490/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03490/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03490/output.1.txt b/codenet/public_test_cases/p03490/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03490/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03490/output.2.txt b/codenet/public_test_cases/p03490/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03490/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03490/output.3.txt b/codenet/public_test_cases/p03490/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03490/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03490/output.4.txt b/codenet/public_test_cases/p03490/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03490/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03490/output.5.txt b/codenet/public_test_cases/p03490/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03490/output.5.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03490/output.6.txt b/codenet/public_test_cases/p03490/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03490/output.6.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03491/input.0.txt b/codenet/public_test_cases/p03491/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded6d3d775f9a212fcd6464bd34503e8b79253d4 --- /dev/null +++ b/codenet/public_test_cases/p03491/input.0.txt @@ -0,0 +1,3 @@ +2 2 +00 +01 diff --git a/codenet/public_test_cases/p03491/input.1.txt b/codenet/public_test_cases/p03491/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cb3b493fa5d86c1207fb01c23f9325795207b44 --- /dev/null +++ b/codenet/public_test_cases/p03491/input.1.txt @@ -0,0 +1,4 @@ +3 3 +0 +10 +110 diff --git a/codenet/public_test_cases/p03491/input.2.txt b/codenet/public_test_cases/p03491/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e16acfa7a61fb8e81eb7553eae187a4d4e71b88 --- /dev/null +++ b/codenet/public_test_cases/p03491/input.2.txt @@ -0,0 +1,3 @@ +2 3 +101 +11 diff --git a/codenet/public_test_cases/p03491/input.3.txt b/codenet/public_test_cases/p03491/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f825eda8890e0b3b0a810c09494bca0bdc6eecf2 --- /dev/null +++ b/codenet/public_test_cases/p03491/input.3.txt @@ -0,0 +1,2 @@ +1 2 +11 diff --git a/codenet/public_test_cases/p03491/input.4.txt b/codenet/public_test_cases/p03491/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8852c82819de2958ee80a1ee54cc86da762170e5 --- /dev/null +++ b/codenet/public_test_cases/p03491/input.4.txt @@ -0,0 +1,3 @@ +2 2 +00 +11 diff --git a/codenet/public_test_cases/p03491/input.5.txt b/codenet/public_test_cases/p03491/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8c8efc57ac51b2d853077c2636b744b1573cb95 --- /dev/null +++ b/codenet/public_test_cases/p03491/input.5.txt @@ -0,0 +1,3 @@ +2 1 +0 +1 diff --git a/codenet/public_test_cases/p03491/input.6.txt b/codenet/public_test_cases/p03491/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded6d3d775f9a212fcd6464bd34503e8b79253d4 --- /dev/null +++ b/codenet/public_test_cases/p03491/input.6.txt @@ -0,0 +1,3 @@ +2 2 +00 +01 diff --git a/codenet/public_test_cases/p03491/output.0.txt b/codenet/public_test_cases/p03491/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03491/output.0.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03491/output.1.txt b/codenet/public_test_cases/p03491/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03491/output.1.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03491/output.2.txt b/codenet/public_test_cases/p03491/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p03491/output.2.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p03491/output.3.txt b/codenet/public_test_cases/p03491/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03491/output.3.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03491/output.4.txt b/codenet/public_test_cases/p03491/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p03491/output.4.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p03491/output.5.txt b/codenet/public_test_cases/p03491/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p03491/output.5.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p03491/output.6.txt b/codenet/public_test_cases/p03491/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03491/output.6.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03492/input.0.txt b/codenet/public_test_cases/p03492/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p03492/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03492/input.1.txt b/codenet/public_test_cases/p03492/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p03492/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03492/input.2.txt b/codenet/public_test_cases/p03492/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..95dc363f3303a461f15965423249ca1335ca414f --- /dev/null +++ b/codenet/public_test_cases/p03492/input.2.txt @@ -0,0 +1,6 @@ +6 +1 2 +1 3 +1 4 +2 5 +2 6 diff --git a/codenet/public_test_cases/p03492/input.3.txt b/codenet/public_test_cases/p03492/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfada82f41e1e3a36aa0fd3a810f14161932b9ea --- /dev/null +++ b/codenet/public_test_cases/p03492/input.3.txt @@ -0,0 +1,7 @@ +7 +1 2 +6 3 +4 5 +1 7 +1 5 +2 3 diff --git a/codenet/public_test_cases/p03492/input.4.txt b/codenet/public_test_cases/p03492/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e7e919d9086f19d0faf1800efb363a22b6e6b8 --- /dev/null +++ b/codenet/public_test_cases/p03492/input.4.txt @@ -0,0 +1,4 @@ +4 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p03492/output.0.txt b/codenet/public_test_cases/p03492/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03492/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03492/output.1.txt b/codenet/public_test_cases/p03492/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03492/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03492/output.2.txt b/codenet/public_test_cases/p03492/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p03492/output.2.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p03492/output.3.txt b/codenet/public_test_cases/p03492/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4391a3343395552806c91a380a71dcbc6ea9e4b2 --- /dev/null +++ b/codenet/public_test_cases/p03492/output.3.txt @@ -0,0 +1 @@ +396 diff --git a/codenet/public_test_cases/p03492/output.4.txt b/codenet/public_test_cases/p03492/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03492/output.4.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03493/input.0.txt b/codenet/public_test_cases/p03493/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..398050c62c882fa5ebc8d8aaa2e730e70790beeb --- /dev/null +++ b/codenet/public_test_cases/p03493/input.0.txt @@ -0,0 +1 @@ +101 diff --git a/codenet/public_test_cases/p03493/output.0.txt b/codenet/public_test_cases/p03493/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03493/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03494/input.0.txt b/codenet/public_test_cases/p03494/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f52145a3c3f9e8bed41db4f396aaf91bbaccba5f --- /dev/null +++ b/codenet/public_test_cases/p03494/input.0.txt @@ -0,0 +1,2 @@ +3 +8 12 40 diff --git a/codenet/public_test_cases/p03494/input.1.txt b/codenet/public_test_cases/p03494/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19a230c0c30e5f6635fb7cdcf00a6f33e26075a5 --- /dev/null +++ b/codenet/public_test_cases/p03494/input.1.txt @@ -0,0 +1,2 @@ +6 +382253568 723152896 37802240 379425024 404894720 471526144 diff --git a/codenet/public_test_cases/p03494/input.2.txt b/codenet/public_test_cases/p03494/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c16ac1adc385aace37660a2ad239df8489809846 --- /dev/null +++ b/codenet/public_test_cases/p03494/input.2.txt @@ -0,0 +1,2 @@ +4 +5 6 8 10 diff --git a/codenet/public_test_cases/p03494/input.3.txt b/codenet/public_test_cases/p03494/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f52145a3c3f9e8bed41db4f396aaf91bbaccba5f --- /dev/null +++ b/codenet/public_test_cases/p03494/input.3.txt @@ -0,0 +1,2 @@ +3 +8 12 40 diff --git a/codenet/public_test_cases/p03494/output.0.txt b/codenet/public_test_cases/p03494/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03494/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03494/output.1.txt b/codenet/public_test_cases/p03494/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03494/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03494/output.2.txt b/codenet/public_test_cases/p03494/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03494/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03494/output.3.txt b/codenet/public_test_cases/p03494/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03494/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03495/input.0.txt b/codenet/public_test_cases/p03495/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..449c2b564bb90a7981b106bec4be17b663963d84 --- /dev/null +++ b/codenet/public_test_cases/p03495/input.0.txt @@ -0,0 +1,2 @@ +5 2 +1 1 2 2 5 diff --git a/codenet/public_test_cases/p03495/output.0.txt b/codenet/public_test_cases/p03495/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03495/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03496/input.0.txt b/codenet/public_test_cases/p03496/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..20d1c1dc5cb33771d34df37c749b2346618d4587 --- /dev/null +++ b/codenet/public_test_cases/p03496/input.0.txt @@ -0,0 +1,2 @@ +3 +-2 5 -1 diff --git a/codenet/public_test_cases/p03496/input.1.txt b/codenet/public_test_cases/p03496/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..20d1c1dc5cb33771d34df37c749b2346618d4587 --- /dev/null +++ b/codenet/public_test_cases/p03496/input.1.txt @@ -0,0 +1,2 @@ +3 +-2 5 -1 diff --git a/codenet/public_test_cases/p03496/input.2.txt b/codenet/public_test_cases/p03496/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f55e257009a79c3e8a18b3cae6c41955ae405297 --- /dev/null +++ b/codenet/public_test_cases/p03496/input.2.txt @@ -0,0 +1,2 @@ +2 +-1 -3 diff --git a/codenet/public_test_cases/p03496/input.3.txt b/codenet/public_test_cases/p03496/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b541ffb87392aae1f65a1d55b69720c286393883 --- /dev/null +++ b/codenet/public_test_cases/p03496/input.3.txt @@ -0,0 +1,2 @@ +5 +0 0 0 0 0 diff --git a/codenet/public_test_cases/p03496/output.0.txt b/codenet/public_test_cases/p03496/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc68d1023532efd851ea37ea35a60d963b0b0f07 --- /dev/null +++ b/codenet/public_test_cases/p03496/output.0.txt @@ -0,0 +1,3 @@ +2 +2 3 +3 3 diff --git a/codenet/public_test_cases/p03496/output.1.txt b/codenet/public_test_cases/p03496/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc68d1023532efd851ea37ea35a60d963b0b0f07 --- /dev/null +++ b/codenet/public_test_cases/p03496/output.1.txt @@ -0,0 +1,3 @@ +2 +2 3 +3 3 diff --git a/codenet/public_test_cases/p03496/output.2.txt b/codenet/public_test_cases/p03496/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bdc75bb7ccd0ce3d6e496a8cee296717eaa8448 --- /dev/null +++ b/codenet/public_test_cases/p03496/output.2.txt @@ -0,0 +1,2 @@ +1 +2 1 diff --git a/codenet/public_test_cases/p03496/output.3.txt b/codenet/public_test_cases/p03496/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03496/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03497/input.0.txt b/codenet/public_test_cases/p03497/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..449c2b564bb90a7981b106bec4be17b663963d84 --- /dev/null +++ b/codenet/public_test_cases/p03497/input.0.txt @@ -0,0 +1,2 @@ +5 2 +1 1 2 2 5 diff --git a/codenet/public_test_cases/p03497/input.1.txt b/codenet/public_test_cases/p03497/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccd96e709a27ff72e1eeee68bb2abadadcad495e --- /dev/null +++ b/codenet/public_test_cases/p03497/input.1.txt @@ -0,0 +1,2 @@ +4 4 +1 1 2 2 diff --git a/codenet/public_test_cases/p03497/input.2.txt b/codenet/public_test_cases/p03497/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..449c2b564bb90a7981b106bec4be17b663963d84 --- /dev/null +++ b/codenet/public_test_cases/p03497/input.2.txt @@ -0,0 +1,2 @@ +5 2 +1 1 2 2 5 diff --git a/codenet/public_test_cases/p03497/input.3.txt b/codenet/public_test_cases/p03497/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..500b03ca51bd828619f0153b0de8ed9f8900612d --- /dev/null +++ b/codenet/public_test_cases/p03497/input.3.txt @@ -0,0 +1,2 @@ +10 3 +5 1 3 2 4 1 1 2 3 4 diff --git a/codenet/public_test_cases/p03497/output.0.txt b/codenet/public_test_cases/p03497/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03497/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03497/output.1.txt b/codenet/public_test_cases/p03497/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03497/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03497/output.2.txt b/codenet/public_test_cases/p03497/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03497/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03497/output.3.txt b/codenet/public_test_cases/p03497/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03497/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03498/input.0.txt b/codenet/public_test_cases/p03498/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..20d1c1dc5cb33771d34df37c749b2346618d4587 --- /dev/null +++ b/codenet/public_test_cases/p03498/input.0.txt @@ -0,0 +1,2 @@ +3 +-2 5 -1 diff --git a/codenet/public_test_cases/p03498/output.0.txt b/codenet/public_test_cases/p03498/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc68d1023532efd851ea37ea35a60d963b0b0f07 --- /dev/null +++ b/codenet/public_test_cases/p03498/output.0.txt @@ -0,0 +1,3 @@ +2 +2 3 +3 3 diff --git a/codenet/public_test_cases/p03499/input.0.txt b/codenet/public_test_cases/p03499/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a9ba555df6514a934861f4fcc1e43a4f4440b7c --- /dev/null +++ b/codenet/public_test_cases/p03499/input.0.txt @@ -0,0 +1,2 @@ +2 +0 0 diff --git a/codenet/public_test_cases/p03499/input.1.txt b/codenet/public_test_cases/p03499/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a9ba555df6514a934861f4fcc1e43a4f4440b7c --- /dev/null +++ b/codenet/public_test_cases/p03499/input.1.txt @@ -0,0 +1,2 @@ +2 +0 0 diff --git a/codenet/public_test_cases/p03499/input.2.txt b/codenet/public_test_cases/p03499/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac7f7c5800268b1ec8747cba695505dc43353a55 --- /dev/null +++ b/codenet/public_test_cases/p03499/input.2.txt @@ -0,0 +1,2 @@ +31 +0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 2 15 6 12 10 12 16 5 3 20 1 25 20 23 24 23 diff --git a/codenet/public_test_cases/p03499/input.3.txt b/codenet/public_test_cases/p03499/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..15325232991c86717260e7bc6ecadae7c01d7393 --- /dev/null +++ b/codenet/public_test_cases/p03499/input.3.txt @@ -0,0 +1,2 @@ +5 +0 1 1 0 4 diff --git a/codenet/public_test_cases/p03499/output.0.txt b/codenet/public_test_cases/p03499/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03499/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03499/output.1.txt b/codenet/public_test_cases/p03499/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03499/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03499/output.2.txt b/codenet/public_test_cases/p03499/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b5e6a74bd9147eab984f4cff71b583dddc236b1 --- /dev/null +++ b/codenet/public_test_cases/p03499/output.2.txt @@ -0,0 +1 @@ +730395550 diff --git a/codenet/public_test_cases/p03499/output.3.txt b/codenet/public_test_cases/p03499/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f906e1845dc9a277bd1a44cddccef74038e38367 --- /dev/null +++ b/codenet/public_test_cases/p03499/output.3.txt @@ -0,0 +1 @@ +96 diff --git a/codenet/public_test_cases/p03500/input.0.txt b/codenet/public_test_cases/p03500/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..911d4a5690c28c7d601da255a48b80c8c23f4b0d --- /dev/null +++ b/codenet/public_test_cases/p03500/input.0.txt @@ -0,0 +1,2 @@ +2 2 +5 7 diff --git a/codenet/public_test_cases/p03500/input.1.txt b/codenet/public_test_cases/p03500/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e31b762560f4bcd5716a6749d6c0f92f4382d737 --- /dev/null +++ b/codenet/public_test_cases/p03500/input.1.txt @@ -0,0 +1,2 @@ +3 4 +10 13 22 diff --git a/codenet/public_test_cases/p03500/input.2.txt b/codenet/public_test_cases/p03500/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..860cef516cd847c9b79bc7c3c67597370c7acabd --- /dev/null +++ b/codenet/public_test_cases/p03500/input.2.txt @@ -0,0 +1,2 @@ +1 100 +10 diff --git a/codenet/public_test_cases/p03500/input.3.txt b/codenet/public_test_cases/p03500/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..af3226d2404c52eac7c405fa6523d180ef6c7803 --- /dev/null +++ b/codenet/public_test_cases/p03500/input.3.txt @@ -0,0 +1,2 @@ +10 123456789012345678 +228344079825412349 478465001534875275 398048921164061989 329102208281783917 779698519704384319 617456682030809556 561259383338846380 254083246422083141 458181156833851984 502254767369499613 diff --git a/codenet/public_test_cases/p03500/input.4.txt b/codenet/public_test_cases/p03500/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..911d4a5690c28c7d601da255a48b80c8c23f4b0d --- /dev/null +++ b/codenet/public_test_cases/p03500/input.4.txt @@ -0,0 +1,2 @@ +2 2 +5 7 diff --git a/codenet/public_test_cases/p03500/output.0.txt b/codenet/public_test_cases/p03500/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03500/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03500/output.1.txt b/codenet/public_test_cases/p03500/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03500/output.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03500/output.2.txt b/codenet/public_test_cases/p03500/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03500/output.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03500/output.3.txt b/codenet/public_test_cases/p03500/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe98b004fbdec6ab04206008a6ff974efa827ef2 --- /dev/null +++ b/codenet/public_test_cases/p03500/output.3.txt @@ -0,0 +1 @@ +164286011 diff --git a/codenet/public_test_cases/p03500/output.4.txt b/codenet/public_test_cases/p03500/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03500/output.4.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03501/input.0.txt b/codenet/public_test_cases/p03501/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9741825f3404365f3c0361d1bb4b9a059a6a85a --- /dev/null +++ b/codenet/public_test_cases/p03501/input.0.txt @@ -0,0 +1 @@ +7 17 120 diff --git a/codenet/public_test_cases/p03501/output.0.txt b/codenet/public_test_cases/p03501/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..078fa0fe576b141de649b5439c1fbebbb391dff4 --- /dev/null +++ b/codenet/public_test_cases/p03501/output.0.txt @@ -0,0 +1 @@ +119 diff --git a/codenet/public_test_cases/p03502/input.0.txt b/codenet/public_test_cases/p03502/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03502/input.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03502/input.1.txt b/codenet/public_test_cases/p03502/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d667b5e3a43281136f8c4150f765871e0f95ee2 --- /dev/null +++ b/codenet/public_test_cases/p03502/input.1.txt @@ -0,0 +1 @@ +148 diff --git a/codenet/public_test_cases/p03502/input.2.txt b/codenet/public_test_cases/p03502/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1617e842ad9a038ec2d8332c6084300a43cb09d --- /dev/null +++ b/codenet/public_test_cases/p03502/input.2.txt @@ -0,0 +1 @@ +57 diff --git a/codenet/public_test_cases/p03502/input.3.txt b/codenet/public_test_cases/p03502/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03502/input.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03502/output.0.txt b/codenet/public_test_cases/p03502/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03502/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03502/output.1.txt b/codenet/public_test_cases/p03502/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03502/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03502/output.2.txt b/codenet/public_test_cases/p03502/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03502/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03502/output.3.txt b/codenet/public_test_cases/p03502/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03502/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03503/input.0.txt b/codenet/public_test_cases/p03503/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c69a99b514327f698893625e54c3ff221838065b --- /dev/null +++ b/codenet/public_test_cases/p03503/input.0.txt @@ -0,0 +1,3 @@ +1 +1 1 0 1 0 0 0 1 0 1 +3 4 5 6 7 8 9 -2 -3 4 -2 diff --git a/codenet/public_test_cases/p03503/input.1.txt b/codenet/public_test_cases/p03503/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c69a99b514327f698893625e54c3ff221838065b --- /dev/null +++ b/codenet/public_test_cases/p03503/input.1.txt @@ -0,0 +1,3 @@ +1 +1 1 0 1 0 0 0 1 0 1 +3 4 5 6 7 8 9 -2 -3 4 -2 diff --git a/codenet/public_test_cases/p03503/input.2.txt b/codenet/public_test_cases/p03503/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5e881e606de588751853ebd489acf9194f741f7 --- /dev/null +++ b/codenet/public_test_cases/p03503/input.2.txt @@ -0,0 +1,7 @@ +3 +1 1 1 1 1 1 0 0 1 1 +0 1 0 1 1 1 1 0 1 0 +1 0 1 1 0 1 0 1 0 1 +-8 6 -2 -8 -8 4 8 7 -6 2 2 +-9 2 0 1 7 -5 0 -2 -6 5 5 +6 -6 7 -9 6 -5 8 0 -9 -7 -7 diff --git a/codenet/public_test_cases/p03503/input.3.txt b/codenet/public_test_cases/p03503/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9453bb82e63b23c8e63e5c7b456f0ebb6321c8a --- /dev/null +++ b/codenet/public_test_cases/p03503/input.3.txt @@ -0,0 +1,5 @@ +2 +1 1 1 1 1 0 0 0 0 0 +0 0 0 0 0 1 1 1 1 1 +0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 +0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 diff --git a/codenet/public_test_cases/p03503/output.0.txt b/codenet/public_test_cases/p03503/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03503/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03503/output.1.txt b/codenet/public_test_cases/p03503/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03503/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03503/output.2.txt b/codenet/public_test_cases/p03503/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p03503/output.2.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p03503/output.3.txt b/codenet/public_test_cases/p03503/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fbedf693b51d80a9480634ff720815943de9889 --- /dev/null +++ b/codenet/public_test_cases/p03503/output.3.txt @@ -0,0 +1 @@ +-2 diff --git a/codenet/public_test_cases/p03504/input.0.txt b/codenet/public_test_cases/p03504/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b4ed085fdfc8fafcfc86dbe7373ae42eee4e4e1 --- /dev/null +++ b/codenet/public_test_cases/p03504/input.0.txt @@ -0,0 +1,4 @@ +3 2 +1 7 2 +7 8 1 +8 12 1 diff --git a/codenet/public_test_cases/p03504/input.1.txt b/codenet/public_test_cases/p03504/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c16f880ae5f8530f85980b4708731168adc6550 --- /dev/null +++ b/codenet/public_test_cases/p03504/input.1.txt @@ -0,0 +1,10 @@ +9 4 +56 60 4 +33 37 2 +89 90 3 +32 43 1 +67 68 3 +49 51 3 +31 32 3 +70 71 1 +11 12 3 diff --git a/codenet/public_test_cases/p03504/input.2.txt b/codenet/public_test_cases/p03504/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b4ed085fdfc8fafcfc86dbe7373ae42eee4e4e1 --- /dev/null +++ b/codenet/public_test_cases/p03504/input.2.txt @@ -0,0 +1,4 @@ +3 2 +1 7 2 +7 8 1 +8 12 1 diff --git a/codenet/public_test_cases/p03504/input.3.txt b/codenet/public_test_cases/p03504/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d50a81967936568c7ebbd4add37bc3e77976d516 --- /dev/null +++ b/codenet/public_test_cases/p03504/input.3.txt @@ -0,0 +1,4 @@ +3 4 +1 3 2 +3 4 4 +1 4 3 diff --git a/codenet/public_test_cases/p03504/output.0.txt b/codenet/public_test_cases/p03504/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03504/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03504/output.1.txt b/codenet/public_test_cases/p03504/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03504/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03504/output.2.txt b/codenet/public_test_cases/p03504/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03504/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03504/output.3.txt b/codenet/public_test_cases/p03504/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03504/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03505/input.0.txt b/codenet/public_test_cases/p03505/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f6714102b6aa9a1721d8db75950d8d35539ef14 --- /dev/null +++ b/codenet/public_test_cases/p03505/input.0.txt @@ -0,0 +1 @@ +4000 2000 500 diff --git a/codenet/public_test_cases/p03505/input.1.txt b/codenet/public_test_cases/p03505/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9894dd65e4edb8334aee4a1ef7aaf35a5eeae813 --- /dev/null +++ b/codenet/public_test_cases/p03505/input.1.txt @@ -0,0 +1 @@ +4000 500 2000 diff --git a/codenet/public_test_cases/p03505/input.2.txt b/codenet/public_test_cases/p03505/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f6714102b6aa9a1721d8db75950d8d35539ef14 --- /dev/null +++ b/codenet/public_test_cases/p03505/input.2.txt @@ -0,0 +1 @@ +4000 2000 500 diff --git a/codenet/public_test_cases/p03505/input.3.txt b/codenet/public_test_cases/p03505/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4127a6207f47d1798b3d8c04efca6cf931890b4 --- /dev/null +++ b/codenet/public_test_cases/p03505/input.3.txt @@ -0,0 +1 @@ +1000000000000000000 2 1 diff --git a/codenet/public_test_cases/p03505/output.0.txt b/codenet/public_test_cases/p03505/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03505/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03505/output.1.txt b/codenet/public_test_cases/p03505/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03505/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03505/output.2.txt b/codenet/public_test_cases/p03505/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03505/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03505/output.3.txt b/codenet/public_test_cases/p03505/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd288f0cb101f6b748f0c04f7ef8db96645e2187 --- /dev/null +++ b/codenet/public_test_cases/p03505/output.3.txt @@ -0,0 +1 @@ +1999999999999999997 diff --git a/codenet/public_test_cases/p03506/input.0.txt b/codenet/public_test_cases/p03506/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed9d24952cb1e07b0f6e7a40bee70fa01e904ad --- /dev/null +++ b/codenet/public_test_cases/p03506/input.0.txt @@ -0,0 +1,4 @@ +3 3 +5 7 +8 11 +3 9 diff --git a/codenet/public_test_cases/p03506/input.1.txt b/codenet/public_test_cases/p03506/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed9d24952cb1e07b0f6e7a40bee70fa01e904ad --- /dev/null +++ b/codenet/public_test_cases/p03506/input.1.txt @@ -0,0 +1,4 @@ +3 3 +5 7 +8 11 +3 9 diff --git a/codenet/public_test_cases/p03506/input.2.txt b/codenet/public_test_cases/p03506/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bcc37c07e65317b0c1bf5147b1d3f62008ca828 --- /dev/null +++ b/codenet/public_test_cases/p03506/input.2.txt @@ -0,0 +1,3 @@ +100000 2 +1 2 +3 4 diff --git a/codenet/public_test_cases/p03506/output.0.txt b/codenet/public_test_cases/p03506/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b52e52d0a527394fbeea350bb8d1ffc5c1385d05 --- /dev/null +++ b/codenet/public_test_cases/p03506/output.0.txt @@ -0,0 +1,3 @@ +2 +1 +3 diff --git a/codenet/public_test_cases/p03506/output.1.txt b/codenet/public_test_cases/p03506/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b52e52d0a527394fbeea350bb8d1ffc5c1385d05 --- /dev/null +++ b/codenet/public_test_cases/p03506/output.1.txt @@ -0,0 +1,3 @@ +2 +1 +3 diff --git a/codenet/public_test_cases/p03506/output.2.txt b/codenet/public_test_cases/p03506/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p03506/output.2.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p03507/input.0.txt b/codenet/public_test_cases/p03507/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fceb26bc054e691d6345c8e8a7ccb5496e0c6f88 --- /dev/null +++ b/codenet/public_test_cases/p03507/input.0.txt @@ -0,0 +1,3 @@ +2 6 +20 10 +25 15 diff --git a/codenet/public_test_cases/p03507/input.1.txt b/codenet/public_test_cases/p03507/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b491249572c66a969a43606ea598811785798d2a --- /dev/null +++ b/codenet/public_test_cases/p03507/input.1.txt @@ -0,0 +1,2 @@ +1 1000000000 +1000000000000000000 1000000000 diff --git a/codenet/public_test_cases/p03507/input.2.txt b/codenet/public_test_cases/p03507/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fceb26bc054e691d6345c8e8a7ccb5496e0c6f88 --- /dev/null +++ b/codenet/public_test_cases/p03507/input.2.txt @@ -0,0 +1,3 @@ +2 6 +20 10 +25 15 diff --git a/codenet/public_test_cases/p03507/input.3.txt b/codenet/public_test_cases/p03507/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb72c0836163c249cd32210eca23ab40bf0cee91 --- /dev/null +++ b/codenet/public_test_cases/p03507/input.3.txt @@ -0,0 +1,4 @@ +3 9 +10 10 +10 10 +10 10 diff --git a/codenet/public_test_cases/p03507/output.0.txt b/codenet/public_test_cases/p03507/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p03507/output.0.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p03507/output.1.txt b/codenet/public_test_cases/p03507/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a92330e712d125a69a84b863162831f3b882614 --- /dev/null +++ b/codenet/public_test_cases/p03507/output.1.txt @@ -0,0 +1 @@ +1999999999000000000 diff --git a/codenet/public_test_cases/p03507/output.2.txt b/codenet/public_test_cases/p03507/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p03507/output.2.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p03507/output.3.txt b/codenet/public_test_cases/p03507/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03507/output.3.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03508/input.0.txt b/codenet/public_test_cases/p03508/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61f1030688e0cdad0c72651ae4a79beb87fb5c7c --- /dev/null +++ b/codenet/public_test_cases/p03508/input.0.txt @@ -0,0 +1,2 @@ +4 1 +1 3 diff --git a/codenet/public_test_cases/p03508/input.1.txt b/codenet/public_test_cases/p03508/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..61f1030688e0cdad0c72651ae4a79beb87fb5c7c --- /dev/null +++ b/codenet/public_test_cases/p03508/input.1.txt @@ -0,0 +1,2 @@ +4 1 +1 3 diff --git a/codenet/public_test_cases/p03508/input.2.txt b/codenet/public_test_cases/p03508/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a74b3c2309d5dee0e16c0639409cbe4bfd6f1f9e --- /dev/null +++ b/codenet/public_test_cases/p03508/input.2.txt @@ -0,0 +1 @@ +2 0 diff --git a/codenet/public_test_cases/p03508/input.3.txt b/codenet/public_test_cases/p03508/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3402a924278248c0f448cc153414093217922d13 --- /dev/null +++ b/codenet/public_test_cases/p03508/input.3.txt @@ -0,0 +1,7 @@ +9 6 +1 4 +1 8 +2 5 +3 6 +4 8 +5 7 diff --git a/codenet/public_test_cases/p03508/output.0.txt b/codenet/public_test_cases/p03508/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03508/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03508/output.1.txt b/codenet/public_test_cases/p03508/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03508/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03508/output.2.txt b/codenet/public_test_cases/p03508/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03508/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03508/output.3.txt b/codenet/public_test_cases/p03508/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03508/output.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03509/input.0.txt b/codenet/public_test_cases/p03509/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..710d668dae59c1a34a662fb59da3ab8e9ab3bf8f --- /dev/null +++ b/codenet/public_test_cases/p03509/input.0.txt @@ -0,0 +1,5 @@ +4 75 +1 1 +1 1 +1 1 +1 1 diff --git a/codenet/public_test_cases/p03509/input.1.txt b/codenet/public_test_cases/p03509/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..207a59e2ba6071a288bd019cd5479647a31ec611 --- /dev/null +++ b/codenet/public_test_cases/p03509/input.1.txt @@ -0,0 +1,6 @@ +5 60 +6 3 +5 9 +3 4 +7 8 +4 7 diff --git a/codenet/public_test_cases/p03509/input.2.txt b/codenet/public_test_cases/p03509/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..710d668dae59c1a34a662fb59da3ab8e9ab3bf8f --- /dev/null +++ b/codenet/public_test_cases/p03509/input.2.txt @@ -0,0 +1,5 @@ +4 75 +1 1 +1 1 +1 1 +1 1 diff --git a/codenet/public_test_cases/p03509/input.3.txt b/codenet/public_test_cases/p03509/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..84f001e5c5f562f9abff6b8d63db6519cb429031 --- /dev/null +++ b/codenet/public_test_cases/p03509/input.3.txt @@ -0,0 +1,5 @@ +4 75 +1 1 +1 1 +1 1 +100 1 diff --git a/codenet/public_test_cases/p03509/output.0.txt b/codenet/public_test_cases/p03509/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03509/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03509/output.1.txt b/codenet/public_test_cases/p03509/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03509/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03509/output.2.txt b/codenet/public_test_cases/p03509/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03509/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03509/output.3.txt b/codenet/public_test_cases/p03509/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03509/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03510/input.0.txt b/codenet/public_test_cases/p03510/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6017c95758c88e1f1cbdd33c2cad2236e17aa042 --- /dev/null +++ b/codenet/public_test_cases/p03510/input.0.txt @@ -0,0 +1,6 @@ +5 +10 20 +40 50 +60 30 +70 40 +90 10 diff --git a/codenet/public_test_cases/p03510/input.1.txt b/codenet/public_test_cases/p03510/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbb0381cf0a5b107ce7a9be2c3c77acdf4a93f62 --- /dev/null +++ b/codenet/public_test_cases/p03510/input.1.txt @@ -0,0 +1,5 @@ +4 +1 100 +3 200 +999999999999999 150 +1000000000000000 150 diff --git a/codenet/public_test_cases/p03510/input.2.txt b/codenet/public_test_cases/p03510/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b09c1fb9e4b59dbe63f9e97f639cc5366c9da49 --- /dev/null +++ b/codenet/public_test_cases/p03510/input.2.txt @@ -0,0 +1,6 @@ +5 +10 2 +40 5 +60 3 +70 4 +90 1 diff --git a/codenet/public_test_cases/p03510/input.3.txt b/codenet/public_test_cases/p03510/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6017c95758c88e1f1cbdd33c2cad2236e17aa042 --- /dev/null +++ b/codenet/public_test_cases/p03510/input.3.txt @@ -0,0 +1,6 @@ +5 +10 20 +40 50 +60 30 +70 40 +90 10 diff --git a/codenet/public_test_cases/p03510/output.0.txt b/codenet/public_test_cases/p03510/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61f00d8cad3920809f4d992ac3031b3f32e7f10 --- /dev/null +++ b/codenet/public_test_cases/p03510/output.0.txt @@ -0,0 +1 @@ +90 diff --git a/codenet/public_test_cases/p03510/output.1.txt b/codenet/public_test_cases/p03510/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03a5b41d9fe4e87abe23d9efba209933c6d1e30f --- /dev/null +++ b/codenet/public_test_cases/p03510/output.1.txt @@ -0,0 +1 @@ +299 diff --git a/codenet/public_test_cases/p03510/output.2.txt b/codenet/public_test_cases/p03510/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03510/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03510/output.3.txt b/codenet/public_test_cases/p03510/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d61f00d8cad3920809f4d992ac3031b3f32e7f10 --- /dev/null +++ b/codenet/public_test_cases/p03510/output.3.txt @@ -0,0 +1 @@ +90 diff --git a/codenet/public_test_cases/p03511/input.0.txt b/codenet/public_test_cases/p03511/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ec5faf96c57875a4cc7f70bec467886655009ba --- /dev/null +++ b/codenet/public_test_cases/p03511/input.0.txt @@ -0,0 +1,3 @@ +6 +at +code diff --git a/codenet/public_test_cases/p03511/input.1.txt b/codenet/public_test_cases/p03511/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bedb767e4d83246b18a3b5725f976df1a59b39a --- /dev/null +++ b/codenet/public_test_cases/p03511/input.1.txt @@ -0,0 +1,3 @@ +10 +coin +age diff --git a/codenet/public_test_cases/p03511/input.2.txt b/codenet/public_test_cases/p03511/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..52c2726ec96b62acc3b1796592e73355017ae3ef --- /dev/null +++ b/codenet/public_test_cases/p03511/input.2.txt @@ -0,0 +1,3 @@ +8 +coding +festival diff --git a/codenet/public_test_cases/p03511/input.3.txt b/codenet/public_test_cases/p03511/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ec5faf96c57875a4cc7f70bec467886655009ba --- /dev/null +++ b/codenet/public_test_cases/p03511/input.3.txt @@ -0,0 +1,3 @@ +6 +at +code diff --git a/codenet/public_test_cases/p03511/input.4.txt b/codenet/public_test_cases/p03511/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5ecb11b8db7d75e4438b918741c1e97b16def6c --- /dev/null +++ b/codenet/public_test_cases/p03511/input.4.txt @@ -0,0 +1,3 @@ +8 +same +same diff --git a/codenet/public_test_cases/p03511/output.0.txt b/codenet/public_test_cases/p03511/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d78d85841a96936c56142d82884fdd6ed0708e1 --- /dev/null +++ b/codenet/public_test_cases/p03511/output.0.txt @@ -0,0 +1 @@ +atatat diff --git a/codenet/public_test_cases/p03511/output.1.txt b/codenet/public_test_cases/p03511/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..798a698302494d48a25e41cd76c7e31008ef0681 --- /dev/null +++ b/codenet/public_test_cases/p03511/output.1.txt @@ -0,0 +1 @@ +ageagecoin diff --git a/codenet/public_test_cases/p03511/output.2.txt b/codenet/public_test_cases/p03511/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6269d848cb4230d33707cb5d3e2967bfe888cdbd --- /dev/null +++ b/codenet/public_test_cases/p03511/output.2.txt @@ -0,0 +1 @@ +festival diff --git a/codenet/public_test_cases/p03511/output.3.txt b/codenet/public_test_cases/p03511/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d78d85841a96936c56142d82884fdd6ed0708e1 --- /dev/null +++ b/codenet/public_test_cases/p03511/output.3.txt @@ -0,0 +1 @@ +atatat diff --git a/codenet/public_test_cases/p03511/output.4.txt b/codenet/public_test_cases/p03511/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..32f6566a63561b9772561dfaf6f5bf3ef25b3cff --- /dev/null +++ b/codenet/public_test_cases/p03511/output.4.txt @@ -0,0 +1 @@ +samesame diff --git a/codenet/public_test_cases/p03512/input.0.txt b/codenet/public_test_cases/p03512/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d0731ca3c1fe6ccd5a332d1f0cebb41f48def3f --- /dev/null +++ b/codenet/public_test_cases/p03512/input.0.txt @@ -0,0 +1,4 @@ +3 +2 10 +3 -20 +6 15 diff --git a/codenet/public_test_cases/p03512/input.1.txt b/codenet/public_test_cases/p03512/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..992fe92a183385f1be963bfd8b51a6d34083f829 --- /dev/null +++ b/codenet/public_test_cases/p03512/input.1.txt @@ -0,0 +1,4 @@ +3 +10 -3 +50 4 +100 -5 diff --git a/codenet/public_test_cases/p03512/input.2.txt b/codenet/public_test_cases/p03512/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d0731ca3c1fe6ccd5a332d1f0cebb41f48def3f --- /dev/null +++ b/codenet/public_test_cases/p03512/input.2.txt @@ -0,0 +1,4 @@ +3 +2 10 +3 -20 +6 15 diff --git a/codenet/public_test_cases/p03512/input.3.txt b/codenet/public_test_cases/p03512/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..011744587579f7cf73dd06f1083d9ce08d4474be --- /dev/null +++ b/codenet/public_test_cases/p03512/input.3.txt @@ -0,0 +1,6 @@ +5 +56 114834 +72 -149861 +100 190757 +192 -132693 +240 133108 diff --git a/codenet/public_test_cases/p03512/output.0.txt b/codenet/public_test_cases/p03512/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03512/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03512/output.1.txt b/codenet/public_test_cases/p03512/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03512/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03512/output.2.txt b/codenet/public_test_cases/p03512/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03512/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03512/output.3.txt b/codenet/public_test_cases/p03512/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..50092ceb6e25782d664d7f73b0d4ff4d38e49fd3 --- /dev/null +++ b/codenet/public_test_cases/p03512/output.3.txt @@ -0,0 +1 @@ +438699 diff --git a/codenet/public_test_cases/p03513/input.0.txt b/codenet/public_test_cases/p03513/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74f370568812fccd8266f521dcfe97f9dcca7068 --- /dev/null +++ b/codenet/public_test_cases/p03513/input.0.txt @@ -0,0 +1,4 @@ +4 3 +1 3 +2 3 +3 4 diff --git a/codenet/public_test_cases/p03513/input.1.txt b/codenet/public_test_cases/p03513/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c493f0fd7b54ec329cca66552cca00c7d310410d --- /dev/null +++ b/codenet/public_test_cases/p03513/input.1.txt @@ -0,0 +1,6 @@ +5 5 +1 3 +2 4 +3 4 +3 5 +4 5 diff --git a/codenet/public_test_cases/p03513/input.2.txt b/codenet/public_test_cases/p03513/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..599315683914fde4b4132876a4155fcefdb40065 --- /dev/null +++ b/codenet/public_test_cases/p03513/input.2.txt @@ -0,0 +1,7 @@ +6 6 +1 2 +2 3 +3 4 +4 5 +5 6 +1 6 diff --git a/codenet/public_test_cases/p03513/input.3.txt b/codenet/public_test_cases/p03513/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..74f370568812fccd8266f521dcfe97f9dcca7068 --- /dev/null +++ b/codenet/public_test_cases/p03513/input.3.txt @@ -0,0 +1,4 @@ +4 3 +1 3 +2 3 +3 4 diff --git a/codenet/public_test_cases/p03513/output.0.txt b/codenet/public_test_cases/p03513/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03513/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03513/output.1.txt b/codenet/public_test_cases/p03513/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03513/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03513/output.2.txt b/codenet/public_test_cases/p03513/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p03513/output.2.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p03513/output.3.txt b/codenet/public_test_cases/p03513/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03513/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03514/input.0.txt b/codenet/public_test_cases/p03514/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c203fc2d5bcbf4c7aa145becba34b43ecedf2922 --- /dev/null +++ b/codenet/public_test_cases/p03514/input.0.txt @@ -0,0 +1,3 @@ +1 +150000 +108 diff --git a/codenet/public_test_cases/p03514/input.1.txt b/codenet/public_test_cases/p03514/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c203fc2d5bcbf4c7aa145becba34b43ecedf2922 --- /dev/null +++ b/codenet/public_test_cases/p03514/input.1.txt @@ -0,0 +1,3 @@ +1 +150000 +108 diff --git a/codenet/public_test_cases/p03514/input.2.txt b/codenet/public_test_cases/p03514/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cf003eea079b50a9aa0d3c4690afa26bc59aa3a --- /dev/null +++ b/codenet/public_test_cases/p03514/input.2.txt @@ -0,0 +1,5 @@ +2 +50000 +50000 +100000 +100000 diff --git a/codenet/public_test_cases/p03514/output.0.txt b/codenet/public_test_cases/p03514/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..403e007709b8157607659ca7f493f7f6c543c37a --- /dev/null +++ b/codenet/public_test_cases/p03514/output.0.txt @@ -0,0 +1 @@ +150000.0 diff --git a/codenet/public_test_cases/p03514/output.1.txt b/codenet/public_test_cases/p03514/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..403e007709b8157607659ca7f493f7f6c543c37a --- /dev/null +++ b/codenet/public_test_cases/p03514/output.1.txt @@ -0,0 +1 @@ +150000.0 diff --git a/codenet/public_test_cases/p03514/output.2.txt b/codenet/public_test_cases/p03514/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b57b8607d3720dd01f27c1dbf2e987c191763f7 --- /dev/null +++ b/codenet/public_test_cases/p03514/output.2.txt @@ -0,0 +1 @@ +183333.3333333333 diff --git a/codenet/public_test_cases/p03515/input.0.txt b/codenet/public_test_cases/p03515/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5728dac989e2d1a5d65d83207be8ba6fb85a2705 --- /dev/null +++ b/codenet/public_test_cases/p03515/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 10 +2 3 20 diff --git a/codenet/public_test_cases/p03515/input.1.txt b/codenet/public_test_cases/p03515/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdcd39d9b377c14e0f80c2c3b740991bf897612e --- /dev/null +++ b/codenet/public_test_cases/p03515/input.1.txt @@ -0,0 +1,15 @@ +15 +6 3 2 +13 3 1 +1 13 2 +7 1 2 +8 1 1 +2 8 2 +2 12 2 +5 2 2 +2 11 2 +10 2 2 +10 9 1 +9 14 2 +4 14 1 +11 15 2 diff --git a/codenet/public_test_cases/p03515/input.2.txt b/codenet/public_test_cases/p03515/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aced078f2708b39f5de2f04fc739c12baeda4a2e --- /dev/null +++ b/codenet/public_test_cases/p03515/input.2.txt @@ -0,0 +1,19 @@ +19 +19 14 48 +11 19 23 +17 14 30 +7 11 15 +2 19 15 +2 18 21 +19 10 43 +12 11 25 +3 11 4 +5 19 50 +4 11 19 +9 12 29 +14 13 3 +14 6 12 +14 15 14 +5 1 6 +8 18 13 +7 16 14 diff --git a/codenet/public_test_cases/p03515/input.3.txt b/codenet/public_test_cases/p03515/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5728dac989e2d1a5d65d83207be8ba6fb85a2705 --- /dev/null +++ b/codenet/public_test_cases/p03515/input.3.txt @@ -0,0 +1,3 @@ +3 +1 2 10 +2 3 20 diff --git a/codenet/public_test_cases/p03515/output.0.txt b/codenet/public_test_cases/p03515/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de0f597fe17edfa0b193c1d6808ac0e38ae97e2a --- /dev/null +++ b/codenet/public_test_cases/p03515/output.0.txt @@ -0,0 +1,3 @@ +20 +30 +30 diff --git a/codenet/public_test_cases/p03515/output.1.txt b/codenet/public_test_cases/p03515/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b90dc5f87461e14be8887e1befc5512286583897 --- /dev/null +++ b/codenet/public_test_cases/p03515/output.1.txt @@ -0,0 +1,15 @@ +16 +20 +15 +14 +20 +15 +16 +20 +15 +20 +20 +20 +16 +15 +20 diff --git a/codenet/public_test_cases/p03515/output.2.txt b/codenet/public_test_cases/p03515/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea08e4aa14569b62156f1c61188c5a8132d57042 --- /dev/null +++ b/codenet/public_test_cases/p03515/output.2.txt @@ -0,0 +1,19 @@ +103 +237 +71 +263 +370 +193 +231 +207 +299 +358 +295 +299 +54 +368 +220 +220 +319 +237 +370 diff --git a/codenet/public_test_cases/p03515/output.3.txt b/codenet/public_test_cases/p03515/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..de0f597fe17edfa0b193c1d6808ac0e38ae97e2a --- /dev/null +++ b/codenet/public_test_cases/p03515/output.3.txt @@ -0,0 +1,3 @@ +20 +30 +30 diff --git a/codenet/public_test_cases/p03516/input.0.txt b/codenet/public_test_cases/p03516/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..17269c1b73e148a9efefecbb001a4ab23684c054 --- /dev/null +++ b/codenet/public_test_cases/p03516/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 2 3 2 diff --git a/codenet/public_test_cases/p03516/input.1.txt b/codenet/public_test_cases/p03516/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1cf95b947da6b2f4e3c35b608bcfc7018e09162 --- /dev/null +++ b/codenet/public_test_cases/p03516/input.1.txt @@ -0,0 +1,2 @@ +16 +2 1 3 1 2 1 4 1 1 2 1 1 3 2 4 3 diff --git a/codenet/public_test_cases/p03516/input.2.txt b/codenet/public_test_cases/p03516/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..17269c1b73e148a9efefecbb001a4ab23684c054 --- /dev/null +++ b/codenet/public_test_cases/p03516/input.2.txt @@ -0,0 +1,2 @@ +5 +1 2 2 3 2 diff --git a/codenet/public_test_cases/p03516/output.0.txt b/codenet/public_test_cases/p03516/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03516/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03516/output.1.txt b/codenet/public_test_cases/p03516/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..114394f710805a44bbfe021dc98ab1cd0f069654 --- /dev/null +++ b/codenet/public_test_cases/p03516/output.1.txt @@ -0,0 +1 @@ +555275958 diff --git a/codenet/public_test_cases/p03516/output.2.txt b/codenet/public_test_cases/p03516/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03516/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03517/input.0.txt b/codenet/public_test_cases/p03517/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eff71ab09b208b424862fcc7219fcf9e3a262f18 --- /dev/null +++ b/codenet/public_test_cases/p03517/input.0.txt @@ -0,0 +1,5 @@ +4 3 3 +1 0 1 2 +1 2 10 +2 3 20 +2 4 50 diff --git a/codenet/public_test_cases/p03517/input.1.txt b/codenet/public_test_cases/p03517/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eff71ab09b208b424862fcc7219fcf9e3a262f18 --- /dev/null +++ b/codenet/public_test_cases/p03517/input.1.txt @@ -0,0 +1,5 @@ +4 3 3 +1 0 1 2 +1 2 10 +2 3 20 +2 4 50 diff --git a/codenet/public_test_cases/p03517/input.2.txt b/codenet/public_test_cases/p03517/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..70a575b5ccffb0b91e210f6741ccdd771d0d16da --- /dev/null +++ b/codenet/public_test_cases/p03517/input.2.txt @@ -0,0 +1,39 @@ +18 37 12 +5 0 4 10 8 7 2 10 6 0 9 12 12 11 11 11 0 1 +17 1 1 +11 16 7575 +11 15 9 +10 10 289938980 +5 10 17376 +18 4 1866625 +8 11 959154208 +18 13 200 +16 13 2 +2 7 982223 +12 12 9331 +13 12 8861390 +14 13 743 +2 10 162440 +2 4 981849 +7 9 1 +14 17 2800 +2 7 7225452 +3 7 85 +5 17 4 +2 13 1 +10 3 45 +1 15 973 +14 7 56553306 +16 17 70476 +7 18 9 +9 13 27911 +18 14 7788322 +11 11 8925 +9 13 654295 +2 10 9 +10 1 545631016 +3 4 5 +17 12 1929 +2 11 57 +1 5 4 +1 17 7807368 diff --git a/codenet/public_test_cases/p03517/input.3.txt b/codenet/public_test_cases/p03517/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9e5abd7cdec5fc1ca9f0cd05b0ec59ac7c46789 --- /dev/null +++ b/codenet/public_test_cases/p03517/input.3.txt @@ -0,0 +1,14 @@ +9 12 9 +1 2 3 4 5 6 7 8 9 +6 9 9 +8 9 6 +6 7 85 +9 5 545631016 +2 1 321545 +1 6 33562944 +7 3 84946329 +9 7 15926167 +4 7 53386480 +5 8 70476 +4 6 4549 +4 8 8 diff --git a/codenet/public_test_cases/p03517/input.4.txt b/codenet/public_test_cases/p03517/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..46c3961430afaf51253c74d13486667f641eefbf --- /dev/null +++ b/codenet/public_test_cases/p03517/input.4.txt @@ -0,0 +1,4 @@ +5 2 4 +0 0 0 0 0 +1 2 10 +2 3 10 diff --git a/codenet/public_test_cases/p03517/output.0.txt b/codenet/public_test_cases/p03517/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p03517/output.0.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p03517/output.1.txt b/codenet/public_test_cases/p03517/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p03517/output.1.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p03517/output.2.txt b/codenet/public_test_cases/p03517/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b34c321e9c5c5f00062f7a017f75b611e0b4fb4a --- /dev/null +++ b/codenet/public_test_cases/p03517/output.2.txt @@ -0,0 +1 @@ +171 diff --git a/codenet/public_test_cases/p03517/output.3.txt b/codenet/public_test_cases/p03517/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a6c1fa952ac7981606c312bd76cba8656299980 --- /dev/null +++ b/codenet/public_test_cases/p03517/output.3.txt @@ -0,0 +1 @@ +118901402 diff --git a/codenet/public_test_cases/p03517/output.4.txt b/codenet/public_test_cases/p03517/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03517/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03518/input.0.txt b/codenet/public_test_cases/p03518/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76f19b9c1121c6f707a58d59ab73eb0947785ab5 --- /dev/null +++ b/codenet/public_test_cases/p03518/input.0.txt @@ -0,0 +1,2 @@ +5 +4 2 0 1 3 diff --git a/codenet/public_test_cases/p03518/input.1.txt b/codenet/public_test_cases/p03518/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5099ae4b127bed4320a3473ff269a55fff84b417 --- /dev/null +++ b/codenet/public_test_cases/p03518/input.1.txt @@ -0,0 +1,2 @@ +9 +1 0 4 3 5 6 2 8 7 diff --git a/codenet/public_test_cases/p03518/input.2.txt b/codenet/public_test_cases/p03518/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..76f19b9c1121c6f707a58d59ab73eb0947785ab5 --- /dev/null +++ b/codenet/public_test_cases/p03518/input.2.txt @@ -0,0 +1,2 @@ +5 +4 2 0 1 3 diff --git a/codenet/public_test_cases/p03518/output.0.txt b/codenet/public_test_cases/p03518/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb9c9327ee8915396de35ff329b65c83274079bc --- /dev/null +++ b/codenet/public_test_cases/p03518/output.0.txt @@ -0,0 +1,5 @@ +4 +2 +3 +1 +2 diff --git a/codenet/public_test_cases/p03518/output.1.txt b/codenet/public_test_cases/p03518/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9fc5932bf5d1fc71a8ec02f9ada82f6364e1a74 --- /dev/null +++ b/codenet/public_test_cases/p03518/output.1.txt @@ -0,0 +1,12 @@ +11 +3 +6 +1 +3 +5 +2 +4 +7 +8 +6 +3 diff --git a/codenet/public_test_cases/p03518/output.2.txt b/codenet/public_test_cases/p03518/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb9c9327ee8915396de35ff329b65c83274079bc --- /dev/null +++ b/codenet/public_test_cases/p03518/output.2.txt @@ -0,0 +1,5 @@ +4 +2 +3 +1 +2 diff --git a/codenet/public_test_cases/p03519/input.0.txt b/codenet/public_test_cases/p03519/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9ca582e8a66e1a6e10f834a6c4306f21d779659 --- /dev/null +++ b/codenet/public_test_cases/p03519/input.0.txt @@ -0,0 +1,5 @@ +2 2 +1 1 7 3 +4 2 3 3 +2 4 6 +3 2 5 diff --git a/codenet/public_test_cases/p03519/input.1.txt b/codenet/public_test_cases/p03519/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9ca582e8a66e1a6e10f834a6c4306f21d779659 --- /dev/null +++ b/codenet/public_test_cases/p03519/input.1.txt @@ -0,0 +1,5 @@ +2 2 +1 1 7 3 +4 2 3 3 +2 4 6 +3 2 5 diff --git a/codenet/public_test_cases/p03519/input.2.txt b/codenet/public_test_cases/p03519/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce2dd44b18abc47ad41778fb031181a0f7c43473 --- /dev/null +++ b/codenet/public_test_cases/p03519/input.2.txt @@ -0,0 +1,10 @@ +7 7 +34 -20 -27 42 44 29 9 11 20 44 27 19 -31 -29 +46 -50 -11 20 28 46 12 13 33 -22 -48 -27 35 -17 +7 27 34 +12 -2 22 +4 -50 -12 +3 -32 15 +8 -7 23 +3 -30 11 +4 -2 23 diff --git a/codenet/public_test_cases/p03519/output.0.txt b/codenet/public_test_cases/p03519/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2de525e8598cc86ffc221bd5689677d5fc94b7f --- /dev/null +++ b/codenet/public_test_cases/p03519/output.0.txt @@ -0,0 +1,2 @@ +15 +15 diff --git a/codenet/public_test_cases/p03519/output.1.txt b/codenet/public_test_cases/p03519/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2de525e8598cc86ffc221bd5689677d5fc94b7f --- /dev/null +++ b/codenet/public_test_cases/p03519/output.1.txt @@ -0,0 +1,2 @@ +15 +15 diff --git a/codenet/public_test_cases/p03519/output.2.txt b/codenet/public_test_cases/p03519/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ebf23be92134abdad07567515e830798eb41653 --- /dev/null +++ b/codenet/public_test_cases/p03519/output.2.txt @@ -0,0 +1,7 @@ +311 +312 +260 +286 +296 +292 +327 diff --git a/codenet/public_test_cases/p03520/input.0.txt b/codenet/public_test_cases/p03520/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc17309e03ab880bd9f2bc669fad6165c01a963f --- /dev/null +++ b/codenet/public_test_cases/p03520/input.0.txt @@ -0,0 +1,5 @@ +4 +1 2 +2 3 +3 4 +8 6 6 8 diff --git a/codenet/public_test_cases/p03520/input.1.txt b/codenet/public_test_cases/p03520/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc17309e03ab880bd9f2bc669fad6165c01a963f --- /dev/null +++ b/codenet/public_test_cases/p03520/input.1.txt @@ -0,0 +1,5 @@ +4 +1 2 +2 3 +3 4 +8 6 6 8 diff --git a/codenet/public_test_cases/p03520/input.2.txt b/codenet/public_test_cases/p03520/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6808d49841e7848e2e6172e6581893269e3bcdb2 --- /dev/null +++ b/codenet/public_test_cases/p03520/input.2.txt @@ -0,0 +1,16 @@ +15 +9 10 +9 15 +15 4 +4 13 +13 2 +13 11 +2 14 +13 6 +11 1 +1 12 +12 3 +12 7 +2 5 +14 8 +1154 890 2240 883 2047 2076 1590 1104 1726 1791 1091 1226 841 1000 901 diff --git a/codenet/public_test_cases/p03520/input.3.txt b/codenet/public_test_cases/p03520/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6c217f8e3b77b083b71d9495a5bc1764989028a --- /dev/null +++ b/codenet/public_test_cases/p03520/input.3.txt @@ -0,0 +1,6 @@ +5 +1 2 +1 3 +1 4 +1 5 +10 13 16 19 22 diff --git a/codenet/public_test_cases/p03520/output.0.txt b/codenet/public_test_cases/p03520/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e13c5bfaa64f706a467fbfed13e3c609dc07a95e --- /dev/null +++ b/codenet/public_test_cases/p03520/output.0.txt @@ -0,0 +1,3 @@ +1 +2 +1 diff --git a/codenet/public_test_cases/p03520/output.1.txt b/codenet/public_test_cases/p03520/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e13c5bfaa64f706a467fbfed13e3c609dc07a95e --- /dev/null +++ b/codenet/public_test_cases/p03520/output.1.txt @@ -0,0 +1,3 @@ +1 +2 +1 diff --git a/codenet/public_test_cases/p03520/output.2.txt b/codenet/public_test_cases/p03520/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..44cac8f822297058a9eefec62e7226a85a6105a9 --- /dev/null +++ b/codenet/public_test_cases/p03520/output.2.txt @@ -0,0 +1,14 @@ +5 +75 +2 +6 +7 +50 +10 +95 +9 +8 +78 +28 +89 +8 diff --git a/codenet/public_test_cases/p03520/output.3.txt b/codenet/public_test_cases/p03520/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..94ebaf900161394059478fd88aec30e59092a1d7 --- /dev/null +++ b/codenet/public_test_cases/p03520/output.3.txt @@ -0,0 +1,4 @@ +1 +2 +3 +4 diff --git a/codenet/public_test_cases/p03521/input.0.txt b/codenet/public_test_cases/p03521/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ddda174dd5e1026d745abfdcfe61a3b55b47df9 --- /dev/null +++ b/codenet/public_test_cases/p03521/input.0.txt @@ -0,0 +1,4 @@ +4 +1 +2 +3 diff --git a/codenet/public_test_cases/p03521/input.1.txt b/codenet/public_test_cases/p03521/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ddda174dd5e1026d745abfdcfe61a3b55b47df9 --- /dev/null +++ b/codenet/public_test_cases/p03521/input.1.txt @@ -0,0 +1,4 @@ +4 +1 +2 +3 diff --git a/codenet/public_test_cases/p03521/input.2.txt b/codenet/public_test_cases/p03521/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..75ecbffa90d621c30ef75df6ceefd48db73796fc --- /dev/null +++ b/codenet/public_test_cases/p03521/input.2.txt @@ -0,0 +1,15 @@ +15 +1 +2 +3 +1 +4 +2 +7 +1 +8 +2 +8 +1 +8 +2 diff --git a/codenet/public_test_cases/p03521/input.3.txt b/codenet/public_test_cases/p03521/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0571a2e15a712887514f5eabbbe731a4b1b70672 --- /dev/null +++ b/codenet/public_test_cases/p03521/input.3.txt @@ -0,0 +1,3 @@ +3 +1 +2 diff --git a/codenet/public_test_cases/p03521/input.4.txt b/codenet/public_test_cases/p03521/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..64eb98e01950ec244ef7c2ed00aae375286da9fc --- /dev/null +++ b/codenet/public_test_cases/p03521/input.4.txt @@ -0,0 +1,5 @@ +5 +1 +1 +3 +3 diff --git a/codenet/public_test_cases/p03521/output.0.txt b/codenet/public_test_cases/p03521/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03521/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03521/output.1.txt b/codenet/public_test_cases/p03521/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03521/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03521/output.2.txt b/codenet/public_test_cases/p03521/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..79222e578d1b2e977eb4dede36af36c97efee3e7 --- /dev/null +++ b/codenet/public_test_cases/p03521/output.2.txt @@ -0,0 +1 @@ +97193524 diff --git a/codenet/public_test_cases/p03521/output.3.txt b/codenet/public_test_cases/p03521/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03521/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03521/output.4.txt b/codenet/public_test_cases/p03521/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03521/output.4.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03522/input.0.txt b/codenet/public_test_cases/p03522/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9c78ddc7d5fe4c96e42bf17a8f52e9bce9b9405 --- /dev/null +++ b/codenet/public_test_cases/p03522/input.0.txt @@ -0,0 +1,6 @@ +5 +4 +1 +8 +8 +7 diff --git a/codenet/public_test_cases/p03522/input.1.txt b/codenet/public_test_cases/p03522/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..41d4c1d8eb05a6a1d01049b22cd28de28909cb56 --- /dev/null +++ b/codenet/public_test_cases/p03522/input.1.txt @@ -0,0 +1,21 @@ +20 +8 +2 +9 +7 +4 +6 +7 +9 +7 +4 +7 +4 +4 +3 +6 +2 +3 +4 +4 +9 diff --git a/codenet/public_test_cases/p03522/input.2.txt b/codenet/public_test_cases/p03522/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f9c78ddc7d5fe4c96e42bf17a8f52e9bce9b9405 --- /dev/null +++ b/codenet/public_test_cases/p03522/input.2.txt @@ -0,0 +1,6 @@ +5 +4 +1 +8 +8 +7 diff --git a/codenet/public_test_cases/p03522/output.0.txt b/codenet/public_test_cases/p03522/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03522/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03522/output.1.txt b/codenet/public_test_cases/p03522/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8fa06e1be7da01425d2be19da24595de2fa02c2 --- /dev/null +++ b/codenet/public_test_cases/p03522/output.1.txt @@ -0,0 +1 @@ +62 diff --git a/codenet/public_test_cases/p03522/output.2.txt b/codenet/public_test_cases/p03522/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03522/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03523/input.0.txt b/codenet/public_test_cases/p03523/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd1ba0ef412fe717e0a1e7edf982e09973beff4 --- /dev/null +++ b/codenet/public_test_cases/p03523/input.0.txt @@ -0,0 +1 @@ +KIHBR diff --git a/codenet/public_test_cases/p03523/input.1.txt b/codenet/public_test_cases/p03523/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6ae4b40d0f95f7599e91f91cc5b0dd9499f4b06 --- /dev/null +++ b/codenet/public_test_cases/p03523/input.1.txt @@ -0,0 +1 @@ +AKIBAHARA diff --git a/codenet/public_test_cases/p03523/input.2.txt b/codenet/public_test_cases/p03523/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd1ba0ef412fe717e0a1e7edf982e09973beff4 --- /dev/null +++ b/codenet/public_test_cases/p03523/input.2.txt @@ -0,0 +1 @@ +KIHBR diff --git a/codenet/public_test_cases/p03523/input.3.txt b/codenet/public_test_cases/p03523/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e11cbe157f8ce8878db5c9c00607353bde1cc9a8 --- /dev/null +++ b/codenet/public_test_cases/p03523/input.3.txt @@ -0,0 +1 @@ +AAKIAHBAARA diff --git a/codenet/public_test_cases/p03523/output.0.txt b/codenet/public_test_cases/p03523/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03523/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03523/output.1.txt b/codenet/public_test_cases/p03523/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03523/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03523/output.2.txt b/codenet/public_test_cases/p03523/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03523/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03523/output.3.txt b/codenet/public_test_cases/p03523/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03523/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03524/input.0.txt b/codenet/public_test_cases/p03524/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54c125dfc6659ff8228cfc17d1e5d026598d0b85 --- /dev/null +++ b/codenet/public_test_cases/p03524/input.0.txt @@ -0,0 +1 @@ +abac diff --git a/codenet/public_test_cases/p03524/output.0.txt b/codenet/public_test_cases/p03524/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03524/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03525/input.0.txt b/codenet/public_test_cases/p03525/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74374010e99818ed82d5fa905c10f9835d89248d --- /dev/null +++ b/codenet/public_test_cases/p03525/input.0.txt @@ -0,0 +1,2 @@ +3 +7 12 8 diff --git a/codenet/public_test_cases/p03525/output.0.txt b/codenet/public_test_cases/p03525/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03525/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03526/input.0.txt b/codenet/public_test_cases/p03526/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..205aa8e6d9f6fee94354e4e57355a24a9f185ccf --- /dev/null +++ b/codenet/public_test_cases/p03526/input.0.txt @@ -0,0 +1,4 @@ +3 +0 2 +1 3 +3 4 diff --git a/codenet/public_test_cases/p03526/input.1.txt b/codenet/public_test_cases/p03526/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a91dd2989eccee9a9bcfb82d7c695629a4d9596d --- /dev/null +++ b/codenet/public_test_cases/p03526/input.1.txt @@ -0,0 +1,4 @@ +3 +2 4 +3 1 +4 1 diff --git a/codenet/public_test_cases/p03526/input.2.txt b/codenet/public_test_cases/p03526/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00a02cf51af3f231386e27fbf7e22ba7aab2d93c --- /dev/null +++ b/codenet/public_test_cases/p03526/input.2.txt @@ -0,0 +1,11 @@ +10 +1 3 +8 4 +8 3 +9 1 +6 4 +2 3 +4 2 +9 2 +8 3 +0 1 diff --git a/codenet/public_test_cases/p03526/input.3.txt b/codenet/public_test_cases/p03526/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..205aa8e6d9f6fee94354e4e57355a24a9f185ccf --- /dev/null +++ b/codenet/public_test_cases/p03526/input.3.txt @@ -0,0 +1,4 @@ +3 +0 2 +1 3 +3 4 diff --git a/codenet/public_test_cases/p03526/output.0.txt b/codenet/public_test_cases/p03526/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03526/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03526/output.1.txt b/codenet/public_test_cases/p03526/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03526/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03526/output.2.txt b/codenet/public_test_cases/p03526/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03526/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03526/output.3.txt b/codenet/public_test_cases/p03526/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03526/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03527/input.0.txt b/codenet/public_test_cases/p03527/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c38531df690dbc69e7ebf4809ef264b4ed269212 --- /dev/null +++ b/codenet/public_test_cases/p03527/input.0.txt @@ -0,0 +1,4 @@ +bixzja +2 +2 3 +3 6 diff --git a/codenet/public_test_cases/p03527/output.0.txt b/codenet/public_test_cases/p03527/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03527/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03529/input.0.txt b/codenet/public_test_cases/p03529/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03529/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03529/input.1.txt b/codenet/public_test_cases/p03529/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..484ac97d06c09604060ad60b3f216bf7724bbc0f --- /dev/null +++ b/codenet/public_test_cases/p03529/input.1.txt @@ -0,0 +1 @@ +20 17 diff --git a/codenet/public_test_cases/p03529/input.2.txt b/codenet/public_test_cases/p03529/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03529/input.2.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03529/output.0.txt b/codenet/public_test_cases/p03529/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03529/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03529/output.1.txt b/codenet/public_test_cases/p03529/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8312820b968a9e72a863071add3eec5e8742f3a3 --- /dev/null +++ b/codenet/public_test_cases/p03529/output.1.txt @@ -0,0 +1 @@ +983853488 diff --git a/codenet/public_test_cases/p03529/output.2.txt b/codenet/public_test_cases/p03529/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03529/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03530/input.0.txt b/codenet/public_test_cases/p03530/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9d5d0225822c890dec663f97fde4f2ca853c10a --- /dev/null +++ b/codenet/public_test_cases/p03530/input.0.txt @@ -0,0 +1,4 @@ +3 3 ++#+ +#P# ++#+ diff --git a/codenet/public_test_cases/p03530/input.1.txt b/codenet/public_test_cases/p03530/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9d5d0225822c890dec663f97fde4f2ca853c10a --- /dev/null +++ b/codenet/public_test_cases/p03530/input.1.txt @@ -0,0 +1,4 @@ +3 3 ++#+ +#P# ++#+ diff --git a/codenet/public_test_cases/p03530/input.2.txt b/codenet/public_test_cases/p03530/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..545202ea75b8f8c02a991e10f17bda1544724dab --- /dev/null +++ b/codenet/public_test_cases/p03530/input.2.txt @@ -0,0 +1,41 @@ +40 40 +++#+++++#+#+#+##+++++++##+#+++#++##++## ++##++++++++++#+###+##++++#+++++++++#++## ++++#+++++#++#++####+++#+#+###+++##+++#++ ++++#+######++##+#+##+#+++#+++++++++#++#+ ++++##+#+#++#+++#++++##+++++++++#++#+#+#+ +++#+++#+#++++##+#+#+++##+#+##+#++++##++ +++#+##+++#++####+#++##++#+++#+#+#++++#++ ++#+###++++++##++++++#++##+#####++#++##++ ++##+#+++#+#+##++#+###+######++++#+###+ ++++#+++##+#####+#+#++++#+#+++++#+##++##+ ++++#+##+++++++#++#++++++++++###+#++#+#+ ++++##++#+++++#++++#++#+##++#+#+#++##+# ++++#+###+++++##++#+#+++####+#+++++#+++ ++++#++#++#+++++++++#++###++++++++###+##+ +++#+++#++++++#####++##++#+++#+++++#++++# +++#++#+##++++#####+###+++####+#+#+###### +++++++##+++++##+++++#++###++#++##+++++++ ++#++++##++++++#++++#+#++++#++++##+++##+# ++++++++#+#++##+##+#+++++++###+###++##+++ +++++++#++###+#+#+++##+#++++++#++#+#++#+# ++##++++++#+++++#++#+#++##+++#+#+++##+# ++++#+#+##+#+##++#P#++#++++++##++#+#++## ++++#++##+##+#++++#++#++##++++++#+#+#+++ +++++####+#++#####+++#+###+#++###++++#++# ++#++####++##++#+#+#+##+#+#+##++++##++#+ ++###+###+#+##+++#++++++#+#++++###+#+++++ ++++#+++++#+++#+++++##++++++++###++#+#+++ ++#+#++#+#++++++###+#++##+#+##+##+#+##### +++++++++#+#+###+######++#++#+++++++++++ ++++##+#+#++#++#++#++++++#++##+#+#++### ++#+#+#+++++++#+++++++######+##++#++##+## +++#+++#+###+#++###+++#+++#+#++++#+###+++ ++#+###++#+#####+++++#+####++#++#+###+++ ++#+##+#++#++##+++++++######++#++++++++++ ++####+#+#+++++##+#+#++#+#++#+++##++++#+# +++##++#+#+++++##+#++++####+++++###+#+#+ ++#++#++#+##+#+#++##++###+###+#+++++##+ +++###+###+#+#++#++#########+++###+#+## ++++#+++#++++++++++#+#+++#++#++###+####+# +++##+###+++++++##+++++#++#++++++++++++++ diff --git a/codenet/public_test_cases/p03530/input.3.txt b/codenet/public_test_cases/p03530/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..38d1eefac98dcecc951518fa4f7382c60532b493 --- /dev/null +++ b/codenet/public_test_cases/p03530/input.3.txt @@ -0,0 +1,7 @@ +6 6 ++++++ ++++#++ ++++++ ++++P+# ++##+++ +++++#+ diff --git a/codenet/public_test_cases/p03530/input.4.txt b/codenet/public_test_cases/p03530/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf2fb9fc4d9e78266eeecb644cfaf0c680f039f2 --- /dev/null +++ b/codenet/public_test_cases/p03530/input.4.txt @@ -0,0 +1,4 @@ +3 3 ++#+ +P# ++#+ diff --git a/codenet/public_test_cases/p03530/input.5.txt b/codenet/public_test_cases/p03530/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..64728ad0f41a0a75b03863329ad8cfcd07666d4b --- /dev/null +++ b/codenet/public_test_cases/p03530/input.5.txt @@ -0,0 +1,2 @@ +1 1 +P diff --git a/codenet/public_test_cases/p03530/output.0.txt b/codenet/public_test_cases/p03530/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03530/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03530/output.1.txt b/codenet/public_test_cases/p03530/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03530/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03530/output.2.txt b/codenet/public_test_cases/p03530/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b9cba4ae554a6be2a83e312864d17476f13431a --- /dev/null +++ b/codenet/public_test_cases/p03530/output.2.txt @@ -0,0 +1 @@ +151 diff --git a/codenet/public_test_cases/p03530/output.3.txt b/codenet/public_test_cases/p03530/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03530/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03530/output.4.txt b/codenet/public_test_cases/p03530/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03530/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03530/output.5.txt b/codenet/public_test_cases/p03530/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03530/output.5.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03531/input.0.txt b/codenet/public_test_cases/p03531/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c8e60dbf0b4bb05f452c426ddc5fc38e4cc5c3b --- /dev/null +++ b/codenet/public_test_cases/p03531/input.0.txt @@ -0,0 +1,2 @@ +3 +0 3 0 6 0 0 0 8 diff --git a/codenet/public_test_cases/p03531/input.1.txt b/codenet/public_test_cases/p03531/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bdc75bb7ccd0ce3d6e496a8cee296717eaa8448 --- /dev/null +++ b/codenet/public_test_cases/p03531/input.1.txt @@ -0,0 +1,2 @@ +1 +2 1 diff --git a/codenet/public_test_cases/p03531/input.2.txt b/codenet/public_test_cases/p03531/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c8e60dbf0b4bb05f452c426ddc5fc38e4cc5c3b --- /dev/null +++ b/codenet/public_test_cases/p03531/input.2.txt @@ -0,0 +1,2 @@ +3 +0 3 0 6 0 0 0 8 diff --git a/codenet/public_test_cases/p03531/output.0.txt b/codenet/public_test_cases/p03531/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7e47ea5eee5805b5f26c80c36dc067d05d353de --- /dev/null +++ b/codenet/public_test_cases/p03531/output.0.txt @@ -0,0 +1,2 @@ +YES +3 4 8 6 2 1 7 5 diff --git a/codenet/public_test_cases/p03531/output.1.txt b/codenet/public_test_cases/p03531/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03531/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03531/output.2.txt b/codenet/public_test_cases/p03531/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7e47ea5eee5805b5f26c80c36dc067d05d353de --- /dev/null +++ b/codenet/public_test_cases/p03531/output.2.txt @@ -0,0 +1,2 @@ +YES +3 4 8 6 2 1 7 5 diff --git a/codenet/public_test_cases/p03532/input.0.txt b/codenet/public_test_cases/p03532/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e3b48f72e3a66198273aec01f34d32dfa338591 --- /dev/null +++ b/codenet/public_test_cases/p03532/input.0.txt @@ -0,0 +1,5 @@ +4 +1 3 5 1 +1 2 1 +2 3 2 +3 4 3 diff --git a/codenet/public_test_cases/p03532/input.1.txt b/codenet/public_test_cases/p03532/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e3b48f72e3a66198273aec01f34d32dfa338591 --- /dev/null +++ b/codenet/public_test_cases/p03532/input.1.txt @@ -0,0 +1,5 @@ +4 +1 3 5 1 +1 2 1 +2 3 2 +3 4 3 diff --git a/codenet/public_test_cases/p03532/input.2.txt b/codenet/public_test_cases/p03532/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..baa4e18d2169e5bd91b4ba98439963e8a0714b4d --- /dev/null +++ b/codenet/public_test_cases/p03532/input.2.txt @@ -0,0 +1,7 @@ +6 +44 23 31 29 32 15 +1 2 10 +1 3 12 +1 4 16 +4 5 8 +4 6 15 diff --git a/codenet/public_test_cases/p03532/input.3.txt b/codenet/public_test_cases/p03532/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a51265326ba97b54e9ffc74260be46c29eb6352 --- /dev/null +++ b/codenet/public_test_cases/p03532/input.3.txt @@ -0,0 +1,3 @@ +2 +1000000000 1000000000 +2 1 1000000000 diff --git a/codenet/public_test_cases/p03532/output.0.txt b/codenet/public_test_cases/p03532/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03532/output.0.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03532/output.1.txt b/codenet/public_test_cases/p03532/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03532/output.1.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03532/output.2.txt b/codenet/public_test_cases/p03532/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf7ff50f7096c769562fad5129339959761946c2 --- /dev/null +++ b/codenet/public_test_cases/p03532/output.2.txt @@ -0,0 +1 @@ +359 diff --git a/codenet/public_test_cases/p03532/output.3.txt b/codenet/public_test_cases/p03532/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1911b6e1e0b6ba372db173e7dcb15d7f609827d2 --- /dev/null +++ b/codenet/public_test_cases/p03532/output.3.txt @@ -0,0 +1 @@ +3000000000 diff --git a/codenet/public_test_cases/p03533/input.0.txt b/codenet/public_test_cases/p03533/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fd1ba0ef412fe717e0a1e7edf982e09973beff4 --- /dev/null +++ b/codenet/public_test_cases/p03533/input.0.txt @@ -0,0 +1 @@ +KIHBR diff --git a/codenet/public_test_cases/p03533/output.0.txt b/codenet/public_test_cases/p03533/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03533/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03534/input.0.txt b/codenet/public_test_cases/p03534/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54c125dfc6659ff8228cfc17d1e5d026598d0b85 --- /dev/null +++ b/codenet/public_test_cases/p03534/input.0.txt @@ -0,0 +1 @@ +abac diff --git a/codenet/public_test_cases/p03534/input.1.txt b/codenet/public_test_cases/p03534/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9265f8251cfab3529825e5c708c15c55801bed5 --- /dev/null +++ b/codenet/public_test_cases/p03534/input.1.txt @@ -0,0 +1 @@ +aba diff --git a/codenet/public_test_cases/p03534/input.2.txt b/codenet/public_test_cases/p03534/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..54c125dfc6659ff8228cfc17d1e5d026598d0b85 --- /dev/null +++ b/codenet/public_test_cases/p03534/input.2.txt @@ -0,0 +1 @@ +abac diff --git a/codenet/public_test_cases/p03534/input.3.txt b/codenet/public_test_cases/p03534/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9796b69f56e9e4f35abe49ce7cc5cc9bbbb71c80 --- /dev/null +++ b/codenet/public_test_cases/p03534/input.3.txt @@ -0,0 +1 @@ +babacccabab diff --git a/codenet/public_test_cases/p03534/output.0.txt b/codenet/public_test_cases/p03534/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03534/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03534/output.1.txt b/codenet/public_test_cases/p03534/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03534/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03534/output.2.txt b/codenet/public_test_cases/p03534/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03534/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03534/output.3.txt b/codenet/public_test_cases/p03534/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03534/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03535/input.0.txt b/codenet/public_test_cases/p03535/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74374010e99818ed82d5fa905c10f9835d89248d --- /dev/null +++ b/codenet/public_test_cases/p03535/input.0.txt @@ -0,0 +1,2 @@ +3 +7 12 8 diff --git a/codenet/public_test_cases/p03535/input.1.txt b/codenet/public_test_cases/p03535/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29a40133fb1a10cfca50f70519e1af98b013dd34 --- /dev/null +++ b/codenet/public_test_cases/p03535/input.1.txt @@ -0,0 +1,2 @@ +2 +11 11 diff --git a/codenet/public_test_cases/p03535/input.2.txt b/codenet/public_test_cases/p03535/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74374010e99818ed82d5fa905c10f9835d89248d --- /dev/null +++ b/codenet/public_test_cases/p03535/input.2.txt @@ -0,0 +1,2 @@ +3 +7 12 8 diff --git a/codenet/public_test_cases/p03535/input.3.txt b/codenet/public_test_cases/p03535/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b261da18d51a39dc2cf0d156791e9c0b35dd83f4 --- /dev/null +++ b/codenet/public_test_cases/p03535/input.3.txt @@ -0,0 +1,2 @@ +1 +0 diff --git a/codenet/public_test_cases/p03535/output.0.txt b/codenet/public_test_cases/p03535/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03535/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03535/output.1.txt b/codenet/public_test_cases/p03535/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03535/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03535/output.2.txt b/codenet/public_test_cases/p03535/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03535/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03535/output.3.txt b/codenet/public_test_cases/p03535/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03535/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03536/input.0.txt b/codenet/public_test_cases/p03536/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..205aa8e6d9f6fee94354e4e57355a24a9f185ccf --- /dev/null +++ b/codenet/public_test_cases/p03536/input.0.txt @@ -0,0 +1,4 @@ +3 +0 2 +1 3 +3 4 diff --git a/codenet/public_test_cases/p03536/output.0.txt b/codenet/public_test_cases/p03536/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03536/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03537/input.0.txt b/codenet/public_test_cases/p03537/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c38531df690dbc69e7ebf4809ef264b4ed269212 --- /dev/null +++ b/codenet/public_test_cases/p03537/input.0.txt @@ -0,0 +1,4 @@ +bixzja +2 +2 3 +3 6 diff --git a/codenet/public_test_cases/p03537/input.1.txt b/codenet/public_test_cases/p03537/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c38531df690dbc69e7ebf4809ef264b4ed269212 --- /dev/null +++ b/codenet/public_test_cases/p03537/input.1.txt @@ -0,0 +1,4 @@ +bixzja +2 +2 3 +3 6 diff --git a/codenet/public_test_cases/p03537/input.2.txt b/codenet/public_test_cases/p03537/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..01bfdecd44aff92015c9cc2eb03fbad9dc01d279 --- /dev/null +++ b/codenet/public_test_cases/p03537/input.2.txt @@ -0,0 +1,3 @@ +abc +1 +2 2 diff --git a/codenet/public_test_cases/p03537/input.3.txt b/codenet/public_test_cases/p03537/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b37183035bb583fd4dec438d87b65443d21df0a --- /dev/null +++ b/codenet/public_test_cases/p03537/input.3.txt @@ -0,0 +1,6 @@ +cassert +4 +1 2 +3 4 +1 1 +2 2 diff --git a/codenet/public_test_cases/p03537/output.0.txt b/codenet/public_test_cases/p03537/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03537/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03537/output.1.txt b/codenet/public_test_cases/p03537/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03537/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03537/output.2.txt b/codenet/public_test_cases/p03537/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03537/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03537/output.3.txt b/codenet/public_test_cases/p03537/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03537/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03539/input.0.txt b/codenet/public_test_cases/p03539/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03539/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03539/output.0.txt b/codenet/public_test_cases/p03539/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03539/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03540/input.0.txt b/codenet/public_test_cases/p03540/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9d5d0225822c890dec663f97fde4f2ca853c10a --- /dev/null +++ b/codenet/public_test_cases/p03540/input.0.txt @@ -0,0 +1,4 @@ +3 3 ++#+ +#P# ++#+ diff --git a/codenet/public_test_cases/p03540/output.0.txt b/codenet/public_test_cases/p03540/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03540/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03541/input.0.txt b/codenet/public_test_cases/p03541/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c8e60dbf0b4bb05f452c426ddc5fc38e4cc5c3b --- /dev/null +++ b/codenet/public_test_cases/p03541/input.0.txt @@ -0,0 +1,2 @@ +3 +0 3 0 6 0 0 0 8 diff --git a/codenet/public_test_cases/p03541/output.0.txt b/codenet/public_test_cases/p03541/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7e47ea5eee5805b5f26c80c36dc067d05d353de --- /dev/null +++ b/codenet/public_test_cases/p03541/output.0.txt @@ -0,0 +1,2 @@ +YES +3 4 8 6 2 1 7 5 diff --git a/codenet/public_test_cases/p03542/input.0.txt b/codenet/public_test_cases/p03542/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e3b48f72e3a66198273aec01f34d32dfa338591 --- /dev/null +++ b/codenet/public_test_cases/p03542/input.0.txt @@ -0,0 +1,5 @@ +4 +1 3 5 1 +1 2 1 +2 3 2 +3 4 3 diff --git a/codenet/public_test_cases/p03542/output.0.txt b/codenet/public_test_cases/p03542/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03542/output.0.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03543/input.0.txt b/codenet/public_test_cases/p03543/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..79e6287b6aa1b0ed4bd31257e0eba6be3f4053ba --- /dev/null +++ b/codenet/public_test_cases/p03543/input.0.txt @@ -0,0 +1 @@ +1118 diff --git a/codenet/public_test_cases/p03543/input.1.txt b/codenet/public_test_cases/p03543/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0c6b7a659ba4a341868127982f1070d46964755 --- /dev/null +++ b/codenet/public_test_cases/p03543/input.1.txt @@ -0,0 +1 @@ +7777 diff --git a/codenet/public_test_cases/p03543/input.2.txt b/codenet/public_test_cases/p03543/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..79e6287b6aa1b0ed4bd31257e0eba6be3f4053ba --- /dev/null +++ b/codenet/public_test_cases/p03543/input.2.txt @@ -0,0 +1 @@ +1118 diff --git a/codenet/public_test_cases/p03543/input.3.txt b/codenet/public_test_cases/p03543/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..81c545efebe5f57d4cab2ba9ec294c4b0cadf672 --- /dev/null +++ b/codenet/public_test_cases/p03543/input.3.txt @@ -0,0 +1 @@ +1234 diff --git a/codenet/public_test_cases/p03543/output.0.txt b/codenet/public_test_cases/p03543/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03543/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03543/output.1.txt b/codenet/public_test_cases/p03543/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03543/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03543/output.2.txt b/codenet/public_test_cases/p03543/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03543/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03543/output.3.txt b/codenet/public_test_cases/p03543/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03543/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03544/input.0.txt b/codenet/public_test_cases/p03544/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03544/input.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03544/input.1.txt b/codenet/public_test_cases/p03544/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03544/input.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03544/input.2.txt b/codenet/public_test_cases/p03544/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cf5c1a22a22b47ef790873cb9fdbd475460e6c3 --- /dev/null +++ b/codenet/public_test_cases/p03544/input.2.txt @@ -0,0 +1 @@ +86 diff --git a/codenet/public_test_cases/p03544/output.0.txt b/codenet/public_test_cases/p03544/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03544/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03544/output.1.txt b/codenet/public_test_cases/p03544/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03544/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03544/output.2.txt b/codenet/public_test_cases/p03544/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ef4fe0eb168474233d454f572700e7c8b04928a --- /dev/null +++ b/codenet/public_test_cases/p03544/output.2.txt @@ -0,0 +1 @@ +939587134549734843 diff --git a/codenet/public_test_cases/p03545/input.0.txt b/codenet/public_test_cases/p03545/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d63033fa51d4833e6c07e9836674f1e25ce95e2 --- /dev/null +++ b/codenet/public_test_cases/p03545/input.0.txt @@ -0,0 +1 @@ +1222 diff --git a/codenet/public_test_cases/p03545/input.1.txt b/codenet/public_test_cases/p03545/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d63033fa51d4833e6c07e9836674f1e25ce95e2 --- /dev/null +++ b/codenet/public_test_cases/p03545/input.1.txt @@ -0,0 +1 @@ +1222 diff --git a/codenet/public_test_cases/p03545/input.2.txt b/codenet/public_test_cases/p03545/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..095d2cc22ad08c4a81658cd5fbe6d99d8f5e7e45 --- /dev/null +++ b/codenet/public_test_cases/p03545/input.2.txt @@ -0,0 +1 @@ +3242 diff --git a/codenet/public_test_cases/p03545/input.3.txt b/codenet/public_test_cases/p03545/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..09c08840d0ab586228d29657d5c86c829a140afd --- /dev/null +++ b/codenet/public_test_cases/p03545/input.3.txt @@ -0,0 +1 @@ +0290 diff --git a/codenet/public_test_cases/p03545/output.0.txt b/codenet/public_test_cases/p03545/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bf514dd7a2547f25088b3e42b13379a7d7bb717 --- /dev/null +++ b/codenet/public_test_cases/p03545/output.0.txt @@ -0,0 +1 @@ +1+2+2+2=7 diff --git a/codenet/public_test_cases/p03545/output.1.txt b/codenet/public_test_cases/p03545/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bf514dd7a2547f25088b3e42b13379a7d7bb717 --- /dev/null +++ b/codenet/public_test_cases/p03545/output.1.txt @@ -0,0 +1 @@ +1+2+2+2=7 diff --git a/codenet/public_test_cases/p03545/output.2.txt b/codenet/public_test_cases/p03545/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1cf300a4a794d714320893975cdc4ee08f1b74ea --- /dev/null +++ b/codenet/public_test_cases/p03545/output.2.txt @@ -0,0 +1 @@ +3+2+4-2=7 diff --git a/codenet/public_test_cases/p03545/output.3.txt b/codenet/public_test_cases/p03545/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3930f30584a688ae0b50ac7664b1af8ba191db4a --- /dev/null +++ b/codenet/public_test_cases/p03545/output.3.txt @@ -0,0 +1 @@ +0-2+9+0=7 diff --git a/codenet/public_test_cases/p03546/input.0.txt b/codenet/public_test_cases/p03546/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29daa64336ef1aee769d70245bfda57345fc360e --- /dev/null +++ b/codenet/public_test_cases/p03546/input.0.txt @@ -0,0 +1,13 @@ +2 4 +0 9 9 9 9 9 9 9 9 9 +9 0 9 9 9 9 9 9 9 9 +9 9 0 9 9 9 9 9 9 9 +9 9 9 0 9 9 9 9 9 9 +9 9 9 9 0 9 9 9 9 2 +9 9 9 9 9 0 9 9 9 9 +9 9 9 9 9 9 0 9 9 9 +9 9 9 9 9 9 9 0 9 9 +9 9 9 9 2 9 9 9 0 9 +9 2 9 9 9 9 9 9 9 0 +-1 -1 -1 -1 +8 1 1 8 diff --git a/codenet/public_test_cases/p03546/input.1.txt b/codenet/public_test_cases/p03546/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29daa64336ef1aee769d70245bfda57345fc360e --- /dev/null +++ b/codenet/public_test_cases/p03546/input.1.txt @@ -0,0 +1,13 @@ +2 4 +0 9 9 9 9 9 9 9 9 9 +9 0 9 9 9 9 9 9 9 9 +9 9 0 9 9 9 9 9 9 9 +9 9 9 0 9 9 9 9 9 9 +9 9 9 9 0 9 9 9 9 2 +9 9 9 9 9 0 9 9 9 9 +9 9 9 9 9 9 0 9 9 9 +9 9 9 9 9 9 9 0 9 9 +9 9 9 9 2 9 9 9 0 9 +9 2 9 9 9 9 9 9 9 0 +-1 -1 -1 -1 +8 1 1 8 diff --git a/codenet/public_test_cases/p03546/input.2.txt b/codenet/public_test_cases/p03546/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..668d7db470608b4e6925fa5f544d90a0f0a8476a --- /dev/null +++ b/codenet/public_test_cases/p03546/input.2.txt @@ -0,0 +1,14 @@ +3 5 +0 4 3 6 2 7 2 5 3 3 +4 0 5 3 7 5 3 7 2 7 +5 7 0 7 2 9 3 2 9 1 +3 6 2 0 2 4 6 4 2 3 +3 5 7 4 0 6 9 7 6 7 +9 8 5 2 2 0 4 7 6 5 +5 4 6 3 2 3 0 5 4 3 +3 6 2 3 4 2 4 0 8 9 +4 6 5 4 3 5 3 2 0 8 +2 1 3 4 5 7 8 6 4 0 +3 5 2 6 1 +2 5 3 2 1 +6 9 2 5 6 diff --git a/codenet/public_test_cases/p03546/input.3.txt b/codenet/public_test_cases/p03546/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45dc2bfab1946c3144f760d8094cc16407e03210 --- /dev/null +++ b/codenet/public_test_cases/p03546/input.3.txt @@ -0,0 +1,16 @@ +5 5 +0 999 999 999 999 999 999 999 999 999 +999 0 999 999 999 999 999 999 999 999 +999 999 0 999 999 999 999 999 999 999 +999 999 999 0 999 999 999 999 999 999 +999 999 999 999 0 999 999 999 999 999 +999 999 999 999 999 0 999 999 999 999 +999 999 999 999 999 999 0 999 999 999 +999 999 999 999 999 999 999 0 999 999 +999 999 999 999 999 999 999 999 0 999 +999 999 999 999 999 999 999 999 999 0 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p03546/output.0.txt b/codenet/public_test_cases/p03546/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03546/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03546/output.1.txt b/codenet/public_test_cases/p03546/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03546/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03546/output.2.txt b/codenet/public_test_cases/p03546/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..abac1ea7b759d8258c9ad9e5b450f782aaa33374 --- /dev/null +++ b/codenet/public_test_cases/p03546/output.2.txt @@ -0,0 +1 @@ +47 diff --git a/codenet/public_test_cases/p03546/output.3.txt b/codenet/public_test_cases/p03546/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03546/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03547/input.0.txt b/codenet/public_test_cases/p03547/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5decc2b6a1cdca10966091e39caed1e532a81772 --- /dev/null +++ b/codenet/public_test_cases/p03547/input.0.txt @@ -0,0 +1 @@ +A B diff --git a/codenet/public_test_cases/p03547/input.1.txt b/codenet/public_test_cases/p03547/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..622d51c162583f36eec4a61f31c07ec523734ec0 --- /dev/null +++ b/codenet/public_test_cases/p03547/input.1.txt @@ -0,0 +1 @@ +F F diff --git a/codenet/public_test_cases/p03547/input.2.txt b/codenet/public_test_cases/p03547/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5decc2b6a1cdca10966091e39caed1e532a81772 --- /dev/null +++ b/codenet/public_test_cases/p03547/input.2.txt @@ -0,0 +1 @@ +A B diff --git a/codenet/public_test_cases/p03547/input.3.txt b/codenet/public_test_cases/p03547/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b2e4a87744b9e5d1821243aa6ca1b3eb985fc49 --- /dev/null +++ b/codenet/public_test_cases/p03547/input.3.txt @@ -0,0 +1 @@ +E C diff --git a/codenet/public_test_cases/p03547/output.0.txt b/codenet/public_test_cases/p03547/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9318418344a8d00847ab6dc08d0c979248b92a0b --- /dev/null +++ b/codenet/public_test_cases/p03547/output.0.txt @@ -0,0 +1 @@ +< diff --git a/codenet/public_test_cases/p03547/output.1.txt b/codenet/public_test_cases/p03547/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3134d36bfdd63256413783fceb65bd8842846792 --- /dev/null +++ b/codenet/public_test_cases/p03547/output.1.txt @@ -0,0 +1 @@ += diff --git a/codenet/public_test_cases/p03547/output.2.txt b/codenet/public_test_cases/p03547/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9318418344a8d00847ab6dc08d0c979248b92a0b --- /dev/null +++ b/codenet/public_test_cases/p03547/output.2.txt @@ -0,0 +1 @@ +< diff --git a/codenet/public_test_cases/p03547/output.3.txt b/codenet/public_test_cases/p03547/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9e80f6f7602c18d035af9659303047b30204182 --- /dev/null +++ b/codenet/public_test_cases/p03547/output.3.txt @@ -0,0 +1 @@ +> diff --git a/codenet/public_test_cases/p03548/input.0.txt b/codenet/public_test_cases/p03548/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8869fd822a4a2b805923eae5385c49c85d229dca --- /dev/null +++ b/codenet/public_test_cases/p03548/input.0.txt @@ -0,0 +1 @@ +13 3 1 diff --git a/codenet/public_test_cases/p03548/input.1.txt b/codenet/public_test_cases/p03548/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a2db4dbfe3af6e033fd054a78a2037008824d20 --- /dev/null +++ b/codenet/public_test_cases/p03548/input.1.txt @@ -0,0 +1 @@ +100000 1 1 diff --git a/codenet/public_test_cases/p03548/input.2.txt b/codenet/public_test_cases/p03548/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8869fd822a4a2b805923eae5385c49c85d229dca --- /dev/null +++ b/codenet/public_test_cases/p03548/input.2.txt @@ -0,0 +1 @@ +13 3 1 diff --git a/codenet/public_test_cases/p03548/input.3.txt b/codenet/public_test_cases/p03548/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..14677320ef1ebabb799141d7c55440be4b06f584 --- /dev/null +++ b/codenet/public_test_cases/p03548/input.3.txt @@ -0,0 +1 @@ +64145 123 456 diff --git a/codenet/public_test_cases/p03548/input.4.txt b/codenet/public_test_cases/p03548/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4bef20d82a639700e4af6bedd78d102baea3583 --- /dev/null +++ b/codenet/public_test_cases/p03548/input.4.txt @@ -0,0 +1 @@ +12 3 1 diff --git a/codenet/public_test_cases/p03548/input.5.txt b/codenet/public_test_cases/p03548/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..22335fca74b4a2875714637b97a7945717bc0a82 --- /dev/null +++ b/codenet/public_test_cases/p03548/input.5.txt @@ -0,0 +1 @@ +64146 123 456 diff --git a/codenet/public_test_cases/p03548/output.0.txt b/codenet/public_test_cases/p03548/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03548/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03548/output.1.txt b/codenet/public_test_cases/p03548/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..722870edc1d6f330c6d631a42f4ca175b6fd4650 --- /dev/null +++ b/codenet/public_test_cases/p03548/output.1.txt @@ -0,0 +1 @@ +49999 diff --git a/codenet/public_test_cases/p03548/output.2.txt b/codenet/public_test_cases/p03548/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03548/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03548/output.3.txt b/codenet/public_test_cases/p03548/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2a9fee008af419b5b336e778c8f3e45e247c776 --- /dev/null +++ b/codenet/public_test_cases/p03548/output.3.txt @@ -0,0 +1 @@ +109 diff --git a/codenet/public_test_cases/p03548/output.4.txt b/codenet/public_test_cases/p03548/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03548/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03548/output.5.txt b/codenet/public_test_cases/p03548/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p03548/output.5.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p03549/input.0.txt b/codenet/public_test_cases/p03549/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03549/input.0.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03549/input.1.txt b/codenet/public_test_cases/p03549/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5bf2d0f1e8a723c3ff025969fd8c6dceba85bde6 --- /dev/null +++ b/codenet/public_test_cases/p03549/input.1.txt @@ -0,0 +1 @@ +100 5 diff --git a/codenet/public_test_cases/p03549/input.2.txt b/codenet/public_test_cases/p03549/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd64ae0403c3dcbf893963e75f433dbfad8230bb --- /dev/null +++ b/codenet/public_test_cases/p03549/input.2.txt @@ -0,0 +1 @@ +10 2 diff --git a/codenet/public_test_cases/p03549/input.3.txt b/codenet/public_test_cases/p03549/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03549/input.3.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03549/output.0.txt b/codenet/public_test_cases/p03549/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e78293ac9dd39a69c5aafd13a49abb589ae35fa5 --- /dev/null +++ b/codenet/public_test_cases/p03549/output.0.txt @@ -0,0 +1 @@ +3800 diff --git a/codenet/public_test_cases/p03549/output.1.txt b/codenet/public_test_cases/p03549/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4ef163bc56e1244a5f4d4bcc3d8d6976a3616e9 --- /dev/null +++ b/codenet/public_test_cases/p03549/output.1.txt @@ -0,0 +1 @@ +608000 diff --git a/codenet/public_test_cases/p03549/output.2.txt b/codenet/public_test_cases/p03549/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..de26d6d9e7977e10dacaac06568f37ec099438e2 --- /dev/null +++ b/codenet/public_test_cases/p03549/output.2.txt @@ -0,0 +1 @@ +18400 diff --git a/codenet/public_test_cases/p03549/output.3.txt b/codenet/public_test_cases/p03549/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e78293ac9dd39a69c5aafd13a49abb589ae35fa5 --- /dev/null +++ b/codenet/public_test_cases/p03549/output.3.txt @@ -0,0 +1 @@ +3800 diff --git a/codenet/public_test_cases/p03550/input.0.txt b/codenet/public_test_cases/p03550/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..083efa941ff5110940889dba8df4fea894da1582 --- /dev/null +++ b/codenet/public_test_cases/p03550/input.0.txt @@ -0,0 +1,2 @@ +3 100 100 +10 1000 100 diff --git a/codenet/public_test_cases/p03550/output.0.txt b/codenet/public_test_cases/p03550/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b02a197f603b1424f13f8f5293cbf92417c1b00 --- /dev/null +++ b/codenet/public_test_cases/p03550/output.0.txt @@ -0,0 +1 @@ +900 diff --git a/codenet/public_test_cases/p03551/input.0.txt b/codenet/public_test_cases/p03551/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03551/input.0.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03551/output.0.txt b/codenet/public_test_cases/p03551/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e78293ac9dd39a69c5aafd13a49abb589ae35fa5 --- /dev/null +++ b/codenet/public_test_cases/p03551/output.0.txt @@ -0,0 +1 @@ +3800 diff --git a/codenet/public_test_cases/p03552/input.0.txt b/codenet/public_test_cases/p03552/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..083efa941ff5110940889dba8df4fea894da1582 --- /dev/null +++ b/codenet/public_test_cases/p03552/input.0.txt @@ -0,0 +1,2 @@ +3 100 100 +10 1000 100 diff --git a/codenet/public_test_cases/p03552/input.1.txt b/codenet/public_test_cases/p03552/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbe2d07a9ab15ca061acdba2fbc46e644602b8b1 --- /dev/null +++ b/codenet/public_test_cases/p03552/input.1.txt @@ -0,0 +1,2 @@ +5 1 1 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p03552/input.2.txt b/codenet/public_test_cases/p03552/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8458e86f95eb2256dd6d1856381385d2269f87e1 --- /dev/null +++ b/codenet/public_test_cases/p03552/input.2.txt @@ -0,0 +1,2 @@ +3 100 1000 +10 100 100 diff --git a/codenet/public_test_cases/p03552/input.3.txt b/codenet/public_test_cases/p03552/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..083efa941ff5110940889dba8df4fea894da1582 --- /dev/null +++ b/codenet/public_test_cases/p03552/input.3.txt @@ -0,0 +1,2 @@ +3 100 100 +10 1000 100 diff --git a/codenet/public_test_cases/p03552/input.4.txt b/codenet/public_test_cases/p03552/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..67d8cdba63417e3eab11258ad38bdf6ad4090fed --- /dev/null +++ b/codenet/public_test_cases/p03552/input.4.txt @@ -0,0 +1,2 @@ +1 1 1 +1000000000 diff --git a/codenet/public_test_cases/p03552/output.0.txt b/codenet/public_test_cases/p03552/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b02a197f603b1424f13f8f5293cbf92417c1b00 --- /dev/null +++ b/codenet/public_test_cases/p03552/output.0.txt @@ -0,0 +1 @@ +900 diff --git a/codenet/public_test_cases/p03552/output.1.txt b/codenet/public_test_cases/p03552/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03552/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03552/output.2.txt b/codenet/public_test_cases/p03552/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b02a197f603b1424f13f8f5293cbf92417c1b00 --- /dev/null +++ b/codenet/public_test_cases/p03552/output.2.txt @@ -0,0 +1 @@ +900 diff --git a/codenet/public_test_cases/p03552/output.3.txt b/codenet/public_test_cases/p03552/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b02a197f603b1424f13f8f5293cbf92417c1b00 --- /dev/null +++ b/codenet/public_test_cases/p03552/output.3.txt @@ -0,0 +1 @@ +900 diff --git a/codenet/public_test_cases/p03552/output.4.txt b/codenet/public_test_cases/p03552/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..28e56d983ef928848a1b0cdae1fe481ad09143a2 --- /dev/null +++ b/codenet/public_test_cases/p03552/output.4.txt @@ -0,0 +1 @@ +999999999 diff --git a/codenet/public_test_cases/p03553/input.0.txt b/codenet/public_test_cases/p03553/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..be91059b7d657a86a6adb65a83eccd3a3dbd3da2 --- /dev/null +++ b/codenet/public_test_cases/p03553/input.0.txt @@ -0,0 +1,2 @@ +6 +1 2 -6 4 5 3 diff --git a/codenet/public_test_cases/p03553/input.1.txt b/codenet/public_test_cases/p03553/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83ffbd1ca1b470ca814404d8c5e97dab88849577 --- /dev/null +++ b/codenet/public_test_cases/p03553/input.1.txt @@ -0,0 +1,2 @@ +6 +100 -100 -100 -100 100 -100 diff --git a/codenet/public_test_cases/p03553/input.2.txt b/codenet/public_test_cases/p03553/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..be91059b7d657a86a6adb65a83eccd3a3dbd3da2 --- /dev/null +++ b/codenet/public_test_cases/p03553/input.2.txt @@ -0,0 +1,2 @@ +6 +1 2 -6 4 5 3 diff --git a/codenet/public_test_cases/p03553/input.3.txt b/codenet/public_test_cases/p03553/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..823eee703dae285fb13e52056a2a4b60f59afc46 --- /dev/null +++ b/codenet/public_test_cases/p03553/input.3.txt @@ -0,0 +1,2 @@ +2 +-1000 100000 diff --git a/codenet/public_test_cases/p03553/input.4.txt b/codenet/public_test_cases/p03553/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..207d73bf63bb45e2f8d59f4a9205baf02febd387 --- /dev/null +++ b/codenet/public_test_cases/p03553/input.4.txt @@ -0,0 +1,2 @@ +5 +-1 -2 -3 -4 -5 diff --git a/codenet/public_test_cases/p03553/output.0.txt b/codenet/public_test_cases/p03553/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03553/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03553/output.1.txt b/codenet/public_test_cases/p03553/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08839f6bb296e888d311d8ea2f35f7ff82dd3f2d --- /dev/null +++ b/codenet/public_test_cases/p03553/output.1.txt @@ -0,0 +1 @@ +200 diff --git a/codenet/public_test_cases/p03553/output.2.txt b/codenet/public_test_cases/p03553/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03553/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03553/output.3.txt b/codenet/public_test_cases/p03553/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7eaa76c2c785cb914e8e10cb816c43195f2b082f --- /dev/null +++ b/codenet/public_test_cases/p03553/output.3.txt @@ -0,0 +1 @@ +99000 diff --git a/codenet/public_test_cases/p03553/output.4.txt b/codenet/public_test_cases/p03553/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03553/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03554/input.0.txt b/codenet/public_test_cases/p03554/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9480b00fcc639d00bd4182ca0b67d149ac294123 --- /dev/null +++ b/codenet/public_test_cases/p03554/input.0.txt @@ -0,0 +1,4 @@ +3 +1 0 1 +1 +1 3 diff --git a/codenet/public_test_cases/p03554/input.1.txt b/codenet/public_test_cases/p03554/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f690989cf2ae6f9952c607ae5df8e6212eb8efe5 --- /dev/null +++ b/codenet/public_test_cases/p03554/input.1.txt @@ -0,0 +1,4 @@ +5 +0 1 0 1 0 +1 +1 5 diff --git a/codenet/public_test_cases/p03554/input.2.txt b/codenet/public_test_cases/p03554/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3317d8581a60daedae40854275b80020c17096f --- /dev/null +++ b/codenet/public_test_cases/p03554/input.2.txt @@ -0,0 +1,5 @@ +3 +1 0 1 +2 +1 1 +3 3 diff --git a/codenet/public_test_cases/p03554/input.3.txt b/codenet/public_test_cases/p03554/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e3850a66cff43c7a80224e7c16709fd1de1fd7e --- /dev/null +++ b/codenet/public_test_cases/p03554/input.3.txt @@ -0,0 +1,10 @@ +10 +0 0 0 1 0 0 1 1 1 0 +7 +1 4 +2 5 +1 3 +6 7 +9 9 +1 5 +7 9 diff --git a/codenet/public_test_cases/p03554/input.4.txt b/codenet/public_test_cases/p03554/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9480b00fcc639d00bd4182ca0b67d149ac294123 --- /dev/null +++ b/codenet/public_test_cases/p03554/input.4.txt @@ -0,0 +1,4 @@ +3 +1 0 1 +1 +1 3 diff --git a/codenet/public_test_cases/p03554/input.5.txt b/codenet/public_test_cases/p03554/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..38521174922bc92ea8ab901ee9070879ef6589fc --- /dev/null +++ b/codenet/public_test_cases/p03554/input.5.txt @@ -0,0 +1,5 @@ +3 +1 0 1 +2 +1 1 +2 3 diff --git a/codenet/public_test_cases/p03554/input.6.txt b/codenet/public_test_cases/p03554/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..d95b3055438ab75cb30dc85ae9a76f6b015b9f94 --- /dev/null +++ b/codenet/public_test_cases/p03554/input.6.txt @@ -0,0 +1,12 @@ +15 +1 1 0 0 0 0 0 0 1 0 1 1 1 0 0 +9 +4 10 +13 14 +1 7 +4 14 +9 11 +2 6 +7 8 +3 12 +7 13 diff --git a/codenet/public_test_cases/p03554/input.7.txt b/codenet/public_test_cases/p03554/input.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb4d9106f2c91d5c5653bb51ce1ae50bfaa85a66 --- /dev/null +++ b/codenet/public_test_cases/p03554/input.7.txt @@ -0,0 +1,6 @@ +9 +0 1 0 1 1 1 0 1 0 +3 +1 4 +5 8 +6 7 diff --git a/codenet/public_test_cases/p03554/output.0.txt b/codenet/public_test_cases/p03554/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03554/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03554/output.1.txt b/codenet/public_test_cases/p03554/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03554/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03554/output.2.txt b/codenet/public_test_cases/p03554/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03554/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03554/output.3.txt b/codenet/public_test_cases/p03554/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03554/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03554/output.4.txt b/codenet/public_test_cases/p03554/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03554/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03554/output.5.txt b/codenet/public_test_cases/p03554/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03554/output.5.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03554/output.6.txt b/codenet/public_test_cases/p03554/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03554/output.6.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03554/output.7.txt b/codenet/public_test_cases/p03554/output.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03554/output.7.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03555/input.0.txt b/codenet/public_test_cases/p03555/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..825a387db8b024d8de8b9311ed370814a8f1e31a --- /dev/null +++ b/codenet/public_test_cases/p03555/input.0.txt @@ -0,0 +1,2 @@ +pot +top diff --git a/codenet/public_test_cases/p03555/input.1.txt b/codenet/public_test_cases/p03555/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2361e11963d6a514137ae088c129ab5fb5bfe75d --- /dev/null +++ b/codenet/public_test_cases/p03555/input.1.txt @@ -0,0 +1,2 @@ +tab +bet diff --git a/codenet/public_test_cases/p03555/input.2.txt b/codenet/public_test_cases/p03555/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..527c59d68d65fd6df0f8fb4edc4b543e91159355 --- /dev/null +++ b/codenet/public_test_cases/p03555/input.2.txt @@ -0,0 +1,2 @@ +eye +eel diff --git a/codenet/public_test_cases/p03555/input.3.txt b/codenet/public_test_cases/p03555/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..825a387db8b024d8de8b9311ed370814a8f1e31a --- /dev/null +++ b/codenet/public_test_cases/p03555/input.3.txt @@ -0,0 +1,2 @@ +pot +top diff --git a/codenet/public_test_cases/p03555/output.0.txt b/codenet/public_test_cases/p03555/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03555/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03555/output.1.txt b/codenet/public_test_cases/p03555/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03555/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03555/output.2.txt b/codenet/public_test_cases/p03555/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03555/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03555/output.3.txt b/codenet/public_test_cases/p03555/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03555/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03556/input.0.txt b/codenet/public_test_cases/p03556/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03556/input.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03556/input.1.txt b/codenet/public_test_cases/p03556/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d88e313699871a6c780316c8df7479aebe6999c0 --- /dev/null +++ b/codenet/public_test_cases/p03556/input.1.txt @@ -0,0 +1 @@ +81 diff --git a/codenet/public_test_cases/p03556/input.2.txt b/codenet/public_test_cases/p03556/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03556/input.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03556/input.3.txt b/codenet/public_test_cases/p03556/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..17769f40e3b8358a059e72d92a19257ed1060ad7 --- /dev/null +++ b/codenet/public_test_cases/p03556/input.3.txt @@ -0,0 +1 @@ +271828182 diff --git a/codenet/public_test_cases/p03556/output.0.txt b/codenet/public_test_cases/p03556/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03556/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03556/output.1.txt b/codenet/public_test_cases/p03556/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d88e313699871a6c780316c8df7479aebe6999c0 --- /dev/null +++ b/codenet/public_test_cases/p03556/output.1.txt @@ -0,0 +1 @@ +81 diff --git a/codenet/public_test_cases/p03556/output.2.txt b/codenet/public_test_cases/p03556/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03556/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03556/output.3.txt b/codenet/public_test_cases/p03556/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8060ba194335a605fe779098008da87df7488d3c --- /dev/null +++ b/codenet/public_test_cases/p03556/output.3.txt @@ -0,0 +1 @@ +271821169 diff --git a/codenet/public_test_cases/p03557/input.0.txt b/codenet/public_test_cases/p03557/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..094d7025ae107dbdedcfccddbc454a23826e633a --- /dev/null +++ b/codenet/public_test_cases/p03557/input.0.txt @@ -0,0 +1,4 @@ +2 +1 5 +2 4 +3 6 diff --git a/codenet/public_test_cases/p03557/output.0.txt b/codenet/public_test_cases/p03557/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03557/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03558/input.0.txt b/codenet/public_test_cases/p03558/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03558/input.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03558/input.1.txt b/codenet/public_test_cases/p03558/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87523dd7a0632907d61799465827c3f08825fa47 --- /dev/null +++ b/codenet/public_test_cases/p03558/input.1.txt @@ -0,0 +1 @@ +41 diff --git a/codenet/public_test_cases/p03558/input.2.txt b/codenet/public_test_cases/p03558/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03558/input.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03558/input.3.txt b/codenet/public_test_cases/p03558/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..061d89caec2321166db8d6e54bce88c1befb5751 --- /dev/null +++ b/codenet/public_test_cases/p03558/input.3.txt @@ -0,0 +1 @@ +79992 diff --git a/codenet/public_test_cases/p03558/output.0.txt b/codenet/public_test_cases/p03558/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03558/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03558/output.1.txt b/codenet/public_test_cases/p03558/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03558/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03558/output.2.txt b/codenet/public_test_cases/p03558/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03558/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03558/output.3.txt b/codenet/public_test_cases/p03558/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p03558/output.3.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p03559/input.0.txt b/codenet/public_test_cases/p03559/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..094d7025ae107dbdedcfccddbc454a23826e633a --- /dev/null +++ b/codenet/public_test_cases/p03559/input.0.txt @@ -0,0 +1,4 @@ +2 +1 5 +2 4 +3 6 diff --git a/codenet/public_test_cases/p03559/input.1.txt b/codenet/public_test_cases/p03559/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a304b917058e357ca1abf1237e4a64bc2ec91cd3 --- /dev/null +++ b/codenet/public_test_cases/p03559/input.1.txt @@ -0,0 +1,4 @@ +3 +1 1 1 +2 2 2 +3 3 3 diff --git a/codenet/public_test_cases/p03559/input.2.txt b/codenet/public_test_cases/p03559/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..094d7025ae107dbdedcfccddbc454a23826e633a --- /dev/null +++ b/codenet/public_test_cases/p03559/input.2.txt @@ -0,0 +1,4 @@ +2 +1 5 +2 4 +3 6 diff --git a/codenet/public_test_cases/p03559/input.3.txt b/codenet/public_test_cases/p03559/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad6543d433818ee175e95c99df6c013f5b02a397 --- /dev/null +++ b/codenet/public_test_cases/p03559/input.3.txt @@ -0,0 +1,4 @@ +6 +3 14 159 2 6 53 +58 9 79 323 84 6 +2643 383 2 79 50 288 diff --git a/codenet/public_test_cases/p03559/output.0.txt b/codenet/public_test_cases/p03559/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03559/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03559/output.1.txt b/codenet/public_test_cases/p03559/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p03559/output.1.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p03559/output.2.txt b/codenet/public_test_cases/p03559/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03559/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03559/output.3.txt b/codenet/public_test_cases/p03559/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..84df3526d808244511707ba9f610794cfb3096e6 --- /dev/null +++ b/codenet/public_test_cases/p03559/output.3.txt @@ -0,0 +1 @@ +87 diff --git a/codenet/public_test_cases/p03560/input.0.txt b/codenet/public_test_cases/p03560/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03560/input.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03560/output.0.txt b/codenet/public_test_cases/p03560/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03560/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03561/input.0.txt b/codenet/public_test_cases/p03561/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03561/input.0.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03561/input.1.txt b/codenet/public_test_cases/p03561/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0efd67f9502e63cb033cb651e65e025b6e3a5cb2 --- /dev/null +++ b/codenet/public_test_cases/p03561/input.1.txt @@ -0,0 +1 @@ +2 4 diff --git a/codenet/public_test_cases/p03561/input.2.txt b/codenet/public_test_cases/p03561/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed100ae2be56afb172d164c5656fd5a1da0fc220 --- /dev/null +++ b/codenet/public_test_cases/p03561/input.2.txt @@ -0,0 +1 @@ +5 14 diff --git a/codenet/public_test_cases/p03561/input.3.txt b/codenet/public_test_cases/p03561/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03561/input.3.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03561/output.0.txt b/codenet/public_test_cases/p03561/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03561/output.0.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03561/output.1.txt b/codenet/public_test_cases/p03561/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8834daeea7aa2b0437b66593d2a17bb7f7e1431 --- /dev/null +++ b/codenet/public_test_cases/p03561/output.1.txt @@ -0,0 +1 @@ +1 2 2 2 diff --git a/codenet/public_test_cases/p03561/output.2.txt b/codenet/public_test_cases/p03561/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d35f37d2ffeae7a02d20c63bcf1d3ee04f30e21 --- /dev/null +++ b/codenet/public_test_cases/p03561/output.2.txt @@ -0,0 +1 @@ +3 3 3 3 3 3 3 3 3 3 3 3 2 2 diff --git a/codenet/public_test_cases/p03561/output.3.txt b/codenet/public_test_cases/p03561/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03561/output.3.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03562/input.0.txt b/codenet/public_test_cases/p03562/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f197eac02f99b9c0b77a14a8444f4763e7a56456 --- /dev/null +++ b/codenet/public_test_cases/p03562/input.0.txt @@ -0,0 +1,4 @@ +3 111 +1111 +10111 +10010 diff --git a/codenet/public_test_cases/p03562/input.1.txt b/codenet/public_test_cases/p03562/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea44fcab6eb07c8ecbfe467565b855832192c806 --- /dev/null +++ b/codenet/public_test_cases/p03562/input.1.txt @@ -0,0 +1,2 @@ +1 111111111111111111111111111111111111111111111111111111111111111 +1 diff --git a/codenet/public_test_cases/p03562/input.2.txt b/codenet/public_test_cases/p03562/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec802f48b3295b730e42db9dac9e2dd0c9bb3801 --- /dev/null +++ b/codenet/public_test_cases/p03562/input.2.txt @@ -0,0 +1,5 @@ +4 100100 +1011 +1110 +110101 +1010110 diff --git a/codenet/public_test_cases/p03562/input.3.txt b/codenet/public_test_cases/p03562/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..08178b06c9b134481518fc41b2cdc7691cc0d03c --- /dev/null +++ b/codenet/public_test_cases/p03562/input.3.txt @@ -0,0 +1,5 @@ +4 111001100101001 +10111110 +1001000110 +100000101 +11110000011 diff --git a/codenet/public_test_cases/p03562/input.4.txt b/codenet/public_test_cases/p03562/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f197eac02f99b9c0b77a14a8444f4763e7a56456 --- /dev/null +++ b/codenet/public_test_cases/p03562/input.4.txt @@ -0,0 +1,4 @@ +3 111 +1111 +10111 +10010 diff --git a/codenet/public_test_cases/p03562/output.0.txt b/codenet/public_test_cases/p03562/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03562/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03562/output.1.txt b/codenet/public_test_cases/p03562/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c7ec0eba453b2773795087a3b6f14692435e020 --- /dev/null +++ b/codenet/public_test_cases/p03562/output.1.txt @@ -0,0 +1 @@ +466025955 diff --git a/codenet/public_test_cases/p03562/output.2.txt b/codenet/public_test_cases/p03562/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..81b5c5d06cc0b8290c264b408abb32cc0986e8f2 --- /dev/null +++ b/codenet/public_test_cases/p03562/output.2.txt @@ -0,0 +1 @@ +37 diff --git a/codenet/public_test_cases/p03562/output.3.txt b/codenet/public_test_cases/p03562/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f625eb6ab6abaebfe94176fa9c5ad9b74e049598 --- /dev/null +++ b/codenet/public_test_cases/p03562/output.3.txt @@ -0,0 +1 @@ +1843 diff --git a/codenet/public_test_cases/p03562/output.4.txt b/codenet/public_test_cases/p03562/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03562/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03563/input.0.txt b/codenet/public_test_cases/p03563/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d4f939133a3d35e5007927473d0b8a570c85393 --- /dev/null +++ b/codenet/public_test_cases/p03563/input.0.txt @@ -0,0 +1,2 @@ +2002 +2017 diff --git a/codenet/public_test_cases/p03563/input.1.txt b/codenet/public_test_cases/p03563/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..713c0321005541bbbd8621b2184b4101fcfed867 --- /dev/null +++ b/codenet/public_test_cases/p03563/input.1.txt @@ -0,0 +1,2 @@ +4500 +0 diff --git a/codenet/public_test_cases/p03563/input.2.txt b/codenet/public_test_cases/p03563/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d4f939133a3d35e5007927473d0b8a570c85393 --- /dev/null +++ b/codenet/public_test_cases/p03563/input.2.txt @@ -0,0 +1,2 @@ +2002 +2017 diff --git a/codenet/public_test_cases/p03563/output.0.txt b/codenet/public_test_cases/p03563/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9cef4a4ee82fce94640535983845b6cde054af9 --- /dev/null +++ b/codenet/public_test_cases/p03563/output.0.txt @@ -0,0 +1 @@ +2032 diff --git a/codenet/public_test_cases/p03563/output.1.txt b/codenet/public_test_cases/p03563/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c167a1dfe7416fa6a536b5002a249a615d7b059 --- /dev/null +++ b/codenet/public_test_cases/p03563/output.1.txt @@ -0,0 +1 @@ +-4500 diff --git a/codenet/public_test_cases/p03563/output.2.txt b/codenet/public_test_cases/p03563/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9cef4a4ee82fce94640535983845b6cde054af9 --- /dev/null +++ b/codenet/public_test_cases/p03563/output.2.txt @@ -0,0 +1 @@ +2032 diff --git a/codenet/public_test_cases/p03564/input.0.txt b/codenet/public_test_cases/p03564/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81450f3d334f886509a186abffcf1a1aee0866a5 --- /dev/null +++ b/codenet/public_test_cases/p03564/input.0.txt @@ -0,0 +1,2 @@ +4 +3 diff --git a/codenet/public_test_cases/p03564/input.1.txt b/codenet/public_test_cases/p03564/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2f7f08c17074991c47ce9b2475c3fe58fc26247 --- /dev/null +++ b/codenet/public_test_cases/p03564/input.1.txt @@ -0,0 +1,2 @@ +10 +10 diff --git a/codenet/public_test_cases/p03564/input.2.txt b/codenet/public_test_cases/p03564/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..81450f3d334f886509a186abffcf1a1aee0866a5 --- /dev/null +++ b/codenet/public_test_cases/p03564/input.2.txt @@ -0,0 +1,2 @@ +4 +3 diff --git a/codenet/public_test_cases/p03564/output.0.txt b/codenet/public_test_cases/p03564/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03564/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03564/output.1.txt b/codenet/public_test_cases/p03564/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd475631baeff3ce652b97d921c1cc43c917b9e2 --- /dev/null +++ b/codenet/public_test_cases/p03564/output.1.txt @@ -0,0 +1 @@ +76 diff --git a/codenet/public_test_cases/p03564/output.2.txt b/codenet/public_test_cases/p03564/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03564/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03565/input.0.txt b/codenet/public_test_cases/p03565/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0e087018fbf7f8aa3030c078849bf7c101e4790 --- /dev/null +++ b/codenet/public_test_cases/p03565/input.0.txt @@ -0,0 +1,2 @@ +?tc???? +coder diff --git a/codenet/public_test_cases/p03565/input.1.txt b/codenet/public_test_cases/p03565/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0e087018fbf7f8aa3030c078849bf7c101e4790 --- /dev/null +++ b/codenet/public_test_cases/p03565/input.1.txt @@ -0,0 +1,2 @@ +?tc???? +coder diff --git a/codenet/public_test_cases/p03565/input.2.txt b/codenet/public_test_cases/p03565/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..75bed926ecbefce7cdc384b62ca4cce24db8a523 --- /dev/null +++ b/codenet/public_test_cases/p03565/input.2.txt @@ -0,0 +1,2 @@ +??p??d?? +abc diff --git a/codenet/public_test_cases/p03565/output.0.txt b/codenet/public_test_cases/p03565/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ef13d11d0bc8c8cde49253ea4a0cdbea2c9416 --- /dev/null +++ b/codenet/public_test_cases/p03565/output.0.txt @@ -0,0 +1 @@ +atcoder diff --git a/codenet/public_test_cases/p03565/output.1.txt b/codenet/public_test_cases/p03565/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ef13d11d0bc8c8cde49253ea4a0cdbea2c9416 --- /dev/null +++ b/codenet/public_test_cases/p03565/output.1.txt @@ -0,0 +1 @@ +atcoder diff --git a/codenet/public_test_cases/p03565/output.2.txt b/codenet/public_test_cases/p03565/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..507b5b96ecda1046ae689dfa99a64e4bd3b9491d --- /dev/null +++ b/codenet/public_test_cases/p03565/output.2.txt @@ -0,0 +1 @@ +UNRESTORABLE diff --git a/codenet/public_test_cases/p03566/input.0.txt b/codenet/public_test_cases/p03566/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bac488bcb51bb8e1384d4c83320c735f2d09fab --- /dev/null +++ b/codenet/public_test_cases/p03566/input.0.txt @@ -0,0 +1,3 @@ +1 +100 +30 diff --git a/codenet/public_test_cases/p03566/input.1.txt b/codenet/public_test_cases/p03566/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..329fb39a9ea51f2341e11de22e8ee32dcbfb5c0f --- /dev/null +++ b/codenet/public_test_cases/p03566/input.1.txt @@ -0,0 +1,3 @@ +1 +9 +10 diff --git a/codenet/public_test_cases/p03566/input.2.txt b/codenet/public_test_cases/p03566/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d221b2985160b0420105b047f6c44bab6610044 --- /dev/null +++ b/codenet/public_test_cases/p03566/input.2.txt @@ -0,0 +1,3 @@ +3 +12 14 2 +6 2 7 diff --git a/codenet/public_test_cases/p03566/input.3.txt b/codenet/public_test_cases/p03566/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..452d284322460aabc223bac6e97cdd317d8b2253 --- /dev/null +++ b/codenet/public_test_cases/p03566/input.3.txt @@ -0,0 +1,3 @@ +2 +60 50 +34 38 diff --git a/codenet/public_test_cases/p03566/input.4.txt b/codenet/public_test_cases/p03566/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bac488bcb51bb8e1384d4c83320c735f2d09fab --- /dev/null +++ b/codenet/public_test_cases/p03566/input.4.txt @@ -0,0 +1,3 @@ +1 +100 +30 diff --git a/codenet/public_test_cases/p03566/input.5.txt b/codenet/public_test_cases/p03566/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..db7426c79623aca76bb501988656c258f9fa6ac7 --- /dev/null +++ b/codenet/public_test_cases/p03566/input.5.txt @@ -0,0 +1,3 @@ +10 +64 55 27 35 76 119 7 18 49 100 +29 19 31 39 27 48 41 87 55 70 diff --git a/codenet/public_test_cases/p03566/output.0.txt b/codenet/public_test_cases/p03566/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78b379d51aaaf9cf385531fa94f9848d883426a6 --- /dev/null +++ b/codenet/public_test_cases/p03566/output.0.txt @@ -0,0 +1 @@ +2100.000000000000000 diff --git a/codenet/public_test_cases/p03566/output.1.txt b/codenet/public_test_cases/p03566/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8bb59e34abcb1569ad5c2c45b9f0212e1596436 --- /dev/null +++ b/codenet/public_test_cases/p03566/output.1.txt @@ -0,0 +1 @@ +20.250000000000000000 diff --git a/codenet/public_test_cases/p03566/output.2.txt b/codenet/public_test_cases/p03566/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f13db76ac6a92e9aa7773b2b9dceded2aa7ccaf9 --- /dev/null +++ b/codenet/public_test_cases/p03566/output.2.txt @@ -0,0 +1 @@ +76.000000000000000 diff --git a/codenet/public_test_cases/p03566/output.3.txt b/codenet/public_test_cases/p03566/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a1816134c78fffa8672f0adab3a8252892db736 --- /dev/null +++ b/codenet/public_test_cases/p03566/output.3.txt @@ -0,0 +1 @@ +2632.000000000000000 diff --git a/codenet/public_test_cases/p03566/output.4.txt b/codenet/public_test_cases/p03566/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..78b379d51aaaf9cf385531fa94f9848d883426a6 --- /dev/null +++ b/codenet/public_test_cases/p03566/output.4.txt @@ -0,0 +1 @@ +2100.000000000000000 diff --git a/codenet/public_test_cases/p03566/output.5.txt b/codenet/public_test_cases/p03566/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..06b1fbf2345c077b8a7f8f4220d0871ce27c1407 --- /dev/null +++ b/codenet/public_test_cases/p03566/output.5.txt @@ -0,0 +1 @@ +20291.000000000000 diff --git a/codenet/public_test_cases/p03567/input.0.txt b/codenet/public_test_cases/p03567/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4951826b6b4191b5a46df6429334a3bd0fa82973 --- /dev/null +++ b/codenet/public_test_cases/p03567/input.0.txt @@ -0,0 +1 @@ +BACD diff --git a/codenet/public_test_cases/p03567/input.1.txt b/codenet/public_test_cases/p03567/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0856047476e55b8b182aa294e37b793fc038d4ad --- /dev/null +++ b/codenet/public_test_cases/p03567/input.1.txt @@ -0,0 +1 @@ +CABD diff --git a/codenet/public_test_cases/p03567/input.2.txt b/codenet/public_test_cases/p03567/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4951826b6b4191b5a46df6429334a3bd0fa82973 --- /dev/null +++ b/codenet/public_test_cases/p03567/input.2.txt @@ -0,0 +1 @@ +BACD diff --git a/codenet/public_test_cases/p03567/input.3.txt b/codenet/public_test_cases/p03567/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..40c47850a1e09c671d858529954e41da6197e9ce --- /dev/null +++ b/codenet/public_test_cases/p03567/input.3.txt @@ -0,0 +1 @@ +ACACA diff --git a/codenet/public_test_cases/p03567/input.4.txt b/codenet/public_test_cases/p03567/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ed461429cd4f1c992693d7350a4a66c762dca3d --- /dev/null +++ b/codenet/public_test_cases/p03567/input.4.txt @@ -0,0 +1 @@ +ABCD diff --git a/codenet/public_test_cases/p03567/input.5.txt b/codenet/public_test_cases/p03567/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..71d9eb34caa48baf089ec1f6ee107d6a60831dfb --- /dev/null +++ b/codenet/public_test_cases/p03567/input.5.txt @@ -0,0 +1 @@ +XX diff --git a/codenet/public_test_cases/p03567/output.0.txt b/codenet/public_test_cases/p03567/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03567/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03567/output.1.txt b/codenet/public_test_cases/p03567/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03567/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03567/output.2.txt b/codenet/public_test_cases/p03567/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03567/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03567/output.3.txt b/codenet/public_test_cases/p03567/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03567/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03567/output.4.txt b/codenet/public_test_cases/p03567/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03567/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03567/output.5.txt b/codenet/public_test_cases/p03567/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03567/output.5.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03568/input.0.txt b/codenet/public_test_cases/p03568/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6b80dc12eb8b4d587c14925619a0ed63a2a23c4 --- /dev/null +++ b/codenet/public_test_cases/p03568/input.0.txt @@ -0,0 +1,2 @@ +2 +2 3 diff --git a/codenet/public_test_cases/p03568/input.1.txt b/codenet/public_test_cases/p03568/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2174064a619baff298cf6c4bc0e9d6408cfe3343 --- /dev/null +++ b/codenet/public_test_cases/p03568/input.1.txt @@ -0,0 +1,2 @@ +10 +90 52 56 71 44 8 13 30 57 84 diff --git a/codenet/public_test_cases/p03568/input.2.txt b/codenet/public_test_cases/p03568/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6b80dc12eb8b4d587c14925619a0ed63a2a23c4 --- /dev/null +++ b/codenet/public_test_cases/p03568/input.2.txt @@ -0,0 +1,2 @@ +2 +2 3 diff --git a/codenet/public_test_cases/p03568/input.3.txt b/codenet/public_test_cases/p03568/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ace1d56c945a8b51a5a4b8866a21680d7caa2852 --- /dev/null +++ b/codenet/public_test_cases/p03568/input.3.txt @@ -0,0 +1,2 @@ +1 +100 diff --git a/codenet/public_test_cases/p03568/input.4.txt b/codenet/public_test_cases/p03568/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7c8d8c3c5f68303dbc6b7f9208e3f0e74235ba1 --- /dev/null +++ b/codenet/public_test_cases/p03568/input.4.txt @@ -0,0 +1,2 @@ +3 +3 3 3 diff --git a/codenet/public_test_cases/p03568/output.0.txt b/codenet/public_test_cases/p03568/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03568/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03568/output.1.txt b/codenet/public_test_cases/p03568/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87c026d313fed27515b2e6afe21cf3bce8b218aa --- /dev/null +++ b/codenet/public_test_cases/p03568/output.1.txt @@ -0,0 +1 @@ +58921 diff --git a/codenet/public_test_cases/p03568/output.2.txt b/codenet/public_test_cases/p03568/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03568/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03568/output.3.txt b/codenet/public_test_cases/p03568/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03568/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03568/output.4.txt b/codenet/public_test_cases/p03568/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p03568/output.4.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p03569/input.0.txt b/codenet/public_test_cases/p03569/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db19ce83c1d59a66f1959aef8bd43b459a283597 --- /dev/null +++ b/codenet/public_test_cases/p03569/input.0.txt @@ -0,0 +1 @@ +xabxa diff --git a/codenet/public_test_cases/p03569/input.1.txt b/codenet/public_test_cases/p03569/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p03569/input.1.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p03569/input.2.txt b/codenet/public_test_cases/p03569/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db19ce83c1d59a66f1959aef8bd43b459a283597 --- /dev/null +++ b/codenet/public_test_cases/p03569/input.2.txt @@ -0,0 +1 @@ +xabxa diff --git a/codenet/public_test_cases/p03569/input.3.txt b/codenet/public_test_cases/p03569/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..81bf396956110ad81c14860af1bbcc9dfbe4df20 --- /dev/null +++ b/codenet/public_test_cases/p03569/input.3.txt @@ -0,0 +1 @@ +ab diff --git a/codenet/public_test_cases/p03569/input.4.txt b/codenet/public_test_cases/p03569/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d1a3d5e4ac30b797bd74ebbe97b5310677918ab --- /dev/null +++ b/codenet/public_test_cases/p03569/input.4.txt @@ -0,0 +1 @@ +oxxx diff --git a/codenet/public_test_cases/p03569/output.0.txt b/codenet/public_test_cases/p03569/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03569/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03569/output.1.txt b/codenet/public_test_cases/p03569/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03569/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03569/output.2.txt b/codenet/public_test_cases/p03569/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03569/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03569/output.3.txt b/codenet/public_test_cases/p03569/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03569/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03569/output.4.txt b/codenet/public_test_cases/p03569/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03569/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03570/input.0.txt b/codenet/public_test_cases/p03570/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef4623e4f2864fdd479fc030abf0cbfe86c12b81 --- /dev/null +++ b/codenet/public_test_cases/p03570/input.0.txt @@ -0,0 +1 @@ +aabxyyzz diff --git a/codenet/public_test_cases/p03570/input.1.txt b/codenet/public_test_cases/p03570/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3abe061d90cd975b4bef1fa702caec7c0f320b29 --- /dev/null +++ b/codenet/public_test_cases/p03570/input.1.txt @@ -0,0 +1 @@ +byebye diff --git a/codenet/public_test_cases/p03570/input.2.txt b/codenet/public_test_cases/p03570/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0883f382e1a80609b7b2c7904e701fbe6760b14 --- /dev/null +++ b/codenet/public_test_cases/p03570/input.2.txt @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwxyz diff --git a/codenet/public_test_cases/p03570/input.3.txt b/codenet/public_test_cases/p03570/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef4623e4f2864fdd479fc030abf0cbfe86c12b81 --- /dev/null +++ b/codenet/public_test_cases/p03570/input.3.txt @@ -0,0 +1 @@ +aabxyyzz diff --git a/codenet/public_test_cases/p03570/input.4.txt b/codenet/public_test_cases/p03570/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..84c6e9e5df561d3b6ce9658870d9886d68efb2a2 --- /dev/null +++ b/codenet/public_test_cases/p03570/input.4.txt @@ -0,0 +1 @@ +abcabcxabcx diff --git a/codenet/public_test_cases/p03570/output.0.txt b/codenet/public_test_cases/p03570/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03570/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03570/output.1.txt b/codenet/public_test_cases/p03570/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03570/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03570/output.2.txt b/codenet/public_test_cases/p03570/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p03570/output.2.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p03570/output.3.txt b/codenet/public_test_cases/p03570/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03570/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03570/output.4.txt b/codenet/public_test_cases/p03570/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03570/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03571/input.0.txt b/codenet/public_test_cases/p03571/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..daa56cc946f5c834b52daf52f052de6e44c97156 --- /dev/null +++ b/codenet/public_test_cases/p03571/input.0.txt @@ -0,0 +1 @@ +3 4 5 1 diff --git a/codenet/public_test_cases/p03571/input.1.txt b/codenet/public_test_cases/p03571/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2aa9e787cfb5468b50b0fdb47a585cb828979aee --- /dev/null +++ b/codenet/public_test_cases/p03571/input.1.txt @@ -0,0 +1 @@ +1 2 3 0 diff --git a/codenet/public_test_cases/p03571/input.2.txt b/codenet/public_test_cases/p03571/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a6ac94d63029387080af7d4c329d901671dda91 --- /dev/null +++ b/codenet/public_test_cases/p03571/input.2.txt @@ -0,0 +1 @@ +3 5 7 100 diff --git a/codenet/public_test_cases/p03571/input.3.txt b/codenet/public_test_cases/p03571/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..daa56cc946f5c834b52daf52f052de6e44c97156 --- /dev/null +++ b/codenet/public_test_cases/p03571/input.3.txt @@ -0,0 +1 @@ +3 4 5 1 diff --git a/codenet/public_test_cases/p03571/input.4.txt b/codenet/public_test_cases/p03571/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..640580f17af42ce4959a7d083b872cfe53eaf2ae --- /dev/null +++ b/codenet/public_test_cases/p03571/input.4.txt @@ -0,0 +1 @@ +1234 12345 1234567 5 diff --git a/codenet/public_test_cases/p03571/input.5.txt b/codenet/public_test_cases/p03571/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..40be6763f7fc3032cf7d2ccb109b4f4fbcb22bb2 --- /dev/null +++ b/codenet/public_test_cases/p03571/input.5.txt @@ -0,0 +1 @@ +3 123456781 1000000000 100 diff --git a/codenet/public_test_cases/p03571/input.6.txt b/codenet/public_test_cases/p03571/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..c48d2187ddab029d3cd9a14dcdc237c5d89d276e --- /dev/null +++ b/codenet/public_test_cases/p03571/input.6.txt @@ -0,0 +1 @@ +999999997 999999999 1000000000 50000 diff --git a/codenet/public_test_cases/p03571/output.0.txt b/codenet/public_test_cases/p03571/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb1e7bc86996a80d4a16529b990adda1d3434c92 --- /dev/null +++ b/codenet/public_test_cases/p03571/output.0.txt @@ -0,0 +1 @@ +54 diff --git a/codenet/public_test_cases/p03571/output.1.txt b/codenet/public_test_cases/p03571/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03571/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03571/output.2.txt b/codenet/public_test_cases/p03571/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f96ac06721837aa6a644a580c03c76f304e81db0 --- /dev/null +++ b/codenet/public_test_cases/p03571/output.2.txt @@ -0,0 +1 @@ +105 diff --git a/codenet/public_test_cases/p03571/output.3.txt b/codenet/public_test_cases/p03571/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb1e7bc86996a80d4a16529b990adda1d3434c92 --- /dev/null +++ b/codenet/public_test_cases/p03571/output.3.txt @@ -0,0 +1 @@ +54 diff --git a/codenet/public_test_cases/p03571/output.4.txt b/codenet/public_test_cases/p03571/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..307452a1c9bf0beafea015d6d0d7f69f65dc0997 --- /dev/null +++ b/codenet/public_test_cases/p03571/output.4.txt @@ -0,0 +1 @@ +150673016 diff --git a/codenet/public_test_cases/p03571/output.5.txt b/codenet/public_test_cases/p03571/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..032df39fa87320b44339f5867b0a1ca4828b29eb --- /dev/null +++ b/codenet/public_test_cases/p03571/output.5.txt @@ -0,0 +1 @@ +444124403 diff --git a/codenet/public_test_cases/p03571/output.6.txt b/codenet/public_test_cases/p03571/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b10014c253f7b8741d17c9e65745b01be88bea3 --- /dev/null +++ b/codenet/public_test_cases/p03571/output.6.txt @@ -0,0 +1 @@ +8402143 diff --git a/codenet/public_test_cases/p03572/input.0.txt b/codenet/public_test_cases/p03572/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d080ca626ae28126cef844007c6d9d8c52491f0 --- /dev/null +++ b/codenet/public_test_cases/p03572/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 3 +2 3 1 diff --git a/codenet/public_test_cases/p03572/input.1.txt b/codenet/public_test_cases/p03572/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d080ca626ae28126cef844007c6d9d8c52491f0 --- /dev/null +++ b/codenet/public_test_cases/p03572/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 3 +2 3 1 diff --git a/codenet/public_test_cases/p03572/input.2.txt b/codenet/public_test_cases/p03572/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9005bae1a08640dea5aef6c8dd4e670725084aad --- /dev/null +++ b/codenet/public_test_cases/p03572/input.2.txt @@ -0,0 +1,3 @@ +9 +4 5 6 7 8 9 1 2 3 +7 8 9 1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p03572/input.3.txt b/codenet/public_test_cases/p03572/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b186e0a22bc3d061de3cdfe175d2bcfe3a4cf33d --- /dev/null +++ b/codenet/public_test_cases/p03572/input.3.txt @@ -0,0 +1,3 @@ +6 +1 2 3 4 5 6 +2 1 4 3 6 5 diff --git a/codenet/public_test_cases/p03572/input.4.txt b/codenet/public_test_cases/p03572/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0139c299951a85ea18f7c8b358244356b953fb1 --- /dev/null +++ b/codenet/public_test_cases/p03572/input.4.txt @@ -0,0 +1,3 @@ +3 +1 2 3 +1 2 3 diff --git a/codenet/public_test_cases/p03572/input.5.txt b/codenet/public_test_cases/p03572/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..54c9bcc88a45b44c407ce6ad8e2765709c862500 --- /dev/null +++ b/codenet/public_test_cases/p03572/input.5.txt @@ -0,0 +1,3 @@ +6 +1 2 3 4 5 6 +6 5 4 3 2 1 diff --git a/codenet/public_test_cases/p03572/output.0.txt b/codenet/public_test_cases/p03572/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03572/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03572/output.1.txt b/codenet/public_test_cases/p03572/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03572/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03572/output.2.txt b/codenet/public_test_cases/p03572/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..afbdde3319f5b519d76b4b015bf954ec894e2c18 --- /dev/null +++ b/codenet/public_test_cases/p03572/output.2.txt @@ -0,0 +1 @@ +33600 diff --git a/codenet/public_test_cases/p03572/output.3.txt b/codenet/public_test_cases/p03572/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p03572/output.3.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p03572/output.4.txt b/codenet/public_test_cases/p03572/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03572/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03572/output.5.txt b/codenet/public_test_cases/p03572/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..a76256037d61ef7aed02f761d7673513e814e747 --- /dev/null +++ b/codenet/public_test_cases/p03572/output.5.txt @@ -0,0 +1 @@ +160 diff --git a/codenet/public_test_cases/p03573/input.0.txt b/codenet/public_test_cases/p03573/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f1497a8f8479aa395017cb862f6aecb9445987e --- /dev/null +++ b/codenet/public_test_cases/p03573/input.0.txt @@ -0,0 +1 @@ +5 7 5 diff --git a/codenet/public_test_cases/p03573/input.1.txt b/codenet/public_test_cases/p03573/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f1497a8f8479aa395017cb862f6aecb9445987e --- /dev/null +++ b/codenet/public_test_cases/p03573/input.1.txt @@ -0,0 +1 @@ +5 7 5 diff --git a/codenet/public_test_cases/p03573/input.2.txt b/codenet/public_test_cases/p03573/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0570047f5e6e837d1e518e41c0418dff45f5d4c --- /dev/null +++ b/codenet/public_test_cases/p03573/input.2.txt @@ -0,0 +1 @@ +-100 100 100 diff --git a/codenet/public_test_cases/p03573/input.3.txt b/codenet/public_test_cases/p03573/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..747c5e3e594c3970a6366e434ea91854c811fe66 --- /dev/null +++ b/codenet/public_test_cases/p03573/input.3.txt @@ -0,0 +1 @@ +1 1 7 diff --git a/codenet/public_test_cases/p03573/output.0.txt b/codenet/public_test_cases/p03573/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03573/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03573/output.1.txt b/codenet/public_test_cases/p03573/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03573/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03573/output.2.txt b/codenet/public_test_cases/p03573/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e96acb9254becae7d57c63a77897b49f2688c9e1 --- /dev/null +++ b/codenet/public_test_cases/p03573/output.2.txt @@ -0,0 +1 @@ +-100 diff --git a/codenet/public_test_cases/p03573/output.3.txt b/codenet/public_test_cases/p03573/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03573/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03574/input.0.txt b/codenet/public_test_cases/p03574/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2de4b27b1efa8cebbfacdfd2c162f20042426c09 --- /dev/null +++ b/codenet/public_test_cases/p03574/input.0.txt @@ -0,0 +1,4 @@ +3 5 +..... +.#.#. +..... diff --git a/codenet/public_test_cases/p03574/input.1.txt b/codenet/public_test_cases/p03574/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2de4b27b1efa8cebbfacdfd2c162f20042426c09 --- /dev/null +++ b/codenet/public_test_cases/p03574/input.1.txt @@ -0,0 +1,4 @@ +3 5 +..... +.#.#. +..... diff --git a/codenet/public_test_cases/p03574/input.2.txt b/codenet/public_test_cases/p03574/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p03574/input.2.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p03574/input.3.txt b/codenet/public_test_cases/p03574/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ec177fd57a2745b330667259831bda1e294f07f --- /dev/null +++ b/codenet/public_test_cases/p03574/input.3.txt @@ -0,0 +1,7 @@ +6 6 +. +.#.## +.# +.#..#. +.##.. +.#... diff --git a/codenet/public_test_cases/p03574/output.0.txt b/codenet/public_test_cases/p03574/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c797e255780b6f64b5720e1e918cdb71480ab6a --- /dev/null +++ b/codenet/public_test_cases/p03574/output.0.txt @@ -0,0 +1,3 @@ +11211 +1#2#1 +11211 diff --git a/codenet/public_test_cases/p03574/output.1.txt b/codenet/public_test_cases/p03574/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c797e255780b6f64b5720e1e918cdb71480ab6a --- /dev/null +++ b/codenet/public_test_cases/p03574/output.1.txt @@ -0,0 +1,3 @@ +11211 +1#2#1 +11211 diff --git a/codenet/public_test_cases/p03574/output.2.txt b/codenet/public_test_cases/p03574/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p03574/output.2.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p03574/output.3.txt b/codenet/public_test_cases/p03574/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..33bb793ae1505318753b3f3326ca318172d29532 --- /dev/null +++ b/codenet/public_test_cases/p03574/output.3.txt @@ -0,0 +1,6 @@ +3 +8#7## +5# +4#65#2 +5##21 +4#310 diff --git a/codenet/public_test_cases/p03575/input.0.txt b/codenet/public_test_cases/p03575/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..052f07af20aa7390e7dda7eed469604a7fcced87 --- /dev/null +++ b/codenet/public_test_cases/p03575/input.0.txt @@ -0,0 +1,8 @@ +7 7 +1 3 +2 7 +3 4 +4 5 +4 6 +5 6 +6 7 diff --git a/codenet/public_test_cases/p03575/input.1.txt b/codenet/public_test_cases/p03575/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc88773658f25592fbc224fa48bd285513c79119 --- /dev/null +++ b/codenet/public_test_cases/p03575/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03575/input.2.txt b/codenet/public_test_cases/p03575/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..23c6e7c10e1b348c722c0dfc6f2413d74bc1698b --- /dev/null +++ b/codenet/public_test_cases/p03575/input.2.txt @@ -0,0 +1,6 @@ +6 5 +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p03575/input.3.txt b/codenet/public_test_cases/p03575/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..052f07af20aa7390e7dda7eed469604a7fcced87 --- /dev/null +++ b/codenet/public_test_cases/p03575/input.3.txt @@ -0,0 +1,8 @@ +7 7 +1 3 +2 7 +3 4 +4 5 +4 6 +5 6 +6 7 diff --git a/codenet/public_test_cases/p03575/output.0.txt b/codenet/public_test_cases/p03575/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03575/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03575/output.1.txt b/codenet/public_test_cases/p03575/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03575/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03575/output.2.txt b/codenet/public_test_cases/p03575/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03575/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03575/output.3.txt b/codenet/public_test_cases/p03575/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03575/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03576/input.0.txt b/codenet/public_test_cases/p03576/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5128c2de943a9b7dbc4e9c1a99295ca5e62deeb2 --- /dev/null +++ b/codenet/public_test_cases/p03576/input.0.txt @@ -0,0 +1,5 @@ +4 4 +1 4 +3 3 +6 2 +8 1 diff --git a/codenet/public_test_cases/p03576/input.1.txt b/codenet/public_test_cases/p03576/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..07518943fe1e1f4e3faaed64dcd9a6d6481357d5 --- /dev/null +++ b/codenet/public_test_cases/p03576/input.1.txt @@ -0,0 +1,5 @@ +4 3 +-1000000000 -1000000000 +1000000000 1000000000 +-999999999 999999999 +999999999 -999999999 diff --git a/codenet/public_test_cases/p03576/input.2.txt b/codenet/public_test_cases/p03576/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e237cdbb3925cb7ac047b8c051216519280bb1cc --- /dev/null +++ b/codenet/public_test_cases/p03576/input.2.txt @@ -0,0 +1,5 @@ +4 2 +0 0 +1 1 +2 2 +3 3 diff --git a/codenet/public_test_cases/p03576/input.3.txt b/codenet/public_test_cases/p03576/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5128c2de943a9b7dbc4e9c1a99295ca5e62deeb2 --- /dev/null +++ b/codenet/public_test_cases/p03576/input.3.txt @@ -0,0 +1,5 @@ +4 4 +1 4 +3 3 +6 2 +8 1 diff --git a/codenet/public_test_cases/p03576/output.0.txt b/codenet/public_test_cases/p03576/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03576/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03576/output.1.txt b/codenet/public_test_cases/p03576/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c02cf7e15192aacdea377a21f8462ed8d1513918 --- /dev/null +++ b/codenet/public_test_cases/p03576/output.1.txt @@ -0,0 +1 @@ +3999999996000000001 diff --git a/codenet/public_test_cases/p03576/output.2.txt b/codenet/public_test_cases/p03576/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03576/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03576/output.3.txt b/codenet/public_test_cases/p03576/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03576/output.3.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03577/input.0.txt b/codenet/public_test_cases/p03577/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6278f144219063e186191a7a5d52cfbddda36ce0 --- /dev/null +++ b/codenet/public_test_cases/p03577/input.0.txt @@ -0,0 +1 @@ +CODEFESTIVAL diff --git a/codenet/public_test_cases/p03577/input.1.txt b/codenet/public_test_cases/p03577/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a154b22c13358dfda0232c8e217196811e4c6d5 --- /dev/null +++ b/codenet/public_test_cases/p03577/input.1.txt @@ -0,0 +1 @@ +YAKINIKUFESTIVAL diff --git a/codenet/public_test_cases/p03577/input.2.txt b/codenet/public_test_cases/p03577/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f4cd0b88e10022d84e38bb2cbd3fcf5b5108854 --- /dev/null +++ b/codenet/public_test_cases/p03577/input.2.txt @@ -0,0 +1 @@ +CODEFESTIVALFESTIVAL diff --git a/codenet/public_test_cases/p03577/input.3.txt b/codenet/public_test_cases/p03577/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6278f144219063e186191a7a5d52cfbddda36ce0 --- /dev/null +++ b/codenet/public_test_cases/p03577/input.3.txt @@ -0,0 +1 @@ +CODEFESTIVAL diff --git a/codenet/public_test_cases/p03577/output.0.txt b/codenet/public_test_cases/p03577/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..73dfa4644f07f3719f51d627d4d3c91de25a1667 --- /dev/null +++ b/codenet/public_test_cases/p03577/output.0.txt @@ -0,0 +1 @@ +CODE diff --git a/codenet/public_test_cases/p03577/output.1.txt b/codenet/public_test_cases/p03577/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f15d90253bfebfc4698b8dc987a8c49fd93bd23c --- /dev/null +++ b/codenet/public_test_cases/p03577/output.1.txt @@ -0,0 +1 @@ +YAKINIKU diff --git a/codenet/public_test_cases/p03577/output.2.txt b/codenet/public_test_cases/p03577/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6278f144219063e186191a7a5d52cfbddda36ce0 --- /dev/null +++ b/codenet/public_test_cases/p03577/output.2.txt @@ -0,0 +1 @@ +CODEFESTIVAL diff --git a/codenet/public_test_cases/p03577/output.3.txt b/codenet/public_test_cases/p03577/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..73dfa4644f07f3719f51d627d4d3c91de25a1667 --- /dev/null +++ b/codenet/public_test_cases/p03577/output.3.txt @@ -0,0 +1 @@ +CODE diff --git a/codenet/public_test_cases/p03578/input.0.txt b/codenet/public_test_cases/p03578/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05fe154fa223abce8688ab17ece5eb9e534abe97 --- /dev/null +++ b/codenet/public_test_cases/p03578/input.0.txt @@ -0,0 +1,4 @@ +5 +3 1 4 1 5 +3 +5 4 3 diff --git a/codenet/public_test_cases/p03578/input.1.txt b/codenet/public_test_cases/p03578/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..05fe154fa223abce8688ab17ece5eb9e534abe97 --- /dev/null +++ b/codenet/public_test_cases/p03578/input.1.txt @@ -0,0 +1,4 @@ +5 +3 1 4 1 5 +3 +5 4 3 diff --git a/codenet/public_test_cases/p03578/input.2.txt b/codenet/public_test_cases/p03578/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..98816f574656d2dda13fdd93af63d41bf9f7015e --- /dev/null +++ b/codenet/public_test_cases/p03578/input.2.txt @@ -0,0 +1,4 @@ +1 +800 +5 +100 100 100 100 100 diff --git a/codenet/public_test_cases/p03578/input.3.txt b/codenet/public_test_cases/p03578/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d34026d41da3b9db55d9a074947b3ccac677da9a --- /dev/null +++ b/codenet/public_test_cases/p03578/input.3.txt @@ -0,0 +1,4 @@ +15 +1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 +9 +5 4 3 2 1 2 3 4 5 diff --git a/codenet/public_test_cases/p03578/input.4.txt b/codenet/public_test_cases/p03578/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..81e4ea25213d6bee15706d8a77f910d18afba624 --- /dev/null +++ b/codenet/public_test_cases/p03578/input.4.txt @@ -0,0 +1,4 @@ +7 +100 200 500 700 1200 1600 2000 +6 +100 200 500 700 1600 1600 diff --git a/codenet/public_test_cases/p03578/output.0.txt b/codenet/public_test_cases/p03578/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03578/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03578/output.1.txt b/codenet/public_test_cases/p03578/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03578/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03578/output.2.txt b/codenet/public_test_cases/p03578/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03578/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03578/output.3.txt b/codenet/public_test_cases/p03578/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03578/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03578/output.4.txt b/codenet/public_test_cases/p03578/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03578/output.4.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03579/input.0.txt b/codenet/public_test_cases/p03579/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23c6e7c10e1b348c722c0dfc6f2413d74bc1698b --- /dev/null +++ b/codenet/public_test_cases/p03579/input.0.txt @@ -0,0 +1,6 @@ +6 5 +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p03579/input.1.txt b/codenet/public_test_cases/p03579/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..23c6e7c10e1b348c722c0dfc6f2413d74bc1698b --- /dev/null +++ b/codenet/public_test_cases/p03579/input.1.txt @@ -0,0 +1,6 @@ +6 5 +1 2 +2 3 +3 4 +4 5 +5 6 diff --git a/codenet/public_test_cases/p03579/input.2.txt b/codenet/public_test_cases/p03579/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..02b61e61ec3ca20984d01fc43a29dd57b06b0c9c --- /dev/null +++ b/codenet/public_test_cases/p03579/input.2.txt @@ -0,0 +1,6 @@ +5 5 +1 2 +2 3 +3 1 +5 4 +5 1 diff --git a/codenet/public_test_cases/p03579/output.0.txt b/codenet/public_test_cases/p03579/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03579/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03579/output.1.txt b/codenet/public_test_cases/p03579/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03579/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03579/output.2.txt b/codenet/public_test_cases/p03579/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03579/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03580/input.0.txt b/codenet/public_test_cases/p03580/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d19331b2e70ee9ec63ba0969f111600efea2b890 --- /dev/null +++ b/codenet/public_test_cases/p03580/input.0.txt @@ -0,0 +1,2 @@ +7 +1010101 diff --git a/codenet/public_test_cases/p03580/input.1.txt b/codenet/public_test_cases/p03580/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d19331b2e70ee9ec63ba0969f111600efea2b890 --- /dev/null +++ b/codenet/public_test_cases/p03580/input.1.txt @@ -0,0 +1,2 @@ +7 +1010101 diff --git a/codenet/public_test_cases/p03580/input.2.txt b/codenet/public_test_cases/p03580/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fba2dee1811275ad97bafe2fc313f207e2d85858 --- /dev/null +++ b/codenet/public_test_cases/p03580/input.2.txt @@ -0,0 +1,2 @@ +50 +10101000010011011110001001111110000101010111100110 diff --git a/codenet/public_test_cases/p03580/output.0.txt b/codenet/public_test_cases/p03580/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03580/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03580/output.1.txt b/codenet/public_test_cases/p03580/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03580/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03580/output.2.txt b/codenet/public_test_cases/p03580/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03580/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03581/input.0.txt b/codenet/public_test_cases/p03581/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p03581/input.0.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p03581/input.1.txt b/codenet/public_test_cases/p03581/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45dbbecd30d62729b1acadb04f7907f77aaa9741 --- /dev/null +++ b/codenet/public_test_cases/p03581/input.1.txt @@ -0,0 +1 @@ +1987 1789 diff --git a/codenet/public_test_cases/p03581/input.2.txt b/codenet/public_test_cases/p03581/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8835c0701f66f328251eac951d4278ae8acd00a1 --- /dev/null +++ b/codenet/public_test_cases/p03581/input.2.txt @@ -0,0 +1 @@ +4 4 diff --git a/codenet/public_test_cases/p03581/input.3.txt b/codenet/public_test_cases/p03581/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p03581/input.3.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p03581/input.4.txt b/codenet/public_test_cases/p03581/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5b6096201d6b1d532a4301f492b7736cdde9c91 --- /dev/null +++ b/codenet/public_test_cases/p03581/input.4.txt @@ -0,0 +1 @@ +7 9 diff --git a/codenet/public_test_cases/p03581/output.0.txt b/codenet/public_test_cases/p03581/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03581/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03581/output.1.txt b/codenet/public_test_cases/p03581/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7379a9814b35e819da7aac8e1a5381bcb5d5232 --- /dev/null +++ b/codenet/public_test_cases/p03581/output.1.txt @@ -0,0 +1 @@ +456315553 diff --git a/codenet/public_test_cases/p03581/output.2.txt b/codenet/public_test_cases/p03581/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fdcd7c44cb1791f45e7386a8f230e018fd7e052 --- /dev/null +++ b/codenet/public_test_cases/p03581/output.2.txt @@ -0,0 +1 @@ +67 diff --git a/codenet/public_test_cases/p03581/output.3.txt b/codenet/public_test_cases/p03581/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03581/output.3.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03581/output.4.txt b/codenet/public_test_cases/p03581/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f839d3cc3f345f5a17253521e682ff0a11e9a157 --- /dev/null +++ b/codenet/public_test_cases/p03581/output.4.txt @@ -0,0 +1 @@ +7772 diff --git a/codenet/public_test_cases/p03582/input.0.txt b/codenet/public_test_cases/p03582/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fab56448a4e74f00a22d955d939228e8ac9f654 --- /dev/null +++ b/codenet/public_test_cases/p03582/input.0.txt @@ -0,0 +1 @@ +2 2 0 diff --git a/codenet/public_test_cases/p03582/input.1.txt b/codenet/public_test_cases/p03582/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8fab56448a4e74f00a22d955d939228e8ac9f654 --- /dev/null +++ b/codenet/public_test_cases/p03582/input.1.txt @@ -0,0 +1 @@ +2 2 0 diff --git a/codenet/public_test_cases/p03582/input.2.txt b/codenet/public_test_cases/p03582/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc3759002bf5280e344eeadc5dbf9ea31b3e0b78 --- /dev/null +++ b/codenet/public_test_cases/p03582/input.2.txt @@ -0,0 +1 @@ +1 1 1 diff --git a/codenet/public_test_cases/p03582/output.0.txt b/codenet/public_test_cases/p03582/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1790c8d8f24817257c4d9e9bfddcb7e7d001c208 --- /dev/null +++ b/codenet/public_test_cases/p03582/output.0.txt @@ -0,0 +1 @@ +abab diff --git a/codenet/public_test_cases/p03582/output.1.txt b/codenet/public_test_cases/p03582/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1790c8d8f24817257c4d9e9bfddcb7e7d001c208 --- /dev/null +++ b/codenet/public_test_cases/p03582/output.1.txt @@ -0,0 +1 @@ +abab diff --git a/codenet/public_test_cases/p03582/output.2.txt b/codenet/public_test_cases/p03582/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..66a2f4b494cf4aa9e6dbd0668e7b93bb93b4546b --- /dev/null +++ b/codenet/public_test_cases/p03582/output.2.txt @@ -0,0 +1 @@ +acb diff --git a/codenet/public_test_cases/p03583/input.0.txt b/codenet/public_test_cases/p03583/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03583/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03583/input.1.txt b/codenet/public_test_cases/p03583/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03583/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03583/input.2.txt b/codenet/public_test_cases/p03583/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8eef87f3f969b769f1a3495324bf088557f6d72f --- /dev/null +++ b/codenet/public_test_cases/p03583/input.2.txt @@ -0,0 +1 @@ +4664 diff --git a/codenet/public_test_cases/p03583/input.3.txt b/codenet/public_test_cases/p03583/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..294337bb646b5b52727165e0b0200589c4f82d4b --- /dev/null +++ b/codenet/public_test_cases/p03583/input.3.txt @@ -0,0 +1 @@ +3485 diff --git a/codenet/public_test_cases/p03583/output.0.txt b/codenet/public_test_cases/p03583/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..43cebf1df4e79a791597a64647725012587f449f --- /dev/null +++ b/codenet/public_test_cases/p03583/output.0.txt @@ -0,0 +1 @@ +1 2 2 diff --git a/codenet/public_test_cases/p03583/output.1.txt b/codenet/public_test_cases/p03583/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..43cebf1df4e79a791597a64647725012587f449f --- /dev/null +++ b/codenet/public_test_cases/p03583/output.1.txt @@ -0,0 +1 @@ +1 2 2 diff --git a/codenet/public_test_cases/p03583/output.2.txt b/codenet/public_test_cases/p03583/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1e4782dca50611ad7fc314ba3edf71c5f44a59a --- /dev/null +++ b/codenet/public_test_cases/p03583/output.2.txt @@ -0,0 +1 @@ +3498 3498 3498 diff --git a/codenet/public_test_cases/p03583/output.3.txt b/codenet/public_test_cases/p03583/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4621825b6a607250e9329270d4f263119e0807f1 --- /dev/null +++ b/codenet/public_test_cases/p03583/output.3.txt @@ -0,0 +1 @@ +872 1012974 1539173474040 diff --git a/codenet/public_test_cases/p03584/input.0.txt b/codenet/public_test_cases/p03584/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f4c3763d1cd0b8f5cfacf9e4ee6ac2c53c6d5b8 --- /dev/null +++ b/codenet/public_test_cases/p03584/input.0.txt @@ -0,0 +1,4 @@ +3 5 +3 3 +4 4 +2 5 diff --git a/codenet/public_test_cases/p03584/output.0.txt b/codenet/public_test_cases/p03584/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03584/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03585/input.0.txt b/codenet/public_test_cases/p03585/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bee223d572b5a7d591d961dc549fd0d9d32dd16 --- /dev/null +++ b/codenet/public_test_cases/p03585/input.0.txt @@ -0,0 +1,4 @@ +3 +1 1 1 +2 -1 2 +-1 2 2 diff --git a/codenet/public_test_cases/p03585/input.1.txt b/codenet/public_test_cases/p03585/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..561b92eb019fcd5f1612ca530bfe71fe418dc004 --- /dev/null +++ b/codenet/public_test_cases/p03585/input.1.txt @@ -0,0 +1,5 @@ +4 +1 1 2 +1 -1 0 +3 -1 -2 +1 -3 4 diff --git a/codenet/public_test_cases/p03585/input.2.txt b/codenet/public_test_cases/p03585/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bee223d572b5a7d591d961dc549fd0d9d32dd16 --- /dev/null +++ b/codenet/public_test_cases/p03585/input.2.txt @@ -0,0 +1,4 @@ +3 +1 1 1 +2 -1 2 +-1 2 2 diff --git a/codenet/public_test_cases/p03585/input.3.txt b/codenet/public_test_cases/p03585/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..db24a564c8887a8e08d5f0dd5b96e1ee2ec7b493 --- /dev/null +++ b/codenet/public_test_cases/p03585/input.3.txt @@ -0,0 +1,8 @@ +7 +1 7 8 +-2 4 9 +3 -8 -5 +9 2 -14 +6 7 5 +-8 -9 3 +3 8 10 diff --git a/codenet/public_test_cases/p03585/output.0.txt b/codenet/public_test_cases/p03585/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a78a793c547e4d23202d5a5a8e44944abc21aa8 --- /dev/null +++ b/codenet/public_test_cases/p03585/output.0.txt @@ -0,0 +1 @@ +1.000000000000000 1.000000000000000 diff --git a/codenet/public_test_cases/p03585/output.1.txt b/codenet/public_test_cases/p03585/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b79b1751e0b681ed253c89a12f4b0352360e0537 --- /dev/null +++ b/codenet/public_test_cases/p03585/output.1.txt @@ -0,0 +1 @@ +-1.000000000000000 -1.000000000000000 diff --git a/codenet/public_test_cases/p03585/output.2.txt b/codenet/public_test_cases/p03585/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a78a793c547e4d23202d5a5a8e44944abc21aa8 --- /dev/null +++ b/codenet/public_test_cases/p03585/output.2.txt @@ -0,0 +1 @@ +1.000000000000000 1.000000000000000 diff --git a/codenet/public_test_cases/p03585/output.3.txt b/codenet/public_test_cases/p03585/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e24e46fcbe630902fe98fa963b9d5b94f33eba6c --- /dev/null +++ b/codenet/public_test_cases/p03585/output.3.txt @@ -0,0 +1 @@ +-1.722222222222222 1.325000000000000 diff --git a/codenet/public_test_cases/p03586/input.0.txt b/codenet/public_test_cases/p03586/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6bbfa589ed057bf5a9d97837db7065fa3f0adb3 --- /dev/null +++ b/codenet/public_test_cases/p03586/input.0.txt @@ -0,0 +1,5 @@ +4 +2 4 +3 8 +9 6 +10 7 diff --git a/codenet/public_test_cases/p03586/input.1.txt b/codenet/public_test_cases/p03586/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..362e0bf2f1975c381e7dcc7df15836465e477a57 --- /dev/null +++ b/codenet/public_test_cases/p03586/input.1.txt @@ -0,0 +1,4 @@ +3 +177 168 +2028 88772 +123456789 987654321 diff --git a/codenet/public_test_cases/p03586/input.2.txt b/codenet/public_test_cases/p03586/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6bbfa589ed057bf5a9d97837db7065fa3f0adb3 --- /dev/null +++ b/codenet/public_test_cases/p03586/input.2.txt @@ -0,0 +1,5 @@ +4 +2 4 +3 8 +9 6 +10 7 diff --git a/codenet/public_test_cases/p03586/output.0.txt b/codenet/public_test_cases/p03586/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d217aacfe4ca3d0ac76a59f677498e62e3b17f0 --- /dev/null +++ b/codenet/public_test_cases/p03586/output.0.txt @@ -0,0 +1,4 @@ +4 +11 +9 +2 diff --git a/codenet/public_test_cases/p03586/output.1.txt b/codenet/public_test_cases/p03586/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..79543a6406ef963bb078ae04f6e3f465ddf48e0f --- /dev/null +++ b/codenet/public_test_cases/p03586/output.1.txt @@ -0,0 +1,3 @@ +7953 +234831584 +471523108231963269 diff --git a/codenet/public_test_cases/p03586/output.2.txt b/codenet/public_test_cases/p03586/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d217aacfe4ca3d0ac76a59f677498e62e3b17f0 --- /dev/null +++ b/codenet/public_test_cases/p03586/output.2.txt @@ -0,0 +1,4 @@ +4 +11 +9 +2 diff --git a/codenet/public_test_cases/p03587/input.0.txt b/codenet/public_test_cases/p03587/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..91f9bab3bb19e8711179df2cfcae02a5aa4f6b92 --- /dev/null +++ b/codenet/public_test_cases/p03587/input.0.txt @@ -0,0 +1 @@ +111100 diff --git a/codenet/public_test_cases/p03587/input.1.txt b/codenet/public_test_cases/p03587/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b4c127d1d2f545cec1e200772b31526487baa6b --- /dev/null +++ b/codenet/public_test_cases/p03587/input.1.txt @@ -0,0 +1 @@ +001001 diff --git a/codenet/public_test_cases/p03587/input.2.txt b/codenet/public_test_cases/p03587/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4949eb930d0cf4dfe779fb20d06377c49899112 --- /dev/null +++ b/codenet/public_test_cases/p03587/input.2.txt @@ -0,0 +1 @@ +000000 diff --git a/codenet/public_test_cases/p03587/input.3.txt b/codenet/public_test_cases/p03587/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..91f9bab3bb19e8711179df2cfcae02a5aa4f6b92 --- /dev/null +++ b/codenet/public_test_cases/p03587/input.3.txt @@ -0,0 +1 @@ +111100 diff --git a/codenet/public_test_cases/p03587/output.0.txt b/codenet/public_test_cases/p03587/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03587/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03587/output.1.txt b/codenet/public_test_cases/p03587/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03587/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03587/output.2.txt b/codenet/public_test_cases/p03587/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03587/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03587/output.3.txt b/codenet/public_test_cases/p03587/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03587/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03588/input.0.txt b/codenet/public_test_cases/p03588/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2c7f3d0980fea855ea9d1071255711c4cf9fa59 --- /dev/null +++ b/codenet/public_test_cases/p03588/input.0.txt @@ -0,0 +1,4 @@ +3 +4 7 +2 9 +6 2 diff --git a/codenet/public_test_cases/p03588/input.1.txt b/codenet/public_test_cases/p03588/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e2c7f3d0980fea855ea9d1071255711c4cf9fa59 --- /dev/null +++ b/codenet/public_test_cases/p03588/input.1.txt @@ -0,0 +1,4 @@ +3 +4 7 +2 9 +6 2 diff --git a/codenet/public_test_cases/p03588/input.2.txt b/codenet/public_test_cases/p03588/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f220008bd9454808196facc9dde1ad571dce8e9 --- /dev/null +++ b/codenet/public_test_cases/p03588/input.2.txt @@ -0,0 +1,3 @@ +2 +1 1000000000 +1000000000 1 diff --git a/codenet/public_test_cases/p03588/input.3.txt b/codenet/public_test_cases/p03588/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a83c92094b2c9c094d02df7722b08c62e696f2e9 --- /dev/null +++ b/codenet/public_test_cases/p03588/input.3.txt @@ -0,0 +1,6 @@ +5 +1 10 +3 6 +5 2 +4 4 +2 8 diff --git a/codenet/public_test_cases/p03588/output.0.txt b/codenet/public_test_cases/p03588/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03588/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03588/output.1.txt b/codenet/public_test_cases/p03588/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03588/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03588/output.2.txt b/codenet/public_test_cases/p03588/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a528ed87320071ba84058bf3cd59e85b5bb7fd7d --- /dev/null +++ b/codenet/public_test_cases/p03588/output.2.txt @@ -0,0 +1 @@ +1000000001 diff --git a/codenet/public_test_cases/p03588/output.3.txt b/codenet/public_test_cases/p03588/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03588/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03589/input.0.txt b/codenet/public_test_cases/p03589/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03589/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03589/output.0.txt b/codenet/public_test_cases/p03589/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..43cebf1df4e79a791597a64647725012587f449f --- /dev/null +++ b/codenet/public_test_cases/p03589/output.0.txt @@ -0,0 +1 @@ +1 2 2 diff --git a/codenet/public_test_cases/p03590/input.0.txt b/codenet/public_test_cases/p03590/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f4c3763d1cd0b8f5cfacf9e4ee6ac2c53c6d5b8 --- /dev/null +++ b/codenet/public_test_cases/p03590/input.0.txt @@ -0,0 +1,4 @@ +3 5 +3 3 +4 4 +2 5 diff --git a/codenet/public_test_cases/p03590/input.1.txt b/codenet/public_test_cases/p03590/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..953b5b37ca1a455d1bd4e88eadb77d49e9191ed4 --- /dev/null +++ b/codenet/public_test_cases/p03590/input.1.txt @@ -0,0 +1,4 @@ +3 6 +3 3 +4 4 +2 5 diff --git a/codenet/public_test_cases/p03590/input.2.txt b/codenet/public_test_cases/p03590/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f756d3dd0511a71302020952b5d430d68bc5965 --- /dev/null +++ b/codenet/public_test_cases/p03590/input.2.txt @@ -0,0 +1,8 @@ +7 14 +10 5 +7 4 +11 4 +9 8 +3 6 +6 2 +8 9 diff --git a/codenet/public_test_cases/p03590/input.3.txt b/codenet/public_test_cases/p03590/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f4c3763d1cd0b8f5cfacf9e4ee6ac2c53c6d5b8 --- /dev/null +++ b/codenet/public_test_cases/p03590/input.3.txt @@ -0,0 +1,4 @@ +3 5 +3 3 +4 4 +2 5 diff --git a/codenet/public_test_cases/p03590/output.0.txt b/codenet/public_test_cases/p03590/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03590/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03590/output.1.txt b/codenet/public_test_cases/p03590/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03590/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03590/output.2.txt b/codenet/public_test_cases/p03590/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p03590/output.2.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p03590/output.3.txt b/codenet/public_test_cases/p03590/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03590/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03591/input.0.txt b/codenet/public_test_cases/p03591/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f15d90253bfebfc4698b8dc987a8c49fd93bd23c --- /dev/null +++ b/codenet/public_test_cases/p03591/input.0.txt @@ -0,0 +1 @@ +YAKINIKU diff --git a/codenet/public_test_cases/p03591/input.1.txt b/codenet/public_test_cases/p03591/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f15d90253bfebfc4698b8dc987a8c49fd93bd23c --- /dev/null +++ b/codenet/public_test_cases/p03591/input.1.txt @@ -0,0 +1 @@ +YAKINIKU diff --git a/codenet/public_test_cases/p03591/input.2.txt b/codenet/public_test_cases/p03591/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..70d40cbffe290b231b4cbe4fe6cd655e98cb01da --- /dev/null +++ b/codenet/public_test_cases/p03591/input.2.txt @@ -0,0 +1 @@ +TAKOYAKI diff --git a/codenet/public_test_cases/p03591/input.3.txt b/codenet/public_test_cases/p03591/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1020c6f01a5567219929fa395b98a5cffc9e779b --- /dev/null +++ b/codenet/public_test_cases/p03591/input.3.txt @@ -0,0 +1 @@ +YAK diff --git a/codenet/public_test_cases/p03591/output.0.txt b/codenet/public_test_cases/p03591/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03591/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03591/output.1.txt b/codenet/public_test_cases/p03591/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03591/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03591/output.2.txt b/codenet/public_test_cases/p03591/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03591/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03591/output.3.txt b/codenet/public_test_cases/p03591/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03591/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03592/input.0.txt b/codenet/public_test_cases/p03592/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p03592/input.0.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p03592/input.1.txt b/codenet/public_test_cases/p03592/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p03592/input.1.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p03592/input.2.txt b/codenet/public_test_cases/p03592/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac06d91d8aecaaf1ed168da3b63333dfc2e26e6d --- /dev/null +++ b/codenet/public_test_cases/p03592/input.2.txt @@ -0,0 +1 @@ +2 2 1 diff --git a/codenet/public_test_cases/p03592/input.3.txt b/codenet/public_test_cases/p03592/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..74b25dcf266102603bd4911957533375a99b0148 --- /dev/null +++ b/codenet/public_test_cases/p03592/input.3.txt @@ -0,0 +1 @@ +7 9 20 diff --git a/codenet/public_test_cases/p03592/input.4.txt b/codenet/public_test_cases/p03592/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..803684c8a46f4ad036793a8684530ec2decafb74 --- /dev/null +++ b/codenet/public_test_cases/p03592/input.4.txt @@ -0,0 +1 @@ +3 5 8 diff --git a/codenet/public_test_cases/p03592/output.0.txt b/codenet/public_test_cases/p03592/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03592/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03592/output.1.txt b/codenet/public_test_cases/p03592/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03592/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03592/output.2.txt b/codenet/public_test_cases/p03592/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03592/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03592/output.3.txt b/codenet/public_test_cases/p03592/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03592/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03592/output.4.txt b/codenet/public_test_cases/p03592/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03592/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03593/input.0.txt b/codenet/public_test_cases/p03593/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b60f6feb4b124de99677b629f235649c40e01345 --- /dev/null +++ b/codenet/public_test_cases/p03593/input.0.txt @@ -0,0 +1,4 @@ +3 4 +aabb +aabb +aacc diff --git a/codenet/public_test_cases/p03593/input.1.txt b/codenet/public_test_cases/p03593/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..50739428cf195c7b5a188dbcbabed0865aef1871 --- /dev/null +++ b/codenet/public_test_cases/p03593/input.1.txt @@ -0,0 +1,3 @@ +2 5 +abxba +abyba diff --git a/codenet/public_test_cases/p03593/input.2.txt b/codenet/public_test_cases/p03593/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..366f819e264d23683228bdd073fbe10a33e5769d --- /dev/null +++ b/codenet/public_test_cases/p03593/input.2.txt @@ -0,0 +1,6 @@ +5 1 +t +w +e +e +t diff --git a/codenet/public_test_cases/p03593/input.3.txt b/codenet/public_test_cases/p03593/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..415c5a1bed5bc0d48cdda58c5df2e1fb67d88be5 --- /dev/null +++ b/codenet/public_test_cases/p03593/input.3.txt @@ -0,0 +1,3 @@ +2 2 +aa +bb diff --git a/codenet/public_test_cases/p03593/input.4.txt b/codenet/public_test_cases/p03593/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6e07373df8563ac2f5ce1ff7e2d387c2fb5fc24 --- /dev/null +++ b/codenet/public_test_cases/p03593/input.4.txt @@ -0,0 +1,2 @@ +1 1 +z diff --git a/codenet/public_test_cases/p03593/input.5.txt b/codenet/public_test_cases/p03593/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b60f6feb4b124de99677b629f235649c40e01345 --- /dev/null +++ b/codenet/public_test_cases/p03593/input.5.txt @@ -0,0 +1,4 @@ +3 4 +aabb +aabb +aacc diff --git a/codenet/public_test_cases/p03593/output.0.txt b/codenet/public_test_cases/p03593/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03593/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03593/output.1.txt b/codenet/public_test_cases/p03593/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03593/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03593/output.2.txt b/codenet/public_test_cases/p03593/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03593/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03593/output.3.txt b/codenet/public_test_cases/p03593/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03593/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03593/output.4.txt b/codenet/public_test_cases/p03593/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03593/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03593/output.5.txt b/codenet/public_test_cases/p03593/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03593/output.5.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03594/input.0.txt b/codenet/public_test_cases/p03594/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac06d91d8aecaaf1ed168da3b63333dfc2e26e6d --- /dev/null +++ b/codenet/public_test_cases/p03594/input.0.txt @@ -0,0 +1 @@ +2 2 1 diff --git a/codenet/public_test_cases/p03594/input.1.txt b/codenet/public_test_cases/p03594/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac06d91d8aecaaf1ed168da3b63333dfc2e26e6d --- /dev/null +++ b/codenet/public_test_cases/p03594/input.1.txt @@ -0,0 +1 @@ +2 2 1 diff --git a/codenet/public_test_cases/p03594/input.2.txt b/codenet/public_test_cases/p03594/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb09d0419167765fd1dffe4eecba39579415d658 --- /dev/null +++ b/codenet/public_test_cases/p03594/input.2.txt @@ -0,0 +1 @@ +2 3 2 diff --git a/codenet/public_test_cases/p03594/output.0.txt b/codenet/public_test_cases/p03594/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0e9169aeea37eab7c6db5544a9e3949dfae2b30 --- /dev/null +++ b/codenet/public_test_cases/p03594/output.0.txt @@ -0,0 +1,2 @@ +RY +GR diff --git a/codenet/public_test_cases/p03594/output.1.txt b/codenet/public_test_cases/p03594/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0e9169aeea37eab7c6db5544a9e3949dfae2b30 --- /dev/null +++ b/codenet/public_test_cases/p03594/output.1.txt @@ -0,0 +1,2 @@ +RY +GR diff --git a/codenet/public_test_cases/p03594/output.2.txt b/codenet/public_test_cases/p03594/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b5b38851ee5398a9240ec29204ebc4431939bfe --- /dev/null +++ b/codenet/public_test_cases/p03594/output.2.txt @@ -0,0 +1,2 @@ +RYB +RGB diff --git a/codenet/public_test_cases/p03595/input.0.txt b/codenet/public_test_cases/p03595/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c58f48c562f77d93c2701680a2880ebde62c84a7 --- /dev/null +++ b/codenet/public_test_cases/p03595/input.0.txt @@ -0,0 +1,5 @@ +2 2 +10 +01 +10 +01 diff --git a/codenet/public_test_cases/p03595/input.1.txt b/codenet/public_test_cases/p03595/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3517195fd368dcf11bdee47e287fd4522a6cf8a0 --- /dev/null +++ b/codenet/public_test_cases/p03595/input.1.txt @@ -0,0 +1,5 @@ +3 4 +111 +111 +1111 +1111 diff --git a/codenet/public_test_cases/p03595/input.2.txt b/codenet/public_test_cases/p03595/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e68d6b59357320f2932e9e35cd03736de6251c2e --- /dev/null +++ b/codenet/public_test_cases/p03595/input.2.txt @@ -0,0 +1,5 @@ +9 13 +111100001 +010101011 +0000000000000 +1010111111101 diff --git a/codenet/public_test_cases/p03595/input.3.txt b/codenet/public_test_cases/p03595/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a5e2206beff3f777b91d1ac6cb827079a6e7f24 --- /dev/null +++ b/codenet/public_test_cases/p03595/input.3.txt @@ -0,0 +1,5 @@ +2 2 +11 +11 +11 +11 diff --git a/codenet/public_test_cases/p03595/input.4.txt b/codenet/public_test_cases/p03595/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e23ecb46543f307692dcbaf81ad3cd5e569345d6 --- /dev/null +++ b/codenet/public_test_cases/p03595/input.4.txt @@ -0,0 +1,5 @@ +17 21 +11001010101011101 +11001010011010111 +111010101110101111100 +011010110110101000111 diff --git a/codenet/public_test_cases/p03595/input.5.txt b/codenet/public_test_cases/p03595/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..202204cc8c8db3f4415b2ccbbfa9c69ecb7b637e --- /dev/null +++ b/codenet/public_test_cases/p03595/input.5.txt @@ -0,0 +1,5 @@ +23 30 +01010010101010010001110 +11010100100100101010101 +000101001001010010101010101101 +101001000100101001010010101000 diff --git a/codenet/public_test_cases/p03595/input.6.txt b/codenet/public_test_cases/p03595/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..c58f48c562f77d93c2701680a2880ebde62c84a7 --- /dev/null +++ b/codenet/public_test_cases/p03595/input.6.txt @@ -0,0 +1,5 @@ +2 2 +10 +01 +10 +01 diff --git a/codenet/public_test_cases/p03595/input.7.txt b/codenet/public_test_cases/p03595/input.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb46876ac42f833bf7db944426453dd60e448242 --- /dev/null +++ b/codenet/public_test_cases/p03595/input.7.txt @@ -0,0 +1,5 @@ +3 4 +000 +101 +1111 +0010 diff --git a/codenet/public_test_cases/p03595/output.0.txt b/codenet/public_test_cases/p03595/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03595/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03595/output.1.txt b/codenet/public_test_cases/p03595/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b809f8d5b608b051c5cc1eb7de360d80aec1239 --- /dev/null +++ b/codenet/public_test_cases/p03595/output.1.txt @@ -0,0 +1 @@ +1276 diff --git a/codenet/public_test_cases/p03595/output.2.txt b/codenet/public_test_cases/p03595/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..19d9535afb0e2ca4a70d0b4870996f2f9a049eb2 --- /dev/null +++ b/codenet/public_test_cases/p03595/output.2.txt @@ -0,0 +1 @@ +177856 diff --git a/codenet/public_test_cases/p03595/output.3.txt b/codenet/public_test_cases/p03595/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p03595/output.3.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p03595/output.4.txt b/codenet/public_test_cases/p03595/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b3e126fba1807b79f239c3f8a0b45099b615d74 --- /dev/null +++ b/codenet/public_test_cases/p03595/output.4.txt @@ -0,0 +1 @@ +548356548 diff --git a/codenet/public_test_cases/p03595/output.5.txt b/codenet/public_test_cases/p03595/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d401677fead5a2ee397b9e26941182f61512d47c --- /dev/null +++ b/codenet/public_test_cases/p03595/output.5.txt @@ -0,0 +1 @@ +734524988 diff --git a/codenet/public_test_cases/p03595/output.6.txt b/codenet/public_test_cases/p03595/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03595/output.6.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03595/output.7.txt b/codenet/public_test_cases/p03595/output.7.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03595/output.7.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03596/input.0.txt b/codenet/public_test_cases/p03596/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da7e2683930a192d974c42d4a5ff0edf17b08550 --- /dev/null +++ b/codenet/public_test_cases/p03596/input.0.txt @@ -0,0 +1,2 @@ +2 +3 3 diff --git a/codenet/public_test_cases/p03596/input.1.txt b/codenet/public_test_cases/p03596/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f63eb2bbdec3e47773eb4084d4df93d9305f9655 --- /dev/null +++ b/codenet/public_test_cases/p03596/input.1.txt @@ -0,0 +1,2 @@ +10 +3 1 4 1 5 9 2 6 5 3 diff --git a/codenet/public_test_cases/p03596/input.2.txt b/codenet/public_test_cases/p03596/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e37455d6909314e8f437d1f7233e5d7f35780f5b --- /dev/null +++ b/codenet/public_test_cases/p03596/input.2.txt @@ -0,0 +1,2 @@ +4 +2 1 2 2 diff --git a/codenet/public_test_cases/p03596/input.3.txt b/codenet/public_test_cases/p03596/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p03596/input.3.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p03596/input.4.txt b/codenet/public_test_cases/p03596/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..da7e2683930a192d974c42d4a5ff0edf17b08550 --- /dev/null +++ b/codenet/public_test_cases/p03596/input.4.txt @@ -0,0 +1,2 @@ +2 +3 3 diff --git a/codenet/public_test_cases/p03596/output.0.txt b/codenet/public_test_cases/p03596/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03596/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03596/output.1.txt b/codenet/public_test_cases/p03596/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03596/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03596/output.2.txt b/codenet/public_test_cases/p03596/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03596/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03596/output.3.txt b/codenet/public_test_cases/p03596/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03596/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03596/output.4.txt b/codenet/public_test_cases/p03596/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03596/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03597/input.0.txt b/codenet/public_test_cases/p03597/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b94473479cd96f84ea5fdd389a9f4f9d3786b8c1 --- /dev/null +++ b/codenet/public_test_cases/p03597/input.0.txt @@ -0,0 +1,2 @@ +3 +4 diff --git a/codenet/public_test_cases/p03597/input.1.txt b/codenet/public_test_cases/p03597/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b94473479cd96f84ea5fdd389a9f4f9d3786b8c1 --- /dev/null +++ b/codenet/public_test_cases/p03597/input.1.txt @@ -0,0 +1,2 @@ +3 +4 diff --git a/codenet/public_test_cases/p03597/input.2.txt b/codenet/public_test_cases/p03597/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc0829ef1f36f01d8630f1b7d4a72bc1fe072828 --- /dev/null +++ b/codenet/public_test_cases/p03597/input.2.txt @@ -0,0 +1,2 @@ +19 +100 diff --git a/codenet/public_test_cases/p03597/input.3.txt b/codenet/public_test_cases/p03597/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..937bac740bc20c8955f85232d72c06f8bb923b23 --- /dev/null +++ b/codenet/public_test_cases/p03597/input.3.txt @@ -0,0 +1,2 @@ +10 +0 diff --git a/codenet/public_test_cases/p03597/output.0.txt b/codenet/public_test_cases/p03597/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03597/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03597/output.1.txt b/codenet/public_test_cases/p03597/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03597/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03597/output.2.txt b/codenet/public_test_cases/p03597/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fc233b7abc7e73aab2d968759841218fde09dfb --- /dev/null +++ b/codenet/public_test_cases/p03597/output.2.txt @@ -0,0 +1 @@ +261 diff --git a/codenet/public_test_cases/p03597/output.3.txt b/codenet/public_test_cases/p03597/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03597/output.3.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03598/input.0.txt b/codenet/public_test_cases/p03598/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..621d3f69d9e3859d74e3cec7936453dc456107a4 --- /dev/null +++ b/codenet/public_test_cases/p03598/input.0.txt @@ -0,0 +1,3 @@ +1 +10 +2 diff --git a/codenet/public_test_cases/p03598/input.1.txt b/codenet/public_test_cases/p03598/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..621d3f69d9e3859d74e3cec7936453dc456107a4 --- /dev/null +++ b/codenet/public_test_cases/p03598/input.1.txt @@ -0,0 +1,3 @@ +1 +10 +2 diff --git a/codenet/public_test_cases/p03598/input.2.txt b/codenet/public_test_cases/p03598/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..06370ce79d874883193a6426e44f005553d46b7a --- /dev/null +++ b/codenet/public_test_cases/p03598/input.2.txt @@ -0,0 +1,3 @@ +2 +9 +3 6 diff --git a/codenet/public_test_cases/p03598/input.3.txt b/codenet/public_test_cases/p03598/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b82e790c8fddbbbb35cdbd33603029dc359bbd5 --- /dev/null +++ b/codenet/public_test_cases/p03598/input.3.txt @@ -0,0 +1,3 @@ +5 +20 +11 12 9 17 12 diff --git a/codenet/public_test_cases/p03598/output.0.txt b/codenet/public_test_cases/p03598/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03598/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03598/output.1.txt b/codenet/public_test_cases/p03598/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03598/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03598/output.2.txt b/codenet/public_test_cases/p03598/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03598/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03598/output.3.txt b/codenet/public_test_cases/p03598/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fff0a2476aa5c8e60a3ef21cfc66e0cc670920be --- /dev/null +++ b/codenet/public_test_cases/p03598/output.3.txt @@ -0,0 +1 @@ +74 diff --git a/codenet/public_test_cases/p03599/input.0.txt b/codenet/public_test_cases/p03599/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..06354836e229041206f81c510cf52c3bd0293371 --- /dev/null +++ b/codenet/public_test_cases/p03599/input.0.txt @@ -0,0 +1 @@ +1 2 10 20 15 200 diff --git a/codenet/public_test_cases/p03599/input.1.txt b/codenet/public_test_cases/p03599/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74a7475567efc9349a79f4b99b40fa6257a472e5 --- /dev/null +++ b/codenet/public_test_cases/p03599/input.1.txt @@ -0,0 +1 @@ +1 2 1 2 100 1000 diff --git a/codenet/public_test_cases/p03599/input.2.txt b/codenet/public_test_cases/p03599/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..06354836e229041206f81c510cf52c3bd0293371 --- /dev/null +++ b/codenet/public_test_cases/p03599/input.2.txt @@ -0,0 +1 @@ +1 2 10 20 15 200 diff --git a/codenet/public_test_cases/p03599/input.3.txt b/codenet/public_test_cases/p03599/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..616261117b3b0603fe04cb08aaf6b91469f91cb9 --- /dev/null +++ b/codenet/public_test_cases/p03599/input.3.txt @@ -0,0 +1 @@ +17 19 22 26 55 2802 diff --git a/codenet/public_test_cases/p03599/output.0.txt b/codenet/public_test_cases/p03599/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..03c38c3977e4ab37579f0d3d17a5a0e38b148b44 --- /dev/null +++ b/codenet/public_test_cases/p03599/output.0.txt @@ -0,0 +1 @@ +110 10 diff --git a/codenet/public_test_cases/p03599/output.1.txt b/codenet/public_test_cases/p03599/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1500237c24296d952c6c8e739ce43ef8a78914be --- /dev/null +++ b/codenet/public_test_cases/p03599/output.1.txt @@ -0,0 +1 @@ +200 100 diff --git a/codenet/public_test_cases/p03599/output.2.txt b/codenet/public_test_cases/p03599/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..03c38c3977e4ab37579f0d3d17a5a0e38b148b44 --- /dev/null +++ b/codenet/public_test_cases/p03599/output.2.txt @@ -0,0 +1 @@ +110 10 diff --git a/codenet/public_test_cases/p03599/output.3.txt b/codenet/public_test_cases/p03599/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a6d3dc652a2b77cb73f5b91e11f9387b87185e7 --- /dev/null +++ b/codenet/public_test_cases/p03599/output.3.txt @@ -0,0 +1 @@ +2634 934 diff --git a/codenet/public_test_cases/p03600/input.0.txt b/codenet/public_test_cases/p03600/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ba40b3961b9f4f12aac2897d28ebee84b0b41b5 --- /dev/null +++ b/codenet/public_test_cases/p03600/input.0.txt @@ -0,0 +1,4 @@ +3 +0 1 3 +1 0 2 +3 2 0 diff --git a/codenet/public_test_cases/p03600/input.1.txt b/codenet/public_test_cases/p03600/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e8ea178e38eb2e13e5e0126fa8cae1842da873a --- /dev/null +++ b/codenet/public_test_cases/p03600/input.1.txt @@ -0,0 +1,4 @@ +3 +0 1000000000 1000000000 +1000000000 0 1000000000 +1000000000 1000000000 0 diff --git a/codenet/public_test_cases/p03600/input.2.txt b/codenet/public_test_cases/p03600/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ba40b3961b9f4f12aac2897d28ebee84b0b41b5 --- /dev/null +++ b/codenet/public_test_cases/p03600/input.2.txt @@ -0,0 +1,4 @@ +3 +0 1 3 +1 0 2 +3 2 0 diff --git a/codenet/public_test_cases/p03600/input.3.txt b/codenet/public_test_cases/p03600/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..91066a224d710738746b1287b27eea54a337aa16 --- /dev/null +++ b/codenet/public_test_cases/p03600/input.3.txt @@ -0,0 +1,4 @@ +3 +0 1 3 +1 0 1 +3 1 0 diff --git a/codenet/public_test_cases/p03600/input.4.txt b/codenet/public_test_cases/p03600/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..21d1b10b6c9e6def83cc76e086f56a8adbddf38d --- /dev/null +++ b/codenet/public_test_cases/p03600/input.4.txt @@ -0,0 +1,6 @@ +5 +0 21 18 11 28 +21 0 13 10 26 +18 13 0 23 13 +11 10 23 0 17 +28 26 13 17 0 diff --git a/codenet/public_test_cases/p03600/output.0.txt b/codenet/public_test_cases/p03600/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03600/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03600/output.1.txt b/codenet/public_test_cases/p03600/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1911b6e1e0b6ba372db173e7dcb15d7f609827d2 --- /dev/null +++ b/codenet/public_test_cases/p03600/output.1.txt @@ -0,0 +1 @@ +3000000000 diff --git a/codenet/public_test_cases/p03600/output.2.txt b/codenet/public_test_cases/p03600/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03600/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03600/output.3.txt b/codenet/public_test_cases/p03600/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03600/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03600/output.4.txt b/codenet/public_test_cases/p03600/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dde92ddc1a594acd912b467305f36d9f26da45f3 --- /dev/null +++ b/codenet/public_test_cases/p03600/output.4.txt @@ -0,0 +1 @@ +82 diff --git a/codenet/public_test_cases/p03601/input.0.txt b/codenet/public_test_cases/p03601/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..06354836e229041206f81c510cf52c3bd0293371 --- /dev/null +++ b/codenet/public_test_cases/p03601/input.0.txt @@ -0,0 +1 @@ +1 2 10 20 15 200 diff --git a/codenet/public_test_cases/p03601/output.0.txt b/codenet/public_test_cases/p03601/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..03c38c3977e4ab37579f0d3d17a5a0e38b148b44 --- /dev/null +++ b/codenet/public_test_cases/p03601/output.0.txt @@ -0,0 +1 @@ +110 10 diff --git a/codenet/public_test_cases/p03602/input.0.txt b/codenet/public_test_cases/p03602/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ba40b3961b9f4f12aac2897d28ebee84b0b41b5 --- /dev/null +++ b/codenet/public_test_cases/p03602/input.0.txt @@ -0,0 +1,4 @@ +3 +0 1 3 +1 0 2 +3 2 0 diff --git a/codenet/public_test_cases/p03602/output.0.txt b/codenet/public_test_cases/p03602/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03602/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03603/input.0.txt b/codenet/public_test_cases/p03603/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbae4633d8610f4a93578740a88eb5efb2f67342 --- /dev/null +++ b/codenet/public_test_cases/p03603/input.0.txt @@ -0,0 +1,3 @@ +3 +1 1 +4 3 2 diff --git a/codenet/public_test_cases/p03603/input.1.txt b/codenet/public_test_cases/p03603/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbae4633d8610f4a93578740a88eb5efb2f67342 --- /dev/null +++ b/codenet/public_test_cases/p03603/input.1.txt @@ -0,0 +1,3 @@ +3 +1 1 +4 3 2 diff --git a/codenet/public_test_cases/p03603/input.2.txt b/codenet/public_test_cases/p03603/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..89f5c351ae55b789044d16216bc4379b97fb0c23 --- /dev/null +++ b/codenet/public_test_cases/p03603/input.2.txt @@ -0,0 +1,3 @@ +8 +1 1 1 3 4 5 5 +4 1 6 2 2 1 3 3 diff --git a/codenet/public_test_cases/p03603/input.3.txt b/codenet/public_test_cases/p03603/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2c112f580567e7b059620337ff2ef1c7d142f81 --- /dev/null +++ b/codenet/public_test_cases/p03603/input.3.txt @@ -0,0 +1,3 @@ +1 + +0 diff --git a/codenet/public_test_cases/p03603/input.4.txt b/codenet/public_test_cases/p03603/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ada4f5df8a95028c3ab8325e31442a8c782c0b4b --- /dev/null +++ b/codenet/public_test_cases/p03603/input.4.txt @@ -0,0 +1,3 @@ +3 +1 2 +1 2 3 diff --git a/codenet/public_test_cases/p03603/output.0.txt b/codenet/public_test_cases/p03603/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03603/output.0.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03603/output.1.txt b/codenet/public_test_cases/p03603/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03603/output.1.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03603/output.2.txt b/codenet/public_test_cases/p03603/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03603/output.2.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03603/output.3.txt b/codenet/public_test_cases/p03603/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03603/output.3.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03603/output.4.txt b/codenet/public_test_cases/p03603/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p03603/output.4.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p03604/input.0.txt b/codenet/public_test_cases/p03604/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d26dbe20cd2fea504fbb1ddd88f8d210753ddd8 --- /dev/null +++ b/codenet/public_test_cases/p03604/input.0.txt @@ -0,0 +1,5 @@ +2 +1 1 +1 2 +2 1 +2 2 diff --git a/codenet/public_test_cases/p03604/input.1.txt b/codenet/public_test_cases/p03604/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1ac84d82c231d63c14be53db40220a739d4ac9c --- /dev/null +++ b/codenet/public_test_cases/p03604/input.1.txt @@ -0,0 +1,9 @@ +4 +1 1 +2 2 +3 3 +4 4 +1 2 +2 1 +3 4 +4 3 diff --git a/codenet/public_test_cases/p03604/input.2.txt b/codenet/public_test_cases/p03604/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..faef7aa92bfef9f747cce4911d30225a77109350 --- /dev/null +++ b/codenet/public_test_cases/p03604/input.2.txt @@ -0,0 +1,17 @@ +8 +6 2 +5 1 +6 8 +7 8 +6 5 +5 7 +4 3 +1 4 +7 6 +8 3 +2 8 +3 6 +3 2 +8 5 +1 5 +5 8 diff --git a/codenet/public_test_cases/p03604/input.3.txt b/codenet/public_test_cases/p03604/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d26dbe20cd2fea504fbb1ddd88f8d210753ddd8 --- /dev/null +++ b/codenet/public_test_cases/p03604/input.3.txt @@ -0,0 +1,5 @@ +2 +1 1 +1 2 +2 1 +2 2 diff --git a/codenet/public_test_cases/p03604/input.4.txt b/codenet/public_test_cases/p03604/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f5beab78641901c79414eebc39c258866ea46b9 --- /dev/null +++ b/codenet/public_test_cases/p03604/input.4.txt @@ -0,0 +1,7 @@ +3 +1 1 +1 2 +1 3 +2 1 +2 2 +2 3 diff --git a/codenet/public_test_cases/p03604/input.5.txt b/codenet/public_test_cases/p03604/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b91a8acb88f18fd4862c3f09447ec1701917856d --- /dev/null +++ b/codenet/public_test_cases/p03604/input.5.txt @@ -0,0 +1,9 @@ +4 +3 2 +1 2 +4 1 +4 2 +2 2 +4 4 +2 1 +1 3 diff --git a/codenet/public_test_cases/p03604/output.0.txt b/codenet/public_test_cases/p03604/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03604/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03604/output.1.txt b/codenet/public_test_cases/p03604/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bf6eb06ed73887a3abae2753b127a05f3401d5a --- /dev/null +++ b/codenet/public_test_cases/p03604/output.1.txt @@ -0,0 +1 @@ +4480 diff --git a/codenet/public_test_cases/p03604/output.2.txt b/codenet/public_test_cases/p03604/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd3bd0c57e177f0b77f742c24d482880a519318e --- /dev/null +++ b/codenet/public_test_cases/p03604/output.2.txt @@ -0,0 +1 @@ +82060779 diff --git a/codenet/public_test_cases/p03604/output.3.txt b/codenet/public_test_cases/p03604/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03604/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03604/output.4.txt b/codenet/public_test_cases/p03604/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03604/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03604/output.5.txt b/codenet/public_test_cases/p03604/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0d6bf571e8639a356c9364f082a36c0e0cf175f --- /dev/null +++ b/codenet/public_test_cases/p03604/output.5.txt @@ -0,0 +1 @@ +7392 diff --git a/codenet/public_test_cases/p03605/input.0.txt b/codenet/public_test_cases/p03605/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f04c001f3f7fd5d290d0264b4a2c35f7b159ac42 --- /dev/null +++ b/codenet/public_test_cases/p03605/input.0.txt @@ -0,0 +1 @@ +29 diff --git a/codenet/public_test_cases/p03605/input.1.txt b/codenet/public_test_cases/p03605/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f04c001f3f7fd5d290d0264b4a2c35f7b159ac42 --- /dev/null +++ b/codenet/public_test_cases/p03605/input.1.txt @@ -0,0 +1 @@ +29 diff --git a/codenet/public_test_cases/p03605/input.2.txt b/codenet/public_test_cases/p03605/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fe4e495fed81a962c91dde803eb5bbe3aa14261 --- /dev/null +++ b/codenet/public_test_cases/p03605/input.2.txt @@ -0,0 +1 @@ +91 diff --git a/codenet/public_test_cases/p03605/input.3.txt b/codenet/public_test_cases/p03605/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea70ce013438b2e42d5297cf39110708d9cfe033 --- /dev/null +++ b/codenet/public_test_cases/p03605/input.3.txt @@ -0,0 +1 @@ +72 diff --git a/codenet/public_test_cases/p03605/output.0.txt b/codenet/public_test_cases/p03605/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03605/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03605/output.1.txt b/codenet/public_test_cases/p03605/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03605/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03605/output.2.txt b/codenet/public_test_cases/p03605/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03605/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03605/output.3.txt b/codenet/public_test_cases/p03605/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03605/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03606/input.0.txt b/codenet/public_test_cases/p03606/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a23486bd597b8f667459a3acc6c0fd78f9e48dd1 --- /dev/null +++ b/codenet/public_test_cases/p03606/input.0.txt @@ -0,0 +1,2 @@ +1 +24 30 diff --git a/codenet/public_test_cases/p03606/input.1.txt b/codenet/public_test_cases/p03606/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a23486bd597b8f667459a3acc6c0fd78f9e48dd1 --- /dev/null +++ b/codenet/public_test_cases/p03606/input.1.txt @@ -0,0 +1,2 @@ +1 +24 30 diff --git a/codenet/public_test_cases/p03606/input.2.txt b/codenet/public_test_cases/p03606/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2546551f1bdee87e8b49abaefb4ac5a12537e007 --- /dev/null +++ b/codenet/public_test_cases/p03606/input.2.txt @@ -0,0 +1,3 @@ +2 +6 8 +3 3 diff --git a/codenet/public_test_cases/p03606/output.0.txt b/codenet/public_test_cases/p03606/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03606/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03606/output.1.txt b/codenet/public_test_cases/p03606/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03606/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03606/output.2.txt b/codenet/public_test_cases/p03606/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03606/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03607/input.0.txt b/codenet/public_test_cases/p03607/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7282dfabada5e88d9ef1968157c0f732cced671 --- /dev/null +++ b/codenet/public_test_cases/p03607/input.0.txt @@ -0,0 +1,4 @@ +3 +6 +2 +6 diff --git a/codenet/public_test_cases/p03607/input.1.txt b/codenet/public_test_cases/p03607/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7282dfabada5e88d9ef1968157c0f732cced671 --- /dev/null +++ b/codenet/public_test_cases/p03607/input.1.txt @@ -0,0 +1,4 @@ +3 +6 +2 +6 diff --git a/codenet/public_test_cases/p03607/input.2.txt b/codenet/public_test_cases/p03607/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c7892595226176004a889759994a5c07fa57e2b --- /dev/null +++ b/codenet/public_test_cases/p03607/input.2.txt @@ -0,0 +1,5 @@ +4 +2 +5 +5 +2 diff --git a/codenet/public_test_cases/p03607/input.3.txt b/codenet/public_test_cases/p03607/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..041499452d17110a5f46560af9fec6b89ba5c4b8 --- /dev/null +++ b/codenet/public_test_cases/p03607/input.3.txt @@ -0,0 +1,7 @@ +6 +12 +22 +16 +22 +18 +12 diff --git a/codenet/public_test_cases/p03607/output.0.txt b/codenet/public_test_cases/p03607/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03607/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03607/output.1.txt b/codenet/public_test_cases/p03607/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03607/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03607/output.2.txt b/codenet/public_test_cases/p03607/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03607/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03607/output.3.txt b/codenet/public_test_cases/p03607/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03607/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03608/input.0.txt b/codenet/public_test_cases/p03608/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c99749f9160c091c45fe78d87bbdd3cf4703dd3b --- /dev/null +++ b/codenet/public_test_cases/p03608/input.0.txt @@ -0,0 +1,5 @@ +3 3 3 +1 2 3 +1 2 1 +2 3 1 +3 1 4 diff --git a/codenet/public_test_cases/p03608/input.1.txt b/codenet/public_test_cases/p03608/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e47ade297a1752e2e6833d4a24f7b7dac780b973 --- /dev/null +++ b/codenet/public_test_cases/p03608/input.1.txt @@ -0,0 +1,8 @@ +4 6 3 +2 3 4 +1 2 4 +2 3 3 +4 3 1 +1 4 1 +4 2 2 +3 1 6 diff --git a/codenet/public_test_cases/p03608/input.2.txt b/codenet/public_test_cases/p03608/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c99749f9160c091c45fe78d87bbdd3cf4703dd3b --- /dev/null +++ b/codenet/public_test_cases/p03608/input.2.txt @@ -0,0 +1,5 @@ +3 3 3 +1 2 3 +1 2 1 +2 3 1 +3 1 4 diff --git a/codenet/public_test_cases/p03608/input.3.txt b/codenet/public_test_cases/p03608/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d674d468b05a6058982f8b220d777208ffc5a2e --- /dev/null +++ b/codenet/public_test_cases/p03608/input.3.txt @@ -0,0 +1,5 @@ +3 3 2 +1 3 +2 3 2 +1 3 6 +1 2 2 diff --git a/codenet/public_test_cases/p03608/output.0.txt b/codenet/public_test_cases/p03608/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03608/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03608/output.1.txt b/codenet/public_test_cases/p03608/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03608/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03608/output.2.txt b/codenet/public_test_cases/p03608/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03608/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03608/output.3.txt b/codenet/public_test_cases/p03608/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03608/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03609/input.0.txt b/codenet/public_test_cases/p03609/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d998482785a2c1f2ee2df0a322684c23e6cc8a1 --- /dev/null +++ b/codenet/public_test_cases/p03609/input.0.txt @@ -0,0 +1 @@ +100 17 diff --git a/codenet/public_test_cases/p03609/input.1.txt b/codenet/public_test_cases/p03609/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..12f5eb891c322d9a5b97973aa062015954838ad6 --- /dev/null +++ b/codenet/public_test_cases/p03609/input.1.txt @@ -0,0 +1 @@ +48 58 diff --git a/codenet/public_test_cases/p03609/input.2.txt b/codenet/public_test_cases/p03609/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..caf89741fceaaa4127b0607f26763103dc3d00ca --- /dev/null +++ b/codenet/public_test_cases/p03609/input.2.txt @@ -0,0 +1 @@ +1000000000 1000000000 diff --git a/codenet/public_test_cases/p03609/input.3.txt b/codenet/public_test_cases/p03609/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d998482785a2c1f2ee2df0a322684c23e6cc8a1 --- /dev/null +++ b/codenet/public_test_cases/p03609/input.3.txt @@ -0,0 +1 @@ +100 17 diff --git a/codenet/public_test_cases/p03609/output.0.txt b/codenet/public_test_cases/p03609/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76a8b2b7030a5174d272734b25898ecee82a0830 --- /dev/null +++ b/codenet/public_test_cases/p03609/output.0.txt @@ -0,0 +1 @@ +83 diff --git a/codenet/public_test_cases/p03609/output.1.txt b/codenet/public_test_cases/p03609/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03609/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03609/output.2.txt b/codenet/public_test_cases/p03609/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03609/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03609/output.3.txt b/codenet/public_test_cases/p03609/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..76a8b2b7030a5174d272734b25898ecee82a0830 --- /dev/null +++ b/codenet/public_test_cases/p03609/output.3.txt @@ -0,0 +1 @@ +83 diff --git a/codenet/public_test_cases/p03610/input.0.txt b/codenet/public_test_cases/p03610/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ef13d11d0bc8c8cde49253ea4a0cdbea2c9416 --- /dev/null +++ b/codenet/public_test_cases/p03610/input.0.txt @@ -0,0 +1 @@ +atcoder diff --git a/codenet/public_test_cases/p03610/output.0.txt b/codenet/public_test_cases/p03610/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d04ab90941856b9f63463bf2985acdbe97615d86 --- /dev/null +++ b/codenet/public_test_cases/p03610/output.0.txt @@ -0,0 +1 @@ +acdr diff --git a/codenet/public_test_cases/p03611/input.0.txt b/codenet/public_test_cases/p03611/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e87d7a086c27bcb29567dd1086f15cc55abd524 --- /dev/null +++ b/codenet/public_test_cases/p03611/input.0.txt @@ -0,0 +1,2 @@ +7 +3 1 4 1 5 9 2 diff --git a/codenet/public_test_cases/p03611/output.0.txt b/codenet/public_test_cases/p03611/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03611/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03612/input.0.txt b/codenet/public_test_cases/p03612/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28360663082779fc5b0073c379f3bd0a3995650e --- /dev/null +++ b/codenet/public_test_cases/p03612/input.0.txt @@ -0,0 +1,2 @@ +5 +1 4 3 5 2 diff --git a/codenet/public_test_cases/p03612/input.1.txt b/codenet/public_test_cases/p03612/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28360663082779fc5b0073c379f3bd0a3995650e --- /dev/null +++ b/codenet/public_test_cases/p03612/input.1.txt @@ -0,0 +1,2 @@ +5 +1 4 3 5 2 diff --git a/codenet/public_test_cases/p03612/input.2.txt b/codenet/public_test_cases/p03612/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..76c825cf02aafda59e7201090090ef0c952d3672 --- /dev/null +++ b/codenet/public_test_cases/p03612/input.2.txt @@ -0,0 +1,2 @@ +9 +1 2 4 9 5 8 7 3 6 diff --git a/codenet/public_test_cases/p03612/input.3.txt b/codenet/public_test_cases/p03612/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p03612/input.3.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p03612/input.4.txt b/codenet/public_test_cases/p03612/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..65cd4f58526b6a547080920f1f04b3d3a58b80b1 --- /dev/null +++ b/codenet/public_test_cases/p03612/input.4.txt @@ -0,0 +1,2 @@ +2 +2 1 diff --git a/codenet/public_test_cases/p03612/output.0.txt b/codenet/public_test_cases/p03612/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03612/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03612/output.1.txt b/codenet/public_test_cases/p03612/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03612/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03612/output.2.txt b/codenet/public_test_cases/p03612/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03612/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03612/output.3.txt b/codenet/public_test_cases/p03612/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03612/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03612/output.4.txt b/codenet/public_test_cases/p03612/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03612/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03613/input.0.txt b/codenet/public_test_cases/p03613/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e87d7a086c27bcb29567dd1086f15cc55abd524 --- /dev/null +++ b/codenet/public_test_cases/p03613/input.0.txt @@ -0,0 +1,2 @@ +7 +3 1 4 1 5 9 2 diff --git a/codenet/public_test_cases/p03613/input.1.txt b/codenet/public_test_cases/p03613/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e87d7a086c27bcb29567dd1086f15cc55abd524 --- /dev/null +++ b/codenet/public_test_cases/p03613/input.1.txt @@ -0,0 +1,2 @@ +7 +3 1 4 1 5 9 2 diff --git a/codenet/public_test_cases/p03613/input.2.txt b/codenet/public_test_cases/p03613/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4a0ecd37aa595b1e59ef8bbd436f8fe416f97ce --- /dev/null +++ b/codenet/public_test_cases/p03613/input.2.txt @@ -0,0 +1,2 @@ +10 +0 1 2 3 4 5 6 7 8 9 diff --git a/codenet/public_test_cases/p03613/input.3.txt b/codenet/public_test_cases/p03613/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed3a625fa45cfa7ea95b4610d354e6aa7701fe06 --- /dev/null +++ b/codenet/public_test_cases/p03613/input.3.txt @@ -0,0 +1,2 @@ +1 +99999 diff --git a/codenet/public_test_cases/p03613/output.0.txt b/codenet/public_test_cases/p03613/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03613/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03613/output.1.txt b/codenet/public_test_cases/p03613/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03613/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03613/output.2.txt b/codenet/public_test_cases/p03613/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03613/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03613/output.3.txt b/codenet/public_test_cases/p03613/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03613/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03614/input.0.txt b/codenet/public_test_cases/p03614/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28360663082779fc5b0073c379f3bd0a3995650e --- /dev/null +++ b/codenet/public_test_cases/p03614/input.0.txt @@ -0,0 +1,2 @@ +5 +1 4 3 5 2 diff --git a/codenet/public_test_cases/p03614/output.0.txt b/codenet/public_test_cases/p03614/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03614/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03615/input.0.txt b/codenet/public_test_cases/p03615/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6261c29d220c9a855c0a499a2e85bfb30611d6b9 --- /dev/null +++ b/codenet/public_test_cases/p03615/input.0.txt @@ -0,0 +1,5 @@ +4 +0 0 +0 1 +1 0 +1 1 diff --git a/codenet/public_test_cases/p03615/input.1.txt b/codenet/public_test_cases/p03615/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..604bcf4a2a9eec3bf7833d6449b85e48bafde28d --- /dev/null +++ b/codenet/public_test_cases/p03615/input.1.txt @@ -0,0 +1,2 @@ +1 +3141 2718 diff --git a/codenet/public_test_cases/p03615/input.2.txt b/codenet/public_test_cases/p03615/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6261c29d220c9a855c0a499a2e85bfb30611d6b9 --- /dev/null +++ b/codenet/public_test_cases/p03615/input.2.txt @@ -0,0 +1,5 @@ +4 +0 0 +0 1 +1 0 +1 1 diff --git a/codenet/public_test_cases/p03615/input.3.txt b/codenet/public_test_cases/p03615/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..77bea69e4f6a4681073eba07f3b75351e51f0abc --- /dev/null +++ b/codenet/public_test_cases/p03615/input.3.txt @@ -0,0 +1,6 @@ +5 +0 0 +0 1 +0 2 +0 3 +1 1 diff --git a/codenet/public_test_cases/p03615/output.0.txt b/codenet/public_test_cases/p03615/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03615/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03615/output.1.txt b/codenet/public_test_cases/p03615/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03615/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03615/output.2.txt b/codenet/public_test_cases/p03615/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03615/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03615/output.3.txt b/codenet/public_test_cases/p03615/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03615/output.3.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03616/input.0.txt b/codenet/public_test_cases/p03616/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc792429d3d86d714d751cefaf663562b44bec42 --- /dev/null +++ b/codenet/public_test_cases/p03616/input.0.txt @@ -0,0 +1,7 @@ +180 +3 +60 120 180 +3 +30 90 +61 1 +180 180 diff --git a/codenet/public_test_cases/p03616/input.1.txt b/codenet/public_test_cases/p03616/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..069aec92ee68d8d8bc1647bf7e7a6ba9373ab293 --- /dev/null +++ b/codenet/public_test_cases/p03616/input.1.txt @@ -0,0 +1,11 @@ +100 +5 +48 141 231 314 425 +7 +0 19 +50 98 +143 30 +231 55 +342 0 +365 100 +600 10 diff --git a/codenet/public_test_cases/p03616/input.2.txt b/codenet/public_test_cases/p03616/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc792429d3d86d714d751cefaf663562b44bec42 --- /dev/null +++ b/codenet/public_test_cases/p03616/input.2.txt @@ -0,0 +1,7 @@ +180 +3 +60 120 180 +3 +30 90 +61 1 +180 180 diff --git a/codenet/public_test_cases/p03616/input.3.txt b/codenet/public_test_cases/p03616/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..63669fddfe2d99c649d55e6f9b020ac95f5765e5 --- /dev/null +++ b/codenet/public_test_cases/p03616/input.3.txt @@ -0,0 +1,8 @@ +100 +1 +100000 +4 +0 100 +90 100 +100 100 +101 100 diff --git a/codenet/public_test_cases/p03616/output.0.txt b/codenet/public_test_cases/p03616/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..da1ae998ae274097eec0b2b444333308bb62b34a --- /dev/null +++ b/codenet/public_test_cases/p03616/output.0.txt @@ -0,0 +1,3 @@ +60 +1 +120 diff --git a/codenet/public_test_cases/p03616/output.1.txt b/codenet/public_test_cases/p03616/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccd84e91d49fdf473de92e0a5a2ef3a581726bd3 --- /dev/null +++ b/codenet/public_test_cases/p03616/output.1.txt @@ -0,0 +1,7 @@ +19 +52 +91 +10 +58 +42 +100 diff --git a/codenet/public_test_cases/p03616/output.2.txt b/codenet/public_test_cases/p03616/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..da1ae998ae274097eec0b2b444333308bb62b34a --- /dev/null +++ b/codenet/public_test_cases/p03616/output.2.txt @@ -0,0 +1,3 @@ +60 +1 +120 diff --git a/codenet/public_test_cases/p03616/output.3.txt b/codenet/public_test_cases/p03616/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a360ba265329d5eb4f34a9c6a3356d064a0ca70 --- /dev/null +++ b/codenet/public_test_cases/p03616/output.3.txt @@ -0,0 +1,4 @@ +100 +10 +0 +0 diff --git a/codenet/public_test_cases/p03617/input.0.txt b/codenet/public_test_cases/p03617/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14bc83bc9481e8be993b5de1bef35ee665d6b871 --- /dev/null +++ b/codenet/public_test_cases/p03617/input.0.txt @@ -0,0 +1,2 @@ +20 30 70 90 +3 diff --git a/codenet/public_test_cases/p03617/input.1.txt b/codenet/public_test_cases/p03617/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6f2bfd9fc4c72634aab2bd3c25da87129f30119 --- /dev/null +++ b/codenet/public_test_cases/p03617/input.1.txt @@ -0,0 +1,2 @@ +10 100 1000 10000 +1 diff --git a/codenet/public_test_cases/p03617/input.2.txt b/codenet/public_test_cases/p03617/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..14bc83bc9481e8be993b5de1bef35ee665d6b871 --- /dev/null +++ b/codenet/public_test_cases/p03617/input.2.txt @@ -0,0 +1,2 @@ +20 30 70 90 +3 diff --git a/codenet/public_test_cases/p03617/input.3.txt b/codenet/public_test_cases/p03617/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cc4a479d7111e2591b72e2ecece7bf77b335878 --- /dev/null +++ b/codenet/public_test_cases/p03617/input.3.txt @@ -0,0 +1,2 @@ +10000 1000 100 10 +1 diff --git a/codenet/public_test_cases/p03617/input.4.txt b/codenet/public_test_cases/p03617/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b42e1214e2d1ea64221c8ab7b3114f85e3b6470 --- /dev/null +++ b/codenet/public_test_cases/p03617/input.4.txt @@ -0,0 +1,2 @@ +12345678 87654321 12345678 87654321 +123456789 diff --git a/codenet/public_test_cases/p03617/output.0.txt b/codenet/public_test_cases/p03617/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa8f08cb6ff8a30dd34a3b442009bdfc798a7316 --- /dev/null +++ b/codenet/public_test_cases/p03617/output.0.txt @@ -0,0 +1 @@ +150 diff --git a/codenet/public_test_cases/p03617/output.1.txt b/codenet/public_test_cases/p03617/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..425151f3a411f5e088d7753e7c8d016303b1b9d1 --- /dev/null +++ b/codenet/public_test_cases/p03617/output.1.txt @@ -0,0 +1 @@ +40 diff --git a/codenet/public_test_cases/p03617/output.2.txt b/codenet/public_test_cases/p03617/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa8f08cb6ff8a30dd34a3b442009bdfc798a7316 --- /dev/null +++ b/codenet/public_test_cases/p03617/output.2.txt @@ -0,0 +1 @@ +150 diff --git a/codenet/public_test_cases/p03617/output.3.txt b/codenet/public_test_cases/p03617/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03617/output.3.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03617/output.4.txt b/codenet/public_test_cases/p03617/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4ce7e0633ed6986b97b8a840a204e3cb5f59ba5 --- /dev/null +++ b/codenet/public_test_cases/p03617/output.4.txt @@ -0,0 +1 @@ +1524157763907942 diff --git a/codenet/public_test_cases/p03618/input.0.txt b/codenet/public_test_cases/p03618/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..985c8f63f3a78f846de8424066da01f9b8dccdfd --- /dev/null +++ b/codenet/public_test_cases/p03618/input.0.txt @@ -0,0 +1 @@ +aatt diff --git a/codenet/public_test_cases/p03618/input.1.txt b/codenet/public_test_cases/p03618/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0cbc4d4d54bdbc57609fcb344e210df4bdace32 --- /dev/null +++ b/codenet/public_test_cases/p03618/input.1.txt @@ -0,0 +1 @@ +xxxxxxxxxx diff --git a/codenet/public_test_cases/p03618/input.2.txt b/codenet/public_test_cases/p03618/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..985c8f63f3a78f846de8424066da01f9b8dccdfd --- /dev/null +++ b/codenet/public_test_cases/p03618/input.2.txt @@ -0,0 +1 @@ +aatt diff --git a/codenet/public_test_cases/p03618/input.3.txt b/codenet/public_test_cases/p03618/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..474987c2cb0ee4fe61865c86ec86fd4819976874 --- /dev/null +++ b/codenet/public_test_cases/p03618/input.3.txt @@ -0,0 +1 @@ +abracadabra diff --git a/codenet/public_test_cases/p03618/output.0.txt b/codenet/public_test_cases/p03618/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03618/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03618/output.1.txt b/codenet/public_test_cases/p03618/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03618/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03618/output.2.txt b/codenet/public_test_cases/p03618/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03618/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03618/output.3.txt b/codenet/public_test_cases/p03618/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c739b42c4d2ce23786c5350641d0adbf5fa7d6b2 --- /dev/null +++ b/codenet/public_test_cases/p03618/output.3.txt @@ -0,0 +1 @@ +44 diff --git a/codenet/public_test_cases/p03619/input.0.txt b/codenet/public_test_cases/p03619/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceb79111581318ba52417aac5a938d0af10a6801 --- /dev/null +++ b/codenet/public_test_cases/p03619/input.0.txt @@ -0,0 +1,5 @@ +1 1 6 5 +3 +3 2 +5 3 +2 4 diff --git a/codenet/public_test_cases/p03619/input.1.txt b/codenet/public_test_cases/p03619/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e12452264c46651946e113198a0ee8d57c8d7cb --- /dev/null +++ b/codenet/public_test_cases/p03619/input.1.txt @@ -0,0 +1,5 @@ +4 2 2 2 +3 +3 2 +5 3 +2 4 diff --git a/codenet/public_test_cases/p03619/input.2.txt b/codenet/public_test_cases/p03619/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceb79111581318ba52417aac5a938d0af10a6801 --- /dev/null +++ b/codenet/public_test_cases/p03619/input.2.txt @@ -0,0 +1,5 @@ +1 1 6 5 +3 +3 2 +5 3 +2 4 diff --git a/codenet/public_test_cases/p03619/input.3.txt b/codenet/public_test_cases/p03619/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29bd6dc2c7f49b1baa618722240abb4ac2f93ee2 --- /dev/null +++ b/codenet/public_test_cases/p03619/input.3.txt @@ -0,0 +1,5 @@ +3 5 6 4 +3 +3 2 +5 3 +2 4 diff --git a/codenet/public_test_cases/p03619/output.0.txt b/codenet/public_test_cases/p03619/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec5bc18f7940e180de5a1e0e4625b292f5186747 --- /dev/null +++ b/codenet/public_test_cases/p03619/output.0.txt @@ -0,0 +1 @@ +891.415926535897938 diff --git a/codenet/public_test_cases/p03619/output.1.txt b/codenet/public_test_cases/p03619/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b24df817417e1b96e995a742e6ad58a75b82992e --- /dev/null +++ b/codenet/public_test_cases/p03619/output.1.txt @@ -0,0 +1 @@ +211.415926535897938 diff --git a/codenet/public_test_cases/p03619/output.2.txt b/codenet/public_test_cases/p03619/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec5bc18f7940e180de5a1e0e4625b292f5186747 --- /dev/null +++ b/codenet/public_test_cases/p03619/output.2.txt @@ -0,0 +1 @@ +891.415926535897938 diff --git a/codenet/public_test_cases/p03619/output.3.txt b/codenet/public_test_cases/p03619/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..02a609b9eb7f7b1b3a85ebb880745dcc5b8add06 --- /dev/null +++ b/codenet/public_test_cases/p03619/output.3.txt @@ -0,0 +1 @@ +400.000000000000000 diff --git a/codenet/public_test_cases/p03620/input.0.txt b/codenet/public_test_cases/p03620/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7148477869ce68f717f4257b64b01a6088905755 --- /dev/null +++ b/codenet/public_test_cases/p03620/input.0.txt @@ -0,0 +1,2 @@ +1010 +1100 diff --git a/codenet/public_test_cases/p03620/input.1.txt b/codenet/public_test_cases/p03620/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7148477869ce68f717f4257b64b01a6088905755 --- /dev/null +++ b/codenet/public_test_cases/p03620/input.1.txt @@ -0,0 +1,2 @@ +1010 +1100 diff --git a/codenet/public_test_cases/p03620/input.2.txt b/codenet/public_test_cases/p03620/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b261da18d51a39dc2cf0d156791e9c0b35dd83f4 --- /dev/null +++ b/codenet/public_test_cases/p03620/input.2.txt @@ -0,0 +1,2 @@ +1 +0 diff --git a/codenet/public_test_cases/p03620/input.3.txt b/codenet/public_test_cases/p03620/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8fd97b0c518a73fa3fbcb43268ea32199c1d8dc --- /dev/null +++ b/codenet/public_test_cases/p03620/input.3.txt @@ -0,0 +1,2 @@ +11010 +10001 diff --git a/codenet/public_test_cases/p03620/input.4.txt b/codenet/public_test_cases/p03620/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6dd0393f2db485f063163a07360152debe704a4d --- /dev/null +++ b/codenet/public_test_cases/p03620/input.4.txt @@ -0,0 +1,2 @@ +0100100 +1111111 diff --git a/codenet/public_test_cases/p03620/output.0.txt b/codenet/public_test_cases/p03620/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03620/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03620/output.1.txt b/codenet/public_test_cases/p03620/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03620/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03620/output.2.txt b/codenet/public_test_cases/p03620/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03620/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03620/output.3.txt b/codenet/public_test_cases/p03620/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03620/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03620/output.4.txt b/codenet/public_test_cases/p03620/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03620/output.4.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03621/input.0.txt b/codenet/public_test_cases/p03621/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7148477869ce68f717f4257b64b01a6088905755 --- /dev/null +++ b/codenet/public_test_cases/p03621/input.0.txt @@ -0,0 +1,2 @@ +1010 +1100 diff --git a/codenet/public_test_cases/p03621/input.1.txt b/codenet/public_test_cases/p03621/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f14dfcf413e9bcabd34cad00c6a997147b8cfd5 --- /dev/null +++ b/codenet/public_test_cases/p03621/input.1.txt @@ -0,0 +1,2 @@ +01001 +01001 diff --git a/codenet/public_test_cases/p03621/input.2.txt b/codenet/public_test_cases/p03621/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..662e26c096e21fd724c8c64f2897bb57f5744b12 --- /dev/null +++ b/codenet/public_test_cases/p03621/input.2.txt @@ -0,0 +1,2 @@ +101010 +010101 diff --git a/codenet/public_test_cases/p03621/input.3.txt b/codenet/public_test_cases/p03621/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3273e1fc584feb952c3c0f1d25113a2283480e9 --- /dev/null +++ b/codenet/public_test_cases/p03621/input.3.txt @@ -0,0 +1,2 @@ +1101011011110 +0111101011101 diff --git a/codenet/public_test_cases/p03621/input.4.txt b/codenet/public_test_cases/p03621/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7148477869ce68f717f4257b64b01a6088905755 --- /dev/null +++ b/codenet/public_test_cases/p03621/input.4.txt @@ -0,0 +1,2 @@ +1010 +1100 diff --git a/codenet/public_test_cases/p03621/output.0.txt b/codenet/public_test_cases/p03621/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03621/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03621/output.1.txt b/codenet/public_test_cases/p03621/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03621/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03621/output.2.txt b/codenet/public_test_cases/p03621/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7facc89938bbc5635e3d36ffa56b4c85e9b07db8 --- /dev/null +++ b/codenet/public_test_cases/p03621/output.2.txt @@ -0,0 +1 @@ +36 diff --git a/codenet/public_test_cases/p03621/output.3.txt b/codenet/public_test_cases/p03621/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b6d7710340cc19b1ed55b649106e123f05e97d5 --- /dev/null +++ b/codenet/public_test_cases/p03621/output.3.txt @@ -0,0 +1 @@ +932171449 diff --git a/codenet/public_test_cases/p03621/output.4.txt b/codenet/public_test_cases/p03621/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03621/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03622/input.0.txt b/codenet/public_test_cases/p03622/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03622/input.0.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03622/input.1.txt b/codenet/public_test_cases/p03622/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03622/input.1.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03622/input.2.txt b/codenet/public_test_cases/p03622/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03622/input.2.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03622/input.3.txt b/codenet/public_test_cases/p03622/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..afc4d6a1d976cedf052af284f38b9e7ddc63c71f --- /dev/null +++ b/codenet/public_test_cases/p03622/input.3.txt @@ -0,0 +1 @@ +42 23 diff --git a/codenet/public_test_cases/p03622/input.4.txt b/codenet/public_test_cases/p03622/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebcee1a506db729ea7b0e0b6e9b0be36806d16bd --- /dev/null +++ b/codenet/public_test_cases/p03622/input.4.txt @@ -0,0 +1 @@ +3 4 diff --git a/codenet/public_test_cases/p03622/input.5.txt b/codenet/public_test_cases/p03622/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6bc7799eba513be6b20846b727f864fb7acabcd --- /dev/null +++ b/codenet/public_test_cases/p03622/input.5.txt @@ -0,0 +1 @@ +10 10 diff --git a/codenet/public_test_cases/p03622/output.0.txt b/codenet/public_test_cases/p03622/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14f2eab3dff766544ac4b71da727ce58c173eca4 --- /dev/null +++ b/codenet/public_test_cases/p03622/output.0.txt @@ -0,0 +1 @@ +499122178 diff --git a/codenet/public_test_cases/p03622/output.1.txt b/codenet/public_test_cases/p03622/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14f2eab3dff766544ac4b71da727ce58c173eca4 --- /dev/null +++ b/codenet/public_test_cases/p03622/output.1.txt @@ -0,0 +1 @@ +499122178 diff --git a/codenet/public_test_cases/p03622/output.2.txt b/codenet/public_test_cases/p03622/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..86074344efdf296e481ef0d164515c3613ff174b --- /dev/null +++ b/codenet/public_test_cases/p03622/output.2.txt @@ -0,0 +1 @@ +831870297 diff --git a/codenet/public_test_cases/p03622/output.3.txt b/codenet/public_test_cases/p03622/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e48cff7ba9a254f30fcbd74ee5950caf66f4a9d --- /dev/null +++ b/codenet/public_test_cases/p03622/output.3.txt @@ -0,0 +1 @@ +362936761 diff --git a/codenet/public_test_cases/p03622/output.4.txt b/codenet/public_test_cases/p03622/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..462c01438fea9e0092bb423e6e8b5f7520be100e --- /dev/null +++ b/codenet/public_test_cases/p03622/output.4.txt @@ -0,0 +1 @@ +770074220 diff --git a/codenet/public_test_cases/p03622/output.5.txt b/codenet/public_test_cases/p03622/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f5b8aa3c8c2a3936cfa5c7100c057e248a57b72 --- /dev/null +++ b/codenet/public_test_cases/p03622/output.5.txt @@ -0,0 +1 @@ +208827570 diff --git a/codenet/public_test_cases/p03623/input.0.txt b/codenet/public_test_cases/p03623/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2204ecc5a053f6a5ee8d90452489a32bfcc6ccb5 --- /dev/null +++ b/codenet/public_test_cases/p03623/input.0.txt @@ -0,0 +1 @@ +5 2 7 diff --git a/codenet/public_test_cases/p03623/input.1.txt b/codenet/public_test_cases/p03623/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e13bd2e38860dca7e7b45a157e90c87732e04dd6 --- /dev/null +++ b/codenet/public_test_cases/p03623/input.1.txt @@ -0,0 +1 @@ +1 999 1000 diff --git a/codenet/public_test_cases/p03623/input.2.txt b/codenet/public_test_cases/p03623/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2204ecc5a053f6a5ee8d90452489a32bfcc6ccb5 --- /dev/null +++ b/codenet/public_test_cases/p03623/input.2.txt @@ -0,0 +1 @@ +5 2 7 diff --git a/codenet/public_test_cases/p03623/output.0.txt b/codenet/public_test_cases/p03623/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..223b7836fb19fdf64ba2d3cd6173c6a283141f78 --- /dev/null +++ b/codenet/public_test_cases/p03623/output.0.txt @@ -0,0 +1 @@ +B diff --git a/codenet/public_test_cases/p03623/output.1.txt b/codenet/public_test_cases/p03623/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70f10e4db19068f79bc43844b49f3eece45c4e8 --- /dev/null +++ b/codenet/public_test_cases/p03623/output.1.txt @@ -0,0 +1 @@ +A diff --git a/codenet/public_test_cases/p03623/output.2.txt b/codenet/public_test_cases/p03623/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..223b7836fb19fdf64ba2d3cd6173c6a283141f78 --- /dev/null +++ b/codenet/public_test_cases/p03623/output.2.txt @@ -0,0 +1 @@ +B diff --git a/codenet/public_test_cases/p03624/input.0.txt b/codenet/public_test_cases/p03624/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d233b110355c600fd3d90e1134590993e34db52c --- /dev/null +++ b/codenet/public_test_cases/p03624/input.0.txt @@ -0,0 +1 @@ +atcoderregularcontest diff --git a/codenet/public_test_cases/p03624/output.0.txt b/codenet/public_test_cases/p03624/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p03624/output.0.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p03625/input.0.txt b/codenet/public_test_cases/p03625/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae65d60bd8308caf4eec868d523dec9d043a705c --- /dev/null +++ b/codenet/public_test_cases/p03625/input.0.txt @@ -0,0 +1,2 @@ +6 +3 1 2 4 2 1 diff --git a/codenet/public_test_cases/p03625/input.1.txt b/codenet/public_test_cases/p03625/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef7fa3d2ef6c44b7adc8f64474840bd57506772d --- /dev/null +++ b/codenet/public_test_cases/p03625/input.1.txt @@ -0,0 +1,2 @@ +10 +3 3 3 3 4 4 4 5 5 5 diff --git a/codenet/public_test_cases/p03625/input.2.txt b/codenet/public_test_cases/p03625/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae65d60bd8308caf4eec868d523dec9d043a705c --- /dev/null +++ b/codenet/public_test_cases/p03625/input.2.txt @@ -0,0 +1,2 @@ +6 +3 1 2 4 2 1 diff --git a/codenet/public_test_cases/p03625/input.3.txt b/codenet/public_test_cases/p03625/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a4d515660c3c567ab07859fc5e252f8c966e46 --- /dev/null +++ b/codenet/public_test_cases/p03625/input.3.txt @@ -0,0 +1,2 @@ +4 +1 2 3 4 diff --git a/codenet/public_test_cases/p03625/output.0.txt b/codenet/public_test_cases/p03625/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03625/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03625/output.1.txt b/codenet/public_test_cases/p03625/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03625/output.1.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03625/output.2.txt b/codenet/public_test_cases/p03625/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03625/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03625/output.3.txt b/codenet/public_test_cases/p03625/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03625/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03626/input.0.txt b/codenet/public_test_cases/p03626/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..17f3b341e036676c79e060576a75b1cd9f0b4b50 --- /dev/null +++ b/codenet/public_test_cases/p03626/input.0.txt @@ -0,0 +1,3 @@ +3 +aab +ccb diff --git a/codenet/public_test_cases/p03626/input.1.txt b/codenet/public_test_cases/p03626/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f067cac32e9e5a9353d207d68ace470edcf66f2c --- /dev/null +++ b/codenet/public_test_cases/p03626/input.1.txt @@ -0,0 +1,3 @@ +1 +Z +Z diff --git a/codenet/public_test_cases/p03626/input.2.txt b/codenet/public_test_cases/p03626/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7237cdf2de5826eb2cebd450b4a02e0adac3286e --- /dev/null +++ b/codenet/public_test_cases/p03626/input.2.txt @@ -0,0 +1,3 @@ +52 +RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn +RLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn diff --git a/codenet/public_test_cases/p03626/input.3.txt b/codenet/public_test_cases/p03626/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..17f3b341e036676c79e060576a75b1cd9f0b4b50 --- /dev/null +++ b/codenet/public_test_cases/p03626/input.3.txt @@ -0,0 +1,3 @@ +3 +aab +ccb diff --git a/codenet/public_test_cases/p03626/output.0.txt b/codenet/public_test_cases/p03626/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03626/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03626/output.1.txt b/codenet/public_test_cases/p03626/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03626/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03626/output.2.txt b/codenet/public_test_cases/p03626/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..71a64baa35b28ff5112352e4956afdb1a1090c43 --- /dev/null +++ b/codenet/public_test_cases/p03626/output.2.txt @@ -0,0 +1 @@ +958681902 diff --git a/codenet/public_test_cases/p03626/output.3.txt b/codenet/public_test_cases/p03626/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03626/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03627/input.0.txt b/codenet/public_test_cases/p03627/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae65d60bd8308caf4eec868d523dec9d043a705c --- /dev/null +++ b/codenet/public_test_cases/p03627/input.0.txt @@ -0,0 +1,2 @@ +6 +3 1 2 4 2 1 diff --git a/codenet/public_test_cases/p03627/output.0.txt b/codenet/public_test_cases/p03627/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03627/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03628/input.0.txt b/codenet/public_test_cases/p03628/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..17f3b341e036676c79e060576a75b1cd9f0b4b50 --- /dev/null +++ b/codenet/public_test_cases/p03628/input.0.txt @@ -0,0 +1,3 @@ +3 +aab +ccb diff --git a/codenet/public_test_cases/p03628/output.0.txt b/codenet/public_test_cases/p03628/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03628/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03629/input.0.txt b/codenet/public_test_cases/p03629/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d233b110355c600fd3d90e1134590993e34db52c --- /dev/null +++ b/codenet/public_test_cases/p03629/input.0.txt @@ -0,0 +1 @@ +atcoderregularcontest diff --git a/codenet/public_test_cases/p03629/input.1.txt b/codenet/public_test_cases/p03629/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..acc370c91e2a9ac7f267ec3c550660993c7c8cb6 --- /dev/null +++ b/codenet/public_test_cases/p03629/input.1.txt @@ -0,0 +1 @@ +frqnvhydscshfcgdemurlfrutcpzhopfotpifgepnqjxupnskapziurswqazdwnwbgdhyktfyhqqxpoidfhjdakoxraiedxskywuepzfniuyskxiyjpjlxuqnfgmnjcvtlpnclfkpervxmdbvrbrdn diff --git a/codenet/public_test_cases/p03629/input.2.txt b/codenet/public_test_cases/p03629/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b0883f382e1a80609b7b2c7904e701fbe6760b14 --- /dev/null +++ b/codenet/public_test_cases/p03629/input.2.txt @@ -0,0 +1 @@ +abcdefghijklmnopqrstuvwxyz diff --git a/codenet/public_test_cases/p03629/input.3.txt b/codenet/public_test_cases/p03629/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d233b110355c600fd3d90e1134590993e34db52c --- /dev/null +++ b/codenet/public_test_cases/p03629/input.3.txt @@ -0,0 +1 @@ +atcoderregularcontest diff --git a/codenet/public_test_cases/p03629/output.0.txt b/codenet/public_test_cases/p03629/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p03629/output.0.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p03629/output.1.txt b/codenet/public_test_cases/p03629/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d002497f8b08b369ebf42d5f0e3f49c22bd3930 --- /dev/null +++ b/codenet/public_test_cases/p03629/output.1.txt @@ -0,0 +1 @@ +aca diff --git a/codenet/public_test_cases/p03629/output.2.txt b/codenet/public_test_cases/p03629/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e61ef7b965e17c62ca23b6ff5f0aaf09586e10e9 --- /dev/null +++ b/codenet/public_test_cases/p03629/output.2.txt @@ -0,0 +1 @@ +aa diff --git a/codenet/public_test_cases/p03629/output.3.txt b/codenet/public_test_cases/p03629/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/codenet/public_test_cases/p03629/output.3.txt @@ -0,0 +1 @@ +b diff --git a/codenet/public_test_cases/p03630/input.0.txt b/codenet/public_test_cases/p03630/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..02e0c141197f4068f12f60cd60c18c79d9d7c91e --- /dev/null +++ b/codenet/public_test_cases/p03630/input.0.txt @@ -0,0 +1,4 @@ +3 3 +..# +##. +.#. diff --git a/codenet/public_test_cases/p03630/input.1.txt b/codenet/public_test_cases/p03630/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a1f4a4b3f608aed0b11aa7f18644d3afdd2db0 --- /dev/null +++ b/codenet/public_test_cases/p03630/input.1.txt @@ -0,0 +1,4 @@ +3 3 +..# +. +.#. diff --git a/codenet/public_test_cases/p03630/input.2.txt b/codenet/public_test_cases/p03630/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d719abba3473feb2e729bfc85b95f88115a8528 --- /dev/null +++ b/codenet/public_test_cases/p03630/input.2.txt @@ -0,0 +1,11 @@ +10 8 +...#.# +...#.# +..###.#. +.##.#.# +.#..#.#. +..##.#.# +.#.#.. +...#.#.. +.#.## +..### diff --git a/codenet/public_test_cases/p03630/input.3.txt b/codenet/public_test_cases/p03630/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..02e0c141197f4068f12f60cd60c18c79d9d7c91e --- /dev/null +++ b/codenet/public_test_cases/p03630/input.3.txt @@ -0,0 +1,4 @@ +3 3 +..# +##. +.#. diff --git a/codenet/public_test_cases/p03630/input.4.txt b/codenet/public_test_cases/p03630/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..357fbac7b38917aeba951948441c5f3b541d963c --- /dev/null +++ b/codenet/public_test_cases/p03630/input.4.txt @@ -0,0 +1,5 @@ +4 4 +.... +.... +.... +.... diff --git a/codenet/public_test_cases/p03630/output.0.txt b/codenet/public_test_cases/p03630/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03630/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03630/output.1.txt b/codenet/public_test_cases/p03630/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03630/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03630/output.2.txt b/codenet/public_test_cases/p03630/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f64f5d8d85ac0230d36724bd7e6ba351a95b4942 --- /dev/null +++ b/codenet/public_test_cases/p03630/output.2.txt @@ -0,0 +1 @@ +27 diff --git a/codenet/public_test_cases/p03630/output.3.txt b/codenet/public_test_cases/p03630/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03630/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03630/output.4.txt b/codenet/public_test_cases/p03630/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03630/output.4.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03631/input.0.txt b/codenet/public_test_cases/p03631/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db08d2acf848400d68132e548a0dd7a6150da542 --- /dev/null +++ b/codenet/public_test_cases/p03631/input.0.txt @@ -0,0 +1 @@ +575 diff --git a/codenet/public_test_cases/p03631/input.1.txt b/codenet/public_test_cases/p03631/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7438337bf96d89a1f30afaa436deb9ceb53483f3 --- /dev/null +++ b/codenet/public_test_cases/p03631/input.1.txt @@ -0,0 +1 @@ +812 diff --git a/codenet/public_test_cases/p03631/input.2.txt b/codenet/public_test_cases/p03631/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db08d2acf848400d68132e548a0dd7a6150da542 --- /dev/null +++ b/codenet/public_test_cases/p03631/input.2.txt @@ -0,0 +1 @@ +575 diff --git a/codenet/public_test_cases/p03631/input.3.txt b/codenet/public_test_cases/p03631/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..190a18037c64c43e6b11489df4bf0b9eb6d2c9bf --- /dev/null +++ b/codenet/public_test_cases/p03631/input.3.txt @@ -0,0 +1 @@ +123 diff --git a/codenet/public_test_cases/p03631/output.0.txt b/codenet/public_test_cases/p03631/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03631/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03631/output.1.txt b/codenet/public_test_cases/p03631/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03631/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03631/output.2.txt b/codenet/public_test_cases/p03631/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03631/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03631/output.3.txt b/codenet/public_test_cases/p03631/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03631/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03632/input.0.txt b/codenet/public_test_cases/p03632/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c888ba537e7f96d4bbefacf71ad3de7a6fa588f4 --- /dev/null +++ b/codenet/public_test_cases/p03632/input.0.txt @@ -0,0 +1 @@ +0 75 25 100 diff --git a/codenet/public_test_cases/p03632/input.1.txt b/codenet/public_test_cases/p03632/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccb4ae2dca50502a04e60e00e98c7856b9ca740b --- /dev/null +++ b/codenet/public_test_cases/p03632/input.1.txt @@ -0,0 +1 @@ +10 90 20 80 diff --git a/codenet/public_test_cases/p03632/input.2.txt b/codenet/public_test_cases/p03632/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c888ba537e7f96d4bbefacf71ad3de7a6fa588f4 --- /dev/null +++ b/codenet/public_test_cases/p03632/input.2.txt @@ -0,0 +1 @@ +0 75 25 100 diff --git a/codenet/public_test_cases/p03632/input.3.txt b/codenet/public_test_cases/p03632/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8008b143105902cade0de2935956dd1a47ba848 --- /dev/null +++ b/codenet/public_test_cases/p03632/input.3.txt @@ -0,0 +1 @@ +0 33 66 99 diff --git a/codenet/public_test_cases/p03632/output.0.txt b/codenet/public_test_cases/p03632/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p03632/output.0.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p03632/output.1.txt b/codenet/public_test_cases/p03632/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p03632/output.1.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p03632/output.2.txt b/codenet/public_test_cases/p03632/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e373ee695f6e76d7d3f8f8c4e92d1d60995352e5 --- /dev/null +++ b/codenet/public_test_cases/p03632/output.2.txt @@ -0,0 +1 @@ +50 diff --git a/codenet/public_test_cases/p03632/output.3.txt b/codenet/public_test_cases/p03632/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03632/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03633/input.0.txt b/codenet/public_test_cases/p03633/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..179d8a7593af64bd2f34369a01d06ceb66ca4c40 --- /dev/null +++ b/codenet/public_test_cases/p03633/input.0.txt @@ -0,0 +1,3 @@ +2 +2 +3 diff --git a/codenet/public_test_cases/p03633/input.1.txt b/codenet/public_test_cases/p03633/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f31bf06e3c8313a571741c30fcee9b336aff53a --- /dev/null +++ b/codenet/public_test_cases/p03633/input.1.txt @@ -0,0 +1,6 @@ +5 +2 +5 +10 +1000000000000000000 +1000000000000000000 diff --git a/codenet/public_test_cases/p03633/input.2.txt b/codenet/public_test_cases/p03633/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..179d8a7593af64bd2f34369a01d06ceb66ca4c40 --- /dev/null +++ b/codenet/public_test_cases/p03633/input.2.txt @@ -0,0 +1,3 @@ +2 +2 +3 diff --git a/codenet/public_test_cases/p03633/output.0.txt b/codenet/public_test_cases/p03633/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03633/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03633/output.1.txt b/codenet/public_test_cases/p03633/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a4149f568ebd1c601c9657a0e51a097d0c2703 --- /dev/null +++ b/codenet/public_test_cases/p03633/output.1.txt @@ -0,0 +1 @@ +1000000000000000000 diff --git a/codenet/public_test_cases/p03633/output.2.txt b/codenet/public_test_cases/p03633/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03633/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03634/input.0.txt b/codenet/public_test_cases/p03634/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..76a1a4930e69d987762584da0089045f2386579d --- /dev/null +++ b/codenet/public_test_cases/p03634/input.0.txt @@ -0,0 +1,9 @@ +5 +1 2 1 +1 3 1 +2 4 1 +3 5 1 +3 1 +2 4 +2 3 +4 5 diff --git a/codenet/public_test_cases/p03634/input.1.txt b/codenet/public_test_cases/p03634/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76a1a4930e69d987762584da0089045f2386579d --- /dev/null +++ b/codenet/public_test_cases/p03634/input.1.txt @@ -0,0 +1,9 @@ +5 +1 2 1 +1 3 1 +2 4 1 +3 5 1 +3 1 +2 4 +2 3 +4 5 diff --git a/codenet/public_test_cases/p03634/input.2.txt b/codenet/public_test_cases/p03634/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b9b727eeaccdb3e6d308952a4bcb62aae3ea7b7 --- /dev/null +++ b/codenet/public_test_cases/p03634/input.2.txt @@ -0,0 +1,11 @@ +7 +1 2 1 +1 3 3 +1 4 5 +1 5 7 +1 6 9 +1 7 11 +3 2 +1 3 +4 5 +6 7 diff --git a/codenet/public_test_cases/p03634/input.3.txt b/codenet/public_test_cases/p03634/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fecdd6e0a16fcf545513977f69171e385b8d6783 --- /dev/null +++ b/codenet/public_test_cases/p03634/input.3.txt @@ -0,0 +1,12 @@ +10 +1 2 1000000000 +2 3 1000000000 +3 4 1000000000 +4 5 1000000000 +5 6 1000000000 +6 7 1000000000 +7 8 1000000000 +8 9 1000000000 +9 10 1000000000 +1 1 +9 10 diff --git a/codenet/public_test_cases/p03634/output.0.txt b/codenet/public_test_cases/p03634/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b37424c292e8be2a461d6003ee2b58794746e743 --- /dev/null +++ b/codenet/public_test_cases/p03634/output.0.txt @@ -0,0 +1,3 @@ +3 +2 +4 diff --git a/codenet/public_test_cases/p03634/output.1.txt b/codenet/public_test_cases/p03634/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b37424c292e8be2a461d6003ee2b58794746e743 --- /dev/null +++ b/codenet/public_test_cases/p03634/output.1.txt @@ -0,0 +1,3 @@ +3 +2 +4 diff --git a/codenet/public_test_cases/p03634/output.2.txt b/codenet/public_test_cases/p03634/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0220289d07186c627a290decc49a7aaf22ceb0c --- /dev/null +++ b/codenet/public_test_cases/p03634/output.2.txt @@ -0,0 +1,3 @@ +5 +14 +22 diff --git a/codenet/public_test_cases/p03634/output.3.txt b/codenet/public_test_cases/p03634/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcd6d3c417e15bb575c849220687c81bd54de8d5 --- /dev/null +++ b/codenet/public_test_cases/p03634/output.3.txt @@ -0,0 +1 @@ +17000000000 diff --git a/codenet/public_test_cases/p03635/input.0.txt b/codenet/public_test_cases/p03635/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebcee1a506db729ea7b0e0b6e9b0be36806d16bd --- /dev/null +++ b/codenet/public_test_cases/p03635/input.0.txt @@ -0,0 +1 @@ +3 4 diff --git a/codenet/public_test_cases/p03635/output.0.txt b/codenet/public_test_cases/p03635/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03635/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03636/input.0.txt b/codenet/public_test_cases/p03636/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee27c63b67f3543e18b51cbd13e51dbb1443c60 --- /dev/null +++ b/codenet/public_test_cases/p03636/input.0.txt @@ -0,0 +1 @@ +internationalization diff --git a/codenet/public_test_cases/p03636/input.1.txt b/codenet/public_test_cases/p03636/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d249fbca1e52488507b90673f5c1951c3d24ac26 --- /dev/null +++ b/codenet/public_test_cases/p03636/input.1.txt @@ -0,0 +1 @@ +smiles diff --git a/codenet/public_test_cases/p03636/input.2.txt b/codenet/public_test_cases/p03636/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee27c63b67f3543e18b51cbd13e51dbb1443c60 --- /dev/null +++ b/codenet/public_test_cases/p03636/input.2.txt @@ -0,0 +1 @@ +internationalization diff --git a/codenet/public_test_cases/p03636/input.3.txt b/codenet/public_test_cases/p03636/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd470e619003f5e55999473fec485d85a8601e44 --- /dev/null +++ b/codenet/public_test_cases/p03636/input.3.txt @@ -0,0 +1 @@ +xyz diff --git a/codenet/public_test_cases/p03636/output.0.txt b/codenet/public_test_cases/p03636/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5669308ee0f02580bab3a0d3632ecbd85f8fd755 --- /dev/null +++ b/codenet/public_test_cases/p03636/output.0.txt @@ -0,0 +1 @@ +i18n diff --git a/codenet/public_test_cases/p03636/output.1.txt b/codenet/public_test_cases/p03636/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51ddc716491d275cbe97866d80933c802d510f42 --- /dev/null +++ b/codenet/public_test_cases/p03636/output.1.txt @@ -0,0 +1 @@ +s4s diff --git a/codenet/public_test_cases/p03636/output.2.txt b/codenet/public_test_cases/p03636/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5669308ee0f02580bab3a0d3632ecbd85f8fd755 --- /dev/null +++ b/codenet/public_test_cases/p03636/output.2.txt @@ -0,0 +1 @@ +i18n diff --git a/codenet/public_test_cases/p03636/output.3.txt b/codenet/public_test_cases/p03636/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6361d808ec53437a389069feb267f7b395ea266b --- /dev/null +++ b/codenet/public_test_cases/p03636/output.3.txt @@ -0,0 +1 @@ +x1z diff --git a/codenet/public_test_cases/p03637/input.0.txt b/codenet/public_test_cases/p03637/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac1c775de0a3d87826e58f000bbe4f5222a22e9 --- /dev/null +++ b/codenet/public_test_cases/p03637/input.0.txt @@ -0,0 +1,2 @@ +3 +1 10 100 diff --git a/codenet/public_test_cases/p03637/input.1.txt b/codenet/public_test_cases/p03637/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5460fe3629ec0ab902a3f067f307d923af674451 --- /dev/null +++ b/codenet/public_test_cases/p03637/input.1.txt @@ -0,0 +1,2 @@ +6 +2 7 1 8 2 8 diff --git a/codenet/public_test_cases/p03637/input.2.txt b/codenet/public_test_cases/p03637/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf3a1164322c6e9ed544e706677fa9f249010e08 --- /dev/null +++ b/codenet/public_test_cases/p03637/input.2.txt @@ -0,0 +1,2 @@ +3 +1 4 1 diff --git a/codenet/public_test_cases/p03637/input.3.txt b/codenet/public_test_cases/p03637/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac1c775de0a3d87826e58f000bbe4f5222a22e9 --- /dev/null +++ b/codenet/public_test_cases/p03637/input.3.txt @@ -0,0 +1,2 @@ +3 +1 10 100 diff --git a/codenet/public_test_cases/p03637/input.4.txt b/codenet/public_test_cases/p03637/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..811797a5438c685df3973fb0fb0d816b7750605b --- /dev/null +++ b/codenet/public_test_cases/p03637/input.4.txt @@ -0,0 +1,2 @@ +2 +1 1 diff --git a/codenet/public_test_cases/p03637/input.5.txt b/codenet/public_test_cases/p03637/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a4d515660c3c567ab07859fc5e252f8c966e46 --- /dev/null +++ b/codenet/public_test_cases/p03637/input.5.txt @@ -0,0 +1,2 @@ +4 +1 2 3 4 diff --git a/codenet/public_test_cases/p03637/output.0.txt b/codenet/public_test_cases/p03637/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03637/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03637/output.1.txt b/codenet/public_test_cases/p03637/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03637/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03637/output.2.txt b/codenet/public_test_cases/p03637/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03637/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03637/output.3.txt b/codenet/public_test_cases/p03637/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03637/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03637/output.4.txt b/codenet/public_test_cases/p03637/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03637/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03637/output.5.txt b/codenet/public_test_cases/p03637/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03637/output.5.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03638/input.0.txt b/codenet/public_test_cases/p03638/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5748a065de40ee14ad4cbf73269c3df1fe19e316 --- /dev/null +++ b/codenet/public_test_cases/p03638/input.0.txt @@ -0,0 +1,3 @@ +2 2 +3 +2 1 1 diff --git a/codenet/public_test_cases/p03638/output.0.txt b/codenet/public_test_cases/p03638/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd26e55f72a31621d14466eda2816a0151e00816 --- /dev/null +++ b/codenet/public_test_cases/p03638/output.0.txt @@ -0,0 +1,2 @@ +1 1 +2 3 diff --git a/codenet/public_test_cases/p03639/input.0.txt b/codenet/public_test_cases/p03639/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ac1c775de0a3d87826e58f000bbe4f5222a22e9 --- /dev/null +++ b/codenet/public_test_cases/p03639/input.0.txt @@ -0,0 +1,2 @@ +3 +1 10 100 diff --git a/codenet/public_test_cases/p03639/output.0.txt b/codenet/public_test_cases/p03639/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03639/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03640/input.0.txt b/codenet/public_test_cases/p03640/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5748a065de40ee14ad4cbf73269c3df1fe19e316 --- /dev/null +++ b/codenet/public_test_cases/p03640/input.0.txt @@ -0,0 +1,3 @@ +2 2 +3 +2 1 1 diff --git a/codenet/public_test_cases/p03640/input.1.txt b/codenet/public_test_cases/p03640/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa06f24722228190f0f083410747b30fad83865d --- /dev/null +++ b/codenet/public_test_cases/p03640/input.1.txt @@ -0,0 +1,3 @@ +1 1 +1 +1 diff --git a/codenet/public_test_cases/p03640/input.2.txt b/codenet/public_test_cases/p03640/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..868aec373cf22491ae715444c9999204749762db --- /dev/null +++ b/codenet/public_test_cases/p03640/input.2.txt @@ -0,0 +1,3 @@ +3 5 +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03640/input.3.txt b/codenet/public_test_cases/p03640/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5748a065de40ee14ad4cbf73269c3df1fe19e316 --- /dev/null +++ b/codenet/public_test_cases/p03640/input.3.txt @@ -0,0 +1,3 @@ +2 2 +3 +2 1 1 diff --git a/codenet/public_test_cases/p03640/output.0.txt b/codenet/public_test_cases/p03640/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd26e55f72a31621d14466eda2816a0151e00816 --- /dev/null +++ b/codenet/public_test_cases/p03640/output.0.txt @@ -0,0 +1,2 @@ +1 1 +2 3 diff --git a/codenet/public_test_cases/p03640/output.1.txt b/codenet/public_test_cases/p03640/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03640/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03640/output.2.txt b/codenet/public_test_cases/p03640/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3597a6dc537d3b6bf89dd0f3004979b2b15fa131 --- /dev/null +++ b/codenet/public_test_cases/p03640/output.2.txt @@ -0,0 +1,3 @@ +1 4 4 4 3 +2 5 4 5 3 +2 5 5 5 3 diff --git a/codenet/public_test_cases/p03640/output.3.txt b/codenet/public_test_cases/p03640/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd26e55f72a31621d14466eda2816a0151e00816 --- /dev/null +++ b/codenet/public_test_cases/p03640/output.3.txt @@ -0,0 +1,2 @@ +1 1 +2 3 diff --git a/codenet/public_test_cases/p03641/input.0.txt b/codenet/public_test_cases/p03641/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11be524eec56c42d86863eda83563bea50990916 --- /dev/null +++ b/codenet/public_test_cases/p03641/input.0.txt @@ -0,0 +1,2 @@ +4 +3 2 4 1 diff --git a/codenet/public_test_cases/p03641/input.1.txt b/codenet/public_test_cases/p03641/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p03641/input.1.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p03641/input.2.txt b/codenet/public_test_cases/p03641/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f94f086ced953f1607d2a20033e6183429c8b84f --- /dev/null +++ b/codenet/public_test_cases/p03641/input.2.txt @@ -0,0 +1,2 @@ +8 +4 6 3 2 8 5 7 1 diff --git a/codenet/public_test_cases/p03641/input.3.txt b/codenet/public_test_cases/p03641/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..11be524eec56c42d86863eda83563bea50990916 --- /dev/null +++ b/codenet/public_test_cases/p03641/input.3.txt @@ -0,0 +1,2 @@ +4 +3 2 4 1 diff --git a/codenet/public_test_cases/p03641/output.0.txt b/codenet/public_test_cases/p03641/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2801cca7dbc36f5b89b38430b77c11eb683f0f15 --- /dev/null +++ b/codenet/public_test_cases/p03641/output.0.txt @@ -0,0 +1 @@ +3 1 2 4 diff --git a/codenet/public_test_cases/p03641/output.1.txt b/codenet/public_test_cases/p03641/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p03641/output.1.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p03641/output.2.txt b/codenet/public_test_cases/p03641/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7e4c258ec3cedd9aef37e4b103dc95eeee2ad2b --- /dev/null +++ b/codenet/public_test_cases/p03641/output.2.txt @@ -0,0 +1 @@ +3 1 2 7 4 6 8 5 diff --git a/codenet/public_test_cases/p03641/output.3.txt b/codenet/public_test_cases/p03641/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2801cca7dbc36f5b89b38430b77c11eb683f0f15 --- /dev/null +++ b/codenet/public_test_cases/p03641/output.3.txt @@ -0,0 +1 @@ +3 1 2 4 diff --git a/codenet/public_test_cases/p03642/input.0.txt b/codenet/public_test_cases/p03642/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..141ae9891986526d63d7f1aa23cdcc83cd31d4b9 --- /dev/null +++ b/codenet/public_test_cases/p03642/input.0.txt @@ -0,0 +1,2 @@ +2 +4 5 diff --git a/codenet/public_test_cases/p03642/input.1.txt b/codenet/public_test_cases/p03642/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..141ae9891986526d63d7f1aa23cdcc83cd31d4b9 --- /dev/null +++ b/codenet/public_test_cases/p03642/input.1.txt @@ -0,0 +1,2 @@ +2 +4 5 diff --git a/codenet/public_test_cases/p03642/input.2.txt b/codenet/public_test_cases/p03642/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db8957c19ca4c6bd2c778190eb5e7d50e30bf866 --- /dev/null +++ b/codenet/public_test_cases/p03642/input.2.txt @@ -0,0 +1,2 @@ +2 +1 10000000 diff --git a/codenet/public_test_cases/p03642/input.3.txt b/codenet/public_test_cases/p03642/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bbd6ae3a1f8c6414096b7a175fd70d13657f5b --- /dev/null +++ b/codenet/public_test_cases/p03642/input.3.txt @@ -0,0 +1,2 @@ +9 +1 2 3 4 5 6 7 8 9 diff --git a/codenet/public_test_cases/p03642/output.0.txt b/codenet/public_test_cases/p03642/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03642/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03642/output.1.txt b/codenet/public_test_cases/p03642/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03642/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03642/output.2.txt b/codenet/public_test_cases/p03642/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03642/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03642/output.3.txt b/codenet/public_test_cases/p03642/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03642/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03643/input.0.txt b/codenet/public_test_cases/p03643/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03643/input.0.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03643/input.1.txt b/codenet/public_test_cases/p03643/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6905f8ba447c0116590e38b2430151b506b1611 --- /dev/null +++ b/codenet/public_test_cases/p03643/input.1.txt @@ -0,0 +1 @@ +999 diff --git a/codenet/public_test_cases/p03643/input.2.txt b/codenet/public_test_cases/p03643/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e4a5228abc4023f3ec178d58a0fefd20c97e61e --- /dev/null +++ b/codenet/public_test_cases/p03643/input.2.txt @@ -0,0 +1 @@ +425 diff --git a/codenet/public_test_cases/p03643/input.3.txt b/codenet/public_test_cases/p03643/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03643/input.3.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03643/output.0.txt b/codenet/public_test_cases/p03643/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..440cbd5c657e1c68bbb6e16b14598c1f2b4eb1c1 --- /dev/null +++ b/codenet/public_test_cases/p03643/output.0.txt @@ -0,0 +1 @@ +ABC100 diff --git a/codenet/public_test_cases/p03643/output.1.txt b/codenet/public_test_cases/p03643/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..faddfa803712de9d9b27dbf8b06fb588404695a2 --- /dev/null +++ b/codenet/public_test_cases/p03643/output.1.txt @@ -0,0 +1 @@ +ABC999 diff --git a/codenet/public_test_cases/p03643/output.2.txt b/codenet/public_test_cases/p03643/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d269d6a48f3822e5ecbcc98ed98546ea80b230cd --- /dev/null +++ b/codenet/public_test_cases/p03643/output.2.txt @@ -0,0 +1 @@ +ABC425 diff --git a/codenet/public_test_cases/p03643/output.3.txt b/codenet/public_test_cases/p03643/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..440cbd5c657e1c68bbb6e16b14598c1f2b4eb1c1 --- /dev/null +++ b/codenet/public_test_cases/p03643/output.3.txt @@ -0,0 +1 @@ +ABC100 diff --git a/codenet/public_test_cases/p03644/input.0.txt b/codenet/public_test_cases/p03644/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03644/input.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03644/input.1.txt b/codenet/public_test_cases/p03644/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03644/input.1.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03644/input.2.txt b/codenet/public_test_cases/p03644/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03644/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03644/input.3.txt b/codenet/public_test_cases/p03644/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03644/input.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03644/input.4.txt b/codenet/public_test_cases/p03644/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p03644/input.4.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p03644/output.0.txt b/codenet/public_test_cases/p03644/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03644/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03644/output.1.txt b/codenet/public_test_cases/p03644/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p03644/output.1.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p03644/output.2.txt b/codenet/public_test_cases/p03644/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03644/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03644/output.3.txt b/codenet/public_test_cases/p03644/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03644/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03644/output.4.txt b/codenet/public_test_cases/p03644/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p03644/output.4.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p03645/input.0.txt b/codenet/public_test_cases/p03645/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p03645/input.0.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03645/output.0.txt b/codenet/public_test_cases/p03645/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03645/output.0.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03646/input.0.txt b/codenet/public_test_cases/p03646/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03646/input.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03646/output.0.txt b/codenet/public_test_cases/p03646/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c527d5403ccac6eb909516290ad2a34f0d99684b --- /dev/null +++ b/codenet/public_test_cases/p03646/output.0.txt @@ -0,0 +1,2 @@ +4 +3 3 3 3 diff --git a/codenet/public_test_cases/p03647/input.0.txt b/codenet/public_test_cases/p03647/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p03647/input.0.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03647/input.1.txt b/codenet/public_test_cases/p03647/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9341dd1d933a874bacc49475ebb86d71a3c7602e --- /dev/null +++ b/codenet/public_test_cases/p03647/input.1.txt @@ -0,0 +1,6 @@ +5 5 +1 3 +4 5 +2 3 +2 4 +1 4 diff --git a/codenet/public_test_cases/p03647/input.2.txt b/codenet/public_test_cases/p03647/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7eb1cdc80c531ee5890d1c06dc39932f06177048 --- /dev/null +++ b/codenet/public_test_cases/p03647/input.2.txt @@ -0,0 +1,2 @@ +100000 1 +1 99999 diff --git a/codenet/public_test_cases/p03647/input.3.txt b/codenet/public_test_cases/p03647/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..60fdf3feec682bec0be8b20e3d7ac2805bf0c2e0 --- /dev/null +++ b/codenet/public_test_cases/p03647/input.3.txt @@ -0,0 +1,4 @@ +4 3 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p03647/input.4.txt b/codenet/public_test_cases/p03647/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p03647/input.4.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03647/output.0.txt b/codenet/public_test_cases/p03647/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03647/output.0.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03647/output.1.txt b/codenet/public_test_cases/p03647/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03647/output.1.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03647/output.2.txt b/codenet/public_test_cases/p03647/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p03647/output.2.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p03647/output.3.txt b/codenet/public_test_cases/p03647/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p03647/output.3.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p03647/output.4.txt b/codenet/public_test_cases/p03647/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03647/output.4.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03648/input.0.txt b/codenet/public_test_cases/p03648/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03648/input.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03648/input.1.txt b/codenet/public_test_cases/p03648/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03648/input.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03648/input.2.txt b/codenet/public_test_cases/p03648/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03648/input.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03648/input.3.txt b/codenet/public_test_cases/p03648/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4b65e6d834fd105cd8cc5ff3ce0d2533b8b737b --- /dev/null +++ b/codenet/public_test_cases/p03648/input.3.txt @@ -0,0 +1 @@ +1234567894848 diff --git a/codenet/public_test_cases/p03648/input.4.txt b/codenet/public_test_cases/p03648/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03648/input.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03648/input.5.txt b/codenet/public_test_cases/p03648/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03648/input.5.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03648/output.0.txt b/codenet/public_test_cases/p03648/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c527d5403ccac6eb909516290ad2a34f0d99684b --- /dev/null +++ b/codenet/public_test_cases/p03648/output.0.txt @@ -0,0 +1,2 @@ +4 +3 3 3 3 diff --git a/codenet/public_test_cases/p03648/output.1.txt b/codenet/public_test_cases/p03648/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c527d5403ccac6eb909516290ad2a34f0d99684b --- /dev/null +++ b/codenet/public_test_cases/p03648/output.1.txt @@ -0,0 +1,2 @@ +4 +3 3 3 3 diff --git a/codenet/public_test_cases/p03648/output.2.txt b/codenet/public_test_cases/p03648/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5236c6a310ff95e604ee66db81918b5b07de6df1 --- /dev/null +++ b/codenet/public_test_cases/p03648/output.2.txt @@ -0,0 +1,2 @@ +3 +1 0 3 diff --git a/codenet/public_test_cases/p03648/output.3.txt b/codenet/public_test_cases/p03648/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..74f2d2c2b3b84dc2155963cca6033579af294ad8 --- /dev/null +++ b/codenet/public_test_cases/p03648/output.3.txt @@ -0,0 +1,2 @@ +10 +1000 193 256 777 0 1 1192 1234567891011 48 425 diff --git a/codenet/public_test_cases/p03648/output.4.txt b/codenet/public_test_cases/p03648/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d7778566a9ec2edc1aef3405376f39389487c9f --- /dev/null +++ b/codenet/public_test_cases/p03648/output.4.txt @@ -0,0 +1,2 @@ +2 +2 2 diff --git a/codenet/public_test_cases/p03648/output.5.txt b/codenet/public_test_cases/p03648/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea40c66a55cfc4c5b064380e79a71379d1a850a7 --- /dev/null +++ b/codenet/public_test_cases/p03648/output.5.txt @@ -0,0 +1,2 @@ +7 +27 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p03649/input.0.txt b/codenet/public_test_cases/p03649/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c527d5403ccac6eb909516290ad2a34f0d99684b --- /dev/null +++ b/codenet/public_test_cases/p03649/input.0.txt @@ -0,0 +1,2 @@ +4 +3 3 3 3 diff --git a/codenet/public_test_cases/p03649/input.1.txt b/codenet/public_test_cases/p03649/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d7778566a9ec2edc1aef3405376f39389487c9f --- /dev/null +++ b/codenet/public_test_cases/p03649/input.1.txt @@ -0,0 +1,2 @@ +2 +2 2 diff --git a/codenet/public_test_cases/p03649/input.2.txt b/codenet/public_test_cases/p03649/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c527d5403ccac6eb909516290ad2a34f0d99684b --- /dev/null +++ b/codenet/public_test_cases/p03649/input.2.txt @@ -0,0 +1,2 @@ +4 +3 3 3 3 diff --git a/codenet/public_test_cases/p03649/input.3.txt b/codenet/public_test_cases/p03649/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea40c66a55cfc4c5b064380e79a71379d1a850a7 --- /dev/null +++ b/codenet/public_test_cases/p03649/input.3.txt @@ -0,0 +1,2 @@ +7 +27 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p03649/input.4.txt b/codenet/public_test_cases/p03649/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5236c6a310ff95e604ee66db81918b5b07de6df1 --- /dev/null +++ b/codenet/public_test_cases/p03649/input.4.txt @@ -0,0 +1,2 @@ +3 +1 0 3 diff --git a/codenet/public_test_cases/p03649/input.5.txt b/codenet/public_test_cases/p03649/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..74f2d2c2b3b84dc2155963cca6033579af294ad8 --- /dev/null +++ b/codenet/public_test_cases/p03649/input.5.txt @@ -0,0 +1,2 @@ +10 +1000 193 256 777 0 1 1192 1234567891011 48 425 diff --git a/codenet/public_test_cases/p03649/output.0.txt b/codenet/public_test_cases/p03649/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03649/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03649/output.1.txt b/codenet/public_test_cases/p03649/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03649/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03649/output.2.txt b/codenet/public_test_cases/p03649/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03649/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03649/output.3.txt b/codenet/public_test_cases/p03649/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03649/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03649/output.4.txt b/codenet/public_test_cases/p03649/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03649/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03649/output.5.txt b/codenet/public_test_cases/p03649/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4b65e6d834fd105cd8cc5ff3ce0d2533b8b737b --- /dev/null +++ b/codenet/public_test_cases/p03649/output.5.txt @@ -0,0 +1 @@ +1234567894848 diff --git a/codenet/public_test_cases/p03650/input.0.txt b/codenet/public_test_cases/p03650/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..65c8e6bc51b9b68d4c4cc97544660e27a2dedd3d --- /dev/null +++ b/codenet/public_test_cases/p03650/input.0.txt @@ -0,0 +1,2 @@ +4 +2 3 4 1 diff --git a/codenet/public_test_cases/p03650/input.1.txt b/codenet/public_test_cases/p03650/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83447d0b6ba8aeed75a84d348839ba497597ff24 --- /dev/null +++ b/codenet/public_test_cases/p03650/input.1.txt @@ -0,0 +1,2 @@ +6 +4 5 6 5 6 4 diff --git a/codenet/public_test_cases/p03650/input.2.txt b/codenet/public_test_cases/p03650/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5ca630fe51a1f083546542ff19f232f1e9842b8 --- /dev/null +++ b/codenet/public_test_cases/p03650/input.2.txt @@ -0,0 +1,2 @@ +4 +2 3 1 1 diff --git a/codenet/public_test_cases/p03650/input.3.txt b/codenet/public_test_cases/p03650/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b29044c7562263214ba07e95181d4fffa71da483 --- /dev/null +++ b/codenet/public_test_cases/p03650/input.3.txt @@ -0,0 +1,2 @@ +3 +2 3 1 diff --git a/codenet/public_test_cases/p03650/input.4.txt b/codenet/public_test_cases/p03650/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..65c8e6bc51b9b68d4c4cc97544660e27a2dedd3d --- /dev/null +++ b/codenet/public_test_cases/p03650/input.4.txt @@ -0,0 +1,2 @@ +4 +2 3 4 1 diff --git a/codenet/public_test_cases/p03650/output.0.txt b/codenet/public_test_cases/p03650/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03650/output.0.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03650/output.1.txt b/codenet/public_test_cases/p03650/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p03650/output.1.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p03650/output.2.txt b/codenet/public_test_cases/p03650/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03650/output.2.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03650/output.3.txt b/codenet/public_test_cases/p03650/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p03650/output.3.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p03650/output.4.txt b/codenet/public_test_cases/p03650/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03650/output.4.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03651/input.0.txt b/codenet/public_test_cases/p03651/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a82133b51ac239b7edf79305877ee020eaaf0598 --- /dev/null +++ b/codenet/public_test_cases/p03651/input.0.txt @@ -0,0 +1,2 @@ +3 7 +9 3 4 diff --git a/codenet/public_test_cases/p03651/input.1.txt b/codenet/public_test_cases/p03651/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7bd62921f3e87274b610c0452ab91fe5e61ab88 --- /dev/null +++ b/codenet/public_test_cases/p03651/input.1.txt @@ -0,0 +1,2 @@ +4 11 +11 3 7 15 diff --git a/codenet/public_test_cases/p03651/input.2.txt b/codenet/public_test_cases/p03651/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2849bf5e8e96bc99ec6ec21536f0128a9671f6af --- /dev/null +++ b/codenet/public_test_cases/p03651/input.2.txt @@ -0,0 +1,2 @@ +3 5 +6 9 3 diff --git a/codenet/public_test_cases/p03651/input.3.txt b/codenet/public_test_cases/p03651/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..44f1095ac9d2fc38ed0e23f700c4fd99ebe76c1d --- /dev/null +++ b/codenet/public_test_cases/p03651/input.3.txt @@ -0,0 +1,2 @@ +5 12 +10 2 8 6 4 diff --git a/codenet/public_test_cases/p03651/input.4.txt b/codenet/public_test_cases/p03651/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a82133b51ac239b7edf79305877ee020eaaf0598 --- /dev/null +++ b/codenet/public_test_cases/p03651/input.4.txt @@ -0,0 +1,2 @@ +3 7 +9 3 4 diff --git a/codenet/public_test_cases/p03651/output.0.txt b/codenet/public_test_cases/p03651/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03651/output.0.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03651/output.1.txt b/codenet/public_test_cases/p03651/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03651/output.1.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03651/output.2.txt b/codenet/public_test_cases/p03651/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p03651/output.2.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p03651/output.3.txt b/codenet/public_test_cases/p03651/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p03651/output.3.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p03651/output.4.txt b/codenet/public_test_cases/p03651/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d589be1f338dc2493f622e94784b883eded3adaa --- /dev/null +++ b/codenet/public_test_cases/p03651/output.4.txt @@ -0,0 +1 @@ +POSSIBLE diff --git a/codenet/public_test_cases/p03652/input.0.txt b/codenet/public_test_cases/p03652/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82b53e7a0f2f79e9e64499bc318b8883e0d8efd2 --- /dev/null +++ b/codenet/public_test_cases/p03652/input.0.txt @@ -0,0 +1,5 @@ +4 5 +5 1 3 4 2 +2 5 3 1 4 +2 3 1 4 5 +2 5 4 3 1 diff --git a/codenet/public_test_cases/p03652/input.1.txt b/codenet/public_test_cases/p03652/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6af1bae82ccf7c141b0bb9cfefd7849171daf394 --- /dev/null +++ b/codenet/public_test_cases/p03652/input.1.txt @@ -0,0 +1,4 @@ +3 3 +2 1 3 +2 1 3 +2 1 3 diff --git a/codenet/public_test_cases/p03652/input.2.txt b/codenet/public_test_cases/p03652/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..82b53e7a0f2f79e9e64499bc318b8883e0d8efd2 --- /dev/null +++ b/codenet/public_test_cases/p03652/input.2.txt @@ -0,0 +1,5 @@ +4 5 +5 1 3 4 2 +2 5 3 1 4 +2 3 1 4 5 +2 5 4 3 1 diff --git a/codenet/public_test_cases/p03652/output.0.txt b/codenet/public_test_cases/p03652/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03652/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03652/output.1.txt b/codenet/public_test_cases/p03652/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03652/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03652/output.2.txt b/codenet/public_test_cases/p03652/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03652/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03653/input.0.txt b/codenet/public_test_cases/p03653/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..df7f1ec3ccd09a14f99f64910db4b14da19c7458 --- /dev/null +++ b/codenet/public_test_cases/p03653/input.0.txt @@ -0,0 +1,5 @@ +1 2 1 +2 4 4 +3 2 1 +7 6 7 +5 2 3 diff --git a/codenet/public_test_cases/p03653/input.1.txt b/codenet/public_test_cases/p03653/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..df7f1ec3ccd09a14f99f64910db4b14da19c7458 --- /dev/null +++ b/codenet/public_test_cases/p03653/input.1.txt @@ -0,0 +1,5 @@ +1 2 1 +2 4 4 +3 2 1 +7 6 7 +5 2 3 diff --git a/codenet/public_test_cases/p03653/input.2.txt b/codenet/public_test_cases/p03653/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2768cb36e01e9e851aae0a7c7e2820516fb10afa --- /dev/null +++ b/codenet/public_test_cases/p03653/input.2.txt @@ -0,0 +1,13 @@ +6 2 4 +33189 87907 277349742 +71616 46764 575306520 +8801 53151 327161251 +58589 4337 796697686 +66854 17565 289910583 +50598 35195 478112689 +13919 88414 103962455 +7953 69657 699253752 +44255 98144 468443709 +2332 42580 752437097 +39752 19060 845062869 +60126 74101 382963164 diff --git a/codenet/public_test_cases/p03653/input.3.txt b/codenet/public_test_cases/p03653/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e19edcd887a851c8f34b2005f866688487ec8c6 --- /dev/null +++ b/codenet/public_test_cases/p03653/input.3.txt @@ -0,0 +1,9 @@ +3 3 2 +16 17 1 +2 7 5 +2 16 12 +17 7 7 +13 2 10 +12 18 3 +16 15 19 +5 6 2 diff --git a/codenet/public_test_cases/p03653/output.0.txt b/codenet/public_test_cases/p03653/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03653/output.0.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03653/output.1.txt b/codenet/public_test_cases/p03653/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03653/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03653/output.2.txt b/codenet/public_test_cases/p03653/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b345828cf371adc7713203cc4e5e416777c5cbc9 --- /dev/null +++ b/codenet/public_test_cases/p03653/output.2.txt @@ -0,0 +1 @@ +3093929975 diff --git a/codenet/public_test_cases/p03653/output.3.txt b/codenet/public_test_cases/p03653/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc6298e80ad4b7c48ae27ed65630f31e1d1143de --- /dev/null +++ b/codenet/public_test_cases/p03653/output.3.txt @@ -0,0 +1 @@ +110 diff --git a/codenet/public_test_cases/p03654/input.0.txt b/codenet/public_test_cases/p03654/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fea644efa1773a4c98d8e1d42977e1514e1fa168 --- /dev/null +++ b/codenet/public_test_cases/p03654/input.0.txt @@ -0,0 +1,5 @@ +5 +1 2 5 +3 4 7 +2 3 3 +2 5 2 diff --git a/codenet/public_test_cases/p03654/input.1.txt b/codenet/public_test_cases/p03654/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..925e88fdfa08c76c4efd6b6a21f1e088263edb50 --- /dev/null +++ b/codenet/public_test_cases/p03654/input.1.txt @@ -0,0 +1,8 @@ +8 +2 8 8 +1 5 1 +4 8 2 +2 5 4 +3 8 6 +6 8 9 +2 7 12 diff --git a/codenet/public_test_cases/p03654/input.2.txt b/codenet/public_test_cases/p03654/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fea644efa1773a4c98d8e1d42977e1514e1fa168 --- /dev/null +++ b/codenet/public_test_cases/p03654/input.2.txt @@ -0,0 +1,5 @@ +5 +1 2 5 +3 4 7 +2 3 3 +2 5 2 diff --git a/codenet/public_test_cases/p03654/output.0.txt b/codenet/public_test_cases/p03654/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e522732c77ec94723e739d22f28df549b0231f5f --- /dev/null +++ b/codenet/public_test_cases/p03654/output.0.txt @@ -0,0 +1 @@ +38 diff --git a/codenet/public_test_cases/p03654/output.1.txt b/codenet/public_test_cases/p03654/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94361d49fd91ff9629fe80ddd10a5cb5581cbb0d --- /dev/null +++ b/codenet/public_test_cases/p03654/output.1.txt @@ -0,0 +1 @@ +132 diff --git a/codenet/public_test_cases/p03654/output.2.txt b/codenet/public_test_cases/p03654/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e522732c77ec94723e739d22f28df549b0231f5f --- /dev/null +++ b/codenet/public_test_cases/p03654/output.2.txt @@ -0,0 +1 @@ +38 diff --git a/codenet/public_test_cases/p03655/input.0.txt b/codenet/public_test_cases/p03655/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5e56d4d0c4f5cb200fa493bc8d07be641e9689c --- /dev/null +++ b/codenet/public_test_cases/p03655/input.0.txt @@ -0,0 +1,2 @@ +1 1 2 2 3 4 +1 1 2 2 3 3 diff --git a/codenet/public_test_cases/p03655/input.1.txt b/codenet/public_test_cases/p03655/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..04f89f13d22193291a5425bcbedb34b7396334ea --- /dev/null +++ b/codenet/public_test_cases/p03655/input.1.txt @@ -0,0 +1,2 @@ +1 2 3 4 5 6 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p03655/input.2.txt b/codenet/public_test_cases/p03655/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5e56d4d0c4f5cb200fa493bc8d07be641e9689c --- /dev/null +++ b/codenet/public_test_cases/p03655/input.2.txt @@ -0,0 +1,2 @@ +1 1 2 2 3 4 +1 1 2 2 3 3 diff --git a/codenet/public_test_cases/p03655/input.3.txt b/codenet/public_test_cases/p03655/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d17dcb1f3d7ea2b6dd0c13bf8f62d6ea2e0f708 --- /dev/null +++ b/codenet/public_test_cases/p03655/input.3.txt @@ -0,0 +1,2 @@ +77523 89555 420588 604360 845669 973451 +2743 188053 544330 647651 709337 988194 diff --git a/codenet/public_test_cases/p03655/output.0.txt b/codenet/public_test_cases/p03655/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03655/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03655/output.1.txt b/codenet/public_test_cases/p03655/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4fdb9ba8959b715315eb59824b2af4ebbdaa674 --- /dev/null +++ b/codenet/public_test_cases/p03655/output.1.txt @@ -0,0 +1 @@ +2346 diff --git a/codenet/public_test_cases/p03655/output.2.txt b/codenet/public_test_cases/p03655/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03655/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03655/output.3.txt b/codenet/public_test_cases/p03655/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9330c497e0b934322d200d3d2601920f46eb3b6 --- /dev/null +++ b/codenet/public_test_cases/p03655/output.3.txt @@ -0,0 +1 @@ +137477680 diff --git a/codenet/public_test_cases/p03656/input.0.txt b/codenet/public_test_cases/p03656/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c355bc6e1cdf9cb4863a051d892488247be4cb89 --- /dev/null +++ b/codenet/public_test_cases/p03656/input.0.txt @@ -0,0 +1,3 @@ +5 +3 3 4 -1 4 +4 4 1 -1 1 diff --git a/codenet/public_test_cases/p03656/input.1.txt b/codenet/public_test_cases/p03656/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..17e3be3c9ea90ecc4882666539feadfa403064ed --- /dev/null +++ b/codenet/public_test_cases/p03656/input.1.txt @@ -0,0 +1,3 @@ +6 +-1 5 1 5 1 3 +6 5 5 3 -1 3 diff --git a/codenet/public_test_cases/p03656/input.2.txt b/codenet/public_test_cases/p03656/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c355bc6e1cdf9cb4863a051d892488247be4cb89 --- /dev/null +++ b/codenet/public_test_cases/p03656/input.2.txt @@ -0,0 +1,3 @@ +5 +3 3 4 -1 4 +4 4 1 -1 1 diff --git a/codenet/public_test_cases/p03656/input.3.txt b/codenet/public_test_cases/p03656/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0323ed6967d490d6ec5e45b5cbb929bdb4127b74 --- /dev/null +++ b/codenet/public_test_cases/p03656/input.3.txt @@ -0,0 +1,3 @@ +8 +2 7 1 2 2 1 -1 4 +4 -1 4 7 4 4 2 4 diff --git a/codenet/public_test_cases/p03656/output.0.txt b/codenet/public_test_cases/p03656/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..12fa794e8f6fe4b9f5157848ccb40edf75644b44 --- /dev/null +++ b/codenet/public_test_cases/p03656/output.0.txt @@ -0,0 +1,2 @@ +POSSIBLE +1 -1 -1 3 -1 diff --git a/codenet/public_test_cases/p03656/output.1.txt b/codenet/public_test_cases/p03656/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e36f604ad5f01f224df0fc69289677d46ac935d --- /dev/null +++ b/codenet/public_test_cases/p03656/output.1.txt @@ -0,0 +1 @@ +IMPOSSIBLE diff --git a/codenet/public_test_cases/p03656/output.2.txt b/codenet/public_test_cases/p03656/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..12fa794e8f6fe4b9f5157848ccb40edf75644b44 --- /dev/null +++ b/codenet/public_test_cases/p03656/output.2.txt @@ -0,0 +1,2 @@ +POSSIBLE +1 -1 -1 3 -1 diff --git a/codenet/public_test_cases/p03656/output.3.txt b/codenet/public_test_cases/p03656/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5de9dea432babddc776123bb8607c6877ca12c43 --- /dev/null +++ b/codenet/public_test_cases/p03656/output.3.txt @@ -0,0 +1,2 @@ +POSSIBLE +1 2 -1 0 -1 1 0 -1 diff --git a/codenet/public_test_cases/p03657/input.0.txt b/codenet/public_test_cases/p03657/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a99162ed9cdd1b90006cbd4f07e2a2bd3f404d4 --- /dev/null +++ b/codenet/public_test_cases/p03657/input.0.txt @@ -0,0 +1 @@ +4 5 diff --git a/codenet/public_test_cases/p03657/input.1.txt b/codenet/public_test_cases/p03657/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a99162ed9cdd1b90006cbd4f07e2a2bd3f404d4 --- /dev/null +++ b/codenet/public_test_cases/p03657/input.1.txt @@ -0,0 +1 @@ +4 5 diff --git a/codenet/public_test_cases/p03657/input.2.txt b/codenet/public_test_cases/p03657/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03657/input.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03657/output.0.txt b/codenet/public_test_cases/p03657/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p03657/output.0.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p03657/output.1.txt b/codenet/public_test_cases/p03657/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p03657/output.1.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p03657/output.2.txt b/codenet/public_test_cases/p03657/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p03657/output.2.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p03658/input.0.txt b/codenet/public_test_cases/p03658/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7414a21c5fa330e8417f28dd55e5ea21b73e1144 --- /dev/null +++ b/codenet/public_test_cases/p03658/input.0.txt @@ -0,0 +1,2 @@ +5 3 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03658/input.1.txt b/codenet/public_test_cases/p03658/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c33da1b8e47e2f2fc795c54f26400d7659b01f7 --- /dev/null +++ b/codenet/public_test_cases/p03658/input.1.txt @@ -0,0 +1,2 @@ +15 14 +50 26 27 21 41 7 42 35 7 5 5 36 39 1 45 diff --git a/codenet/public_test_cases/p03658/input.2.txt b/codenet/public_test_cases/p03658/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7414a21c5fa330e8417f28dd55e5ea21b73e1144 --- /dev/null +++ b/codenet/public_test_cases/p03658/input.2.txt @@ -0,0 +1,2 @@ +5 3 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03658/output.0.txt b/codenet/public_test_cases/p03658/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03658/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03658/output.1.txt b/codenet/public_test_cases/p03658/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aeccadf78362abd1f808e39f898b6fefa0f1dcec --- /dev/null +++ b/codenet/public_test_cases/p03658/output.1.txt @@ -0,0 +1 @@ +386 diff --git a/codenet/public_test_cases/p03658/output.2.txt b/codenet/public_test_cases/p03658/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03658/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03659/input.0.txt b/codenet/public_test_cases/p03659/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee886e113fb8e0c61426795b71508f0130a4438 --- /dev/null +++ b/codenet/public_test_cases/p03659/input.0.txt @@ -0,0 +1,2 @@ +6 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p03659/input.1.txt b/codenet/public_test_cases/p03659/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee886e113fb8e0c61426795b71508f0130a4438 --- /dev/null +++ b/codenet/public_test_cases/p03659/input.1.txt @@ -0,0 +1,2 @@ +6 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p03659/input.2.txt b/codenet/public_test_cases/p03659/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..335374b79f6dd17cbb646953b32ec6476765fedc --- /dev/null +++ b/codenet/public_test_cases/p03659/input.2.txt @@ -0,0 +1,2 @@ +2 +10 -10 diff --git a/codenet/public_test_cases/p03659/output.0.txt b/codenet/public_test_cases/p03659/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03659/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03659/output.1.txt b/codenet/public_test_cases/p03659/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03659/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03659/output.2.txt b/codenet/public_test_cases/p03659/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03659/output.2.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03660/input.0.txt b/codenet/public_test_cases/p03660/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dca699f88e7c06ae1c2dae48cda4207b03443fc9 --- /dev/null +++ b/codenet/public_test_cases/p03660/input.0.txt @@ -0,0 +1,7 @@ +7 +3 6 +1 2 +3 1 +7 4 +5 7 +1 4 diff --git a/codenet/public_test_cases/p03660/output.0.txt b/codenet/public_test_cases/p03660/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4aecd8165b8122c76e25ecc7ea6582a7c5887ca3 --- /dev/null +++ b/codenet/public_test_cases/p03660/output.0.txt @@ -0,0 +1 @@ +Fennec diff --git a/codenet/public_test_cases/p03661/input.0.txt b/codenet/public_test_cases/p03661/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ee886e113fb8e0c61426795b71508f0130a4438 --- /dev/null +++ b/codenet/public_test_cases/p03661/input.0.txt @@ -0,0 +1,2 @@ +6 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p03661/output.0.txt b/codenet/public_test_cases/p03661/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03661/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03662/input.0.txt b/codenet/public_test_cases/p03662/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dca699f88e7c06ae1c2dae48cda4207b03443fc9 --- /dev/null +++ b/codenet/public_test_cases/p03662/input.0.txt @@ -0,0 +1,7 @@ +7 +3 6 +1 2 +3 1 +7 4 +5 7 +1 4 diff --git a/codenet/public_test_cases/p03662/input.1.txt b/codenet/public_test_cases/p03662/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad7e03d90e7a8021875df1ef0562300291af22d4 --- /dev/null +++ b/codenet/public_test_cases/p03662/input.1.txt @@ -0,0 +1,4 @@ +4 +1 4 +4 2 +2 3 diff --git a/codenet/public_test_cases/p03662/input.2.txt b/codenet/public_test_cases/p03662/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dca699f88e7c06ae1c2dae48cda4207b03443fc9 --- /dev/null +++ b/codenet/public_test_cases/p03662/input.2.txt @@ -0,0 +1,7 @@ +7 +3 6 +1 2 +3 1 +7 4 +5 7 +1 4 diff --git a/codenet/public_test_cases/p03662/output.0.txt b/codenet/public_test_cases/p03662/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4aecd8165b8122c76e25ecc7ea6582a7c5887ca3 --- /dev/null +++ b/codenet/public_test_cases/p03662/output.0.txt @@ -0,0 +1 @@ +Fennec diff --git a/codenet/public_test_cases/p03662/output.1.txt b/codenet/public_test_cases/p03662/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..745062eb37e7fb3fe05e7957680d6e99d54a82b9 --- /dev/null +++ b/codenet/public_test_cases/p03662/output.1.txt @@ -0,0 +1 @@ +Snuke diff --git a/codenet/public_test_cases/p03662/output.2.txt b/codenet/public_test_cases/p03662/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4aecd8165b8122c76e25ecc7ea6582a7c5887ca3 --- /dev/null +++ b/codenet/public_test_cases/p03662/output.2.txt @@ -0,0 +1 @@ +Fennec diff --git a/codenet/public_test_cases/p03664/input.0.txt b/codenet/public_test_cases/p03664/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf4953b4a1556af7a8d3d297e268b7581368b29a --- /dev/null +++ b/codenet/public_test_cases/p03664/input.0.txt @@ -0,0 +1,7 @@ +4 6 +1 2 100 +3 1 100 +2 4 100 +4 3 100 +1 4 100 +3 2 100 diff --git a/codenet/public_test_cases/p03664/input.1.txt b/codenet/public_test_cases/p03664/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69032148db1badb9b9bc7a3ed1bc65a1c1195cad --- /dev/null +++ b/codenet/public_test_cases/p03664/input.1.txt @@ -0,0 +1,23 @@ +15 22 +8 13 33418 +14 15 55849 +7 10 15207 +4 6 64328 +6 9 86902 +15 7 46978 +8 14 53526 +1 2 8720 +14 12 37748 +8 3 61543 +6 5 32425 +4 11 20932 +3 12 55123 +8 2 45333 +9 12 77796 +3 9 71922 +12 15 70793 +2 4 25485 +11 6 1436 +2 7 81563 +7 11 97843 +3 1 40491 diff --git a/codenet/public_test_cases/p03664/input.2.txt b/codenet/public_test_cases/p03664/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..71fcd8431c6ef5a607f6db97d4321c7f1f8d9de4 --- /dev/null +++ b/codenet/public_test_cases/p03664/input.2.txt @@ -0,0 +1,2 @@ +2 1 +1 2 1 diff --git a/codenet/public_test_cases/p03664/input.3.txt b/codenet/public_test_cases/p03664/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf4953b4a1556af7a8d3d297e268b7581368b29a --- /dev/null +++ b/codenet/public_test_cases/p03664/input.3.txt @@ -0,0 +1,7 @@ +4 6 +1 2 100 +3 1 100 +2 4 100 +4 3 100 +1 4 100 +3 2 100 diff --git a/codenet/public_test_cases/p03664/output.0.txt b/codenet/public_test_cases/p03664/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08839f6bb296e888d311d8ea2f35f7ff82dd3f2d --- /dev/null +++ b/codenet/public_test_cases/p03664/output.0.txt @@ -0,0 +1 @@ +200 diff --git a/codenet/public_test_cases/p03664/output.1.txt b/codenet/public_test_cases/p03664/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46c136bf11ff28e46ca70323f0e1a5731bb217f3 --- /dev/null +++ b/codenet/public_test_cases/p03664/output.1.txt @@ -0,0 +1 @@ +133677 diff --git a/codenet/public_test_cases/p03664/output.2.txt b/codenet/public_test_cases/p03664/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03664/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03664/output.3.txt b/codenet/public_test_cases/p03664/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..08839f6bb296e888d311d8ea2f35f7ff82dd3f2d --- /dev/null +++ b/codenet/public_test_cases/p03664/output.3.txt @@ -0,0 +1 @@ +200 diff --git a/codenet/public_test_cases/p03665/input.0.txt b/codenet/public_test_cases/p03665/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9c573f8e4c3370184e75ee6ae6f8e9881d718c3 --- /dev/null +++ b/codenet/public_test_cases/p03665/input.0.txt @@ -0,0 +1,2 @@ +2 0 +1 3 diff --git a/codenet/public_test_cases/p03665/input.1.txt b/codenet/public_test_cases/p03665/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a15a558085825d9e31901dc47d36bb66f95b9c9 --- /dev/null +++ b/codenet/public_test_cases/p03665/input.1.txt @@ -0,0 +1,2 @@ +3 0 +1 1 1 diff --git a/codenet/public_test_cases/p03665/input.2.txt b/codenet/public_test_cases/p03665/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd3e03b8e00e34871805e7ab186bac0cebadd33d --- /dev/null +++ b/codenet/public_test_cases/p03665/input.2.txt @@ -0,0 +1,2 @@ +1 1 +50 diff --git a/codenet/public_test_cases/p03665/input.3.txt b/codenet/public_test_cases/p03665/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9c573f8e4c3370184e75ee6ae6f8e9881d718c3 --- /dev/null +++ b/codenet/public_test_cases/p03665/input.3.txt @@ -0,0 +1,2 @@ +2 0 +1 3 diff --git a/codenet/public_test_cases/p03665/input.4.txt b/codenet/public_test_cases/p03665/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed66fdb06aca33773558d6a556f36368b15ea41 --- /dev/null +++ b/codenet/public_test_cases/p03665/input.4.txt @@ -0,0 +1,2 @@ +45 1 +17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26 diff --git a/codenet/public_test_cases/p03665/output.0.txt b/codenet/public_test_cases/p03665/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03665/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03665/output.1.txt b/codenet/public_test_cases/p03665/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03665/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03665/output.2.txt b/codenet/public_test_cases/p03665/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03665/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03665/output.3.txt b/codenet/public_test_cases/p03665/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03665/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03665/output.4.txt b/codenet/public_test_cases/p03665/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1c8c019498913a37b2270d4a0dd9d5399369511 --- /dev/null +++ b/codenet/public_test_cases/p03665/output.4.txt @@ -0,0 +1 @@ +17592186044416 diff --git a/codenet/public_test_cases/p03666/input.0.txt b/codenet/public_test_cases/p03666/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7bb5ef743e0273fa512f5995eed8c07ea48819e --- /dev/null +++ b/codenet/public_test_cases/p03666/input.0.txt @@ -0,0 +1 @@ +5 1 5 2 4 diff --git a/codenet/public_test_cases/p03666/input.1.txt b/codenet/public_test_cases/p03666/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed9b3e111b82d34eff88657e2a85e9e3c8e1bce9 --- /dev/null +++ b/codenet/public_test_cases/p03666/input.1.txt @@ -0,0 +1 @@ +48792 105960835 681218449 90629745 90632170 diff --git a/codenet/public_test_cases/p03666/input.2.txt b/codenet/public_test_cases/p03666/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b532964482390a9d83c5470f8fc59619e4d057f3 --- /dev/null +++ b/codenet/public_test_cases/p03666/input.2.txt @@ -0,0 +1 @@ +491995 412925347 825318103 59999126 59999339 diff --git a/codenet/public_test_cases/p03666/input.3.txt b/codenet/public_test_cases/p03666/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7bb5ef743e0273fa512f5995eed8c07ea48819e --- /dev/null +++ b/codenet/public_test_cases/p03666/input.3.txt @@ -0,0 +1 @@ +5 1 5 2 4 diff --git a/codenet/public_test_cases/p03666/input.4.txt b/codenet/public_test_cases/p03666/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..60a4a14eb7e691a9c6e520a2a8dd1af1c69530d3 --- /dev/null +++ b/codenet/public_test_cases/p03666/input.4.txt @@ -0,0 +1 @@ +4 7 6 4 5 diff --git a/codenet/public_test_cases/p03666/output.0.txt b/codenet/public_test_cases/p03666/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03666/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03666/output.1.txt b/codenet/public_test_cases/p03666/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03666/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03666/output.2.txt b/codenet/public_test_cases/p03666/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03666/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03666/output.3.txt b/codenet/public_test_cases/p03666/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03666/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03666/output.4.txt b/codenet/public_test_cases/p03666/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03666/output.4.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03667/input.0.txt b/codenet/public_test_cases/p03667/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2448cd072b6281b38688a6257ebde0fb11376454 --- /dev/null +++ b/codenet/public_test_cases/p03667/input.0.txt @@ -0,0 +1,5 @@ +5 3 +1 1 3 4 5 +1 2 +2 5 +5 4 diff --git a/codenet/public_test_cases/p03667/input.1.txt b/codenet/public_test_cases/p03667/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2448cd072b6281b38688a6257ebde0fb11376454 --- /dev/null +++ b/codenet/public_test_cases/p03667/input.1.txt @@ -0,0 +1,5 @@ +5 3 +1 1 3 4 5 +1 2 +2 5 +5 4 diff --git a/codenet/public_test_cases/p03667/input.2.txt b/codenet/public_test_cases/p03667/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb3028fd4ec01c1d652fbef9e6830768d6faa526 --- /dev/null +++ b/codenet/public_test_cases/p03667/input.2.txt @@ -0,0 +1,6 @@ +4 4 +4 4 4 4 +4 1 +3 1 +1 1 +2 1 diff --git a/codenet/public_test_cases/p03667/input.3.txt b/codenet/public_test_cases/p03667/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0ef4c723ba16e32a5eb1154f25b3652ec3251ea --- /dev/null +++ b/codenet/public_test_cases/p03667/input.3.txt @@ -0,0 +1,12 @@ +10 10 +8 7 2 9 10 6 6 5 5 4 +8 1 +6 3 +6 2 +7 10 +9 7 +9 9 +2 4 +8 1 +1 8 +7 7 diff --git a/codenet/public_test_cases/p03667/output.0.txt b/codenet/public_test_cases/p03667/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..986394f7c0fa05e52a94a3d93dee7085ed84cca4 --- /dev/null +++ b/codenet/public_test_cases/p03667/output.0.txt @@ -0,0 +1,3 @@ +0 +1 +1 diff --git a/codenet/public_test_cases/p03667/output.1.txt b/codenet/public_test_cases/p03667/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..986394f7c0fa05e52a94a3d93dee7085ed84cca4 --- /dev/null +++ b/codenet/public_test_cases/p03667/output.1.txt @@ -0,0 +1,3 @@ +0 +1 +1 diff --git a/codenet/public_test_cases/p03667/output.2.txt b/codenet/public_test_cases/p03667/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc856dafab0941942ccea4202bfa3a5b02bf4371 --- /dev/null +++ b/codenet/public_test_cases/p03667/output.2.txt @@ -0,0 +1,4 @@ +0 +1 +2 +3 diff --git a/codenet/public_test_cases/p03667/output.3.txt b/codenet/public_test_cases/p03667/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..51733d841d7dc1303ae1409c12655c2013395f77 --- /dev/null +++ b/codenet/public_test_cases/p03667/output.3.txt @@ -0,0 +1,10 @@ +1 +0 +1 +2 +2 +3 +3 +3 +3 +2 diff --git a/codenet/public_test_cases/p03668/input.0.txt b/codenet/public_test_cases/p03668/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb7357eca2083e13f4ab0688f8f6e042d29dfd56 --- /dev/null +++ b/codenet/public_test_cases/p03668/input.0.txt @@ -0,0 +1,5 @@ +5 +1 2 +2 3 +2 4 +4 5 diff --git a/codenet/public_test_cases/p03668/input.1.txt b/codenet/public_test_cases/p03668/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb7357eca2083e13f4ab0688f8f6e042d29dfd56 --- /dev/null +++ b/codenet/public_test_cases/p03668/input.1.txt @@ -0,0 +1,5 @@ +5 +1 2 +2 3 +2 4 +4 5 diff --git a/codenet/public_test_cases/p03668/input.2.txt b/codenet/public_test_cases/p03668/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9afc790893fab7d7b1dcffb8bf948671231c3bb --- /dev/null +++ b/codenet/public_test_cases/p03668/input.2.txt @@ -0,0 +1,5 @@ +5 +1 2 +2 3 +1 4 +4 5 diff --git a/codenet/public_test_cases/p03668/input.3.txt b/codenet/public_test_cases/p03668/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa06bc32ac549014fec7140f5e64d1c3811f1c20 --- /dev/null +++ b/codenet/public_test_cases/p03668/input.3.txt @@ -0,0 +1,7 @@ +7 +1 2 +3 7 +4 6 +2 3 +2 4 +1 5 diff --git a/codenet/public_test_cases/p03668/input.4.txt b/codenet/public_test_cases/p03668/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c8dea598f64c7881be97b47ceae5c8bd1f57630 --- /dev/null +++ b/codenet/public_test_cases/p03668/input.4.txt @@ -0,0 +1,6 @@ +6 +1 2 +2 4 +5 1 +6 3 +3 2 diff --git a/codenet/public_test_cases/p03668/output.0.txt b/codenet/public_test_cases/p03668/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03668/output.0.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03668/output.1.txt b/codenet/public_test_cases/p03668/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03668/output.1.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03668/output.2.txt b/codenet/public_test_cases/p03668/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p03668/output.2.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p03668/output.3.txt b/codenet/public_test_cases/p03668/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p03668/output.3.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p03668/output.4.txt b/codenet/public_test_cases/p03668/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03668/output.4.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03669/input.0.txt b/codenet/public_test_cases/p03669/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..23273ed5495639a28ad5ba41fb4915be3e123547 --- /dev/null +++ b/codenet/public_test_cases/p03669/input.0.txt @@ -0,0 +1,4 @@ +3 4 +1 1 0 0 +2 2 0 1 +3 3 1 0 diff --git a/codenet/public_test_cases/p03669/input.1.txt b/codenet/public_test_cases/p03669/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..510d85c7a82dd65c92b65e14db37339497936c77 --- /dev/null +++ b/codenet/public_test_cases/p03669/input.1.txt @@ -0,0 +1,11 @@ +10 4 +1 1 0 3 +2 3 2 0 +1 2 3 0 +2 1 0 0 +3 2 0 2 +1 1 3 0 +3 2 0 0 +1 3 2 0 +1 1 1 3 +2 3 0 0 diff --git a/codenet/public_test_cases/p03669/input.2.txt b/codenet/public_test_cases/p03669/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..23273ed5495639a28ad5ba41fb4915be3e123547 --- /dev/null +++ b/codenet/public_test_cases/p03669/input.2.txt @@ -0,0 +1,4 @@ +3 4 +1 1 0 0 +2 2 0 1 +3 3 1 0 diff --git a/codenet/public_test_cases/p03669/input.3.txt b/codenet/public_test_cases/p03669/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4ca73da6206a9d1be485e0281155136d4565c0b --- /dev/null +++ b/codenet/public_test_cases/p03669/input.3.txt @@ -0,0 +1,5 @@ +4 2 +1 1 0 1 +1 1 0 1 +1 1 0 1 +1 1 0 1 diff --git a/codenet/public_test_cases/p03669/output.0.txt b/codenet/public_test_cases/p03669/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03669/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03669/output.1.txt b/codenet/public_test_cases/p03669/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03669/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03669/output.2.txt b/codenet/public_test_cases/p03669/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03669/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03669/output.3.txt b/codenet/public_test_cases/p03669/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03669/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03670/input.0.txt b/codenet/public_test_cases/p03670/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dce25bda9588ce3f3488c3c685309e49ea8a9ef --- /dev/null +++ b/codenet/public_test_cases/p03670/input.0.txt @@ -0,0 +1,2 @@ +3 2 1 +1 2 0 diff --git a/codenet/public_test_cases/p03670/input.1.txt b/codenet/public_test_cases/p03670/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dce25bda9588ce3f3488c3c685309e49ea8a9ef --- /dev/null +++ b/codenet/public_test_cases/p03670/input.1.txt @@ -0,0 +1,2 @@ +3 2 1 +1 2 0 diff --git a/codenet/public_test_cases/p03670/input.2.txt b/codenet/public_test_cases/p03670/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..87f5db4bf2f6a8cf25c46a47d79b23b945b622a4 --- /dev/null +++ b/codenet/public_test_cases/p03670/input.2.txt @@ -0,0 +1,3 @@ +3 2 2 +1 1 1 +2 1 0 diff --git a/codenet/public_test_cases/p03670/input.3.txt b/codenet/public_test_cases/p03670/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..71e3adb978cea09e9052209a02666ea8aed0f6c3 --- /dev/null +++ b/codenet/public_test_cases/p03670/input.3.txt @@ -0,0 +1,3 @@ +5 4 2 +1 3 1 +4 2 0 diff --git a/codenet/public_test_cases/p03670/input.4.txt b/codenet/public_test_cases/p03670/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5f4e4449c9f5165741f236d295f3c157c3d5a9a --- /dev/null +++ b/codenet/public_test_cases/p03670/input.4.txt @@ -0,0 +1 @@ +20 20 0 diff --git a/codenet/public_test_cases/p03670/output.0.txt b/codenet/public_test_cases/p03670/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03670/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03670/output.1.txt b/codenet/public_test_cases/p03670/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03670/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03670/output.2.txt b/codenet/public_test_cases/p03670/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03670/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03670/output.3.txt b/codenet/public_test_cases/p03670/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..730a054a05d6b19fce149748d475c9c8210a6094 --- /dev/null +++ b/codenet/public_test_cases/p03670/output.3.txt @@ -0,0 +1 @@ +172 diff --git a/codenet/public_test_cases/p03670/output.4.txt b/codenet/public_test_cases/p03670/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffe8111a4fae1dfa6a2c42397637dc42a03aa5b2 --- /dev/null +++ b/codenet/public_test_cases/p03670/output.4.txt @@ -0,0 +1 @@ +881396682 diff --git a/codenet/public_test_cases/p03671/input.0.txt b/codenet/public_test_cases/p03671/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..24daf29a009f2e7f54cbf7ade3f44f9ffabddf62 --- /dev/null +++ b/codenet/public_test_cases/p03671/input.0.txt @@ -0,0 +1 @@ +700 600 780 diff --git a/codenet/public_test_cases/p03671/input.1.txt b/codenet/public_test_cases/p03671/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7aca916d0f6c45712e4d1d72440c9379b47449fe --- /dev/null +++ b/codenet/public_test_cases/p03671/input.1.txt @@ -0,0 +1 @@ +10000 10000 10000 diff --git a/codenet/public_test_cases/p03671/input.2.txt b/codenet/public_test_cases/p03671/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..24daf29a009f2e7f54cbf7ade3f44f9ffabddf62 --- /dev/null +++ b/codenet/public_test_cases/p03671/input.2.txt @@ -0,0 +1 @@ +700 600 780 diff --git a/codenet/public_test_cases/p03671/output.0.txt b/codenet/public_test_cases/p03671/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d772530577314aab98d903ff0cc7a76de17f9e15 --- /dev/null +++ b/codenet/public_test_cases/p03671/output.0.txt @@ -0,0 +1 @@ +1300 diff --git a/codenet/public_test_cases/p03671/output.1.txt b/codenet/public_test_cases/p03671/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b92677edb9566c26b6e52b6422544bb952cb7ca6 --- /dev/null +++ b/codenet/public_test_cases/p03671/output.1.txt @@ -0,0 +1 @@ +20000 diff --git a/codenet/public_test_cases/p03671/output.2.txt b/codenet/public_test_cases/p03671/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d772530577314aab98d903ff0cc7a76de17f9e15 --- /dev/null +++ b/codenet/public_test_cases/p03671/output.2.txt @@ -0,0 +1 @@ +1300 diff --git a/codenet/public_test_cases/p03672/input.0.txt b/codenet/public_test_cases/p03672/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..49d807a0ad4fb61b9234d5ffede3e6834c9264a7 --- /dev/null +++ b/codenet/public_test_cases/p03672/input.0.txt @@ -0,0 +1 @@ +abaababaab diff --git a/codenet/public_test_cases/p03672/input.1.txt b/codenet/public_test_cases/p03672/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..49d807a0ad4fb61b9234d5ffede3e6834c9264a7 --- /dev/null +++ b/codenet/public_test_cases/p03672/input.1.txt @@ -0,0 +1 @@ +abaababaab diff --git a/codenet/public_test_cases/p03672/input.2.txt b/codenet/public_test_cases/p03672/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2375f8108b2b664aa0c7533d599c03873f1d5f66 --- /dev/null +++ b/codenet/public_test_cases/p03672/input.2.txt @@ -0,0 +1 @@ +abcabcabcabc diff --git a/codenet/public_test_cases/p03672/input.3.txt b/codenet/public_test_cases/p03672/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..63fc8131d563e4c067404cb42d39eb293952bd51 --- /dev/null +++ b/codenet/public_test_cases/p03672/input.3.txt @@ -0,0 +1 @@ +xxxx diff --git a/codenet/public_test_cases/p03672/input.4.txt b/codenet/public_test_cases/p03672/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d27e0346bbba65d25484877ff318531fdde490b3 --- /dev/null +++ b/codenet/public_test_cases/p03672/input.4.txt @@ -0,0 +1 @@ +akasakaakasakasakaakas diff --git a/codenet/public_test_cases/p03672/output.0.txt b/codenet/public_test_cases/p03672/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03672/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03672/output.1.txt b/codenet/public_test_cases/p03672/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03672/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03672/output.2.txt b/codenet/public_test_cases/p03672/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03672/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03672/output.3.txt b/codenet/public_test_cases/p03672/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03672/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03672/output.4.txt b/codenet/public_test_cases/p03672/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03672/output.4.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03673/input.0.txt b/codenet/public_test_cases/p03673/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a4d515660c3c567ab07859fc5e252f8c966e46 --- /dev/null +++ b/codenet/public_test_cases/p03673/input.0.txt @@ -0,0 +1,2 @@ +4 +1 2 3 4 diff --git a/codenet/public_test_cases/p03673/output.0.txt b/codenet/public_test_cases/p03673/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce818bcbcc5ffa46782098f19aaa07922fa9fb0d --- /dev/null +++ b/codenet/public_test_cases/p03673/output.0.txt @@ -0,0 +1 @@ +4 2 1 3 diff --git a/codenet/public_test_cases/p03674/input.0.txt b/codenet/public_test_cases/p03674/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6357b8d6a4fa71fc3e324552d493858ca227a418 --- /dev/null +++ b/codenet/public_test_cases/p03674/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 1 3 diff --git a/codenet/public_test_cases/p03674/input.1.txt b/codenet/public_test_cases/p03674/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..20478c63e5f63708f9e029bd32f2a98cf73cbd6b --- /dev/null +++ b/codenet/public_test_cases/p03674/input.1.txt @@ -0,0 +1,2 @@ +1 +1 1 diff --git a/codenet/public_test_cases/p03674/input.2.txt b/codenet/public_test_cases/p03674/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b78286fd7efb97e0d93e3b5a486bbb9e0c7a3237 --- /dev/null +++ b/codenet/public_test_cases/p03674/input.2.txt @@ -0,0 +1,2 @@ +32 +29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9 diff --git a/codenet/public_test_cases/p03674/input.3.txt b/codenet/public_test_cases/p03674/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6357b8d6a4fa71fc3e324552d493858ca227a418 --- /dev/null +++ b/codenet/public_test_cases/p03674/input.3.txt @@ -0,0 +1,2 @@ +3 +1 2 1 3 diff --git a/codenet/public_test_cases/p03674/output.0.txt b/codenet/public_test_cases/p03674/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c08d8781d7d94dc29afc40547bf97eebe778e0ae --- /dev/null +++ b/codenet/public_test_cases/p03674/output.0.txt @@ -0,0 +1,4 @@ +3 +5 +4 +1 diff --git a/codenet/public_test_cases/p03674/output.1.txt b/codenet/public_test_cases/p03674/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p03674/output.1.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p03674/output.2.txt b/codenet/public_test_cases/p03674/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fdd452603f0da3dad0aa5d4cdb63c78da8e8ec02 --- /dev/null +++ b/codenet/public_test_cases/p03674/output.2.txt @@ -0,0 +1,33 @@ +32 +525 +5453 +40919 +237336 +1107568 +4272048 +13884156 +38567100 +92561040 +193536720 +354817320 +573166440 +818809200 +37158313 +166803103 +166803103 +37158313 +818809200 +573166440 +354817320 +193536720 +92561040 +38567100 +13884156 +4272048 +1107568 +237336 +40920 +5456 +528 +33 +1 diff --git a/codenet/public_test_cases/p03674/output.3.txt b/codenet/public_test_cases/p03674/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c08d8781d7d94dc29afc40547bf97eebe778e0ae --- /dev/null +++ b/codenet/public_test_cases/p03674/output.3.txt @@ -0,0 +1,4 @@ +3 +5 +4 +1 diff --git a/codenet/public_test_cases/p03675/input.0.txt b/codenet/public_test_cases/p03675/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a4d515660c3c567ab07859fc5e252f8c966e46 --- /dev/null +++ b/codenet/public_test_cases/p03675/input.0.txt @@ -0,0 +1,2 @@ +4 +1 2 3 4 diff --git a/codenet/public_test_cases/p03675/input.1.txt b/codenet/public_test_cases/p03675/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..24bc79b73a4beb49985fea8994940882e2e2ca75 --- /dev/null +++ b/codenet/public_test_cases/p03675/input.1.txt @@ -0,0 +1,2 @@ +6 +0 6 7 6 7 0 diff --git a/codenet/public_test_cases/p03675/input.2.txt b/codenet/public_test_cases/p03675/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a4d515660c3c567ab07859fc5e252f8c966e46 --- /dev/null +++ b/codenet/public_test_cases/p03675/input.2.txt @@ -0,0 +1,2 @@ +4 +1 2 3 4 diff --git a/codenet/public_test_cases/p03675/input.3.txt b/codenet/public_test_cases/p03675/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8faee6e444a239b1e46632078e2c9378479346c1 --- /dev/null +++ b/codenet/public_test_cases/p03675/input.3.txt @@ -0,0 +1,2 @@ +1 +1000000000 diff --git a/codenet/public_test_cases/p03675/input.4.txt b/codenet/public_test_cases/p03675/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03675/input.4.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03675/output.0.txt b/codenet/public_test_cases/p03675/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce818bcbcc5ffa46782098f19aaa07922fa9fb0d --- /dev/null +++ b/codenet/public_test_cases/p03675/output.0.txt @@ -0,0 +1 @@ +4 2 1 3 diff --git a/codenet/public_test_cases/p03675/output.1.txt b/codenet/public_test_cases/p03675/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0792df61af70ea159d54b3b06c15a37615fe0ae --- /dev/null +++ b/codenet/public_test_cases/p03675/output.1.txt @@ -0,0 +1 @@ +0 6 6 0 7 7 diff --git a/codenet/public_test_cases/p03675/output.2.txt b/codenet/public_test_cases/p03675/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce818bcbcc5ffa46782098f19aaa07922fa9fb0d --- /dev/null +++ b/codenet/public_test_cases/p03675/output.2.txt @@ -0,0 +1 @@ +4 2 1 3 diff --git a/codenet/public_test_cases/p03675/output.3.txt b/codenet/public_test_cases/p03675/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..770fdcfb4b7d03520f649b7f7ca20e2546bdb41f --- /dev/null +++ b/codenet/public_test_cases/p03675/output.3.txt @@ -0,0 +1 @@ +1000000000 diff --git a/codenet/public_test_cases/p03675/output.4.txt b/codenet/public_test_cases/p03675/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4c3b6fa8ddc94fc44ce15c6da3720c1f07040ba --- /dev/null +++ b/codenet/public_test_cases/p03675/output.4.txt @@ -0,0 +1 @@ +3 1 2 diff --git a/codenet/public_test_cases/p03676/input.0.txt b/codenet/public_test_cases/p03676/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6357b8d6a4fa71fc3e324552d493858ca227a418 --- /dev/null +++ b/codenet/public_test_cases/p03676/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 1 3 diff --git a/codenet/public_test_cases/p03676/output.0.txt b/codenet/public_test_cases/p03676/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c08d8781d7d94dc29afc40547bf97eebe778e0ae --- /dev/null +++ b/codenet/public_test_cases/p03676/output.0.txt @@ -0,0 +1,4 @@ +3 +5 +4 +1 diff --git a/codenet/public_test_cases/p03677/input.0.txt b/codenet/public_test_cases/p03677/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb097451500f5b8314203a6c2503bc9ad37036cd --- /dev/null +++ b/codenet/public_test_cases/p03677/input.0.txt @@ -0,0 +1,2 @@ +4 6 +1 5 1 4 diff --git a/codenet/public_test_cases/p03677/input.1.txt b/codenet/public_test_cases/p03677/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb097451500f5b8314203a6c2503bc9ad37036cd --- /dev/null +++ b/codenet/public_test_cases/p03677/input.1.txt @@ -0,0 +1,2 @@ +4 6 +1 5 1 4 diff --git a/codenet/public_test_cases/p03677/input.2.txt b/codenet/public_test_cases/p03677/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..40634cc1a09b6cf7e0ffc9c032f49b1bf2d529b7 --- /dev/null +++ b/codenet/public_test_cases/p03677/input.2.txt @@ -0,0 +1,2 @@ +10 10 +10 9 8 7 6 5 4 3 2 1 diff --git a/codenet/public_test_cases/p03677/output.0.txt b/codenet/public_test_cases/p03677/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03677/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03677/output.1.txt b/codenet/public_test_cases/p03677/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03677/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03677/output.2.txt b/codenet/public_test_cases/p03677/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea90ee31980757b2e469741512bcb39e73494e78 --- /dev/null +++ b/codenet/public_test_cases/p03677/output.2.txt @@ -0,0 +1 @@ +45 diff --git a/codenet/public_test_cases/p03678/input.0.txt b/codenet/public_test_cases/p03678/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c9d7351f31927dcb963ebabd41d297a3093d4a0 --- /dev/null +++ b/codenet/public_test_cases/p03678/input.0.txt @@ -0,0 +1,2 @@ +abaaba +6 10 diff --git a/codenet/public_test_cases/p03678/input.1.txt b/codenet/public_test_cases/p03678/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dccd567b64e11f254364d7589c5208b51a0a74f7 --- /dev/null +++ b/codenet/public_test_cases/p03678/input.1.txt @@ -0,0 +1,2 @@ +vgxgpuamkvgxgvgxgpuamkvgxg +1 1000000000000000000 diff --git a/codenet/public_test_cases/p03678/input.2.txt b/codenet/public_test_cases/p03678/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d4d2c85d093b382cddff258a5bb78d0a90383c04 --- /dev/null +++ b/codenet/public_test_cases/p03678/input.2.txt @@ -0,0 +1,2 @@ +xx +1 1000000000000000000 diff --git a/codenet/public_test_cases/p03678/input.3.txt b/codenet/public_test_cases/p03678/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0c9d7351f31927dcb963ebabd41d297a3093d4a0 --- /dev/null +++ b/codenet/public_test_cases/p03678/input.3.txt @@ -0,0 +1,2 @@ +abaaba +6 10 diff --git a/codenet/public_test_cases/p03678/output.0.txt b/codenet/public_test_cases/p03678/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e21c53f1ad7078783ce57398f5cc2f27f8d426ee --- /dev/null +++ b/codenet/public_test_cases/p03678/output.0.txt @@ -0,0 +1 @@ +3 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p03678/output.1.txt b/codenet/public_test_cases/p03678/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..62e336be6bfe22e1a04f855c9a9f9148c978fa48 --- /dev/null +++ b/codenet/public_test_cases/p03678/output.1.txt @@ -0,0 +1 @@ +87167725689669676 0 0 0 0 0 282080685775825810 0 0 0 87167725689669676 0 87167725689669676 0 0 87167725689669676 0 0 0 0 87167725689669676 141040342887912905 0 141040342887912905 0 0 diff --git a/codenet/public_test_cases/p03678/output.2.txt b/codenet/public_test_cases/p03678/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9e36800ed3ef4285652ec41913610d00f858065 --- /dev/null +++ b/codenet/public_test_cases/p03678/output.2.txt @@ -0,0 +1 @@ +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1000000000000000000 0 0 diff --git a/codenet/public_test_cases/p03678/output.3.txt b/codenet/public_test_cases/p03678/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e21c53f1ad7078783ce57398f5cc2f27f8d426ee --- /dev/null +++ b/codenet/public_test_cases/p03678/output.3.txt @@ -0,0 +1 @@ +3 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/codenet/public_test_cases/p03679/input.0.txt b/codenet/public_test_cases/p03679/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f44244baaaa2aea6bedd6b5cd5d071e31b46e8df --- /dev/null +++ b/codenet/public_test_cases/p03679/input.0.txt @@ -0,0 +1 @@ +4 3 6 diff --git a/codenet/public_test_cases/p03679/input.1.txt b/codenet/public_test_cases/p03679/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f44244baaaa2aea6bedd6b5cd5d071e31b46e8df --- /dev/null +++ b/codenet/public_test_cases/p03679/input.1.txt @@ -0,0 +1 @@ +4 3 6 diff --git a/codenet/public_test_cases/p03679/input.2.txt b/codenet/public_test_cases/p03679/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4187bffd6bddb72adb386c61be2751cf7caa8755 --- /dev/null +++ b/codenet/public_test_cases/p03679/input.2.txt @@ -0,0 +1 @@ +6 5 1 diff --git a/codenet/public_test_cases/p03679/input.3.txt b/codenet/public_test_cases/p03679/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1f25ed83f5879d7bd090f6952c6528df00b362d --- /dev/null +++ b/codenet/public_test_cases/p03679/input.3.txt @@ -0,0 +1 @@ +3 7 12 diff --git a/codenet/public_test_cases/p03679/output.0.txt b/codenet/public_test_cases/p03679/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7767f67d3494c9c8df2deaac7129f48ce33d2f7 --- /dev/null +++ b/codenet/public_test_cases/p03679/output.0.txt @@ -0,0 +1 @@ +safe diff --git a/codenet/public_test_cases/p03679/output.1.txt b/codenet/public_test_cases/p03679/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7767f67d3494c9c8df2deaac7129f48ce33d2f7 --- /dev/null +++ b/codenet/public_test_cases/p03679/output.1.txt @@ -0,0 +1 @@ +safe diff --git a/codenet/public_test_cases/p03679/output.2.txt b/codenet/public_test_cases/p03679/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d47584887ba08d615ec8176949ab6c30b846fa5 --- /dev/null +++ b/codenet/public_test_cases/p03679/output.2.txt @@ -0,0 +1 @@ +delicious diff --git a/codenet/public_test_cases/p03679/output.3.txt b/codenet/public_test_cases/p03679/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8438307b9fe33ae479bb975bdf8fbb5dea385d42 --- /dev/null +++ b/codenet/public_test_cases/p03679/output.3.txt @@ -0,0 +1 @@ +dangerous diff --git a/codenet/public_test_cases/p03680/input.0.txt b/codenet/public_test_cases/p03680/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d6ec76789f40db7d20f7a5620be54bff42c3193 --- /dev/null +++ b/codenet/public_test_cases/p03680/input.0.txt @@ -0,0 +1,4 @@ +3 +3 +1 +2 diff --git a/codenet/public_test_cases/p03680/input.1.txt b/codenet/public_test_cases/p03680/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d6ec76789f40db7d20f7a5620be54bff42c3193 --- /dev/null +++ b/codenet/public_test_cases/p03680/input.1.txt @@ -0,0 +1,4 @@ +3 +3 +1 +2 diff --git a/codenet/public_test_cases/p03680/input.2.txt b/codenet/public_test_cases/p03680/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0159210d717c280109d3a4b22d92d62b9e6efa37 --- /dev/null +++ b/codenet/public_test_cases/p03680/input.2.txt @@ -0,0 +1,6 @@ +5 +3 +3 +4 +2 +4 diff --git a/codenet/public_test_cases/p03680/input.3.txt b/codenet/public_test_cases/p03680/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..796a4816d68a5f21157d8ab0c74e6a87af4c586a --- /dev/null +++ b/codenet/public_test_cases/p03680/input.3.txt @@ -0,0 +1,5 @@ +4 +3 +4 +1 +2 diff --git a/codenet/public_test_cases/p03680/output.0.txt b/codenet/public_test_cases/p03680/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03680/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03680/output.1.txt b/codenet/public_test_cases/p03680/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03680/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03680/output.2.txt b/codenet/public_test_cases/p03680/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03680/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03680/output.3.txt b/codenet/public_test_cases/p03680/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03680/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03681/input.0.txt b/codenet/public_test_cases/p03681/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03681/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03681/output.0.txt b/codenet/public_test_cases/p03681/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03681/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03682/input.0.txt b/codenet/public_test_cases/p03682/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e663c5c0ac2a153bb5a296d093e21bcc384b02a --- /dev/null +++ b/codenet/public_test_cases/p03682/input.0.txt @@ -0,0 +1,4 @@ +3 +1 5 +3 9 +7 8 diff --git a/codenet/public_test_cases/p03682/output.0.txt b/codenet/public_test_cases/p03682/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03682/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03683/input.0.txt b/codenet/public_test_cases/p03683/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03683/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03683/input.1.txt b/codenet/public_test_cases/p03683/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bfd8643e47256f0fce54761d9cc9e58d209aebc --- /dev/null +++ b/codenet/public_test_cases/p03683/input.1.txt @@ -0,0 +1 @@ +100000 100000 diff --git a/codenet/public_test_cases/p03683/input.2.txt b/codenet/public_test_cases/p03683/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce438813ac78ccab622a25c584da28e4df80db5 --- /dev/null +++ b/codenet/public_test_cases/p03683/input.2.txt @@ -0,0 +1 @@ +3 2 diff --git a/codenet/public_test_cases/p03683/input.3.txt b/codenet/public_test_cases/p03683/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ebabbcb524590aac8aa2ae22f41f4eff6cfd4e1 --- /dev/null +++ b/codenet/public_test_cases/p03683/input.3.txt @@ -0,0 +1 @@ +1 8 diff --git a/codenet/public_test_cases/p03683/input.4.txt b/codenet/public_test_cases/p03683/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03683/input.4.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03683/output.0.txt b/codenet/public_test_cases/p03683/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03683/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03683/output.1.txt b/codenet/public_test_cases/p03683/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b5a6478ea3c00c348e9401c85cfa533dac4b531 --- /dev/null +++ b/codenet/public_test_cases/p03683/output.1.txt @@ -0,0 +1 @@ +530123477 diff --git a/codenet/public_test_cases/p03683/output.2.txt b/codenet/public_test_cases/p03683/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03683/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03683/output.3.txt b/codenet/public_test_cases/p03683/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03683/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03683/output.4.txt b/codenet/public_test_cases/p03683/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03683/output.4.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03684/input.0.txt b/codenet/public_test_cases/p03684/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e663c5c0ac2a153bb5a296d093e21bcc384b02a --- /dev/null +++ b/codenet/public_test_cases/p03684/input.0.txt @@ -0,0 +1,4 @@ +3 +1 5 +3 9 +7 8 diff --git a/codenet/public_test_cases/p03684/input.1.txt b/codenet/public_test_cases/p03684/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..60719023385529bed75e93a8f64c8d2c0350a346 --- /dev/null +++ b/codenet/public_test_cases/p03684/input.1.txt @@ -0,0 +1,7 @@ +6 +8 3 +4 9 +12 19 +18 1 +13 5 +7 6 diff --git a/codenet/public_test_cases/p03684/input.2.txt b/codenet/public_test_cases/p03684/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e663c5c0ac2a153bb5a296d093e21bcc384b02a --- /dev/null +++ b/codenet/public_test_cases/p03684/input.2.txt @@ -0,0 +1,4 @@ +3 +1 5 +3 9 +7 8 diff --git a/codenet/public_test_cases/p03684/output.0.txt b/codenet/public_test_cases/p03684/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03684/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03684/output.1.txt b/codenet/public_test_cases/p03684/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03684/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03684/output.2.txt b/codenet/public_test_cases/p03684/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03684/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03685/input.0.txt b/codenet/public_test_cases/p03685/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..613798ae568bb8990a88c2f6c1790dfb3246a859 --- /dev/null +++ b/codenet/public_test_cases/p03685/input.0.txt @@ -0,0 +1,4 @@ +4 2 3 +0 1 3 1 +1 1 4 1 +2 0 2 2 diff --git a/codenet/public_test_cases/p03685/input.1.txt b/codenet/public_test_cases/p03685/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..613798ae568bb8990a88c2f6c1790dfb3246a859 --- /dev/null +++ b/codenet/public_test_cases/p03685/input.1.txt @@ -0,0 +1,4 @@ +4 2 3 +0 1 3 1 +1 1 4 1 +2 0 2 2 diff --git a/codenet/public_test_cases/p03685/input.2.txt b/codenet/public_test_cases/p03685/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5998fa118ef91c51884601563aead76513f96fd --- /dev/null +++ b/codenet/public_test_cases/p03685/input.2.txt @@ -0,0 +1,8 @@ +5 5 7 +0 0 2 4 +2 3 4 5 +3 5 5 2 +5 5 5 4 +0 3 5 1 +2 2 4 4 +0 5 4 1 diff --git a/codenet/public_test_cases/p03685/input.3.txt b/codenet/public_test_cases/p03685/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d89c9d44e66f780b807b5cfe60a9cec8eaa60f7 --- /dev/null +++ b/codenet/public_test_cases/p03685/input.3.txt @@ -0,0 +1,5 @@ +2 2 4 +0 0 2 2 +2 0 0 1 +0 2 1 2 +1 1 2 1 diff --git a/codenet/public_test_cases/p03685/input.4.txt b/codenet/public_test_cases/p03685/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad9a5a70580939c1a17c4cc14d85392a8ea93b63 --- /dev/null +++ b/codenet/public_test_cases/p03685/input.4.txt @@ -0,0 +1,3 @@ +1 1 2 +0 0 1 1 +1 0 0 1 diff --git a/codenet/public_test_cases/p03685/output.0.txt b/codenet/public_test_cases/p03685/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03685/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03685/output.1.txt b/codenet/public_test_cases/p03685/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03685/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03685/output.2.txt b/codenet/public_test_cases/p03685/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03685/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03685/output.3.txt b/codenet/public_test_cases/p03685/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03685/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03685/output.4.txt b/codenet/public_test_cases/p03685/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03685/output.4.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03686/input.0.txt b/codenet/public_test_cases/p03686/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70eec072d84a7295a26e489971dba0d6e08146a --- /dev/null +++ b/codenet/public_test_cases/p03686/input.0.txt @@ -0,0 +1,5 @@ +4 4 +0 3 +2 3 +1 3 +3 4 diff --git a/codenet/public_test_cases/p03686/input.1.txt b/codenet/public_test_cases/p03686/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b4dcd71529b28c6d53eb6fe7cfec51724ac8f96 --- /dev/null +++ b/codenet/public_test_cases/p03686/input.1.txt @@ -0,0 +1,7 @@ +6 6 +1 6 +1 6 +1 5 +1 5 +2 6 +2 6 diff --git a/codenet/public_test_cases/p03686/input.2.txt b/codenet/public_test_cases/p03686/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70eec072d84a7295a26e489971dba0d6e08146a --- /dev/null +++ b/codenet/public_test_cases/p03686/input.2.txt @@ -0,0 +1,5 @@ +4 4 +0 3 +2 3 +1 3 +3 4 diff --git a/codenet/public_test_cases/p03686/input.3.txt b/codenet/public_test_cases/p03686/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f9d673bf3910a21b04986e625dbb5e27ad11562 --- /dev/null +++ b/codenet/public_test_cases/p03686/input.3.txt @@ -0,0 +1,8 @@ +7 6 +0 7 +1 5 +3 6 +2 7 +1 6 +2 6 +3 7 diff --git a/codenet/public_test_cases/p03686/input.4.txt b/codenet/public_test_cases/p03686/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4670f6711e46121a188fdb755f9806ecac82ac4 --- /dev/null +++ b/codenet/public_test_cases/p03686/input.4.txt @@ -0,0 +1,4 @@ +3 1 +1 2 +1 2 +1 2 diff --git a/codenet/public_test_cases/p03686/output.0.txt b/codenet/public_test_cases/p03686/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03686/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03686/output.1.txt b/codenet/public_test_cases/p03686/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03686/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03686/output.2.txt b/codenet/public_test_cases/p03686/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03686/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03686/output.3.txt b/codenet/public_test_cases/p03686/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03686/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03686/output.4.txt b/codenet/public_test_cases/p03686/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03686/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03687/input.0.txt b/codenet/public_test_cases/p03687/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d368247923840f35ded4e12ab65711769d569f2b --- /dev/null +++ b/codenet/public_test_cases/p03687/input.0.txt @@ -0,0 +1 @@ +serval diff --git a/codenet/public_test_cases/p03687/input.1.txt b/codenet/public_test_cases/p03687/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d368247923840f35ded4e12ab65711769d569f2b --- /dev/null +++ b/codenet/public_test_cases/p03687/input.1.txt @@ -0,0 +1 @@ +serval diff --git a/codenet/public_test_cases/p03687/input.2.txt b/codenet/public_test_cases/p03687/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..68798336ae914c1a682ac0a254402ad7f408192d --- /dev/null +++ b/codenet/public_test_cases/p03687/input.2.txt @@ -0,0 +1 @@ +whbrjpjyhsrywlqjxdbrbaomnw diff --git a/codenet/public_test_cases/p03687/input.3.txt b/codenet/public_test_cases/p03687/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b57ec9b7396a611eb13975b9f01636149d0e9e5 --- /dev/null +++ b/codenet/public_test_cases/p03687/input.3.txt @@ -0,0 +1 @@ +jackal diff --git a/codenet/public_test_cases/p03687/input.4.txt b/codenet/public_test_cases/p03687/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1a17ba136936531b72571844a773fe938b85ad4 --- /dev/null +++ b/codenet/public_test_cases/p03687/input.4.txt @@ -0,0 +1 @@ +zzz diff --git a/codenet/public_test_cases/p03687/output.0.txt b/codenet/public_test_cases/p03687/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03687/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03687/output.1.txt b/codenet/public_test_cases/p03687/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03687/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03687/output.2.txt b/codenet/public_test_cases/p03687/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03687/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03687/output.3.txt b/codenet/public_test_cases/p03687/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03687/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03687/output.4.txt b/codenet/public_test_cases/p03687/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03687/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03688/input.0.txt b/codenet/public_test_cases/p03688/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1a3ea4e326f8121a99b2057e7f2b8c9b0c2119f --- /dev/null +++ b/codenet/public_test_cases/p03688/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 2 diff --git a/codenet/public_test_cases/p03688/input.1.txt b/codenet/public_test_cases/p03688/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e1857e71f68a2a11164f7ca09cb1f89d82cb385 --- /dev/null +++ b/codenet/public_test_cases/p03688/input.1.txt @@ -0,0 +1,2 @@ +5 +4 3 4 3 4 diff --git a/codenet/public_test_cases/p03688/input.2.txt b/codenet/public_test_cases/p03688/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c54d55a8d166e20db07dc7c7ab25cb293a0c3cfd --- /dev/null +++ b/codenet/public_test_cases/p03688/input.2.txt @@ -0,0 +1,2 @@ +3 +1 1 2 diff --git a/codenet/public_test_cases/p03688/input.3.txt b/codenet/public_test_cases/p03688/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6ad0ca15d6caa972e6ddf0d652c404bffd885a2 --- /dev/null +++ b/codenet/public_test_cases/p03688/input.3.txt @@ -0,0 +1,2 @@ +5 +3 3 3 3 3 diff --git a/codenet/public_test_cases/p03688/input.4.txt b/codenet/public_test_cases/p03688/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1a3ea4e326f8121a99b2057e7f2b8c9b0c2119f --- /dev/null +++ b/codenet/public_test_cases/p03688/input.4.txt @@ -0,0 +1,2 @@ +3 +1 2 2 diff --git a/codenet/public_test_cases/p03688/input.5.txt b/codenet/public_test_cases/p03688/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7fb94c2e07f44732d9a7c8cf87909b12438cc5b --- /dev/null +++ b/codenet/public_test_cases/p03688/input.5.txt @@ -0,0 +1,2 @@ +4 +2 2 2 2 diff --git a/codenet/public_test_cases/p03688/input.6.txt b/codenet/public_test_cases/p03688/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..7de66e6d61c2f227c6978ef84b34d8e28eeb6bfe --- /dev/null +++ b/codenet/public_test_cases/p03688/input.6.txt @@ -0,0 +1,2 @@ +3 +2 2 2 diff --git a/codenet/public_test_cases/p03688/output.0.txt b/codenet/public_test_cases/p03688/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03688/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03688/output.1.txt b/codenet/public_test_cases/p03688/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03688/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03688/output.2.txt b/codenet/public_test_cases/p03688/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03688/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03688/output.3.txt b/codenet/public_test_cases/p03688/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03688/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03688/output.4.txt b/codenet/public_test_cases/p03688/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03688/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03688/output.5.txt b/codenet/public_test_cases/p03688/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03688/output.5.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03688/output.6.txt b/codenet/public_test_cases/p03688/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03688/output.6.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03689/input.0.txt b/codenet/public_test_cases/p03689/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c4e8901a7bd4ab6c93fb89729dca1b99f0e5123 --- /dev/null +++ b/codenet/public_test_cases/p03689/input.0.txt @@ -0,0 +1 @@ +3 3 2 2 diff --git a/codenet/public_test_cases/p03689/input.1.txt b/codenet/public_test_cases/p03689/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..212fe2895b354f17cbab8b732895ac267e7cf0e5 --- /dev/null +++ b/codenet/public_test_cases/p03689/input.1.txt @@ -0,0 +1 @@ +2 4 1 2 diff --git a/codenet/public_test_cases/p03689/input.2.txt b/codenet/public_test_cases/p03689/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..43291f26025b90ac2eaa684e1c4ee84808510aea --- /dev/null +++ b/codenet/public_test_cases/p03689/input.2.txt @@ -0,0 +1 @@ +3 4 2 3 diff --git a/codenet/public_test_cases/p03689/input.3.txt b/codenet/public_test_cases/p03689/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c4e8901a7bd4ab6c93fb89729dca1b99f0e5123 --- /dev/null +++ b/codenet/public_test_cases/p03689/input.3.txt @@ -0,0 +1 @@ +3 3 2 2 diff --git a/codenet/public_test_cases/p03689/output.0.txt b/codenet/public_test_cases/p03689/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5cb16c6ed006daa634f8be4ccac4a3baf597bd4 --- /dev/null +++ b/codenet/public_test_cases/p03689/output.0.txt @@ -0,0 +1,4 @@ +Yes +1 1 1 +1 -4 1 +1 1 1 diff --git a/codenet/public_test_cases/p03689/output.1.txt b/codenet/public_test_cases/p03689/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03689/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03689/output.2.txt b/codenet/public_test_cases/p03689/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b768c90dd9db7d04ae2168c7a5373b625f6a626 --- /dev/null +++ b/codenet/public_test_cases/p03689/output.2.txt @@ -0,0 +1,4 @@ +Yes +2 -5 8 7 +3 -5 -4 -5 +2 1 -1 7 diff --git a/codenet/public_test_cases/p03689/output.3.txt b/codenet/public_test_cases/p03689/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5cb16c6ed006daa634f8be4ccac4a3baf597bd4 --- /dev/null +++ b/codenet/public_test_cases/p03689/output.3.txt @@ -0,0 +1,4 @@ +Yes +1 1 1 +1 -4 1 +1 1 1 diff --git a/codenet/public_test_cases/p03690/input.0.txt b/codenet/public_test_cases/p03690/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e665fe82b1d58e567eee3598c81dd88b2414fad --- /dev/null +++ b/codenet/public_test_cases/p03690/input.0.txt @@ -0,0 +1,3 @@ +3 +0 1 2 +3 1 0 diff --git a/codenet/public_test_cases/p03690/input.1.txt b/codenet/public_test_cases/p03690/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e665fe82b1d58e567eee3598c81dd88b2414fad --- /dev/null +++ b/codenet/public_test_cases/p03690/input.1.txt @@ -0,0 +1,3 @@ +3 +0 1 2 +3 1 0 diff --git a/codenet/public_test_cases/p03690/input.2.txt b/codenet/public_test_cases/p03690/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e68a48ba87a48369e20ce9843af2d9c523f7f1b0 --- /dev/null +++ b/codenet/public_test_cases/p03690/input.2.txt @@ -0,0 +1,3 @@ +4 +0 1 2 3 +1 0 3 2 diff --git a/codenet/public_test_cases/p03690/input.3.txt b/codenet/public_test_cases/p03690/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..793a219bc9287b3b37f66693291390a2901a2744 --- /dev/null +++ b/codenet/public_test_cases/p03690/input.3.txt @@ -0,0 +1,3 @@ +3 +0 1 2 +0 1 2 diff --git a/codenet/public_test_cases/p03690/input.4.txt b/codenet/public_test_cases/p03690/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a2f7f7ca6f72ce1bd69d7f0c57684d4c6126868 --- /dev/null +++ b/codenet/public_test_cases/p03690/input.4.txt @@ -0,0 +1,3 @@ +2 +1 1 +0 0 diff --git a/codenet/public_test_cases/p03690/output.0.txt b/codenet/public_test_cases/p03690/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03690/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03690/output.1.txt b/codenet/public_test_cases/p03690/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03690/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03690/output.2.txt b/codenet/public_test_cases/p03690/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03690/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03690/output.3.txt b/codenet/public_test_cases/p03690/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03690/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03690/output.4.txt b/codenet/public_test_cases/p03690/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03690/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03691/input.0.txt b/codenet/public_test_cases/p03691/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fa34b26edbf5a028e89c0ad87b196b184ac114a --- /dev/null +++ b/codenet/public_test_cases/p03691/input.0.txt @@ -0,0 +1,2 @@ +3 1 +1 2 diff --git a/codenet/public_test_cases/p03691/input.1.txt b/codenet/public_test_cases/p03691/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d415dcf061e74c0a32abfd354a19a31d4bc285e3 --- /dev/null +++ b/codenet/public_test_cases/p03691/input.1.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +1 2 diff --git a/codenet/public_test_cases/p03691/input.2.txt b/codenet/public_test_cases/p03691/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bfedf910adf1ac8f0ed630db18fcb83cfaf84b8 --- /dev/null +++ b/codenet/public_test_cases/p03691/input.2.txt @@ -0,0 +1,4 @@ +4 3 +1 2 +3 4 +2 3 diff --git a/codenet/public_test_cases/p03691/input.3.txt b/codenet/public_test_cases/p03691/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..40355bb69986d9e173ebd45b6562b0a373964e20 --- /dev/null +++ b/codenet/public_test_cases/p03691/input.3.txt @@ -0,0 +1,11 @@ +10 10 +8 9 +2 8 +4 6 +4 9 +7 8 +2 8 +1 8 +3 4 +3 4 +2 7 diff --git a/codenet/public_test_cases/p03691/input.4.txt b/codenet/public_test_cases/p03691/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fa34b26edbf5a028e89c0ad87b196b184ac114a --- /dev/null +++ b/codenet/public_test_cases/p03691/input.4.txt @@ -0,0 +1,2 @@ +3 1 +1 2 diff --git a/codenet/public_test_cases/p03691/output.0.txt b/codenet/public_test_cases/p03691/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03691/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03691/output.1.txt b/codenet/public_test_cases/p03691/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03691/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03691/output.2.txt b/codenet/public_test_cases/p03691/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03691/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03691/output.3.txt b/codenet/public_test_cases/p03691/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03691/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03691/output.4.txt b/codenet/public_test_cases/p03691/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03691/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03692/input.0.txt b/codenet/public_test_cases/p03692/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fa10279583c299e9d987e8a5ad331bc6c8704d --- /dev/null +++ b/codenet/public_test_cases/p03692/input.0.txt @@ -0,0 +1,2 @@ +2 1 +1 2 diff --git a/codenet/public_test_cases/p03692/input.1.txt b/codenet/public_test_cases/p03692/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..938abf4cc84ac0f75d8470678b365b734c5a9076 --- /dev/null +++ b/codenet/public_test_cases/p03692/input.1.txt @@ -0,0 +1,3 @@ +4 2 +1 3 +2 4 diff --git a/codenet/public_test_cases/p03692/input.2.txt b/codenet/public_test_cases/p03692/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab6b3ad72b66bb8b71a331f71dab8ab6b5a2e1b2 --- /dev/null +++ b/codenet/public_test_cases/p03692/input.2.txt @@ -0,0 +1,11 @@ +5 10 +2 4 +3 4 +2 5 +2 3 +1 2 +3 5 +1 3 +1 5 +4 5 +1 4 diff --git a/codenet/public_test_cases/p03692/input.3.txt b/codenet/public_test_cases/p03692/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc88773658f25592fbc224fa48bd285513c79119 --- /dev/null +++ b/codenet/public_test_cases/p03692/input.3.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03692/input.4.txt b/codenet/public_test_cases/p03692/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9fa10279583c299e9d987e8a5ad331bc6c8704d --- /dev/null +++ b/codenet/public_test_cases/p03692/input.4.txt @@ -0,0 +1,2 @@ +2 1 +1 2 diff --git a/codenet/public_test_cases/p03692/output.0.txt b/codenet/public_test_cases/p03692/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03692/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03692/output.1.txt b/codenet/public_test_cases/p03692/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03692/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03692/output.2.txt b/codenet/public_test_cases/p03692/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd93ccc9dbccdc409312a8f118ad64431b5e01e6 --- /dev/null +++ b/codenet/public_test_cases/p03692/output.2.txt @@ -0,0 +1 @@ +816 diff --git a/codenet/public_test_cases/p03692/output.3.txt b/codenet/public_test_cases/p03692/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03692/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03692/output.4.txt b/codenet/public_test_cases/p03692/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03692/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03693/input.0.txt b/codenet/public_test_cases/p03693/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8745e6f89587ddd56678ed3cebbdd42dd2f83f33 --- /dev/null +++ b/codenet/public_test_cases/p03693/input.0.txt @@ -0,0 +1 @@ +4 3 2 diff --git a/codenet/public_test_cases/p03693/input.1.txt b/codenet/public_test_cases/p03693/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8745e6f89587ddd56678ed3cebbdd42dd2f83f33 --- /dev/null +++ b/codenet/public_test_cases/p03693/input.1.txt @@ -0,0 +1 @@ +4 3 2 diff --git a/codenet/public_test_cases/p03693/input.2.txt b/codenet/public_test_cases/p03693/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aacd417fc7c2580e624192c8176938cde0c8f06 --- /dev/null +++ b/codenet/public_test_cases/p03693/input.2.txt @@ -0,0 +1 @@ +2 3 4 diff --git a/codenet/public_test_cases/p03693/output.0.txt b/codenet/public_test_cases/p03693/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03693/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03693/output.1.txt b/codenet/public_test_cases/p03693/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03693/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03693/output.2.txt b/codenet/public_test_cases/p03693/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03693/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03694/input.0.txt b/codenet/public_test_cases/p03694/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b27f01a7269693686d3af70c165f99f2c1542de2 --- /dev/null +++ b/codenet/public_test_cases/p03694/input.0.txt @@ -0,0 +1,2 @@ +4 +2 3 7 9 diff --git a/codenet/public_test_cases/p03694/input.1.txt b/codenet/public_test_cases/p03694/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b27f01a7269693686d3af70c165f99f2c1542de2 --- /dev/null +++ b/codenet/public_test_cases/p03694/input.1.txt @@ -0,0 +1,2 @@ +4 +2 3 7 9 diff --git a/codenet/public_test_cases/p03694/input.2.txt b/codenet/public_test_cases/p03694/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1106c7db160dfbf7191fbd97774cbb40b33e0a52 --- /dev/null +++ b/codenet/public_test_cases/p03694/input.2.txt @@ -0,0 +1,2 @@ +8 +3 1 4 1 5 9 2 6 diff --git a/codenet/public_test_cases/p03694/output.0.txt b/codenet/public_test_cases/p03694/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03694/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03694/output.1.txt b/codenet/public_test_cases/p03694/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03694/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03694/output.2.txt b/codenet/public_test_cases/p03694/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03694/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03695/input.0.txt b/codenet/public_test_cases/p03695/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aa8b7d4d3d88eb0ebc4569ab0c0444dfbaf3d3c --- /dev/null +++ b/codenet/public_test_cases/p03695/input.0.txt @@ -0,0 +1,2 @@ +4 +2100 2500 2700 2700 diff --git a/codenet/public_test_cases/p03695/input.1.txt b/codenet/public_test_cases/p03695/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3aa8b7d4d3d88eb0ebc4569ab0c0444dfbaf3d3c --- /dev/null +++ b/codenet/public_test_cases/p03695/input.1.txt @@ -0,0 +1,2 @@ +4 +2100 2500 2700 2700 diff --git a/codenet/public_test_cases/p03695/input.2.txt b/codenet/public_test_cases/p03695/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..66cdd1f3891619efaf1384e4ee627ad0764197f0 --- /dev/null +++ b/codenet/public_test_cases/p03695/input.2.txt @@ -0,0 +1,2 @@ +20 +800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990 diff --git a/codenet/public_test_cases/p03695/input.3.txt b/codenet/public_test_cases/p03695/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..51db65b46b5881ec23e334115da4722ec4510932 --- /dev/null +++ b/codenet/public_test_cases/p03695/input.3.txt @@ -0,0 +1,2 @@ +5 +1100 1900 2800 3200 3200 diff --git a/codenet/public_test_cases/p03695/output.0.txt b/codenet/public_test_cases/p03695/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03695/output.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03695/output.1.txt b/codenet/public_test_cases/p03695/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03695/output.1.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03695/output.2.txt b/codenet/public_test_cases/p03695/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03695/output.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03695/output.3.txt b/codenet/public_test_cases/p03695/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p03695/output.3.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p03696/input.0.txt b/codenet/public_test_cases/p03696/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e82887e71ddb0b73fa53a08a84d3c5f8bc46e6cc --- /dev/null +++ b/codenet/public_test_cases/p03696/input.0.txt @@ -0,0 +1,2 @@ +3 +()) diff --git a/codenet/public_test_cases/p03696/input.1.txt b/codenet/public_test_cases/p03696/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..25419b30732d73dfa9093195399290f5db93269a --- /dev/null +++ b/codenet/public_test_cases/p03696/input.1.txt @@ -0,0 +1,2 @@ +8 +))))(((( diff --git a/codenet/public_test_cases/p03696/input.2.txt b/codenet/public_test_cases/p03696/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e82887e71ddb0b73fa53a08a84d3c5f8bc46e6cc --- /dev/null +++ b/codenet/public_test_cases/p03696/input.2.txt @@ -0,0 +1,2 @@ +3 +()) diff --git a/codenet/public_test_cases/p03696/input.3.txt b/codenet/public_test_cases/p03696/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..03a440a41f595c2c2b3080cd9dde7efa00cb08f2 --- /dev/null +++ b/codenet/public_test_cases/p03696/input.3.txt @@ -0,0 +1,2 @@ +6 +)))()) diff --git a/codenet/public_test_cases/p03696/output.0.txt b/codenet/public_test_cases/p03696/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbb2ed7bd9e0c917fd90e69d3401e6ebf43f30c4 --- /dev/null +++ b/codenet/public_test_cases/p03696/output.0.txt @@ -0,0 +1 @@ +(()) diff --git a/codenet/public_test_cases/p03696/output.1.txt b/codenet/public_test_cases/p03696/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b36443d5393429fe9e9b3ebc774157fe83ee479 --- /dev/null +++ b/codenet/public_test_cases/p03696/output.1.txt @@ -0,0 +1 @@ +(((())))(((()))) diff --git a/codenet/public_test_cases/p03696/output.2.txt b/codenet/public_test_cases/p03696/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbb2ed7bd9e0c917fd90e69d3401e6ebf43f30c4 --- /dev/null +++ b/codenet/public_test_cases/p03696/output.2.txt @@ -0,0 +1 @@ +(()) diff --git a/codenet/public_test_cases/p03696/output.3.txt b/codenet/public_test_cases/p03696/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b660f3a39874d59a07e4a706e815ce3d1a6b3265 --- /dev/null +++ b/codenet/public_test_cases/p03696/output.3.txt @@ -0,0 +1 @@ +(((()))()) diff --git a/codenet/public_test_cases/p03697/input.0.txt b/codenet/public_test_cases/p03697/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0dc5f67e18feaa8ac385a23e46b2594040b228c --- /dev/null +++ b/codenet/public_test_cases/p03697/input.0.txt @@ -0,0 +1 @@ +6 3 diff --git a/codenet/public_test_cases/p03697/input.1.txt b/codenet/public_test_cases/p03697/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9efb403ac19b10bb1044ee6f241a1af54f353edb --- /dev/null +++ b/codenet/public_test_cases/p03697/input.1.txt @@ -0,0 +1 @@ +6 4 diff --git a/codenet/public_test_cases/p03697/input.2.txt b/codenet/public_test_cases/p03697/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0dc5f67e18feaa8ac385a23e46b2594040b228c --- /dev/null +++ b/codenet/public_test_cases/p03697/input.2.txt @@ -0,0 +1 @@ +6 3 diff --git a/codenet/public_test_cases/p03697/output.0.txt b/codenet/public_test_cases/p03697/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03697/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03697/output.1.txt b/codenet/public_test_cases/p03697/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8276753746b12b5843b25ec22b5a061787b0b670 --- /dev/null +++ b/codenet/public_test_cases/p03697/output.1.txt @@ -0,0 +1 @@ +error diff --git a/codenet/public_test_cases/p03697/output.2.txt b/codenet/public_test_cases/p03697/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03697/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03698/input.0.txt b/codenet/public_test_cases/p03698/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e3e456ccb783811ec57c3ae8008313c4b6d5ede --- /dev/null +++ b/codenet/public_test_cases/p03698/input.0.txt @@ -0,0 +1 @@ +uncopyrightable diff --git a/codenet/public_test_cases/p03698/input.1.txt b/codenet/public_test_cases/p03698/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e3e456ccb783811ec57c3ae8008313c4b6d5ede --- /dev/null +++ b/codenet/public_test_cases/p03698/input.1.txt @@ -0,0 +1 @@ +uncopyrightable diff --git a/codenet/public_test_cases/p03698/input.2.txt b/codenet/public_test_cases/p03698/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dca2f88bcfeb5fb3ecb832c4170ea85ef7be25c --- /dev/null +++ b/codenet/public_test_cases/p03698/input.2.txt @@ -0,0 +1 @@ +different diff --git a/codenet/public_test_cases/p03698/input.3.txt b/codenet/public_test_cases/p03698/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p03698/input.3.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p03698/output.0.txt b/codenet/public_test_cases/p03698/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p03698/output.0.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p03698/output.1.txt b/codenet/public_test_cases/p03698/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p03698/output.1.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p03698/output.2.txt b/codenet/public_test_cases/p03698/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ecb56eb3fa3fa6f19dd48bca9f971950b119ede --- /dev/null +++ b/codenet/public_test_cases/p03698/output.2.txt @@ -0,0 +1 @@ +no diff --git a/codenet/public_test_cases/p03698/output.3.txt b/codenet/public_test_cases/p03698/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cfab5b05d620d8c6f386273d5d507975cef115f --- /dev/null +++ b/codenet/public_test_cases/p03698/output.3.txt @@ -0,0 +1 @@ +yes diff --git a/codenet/public_test_cases/p03699/input.0.txt b/codenet/public_test_cases/p03699/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bba7385792f97b429cd1dff433e9baf6b164045 --- /dev/null +++ b/codenet/public_test_cases/p03699/input.0.txt @@ -0,0 +1,4 @@ +3 +5 +10 +15 diff --git a/codenet/public_test_cases/p03699/input.1.txt b/codenet/public_test_cases/p03699/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f44fc1eaadcd01ba1021dbe30c240d7a22fe1366 --- /dev/null +++ b/codenet/public_test_cases/p03699/input.1.txt @@ -0,0 +1,4 @@ +3 +10 +10 +15 diff --git a/codenet/public_test_cases/p03699/input.2.txt b/codenet/public_test_cases/p03699/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e21dd378953a88a4ee04b824e01851e2491c87c --- /dev/null +++ b/codenet/public_test_cases/p03699/input.2.txt @@ -0,0 +1,4 @@ +3 +10 +20 +30 diff --git a/codenet/public_test_cases/p03699/input.3.txt b/codenet/public_test_cases/p03699/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bba7385792f97b429cd1dff433e9baf6b164045 --- /dev/null +++ b/codenet/public_test_cases/p03699/input.3.txt @@ -0,0 +1,4 @@ +3 +5 +10 +15 diff --git a/codenet/public_test_cases/p03699/output.0.txt b/codenet/public_test_cases/p03699/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p03699/output.0.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p03699/output.1.txt b/codenet/public_test_cases/p03699/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f92bfdd49766b1907d4aec8d3b0f9ed6129d0e6 --- /dev/null +++ b/codenet/public_test_cases/p03699/output.1.txt @@ -0,0 +1 @@ +35 diff --git a/codenet/public_test_cases/p03699/output.2.txt b/codenet/public_test_cases/p03699/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03699/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03699/output.3.txt b/codenet/public_test_cases/p03699/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p03699/output.3.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p03700/input.0.txt b/codenet/public_test_cases/p03700/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba54752c07cb492d492c531049c31395a7fba458 --- /dev/null +++ b/codenet/public_test_cases/p03700/input.0.txt @@ -0,0 +1,5 @@ +4 5 3 +8 +7 +4 +2 diff --git a/codenet/public_test_cases/p03700/input.1.txt b/codenet/public_test_cases/p03700/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cf5330b515812b455ef34393218eb7ac9d85138 --- /dev/null +++ b/codenet/public_test_cases/p03700/input.1.txt @@ -0,0 +1,6 @@ +5 2 1 +900000000 +900000000 +1000000000 +1000000000 +1000000000 diff --git a/codenet/public_test_cases/p03700/input.2.txt b/codenet/public_test_cases/p03700/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba54752c07cb492d492c531049c31395a7fba458 --- /dev/null +++ b/codenet/public_test_cases/p03700/input.2.txt @@ -0,0 +1,5 @@ +4 5 3 +8 +7 +4 +2 diff --git a/codenet/public_test_cases/p03700/input.3.txt b/codenet/public_test_cases/p03700/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3848a6e34b952b891f27996c009e84ab37a17fb2 --- /dev/null +++ b/codenet/public_test_cases/p03700/input.3.txt @@ -0,0 +1,3 @@ +2 10 4 +20 +20 diff --git a/codenet/public_test_cases/p03700/output.0.txt b/codenet/public_test_cases/p03700/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03700/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03700/output.1.txt b/codenet/public_test_cases/p03700/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bbf1410e01b0b57202807e620a852005214e5bc --- /dev/null +++ b/codenet/public_test_cases/p03700/output.1.txt @@ -0,0 +1 @@ +800000000 diff --git a/codenet/public_test_cases/p03700/output.2.txt b/codenet/public_test_cases/p03700/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03700/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03700/output.3.txt b/codenet/public_test_cases/p03700/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03700/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03701/input.0.txt b/codenet/public_test_cases/p03701/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bba7385792f97b429cd1dff433e9baf6b164045 --- /dev/null +++ b/codenet/public_test_cases/p03701/input.0.txt @@ -0,0 +1,4 @@ +3 +5 +10 +15 diff --git a/codenet/public_test_cases/p03701/output.0.txt b/codenet/public_test_cases/p03701/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7273c0fa8c522b7eed7762a353d46f7768e9b6f2 --- /dev/null +++ b/codenet/public_test_cases/p03701/output.0.txt @@ -0,0 +1 @@ +25 diff --git a/codenet/public_test_cases/p03702/input.0.txt b/codenet/public_test_cases/p03702/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba54752c07cb492d492c531049c31395a7fba458 --- /dev/null +++ b/codenet/public_test_cases/p03702/input.0.txt @@ -0,0 +1,5 @@ +4 5 3 +8 +7 +4 +2 diff --git a/codenet/public_test_cases/p03702/output.0.txt b/codenet/public_test_cases/p03702/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03702/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03703/input.0.txt b/codenet/public_test_cases/p03703/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d757af51c60addcc0b8836177ac74719403dd5e --- /dev/null +++ b/codenet/public_test_cases/p03703/input.0.txt @@ -0,0 +1,4 @@ +3 6 +7 +5 +7 diff --git a/codenet/public_test_cases/p03703/input.1.txt b/codenet/public_test_cases/p03703/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11f162df37eb603c6bc8320a10e36affe66f9118 --- /dev/null +++ b/codenet/public_test_cases/p03703/input.1.txt @@ -0,0 +1,2 @@ +1 2 +1 diff --git a/codenet/public_test_cases/p03703/input.2.txt b/codenet/public_test_cases/p03703/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d757af51c60addcc0b8836177ac74719403dd5e --- /dev/null +++ b/codenet/public_test_cases/p03703/input.2.txt @@ -0,0 +1,4 @@ +3 6 +7 +5 +7 diff --git a/codenet/public_test_cases/p03703/input.3.txt b/codenet/public_test_cases/p03703/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..72c8cabe7072fde55d1324c7839f3927c9dcedad --- /dev/null +++ b/codenet/public_test_cases/p03703/input.3.txt @@ -0,0 +1,8 @@ +7 26 +10 +20 +30 +40 +30 +20 +10 diff --git a/codenet/public_test_cases/p03703/output.0.txt b/codenet/public_test_cases/p03703/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03703/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03703/output.1.txt b/codenet/public_test_cases/p03703/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03703/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03703/output.2.txt b/codenet/public_test_cases/p03703/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03703/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03703/output.3.txt b/codenet/public_test_cases/p03703/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03703/output.3.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03704/input.0.txt b/codenet/public_test_cases/p03704/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b9026d8e2aa237955be84bd9e06954bdd343190 --- /dev/null +++ b/codenet/public_test_cases/p03704/input.0.txt @@ -0,0 +1 @@ +63 diff --git a/codenet/public_test_cases/p03704/input.1.txt b/codenet/public_test_cases/p03704/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b9026d8e2aa237955be84bd9e06954bdd343190 --- /dev/null +++ b/codenet/public_test_cases/p03704/input.1.txt @@ -0,0 +1 @@ +63 diff --git a/codenet/public_test_cases/p03704/input.2.txt b/codenet/public_test_cases/p03704/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..399a9dd60e532d63e8c3b4c728c2cdaeb28dd130 --- /dev/null +++ b/codenet/public_test_cases/p03704/input.2.txt @@ -0,0 +1 @@ +864197532 diff --git a/codenet/public_test_cases/p03704/input.3.txt b/codenet/public_test_cases/p03704/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..78eb67cee1ab25652fe5c9e29efc173671301400 --- /dev/null +++ b/codenet/public_test_cases/p03704/input.3.txt @@ -0,0 +1 @@ +75 diff --git a/codenet/public_test_cases/p03704/output.0.txt b/codenet/public_test_cases/p03704/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03704/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03704/output.1.txt b/codenet/public_test_cases/p03704/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03704/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03704/output.2.txt b/codenet/public_test_cases/p03704/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e37d15a094a6b6e87fadc3c4d934fd9304f3653d --- /dev/null +++ b/codenet/public_test_cases/p03704/output.2.txt @@ -0,0 +1 @@ +1920 diff --git a/codenet/public_test_cases/p03704/output.3.txt b/codenet/public_test_cases/p03704/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03704/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03705/input.0.txt b/codenet/public_test_cases/p03705/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f007b23a109968c228711c8e2a114b9ec1277ba6 --- /dev/null +++ b/codenet/public_test_cases/p03705/input.0.txt @@ -0,0 +1 @@ +4 4 6 diff --git a/codenet/public_test_cases/p03705/input.1.txt b/codenet/public_test_cases/p03705/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aacd9808d5d451faed62fc45c8e80895238922a4 --- /dev/null +++ b/codenet/public_test_cases/p03705/input.1.txt @@ -0,0 +1 @@ +5 4 3 diff --git a/codenet/public_test_cases/p03705/input.2.txt b/codenet/public_test_cases/p03705/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5581895cdf526fd0348737c271ff8a7e8d799237 --- /dev/null +++ b/codenet/public_test_cases/p03705/input.2.txt @@ -0,0 +1 @@ +1 7 10 diff --git a/codenet/public_test_cases/p03705/input.3.txt b/codenet/public_test_cases/p03705/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ef63d76e86713ac418642c556347aae7ea86ed3 --- /dev/null +++ b/codenet/public_test_cases/p03705/input.3.txt @@ -0,0 +1 @@ +1 3 3 diff --git a/codenet/public_test_cases/p03705/input.4.txt b/codenet/public_test_cases/p03705/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f007b23a109968c228711c8e2a114b9ec1277ba6 --- /dev/null +++ b/codenet/public_test_cases/p03705/input.4.txt @@ -0,0 +1 @@ +4 4 6 diff --git a/codenet/public_test_cases/p03705/output.0.txt b/codenet/public_test_cases/p03705/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03705/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03705/output.1.txt b/codenet/public_test_cases/p03705/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03705/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03705/output.2.txt b/codenet/public_test_cases/p03705/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03705/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03705/output.3.txt b/codenet/public_test_cases/p03705/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03705/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03705/output.4.txt b/codenet/public_test_cases/p03705/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03705/output.4.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03706/input.0.txt b/codenet/public_test_cases/p03706/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a7b37f2f396d6c8f3d923abd0abe9e68c9dcb3e --- /dev/null +++ b/codenet/public_test_cases/p03706/input.0.txt @@ -0,0 +1 @@ +UUD diff --git a/codenet/public_test_cases/p03706/output.0.txt b/codenet/public_test_cases/p03706/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03706/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03707/input.0.txt b/codenet/public_test_cases/p03707/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b81148f8105ccd880dd4f2bd6babfa6f3143dba6 --- /dev/null +++ b/codenet/public_test_cases/p03707/input.0.txt @@ -0,0 +1,8 @@ +3 4 4 +1101 +0110 +1101 +1 1 3 4 +1 1 3 1 +2 2 3 4 +1 2 2 4 diff --git a/codenet/public_test_cases/p03707/input.1.txt b/codenet/public_test_cases/p03707/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b81148f8105ccd880dd4f2bd6babfa6f3143dba6 --- /dev/null +++ b/codenet/public_test_cases/p03707/input.1.txt @@ -0,0 +1,8 @@ +3 4 4 +1101 +0110 +1101 +1 1 3 4 +1 1 3 1 +2 2 3 4 +1 2 2 4 diff --git a/codenet/public_test_cases/p03707/input.2.txt b/codenet/public_test_cases/p03707/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6aa020e882ee9beafdffbdbb8d89c66821c93378 --- /dev/null +++ b/codenet/public_test_cases/p03707/input.2.txt @@ -0,0 +1,12 @@ +5 5 6 +11010 +01110 +10101 +11101 +01010 +1 1 5 5 +1 2 4 5 +2 3 3 4 +3 3 3 3 +3 1 3 5 +1 1 3 4 diff --git a/codenet/public_test_cases/p03707/output.0.txt b/codenet/public_test_cases/p03707/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..47caebfbef7dff406435e96bcb077353adfe2a4e --- /dev/null +++ b/codenet/public_test_cases/p03707/output.0.txt @@ -0,0 +1,4 @@ +3 +2 +2 +2 diff --git a/codenet/public_test_cases/p03707/output.1.txt b/codenet/public_test_cases/p03707/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..47caebfbef7dff406435e96bcb077353adfe2a4e --- /dev/null +++ b/codenet/public_test_cases/p03707/output.1.txt @@ -0,0 +1,4 @@ +3 +2 +2 +2 diff --git a/codenet/public_test_cases/p03707/output.2.txt b/codenet/public_test_cases/p03707/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d92d9e52e8bd7c9950e194a17e33a627cc69f82e --- /dev/null +++ b/codenet/public_test_cases/p03707/output.2.txt @@ -0,0 +1,6 @@ +3 +2 +1 +1 +3 +2 diff --git a/codenet/public_test_cases/p03708/input.0.txt b/codenet/public_test_cases/p03708/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce2e38b6160eedf7b303339b2290b097c58f7af3 --- /dev/null +++ b/codenet/public_test_cases/p03708/input.0.txt @@ -0,0 +1,2 @@ +7 +9 diff --git a/codenet/public_test_cases/p03708/input.1.txt b/codenet/public_test_cases/p03708/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3554e1f2952a45eaa45893c8cbf82bdd74caf37d --- /dev/null +++ b/codenet/public_test_cases/p03708/input.1.txt @@ -0,0 +1,2 @@ +65 +98 diff --git a/codenet/public_test_cases/p03708/input.2.txt b/codenet/public_test_cases/p03708/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce2e38b6160eedf7b303339b2290b097c58f7af3 --- /dev/null +++ b/codenet/public_test_cases/p03708/input.2.txt @@ -0,0 +1,2 @@ +7 +9 diff --git a/codenet/public_test_cases/p03708/input.3.txt b/codenet/public_test_cases/p03708/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..617b33fb582f115d550d624cfdacd3ab2cd6457e --- /dev/null +++ b/codenet/public_test_cases/p03708/input.3.txt @@ -0,0 +1,2 @@ +271828182845904523 +314159265358979323 diff --git a/codenet/public_test_cases/p03708/output.0.txt b/codenet/public_test_cases/p03708/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03708/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03708/output.1.txt b/codenet/public_test_cases/p03708/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b9026d8e2aa237955be84bd9e06954bdd343190 --- /dev/null +++ b/codenet/public_test_cases/p03708/output.1.txt @@ -0,0 +1 @@ +63 diff --git a/codenet/public_test_cases/p03708/output.2.txt b/codenet/public_test_cases/p03708/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03708/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03708/output.3.txt b/codenet/public_test_cases/p03708/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6f85d9497fab254dc69bc1c7e8a651966587df8 --- /dev/null +++ b/codenet/public_test_cases/p03708/output.3.txt @@ -0,0 +1 @@ +68833183630578410 diff --git a/codenet/public_test_cases/p03709/input.0.txt b/codenet/public_test_cases/p03709/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..90981ddfb4f51287886ec11b074a2f17ce22b727 --- /dev/null +++ b/codenet/public_test_cases/p03709/input.0.txt @@ -0,0 +1,4 @@ +3 +2 5 +6 1 +3 7 diff --git a/codenet/public_test_cases/p03709/input.1.txt b/codenet/public_test_cases/p03709/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..90981ddfb4f51287886ec11b074a2f17ce22b727 --- /dev/null +++ b/codenet/public_test_cases/p03709/input.1.txt @@ -0,0 +1,4 @@ +3 +2 5 +6 1 +3 7 diff --git a/codenet/public_test_cases/p03709/input.2.txt b/codenet/public_test_cases/p03709/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..31057b6ac92a40a60e492674eff764e320d97805 --- /dev/null +++ b/codenet/public_test_cases/p03709/input.2.txt @@ -0,0 +1,5 @@ +4 +3 7 +2 9 +8 16 +10 8 diff --git a/codenet/public_test_cases/p03709/output.0.txt b/codenet/public_test_cases/p03709/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03709/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03709/output.1.txt b/codenet/public_test_cases/p03709/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03709/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03709/output.2.txt b/codenet/public_test_cases/p03709/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03709/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03710/input.0.txt b/codenet/public_test_cases/p03710/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5a07a2b46e284ae4463abd4a7ff1e44f89c133 --- /dev/null +++ b/codenet/public_test_cases/p03710/input.0.txt @@ -0,0 +1,4 @@ +3 +4 4 +6 10 +12 11 diff --git a/codenet/public_test_cases/p03710/input.1.txt b/codenet/public_test_cases/p03710/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..be70bda70870d449872eea598a0c9c77de9a94d8 --- /dev/null +++ b/codenet/public_test_cases/p03710/input.1.txt @@ -0,0 +1,11 @@ +10 +1 1 +2 2 +5 1000000000000000000 +7 3 +1 334334334334334334 +23847657 23458792534 +111111111 111111111 +7 7 +4 19 +9 10 diff --git a/codenet/public_test_cases/p03710/input.2.txt b/codenet/public_test_cases/p03710/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5a07a2b46e284ae4463abd4a7ff1e44f89c133 --- /dev/null +++ b/codenet/public_test_cases/p03710/input.2.txt @@ -0,0 +1,4 @@ +3 +4 4 +6 10 +12 11 diff --git a/codenet/public_test_cases/p03710/output.0.txt b/codenet/public_test_cases/p03710/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d14a2192e5134ccd6cb0a959b5a9bd8e8b8c3964 --- /dev/null +++ b/codenet/public_test_cases/p03710/output.0.txt @@ -0,0 +1,3 @@ +2 4 +4 1 +4 7 diff --git a/codenet/public_test_cases/p03710/output.1.txt b/codenet/public_test_cases/p03710/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bba1e066d166155928666f2d6869b0f3381fbd67 --- /dev/null +++ b/codenet/public_test_cases/p03710/output.1.txt @@ -0,0 +1,10 @@ +1 1 +1 4 +4 600000013 +3 1 +1 993994017 +35 37447 +38 2 +3 6 +3 9 +4 2 diff --git a/codenet/public_test_cases/p03710/output.2.txt b/codenet/public_test_cases/p03710/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d14a2192e5134ccd6cb0a959b5a9bd8e8b8c3964 --- /dev/null +++ b/codenet/public_test_cases/p03710/output.2.txt @@ -0,0 +1,3 @@ +2 4 +4 1 +4 7 diff --git a/codenet/public_test_cases/p03711/input.0.txt b/codenet/public_test_cases/p03711/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p03711/input.0.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p03711/input.1.txt b/codenet/public_test_cases/p03711/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0efd67f9502e63cb033cb651e65e025b6e3a5cb2 --- /dev/null +++ b/codenet/public_test_cases/p03711/input.1.txt @@ -0,0 +1 @@ +2 4 diff --git a/codenet/public_test_cases/p03711/input.2.txt b/codenet/public_test_cases/p03711/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p03711/input.2.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p03711/output.0.txt b/codenet/public_test_cases/p03711/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03711/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03711/output.1.txt b/codenet/public_test_cases/p03711/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03711/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03711/output.2.txt b/codenet/public_test_cases/p03711/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03711/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03712/input.0.txt b/codenet/public_test_cases/p03712/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6aafc49b2ec604b71fb0ef119e09ad49ab78bbd --- /dev/null +++ b/codenet/public_test_cases/p03712/input.0.txt @@ -0,0 +1,3 @@ +2 3 +abc +arc diff --git a/codenet/public_test_cases/p03712/input.1.txt b/codenet/public_test_cases/p03712/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6aafc49b2ec604b71fb0ef119e09ad49ab78bbd --- /dev/null +++ b/codenet/public_test_cases/p03712/input.1.txt @@ -0,0 +1,3 @@ +2 3 +abc +arc diff --git a/codenet/public_test_cases/p03712/input.2.txt b/codenet/public_test_cases/p03712/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6e07373df8563ac2f5ce1ff7e2d387c2fb5fc24 --- /dev/null +++ b/codenet/public_test_cases/p03712/input.2.txt @@ -0,0 +1,2 @@ +1 1 +z diff --git a/codenet/public_test_cases/p03712/output.0.txt b/codenet/public_test_cases/p03712/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..03881610f3b286f98e5249e8d15ba8fc659a6fa2 --- /dev/null +++ b/codenet/public_test_cases/p03712/output.0.txt @@ -0,0 +1,4 @@ +##### +#abc# +#arc# +##### diff --git a/codenet/public_test_cases/p03712/output.1.txt b/codenet/public_test_cases/p03712/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03881610f3b286f98e5249e8d15ba8fc659a6fa2 --- /dev/null +++ b/codenet/public_test_cases/p03712/output.1.txt @@ -0,0 +1,4 @@ +##### +#abc# +#arc# +##### diff --git a/codenet/public_test_cases/p03712/output.2.txt b/codenet/public_test_cases/p03712/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ced7816a30245aac0b5c646272cd4a4daf06072b --- /dev/null +++ b/codenet/public_test_cases/p03712/output.2.txt @@ -0,0 +1 @@ +z# diff --git a/codenet/public_test_cases/p03713/input.0.txt b/codenet/public_test_cases/p03713/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p03713/input.0.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p03713/input.1.txt b/codenet/public_test_cases/p03713/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p03713/input.1.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p03713/input.2.txt b/codenet/public_test_cases/p03713/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bfd8643e47256f0fce54761d9cc9e58d209aebc --- /dev/null +++ b/codenet/public_test_cases/p03713/input.2.txt @@ -0,0 +1 @@ +100000 100000 diff --git a/codenet/public_test_cases/p03713/input.3.txt b/codenet/public_test_cases/p03713/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbf084b3bc8579e8a9c727ab3d9b153a3f88ff94 --- /dev/null +++ b/codenet/public_test_cases/p03713/input.3.txt @@ -0,0 +1 @@ +100000 2 diff --git a/codenet/public_test_cases/p03713/input.4.txt b/codenet/public_test_cases/p03713/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..299a71f3fe47862a2e17f69e981e7ad8beff4e53 --- /dev/null +++ b/codenet/public_test_cases/p03713/input.4.txt @@ -0,0 +1 @@ +5 5 diff --git a/codenet/public_test_cases/p03713/input.5.txt b/codenet/public_test_cases/p03713/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a99162ed9cdd1b90006cbd4f07e2a2bd3f404d4 --- /dev/null +++ b/codenet/public_test_cases/p03713/input.5.txt @@ -0,0 +1 @@ +4 5 diff --git a/codenet/public_test_cases/p03713/output.0.txt b/codenet/public_test_cases/p03713/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03713/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03713/output.1.txt b/codenet/public_test_cases/p03713/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03713/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03713/output.2.txt b/codenet/public_test_cases/p03713/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ccfc37a15dad24fe8999ddb4c0d77ca5dcb1e1a4 --- /dev/null +++ b/codenet/public_test_cases/p03713/output.2.txt @@ -0,0 +1 @@ +50000 diff --git a/codenet/public_test_cases/p03713/output.3.txt b/codenet/public_test_cases/p03713/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03713/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03713/output.4.txt b/codenet/public_test_cases/p03713/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03713/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03713/output.5.txt b/codenet/public_test_cases/p03713/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03713/output.5.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03714/input.0.txt b/codenet/public_test_cases/p03714/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d4f27ac163f769a21c4f0194d8dacb2b8b9bd74 --- /dev/null +++ b/codenet/public_test_cases/p03714/input.0.txt @@ -0,0 +1,2 @@ +2 +3 1 4 1 5 9 diff --git a/codenet/public_test_cases/p03714/input.1.txt b/codenet/public_test_cases/p03714/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d4f27ac163f769a21c4f0194d8dacb2b8b9bd74 --- /dev/null +++ b/codenet/public_test_cases/p03714/input.1.txt @@ -0,0 +1,2 @@ +2 +3 1 4 1 5 9 diff --git a/codenet/public_test_cases/p03714/input.2.txt b/codenet/public_test_cases/p03714/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fe8783a8d21f51583db27e86ad33c9aff70efaf --- /dev/null +++ b/codenet/public_test_cases/p03714/input.2.txt @@ -0,0 +1,2 @@ +1 +1 2 3 diff --git a/codenet/public_test_cases/p03714/input.3.txt b/codenet/public_test_cases/p03714/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e21a588230c73d19985aa71e9d81cd1c71d6620 --- /dev/null +++ b/codenet/public_test_cases/p03714/input.3.txt @@ -0,0 +1,2 @@ +3 +8 2 2 7 4 6 5 3 8 diff --git a/codenet/public_test_cases/p03714/output.0.txt b/codenet/public_test_cases/p03714/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03714/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03714/output.1.txt b/codenet/public_test_cases/p03714/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03714/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03714/output.2.txt b/codenet/public_test_cases/p03714/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03714/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03714/output.3.txt b/codenet/public_test_cases/p03714/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03714/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03715/input.0.txt b/codenet/public_test_cases/p03715/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99818b5e14a5b696e9ca6864fe6ee34c0695cb04 --- /dev/null +++ b/codenet/public_test_cases/p03715/input.0.txt @@ -0,0 +1 @@ +3 5 diff --git a/codenet/public_test_cases/p03715/output.0.txt b/codenet/public_test_cases/p03715/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03715/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03716/input.0.txt b/codenet/public_test_cases/p03716/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d4f27ac163f769a21c4f0194d8dacb2b8b9bd74 --- /dev/null +++ b/codenet/public_test_cases/p03716/input.0.txt @@ -0,0 +1,2 @@ +2 +3 1 4 1 5 9 diff --git a/codenet/public_test_cases/p03716/output.0.txt b/codenet/public_test_cases/p03716/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03716/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03717/input.0.txt b/codenet/public_test_cases/p03717/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd7515ecf20946ec4b8658f306be727f34723f0f --- /dev/null +++ b/codenet/public_test_cases/p03717/input.0.txt @@ -0,0 +1,2 @@ +3 1 +1 3 3 diff --git a/codenet/public_test_cases/p03717/input.1.txt b/codenet/public_test_cases/p03717/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd7515ecf20946ec4b8658f306be727f34723f0f --- /dev/null +++ b/codenet/public_test_cases/p03717/input.1.txt @@ -0,0 +1,2 @@ +3 1 +1 3 3 diff --git a/codenet/public_test_cases/p03717/input.2.txt b/codenet/public_test_cases/p03717/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..50aa54a4ae4040ded4a33e2769105ce320472255 --- /dev/null +++ b/codenet/public_test_cases/p03717/input.2.txt @@ -0,0 +1,11 @@ +8 10 +2 6 2 +5 5 1 +3 5 2 +4 7 3 +4 4 1 +2 3 1 +7 7 1 +1 5 2 +1 7 3 +3 4 2 diff --git a/codenet/public_test_cases/p03717/input.3.txt b/codenet/public_test_cases/p03717/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9f7cc24f7bfe602ec8157f0dadc99203536d91e --- /dev/null +++ b/codenet/public_test_cases/p03717/input.3.txt @@ -0,0 +1,4 @@ +1 3 +1 1 1 +1 1 2 +1 1 3 diff --git a/codenet/public_test_cases/p03717/input.4.txt b/codenet/public_test_cases/p03717/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..514e315b1f00bd523b29d91dbbcf0e50e9b5e48a --- /dev/null +++ b/codenet/public_test_cases/p03717/input.4.txt @@ -0,0 +1,3 @@ +4 2 +1 3 1 +2 4 2 diff --git a/codenet/public_test_cases/p03717/output.0.txt b/codenet/public_test_cases/p03717/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03717/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03717/output.1.txt b/codenet/public_test_cases/p03717/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03717/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03717/output.2.txt b/codenet/public_test_cases/p03717/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b20426c05051ed8bd8c8cc632573c194e57809c --- /dev/null +++ b/codenet/public_test_cases/p03717/output.2.txt @@ -0,0 +1 @@ +108 diff --git a/codenet/public_test_cases/p03717/output.3.txt b/codenet/public_test_cases/p03717/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03717/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03717/output.4.txt b/codenet/public_test_cases/p03717/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03717/output.4.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03718/input.0.txt b/codenet/public_test_cases/p03718/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e54740d44fa6e510d35deb0c79deb89b1d2e592 --- /dev/null +++ b/codenet/public_test_cases/p03718/input.0.txt @@ -0,0 +1,4 @@ +3 3 +S.o +.o. +o.T diff --git a/codenet/public_test_cases/p03718/input.1.txt b/codenet/public_test_cases/p03718/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..090cbe26697dfe31eb1957a16ad20996a68513ef --- /dev/null +++ b/codenet/public_test_cases/p03718/input.1.txt @@ -0,0 +1,5 @@ +4 3 +.S. +.o. +.o. +.T. diff --git a/codenet/public_test_cases/p03718/input.2.txt b/codenet/public_test_cases/p03718/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..05dcdcef8751db3708bd334bb260cb42470ba180 --- /dev/null +++ b/codenet/public_test_cases/p03718/input.2.txt @@ -0,0 +1,4 @@ +3 4 +S... +.oo. +...T diff --git a/codenet/public_test_cases/p03718/input.3.txt b/codenet/public_test_cases/p03718/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e54740d44fa6e510d35deb0c79deb89b1d2e592 --- /dev/null +++ b/codenet/public_test_cases/p03718/input.3.txt @@ -0,0 +1,4 @@ +3 3 +S.o +.o. +o.T diff --git a/codenet/public_test_cases/p03718/input.4.txt b/codenet/public_test_cases/p03718/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..49bd7cba070c2e8967b24dbe20059085adddb193 --- /dev/null +++ b/codenet/public_test_cases/p03718/input.4.txt @@ -0,0 +1,11 @@ +10 10 +.o...o..o. +....o..... +....oo.oo. +..oooo..o. +....oo.... +..o..o.... +o..o....So +o....T.... +....o..... +........oo diff --git a/codenet/public_test_cases/p03718/output.0.txt b/codenet/public_test_cases/p03718/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03718/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03718/output.1.txt b/codenet/public_test_cases/p03718/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03718/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03718/output.2.txt b/codenet/public_test_cases/p03718/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03718/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03718/output.3.txt b/codenet/public_test_cases/p03718/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03718/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03718/output.4.txt b/codenet/public_test_cases/p03718/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03718/output.4.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03719/input.0.txt b/codenet/public_test_cases/p03719/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d849ff9fbc8ef5b5ece8947aedea2c693179e497 --- /dev/null +++ b/codenet/public_test_cases/p03719/input.0.txt @@ -0,0 +1 @@ +1 3 2 diff --git a/codenet/public_test_cases/p03719/input.1.txt b/codenet/public_test_cases/p03719/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef8c4b9ae5c4b77065fe39d4097af026125f5675 --- /dev/null +++ b/codenet/public_test_cases/p03719/input.1.txt @@ -0,0 +1 @@ +6 5 4 diff --git a/codenet/public_test_cases/p03719/input.2.txt b/codenet/public_test_cases/p03719/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p03719/input.2.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p03719/input.3.txt b/codenet/public_test_cases/p03719/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d849ff9fbc8ef5b5ece8947aedea2c693179e497 --- /dev/null +++ b/codenet/public_test_cases/p03719/input.3.txt @@ -0,0 +1 @@ +1 3 2 diff --git a/codenet/public_test_cases/p03719/output.0.txt b/codenet/public_test_cases/p03719/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03719/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03719/output.1.txt b/codenet/public_test_cases/p03719/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03719/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03719/output.2.txt b/codenet/public_test_cases/p03719/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03719/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03719/output.3.txt b/codenet/public_test_cases/p03719/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03719/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03720/input.0.txt b/codenet/public_test_cases/p03720/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fca0d282ff0046c8f0bd3e46dfc1e536ed65307 --- /dev/null +++ b/codenet/public_test_cases/p03720/input.0.txt @@ -0,0 +1,4 @@ +4 3 +1 2 +2 3 +1 4 diff --git a/codenet/public_test_cases/p03720/input.1.txt b/codenet/public_test_cases/p03720/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fca0d282ff0046c8f0bd3e46dfc1e536ed65307 --- /dev/null +++ b/codenet/public_test_cases/p03720/input.1.txt @@ -0,0 +1,4 @@ +4 3 +1 2 +2 3 +1 4 diff --git a/codenet/public_test_cases/p03720/input.2.txt b/codenet/public_test_cases/p03720/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e3d066d47355315bc0262cfe9e716871ef1597c --- /dev/null +++ b/codenet/public_test_cases/p03720/input.2.txt @@ -0,0 +1,9 @@ +8 8 +1 2 +3 4 +1 5 +2 8 +3 7 +5 2 +4 1 +6 8 diff --git a/codenet/public_test_cases/p03720/input.3.txt b/codenet/public_test_cases/p03720/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fcba2c8375468ad5dd87cfcfd7967a2b2ae80cf --- /dev/null +++ b/codenet/public_test_cases/p03720/input.3.txt @@ -0,0 +1,6 @@ +2 5 +1 2 +2 1 +1 2 +2 1 +1 2 diff --git a/codenet/public_test_cases/p03720/output.0.txt b/codenet/public_test_cases/p03720/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74cd8c6d31fbfab6e528d2eb5a285845b175476b --- /dev/null +++ b/codenet/public_test_cases/p03720/output.0.txt @@ -0,0 +1,4 @@ +2 +2 +1 +1 diff --git a/codenet/public_test_cases/p03720/output.1.txt b/codenet/public_test_cases/p03720/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74cd8c6d31fbfab6e528d2eb5a285845b175476b --- /dev/null +++ b/codenet/public_test_cases/p03720/output.1.txt @@ -0,0 +1,4 @@ +2 +2 +1 +1 diff --git a/codenet/public_test_cases/p03720/output.2.txt b/codenet/public_test_cases/p03720/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e35d833bd435d3fea5fae6f591e7ac2ffba2073e --- /dev/null +++ b/codenet/public_test_cases/p03720/output.2.txt @@ -0,0 +1,8 @@ +3 +3 +2 +2 +2 +1 +1 +2 diff --git a/codenet/public_test_cases/p03720/output.3.txt b/codenet/public_test_cases/p03720/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fd3c81a4d763121f1827c8b4bbdd0cef674c30f9 --- /dev/null +++ b/codenet/public_test_cases/p03720/output.3.txt @@ -0,0 +1,2 @@ +5 +5 diff --git a/codenet/public_test_cases/p03721/input.0.txt b/codenet/public_test_cases/p03721/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f54f665f431f43545c73ca8dd9cee7b9a39e7d0 --- /dev/null +++ b/codenet/public_test_cases/p03721/input.0.txt @@ -0,0 +1,4 @@ +3 4 +1 1 +2 2 +3 3 diff --git a/codenet/public_test_cases/p03721/input.1.txt b/codenet/public_test_cases/p03721/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f54f665f431f43545c73ca8dd9cee7b9a39e7d0 --- /dev/null +++ b/codenet/public_test_cases/p03721/input.1.txt @@ -0,0 +1,4 @@ +3 4 +1 1 +2 2 +3 3 diff --git a/codenet/public_test_cases/p03721/input.2.txt b/codenet/public_test_cases/p03721/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7171a4c207c669409f428494299681ccd4df97fc --- /dev/null +++ b/codenet/public_test_cases/p03721/input.2.txt @@ -0,0 +1,11 @@ +10 500000 +1 100000 +1 100000 +1 100000 +1 100000 +1 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 +100000 100000 diff --git a/codenet/public_test_cases/p03721/output.0.txt b/codenet/public_test_cases/p03721/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03721/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03721/output.1.txt b/codenet/public_test_cases/p03721/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03721/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03721/output.2.txt b/codenet/public_test_cases/p03721/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03721/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03722/input.0.txt b/codenet/public_test_cases/p03722/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cf74603e8a3efaa071854c1c925e84707539b87 --- /dev/null +++ b/codenet/public_test_cases/p03722/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 4 +2 3 3 +1 3 5 diff --git a/codenet/public_test_cases/p03722/input.1.txt b/codenet/public_test_cases/p03722/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14a08ad68b20fee28c83a586cdc42f957e4a7614 --- /dev/null +++ b/codenet/public_test_cases/p03722/input.1.txt @@ -0,0 +1,3 @@ +2 2 +1 2 1 +2 1 1 diff --git a/codenet/public_test_cases/p03722/input.2.txt b/codenet/public_test_cases/p03722/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cf74603e8a3efaa071854c1c925e84707539b87 --- /dev/null +++ b/codenet/public_test_cases/p03722/input.2.txt @@ -0,0 +1,4 @@ +3 3 +1 2 4 +2 3 3 +1 3 5 diff --git a/codenet/public_test_cases/p03722/input.3.txt b/codenet/public_test_cases/p03722/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..280b713298de33bbf28b30bdb2bc2645f01c807b --- /dev/null +++ b/codenet/public_test_cases/p03722/input.3.txt @@ -0,0 +1,6 @@ +6 5 +1 2 -1000000000 +2 3 -1000000000 +3 4 -1000000000 +4 5 -1000000000 +5 6 -1000000000 diff --git a/codenet/public_test_cases/p03722/output.0.txt b/codenet/public_test_cases/p03722/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03722/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03722/output.1.txt b/codenet/public_test_cases/p03722/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8484d062f57dd9d5606ee2db1c06424879fd62f4 --- /dev/null +++ b/codenet/public_test_cases/p03722/output.1.txt @@ -0,0 +1 @@ +inf diff --git a/codenet/public_test_cases/p03722/output.2.txt b/codenet/public_test_cases/p03722/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03722/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03722/output.3.txt b/codenet/public_test_cases/p03722/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b50d4b172b3d6adf1a81d4ff0d288f5f8796be51 --- /dev/null +++ b/codenet/public_test_cases/p03722/output.3.txt @@ -0,0 +1 @@ +-5000000000 diff --git a/codenet/public_test_cases/p03723/input.0.txt b/codenet/public_test_cases/p03723/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..50775277604c92e3779ed248a09012d4e4a69fbf --- /dev/null +++ b/codenet/public_test_cases/p03723/input.0.txt @@ -0,0 +1 @@ +4 12 20 diff --git a/codenet/public_test_cases/p03723/input.1.txt b/codenet/public_test_cases/p03723/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..95b3079fe08cdd7df49aa8cb902a5df8863513cf --- /dev/null +++ b/codenet/public_test_cases/p03723/input.1.txt @@ -0,0 +1 @@ +14 14 14 diff --git a/codenet/public_test_cases/p03723/input.2.txt b/codenet/public_test_cases/p03723/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcb6500f6e2321ea24510014a711901574e2e90d --- /dev/null +++ b/codenet/public_test_cases/p03723/input.2.txt @@ -0,0 +1 @@ +454 414 444 diff --git a/codenet/public_test_cases/p03723/input.3.txt b/codenet/public_test_cases/p03723/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..50775277604c92e3779ed248a09012d4e4a69fbf --- /dev/null +++ b/codenet/public_test_cases/p03723/input.3.txt @@ -0,0 +1 @@ +4 12 20 diff --git a/codenet/public_test_cases/p03723/output.0.txt b/codenet/public_test_cases/p03723/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03723/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03723/output.1.txt b/codenet/public_test_cases/p03723/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03723/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03723/output.2.txt b/codenet/public_test_cases/p03723/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03723/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03723/output.3.txt b/codenet/public_test_cases/p03723/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03723/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03724/input.0.txt b/codenet/public_test_cases/p03724/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a54c5894d0d926eb3561c6439e0f0b15711634d --- /dev/null +++ b/codenet/public_test_cases/p03724/input.0.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 4 +1 3 +3 4 diff --git a/codenet/public_test_cases/p03724/input.1.txt b/codenet/public_test_cases/p03724/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..807be6b3bbbb70c8a0db5578a249f34a9ccb9803 --- /dev/null +++ b/codenet/public_test_cases/p03724/input.1.txt @@ -0,0 +1,6 @@ +5 5 +1 2 +3 5 +5 1 +3 4 +2 3 diff --git a/codenet/public_test_cases/p03724/input.2.txt b/codenet/public_test_cases/p03724/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a54c5894d0d926eb3561c6439e0f0b15711634d --- /dev/null +++ b/codenet/public_test_cases/p03724/input.2.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 4 +1 3 +3 4 diff --git a/codenet/public_test_cases/p03724/output.0.txt b/codenet/public_test_cases/p03724/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03724/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03724/output.1.txt b/codenet/public_test_cases/p03724/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03724/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03724/output.2.txt b/codenet/public_test_cases/p03724/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03724/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03725/input.0.txt b/codenet/public_test_cases/p03725/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdc6862a84044aada7b60227b0dfd3890f1ce621 --- /dev/null +++ b/codenet/public_test_cases/p03725/input.0.txt @@ -0,0 +1,4 @@ +3 3 3 +#.# +#S. +### diff --git a/codenet/public_test_cases/p03725/input.1.txt b/codenet/public_test_cases/p03725/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdc6862a84044aada7b60227b0dfd3890f1ce621 --- /dev/null +++ b/codenet/public_test_cases/p03725/input.1.txt @@ -0,0 +1,4 @@ +3 3 3 +#.# +#S. +### diff --git a/codenet/public_test_cases/p03725/input.2.txt b/codenet/public_test_cases/p03725/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac905a4ca06d6095bba1313693669a0a72569c40 --- /dev/null +++ b/codenet/public_test_cases/p03725/input.2.txt @@ -0,0 +1,3 @@ +3 3 3 +.# +S. diff --git a/codenet/public_test_cases/p03725/input.3.txt b/codenet/public_test_cases/p03725/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3f03fef33632813c5c9d65370b6733fb464a551 --- /dev/null +++ b/codenet/public_test_cases/p03725/input.3.txt @@ -0,0 +1,3 @@ +3 3 3 + +S# diff --git a/codenet/public_test_cases/p03725/input.4.txt b/codenet/public_test_cases/p03725/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..52ae5ad005c40b4c1bd775f298a962e588d3f33e --- /dev/null +++ b/codenet/public_test_cases/p03725/input.4.txt @@ -0,0 +1,7 @@ +7 7 2 + + +...## +S### +.#.## +.### diff --git a/codenet/public_test_cases/p03725/output.0.txt b/codenet/public_test_cases/p03725/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03725/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03725/output.1.txt b/codenet/public_test_cases/p03725/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03725/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03725/output.2.txt b/codenet/public_test_cases/p03725/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03725/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03725/output.3.txt b/codenet/public_test_cases/p03725/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03725/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03725/output.4.txt b/codenet/public_test_cases/p03725/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03725/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03726/input.0.txt b/codenet/public_test_cases/p03726/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p03726/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03726/input.1.txt b/codenet/public_test_cases/p03726/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p03726/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03726/input.2.txt b/codenet/public_test_cases/p03726/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc252a3b66a9065ff078f32a92245338c08e207c --- /dev/null +++ b/codenet/public_test_cases/p03726/input.2.txt @@ -0,0 +1,6 @@ +6 +1 2 +2 3 +3 4 +2 5 +5 6 diff --git a/codenet/public_test_cases/p03726/input.3.txt b/codenet/public_test_cases/p03726/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..913dc828930ae6560976a61bff74724593bfba79 --- /dev/null +++ b/codenet/public_test_cases/p03726/input.3.txt @@ -0,0 +1,4 @@ +4 +1 2 +2 3 +2 4 diff --git a/codenet/public_test_cases/p03726/output.0.txt b/codenet/public_test_cases/p03726/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03726/output.0.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03726/output.1.txt b/codenet/public_test_cases/p03726/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03726/output.1.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03726/output.2.txt b/codenet/public_test_cases/p03726/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p03726/output.2.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p03726/output.3.txt b/codenet/public_test_cases/p03726/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03726/output.3.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03727/input.0.txt b/codenet/public_test_cases/p03727/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b96801e923f3a3db7667e973ff0312a8ced06659 --- /dev/null +++ b/codenet/public_test_cases/p03727/input.0.txt @@ -0,0 +1,5 @@ +3 +1 2 +2 3 +1 3 +3 2 diff --git a/codenet/public_test_cases/p03727/input.1.txt b/codenet/public_test_cases/p03727/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..94b81cb576d92277a1aacb8416e4ef31ff03662e --- /dev/null +++ b/codenet/public_test_cases/p03727/input.1.txt @@ -0,0 +1,9 @@ +5 +1 2 +2 3 +3 4 +4 5 +3 4 +2 4 +1 4 +1 5 diff --git a/codenet/public_test_cases/p03727/input.2.txt b/codenet/public_test_cases/p03727/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b2371029d2b36bc71807554904a350588366e00 --- /dev/null +++ b/codenet/public_test_cases/p03727/input.2.txt @@ -0,0 +1,11 @@ +6 +1 2 +3 5 +4 6 +1 6 +5 1 +5 3 +1 4 +2 6 +4 3 +5 6 diff --git a/codenet/public_test_cases/p03727/input.3.txt b/codenet/public_test_cases/p03727/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b96801e923f3a3db7667e973ff0312a8ced06659 --- /dev/null +++ b/codenet/public_test_cases/p03727/input.3.txt @@ -0,0 +1,5 @@ +3 +1 2 +2 3 +1 3 +3 2 diff --git a/codenet/public_test_cases/p03727/output.0.txt b/codenet/public_test_cases/p03727/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03727/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03727/output.1.txt b/codenet/public_test_cases/p03727/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03727/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03727/output.2.txt b/codenet/public_test_cases/p03727/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03727/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03727/output.3.txt b/codenet/public_test_cases/p03727/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03727/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03728/input.0.txt b/codenet/public_test_cases/p03728/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b963f22471ef530788d18524b079a2e9b8e7d6ef --- /dev/null +++ b/codenet/public_test_cases/p03728/input.0.txt @@ -0,0 +1,2 @@ +5 +3 5 1 2 4 diff --git a/codenet/public_test_cases/p03728/input.1.txt b/codenet/public_test_cases/p03728/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..19316c8d53b3b1b6b61b70be0560b4d5b5f4d457 --- /dev/null +++ b/codenet/public_test_cases/p03728/input.1.txt @@ -0,0 +1,2 @@ +10 +2 10 5 7 3 6 4 9 8 1 diff --git a/codenet/public_test_cases/p03728/input.2.txt b/codenet/public_test_cases/p03728/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac4e9ed890dd280894cc797a96e1d2f4ab7d3a9b --- /dev/null +++ b/codenet/public_test_cases/p03728/input.2.txt @@ -0,0 +1,2 @@ +5 +5 4 3 2 1 diff --git a/codenet/public_test_cases/p03728/input.3.txt b/codenet/public_test_cases/p03728/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b963f22471ef530788d18524b079a2e9b8e7d6ef --- /dev/null +++ b/codenet/public_test_cases/p03728/input.3.txt @@ -0,0 +1,2 @@ +5 +3 5 1 2 4 diff --git a/codenet/public_test_cases/p03728/output.0.txt b/codenet/public_test_cases/p03728/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03728/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03728/output.1.txt b/codenet/public_test_cases/p03728/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03728/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03728/output.2.txt b/codenet/public_test_cases/p03728/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03728/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03728/output.3.txt b/codenet/public_test_cases/p03728/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03728/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03729/input.0.txt b/codenet/public_test_cases/p03729/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0916aac9a4a6a53c03b9a3bb80aa9254ce172546 --- /dev/null +++ b/codenet/public_test_cases/p03729/input.0.txt @@ -0,0 +1 @@ +rng gorilla apple diff --git a/codenet/public_test_cases/p03729/input.1.txt b/codenet/public_test_cases/p03729/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b22eb844f75bd4eed8bf8e138e4c24dd32cf7b10 --- /dev/null +++ b/codenet/public_test_cases/p03729/input.1.txt @@ -0,0 +1 @@ +a a a diff --git a/codenet/public_test_cases/p03729/input.2.txt b/codenet/public_test_cases/p03729/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0916aac9a4a6a53c03b9a3bb80aa9254ce172546 --- /dev/null +++ b/codenet/public_test_cases/p03729/input.2.txt @@ -0,0 +1 @@ +rng gorilla apple diff --git a/codenet/public_test_cases/p03729/input.3.txt b/codenet/public_test_cases/p03729/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f16ebe5ad77a0f2a69925ddd545abcdfc573969a --- /dev/null +++ b/codenet/public_test_cases/p03729/input.3.txt @@ -0,0 +1 @@ +aaaaaaaaab aaaaaaaaaa aaaaaaaaab diff --git a/codenet/public_test_cases/p03729/input.4.txt b/codenet/public_test_cases/p03729/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe76cce66949b394c0ec34338bd4f93383ad64e4 --- /dev/null +++ b/codenet/public_test_cases/p03729/input.4.txt @@ -0,0 +1 @@ +yakiniku unagi sushi diff --git a/codenet/public_test_cases/p03729/output.0.txt b/codenet/public_test_cases/p03729/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03729/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03729/output.1.txt b/codenet/public_test_cases/p03729/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03729/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03729/output.2.txt b/codenet/public_test_cases/p03729/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03729/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03729/output.3.txt b/codenet/public_test_cases/p03729/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03729/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03729/output.4.txt b/codenet/public_test_cases/p03729/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03729/output.4.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03730/input.0.txt b/codenet/public_test_cases/p03730/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..241c6876cf2bdecaea2fb551186de4b29e68164a --- /dev/null +++ b/codenet/public_test_cases/p03730/input.0.txt @@ -0,0 +1 @@ +7 5 1 diff --git a/codenet/public_test_cases/p03730/input.1.txt b/codenet/public_test_cases/p03730/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..241c6876cf2bdecaea2fb551186de4b29e68164a --- /dev/null +++ b/codenet/public_test_cases/p03730/input.1.txt @@ -0,0 +1 @@ +7 5 1 diff --git a/codenet/public_test_cases/p03730/input.2.txt b/codenet/public_test_cases/p03730/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac06d91d8aecaaf1ed168da3b63333dfc2e26e6d --- /dev/null +++ b/codenet/public_test_cases/p03730/input.2.txt @@ -0,0 +1 @@ +2 2 1 diff --git a/codenet/public_test_cases/p03730/input.3.txt b/codenet/public_test_cases/p03730/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f42daf402344e2b963a64fec7b7dee0a0a42b26 --- /dev/null +++ b/codenet/public_test_cases/p03730/input.3.txt @@ -0,0 +1 @@ +77 42 36 diff --git a/codenet/public_test_cases/p03730/input.4.txt b/codenet/public_test_cases/p03730/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..04951d81cf91981fc9ad32a70a113bebe64fae85 --- /dev/null +++ b/codenet/public_test_cases/p03730/input.4.txt @@ -0,0 +1 @@ +40 98 58 diff --git a/codenet/public_test_cases/p03730/input.5.txt b/codenet/public_test_cases/p03730/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..f57324a533e5bf64320cddec9709ffc77a62bff5 --- /dev/null +++ b/codenet/public_test_cases/p03730/input.5.txt @@ -0,0 +1 @@ +1 100 97 diff --git a/codenet/public_test_cases/p03730/output.0.txt b/codenet/public_test_cases/p03730/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03730/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03730/output.1.txt b/codenet/public_test_cases/p03730/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03730/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03730/output.2.txt b/codenet/public_test_cases/p03730/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03730/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03730/output.3.txt b/codenet/public_test_cases/p03730/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03730/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03730/output.4.txt b/codenet/public_test_cases/p03730/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03730/output.4.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03730/output.5.txt b/codenet/public_test_cases/p03730/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03730/output.5.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03731/input.0.txt b/codenet/public_test_cases/p03731/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e828bdbc9d3fad86abe19a2e4c2f80164947a462 --- /dev/null +++ b/codenet/public_test_cases/p03731/input.0.txt @@ -0,0 +1,2 @@ +2 4 +0 3 diff --git a/codenet/public_test_cases/p03731/output.0.txt b/codenet/public_test_cases/p03731/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03731/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03732/input.0.txt b/codenet/public_test_cases/p03732/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fdb127b63a113e6a518ddf21cb9692ef22e6cb1 --- /dev/null +++ b/codenet/public_test_cases/p03732/input.0.txt @@ -0,0 +1,5 @@ +4 6 +2 1 +3 4 +4 10 +3 4 diff --git a/codenet/public_test_cases/p03732/output.0.txt b/codenet/public_test_cases/p03732/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03732/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03733/input.0.txt b/codenet/public_test_cases/p03733/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e828bdbc9d3fad86abe19a2e4c2f80164947a462 --- /dev/null +++ b/codenet/public_test_cases/p03733/input.0.txt @@ -0,0 +1,2 @@ +2 4 +0 3 diff --git a/codenet/public_test_cases/p03733/input.1.txt b/codenet/public_test_cases/p03733/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d5a87e1986270412d7ef5fc943b27b914aeebb1 --- /dev/null +++ b/codenet/public_test_cases/p03733/input.1.txt @@ -0,0 +1,2 @@ +9 10 +0 3 5 7 100 110 200 300 311 diff --git a/codenet/public_test_cases/p03733/input.2.txt b/codenet/public_test_cases/p03733/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e828bdbc9d3fad86abe19a2e4c2f80164947a462 --- /dev/null +++ b/codenet/public_test_cases/p03733/input.2.txt @@ -0,0 +1,2 @@ +2 4 +0 3 diff --git a/codenet/public_test_cases/p03733/input.3.txt b/codenet/public_test_cases/p03733/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b774dab2b2a8a99b5977390fb9d06e6fcaae52e --- /dev/null +++ b/codenet/public_test_cases/p03733/input.3.txt @@ -0,0 +1,2 @@ +1 1 +0 diff --git a/codenet/public_test_cases/p03733/input.4.txt b/codenet/public_test_cases/p03733/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..057ae1144ea22b0b4a1ff60817c99123d1fe8bf3 --- /dev/null +++ b/codenet/public_test_cases/p03733/input.4.txt @@ -0,0 +1,2 @@ +2 4 +0 5 diff --git a/codenet/public_test_cases/p03733/input.5.txt b/codenet/public_test_cases/p03733/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..dec7b0b182ddf77ac579453a813d29652c50a3ef --- /dev/null +++ b/codenet/public_test_cases/p03733/input.5.txt @@ -0,0 +1,2 @@ +4 1000000000 +0 1000 1000000 1000000000 diff --git a/codenet/public_test_cases/p03733/output.0.txt b/codenet/public_test_cases/p03733/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03733/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03733/output.1.txt b/codenet/public_test_cases/p03733/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fdcd7c44cb1791f45e7386a8f230e018fd7e052 --- /dev/null +++ b/codenet/public_test_cases/p03733/output.1.txt @@ -0,0 +1 @@ +67 diff --git a/codenet/public_test_cases/p03733/output.2.txt b/codenet/public_test_cases/p03733/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03733/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03733/output.3.txt b/codenet/public_test_cases/p03733/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03733/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03733/output.4.txt b/codenet/public_test_cases/p03733/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03733/output.4.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03733/output.5.txt b/codenet/public_test_cases/p03733/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..04b2646e30b0383d7bab169b05c1edc80feed7b0 --- /dev/null +++ b/codenet/public_test_cases/p03733/output.5.txt @@ -0,0 +1 @@ +2000000000 diff --git a/codenet/public_test_cases/p03734/input.0.txt b/codenet/public_test_cases/p03734/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fdb127b63a113e6a518ddf21cb9692ef22e6cb1 --- /dev/null +++ b/codenet/public_test_cases/p03734/input.0.txt @@ -0,0 +1,5 @@ +4 6 +2 1 +3 4 +4 10 +3 4 diff --git a/codenet/public_test_cases/p03734/input.1.txt b/codenet/public_test_cases/p03734/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f37330f505b890ea485b82311610d4b8034393c --- /dev/null +++ b/codenet/public_test_cases/p03734/input.1.txt @@ -0,0 +1,5 @@ +4 10 +1 100 +1 100 +1 100 +1 100 diff --git a/codenet/public_test_cases/p03734/input.2.txt b/codenet/public_test_cases/p03734/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c9bb63575edc5f3505ac36ba322a96f80fb110c --- /dev/null +++ b/codenet/public_test_cases/p03734/input.2.txt @@ -0,0 +1,5 @@ +4 1 +10 100 +10 100 +10 100 +10 100 diff --git a/codenet/public_test_cases/p03734/input.3.txt b/codenet/public_test_cases/p03734/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d24bc8459b5075bcc9e2915ad6e690e858a44c1 --- /dev/null +++ b/codenet/public_test_cases/p03734/input.3.txt @@ -0,0 +1,5 @@ +4 6 +2 1 +3 7 +4 10 +3 6 diff --git a/codenet/public_test_cases/p03734/input.4.txt b/codenet/public_test_cases/p03734/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fdb127b63a113e6a518ddf21cb9692ef22e6cb1 --- /dev/null +++ b/codenet/public_test_cases/p03734/input.4.txt @@ -0,0 +1,5 @@ +4 6 +2 1 +3 4 +4 10 +3 4 diff --git a/codenet/public_test_cases/p03734/output.0.txt b/codenet/public_test_cases/p03734/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03734/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03734/output.1.txt b/codenet/public_test_cases/p03734/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d411bb7c1acabe5edc652eb910b74ab77be9dd3d --- /dev/null +++ b/codenet/public_test_cases/p03734/output.1.txt @@ -0,0 +1 @@ +400 diff --git a/codenet/public_test_cases/p03734/output.2.txt b/codenet/public_test_cases/p03734/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03734/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03734/output.3.txt b/codenet/public_test_cases/p03734/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03734/output.3.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03734/output.4.txt b/codenet/public_test_cases/p03734/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03734/output.4.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03735/input.0.txt b/codenet/public_test_cases/p03735/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf3de8936aec141cfc3745bbff8bf1b8ea264439 --- /dev/null +++ b/codenet/public_test_cases/p03735/input.0.txt @@ -0,0 +1,4 @@ +3 +1 2 +3 4 +5 6 diff --git a/codenet/public_test_cases/p03735/input.1.txt b/codenet/public_test_cases/p03735/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7f0c4d450c561840fe987127609c8c2f9459deb --- /dev/null +++ b/codenet/public_test_cases/p03735/input.1.txt @@ -0,0 +1,3 @@ +2 +1 1 +1000000000 1000000000 diff --git a/codenet/public_test_cases/p03735/input.2.txt b/codenet/public_test_cases/p03735/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf3de8936aec141cfc3745bbff8bf1b8ea264439 --- /dev/null +++ b/codenet/public_test_cases/p03735/input.2.txt @@ -0,0 +1,4 @@ +3 +1 2 +3 4 +5 6 diff --git a/codenet/public_test_cases/p03735/input.3.txt b/codenet/public_test_cases/p03735/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1011aefcf34dde2c544c6368efe83c16bd48dad --- /dev/null +++ b/codenet/public_test_cases/p03735/input.3.txt @@ -0,0 +1,4 @@ +3 +1010 10 +1000 1 +20 1020 diff --git a/codenet/public_test_cases/p03735/output.0.txt b/codenet/public_test_cases/p03735/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03735/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03735/output.1.txt b/codenet/public_test_cases/p03735/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a8453ca30824c67c9a58fe61aa64b2da4868c29 --- /dev/null +++ b/codenet/public_test_cases/p03735/output.1.txt @@ -0,0 +1 @@ +999999998000000001 diff --git a/codenet/public_test_cases/p03735/output.2.txt b/codenet/public_test_cases/p03735/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03735/output.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03735/output.3.txt b/codenet/public_test_cases/p03735/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2f53117572c977e17d57f8ca4570b144fafef06 --- /dev/null +++ b/codenet/public_test_cases/p03735/output.3.txt @@ -0,0 +1 @@ +380 diff --git a/codenet/public_test_cases/p03736/input.0.txt b/codenet/public_test_cases/p03736/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..329af0b0aac58c113202a313a5c4006d1ca3b312 --- /dev/null +++ b/codenet/public_test_cases/p03736/input.0.txt @@ -0,0 +1,2 @@ +8 3 1 8 +3 5 1 diff --git a/codenet/public_test_cases/p03736/input.1.txt b/codenet/public_test_cases/p03736/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..329af0b0aac58c113202a313a5c4006d1ca3b312 --- /dev/null +++ b/codenet/public_test_cases/p03736/input.1.txt @@ -0,0 +1,2 @@ +8 3 1 8 +3 5 1 diff --git a/codenet/public_test_cases/p03736/input.2.txt b/codenet/public_test_cases/p03736/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1fccdd72f9a449dfa77d7bcfc467b8505aee1fd5 --- /dev/null +++ b/codenet/public_test_cases/p03736/input.2.txt @@ -0,0 +1,2 @@ +9 2 1 9 +5 9 diff --git a/codenet/public_test_cases/p03736/input.3.txt b/codenet/public_test_cases/p03736/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..04207ed5b41d141027ec1ee55ce5123cac59068b --- /dev/null +++ b/codenet/public_test_cases/p03736/input.3.txt @@ -0,0 +1,2 @@ +9 2 1 9 +5 1 diff --git a/codenet/public_test_cases/p03736/input.4.txt b/codenet/public_test_cases/p03736/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c4413c1a8668c9ef5194bd12cdd8e94485cbc68 --- /dev/null +++ b/codenet/public_test_cases/p03736/input.4.txt @@ -0,0 +1,2 @@ +11 16 8 1 +1 1 5 1 11 4 5 2 5 3 3 3 5 5 6 7 diff --git a/codenet/public_test_cases/p03736/output.0.txt b/codenet/public_test_cases/p03736/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03736/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03736/output.1.txt b/codenet/public_test_cases/p03736/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03736/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03736/output.2.txt b/codenet/public_test_cases/p03736/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03736/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03736/output.3.txt b/codenet/public_test_cases/p03736/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03736/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03736/output.4.txt b/codenet/public_test_cases/p03736/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03736/output.4.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03737/input.0.txt b/codenet/public_test_cases/p03737/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..95ded2343e9167a2fd1f9728ed53af9b5b1733fd --- /dev/null +++ b/codenet/public_test_cases/p03737/input.0.txt @@ -0,0 +1 @@ +atcoder beginner contest diff --git a/codenet/public_test_cases/p03737/input.1.txt b/codenet/public_test_cases/p03737/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46c61765558cc5b3053650b3ca4dd0a1330ba3a2 --- /dev/null +++ b/codenet/public_test_cases/p03737/input.1.txt @@ -0,0 +1 @@ +resident register number diff --git a/codenet/public_test_cases/p03737/input.2.txt b/codenet/public_test_cases/p03737/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ac2dd48b68fca760df1e31f81c8e60b9906d799 --- /dev/null +++ b/codenet/public_test_cases/p03737/input.2.txt @@ -0,0 +1 @@ +async layered coding diff --git a/codenet/public_test_cases/p03737/input.3.txt b/codenet/public_test_cases/p03737/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..28cc7a4a93e5dd27bdacc16b61ba2d77c6dbef6d --- /dev/null +++ b/codenet/public_test_cases/p03737/input.3.txt @@ -0,0 +1 @@ +k nearest neighbor diff --git a/codenet/public_test_cases/p03737/input.4.txt b/codenet/public_test_cases/p03737/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..95ded2343e9167a2fd1f9728ed53af9b5b1733fd --- /dev/null +++ b/codenet/public_test_cases/p03737/input.4.txt @@ -0,0 +1 @@ +atcoder beginner contest diff --git a/codenet/public_test_cases/p03737/output.0.txt b/codenet/public_test_cases/p03737/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p03737/output.0.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p03737/output.1.txt b/codenet/public_test_cases/p03737/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74fcecc52ceb5f73e7ce3bec28841e653267a14c --- /dev/null +++ b/codenet/public_test_cases/p03737/output.1.txt @@ -0,0 +1 @@ +RRN diff --git a/codenet/public_test_cases/p03737/output.2.txt b/codenet/public_test_cases/p03737/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d33a4436e26c4fe7bbc749aea9d98d8fb695194 --- /dev/null +++ b/codenet/public_test_cases/p03737/output.2.txt @@ -0,0 +1 @@ +ALC diff --git a/codenet/public_test_cases/p03737/output.3.txt b/codenet/public_test_cases/p03737/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8cd5024aae5bb158b281bbe976de5a7bbe841460 --- /dev/null +++ b/codenet/public_test_cases/p03737/output.3.txt @@ -0,0 +1 @@ +KNN diff --git a/codenet/public_test_cases/p03737/output.4.txt b/codenet/public_test_cases/p03737/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p03737/output.4.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p03738/input.0.txt b/codenet/public_test_cases/p03738/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69f2da6c4dd2e0a4bd4cc1ec41d2133cda6d0292 --- /dev/null +++ b/codenet/public_test_cases/p03738/input.0.txt @@ -0,0 +1,2 @@ +36 +24 diff --git a/codenet/public_test_cases/p03738/input.1.txt b/codenet/public_test_cases/p03738/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69f2da6c4dd2e0a4bd4cc1ec41d2133cda6d0292 --- /dev/null +++ b/codenet/public_test_cases/p03738/input.1.txt @@ -0,0 +1,2 @@ +36 +24 diff --git a/codenet/public_test_cases/p03738/input.2.txt b/codenet/public_test_cases/p03738/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..003e839ef1a68ad233cc50f6a543392e88080b9c --- /dev/null +++ b/codenet/public_test_cases/p03738/input.2.txt @@ -0,0 +1,2 @@ +9720246 +22516266 diff --git a/codenet/public_test_cases/p03738/input.3.txt b/codenet/public_test_cases/p03738/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a072adbde64c1f10c82ceebac7c92667f0421934 --- /dev/null +++ b/codenet/public_test_cases/p03738/input.3.txt @@ -0,0 +1,2 @@ +123456789012345678901234567890 +234567890123456789012345678901 diff --git a/codenet/public_test_cases/p03738/input.4.txt b/codenet/public_test_cases/p03738/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc02257141bb209c158cc948e768e4d13202670c --- /dev/null +++ b/codenet/public_test_cases/p03738/input.4.txt @@ -0,0 +1,2 @@ +850 +3777 diff --git a/codenet/public_test_cases/p03738/output.0.txt b/codenet/public_test_cases/p03738/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..62da4c4673493da0ae9138ede6769ef72c5f5088 --- /dev/null +++ b/codenet/public_test_cases/p03738/output.0.txt @@ -0,0 +1 @@ +GREATER diff --git a/codenet/public_test_cases/p03738/output.1.txt b/codenet/public_test_cases/p03738/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..62da4c4673493da0ae9138ede6769ef72c5f5088 --- /dev/null +++ b/codenet/public_test_cases/p03738/output.1.txt @@ -0,0 +1 @@ +GREATER diff --git a/codenet/public_test_cases/p03738/output.2.txt b/codenet/public_test_cases/p03738/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..71a2337a7b74a7f6c8190ac89b88a5ad2a38abdf --- /dev/null +++ b/codenet/public_test_cases/p03738/output.2.txt @@ -0,0 +1 @@ +LESS diff --git a/codenet/public_test_cases/p03738/output.3.txt b/codenet/public_test_cases/p03738/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..71a2337a7b74a7f6c8190ac89b88a5ad2a38abdf --- /dev/null +++ b/codenet/public_test_cases/p03738/output.3.txt @@ -0,0 +1 @@ +LESS diff --git a/codenet/public_test_cases/p03738/output.4.txt b/codenet/public_test_cases/p03738/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..71a2337a7b74a7f6c8190ac89b88a5ad2a38abdf --- /dev/null +++ b/codenet/public_test_cases/p03738/output.4.txt @@ -0,0 +1 @@ +LESS diff --git a/codenet/public_test_cases/p03739/input.0.txt b/codenet/public_test_cases/p03739/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0f81bac299ee93b12a0e22d03579e3203f52c3a --- /dev/null +++ b/codenet/public_test_cases/p03739/input.0.txt @@ -0,0 +1,2 @@ +4 +1 -3 1 0 diff --git a/codenet/public_test_cases/p03739/input.1.txt b/codenet/public_test_cases/p03739/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..79e083beea4b5ff0f17edfcdeb9facf310fd2cd1 --- /dev/null +++ b/codenet/public_test_cases/p03739/input.1.txt @@ -0,0 +1,2 @@ +5 +3 -6 4 -5 7 diff --git a/codenet/public_test_cases/p03739/input.2.txt b/codenet/public_test_cases/p03739/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0f81bac299ee93b12a0e22d03579e3203f52c3a --- /dev/null +++ b/codenet/public_test_cases/p03739/input.2.txt @@ -0,0 +1,2 @@ +4 +1 -3 1 0 diff --git a/codenet/public_test_cases/p03739/input.3.txt b/codenet/public_test_cases/p03739/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..72ecc374387df32474282cfb71a2a310a262c527 --- /dev/null +++ b/codenet/public_test_cases/p03739/input.3.txt @@ -0,0 +1,2 @@ +6 +-1 4 3 2 -5 4 diff --git a/codenet/public_test_cases/p03739/output.0.txt b/codenet/public_test_cases/p03739/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03739/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03739/output.1.txt b/codenet/public_test_cases/p03739/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03739/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03739/output.2.txt b/codenet/public_test_cases/p03739/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03739/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03739/output.3.txt b/codenet/public_test_cases/p03739/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03739/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03740/input.0.txt b/codenet/public_test_cases/p03740/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03740/input.0.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03740/input.1.txt b/codenet/public_test_cases/p03740/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b748e2dcfcbc7db3aae214293cef6cb2afbd0a65 --- /dev/null +++ b/codenet/public_test_cases/p03740/input.1.txt @@ -0,0 +1 @@ +0 0 diff --git a/codenet/public_test_cases/p03740/input.2.txt b/codenet/public_test_cases/p03740/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e846a7c6282b3642ed86ac23209829f4a4a48586 --- /dev/null +++ b/codenet/public_test_cases/p03740/input.2.txt @@ -0,0 +1 @@ +5 0 diff --git a/codenet/public_test_cases/p03740/input.3.txt b/codenet/public_test_cases/p03740/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03740/input.3.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03740/input.4.txt b/codenet/public_test_cases/p03740/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dfbee1ba298ba75b0413655c18cbcf5dfc2dbc0 --- /dev/null +++ b/codenet/public_test_cases/p03740/input.4.txt @@ -0,0 +1 @@ +4 8 diff --git a/codenet/public_test_cases/p03740/output.0.txt b/codenet/public_test_cases/p03740/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c047400bd768be07b10f47b989ee47bd21acff6 --- /dev/null +++ b/codenet/public_test_cases/p03740/output.0.txt @@ -0,0 +1 @@ +Brown diff --git a/codenet/public_test_cases/p03740/output.1.txt b/codenet/public_test_cases/p03740/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c047400bd768be07b10f47b989ee47bd21acff6 --- /dev/null +++ b/codenet/public_test_cases/p03740/output.1.txt @@ -0,0 +1 @@ +Brown diff --git a/codenet/public_test_cases/p03740/output.2.txt b/codenet/public_test_cases/p03740/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03740/output.2.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03740/output.3.txt b/codenet/public_test_cases/p03740/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c047400bd768be07b10f47b989ee47bd21acff6 --- /dev/null +++ b/codenet/public_test_cases/p03740/output.3.txt @@ -0,0 +1 @@ +Brown diff --git a/codenet/public_test_cases/p03740/output.4.txt b/codenet/public_test_cases/p03740/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03740/output.4.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03741/input.0.txt b/codenet/public_test_cases/p03741/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0f81bac299ee93b12a0e22d03579e3203f52c3a --- /dev/null +++ b/codenet/public_test_cases/p03741/input.0.txt @@ -0,0 +1,2 @@ +4 +1 -3 1 0 diff --git a/codenet/public_test_cases/p03741/output.0.txt b/codenet/public_test_cases/p03741/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03741/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03742/input.0.txt b/codenet/public_test_cases/p03742/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03742/input.0.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03742/output.0.txt b/codenet/public_test_cases/p03742/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c047400bd768be07b10f47b989ee47bd21acff6 --- /dev/null +++ b/codenet/public_test_cases/p03742/output.0.txt @@ -0,0 +1 @@ +Brown diff --git a/codenet/public_test_cases/p03743/input.0.txt b/codenet/public_test_cases/p03743/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69f0f4b05fcae47fdd491694fb8934e08cc530d --- /dev/null +++ b/codenet/public_test_cases/p03743/input.0.txt @@ -0,0 +1,4 @@ +4 10 +3 4 3 3 +2 +4 3 diff --git a/codenet/public_test_cases/p03743/input.1.txt b/codenet/public_test_cases/p03743/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e572a508be66d30f0f364612d8a8df2e57c5dc6 --- /dev/null +++ b/codenet/public_test_cases/p03743/input.1.txt @@ -0,0 +1,4 @@ +5 9 +4 4 2 3 2 +5 +1 4 2 3 5 diff --git a/codenet/public_test_cases/p03743/input.2.txt b/codenet/public_test_cases/p03743/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca3bb1ff86bf85c0cd196eb94a2f80b4e3d79ffb --- /dev/null +++ b/codenet/public_test_cases/p03743/input.2.txt @@ -0,0 +1,4 @@ +6 15 +4 3 5 4 2 1 +6 +1 2 3 4 5 6 diff --git a/codenet/public_test_cases/p03743/input.3.txt b/codenet/public_test_cases/p03743/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69f0f4b05fcae47fdd491694fb8934e08cc530d --- /dev/null +++ b/codenet/public_test_cases/p03743/input.3.txt @@ -0,0 +1,4 @@ +4 10 +3 4 3 3 +2 +4 3 diff --git a/codenet/public_test_cases/p03743/output.0.txt b/codenet/public_test_cases/p03743/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b84a2378d351b0c1b98546d4891b3f0a324df1fb --- /dev/null +++ b/codenet/public_test_cases/p03743/output.0.txt @@ -0,0 +1,2 @@ +NO +YES diff --git a/codenet/public_test_cases/p03743/output.1.txt b/codenet/public_test_cases/p03743/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74eacf7ff9ea117139c086368d25b43f9358123d --- /dev/null +++ b/codenet/public_test_cases/p03743/output.1.txt @@ -0,0 +1,5 @@ +YES +YES +YES +YES +YES diff --git a/codenet/public_test_cases/p03743/output.2.txt b/codenet/public_test_cases/p03743/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..187ad8af4c3f273d97a2cb63d7639786576795bb --- /dev/null +++ b/codenet/public_test_cases/p03743/output.2.txt @@ -0,0 +1,6 @@ +NO +NO +YES +NO +NO +YES diff --git a/codenet/public_test_cases/p03743/output.3.txt b/codenet/public_test_cases/p03743/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b84a2378d351b0c1b98546d4891b3f0a324df1fb --- /dev/null +++ b/codenet/public_test_cases/p03743/output.3.txt @@ -0,0 +1,2 @@ +NO +YES diff --git a/codenet/public_test_cases/p03744/input.0.txt b/codenet/public_test_cases/p03744/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ee1359abf34c1a9416a243fbc541e0c8733eca5 --- /dev/null +++ b/codenet/public_test_cases/p03744/input.0.txt @@ -0,0 +1,4 @@ +3 10 +10 10 +20 5 +4 3 diff --git a/codenet/public_test_cases/p03744/input.1.txt b/codenet/public_test_cases/p03744/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81bb6f9e11a938d724bb0ea5660dc89bc9dc9f36 --- /dev/null +++ b/codenet/public_test_cases/p03744/input.1.txt @@ -0,0 +1,5 @@ +4 15 +1000000000 15 +9 5 +8 6 +7 4 diff --git a/codenet/public_test_cases/p03744/input.2.txt b/codenet/public_test_cases/p03744/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..92a130235c08d972779c476887d892cdc7a87772 --- /dev/null +++ b/codenet/public_test_cases/p03744/input.2.txt @@ -0,0 +1,5 @@ +4 15 +0 15 +2 5 +3 6 +4 4 diff --git a/codenet/public_test_cases/p03744/input.3.txt b/codenet/public_test_cases/p03744/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ee1359abf34c1a9416a243fbc541e0c8733eca5 --- /dev/null +++ b/codenet/public_test_cases/p03744/input.3.txt @@ -0,0 +1,4 @@ +3 10 +10 10 +20 5 +4 3 diff --git a/codenet/public_test_cases/p03744/output.0.txt b/codenet/public_test_cases/p03744/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..28697c1875dde03252855bfefef122150d4b1d88 --- /dev/null +++ b/codenet/public_test_cases/p03744/output.0.txt @@ -0,0 +1,3 @@ +10.0000000 +15.0000000 +13.2000000 diff --git a/codenet/public_test_cases/p03744/output.1.txt b/codenet/public_test_cases/p03744/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5393287eaf1a3833f975202752394f5ce5488fdc --- /dev/null +++ b/codenet/public_test_cases/p03744/output.1.txt @@ -0,0 +1,4 @@ +1000000000.0000000 +666666669.6666666 +400000005.0000000 +293333338.8666667 diff --git a/codenet/public_test_cases/p03744/output.2.txt b/codenet/public_test_cases/p03744/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..acd5e5465a9ad78d84dce68aca15bc67312a041a --- /dev/null +++ b/codenet/public_test_cases/p03744/output.2.txt @@ -0,0 +1,4 @@ +0.0000000 +0.6666667 +1.8666667 +2.9333333 diff --git a/codenet/public_test_cases/p03744/output.3.txt b/codenet/public_test_cases/p03744/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..28697c1875dde03252855bfefef122150d4b1d88 --- /dev/null +++ b/codenet/public_test_cases/p03744/output.3.txt @@ -0,0 +1,3 @@ +10.0000000 +15.0000000 +13.2000000 diff --git a/codenet/public_test_cases/p03745/input.0.txt b/codenet/public_test_cases/p03745/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9b36f4a769f3c2eed3885a23cb7558e8e9ab910 --- /dev/null +++ b/codenet/public_test_cases/p03745/input.0.txt @@ -0,0 +1,2 @@ +6 +1 2 3 2 2 1 diff --git a/codenet/public_test_cases/p03745/input.1.txt b/codenet/public_test_cases/p03745/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9b36f4a769f3c2eed3885a23cb7558e8e9ab910 --- /dev/null +++ b/codenet/public_test_cases/p03745/input.1.txt @@ -0,0 +1,2 @@ +6 +1 2 3 2 2 1 diff --git a/codenet/public_test_cases/p03745/input.2.txt b/codenet/public_test_cases/p03745/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..83c1da325adf3eaebb05e3d6a7575b5ed326d1e3 --- /dev/null +++ b/codenet/public_test_cases/p03745/input.2.txt @@ -0,0 +1,2 @@ +9 +1 2 1 2 1 2 1 2 1 diff --git a/codenet/public_test_cases/p03745/input.3.txt b/codenet/public_test_cases/p03745/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4e0369d90d8e00f3549d9bb9cb5206f7a7101ab --- /dev/null +++ b/codenet/public_test_cases/p03745/input.3.txt @@ -0,0 +1,2 @@ +7 +1 2 3 2 1 999999999 1000000000 diff --git a/codenet/public_test_cases/p03745/output.0.txt b/codenet/public_test_cases/p03745/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03745/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03745/output.1.txt b/codenet/public_test_cases/p03745/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03745/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03745/output.2.txt b/codenet/public_test_cases/p03745/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03745/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03745/output.3.txt b/codenet/public_test_cases/p03745/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03745/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03746/input.0.txt b/codenet/public_test_cases/p03746/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..993abe322648a1c93e25c384415c85ad661dc022 --- /dev/null +++ b/codenet/public_test_cases/p03746/input.0.txt @@ -0,0 +1,7 @@ +5 6 +1 3 +1 4 +2 3 +1 5 +3 5 +2 4 diff --git a/codenet/public_test_cases/p03746/input.1.txt b/codenet/public_test_cases/p03746/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..993abe322648a1c93e25c384415c85ad661dc022 --- /dev/null +++ b/codenet/public_test_cases/p03746/input.1.txt @@ -0,0 +1,7 @@ +5 6 +1 3 +1 4 +2 3 +1 5 +3 5 +2 4 diff --git a/codenet/public_test_cases/p03746/input.2.txt b/codenet/public_test_cases/p03746/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6130c6999e981533ca0a8cc5ef1f2bacb8d1ebb6 --- /dev/null +++ b/codenet/public_test_cases/p03746/input.2.txt @@ -0,0 +1,9 @@ +7 8 +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +3 5 +2 6 diff --git a/codenet/public_test_cases/p03746/output.0.txt b/codenet/public_test_cases/p03746/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd3e9c88357a718e9f8022965f8f178b05cd2e74 --- /dev/null +++ b/codenet/public_test_cases/p03746/output.0.txt @@ -0,0 +1,2 @@ +4 +2 3 1 4 diff --git a/codenet/public_test_cases/p03746/output.1.txt b/codenet/public_test_cases/p03746/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd3e9c88357a718e9f8022965f8f178b05cd2e74 --- /dev/null +++ b/codenet/public_test_cases/p03746/output.1.txt @@ -0,0 +1,2 @@ +4 +2 3 1 4 diff --git a/codenet/public_test_cases/p03746/output.2.txt b/codenet/public_test_cases/p03746/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1867bcc2bb2dbdce09956ca9bd917b085cfdda7b --- /dev/null +++ b/codenet/public_test_cases/p03746/output.2.txt @@ -0,0 +1,2 @@ +7 +1 2 3 4 5 6 7 diff --git a/codenet/public_test_cases/p03747/input.0.txt b/codenet/public_test_cases/p03747/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48881c145447f4614aba6da09bf01cda91c8413c --- /dev/null +++ b/codenet/public_test_cases/p03747/input.0.txt @@ -0,0 +1,4 @@ +3 8 3 +0 1 +3 2 +6 1 diff --git a/codenet/public_test_cases/p03747/input.1.txt b/codenet/public_test_cases/p03747/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6a64cd7d1e83d6aa20c125b83e8a2b876604ddf --- /dev/null +++ b/codenet/public_test_cases/p03747/input.1.txt @@ -0,0 +1,5 @@ +4 20 9 +7 2 +9 1 +12 1 +18 1 diff --git a/codenet/public_test_cases/p03747/input.2.txt b/codenet/public_test_cases/p03747/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48881c145447f4614aba6da09bf01cda91c8413c --- /dev/null +++ b/codenet/public_test_cases/p03747/input.2.txt @@ -0,0 +1,4 @@ +3 8 3 +0 1 +3 2 +6 1 diff --git a/codenet/public_test_cases/p03747/output.0.txt b/codenet/public_test_cases/p03747/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..983374adc89a3fac6cbfc4a881eca3083b1063a1 --- /dev/null +++ b/codenet/public_test_cases/p03747/output.0.txt @@ -0,0 +1,3 @@ +1 +3 +0 diff --git a/codenet/public_test_cases/p03747/output.1.txt b/codenet/public_test_cases/p03747/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..413c9b935bc0a7582df9f39ec16414f130697331 --- /dev/null +++ b/codenet/public_test_cases/p03747/output.1.txt @@ -0,0 +1,4 @@ +7 +18 +18 +1 diff --git a/codenet/public_test_cases/p03747/output.2.txt b/codenet/public_test_cases/p03747/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..983374adc89a3fac6cbfc4a881eca3083b1063a1 --- /dev/null +++ b/codenet/public_test_cases/p03747/output.2.txt @@ -0,0 +1,3 @@ +1 +3 +0 diff --git a/codenet/public_test_cases/p03748/input.0.txt b/codenet/public_test_cases/p03748/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p03748/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p03748/input.1.txt b/codenet/public_test_cases/p03748/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aec3d1631b352671316272905257ef83b1db9911 --- /dev/null +++ b/codenet/public_test_cases/p03748/input.1.txt @@ -0,0 +1 @@ +1000 3000 diff --git a/codenet/public_test_cases/p03748/input.2.txt b/codenet/public_test_cases/p03748/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..453cb994d01ac18236056aaf7c4b110f88445352 --- /dev/null +++ b/codenet/public_test_cases/p03748/input.2.txt @@ -0,0 +1 @@ +1000 10 diff --git a/codenet/public_test_cases/p03748/input.3.txt b/codenet/public_test_cases/p03748/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p03748/input.3.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p03748/output.0.txt b/codenet/public_test_cases/p03748/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b91e0e1f8dddaac700b51aa7a66f29fc135a02 --- /dev/null +++ b/codenet/public_test_cases/p03748/output.0.txt @@ -0,0 +1 @@ +56 diff --git a/codenet/public_test_cases/p03748/output.1.txt b/codenet/public_test_cases/p03748/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..754b53abc0f7e2aae86adab676c987c746b324a5 --- /dev/null +++ b/codenet/public_test_cases/p03748/output.1.txt @@ -0,0 +1 @@ +693347555 diff --git a/codenet/public_test_cases/p03748/output.2.txt b/codenet/public_test_cases/p03748/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6820bf1779b1e548aa6c6e35afcd092e0e09137a --- /dev/null +++ b/codenet/public_test_cases/p03748/output.2.txt @@ -0,0 +1 @@ +1048576 diff --git a/codenet/public_test_cases/p03748/output.3.txt b/codenet/public_test_cases/p03748/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b91e0e1f8dddaac700b51aa7a66f29fc135a02 --- /dev/null +++ b/codenet/public_test_cases/p03748/output.3.txt @@ -0,0 +1 @@ +56 diff --git a/codenet/public_test_cases/p03749/input.0.txt b/codenet/public_test_cases/p03749/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e7c097aa3efddc15f7118eafbea4952255140f --- /dev/null +++ b/codenet/public_test_cases/p03749/input.0.txt @@ -0,0 +1,2 @@ +3 1 +2 diff --git a/codenet/public_test_cases/p03749/input.1.txt b/codenet/public_test_cases/p03749/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98b559c7fe1805d51d977a34f10bb2698d72c5b9 --- /dev/null +++ b/codenet/public_test_cases/p03749/input.1.txt @@ -0,0 +1 @@ +1000000000 0 diff --git a/codenet/public_test_cases/p03749/input.2.txt b/codenet/public_test_cases/p03749/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a5c11097e3509876aa693156964af8163f4ab8b --- /dev/null +++ b/codenet/public_test_cases/p03749/input.2.txt @@ -0,0 +1,2 @@ +10 9 +1 2 3 4 5 6 7 8 9 diff --git a/codenet/public_test_cases/p03749/input.3.txt b/codenet/public_test_cases/p03749/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b4a8ec64d0e0b87d122c0253bf629f19793c087 --- /dev/null +++ b/codenet/public_test_cases/p03749/input.3.txt @@ -0,0 +1,2 @@ +5 2 +2 3 diff --git a/codenet/public_test_cases/p03749/input.4.txt b/codenet/public_test_cases/p03749/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e7c097aa3efddc15f7118eafbea4952255140f --- /dev/null +++ b/codenet/public_test_cases/p03749/input.4.txt @@ -0,0 +1,2 @@ +3 1 +2 diff --git a/codenet/public_test_cases/p03749/output.0.txt b/codenet/public_test_cases/p03749/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03749/output.0.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03749/output.1.txt b/codenet/public_test_cases/p03749/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29cf824614bac19b4bd6ee1a0b473c97dcd0d65a --- /dev/null +++ b/codenet/public_test_cases/p03749/output.1.txt @@ -0,0 +1 @@ +693316425 diff --git a/codenet/public_test_cases/p03749/output.2.txt b/codenet/public_test_cases/p03749/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p03749/output.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p03749/output.3.txt b/codenet/public_test_cases/p03749/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..69a893aa31141827125ddaaee26966b7aed3de74 --- /dev/null +++ b/codenet/public_test_cases/p03749/output.3.txt @@ -0,0 +1 @@ +66 diff --git a/codenet/public_test_cases/p03749/output.4.txt b/codenet/public_test_cases/p03749/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03749/output.4.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03750/input.0.txt b/codenet/public_test_cases/p03750/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d0f8b175277e4033dcb3ab4b804a040571fdd61 --- /dev/null +++ b/codenet/public_test_cases/p03750/input.0.txt @@ -0,0 +1,9 @@ +3 +4 1 +5 3 +3 1 +1 2 3 4 +3 +5 4 +4 3 +2 3 diff --git a/codenet/public_test_cases/p03750/input.1.txt b/codenet/public_test_cases/p03750/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a76bfae09e3940ea16c7ea00fb37eb6c124d827f --- /dev/null +++ b/codenet/public_test_cases/p03750/input.1.txt @@ -0,0 +1,15 @@ +5 +7 1 +9 7 +13 13 +11 8 +12 9 +16 7 8 6 9 11 +7 +6 11 +7 10 +9 3 +12 9 +18 16 +8 9 +10 15 diff --git a/codenet/public_test_cases/p03750/input.2.txt b/codenet/public_test_cases/p03750/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..86bcdfcdaf30b882dd0c405ce30fa32d2b5c3178 --- /dev/null +++ b/codenet/public_test_cases/p03750/input.2.txt @@ -0,0 +1,23 @@ +9 +89 67 +37 14 +6 1 +42 25 +61 22 +23 1 +63 60 +93 62 +14 2 +67 96 26 17 1 62 56 92 13 38 +11 +93 97 +17 93 +61 57 +88 62 +98 29 +49 1 +5 1 +1 77 +34 1 +63 27 +22 66 diff --git a/codenet/public_test_cases/p03750/input.3.txt b/codenet/public_test_cases/p03750/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d0f8b175277e4033dcb3ab4b804a040571fdd61 --- /dev/null +++ b/codenet/public_test_cases/p03750/input.3.txt @@ -0,0 +1,9 @@ +3 +4 1 +5 3 +3 1 +1 2 3 4 +3 +5 4 +4 3 +2 3 diff --git a/codenet/public_test_cases/p03750/output.0.txt b/codenet/public_test_cases/p03750/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4539bbf2d22d5c3b4227859ff854eda060a687fb --- /dev/null +++ b/codenet/public_test_cases/p03750/output.0.txt @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/codenet/public_test_cases/p03750/output.1.txt b/codenet/public_test_cases/p03750/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3b5c1ce5914d2a2cef9a53756ecb4a2ef0f96af --- /dev/null +++ b/codenet/public_test_cases/p03750/output.1.txt @@ -0,0 +1,7 @@ +4 +3 +3 +1 +-1 +3 +2 diff --git a/codenet/public_test_cases/p03750/output.2.txt b/codenet/public_test_cases/p03750/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f2b4842ec35995b329346db35808a7c40e9a3393 --- /dev/null +++ b/codenet/public_test_cases/p03750/output.2.txt @@ -0,0 +1,11 @@ +7 +9 +8 +7 +7 +9 +9 +10 +9 +7 +9 diff --git a/codenet/public_test_cases/p03750/output.3.txt b/codenet/public_test_cases/p03750/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4539bbf2d22d5c3b4227859ff854eda060a687fb --- /dev/null +++ b/codenet/public_test_cases/p03750/output.3.txt @@ -0,0 +1,3 @@ +0 +1 +2 diff --git a/codenet/public_test_cases/p03751/input.0.txt b/codenet/public_test_cases/p03751/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5527f287d06fad3cd6519f78baeae0b378478af2 --- /dev/null +++ b/codenet/public_test_cases/p03751/input.0.txt @@ -0,0 +1,4 @@ +2 +tourist +petr +e diff --git a/codenet/public_test_cases/p03751/input.1.txt b/codenet/public_test_cases/p03751/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5527f287d06fad3cd6519f78baeae0b378478af2 --- /dev/null +++ b/codenet/public_test_cases/p03751/input.1.txt @@ -0,0 +1,4 @@ +2 +tourist +petr +e diff --git a/codenet/public_test_cases/p03751/output.0.txt b/codenet/public_test_cases/p03751/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03751/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03751/output.1.txt b/codenet/public_test_cases/p03751/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03751/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03752/input.0.txt b/codenet/public_test_cases/p03752/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c178895950f41cbb64b8e4846cbef7534ee437e --- /dev/null +++ b/codenet/public_test_cases/p03752/input.0.txt @@ -0,0 +1,2 @@ +5 5 +3949 3774 3598 3469 3424 diff --git a/codenet/public_test_cases/p03752/input.1.txt b/codenet/public_test_cases/p03752/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c178895950f41cbb64b8e4846cbef7534ee437e --- /dev/null +++ b/codenet/public_test_cases/p03752/input.1.txt @@ -0,0 +1,2 @@ +5 5 +3949 3774 3598 3469 3424 diff --git a/codenet/public_test_cases/p03752/output.0.txt b/codenet/public_test_cases/p03752/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..27600766db2b79929d5ce1d0d0303fca20197f36 --- /dev/null +++ b/codenet/public_test_cases/p03752/output.0.txt @@ -0,0 +1 @@ +1541 diff --git a/codenet/public_test_cases/p03752/output.1.txt b/codenet/public_test_cases/p03752/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..27600766db2b79929d5ce1d0d0303fca20197f36 --- /dev/null +++ b/codenet/public_test_cases/p03752/output.1.txt @@ -0,0 +1 @@ +1541 diff --git a/codenet/public_test_cases/p03753/input.0.txt b/codenet/public_test_cases/p03753/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ab59c7608953d385cfbf47f3dc95216974589f7 --- /dev/null +++ b/codenet/public_test_cases/p03753/input.0.txt @@ -0,0 +1,2 @@ +7 7 3 +1 3 5 diff --git a/codenet/public_test_cases/p03753/input.1.txt b/codenet/public_test_cases/p03753/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..24df371ba1939057559695a3d11a23370d6b5132 --- /dev/null +++ b/codenet/public_test_cases/p03753/input.1.txt @@ -0,0 +1,2 @@ +10 14 8 +5 6 7 8 9 10 11 12 diff --git a/codenet/public_test_cases/p03753/input.2.txt b/codenet/public_test_cases/p03753/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ab59c7608953d385cfbf47f3dc95216974589f7 --- /dev/null +++ b/codenet/public_test_cases/p03753/input.2.txt @@ -0,0 +1,2 @@ +7 7 3 +1 3 5 diff --git a/codenet/public_test_cases/p03753/output.0.txt b/codenet/public_test_cases/p03753/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03753/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03753/output.1.txt b/codenet/public_test_cases/p03753/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03753/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03753/output.2.txt b/codenet/public_test_cases/p03753/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03753/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03754/input.0.txt b/codenet/public_test_cases/p03754/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..913dc828930ae6560976a61bff74724593bfba79 --- /dev/null +++ b/codenet/public_test_cases/p03754/input.0.txt @@ -0,0 +1,4 @@ +4 +1 2 +2 3 +2 4 diff --git a/codenet/public_test_cases/p03754/output.0.txt b/codenet/public_test_cases/p03754/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3c2b005c10d03d5201b1384bd37c07d4d73d202 --- /dev/null +++ b/codenet/public_test_cases/p03754/output.0.txt @@ -0,0 +1,4 @@ +2.0 +1.0 +2.0 +2.0 diff --git a/codenet/public_test_cases/p03755/input.0.txt b/codenet/public_test_cases/p03755/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7672e0e77ff51c1b0e5a552df9ccdd5912f8abb8 --- /dev/null +++ b/codenet/public_test_cases/p03755/input.0.txt @@ -0,0 +1,2 @@ +7 2 3 +0 7 diff --git a/codenet/public_test_cases/p03755/output.0.txt b/codenet/public_test_cases/p03755/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3f407c0955bb5738e40a82664c79b63f04a9adb --- /dev/null +++ b/codenet/public_test_cases/p03755/output.0.txt @@ -0,0 +1 @@ +55 diff --git a/codenet/public_test_cases/p03756/input.0.txt b/codenet/public_test_cases/p03756/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d924da28f6e6abe8850c4c5c5988f78ba26d60d --- /dev/null +++ b/codenet/public_test_cases/p03756/input.0.txt @@ -0,0 +1,4 @@ +4 4 2 2 +1 1 2 2 +1 1 E 1 1 +1 2 E 2 2 diff --git a/codenet/public_test_cases/p03756/output.0.txt b/codenet/public_test_cases/p03756/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03756/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03757/input.0.txt b/codenet/public_test_cases/p03757/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..297a66675f30d49885f2feeda62fda465b02013d --- /dev/null +++ b/codenet/public_test_cases/p03757/input.0.txt @@ -0,0 +1,14 @@ +6 7 +-1 6 +0 5 +0 4 +2 3 +2 2 +1 1 +2 0 1 +1 0 2 1 +2 2 1 +3 3 3 +2 0 3 +3 3 4 +2 1 1 diff --git a/codenet/public_test_cases/p03757/input.1.txt b/codenet/public_test_cases/p03757/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..297a66675f30d49885f2feeda62fda465b02013d --- /dev/null +++ b/codenet/public_test_cases/p03757/input.1.txt @@ -0,0 +1,14 @@ +6 7 +-1 6 +0 5 +0 4 +2 3 +2 2 +1 1 +2 0 1 +1 0 2 1 +2 2 1 +3 3 3 +2 0 3 +3 3 4 +2 1 1 diff --git a/codenet/public_test_cases/p03757/output.0.txt b/codenet/public_test_cases/p03757/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3731fdcb849e90d7519f05584bc14781cf07a304 --- /dev/null +++ b/codenet/public_test_cases/p03757/output.0.txt @@ -0,0 +1,4 @@ +15 +12 +30 +8 diff --git a/codenet/public_test_cases/p03757/output.1.txt b/codenet/public_test_cases/p03757/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3731fdcb849e90d7519f05584bc14781cf07a304 --- /dev/null +++ b/codenet/public_test_cases/p03757/output.1.txt @@ -0,0 +1,4 @@ +15 +12 +30 +8 diff --git a/codenet/public_test_cases/p03759/input.0.txt b/codenet/public_test_cases/p03759/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c94bb7149267de1604826623ceb14500c7acfb23 --- /dev/null +++ b/codenet/public_test_cases/p03759/input.0.txt @@ -0,0 +1 @@ +2 4 6 diff --git a/codenet/public_test_cases/p03759/input.1.txt b/codenet/public_test_cases/p03759/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d9df412c4a61a869745a305412e5bc089a469ef --- /dev/null +++ b/codenet/public_test_cases/p03759/input.1.txt @@ -0,0 +1 @@ +2 5 6 diff --git a/codenet/public_test_cases/p03759/input.2.txt b/codenet/public_test_cases/p03759/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d03090e700f3bac824c9d4299ee554a97e685319 --- /dev/null +++ b/codenet/public_test_cases/p03759/input.2.txt @@ -0,0 +1 @@ +3 2 1 diff --git a/codenet/public_test_cases/p03759/input.3.txt b/codenet/public_test_cases/p03759/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c94bb7149267de1604826623ceb14500c7acfb23 --- /dev/null +++ b/codenet/public_test_cases/p03759/input.3.txt @@ -0,0 +1 @@ +2 4 6 diff --git a/codenet/public_test_cases/p03759/output.0.txt b/codenet/public_test_cases/p03759/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03759/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03759/output.1.txt b/codenet/public_test_cases/p03759/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03759/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03759/output.2.txt b/codenet/public_test_cases/p03759/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03759/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03759/output.3.txt b/codenet/public_test_cases/p03759/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03759/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03760/input.0.txt b/codenet/public_test_cases/p03760/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc404011c75d8d2ca96a18d6c290a701cd9cce0b --- /dev/null +++ b/codenet/public_test_cases/p03760/input.0.txt @@ -0,0 +1,2 @@ +xyz +abc diff --git a/codenet/public_test_cases/p03760/input.1.txt b/codenet/public_test_cases/p03760/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81e5403aee910da71c585c931e116b6a7472b468 --- /dev/null +++ b/codenet/public_test_cases/p03760/input.1.txt @@ -0,0 +1,2 @@ +atcoderbeginnercontest +atcoderregularcontest diff --git a/codenet/public_test_cases/p03760/input.2.txt b/codenet/public_test_cases/p03760/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc404011c75d8d2ca96a18d6c290a701cd9cce0b --- /dev/null +++ b/codenet/public_test_cases/p03760/input.2.txt @@ -0,0 +1,2 @@ +xyz +abc diff --git a/codenet/public_test_cases/p03760/output.0.txt b/codenet/public_test_cases/p03760/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..caba0fa8cf7707a456e897a5474ce4ae7e77630c --- /dev/null +++ b/codenet/public_test_cases/p03760/output.0.txt @@ -0,0 +1 @@ +xaybzc diff --git a/codenet/public_test_cases/p03760/output.1.txt b/codenet/public_test_cases/p03760/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..41d5905be67e3ab91e31eddecf620db724b18ba4 --- /dev/null +++ b/codenet/public_test_cases/p03760/output.1.txt @@ -0,0 +1 @@ +aattccooddeerrbreeggiunlnaerrccoonntteesstt diff --git a/codenet/public_test_cases/p03760/output.2.txt b/codenet/public_test_cases/p03760/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..caba0fa8cf7707a456e897a5474ce4ae7e77630c --- /dev/null +++ b/codenet/public_test_cases/p03760/output.2.txt @@ -0,0 +1 @@ +xaybzc diff --git a/codenet/public_test_cases/p03761/input.0.txt b/codenet/public_test_cases/p03761/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d05cb41794fc3fa557f0a53c150590eedf40a82 --- /dev/null +++ b/codenet/public_test_cases/p03761/input.0.txt @@ -0,0 +1,4 @@ +3 +cbaa +daacc +acacac diff --git a/codenet/public_test_cases/p03761/input.1.txt b/codenet/public_test_cases/p03761/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d05cb41794fc3fa557f0a53c150590eedf40a82 --- /dev/null +++ b/codenet/public_test_cases/p03761/input.1.txt @@ -0,0 +1,4 @@ +3 +cbaa +daacc +acacac diff --git a/codenet/public_test_cases/p03761/input.2.txt b/codenet/public_test_cases/p03761/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e4d48b26b9b387f5f111bc4437629d5e618a4b9 --- /dev/null +++ b/codenet/public_test_cases/p03761/input.2.txt @@ -0,0 +1,4 @@ +3 +a +aa +b diff --git a/codenet/public_test_cases/p03761/output.0.txt b/codenet/public_test_cases/p03761/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbfd75b4a5b0175f4f2561863391c3bd47c53101 --- /dev/null +++ b/codenet/public_test_cases/p03761/output.0.txt @@ -0,0 +1 @@ +aac diff --git a/codenet/public_test_cases/p03761/output.1.txt b/codenet/public_test_cases/p03761/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbfd75b4a5b0175f4f2561863391c3bd47c53101 --- /dev/null +++ b/codenet/public_test_cases/p03761/output.1.txt @@ -0,0 +1 @@ +aac diff --git a/codenet/public_test_cases/p03761/output.2.txt b/codenet/public_test_cases/p03761/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p03761/output.2.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p03762/input.0.txt b/codenet/public_test_cases/p03762/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc0b99d65a95e854cdcd6232e87d6b163b7eca2a --- /dev/null +++ b/codenet/public_test_cases/p03762/input.0.txt @@ -0,0 +1,3 @@ +3 3 +1 3 4 +1 3 6 diff --git a/codenet/public_test_cases/p03762/input.1.txt b/codenet/public_test_cases/p03762/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc0b99d65a95e854cdcd6232e87d6b163b7eca2a --- /dev/null +++ b/codenet/public_test_cases/p03762/input.1.txt @@ -0,0 +1,3 @@ +3 3 +1 3 4 +1 3 6 diff --git a/codenet/public_test_cases/p03762/input.2.txt b/codenet/public_test_cases/p03762/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8c39cae32af401661bc14b1f96e49c7153a5929 --- /dev/null +++ b/codenet/public_test_cases/p03762/input.2.txt @@ -0,0 +1,3 @@ +6 5 +-790013317 -192321079 95834122 418379342 586260100 802780784 +-253230108 193944314 363756450 712662868 735867677 diff --git a/codenet/public_test_cases/p03762/output.0.txt b/codenet/public_test_cases/p03762/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p03762/output.0.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p03762/output.1.txt b/codenet/public_test_cases/p03762/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p03762/output.1.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p03762/output.2.txt b/codenet/public_test_cases/p03762/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1501f739081d5afcb06e879d73f0561bcd1328a --- /dev/null +++ b/codenet/public_test_cases/p03762/output.2.txt @@ -0,0 +1 @@ +835067060 diff --git a/codenet/public_test_cases/p03763/input.0.txt b/codenet/public_test_cases/p03763/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d05cb41794fc3fa557f0a53c150590eedf40a82 --- /dev/null +++ b/codenet/public_test_cases/p03763/input.0.txt @@ -0,0 +1,4 @@ +3 +cbaa +daacc +acacac diff --git a/codenet/public_test_cases/p03763/output.0.txt b/codenet/public_test_cases/p03763/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbfd75b4a5b0175f4f2561863391c3bd47c53101 --- /dev/null +++ b/codenet/public_test_cases/p03763/output.0.txt @@ -0,0 +1 @@ +aac diff --git a/codenet/public_test_cases/p03764/input.0.txt b/codenet/public_test_cases/p03764/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc0b99d65a95e854cdcd6232e87d6b163b7eca2a --- /dev/null +++ b/codenet/public_test_cases/p03764/input.0.txt @@ -0,0 +1,3 @@ +3 3 +1 3 4 +1 3 6 diff --git a/codenet/public_test_cases/p03764/output.0.txt b/codenet/public_test_cases/p03764/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p03764/output.0.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p03765/input.0.txt b/codenet/public_test_cases/p03765/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e8ff1bfd47605bef2e956cc4cba6a59399ff275 --- /dev/null +++ b/codenet/public_test_cases/p03765/input.0.txt @@ -0,0 +1,7 @@ +BBBAAAABA +BBBBA +4 +7 9 2 5 +7 9 1 4 +1 7 2 5 +1 7 2 4 diff --git a/codenet/public_test_cases/p03765/input.1.txt b/codenet/public_test_cases/p03765/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e77d91d55ee5f8114f49fbfbbe3b362c225e66b --- /dev/null +++ b/codenet/public_test_cases/p03765/input.1.txt @@ -0,0 +1,13 @@ +AAAAABBBBAAABBBBAAAA +BBBBAAABBBBBBAAAAABB +10 +2 15 2 13 +2 13 6 16 +1 13 2 20 +4 20 3 20 +1 18 9 19 +2 14 1 11 +3 20 3 15 +6 16 1 17 +4 18 8 20 +7 20 3 14 diff --git a/codenet/public_test_cases/p03765/input.2.txt b/codenet/public_test_cases/p03765/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e8ff1bfd47605bef2e956cc4cba6a59399ff275 --- /dev/null +++ b/codenet/public_test_cases/p03765/input.2.txt @@ -0,0 +1,7 @@ +BBBAAAABA +BBBBA +4 +7 9 2 5 +7 9 1 4 +1 7 2 5 +1 7 2 4 diff --git a/codenet/public_test_cases/p03765/output.0.txt b/codenet/public_test_cases/p03765/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bc77997d5fbb268f458f0a0d0c4e16bd5a6a25e --- /dev/null +++ b/codenet/public_test_cases/p03765/output.0.txt @@ -0,0 +1,4 @@ +YES +NO +YES +NO diff --git a/codenet/public_test_cases/p03765/output.1.txt b/codenet/public_test_cases/p03765/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6371ca733f2bd6d56ef751468d1b2aeed7970f93 --- /dev/null +++ b/codenet/public_test_cases/p03765/output.1.txt @@ -0,0 +1,10 @@ +YES +YES +YES +YES +YES +YES +NO +NO +NO +NO diff --git a/codenet/public_test_cases/p03765/output.2.txt b/codenet/public_test_cases/p03765/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bc77997d5fbb268f458f0a0d0c4e16bd5a6a25e --- /dev/null +++ b/codenet/public_test_cases/p03765/output.2.txt @@ -0,0 +1,4 @@ +YES +NO +YES +NO diff --git a/codenet/public_test_cases/p03766/input.0.txt b/codenet/public_test_cases/p03766/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03766/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03766/input.1.txt b/codenet/public_test_cases/p03766/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f9e30b6a9aeb8aa0ed59183fa86751d026af4d0 --- /dev/null +++ b/codenet/public_test_cases/p03766/input.1.txt @@ -0,0 +1 @@ +654321 diff --git a/codenet/public_test_cases/p03766/input.2.txt b/codenet/public_test_cases/p03766/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03766/input.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03766/output.0.txt b/codenet/public_test_cases/p03766/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03766/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03766/output.1.txt b/codenet/public_test_cases/p03766/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..486f2c7634b655411a6dbf650a96ed13432f798f --- /dev/null +++ b/codenet/public_test_cases/p03766/output.1.txt @@ -0,0 +1 @@ +968545283 diff --git a/codenet/public_test_cases/p03766/output.2.txt b/codenet/public_test_cases/p03766/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03766/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03767/input.0.txt b/codenet/public_test_cases/p03767/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af50bdad870153a116cd1e0b2d1723d623a3b2cc --- /dev/null +++ b/codenet/public_test_cases/p03767/input.0.txt @@ -0,0 +1,2 @@ +2 +5 2 8 5 1 5 diff --git a/codenet/public_test_cases/p03767/input.1.txt b/codenet/public_test_cases/p03767/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..af50bdad870153a116cd1e0b2d1723d623a3b2cc --- /dev/null +++ b/codenet/public_test_cases/p03767/input.1.txt @@ -0,0 +1,2 @@ +2 +5 2 8 5 1 5 diff --git a/codenet/public_test_cases/p03767/input.2.txt b/codenet/public_test_cases/p03767/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..47fe052f408a201640fa6ace2799acfc59fd5ef7 --- /dev/null +++ b/codenet/public_test_cases/p03767/input.2.txt @@ -0,0 +1,2 @@ +10 +1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 diff --git a/codenet/public_test_cases/p03767/output.0.txt b/codenet/public_test_cases/p03767/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03767/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03767/output.1.txt b/codenet/public_test_cases/p03767/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03767/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03767/output.2.txt b/codenet/public_test_cases/p03767/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa70b89f2419392b9755e77e59b6b93b424cca9a --- /dev/null +++ b/codenet/public_test_cases/p03767/output.2.txt @@ -0,0 +1 @@ +10000000000 diff --git a/codenet/public_test_cases/p03768/input.0.txt b/codenet/public_test_cases/p03768/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..20a5ccc215d2783da5564ba65b5be522a188c94d --- /dev/null +++ b/codenet/public_test_cases/p03768/input.0.txt @@ -0,0 +1,11 @@ +7 7 +1 2 +1 3 +1 4 +4 5 +5 6 +5 7 +2 3 +2 +6 1 1 +1 2 2 diff --git a/codenet/public_test_cases/p03768/input.1.txt b/codenet/public_test_cases/p03768/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58c9d1fed9c8be84ac01c60dba13fd3bcc253fce --- /dev/null +++ b/codenet/public_test_cases/p03768/input.1.txt @@ -0,0 +1,20 @@ +14 10 +1 4 +5 7 +7 11 +4 10 +14 7 +14 3 +6 14 +8 11 +5 13 +8 3 +8 +8 6 2 +9 7 85 +6 9 3 +6 7 5 +10 3 1 +12 9 4 +9 6 6 +8 2 3 diff --git a/codenet/public_test_cases/p03768/input.2.txt b/codenet/public_test_cases/p03768/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..20a5ccc215d2783da5564ba65b5be522a188c94d --- /dev/null +++ b/codenet/public_test_cases/p03768/input.2.txt @@ -0,0 +1,11 @@ +7 7 +1 2 +1 3 +1 4 +4 5 +5 6 +5 7 +2 3 +2 +6 1 1 +1 2 2 diff --git a/codenet/public_test_cases/p03768/output.0.txt b/codenet/public_test_cases/p03768/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d77f91e4274307bde71d099f425fee453ff857e --- /dev/null +++ b/codenet/public_test_cases/p03768/output.0.txt @@ -0,0 +1,7 @@ +2 +2 +2 +2 +2 +1 +0 diff --git a/codenet/public_test_cases/p03768/output.1.txt b/codenet/public_test_cases/p03768/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..87e4b8e1ac88f7edb1681f326684f16a44affd6c --- /dev/null +++ b/codenet/public_test_cases/p03768/output.1.txt @@ -0,0 +1,14 @@ +1 +0 +3 +1 +5 +5 +3 +3 +6 +1 +3 +4 +5 +3 diff --git a/codenet/public_test_cases/p03768/output.2.txt b/codenet/public_test_cases/p03768/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d77f91e4274307bde71d099f425fee453ff857e --- /dev/null +++ b/codenet/public_test_cases/p03768/output.2.txt @@ -0,0 +1,7 @@ +2 +2 +2 +2 +2 +1 +0 diff --git a/codenet/public_test_cases/p03769/input.0.txt b/codenet/public_test_cases/p03769/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03769/input.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03769/input.1.txt b/codenet/public_test_cases/p03769/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03769/input.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03769/input.2.txt b/codenet/public_test_cases/p03769/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..03a5b41d9fe4e87abe23d9efba209933c6d1e30f --- /dev/null +++ b/codenet/public_test_cases/p03769/input.2.txt @@ -0,0 +1 @@ +299 diff --git a/codenet/public_test_cases/p03769/output.0.txt b/codenet/public_test_cases/p03769/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c95aee82892a809ab2db3e2c46a29df093e930e --- /dev/null +++ b/codenet/public_test_cases/p03769/output.0.txt @@ -0,0 +1,2 @@ +4 +1 1 1 1 diff --git a/codenet/public_test_cases/p03769/output.1.txt b/codenet/public_test_cases/p03769/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c95aee82892a809ab2db3e2c46a29df093e930e --- /dev/null +++ b/codenet/public_test_cases/p03769/output.1.txt @@ -0,0 +1,2 @@ +4 +1 1 1 1 diff --git a/codenet/public_test_cases/p03769/output.2.txt b/codenet/public_test_cases/p03769/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..744ffd85ee2f55913f8e186840fba2484ba6b6e6 --- /dev/null +++ b/codenet/public_test_cases/p03769/output.2.txt @@ -0,0 +1,2 @@ +23 +32 11 11 73 45 8 11 83 83 8 45 32 32 10 100 73 32 83 45 73 32 11 10 diff --git a/codenet/public_test_cases/p03770/input.0.txt b/codenet/public_test_cases/p03770/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded6cd420473b8d8393a53a1b18754d80638ae49 --- /dev/null +++ b/codenet/public_test_cases/p03770/input.0.txt @@ -0,0 +1,5 @@ +4 7 3 +3 2 +4 3 +2 1 +4 4 diff --git a/codenet/public_test_cases/p03770/input.1.txt b/codenet/public_test_cases/p03770/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..46b206baeac2eedb49ae7c2aea80920b600f1ab0 --- /dev/null +++ b/codenet/public_test_cases/p03770/input.1.txt @@ -0,0 +1,2 @@ +1 1 1 +1 1 diff --git a/codenet/public_test_cases/p03770/input.2.txt b/codenet/public_test_cases/p03770/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded6cd420473b8d8393a53a1b18754d80638ae49 --- /dev/null +++ b/codenet/public_test_cases/p03770/input.2.txt @@ -0,0 +1,5 @@ +4 7 3 +3 2 +4 3 +2 1 +4 4 diff --git a/codenet/public_test_cases/p03770/input.3.txt b/codenet/public_test_cases/p03770/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8583ac4a898bfc60b692902728df18aeec903028 --- /dev/null +++ b/codenet/public_test_cases/p03770/input.3.txt @@ -0,0 +1,22 @@ +21 77 68 +16 73 +16 99 +19 66 +2 87 +2 16 +7 17 +10 36 +10 68 +2 38 +10 74 +13 55 +21 21 +3 7 +12 41 +13 88 +18 6 +2 12 +13 87 +1 9 +2 27 +13 15 diff --git a/codenet/public_test_cases/p03770/output.0.txt b/codenet/public_test_cases/p03770/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03770/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03770/output.1.txt b/codenet/public_test_cases/p03770/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03770/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03770/output.2.txt b/codenet/public_test_cases/p03770/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03770/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03770/output.3.txt b/codenet/public_test_cases/p03770/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..93b5e76bfd60a7fccebb48061a9f4d2890c9bec0 --- /dev/null +++ b/codenet/public_test_cases/p03770/output.3.txt @@ -0,0 +1 @@ +129729600 diff --git a/codenet/public_test_cases/p03771/input.0.txt b/codenet/public_test_cases/p03771/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d1837c5eea6dd252ab6d9fe6f7767757b9abf4d --- /dev/null +++ b/codenet/public_test_cases/p03771/input.0.txt @@ -0,0 +1,2 @@ +3 2 +1 3 6 diff --git a/codenet/public_test_cases/p03771/input.1.txt b/codenet/public_test_cases/p03771/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..11d5735b449d411dee7b201a04579bb42b24a9cb --- /dev/null +++ b/codenet/public_test_cases/p03771/input.1.txt @@ -0,0 +1,2 @@ +7 2 +-10 -4 -2 0 2 4 10 diff --git a/codenet/public_test_cases/p03771/input.2.txt b/codenet/public_test_cases/p03771/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..69a8168aefa7ca0fa413d9bf78ff068effc36f70 --- /dev/null +++ b/codenet/public_test_cases/p03771/input.2.txt @@ -0,0 +1,2 @@ +16 19 +-49 -48 -33 -30 -21 -14 0 15 19 23 44 52 80 81 82 84 diff --git a/codenet/public_test_cases/p03771/input.3.txt b/codenet/public_test_cases/p03771/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d1837c5eea6dd252ab6d9fe6f7767757b9abf4d --- /dev/null +++ b/codenet/public_test_cases/p03771/input.3.txt @@ -0,0 +1,2 @@ +3 2 +1 3 6 diff --git a/codenet/public_test_cases/p03771/output.0.txt b/codenet/public_test_cases/p03771/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3550184703552470d008afafafbf44a8e8df5abb --- /dev/null +++ b/codenet/public_test_cases/p03771/output.0.txt @@ -0,0 +1,3 @@ +Possible +Possible +Possible diff --git a/codenet/public_test_cases/p03771/output.1.txt b/codenet/public_test_cases/p03771/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..51595f8a26f73f2fc3407660764d981f1ed25333 --- /dev/null +++ b/codenet/public_test_cases/p03771/output.1.txt @@ -0,0 +1,7 @@ +Impossible +Possible +Possible +Possible +Possible +Possible +Impossible diff --git a/codenet/public_test_cases/p03771/output.2.txt b/codenet/public_test_cases/p03771/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..75193e0d251fc19aef4cd98fd7ba59829beea0d8 --- /dev/null +++ b/codenet/public_test_cases/p03771/output.2.txt @@ -0,0 +1,16 @@ +Possible +Possible +Possible +Possible +Possible +Possible +Possible +Possible +Possible +Possible +Possible +Possible +Impossible +Impossible +Impossible +Impossible diff --git a/codenet/public_test_cases/p03771/output.3.txt b/codenet/public_test_cases/p03771/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3550184703552470d008afafafbf44a8e8df5abb --- /dev/null +++ b/codenet/public_test_cases/p03771/output.3.txt @@ -0,0 +1,3 @@ +Possible +Possible +Possible diff --git a/codenet/public_test_cases/p03772/input.0.txt b/codenet/public_test_cases/p03772/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8f5ba43ed3115d9d079dab2be8bcc10bc5e843d --- /dev/null +++ b/codenet/public_test_cases/p03772/input.0.txt @@ -0,0 +1,2 @@ +2 +1 3 2 diff --git a/codenet/public_test_cases/p03772/input.1.txt b/codenet/public_test_cases/p03772/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..446a35f64712c77c955b63c7c179c8473ad20f6f --- /dev/null +++ b/codenet/public_test_cases/p03772/input.1.txt @@ -0,0 +1,2 @@ +4 +1 3 2 3 2 4 3 diff --git a/codenet/public_test_cases/p03772/input.2.txt b/codenet/public_test_cases/p03772/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cdcb367ac3cd39938bdaac3d2cd1efd09ca8763 --- /dev/null +++ b/codenet/public_test_cases/p03772/input.2.txt @@ -0,0 +1,2 @@ +15 +1 5 9 11 1 19 17 18 20 1 14 3 3 8 19 15 16 29 10 2 4 13 6 12 7 15 16 1 1 diff --git a/codenet/public_test_cases/p03772/input.3.txt b/codenet/public_test_cases/p03772/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8f5ba43ed3115d9d079dab2be8bcc10bc5e843d --- /dev/null +++ b/codenet/public_test_cases/p03772/input.3.txt @@ -0,0 +1,2 @@ +2 +1 3 2 diff --git a/codenet/public_test_cases/p03772/output.0.txt b/codenet/public_test_cases/p03772/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03772/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03772/output.1.txt b/codenet/public_test_cases/p03772/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03772/output.1.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03772/output.2.txt b/codenet/public_test_cases/p03772/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d495e186910faead49939c0176af44108f512c1a --- /dev/null +++ b/codenet/public_test_cases/p03772/output.2.txt @@ -0,0 +1 @@ +911828634 diff --git a/codenet/public_test_cases/p03772/output.3.txt b/codenet/public_test_cases/p03772/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03772/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03773/input.0.txt b/codenet/public_test_cases/p03773/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bc09f8637b346ba4e57e897cc73df4e0886e14e --- /dev/null +++ b/codenet/public_test_cases/p03773/input.0.txt @@ -0,0 +1 @@ +9 12 diff --git a/codenet/public_test_cases/p03773/input.1.txt b/codenet/public_test_cases/p03773/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bc09f8637b346ba4e57e897cc73df4e0886e14e --- /dev/null +++ b/codenet/public_test_cases/p03773/input.1.txt @@ -0,0 +1 @@ +9 12 diff --git a/codenet/public_test_cases/p03773/input.2.txt b/codenet/public_test_cases/p03773/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7541665a56c89b6205bfc2e6f314fca15a0ab2f9 --- /dev/null +++ b/codenet/public_test_cases/p03773/input.2.txt @@ -0,0 +1 @@ +19 0 diff --git a/codenet/public_test_cases/p03773/input.3.txt b/codenet/public_test_cases/p03773/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45d317f7c763bcc2474448abba65466a28a8b46e --- /dev/null +++ b/codenet/public_test_cases/p03773/input.3.txt @@ -0,0 +1 @@ +23 2 diff --git a/codenet/public_test_cases/p03773/output.0.txt b/codenet/public_test_cases/p03773/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03773/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03773/output.1.txt b/codenet/public_test_cases/p03773/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03773/output.1.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03773/output.2.txt b/codenet/public_test_cases/p03773/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p03773/output.2.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p03773/output.3.txt b/codenet/public_test_cases/p03773/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03773/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03774/input.0.txt b/codenet/public_test_cases/p03774/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c43659a792a49946e6db081f0d90bb9e24eb7317 --- /dev/null +++ b/codenet/public_test_cases/p03774/input.0.txt @@ -0,0 +1,5 @@ +2 2 +2 0 +0 0 +-1 0 +1 0 diff --git a/codenet/public_test_cases/p03774/input.1.txt b/codenet/public_test_cases/p03774/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..541f6dd451a165174338d0235b8f13476b7e8bc5 --- /dev/null +++ b/codenet/public_test_cases/p03774/input.1.txt @@ -0,0 +1,8 @@ +3 4 +10 10 +-10 -10 +3 3 +1 2 +2 3 +3 5 +3 5 diff --git a/codenet/public_test_cases/p03774/input.2.txt b/codenet/public_test_cases/p03774/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c43659a792a49946e6db081f0d90bb9e24eb7317 --- /dev/null +++ b/codenet/public_test_cases/p03774/input.2.txt @@ -0,0 +1,5 @@ +2 2 +2 0 +0 0 +-1 0 +1 0 diff --git a/codenet/public_test_cases/p03774/input.3.txt b/codenet/public_test_cases/p03774/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..596121ce9775283348fe63220d9f1d28e3566218 --- /dev/null +++ b/codenet/public_test_cases/p03774/input.3.txt @@ -0,0 +1,11 @@ +5 5 +-100000000 -100000000 +-100000000 100000000 +100000000 -100000000 +100000000 100000000 +0 0 +0 0 +100000000 100000000 +100000000 -100000000 +-100000000 100000000 +-100000000 -100000000 diff --git a/codenet/public_test_cases/p03774/output.0.txt b/codenet/public_test_cases/p03774/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p03774/output.0.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p03774/output.1.txt b/codenet/public_test_cases/p03774/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0571a2e15a712887514f5eabbbe731a4b1b70672 --- /dev/null +++ b/codenet/public_test_cases/p03774/output.1.txt @@ -0,0 +1,3 @@ +3 +1 +2 diff --git a/codenet/public_test_cases/p03774/output.2.txt b/codenet/public_test_cases/p03774/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p03774/output.2.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p03774/output.3.txt b/codenet/public_test_cases/p03774/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..86e24d1b4c3fb30080acde6f9c98a24bac0d47c7 --- /dev/null +++ b/codenet/public_test_cases/p03774/output.3.txt @@ -0,0 +1,5 @@ +5 +4 +3 +2 +1 diff --git a/codenet/public_test_cases/p03775/input.0.txt b/codenet/public_test_cases/p03775/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5caff40c4a0ce4ed0dcb3aa983da623641af1b06 --- /dev/null +++ b/codenet/public_test_cases/p03775/input.0.txt @@ -0,0 +1 @@ +10000 diff --git a/codenet/public_test_cases/p03775/input.1.txt b/codenet/public_test_cases/p03775/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48145ccd79e644cbd016a5ef7c0919b535a7ac95 --- /dev/null +++ b/codenet/public_test_cases/p03775/input.1.txt @@ -0,0 +1 @@ +1000003 diff --git a/codenet/public_test_cases/p03775/input.2.txt b/codenet/public_test_cases/p03775/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5caff40c4a0ce4ed0dcb3aa983da623641af1b06 --- /dev/null +++ b/codenet/public_test_cases/p03775/input.2.txt @@ -0,0 +1 @@ +10000 diff --git a/codenet/public_test_cases/p03775/input.3.txt b/codenet/public_test_cases/p03775/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ebc85d26bdfd21e43fb7b0701ce7e1b0bf36aa66 --- /dev/null +++ b/codenet/public_test_cases/p03775/input.3.txt @@ -0,0 +1 @@ +9876543210 diff --git a/codenet/public_test_cases/p03775/output.0.txt b/codenet/public_test_cases/p03775/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03775/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03775/output.1.txt b/codenet/public_test_cases/p03775/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03775/output.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03775/output.2.txt b/codenet/public_test_cases/p03775/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03775/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03775/output.3.txt b/codenet/public_test_cases/p03775/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03775/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03776/input.0.txt b/codenet/public_test_cases/p03776/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7635a5f476390d668bcb9533b30cfb4648a5873b --- /dev/null +++ b/codenet/public_test_cases/p03776/input.0.txt @@ -0,0 +1,2 @@ +5 2 2 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03776/input.1.txt b/codenet/public_test_cases/p03776/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d27e433e2dba4260bc08afcdee38420dc550dbf7 --- /dev/null +++ b/codenet/public_test_cases/p03776/input.1.txt @@ -0,0 +1,2 @@ +4 2 3 +10 20 10 10 diff --git a/codenet/public_test_cases/p03776/input.2.txt b/codenet/public_test_cases/p03776/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db2b367f2fd22b46d06067687c278cea82e5c066 --- /dev/null +++ b/codenet/public_test_cases/p03776/input.2.txt @@ -0,0 +1,2 @@ +5 1 5 +1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996 diff --git a/codenet/public_test_cases/p03776/input.3.txt b/codenet/public_test_cases/p03776/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7635a5f476390d668bcb9533b30cfb4648a5873b --- /dev/null +++ b/codenet/public_test_cases/p03776/input.3.txt @@ -0,0 +1,2 @@ +5 2 2 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03776/output.0.txt b/codenet/public_test_cases/p03776/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4e4c91a03bc03498c80e7d88345efdbb0fd3e1 --- /dev/null +++ b/codenet/public_test_cases/p03776/output.0.txt @@ -0,0 +1,2 @@ +4.500000 +1 diff --git a/codenet/public_test_cases/p03776/output.1.txt b/codenet/public_test_cases/p03776/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4da008e8718c14a6d8fb4b60f9f36a7030431fd --- /dev/null +++ b/codenet/public_test_cases/p03776/output.1.txt @@ -0,0 +1,2 @@ +15.000000 +3 diff --git a/codenet/public_test_cases/p03776/output.2.txt b/codenet/public_test_cases/p03776/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6186621ce07c929e551bc977d94a9212a9dfd4a --- /dev/null +++ b/codenet/public_test_cases/p03776/output.2.txt @@ -0,0 +1,2 @@ +1000000000000000.000000 +1 diff --git a/codenet/public_test_cases/p03776/output.3.txt b/codenet/public_test_cases/p03776/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4e4c91a03bc03498c80e7d88345efdbb0fd3e1 --- /dev/null +++ b/codenet/public_test_cases/p03776/output.3.txt @@ -0,0 +1,2 @@ +4.500000 +1 diff --git a/codenet/public_test_cases/p03777/input.0.txt b/codenet/public_test_cases/p03777/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573250eb98ab56631150e3664fbc794a95098508 --- /dev/null +++ b/codenet/public_test_cases/p03777/input.0.txt @@ -0,0 +1 @@ +H H diff --git a/codenet/public_test_cases/p03777/input.1.txt b/codenet/public_test_cases/p03777/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..286573b1d8e481e859122c7abf82243cec4f37ec --- /dev/null +++ b/codenet/public_test_cases/p03777/input.1.txt @@ -0,0 +1 @@ +D D diff --git a/codenet/public_test_cases/p03777/input.2.txt b/codenet/public_test_cases/p03777/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573250eb98ab56631150e3664fbc794a95098508 --- /dev/null +++ b/codenet/public_test_cases/p03777/input.2.txt @@ -0,0 +1 @@ +H H diff --git a/codenet/public_test_cases/p03777/input.3.txt b/codenet/public_test_cases/p03777/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f10c60b946bdea71dedd1bc24f51db434e8504e --- /dev/null +++ b/codenet/public_test_cases/p03777/input.3.txt @@ -0,0 +1 @@ +D H diff --git a/codenet/public_test_cases/p03777/output.0.txt b/codenet/public_test_cases/p03777/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9edc74f3848050ab04b488787d715349bb9b215 --- /dev/null +++ b/codenet/public_test_cases/p03777/output.0.txt @@ -0,0 +1 @@ +H diff --git a/codenet/public_test_cases/p03777/output.1.txt b/codenet/public_test_cases/p03777/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9edc74f3848050ab04b488787d715349bb9b215 --- /dev/null +++ b/codenet/public_test_cases/p03777/output.1.txt @@ -0,0 +1 @@ +H diff --git a/codenet/public_test_cases/p03777/output.2.txt b/codenet/public_test_cases/p03777/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9edc74f3848050ab04b488787d715349bb9b215 --- /dev/null +++ b/codenet/public_test_cases/p03777/output.2.txt @@ -0,0 +1 @@ +H diff --git a/codenet/public_test_cases/p03777/output.3.txt b/codenet/public_test_cases/p03777/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..178481050188cf00d7d9cd5a11e43ab8fab9294f --- /dev/null +++ b/codenet/public_test_cases/p03777/output.3.txt @@ -0,0 +1 @@ +D diff --git a/codenet/public_test_cases/p03778/input.0.txt b/codenet/public_test_cases/p03778/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b532e558fd1aa7bd7a735352f045bad542b4fbb --- /dev/null +++ b/codenet/public_test_cases/p03778/input.0.txt @@ -0,0 +1 @@ +3 2 6 diff --git a/codenet/public_test_cases/p03778/input.1.txt b/codenet/public_test_cases/p03778/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b532e558fd1aa7bd7a735352f045bad542b4fbb --- /dev/null +++ b/codenet/public_test_cases/p03778/input.1.txt @@ -0,0 +1 @@ +3 2 6 diff --git a/codenet/public_test_cases/p03778/input.2.txt b/codenet/public_test_cases/p03778/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd44576efdb1644f37860091ca301a02d1d8c54d --- /dev/null +++ b/codenet/public_test_cases/p03778/input.2.txt @@ -0,0 +1 @@ +3 1 3 diff --git a/codenet/public_test_cases/p03778/input.3.txt b/codenet/public_test_cases/p03778/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f4d9f12cf4e0313ab8f3bdfd61bbc7a4c52ad9d6 --- /dev/null +++ b/codenet/public_test_cases/p03778/input.3.txt @@ -0,0 +1 @@ +5 10 1 diff --git a/codenet/public_test_cases/p03778/output.0.txt b/codenet/public_test_cases/p03778/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03778/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03778/output.1.txt b/codenet/public_test_cases/p03778/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03778/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03778/output.2.txt b/codenet/public_test_cases/p03778/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03778/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03778/output.3.txt b/codenet/public_test_cases/p03778/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03778/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03779/input.0.txt b/codenet/public_test_cases/p03779/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03779/input.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03779/output.0.txt b/codenet/public_test_cases/p03779/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03779/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03780/input.0.txt b/codenet/public_test_cases/p03780/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2680447d9729a558e2876ecee873986d18b6851f --- /dev/null +++ b/codenet/public_test_cases/p03780/input.0.txt @@ -0,0 +1,2 @@ +3 6 +1 4 3 diff --git a/codenet/public_test_cases/p03780/input.1.txt b/codenet/public_test_cases/p03780/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1ce3ccedf3278a141c9477cb5fe1029a3d9d7726 --- /dev/null +++ b/codenet/public_test_cases/p03780/input.1.txt @@ -0,0 +1,2 @@ +5 400 +3 1 4 1 5 diff --git a/codenet/public_test_cases/p03780/input.2.txt b/codenet/public_test_cases/p03780/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2680447d9729a558e2876ecee873986d18b6851f --- /dev/null +++ b/codenet/public_test_cases/p03780/input.2.txt @@ -0,0 +1,2 @@ +3 6 +1 4 3 diff --git a/codenet/public_test_cases/p03780/input.3.txt b/codenet/public_test_cases/p03780/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1e1d6df6cecef66037935bbc664899438eb1e83 --- /dev/null +++ b/codenet/public_test_cases/p03780/input.3.txt @@ -0,0 +1,2 @@ +6 20 +10 4 3 10 25 2 diff --git a/codenet/public_test_cases/p03780/output.0.txt b/codenet/public_test_cases/p03780/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03780/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03780/output.1.txt b/codenet/public_test_cases/p03780/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03780/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03780/output.2.txt b/codenet/public_test_cases/p03780/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03780/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03780/output.3.txt b/codenet/public_test_cases/p03780/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03780/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03781/input.0.txt b/codenet/public_test_cases/p03781/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03781/input.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03781/input.1.txt b/codenet/public_test_cases/p03781/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03781/input.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03781/input.2.txt b/codenet/public_test_cases/p03781/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03781/input.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03781/input.3.txt b/codenet/public_test_cases/p03781/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03781/input.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03781/output.0.txt b/codenet/public_test_cases/p03781/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03781/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03781/output.1.txt b/codenet/public_test_cases/p03781/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03781/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03781/output.2.txt b/codenet/public_test_cases/p03781/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03781/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03781/output.3.txt b/codenet/public_test_cases/p03781/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03781/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03782/input.0.txt b/codenet/public_test_cases/p03782/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2680447d9729a558e2876ecee873986d18b6851f --- /dev/null +++ b/codenet/public_test_cases/p03782/input.0.txt @@ -0,0 +1,2 @@ +3 6 +1 4 3 diff --git a/codenet/public_test_cases/p03782/output.0.txt b/codenet/public_test_cases/p03782/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03782/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03783/input.0.txt b/codenet/public_test_cases/p03783/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..19841dd54fe2120790ae2a4333ffc387842826ed --- /dev/null +++ b/codenet/public_test_cases/p03783/input.0.txt @@ -0,0 +1,4 @@ +3 +1 3 +5 7 +1 3 diff --git a/codenet/public_test_cases/p03783/input.1.txt b/codenet/public_test_cases/p03783/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..95f1190ffe625ea2073d5b87403f66a6afcc03cd --- /dev/null +++ b/codenet/public_test_cases/p03783/input.1.txt @@ -0,0 +1,4 @@ +3 +2 5 +4 6 +1 4 diff --git a/codenet/public_test_cases/p03783/input.2.txt b/codenet/public_test_cases/p03783/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dc24d939208a0461a640ddb48581910ac3a4e67 --- /dev/null +++ b/codenet/public_test_cases/p03783/input.2.txt @@ -0,0 +1,6 @@ +5 +123456 789012 +123 456 +12 345678901 +123456 789012 +1 23 diff --git a/codenet/public_test_cases/p03783/input.3.txt b/codenet/public_test_cases/p03783/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..19841dd54fe2120790ae2a4333ffc387842826ed --- /dev/null +++ b/codenet/public_test_cases/p03783/input.3.txt @@ -0,0 +1,4 @@ +3 +1 3 +5 7 +1 3 diff --git a/codenet/public_test_cases/p03783/input.4.txt b/codenet/public_test_cases/p03783/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..35c4e5b17c19ca5e0a4ded365bdbfdff94822bfd --- /dev/null +++ b/codenet/public_test_cases/p03783/input.4.txt @@ -0,0 +1,2 @@ +1 +1 400 diff --git a/codenet/public_test_cases/p03783/input.5.txt b/codenet/public_test_cases/p03783/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc0f9b450f36d8454a09b82c5904e390510a637c --- /dev/null +++ b/codenet/public_test_cases/p03783/input.5.txt @@ -0,0 +1,6 @@ +5 +999999999 1000000000 +1 2 +314 315 +500000 500001 +999999999 1000000000 diff --git a/codenet/public_test_cases/p03783/output.0.txt b/codenet/public_test_cases/p03783/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03783/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03783/output.1.txt b/codenet/public_test_cases/p03783/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03783/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03783/output.2.txt b/codenet/public_test_cases/p03783/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d62d32ed1f0d948ab996b9924cdfea72d632dcc --- /dev/null +++ b/codenet/public_test_cases/p03783/output.2.txt @@ -0,0 +1 @@ +246433 diff --git a/codenet/public_test_cases/p03783/output.3.txt b/codenet/public_test_cases/p03783/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03783/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03783/output.4.txt b/codenet/public_test_cases/p03783/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03783/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03783/output.5.txt b/codenet/public_test_cases/p03783/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..4864470505a26211fdca807031e7ac64cf895df2 --- /dev/null +++ b/codenet/public_test_cases/p03783/output.5.txt @@ -0,0 +1 @@ +1999999680 diff --git a/codenet/public_test_cases/p03785/input.0.txt b/codenet/public_test_cases/p03785/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8846fba52a441a7a3b9ca8a26255f04b64a4bafa --- /dev/null +++ b/codenet/public_test_cases/p03785/input.0.txt @@ -0,0 +1,6 @@ +5 3 5 +1 +2 +3 +6 +12 diff --git a/codenet/public_test_cases/p03785/input.1.txt b/codenet/public_test_cases/p03785/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8846fba52a441a7a3b9ca8a26255f04b64a4bafa --- /dev/null +++ b/codenet/public_test_cases/p03785/input.1.txt @@ -0,0 +1,6 @@ +5 3 5 +1 +2 +3 +6 +12 diff --git a/codenet/public_test_cases/p03785/input.2.txt b/codenet/public_test_cases/p03785/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6982ce4514ea2cc158cecbb242744f1dd8cc9c2d --- /dev/null +++ b/codenet/public_test_cases/p03785/input.2.txt @@ -0,0 +1,7 @@ +6 3 3 +7 +6 +2 +8 +10 +6 diff --git a/codenet/public_test_cases/p03785/output.0.txt b/codenet/public_test_cases/p03785/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03785/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03785/output.1.txt b/codenet/public_test_cases/p03785/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03785/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03785/output.2.txt b/codenet/public_test_cases/p03785/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03785/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03786/input.0.txt b/codenet/public_test_cases/p03786/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..077743bf22666b8fe7840d1736cb3255c8dd857e --- /dev/null +++ b/codenet/public_test_cases/p03786/input.0.txt @@ -0,0 +1,2 @@ +3 +3 1 4 diff --git a/codenet/public_test_cases/p03786/input.1.txt b/codenet/public_test_cases/p03786/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5798ec63b3d84e04ace9c318af6eee1f3c36507 --- /dev/null +++ b/codenet/public_test_cases/p03786/input.1.txt @@ -0,0 +1,2 @@ +5 +1 1 1 1 1 diff --git a/codenet/public_test_cases/p03786/input.2.txt b/codenet/public_test_cases/p03786/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..077743bf22666b8fe7840d1736cb3255c8dd857e --- /dev/null +++ b/codenet/public_test_cases/p03786/input.2.txt @@ -0,0 +1,2 @@ +3 +3 1 4 diff --git a/codenet/public_test_cases/p03786/input.3.txt b/codenet/public_test_cases/p03786/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..050891e1450d138a944be2b24fa5b8af1c15fe26 --- /dev/null +++ b/codenet/public_test_cases/p03786/input.3.txt @@ -0,0 +1,2 @@ +6 +40 1 30 2 7 20 diff --git a/codenet/public_test_cases/p03786/output.0.txt b/codenet/public_test_cases/p03786/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03786/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03786/output.1.txt b/codenet/public_test_cases/p03786/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03786/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03786/output.2.txt b/codenet/public_test_cases/p03786/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03786/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03786/output.3.txt b/codenet/public_test_cases/p03786/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03786/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03787/input.0.txt b/codenet/public_test_cases/p03787/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fa34b26edbf5a028e89c0ad87b196b184ac114a --- /dev/null +++ b/codenet/public_test_cases/p03787/input.0.txt @@ -0,0 +1,2 @@ +3 1 +1 2 diff --git a/codenet/public_test_cases/p03787/input.1.txt b/codenet/public_test_cases/p03787/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d8fd32b427646dc2d767b16411e2bb2e7a25005b --- /dev/null +++ b/codenet/public_test_cases/p03787/input.1.txt @@ -0,0 +1,6 @@ +7 5 +1 2 +3 4 +3 5 +4 5 +2 6 diff --git a/codenet/public_test_cases/p03787/input.2.txt b/codenet/public_test_cases/p03787/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fa34b26edbf5a028e89c0ad87b196b184ac114a --- /dev/null +++ b/codenet/public_test_cases/p03787/input.2.txt @@ -0,0 +1,2 @@ +3 1 +1 2 diff --git a/codenet/public_test_cases/p03787/output.0.txt b/codenet/public_test_cases/p03787/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03787/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03787/output.1.txt b/codenet/public_test_cases/p03787/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03787/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03787/output.2.txt b/codenet/public_test_cases/p03787/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03787/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03788/input.0.txt b/codenet/public_test_cases/p03788/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..912dd04723cbbc6f7e730200d5ce47ded9ec84ab --- /dev/null +++ b/codenet/public_test_cases/p03788/input.0.txt @@ -0,0 +1,2 @@ +5 1 +ABAAA diff --git a/codenet/public_test_cases/p03788/input.1.txt b/codenet/public_test_cases/p03788/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d40847d5841930df385ffb02ab1bb4a33807c583 --- /dev/null +++ b/codenet/public_test_cases/p03788/input.1.txt @@ -0,0 +1,2 @@ +5 2 +ABAAA diff --git a/codenet/public_test_cases/p03788/input.2.txt b/codenet/public_test_cases/p03788/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..912dd04723cbbc6f7e730200d5ce47ded9ec84ab --- /dev/null +++ b/codenet/public_test_cases/p03788/input.2.txt @@ -0,0 +1,2 @@ +5 1 +ABAAA diff --git a/codenet/public_test_cases/p03788/input.3.txt b/codenet/public_test_cases/p03788/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..64397fec342a12c6eda5edebd88d89909ffb9a63 --- /dev/null +++ b/codenet/public_test_cases/p03788/input.3.txt @@ -0,0 +1,2 @@ +4 123456789 +AABB diff --git a/codenet/public_test_cases/p03788/output.0.txt b/codenet/public_test_cases/p03788/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f4305f07d40098e304f184b413acfa1d7283a5a --- /dev/null +++ b/codenet/public_test_cases/p03788/output.0.txt @@ -0,0 +1 @@ +BBAAA diff --git a/codenet/public_test_cases/p03788/output.1.txt b/codenet/public_test_cases/p03788/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..647c66bcde44c7648d4bbb15e42ac413e6d43e20 --- /dev/null +++ b/codenet/public_test_cases/p03788/output.1.txt @@ -0,0 +1 @@ +ABBBA diff --git a/codenet/public_test_cases/p03788/output.2.txt b/codenet/public_test_cases/p03788/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f4305f07d40098e304f184b413acfa1d7283a5a --- /dev/null +++ b/codenet/public_test_cases/p03788/output.2.txt @@ -0,0 +1 @@ +BBAAA diff --git a/codenet/public_test_cases/p03788/output.3.txt b/codenet/public_test_cases/p03788/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..142636566ed873a71861cb8d79f6935f6cdeb36b --- /dev/null +++ b/codenet/public_test_cases/p03788/output.3.txt @@ -0,0 +1 @@ +BABA diff --git a/codenet/public_test_cases/p03789/input.0.txt b/codenet/public_test_cases/p03789/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p03789/input.0.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p03789/input.1.txt b/codenet/public_test_cases/p03789/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..28d14454c380441fa2b6f562072a1cd641c06e22 --- /dev/null +++ b/codenet/public_test_cases/p03789/input.1.txt @@ -0,0 +1 @@ +123456789 diff --git a/codenet/public_test_cases/p03789/input.2.txt b/codenet/public_test_cases/p03789/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15a2cc44e31b14c65264271b81072e5ba0e1634 --- /dev/null +++ b/codenet/public_test_cases/p03789/input.2.txt @@ -0,0 +1 @@ +80 diff --git a/codenet/public_test_cases/p03789/input.3.txt b/codenet/public_test_cases/p03789/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce348cd58e19f3ec286ad17a64ba6bd439d0de68 --- /dev/null +++ b/codenet/public_test_cases/p03789/input.3.txt @@ -0,0 +1 @@ +7204647845201772120166980358816078279571541735614841625060678056933503 diff --git a/codenet/public_test_cases/p03789/input.4.txt b/codenet/public_test_cases/p03789/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f106e0dda37c9ebb3b713a828a0e5196e2b22b26 --- /dev/null +++ b/codenet/public_test_cases/p03789/input.4.txt @@ -0,0 +1 @@ +20170312 diff --git a/codenet/public_test_cases/p03789/output.0.txt b/codenet/public_test_cases/p03789/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03789/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03789/output.1.txt b/codenet/public_test_cases/p03789/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03789/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03789/output.2.txt b/codenet/public_test_cases/p03789/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03789/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03789/output.3.txt b/codenet/public_test_cases/p03789/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e85087affded170efcbc6f9672a6fc671d839ed0 --- /dev/null +++ b/codenet/public_test_cases/p03789/output.3.txt @@ -0,0 +1 @@ +31 diff --git a/codenet/public_test_cases/p03789/output.4.txt b/codenet/public_test_cases/p03789/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03789/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03790/input.0.txt b/codenet/public_test_cases/p03790/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cff04cf86cfb14435ff2767ff30bff9fe3f0934 --- /dev/null +++ b/codenet/public_test_cases/p03790/input.0.txt @@ -0,0 +1,4 @@ +3 10 +4 1 +3 1 +4 1 diff --git a/codenet/public_test_cases/p03790/input.1.txt b/codenet/public_test_cases/p03790/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7cff04cf86cfb14435ff2767ff30bff9fe3f0934 --- /dev/null +++ b/codenet/public_test_cases/p03790/input.1.txt @@ -0,0 +1,4 @@ +3 10 +4 1 +3 1 +4 1 diff --git a/codenet/public_test_cases/p03790/input.2.txt b/codenet/public_test_cases/p03790/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..90f1d693020b0c210d2fd9c605111bc911f20977 --- /dev/null +++ b/codenet/public_test_cases/p03790/input.2.txt @@ -0,0 +1,7 @@ +6 4 +1 1 +1 1 +1 1 +1 1 +1 1 +1 1 diff --git a/codenet/public_test_cases/p03790/input.3.txt b/codenet/public_test_cases/p03790/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3de53c40176941ee5a28c798bc8ed7209d3939d --- /dev/null +++ b/codenet/public_test_cases/p03790/input.3.txt @@ -0,0 +1,21 @@ +20 987654321 +129662684 2 +162021979 1 +458437539 1 +319670097 2 +202863355 1 +112218745 1 +348732033 1 +323036578 1 +382398703 1 +55854389 1 +283445191 1 +151300613 1 +693338042 2 +191178308 2 +386707193 1 +204580036 1 +335134457 1 +122253639 1 +824646518 2 +902554792 2 diff --git a/codenet/public_test_cases/p03790/input.4.txt b/codenet/public_test_cases/p03790/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..9642cc7261771488c236c2be3ff1fdde4fb11cba --- /dev/null +++ b/codenet/public_test_cases/p03790/input.4.txt @@ -0,0 +1,2 @@ +1 10 +10 1 diff --git a/codenet/public_test_cases/p03790/output.0.txt b/codenet/public_test_cases/p03790/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p03790/output.0.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p03790/output.1.txt b/codenet/public_test_cases/p03790/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p03790/output.1.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p03790/output.2.txt b/codenet/public_test_cases/p03790/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03790/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03790/output.3.txt b/codenet/public_test_cases/p03790/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2c0faf0296cb3d76b151f31fe3b635541847860 --- /dev/null +++ b/codenet/public_test_cases/p03790/output.3.txt @@ -0,0 +1 @@ +14829091348 diff --git a/codenet/public_test_cases/p03790/output.4.txt b/codenet/public_test_cases/p03790/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03790/output.4.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03791/input.0.txt b/codenet/public_test_cases/p03791/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03791/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03791/input.1.txt b/codenet/public_test_cases/p03791/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3422d0a09d7da299f80d267c4a523a1774fd4150 --- /dev/null +++ b/codenet/public_test_cases/p03791/input.1.txt @@ -0,0 +1,2 @@ +13 +4 6 8 9 10 12 14 15 16 18 20 21 22 diff --git a/codenet/public_test_cases/p03791/input.2.txt b/codenet/public_test_cases/p03791/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03791/input.2.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03791/input.3.txt b/codenet/public_test_cases/p03791/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..88820dc653221aac1f701c46e60afd7bd3b7f745 --- /dev/null +++ b/codenet/public_test_cases/p03791/input.3.txt @@ -0,0 +1,2 @@ +3 +2 3 4 diff --git a/codenet/public_test_cases/p03791/input.4.txt b/codenet/public_test_cases/p03791/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bd59c0f42aabb8a155b5997e98e757116e1b62d --- /dev/null +++ b/codenet/public_test_cases/p03791/input.4.txt @@ -0,0 +1,2 @@ +8 +1 2 3 5 7 11 13 17 diff --git a/codenet/public_test_cases/p03791/output.0.txt b/codenet/public_test_cases/p03791/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03791/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03791/output.1.txt b/codenet/public_test_cases/p03791/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd1270ff2d2a0ae5d6e717386154b60694b325fc --- /dev/null +++ b/codenet/public_test_cases/p03791/output.1.txt @@ -0,0 +1 @@ +311014372 diff --git a/codenet/public_test_cases/p03791/output.2.txt b/codenet/public_test_cases/p03791/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03791/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03791/output.3.txt b/codenet/public_test_cases/p03791/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03791/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03791/output.4.txt b/codenet/public_test_cases/p03791/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..72058b9dbeda213de0c9d9f3db35fc878371d010 --- /dev/null +++ b/codenet/public_test_cases/p03791/output.4.txt @@ -0,0 +1 @@ +10080 diff --git a/codenet/public_test_cases/p03792/input.0.txt b/codenet/public_test_cases/p03792/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3efa6cec5cd9ad7953275de7392d959fc955d5c9 --- /dev/null +++ b/codenet/public_test_cases/p03792/input.0.txt @@ -0,0 +1,3 @@ +2 +#. +.# diff --git a/codenet/public_test_cases/p03792/input.1.txt b/codenet/public_test_cases/p03792/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..018bb7038a9e3a376f0c961b8e4ba2a9489f7b6c --- /dev/null +++ b/codenet/public_test_cases/p03792/input.1.txt @@ -0,0 +1,3 @@ +2 +.. +.. diff --git a/codenet/public_test_cases/p03792/input.2.txt b/codenet/public_test_cases/p03792/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3efa6cec5cd9ad7953275de7392d959fc955d5c9 --- /dev/null +++ b/codenet/public_test_cases/p03792/input.2.txt @@ -0,0 +1,3 @@ +2 +#. +.# diff --git a/codenet/public_test_cases/p03792/input.3.txt b/codenet/public_test_cases/p03792/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03792/input.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03792/input.4.txt b/codenet/public_test_cases/p03792/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ee0362e63b7cc0bc8e2bcced9a6e596baf7a6bb --- /dev/null +++ b/codenet/public_test_cases/p03792/input.4.txt @@ -0,0 +1,4 @@ +3 +.#. + +.#. diff --git a/codenet/public_test_cases/p03792/input.5.txt b/codenet/public_test_cases/p03792/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9b11d76b0d70946a2438bd66247c25f623d5533 --- /dev/null +++ b/codenet/public_test_cases/p03792/input.5.txt @@ -0,0 +1,4 @@ +3 +... +.#. +... diff --git a/codenet/public_test_cases/p03792/input.6.txt b/codenet/public_test_cases/p03792/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..f04f4e4111ebac4624ed14073653ca0023ae4d72 --- /dev/null +++ b/codenet/public_test_cases/p03792/input.6.txt @@ -0,0 +1,3 @@ +2 +. +.# diff --git a/codenet/public_test_cases/p03792/output.0.txt b/codenet/public_test_cases/p03792/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03792/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03792/output.1.txt b/codenet/public_test_cases/p03792/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03792/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03792/output.2.txt b/codenet/public_test_cases/p03792/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03792/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03792/output.3.txt b/codenet/public_test_cases/p03792/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03792/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03792/output.4.txt b/codenet/public_test_cases/p03792/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03792/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03792/output.5.txt b/codenet/public_test_cases/p03792/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03792/output.5.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03792/output.6.txt b/codenet/public_test_cases/p03792/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03792/output.6.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03793/input.0.txt b/codenet/public_test_cases/p03793/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb95af0d32e8774c8b18890217eba0b52d745df8 --- /dev/null +++ b/codenet/public_test_cases/p03793/input.0.txt @@ -0,0 +1,4 @@ +axxxxza +2 +1 7 +2 6 diff --git a/codenet/public_test_cases/p03793/input.1.txt b/codenet/public_test_cases/p03793/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c0613a1f01b8eb841a5d4c85ddc2964829f6e21 --- /dev/null +++ b/codenet/public_test_cases/p03793/input.1.txt @@ -0,0 +1,3 @@ +aabcdefghijklmnopqrstuvwxyz +1 +1 27 diff --git a/codenet/public_test_cases/p03793/input.2.txt b/codenet/public_test_cases/p03793/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f25105a64a26a6e9145ed39f5505bacaaf5500b --- /dev/null +++ b/codenet/public_test_cases/p03793/input.2.txt @@ -0,0 +1,10 @@ +yzyyyzyzyyyz +8 +1 6 +7 12 +1 12 +6 11 +1 1 +1 3 +4 9 +3 8 diff --git a/codenet/public_test_cases/p03793/input.3.txt b/codenet/public_test_cases/p03793/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb95af0d32e8774c8b18890217eba0b52d745df8 --- /dev/null +++ b/codenet/public_test_cases/p03793/input.3.txt @@ -0,0 +1,4 @@ +axxxxza +2 +1 7 +2 6 diff --git a/codenet/public_test_cases/p03793/output.0.txt b/codenet/public_test_cases/p03793/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6631b22779376d4c1b0470c35390d511ec268e3c --- /dev/null +++ b/codenet/public_test_cases/p03793/output.0.txt @@ -0,0 +1,2 @@ +No +Yes diff --git a/codenet/public_test_cases/p03793/output.1.txt b/codenet/public_test_cases/p03793/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03793/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03793/output.2.txt b/codenet/public_test_cases/p03793/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c01a787a9d7dbe188c70c286482dd5752976295 --- /dev/null +++ b/codenet/public_test_cases/p03793/output.2.txt @@ -0,0 +1,8 @@ +Yes +Yes +Yes +Yes +No +No +No +No diff --git a/codenet/public_test_cases/p03793/output.3.txt b/codenet/public_test_cases/p03793/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6631b22779376d4c1b0470c35390d511ec268e3c --- /dev/null +++ b/codenet/public_test_cases/p03793/output.3.txt @@ -0,0 +1,2 @@ +No +Yes diff --git a/codenet/public_test_cases/p03794/input.0.txt b/codenet/public_test_cases/p03794/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e7e919d9086f19d0faf1800efb363a22b6e6b8 --- /dev/null +++ b/codenet/public_test_cases/p03794/input.0.txt @@ -0,0 +1,4 @@ +4 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p03794/input.1.txt b/codenet/public_test_cases/p03794/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..604c7b32caf077c090d1e568da712399ae45734a --- /dev/null +++ b/codenet/public_test_cases/p03794/input.1.txt @@ -0,0 +1,4 @@ +4 +1 2 +2 3 +3 4 diff --git a/codenet/public_test_cases/p03794/input.2.txt b/codenet/public_test_cases/p03794/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e48098a9f2bd0f5b5b6dcc50f8516a71d8d616bb --- /dev/null +++ b/codenet/public_test_cases/p03794/input.2.txt @@ -0,0 +1,10 @@ +10 +2 4 +2 5 +8 3 +10 7 +1 6 +2 8 +9 5 +8 6 +10 6 diff --git a/codenet/public_test_cases/p03794/input.3.txt b/codenet/public_test_cases/p03794/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e7e919d9086f19d0faf1800efb363a22b6e6b8 --- /dev/null +++ b/codenet/public_test_cases/p03794/input.3.txt @@ -0,0 +1,4 @@ +4 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p03794/input.4.txt b/codenet/public_test_cases/p03794/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..95dc363f3303a461f15965423249ca1335ca414f --- /dev/null +++ b/codenet/public_test_cases/p03794/input.4.txt @@ -0,0 +1,6 @@ +6 +1 2 +1 3 +1 4 +2 5 +2 6 diff --git a/codenet/public_test_cases/p03794/output.0.txt b/codenet/public_test_cases/p03794/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03794/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03794/output.1.txt b/codenet/public_test_cases/p03794/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03794/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03794/output.2.txt b/codenet/public_test_cases/p03794/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..257e563266b43281b3fbb3632ab67ab0d3f314e9 --- /dev/null +++ b/codenet/public_test_cases/p03794/output.2.txt @@ -0,0 +1 @@ +102 diff --git a/codenet/public_test_cases/p03794/output.3.txt b/codenet/public_test_cases/p03794/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03794/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03794/output.4.txt b/codenet/public_test_cases/p03794/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03794/output.4.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03795/input.0.txt b/codenet/public_test_cases/p03795/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03795/input.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03795/output.0.txt b/codenet/public_test_cases/p03795/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d32ab209573e8cedcbe8bc6672ce982cb3ae38df --- /dev/null +++ b/codenet/public_test_cases/p03795/output.0.txt @@ -0,0 +1 @@ +15800 diff --git a/codenet/public_test_cases/p03796/input.0.txt b/codenet/public_test_cases/p03796/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03796/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03796/input.1.txt b/codenet/public_test_cases/p03796/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7393e847d34d19031ee0ba57df63e4d0ccb4fb2 --- /dev/null +++ b/codenet/public_test_cases/p03796/input.1.txt @@ -0,0 +1 @@ +100000 diff --git a/codenet/public_test_cases/p03796/input.2.txt b/codenet/public_test_cases/p03796/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03796/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03796/input.3.txt b/codenet/public_test_cases/p03796/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03796/input.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03796/output.0.txt b/codenet/public_test_cases/p03796/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03796/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03796/output.1.txt b/codenet/public_test_cases/p03796/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..63225bf03ec1b4650cd1e8ebdb2c6e5854f25e5c --- /dev/null +++ b/codenet/public_test_cases/p03796/output.1.txt @@ -0,0 +1 @@ +457992974 diff --git a/codenet/public_test_cases/p03796/output.2.txt b/codenet/public_test_cases/p03796/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03796/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03796/output.3.txt b/codenet/public_test_cases/p03796/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fbd4a8698fa3e732ab926a391e1c2072da84ddb --- /dev/null +++ b/codenet/public_test_cases/p03796/output.3.txt @@ -0,0 +1 @@ +3628800 diff --git a/codenet/public_test_cases/p03797/input.0.txt b/codenet/public_test_cases/p03797/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32ac9cc4e429950e6787fbe4aa5c9a1e40874ec0 --- /dev/null +++ b/codenet/public_test_cases/p03797/input.0.txt @@ -0,0 +1 @@ +1 6 diff --git a/codenet/public_test_cases/p03797/output.0.txt b/codenet/public_test_cases/p03797/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03797/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03798/input.0.txt b/codenet/public_test_cases/p03798/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc80772f84ec3bef7d433b3420b3426d8d6ccce2 --- /dev/null +++ b/codenet/public_test_cases/p03798/input.0.txt @@ -0,0 +1,2 @@ +6 +ooxoox diff --git a/codenet/public_test_cases/p03798/input.1.txt b/codenet/public_test_cases/p03798/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7649bc66a0286b8ebbea576f737b31193eba1552 --- /dev/null +++ b/codenet/public_test_cases/p03798/input.1.txt @@ -0,0 +1,2 @@ +10 +oxooxoxoox diff --git a/codenet/public_test_cases/p03798/input.2.txt b/codenet/public_test_cases/p03798/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc80772f84ec3bef7d433b3420b3426d8d6ccce2 --- /dev/null +++ b/codenet/public_test_cases/p03798/input.2.txt @@ -0,0 +1,2 @@ +6 +ooxoox diff --git a/codenet/public_test_cases/p03798/input.3.txt b/codenet/public_test_cases/p03798/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..243c60a1d87935c2f778c8c85850999773d920db --- /dev/null +++ b/codenet/public_test_cases/p03798/input.3.txt @@ -0,0 +1,2 @@ +3 +oox diff --git a/codenet/public_test_cases/p03798/output.0.txt b/codenet/public_test_cases/p03798/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab94845345485270eb3882e6cd2e68f5550a8ee3 --- /dev/null +++ b/codenet/public_test_cases/p03798/output.0.txt @@ -0,0 +1 @@ +SSSWWS diff --git a/codenet/public_test_cases/p03798/output.1.txt b/codenet/public_test_cases/p03798/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bdd9ba891c473a1262fc8b769a089b98d21111b --- /dev/null +++ b/codenet/public_test_cases/p03798/output.1.txt @@ -0,0 +1 @@ +SSWWSSSWWS diff --git a/codenet/public_test_cases/p03798/output.2.txt b/codenet/public_test_cases/p03798/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab94845345485270eb3882e6cd2e68f5550a8ee3 --- /dev/null +++ b/codenet/public_test_cases/p03798/output.2.txt @@ -0,0 +1 @@ +SSSWWS diff --git a/codenet/public_test_cases/p03798/output.3.txt b/codenet/public_test_cases/p03798/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03798/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03799/input.0.txt b/codenet/public_test_cases/p03799/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..32ac9cc4e429950e6787fbe4aa5c9a1e40874ec0 --- /dev/null +++ b/codenet/public_test_cases/p03799/input.0.txt @@ -0,0 +1 @@ +1 6 diff --git a/codenet/public_test_cases/p03799/input.1.txt b/codenet/public_test_cases/p03799/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5340a25d656157a0b17082417ba33b02baace299 --- /dev/null +++ b/codenet/public_test_cases/p03799/input.1.txt @@ -0,0 +1 @@ +12345 678901 diff --git a/codenet/public_test_cases/p03799/input.2.txt b/codenet/public_test_cases/p03799/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..32ac9cc4e429950e6787fbe4aa5c9a1e40874ec0 --- /dev/null +++ b/codenet/public_test_cases/p03799/input.2.txt @@ -0,0 +1 @@ +1 6 diff --git a/codenet/public_test_cases/p03799/output.0.txt b/codenet/public_test_cases/p03799/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03799/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03799/output.1.txt b/codenet/public_test_cases/p03799/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9fef2bdd0d0effe9a8ed66e41ac092d8cc7af274 --- /dev/null +++ b/codenet/public_test_cases/p03799/output.1.txt @@ -0,0 +1 @@ +175897 diff --git a/codenet/public_test_cases/p03799/output.2.txt b/codenet/public_test_cases/p03799/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03799/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03800/input.0.txt b/codenet/public_test_cases/p03800/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc80772f84ec3bef7d433b3420b3426d8d6ccce2 --- /dev/null +++ b/codenet/public_test_cases/p03800/input.0.txt @@ -0,0 +1,2 @@ +6 +ooxoox diff --git a/codenet/public_test_cases/p03800/output.0.txt b/codenet/public_test_cases/p03800/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab94845345485270eb3882e6cd2e68f5550a8ee3 --- /dev/null +++ b/codenet/public_test_cases/p03800/output.0.txt @@ -0,0 +1 @@ +SSSWWS diff --git a/codenet/public_test_cases/p03801/input.0.txt b/codenet/public_test_cases/p03801/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p03801/input.0.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p03801/input.1.txt b/codenet/public_test_cases/p03801/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p03801/input.1.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p03801/input.2.txt b/codenet/public_test_cases/p03801/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b72efcb03d48e339bd969467b90a7418df723aa8 --- /dev/null +++ b/codenet/public_test_cases/p03801/input.2.txt @@ -0,0 +1,2 @@ +10 +1 2 1 3 2 4 2 5 8 1 diff --git a/codenet/public_test_cases/p03801/output.0.txt b/codenet/public_test_cases/p03801/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p03801/output.0.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p03801/output.1.txt b/codenet/public_test_cases/p03801/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f1d0ecea5d750ac0e30713a0aee40cdde3b2a52 --- /dev/null +++ b/codenet/public_test_cases/p03801/output.1.txt @@ -0,0 +1,2 @@ +2 +1 diff --git a/codenet/public_test_cases/p03801/output.2.txt b/codenet/public_test_cases/p03801/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc046cf566caafb9515a194e794e242dd1147b24 --- /dev/null +++ b/codenet/public_test_cases/p03801/output.2.txt @@ -0,0 +1,10 @@ +10 +7 +0 +4 +0 +3 +0 +2 +3 +0 diff --git a/codenet/public_test_cases/p03802/input.0.txt b/codenet/public_test_cases/p03802/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb8ed04a3249bd4a35a7642d528c202939ce9405 --- /dev/null +++ b/codenet/public_test_cases/p03802/input.0.txt @@ -0,0 +1,4 @@ +3 +1 3 +2 5 +1 9 diff --git a/codenet/public_test_cases/p03802/input.1.txt b/codenet/public_test_cases/p03802/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1aa00dffc8f541802094b892dd2783838a46caea --- /dev/null +++ b/codenet/public_test_cases/p03802/input.1.txt @@ -0,0 +1,6 @@ +5 +2 2 +2 2 +2 2 +2 2 +2 2 diff --git a/codenet/public_test_cases/p03802/input.2.txt b/codenet/public_test_cases/p03802/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb8ed04a3249bd4a35a7642d528c202939ce9405 --- /dev/null +++ b/codenet/public_test_cases/p03802/input.2.txt @@ -0,0 +1,4 @@ +3 +1 3 +2 5 +1 9 diff --git a/codenet/public_test_cases/p03802/input.3.txt b/codenet/public_test_cases/p03802/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..379b01e084c954633d01c2de051141700496f06e --- /dev/null +++ b/codenet/public_test_cases/p03802/input.3.txt @@ -0,0 +1,23 @@ +22 +93 6440 +78 6647 +862 11 +8306 9689 +798 99 +801 521 +188 206 +6079 971 +4559 209 +50 94 +92 6270 +5403 560 +803 83 +1855 99 +42 504 +75 484 +629 11 +92 122 +3359 37 +28 16 +648 14 +11 269 diff --git a/codenet/public_test_cases/p03802/output.0.txt b/codenet/public_test_cases/p03802/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03802/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03802/output.1.txt b/codenet/public_test_cases/p03802/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03802/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03802/output.2.txt b/codenet/public_test_cases/p03802/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03802/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03802/output.3.txt b/codenet/public_test_cases/p03802/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p03802/output.3.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p03803/input.0.txt b/codenet/public_test_cases/p03803/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..25bf1347ee5411deaaf3532637d6568e29bdb7b6 --- /dev/null +++ b/codenet/public_test_cases/p03803/input.0.txt @@ -0,0 +1 @@ +8 6 diff --git a/codenet/public_test_cases/p03803/input.1.txt b/codenet/public_test_cases/p03803/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..25bf1347ee5411deaaf3532637d6568e29bdb7b6 --- /dev/null +++ b/codenet/public_test_cases/p03803/input.1.txt @@ -0,0 +1 @@ +8 6 diff --git a/codenet/public_test_cases/p03803/input.2.txt b/codenet/public_test_cases/p03803/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fb73a07ec2d7b737fbb6c160ff8bc78dadb6930 --- /dev/null +++ b/codenet/public_test_cases/p03803/input.2.txt @@ -0,0 +1 @@ +1 1 diff --git a/codenet/public_test_cases/p03803/input.3.txt b/codenet/public_test_cases/p03803/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..be6c2bd70d72aa3f3b8b4a4cb46b4eb31ffa7122 --- /dev/null +++ b/codenet/public_test_cases/p03803/input.3.txt @@ -0,0 +1 @@ +13 1 diff --git a/codenet/public_test_cases/p03803/output.0.txt b/codenet/public_test_cases/p03803/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03803/output.0.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03803/output.1.txt b/codenet/public_test_cases/p03803/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..08b64854c096175321a68282c6af3817c89edbdc --- /dev/null +++ b/codenet/public_test_cases/p03803/output.1.txt @@ -0,0 +1 @@ +Alice diff --git a/codenet/public_test_cases/p03803/output.2.txt b/codenet/public_test_cases/p03803/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e3aa57d754e218f35f415900ed803f94c09b3df --- /dev/null +++ b/codenet/public_test_cases/p03803/output.2.txt @@ -0,0 +1 @@ +Draw diff --git a/codenet/public_test_cases/p03803/output.3.txt b/codenet/public_test_cases/p03803/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e9edc911f9ca0d09afabec830edf23a30a7044 --- /dev/null +++ b/codenet/public_test_cases/p03803/output.3.txt @@ -0,0 +1 @@ +Bob diff --git a/codenet/public_test_cases/p03804/input.0.txt b/codenet/public_test_cases/p03804/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a6d44a8a120d7a520c89aae717cf962cb3622f7 --- /dev/null +++ b/codenet/public_test_cases/p03804/input.0.txt @@ -0,0 +1,6 @@ +3 2 +#.# +.#. +#.# +#. +.# diff --git a/codenet/public_test_cases/p03804/input.1.txt b/codenet/public_test_cases/p03804/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a6d44a8a120d7a520c89aae717cf962cb3622f7 --- /dev/null +++ b/codenet/public_test_cases/p03804/input.1.txt @@ -0,0 +1,6 @@ +3 2 +#.# +.#. +#.# +#. +.# diff --git a/codenet/public_test_cases/p03804/input.2.txt b/codenet/public_test_cases/p03804/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d5f3220b7a76001cb02852be96f0de48b93d44e --- /dev/null +++ b/codenet/public_test_cases/p03804/input.2.txt @@ -0,0 +1,5 @@ +4 1 +.... +.... +.... +.... diff --git a/codenet/public_test_cases/p03804/input.3.txt b/codenet/public_test_cases/p03804/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c4fbd0c75348c60a8464fa4576a4f651b34e1b8 --- /dev/null +++ b/codenet/public_test_cases/p03804/input.3.txt @@ -0,0 +1,6 @@ +3 2 +.# +.#. +.# +. +.# diff --git a/codenet/public_test_cases/p03804/output.0.txt b/codenet/public_test_cases/p03804/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03804/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03804/output.1.txt b/codenet/public_test_cases/p03804/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03804/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03804/output.2.txt b/codenet/public_test_cases/p03804/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03804/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03804/output.3.txt b/codenet/public_test_cases/p03804/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03804/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03805/input.0.txt b/codenet/public_test_cases/p03805/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc88773658f25592fbc224fa48bd285513c79119 --- /dev/null +++ b/codenet/public_test_cases/p03805/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03805/input.1.txt b/codenet/public_test_cases/p03805/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..052f07af20aa7390e7dda7eed469604a7fcced87 --- /dev/null +++ b/codenet/public_test_cases/p03805/input.1.txt @@ -0,0 +1,8 @@ +7 7 +1 3 +2 7 +3 4 +4 5 +4 6 +5 6 +6 7 diff --git a/codenet/public_test_cases/p03805/input.2.txt b/codenet/public_test_cases/p03805/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc88773658f25592fbc224fa48bd285513c79119 --- /dev/null +++ b/codenet/public_test_cases/p03805/input.2.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +1 3 +2 3 diff --git a/codenet/public_test_cases/p03805/output.0.txt b/codenet/public_test_cases/p03805/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03805/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03805/output.1.txt b/codenet/public_test_cases/p03805/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03805/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03805/output.2.txt b/codenet/public_test_cases/p03805/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03805/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03806/input.0.txt b/codenet/public_test_cases/p03806/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..75ff3ea9dc197e9530e6541f49838e7095386b5b --- /dev/null +++ b/codenet/public_test_cases/p03806/input.0.txt @@ -0,0 +1,4 @@ +3 1 1 +1 2 1 +2 1 2 +3 3 10 diff --git a/codenet/public_test_cases/p03806/input.1.txt b/codenet/public_test_cases/p03806/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a58b4f71c6bca21844261432fcadece86ade4f14 --- /dev/null +++ b/codenet/public_test_cases/p03806/input.1.txt @@ -0,0 +1,2 @@ +1 1 10 +10 10 10 diff --git a/codenet/public_test_cases/p03806/input.2.txt b/codenet/public_test_cases/p03806/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..75ff3ea9dc197e9530e6541f49838e7095386b5b --- /dev/null +++ b/codenet/public_test_cases/p03806/input.2.txt @@ -0,0 +1,4 @@ +3 1 1 +1 2 1 +2 1 2 +3 3 10 diff --git a/codenet/public_test_cases/p03806/output.0.txt b/codenet/public_test_cases/p03806/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03806/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03806/output.1.txt b/codenet/public_test_cases/p03806/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03806/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03806/output.2.txt b/codenet/public_test_cases/p03806/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03806/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03807/input.0.txt b/codenet/public_test_cases/p03807/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03807/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03807/input.1.txt b/codenet/public_test_cases/p03807/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p03807/input.1.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03807/input.2.txt b/codenet/public_test_cases/p03807/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03807/input.2.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03807/output.0.txt b/codenet/public_test_cases/p03807/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03807/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03807/output.1.txt b/codenet/public_test_cases/p03807/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03807/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03807/output.2.txt b/codenet/public_test_cases/p03807/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03807/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03808/input.0.txt b/codenet/public_test_cases/p03808/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..abfa1c28b3970b0d8d77df8a44de1e8872e6a9fb --- /dev/null +++ b/codenet/public_test_cases/p03808/input.0.txt @@ -0,0 +1,2 @@ +5 +4 5 1 2 3 diff --git a/codenet/public_test_cases/p03808/input.1.txt b/codenet/public_test_cases/p03808/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0ebc780dd26aa0fa06ac11c00c419583dce160c --- /dev/null +++ b/codenet/public_test_cases/p03808/input.1.txt @@ -0,0 +1,2 @@ +4 +1 2 3 1 diff --git a/codenet/public_test_cases/p03808/input.2.txt b/codenet/public_test_cases/p03808/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd3e7a6d733d9190a8981ccd1b4d0d2649dbaab7 --- /dev/null +++ b/codenet/public_test_cases/p03808/input.2.txt @@ -0,0 +1,2 @@ +5 +6 9 12 10 8 diff --git a/codenet/public_test_cases/p03808/input.3.txt b/codenet/public_test_cases/p03808/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..abfa1c28b3970b0d8d77df8a44de1e8872e6a9fb --- /dev/null +++ b/codenet/public_test_cases/p03808/input.3.txt @@ -0,0 +1,2 @@ +5 +4 5 1 2 3 diff --git a/codenet/public_test_cases/p03808/output.0.txt b/codenet/public_test_cases/p03808/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03808/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03808/output.1.txt b/codenet/public_test_cases/p03808/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03808/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03808/output.2.txt b/codenet/public_test_cases/p03808/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03808/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03808/output.3.txt b/codenet/public_test_cases/p03808/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03808/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03809/input.0.txt b/codenet/public_test_cases/p03809/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ade5c99d8b017c82759a5005cc201c4ba178484c --- /dev/null +++ b/codenet/public_test_cases/p03809/input.0.txt @@ -0,0 +1,6 @@ +5 +1 2 1 1 2 +2 4 +5 2 +3 2 +1 3 diff --git a/codenet/public_test_cases/p03809/input.1.txt b/codenet/public_test_cases/p03809/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e59cbd81b6b5cec5e46705f66963f3c2a3ab9ceb --- /dev/null +++ b/codenet/public_test_cases/p03809/input.1.txt @@ -0,0 +1,7 @@ +6 +3 2 2 2 2 2 +1 2 +2 3 +1 4 +1 5 +4 6 diff --git a/codenet/public_test_cases/p03809/input.2.txt b/codenet/public_test_cases/p03809/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ade5c99d8b017c82759a5005cc201c4ba178484c --- /dev/null +++ b/codenet/public_test_cases/p03809/input.2.txt @@ -0,0 +1,6 @@ +5 +1 2 1 1 2 +2 4 +5 2 +3 2 +1 3 diff --git a/codenet/public_test_cases/p03809/input.3.txt b/codenet/public_test_cases/p03809/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..38205e0b9319c256d50c6d19be05f078624e51bf --- /dev/null +++ b/codenet/public_test_cases/p03809/input.3.txt @@ -0,0 +1,4 @@ +3 +1 2 1 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03809/output.0.txt b/codenet/public_test_cases/p03809/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03809/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03809/output.1.txt b/codenet/public_test_cases/p03809/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03809/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03809/output.2.txt b/codenet/public_test_cases/p03809/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03809/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03809/output.3.txt b/codenet/public_test_cases/p03809/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03809/output.3.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03810/input.0.txt b/codenet/public_test_cases/p03810/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..216b4c7f179156d414a09f166a9931721b598cf5 --- /dev/null +++ b/codenet/public_test_cases/p03810/input.0.txt @@ -0,0 +1,2 @@ +3 +3 6 7 diff --git a/codenet/public_test_cases/p03810/input.1.txt b/codenet/public_test_cases/p03810/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..216b4c7f179156d414a09f166a9931721b598cf5 --- /dev/null +++ b/codenet/public_test_cases/p03810/input.1.txt @@ -0,0 +1,2 @@ +3 +3 6 7 diff --git a/codenet/public_test_cases/p03810/input.2.txt b/codenet/public_test_cases/p03810/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fcd4007f47f8446e2d03da988c565e8a99c2bd86 --- /dev/null +++ b/codenet/public_test_cases/p03810/input.2.txt @@ -0,0 +1,2 @@ +4 +1 2 4 8 diff --git a/codenet/public_test_cases/p03810/input.3.txt b/codenet/public_test_cases/p03810/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2dcb0c32309c81a4ab24422f10da771c509c0947 --- /dev/null +++ b/codenet/public_test_cases/p03810/input.3.txt @@ -0,0 +1,2 @@ +5 +7 8 8 8 8 diff --git a/codenet/public_test_cases/p03810/output.0.txt b/codenet/public_test_cases/p03810/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03810/output.0.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03810/output.1.txt b/codenet/public_test_cases/p03810/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03810/output.1.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03810/output.2.txt b/codenet/public_test_cases/p03810/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03810/output.2.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03810/output.3.txt b/codenet/public_test_cases/p03810/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p03810/output.3.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p03811/input.0.txt b/codenet/public_test_cases/p03811/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p03811/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03811/input.1.txt b/codenet/public_test_cases/p03811/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1df2e0620468b317111218135743816ca3eda604 --- /dev/null +++ b/codenet/public_test_cases/p03811/input.1.txt @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/codenet/public_test_cases/p03811/input.2.txt b/codenet/public_test_cases/p03811/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e7844f0340e07a18cc27010c97975502576e5f0 --- /dev/null +++ b/codenet/public_test_cases/p03811/input.2.txt @@ -0,0 +1,2 @@ +4 +2 3 4 6 diff --git a/codenet/public_test_cases/p03811/output.0.txt b/codenet/public_test_cases/p03811/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3b537cd78d2ef1f5a9a9c1bf1027f6a789b4146 --- /dev/null +++ b/codenet/public_test_cases/p03811/output.0.txt @@ -0,0 +1 @@ +5 3 2 4 1 diff --git a/codenet/public_test_cases/p03811/output.1.txt b/codenet/public_test_cases/p03811/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3b537cd78d2ef1f5a9a9c1bf1027f6a789b4146 --- /dev/null +++ b/codenet/public_test_cases/p03811/output.1.txt @@ -0,0 +1 @@ +5 3 2 4 1 diff --git a/codenet/public_test_cases/p03811/output.2.txt b/codenet/public_test_cases/p03811/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..17bddc75d8d5af49530deddbe3242bb1fef8acee --- /dev/null +++ b/codenet/public_test_cases/p03811/output.2.txt @@ -0,0 +1 @@ +2 4 6 3 diff --git a/codenet/public_test_cases/p03812/input.0.txt b/codenet/public_test_cases/p03812/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..356a32ff569debbc9616ed0ce12649f4dfa1f84c --- /dev/null +++ b/codenet/public_test_cases/p03812/input.0.txt @@ -0,0 +1,4 @@ +3 +1 2 3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03812/input.1.txt b/codenet/public_test_cases/p03812/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..356a32ff569debbc9616ed0ce12649f4dfa1f84c --- /dev/null +++ b/codenet/public_test_cases/p03812/input.1.txt @@ -0,0 +1,4 @@ +3 +1 2 3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03812/input.2.txt b/codenet/public_test_cases/p03812/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9640487f5fd4e1a08ad27bd7fa8e6043af88299 --- /dev/null +++ b/codenet/public_test_cases/p03812/input.2.txt @@ -0,0 +1,6 @@ +5 +5 4 1 2 3 +1 2 +1 3 +2 4 +2 5 diff --git a/codenet/public_test_cases/p03812/input.3.txt b/codenet/public_test_cases/p03812/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5e734a4337cc4680121a9f33a8b38d38dfd9475 --- /dev/null +++ b/codenet/public_test_cases/p03812/input.3.txt @@ -0,0 +1,4 @@ +3 +1 1 1 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03812/output.0.txt b/codenet/public_test_cases/p03812/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03812/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03812/output.1.txt b/codenet/public_test_cases/p03812/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03812/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03812/output.2.txt b/codenet/public_test_cases/p03812/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d04f961a037117c1eaa69ac60eb363d37ae78d1 --- /dev/null +++ b/codenet/public_test_cases/p03812/output.2.txt @@ -0,0 +1 @@ +1 2 diff --git a/codenet/public_test_cases/p03812/output.3.txt b/codenet/public_test_cases/p03812/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p03812/output.3.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p03813/input.0.txt b/codenet/public_test_cases/p03813/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b33d238dab9943201aaf267f701e8ea5fc9268 --- /dev/null +++ b/codenet/public_test_cases/p03813/input.0.txt @@ -0,0 +1 @@ +1000 diff --git a/codenet/public_test_cases/p03813/input.1.txt b/codenet/public_test_cases/p03813/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b33d238dab9943201aaf267f701e8ea5fc9268 --- /dev/null +++ b/codenet/public_test_cases/p03813/input.1.txt @@ -0,0 +1 @@ +1000 diff --git a/codenet/public_test_cases/p03813/input.2.txt b/codenet/public_test_cases/p03813/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd1af11bf283704974791862e5f3b3bd5e411aa --- /dev/null +++ b/codenet/public_test_cases/p03813/input.2.txt @@ -0,0 +1 @@ +2000 diff --git a/codenet/public_test_cases/p03813/output.0.txt b/codenet/public_test_cases/p03813/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p03813/output.0.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p03813/output.1.txt b/codenet/public_test_cases/p03813/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p03813/output.1.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p03813/output.2.txt b/codenet/public_test_cases/p03813/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c4fba4f9ae03ed0aeddbb3fe0ff90f5684e90bb --- /dev/null +++ b/codenet/public_test_cases/p03813/output.2.txt @@ -0,0 +1 @@ +ARC diff --git a/codenet/public_test_cases/p03814/input.0.txt b/codenet/public_test_cases/p03814/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bea3a90a6011a5f41ab75fc9e4478c37c6b4c631 --- /dev/null +++ b/codenet/public_test_cases/p03814/input.0.txt @@ -0,0 +1 @@ +QWERTYASDFZXCV diff --git a/codenet/public_test_cases/p03814/input.1.txt b/codenet/public_test_cases/p03814/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a8bde7d7a6ed819f488aba7deb8d0fe3c592486 --- /dev/null +++ b/codenet/public_test_cases/p03814/input.1.txt @@ -0,0 +1 @@ +HASFJGHOGAKZZFEGA diff --git a/codenet/public_test_cases/p03814/input.2.txt b/codenet/public_test_cases/p03814/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..189fc1fb8eaf6a88c3a7a37c2719f75d316552ef --- /dev/null +++ b/codenet/public_test_cases/p03814/input.2.txt @@ -0,0 +1 @@ +ZABCZ diff --git a/codenet/public_test_cases/p03814/input.3.txt b/codenet/public_test_cases/p03814/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bea3a90a6011a5f41ab75fc9e4478c37c6b4c631 --- /dev/null +++ b/codenet/public_test_cases/p03814/input.3.txt @@ -0,0 +1 @@ +QWERTYASDFZXCV diff --git a/codenet/public_test_cases/p03814/output.0.txt b/codenet/public_test_cases/p03814/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03814/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03814/output.1.txt b/codenet/public_test_cases/p03814/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03814/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03814/output.2.txt b/codenet/public_test_cases/p03814/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03814/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03814/output.3.txt b/codenet/public_test_cases/p03814/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03814/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03815/input.0.txt b/codenet/public_test_cases/p03815/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03815/input.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03815/input.1.txt b/codenet/public_test_cases/p03815/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03815/input.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03815/input.2.txt b/codenet/public_test_cases/p03815/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..15bd0a83b3ec19eec24260c40bfbce16fc391375 --- /dev/null +++ b/codenet/public_test_cases/p03815/input.2.txt @@ -0,0 +1 @@ +149696127901 diff --git a/codenet/public_test_cases/p03815/output.0.txt b/codenet/public_test_cases/p03815/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03815/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03815/output.1.txt b/codenet/public_test_cases/p03815/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03815/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03815/output.2.txt b/codenet/public_test_cases/p03815/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..94a0b81f9c8eb98e30194b2906d8cc5bb9500b79 --- /dev/null +++ b/codenet/public_test_cases/p03815/output.2.txt @@ -0,0 +1 @@ +27217477801 diff --git a/codenet/public_test_cases/p03816/input.0.txt b/codenet/public_test_cases/p03816/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e15dcf15767d3e289c2fbbb080fb8a0c7c6b4cad --- /dev/null +++ b/codenet/public_test_cases/p03816/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 1 3 7 diff --git a/codenet/public_test_cases/p03816/input.1.txt b/codenet/public_test_cases/p03816/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e15dcf15767d3e289c2fbbb080fb8a0c7c6b4cad --- /dev/null +++ b/codenet/public_test_cases/p03816/input.1.txt @@ -0,0 +1,2 @@ +5 +1 2 1 3 7 diff --git a/codenet/public_test_cases/p03816/input.2.txt b/codenet/public_test_cases/p03816/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce48eee6e8d4c5b97032f63070486b4c200705fb --- /dev/null +++ b/codenet/public_test_cases/p03816/input.2.txt @@ -0,0 +1,2 @@ +15 +1 3 5 2 1 3 2 8 8 6 2 6 11 1 1 diff --git a/codenet/public_test_cases/p03816/output.0.txt b/codenet/public_test_cases/p03816/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03816/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03816/output.1.txt b/codenet/public_test_cases/p03816/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03816/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03816/output.2.txt b/codenet/public_test_cases/p03816/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03816/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03817/input.0.txt b/codenet/public_test_cases/p03817/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03817/input.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03817/output.0.txt b/codenet/public_test_cases/p03817/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03817/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03818/input.0.txt b/codenet/public_test_cases/p03818/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e15dcf15767d3e289c2fbbb080fb8a0c7c6b4cad --- /dev/null +++ b/codenet/public_test_cases/p03818/input.0.txt @@ -0,0 +1,2 @@ +5 +1 2 1 3 7 diff --git a/codenet/public_test_cases/p03818/output.0.txt b/codenet/public_test_cases/p03818/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03818/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03819/input.0.txt b/codenet/public_test_cases/p03819/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..81dc078edb9905d11622ae49f48fb1d6a504dfac --- /dev/null +++ b/codenet/public_test_cases/p03819/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +3 3 diff --git a/codenet/public_test_cases/p03819/input.1.txt b/codenet/public_test_cases/p03819/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..81dc078edb9905d11622ae49f48fb1d6a504dfac --- /dev/null +++ b/codenet/public_test_cases/p03819/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +3 3 diff --git a/codenet/public_test_cases/p03819/input.2.txt b/codenet/public_test_cases/p03819/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..193c57de0b1cd38ec20766a245b02c7346fc5d0f --- /dev/null +++ b/codenet/public_test_cases/p03819/input.2.txt @@ -0,0 +1,8 @@ +7 9 +1 7 +5 9 +5 7 +5 9 +1 1 +6 8 +3 4 diff --git a/codenet/public_test_cases/p03819/output.0.txt b/codenet/public_test_cases/p03819/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3cb04507b740b492d5c49c55e8ac5dc39be987f --- /dev/null +++ b/codenet/public_test_cases/p03819/output.0.txt @@ -0,0 +1,3 @@ +3 +2 +2 diff --git a/codenet/public_test_cases/p03819/output.1.txt b/codenet/public_test_cases/p03819/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3cb04507b740b492d5c49c55e8ac5dc39be987f --- /dev/null +++ b/codenet/public_test_cases/p03819/output.1.txt @@ -0,0 +1,3 @@ +3 +2 +2 diff --git a/codenet/public_test_cases/p03819/output.2.txt b/codenet/public_test_cases/p03819/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..661d975cbd45c856b42855c8de30a16e6d07149d --- /dev/null +++ b/codenet/public_test_cases/p03819/output.2.txt @@ -0,0 +1,9 @@ +7 +6 +6 +5 +4 +5 +5 +3 +2 diff --git a/codenet/public_test_cases/p03820/input.0.txt b/codenet/public_test_cases/p03820/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03820/input.0.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03820/input.1.txt b/codenet/public_test_cases/p03820/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03820/input.1.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03820/input.2.txt b/codenet/public_test_cases/p03820/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb86a82c765bc3b22eb61b4c1dd47bb6a42664ba --- /dev/null +++ b/codenet/public_test_cases/p03820/input.2.txt @@ -0,0 +1 @@ +2000 1000 diff --git a/codenet/public_test_cases/p03820/input.3.txt b/codenet/public_test_cases/p03820/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cadffb8e8d10ec5f03f54e69e12f802858e17987 --- /dev/null +++ b/codenet/public_test_cases/p03820/input.3.txt @@ -0,0 +1 @@ +17 2 diff --git a/codenet/public_test_cases/p03820/output.0.txt b/codenet/public_test_cases/p03820/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03820/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03820/output.1.txt b/codenet/public_test_cases/p03820/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03820/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03820/output.2.txt b/codenet/public_test_cases/p03820/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..84c68dd763e3e2b93cff03dd3d422aa0c447e0c7 --- /dev/null +++ b/codenet/public_test_cases/p03820/output.2.txt @@ -0,0 +1 @@ +674286644 diff --git a/codenet/public_test_cases/p03820/output.3.txt b/codenet/public_test_cases/p03820/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d14dfebef3a698d7edf184b1e725661d3019ae21 --- /dev/null +++ b/codenet/public_test_cases/p03820/output.3.txt @@ -0,0 +1 @@ +262144 diff --git a/codenet/public_test_cases/p03821/input.0.txt b/codenet/public_test_cases/p03821/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4bd2310285374395ee46e9d82c25c6a51152a039 --- /dev/null +++ b/codenet/public_test_cases/p03821/input.0.txt @@ -0,0 +1,4 @@ +3 +3 5 +2 7 +9 4 diff --git a/codenet/public_test_cases/p03821/input.1.txt b/codenet/public_test_cases/p03821/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb6fd3568cc71fda539a55f3fde8379a39ed5c9f --- /dev/null +++ b/codenet/public_test_cases/p03821/input.1.txt @@ -0,0 +1,8 @@ +7 +3 1 +4 1 +5 9 +2 6 +5 3 +5 8 +9 7 diff --git a/codenet/public_test_cases/p03821/input.2.txt b/codenet/public_test_cases/p03821/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4bd2310285374395ee46e9d82c25c6a51152a039 --- /dev/null +++ b/codenet/public_test_cases/p03821/input.2.txt @@ -0,0 +1,4 @@ +3 +3 5 +2 7 +9 4 diff --git a/codenet/public_test_cases/p03821/output.0.txt b/codenet/public_test_cases/p03821/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03821/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03821/output.1.txt b/codenet/public_test_cases/p03821/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03821/output.1.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03821/output.2.txt b/codenet/public_test_cases/p03821/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03821/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03822/input.0.txt b/codenet/public_test_cases/p03822/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0838f564f6db9592a7f42f6d916f776afacb371f --- /dev/null +++ b/codenet/public_test_cases/p03822/input.0.txt @@ -0,0 +1,5 @@ +5 +1 +1 +2 +4 diff --git a/codenet/public_test_cases/p03822/input.1.txt b/codenet/public_test_cases/p03822/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..82b1c82a77c740058891f68e4b0f0a7856082b42 --- /dev/null +++ b/codenet/public_test_cases/p03822/input.1.txt @@ -0,0 +1,7 @@ +7 +1 +2 +1 +3 +1 +4 diff --git a/codenet/public_test_cases/p03822/input.2.txt b/codenet/public_test_cases/p03822/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..186c1e94f6484e8728038ff0292b46a4d0d0514d --- /dev/null +++ b/codenet/public_test_cases/p03822/input.2.txt @@ -0,0 +1,4 @@ +4 +4 +4 +1 diff --git a/codenet/public_test_cases/p03822/input.3.txt b/codenet/public_test_cases/p03822/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0838f564f6db9592a7f42f6d916f776afacb371f --- /dev/null +++ b/codenet/public_test_cases/p03822/input.3.txt @@ -0,0 +1,5 @@ +5 +1 +1 +2 +4 diff --git a/codenet/public_test_cases/p03822/output.0.txt b/codenet/public_test_cases/p03822/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03822/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03822/output.1.txt b/codenet/public_test_cases/p03822/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03822/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03822/output.2.txt b/codenet/public_test_cases/p03822/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03822/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03822/output.3.txt b/codenet/public_test_cases/p03822/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03822/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03823/input.0.txt b/codenet/public_test_cases/p03823/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbe04094cbfd83f1c5338999462490ebba31a96c --- /dev/null +++ b/codenet/public_test_cases/p03823/input.0.txt @@ -0,0 +1,6 @@ +5 3 7 +1 +3 +6 +9 +12 diff --git a/codenet/public_test_cases/p03823/input.1.txt b/codenet/public_test_cases/p03823/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbe04094cbfd83f1c5338999462490ebba31a96c --- /dev/null +++ b/codenet/public_test_cases/p03823/input.1.txt @@ -0,0 +1,6 @@ +5 3 7 +1 +3 +6 +9 +12 diff --git a/codenet/public_test_cases/p03823/input.2.txt b/codenet/public_test_cases/p03823/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4acd6eaba63ec88bd833d32c75a6897ab02aa9a --- /dev/null +++ b/codenet/public_test_cases/p03823/input.2.txt @@ -0,0 +1,4 @@ +3 3 4 +5 +6 +7 diff --git a/codenet/public_test_cases/p03823/input.3.txt b/codenet/public_test_cases/p03823/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c753ce4a07bb6e10221a5c3b5fd7326c74b0dde2 --- /dev/null +++ b/codenet/public_test_cases/p03823/input.3.txt @@ -0,0 +1,9 @@ +8 2 9 +3 +4 +5 +13 +15 +22 +26 +32 diff --git a/codenet/public_test_cases/p03823/input.4.txt b/codenet/public_test_cases/p03823/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd63aa7e229c037744123ca4fa4da8c18fc76a9d --- /dev/null +++ b/codenet/public_test_cases/p03823/input.4.txt @@ -0,0 +1,8 @@ +7 5 3 +0 +2 +4 +7 +8 +11 +15 diff --git a/codenet/public_test_cases/p03823/output.0.txt b/codenet/public_test_cases/p03823/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03823/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03823/output.1.txt b/codenet/public_test_cases/p03823/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03823/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03823/output.2.txt b/codenet/public_test_cases/p03823/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03823/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03823/output.3.txt b/codenet/public_test_cases/p03823/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03823/output.3.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03823/output.4.txt b/codenet/public_test_cases/p03823/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03823/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03824/input.0.txt b/codenet/public_test_cases/p03824/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01f00984864abf869efeddebb71572dc8662c535 --- /dev/null +++ b/codenet/public_test_cases/p03824/input.0.txt @@ -0,0 +1,7 @@ +7 +1 2 +2 3 +2 4 +4 6 +6 7 +7 5 diff --git a/codenet/public_test_cases/p03824/input.1.txt b/codenet/public_test_cases/p03824/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef740b4a7b874134cd94038acfd624de05f51f4d --- /dev/null +++ b/codenet/public_test_cases/p03824/input.1.txt @@ -0,0 +1,12 @@ +12 +1 2 +2 3 +2 4 +4 5 +5 6 +6 7 +7 8 +5 9 +9 10 +10 11 +11 12 diff --git a/codenet/public_test_cases/p03824/input.2.txt b/codenet/public_test_cases/p03824/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..01f00984864abf869efeddebb71572dc8662c535 --- /dev/null +++ b/codenet/public_test_cases/p03824/input.2.txt @@ -0,0 +1,7 @@ +7 +1 2 +2 3 +2 4 +4 6 +6 7 +7 5 diff --git a/codenet/public_test_cases/p03824/output.0.txt b/codenet/public_test_cases/p03824/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03824/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03824/output.1.txt b/codenet/public_test_cases/p03824/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03824/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03824/output.2.txt b/codenet/public_test_cases/p03824/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03824/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03825/input.0.txt b/codenet/public_test_cases/p03825/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p03825/input.0.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p03825/input.1.txt b/codenet/public_test_cases/p03825/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fc9bc7c08ff3aee2d1ec7caabcb461fa6a72730 --- /dev/null +++ b/codenet/public_test_cases/p03825/input.1.txt @@ -0,0 +1 @@ +2 2 2 diff --git a/codenet/public_test_cases/p03825/input.2.txt b/codenet/public_test_cases/p03825/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8089c073cd289a816777b879b923b3890ba96d0a --- /dev/null +++ b/codenet/public_test_cases/p03825/input.2.txt @@ -0,0 +1 @@ +3 4 3 diff --git a/codenet/public_test_cases/p03825/input.3.txt b/codenet/public_test_cases/p03825/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..933614b46dcd135fe14ed0c8978a7ff73fa07291 --- /dev/null +++ b/codenet/public_test_cases/p03825/input.3.txt @@ -0,0 +1 @@ +150 150 14 diff --git a/codenet/public_test_cases/p03825/output.0.txt b/codenet/public_test_cases/p03825/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03825/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03825/output.1.txt b/codenet/public_test_cases/p03825/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03825/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03825/output.2.txt b/codenet/public_test_cases/p03825/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03825/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03825/output.3.txt b/codenet/public_test_cases/p03825/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f432bc9fce1bb3f91ee083630780a8cb4321f7c3 --- /dev/null +++ b/codenet/public_test_cases/p03825/output.3.txt @@ -0,0 +1 @@ +937426930 diff --git a/codenet/public_test_cases/p03826/input.0.txt b/codenet/public_test_cases/p03826/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..42fc78be573b6deb96423cc7ac3eb75621090c9e --- /dev/null +++ b/codenet/public_test_cases/p03826/input.0.txt @@ -0,0 +1 @@ +3 5 2 7 diff --git a/codenet/public_test_cases/p03826/input.1.txt b/codenet/public_test_cases/p03826/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddd25442873b1a7708854b2f38e045bfa94c63c4 --- /dev/null +++ b/codenet/public_test_cases/p03826/input.1.txt @@ -0,0 +1 @@ +100 600 200 300 diff --git a/codenet/public_test_cases/p03826/input.2.txt b/codenet/public_test_cases/p03826/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..42fc78be573b6deb96423cc7ac3eb75621090c9e --- /dev/null +++ b/codenet/public_test_cases/p03826/input.2.txt @@ -0,0 +1 @@ +3 5 2 7 diff --git a/codenet/public_test_cases/p03826/output.0.txt b/codenet/public_test_cases/p03826/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03826/output.0.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03826/output.1.txt b/codenet/public_test_cases/p03826/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..541b3a18e90c9006fa0e9b52b8b9236d1bca5056 --- /dev/null +++ b/codenet/public_test_cases/p03826/output.1.txt @@ -0,0 +1 @@ +60000 diff --git a/codenet/public_test_cases/p03826/output.2.txt b/codenet/public_test_cases/p03826/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03826/output.2.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03827/input.0.txt b/codenet/public_test_cases/p03827/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6ae927c678ae229610511d223b91a7ab500914c --- /dev/null +++ b/codenet/public_test_cases/p03827/input.0.txt @@ -0,0 +1,2 @@ +5 +IIDID diff --git a/codenet/public_test_cases/p03827/input.1.txt b/codenet/public_test_cases/p03827/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6ae927c678ae229610511d223b91a7ab500914c --- /dev/null +++ b/codenet/public_test_cases/p03827/input.1.txt @@ -0,0 +1,2 @@ +5 +IIDID diff --git a/codenet/public_test_cases/p03827/input.2.txt b/codenet/public_test_cases/p03827/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6793fd1f5df0c46004f8fa48b4528c8b77cbf94d --- /dev/null +++ b/codenet/public_test_cases/p03827/input.2.txt @@ -0,0 +1,2 @@ +7 +DDIDDII diff --git a/codenet/public_test_cases/p03827/output.0.txt b/codenet/public_test_cases/p03827/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03827/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03827/output.1.txt b/codenet/public_test_cases/p03827/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03827/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03827/output.2.txt b/codenet/public_test_cases/p03827/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03827/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03828/input.0.txt b/codenet/public_test_cases/p03828/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03828/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03828/input.1.txt b/codenet/public_test_cases/p03828/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03828/input.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03828/input.2.txt b/codenet/public_test_cases/p03828/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03828/input.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03828/input.3.txt b/codenet/public_test_cases/p03828/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b33d238dab9943201aaf267f701e8ea5fc9268 --- /dev/null +++ b/codenet/public_test_cases/p03828/input.3.txt @@ -0,0 +1 @@ +1000 diff --git a/codenet/public_test_cases/p03828/output.0.txt b/codenet/public_test_cases/p03828/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03828/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03828/output.1.txt b/codenet/public_test_cases/p03828/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..64bb6b746dceaf12b0ba8c08f310b0426babde44 --- /dev/null +++ b/codenet/public_test_cases/p03828/output.1.txt @@ -0,0 +1 @@ +30 diff --git a/codenet/public_test_cases/p03828/output.2.txt b/codenet/public_test_cases/p03828/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03828/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03828/output.3.txt b/codenet/public_test_cases/p03828/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..854c6b736acc80434bc7087a6234710a29d54b4d --- /dev/null +++ b/codenet/public_test_cases/p03828/output.3.txt @@ -0,0 +1 @@ +972926972 diff --git a/codenet/public_test_cases/p03829/input.0.txt b/codenet/public_test_cases/p03829/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec9287fd8f88bded8a6af3a216946ea350f01926 --- /dev/null +++ b/codenet/public_test_cases/p03829/input.0.txt @@ -0,0 +1,2 @@ +4 2 5 +1 2 5 7 diff --git a/codenet/public_test_cases/p03829/input.1.txt b/codenet/public_test_cases/p03829/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..93ebf07b93179b90f580257f1ff43572dfdcff73 --- /dev/null +++ b/codenet/public_test_cases/p03829/input.1.txt @@ -0,0 +1,2 @@ +7 1 100 +40 43 45 105 108 115 124 diff --git a/codenet/public_test_cases/p03829/input.2.txt b/codenet/public_test_cases/p03829/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3984854dc20bbfb203d84099259cc6200d7082e6 --- /dev/null +++ b/codenet/public_test_cases/p03829/input.2.txt @@ -0,0 +1,2 @@ +7 1 2 +24 35 40 68 72 99 103 diff --git a/codenet/public_test_cases/p03829/input.3.txt b/codenet/public_test_cases/p03829/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec9287fd8f88bded8a6af3a216946ea350f01926 --- /dev/null +++ b/codenet/public_test_cases/p03829/input.3.txt @@ -0,0 +1,2 @@ +4 2 5 +1 2 5 7 diff --git a/codenet/public_test_cases/p03829/output.0.txt b/codenet/public_test_cases/p03829/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03829/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03829/output.1.txt b/codenet/public_test_cases/p03829/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..871727de1fd703d0c4aab92017011c373e795b67 --- /dev/null +++ b/codenet/public_test_cases/p03829/output.1.txt @@ -0,0 +1 @@ +84 diff --git a/codenet/public_test_cases/p03829/output.2.txt b/codenet/public_test_cases/p03829/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03829/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03829/output.3.txt b/codenet/public_test_cases/p03829/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03829/output.3.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03830/input.0.txt b/codenet/public_test_cases/p03830/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03830/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03830/output.0.txt b/codenet/public_test_cases/p03830/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03830/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03831/input.0.txt b/codenet/public_test_cases/p03831/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec9287fd8f88bded8a6af3a216946ea350f01926 --- /dev/null +++ b/codenet/public_test_cases/p03831/input.0.txt @@ -0,0 +1,2 @@ +4 2 5 +1 2 5 7 diff --git a/codenet/public_test_cases/p03831/output.0.txt b/codenet/public_test_cases/p03831/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03831/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03832/input.0.txt b/codenet/public_test_cases/p03832/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..511f25706dbec658f9a2c87017ef6a12d23af010 --- /dev/null +++ b/codenet/public_test_cases/p03832/input.0.txt @@ -0,0 +1 @@ +3 1 3 1 2 diff --git a/codenet/public_test_cases/p03832/input.1.txt b/codenet/public_test_cases/p03832/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8597a9ff905883c7720da81f25cc59df8e4c9d15 --- /dev/null +++ b/codenet/public_test_cases/p03832/input.1.txt @@ -0,0 +1 @@ +10 3 4 2 5 diff --git a/codenet/public_test_cases/p03832/input.2.txt b/codenet/public_test_cases/p03832/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8058950bc7373698f7314c71893cb054dc86aa5 --- /dev/null +++ b/codenet/public_test_cases/p03832/input.2.txt @@ -0,0 +1 @@ +7 2 3 1 3 diff --git a/codenet/public_test_cases/p03832/input.3.txt b/codenet/public_test_cases/p03832/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b065a35eb25cd602129788d951a4a24b2b2581d --- /dev/null +++ b/codenet/public_test_cases/p03832/input.3.txt @@ -0,0 +1 @@ +1000 1 1000 1 1000 diff --git a/codenet/public_test_cases/p03832/input.4.txt b/codenet/public_test_cases/p03832/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..511f25706dbec658f9a2c87017ef6a12d23af010 --- /dev/null +++ b/codenet/public_test_cases/p03832/input.4.txt @@ -0,0 +1 @@ +3 1 3 1 2 diff --git a/codenet/public_test_cases/p03832/output.0.txt b/codenet/public_test_cases/p03832/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03832/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03832/output.1.txt b/codenet/public_test_cases/p03832/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03832/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03832/output.2.txt b/codenet/public_test_cases/p03832/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f96ac06721837aa6a644a580c03c76f304e81db0 --- /dev/null +++ b/codenet/public_test_cases/p03832/output.2.txt @@ -0,0 +1 @@ +105 diff --git a/codenet/public_test_cases/p03832/output.3.txt b/codenet/public_test_cases/p03832/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc39aea3d66951242164bae6972e1c63a41f2845 --- /dev/null +++ b/codenet/public_test_cases/p03832/output.3.txt @@ -0,0 +1 @@ +465231251 diff --git a/codenet/public_test_cases/p03832/output.4.txt b/codenet/public_test_cases/p03832/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03832/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03833/input.0.txt b/codenet/public_test_cases/p03833/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..836ceb477616a8e7ee820ce8f89dee4a9c4947a1 --- /dev/null +++ b/codenet/public_test_cases/p03833/input.0.txt @@ -0,0 +1,5 @@ +3 4 +1 4 +2 2 5 1 +1 3 3 2 +2 2 5 1 diff --git a/codenet/public_test_cases/p03833/input.1.txt b/codenet/public_test_cases/p03833/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..836ceb477616a8e7ee820ce8f89dee4a9c4947a1 --- /dev/null +++ b/codenet/public_test_cases/p03833/input.1.txt @@ -0,0 +1,5 @@ +3 4 +1 4 +2 2 5 1 +1 3 3 2 +2 2 5 1 diff --git a/codenet/public_test_cases/p03833/input.2.txt b/codenet/public_test_cases/p03833/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f20f0f62570b075a5f58643975e785ed901dbb9 --- /dev/null +++ b/codenet/public_test_cases/p03833/input.2.txt @@ -0,0 +1,7 @@ +5 3 +1 2 3 4 +10 1 1 +1 1 1 +1 10 1 +1 1 1 +1 1 10 diff --git a/codenet/public_test_cases/p03833/output.0.txt b/codenet/public_test_cases/p03833/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03833/output.0.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03833/output.1.txt b/codenet/public_test_cases/p03833/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03833/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03833/output.2.txt b/codenet/public_test_cases/p03833/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03833/output.2.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03834/input.0.txt b/codenet/public_test_cases/p03834/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d588731d35a7ee695f0c93221fd6b039404eef6 --- /dev/null +++ b/codenet/public_test_cases/p03834/input.0.txt @@ -0,0 +1 @@ +happy,newyear,enjoy diff --git a/codenet/public_test_cases/p03834/input.1.txt b/codenet/public_test_cases/p03834/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afb694cf99032f48d5ecf234bba7eaf28df42e58 --- /dev/null +++ b/codenet/public_test_cases/p03834/input.1.txt @@ -0,0 +1 @@ +haiku,atcoder,tasks diff --git a/codenet/public_test_cases/p03834/input.2.txt b/codenet/public_test_cases/p03834/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5754294aff7cd7d324da46de3a2e237227ef1fc8 --- /dev/null +++ b/codenet/public_test_cases/p03834/input.2.txt @@ -0,0 +1 @@ +abcde,fghihgf,edcba diff --git a/codenet/public_test_cases/p03834/input.3.txt b/codenet/public_test_cases/p03834/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d588731d35a7ee695f0c93221fd6b039404eef6 --- /dev/null +++ b/codenet/public_test_cases/p03834/input.3.txt @@ -0,0 +1 @@ +happy,newyear,enjoy diff --git a/codenet/public_test_cases/p03834/output.0.txt b/codenet/public_test_cases/p03834/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..541eb1f7dee049d70f5354d0f7bed7756b565f44 --- /dev/null +++ b/codenet/public_test_cases/p03834/output.0.txt @@ -0,0 +1 @@ +happy newyear enjoy diff --git a/codenet/public_test_cases/p03834/output.1.txt b/codenet/public_test_cases/p03834/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31e5a9a76a062f0b6309a5a9aa52b6c2abafa651 --- /dev/null +++ b/codenet/public_test_cases/p03834/output.1.txt @@ -0,0 +1 @@ +haiku atcoder tasks diff --git a/codenet/public_test_cases/p03834/output.2.txt b/codenet/public_test_cases/p03834/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..582d223b52f9b0415d665ad79f6308567824adb0 --- /dev/null +++ b/codenet/public_test_cases/p03834/output.2.txt @@ -0,0 +1 @@ +abcde fghihgf edcba diff --git a/codenet/public_test_cases/p03834/output.3.txt b/codenet/public_test_cases/p03834/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..541eb1f7dee049d70f5354d0f7bed7756b565f44 --- /dev/null +++ b/codenet/public_test_cases/p03834/output.3.txt @@ -0,0 +1 @@ +happy newyear enjoy diff --git a/codenet/public_test_cases/p03835/input.0.txt b/codenet/public_test_cases/p03835/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03835/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03835/input.1.txt b/codenet/public_test_cases/p03835/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03835/input.1.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03835/input.2.txt b/codenet/public_test_cases/p03835/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbe3ea5b86370ce67269e77cbecb35dd75efddb5 --- /dev/null +++ b/codenet/public_test_cases/p03835/input.2.txt @@ -0,0 +1 @@ +5 15 diff --git a/codenet/public_test_cases/p03835/output.0.txt b/codenet/public_test_cases/p03835/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03835/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03835/output.1.txt b/codenet/public_test_cases/p03835/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03835/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03835/output.2.txt b/codenet/public_test_cases/p03835/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03835/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03836/input.0.txt b/codenet/public_test_cases/p03836/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4eb9384c376593f1ebc15b8475e38e20ba9e7d82 --- /dev/null +++ b/codenet/public_test_cases/p03836/input.0.txt @@ -0,0 +1 @@ +0 0 1 2 diff --git a/codenet/public_test_cases/p03836/input.1.txt b/codenet/public_test_cases/p03836/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4eb9384c376593f1ebc15b8475e38e20ba9e7d82 --- /dev/null +++ b/codenet/public_test_cases/p03836/input.1.txt @@ -0,0 +1 @@ +0 0 1 2 diff --git a/codenet/public_test_cases/p03836/input.2.txt b/codenet/public_test_cases/p03836/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f17315e57611c7478d7070b1f2c3a5439a880856 --- /dev/null +++ b/codenet/public_test_cases/p03836/input.2.txt @@ -0,0 +1 @@ +-2 -2 1 1 diff --git a/codenet/public_test_cases/p03836/output.0.txt b/codenet/public_test_cases/p03836/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab0a49f8c6e3242c131475b55f1c839f4d8249b1 --- /dev/null +++ b/codenet/public_test_cases/p03836/output.0.txt @@ -0,0 +1 @@ +UURDDLLUUURRDRDDDLLU diff --git a/codenet/public_test_cases/p03836/output.1.txt b/codenet/public_test_cases/p03836/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab0a49f8c6e3242c131475b55f1c839f4d8249b1 --- /dev/null +++ b/codenet/public_test_cases/p03836/output.1.txt @@ -0,0 +1 @@ +UURDDLLUUURRDRDDDLLU diff --git a/codenet/public_test_cases/p03836/output.2.txt b/codenet/public_test_cases/p03836/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..06400727b4414be7bdab999b52b723b11852369c --- /dev/null +++ b/codenet/public_test_cases/p03836/output.2.txt @@ -0,0 +1 @@ +UURRURRDDDLLDLLULUUURRURRDDDLLDL diff --git a/codenet/public_test_cases/p03837/input.0.txt b/codenet/public_test_cases/p03837/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b1c1b6434f5a8cdd1d3fa24ffd4040f47628c82 --- /dev/null +++ b/codenet/public_test_cases/p03837/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 +1 3 1 +2 3 3 diff --git a/codenet/public_test_cases/p03837/input.1.txt b/codenet/public_test_cases/p03837/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b1c1b6434f5a8cdd1d3fa24ffd4040f47628c82 --- /dev/null +++ b/codenet/public_test_cases/p03837/input.1.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 +1 3 1 +2 3 3 diff --git a/codenet/public_test_cases/p03837/input.2.txt b/codenet/public_test_cases/p03837/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f97b6d0a4e33a8a78de03c96e3f5c08bea29277 --- /dev/null +++ b/codenet/public_test_cases/p03837/input.2.txt @@ -0,0 +1,3 @@ +3 2 +1 2 1 +2 3 1 diff --git a/codenet/public_test_cases/p03837/output.0.txt b/codenet/public_test_cases/p03837/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03837/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03837/output.1.txt b/codenet/public_test_cases/p03837/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03837/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03837/output.2.txt b/codenet/public_test_cases/p03837/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03837/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03838/input.0.txt b/codenet/public_test_cases/p03838/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed40cec79baa7d9dbb01e18ad634edd038ad2259 --- /dev/null +++ b/codenet/public_test_cases/p03838/input.0.txt @@ -0,0 +1 @@ +10 20 diff --git a/codenet/public_test_cases/p03838/input.1.txt b/codenet/public_test_cases/p03838/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed40cec79baa7d9dbb01e18ad634edd038ad2259 --- /dev/null +++ b/codenet/public_test_cases/p03838/input.1.txt @@ -0,0 +1 @@ +10 20 diff --git a/codenet/public_test_cases/p03838/input.2.txt b/codenet/public_test_cases/p03838/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..572e9769f78a3ef168e96744987f9c8f8455ec82 --- /dev/null +++ b/codenet/public_test_cases/p03838/input.2.txt @@ -0,0 +1 @@ +-10 -20 diff --git a/codenet/public_test_cases/p03838/input.3.txt b/codenet/public_test_cases/p03838/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d05c00a7cf8b6dd00fb63f6574c7024d54244aed --- /dev/null +++ b/codenet/public_test_cases/p03838/input.3.txt @@ -0,0 +1 @@ +10 -10 diff --git a/codenet/public_test_cases/p03838/output.0.txt b/codenet/public_test_cases/p03838/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03838/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03838/output.1.txt b/codenet/public_test_cases/p03838/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03838/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03838/output.2.txt b/codenet/public_test_cases/p03838/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03838/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03838/output.3.txt b/codenet/public_test_cases/p03838/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03838/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03839/input.0.txt b/codenet/public_test_cases/p03839/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..caea71e089ce6652aaef30824996886b3614582b --- /dev/null +++ b/codenet/public_test_cases/p03839/input.0.txt @@ -0,0 +1,2 @@ +5 3 +-10 10 -10 10 -10 diff --git a/codenet/public_test_cases/p03839/input.1.txt b/codenet/public_test_cases/p03839/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a71e27f5929811314fa3096dd73b55e262b1494 --- /dev/null +++ b/codenet/public_test_cases/p03839/input.1.txt @@ -0,0 +1,2 @@ +10 5 +5 -4 -5 -8 -4 7 2 -4 0 7 diff --git a/codenet/public_test_cases/p03839/input.2.txt b/codenet/public_test_cases/p03839/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b3d1dbe2626314ef18234751d62980157f1580a --- /dev/null +++ b/codenet/public_test_cases/p03839/input.2.txt @@ -0,0 +1,2 @@ +1 1 +-10 diff --git a/codenet/public_test_cases/p03839/input.3.txt b/codenet/public_test_cases/p03839/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..caea71e089ce6652aaef30824996886b3614582b --- /dev/null +++ b/codenet/public_test_cases/p03839/input.3.txt @@ -0,0 +1,2 @@ +5 3 +-10 10 -10 10 -10 diff --git a/codenet/public_test_cases/p03839/input.4.txt b/codenet/public_test_cases/p03839/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..39b6ca23cf2f910551a52f11f0a97c0d398d4788 --- /dev/null +++ b/codenet/public_test_cases/p03839/input.4.txt @@ -0,0 +1,2 @@ +4 2 +10 -10 -10 10 diff --git a/codenet/public_test_cases/p03839/output.0.txt b/codenet/public_test_cases/p03839/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03839/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03839/output.1.txt b/codenet/public_test_cases/p03839/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p03839/output.1.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p03839/output.2.txt b/codenet/public_test_cases/p03839/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03839/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03839/output.3.txt b/codenet/public_test_cases/p03839/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03839/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03839/output.4.txt b/codenet/public_test_cases/p03839/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p03839/output.4.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p03840/input.0.txt b/codenet/public_test_cases/p03840/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7f7442e060fc5c3cf191f064e72e1eb86296329 --- /dev/null +++ b/codenet/public_test_cases/p03840/input.0.txt @@ -0,0 +1 @@ +2 1 1 0 0 0 0 diff --git a/codenet/public_test_cases/p03840/input.1.txt b/codenet/public_test_cases/p03840/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7f7442e060fc5c3cf191f064e72e1eb86296329 --- /dev/null +++ b/codenet/public_test_cases/p03840/input.1.txt @@ -0,0 +1 @@ +2 1 1 0 0 0 0 diff --git a/codenet/public_test_cases/p03840/input.2.txt b/codenet/public_test_cases/p03840/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b64a0839d9134fec2ebf53942a4d126efe914b7a --- /dev/null +++ b/codenet/public_test_cases/p03840/input.2.txt @@ -0,0 +1 @@ +0 0 10 0 0 0 0 diff --git a/codenet/public_test_cases/p03840/output.0.txt b/codenet/public_test_cases/p03840/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03840/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03840/output.1.txt b/codenet/public_test_cases/p03840/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03840/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03840/output.2.txt b/codenet/public_test_cases/p03840/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03840/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03841/input.0.txt b/codenet/public_test_cases/p03841/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1baa7b470a455b95abdf1958aa75e97787d68e9b --- /dev/null +++ b/codenet/public_test_cases/p03841/input.0.txt @@ -0,0 +1,2 @@ +3 +1 5 9 diff --git a/codenet/public_test_cases/p03841/input.1.txt b/codenet/public_test_cases/p03841/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..97141bb503621432c473b985ea38b0632eb7271c --- /dev/null +++ b/codenet/public_test_cases/p03841/input.1.txt @@ -0,0 +1,2 @@ +2 +4 1 diff --git a/codenet/public_test_cases/p03841/input.2.txt b/codenet/public_test_cases/p03841/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1baa7b470a455b95abdf1958aa75e97787d68e9b --- /dev/null +++ b/codenet/public_test_cases/p03841/input.2.txt @@ -0,0 +1,2 @@ +3 +1 5 9 diff --git a/codenet/public_test_cases/p03841/output.0.txt b/codenet/public_test_cases/p03841/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..335433a4d55eab728c0a8a84cf9b074fbd03c3ed --- /dev/null +++ b/codenet/public_test_cases/p03841/output.0.txt @@ -0,0 +1,2 @@ +Yes +1 1 1 2 2 2 3 3 3 diff --git a/codenet/public_test_cases/p03841/output.1.txt b/codenet/public_test_cases/p03841/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03841/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03841/output.2.txt b/codenet/public_test_cases/p03841/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..335433a4d55eab728c0a8a84cf9b074fbd03c3ed --- /dev/null +++ b/codenet/public_test_cases/p03841/output.2.txt @@ -0,0 +1,2 @@ +Yes +1 1 1 2 2 2 3 3 3 diff --git a/codenet/public_test_cases/p03842/input.0.txt b/codenet/public_test_cases/p03842/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03842/input.0.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03842/input.1.txt b/codenet/public_test_cases/p03842/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..811797a5438c685df3973fb0fb0d816b7750605b --- /dev/null +++ b/codenet/public_test_cases/p03842/input.1.txt @@ -0,0 +1,2 @@ +2 +1 1 diff --git a/codenet/public_test_cases/p03842/input.2.txt b/codenet/public_test_cases/p03842/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6d86050b0e039e215b0da8a93663a9bb6efd092a --- /dev/null +++ b/codenet/public_test_cases/p03842/input.2.txt @@ -0,0 +1,2 @@ +3 +1 1 1 diff --git a/codenet/public_test_cases/p03842/input.3.txt b/codenet/public_test_cases/p03842/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..43b6a73891112a58649226dca9107ab1246e0cf7 --- /dev/null +++ b/codenet/public_test_cases/p03842/input.3.txt @@ -0,0 +1,2 @@ +3 +2 1 1 diff --git a/codenet/public_test_cases/p03842/input.4.txt b/codenet/public_test_cases/p03842/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p03842/input.4.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p03842/input.5.txt b/codenet/public_test_cases/p03842/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dfda7c853d2249547065f503cced08b01058039 --- /dev/null +++ b/codenet/public_test_cases/p03842/input.5.txt @@ -0,0 +1,2 @@ +13 +2 1 4 3 6 7 5 9 10 8 8 9 11 diff --git a/codenet/public_test_cases/p03842/output.0.txt b/codenet/public_test_cases/p03842/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03842/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03842/output.1.txt b/codenet/public_test_cases/p03842/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03842/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03842/output.2.txt b/codenet/public_test_cases/p03842/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03842/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03842/output.3.txt b/codenet/public_test_cases/p03842/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03842/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03842/output.4.txt b/codenet/public_test_cases/p03842/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03842/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03842/output.5.txt b/codenet/public_test_cases/p03842/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03842/output.5.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03843/input.0.txt b/codenet/public_test_cases/p03843/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..14f83ce419bbf2b867c10deccb822dcacf00cd53 --- /dev/null +++ b/codenet/public_test_cases/p03843/input.0.txt @@ -0,0 +1,5 @@ +4 +1 2 +1 3 +1 4 +1100 diff --git a/codenet/public_test_cases/p03843/input.1.txt b/codenet/public_test_cases/p03843/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..14f83ce419bbf2b867c10deccb822dcacf00cd53 --- /dev/null +++ b/codenet/public_test_cases/p03843/input.1.txt @@ -0,0 +1,5 @@ +4 +1 2 +1 3 +1 4 +1100 diff --git a/codenet/public_test_cases/p03843/input.2.txt b/codenet/public_test_cases/p03843/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..338b4dc45bce5b750d9c59f7c1f298efefc481ec --- /dev/null +++ b/codenet/public_test_cases/p03843/input.2.txt @@ -0,0 +1,6 @@ +5 +1 2 +1 3 +1 4 +4 5 +11111 diff --git a/codenet/public_test_cases/p03843/input.3.txt b/codenet/public_test_cases/p03843/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2d3ba26f781722dae27e2fdffd618cf74cce1fc --- /dev/null +++ b/codenet/public_test_cases/p03843/input.3.txt @@ -0,0 +1,7 @@ +6 +1 2 +1 3 +1 4 +2 5 +2 6 +100011 diff --git a/codenet/public_test_cases/p03843/output.0.txt b/codenet/public_test_cases/p03843/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03843/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03843/output.1.txt b/codenet/public_test_cases/p03843/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03843/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03843/output.2.txt b/codenet/public_test_cases/p03843/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03843/output.2.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03843/output.3.txt b/codenet/public_test_cases/p03843/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03843/output.3.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03844/input.0.txt b/codenet/public_test_cases/p03844/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0ef5840209cba55095233da06d417f0c5ac7e00 --- /dev/null +++ b/codenet/public_test_cases/p03844/input.0.txt @@ -0,0 +1 @@ +1 + 2 diff --git a/codenet/public_test_cases/p03844/input.1.txt b/codenet/public_test_cases/p03844/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0ef5840209cba55095233da06d417f0c5ac7e00 --- /dev/null +++ b/codenet/public_test_cases/p03844/input.1.txt @@ -0,0 +1 @@ +1 + 2 diff --git a/codenet/public_test_cases/p03844/input.2.txt b/codenet/public_test_cases/p03844/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..37303e210b8936f2d931acdcd2acec924b077fcb --- /dev/null +++ b/codenet/public_test_cases/p03844/input.2.txt @@ -0,0 +1 @@ +5 - 7 diff --git a/codenet/public_test_cases/p03844/output.0.txt b/codenet/public_test_cases/p03844/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03844/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03844/output.1.txt b/codenet/public_test_cases/p03844/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03844/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03844/output.2.txt b/codenet/public_test_cases/p03844/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fbedf693b51d80a9480634ff720815943de9889 --- /dev/null +++ b/codenet/public_test_cases/p03844/output.2.txt @@ -0,0 +1 @@ +-2 diff --git a/codenet/public_test_cases/p03845/input.0.txt b/codenet/public_test_cases/p03845/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf1d5f0ef805c512725925158bbd921968758296 --- /dev/null +++ b/codenet/public_test_cases/p03845/input.0.txt @@ -0,0 +1,5 @@ +3 +2 1 4 +2 +1 1 +2 3 diff --git a/codenet/public_test_cases/p03845/input.1.txt b/codenet/public_test_cases/p03845/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf1d5f0ef805c512725925158bbd921968758296 --- /dev/null +++ b/codenet/public_test_cases/p03845/input.1.txt @@ -0,0 +1,5 @@ +3 +2 1 4 +2 +1 1 +2 3 diff --git a/codenet/public_test_cases/p03845/input.2.txt b/codenet/public_test_cases/p03845/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..413e65c95ba69a4949cb469d504610504cb05597 --- /dev/null +++ b/codenet/public_test_cases/p03845/input.2.txt @@ -0,0 +1,6 @@ +5 +7 2 3 8 5 +3 +4 2 +1 7 +4 13 diff --git a/codenet/public_test_cases/p03845/output.0.txt b/codenet/public_test_cases/p03845/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..95b562c8e68036d3eeda8bd9f59123609db2498b --- /dev/null +++ b/codenet/public_test_cases/p03845/output.0.txt @@ -0,0 +1,2 @@ +6 +9 diff --git a/codenet/public_test_cases/p03845/output.1.txt b/codenet/public_test_cases/p03845/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..95b562c8e68036d3eeda8bd9f59123609db2498b --- /dev/null +++ b/codenet/public_test_cases/p03845/output.1.txt @@ -0,0 +1,2 @@ +6 +9 diff --git a/codenet/public_test_cases/p03845/output.2.txt b/codenet/public_test_cases/p03845/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9941b474bcf133913d08d023d8005bec7b5f86e8 --- /dev/null +++ b/codenet/public_test_cases/p03845/output.2.txt @@ -0,0 +1,3 @@ +19 +25 +30 diff --git a/codenet/public_test_cases/p03846/input.0.txt b/codenet/public_test_cases/p03846/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5704f0bb73c5fa67b416f508aa0650dc013e160 --- /dev/null +++ b/codenet/public_test_cases/p03846/input.0.txt @@ -0,0 +1,2 @@ +5 +2 4 4 0 2 diff --git a/codenet/public_test_cases/p03846/input.1.txt b/codenet/public_test_cases/p03846/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d2af4b34bf162f67c5fc57156cc74ed032f7dde4 --- /dev/null +++ b/codenet/public_test_cases/p03846/input.1.txt @@ -0,0 +1,2 @@ +8 +7 5 1 1 7 3 5 3 diff --git a/codenet/public_test_cases/p03846/input.2.txt b/codenet/public_test_cases/p03846/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..19428a4d1f59e6b58b9835c50a5979ca9df40594 --- /dev/null +++ b/codenet/public_test_cases/p03846/input.2.txt @@ -0,0 +1,2 @@ +7 +6 4 0 2 4 0 2 diff --git a/codenet/public_test_cases/p03846/input.3.txt b/codenet/public_test_cases/p03846/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5704f0bb73c5fa67b416f508aa0650dc013e160 --- /dev/null +++ b/codenet/public_test_cases/p03846/input.3.txt @@ -0,0 +1,2 @@ +5 +2 4 4 0 2 diff --git a/codenet/public_test_cases/p03846/output.0.txt b/codenet/public_test_cases/p03846/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03846/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03846/output.1.txt b/codenet/public_test_cases/p03846/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03846/output.1.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03846/output.2.txt b/codenet/public_test_cases/p03846/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03846/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03846/output.3.txt b/codenet/public_test_cases/p03846/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03846/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03847/input.0.txt b/codenet/public_test_cases/p03847/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03847/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03847/output.0.txt b/codenet/public_test_cases/p03847/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03847/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03848/input.0.txt b/codenet/public_test_cases/p03848/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5704f0bb73c5fa67b416f508aa0650dc013e160 --- /dev/null +++ b/codenet/public_test_cases/p03848/input.0.txt @@ -0,0 +1,2 @@ +5 +2 4 4 0 2 diff --git a/codenet/public_test_cases/p03848/output.0.txt b/codenet/public_test_cases/p03848/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03848/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03849/input.0.txt b/codenet/public_test_cases/p03849/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03849/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03849/input.1.txt b/codenet/public_test_cases/p03849/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03849/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03849/input.2.txt b/codenet/public_test_cases/p03849/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecaa8c86fa601830e0e46393e16bd32fc30cfa63 --- /dev/null +++ b/codenet/public_test_cases/p03849/input.2.txt @@ -0,0 +1 @@ +1422 diff --git a/codenet/public_test_cases/p03849/input.3.txt b/codenet/public_test_cases/p03849/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9a4149f568ebd1c601c9657a0e51a097d0c2703 --- /dev/null +++ b/codenet/public_test_cases/p03849/input.3.txt @@ -0,0 +1 @@ +1000000000000000000 diff --git a/codenet/public_test_cases/p03849/output.0.txt b/codenet/public_test_cases/p03849/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03849/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03849/output.1.txt b/codenet/public_test_cases/p03849/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03849/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03849/output.2.txt b/codenet/public_test_cases/p03849/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aa1d8f41eac8c6171a443b5ef48861029bc2ebda --- /dev/null +++ b/codenet/public_test_cases/p03849/output.2.txt @@ -0,0 +1 @@ +52277 diff --git a/codenet/public_test_cases/p03849/output.3.txt b/codenet/public_test_cases/p03849/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee455bf28f69881347a7df27a8e937d59d3c6216 --- /dev/null +++ b/codenet/public_test_cases/p03849/output.3.txt @@ -0,0 +1 @@ +787014179 diff --git a/codenet/public_test_cases/p03850/input.0.txt b/codenet/public_test_cases/p03850/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..679003462b0c9f753189377d2032e5c92fdc16ff --- /dev/null +++ b/codenet/public_test_cases/p03850/input.0.txt @@ -0,0 +1,2 @@ +3 +5 - 1 - 3 diff --git a/codenet/public_test_cases/p03850/input.1.txt b/codenet/public_test_cases/p03850/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b24a5d73eb4d88ab9915441f3191779f13479af3 --- /dev/null +++ b/codenet/public_test_cases/p03850/input.1.txt @@ -0,0 +1,2 @@ +5 +1 - 2 + 3 - 4 + 5 diff --git a/codenet/public_test_cases/p03850/input.2.txt b/codenet/public_test_cases/p03850/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..679003462b0c9f753189377d2032e5c92fdc16ff --- /dev/null +++ b/codenet/public_test_cases/p03850/input.2.txt @@ -0,0 +1,2 @@ +3 +5 - 1 - 3 diff --git a/codenet/public_test_cases/p03850/input.3.txt b/codenet/public_test_cases/p03850/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b81cc6c9ca4f852c0dbe1ed0bcae63d7b7eae76 --- /dev/null +++ b/codenet/public_test_cases/p03850/input.3.txt @@ -0,0 +1,2 @@ +5 +1 - 20 - 13 + 14 - 5 diff --git a/codenet/public_test_cases/p03850/output.0.txt b/codenet/public_test_cases/p03850/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03850/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03850/output.1.txt b/codenet/public_test_cases/p03850/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03850/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03850/output.2.txt b/codenet/public_test_cases/p03850/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03850/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03850/output.3.txt b/codenet/public_test_cases/p03850/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1bd38b62a0800a4f6a80c34e21c5acffae52c7e --- /dev/null +++ b/codenet/public_test_cases/p03850/output.3.txt @@ -0,0 +1 @@ +13 diff --git a/codenet/public_test_cases/p03851/input.0.txt b/codenet/public_test_cases/p03851/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8837b322ce72bf1386ac8d839f9cf806f297ecec --- /dev/null +++ b/codenet/public_test_cases/p03851/input.0.txt @@ -0,0 +1,5 @@ +5 +1 1 4 1 1 +2 +3 2 +3 10 diff --git a/codenet/public_test_cases/p03851/input.1.txt b/codenet/public_test_cases/p03851/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8837b322ce72bf1386ac8d839f9cf806f297ecec --- /dev/null +++ b/codenet/public_test_cases/p03851/input.1.txt @@ -0,0 +1,5 @@ +5 +1 1 4 1 1 +2 +3 2 +3 10 diff --git a/codenet/public_test_cases/p03851/input.2.txt b/codenet/public_test_cases/p03851/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74837ce7527b789fe7d2a79e2e23663bc265f853 --- /dev/null +++ b/codenet/public_test_cases/p03851/input.2.txt @@ -0,0 +1,13 @@ +12 +1 2 1 3 4 1 2 1 12 3 12 12 +10 +9 3 +11 1 +5 35 +6 15 +12 1 +1 9 +4 3 +10 2 +5 1 +7 6 diff --git a/codenet/public_test_cases/p03851/output.0.txt b/codenet/public_test_cases/p03851/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..deae8f82e015c5ce2e255f8ed03f55c43979833d --- /dev/null +++ b/codenet/public_test_cases/p03851/output.0.txt @@ -0,0 +1,2 @@ +9 +2 diff --git a/codenet/public_test_cases/p03851/output.1.txt b/codenet/public_test_cases/p03851/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..deae8f82e015c5ce2e255f8ed03f55c43979833d --- /dev/null +++ b/codenet/public_test_cases/p03851/output.1.txt @@ -0,0 +1,2 @@ +9 +2 diff --git a/codenet/public_test_cases/p03851/output.2.txt b/codenet/public_test_cases/p03851/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..169d986263353ed4bb233b76911738d9f485cc88 --- /dev/null +++ b/codenet/public_test_cases/p03851/output.2.txt @@ -0,0 +1,10 @@ +34 +35 +5 +11 +35 +17 +25 +26 +28 +21 diff --git a/codenet/public_test_cases/p03852/input.0.txt b/codenet/public_test_cases/p03852/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p03852/input.0.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p03852/input.1.txt b/codenet/public_test_cases/p03852/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4785957bc986dc39c629de9fac9df46972c00fc --- /dev/null +++ b/codenet/public_test_cases/p03852/input.1.txt @@ -0,0 +1 @@ +s diff --git a/codenet/public_test_cases/p03852/input.2.txt b/codenet/public_test_cases/p03852/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b68025345d5301abad4d9ec9166f455243a0d746 --- /dev/null +++ b/codenet/public_test_cases/p03852/input.2.txt @@ -0,0 +1 @@ +z diff --git a/codenet/public_test_cases/p03852/input.3.txt b/codenet/public_test_cases/p03852/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..78981922613b2afb6025042ff6bd878ac1994e85 --- /dev/null +++ b/codenet/public_test_cases/p03852/input.3.txt @@ -0,0 +1 @@ +a diff --git a/codenet/public_test_cases/p03852/output.0.txt b/codenet/public_test_cases/p03852/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..05f8ce3cc87489adb40df32b73d036787382ba0b --- /dev/null +++ b/codenet/public_test_cases/p03852/output.0.txt @@ -0,0 +1 @@ +vowel diff --git a/codenet/public_test_cases/p03852/output.1.txt b/codenet/public_test_cases/p03852/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..901caf59f62da5c7a75eb4cfb5af2486835b0689 --- /dev/null +++ b/codenet/public_test_cases/p03852/output.1.txt @@ -0,0 +1 @@ +consonant diff --git a/codenet/public_test_cases/p03852/output.2.txt b/codenet/public_test_cases/p03852/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..901caf59f62da5c7a75eb4cfb5af2486835b0689 --- /dev/null +++ b/codenet/public_test_cases/p03852/output.2.txt @@ -0,0 +1 @@ +consonant diff --git a/codenet/public_test_cases/p03852/output.3.txt b/codenet/public_test_cases/p03852/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..05f8ce3cc87489adb40df32b73d036787382ba0b --- /dev/null +++ b/codenet/public_test_cases/p03852/output.3.txt @@ -0,0 +1 @@ +vowel diff --git a/codenet/public_test_cases/p03853/input.0.txt b/codenet/public_test_cases/p03853/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..103c0cfe2d2858b8b31a1809ab7825eb55a2cc79 --- /dev/null +++ b/codenet/public_test_cases/p03853/input.0.txt @@ -0,0 +1,3 @@ +2 2 +*. +.* diff --git a/codenet/public_test_cases/p03853/input.1.txt b/codenet/public_test_cases/p03853/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cf0e86b0cf4f65dcb7e20fcb3bc94133e9e2f6d --- /dev/null +++ b/codenet/public_test_cases/p03853/input.1.txt @@ -0,0 +1,10 @@ +9 20 +.....***....***..... +....*...*..*...*.... +...*.....**.....*... +...*.....*......*... +....*.....*....*.... +.....**..*...**..... +.......*..*.*....... +........**.*........ +.........**......... diff --git a/codenet/public_test_cases/p03853/input.2.txt b/codenet/public_test_cases/p03853/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..103c0cfe2d2858b8b31a1809ab7825eb55a2cc79 --- /dev/null +++ b/codenet/public_test_cases/p03853/input.2.txt @@ -0,0 +1,3 @@ +2 2 +*. +.* diff --git a/codenet/public_test_cases/p03853/input.3.txt b/codenet/public_test_cases/p03853/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dc095056437bad14a2208a4b58835921213dbb9f --- /dev/null +++ b/codenet/public_test_cases/p03853/input.3.txt @@ -0,0 +1,2 @@ +1 4 +***. diff --git a/codenet/public_test_cases/p03853/output.0.txt b/codenet/public_test_cases/p03853/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..82480d0cf2d2ec2e53be66359502b7d8b3690881 --- /dev/null +++ b/codenet/public_test_cases/p03853/output.0.txt @@ -0,0 +1,4 @@ +*. +*. +.* +.* diff --git a/codenet/public_test_cases/p03853/output.1.txt b/codenet/public_test_cases/p03853/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5facf2f4d7a0c1658f47b37cec6d36fdac94d52b --- /dev/null +++ b/codenet/public_test_cases/p03853/output.1.txt @@ -0,0 +1,18 @@ +.....***....***..... +.....***....***..... +....*...*..*...*.... +....*...*..*...*.... +...*.....**.....*... +...*.....**.....*... +...*.....*......*... +...*.....*......*... +....*.....*....*.... +....*.....*....*.... +.....**..*...**..... +.....**..*...**..... +.......*..*.*....... +.......*..*.*....... +........**.*........ +........**.*........ +.........**......... +.........**......... diff --git a/codenet/public_test_cases/p03853/output.2.txt b/codenet/public_test_cases/p03853/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..82480d0cf2d2ec2e53be66359502b7d8b3690881 --- /dev/null +++ b/codenet/public_test_cases/p03853/output.2.txt @@ -0,0 +1,4 @@ +*. +*. +.* +.* diff --git a/codenet/public_test_cases/p03853/output.3.txt b/codenet/public_test_cases/p03853/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1a4b491b4e01e239553b682a83643c8baca2eaa --- /dev/null +++ b/codenet/public_test_cases/p03853/output.3.txt @@ -0,0 +1,2 @@ +***. +***. diff --git a/codenet/public_test_cases/p03854/input.0.txt b/codenet/public_test_cases/p03854/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2f36c515340952d293596987ff468a3839d3fda --- /dev/null +++ b/codenet/public_test_cases/p03854/input.0.txt @@ -0,0 +1 @@ +erasedream diff --git a/codenet/public_test_cases/p03854/input.1.txt b/codenet/public_test_cases/p03854/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..621f45355b97aed3f1eaa003ac651e856a125064 --- /dev/null +++ b/codenet/public_test_cases/p03854/input.1.txt @@ -0,0 +1 @@ +dreamerer diff --git a/codenet/public_test_cases/p03854/input.2.txt b/codenet/public_test_cases/p03854/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2f36c515340952d293596987ff468a3839d3fda --- /dev/null +++ b/codenet/public_test_cases/p03854/input.2.txt @@ -0,0 +1 @@ +erasedream diff --git a/codenet/public_test_cases/p03854/input.3.txt b/codenet/public_test_cases/p03854/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..afebb48a374e93446553425312d515e879d80760 --- /dev/null +++ b/codenet/public_test_cases/p03854/input.3.txt @@ -0,0 +1 @@ +dreameraser diff --git a/codenet/public_test_cases/p03854/output.0.txt b/codenet/public_test_cases/p03854/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03854/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03854/output.1.txt b/codenet/public_test_cases/p03854/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03854/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03854/output.2.txt b/codenet/public_test_cases/p03854/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03854/output.2.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03854/output.3.txt b/codenet/public_test_cases/p03854/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03854/output.3.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03855/input.0.txt b/codenet/public_test_cases/p03855/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbb30e000cbfdcf868667e4b9e5ab43171e4e927 --- /dev/null +++ b/codenet/public_test_cases/p03855/input.0.txt @@ -0,0 +1,5 @@ +4 3 1 +1 2 +2 3 +3 4 +2 3 diff --git a/codenet/public_test_cases/p03855/output.0.txt b/codenet/public_test_cases/p03855/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecc6a13517f5c18e9c3f11484761bc07d1448d89 --- /dev/null +++ b/codenet/public_test_cases/p03855/output.0.txt @@ -0,0 +1 @@ +1 2 2 1 diff --git a/codenet/public_test_cases/p03856/input.0.txt b/codenet/public_test_cases/p03856/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2f36c515340952d293596987ff468a3839d3fda --- /dev/null +++ b/codenet/public_test_cases/p03856/input.0.txt @@ -0,0 +1 @@ +erasedream diff --git a/codenet/public_test_cases/p03856/output.0.txt b/codenet/public_test_cases/p03856/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03856/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03857/input.0.txt b/codenet/public_test_cases/p03857/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbb30e000cbfdcf868667e4b9e5ab43171e4e927 --- /dev/null +++ b/codenet/public_test_cases/p03857/input.0.txt @@ -0,0 +1,5 @@ +4 3 1 +1 2 +2 3 +3 4 +2 3 diff --git a/codenet/public_test_cases/p03857/input.1.txt b/codenet/public_test_cases/p03857/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1697a4e996b8a2254779faad052443f5f3581c71 --- /dev/null +++ b/codenet/public_test_cases/p03857/input.1.txt @@ -0,0 +1,9 @@ +7 4 4 +1 2 +2 3 +2 5 +6 7 +3 5 +4 5 +3 4 +6 7 diff --git a/codenet/public_test_cases/p03857/input.2.txt b/codenet/public_test_cases/p03857/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbb30e000cbfdcf868667e4b9e5ab43171e4e927 --- /dev/null +++ b/codenet/public_test_cases/p03857/input.2.txt @@ -0,0 +1,5 @@ +4 3 1 +1 2 +2 3 +3 4 +2 3 diff --git a/codenet/public_test_cases/p03857/input.3.txt b/codenet/public_test_cases/p03857/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aacaee27ee8ebe7e9eeee1b6f796d2c042bd9be2 --- /dev/null +++ b/codenet/public_test_cases/p03857/input.3.txt @@ -0,0 +1,5 @@ +4 2 2 +1 2 +2 3 +1 4 +2 3 diff --git a/codenet/public_test_cases/p03857/output.0.txt b/codenet/public_test_cases/p03857/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecc6a13517f5c18e9c3f11484761bc07d1448d89 --- /dev/null +++ b/codenet/public_test_cases/p03857/output.0.txt @@ -0,0 +1 @@ +1 2 2 1 diff --git a/codenet/public_test_cases/p03857/output.1.txt b/codenet/public_test_cases/p03857/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b259998a0df05d233488251693af892c8e4a571e --- /dev/null +++ b/codenet/public_test_cases/p03857/output.1.txt @@ -0,0 +1 @@ +1 1 2 1 2 2 2 diff --git a/codenet/public_test_cases/p03857/output.2.txt b/codenet/public_test_cases/p03857/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecc6a13517f5c18e9c3f11484761bc07d1448d89 --- /dev/null +++ b/codenet/public_test_cases/p03857/output.2.txt @@ -0,0 +1 @@ +1 2 2 1 diff --git a/codenet/public_test_cases/p03857/output.3.txt b/codenet/public_test_cases/p03857/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ecc6a13517f5c18e9c3f11484761bc07d1448d89 --- /dev/null +++ b/codenet/public_test_cases/p03857/output.3.txt @@ -0,0 +1 @@ +1 2 2 1 diff --git a/codenet/public_test_cases/p03858/input.0.txt b/codenet/public_test_cases/p03858/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3dc30491bf9a11ea77d60bde840354c677a61e3d --- /dev/null +++ b/codenet/public_test_cases/p03858/input.0.txt @@ -0,0 +1,6 @@ +5 1 2 +1 1 +4 3 +6 1 +5 5 +4 8 diff --git a/codenet/public_test_cases/p03858/input.1.txt b/codenet/public_test_cases/p03858/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3f15330e30765d4d43e0aa8c7e737ff970a3c23 --- /dev/null +++ b/codenet/public_test_cases/p03858/input.1.txt @@ -0,0 +1,7 @@ +6 2 3 +1 3 +5 3 +3 5 +8 4 +4 7 +2 5 diff --git a/codenet/public_test_cases/p03858/input.2.txt b/codenet/public_test_cases/p03858/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3dc30491bf9a11ea77d60bde840354c677a61e3d --- /dev/null +++ b/codenet/public_test_cases/p03858/input.2.txt @@ -0,0 +1,6 @@ +5 1 2 +1 1 +4 3 +6 1 +5 5 +4 8 diff --git a/codenet/public_test_cases/p03858/input.3.txt b/codenet/public_test_cases/p03858/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f0522a6804da27fa15ec4472f31cb53a90e0428 --- /dev/null +++ b/codenet/public_test_cases/p03858/input.3.txt @@ -0,0 +1,9 @@ +8 1 2 +1 5 +4 3 +8 2 +4 7 +8 8 +3 3 +6 6 +4 8 diff --git a/codenet/public_test_cases/p03858/output.0.txt b/codenet/public_test_cases/p03858/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03858/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03858/output.1.txt b/codenet/public_test_cases/p03858/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03858/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03858/output.2.txt b/codenet/public_test_cases/p03858/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03858/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03858/output.3.txt b/codenet/public_test_cases/p03858/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03858/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03859/input.0.txt b/codenet/public_test_cases/p03859/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad05388d44e941886ead88a68100849ba4035e8c --- /dev/null +++ b/codenet/public_test_cases/p03859/input.0.txt @@ -0,0 +1,4 @@ +5 2 +01001 +2 4 +3 5 diff --git a/codenet/public_test_cases/p03859/input.1.txt b/codenet/public_test_cases/p03859/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1bc88062c98484eab0225eb4a4f9ee653d18447a --- /dev/null +++ b/codenet/public_test_cases/p03859/input.1.txt @@ -0,0 +1,8 @@ +11 6 +00101000110 +2 4 +2 3 +4 7 +5 6 +6 10 +10 11 diff --git a/codenet/public_test_cases/p03859/input.2.txt b/codenet/public_test_cases/p03859/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad05388d44e941886ead88a68100849ba4035e8c --- /dev/null +++ b/codenet/public_test_cases/p03859/input.2.txt @@ -0,0 +1,4 @@ +5 2 +01001 +2 4 +3 5 diff --git a/codenet/public_test_cases/p03859/input.3.txt b/codenet/public_test_cases/p03859/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6da0377b39883c167bd66fb54d6483f8d8dd9fa --- /dev/null +++ b/codenet/public_test_cases/p03859/input.3.txt @@ -0,0 +1,5 @@ +9 3 +110111110 +1 4 +4 6 +6 9 diff --git a/codenet/public_test_cases/p03859/output.0.txt b/codenet/public_test_cases/p03859/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03859/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03859/output.1.txt b/codenet/public_test_cases/p03859/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fba7ed526e434d8e4d615d8c9eca14f252c8a0f4 --- /dev/null +++ b/codenet/public_test_cases/p03859/output.1.txt @@ -0,0 +1 @@ +143 diff --git a/codenet/public_test_cases/p03859/output.2.txt b/codenet/public_test_cases/p03859/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03859/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03859/output.3.txt b/codenet/public_test_cases/p03859/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p03859/output.3.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p03860/input.0.txt b/codenet/public_test_cases/p03860/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1131392b16ce203529cce6303fbfee38d1c19e99 --- /dev/null +++ b/codenet/public_test_cases/p03860/input.0.txt @@ -0,0 +1 @@ +AtCoder Beginner Contest diff --git a/codenet/public_test_cases/p03860/input.1.txt b/codenet/public_test_cases/p03860/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1131392b16ce203529cce6303fbfee38d1c19e99 --- /dev/null +++ b/codenet/public_test_cases/p03860/input.1.txt @@ -0,0 +1 @@ +AtCoder Beginner Contest diff --git a/codenet/public_test_cases/p03860/input.2.txt b/codenet/public_test_cases/p03860/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a03c5b79c0055aac35b44dee21cf073f6a35510c --- /dev/null +++ b/codenet/public_test_cases/p03860/input.2.txt @@ -0,0 +1 @@ +AtCoder Snuke Contest diff --git a/codenet/public_test_cases/p03860/input.3.txt b/codenet/public_test_cases/p03860/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f19b9fe4cdea76e723b60abd36ab769ca9756841 --- /dev/null +++ b/codenet/public_test_cases/p03860/input.3.txt @@ -0,0 +1 @@ +AtCoder X Contest diff --git a/codenet/public_test_cases/p03860/output.0.txt b/codenet/public_test_cases/p03860/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p03860/output.0.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p03860/output.1.txt b/codenet/public_test_cases/p03860/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5da849b5c6f00b5292b1a823b29ceb303e98585c --- /dev/null +++ b/codenet/public_test_cases/p03860/output.1.txt @@ -0,0 +1 @@ +ABC diff --git a/codenet/public_test_cases/p03860/output.2.txt b/codenet/public_test_cases/p03860/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bde36bfa240be08e43605b9797a2083f0e52985e --- /dev/null +++ b/codenet/public_test_cases/p03860/output.2.txt @@ -0,0 +1 @@ +ASC diff --git a/codenet/public_test_cases/p03860/output.3.txt b/codenet/public_test_cases/p03860/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9aa70d9f3bb8b0aa669cd9da76fe61087639d50b --- /dev/null +++ b/codenet/public_test_cases/p03860/output.3.txt @@ -0,0 +1 @@ +AXC diff --git a/codenet/public_test_cases/p03861/input.0.txt b/codenet/public_test_cases/p03861/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..84d5a7b3b4b2a0b71cee627265912293767e6deb --- /dev/null +++ b/codenet/public_test_cases/p03861/input.0.txt @@ -0,0 +1 @@ +4 8 2 diff --git a/codenet/public_test_cases/p03861/input.1.txt b/codenet/public_test_cases/p03861/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..84d5a7b3b4b2a0b71cee627265912293767e6deb --- /dev/null +++ b/codenet/public_test_cases/p03861/input.1.txt @@ -0,0 +1 @@ +4 8 2 diff --git a/codenet/public_test_cases/p03861/input.2.txt b/codenet/public_test_cases/p03861/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..210361fad9fd5541da1b89687552b54331bb5b6c --- /dev/null +++ b/codenet/public_test_cases/p03861/input.2.txt @@ -0,0 +1 @@ +9 9 2 diff --git a/codenet/public_test_cases/p03861/input.3.txt b/codenet/public_test_cases/p03861/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..81701251d4f39c9fa64b937cee5e9ae6bc9f334c --- /dev/null +++ b/codenet/public_test_cases/p03861/input.3.txt @@ -0,0 +1 @@ +1 1000000000000000000 3 diff --git a/codenet/public_test_cases/p03861/input.4.txt b/codenet/public_test_cases/p03861/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a779db161a4a19c52b88d2619cf0b050efc5b089 --- /dev/null +++ b/codenet/public_test_cases/p03861/input.4.txt @@ -0,0 +1 @@ +0 5 1 diff --git a/codenet/public_test_cases/p03861/output.0.txt b/codenet/public_test_cases/p03861/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03861/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03861/output.1.txt b/codenet/public_test_cases/p03861/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03861/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03861/output.2.txt b/codenet/public_test_cases/p03861/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03861/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03861/output.3.txt b/codenet/public_test_cases/p03861/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..674429b3ca56bca625094d0ab4bd9613af1b9446 --- /dev/null +++ b/codenet/public_test_cases/p03861/output.3.txt @@ -0,0 +1 @@ +333333333333333333 diff --git a/codenet/public_test_cases/p03861/output.4.txt b/codenet/public_test_cases/p03861/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03861/output.4.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03862/input.0.txt b/codenet/public_test_cases/p03862/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd7d19d664b1af656b5ac799a274ad759e64cb03 --- /dev/null +++ b/codenet/public_test_cases/p03862/input.0.txt @@ -0,0 +1,2 @@ +3 3 +2 2 2 diff --git a/codenet/public_test_cases/p03862/input.1.txt b/codenet/public_test_cases/p03862/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dea979abbce5cc56709678138945b20d53e203ba --- /dev/null +++ b/codenet/public_test_cases/p03862/input.1.txt @@ -0,0 +1,2 @@ +2 0 +5 5 diff --git a/codenet/public_test_cases/p03862/input.2.txt b/codenet/public_test_cases/p03862/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45edf9e00e81f1f206b41ad76b08a4de9725cca7 --- /dev/null +++ b/codenet/public_test_cases/p03862/input.2.txt @@ -0,0 +1,2 @@ +5 9 +3 1 4 1 5 diff --git a/codenet/public_test_cases/p03862/input.3.txt b/codenet/public_test_cases/p03862/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd7d19d664b1af656b5ac799a274ad759e64cb03 --- /dev/null +++ b/codenet/public_test_cases/p03862/input.3.txt @@ -0,0 +1,2 @@ +3 3 +2 2 2 diff --git a/codenet/public_test_cases/p03862/input.4.txt b/codenet/public_test_cases/p03862/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f549f5e6195d586e93fa48bde25f14d8dbaa5e8 --- /dev/null +++ b/codenet/public_test_cases/p03862/input.4.txt @@ -0,0 +1,2 @@ +6 1 +1 6 1 2 0 4 diff --git a/codenet/public_test_cases/p03862/output.0.txt b/codenet/public_test_cases/p03862/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03862/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03862/output.1.txt b/codenet/public_test_cases/p03862/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03862/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03862/output.2.txt b/codenet/public_test_cases/p03862/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03862/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03862/output.3.txt b/codenet/public_test_cases/p03862/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03862/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03862/output.4.txt b/codenet/public_test_cases/p03862/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03862/output.4.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03863/input.0.txt b/codenet/public_test_cases/p03863/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9265f8251cfab3529825e5c708c15c55801bed5 --- /dev/null +++ b/codenet/public_test_cases/p03863/input.0.txt @@ -0,0 +1 @@ +aba diff --git a/codenet/public_test_cases/p03863/input.1.txt b/codenet/public_test_cases/p03863/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8baef1b4abc478178b004d62031cf7fe6db6f903 --- /dev/null +++ b/codenet/public_test_cases/p03863/input.1.txt @@ -0,0 +1 @@ +abc diff --git a/codenet/public_test_cases/p03863/input.2.txt b/codenet/public_test_cases/p03863/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9265f8251cfab3529825e5c708c15c55801bed5 --- /dev/null +++ b/codenet/public_test_cases/p03863/input.2.txt @@ -0,0 +1 @@ +aba diff --git a/codenet/public_test_cases/p03863/input.3.txt b/codenet/public_test_cases/p03863/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..64a9b8a12e023cc2f476dd584cceb99456b93a65 --- /dev/null +++ b/codenet/public_test_cases/p03863/input.3.txt @@ -0,0 +1 @@ +abcab diff --git a/codenet/public_test_cases/p03863/output.0.txt b/codenet/public_test_cases/p03863/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p03863/output.0.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p03863/output.1.txt b/codenet/public_test_cases/p03863/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03863/output.1.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03863/output.2.txt b/codenet/public_test_cases/p03863/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p03863/output.2.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p03863/output.3.txt b/codenet/public_test_cases/p03863/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p03863/output.3.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p03864/input.0.txt b/codenet/public_test_cases/p03864/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dd7d19d664b1af656b5ac799a274ad759e64cb03 --- /dev/null +++ b/codenet/public_test_cases/p03864/input.0.txt @@ -0,0 +1,2 @@ +3 3 +2 2 2 diff --git a/codenet/public_test_cases/p03864/output.0.txt b/codenet/public_test_cases/p03864/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03864/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03865/input.0.txt b/codenet/public_test_cases/p03865/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9265f8251cfab3529825e5c708c15c55801bed5 --- /dev/null +++ b/codenet/public_test_cases/p03865/input.0.txt @@ -0,0 +1 @@ +aba diff --git a/codenet/public_test_cases/p03865/output.0.txt b/codenet/public_test_cases/p03865/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p03865/output.0.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p03866/input.0.txt b/codenet/public_test_cases/p03866/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..35977b4f73f500c6bcabce325f9c0f30f4d35cc1 --- /dev/null +++ b/codenet/public_test_cases/p03866/input.0.txt @@ -0,0 +1,3 @@ +-2 -2 2 2 +1 +0 0 1 diff --git a/codenet/public_test_cases/p03866/input.1.txt b/codenet/public_test_cases/p03866/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf65b5da523db2bb99f827bfb3b97a1e8039a28b --- /dev/null +++ b/codenet/public_test_cases/p03866/input.1.txt @@ -0,0 +1,4 @@ +-2 0 2 0 +2 +-1 0 2 +1 0 2 diff --git a/codenet/public_test_cases/p03866/input.2.txt b/codenet/public_test_cases/p03866/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e025970031487e8973a9a7d26e0d3ffc99427be --- /dev/null +++ b/codenet/public_test_cases/p03866/input.2.txt @@ -0,0 +1,5 @@ +4 -2 -2 4 +3 +0 0 2 +4 0 1 +0 4 1 diff --git a/codenet/public_test_cases/p03866/input.3.txt b/codenet/public_test_cases/p03866/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..35977b4f73f500c6bcabce325f9c0f30f4d35cc1 --- /dev/null +++ b/codenet/public_test_cases/p03866/input.3.txt @@ -0,0 +1,3 @@ +-2 -2 2 2 +1 +0 0 1 diff --git a/codenet/public_test_cases/p03866/output.0.txt b/codenet/public_test_cases/p03866/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4743e21a76c0a625cd10d0d5e1c89b718ddee86b --- /dev/null +++ b/codenet/public_test_cases/p03866/output.0.txt @@ -0,0 +1 @@ +3.6568542495 diff --git a/codenet/public_test_cases/p03866/output.1.txt b/codenet/public_test_cases/p03866/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9ea018f39fb93217cb6e831e08c8a7d15907f1a --- /dev/null +++ b/codenet/public_test_cases/p03866/output.1.txt @@ -0,0 +1 @@ +0.0000000000 diff --git a/codenet/public_test_cases/p03866/output.2.txt b/codenet/public_test_cases/p03866/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cebf94fe02ec054332441c14dff6e277e7d65b5 --- /dev/null +++ b/codenet/public_test_cases/p03866/output.2.txt @@ -0,0 +1 @@ +4.0000000000 diff --git a/codenet/public_test_cases/p03866/output.3.txt b/codenet/public_test_cases/p03866/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4743e21a76c0a625cd10d0d5e1c89b718ddee86b --- /dev/null +++ b/codenet/public_test_cases/p03866/output.3.txt @@ -0,0 +1 @@ +3.6568542495 diff --git a/codenet/public_test_cases/p03867/input.0.txt b/codenet/public_test_cases/p03867/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..805e7f5a05abb0767d277398dd810d64910d282f --- /dev/null +++ b/codenet/public_test_cases/p03867/input.0.txt @@ -0,0 +1 @@ +4 2 diff --git a/codenet/public_test_cases/p03867/input.1.txt b/codenet/public_test_cases/p03867/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..caf89741fceaaa4127b0607f26763103dc3d00ca --- /dev/null +++ b/codenet/public_test_cases/p03867/input.1.txt @@ -0,0 +1 @@ +1000000000 1000000000 diff --git a/codenet/public_test_cases/p03867/input.2.txt b/codenet/public_test_cases/p03867/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aba066490735a0d12c6c3ce01830600db457d5bc --- /dev/null +++ b/codenet/public_test_cases/p03867/input.2.txt @@ -0,0 +1 @@ +1 10 diff --git a/codenet/public_test_cases/p03867/input.3.txt b/codenet/public_test_cases/p03867/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..805e7f5a05abb0767d277398dd810d64910d282f --- /dev/null +++ b/codenet/public_test_cases/p03867/input.3.txt @@ -0,0 +1 @@ +4 2 diff --git a/codenet/public_test_cases/p03867/input.4.txt b/codenet/public_test_cases/p03867/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0dc5f67e18feaa8ac385a23e46b2594040b228c --- /dev/null +++ b/codenet/public_test_cases/p03867/input.4.txt @@ -0,0 +1 @@ +6 3 diff --git a/codenet/public_test_cases/p03867/output.0.txt b/codenet/public_test_cases/p03867/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03867/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03867/output.1.txt b/codenet/public_test_cases/p03867/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5faa6b31ef0c825b028777ec2b54d428ee25dee1 --- /dev/null +++ b/codenet/public_test_cases/p03867/output.1.txt @@ -0,0 +1 @@ +875699961 diff --git a/codenet/public_test_cases/p03867/output.2.txt b/codenet/public_test_cases/p03867/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03867/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03867/output.3.txt b/codenet/public_test_cases/p03867/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03867/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03867/output.4.txt b/codenet/public_test_cases/p03867/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..78eb67cee1ab25652fe5c9e29efc173671301400 --- /dev/null +++ b/codenet/public_test_cases/p03867/output.4.txt @@ -0,0 +1 @@ +75 diff --git a/codenet/public_test_cases/p03868/input.0.txt b/codenet/public_test_cases/p03868/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c97d655f0330438069ff55bd0a18f0dd78d6e077 --- /dev/null +++ b/codenet/public_test_cases/p03868/input.0.txt @@ -0,0 +1,5 @@ +2 +0 +10 +20 +30 diff --git a/codenet/public_test_cases/p03868/output.0.txt b/codenet/public_test_cases/p03868/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03868/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03869/input.0.txt b/codenet/public_test_cases/p03869/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacef92c21f7d2b311b29e5de633241cce58036c --- /dev/null +++ b/codenet/public_test_cases/p03869/input.0.txt @@ -0,0 +1,3 @@ +0 0 +1 1 +2 0 diff --git a/codenet/public_test_cases/p03869/output.0.txt b/codenet/public_test_cases/p03869/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08a80a2690cad9d1b14e87b1f7d3ac5ba5345e58 --- /dev/null +++ b/codenet/public_test_cases/p03869/output.0.txt @@ -0,0 +1 @@ +0.292893218813 diff --git a/codenet/public_test_cases/p03870/input.0.txt b/codenet/public_test_cases/p03870/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ecdb04bca6a9dd0158e83de51ac6c0536084d6e --- /dev/null +++ b/codenet/public_test_cases/p03870/input.0.txt @@ -0,0 +1,4 @@ +3 +2 +3 +4 diff --git a/codenet/public_test_cases/p03870/output.0.txt b/codenet/public_test_cases/p03870/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03870/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03871/input.0.txt b/codenet/public_test_cases/p03871/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c52fc240d5e70f2093011440dc8b9217970fbc2f --- /dev/null +++ b/codenet/public_test_cases/p03871/input.0.txt @@ -0,0 +1,2 @@ +25 25 25 25 0 0 +0 0 0 0 50 50 diff --git a/codenet/public_test_cases/p03871/input.1.txt b/codenet/public_test_cases/p03871/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..378c94745f2217c6f603afacafd3320b22d606ab --- /dev/null +++ b/codenet/public_test_cases/p03871/input.1.txt @@ -0,0 +1,2 @@ +10 20 20 10 20 20 +20 20 20 10 10 20 diff --git a/codenet/public_test_cases/p03871/input.2.txt b/codenet/public_test_cases/p03871/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c52fc240d5e70f2093011440dc8b9217970fbc2f --- /dev/null +++ b/codenet/public_test_cases/p03871/input.2.txt @@ -0,0 +1,2 @@ +25 25 25 25 0 0 +0 0 0 0 50 50 diff --git a/codenet/public_test_cases/p03871/output.0.txt b/codenet/public_test_cases/p03871/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b43b2ec6156b9a6e96f1152dd5c48c3b433ab05a --- /dev/null +++ b/codenet/public_test_cases/p03871/output.0.txt @@ -0,0 +1 @@ +1.000000000000 diff --git a/codenet/public_test_cases/p03871/output.1.txt b/codenet/public_test_cases/p03871/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3e06abbd8229c2554e367ca91edd450da44d62b --- /dev/null +++ b/codenet/public_test_cases/p03871/output.1.txt @@ -0,0 +1 @@ +0.550000000000 diff --git a/codenet/public_test_cases/p03871/output.2.txt b/codenet/public_test_cases/p03871/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b43b2ec6156b9a6e96f1152dd5c48c3b433ab05a --- /dev/null +++ b/codenet/public_test_cases/p03871/output.2.txt @@ -0,0 +1 @@ +1.000000000000 diff --git a/codenet/public_test_cases/p03872/input.0.txt b/codenet/public_test_cases/p03872/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3a06879ded5d329d13da0c9cf44afbf87046b0c --- /dev/null +++ b/codenet/public_test_cases/p03872/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 10 +2 0 5 +0 5 8 diff --git a/codenet/public_test_cases/p03872/output.0.txt b/codenet/public_test_cases/p03872/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85e290e226cbc5eab4e808a250592bb058ed068a --- /dev/null +++ b/codenet/public_test_cases/p03872/output.0.txt @@ -0,0 +1 @@ +6.500000000000 diff --git a/codenet/public_test_cases/p03873/input.0.txt b/codenet/public_test_cases/p03873/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..873ce35d29660b236dff95f798504ba43ec86226 --- /dev/null +++ b/codenet/public_test_cases/p03873/input.0.txt @@ -0,0 +1,5 @@ +4 +2 7 +2 5 +4 1 +7 5 diff --git a/codenet/public_test_cases/p03873/output.0.txt b/codenet/public_test_cases/p03873/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03873/output.0.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03874/input.0.txt b/codenet/public_test_cases/p03874/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03874/input.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03874/input.1.txt b/codenet/public_test_cases/p03874/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03874/input.1.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03874/input.2.txt b/codenet/public_test_cases/p03874/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9183bf03fccab013c0805dd51f7ea97bbb86de5d --- /dev/null +++ b/codenet/public_test_cases/p03874/input.2.txt @@ -0,0 +1 @@ +256 diff --git a/codenet/public_test_cases/p03874/output.0.txt b/codenet/public_test_cases/p03874/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7fabf6b74ac331fb09d6a44916a3a3588b5274c --- /dev/null +++ b/codenet/public_test_cases/p03874/output.0.txt @@ -0,0 +1 @@ +FESSSSSSSTIVAL diff --git a/codenet/public_test_cases/p03874/output.1.txt b/codenet/public_test_cases/p03874/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7fabf6b74ac331fb09d6a44916a3a3588b5274c --- /dev/null +++ b/codenet/public_test_cases/p03874/output.1.txt @@ -0,0 +1 @@ +FESSSSSSSTIVAL diff --git a/codenet/public_test_cases/p03874/output.2.txt b/codenet/public_test_cases/p03874/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4b59af9771713ad1d066b17186f2397822698044 --- /dev/null +++ b/codenet/public_test_cases/p03874/output.2.txt @@ -0,0 +1 @@ +FFEESSTTIIVVAALL diff --git a/codenet/public_test_cases/p03875/input.0.txt b/codenet/public_test_cases/p03875/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5588077b4f7297f370e79bab708d7d4847bd7b8 --- /dev/null +++ b/codenet/public_test_cases/p03875/input.0.txt @@ -0,0 +1,3 @@ +2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03875/input.1.txt b/codenet/public_test_cases/p03875/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5588077b4f7297f370e79bab708d7d4847bd7b8 --- /dev/null +++ b/codenet/public_test_cases/p03875/input.1.txt @@ -0,0 +1,3 @@ +2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03875/input.2.txt b/codenet/public_test_cases/p03875/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ac475494a322b06e73052f856a93ec017c388e8 --- /dev/null +++ b/codenet/public_test_cases/p03875/input.2.txt @@ -0,0 +1,11 @@ +10 +1 0 0 1 1 1 0 0 1 0 +0 0 0 1 1 0 0 0 1 0 +0 0 1 1 1 1 1 1 1 1 +0 1 0 1 0 0 0 1 1 0 +0 0 1 0 1 1 1 1 1 1 +1 0 0 0 0 1 0 0 0 0 +1 1 1 0 1 0 0 0 0 1 +0 0 0 1 0 0 1 0 1 0 +0 0 0 1 1 1 0 0 0 0 +1 0 1 0 0 1 1 1 1 1 diff --git a/codenet/public_test_cases/p03875/output.0.txt b/codenet/public_test_cases/p03875/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03875/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03875/output.1.txt b/codenet/public_test_cases/p03875/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03875/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03875/output.2.txt b/codenet/public_test_cases/p03875/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0eaa215518081adaa2c994c43c4cb217f5f8fa06 --- /dev/null +++ b/codenet/public_test_cases/p03875/output.2.txt @@ -0,0 +1 @@ +741992411 diff --git a/codenet/public_test_cases/p03876/input.0.txt b/codenet/public_test_cases/p03876/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ba21e8795ecc15343e0f9c0693c9e67ff162586 --- /dev/null +++ b/codenet/public_test_cases/p03876/input.0.txt @@ -0,0 +1,9 @@ +8 +90 +90 +270 +90 +90 +90 +270 +90 diff --git a/codenet/public_test_cases/p03876/output.0.txt b/codenet/public_test_cases/p03876/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cf08f5592de9fc65816f6c6dea1137aa0bd60cf --- /dev/null +++ b/codenet/public_test_cases/p03876/output.0.txt @@ -0,0 +1,8 @@ +0 0 +2 0 +2 1 +3 1 +3 2 +1 2 +1 1 +0 1 diff --git a/codenet/public_test_cases/p03877/input.0.txt b/codenet/public_test_cases/p03877/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e74b415e7fbb85867d122f19bbd5959bf6d6bc1b --- /dev/null +++ b/codenet/public_test_cases/p03877/input.0.txt @@ -0,0 +1 @@ +3 1 2 0 diff --git a/codenet/public_test_cases/p03877/input.1.txt b/codenet/public_test_cases/p03877/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e74b415e7fbb85867d122f19bbd5959bf6d6bc1b --- /dev/null +++ b/codenet/public_test_cases/p03877/input.1.txt @@ -0,0 +1 @@ +3 1 2 0 diff --git a/codenet/public_test_cases/p03877/input.2.txt b/codenet/public_test_cases/p03877/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c445d44a841480fdfd9524818aeb5cab172f7efb --- /dev/null +++ b/codenet/public_test_cases/p03877/input.2.txt @@ -0,0 +1 @@ +600 100 200 300 diff --git a/codenet/public_test_cases/p03877/output.0.txt b/codenet/public_test_cases/p03877/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03877/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03877/output.1.txt b/codenet/public_test_cases/p03877/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03877/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03877/output.2.txt b/codenet/public_test_cases/p03877/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bedde34eff4bf29ae91001963543201e7dbf93d --- /dev/null +++ b/codenet/public_test_cases/p03877/output.2.txt @@ -0,0 +1 @@ +522158867 diff --git a/codenet/public_test_cases/p03878/input.0.txt b/codenet/public_test_cases/p03878/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c97d655f0330438069ff55bd0a18f0dd78d6e077 --- /dev/null +++ b/codenet/public_test_cases/p03878/input.0.txt @@ -0,0 +1,5 @@ +2 +0 +10 +20 +30 diff --git a/codenet/public_test_cases/p03878/input.1.txt b/codenet/public_test_cases/p03878/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c97d655f0330438069ff55bd0a18f0dd78d6e077 --- /dev/null +++ b/codenet/public_test_cases/p03878/input.1.txt @@ -0,0 +1,5 @@ +2 +0 +10 +20 +30 diff --git a/codenet/public_test_cases/p03878/input.2.txt b/codenet/public_test_cases/p03878/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..40d2360f481342d12e3ab892de5bd9327208b687 --- /dev/null +++ b/codenet/public_test_cases/p03878/input.2.txt @@ -0,0 +1,7 @@ +3 +3 +10 +8 +7 +12 +5 diff --git a/codenet/public_test_cases/p03878/output.0.txt b/codenet/public_test_cases/p03878/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03878/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03878/output.1.txt b/codenet/public_test_cases/p03878/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03878/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03878/output.2.txt b/codenet/public_test_cases/p03878/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03878/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03879/input.0.txt b/codenet/public_test_cases/p03879/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacef92c21f7d2b311b29e5de633241cce58036c --- /dev/null +++ b/codenet/public_test_cases/p03879/input.0.txt @@ -0,0 +1,3 @@ +0 0 +1 1 +2 0 diff --git a/codenet/public_test_cases/p03879/input.1.txt b/codenet/public_test_cases/p03879/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..32b285a4eaee8a0bee64e1e8d33346f95896c6af --- /dev/null +++ b/codenet/public_test_cases/p03879/input.1.txt @@ -0,0 +1,3 @@ +3 1 +1 5 +4 9 diff --git a/codenet/public_test_cases/p03879/input.2.txt b/codenet/public_test_cases/p03879/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacef92c21f7d2b311b29e5de633241cce58036c --- /dev/null +++ b/codenet/public_test_cases/p03879/input.2.txt @@ -0,0 +1,3 @@ +0 0 +1 1 +2 0 diff --git a/codenet/public_test_cases/p03879/output.0.txt b/codenet/public_test_cases/p03879/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..08a80a2690cad9d1b14e87b1f7d3ac5ba5345e58 --- /dev/null +++ b/codenet/public_test_cases/p03879/output.0.txt @@ -0,0 +1 @@ +0.292893218813 diff --git a/codenet/public_test_cases/p03879/output.1.txt b/codenet/public_test_cases/p03879/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e1e545bd53fee5cb45039146d7ee8507762dff5 --- /dev/null +++ b/codenet/public_test_cases/p03879/output.1.txt @@ -0,0 +1 @@ +0.889055514217 diff --git a/codenet/public_test_cases/p03879/output.2.txt b/codenet/public_test_cases/p03879/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..08a80a2690cad9d1b14e87b1f7d3ac5ba5345e58 --- /dev/null +++ b/codenet/public_test_cases/p03879/output.2.txt @@ -0,0 +1 @@ +0.292893218813 diff --git a/codenet/public_test_cases/p03880/input.0.txt b/codenet/public_test_cases/p03880/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ecdb04bca6a9dd0158e83de51ac6c0536084d6e --- /dev/null +++ b/codenet/public_test_cases/p03880/input.0.txt @@ -0,0 +1,4 @@ +3 +2 +3 +4 diff --git a/codenet/public_test_cases/p03880/input.1.txt b/codenet/public_test_cases/p03880/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ecdb04bca6a9dd0158e83de51ac6c0536084d6e --- /dev/null +++ b/codenet/public_test_cases/p03880/input.1.txt @@ -0,0 +1,4 @@ +3 +2 +3 +4 diff --git a/codenet/public_test_cases/p03880/input.2.txt b/codenet/public_test_cases/p03880/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f2b204a959380c70552ec4fdc20d4ee9b48b464 --- /dev/null +++ b/codenet/public_test_cases/p03880/input.2.txt @@ -0,0 +1,4 @@ +3 +100 +100 +100 diff --git a/codenet/public_test_cases/p03880/output.0.txt b/codenet/public_test_cases/p03880/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03880/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03880/output.1.txt b/codenet/public_test_cases/p03880/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03880/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03880/output.2.txt b/codenet/public_test_cases/p03880/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03880/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03881/input.0.txt b/codenet/public_test_cases/p03881/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c52fc240d5e70f2093011440dc8b9217970fbc2f --- /dev/null +++ b/codenet/public_test_cases/p03881/input.0.txt @@ -0,0 +1,2 @@ +25 25 25 25 0 0 +0 0 0 0 50 50 diff --git a/codenet/public_test_cases/p03881/output.0.txt b/codenet/public_test_cases/p03881/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b43b2ec6156b9a6e96f1152dd5c48c3b433ab05a --- /dev/null +++ b/codenet/public_test_cases/p03881/output.0.txt @@ -0,0 +1 @@ +1.000000000000 diff --git a/codenet/public_test_cases/p03882/input.0.txt b/codenet/public_test_cases/p03882/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3a06879ded5d329d13da0c9cf44afbf87046b0c --- /dev/null +++ b/codenet/public_test_cases/p03882/input.0.txt @@ -0,0 +1,4 @@ +3 +0 0 10 +2 0 5 +0 5 8 diff --git a/codenet/public_test_cases/p03882/input.1.txt b/codenet/public_test_cases/p03882/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3a06879ded5d329d13da0c9cf44afbf87046b0c --- /dev/null +++ b/codenet/public_test_cases/p03882/input.1.txt @@ -0,0 +1,4 @@ +3 +0 0 10 +2 0 5 +0 5 8 diff --git a/codenet/public_test_cases/p03882/input.2.txt b/codenet/public_test_cases/p03882/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbaf0bf9995e34506d1ae36094dac7358d6b216e --- /dev/null +++ b/codenet/public_test_cases/p03882/input.2.txt @@ -0,0 +1,16 @@ +15 +335279264 849598327 822889311 +446755913 526239859 548830120 +181424399 715477619 342858071 +625711486 448565595 480845266 +647639160 467825612 449656269 +160714711 336869678 545923679 +61020590 573085537 816372580 +626006012 389312924 135599877 +547865075 511429216 605997004 +561330066 539239436 921749002 +650693494 63219754 786119025 +849028504 632532642 655702582 +285323416 611583586 211428413 +990607689 590857173 393671555 +560686330 679513171 501983447 diff --git a/codenet/public_test_cases/p03882/output.0.txt b/codenet/public_test_cases/p03882/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..85e290e226cbc5eab4e808a250592bb058ed068a --- /dev/null +++ b/codenet/public_test_cases/p03882/output.0.txt @@ -0,0 +1 @@ +6.500000000000 diff --git a/codenet/public_test_cases/p03882/output.1.txt b/codenet/public_test_cases/p03882/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..85e290e226cbc5eab4e808a250592bb058ed068a --- /dev/null +++ b/codenet/public_test_cases/p03882/output.1.txt @@ -0,0 +1 @@ +6.500000000000 diff --git a/codenet/public_test_cases/p03882/output.2.txt b/codenet/public_test_cases/p03882/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6512d91f329df8c6354714a0a5849a72a8435f64 --- /dev/null +++ b/codenet/public_test_cases/p03882/output.2.txt @@ -0,0 +1 @@ +434666178.237122833729 diff --git a/codenet/public_test_cases/p03883/input.0.txt b/codenet/public_test_cases/p03883/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..873ce35d29660b236dff95f798504ba43ec86226 --- /dev/null +++ b/codenet/public_test_cases/p03883/input.0.txt @@ -0,0 +1,5 @@ +4 +2 7 +2 5 +4 1 +7 5 diff --git a/codenet/public_test_cases/p03883/input.1.txt b/codenet/public_test_cases/p03883/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee0ac8fdf5d0d88362c994b639c4aac42c27c958 --- /dev/null +++ b/codenet/public_test_cases/p03883/input.1.txt @@ -0,0 +1,21 @@ +20 +97 2 +75 25 +82 84 +17 56 +32 2 +28 37 +57 39 +18 11 +79 6 +40 68 +68 16 +40 63 +93 49 +91 10 +55 68 +31 80 +57 18 +34 28 +76 55 +21 80 diff --git a/codenet/public_test_cases/p03883/input.2.txt b/codenet/public_test_cases/p03883/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..873ce35d29660b236dff95f798504ba43ec86226 --- /dev/null +++ b/codenet/public_test_cases/p03883/input.2.txt @@ -0,0 +1,5 @@ +4 +2 7 +2 5 +4 1 +7 5 diff --git a/codenet/public_test_cases/p03883/output.0.txt b/codenet/public_test_cases/p03883/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03883/output.0.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03883/output.1.txt b/codenet/public_test_cases/p03883/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd22903d843294d0ed5fde4fa5fa94481fa94e73 --- /dev/null +++ b/codenet/public_test_cases/p03883/output.1.txt @@ -0,0 +1 @@ +7337 diff --git a/codenet/public_test_cases/p03883/output.2.txt b/codenet/public_test_cases/p03883/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bd5a0a98a36cc08ada88b804d3be047e6aa5b8a --- /dev/null +++ b/codenet/public_test_cases/p03883/output.2.txt @@ -0,0 +1 @@ +22 diff --git a/codenet/public_test_cases/p03884/input.0.txt b/codenet/public_test_cases/p03884/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03884/input.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03884/output.0.txt b/codenet/public_test_cases/p03884/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7fabf6b74ac331fb09d6a44916a3a3588b5274c --- /dev/null +++ b/codenet/public_test_cases/p03884/output.0.txt @@ -0,0 +1 @@ +FESSSSSSSTIVAL diff --git a/codenet/public_test_cases/p03885/input.0.txt b/codenet/public_test_cases/p03885/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5588077b4f7297f370e79bab708d7d4847bd7b8 --- /dev/null +++ b/codenet/public_test_cases/p03885/input.0.txt @@ -0,0 +1,3 @@ +2 +0 1 +1 0 diff --git a/codenet/public_test_cases/p03885/output.0.txt b/codenet/public_test_cases/p03885/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03885/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03886/input.0.txt b/codenet/public_test_cases/p03886/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ba21e8795ecc15343e0f9c0693c9e67ff162586 --- /dev/null +++ b/codenet/public_test_cases/p03886/input.0.txt @@ -0,0 +1,9 @@ +8 +90 +90 +270 +90 +90 +90 +270 +90 diff --git a/codenet/public_test_cases/p03886/input.1.txt b/codenet/public_test_cases/p03886/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ba21e8795ecc15343e0f9c0693c9e67ff162586 --- /dev/null +++ b/codenet/public_test_cases/p03886/input.1.txt @@ -0,0 +1,9 @@ +8 +90 +90 +270 +90 +90 +90 +270 +90 diff --git a/codenet/public_test_cases/p03886/input.2.txt b/codenet/public_test_cases/p03886/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8ea3b594cc85b94cbbe278ef9bf0f1e38dc620d --- /dev/null +++ b/codenet/public_test_cases/p03886/input.2.txt @@ -0,0 +1,4 @@ +3 +90 +90 +90 diff --git a/codenet/public_test_cases/p03886/output.0.txt b/codenet/public_test_cases/p03886/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cf08f5592de9fc65816f6c6dea1137aa0bd60cf --- /dev/null +++ b/codenet/public_test_cases/p03886/output.0.txt @@ -0,0 +1,8 @@ +0 0 +2 0 +2 1 +3 1 +3 2 +1 2 +1 1 +0 1 diff --git a/codenet/public_test_cases/p03886/output.1.txt b/codenet/public_test_cases/p03886/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cf08f5592de9fc65816f6c6dea1137aa0bd60cf --- /dev/null +++ b/codenet/public_test_cases/p03886/output.1.txt @@ -0,0 +1,8 @@ +0 0 +2 0 +2 1 +3 1 +3 2 +1 2 +1 1 +0 1 diff --git a/codenet/public_test_cases/p03886/output.2.txt b/codenet/public_test_cases/p03886/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03886/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03887/input.0.txt b/codenet/public_test_cases/p03887/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e74b415e7fbb85867d122f19bbd5959bf6d6bc1b --- /dev/null +++ b/codenet/public_test_cases/p03887/input.0.txt @@ -0,0 +1 @@ +3 1 2 0 diff --git a/codenet/public_test_cases/p03887/output.0.txt b/codenet/public_test_cases/p03887/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03887/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03888/input.0.txt b/codenet/public_test_cases/p03888/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p03888/input.0.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p03888/input.1.txt b/codenet/public_test_cases/p03888/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c599ae1944431c57be525df306d867dd22e36afb --- /dev/null +++ b/codenet/public_test_cases/p03888/input.1.txt @@ -0,0 +1 @@ +100 99 diff --git a/codenet/public_test_cases/p03888/input.2.txt b/codenet/public_test_cases/p03888/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p03888/input.2.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p03888/output.0.txt b/codenet/public_test_cases/p03888/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d14f9d446602f9be53de1935a2617650f9fb0a4 --- /dev/null +++ b/codenet/public_test_cases/p03888/output.0.txt @@ -0,0 +1 @@ +1.2000000000 diff --git a/codenet/public_test_cases/p03888/output.1.txt b/codenet/public_test_cases/p03888/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..087e2b827613f337343c9fb21785e116441eabbc --- /dev/null +++ b/codenet/public_test_cases/p03888/output.1.txt @@ -0,0 +1 @@ +49.7487437186 diff --git a/codenet/public_test_cases/p03888/output.2.txt b/codenet/public_test_cases/p03888/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d14f9d446602f9be53de1935a2617650f9fb0a4 --- /dev/null +++ b/codenet/public_test_cases/p03888/output.2.txt @@ -0,0 +1 @@ +1.2000000000 diff --git a/codenet/public_test_cases/p03889/input.0.txt b/codenet/public_test_cases/p03889/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf4f0519629d30d0cedf2fbfae0c8e462ed560d6 --- /dev/null +++ b/codenet/public_test_cases/p03889/input.0.txt @@ -0,0 +1 @@ +pdbq diff --git a/codenet/public_test_cases/p03889/input.1.txt b/codenet/public_test_cases/p03889/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0dd69c291191bbe99d5f7ee3d085d827ad5e825d --- /dev/null +++ b/codenet/public_test_cases/p03889/input.1.txt @@ -0,0 +1 @@ +ppqb diff --git a/codenet/public_test_cases/p03889/input.2.txt b/codenet/public_test_cases/p03889/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf4f0519629d30d0cedf2fbfae0c8e462ed560d6 --- /dev/null +++ b/codenet/public_test_cases/p03889/input.2.txt @@ -0,0 +1 @@ +pdbq diff --git a/codenet/public_test_cases/p03889/output.0.txt b/codenet/public_test_cases/p03889/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03889/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03889/output.1.txt b/codenet/public_test_cases/p03889/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03889/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03889/output.2.txt b/codenet/public_test_cases/p03889/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03889/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03890/input.0.txt b/codenet/public_test_cases/p03890/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3dfa8e69c232028fbf3284173d5f290f79670ff9 --- /dev/null +++ b/codenet/public_test_cases/p03890/input.0.txt @@ -0,0 +1,5 @@ +2 +1 +3 +10 +19 diff --git a/codenet/public_test_cases/p03890/input.1.txt b/codenet/public_test_cases/p03890/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9eb406fb043e162c53b66edc39cd2a5face6bedf --- /dev/null +++ b/codenet/public_test_cases/p03890/input.1.txt @@ -0,0 +1,9 @@ +3 +1 +3 +2 +4 +6 +8 +100 +104 diff --git a/codenet/public_test_cases/p03890/input.2.txt b/codenet/public_test_cases/p03890/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3dfa8e69c232028fbf3284173d5f290f79670ff9 --- /dev/null +++ b/codenet/public_test_cases/p03890/input.2.txt @@ -0,0 +1,5 @@ +2 +1 +3 +10 +19 diff --git a/codenet/public_test_cases/p03890/output.0.txt b/codenet/public_test_cases/p03890/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03890/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03890/output.1.txt b/codenet/public_test_cases/p03890/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03890/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03890/output.2.txt b/codenet/public_test_cases/p03890/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03890/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03891/input.0.txt b/codenet/public_test_cases/p03891/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bca0cc9d4b028f3a665d3b8c9762860f98f5ba6 --- /dev/null +++ b/codenet/public_test_cases/p03891/input.0.txt @@ -0,0 +1,3 @@ +8 +3 +5 diff --git a/codenet/public_test_cases/p03891/input.1.txt b/codenet/public_test_cases/p03891/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7bca0cc9d4b028f3a665d3b8c9762860f98f5ba6 --- /dev/null +++ b/codenet/public_test_cases/p03891/input.1.txt @@ -0,0 +1,3 @@ +8 +3 +5 diff --git a/codenet/public_test_cases/p03891/input.2.txt b/codenet/public_test_cases/p03891/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8183f05f5db68b3934e93f4bf6bed2bb664e0b5 --- /dev/null +++ b/codenet/public_test_cases/p03891/input.2.txt @@ -0,0 +1,3 @@ +1 +1 +1 diff --git a/codenet/public_test_cases/p03891/output.0.txt b/codenet/public_test_cases/p03891/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f640368cdb737721108b5a86e83f60f27aad5e9d --- /dev/null +++ b/codenet/public_test_cases/p03891/output.0.txt @@ -0,0 +1,3 @@ +8 3 4 +1 5 9 +6 7 2 diff --git a/codenet/public_test_cases/p03891/output.1.txt b/codenet/public_test_cases/p03891/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f640368cdb737721108b5a86e83f60f27aad5e9d --- /dev/null +++ b/codenet/public_test_cases/p03891/output.1.txt @@ -0,0 +1,3 @@ +8 3 4 +1 5 9 +6 7 2 diff --git a/codenet/public_test_cases/p03891/output.2.txt b/codenet/public_test_cases/p03891/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1338399b918e92b66f6224f72a7c51c4384b38fa --- /dev/null +++ b/codenet/public_test_cases/p03891/output.2.txt @@ -0,0 +1,3 @@ +1 1 1 +1 1 1 +1 1 1 diff --git a/codenet/public_test_cases/p03892/input.0.txt b/codenet/public_test_cases/p03892/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..01aed53aca7e015f4b00452fdf9b794c2e19c94c --- /dev/null +++ b/codenet/public_test_cases/p03892/input.0.txt @@ -0,0 +1 @@ +1 1 3 4 diff --git a/codenet/public_test_cases/p03892/input.1.txt b/codenet/public_test_cases/p03892/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..01aed53aca7e015f4b00452fdf9b794c2e19c94c --- /dev/null +++ b/codenet/public_test_cases/p03892/input.1.txt @@ -0,0 +1 @@ +1 1 3 4 diff --git a/codenet/public_test_cases/p03892/input.2.txt b/codenet/public_test_cases/p03892/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..04ce30c67acf66c35d1605223f4914b1e5f0c7f5 --- /dev/null +++ b/codenet/public_test_cases/p03892/input.2.txt @@ -0,0 +1 @@ +2 3 10 7 diff --git a/codenet/public_test_cases/p03892/output.0.txt b/codenet/public_test_cases/p03892/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03892/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03892/output.1.txt b/codenet/public_test_cases/p03892/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03892/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03892/output.2.txt b/codenet/public_test_cases/p03892/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03892/output.2.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03893/input.0.txt b/codenet/public_test_cases/p03893/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03893/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03893/input.1.txt b/codenet/public_test_cases/p03893/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03893/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03893/output.0.txt b/codenet/public_test_cases/p03893/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03893/output.0.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03893/output.1.txt b/codenet/public_test_cases/p03893/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03893/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03894/input.0.txt b/codenet/public_test_cases/p03894/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9951017cf66256b53d63f0eaae90cacb10b70fb8 --- /dev/null +++ b/codenet/public_test_cases/p03894/input.0.txt @@ -0,0 +1,4 @@ +10 3 +1 3 +2 4 +4 5 diff --git a/codenet/public_test_cases/p03894/input.1.txt b/codenet/public_test_cases/p03894/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9951017cf66256b53d63f0eaae90cacb10b70fb8 --- /dev/null +++ b/codenet/public_test_cases/p03894/input.1.txt @@ -0,0 +1,4 @@ +10 3 +1 3 +2 4 +4 5 diff --git a/codenet/public_test_cases/p03894/input.2.txt b/codenet/public_test_cases/p03894/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..de14e49546f7eda97f495c117ff8874478344f2d --- /dev/null +++ b/codenet/public_test_cases/p03894/input.2.txt @@ -0,0 +1,4 @@ +20 3 +1 7 +8 20 +1 19 diff --git a/codenet/public_test_cases/p03894/output.0.txt b/codenet/public_test_cases/p03894/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03894/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03894/output.1.txt b/codenet/public_test_cases/p03894/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03894/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03894/output.2.txt b/codenet/public_test_cases/p03894/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03894/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03895/input.0.txt b/codenet/public_test_cases/p03895/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0157d523fb0b7b86104c0b4d374eeef0c273078f --- /dev/null +++ b/codenet/public_test_cases/p03895/input.0.txt @@ -0,0 +1,4 @@ +3 +28800 57600 +28800 57600 +57600 28800 diff --git a/codenet/public_test_cases/p03895/input.1.txt b/codenet/public_test_cases/p03895/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0157d523fb0b7b86104c0b4d374eeef0c273078f --- /dev/null +++ b/codenet/public_test_cases/p03895/input.1.txt @@ -0,0 +1,4 @@ +3 +28800 57600 +28800 57600 +57600 28800 diff --git a/codenet/public_test_cases/p03895/input.2.txt b/codenet/public_test_cases/p03895/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c33b5b5325f4d2d098fa23b335a96957a03b2a4 --- /dev/null +++ b/codenet/public_test_cases/p03895/input.2.txt @@ -0,0 +1,11 @@ +10 +28800 57600 +4800 9600 +6000 1200 +600 600 +300 600 +5400 600 +6000 5760 +6760 2880 +6000 12000 +9000 600 diff --git a/codenet/public_test_cases/p03895/output.0.txt b/codenet/public_test_cases/p03895/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03895/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03895/output.1.txt b/codenet/public_test_cases/p03895/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03895/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03895/output.2.txt b/codenet/public_test_cases/p03895/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03895/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03896/input.0.txt b/codenet/public_test_cases/p03896/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03896/input.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03896/input.1.txt b/codenet/public_test_cases/p03896/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03896/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03896/input.2.txt b/codenet/public_test_cases/p03896/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03896/input.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03896/output.0.txt b/codenet/public_test_cases/p03896/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..264b5814306e0e689648b8f99cdcab9aa4130be5 --- /dev/null +++ b/codenet/public_test_cases/p03896/output.0.txt @@ -0,0 +1,7 @@ +2 3 4 5 6 7 +5 3 1 6 4 7 +2 7 4 1 5 6 +2 1 7 5 3 6 +1 4 3 7 6 2 +2 5 7 3 4 1 +2 6 1 4 5 3 diff --git a/codenet/public_test_cases/p03896/output.1.txt b/codenet/public_test_cases/p03896/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03896/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03896/output.2.txt b/codenet/public_test_cases/p03896/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..264b5814306e0e689648b8f99cdcab9aa4130be5 --- /dev/null +++ b/codenet/public_test_cases/p03896/output.2.txt @@ -0,0 +1,7 @@ +2 3 4 5 6 7 +5 3 1 6 4 7 +2 7 4 1 5 6 +2 1 7 5 3 6 +1 4 3 7 6 2 +2 5 7 3 4 1 +2 6 1 4 5 3 diff --git a/codenet/public_test_cases/p03897/input.0.txt b/codenet/public_test_cases/p03897/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03897/input.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03897/input.1.txt b/codenet/public_test_cases/p03897/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03897/input.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03897/input.2.txt b/codenet/public_test_cases/p03897/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03897/input.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03897/output.0.txt b/codenet/public_test_cases/p03897/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7ce5df8fb16e7741b8e2541619740404108597f --- /dev/null +++ b/codenet/public_test_cases/p03897/output.0.txt @@ -0,0 +1,2 @@ +1 +1 0 diff --git a/codenet/public_test_cases/p03897/output.1.txt b/codenet/public_test_cases/p03897/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7ce5df8fb16e7741b8e2541619740404108597f --- /dev/null +++ b/codenet/public_test_cases/p03897/output.1.txt @@ -0,0 +1,2 @@ +1 +1 0 diff --git a/codenet/public_test_cases/p03897/output.2.txt b/codenet/public_test_cases/p03897/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4ccceac372f7c1b735f0bacd256ce1e15e72cbb --- /dev/null +++ b/codenet/public_test_cases/p03897/output.2.txt @@ -0,0 +1,4 @@ +3 +0 1 +2 1 +2 3 diff --git a/codenet/public_test_cases/p03898/input.0.txt b/codenet/public_test_cases/p03898/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..913dc828930ae6560976a61bff74724593bfba79 --- /dev/null +++ b/codenet/public_test_cases/p03898/input.0.txt @@ -0,0 +1,4 @@ +4 +1 2 +2 3 +2 4 diff --git a/codenet/public_test_cases/p03898/input.1.txt b/codenet/public_test_cases/p03898/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..76fe18e6fb256dd7f122f78a405b240154405981 --- /dev/null +++ b/codenet/public_test_cases/p03898/input.1.txt @@ -0,0 +1,10 @@ +10 +7 9 +1 2 +6 4 +8 1 +3 7 +6 5 +2 10 +9 6 +2 6 diff --git a/codenet/public_test_cases/p03898/input.2.txt b/codenet/public_test_cases/p03898/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..913dc828930ae6560976a61bff74724593bfba79 --- /dev/null +++ b/codenet/public_test_cases/p03898/input.2.txt @@ -0,0 +1,4 @@ +4 +1 2 +2 3 +2 4 diff --git a/codenet/public_test_cases/p03898/output.0.txt b/codenet/public_test_cases/p03898/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03898/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03898/output.1.txt b/codenet/public_test_cases/p03898/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03898/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03898/output.2.txt b/codenet/public_test_cases/p03898/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03898/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03899/input.0.txt b/codenet/public_test_cases/p03899/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..52ef680ccdbc47351f5f76caa5710e1df82c455a --- /dev/null +++ b/codenet/public_test_cases/p03899/input.0.txt @@ -0,0 +1,2 @@ +5 2 3 +10 2 8 10 2 diff --git a/codenet/public_test_cases/p03899/input.1.txt b/codenet/public_test_cases/p03899/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..52ef680ccdbc47351f5f76caa5710e1df82c455a --- /dev/null +++ b/codenet/public_test_cases/p03899/input.1.txt @@ -0,0 +1,2 @@ +5 2 3 +10 2 8 10 2 diff --git a/codenet/public_test_cases/p03899/input.2.txt b/codenet/public_test_cases/p03899/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fb420ed59a76490977e082e25ecba4153a23ffd --- /dev/null +++ b/codenet/public_test_cases/p03899/input.2.txt @@ -0,0 +1,2 @@ +10 3 5 +3 7 2 6 9 4 8 5 1 1000000000 diff --git a/codenet/public_test_cases/p03899/input.3.txt b/codenet/public_test_cases/p03899/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0ea4c883b3639f175e858e07bd8763047768d76 --- /dev/null +++ b/codenet/public_test_cases/p03899/input.3.txt @@ -0,0 +1,2 @@ +5 5 2 +5 2 10 5 9 diff --git a/codenet/public_test_cases/p03899/output.0.txt b/codenet/public_test_cases/p03899/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b91e0e1f8dddaac700b51aa7a66f29fc135a02 --- /dev/null +++ b/codenet/public_test_cases/p03899/output.0.txt @@ -0,0 +1 @@ +56 diff --git a/codenet/public_test_cases/p03899/output.1.txt b/codenet/public_test_cases/p03899/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6b91e0e1f8dddaac700b51aa7a66f29fc135a02 --- /dev/null +++ b/codenet/public_test_cases/p03899/output.1.txt @@ -0,0 +1 @@ +56 diff --git a/codenet/public_test_cases/p03899/output.2.txt b/codenet/public_test_cases/p03899/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb8eb31af402af5a33d06463d29cc64db2ae09a0 --- /dev/null +++ b/codenet/public_test_cases/p03899/output.2.txt @@ -0,0 +1 @@ +5000000078 diff --git a/codenet/public_test_cases/p03899/output.3.txt b/codenet/public_test_cases/p03899/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9902f17848a8974ab57d57999b74a63198fe6e23 --- /dev/null +++ b/codenet/public_test_cases/p03899/output.3.txt @@ -0,0 +1 @@ +28 diff --git a/codenet/public_test_cases/p03900/input.0.txt b/codenet/public_test_cases/p03900/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..04bb19b4c7e89684eb1edc3d06fb96264998aee9 --- /dev/null +++ b/codenet/public_test_cases/p03900/input.0.txt @@ -0,0 +1,3 @@ +4 +1 2 3 4 +MmM diff --git a/codenet/public_test_cases/p03900/input.1.txt b/codenet/public_test_cases/p03900/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7d9c0f9239238d5801dd63b733908aaceec883b --- /dev/null +++ b/codenet/public_test_cases/p03900/input.1.txt @@ -0,0 +1,3 @@ +5 +3 4 2 2 1 +MMmm diff --git a/codenet/public_test_cases/p03900/input.2.txt b/codenet/public_test_cases/p03900/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f357e8b997d4e835b7f06e7cca7baf79735406d --- /dev/null +++ b/codenet/public_test_cases/p03900/input.2.txt @@ -0,0 +1,3 @@ +10 +1 8 7 6 8 5 2 2 6 1 +MmmmmMMMm diff --git a/codenet/public_test_cases/p03900/input.3.txt b/codenet/public_test_cases/p03900/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f6e86284abd12c31471aea36d8f8cb162940c37 --- /dev/null +++ b/codenet/public_test_cases/p03900/input.3.txt @@ -0,0 +1,3 @@ +20 +12 7 16 8 7 19 8 19 20 11 7 13 20 3 4 11 19 11 15 5 +mMMmmmMMMMMMmMmmmMM diff --git a/codenet/public_test_cases/p03900/input.4.txt b/codenet/public_test_cases/p03900/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..04bb19b4c7e89684eb1edc3d06fb96264998aee9 --- /dev/null +++ b/codenet/public_test_cases/p03900/input.4.txt @@ -0,0 +1,3 @@ +4 +1 2 3 4 +MmM diff --git a/codenet/public_test_cases/p03900/output.0.txt b/codenet/public_test_cases/p03900/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03900/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03900/output.1.txt b/codenet/public_test_cases/p03900/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03900/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03900/output.2.txt b/codenet/public_test_cases/p03900/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03900/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03900/output.3.txt b/codenet/public_test_cases/p03900/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03900/output.3.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03900/output.4.txt b/codenet/public_test_cases/p03900/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03900/output.4.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03901/input.0.txt b/codenet/public_test_cases/p03901/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e334c9cc44262cdf8970a5d4ad41c7dd75002a2 --- /dev/null +++ b/codenet/public_test_cases/p03901/input.0.txt @@ -0,0 +1,2 @@ +3 +100 diff --git a/codenet/public_test_cases/p03901/input.1.txt b/codenet/public_test_cases/p03901/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..03475b2d9c3a0bbf1515bbc18dae32846efe5492 --- /dev/null +++ b/codenet/public_test_cases/p03901/input.1.txt @@ -0,0 +1,2 @@ +6 +40 diff --git a/codenet/public_test_cases/p03901/input.2.txt b/codenet/public_test_cases/p03901/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b9c3adc3b2e9a579eb19a72fc4455fe452f82d0 --- /dev/null +++ b/codenet/public_test_cases/p03901/input.2.txt @@ -0,0 +1,2 @@ +101 +80 diff --git a/codenet/public_test_cases/p03901/input.3.txt b/codenet/public_test_cases/p03901/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e334c9cc44262cdf8970a5d4ad41c7dd75002a2 --- /dev/null +++ b/codenet/public_test_cases/p03901/input.3.txt @@ -0,0 +1,2 @@ +3 +100 diff --git a/codenet/public_test_cases/p03901/output.0.txt b/codenet/public_test_cases/p03901/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b115ac3742ec2160465003718e933a07feeea7db --- /dev/null +++ b/codenet/public_test_cases/p03901/output.0.txt @@ -0,0 +1 @@ +2.0000000 diff --git a/codenet/public_test_cases/p03901/output.1.txt b/codenet/public_test_cases/p03901/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4937b7a2a7a27aacd5d33a863555056332dd02b9 --- /dev/null +++ b/codenet/public_test_cases/p03901/output.1.txt @@ -0,0 +1 @@ +7.5000000 diff --git a/codenet/public_test_cases/p03901/output.2.txt b/codenet/public_test_cases/p03901/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..30679b685e9bf3a5eafe10333787314e021ce8d0 --- /dev/null +++ b/codenet/public_test_cases/p03901/output.2.txt @@ -0,0 +1 @@ +63.7500000 diff --git a/codenet/public_test_cases/p03901/output.3.txt b/codenet/public_test_cases/p03901/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b115ac3742ec2160465003718e933a07feeea7db --- /dev/null +++ b/codenet/public_test_cases/p03901/output.3.txt @@ -0,0 +1 @@ +2.0000000 diff --git a/codenet/public_test_cases/p03902/input.0.txt b/codenet/public_test_cases/p03902/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2c0abf4c1cac470e9d5c005d482433f6ef78b4f --- /dev/null +++ b/codenet/public_test_cases/p03902/input.0.txt @@ -0,0 +1,4 @@ +3 3 +2 3 1 +2 1 2 +2 6 3 diff --git a/codenet/public_test_cases/p03902/input.1.txt b/codenet/public_test_cases/p03902/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee9832c31d8ec70603687e090ef22ec33af9dcbc --- /dev/null +++ b/codenet/public_test_cases/p03902/input.1.txt @@ -0,0 +1,6 @@ +5 5 +2 6 5 6 9 +2 6 4 9 10 +2 6 8 6 7 +2 1 7 3 8 +2 1 4 8 3 diff --git a/codenet/public_test_cases/p03902/input.2.txt b/codenet/public_test_cases/p03902/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..063da6fe5bd814a416fa7765c425a8051d7a4d03 --- /dev/null +++ b/codenet/public_test_cases/p03902/input.2.txt @@ -0,0 +1,4 @@ +3 3 +3 2 10 +10 5 4 +9 1 9 diff --git a/codenet/public_test_cases/p03902/input.3.txt b/codenet/public_test_cases/p03902/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b2c0abf4c1cac470e9d5c005d482433f6ef78b4f --- /dev/null +++ b/codenet/public_test_cases/p03902/input.3.txt @@ -0,0 +1,4 @@ +3 3 +2 3 1 +2 1 2 +2 6 3 diff --git a/codenet/public_test_cases/p03902/output.0.txt b/codenet/public_test_cases/p03902/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03902/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03902/output.1.txt b/codenet/public_test_cases/p03902/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0 --- /dev/null +++ b/codenet/public_test_cases/p03902/output.1.txt @@ -0,0 +1 @@ +11 diff --git a/codenet/public_test_cases/p03902/output.2.txt b/codenet/public_test_cases/p03902/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03902/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03902/output.3.txt b/codenet/public_test_cases/p03902/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03902/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03903/input.0.txt b/codenet/public_test_cases/p03903/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7fa7c8667f10d8b246175e238b331c9e17a8fbf --- /dev/null +++ b/codenet/public_test_cases/p03903/input.0.txt @@ -0,0 +1,7 @@ +4 3 +1 2 3 +2 3 4 +3 4 5 +2 +2 3 +1 4 diff --git a/codenet/public_test_cases/p03903/input.1.txt b/codenet/public_test_cases/p03903/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c95759d82d02e4ad308d07edb8e2a1b10bff33aa --- /dev/null +++ b/codenet/public_test_cases/p03903/input.1.txt @@ -0,0 +1,9 @@ +4 6 +1 3 5 +4 1 10 +2 4 6 +3 2 2 +3 4 5 +2 1 3 +1 +2 3 diff --git a/codenet/public_test_cases/p03903/input.2.txt b/codenet/public_test_cases/p03903/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7fa7c8667f10d8b246175e238b331c9e17a8fbf --- /dev/null +++ b/codenet/public_test_cases/p03903/input.2.txt @@ -0,0 +1,7 @@ +4 3 +1 2 3 +2 3 4 +3 4 5 +2 +2 3 +1 4 diff --git a/codenet/public_test_cases/p03903/output.0.txt b/codenet/public_test_cases/p03903/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c52c0341c4b5bda02afb9813365631e97fa2bff7 --- /dev/null +++ b/codenet/public_test_cases/p03903/output.0.txt @@ -0,0 +1,2 @@ +8 +7 diff --git a/codenet/public_test_cases/p03903/output.1.txt b/codenet/public_test_cases/p03903/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03903/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03903/output.2.txt b/codenet/public_test_cases/p03903/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c52c0341c4b5bda02afb9813365631e97fa2bff7 --- /dev/null +++ b/codenet/public_test_cases/p03903/output.2.txt @@ -0,0 +1,2 @@ +8 +7 diff --git a/codenet/public_test_cases/p03904/input.0.txt b/codenet/public_test_cases/p03904/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ac11ed22082c3986e6361bfea57d1897281a4c2 --- /dev/null +++ b/codenet/public_test_cases/p03904/input.0.txt @@ -0,0 +1,2 @@ +2 +15267315 diff --git a/codenet/public_test_cases/p03904/input.1.txt b/codenet/public_test_cases/p03904/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b49021bfabafc193f40c85dbe2180091556e3f53 --- /dev/null +++ b/codenet/public_test_cases/p03904/input.1.txt @@ -0,0 +1,2 @@ +8 +127356176351764127645176543176531763517635176531278461856198765816581726586715987216581 diff --git a/codenet/public_test_cases/p03904/input.2.txt b/codenet/public_test_cases/p03904/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ac11ed22082c3986e6361bfea57d1897281a4c2 --- /dev/null +++ b/codenet/public_test_cases/p03904/input.2.txt @@ -0,0 +1,2 @@ +2 +15267315 diff --git a/codenet/public_test_cases/p03904/input.3.txt b/codenet/public_test_cases/p03904/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1a61cf61fa2a1a954b60e08cbbac1d5f19fdf1f --- /dev/null +++ b/codenet/public_test_cases/p03904/input.3.txt @@ -0,0 +1,2 @@ +0 +12456174517653111 diff --git a/codenet/public_test_cases/p03904/output.0.txt b/codenet/public_test_cases/p03904/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..66953656a205bd743475fa76b8e4ea6ee3076b3a --- /dev/null +++ b/codenet/public_test_cases/p03904/output.0.txt @@ -0,0 +1 @@ +315 diff --git a/codenet/public_test_cases/p03904/output.1.txt b/codenet/public_test_cases/p03904/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7c9ffedb86fa271159dfea6d03eb86881577fe4 --- /dev/null +++ b/codenet/public_test_cases/p03904/output.1.txt @@ -0,0 +1 @@ +5317635176 diff --git a/codenet/public_test_cases/p03904/output.2.txt b/codenet/public_test_cases/p03904/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..66953656a205bd743475fa76b8e4ea6ee3076b3a --- /dev/null +++ b/codenet/public_test_cases/p03904/output.2.txt @@ -0,0 +1 @@ +315 diff --git a/codenet/public_test_cases/p03904/output.3.txt b/codenet/public_test_cases/p03904/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..32432f2facdfda772feeb0d43cbd264ce8271123 --- /dev/null +++ b/codenet/public_test_cases/p03904/output.3.txt @@ -0,0 +1 @@ +12456174517653111 diff --git a/codenet/public_test_cases/p03905/input.0.txt b/codenet/public_test_cases/p03905/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55a59007689e66009da1c61b950d7cb8fce223b9 --- /dev/null +++ b/codenet/public_test_cases/p03905/input.0.txt @@ -0,0 +1,5 @@ +4 +0 1 +1 0 +1 1 +2 1 diff --git a/codenet/public_test_cases/p03905/output.0.txt b/codenet/public_test_cases/p03905/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03905/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03906/input.0.txt b/codenet/public_test_cases/p03906/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..370b467635b44838e9289ec462174adc5dcb118f --- /dev/null +++ b/codenet/public_test_cases/p03906/input.0.txt @@ -0,0 +1,2 @@ +3 +43 24 37 diff --git a/codenet/public_test_cases/p03906/output.0.txt b/codenet/public_test_cases/p03906/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03906/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03907/input.0.txt b/codenet/public_test_cases/p03907/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..55a59007689e66009da1c61b950d7cb8fce223b9 --- /dev/null +++ b/codenet/public_test_cases/p03907/input.0.txt @@ -0,0 +1,5 @@ +4 +0 1 +1 0 +1 1 +2 1 diff --git a/codenet/public_test_cases/p03907/input.1.txt b/codenet/public_test_cases/p03907/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6572807d955643cafc016aafe313b3a4057e5df --- /dev/null +++ b/codenet/public_test_cases/p03907/input.1.txt @@ -0,0 +1,4 @@ +3 +0 1 +1 0 +2 2 diff --git a/codenet/public_test_cases/p03907/input.2.txt b/codenet/public_test_cases/p03907/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..55a59007689e66009da1c61b950d7cb8fce223b9 --- /dev/null +++ b/codenet/public_test_cases/p03907/input.2.txt @@ -0,0 +1,5 @@ +4 +0 1 +1 0 +1 1 +2 1 diff --git a/codenet/public_test_cases/p03907/output.0.txt b/codenet/public_test_cases/p03907/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03907/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03907/output.1.txt b/codenet/public_test_cases/p03907/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03907/output.1.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03907/output.2.txt b/codenet/public_test_cases/p03907/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03907/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03908/input.0.txt b/codenet/public_test_cases/p03908/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..370b467635b44838e9289ec462174adc5dcb118f --- /dev/null +++ b/codenet/public_test_cases/p03908/input.0.txt @@ -0,0 +1,2 @@ +3 +43 24 37 diff --git a/codenet/public_test_cases/p03908/input.1.txt b/codenet/public_test_cases/p03908/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..370b467635b44838e9289ec462174adc5dcb118f --- /dev/null +++ b/codenet/public_test_cases/p03908/input.1.txt @@ -0,0 +1,2 @@ +3 +43 24 37 diff --git a/codenet/public_test_cases/p03908/input.2.txt b/codenet/public_test_cases/p03908/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e8d26e0418020903d7479e954eec4b7bfd06178 --- /dev/null +++ b/codenet/public_test_cases/p03908/input.2.txt @@ -0,0 +1,2 @@ +5 +49735011221 970534221705 411566391637 760836201000 563515091165 diff --git a/codenet/public_test_cases/p03908/output.0.txt b/codenet/public_test_cases/p03908/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03908/output.0.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03908/output.1.txt b/codenet/public_test_cases/p03908/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03908/output.1.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03908/output.2.txt b/codenet/public_test_cases/p03908/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f96ac06721837aa6a644a580c03c76f304e81db0 --- /dev/null +++ b/codenet/public_test_cases/p03908/output.2.txt @@ -0,0 +1 @@ +105 diff --git a/codenet/public_test_cases/p03909/input.0.txt b/codenet/public_test_cases/p03909/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cffe64bea1b257eafe3b5c8edc77f8f1171e895b --- /dev/null +++ b/codenet/public_test_cases/p03909/input.0.txt @@ -0,0 +1,16 @@ +15 10 +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snuke snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake diff --git a/codenet/public_test_cases/p03909/input.1.txt b/codenet/public_test_cases/p03909/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cffe64bea1b257eafe3b5c8edc77f8f1171e895b --- /dev/null +++ b/codenet/public_test_cases/p03909/input.1.txt @@ -0,0 +1,16 @@ +15 10 +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snuke snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake diff --git a/codenet/public_test_cases/p03909/input.2.txt b/codenet/public_test_cases/p03909/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e797d8d7fa91dde201bc2ac2a91e8196ec940b16 --- /dev/null +++ b/codenet/public_test_cases/p03909/input.2.txt @@ -0,0 +1,2 @@ +1 1 +snuke diff --git a/codenet/public_test_cases/p03909/output.0.txt b/codenet/public_test_cases/p03909/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..36e957ec5e3131a68548f5f15805715ef4d70320 --- /dev/null +++ b/codenet/public_test_cases/p03909/output.0.txt @@ -0,0 +1 @@ +H6 diff --git a/codenet/public_test_cases/p03909/output.1.txt b/codenet/public_test_cases/p03909/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..36e957ec5e3131a68548f5f15805715ef4d70320 --- /dev/null +++ b/codenet/public_test_cases/p03909/output.1.txt @@ -0,0 +1 @@ +H6 diff --git a/codenet/public_test_cases/p03909/output.2.txt b/codenet/public_test_cases/p03909/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e6fea0beb6ee8f1b3af7b1f554fe0231dc97016 --- /dev/null +++ b/codenet/public_test_cases/p03909/output.2.txt @@ -0,0 +1 @@ +A1 diff --git a/codenet/public_test_cases/p03910/input.0.txt b/codenet/public_test_cases/p03910/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03910/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03910/input.1.txt b/codenet/public_test_cases/p03910/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03910/input.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03910/input.2.txt b/codenet/public_test_cases/p03910/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03910/input.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03910/input.3.txt b/codenet/public_test_cases/p03910/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03910/input.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03910/output.0.txt b/codenet/public_test_cases/p03910/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p03910/output.0.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p03910/output.1.txt b/codenet/public_test_cases/p03910/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p03910/output.1.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p03910/output.2.txt b/codenet/public_test_cases/p03910/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8a01cd985125a824409ef6b2f264c76b54ffe6a --- /dev/null +++ b/codenet/public_test_cases/p03910/output.2.txt @@ -0,0 +1,3 @@ +1 +2 +4 diff --git a/codenet/public_test_cases/p03910/output.3.txt b/codenet/public_test_cases/p03910/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03910/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03911/input.0.txt b/codenet/public_test_cases/p03911/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a9e0fbff537a0bb6c2227e168496f1c64ce9994 --- /dev/null +++ b/codenet/public_test_cases/p03911/input.0.txt @@ -0,0 +1,5 @@ +4 6 +3 1 2 3 +2 4 2 +2 4 6 +1 6 diff --git a/codenet/public_test_cases/p03911/output.0.txt b/codenet/public_test_cases/p03911/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03911/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03912/input.0.txt b/codenet/public_test_cases/p03912/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5a5ef34631ef24e353ec9100b6fc9c1a7cbd9fc --- /dev/null +++ b/codenet/public_test_cases/p03912/input.0.txt @@ -0,0 +1,2 @@ +7 5 +3 1 4 1 5 9 2 diff --git a/codenet/public_test_cases/p03912/output.0.txt b/codenet/public_test_cases/p03912/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03912/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03913/input.0.txt b/codenet/public_test_cases/p03913/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af989859a6a6db64e78a7df7edcdbf3d495948d9 --- /dev/null +++ b/codenet/public_test_cases/p03913/input.0.txt @@ -0,0 +1 @@ +8 1 diff --git a/codenet/public_test_cases/p03913/input.1.txt b/codenet/public_test_cases/p03913/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0d1892bdf7bd3b3242f6ee4273434a206327d21 --- /dev/null +++ b/codenet/public_test_cases/p03913/input.1.txt @@ -0,0 +1 @@ +1000000000000 1000000000000 diff --git a/codenet/public_test_cases/p03913/input.2.txt b/codenet/public_test_cases/p03913/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..af989859a6a6db64e78a7df7edcdbf3d495948d9 --- /dev/null +++ b/codenet/public_test_cases/p03913/input.2.txt @@ -0,0 +1 @@ +8 1 diff --git a/codenet/public_test_cases/p03913/output.0.txt b/codenet/public_test_cases/p03913/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03913/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03913/output.1.txt b/codenet/public_test_cases/p03913/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6ee9012f2ab8aa0961ad84e2066b4518eafea4f --- /dev/null +++ b/codenet/public_test_cases/p03913/output.1.txt @@ -0,0 +1 @@ +1000000000000 diff --git a/codenet/public_test_cases/p03913/output.2.txt b/codenet/public_test_cases/p03913/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03913/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03914/input.0.txt b/codenet/public_test_cases/p03914/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p03914/input.0.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p03914/input.1.txt b/codenet/public_test_cases/p03914/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p03914/input.1.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p03914/input.2.txt b/codenet/public_test_cases/p03914/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bc9bfb343f33d5c97ae86d1f8060695e024adce --- /dev/null +++ b/codenet/public_test_cases/p03914/input.2.txt @@ -0,0 +1 @@ +150 300 diff --git a/codenet/public_test_cases/p03914/input.3.txt b/codenet/public_test_cases/p03914/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..badfc1a91ddc13e67184e8031f458cc874e044a2 --- /dev/null +++ b/codenet/public_test_cases/p03914/input.3.txt @@ -0,0 +1 @@ +300 150 diff --git a/codenet/public_test_cases/p03914/output.0.txt b/codenet/public_test_cases/p03914/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03914/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03914/output.1.txt b/codenet/public_test_cases/p03914/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03914/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03914/output.2.txt b/codenet/public_test_cases/p03914/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6ca611cfbe37f5c53022d63e3c8b9881a8ff6d2 --- /dev/null +++ b/codenet/public_test_cases/p03914/output.2.txt @@ -0,0 +1 @@ +734286322 diff --git a/codenet/public_test_cases/p03914/output.3.txt b/codenet/public_test_cases/p03914/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03914/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03915/input.0.txt b/codenet/public_test_cases/p03915/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c26866c8cf9a3352a7297951b085a24398b498fc --- /dev/null +++ b/codenet/public_test_cases/p03915/input.0.txt @@ -0,0 +1,2 @@ +7 1 +5 2 1 diff --git a/codenet/public_test_cases/p03915/input.1.txt b/codenet/public_test_cases/p03915/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c26866c8cf9a3352a7297951b085a24398b498fc --- /dev/null +++ b/codenet/public_test_cases/p03915/input.1.txt @@ -0,0 +1,2 @@ +7 1 +5 2 1 diff --git a/codenet/public_test_cases/p03915/input.2.txt b/codenet/public_test_cases/p03915/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e1fe15e48a7647e040e2cd8e17c41c2fb09b5fb --- /dev/null +++ b/codenet/public_test_cases/p03915/input.2.txt @@ -0,0 +1,2 @@ +2 1 +0 0 1000000000 diff --git a/codenet/public_test_cases/p03915/input.3.txt b/codenet/public_test_cases/p03915/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9012ac4d904881a193328d2277e1fab8133791c --- /dev/null +++ b/codenet/public_test_cases/p03915/input.3.txt @@ -0,0 +1,4 @@ +5 3 +0 1 10 +0 2 10 +0 4 10 diff --git a/codenet/public_test_cases/p03915/output.0.txt b/codenet/public_test_cases/p03915/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03915/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03915/output.1.txt b/codenet/public_test_cases/p03915/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03915/output.1.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03915/output.2.txt b/codenet/public_test_cases/p03915/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a528ed87320071ba84058bf3cd59e85b5bb7fd7d --- /dev/null +++ b/codenet/public_test_cases/p03915/output.2.txt @@ -0,0 +1 @@ +1000000001 diff --git a/codenet/public_test_cases/p03915/output.3.txt b/codenet/public_test_cases/p03915/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d81cc0710eb6cf9efd5b920a8453e1e07157b6cd --- /dev/null +++ b/codenet/public_test_cases/p03915/output.3.txt @@ -0,0 +1 @@ +42 diff --git a/codenet/public_test_cases/p03916/input.0.txt b/codenet/public_test_cases/p03916/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca282344e3862acbb16958e0ca0539eec3540e52 --- /dev/null +++ b/codenet/public_test_cases/p03916/input.0.txt @@ -0,0 +1,4 @@ +5 +2 7 1 8 +1 +2 diff --git a/codenet/public_test_cases/p03916/input.1.txt b/codenet/public_test_cases/p03916/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5638b1a82fa5a06c7a9ccb64178fdb9915800551 --- /dev/null +++ b/codenet/public_test_cases/p03916/input.1.txt @@ -0,0 +1,8 @@ +9 +2 0 1 6 1 1 2 6 +5 +2016 +1 +1 +2 +6 diff --git a/codenet/public_test_cases/p03916/input.2.txt b/codenet/public_test_cases/p03916/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca282344e3862acbb16958e0ca0539eec3540e52 --- /dev/null +++ b/codenet/public_test_cases/p03916/input.2.txt @@ -0,0 +1,4 @@ +5 +2 7 1 8 +1 +2 diff --git a/codenet/public_test_cases/p03916/output.0.txt b/codenet/public_test_cases/p03916/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03916/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03916/output.1.txt b/codenet/public_test_cases/p03916/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..24afd3145e362ba133a7918064d9a9d1ee7af379 --- /dev/null +++ b/codenet/public_test_cases/p03916/output.1.txt @@ -0,0 +1,5 @@ +2001 +6 +6 +7 +7 diff --git a/codenet/public_test_cases/p03916/output.2.txt b/codenet/public_test_cases/p03916/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03916/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03917/input.0.txt b/codenet/public_test_cases/p03917/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4bcb653cd341dab24438edda0e4ff1e13cc6894 --- /dev/null +++ b/codenet/public_test_cases/p03917/input.0.txt @@ -0,0 +1,3 @@ +2 2 +cf +cf diff --git a/codenet/public_test_cases/p03917/input.1.txt b/codenet/public_test_cases/p03917/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4bcb653cd341dab24438edda0e4ff1e13cc6894 --- /dev/null +++ b/codenet/public_test_cases/p03917/input.1.txt @@ -0,0 +1,3 @@ +2 2 +cf +cf diff --git a/codenet/public_test_cases/p03917/input.2.txt b/codenet/public_test_cases/p03917/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c6a3e7e40e03ece591b12035ce14309b4317c12 --- /dev/null +++ b/codenet/public_test_cases/p03917/input.2.txt @@ -0,0 +1,2 @@ +1 12 +codefestival diff --git a/codenet/public_test_cases/p03917/output.0.txt b/codenet/public_test_cases/p03917/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03917/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03917/output.1.txt b/codenet/public_test_cases/p03917/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03917/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03917/output.2.txt b/codenet/public_test_cases/p03917/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03917/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03918/input.0.txt b/codenet/public_test_cases/p03918/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b6e3d382e0556652a0e991101bc2492b3781ac1 --- /dev/null +++ b/codenet/public_test_cases/p03918/input.0.txt @@ -0,0 +1,5 @@ +3 +0 0 1 +1 1 0 +3 0 1 +0 1 1 diff --git a/codenet/public_test_cases/p03918/input.1.txt b/codenet/public_test_cases/p03918/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2863aba2f26c40572c00d9f8bd7f27c9ffebb15a --- /dev/null +++ b/codenet/public_test_cases/p03918/input.1.txt @@ -0,0 +1,5 @@ +2 +2 0 +2 0 +0 0 +0 0 diff --git a/codenet/public_test_cases/p03918/input.2.txt b/codenet/public_test_cases/p03918/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b6e3d382e0556652a0e991101bc2492b3781ac1 --- /dev/null +++ b/codenet/public_test_cases/p03918/input.2.txt @@ -0,0 +1,5 @@ +3 +0 0 1 +1 1 0 +3 0 1 +0 1 1 diff --git a/codenet/public_test_cases/p03918/output.0.txt b/codenet/public_test_cases/p03918/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0875097253c9ec05135d0569c2f7f60f764afb57 --- /dev/null +++ b/codenet/public_test_cases/p03918/output.0.txt @@ -0,0 +1,9 @@ +L1 +L1 +L1 +L3 +D1 +R2 +U3 +R3 +D2 diff --git a/codenet/public_test_cases/p03918/output.1.txt b/codenet/public_test_cases/p03918/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03918/output.1.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03918/output.2.txt b/codenet/public_test_cases/p03918/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0875097253c9ec05135d0569c2f7f60f764afb57 --- /dev/null +++ b/codenet/public_test_cases/p03918/output.2.txt @@ -0,0 +1,9 @@ +L1 +L1 +L1 +L3 +D1 +R2 +U3 +R3 +D2 diff --git a/codenet/public_test_cases/p03919/input.0.txt b/codenet/public_test_cases/p03919/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cffe64bea1b257eafe3b5c8edc77f8f1171e895b --- /dev/null +++ b/codenet/public_test_cases/p03919/input.0.txt @@ -0,0 +1,16 @@ +15 10 +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snuke snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake +snake snake snake snake snake snake snake snake snake snake diff --git a/codenet/public_test_cases/p03919/output.0.txt b/codenet/public_test_cases/p03919/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..36e957ec5e3131a68548f5f15805715ef4d70320 --- /dev/null +++ b/codenet/public_test_cases/p03919/output.0.txt @@ -0,0 +1 @@ +H6 diff --git a/codenet/public_test_cases/p03920/input.0.txt b/codenet/public_test_cases/p03920/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03920/input.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03920/output.0.txt b/codenet/public_test_cases/p03920/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2f2e1b9261c50c3816610eb3eb140fabf1745a --- /dev/null +++ b/codenet/public_test_cases/p03920/output.0.txt @@ -0,0 +1,2 @@ +1 +3 diff --git a/codenet/public_test_cases/p03921/input.0.txt b/codenet/public_test_cases/p03921/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a9e0fbff537a0bb6c2227e168496f1c64ce9994 --- /dev/null +++ b/codenet/public_test_cases/p03921/input.0.txt @@ -0,0 +1,5 @@ +4 6 +3 1 2 3 +2 4 2 +2 4 6 +1 6 diff --git a/codenet/public_test_cases/p03921/input.1.txt b/codenet/public_test_cases/p03921/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a9e0fbff537a0bb6c2227e168496f1c64ce9994 --- /dev/null +++ b/codenet/public_test_cases/p03921/input.1.txt @@ -0,0 +1,5 @@ +4 6 +3 1 2 3 +2 4 2 +2 4 6 +1 6 diff --git a/codenet/public_test_cases/p03921/input.2.txt b/codenet/public_test_cases/p03921/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..eeb3449f278467829ff150a4e443113678d99ee6 --- /dev/null +++ b/codenet/public_test_cases/p03921/input.2.txt @@ -0,0 +1,5 @@ +4 4 +2 1 2 +2 1 2 +1 3 +2 4 3 diff --git a/codenet/public_test_cases/p03921/output.0.txt b/codenet/public_test_cases/p03921/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03921/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03921/output.1.txt b/codenet/public_test_cases/p03921/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p03921/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p03921/output.2.txt b/codenet/public_test_cases/p03921/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p03921/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p03922/input.0.txt b/codenet/public_test_cases/p03922/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5a5ef34631ef24e353ec9100b6fc9c1a7cbd9fc --- /dev/null +++ b/codenet/public_test_cases/p03922/input.0.txt @@ -0,0 +1,2 @@ +7 5 +3 1 4 1 5 9 2 diff --git a/codenet/public_test_cases/p03922/input.1.txt b/codenet/public_test_cases/p03922/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e5a5ef34631ef24e353ec9100b6fc9c1a7cbd9fc --- /dev/null +++ b/codenet/public_test_cases/p03922/input.1.txt @@ -0,0 +1,2 @@ +7 5 +3 1 4 1 5 9 2 diff --git a/codenet/public_test_cases/p03922/input.2.txt b/codenet/public_test_cases/p03922/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbcce0bcf01ce9ea49118bcd8c018c3b39ec1ad8 --- /dev/null +++ b/codenet/public_test_cases/p03922/input.2.txt @@ -0,0 +1,2 @@ +15 10 +1 5 6 10 11 11 11 20 21 25 25 26 99 99 99 diff --git a/codenet/public_test_cases/p03922/output.0.txt b/codenet/public_test_cases/p03922/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03922/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03922/output.1.txt b/codenet/public_test_cases/p03922/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03922/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03922/output.2.txt b/codenet/public_test_cases/p03922/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03922/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03923/input.0.txt b/codenet/public_test_cases/p03923/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..af989859a6a6db64e78a7df7edcdbf3d495948d9 --- /dev/null +++ b/codenet/public_test_cases/p03923/input.0.txt @@ -0,0 +1 @@ +8 1 diff --git a/codenet/public_test_cases/p03923/output.0.txt b/codenet/public_test_cases/p03923/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03923/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03924/input.0.txt b/codenet/public_test_cases/p03924/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac81dc6c529dd3ba045aa25a75933ff6b8539a39 --- /dev/null +++ b/codenet/public_test_cases/p03924/input.0.txt @@ -0,0 +1 @@ +3 3 diff --git a/codenet/public_test_cases/p03924/output.0.txt b/codenet/public_test_cases/p03924/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03924/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03925/input.0.txt b/codenet/public_test_cases/p03925/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c26866c8cf9a3352a7297951b085a24398b498fc --- /dev/null +++ b/codenet/public_test_cases/p03925/input.0.txt @@ -0,0 +1,2 @@ +7 1 +5 2 1 diff --git a/codenet/public_test_cases/p03925/output.0.txt b/codenet/public_test_cases/p03925/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03925/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03926/input.0.txt b/codenet/public_test_cases/p03926/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca282344e3862acbb16958e0ca0539eec3540e52 --- /dev/null +++ b/codenet/public_test_cases/p03926/input.0.txt @@ -0,0 +1,4 @@ +5 +2 7 1 8 +1 +2 diff --git a/codenet/public_test_cases/p03926/output.0.txt b/codenet/public_test_cases/p03926/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03926/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03927/input.0.txt b/codenet/public_test_cases/p03927/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4bcb653cd341dab24438edda0e4ff1e13cc6894 --- /dev/null +++ b/codenet/public_test_cases/p03927/input.0.txt @@ -0,0 +1,3 @@ +2 2 +cf +cf diff --git a/codenet/public_test_cases/p03927/output.0.txt b/codenet/public_test_cases/p03927/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03927/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03928/input.0.txt b/codenet/public_test_cases/p03928/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b6e3d382e0556652a0e991101bc2492b3781ac1 --- /dev/null +++ b/codenet/public_test_cases/p03928/input.0.txt @@ -0,0 +1,5 @@ +3 +0 0 1 +1 1 0 +3 0 1 +0 1 1 diff --git a/codenet/public_test_cases/p03928/output.0.txt b/codenet/public_test_cases/p03928/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0875097253c9ec05135d0569c2f7f60f764afb57 --- /dev/null +++ b/codenet/public_test_cases/p03928/output.0.txt @@ -0,0 +1,9 @@ +L1 +L1 +L1 +L3 +D1 +R2 +U3 +R3 +D2 diff --git a/codenet/public_test_cases/p03929/input.0.txt b/codenet/public_test_cases/p03929/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..11c8dd7f2c36bdd2f4603cd9e82c497036c78f61 --- /dev/null +++ b/codenet/public_test_cases/p03929/input.0.txt @@ -0,0 +1 @@ +7 7 diff --git a/codenet/public_test_cases/p03929/output.0.txt b/codenet/public_test_cases/p03929/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03929/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03931/input.0.txt b/codenet/public_test_cases/p03931/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6f19c987b62beffd30898dd2b738b8e263f50d6 --- /dev/null +++ b/codenet/public_test_cases/p03931/input.0.txt @@ -0,0 +1,2 @@ +3 1 +1 2 3 diff --git a/codenet/public_test_cases/p03931/input.1.txt b/codenet/public_test_cases/p03931/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b0dd705ae64fd83ccb0bcc583cba1511e4ec1a9 --- /dev/null +++ b/codenet/public_test_cases/p03931/input.1.txt @@ -0,0 +1,2 @@ +25 127 +5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 diff --git a/codenet/public_test_cases/p03931/input.2.txt b/codenet/public_test_cases/p03931/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6f19c987b62beffd30898dd2b738b8e263f50d6 --- /dev/null +++ b/codenet/public_test_cases/p03931/input.2.txt @@ -0,0 +1,2 @@ +3 1 +1 2 3 diff --git a/codenet/public_test_cases/p03931/input.3.txt b/codenet/public_test_cases/p03931/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..17cb8d1a96ca2be4364ef10f278a62b08773cf10 --- /dev/null +++ b/codenet/public_test_cases/p03931/input.3.txt @@ -0,0 +1,2 @@ +3 10 +8 7 5 diff --git a/codenet/public_test_cases/p03931/output.0.txt b/codenet/public_test_cases/p03931/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03931/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03931/output.1.txt b/codenet/public_test_cases/p03931/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e9a42827bea1973b9408ac466875a5769beef23 --- /dev/null +++ b/codenet/public_test_cases/p03931/output.1.txt @@ -0,0 +1 @@ +235924722 diff --git a/codenet/public_test_cases/p03931/output.2.txt b/codenet/public_test_cases/p03931/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03931/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03931/output.3.txt b/codenet/public_test_cases/p03931/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03931/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03932/input.0.txt b/codenet/public_test_cases/p03932/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb6c4129d94104e15c479f988974ba48a7d61389 --- /dev/null +++ b/codenet/public_test_cases/p03932/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 0 5 +2 2 3 +4 2 4 diff --git a/codenet/public_test_cases/p03932/input.1.txt b/codenet/public_test_cases/p03932/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd3cf73cb65e479f06d360c71f8e7ba92cf388a3 --- /dev/null +++ b/codenet/public_test_cases/p03932/input.1.txt @@ -0,0 +1,7 @@ +6 6 +1 2 3 4 5 6 +8 6 9 1 2 0 +3 1 4 1 5 9 +2 6 5 3 5 8 +1 4 1 4 2 1 +2 7 1 8 2 8 diff --git a/codenet/public_test_cases/p03932/input.2.txt b/codenet/public_test_cases/p03932/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb6c4129d94104e15c479f988974ba48a7d61389 --- /dev/null +++ b/codenet/public_test_cases/p03932/input.2.txt @@ -0,0 +1,4 @@ +3 3 +1 0 5 +2 2 3 +4 2 4 diff --git a/codenet/public_test_cases/p03932/output.0.txt b/codenet/public_test_cases/p03932/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03932/output.0.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03932/output.1.txt b/codenet/public_test_cases/p03932/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c17e934b51c1f08a2b3056e4cd63fe62d111672d --- /dev/null +++ b/codenet/public_test_cases/p03932/output.1.txt @@ -0,0 +1 @@ +97 diff --git a/codenet/public_test_cases/p03932/output.2.txt b/codenet/public_test_cases/p03932/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03932/output.2.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03933/input.0.txt b/codenet/public_test_cases/p03933/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p03933/input.0.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p03933/input.1.txt b/codenet/public_test_cases/p03933/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p03933/input.1.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p03933/input.2.txt b/codenet/public_test_cases/p03933/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8585e8227b0ed39229d096fa1ebeade239ca9dd3 --- /dev/null +++ b/codenet/public_test_cases/p03933/input.2.txt @@ -0,0 +1 @@ +12 220 diff --git a/codenet/public_test_cases/p03933/input.3.txt b/codenet/public_test_cases/p03933/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c7907f9ed995225a618e238435cf68b9cf6cd06 --- /dev/null +++ b/codenet/public_test_cases/p03933/input.3.txt @@ -0,0 +1 @@ +6 9 diff --git a/codenet/public_test_cases/p03933/output.0.txt b/codenet/public_test_cases/p03933/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0052626b462e41304cca2575da304eb5117e90d3 --- /dev/null +++ b/codenet/public_test_cases/p03933/output.0.txt @@ -0,0 +1 @@ +1.0000000000000 diff --git a/codenet/public_test_cases/p03933/output.1.txt b/codenet/public_test_cases/p03933/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0052626b462e41304cca2575da304eb5117e90d3 --- /dev/null +++ b/codenet/public_test_cases/p03933/output.1.txt @@ -0,0 +1 @@ +1.0000000000000 diff --git a/codenet/public_test_cases/p03933/output.2.txt b/codenet/public_test_cases/p03933/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c52dec16377f02dec04b1d97344d9c0d10d0fc5e --- /dev/null +++ b/codenet/public_test_cases/p03933/output.2.txt @@ -0,0 +1 @@ +1.29903810568 diff --git a/codenet/public_test_cases/p03933/output.3.txt b/codenet/public_test_cases/p03933/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eb7709fdb9718ec60d11b4fed0f3c5e7ac1e87f --- /dev/null +++ b/codenet/public_test_cases/p03933/output.3.txt @@ -0,0 +1 @@ +0.86602540378 diff --git a/codenet/public_test_cases/p03934/input.0.txt b/codenet/public_test_cases/p03934/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a84cefc5514f91746ec95c9ec9702d87f7aec031 --- /dev/null +++ b/codenet/public_test_cases/p03934/input.0.txt @@ -0,0 +1,4 @@ +9 3 +5 11 +8 4 +4 7 diff --git a/codenet/public_test_cases/p03934/input.1.txt b/codenet/public_test_cases/p03934/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ec65aee98f3c3751988e08afa467751bd7d5990 --- /dev/null +++ b/codenet/public_test_cases/p03934/input.1.txt @@ -0,0 +1,7 @@ +6 6 +3 5 +6 11 +1 6 +4 7 +5 2 +2 5 diff --git a/codenet/public_test_cases/p03934/input.2.txt b/codenet/public_test_cases/p03934/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a84cefc5514f91746ec95c9ec9702d87f7aec031 --- /dev/null +++ b/codenet/public_test_cases/p03934/input.2.txt @@ -0,0 +1,4 @@ +9 3 +5 11 +8 4 +4 7 diff --git a/codenet/public_test_cases/p03934/input.3.txt b/codenet/public_test_cases/p03934/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b84405095a8e5b7e75d511b064f10977adbd645d --- /dev/null +++ b/codenet/public_test_cases/p03934/input.3.txt @@ -0,0 +1,7 @@ +5 6 +1 1 +2 1 +3 1 +1 1 +5 1 +3 1 diff --git a/codenet/public_test_cases/p03934/input.4.txt b/codenet/public_test_cases/p03934/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4f024d7210348548f88085727e0f942cfdbfc49 --- /dev/null +++ b/codenet/public_test_cases/p03934/input.4.txt @@ -0,0 +1,11 @@ +10 10 +10 10 +9 20 +8 30 +7 40 +6 50 +5 60 +4 70 +3 80 +2 90 +1 100 diff --git a/codenet/public_test_cases/p03934/output.0.txt b/codenet/public_test_cases/p03934/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31de5e4a1fae8e83cd7a09601511b7d579bb79ee --- /dev/null +++ b/codenet/public_test_cases/p03934/output.0.txt @@ -0,0 +1,9 @@ +4 +4 +4 +4 +2 +2 +1 +1 +0 diff --git a/codenet/public_test_cases/p03934/output.1.txt b/codenet/public_test_cases/p03934/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9dd8a629004e48402071881af89a58d0d85cbcde --- /dev/null +++ b/codenet/public_test_cases/p03934/output.1.txt @@ -0,0 +1,6 @@ +10 +10 +5 +5 +4 +2 diff --git a/codenet/public_test_cases/p03934/output.2.txt b/codenet/public_test_cases/p03934/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..31de5e4a1fae8e83cd7a09601511b7d579bb79ee --- /dev/null +++ b/codenet/public_test_cases/p03934/output.2.txt @@ -0,0 +1,9 @@ +4 +4 +4 +4 +2 +2 +1 +1 +0 diff --git a/codenet/public_test_cases/p03934/output.3.txt b/codenet/public_test_cases/p03934/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e12b8a9216ea2c83be4943c19fbbae1430277bf0 --- /dev/null +++ b/codenet/public_test_cases/p03934/output.3.txt @@ -0,0 +1,5 @@ +2 +2 +1 +1 +0 diff --git a/codenet/public_test_cases/p03934/output.4.txt b/codenet/public_test_cases/p03934/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..943c47d100ad5acfedbb210dcb330855039f1a88 --- /dev/null +++ b/codenet/public_test_cases/p03934/output.4.txt @@ -0,0 +1,10 @@ +223 +123 +77 +50 +33 +21 +12 +7 +3 +1 diff --git a/codenet/public_test_cases/p03935/input.0.txt b/codenet/public_test_cases/p03935/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ac1165e4c0945867839c19fec5e93993649bbef --- /dev/null +++ b/codenet/public_test_cases/p03935/input.0.txt @@ -0,0 +1 @@ +4 7 diff --git a/codenet/public_test_cases/p03935/input.1.txt b/codenet/public_test_cases/p03935/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ac1165e4c0945867839c19fec5e93993649bbef --- /dev/null +++ b/codenet/public_test_cases/p03935/input.1.txt @@ -0,0 +1 @@ +4 7 diff --git a/codenet/public_test_cases/p03935/input.2.txt b/codenet/public_test_cases/p03935/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db422711562179475058321c1e9ba6f490f51421 --- /dev/null +++ b/codenet/public_test_cases/p03935/input.2.txt @@ -0,0 +1 @@ +12 20 diff --git a/codenet/public_test_cases/p03935/input.3.txt b/codenet/public_test_cases/p03935/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4084d94e7dd94a14f3985f0bc77cbf47b9673f02 --- /dev/null +++ b/codenet/public_test_cases/p03935/input.3.txt @@ -0,0 +1 @@ +16 30 diff --git a/codenet/public_test_cases/p03935/output.0.txt b/codenet/public_test_cases/p03935/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1057e9a27306e3e5567c601c522f00dc5ed6698e --- /dev/null +++ b/codenet/public_test_cases/p03935/output.0.txt @@ -0,0 +1 @@ +176 diff --git a/codenet/public_test_cases/p03935/output.1.txt b/codenet/public_test_cases/p03935/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1057e9a27306e3e5567c601c522f00dc5ed6698e --- /dev/null +++ b/codenet/public_test_cases/p03935/output.1.txt @@ -0,0 +1 @@ +176 diff --git a/codenet/public_test_cases/p03935/output.2.txt b/codenet/public_test_cases/p03935/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..63c2e7082ba38fbbe271d2f78d066d4cf0b84a1a --- /dev/null +++ b/codenet/public_test_cases/p03935/output.2.txt @@ -0,0 +1 @@ +174174144 diff --git a/codenet/public_test_cases/p03935/output.3.txt b/codenet/public_test_cases/p03935/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a172647416c81b9cc39585335133d93e3ceda9da --- /dev/null +++ b/codenet/public_test_cases/p03935/output.3.txt @@ -0,0 +1 @@ +102292850 diff --git a/codenet/public_test_cases/p03937/input.0.txt b/codenet/public_test_cases/p03937/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6dff3c7e5c8c94ff17b00917b493956a715316f9 --- /dev/null +++ b/codenet/public_test_cases/p03937/input.0.txt @@ -0,0 +1,5 @@ +4 5 +##... +.##.. +..##. +...## diff --git a/codenet/public_test_cases/p03937/input.1.txt b/codenet/public_test_cases/p03937/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b21594815b6de900fc5343132cf300a0a750c9b3 --- /dev/null +++ b/codenet/public_test_cases/p03937/input.1.txt @@ -0,0 +1,5 @@ +5 3 + +..# + +.. diff --git a/codenet/public_test_cases/p03937/input.2.txt b/codenet/public_test_cases/p03937/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6dff3c7e5c8c94ff17b00917b493956a715316f9 --- /dev/null +++ b/codenet/public_test_cases/p03937/input.2.txt @@ -0,0 +1,5 @@ +4 5 +##... +.##.. +..##. +...## diff --git a/codenet/public_test_cases/p03937/input.3.txt b/codenet/public_test_cases/p03937/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..580bac27d910df0307df8ed06f05cd6c820ed84e --- /dev/null +++ b/codenet/public_test_cases/p03937/input.3.txt @@ -0,0 +1,5 @@ +4 5 +... +.###. +.###. +...## diff --git a/codenet/public_test_cases/p03937/input.4.txt b/codenet/public_test_cases/p03937/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b46552a116c5e0e1e4e98b9d06568746b03c3c49 --- /dev/null +++ b/codenet/public_test_cases/p03937/input.4.txt @@ -0,0 +1,5 @@ +4 5 +... +.##.. +..##. +...## diff --git a/codenet/public_test_cases/p03937/output.0.txt b/codenet/public_test_cases/p03937/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p03937/output.0.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p03937/output.1.txt b/codenet/public_test_cases/p03937/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p03937/output.1.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p03937/output.2.txt b/codenet/public_test_cases/p03937/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p03937/output.2.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p03937/output.3.txt b/codenet/public_test_cases/p03937/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p03937/output.3.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p03937/output.4.txt b/codenet/public_test_cases/p03937/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p03937/output.4.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p03938/input.0.txt b/codenet/public_test_cases/p03938/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p03938/input.0.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p03938/input.1.txt b/codenet/public_test_cases/p03938/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5898906cc695e2f596c5a2686fef39f0284514c0 --- /dev/null +++ b/codenet/public_test_cases/p03938/input.1.txt @@ -0,0 +1,2 @@ +3 +3 2 1 diff --git a/codenet/public_test_cases/p03938/input.2.txt b/codenet/public_test_cases/p03938/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b29044c7562263214ba07e95181d4fffa71da483 --- /dev/null +++ b/codenet/public_test_cases/p03938/input.2.txt @@ -0,0 +1,2 @@ +3 +2 3 1 diff --git a/codenet/public_test_cases/p03938/input.3.txt b/codenet/public_test_cases/p03938/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a789e877c643430c30a51865929c408fd1be22d4 --- /dev/null +++ b/codenet/public_test_cases/p03938/input.3.txt @@ -0,0 +1,2 @@ +2 +1 2 diff --git a/codenet/public_test_cases/p03938/output.0.txt b/codenet/public_test_cases/p03938/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fd114c41aefed78eaa24be39cb6e685d782a451 --- /dev/null +++ b/codenet/public_test_cases/p03938/output.0.txt @@ -0,0 +1,2 @@ +1 4 +5 4 diff --git a/codenet/public_test_cases/p03938/output.1.txt b/codenet/public_test_cases/p03938/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f6391481842ead0e037a7a8f48355327b283e8d --- /dev/null +++ b/codenet/public_test_cases/p03938/output.1.txt @@ -0,0 +1,2 @@ +1 2 3 +5 3 1 diff --git a/codenet/public_test_cases/p03938/output.2.txt b/codenet/public_test_cases/p03938/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f37bad9d5d0c4c54f9f2ace4b7f278dcfb5fa97c --- /dev/null +++ b/codenet/public_test_cases/p03938/output.2.txt @@ -0,0 +1,2 @@ +5 10 100 +100 10 1 diff --git a/codenet/public_test_cases/p03938/output.3.txt b/codenet/public_test_cases/p03938/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fd114c41aefed78eaa24be39cb6e685d782a451 --- /dev/null +++ b/codenet/public_test_cases/p03938/output.3.txt @@ -0,0 +1,2 @@ +1 4 +5 4 diff --git a/codenet/public_test_cases/p03939/input.0.txt b/codenet/public_test_cases/p03939/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ef63d76e86713ac418642c556347aae7ea86ed3 --- /dev/null +++ b/codenet/public_test_cases/p03939/input.0.txt @@ -0,0 +1 @@ +1 3 3 diff --git a/codenet/public_test_cases/p03939/input.1.txt b/codenet/public_test_cases/p03939/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4ef63d76e86713ac418642c556347aae7ea86ed3 --- /dev/null +++ b/codenet/public_test_cases/p03939/input.1.txt @@ -0,0 +1 @@ +1 3 3 diff --git a/codenet/public_test_cases/p03939/input.2.txt b/codenet/public_test_cases/p03939/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f7ca21f62cc452296f2cd11e737889977b95049c --- /dev/null +++ b/codenet/public_test_cases/p03939/input.2.txt @@ -0,0 +1 @@ +1000 100 100 diff --git a/codenet/public_test_cases/p03939/input.3.txt b/codenet/public_test_cases/p03939/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf3b95ccb2dce2dba412eba3a42880252b3238a3 --- /dev/null +++ b/codenet/public_test_cases/p03939/input.3.txt @@ -0,0 +1 @@ +2 1 0 diff --git a/codenet/public_test_cases/p03939/output.0.txt b/codenet/public_test_cases/p03939/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7cc2d57badfff1023a3665689f8840d9afe1370 --- /dev/null +++ b/codenet/public_test_cases/p03939/output.0.txt @@ -0,0 +1 @@ +4.500000000000000 diff --git a/codenet/public_test_cases/p03939/output.1.txt b/codenet/public_test_cases/p03939/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7cc2d57badfff1023a3665689f8840d9afe1370 --- /dev/null +++ b/codenet/public_test_cases/p03939/output.1.txt @@ -0,0 +1 @@ +4.500000000000000 diff --git a/codenet/public_test_cases/p03939/output.2.txt b/codenet/public_test_cases/p03939/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..482f269830ff7100ff855a42a6445378de6e8b98 --- /dev/null +++ b/codenet/public_test_cases/p03939/output.2.txt @@ -0,0 +1 @@ +649620280.957660079002380 diff --git a/codenet/public_test_cases/p03939/output.3.txt b/codenet/public_test_cases/p03939/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f45b7ffd5a15b78dc934dec2ac98819ea6de7fff --- /dev/null +++ b/codenet/public_test_cases/p03939/output.3.txt @@ -0,0 +1 @@ +2.500000000000000 diff --git a/codenet/public_test_cases/p03940/input.0.txt b/codenet/public_test_cases/p03940/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6517df473ed162c8617a66d3a768c0859f07938 --- /dev/null +++ b/codenet/public_test_cases/p03940/input.0.txt @@ -0,0 +1,2 @@ +3 9 1 +1 3 8 diff --git a/codenet/public_test_cases/p03940/input.1.txt b/codenet/public_test_cases/p03940/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6517df473ed162c8617a66d3a768c0859f07938 --- /dev/null +++ b/codenet/public_test_cases/p03940/input.1.txt @@ -0,0 +1,2 @@ +3 9 1 +1 3 8 diff --git a/codenet/public_test_cases/p03940/input.2.txt b/codenet/public_test_cases/p03940/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..24f8dc1e1bd64f38be817319648d343639ecb895 --- /dev/null +++ b/codenet/public_test_cases/p03940/input.2.txt @@ -0,0 +1,2 @@ +2 1000000000 1000000000 +1 999999999 diff --git a/codenet/public_test_cases/p03940/input.3.txt b/codenet/public_test_cases/p03940/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..feea728056bf5c5b0f3588cfb925b13d7bd641da --- /dev/null +++ b/codenet/public_test_cases/p03940/input.3.txt @@ -0,0 +1,2 @@ +3 9 3 +1 3 8 diff --git a/codenet/public_test_cases/p03940/output.0.txt b/codenet/public_test_cases/p03940/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03940/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03940/output.1.txt b/codenet/public_test_cases/p03940/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03940/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03940/output.2.txt b/codenet/public_test_cases/p03940/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9702df67e79499fd3e69dddbcfd583c52905f614 --- /dev/null +++ b/codenet/public_test_cases/p03940/output.2.txt @@ -0,0 +1 @@ +2999999996 diff --git a/codenet/public_test_cases/p03940/output.3.txt b/codenet/public_test_cases/p03940/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03940/output.3.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03941/input.0.txt b/codenet/public_test_cases/p03941/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..53db7bf9499109729d422e0dfa267502950a02c5 --- /dev/null +++ b/codenet/public_test_cases/p03941/input.0.txt @@ -0,0 +1,7 @@ +7 +1 1 +1 1 +2 1 +2 1 +3 1 +3 1 diff --git a/codenet/public_test_cases/p03941/input.1.txt b/codenet/public_test_cases/p03941/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4957980da7a57430a4fdde21348be7057e14a51c --- /dev/null +++ b/codenet/public_test_cases/p03941/input.1.txt @@ -0,0 +1,9 @@ +9 +1 2 +1 2 +3 2 +3 2 +5 2 +5 2 +7 2 +7 2 diff --git a/codenet/public_test_cases/p03941/input.2.txt b/codenet/public_test_cases/p03941/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0158dd7f8869960acd606d272b7e081111d3aab --- /dev/null +++ b/codenet/public_test_cases/p03941/input.2.txt @@ -0,0 +1,3 @@ +3 +1 0 +1 0 diff --git a/codenet/public_test_cases/p03941/input.3.txt b/codenet/public_test_cases/p03941/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..53db7bf9499109729d422e0dfa267502950a02c5 --- /dev/null +++ b/codenet/public_test_cases/p03941/input.3.txt @@ -0,0 +1,7 @@ +7 +1 1 +1 1 +2 1 +2 1 +3 1 +3 1 diff --git a/codenet/public_test_cases/p03941/input.4.txt b/codenet/public_test_cases/p03941/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c499d965bb58cce57c34587d036d01c4df939c8 --- /dev/null +++ b/codenet/public_test_cases/p03941/input.4.txt @@ -0,0 +1,15 @@ +15 +1 2 +1 5 +3 3 +4 3 +4 3 +6 5 +5 4 +5 3 +6 3 +3 2 +11 5 +11 3 +13 2 +13 1 diff --git a/codenet/public_test_cases/p03941/output.0.txt b/codenet/public_test_cases/p03941/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03941/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03941/output.1.txt b/codenet/public_test_cases/p03941/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03941/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03941/output.2.txt b/codenet/public_test_cases/p03941/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03941/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03941/output.3.txt b/codenet/public_test_cases/p03941/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03941/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03941/output.4.txt b/codenet/public_test_cases/p03941/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p03941/output.4.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p03942/input.0.txt b/codenet/public_test_cases/p03942/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..de4d9f16d15fc86a23c71d1ed5bfb1a2d0aa3177 --- /dev/null +++ b/codenet/public_test_cases/p03942/input.0.txt @@ -0,0 +1,3 @@ +5 +abcde +aaacc diff --git a/codenet/public_test_cases/p03942/input.1.txt b/codenet/public_test_cases/p03942/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cea30a93ed8f4b21a0f0a6b24982672ca9cb72a1 --- /dev/null +++ b/codenet/public_test_cases/p03942/input.1.txt @@ -0,0 +1,3 @@ +5 +abcde +abcde diff --git a/codenet/public_test_cases/p03942/input.2.txt b/codenet/public_test_cases/p03942/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f78086b708602f479fd0f7c41135742d78f7f8f --- /dev/null +++ b/codenet/public_test_cases/p03942/input.2.txt @@ -0,0 +1,3 @@ +5 +abcde +bbbbb diff --git a/codenet/public_test_cases/p03942/input.3.txt b/codenet/public_test_cases/p03942/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1504a8b6efd516c89956e4d642d41004b4778d1a --- /dev/null +++ b/codenet/public_test_cases/p03942/input.3.txt @@ -0,0 +1,3 @@ +4 +acaa +aaca diff --git a/codenet/public_test_cases/p03942/input.4.txt b/codenet/public_test_cases/p03942/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..de4d9f16d15fc86a23c71d1ed5bfb1a2d0aa3177 --- /dev/null +++ b/codenet/public_test_cases/p03942/input.4.txt @@ -0,0 +1,3 @@ +5 +abcde +aaacc diff --git a/codenet/public_test_cases/p03942/output.0.txt b/codenet/public_test_cases/p03942/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03942/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03942/output.1.txt b/codenet/public_test_cases/p03942/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03942/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03942/output.2.txt b/codenet/public_test_cases/p03942/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03942/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03942/output.3.txt b/codenet/public_test_cases/p03942/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03942/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03942/output.4.txt b/codenet/public_test_cases/p03942/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03942/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03943/input.0.txt b/codenet/public_test_cases/p03943/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..656cfca42f985f948aa5326564973e28baad5fc4 --- /dev/null +++ b/codenet/public_test_cases/p03943/input.0.txt @@ -0,0 +1 @@ +10 30 20 diff --git a/codenet/public_test_cases/p03943/input.1.txt b/codenet/public_test_cases/p03943/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d8671ece10546c705aedb92232cac25f810eccd --- /dev/null +++ b/codenet/public_test_cases/p03943/input.1.txt @@ -0,0 +1 @@ +56 25 31 diff --git a/codenet/public_test_cases/p03943/input.2.txt b/codenet/public_test_cases/p03943/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..656cfca42f985f948aa5326564973e28baad5fc4 --- /dev/null +++ b/codenet/public_test_cases/p03943/input.2.txt @@ -0,0 +1 @@ +10 30 20 diff --git a/codenet/public_test_cases/p03943/input.3.txt b/codenet/public_test_cases/p03943/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdadafdd7634b7a89b4ec1347004e4e3074035ed --- /dev/null +++ b/codenet/public_test_cases/p03943/input.3.txt @@ -0,0 +1 @@ +30 30 100 diff --git a/codenet/public_test_cases/p03943/output.0.txt b/codenet/public_test_cases/p03943/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03943/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03943/output.1.txt b/codenet/public_test_cases/p03943/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03943/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03943/output.2.txt b/codenet/public_test_cases/p03943/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03943/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03943/output.3.txt b/codenet/public_test_cases/p03943/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03943/output.3.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03944/input.0.txt b/codenet/public_test_cases/p03944/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..acbfc5e914a1485dd0f6a4160d9c109bb8dc6c6e --- /dev/null +++ b/codenet/public_test_cases/p03944/input.0.txt @@ -0,0 +1,3 @@ +5 4 2 +2 1 1 +3 3 4 diff --git a/codenet/public_test_cases/p03944/input.1.txt b/codenet/public_test_cases/p03944/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d609c374a9e658e6a39461753fba812d8dd9bb58 --- /dev/null +++ b/codenet/public_test_cases/p03944/input.1.txt @@ -0,0 +1,4 @@ +5 4 3 +2 1 1 +3 3 4 +1 4 2 diff --git a/codenet/public_test_cases/p03944/input.2.txt b/codenet/public_test_cases/p03944/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..acbfc5e914a1485dd0f6a4160d9c109bb8dc6c6e --- /dev/null +++ b/codenet/public_test_cases/p03944/input.2.txt @@ -0,0 +1,3 @@ +5 4 2 +2 1 1 +3 3 4 diff --git a/codenet/public_test_cases/p03944/input.3.txt b/codenet/public_test_cases/p03944/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..47ecef8375ebebdb78ee55771deb7c94f53638f3 --- /dev/null +++ b/codenet/public_test_cases/p03944/input.3.txt @@ -0,0 +1,6 @@ +10 10 5 +1 6 1 +4 1 3 +6 9 4 +9 4 2 +3 1 3 diff --git a/codenet/public_test_cases/p03944/output.0.txt b/codenet/public_test_cases/p03944/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03944/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03944/output.1.txt b/codenet/public_test_cases/p03944/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03944/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03944/output.2.txt b/codenet/public_test_cases/p03944/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03944/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03944/output.3.txt b/codenet/public_test_cases/p03944/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..900731ffd51ffc82db488b6554f719de735f12bd --- /dev/null +++ b/codenet/public_test_cases/p03944/output.3.txt @@ -0,0 +1 @@ +64 diff --git a/codenet/public_test_cases/p03945/input.0.txt b/codenet/public_test_cases/p03945/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b48f967c360cc8198983a3395fb4552803ccbc3a --- /dev/null +++ b/codenet/public_test_cases/p03945/input.0.txt @@ -0,0 +1 @@ +BBBWW diff --git a/codenet/public_test_cases/p03945/input.1.txt b/codenet/public_test_cases/p03945/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..13bbdc2e7705c3c8014b52f71464477b407420b7 --- /dev/null +++ b/codenet/public_test_cases/p03945/input.1.txt @@ -0,0 +1 @@ +WWWWWW diff --git a/codenet/public_test_cases/p03945/input.2.txt b/codenet/public_test_cases/p03945/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4db4936fb9b6e057496c68831c60f74bd4daa432 --- /dev/null +++ b/codenet/public_test_cases/p03945/input.2.txt @@ -0,0 +1 @@ +WBWBWBWBWB diff --git a/codenet/public_test_cases/p03945/input.3.txt b/codenet/public_test_cases/p03945/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b48f967c360cc8198983a3395fb4552803ccbc3a --- /dev/null +++ b/codenet/public_test_cases/p03945/input.3.txt @@ -0,0 +1 @@ +BBBWW diff --git a/codenet/public_test_cases/p03945/output.0.txt b/codenet/public_test_cases/p03945/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03945/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03945/output.1.txt b/codenet/public_test_cases/p03945/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03945/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03945/output.2.txt b/codenet/public_test_cases/p03945/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03945/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03945/output.3.txt b/codenet/public_test_cases/p03945/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03945/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03946/input.0.txt b/codenet/public_test_cases/p03946/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b9859e2b51fca8177149002068af19928c5d203 --- /dev/null +++ b/codenet/public_test_cases/p03946/input.0.txt @@ -0,0 +1,2 @@ +3 2 +100 50 200 diff --git a/codenet/public_test_cases/p03946/output.0.txt b/codenet/public_test_cases/p03946/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03946/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03947/input.0.txt b/codenet/public_test_cases/p03947/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b48f967c360cc8198983a3395fb4552803ccbc3a --- /dev/null +++ b/codenet/public_test_cases/p03947/input.0.txt @@ -0,0 +1 @@ +BBBWW diff --git a/codenet/public_test_cases/p03947/output.0.txt b/codenet/public_test_cases/p03947/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03947/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03948/input.0.txt b/codenet/public_test_cases/p03948/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b9859e2b51fca8177149002068af19928c5d203 --- /dev/null +++ b/codenet/public_test_cases/p03948/input.0.txt @@ -0,0 +1,2 @@ +3 2 +100 50 200 diff --git a/codenet/public_test_cases/p03948/input.1.txt b/codenet/public_test_cases/p03948/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c68c835b4dc2a4aa7c96fe69d1b8cf8e4ab60fd --- /dev/null +++ b/codenet/public_test_cases/p03948/input.1.txt @@ -0,0 +1,2 @@ +5 8 +50 30 40 10 20 diff --git a/codenet/public_test_cases/p03948/input.2.txt b/codenet/public_test_cases/p03948/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..71b4c4a6e1aee249c789eea014e9be6027f1a655 --- /dev/null +++ b/codenet/public_test_cases/p03948/input.2.txt @@ -0,0 +1,2 @@ +10 100 +7 10 4 5 9 3 6 8 2 1 diff --git a/codenet/public_test_cases/p03948/input.3.txt b/codenet/public_test_cases/p03948/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b9859e2b51fca8177149002068af19928c5d203 --- /dev/null +++ b/codenet/public_test_cases/p03948/input.3.txt @@ -0,0 +1,2 @@ +3 2 +100 50 200 diff --git a/codenet/public_test_cases/p03948/output.0.txt b/codenet/public_test_cases/p03948/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03948/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03948/output.1.txt b/codenet/public_test_cases/p03948/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03948/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03948/output.2.txt b/codenet/public_test_cases/p03948/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03948/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03948/output.3.txt b/codenet/public_test_cases/p03948/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03948/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03949/input.0.txt b/codenet/public_test_cases/p03949/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a86b83066fac73972b4e53faad052a65b805ba4 --- /dev/null +++ b/codenet/public_test_cases/p03949/input.0.txt @@ -0,0 +1,8 @@ +5 +1 2 +3 1 +4 3 +3 5 +2 +2 6 +5 7 diff --git a/codenet/public_test_cases/p03949/input.1.txt b/codenet/public_test_cases/p03949/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2c5f2b60afe6ab8b9a93da253ee8bbee3f41423 --- /dev/null +++ b/codenet/public_test_cases/p03949/input.1.txt @@ -0,0 +1,6 @@ +4 +1 2 +2 3 +3 4 +1 +1 0 diff --git a/codenet/public_test_cases/p03949/input.2.txt b/codenet/public_test_cases/p03949/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..22cc29e609c06446fa337c99d7e9fc1ae29d9d9b --- /dev/null +++ b/codenet/public_test_cases/p03949/input.2.txt @@ -0,0 +1,9 @@ +5 +1 2 +3 1 +4 3 +3 5 +3 +2 6 +4 3 +5 7 diff --git a/codenet/public_test_cases/p03949/input.3.txt b/codenet/public_test_cases/p03949/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a86b83066fac73972b4e53faad052a65b805ba4 --- /dev/null +++ b/codenet/public_test_cases/p03949/input.3.txt @@ -0,0 +1,8 @@ +5 +1 2 +3 1 +4 3 +3 5 +2 +2 6 +5 7 diff --git a/codenet/public_test_cases/p03949/output.0.txt b/codenet/public_test_cases/p03949/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7580dae88ef712178ccaf8c66e4254d87292eab6 --- /dev/null +++ b/codenet/public_test_cases/p03949/output.0.txt @@ -0,0 +1,6 @@ +Yes +5 +6 +6 +5 +7 diff --git a/codenet/public_test_cases/p03949/output.1.txt b/codenet/public_test_cases/p03949/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..29172929eee15d368dec7c0cd4b7419ca870adff --- /dev/null +++ b/codenet/public_test_cases/p03949/output.1.txt @@ -0,0 +1,5 @@ +Yes +0 +-1 +-2 +-3 diff --git a/codenet/public_test_cases/p03949/output.2.txt b/codenet/public_test_cases/p03949/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03949/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03949/output.3.txt b/codenet/public_test_cases/p03949/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7580dae88ef712178ccaf8c66e4254d87292eab6 --- /dev/null +++ b/codenet/public_test_cases/p03949/output.3.txt @@ -0,0 +1,6 @@ +Yes +5 +6 +6 +5 +7 diff --git a/codenet/public_test_cases/p03950/input.0.txt b/codenet/public_test_cases/p03950/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f20ff619fdaa77a8899620a6600da5bbe2ecdeb --- /dev/null +++ b/codenet/public_test_cases/p03950/input.0.txt @@ -0,0 +1,5 @@ +10 10 4 +1 6 +4 1 +6 9 +9 4 diff --git a/codenet/public_test_cases/p03950/input.1.txt b/codenet/public_test_cases/p03950/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..430ff4f3baef0cba67479fffd7ec46832427c418 --- /dev/null +++ b/codenet/public_test_cases/p03950/input.1.txt @@ -0,0 +1,6 @@ +5 4 5 +0 0 +1 1 +2 2 +4 3 +5 4 diff --git a/codenet/public_test_cases/p03950/input.2.txt b/codenet/public_test_cases/p03950/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fc42b50125dd2e2d97e5e25f24d7bf21fcc9735 --- /dev/null +++ b/codenet/public_test_cases/p03950/input.2.txt @@ -0,0 +1,2 @@ +100000000 100000000 1 +3 4 diff --git a/codenet/public_test_cases/p03950/input.3.txt b/codenet/public_test_cases/p03950/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f20ff619fdaa77a8899620a6600da5bbe2ecdeb --- /dev/null +++ b/codenet/public_test_cases/p03950/input.3.txt @@ -0,0 +1,5 @@ +10 10 4 +1 6 +4 1 +6 9 +9 4 diff --git a/codenet/public_test_cases/p03950/input.4.txt b/codenet/public_test_cases/p03950/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..367e02f1efd7d6515fdb0f354fb660fab31946ad --- /dev/null +++ b/codenet/public_test_cases/p03950/input.4.txt @@ -0,0 +1,9 @@ +100 100 8 +19 33 +8 10 +52 18 +94 2 +81 36 +88 95 +67 83 +20 71 diff --git a/codenet/public_test_cases/p03950/output.0.txt b/codenet/public_test_cases/p03950/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p03950/output.0.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p03950/output.1.txt b/codenet/public_test_cases/p03950/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03950/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03950/output.2.txt b/codenet/public_test_cases/p03950/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6b1f3019788d9a5daa5f800c98453dea70a075b --- /dev/null +++ b/codenet/public_test_cases/p03950/output.2.txt @@ -0,0 +1 @@ +399999994 diff --git a/codenet/public_test_cases/p03950/output.3.txt b/codenet/public_test_cases/p03950/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5c89552bd3e62bfce023a230e90d141f7a46b2f --- /dev/null +++ b/codenet/public_test_cases/p03950/output.3.txt @@ -0,0 +1 @@ +32 diff --git a/codenet/public_test_cases/p03950/output.4.txt b/codenet/public_test_cases/p03950/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..67f3f23eca8eac181c5a0e2f8da2a535eba9f5a3 --- /dev/null +++ b/codenet/public_test_cases/p03950/output.4.txt @@ -0,0 +1 @@ +270 diff --git a/codenet/public_test_cases/p03951/input.0.txt b/codenet/public_test_cases/p03951/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..307c7f09087bbd6e66f21e43ad2f1cc56ca8c16c --- /dev/null +++ b/codenet/public_test_cases/p03951/input.0.txt @@ -0,0 +1,3 @@ +3 +abc +cde diff --git a/codenet/public_test_cases/p03951/input.1.txt b/codenet/public_test_cases/p03951/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..307c7f09087bbd6e66f21e43ad2f1cc56ca8c16c --- /dev/null +++ b/codenet/public_test_cases/p03951/input.1.txt @@ -0,0 +1,3 @@ +3 +abc +cde diff --git a/codenet/public_test_cases/p03951/input.2.txt b/codenet/public_test_cases/p03951/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1b769783b672fd10a46a0e9efab1f51d24146aad --- /dev/null +++ b/codenet/public_test_cases/p03951/input.2.txt @@ -0,0 +1,3 @@ +1 +a +z diff --git a/codenet/public_test_cases/p03951/input.3.txt b/codenet/public_test_cases/p03951/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..20a0bfc44e6c1024b706abb447e51b4204fb676f --- /dev/null +++ b/codenet/public_test_cases/p03951/input.3.txt @@ -0,0 +1,3 @@ +4 +expr +expr diff --git a/codenet/public_test_cases/p03951/output.0.txt b/codenet/public_test_cases/p03951/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03951/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03951/output.1.txt b/codenet/public_test_cases/p03951/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03951/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03951/output.2.txt b/codenet/public_test_cases/p03951/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03951/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03951/output.3.txt b/codenet/public_test_cases/p03951/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03951/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03952/input.0.txt b/codenet/public_test_cases/p03952/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8835c0701f66f328251eac951d4278ae8acd00a1 --- /dev/null +++ b/codenet/public_test_cases/p03952/input.0.txt @@ -0,0 +1 @@ +4 4 diff --git a/codenet/public_test_cases/p03952/input.1.txt b/codenet/public_test_cases/p03952/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8835c0701f66f328251eac951d4278ae8acd00a1 --- /dev/null +++ b/codenet/public_test_cases/p03952/input.1.txt @@ -0,0 +1 @@ +4 4 diff --git a/codenet/public_test_cases/p03952/input.2.txt b/codenet/public_test_cases/p03952/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cba3471eb57a36532843f61b9d1c3e9a8a577c4e --- /dev/null +++ b/codenet/public_test_cases/p03952/input.2.txt @@ -0,0 +1 @@ +2 1 diff --git a/codenet/public_test_cases/p03952/output.0.txt b/codenet/public_test_cases/p03952/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b9ccb9813ece7aafb50883e27049005e641b4d3 --- /dev/null +++ b/codenet/public_test_cases/p03952/output.0.txt @@ -0,0 +1,8 @@ +Yes +1 +6 +3 +7 +4 +5 +2 diff --git a/codenet/public_test_cases/p03952/output.1.txt b/codenet/public_test_cases/p03952/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b9ccb9813ece7aafb50883e27049005e641b4d3 --- /dev/null +++ b/codenet/public_test_cases/p03952/output.1.txt @@ -0,0 +1,8 @@ +Yes +1 +6 +3 +7 +4 +5 +2 diff --git a/codenet/public_test_cases/p03952/output.2.txt b/codenet/public_test_cases/p03952/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03952/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03953/input.0.txt b/codenet/public_test_cases/p03953/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b59c1af8a5ce918474d108784bbd7fb0abb291e0 --- /dev/null +++ b/codenet/public_test_cases/p03953/input.0.txt @@ -0,0 +1,4 @@ +3 +-1 0 2 +1 1 +2 diff --git a/codenet/public_test_cases/p03953/input.1.txt b/codenet/public_test_cases/p03953/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa061307993e5409167e9bb91cf15e4eefdf69a6 --- /dev/null +++ b/codenet/public_test_cases/p03953/input.1.txt @@ -0,0 +1,4 @@ +3 +1 -1 1 +2 2 +2 2 diff --git a/codenet/public_test_cases/p03953/input.2.txt b/codenet/public_test_cases/p03953/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b59c1af8a5ce918474d108784bbd7fb0abb291e0 --- /dev/null +++ b/codenet/public_test_cases/p03953/input.2.txt @@ -0,0 +1,4 @@ +3 +-1 0 2 +1 1 +2 diff --git a/codenet/public_test_cases/p03953/input.3.txt b/codenet/public_test_cases/p03953/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aaee52912379fb4a19821d200b2be72e3b13b056 --- /dev/null +++ b/codenet/public_test_cases/p03953/input.3.txt @@ -0,0 +1,4 @@ +5 +0 1 3 6 10 +3 10 +2 3 4 diff --git a/codenet/public_test_cases/p03953/output.0.txt b/codenet/public_test_cases/p03953/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d7d8729c67ead057e94219e7e7a85ff53f9d6dc --- /dev/null +++ b/codenet/public_test_cases/p03953/output.0.txt @@ -0,0 +1,3 @@ +-1.0 +1.0 +2.0 diff --git a/codenet/public_test_cases/p03953/output.1.txt b/codenet/public_test_cases/p03953/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..afe8e47a026fa74e33fb5b97dd78d15161515d0a --- /dev/null +++ b/codenet/public_test_cases/p03953/output.1.txt @@ -0,0 +1,3 @@ +1.0 +-1.0 +1.0 diff --git a/codenet/public_test_cases/p03953/output.2.txt b/codenet/public_test_cases/p03953/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d7d8729c67ead057e94219e7e7a85ff53f9d6dc --- /dev/null +++ b/codenet/public_test_cases/p03953/output.2.txt @@ -0,0 +1,3 @@ +-1.0 +1.0 +2.0 diff --git a/codenet/public_test_cases/p03953/output.3.txt b/codenet/public_test_cases/p03953/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..541ed43ff35d61632a9d7404efa1b676f7420165 --- /dev/null +++ b/codenet/public_test_cases/p03953/output.3.txt @@ -0,0 +1,5 @@ +0.0 +3.0 +7.0 +8.0 +10.0 diff --git a/codenet/public_test_cases/p03954/input.0.txt b/codenet/public_test_cases/p03954/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5366401351031e6e838a75628d235ff9ceff5421 --- /dev/null +++ b/codenet/public_test_cases/p03954/input.0.txt @@ -0,0 +1,2 @@ +4 +1 6 3 7 4 5 2 diff --git a/codenet/public_test_cases/p03954/input.1.txt b/codenet/public_test_cases/p03954/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..114c36cc30ab6cb59ae49e39e1f583b3e0da5fa1 --- /dev/null +++ b/codenet/public_test_cases/p03954/input.1.txt @@ -0,0 +1,2 @@ +2 +1 2 3 diff --git a/codenet/public_test_cases/p03954/input.2.txt b/codenet/public_test_cases/p03954/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5366401351031e6e838a75628d235ff9ceff5421 --- /dev/null +++ b/codenet/public_test_cases/p03954/input.2.txt @@ -0,0 +1,2 @@ +4 +1 6 3 7 4 5 2 diff --git a/codenet/public_test_cases/p03954/output.0.txt b/codenet/public_test_cases/p03954/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03954/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03954/output.1.txt b/codenet/public_test_cases/p03954/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03954/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03954/output.2.txt b/codenet/public_test_cases/p03954/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03954/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03955/input.0.txt b/codenet/public_test_cases/p03955/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c2e9f3467d3456f1e556444eba73288d04ac01a --- /dev/null +++ b/codenet/public_test_cases/p03955/input.0.txt @@ -0,0 +1,4 @@ +5 +9 6 15 12 1 +8 5 14 11 2 +7 4 13 10 3 diff --git a/codenet/public_test_cases/p03955/input.1.txt b/codenet/public_test_cases/p03955/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb3ec21f2dd0a4597c3b50273f7e6c73a1df84e7 --- /dev/null +++ b/codenet/public_test_cases/p03955/input.1.txt @@ -0,0 +1,4 @@ +7 +21 12 1 16 13 6 7 +20 11 2 17 14 5 8 +19 10 3 18 15 4 9 diff --git a/codenet/public_test_cases/p03955/input.2.txt b/codenet/public_test_cases/p03955/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c2e9f3467d3456f1e556444eba73288d04ac01a --- /dev/null +++ b/codenet/public_test_cases/p03955/input.2.txt @@ -0,0 +1,4 @@ +5 +9 6 15 12 1 +8 5 14 11 2 +7 4 13 10 3 diff --git a/codenet/public_test_cases/p03955/input.3.txt b/codenet/public_test_cases/p03955/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f319d1e2b039b14b3e30813d3e5bbab2b27c41f --- /dev/null +++ b/codenet/public_test_cases/p03955/input.3.txt @@ -0,0 +1,4 @@ +6 +15 10 3 4 9 16 +14 11 2 5 8 17 +13 12 1 6 7 18 diff --git a/codenet/public_test_cases/p03955/input.4.txt b/codenet/public_test_cases/p03955/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c806f3cc379a623cc9e478110e27beae6cad5a36 --- /dev/null +++ b/codenet/public_test_cases/p03955/input.4.txt @@ -0,0 +1,4 @@ +5 +1 4 7 10 13 +2 5 8 11 14 +3 6 9 12 15 diff --git a/codenet/public_test_cases/p03955/input.5.txt b/codenet/public_test_cases/p03955/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..a419e65fdd1ae6631c2752f4e4d6c34e0b0b0908 --- /dev/null +++ b/codenet/public_test_cases/p03955/input.5.txt @@ -0,0 +1,4 @@ +5 +1 2 3 4 5 +6 7 8 9 10 +11 12 13 14 15 diff --git a/codenet/public_test_cases/p03955/output.0.txt b/codenet/public_test_cases/p03955/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03955/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03955/output.1.txt b/codenet/public_test_cases/p03955/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03955/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03955/output.2.txt b/codenet/public_test_cases/p03955/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03955/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03955/output.3.txt b/codenet/public_test_cases/p03955/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03955/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03955/output.4.txt b/codenet/public_test_cases/p03955/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03955/output.4.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03955/output.5.txt b/codenet/public_test_cases/p03955/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03955/output.5.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03956/input.0.txt b/codenet/public_test_cases/p03956/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p03956/input.0.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03956/input.1.txt b/codenet/public_test_cases/p03956/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..36c9231aa98943c01ca36f37c6dd3d7aa8821437 --- /dev/null +++ b/codenet/public_test_cases/p03956/input.1.txt @@ -0,0 +1,3 @@ +2 2 +1 1 +1 2 diff --git a/codenet/public_test_cases/p03956/input.2.txt b/codenet/public_test_cases/p03956/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p03956/input.2.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03956/input.3.txt b/codenet/public_test_cases/p03956/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2857bfc6239f0802cf7894ab087f26dee1d75404 --- /dev/null +++ b/codenet/public_test_cases/p03956/input.3.txt @@ -0,0 +1,4 @@ +4 3 +1 2 +1 3 +4 4 diff --git a/codenet/public_test_cases/p03956/output.0.txt b/codenet/public_test_cases/p03956/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03956/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03956/output.1.txt b/codenet/public_test_cases/p03956/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03956/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03956/output.2.txt b/codenet/public_test_cases/p03956/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03956/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03956/output.3.txt b/codenet/public_test_cases/p03956/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03956/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03957/input.0.txt b/codenet/public_test_cases/p03957/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6278f144219063e186191a7a5d52cfbddda36ce0 --- /dev/null +++ b/codenet/public_test_cases/p03957/input.0.txt @@ -0,0 +1 @@ +CODEFESTIVAL diff --git a/codenet/public_test_cases/p03957/input.1.txt b/codenet/public_test_cases/p03957/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b1c4b44dbee9f35933afec133db2cd861c40e76 --- /dev/null +++ b/codenet/public_test_cases/p03957/input.1.txt @@ -0,0 +1 @@ +CF diff --git a/codenet/public_test_cases/p03957/input.2.txt b/codenet/public_test_cases/p03957/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6278f144219063e186191a7a5d52cfbddda36ce0 --- /dev/null +++ b/codenet/public_test_cases/p03957/input.2.txt @@ -0,0 +1 @@ +CODEFESTIVAL diff --git a/codenet/public_test_cases/p03957/input.3.txt b/codenet/public_test_cases/p03957/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..c29dd53f8fa3efae138292ed9601de24db29e3d7 --- /dev/null +++ b/codenet/public_test_cases/p03957/input.3.txt @@ -0,0 +1 @@ +FCF diff --git a/codenet/public_test_cases/p03957/input.4.txt b/codenet/public_test_cases/p03957/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e7ebe3363c3a5aa55f126bbfd275cd23eaab48c --- /dev/null +++ b/codenet/public_test_cases/p03957/input.4.txt @@ -0,0 +1 @@ +FESTIVALCODE diff --git a/codenet/public_test_cases/p03957/output.0.txt b/codenet/public_test_cases/p03957/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03957/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03957/output.1.txt b/codenet/public_test_cases/p03957/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03957/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03957/output.2.txt b/codenet/public_test_cases/p03957/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03957/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03957/output.3.txt b/codenet/public_test_cases/p03957/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03957/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03957/output.4.txt b/codenet/public_test_cases/p03957/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03957/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03958/input.0.txt b/codenet/public_test_cases/p03958/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff6fbade6ac71780772f750cf85830bf8cb026d0 --- /dev/null +++ b/codenet/public_test_cases/p03958/input.0.txt @@ -0,0 +1,2 @@ +7 3 +3 2 2 diff --git a/codenet/public_test_cases/p03958/input.1.txt b/codenet/public_test_cases/p03958/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff6fbade6ac71780772f750cf85830bf8cb026d0 --- /dev/null +++ b/codenet/public_test_cases/p03958/input.1.txt @@ -0,0 +1,2 @@ +7 3 +3 2 2 diff --git a/codenet/public_test_cases/p03958/input.2.txt b/codenet/public_test_cases/p03958/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e30b2a2866cfad33acbbe162b595b69dff4d88 --- /dev/null +++ b/codenet/public_test_cases/p03958/input.2.txt @@ -0,0 +1,2 @@ +6 3 +1 4 1 diff --git a/codenet/public_test_cases/p03958/input.3.txt b/codenet/public_test_cases/p03958/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b42da4c307b0d00daac0623fcf7f085099b869b --- /dev/null +++ b/codenet/public_test_cases/p03958/input.3.txt @@ -0,0 +1,2 @@ +100 1 +100 diff --git a/codenet/public_test_cases/p03958/output.0.txt b/codenet/public_test_cases/p03958/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03958/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03958/output.1.txt b/codenet/public_test_cases/p03958/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03958/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03958/output.2.txt b/codenet/public_test_cases/p03958/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03958/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03958/output.3.txt b/codenet/public_test_cases/p03958/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ad5abd03aea89f7de126c4861363e4f64355973 --- /dev/null +++ b/codenet/public_test_cases/p03958/output.3.txt @@ -0,0 +1 @@ +99 diff --git a/codenet/public_test_cases/p03959/input.0.txt b/codenet/public_test_cases/p03959/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8768803a0ae40ad7015cf82bdb2564ef23cef2bd --- /dev/null +++ b/codenet/public_test_cases/p03959/input.0.txt @@ -0,0 +1,3 @@ +5 +1 3 3 3 3 +3 3 2 2 2 diff --git a/codenet/public_test_cases/p03959/input.1.txt b/codenet/public_test_cases/p03959/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8768803a0ae40ad7015cf82bdb2564ef23cef2bd --- /dev/null +++ b/codenet/public_test_cases/p03959/input.1.txt @@ -0,0 +1,3 @@ +5 +1 3 3 3 3 +3 3 2 2 2 diff --git a/codenet/public_test_cases/p03959/input.2.txt b/codenet/public_test_cases/p03959/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..14edf48c27bc002d680a99d20c5c756df17ed22b --- /dev/null +++ b/codenet/public_test_cases/p03959/input.2.txt @@ -0,0 +1,3 @@ +10 +1 3776 3776 8848 8848 8848 8848 8848 8848 8848 +8848 8848 8848 8848 8848 8848 8848 8848 3776 5 diff --git a/codenet/public_test_cases/p03959/input.3.txt b/codenet/public_test_cases/p03959/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6d586748d7cfbbb0069213ede1931d36c93556e --- /dev/null +++ b/codenet/public_test_cases/p03959/input.3.txt @@ -0,0 +1,3 @@ +1 +17 +17 diff --git a/codenet/public_test_cases/p03959/input.4.txt b/codenet/public_test_cases/p03959/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc1851cdeb6471132e5096c8cc8953efdbf68009 --- /dev/null +++ b/codenet/public_test_cases/p03959/input.4.txt @@ -0,0 +1,3 @@ +5 +1 1 1 2 2 +3 2 1 1 1 diff --git a/codenet/public_test_cases/p03959/output.0.txt b/codenet/public_test_cases/p03959/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03959/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03959/output.1.txt b/codenet/public_test_cases/p03959/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03959/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03959/output.2.txt b/codenet/public_test_cases/p03959/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58ee70ae7c1a7cdefa3616cdb58c9699e98a487b --- /dev/null +++ b/codenet/public_test_cases/p03959/output.2.txt @@ -0,0 +1 @@ +884111967 diff --git a/codenet/public_test_cases/p03959/output.3.txt b/codenet/public_test_cases/p03959/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03959/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03959/output.4.txt b/codenet/public_test_cases/p03959/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03959/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03960/input.0.txt b/codenet/public_test_cases/p03960/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..3156030e0fcfe5dfea942455220093fa041a007c --- /dev/null +++ b/codenet/public_test_cases/p03960/input.0.txt @@ -0,0 +1,3 @@ +2 3 +rrr +brg diff --git a/codenet/public_test_cases/p03960/output.0.txt b/codenet/public_test_cases/p03960/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03960/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03961/input.0.txt b/codenet/public_test_cases/p03961/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..611e085c614995c711c3d494d0fdf075d483a86c --- /dev/null +++ b/codenet/public_test_cases/p03961/input.0.txt @@ -0,0 +1,2 @@ +4 +0 2 3 0 diff --git a/codenet/public_test_cases/p03961/input.1.txt b/codenet/public_test_cases/p03961/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b261da18d51a39dc2cf0d156791e9c0b35dd83f4 --- /dev/null +++ b/codenet/public_test_cases/p03961/input.1.txt @@ -0,0 +1,2 @@ +1 +0 diff --git a/codenet/public_test_cases/p03961/input.2.txt b/codenet/public_test_cases/p03961/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1441a89af9d89b59ae5d73b397b73fab6029596d --- /dev/null +++ b/codenet/public_test_cases/p03961/input.2.txt @@ -0,0 +1,2 @@ +5 +1 2 3 5 4 diff --git a/codenet/public_test_cases/p03961/input.3.txt b/codenet/public_test_cases/p03961/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..611e085c614995c711c3d494d0fdf075d483a86c --- /dev/null +++ b/codenet/public_test_cases/p03961/input.3.txt @@ -0,0 +1,2 @@ +4 +0 2 3 0 diff --git a/codenet/public_test_cases/p03961/input.4.txt b/codenet/public_test_cases/p03961/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..470f21e0f4c48a62289f1691d6f1af9c18bded13 --- /dev/null +++ b/codenet/public_test_cases/p03961/input.4.txt @@ -0,0 +1,2 @@ +10 +0 3 0 0 1 0 4 0 0 0 diff --git a/codenet/public_test_cases/p03961/input.5.txt b/codenet/public_test_cases/p03961/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..2edfca631f6b221d5a1dfd1f79e5a63d755b7b9d --- /dev/null +++ b/codenet/public_test_cases/p03961/input.5.txt @@ -0,0 +1,2 @@ +3 +0 0 0 diff --git a/codenet/public_test_cases/p03961/output.0.txt b/codenet/public_test_cases/p03961/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p03961/output.0.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p03961/output.1.txt b/codenet/public_test_cases/p03961/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03961/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03961/output.2.txt b/codenet/public_test_cases/p03961/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03961/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03961/output.3.txt b/codenet/public_test_cases/p03961/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p03961/output.3.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p03961/output.4.txt b/codenet/public_test_cases/p03961/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8df87bf19b800c0fd76b44b6864cf46bb0486ad --- /dev/null +++ b/codenet/public_test_cases/p03961/output.4.txt @@ -0,0 +1 @@ +953330050 diff --git a/codenet/public_test_cases/p03961/output.5.txt b/codenet/public_test_cases/p03961/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..aabe6ec3909c9d4871f8f89ef88ca3b6795ebd29 --- /dev/null +++ b/codenet/public_test_cases/p03961/output.5.txt @@ -0,0 +1 @@ +21 diff --git a/codenet/public_test_cases/p03962/input.0.txt b/codenet/public_test_cases/p03962/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a46f5080b5038d22913c906f987ba65fb8fa7ed1 --- /dev/null +++ b/codenet/public_test_cases/p03962/input.0.txt @@ -0,0 +1 @@ +3 1 4 diff --git a/codenet/public_test_cases/p03962/input.1.txt b/codenet/public_test_cases/p03962/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a46f5080b5038d22913c906f987ba65fb8fa7ed1 --- /dev/null +++ b/codenet/public_test_cases/p03962/input.1.txt @@ -0,0 +1 @@ +3 1 4 diff --git a/codenet/public_test_cases/p03962/input.2.txt b/codenet/public_test_cases/p03962/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..064755371e7443dd469886c633eda11b30b812df --- /dev/null +++ b/codenet/public_test_cases/p03962/input.2.txt @@ -0,0 +1 @@ +3 3 33 diff --git a/codenet/public_test_cases/p03962/output.0.txt b/codenet/public_test_cases/p03962/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03962/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03962/output.1.txt b/codenet/public_test_cases/p03962/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03962/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03962/output.2.txt b/codenet/public_test_cases/p03962/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03962/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03963/input.0.txt b/codenet/public_test_cases/p03963/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03963/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03963/input.1.txt b/codenet/public_test_cases/p03963/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p03963/input.1.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p03963/input.2.txt b/codenet/public_test_cases/p03963/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aba066490735a0d12c6c3ce01830600db457d5bc --- /dev/null +++ b/codenet/public_test_cases/p03963/input.2.txt @@ -0,0 +1 @@ +1 10 diff --git a/codenet/public_test_cases/p03963/output.0.txt b/codenet/public_test_cases/p03963/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03963/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03963/output.1.txt b/codenet/public_test_cases/p03963/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03963/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03963/output.2.txt b/codenet/public_test_cases/p03963/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03963/output.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03964/input.0.txt b/codenet/public_test_cases/p03964/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f33eee775724a46fafe7d246e771aa87e7402ecb --- /dev/null +++ b/codenet/public_test_cases/p03964/input.0.txt @@ -0,0 +1,4 @@ +3 +2 3 +1 1 +3 2 diff --git a/codenet/public_test_cases/p03964/input.1.txt b/codenet/public_test_cases/p03964/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7e5a124f22f9b0512e2566dfa53c9265cbe62b9 --- /dev/null +++ b/codenet/public_test_cases/p03964/input.1.txt @@ -0,0 +1,6 @@ +5 +3 10 +48 17 +31 199 +231 23 +3 2 diff --git a/codenet/public_test_cases/p03964/input.2.txt b/codenet/public_test_cases/p03964/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..98aa80e8ea5480d11869cb1076313c1ba3e1b440 --- /dev/null +++ b/codenet/public_test_cases/p03964/input.2.txt @@ -0,0 +1,5 @@ +4 +1 1 +1 1 +1 5 +1 100 diff --git a/codenet/public_test_cases/p03964/input.3.txt b/codenet/public_test_cases/p03964/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f33eee775724a46fafe7d246e771aa87e7402ecb --- /dev/null +++ b/codenet/public_test_cases/p03964/input.3.txt @@ -0,0 +1,4 @@ +3 +2 3 +1 1 +3 2 diff --git a/codenet/public_test_cases/p03964/output.0.txt b/codenet/public_test_cases/p03964/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03964/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03964/output.1.txt b/codenet/public_test_cases/p03964/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f35be3abca15608f5b8bc230f729609e3b030b21 --- /dev/null +++ b/codenet/public_test_cases/p03964/output.1.txt @@ -0,0 +1 @@ +6930 diff --git a/codenet/public_test_cases/p03964/output.2.txt b/codenet/public_test_cases/p03964/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..398050c62c882fa5ebc8d8aaa2e730e70790beeb --- /dev/null +++ b/codenet/public_test_cases/p03964/output.2.txt @@ -0,0 +1 @@ +101 diff --git a/codenet/public_test_cases/p03964/output.3.txt b/codenet/public_test_cases/p03964/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03964/output.3.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03965/input.0.txt b/codenet/public_test_cases/p03965/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37ca8bede779918e2c88a3be33e826b03460f95e --- /dev/null +++ b/codenet/public_test_cases/p03965/input.0.txt @@ -0,0 +1 @@ +gpg diff --git a/codenet/public_test_cases/p03965/input.1.txt b/codenet/public_test_cases/p03965/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37ca8bede779918e2c88a3be33e826b03460f95e --- /dev/null +++ b/codenet/public_test_cases/p03965/input.1.txt @@ -0,0 +1 @@ +gpg diff --git a/codenet/public_test_cases/p03965/input.2.txt b/codenet/public_test_cases/p03965/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a75723a5e1b4c7060f13b153b745c6098dacc33 --- /dev/null +++ b/codenet/public_test_cases/p03965/input.2.txt @@ -0,0 +1 @@ +ggppgggpgg diff --git a/codenet/public_test_cases/p03965/output.0.txt b/codenet/public_test_cases/p03965/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03965/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03965/output.1.txt b/codenet/public_test_cases/p03965/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03965/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03965/output.2.txt b/codenet/public_test_cases/p03965/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03965/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03966/input.0.txt b/codenet/public_test_cases/p03966/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f33eee775724a46fafe7d246e771aa87e7402ecb --- /dev/null +++ b/codenet/public_test_cases/p03966/input.0.txt @@ -0,0 +1,4 @@ +3 +2 3 +1 1 +3 2 diff --git a/codenet/public_test_cases/p03966/output.0.txt b/codenet/public_test_cases/p03966/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p03966/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p03967/input.0.txt b/codenet/public_test_cases/p03967/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..37ca8bede779918e2c88a3be33e826b03460f95e --- /dev/null +++ b/codenet/public_test_cases/p03967/input.0.txt @@ -0,0 +1 @@ +gpg diff --git a/codenet/public_test_cases/p03967/output.0.txt b/codenet/public_test_cases/p03967/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03967/output.0.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03968/input.0.txt b/codenet/public_test_cases/p03968/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5edb4e1326d2bc88ca8b04d04c36f502a3ea7ce --- /dev/null +++ b/codenet/public_test_cases/p03968/input.0.txt @@ -0,0 +1,7 @@ +6 +0 1 2 3 +0 4 6 1 +1 6 7 2 +2 7 5 3 +6 4 5 7 +4 0 3 5 diff --git a/codenet/public_test_cases/p03968/input.1.txt b/codenet/public_test_cases/p03968/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5edb4e1326d2bc88ca8b04d04c36f502a3ea7ce --- /dev/null +++ b/codenet/public_test_cases/p03968/input.1.txt @@ -0,0 +1,7 @@ +6 +0 1 2 3 +0 4 6 1 +1 6 7 2 +2 7 5 3 +6 4 5 7 +4 0 3 5 diff --git a/codenet/public_test_cases/p03968/input.2.txt b/codenet/public_test_cases/p03968/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c81345a50f4daf99f96de149eaa3a4210f011b --- /dev/null +++ b/codenet/public_test_cases/p03968/input.2.txt @@ -0,0 +1,7 @@ +6 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 diff --git a/codenet/public_test_cases/p03968/input.3.txt b/codenet/public_test_cases/p03968/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..bafceaf8cf73f6f4736031d15882575972e6c308 --- /dev/null +++ b/codenet/public_test_cases/p03968/input.3.txt @@ -0,0 +1,9 @@ +8 +0 0 0 0 +0 0 1 1 +0 1 0 1 +0 1 1 0 +1 0 0 1 +1 0 1 0 +1 1 0 0 +1 1 1 1 diff --git a/codenet/public_test_cases/p03968/output.0.txt b/codenet/public_test_cases/p03968/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03968/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03968/output.1.txt b/codenet/public_test_cases/p03968/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03968/output.1.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03968/output.2.txt b/codenet/public_test_cases/p03968/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cd613a43016ed8555ee531f91013f7ef75d6204 --- /dev/null +++ b/codenet/public_test_cases/p03968/output.2.txt @@ -0,0 +1 @@ +122880 diff --git a/codenet/public_test_cases/p03968/output.3.txt b/codenet/public_test_cases/p03968/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a29644e57ed8718497f53748fe4433ed7d7bdf79 --- /dev/null +++ b/codenet/public_test_cases/p03968/output.3.txt @@ -0,0 +1 @@ +144 diff --git a/codenet/public_test_cases/p03969/input.0.txt b/codenet/public_test_cases/p03969/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9e23db40da22ef50b5e99fbcc3a196730767b23 --- /dev/null +++ b/codenet/public_test_cases/p03969/input.0.txt @@ -0,0 +1,5 @@ +4 4 2 +1 2 +2 3 +3 1 +3 4 diff --git a/codenet/public_test_cases/p03969/input.1.txt b/codenet/public_test_cases/p03969/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9e23db40da22ef50b5e99fbcc3a196730767b23 --- /dev/null +++ b/codenet/public_test_cases/p03969/input.1.txt @@ -0,0 +1,5 @@ +4 4 2 +1 2 +2 3 +3 1 +3 4 diff --git a/codenet/public_test_cases/p03969/input.2.txt b/codenet/public_test_cases/p03969/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..77c8590efe59d04e643387c7d7d3360dd48db290 --- /dev/null +++ b/codenet/public_test_cases/p03969/input.2.txt @@ -0,0 +1,3 @@ +5 2 3 +1 2 +4 5 diff --git a/codenet/public_test_cases/p03969/input.3.txt b/codenet/public_test_cases/p03969/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..733e9fdcc399f6295d8b4292e6e119eecae6beeb --- /dev/null +++ b/codenet/public_test_cases/p03969/input.3.txt @@ -0,0 +1,13 @@ +11 12 48 +3 1 +8 2 +4 9 +5 4 +1 6 +2 9 +8 3 +10 8 +4 10 +8 6 +11 7 +1 8 diff --git a/codenet/public_test_cases/p03969/output.0.txt b/codenet/public_test_cases/p03969/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03969/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03969/output.1.txt b/codenet/public_test_cases/p03969/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03969/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03969/output.2.txt b/codenet/public_test_cases/p03969/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03969/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03969/output.3.txt b/codenet/public_test_cases/p03969/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1e33b72d33b39624024032db63bb8fa587cd902 --- /dev/null +++ b/codenet/public_test_cases/p03969/output.3.txt @@ -0,0 +1 @@ +569519295 diff --git a/codenet/public_test_cases/p03970/input.0.txt b/codenet/public_test_cases/p03970/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7f43fb953ada7dadda2d3eab68d3d9881345f71 --- /dev/null +++ b/codenet/public_test_cases/p03970/input.0.txt @@ -0,0 +1 @@ +C0DEFESTIVAL2O16 diff --git a/codenet/public_test_cases/p03970/input.1.txt b/codenet/public_test_cases/p03970/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7f43fb953ada7dadda2d3eab68d3d9881345f71 --- /dev/null +++ b/codenet/public_test_cases/p03970/input.1.txt @@ -0,0 +1 @@ +C0DEFESTIVAL2O16 diff --git a/codenet/public_test_cases/p03970/input.2.txt b/codenet/public_test_cases/p03970/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..607b641a31ed0b7cfeb86c59c40693231d674368 --- /dev/null +++ b/codenet/public_test_cases/p03970/input.2.txt @@ -0,0 +1 @@ +FESTIVAL2016CODE diff --git a/codenet/public_test_cases/p03970/output.0.txt b/codenet/public_test_cases/p03970/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03970/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03970/output.1.txt b/codenet/public_test_cases/p03970/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03970/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03970/output.2.txt b/codenet/public_test_cases/p03970/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03970/output.2.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03971/input.0.txt b/codenet/public_test_cases/p03971/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d64452c2558bc27292b603b24d183c5b66a61b3e --- /dev/null +++ b/codenet/public_test_cases/p03971/input.0.txt @@ -0,0 +1,2 @@ +10 2 3 +abccabaabb diff --git a/codenet/public_test_cases/p03971/input.1.txt b/codenet/public_test_cases/p03971/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c20f906e276584ec2139a47f8ec7e95bbb0d433 --- /dev/null +++ b/codenet/public_test_cases/p03971/input.1.txt @@ -0,0 +1,2 @@ +12 5 2 +cabbabaacaba diff --git a/codenet/public_test_cases/p03971/input.2.txt b/codenet/public_test_cases/p03971/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..438b14cb26ee07a45fba67d5587c108bcaca3709 --- /dev/null +++ b/codenet/public_test_cases/p03971/input.2.txt @@ -0,0 +1,2 @@ +5 2 2 +ccccc diff --git a/codenet/public_test_cases/p03971/input.3.txt b/codenet/public_test_cases/p03971/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d64452c2558bc27292b603b24d183c5b66a61b3e --- /dev/null +++ b/codenet/public_test_cases/p03971/input.3.txt @@ -0,0 +1,2 @@ +10 2 3 +abccabaabb diff --git a/codenet/public_test_cases/p03971/output.0.txt b/codenet/public_test_cases/p03971/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f827a85124b9a98d43419d6976a42b581ba4734 --- /dev/null +++ b/codenet/public_test_cases/p03971/output.0.txt @@ -0,0 +1,10 @@ +Yes +Yes +No +No +Yes +Yes +Yes +No +No +No diff --git a/codenet/public_test_cases/p03971/output.1.txt b/codenet/public_test_cases/p03971/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..88a81d5b84ef9ea9343395de2bfae46bc375a790 --- /dev/null +++ b/codenet/public_test_cases/p03971/output.1.txt @@ -0,0 +1,12 @@ +No +Yes +Yes +Yes +Yes +No +Yes +Yes +No +Yes +No +No diff --git a/codenet/public_test_cases/p03971/output.2.txt b/codenet/public_test_cases/p03971/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4420a22e06cb925eff9a3e4ec9c45a37d4ef9f1a --- /dev/null +++ b/codenet/public_test_cases/p03971/output.2.txt @@ -0,0 +1,5 @@ +No +No +No +No +No diff --git a/codenet/public_test_cases/p03971/output.3.txt b/codenet/public_test_cases/p03971/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f827a85124b9a98d43419d6976a42b581ba4734 --- /dev/null +++ b/codenet/public_test_cases/p03971/output.3.txt @@ -0,0 +1,10 @@ +Yes +Yes +No +No +Yes +Yes +Yes +No +No +No diff --git a/codenet/public_test_cases/p03972/input.0.txt b/codenet/public_test_cases/p03972/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f257cc7217ad2f38a7d25ab2b62ec63a24d89eba --- /dev/null +++ b/codenet/public_test_cases/p03972/input.0.txt @@ -0,0 +1,5 @@ +2 2 +3 +5 +2 +7 diff --git a/codenet/public_test_cases/p03972/input.1.txt b/codenet/public_test_cases/p03972/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a34c20d9e38d68e76d1d1827c75f99defaacaabd --- /dev/null +++ b/codenet/public_test_cases/p03972/input.1.txt @@ -0,0 +1,8 @@ +4 3 +2 +4 +8 +1 +2 +9 +3 diff --git a/codenet/public_test_cases/p03972/input.2.txt b/codenet/public_test_cases/p03972/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f257cc7217ad2f38a7d25ab2b62ec63a24d89eba --- /dev/null +++ b/codenet/public_test_cases/p03972/input.2.txt @@ -0,0 +1,5 @@ +2 2 +3 +5 +2 +7 diff --git a/codenet/public_test_cases/p03972/output.0.txt b/codenet/public_test_cases/p03972/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f04c001f3f7fd5d290d0264b4a2c35f7b159ac42 --- /dev/null +++ b/codenet/public_test_cases/p03972/output.0.txt @@ -0,0 +1 @@ +29 diff --git a/codenet/public_test_cases/p03972/output.1.txt b/codenet/public_test_cases/p03972/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..abdfb053e41e2af75ba7e11f82b4ef0c312566a7 --- /dev/null +++ b/codenet/public_test_cases/p03972/output.1.txt @@ -0,0 +1 @@ +60 diff --git a/codenet/public_test_cases/p03972/output.2.txt b/codenet/public_test_cases/p03972/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f04c001f3f7fd5d290d0264b4a2c35f7b159ac42 --- /dev/null +++ b/codenet/public_test_cases/p03972/output.2.txt @@ -0,0 +1 @@ +29 diff --git a/codenet/public_test_cases/p03973/input.0.txt b/codenet/public_test_cases/p03973/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6f10ee4a4f45b977d282ab767709f09579829da --- /dev/null +++ b/codenet/public_test_cases/p03973/input.0.txt @@ -0,0 +1,4 @@ +3 +3 +2 +5 diff --git a/codenet/public_test_cases/p03973/input.1.txt b/codenet/public_test_cases/p03973/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..18523e6a4a89004d1c8c191b0f941dcea6cee502 --- /dev/null +++ b/codenet/public_test_cases/p03973/input.1.txt @@ -0,0 +1,16 @@ +15 +3 +1 +4 +1 +5 +9 +2 +6 +5 +3 +5 +8 +9 +7 +9 diff --git a/codenet/public_test_cases/p03973/input.2.txt b/codenet/public_test_cases/p03973/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6f10ee4a4f45b977d282ab767709f09579829da --- /dev/null +++ b/codenet/public_test_cases/p03973/input.2.txt @@ -0,0 +1,4 @@ +3 +3 +2 +5 diff --git a/codenet/public_test_cases/p03973/output.0.txt b/codenet/public_test_cases/p03973/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03973/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03973/output.1.txt b/codenet/public_test_cases/p03973/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c032078a4a21c5c51d3c93d91717c1dabbb8cd0 --- /dev/null +++ b/codenet/public_test_cases/p03973/output.1.txt @@ -0,0 +1 @@ +18 diff --git a/codenet/public_test_cases/p03973/output.2.txt b/codenet/public_test_cases/p03973/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03973/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03974/input.0.txt b/codenet/public_test_cases/p03974/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..921e6210201c461a40ed54aff05242d5c990cab1 --- /dev/null +++ b/codenet/public_test_cases/p03974/input.0.txt @@ -0,0 +1,12 @@ +5 +aa +abbaa +abbba +aaab +aaaaaba +5 +1 abcdefghijklmnopqrstuvwxyz +2 bacdefghijklmnopqrstuvwxyz +3 abcdefghijklmnopqrstuvwxyz +4 bacdefghijklmnopqrstuvwxyz +5 abcdefghijklmnopqrstuvwxyz diff --git a/codenet/public_test_cases/p03974/input.1.txt b/codenet/public_test_cases/p03974/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..13fc5b27c62b11bbb2fae4955d3e7318a2d724ac --- /dev/null +++ b/codenet/public_test_cases/p03974/input.1.txt @@ -0,0 +1,16 @@ +8 +abrakatabra +abadaba +abracadabra +atcoder +grand +contest +ababa +a +6 +3 abcdefghijklmnopqrstuvwxyz +6 qwertyuiopasdfghjklzxcvbnm +8 poiuytrewqlkjhgfdsamnbvcxz +2 qazwsxedcrfvtgbyhnujmikolp +1 plokmijnuhbygvtfcrdxeszwaq +4 mnbvcxzasdfghjklpoiuytrewq diff --git a/codenet/public_test_cases/p03974/input.2.txt b/codenet/public_test_cases/p03974/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..921e6210201c461a40ed54aff05242d5c990cab1 --- /dev/null +++ b/codenet/public_test_cases/p03974/input.2.txt @@ -0,0 +1,12 @@ +5 +aa +abbaa +abbba +aaab +aaaaaba +5 +1 abcdefghijklmnopqrstuvwxyz +2 bacdefghijklmnopqrstuvwxyz +3 abcdefghijklmnopqrstuvwxyz +4 bacdefghijklmnopqrstuvwxyz +5 abcdefghijklmnopqrstuvwxyz diff --git a/codenet/public_test_cases/p03974/output.0.txt b/codenet/public_test_cases/p03974/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1457ee918ec7f9abe66dc652347d1bccddc0cd6f --- /dev/null +++ b/codenet/public_test_cases/p03974/output.0.txt @@ -0,0 +1,5 @@ +1 +2 +5 +4 +2 diff --git a/codenet/public_test_cases/p03974/output.1.txt b/codenet/public_test_cases/p03974/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6cb8f3eacfde389f2eb16f589a317eb53444fbc5 --- /dev/null +++ b/codenet/public_test_cases/p03974/output.1.txt @@ -0,0 +1,6 @@ +4 +8 +2 +3 +4 +7 diff --git a/codenet/public_test_cases/p03974/output.2.txt b/codenet/public_test_cases/p03974/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1457ee918ec7f9abe66dc652347d1bccddc0cd6f --- /dev/null +++ b/codenet/public_test_cases/p03974/output.2.txt @@ -0,0 +1,5 @@ +1 +2 +5 +4 +2 diff --git a/codenet/public_test_cases/p03975/input.0.txt b/codenet/public_test_cases/p03975/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..397f8096b210351c650e7eb7674508dbe57b780b --- /dev/null +++ b/codenet/public_test_cases/p03975/input.0.txt @@ -0,0 +1,6 @@ +5 5 9 +4 +3 +6 +9 +1 diff --git a/codenet/public_test_cases/p03975/input.1.txt b/codenet/public_test_cases/p03975/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..958e29e7ff6e0a0217e9786209ede39c81da9104 --- /dev/null +++ b/codenet/public_test_cases/p03975/input.1.txt @@ -0,0 +1,5 @@ +4 3 6 +9 +6 +8 +1 diff --git a/codenet/public_test_cases/p03975/input.2.txt b/codenet/public_test_cases/p03975/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..397f8096b210351c650e7eb7674508dbe57b780b --- /dev/null +++ b/codenet/public_test_cases/p03975/input.2.txt @@ -0,0 +1,6 @@ +5 5 9 +4 +3 +6 +9 +1 diff --git a/codenet/public_test_cases/p03975/input.3.txt b/codenet/public_test_cases/p03975/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d00cba2ce8e257b39584c9d0fbdbeecfb67ae78 --- /dev/null +++ b/codenet/public_test_cases/p03975/input.3.txt @@ -0,0 +1,3 @@ +2 1 2 +1 +2 diff --git a/codenet/public_test_cases/p03975/input.4.txt b/codenet/public_test_cases/p03975/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..56743babb9440a16e421aa07efb25ea7609eedd5 --- /dev/null +++ b/codenet/public_test_cases/p03975/input.4.txt @@ -0,0 +1,6 @@ +5 4 9 +5 +6 +7 +8 +9 diff --git a/codenet/public_test_cases/p03975/output.0.txt b/codenet/public_test_cases/p03975/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03975/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03975/output.1.txt b/codenet/public_test_cases/p03975/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03975/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03975/output.2.txt b/codenet/public_test_cases/p03975/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03975/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03975/output.3.txt b/codenet/public_test_cases/p03975/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03975/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03975/output.4.txt b/codenet/public_test_cases/p03975/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03975/output.4.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03976/input.0.txt b/codenet/public_test_cases/p03976/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..eef5e16f1a9db318aed08a14d2856e899c24d883 --- /dev/null +++ b/codenet/public_test_cases/p03976/input.0.txt @@ -0,0 +1,10 @@ +9 3 +APPLE +ANT +ATCODER +BLOCK +BULL +BOSS +CAT +DOG +EGG diff --git a/codenet/public_test_cases/p03976/input.1.txt b/codenet/public_test_cases/p03976/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eef5e16f1a9db318aed08a14d2856e899c24d883 --- /dev/null +++ b/codenet/public_test_cases/p03976/input.1.txt @@ -0,0 +1,10 @@ +9 3 +APPLE +ANT +ATCODER +BLOCK +BULL +BOSS +CAT +DOG +EGG diff --git a/codenet/public_test_cases/p03976/input.2.txt b/codenet/public_test_cases/p03976/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a62af6f02641c676853c6b26c081879b80ad420 --- /dev/null +++ b/codenet/public_test_cases/p03976/input.2.txt @@ -0,0 +1,4 @@ +3 2 +KU +KYOUDAI +KYOTOUNIV diff --git a/codenet/public_test_cases/p03976/output.0.txt b/codenet/public_test_cases/p03976/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03976/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03976/output.1.txt b/codenet/public_test_cases/p03976/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03976/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03976/output.2.txt b/codenet/public_test_cases/p03976/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03976/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03977/input.0.txt b/codenet/public_test_cases/p03977/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b14d67bbc6c61d51590084d2a98083174fab6f8 --- /dev/null +++ b/codenet/public_test_cases/p03977/input.0.txt @@ -0,0 +1,4 @@ +3 +3 1 +4 108 +1 10 diff --git a/codenet/public_test_cases/p03977/input.1.txt b/codenet/public_test_cases/p03977/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b14d67bbc6c61d51590084d2a98083174fab6f8 --- /dev/null +++ b/codenet/public_test_cases/p03977/input.1.txt @@ -0,0 +1,4 @@ +3 +3 1 +4 108 +1 10 diff --git a/codenet/public_test_cases/p03977/output.0.txt b/codenet/public_test_cases/p03977/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0c50c8b5fff54ef9ed0fd7ad02c9d04d8fdb71d --- /dev/null +++ b/codenet/public_test_cases/p03977/output.0.txt @@ -0,0 +1,3 @@ +255 +400 +10 diff --git a/codenet/public_test_cases/p03977/output.1.txt b/codenet/public_test_cases/p03977/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f0c50c8b5fff54ef9ed0fd7ad02c9d04d8fdb71d --- /dev/null +++ b/codenet/public_test_cases/p03977/output.1.txt @@ -0,0 +1,3 @@ +255 +400 +10 diff --git a/codenet/public_test_cases/p03978/input.1.txt b/codenet/public_test_cases/p03978/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p03978/input.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p03978/output.1.txt b/codenet/public_test_cases/p03978/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/codenet/public_test_cases/p03978/output.1.txt @@ -0,0 +1 @@ + diff --git a/codenet/public_test_cases/p03980/input.0.txt b/codenet/public_test_cases/p03980/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..805c688046345b4b622fa979cfef2f240b365949 --- /dev/null +++ b/codenet/public_test_cases/p03980/input.0.txt @@ -0,0 +1,5 @@ +4 +_(4,51)? +^(99,_(3,67))? +_(0,87)? +3? diff --git a/codenet/public_test_cases/p03980/input.1.txt b/codenet/public_test_cases/p03980/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..805c688046345b4b622fa979cfef2f240b365949 --- /dev/null +++ b/codenet/public_test_cases/p03980/input.1.txt @@ -0,0 +1,5 @@ +4 +_(4,51)? +^(99,_(3,67))? +_(0,87)? +3? diff --git a/codenet/public_test_cases/p03980/input.2.txt b/codenet/public_test_cases/p03980/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..91745cdc8adcf6c707074023aa904b54833cdc56 --- /dev/null +++ b/codenet/public_test_cases/p03980/input.2.txt @@ -0,0 +1,8 @@ +7 +_(23,^(_(22,40),4))? +_(0,99)? +^(99,_(^(19,2),5))? +_(^(43,20),^(30,29))? +^(_(20,3),_(50,41))? +^(_(20,3),_(3,41))? +^(_(20,3),_(4,41))? diff --git a/codenet/public_test_cases/p03980/output.0.txt b/codenet/public_test_cases/p03980/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4171cc3523269d2455b0dff9057dab2aa982308 --- /dev/null +++ b/codenet/public_test_cases/p03980/output.0.txt @@ -0,0 +1,4 @@ +4 5 +99 4 +0 3 +3 2 diff --git a/codenet/public_test_cases/p03980/output.1.txt b/codenet/public_test_cases/p03980/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a4171cc3523269d2455b0dff9057dab2aa982308 --- /dev/null +++ b/codenet/public_test_cases/p03980/output.1.txt @@ -0,0 +1,4 @@ +4 5 +99 4 +0 3 +3 2 diff --git a/codenet/public_test_cases/p03980/output.2.txt b/codenet/public_test_cases/p03980/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba300eb5662ed1a152136d03a8fd590248c7db63 --- /dev/null +++ b/codenet/public_test_cases/p03980/output.2.txt @@ -0,0 +1,7 @@ +22 18 +0 3 +99 4 +30 17 +41 17 +3 14 +4 15 diff --git a/codenet/public_test_cases/p03981/input.0.txt b/codenet/public_test_cases/p03981/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..db2fcbc4c1f5c985ba531b76d82256f1fe94034b --- /dev/null +++ b/codenet/public_test_cases/p03981/input.0.txt @@ -0,0 +1 @@ +abcabc diff --git a/codenet/public_test_cases/p03981/input.1.txt b/codenet/public_test_cases/p03981/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a8030836dd962e29a9a997a5bea747314d6605a4 --- /dev/null +++ b/codenet/public_test_cases/p03981/input.1.txt @@ -0,0 +1 @@ +abcbabbcabbc diff --git a/codenet/public_test_cases/p03981/input.2.txt b/codenet/public_test_cases/p03981/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..db2fcbc4c1f5c985ba531b76d82256f1fe94034b --- /dev/null +++ b/codenet/public_test_cases/p03981/input.2.txt @@ -0,0 +1 @@ +abcabc diff --git a/codenet/public_test_cases/p03981/input.3.txt b/codenet/public_test_cases/p03981/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..474987c2cb0ee4fe61865c86ec86fd4819976874 --- /dev/null +++ b/codenet/public_test_cases/p03981/input.3.txt @@ -0,0 +1 @@ +abracadabra diff --git a/codenet/public_test_cases/p03981/input.4.txt b/codenet/public_test_cases/p03981/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ddaf4446f6feb5af1727d1667c43f14dd8b56f6f --- /dev/null +++ b/codenet/public_test_cases/p03981/input.4.txt @@ -0,0 +1 @@ +bbcacbcbcabbabacccbbcacbaaababbacabaaccbccabcaabba diff --git a/codenet/public_test_cases/p03981/output.0.txt b/codenet/public_test_cases/p03981/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03981/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03981/output.1.txt b/codenet/public_test_cases/p03981/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p03981/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p03981/output.2.txt b/codenet/public_test_cases/p03981/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p03981/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p03981/output.3.txt b/codenet/public_test_cases/p03981/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03981/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03981/output.4.txt b/codenet/public_test_cases/p03981/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c739b42c4d2ce23786c5350641d0adbf5fa7d6b2 --- /dev/null +++ b/codenet/public_test_cases/p03981/output.4.txt @@ -0,0 +1 @@ +44 diff --git a/codenet/public_test_cases/p03982/input.0.txt b/codenet/public_test_cases/p03982/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..31cf1a4eee021a30a0dc5d7da96f8d1f7341e1ad --- /dev/null +++ b/codenet/public_test_cases/p03982/input.0.txt @@ -0,0 +1,3 @@ +2 +1 5 +3 1 diff --git a/codenet/public_test_cases/p03982/input.1.txt b/codenet/public_test_cases/p03982/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..31cf1a4eee021a30a0dc5d7da96f8d1f7341e1ad --- /dev/null +++ b/codenet/public_test_cases/p03982/input.1.txt @@ -0,0 +1,3 @@ +2 +1 5 +3 1 diff --git a/codenet/public_test_cases/p03982/input.2.txt b/codenet/public_test_cases/p03982/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..68f8d91ecfbdf3c164912a92f42367cb30a43948 --- /dev/null +++ b/codenet/public_test_cases/p03982/input.2.txt @@ -0,0 +1,3 @@ +5 +1 2 3 4 5 +3 3 1 1 1 diff --git a/codenet/public_test_cases/p03982/input.3.txt b/codenet/public_test_cases/p03982/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..086072c608ec3f40d0d148806d3d65cafeeb273e --- /dev/null +++ b/codenet/public_test_cases/p03982/input.3.txt @@ -0,0 +1,3 @@ +27 +46 3 4 2 10 2 5 2 6 7 20 13 9 49 3 8 4 3 19 9 3 5 4 13 9 5 7 +10 2 5 6 2 6 3 2 2 5 3 11 13 2 2 7 7 3 9 5 13 4 17 2 2 2 4 diff --git a/codenet/public_test_cases/p03982/input.4.txt b/codenet/public_test_cases/p03982/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..887406890bff122f36ea60c31a08044c770c72ed --- /dev/null +++ b/codenet/public_test_cases/p03982/input.4.txt @@ -0,0 +1,3 @@ +2 +1 99999999999 +1234567891 1 diff --git a/codenet/public_test_cases/p03982/input.5.txt b/codenet/public_test_cases/p03982/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..7dd2f8226cf6ab22d9f2eb0f4841b07486db82ad --- /dev/null +++ b/codenet/public_test_cases/p03982/input.5.txt @@ -0,0 +1,3 @@ +18 +3878348 423911 8031742 1035156 24256 10344593 19379 3867285 4481365 1475384 1959412 1383457 164869 4633165 6674637 9732852 10459147 2810788 +1236501 770807 4003004 131688 1965412 266841 3980782 565060 816313 192940 541896 250801 217586 3806049 1220252 1161079 31168 2008961 diff --git a/codenet/public_test_cases/p03982/output.0.txt b/codenet/public_test_cases/p03982/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03982/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03982/output.1.txt b/codenet/public_test_cases/p03982/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03982/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03982/output.2.txt b/codenet/public_test_cases/p03982/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03982/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03982/output.3.txt b/codenet/public_test_cases/p03982/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..21e72e8ac3d7e23bd6532b5f1f4a6bdf8362e6cf --- /dev/null +++ b/codenet/public_test_cases/p03982/output.3.txt @@ -0,0 +1 @@ +48 diff --git a/codenet/public_test_cases/p03982/output.4.txt b/codenet/public_test_cases/p03982/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a32a4347a4ec2c9f9a91b2f40ecca8701af1b22a --- /dev/null +++ b/codenet/public_test_cases/p03982/output.4.txt @@ -0,0 +1 @@ +1234567890 diff --git a/codenet/public_test_cases/p03982/output.5.txt b/codenet/public_test_cases/p03982/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..d284a4983253a0c5fe8deb1cac4141c9fc5d8f14 --- /dev/null +++ b/codenet/public_test_cases/p03982/output.5.txt @@ -0,0 +1 @@ +6302172 diff --git a/codenet/public_test_cases/p03983/input.0.txt b/codenet/public_test_cases/p03983/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce1349bc1a2212e14be6194f5bcbb47ada25147e --- /dev/null +++ b/codenet/public_test_cases/p03983/input.0.txt @@ -0,0 +1,3 @@ +2 +20 8 +20 12 diff --git a/codenet/public_test_cases/p03983/input.1.txt b/codenet/public_test_cases/p03983/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8da4be2feb37b861d4640e73f3b1d42944e3e08 --- /dev/null +++ b/codenet/public_test_cases/p03983/input.1.txt @@ -0,0 +1,2 @@ +1 +20 3 diff --git a/codenet/public_test_cases/p03983/input.2.txt b/codenet/public_test_cases/p03983/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..59dc39d9e9afd6d479b6084bc4aa0675bfc56eb0 --- /dev/null +++ b/codenet/public_test_cases/p03983/input.2.txt @@ -0,0 +1,2 @@ +1 +200 1 diff --git a/codenet/public_test_cases/p03983/input.3.txt b/codenet/public_test_cases/p03983/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce1349bc1a2212e14be6194f5bcbb47ada25147e --- /dev/null +++ b/codenet/public_test_cases/p03983/input.3.txt @@ -0,0 +1,3 @@ +2 +20 8 +20 12 diff --git a/codenet/public_test_cases/p03983/output.0.txt b/codenet/public_test_cases/p03983/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f83f7f91731509fa13b156ac57ed875bbfebd1c1 --- /dev/null +++ b/codenet/public_test_cases/p03983/output.0.txt @@ -0,0 +1,2 @@ +24 +20 diff --git a/codenet/public_test_cases/p03983/output.1.txt b/codenet/public_test_cases/p03983/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fdcd7c44cb1791f45e7386a8f230e018fd7e052 --- /dev/null +++ b/codenet/public_test_cases/p03983/output.1.txt @@ -0,0 +1 @@ +67 diff --git a/codenet/public_test_cases/p03983/output.2.txt b/codenet/public_test_cases/p03983/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cc4caa84ffe386621f30ccebb5813f1bebcc8d1 --- /dev/null +++ b/codenet/public_test_cases/p03983/output.2.txt @@ -0,0 +1 @@ +148322100 diff --git a/codenet/public_test_cases/p03983/output.3.txt b/codenet/public_test_cases/p03983/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f83f7f91731509fa13b156ac57ed875bbfebd1c1 --- /dev/null +++ b/codenet/public_test_cases/p03983/output.3.txt @@ -0,0 +1,2 @@ +24 +20 diff --git a/codenet/public_test_cases/p03984/input.0.txt b/codenet/public_test_cases/p03984/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac0195fe747993291953b33cd2c6baf987c8eb6c --- /dev/null +++ b/codenet/public_test_cases/p03984/input.0.txt @@ -0,0 +1,5 @@ +4 2 +2 +3 +1 +1 diff --git a/codenet/public_test_cases/p03984/input.1.txt b/codenet/public_test_cases/p03984/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d1992bff22860bddedac3335a473a37cd24fc18f --- /dev/null +++ b/codenet/public_test_cases/p03984/input.1.txt @@ -0,0 +1,11 @@ +10 5 +2 +3 +4 +1 +1 +1 +2 +3 +3 +4 diff --git a/codenet/public_test_cases/p03984/input.2.txt b/codenet/public_test_cases/p03984/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..902eb6151ea2755f10d19aeb383df9549ec33080 --- /dev/null +++ b/codenet/public_test_cases/p03984/input.2.txt @@ -0,0 +1,5 @@ +4 4 +2 +3 +4 +1 diff --git a/codenet/public_test_cases/p03984/input.3.txt b/codenet/public_test_cases/p03984/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac0195fe747993291953b33cd2c6baf987c8eb6c --- /dev/null +++ b/codenet/public_test_cases/p03984/input.3.txt @@ -0,0 +1,5 @@ +4 2 +2 +3 +1 +1 diff --git a/codenet/public_test_cases/p03984/output.0.txt b/codenet/public_test_cases/p03984/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03984/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03984/output.1.txt b/codenet/public_test_cases/p03984/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..59bf5f344ff60a33cc5bc160951ebba8b27cf932 --- /dev/null +++ b/codenet/public_test_cases/p03984/output.1.txt @@ -0,0 +1 @@ +926250 diff --git a/codenet/public_test_cases/p03984/output.2.txt b/codenet/public_test_cases/p03984/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3f407c0955bb5738e40a82664c79b63f04a9adb --- /dev/null +++ b/codenet/public_test_cases/p03984/output.2.txt @@ -0,0 +1 @@ +55 diff --git a/codenet/public_test_cases/p03984/output.3.txt b/codenet/public_test_cases/p03984/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p03984/output.3.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p03985/input.0.txt b/codenet/public_test_cases/p03985/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..72b510bfa826c2b45944d25d4011abeb5bcf01eb --- /dev/null +++ b/codenet/public_test_cases/p03985/input.0.txt @@ -0,0 +1,5 @@ +4 +0 -3 2 0 3 2 +0 0 9 8 8 2 +0 0 9 10 10 5 +0 0 707 1000 1000 707 diff --git a/codenet/public_test_cases/p03985/input.1.txt b/codenet/public_test_cases/p03985/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..72b510bfa826c2b45944d25d4011abeb5bcf01eb --- /dev/null +++ b/codenet/public_test_cases/p03985/input.1.txt @@ -0,0 +1,5 @@ +4 +0 -3 2 0 3 2 +0 0 9 8 8 2 +0 0 9 10 10 5 +0 0 707 1000 1000 707 diff --git a/codenet/public_test_cases/p03985/output.0.txt b/codenet/public_test_cases/p03985/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e8091f3db0add27dbc8eb91fc6bfda2b3234c7c --- /dev/null +++ b/codenet/public_test_cases/p03985/output.0.txt @@ -0,0 +1,4 @@ +3 +10 +21 +180 diff --git a/codenet/public_test_cases/p03985/output.1.txt b/codenet/public_test_cases/p03985/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e8091f3db0add27dbc8eb91fc6bfda2b3234c7c --- /dev/null +++ b/codenet/public_test_cases/p03985/output.1.txt @@ -0,0 +1,4 @@ +3 +10 +21 +180 diff --git a/codenet/public_test_cases/p03986/input.0.txt b/codenet/public_test_cases/p03986/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb7dd7d38f9e8532568cd084bee8eb16799055cb --- /dev/null +++ b/codenet/public_test_cases/p03986/input.0.txt @@ -0,0 +1 @@ +TSTTSS diff --git a/codenet/public_test_cases/p03986/input.1.txt b/codenet/public_test_cases/p03986/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb7dd7d38f9e8532568cd084bee8eb16799055cb --- /dev/null +++ b/codenet/public_test_cases/p03986/input.1.txt @@ -0,0 +1 @@ +TSTTSS diff --git a/codenet/public_test_cases/p03986/input.2.txt b/codenet/public_test_cases/p03986/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..187f6700321bbf7b7c6ff45479d31a3307f5da45 --- /dev/null +++ b/codenet/public_test_cases/p03986/input.2.txt @@ -0,0 +1 @@ +SSTTST diff --git a/codenet/public_test_cases/p03986/input.3.txt b/codenet/public_test_cases/p03986/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a8091687ff8b77337c6d3d6b15e2775a6f6b309 --- /dev/null +++ b/codenet/public_test_cases/p03986/input.3.txt @@ -0,0 +1 @@ +TSSTTTSS diff --git a/codenet/public_test_cases/p03986/output.0.txt b/codenet/public_test_cases/p03986/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03986/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03986/output.1.txt b/codenet/public_test_cases/p03986/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03986/output.1.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03986/output.2.txt b/codenet/public_test_cases/p03986/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03986/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03986/output.3.txt b/codenet/public_test_cases/p03986/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03986/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03987/input.0.txt b/codenet/public_test_cases/p03987/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0be9b31f60716a41721b53522fbabb7dd714eee7 --- /dev/null +++ b/codenet/public_test_cases/p03987/input.0.txt @@ -0,0 +1,2 @@ +3 +2 1 3 diff --git a/codenet/public_test_cases/p03987/input.1.txt b/codenet/public_test_cases/p03987/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0be9b31f60716a41721b53522fbabb7dd714eee7 --- /dev/null +++ b/codenet/public_test_cases/p03987/input.1.txt @@ -0,0 +1,2 @@ +3 +2 1 3 diff --git a/codenet/public_test_cases/p03987/input.2.txt b/codenet/public_test_cases/p03987/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b74a6382fd4c003048566f5a3755ce6d3750f919 --- /dev/null +++ b/codenet/public_test_cases/p03987/input.2.txt @@ -0,0 +1,2 @@ +4 +1 3 2 4 diff --git a/codenet/public_test_cases/p03987/input.3.txt b/codenet/public_test_cases/p03987/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f28b12a6790b33bc2bfac0c1c81c5c0f5fdf2f0 --- /dev/null +++ b/codenet/public_test_cases/p03987/input.3.txt @@ -0,0 +1,2 @@ +8 +5 4 8 1 2 6 7 3 diff --git a/codenet/public_test_cases/p03987/output.0.txt b/codenet/public_test_cases/p03987/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03987/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03987/output.1.txt b/codenet/public_test_cases/p03987/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03987/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03987/output.2.txt b/codenet/public_test_cases/p03987/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p03987/output.2.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p03987/output.3.txt b/codenet/public_test_cases/p03987/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a862eb8444d443dbaf5db59f7e27d956cd7691d5 --- /dev/null +++ b/codenet/public_test_cases/p03987/output.3.txt @@ -0,0 +1 @@ +85 diff --git a/codenet/public_test_cases/p03988/input.0.txt b/codenet/public_test_cases/p03988/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe2e918f671350e8c81a0ad424fa93d60f8a2cde --- /dev/null +++ b/codenet/public_test_cases/p03988/input.0.txt @@ -0,0 +1,2 @@ +5 +3 2 2 3 3 diff --git a/codenet/public_test_cases/p03988/input.1.txt b/codenet/public_test_cases/p03988/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b073c97cd642976c8bc803d1a5a88f786977247 --- /dev/null +++ b/codenet/public_test_cases/p03988/input.1.txt @@ -0,0 +1,2 @@ +6 +1 1 1 1 1 5 diff --git a/codenet/public_test_cases/p03988/input.2.txt b/codenet/public_test_cases/p03988/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c54d55a8d166e20db07dc7c7ab25cb293a0c3cfd --- /dev/null +++ b/codenet/public_test_cases/p03988/input.2.txt @@ -0,0 +1,2 @@ +3 +1 1 2 diff --git a/codenet/public_test_cases/p03988/input.3.txt b/codenet/public_test_cases/p03988/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe2e918f671350e8c81a0ad424fa93d60f8a2cde --- /dev/null +++ b/codenet/public_test_cases/p03988/input.3.txt @@ -0,0 +1,2 @@ +5 +3 2 2 3 3 diff --git a/codenet/public_test_cases/p03988/input.4.txt b/codenet/public_test_cases/p03988/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a101db8fbec1cc4e37d68494ca7036461dcf379f --- /dev/null +++ b/codenet/public_test_cases/p03988/input.4.txt @@ -0,0 +1,2 @@ +5 +4 3 2 3 4 diff --git a/codenet/public_test_cases/p03988/input.5.txt b/codenet/public_test_cases/p03988/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..00e1cc7de5bd942aa5de18969e6a0b2027822c4c --- /dev/null +++ b/codenet/public_test_cases/p03988/input.5.txt @@ -0,0 +1,2 @@ +10 +1 2 2 2 2 2 2 2 2 2 diff --git a/codenet/public_test_cases/p03988/input.6.txt b/codenet/public_test_cases/p03988/input.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..27a369495f4209b0e44525608e438d53ae411b2d --- /dev/null +++ b/codenet/public_test_cases/p03988/input.6.txt @@ -0,0 +1,2 @@ +10 +1 1 2 2 2 2 2 2 2 2 diff --git a/codenet/public_test_cases/p03988/output.0.txt b/codenet/public_test_cases/p03988/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p03988/output.0.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p03988/output.1.txt b/codenet/public_test_cases/p03988/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p03988/output.1.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p03988/output.2.txt b/codenet/public_test_cases/p03988/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p03988/output.2.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p03988/output.3.txt b/codenet/public_test_cases/p03988/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p03988/output.3.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p03988/output.4.txt b/codenet/public_test_cases/p03988/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p03988/output.4.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p03988/output.5.txt b/codenet/public_test_cases/p03988/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..0213dbe41c1e02aa78ea4bee84fd4c5e8d74da8d --- /dev/null +++ b/codenet/public_test_cases/p03988/output.5.txt @@ -0,0 +1 @@ +Possible diff --git a/codenet/public_test_cases/p03988/output.6.txt b/codenet/public_test_cases/p03988/output.6.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p03988/output.6.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p03989/input.0.txt b/codenet/public_test_cases/p03989/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p03989/input.0.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p03989/input.1.txt b/codenet/public_test_cases/p03989/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac08000ef10fb83a52c9fa8aa443e526baf9ba89 --- /dev/null +++ b/codenet/public_test_cases/p03989/input.1.txt @@ -0,0 +1 @@ +425 48 diff --git a/codenet/public_test_cases/p03989/input.2.txt b/codenet/public_test_cases/p03989/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b05461b1ba727d91054ac49487ae1ab1ceeb4967 --- /dev/null +++ b/codenet/public_test_cases/p03989/input.2.txt @@ -0,0 +1 @@ +4 1 diff --git a/codenet/public_test_cases/p03989/input.3.txt b/codenet/public_test_cases/p03989/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..109c32b18b1efa0beca194b39d372eff384919fa --- /dev/null +++ b/codenet/public_test_cases/p03989/input.3.txt @@ -0,0 +1 @@ +4 3 diff --git a/codenet/public_test_cases/p03989/input.4.txt b/codenet/public_test_cases/p03989/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p03989/input.4.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p03989/input.5.txt b/codenet/public_test_cases/p03989/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..805e7f5a05abb0767d277398dd810d64910d282f --- /dev/null +++ b/codenet/public_test_cases/p03989/input.5.txt @@ -0,0 +1 @@ +4 2 diff --git a/codenet/public_test_cases/p03989/output.0.txt b/codenet/public_test_cases/p03989/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03989/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03989/output.1.txt b/codenet/public_test_cases/p03989/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c0f07c1d035f7e130941c38479e8d22837daf48d --- /dev/null +++ b/codenet/public_test_cases/p03989/output.1.txt @@ -0,0 +1 @@ +756765083 diff --git a/codenet/public_test_cases/p03989/output.2.txt b/codenet/public_test_cases/p03989/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p03989/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p03989/output.3.txt b/codenet/public_test_cases/p03989/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p03989/output.3.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p03989/output.4.txt b/codenet/public_test_cases/p03989/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03989/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03989/output.5.txt b/codenet/public_test_cases/p03989/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p03989/output.5.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p03990/input.0.txt b/codenet/public_test_cases/p03990/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1210a620e24351ace095785b9fbb84c98186f30 --- /dev/null +++ b/codenet/public_test_cases/p03990/input.0.txt @@ -0,0 +1,7 @@ +4 1 2 +1 2 +1 3 +1 4 +2 1 +2 3 +1 4 diff --git a/codenet/public_test_cases/p03990/input.1.txt b/codenet/public_test_cases/p03990/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5c0baffc7b52854f628432037d73cc04c8a71553 --- /dev/null +++ b/codenet/public_test_cases/p03990/input.1.txt @@ -0,0 +1,7 @@ +4 1 2 +1 2 +3 4 +2 4 +1 2 +3 4 +1 3 diff --git a/codenet/public_test_cases/p03990/input.2.txt b/codenet/public_test_cases/p03990/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..388c4557f9dcb0b102bdd31c87e398d31df0f2d5 --- /dev/null +++ b/codenet/public_test_cases/p03990/input.2.txt @@ -0,0 +1,9 @@ +5 1 2 +1 2 +1 3 +1 4 +4 5 +2 1 +1 3 +1 5 +5 4 diff --git a/codenet/public_test_cases/p03990/input.3.txt b/codenet/public_test_cases/p03990/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b31cf56cbb21a8bf98e4fd23ae4c030745a9458 --- /dev/null +++ b/codenet/public_test_cases/p03990/input.3.txt @@ -0,0 +1,5 @@ +3 3 1 +1 2 +2 3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03990/input.4.txt b/codenet/public_test_cases/p03990/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1210a620e24351ace095785b9fbb84c98186f30 --- /dev/null +++ b/codenet/public_test_cases/p03990/input.4.txt @@ -0,0 +1,7 @@ +4 1 2 +1 2 +1 3 +1 4 +2 1 +2 3 +1 4 diff --git a/codenet/public_test_cases/p03990/input.5.txt b/codenet/public_test_cases/p03990/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..92c2495dca06f247ee510a72c95513c7b2bbaa24 --- /dev/null +++ b/codenet/public_test_cases/p03990/input.5.txt @@ -0,0 +1,7 @@ +4 2 1 +1 2 +3 4 +2 4 +1 2 +3 4 +1 3 diff --git a/codenet/public_test_cases/p03990/output.0.txt b/codenet/public_test_cases/p03990/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03990/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03990/output.1.txt b/codenet/public_test_cases/p03990/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03990/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03990/output.2.txt b/codenet/public_test_cases/p03990/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p03990/output.2.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p03990/output.3.txt b/codenet/public_test_cases/p03990/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03990/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03990/output.4.txt b/codenet/public_test_cases/p03990/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p03990/output.4.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p03990/output.5.txt b/codenet/public_test_cases/p03990/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p03990/output.5.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p03991/input.0.txt b/codenet/public_test_cases/p03991/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p03991/input.0.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03991/input.1.txt b/codenet/public_test_cases/p03991/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a228b06e601c1a4c8c4cfa2172b2486421746cb6 --- /dev/null +++ b/codenet/public_test_cases/p03991/input.1.txt @@ -0,0 +1,3 @@ +3 +1 2 +2 3 diff --git a/codenet/public_test_cases/p03991/input.2.txt b/codenet/public_test_cases/p03991/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..92e7e919d9086f19d0faf1800efb363a22b6e6b8 --- /dev/null +++ b/codenet/public_test_cases/p03991/input.2.txt @@ -0,0 +1,4 @@ +4 +1 2 +1 3 +1 4 diff --git a/codenet/public_test_cases/p03991/input.3.txt b/codenet/public_test_cases/p03991/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d28f51cfbcaf47face8ddeace7069ce587dca10e --- /dev/null +++ b/codenet/public_test_cases/p03991/input.3.txt @@ -0,0 +1,7 @@ +7 +1 2 +2 3 +2 4 +4 5 +4 6 +6 7 diff --git a/codenet/public_test_cases/p03991/output.0.txt b/codenet/public_test_cases/p03991/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..74cf3265ecdf3823bcfff4f98e74f552e53476d7 --- /dev/null +++ b/codenet/public_test_cases/p03991/output.0.txt @@ -0,0 +1,3 @@ +3 +7 +3 diff --git a/codenet/public_test_cases/p03991/output.1.txt b/codenet/public_test_cases/p03991/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..74cf3265ecdf3823bcfff4f98e74f552e53476d7 --- /dev/null +++ b/codenet/public_test_cases/p03991/output.1.txt @@ -0,0 +1,3 @@ +3 +7 +3 diff --git a/codenet/public_test_cases/p03991/output.2.txt b/codenet/public_test_cases/p03991/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0979cc2782b0309a29812e353f42c17f527df39f --- /dev/null +++ b/codenet/public_test_cases/p03991/output.2.txt @@ -0,0 +1,4 @@ +4 +15 +13 +4 diff --git a/codenet/public_test_cases/p03991/output.3.txt b/codenet/public_test_cases/p03991/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..df3a9e9b716a124bfbde3674f607e020986da75e --- /dev/null +++ b/codenet/public_test_cases/p03991/output.3.txt @@ -0,0 +1,7 @@ +7 +67 +150 +179 +122 +45 +7 diff --git a/codenet/public_test_cases/p03992/input.0.txt b/codenet/public_test_cases/p03992/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6278f144219063e186191a7a5d52cfbddda36ce0 --- /dev/null +++ b/codenet/public_test_cases/p03992/input.0.txt @@ -0,0 +1 @@ +CODEFESTIVAL diff --git a/codenet/public_test_cases/p03992/input.1.txt b/codenet/public_test_cases/p03992/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e9effbdca876e33a1bb182b8febfc6311d057de4 --- /dev/null +++ b/codenet/public_test_cases/p03992/input.1.txt @@ -0,0 +1 @@ +POSTGRADUATE diff --git a/codenet/public_test_cases/p03992/input.2.txt b/codenet/public_test_cases/p03992/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb5bd50943d1fd27deb7464ca1a8df5203af2c7c --- /dev/null +++ b/codenet/public_test_cases/p03992/input.2.txt @@ -0,0 +1 @@ +ABCDEFGHIJKL diff --git a/codenet/public_test_cases/p03992/input.3.txt b/codenet/public_test_cases/p03992/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6278f144219063e186191a7a5d52cfbddda36ce0 --- /dev/null +++ b/codenet/public_test_cases/p03992/input.3.txt @@ -0,0 +1 @@ +CODEFESTIVAL diff --git a/codenet/public_test_cases/p03992/output.0.txt b/codenet/public_test_cases/p03992/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..789d9a9a59e15c2b90f612bb25d69099d22213ff --- /dev/null +++ b/codenet/public_test_cases/p03992/output.0.txt @@ -0,0 +1 @@ +CODE FESTIVAL diff --git a/codenet/public_test_cases/p03992/output.1.txt b/codenet/public_test_cases/p03992/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dabca9775369260259f8ee1853d307041bc43c9 --- /dev/null +++ b/codenet/public_test_cases/p03992/output.1.txt @@ -0,0 +1 @@ +POST GRADUATE diff --git a/codenet/public_test_cases/p03992/output.2.txt b/codenet/public_test_cases/p03992/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dee88d909a688e985f5733a07ae50bd64a4edcb6 --- /dev/null +++ b/codenet/public_test_cases/p03992/output.2.txt @@ -0,0 +1 @@ +ABCD EFGHIJKL diff --git a/codenet/public_test_cases/p03992/output.3.txt b/codenet/public_test_cases/p03992/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..789d9a9a59e15c2b90f612bb25d69099d22213ff --- /dev/null +++ b/codenet/public_test_cases/p03992/output.3.txt @@ -0,0 +1 @@ +CODE FESTIVAL diff --git a/codenet/public_test_cases/p03993/input.0.txt b/codenet/public_test_cases/p03993/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..99499867d9a792adf26ec05dd5ce7536d885d371 --- /dev/null +++ b/codenet/public_test_cases/p03993/input.0.txt @@ -0,0 +1,2 @@ +4 +2 1 4 3 diff --git a/codenet/public_test_cases/p03993/input.1.txt b/codenet/public_test_cases/p03993/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b29044c7562263214ba07e95181d4fffa71da483 --- /dev/null +++ b/codenet/public_test_cases/p03993/input.1.txt @@ -0,0 +1,2 @@ +3 +2 3 1 diff --git a/codenet/public_test_cases/p03993/input.2.txt b/codenet/public_test_cases/p03993/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..67b5eb47d93a79b9f7f798005d3866c0a1540ff1 --- /dev/null +++ b/codenet/public_test_cases/p03993/input.2.txt @@ -0,0 +1,2 @@ +5 +5 5 5 5 1 diff --git a/codenet/public_test_cases/p03993/input.3.txt b/codenet/public_test_cases/p03993/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99499867d9a792adf26ec05dd5ce7536d885d371 --- /dev/null +++ b/codenet/public_test_cases/p03993/input.3.txt @@ -0,0 +1,2 @@ +4 +2 1 4 3 diff --git a/codenet/public_test_cases/p03993/output.0.txt b/codenet/public_test_cases/p03993/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03993/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03993/output.1.txt b/codenet/public_test_cases/p03993/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p03993/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p03993/output.2.txt b/codenet/public_test_cases/p03993/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p03993/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p03993/output.3.txt b/codenet/public_test_cases/p03993/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p03993/output.3.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p03994/input.0.txt b/codenet/public_test_cases/p03994/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..72e93ab54fa184e871a3dacb01b34b618b82d787 --- /dev/null +++ b/codenet/public_test_cases/p03994/input.0.txt @@ -0,0 +1,2 @@ +xyz +4 diff --git a/codenet/public_test_cases/p03994/input.1.txt b/codenet/public_test_cases/p03994/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a33b87caa17d420d46c5c11996e9d54b0c21610 --- /dev/null +++ b/codenet/public_test_cases/p03994/input.1.txt @@ -0,0 +1,2 @@ +codefestival +100 diff --git a/codenet/public_test_cases/p03994/input.2.txt b/codenet/public_test_cases/p03994/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..72e93ab54fa184e871a3dacb01b34b618b82d787 --- /dev/null +++ b/codenet/public_test_cases/p03994/input.2.txt @@ -0,0 +1,2 @@ +xyz +4 diff --git a/codenet/public_test_cases/p03994/input.3.txt b/codenet/public_test_cases/p03994/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fd30424f421e57f7c040da7c1cdf4269c3ae0af --- /dev/null +++ b/codenet/public_test_cases/p03994/input.3.txt @@ -0,0 +1,2 @@ +a +25 diff --git a/codenet/public_test_cases/p03994/output.0.txt b/codenet/public_test_cases/p03994/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c1a5fb0bad7b410ab65723106af89688e84125c --- /dev/null +++ b/codenet/public_test_cases/p03994/output.0.txt @@ -0,0 +1 @@ +aya diff --git a/codenet/public_test_cases/p03994/output.1.txt b/codenet/public_test_cases/p03994/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c74f701fcb1d220976c471b4334481ad83265d67 --- /dev/null +++ b/codenet/public_test_cases/p03994/output.1.txt @@ -0,0 +1 @@ +aaaafeaaivap diff --git a/codenet/public_test_cases/p03994/output.2.txt b/codenet/public_test_cases/p03994/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c1a5fb0bad7b410ab65723106af89688e84125c --- /dev/null +++ b/codenet/public_test_cases/p03994/output.2.txt @@ -0,0 +1 @@ +aya diff --git a/codenet/public_test_cases/p03994/output.3.txt b/codenet/public_test_cases/p03994/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b68025345d5301abad4d9ec9166f455243a0d746 --- /dev/null +++ b/codenet/public_test_cases/p03994/output.3.txt @@ -0,0 +1 @@ +z diff --git a/codenet/public_test_cases/p03995/input.0.txt b/codenet/public_test_cases/p03995/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..63ed20ec41d444be50a2d16ccdea73854e873be5 --- /dev/null +++ b/codenet/public_test_cases/p03995/input.0.txt @@ -0,0 +1,5 @@ +2 2 +3 +1 1 0 +1 2 10 +2 1 20 diff --git a/codenet/public_test_cases/p03995/input.1.txt b/codenet/public_test_cases/p03995/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..24acf3f1751d05c7db318eae708664cb1b2e5c55 --- /dev/null +++ b/codenet/public_test_cases/p03995/input.1.txt @@ -0,0 +1,6 @@ +2 2 +4 +1 1 0 +1 2 10 +2 1 30 +2 2 20 diff --git a/codenet/public_test_cases/p03995/input.2.txt b/codenet/public_test_cases/p03995/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..63ed20ec41d444be50a2d16ccdea73854e873be5 --- /dev/null +++ b/codenet/public_test_cases/p03995/input.2.txt @@ -0,0 +1,5 @@ +2 2 +3 +1 1 0 +1 2 10 +2 1 20 diff --git a/codenet/public_test_cases/p03995/input.3.txt b/codenet/public_test_cases/p03995/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b25826ed5ebf1f960539ffc65737421e6c222b14 --- /dev/null +++ b/codenet/public_test_cases/p03995/input.3.txt @@ -0,0 +1,6 @@ +3 3 +4 +1 1 0 +1 3 10 +3 1 10 +3 3 20 diff --git a/codenet/public_test_cases/p03995/input.4.txt b/codenet/public_test_cases/p03995/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..40ed7f5ba7637bd747b34ff919acec024b160b93 --- /dev/null +++ b/codenet/public_test_cases/p03995/input.4.txt @@ -0,0 +1,5 @@ +2 2 +3 +1 1 20 +1 2 10 +2 1 0 diff --git a/codenet/public_test_cases/p03995/input.5.txt b/codenet/public_test_cases/p03995/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..b74fb9077edf5e239106b975704ebd7e485bd50b --- /dev/null +++ b/codenet/public_test_cases/p03995/input.5.txt @@ -0,0 +1,7 @@ +2 3 +5 +1 1 0 +1 2 10 +1 3 20 +2 1 30 +2 3 40 diff --git a/codenet/public_test_cases/p03995/output.0.txt b/codenet/public_test_cases/p03995/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03995/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03995/output.1.txt b/codenet/public_test_cases/p03995/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03995/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03995/output.2.txt b/codenet/public_test_cases/p03995/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03995/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03995/output.3.txt b/codenet/public_test_cases/p03995/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03995/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03995/output.4.txt b/codenet/public_test_cases/p03995/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03995/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03995/output.5.txt b/codenet/public_test_cases/p03995/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03995/output.5.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03996/input.0.txt b/codenet/public_test_cases/p03996/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e82b3b28f67fb38efdc9362755a750766b69bd55 --- /dev/null +++ b/codenet/public_test_cases/p03996/input.0.txt @@ -0,0 +1,3 @@ +2 2 +3 +2 1 2 diff --git a/codenet/public_test_cases/p03996/input.1.txt b/codenet/public_test_cases/p03996/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcebd1d44bd554737c82d7f1fddecf87e52aa948 --- /dev/null +++ b/codenet/public_test_cases/p03996/input.1.txt @@ -0,0 +1,3 @@ +3 3 +6 +1 2 2 3 3 3 diff --git a/codenet/public_test_cases/p03996/input.2.txt b/codenet/public_test_cases/p03996/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15423c6fb3b2084c996145082b385bb6343c75f --- /dev/null +++ b/codenet/public_test_cases/p03996/input.2.txt @@ -0,0 +1,3 @@ +2 3 +3 +3 2 1 diff --git a/codenet/public_test_cases/p03996/input.3.txt b/codenet/public_test_cases/p03996/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e82b3b28f67fb38efdc9362755a750766b69bd55 --- /dev/null +++ b/codenet/public_test_cases/p03996/input.3.txt @@ -0,0 +1,3 @@ +2 2 +3 +2 1 2 diff --git a/codenet/public_test_cases/p03996/input.4.txt b/codenet/public_test_cases/p03996/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d4935a5e064ae5eca7d24f90a34e2ff5eb37d51 --- /dev/null +++ b/codenet/public_test_cases/p03996/input.4.txt @@ -0,0 +1,3 @@ +3 2 +3 +2 1 2 diff --git a/codenet/public_test_cases/p03996/output.0.txt b/codenet/public_test_cases/p03996/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03996/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03996/output.1.txt b/codenet/public_test_cases/p03996/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03996/output.1.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03996/output.2.txt b/codenet/public_test_cases/p03996/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03996/output.2.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03996/output.3.txt b/codenet/public_test_cases/p03996/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p03996/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p03996/output.4.txt b/codenet/public_test_cases/p03996/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p03996/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p03997/input.0.txt b/codenet/public_test_cases/p03997/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c1c43cca20cc7fd0562fe62383325fb93daccc9 --- /dev/null +++ b/codenet/public_test_cases/p03997/input.0.txt @@ -0,0 +1,3 @@ +3 +4 +2 diff --git a/codenet/public_test_cases/p03997/input.1.txt b/codenet/public_test_cases/p03997/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e435a26e08d0cb483ca192b3003d030f6e501ee --- /dev/null +++ b/codenet/public_test_cases/p03997/input.1.txt @@ -0,0 +1,3 @@ +4 +4 +4 diff --git a/codenet/public_test_cases/p03997/input.2.txt b/codenet/public_test_cases/p03997/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c1c43cca20cc7fd0562fe62383325fb93daccc9 --- /dev/null +++ b/codenet/public_test_cases/p03997/input.2.txt @@ -0,0 +1,3 @@ +3 +4 +2 diff --git a/codenet/public_test_cases/p03997/output.0.txt b/codenet/public_test_cases/p03997/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03997/output.0.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03997/output.1.txt b/codenet/public_test_cases/p03997/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6a7d89c68e0ca66e96a9a51892cc33db66fb8a3 --- /dev/null +++ b/codenet/public_test_cases/p03997/output.1.txt @@ -0,0 +1 @@ +16 diff --git a/codenet/public_test_cases/p03997/output.2.txt b/codenet/public_test_cases/p03997/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p03997/output.2.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p03998/input.0.txt b/codenet/public_test_cases/p03998/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..937fea1cb7867491a8bb912aef69bf9080f1af3d --- /dev/null +++ b/codenet/public_test_cases/p03998/input.0.txt @@ -0,0 +1,3 @@ +aca +accc +ca diff --git a/codenet/public_test_cases/p03998/input.1.txt b/codenet/public_test_cases/p03998/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0e39ada707d4a70c3e626f799b8c7dbcf2e7236 --- /dev/null +++ b/codenet/public_test_cases/p03998/input.1.txt @@ -0,0 +1,3 @@ +abcb +aacb +bccc diff --git a/codenet/public_test_cases/p03998/input.2.txt b/codenet/public_test_cases/p03998/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..937fea1cb7867491a8bb912aef69bf9080f1af3d --- /dev/null +++ b/codenet/public_test_cases/p03998/input.2.txt @@ -0,0 +1,3 @@ +aca +accc +ca diff --git a/codenet/public_test_cases/p03998/output.0.txt b/codenet/public_test_cases/p03998/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70f10e4db19068f79bc43844b49f3eece45c4e8 --- /dev/null +++ b/codenet/public_test_cases/p03998/output.0.txt @@ -0,0 +1 @@ +A diff --git a/codenet/public_test_cases/p03998/output.1.txt b/codenet/public_test_cases/p03998/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cc58df83752123644fef39faab2393af643b1d2 --- /dev/null +++ b/codenet/public_test_cases/p03998/output.1.txt @@ -0,0 +1 @@ +C diff --git a/codenet/public_test_cases/p03998/output.2.txt b/codenet/public_test_cases/p03998/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f70f10e4db19068f79bc43844b49f3eece45c4e8 --- /dev/null +++ b/codenet/public_test_cases/p03998/output.2.txt @@ -0,0 +1 @@ +A diff --git a/codenet/public_test_cases/p03999/input.0.txt b/codenet/public_test_cases/p03999/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d136d6a7142602026090af9a34286fc2a1ea39b9 --- /dev/null +++ b/codenet/public_test_cases/p03999/input.0.txt @@ -0,0 +1 @@ +125 diff --git a/codenet/public_test_cases/p03999/input.1.txt b/codenet/public_test_cases/p03999/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dcd3c3738e76958023a136cf0f4543a212d4357 --- /dev/null +++ b/codenet/public_test_cases/p03999/input.1.txt @@ -0,0 +1 @@ +9999999999 diff --git a/codenet/public_test_cases/p03999/input.2.txt b/codenet/public_test_cases/p03999/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d136d6a7142602026090af9a34286fc2a1ea39b9 --- /dev/null +++ b/codenet/public_test_cases/p03999/input.2.txt @@ -0,0 +1 @@ +125 diff --git a/codenet/public_test_cases/p03999/output.0.txt b/codenet/public_test_cases/p03999/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1057e9a27306e3e5567c601c522f00dc5ed6698e --- /dev/null +++ b/codenet/public_test_cases/p03999/output.0.txt @@ -0,0 +1 @@ +176 diff --git a/codenet/public_test_cases/p03999/output.1.txt b/codenet/public_test_cases/p03999/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..098e657a174185447cd92a3bad2887e45c2e7b4e --- /dev/null +++ b/codenet/public_test_cases/p03999/output.1.txt @@ -0,0 +1 @@ +12656242944 diff --git a/codenet/public_test_cases/p03999/output.2.txt b/codenet/public_test_cases/p03999/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1057e9a27306e3e5567c601c522f00dc5ed6698e --- /dev/null +++ b/codenet/public_test_cases/p03999/output.2.txt @@ -0,0 +1 @@ +176 diff --git a/codenet/public_test_cases/p04000/input.0.txt b/codenet/public_test_cases/p04000/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f49cccb2aa19cc0d6242eee291eec19f978085c6 --- /dev/null +++ b/codenet/public_test_cases/p04000/input.0.txt @@ -0,0 +1,9 @@ +4 5 8 +1 1 +1 4 +1 5 +2 3 +3 1 +3 2 +3 4 +4 4 diff --git a/codenet/public_test_cases/p04000/input.1.txt b/codenet/public_test_cases/p04000/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae0a16359ad72f0908319c98d02cac95a8955b12 --- /dev/null +++ b/codenet/public_test_cases/p04000/input.1.txt @@ -0,0 +1 @@ +1000000000 1000000000 0 diff --git a/codenet/public_test_cases/p04000/input.2.txt b/codenet/public_test_cases/p04000/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f49cccb2aa19cc0d6242eee291eec19f978085c6 --- /dev/null +++ b/codenet/public_test_cases/p04000/input.2.txt @@ -0,0 +1,9 @@ +4 5 8 +1 1 +1 4 +1 5 +2 3 +3 1 +3 2 +3 4 +4 4 diff --git a/codenet/public_test_cases/p04000/input.3.txt b/codenet/public_test_cases/p04000/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..23f094d15e38572c19e964dd1f1e3dd3f7febc71 --- /dev/null +++ b/codenet/public_test_cases/p04000/input.3.txt @@ -0,0 +1,21 @@ +10 10 20 +1 1 +1 4 +1 9 +2 5 +3 10 +4 2 +4 7 +5 9 +6 4 +6 6 +6 7 +7 1 +7 3 +7 7 +8 1 +8 5 +8 10 +9 2 +10 4 +10 9 diff --git a/codenet/public_test_cases/p04000/output.0.txt b/codenet/public_test_cases/p04000/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..df935a33fe0a41da21d21f1863e39bbf5a7bd43a --- /dev/null +++ b/codenet/public_test_cases/p04000/output.0.txt @@ -0,0 +1,10 @@ +0 +0 +0 +2 +4 +0 +0 +0 +0 +0 diff --git a/codenet/public_test_cases/p04000/output.1.txt b/codenet/public_test_cases/p04000/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d40d17cea24e2062e4eb8b391286ae7ca82bd37 --- /dev/null +++ b/codenet/public_test_cases/p04000/output.1.txt @@ -0,0 +1,10 @@ +999999996000000004 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/codenet/public_test_cases/p04000/output.2.txt b/codenet/public_test_cases/p04000/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..df935a33fe0a41da21d21f1863e39bbf5a7bd43a --- /dev/null +++ b/codenet/public_test_cases/p04000/output.2.txt @@ -0,0 +1,10 @@ +0 +0 +0 +2 +4 +0 +0 +0 +0 +0 diff --git a/codenet/public_test_cases/p04000/output.3.txt b/codenet/public_test_cases/p04000/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..11df4b645564ac9a1db38720040eae11b4e27c70 --- /dev/null +++ b/codenet/public_test_cases/p04000/output.3.txt @@ -0,0 +1,10 @@ +4 +26 +22 +10 +2 +0 +0 +0 +0 +0 diff --git a/codenet/public_test_cases/p04001/input.0.txt b/codenet/public_test_cases/p04001/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d136d6a7142602026090af9a34286fc2a1ea39b9 --- /dev/null +++ b/codenet/public_test_cases/p04001/input.0.txt @@ -0,0 +1 @@ +125 diff --git a/codenet/public_test_cases/p04001/output.0.txt b/codenet/public_test_cases/p04001/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1057e9a27306e3e5567c601c522f00dc5ed6698e --- /dev/null +++ b/codenet/public_test_cases/p04001/output.0.txt @@ -0,0 +1 @@ +176 diff --git a/codenet/public_test_cases/p04002/input.0.txt b/codenet/public_test_cases/p04002/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f49cccb2aa19cc0d6242eee291eec19f978085c6 --- /dev/null +++ b/codenet/public_test_cases/p04002/input.0.txt @@ -0,0 +1,9 @@ +4 5 8 +1 1 +1 4 +1 5 +2 3 +3 1 +3 2 +3 4 +4 4 diff --git a/codenet/public_test_cases/p04002/output.0.txt b/codenet/public_test_cases/p04002/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..df935a33fe0a41da21d21f1863e39bbf5a7bd43a --- /dev/null +++ b/codenet/public_test_cases/p04002/output.0.txt @@ -0,0 +1,10 @@ +0 +0 +0 +2 +4 +0 +0 +0 +0 +0 diff --git a/codenet/public_test_cases/p04003/input.0.txt b/codenet/public_test_cases/p04003/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..72184f7fa1135eeb4cd79f7e6d0bd96ceebec908 --- /dev/null +++ b/codenet/public_test_cases/p04003/input.0.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 +2 3 1 +3 1 2 diff --git a/codenet/public_test_cases/p04003/input.1.txt b/codenet/public_test_cases/p04003/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b18aaeb912c1648da2ce8a4bbc23085db214d9d6 --- /dev/null +++ b/codenet/public_test_cases/p04003/input.1.txt @@ -0,0 +1,12 @@ +8 11 +1 3 1 +1 4 2 +2 3 1 +2 5 1 +3 4 3 +3 6 3 +3 7 3 +4 8 4 +5 6 1 +6 7 5 +7 8 5 diff --git a/codenet/public_test_cases/p04003/input.2.txt b/codenet/public_test_cases/p04003/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a74b3c2309d5dee0e16c0639409cbe4bfd6f1f9e --- /dev/null +++ b/codenet/public_test_cases/p04003/input.2.txt @@ -0,0 +1 @@ +2 0 diff --git a/codenet/public_test_cases/p04003/input.3.txt b/codenet/public_test_cases/p04003/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..72184f7fa1135eeb4cd79f7e6d0bd96ceebec908 --- /dev/null +++ b/codenet/public_test_cases/p04003/input.3.txt @@ -0,0 +1,4 @@ +3 3 +1 2 1 +2 3 1 +3 1 2 diff --git a/codenet/public_test_cases/p04003/output.0.txt b/codenet/public_test_cases/p04003/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04003/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04003/output.1.txt b/codenet/public_test_cases/p04003/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04003/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04003/output.2.txt b/codenet/public_test_cases/p04003/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p04003/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p04003/output.3.txt b/codenet/public_test_cases/p04003/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04003/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04004/input.0.txt b/codenet/public_test_cases/p04004/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc3759002bf5280e344eeadc5dbf9ea31b3e0b78 --- /dev/null +++ b/codenet/public_test_cases/p04004/input.0.txt @@ -0,0 +1 @@ +1 1 1 diff --git a/codenet/public_test_cases/p04004/input.1.txt b/codenet/public_test_cases/p04004/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8c77475f1fbaf82c05ba735555b9c5db097c24e --- /dev/null +++ b/codenet/public_test_cases/p04004/input.1.txt @@ -0,0 +1 @@ +4 2 2 diff --git a/codenet/public_test_cases/p04004/input.2.txt b/codenet/public_test_cases/p04004/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cc3759002bf5280e344eeadc5dbf9ea31b3e0b78 --- /dev/null +++ b/codenet/public_test_cases/p04004/input.2.txt @@ -0,0 +1 @@ +1 1 1 diff --git a/codenet/public_test_cases/p04004/input.3.txt b/codenet/public_test_cases/p04004/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a488289edd1f3e7691ce68ead07631af9ca1169a --- /dev/null +++ b/codenet/public_test_cases/p04004/input.3.txt @@ -0,0 +1 @@ +1000 1000 1000 diff --git a/codenet/public_test_cases/p04004/output.0.txt b/codenet/public_test_cases/p04004/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p04004/output.0.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p04004/output.1.txt b/codenet/public_test_cases/p04004/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f720374865e9f1f0b5502715305de5d2bcde0a5 --- /dev/null +++ b/codenet/public_test_cases/p04004/output.1.txt @@ -0,0 +1 @@ +1227 diff --git a/codenet/public_test_cases/p04004/output.2.txt b/codenet/public_test_cases/p04004/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..98d9bcb75a685dfbfd60f611c309410152935b3d --- /dev/null +++ b/codenet/public_test_cases/p04004/output.2.txt @@ -0,0 +1 @@ +17 diff --git a/codenet/public_test_cases/p04004/output.3.txt b/codenet/public_test_cases/p04004/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..75eb331245664120893158458cc44c82dffd7578 --- /dev/null +++ b/codenet/public_test_cases/p04004/output.3.txt @@ -0,0 +1 @@ +261790852 diff --git a/codenet/public_test_cases/p04005/input.0.txt b/codenet/public_test_cases/p04005/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..975b5b4edbcd4186641710d4e3ef291a40475f00 --- /dev/null +++ b/codenet/public_test_cases/p04005/input.0.txt @@ -0,0 +1 @@ +3 3 3 diff --git a/codenet/public_test_cases/p04005/input.1.txt b/codenet/public_test_cases/p04005/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f50aaec4daf65c6d1b8b27ee9252b0ded2352265 --- /dev/null +++ b/codenet/public_test_cases/p04005/input.1.txt @@ -0,0 +1 @@ +2 2 4 diff --git a/codenet/public_test_cases/p04005/input.2.txt b/codenet/public_test_cases/p04005/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..975b5b4edbcd4186641710d4e3ef291a40475f00 --- /dev/null +++ b/codenet/public_test_cases/p04005/input.2.txt @@ -0,0 +1 @@ +3 3 3 diff --git a/codenet/public_test_cases/p04005/input.3.txt b/codenet/public_test_cases/p04005/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..a0e83e7653ec1c4d7ae8824bb2e65344767ff752 --- /dev/null +++ b/codenet/public_test_cases/p04005/input.3.txt @@ -0,0 +1 @@ +5 3 5 diff --git a/codenet/public_test_cases/p04005/output.0.txt b/codenet/public_test_cases/p04005/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p04005/output.0.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p04005/output.1.txt b/codenet/public_test_cases/p04005/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p04005/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p04005/output.2.txt b/codenet/public_test_cases/p04005/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p04005/output.2.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p04005/output.3.txt b/codenet/public_test_cases/p04005/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..60d3b2f4a4cd5f1637eba020358bfe5ecb5edcf2 --- /dev/null +++ b/codenet/public_test_cases/p04005/output.3.txt @@ -0,0 +1 @@ +15 diff --git a/codenet/public_test_cases/p04006/input.0.txt b/codenet/public_test_cases/p04006/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..64f0c555a1aaee02f00dec0108c04d3299d08605 --- /dev/null +++ b/codenet/public_test_cases/p04006/input.0.txt @@ -0,0 +1,2 @@ +2 10 +1 100 diff --git a/codenet/public_test_cases/p04006/input.1.txt b/codenet/public_test_cases/p04006/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7d0453234f0f0414b6ed368f9b00f8928e21a8a --- /dev/null +++ b/codenet/public_test_cases/p04006/input.1.txt @@ -0,0 +1,2 @@ +4 10 +1 2 3 4 diff --git a/codenet/public_test_cases/p04006/input.2.txt b/codenet/public_test_cases/p04006/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..64f0c555a1aaee02f00dec0108c04d3299d08605 --- /dev/null +++ b/codenet/public_test_cases/p04006/input.2.txt @@ -0,0 +1,2 @@ +2 10 +1 100 diff --git a/codenet/public_test_cases/p04006/input.3.txt b/codenet/public_test_cases/p04006/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..13c90b865b0217a8273f0961c424c975f86fdcfa --- /dev/null +++ b/codenet/public_test_cases/p04006/input.3.txt @@ -0,0 +1,2 @@ +3 10 +100 1 100 diff --git a/codenet/public_test_cases/p04006/output.0.txt b/codenet/public_test_cases/p04006/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p04006/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p04006/output.1.txt b/codenet/public_test_cases/p04006/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p04006/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p04006/output.2.txt b/codenet/public_test_cases/p04006/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p04006/output.2.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p04006/output.3.txt b/codenet/public_test_cases/p04006/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..409940768f2a684935a7d15a29f96e82c487f439 --- /dev/null +++ b/codenet/public_test_cases/p04006/output.3.txt @@ -0,0 +1 @@ +23 diff --git a/codenet/public_test_cases/p04007/input.0.txt b/codenet/public_test_cases/p04007/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..54b1b0e07a9eff71ce6007956851fea1bd516a0e --- /dev/null +++ b/codenet/public_test_cases/p04007/input.0.txt @@ -0,0 +1,6 @@ +5 5 +..... +.#.#. +..... +.#.#. +..... diff --git a/codenet/public_test_cases/p04007/input.1.txt b/codenet/public_test_cases/p04007/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..54b1b0e07a9eff71ce6007956851fea1bd516a0e --- /dev/null +++ b/codenet/public_test_cases/p04007/input.1.txt @@ -0,0 +1,6 @@ +5 5 +..... +.#.#. +..... +.#.#. +..... diff --git a/codenet/public_test_cases/p04007/input.2.txt b/codenet/public_test_cases/p04007/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..881b3a57b68290c0b6f47961daf4c783f3e44576 --- /dev/null +++ b/codenet/public_test_cases/p04007/input.2.txt @@ -0,0 +1,8 @@ +7 13 +............. +.###.###.###. +.#.#.#...#... +.###.#...#... +.#.#.#.#.#... +.#.#.###.###. +............. diff --git a/codenet/public_test_cases/p04007/output.0.txt b/codenet/public_test_cases/p04007/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..206702b0e96b1f80bd58b479369c8920c5c8e88b --- /dev/null +++ b/codenet/public_test_cases/p04007/output.0.txt @@ -0,0 +1,11 @@ +..... +##### +#.... +##### +..... + +.###. +.#.#. +.#.#. +.#.#. +..... diff --git a/codenet/public_test_cases/p04007/output.1.txt b/codenet/public_test_cases/p04007/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..206702b0e96b1f80bd58b479369c8920c5c8e88b --- /dev/null +++ b/codenet/public_test_cases/p04007/output.1.txt @@ -0,0 +1,11 @@ +..... +##### +#.... +##### +..... + +.###. +.#.#. +.#.#. +.#.#. +..... diff --git a/codenet/public_test_cases/p04007/output.2.txt b/codenet/public_test_cases/p04007/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..25f4ca3a0f38342909b8c00720bfe041c4a672ee --- /dev/null +++ b/codenet/public_test_cases/p04007/output.2.txt @@ -0,0 +1,15 @@ +............. +.###########. +.###.###.###. +.###.###.###. +.###.###.###. +.###.###.###. +............. + +............. +.###.###.###. +.#.#.#...#... +.###.#...#... +.#.#.#.#.#... +.#.#########. +............. diff --git a/codenet/public_test_cases/p04008/input.0.txt b/codenet/public_test_cases/p04008/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e6812bf868798310dee75319a82a2bde324d88b --- /dev/null +++ b/codenet/public_test_cases/p04008/input.0.txt @@ -0,0 +1,2 @@ +3 1 +2 3 1 diff --git a/codenet/public_test_cases/p04008/input.1.txt b/codenet/public_test_cases/p04008/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ec710cb56a443c9756ec26f2f56b22bd55143eb --- /dev/null +++ b/codenet/public_test_cases/p04008/input.1.txt @@ -0,0 +1,2 @@ +8 2 +4 1 2 3 1 2 3 4 diff --git a/codenet/public_test_cases/p04008/input.2.txt b/codenet/public_test_cases/p04008/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e6812bf868798310dee75319a82a2bde324d88b --- /dev/null +++ b/codenet/public_test_cases/p04008/input.2.txt @@ -0,0 +1,2 @@ +3 1 +2 3 1 diff --git a/codenet/public_test_cases/p04008/input.3.txt b/codenet/public_test_cases/p04008/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..29623797065c5c1a6f759560e61c44a4d2bf1b0f --- /dev/null +++ b/codenet/public_test_cases/p04008/input.3.txt @@ -0,0 +1,2 @@ +4 2 +1 1 2 2 diff --git a/codenet/public_test_cases/p04008/output.0.txt b/codenet/public_test_cases/p04008/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04008/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04008/output.1.txt b/codenet/public_test_cases/p04008/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p04008/output.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p04008/output.2.txt b/codenet/public_test_cases/p04008/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04008/output.2.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04008/output.3.txt b/codenet/public_test_cases/p04008/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p04008/output.3.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p04009/input.0.txt b/codenet/public_test_cases/p04009/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec1a659152021a8288ba4b0c893d7d82087178dc --- /dev/null +++ b/codenet/public_test_cases/p04009/input.0.txt @@ -0,0 +1,4 @@ +3 3 +o.o +.Eo +ooo diff --git a/codenet/public_test_cases/p04009/input.1.txt b/codenet/public_test_cases/p04009/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e97f801705e4c563d3bfe1e028d977031b95454 --- /dev/null +++ b/codenet/public_test_cases/p04009/input.1.txt @@ -0,0 +1,6 @@ +5 11 +ooo.ooo.ooo +o.o.o...o.. +ooo.oE..o.. +o.o.o.o.o.. +o.o.ooo.ooo diff --git a/codenet/public_test_cases/p04009/input.2.txt b/codenet/public_test_cases/p04009/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d31e6e2df6033c16cb6ab143df7d0228848d84b --- /dev/null +++ b/codenet/public_test_cases/p04009/input.2.txt @@ -0,0 +1,4 @@ +3 4 +o... +o... +oooE diff --git a/codenet/public_test_cases/p04009/input.3.txt b/codenet/public_test_cases/p04009/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec1a659152021a8288ba4b0c893d7d82087178dc --- /dev/null +++ b/codenet/public_test_cases/p04009/input.3.txt @@ -0,0 +1,4 @@ +3 3 +o.o +.Eo +ooo diff --git a/codenet/public_test_cases/p04009/input.4.txt b/codenet/public_test_cases/p04009/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8052f02855db86b747e240b84f103bc2edd2ffa --- /dev/null +++ b/codenet/public_test_cases/p04009/input.4.txt @@ -0,0 +1,3 @@ +2 2 +E. +.. diff --git a/codenet/public_test_cases/p04009/output.0.txt b/codenet/public_test_cases/p04009/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p04009/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p04009/output.1.txt b/codenet/public_test_cases/p04009/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p04009/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p04009/output.2.txt b/codenet/public_test_cases/p04009/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p04009/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p04009/output.3.txt b/codenet/public_test_cases/p04009/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p04009/output.3.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p04009/output.4.txt b/codenet/public_test_cases/p04009/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p04009/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p04010/input.0.txt b/codenet/public_test_cases/p04010/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e73d00f559597bda1fc62f2ddd226ee993bd129 --- /dev/null +++ b/codenet/public_test_cases/p04010/input.0.txt @@ -0,0 +1,6 @@ +6 5 +1 2 +1 3 +1 4 +2 5 +2 6 diff --git a/codenet/public_test_cases/p04010/input.1.txt b/codenet/public_test_cases/p04010/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e73d00f559597bda1fc62f2ddd226ee993bd129 --- /dev/null +++ b/codenet/public_test_cases/p04010/input.1.txt @@ -0,0 +1,6 @@ +6 5 +1 2 +1 3 +1 4 +2 5 +2 6 diff --git a/codenet/public_test_cases/p04010/input.2.txt b/codenet/public_test_cases/p04010/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p04010/input.2.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p04010/input.3.txt b/codenet/public_test_cases/p04010/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..91baa4f218707905b03e897b6b0f14e7ded2ebe0 --- /dev/null +++ b/codenet/public_test_cases/p04010/input.3.txt @@ -0,0 +1,7 @@ +6 6 +1 2 +2 3 +3 1 +1 4 +1 5 +1 6 diff --git a/codenet/public_test_cases/p04010/input.4.txt b/codenet/public_test_cases/p04010/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..3e5b02d4ce0ae2d57ab906325e55bf8f13d9caca --- /dev/null +++ b/codenet/public_test_cases/p04010/input.4.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 3 +3 4 +4 1 diff --git a/codenet/public_test_cases/p04010/output.0.txt b/codenet/public_test_cases/p04010/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p04010/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p04010/output.1.txt b/codenet/public_test_cases/p04010/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p04010/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p04010/output.2.txt b/codenet/public_test_cases/p04010/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p04010/output.2.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p04010/output.3.txt b/codenet/public_test_cases/p04010/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 --- /dev/null +++ b/codenet/public_test_cases/p04010/output.3.txt @@ -0,0 +1 @@ +7 diff --git a/codenet/public_test_cases/p04010/output.4.txt b/codenet/public_test_cases/p04010/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04010/output.4.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04011/input.0.txt b/codenet/public_test_cases/p04011/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..687edf99c939b63a302a8f7ef841e3fcfb3d2cfc --- /dev/null +++ b/codenet/public_test_cases/p04011/input.0.txt @@ -0,0 +1,4 @@ +5 +3 +10000 +9000 diff --git a/codenet/public_test_cases/p04011/input.1.txt b/codenet/public_test_cases/p04011/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e049366d0a70062fe0e52e4af88f60f5d988da09 --- /dev/null +++ b/codenet/public_test_cases/p04011/input.1.txt @@ -0,0 +1,4 @@ +2 +3 +10000 +9000 diff --git a/codenet/public_test_cases/p04011/input.2.txt b/codenet/public_test_cases/p04011/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..687edf99c939b63a302a8f7ef841e3fcfb3d2cfc --- /dev/null +++ b/codenet/public_test_cases/p04011/input.2.txt @@ -0,0 +1,4 @@ +5 +3 +10000 +9000 diff --git a/codenet/public_test_cases/p04011/output.0.txt b/codenet/public_test_cases/p04011/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..22f0d241a8d1a28a84d5bfadc75068ed9c0b4804 --- /dev/null +++ b/codenet/public_test_cases/p04011/output.0.txt @@ -0,0 +1 @@ +48000 diff --git a/codenet/public_test_cases/p04011/output.1.txt b/codenet/public_test_cases/p04011/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..b92677edb9566c26b6e52b6422544bb952cb7ca6 --- /dev/null +++ b/codenet/public_test_cases/p04011/output.1.txt @@ -0,0 +1 @@ +20000 diff --git a/codenet/public_test_cases/p04011/output.2.txt b/codenet/public_test_cases/p04011/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..22f0d241a8d1a28a84d5bfadc75068ed9c0b4804 --- /dev/null +++ b/codenet/public_test_cases/p04011/output.2.txt @@ -0,0 +1 @@ +48000 diff --git a/codenet/public_test_cases/p04012/input.0.txt b/codenet/public_test_cases/p04012/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..468a2c27d8c588f0559a30f23be3b3c3115f986d --- /dev/null +++ b/codenet/public_test_cases/p04012/input.0.txt @@ -0,0 +1 @@ +abaccaba diff --git a/codenet/public_test_cases/p04012/input.1.txt b/codenet/public_test_cases/p04012/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..468a2c27d8c588f0559a30f23be3b3c3115f986d --- /dev/null +++ b/codenet/public_test_cases/p04012/input.1.txt @@ -0,0 +1 @@ +abaccaba diff --git a/codenet/public_test_cases/p04012/input.2.txt b/codenet/public_test_cases/p04012/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1e670a1a2ede8a4aa60ce7fdaea44e78d983993 --- /dev/null +++ b/codenet/public_test_cases/p04012/input.2.txt @@ -0,0 +1 @@ +hthth diff --git a/codenet/public_test_cases/p04012/output.0.txt b/codenet/public_test_cases/p04012/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p04012/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p04012/output.1.txt b/codenet/public_test_cases/p04012/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p04012/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p04012/output.2.txt b/codenet/public_test_cases/p04012/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p04012/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p04013/input.0.txt b/codenet/public_test_cases/p04013/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f3cfa17f27c74f1294805118980909652ba3b82 --- /dev/null +++ b/codenet/public_test_cases/p04013/input.0.txt @@ -0,0 +1,2 @@ +4 8 +7 9 8 9 diff --git a/codenet/public_test_cases/p04013/output.0.txt b/codenet/public_test_cases/p04013/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p04013/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p04014/input.0.txt b/codenet/public_test_cases/p04014/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e9da6ee59862fbdd2171eba54e60850ea76727a --- /dev/null +++ b/codenet/public_test_cases/p04014/input.0.txt @@ -0,0 +1,2 @@ +87654 +30 diff --git a/codenet/public_test_cases/p04014/input.1.txt b/codenet/public_test_cases/p04014/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e9da6ee59862fbdd2171eba54e60850ea76727a --- /dev/null +++ b/codenet/public_test_cases/p04014/input.1.txt @@ -0,0 +1,2 @@ +87654 +30 diff --git a/codenet/public_test_cases/p04014/input.2.txt b/codenet/public_test_cases/p04014/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b83aeacceff137edd426cd8db3ca99a52854596f --- /dev/null +++ b/codenet/public_test_cases/p04014/input.2.txt @@ -0,0 +1,2 @@ +87654 +138 diff --git a/codenet/public_test_cases/p04014/input.3.txt b/codenet/public_test_cases/p04014/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..100176d4d92521ebb1a6f98055663db9b2a6ff54 --- /dev/null +++ b/codenet/public_test_cases/p04014/input.3.txt @@ -0,0 +1,2 @@ +87654 +45678 diff --git a/codenet/public_test_cases/p04014/input.4.txt b/codenet/public_test_cases/p04014/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..0bc95f91822a935ae863ed6bd23bd3590a6374c5 --- /dev/null +++ b/codenet/public_test_cases/p04014/input.4.txt @@ -0,0 +1,2 @@ +31415926535 +1 diff --git a/codenet/public_test_cases/p04014/input.5.txt b/codenet/public_test_cases/p04014/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f4734d6e32331e263388eabb26d8706c38348c7 --- /dev/null +++ b/codenet/public_test_cases/p04014/input.5.txt @@ -0,0 +1,2 @@ +1 +31415926535 diff --git a/codenet/public_test_cases/p04014/output.0.txt b/codenet/public_test_cases/p04014/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p04014/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p04014/output.1.txt b/codenet/public_test_cases/p04014/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p04014/output.1.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p04014/output.2.txt b/codenet/public_test_cases/p04014/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d6383b52c1352e92a45875b5bb206f89139643 --- /dev/null +++ b/codenet/public_test_cases/p04014/output.2.txt @@ -0,0 +1 @@ +100 diff --git a/codenet/public_test_cases/p04014/output.3.txt b/codenet/public_test_cases/p04014/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p04014/output.3.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p04014/output.4.txt b/codenet/public_test_cases/p04014/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3625e8a987a3de210d452e75b0fea107b416c1f --- /dev/null +++ b/codenet/public_test_cases/p04014/output.4.txt @@ -0,0 +1 @@ +31415926535 diff --git a/codenet/public_test_cases/p04014/output.5.txt b/codenet/public_test_cases/p04014/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a2e3f4984a0ee55900f8c7894844c563d2c2744 --- /dev/null +++ b/codenet/public_test_cases/p04014/output.5.txt @@ -0,0 +1 @@ +-1 diff --git a/codenet/public_test_cases/p04015/input.0.txt b/codenet/public_test_cases/p04015/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f3cfa17f27c74f1294805118980909652ba3b82 --- /dev/null +++ b/codenet/public_test_cases/p04015/input.0.txt @@ -0,0 +1,2 @@ +4 8 +7 9 8 9 diff --git a/codenet/public_test_cases/p04015/input.1.txt b/codenet/public_test_cases/p04015/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..5f3cfa17f27c74f1294805118980909652ba3b82 --- /dev/null +++ b/codenet/public_test_cases/p04015/input.1.txt @@ -0,0 +1,2 @@ +4 8 +7 9 8 9 diff --git a/codenet/public_test_cases/p04015/input.2.txt b/codenet/public_test_cases/p04015/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd09baad62d8c9303010a9464aa8e21372b5239e --- /dev/null +++ b/codenet/public_test_cases/p04015/input.2.txt @@ -0,0 +1,2 @@ +3 8 +6 6 9 diff --git a/codenet/public_test_cases/p04015/input.3.txt b/codenet/public_test_cases/p04015/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..f523a6a18a00e8753ef2b7fe696fb3930bf8265d --- /dev/null +++ b/codenet/public_test_cases/p04015/input.3.txt @@ -0,0 +1,2 @@ +33 3 +3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 diff --git a/codenet/public_test_cases/p04015/input.4.txt b/codenet/public_test_cases/p04015/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdfb07c2915c23b8c4f63f9484c4d42cc6edbf94 --- /dev/null +++ b/codenet/public_test_cases/p04015/input.4.txt @@ -0,0 +1,2 @@ +8 5 +3 6 2 8 7 6 5 9 diff --git a/codenet/public_test_cases/p04015/output.0.txt b/codenet/public_test_cases/p04015/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p04015/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p04015/output.1.txt b/codenet/public_test_cases/p04015/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p04015/output.1.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p04015/output.2.txt b/codenet/public_test_cases/p04015/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p04015/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p04015/output.3.txt b/codenet/public_test_cases/p04015/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b54bf8fa9933481addaa9b73db3f431144e4445 --- /dev/null +++ b/codenet/public_test_cases/p04015/output.3.txt @@ -0,0 +1 @@ +8589934591 diff --git a/codenet/public_test_cases/p04015/output.4.txt b/codenet/public_test_cases/p04015/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6b24041cf04154f8f902651969675021f4d93a5 --- /dev/null +++ b/codenet/public_test_cases/p04015/output.4.txt @@ -0,0 +1 @@ +19 diff --git a/codenet/public_test_cases/p04016/input.0.txt b/codenet/public_test_cases/p04016/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e9da6ee59862fbdd2171eba54e60850ea76727a --- /dev/null +++ b/codenet/public_test_cases/p04016/input.0.txt @@ -0,0 +1,2 @@ +87654 +30 diff --git a/codenet/public_test_cases/p04016/output.0.txt b/codenet/public_test_cases/p04016/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p04016/output.0.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p04017/input.0.txt b/codenet/public_test_cases/p04017/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1af6e133edc91fd46eddc38b81df57afe1c227ad --- /dev/null +++ b/codenet/public_test_cases/p04017/input.0.txt @@ -0,0 +1,8 @@ +9 +1 3 6 13 15 18 19 29 31 +10 +4 +1 8 +7 3 +6 7 +8 5 diff --git a/codenet/public_test_cases/p04017/input.1.txt b/codenet/public_test_cases/p04017/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1af6e133edc91fd46eddc38b81df57afe1c227ad --- /dev/null +++ b/codenet/public_test_cases/p04017/input.1.txt @@ -0,0 +1,8 @@ +9 +1 3 6 13 15 18 19 29 31 +10 +4 +1 8 +7 3 +6 7 +8 5 diff --git a/codenet/public_test_cases/p04017/output.0.txt b/codenet/public_test_cases/p04017/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf0d8bb1a7f0567e2a2a8c40bc3d3b9bc172991b --- /dev/null +++ b/codenet/public_test_cases/p04017/output.0.txt @@ -0,0 +1,4 @@ +4 +2 +1 +2 diff --git a/codenet/public_test_cases/p04017/output.1.txt b/codenet/public_test_cases/p04017/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf0d8bb1a7f0567e2a2a8c40bc3d3b9bc172991b --- /dev/null +++ b/codenet/public_test_cases/p04017/output.1.txt @@ -0,0 +1,4 @@ +4 +2 +1 +2 diff --git a/codenet/public_test_cases/p04018/input.0.txt b/codenet/public_test_cases/p04018/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f27bcf7c99320f97e935dac870033e697bc5b11 --- /dev/null +++ b/codenet/public_test_cases/p04018/input.0.txt @@ -0,0 +1 @@ +aab diff --git a/codenet/public_test_cases/p04018/input.1.txt b/codenet/public_test_cases/p04018/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d60b70ed8125fdfde9934ac0942548a25477971 --- /dev/null +++ b/codenet/public_test_cases/p04018/input.1.txt @@ -0,0 +1 @@ +ddd diff --git a/codenet/public_test_cases/p04018/input.2.txt b/codenet/public_test_cases/p04018/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f27bcf7c99320f97e935dac870033e697bc5b11 --- /dev/null +++ b/codenet/public_test_cases/p04018/input.2.txt @@ -0,0 +1 @@ +aab diff --git a/codenet/public_test_cases/p04018/input.3.txt b/codenet/public_test_cases/p04018/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..e8f43074aafb944c79574e40554c353d2c0ba573 --- /dev/null +++ b/codenet/public_test_cases/p04018/input.3.txt @@ -0,0 +1 @@ +bcbc diff --git a/codenet/public_test_cases/p04018/output.0.txt b/codenet/public_test_cases/p04018/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p04018/output.0.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p04018/output.1.txt b/codenet/public_test_cases/p04018/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f00580c4060794725a4817ab7935de04726c8933 --- /dev/null +++ b/codenet/public_test_cases/p04018/output.1.txt @@ -0,0 +1,2 @@ +3 +1 diff --git a/codenet/public_test_cases/p04018/output.2.txt b/codenet/public_test_cases/p04018/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ed281c757a969ffe22f3dcfa5830c532479c726 --- /dev/null +++ b/codenet/public_test_cases/p04018/output.2.txt @@ -0,0 +1,2 @@ +1 +1 diff --git a/codenet/public_test_cases/p04018/output.3.txt b/codenet/public_test_cases/p04018/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..4792e70f333077a81456ca2bc74e492ab8bb58c3 --- /dev/null +++ b/codenet/public_test_cases/p04018/output.3.txt @@ -0,0 +1,2 @@ +2 +3 diff --git a/codenet/public_test_cases/p04019/input.0.txt b/codenet/public_test_cases/p04019/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe588e53fdd8bb0a18425eb09ba441230a3a2e75 --- /dev/null +++ b/codenet/public_test_cases/p04019/input.0.txt @@ -0,0 +1 @@ +SENW diff --git a/codenet/public_test_cases/p04019/input.1.txt b/codenet/public_test_cases/p04019/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..54e96bba4a7484754018275d590c002602d3f692 --- /dev/null +++ b/codenet/public_test_cases/p04019/input.1.txt @@ -0,0 +1 @@ +NSNNSNSN diff --git a/codenet/public_test_cases/p04019/input.2.txt b/codenet/public_test_cases/p04019/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..669beb837f1b7e7ba6a7718d66b09587fb367752 --- /dev/null +++ b/codenet/public_test_cases/p04019/input.2.txt @@ -0,0 +1 @@ +NNEW diff --git a/codenet/public_test_cases/p04019/input.3.txt b/codenet/public_test_cases/p04019/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe588e53fdd8bb0a18425eb09ba441230a3a2e75 --- /dev/null +++ b/codenet/public_test_cases/p04019/input.3.txt @@ -0,0 +1 @@ +SENW diff --git a/codenet/public_test_cases/p04019/input.4.txt b/codenet/public_test_cases/p04019/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..a42d8ff61914884d31a8f36bbc78085aae1e0b01 --- /dev/null +++ b/codenet/public_test_cases/p04019/input.4.txt @@ -0,0 +1 @@ +W diff --git a/codenet/public_test_cases/p04019/output.0.txt b/codenet/public_test_cases/p04019/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p04019/output.0.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p04019/output.1.txt b/codenet/public_test_cases/p04019/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p04019/output.1.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p04019/output.2.txt b/codenet/public_test_cases/p04019/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p04019/output.2.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p04019/output.3.txt b/codenet/public_test_cases/p04019/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcd7a5d6d55bef30b5619e90266d7af48a1c239f --- /dev/null +++ b/codenet/public_test_cases/p04019/output.3.txt @@ -0,0 +1 @@ +Yes diff --git a/codenet/public_test_cases/p04019/output.4.txt b/codenet/public_test_cases/p04019/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..cf456979c3c1f62274f0a5b15ac4877ea042a50d --- /dev/null +++ b/codenet/public_test_cases/p04019/output.4.txt @@ -0,0 +1 @@ +No diff --git a/codenet/public_test_cases/p04020/input.0.txt b/codenet/public_test_cases/p04020/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..afec7516ac83f65b3e6866839804aacb80ebdbaf --- /dev/null +++ b/codenet/public_test_cases/p04020/input.0.txt @@ -0,0 +1,5 @@ +4 +4 +0 +3 +2 diff --git a/codenet/public_test_cases/p04020/input.1.txt b/codenet/public_test_cases/p04020/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..80305993aeae557f94aac753b38febe326f32d8b --- /dev/null +++ b/codenet/public_test_cases/p04020/input.1.txt @@ -0,0 +1,9 @@ +8 +2 +0 +1 +6 +0 +8 +2 +1 diff --git a/codenet/public_test_cases/p04020/input.2.txt b/codenet/public_test_cases/p04020/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..afec7516ac83f65b3e6866839804aacb80ebdbaf --- /dev/null +++ b/codenet/public_test_cases/p04020/input.2.txt @@ -0,0 +1,5 @@ +4 +4 +0 +3 +2 diff --git a/codenet/public_test_cases/p04020/output.0.txt b/codenet/public_test_cases/p04020/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p04020/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p04020/output.1.txt b/codenet/public_test_cases/p04020/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p04020/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p04020/output.2.txt b/codenet/public_test_cases/p04020/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p04020/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p04021/input.0.txt b/codenet/public_test_cases/p04021/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f837a7a32e7916d73026032b3127f153f8367e43 --- /dev/null +++ b/codenet/public_test_cases/p04021/input.0.txt @@ -0,0 +1,5 @@ +4 +2 +4 +3 +1 diff --git a/codenet/public_test_cases/p04021/input.1.txt b/codenet/public_test_cases/p04021/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..2892b038bce03ad324d2206a5367622e93e6ab78 --- /dev/null +++ b/codenet/public_test_cases/p04021/input.1.txt @@ -0,0 +1,6 @@ +5 +10 +8 +5 +3 +2 diff --git a/codenet/public_test_cases/p04021/input.2.txt b/codenet/public_test_cases/p04021/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f837a7a32e7916d73026032b3127f153f8367e43 --- /dev/null +++ b/codenet/public_test_cases/p04021/input.2.txt @@ -0,0 +1,5 @@ +4 +2 +4 +3 +1 diff --git a/codenet/public_test_cases/p04021/output.0.txt b/codenet/public_test_cases/p04021/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04021/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04021/output.1.txt b/codenet/public_test_cases/p04021/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p04021/output.1.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p04021/output.2.txt b/codenet/public_test_cases/p04021/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04021/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04022/input.0.txt b/codenet/public_test_cases/p04022/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef0f40ae9c361a57d966ee880c7542eb092f40c --- /dev/null +++ b/codenet/public_test_cases/p04022/input.0.txt @@ -0,0 +1,9 @@ +8 +1 +2 +3 +4 +5 +6 +7 +8 diff --git a/codenet/public_test_cases/p04022/input.1.txt b/codenet/public_test_cases/p04022/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef7aabf9a34c3ade1fd774c2873ab0a5a09751e5 --- /dev/null +++ b/codenet/public_test_cases/p04022/input.1.txt @@ -0,0 +1,11 @@ +10 +1 +10 +100 +1000000007 +10000000000 +1000000009 +999999999 +999 +999 +999 diff --git a/codenet/public_test_cases/p04022/input.2.txt b/codenet/public_test_cases/p04022/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f063290d5e9ff0553c17aa92548b55703697b16 --- /dev/null +++ b/codenet/public_test_cases/p04022/input.2.txt @@ -0,0 +1,7 @@ +6 +2 +4 +8 +16 +32 +64 diff --git a/codenet/public_test_cases/p04022/input.3.txt b/codenet/public_test_cases/p04022/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ef0f40ae9c361a57d966ee880c7542eb092f40c --- /dev/null +++ b/codenet/public_test_cases/p04022/input.3.txt @@ -0,0 +1,9 @@ +8 +1 +2 +3 +4 +5 +6 +7 +8 diff --git a/codenet/public_test_cases/p04022/output.0.txt b/codenet/public_test_cases/p04022/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p04022/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p04022/output.1.txt b/codenet/public_test_cases/p04022/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/codenet/public_test_cases/p04022/output.1.txt @@ -0,0 +1 @@ +9 diff --git a/codenet/public_test_cases/p04022/output.2.txt b/codenet/public_test_cases/p04022/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p04022/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p04022/output.3.txt b/codenet/public_test_cases/p04022/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p04022/output.3.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p04023/input.0.txt b/codenet/public_test_cases/p04023/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3f33bc93e9af160c4214fb82e41aa7b599c2e84 --- /dev/null +++ b/codenet/public_test_cases/p04023/input.0.txt @@ -0,0 +1,4 @@ +5 3 +6 +4 +11 diff --git a/codenet/public_test_cases/p04023/input.1.txt b/codenet/public_test_cases/p04023/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..49dcde8ce30016dbf6bfb6003ccc4ae2a27182be --- /dev/null +++ b/codenet/public_test_cases/p04023/input.1.txt @@ -0,0 +1,11 @@ +10 10 +9 +13 +18 +8 +10 +10 +9 +19 +22 +27 diff --git a/codenet/public_test_cases/p04023/input.2.txt b/codenet/public_test_cases/p04023/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3f33bc93e9af160c4214fb82e41aa7b599c2e84 --- /dev/null +++ b/codenet/public_test_cases/p04023/input.2.txt @@ -0,0 +1,4 @@ +5 3 +6 +4 +11 diff --git a/codenet/public_test_cases/p04023/output.0.txt b/codenet/public_test_cases/p04023/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e583be14d0c0fb252d9f673582a462bd5625b9c --- /dev/null +++ b/codenet/public_test_cases/p04023/output.0.txt @@ -0,0 +1,5 @@ +3 +3 +3 +2 +0 diff --git a/codenet/public_test_cases/p04023/output.1.txt b/codenet/public_test_cases/p04023/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3887b792ffa2c50a9c2cf645496e47b12cf45d5 --- /dev/null +++ b/codenet/public_test_cases/p04023/output.1.txt @@ -0,0 +1,10 @@ +7 +4 +4 +3 +3 +2 +2 +2 +0 +0 diff --git a/codenet/public_test_cases/p04023/output.2.txt b/codenet/public_test_cases/p04023/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e583be14d0c0fb252d9f673582a462bd5625b9c --- /dev/null +++ b/codenet/public_test_cases/p04023/output.2.txt @@ -0,0 +1,5 @@ +3 +3 +3 +2 +0 diff --git a/codenet/public_test_cases/p04024/input.0.txt b/codenet/public_test_cases/p04024/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b98121f2eba0e47afa0e904db9b54d1f04fe32ce --- /dev/null +++ b/codenet/public_test_cases/p04024/input.0.txt @@ -0,0 +1,4 @@ +3 3 3 +.#. +### +#.# diff --git a/codenet/public_test_cases/p04024/input.1.txt b/codenet/public_test_cases/p04024/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..67d330ab12fc2d4092e9b02e83b28310d155cfbc --- /dev/null +++ b/codenet/public_test_cases/p04024/input.1.txt @@ -0,0 +1,12 @@ +11 15 1000000000000000000 +.....#......... +....###........ +....####....... +...######...... +...#######..... +..##.###.##.... +..##########... +.###.....####.. +.####...######. + +.##..##..##..# diff --git a/codenet/public_test_cases/p04024/input.2.txt b/codenet/public_test_cases/p04024/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b98121f2eba0e47afa0e904db9b54d1f04fe32ce --- /dev/null +++ b/codenet/public_test_cases/p04024/input.2.txt @@ -0,0 +1,4 @@ +3 3 3 +.#. +### +#.# diff --git a/codenet/public_test_cases/p04024/input.3.txt b/codenet/public_test_cases/p04024/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..35cd57bb6fb707de72fa213107139b7f1a1f0c19 --- /dev/null +++ b/codenet/public_test_cases/p04024/input.3.txt @@ -0,0 +1,3 @@ +3 3 3 + +.# diff --git a/codenet/public_test_cases/p04024/input.4.txt b/codenet/public_test_cases/p04024/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d9c9ede1aa3824feb8c7213283cdd8519989221d --- /dev/null +++ b/codenet/public_test_cases/p04024/input.4.txt @@ -0,0 +1,4 @@ +3 3 3 +.#. + +.# diff --git a/codenet/public_test_cases/p04024/output.0.txt b/codenet/public_test_cases/p04024/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p04024/output.0.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p04024/output.1.txt b/codenet/public_test_cases/p04024/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaed1f07b27cf729738aad9a32390675be2529dd --- /dev/null +++ b/codenet/public_test_cases/p04024/output.1.txt @@ -0,0 +1 @@ +301811921 diff --git a/codenet/public_test_cases/p04024/output.2.txt b/codenet/public_test_cases/p04024/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p04024/output.2.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p04024/output.3.txt b/codenet/public_test_cases/p04024/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04024/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04024/output.4.txt b/codenet/public_test_cases/p04024/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..209e3ef4b6247ce746048d5711befda46206d235 --- /dev/null +++ b/codenet/public_test_cases/p04024/output.4.txt @@ -0,0 +1 @@ +20 diff --git a/codenet/public_test_cases/p04025/input.0.txt b/codenet/public_test_cases/p04025/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..77e678c0379756c0b7fbde31e174409bd21213c6 --- /dev/null +++ b/codenet/public_test_cases/p04025/input.0.txt @@ -0,0 +1,2 @@ +2 +4 8 diff --git a/codenet/public_test_cases/p04025/output.0.txt b/codenet/public_test_cases/p04025/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p04025/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p04026/input.0.txt b/codenet/public_test_cases/p04026/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b0cb99a6d1f06f2bb6c701a1f851beacd28ab15 --- /dev/null +++ b/codenet/public_test_cases/p04026/input.0.txt @@ -0,0 +1 @@ +needed diff --git a/codenet/public_test_cases/p04026/input.1.txt b/codenet/public_test_cases/p04026/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b0cb99a6d1f06f2bb6c701a1f851beacd28ab15 --- /dev/null +++ b/codenet/public_test_cases/p04026/input.1.txt @@ -0,0 +1 @@ +needed diff --git a/codenet/public_test_cases/p04026/input.2.txt b/codenet/public_test_cases/p04026/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..74ef13d11d0bc8c8cde49253ea4a0cdbea2c9416 --- /dev/null +++ b/codenet/public_test_cases/p04026/input.2.txt @@ -0,0 +1 @@ +atcoder diff --git a/codenet/public_test_cases/p04026/output.0.txt b/codenet/public_test_cases/p04026/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p04026/output.0.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p04026/output.1.txt b/codenet/public_test_cases/p04026/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p04026/output.1.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p04026/output.2.txt b/codenet/public_test_cases/p04026/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b56b57b93626dfaee10f0d765259a141fe23f15 --- /dev/null +++ b/codenet/public_test_cases/p04026/output.2.txt @@ -0,0 +1 @@ +-1 -1 diff --git a/codenet/public_test_cases/p04027/input.0.txt b/codenet/public_test_cases/p04027/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe176db18cf1811b742ae5a0f5b7cf450b01f51e --- /dev/null +++ b/codenet/public_test_cases/p04027/input.0.txt @@ -0,0 +1,3 @@ +2 3 +1 1 +1 1 diff --git a/codenet/public_test_cases/p04027/input.1.txt b/codenet/public_test_cases/p04027/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f3066d8b7c549663b27f8137fcfe60067b537908 --- /dev/null +++ b/codenet/public_test_cases/p04027/input.1.txt @@ -0,0 +1,3 @@ +3 100 +7 6 5 +9 9 9 diff --git a/codenet/public_test_cases/p04027/input.2.txt b/codenet/public_test_cases/p04027/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..92d43dbe0a860e830c51d5cd8c58605b19f8808c --- /dev/null +++ b/codenet/public_test_cases/p04027/input.2.txt @@ -0,0 +1,3 @@ +1 2 +1 +3 diff --git a/codenet/public_test_cases/p04027/input.3.txt b/codenet/public_test_cases/p04027/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe176db18cf1811b742ae5a0f5b7cf450b01f51e --- /dev/null +++ b/codenet/public_test_cases/p04027/input.3.txt @@ -0,0 +1,3 @@ +2 3 +1 1 +1 1 diff --git a/codenet/public_test_cases/p04027/input.4.txt b/codenet/public_test_cases/p04027/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..71dee2133ccd05d353ce14c3ded57fd96c61f0de --- /dev/null +++ b/codenet/public_test_cases/p04027/input.4.txt @@ -0,0 +1,3 @@ +2 3 +1 1 +2 2 diff --git a/codenet/public_test_cases/p04027/input.5.txt b/codenet/public_test_cases/p04027/input.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d8a361e7bd56ca39a33d810aa10e7647cc46167 --- /dev/null +++ b/codenet/public_test_cases/p04027/input.5.txt @@ -0,0 +1,3 @@ +4 8 +3 1 4 1 +3 1 4 1 diff --git a/codenet/public_test_cases/p04027/output.0.txt b/codenet/public_test_cases/p04027/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p04027/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p04027/output.1.txt b/codenet/public_test_cases/p04027/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..345c8392e37e8bf87dc55d017a4a0c68b451a36b --- /dev/null +++ b/codenet/public_test_cases/p04027/output.1.txt @@ -0,0 +1 @@ +139123417 diff --git a/codenet/public_test_cases/p04027/output.2.txt b/codenet/public_test_cases/p04027/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p04027/output.2.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p04027/output.3.txt b/codenet/public_test_cases/p04027/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p04027/output.3.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p04027/output.4.txt b/codenet/public_test_cases/p04027/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..69a893aa31141827125ddaaee26966b7aed3de74 --- /dev/null +++ b/codenet/public_test_cases/p04027/output.4.txt @@ -0,0 +1 @@ +66 diff --git a/codenet/public_test_cases/p04027/output.5.txt b/codenet/public_test_cases/p04027/output.5.txt new file mode 100644 index 0000000000000000000000000000000000000000..6fe8fea153658b048ba9f2df1b23f07148e153f8 --- /dev/null +++ b/codenet/public_test_cases/p04027/output.5.txt @@ -0,0 +1 @@ +421749 diff --git a/codenet/public_test_cases/p04028/input.0.txt b/codenet/public_test_cases/p04028/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p04028/input.0.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p04028/input.1.txt b/codenet/public_test_cases/p04028/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..37e26fc2e0dc783b6064aa031d3bf31c619826ef --- /dev/null +++ b/codenet/public_test_cases/p04028/input.1.txt @@ -0,0 +1,2 @@ +5000 +01000001011101000100001101101111011001000110010101110010000 diff --git a/codenet/public_test_cases/p04028/input.2.txt b/codenet/public_test_cases/p04028/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..043e5719abf6a4dfb639917a36dae53ea42b6919 --- /dev/null +++ b/codenet/public_test_cases/p04028/input.2.txt @@ -0,0 +1,2 @@ +3 +0 diff --git a/codenet/public_test_cases/p04028/input.3.txt b/codenet/public_test_cases/p04028/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..11dd361af9157339766a329c90e243f4c86129dc --- /dev/null +++ b/codenet/public_test_cases/p04028/input.3.txt @@ -0,0 +1,2 @@ +300 +1100100 diff --git a/codenet/public_test_cases/p04028/output.0.txt b/codenet/public_test_cases/p04028/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p04028/output.0.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p04028/output.1.txt b/codenet/public_test_cases/p04028/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..304de0f7a7c666ebc04ac88219e0c0026af6c035 --- /dev/null +++ b/codenet/public_test_cases/p04028/output.1.txt @@ -0,0 +1 @@ +500886057 diff --git a/codenet/public_test_cases/p04028/output.2.txt b/codenet/public_test_cases/p04028/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p04028/output.2.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p04028/output.3.txt b/codenet/public_test_cases/p04028/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..91d0b096e3fc0771ef3ee4262689730b980d7b07 --- /dev/null +++ b/codenet/public_test_cases/p04028/output.3.txt @@ -0,0 +1 @@ +519054663 diff --git a/codenet/public_test_cases/p04029/input.0.txt b/codenet/public_test_cases/p04029/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p04029/input.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p04029/input.1.txt b/codenet/public_test_cases/p04029/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p04029/input.1.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p04029/input.2.txt b/codenet/public_test_cases/p04029/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2 --- /dev/null +++ b/codenet/public_test_cases/p04029/input.2.txt @@ -0,0 +1 @@ +10 diff --git a/codenet/public_test_cases/p04029/input.3.txt b/codenet/public_test_cases/p04029/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04029/input.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04029/output.0.txt b/codenet/public_test_cases/p04029/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p04029/output.0.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p04029/output.1.txt b/codenet/public_test_cases/p04029/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e8b314962144c26d5e0e50fd29d2ca327864913 --- /dev/null +++ b/codenet/public_test_cases/p04029/output.1.txt @@ -0,0 +1 @@ +6 diff --git a/codenet/public_test_cases/p04029/output.2.txt b/codenet/public_test_cases/p04029/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..c3f407c0955bb5738e40a82664c79b63f04a9adb --- /dev/null +++ b/codenet/public_test_cases/p04029/output.2.txt @@ -0,0 +1 @@ +55 diff --git a/codenet/public_test_cases/p04029/output.3.txt b/codenet/public_test_cases/p04029/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04029/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04030/input.0.txt b/codenet/public_test_cases/p04030/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f769cc3538be36cc8d65f556ee112304ac762c2 --- /dev/null +++ b/codenet/public_test_cases/p04030/input.0.txt @@ -0,0 +1 @@ +01B0 diff --git a/codenet/public_test_cases/p04030/input.1.txt b/codenet/public_test_cases/p04030/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..7f769cc3538be36cc8d65f556ee112304ac762c2 --- /dev/null +++ b/codenet/public_test_cases/p04030/input.1.txt @@ -0,0 +1 @@ +01B0 diff --git a/codenet/public_test_cases/p04030/input.2.txt b/codenet/public_test_cases/p04030/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..0617eb73dc8c5a593b86bc2998707f7609186303 --- /dev/null +++ b/codenet/public_test_cases/p04030/input.2.txt @@ -0,0 +1 @@ +0BB1 diff --git a/codenet/public_test_cases/p04030/output.0.txt b/codenet/public_test_cases/p04030/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4daddb72ffc0402845066df20e4480037235ff6b --- /dev/null +++ b/codenet/public_test_cases/p04030/output.0.txt @@ -0,0 +1 @@ +00 diff --git a/codenet/public_test_cases/p04030/output.1.txt b/codenet/public_test_cases/p04030/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4daddb72ffc0402845066df20e4480037235ff6b --- /dev/null +++ b/codenet/public_test_cases/p04030/output.1.txt @@ -0,0 +1 @@ +00 diff --git a/codenet/public_test_cases/p04030/output.2.txt b/codenet/public_test_cases/p04030/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04030/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04031/input.0.txt b/codenet/public_test_cases/p04031/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..77e678c0379756c0b7fbde31e174409bd21213c6 --- /dev/null +++ b/codenet/public_test_cases/p04031/input.0.txt @@ -0,0 +1,2 @@ +2 +4 8 diff --git a/codenet/public_test_cases/p04031/input.1.txt b/codenet/public_test_cases/p04031/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..77e678c0379756c0b7fbde31e174409bd21213c6 --- /dev/null +++ b/codenet/public_test_cases/p04031/input.1.txt @@ -0,0 +1,2 @@ +2 +4 8 diff --git a/codenet/public_test_cases/p04031/input.2.txt b/codenet/public_test_cases/p04031/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ec766278d9cca47c102e1b0c326ff43b0c91e1c --- /dev/null +++ b/codenet/public_test_cases/p04031/input.2.txt @@ -0,0 +1,2 @@ +3 +1 1 3 diff --git a/codenet/public_test_cases/p04031/input.3.txt b/codenet/public_test_cases/p04031/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00747b6ddf9e7af521c89cf4cf894faa2170774 --- /dev/null +++ b/codenet/public_test_cases/p04031/input.3.txt @@ -0,0 +1,2 @@ +3 +4 2 5 diff --git a/codenet/public_test_cases/p04031/input.4.txt b/codenet/public_test_cases/p04031/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..d91dea4257e6f62c9d776f7531f3ef814899f3c6 --- /dev/null +++ b/codenet/public_test_cases/p04031/input.4.txt @@ -0,0 +1,2 @@ +4 +-100 -100 -100 -100 diff --git a/codenet/public_test_cases/p04031/output.0.txt b/codenet/public_test_cases/p04031/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p04031/output.0.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p04031/output.1.txt b/codenet/public_test_cases/p04031/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..45a4fb75db864000d01701c0f7a51864bd4daabf --- /dev/null +++ b/codenet/public_test_cases/p04031/output.1.txt @@ -0,0 +1 @@ +8 diff --git a/codenet/public_test_cases/p04031/output.2.txt b/codenet/public_test_cases/p04031/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p04031/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p04031/output.3.txt b/codenet/public_test_cases/p04031/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69 --- /dev/null +++ b/codenet/public_test_cases/p04031/output.3.txt @@ -0,0 +1 @@ +5 diff --git a/codenet/public_test_cases/p04031/output.4.txt b/codenet/public_test_cases/p04031/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p04031/output.4.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p04032/input.0.txt b/codenet/public_test_cases/p04032/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b0cb99a6d1f06f2bb6c701a1f851beacd28ab15 --- /dev/null +++ b/codenet/public_test_cases/p04032/input.0.txt @@ -0,0 +1 @@ +needed diff --git a/codenet/public_test_cases/p04032/output.0.txt b/codenet/public_test_cases/p04032/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a57b07e9df1624af5ea8d4dc04c425f07b5f0e1f --- /dev/null +++ b/codenet/public_test_cases/p04032/output.0.txt @@ -0,0 +1 @@ +2 5 diff --git a/codenet/public_test_cases/p04033/input.0.txt b/codenet/public_test_cases/p04033/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..707c2f26137f5d7132ee955e0991307ab1a0c540 --- /dev/null +++ b/codenet/public_test_cases/p04033/input.0.txt @@ -0,0 +1 @@ +1 3 diff --git a/codenet/public_test_cases/p04033/output.0.txt b/codenet/public_test_cases/p04033/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bb17ae9585f8185d7c1bb8c4aa98382b0baa17c --- /dev/null +++ b/codenet/public_test_cases/p04033/output.0.txt @@ -0,0 +1 @@ +Positive diff --git a/codenet/public_test_cases/p04034/input.0.txt b/codenet/public_test_cases/p04034/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p04034/input.0.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p04034/input.1.txt b/codenet/public_test_cases/p04034/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d08dd36c793b48d85262290bd4546223000a9f7f --- /dev/null +++ b/codenet/public_test_cases/p04034/input.1.txt @@ -0,0 +1,3 @@ +3 2 +1 2 +2 3 diff --git a/codenet/public_test_cases/p04034/input.2.txt b/codenet/public_test_cases/p04034/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..2c50540ea7b6cccb2d67a23dd0346ec857911d0a --- /dev/null +++ b/codenet/public_test_cases/p04034/input.2.txt @@ -0,0 +1,5 @@ +4 4 +1 2 +2 3 +4 1 +3 4 diff --git a/codenet/public_test_cases/p04034/input.3.txt b/codenet/public_test_cases/p04034/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..00fda8fefd0f7eb36df7bc391876aa9ec7aeb677 --- /dev/null +++ b/codenet/public_test_cases/p04034/input.3.txt @@ -0,0 +1,4 @@ +3 3 +1 2 +2 3 +2 3 diff --git a/codenet/public_test_cases/p04034/output.0.txt b/codenet/public_test_cases/p04034/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04034/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04034/output.1.txt b/codenet/public_test_cases/p04034/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04034/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04034/output.2.txt b/codenet/public_test_cases/p04034/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p04034/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p04034/output.3.txt b/codenet/public_test_cases/p04034/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04034/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04035/input.0.txt b/codenet/public_test_cases/p04035/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab848ce2cba2b686e42f39801d419369c4ec594d --- /dev/null +++ b/codenet/public_test_cases/p04035/input.0.txt @@ -0,0 +1,2 @@ +3 50 +30 20 10 diff --git a/codenet/public_test_cases/p04035/input.1.txt b/codenet/public_test_cases/p04035/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab848ce2cba2b686e42f39801d419369c4ec594d --- /dev/null +++ b/codenet/public_test_cases/p04035/input.1.txt @@ -0,0 +1,2 @@ +3 50 +30 20 10 diff --git a/codenet/public_test_cases/p04035/input.2.txt b/codenet/public_test_cases/p04035/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8af36b4512f83dbbe09f041eca9264c35efca4a3 --- /dev/null +++ b/codenet/public_test_cases/p04035/input.2.txt @@ -0,0 +1,2 @@ +5 50 +10 20 30 40 50 diff --git a/codenet/public_test_cases/p04035/input.3.txt b/codenet/public_test_cases/p04035/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..94b51af5f286adfe958781bdb5613488340e82fa --- /dev/null +++ b/codenet/public_test_cases/p04035/input.3.txt @@ -0,0 +1,2 @@ +2 21 +10 10 diff --git a/codenet/public_test_cases/p04035/output.0.txt b/codenet/public_test_cases/p04035/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca3dbeeabbcaaeb775389d35633865954ec0e2ea --- /dev/null +++ b/codenet/public_test_cases/p04035/output.0.txt @@ -0,0 +1,3 @@ +Possible +2 +1 diff --git a/codenet/public_test_cases/p04035/output.1.txt b/codenet/public_test_cases/p04035/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca3dbeeabbcaaeb775389d35633865954ec0e2ea --- /dev/null +++ b/codenet/public_test_cases/p04035/output.1.txt @@ -0,0 +1,3 @@ +Possible +2 +1 diff --git a/codenet/public_test_cases/p04035/output.2.txt b/codenet/public_test_cases/p04035/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b4644307c29b5e3f2c29bf997c6402332a6b1c5 --- /dev/null +++ b/codenet/public_test_cases/p04035/output.2.txt @@ -0,0 +1,5 @@ +Possible +1 +2 +3 +4 diff --git a/codenet/public_test_cases/p04035/output.3.txt b/codenet/public_test_cases/p04035/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p04035/output.3.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p04036/input.0.txt b/codenet/public_test_cases/p04036/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6a1b731c827defca4a9d990eb4094964ca075bf --- /dev/null +++ b/codenet/public_test_cases/p04036/input.0.txt @@ -0,0 +1,14 @@ +5 6 +2 3 +4 5 +1 2 +1 3 +1 4 +1 5 +6 +2 4 3 +2 4 4 +2 4 5 +1 3 3 +1 3 4 +1 3 5 diff --git a/codenet/public_test_cases/p04036/output.0.txt b/codenet/public_test_cases/p04036/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..a26f52d2890d2cfd201c6845ce4828057e3f0cb2 --- /dev/null +++ b/codenet/public_test_cases/p04036/output.0.txt @@ -0,0 +1,6 @@ +1 +2 +3 +1 +5 +5 diff --git a/codenet/public_test_cases/p04037/input.0.txt b/codenet/public_test_cases/p04037/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..942ce066246f106700b877a50c58e810815c3de6 --- /dev/null +++ b/codenet/public_test_cases/p04037/input.0.txt @@ -0,0 +1,2 @@ +2 +1 3 diff --git a/codenet/public_test_cases/p04037/input.1.txt b/codenet/public_test_cases/p04037/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..56221aadc5dfac666c62fd57ad1536458c512851 --- /dev/null +++ b/codenet/public_test_cases/p04037/input.1.txt @@ -0,0 +1,2 @@ +3 +1 2 1 diff --git a/codenet/public_test_cases/p04037/input.2.txt b/codenet/public_test_cases/p04037/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..942ce066246f106700b877a50c58e810815c3de6 --- /dev/null +++ b/codenet/public_test_cases/p04037/input.2.txt @@ -0,0 +1,2 @@ +2 +1 3 diff --git a/codenet/public_test_cases/p04037/input.3.txt b/codenet/public_test_cases/p04037/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..99e00b5d5b1db4e0fa51a22106d5f35af30e2692 --- /dev/null +++ b/codenet/public_test_cases/p04037/input.3.txt @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/codenet/public_test_cases/p04037/output.0.txt b/codenet/public_test_cases/p04037/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p04037/output.0.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p04037/output.1.txt b/codenet/public_test_cases/p04037/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p04037/output.1.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p04037/output.2.txt b/codenet/public_test_cases/p04037/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..4856fe236dbdd59db2741de0235ae7db63c27a1a --- /dev/null +++ b/codenet/public_test_cases/p04037/output.2.txt @@ -0,0 +1 @@ +First diff --git a/codenet/public_test_cases/p04037/output.3.txt b/codenet/public_test_cases/p04037/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..495a7e948fe261472b6a1b15d76ffdd69a68eff0 --- /dev/null +++ b/codenet/public_test_cases/p04037/output.3.txt @@ -0,0 +1 @@ +Second diff --git a/codenet/public_test_cases/p04038/input.0.txt b/codenet/public_test_cases/p04038/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p04038/input.0.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p04038/input.1.txt b/codenet/public_test_cases/p04038/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..654d526942adbc55329ba991f2023b5f547357a0 --- /dev/null +++ b/codenet/public_test_cases/p04038/input.1.txt @@ -0,0 +1 @@ +2 3 diff --git a/codenet/public_test_cases/p04038/input.2.txt b/codenet/public_test_cases/p04038/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..78454aabfb2f18959434287fece91a9070ffa075 --- /dev/null +++ b/codenet/public_test_cases/p04038/input.2.txt @@ -0,0 +1 @@ +2 2 diff --git a/codenet/public_test_cases/p04038/input.3.txt b/codenet/public_test_cases/p04038/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..606c19ac81d33c3c51cfca1d25eb19573725db09 --- /dev/null +++ b/codenet/public_test_cases/p04038/input.3.txt @@ -0,0 +1 @@ +3 1 diff --git a/codenet/public_test_cases/p04038/input.4.txt b/codenet/public_test_cases/p04038/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca71038cfa7cdffd0f9f88c91973a6d67659c332 --- /dev/null +++ b/codenet/public_test_cases/p04038/input.4.txt @@ -0,0 +1 @@ +2000 2000 diff --git a/codenet/public_test_cases/p04038/output.0.txt b/codenet/public_test_cases/p04038/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p04038/output.0.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p04038/output.1.txt b/codenet/public_test_cases/p04038/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8351c19397f4fcd5238d10034fa7fa384f14d580 --- /dev/null +++ b/codenet/public_test_cases/p04038/output.1.txt @@ -0,0 +1 @@ +14 diff --git a/codenet/public_test_cases/p04038/output.2.txt b/codenet/public_test_cases/p04038/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/codenet/public_test_cases/p04038/output.2.txt @@ -0,0 +1 @@ +4 diff --git a/codenet/public_test_cases/p04038/output.3.txt b/codenet/public_test_cases/p04038/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04038/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04038/output.4.txt b/codenet/public_test_cases/p04038/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e8e11e9924ff0a8f4460971825bf3a6d86526f7 --- /dev/null +++ b/codenet/public_test_cases/p04038/output.4.txt @@ -0,0 +1 @@ +546381702 diff --git a/codenet/public_test_cases/p04039/input.0.txt b/codenet/public_test_cases/p04039/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..008daab23db756e1e7ae8514d0ca7a394d1b53d9 --- /dev/null +++ b/codenet/public_test_cases/p04039/input.0.txt @@ -0,0 +1,2 @@ +1000 8 +1 3 4 5 6 7 8 9 diff --git a/codenet/public_test_cases/p04039/input.1.txt b/codenet/public_test_cases/p04039/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..008daab23db756e1e7ae8514d0ca7a394d1b53d9 --- /dev/null +++ b/codenet/public_test_cases/p04039/input.1.txt @@ -0,0 +1,2 @@ +1000 8 +1 3 4 5 6 7 8 9 diff --git a/codenet/public_test_cases/p04039/input.2.txt b/codenet/public_test_cases/p04039/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..585dd3a6317ee86d995977407c6945a2deb7884b --- /dev/null +++ b/codenet/public_test_cases/p04039/input.2.txt @@ -0,0 +1,2 @@ +9999 1 +0 diff --git a/codenet/public_test_cases/p04039/output.0.txt b/codenet/public_test_cases/p04039/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd1af11bf283704974791862e5f3b3bd5e411aa --- /dev/null +++ b/codenet/public_test_cases/p04039/output.0.txt @@ -0,0 +1 @@ +2000 diff --git a/codenet/public_test_cases/p04039/output.1.txt b/codenet/public_test_cases/p04039/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd1af11bf283704974791862e5f3b3bd5e411aa --- /dev/null +++ b/codenet/public_test_cases/p04039/output.1.txt @@ -0,0 +1 @@ +2000 diff --git a/codenet/public_test_cases/p04039/output.2.txt b/codenet/public_test_cases/p04039/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c2df076c2fbf45c71d624a6cea8ed81d2ac5ee8 --- /dev/null +++ b/codenet/public_test_cases/p04039/output.2.txt @@ -0,0 +1 @@ +9999 diff --git a/codenet/public_test_cases/p04040/input.0.txt b/codenet/public_test_cases/p04040/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f98109664dde37b336d73dee7fbf2b395c7a1fe7 --- /dev/null +++ b/codenet/public_test_cases/p04040/input.0.txt @@ -0,0 +1 @@ +2 3 1 1 diff --git a/codenet/public_test_cases/p04040/input.1.txt b/codenet/public_test_cases/p04040/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f98109664dde37b336d73dee7fbf2b395c7a1fe7 --- /dev/null +++ b/codenet/public_test_cases/p04040/input.1.txt @@ -0,0 +1 @@ +2 3 1 1 diff --git a/codenet/public_test_cases/p04040/input.2.txt b/codenet/public_test_cases/p04040/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..460c66c660d8bd4ee9a50d61f72e9f6e964d9fe8 --- /dev/null +++ b/codenet/public_test_cases/p04040/input.2.txt @@ -0,0 +1 @@ +100000 100000 99999 99999 diff --git a/codenet/public_test_cases/p04040/input.3.txt b/codenet/public_test_cases/p04040/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6073dc32a83779987d6f7da3c2d98ff9d58b74cd --- /dev/null +++ b/codenet/public_test_cases/p04040/input.3.txt @@ -0,0 +1 @@ +100000 100000 44444 55555 diff --git a/codenet/public_test_cases/p04040/input.4.txt b/codenet/public_test_cases/p04040/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..16da09e19a8541c1f21a3d181b22da5bb5dbe91e --- /dev/null +++ b/codenet/public_test_cases/p04040/input.4.txt @@ -0,0 +1 @@ +10 7 3 4 diff --git a/codenet/public_test_cases/p04040/output.0.txt b/codenet/public_test_cases/p04040/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04040/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04040/output.1.txt b/codenet/public_test_cases/p04040/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04040/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04040/output.2.txt b/codenet/public_test_cases/p04040/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04040/output.2.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04040/output.3.txt b/codenet/public_test_cases/p04040/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f3ed1ede561146af3d2264021f4b8fffb8ea2f0 --- /dev/null +++ b/codenet/public_test_cases/p04040/output.3.txt @@ -0,0 +1 @@ +738162020 diff --git a/codenet/public_test_cases/p04040/output.4.txt b/codenet/public_test_cases/p04040/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..43acce8011a8471a5adf811413e79165f8f276aa --- /dev/null +++ b/codenet/public_test_cases/p04040/output.4.txt @@ -0,0 +1 @@ +3570 diff --git a/codenet/public_test_cases/p04041/input.0.txt b/codenet/public_test_cases/p04041/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..10e792e77e4cfb2fb296c61675972631c322f11b --- /dev/null +++ b/codenet/public_test_cases/p04041/input.0.txt @@ -0,0 +1 @@ +3 5 7 5 diff --git a/codenet/public_test_cases/p04041/input.1.txt b/codenet/public_test_cases/p04041/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..24c8e58c7d91373903a2b363a3034c681fafcd5a --- /dev/null +++ b/codenet/public_test_cases/p04041/input.1.txt @@ -0,0 +1 @@ +40 5 7 5 diff --git a/codenet/public_test_cases/p04041/input.2.txt b/codenet/public_test_cases/p04041/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..732cccee76f5fd87d6a0a77732e55152316c82cd --- /dev/null +++ b/codenet/public_test_cases/p04041/input.2.txt @@ -0,0 +1 @@ +4 5 7 5 diff --git a/codenet/public_test_cases/p04041/input.3.txt b/codenet/public_test_cases/p04041/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..10e792e77e4cfb2fb296c61675972631c322f11b --- /dev/null +++ b/codenet/public_test_cases/p04041/input.3.txt @@ -0,0 +1 @@ +3 5 7 5 diff --git a/codenet/public_test_cases/p04041/input.4.txt b/codenet/public_test_cases/p04041/input.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..61841d478d1c7d918038e84950d3d4d614e97b9e --- /dev/null +++ b/codenet/public_test_cases/p04041/input.4.txt @@ -0,0 +1 @@ +37 4 2 3 diff --git a/codenet/public_test_cases/p04041/output.0.txt b/codenet/public_test_cases/p04041/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04041/output.0.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04041/output.1.txt b/codenet/public_test_cases/p04041/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..daa2799bd370bc72a4d2292b21aa3a6f62e8543b --- /dev/null +++ b/codenet/public_test_cases/p04041/output.1.txt @@ -0,0 +1 @@ +562805100 diff --git a/codenet/public_test_cases/p04041/output.2.txt b/codenet/public_test_cases/p04041/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..a7873645902455c63d166fdcaa4b2fe565f6de7d --- /dev/null +++ b/codenet/public_test_cases/p04041/output.2.txt @@ -0,0 +1 @@ +34 diff --git a/codenet/public_test_cases/p04041/output.3.txt b/codenet/public_test_cases/p04041/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d00491fd7e5bb6fa28c517a0bb32b8b506539d4d --- /dev/null +++ b/codenet/public_test_cases/p04041/output.3.txt @@ -0,0 +1 @@ +1 diff --git a/codenet/public_test_cases/p04041/output.4.txt b/codenet/public_test_cases/p04041/output.4.txt new file mode 100644 index 0000000000000000000000000000000000000000..f63b98fdc237579631c6403959f220425f629b70 --- /dev/null +++ b/codenet/public_test_cases/p04041/output.4.txt @@ -0,0 +1 @@ +863912418 diff --git a/codenet/public_test_cases/p04042/input.0.txt b/codenet/public_test_cases/p04042/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3b305c033cbd98ce659f8ea3b1cbf788005c97a --- /dev/null +++ b/codenet/public_test_cases/p04042/input.0.txt @@ -0,0 +1,4 @@ +3 7 +at +coder +codar diff --git a/codenet/public_test_cases/p04042/input.1.txt b/codenet/public_test_cases/p04042/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4155207fc6b1ac91ba6222c37b76b79dbcee071 --- /dev/null +++ b/codenet/public_test_cases/p04042/input.1.txt @@ -0,0 +1,5 @@ +4 13 +kyuri +namida +zzzzzzz +aaaaaa diff --git a/codenet/public_test_cases/p04042/input.2.txt b/codenet/public_test_cases/p04042/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3b305c033cbd98ce659f8ea3b1cbf788005c97a --- /dev/null +++ b/codenet/public_test_cases/p04042/input.2.txt @@ -0,0 +1,4 @@ +3 7 +at +coder +codar diff --git a/codenet/public_test_cases/p04042/input.3.txt b/codenet/public_test_cases/p04042/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..57f2a909f7bc5f3f86f4f811bfcff38043281351 --- /dev/null +++ b/codenet/public_test_cases/p04042/input.3.txt @@ -0,0 +1,4 @@ +3 7 +coder +codar +at diff --git a/codenet/public_test_cases/p04042/output.0.txt b/codenet/public_test_cases/p04042/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..236ab3f2809273f1a2fe4cf752788e9197a95c53 --- /dev/null +++ b/codenet/public_test_cases/p04042/output.0.txt @@ -0,0 +1 @@ +atcodar diff --git a/codenet/public_test_cases/p04042/output.1.txt b/codenet/public_test_cases/p04042/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..16094dbf21c85c58462abf5bbd3715de069ec775 --- /dev/null +++ b/codenet/public_test_cases/p04042/output.1.txt @@ -0,0 +1 @@ +namidazzzzzzz diff --git a/codenet/public_test_cases/p04042/output.2.txt b/codenet/public_test_cases/p04042/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..236ab3f2809273f1a2fe4cf752788e9197a95c53 --- /dev/null +++ b/codenet/public_test_cases/p04042/output.2.txt @@ -0,0 +1 @@ +atcodar diff --git a/codenet/public_test_cases/p04042/output.3.txt b/codenet/public_test_cases/p04042/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d55bcdf6575d53250b85aa2f9d1c94ac80e59d0 --- /dev/null +++ b/codenet/public_test_cases/p04042/output.3.txt @@ -0,0 +1 @@ +codarat diff --git a/codenet/public_test_cases/p04043/input.0.txt b/codenet/public_test_cases/p04043/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..959b81b0987b726e9460e89db0416a00c9faac0b --- /dev/null +++ b/codenet/public_test_cases/p04043/input.0.txt @@ -0,0 +1 @@ +5 5 7 diff --git a/codenet/public_test_cases/p04043/input.1.txt b/codenet/public_test_cases/p04043/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..959b81b0987b726e9460e89db0416a00c9faac0b --- /dev/null +++ b/codenet/public_test_cases/p04043/input.1.txt @@ -0,0 +1 @@ +5 5 7 diff --git a/codenet/public_test_cases/p04043/input.2.txt b/codenet/public_test_cases/p04043/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..023b756a4c048c515288e3bd78d030a0b8e3898f --- /dev/null +++ b/codenet/public_test_cases/p04043/input.2.txt @@ -0,0 +1 @@ +7 7 5 diff --git a/codenet/public_test_cases/p04043/output.0.txt b/codenet/public_test_cases/p04043/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p04043/output.0.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p04043/output.1.txt b/codenet/public_test_cases/p04043/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..f033a5010da4a225a1ba70eedd933397ae5bebfc --- /dev/null +++ b/codenet/public_test_cases/p04043/output.1.txt @@ -0,0 +1 @@ +YES diff --git a/codenet/public_test_cases/p04043/output.2.txt b/codenet/public_test_cases/p04043/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e35d1bfb243fe9a0bf946872a23438db60e8b77 --- /dev/null +++ b/codenet/public_test_cases/p04043/output.2.txt @@ -0,0 +1 @@ +NO diff --git a/codenet/public_test_cases/p04044/input.0.txt b/codenet/public_test_cases/p04044/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..d608a688a12afd412ae69400e771c93ea0a30e27 --- /dev/null +++ b/codenet/public_test_cases/p04044/input.0.txt @@ -0,0 +1,4 @@ +3 3 +dxx +axx +cxx diff --git a/codenet/public_test_cases/p04044/input.1.txt b/codenet/public_test_cases/p04044/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d608a688a12afd412ae69400e771c93ea0a30e27 --- /dev/null +++ b/codenet/public_test_cases/p04044/input.1.txt @@ -0,0 +1,4 @@ +3 3 +dxx +axx +cxx diff --git a/codenet/public_test_cases/p04044/output.0.txt b/codenet/public_test_cases/p04044/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..96f7c28ca8e1959a085d42c2edd0f646b80eb535 --- /dev/null +++ b/codenet/public_test_cases/p04044/output.0.txt @@ -0,0 +1 @@ +axxcxxdxx diff --git a/codenet/public_test_cases/p04044/output.1.txt b/codenet/public_test_cases/p04044/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..96f7c28ca8e1959a085d42c2edd0f646b80eb535 --- /dev/null +++ b/codenet/public_test_cases/p04044/output.1.txt @@ -0,0 +1 @@ +axxcxxdxx diff --git a/codenet/public_test_cases/p04045/input.0.txt b/codenet/public_test_cases/p04045/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..008daab23db756e1e7ae8514d0ca7a394d1b53d9 --- /dev/null +++ b/codenet/public_test_cases/p04045/input.0.txt @@ -0,0 +1,2 @@ +1000 8 +1 3 4 5 6 7 8 9 diff --git a/codenet/public_test_cases/p04045/output.0.txt b/codenet/public_test_cases/p04045/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..8bd1af11bf283704974791862e5f3b3bd5e411aa --- /dev/null +++ b/codenet/public_test_cases/p04045/output.0.txt @@ -0,0 +1 @@ +2000 diff --git a/codenet/public_test_cases/p04046/input.0.txt b/codenet/public_test_cases/p04046/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..f98109664dde37b336d73dee7fbf2b395c7a1fe7 --- /dev/null +++ b/codenet/public_test_cases/p04046/input.0.txt @@ -0,0 +1 @@ +2 3 1 1 diff --git a/codenet/public_test_cases/p04046/output.0.txt b/codenet/public_test_cases/p04046/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04046/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04047/input.0.txt b/codenet/public_test_cases/p04047/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..773eb831ae1e6dfe5e263de9c375b4fd91b777a8 --- /dev/null +++ b/codenet/public_test_cases/p04047/input.0.txt @@ -0,0 +1,2 @@ +2 +1 3 1 2 diff --git a/codenet/public_test_cases/p04047/input.1.txt b/codenet/public_test_cases/p04047/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5424ed3b3e436871f05a3effd73d84cf9c26be8 --- /dev/null +++ b/codenet/public_test_cases/p04047/input.1.txt @@ -0,0 +1,2 @@ +5 +100 1 2 3 14 15 58 58 58 29 diff --git a/codenet/public_test_cases/p04047/input.2.txt b/codenet/public_test_cases/p04047/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..773eb831ae1e6dfe5e263de9c375b4fd91b777a8 --- /dev/null +++ b/codenet/public_test_cases/p04047/input.2.txt @@ -0,0 +1,2 @@ +2 +1 3 1 2 diff --git a/codenet/public_test_cases/p04047/output.0.txt b/codenet/public_test_cases/p04047/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p04047/output.0.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p04047/output.1.txt b/codenet/public_test_cases/p04047/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c8b255fc8e570b060dee73203b13b3bb65a75758 --- /dev/null +++ b/codenet/public_test_cases/p04047/output.1.txt @@ -0,0 +1 @@ +135 diff --git a/codenet/public_test_cases/p04047/output.2.txt b/codenet/public_test_cases/p04047/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..00750edc07d6415dcc07ae0351e9397b0222b7ba --- /dev/null +++ b/codenet/public_test_cases/p04047/output.2.txt @@ -0,0 +1 @@ +3 diff --git a/codenet/public_test_cases/p04048/input.0.txt b/codenet/public_test_cases/p04048/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p04048/input.0.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p04048/input.1.txt b/codenet/public_test_cases/p04048/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..69010fb2e636487328585eeb80e4ecfb1ea391f0 --- /dev/null +++ b/codenet/public_test_cases/p04048/input.1.txt @@ -0,0 +1 @@ +5 2 diff --git a/codenet/public_test_cases/p04048/output.0.txt b/codenet/public_test_cases/p04048/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p04048/output.0.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p04048/output.1.txt b/codenet/public_test_cases/p04048/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..48082f72f087ce7e6fa75b9c41d7387daecd447b --- /dev/null +++ b/codenet/public_test_cases/p04048/output.1.txt @@ -0,0 +1 @@ +12 diff --git a/codenet/public_test_cases/p04049/input.0.txt b/codenet/public_test_cases/p04049/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..58bcc369029c99e7f10b448d64ba20aa4ea70569 --- /dev/null +++ b/codenet/public_test_cases/p04049/input.0.txt @@ -0,0 +1,6 @@ +6 2 +1 2 +3 2 +4 2 +1 6 +5 6 diff --git a/codenet/public_test_cases/p04049/input.1.txt b/codenet/public_test_cases/p04049/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..58bcc369029c99e7f10b448d64ba20aa4ea70569 --- /dev/null +++ b/codenet/public_test_cases/p04049/input.1.txt @@ -0,0 +1,6 @@ +6 2 +1 2 +3 2 +4 2 +1 6 +5 6 diff --git a/codenet/public_test_cases/p04049/input.2.txt b/codenet/public_test_cases/p04049/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..abd7f93eb37e0c3657b175820ecf61a902a7408d --- /dev/null +++ b/codenet/public_test_cases/p04049/input.2.txt @@ -0,0 +1,6 @@ +6 5 +1 2 +3 2 +4 2 +1 6 +5 6 diff --git a/codenet/public_test_cases/p04049/output.0.txt b/codenet/public_test_cases/p04049/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04049/output.0.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04049/output.1.txt b/codenet/public_test_cases/p04049/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..0cfbf08886fca9a91cb753ec8734c84fcbe52c9f --- /dev/null +++ b/codenet/public_test_cases/p04049/output.1.txt @@ -0,0 +1 @@ +2 diff --git a/codenet/public_test_cases/p04049/output.2.txt b/codenet/public_test_cases/p04049/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..573541ac9702dd3969c9bc859d2b91ec1f7e6e56 --- /dev/null +++ b/codenet/public_test_cases/p04049/output.2.txt @@ -0,0 +1 @@ +0 diff --git a/codenet/public_test_cases/p04050/input.0.txt b/codenet/public_test_cases/p04050/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..735564ef4e99e0d6b0747d87932b5088397f9cb8 --- /dev/null +++ b/codenet/public_test_cases/p04050/input.0.txt @@ -0,0 +1,2 @@ +3 2 +2 1 diff --git a/codenet/public_test_cases/p04050/input.1.txt b/codenet/public_test_cases/p04050/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..735564ef4e99e0d6b0747d87932b5088397f9cb8 --- /dev/null +++ b/codenet/public_test_cases/p04050/input.1.txt @@ -0,0 +1,2 @@ +3 2 +2 1 diff --git a/codenet/public_test_cases/p04050/input.2.txt b/codenet/public_test_cases/p04050/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8c44aec543522e1afa47bc6f4e2796693f89642c --- /dev/null +++ b/codenet/public_test_cases/p04050/input.2.txt @@ -0,0 +1,2 @@ +55 10 +1 2 3 4 5 6 7 8 9 10 diff --git a/codenet/public_test_cases/p04050/input.3.txt b/codenet/public_test_cases/p04050/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..2ad18d286c3680c7181c8e5005e06d2797b62708 --- /dev/null +++ b/codenet/public_test_cases/p04050/input.3.txt @@ -0,0 +1,2 @@ +6 1 +6 diff --git a/codenet/public_test_cases/p04050/output.0.txt b/codenet/public_test_cases/p04050/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..92d43dbe0a860e830c51d5cd8c58605b19f8808c --- /dev/null +++ b/codenet/public_test_cases/p04050/output.0.txt @@ -0,0 +1,3 @@ +1 2 +1 +3 diff --git a/codenet/public_test_cases/p04050/output.1.txt b/codenet/public_test_cases/p04050/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..92d43dbe0a860e830c51d5cd8c58605b19f8808c --- /dev/null +++ b/codenet/public_test_cases/p04050/output.1.txt @@ -0,0 +1,3 @@ +1 2 +1 +3 diff --git a/codenet/public_test_cases/p04050/output.2.txt b/codenet/public_test_cases/p04050/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..aebdce6a6fe65fdfb8cf844fe388bc146a50b9b5 --- /dev/null +++ b/codenet/public_test_cases/p04050/output.2.txt @@ -0,0 +1 @@ +Impossible diff --git a/codenet/public_test_cases/p04050/output.3.txt b/codenet/public_test_cases/p04050/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..cfaeb23412c12c44e471053d7a999282e7441d62 --- /dev/null +++ b/codenet/public_test_cases/p04050/output.3.txt @@ -0,0 +1,3 @@ +6 +3 +1 2 3 diff --git a/codenet/public_test_cases/p04051/input.0.txt b/codenet/public_test_cases/p04051/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..baea5261f35227e645bc95a18ddfd75dadb7d36e --- /dev/null +++ b/codenet/public_test_cases/p04051/input.0.txt @@ -0,0 +1,4 @@ +3 +1 1 +1 1 +2 1 diff --git a/codenet/public_test_cases/p04051/input.1.txt b/codenet/public_test_cases/p04051/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..baea5261f35227e645bc95a18ddfd75dadb7d36e --- /dev/null +++ b/codenet/public_test_cases/p04051/input.1.txt @@ -0,0 +1,4 @@ +3 +1 1 +1 1 +2 1 diff --git a/codenet/public_test_cases/p04051/output.0.txt b/codenet/public_test_cases/p04051/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p04051/output.0.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p04051/output.1.txt b/codenet/public_test_cases/p04051/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f4247a6255c99f420d1df558d68745592862ff7 --- /dev/null +++ b/codenet/public_test_cases/p04051/output.1.txt @@ -0,0 +1 @@ +26 diff --git a/codenet/public_test_cases/p04052/input.0.txt b/codenet/public_test_cases/p04052/input.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..986280dec6687d112e116dc164411acda449d0fc --- /dev/null +++ b/codenet/public_test_cases/p04052/input.0.txt @@ -0,0 +1,2 @@ +4 2 +4 2 3 1 diff --git a/codenet/public_test_cases/p04052/input.1.txt b/codenet/public_test_cases/p04052/input.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe505e04dac46606dbd95c27cdcedf2f1ebab037 --- /dev/null +++ b/codenet/public_test_cases/p04052/input.1.txt @@ -0,0 +1,2 @@ +8 3 +4 5 7 8 3 1 2 6 diff --git a/codenet/public_test_cases/p04052/input.2.txt b/codenet/public_test_cases/p04052/input.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..b433344d6c89538ac4480746b8567e7bcefdfb59 --- /dev/null +++ b/codenet/public_test_cases/p04052/input.2.txt @@ -0,0 +1,2 @@ +5 1 +5 4 3 2 1 diff --git a/codenet/public_test_cases/p04052/input.3.txt b/codenet/public_test_cases/p04052/input.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..986280dec6687d112e116dc164411acda449d0fc --- /dev/null +++ b/codenet/public_test_cases/p04052/input.3.txt @@ -0,0 +1,2 @@ +4 2 +4 2 3 1 diff --git a/codenet/public_test_cases/p04052/output.0.txt b/codenet/public_test_cases/p04052/output.0.txt new file mode 100644 index 0000000000000000000000000000000000000000..388fe070d8a39dbbaca36e7c0d08b7ad1fe66b74 --- /dev/null +++ b/codenet/public_test_cases/p04052/output.0.txt @@ -0,0 +1,4 @@ +2 +1 +4 +3 diff --git a/codenet/public_test_cases/p04052/output.1.txt b/codenet/public_test_cases/p04052/output.1.txt new file mode 100644 index 0000000000000000000000000000000000000000..9de2dbe2452d4653b108ca2ea355052010e643a5 --- /dev/null +++ b/codenet/public_test_cases/p04052/output.1.txt @@ -0,0 +1,8 @@ +1 +2 +6 +7 +5 +3 +4 +8 diff --git a/codenet/public_test_cases/p04052/output.2.txt b/codenet/public_test_cases/p04052/output.2.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a1218a1024a212bb3db30becd860315f9f3ac52 --- /dev/null +++ b/codenet/public_test_cases/p04052/output.2.txt @@ -0,0 +1,5 @@ +1 +2 +3 +4 +5 diff --git a/codenet/public_test_cases/p04052/output.3.txt b/codenet/public_test_cases/p04052/output.3.txt new file mode 100644 index 0000000000000000000000000000000000000000..388fe070d8a39dbbaca36e7c0d08b7ad1fe66b74 --- /dev/null +++ b/codenet/public_test_cases/p04052/output.3.txt @@ -0,0 +1,4 @@ +2 +1 +4 +3 diff --git a/preprocessed/README.md b/preprocessed/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d4567f15c53ab4b8a76513ff63053bfa909260a6 --- /dev/null +++ b/preprocessed/README.md @@ -0,0 +1,19 @@ +# `data/preprocessed/` — Preprocessed tensor caches + +Tokenize `jsonl` offline into `.pt` bundles to reduce CPU load during SFT or related stages. + +## Subdirectories + +### `sft_dream_py/` + +| File | Description | +|------|-------------| +| `train.pt` | Training split tensor dict (`input_ids`, `labels`, `attention_mask`, etc.; confirm with `torch.load`) | +| `val.pt` | Validation split | +| `meta.json` | Source paths, tokenizer name, max length, etc. | + +### `sft_dream_py_ast/` (if present) + +Same general layout with **AST** / extra fields; often contains **many experiment subfolders**—see [`sft_dream_py_ast/README.md`](sft_dream_py_ast/README.md). Tensor keys follow `train/sft_dream_dataset_ast*.py`. + +Generation is usually a custom script or a `--preprocess`-style path in `train/`; `dataset.preprocessed_dir` in YAML should match the folder name. diff --git a/preprocessed/sft_dream_py/README.md b/preprocessed/sft_dream_py/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8945b1ee7aa01cabeb157ab4a7f0c0a2d8534def --- /dev/null +++ b/preprocessed/sft_dream_py/README.md @@ -0,0 +1,3 @@ +# `data/preprocessed/sft_dream_py/` — Non-AST SFT cache + +As in the parent [`README.md`](../README.md): typically `train.pt`, `val.pt`, `meta.json` for `train/sft_dream_dataset.py` and `configs/sft_dream_py.yaml`-style flows. diff --git a/preprocessed/sft_dream_py/meta.json b/preprocessed/sft_dream_py/meta.json new file mode 100644 index 0000000000000000000000000000000000000000..a20341ff6124cdc90316d6f572e52230942e9b17 --- /dev/null +++ b/preprocessed/sft_dream_py/meta.json @@ -0,0 +1,8 @@ +{ + "drop_num": 14, + "num_train": 204752, + "num_val": 400, + "method": "random_masking", + "num_response": 25608, + "preprocessed_dir": "data/preprocessed/sft_dream_py_5e-7lr_2lm_8ga_4gpus_m7_1000traincases_2epochs" +} \ No newline at end of file diff --git a/preprocessed/sft_dream_py/train.pt b/preprocessed/sft_dream_py/train.pt new file mode 100644 index 0000000000000000000000000000000000000000..139d0a20a4c6b91f285100da7bc1a83cfea7aef5 --- /dev/null +++ b/preprocessed/sft_dream_py/train.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11c2d83e690c622262f2af6811be3d6b063ede32c33845ba28add7cf61c7463e +size 6872707576 diff --git a/preprocessed/sft_dream_py/val.pt b/preprocessed/sft_dream_py/val.pt new file mode 100644 index 0000000000000000000000000000000000000000..1f4ac1e4e59329000aa7451ea771c4e41b4c40d2 --- /dev/null +++ b/preprocessed/sft_dream_py/val.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7de83fcb72072166b5d93ba82ace46f9512d3c436323ca86e653d9b3e941979 +size 12326512 diff --git a/preprocessed/sft_dream_py_ast/README.md b/preprocessed/sft_dream_py_ast/README.md new file mode 100644 index 0000000000000000000000000000000000000000..845bfe5bb9c122d744a5737a5d3023d04eb6a9da --- /dev/null +++ b/preprocessed/sft_dream_py_ast/README.md @@ -0,0 +1,17 @@ +# `data/preprocessed/sft_dream_py_ast/` — AST SFT caches (many runs) + +Sibling to `sft_dream_py/`. Each **subfolder** is one **AST-related preprocessing** pipeline (mask policy, depth, random depth, SVEN subsets, etc.), usually containing `train.pt`, `val.pt`, `meta.json` (verify on disk). + +## Subfolder name patterns (examples) + +| Pattern | Meaning (high level) | +|---------|----------------------| +| `ast_depth_masking*`, `ast_depth_masking_both`, `ast_depth_masking_min` | Mask variants by **AST depth** | +| `ast_depth_masking_invert*` | Inverted or ablation depth masks | +| `random_depth_masking*` | **Random depth** masks | +| `ast_node_masking_*` | **Node-level** masks | +| `ast_random_m_*` | Random-AST `m` experiment series | +| `*_sven_1_1024`, `*_sven_bigvul*` | **SVEN / Big-Vul** scale or subset | +| `ast_depth_label_learning` | Preprocessing with **depth label learning** | + +We **do not** add a README in every leaf; for reproduction use that folder’s `meta.json` and the YAML `dataset.preprocessed_dir` from the run. diff --git a/preprocessed/sft_dream_py_ast/ast_random_m_3/meta.json b/preprocessed/sft_dream_py_ast/ast_random_m_3/meta.json new file mode 100644 index 0000000000000000000000000000000000000000..af95e93688c86adc9fea1f4601d93f9981c29d82 --- /dev/null +++ b/preprocessed/sft_dream_py_ast/ast_random_m_3/meta.json @@ -0,0 +1,9 @@ +{ + "drop_num": 14, + "num_train": 204744, + "num_val": 400, + "method": "ast_depth_masking", + "num_response": 25607, + "preprocessed_dir": "data/preprocessed/sft_dream_py_ast/ast_random_m_3", + "model_path": "../dLLM-RL/local_models/dream-7b-base" +} \ No newline at end of file diff --git a/preprocessed/sft_dream_py_ast/ast_random_m_3/train.pt b/preprocessed/sft_dream_py_ast/ast_random_m_3/train.pt new file mode 100644 index 0000000000000000000000000000000000000000..b2cb3d80ca83d4f510089accf7daa34ee8aae3ec --- /dev/null +++ b/preprocessed/sft_dream_py_ast/ast_random_m_3/train.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f3d8bb7a955e6c9442edd9c355fb72c50f1f12c6f09ffe943305d525c4c69be +size 7164697272 diff --git a/preprocessed/sft_dream_py_ast/ast_random_m_3/val.pt b/preprocessed/sft_dream_py_ast/ast_random_m_3/val.pt new file mode 100644 index 0000000000000000000000000000000000000000..a74d170f8767cb6c24f1d2027916732e69ca2313 --- /dev/null +++ b/preprocessed/sft_dream_py_ast/ast_random_m_3/val.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca72fa47ad4a056beff2535460ed64847527b894f5bd8c66d3d07011efe2d95b +size 13010608 diff --git a/preprocessed/sft_dream_py_ast/random_depth_masking-1/meta.json b/preprocessed/sft_dream_py_ast/random_depth_masking-1/meta.json new file mode 100644 index 0000000000000000000000000000000000000000..c84908d7f982a126a75882ad40b7db51601733c0 --- /dev/null +++ b/preprocessed/sft_dream_py_ast/random_depth_masking-1/meta.json @@ -0,0 +1,9 @@ +{ + "drop_num": 14, + "num_train": 204744, + "num_val": 400, + "method": "ast_depth_masking", + "num_response": 25607, + "preprocessed_dir": "data/preprocessed/sft_dream_py_ast/random_depth_masking", + "model_path": "../dLLM-RL/local_models/dream-7b-base" +} \ No newline at end of file diff --git a/preprocessed/sft_dream_py_ast/random_depth_masking-1/train.pt b/preprocessed/sft_dream_py_ast/random_depth_masking-1/train.pt new file mode 100644 index 0000000000000000000000000000000000000000..a4d761358e98c695642355a26ddb605321f13491 --- /dev/null +++ b/preprocessed/sft_dream_py_ast/random_depth_masking-1/train.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c6447c4e3300e4b0552fa63b294792f5e6b74ef92d5a02b74309b34e34c5093 +size 8781356222 diff --git a/preprocessed/sft_dream_py_ast/random_depth_masking-1/val.pt b/preprocessed/sft_dream_py_ast/random_depth_masking-1/val.pt new file mode 100644 index 0000000000000000000000000000000000000000..6daa4a20a51754260f574b802fe1dc5c42af659a --- /dev/null +++ b/preprocessed/sft_dream_py_ast/random_depth_masking-1/val.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15d2693395b4b44bee6a6405ad160f8417a9e4a12fbcab4c2aef9850d7a83ade +size 15910056 diff --git a/preprocessed/sft_dream_py_ast/random_depth_masking-1_sven_bigvul_all_1_1024/meta.json b/preprocessed/sft_dream_py_ast/random_depth_masking-1_sven_bigvul_all_1_1024/meta.json new file mode 100644 index 0000000000000000000000000000000000000000..41f49d006f861061258f22d89293e63bf68d41bb --- /dev/null +++ b/preprocessed/sft_dream_py_ast/random_depth_masking-1_sven_bigvul_all_1_1024/meta.json @@ -0,0 +1,21 @@ +{ + "drop_num": 92, + "num_train": 59352, + "num_val": 392, + "method": "ast_depth_masking", + "num_response": 7511, + "preprocessed_dir": "data/preprocessed/sft_dream_py_ast/random_depth_masking-1_sven_bigvul_all_1_1024", + "model_path": "/research/jiamin0630/codediffu/CodeDllm/projects/sft_dream_py_ast/multitask_stage1_sven_1_1024_astdepth_1e-4lr_2/checkpoint-200", + "ast_success_count_by_lang": { + "c": 7009, + "cpp": 73, + "python": 337 + }, + "ast_fail_count_by_lang": {}, + "val_ast_success_count_by_lang": { + "c": 45, + "python": 2, + "cpp": 2 + }, + "val_ast_fail_count_by_lang": {} +} \ No newline at end of file diff --git a/preprocessed/sft_dream_py_ast/random_depth_masking-1_sven_bigvul_all_1_1024/train.pt b/preprocessed/sft_dream_py_ast/random_depth_masking-1_sven_bigvul_all_1_1024/train.pt new file mode 100644 index 0000000000000000000000000000000000000000..0bf6d85d6efab7791652b892a3ac98b56be14c5e --- /dev/null +++ b/preprocessed/sft_dream_py_ast/random_depth_masking-1_sven_bigvul_all_1_1024/train.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e043ff361c70457b007ab7d7bdbaa207739321b58c6b0daab2a2af7ee94b22e +size 2647374458 diff --git a/preprocessed/sft_dream_py_ast/random_depth_masking-1_sven_bigvul_all_1_1024/val.pt b/preprocessed/sft_dream_py_ast/random_depth_masking-1_sven_bigvul_all_1_1024/val.pt new file mode 100644 index 0000000000000000000000000000000000000000..9b70a3e64408136a11e2bf683dff585503050b67 --- /dev/null +++ b/preprocessed/sft_dream_py_ast/random_depth_masking-1_sven_bigvul_all_1_1024/val.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66d9571ac0d43e9abc28fb067780a47a578c93363ee5976a5c1522403a41207e +size 16573544 diff --git a/python_splits/README.md b/python_splits/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fac5f60a5a36f1065b6005649fe06952430ca5ae --- /dev/null +++ b/python_splits/README.md @@ -0,0 +1,34 @@ +# `data/python_splits/` — Python task splits + +`jsonl` splits and derived files for **verified** code completion / repair benchmarks. + +## Core `jsonl` files + +| File | Description | +|------|-------------| +| `train_verified.jsonl` | Training set | +| `val.jsonl` | Validation set | +| `test_verified.jsonl` | Test set | +| `train_valtest.jsonl` | Train+val+test union (if a script needs the full pool) | +| `codegen_1shot_test.jsonl` | One-shot generation test subset | +| `test_input_verified_baseline.jsonl` | Baseline input version | +| `test_input_verified_baseline_with_weights.jsonl` | With per-sample weights | +| `test_input_verified_baseline_with_cfg_weights.jsonl` | With CFG-related weights | +| `train_verified_with_weights.jsonl`, `train_verified_with_cfg_weights.jsonl` | Weighted training | +| `test_verified.target_with_token_buckets.jsonl` | Test rows with **target length bucket** labels | + +## Bucket metadata + +| Path | Description | +|------|-------------| +| `test_verified.target_bucket_subsets/` | Per-bucket files, e.g. `1_128.jsonl`, `128_256.jsonl`, `256_512.jsonl`, `512_1024.jsonl` | +| `test_verified.target_bucket_to_keys.json` | Bucket name → list of sample ids | +| `test_verified.target_token_bucket_summary.json` | Per-bucket counts and stats | + +`rl.py` function `_resolve_train_subset_specs` reads selected files under `python_splits/test_verified.target_bucket_subsets` by default and infers per-bucket `max_new_tokens`, `steps`, and `shrink` (overridable in YAML). + +## Other + +| File | Description | +|------|-------------| +| `command.txt` | Commands used to generate or refresh this folder | diff --git a/python_splits/codegen_1shot_test.jsonl b/python_splits/codegen_1shot_test.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..6446c4f6afa806d50bbafd86655d130756ee00ea --- /dev/null +++ b/python_splits/codegen_1shot_test.jsonl @@ -0,0 +1,1000 @@ +{"user_id":"u732870425","problem_id":"p03371","language":"python","submission_id_v0":"s504204235","submission_id_v1":"s825991485","cpu_time_v0":104,"cpu_time_v1":26,"memory_v0":9176,"memory_v1":9180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 5000 * 2 * 10 ** 5\n\nfor i in range(10 ** 5 + 1):\n\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n\n ans = min(ans, s)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nif X > Y:\n\n v = A\n\nelse:\n\n v = B\n\n\n\nans = min(A*X+B*Y, C*max(X, Y)*2, C*min(X,Y)*2+(max(X,Y)-min(X,Y))*v)\n\n\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":10,"code_v0_num_chars":195,"code_v1_num_chars":170,"code_v0_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nans = 5000 * 2 * 10**5\nfor i in range(10**5 + 1):\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n ans = min(ans, s)\nprint(ans)\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nif X > Y:\n v = A\nelse:\n v = B\nans = min(\n A * X + B * Y, C * max(X, Y) * 2, C * min(X, Y) * 2 + (max(X, Y) - min(X, Y)) * v\n)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-ans = 5000 * 2 * 10**5","-for i in range(10**5 + 1):","- s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B","- ans = min(ans, s)","+if X > Y:","+ v = A","+else:","+ v = B","+ans = min(","+ A * X + B * Y, C * max(X, Y) * 2, C * min(X, Y) * 2 + (max(X, Y) - min(X, Y)) * v","+)"],"diff_only_import_comment":false,"measured_runtime_v0":1.5409223008,"measured_runtime_v1":0.2907806964,"runtime_lift":5.2992592696,"key":["s504204235","s825991485"]} +{"user_id":"u102461423","problem_id":"p02612","language":"python","submission_id_v0":"s840955881","submission_id_v1":"s608348800","cpu_time_v0":35,"cpu_time_v1":29,"memory_v0":9152,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.14,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(read())\n\nx = N + (-N) % 1000\n\nprint((x - N))\n\n# optimized version of the same code:\n","target":"import math\n\nN = int(eval(input()))\n\nx = math.ceil(N\/1000) * 1000\n\nprint((x-N))","code_v0_loc":9,"code_v1_loc":4,"code_v0_num_chars":174,"code_v1_num_chars":71,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(read())\nx = N + (-N) % 1000\nprint((x - N))\n","code_v1_no_empty_lines":"import math\n\nN = int(eval(input()))\nx = math.ceil(N \/ 1000) * 1000\nprint((x - N))\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-import sys","+import math","-read = sys.stdin.buffer.read","-readline = sys.stdin.buffer.readline","-readlines = sys.stdin.buffer.readlines","-N = int(read())","-x = N + (-N) % 1000","+N = int(eval(input()))","+x = math.ceil(N \/ 1000) * 1000"],"diff_only_import_comment":false,"measured_runtime_v0":0.260022393,"measured_runtime_v1":0.1385840868,"runtime_lift":1.8762788639,"key":["s840955881","s608348800"]} +{"user_id":"u105210954","problem_id":"p03013","language":"python","submission_id_v0":"s757552767","submission_id_v1":"s396543034","cpu_time_v0":1264,"cpu_time_v1":505,"memory_v0":17796,"memory_v1":44376,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.05,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\ndef resolve():\n\n MOD = 10 ** 9 + 7\n\n n, m = list(map(int, input().split()))\n\n a = [int(eval(input())) for _ in range(m)]\n\n\n\n dp = np.array([1] * (n + 1))\n\n dp[a] = 0\n\n\n\n for i in range(2, n + 1):\n\n if dp[i] != 0:\n\n dp[i] = np.sum(dp[i - 2:i]) % MOD\n\n\n\n print((dp[n]))\n\n \n\nresolve()\n\n# optimized version of the same code:\n","target":"def resolve():\n\n MOD = 10 ** 9 + 7\n\n n, m = list(map(int, input().split()))\n\n\n\n # i\u6bb5\u76ee\u306b\u5230\u9054\u3059\u308b\u307e\u3067\u306e\u30eb\u30fc\u30c8\u306e\u7dcf\u6570\n\n dp = [1] * (n + 1)\n\n\n\n for _ in range(m):\n\n dp[int(eval(input()))] = 0\n\n\n\n for i in range(2, n + 1):\n\n if dp[i] == 0:\n\n continue\n\n\n\n dp[i] = (dp[i - 1] + dp[i - 2]) % MOD\n\n\n\n print((dp[n]))\n\n \n\nresolve()","code_v0_loc":16,"code_v1_loc":19,"code_v0_num_chars":329,"code_v1_num_chars":347,"code_v0_no_empty_lines":"import numpy as np\n\n\ndef resolve():\n MOD = 10**9 + 7\n n, m = list(map(int, input().split()))\n a = [int(eval(input())) for _ in range(m)]\n dp = np.array([1] * (n + 1))\n dp[a] = 0\n for i in range(2, n + 1):\n if dp[i] != 0:\n dp[i] = np.sum(dp[i - 2 : i]) % MOD\n print((dp[n]))\n\n\nresolve()\n","code_v1_no_empty_lines":"def resolve():\n MOD = 10**9 + 7\n n, m = list(map(int, input().split()))\n # i\u6bb5\u76ee\u306b\u5230\u9054\u3059\u308b\u307e\u3067\u306e\u30eb\u30fc\u30c8\u306e\u7dcf\u6570\n dp = [1] * (n + 1)\n for _ in range(m):\n dp[int(eval(input()))] = 0\n for i in range(2, n + 1):\n if dp[i] == 0:\n continue\n dp[i] = (dp[i - 1] + dp[i - 2]) % MOD\n print((dp[n]))\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-import numpy as np","-","-","- a = [int(eval(input())) for _ in range(m)]","- dp = np.array([1] * (n + 1))","- dp[a] = 0","+ # i\u6bb5\u76ee\u306b\u5230\u9054\u3059\u308b\u307e\u3067\u306e\u30eb\u30fc\u30c8\u306e\u7dcf\u6570","+ dp = [1] * (n + 1)","+ for _ in range(m):","+ dp[int(eval(input()))] = 0","- if dp[i] != 0:","- dp[i] = np.sum(dp[i - 2 : i]) % MOD","+ if dp[i] == 0:","+ continue","+ dp[i] = (dp[i - 1] + dp[i - 2]) % MOD"],"diff_only_import_comment":false,"measured_runtime_v0":1.6744469514,"measured_runtime_v1":0.2573392596,"runtime_lift":6.5067683562,"key":["s757552767","s396543034"]} +{"user_id":"u952708174","problem_id":"p02596","language":"python","submission_id_v0":"s856754977","submission_id_v1":"s552892775","cpu_time_v0":106,"cpu_time_v1":34,"memory_v0":9192,"memory_v1":9148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.92,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef c_repsept():\n\n K = int(eval(input()))\n\n\n\n L = 9 * K \/\/ 7 if K % 7 == 0 else 9 * K\n\n if L % 2 == 0 or L % 5 == 0:\n\n return -1\n\n\n\n remainder = 1\n\n for n in range(1, L + 1):\n\n remainder = (10 * remainder) % L\n\n if remainder == 1:\n\n return n\n\n return -1\n\n\n\nprint((c_repsept()))\n\n# optimized version of the same code:\n","target":"def c_repsept_totient():\n\n def euler_phi(n):\n\n \"\"\"\u6b63\u6574\u6570 n \u306b\u5bfe\u3057\u3066\u3001n \u3068\u4e92\u3044\u306b\u7d20\u306a n \u4ee5\u4e0b\u306e\u6b63\u6574\u6570\u306e\u500b\u6570\"\"\"\n\n ret = n\n\n for i in range(2, int(n**0.5) + 1):\n\n if n % i == 0:\n\n ret = ret \/\/ i * (i - 1)\n\n while n % i == 0:\n\n n \/\/= i\n\n if n > 1:\n\n ret -= ret \/\/ n\n\n return ret\n\n\n\n def divisor_list(n):\n\n \"\"\"n \u306e\u6b63\u306e\u7d04\u6570\u306e\u30ea\u30b9\u30c8\"\"\"\n\n ret = set()\n\n for k in range(1, int(n**0.5) + 1):\n\n if n % k == 0:\n\n ret.update({k, n \/\/ k})\n\n return sorted(ret)\n\n\n\n K = int(eval(input()))\n\n L = 9 * (K \/\/ 7 if K % 7 == 0 else K)\n\n\n\n for d in divisor_list(euler_phi(L)):\n\n if pow(10, d, L) == 1:\n\n return d\n\n return -1\n\n\n\nprint((c_repsept_totient()))","code_v0_loc":15,"code_v1_loc":30,"code_v0_num_chars":319,"code_v1_num_chars":786,"code_v0_no_empty_lines":"def c_repsept():\n K = int(eval(input()))\n L = 9 * K \/\/ 7 if K % 7 == 0 else 9 * K\n if L % 2 == 0 or L % 5 == 0:\n return -1\n remainder = 1\n for n in range(1, L + 1):\n remainder = (10 * remainder) % L\n if remainder == 1:\n return n\n return -1\n\n\nprint((c_repsept()))\n","code_v1_no_empty_lines":"def c_repsept_totient():\n def euler_phi(n):\n \"\"\"\u6b63\u6574\u6570 n \u306b\u5bfe\u3057\u3066\u3001n \u3068\u4e92\u3044\u306b\u7d20\u306a n \u4ee5\u4e0b\u306e\u6b63\u6574\u6570\u306e\u500b\u6570\"\"\"\n ret = n\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n ret = ret \/\/ i * (i - 1)\n while n % i == 0:\n n \/\/= i\n if n > 1:\n ret -= ret \/\/ n\n return ret\n\n def divisor_list(n):\n \"\"\"n \u306e\u6b63\u306e\u7d04\u6570\u306e\u30ea\u30b9\u30c8\"\"\"\n ret = set()\n for k in range(1, int(n**0.5) + 1):\n if n % k == 0:\n ret.update({k, n \/\/ k})\n return sorted(ret)\n\n K = int(eval(input()))\n L = 9 * (K \/\/ 7 if K % 7 == 0 else K)\n for d in divisor_list(euler_phi(L)):\n if pow(10, d, L) == 1:\n return d\n return -1\n\n\nprint((c_repsept_totient()))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-def c_repsept():","+def c_repsept_totient():","+ def euler_phi(n):","+ \"\"\"\u6b63\u6574\u6570 n \u306b\u5bfe\u3057\u3066\u3001n \u3068\u4e92\u3044\u306b\u7d20\u306a n \u4ee5\u4e0b\u306e\u6b63\u6574\u6570\u306e\u500b\u6570\"\"\"","+ ret = n","+ for i in range(2, int(n**0.5) + 1):","+ if n % i == 0:","+ ret = ret \/\/ i * (i - 1)","+ while n % i == 0:","+ n \/\/= i","+ if n > 1:","+ ret -= ret \/\/ n","+ return ret","+","+ def divisor_list(n):","+ \"\"\"n \u306e\u6b63\u306e\u7d04\u6570\u306e\u30ea\u30b9\u30c8\"\"\"","+ ret = set()","+ for k in range(1, int(n**0.5) + 1):","+ if n % k == 0:","+ ret.update({k, n \/\/ k})","+ return sorted(ret)","+","- L = 9 * K \/\/ 7 if K % 7 == 0 else 9 * K","- if L % 2 == 0 or L % 5 == 0:","- return -1","- remainder = 1","- for n in range(1, L + 1):","- remainder = (10 * remainder) % L","- if remainder == 1:","- return n","+ L = 9 * (K \/\/ 7 if K % 7 == 0 else K)","+ for d in divisor_list(euler_phi(L)):","+ if pow(10, d, L) == 1:","+ return d","-print((c_repsept()))","+print((c_repsept_totient()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.338304636,"measured_runtime_v1":0.2146003115,"runtime_lift":1.5764405634,"key":["s856754977","s552892775"]} +{"user_id":"u075012704","problem_id":"p03039","language":"python","submission_id_v0":"s732762289","submission_id_v1":"s994755294","cpu_time_v0":918,"cpu_time_v1":624,"memory_v0":21244,"memory_v1":27024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nH, W, K = list(map(int, input().split()))\n\nMOD = 10 ** 9 + 7\n\n\n\nHd = sum([d * (H - d) * (W ** 2) for d in range(H)])\n\nWd = sum([d * (W - d) * (H ** 2) for d in range(W)])\n\n\n\n\n\n# \u968e\u4e57 & \u9006\u5143\u8a08\u7b97\n\nfactorial = [1]\n\ninverse = [1]\n\nfor i in range(1, H * W + 2):\n\n factorial.append(factorial[-1] * i % MOD)\n\n inverse.append(pow(factorial[-1], MOD - 2, MOD))\n\n\n\n\n\nans = (Hd + Wd) * factorial[H * W - 2] * inverse[K - 2] * inverse[H * W - K] % MOD\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"H, W, K = list(map(int, input().split()))\n\nMOD = 10 ** 9 + 7\n\n\n\nfactorial = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\ninverse = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\ninverse_from = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\n\nfor i in range(2, H * W + 1):\n\n factorial.append((factorial[-1] * i) % MOD)\n\n inverse_from.append((-inverse_from[MOD % i] * (MOD \/\/ i)) % MOD)\n\n inverse.append((inverse[-1] * inverse_from[-1]) % MOD)\n\n\n\n\n\ndef nCr(n, r):\n\n if n < r or r < 0:\n\n return 0\n\n elif r == 0:\n\n return 1\n\n return factorial[n] * inverse[r] * inverse[n - r] % MOD\n\n\n\n\n\nans = 0\n\n# H\u306b\u3064\u3044\u3066\n\nfor d in range(1, H):\n\n ans += d * (H - d) * pow(W, 2, MOD) * nCr(H * W - 2, K - 2) % MOD\n\n ans %= MOD\n\n# W\u306b\u3064\u3044\u3066\n\nfor d in range(1, W):\n\n ans += d * (W - d) * pow(H, 2, MOD) * nCr(H * W - 2, K - 2) % MOD\n\n ans %= MOD\n\n\n\nprint((ans % MOD))\n","code_v0_loc":17,"code_v1_loc":32,"code_v0_num_chars":446,"code_v1_num_chars":796,"code_v0_no_empty_lines":"H, W, K = list(map(int, input().split()))\nMOD = 10**9 + 7\nHd = sum([d * (H - d) * (W**2) for d in range(H)])\nWd = sum([d * (W - d) * (H**2) for d in range(W)])\n# \u968e\u4e57 & \u9006\u5143\u8a08\u7b97\nfactorial = [1]\ninverse = [1]\nfor i in range(1, H * W + 2):\n factorial.append(factorial[-1] * i % MOD)\n inverse.append(pow(factorial[-1], MOD - 2, MOD))\nans = (Hd + Wd) * factorial[H * W - 2] * inverse[K - 2] * inverse[H * W - K] % MOD\nprint(ans)\n","code_v1_no_empty_lines":"H, W, K = list(map(int, input().split()))\nMOD = 10**9 + 7\nfactorial = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\ninverse = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\ninverse_from = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\nfor i in range(2, H * W + 1):\n factorial.append((factorial[-1] * i) % MOD)\n inverse_from.append((-inverse_from[MOD % i] * (MOD \/\/ i)) % MOD)\n inverse.append((inverse[-1] * inverse_from[-1]) % MOD)\n\n\ndef nCr(n, r):\n if n < r or r < 0:\n return 0\n elif r == 0:\n return 1\n return factorial[n] * inverse[r] * inverse[n - r] % MOD\n\n\nans = 0\n# H\u306b\u3064\u3044\u3066\nfor d in range(1, H):\n ans += d * (H - d) * pow(W, 2, MOD) * nCr(H * W - 2, K - 2) % MOD\n ans %= MOD\n# W\u306b\u3064\u3044\u3066\nfor d in range(1, W):\n ans += d * (W - d) * pow(H, 2, MOD) * nCr(H * W - 2, K - 2) % MOD\n ans %= MOD\nprint((ans % MOD))\n","code_same":false,"relative_loc_diff_percent":46.875,"diff":["-Hd = sum([d * (H - d) * (W**2) for d in range(H)])","-Wd = sum([d * (W - d) * (H**2) for d in range(W)])","-# \u968e\u4e57 & \u9006\u5143\u8a08\u7b97","-factorial = [1]","-inverse = [1]","-for i in range(1, H * W + 2):","- factorial.append(factorial[-1] * i % MOD)","- inverse.append(pow(factorial[-1], MOD - 2, MOD))","-ans = (Hd + Wd) * factorial[H * W - 2] * inverse[K - 2] * inverse[H * W - K] % MOD","-print(ans)","+factorial = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb","+inverse = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb","+inverse_from = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb","+for i in range(2, H * W + 1):","+ factorial.append((factorial[-1] * i) % MOD)","+ inverse_from.append((-inverse_from[MOD % i] * (MOD \/\/ i)) % MOD)","+ inverse.append((inverse[-1] * inverse_from[-1]) % MOD)","+","+","+def nCr(n, r):","+ if n < r or r < 0:","+ return 0","+ elif r == 0:","+ return 1","+ return factorial[n] * inverse[r] * inverse[n - r] % MOD","+","+","+ans = 0","+# H\u306b\u3064\u3044\u3066","+for d in range(1, H):","+ ans += d * (H - d) * pow(W, 2, MOD) * nCr(H * W - 2, K - 2) % MOD","+ ans %= MOD","+# W\u306b\u3064\u3044\u3066","+for d in range(1, W):","+ ans += d * (W - d) * pow(H, 2, MOD) * nCr(H * W - 2, K - 2) % MOD","+ ans %= MOD","+print((ans % MOD))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3874847701,"measured_runtime_v1":0.2564818668,"runtime_lift":1.5107686747,"key":["s732762289","s994755294"]} +{"user_id":"u056277698","problem_id":"p03078","language":"python","submission_id_v0":"s581139547","submission_id_v1":"s213757381","cpu_time_v0":104,"cpu_time_v1":36,"memory_v0":8708,"memory_v1":4976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.38,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nabc = []\n\n\n\nfor i, _a in enumerate(a):\n\n for j, _b in enumerate(b):\n\n if (i+1) * (j+1) > k:\n\n break\n\n for l, _c in enumerate(c):\n\n if (i+1) * (j+1) * (l+1) > k:\n\n break\n\n abc.append(_a + _b + _c)\n\n\n\nabc.sort(reverse=True)\n\nfor x in abc[:k]:\n\n print(x)\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\nimport heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\nla, lb, lc = len(a), len(b), len(c)\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nfix = set()\n\n\n\nq = [(-(a[0]+b[0]+c[0]), 0, 0, 0)]\n\n\n\nfor _ in range(k):\n\n abc, i, j, l = heapq.heappop(q)\n\n print((-abc))\n\n\n\n if i+1 < la and (i+1, j, l) not in fix:\n\n heapq.heappush(q, (-(a[i+1]+b[j]+c[l]), i+1, j, l))\n\n fix.add((i+1, j, l))\n\n\n\n if j+1 < lb and (i, j+1, l) not in fix:\n\n heapq.heappush(q, (-(a[i]+b[j+1]+c[l]), i, j+1, l))\n\n fix.add((i, j+1, l))\n\n\n\n if l+1 < lc and (i, j, l+1) not in fix:\n\n heapq.heappush(q, (-(a[i]+b[j]+c[l+1]), i, j, l+1))\n\n fix.add((i, j, l+1))\n","code_v0_loc":24,"code_v1_loc":33,"code_v0_num_chars":566,"code_v1_num_chars":841,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nabc = []\nfor i, _a in enumerate(a):\n for j, _b in enumerate(b):\n if (i + 1) * (j + 1) > k:\n break\n for l, _c in enumerate(c):\n if (i + 1) * (j + 1) * (l + 1) > k:\n break\n abc.append(_a + _b + _c)\nabc.sort(reverse=True)\nfor x in abc[:k]:\n print(x)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport heapq\n\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\nla, lb, lc = len(a), len(b), len(c)\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nfix = set()\nq = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]\nfor _ in range(k):\n abc, i, j, l = heapq.heappop(q)\n print((-abc))\n if i + 1 < la and (i + 1, j, l) not in fix:\n heapq.heappush(q, (-(a[i + 1] + b[j] + c[l]), i + 1, j, l))\n fix.add((i + 1, j, l))\n if j + 1 < lb and (i, j + 1, l) not in fix:\n heapq.heappush(q, (-(a[i] + b[j + 1] + c[l]), i, j + 1, l))\n fix.add((i, j + 1, l))\n if l + 1 < lc and (i, j, l + 1) not in fix:\n heapq.heappush(q, (-(a[i] + b[j] + c[l + 1]), i, j, l + 1))\n fix.add((i, j, l + 1))\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["+import heapq","+","+la, lb, lc = len(a), len(b), len(c)","-abc = []","-for i, _a in enumerate(a):","- for j, _b in enumerate(b):","- if (i + 1) * (j + 1) > k:","- break","- for l, _c in enumerate(c):","- if (i + 1) * (j + 1) * (l + 1) > k:","- break","- abc.append(_a + _b + _c)","-abc.sort(reverse=True)","-for x in abc[:k]:","- print(x)","+fix = set()","+q = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]","+for _ in range(k):","+ abc, i, j, l = heapq.heappop(q)","+ print((-abc))","+ if i + 1 < la and (i + 1, j, l) not in fix:","+ heapq.heappush(q, (-(a[i + 1] + b[j] + c[l]), i + 1, j, l))","+ fix.add((i + 1, j, l))","+ if j + 1 < lb and (i, j + 1, l) not in fix:","+ heapq.heappush(q, (-(a[i] + b[j + 1] + c[l]), i, j + 1, l))","+ fix.add((i, j + 1, l))","+ if l + 1 < lc and (i, j, l + 1) not in fix:","+ heapq.heappush(q, (-(a[i] + b[j] + c[l + 1]), i, j, l + 1))","+ fix.add((i, j, l + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4343315315,"measured_runtime_v1":0.2096420834,"runtime_lift":2.0717764508,"key":["s581139547","s213757381"]} +{"user_id":"u761320129","problem_id":"p03559","language":"python","submission_id_v0":"s241549796","submission_id_v1":"s763191935","cpu_time_v0":368,"cpu_time_v1":263,"memory_v0":23328,"memory_v1":29344,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nans = 0\n\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n\n i = bisect_left(A, b)\n\n j = bisect(C, b)\n\n ans += i * (N-j)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nfrom bisect import bisect_left, bisect\n\nans = 0\n\nfor b in B:\n\n i = bisect_left(A,b)\n\n j = bisect(C,b)\n\n ans += i * (N-j)\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":291,"code_v1_num_chars":289,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort()\nC.sort()\nans = 0\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n i = bisect_left(A, b)\n j = bisect(C, b)\n ans += i * (N - j)\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort()\nC.sort()\nfrom bisect import bisect_left, bisect\n\nans = 0\nfor b in B:\n i = bisect_left(A, b)\n j = bisect(C, b)\n ans += i * (N - j)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+from bisect import bisect_left, bisect","+","-from bisect import bisect, bisect_left","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.2898341594,"measured_runtime_v1":0.1261365476,"runtime_lift":2.2977809758,"key":["s241549796","s763191935"]} +{"user_id":"u984276646","problem_id":"p03674","language":"python","submission_id_v0":"s545310428","submission_id_v1":"s792744532","cpu_time_v0":433,"cpu_time_v1":334,"memory_v0":43480,"memory_v1":43988,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp \/\/= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp \/\/= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k \/\/ l), y - v * (k \/\/ l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n]*invf[i-1]*invf[n-i+1]%mod\n\n if i <= n-1:\n\n S += fact[n-1]*invf[i]*invf[n-1-i]%mod\n\n S %= mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n if i <= n:\n\n S += fact[n-1]*invf[i-1]*invf[n-i]%mod\n\n S %= mod\n\n print(S)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp \/\/= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp \/\/= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k \/\/ l), y - v * (k \/\/ l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n+1]*invf[i]*invf[n-i+1]%mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n print(S)\n","code_v0_loc":75,"code_v1_loc":69,"code_v0_num_chars":1780,"code_v1_num_chars":1635,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nD = {i: [0] for i in range(1, n + 1)}\nfor i in range(n + 1):\n D[a[i]][0] += 1\n D[a[i]].append(i)\npl, pr = 0, 0\nfor i in D:\n if D[i][0] == 2:\n pl = D[i][1]\n pr = D[i][2]\n break\nL = pl\nM = pr - pl - 1\nN = n - pr\nmod = int(1e9) + 7 # <-- input modulo\nmaxf = n + 11 # <-- input factional limitation\n\n\ndef make_fact(n, k):\n tmp = n\n perm = [i for i in range(k)]\n L = [0 for _ in range(k)]\n for i in range(k):\n L[i] = tmp % (i + 1)\n tmp \/\/= i + 1\n LL = [0 for _ in range(k)]\n for i in range(k):\n LL[i] = perm[L[-i - 1]]\n for j in range(L[-i - 1] + 1, k):\n perm[j - 1] = perm[j]\n return LL\n\n\ndef doubling(n, m, modulo=mod):\n y = 1\n base = n\n tmp = m\n while tmp != 0:\n if tmp % 2 == 1:\n y *= base\n if modulo > 0:\n y %= modulo\n base *= base\n if modulo > 0:\n base %= modulo\n tmp \/\/= 2\n return y\n\n\ndef inved(a, modulo=mod):\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n while l != 0:\n x, y, u, v = u, v, x - u * (k \/\/ l), y - v * (k \/\/ l)\n k, l = l, k % l\n return x % modulo\n\n\nfact = [1 for _ in range(maxf + 1)]\ninvf = [1 for _ in range(maxf + 1)]\nfor i in range(maxf):\n fact[i + 1] = (fact[i] * (i + 1)) % mod\ninvf[-1] = inved(fact[-1])\nfor i in range(maxf, 0, -1):\n invf[i - 1] = (invf[i] * i) % mod\nfor i in range(1, n + 2):\n S = fact[n] * invf[i - 1] * invf[n - i + 1] % mod\n if i <= n - 1:\n S += fact[n - 1] * invf[i] * invf[n - 1 - i] % mod\n S %= mod\n if i <= n - M:\n S -= fact[n - 1 - M] * invf[i - 1] * invf[n - M - i] % mod\n S %= mod\n if i <= n:\n S += fact[n - 1] * invf[i - 1] * invf[n - i] % mod\n S %= mod\n print(S)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nD = {i: [0] for i in range(1, n + 1)}\nfor i in range(n + 1):\n D[a[i]][0] += 1\n D[a[i]].append(i)\npl, pr = 0, 0\nfor i in D:\n if D[i][0] == 2:\n pl = D[i][1]\n pr = D[i][2]\n break\nL = pl\nM = pr - pl - 1\nN = n - pr\nmod = int(1e9) + 7 # <-- input modulo\nmaxf = n + 11 # <-- input factional limitation\n\n\ndef make_fact(n, k):\n tmp = n\n perm = [i for i in range(k)]\n L = [0 for _ in range(k)]\n for i in range(k):\n L[i] = tmp % (i + 1)\n tmp \/\/= i + 1\n LL = [0 for _ in range(k)]\n for i in range(k):\n LL[i] = perm[L[-i - 1]]\n for j in range(L[-i - 1] + 1, k):\n perm[j - 1] = perm[j]\n return LL\n\n\ndef doubling(n, m, modulo=mod):\n y = 1\n base = n\n tmp = m\n while tmp != 0:\n if tmp % 2 == 1:\n y *= base\n if modulo > 0:\n y %= modulo\n base *= base\n if modulo > 0:\n base %= modulo\n tmp \/\/= 2\n return y\n\n\ndef inved(a, modulo=mod):\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n while l != 0:\n x, y, u, v = u, v, x - u * (k \/\/ l), y - v * (k \/\/ l)\n k, l = l, k % l\n return x % modulo\n\n\nfact = [1 for _ in range(maxf + 1)]\ninvf = [1 for _ in range(maxf + 1)]\nfor i in range(maxf):\n fact[i + 1] = (fact[i] * (i + 1)) % mod\ninvf[-1] = inved(fact[-1])\nfor i in range(maxf, 0, -1):\n invf[i - 1] = (invf[i] * i) % mod\nfor i in range(1, n + 2):\n S = fact[n + 1] * invf[i] * invf[n - i + 1] % mod\n if i <= n - M:\n S -= fact[n - 1 - M] * invf[i - 1] * invf[n - M - i] % mod\n S %= mod\n print(S)\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["- S = fact[n] * invf[i - 1] * invf[n - i + 1] % mod","- if i <= n - 1:","- S += fact[n - 1] * invf[i] * invf[n - 1 - i] % mod","- S %= mod","+ S = fact[n + 1] * invf[i] * invf[n - i + 1] % mod","- if i <= n:","- S += fact[n - 1] * invf[i - 1] * invf[n - i] % mod","- S %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.3162681131,"measured_runtime_v1":0.0655883436,"runtime_lift":4.8220170785,"key":["s545310428","s792744532"]} +{"user_id":"u671060652","problem_id":"p02952","language":"python","submission_id_v0":"s923935687","submission_id_v1":"s007434774","cpu_time_v0":222,"cpu_time_v1":60,"memory_v0":40940,"memory_v1":61860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.97,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\n\n\n\n\ndef countKeta(num):\n\n count = 1\n\n while num \/ 10 >= 1:\n\n count += 1\n\n num = num \/\/ 10\n\n return count\n\n\n\n\n\ncount = 0\n\n\n\nfor i in range(1, n+1):\n\n if(countKeta(i) % 2 == 1):\n\n count += 1\n\n\n\nprint(count)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\n\n\nif n < 10:\n\n print(n)\n\nelif n < 100:\n\n print((9))\n\nelif n < 1000:\n\n print((n-90))\n\nelif n < 10000:\n\n print((909))\n\nelif n < 100000:\n\n print((n-9090))\n\nelif n < 1000000:\n\n print((90909))","code_v0_loc":18,"code_v1_loc":14,"code_v0_num_chars":255,"code_v1_num_chars":213,"code_v0_no_empty_lines":"n = int(eval(input()))\n\n\ndef countKeta(num):\n count = 1\n while num \/ 10 >= 1:\n count += 1\n num = num \/\/ 10\n return count\n\n\ncount = 0\nfor i in range(1, n + 1):\n if countKeta(i) % 2 == 1:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nif n < 10:\n print(n)\nelif n < 100:\n print((9))\nelif n < 1000:\n print((n - 90))\nelif n < 10000:\n print((909))\nelif n < 100000:\n print((n - 9090))\nelif n < 1000000:\n print((90909))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-","-","-def countKeta(num):","- count = 1","- while num \/ 10 >= 1:","- count += 1","- num = num \/\/ 10","- return count","-","-","-count = 0","-for i in range(1, n + 1):","- if countKeta(i) % 2 == 1:","- count += 1","-print(count)","+if n < 10:","+ print(n)","+elif n < 100:","+ print((9))","+elif n < 1000:","+ print((n - 90))","+elif n < 10000:","+ print((909))","+elif n < 100000:","+ print((n - 9090))","+elif n < 1000000:","+ print((90909))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2693535981,"measured_runtime_v1":0.1929554205,"runtime_lift":1.3959369341,"key":["s923935687","s007434774"]} +{"user_id":"u598016178","problem_id":"p03721","language":"python","submission_id_v0":"s302115761","submission_id_v1":"s017112636","cpu_time_v0":756,"cpu_time_v1":620,"memory_v0":13140,"memory_v1":49880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.99,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn, k = list(map(int, input().split()))\n\nz = np.zeros(10**5 + 1)\n\nfor i in range(n):\n\n a, b = list(map(int, input().split()))\n\n z[a] += b\n\n\n\na = 0\n\nfor i in range(1, 10**5 + 1):\n\n if k <= z[i]:\n\n a = i\n\n break\n\n k -= z[i]\n\n\n\nprint((int(a)))\n\n\n# optimized version of the same code:\n","target":"n, k = list(map(int, input().split()))\n\nd = {}\n\nfor i in range(n):\n\n a, b = list(map(int, input().split()))\n\n d[a] = d[a] + b if a in d else b\n\n \n\na = 0\n\nfor i in range(1, 10**5+1):\n\n if i in d and k <= d[i]:\n\n a = i\n\n break\n\n k -= d[i] if i in d else 0\n\n \n\nprint(a)","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":258,"code_v1_num_chars":264,"code_v0_no_empty_lines":"import numpy as np\n\nn, k = list(map(int, input().split()))\nz = np.zeros(10**5 + 1)\nfor i in range(n):\n a, b = list(map(int, input().split()))\n z[a] += b\na = 0\nfor i in range(1, 10**5 + 1):\n if k <= z[i]:\n a = i\n break\n k -= z[i]\nprint((int(a)))\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nd = {}\nfor i in range(n):\n a, b = list(map(int, input().split()))\n d[a] = d[a] + b if a in d else b\na = 0\nfor i in range(1, 10**5 + 1):\n if i in d and k <= d[i]:\n a = i\n break\n k -= d[i] if i in d else 0\nprint(a)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import numpy as np","-","-z = np.zeros(10**5 + 1)","+d = {}","- z[a] += b","+ d[a] = d[a] + b if a in d else b","- if k <= z[i]:","+ if i in d and k <= d[i]:","- k -= z[i]","-print((int(a)))","+ k -= d[i] if i in d else 0","+print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":2.2745897543,"measured_runtime_v1":0.3532919188,"runtime_lift":6.4382728093,"key":["s302115761","s017112636"]} +{"user_id":"u837286475","problem_id":"p02996","language":"python","submission_id_v0":"s244057022","submission_id_v1":"s796254109","cpu_time_v0":1201,"cpu_time_v1":941,"memory_v0":53532,"memory_v1":53600,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.65,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n\n\n\n\nn = int(eval(input()))\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\nabn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))\n\n# optimized version of the same code:\n","target":"\n\nn = int(eval(input()))\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\n#abn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))","code_v0_loc":25,"code_v1_loc":24,"code_v0_num_chars":345,"code_v1_num_chars":344,"code_v0_no_empty_lines":"n = int(eval(input()))\nabn = [list(map(int, input().split())) for _ in range(n)]\nabn.sort()\nabn.sort(key=lambda x: x[1])\n# print(abn)\nts = 0 # time_stamp\nenable = True\nfor abi in abn:\n a, b = abi\n if not ts + a <= b:\n enable = False\n break\n else:\n ts += a\nprint((\"Yes\" if enable else \"No\"))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nabn = [list(map(int, input().split())) for _ in range(n)]\n# abn.sort()\nabn.sort(key=lambda x: x[1])\n# print(abn)\nts = 0 # time_stamp\nenable = True\nfor abi in abn:\n a, b = abi\n if not ts + a <= b:\n enable = False\n break\n else:\n ts += a\nprint((\"Yes\" if enable else \"No\"))\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["-abn.sort()","+# abn.sort()"],"diff_only_import_comment":false,"measured_runtime_v0":0.205832685,"measured_runtime_v1":0.0061624551,"runtime_lift":33.4010847824,"key":["s244057022","s796254109"]} +{"user_id":"u546285759","problem_id":"p00053","language":"python","submission_id_v0":"s431311473","submission_id_v1":"s975765781","cpu_time_v0":360,"cpu_time_v1":100,"memory_v0":8104,"memory_v1":9480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef isPrime(x):\n\n if x == 2:\n\n return True\n\n if x < 2 or x % 2 == 0:\n\n return False\n\n i, root_x = 3, int(pow(x, 0.5))\n\n while i <= root_x:\n\n if x % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nprimes = [2]\n\nfor i in range(3, 104730):\n\n if isPrime(i):\n\n primes.append(primes[-1]+i)\n\nwhile True:\n\n n = int(eval(input()))\n\n if n == 0:\n\n break\n\n print((primes[n-1]))\n\n# optimized version of the same code:\n","target":"primes = [0, 0] + [1] * 150000\n\nfor i in range(2, 388):\n\n if primes[i]:\n\n for j in range(i*i, 150001, i):\n\n primes[j] = 0\n\n\n\nvalues = [i for i, v in enumerate(primes) if v]\n\nwhile True:\n\n n = int(eval(input()))\n\n if n == 0:\n\n break\n\n print((sum(values[:n])))","code_v0_loc":21,"code_v1_loc":12,"code_v0_num_chars":438,"code_v1_num_chars":287,"code_v0_no_empty_lines":"def isPrime(x):\n if x == 2:\n return True\n if x < 2 or x % 2 == 0:\n return False\n i, root_x = 3, int(pow(x, 0.5))\n while i <= root_x:\n if x % i == 0:\n return False\n i += 2\n return True\n\n\nprimes = [2]\nfor i in range(3, 104730):\n if isPrime(i):\n primes.append(primes[-1] + i)\nwhile True:\n n = int(eval(input()))\n if n == 0:\n break\n print((primes[n - 1]))\n","code_v1_no_empty_lines":"primes = [0, 0] + [1] * 150000\nfor i in range(2, 388):\n if primes[i]:\n for j in range(i * i, 150001, i):\n primes[j] = 0\nvalues = [i for i, v in enumerate(primes) if v]\nwhile True:\n n = int(eval(input()))\n if n == 0:\n break\n print((sum(values[:n])))\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-def isPrime(x):","- if x == 2:","- return True","- if x < 2 or x % 2 == 0:","- return False","- i, root_x = 3, int(pow(x, 0.5))","- while i <= root_x:","- if x % i == 0:","- return False","- i += 2","- return True","-","-","-primes = [2]","-for i in range(3, 104730):","- if isPrime(i):","- primes.append(primes[-1] + i)","+primes = [0, 0] + [1] * 150000","+for i in range(2, 388):","+ if primes[i]:","+ for j in range(i * i, 150001, i):","+ primes[j] = 0","+values = [i for i, v in enumerate(primes) if v]","- print((primes[n - 1]))","+ print((sum(values[:n])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4180367088,"measured_runtime_v1":0.5017841969,"runtime_lift":2.8259891756,"key":["s431311473","s975765781"]} +{"user_id":"u773686010","problem_id":"p03162","language":"python","submission_id_v0":"s443943241","submission_id_v1":"s399855216","cpu_time_v0":1938,"cpu_time_v1":418,"memory_v0":46688,"memory_v1":28484,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_c\n\nimport numpy as np\n\nN = int(eval(input()))\n\nMax_List=[]\n\nN_List=[i for i in range(3)]\n\nfor i in range(N):\n\n Current_List=list(map(int,input().split())) \n\n if i == 0:\n\n Max_List.append(Current_List)\n\n else:\n\n Current_Max_List = []\n\n for j in range(3):\n\n Index_List=np.array(Max_List[i-1])\n\n ind = np.ones(3, dtype=bool)\n\n ind[j] = False\n\n Current_Max_List.append(max(Index_List[ind])+Current_List[j])\n\n \n\n Max_List.append(Current_Max_List)\n\n \n\n \n\nprint((max(Max_List[-1])))\n\n# optimized version of the same code:\n","target":"# https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_c\n\nN = int(eval(input()))\n\nMax_List=[]\n\nN_List=[i for i in range(3)]\n\nfor i in range(N):\n\n Current_List=list(map(int,input().split())) \n\n if i == 0:\n\n Max_List.append(Current_List)\n\n else:\n\n Current_Max_List = []\n\n Search_List=Max_List[i-1]\n\n for j in range(3):\n\n Current_Search_List=Search_List[1:3]\n\n Current_Max_List.append(max(Current_Search_List)+Current_List[j])\n\n Search_List.append(Search_List[0])\n\n del Search_List[0]\n\n Max_List.append(Current_Max_List)\n\n \n\n \n\nprint((max(Max_List[-1])))","code_v0_loc":21,"code_v1_loc":20,"code_v0_num_chars":611,"code_v1_num_chars":628,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_c\nimport numpy as np\n\nN = int(eval(input()))\nMax_List = []\nN_List = [i for i in range(3)]\nfor i in range(N):\n Current_List = list(map(int, input().split()))\n if i == 0:\n Max_List.append(Current_List)\n else:\n Current_Max_List = []\n for j in range(3):\n Index_List = np.array(Max_List[i - 1])\n ind = np.ones(3, dtype=bool)\n ind[j] = False\n Current_Max_List.append(max(Index_List[ind]) + Current_List[j])\n Max_List.append(Current_Max_List)\nprint((max(Max_List[-1])))\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_c\nN = int(eval(input()))\nMax_List = []\nN_List = [i for i in range(3)]\nfor i in range(N):\n Current_List = list(map(int, input().split()))\n if i == 0:\n Max_List.append(Current_List)\n else:\n Current_Max_List = []\n Search_List = Max_List[i - 1]\n for j in range(3):\n Current_Search_List = Search_List[1:3]\n Current_Max_List.append(max(Current_Search_List) + Current_List[j])\n Search_List.append(Search_List[0])\n del Search_List[0]\n Max_List.append(Current_Max_List)\nprint((max(Max_List[-1])))\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["-import numpy as np","-","+ Search_List = Max_List[i - 1]","- Index_List = np.array(Max_List[i - 1])","- ind = np.ones(3, dtype=bool)","- ind[j] = False","- Current_Max_List.append(max(Index_List[ind]) + Current_List[j])","+ Current_Search_List = Search_List[1:3]","+ Current_Max_List.append(max(Current_Search_List) + Current_List[j])","+ Search_List.append(Search_List[0])","+ del Search_List[0]"],"diff_only_import_comment":false,"measured_runtime_v0":1.9151891472,"measured_runtime_v1":0.3473046393,"runtime_lift":5.5144358302,"key":["s443943241","s399855216"]} +{"user_id":"u714300041","problem_id":"p03835","language":"python","submission_id_v0":"s859897716","submission_id_v1":"s908338086","cpu_time_v0":324,"cpu_time_v1":265,"memory_v0":40684,"memory_v1":40684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.21,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if x >= 0 and x <= K:\n\n ans += 1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if 0 <= x <= K:\n\n ans += 1\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":255,"code_v1_num_chars":249,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nK, S = list(map(int, input().split()))\nans = 0\nfor z in range(K + 1):\n for y in range(K + 1):\n x = S - (z + y)\n if x >= 0 and x <= K:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nK, S = list(map(int, input().split()))\nans = 0\nfor z in range(K + 1):\n for y in range(K + 1):\n x = S - (z + y)\n if 0 <= x <= K:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if x >= 0 and x <= K:","+ if 0 <= x <= K:"],"diff_only_import_comment":false,"measured_runtime_v0":0.450106571,"measured_runtime_v1":0.2041984936,"runtime_lift":2.2042599977,"key":["s859897716","s908338086"]} +{"user_id":"u994988729","problem_id":"p02996","language":"python","submission_id_v0":"s348750359","submission_id_v1":"s832149929","cpu_time_v0":885,"cpu_time_v1":774,"memory_v0":30828,"memory_v1":41916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.54,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\ntask=[] \n\nfor _ in range(n):\n\n a,b=list(map(int,input().split()))\n\n task.append((b, -a))\n\n\n\ntask.sort()\n\n\n\ntime=0\n\nflag=True\n\nfor i in task:\n\n time-=i[1]\n\n if time>i[0]:\n\n flag=False\n\n break\n\n\n\nif flag:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n\n\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom collections import defaultdict\n\nfrom operator import itemgetter\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nd = defaultdict(int)\n\nfor _ in range(N):\n\n a, b = list(map(int, input().split()))\n\n d[b] += a\n\ntask = list(d.items())\n\ntask.sort()\n\n\n\nnow = 0\n\nans = \"Yes\"\n\nfor limit, time in task:\n\n now += time\n\n if now > limit:\n\n ans = \"No\"\n\n break\n\n\n\nprint(ans)\n","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":283,"code_v1_num_chars":398,"code_v0_no_empty_lines":"n = int(eval(input()))\ntask = []\nfor _ in range(n):\n a, b = list(map(int, input().split()))\n task.append((b, -a))\ntask.sort()\ntime = 0\nflag = True\nfor i in task:\n time -= i[1]\n if time > i[0]:\n flag = False\n break\nif flag:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"import sys\nfrom collections import defaultdict\nfrom operator import itemgetter\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nd = defaultdict(int)\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n d[b] += a\ntask = list(d.items())\ntask.sort()\nnow = 0\nans = \"Yes\"\nfor limit, time in task:\n now += time\n if now > limit:\n ans = \"No\"\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-n = int(eval(input()))","-task = []","-for _ in range(n):","+import sys","+from collections import defaultdict","+from operator import itemgetter","+","+input = sys.stdin.readline","+N = int(eval(input()))","+d = defaultdict(int)","+for _ in range(N):","- task.append((b, -a))","+ d[b] += a","+task = list(d.items())","-time = 0","-flag = True","-for i in task:","- time -= i[1]","- if time > i[0]:","- flag = False","+now = 0","+ans = \"Yes\"","+for limit, time in task:","+ now += time","+ if now > limit:","+ ans = \"No\"","-if flag:","- print(\"Yes\")","-else:","- print(\"No\")","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3182171457,"measured_runtime_v1":0.1977030051,"runtime_lift":1.6095716175,"key":["s348750359","s832149929"]} +{"user_id":"u883040023","problem_id":"p02767","language":"python","submission_id_v0":"s988075401","submission_id_v1":"s958750940","cpu_time_v0":151,"cpu_time_v1":21,"memory_v0":12504,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.09,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn = int(eval(input()))\n\nx = list(map(int,input().split()))\n\nx2 = np.power(x,2)\n\n\n\np1 = sum(x)\/\/n\n\np2 = -(-sum(x)\/\/n)\n\n\n\nw1 = n*(p1**2) -2*sum(x)*p1 +sum(x2)\n\nw2 = n*(p2**2) -2*sum(x)*p2 +sum(x2)\n\n\n\nprint((min(w1,w2)))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nX = sorted(map(int,input().split()))\n\nans = 10**6\n\n\n\nfor i in range(X[0],X[-1]+1):\n\n HP = 0\n\n \n\n for j in X:\n\n HP += (j - i) ** 2\n\n \n\n ans = min(ans,HP)\n\n \n\nprint(ans)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":231,"code_v1_num_chars":214,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nx = list(map(int, input().split()))\nx2 = np.power(x, 2)\np1 = sum(x) \/\/ n\np2 = -(-sum(x) \/\/ n)\nw1 = n * (p1**2) - 2 * sum(x) * p1 + sum(x2)\nw2 = n * (p2**2) - 2 * sum(x) * p2 + sum(x2)\nprint((min(w1, w2)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nX = sorted(map(int, input().split()))\nans = 10**6\nfor i in range(X[0], X[-1] + 1):\n HP = 0\n for j in X:\n HP += (j - i) ** 2\n ans = min(ans, HP)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","-","-x = list(map(int, input().split()))","-x2 = np.power(x, 2)","-p1 = sum(x) \/\/ n","-p2 = -(-sum(x) \/\/ n)","-w1 = n * (p1**2) - 2 * sum(x) * p1 + sum(x2)","-w2 = n * (p2**2) - 2 * sum(x) * p2 + sum(x2)","-print((min(w1, w2)))","+X = sorted(map(int, input().split()))","+ans = 10**6","+for i in range(X[0], X[-1] + 1):","+ HP = 0","+ for j in X:","+ HP += (j - i) ** 2","+ ans = min(ans, HP)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3939440961,"measured_runtime_v1":0.2004205168,"runtime_lift":6.9550968045,"key":["s988075401","s958750940"]} +{"user_id":"u645250356","problem_id":"p03038","language":"python","submission_id_v0":"s890208193","submission_id_v1":"s797826633","cpu_time_v0":490,"cpu_time_v1":431,"memory_v0":71452,"memory_v1":34916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.04,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter,defaultdict,deque\n\nfrom heapq import heapify,heappop,heappush\n\nfrom bisect import bisect_left,bisect_right\n\nimport sys,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn,m = inpl()\n\na = inpl()\n\nb = [0] * m\n\nfor i in range(m):\n\n x,y = inpl()\n\n b[i] = [x,y]\n\na.sort()\n\nb.sort(key=lambda x:x[1], reverse = True)\n\nres = sum(a)\n\ni = 0\n\nj = 0\n\nwhile True:\n\n # print(i,j)\n\n if a[i] < b[j][1]:\n\n res += b[j][1] - a[i]\n\n i += 1\n\n else:\n\n break\n\n b[j][0] -= 1\n\n if b[j][0] == 0:\n\n j += 1\n\n if i >= n or j >= m:\n\n break\n\nprint(res)\n\n\n# optimized version of the same code:\n","target":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nfrom bisect import bisect_left,bisect_right \n\nimport sys,math,itertools,fractions,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn,m = inpl()\n\na = inpl()\n\na.sort()\n\nbc = [inpl() for _ in range(m)]\n\nbc.sort(key = lambda x:x[1], reverse = True)\n\nlm = sum(x[1] for x in bc)\n\nnow = 0\n\nalt = 0\n\nwhile now < n and alt < m:\n\n c,b = bc[alt]\n\n if a[now] > b:\n\n break\n\n else:\n\n a[now] = b\n\n bc[alt][0] -= 1\n\n if bc[alt][0] == 0:\n\n alt += 1\n\n now += 1\n\nprint((sum(a)))\n","code_v0_loc":35,"code_v1_loc":29,"code_v0_num_chars":880,"code_v1_num_chars":728,"code_v0_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heapify, heappop, heappush\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, string, queue\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef inpl_str():\n return list(sys.stdin.readline().split())\n\n\ndef inpln(n):\n return list(int(sys.stdin.readline()) for i in range(n))\n\n\nn, m = inpl()\na = inpl()\nb = [0] * m\nfor i in range(m):\n x, y = inpl()\n b[i] = [x, y]\na.sort()\nb.sort(key=lambda x: x[1], reverse=True)\nres = sum(a)\ni = 0\nj = 0\nwhile True:\n # print(i,j)\n if a[i] < b[j][1]:\n res += b[j][1] - a[i]\n i += 1\n else:\n break\n b[j][0] -= 1\n if b[j][0] == 0:\n j += 1\n if i >= n or j >= m:\n break\nprint(res)\n","code_v1_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, fractions, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn, m = inpl()\na = inpl()\na.sort()\nbc = [inpl() for _ in range(m)]\nbc.sort(key=lambda x: x[1], reverse=True)\nlm = sum(x[1] for x in bc)\nnow = 0\nalt = 0\nwhile now < n and alt < m:\n c, b = bc[alt]\n if a[now] > b:\n break\n else:\n a[now] = b\n bc[alt][0] -= 1\n if bc[alt][0] == 0:\n alt += 1\n now += 1\nprint((sum(a)))\n","code_same":false,"relative_loc_diff_percent":17.1428571429,"diff":["-from heapq import heapify, heappop, heappush","+from heapq import heappop, heappush, heapify","-import sys, math, itertools, string, queue","+import sys, math, itertools, fractions, pprint","+INF = float(\"inf\")","-def inpl_str():","- return list(sys.stdin.readline().split())","-","-","-def inpln(n):","- return list(int(sys.stdin.readline()) for i in range(n))","-","-","-b = [0] * m","-for i in range(m):","- x, y = inpl()","- b[i] = [x, y]","-b.sort(key=lambda x: x[1], reverse=True)","-res = sum(a)","-i = 0","-j = 0","-while True:","- # print(i,j)","- if a[i] < b[j][1]:","- res += b[j][1] - a[i]","- i += 1","+bc = [inpl() for _ in range(m)]","+bc.sort(key=lambda x: x[1], reverse=True)","+lm = sum(x[1] for x in bc)","+now = 0","+alt = 0","+while now < n and alt < m:","+ c, b = bc[alt]","+ if a[now] > b:","+ break","- break","- b[j][0] -= 1","- if b[j][0] == 0:","- j += 1","- if i >= n or j >= m:","- break","-print(res)","+ a[now] = b","+ bc[alt][0] -= 1","+ if bc[alt][0] == 0:","+ alt += 1","+ now += 1","+print((sum(a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.310756367,"measured_runtime_v1":0.2053928638,"runtime_lift":1.5129852191,"key":["s890208193","s797826633"]} +{"user_id":"u287132915","problem_id":"p02891","language":"python","submission_id_v0":"s480399361","submission_id_v1":"s640908939","cpu_time_v0":182,"cpu_time_v1":72,"memory_v0":38256,"memory_v1":61768,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.44,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = eval(input())\n\nk = int(eval(input()))\n\n\n\nif len(set(s)) == 1:\n\n print(((len(s)*k)\/\/2))\n\n exit()\n\n\n\nss = s + s\n\n\n\nshoko = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(s)):\n\n if s[i] == prev:\n\n cnt += 1\n\n else:\n\n shoko += cnt \/\/ 2\n\n cnt = 1\n\n prev = s[i]\n\nshoko += cnt \/\/ 2\n\n\n\nkosa = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(ss)):\n\n if ss[i] == prev:\n\n cnt += 1\n\n else:\n\n kosa += cnt \/\/ 2\n\n cnt = 1\n\n prev = ss[i]\n\nkosa += cnt \/\/ 2\n\nkosa -= shoko\n\n\n\nprint((shoko + (k-1)*kosa))\n\n# optimized version of the same code:\n","target":"s = eval(input())\n\nk = int(eval(input()))\n\nn = len(s)\n\n\n\nif len(set(s)) == 1:\n\n print((n*k\/\/2))\n\n exit()\n\n\n\nss = s + s\n\ncnts = 0\n\nnow = s[0]\n\ntemp = 1\n\nfor i in range(1, n):\n\n if s[i] == now:\n\n temp += 1\n\n else:\n\n cnts += temp \/\/ 2\n\n temp = 1\n\n now = s[i]\n\ncnts += temp \/\/ 2\n\n\n\ncntss = 0\n\nnow = ss[0]\n\ntemp = 1\n\nfor i in range(1, 2*n):\n\n if ss[i] == now:\n\n temp += 1\n\n else:\n\n cntss += temp \/\/ 2\n\n temp = 1\n\n now = ss[i]\n\ncntss += temp \/\/ 2\n\n\n\nkousa = cntss - cnts\n\nprint((cnts + kousa*(k-1)))","code_v0_loc":35,"code_v1_loc":35,"code_v0_num_chars":527,"code_v1_num_chars":551,"code_v0_no_empty_lines":"s = eval(input())\nk = int(eval(input()))\nif len(set(s)) == 1:\n print(((len(s) * k) \/\/ 2))\n exit()\nss = s + s\nshoko = 0\nprev = \"\"\ncnt = 0\nfor i in range(len(s)):\n if s[i] == prev:\n cnt += 1\n else:\n shoko += cnt \/\/ 2\n cnt = 1\n prev = s[i]\nshoko += cnt \/\/ 2\nkosa = 0\nprev = \"\"\ncnt = 0\nfor i in range(len(ss)):\n if ss[i] == prev:\n cnt += 1\n else:\n kosa += cnt \/\/ 2\n cnt = 1\n prev = ss[i]\nkosa += cnt \/\/ 2\nkosa -= shoko\nprint((shoko + (k - 1) * kosa))\n","code_v1_no_empty_lines":"s = eval(input())\nk = int(eval(input()))\nn = len(s)\nif len(set(s)) == 1:\n print((n * k \/\/ 2))\n exit()\nss = s + s\ncnts = 0\nnow = s[0]\ntemp = 1\nfor i in range(1, n):\n if s[i] == now:\n temp += 1\n else:\n cnts += temp \/\/ 2\n temp = 1\n now = s[i]\ncnts += temp \/\/ 2\ncntss = 0\nnow = ss[0]\ntemp = 1\nfor i in range(1, 2 * n):\n if ss[i] == now:\n temp += 1\n else:\n cntss += temp \/\/ 2\n temp = 1\n now = ss[i]\ncntss += temp \/\/ 2\nkousa = cntss - cnts\nprint((cnts + kousa * (k - 1)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+n = len(s)","- print(((len(s) * k) \/\/ 2))","+ print((n * k \/\/ 2))","-shoko = 0","-prev = \"\"","-cnt = 0","-for i in range(len(s)):","- if s[i] == prev:","- cnt += 1","+cnts = 0","+now = s[0]","+temp = 1","+for i in range(1, n):","+ if s[i] == now:","+ temp += 1","- shoko += cnt \/\/ 2","- cnt = 1","- prev = s[i]","-shoko += cnt \/\/ 2","-kosa = 0","-prev = \"\"","-cnt = 0","-for i in range(len(ss)):","- if ss[i] == prev:","- cnt += 1","+ cnts += temp \/\/ 2","+ temp = 1","+ now = s[i]","+cnts += temp \/\/ 2","+cntss = 0","+now = ss[0]","+temp = 1","+for i in range(1, 2 * n):","+ if ss[i] == now:","+ temp += 1","- kosa += cnt \/\/ 2","- cnt = 1","- prev = ss[i]","-kosa += cnt \/\/ 2","-kosa -= shoko","-print((shoko + (k - 1) * kosa))","+ cntss += temp \/\/ 2","+ temp = 1","+ now = ss[i]","+cntss += temp \/\/ 2","+kousa = cntss - cnts","+print((cnts + kousa * (k - 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2980948234,"measured_runtime_v1":0.2282131991,"runtime_lift":1.3062120179,"key":["s480399361","s640908939"]} +{"user_id":"u367130284","problem_id":"p03081","language":"python","submission_id_v0":"s141729674","submission_id_v1":"s328617225","cpu_time_v0":599,"cpu_time_v1":524,"memory_v0":40892,"memory_v1":40892,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,q=list(map(int,input().split()));s=\"_\"+eval(input())+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:L=h==\"L\";R=h==\"R\";l,r=[l,l-1,l+1][(m==s[l]and R)-(m==s[l+1]and L)],[r,r-1,r+1][(m==s[r-1]and R)-(m==s[r]and L)]\n\nprint((max(0,r-l-1)))\n\n# optimized version of the same code:\n","target":"n,q=list(map(int,input().split()));s=\"_\"+eval(input())+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:\n\n L=h==\"L\";R=h==\"R\";\n\n l+=(m==s[l+1]and L)-(m==s[l]and R)\n\n r+=(m==s[r]and L)-(m==s[r-1]and R)\n\nprint((max(0,r-l-1)))","code_v0_loc":3,"code_v1_loc":6,"code_v0_num_chars":241,"code_v1_num_chars":234,"code_v0_no_empty_lines":"n, q = list(map(int, input().split()))\ns = \"_\" + eval(input()) + \"_\"\nl, r = 0, n + 1\nfor (m, h) in [input().split() for i in range(q)][::-1]:\n L = h == \"L\"\n R = h == \"R\"\n l, r = [l, l - 1, l + 1][(m == s[l] and R) - (m == s[l + 1] and L)], [\n r,\n r - 1,\n r + 1,\n ][(m == s[r - 1] and R) - (m == s[r] and L)]\nprint((max(0, r - l - 1)))\n","code_v1_no_empty_lines":"n, q = list(map(int, input().split()))\ns = \"_\" + eval(input()) + \"_\"\nl, r = 0, n + 1\nfor (m, h) in [input().split() for i in range(q)][::-1]:\n L = h == \"L\"\n R = h == \"R\"\n l += (m == s[l + 1] and L) - (m == s[l] and R)\n r += (m == s[r] and L) - (m == s[r - 1] and R)\nprint((max(0, r - l - 1)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["- l, r = [l, l - 1, l + 1][(m == s[l] and R) - (m == s[l + 1] and L)], [","- r,","- r - 1,","- r + 1,","- ][(m == s[r - 1] and R) - (m == s[r] and L)]","+ l += (m == s[l + 1] and L) - (m == s[l] and R)","+ r += (m == s[r] and L) - (m == s[r - 1] and R)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2496840062,"measured_runtime_v1":0.1505171778,"runtime_lift":1.6588406042,"key":["s141729674","s328617225"]} +{"user_id":"u884982181","problem_id":"p03325","language":"python","submission_id_v0":"s470797111","submission_id_v1":"s347705079","cpu_time_v0":557,"cpu_time_v1":99,"memory_v0":14868,"memory_v1":4148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.23,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\na = list(map(int,input().split()))\n\nans = 0\n\na = np.array(a)\n\nwhile a.size > 0:\n\n a = a[a%2 == 0]\n\n ans += len(a)\n\n a = a\/\/2\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(n):\n\n while a[i]%2 == 0:\n\n a[i] \/\/=2\n\n ans+=1\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":183,"code_v1_num_chars":152,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\na = list(map(int, input().split()))\nans = 0\na = np.array(a)\nwhile a.size > 0:\n a = a[a % 2 == 0]\n ans += len(a)\n a = a \/\/ 2\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nans = 0\nfor i in range(n):\n while a[i] % 2 == 0:\n a[i] \/\/= 2\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import numpy as np","-","-N = int(eval(input()))","+n = int(eval(input()))","-a = np.array(a)","-while a.size > 0:","- a = a[a % 2 == 0]","- ans += len(a)","- a = a \/\/ 2","+for i in range(n):","+ while a[i] % 2 == 0:","+ a[i] \/\/= 2","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":1.4026193674,"measured_runtime_v1":0.2031858566,"runtime_lift":6.9031348485,"key":["s470797111","s347705079"]} +{"user_id":"u377989038","problem_id":"p03013","language":"python","submission_id_v0":"s518499900","submission_id_v1":"s037041247","cpu_time_v0":377,"cpu_time_v1":189,"memory_v0":17016,"memory_v1":7824,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.87,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn, m = list(map(int, input().split()))\n\na = [int(eval(input())) for _ in range(m)] + [0]\n\nmod = 10 ** 9 + 7\n\n\n\ndp = np.zeros(n + 1, dtype=np.int64)\n\ndp[0] = 1\n\nb = a[0]\n\nj = 1\n\nfor i in range(1, n + 1):\n\n if i == b:\n\n b = a[j]\n\n j += 1\n\n else:\n\n tmp = dp[i - 2] + dp[i - 1]\n\n if tmp >= mod:\n\n tmp -= mod\n\n dp[i] = tmp\n\nprint((int(dp[-1])))\n\n# optimized version of the same code:\n","target":"n, m = list(map(int, input().split()))\n\na = [int(eval(input())) for _ in range(m)] + [0]\n\nmod = 10 ** 9 + 7\n\n\n\ndp = [0] * (n + 1)\n\ndp[0] = 1\n\nb = a[0]\n\nj = 1\n\nfor i in range(1, n + 1):\n\n if i == b:\n\n b = a[j]\n\n j += 1\n\n else:\n\n tmp = dp[i - 2] + dp[i - 1]\n\n if tmp >= mod:\n\n tmp -= mod\n\n dp[i] = tmp\n\nprint((int(dp[-1])))","code_v0_loc":20,"code_v1_loc":18,"code_v0_num_chars":399,"code_v1_num_chars":359,"code_v0_no_empty_lines":"import numpy as np\n\nn, m = list(map(int, input().split()))\na = [int(eval(input())) for _ in range(m)] + [0]\nmod = 10**9 + 7\ndp = np.zeros(n + 1, dtype=np.int64)\ndp[0] = 1\nb = a[0]\nj = 1\nfor i in range(1, n + 1):\n if i == b:\n b = a[j]\n j += 1\n else:\n tmp = dp[i - 2] + dp[i - 1]\n if tmp >= mod:\n tmp -= mod\n dp[i] = tmp\nprint((int(dp[-1])))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\na = [int(eval(input())) for _ in range(m)] + [0]\nmod = 10**9 + 7\ndp = [0] * (n + 1)\ndp[0] = 1\nb = a[0]\nj = 1\nfor i in range(1, n + 1):\n if i == b:\n b = a[j]\n j += 1\n else:\n tmp = dp[i - 2] + dp[i - 1]\n if tmp >= mod:\n tmp -= mod\n dp[i] = tmp\nprint((int(dp[-1])))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-import numpy as np","-","-dp = np.zeros(n + 1, dtype=np.int64)","+dp = [0] * (n + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":1.311264878,"measured_runtime_v1":0.2038756571,"runtime_lift":6.4316892793,"key":["s518499900","s037041247"]} +{"user_id":"u093739220","problem_id":"p03013","language":"python","submission_id_v0":"s120232779","submission_id_v1":"s983584428","cpu_time_v0":173,"cpu_time_v1":130,"memory_v0":11884,"memory_v1":13948,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, M = list(map(int, input().split(\" \")))\n\nA = {int(eval(input())) for _ in range(M)}\n\n\n\nmemo = [0] * (N + 1)\n\nmemo[0] = 1\n\nmemo[1] = 0 if 1 in A else 1\n\n\n\nif N == 1:\n\n print((memo[1]))\n\nelse:\n\n for i in range(2, N + 1):\n\n if i in A:\n\n continue\n\n memo[i] = (memo[i - 2] + memo[i - 1]) % 1000000007\n\n\n\n print((memo[N]))\n\n\n# optimized version of the same code:\n","target":"N, M = list(map(int, input().split(\" \")))\n\nA = {int(input()) for _ in range(M)}\n\n\n\nmemo = [0] * (N + 1)\n\nmemo[0] = 1\n\nmemo[1] = 0 if 1 in A else 1\n\n\n\nif N == 1:\n\n print((memo[1]))\n\nelse:\n\n for i in range(2, N + 1):\n\n if i in A:\n\n continue\n\n memo[i] = (memo[i - 2] + memo[i - 1]) % 1000000007\n\n print((memo[N]))\n","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":343,"code_v1_num_chars":343,"code_v0_no_empty_lines":"N, M = list(map(int, input().split(\" \")))\nA = {int(eval(input())) for _ in range(M)}\nmemo = [0] * (N + 1)\nmemo[0] = 1\nmemo[1] = 0 if 1 in A else 1\nif N == 1:\n print((memo[1]))\nelse:\n for i in range(2, N + 1):\n if i in A:\n continue\n memo[i] = (memo[i - 2] + memo[i - 1]) % 1000000007\n print((memo[N]))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split(\" \")))\nA = {int(input()) for _ in range(M)}\nmemo = [0] * (N + 1)\nmemo[0] = 1\nmemo[1] = 0 if 1 in A else 1\nif N == 1:\n print((memo[1]))\nelse:\n for i in range(2, N + 1):\n if i in A:\n continue\n memo[i] = (memo[i - 2] + memo[i - 1]) % 1000000007\n print((memo[N]))\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["-A = {int(eval(input())) for _ in range(M)}","+A = {int(input()) for _ in range(M)}"],"diff_only_import_comment":false,"measured_runtime_v0":0.3921922538,"measured_runtime_v1":0.2727835524,"runtime_lift":1.4377415733,"key":["s120232779","s983584428"]} +{"user_id":"u134019875","problem_id":"p03796","language":"python","submission_id_v0":"s983655328","submission_id_v1":"s754374761","cpu_time_v0":231,"cpu_time_v1":36,"memory_v0":3984,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\nn = int(eval(input()))\n\nprint((math.factorial(n) % (10 ** 9 + 7)))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\np = 1\n\nfor i in range(1, n + 1):\n\n p = p * i % (10 ** 9 + 7)\n\nprint(p)","code_v0_loc":4,"code_v1_loc":5,"code_v0_num_chars":73,"code_v1_num_chars":89,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nprint((math.factorial(n) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\np = 1\nfor i in range(1, n + 1):\n p = p * i % (10**9 + 7)\nprint(p)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import math","-","-print((math.factorial(n) % (10**9 + 7)))","+p = 1","+for i in range(1, n + 1):","+ p = p * i % (10**9 + 7)","+print(p)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1349290106,"measured_runtime_v1":0.0997186968,"runtime_lift":1.3530964092,"key":["s983655328","s754374761"]} +{"user_id":"u852690916","problem_id":"p02883","language":"python","submission_id_v0":"s516001124","submission_id_v1":"s468582154","cpu_time_v0":510,"cpu_time_v1":354,"memory_v0":119500,"memory_v1":120848,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nF = list(map(int, input().split()))\n\n\n\nA.sort()\n\nF.sort(reverse=True)\n\n\n\n#\u7a4d\u3092x\u4ee5\u4e0b\u306b\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u4fee\u884c\u56de\u6570\n\ndef f(x):\n\n r = 0\n\n for i in range(N):\n\n a, f = A[i], F[i]\n\n m = a * f\n\n if m > x:\n\n r += (m - x + f - 1) \/\/ f\n\n return r\n\n\n\nunder = -1\n\nr = 10**18\n\nwhile r - under > 1:\n\n m = (under + r) \/\/ 2\n\n if f(m) > K: under = m\n\n else: r = m\n\nprint(r)\n\n# optimized version of the same code:\n","target":"# \u3067\u3064oO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)\n\nimport sys\n\ndef main(N, K, A, F):\n\n A.sort()\n\n F.sort(reverse=True)\n\n\n\n def f(x):\n\n sy = 0\n\n for a, f in zip(A, F):\n\n m = a * f\n\n if m > x:\n\n sy += (m - x + f - 1) \/\/ f\n\n return sy\n\n\n\n under = -1\n\n hi = 10**12 + 1\n\n while hi - under > 1:\n\n m = (hi + under) \/\/ 2\n\n if f(m) <= K: hi = m\n\n else: under = m\n\n print(hi)\n\n\n\nif __name__ == '__main__':\n\n input = sys.stdin.readline\n\n N, K = list(map(int, input().split()))\n\n *A, = list(map(int, input().split()))\n\n *F, = list(map(int, input().split()))\n\n main(N, K, A, F)\n","code_v0_loc":24,"code_v1_loc":28,"code_v0_num_chars":456,"code_v1_num_chars":659,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nF = list(map(int, input().split()))\nA.sort()\nF.sort(reverse=True)\n# \u7a4d\u3092x\u4ee5\u4e0b\u306b\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u4fee\u884c\u56de\u6570\ndef f(x):\n r = 0\n for i in range(N):\n a, f = A[i], F[i]\n m = a * f\n if m > x:\n r += (m - x + f - 1) \/\/ f\n return r\n\n\nunder = -1\nr = 10**18\nwhile r - under > 1:\n m = (under + r) \/\/ 2\n if f(m) > K:\n under = m\n else:\n r = m\nprint(r)\n","code_v1_no_empty_lines":"# \u3067\u3064oO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)\nimport sys\n\n\ndef main(N, K, A, F):\n A.sort()\n F.sort(reverse=True)\n\n def f(x):\n sy = 0\n for a, f in zip(A, F):\n m = a * f\n if m > x:\n sy += (m - x + f - 1) \/\/ f\n return sy\n\n under = -1\n hi = 10**12 + 1\n while hi - under > 1:\n m = (hi + under) \/\/ 2\n if f(m) <= K:\n hi = m\n else:\n under = m\n print(hi)\n\n\nif __name__ == \"__main__\":\n input = sys.stdin.readline\n N, K = list(map(int, input().split()))\n (*A,) = list(map(int, input().split()))\n (*F,) = list(map(int, input().split()))\n main(N, K, A, F)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-N, K = list(map(int, input().split()))","-A = list(map(int, input().split()))","-F = list(map(int, input().split()))","-A.sort()","-F.sort(reverse=True)","-# \u7a4d\u3092x\u4ee5\u4e0b\u306b\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u4fee\u884c\u56de\u6570","-def f(x):","- r = 0","- for i in range(N):","- a, f = A[i], F[i]","- m = a * f","- if m > x:","- r += (m - x + f - 1) \/\/ f","- return r","+# \u3067\u3064oO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)","+import sys","-under = -1","-r = 10**18","-while r - under > 1:","- m = (under + r) \/\/ 2","- if f(m) > K:","- under = m","- else:","- r = m","-print(r)","+def main(N, K, A, F):","+ A.sort()","+ F.sort(reverse=True)","+","+ def f(x):","+ sy = 0","+ for a, f in zip(A, F):","+ m = a * f","+ if m > x:","+ sy += (m - x + f - 1) \/\/ f","+ return sy","+","+ under = -1","+ hi = 10**12 + 1","+ while hi - under > 1:","+ m = (hi + under) \/\/ 2","+ if f(m) <= K:","+ hi = m","+ else:","+ under = m","+ print(hi)","+","+","+if __name__ == \"__main__\":","+ input = sys.stdin.readline","+ N, K = list(map(int, input().split()))","+ (*A,) = list(map(int, input().split()))","+ (*F,) = list(map(int, input().split()))","+ main(N, K, A, F)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3640662682,"measured_runtime_v1":0.2871974897,"runtime_lift":1.2676512894,"key":["s516001124","s468582154"]} +{"user_id":"u597374218","problem_id":"p03035","language":"python","submission_id_v0":"s085289040","submission_id_v1":"s328762084","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b=list(map(int,input().split()))\n\nprint((b if 13<=a else b\/\/2 if 6<=a else 0))\n\n# optimized version of the same code:\n","target":"a,b=list(map(int,input().split()))\n\nprint((b if 12k:\n\n continue\n\n for t in range(z):\n\n if i*j*t>k:\n\n continue\n\n abc.append(a[i]+b[j]+c[t])\n\n abc.sort(reverse=1)\n\n for i in range(k):\n\n print((abc[i]))\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":36,"code_v1_loc":45,"code_v0_num_chars":954,"code_v1_num_chars":1172,"code_v0_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.readline\n sys.setrecursionlimit(10**7)\n from collections import Counter, deque\n\n # from collections import defaultdict\n from itertools import combinations, permutations, accumulate, groupby\n\n # from itertools import product\n from bisect import bisect_left, bisect_right\n import heapq\n from math import floor, ceil\n\n # from operator import itemgetter\n # inf = 10**17\n # mod = 10**9 + 7\n x, y, z, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n ab = []\n for i in a:\n for j in b:\n ab.append(i + j)\n ab.sort(reverse=1)\n ab = ab[:k]\n abc = []\n for i in ab:\n for j in c:\n abc.append(i + j)\n abc.sort(reverse=1)\n for i in range(k):\n print((abc[i]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# xyz\u306e\u5168\u901a\u308a\u8abf\u3079\u308b\u3068\u9593\u306b\u5408\u308f\u306a\u3044\n# \u307e\u305a\u554f\u984c\u3092\u5206\u3051\u3088\u3046\n# \u5148\u306bxy\u3060\u3051\u8003\u3048\u3066\u307f\u308b\n# xy\u306e\u548c\u3092\u3068\u3063\u3066\u304b\u3089\u305d\u308c\u3068z\u306e\u548c\u3092\u3068\u308b\u3068\u304d\n# xy\u306e\u548c\u306b\u304a\u3044\u3066k\u756a\u76ee\u4ee5\u964d\u306e\u5024\u3092\u4f7f\u3046\u3053\u3068\u306f\u7121\u3044\n#\ndef main():\n import sys\n\n input = sys.stdin.readline\n sys.setrecursionlimit(10**7)\n from collections import Counter, deque\n\n # from collections import defaultdict\n from itertools import combinations, permutations, accumulate, groupby\n\n # from itertools import product\n from bisect import bisect_left, bisect_right\n import heapq\n from math import floor, ceil\n\n # from operator import itemgetter\n # inf = 10**17\n # mod = 10**9 + 7\n x, y, z, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n a.sort(reverse=1)\n b.sort(reverse=1)\n c.sort(reverse=1)\n abc = []\n for i in range(x):\n for j in range(y):\n if i * j > k:\n continue\n for t in range(z):\n if i * j * t > k:\n continue\n abc.append(a[i] + b[j] + c[t])\n abc.sort(reverse=1)\n for i in range(k):\n print((abc[i]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["+# xyz\u306e\u5168\u901a\u308a\u8abf\u3079\u308b\u3068\u9593\u306b\u5408\u308f\u306a\u3044","+# \u307e\u305a\u554f\u984c\u3092\u5206\u3051\u3088\u3046","+# \u5148\u306bxy\u3060\u3051\u8003\u3048\u3066\u307f\u308b","+# xy\u306e\u548c\u3092\u3068\u3063\u3066\u304b\u3089\u305d\u308c\u3068z\u306e\u548c\u3092\u3068\u308b\u3068\u304d","+# xy\u306e\u548c\u306b\u304a\u3044\u3066k\u756a\u76ee\u4ee5\u964d\u306e\u5024\u3092\u4f7f\u3046\u3053\u3068\u306f\u7121\u3044","+#","- ab = []","- for i in a:","- for j in b:","- ab.append(i + j)","- ab.sort(reverse=1)","- ab = ab[:k]","+ a.sort(reverse=1)","+ b.sort(reverse=1)","+ c.sort(reverse=1)","- for i in ab:","- for j in c:","- abc.append(i + j)","+ for i in range(x):","+ for j in range(y):","+ if i * j > k:","+ continue","+ for t in range(z):","+ if i * j * t > k:","+ continue","+ abc.append(a[i] + b[j] + c[t])"],"diff_only_import_comment":false,"measured_runtime_v0":0.5108549283,"measured_runtime_v1":0.1529760139,"runtime_lift":3.3394446306,"key":["s321808897","s575596303"]} +{"user_id":"u150984829","problem_id":"p02414","language":"python","submission_id_v0":"s058277941","submission_id_v1":"s168687059","cpu_time_v0":180,"cpu_time_v1":130,"memory_v0":6264,"memory_v1":6796,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.78,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ne=[list(map(int,e.split()))for e in sys.stdin]\n\nn=e[0][0]+1\n\nfor c in e[1:n]:\n\n t=''\n\n for l in zip(*e[n:]):t+=f'{sum(s*t for s,t in zip(c,l))} '\n\n print((t[:-1]))\n\n\n# optimized version of the same code:\n","target":"import sys\n\ne=[list(map(int,e.split()))for e in sys.stdin]\n\nn=e[0][0]+1\n\nt=''\n\nfor c in e[1:n]:\n\n for l in zip(*e[n:]):t+=f'{sum(s*t for s,t in zip(c,l))} '\n\n t=t[:-1]+'\\n'\n\nprint((t[:-1]))\n","code_v0_loc":7,"code_v1_loc":8,"code_v0_num_chars":174,"code_v1_num_chars":188,"code_v0_no_empty_lines":"import sys\n\ne = [list(map(int, e.split())) for e in sys.stdin]\nn = e[0][0] + 1\nfor c in e[1:n]:\n t = \"\"\n for l in zip(*e[n:]):\n t += f\"{sum(s*t for s,t in zip(c,l))} \"\n print((t[:-1]))\n","code_v1_no_empty_lines":"import sys\n\ne = [list(map(int, e.split())) for e in sys.stdin]\nn = e[0][0] + 1\nt = \"\"\nfor c in e[1:n]:\n for l in zip(*e[n:]):\n t += f\"{sum(s*t for s,t in zip(c,l))} \"\n t = t[:-1] + \"\\n\"\nprint((t[:-1]))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["+t = \"\"","- t = \"\"","- print((t[:-1]))","+ t = t[:-1] + \"\\n\"","+print((t[:-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2549450145,"measured_runtime_v1":0.0065752838,"runtime_lift":38.7732336991,"key":["s058277941","s168687059"]} +{"user_id":"u057109575","problem_id":"p02814","language":"python","submission_id_v0":"s505874222","submission_id_v1":"s539286615","cpu_time_v0":444,"cpu_time_v1":182,"memory_v0":96824,"memory_v1":96876,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.01,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom functools import reduce\n\nfrom fractions import gcd\n\n\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\n\ndef lcm(x, y):\n\n return x * y \/\/ gcd(x, y)\n\n\n\ndef sub_by_2(n):\n\n cnt = 0\n\n while n % 2 == 0:\n\n n \/\/= 2\n\n cnt += 1\n\n return cnt\n\n\n\nlcm_2 = [sub_by_2(n \/\/ 2) for n in A]\n\nif all(lcm_2[0] == v for v in lcm_2):\n\n num = reduce(lcm, [v \/\/ 2 for v in A])\n\n res = M \/\/ num\n\n print((res \/\/ 2 + res % 2))\n\nelse:\n\n print((0))\n\n\n# optimized version of the same code:\n","target":"from math import gcd\n\nfrom functools import reduce\n\n\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\n\ndef lcm(x, y):\n\n return x * y \/\/ gcd(x, y)\n\n\n\ndef lcm_list(numbers):\n\n return reduce(lcm, numbers, 1)\n\n\n\ndef even_count(n):\n\n res = 0\n\n while n % 2 == 0:\n\n res += 1\n\n n \/\/= 2\n\n return res\n\n\n\n\n\nx = [v \/\/ 2 for v in A]\n\nif all(even_count(v) == even_count(x[0]) for v in x):\n\n num = lcm_list(x)\n\n print((-(-(M \/\/ num) \/\/ 2)))\n\nelse:\n\n print((0))\n\n\n","code_v0_loc":22,"code_v1_loc":26,"code_v0_num_chars":455,"code_v1_num_chars":480,"code_v0_no_empty_lines":"from functools import reduce\nfrom fractions import gcd\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\ndef lcm(x, y):\n return x * y \/\/ gcd(x, y)\n\n\ndef sub_by_2(n):\n cnt = 0\n while n % 2 == 0:\n n \/\/= 2\n cnt += 1\n return cnt\n\n\nlcm_2 = [sub_by_2(n \/\/ 2) for n in A]\nif all(lcm_2[0] == v for v in lcm_2):\n num = reduce(lcm, [v \/\/ 2 for v in A])\n res = M \/\/ num\n print((res \/\/ 2 + res % 2))\nelse:\n print((0))\n","code_v1_no_empty_lines":"from math import gcd\nfrom functools import reduce\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\ndef lcm(x, y):\n return x * y \/\/ gcd(x, y)\n\n\ndef lcm_list(numbers):\n return reduce(lcm, numbers, 1)\n\n\ndef even_count(n):\n res = 0\n while n % 2 == 0:\n res += 1\n n \/\/= 2\n return res\n\n\nx = [v \/\/ 2 for v in A]\nif all(even_count(v) == even_count(x[0]) for v in x):\n num = lcm_list(x)\n print((-(-(M \/\/ num) \/\/ 2)))\nelse:\n print((0))\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["+from math import gcd","-from fractions import gcd","-def sub_by_2(n):","- cnt = 0","- while n % 2 == 0:","- n \/\/= 2","- cnt += 1","- return cnt","+def lcm_list(numbers):","+ return reduce(lcm, numbers, 1)","-lcm_2 = [sub_by_2(n \/\/ 2) for n in A]","-if all(lcm_2[0] == v for v in lcm_2):","- num = reduce(lcm, [v \/\/ 2 for v in A])","- res = M \/\/ num","- print((res \/\/ 2 + res % 2))","+def even_count(n):","+ res = 0","+ while n % 2 == 0:","+ res += 1","+ n \/\/= 2","+ return res","+","+","+x = [v \/\/ 2 for v in A]","+if all(even_count(v) == even_count(x[0]) for v in x):","+ num = lcm_list(x)","+ print((-(-(M \/\/ num) \/\/ 2)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4227621694,"measured_runtime_v1":0.2989870732,"runtime_lift":1.4139814302,"key":["s505874222","s539286615"]} +{"user_id":"u576917603","problem_id":"p02886","language":"python","submission_id_v0":"s933480835","submission_id_v1":"s488301795","cpu_time_v0":163,"cpu_time_v1":18,"memory_v0":12424,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.96,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\na=list(map(int,input().split()))\n\nimport itertools as it\n\nimport numpy as np\n\nal=list(it.combinations(a,2))\n\ntotal=0\n\nfor i in al:\n\n total+=np.prod(i)\n\nprint(total)\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\nans=0\n\nfor i in range(n-1):\n\n for j in range(i+1,n):\n\n ans+=a[i]*a[j]\n\nprint(ans)","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":183,"code_v1_num_chars":141,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nimport itertools as it\nimport numpy as np\n\nal = list(it.combinations(a, 2))\ntotal = 0\nfor i in al:\n total += np.prod(i)\nprint(total)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nans = 0\nfor i in range(n - 1):\n for j in range(i + 1, n):\n ans += a[i] * a[j]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-import itertools as it","-import numpy as np","-","-al = list(it.combinations(a, 2))","-total = 0","-for i in al:","- total += np.prod(i)","-print(total)","+ans = 0","+for i in range(n - 1):","+ for j in range(i + 1, n):","+ ans += a[i] * a[j]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.6349947588,"measured_runtime_v1":0.2197330449,"runtime_lift":7.4408232914,"key":["s933480835","s488301795"]} +{"user_id":"u453634104","problem_id":"p02552","language":"python","submission_id_v0":"s410377980","submission_id_v1":"s110616608","cpu_time_v0":126,"cpu_time_v1":24,"memory_v0":61640,"memory_v1":9128,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\nif x == 0:\n\n print((1))\n\nelse:\n\n print((0))\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\nprint((x^1))\n","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":59,"code_v1_num_chars":29,"code_v0_no_empty_lines":"x = int(eval(input()))\nif x == 0:\n print((1))\nelse:\n print((0))\n","code_v1_no_empty_lines":"x = int(eval(input()))\nprint((x ^ 1))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-if x == 0:","- print((1))","-else:","- print((0))","+print((x ^ 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3271924098,"measured_runtime_v1":0.2133970539,"runtime_lift":1.5332564526,"key":["s410377980","s110616608"]} +{"user_id":"u102461423","problem_id":"p03325","language":"python","submission_id_v0":"s031225874","submission_id_v1":"s421873683","cpu_time_v0":349,"cpu_time_v1":154,"memory_v0":22780,"memory_v1":12668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.87,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nA = np.array(input().split(),dtype=np.int32)\n\n\n\ndef ord(n):\n\n cnt = 0\n\n while not n&1:\n\n n >>= 1\n\n cnt += 1\n\n return cnt\n\n\n\nnp_ord = np.frompyfunc(ord,1,1)\n\nanswer = np_ord(A).sum()\n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nimport numpy as np\n\n\n\nN = int(readline())\n\nA = np.array(read().split(),np.int32)\n\n\n\nanswer = 0\n\nfor _ in range(32):\n\n A = A[A%2 == 0]\n\n answer += len(A)\n\n A >>= 1\n\n\n\nprint(answer)","code_v0_loc":15,"code_v1_loc":17,"code_v0_num_chars":245,"code_v1_num_chars":310,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = np.array(input().split(), dtype=np.int32)\n\n\ndef ord(n):\n cnt = 0\n while not n & 1:\n n >>= 1\n cnt += 1\n return cnt\n\n\nnp_ord = np.frompyfunc(ord, 1, 1)\nanswer = np_ord(A).sum()\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport numpy as np\n\nN = int(readline())\nA = np.array(read().split(), np.int32)\nanswer = 0\nfor _ in range(32):\n A = A[A % 2 == 0]\n answer += len(A)\n A >>= 1\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":11.7647058824,"diff":["+import sys","+","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","-N = int(eval(input()))","-A = np.array(input().split(), dtype=np.int32)","-","-","-def ord(n):","- cnt = 0","- while not n & 1:","- n >>= 1","- cnt += 1","- return cnt","-","-","-np_ord = np.frompyfunc(ord, 1, 1)","-answer = np_ord(A).sum()","+N = int(readline())","+A = np.array(read().split(), np.int32)","+answer = 0","+for _ in range(32):","+ A = A[A % 2 == 0]","+ answer += len(A)","+ A >>= 1"],"diff_only_import_comment":false,"measured_runtime_v0":2.014342514,"measured_runtime_v1":0.210192055,"runtime_lift":9.5833427865,"key":["s031225874","s421873683"]} +{"user_id":"u043236471","problem_id":"p02994","language":"python","submission_id_v0":"s517208919","submission_id_v1":"s465254734","cpu_time_v0":149,"cpu_time_v1":17,"memory_v0":12492,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn,l = [int(x) for x in input().split()] \n\nx = np.arange(l,l+n)\n\ny = np.abs(x)\n\nx = np.delete(x, np.argmin(y))\n\nprint((np.sum(x)))\n\n# optimized version of the same code:\n","target":"N, L = list(map(int, input().split()))\n\napples = [i for i in range(L, L+N)]\n\napples_abs = [abs(i) for i in apples]\n\nmin_idx = apples_abs.index(min(apples_abs))\n\n\n\nprint((sum(apples) - apples[min_idx]))","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":149,"code_v1_num_chars":193,"code_v0_no_empty_lines":"import numpy as np\n\nn, l = [int(x) for x in input().split()]\nx = np.arange(l, l + n)\ny = np.abs(x)\nx = np.delete(x, np.argmin(y))\nprint((np.sum(x)))\n","code_v1_no_empty_lines":"N, L = list(map(int, input().split()))\napples = [i for i in range(L, L + N)]\napples_abs = [abs(i) for i in apples]\nmin_idx = apples_abs.index(min(apples_abs))\nprint((sum(apples) - apples[min_idx]))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-import numpy as np","-","-n, l = [int(x) for x in input().split()]","-x = np.arange(l, l + n)","-y = np.abs(x)","-x = np.delete(x, np.argmin(y))","-print((np.sum(x)))","+N, L = list(map(int, input().split()))","+apples = [i for i in range(L, L + N)]","+apples_abs = [abs(i) for i in apples]","+min_idx = apples_abs.index(min(apples_abs))","+print((sum(apples) - apples[min_idx]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.748840265,"measured_runtime_v1":0.2910926256,"runtime_lift":6.0078480561,"key":["s517208919","s465254734"]} +{"user_id":"u079022693","problem_id":"p02792","language":"python","submission_id_v0":"s064765551","submission_id_v1":"s282052850","cpu_time_v0":289,"cpu_time_v1":146,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN=int(eval(input()))\n\nC=[[0]*9 for i in range(9)]\n\ncount=0\n\n\n\nfor n in range(1,N+1):\n\n if str(n)[-1]!=\"0\":\n\n left=int(str(n)[0])-1\n\n right=int(str(n)[-1])-1\n\n C[left][right]+=1\n\n \n\nfor i in range(1,10):\n\n for j in range(1,10):\n\n count+=C[i-1][j-1]*C[j-1][i-1]\n\n\n\nprint(count)\n\n# optimized version of the same code:\n","target":"from sys import stdin\n\ndef main():\n\n #\u5165\u529b\n\n readline=stdin.readline\n\n N=int(readline())\n\n d=dict()\n\n for i in range(1,N+1):\n\n i=str(i)\n\n head=i[0]\n\n tail=i[-1]\n\n if tail==\"0\":\n\n continue\n\n if (head,tail) not in d:\n\n d[(head,tail)]=1\n\n else:\n\n d[(head,tail)]+=1\n\n\n\n ans=0\n\n s=set()\n\n for k in list(d.keys()):\n\n m,l=k[0],k[1]\n\n if (m,l) in s:\n\n continue\n\n if (l,m) in d:\n\n ans+=d[(m,l)]*d[(l,m)]\n\n if (m,l)!=(l,m):\n\n ans+=d[(m,l)]*d[(l,m)]\n\n s.add((m,l))\n\n s.add((l,m))\n\n\n\n print(ans)\n\n\n\nif __name__==\"__main__\":\n\n main()","code_v0_loc":15,"code_v1_loc":34,"code_v0_num_chars":299,"code_v1_num_chars":700,"code_v0_no_empty_lines":"N = int(eval(input()))\nC = [[0] * 9 for i in range(9)]\ncount = 0\nfor n in range(1, N + 1):\n if str(n)[-1] != \"0\":\n left = int(str(n)[0]) - 1\n right = int(str(n)[-1]) - 1\n C[left][right] += 1\nfor i in range(1, 10):\n for j in range(1, 10):\n count += C[i - 1][j - 1] * C[j - 1][i - 1]\nprint(count)\n","code_v1_no_empty_lines":"from sys import stdin\n\n\ndef main():\n # \u5165\u529b\n readline = stdin.readline\n N = int(readline())\n d = dict()\n for i in range(1, N + 1):\n i = str(i)\n head = i[0]\n tail = i[-1]\n if tail == \"0\":\n continue\n if (head, tail) not in d:\n d[(head, tail)] = 1\n else:\n d[(head, tail)] += 1\n ans = 0\n s = set()\n for k in list(d.keys()):\n m, l = k[0], k[1]\n if (m, l) in s:\n continue\n if (l, m) in d:\n ans += d[(m, l)] * d[(l, m)]\n if (m, l) != (l, m):\n ans += d[(m, l)] * d[(l, m)]\n s.add((m, l))\n s.add((l, m))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":55.8823529412,"diff":["-N = int(eval(input()))","-C = [[0] * 9 for i in range(9)]","-count = 0","-for n in range(1, N + 1):","- if str(n)[-1] != \"0\":","- left = int(str(n)[0]) - 1","- right = int(str(n)[-1]) - 1","- C[left][right] += 1","-for i in range(1, 10):","- for j in range(1, 10):","- count += C[i - 1][j - 1] * C[j - 1][i - 1]","-print(count)","+from sys import stdin","+","+","+def main():","+ # \u5165\u529b","+ readline = stdin.readline","+ N = int(readline())","+ d = dict()","+ for i in range(1, N + 1):","+ i = str(i)","+ head = i[0]","+ tail = i[-1]","+ if tail == \"0\":","+ continue","+ if (head, tail) not in d:","+ d[(head, tail)] = 1","+ else:","+ d[(head, tail)] += 1","+ ans = 0","+ s = set()","+ for k in list(d.keys()):","+ m, l = k[0], k[1]","+ if (m, l) in s:","+ continue","+ if (l, m) in d:","+ ans += d[(m, l)] * d[(l, m)]","+ if (m, l) != (l, m):","+ ans += d[(m, l)] * d[(l, m)]","+ s.add((m, l))","+ s.add((l, m))","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3649349464,"measured_runtime_v1":0.2790334361,"runtime_lift":1.3078538236,"key":["s064765551","s282052850"]} +{"user_id":"u867069435","problem_id":"p03696","language":"python","submission_id_v0":"s841488788","submission_id_v1":"s312350323","cpu_time_v0":295,"cpu_time_v1":17,"memory_v0":20656,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.24,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn = int(eval(input()))\n\ns = list(eval(input()))\n\nj = []\n\nnow = 0\n\nunclosen = 0\n\nopened = 0\n\nfor i in s:\n\n if i == \")\":\n\n now -= 1\n\n if opened:\n\n opened -= 1\n\n else:\n\n unclosen += 1\n\n else:\n\n now += 1\n\n opened += 1\n\nj = np.array(j)\n\nprint((\"(\" * unclosen + \"\".join(s) + \")\" * opened))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\ns = list(eval(input()))\n\nnow = 0\n\nunclosen = 0\n\nopened = 0\n\nfor i in s:\n\n if i == \")\":\n\n now -= 1\n\n if opened:\n\n opened -= 1\n\n else:\n\n unclosen += 1\n\n else:\n\n now += 1\n\n opened += 1\n\nprint((\"(\" * unclosen + \"\".join(s) + \")\" * opened))","code_v0_loc":19,"code_v1_loc":16,"code_v0_num_chars":352,"code_v1_num_chars":307,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\ns = list(eval(input()))\nj = []\nnow = 0\nunclosen = 0\nopened = 0\nfor i in s:\n if i == \")\":\n now -= 1\n if opened:\n opened -= 1\n else:\n unclosen += 1\n else:\n now += 1\n opened += 1\nj = np.array(j)\nprint((\"(\" * unclosen + \"\".join(s) + \")\" * opened))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = list(eval(input()))\nnow = 0\nunclosen = 0\nopened = 0\nfor i in s:\n if i == \")\":\n now -= 1\n if opened:\n opened -= 1\n else:\n unclosen += 1\n else:\n now += 1\n opened += 1\nprint((\"(\" * unclosen + \"\".join(s) + \")\" * opened))\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-import numpy as np","-","-j = []","-j = np.array(j)"],"diff_only_import_comment":false,"measured_runtime_v0":1.891548876,"measured_runtime_v1":0.2480743408,"runtime_lift":7.6249275508,"key":["s841488788","s312350323"]} +{"user_id":"u860002137","problem_id":"p03254","language":"python","submission_id_v0":"s707896844","submission_id_v1":"s627798423","cpu_time_v0":154,"cpu_time_v1":29,"memory_v0":12392,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN, x = list(map(int, input().split()))\n\na = np.array(list(map(int, input().split())))\n\n\n\ncs = np.sort(a).cumsum()\n\n\n\nif cs[-1]=b[i]):\n\n cnt+=b[i]\n\n else:\n\n cnt+=a[i]\n\n d=b[i]-a[i]\n\n cnt+=min(a[i+1],d)\n\n if(d>a[i+1]):\n\n a[i+1]=0\n\n else: a[i+1]-=d\n\n \n\n stdout.write(str(cnt)+\"\\n\")\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\na1 = sum(A)\n\nfor i in range(n):\n\n b = B[i]\n\n if A[i] >= b:A[i] -= b\n\n else:\n\n if A[i+1]+A[i] >= b:\n\n A[i+1] = A[i+1]+A[i]-b\n\n A[i] = 0\n\n else:A[i], A[i+1] = 0, 0\n\na2 = sum(A)\n\nprint((a1-a2))","code_v0_loc":22,"code_v1_loc":14,"code_v0_num_chars":499,"code_v1_num_chars":299,"code_v0_no_empty_lines":"from sys import stdin, stdout\n\nif __name__ == \"__main__\":\n n = int(stdin.readline())\n a = [int(x) for x in stdin.readline().split()]\n b = [int(x) for x in stdin.readline().split()]\n cnt = 0\n for i in range(n):\n if a[i] >= b[i]:\n cnt += b[i]\n else:\n cnt += a[i]\n d = b[i] - a[i]\n cnt += min(a[i + 1], d)\n if d > a[i + 1]:\n a[i + 1] = 0\n else:\n a[i + 1] -= d\n stdout.write(str(cnt) + \"\\n\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\na1 = sum(A)\nfor i in range(n):\n b = B[i]\n if A[i] >= b:\n A[i] -= b\n else:\n if A[i + 1] + A[i] >= b:\n A[i + 1] = A[i + 1] + A[i] - b\n A[i] = 0\n else:\n A[i], A[i + 1] = 0, 0\na2 = sum(A)\nprint((a1 - a2))\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-from sys import stdin, stdout","-","-if __name__ == \"__main__\":","- n = int(stdin.readline())","- a = [int(x) for x in stdin.readline().split()]","- b = [int(x) for x in stdin.readline().split()]","- cnt = 0","- for i in range(n):","- if a[i] >= b[i]:","- cnt += b[i]","+n = int(eval(input()))","+A = list(map(int, input().split()))","+B = list(map(int, input().split()))","+a1 = sum(A)","+for i in range(n):","+ b = B[i]","+ if A[i] >= b:","+ A[i] -= b","+ else:","+ if A[i + 1] + A[i] >= b:","+ A[i + 1] = A[i + 1] + A[i] - b","+ A[i] = 0","- cnt += a[i]","- d = b[i] - a[i]","- cnt += min(a[i + 1], d)","- if d > a[i + 1]:","- a[i + 1] = 0","- else:","- a[i + 1] -= d","- stdout.write(str(cnt) + \"\\n\")","+ A[i], A[i + 1] = 0, 0","+a2 = sum(A)","+print((a1 - a2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2530250838,"measured_runtime_v1":0.0949857178,"runtime_lift":2.6638224113,"key":["s078643579","s464947070"]} +{"user_id":"u127499732","problem_id":"p03608","language":"python","submission_id_v0":"s266235653","submission_id_v1":"s503227515","cpu_time_v0":246,"cpu_time_v1":190,"memory_v0":83588,"memory_v1":83656,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.76,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = float(\"Inf\")\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[10 ** 8] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = 10 ** 8\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":34,"code_v1_loc":34,"code_v0_num_chars":771,"code_v1_num_chars":761,"code_v0_no_empty_lines":"def main():\n from itertools import permutations\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n to = x[:r]\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n for i in range(1, n + 1):\n dis[i][i] = 0\n for a, b, c in zip(*[iter(x[r:])] * 3):\n dis[a][b] = c\n dis[b][a] = c\n for k in range(1, n + 1):\n for i in range(1, n + 1):\n for j in range(1, n + 1):\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n ans = float(\"Inf\")\n for p in permutations(to):\n tmp = 0\n nw = p[0]\n for nx in p[1:]:\n tmp += dis[nw][nx]\n nw = nx\n ans = min(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n from itertools import permutations\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n to = x[:r]\n dis = [[10**8] * (n + 1) for _ in range(n + 1)]\n for i in range(1, n + 1):\n dis[i][i] = 0\n for a, b, c in zip(*[iter(x[r:])] * 3):\n dis[a][b] = c\n dis[b][a] = c\n for k in range(1, n + 1):\n for i in range(1, n + 1):\n for j in range(1, n + 1):\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n ans = 10**8\n for p in permutations(to):\n tmp = 0\n nw = p[0]\n for nx in p[1:]:\n tmp += dis[nw][nx]\n nw = nx\n ans = min(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]","+ dis = [[10**8] * (n + 1) for _ in range(n + 1)]","- ans = float(\"Inf\")","+ ans = 10**8"],"diff_only_import_comment":false,"measured_runtime_v0":0.3828251469,"measured_runtime_v1":0.1865792952,"runtime_lift":2.0518093745,"key":["s266235653","s503227515"]} +{"user_id":"u732159958","problem_id":"p03416","language":"python","submission_id_v0":"s130057185","submission_id_v1":"s637640023","cpu_time_v0":68,"cpu_time_v1":50,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.47,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ncounter = 0\n\nc = list(map(int, input().split(' ')))\n\nfor i in range(c[0], c[1] + 1):\n\n if str(i)[0] != str(i)[4]:\n\n continue\n\n if str(i)[1] != str(i)[3]:\n\n continue\n\n counter += 1\n\n\n\nprint(counter)\n\n# optimized version of the same code:\n","target":"a = list(map(int, input().split()))\n\ncounter = 0\n\nfor i in range(a[0], a[1] + 1):\n\n stri = str(i)\n\n if (stri[0] == stri[4] and stri[1] == stri[3]):\n\n counter += 1\n\n \n\nprint(counter)","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":206,"code_v1_num_chars":189,"code_v0_no_empty_lines":"counter = 0\nc = list(map(int, input().split(\" \")))\nfor i in range(c[0], c[1] + 1):\n if str(i)[0] != str(i)[4]:\n continue\n if str(i)[1] != str(i)[3]:\n continue\n counter += 1\nprint(counter)\n","code_v1_no_empty_lines":"a = list(map(int, input().split()))\ncounter = 0\nfor i in range(a[0], a[1] + 1):\n stri = str(i)\n if stri[0] == stri[4] and stri[1] == stri[3]:\n counter += 1\nprint(counter)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["+a = list(map(int, input().split()))","-c = list(map(int, input().split(\" \")))","-for i in range(c[0], c[1] + 1):","- if str(i)[0] != str(i)[4]:","- continue","- if str(i)[1] != str(i)[3]:","- continue","- counter += 1","+for i in range(a[0], a[1] + 1):","+ stri = str(i)","+ if stri[0] == stri[4] and stri[1] == stri[3]:","+ counter += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.442622024,"measured_runtime_v1":0.3161446974,"runtime_lift":1.4000615148,"key":["s130057185","s637640023"]} +{"user_id":"u089230684","problem_id":"p03038","language":"python","submission_id_v0":"s817533229","submission_id_v1":"s906455398","cpu_time_v0":826,"cpu_time_v1":662,"memory_v0":82456,"memory_v1":25196,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.85,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nI=lambda:list(map(int,input().split()))\n\nn,m=I()\n\na=I()\n\na.sort(reverse=True)\n\nqq=[I() for i in range(m)]\n\nqq.sort(key=lambda x:x[1],reverse=True)\n\nans=0\n\nfor x,y in qq:\n\n for j in range(x):\n\n if not a:\n\n break\n\n aa=a.pop()\n\n ans+=max(aa,y)\n\nans+=sum(a)\n\nprint(ans)\n\n \n\n# optimized version of the same code:\n","target":"I=lambda : list(map(int,input().split()))\n\nn,m = I()\n\nl=I();s=sum(l);l.sort();d=[]\n\nfor _ in range(m):\n\n b,c=I()\n\n d.append([c,b])\n\np=s=0 \n\nfor i in sorted(d,reverse=True):\n\n while i[1]:\n\n if p>=n or l[p]>=i[0]:\n\n break\n\n i[1]-=1\n\n s+=i[0]\n\n p+=1\n\n if p>=n:\n\n break\n\ns+=sum(l[p:])\n\nprint(s)","code_v0_loc":16,"code_v1_loc":18,"code_v0_num_chars":310,"code_v1_num_chars":351,"code_v0_no_empty_lines":"I = lambda: list(map(int, input().split()))\nn, m = I()\na = I()\na.sort(reverse=True)\nqq = [I() for i in range(m)]\nqq.sort(key=lambda x: x[1], reverse=True)\nans = 0\nfor x, y in qq:\n for j in range(x):\n if not a:\n break\n aa = a.pop()\n ans += max(aa, y)\nans += sum(a)\nprint(ans)\n","code_v1_no_empty_lines":"I = lambda: list(map(int, input().split()))\nn, m = I()\nl = I()\ns = sum(l)\nl.sort()\nd = []\nfor _ in range(m):\n b, c = I()\n d.append([c, b])\np = s = 0\nfor i in sorted(d, reverse=True):\n while i[1]:\n if p >= n or l[p] >= i[0]:\n break\n i[1] -= 1\n s += i[0]\n p += 1\n if p >= n:\n break\ns += sum(l[p:])\nprint(s)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-a = I()","-a.sort(reverse=True)","-qq = [I() for i in range(m)]","-qq.sort(key=lambda x: x[1], reverse=True)","-ans = 0","-for x, y in qq:","- for j in range(x):","- if not a:","+l = I()","+s = sum(l)","+l.sort()","+d = []","+for _ in range(m):","+ b, c = I()","+ d.append([c, b])","+p = s = 0","+for i in sorted(d, reverse=True):","+ while i[1]:","+ if p >= n or l[p] >= i[0]:","- aa = a.pop()","- ans += max(aa, y)","-ans += sum(a)","-print(ans)","+ i[1] -= 1","+ s += i[0]","+ p += 1","+ if p >= n:","+ break","+s += sum(l[p:])","+print(s)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3493785617,"measured_runtime_v1":0.2761461248,"runtime_lift":1.2651945122,"key":["s817533229","s906455398"]} +{"user_id":"u127499732","problem_id":"p02780","language":"python","submission_id_v0":"s032064078","submission_id_v1":"s836088645","cpu_time_v0":401,"cpu_time_v1":159,"memory_v0":32556,"memory_v1":23616,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.35,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn,k=list(map(int,input().split()))\n\nexp=tuple([(int(x)+1)\/2 for x in input().split()])\n\nl=np.cumsum(exp)\n\n\n\nans=l[k-1]\n\nfor i in range(0,n-k):\n\n x=l[i+k]-l[i]\n\n ans=max(ans,x)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"def main():\n\n from itertools import accumulate\n\n n, k = list(map(int, input().split()))\n\n *exp, = [(int(x) + 1) \/ 2 for x in input().split()]\n\n l = accumulate(exp)\n\n l = list(l)\n\n ans = l[k - 1]\n\n for i in range(0, n - k):\n\n x = l[i + k] - l[i]\n\n ans = max(ans, x)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":10,"code_v1_loc":15,"code_v0_num_chars":207,"code_v1_num_chars":359,"code_v0_no_empty_lines":"import numpy as np\n\nn, k = list(map(int, input().split()))\nexp = tuple([(int(x) + 1) \/ 2 for x in input().split()])\nl = np.cumsum(exp)\nans = l[k - 1]\nfor i in range(0, n - k):\n x = l[i + k] - l[i]\n ans = max(ans, x)\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n from itertools import accumulate\n\n n, k = list(map(int, input().split()))\n (*exp,) = [(int(x) + 1) \/ 2 for x in input().split()]\n l = accumulate(exp)\n l = list(l)\n ans = l[k - 1]\n for i in range(0, n - k):\n x = l[i + k] - l[i]\n ans = max(ans, x)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-import numpy as np","+def main():","+ from itertools import accumulate","-n, k = list(map(int, input().split()))","-exp = tuple([(int(x) + 1) \/ 2 for x in input().split()])","-l = np.cumsum(exp)","-ans = l[k - 1]","-for i in range(0, n - k):","- x = l[i + k] - l[i]","- ans = max(ans, x)","-print(ans)","+ n, k = list(map(int, input().split()))","+ (*exp,) = [(int(x) + 1) \/ 2 for x in input().split()]","+ l = accumulate(exp)","+ l = list(l)","+ ans = l[k - 1]","+ for i in range(0, n - k):","+ x = l[i + k] - l[i]","+ ans = max(ans, x)","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":1.2954093719,"measured_runtime_v1":0.1973411753,"runtime_lift":6.5643136548,"key":["s032064078","s836088645"]} +{"user_id":"u202406075","problem_id":"p03494","language":"python","submission_id_v0":"s829872247","submission_id_v1":"s319951709","cpu_time_v0":148,"cpu_time_v1":18,"memory_v0":12396,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.84,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nimport sys\n\n\n\nn = int(eval(input()))\n\na = np.array(list(map(int, input().split())))\n\n\n\ncnt = 1\n\n\n\nif np.any(a%2==1):\n\n print((0))\n\n sys.exit()\n\n\n\nwhile True:\n\n a2 = a % 2**cnt\n\n if np.all(a2==0):\n\n cnt += 1\n\n continue\n\n else:\n\n print((cnt-1))\n\n break\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\na = list(map(int,input().split()))\n\nans = 0\n\nwhile all(A%2 == 0 for A in a):\n\n\ta = [i\/2 for i in a ]\n\n\tans += 1\n\nprint(ans)\n","code_v0_loc":20,"code_v1_loc":7,"code_v0_num_chars":303,"code_v1_num_chars":142,"code_v0_no_empty_lines":"import numpy as np\nimport sys\n\nn = int(eval(input()))\na = np.array(list(map(int, input().split())))\ncnt = 1\nif np.any(a % 2 == 1):\n print((0))\n sys.exit()\nwhile True:\n a2 = a % 2**cnt\n if np.all(a2 == 0):\n cnt += 1\n continue\n else:\n print((cnt - 1))\n break\n","code_v1_no_empty_lines":"N = int(eval(input()))\na = list(map(int, input().split()))\nans = 0\nwhile all(A % 2 == 0 for A in a):\n a = [i \/ 2 for i in a]\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":65.0,"diff":["-import numpy as np","-import sys","-","-n = int(eval(input()))","-a = np.array(list(map(int, input().split())))","-cnt = 1","-if np.any(a % 2 == 1):","- print((0))","- sys.exit()","-while True:","- a2 = a % 2**cnt","- if np.all(a2 == 0):","- cnt += 1","- continue","- else:","- print((cnt - 1))","- break","+N = int(eval(input()))","+a = list(map(int, input().split()))","+ans = 0","+while all(A % 2 == 0 for A in a):","+ a = [i \/ 2 for i in a]","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.8370131412,"measured_runtime_v1":0.3072203367,"runtime_lift":5.9794646441,"key":["s829872247","s319951709"]} +{"user_id":"u062691227","problem_id":"p03723","language":"python","submission_id_v0":"s522426109","submission_id_v1":"s794063832","cpu_time_v0":61,"cpu_time_v1":29,"memory_v0":61360,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.46,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c=list(map(int,input().split()))\n\ne=(a-b)|(b-c)\n\nprint((bool(e|(a|b|c)%2)*(e^~-e).bit_length()-1))\n\n# optimized version of the same code:\n","target":"a,b,c=list(map(int,input().split()))\n\ne=(a-b)|(b-c)\n\nprint((bool(e|b%2)*(e^~-e).bit_length()-1))","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":94,"code_v1_num_chars":88,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\ne = (a - b) | (b - c)\nprint((bool(e | (a | b | c) % 2) * (e ^ ~-e).bit_length() - 1))\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\ne = (a - b) | (b - c)\nprint((bool(e | b % 2) * (e ^ ~-e).bit_length() - 1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((bool(e | (a | b | c) % 2) * (e ^ ~-e).bit_length() - 1))","+print((bool(e | b % 2) * (e ^ ~-e).bit_length() - 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2914967289,"measured_runtime_v1":0.0905496902,"runtime_lift":3.2191907898,"key":["s522426109","s794063832"]} +{"user_id":"u531220228","problem_id":"p02970","language":"python","submission_id_v0":"s388408889","submission_id_v1":"s284238115","cpu_time_v0":150,"cpu_time_v1":21,"memory_v0":12392,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN, D = list(map(int, input().split()))\n\nprint((int(np.ceil(N\/(2*D+1)))))\n\n# optimized version of the same code:\n","target":"N, D = list(map(int, input().split()))\n\nimport math\n\nprint((math.ceil(N\/(2*D+1))))","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":84,"code_v1_num_chars":74,"code_v0_no_empty_lines":"import numpy as np\n\nN, D = list(map(int, input().split()))\nprint((int(np.ceil(N \/ (2 * D + 1)))))\n","code_v1_no_empty_lines":"N, D = list(map(int, input().split()))\nimport math\n\nprint((math.ceil(N \/ (2 * D + 1))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","+N, D = list(map(int, input().split()))","+import math","-N, D = list(map(int, input().split()))","-print((int(np.ceil(N \/ (2 * D + 1)))))","+print((math.ceil(N \/ (2 * D + 1))))"],"diff_only_import_comment":false,"measured_runtime_v0":2.2725535502,"measured_runtime_v1":0.3538572516,"runtime_lift":6.4222325235,"key":["s388408889","s284238115"]} +{"user_id":"u298297089","problem_id":"p03037","language":"python","submission_id_v0":"s092044899","submission_id_v1":"s679810914","cpu_time_v0":352,"cpu_time_v1":284,"memory_v0":4760,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.32,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, M =list(map(int, input().split()))\n\nL = [0 for i in range(N+1)]\n\nR = [0 for i in range(N+1)]\n\nfor i in range(M):\n\n l,r = list(map(int, input().split()))\n\n L[l] += 1\n\n R[r] += 1\n\ncnt = 0\n\ntmp = 0\n\nfor i in range(N+1):\n\n tmp += L[i]\n\n if tmp == M:\n\n cnt += 1\n\n tmp -= R[i]\n\nprint(cnt)\n\n\n# optimized version of the same code:\n","target":"n,m = list(map(int, input().split()))\n\nll = 1\n\nrr = n\n\nfor i in range(m):\n\n l,r = list(map(int,input().split()))\n\n if l > ll:\n\n ll = l\n\n if r < rr:\n\n rr = r\n\nprint((max(rr - ll + 1, 0)))\n","code_v0_loc":15,"code_v1_loc":10,"code_v0_num_chars":299,"code_v1_num_chars":196,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nL = [0 for i in range(N + 1)]\nR = [0 for i in range(N + 1)]\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L[l] += 1\n R[r] += 1\ncnt = 0\ntmp = 0\nfor i in range(N + 1):\n tmp += L[i]\n if tmp == M:\n cnt += 1\n tmp -= R[i]\nprint(cnt)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nll = 1\nrr = n\nfor i in range(m):\n l, r = list(map(int, input().split()))\n if l > ll:\n ll = l\n if r < rr:\n rr = r\nprint((max(rr - ll + 1, 0)))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-N, M = list(map(int, input().split()))","-L = [0 for i in range(N + 1)]","-R = [0 for i in range(N + 1)]","-for i in range(M):","+n, m = list(map(int, input().split()))","+ll = 1","+rr = n","+for i in range(m):","- L[l] += 1","- R[r] += 1","-cnt = 0","-tmp = 0","-for i in range(N + 1):","- tmp += L[i]","- if tmp == M:","- cnt += 1","- tmp -= R[i]","-print(cnt)","+ if l > ll:","+ ll = l","+ if r < rr:","+ rr = r","+print((max(rr - ll + 1, 0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2886495962,"measured_runtime_v1":0.2151292083,"runtime_lift":1.3417499114,"key":["s092044899","s679810914"]} +{"user_id":"u652057333","problem_id":"p03457","language":"python","submission_id_v0":"s981534291","submission_id_v1":"s633478372","cpu_time_v0":1075,"cpu_time_v1":501,"memory_v0":32460,"memory_v1":3572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.4,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn = int(eval(input()))\n\ninput_X = [[int(i) for i in input().split()] for i in range(n)]\n\nX = np.array(input_X)\n\n\n\npre_t = 0\n\npre_x = 0\n\npre_y = 0\n\nfor i in range(n):\n\n x_move = abs(X[i][1] - pre_x)\n\n y_move = abs(X[i][2] - pre_y)\n\n xy_sum = x_move + y_move\n\n spend_time = X[i][0]-pre_t\n\n if xy_sum%2 == spend_time%2 and spend_time >= xy_sum:\n\n pre_t = X[i][0]\n\n pre_x = X[i][1]\n\n pre_y = X[i][2]\n\n if i+1 == n:\n\n print('Yes')\n\n else:\n\n continue\n\n else:\n\n print('No')\n\n break\n\n# optimized version of the same code:\n","target":"# C\n\nimport copy\n\nn = int(eval(input()))\n\npreX = [0,0,0]\n\nans = True\n\nfor i in range(n):\n\n curX = list(map(int, input().split()))\n\n dt = curX[0] - preX[0]\n\n dx = abs(curX[1] - preX[1])\n\n dy = abs(curX[2] - preX[2])\n\n if dt < dx + dy or (dt % 2) != ((dx + dy) % 2):\n\n ans = False\n\n preX = copy.copy(curX)\n\nif ans:\n\n print('Yes')\n\nelse:\n\n print('No')","code_v0_loc":25,"code_v1_loc":17,"code_v0_num_chars":579,"code_v1_num_chars":374,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\ninput_X = [[int(i) for i in input().split()] for i in range(n)]\nX = np.array(input_X)\npre_t = 0\npre_x = 0\npre_y = 0\nfor i in range(n):\n x_move = abs(X[i][1] - pre_x)\n y_move = abs(X[i][2] - pre_y)\n xy_sum = x_move + y_move\n spend_time = X[i][0] - pre_t\n if xy_sum % 2 == spend_time % 2 and spend_time >= xy_sum:\n pre_t = X[i][0]\n pre_x = X[i][1]\n pre_y = X[i][2]\n if i + 1 == n:\n print(\"Yes\")\n else:\n continue\n else:\n print(\"No\")\n break\n","code_v1_no_empty_lines":"# C\nimport copy\n\nn = int(eval(input()))\npreX = [0, 0, 0]\nans = True\nfor i in range(n):\n curX = list(map(int, input().split()))\n dt = curX[0] - preX[0]\n dx = abs(curX[1] - preX[1])\n dy = abs(curX[2] - preX[2])\n if dt < dx + dy or (dt % 2) != ((dx + dy) % 2):\n ans = False\n preX = copy.copy(curX)\nif ans:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":32.0,"diff":["-import numpy as np","+# C","+import copy","-input_X = [[int(i) for i in input().split()] for i in range(n)]","-X = np.array(input_X)","-pre_t = 0","-pre_x = 0","-pre_y = 0","+preX = [0, 0, 0]","+ans = True","- x_move = abs(X[i][1] - pre_x)","- y_move = abs(X[i][2] - pre_y)","- xy_sum = x_move + y_move","- spend_time = X[i][0] - pre_t","- if xy_sum % 2 == spend_time % 2 and spend_time >= xy_sum:","- pre_t = X[i][0]","- pre_x = X[i][1]","- pre_y = X[i][2]","- if i + 1 == n:","- print(\"Yes\")","- else:","- continue","- else:","- print(\"No\")","- break","+ curX = list(map(int, input().split()))","+ dt = curX[0] - preX[0]","+ dx = abs(curX[1] - preX[1])","+ dy = abs(curX[2] - preX[2])","+ if dt < dx + dy or (dt % 2) != ((dx + dy) % 2):","+ ans = False","+ preX = copy.copy(curX)","+if ans:","+ print(\"Yes\")","+else:","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":1.2549288661,"measured_runtime_v1":0.2172089093,"runtime_lift":5.7775202237,"key":["s981534291","s633478372"]} +{"user_id":"u075012704","problem_id":"p03558","language":"python","submission_id_v0":"s239051528","submission_id_v1":"s690298448","cpu_time_v0":622,"cpu_time_v1":294,"memory_v0":102192,"memory_v1":35324,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import deque\n\nK = int(eval(input()))\n\nG = [[] for i in range(K)]\n\n\n\nfor n in range(K):\n\n G[n].append([(n + 1) % K, 1])\n\n G[n].append([(10 * n) % K, 0])\n\n\n\nque = deque([[1, 1]])\n\ndist = [float('inf')] * K\n\n\n\nwhile que:\n\n node, cost = que.pop()\n\n dist[node] = min(cost, dist[node])\n\n for e, e_cost in G[node]:\n\n if dist[e] != float('inf'):\n\n continue\n\n\n\n if e_cost == 0:\n\n que.append([e, cost + 0])\n\n\n\n if e_cost == 1:\n\n que.appendleft([e, cost + 1])\n\n\n\nprint((dist[0]))\n\n\n# optimized version of the same code:\n","target":"from collections import deque\n\nK = int(eval(input()))\n\nG = [[] for i in range(K)]\n\nfor i in range(K):\n\n G[i].append(((10 * i) % K, 0))\n\n G[i].append(((i + 1) % K, 1))\n\n\n\ndist = [float('inf')] * K\n\ndist[1] = 1\n\nque = deque()\n\nque.append(1)\n\n\n\nwhile que:\n\n n = que.pop()\n\n for v, c in G[n]:\n\n if dist[v] > dist[n] + c:\n\n dist[v] = dist[n] + c\n\n if c == 0:\n\n que.append(v)\n\n else:\n\n que.appendleft(v)\n\n\n\nprint((dist[0]))\n","code_v0_loc":25,"code_v1_loc":23,"code_v0_num_chars":547,"code_v1_num_chars":492,"code_v0_no_empty_lines":"from collections import deque\n\nK = int(eval(input()))\nG = [[] for i in range(K)]\nfor n in range(K):\n G[n].append([(n + 1) % K, 1])\n G[n].append([(10 * n) % K, 0])\nque = deque([[1, 1]])\ndist = [float(\"inf\")] * K\nwhile que:\n node, cost = que.pop()\n dist[node] = min(cost, dist[node])\n for e, e_cost in G[node]:\n if dist[e] != float(\"inf\"):\n continue\n if e_cost == 0:\n que.append([e, cost + 0])\n if e_cost == 1:\n que.appendleft([e, cost + 1])\nprint((dist[0]))\n","code_v1_no_empty_lines":"from collections import deque\n\nK = int(eval(input()))\nG = [[] for i in range(K)]\nfor i in range(K):\n G[i].append(((10 * i) % K, 0))\n G[i].append(((i + 1) % K, 1))\ndist = [float(\"inf\")] * K\ndist[1] = 1\nque = deque()\nque.append(1)\nwhile que:\n n = que.pop()\n for v, c in G[n]:\n if dist[v] > dist[n] + c:\n dist[v] = dist[n] + c\n if c == 0:\n que.append(v)\n else:\n que.appendleft(v)\nprint((dist[0]))\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["-for n in range(K):","- G[n].append([(n + 1) % K, 1])","- G[n].append([(10 * n) % K, 0])","-que = deque([[1, 1]])","+for i in range(K):","+ G[i].append(((10 * i) % K, 0))","+ G[i].append(((i + 1) % K, 1))","+dist[1] = 1","+que = deque()","+que.append(1)","- node, cost = que.pop()","- dist[node] = min(cost, dist[node])","- for e, e_cost in G[node]:","- if dist[e] != float(\"inf\"):","- continue","- if e_cost == 0:","- que.append([e, cost + 0])","- if e_cost == 1:","- que.appendleft([e, cost + 1])","+ n = que.pop()","+ for v, c in G[n]:","+ if dist[v] > dist[n] + c:","+ dist[v] = dist[n] + c","+ if c == 0:","+ que.append(v)","+ else:","+ que.appendleft(v)"],"diff_only_import_comment":false,"measured_runtime_v0":0.7363213913,"measured_runtime_v1":0.4714232118,"runtime_lift":1.5619116176,"key":["s239051528","s690298448"]} +{"user_id":"u305366205","problem_id":"p03307","language":"python","submission_id_v0":"s023207655","submission_id_v1":"s158622460","cpu_time_v0":36,"cpu_time_v1":17,"memory_v0":5176,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.78,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport fractions\n\n\n\n\n\ndef lcm(x, y):\n\n return (x * y) \/\/ fractions.gcd(x, y)\n\n\n\n\n\nN = int(eval(input()))\n\nprint((lcm(N, 2)))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nif N % 2 == 0:\n\n print(N)\n\nelse:\n\n print((2 * N))","code_v0_loc":9,"code_v1_loc":5,"code_v0_num_chars":119,"code_v1_num_chars":71,"code_v0_no_empty_lines":"import fractions\n\n\ndef lcm(x, y):\n return (x * y) \/\/ fractions.gcd(x, y)\n\n\nN = int(eval(input()))\nprint((lcm(N, 2)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nif N % 2 == 0:\n print(N)\nelse:\n print((2 * N))\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-import fractions","-","-","-def lcm(x, y):","- return (x * y) \/\/ fractions.gcd(x, y)","-","-","-print((lcm(N, 2)))","+if N % 2 == 0:","+ print(N)","+else:","+ print((2 * N))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2764545197,"measured_runtime_v1":0.1953277736,"runtime_lift":1.4153364608,"key":["s023207655","s158622460"]} +{"user_id":"u379692329","problem_id":"p03720","language":"python","submission_id_v0":"s591924545","submission_id_v1":"s922681456","cpu_time_v0":155,"cpu_time_v1":17,"memory_v0":12452,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN, M = [int(x) for x in input().split()]\n\nL = [[int (y) for y in input().split()] for _ in range(M)]\n\nL = sum(L, [])\n\n\n\nfor i in np.arange(1, N+1):\n\n print((L.count(i)))\n\n# optimized version of the same code:\n","target":"N, M = [int(x) for x in input().split()]\n\nL = [[int (y) for y in input().split()] for _ in range(M)]\n\nL = sum(L, [])\n\n\n\nfor i in range(1, N+1):\n\n print((L.count(i)))","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":192,"code_v1_num_chars":166,"code_v0_no_empty_lines":"import numpy as np\n\nN, M = [int(x) for x in input().split()]\nL = [[int(y) for y in input().split()] for _ in range(M)]\nL = sum(L, [])\nfor i in np.arange(1, N + 1):\n print((L.count(i)))\n","code_v1_no_empty_lines":"N, M = [int(x) for x in input().split()]\nL = [[int(y) for y in input().split()] for _ in range(M)]\nL = sum(L, [])\nfor i in range(1, N + 1):\n print((L.count(i)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import numpy as np","-","-for i in np.arange(1, N + 1):","+for i in range(1, N + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":1.7429071844,"measured_runtime_v1":0.246149132,"runtime_lift":7.08069604,"key":["s591924545","s922681456"]} +{"user_id":"u638456847","problem_id":"p02881","language":"python","submission_id_v0":"s727719500","submission_id_v1":"s621896362","cpu_time_v0":169,"cpu_time_v1":115,"memory_v0":29028,"memory_v1":3464,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n\n\n INF = 10**6 + 100\n\n\n\n x = np.arange(1,INF,dtype=np.int64)\n\n div = x[N % x == 0]\n\n #print(div)\n\n #print(N \/\/ div)\n\n \n\n ans = (div + N\/\/div).min() - 2\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\nfrom math import sqrt\n\n\n\ndef divisor_enumeration(n):\n\n div = []\n\n for i in range(1, int(sqrt(n))+1):\n\n if n % i == 0:\n\n if n \/\/ i != i:\n\n div.append((i, n \/\/ i))\n\n else:\n\n div.append((i, i))\n\n \n\n return div\n\n\n\n\n\ndef main():\n\n N = int(readline())\n\n\n\n d = divisor_enumeration(N)\n\n \n\n ans = 10**15\n\n for x, y in d:\n\n ans = min(ans, x + y - 2)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":18,"code_v1_loc":33,"code_v0_num_chars":290,"code_v1_num_chars":600,"code_v0_no_empty_lines":"import numpy as np\n\n\ndef main():\n N = int(eval(input()))\n INF = 10**6 + 100\n x = np.arange(1, INF, dtype=np.int64)\n div = x[N % x == 0]\n # print(div)\n # print(N \/\/ div)\n ans = (div + N \/\/ div).min() - 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nfrom math import sqrt\n\n\ndef divisor_enumeration(n):\n div = []\n for i in range(1, int(sqrt(n)) + 1):\n if n % i == 0:\n if n \/\/ i != i:\n div.append((i, n \/\/ i))\n else:\n div.append((i, i))\n return div\n\n\ndef main():\n N = int(readline())\n d = divisor_enumeration(N)\n ans = 10**15\n for x, y in d:\n ans = min(ans, x + y - 2)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-import numpy as np","+import sys","+","+read = sys.stdin.read","+readline = sys.stdin.readline","+readlines = sys.stdin.readlines","+from math import sqrt","+","+","+def divisor_enumeration(n):","+ div = []","+ for i in range(1, int(sqrt(n)) + 1):","+ if n % i == 0:","+ if n \/\/ i != i:","+ div.append((i, n \/\/ i))","+ else:","+ div.append((i, i))","+ return div","- N = int(eval(input()))","- INF = 10**6 + 100","- x = np.arange(1, INF, dtype=np.int64)","- div = x[N % x == 0]","- # print(div)","- # print(N \/\/ div)","- ans = (div + N \/\/ div).min() - 2","+ N = int(readline())","+ d = divisor_enumeration(N)","+ ans = 10**15","+ for x, y in d:","+ ans = min(ans, x + y - 2)"],"diff_only_import_comment":false,"measured_runtime_v0":1.9439773376,"measured_runtime_v1":0.2817540879,"runtime_lift":6.8995532659,"key":["s727719500","s621896362"]} +{"user_id":"u507456172","problem_id":"p02555","language":"python","submission_id_v0":"s532831472","submission_id_v1":"s789265811","cpu_time_v0":123,"cpu_time_v1":31,"memory_v0":9160,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.8,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import factorial as fac\n\n\n\nS = int(eval(input()))\n\nans = 0\n\n\n\nif S == 1 or S == 2:\n\n print((0))\n\nelif S == 3:\n\n print((1))\n\nelse:\n\n for k in range(1,S):\n\n if S-2*k-1 >= 0 and S-3*k >= 0:\n\n ans += fac(S-2*k-1)\/\/(fac(k-1)*fac(S-3*k))\n\n print((ans%1000000007))\n\n# optimized version of the same code:\n","target":"S = int(eval(input()))\n\n\n\nif S == 1 or S ==2:\n\n print((0))\n\nelif S == 3 or S == 4 or S == 5:\n\n print((1))\n\nelse:\n\n #\u521d\u671f\u5316\n\n dp = [0]*S\n\n dp[2] = 1\n\n dp[3] = 1\n\n dp[4] = 1\n\n dp_S = 0\n\n #dp\n\n for i in range(5,S):\n\n dp_S += dp[i-3] \n\n dp[i] = 1+dp_S\n\n\n\n print((dp[S-1]%1000000007))","code_v0_loc":14,"code_v1_loc":19,"code_v0_num_chars":267,"code_v1_num_chars":281,"code_v0_no_empty_lines":"from math import factorial as fac\n\nS = int(eval(input()))\nans = 0\nif S == 1 or S == 2:\n print((0))\nelif S == 3:\n print((1))\nelse:\n for k in range(1, S):\n if S - 2 * k - 1 >= 0 and S - 3 * k >= 0:\n ans += fac(S - 2 * k - 1) \/\/ (fac(k - 1) * fac(S - 3 * k))\n print((ans % 1000000007))\n","code_v1_no_empty_lines":"S = int(eval(input()))\nif S == 1 or S == 2:\n print((0))\nelif S == 3 or S == 4 or S == 5:\n print((1))\nelse:\n # \u521d\u671f\u5316\n dp = [0] * S\n dp[2] = 1\n dp[3] = 1\n dp[4] = 1\n dp_S = 0\n # dp\n for i in range(5, S):\n dp_S += dp[i - 3]\n dp[i] = 1 + dp_S\n print((dp[S - 1] % 1000000007))\n","code_same":false,"relative_loc_diff_percent":26.3157894737,"diff":["-from math import factorial as fac","-","-ans = 0","-elif S == 3:","+elif S == 3 or S == 4 or S == 5:","- for k in range(1, S):","- if S - 2 * k - 1 >= 0 and S - 3 * k >= 0:","- ans += fac(S - 2 * k - 1) \/\/ (fac(k - 1) * fac(S - 3 * k))","- print((ans % 1000000007))","+ # \u521d\u671f\u5316","+ dp = [0] * S","+ dp[2] = 1","+ dp[3] = 1","+ dp[4] = 1","+ dp_S = 0","+ # dp","+ for i in range(5, S):","+ dp_S += dp[i - 3]","+ dp[i] = 1 + dp_S","+ print((dp[S - 1] % 1000000007))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3404159594,"measured_runtime_v1":0.2477156413,"runtime_lift":1.3742206895,"key":["s532831472","s789265811"]} +{"user_id":"u439396449","problem_id":"p03287","language":"python","submission_id_v0":"s936062710","submission_id_v1":"s930018564","cpu_time_v0":270,"cpu_time_v1":121,"memory_v0":27356,"memory_v1":16208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.19,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import defaultdict\n\n\n\nfrom scipy.misc import comb\n\n\n\nN, M = list(map(int, input().split()))\n\nA = [int(x) for x in input().split()]\n\n\n\nB = [0] * N\n\nB[0] = A[0]\n\nfor i in range(1, N):\n\n B[i] = B[i - 1] + A[i]\n\nB = [0] + B\n\n\n\nc = defaultdict(int)\n\nfor i in range(N + 1):\n\n c[B[i] % M] += 1\n\n\n\nans = 0\n\nfor k, v in list(c.items()):\n\n if v >= 2:\n\n ans += comb(v, 2, exact=True)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\n\n\nN, M = list(map(int, input().split()))\n\nA = [int(x) for x in input().split()]\n\n\n\nB = [0] * N\n\nB[0] = A[0]\n\nfor i in range(1, N):\n\n B[i] = B[i - 1] + A[i]\n\nB = [0] + B\n\n\n\nc = defaultdict(int)\n\nfor i in range(N + 1):\n\n c[B[i] % M] += 1\n\n\n\nans = 0\n\nfor k, v in list(c.items()):\n\n if v >= 2:\n\n ans += v * (v - 1) \/\/ 2\n\nprint(ans)","code_v0_loc":22,"code_v1_loc":20,"code_v0_num_chars":405,"code_v1_num_chars":368,"code_v0_no_empty_lines":"from collections import defaultdict\nfrom scipy.misc import comb\n\nN, M = list(map(int, input().split()))\nA = [int(x) for x in input().split()]\nB = [0] * N\nB[0] = A[0]\nfor i in range(1, N):\n B[i] = B[i - 1] + A[i]\nB = [0] + B\nc = defaultdict(int)\nfor i in range(N + 1):\n c[B[i] % M] += 1\nans = 0\nfor k, v in list(c.items()):\n if v >= 2:\n ans += comb(v, 2, exact=True)\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nN, M = list(map(int, input().split()))\nA = [int(x) for x in input().split()]\nB = [0] * N\nB[0] = A[0]\nfor i in range(1, N):\n B[i] = B[i - 1] + A[i]\nB = [0] + B\nc = defaultdict(int)\nfor i in range(N + 1):\n c[B[i] % M] += 1\nans = 0\nfor k, v in list(c.items()):\n if v >= 2:\n ans += v * (v - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-from scipy.misc import comb","- ans += comb(v, 2, exact=True)","+ ans += v * (v - 1) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":1.3683824704,"measured_runtime_v1":0.2000572271,"runtime_lift":6.8399551963,"key":["s936062710","s930018564"]} +{"user_id":"u279493135","problem_id":"p02555","language":"python","submission_id_v0":"s706729835","submission_id_v1":"s005580579","cpu_time_v0":319,"cpu_time_v1":39,"memory_v0":10348,"memory_v1":11860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.77,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n for i in range(x-2):\n\n ret += rec(i)\n\n ret %= mod\n\n return ret\n\n\n\nprint((rec(S)))\n\n\n# optimized version of the same code:\n","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n if x >= 3:\n\n return (rec(x-1)+rec(x-3))%mod\n\n else:\n\n return 0\n\n\n\nprint((rec(S)))\n","code_v0_loc":32,"code_v1_loc":32,"code_v0_num_chars":996,"code_v1_num_chars":996,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n product,\n groupby,\n combinations_with_replacement,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nS = INT()\n\n\n@lru_cache(maxsize=None)\ndef rec(x):\n if x == 0:\n return 1\n ret = 0\n for i in range(x - 2):\n ret += rec(i)\n ret %= mod\n return ret\n\n\nprint((rec(S)))\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n product,\n groupby,\n combinations_with_replacement,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nS = INT()\n\n\n@lru_cache(maxsize=None)\ndef rec(x):\n if x == 0:\n return 1\n ret = 0\n if x >= 3:\n return (rec(x - 1) + rec(x - 3)) % mod\n else:\n return 0\n\n\nprint((rec(S)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for i in range(x - 2):","- ret += rec(i)","- ret %= mod","- return ret","+ if x >= 3:","+ return (rec(x - 1) + rec(x - 3)) % mod","+ else:","+ return 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.4423550682,"measured_runtime_v1":0.2103828435,"runtime_lift":2.1026194952,"key":["s706729835","s005580579"]} +{"user_id":"u143173995","problem_id":"p03250","language":"python","submission_id_v0":"s114284602","submission_id_v1":"s442028856","cpu_time_v0":276,"cpu_time_v1":17,"memory_v0":17964,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.84,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# \u30a4\u30f3\u30dd\u30fc\u30c8\n\nimport numpy as np\n\n# A,B,C\u306e\u5024\u306e\u7372\u5f97\n\nnum = list(map(int, input().split()))\n\n# num\u30ea\u30b9\u30c8\u306e\u6700\u5927\u5024\u309210\u500d\n\nnum[num.index(max(num))] = max(num) * 10\n\n# np\u3067\u8981\u7d20\u306e\u548c\u3092\u8a08\u7b97\u3057\u3001\u51fa\u529b\n\nprint((np.sum(num)))\n\n# optimized version of the same code:\n","target":"# A,B,C\u306e\u5024\u306e\u7372\u5f97\n\nnum = list(map(int, input().split()))\n\n# num\u30ea\u30b9\u30c8\u306e\u6700\u5927\u5024\u309210\u500d\n\nnum[num.index(max(num))] *= 10\n\n# np\u3067\u8981\u7d20\u306e\u548c\u3092\u8a08\u7b97\u3057\u3001\u51fa\u529b\n\nprint((sum(num)))\n","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":178,"code_v1_num_chars":137,"code_v0_no_empty_lines":"# \u30a4\u30f3\u30dd\u30fc\u30c8\nimport numpy as np\n\n# A,B,C\u306e\u5024\u306e\u7372\u5f97\nnum = list(map(int, input().split()))\n# num\u30ea\u30b9\u30c8\u306e\u6700\u5927\u5024\u309210\u500d\nnum[num.index(max(num))] = max(num) * 10\n# np\u3067\u8981\u7d20\u306e\u548c\u3092\u8a08\u7b97\u3057\u3001\u51fa\u529b\nprint((np.sum(num)))\n","code_v1_no_empty_lines":"# A,B,C\u306e\u5024\u306e\u7372\u5f97\nnum = list(map(int, input().split()))\n# num\u30ea\u30b9\u30c8\u306e\u6700\u5927\u5024\u309210\u500d\nnum[num.index(max(num))] *= 10\n# np\u3067\u8981\u7d20\u306e\u548c\u3092\u8a08\u7b97\u3057\u3001\u51fa\u529b\nprint((sum(num)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-# \u30a4\u30f3\u30dd\u30fc\u30c8","-import numpy as np","-","-num[num.index(max(num))] = max(num) * 10","+num[num.index(max(num))] *= 10","-print((np.sum(num)))","+print((sum(num)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3555554001,"measured_runtime_v1":0.1939001415,"runtime_lift":6.990997478,"key":["s114284602","s442028856"]} +{"user_id":"u254871849","problem_id":"p03037","language":"python","submission_id_v0":"s133611442","submission_id_v1":"s023877292","cpu_time_v0":105,"cpu_time_v1":71,"memory_v0":25076,"memory_v1":25076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.38,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nlr = list(zip(*[iter(lr)] * 2))\n\n\n\ndef main():\n\n cnt = [0] * (n + 1)\n\n for l, r in lr:\n\n cnt[l-1] += 1\n\n cnt[r] -= 1\n\n \n\n for i in range(n):\n\n cnt[i+1] += cnt[i]\n\n \n\n res = 0\n\n for i in range(n):\n\n res += (cnt[i] == m) & 1\n\n \n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nl, r = lr[::2], lr[1::2]\n\n\n\ndef main():\n\n ans = max(min(r) - max(l) + 1, 0)\n\n return ans\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":23,"code_v1_loc":12,"code_v0_num_chars":413,"code_v1_num_chars":220,"code_v0_no_empty_lines":"import sys\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\nlr = list(zip(*[iter(lr)] * 2))\n\n\ndef main():\n cnt = [0] * (n + 1)\n for l, r in lr:\n cnt[l - 1] += 1\n cnt[r] -= 1\n for i in range(n):\n cnt[i + 1] += cnt[i]\n res = 0\n for i in range(n):\n res += (cnt[i] == m) & 1\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_v1_no_empty_lines":"import sys\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\nl, r = lr[::2], lr[1::2]\n\n\ndef main():\n ans = max(min(r) - max(l) + 1, 0)\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":47.8260869565,"diff":["-lr = list(zip(*[iter(lr)] * 2))","+l, r = lr[::2], lr[1::2]","- cnt = [0] * (n + 1)","- for l, r in lr:","- cnt[l - 1] += 1","- cnt[r] -= 1","- for i in range(n):","- cnt[i + 1] += cnt[i]","- res = 0","- for i in range(n):","- res += (cnt[i] == m) & 1","- return res","+ ans = max(min(r) - max(l) + 1, 0)","+ return ans"],"diff_only_import_comment":false,"measured_runtime_v0":0.3223134096,"measured_runtime_v1":0.2034767451,"runtime_lift":1.5840306928,"key":["s133611442","s023877292"]} +{"user_id":"u633068244","problem_id":"p01438","language":"python","submission_id_v0":"s057521298","submission_id_v1":"s672157071","cpu_time_v0":350,"cpu_time_v1":160,"memory_v0":16636,"memory_v1":11468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n D = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n for s in range(s-6,e-6):\n\n t |= 1 << s\n\n D[man] = t\n\n\n\n dp = [defaultdict(int) for i in range(n)]\n\n dp[0][D[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp[i-1].keys()):\n\n if bit&D[i] == 0:\n\n dp[i][bit|D[i]] = max(dp[i][bit|D[i]], dp[i-1][bit]+L[i])\n\n dp[i][bit] = max(dp[i][bit],dp[i-1][bit])\n\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n\n \n\n ans = max(max(dp[i].values()) for i in range(n))\n\n print(ans)\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n T = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n t |= 2**(e-6)-2**(s-6)\n\n T[man] = t\n\n\n\n dp = defaultdict(int)\n\n dp[T[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp.keys()):\n\n if bit&T[i] == 0:\n\n dp[bit|T[i]] = max(dp[bit|T[i]], dp[bit]+L[i])\n\n dp[T[i]] = max(dp[T[i]], L[i])\n\n \n\n print(max(dp.values()))","code_v0_loc":27,"code_v1_loc":24,"code_v0_num_chars":821,"code_v1_num_chars":646,"code_v0_no_empty_lines":"from collections import defaultdict\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n L = [0] * n\n D = [0] * n\n for man in range(n):\n m, l = list(map(int, input().split()))\n L[man] = l\n t = 0\n for date in range(m):\n s, e = list(map(int, input().split()))\n for s in range(s - 6, e - 6):\n t |= 1 << s\n D[man] = t\n dp = [defaultdict(int) for i in range(n)]\n dp[0][D[0]] = L[0]\n for i in range(1, n):\n for bit in list(dp[i - 1].keys()):\n if bit & D[i] == 0:\n dp[i][bit | D[i]] = max(dp[i][bit | D[i]], dp[i - 1][bit] + L[i])\n dp[i][bit] = max(dp[i][bit], dp[i - 1][bit])\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n ans = max(max(dp[i].values()) for i in range(n))\n print(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n L = [0] * n\n T = [0] * n\n for man in range(n):\n m, l = list(map(int, input().split()))\n L[man] = l\n t = 0\n for date in range(m):\n s, e = list(map(int, input().split()))\n t |= 2 ** (e - 6) - 2 ** (s - 6)\n T[man] = t\n dp = defaultdict(int)\n dp[T[0]] = L[0]\n for i in range(1, n):\n for bit in list(dp.keys()):\n if bit & T[i] == 0:\n dp[bit | T[i]] = max(dp[bit | T[i]], dp[bit] + L[i])\n dp[T[i]] = max(dp[T[i]], L[i])\n print(max(dp.values()))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["- D = [0] * n","+ T = [0] * n","- for s in range(s - 6, e - 6):","- t |= 1 << s","- D[man] = t","- dp = [defaultdict(int) for i in range(n)]","- dp[0][D[0]] = L[0]","+ t |= 2 ** (e - 6) - 2 ** (s - 6)","+ T[man] = t","+ dp = defaultdict(int)","+ dp[T[0]] = L[0]","- for bit in list(dp[i - 1].keys()):","- if bit & D[i] == 0:","- dp[i][bit | D[i]] = max(dp[i][bit | D[i]], dp[i - 1][bit] + L[i])","- dp[i][bit] = max(dp[i][bit], dp[i - 1][bit])","- dp[i][D[i]] = max(dp[i][D[i]], L[i])","- ans = max(max(dp[i].values()) for i in range(n))","- print(ans)","+ for bit in list(dp.keys()):","+ if bit & T[i] == 0:","+ dp[bit | T[i]] = max(dp[bit | T[i]], dp[bit] + L[i])","+ dp[T[i]] = max(dp[T[i]], L[i])","+ print(max(dp.values()))"],"diff_only_import_comment":false,"measured_runtime_v0":1.0352676418,"measured_runtime_v1":0.6319530358,"runtime_lift":1.6382034472,"key":["s057521298","s672157071"]} +{"user_id":"u186974762","problem_id":"p02767","language":"python","submission_id_v0":"s418768557","submission_id_v1":"s739454407","cpu_time_v0":150,"cpu_time_v1":19,"memory_v0":12504,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nX = np.array(input().split()).astype(int)\n\nP = round(np.average(X))\n\nprint((int(np.sum((P-X)**2))))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nx = [int(i) for i in input().split()]\n\nmin_x = round(sum(x) \/ n)\n\nans = sum([(min_x - i)**2 for i in x])\n\nprint(ans)","code_v0_loc":5,"code_v1_loc":5,"code_v0_num_chars":135,"code_v1_num_chars":134,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nX = np.array(input().split()).astype(int)\nP = round(np.average(X))\nprint((int(np.sum((P - X) ** 2))))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nx = [int(i) for i in input().split()]\nmin_x = round(sum(x) \/ n)\nans = sum([(min_x - i) ** 2 for i in x])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","-","-N = int(eval(input()))","-X = np.array(input().split()).astype(int)","-P = round(np.average(X))","-print((int(np.sum((P - X) ** 2))))","+n = int(eval(input()))","+x = [int(i) for i in input().split()]","+min_x = round(sum(x) \/ n)","+ans = sum([(min_x - i) ** 2 for i in x])","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.1962851752,"measured_runtime_v1":0.2023058402,"runtime_lift":5.9132508194,"key":["s418768557","s739454407"]} +{"user_id":"u873616440","problem_id":"p02780","language":"python","submission_id_v0":"s803345472","submission_id_v1":"s423400256","cpu_time_v0":163,"cpu_time_v1":141,"memory_v0":25952,"memory_v1":25060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\ns = [0] * 1000000\n\nfor i in range(N):\n\n s[i+1] = s[i] + A[i]\n\n\n\nmax_s = 0\n\nfor i in range(N):\n\n if max_s < s[i+K] - s[i]:\n\n max_s = s[i+K] - s[i]\n\n\n\n\n\nprint(((max_s+K) \/ 2))\n\n# optimized version of the same code:\n","target":"N, K = list(map(int, input().split()))\n\np = list(map(int, input().split()))\n\n\n\nm = [(e + 1) \/ 2 for e in p]\n\n\n\nt = sum(m[0:K])\n\nresult = t\n\nfor i in range(N - K):\n\n t -= m[i]\n\n t += m[i + K]\n\n if t > result:\n\n result = t\n\nprint(result)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":261,"code_v1_num_chars":245,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\ns = [0] * 1000000\nfor i in range(N):\n s[i + 1] = s[i] + A[i]\nmax_s = 0\nfor i in range(N):\n if max_s < s[i + K] - s[i]:\n max_s = s[i + K] - s[i]\nprint(((max_s + K) \/ 2))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\np = list(map(int, input().split()))\nm = [(e + 1) \/ 2 for e in p]\nt = sum(m[0:K])\nresult = t\nfor i in range(N - K):\n t -= m[i]\n t += m[i + K]\n if t > result:\n result = t\nprint(result)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-A = list(map(int, input().split()))","-s = [0] * 1000000","-for i in range(N):","- s[i + 1] = s[i] + A[i]","-max_s = 0","-for i in range(N):","- if max_s < s[i + K] - s[i]:","- max_s = s[i + K] - s[i]","-print(((max_s + K) \/ 2))","+p = list(map(int, input().split()))","+m = [(e + 1) \/ 2 for e in p]","+t = sum(m[0:K])","+result = t","+for i in range(N - K):","+ t -= m[i]","+ t += m[i + K]","+ if t > result:","+ result = t","+print(result)"],"diff_only_import_comment":false,"measured_runtime_v0":0.394733299,"measured_runtime_v1":0.2439838529,"runtime_lift":1.6178664873,"key":["s803345472","s423400256"]} +{"user_id":"u392319141","problem_id":"p03208","language":"python","submission_id_v0":"s260498412","submission_id_v1":"s755290756","cpu_time_v0":275,"cpu_time_v1":243,"memory_v0":7384,"memory_v1":7484,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, K = list(map(int, input().split()))\n\n\n\nheight = []\n\nfor _ in range(N) :\n\n height.append(int(eval(input())))\n\n\n\nheight.sort()\n\nans = float('inf')\n\n\n\nfor i in range(N-K+1) :\n\n diff = height[i + K - 1] - height[i]\n\n ans = min(ans, diff)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N, K = list(map(int, input().split()))\n\nH = [int(eval(input())) for _ in range(N)]\n\nH.sort()\n\n\n\nans = 10**18\n\nfor i in range(N - K + 1):\n\n ans = min(ans, H[i + K - 1] - H[i])\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":8,"code_v0_num_chars":247,"code_v1_num_chars":177,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nheight = []\nfor _ in range(N):\n height.append(int(eval(input())))\nheight.sort()\nans = float(\"inf\")\nfor i in range(N - K + 1):\n diff = height[i + K - 1] - height[i]\n ans = min(ans, diff)\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nH = [int(eval(input())) for _ in range(N)]\nH.sort()\nans = 10**18\nfor i in range(N - K + 1):\n ans = min(ans, H[i + K - 1] - H[i])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-height = []","-for _ in range(N):","- height.append(int(eval(input())))","-height.sort()","-ans = float(\"inf\")","+H = [int(eval(input())) for _ in range(N)]","+H.sort()","+ans = 10**18","- diff = height[i + K - 1] - height[i]","- ans = min(ans, diff)","+ ans = min(ans, H[i + K - 1] - H[i])"],"diff_only_import_comment":false,"measured_runtime_v0":0.2545773742,"measured_runtime_v1":0.0892174052,"runtime_lift":2.8534496549,"key":["s260498412","s755290756"]} +{"user_id":"u380524497","problem_id":"p03032","language":"python","submission_id_v0":"s669893633","submission_id_v1":"s465849215","cpu_time_v0":57,"cpu_time_v1":34,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.35,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import deque\n\n\n\nn, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor t in range(k\/\/2 + 1):\n\n hand = deque(V[:k-t])\n\n rest = deque(V[k-t:])\n\n cur_sum = sum(hand)\n\n\n\n for j in range(k-t+1):\n\n put_back = 0\n\n rev_hand = sorted(hand)\n\n\n\n for i in range(t):\n\n jewel = rev_hand[i]\n\n if jewel < 0:\n\n put_back -= jewel\n\n else:\n\n break\n\n\n\n candidate = cur_sum + put_back\n\n ans = max(candidate, ans)\n\n\n\n to_rest = hand.pop()\n\n rest.appendleft(to_rest)\n\n to_hand = rest.pop()\n\n hand.appendleft(to_hand)\n\n\n\n cur_sum += to_hand - to_rest\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\n\n\ndef get_jewelries(box, left_pop, right_pop):\n\n if left_pop + right_pop >= len(box):\n\n return box[:]\n\n\n\n left = box[:left_pop]\n\n right = box[-right_pop:] if right_pop else []\n\n\n\n return left + right\n\n\n\n\n\ncandidates = []\n\npop_max = min(k, n)\n\nfor pop_count in range(pop_max+1):\n\n residue = k - pop_count\n\n\n\n for left_pop in range(pop_count+1):\n\n right_pop = pop_count - left_pop\n\n jewelries = get_jewelries(V, left_pop, right_pop)\n\n jewelries.sort(reverse=True)\n\n\n\n for _ in range(residue):\n\n if not jewelries:\n\n break\n\n if jewelries[-1] < 0:\n\n jewelries.pop()\n\n\n\n value = sum(jewelries)\n\n candidates.append(value)\n\n\n\nprint((max(candidates)))\n","code_v0_loc":33,"code_v1_loc":34,"code_v0_num_chars":732,"code_v1_num_chars":833,"code_v0_no_empty_lines":"from collections import deque\n\nn, k = list(map(int, input().split()))\nV = list(map(int, input().split()))\nans = 0\nfor t in range(k \/\/ 2 + 1):\n hand = deque(V[: k - t])\n rest = deque(V[k - t :])\n cur_sum = sum(hand)\n for j in range(k - t + 1):\n put_back = 0\n rev_hand = sorted(hand)\n for i in range(t):\n jewel = rev_hand[i]\n if jewel < 0:\n put_back -= jewel\n else:\n break\n candidate = cur_sum + put_back\n ans = max(candidate, ans)\n to_rest = hand.pop()\n rest.appendleft(to_rest)\n to_hand = rest.pop()\n hand.appendleft(to_hand)\n cur_sum += to_hand - to_rest\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nV = list(map(int, input().split()))\n\n\ndef get_jewelries(box, left_pop, right_pop):\n if left_pop + right_pop >= len(box):\n return box[:]\n left = box[:left_pop]\n right = box[-right_pop:] if right_pop else []\n return left + right\n\n\ncandidates = []\npop_max = min(k, n)\nfor pop_count in range(pop_max + 1):\n residue = k - pop_count\n for left_pop in range(pop_count + 1):\n right_pop = pop_count - left_pop\n jewelries = get_jewelries(V, left_pop, right_pop)\n jewelries.sort(reverse=True)\n for _ in range(residue):\n if not jewelries:\n break\n if jewelries[-1] < 0:\n jewelries.pop()\n value = sum(jewelries)\n candidates.append(value)\nprint((max(candidates)))\n","code_same":false,"relative_loc_diff_percent":2.9411764706,"diff":["-from collections import deque","-","-ans = 0","-for t in range(k \/\/ 2 + 1):","- hand = deque(V[: k - t])","- rest = deque(V[k - t :])","- cur_sum = sum(hand)","- for j in range(k - t + 1):","- put_back = 0","- rev_hand = sorted(hand)","- for i in range(t):","- jewel = rev_hand[i]","- if jewel < 0:","- put_back -= jewel","- else:","+","+","+def get_jewelries(box, left_pop, right_pop):","+ if left_pop + right_pop >= len(box):","+ return box[:]","+ left = box[:left_pop]","+ right = box[-right_pop:] if right_pop else []","+ return left + right","+","+","+candidates = []","+pop_max = min(k, n)","+for pop_count in range(pop_max + 1):","+ residue = k - pop_count","+ for left_pop in range(pop_count + 1):","+ right_pop = pop_count - left_pop","+ jewelries = get_jewelries(V, left_pop, right_pop)","+ jewelries.sort(reverse=True)","+ for _ in range(residue):","+ if not jewelries:","- candidate = cur_sum + put_back","- ans = max(candidate, ans)","- to_rest = hand.pop()","- rest.appendleft(to_rest)","- to_hand = rest.pop()","- hand.appendleft(to_hand)","- cur_sum += to_hand - to_rest","-print(ans)","+ if jewelries[-1] < 0:","+ jewelries.pop()","+ value = sum(jewelries)","+ candidates.append(value)","+print((max(candidates)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2830656636,"measured_runtime_v1":0.1950679789,"runtime_lift":1.4511129157,"key":["s669893633","s465849215"]} +{"user_id":"u227082700","problem_id":"p02863","language":"python","submission_id_v0":"s340691380","submission_id_v1":"s390961057","cpu_time_v0":541,"cpu_time_v1":362,"memory_v0":216520,"memory_v1":217248,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.09,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,t=list(map(int,input().split()))\n\nab=[list(map(int,input().split()))for _ in range(n)]\n\nab.sort()\n\ndp=[(6007)*[0]for _ in range(n+1)]\n\ndp[0][0]=0\n\nans=0\n\nfor i in range(n):\n\n for j in range(6007):\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\n if j= 50:\n\n break\n\n\n\n print((\" \".join(map(str, A))))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n\n# optimized version of the same code:\n","target":"import copy\n\nfrom functools import lru_cache\n\n#import numpy as np\n\n#from numba import njit\n\n\n\ndef resolve():\n\n N, K = list(map(int, input().split()))\n\n #A = np.array(list(map(int, input().split())))\n\n A = list(map(int, input().split()))\n\n\n\n #N = 2 * 10**5\n\n #K = 2 * 10**5\n\n #A = np.array([0] * N)\n\n\n\n def func(A):\n\n B = [0] * N\n\n for i in range(N):\n\n l = max(0, i - A[i])\n\n r = min(i + A[i], N-1)\n\n B[l] += 1\n\n if r+1 < N:\n\n B[r+1] -= 1\n\n\n\n for i in range(1, N):\n\n B[i] += B[i-1]\n\n return B\n\n\n\n for k in range(K):\n\n #print(k)\n\n A = func(A)\n\n if k >= 50:\n\n break\n\n\n\n print((\" \".join(map(str, A))))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()","code_v0_loc":52,"code_v1_loc":37,"code_v0_num_chars":1071,"code_v1_num_chars":792,"code_v0_no_empty_lines":"import copy\nfrom functools import lru_cache\nimport numpy as np\nfrom numba import njit\n\n# @njit\n# @njit('(i8[::1],)', cache=True)\n# def func(A):\n# N = len(A)\n# B = np.zeros_like(A)\n# for i in range(N):\n# l = max(0, i - A[i])\n# r = min(i + A[i], N-1)\n# B[l] += 1\n# if r+1 < N:\n# B[r+1] -= 1\n# B = np.cumsum(B)\n# return B\ndef resolve():\n N, K = list(map(int, input().split()))\n A = np.array(list(map(int, input().split())))\n # N = 2 * 10**5\n # K = 2 * 10**5\n # A = np.array([0] * N)\n @njit\n def func(A):\n # N = len(A)\n B = np.zeros_like(A)\n for i in range(N):\n l = max(0, i - A[i])\n r = min(i + A[i], N - 1)\n B[l] += 1\n if r + 1 < N:\n B[r + 1] -= 1\n B = np.cumsum(B)\n return B\n\n for k in range(K):\n # print(k)\n A = func(A)\n if k >= 50:\n break\n print((\" \".join(map(str, A))))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"import copy\nfrom functools import lru_cache\n\n# import numpy as np\n# from numba import njit\ndef resolve():\n N, K = list(map(int, input().split()))\n # A = np.array(list(map(int, input().split())))\n A = list(map(int, input().split()))\n # N = 2 * 10**5\n # K = 2 * 10**5\n # A = np.array([0] * N)\n def func(A):\n B = [0] * N\n for i in range(N):\n l = max(0, i - A[i])\n r = min(i + A[i], N - 1)\n B[l] += 1\n if r + 1 < N:\n B[r + 1] -= 1\n for i in range(1, N):\n B[i] += B[i - 1]\n return B\n\n for k in range(K):\n # print(k)\n A = func(A)\n if k >= 50:\n break\n print((\" \".join(map(str, A))))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":28.8461538462,"diff":["-import numpy as np","-from numba import njit","-# @njit","-# @njit('(i8[::1],)', cache=True)","-# def func(A):","-# N = len(A)","-# B = np.zeros_like(A)","-# for i in range(N):","-# l = max(0, i - A[i])","-# r = min(i + A[i], N-1)","-# B[l] += 1","-# if r+1 < N:","-# B[r+1] -= 1","-# B = np.cumsum(B)","-# return B","+# import numpy as np","+# from numba import njit","- A = np.array(list(map(int, input().split())))","+ # A = np.array(list(map(int, input().split())))","+ A = list(map(int, input().split()))","- @njit","- # N = len(A)","- B = np.zeros_like(A)","+ B = [0] * N","- B = np.cumsum(B)","+ for i in range(1, N):","+ B[i] += B[i - 1]"],"diff_only_import_comment":false,"measured_runtime_v0":1.3551732968,"measured_runtime_v1":0.2157634698,"runtime_lift":6.280828252,"key":["s947547146","s829816575"]} +{"user_id":"u867069435","problem_id":"p03399","language":"python","submission_id_v0":"s852784971","submission_id_v1":"s460322800","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c, d = int(eval(input())), int(eval(input())), int(eval(input())), int(eval(input())),\n\nprint((min(a, b)+min(c, d)))\n\n# optimized version of the same code:\n","target":"print((min(int(eval(input())), int(eval(input()))) + min(int(eval(input())), int(eval(input())))))","code_v0_loc":2,"code_v1_loc":1,"code_v0_num_chars":96,"code_v1_num_chars":72,"code_v0_no_empty_lines":"a, b, c, d = (\n int(eval(input())),\n int(eval(input())),\n int(eval(input())),\n int(eval(input())),\n)\nprint((min(a, b) + min(c, d)))\n","code_v1_no_empty_lines":"print(\n (\n min(int(eval(input())), int(eval(input())))\n + min(int(eval(input())), int(eval(input())))\n )\n)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-a, b, c, d = (","- int(eval(input())),","- int(eval(input())),","- int(eval(input())),","- int(eval(input())),","+print(","+ (","+ min(int(eval(input())), int(eval(input())))","+ + min(int(eval(input())), int(eval(input())))","+ )","-print((min(a, b) + min(c, d)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2959700694,"measured_runtime_v1":0.2359499116,"runtime_lift":1.2543766912,"key":["s852784971","s460322800"]} +{"user_id":"u021019433","problem_id":"p02837","language":"python","submission_id_v0":"s475579950","submission_id_v1":"s165212154","cpu_time_v0":219,"cpu_time_v1":58,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef popcount(x):\n\n r = 0\n\n while x:\n\n if x & 1:\n\n r += 1\n\n x >>= 1\n\n return r\n\n\n\nn = int(eval(input()))\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(eval(input()))):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\n\n\nm = 0\n\nl = (1 << n) - 1\n\nfor x in range(1, l + 1):\n\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n\n m = max(m, popcount(x))\n\nprint(m)\n\n\n# optimized version of the same code:\n","target":"from itertools import combinations\n\n \n\nn = int(eval(input()))\n\nr = list(range(n))\n\na = [(set(), set()) for _ in r]\n\nfor i in r:\n\n for _ in range(int(eval(input()))):\n\n x, y = list(map(int, input().split()))\n\n a[i][y].add(x - 1)\n\n \n\nfail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)\n\n \n\nwhile all(map(fail, list(map(set, combinations(r, n))))):\n\n n -= 1\n\nprint(n)","code_v0_loc":22,"code_v1_loc":15,"code_v0_num_chars":430,"code_v1_num_chars":365,"code_v0_no_empty_lines":"def popcount(x):\n r = 0\n while x:\n if x & 1:\n r += 1\n x >>= 1\n return r\n\n\nn = int(eval(input()))\nr = list(range(n))\na = [[0, 0] for _ in r]\nfor i in r:\n for _ in range(int(eval(input()))):\n x, y = list(map(int, input().split()))\n a[i][y] |= 1 << (x - 1)\nm = 0\nl = (1 << n) - 1\nfor x in range(1, l + 1):\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n m = max(m, popcount(x))\nprint(m)\n","code_v1_no_empty_lines":"from itertools import combinations\n\nn = int(eval(input()))\nr = list(range(n))\na = [(set(), set()) for _ in r]\nfor i in r:\n for _ in range(int(eval(input()))):\n x, y = list(map(int, input().split()))\n a[i][y].add(x - 1)\nfail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)\nwhile all(map(fail, list(map(set, combinations(r, n))))):\n n -= 1\nprint(n)\n","code_same":false,"relative_loc_diff_percent":31.8181818182,"diff":["-def popcount(x):","- r = 0","- while x:","- if x & 1:","- r += 1","- x >>= 1","- return r","-","+from itertools import combinations","-a = [[0, 0] for _ in r]","+a = [(set(), set()) for _ in r]","- a[i][y] |= 1 << (x - 1)","-m = 0","-l = (1 << n) - 1","-for x in range(1, l + 1):","- if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):","- m = max(m, popcount(x))","-print(m)","+ a[i][y].add(x - 1)","+fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)","+while all(map(fail, list(map(set, combinations(r, n))))):","+ n -= 1","+print(n)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2279194756,"measured_runtime_v1":0.0067682672,"runtime_lift":33.6747161436,"key":["s475579950","s165212154"]} +{"user_id":"u893063840","problem_id":"p03039","language":"python","submission_id_v0":"s835548762","submission_id_v1":"s860519661","cpu_time_v0":1667,"cpu_time_v1":328,"memory_v0":85236,"memory_v1":18804,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.32,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, m, k = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\nMAX = n * m\n\n\n\n\n\nclass ModInt:\n\n def __init__(self, num):\n\n self.num = num\n\n\n\n def __str__(self):\n\n return str(self.num)\n\n\n\n def __repr__(self):\n\n return \"ModInt(num: {}, mod: {}\".format(self.num, mod)\n\n\n\n def __add__(self, other):\n\n ret = self.num + other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __sub__(self, other):\n\n ret = self.num - other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __mul__(self, other):\n\n ret = self.num * other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def pow(self, times):\n\n pw = pow(self.num, times, mod)\n\n return ModInt(pw)\n\n\n\n def inverse(self):\n\n return ModInt(inv[self.num])\n\n\n\n def __truediv__(self, other):\n\n num = self * other.inverse()\n\n return ModInt(num)\n\n\n\n\n\ndef comb(n, k):\n\n return fact[n] * inv[n-k] * inv[k]\n\n\n\n\n\nfact = [None] * (MAX + 1)\n\nfact[0] = ModInt(1)\n\nfor i in range(1, MAX + 1):\n\n fact[i] = fact[i-1] * ModInt(i)\n\n\n\ninv = [None] * (MAX + 1)\n\ninv[MAX] = fact[MAX].pow(mod - 2)\n\nfor i in range(MAX, 0, -1):\n\n inv[i-1] = inv[i] * ModInt(i)\n\n\n\nans = ModInt(0)\n\nfor i in range(n):\n\n for j in range(m):\n\n add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)\n\n if i != 0 and j != 0:\n\n add *= ModInt(2)\n\n\n\n ans += add\n\n\n\nans *= comb(n * m - 2, k - 2)\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"n, m, k = list(map(int, input().split()))\n\n\n\nmod = 10 ** 9 + 7\n\nMAX = n * m\n\n\n\nfact = [1] * (MAX + 1)\n\nfor i in range(1, MAX + 1):\n\n fact[i] = (fact[i-1] * i) % mod\n\n\n\ninv = [1] * (MAX + 1)\n\ninv[MAX] = pow(fact[MAX], mod - 2, mod)\n\nfor i in range(MAX, 0, -1):\n\n inv[i-1] = (inv[i] * i) % mod\n\n\n\n\n\ndef comb(n, k):\n\n return fact[n] * inv[n-k] * inv[k] % mod\n\n\n\n\n\nans = 0\n\nfor i in range(n):\n\n for j in range(m):\n\n add = (n - i) * (m - j) * (i + j) % mod\n\n if i != 0 and j != 0:\n\n add *= 2\n\n add %= mod\n\n\n\n ans += add\n\n ans %= mod\n\n\n\nans *= comb(MAX - 2, k - 2)\n\nans %= mod\n\nprint(ans)\n","code_v0_loc":67,"code_v1_loc":33,"code_v0_num_chars":1460,"code_v1_num_chars":639,"code_v0_no_empty_lines":"n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nMAX = n * m\n\n\nclass ModInt:\n def __init__(self, num):\n self.num = num\n\n def __str__(self):\n return str(self.num)\n\n def __repr__(self):\n return \"ModInt(num: {}, mod: {}\".format(self.num, mod)\n\n def __add__(self, other):\n ret = self.num + other.num\n ret %= mod\n return ModInt(ret)\n\n def __sub__(self, other):\n ret = self.num - other.num\n ret %= mod\n return ModInt(ret)\n\n def __mul__(self, other):\n ret = self.num * other.num\n ret %= mod\n return ModInt(ret)\n\n def pow(self, times):\n pw = pow(self.num, times, mod)\n return ModInt(pw)\n\n def inverse(self):\n return ModInt(inv[self.num])\n\n def __truediv__(self, other):\n num = self * other.inverse()\n return ModInt(num)\n\n\ndef comb(n, k):\n return fact[n] * inv[n - k] * inv[k]\n\n\nfact = [None] * (MAX + 1)\nfact[0] = ModInt(1)\nfor i in range(1, MAX + 1):\n fact[i] = fact[i - 1] * ModInt(i)\ninv = [None] * (MAX + 1)\ninv[MAX] = fact[MAX].pow(mod - 2)\nfor i in range(MAX, 0, -1):\n inv[i - 1] = inv[i] * ModInt(i)\nans = ModInt(0)\nfor i in range(n):\n for j in range(m):\n add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)\n if i != 0 and j != 0:\n add *= ModInt(2)\n ans += add\nans *= comb(n * m - 2, k - 2)\nprint(ans)\n","code_v1_no_empty_lines":"n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nMAX = n * m\nfact = [1] * (MAX + 1)\nfor i in range(1, MAX + 1):\n fact[i] = (fact[i - 1] * i) % mod\ninv = [1] * (MAX + 1)\ninv[MAX] = pow(fact[MAX], mod - 2, mod)\nfor i in range(MAX, 0, -1):\n inv[i - 1] = (inv[i] * i) % mod\n\n\ndef comb(n, k):\n return fact[n] * inv[n - k] * inv[k] % mod\n\n\nans = 0\nfor i in range(n):\n for j in range(m):\n add = (n - i) * (m - j) * (i + j) % mod\n if i != 0 and j != 0:\n add *= 2\n add %= mod\n ans += add\n ans %= mod\nans *= comb(MAX - 2, k - 2)\nans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.7462686567,"diff":["-","-","-class ModInt:","- def __init__(self, num):","- self.num = num","-","- def __str__(self):","- return str(self.num)","-","- def __repr__(self):","- return \"ModInt(num: {}, mod: {}\".format(self.num, mod)","-","- def __add__(self, other):","- ret = self.num + other.num","- ret %= mod","- return ModInt(ret)","-","- def __sub__(self, other):","- ret = self.num - other.num","- ret %= mod","- return ModInt(ret)","-","- def __mul__(self, other):","- ret = self.num * other.num","- ret %= mod","- return ModInt(ret)","-","- def pow(self, times):","- pw = pow(self.num, times, mod)","- return ModInt(pw)","-","- def inverse(self):","- return ModInt(inv[self.num])","-","- def __truediv__(self, other):","- num = self * other.inverse()","- return ModInt(num)","+fact = [1] * (MAX + 1)","+for i in range(1, MAX + 1):","+ fact[i] = (fact[i - 1] * i) % mod","+inv = [1] * (MAX + 1)","+inv[MAX] = pow(fact[MAX], mod - 2, mod)","+for i in range(MAX, 0, -1):","+ inv[i - 1] = (inv[i] * i) % mod","- return fact[n] * inv[n - k] * inv[k]","+ return fact[n] * inv[n - k] * inv[k] % mod","-fact = [None] * (MAX + 1)","-fact[0] = ModInt(1)","-for i in range(1, MAX + 1):","- fact[i] = fact[i - 1] * ModInt(i)","-inv = [None] * (MAX + 1)","-inv[MAX] = fact[MAX].pow(mod - 2)","-for i in range(MAX, 0, -1):","- inv[i - 1] = inv[i] * ModInt(i)","-ans = ModInt(0)","+ans = 0","- add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)","+ add = (n - i) * (m - j) * (i + j) % mod","- add *= ModInt(2)","+ add *= 2","+ add %= mod","-ans *= comb(n * m - 2, k - 2)","+ ans %= mod","+ans *= comb(MAX - 2, k - 2)","+ans %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":1.0146762717,"measured_runtime_v1":0.4959636457,"runtime_lift":2.0458682415,"key":["s835548762","s860519661"]} +{"user_id":"u600402037","problem_id":"p02792","language":"python","submission_id_v0":"s118732898","submission_id_v1":"s414047719","cpu_time_v0":343,"cpu_time_v1":199,"memory_v0":12500,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.98,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN = ir()\n\n# A\u306e\u5148\u982d\u306e\u6841\u3068\u672b\u5c3e\u306e\u6841\u306e\u7d44\u307f\u5408\u308f\u305b\u306f9*10=90\u901a\u308a\u3060\u3051\n\ntable = [[0] * 10 for i in range(10)]\n\nfor x in range(1, N+1):\n\n x = str(x)\n\n i = int(x[0])\n\n j = int(x[-1])\n\n table[i][j] += 1\n\n\n\ntable = np.array(table)\n\nanswer = (table * table.T).sum()\n\nprint(answer)\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN = ir()\n\ncount = [[0] * 10 for _ in range(10)] # dp[head][tail]\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n head = int(s[0]); tail = int(s[-1])\n\n count[head][tail] += 1\n\n\n\nanswer = 0\n\nfor h in range(10):\n\n for t in range(10):\n\n answer += count[h][t] * count[t][h]\n\nprint(answer)\n","code_v0_loc":19,"code_v1_loc":18,"code_v0_num_chars":406,"code_v1_num_chars":422,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN = ir()\n# A\u306e\u5148\u982d\u306e\u6841\u3068\u672b\u5c3e\u306e\u6841\u306e\u7d44\u307f\u5408\u308f\u305b\u306f9*10=90\u901a\u308a\u3060\u3051\ntable = [[0] * 10 for i in range(10)]\nfor x in range(1, N + 1):\n x = str(x)\n i = int(x[0])\n j = int(x[-1])\n table[i][j] += 1\ntable = np.array(table)\nanswer = (table * table.T).sum()\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN = ir()\ncount = [[0] * 10 for _ in range(10)] # dp[head][tail]\nfor i in range(1, N + 1):\n s = str(i)\n head = int(s[0])\n tail = int(s[-1])\n count[head][tail] += 1\nanswer = 0\nfor h in range(10):\n for t in range(10):\n answer += count[h][t] * count[t][h]\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-import numpy as np","-# A\u306e\u5148\u982d\u306e\u6841\u3068\u672b\u5c3e\u306e\u6841\u306e\u7d44\u307f\u5408\u308f\u305b\u306f9*10=90\u901a\u308a\u3060\u3051","-table = [[0] * 10 for i in range(10)]","-for x in range(1, N + 1):","- x = str(x)","- i = int(x[0])","- j = int(x[-1])","- table[i][j] += 1","-table = np.array(table)","-answer = (table * table.T).sum()","+count = [[0] * 10 for _ in range(10)] # dp[head][tail]","+for i in range(1, N + 1):","+ s = str(i)","+ head = int(s[0])","+ tail = int(s[-1])","+ count[head][tail] += 1","+answer = 0","+for h in range(10):","+ for t in range(10):","+ answer += count[h][t] * count[t][h]"],"diff_only_import_comment":false,"measured_runtime_v0":1.4269222763,"measured_runtime_v1":0.2967054391,"runtime_lift":4.8092218352,"key":["s118732898","s414047719"]} +{"user_id":"u644907318","problem_id":"p03241","language":"python","submission_id_v0":"s205255104","submission_id_v1":"s496579949","cpu_time_v0":180,"cpu_time_v1":73,"memory_v0":38640,"memory_v1":63824,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.44,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,M = list(map(int,input().split()))\n\nif N==1:\n\n nmax=M\n\nelse:\n\n nmax = 1\n\n for i in range(2,int(M**0.5)+1):\n\n if M%i==0 and M\/\/i>=N:\n\n nmax = max(nmax,i)\n\n if M%i==0 and i>=N:\n\n nmax = max(nmax,M\/\/i)\n\nprint(nmax)\n\n# optimized version of the same code:\n","target":"N,M = list(map(int,input().split()))\n\namax = 1\n\nfor i in range(1,int(M**0.5)+1):\n\n if M%i==0:\n\n a = i\n\n b = M\/\/i\n\n if b>=N:\n\n amax = max(amax,a)\n\n a,b = b,a\n\n if b>=N:\n\n amax = max(amax,a)\n\nprint(amax)","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":252,"code_v1_num_chars":255,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nif N == 1:\n nmax = M\nelse:\n nmax = 1\n for i in range(2, int(M**0.5) + 1):\n if M % i == 0 and M \/\/ i >= N:\n nmax = max(nmax, i)\n if M % i == 0 and i >= N:\n nmax = max(nmax, M \/\/ i)\nprint(nmax)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\namax = 1\nfor i in range(1, int(M**0.5) + 1):\n if M % i == 0:\n a = i\n b = M \/\/ i\n if b >= N:\n amax = max(amax, a)\n a, b = b, a\n if b >= N:\n amax = max(amax, a)\nprint(amax)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-if N == 1:","- nmax = M","-else:","- nmax = 1","- for i in range(2, int(M**0.5) + 1):","- if M % i == 0 and M \/\/ i >= N:","- nmax = max(nmax, i)","- if M % i == 0 and i >= N:","- nmax = max(nmax, M \/\/ i)","-print(nmax)","+amax = 1","+for i in range(1, int(M**0.5) + 1):","+ if M % i == 0:","+ a = i","+ b = M \/\/ i","+ if b >= N:","+ amax = max(amax, a)","+ a, b = b, a","+ if b >= N:","+ amax = max(amax, a)","+print(amax)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3445633175,"measured_runtime_v1":0.2717220852,"runtime_lift":1.26807255,"key":["s205255104","s496579949"]} +{"user_id":"u628335443","problem_id":"p03162","language":"python","submission_id_v0":"s314983266","submission_id_v1":"s746344991","cpu_time_v0":1077,"cpu_time_v1":699,"memory_v0":56144,"memory_v1":50192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.1,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\na = np.array([input().split() for i in range(N)], dtype=int)\n\n\n\ndp = np.zeros((N, 3), dtype=int)\n\ndp[0] = a[0]\n\n\n\nfor i in range(1, N):\n\n dp[i] = [\n\n a[i][0] + max(dp[i - 1][1], dp[i - 1][2]),\n\n a[i][1] + max(dp[i - 1][2], dp[i - 1][0]),\n\n a[i][2] + max(dp[i - 1][0], dp[i - 1][1]),\n\n ]\n\n\n\nprint((np.max(dp[-1])))\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\na = [list(map(int, input().split())) for _ in range(N)]\n\n\n\ndp = [[0, 0, 0] for _ in range(N+1)]\n\n\n\nfor i in range(N):\n\n for j in range(3):\n\n for k in range(3):\n\n if j == k:\n\n continue\n\n dp[i+1][k] = max(dp[i+1][k], dp[i][j] + a[i][k])\n\n\n\nprint((max(dp[-1])))\n","code_v0_loc":16,"code_v1_loc":13,"code_v0_num_chars":379,"code_v1_num_chars":322,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\na = np.array([input().split() for i in range(N)], dtype=int)\ndp = np.zeros((N, 3), dtype=int)\ndp[0] = a[0]\nfor i in range(1, N):\n dp[i] = [\n a[i][0] + max(dp[i - 1][1], dp[i - 1][2]),\n a[i][1] + max(dp[i - 1][2], dp[i - 1][0]),\n a[i][2] + max(dp[i - 1][0], dp[i - 1][1]),\n ]\nprint((np.max(dp[-1])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\na = [list(map(int, input().split())) for _ in range(N)]\ndp = [[0, 0, 0] for _ in range(N + 1)]\nfor i in range(N):\n for j in range(3):\n for k in range(3):\n if j == k:\n continue\n dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + a[i][k])\nprint((max(dp[-1])))\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-import numpy as np","-","-a = np.array([input().split() for i in range(N)], dtype=int)","-dp = np.zeros((N, 3), dtype=int)","-dp[0] = a[0]","-for i in range(1, N):","- dp[i] = [","- a[i][0] + max(dp[i - 1][1], dp[i - 1][2]),","- a[i][1] + max(dp[i - 1][2], dp[i - 1][0]),","- a[i][2] + max(dp[i - 1][0], dp[i - 1][1]),","- ]","-print((np.max(dp[-1])))","+a = [list(map(int, input().split())) for _ in range(N)]","+dp = [[0, 0, 0] for _ in range(N + 1)]","+for i in range(N):","+ for j in range(3):","+ for k in range(3):","+ if j == k:","+ continue","+ dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + a[i][k])","+print((max(dp[-1])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3170761042,"measured_runtime_v1":0.2653971686,"runtime_lift":4.9626607205,"key":["s314983266","s746344991"]} +{"user_id":"u543954314","problem_id":"p02596","language":"python","submission_id_v0":"s410919516","submission_id_v1":"s753895766","cpu_time_v0":302,"cpu_time_v1":127,"memory_v0":114648,"memory_v1":9196,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\nreadline = sys.stdin.readline\n\nreadall = sys.stdin.read\n\nns = lambda: readline().rstrip()\n\nni = lambda: int(readline().rstrip())\n\nnm = lambda: map(int, readline().split())\n\nnl = lambda: list(map(int, readline().split()))\n\nprn = lambda x: print(*x, sep='\\n')\n\n\n\ndef solve():\n\n d = dict()\n\n k = ni()\n\n c = 7 % k\n\n x = d[c] = 1\n\n while True:\n\n c = (c * 10 + 7) % k\n\n if c in d:\n\n break\n\n x += 1\n\n d[c] = x\n\n print(d.get(0, -1))\n\n return\n\n\n\nsolve()\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nreadline = sys.stdin.readline\n\nreadall = sys.stdin.read\n\nns = lambda: readline().rstrip()\n\nni = lambda: int(readline().rstrip())\n\nnm = lambda: map(int, readline().split())\n\nnl = lambda: list(map(int, readline().split()))\n\nprn = lambda x: print(*x, sep='\\n')\n\n\n\ndef solve():\n\n k = ni()\n\n c = 0\n\n for i in range(k):\n\n c = (c * 10 + 7) % k\n\n if c == 0:\n\n print(i+1)\n\n break\n\n else:\n\n print(-1)\n\n return\n\n\n\nsolve()\n","code_v0_loc":25,"code_v1_loc":23,"code_v0_num_chars":519,"code_v1_num_chars":483,"code_v0_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nreadall = sys.stdin.read\nns = lambda: readline().rstrip()\nni = lambda: int(readline().rstrip())\nnm = lambda: map(int, readline().split())\nnl = lambda: list(map(int, readline().split()))\nprn = lambda x: print(*x, sep=\"\\n\")\n\n\ndef solve():\n d = dict()\n k = ni()\n c = 7 % k\n x = d[c] = 1\n while True:\n c = (c * 10 + 7) % k\n if c in d:\n break\n x += 1\n d[c] = x\n print(d.get(0, -1))\n return\n\n\nsolve()\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nreadall = sys.stdin.read\nns = lambda: readline().rstrip()\nni = lambda: int(readline().rstrip())\nnm = lambda: map(int, readline().split())\nnl = lambda: list(map(int, readline().split()))\nprn = lambda x: print(*x, sep=\"\\n\")\n\n\ndef solve():\n k = ni()\n c = 0\n for i in range(k):\n c = (c * 10 + 7) % k\n if c == 0:\n print(i + 1)\n break\n else:\n print(-1)\n return\n\n\nsolve()\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["- d = dict()","- c = 7 % k","- x = d[c] = 1","- while True:","+ c = 0","+ for i in range(k):","- if c in d:","+ if c == 0:","+ print(i + 1)","- x += 1","- d[c] = x","- print(d.get(0, -1))","+ else:","+ print(-1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.7691566973,"measured_runtime_v1":0.3673865876,"runtime_lift":2.0935894863,"key":["s410919516","s753895766"]} +{"user_id":"u561083515","problem_id":"p02959","language":"python","submission_id_v0":"s872669573","submission_id_v1":"s116182226","cpu_time_v0":274,"cpu_time_v1":160,"memory_v0":73316,"memory_v1":19648,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\nbefore = sum(A)\n\n\n\nfor i in range(N):\n\n nokori = B[i]\n\n for j in range(i,i+2):\n\n if nokori >= A[j]:\n\n nokori -= A[j]\n\n A[j] = 0\n\n else:\n\n A[j] -= nokori\n\n nokori = 0\n\nafter = sum(A)\n\n\n\nprint((before - after))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\n\n\ncnt = 0\n\nfor i in range(N):\n\n if B[i] >= A[i]:\n\n cnt += A[i]\n\n B[i] -= A[i]\n\n else:\n\n cnt += B[i]\n\n B[i] = 0\n\n if B[i] == 0:\n\n continue\n\n if B[i] >= A[i+1]:\n\n cnt += A[i+1]\n\n A[i+1] = 0\n\n else:\n\n cnt += B[i]\n\n A[i+1] -= B[i]\n\n\n\nprint(cnt)","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":440,"code_v1_num_chars":414,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nN = int(eval(input()))\nA = [int(i) for i in input().split()]\nB = [int(i) for i in input().split()]\nbefore = sum(A)\nfor i in range(N):\n nokori = B[i]\n for j in range(i, i + 2):\n if nokori >= A[j]:\n nokori -= A[j]\n A[j] = 0\n else:\n A[j] -= nokori\n nokori = 0\nafter = sum(A)\nprint((before - after))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(i) for i in input().split()]\nB = [int(i) for i in input().split()]\ncnt = 0\nfor i in range(N):\n if B[i] >= A[i]:\n cnt += A[i]\n B[i] -= A[i]\n else:\n cnt += B[i]\n B[i] = 0\n if B[i] == 0:\n continue\n if B[i] >= A[i + 1]:\n cnt += A[i + 1]\n A[i + 1] = 0\n else:\n cnt += B[i]\n A[i + 1] -= B[i]\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-import sys","-","-input = sys.stdin.readline","-sys.setrecursionlimit(10**7)","-before = sum(A)","+cnt = 0","- nokori = B[i]","- for j in range(i, i + 2):","- if nokori >= A[j]:","- nokori -= A[j]","- A[j] = 0","- else:","- A[j] -= nokori","- nokori = 0","-after = sum(A)","-print((before - after))","+ if B[i] >= A[i]:","+ cnt += A[i]","+ B[i] -= A[i]","+ else:","+ cnt += B[i]","+ B[i] = 0","+ if B[i] == 0:","+ continue","+ if B[i] >= A[i + 1]:","+ cnt += A[i + 1]","+ A[i + 1] = 0","+ else:","+ cnt += B[i]","+ A[i + 1] -= B[i]","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3369382279,"measured_runtime_v1":0.0062937415,"runtime_lift":53.5354413986,"key":["s872669573","s116182226"]} +{"user_id":"u144913062","problem_id":"p03457","language":"python","submission_id_v0":"s956976175","submission_id_v1":"s285518014","cpu_time_v0":628,"cpu_time_v1":555,"memory_v0":62040,"memory_v1":46056,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\n\nfor i in range(N):\n\n t1, x1, y1 = txy[i]\n\n t2, x2, y2 = txy[i+1]\n\n if abs(x2-x1) + abs(y2-y1) <= t2 - t1 and (x1+y1+x2+y2) % 2 == (t2-t1) % 2:\n\n continue\n\n else:\n\n print('No')\n\n exit()\n\nprint('Yes')\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nt0 = x0 = y0 = 0\n\nfor _ in range(N):\n\n t1, x1, y1 = list(map(int, input().split()))\n\n d = abs(x1 - x0) + abs(y1 - y0)\n\n if d > t1 - t0 or d % 2 != (t1 - t0) % 2:\n\n print('No')\n\n exit()\n\n t0, x0, y0 = t1, x1, y1\n\nprint('Yes')\n","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":323,"code_v1_num_chars":263,"code_v0_no_empty_lines":"N = int(eval(input()))\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\nfor i in range(N):\n t1, x1, y1 = txy[i]\n t2, x2, y2 = txy[i + 1]\n if (\n abs(x2 - x1) + abs(y2 - y1) <= t2 - t1\n and (x1 + y1 + x2 + y2) % 2 == (t2 - t1) % 2\n ):\n continue\n else:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nt0 = x0 = y0 = 0\nfor _ in range(N):\n t1, x1, y1 = list(map(int, input().split()))\n d = abs(x1 - x0) + abs(y1 - y0)\n if d > t1 - t0 or d % 2 != (t1 - t0) % 2:\n print(\"No\")\n exit()\n t0, x0, y0 = t1, x1, y1\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-txy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]","-for i in range(N):","- t1, x1, y1 = txy[i]","- t2, x2, y2 = txy[i + 1]","- if (","- abs(x2 - x1) + abs(y2 - y1) <= t2 - t1","- and (x1 + y1 + x2 + y2) % 2 == (t2 - t1) % 2","- ):","- continue","- else:","+t0 = x0 = y0 = 0","+for _ in range(N):","+ t1, x1, y1 = list(map(int, input().split()))","+ d = abs(x1 - x0) + abs(y1 - y0)","+ if d > t1 - t0 or d % 2 != (t1 - t0) % 2:","+ t0, x0, y0 = t1, x1, y1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3724059272,"measured_runtime_v1":0.2797260373,"runtime_lift":1.3313237867,"key":["s956976175","s285518014"]} +{"user_id":"u227082700","problem_id":"p02834","language":"python","submission_id_v0":"s854767798","submission_id_v1":"s662268715","cpu_time_v0":780,"cpu_time_v1":670,"memory_v0":84508,"memory_v1":38312,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.1,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,u,v=list(map(int,input().split()))\n\nanss=0\n\nu-=1\n\nv-=1\n\nd=[[]for _ in range(n)]\n\ninf=float('inf')\n\naoki=[inf]*n\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n d[a].append(b)\n\n d[b].append(a)\n\nQ=d[v]\n\naoki[v]=0\n\ndis=1\n\nvisited={v}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n aoki[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[u]\n\nchokudai=[-1]*n\n\nchokudai[u]=0\n\ndis=1\n\nvisited={u}\n\npoint=-1\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if aoki[j]<=dis+1:\n\n if aoki[j]==dis+1:anss=1\n\n if point<0:point=i\n\n continue\n\n if j not in visited:P.append(j)\n\n chokudai[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[point]\n\ndis=chokudai[point]+1\n\nvisited={point}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n if chokudai[i]==-1:continue\n\n chokudai[i]=max(dis,chokudai[i])\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n dis+=1\n\n Q=P\n\nans=0\n\nfor i in range(n):\n\n if aoki[i]>chokudai[i]:ans=max(ans,chokudai[i])\n\nprint((ans+anss))\n\n#print(aoki)\n\n#print(chokudai)\n\n# optimized version of the same code:\n","target":"n,u,v=list(map(int,input().split()))\n\nu-=1\n\nv-=1\n\ne=[[]for _ in range(n)]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n e[a].append(b)\n\n e[b].append(a)\n\ncho=[u]\n\ncho_dis=[10**7]*n\n\ncho_dis[u]=0\n\ncho_visited={u}\n\ncountt=1\n\nwhile cho:\n\n CHO=[]\n\n for i in cho:\n\n for j in e[i]:\n\n if j in cho_visited:continue\n\n cho_visited.add(j)\n\n CHO.append(j)\n\n cho_dis[j]=countt\n\n countt+=1\n\n cho=CHO\n\naok=[v]\n\naok_dis=[10**7]*n\n\naok_dis[v]=0\n\naok_visited={v}\n\ncountt=1\n\nwhile aok:\n\n AOK=[]\n\n for i in aok:\n\n for j in e[i]:\n\n if j in aok_visited:continue\n\n aok_visited.add(j)\n\n AOK.append(j)\n\n aok_dis[j]=countt\n\n countt+=1\n\n aok=AOK\n\nans=0\n\nfor i in range(n):\n\n if cho_dis[i] chokudai[i]:\n ans = max(ans, chokudai[i])\nprint((ans + anss))\n# print(aoki)\n# print(chokudai)\n","code_v1_no_empty_lines":"n, u, v = list(map(int, input().split()))\nu -= 1\nv -= 1\ne = [[] for _ in range(n)]\nfor i in range(n - 1):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n e[a].append(b)\n e[b].append(a)\ncho = [u]\ncho_dis = [10**7] * n\ncho_dis[u] = 0\ncho_visited = {u}\ncountt = 1\nwhile cho:\n CHO = []\n for i in cho:\n for j in e[i]:\n if j in cho_visited:\n continue\n cho_visited.add(j)\n CHO.append(j)\n cho_dis[j] = countt\n countt += 1\n cho = CHO\naok = [v]\naok_dis = [10**7] * n\naok_dis[v] = 0\naok_visited = {v}\ncountt = 1\nwhile aok:\n AOK = []\n for i in aok:\n for j in e[i]:\n if j in aok_visited:\n continue\n aok_visited.add(j)\n AOK.append(j)\n aok_dis[j] = countt\n countt += 1\n aok = AOK\nans = 0\nfor i in range(n):\n if cho_dis[i] < aok_dis[i]:\n ans = max(ans, aok_dis[i] - 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":31.25,"diff":["-anss = 0","-d = [[] for _ in range(n)]","-inf = float(\"inf\")","-aoki = [inf] * n","+e = [[] for _ in range(n)]","- d[a].append(b)","- d[b].append(a)","-Q = d[v]","-aoki[v] = 0","-dis = 1","-visited = {v}","-while Q:","- P = []","- for i in Q:","- visited.add(i)","- for j in d[i]:","- if j not in visited:","- P.append(j)","- aoki[i] = dis","- dis += 1","- Q = P","-Q = d[u]","-chokudai = [-1] * n","-chokudai[u] = 0","-dis = 1","-visited = {u}","-point = -1","-while Q:","- P = []","- for i in Q:","- visited.add(i)","- for j in d[i]:","- if aoki[j] <= dis + 1:","- if aoki[j] == dis + 1:","- anss = 1","- if point < 0:","- point = i","+ e[a].append(b)","+ e[b].append(a)","+cho = [u]","+cho_dis = [10**7] * n","+cho_dis[u] = 0","+cho_visited = {u}","+countt = 1","+while cho:","+ CHO = []","+ for i in cho:","+ for j in e[i]:","+ if j in cho_visited:","- if j not in visited:","- P.append(j)","- chokudai[i] = dis","- dis += 1","- Q = P","-Q = d[point]","-dis = chokudai[point] + 1","-visited = {point}","-while Q:","- P = []","- for i in Q:","- visited.add(i)","- if chokudai[i] == -1:","- continue","- chokudai[i] = max(dis, chokudai[i])","- for j in d[i]:","- if j not in visited:","- P.append(j)","- dis += 1","- Q = P","+ cho_visited.add(j)","+ CHO.append(j)","+ cho_dis[j] = countt","+ countt += 1","+ cho = CHO","+aok = [v]","+aok_dis = [10**7] * n","+aok_dis[v] = 0","+aok_visited = {v}","+countt = 1","+while aok:","+ AOK = []","+ for i in aok:","+ for j in e[i]:","+ if j in aok_visited:","+ continue","+ aok_visited.add(j)","+ AOK.append(j)","+ aok_dis[j] = countt","+ countt += 1","+ aok = AOK","- if aoki[i] > chokudai[i]:","- ans = max(ans, chokudai[i])","-print((ans + anss))","-# print(aoki)","-# print(chokudai)","+ if cho_dis[i] < aok_dis[i]:","+ ans = max(ans, aok_dis[i] - 1)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2686464586,"measured_runtime_v1":0.0699197628,"runtime_lift":3.842210666,"key":["s854767798","s662268715"]} +{"user_id":"u102461423","problem_id":"p02624","language":"python","submission_id_v0":"s573473634","submission_id_v1":"s100010005","cpu_time_v0":791,"cpu_time_v1":35,"memory_v0":266304,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.58,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\ndef prime_table(N):\n\n is_prime = np.zeros(N, np.int64)\n\n is_prime[2:3] = 1\n\n is_prime[3::2] = 1\n\n for p in range(3, N, 2):\n\n if p * p >= N:\n\n break\n\n if is_prime[p]:\n\n is_prime[p * p::p + p] = 0\n\n return is_prime, np.where(is_prime)[0]\n\n\n\ndef main(N, primes):\n\n div = np.ones(N + 1, dtype=np.int64)\n\n for p in primes:\n\n for i in range(N \/\/ p + 1):\n\n div[p * i] += div[i]\n\n div *= np.arange(N + 1)\n\n return div.sum()\n\n\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n import numba\n\n from numba.pycc import CC\n\n i8 = numba.int64\n\n cc = CC('my_module')\n\n\n\n def cc_export(f, signature):\n\n cc.export(f.__name__, signature)(f)\n\n return numba.njit(f)\n\n\n\n main = cc_export(main, (i8, i8[:]))\n\n cc.compile()\n\n\n\nfrom my_module import main\n\n\n\nN = int(read())\n\nis_prime, primes = prime_table(N + 1)\n\nprint((main(N, primes)))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\n\n\ndef f(x):\n\n return x * (x+1) \/\/ 2\n\n\n\nans = 0\n\nfor x in range(1, N+1):\n\n if x * x > N:\n\n break\n\n # x = y\n\n ans += x * x\n\n # x < y \u306e 2 \u500d\n\n y_high = N\/\/x\n\n ans += 2 * x * (f(y_high) - f(x))\n\n\n\nprint(ans)","code_v0_loc":44,"code_v1_loc":16,"code_v0_num_chars":1059,"code_v1_num_chars":230,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\ndef prime_table(N):\n is_prime = np.zeros(N, np.int64)\n is_prime[2:3] = 1\n is_prime[3::2] = 1\n for p in range(3, N, 2):\n if p * p >= N:\n break\n if is_prime[p]:\n is_prime[p * p :: p + p] = 0\n return is_prime, np.where(is_prime)[0]\n\n\ndef main(N, primes):\n div = np.ones(N + 1, dtype=np.int64)\n for p in primes:\n for i in range(N \/\/ p + 1):\n div[p * i] += div[i]\n div *= np.arange(N + 1)\n return div.sum()\n\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n import numba\n from numba.pycc import CC\n\n i8 = numba.int64\n cc = CC(\"my_module\")\n\n def cc_export(f, signature):\n cc.export(f.__name__, signature)(f)\n return numba.njit(f)\n\n main = cc_export(main, (i8, i8[:]))\n cc.compile()\nfrom my_module import main\n\nN = int(read())\nis_prime, primes = prime_table(N + 1)\nprint((main(N, primes)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\n\n\ndef f(x):\n return x * (x + 1) \/\/ 2\n\n\nans = 0\nfor x in range(1, N + 1):\n if x * x > N:\n break\n # x = y\n ans += x * x\n # x < y \u306e 2 \u500d\n y_high = N \/\/ x\n ans += 2 * x * (f(y_high) - f(x))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":63.6363636364,"diff":["-import sys","-import numpy as np","-","-read = sys.stdin.buffer.read","-readline = sys.stdin.buffer.readline","-readlines = sys.stdin.buffer.readlines","+N = int(eval(input()))","-def prime_table(N):","- is_prime = np.zeros(N, np.int64)","- is_prime[2:3] = 1","- is_prime[3::2] = 1","- for p in range(3, N, 2):","- if p * p >= N:","- break","- if is_prime[p]:","- is_prime[p * p :: p + p] = 0","- return is_prime, np.where(is_prime)[0]","+def f(x):","+ return x * (x + 1) \/\/ 2","-def main(N, primes):","- div = np.ones(N + 1, dtype=np.int64)","- for p in primes:","- for i in range(N \/\/ p + 1):","- div[p * i] += div[i]","- div *= np.arange(N + 1)","- return div.sum()","-","-","-if sys.argv[-1] == \"ONLINE_JUDGE\":","- import numba","- from numba.pycc import CC","-","- i8 = numba.int64","- cc = CC(\"my_module\")","-","- def cc_export(f, signature):","- cc.export(f.__name__, signature)(f)","- return numba.njit(f)","-","- main = cc_export(main, (i8, i8[:]))","- cc.compile()","-from my_module import main","-","-N = int(read())","-is_prime, primes = prime_table(N + 1)","-print((main(N, primes)))","+ans = 0","+for x in range(1, N + 1):","+ if x * x > N:","+ break","+ # x = y","+ ans += x * x","+ # x < y \u306e 2 \u500d","+ y_high = N \/\/ x","+ ans += 2 * x * (f(y_high) - f(x))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.4964172101,"measured_runtime_v1":0.255015204,"runtime_lift":5.8679529175,"key":["s573473634","s100010005"]} +{"user_id":"u729133443","problem_id":"p02537","language":"python","submission_id_v0":"s897150427","submission_id_v1":"s003067542","cpu_time_v0":1389,"cpu_time_v1":1137,"memory_v0":275544,"memory_v1":157144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.14,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nd=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()+d))\n\nfor i in range(n):d[i]=max(d[j]for j in range(i-99,i+1)if abs(a[i]-a[j])<=k)+1\n\nprint((max(d)))\n\n# optimized version of the same code:\n","target":"d=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()))\n\na=d+a\n\nwhile n:d[n]=max(d[j]for j in range(n,n+99)if abs(a[-n]-a[-j])<=k)+1;n-=1\n\nprint((max(d)))","code_v0_loc":4,"code_v1_loc":5,"code_v0_num_chars":147,"code_v1_num_chars":147,"code_v0_no_empty_lines":"d = [0] * 6**8\nn, k, *a = list(map(int, open(0).read().split() + d))\nfor i in range(n):\n d[i] = max(d[j] for j in range(i - 99, i + 1) if abs(a[i] - a[j]) <= k) + 1\nprint((max(d)))\n","code_v1_no_empty_lines":"d = [0] * 6**8\nn, k, *a = list(map(int, open(0).read().split()))\na = d + a\nwhile n:\n d[n] = max(d[j] for j in range(n, n + 99) if abs(a[-n] - a[-j]) <= k) + 1\n n -= 1\nprint((max(d)))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-n, k, *a = list(map(int, open(0).read().split() + d))","-for i in range(n):","- d[i] = max(d[j] for j in range(i - 99, i + 1) if abs(a[i] - a[j]) <= k) + 1","+n, k, *a = list(map(int, open(0).read().split()))","+a = d + a","+while n:","+ d[n] = max(d[j] for j in range(n, n + 99) if abs(a[-n] - a[-j]) <= k) + 1","+ n -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":1.750332129,"measured_runtime_v1":0.822091434,"runtime_lift":2.1291209914,"key":["s897150427","s003067542"]} +{"user_id":"u437638594","problem_id":"p02899","language":"python","submission_id_v0":"s394411898","submission_id_v1":"s768084185","cpu_time_v0":774,"cpu_time_v1":113,"memory_v0":23388,"memory_v1":14008,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.4,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN = int(input())\n\nAs = list(map(int, input().split()))\n\n\n\n# for i in range(N):\n\n# print(As.index(i+1) + 1, end = \" \")\n\n\n\nfor item in np.argsort(As):\n\n print(item+1, end=\" \")\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nAs = list(map(int, input().split()))\n\n\n\nans = [0] * N\n\n\n\nfor i, A in enumerate(As):\n\n ans[A-1] = i+1\n\n \n\nprint((*ans))","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":199,"code_v1_num_chars":136,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(input())\nAs = list(map(int, input().split()))\n# for i in range(N):\n# print(As.index(i+1) + 1, end = \" \")\nfor item in np.argsort(As):\n print(item + 1, end=\" \")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nAs = list(map(int, input().split()))\nans = [0] * N\nfor i, A in enumerate(As):\n ans[A - 1] = i + 1\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-import numpy as np","-","-N = int(input())","+N = int(eval(input()))","-# for i in range(N):","-# print(As.index(i+1) + 1, end = \" \")","-for item in np.argsort(As):","- print(item + 1, end=\" \")","+ans = [0] * N","+for i, A in enumerate(As):","+ ans[A - 1] = i + 1","+print((*ans))"],"diff_only_import_comment":false,"measured_runtime_v0":2.1602964805,"measured_runtime_v1":0.2883257704,"runtime_lift":7.4925542641,"key":["s394411898","s768084185"]} +{"user_id":"u028260664","problem_id":"p03494","language":"python","submission_id_v0":"s951687748","submission_id_v1":"s895960468","cpu_time_v0":279,"cpu_time_v1":19,"memory_v0":17932,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.19,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n# Me\n\n\n\n\n\ndef f():\n\n i = int(eval(input()))\n\n nums = np.array(list(map(int, input().split())))\n\n # nums = [int(x) for x in input().split()]\n\n c = 0\n\n while True:\n\n if any(nums % 2 == 1):\n\n break\n\n c += 1\n\n nums = nums \/ 2\n\n print(c)\n\n\n\n\n\nf()\n\n\n\n\n\n# Other\n\n\n# optimized version of the same code:\n","target":"def divide_all(a):\n\n success = True\n\n for i, n in enumerate(a):\n\n if n % 2 != 0:\n\n success = False\n\n break\n\n a[i] = n \/ 2\n\n if success is False:\n\n return (a, False)\n\n return (a, True)\n\n\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\nc = 0\n\nwhile True:\n\n a, r = divide_all(a)\n\n if r is False:\n\n break\n\n c += 1\n\n\n\n\n\nprint(c)\n","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":319,"code_v1_num_chars":403,"code_v0_no_empty_lines":"import numpy as np\n\n# Me\ndef f():\n i = int(eval(input()))\n nums = np.array(list(map(int, input().split())))\n # nums = [int(x) for x in input().split()]\n c = 0\n while True:\n if any(nums % 2 == 1):\n break\n c += 1\n nums = nums \/ 2\n print(c)\n\n\nf()\n# Other\n","code_v1_no_empty_lines":"def divide_all(a):\n success = True\n for i, n in enumerate(a):\n if n % 2 != 0:\n success = False\n break\n a[i] = n \/ 2\n if success is False:\n return (a, False)\n return (a, True)\n\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nc = 0\nwhile True:\n a, r = divide_all(a)\n if r is False:\n break\n c += 1\nprint(c)\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-import numpy as np","-","-# Me","-def f():","- i = int(eval(input()))","- nums = np.array(list(map(int, input().split())))","- # nums = [int(x) for x in input().split()]","- c = 0","- while True:","- if any(nums % 2 == 1):","+def divide_all(a):","+ success = True","+ for i, n in enumerate(a):","+ if n % 2 != 0:","+ success = False","- c += 1","- nums = nums \/ 2","- print(c)","+ a[i] = n \/ 2","+ if success is False:","+ return (a, False)","+ return (a, True)","-f()","-# Other","+n = int(eval(input()))","+a = list(map(int, input().split()))","+c = 0","+while True:","+ a, r = divide_all(a)","+ if r is False:","+ break","+ c += 1","+print(c)"],"diff_only_import_comment":false,"measured_runtime_v0":1.5223398395,"measured_runtime_v1":0.2142075307,"runtime_lift":7.106845563,"key":["s951687748","s895960468"]} +{"user_id":"u163829702","problem_id":"p02690","language":"python","submission_id_v0":"s837447612","submission_id_v1":"s901497928","cpu_time_v0":71,"cpu_time_v1":47,"memory_v0":9108,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.8,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nX = int(eval(input()))\n\nfor A in range(-200, 200):\n\n for B in range(-200, 200):\n\n if A**5 - B**5 == X:\n\n print((A, B))\n\n break\n\n else:\n\n continue\n\n break\n\n# optimized version of the same code:\n","target":"X = int(eval(input()))\n\nfor A in range(-150, 150):\n\n for B in range(-150, 150):\n\n if A**5 - B**5 == X:\n\n print((A, B))\n\n break\n\n else:\n\n continue\n\n break","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":190,"code_v1_num_chars":190,"code_v0_no_empty_lines":"X = int(eval(input()))\nfor A in range(-200, 200):\n for B in range(-200, 200):\n if A**5 - B**5 == X:\n print((A, B))\n break\n else:\n continue\n break\n","code_v1_no_empty_lines":"X = int(eval(input()))\nfor A in range(-150, 150):\n for B in range(-150, 150):\n if A**5 - B**5 == X:\n print((A, B))\n break\n else:\n continue\n break\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for A in range(-200, 200):","- for B in range(-200, 200):","+for A in range(-150, 150):","+ for B in range(-150, 150):"],"diff_only_import_comment":false,"measured_runtime_v0":0.6633033911,"measured_runtime_v1":0.465554901,"runtime_lift":1.4247586907,"key":["s837447612","s901497928"]} +{"user_id":"u185948224","problem_id":"p02873","language":"python","submission_id_v0":"s874712614","submission_id_v1":"s975354355","cpu_time_v0":481,"cpu_time_v1":429,"memory_v0":27676,"memory_v1":27548,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.81,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = eval(input())\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in range(len(lst)):\n\n if lst[i] > 0:\n\n ans += list(range(1,lst[i]+1))\n\n else:\n\n ans[-1] = max(ans[-1], -lst[i])\n\n ans += list(range(-lst[i]-1,-1, -1))\n\n\n\nprint((sum(ans)))\n\n\n# optimized version of the same code:\n","target":"S = eval(input())\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in lst:\n\n if i > 0:\n\n ans += list(range(1,i+1))\n\n else:\n\n ans[-1] = max(ans[-1], -i)\n\n ans += list(range(-i-1,-1, -1))\n\n\n\n\n\nprint((sum(ans)))","code_v0_loc":19,"code_v1_loc":20,"code_v0_num_chars":425,"code_v1_num_chars":394,"code_v0_no_empty_lines":"S = eval(input())\nlst = [1 if S[0] == \"<\" else -1]\nfor i in range(1, len(S)):\n if S[i] == S[i - 1]:\n lst[-1] += 1 if S[i] == \"<\" else -1\n else:\n lst.append(-1 if S[i] == \">\" else 1)\nans = [0]\nfor i in range(len(lst)):\n if lst[i] > 0:\n ans += list(range(1, lst[i] + 1))\n else:\n ans[-1] = max(ans[-1], -lst[i])\n ans += list(range(-lst[i] - 1, -1, -1))\nprint((sum(ans)))\n","code_v1_no_empty_lines":"S = eval(input())\nlst = [1 if S[0] == \"<\" else -1]\nfor i in range(1, len(S)):\n if S[i] == S[i - 1]:\n lst[-1] += 1 if S[i] == \"<\" else -1\n else:\n lst.append(-1 if S[i] == \">\" else 1)\nans = [0]\nfor i in lst:\n if i > 0:\n ans += list(range(1, i + 1))\n else:\n ans[-1] = max(ans[-1], -i)\n ans += list(range(-i - 1, -1, -1))\nprint((sum(ans)))\n","code_same":false,"relative_loc_diff_percent":5.0,"diff":["-for i in range(len(lst)):","- if lst[i] > 0:","- ans += list(range(1, lst[i] + 1))","+for i in lst:","+ if i > 0:","+ ans += list(range(1, i + 1))","- ans[-1] = max(ans[-1], -lst[i])","- ans += list(range(-lst[i] - 1, -1, -1))","+ ans[-1] = max(ans[-1], -i)","+ ans += list(range(-i - 1, -1, -1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2820563465,"measured_runtime_v1":0.2050767321,"runtime_lift":1.3753698122,"key":["s874712614","s975354355"]} +{"user_id":"u231095456","problem_id":"p03253","language":"python","submission_id_v0":"s968664754","submission_id_v1":"s390670273","cpu_time_v0":89,"cpu_time_v1":32,"memory_v0":11252,"memory_v1":9336,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.04,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import floor, sqrt\n\nfrom collections import defaultdict\n\ndef factors(n):\n\n d = defaultdict(int)\n\n for i in range(2,floor(sqrt(n))+1):\n\n while n % i == 0:\n\n n \/\/= i\n\n d[i] += 1\n\n if n == 1:\n\n break\n\n if n != 1:\n\n d[n] += 1\n\n return d\n\ndef inv(x, mod):\n\n k = mod - 2\n\n ret = 1\n\n while k > 0:\n\n if k&1:\n\n ret = (ret*x) % mod\n\n x = (x*x) % mod\n\n k >>= 1\n\n return ret\n\nN, M = list(map(int,input().split()))\n\nmod = 10**9+7\n\ndic = factors(M)\n\nK = len(dic)\n\nSIZE = N+max(dic.values()) if list(dic.values()) else N\n\nfact = [None]*(SIZE+1)\n\nfinv = [None]*(SIZE+1)\n\nfact[0] = 1\n\nfor i in range(1,SIZE+1):\n\n fact[i] = (fact[i-1]*i) % mod\n\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\n\nfor i in range(SIZE, 0, -1):\n\n finv[i-1] = (finv[i]*i) % mod\n\ndef comb(n,k):\n\n tmp = (finv[k]*finv[n-k]) % mod\n\n return (fact[n]*tmp) % mod\n\nans = 1\n\nfor p in dic:\n\n ans = (ans*comb(dic[p]+N-1, dic[p])) % mod\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"from math import floor, sqrt\n\nfrom collections import defaultdict\n\nN,M = list(map(int,input().split()))\n\nd = defaultdict(int)\n\nfor i in range(2, floor(sqrt(M))+1):\n\n while M % i == 0:\n\n d[i] += 1\n\n M \/\/= i\n\nif M != 1:\n\n d[M] += 1\n\ndef comb(n,k):\n\n if k == 0:\n\n return 1\n\n return comb(n-1,k-1) * n \/\/ k\n\nans = 1\n\nfor e in list(d.values()):\n\n ans *= comb(N+e-1, e)\n\nprint((ans % (10**9+7)))","code_v0_loc":42,"code_v1_loc":18,"code_v0_num_chars":1009,"code_v1_num_chars":410,"code_v0_no_empty_lines":"from math import floor, sqrt\nfrom collections import defaultdict\n\n\ndef factors(n):\n d = defaultdict(int)\n for i in range(2, floor(sqrt(n)) + 1):\n while n % i == 0:\n n \/\/= i\n d[i] += 1\n if n == 1:\n break\n if n != 1:\n d[n] += 1\n return d\n\n\ndef inv(x, mod):\n k = mod - 2\n ret = 1\n while k > 0:\n if k & 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n k >>= 1\n return ret\n\n\nN, M = list(map(int, input().split()))\nmod = 10**9 + 7\ndic = factors(M)\nK = len(dic)\nSIZE = N + max(dic.values()) if list(dic.values()) else N\nfact = [None] * (SIZE + 1)\nfinv = [None] * (SIZE + 1)\nfact[0] = 1\nfor i in range(1, SIZE + 1):\n fact[i] = (fact[i - 1] * i) % mod\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\nfor i in range(SIZE, 0, -1):\n finv[i - 1] = (finv[i] * i) % mod\n\n\ndef comb(n, k):\n tmp = (finv[k] * finv[n - k]) % mod\n return (fact[n] * tmp) % mod\n\n\nans = 1\nfor p in dic:\n ans = (ans * comb(dic[p] + N - 1, dic[p])) % mod\nprint(ans)\n","code_v1_no_empty_lines":"from math import floor, sqrt\nfrom collections import defaultdict\n\nN, M = list(map(int, input().split()))\nd = defaultdict(int)\nfor i in range(2, floor(sqrt(M)) + 1):\n while M % i == 0:\n d[i] += 1\n M \/\/= i\nif M != 1:\n d[M] += 1\n\n\ndef comb(n, k):\n if k == 0:\n return 1\n return comb(n - 1, k - 1) * n \/\/ k\n\n\nans = 1\nfor e in list(d.values()):\n ans *= comb(N + e - 1, e)\nprint((ans % (10**9 + 7)))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-","-def factors(n):","- d = defaultdict(int)","- for i in range(2, floor(sqrt(n)) + 1):","- while n % i == 0:","- n \/\/= i","- d[i] += 1","- if n == 1:","- break","- if n != 1:","- d[n] += 1","- return d","-","-","-def inv(x, mod):","- k = mod - 2","- ret = 1","- while k > 0:","- if k & 1:","- ret = (ret * x) % mod","- x = (x * x) % mod","- k >>= 1","- return ret","-","-","-mod = 10**9 + 7","-dic = factors(M)","-K = len(dic)","-SIZE = N + max(dic.values()) if list(dic.values()) else N","-fact = [None] * (SIZE + 1)","-finv = [None] * (SIZE + 1)","-fact[0] = 1","-for i in range(1, SIZE + 1):","- fact[i] = (fact[i - 1] * i) % mod","-finv[SIZE] = inv(fact[SIZE], mod=mod)","-for i in range(SIZE, 0, -1):","- finv[i - 1] = (finv[i] * i) % mod","+d = defaultdict(int)","+for i in range(2, floor(sqrt(M)) + 1):","+ while M % i == 0:","+ d[i] += 1","+ M \/\/= i","+if M != 1:","+ d[M] += 1","- tmp = (finv[k] * finv[n - k]) % mod","- return (fact[n] * tmp) % mod","+ if k == 0:","+ return 1","+ return comb(n - 1, k - 1) * n \/\/ k","-for p in dic:","- ans = (ans * comb(dic[p] + N - 1, dic[p])) % mod","-print(ans)","+for e in list(d.values()):","+ ans *= comb(N + e - 1, e)","+print((ans % (10**9 + 7)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3098533685,"measured_runtime_v1":0.2185445104,"runtime_lift":1.4178044005,"key":["s968664754","s390670273"]} +{"user_id":"u118019047","problem_id":"p03416","language":"python","submission_id_v0":"s640144582","submission_id_v1":"s252292470","cpu_time_v0":78,"cpu_time_v1":54,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.77,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na , b = input().split()\n\na = int(a)\n\nb = int(b)\n\ncount=0\n\nfor i in range(a,b+1):\n\n test = list(str(i))\n\n if (test[0] == test[4]) and (test[1]==test[3]):\n\n count=count+1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"A,B=list(map(int,input().split()))\n\nct=0\n\nfor i in range(A,B+1):\n\n s=str(i)\n\n if s==s[::-1]:\n\n ct+=1\n\nprint(ct)","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":195,"code_v1_num_chars":118,"code_v0_no_empty_lines":"a, b = input().split()\na = int(a)\nb = int(b)\ncount = 0\nfor i in range(a, b + 1):\n test = list(str(i))\n if (test[0] == test[4]) and (test[1] == test[3]):\n count = count + 1\nprint(count)\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\nct = 0\nfor i in range(A, B + 1):\n s = str(i)\n if s == s[::-1]:\n ct += 1\nprint(ct)\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-a, b = input().split()","-a = int(a)","-b = int(b)","-count = 0","-for i in range(a, b + 1):","- test = list(str(i))","- if (test[0] == test[4]) and (test[1] == test[3]):","- count = count + 1","-print(count)","+A, B = list(map(int, input().split()))","+ct = 0","+for i in range(A, B + 1):","+ s = str(i)","+ if s == s[::-1]:","+ ct += 1","+print(ct)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4764800201,"measured_runtime_v1":0.3351052109,"runtime_lift":1.4218818588,"key":["s640144582","s252292470"]} +{"user_id":"u102461423","problem_id":"p03034","language":"python","submission_id_v0":"s230699006","submission_id_v1":"s911725590","cpu_time_v0":873,"cpu_time_v1":348,"memory_v0":18552,"memory_v1":12936,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.14,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nimport numpy as np\n\n\n\nN = int(readline())\n\nS = np.array(read().split(),np.int64)\n\n\n\ndef F(d):\n\n # \u516c\u5dee\u3092\u56fa\u5b9a\n\n L = S[:-d:d].cumsum()\n\n R = S[::-1][:-d:d].cumsum()\n\n if (N-1)%d == 0:\n\n n = (N-1)\/\/d\n\n x = np.arange(1,n+1)\n\n bl = (x+x <= n+1)\n\n L = L[bl]; R = R[bl]\n\n return (L+R).max()\n\n\n\ndef G(n):\n\n # \u9805\u6570n+1\u3092\u56fa\u5b9a\n\n D = (N-1-n)\/\/n\n\n L = np.zeros(D+1,np.int64)\n\n R = np.zeros(D+1,np.int64)\n\n for i in range(1,n+1):\n\n L += S[:i*(D+1):i]\n\n R += S[::-1][:i*(D+1):i]\n\n ok = np.ones(D+1,np.bool)\n\n overlap = (np.arange(D+1) * (n+n) >= N-1)\n\n overlap[1:] &= ((N-1)%np.arange(1,D+1) == 0)\n\n x = L+R\n\n x[overlap] = 0\n\n return x.max()\n\n\n\nL = int((N-1)**.5 + 10)\n\nL = min(N-1,L)\n\n\n\nx = max(F(n) for n in range(1,L+1))\n\ny = max(G(n) for n in range(1,L+1))\n\nanswer = max(x,y)\n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nimport itertools\n\n\n\nN = int(readline())\n\nS = list(map(int,read().split()))\n\n\n\nanswer = 0\n\nfor d in range(1,N):\n\n n = (N-1)\/\/d\n\n if (N-1)%d == 0:\n\n n = ((N-1)\/\/d+1)\/\/2\n\n if n <= 1:\n\n continue\n\n x = max(itertools.accumulate(x+y for x,y in zip(S[d:d*n:d],S[N-1-d:N-1-d*n:-d])))\n\n if answer < x:\n\n answer = x\n\n\n\nprint(answer)","code_v0_loc":43,"code_v1_loc":22,"code_v0_num_chars":980,"code_v1_num_chars":479,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport numpy as np\n\nN = int(readline())\nS = np.array(read().split(), np.int64)\n\n\ndef F(d):\n # \u516c\u5dee\u3092\u56fa\u5b9a\n L = S[:-d:d].cumsum()\n R = S[::-1][:-d:d].cumsum()\n if (N - 1) % d == 0:\n n = (N - 1) \/\/ d\n x = np.arange(1, n + 1)\n bl = x + x <= n + 1\n L = L[bl]\n R = R[bl]\n return (L + R).max()\n\n\ndef G(n):\n # \u9805\u6570n+1\u3092\u56fa\u5b9a\n D = (N - 1 - n) \/\/ n\n L = np.zeros(D + 1, np.int64)\n R = np.zeros(D + 1, np.int64)\n for i in range(1, n + 1):\n L += S[: i * (D + 1) : i]\n R += S[::-1][: i * (D + 1) : i]\n ok = np.ones(D + 1, np.bool)\n overlap = np.arange(D + 1) * (n + n) >= N - 1\n overlap[1:] &= (N - 1) % np.arange(1, D + 1) == 0\n x = L + R\n x[overlap] = 0\n return x.max()\n\n\nL = int((N - 1) ** 0.5 + 10)\nL = min(N - 1, L)\nx = max(F(n) for n in range(1, L + 1))\ny = max(G(n) for n in range(1, L + 1))\nanswer = max(x, y)\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport itertools\n\nN = int(readline())\nS = list(map(int, read().split()))\nanswer = 0\nfor d in range(1, N):\n n = (N - 1) \/\/ d\n if (N - 1) % d == 0:\n n = ((N - 1) \/\/ d + 1) \/\/ 2\n if n <= 1:\n continue\n x = max(\n itertools.accumulate(\n x + y for x, y in zip(S[d : d * n : d], S[N - 1 - d : N - 1 - d * n : -d])\n )\n )\n if answer < x:\n answer = x\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":48.8372093023,"diff":["-import numpy as np","+import itertools","-S = np.array(read().split(), np.int64)","-","-","-def F(d):","- # \u516c\u5dee\u3092\u56fa\u5b9a","- L = S[:-d:d].cumsum()","- R = S[::-1][:-d:d].cumsum()","+S = list(map(int, read().split()))","+answer = 0","+for d in range(1, N):","+ n = (N - 1) \/\/ d","- n = (N - 1) \/\/ d","- x = np.arange(1, n + 1)","- bl = x + x <= n + 1","- L = L[bl]","- R = R[bl]","- return (L + R).max()","-","-","-def G(n):","- # \u9805\u6570n+1\u3092\u56fa\u5b9a","- D = (N - 1 - n) \/\/ n","- L = np.zeros(D + 1, np.int64)","- R = np.zeros(D + 1, np.int64)","- for i in range(1, n + 1):","- L += S[: i * (D + 1) : i]","- R += S[::-1][: i * (D + 1) : i]","- ok = np.ones(D + 1, np.bool)","- overlap = np.arange(D + 1) * (n + n) >= N - 1","- overlap[1:] &= (N - 1) % np.arange(1, D + 1) == 0","- x = L + R","- x[overlap] = 0","- return x.max()","-","-","-L = int((N - 1) ** 0.5 + 10)","-L = min(N - 1, L)","-x = max(F(n) for n in range(1, L + 1))","-y = max(G(n) for n in range(1, L + 1))","-answer = max(x, y)","+ n = ((N - 1) \/\/ d + 1) \/\/ 2","+ if n <= 1:","+ continue","+ x = max(","+ itertools.accumulate(","+ x + y for x, y in zip(S[d : d * n : d], S[N - 1 - d : N - 1 - d * n : -d])","+ )","+ )","+ if answer < x:","+ answer = x"],"diff_only_import_comment":false,"measured_runtime_v0":1.5818065369,"measured_runtime_v1":0.2384125237,"runtime_lift":6.634745994,"key":["s230699006","s911725590"]} +{"user_id":"u562016607","problem_id":"p03835","language":"python","submission_id_v0":"s390314187","submission_id_v1":"s016239384","cpu_time_v0":1476,"cpu_time_v1":282,"memory_v0":2940,"memory_v1":41180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.89,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nK,S=list(map(int,input().split()))\n\nO=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n O+=1\n\nprint(O)\n\n\n# optimized version of the same code:\n","target":"K,S=list(map(int,input().split()))\n\nans=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n ans+=1\n\nprint(ans)\n","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":132,"code_v1_num_chars":154,"code_v0_no_empty_lines":"K, S = list(map(int, input().split()))\nO = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if 0 <= Z <= K:\n O += 1\nprint(O)\n","code_v1_no_empty_lines":"K, S = list(map(int, input().split()))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if 0 <= Z <= K:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-O = 0","+ans = 0","- O += 1","-print(O)","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2257852338,"measured_runtime_v1":0.0060590109,"runtime_lift":37.2643715379,"key":["s390314187","s016239384"]} +{"user_id":"u631277801","problem_id":"p04020","language":"python","submission_id_v0":"s879592559","submission_id_v1":"s107006666","cpu_time_v0":164,"cpu_time_v1":99,"memory_v0":19100,"memory_v1":7072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.63,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nstdin = sys.stdin\n\n \n\nsys.setrecursionlimit(10**8) \n\n \n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x)-1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\n\n\nn = ni()\n\na = [ni() for _ in range(n)]\n\n\n\ncnt = {i+1: ai for i, ai in enumerate(a)}\n\n\n\nprev = -100\n\ncur = 0\n\nans = 0\n\nfor key in sorted(cnt.keys()):\n\n if cnt[key] == 0:\n\n continue\n\n \n\n if prev == -100:\n\n prev = key\n\n \n\n if (key-prev) < 2:\n\n cur += cnt[key]\n\n else:\n\n cur = cnt[key]\n\n \n\n ans += cur \/\/ 2\n\n cur -= 2 * (cur\/\/2)\n\n \n\n prev = key\n\n \n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\n\n\nans = 0\n\nplus = 0\n\na = [ni() for _ in range(n)]\n\n\n\nfor ai in a:\n\n ans += ((ai+plus) \/\/ 2)\n\n plus = (ai+plus) % 2 if ai > 0 else 0\n\n\n\nprint(ans)","code_v0_loc":41,"code_v1_loc":25,"code_v0_num_chars":874,"code_v1_num_chars":607,"code_v0_no_empty_lines":"import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**8)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\na = [ni() for _ in range(n)]\ncnt = {i + 1: ai for i, ai in enumerate(a)}\nprev = -100\ncur = 0\nans = 0\nfor key in sorted(cnt.keys()):\n if cnt[key] == 0:\n continue\n if prev == -100:\n prev = key\n if (key - prev) < 2:\n cur += cnt[key]\n else:\n cur = cnt[key]\n ans += cur \/\/ 2\n cur -= 2 * (cur \/\/ 2)\n prev = key\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nans = 0\nplus = 0\na = [ni() for _ in range(n)]\nfor ai in a:\n ans += (ai + plus) \/\/ 2\n plus = (ai + plus) % 2 if ai > 0 else 0\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":39.0243902439,"diff":["-sys.setrecursionlimit(10**8)","+sys.setrecursionlimit(10**7)","+ans = 0","+plus = 0","-cnt = {i + 1: ai for i, ai in enumerate(a)}","-prev = -100","-cur = 0","-ans = 0","-for key in sorted(cnt.keys()):","- if cnt[key] == 0:","- continue","- if prev == -100:","- prev = key","- if (key - prev) < 2:","- cur += cnt[key]","- else:","- cur = cnt[key]","- ans += cur \/\/ 2","- cur -= 2 * (cur \/\/ 2)","- prev = key","+for ai in a:","+ ans += (ai + plus) \/\/ 2","+ plus = (ai + plus) % 2 if ai > 0 else 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.2743015865,"measured_runtime_v1":0.1203746786,"runtime_lift":2.278731621,"key":["s879592559","s107006666"]} +{"user_id":"u761529120","problem_id":"p03164","language":"python","submission_id_v0":"s478711084","submission_id_v1":"s154638745","cpu_time_v0":1151,"cpu_time_v1":682,"memory_v0":312192,"memory_v1":334552,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.75,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n N, W = list(map(int, input().split()))\n\n w = [0] * N\n\n v = [0] * N\n\n for i in range(N):\n\n w[i], v[i] = list(map(int, input().split()))\n\n\n\n max_v = max(v)\n\n dp = [[float('inf')] * (max_v * N + 5) for _ in range(N + 5)]\n\n\n\n dp[0][0] = 0\n\n\n\n for i in range(N):\n\n for j in range(max_v * N):\n\n if j + v[i] <= max_v * N:\n\n dp[i+1][j + v[i]] = min(dp[i+1][j + v[i]], dp[i][j] + w[i])\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j]) \n\n\n\n ans = 0\n\n for j in range(max_v * N + 1):\n\n if dp[N][j] <= W:\n\n ans = j\n\n\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n# optimized version of the same code:\n","target":"def main():\n\n N, W = list(map(int, input().split()))\n\n weight = [0] * N\n\n value = [0] * N\n\n for i in range(N):\n\n weight[i], value[i] = list(map(int, input().split()))\n\n V = sum(value)\n\n dp = [[float('inf')] * (V + 5) for _ in range(N + 5)]\n\n dp[0][0] = 0\n\n for i in range(N):\n\n for v in range(V+1):\n\n if v - value[i] >= 0:\n\n dp[i+1][v] = min(dp[i][v-value[i]] + weight[i], dp[i][v])\n\n else:\n\n dp[i+1][v] = dp[i][v]\n\n ans = 0\n\n for v in range(V+1):\n\n if dp[N][v] <= W:\n\n ans = v\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":27,"code_v1_loc":23,"code_v0_num_chars":654,"code_v1_num_chars":637,"code_v0_no_empty_lines":"def main():\n N, W = list(map(int, input().split()))\n w = [0] * N\n v = [0] * N\n for i in range(N):\n w[i], v[i] = list(map(int, input().split()))\n max_v = max(v)\n dp = [[float(\"inf\")] * (max_v * N + 5) for _ in range(N + 5)]\n dp[0][0] = 0\n for i in range(N):\n for j in range(max_v * N):\n if j + v[i] <= max_v * N:\n dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i])\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n ans = 0\n for j in range(max_v * N + 1):\n if dp[N][j] <= W:\n ans = j\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N, W = list(map(int, input().split()))\n weight = [0] * N\n value = [0] * N\n for i in range(N):\n weight[i], value[i] = list(map(int, input().split()))\n V = sum(value)\n dp = [[float(\"inf\")] * (V + 5) for _ in range(N + 5)]\n dp[0][0] = 0\n for i in range(N):\n for v in range(V + 1):\n if v - value[i] >= 0:\n dp[i + 1][v] = min(dp[i][v - value[i]] + weight[i], dp[i][v])\n else:\n dp[i + 1][v] = dp[i][v]\n ans = 0\n for v in range(V + 1):\n if dp[N][v] <= W:\n ans = v\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":14.8148148148,"diff":["- w = [0] * N","- v = [0] * N","+ weight = [0] * N","+ value = [0] * N","- w[i], v[i] = list(map(int, input().split()))","- max_v = max(v)","- dp = [[float(\"inf\")] * (max_v * N + 5) for _ in range(N + 5)]","+ weight[i], value[i] = list(map(int, input().split()))","+ V = sum(value)","+ dp = [[float(\"inf\")] * (V + 5) for _ in range(N + 5)]","- for j in range(max_v * N):","- if j + v[i] <= max_v * N:","- dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i])","- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])","+ for v in range(V + 1):","+ if v - value[i] >= 0:","+ dp[i + 1][v] = min(dp[i][v - value[i]] + weight[i], dp[i][v])","+ else:","+ dp[i + 1][v] = dp[i][v]","- for j in range(max_v * N + 1):","- if dp[N][j] <= W:","- ans = j","+ for v in range(V + 1):","+ if dp[N][v] <= W:","+ ans = v"],"diff_only_import_comment":false,"measured_runtime_v0":0.2676751952,"measured_runtime_v1":0.1215952404,"runtime_lift":2.2013624416,"key":["s478711084","s154638745"]} +{"user_id":"u208713671","problem_id":"p03038","language":"python","submission_id_v0":"s801223812","submission_id_v1":"s234548187","cpu_time_v0":968,"cpu_time_v1":337,"memory_v0":44132,"memory_v1":115244,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.19,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nNM = list(map(int,input().split()))\n\nN = NM[0]\n\nM = NM[1]\n\nA = list(map(int,input().split()))\n\nlistBC =[]\n\nwhile True:\n\n try:\n\n listBC.append(list(map(int,input().split())))\n\n except:\n\n break;\n\nBC = np.array(listBC)\n\nBCnum = np.argsort(BC[:,1])[::-1]\n\nBC = BC[BCnum,:]\n\n\n\nA.sort()\n\nj=0\n\nfor i in range(len(A)):\n\n times = BC[j,0]\n\n if BC[j,0]==0:\n\n j+=1\n\n if j == BC.shape[0]:\n\n break\n\n times = BC[j,0]\n\n if A[i]0:\n\n out += K[now]\n\n D[K[now]] += -1\n\n cnt+=1\n\n else:\n\n now+=1\n\nprint(out)","code_v0_loc":29,"code_v1_loc":23,"code_v0_num_chars":578,"code_v1_num_chars":429,"code_v0_no_empty_lines":"import numpy as np\n\nNM = list(map(int, input().split()))\nN = NM[0]\nM = NM[1]\nA = list(map(int, input().split()))\nlistBC = []\nwhile True:\n try:\n listBC.append(list(map(int, input().split())))\n except:\n break\nBC = np.array(listBC)\nBCnum = np.argsort(BC[:, 1])[::-1]\nBC = BC[BCnum, :]\nA.sort()\nj = 0\nfor i in range(len(A)):\n times = BC[j, 0]\n if BC[j, 0] == 0:\n j += 1\n if j == BC.shape[0]:\n break\n times = BC[j, 0]\n if A[i] < BC[j, 1]:\n A[i] = BC[j, 1]\n BC[j, 0] += -1\noutput = sum(A)\nprint(output)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nfrom collections import Counter\n\nD = dict(Counter(A))\nfor i in range(M):\n B, C = list(map(int, input().split()))\n D[C] = D.get(C, 0) + B\nK = sorted(list(D.keys()), reverse=True)\nout = 0\ncnt = 0\nnow = 0\nwhile cnt <= N - 1:\n if D[K[now]] > 0:\n out += K[now]\n D[K[now]] += -1\n cnt += 1\n else:\n now += 1\nprint(out)\n","code_same":false,"relative_loc_diff_percent":20.6896551724,"diff":["-import numpy as np","+N, M = list(map(int, input().split()))","+A = list(map(int, input().split()))","+from collections import Counter","-NM = list(map(int, input().split()))","-N = NM[0]","-M = NM[1]","-A = list(map(int, input().split()))","-listBC = []","-while True:","- try:","- listBC.append(list(map(int, input().split())))","- except:","- break","-BC = np.array(listBC)","-BCnum = np.argsort(BC[:, 1])[::-1]","-BC = BC[BCnum, :]","-A.sort()","-j = 0","-for i in range(len(A)):","- times = BC[j, 0]","- if BC[j, 0] == 0:","- j += 1","- if j == BC.shape[0]:","- break","- times = BC[j, 0]","- if A[i] < BC[j, 1]:","- A[i] = BC[j, 1]","- BC[j, 0] += -1","-output = sum(A)","-print(output)","+D = dict(Counter(A))","+for i in range(M):","+ B, C = list(map(int, input().split()))","+ D[C] = D.get(C, 0) + B","+K = sorted(list(D.keys()), reverse=True)","+out = 0","+cnt = 0","+now = 0","+while cnt <= N - 1:","+ if D[K[now]] > 0:","+ out += K[now]","+ D[K[now]] += -1","+ cnt += 1","+ else:","+ now += 1","+print(out)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3117765622,"measured_runtime_v1":0.2034162543,"runtime_lift":6.4487302983,"key":["s801223812","s234548187"]} +{"user_id":"u812576525","problem_id":"p03309","language":"python","submission_id_v0":"s649374585","submission_id_v1":"s527849910","cpu_time_v0":249,"cpu_time_v1":171,"memory_v0":26180,"memory_v1":30980,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\na = list(map(int,input().split()))\n\naa = []\n\nfor i in range(n):\n\n aa.append(a[i]-(i+1))\n\nb = (sorted(aa)[n\/\/2])\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans += abs(a[i]-(b+i+1))\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N= int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nB = []\n\nfor i in range(N):\n\n B.append(A[i]-(i+1))\n\n#print(B)\n\nb= (sorted(B)[N\/\/2])\n\n#print(b)\n\nans = 0\n\nfor i in range(N):\n\n ans += abs(B[i]-b)\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":13,"code_v0_num_chars":205,"code_v1_num_chars":216,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\naa = []\nfor i in range(n):\n aa.append(a[i] - (i + 1))\nb = sorted(aa)[n \/\/ 2]\nans = 0\nfor i in range(n):\n ans += abs(a[i] - (b + i + 1))\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nB = []\nfor i in range(N):\n B.append(A[i] - (i + 1))\n# print(B)\nb = sorted(B)[N \/\/ 2]\n# print(b)\nans = 0\nfor i in range(N):\n ans += abs(B[i] - b)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-n = int(eval(input()))","-a = list(map(int, input().split()))","-aa = []","-for i in range(n):","- aa.append(a[i] - (i + 1))","-b = sorted(aa)[n \/\/ 2]","+N = int(eval(input()))","+A = list(map(int, input().split()))","+B = []","+for i in range(N):","+ B.append(A[i] - (i + 1))","+# print(B)","+b = sorted(B)[N \/\/ 2]","+# print(b)","-for i in range(n):","- ans += abs(a[i] - (b + i + 1))","+for i in range(N):","+ ans += abs(B[i] - b)"],"diff_only_import_comment":false,"measured_runtime_v0":0.277994447,"measured_runtime_v1":0.0063325391,"runtime_lift":43.8993653214,"key":["s649374585","s527849910"]} +{"user_id":"u864197622","problem_id":"p02794","language":"python","submission_id_v0":"s167224132","submission_id_v1":"s245735210","cpu_time_v0":294,"cpu_time_v1":228,"memory_v0":50156,"memory_v1":49128,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.45,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(eval(input()))\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\nD = {1<>= 17\n\n bc += BC[aa % (1<<17)]\n\n aa >>= 17\n\n bc += BC[aa]\n\n CC[N - 1 - bc] += (1 if BC[m%1024] + BC[m>>10] & 1 == 0 else -1)\n\n\n\nprint((sum([2 ** i * CC[i] for i in range(N)])))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(eval(input()))\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\ndef popcnt(n):\n\n c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)\n\n c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)\n\n c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)\n\n c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)\n\n c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)\n\n c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)\n\n return c\n\n\n\nD = {1< DE[v]:\n t += 1 << u - 1\n u = P[u]\n elif DE[u] < DE[v]:\n t += 1 << v - 1\n v = P[v]\n else:\n t += 1 << u - 1\n t += 1 << v - 1\n u = P[u]\n v = P[v]\n return t\n\n\nY = []\nM = int(eval(input()))\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n Y.append(lp(a, b))\nD = {1 << i: i for i in range(50)}\nZ = [0] * (1 << M)\nans = 0\nCC = [0] * N\nBC = [0] * (1 << 17)\nfor m in range(1, 1 << 17):\n a = m & (-m)\n BC[m] = BC[m ^ a] + 1\nfor m in range(1 << M):\n a = m & (-m)\n if a == m:\n if a == 0:\n Z[m] = 0\n else:\n Z[m] = Y[D[a]]\n else:\n Z[m] = Z[m ^ a] | Y[D[a]]\n aa = Z[m]\n bc = BC[aa % (1 << 17)]\n aa >>= 17\n bc += BC[aa % (1 << 17)]\n aa >>= 17\n bc += BC[aa]\n CC[N - 1 - bc] += 1 if BC[m % 1024] + BC[m >> 10] & 1 == 0 else -1\nprint((sum([2**i * CC[i] for i in range(N)])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\nP = [-1] * N\nDE = [0] * N\nQ = [0]\nwhile Q:\n i = Q.pop()\n for a in X[i][::-1]:\n if a != P[i]:\n P[a] = i\n DE[a] = DE[i] + 1\n X[a].remove(i)\n Q.append(a)\n\n\ndef lp(u, v):\n t = 0\n while u != v:\n if DE[u] > DE[v]:\n t += 1 << u - 1\n u = P[u]\n elif DE[u] < DE[v]:\n t += 1 << v - 1\n v = P[v]\n else:\n t += 1 << u - 1\n t += 1 << v - 1\n u = P[u]\n v = P[v]\n return t\n\n\nY = []\nM = int(eval(input()))\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n Y.append(lp(a, b))\n\n\ndef popcnt(n):\n c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)\n c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)\n c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)\n c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)\n c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)\n c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)\n return c\n\n\nD = {1 << i: i for i in range(50)}\nZ = [0] * (1 << M)\nans = 0\nCC = [0] * N\nfor m in range(1 << M):\n a = m & (-m)\n if a == m:\n if a == 0:\n Z[m] = 0\n else:\n Z[m] = Y[D[a]]\n else:\n Z[m] = Z[m ^ a] | Y[D[a]]\n CC[N - 1 - popcnt(Z[m])] += 1 if popcnt(m) & 1 == 0 else -1\nprint((sum([2**i * CC[i] for i in range(N)])))\n","code_same":false,"relative_loc_diff_percent":1.4285714286,"diff":["+","+","+def popcnt(n):","+ c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)","+ c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)","+ c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)","+ c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)","+ c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)","+ c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)","+ return c","+","+","-BC = [0] * (1 << 17)","-for m in range(1, 1 << 17):","- a = m & (-m)","- BC[m] = BC[m ^ a] + 1","- aa = Z[m]","- bc = BC[aa % (1 << 17)]","- aa >>= 17","- bc += BC[aa % (1 << 17)]","- aa >>= 17","- bc += BC[aa]","- CC[N - 1 - bc] += 1 if BC[m % 1024] + BC[m >> 10] & 1 == 0 else -1","+ CC[N - 1 - popcnt(Z[m])] += 1 if popcnt(m) & 1 == 0 else -1"],"diff_only_import_comment":false,"measured_runtime_v0":0.4825011034,"measured_runtime_v1":0.2223737774,"runtime_lift":2.1697751823,"key":["s167224132","s245735210"]} +{"user_id":"u638282348","problem_id":"p03720","language":"python","submission_id_v0":"s487647415","submission_id_v1":"s133103425","cpu_time_v0":149,"cpu_time_v1":18,"memory_v0":12500,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.92,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nncity, nlines = list(map(int, input().rstrip(\"\\n\").split()))\n\nmatrix = np.zeros((ncity, ncity), dtype=int)\n\nfor _ in range(nlines):\n\n l, c = [int(x) - 1 for x in input().rstrip(\"\\n\").split()]\n\n matrix[l][c] += 1\n\n matrix[c][l] += 1\n\n\n\nfor list_ in matrix:\n\n print((sum(list_)))\n\n# optimized version of the same code:\n","target":"n, m = map(int, input().split())\n\nroads = [0] * n\n\n[exec(\"roads[%d] += 1; roads[%d] += 1\" % tuple(map(lambda c: int(c) - 1, input().split()))) for _ in range(m)]\n\nprint(*roads, sep=\"\\n\", end=\"\")\n","code_v0_loc":11,"code_v1_loc":4,"code_v0_num_chars":308,"code_v1_num_chars":195,"code_v0_no_empty_lines":"import numpy as np\n\nncity, nlines = list(map(int, input().rstrip(\"\\n\").split()))\nmatrix = np.zeros((ncity, ncity), dtype=int)\nfor _ in range(nlines):\n l, c = [int(x) - 1 for x in input().rstrip(\"\\n\").split()]\n matrix[l][c] += 1\n matrix[c][l] += 1\nfor list_ in matrix:\n print((sum(list_)))\n","code_v1_no_empty_lines":"n, m = map(int, input().split())\nroads = [0] * n\n[\n exec(\n \"roads[%d] += 1; roads[%d] += 1\"\n % tuple(map(lambda c: int(c) - 1, input().split()))\n )\n for _ in range(m)\n]\nprint(*roads, sep=\"\\n\", end=\"\")\n","code_same":false,"relative_loc_diff_percent":63.6363636364,"diff":["-import numpy as np","-","-ncity, nlines = list(map(int, input().rstrip(\"\\n\").split()))","-matrix = np.zeros((ncity, ncity), dtype=int)","-for _ in range(nlines):","- l, c = [int(x) - 1 for x in input().rstrip(\"\\n\").split()]","- matrix[l][c] += 1","- matrix[c][l] += 1","-for list_ in matrix:","- print((sum(list_)))","+n, m = map(int, input().split())","+roads = [0] * n","+[","+ exec(","+ \"roads[%d] += 1; roads[%d] += 1\"","+ % tuple(map(lambda c: int(c) - 1, input().split()))","+ )","+ for _ in range(m)","+]","+print(*roads, sep=\"\\n\", end=\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":1.5392445521,"measured_runtime_v1":0.2919934719,"runtime_lift":5.2715033054,"key":["s487647415","s133103425"]} +{"user_id":"u732061897","problem_id":"p03273","language":"python","submission_id_v0":"s132976376","submission_id_v1":"s531161710","cpu_time_v0":40,"cpu_time_v1":32,"memory_v0":9468,"memory_v1":9364,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nH, W = list(map(int, input().split()))\n\nHW_list = [list(eval(input())) for i in range(H)]\n\nimport copy\n\n\n\ntmp = copy.deepcopy(HW_list)\n\nh_index = 0\n\nfor i, HW in enumerate(HW_list):\n\n is_all_shiro = True\n\n for hw in HW:\n\n if hw == '#':\n\n is_all_shiro = False\n\n h_index += 1\n\n break\n\n if is_all_shiro:\n\n tmp.pop(h_index)\n\nw_index = 0\n\nans = copy.deepcopy(tmp)\n\nfor w in range(W):\n\n is_all_shiro = True\n\n for t in tmp:\n\n if t[w] == '#':\n\n is_all_shiro = False\n\n w_index += 1\n\n break\n\n if is_all_shiro:\n\n for a in ans:\n\n a.pop(w_index)\n\nfor A in ans:\n\n print((''.join(A)))\n\n\n# optimized version of the same code:\n","target":"H, W = list(map(int, input().split()))\n\nHW_list = [list(eval(input())) for i in range(H)]\n\nimport copy\n\n\n\ntate = [False] * H\n\nyoko = [False] * W\n\n\n\nfor h in range(H):\n\n for w in range(W):\n\n if HW_list[h][w] == '#':\n\n tate[h] = True\n\n yoko[w] = True\n\n\n\nfor h in range(H):\n\n tmp = ''\n\n for w in range(W):\n\n if tate[h] and yoko[w]:\n\n tmp += HW_list[h][w]\n\n if tmp == '':\n\n continue\n\n print(tmp)\n","code_v0_loc":29,"code_v1_loc":21,"code_v0_num_chars":682,"code_v1_num_chars":449,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\nHW_list = [list(eval(input())) for i in range(H)]\nimport copy\n\ntmp = copy.deepcopy(HW_list)\nh_index = 0\nfor i, HW in enumerate(HW_list):\n is_all_shiro = True\n for hw in HW:\n if hw == \"#\":\n is_all_shiro = False\n h_index += 1\n break\n if is_all_shiro:\n tmp.pop(h_index)\nw_index = 0\nans = copy.deepcopy(tmp)\nfor w in range(W):\n is_all_shiro = True\n for t in tmp:\n if t[w] == \"#\":\n is_all_shiro = False\n w_index += 1\n break\n if is_all_shiro:\n for a in ans:\n a.pop(w_index)\nfor A in ans:\n print((\"\".join(A)))\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nHW_list = [list(eval(input())) for i in range(H)]\nimport copy\n\ntate = [False] * H\nyoko = [False] * W\nfor h in range(H):\n for w in range(W):\n if HW_list[h][w] == \"#\":\n tate[h] = True\n yoko[w] = True\nfor h in range(H):\n tmp = \"\"\n for w in range(W):\n if tate[h] and yoko[w]:\n tmp += HW_list[h][w]\n if tmp == \"\":\n continue\n print(tmp)\n","code_same":false,"relative_loc_diff_percent":27.5862068966,"diff":["-tmp = copy.deepcopy(HW_list)","-h_index = 0","-for i, HW in enumerate(HW_list):","- is_all_shiro = True","- for hw in HW:","- if hw == \"#\":","- is_all_shiro = False","- h_index += 1","- break","- if is_all_shiro:","- tmp.pop(h_index)","-w_index = 0","-ans = copy.deepcopy(tmp)","-for w in range(W):","- is_all_shiro = True","- for t in tmp:","- if t[w] == \"#\":","- is_all_shiro = False","- w_index += 1","- break","- if is_all_shiro:","- for a in ans:","- a.pop(w_index)","-for A in ans:","- print((\"\".join(A)))","+tate = [False] * H","+yoko = [False] * W","+for h in range(H):","+ for w in range(W):","+ if HW_list[h][w] == \"#\":","+ tate[h] = True","+ yoko[w] = True","+for h in range(H):","+ tmp = \"\"","+ for w in range(W):","+ if tate[h] and yoko[w]:","+ tmp += HW_list[h][w]","+ if tmp == \"\":","+ continue","+ print(tmp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2898663879,"measured_runtime_v1":0.204775079,"runtime_lift":1.415535471,"key":["s132976376","s531161710"]} +{"user_id":"u057109575","problem_id":"p03078","language":"python","submission_id_v0":"s065985582","submission_id_v1":"s294135268","cpu_time_v0":153,"cpu_time_v1":124,"memory_v0":79232,"memory_v1":73392,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n\n\nfrom heapq import heappop, heappush\n\n\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\npq = []\n\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\n\nappeared = set((0, 0, 0))\n\n\n\nfor _ in range(K):\n\n # Pop maximum value\n\n val, i, j, k = heappop(pq)\n\n print((-val))\n\n\n\n # Add next value\n\n if i + 1 < X and (i + 1, j, k) not in appeared:\n\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n\n appeared.add((i + 1, j, k))\n\n\n\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n\n appeared.add((i, j + 1, k))\n\n\n\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n\n appeared.add((i, j, k + 1))\n\n\n# optimized version of the same code:\n","target":"\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\nres = []\n\nfor i in range(X):\n\n for j in range(Y):\n\n for k in range(Z):\n\n if (i + 1) * (j + 1) * (k + 1) <= K:\n\n res.append(A[i] + B[j] + C[k])\n\n else:\n\n break\n\n\n\nres.sort(reverse=True)\n\nfor i in range(K):\n\n print((res[i]))\n","code_v0_loc":33,"code_v1_loc":22,"code_v0_num_chars":923,"code_v1_num_chars":509,"code_v0_no_empty_lines":"from heapq import heappop, heappush\n\nX, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort(reverse=True)\nB.sort(reverse=True)\nC.sort(reverse=True)\npq = []\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\nappeared = set((0, 0, 0))\nfor _ in range(K):\n # Pop maximum value\n val, i, j, k = heappop(pq)\n print((-val))\n # Add next value\n if i + 1 < X and (i + 1, j, k) not in appeared:\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n appeared.add((i + 1, j, k))\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n appeared.add((i, j + 1, k))\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n appeared.add((i, j, k + 1))\n","code_v1_no_empty_lines":"X, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort(reverse=True)\nB.sort(reverse=True)\nC.sort(reverse=True)\nres = []\nfor i in range(X):\n for j in range(Y):\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) <= K:\n res.append(A[i] + B[j] + C[k])\n else:\n break\nres.sort(reverse=True)\nfor i in range(K):\n print((res[i]))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-from heapq import heappop, heappush","-","-pq = []","-heappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))","-appeared = set((0, 0, 0))","-for _ in range(K):","- # Pop maximum value","- val, i, j, k = heappop(pq)","- print((-val))","- # Add next value","- if i + 1 < X and (i + 1, j, k) not in appeared:","- heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))","- appeared.add((i + 1, j, k))","- if j + 1 < Y and (i, j + 1, k) not in appeared:","- heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))","- appeared.add((i, j + 1, k))","- if k + 1 < Z and (i, j, k + 1) not in appeared:","- heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))","- appeared.add((i, j, k + 1))","+res = []","+for i in range(X):","+ for j in range(Y):","+ for k in range(Z):","+ if (i + 1) * (j + 1) * (k + 1) <= K:","+ res.append(A[i] + B[j] + C[k])","+ else:","+ break","+res.sort(reverse=True)","+for i in range(K):","+ print((res[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3859105117,"measured_runtime_v1":0.2075348065,"runtime_lift":1.8594977789,"key":["s065985582","s294135268"]} +{"user_id":"u944325914","problem_id":"p02773","language":"python","submission_id_v0":"s220148525","submission_id_v1":"s009987907","cpu_time_v0":1010,"cpu_time_v1":521,"memory_v0":104656,"memory_v1":50176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport collections\n\nn = int(eval(input()))\n\na=[eval(input()) for _ in range(n)]\n\nanslist=[]\n\nb=collections.Counter(a)\n\nc=max(list(b.values()))\n\nfor i in b:\n\n if b[i]==c:\n\n anslist.append(i)\n\nd=sorted(anslist)\n\nfor i in tuple(d):\n\n print(i)\n\n# optimized version of the same code:\n","target":"from collections import Counter\n\nn=int(eval(input()))\n\na=[]\n\nfor i in range(n):\n\n a.append(eval(input()))\n\nac=Counter(a)\n\nacs=sorted(list(ac.items()),key=lambda x:x[1],reverse=1)\n\nz=len(acs)\n\ni=0\n\ntemp=[]\n\n\n\nwhile i<=z-1 and acs[i][1]==acs[0][1] :\n\n temp.append(acs[i][0])\n\n i+=1\n\ntemp.sort()\n\nfor i in temp:\n\n print(i)","code_v0_loc":12,"code_v1_loc":17,"code_v0_num_chars":240,"code_v1_num_chars":305,"code_v0_no_empty_lines":"import collections\n\nn = int(eval(input()))\na = [eval(input()) for _ in range(n)]\nanslist = []\nb = collections.Counter(a)\nc = max(list(b.values()))\nfor i in b:\n if b[i] == c:\n anslist.append(i)\nd = sorted(anslist)\nfor i in tuple(d):\n print(i)\n","code_v1_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\na = []\nfor i in range(n):\n a.append(eval(input()))\nac = Counter(a)\nacs = sorted(list(ac.items()), key=lambda x: x[1], reverse=1)\nz = len(acs)\ni = 0\ntemp = []\nwhile i <= z - 1 and acs[i][1] == acs[0][1]:\n temp.append(acs[i][0])\n i += 1\ntemp.sort()\nfor i in temp:\n print(i)\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["-import collections","+from collections import Counter","-a = [eval(input()) for _ in range(n)]","-anslist = []","-b = collections.Counter(a)","-c = max(list(b.values()))","-for i in b:","- if b[i] == c:","- anslist.append(i)","-d = sorted(anslist)","-for i in tuple(d):","+a = []","+for i in range(n):","+ a.append(eval(input()))","+ac = Counter(a)","+acs = sorted(list(ac.items()), key=lambda x: x[1], reverse=1)","+z = len(acs)","+i = 0","+temp = []","+while i <= z - 1 and acs[i][1] == acs[0][1]:","+ temp.append(acs[i][0])","+ i += 1","+temp.sort()","+for i in temp:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3929853504,"measured_runtime_v1":0.3037585902,"runtime_lift":1.2937423435,"key":["s220148525","s009987907"]} +{"user_id":"u857759499","problem_id":"p03371","language":"python","submission_id_v0":"s203363465","submission_id_v1":"s893730989","cpu_time_v0":85,"cpu_time_v1":17,"memory_v0":7096,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c,x,y = list(map(int,input().split()))\n\nxy = max(x,y)*2+1\n\nprint((min([c*i + max(0,a*(x-i\/\/2)) +max(0,b*(y-i\/\/2)) for i in range(0,xy,2)])))\n\n# optimized version of the same code:\n","target":"a,b,c,x,y = list(map(int,input().split()))\n\nif x < y:\n\n a, b, x, y = b, a, y, x\n\nprint((min(a*x+b*y,2*c*y + a*(x-y),2*c*x)))","code_v0_loc":3,"code_v1_loc":4,"code_v0_num_chars":136,"code_v1_num_chars":119,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nxy = max(x, y) * 2 + 1\nprint(\n (\n min(\n [\n c * i + max(0, a * (x - i \/\/ 2)) + max(0, b * (y - i \/\/ 2))\n for i in range(0, xy, 2)\n ]\n )\n )\n)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nif x < y:\n a, b, x, y = b, a, y, x\nprint((min(a * x + b * y, 2 * c * y + a * (x - y), 2 * c * x)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-xy = max(x, y) * 2 + 1","-print(","- (","- min(","- [","- c * i + max(0, a * (x - i \/\/ 2)) + max(0, b * (y - i \/\/ 2))","- for i in range(0, xy, 2)","- ]","- )","- )","-)","+if x < y:","+ a, b, x, y = b, a, y, x","+print((min(a * x + b * y, 2 * c * y + a * (x - y), 2 * c * x)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2887920134,"measured_runtime_v1":0.2046661584,"runtime_lift":1.4110394,"key":["s203363465","s893730989"]} +{"user_id":"u628732336","problem_id":"p02412","language":"python","submission_id_v0":"s343999289","submission_id_v1":"s206971885","cpu_time_v0":1010,"cpu_time_v1":530,"memory_v0":7716,"memory_v1":7724,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nwhile True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == sum([s, m, e]):\n\n count += 1\n\n\n\n print(count)\n\n# optimized version of the same code:\n","target":"while True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == s+m+e:\n\n count += 1\n\n\n\n print(count)","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":314,"code_v1_num_chars":305,"code_v0_no_empty_lines":"while True:\n n, x = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for s in range(1, n - 1):\n for m in range(s + 1, n):\n for e in range(m + 1, n + 1):\n if x == sum([s, m, e]):\n count += 1\n print(count)\n","code_v1_no_empty_lines":"while True:\n n, x = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for s in range(1, n - 1):\n for m in range(s + 1, n):\n for e in range(m + 1, n + 1):\n if x == s + m + e:\n count += 1\n print(count)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if x == sum([s, m, e]):","+ if x == s + m + e:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3385973902,"measured_runtime_v1":0.2597145021,"runtime_lift":1.3037292389,"key":["s343999289","s206971885"]} +{"user_id":"u867826040","problem_id":"p02837","language":"python","submission_id_v0":"s705992872","submission_id_v1":"s870269222","cpu_time_v0":258,"cpu_time_v1":223,"memory_v0":9120,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.57,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nv = [[tuple(map(int, input().split()))for i in range(int(eval(input())))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [False] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = True\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n if f[x - 1] is not bool(y):\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nv = [[tuple(map(int, input().split()))for i in range(int(eval(input())))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [0] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = 1\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n #print(f,x,y,bin(i))\n\n if (i>>(x-1))&1 != y:\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":499,"code_v1_num_chars":520,"code_v0_no_empty_lines":"n = int(eval(input()))\nv = [\n [tuple(map(int, input().split())) for i in range(int(eval(input())))]\n for i in range(n)\n]\nans = 0\nfor i in range(2**n):\n f = [False] * n\n xy = []\n for j in range(n):\n if (i >> j) & 1:\n f[j] = True\n xy.append(v[j])\n flag = True\n for xyi in xy:\n for x, y in xyi:\n if f[x - 1] is not bool(y):\n flag = False\n break\n if flag:\n ans = max(ans, len(xy))\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nv = [\n [tuple(map(int, input().split())) for i in range(int(eval(input())))]\n for i in range(n)\n]\nans = 0\nfor i in range(2**n):\n f = [0] * n\n xy = []\n for j in range(n):\n if (i >> j) & 1:\n f[j] = 1\n xy.append(v[j])\n flag = True\n for xyi in xy:\n for x, y in xyi:\n # print(f,x,y,bin(i))\n if (i >> (x - 1)) & 1 != y:\n flag = False\n break\n if flag:\n ans = max(ans, len(xy))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["- f = [False] * n","+ f = [0] * n","- f[j] = True","+ f[j] = 1","- if f[x - 1] is not bool(y):","+ # print(f,x,y,bin(i))","+ if (i >> (x - 1)) & 1 != y:"],"diff_only_import_comment":false,"measured_runtime_v0":0.289290843,"measured_runtime_v1":0.2134317408,"runtime_lift":1.3554255893,"key":["s705992872","s870269222"]} +{"user_id":"u102461423","problem_id":"p03000","language":"python","submission_id_v0":"s091839409","submission_id_v1":"s096312338","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,X = list(map(int,input().split()))\n\nL = [0] + [int(x) for x in input().split()]\n\n\n\nD = [0] * (N+2)\n\nanswer = 1\n\nfor n in range(2,N+2):\n\n D[n] = D[n-1] + L[n-1]\n\n if D[n] <= X:\n\n answer += 1\n\n \n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nimport itertools\n\n\n\nN,X,*L = list(map(int,read().split()))\n\n\n\nanswer = sum(x <= X for x in itertools.accumulate([0]+L))\n\nprint(answer)","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":211,"code_v1_num_chars":250,"code_v0_no_empty_lines":"N, X = list(map(int, input().split()))\nL = [0] + [int(x) for x in input().split()]\nD = [0] * (N + 2)\nanswer = 1\nfor n in range(2, N + 2):\n D[n] = D[n - 1] + L[n - 1]\n if D[n] <= X:\n answer += 1\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport itertools\n\nN, X, *L = list(map(int, read().split()))\nanswer = sum(x <= X for x in itertools.accumulate([0] + L))\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-N, X = list(map(int, input().split()))","-L = [0] + [int(x) for x in input().split()]","-D = [0] * (N + 2)","-answer = 1","-for n in range(2, N + 2):","- D[n] = D[n - 1] + L[n - 1]","- if D[n] <= X:","- answer += 1","+import sys","+","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+import itertools","+","+N, X, *L = list(map(int, read().split()))","+answer = sum(x <= X for x in itertools.accumulate([0] + L))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4454345685,"measured_runtime_v1":0.3287086122,"runtime_lift":1.3551046487,"key":["s091839409","s096312338"]} +{"user_id":"u133936772","problem_id":"p02983","language":"python","submission_id_v0":"s915950177","submission_id_v1":"s423283368","cpu_time_v0":97,"cpu_time_v1":51,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nmod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r\/\/mod - l\/\/mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l+1, r+1):\n\n for j in range(l, i):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)\n\n# optimized version of the same code:\n","target":"mod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r\/\/mod - l\/\/mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l, r):\n\n for j in range(i+1, r+1):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":259,"code_v1_num_chars":259,"code_v0_no_empty_lines":"mod = 2019\nl, r = list(map(int, input().split()))\nif r \/\/ mod - l \/\/ mod > 0:\n print((0))\nelse:\n l %= mod\n r %= mod\n ans = mod\n for i in range(l + 1, r + 1):\n for j in range(l, i):\n ans = min(i * j % mod, ans)\n if ans == 0:\n break\n print(ans)\n","code_v1_no_empty_lines":"mod = 2019\nl, r = list(map(int, input().split()))\nif r \/\/ mod - l \/\/ mod > 0:\n print((0))\nelse:\n l %= mod\n r %= mod\n ans = mod\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n ans = min(i * j % mod, ans)\n if ans == 0:\n break\n print(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for i in range(l + 1, r + 1):","- for j in range(l, i):","+ for i in range(l, r):","+ for j in range(i + 1, r + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.3490325066,"measured_runtime_v1":0.2693671175,"runtime_lift":1.2957502381,"key":["s915950177","s423283368"]} +{"user_id":"u998741086","problem_id":"p03425","language":"python","submission_id_v0":"s570150327","submission_id_v1":"s255248054","cpu_time_v0":227,"cpu_time_v1":144,"memory_v0":16268,"memory_v1":16064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.56,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env python3\n\n\n\nn = int(eval(input()))\n\ns = [eval(input()) for _ in range(n)]\n\n\n\nc = [0 for _ in range(5)]\n\nt = 'MARCH'\n\n\n\nfor i in range(n):\n\n for j in range(5):\n\n if s[i][0] == t[j]:\n\n c[j] += 1\n\nans = 0 \n\nfor i in range(5):\n\n for j in range(i+1, 5): \n\n for k in range(j+1, 5): \n\n ans += c[i]*c[k]*c[j]\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\n\n\nn = int(eval(input()))\n\ns = [eval(input()) for _ in range(n)]\n\nd = {}\n\n\n\nfor c in s:\n\n if c[0] not in d:\n\n d[c[0]] = 1 \n\n else:\n\n d[c[0]] += 1\n\n\n\ntmp = d.copy()\n\nt = ['M', 'A', 'R', 'C', 'H']\n\nfor c in tmp:\n\n if c not in t:\n\n d.pop(c)\n\n\n\nans = 0 \n\ndlist = list(d.items())\n\nfor i in range(len(dlist)):\n\n for j in range(i+1, len(dlist)):\n\n for k in range(j+1, len(dlist)):\n\n ans += dlist[i][1]*dlist[j][1]*dlist[k][1]\n\nprint(ans)\n","code_v0_loc":18,"code_v1_loc":25,"code_v0_num_chars":357,"code_v1_num_chars":493,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nn = int(eval(input()))\ns = [eval(input()) for _ in range(n)]\nc = [0 for _ in range(5)]\nt = \"MARCH\"\nfor i in range(n):\n for j in range(5):\n if s[i][0] == t[j]:\n c[j] += 1\nans = 0\nfor i in range(5):\n for j in range(i + 1, 5):\n for k in range(j + 1, 5):\n ans += c[i] * c[k] * c[j]\nprint(ans)\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nn = int(eval(input()))\ns = [eval(input()) for _ in range(n)]\nd = {}\nfor c in s:\n if c[0] not in d:\n d[c[0]] = 1\n else:\n d[c[0]] += 1\ntmp = d.copy()\nt = [\"M\", \"A\", \"R\", \"C\", \"H\"]\nfor c in tmp:\n if c not in t:\n d.pop(c)\nans = 0\ndlist = list(d.items())\nfor i in range(len(dlist)):\n for j in range(i + 1, len(dlist)):\n for k in range(j + 1, len(dlist)):\n ans += dlist[i][1] * dlist[j][1] * dlist[k][1]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":28.0,"diff":["-c = [0 for _ in range(5)]","-t = \"MARCH\"","-for i in range(n):","- for j in range(5):","- if s[i][0] == t[j]:","- c[j] += 1","+d = {}","+for c in s:","+ if c[0] not in d:","+ d[c[0]] = 1","+ else:","+ d[c[0]] += 1","+tmp = d.copy()","+t = [\"M\", \"A\", \"R\", \"C\", \"H\"]","+for c in tmp:","+ if c not in t:","+ d.pop(c)","-for i in range(5):","- for j in range(i + 1, 5):","- for k in range(j + 1, 5):","- ans += c[i] * c[k] * c[j]","+dlist = list(d.items())","+for i in range(len(dlist)):","+ for j in range(i + 1, len(dlist)):","+ for k in range(j + 1, len(dlist)):","+ ans += dlist[i][1] * dlist[j][1] * dlist[k][1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.3218575408,"measured_runtime_v1":0.2488505929,"runtime_lift":1.2933766287,"key":["s570150327","s255248054"]} +{"user_id":"u661290476","problem_id":"p00053","language":"python","submission_id_v0":"s978814614","submission_id_v1":"s421101567","cpu_time_v0":420,"cpu_time_v1":210,"memory_v0":18368,"memory_v1":51028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nprim=[True]*1000000\n\nprim[0],prim[1]=False,False\n\nfor i in range(2,1000):\n\n if prim[i]:\n\n for j in range(i*2,1000000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(eval(input()))\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))\n\n# optimized version of the same code:\n","target":"prim=[True]*1000000\n\nprim[0]=prim[1]=False\n\nfor i in range(2,350):\n\n if prim[i]:\n\n for j in range(i*2,110000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(eval(input()))\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":297,"code_v1_num_chars":289,"code_v0_no_empty_lines":"prim = [True] * 1000000\nprim[0], prim[1] = False, False\nfor i in range(2, 1000):\n if prim[i]:\n for j in range(i * 2, 1000000, i):\n prim[j] = False\nprime = [i for i, j in enumerate(prim) if j == True]\nwhile True:\n n = int(eval(input()))\n if n == 0:\n break\n print((sum(prime[:n])))\n","code_v1_no_empty_lines":"prim = [True] * 1000000\nprim[0] = prim[1] = False\nfor i in range(2, 350):\n if prim[i]:\n for j in range(i * 2, 110000, i):\n prim[j] = False\nprime = [i for i, j in enumerate(prim) if j == True]\nwhile True:\n n = int(eval(input()))\n if n == 0:\n break\n print((sum(prime[:n])))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-prim[0], prim[1] = False, False","-for i in range(2, 1000):","+prim[0] = prim[1] = False","+for i in range(2, 350):","- for j in range(i * 2, 1000000, i):","+ for j in range(i * 2, 110000, i):"],"diff_only_import_comment":false,"measured_runtime_v0":1.0302433112,"measured_runtime_v1":0.6551637814,"runtime_lift":1.5724973516,"key":["s978814614","s421101567"]} +{"user_id":"u113971909","problem_id":"p03162","language":"python","submission_id_v0":"s130783532","submission_id_v1":"s220078110","cpu_time_v0":1281,"cpu_time_v1":522,"memory_v0":14812,"memory_v1":22816,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.25,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nimport numpy as np\n\nN = int(eval(input()))\n\ndp = np.zeros((N+1,3), dtype=np.int)\n\nX = list(map(int, input().split()))\n\nfor _ in range(3):\n\n dp[1][_] = X[_]\n\nfor n in range(2,N+1):\n\n X = list(map(int, input().split()))\n\n dp[n][0] = max(dp[n-1][1],dp[n-1][2]) + X[0]\n\n dp[n][1] = max(dp[n-1][2],dp[n-1][0]) + X[1]\n\n dp[n][2] = max(dp[n-1][0],dp[n-1][1]) + X[2]\n\nprint((max(dp[N])))\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin python3\n\n# -*- coding: utf-8 -*-\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n dp = [[0]*3 for i in range(N+1)]\n\n #dp[i][j] i\u307e\u3067\u3067\u3001j=0\u306fa\u3092\u9078\u3076,j=1\u306fb\u3092\u9078\u3076,j=2\u306fc\u3092\u9078\u3076\n\n for i in range(1,N+1):\n\n a, b, c=list(map(int,input().split()))\n\n dp[i][0] = max(dp[i-1][1]+a, dp[i-1][2]+a, dp[i][0])\n\n dp[i][1] = max(dp[i-1][2]+b, dp[i-1][0]+b, dp[i][1])\n\n dp[i][2] = max(dp[i-1][0]+c, dp[i-1][1]+c, dp[i][2])\n\n\n\n print((max(dp[N])))\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":14,"code_v1_loc":17,"code_v0_num_chars":416,"code_v1_num_chars":488,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nimport numpy as np\n\nN = int(eval(input()))\ndp = np.zeros((N + 1, 3), dtype=np.int)\nX = list(map(int, input().split()))\nfor _ in range(3):\n dp[1][_] = X[_]\nfor n in range(2, N + 1):\n X = list(map(int, input().split()))\n dp[n][0] = max(dp[n - 1][1], dp[n - 1][2]) + X[0]\n dp[n][1] = max(dp[n - 1][2], dp[n - 1][0]) + X[1]\n dp[n][2] = max(dp[n - 1][0], dp[n - 1][1]) + X[2]\nprint((max(dp[N])))\n","code_v1_no_empty_lines":"#!\/usr\/bin python3\n# -*- coding: utf-8 -*-\ndef main():\n N = int(eval(input()))\n dp = [[0] * 3 for i in range(N + 1)]\n # dp[i][j] i\u307e\u3067\u3067\u3001j=0\u306fa\u3092\u9078\u3076,j=1\u306fb\u3092\u9078\u3076,j=2\u306fc\u3092\u9078\u3076\n for i in range(1, N + 1):\n a, b, c = list(map(int, input().split()))\n dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a, dp[i][0])\n dp[i][1] = max(dp[i - 1][2] + b, dp[i - 1][0] + b, dp[i][1])\n dp[i][2] = max(dp[i - 1][0] + c, dp[i - 1][1] + c, dp[i][2])\n print((max(dp[N])))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["-import sys","+#!\/usr\/bin python3","+# -*- coding: utf-8 -*-","+def main():","+ N = int(eval(input()))","+ dp = [[0] * 3 for i in range(N + 1)]","+ # dp[i][j] i\u307e\u3067\u3067\u3001j=0\u306fa\u3092\u9078\u3076,j=1\u306fb\u3092\u9078\u3076,j=2\u306fc\u3092\u9078\u3076","+ for i in range(1, N + 1):","+ a, b, c = list(map(int, input().split()))","+ dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a, dp[i][0])","+ dp[i][1] = max(dp[i - 1][2] + b, dp[i - 1][0] + b, dp[i][1])","+ dp[i][2] = max(dp[i - 1][0] + c, dp[i - 1][1] + c, dp[i][2])","+ print((max(dp[N])))","-input = sys.stdin.readline","-import numpy as np","-N = int(eval(input()))","-dp = np.zeros((N + 1, 3), dtype=np.int)","-X = list(map(int, input().split()))","-for _ in range(3):","- dp[1][_] = X[_]","-for n in range(2, N + 1):","- X = list(map(int, input().split()))","- dp[n][0] = max(dp[n - 1][1], dp[n - 1][2]) + X[0]","- dp[n][1] = max(dp[n - 1][2], dp[n - 1][0]) + X[1]","- dp[n][2] = max(dp[n - 1][0], dp[n - 1][1]) + X[2]","-print((max(dp[N])))","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":2.4970043278,"measured_runtime_v1":0.3113249114,"runtime_lift":8.02057348,"key":["s130783532","s220078110"]} +{"user_id":"u347600233","problem_id":"p03037","language":"python","submission_id_v0":"s661845965","submission_id_v1":"s817506416","cpu_time_v0":279,"cpu_time_v1":195,"memory_v0":7088,"memory_v1":16564,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, m = list(map(int, input().split()))\n\ngate = []\n\nl, r = list(map(int, input().split()))\n\nfor i in range(1, m):\n\n m, s = list(map(int, input().split()))\n\n if l < m:\n\n l = m\n\n if s < r:\n\n r = s\n\nprint((len([i for i in range(l, r + 1)])))\n\n# optimized version of the same code:\n","target":"n, m = list(map(int, input().split()))\n\nl, r = [0] * m, [0] * m\n\nfor i in range(m):\n\n l[i], r[i] = list(map(int, input().split()))\n\nprint((max(min(r) - max(l) + 1, 0)))","code_v0_loc":10,"code_v1_loc":5,"code_v0_num_chars":240,"code_v1_num_chars":157,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\ngate = []\nl, r = list(map(int, input().split()))\nfor i in range(1, m):\n m, s = list(map(int, input().split()))\n if l < m:\n l = m\n if s < r:\n r = s\nprint((len([i for i in range(l, r + 1)])))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nl, r = [0] * m, [0] * m\nfor i in range(m):\n l[i], r[i] = list(map(int, input().split()))\nprint((max(min(r) - max(l) + 1, 0)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-gate = []","-l, r = list(map(int, input().split()))","-for i in range(1, m):","- m, s = list(map(int, input().split()))","- if l < m:","- l = m","- if s < r:","- r = s","-print((len([i for i in range(l, r + 1)])))","+l, r = [0] * m, [0] * m","+for i in range(m):","+ l[i], r[i] = list(map(int, input().split()))","+print((max(min(r) - max(l) + 1, 0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.317712152,"measured_runtime_v1":0.2449507949,"runtime_lift":1.2970447884,"key":["s661845965","s817506416"]} +{"user_id":"u585963734","problem_id":"p02596","language":"python","submission_id_v0":"s961921352","submission_id_v1":"s631804156","cpu_time_v0":290,"cpu_time_v1":180,"memory_v0":48468,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.93,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nK=int(eval(input()))\n\n\n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n \n\nans=[0]*(pow(10,6)+1)\n\nans[0]=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n ans[i]=(ans[i-1]*10+7)%K\n\n if ans[i]==0:\n\n print(i)\n\n exit(0)\n\n\n\nprint((-1))\n\n# optimized version of the same code:\n","target":"import functools\n\n\n\nK=int(eval(input()))\n\n \n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n\n\nmod=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n mod=(mod*10+7)%K\n\n if mod==0:\n\n print(i)\n\n exit(0)\n\n \n\nprint((-1))","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":224,"code_v1_num_chars":212,"code_v0_no_empty_lines":"K = int(eval(input()))\nif K % 2 == 0:\n print((-1))\n exit(0)\nans = [0] * (pow(10, 6) + 1)\nans[0] = 0\nfor i in range(1, pow(10, 6)):\n ans[i] = (ans[i - 1] * 10 + 7) % K\n if ans[i] == 0:\n print(i)\n exit(0)\nprint((-1))\n","code_v1_no_empty_lines":"import functools\n\nK = int(eval(input()))\nif K % 2 == 0:\n print((-1))\n exit(0)\nmod = 0\nfor i in range(1, pow(10, 6)):\n mod = (mod * 10 + 7) % K\n if mod == 0:\n print(i)\n exit(0)\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["+import functools","+","-ans = [0] * (pow(10, 6) + 1)","-ans[0] = 0","+mod = 0","- ans[i] = (ans[i - 1] * 10 + 7) % K","- if ans[i] == 0:","+ mod = (mod * 10 + 7) % K","+ if mod == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.7143074386,"measured_runtime_v1":0.5444337668,"runtime_lift":1.3120189858,"key":["s961921352","s631804156"]} +{"user_id":"u311379832","problem_id":"p02537","language":"python","submission_id_v0":"s277145927","submission_id_v1":"s770419806","cpu_time_v0":790,"cpu_time_v1":668,"memory_v0":119112,"memory_v1":103304,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.44,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef segfunc(x, y): return max(x, y)\n\n\n\nclass SegmentTree:\n\n def __init__(self, arr):\n\n size = len(arr)\n\n n = 2 ** (size - 1).bit_length()\n\n self.n = n\n\n self.node = [0] * (2*n)\n\n for i in range(size):\n\n self.node[i+n-1] = arr[i]\n\n for i in reversed(list(range(n-2))):\n\n self.node[i] = segfunc(self.node[2*i+1], self.node[2*i+2])\n\n\n\n def update(self, i, x):\n\n i += self.n - 1\n\n self.node[i] = x\n\n while i > 0:\n\n i = (i - 1) \/\/ 2\n\n self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])\n\n\n\n def update(self, x, val):\n\n x += (self.n - 1)\n\n self.node[x] = val\n\n while x > 0:\n\n x = (x - 1) \/\/ 2\n\n self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])\n\n\n\n def query(self, a, b):\n\n res = 0\n\n l = self.n - 1 + a\n\n r = self.n - 1 + (b - 1)\n\n\n\n while l <= r:\n\n if l == r:\n\n res = segfunc(res, self.node[l])\n\n break\n\n\n\n if l % 2 == 0:\n\n res = segfunc(res, self.node[l])\n\n if r % 2 == 1:\n\n res = segfunc(res, self.node[r])\n\n l = l \/\/ 2\n\n r = r \/\/ 2 - 1\n\n\n\n return res\n\n\n\nN, K = list(map(int, input().split()))\n\nINF = 0\n\nseg = SegmentTree([0] * 300000)\n\nfor i in range(N):\n\n a = int(eval(input()))\n\n tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1\n\n seg.update(a, tmp)\n\nprint((seg.query(0, 300000)))\n\n\n# optimized version of the same code:\n","target":"def segfunc(x, y): return max(x, y)\n\ndef update(i, x):\n\n i += MAX_N-1\n\n node[i] = x\n\n while i:\n\n i = (i-1)\/\/2\n\n node[i] = segfunc(node[i*2+1], node[i*2+2])\n\n\n\ndef query(l, r):\n\n L = l + MAX_N\n\n R = r + MAX_N\n\n s = INF\n\n while L < R:\n\n if R & 1:\n\n R -= 1\n\n s = segfunc(s, node[R - 1])\n\n if L & 1:\n\n s = segfunc(s, node[L - 1])\n\n L += 1\n\n L >>= 1\n\n R >>= 1\n\n return s\n\n\n\nN, K = list(map(int, input().split()))\n\nMAX_N = 2**(300005).bit_length()\n\na = [int(eval(input())) for _ in range(N)]\n\nnode = [0] * (2 * MAX_N)\n\nINF = 0\n\nans = 0\n\n\n\n#for i in range(N):\n\n# update(i, a[i])\n\n\n\nfor i in a:\n\n tmp = query(max(i - K, 0), min(300005, i + K) + 1)\n\n update(i, tmp + 1)\n\n ans = max(ans, tmp + 1)\n\nprint(ans)\n","code_v0_loc":54,"code_v1_loc":38,"code_v0_num_chars":1524,"code_v1_num_chars":809,"code_v0_no_empty_lines":"def segfunc(x, y):\n return max(x, y)\n\n\nclass SegmentTree:\n def __init__(self, arr):\n size = len(arr)\n n = 2 ** (size - 1).bit_length()\n self.n = n\n self.node = [0] * (2 * n)\n for i in range(size):\n self.node[i + n - 1] = arr[i]\n for i in reversed(list(range(n - 2))):\n self.node[i] = segfunc(self.node[2 * i + 1], self.node[2 * i + 2])\n\n def update(self, i, x):\n i += self.n - 1\n self.node[i] = x\n while i > 0:\n i = (i - 1) \/\/ 2\n self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])\n\n def update(self, x, val):\n x += self.n - 1\n self.node[x] = val\n while x > 0:\n x = (x - 1) \/\/ 2\n self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])\n\n def query(self, a, b):\n res = 0\n l = self.n - 1 + a\n r = self.n - 1 + (b - 1)\n while l <= r:\n if l == r:\n res = segfunc(res, self.node[l])\n break\n if l % 2 == 0:\n res = segfunc(res, self.node[l])\n if r % 2 == 1:\n res = segfunc(res, self.node[r])\n l = l \/\/ 2\n r = r \/\/ 2 - 1\n return res\n\n\nN, K = list(map(int, input().split()))\nINF = 0\nseg = SegmentTree([0] * 300000)\nfor i in range(N):\n a = int(eval(input()))\n tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1\n seg.update(a, tmp)\nprint((seg.query(0, 300000)))\n","code_v1_no_empty_lines":"def segfunc(x, y):\n return max(x, y)\n\n\ndef update(i, x):\n i += MAX_N - 1\n node[i] = x\n while i:\n i = (i - 1) \/\/ 2\n node[i] = segfunc(node[i * 2 + 1], node[i * 2 + 2])\n\n\ndef query(l, r):\n L = l + MAX_N\n R = r + MAX_N\n s = INF\n while L < R:\n if R & 1:\n R -= 1\n s = segfunc(s, node[R - 1])\n if L & 1:\n s = segfunc(s, node[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\nN, K = list(map(int, input().split()))\nMAX_N = 2 ** (300005).bit_length()\na = [int(eval(input())) for _ in range(N)]\nnode = [0] * (2 * MAX_N)\nINF = 0\nans = 0\n# for i in range(N):\n# update(i, a[i])\nfor i in a:\n tmp = query(max(i - K, 0), min(300005, i + K) + 1)\n update(i, tmp + 1)\n ans = max(ans, tmp + 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":29.6296296296,"diff":["-class SegmentTree:","- def __init__(self, arr):","- size = len(arr)","- n = 2 ** (size - 1).bit_length()","- self.n = n","- self.node = [0] * (2 * n)","- for i in range(size):","- self.node[i + n - 1] = arr[i]","- for i in reversed(list(range(n - 2))):","- self.node[i] = segfunc(self.node[2 * i + 1], self.node[2 * i + 2])","+def update(i, x):","+ i += MAX_N - 1","+ node[i] = x","+ while i:","+ i = (i - 1) \/\/ 2","+ node[i] = segfunc(node[i * 2 + 1], node[i * 2 + 2])","- def update(self, i, x):","- i += self.n - 1","- self.node[i] = x","- while i > 0:","- i = (i - 1) \/\/ 2","- self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])","- def update(self, x, val):","- x += self.n - 1","- self.node[x] = val","- while x > 0:","- x = (x - 1) \/\/ 2","- self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])","-","- def query(self, a, b):","- res = 0","- l = self.n - 1 + a","- r = self.n - 1 + (b - 1)","- while l <= r:","- if l == r:","- res = segfunc(res, self.node[l])","- break","- if l % 2 == 0:","- res = segfunc(res, self.node[l])","- if r % 2 == 1:","- res = segfunc(res, self.node[r])","- l = l \/\/ 2","- r = r \/\/ 2 - 1","- return res","+def query(l, r):","+ L = l + MAX_N","+ R = r + MAX_N","+ s = INF","+ while L < R:","+ if R & 1:","+ R -= 1","+ s = segfunc(s, node[R - 1])","+ if L & 1:","+ s = segfunc(s, node[L - 1])","+ L += 1","+ L >>= 1","+ R >>= 1","+ return s","+MAX_N = 2 ** (300005).bit_length()","+a = [int(eval(input())) for _ in range(N)]","+node = [0] * (2 * MAX_N)","-seg = SegmentTree([0] * 300000)","-for i in range(N):","- a = int(eval(input()))","- tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1","- seg.update(a, tmp)","-print((seg.query(0, 300000)))","+ans = 0","+# for i in range(N):","+# update(i, a[i])","+for i in a:","+ tmp = query(max(i - K, 0), min(300005, i + K) + 1)","+ update(i, tmp + 1)","+ ans = max(ans, tmp + 1)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":2.9777374048,"measured_runtime_v1":0.391063194,"runtime_lift":7.6144660253,"key":["s277145927","s770419806"]} +{"user_id":"u461833298","problem_id":"p02899","language":"python","submission_id_v0":"s458295975","submission_id_v1":"s339978019","cpu_time_v0":623,"cpu_time_v1":111,"memory_v0":29124,"memory_v1":13880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.18,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nA = [int(x) for x in input().split()]\n\n\n\ntmp = [x for x in zip(A, list(range(1, N+1)))]\n\ntmp = np.array(sorted(tmp))\n\nprint((*tmp[:,1]))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = [int(x) for x in input().split()]\n\nB = [0 for _ in range(N)]\n\nfor i in range(N):\n\n B[A[i]-1] = i+1\n\nprint((*B))","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":166,"code_v1_num_chars":134,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = [int(x) for x in input().split()]\ntmp = [x for x in zip(A, list(range(1, N + 1)))]\ntmp = np.array(sorted(tmp))\nprint((*tmp[:, 1]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(x) for x in input().split()]\nB = [0 for _ in range(N)]\nfor i in range(N):\n B[A[i] - 1] = i + 1\nprint((*B))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-import numpy as np","-","-tmp = [x for x in zip(A, list(range(1, N + 1)))]","-tmp = np.array(sorted(tmp))","-print((*tmp[:, 1]))","+B = [0 for _ in range(N)]","+for i in range(N):","+ B[A[i] - 1] = i + 1","+print((*B))"],"diff_only_import_comment":false,"measured_runtime_v0":1.9516685504,"measured_runtime_v1":0.359870365,"runtime_lift":5.4232544271,"key":["s458295975","s339978019"]} +{"user_id":"u188827677","problem_id":"p03037","language":"python","submission_id_v0":"s698380012","submission_id_v1":"s714478978","cpu_time_v0":302,"cpu_time_v1":221,"memory_v0":11020,"memory_v1":9144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,M = list(map(int, input().split()))\n\nL = []\n\nR = []\n\nfor _ in range(M):\n\n l,r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n\n\nans = min(R)-max(L)+1\n\nif ans < 0:\n\n print((0))\n\nelse:\n\n print(ans)\n\n \n\n# optimized version of the same code:\n","target":"n,m = list(map(int, input().split()))\n\nmax_l = float(\"-inf\")\n\nmin_r = float(\"inf\")\n\nfor _ in range(m):\n\n l,r = list(map(int, input().split()))\n\n max_l = max(max_l, l)\n\n min_r = min(min_r, r)\n\nans = min_r - max_l + 1\n\nif ans > 0:\n\n print(ans)\n\nelse:\n\n print((0))","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":207,"code_v1_num_chars":252,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nL = []\nR = []\nfor _ in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\nans = min(R) - max(L) + 1\nif ans < 0:\n print((0))\nelse:\n print(ans)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nmax_l = float(\"-inf\")\nmin_r = float(\"inf\")\nfor _ in range(m):\n l, r = list(map(int, input().split()))\n max_l = max(max_l, l)\n min_r = min(min_r, r)\nans = min_r - max_l + 1\nif ans > 0:\n print(ans)\nelse:\n print((0))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-N, M = list(map(int, input().split()))","-L = []","-R = []","-for _ in range(M):","+n, m = list(map(int, input().split()))","+max_l = float(\"-inf\")","+min_r = float(\"inf\")","+for _ in range(m):","- L.append(l)","- R.append(r)","-ans = min(R) - max(L) + 1","-if ans < 0:","+ max_l = max(max_l, l)","+ min_r = min(min_r, r)","+ans = min_r - max_l + 1","+if ans > 0:","+ print(ans)","+else:","-else:","- print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2637555127,"measured_runtime_v1":0.1756164875,"runtime_lift":1.5018835444,"key":["s698380012","s714478978"]} +{"user_id":"u989345508","problem_id":"p03273","language":"python","submission_id_v0":"s593926411","submission_id_v1":"s601943768","cpu_time_v0":162,"cpu_time_v1":20,"memory_v0":14024,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.65,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nh,w=input().split()\n\nh,w=int(h),int(w)\n\nx3=[]\n\nfor i in range(h):\n\n x1=input()\n\n if x1 != w*\".\":\n\n x3.append(list(x1))\n\n\n\nx3=np.array(x3).T.tolist()\n\nx4=[]\n\nfor i in range(w):\n\n if x3[i] != [\".\" for i in range(len(x3[i]))]:\n\n x4.append(x3[i])\n\n\n\nx4=np.array(x4).T.tolist()\n\nfor i in range(len(x4)):\n\n for j in range(len(x4[0])):\n\n print(x4[i][j],end=\"\")\n\n print()\n\n\n# optimized version of the same code:\n","target":"h,w=list(map(int,input().split()))\n\na=[]\n\nfor i in range(h):\n\n k=eval(input())\n\n if k!=\".\"*w:\n\n a.append(k)\n\nl=len(a)\n\n#print(a)\n\nans=[[] for i in range(l)]\n\nfor i in range(w):\n\n for j in range(l):\n\n if a[j][i]==\"#\":\n\n for k in range(l):\n\n ans[k].append(a[k][i])\n\n break\n\nfor i in range(l):\n\n print((\"\".join(ans[i])))","code_v0_loc":20,"code_v1_loc":17,"code_v0_num_chars":421,"code_v1_num_chars":366,"code_v0_no_empty_lines":"import numpy as np\n\nh, w = input().split()\nh, w = int(h), int(w)\nx3 = []\nfor i in range(h):\n x1 = input()\n if x1 != w * \".\":\n x3.append(list(x1))\nx3 = np.array(x3).T.tolist()\nx4 = []\nfor i in range(w):\n if x3[i] != [\".\" for i in range(len(x3[i]))]:\n x4.append(x3[i])\nx4 = np.array(x4).T.tolist()\nfor i in range(len(x4)):\n for j in range(len(x4[0])):\n print(x4[i][j], end=\"\")\n print()\n","code_v1_no_empty_lines":"h, w = list(map(int, input().split()))\na = []\nfor i in range(h):\n k = eval(input())\n if k != \".\" * w:\n a.append(k)\nl = len(a)\n# print(a)\nans = [[] for i in range(l)]\nfor i in range(w):\n for j in range(l):\n if a[j][i] == \"#\":\n for k in range(l):\n ans[k].append(a[k][i])\n break\nfor i in range(l):\n print((\"\".join(ans[i])))\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-import numpy as np","-","-h, w = input().split()","-h, w = int(h), int(w)","-x3 = []","+h, w = list(map(int, input().split()))","+a = []","- x1 = input()","- if x1 != w * \".\":","- x3.append(list(x1))","-x3 = np.array(x3).T.tolist()","-x4 = []","+ k = eval(input())","+ if k != \".\" * w:","+ a.append(k)","+l = len(a)","+# print(a)","+ans = [[] for i in range(l)]","- if x3[i] != [\".\" for i in range(len(x3[i]))]:","- x4.append(x3[i])","-x4 = np.array(x4).T.tolist()","-for i in range(len(x4)):","- for j in range(len(x4[0])):","- print(x4[i][j], end=\"\")","- print()","+ for j in range(l):","+ if a[j][i] == \"#\":","+ for k in range(l):","+ ans[k].append(a[k][i])","+ break","+for i in range(l):","+ print((\"\".join(ans[i])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.2296837176,"measured_runtime_v1":0.215579181,"runtime_lift":5.7040930953,"key":["s593926411","s601943768"]} +{"user_id":"u945359338","problem_id":"p02595","language":"python","submission_id_v0":"s600709561","submission_id_v1":"s552125258","cpu_time_v0":840,"cpu_time_v1":755,"memory_v0":57424,"memory_v1":9988,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.12,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom decimal import *\n\ngetcontext().prec = 14\n\n\n\nN, D = list(map(int, input().split()))\n\n\n\n\n\ndef distance(x1, x2, y1, y2):\n\n dx = x2-x1\n\n dy = y2-y1\n\n return (dx*dx + dy*dy).sqrt()\n\n\n\n\n\nX = [0] * N\n\nY = [0] * N\n\nans = 0\n\nfor i in range(N):\n\n X[i], Y[i] = list(map(Decimal, input().split()))\n\n if (distance(0, X[i], 0, Y[i]) <= D):\n\n ans += 1\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"from decimal import *\n\ngetcontext().prec = 14 # \u3042\u3093\u307e\u308a\u5927\u304d\u3044\u3068\u8a08\u7b97\u9045\u3044\u304b\u3082\n\n\n\nN, D = list(map(int, input().split()))\n\n\n\ndef distance(x1, x2, y1, y2):\n\n dx = x2-x1\n\n dy = y2-y1\n\n return (dx*dx + dy*dy).sqrt()\n\n\n\nans = 0\n\nfor i in range(N):\n\n X, Y = list(map(Decimal, input().split()))\n\n if (distance(0, X, 0, Y) <= D):\n\n ans += 1\n\n\n\nprint(ans)\n","code_v0_loc":21,"code_v1_loc":17,"code_v0_num_chars":366,"code_v1_num_chars":342,"code_v0_no_empty_lines":"from decimal import *\n\ngetcontext().prec = 14\nN, D = list(map(int, input().split()))\n\n\ndef distance(x1, x2, y1, y2):\n dx = x2 - x1\n dy = y2 - y1\n return (dx * dx + dy * dy).sqrt()\n\n\nX = [0] * N\nY = [0] * N\nans = 0\nfor i in range(N):\n X[i], Y[i] = list(map(Decimal, input().split()))\n if distance(0, X[i], 0, Y[i]) <= D:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"from decimal import *\n\ngetcontext().prec = 14 # \u3042\u3093\u307e\u308a\u5927\u304d\u3044\u3068\u8a08\u7b97\u9045\u3044\u304b\u3082\nN, D = list(map(int, input().split()))\n\n\ndef distance(x1, x2, y1, y2):\n dx = x2 - x1\n dy = y2 - y1\n return (dx * dx + dy * dy).sqrt()\n\n\nans = 0\nfor i in range(N):\n X, Y = list(map(Decimal, input().split()))\n if distance(0, X, 0, Y) <= D:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":19.0476190476,"diff":["-getcontext().prec = 14","+getcontext().prec = 14 # \u3042\u3093\u307e\u308a\u5927\u304d\u3044\u3068\u8a08\u7b97\u9045\u3044\u304b\u3082","-X = [0] * N","-Y = [0] * N","- X[i], Y[i] = list(map(Decimal, input().split()))","- if distance(0, X[i], 0, Y[i]) <= D:","+ X, Y = list(map(Decimal, input().split()))","+ if distance(0, X, 0, Y) <= D:"],"diff_only_import_comment":false,"measured_runtime_v0":0.4031279888,"measured_runtime_v1":0.2312259483,"runtime_lift":1.7434374978,"key":["s600709561","s552125258"]} +{"user_id":"u803617136","problem_id":"p03325","language":"python","submission_id_v0":"s116805601","submission_id_v1":"s513357045","cpu_time_v0":184,"cpu_time_v1":27,"memory_v0":40560,"memory_v1":4148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\n\n\nseq = list(map(int, input().split()))\n\n\n\ncnt = 0\n\n\n\nfor num in seq:\n\n while num % 2 == 0:\n\n cnt += 1\n\n num \/= 2\n\n\n\nprint(cnt)\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\nans = 0\n\nfor num in a:\n\n ans += format(num, 'b')[::-1].find('1')\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":6,"code_v0_num_chars":163,"code_v1_num_chars":134,"code_v0_no_empty_lines":"N = int(eval(input()))\nseq = list(map(int, input().split()))\ncnt = 0\nfor num in seq:\n while num % 2 == 0:\n cnt += 1\n num \/= 2\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nans = 0\nfor num in a:\n ans += format(num, \"b\")[::-1].find(\"1\")\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-N = int(eval(input()))","-seq = list(map(int, input().split()))","-cnt = 0","-for num in seq:","- while num % 2 == 0:","- cnt += 1","- num \/= 2","-print(cnt)","+n = int(eval(input()))","+a = list(map(int, input().split()))","+ans = 0","+for num in a:","+ ans += format(num, \"b\")[::-1].find(\"1\")","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1574799829,"measured_runtime_v1":0.0061847587,"runtime_lift":25.4625913758,"key":["s116805601","s513357045"]} +{"user_id":"u564589929","problem_id":"p03371","language":"python","submission_id_v0":"s501790970","submission_id_v1":"s324668886","cpu_time_v0":93,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.72,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(eval(input()))\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = INF\n\n for k in range(100001):\n\n yen = 2 * c * k + max(0, x-k) * a + max(0, y-k) * b\n\n ans = min(ans, yen)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(eval(input()))\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = 0\n\n if a + b <= 2 * c:\n\n mn = min(x, y)\n\n ans = a * mn + b * mn + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)\n\n\n\n else:\n\n mn = min(x, y)\n\n ans = mn * 2 * c + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)\n\n\n\n print(ans)\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","code_v0_loc":28,"code_v1_loc":34,"code_v0_num_chars":727,"code_v1_num_chars":868,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\n\n\ndef II():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MI1():\n return list(map(int1, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI1():\n return list(map(int1, input().split()))\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef printlist(lst, k=\"\\n\"):\n print((k.join(list(map(str, lst)))))\n\n\nINF = float(\"inf\")\n\n\ndef solve():\n a, b, c, x, y = MI()\n ans = INF\n for k in range(100001):\n yen = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b\n ans = min(ans, yen)\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\n\n\ndef II():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MI1():\n return list(map(int1, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI1():\n return list(map(int1, input().split()))\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef printlist(lst, k=\"\\n\"):\n print((k.join(list(map(str, lst)))))\n\n\nINF = float(\"inf\")\n\n\ndef solve():\n a, b, c, x, y = MI()\n ans = 0\n if a + b <= 2 * c:\n mn = min(x, y)\n ans = (\n a * mn\n + b * mn\n + max(0, x - mn) * min(a, 2 * c)\n + max(0, y - mn) * min(b, 2 * c)\n )\n else:\n mn = min(x, y)\n ans = (\n mn * 2 * c + max(0, x - mn) * min(a, 2 * c) + max(0, y - mn) * min(b, 2 * c)\n )\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["- ans = INF","- for k in range(100001):","- yen = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b","- ans = min(ans, yen)","+ ans = 0","+ if a + b <= 2 * c:","+ mn = min(x, y)","+ ans = (","+ a * mn","+ + b * mn","+ + max(0, x - mn) * min(a, 2 * c)","+ + max(0, y - mn) * min(b, 2 * c)","+ )","+ else:","+ mn = min(x, y)","+ ans = (","+ mn * 2 * c + max(0, x - mn) * min(a, 2 * c) + max(0, y - mn) * min(b, 2 * c)","+ )"],"diff_only_import_comment":false,"measured_runtime_v0":1.2337559407,"measured_runtime_v1":0.3123451986,"runtime_lift":3.9499756873,"key":["s501790970","s324668886"]} +{"user_id":"u186838327","problem_id":"p03796","language":"python","submission_id_v0":"s155084707","submission_id_v1":"s301395968","cpu_time_v0":231,"cpu_time_v1":177,"memory_v0":4104,"memory_v1":38640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.38,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nn = int(eval(input()))\n\nprint((math.factorial(n)%(10**9+7)))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nans = 1\n\nmod = 10**9+7\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= mod\n\n\n\nans %= mod\n\nprint(ans)\n","code_v0_loc":3,"code_v1_loc":9,"code_v0_num_chars":65,"code_v1_num_chars":122,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nprint((math.factorial(n) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = 1\nmod = 10**9 + 7\nfor i in range(1, n + 1):\n ans *= i\n ans %= mod\nans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-import math","-","-print((math.factorial(n) % (10**9 + 7)))","+ans = 1","+mod = 10**9 + 7","+for i in range(1, n + 1):","+ ans *= i","+ ans %= mod","+ans %= mod","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5786725054,"measured_runtime_v1":0.2556207638,"runtime_lift":2.2637930378,"key":["s155084707","s301395968"]} +{"user_id":"u014333473","problem_id":"p03845","language":"python","submission_id_v0":"s045706452","submission_id_v1":"s705375036","cpu_time_v0":29,"cpu_time_v1":25,"memory_v0":9180,"memory_v1":9164,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,t=int(input()),list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n\n\n# optimized version of the same code:\n","target":"input();t=list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":160,"code_v1_num_chars":153,"code_v0_no_empty_lines":"n, t = int(input()), list(map(int, input().split()))\nT = sum(t)\nprint(\n *[\n T - t[i - 1] + j\n for i, j in [list(map(int, input().split())) for _ in range(int(input()))]\n ],\n sep=\"\\n\"\n)\n","code_v1_no_empty_lines":"input()\nt = list(map(int, input().split()))\nT = sum(t)\nprint(\n *[\n T - t[i - 1] + j\n for i, j in [list(map(int, input().split())) for _ in range(int(input()))]\n ],\n sep=\"\\n\"\n)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-n, t = int(input()), list(map(int, input().split()))","+input()","+t = list(map(int, input().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.308619008,"measured_runtime_v1":0.2417461898,"runtime_lift":1.2766240837,"key":["s045706452","s705375036"]} +{"user_id":"u906501980","problem_id":"p03363","language":"python","submission_id_v0":"s203042500","submission_id_v1":"s990747122","cpu_time_v0":316,"cpu_time_v1":264,"memory_v0":52496,"memory_v1":52544,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.46,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum={}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n if str(i) in list(num.keys()):\n\n num[str(i)] += 1\n\n else:\n\n num[str(i)] = 1\n\nout = [i*(i-1)\/\/2 for i in list(num.values()) if i>1]\n\nprint((sum(out)))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum = {}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n s = str(i)\n\n num[s] = 1 if s not in list(num.keys()) else num[s]+1\n\nout = [i*(i-1)\/\/2 for i in list(num.values()) if i > 1]\n\nprint((sum(out)))","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":295,"code_v1_num_chars":276,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = [int(i) for i in input().split()]\nS = [0] * (n + 1)\nnum = {}\nfor i in range(n):\n S[i + 1] = S[i] + A[i]\nfor i in S:\n if str(i) in list(num.keys()):\n num[str(i)] += 1\n else:\n num[str(i)] = 1\nout = [i * (i - 1) \/\/ 2 for i in list(num.values()) if i > 1]\nprint((sum(out)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = [int(i) for i in input().split()]\nS = [0] * (n + 1)\nnum = {}\nfor i in range(n):\n S[i + 1] = S[i] + A[i]\nfor i in S:\n s = str(i)\n num[s] = 1 if s not in list(num.keys()) else num[s] + 1\nout = [i * (i - 1) \/\/ 2 for i in list(num.values()) if i > 1]\nprint((sum(out)))\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["- if str(i) in list(num.keys()):","- num[str(i)] += 1","- else:","- num[str(i)] = 1","+ s = str(i)","+ num[s] = 1 if s not in list(num.keys()) else num[s] + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.4443410683,"measured_runtime_v1":0.2339228122,"runtime_lift":1.8995200341,"key":["s203042500","s990747122"]} +{"user_id":"u805332733","problem_id":"p02555","language":"python","submission_id_v0":"s317659277","submission_id_v1":"s521440898","cpu_time_v0":89,"cpu_time_v1":65,"memory_v0":64652,"memory_v1":63416,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.97,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef resolve():\n\n base = 10**9+7\n\n S = int(eval(input()))\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(1, S+1):\n\n for u in range(i-2):\n\n dp[i] += dp[u]\n\n dp[i] %= base\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n\n\n# optimized version of the same code:\n","target":"def resolve():\n\n base = 10**9+7\n\n S = int(eval(input()))\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(3, S+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()","code_v0_loc":15,"code_v1_loc":13,"code_v0_num_chars":263,"code_v1_num_chars":224,"code_v0_no_empty_lines":"def resolve():\n base = 10**9 + 7\n S = int(eval(input()))\n dp = [0] * (S + 1)\n dp[0] = 1\n for i in range(1, S + 1):\n for u in range(i - 2):\n dp[i] += dp[u]\n dp[i] %= base\n # print(dp)\n print((dp[S] % base))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"def resolve():\n base = 10**9 + 7\n S = int(eval(input()))\n dp = [0] * (S + 1)\n dp[0] = 1\n for i in range(3, S + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n # print(dp)\n print((dp[S] % base))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["- for i in range(1, S + 1):","- for u in range(i - 2):","- dp[i] += dp[u]","- dp[i] %= base","+ for i in range(3, S + 1):","+ dp[i] = dp[i - 1] + dp[i - 3]"],"diff_only_import_comment":false,"measured_runtime_v0":0.5217176821,"measured_runtime_v1":0.2045270953,"runtime_lift":2.5508487337,"key":["s317659277","s521440898"]} +{"user_id":"u340781749","problem_id":"p02604","language":"python","submission_id_v0":"s339976577","submission_id_v1":"s349402655","cpu_time_v0":907,"cpu_time_v1":582,"memory_v0":96844,"memory_v1":96788,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.83,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport os\n\nimport sys\n\n\n\nimport numpy as np\n\n\n\n\n\ndef solve(n, precalc_x, precalc_y):\n\n ans = np.full(n + 1, 10 ** 18, dtype=np.int64)\n\n\n\n def get_cost(v, bit):\n\n cost = 0\n\n pcx = precalc_x[v]\n\n pcy = precalc_y[v ^ bit]\n\n for i in range(n):\n\n if v & (1 << i):\n\n continue\n\n cost += min(pcx[i], pcy[i])\n\n return cost\n\n\n\n for bit in range(1 << n):\n\n k = (bit & 0x5555) + (bit >> 1 & 0x5555)\n\n k = (k & 0x3333) + (k >> 2 & 0x3333)\n\n k = (k & 0x0f0f) + (k >> 4 & 0x0f0f)\n\n k = (k & 0x00ff) + (k >> 8 & 0x00ff)\n\n v = bit\n\n while v:\n\n ans[k] = min(ans[k], get_cost(v, bit))\n\n v = (v - 1) & bit\n\n ans[k] = min(ans[k], get_cost(0, bit))\n\n\n\n return ans\n\n\n\n\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n from numba.pycc import CC\n\n\n\n cc = CC('my_module')\n\n cc.export('solve', '(i8, i8[:,:], i8[:,:])')(solve)\n\n cc.compile()\n\n exit()\n\n\n\nif os.name == 'posix':\n\n # noinspection PyUnresolvedReferences\n\n from my_module import solve\n\nelse:\n\n from numba import njit\n\n\n\n solve = njit('(i8, i8[:,:], i8[:,:])', cache=True)(solve)\n\n print('compiled', file=sys.stderr)\n\n\n\ninp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=' ')\n\nn = inp[0]\n\nxxx = inp[1::3]\n\nyyy = inp[2::3]\n\nppp = inp[3::3]\n\n\n\nbit_d = (((np.arange(1 << n)[:, None] & (1 << np.arange(n)))) > 0).astype(np.int64)\n\nprecalc_x = abs((xxx[None, :] * bit_d)[..., None] - xxx[None, None, :]).min(axis=1) * ppp[None, :]\n\nprecalc_y = abs((yyy[None, :] * bit_d)[..., None] - yyy[None, None, :]).min(axis=1) * ppp[None, :]\n\n\n\nans = solve(n, precalc_x, precalc_y)\n\nprint('\\n'.join(map(str, ans)))\n\n\n# optimized version of the same code:\n","target":"import os\n\nimport sys\n\n\n\nimport numpy as np\n\n\n\n\n\ndef solve(n, precalc_x, precalc_y):\n\n ans = np.full(n + 1, 10 ** 18, dtype=np.int64)\n\n\n\n def get_cost(v, bit):\n\n cost = 0\n\n pcx = precalc_x[v]\n\n pcy = precalc_y[v ^ bit]\n\n for i in range(n):\n\n cost += min(pcx[i], pcy[i])\n\n return cost\n\n\n\n for bit in range(1 << n):\n\n k = (bit & 0x5555) + (bit >> 1 & 0x5555)\n\n k = (k & 0x3333) + (k >> 2 & 0x3333)\n\n k = (k & 0x0f0f) + (k >> 4 & 0x0f0f)\n\n k = (k & 0x00ff) + (k >> 8 & 0x00ff)\n\n v = bit\n\n while v:\n\n ans[k] = min(ans[k], get_cost(v, bit))\n\n v = (v - 1) & bit\n\n ans[k] = min(ans[k], get_cost(0, bit))\n\n\n\n return ans\n\n\n\n\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n from numba.pycc import CC\n\n\n\n cc = CC('my_module')\n\n cc.export('solve', '(i8, i8[:,:], i8[:,:])')(solve)\n\n cc.compile()\n\n exit()\n\n\n\nif os.name == 'posix':\n\n # noinspection PyUnresolvedReferences\n\n from my_module import solve\n\nelse:\n\n from numba import njit\n\n\n\n solve = njit('(i8, i8[:,:], i8[:,:])', cache=True)(solve)\n\n print('compiled', file=sys.stderr)\n\n\n\ninp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=' ')\n\nn = inp[0]\n\nxxx = inp[1::3]\n\nyyy = inp[2::3]\n\nppp = inp[3::3]\n\n\n\nbit_d = (((np.arange(1 << n)[:, None] & (1 << np.arange(n)))) > 0).astype(np.int64)\n\nprecalc_x = abs((xxx[None, :] * bit_d)[..., None] - xxx[None, None, :]).min(axis=1) * ppp[None, :]\n\nprecalc_y = abs((yyy[None, :] * bit_d)[..., None] - yyy[None, None, :]).min(axis=1) * ppp[None, :]\n\n\n\nans = solve(n, precalc_x, precalc_y)\n\nprint('\\n'.join(map(str, ans)))\n","code_v0_loc":62,"code_v1_loc":60,"code_v0_num_chars":1714,"code_v1_num_chars":1658,"code_v0_no_empty_lines":"import os\nimport sys\nimport numpy as np\n\n\ndef solve(n, precalc_x, precalc_y):\n ans = np.full(n + 1, 10**18, dtype=np.int64)\n\n def get_cost(v, bit):\n cost = 0\n pcx = precalc_x[v]\n pcy = precalc_y[v ^ bit]\n for i in range(n):\n if v & (1 << i):\n continue\n cost += min(pcx[i], pcy[i])\n return cost\n\n for bit in range(1 << n):\n k = (bit & 0x5555) + (bit >> 1 & 0x5555)\n k = (k & 0x3333) + (k >> 2 & 0x3333)\n k = (k & 0x0F0F) + (k >> 4 & 0x0F0F)\n k = (k & 0x00FF) + (k >> 8 & 0x00FF)\n v = bit\n while v:\n ans[k] = min(ans[k], get_cost(v, bit))\n v = (v - 1) & bit\n ans[k] = min(ans[k], get_cost(0, bit))\n return ans\n\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n from numba.pycc import CC\n\n cc = CC(\"my_module\")\n cc.export(\"solve\", \"(i8, i8[:,:], i8[:,:])\")(solve)\n cc.compile()\n exit()\nif os.name == \"posix\":\n # noinspection PyUnresolvedReferences\n from my_module import solve\nelse:\n from numba import njit\n\n solve = njit(\"(i8, i8[:,:], i8[:,:])\", cache=True)(solve)\n print(\"compiled\", file=sys.stderr)\ninp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=\" \")\nn = inp[0]\nxxx = inp[1::3]\nyyy = inp[2::3]\nppp = inp[3::3]\nbit_d = (((np.arange(1 << n)[:, None] & (1 << np.arange(n)))) > 0).astype(np.int64)\nprecalc_x = (\n abs((xxx[None, :] * bit_d)[..., None] - xxx[None, None, :]).min(axis=1)\n * ppp[None, :]\n)\nprecalc_y = (\n abs((yyy[None, :] * bit_d)[..., None] - yyy[None, None, :]).min(axis=1)\n * ppp[None, :]\n)\nans = solve(n, precalc_x, precalc_y)\nprint(\"\\n\".join(map(str, ans)))\n","code_v1_no_empty_lines":"import os\nimport sys\nimport numpy as np\n\n\ndef solve(n, precalc_x, precalc_y):\n ans = np.full(n + 1, 10**18, dtype=np.int64)\n\n def get_cost(v, bit):\n cost = 0\n pcx = precalc_x[v]\n pcy = precalc_y[v ^ bit]\n for i in range(n):\n cost += min(pcx[i], pcy[i])\n return cost\n\n for bit in range(1 << n):\n k = (bit & 0x5555) + (bit >> 1 & 0x5555)\n k = (k & 0x3333) + (k >> 2 & 0x3333)\n k = (k & 0x0F0F) + (k >> 4 & 0x0F0F)\n k = (k & 0x00FF) + (k >> 8 & 0x00FF)\n v = bit\n while v:\n ans[k] = min(ans[k], get_cost(v, bit))\n v = (v - 1) & bit\n ans[k] = min(ans[k], get_cost(0, bit))\n return ans\n\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n from numba.pycc import CC\n\n cc = CC(\"my_module\")\n cc.export(\"solve\", \"(i8, i8[:,:], i8[:,:])\")(solve)\n cc.compile()\n exit()\nif os.name == \"posix\":\n # noinspection PyUnresolvedReferences\n from my_module import solve\nelse:\n from numba import njit\n\n solve = njit(\"(i8, i8[:,:], i8[:,:])\", cache=True)(solve)\n print(\"compiled\", file=sys.stderr)\ninp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=\" \")\nn = inp[0]\nxxx = inp[1::3]\nyyy = inp[2::3]\nppp = inp[3::3]\nbit_d = (((np.arange(1 << n)[:, None] & (1 << np.arange(n)))) > 0).astype(np.int64)\nprecalc_x = (\n abs((xxx[None, :] * bit_d)[..., None] - xxx[None, None, :]).min(axis=1)\n * ppp[None, :]\n)\nprecalc_y = (\n abs((yyy[None, :] * bit_d)[..., None] - yyy[None, None, :]).min(axis=1)\n * ppp[None, :]\n)\nans = solve(n, precalc_x, precalc_y)\nprint(\"\\n\".join(map(str, ans)))\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["- if v & (1 << i):","- continue"],"diff_only_import_comment":false,"measured_runtime_v0":2.2792407084,"measured_runtime_v1":1.4276063459,"runtime_lift":1.5965470558,"key":["s339976577","s349402655"]} +{"user_id":"u490552503","problem_id":"p03494","language":"python","submission_id_v0":"s709803197","submission_id_v1":"s765235052","cpu_time_v0":161,"cpu_time_v1":18,"memory_v0":12392,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nA = np.array(A)\n\ncount = 0\n\nwhile 1:\n\n x = 0\n\n for i in range(N):\n\n if A[i] % 2 == 1:\n\n x = 1\n\n if x == 1:\n\n break\n\n else:\n\n A = A \/ 2\n\n count+=1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"import math\n\nn = eval(input())\n\na = list(map(int, input().split()))\n\nans = float('inf')\n\nfor i in a:\n\n ans = min(ans, len(bin(i)) - bin(i).rfind('1') - 1)\n\nprint((round(ans)))","code_v0_loc":16,"code_v1_loc":7,"code_v0_num_chars":285,"code_v1_num_chars":170,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nA = np.array(A)\ncount = 0\nwhile 1:\n x = 0\n for i in range(N):\n if A[i] % 2 == 1:\n x = 1\n if x == 1:\n break\n else:\n A = A \/ 2\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"import math\n\nn = eval(input())\na = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in a:\n ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1)\nprint((round(ans)))\n","code_same":false,"relative_loc_diff_percent":56.25,"diff":["-import numpy as np","+import math","-N = int(eval(input()))","-A = list(map(int, input().split()))","-A = np.array(A)","-count = 0","-while 1:","- x = 0","- for i in range(N):","- if A[i] % 2 == 1:","- x = 1","- if x == 1:","- break","- else:","- A = A \/ 2","- count += 1","-print(count)","+n = eval(input())","+a = list(map(int, input().split()))","+ans = float(\"inf\")","+for i in a:","+ ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1)","+print((round(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4903787866,"measured_runtime_v1":0.2328151391,"runtime_lift":6.4015544373,"key":["s709803197","s765235052"]} +{"user_id":"u922449550","problem_id":"p02792","language":"python","submission_id_v0":"s475401488","submission_id_v1":"s941984259","cpu_time_v0":197,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.37,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\n\n\ntable = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n id1 = int(s[0])\n\n id2 = int(s[-1])\n\n table[id1][id2] += 1\n\n\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += table[i][j]*table[j][i]\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = eval(input())\n\nm = len(N)\n\n\n\na0 = int(N[0])\n\na1 = int(N[-1])\n\n\n\nans = 0\n\nif m == 1:\n\n ans = int(N)\n\nelse:\n\n mid = (int(N[1:]) - a1)\/\/10\n\n t = 10**(m-2)\n\n ans = 9\n\n ans += ((a0-1)*t) * 2\n\n ans += (mid + (a1>=a0)) * 2\n\n ans += ((a0-1)*t)**2\n\n ans += ((mid*(a0-1) + min(a0-1, a1))*t) * 2\n\n ans += (mid + (a1>=a0))**2\n\n if m >= 3:\n\n ans += (t - 1) * 2\n\n ans += ((a0-1)*(t - 1)*t) * 2\n\n ans += (mid * (t - 1)) * 2\n\n ans += (a1 * (t - 1)\/\/9) * 2\n\n ans += (t - 1)**2\n\n\n\nprint(ans)","code_v0_loc":16,"code_v1_loc":26,"code_v0_num_chars":264,"code_v1_num_chars":496,"code_v0_no_empty_lines":"N = int(eval(input()))\ntable = [[0] * 10 for i in range(10)]\nfor i in range(1, N + 1):\n s = str(i)\n id1 = int(s[0])\n id2 = int(s[-1])\n table[id1][id2] += 1\nans = 0\nfor i in range(10):\n for j in range(10):\n ans += table[i][j] * table[j][i]\nprint(ans)\n","code_v1_no_empty_lines":"N = eval(input())\nm = len(N)\na0 = int(N[0])\na1 = int(N[-1])\nans = 0\nif m == 1:\n ans = int(N)\nelse:\n mid = (int(N[1:]) - a1) \/\/ 10\n t = 10 ** (m - 2)\n ans = 9\n ans += ((a0 - 1) * t) * 2\n ans += (mid + (a1 >= a0)) * 2\n ans += ((a0 - 1) * t) ** 2\n ans += ((mid * (a0 - 1) + min(a0 - 1, a1)) * t) * 2\n ans += (mid + (a1 >= a0)) ** 2\n if m >= 3:\n ans += (t - 1) * 2\n ans += ((a0 - 1) * (t - 1) * t) * 2\n ans += (mid * (t - 1)) * 2\n ans += (a1 * (t - 1) \/\/ 9) * 2\n ans += (t - 1) ** 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":38.4615384615,"diff":["-N = int(eval(input()))","-table = [[0] * 10 for i in range(10)]","-for i in range(1, N + 1):","- s = str(i)","- id1 = int(s[0])","- id2 = int(s[-1])","- table[id1][id2] += 1","+N = eval(input())","+m = len(N)","+a0 = int(N[0])","+a1 = int(N[-1])","-for i in range(10):","- for j in range(10):","- ans += table[i][j] * table[j][i]","+if m == 1:","+ ans = int(N)","+else:","+ mid = (int(N[1:]) - a1) \/\/ 10","+ t = 10 ** (m - 2)","+ ans = 9","+ ans += ((a0 - 1) * t) * 2","+ ans += (mid + (a1 >= a0)) * 2","+ ans += ((a0 - 1) * t) ** 2","+ ans += ((mid * (a0 - 1) + min(a0 - 1, a1)) * t) * 2","+ ans += (mid + (a1 >= a0)) ** 2","+ if m >= 3:","+ ans += (t - 1) * 2","+ ans += ((a0 - 1) * (t - 1) * t) * 2","+ ans += (mid * (t - 1)) * 2","+ ans += (a1 * (t - 1) \/\/ 9) * 2","+ ans += (t - 1) ** 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.589133962,"measured_runtime_v1":0.3507217311,"runtime_lift":1.6797760439,"key":["s475401488","s941984259"]} +{"user_id":"u450904670","problem_id":"p03796","language":"python","submission_id_v0":"s280545626","submission_id_v1":"s422534863","cpu_time_v0":73,"cpu_time_v1":40,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.21,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (pow(10,9) + 7)\n\nprint(res)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (10**9 + 7)\n\nprint(res)\n","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":114,"code_v1_num_chars":115,"code_v0_no_empty_lines":"n = int(eval(input()))\nres = 1\nfor num in range(1, n + 1):\n res = res * num\n res = res % (pow(10, 9) + 7)\nprint(res)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nres = 1\nfor num in range(1, n + 1):\n res = res * num\n res = res % (10**9 + 7)\nprint(res)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- res = res % (pow(10, 9) + 7)","+ res = res % (10**9 + 7)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4279417639,"measured_runtime_v1":0.3313806841,"runtime_lift":1.2913901876,"key":["s280545626","s422534863"]} +{"user_id":"u333190709","problem_id":"p03371","language":"python","submission_id_v0":"s264866690","submission_id_v1":"s762683898","cpu_time_v0":127,"cpu_time_v1":17,"memory_v0":5304,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env python3\n\nimport sys, math, fractions, itertools\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n mn = 1e9\n\n for i in range(0, 2*(max(X, Y)+1), 2):\n\n mn = min(mn, C*i+A*max(X-i\/\/2, 0)+B*max(Y-i\/\/2, 0))\n\n print((int(mn)))\n\n return\n\n\n\n\n\n# Generated by 1.1.4 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n c = 0\n\n if (A + B < 2 * C):\n\n c += min(X, Y) * (A + B)\n\n else:\n\n c += min(X, Y) * 2 * C\n\n if X > Y:\n\n c += (X - Y) * min(A, 2 * C)\n\n else:\n\n c += (Y - X) * min(B, 2 * C)\n\n print(c)\n\n return\n\n\n\n\n\n# Generated by 1.1.5 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":28,"code_v1_loc":34,"code_v0_num_chars":879,"code_v1_num_chars":941,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys, math, fractions, itertools\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n mn = 1e9\n for i in range(0, 2 * (max(X, Y) + 1), 2):\n mn = min(mn, C * i + A * max(X - i \/\/ 2, 0) + B * max(Y - i \/\/ 2, 0))\n print((int(mn)))\n return\n\n\n# Generated by 1.1.4 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n C = int(next(tokens)) # type: int\n X = int(next(tokens)) # type: int\n Y = int(next(tokens)) # type: int\n solve(A, B, C, X, Y)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n c = 0\n if A + B < 2 * C:\n c += min(X, Y) * (A + B)\n else:\n c += min(X, Y) * 2 * C\n if X > Y:\n c += (X - Y) * min(A, 2 * C)\n else:\n c += (Y - X) * min(B, 2 * C)\n print(c)\n return\n\n\n# Generated by 1.1.5 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n C = int(next(tokens)) # type: int\n X = int(next(tokens)) # type: int\n Y = int(next(tokens)) # type: int\n solve(A, B, C, X, Y)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["-import sys, math, fractions, itertools","+import sys","- mn = 1e9","- for i in range(0, 2 * (max(X, Y) + 1), 2):","- mn = min(mn, C * i + A * max(X - i \/\/ 2, 0) + B * max(Y - i \/\/ 2, 0))","- print((int(mn)))","+ c = 0","+ if A + B < 2 * C:","+ c += min(X, Y) * (A + B)","+ else:","+ c += min(X, Y) * 2 * C","+ if X > Y:","+ c += (X - Y) * min(A, 2 * C)","+ else:","+ c += (Y - X) * min(B, 2 * C)","+ print(c)","-# Generated by 1.1.4 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)","+# Generated by 1.1.5 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4482344875,"measured_runtime_v1":0.3314408262,"runtime_lift":1.3523816383,"key":["s264866690","s762683898"]} +{"user_id":"u597455618","problem_id":"p03038","language":"python","submission_id_v0":"s109141472","submission_id_v1":"s852161134","cpu_time_v0":276,"cpu_time_v1":208,"memory_v0":28384,"memory_v1":31520,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nfrom operator import itemgetter\n\n\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, sys.stdin.readline().split()))\n\nbc = [ tuple(map(int, x.split())) for x in sys.stdin.readlines()]\n\nbc.sort(key = itemgetter(1), reverse=True)\n\nbc.append((n,0))\n\ndiff = []\n\nfor b, c in bc:\n\n diff += [c] * b\n\n if len(diff) > n:\n\n break\n\n\n\na += diff\n\na.sort()\n\nprint((sum(a[-n:])))\n\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nfrom operator import itemgetter\n\n\n\nn, m = list(map(int, readline().split()))\n\na = list(map(int, readline().split()))\n\nm = list(map(int, read().split()))\n\nbc = list(zip(m,m))\n\n\n\nbc.sort(key = itemgetter(1), reverse=True)\n\nbc.append((n,0))\n\ndiff = []\n\nfor b, c in bc:\n\n diff += [c] * b\n\n if len(diff) > n:\n\n break\n\n\n\na += diff\n\na.sort()\n\nprint((sum(a[-n:])))\n","code_v0_loc":17,"code_v1_loc":21,"code_v0_num_chars":389,"code_v1_num_chars":436,"code_v0_no_empty_lines":"import sys\nfrom operator import itemgetter\n\nn, m = list(map(int, input().split()))\na = list(map(int, sys.stdin.readline().split()))\nbc = [tuple(map(int, x.split())) for x in sys.stdin.readlines()]\nbc.sort(key=itemgetter(1), reverse=True)\nbc.append((n, 0))\ndiff = []\nfor b, c in bc:\n diff += [c] * b\n if len(diff) > n:\n break\na += diff\na.sort()\nprint((sum(a[-n:])))\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nfrom operator import itemgetter\n\nn, m = list(map(int, readline().split()))\na = list(map(int, readline().split()))\nm = list(map(int, read().split()))\nbc = list(zip(m, m))\nbc.sort(key=itemgetter(1), reverse=True)\nbc.append((n, 0))\ndiff = []\nfor b, c in bc:\n diff += [c] * b\n if len(diff) > n:\n break\na += diff\na.sort()\nprint((sum(a[-n:])))\n","code_same":false,"relative_loc_diff_percent":19.0476190476,"diff":["+","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","-n, m = list(map(int, input().split()))","-a = list(map(int, sys.stdin.readline().split()))","-bc = [tuple(map(int, x.split())) for x in sys.stdin.readlines()]","+n, m = list(map(int, readline().split()))","+a = list(map(int, readline().split()))","+m = list(map(int, read().split()))","+bc = list(zip(m, m))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2032662067,"measured_runtime_v1":0.0066151552,"runtime_lift":30.7273525221,"key":["s109141472","s852161134"]} +{"user_id":"u498487134","problem_id":"p02917","language":"python","submission_id_v0":"s303870321","submission_id_v1":"s766724876","cpu_time_v0":162,"cpu_time_v1":67,"memory_v0":38256,"memory_v1":61812,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nB =list(map(int,input().split()))\n\nA=[0]*N\n\n\n\nA[0]=B[0]\n\nfor i in range(1,N-1):\n\n A[i]=min(B[i],B[i-1])\n\nA[-1]=B[-1]\n\nprint((sum(A)))\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N=I()\n\n B=LI()\n\n A=[0]*N\n\n A[0]=B[0]\n\n A[-1]=B[-1]\n\n for i in range(N-2):\n\n A[i+1]=min(B[i],B[i+1])\n\n \n\n print((sum(A)))\n\n\n\nmain()\n","code_v0_loc":9,"code_v1_loc":20,"code_v0_num_chars":152,"code_v1_num_chars":363,"code_v0_no_empty_lines":"N = int(eval(input()))\nB = list(map(int, input().split()))\nA = [0] * N\nA[0] = B[0]\nfor i in range(1, N - 1):\n A[i] = min(B[i], B[i - 1])\nA[-1] = B[-1]\nprint((sum(A)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N = I()\n B = LI()\n A = [0] * N\n A[0] = B[0]\n A[-1] = B[-1]\n for i in range(N - 2):\n A[i + 1] = min(B[i], B[i + 1])\n print((sum(A)))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":55.0,"diff":["-N = int(eval(input()))","-B = list(map(int, input().split()))","-A = [0] * N","-A[0] = B[0]","-for i in range(1, N - 1):","- A[i] = min(B[i], B[i - 1])","-A[-1] = B[-1]","-print((sum(A)))","+import sys","+","+input = sys.stdin.readline","+","+","+def I():","+ return int(eval(input()))","+","+","+def MI():","+ return list(map(int, input().split()))","+","+","+def LI():","+ return list(map(int, input().split()))","+","+","+def main():","+ mod = 10**9 + 7","+ N = I()","+ B = LI()","+ A = [0] * N","+ A[0] = B[0]","+ A[-1] = B[-1]","+ for i in range(N - 2):","+ A[i + 1] = min(B[i], B[i + 1])","+ print((sum(A)))","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.251366816,"measured_runtime_v1":0.147175539,"runtime_lift":1.7079388172,"key":["s303870321","s766724876"]} +{"user_id":"u047796752","problem_id":"p02700","language":"python","submission_id_v0":"s232689719","submission_id_v1":"s065315130","cpu_time_v0":74,"cpu_time_v1":57,"memory_v0":64716,"memory_v1":61776,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.97,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nA, B, C, D = list(map(int, input().split()))\n\n\n\nwhile True:\n\n C -= B\n\n \n\n if C<=0:\n\n print('Yes')\n\n exit()\n\n \n\n A -= D\n\n \n\n if A<=0:\n\n print('No')\n\n exit()\n\n# optimized version of the same code:\n","target":"A, B, C, D = list(map(int, input().split()))\n\nc1 = (C+B-1)\/\/B\n\nc2 = (A+D-1)\/\/D\n\n\n\nif c1<=c2:\n\n print('Yes')\n\nelse:\n\n print('No')","code_v0_loc":18,"code_v1_loc":8,"code_v0_num_chars":267,"code_v1_num_chars":128,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\nA, B, C, D = list(map(int, input().split()))\nwhile True:\n C -= B\n if C <= 0:\n print(\"Yes\")\n exit()\n A -= D\n if A <= 0:\n print(\"No\")\n exit()\n","code_v1_no_empty_lines":"A, B, C, D = list(map(int, input().split()))\nc1 = (C + B - 1) \/\/ B\nc2 = (A + D - 1) \/\/ D\nif c1 <= c2:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-import sys","-","-input = sys.stdin.readline","-from collections import *","-","-while True:","- C -= B","- if C <= 0:","- print(\"Yes\")","- exit()","- A -= D","- if A <= 0:","- print(\"No\")","- exit()","+c1 = (C + B - 1) \/\/ B","+c2 = (A + D - 1) \/\/ D","+if c1 <= c2:","+ print(\"Yes\")","+else:","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.2898896478,"measured_runtime_v1":0.0638447898,"runtime_lift":4.5405372711,"key":["s232689719","s065315130"]} +{"user_id":"u576432509","problem_id":"p03575","language":"python","submission_id_v0":"s579377069","submission_id_v1":"s043222526","cpu_time_v0":33,"cpu_time_v1":26,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.21,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nicase=0\n\nif icase==0:\n\n n,m=list(map(int, input().split()))\n\n a=[]\n\n b=[]\n\n for i in range(m):\n\n ai,bi=list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\nelif icase==1:\n\n n=6\n\n m=5\n\n# a=[[1],[2],[3],[4],[5]]\n\n# b=[[2],[3],[4],[5],[6]]\n\n a=[1,2,3,4,5]\n\n b=[2,3,4,5,6]\n\nelif icase==2:\n\n n=7\n\n m=7\n\n a=[1,2,3,4,4,5,6]\n\n b=[3,7,4,5,6,6,7]\n\n\n\n \n\nvtx=[]\n\nfor i in range(n):\n\n vtx.append([i+1])\n\nicnt=0\n\n\n\nfor j in range(m): \n\n vtx1=vtx.copy()\n\n a1=a.copy()\n\n b1=b.copy()\n\n del a1[j]\n\n del b1[j]\n\n \n\n for i in range(m-1):\n\n for v1 in vtx1:\n\n if a1[i] in v1:\n\n if not b1[i] in v1:\n\n for v2 in vtx1:\n\n if v1!=v2:\n\n if b1[i] in v2:\n\n break\n\n vtx1.remove(v1)\n\n vtx1.remove(v2)\n\n v3=v1+v2\n\n vtx1.append(v3)\n\n# print(a[i],b[i],len(vtx1),vtx1)\n\n# print(len(vtx1),vtx1)\n\n if len(vtx1)!=1:\n\n icnt=icnt+1\n\nprint(icnt) \n\n# optimized version of the same code:\n","target":"limit=50\n\ngraph=[[False]*limit for i in range(limit)]\n\nvisited=[]*limit\n\n\n\ndef dfs(v,n,graph,visited):\n\n visited[v]=True\n\n for v2 in range(n):\n\n if graph[v][v2]==False:\n\n continue\n\n if visited[v2]==True:\n\n continue\n\n dfs(v2,n,graph,visited)\n\n\n\nn,m=list(map(int,input().split()))\n\na=[0]*m\n\nb=[0]*m\n\nfor i in range(m):\n\n ai,bi=list(map(int,input().split()))\n\n a[i]=ai-1\n\n b[i]=bi-1\n\n graph[a[i]][b[i]]=True\n\n graph[b[i]][a[i]]=True\n\n \n\nans=0 \n\nfor i in range(m):\n\n graph[a[i]][b[i]]=False\n\n graph[b[i]][a[i]]=False\n\n visited=[False]*n\n\n dfs(0,n,graph,visited)\n\n bridge=False\n\n for j in range(n):\n\n if visited[j]==False:\n\n bridge=True\n\n if bridge:\n\n ans+=1\n\n graph[a[i]][b[i]]=True\n\n graph[b[i]][a[i]]=True\n\n \n\nprint(ans)","code_v0_loc":52,"code_v1_loc":39,"code_v0_num_chars":1130,"code_v1_num_chars":828,"code_v0_no_empty_lines":"icase = 0\nif icase == 0:\n n, m = list(map(int, input().split()))\n a = []\n b = []\n for i in range(m):\n ai, bi = list(map(int, input().split()))\n a.append(ai)\n b.append(bi)\nelif icase == 1:\n n = 6\n m = 5\n # a=[[1],[2],[3],[4],[5]]\n # b=[[2],[3],[4],[5],[6]]\n a = [1, 2, 3, 4, 5]\n b = [2, 3, 4, 5, 6]\nelif icase == 2:\n n = 7\n m = 7\n a = [1, 2, 3, 4, 4, 5, 6]\n b = [3, 7, 4, 5, 6, 6, 7]\nvtx = []\nfor i in range(n):\n vtx.append([i + 1])\nicnt = 0\nfor j in range(m):\n vtx1 = vtx.copy()\n a1 = a.copy()\n b1 = b.copy()\n del a1[j]\n del b1[j]\n for i in range(m - 1):\n for v1 in vtx1:\n if a1[i] in v1:\n if not b1[i] in v1:\n for v2 in vtx1:\n if v1 != v2:\n if b1[i] in v2:\n break\n vtx1.remove(v1)\n vtx1.remove(v2)\n v3 = v1 + v2\n vtx1.append(v3)\n # print(a[i],b[i],len(vtx1),vtx1)\n # print(len(vtx1),vtx1)\n if len(vtx1) != 1:\n icnt = icnt + 1\nprint(icnt)\n","code_v1_no_empty_lines":"limit = 50\ngraph = [[False] * limit for i in range(limit)]\nvisited = [] * limit\n\n\ndef dfs(v, n, graph, visited):\n visited[v] = True\n for v2 in range(n):\n if graph[v][v2] == False:\n continue\n if visited[v2] == True:\n continue\n dfs(v2, n, graph, visited)\n\n\nn, m = list(map(int, input().split()))\na = [0] * m\nb = [0] * m\nfor i in range(m):\n ai, bi = list(map(int, input().split()))\n a[i] = ai - 1\n b[i] = bi - 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\nans = 0\nfor i in range(m):\n graph[a[i]][b[i]] = False\n graph[b[i]][a[i]] = False\n visited = [False] * n\n dfs(0, n, graph, visited)\n bridge = False\n for j in range(n):\n if visited[j] == False:\n bridge = True\n if bridge:\n ans += 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-icase = 0","-if icase == 0:","- n, m = list(map(int, input().split()))","- a = []","- b = []","- for i in range(m):","- ai, bi = list(map(int, input().split()))","- a.append(ai)","- b.append(bi)","-elif icase == 1:","- n = 6","- m = 5","- # a=[[1],[2],[3],[4],[5]]","- # b=[[2],[3],[4],[5],[6]]","- a = [1, 2, 3, 4, 5]","- b = [2, 3, 4, 5, 6]","-elif icase == 2:","- n = 7","- m = 7","- a = [1, 2, 3, 4, 4, 5, 6]","- b = [3, 7, 4, 5, 6, 6, 7]","-vtx = []","-for i in range(n):","- vtx.append([i + 1])","-icnt = 0","-for j in range(m):","- vtx1 = vtx.copy()","- a1 = a.copy()","- b1 = b.copy()","- del a1[j]","- del b1[j]","- for i in range(m - 1):","- for v1 in vtx1:","- if a1[i] in v1:","- if not b1[i] in v1:","- for v2 in vtx1:","- if v1 != v2:","- if b1[i] in v2:","- break","- vtx1.remove(v1)","- vtx1.remove(v2)","- v3 = v1 + v2","- vtx1.append(v3)","- # print(a[i],b[i],len(vtx1),vtx1)","- # print(len(vtx1),vtx1)","- if len(vtx1) != 1:","- icnt = icnt + 1","-print(icnt)","+limit = 50","+graph = [[False] * limit for i in range(limit)]","+visited = [] * limit","+","+","+def dfs(v, n, graph, visited):","+ visited[v] = True","+ for v2 in range(n):","+ if graph[v][v2] == False:","+ continue","+ if visited[v2] == True:","+ continue","+ dfs(v2, n, graph, visited)","+","+","+n, m = list(map(int, input().split()))","+a = [0] * m","+b = [0] * m","+for i in range(m):","+ ai, bi = list(map(int, input().split()))","+ a[i] = ai - 1","+ b[i] = bi - 1","+ graph[a[i]][b[i]] = True","+ graph[b[i]][a[i]] = True","+ans = 0","+for i in range(m):","+ graph[a[i]][b[i]] = False","+ graph[b[i]][a[i]] = False","+ visited = [False] * n","+ dfs(0, n, graph, visited)","+ bridge = False","+ for j in range(n):","+ if visited[j] == False:","+ bridge = True","+ if bridge:","+ ans += 1","+ graph[a[i]][b[i]] = True","+ graph[b[i]][a[i]] = True","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3351877429,"measured_runtime_v1":0.2583705549,"runtime_lift":1.2973140188,"key":["s579377069","s043222526"]} +{"user_id":"u086503932","problem_id":"p02814","language":"python","submission_id_v0":"s657535199","submission_id_v1":"s415753878","cpu_time_v0":500,"cpu_time_v1":202,"memory_v0":16280,"memory_v1":91128,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.6,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env python3\n\nimport sys\n\nfrom fractions import gcd\n\nimport math\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n tmp = 1\n\n count = None\n\n for i in range(N):\n\n tmp = (tmp * a[i]\/\/2) \/\/ gcd(tmp,a[i]\/\/2)\n\n c = 0\n\n n = a[i]\/\/2\n\n while n % 2 == 0:\n\n c += 1\n\n n \/\/= 2\n\n if i == 0:\n\n count = c\n\n elif count != c:\n\n print((0))\n\n exit()\n\n print(((M\/\/tmp +1)\/\/2))\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"from math import gcd\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = [a\/\/2 for a in A]\n\nLCM = 1\n\nfor i in range(N):\n\n LCM = LCM * B[i] \/\/ gcd(LCM, B[i])\n\nfor i in range(N):\n\n if LCM \/\/ B[i] % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((M\/\/LCM + 1)\/\/2))","code_v0_loc":26,"code_v1_loc":13,"code_v0_num_chars":527,"code_v1_num_chars":293,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nfrom fractions import gcd\nimport math\n\n\ndef main():\n N, M = list(map(int, input().split()))\n a = list(map(int, input().split()))\n tmp = 1\n count = None\n for i in range(N):\n tmp = (tmp * a[i] \/\/ 2) \/\/ gcd(tmp, a[i] \/\/ 2)\n c = 0\n n = a[i] \/\/ 2\n while n % 2 == 0:\n c += 1\n n \/\/= 2\n if i == 0:\n count = c\n elif count != c:\n print((0))\n exit()\n print(((M \/\/ tmp + 1) \/\/ 2))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from math import gcd\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = [a \/\/ 2 for a in A]\nLCM = 1\nfor i in range(N):\n LCM = LCM * B[i] \/\/ gcd(LCM, B[i])\nfor i in range(N):\n if LCM \/\/ B[i] % 2 == 0:\n print((0))\n exit()\nprint(((M \/\/ LCM + 1) \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-#!\/usr\/bin\/env python3","-import sys","-from fractions import gcd","-import math","+from math import gcd","-","-def main():","- N, M = list(map(int, input().split()))","- a = list(map(int, input().split()))","- tmp = 1","- count = None","- for i in range(N):","- tmp = (tmp * a[i] \/\/ 2) \/\/ gcd(tmp, a[i] \/\/ 2)","- c = 0","- n = a[i] \/\/ 2","- while n % 2 == 0:","- c += 1","- n \/\/= 2","- if i == 0:","- count = c","- elif count != c:","- print((0))","- exit()","- print(((M \/\/ tmp + 1) \/\/ 2))","-","-","-if __name__ == \"__main__\":","- main()","+N, M = list(map(int, input().split()))","+A = list(map(int, input().split()))","+B = [a \/\/ 2 for a in A]","+LCM = 1","+for i in range(N):","+ LCM = LCM * B[i] \/\/ gcd(LCM, B[i])","+for i in range(N):","+ if LCM \/\/ B[i] % 2 == 0:","+ print((0))","+ exit()","+print(((M \/\/ LCM + 1) \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4621698339,"measured_runtime_v1":0.3237110667,"runtime_lift":1.4277233045,"key":["s657535199","s415753878"]} +{"user_id":"u098982053","problem_id":"p03060","language":"python","submission_id_v0":"s481970450","submission_id_v1":"s543533896","cpu_time_v0":153,"cpu_time_v1":17,"memory_v0":12496,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.89,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nV = np.array([int(i) for i in input().split(\" \")])\n\nC = np.array([int(i) for i in input().split(\" \")])\n\n\n\nvc = V-C\n\n\n\nval = 0\n\n\n\nfor i in range(N):\n\n if vc[i]>0:\n\n val+=vc[i]\n\nprint(val)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nV = [int(i) for i in input().split(\" \")]\n\nC = [int(i) for i in input().split(\" \")]\n\n\n\nval = 0\n\n\n\nfor i in range(N):\n\n vc=V[i]-C[i]\n\n if vc>0:\n\n val+=vc\n\nprint(val)","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":234,"code_v1_num_chars":194,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nV = np.array([int(i) for i in input().split(\" \")])\nC = np.array([int(i) for i in input().split(\" \")])\nvc = V - C\nval = 0\nfor i in range(N):\n if vc[i] > 0:\n val += vc[i]\nprint(val)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nV = [int(i) for i in input().split(\" \")]\nC = [int(i) for i in input().split(\" \")]\nval = 0\nfor i in range(N):\n vc = V[i] - C[i]\n if vc > 0:\n val += vc\nprint(val)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-import numpy as np","-","-V = np.array([int(i) for i in input().split(\" \")])","-C = np.array([int(i) for i in input().split(\" \")])","-vc = V - C","+V = [int(i) for i in input().split(\" \")]","+C = [int(i) for i in input().split(\" \")]","- if vc[i] > 0:","- val += vc[i]","+ vc = V[i] - C[i]","+ if vc > 0:","+ val += vc"],"diff_only_import_comment":false,"measured_runtime_v0":1.2125604842,"measured_runtime_v1":0.1993146646,"runtime_lift":6.083649121,"key":["s481970450","s543533896"]} +{"user_id":"u433181015","problem_id":"p02394","language":"python","submission_id_v0":"s560769298","submission_id_v1":"s595626547","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7680,"memory_v1":7728,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na=input().split()\n\nb=list(map(int,a))\n\nW=b[0]\n\nH=b[1]\n\nx=b[2]\n\ny=b[3]\n\nr=b[4]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')\n\n# optimized version of the same code:\n","target":"W,H,x,y,r = [int(i) for i in input().split()]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')","code_v0_loc":11,"code_v1_loc":5,"code_v0_num_chars":164,"code_v1_num_chars":132,"code_v0_no_empty_lines":"a = input().split()\nb = list(map(int, a))\nW = b[0]\nH = b[1]\nx = b[2]\ny = b[3]\nr = b[4]\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"W, H, x, y, r = [int(i) for i in input().split()]\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":54.5454545455,"diff":["-a = input().split()","-b = list(map(int, a))","-W = b[0]","-H = b[1]","-x = b[2]","-y = b[3]","-r = b[4]","+W, H, x, y, r = [int(i) for i in input().split()]"],"diff_only_import_comment":false,"measured_runtime_v0":0.3832537071,"measured_runtime_v1":0.2996923448,"runtime_lift":1.2788238128,"key":["s560769298","s595626547"]} +{"user_id":"u454022848","problem_id":"p02394","language":"python","submission_id_v0":"s949778573","submission_id_v1":"s992404688","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":6724,"memory_v1":6432,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nia = [int(i) for i in input().split(\" \")]\n\nW=ia[0]\n\nH=ia[1]\n\nx=ia[2]\n\ny=ia[3]\n\nr=ia[4]\n\nprint((\"Yes\" if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H else \"No\"))\n\n# optimized version of the same code:\n","target":"# encoding:utf-8\n\n\n\ninput = list(map(int, input().split()))\n\nW, H, x, y, r = input\n\n\n\nif x - r < 0 or x + r > W:\n\n\tprint(\"No\")\n\nelif y - r < 0 or y + r > H:\n\n\tprint(\"No\")\n\nelse:\n\n\tprint(\"Yes\")","code_v0_loc":7,"code_v1_loc":11,"code_v0_num_chars":153,"code_v1_num_chars":190,"code_v0_no_empty_lines":"ia = [int(i) for i in input().split(\" \")]\nW = ia[0]\nH = ia[1]\nx = ia[2]\ny = ia[3]\nr = ia[4]\nprint((\"Yes\" if 0 <= x - r and x + r <= W and 0 <= y - r and y + r <= H else \"No\"))\n","code_v1_no_empty_lines":"# encoding:utf-8\ninput = list(map(int, input().split()))\nW, H, x, y, r = input\nif x - r < 0 or x + r > W:\n print(\"No\")\nelif y - r < 0 or y + r > H:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-ia = [int(i) for i in input().split(\" \")]","-W = ia[0]","-H = ia[1]","-x = ia[2]","-y = ia[3]","-r = ia[4]","-print((\"Yes\" if 0 <= x - r and x + r <= W and 0 <= y - r and y + r <= H else \"No\"))","+# encoding:utf-8","+input = list(map(int, input().split()))","+W, H, x, y, r = input","+if x - r < 0 or x + r > W:","+ print(\"No\")","+elif y - r < 0 or y + r > H:","+ print(\"No\")","+else:","+ print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.354291319,"measured_runtime_v1":0.2815986323,"runtime_lift":1.2581428969,"key":["s949778573","s992404688"]} +{"user_id":"u310381103","problem_id":"p03457","language":"python","submission_id_v0":"s861400279","submission_id_v1":"s171825130","cpu_time_v0":647,"cpu_time_v1":294,"memory_v0":63064,"memory_v1":27216,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.56,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN=eval(input())\n\na=[]\n\nt=True\n\nfor _ in range(int(N)):\n\n a+=[list(map(int,input().split()))]\n\nfor i in range(int(N)):\n\n if a[i][0]%2==0:\n\n if abs(a[i][1]+a[i][2])<=a[i][0] and (a[i][1]+a[i][2])%2==0:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\n else:\n\n if abs(a[i][1]+a[i][2]<=a[i][0]) and (a[i][1]+a[i][2])%2==1:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\nif t:\n\n print('Yes')\n\n# optimized version of the same code:\n","target":"import sys\n\nn=int(eval(input()))\n\nt=[]\n\nfor i in range(n):\n\n t.append(list(map(int,input().split())))\n\nfor i,d in enumerate(t):\n\n if i>0:\n\n b=d[0]-a\n\n c=abs(d[1]+d[2]-aa)\n\n a=d[0]\n\n aa=d[1]+d[2]\n\n if i==0:\n\n if not (a >= aa and a % 2 == aa % 2):\n\n print('No')\n\n sys.exit()\n\n else:\n\n continue\n\n if not (b>=c and b%2==c%2):\n\n print('No')\n\n sys.exit()\n\nprint('Yes')","code_v0_loc":22,"code_v1_loc":21,"code_v0_num_chars":516,"code_v1_num_chars":449,"code_v0_no_empty_lines":"N = eval(input())\na = []\nt = True\nfor _ in range(int(N)):\n a += [list(map(int, input().split()))]\nfor i in range(int(N)):\n if a[i][0] % 2 == 0:\n if abs(a[i][1] + a[i][2]) <= a[i][0] and (a[i][1] + a[i][2]) % 2 == 0:\n continue\n else:\n print(\"No\")\n t = False\n break\n else:\n if abs(a[i][1] + a[i][2] <= a[i][0]) and (a[i][1] + a[i][2]) % 2 == 1:\n continue\n else:\n print(\"No\")\n t = False\n break\nif t:\n print(\"Yes\")\n","code_v1_no_empty_lines":"import sys\n\nn = int(eval(input()))\nt = []\nfor i in range(n):\n t.append(list(map(int, input().split())))\nfor i, d in enumerate(t):\n if i > 0:\n b = d[0] - a\n c = abs(d[1] + d[2] - aa)\n a = d[0]\n aa = d[1] + d[2]\n if i == 0:\n if not (a >= aa and a % 2 == aa % 2):\n print(\"No\")\n sys.exit()\n else:\n continue\n if not (b >= c and b % 2 == c % 2):\n print(\"No\")\n sys.exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-N = eval(input())","-a = []","-t = True","-for _ in range(int(N)):","- a += [list(map(int, input().split()))]","-for i in range(int(N)):","- if a[i][0] % 2 == 0:","- if abs(a[i][1] + a[i][2]) <= a[i][0] and (a[i][1] + a[i][2]) % 2 == 0:","+import sys","+","+n = int(eval(input()))","+t = []","+for i in range(n):","+ t.append(list(map(int, input().split())))","+for i, d in enumerate(t):","+ if i > 0:","+ b = d[0] - a","+ c = abs(d[1] + d[2] - aa)","+ a = d[0]","+ aa = d[1] + d[2]","+ if i == 0:","+ if not (a >= aa and a % 2 == aa % 2):","+ print(\"No\")","+ sys.exit()","+ else:","- else:","- print(\"No\")","- t = False","- break","- else:","- if abs(a[i][1] + a[i][2] <= a[i][0]) and (a[i][1] + a[i][2]) % 2 == 1:","- continue","- else:","- print(\"No\")","- t = False","- break","-if t:","- print(\"Yes\")","+ if not (b >= c and b % 2 == c % 2):","+ print(\"No\")","+ sys.exit()","+print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.2371032157,"measured_runtime_v1":0.0063223619,"runtime_lift":37.5023159605,"key":["s861400279","s171825130"]} +{"user_id":"u633450100","problem_id":"p04012","language":"python","submission_id_v0":"s292377539","submission_id_v1":"s830942060","cpu_time_v0":254,"cpu_time_v1":17,"memory_v0":17816,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.31,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nw = eval(input())\n\nanal = np.array([])\n\n\n\nfor i in range(ord('a'),ord('z')+1):\n\n anal = np.append(anal,w.count(chr(i)))\n\nif np.all(anal % 2 == 0):\n\n #ans = np.sum(anal)\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n# optimized version of the same code:\n","target":"w = str(eval(input()))\n\ncount = int()\n\n\n\nfor i in range(len(w)):\n\n if w.count(w[i]) % 2 == 0:\n\n count += 1\n\n\n\nif count == len(w):\n\n print('Yes')\n\nelse:\n\n print('No')","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":232,"code_v1_num_chars":175,"code_v0_no_empty_lines":"import numpy as np\n\nw = eval(input())\nanal = np.array([])\nfor i in range(ord(\"a\"), ord(\"z\") + 1):\n anal = np.append(anal, w.count(chr(i)))\nif np.all(anal % 2 == 0):\n # ans = np.sum(anal)\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"w = str(eval(input()))\ncount = int()\nfor i in range(len(w)):\n if w.count(w[i]) % 2 == 0:\n count += 1\nif count == len(w):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import numpy as np","-","-w = eval(input())","-anal = np.array([])","-for i in range(ord(\"a\"), ord(\"z\") + 1):","- anal = np.append(anal, w.count(chr(i)))","-if np.all(anal % 2 == 0):","- # ans = np.sum(anal)","+w = str(eval(input()))","+count = int()","+for i in range(len(w)):","+ if w.count(w[i]) % 2 == 0:","+ count += 1","+if count == len(w):"],"diff_only_import_comment":false,"measured_runtime_v0":1.9986827209,"measured_runtime_v1":0.2783588209,"runtime_lift":7.1802384931,"key":["s292377539","s830942060"]} +{"user_id":"u620868411","problem_id":"p03436","language":"python","submission_id_v0":"s808760844","submission_id_v1":"s833213139","cpu_time_v0":54,"cpu_time_v1":26,"memory_v0":4080,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.85,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\nfrom queue import Queue\n\nh,w = list(map(int, input().split()))\n\nd = []\n\nfor _ in range(h):\n\n d.append(eval(input()))\n\ncost = [[0]*w for _ in range(h)]\n\n\n\nq = Queue()\n\nq.put((0,0))\n\nwhile not q.empty():\n\n hi,wi = q.get()\n\n if hi==h-1 and wi==w-1:\n\n break\n\n\n\n for dh,dw in [[0,1],[1,0],[0,-1],[-1,0]]:\n\n if h>dh+hi>=0 and w>dw+wi>=0 and d[dh+hi][dw+wi]==\".\":\n\n if cost[dh+hi][dw+wi]==0 or cost[dh+hi][dw+wi]>cost[hi][wi]+1:\n\n cost[dh+hi][dw+wi] = cost[hi][wi]+1\n\n q.put((dh+hi, dw+wi))\n\n\n\nif cost[h-1][w-1]==0:\n\n print((-1))\n\n exit()\n\n\n\nres = 0\n\nfor hi in range(h):\n\n for wi in range(w):\n\n if (hi==0 and wi==0) or (hi==h-1 and wi==-1):\n\n continue\n\n if d[hi][wi]==\".\":\n\n res += 1\n\n\n\nprint((res - cost[h-1][w-1]))\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\nfrom collections import deque\n\nh,w = list(map(int, input().split()))\n\nm = [\"#\"*(w+2)] + [\"#\"+eval(input())+\"#\" for _ in range(h)] + [\"#\"*(w+2)]\n\n\n\ncnt = 0\n\nfor hi in range(1,h+1):\n\n for wi in range(1,w+1):\n\n if m[hi][wi]==\".\":\n\n cnt += 1\n\n\n\ninf = 10**9\n\nd = [[inf]*(w+2) for _ in range(h+2)]\n\nq = deque([(1,1,1)])\n\nd[1][1] = 1\n\nwhile len(q):\n\n ch,cw,r = q.popleft()\n\n\n\n for hi,wi in [[ch+1,cw],[ch,cw+1],[ch-1,cw],[ch,cw-1]]:\n\n if m[hi][wi]==\".\" and d[hi][wi]>r+1:\n\n d[hi][wi]=r+1\n\n q.append((hi,wi,r+1))\n\n\n\nif d[h][w]==inf:\n\n print((-1))\n\nelse:\n\n print((cnt-d[h][w]))","code_v0_loc":34,"code_v1_loc":27,"code_v0_num_chars":831,"code_v1_num_chars":639,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nfrom queue import Queue\n\nh, w = list(map(int, input().split()))\nd = []\nfor _ in range(h):\n d.append(eval(input()))\ncost = [[0] * w for _ in range(h)]\nq = Queue()\nq.put((0, 0))\nwhile not q.empty():\n hi, wi = q.get()\n if hi == h - 1 and wi == w - 1:\n break\n for dh, dw in [[0, 1], [1, 0], [0, -1], [-1, 0]]:\n if h > dh + hi >= 0 and w > dw + wi >= 0 and d[dh + hi][dw + wi] == \".\":\n if cost[dh + hi][dw + wi] == 0 or cost[dh + hi][dw + wi] > cost[hi][wi] + 1:\n cost[dh + hi][dw + wi] = cost[hi][wi] + 1\n q.put((dh + hi, dw + wi))\nif cost[h - 1][w - 1] == 0:\n print((-1))\n exit()\nres = 0\nfor hi in range(h):\n for wi in range(w):\n if (hi == 0 and wi == 0) or (hi == h - 1 and wi == -1):\n continue\n if d[hi][wi] == \".\":\n res += 1\nprint((res - cost[h - 1][w - 1]))\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nfrom collections import deque\n\nh, w = list(map(int, input().split()))\nm = [\"#\" * (w + 2)] + [\"#\" + eval(input()) + \"#\" for _ in range(h)] + [\"#\" * (w + 2)]\ncnt = 0\nfor hi in range(1, h + 1):\n for wi in range(1, w + 1):\n if m[hi][wi] == \".\":\n cnt += 1\ninf = 10**9\nd = [[inf] * (w + 2) for _ in range(h + 2)]\nq = deque([(1, 1, 1)])\nd[1][1] = 1\nwhile len(q):\n ch, cw, r = q.popleft()\n for hi, wi in [[ch + 1, cw], [ch, cw + 1], [ch - 1, cw], [ch, cw - 1]]:\n if m[hi][wi] == \".\" and d[hi][wi] > r + 1:\n d[hi][wi] = r + 1\n q.append((hi, wi, r + 1))\nif d[h][w] == inf:\n print((-1))\nelse:\n print((cnt - d[h][w]))\n","code_same":false,"relative_loc_diff_percent":20.5882352941,"diff":["-from queue import Queue","+from collections import deque","-d = []","-for _ in range(h):","- d.append(eval(input()))","-cost = [[0] * w for _ in range(h)]","-q = Queue()","-q.put((0, 0))","-while not q.empty():","- hi, wi = q.get()","- if hi == h - 1 and wi == w - 1:","- break","- for dh, dw in [[0, 1], [1, 0], [0, -1], [-1, 0]]:","- if h > dh + hi >= 0 and w > dw + wi >= 0 and d[dh + hi][dw + wi] == \".\":","- if cost[dh + hi][dw + wi] == 0 or cost[dh + hi][dw + wi] > cost[hi][wi] + 1:","- cost[dh + hi][dw + wi] = cost[hi][wi] + 1","- q.put((dh + hi, dw + wi))","-if cost[h - 1][w - 1] == 0:","+m = [\"#\" * (w + 2)] + [\"#\" + eval(input()) + \"#\" for _ in range(h)] + [\"#\" * (w + 2)]","+cnt = 0","+for hi in range(1, h + 1):","+ for wi in range(1, w + 1):","+ if m[hi][wi] == \".\":","+ cnt += 1","+inf = 10**9","+d = [[inf] * (w + 2) for _ in range(h + 2)]","+q = deque([(1, 1, 1)])","+d[1][1] = 1","+while len(q):","+ ch, cw, r = q.popleft()","+ for hi, wi in [[ch + 1, cw], [ch, cw + 1], [ch - 1, cw], [ch, cw - 1]]:","+ if m[hi][wi] == \".\" and d[hi][wi] > r + 1:","+ d[hi][wi] = r + 1","+ q.append((hi, wi, r + 1))","+if d[h][w] == inf:","- exit()","-res = 0","-for hi in range(h):","- for wi in range(w):","- if (hi == 0 and wi == 0) or (hi == h - 1 and wi == -1):","- continue","- if d[hi][wi] == \".\":","- res += 1","-print((res - cost[h - 1][w - 1]))","+else:","+ print((cnt - d[h][w]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.297110918,"measured_runtime_v1":0.2054588807,"runtime_lift":1.4460845745,"key":["s808760844","s833213139"]} +{"user_id":"u576432509","problem_id":"p03371","language":"python","submission_id_v0":"s537618501","submission_id_v1":"s493344814","cpu_time_v0":215,"cpu_time_v1":122,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.26,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c,x,y=list(map(int,input().split()))\n\n\n\nyenmin=a*x+b*y\n\nfor zz in range(2*10**5+1):\n\n xx=max(x-zz\/\/2,0)\n\n yy=max(y-zz\/\/2,0)\n\n yen=a*xx+b*yy+c*zz\n\n if yen d[v]+cost:\n\n d[to] = d[v]+cost\n\n par[to] = v\n\n que.put((d[to],to))\n\n\n\n for j in range(n):\n\n if i != j:\n\n a,b = j,par[j]\n\n if a>b:\n\n a,b = b,a\n\n used.add((a,b))\n\n\n\n print((m - len(used)))\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"INF = 123456789\n\n\n\ndef main():\n\n n,m = list(map(int,input().split()))\n\n\n\n d = [ [INF for i in range(n)] for j in range(n) ]\n\n for i in range(n):\n\n d[i][i] = 0\n\n\n\n a = [0 for _ in range(m)]\n\n b = [0 for _ in range(m)]\n\n c = [0 for _ in range(m)]\n\n for i in range(m):\n\n a[i],b[i],c[i] = list(map(int,input().split()))\n\n a[i] -= 1\n\n b[i] -= 1\n\n d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])\n\n d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])\n\n\n\n # Warshall-Floyd\n\n for k in range(n):\n\n for i in range(n):\n\n for j in range(n):\n\n d[i][j] = min(d[i][j], d[i][k]+d[k][j])\n\n\n\n ans = 0\n\n for i in range(m):\n\n found = 1\n\n for j in range(n):\n\n if d[j][a[i]] + c[i] == d[j][b[i]]:\n\n found = 0\n\n break\n\n ans += found\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":46,"code_v1_loc":37,"code_v0_num_chars":1060,"code_v1_num_chars":907,"code_v0_no_empty_lines":"import queue\n\nINF = 123456789\n\n\ndef main():\n n, m = list(map(int, input().split()))\n G = [[] for _ in range(n)]\n for _ in range(m):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n G[a].append((b, c))\n G[b].append((a, c))\n used = set()\n for i in range(n):\n d = [INF for _ in range(n)]\n par = [-1 for _ in range(n)]\n # dijkstra\n que = queue.PriorityQueue()\n d[i] = 0\n que.put((0, i))\n while not que.empty():\n p = que.get()\n v = p[1]\n if d[v] < p[0]:\n continue\n for (to, cost) in G[v]:\n if d[to] > d[v] + cost:\n d[to] = d[v] + cost\n par[to] = v\n que.put((d[to], to))\n for j in range(n):\n if i != j:\n a, b = j, par[j]\n if a > b:\n a, b = b, a\n used.add((a, b))\n print((m - len(used)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"INF = 123456789\n\n\ndef main():\n n, m = list(map(int, input().split()))\n d = [[INF for i in range(n)] for j in range(n)]\n for i in range(n):\n d[i][i] = 0\n a = [0 for _ in range(m)]\n b = [0 for _ in range(m)]\n c = [0 for _ in range(m)]\n for i in range(m):\n a[i], b[i], c[i] = list(map(int, input().split()))\n a[i] -= 1\n b[i] -= 1\n d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])\n d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])\n # Warshall-Floyd\n for k in range(n):\n for i in range(n):\n for j in range(n):\n d[i][j] = min(d[i][j], d[i][k] + d[k][j])\n ans = 0\n for i in range(m):\n found = 1\n for j in range(n):\n if d[j][a[i]] + c[i] == d[j][b[i]]:\n found = 0\n break\n ans += found\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":19.5652173913,"diff":["-import queue","-","- G = [[] for _ in range(n)]","- for _ in range(m):","- a, b, c = list(map(int, input().split()))","- a -= 1","- b -= 1","- G[a].append((b, c))","- G[b].append((a, c))","- used = set()","+ d = [[INF for i in range(n)] for j in range(n)]","- d = [INF for _ in range(n)]","- par = [-1 for _ in range(n)]","- # dijkstra","- que = queue.PriorityQueue()","- d[i] = 0","- que.put((0, i))","- while not que.empty():","- p = que.get()","- v = p[1]","- if d[v] < p[0]:","- continue","- for (to, cost) in G[v]:","- if d[to] > d[v] + cost:","- d[to] = d[v] + cost","- par[to] = v","- que.put((d[to], to))","+ d[i][i] = 0","+ a = [0 for _ in range(m)]","+ b = [0 for _ in range(m)]","+ c = [0 for _ in range(m)]","+ for i in range(m):","+ a[i], b[i], c[i] = list(map(int, input().split()))","+ a[i] -= 1","+ b[i] -= 1","+ d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])","+ d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])","+ # Warshall-Floyd","+ for k in range(n):","+ for i in range(n):","+ for j in range(n):","+ d[i][j] = min(d[i][j], d[i][k] + d[k][j])","+ ans = 0","+ for i in range(m):","+ found = 1","- if i != j:","- a, b = j, par[j]","- if a > b:","- a, b = b, a","- used.add((a, b))","- print((m - len(used)))","+ if d[j][a[i]] + c[i] == d[j][b[i]]:","+ found = 0","+ break","+ ans += found","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3167709551,"measured_runtime_v1":0.2522355395,"runtime_lift":1.2558537773,"key":["s032580281","s724625000"]} +{"user_id":"u581187895","problem_id":"p03575","language":"python","submission_id_v0":"s060994907","submission_id_v1":"s021977851","cpu_time_v0":271,"cpu_time_v1":22,"memory_v0":18640,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.88,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# \u5168\u90e8\u8a66\u3059\n\n# 1\u3064\u3042\u305f\u308aO(M)\n\n# O(M^2) = 10^6\u304f\u3089\u3044\n\nimport numpy as np\n\nfrom scipy.sparse.csgraph import dijkstra\n\n\n\nN,M = list(map(int,input().split()))\n\nedge = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = np.zeros((N+1, N+1))\n\n\n\nfor a, b in edge:\n\n graph[a, b] = 1\n\n \n\nans = 0\n\nfor a, b in edge:\n\n graph[a, b] = np.inf \n\n # directed=False -> \u7121\u5411\u30b0\u30e9\u30d5\n\n dist = dijkstra(graph, indices=a, directed=False)\n\n if dist[b] == np.inf:\n\n ans += 1\n\n graph[a, b] = 1 # \u5143\u306b\u623b\u3059\n\n \n\nprint(ans) \n\n# optimized version of the same code:\n","target":"class UnionFind():\n\n def __init__(self, N):\n\n \"\"\" N\u500b\u306e\u30ce\u30fc\u30c9\u306eUnion-Find\u6728\u3092\u4f5c\u6210\u3059\u308b \"\"\"\n\n # \u89aa\u306e\u756a\u53f7\u3092\u683c\u7d0d\u3059\u308b\u3002\u81ea\u5206\u304c\u89aa\u3060\u3063\u305f\u5834\u5408\u306f\u3001\u81ea\u5206\u306e\u756a\u53f7\u306b\u306a\u308a\u3001\u305d\u308c\u304c\u305d\u306e\u30b0\u30eb\u30fc\u30d7\u306e\u756a\u53f7\u306b\u306a\u308b\n\n self.parent = [n for n in range(0, N)]\n\n # \u30b0\u30eb\u30fc\u30d7\u306e\u6df1\u3055\n\n self.depth = [1] * N\n\n \n\n def find(self, x):\n\n \"\"\" \u6728\u306e\u6839(\u3069\u306e\u30b0\u30eb\u30fc\u30d7\u304b)\u3092\u6c42\u3081\u308b \"\"\"\n\n if self.parent[x] == x: return x\n\n self.parent[x] = self.find(self.parent[x]) # \u7e2e\u7d04\n\n return self.parent[x]\n\n \n\n def unite(self, x, y):\n\n \"\"\" x\u3068y\u306e\u5c5e\u3059\u308b\u96c6\u5408\u3092\u4f75\u5408\u3059\u308b \"\"\"\n\n gx = self.find(x)\n\n gy = self.find(y)\n\n if gx == gy: return\n\n \n\n # \u5c0f\u3055\u3044\u65b9\u3092\u5927\u304d\u3044\u65b9\u306b\u4f75\u5408\u3055\u305b\u308b\uff08\u6728\u306e\u504f\u308a\u304c\u6e1b\u308b\u306e\u3067\uff09\n\n if self.depth[gx] < self.depth[gy]:\n\n self.parent[gx] = gy\n\n else:\n\n self.parent[gy] = gx\n\n if self.depth[gx] == self.depth[gy]: self.depth[gx] += 1\n\n \n\n def is_same_group(self, x, y):\n\n \"\"\" x\u3068y\u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5426\u304b \"\"\"\n\n return self.find(x) == self.find(y)\n\n \n\nN, M = list(map(int, input().split()))\n\nE = [[int(x)-1 for x in input().split()] for _ in range(M)]\n\n\n\n# \u5404\u8fba\u306b\u3064\u3044\u3066\u3001\u305d\u306e\u8fba\u304c\u5b58\u5728\u3057\u306a\u3044\u6642\u3001a\u3068b\u304c\u9023\u7d50\u306b\u306a\u308b\u304b\u3092Union-Find\u3067\u5224\u5b9a\u3059\u308b\n\nans = 0\n\nfor i in range(M):\n\n uf = UnionFind(N)\n\n for j, e in enumerate(E):\n\n if i==j: continue\n\n \n\n a, b = e\n\n uf.unite(a, b)\n\n \n\n # i\u756a\u76ee\u306e\u8fba\u3092\u9664\u304f\u3059\u3079\u3066\u306e\u8fba\u3092\u3064\u306a\u3044\u3060\u3042\u3068\u3067\u3001i\u756a\u76ee\u306e\u8fba(a, b)\u304c\u3064\u306a\u304c\u308b\u304b\u3092\u5224\u5b9a\u3059\u308b\n\n # \u3064\u306a\u304c\u3089\u306a\u3044\u306a\u3089\u3070\u3001\u305d\u306ei\u756a\u76ee\u306e\u8fba\u306f\u6a4b\u3067\u3042\u308b\n\n a, b = E[i]\n\n if not uf.is_same_group(a, b):\n\n ans += 1\n\n\n\nprint(ans) \n","code_v0_loc":24,"code_v1_loc":51,"code_v0_num_chars":490,"code_v1_num_chars":1409,"code_v0_no_empty_lines":"# \u5168\u90e8\u8a66\u3059\n# 1\u3064\u3042\u305f\u308aO(M)\n# O(M^2) = 10^6\u304f\u3089\u3044\nimport numpy as np\nfrom scipy.sparse.csgraph import dijkstra\n\nN, M = list(map(int, input().split()))\nedge = [list(map(int, input().split())) for _ in range(M)]\ngraph = np.zeros((N + 1, N + 1))\nfor a, b in edge:\n graph[a, b] = 1\nans = 0\nfor a, b in edge:\n graph[a, b] = np.inf\n # directed=False -> \u7121\u5411\u30b0\u30e9\u30d5\n dist = dijkstra(graph, indices=a, directed=False)\n if dist[b] == np.inf:\n ans += 1\n graph[a, b] = 1 # \u5143\u306b\u623b\u3059\nprint(ans)\n","code_v1_no_empty_lines":"class UnionFind:\n def __init__(self, N):\n \"\"\"N\u500b\u306e\u30ce\u30fc\u30c9\u306eUnion-Find\u6728\u3092\u4f5c\u6210\u3059\u308b\"\"\"\n # \u89aa\u306e\u756a\u53f7\u3092\u683c\u7d0d\u3059\u308b\u3002\u81ea\u5206\u304c\u89aa\u3060\u3063\u305f\u5834\u5408\u306f\u3001\u81ea\u5206\u306e\u756a\u53f7\u306b\u306a\u308a\u3001\u305d\u308c\u304c\u305d\u306e\u30b0\u30eb\u30fc\u30d7\u306e\u756a\u53f7\u306b\u306a\u308b\n self.parent = [n for n in range(0, N)]\n # \u30b0\u30eb\u30fc\u30d7\u306e\u6df1\u3055\n self.depth = [1] * N\n\n def find(self, x):\n \"\"\"\u6728\u306e\u6839(\u3069\u306e\u30b0\u30eb\u30fc\u30d7\u304b)\u3092\u6c42\u3081\u308b\"\"\"\n if self.parent[x] == x:\n return x\n self.parent[x] = self.find(self.parent[x]) # \u7e2e\u7d04\n return self.parent[x]\n\n def unite(self, x, y):\n \"\"\"x\u3068y\u306e\u5c5e\u3059\u308b\u96c6\u5408\u3092\u4f75\u5408\u3059\u308b\"\"\"\n gx = self.find(x)\n gy = self.find(y)\n if gx == gy:\n return\n # \u5c0f\u3055\u3044\u65b9\u3092\u5927\u304d\u3044\u65b9\u306b\u4f75\u5408\u3055\u305b\u308b\uff08\u6728\u306e\u504f\u308a\u304c\u6e1b\u308b\u306e\u3067\uff09\n if self.depth[gx] < self.depth[gy]:\n self.parent[gx] = gy\n else:\n self.parent[gy] = gx\n if self.depth[gx] == self.depth[gy]:\n self.depth[gx] += 1\n\n def is_same_group(self, x, y):\n \"\"\"x\u3068y\u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5426\u304b\"\"\"\n return self.find(x) == self.find(y)\n\n\nN, M = list(map(int, input().split()))\nE = [[int(x) - 1 for x in input().split()] for _ in range(M)]\n# \u5404\u8fba\u306b\u3064\u3044\u3066\u3001\u305d\u306e\u8fba\u304c\u5b58\u5728\u3057\u306a\u3044\u6642\u3001a\u3068b\u304c\u9023\u7d50\u306b\u306a\u308b\u304b\u3092Union-Find\u3067\u5224\u5b9a\u3059\u308b\nans = 0\nfor i in range(M):\n uf = UnionFind(N)\n for j, e in enumerate(E):\n if i == j:\n continue\n a, b = e\n uf.unite(a, b)\n # i\u756a\u76ee\u306e\u8fba\u3092\u9664\u304f\u3059\u3079\u3066\u306e\u8fba\u3092\u3064\u306a\u3044\u3060\u3042\u3068\u3067\u3001i\u756a\u76ee\u306e\u8fba(a, b)\u304c\u3064\u306a\u304c\u308b\u304b\u3092\u5224\u5b9a\u3059\u308b\n # \u3064\u306a\u304c\u3089\u306a\u3044\u306a\u3089\u3070\u3001\u305d\u306ei\u756a\u76ee\u306e\u8fba\u306f\u6a4b\u3067\u3042\u308b\n a, b = E[i]\n if not uf.is_same_group(a, b):\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":52.9411764706,"diff":["-# \u5168\u90e8\u8a66\u3059","-# 1\u3064\u3042\u305f\u308aO(M)","-# O(M^2) = 10^6\u304f\u3089\u3044","-import numpy as np","-from scipy.sparse.csgraph import dijkstra","+class UnionFind:","+ def __init__(self, N):","+ \"\"\"N\u500b\u306e\u30ce\u30fc\u30c9\u306eUnion-Find\u6728\u3092\u4f5c\u6210\u3059\u308b\"\"\"","+ # \u89aa\u306e\u756a\u53f7\u3092\u683c\u7d0d\u3059\u308b\u3002\u81ea\u5206\u304c\u89aa\u3060\u3063\u305f\u5834\u5408\u306f\u3001\u81ea\u5206\u306e\u756a\u53f7\u306b\u306a\u308a\u3001\u305d\u308c\u304c\u305d\u306e\u30b0\u30eb\u30fc\u30d7\u306e\u756a\u53f7\u306b\u306a\u308b","+ self.parent = [n for n in range(0, N)]","+ # \u30b0\u30eb\u30fc\u30d7\u306e\u6df1\u3055","+ self.depth = [1] * N","+","+ def find(self, x):","+ \"\"\"\u6728\u306e\u6839(\u3069\u306e\u30b0\u30eb\u30fc\u30d7\u304b)\u3092\u6c42\u3081\u308b\"\"\"","+ if self.parent[x] == x:","+ return x","+ self.parent[x] = self.find(self.parent[x]) # \u7e2e\u7d04","+ return self.parent[x]","+","+ def unite(self, x, y):","+ \"\"\"x\u3068y\u306e\u5c5e\u3059\u308b\u96c6\u5408\u3092\u4f75\u5408\u3059\u308b\"\"\"","+ gx = self.find(x)","+ gy = self.find(y)","+ if gx == gy:","+ return","+ # \u5c0f\u3055\u3044\u65b9\u3092\u5927\u304d\u3044\u65b9\u306b\u4f75\u5408\u3055\u305b\u308b\uff08\u6728\u306e\u504f\u308a\u304c\u6e1b\u308b\u306e\u3067\uff09","+ if self.depth[gx] < self.depth[gy]:","+ self.parent[gx] = gy","+ else:","+ self.parent[gy] = gx","+ if self.depth[gx] == self.depth[gy]:","+ self.depth[gx] += 1","+","+ def is_same_group(self, x, y):","+ \"\"\"x\u3068y\u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5426\u304b\"\"\"","+ return self.find(x) == self.find(y)","+","-edge = [list(map(int, input().split())) for _ in range(M)]","-graph = np.zeros((N + 1, N + 1))","-for a, b in edge:","- graph[a, b] = 1","+E = [[int(x) - 1 for x in input().split()] for _ in range(M)]","+# \u5404\u8fba\u306b\u3064\u3044\u3066\u3001\u305d\u306e\u8fba\u304c\u5b58\u5728\u3057\u306a\u3044\u6642\u3001a\u3068b\u304c\u9023\u7d50\u306b\u306a\u308b\u304b\u3092Union-Find\u3067\u5224\u5b9a\u3059\u308b","-for a, b in edge:","- graph[a, b] = np.inf","- # directed=False -> \u7121\u5411\u30b0\u30e9\u30d5","- dist = dijkstra(graph, indices=a, directed=False)","- if dist[b] == np.inf:","+for i in range(M):","+ uf = UnionFind(N)","+ for j, e in enumerate(E):","+ if i == j:","+ continue","+ a, b = e","+ uf.unite(a, b)","+ # i\u756a\u76ee\u306e\u8fba\u3092\u9664\u304f\u3059\u3079\u3066\u306e\u8fba\u3092\u3064\u306a\u3044\u3060\u3042\u3068\u3067\u3001i\u756a\u76ee\u306e\u8fba(a, b)\u304c\u3064\u306a\u304c\u308b\u304b\u3092\u5224\u5b9a\u3059\u308b","+ # \u3064\u306a\u304c\u3089\u306a\u3044\u306a\u3089\u3070\u3001\u305d\u306ei\u756a\u76ee\u306e\u8fba\u306f\u6a4b\u3067\u3042\u308b","+ a, b = E[i]","+ if not uf.is_same_group(a, b):","- graph[a, b] = 1 # \u5143\u306b\u623b\u3059"],"diff_only_import_comment":false,"measured_runtime_v0":2.1378849642,"measured_runtime_v1":0.2154630218,"runtime_lift":9.922282472,"key":["s060994907","s021977851"]} +{"user_id":"u282228874","problem_id":"p03416","language":"python","submission_id_v0":"s105404887","submission_id_v1":"s977655968","cpu_time_v0":128,"cpu_time_v1":48,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b = list(map(int,input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n s = str(i)\n\n l = len(s)\n\n if all(s[j] == s[l-j-1] for j in range(l)):\n\n count += 1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"a,b = list(map(int,input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n s = str(i)\n\n if s == s[::-1]:\n\n count += 1\n\nprint(count)","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":184,"code_v1_num_chars":138,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n s = str(i)\n l = len(s)\n if all(s[j] == s[l - j - 1] for j in range(l)):\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["- l = len(s)","- if all(s[j] == s[l - j - 1] for j in range(l)):","+ if s == s[::-1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.5951726662,"measured_runtime_v1":0.34452695,"runtime_lift":1.72750685,"key":["s105404887","s977655968"]} +{"user_id":"u375616706","problem_id":"p03575","language":"python","submission_id_v0":"s865425208","submission_id_v1":"s683198450","cpu_time_v0":30,"cpu_time_v1":21,"memory_v0":3064,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n\n\nclass UnionFind:\n\n def __init__(self, size):\n\n self.table = [i for i in range(size)]\n\n\n\n def find(self, x):\n\n return self.table[x]\n\n\n\n def union(self, x, y):\n\n x1 = self.find(x)\n\n y1 = self.find(y)\n\n\n\n if x1 == y1:\n\n return False\n\n\n\n for i in range(len(self.table)):\n\n if self.table[i] == y1:\n\n self.table[i] = x1\n\n return True\n\n\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\nedges = []\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1])\n\n\n\nmat = [[0]*N for _ in range(N)]\n\nfor s, g in edges:\n\n mat[s][g] = 1\n\n mat[g][s] = 1\n\n\n\nans = 0\n\n\n\nfor i in range(M):\n\n uni = UnionFind(N)\n\n\n\n for j in range(M):\n\n if i != j:\n\n uni.union(edges[j][0], edges[j][1])\n\n\n\n if not all(uni.find(0) == uni.find(x) for x in range(N)):\n\n ans += 1\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"# python template for atcoder1\n\nimport sys\n\nsys.setrecursionlimit(10**9)\n\ninput = sys.stdin.readline\n\n\n\n\n\nclass UnionFind:\n\n def __init__(self, size):\n\n \"\"\"\n\n size:\u9802\u70b9\u306e\u6570\n\n \"\"\"\n\n self.parent = [i for i in range(size)]\n\n self.rank = [0 for _ in range(size)]\n\n\n\n def find(self, x):\n\n \"\"\"\n\n x\u306eroot\u3092\u8fd4\u3059\n\n \"\"\"\n\n if self.parent[x] == x:\n\n return x\n\n else:\n\n return self.find(self.parent[x])\n\n\n\n def union(self, x, y):\n\n \"\"\"\n\n x,y\u3092\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u3068\u3057\u3066\u307e\u3068\u3081\u308b\n\n \"\"\"\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:\n\n return\n\n\n\n if self.rank[x] < self.rank[y]:\n\n self.parent[x] = y\n\n else:\n\n self.parent[y] = x\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n\n\n def same(self, x, y):\n\n \"\"\"\n\n x\u3068y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306a\u3089True\n\n \"\"\"\n\n return self.find(x) == self.find(y)\n\n\n\n def component(self):\n\n \"\"\"\n\n \u5404\u9023\u7d50\u6210\u5206\u306eroot\u306e\u96c6\u5408\u3092\u8fd4\u3059\n\n len()\u3092\u3068\u308c\u3070\u9023\u7d50\u6210\u5206\u306e\u6570\u304c\u6c42\u3081\u3089\u308c\u308b\n\n return-> set()\n\n \"\"\"\n\n comp = set()\n\n for i in self.parent:\n\n p = self.find(i)\n\n comp.add(p)\n\n return comp\n\n\n\n def __str__(self):\n\n \"\"\"\n\n for debug\n\n \u30af\u30e9\u30b9\u306elist\u306e\u60c5\u5831\u3092\u51fa\u529b\n\n \"\"\"\n\n ret = \"parents\\n\"\n\n ret += \" \".join(map(str, self.parent))\n\n ret += '\\n'\n\n ret += \" \".join(map(str, self.rank))\n\n return ret\n\n\n\n\n\nN, M = list(map(int, input().split()))\n\nedges = []\n\n\n\nfor _ in range(M):\n\n a, b = [int(x)-1 for x in input().split()]\n\n edges.append([a, b])\n\n\n\nans = 0\n\nfor e in edges:\n\n Un = UnionFind(N)\n\n for g in edges:\n\n if e == g:\n\n continue\n\n else:\n\n Un.union(g[0], g[1])\n\n if not Un.same(e[0], e[1]):\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":45,"code_v1_loc":87,"code_v0_num_chars":905,"code_v1_num_chars":1882,"code_v0_no_empty_lines":"class UnionFind:\n def __init__(self, size):\n self.table = [i for i in range(size)]\n\n def find(self, x):\n return self.table[x]\n\n def union(self, x, y):\n x1 = self.find(x)\n y1 = self.find(y)\n if x1 == y1:\n return False\n for i in range(len(self.table)):\n if self.table[i] == y1:\n self.table[i] = x1\n return True\n\n\nN, M = list(map(int, input().split()))\nedges = []\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n edges.append([a - 1, b - 1])\nmat = [[0] * N for _ in range(N)]\nfor s, g in edges:\n mat[s][g] = 1\n mat[g][s] = 1\nans = 0\nfor i in range(M):\n uni = UnionFind(N)\n for j in range(M):\n if i != j:\n uni.union(edges[j][0], edges[j][1])\n if not all(uni.find(0) == uni.find(x) for x in range(N)):\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"# python template for atcoder1\nimport sys\n\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\n\nclass UnionFind:\n def __init__(self, size):\n \"\"\"\n size:\u9802\u70b9\u306e\u6570\n \"\"\"\n self.parent = [i for i in range(size)]\n self.rank = [0 for _ in range(size)]\n\n def find(self, x):\n \"\"\"\n x\u306eroot\u3092\u8fd4\u3059\n \"\"\"\n if self.parent[x] == x:\n return x\n else:\n return self.find(self.parent[x])\n\n def union(self, x, y):\n \"\"\"\n x,y\u3092\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u3068\u3057\u3066\u307e\u3068\u3081\u308b\n \"\"\"\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.rank[x] < self.rank[y]:\n self.parent[x] = y\n else:\n self.parent[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n def same(self, x, y):\n \"\"\"\n x\u3068y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306a\u3089True\n \"\"\"\n return self.find(x) == self.find(y)\n\n def component(self):\n \"\"\"\n \u5404\u9023\u7d50\u6210\u5206\u306eroot\u306e\u96c6\u5408\u3092\u8fd4\u3059\n len()\u3092\u3068\u308c\u3070\u9023\u7d50\u6210\u5206\u306e\u6570\u304c\u6c42\u3081\u3089\u308c\u308b\n return-> set()\n \"\"\"\n comp = set()\n for i in self.parent:\n p = self.find(i)\n comp.add(p)\n return comp\n\n def __str__(self):\n \"\"\"\n for debug\n \u30af\u30e9\u30b9\u306elist\u306e\u60c5\u5831\u3092\u51fa\u529b\n \"\"\"\n ret = \"parents\\n\"\n ret += \" \".join(map(str, self.parent))\n ret += \"\\n\"\n ret += \" \".join(map(str, self.rank))\n return ret\n\n\nN, M = list(map(int, input().split()))\nedges = []\nfor _ in range(M):\n a, b = [int(x) - 1 for x in input().split()]\n edges.append([a, b])\nans = 0\nfor e in edges:\n Un = UnionFind(N)\n for g in edges:\n if e == g:\n continue\n else:\n Un.union(g[0], g[1])\n if not Un.same(e[0], e[1]):\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":48.275862069,"diff":["+# python template for atcoder1","+import sys","+","+sys.setrecursionlimit(10**9)","+input = sys.stdin.readline","+","+","- self.table = [i for i in range(size)]","+ \"\"\"","+ size:\u9802\u70b9\u306e\u6570","+ \"\"\"","+ self.parent = [i for i in range(size)]","+ self.rank = [0 for _ in range(size)]","- return self.table[x]","+ \"\"\"","+ x\u306eroot\u3092\u8fd4\u3059","+ \"\"\"","+ if self.parent[x] == x:","+ return x","+ else:","+ return self.find(self.parent[x])","- x1 = self.find(x)","- y1 = self.find(y)","- if x1 == y1:","- return False","- for i in range(len(self.table)):","- if self.table[i] == y1:","- self.table[i] = x1","- return True","+ \"\"\"","+ x,y\u3092\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u3068\u3057\u3066\u307e\u3068\u3081\u308b","+ \"\"\"","+ x = self.find(x)","+ y = self.find(y)","+ if x == y:","+ return","+ if self.rank[x] < self.rank[y]:","+ self.parent[x] = y","+ else:","+ self.parent[y] = x","+ if self.rank[x] == self.rank[y]:","+ self.rank[x] += 1","+","+ def same(self, x, y):","+ \"\"\"","+ x\u3068y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306a\u3089True","+ \"\"\"","+ return self.find(x) == self.find(y)","+","+ def component(self):","+ \"\"\"","+ \u5404\u9023\u7d50\u6210\u5206\u306eroot\u306e\u96c6\u5408\u3092\u8fd4\u3059","+ len()\u3092\u3068\u308c\u3070\u9023\u7d50\u6210\u5206\u306e\u6570\u304c\u6c42\u3081\u3089\u308c\u308b","+ return-> set()","+ \"\"\"","+ comp = set()","+ for i in self.parent:","+ p = self.find(i)","+ comp.add(p)","+ return comp","+","+ def __str__(self):","+ \"\"\"","+ for debug","+ \u30af\u30e9\u30b9\u306elist\u306e\u60c5\u5831\u3092\u51fa\u529b","+ \"\"\"","+ ret = \"parents\\n\"","+ ret += \" \".join(map(str, self.parent))","+ ret += \"\\n\"","+ ret += \" \".join(map(str, self.rank))","+ return ret","- a, b = list(map(int, input().split()))","- edges.append([a - 1, b - 1])","-mat = [[0] * N for _ in range(N)]","-for s, g in edges:","- mat[s][g] = 1","- mat[g][s] = 1","+ a, b = [int(x) - 1 for x in input().split()]","+ edges.append([a, b])","-for i in range(M):","- uni = UnionFind(N)","- for j in range(M):","- if i != j:","- uni.union(edges[j][0], edges[j][1])","- if not all(uni.find(0) == uni.find(x) for x in range(N)):","+for e in edges:","+ Un = UnionFind(N)","+ for g in edges:","+ if e == g:","+ continue","+ else:","+ Un.union(g[0], g[1])","+ if not Un.same(e[0], e[1]):"],"diff_only_import_comment":false,"measured_runtime_v0":0.3550173998,"measured_runtime_v1":0.2645738666,"runtime_lift":1.3418460573,"key":["s865425208","s683198450"]} +{"user_id":"u060896757","problem_id":"p02688","language":"python","submission_id_v0":"s916854343","submission_id_v1":"s774123468","cpu_time_v0":116,"cpu_time_v1":60,"memory_v0":27092,"memory_v1":67788,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.28,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN, K = list(map(int, input().split()))\n\n \n\nA = np.zeros(N, dtype=int)\n\n \n\nfor _ in range(K):\n\n eval(input())\n\n for i in input().split():\n\n A[int(i) - 1] += 1\n\n \n\nans = 0\n\nfor i in A:\n\n if i == 0:\n\n ans += 1\n\nprint(ans)\n\n \n\n# optimized version of the same code:\n","target":"N, K = list(map(int, input().split()))\n\n\n\nA = [0] * N\n\n\n\nfor _ in range(K):\n\n eval(input())\n\n for i in map(int, input().split()):\n\n A[i - 1] += 1\n\n\n\nprint((A.count(0)))\n","code_v0_loc":16,"code_v1_loc":10,"code_v0_num_chars":252,"code_v1_num_chars":168,"code_v0_no_empty_lines":"import numpy as np\n\nN, K = list(map(int, input().split()))\nA = np.zeros(N, dtype=int)\nfor _ in range(K):\n eval(input())\n for i in input().split():\n A[int(i) - 1] += 1\nans = 0\nfor i in A:\n if i == 0:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nA = [0] * N\nfor _ in range(K):\n eval(input())\n for i in map(int, input().split()):\n A[i - 1] += 1\nprint((A.count(0)))\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-import numpy as np","-","-A = np.zeros(N, dtype=int)","+A = [0] * N","- for i in input().split():","- A[int(i) - 1] += 1","-ans = 0","-for i in A:","- if i == 0:","- ans += 1","-print(ans)","+ for i in map(int, input().split()):","+ A[i - 1] += 1","+print((A.count(0)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.6720787771,"measured_runtime_v1":0.288313632,"runtime_lift":5.7995134165,"key":["s916854343","s774123468"]} +{"user_id":"u156815136","problem_id":"p02921","language":"python","submission_id_v0":"s427233353","submission_id_v1":"s366680967","cpu_time_v0":35,"cpu_time_v1":17,"memory_v0":5048,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport itertools\n\nimport fractions\n\ndef main():\n\n s = eval(input())\n\n t = eval(input())\n\n cnt = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n cnt += 1\n\n print(cnt)\n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"s = eval(input())\n\nt = eval(input())\n\nans = 0\n\nfor i in range(3):\n\n if s[i] == t[i]:\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":12,"code_v1_loc":7,"code_v0_num_chars":200,"code_v1_num_chars":106,"code_v0_no_empty_lines":"import itertools\nimport fractions\n\n\ndef main():\n s = eval(input())\n t = eval(input())\n cnt = 0\n for i in range(3):\n if s[i] == t[i]:\n cnt += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"s = eval(input())\nt = eval(input())\nans = 0\nfor i in range(3):\n if s[i] == t[i]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["-import itertools","-import fractions","-","-","-def main():","- s = eval(input())","- t = eval(input())","- cnt = 0","- for i in range(3):","- if s[i] == t[i]:","- cnt += 1","- print(cnt)","-","-","-if __name__ == \"__main__\":","- main()","+s = eval(input())","+t = eval(input())","+ans = 0","+for i in range(3):","+ if s[i] == t[i]:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.370313344,"measured_runtime_v1":0.278846802,"runtime_lift":1.3280171813,"key":["s427233353","s366680967"]} +{"user_id":"u190405389","problem_id":"p03575","language":"python","submission_id_v0":"s242823115","submission_id_v1":"s505533510","cpu_time_v0":397,"cpu_time_v1":55,"memory_v0":21148,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.15,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn,m = list(map(int, input().split()))\n\n\n\nconnect = np.zeros((n,n))\n\n\n\nfor i in range(m):\n\n a, b = list(map(int, input().split()))\n\n connect[a-1, b-1] = 1\n\n connect[b-1, a-1] = 1\n\n\n\nnotbridge = 0\n\n\n\n\n\nfor i in range(n):\n\n for j in range(n):\n\n if connect[i,j] == 1:\n\n connect[i,j] = 0\n\n connect[j,i] = 0\n\n stack =[1]\n\n visited = [1]\n\n while stack:\n\n p = stack.pop()\n\n for k in range(n):\n\n if connect[p,k] == 1:\n\n if k not in visited:\n\n stack.append(k)\n\n visited.append(k)\n\n if len(visited) == n:\n\n notbridge += 1\n\n connect[i,j] = 1\n\n connect[j,i] = 1\n\n\n\n\n\n\n\nprint((m-notbridge\/\/2))\n\n\n\n\n\n\n# optimized version of the same code:\n","target":"n,m = list(map(int, input().split()))\n\n\n\nconnect = [[0 for i in range(n)] for j in range(n)]\n\n\n\nfor i in range(m):\n\n a, b = list(map(int, input().split()))\n\n connect[a-1][b-1] = 1\n\n connect[b-1][a-1] = 1\n\n\n\nnotbridge = 0\n\n\n\n\n\nfor i in range(n):\n\n for j in range(n):\n\n if connect[i][j] == 1:\n\n connect[i][j] = 0\n\n connect[j][i] = 0\n\n stack =[1]\n\n visited = [1]\n\n while stack:\n\n p = stack.pop()\n\n for k in range(n):\n\n if connect[p][k] == 1:\n\n if k not in visited:\n\n stack.append(k)\n\n visited.append(k)\n\n if len(visited) == n:\n\n notbridge += 1\n\n connect[i][j] = 1\n\n connect[j][i] = 1\n\n\n\n\n\n\n\nprint((m-notbridge\/\/2))\n\n\n\n\n","code_v0_loc":38,"code_v1_loc":36,"code_v0_num_chars":840,"code_v1_num_chars":850,"code_v0_no_empty_lines":"import numpy as np\n\nn, m = list(map(int, input().split()))\nconnect = np.zeros((n, n))\nfor i in range(m):\n a, b = list(map(int, input().split()))\n connect[a - 1, b - 1] = 1\n connect[b - 1, a - 1] = 1\nnotbridge = 0\nfor i in range(n):\n for j in range(n):\n if connect[i, j] == 1:\n connect[i, j] = 0\n connect[j, i] = 0\n stack = [1]\n visited = [1]\n while stack:\n p = stack.pop()\n for k in range(n):\n if connect[p, k] == 1:\n if k not in visited:\n stack.append(k)\n visited.append(k)\n if len(visited) == n:\n notbridge += 1\n connect[i, j] = 1\n connect[j, i] = 1\nprint((m - notbridge \/\/ 2))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nconnect = [[0 for i in range(n)] for j in range(n)]\nfor i in range(m):\n a, b = list(map(int, input().split()))\n connect[a - 1][b - 1] = 1\n connect[b - 1][a - 1] = 1\nnotbridge = 0\nfor i in range(n):\n for j in range(n):\n if connect[i][j] == 1:\n connect[i][j] = 0\n connect[j][i] = 0\n stack = [1]\n visited = [1]\n while stack:\n p = stack.pop()\n for k in range(n):\n if connect[p][k] == 1:\n if k not in visited:\n stack.append(k)\n visited.append(k)\n if len(visited) == n:\n notbridge += 1\n connect[i][j] = 1\n connect[j][i] = 1\nprint((m - notbridge \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-import numpy as np","-","-connect = np.zeros((n, n))","+connect = [[0 for i in range(n)] for j in range(n)]","- connect[a - 1, b - 1] = 1","- connect[b - 1, a - 1] = 1","+ connect[a - 1][b - 1] = 1","+ connect[b - 1][a - 1] = 1","- if connect[i, j] == 1:","- connect[i, j] = 0","- connect[j, i] = 0","+ if connect[i][j] == 1:","+ connect[i][j] = 0","+ connect[j][i] = 0","- if connect[p, k] == 1:","+ if connect[p][k] == 1:","- connect[i, j] = 1","- connect[j, i] = 1","+ connect[i][j] = 1","+ connect[j][i] = 1"],"diff_only_import_comment":false,"measured_runtime_v0":1.6713217747,"measured_runtime_v1":0.2783439574,"runtime_lift":6.0045196962,"key":["s242823115","s505533510"]} +{"user_id":"u057109575","problem_id":"p03579","language":"python","submission_id_v0":"s986959512","submission_id_v1":"s945473888","cpu_time_v0":918,"cpu_time_v1":684,"memory_v0":108376,"memory_v1":76248,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.49,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(100000)\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(v, c):\n\n # c: color = 1 or -1\n\n node[v] = c\n\n for i in graph[v]:\n\n if node[i] == c:\n\n return False\n\n \n\n if node[i] == 0 and not dfs(i, -c):\n\n return False\n\n \n\n return True\n\n\n\nnode = [0] * N\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in node) \/\/ 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) \/\/ 2 - M))\n\n\n# optimized version of the same code:\n","target":"from collections import deque\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(s, c):\n\n q = deque()\n\n q.append(s)\n\n visited[s] = True\n\n color[s] = c\n\n \n\n while len(q) > 0:\n\n v = q.pop()\n\n for i in graph[v]:\n\n if visited[i] and color[i] == color[v]:\n\n return False\n\n \n\n if not visited[i]:\n\n visited[i] = True\n\n color[i] = -color[v]\n\n q.append(i)\n\n \n\n return True\n\n\n\nvisited = [False] * N\n\ncolor = [0] * N\n\n\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in color) \/\/ 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) \/\/ 2 - M))\n\n \n\n ","code_v0_loc":28,"code_v1_loc":38,"code_v0_num_chars":640,"code_v1_num_chars":858,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(100000)\nN, M = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N)]\nfor x, y in edges:\n graph[x - 1].append(y - 1)\n graph[y - 1].append(x - 1)\n\n\ndef dfs(v, c):\n # c: color = 1 or -1\n node[v] = c\n for i in graph[v]:\n if node[i] == c:\n return False\n if node[i] == 0 and not dfs(i, -c):\n return False\n return True\n\n\nnode = [0] * N\nif dfs(0, 1):\n x = sum(v + 1 for v in node) \/\/ 2\n print((x * (N - x) - M))\nelse:\n print((N * (N - 1) \/\/ 2 - M))\n","code_v1_no_empty_lines":"from collections import deque\n\nN, M = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N)]\nfor x, y in edges:\n graph[x - 1].append(y - 1)\n graph[y - 1].append(x - 1)\n\n\ndef dfs(s, c):\n q = deque()\n q.append(s)\n visited[s] = True\n color[s] = c\n while len(q) > 0:\n v = q.pop()\n for i in graph[v]:\n if visited[i] and color[i] == color[v]:\n return False\n if not visited[i]:\n visited[i] = True\n color[i] = -color[v]\n q.append(i)\n return True\n\n\nvisited = [False] * N\ncolor = [0] * N\nif dfs(0, 1):\n x = sum(v + 1 for v in color) \/\/ 2\n print((x * (N - x) - M))\nelse:\n print((N * (N - 1) \/\/ 2 - M))\n","code_same":false,"relative_loc_diff_percent":26.3157894737,"diff":["-import sys","+from collections import deque","-sys.setrecursionlimit(100000)","-def dfs(v, c):","- # c: color = 1 or -1","- node[v] = c","- for i in graph[v]:","- if node[i] == c:","- return False","- if node[i] == 0 and not dfs(i, -c):","- return False","+def dfs(s, c):","+ q = deque()","+ q.append(s)","+ visited[s] = True","+ color[s] = c","+ while len(q) > 0:","+ v = q.pop()","+ for i in graph[v]:","+ if visited[i] and color[i] == color[v]:","+ return False","+ if not visited[i]:","+ visited[i] = True","+ color[i] = -color[v]","+ q.append(i)","-node = [0] * N","+visited = [False] * N","+color = [0] * N","- x = sum(v + 1 for v in node) \/\/ 2","+ x = sum(v + 1 for v in color) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.2537954175,"measured_runtime_v1":0.006062909,"runtime_lift":41.8603372027,"key":["s986959512","s945473888"]} +{"user_id":"u426534722","problem_id":"p02248","language":"python","submission_id_v0":"s909106276","submission_id_v1":"s961733692","cpu_time_v0":910,"cpu_time_v1":790,"memory_v0":117852,"memory_v1":117860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.19,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return nx\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = eval(input())\n\nP = eval(input())\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n\n\n# optimized version of the same code:\n","target":"def kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return tuple(nx)\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = eval(input())\n\nP = eval(input())\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n","code_v0_loc":36,"code_v1_loc":36,"code_v0_num_chars":860,"code_v1_num_chars":867,"code_v0_no_empty_lines":"def kmpTable(w):\n lw = len(w)\n nx = [-1] * (lw + 1)\n j = -1\n for i in range(lw):\n while j >= 0 and w[i] != w[j]:\n j = nx[j]\n j += 1\n nx[i + 1] = j\n return nx\n\n\ndef kmpSearch(s, w):\n ls = len(s)\n start = 0\n w_idx = 0\n ret = []\n nx = kmpTable(w)\n while start + w_idx < ls:\n if s[start + w_idx] == w[w_idx]:\n w_idx += 1\n if w_idx == len(w):\n ret.append(start)\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n else:\n if w_idx == 0:\n start += 1\n else:\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n return ret\n\n\nT = eval(input())\nP = eval(input())\nans = kmpSearch(T, P)\nif ans:\n print((\"\\n\".join(map(str, ans))))\n","code_v1_no_empty_lines":"def kmpTable(w):\n lw = len(w)\n nx = [-1] * (lw + 1)\n j = -1\n for i in range(lw):\n while j >= 0 and w[i] != w[j]:\n j = nx[j]\n j += 1\n nx[i + 1] = j\n return tuple(nx)\n\n\ndef kmpSearch(s, w):\n ls = len(s)\n start = 0\n w_idx = 0\n ret = []\n nx = kmpTable(w)\n while start + w_idx < ls:\n if s[start + w_idx] == w[w_idx]:\n w_idx += 1\n if w_idx == len(w):\n ret.append(start)\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n else:\n if w_idx == 0:\n start += 1\n else:\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n return ret\n\n\nT = eval(input())\nP = eval(input())\nans = kmpSearch(T, P)\nif ans:\n print((\"\\n\".join(map(str, ans))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- return nx","+ return tuple(nx)"],"diff_only_import_comment":false,"measured_runtime_v0":0.215319014,"measured_runtime_v1":0.1265300495,"runtime_lift":1.7017223565,"key":["s909106276","s961733692"]} +{"user_id":"u326609687","problem_id":"p02537","language":"python","submission_id_v0":"s641106335","submission_id_v1":"s059113462","cpu_time_v0":1304,"cpu_time_v1":183,"memory_v0":131040,"memory_v1":40944,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.97,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n import os\n\n import re\n\n with open(__file__) as f:\n\n source = f.read().split('###''nbacl')\n\n for s in source[1:]:\n\n s = re.sub(\"'''.*\", '', s)\n\n sp = s.split(maxsplit=1)\n\n if os.path.dirname(sp[0]):\n\n os.makedirs(os.path.dirname(sp[0]), exist_ok=True)\n\n with open(sp[0], 'w') as f:\n\n f.write(sp[1])\n\n from nbmodule import cc\n\n cc.compile()\n\nimport numpy as np\n\nfrom numpy import int64\n\nfrom nbmodule import solve\n\n\n\n\n\nf = open(0)\n\nN, K = [int(x) for x in f.readline().split()]\n\nA = np.fromstring(f.read(), dtype=int64, sep=' ')\n\nans = solve(N, K, A)\n\nprint(ans)\n\n\n\n'''\n\n###nbacl nbmodule.py\n\nimport numpy as np\n\nfrom numpy import int64\n\nfrom numba import njit\n\nfrom numba.types import i8\n\nfrom numba.pycc import CC\n\nimport nbacl.segtree as seg\n\ncc = CC('my_module')\n\n\n\n\n\n@cc.export('solve', (i8, i8, i8[:]))\n\n@njit\n\ndef solve(N, K, A):\n\n dp = np.zeros(300_001, dtype=int64)\n\n d = seg.segtree(dp, max, 0)\n\n for i in range(N):\n\n x = seg.prod(d, max, (A[i] - K) if A[i] > K else 0, (A[i] + K + 1) if A[i] + K < 300_000 else 300_001) + 1\n\n seg.set(d, max, A[i], x)\n\n return seg.all_prod(d)\n\n\n\n\n\nif __name__ == '__main__':\n\n cc.compile()\n\n###nbacl nbacl\/segtree.py\n\nimport numpy as np\n\nfrom numba import njit\n\nfrom numba.types import i8\n\n\n\n\n\n@njit\n\ndef ceil_pow2(n):\n\n x = 0\n\n while (1 << x) < n:\n\n x += 1\n\n return x\n\n\n\n\n\n@njit\n\ndef segtree(a, op, e):\n\n log = ceil_pow2(a.shape[0])\n\n size = 1 << log\n\n d = np.empty(size * 2, dtype=a.dtype)\n\n d[size:size + len(a)] = a\n\n d[size + len(a):] = e\n\n # e\n\n d[0] = e\n\n for i in range(size - 1, 0, -1):\n\n update(d, i, op)\n\n return d\n\n\n\n\n\n@njit\n\ndef update(d, k, op):\n\n d[k] = op(d[2 * k], d[2 * k + 1])\n\n\n\n\n\n@njit\n\ndef set(d, op, p, x):\n\n p += d.shape[0] \/\/ 2\n\n d[p] = x\n\n while p > 1:\n\n p >>= 1\n\n update(d, p, op)\n\n\n\n\n\n@njit\n\ndef get(d, p):\n\n return d[p + d.shape[0] \/\/ 2]\n\n\n\n\n\n@njit\n\ndef prod(d, op, left, right):\n\n size = d.shape[0] \/\/ 2\n\n sml = d[0]\n\n smr = d[0]\n\n left += size\n\n right += size\n\n\n\n while left < right:\n\n if left & 1:\n\n sml = op(sml, d[left])\n\n left += 1\n\n if right & 1:\n\n right -= 1\n\n smr = op(d[right], smr)\n\n left >>= 1\n\n right >>= 1\n\n\n\n return op(sml, smr)\n\n\n\n\n\n@njit\n\ndef all_prod(d):\n\n return d[1]\n\n\n\n'''\n\n\n# optimized version of the same code:\n","target":"import sys\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n import os\n\n import re\n\n with open(__file__) as f:\n\n source = f.read().split('###''nbacl')\n\n for s in source[1:]:\n\n s = re.sub(\"'''.*\", '', s)\n\n sp = s.split(maxsplit=1)\n\n if os.path.dirname(sp[0]):\n\n os.makedirs(os.path.dirname(sp[0]), exist_ok=True)\n\n with open(sp[0], 'w') as f:\n\n f.write(sp[1])\n\n from nbmodule import cc\n\n cc.compile()\n\nimport numpy as np\n\nfrom numpy import int64\n\nfrom nbmodule import solve\n\n\n\n\n\nf = open(0)\n\nN, K = [int(x) for x in f.readline().split()]\n\nA = np.fromstring(f.read(), dtype=int64, sep=' ')\n\nans = solve(N, K, A)\n\nprint(ans)\n\n\n\n'''\n\n###nbacl nbmodule.py\n\nimport numpy as np\n\nfrom numpy import int64\n\nfrom numba import njit\n\nfrom numba.types import i8\n\nfrom numba.pycc import CC\n\nimport nbacl.segtree as seg\n\ncc = CC('nbmodule')\n\n\n\n\n\n@cc.export('solve', (i8, i8, i8[:]))\n\n@njit\n\ndef solve(N, K, A):\n\n dp = np.zeros(300_001, dtype=int64)\n\n d = seg.segtree(dp, max, 0)\n\n for i in range(N):\n\n x = seg.prod(d, max, (A[i] - K) if A[i] > K else 0, (A[i] + K + 1) if A[i] + K < 300_000 else 300_001) + 1\n\n seg.set(d, max, A[i], x)\n\n return seg.all_prod(d)\n\n\n\n\n\nif __name__ == '__main__':\n\n cc.compile()\n\n###nbacl nbacl\/segtree.py\n\nimport numpy as np\n\nfrom numba import njit\n\nfrom numba.types import i8\n\n\n\n\n\n@njit\n\ndef ceil_pow2(n):\n\n x = 0\n\n while (1 << x) < n:\n\n x += 1\n\n return x\n\n\n\n\n\n@njit\n\ndef segtree(a, op, e):\n\n log = ceil_pow2(a.shape[0])\n\n size = 1 << log\n\n d = np.empty(size * 2, dtype=a.dtype)\n\n d[size:size + len(a)] = a\n\n d[size + len(a):] = e\n\n # e\n\n d[0] = e\n\n for i in range(size - 1, 0, -1):\n\n update(d, i, op)\n\n return d\n\n\n\n\n\n@njit\n\ndef update(d, k, op):\n\n d[k] = op(d[2 * k], d[2 * k + 1])\n\n\n\n\n\n@njit\n\ndef set(d, op, p, x):\n\n p += d.shape[0] \/\/ 2\n\n d[p] = x\n\n while p > 1:\n\n p >>= 1\n\n update(d, p, op)\n\n\n\n\n\n@njit\n\ndef get(d, p):\n\n return d[p + d.shape[0] \/\/ 2]\n\n\n\n\n\n@njit\n\ndef prod(d, op, left, right):\n\n size = d.shape[0] \/\/ 2\n\n sml = d[0]\n\n smr = d[0]\n\n left += size\n\n right += size\n\n\n\n while left < right:\n\n if left & 1:\n\n sml = op(sml, d[left])\n\n left += 1\n\n if right & 1:\n\n right -= 1\n\n smr = op(d[right], smr)\n\n left >>= 1\n\n right >>= 1\n\n\n\n return op(sml, smr)\n\n\n\n\n\n@njit\n\ndef all_prod(d):\n\n return d[1]\n\n\n\n'''\n","code_v0_loc":123,"code_v1_loc":123,"code_v0_num_chars":2493,"code_v1_num_chars":2492,"code_v0_no_empty_lines":"import sys\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n import os\n import re\n\n with open(__file__) as f:\n source = f.read().split(\"###\" \"nbacl\")\n for s in source[1:]:\n s = re.sub(\"'''.*\", \"\", s)\n sp = s.split(maxsplit=1)\n if os.path.dirname(sp[0]):\n os.makedirs(os.path.dirname(sp[0]), exist_ok=True)\n with open(sp[0], \"w\") as f:\n f.write(sp[1])\n from nbmodule import cc\n\n cc.compile()\nimport numpy as np\nfrom numpy import int64\nfrom nbmodule import solve\n\nf = open(0)\nN, K = [int(x) for x in f.readline().split()]\nA = np.fromstring(f.read(), dtype=int64, sep=\" \")\nans = solve(N, K, A)\nprint(ans)\n\"\"\"\n###nbacl nbmodule.py\nimport numpy as np\nfrom numpy import int64\nfrom numba import njit\nfrom numba.types import i8\nfrom numba.pycc import CC\nimport nbacl.segtree as seg\ncc = CC('my_module')\n@cc.export('solve', (i8, i8, i8[:]))\n@njit\ndef solve(N, K, A):\n dp = np.zeros(300_001, dtype=int64)\n d = seg.segtree(dp, max, 0)\n for i in range(N):\n x = seg.prod(d, max, (A[i] - K) if A[i] > K else 0, (A[i] + K + 1) if A[i] + K < 300_000 else 300_001) + 1\n seg.set(d, max, A[i], x)\n return seg.all_prod(d)\nif __name__ == '__main__':\n cc.compile()\n###nbacl nbacl\/segtree.py\nimport numpy as np\nfrom numba import njit\nfrom numba.types import i8\n@njit\ndef ceil_pow2(n):\n x = 0\n while (1 << x) < n:\n x += 1\n return x\n@njit\ndef segtree(a, op, e):\n log = ceil_pow2(a.shape[0])\n size = 1 << log\n d = np.empty(size * 2, dtype=a.dtype)\n d[size:size + len(a)] = a\n d[size + len(a):] = e\n # e\n d[0] = e\n for i in range(size - 1, 0, -1):\n update(d, i, op)\n return d\n@njit\ndef update(d, k, op):\n d[k] = op(d[2 * k], d[2 * k + 1])\n@njit\ndef set(d, op, p, x):\n p += d.shape[0] \/\/ 2\n d[p] = x\n while p > 1:\n p >>= 1\n update(d, p, op)\n@njit\ndef get(d, p):\n return d[p + d.shape[0] \/\/ 2]\n@njit\ndef prod(d, op, left, right):\n size = d.shape[0] \/\/ 2\n sml = d[0]\n smr = d[0]\n left += size\n right += size\n while left < right:\n if left & 1:\n sml = op(sml, d[left])\n left += 1\n if right & 1:\n right -= 1\n smr = op(d[right], smr)\n left >>= 1\n right >>= 1\n return op(sml, smr)\n@njit\ndef all_prod(d):\n return d[1]\n\"\"\"\n","code_v1_no_empty_lines":"import sys\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n import os\n import re\n\n with open(__file__) as f:\n source = f.read().split(\"###\" \"nbacl\")\n for s in source[1:]:\n s = re.sub(\"'''.*\", \"\", s)\n sp = s.split(maxsplit=1)\n if os.path.dirname(sp[0]):\n os.makedirs(os.path.dirname(sp[0]), exist_ok=True)\n with open(sp[0], \"w\") as f:\n f.write(sp[1])\n from nbmodule import cc\n\n cc.compile()\nimport numpy as np\nfrom numpy import int64\nfrom nbmodule import solve\n\nf = open(0)\nN, K = [int(x) for x in f.readline().split()]\nA = np.fromstring(f.read(), dtype=int64, sep=\" \")\nans = solve(N, K, A)\nprint(ans)\n\"\"\"\n###nbacl nbmodule.py\nimport numpy as np\nfrom numpy import int64\nfrom numba import njit\nfrom numba.types import i8\nfrom numba.pycc import CC\nimport nbacl.segtree as seg\ncc = CC('nbmodule')\n@cc.export('solve', (i8, i8, i8[:]))\n@njit\ndef solve(N, K, A):\n dp = np.zeros(300_001, dtype=int64)\n d = seg.segtree(dp, max, 0)\n for i in range(N):\n x = seg.prod(d, max, (A[i] - K) if A[i] > K else 0, (A[i] + K + 1) if A[i] + K < 300_000 else 300_001) + 1\n seg.set(d, max, A[i], x)\n return seg.all_prod(d)\nif __name__ == '__main__':\n cc.compile()\n###nbacl nbacl\/segtree.py\nimport numpy as np\nfrom numba import njit\nfrom numba.types import i8\n@njit\ndef ceil_pow2(n):\n x = 0\n while (1 << x) < n:\n x += 1\n return x\n@njit\ndef segtree(a, op, e):\n log = ceil_pow2(a.shape[0])\n size = 1 << log\n d = np.empty(size * 2, dtype=a.dtype)\n d[size:size + len(a)] = a\n d[size + len(a):] = e\n # e\n d[0] = e\n for i in range(size - 1, 0, -1):\n update(d, i, op)\n return d\n@njit\ndef update(d, k, op):\n d[k] = op(d[2 * k], d[2 * k + 1])\n@njit\ndef set(d, op, p, x):\n p += d.shape[0] \/\/ 2\n d[p] = x\n while p > 1:\n p >>= 1\n update(d, p, op)\n@njit\ndef get(d, p):\n return d[p + d.shape[0] \/\/ 2]\n@njit\ndef prod(d, op, left, right):\n size = d.shape[0] \/\/ 2\n sml = d[0]\n smr = d[0]\n left += size\n right += size\n while left < right:\n if left & 1:\n sml = op(sml, d[left])\n left += 1\n if right & 1:\n right -= 1\n smr = op(d[right], smr)\n left >>= 1\n right >>= 1\n return op(sml, smr)\n@njit\ndef all_prod(d):\n return d[1]\n\"\"\"\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-cc = CC('my_module')","+cc = CC('nbmodule')"],"diff_only_import_comment":false,"measured_runtime_v0":2.061239439,"measured_runtime_v1":1.5234250698,"runtime_lift":1.3530297485,"key":["s641106335","s059113462"]} +{"user_id":"u312025627","problem_id":"p03457","language":"python","submission_id_v0":"s103328073","submission_id_v1":"s130173321","cpu_time_v0":250,"cpu_time_v1":183,"memory_v0":55644,"memory_v1":21108,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.8,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time, px, py = 0, 0, 0\n\n for t, x, y in TXY:\n\n move = abs(x-px) + abs(y-py)\n\n # print(move, t-time)\n\n if (t - time) % 2 != move % 2 or t - time < move:\n\n return print(\"No\")\n\n time, px, py = t, x, y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time = 0\n\n px = 0\n\n py = 0\n\n for t, x, y in TXY:\n\n move = abs(py-y) + abs(px - x)\n\n if (t-time) < move or (t - time) % 2 != move % 2:\n\n return print(\"No\")\n\n time = t\n\n px = x\n\n py = y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":17,"code_v1_loc":20,"code_v0_num_chars":461,"code_v1_num_chars":460,"code_v0_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.buffer.readline\n N = int(input())\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n time, px, py = 0, 0, 0\n for t, x, y in TXY:\n move = abs(x - px) + abs(y - py)\n # print(move, t-time)\n if (t - time) % 2 != move % 2 or t - time < move:\n return print(\"No\")\n time, px, py = t, x, y\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.buffer.readline\n N = int(input())\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n time = 0\n px = 0\n py = 0\n for t, x, y in TXY:\n move = abs(py - y) + abs(px - x)\n if (t - time) < move or (t - time) % 2 != move % 2:\n return print(\"No\")\n time = t\n px = x\n py = y\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["- time, px, py = 0, 0, 0","+ time = 0","+ px = 0","+ py = 0","- move = abs(x - px) + abs(y - py)","- # print(move, t-time)","- if (t - time) % 2 != move % 2 or t - time < move:","+ move = abs(py - y) + abs(px - x)","+ if (t - time) < move or (t - time) % 2 != move % 2:","- time, px, py = t, x, y","+ time = t","+ px = x","+ py = y"],"diff_only_import_comment":false,"measured_runtime_v0":0.3387642326,"measured_runtime_v1":0.1945750663,"runtime_lift":1.7410464712,"key":["s103328073","s130173321"]} +{"user_id":"u102461423","problem_id":"p02624","language":"python","submission_id_v0":"s575776489","submission_id_v1":"s814917437","cpu_time_v0":1604,"cpu_time_v1":222,"memory_v0":105124,"memory_v1":26992,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\ndef main(N):\n\n div = np.zeros(N+1, np.int64)\n\n for n in range(1, N+1):\n\n for m in range(n, N+1, n):\n\n div[m] += m\n\n return div.sum()\n\n\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n import numba\n\n from numba.pycc import CC\n\n i8 = numba.int64\n\n cc = CC('my_module')\n\n\n\n def cc_export(f, signature):\n\n cc.export(f.__name__, signature)(f)\n\n return numba.njit(f)\n\n\n\n main = cc_export(main, (i8, ))\n\n cc.compile()\n\n\n\nfrom my_module import main\n\n\n\nN = int(read())\n\nprint((main(N)))\n\n\n# optimized version of the same code:\n","target":"import sys\n\nimport numpy as np\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\ndef main(N):\n\n x = 0\n\n for a in range(1, N+1):\n\n for b in range(1, N\/\/a+1):\n\n x += a*b\n\n return x\n\n\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n import numba\n\n from numba.pycc import CC\n\n i8 = numba.int64\n\n cc = CC('my_module')\n\n\n\n def cc_export(f, signature):\n\n cc.export(f.__name__, signature)(f)\n\n return numba.njit(f)\n\n\n\n main = cc_export(main, (i8, ))\n\n cc.compile()\n\n\n\nfrom my_module import main\n\n\n\nN = int(read())\n\nprint((main(N)))\n","code_v0_loc":31,"code_v1_loc":31,"code_v0_num_chars":665,"code_v1_num_chars":636,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\ndef main(N):\n div = np.zeros(N + 1, np.int64)\n for n in range(1, N + 1):\n for m in range(n, N + 1, n):\n div[m] += m\n return div.sum()\n\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n import numba\n from numba.pycc import CC\n\n i8 = numba.int64\n cc = CC(\"my_module\")\n\n def cc_export(f, signature):\n cc.export(f.__name__, signature)(f)\n return numba.njit(f)\n\n main = cc_export(main, (i8,))\n cc.compile()\nfrom my_module import main\n\nN = int(read())\nprint((main(N)))\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\ndef main(N):\n x = 0\n for a in range(1, N + 1):\n for b in range(1, N \/\/ a + 1):\n x += a * b\n return x\n\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n import numba\n from numba.pycc import CC\n\n i8 = numba.int64\n cc = CC(\"my_module\")\n\n def cc_export(f, signature):\n cc.export(f.__name__, signature)(f)\n return numba.njit(f)\n\n main = cc_export(main, (i8,))\n cc.compile()\nfrom my_module import main\n\nN = int(read())\nprint((main(N)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- div = np.zeros(N + 1, np.int64)","- for n in range(1, N + 1):","- for m in range(n, N + 1, n):","- div[m] += m","- return div.sum()","+ x = 0","+ for a in range(1, N + 1):","+ for b in range(1, N \/\/ a + 1):","+ x += a * b","+ return x"],"diff_only_import_comment":false,"measured_runtime_v0":1.5076009564,"measured_runtime_v1":0.2714631007,"runtime_lift":5.5536128212,"key":["s575776489","s814917437"]} +{"user_id":"u683134447","problem_id":"p03309","language":"python","submission_id_v0":"s609480946","submission_id_v1":"s469579435","cpu_time_v0":529,"cpu_time_v1":230,"memory_v0":34168,"memory_v1":27248,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn = int(eval(input()))\n\nal = list(map(int,input().split()))\n\n\n\nfor i in range(n):\n\n al[i] -= i + 1\n\n\n\nmed = np.median(np.array(al))\n\n\n\nans = 0\n\nfor a in al:\n\n ans += abs(a-med)\n\nprint((int(ans)))\n\n# optimized version of the same code:\n","target":"import statistics\n\nn = int(eval(input()))\n\nal = list(map(int,input().split()))\n\n\n\nfor i in range(n):\n\n al[i] -= i + 1\n\n\n\nmedian = statistics.median(al)\n\n\n\nans = 0\n\nfor a in al:\n\n ans += abs(median - a)\n\n\n\nprint((int(ans)))\n","code_v0_loc":13,"code_v1_loc":14,"code_v0_num_chars":213,"code_v1_num_chars":221,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nal = list(map(int, input().split()))\nfor i in range(n):\n al[i] -= i + 1\nmed = np.median(np.array(al))\nans = 0\nfor a in al:\n ans += abs(a - med)\nprint((int(ans)))\n","code_v1_no_empty_lines":"import statistics\n\nn = int(eval(input()))\nal = list(map(int, input().split()))\nfor i in range(n):\n al[i] -= i + 1\nmedian = statistics.median(al)\nans = 0\nfor a in al:\n ans += abs(median - a)\nprint((int(ans)))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-import numpy as np","+import statistics","-med = np.median(np.array(al))","+median = statistics.median(al)","- ans += abs(a - med)","+ ans += abs(median - a)"],"diff_only_import_comment":false,"measured_runtime_v0":1.7668625765,"measured_runtime_v1":0.4307871597,"runtime_lift":4.1014745605,"key":["s609480946","s469579435"]} +{"user_id":"u404676457","problem_id":"p03287","language":"python","submission_id_v0":"s015457447","submission_id_v1":"s379753461","cpu_time_v0":295,"cpu_time_v1":119,"memory_v0":23108,"memory_v1":14224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.66,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n(n, m) = list(map(int, input().split()))\n\na = np.array(list(map(int, input().split()))).astype(\"int64\") \n\na = np.cumsum(a)\n\na %= m\n\ncount = np.sum(a == 0)\n\na.sort()\n\ntc = 1\n\nfor i in range(1, n):\n\n if a[i - 1] == a[i]:\n\n tc += 1\n\n else:\n\n count += tc * (tc - 1) \/\/ 2\n\n tc = 1\n\nelse:\n\n count += tc * (tc - 1) \/\/ 2\n\nprint(count)\n\n# optimized version of the same code:\n","target":"(n, m) = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nunique_a = {a[0] % m: 1}\n\nfor i in range(1, n):\n\n a[i] += a[i - 1]\n\n a[i] %= m\n\n if a[i] in unique_a:\n\n unique_a[a[i]] += 1\n\n else:\n\n unique_a[a[i]] = 1\n\ncount = 0\n\nif 0 in unique_a:\n\n count += unique_a[0]\n\nfor k in unique_a:\n\n count += unique_a[k] * (unique_a[k] - 1) \/\/ 2\n\nprint(count)","code_v0_loc":17,"code_v1_loc":16,"code_v0_num_chars":376,"code_v1_num_chars":398,"code_v0_no_empty_lines":"import numpy as np\n\n(n, m) = list(map(int, input().split()))\na = np.array(list(map(int, input().split()))).astype(\"int64\")\na = np.cumsum(a)\na %= m\ncount = np.sum(a == 0)\na.sort()\ntc = 1\nfor i in range(1, n):\n if a[i - 1] == a[i]:\n tc += 1\n else:\n count += tc * (tc - 1) \/\/ 2\n tc = 1\nelse:\n count += tc * (tc - 1) \/\/ 2\nprint(count)\n","code_v1_no_empty_lines":"(n, m) = list(map(int, input().split()))\na = list(map(int, input().split()))\nunique_a = {a[0] % m: 1}\nfor i in range(1, n):\n a[i] += a[i - 1]\n a[i] %= m\n if a[i] in unique_a:\n unique_a[a[i]] += 1\n else:\n unique_a[a[i]] = 1\ncount = 0\nif 0 in unique_a:\n count += unique_a[0]\nfor k in unique_a:\n count += unique_a[k] * (unique_a[k] - 1) \/\/ 2\nprint(count)\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-import numpy as np","-","-a = np.array(list(map(int, input().split()))).astype(\"int64\")","-a = np.cumsum(a)","-a %= m","-count = np.sum(a == 0)","-a.sort()","-tc = 1","+a = list(map(int, input().split()))","+unique_a = {a[0] % m: 1}","- if a[i - 1] == a[i]:","- tc += 1","+ a[i] += a[i - 1]","+ a[i] %= m","+ if a[i] in unique_a:","+ unique_a[a[i]] += 1","- count += tc * (tc - 1) \/\/ 2","- tc = 1","-else:","- count += tc * (tc - 1) \/\/ 2","+ unique_a[a[i]] = 1","+count = 0","+if 0 in unique_a:","+ count += unique_a[0]","+for k in unique_a:","+ count += unique_a[k] * (unique_a[k] - 1) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":1.3542102392,"measured_runtime_v1":0.1979701376,"runtime_lift":6.8404773343,"key":["s015457447","s379753461"]} +{"user_id":"u080364835","problem_id":"p03273","language":"python","submission_id_v0":"s686787991","submission_id_v1":"s327798112","cpu_time_v0":165,"cpu_time_v1":27,"memory_v0":13912,"memory_v1":4468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nh, w = map(int, input().split())\n\nal = list(list(input()) for _ in range(h))\n\nal_n = np.array(al)\n\nrow = [0]*w\n\ncol = [0]*h\n\nfor i in range(h):\n\n for j in range(w):\n\n if al_n[i][j] == '.':\n\n row[j] += 1\n\n col[i] += 1\n\nrow_ = []\n\ncol_ = []\n\nfor i in range(w):\n\n if row[i] == h:\n\n row_.append(i)\n\n\n\nfor j in range(h):\n\n if col[j] == w:\n\n col_.append(j)\n\n\n\nif len(col_) > 0:\n\n al_n = np.delete(al_n, col_, axis=0)\n\n\n\nif len(row_) > 0:\n\n al_n = np.delete(al_n, row_, axis=1)\n\n\n\nfor a in al_n:\n\n print(*a, sep='')\n\n\n# optimized version of the same code:\n","target":"h, w = map(int, input().split())\n\nal = list(list(input()) for _ in range(h))\n\nrow = [0]*w\n\ncol = [0]*h\n\n\n\nfor i in range(h):\n\n for j in range(w):\n\n if al[i][j] == '#':\n\n col[i] += 1\n\n row[j] += 1\n\nans = []\n\nw_len = len(row) - row.count(0)\n\nfor i in range(h):\n\n tmp = ''\n\n if col[i] != 0:\n\n for j in range(w):\n\n if row[j] != 0:\n\n tmp += al[i][j]\n\n ans.append(tmp)\n\n\n\nfor a in ans:\n\n print(*a, sep='')\n","code_v0_loc":30,"code_v1_loc":22,"code_v0_num_chars":591,"code_v1_num_chars":480,"code_v0_no_empty_lines":"import numpy as np\n\nh, w = map(int, input().split())\nal = list(list(input()) for _ in range(h))\nal_n = np.array(al)\nrow = [0] * w\ncol = [0] * h\nfor i in range(h):\n for j in range(w):\n if al_n[i][j] == \".\":\n row[j] += 1\n col[i] += 1\nrow_ = []\ncol_ = []\nfor i in range(w):\n if row[i] == h:\n row_.append(i)\nfor j in range(h):\n if col[j] == w:\n col_.append(j)\nif len(col_) > 0:\n al_n = np.delete(al_n, col_, axis=0)\nif len(row_) > 0:\n al_n = np.delete(al_n, row_, axis=1)\nfor a in al_n:\n print(*a, sep=\"\")\n","code_v1_no_empty_lines":"h, w = map(int, input().split())\nal = list(list(input()) for _ in range(h))\nrow = [0] * w\ncol = [0] * h\nfor i in range(h):\n for j in range(w):\n if al[i][j] == \"#\":\n col[i] += 1\n row[j] += 1\nans = []\nw_len = len(row) - row.count(0)\nfor i in range(h):\n tmp = \"\"\n if col[i] != 0:\n for j in range(w):\n if row[j] != 0:\n tmp += al[i][j]\n ans.append(tmp)\nfor a in ans:\n print(*a, sep=\"\")\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["-import numpy as np","-","-al_n = np.array(al)","- if al_n[i][j] == \".\":","+ if al[i][j] == \"#\":","+ col[i] += 1","- col[i] += 1","-row_ = []","-col_ = []","-for i in range(w):","- if row[i] == h:","- row_.append(i)","-for j in range(h):","- if col[j] == w:","- col_.append(j)","-if len(col_) > 0:","- al_n = np.delete(al_n, col_, axis=0)","-if len(row_) > 0:","- al_n = np.delete(al_n, row_, axis=1)","-for a in al_n:","+ans = []","+w_len = len(row) - row.count(0)","+for i in range(h):","+ tmp = \"\"","+ if col[i] != 0:","+ for j in range(w):","+ if row[j] != 0:","+ tmp += al[i][j]","+ ans.append(tmp)","+for a in ans:"],"diff_only_import_comment":false,"measured_runtime_v0":0.7321008713,"measured_runtime_v1":0.1549179929,"runtime_lift":4.7257317083,"key":["s686787991","s327798112"]} +{"user_id":"u637175065","problem_id":"p03553","language":"python","submission_id_v0":"s305170925","submission_id_v1":"s833575440","cpu_time_v0":88,"cpu_time_v1":46,"memory_v0":7240,"memory_v1":10956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf = 10**20\n\neps = 1.0 \/ 10**15\n\nmod = 10**9+7\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef F(): return float(sys.stdin.readline())\n\ndef S(): return input()\n\ndef pf(s): return print(s, flush=True)\n\ndef divisions(n):\n\n sq = int(math.sqrt(n)+1)\n\n d = collections.defaultdict(int)\n\n while n % 2 == 0:\n\n n \/\/= 2\n\n d[2] += 1\n\n i = 3\n\n while n > 1 and sq >= i:\n\n if n % i == 0:\n\n n \/\/= i\n\n d[i] += 1\n\n else:\n\n i += 2\n\n\n\n if n > 1:\n\n d[n] += 1\n\n\n\n r = [1]\n\n for k, v in d.items():\n\n for c in r[:]:\n\n for i in range(1,v+1):\n\n r.append(c*(k**i))\n\n\n\n return sorted(r)\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n s = set()\n\n for i in range(n,0,-1):\n\n d = divisions(i)\n\n ld = len(d)\n\n for j in range(1,2**ld):\n\n c = []\n\n ff = True\n\n for k in range(ld):\n\n if j & (1< 0:\n\n e[c][i] -= k\n\n e[i][c] += k\n\n return k\n\n return 0\n\n\n\n while True:\n\n self.v = [None] * self.N\n\n fs = f(s, inf)\n\n if fs == 0:\n\n break\n\n r += fs\n\n\n\n return r\n\n\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n\n\n s = n\n\n t = n + 1\n\n e = [[0] * (n+2) for _ in range(n+2)]\n\n for i in range(n):\n\n c = a[i]\n\n if c < 0:\n\n e[s][i] = -c\n\n ii = i + 1\n\n for j in range(ii*2, n+1, ii):\n\n e[i][j-1] = inf\n\n else:\n\n e[i][t] = c\n\n\n\n\n\n fl = Flow(e, n+2)\n\n r = fl.max_flow(s,t)\n\n\n\n return sum(map(lambda x: max(0,x), a)) - r\n\n\n\n# start = time.time()\n\nprint(main())\n\n# pe(time.time() - start)\n\n\n\n\n\n\n","code_v0_loc":92,"code_v1_loc":89,"code_v0_num_chars":2351,"code_v1_num_chars":2252,"code_v0_no_empty_lines":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 \/ 10**15\nmod = 10**9 + 7\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef F():\n return float(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\ndef pf(s):\n return print(s, flush=True)\n\n\ndef divisions(n):\n sq = int(math.sqrt(n) + 1)\n d = collections.defaultdict(int)\n while n % 2 == 0:\n n \/\/= 2\n d[2] += 1\n i = 3\n while n > 1 and sq >= i:\n if n % i == 0:\n n \/\/= i\n d[i] += 1\n else:\n i += 2\n if n > 1:\n d[n] += 1\n r = [1]\n for k, v in d.items():\n for c in r[:]:\n for i in range(1, v + 1):\n r.append(c * (k**i))\n return sorted(r)\n\n\ndef main():\n n = I()\n a = LI()\n s = set()\n for i in range(n, 0, -1):\n d = divisions(i)\n ld = len(d)\n for j in range(1, 2**ld):\n c = []\n ff = True\n for k in range(ld):\n if j & (1 << k):\n f = True\n for e in c:\n if d[k] % e == 0:\n f = False\n ff = False\n break\n if f:\n c.append(d[k])\n if not ff:\n break\n if ff:\n s.add(tuple(c + [n + 1]))\n b = sorted(list(s), reverse=True)\n for c in b:\n t = 0\n for j in range(1, n + 1):\n f = False\n for e in c:\n if j % e == 0:\n f = True\n break\n if f:\n t += a[j - 1]\n if t < 0:\n for j in range(1, n + 1):\n f = False\n for e in c:\n if j % e == 0:\n f = True\n break\n if f:\n a[j - 1] = 0\n return sum(a)\n\n\nprint(main())\n","code_v1_no_empty_lines":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools\nimport time, random\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 \/ 10**10\nmod = 10**9 + 7\nmod2 = 998244353\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LLI():\n return [list(map(int, l.split())) for l in sys.stdin.readlines()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef F():\n return float(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\ndef pf(s):\n return print(s, flush=True)\n\n\ndef pe(s):\n return print(str(s), file=sys.stderr)\n\n\ndef JA(a, sep):\n return sep.join(map(str, a))\n\n\ndef JAA(a, s, t):\n return s.join(t.join(map(str, b)) for b in a)\n\n\nclass Flow:\n def __init__(self, e, N):\n self.E = e\n self.N = N\n\n def max_flow(self, s, t):\n r = 0\n e = self.E\n\n def f(c, cap):\n v = self.v\n v[c] = 1\n if c == t:\n return cap\n for i in range(self.N):\n if v[i] or e[c][i] <= 0:\n continue\n cp = min(cap, e[c][i])\n k = f(i, cp)\n if k > 0:\n e[c][i] -= k\n e[i][c] += k\n return k\n return 0\n\n while True:\n self.v = [None] * self.N\n fs = f(s, inf)\n if fs == 0:\n break\n r += fs\n return r\n\n\ndef main():\n n = I()\n a = LI()\n s = n\n t = n + 1\n e = [[0] * (n + 2) for _ in range(n + 2)]\n for i in range(n):\n c = a[i]\n if c < 0:\n e[s][i] = -c\n ii = i + 1\n for j in range(ii * 2, n + 1, ii):\n e[i][j - 1] = inf\n else:\n e[i][t] = c\n fl = Flow(e, n + 2)\n r = fl.max_flow(s, t)\n return sum(map(lambda x: max(0, x), a)) - r\n\n\n# start = time.time()\nprint(main())\n# pe(time.time() - start)\n","code_same":false,"relative_loc_diff_percent":3.2608695652,"diff":["-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools","+import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools","+import time, random","-eps = 1.0 \/ 10**15","+eps = 1.0 \/ 10**10","+mod2 = 998244353","+dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]","+ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]","- return [int(x) for x in sys.stdin.readline().split()]","+ return list(map(int, sys.stdin.readline().split()))","+","+","+def LLI():","+ return [list(map(int, l.split())) for l in sys.stdin.readlines()]","-def divisions(n):","- sq = int(math.sqrt(n) + 1)","- d = collections.defaultdict(int)","- while n % 2 == 0:","- n \/\/= 2","- d[2] += 1","- i = 3","- while n > 1 and sq >= i:","- if n % i == 0:","- n \/\/= i","- d[i] += 1","- else:","- i += 2","- if n > 1:","- d[n] += 1","- r = [1]","- for k, v in d.items():","- for c in r[:]:","- for i in range(1, v + 1):","- r.append(c * (k**i))","- return sorted(r)","+def pe(s):","+ return print(str(s), file=sys.stderr)","+","+","+def JA(a, sep):","+ return sep.join(map(str, a))","+","+","+def JAA(a, s, t):","+ return s.join(t.join(map(str, b)) for b in a)","+","+","+class Flow:","+ def __init__(self, e, N):","+ self.E = e","+ self.N = N","+","+ def max_flow(self, s, t):","+ r = 0","+ e = self.E","+","+ def f(c, cap):","+ v = self.v","+ v[c] = 1","+ if c == t:","+ return cap","+ for i in range(self.N):","+ if v[i] or e[c][i] <= 0:","+ continue","+ cp = min(cap, e[c][i])","+ k = f(i, cp)","+ if k > 0:","+ e[c][i] -= k","+ e[i][c] += k","+ return k","+ return 0","+","+ while True:","+ self.v = [None] * self.N","+ fs = f(s, inf)","+ if fs == 0:","+ break","+ r += fs","+ return r","- s = set()","- for i in range(n, 0, -1):","- d = divisions(i)","- ld = len(d)","- for j in range(1, 2**ld):","- c = []","- ff = True","- for k in range(ld):","- if j & (1 << k):","- f = True","- for e in c:","- if d[k] % e == 0:","- f = False","- ff = False","- break","- if f:","- c.append(d[k])","- if not ff:","- break","- if ff:","- s.add(tuple(c + [n + 1]))","- b = sorted(list(s), reverse=True)","- for c in b:","- t = 0","- for j in range(1, n + 1):","- f = False","- for e in c:","- if j % e == 0:","- f = True","- break","- if f:","- t += a[j - 1]","- if t < 0:","- for j in range(1, n + 1):","- f = False","- for e in c:","- if j % e == 0:","- f = True","- break","- if f:","- a[j - 1] = 0","- return sum(a)","+ s = n","+ t = n + 1","+ e = [[0] * (n + 2) for _ in range(n + 2)]","+ for i in range(n):","+ c = a[i]","+ if c < 0:","+ e[s][i] = -c","+ ii = i + 1","+ for j in range(ii * 2, n + 1, ii):","+ e[i][j - 1] = inf","+ else:","+ e[i][t] = c","+ fl = Flow(e, n + 2)","+ r = fl.max_flow(s, t)","+ return sum(map(lambda x: max(0, x), a)) - r","+# start = time.time()","+# pe(time.time() - start)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2170818343,"measured_runtime_v1":0.0062613072,"runtime_lift":34.670369248,"key":["s305170925","s833575440"]} +{"user_id":"u096128910","problem_id":"p02881","language":"python","submission_id_v0":"s987616882","submission_id_v1":"s695744152","cpu_time_v0":126,"cpu_time_v1":81,"memory_v0":66508,"memory_v1":64160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nans = N - 1\n\np = 1\n\nfor i in range(2, int((N ** 0.5) + 1)):\n\n if p % 2 == 1 and i > (N ** 0.5):\n\n break\n\n if N % i == 0:\n\n p = i\n\n j = N \/\/ i\n\n m = i + j - 2\n\n if m < ans:\n\n ans = m\n\n else:\n\n continue\n\n else:\n\n continue\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nans = N - 1\n\nfor i in range(2, int((N ** 0.5) + 1)):\n\n if N % i == 0:\n\n j = N \/\/ i\n\n m = i + j - 2\n\n ans = min(ans, m)\n\nprint(ans)\n","code_v0_loc":17,"code_v1_loc":8,"code_v0_num_chars":330,"code_v1_num_chars":173,"code_v0_no_empty_lines":"N = int(eval(input()))\nans = N - 1\np = 1\nfor i in range(2, int((N**0.5) + 1)):\n if p % 2 == 1 and i > (N**0.5):\n break\n if N % i == 0:\n p = i\n j = N \/\/ i\n m = i + j - 2\n if m < ans:\n ans = m\n else:\n continue\n else:\n continue\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nans = N - 1\nfor i in range(2, int((N**0.5) + 1)):\n if N % i == 0:\n j = N \/\/ i\n m = i + j - 2\n ans = min(ans, m)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":52.9411764706,"diff":["-p = 1","- if p % 2 == 1 and i > (N**0.5):","- break","- p = i","- if m < ans:","- ans = m","- else:","- continue","- else:","- continue","+ ans = min(ans, m)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3775834899,"measured_runtime_v1":0.2214011464,"runtime_lift":1.7054269863,"key":["s987616882","s695744152"]} +{"user_id":"u408071652","problem_id":"p03078","language":"python","submission_id_v0":"s229462844","submission_id_v1":"s240353408","cpu_time_v0":159,"cpu_time_v1":114,"memory_v0":72796,"memory_v1":80804,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.3,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport heapq\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n Q = []\n\n S = set()\n\n heapq.heapify(Q)\n\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n\n for i in range(K):\n\n m, a, b, c = heapq.heappop(Q)\n\n print((-m))\n\n if (a + 1, b, c) not in S and a + 1 < X:\n\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n\n S.add((a + 1, b, c))\n\n if (a, b + 1, c) not in S and b + 1 < Y:\n\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n\n S.add((a, b + 1, c))\n\n if (a, b, c + 1) not in S and c + 1 < Z:\n\n heapq.heappush(Q, (-A[a ] - B[b] - C[c+1], a, b, c + 1))\n\n S.add((a, b, c + 1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n L = []\n\n\n\n for i in range(X):\n\n for j in range(min(Y, K \/\/ (i + 1) + 1)):\n\n for k in range(min(Z, K \/\/ (i + 1) \/\/ (j + 1) + 1)):\n\n L.append(A[i] + B[j] + C[k])\n\n\n\n L.sort(reverse=True)\n\n\n\n for i in range(K):\n\n print((L[i]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":39,"code_v1_loc":33,"code_v0_num_chars":1051,"code_v1_num_chars":663,"code_v0_no_empty_lines":"import sys\nimport heapq\n\n# \\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n X, Y, Z, K = list(map(int, input().split()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n C = list(map(int, input().split()))\n A.sort(reverse=True)\n B.sort(reverse=True)\n C.sort(reverse=True)\n Q = []\n S = set()\n heapq.heapify(Q)\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n for i in range(K):\n m, a, b, c = heapq.heappop(Q)\n print((-m))\n if (a + 1, b, c) not in S and a + 1 < X:\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n S.add((a + 1, b, c))\n if (a, b + 1, c) not in S and b + 1 < Y:\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n S.add((a, b + 1, c))\n if (a, b, c + 1) not in S and c + 1 < Z:\n heapq.heappush(Q, (-A[a] - B[b] - C[c + 1], a, b, c + 1))\n S.add((a, b, c + 1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n# \\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n X, Y, Z, K = list(map(int, input().split()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n C = list(map(int, input().split()))\n A.sort(reverse=True)\n B.sort(reverse=True)\n C.sort(reverse=True)\n L = []\n for i in range(X):\n for j in range(min(Y, K \/\/ (i + 1) + 1)):\n for k in range(min(Z, K \/\/ (i + 1) \/\/ (j + 1) + 1)):\n L.append(A[i] + B[j] + C[k])\n L.sort(reverse=True)\n for i in range(K):\n print((L[i]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-import heapq","- Q = []","- S = set()","- heapq.heapify(Q)","- heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))","+ L = []","+ for i in range(X):","+ for j in range(min(Y, K \/\/ (i + 1) + 1)):","+ for k in range(min(Z, K \/\/ (i + 1) \/\/ (j + 1) + 1)):","+ L.append(A[i] + B[j] + C[k])","+ L.sort(reverse=True)","- m, a, b, c = heapq.heappop(Q)","- print((-m))","- if (a + 1, b, c) not in S and a + 1 < X:","- heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))","- S.add((a + 1, b, c))","- if (a, b + 1, c) not in S and b + 1 < Y:","- heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))","- S.add((a, b + 1, c))","- if (a, b, c + 1) not in S and c + 1 < Z:","- heapq.heappush(Q, (-A[a] - B[b] - C[c + 1], a, b, c + 1))","- S.add((a, b, c + 1))","+ print((L[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3053240893,"measured_runtime_v1":0.1252524042,"runtime_lift":2.4376704877,"key":["s229462844","s240353408"]} +{"user_id":"u599547273","problem_id":"p03494","language":"python","submission_id_v0":"s252753387","submission_id_v1":"s505612116","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef two_count(x):\n\n\tif int(str(x)[-1]) % 2 == 0:\n\n\t\treturn 1 + two_count(x\/\/2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(eval(input()))\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))\n\n# optimized version of the same code:\n","target":"def two_count(x):\n\n\tif x % 2 == 0:\n\n\t\treturn 1 + two_count(x\/\/2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(eval(input()))\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":250,"code_v1_num_chars":236,"code_v0_no_empty_lines":"def two_count(x):\n if int(str(x)[-1]) % 2 == 0:\n return 1 + two_count(x \/\/ 2)\n else:\n return 0\n\n\nn = int(eval(input()))\nn_list = [int(n) for n in input().split(\" \")]\nn_two_count_list = [two_count(n) for n in n_list]\nprint((min(n_two_count_list)))\n","code_v1_no_empty_lines":"def two_count(x):\n if x % 2 == 0:\n return 1 + two_count(x \/\/ 2)\n else:\n return 0\n\n\nn = int(eval(input()))\nn_list = [int(n) for n in input().split(\" \")]\nn_two_count_list = [two_count(n) for n in n_list]\nprint((min(n_two_count_list)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if int(str(x)[-1]) % 2 == 0:","+ if x % 2 == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3392717605,"measured_runtime_v1":0.2706325946,"runtime_lift":1.2536249042,"key":["s252753387","s505612116"]} +{"user_id":"u648881683","problem_id":"p02814","language":"python","submission_id_v0":"s824836675","submission_id_v1":"s558243892","cpu_time_v0":799,"cpu_time_v1":244,"memory_v0":24192,"memory_v1":16272,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.46,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom functools import reduce\n\nimport fractions\n\nimport numpy as np\n\n\n\nN, M = list(map(int, input().split()))\n\na = np.array(list(map(int, input().split())))\n\n\n\na = a \/\/ 2\n\n\n\ndef lcm_base(x, y):\n\n return (x * y) \/\/ fractions.gcd(x, y)\n\n\n\ndef lcm(*numbers):\n\n return reduce(lcm_base, numbers, 1)\n\n\n\nl = lcm(*a)\n\nexist = not 0 in ((l\/\/a)%2)\n\n\n\nif exist:\n\n print(((M \/\/ l + 1 ) \/\/ 2))\n\nelse:\n\n print((0))\n\n# optimized version of the same code:\n","target":"import sys, fractions, functools\n\ninput = lambda: sys.stdin.readline().rstrip() \n\nsys.setrecursionlimit(10**7)\n\nINF = 10**20\n\ndef I(): return int(eval(input()))\n\ndef F(): return float(eval(input()))\n\ndef S(): return eval(input())\n\ndef LI(): return [int(x) for x in input().split()]\n\ndef LI_(): return [int(x)-1 for x in input().split()]\n\ndef LF(): return [float(x) for x in input().split()]\n\ndef LS(): return input().split()\n\n\n\ndef lcm_base(x, y):\n\n return (x * y) \/\/ fractions.gcd(x, y)\n\n\n\ndef lcm_list(numbers):\n\n return functools.reduce(lcm_base, numbers, 1)\n\n\n\ndef resolve():\n\n N, M = LI()\n\n a = LI()\n\n\n\n a_half = [i\/\/2 for i in a]\n\n a_half_lcm = lcm_list(a_half)\n\n has_scm = not 0 in [a_half_lcm\/\/i%2 for i in a_half]\n\n\n\n if has_scm:\n\n print(((M-a_half_lcm)\/\/(2*a_half_lcm)+1))\n\n else:\n\n print((0))\n\n\n\nif __name__ == '__main__':\n\n resolve()","code_v0_loc":22,"code_v1_loc":33,"code_v0_num_chars":401,"code_v1_num_chars":867,"code_v0_no_empty_lines":"from functools import reduce\nimport fractions\nimport numpy as np\n\nN, M = list(map(int, input().split()))\na = np.array(list(map(int, input().split())))\na = a \/\/ 2\n\n\ndef lcm_base(x, y):\n return (x * y) \/\/ fractions.gcd(x, y)\n\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\n\nl = lcm(*a)\nexist = not 0 in ((l \/\/ a) % 2)\nif exist:\n print(((M \/\/ l + 1) \/\/ 2))\nelse:\n print((0))\n","code_v1_no_empty_lines":"import sys, fractions, functools\n\ninput = lambda: sys.stdin.readline().rstrip()\nsys.setrecursionlimit(10**7)\nINF = 10**20\n\n\ndef I():\n return int(eval(input()))\n\n\ndef F():\n return float(eval(input()))\n\n\ndef S():\n return eval(input())\n\n\ndef LI():\n return [int(x) for x in input().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in input().split()]\n\n\ndef LF():\n return [float(x) for x in input().split()]\n\n\ndef LS():\n return input().split()\n\n\ndef lcm_base(x, y):\n return (x * y) \/\/ fractions.gcd(x, y)\n\n\ndef lcm_list(numbers):\n return functools.reduce(lcm_base, numbers, 1)\n\n\ndef resolve():\n N, M = LI()\n a = LI()\n a_half = [i \/\/ 2 for i in a]\n a_half_lcm = lcm_list(a_half)\n has_scm = not 0 in [a_half_lcm \/\/ i % 2 for i in a_half]\n if has_scm:\n print(((M - a_half_lcm) \/\/ (2 * a_half_lcm) + 1))\n else:\n print((0))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-from functools import reduce","-import fractions","-import numpy as np","+import sys, fractions, functools","-N, M = list(map(int, input().split()))","-a = np.array(list(map(int, input().split())))","-a = a \/\/ 2","+input = lambda: sys.stdin.readline().rstrip()","+sys.setrecursionlimit(10**7)","+INF = 10**20","+","+","+def I():","+ return int(eval(input()))","+","+","+def F():","+ return float(eval(input()))","+","+","+def S():","+ return eval(input())","+","+","+def LI():","+ return [int(x) for x in input().split()]","+","+","+def LI_():","+ return [int(x) - 1 for x in input().split()]","+","+","+def LF():","+ return [float(x) for x in input().split()]","+","+","+def LS():","+ return input().split()","-def lcm(*numbers):","- return reduce(lcm_base, numbers, 1)","+def lcm_list(numbers):","+ return functools.reduce(lcm_base, numbers, 1)","-l = lcm(*a)","-exist = not 0 in ((l \/\/ a) % 2)","-if exist:","- print(((M \/\/ l + 1) \/\/ 2))","-else:","- print((0))","+def resolve():","+ N, M = LI()","+ a = LI()","+ a_half = [i \/\/ 2 for i in a]","+ a_half_lcm = lcm_list(a_half)","+ has_scm = not 0 in [a_half_lcm \/\/ i % 2 for i in a_half]","+ if has_scm:","+ print(((M - a_half_lcm) \/\/ (2 * a_half_lcm) + 1))","+ else:","+ print((0))","+","+","+if __name__ == \"__main__\":","+ resolve()"],"diff_only_import_comment":false,"measured_runtime_v0":1.2936481755,"measured_runtime_v1":0.2801775889,"runtime_lift":4.6172435859,"key":["s824836675","s558243892"]} +{"user_id":"u260216890","problem_id":"p02883","language":"python","submission_id_v0":"s662154758","submission_id_v1":"s660978012","cpu_time_v0":569,"cpu_time_v1":344,"memory_v0":43644,"memory_v1":122364,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.54,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN, K= list(map(int, input().split()))\n\nA=[int(i) for i in input().split()]\n\nF=[int(i) for i in input().split()]\n\n\n\nA=np.array(sorted(A, reverse=True))\n\nF=np.array(sorted(F))\n\n\n\nlower_bound=0\n\nupper_bound=np.max(A*F)\n\nK_tmp=0\n\n\n\nwhile upper_bound>=lower_bound:\n\n mid=(lower_bound+upper_bound)\/\/2\n\n K_tmp=np.sum(np.maximum(A-mid\/\/F, 0))\n\n if K_tmp<=K:\n\n upper_bound=mid-1\n\n else:\n\n lower_bound=mid+1\n\n\n\nprint(lower_bound)\n\n# optimized version of the same code:\n","target":"n,k=list(map(int,input().split()))\n\n*a,= list(map(int,input().split()))\n\n*f,= list(map(int,input().split()))\n\na=sorted(a)\n\nf=sorted(f, reverse=True)\n\n\n\ndef is_ok(arg):\n\n cnt=0\n\n for i in range(n):\n\n cnt+=max(a[i]-arg\/\/f[i], 0)\n\n return cnt<=k\n\n\n\ndef meguru_bisect(ng, ok):\n\n while (abs(ok - ng) > 1):\n\n mid = (ok + ng) \/\/ 2\n\n if is_ok(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n return ok\n\n\n\nprint((meguru_bisect(-1, 10**12)))","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":459,"code_v1_num_chars":465,"code_v0_no_empty_lines":"import numpy as np\n\nN, K = list(map(int, input().split()))\nA = [int(i) for i in input().split()]\nF = [int(i) for i in input().split()]\nA = np.array(sorted(A, reverse=True))\nF = np.array(sorted(F))\nlower_bound = 0\nupper_bound = np.max(A * F)\nK_tmp = 0\nwhile upper_bound >= lower_bound:\n mid = (lower_bound + upper_bound) \/\/ 2\n K_tmp = np.sum(np.maximum(A - mid \/\/ F, 0))\n if K_tmp <= K:\n upper_bound = mid - 1\n else:\n lower_bound = mid + 1\nprint(lower_bound)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\n(*a,) = list(map(int, input().split()))\n(*f,) = list(map(int, input().split()))\na = sorted(a)\nf = sorted(f, reverse=True)\n\n\ndef is_ok(arg):\n cnt = 0\n for i in range(n):\n cnt += max(a[i] - arg \/\/ f[i], 0)\n return cnt <= k\n\n\ndef meguru_bisect(ng, ok):\n while abs(ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n if is_ok(mid):\n ok = mid\n else:\n ng = mid\n return ok\n\n\nprint((meguru_bisect(-1, 10**12)))\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-import numpy as np","+n, k = list(map(int, input().split()))","+(*a,) = list(map(int, input().split()))","+(*f,) = list(map(int, input().split()))","+a = sorted(a)","+f = sorted(f, reverse=True)","-N, K = list(map(int, input().split()))","-A = [int(i) for i in input().split()]","-F = [int(i) for i in input().split()]","-A = np.array(sorted(A, reverse=True))","-F = np.array(sorted(F))","-lower_bound = 0","-upper_bound = np.max(A * F)","-K_tmp = 0","-while upper_bound >= lower_bound:","- mid = (lower_bound + upper_bound) \/\/ 2","- K_tmp = np.sum(np.maximum(A - mid \/\/ F, 0))","- if K_tmp <= K:","- upper_bound = mid - 1","- else:","- lower_bound = mid + 1","-print(lower_bound)","+","+def is_ok(arg):","+ cnt = 0","+ for i in range(n):","+ cnt += max(a[i] - arg \/\/ f[i], 0)","+ return cnt <= k","+","+","+def meguru_bisect(ng, ok):","+ while abs(ok - ng) > 1:","+ mid = (ok + ng) \/\/ 2","+ if is_ok(mid):","+ ok = mid","+ else:","+ ng = mid","+ return ok","+","+","+print((meguru_bisect(-1, 10**12)))"],"diff_only_import_comment":false,"measured_runtime_v0":2.029960073,"measured_runtime_v1":0.3428780406,"runtime_lift":5.9203560242,"key":["s662154758","s660978012"]} +{"user_id":"u532966492","problem_id":"p02635","language":"python","submission_id_v0":"s441445233","submission_id_v1":"s346774769","cpu_time_v0":1975,"cpu_time_v1":1651,"memory_v0":87172,"memory_v1":88224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.41,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n mod = 998244353\n\n s, k = input().split()\n\n k = int(k)\n\n n = len(s)\n\n\n\n one = s.count(\"1\")\n\n\n\n cnt = 0\n\n zero_list = []\n\n for i in range(n):\n\n if s[i] == \"0\":\n\n zero_list.append(cnt)\n\n cnt = 0\n\n else:\n\n cnt += 1\n\n\n\n z = 0\n\n mm = min(one, k)\n\n\n\n dp = [[0]*(one+1) for _ in [0]*(one+1)]\n\n dp[0][0] = 1\n\n\n\n for i in range(len(zero_list)):\n\n dp2 = [[0]*(mm+1) for _ in [0]*(one+1)]\n\n base = zero_list[i]\n\n # j:\u4f55\u500b\u4eca\u307e\u3067\u306b\u5165\u308c\u305f\u304b\n\n for j in range(one+1):\n\n # l:\u4f55\u500b\u5165\u308c\u308b\u304b\n\n for l in range(one+1-j):\n\n if l < z+base-j:\n\n continue\n\n ml = max(l-base, 0)\n\n # p:\u3053\u308c\u307e\u3067\u306e\u30da\u30ca\u30eb\u30c6\u30a3\n\n for p in range(min(one, k)+1):\n\n q = p+ml\n\n if q <= mm:\n\n dp2[j+l][q] = (dp2[j+l][q]+dp[j][p]) % mod\n\n else:\n\n break\n\n z += base\n\n dp = dp2\n\n print((sum([sum(i) for i in dp]) % mod))\n\n\n\n\n\nmain()\n\n# optimized version of the same code:\n","target":"def main():\n\n mod = 998244353\n\n s, k = input().split()\n\n k, n, one, cnt, z, zero_list = int(k), len(s), s.count(\"1\")+1, 0, 0, []\n\n for i in range(n):\n\n if s[i] == \"0\":\n\n zero_list.append(cnt)\n\n cnt = 0\n\n else:\n\n cnt += 1\n\n mm = min(one-1, k)\n\n\n\n dp = [[0]*(mm+1) for _ in [0]*one]\n\n dp[0][0] = 1\n\n\n\n for i in zero_list:\n\n dp2 = [[0]*(mm+1) for _ in [0]*one]\n\n for j in range(one):\n\n for l in range(max(z+i-j, 0), one-j):\n\n ml = max(l-i, 0)\n\n for p in range(min(j, mm-ml)+1):\n\n dp2[j+l][p+ml] = (dp2[j+l][p+ml]+dp[j][p]) % mod\n\n z += i\n\n dp = dp2\n\n print((sum([sum(i) for i in dp]) % mod))\n\n\n\n\n\nmain()","code_v0_loc":46,"code_v1_loc":28,"code_v0_num_chars":1093,"code_v1_num_chars":760,"code_v0_no_empty_lines":"def main():\n mod = 998244353\n s, k = input().split()\n k = int(k)\n n = len(s)\n one = s.count(\"1\")\n cnt = 0\n zero_list = []\n for i in range(n):\n if s[i] == \"0\":\n zero_list.append(cnt)\n cnt = 0\n else:\n cnt += 1\n z = 0\n mm = min(one, k)\n dp = [[0] * (one + 1) for _ in [0] * (one + 1)]\n dp[0][0] = 1\n for i in range(len(zero_list)):\n dp2 = [[0] * (mm + 1) for _ in [0] * (one + 1)]\n base = zero_list[i]\n # j:\u4f55\u500b\u4eca\u307e\u3067\u306b\u5165\u308c\u305f\u304b\n for j in range(one + 1):\n # l:\u4f55\u500b\u5165\u308c\u308b\u304b\n for l in range(one + 1 - j):\n if l < z + base - j:\n continue\n ml = max(l - base, 0)\n # p:\u3053\u308c\u307e\u3067\u306e\u30da\u30ca\u30eb\u30c6\u30a3\n for p in range(min(one, k) + 1):\n q = p + ml\n if q <= mm:\n dp2[j + l][q] = (dp2[j + l][q] + dp[j][p]) % mod\n else:\n break\n z += base\n dp = dp2\n print((sum([sum(i) for i in dp]) % mod))\n\n\nmain()\n","code_v1_no_empty_lines":"def main():\n mod = 998244353\n s, k = input().split()\n k, n, one, cnt, z, zero_list = int(k), len(s), s.count(\"1\") + 1, 0, 0, []\n for i in range(n):\n if s[i] == \"0\":\n zero_list.append(cnt)\n cnt = 0\n else:\n cnt += 1\n mm = min(one - 1, k)\n dp = [[0] * (mm + 1) for _ in [0] * one]\n dp[0][0] = 1\n for i in zero_list:\n dp2 = [[0] * (mm + 1) for _ in [0] * one]\n for j in range(one):\n for l in range(max(z + i - j, 0), one - j):\n ml = max(l - i, 0)\n for p in range(min(j, mm - ml) + 1):\n dp2[j + l][p + ml] = (dp2[j + l][p + ml] + dp[j][p]) % mod\n z += i\n dp = dp2\n print((sum([sum(i) for i in dp]) % mod))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":39.1304347826,"diff":["- k = int(k)","- n = len(s)","- one = s.count(\"1\")","- cnt = 0","- zero_list = []","+ k, n, one, cnt, z, zero_list = int(k), len(s), s.count(\"1\") + 1, 0, 0, []","- z = 0","- mm = min(one, k)","- dp = [[0] * (one + 1) for _ in [0] * (one + 1)]","+ mm = min(one - 1, k)","+ dp = [[0] * (mm + 1) for _ in [0] * one]","- for i in range(len(zero_list)):","- dp2 = [[0] * (mm + 1) for _ in [0] * (one + 1)]","- base = zero_list[i]","- # j:\u4f55\u500b\u4eca\u307e\u3067\u306b\u5165\u308c\u305f\u304b","- for j in range(one + 1):","- # l:\u4f55\u500b\u5165\u308c\u308b\u304b","- for l in range(one + 1 - j):","- if l < z + base - j:","- continue","- ml = max(l - base, 0)","- # p:\u3053\u308c\u307e\u3067\u306e\u30da\u30ca\u30eb\u30c6\u30a3","- for p in range(min(one, k) + 1):","- q = p + ml","- if q <= mm:","- dp2[j + l][q] = (dp2[j + l][q] + dp[j][p]) % mod","- else:","- break","- z += base","+ for i in zero_list:","+ dp2 = [[0] * (mm + 1) for _ in [0] * one]","+ for j in range(one):","+ for l in range(max(z + i - j, 0), one - j):","+ ml = max(l - i, 0)","+ for p in range(min(j, mm - ml) + 1):","+ dp2[j + l][p + ml] = (dp2[j + l][p + ml] + dp[j][p]) % mod","+ z += i"],"diff_only_import_comment":false,"measured_runtime_v0":0.3745533221,"measured_runtime_v1":0.2971069293,"runtime_lift":1.2606684164,"key":["s441445233","s346774769"]} +{"user_id":"u150984829","problem_id":"p02386","language":"python","submission_id_v0":"s799017760","submission_id_v1":"s414241098","cpu_time_v0":150,"cpu_time_v1":130,"memory_v0":5608,"memory_v1":5608,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if(g[k:k+4]==e[1:5])*(f[0]==e[0])*(f[5]==e[5]):return 'No'\n\n return 'Yes'\n\nprint((f()))\n\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if g[k:k+4]==e[1:5]:\n\n if f[0]==e[0]:\n\n if f[5]==e[5]:return 'No'\n\n return 'Yes'\n\nprint((f()))\n","code_v0_loc":14,"code_v1_loc":16,"code_v0_num_chars":424,"code_v1_num_chars":442,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):\n f = [d[int(k)] for k in p]\n g = f[1:5] * 2\n for k in range(4):\n if (g[k : k + 4] == e[1:5]) * (f[0] == e[0]) * (f[5] == e[5]):\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):\n f = [d[int(k)] for k in p]\n g = f[1:5] * 2\n for k in range(4):\n if g[k : k + 4] == e[1:5]:\n if f[0] == e[0]:\n if f[5] == e[5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["- if (g[k : k + 4] == e[1:5]) * (f[0] == e[0]) * (f[5] == e[5]):","- return \"No\"","+ if g[k : k + 4] == e[1:5]:","+ if f[0] == e[0]:","+ if f[5] == e[5]:","+ return \"No\""],"diff_only_import_comment":false,"measured_runtime_v0":0.3438470016,"measured_runtime_v1":0.1932190149,"runtime_lift":1.7795712385,"key":["s799017760","s414241098"]} +{"user_id":"u923270446","problem_id":"p02814","language":"python","submission_id_v0":"s885010221","submission_id_v1":"s420231524","cpu_time_v0":220,"cpu_time_v1":172,"memory_v0":16320,"memory_v1":20208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom fractions import gcd\n\nn, m = list(map(int, input().split()))\n\na = [int(i) \/\/ 2 for i in input().split()]\n\nx = 1\n\nfor i in range(n):\n\n x *= a[i] \/\/ gcd(x, a[i])\n\nfor i in a:\n\n if x \/\/ i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((m \/\/ x + 1) \/\/ 2))\n\n# optimized version of the same code:\n","target":"from math import gcd, ceil\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = [i \/\/ 2 for i in a]\n\nl = 1\n\nfor i in a:\n\n l *= i \/\/ gcd(l, i)\n\nfor i in a:\n\n if l \/\/ i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint((ceil((m \/\/ l) \/ 2)))","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":259,"code_v1_num_chars":266,"code_v0_no_empty_lines":"from fractions import gcd\n\nn, m = list(map(int, input().split()))\na = [int(i) \/\/ 2 for i in input().split()]\nx = 1\nfor i in range(n):\n x *= a[i] \/\/ gcd(x, a[i])\nfor i in a:\n if x \/\/ i % 2 == 0:\n print((0))\n exit()\nprint(((m \/\/ x + 1) \/\/ 2))\n","code_v1_no_empty_lines":"from math import gcd, ceil\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = [i \/\/ 2 for i in a]\nl = 1\nfor i in a:\n l *= i \/\/ gcd(l, i)\nfor i in a:\n if l \/\/ i % 2 == 0:\n print((0))\n exit()\nprint((ceil((m \/\/ l) \/ 2)))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-from fractions import gcd","+from math import gcd, ceil","-a = [int(i) \/\/ 2 for i in input().split()]","-x = 1","-for i in range(n):","- x *= a[i] \/\/ gcd(x, a[i])","+a = list(map(int, input().split()))","+a = [i \/\/ 2 for i in a]","+l = 1","- if x \/\/ i % 2 == 0:","+ l *= i \/\/ gcd(l, i)","+for i in a:","+ if l \/\/ i % 2 == 0:","-print(((m \/\/ x + 1) \/\/ 2))","+print((ceil((m \/\/ l) \/ 2)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2764406667,"measured_runtime_v1":0.214073961,"runtime_lift":1.2913325159,"key":["s885010221","s420231524"]} +{"user_id":"u716530146","problem_id":"p03038","language":"python","submission_id_v0":"s839494003","submission_id_v1":"s928697183","cpu_time_v0":613,"cpu_time_v1":410,"memory_v0":89216,"memory_v1":43704,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.12,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nn,m=list(map(int,input().split()))\n\na0=list(map(int,input().split()))\n\ndata=[list(map(int,input().split())) for i in range(m)]\n\nfor i in a0:\n\n\tdata.append([1,i])\n\ndata.sort(key=lambda tup:-tup[1])\n\nans=0\n\nfor num,val in data:\n\n\tif n>=num:\n\n\t\tn-=num\n\n\t\tans+=val*num\n\n\telse:\n\n\t\tans+=val*n\n\n\t\tbreak\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\nfrom collections import Counter\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nsys.setrecursionlimit(10**8)\n\n\n\nans=0\n\nn,m=list(map(int,input().split()))\n\nA=list(map(int,input().split()))\n\nbc=[]\n\nfor i in range(m):\n\n b,c=list(map(int,input().split()))\n\n bc.append((c,b))\n\nC=Counter(A)\n\nbc+=list(C.items())\n\nbc.sort(key=lambda tup:-tup[0])\n\n# print(bc)\n\nfor c,b in bc:\n\n if n>=b:\n\n n-=b\n\n ans+=c*b\n\n else:\n\n ans+=c*n\n\n break\n\nprint(ans)\n\n\n","code_v0_loc":17,"code_v1_loc":26,"code_v0_num_chars":357,"code_v1_num_chars":498,"code_v0_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline()[:-1]\nn, m = list(map(int, input().split()))\na0 = list(map(int, input().split()))\ndata = [list(map(int, input().split())) for i in range(m)]\nfor i in a0:\n data.append([1, i])\ndata.sort(key=lambda tup: -tup[1])\nans = 0\nfor num, val in data:\n if n >= num:\n n -= num\n ans += val * num\n else:\n ans += val * n\n break\nprint(ans)\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nfrom collections import Counter\n\ninput = lambda: sys.stdin.readline()[:-1]\nsys.setrecursionlimit(10**8)\nans = 0\nn, m = list(map(int, input().split()))\nA = list(map(int, input().split()))\nbc = []\nfor i in range(m):\n b, c = list(map(int, input().split()))\n bc.append((c, b))\nC = Counter(A)\nbc += list(C.items())\nbc.sort(key=lambda tup: -tup[0])\n# print(bc)\nfor c, b in bc:\n if n >= b:\n n -= b\n ans += c * b\n else:\n ans += c * n\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":34.6153846154,"diff":["+#!\/usr\/bin\/env python3","+from collections import Counter","+sys.setrecursionlimit(10**8)","+ans = 0","-a0 = list(map(int, input().split()))","-data = [list(map(int, input().split())) for i in range(m)]","-for i in a0:","- data.append([1, i])","-data.sort(key=lambda tup: -tup[1])","-ans = 0","-for num, val in data:","- if n >= num:","- n -= num","- ans += val * num","+A = list(map(int, input().split()))","+bc = []","+for i in range(m):","+ b, c = list(map(int, input().split()))","+ bc.append((c, b))","+C = Counter(A)","+bc += list(C.items())","+bc.sort(key=lambda tup: -tup[0])","+# print(bc)","+for c, b in bc:","+ if n >= b:","+ n -= b","+ ans += c * b","- ans += val * n","+ ans += c * n"],"diff_only_import_comment":false,"measured_runtime_v0":0.2703684399,"measured_runtime_v1":0.1342513988,"runtime_lift":2.013896632,"key":["s839494003","s928697183"]} +{"user_id":"u860002137","problem_id":"p03434","language":"python","submission_id_v0":"s569031277","submission_id_v1":"s835944153","cpu_time_v0":154,"cpu_time_v1":29,"memory_v0":12396,"memory_v1":8924,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\na = np.array(list(map(int, input().split())))\n\n\n\na.sort()\n\na = a[::-1]\n\n\n\nprint((a[0::2].sum() - a[1::2].sum()))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\narr = list(map(int, input().split()))\n\n\n\narr.sort(reverse=True)\n\n\n\nprint((sum(arr[0::2]) - sum(arr[1::2])))","code_v0_loc":9,"code_v1_loc":6,"code_v0_num_chars":150,"code_v1_num_chars":123,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\na = np.array(list(map(int, input().split())))\na.sort()\na = a[::-1]\nprint((a[0::2].sum() - a[1::2].sum()))\n","code_v1_no_empty_lines":"n = int(eval(input()))\narr = list(map(int, input().split()))\narr.sort(reverse=True)\nprint((sum(arr[0::2]) - sum(arr[1::2])))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-import numpy as np","-","-N = int(eval(input()))","-a = np.array(list(map(int, input().split())))","-a.sort()","-a = a[::-1]","-print((a[0::2].sum() - a[1::2].sum()))","+n = int(eval(input()))","+arr = list(map(int, input().split()))","+arr.sort(reverse=True)","+print((sum(arr[0::2]) - sum(arr[1::2])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4327047536,"measured_runtime_v1":0.1933466868,"runtime_lift":7.410030019,"key":["s569031277","s835944153"]} +{"user_id":"u846634344","problem_id":"p03200","language":"python","submission_id_v0":"s951894178","submission_id_v1":"s605042414","cpu_time_v0":58,"cpu_time_v1":51,"memory_v0":5932,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.07,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tA = []\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': A.append(bcnt)\n\n\t\n\n\tprint((sum(A)))\n\n\n\nif __name__ == '__main__':\n\n\tmain()\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tans = 0\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': ans += bcnt\n\n\t\n\n\tprint(ans)\n\n\n\nif __name__ == '__main__':\n\n\tmain()","code_v0_loc":20,"code_v1_loc":20,"code_v0_num_chars":439,"code_v1_num_chars":434,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\nif sys.platform in ([\"ios\", \"darwin\", \"win32\"]):\n sys.stdin = open(\"Untitled.txt\")\ninput = sys.stdin.readline\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return [int(s) for s in input().split()]\n\n\ndef main():\n S = input().rstrip()\n bcnt = 0\n A = []\n for i in range(len(S)):\n if S[i] == \"B\":\n bcnt += 1\n if S[i] == \"W\":\n A.append(bcnt)\n print((sum(A)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\nif sys.platform in ([\"ios\", \"darwin\", \"win32\"]):\n sys.stdin = open(\"Untitled.txt\")\ninput = sys.stdin.readline\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return [int(s) for s in input().split()]\n\n\ndef main():\n S = input().rstrip()\n bcnt = 0\n ans = 0\n for i in range(len(S)):\n if S[i] == \"B\":\n bcnt += 1\n if S[i] == \"W\":\n ans += bcnt\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- A = []","+ ans = 0","- A.append(bcnt)","- print((sum(A)))","+ ans += bcnt","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2057990801,"measured_runtime_v1":0.0065612807,"runtime_lift":31.365687324,"key":["s951894178","s605042414"]} +{"user_id":"u981931040","problem_id":"p02873","language":"python","submission_id_v0":"s351782639","submission_id_v1":"s125422304","cpu_time_v0":1362,"cpu_time_v1":407,"memory_v0":22568,"memory_v1":27056,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.12,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nS = list(eval(input()))\n\nS_len = len(S)\n\nnum_lst = np.zeros(S_len + 1)\n\nfor i in range(S_len):\n\n if S[i] == \"<\":\n\n num_lst[i + 1] = max(num_lst[i] + 1, num_lst[i + 1])\n\n\n\n\n\nfor i in range(S_len - 1, -1 , -1):\n\n if S[i] == \">\":\n\n num_lst[i] = max(num_lst[i], num_lst[i + 1] + 1)\n\nprint((int(np.sum(num_lst))))\n\n# optimized version of the same code:\n","target":"S = list(eval(input()))\n\nnumList = [0] * (len(S) + 1)\n\nfor i in range(len(S)):\n\n if S[i] == '<':\n\n numList[i + 1] = numList[i] + 1\n\n\n\nfor i in range(len(S) - 1 , -1 , -1):\n\n if S[i] == '>':\n\n numList[i] = max(numList[i + 1] + 1 ,numList[i])\n\nprint((sum(numList)))","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":340,"code_v1_num_chars":275,"code_v0_no_empty_lines":"import numpy as np\n\nS = list(eval(input()))\nS_len = len(S)\nnum_lst = np.zeros(S_len + 1)\nfor i in range(S_len):\n if S[i] == \"<\":\n num_lst[i + 1] = max(num_lst[i] + 1, num_lst[i + 1])\nfor i in range(S_len - 1, -1, -1):\n if S[i] == \">\":\n num_lst[i] = max(num_lst[i], num_lst[i + 1] + 1)\nprint((int(np.sum(num_lst))))\n","code_v1_no_empty_lines":"S = list(eval(input()))\nnumList = [0] * (len(S) + 1)\nfor i in range(len(S)):\n if S[i] == \"<\":\n numList[i + 1] = numList[i] + 1\nfor i in range(len(S) - 1, -1, -1):\n if S[i] == \">\":\n numList[i] = max(numList[i + 1] + 1, numList[i])\nprint((sum(numList)))\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-import numpy as np","-","-S_len = len(S)","-num_lst = np.zeros(S_len + 1)","-for i in range(S_len):","+numList = [0] * (len(S) + 1)","+for i in range(len(S)):","- num_lst[i + 1] = max(num_lst[i] + 1, num_lst[i + 1])","-for i in range(S_len - 1, -1, -1):","+ numList[i + 1] = numList[i] + 1","+for i in range(len(S) - 1, -1, -1):","- num_lst[i] = max(num_lst[i], num_lst[i + 1] + 1)","-print((int(np.sum(num_lst))))","+ numList[i] = max(numList[i + 1] + 1, numList[i])","+print((sum(numList)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.7631940264,"measured_runtime_v1":0.252567987,"runtime_lift":6.9810669474,"key":["s351782639","s125422304"]} +{"user_id":"u813098295","problem_id":"p02780","language":"python","submission_id_v0":"s187757761","submission_id_v1":"s900380040","cpu_time_v0":568,"cpu_time_v1":432,"memory_v0":111624,"memory_v1":111624,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.94,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nclass SegmentTree:\n\n seg_len = 1\n\n node = []\n\n def __init__(self, n):\n\n while self.seg_len < n:\n\n self.seg_len <<= 1\n\n self.node = [ 0 for _ in range(self.seg_len*2) ]\n\n\n\n def add(self, idx, v):\n\n idx += self.seg_len\n\n self.node[idx] += v\n\n while True:\n\n idx \/\/= 2\n\n if idx == 0:\n\n break\n\n self.node[idx] = self.node[idx*2] + self.node[idx*2+1]\n\n\n\n def sum(self, l, r):\n\n l += self.seg_len\n\n r += self.seg_len\n\n ret = 0\n\n while l < r:\n\n if l & 1 == 1:\n\n ret += self.node[l]\n\n l += 1\n\n if r & 1 == 1:\n\n ret += self.node[r-1]\n\n r -= 1\n\n l \/\/= 2; r \/\/= 2;\n\n return ret\n\n\n\n\n\nn, k = list(map(int, input().split()))\n\np = [ int(x) for x in input().split() ]\n\n\n\nseg_tree = SegmentTree(n)\n\nfor i in range(n):\n\n seg_tree.add(i, (1+p[i])\/2)\n\n\n\nans = 0\n\nfor i in range(n-k+1):\n\n ans = max(ans, seg_tree.sum(i, i+k))\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"class SegmentTree:\n\n seg_len = 1\n\n node = []\n\n def __init__(self, n):\n\n while self.seg_len < n:\n\n self.seg_len <<= 1\n\n self.node = [ 0 for _ in range(self.seg_len*2) ]\n\n\n\n def add(self, idx, v):\n\n idx += self.seg_len\n\n self.node[idx] += v\n\n while True:\n\n idx >>= 1\n\n if idx == 0:\n\n break\n\n self.node[idx] = self.node[idx*2] + self.node[idx*2+1]\n\n\n\n def sum(self, l, r):\n\n l += self.seg_len\n\n r += self.seg_len\n\n ret = 0\n\n while l < r:\n\n if l & 1 == 1:\n\n ret += self.node[l]\n\n l += 1\n\n if r & 1 == 1:\n\n ret += self.node[r-1]\n\n r -= 1\n\n l >>= 1; r >>= 1;\n\n return ret\n\n\n\n\n\nn, k = list(map(int, input().split()))\n\np = [ int(x) for x in input().split() ]\n\n\n\nseg_tree = SegmentTree(n)\n\nfor i in range(n):\n\n seg_tree.add(i, (1+p[i])\/2)\n\n\n\nans = 0\n\nfor i in range(n-k+1):\n\n ans = max(ans, seg_tree.sum(i, i+k))\n\n\n\nprint(ans)\n","code_v0_loc":44,"code_v1_loc":44,"code_v0_num_chars":1055,"code_v1_num_chars":1055,"code_v0_no_empty_lines":"class SegmentTree:\n seg_len = 1\n node = []\n\n def __init__(self, n):\n while self.seg_len < n:\n self.seg_len <<= 1\n self.node = [0 for _ in range(self.seg_len * 2)]\n\n def add(self, idx, v):\n idx += self.seg_len\n self.node[idx] += v\n while True:\n idx \/\/= 2\n if idx == 0:\n break\n self.node[idx] = self.node[idx * 2] + self.node[idx * 2 + 1]\n\n def sum(self, l, r):\n l += self.seg_len\n r += self.seg_len\n ret = 0\n while l < r:\n if l & 1 == 1:\n ret += self.node[l]\n l += 1\n if r & 1 == 1:\n ret += self.node[r - 1]\n r -= 1\n l \/\/= 2\n r \/\/= 2\n return ret\n\n\nn, k = list(map(int, input().split()))\np = [int(x) for x in input().split()]\nseg_tree = SegmentTree(n)\nfor i in range(n):\n seg_tree.add(i, (1 + p[i]) \/ 2)\nans = 0\nfor i in range(n - k + 1):\n ans = max(ans, seg_tree.sum(i, i + k))\nprint(ans)\n","code_v1_no_empty_lines":"class SegmentTree:\n seg_len = 1\n node = []\n\n def __init__(self, n):\n while self.seg_len < n:\n self.seg_len <<= 1\n self.node = [0 for _ in range(self.seg_len * 2)]\n\n def add(self, idx, v):\n idx += self.seg_len\n self.node[idx] += v\n while True:\n idx >>= 1\n if idx == 0:\n break\n self.node[idx] = self.node[idx * 2] + self.node[idx * 2 + 1]\n\n def sum(self, l, r):\n l += self.seg_len\n r += self.seg_len\n ret = 0\n while l < r:\n if l & 1 == 1:\n ret += self.node[l]\n l += 1\n if r & 1 == 1:\n ret += self.node[r - 1]\n r -= 1\n l >>= 1\n r >>= 1\n return ret\n\n\nn, k = list(map(int, input().split()))\np = [int(x) for x in input().split()]\nseg_tree = SegmentTree(n)\nfor i in range(n):\n seg_tree.add(i, (1 + p[i]) \/ 2)\nans = 0\nfor i in range(n - k + 1):\n ans = max(ans, seg_tree.sum(i, i + k))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- idx \/\/= 2","+ idx >>= 1","- l \/\/= 2","- r \/\/= 2","+ l >>= 1","+ r >>= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3662393868,"measured_runtime_v1":0.2843342848,"runtime_lift":1.2880591838,"key":["s187757761","s900380040"]} +{"user_id":"u930705402","problem_id":"p03723","language":"python","submission_id_v0":"s632911465","submission_id_v1":"s017275362","cpu_time_v0":1018,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":98.23,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport time\n\nt=time.time()\n\nA,B,C=list(map(int,input().split()))\n\ncnt=0\n\nwhile(A%2==B%2==C%2==0):\n\n a,b,c=A,B,C\n\n A=b\/\/2+c\/\/2;B=a\/\/2+c\/\/2;C=a\/\/2+b\/\/2\n\n cnt+=1\n\n if(time.time()-t>=1):\n\n print((-1))\n\n exit()\n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"A,B,C=list(map(int,input().split()))\n\ncnt=0\n\nif(A==B==C):\n\n if A%2!=0:\n\n print((0))\n\n else:\n\n print((-1))\n\n exit()\n\nwhile(A%2==B%2==C%2==0):\n\n a,b,c=A,B,C\n\n A=b\/\/2+c\/\/2;B=a\/\/2+c\/\/2;C=a\/\/2+b\/\/2\n\n cnt+=1\n\nprint(cnt)","code_v0_loc":12,"code_v1_loc":13,"code_v0_num_chars":235,"code_v1_num_chars":235,"code_v0_no_empty_lines":"import time\n\nt = time.time()\nA, B, C = list(map(int, input().split()))\ncnt = 0\nwhile A % 2 == B % 2 == C % 2 == 0:\n a, b, c = A, B, C\n A = b \/\/ 2 + c \/\/ 2\n B = a \/\/ 2 + c \/\/ 2\n C = a \/\/ 2 + b \/\/ 2\n cnt += 1\n if time.time() - t >= 1:\n print((-1))\n exit()\nprint(cnt)\n","code_v1_no_empty_lines":"A, B, C = list(map(int, input().split()))\ncnt = 0\nif A == B == C:\n if A % 2 != 0:\n print((0))\n else:\n print((-1))\n exit()\nwhile A % 2 == B % 2 == C % 2 == 0:\n a, b, c = A, B, C\n A = b \/\/ 2 + c \/\/ 2\n B = a \/\/ 2 + c \/\/ 2\n C = a \/\/ 2 + b \/\/ 2\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-import time","-","-t = time.time()","+if A == B == C:","+ if A % 2 != 0:","+ print((0))","+ else:","+ print((-1))","+ exit()","- if time.time() - t >= 1:","- print((-1))","- exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.4561348832,"measured_runtime_v1":0.2831880744,"runtime_lift":1.6107136015,"key":["s632911465","s017275362"]} +{"user_id":"u780475861","problem_id":"p03416","language":"python","submission_id_v0":"s789877064","submission_id_v1":"s762526319","cpu_time_v0":111,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.68,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(a, b + 1):\n\n f = True\n\n s = str(i)\n\n l = len(s)\n\n for j in range(l\/\/2 + 1):\n\n if s[j] != s[- j - 1]:\n\n f = False\n\n break\n\n if f:\n\n n += 1\n\nprint(n)\n\n# optimized version of the same code:\n","target":"a,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(1, 10):\n\n for j in range(10):\n\n for k in range(10):\n\n s = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n\n if a <= s <= b:\n\n n += 1\n\nprint(n)","code_v0_loc":13,"code_v1_loc":9,"code_v0_num_chars":253,"code_v1_num_chars":240,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nn = 0\nfor i in range(a, b + 1):\n f = True\n s = str(i)\n l = len(s)\n for j in range(l \/\/ 2 + 1):\n if s[j] != s[-j - 1]:\n f = False\n break\n if f:\n n += 1\nprint(n)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nn = 0\nfor i in range(1, 10):\n for j in range(10):\n for k in range(10):\n s = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n if a <= s <= b:\n n += 1\nprint(n)\n","code_same":false,"relative_loc_diff_percent":30.7692307692,"diff":["-for i in range(a, b + 1):","- f = True","- s = str(i)","- l = len(s)","- for j in range(l \/\/ 2 + 1):","- if s[j] != s[-j - 1]:","- f = False","- break","- if f:","- n += 1","+for i in range(1, 10):","+ for j in range(10):","+ for k in range(10):","+ s = 10000 * i + 1000 * j + 100 * k + 10 * j + i","+ if a <= s <= b:","+ n += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.319382349,"measured_runtime_v1":0.1601409102,"runtime_lift":1.99438325,"key":["s789877064","s762526319"]} +{"user_id":"u021548497","problem_id":"p03723","language":"python","submission_id_v0":"s378337044","submission_id_v1":"s805175233","cpu_time_v0":287,"cpu_time_v1":17,"memory_v0":18992,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\ncookies = np.array([int(x) for x in input().split()])\n\n\n\nif any(cookies%2):\n\n ans = 0\n\nelif cookies[0] == cookies[1] == cookies[2]:\n\n ans = -1\n\nelse:\n\n ans = 0\n\n while True:\n\n if not any(cookies%2):\n\n cookies = cookies\/\/2\n\n ans += 1\n\n continue\n\n if all(cookies%2):\n\n ans += 1\n\n break\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"a, b, c = list(map(int, input().split()))\n\nif a == b == c and a%2 == 0:\n\n print((-1))\n\nelif a%2 or b%2 or c%2:\n\n print((0))\n\nelse:\n\n ans = 0\n\n while a%2 == b%2 == c%2 == 0:\n\n a, b, c = (b+c)\/\/2, (a+c)\/\/2, (a+b)\/\/2\n\n ans += 1\n\n print(ans)","code_v0_loc":18,"code_v1_loc":11,"code_v0_num_chars":348,"code_v1_num_chars":238,"code_v0_no_empty_lines":"import numpy as np\n\ncookies = np.array([int(x) for x in input().split()])\nif any(cookies % 2):\n ans = 0\nelif cookies[0] == cookies[1] == cookies[2]:\n ans = -1\nelse:\n ans = 0\n while True:\n if not any(cookies % 2):\n cookies = cookies \/\/ 2\n ans += 1\n continue\n if all(cookies % 2):\n ans += 1\n break\nprint(ans)\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nif a == b == c and a % 2 == 0:\n print((-1))\nelif a % 2 or b % 2 or c % 2:\n print((0))\nelse:\n ans = 0\n while a % 2 == b % 2 == c % 2 == 0:\n a, b, c = (b + c) \/\/ 2, (a + c) \/\/ 2, (a + b) \/\/ 2\n ans += 1\n print(ans)\n","code_same":false,"relative_loc_diff_percent":38.8888888889,"diff":["-import numpy as np","-","-cookies = np.array([int(x) for x in input().split()])","-if any(cookies % 2):","- ans = 0","-elif cookies[0] == cookies[1] == cookies[2]:","- ans = -1","+a, b, c = list(map(int, input().split()))","+if a == b == c and a % 2 == 0:","+ print((-1))","+elif a % 2 or b % 2 or c % 2:","+ print((0))","- while True:","- if not any(cookies % 2):","- cookies = cookies \/\/ 2","- ans += 1","- continue","- if all(cookies % 2):","- ans += 1","- break","-print(ans)","+ while a % 2 == b % 2 == c % 2 == 0:","+ a, b, c = (b + c) \/\/ 2, (a + c) \/\/ 2, (a + b) \/\/ 2","+ ans += 1","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.4413467925,"measured_runtime_v1":0.1942887537,"runtime_lift":7.4185806671,"key":["s378337044","s805175233"]} +{"user_id":"u968166680","problem_id":"p03752","language":"python","submission_id_v0":"s863090450","submission_id_v1":"s059435285","cpu_time_v0":32,"cpu_time_v1":24,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for bit in range(1 << N):\n\n if (not (bit & 1)) or bin(bit).count('1') != K:\n\n continue\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if bit & (1 << i):\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom itertools import combinations\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for comb in combinations(list(range(1, N)), K - 1):\n\n included = [False] * N\n\n for i in comb:\n\n included[i] = True\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if included[i]:\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":37,"code_v1_loc":39,"code_v0_num_chars":756,"code_v1_num_chars":818,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef main():\n N, K, *A = list(map(int, read().split()))\n ans = INF\n for bit in range(1 << N):\n if (not (bit & 1)) or bin(bit).count(\"1\") != K:\n continue\n total = 0\n max_height = A[0]\n for i, a in enumerate(A[1:], 1):\n if a <= max_height:\n if bit & (1 << i):\n total += max_height - a + 1\n max_height += 1\n else:\n max_height = a\n if ans > total:\n ans = total\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nfrom itertools import combinations\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef main():\n N, K, *A = list(map(int, read().split()))\n ans = INF\n for comb in combinations(list(range(1, N)), K - 1):\n included = [False] * N\n for i in comb:\n included[i] = True\n total = 0\n max_height = A[0]\n for i, a in enumerate(A[1:], 1):\n if a <= max_height:\n if included[i]:\n total += max_height - a + 1\n max_height += 1\n else:\n max_height = a\n if ans > total:\n ans = total\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":5.1282051282,"diff":["+from itertools import combinations","- for bit in range(1 << N):","- if (not (bit & 1)) or bin(bit).count(\"1\") != K:","- continue","+ for comb in combinations(list(range(1, N)), K - 1):","+ included = [False] * N","+ for i in comb:","+ included[i] = True","- if bit & (1 << i):","+ if included[i]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.4393207397,"measured_runtime_v1":0.2213684809,"runtime_lift":1.9845677122,"key":["s863090450","s059435285"]} +{"user_id":"u347600233","problem_id":"p02952","language":"python","submission_id_v0":"s073920837","submission_id_v1":"s426081507","cpu_time_v0":75,"cpu_time_v1":58,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nn = int(eval(input()))\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if math.floor(math.log10(i) + 1) % 2:\n\n cnt += 1\n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if len(str(i)) % 2:\n\n cnt += 1\n\nprint(cnt)","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":138,"code_v1_num_chars":107,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\ncnt = 0\nfor i in range(1, n + 1):\n if math.floor(math.log10(i) + 1) % 2:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ncnt = 0\nfor i in range(1, n + 1):\n if len(str(i)) % 2:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-import math","-","- if math.floor(math.log10(i) + 1) % 2:","+ if len(str(i)) % 2:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3655955575,"measured_runtime_v1":0.2850201683,"runtime_lift":1.282700658,"key":["s073920837","s426081507"]} +{"user_id":"u423966555","problem_id":"p02773","language":"python","submission_id_v0":"s252908207","submission_id_v1":"s096619437","cpu_time_v0":859,"cpu_time_v1":768,"memory_v0":46080,"memory_v1":48888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import defaultdict\n\nn = int(eval(input()))\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = eval(input())\n\n d[key] += 1\n\n\n\ndict = sorted(list(d.items()), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nfor s in dict_li:\n\n print(s)\n\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\nn = int(input())\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = input()\n\n d[key] += 1\n\n\n\ndict = sorted(d.items(), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nprint(*dict_li, sep='\\n')\n","code_v0_loc":19,"code_v1_loc":18,"code_v0_num_chars":354,"code_v1_num_chars":348,"code_v0_no_empty_lines":"from collections import defaultdict\n\nn = int(eval(input()))\nd = defaultdict(int)\nfor _ in range(n):\n key = eval(input())\n d[key] += 1\ndict = sorted(list(d.items()), key=lambda x: x[1], reverse=True)\nmax_v = max(d.values())\ndict_li = []\nfor a in dict:\n if a[1] == max_v:\n dict_li.append(a[0])\ndict_li.sort()\nfor s in dict_li:\n print(s)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nn = int(input())\nd = defaultdict(int)\nfor _ in range(n):\n key = input()\n d[key] += 1\ndict = sorted(d.items(), key=lambda x: x[1], reverse=True)\nmax_v = max(d.values())\ndict_li = []\nfor a in dict:\n if a[1] == max_v:\n dict_li.append(a[0])\ndict_li.sort()\nprint(*dict_li, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-n = int(eval(input()))","+n = int(input())","- key = eval(input())","+ key = input()","-dict = sorted(list(d.items()), key=lambda x: x[1], reverse=True)","+dict = sorted(d.items(), key=lambda x: x[1], reverse=True)","-for s in dict_li:","- print(s)","+print(*dict_li, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.2625157752,"measured_runtime_v1":0.2092528682,"runtime_lift":1.2545384801,"key":["s252908207","s096619437"]} +{"user_id":"u933622697","problem_id":"p03273","language":"python","submission_id_v0":"s043120968","submission_id_v1":"s898487040","cpu_time_v0":153,"cpu_time_v1":19,"memory_v0":12484,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.58,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# Use numpy if you use column operation\n\nimport numpy as np\n\nh, w = list(map(int, input().split()))\n\n\n\n# Get grid colors\n\ngird_colors = np.array([])\n\nfor _ in range(h):\n\n tmp_row = np.array(list(eval(input())))\n\n if \"#\" in tmp_row: # If the row includes black\n\n gird_colors = np.concatenate((gird_colors, tmp_row))\n\ngird_colors = gird_colors.reshape(-1, w)\n\n\n\n# Search and delete white line\n\ndel_count = 0\n\nfor wi in range(w):\n\n if \"#\" not in gird_colors[:, wi - del_count]:\n\n gird_colors = np.delete(gird_colors, wi - del_count, 1)\n\n del_count += 1\n\n\n\n# Print result\n\nfor line_val in gird_colors:\n\n print((\"\".join(line_val))) \n\n# optimized version of the same code:\n","target":"h, w = list(map(int, input().split()))\n\ngrid = [list(eval(input())) for _ in range(h)]\n\n\n\n# Filtering the data if any \"#\" are existed in the each row or col\n\n# Usage: filter(lambda row: , grid or zip(*grid)) \n\n# If true, the row is not be deleted\n\n# (Do not use if statement!)\n\nrow_compressed_grid = list([row for row in grid if any(x == \"#\" for x in row)])\n\ncompressed_grid = list([col for col in zip(*row_compressed_grid) if any(x == \"#\" for x in col)])\n\n# list -> string and out\n\nfor row in zip(*compressed_grid):\n\n print((\"\".join(row)))","code_v0_loc":22,"code_v1_loc":12,"code_v0_num_chars":647,"code_v1_num_chars":552,"code_v0_no_empty_lines":"# Use numpy if you use column operation\nimport numpy as np\n\nh, w = list(map(int, input().split()))\n# Get grid colors\ngird_colors = np.array([])\nfor _ in range(h):\n tmp_row = np.array(list(eval(input())))\n if \"#\" in tmp_row: # If the row includes black\n gird_colors = np.concatenate((gird_colors, tmp_row))\ngird_colors = gird_colors.reshape(-1, w)\n# Search and delete white line\ndel_count = 0\nfor wi in range(w):\n if \"#\" not in gird_colors[:, wi - del_count]:\n gird_colors = np.delete(gird_colors, wi - del_count, 1)\n del_count += 1\n# Print result\nfor line_val in gird_colors:\n print((\"\".join(line_val)))\n","code_v1_no_empty_lines":"h, w = list(map(int, input().split()))\ngrid = [list(eval(input())) for _ in range(h)]\n# Filtering the data if any \"#\" are existed in the each row or col\n# Usage: filter(lambda row: , grid or zip(*grid))\n# If true, the row is not be deleted\n# (Do not use if statement!)\nrow_compressed_grid = list([row for row in grid if any(x == \"#\" for x in row)])\ncompressed_grid = list(\n [col for col in zip(*row_compressed_grid) if any(x == \"#\" for x in col)]\n)\n# list -> string and out\nfor row in zip(*compressed_grid):\n print((\"\".join(row)))\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-# Use numpy if you use column operation","-import numpy as np","-","-# Get grid colors","-gird_colors = np.array([])","-for _ in range(h):","- tmp_row = np.array(list(eval(input())))","- if \"#\" in tmp_row: # If the row includes black","- gird_colors = np.concatenate((gird_colors, tmp_row))","-gird_colors = gird_colors.reshape(-1, w)","-# Search and delete white line","-del_count = 0","-for wi in range(w):","- if \"#\" not in gird_colors[:, wi - del_count]:","- gird_colors = np.delete(gird_colors, wi - del_count, 1)","- del_count += 1","-# Print result","-for line_val in gird_colors:","- print((\"\".join(line_val)))","+grid = [list(eval(input())) for _ in range(h)]","+# Filtering the data if any \"#\" are existed in the each row or col","+# Usage: filter(lambda row: , grid or zip(*grid))","+# If true, the row is not be deleted","+# (Do not use if statement!)","+row_compressed_grid = list([row for row in grid if any(x == \"#\" for x in row)])","+compressed_grid = list(","+ [col for col in zip(*row_compressed_grid) if any(x == \"#\" for x in col)]","+)","+# list -> string and out","+for row in zip(*compressed_grid):","+ print((\"\".join(row)))"],"diff_only_import_comment":false,"measured_runtime_v0":2.0488239424,"measured_runtime_v1":0.3252195714,"runtime_lift":6.2998174844,"key":["s043120968","s898487040"]} +{"user_id":"u867826040","problem_id":"p03721","language":"python","submission_id_v0":"s719602965","submission_id_v1":"s173376033","cpu_time_v0":194,"cpu_time_v1":151,"memory_v0":76876,"memory_v1":16524,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,k = list(map(int,input().split()))\n\nl = [0]*(10**5+1)\n\nfor i in range(n):\n\n ai,bi = list(map(int,input().split()))\n\n l[ai]+=bi\n\nfor index,i in enumerate(l):\n\n if i:\n\n k-=i\n\n if k<=0:\n\n break\n\nprint(index)\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\nfrom sys import stdin\n\ninput = stdin.readline\n\nd = defaultdict(int)\n\nn,k = list(map(int,input().split()))\n\nfor _ in range(n):\n\n a,b = list(map(int,input().split()))\n\n d[a]+=b\n\nfor key in sorted(d.keys()):\n\n v = d[key]\n\n k-=v\n\n if k <= 0:\n\n break\n\nprint(key)","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":228,"code_v1_num_chars":304,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nl = [0] * (10**5 + 1)\nfor i in range(n):\n ai, bi = list(map(int, input().split()))\n l[ai] += bi\nfor index, i in enumerate(l):\n if i:\n k -= i\n if k <= 0:\n break\nprint(index)\n","code_v1_no_empty_lines":"from collections import defaultdict\nfrom sys import stdin\n\ninput = stdin.readline\nd = defaultdict(int)\nn, k = list(map(int, input().split()))\nfor _ in range(n):\n a, b = list(map(int, input().split()))\n d[a] += b\nfor key in sorted(d.keys()):\n v = d[key]\n k -= v\n if k <= 0:\n break\nprint(key)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["+from collections import defaultdict","+from sys import stdin","+","+input = stdin.readline","+d = defaultdict(int)","-l = [0] * (10**5 + 1)","-for i in range(n):","- ai, bi = list(map(int, input().split()))","- l[ai] += bi","-for index, i in enumerate(l):","- if i:","- k -= i","- if k <= 0:","- break","-print(index)","+for _ in range(n):","+ a, b = list(map(int, input().split()))","+ d[a] += b","+for key in sorted(d.keys()):","+ v = d[key]","+ k -= v","+ if k <= 0:","+ break","+print(key)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5501943195,"measured_runtime_v1":0.4111647634,"runtime_lift":1.3381358727,"key":["s719602965","s173376033"]} +{"user_id":"u271934630","problem_id":"p03416","language":"python","submission_id_v0":"s986292698","submission_id_v1":"s820058882","cpu_time_v0":225,"cpu_time_v1":186,"memory_v0":40684,"memory_v1":40300,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = list(str(i))\n\n\n\n if l == list(reversed(l)):\n\n cnt += 1\n\n\n\nprint(cnt)\n\n\n# optimized version of the same code:\n","target":"A, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = str(i)\n\n if l == l[::-1]:\n\n cnt += 1\n\n\n\nprint(cnt)\n","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":155,"code_v1_num_chars":137,"code_v0_no_empty_lines":"A, B = list(map(int, input().split()))\ncnt = 0\nfor i in range(A, B + 1):\n l = list(str(i))\n if l == list(reversed(l)):\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\ncnt = 0\nfor i in range(A, B + 1):\n l = str(i)\n if l == l[::-1]:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["- l = list(str(i))","- if l == list(reversed(l)):","+ l = str(i)","+ if l == l[::-1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3457211592,"measured_runtime_v1":0.2683477015,"runtime_lift":1.2883328503,"key":["s986292698","s820058882"]} +{"user_id":"u680851063","problem_id":"p03363","language":"python","submission_id_v0":"s954809041","submission_id_v1":"s284059915","cpu_time_v0":905,"cpu_time_v1":166,"memory_v0":44692,"memory_v1":44492,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.66,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nfrom math import factorial\n\ndef combinations_count(n, r):\n\n return factorial(n) \/\/ (factorial(n - r) * factorial(r))\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += combinations_count(j,2)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += j * (j-1) \/\/ 2\n\n\n\nprint(ans)\n","code_v0_loc":25,"code_v1_loc":21,"code_v0_num_chars":487,"code_v1_num_chars":356,"code_v0_no_empty_lines":"n = int(eval(input()))\nary = list(map(int, input().split()))\n# print(n,ary)\nary_2 = [ary[0]]\nfor i in range(1, n):\n ary_2.append(ary[i] + ary_2[i - 1])\nary_2 = [0] + ary_2\n# print(ary_2)\nfrom collections import Counter\n\nc = Counter(ary_2)\nv = list(c.values())\n# print(v)\nfrom math import factorial\n\n\ndef combinations_count(n, r):\n return factorial(n) \/\/ (factorial(n - r) * factorial(r))\n\n\nans = 0\nfor j in v:\n if j > 1:\n ans += combinations_count(j, 2)\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nary = list(map(int, input().split()))\n# print(n,ary)\nary_2 = [ary[0]]\nfor i in range(1, n):\n ary_2.append(ary[i] + ary_2[i - 1])\nary_2 = [0] + ary_2\n# print(ary_2)\nfrom collections import Counter\n\nc = Counter(ary_2)\nv = list(c.values())\n# print(v)\nans = 0\nfor j in v:\n if j > 1:\n ans += j * (j - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.0,"diff":["-from math import factorial","-","-","-def combinations_count(n, r):","- return factorial(n) \/\/ (factorial(n - r) * factorial(r))","-","-","- ans += combinations_count(j, 2)","+ ans += j * (j - 1) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.2075043974,"measured_runtime_v1":0.0060842175,"runtime_lift":34.1053546165,"key":["s954809041","s284059915"]} +{"user_id":"u437215432","problem_id":"p02983","language":"python","submission_id_v0":"s509898718","submission_id_v1":"s212066250","cpu_time_v0":170,"cpu_time_v1":37,"memory_v0":12504,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.24,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\ndef ABC133C(l, r):\n\n Min = np.inf\n\n for i in range(l, r):\n\n for j in range(i+1, r+1):\n\n a = (i * j) % 2019\n\n if a < Min:\n\n Min = a\n\n if a == 0: # \u3053\u3053\u306b\u6ce8\u76ee\n\n print(Min)\n\n return\n\n print(Min)\n\n\n\nl, r = list(map(int, input().split()))\n\nABC133C(l, r)\n\n\n# optimized version of the same code:\n","target":"def ABC133C(l, r):\n\n Min = 1e10\n\n for i in range(l, r):\n\n for j in range(i+1, r+1):\n\n a = (i * j) % 2019\n\n if a < Min:\n\n Min = a\n\n if a == 0: # \u3053\u3053\u306b\u6ce8\u76ee\n\n print(Min)\n\n return\n\n print(Min)\n\n\n\nl, r = list(map(int, input().split()))\n\nABC133C(l, r)\n","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":366,"code_v1_num_chars":342,"code_v0_no_empty_lines":"import numpy as np\n\n\ndef ABC133C(l, r):\n Min = np.inf\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n a = (i * j) % 2019\n if a < Min:\n Min = a\n if a == 0: # \u3053\u3053\u306b\u6ce8\u76ee\n print(Min)\n return\n print(Min)\n\n\nl, r = list(map(int, input().split()))\nABC133C(l, r)\n","code_v1_no_empty_lines":"def ABC133C(l, r):\n Min = 1e10\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n a = (i * j) % 2019\n if a < Min:\n Min = a\n if a == 0: # \u3053\u3053\u306b\u6ce8\u76ee\n print(Min)\n return\n print(Min)\n\n\nl, r = list(map(int, input().split()))\nABC133C(l, r)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import numpy as np","-","-","- Min = np.inf","+ Min = 1e10"],"diff_only_import_comment":false,"measured_runtime_v0":3.2830341155,"measured_runtime_v1":0.4719189459,"runtime_lift":6.956775403,"key":["s509898718","s212066250"]} +{"user_id":"u761320129","problem_id":"p02792","language":"python","submission_id_v0":"s858070624","submission_id_v1":"s144947075","cpu_time_v0":459,"cpu_time_v1":184,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nmem = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\n\n\nd = [[0]*10 for i in range(10)]\n\nfor n in range(1,N+1):\n\n s = str(n)\n\n d[int(s[0])][int(s[-1])] += 1\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += d[i][j] * d[j][i]\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":11,"code_v0_num_chars":264,"code_v1_num_chars":227,"code_v0_no_empty_lines":"N = int(eval(input()))\nmem = [[0] * 10 for i in range(10)]\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n mem[a][b] += 1\nans = 0\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n ans += mem[b][a]\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nd = [[0] * 10 for i in range(10)]\nfor n in range(1, N + 1):\n s = str(n)\n d[int(s[0])][int(s[-1])] += 1\nans = 0\nfor i in range(10):\n for j in range(10):\n ans += d[i][j] * d[j][i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-mem = [[0] * 10 for i in range(10)]","-for i in range(1, N + 1):","- a = int(str(i)[0])","- b = int(str(i)[-1])","- mem[a][b] += 1","+d = [[0] * 10 for i in range(10)]","+for n in range(1, N + 1):","+ s = str(n)","+ d[int(s[0])][int(s[-1])] += 1","-for i in range(1, N + 1):","- a = int(str(i)[0])","- b = int(str(i)[-1])","- ans += mem[b][a]","+for i in range(10):","+ for j in range(10):","+ ans += d[i][j] * d[j][i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.4986082915,"measured_runtime_v1":0.3140420772,"runtime_lift":1.5877117355,"key":["s858070624","s144947075"]} +{"user_id":"u790012205","problem_id":"p03796","language":"python","submission_id_v0":"s234232673","submission_id_v1":"s468100683","cpu_time_v0":175,"cpu_time_v1":49,"memory_v0":38512,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\np = 1\n\nfor i in range(N):\n\n p *= (i + 1)\n\n p %= (1e9 + 7)\n\nprint((int(p)))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\np = 1\n\nfor i in range(N):\n\n p = p * (i + 1) % (1e9 + 7)\n\nprint((int(p)))","code_v0_loc":6,"code_v1_loc":5,"code_v0_num_chars":96,"code_v1_num_chars":91,"code_v0_no_empty_lines":"N = int(eval(input()))\np = 1\nfor i in range(N):\n p *= i + 1\n p %= 1e9 + 7\nprint((int(p)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\np = 1\nfor i in range(N):\n p = p * (i + 1) % (1e9 + 7)\nprint((int(p)))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["- p *= i + 1","- p %= 1e9 + 7","+ p = p * (i + 1) % (1e9 + 7)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4166263335,"measured_runtime_v1":0.2939343722,"runtime_lift":1.4174127727,"key":["s234232673","s468100683"]} +{"user_id":"u771634798","problem_id":"p02725","language":"python","submission_id_v0":"s591694965","submission_id_v1":"s705639429","cpu_time_v0":110,"cpu_time_v1":85,"memory_v0":32148,"memory_v1":32380,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\ndiff = []\n\n\n\nfor i in range(n - 1):\n\n diff.append(a[i + 1] - a[i])\n\ndiff.append(k - a[-1] + a[0])\n\n\n\nprint((k - max(diff)))\n\n\n# optimized version of the same code:\n","target":"k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\na.append(k + a[0])\n\ndiff = [a1 - a0 for a0, a1 in zip(a, a[1:])]\n\n\n\nprint((k - max(diff)))\n","code_v0_loc":10,"code_v1_loc":7,"code_v0_num_chars":198,"code_v1_num_chars":162,"code_v0_no_empty_lines":"k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\ndiff = []\nfor i in range(n - 1):\n diff.append(a[i + 1] - a[i])\ndiff.append(k - a[-1] + a[0])\nprint((k - max(diff)))\n","code_v1_no_empty_lines":"k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(k + a[0])\ndiff = [a1 - a0 for a0, a1 in zip(a, a[1:])]\nprint((k - max(diff)))\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-diff = []","-for i in range(n - 1):","- diff.append(a[i + 1] - a[i])","-diff.append(k - a[-1] + a[0])","+a.append(k + a[0])","+diff = [a1 - a0 for a0, a1 in zip(a, a[1:])]"],"diff_only_import_comment":false,"measured_runtime_v0":0.3387992765,"measured_runtime_v1":0.2554280306,"runtime_lift":1.3263981864,"key":["s591694965","s705639429"]} +{"user_id":"u562935282","problem_id":"p03253","language":"python","submission_id_v0":"s242343005","submission_id_v1":"s569938093","cpu_time_v0":72,"cpu_time_v1":23,"memory_v0":11380,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.06,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nclass Calc:\n\n def __init__(self, max_value, mod):\n\n \"\"\"combination(max_value, all)\"\"\"\n\n fact = [-1] * (max_value + 1)\n\n fact[0] = 1\n\n fact[1] = 1\n\n for x in range(2, max_value + 1):\n\n fact[x] = x * fact[x - 1] % mod\n\n\n\n invs = [1] * (max_value + 1)\n\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n\n for x in range(max_value - 1, 0, -1):\n\n invs[x] = invs[x + 1] * (x + 1) % mod\n\n\n\n self.fact = fact\n\n self.invs = invs\n\n self.mod = mod\n\n\n\n def combination(self, n, r):\n\n if n - r < r:\n\n return self.combination(n, n - r)\n\n if r < 0:\n\n return 0\n\n if r == 0:\n\n return 1\n\n if r == 1:\n\n return n\n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\n\n\n\ndef gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x \/\/= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n ma = d * d\n\n while ma <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x \/\/= d\n\n cnt += 1\n\n yield cnt\n\n ma += d * 4 + 4\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n cal = Calc(max_value=N + 30, mod=MOD)\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x \/\/= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n while d * d <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x \/\/= d\n\n cnt += 1\n\n yield cnt\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n for d in range(cnt):\n\n ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD\n\n \n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":69,"code_v1_loc":37,"code_v0_num_chars":1490,"code_v1_num_chars":619,"code_v0_no_empty_lines":"class Calc:\n def __init__(self, max_value, mod):\n \"\"\"combination(max_value, all)\"\"\"\n fact = [-1] * (max_value + 1)\n fact[0] = 1\n fact[1] = 1\n for x in range(2, max_value + 1):\n fact[x] = x * fact[x - 1] % mod\n invs = [1] * (max_value + 1)\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n for x in range(max_value - 1, 0, -1):\n invs[x] = invs[x + 1] * (x + 1) % mod\n self.fact = fact\n self.invs = invs\n self.mod = mod\n\n def combination(self, n, r):\n if n - r < r:\n return self.combination(n, n - r)\n if r < 0:\n return 0\n if r == 0:\n return 1\n if r == 1:\n return n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\ndef gen(n):\n x = n\n d = 2\n cnt = 0\n while x % d == 0:\n x \/\/= d\n cnt += 1\n yield cnt\n d = 3\n ma = d * d\n while ma <= n:\n cnt = 0\n while x % d == 0:\n x \/\/= d\n cnt += 1\n yield cnt\n ma += d * 4 + 4\n d += 2\n if x > 1:\n yield 1\n\n\ndef main():\n MOD = 10**9 + 7\n N, M = list(map(int, input().split()))\n cal = Calc(max_value=N + 30, mod=MOD)\n ans = 1\n for cnt in gen(M):\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def gen(n):\n x = n\n d = 2\n cnt = 0\n while x % d == 0:\n x \/\/= d\n cnt += 1\n yield cnt\n d = 3\n while d * d <= n:\n cnt = 0\n while x % d == 0:\n x \/\/= d\n cnt += 1\n yield cnt\n d += 2\n if x > 1:\n yield 1\n\n\ndef main():\n MOD = 10**9 + 7\n N, M = list(map(int, input().split()))\n ans = 1\n for cnt in gen(M):\n for d in range(cnt):\n ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":46.3768115942,"diff":["-class Calc:","- def __init__(self, max_value, mod):","- \"\"\"combination(max_value, all)\"\"\"","- fact = [-1] * (max_value + 1)","- fact[0] = 1","- fact[1] = 1","- for x in range(2, max_value + 1):","- fact[x] = x * fact[x - 1] % mod","- invs = [1] * (max_value + 1)","- invs[max_value] = pow(fact[max_value], mod - 2, mod)","- for x in range(max_value - 1, 0, -1):","- invs[x] = invs[x + 1] * (x + 1) % mod","- self.fact = fact","- self.invs = invs","- self.mod = mod","-","- def combination(self, n, r):","- if n - r < r:","- return self.combination(n, n - r)","- if r < 0:","- return 0","- if r == 0:","- return 1","- if r == 1:","- return n","- return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod","-","-","- ma = d * d","- while ma <= n:","+ while d * d <= n:","- ma += d * 4 + 4","- cal = Calc(max_value=N + 30, mod=MOD)","- ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD","+ for d in range(cnt):","+ ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.5542220466,"measured_runtime_v1":0.3755235486,"runtime_lift":1.4758649588,"key":["s242343005","s569938093"]} +{"user_id":"u952708174","problem_id":"p02983","language":"python","submission_id_v0":"s271837395","submission_id_v1":"s778364451","cpu_time_v0":612,"cpu_time_v1":51,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))\n\n# optimized version of the same code:\n","target":"def c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n if ans == 0:\n\n return 0\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":308,"code_v1_num_chars":360,"code_v0_no_empty_lines":"def c_remainder_minimization_2019(L, R):\n ans = float(\"inf\")\n for i in range(L, min(R, L + 2019)):\n for j in range(i + 1, min(R + 1, L + 2020)):\n ans = min(ans, (i * j) % 2019)\n return ans\n\n\nL, R = [int(i) for i in input().split()]\nprint((c_remainder_minimization_2019(L, R)))\n","code_v1_no_empty_lines":"def c_remainder_minimization_2019(L, R):\n ans = float(\"inf\")\n for i in range(L, min(R, L + 2019)):\n for j in range(i + 1, min(R + 1, L + 2020)):\n ans = min(ans, (i * j) % 2019)\n if ans == 0:\n return 0\n return ans\n\n\nL, R = [int(i) for i in input().split()]\nprint((c_remainder_minimization_2019(L, R)))\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["+ if ans == 0:","+ return 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.3551982943,"measured_runtime_v1":0.2038855975,"runtime_lift":1.7421450986,"key":["s271837395","s778364451"]} +{"user_id":"u562935282","problem_id":"p03371","language":"python","submission_id_v0":"s950527789","submission_id_v1":"s848046688","cpu_time_v0":119,"cpu_time_v1":19,"memory_v0":3060,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c, x, y = list(map(int, input().split()))\n\nval = float('inf')\n\nfor k in range(10 ** 5 + 1):\n\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\n\nprint(val)\n\n# optimized version of the same code:\n","target":"A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 0\n\nans += min(A + B, 2 * C) * min(X, Y)\n\nif X > Y:\n\n ans += min(A, 2 * C) * (X - Y)\n\nelif X < Y:\n\n ans += min(B, 2 * C) * (Y - X)\n\nprint(ans)\n","code_v0_loc":5,"code_v1_loc":9,"code_v0_num_chars":174,"code_v1_num_chars":199,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nval = float(\"inf\")\nfor k in range(10**5 + 1):\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\nprint(val)\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nans = 0\nans += min(A + B, 2 * C) * min(X, Y)\nif X > Y:\n ans += min(A, 2 * C) * (X - Y)\nelif X < Y:\n ans += min(B, 2 * C) * (Y - X)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-a, b, c, x, y = list(map(int, input().split()))","-val = float(\"inf\")","-for k in range(10**5 + 1):","- val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)","-print(val)","+A, B, C, X, Y = list(map(int, input().split()))","+ans = 0","+ans += min(A + B, 2 * C) * min(X, Y)","+if X > Y:","+ ans += min(A, 2 * C) * (X - Y)","+elif X < Y:","+ ans += min(B, 2 * C) * (Y - X)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3470396991,"measured_runtime_v1":0.2883047278,"runtime_lift":4.6722775216,"key":["s950527789","s848046688"]} +{"user_id":"u163320134","problem_id":"p02690","language":"python","submission_id_v0":"s506243349","submission_id_v1":"s621495959","cpu_time_v0":131,"cpu_time_v1":40,"memory_v0":38348,"memory_v1":9100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.47,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx=int(eval(input()))\n\ndic={}\n\nfor i in range(10**5):\n\n dic[i**5]=i\n\n dic[(-i)**5]=-i\n\nfor i in range(10**5):\n\n if i**5+x in dic:\n\n print((dic[i**5+x],i))\n\n break\n\n if (-i)**5+x in dic:\n\n print((dic[(-i)**5+x],-i))\n\n break\n\n# optimized version of the same code:\n","target":"x=int(eval(input()))\n\nfor a in range(-118,120):\n\n for b in range(-119,119):\n\n if a**5-b**5==x:\n\n print((a,b))\n\n exit()","code_v0_loc":12,"code_v1_loc":6,"code_v0_num_chars":239,"code_v1_num_chars":124,"code_v0_no_empty_lines":"x = int(eval(input()))\ndic = {}\nfor i in range(10**5):\n dic[i**5] = i\n dic[(-i) ** 5] = -i\nfor i in range(10**5):\n if i**5 + x in dic:\n print((dic[i**5 + x], i))\n break\n if (-i) ** 5 + x in dic:\n print((dic[(-i) ** 5 + x], -i))\n break\n","code_v1_no_empty_lines":"x = int(eval(input()))\nfor a in range(-118, 120):\n for b in range(-119, 119):\n if a**5 - b**5 == x:\n print((a, b))\n exit()\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-dic = {}","-for i in range(10**5):","- dic[i**5] = i","- dic[(-i) ** 5] = -i","-for i in range(10**5):","- if i**5 + x in dic:","- print((dic[i**5 + x], i))","- break","- if (-i) ** 5 + x in dic:","- print((dic[(-i) ** 5 + x], -i))","- break","+for a in range(-118, 120):","+ for b in range(-119, 119):","+ if a**5 - b**5 == x:","+ print((a, b))","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":1.2600205839,"measured_runtime_v1":0.3441586594,"runtime_lift":3.6611619365,"key":["s506243349","s621495959"]} +{"user_id":"u869919400","problem_id":"p03796","language":"python","submission_id_v0":"s127994042","submission_id_v1":"s163960956","cpu_time_v0":229,"cpu_time_v1":37,"memory_v0":3984,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.84,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import factorial as f\n\nn = int(eval(input()))\n\nprint((f(n) % (10 ** 9 + 7)))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\np = 1\n\nfor i in range(n):\n\n p = (p * (i+1)) % (10 ** 9 + 7)\n\nprint(p)","code_v0_loc":3,"code_v1_loc":5,"code_v0_num_chars":78,"code_v1_num_chars":90,"code_v0_no_empty_lines":"from math import factorial as f\n\nn = int(eval(input()))\nprint((f(n) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\np = 1\nfor i in range(n):\n p = (p * (i + 1)) % (10**9 + 7)\nprint(p)\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-from math import factorial as f","-","-print((f(n) % (10**9 + 7)))","+p = 1","+for i in range(n):","+ p = (p * (i + 1)) % (10**9 + 7)","+print(p)"],"diff_only_import_comment":false,"measured_runtime_v0":0.8111317687,"measured_runtime_v1":0.3589184887,"runtime_lift":2.2599330882,"key":["s127994042","s163960956"]} +{"user_id":"u102461423","problem_id":"p02649","language":"python","submission_id_v0":"s280841683","submission_id_v1":"s122055425","cpu_time_v0":644,"cpu_time_v1":575,"memory_v0":110324,"memory_v1":110580,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\nfrom numba import njit\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n@njit('(i4[::1],i4,i8[::1])', cache=True)\n\ndef main(A, B, C):\n\n counts = np.zeros(1 << 18, np.int32)\n\n popcount = np.zeros(1 << B, np.int32)\n\n for i in range(B):\n\n popcount[1 << i:1 << i + 1] = popcount[:1 << i] + 1\n\n\n\n answer = 0\n\n for i in range(1 << B):\n\n k = popcount[i]\n\n t = 0\n\n for x in A & i:\n\n n = counts[x]\n\n counts[x] += 1\n\n t -= C[n]\n\n t += C[n + 1]\n\n for x in A & i:\n\n counts[x] = 0\n\n if k & 1:\n\n t = -t\n\n answer += t\n\n return answer\n\n\n\nN, K, S, T = list(map(int, readline().split()))\n\nA = np.array(readline().split(), np.int32)\n\n\n\ndef convert_problem(S, T, A):\n\n ng = np.zeros(len(A), np.bool)\n\n B = np.zeros_like(A)\n\n n = 0\n\n for i in range(18):\n\n s, t = (S >> i) & 1, (T >> i) & 1\n\n if (s, t) == (0, 0):\n\n ng |= ((A >> i) & 1) == 1\n\n elif (s, t) == (1, 1):\n\n ng |= ((A >> i) & 1) == 0\n\n elif (s, t) == (1, 0):\n\n print((0))\n\n exit()\n\n else:\n\n B += ((A >> i) & 1) << n\n\n n += 1\n\n return B[~ng], n\n\n\n\nA, B = convert_problem(S, T, A)\n\n\n\nC = np.zeros((100, 100), np.int64)\n\nC[0, 0] = 1\n\nfor n in range(1, 100):\n\n C[n, :-1] += C[n - 1, :-1]\n\n C[n, 1:] += C[n - 1, :-1]\n\nC = C[:, 1:K + 1].sum(axis=1)\n\n\n\nprint((main(A, B, C)))\n\n# optimized version of the same code:\n","target":"import sys\n\nimport numpy as np\n\nfrom numba import njit\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n@njit('(i4[::1],i4,i8[::1])', cache=True)\n\ndef main(A, B, C):\n\n counts = np.zeros(1 << 18, np.int32)\n\n popcount = np.zeros(1 << B, np.int32)\n\n for i in range(B):\n\n popcount[1 << i:1 << i + 1] = popcount[:1 << i] + 1\n\n\n\n answer = 0\n\n for i in range(1 << B):\n\n k = popcount[i]\n\n t = 0\n\n for x in A & i:\n\n n = counts[x]\n\n counts[x] += 1\n\n t -= C[n]\n\n t += C[n + 1]\n\n for x in A & i:\n\n counts[x] = 0\n\n if k & 1:\n\n t = -t\n\n answer += t\n\n return answer\n\n \n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n from numba.pycc import CC\n\n cc = CC('my_module')\n\n cc.export('main', '(i4[::1],i4,i8[::1])')(main)\n\n cc.compile()\n\n exit()\n\nfrom my_module import main\n\n\n\nN, K, S, T = list(map(int, readline().split()))\n\nA = np.array(readline().split(), np.int32)\n\n\n\ndef convert_problem(S, T, A):\n\n ng = np.zeros(len(A), np.bool)\n\n B = np.zeros_like(A)\n\n n = 0\n\n for i in range(18):\n\n s, t = (S >> i) & 1, (T >> i) & 1\n\n if (s, t) == (0, 0):\n\n ng |= ((A >> i) & 1) == 1\n\n elif (s, t) == (1, 1):\n\n ng |= ((A >> i) & 1) == 0\n\n elif (s, t) == (1, 0):\n\n print((0))\n\n exit()\n\n else:\n\n B += ((A >> i) & 1) << n\n\n n += 1\n\n return B[~ng], n\n\n\n\nA, B = convert_problem(S, T, A)\n\n\n\nC = np.zeros((100, 100), np.int64)\n\nC[0, 0] = 1\n\nfor n in range(1, 100):\n\n C[n, :-1] += C[n - 1, :-1]\n\n C[n, 1:] += C[n - 1, :-1]\n\nC = C[:, 1:K + 1].sum(axis=1)\n\n\n\nprint((main(A, B, C)))","code_v0_loc":62,"code_v1_loc":70,"code_v0_num_chars":1548,"code_v1_num_chars":1756,"code_v0_no_empty_lines":"import sys\nimport numpy as np\nfrom numba import njit\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\n@njit(\"(i4[::1],i4,i8[::1])\", cache=True)\ndef main(A, B, C):\n counts = np.zeros(1 << 18, np.int32)\n popcount = np.zeros(1 << B, np.int32)\n for i in range(B):\n popcount[1 << i : 1 << i + 1] = popcount[: 1 << i] + 1\n answer = 0\n for i in range(1 << B):\n k = popcount[i]\n t = 0\n for x in A & i:\n n = counts[x]\n counts[x] += 1\n t -= C[n]\n t += C[n + 1]\n for x in A & i:\n counts[x] = 0\n if k & 1:\n t = -t\n answer += t\n return answer\n\n\nN, K, S, T = list(map(int, readline().split()))\nA = np.array(readline().split(), np.int32)\n\n\ndef convert_problem(S, T, A):\n ng = np.zeros(len(A), np.bool)\n B = np.zeros_like(A)\n n = 0\n for i in range(18):\n s, t = (S >> i) & 1, (T >> i) & 1\n if (s, t) == (0, 0):\n ng |= ((A >> i) & 1) == 1\n elif (s, t) == (1, 1):\n ng |= ((A >> i) & 1) == 0\n elif (s, t) == (1, 0):\n print((0))\n exit()\n else:\n B += ((A >> i) & 1) << n\n n += 1\n return B[~ng], n\n\n\nA, B = convert_problem(S, T, A)\nC = np.zeros((100, 100), np.int64)\nC[0, 0] = 1\nfor n in range(1, 100):\n C[n, :-1] += C[n - 1, :-1]\n C[n, 1:] += C[n - 1, :-1]\nC = C[:, 1 : K + 1].sum(axis=1)\nprint((main(A, B, C)))\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\nfrom numba import njit\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\n@njit(\"(i4[::1],i4,i8[::1])\", cache=True)\ndef main(A, B, C):\n counts = np.zeros(1 << 18, np.int32)\n popcount = np.zeros(1 << B, np.int32)\n for i in range(B):\n popcount[1 << i : 1 << i + 1] = popcount[: 1 << i] + 1\n answer = 0\n for i in range(1 << B):\n k = popcount[i]\n t = 0\n for x in A & i:\n n = counts[x]\n counts[x] += 1\n t -= C[n]\n t += C[n + 1]\n for x in A & i:\n counts[x] = 0\n if k & 1:\n t = -t\n answer += t\n return answer\n\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n from numba.pycc import CC\n\n cc = CC(\"my_module\")\n cc.export(\"main\", \"(i4[::1],i4,i8[::1])\")(main)\n cc.compile()\n exit()\nfrom my_module import main\n\nN, K, S, T = list(map(int, readline().split()))\nA = np.array(readline().split(), np.int32)\n\n\ndef convert_problem(S, T, A):\n ng = np.zeros(len(A), np.bool)\n B = np.zeros_like(A)\n n = 0\n for i in range(18):\n s, t = (S >> i) & 1, (T >> i) & 1\n if (s, t) == (0, 0):\n ng |= ((A >> i) & 1) == 1\n elif (s, t) == (1, 1):\n ng |= ((A >> i) & 1) == 0\n elif (s, t) == (1, 0):\n print((0))\n exit()\n else:\n B += ((A >> i) & 1) << n\n n += 1\n return B[~ng], n\n\n\nA, B = convert_problem(S, T, A)\nC = np.zeros((100, 100), np.int64)\nC[0, 0] = 1\nfor n in range(1, 100):\n C[n, :-1] += C[n - 1, :-1]\n C[n, 1:] += C[n - 1, :-1]\nC = C[:, 1 : K + 1].sum(axis=1)\nprint((main(A, B, C)))\n","code_same":false,"relative_loc_diff_percent":11.4285714286,"diff":["+if sys.argv[-1] == \"ONLINE_JUDGE\":","+ from numba.pycc import CC","+","+ cc = CC(\"my_module\")","+ cc.export(\"main\", \"(i4[::1],i4,i8[::1])\")(main)","+ cc.compile()","+ exit()","+from my_module import main","+"],"diff_only_import_comment":false,"measured_runtime_v0":1.8857788267,"measured_runtime_v1":1.3703739867,"runtime_lift":1.3761052421,"key":["s280841683","s122055425"]} +{"user_id":"u227082700","problem_id":"p03039","language":"python","submission_id_v0":"s481435936","submission_id_v1":"s241948863","cpu_time_v0":1746,"cpu_time_v1":149,"memory_v0":11052,"memory_v1":16752,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.47,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,m,k=list(map(int,input().split()))\n\nmod=10**9+7\n\nf=[1]\n\nfor i in range(2*10**5+7):f+=[f[-1]*(i+1)%mod]\n\ndef comb(a,b):return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod\n\nans=0\n\nfor i in range(1,n):\n\n ans+=(i*(n-i)*m**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nfor i in range(1,m):\n\n ans+=(i*(m-i)*n**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n,m,k=list(map(int,input().split()))\n\n\n\nmod = 10**9+7\n\nf = [1]\n\nfor i in range(n*m):\n\n f += [f[-1]*(i+1) % mod]\n\ndef comb(a, b):\n\n return f[a]*pow(f[b], mod-2, mod)*pow(f[a-b], mod-2, mod) % mod\n\n\n\nans=0\n\nfor dist in range(1,n):\n\n c=n-dist\n\n p=(c*m*m)%mod\n\n ans+=p*dist\n\nfor dist in range(1,m):\n\n c=m-dist\n\n p=(c*n*n)%mod\n\n ans+=p*dist\n\nans%=mod\n\nprint((ans*comb(n*m-2,k-2)%mod))","code_v0_loc":13,"code_v1_loc":20,"code_v0_num_chars":340,"code_v1_num_chars":379,"code_v0_no_empty_lines":"n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nf = [1]\nfor i in range(2 * 10**5 + 7):\n f += [f[-1] * (i + 1) % mod]\n\n\ndef comb(a, b):\n return f[a] * pow(f[b], mod - 2, mod) * pow(f[a - b], mod - 2, mod) % mod\n\n\nans = 0\nfor i in range(1, n):\n ans += (i * (n - i) * m**2) * (comb(n * m - 2, k - 2))\n ans %= mod\nfor i in range(1, m):\n ans += (i * (m - i) * n**2) * (comb(n * m - 2, k - 2))\n ans %= mod\nprint(ans)\n","code_v1_no_empty_lines":"n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nf = [1]\nfor i in range(n * m):\n f += [f[-1] * (i + 1) % mod]\n\n\ndef comb(a, b):\n return f[a] * pow(f[b], mod - 2, mod) * pow(f[a - b], mod - 2, mod) % mod\n\n\nans = 0\nfor dist in range(1, n):\n c = n - dist\n p = (c * m * m) % mod\n ans += p * dist\nfor dist in range(1, m):\n c = m - dist\n p = (c * n * n) % mod\n ans += p * dist\nans %= mod\nprint((ans * comb(n * m - 2, k - 2) % mod))\n","code_same":false,"relative_loc_diff_percent":35.0,"diff":["-for i in range(2 * 10**5 + 7):","+for i in range(n * m):","-for i in range(1, n):","- ans += (i * (n - i) * m**2) * (comb(n * m - 2, k - 2))","- ans %= mod","-for i in range(1, m):","- ans += (i * (m - i) * n**2) * (comb(n * m - 2, k - 2))","- ans %= mod","-print(ans)","+for dist in range(1, n):","+ c = n - dist","+ p = (c * m * m) % mod","+ ans += p * dist","+for dist in range(1, m):","+ c = m - dist","+ p = (c * n * n) % mod","+ ans += p * dist","+ans %= mod","+print((ans * comb(n * m - 2, k - 2) % mod))"],"diff_only_import_comment":false,"measured_runtime_v0":0.907170742,"measured_runtime_v1":0.2339973826,"runtime_lift":3.8768414063,"key":["s481435936","s241948863"]} +{"user_id":"u987164499","problem_id":"p03273","language":"python","submission_id_v0":"s696147047","submission_id_v1":"s878437113","cpu_time_v0":159,"cpu_time_v1":23,"memory_v0":12512,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom sys import stdin\n\nimport numpy as np\n\n\n\nh,w= [int(x) for x in stdin.readline().rstrip().split()]\n\n\n\nli = [[\"\" for i in range(w)]for j in range(h)]\n\n\n\nfor i in range(h):\n\n s = stdin.readline().rstrip()\n\n for j in range(w):\n\n li[i][j] = s[j]\n\n\n\nli = np.asarray([s for s in li if s != ['.']*w]).T.tolist()\n\nli = np.asarray([s for s in li if s != ['.']*len(li[0])]).T.tolist()\n\n\n\nfor i in li:\n\n s = \"\"\n\n for j in range(len(li[0])):\n\n s += i[j]\n\n print(s)\n\n# optimized version of the same code:\n","target":"from sys import stdin,setrecursionlimit\n\nsetrecursionlimit(10 ** 7)\n\nh,w = list(map(int,stdin.readline().rstrip().split()))\n\nli = [[\"\" for i in range(w)]for j in range(h)]\n\nfor i in range(h):\n\n s = stdin.readline().rstrip()\n\n for j in range(w):\n\n li[i][j] = s[j]\n\nlin = []\n\nfor i in li:\n\n if i != [\".\"]*w:\n\n lin.append(i)\n\nout = []\n\nfor i in range(w):\n\n flag = True\n\n for j in range(len(lin)):\n\n if lin[j][i] == \"#\":\n\n flag = False\n\n if flag:\n\n out.append(i)\n\n\n\nlis = []\n\nfor i in lin:\n\n case = []\n\n for j,k in enumerate(i):\n\n if j in out:\n\n continue\n\n case.append(k)\n\n lis.append(case)\n\n\n\nfor i in lis:\n\n print((\"\".join(i)))","code_v0_loc":20,"code_v1_loc":32,"code_v0_num_chars":484,"code_v1_num_chars":711,"code_v0_no_empty_lines":"from sys import stdin\nimport numpy as np\n\nh, w = [int(x) for x in stdin.readline().rstrip().split()]\nli = [[\"\" for i in range(w)] for j in range(h)]\nfor i in range(h):\n s = stdin.readline().rstrip()\n for j in range(w):\n li[i][j] = s[j]\nli = np.asarray([s for s in li if s != [\".\"] * w]).T.tolist()\nli = np.asarray([s for s in li if s != [\".\"] * len(li[0])]).T.tolist()\nfor i in li:\n s = \"\"\n for j in range(len(li[0])):\n s += i[j]\n print(s)\n","code_v1_no_empty_lines":"from sys import stdin, setrecursionlimit\n\nsetrecursionlimit(10**7)\nh, w = list(map(int, stdin.readline().rstrip().split()))\nli = [[\"\" for i in range(w)] for j in range(h)]\nfor i in range(h):\n s = stdin.readline().rstrip()\n for j in range(w):\n li[i][j] = s[j]\nlin = []\nfor i in li:\n if i != [\".\"] * w:\n lin.append(i)\nout = []\nfor i in range(w):\n flag = True\n for j in range(len(lin)):\n if lin[j][i] == \"#\":\n flag = False\n if flag:\n out.append(i)\nlis = []\nfor i in lin:\n case = []\n for j, k in enumerate(i):\n if j in out:\n continue\n case.append(k)\n lis.append(case)\nfor i in lis:\n print((\"\".join(i)))\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-from sys import stdin","-import numpy as np","+from sys import stdin, setrecursionlimit","-h, w = [int(x) for x in stdin.readline().rstrip().split()]","+setrecursionlimit(10**7)","+h, w = list(map(int, stdin.readline().rstrip().split()))","-li = np.asarray([s for s in li if s != [\".\"] * w]).T.tolist()","-li = np.asarray([s for s in li if s != [\".\"] * len(li[0])]).T.tolist()","+lin = []","- s = \"\"","- for j in range(len(li[0])):","- s += i[j]","- print(s)","+ if i != [\".\"] * w:","+ lin.append(i)","+out = []","+for i in range(w):","+ flag = True","+ for j in range(len(lin)):","+ if lin[j][i] == \"#\":","+ flag = False","+ if flag:","+ out.append(i)","+lis = []","+for i in lin:","+ case = []","+ for j, k in enumerate(i):","+ if j in out:","+ continue","+ case.append(k)","+ lis.append(case)","+for i in lis:","+ print((\"\".join(i)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.5214503652,"measured_runtime_v1":0.1999706806,"runtime_lift":7.6083671913,"key":["s696147047","s878437113"]} +{"user_id":"u617203831","problem_id":"p03796","language":"python","submission_id_v0":"s015060265","submission_id_v1":"s192076282","cpu_time_v0":230,"cpu_time_v1":40,"memory_v0":3980,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nprint((math.factorial(int(eval(input())))%(10**9+7)))\n\n# optimized version of the same code:\n","target":"ans=1\n\nn=int(eval(input()))\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)","code_v0_loc":2,"code_v1_loc":6,"code_v0_num_chars":58,"code_v1_num_chars":88,"code_v0_no_empty_lines":"import math\n\nprint((math.factorial(int(eval(input()))) % (10**9 + 7)))\n","code_v1_no_empty_lines":"ans = 1\nn = int(eval(input()))\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-import math","-","-print((math.factorial(int(eval(input()))) % (10**9 + 7)))","+ans = 1","+n = int(eval(input()))","+for i in range(1, n + 1):","+ ans *= i","+ ans = ans % (10**9 + 7)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.7955839839,"measured_runtime_v1":0.4261377716,"runtime_lift":1.866964247,"key":["s015060265","s192076282"]} +{"user_id":"u844789719","problem_id":"p03371","language":"python","submission_id_v0":"s272710522","submission_id_v1":"s867287513","cpu_time_v0":94,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA, B, C, X, Y = [int(_) for _ in input().split()]\n\nans = A * X + B * Y\n\nfor i in range(max(X, Y) + 1):\n\n cost = 2 * C * i\n\n if X > i:\n\n cost += A * (X - i)\n\n if Y > i:\n\n cost += B * (Y - i)\n\n ans = min(ans, cost)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"A, B, C, X, Y = [int(_) for _ in input().split()]\n\nM = max(X, Y)\n\nprint((min(2 * C * M, 2 * C * (X + Y - M) + A *\n\n (M - Y) + B * (M - X), A * X + B * Y)))\n","code_v0_loc":10,"code_v1_loc":4,"code_v0_num_chars":250,"code_v1_num_chars":163,"code_v0_no_empty_lines":"A, B, C, X, Y = [int(_) for _ in input().split()]\nans = A * X + B * Y\nfor i in range(max(X, Y) + 1):\n cost = 2 * C * i\n if X > i:\n cost += A * (X - i)\n if Y > i:\n cost += B * (Y - i)\n ans = min(ans, cost)\nprint(ans)\n","code_v1_no_empty_lines":"A, B, C, X, Y = [int(_) for _ in input().split()]\nM = max(X, Y)\nprint((min(2 * C * M, 2 * C * (X + Y - M) + A * (M - Y) + B * (M - X), A * X + B * Y)))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-ans = A * X + B * Y","-for i in range(max(X, Y) + 1):","- cost = 2 * C * i","- if X > i:","- cost += A * (X - i)","- if Y > i:","- cost += B * (Y - i)","- ans = min(ans, cost)","-print(ans)","+M = max(X, Y)","+print((min(2 * C * M, 2 * C * (X + Y - M) + A * (M - Y) + B * (M - X), A * X + B * Y)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5275072498,"measured_runtime_v1":0.332789422,"runtime_lift":1.5851082243,"key":["s272710522","s867287513"]} +{"user_id":"u678167152","problem_id":"p02899","language":"python","submission_id_v0":"s907108803","submission_id_v1":"s636537863","cpu_time_v0":642,"cpu_time_v1":86,"memory_v0":23368,"memory_v1":20468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.6,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\ninds = numpy.argsort(A)\n\ninds+=1\n\nfor ind in inds:\n\n print(ind, end=' ')\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nans = [0]*N\n\nfor i,a in enumerate(A):\n\n ans[a-1] = i+1\n\nprint((*ans))","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":142,"code_v1_num_chars":123,"code_v0_no_empty_lines":"import numpy\n\nN = int(input())\nA = list(map(int, input().split()))\ninds = numpy.argsort(A)\ninds += 1\nfor ind in inds:\n print(ind, end=\" \")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nans = [0] * N\nfor i, a in enumerate(A):\n ans[a - 1] = i + 1\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-import numpy","-","-N = int(input())","+N = int(eval(input()))","-inds = numpy.argsort(A)","-inds += 1","-for ind in inds:","- print(ind, end=\" \")","+ans = [0] * N","+for i, a in enumerate(A):","+ ans[a - 1] = i + 1","+print((*ans))"],"diff_only_import_comment":false,"measured_runtime_v0":1.787777245,"measured_runtime_v1":0.2704045452,"runtime_lift":6.6114911046,"key":["s907108803","s636537863"]} +{"user_id":"u691018832","problem_id":"p03945","language":"python","submission_id_v0":"s808413359","submission_id_v1":"s766599872","cpu_time_v0":84,"cpu_time_v1":46,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.24,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = eval(input())\n\nlen_s = len(s)\n\ncnt = [0, 0]\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n memo_1 = s[len_s - i]\n\n if s[i] != memo_0:\n\n cnt[0] += 1\n\n if s[len_s - i - 1] != memo_1:\n\n cnt[1] += 1\n\nprint((min(cnt)))\n\n\n# optimized version of the same code:\n","target":"s = eval(input())\n\nlen_s = len(s)\n\ncnt = 0\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n if s[i] != memo_0:\n\n cnt += 1\n\nprint(cnt)\n","code_v0_loc":11,"code_v1_loc":8,"code_v0_num_chars":239,"code_v1_num_chars":142,"code_v0_no_empty_lines":"s = eval(input())\nlen_s = len(s)\ncnt = [0, 0]\nfor i in range(1, len(s)):\n memo_0 = s[i - 1]\n memo_1 = s[len_s - i]\n if s[i] != memo_0:\n cnt[0] += 1\n if s[len_s - i - 1] != memo_1:\n cnt[1] += 1\nprint((min(cnt)))\n","code_v1_no_empty_lines":"s = eval(input())\nlen_s = len(s)\ncnt = 0\nfor i in range(1, len(s)):\n memo_0 = s[i - 1]\n if s[i] != memo_0:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-cnt = [0, 0]","+cnt = 0","- memo_1 = s[len_s - i]","- cnt[0] += 1","- if s[len_s - i - 1] != memo_1:","- cnt[1] += 1","-print((min(cnt)))","+ cnt += 1","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3379861441,"measured_runtime_v1":0.264947257,"runtime_lift":1.2756733088,"key":["s808413359","s766599872"]} +{"user_id":"u832039789","problem_id":"p03371","language":"python","submission_id_v0":"s033280454","submission_id_v1":"s671785140","cpu_time_v0":346,"cpu_time_v1":137,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.4,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\na,b,c,x,y = list(map(int,input().split()))\n\n\n\n# c\u3092\u5168\u63a2\u7d22\uff1f\n\nres = float('inf')\n\nfor i in range(max(x,y)*2+1):\n\n money = i * c\n\n if i\/2=1:\n\n x = j-1\n\n else:\n\n x = 0\n\n if cnt==a:break\n\n if cnt==a:break\n\n d=\"R\"\n\n if x==W-1:\n\n if C[y][x]!=0:\n\n y += 1\n\n d=\"L\"\n\n elif x==0:\n\n if C[y][x]!=0:\n\n y += 1\n\n d=\"R\"\n\n cur = [y,x,d] \n\nfor i in range(H):\n\n print((*C[i]))\n\n# optimized version of the same code:\n","target":"H,W = list(map(int,input().split()))\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nA.insert(0,0)\n\nB = [[0 for _ in range(W)] for _ in range(H)]\n\ncol = 1\n\ncnt = 0\n\ny = 0\n\nx = 0\n\nd = \"R\"\n\nwhile y0:\n\n x -= 1\n\n elif d==\"L\" and x==0:\n\n y += 1\n\n d = \"R\"\n\nfor i in range(H):\n\n print((*B[i]))","code_v0_loc":46,"code_v1_loc":31,"code_v0_num_chars":1123,"code_v1_num_chars":591,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\nN = int(eval(input()))\nA = list(map(int, input().split()))\nA.insert(0, 0)\nC = [[0 for _ in range(W)] for _ in range(H)]\ncur = [0, 0, \"R\"]\nfor k in range(1, N + 1):\n # ipdb.set_trace()\n a = A[k]\n cnt = 0\n y, x, d = cur\n for i in range(y, H):\n y = i\n if d == \"R\":\n for j in range(x, W):\n C[i][j] = str(k)\n cnt += 1\n if j + 1 < W:\n x = j + 1\n else:\n x = j\n if cnt == a:\n break\n if cnt == a:\n break\n d = \"L\"\n else:\n for j in range(x, -1, -1):\n C[i][j] = str(k)\n cnt += 1\n if j >= 1:\n x = j - 1\n else:\n x = 0\n if cnt == a:\n break\n if cnt == a:\n break\n d = \"R\"\n if x == W - 1:\n if C[y][x] != 0:\n y += 1\n d = \"L\"\n elif x == 0:\n if C[y][x] != 0:\n y += 1\n d = \"R\"\n cur = [y, x, d]\nfor i in range(H):\n print((*C[i]))\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nN = int(eval(input()))\nA = list(map(int, input().split()))\nA.insert(0, 0)\nB = [[0 for _ in range(W)] for _ in range(H)]\ncol = 1\ncnt = 0\ny = 0\nx = 0\nd = \"R\"\nwhile y < H:\n if cnt < A[col]:\n B[y][x] = col\n cnt += 1\n else:\n col += 1\n cnt = 0\n B[y][x] = col\n cnt += 1\n if x < W - 1 and d == \"R\":\n x += 1\n elif x == W - 1 and d == \"R\":\n y += 1\n d = \"L\"\n elif d == \"L\" and x > 0:\n x -= 1\n elif d == \"L\" and x == 0:\n y += 1\n d = \"R\"\nfor i in range(H):\n print((*B[i]))\n","code_same":false,"relative_loc_diff_percent":32.6086956522,"diff":["-C = [[0 for _ in range(W)] for _ in range(H)]","-cur = [0, 0, \"R\"]","-for k in range(1, N + 1):","- # ipdb.set_trace()","- a = A[k]","- cnt = 0","- y, x, d = cur","- for i in range(y, H):","- y = i","- if d == \"R\":","- for j in range(x, W):","- C[i][j] = str(k)","- cnt += 1","- if j + 1 < W:","- x = j + 1","- else:","- x = j","- if cnt == a:","- break","- if cnt == a:","- break","- d = \"L\"","- else:","- for j in range(x, -1, -1):","- C[i][j] = str(k)","- cnt += 1","- if j >= 1:","- x = j - 1","- else:","- x = 0","- if cnt == a:","- break","- if cnt == a:","- break","- d = \"R\"","- if x == W - 1:","- if C[y][x] != 0:","- y += 1","- d = \"L\"","- elif x == 0:","- if C[y][x] != 0:","- y += 1","- d = \"R\"","- cur = [y, x, d]","+B = [[0 for _ in range(W)] for _ in range(H)]","+col = 1","+cnt = 0","+y = 0","+x = 0","+d = \"R\"","+while y < H:","+ if cnt < A[col]:","+ B[y][x] = col","+ cnt += 1","+ else:","+ col += 1","+ cnt = 0","+ B[y][x] = col","+ cnt += 1","+ if x < W - 1 and d == \"R\":","+ x += 1","+ elif x == W - 1 and d == \"R\":","+ y += 1","+ d = \"L\"","+ elif d == \"L\" and x > 0:","+ x -= 1","+ elif d == \"L\" and x == 0:","+ y += 1","+ d = \"R\"","- print((*C[i]))","+ print((*B[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3307979391,"measured_runtime_v1":0.2498238492,"runtime_lift":1.3241247387,"key":["s119147613","s968932958"]} +{"user_id":"u095021077","problem_id":"p03000","language":"python","submission_id_v0":"s539723186","submission_id_v1":"s999737072","cpu_time_v0":153,"cpu_time_v1":18,"memory_v0":12468,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.24,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\ntemp=list(map(int, input().split()))\n\n\n\nN=temp[0]\n\nX=temp[1]\n\n\n\nL=list(map(int, input().split()))\n\n\n\nind=1\n\nwhile np.sum(L[:ind])<=X and ind<=N:\n\n ind+=1\n\n \n\nprint(ind)\n\n# optimized version of the same code:\n","target":"N, X=list(map(int, input().split()))\n\nL=list(map(int, input().split()))\n\nL=[0]+L\n\n \n\nl=int(0)\n\ncounter=int(0)\n\nwhile l+L[counter]<=X and counter<=N:\n\n l+=L[counter]\n\n counter+=int(1)\n\n if counter==N+1:\n\n break\n\n \n\nprint(counter)","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":192,"code_v1_num_chars":229,"code_v0_no_empty_lines":"import numpy as np\n\ntemp = list(map(int, input().split()))\nN = temp[0]\nX = temp[1]\nL = list(map(int, input().split()))\nind = 1\nwhile np.sum(L[:ind]) <= X and ind <= N:\n ind += 1\nprint(ind)\n","code_v1_no_empty_lines":"N, X = list(map(int, input().split()))\nL = list(map(int, input().split()))\nL = [0] + L\nl = int(0)\ncounter = int(0)\nwhile l + L[counter] <= X and counter <= N:\n l += L[counter]\n counter += int(1)\n if counter == N + 1:\n break\nprint(counter)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-import numpy as np","-","-temp = list(map(int, input().split()))","-N = temp[0]","-X = temp[1]","+N, X = list(map(int, input().split()))","-ind = 1","-while np.sum(L[:ind]) <= X and ind <= N:","- ind += 1","-print(ind)","+L = [0] + L","+l = int(0)","+counter = int(0)","+while l + L[counter] <= X and counter <= N:","+ l += L[counter]","+ counter += int(1)","+ if counter == N + 1:","+ break","+print(counter)"],"diff_only_import_comment":false,"measured_runtime_v0":1.2074212677,"measured_runtime_v1":0.1849545254,"runtime_lift":6.5282061368,"key":["s539723186","s999737072"]} +{"user_id":"u492447501","problem_id":"p02988","language":"python","submission_id_v0":"s007840106","submission_id_v1":"s122872076","cpu_time_v0":150,"cpu_time_v1":18,"memory_v0":12508,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport copy\n\nimport numpy as np\n\n\n\nS = eval(input())\n\n\n\nN = int(S)\n\n\n\nS = eval(input())\n\n\n\nP = list(map(int, S.split()))\n\n\n\ncheck = []\n\n\n\ncount = 0\n\n\n\nfor i in range(0, N-2, 1):\n\n\n\n check = P[i:i+3]\n\n check = np.array(check)\n\n check = check.argsort()\n\n if check[1] == 1:\n\n count = count + 1\n\n\n\nprint(count)\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nP = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(n-2):\n\n\n\n P_temp = [P[i], P[i+1], P[i+2]]\n\n P_temp.sort()\n\n if P_temp[1] == P[i+1]:\n\n count = count + 1\n\n\n\nprint(count)\n","code_v0_loc":24,"code_v1_loc":11,"code_v0_num_chars":314,"code_v1_num_chars":217,"code_v0_no_empty_lines":"import copy\nimport numpy as np\n\nS = eval(input())\nN = int(S)\nS = eval(input())\nP = list(map(int, S.split()))\ncheck = []\ncount = 0\nfor i in range(0, N - 2, 1):\n check = P[i : i + 3]\n check = np.array(check)\n check = check.argsort()\n if check[1] == 1:\n count = count + 1\nprint(count)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nP = list(map(int, input().split()))\ncount = 0\nfor i in range(n - 2):\n P_temp = [P[i], P[i + 1], P[i + 2]]\n P_temp.sort()\n if P_temp[1] == P[i + 1]:\n count = count + 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":54.1666666667,"diff":["-import copy","-import numpy as np","-","-S = eval(input())","-N = int(S)","-S = eval(input())","-P = list(map(int, S.split()))","-check = []","+n = int(eval(input()))","+P = list(map(int, input().split()))","-for i in range(0, N - 2, 1):","- check = P[i : i + 3]","- check = np.array(check)","- check = check.argsort()","- if check[1] == 1:","+for i in range(n - 2):","+ P_temp = [P[i], P[i + 1], P[i + 2]]","+ P_temp.sort()","+ if P_temp[1] == P[i + 1]:"],"diff_only_import_comment":false,"measured_runtime_v0":1.5926496607,"measured_runtime_v1":0.1723277428,"runtime_lift":9.2419806274,"key":["s007840106","s122872076"]} +{"user_id":"u562016607","problem_id":"p03558","language":"python","submission_id_v0":"s159640382","submission_id_v1":"s651180421","cpu_time_v0":376,"cpu_time_v1":167,"memory_v0":8948,"memory_v1":6060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport heapq\n\nK=int(eval(input()))\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=[]\n\nheapq.heappush(q,(0,1))\n\nwhile (len(q)!=0):\n\n prc,src=heapq.heappop(q)\n\n if dist[src]dist[src]+1:\n\n dist[(src+1)%K]=dist[src]+1\n\n heapq.heappush(q,(dist[(src+1)%K],(src+1)%K))\n\n if dist[(10*src)%K]>dist[src]:\n\n dist[(10*src)%K]=dist[src]\n\n heapq.heappush(q,(dist[(src*10)%K],(src*10)%K))\n\nprint((dist[0]))\n\n\n# optimized version of the same code:\n","target":"from collections import deque\n\nK=int(eval(input()))\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=deque([1])\n\nwhile(len(q)>0):\n\n r=q.popleft()\n\n s=(r+1)%K\n\n if dist[r]+1 dist[src] + 1:\n dist[(src + 1) % K] = dist[src] + 1\n heapq.heappush(q, (dist[(src + 1) % K], (src + 1) % K))\n if dist[(10 * src) % K] > dist[src]:\n dist[(10 * src) % K] = dist[src]\n heapq.heappush(q, (dist[(src * 10) % K], (src * 10) % K))\nprint((dist[0]))\n","code_v1_no_empty_lines":"from collections import deque\n\nK = int(eval(input()))\ndist = [10**15 for i in range(K)]\ndist[1] = 1\nq = deque([1])\nwhile len(q) > 0:\n r = q.popleft()\n s = (r + 1) % K\n if dist[r] + 1 < dist[s]:\n dist[s] = dist[r] + 1\n q.append(s)\n t = (r * 10) % K\n if dist[r] < dist[t]:\n dist[t] = dist[r]\n q.appendleft(t)\nprint((dist[0]))\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-import heapq","+from collections import deque","-q = []","-heapq.heappush(q, (0, 1))","-while len(q) != 0:","- prc, src = heapq.heappop(q)","- if dist[src] < prc:","- continue","- if dist[(src + 1) % K] > dist[src] + 1:","- dist[(src + 1) % K] = dist[src] + 1","- heapq.heappush(q, (dist[(src + 1) % K], (src + 1) % K))","- if dist[(10 * src) % K] > dist[src]:","- dist[(10 * src) % K] = dist[src]","- heapq.heappush(q, (dist[(src * 10) % K], (src * 10) % K))","+q = deque([1])","+while len(q) > 0:","+ r = q.popleft()","+ s = (r + 1) % K","+ if dist[r] + 1 < dist[s]:","+ dist[s] = dist[r] + 1","+ q.append(s)","+ t = (r * 10) % K","+ if dist[r] < dist[t]:","+ dist[t] = dist[r]","+ q.appendleft(t)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4453229659,"measured_runtime_v1":0.2901842129,"runtime_lift":1.5346216162,"key":["s159640382","s651180421"]} +{"user_id":"u531220228","problem_id":"p02994","language":"python","submission_id_v0":"s833148158","submission_id_v1":"s512634929","cpu_time_v0":155,"cpu_time_v1":19,"memory_v0":12404,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN,L = list(map(int, input().split()))\n\ntaste = np.array([L+i-1 for i in range(1,N+1)])\n\nif taste[-1] < 0:\n\n print((sum(taste) + min(np.abs(taste))))\n\nelse:\n\n print((sum(taste) - min(np.abs(taste))))\n\n# optimized version of the same code:\n","target":"N,L = list(map(int, input().split()))\n\ntaste = [L+i-1 for i in range(1,N+1)]\n\nif taste[-1] < 0:\n\n print((sum(taste) + min([abs(x) for x in taste])))\n\nelse:\n\n print((sum(taste) - min([abs(x) for x in taste])))","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":210,"code_v1_num_chars":200,"code_v0_no_empty_lines":"import numpy as np\n\nN, L = list(map(int, input().split()))\ntaste = np.array([L + i - 1 for i in range(1, N + 1)])\nif taste[-1] < 0:\n print((sum(taste) + min(np.abs(taste))))\nelse:\n print((sum(taste) - min(np.abs(taste))))\n","code_v1_no_empty_lines":"N, L = list(map(int, input().split()))\ntaste = [L + i - 1 for i in range(1, N + 1)]\nif taste[-1] < 0:\n print((sum(taste) + min([abs(x) for x in taste])))\nelse:\n print((sum(taste) - min([abs(x) for x in taste])))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-import numpy as np","-","-taste = np.array([L + i - 1 for i in range(1, N + 1)])","+taste = [L + i - 1 for i in range(1, N + 1)]","- print((sum(taste) + min(np.abs(taste))))","+ print((sum(taste) + min([abs(x) for x in taste])))","- print((sum(taste) - min(np.abs(taste))))","+ print((sum(taste) - min([abs(x) for x in taste])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.945645529,"measured_runtime_v1":0.3334629779,"runtime_lift":5.8346672884,"key":["s833148158","s512634929"]} +{"user_id":"u645250356","problem_id":"p02899","language":"python","submission_id_v0":"s344747010","submission_id_v1":"s621981799","cpu_time_v0":434,"cpu_time_v1":102,"memory_v0":70376,"memory_v1":21544,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter,defaultdict,deque\n\nimport sys,heapq,bisect,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn = inp()\n\na = inpl()\n\naa = []\n\nfor i in range(n):\n\n aa.append([i+1,a[i]])\n\naa.sort(key=lambda x:x[1])\n\nfor i in range(n):\n\n print((aa[i][0]))\n\n\n\n\n# optimized version of the same code:\n","target":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush\n\nfrom bisect import bisect_left,bisect_right \n\nimport sys,math,itertools,fractions\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\na = inpl()\n\nres = [0] * n\n\nfor i,x in enumerate(a):\n\n res[x-1] = i+1\n\nprint((*res))\n","code_v0_loc":18,"code_v1_loc":16,"code_v0_num_chars":541,"code_v1_num_chars":443,"code_v0_no_empty_lines":"from collections import Counter, defaultdict, deque\nimport sys, heapq, bisect, math, itertools, string, queue\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef inpl_str():\n return list(sys.stdin.readline().split())\n\n\ndef inpln(n):\n return list(int(sys.stdin.readline()) for i in range(n))\n\n\nn = inp()\na = inpl()\naa = []\nfor i in range(n):\n aa.append([i + 1, a[i]])\naa.sort(key=lambda x: x[1])\nfor i in range(n):\n print((aa[i][0]))\n","code_v1_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, fractions\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = inp()\na = inpl()\nres = [0] * n\nfor i, x in enumerate(a):\n res[x - 1] = i + 1\nprint((*res))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-import sys, heapq, bisect, math, itertools, string, queue","+from heapq import heappop, heappush","+from bisect import bisect_left, bisect_right","+import sys, math, itertools, fractions","+INF = float(\"inf\")","-def inpl_str():","- return list(sys.stdin.readline().split())","-","-","-def inpln(n):","- return list(int(sys.stdin.readline()) for i in range(n))","-","-","-aa = []","-for i in range(n):","- aa.append([i + 1, a[i]])","-aa.sort(key=lambda x: x[1])","-for i in range(n):","- print((aa[i][0]))","+res = [0] * n","+for i, x in enumerate(a):","+ res[x - 1] = i + 1","+print((*res))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2881344714,"measured_runtime_v1":0.207670383,"runtime_lift":1.3874605868,"key":["s344747010","s621981799"]} +{"user_id":"u049979154","problem_id":"p03371","language":"python","submission_id_v0":"s167074309","submission_id_v1":"s223988235","cpu_time_v0":207,"cpu_time_v1":20,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c, x, y = list(map(int, input().split()))\n\n\n\nans = float('inf')\n\n\n\nfor i in range(2 * 10**5 + 1):\n\n ans = min(ans, a * max(x - i, 0) + b * max(y - i, 0) + 2 * c * i)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"A,B,C,X,Y = list(map(int,input().split()))\n\nmin_xy = min(X,Y)\n\nmax_xy = max(X,Y)\n\nans1 = 2 * C * min_xy + A * (X-min_xy) + B * (Y-min_xy) # \u7121\u99c4\u306b\u306a\u3089\u306a\u3044\u7bc4\u56f2\u3067AB\u30d4\u30b6\u3092\u8cb7\u3044\u3001\u6b8b\u308a\u3092\u8cb7\u3046\n\nans2 = A*X + B*Y # AB\u30d4\u30b6\u3092\u8cb7\u308f\u306a\u3044\n\nans3 = 2 * C * max_xy # AB\u30d4\u30b6\u3060\u3051\u3092\u8cb7\u3046\n\nprint((min(ans1,ans2,ans3)))","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":182,"code_v1_num_chars":251,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(2 * 10**5 + 1):\n ans = min(ans, a * max(x - i, 0) + b * max(y - i, 0) + 2 * c * i)\nprint(ans)\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nmin_xy = min(X, Y)\nmax_xy = max(X, Y)\nans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy) # \u7121\u99c4\u306b\u306a\u3089\u306a\u3044\u7bc4\u56f2\u3067AB\u30d4\u30b6\u3092\u8cb7\u3044\u3001\u6b8b\u308a\u3092\u8cb7\u3046\nans2 = A * X + B * Y # AB\u30d4\u30b6\u3092\u8cb7\u308f\u306a\u3044\nans3 = 2 * C * max_xy # AB\u30d4\u30b6\u3060\u3051\u3092\u8cb7\u3046\nprint((min(ans1, ans2, ans3)))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-a, b, c, x, y = list(map(int, input().split()))","-ans = float(\"inf\")","-for i in range(2 * 10**5 + 1):","- ans = min(ans, a * max(x - i, 0) + b * max(y - i, 0) + 2 * c * i)","-print(ans)","+A, B, C, X, Y = list(map(int, input().split()))","+min_xy = min(X, Y)","+max_xy = max(X, Y)","+ans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy) # \u7121\u99c4\u306b\u306a\u3089\u306a\u3044\u7bc4\u56f2\u3067AB\u30d4\u30b6\u3092\u8cb7\u3044\u3001\u6b8b\u308a\u3092\u8cb7\u3046","+ans2 = A * X + B * Y # AB\u30d4\u30b6\u3092\u8cb7\u308f\u306a\u3044","+ans3 = 2 * C * max_xy # AB\u30d4\u30b6\u3060\u3051\u3092\u8cb7\u3046","+print((min(ans1, ans2, ans3)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.9003799064,"measured_runtime_v1":0.2384188967,"runtime_lift":7.9707604256,"key":["s167074309","s223988235"]} +{"user_id":"u287132915","problem_id":"p02792","language":"python","submission_id_v0":"s161079550","submission_id_v1":"s476355973","cpu_time_v0":369,"cpu_time_v1":198,"memory_v0":46468,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\n\n\ncnt = 0\n\nfor i in range(1, n+1):\n\n i_str = str(i)\n\n if len(i_str) == 1:\n\n cnt += 1\n\n continue\n\n if len(i_str) == 2:\n\n if int(i_str[0]) == int(i_str[1]):\n\n cnt += 3\n\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 3:\n\n if int(i_str[0]) == int(i_str[2]):\n\n cnt += 4 + (2 * (int(i_str[1])+1) - 1)\n\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n\n cnt += 22\n\n elif int(i_str[0]) < int(i_str[2]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 4:\n\n if int(i_str[0]) == int(i_str[3]):\n\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2])+1) - 1\n\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n\n cnt += 222\n\n elif int(i_str[0]) < int(i_str[3]):\n\n cnt += 22\n\n continue\n\n if len(i_str) == 5:\n\n if int(i_str[0]) == int(i_str[4]):\n\n cnt += 224 + 200 * int(i_str[1]) + 20 * int(i_str[2]) + 2 * (int(i_str[3])+1) - 1\n\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n\n cnt += 2222\n\n elif int(i_str[0]) < int(i_str[4]):\n\n cnt += 222\n\n continue\n\n if len(i_str) == 6:\n\n if int(i_str[0]) == int(i_str[5]):\n\n cnt += 2224 + 2000 * int(i_str[1]) + 200 * int(i_str[2]) + 20 * int(i_str[3]) + 2 * (int(i_str[4])+1) - 1\n\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n\n cnt += 22222\n\n elif int(i_str[0]) < int(i_str[5]):\n\n cnt += 2222\n\n continue\n\n\n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\n\n\nc = [[0 for _ in range(10)] for __ in range(10)]\n\nfor i in range(1, n+1):\n\n str_i = str(i)\n\n head = int(str_i[0])\n\n tail = int(str_i[-1])\n\n c[head][tail] += 1\n\n\n\ncnt = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n cnt += c[i][j] * c[j][i]\n\n\n\nprint(cnt)","code_v0_loc":48,"code_v1_loc":15,"code_v0_num_chars":1676,"code_v1_num_chars":295,"code_v0_no_empty_lines":"n = int(eval(input()))\ncnt = 0\nfor i in range(1, n + 1):\n i_str = str(i)\n if len(i_str) == 1:\n cnt += 1\n continue\n if len(i_str) == 2:\n if int(i_str[0]) == int(i_str[1]):\n cnt += 3\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n cnt += 2\n continue\n if len(i_str) == 3:\n if int(i_str[0]) == int(i_str[2]):\n cnt += 4 + (2 * (int(i_str[1]) + 1) - 1)\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n cnt += 22\n elif int(i_str[0]) < int(i_str[2]):\n cnt += 2\n continue\n if len(i_str) == 4:\n if int(i_str[0]) == int(i_str[3]):\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2]) + 1) - 1\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n cnt += 222\n elif int(i_str[0]) < int(i_str[3]):\n cnt += 22\n continue\n if len(i_str) == 5:\n if int(i_str[0]) == int(i_str[4]):\n cnt += (\n 224\n + 200 * int(i_str[1])\n + 20 * int(i_str[2])\n + 2 * (int(i_str[3]) + 1)\n - 1\n )\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n cnt += 2222\n elif int(i_str[0]) < int(i_str[4]):\n cnt += 222\n continue\n if len(i_str) == 6:\n if int(i_str[0]) == int(i_str[5]):\n cnt += (\n 2224\n + 2000 * int(i_str[1])\n + 200 * int(i_str[2])\n + 20 * int(i_str[3])\n + 2 * (int(i_str[4]) + 1)\n - 1\n )\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n cnt += 22222\n elif int(i_str[0]) < int(i_str[5]):\n cnt += 2222\n continue\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nc = [[0 for _ in range(10)] for __ in range(10)]\nfor i in range(1, n + 1):\n str_i = str(i)\n head = int(str_i[0])\n tail = int(str_i[-1])\n c[head][tail] += 1\ncnt = 0\nfor i in range(10):\n for j in range(10):\n cnt += c[i][j] * c[j][i]\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":68.75,"diff":["+c = [[0 for _ in range(10)] for __ in range(10)]","+for i in range(1, n + 1):","+ str_i = str(i)","+ head = int(str_i[0])","+ tail = int(str_i[-1])","+ c[head][tail] += 1","-for i in range(1, n + 1):","- i_str = str(i)","- if len(i_str) == 1:","- cnt += 1","- continue","- if len(i_str) == 2:","- if int(i_str[0]) == int(i_str[1]):","- cnt += 3","- elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):","- cnt += 2","- continue","- if len(i_str) == 3:","- if int(i_str[0]) == int(i_str[2]):","- cnt += 4 + (2 * (int(i_str[1]) + 1) - 1)","- elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):","- cnt += 22","- elif int(i_str[0]) < int(i_str[2]):","- cnt += 2","- continue","- if len(i_str) == 4:","- if int(i_str[0]) == int(i_str[3]):","- cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2]) + 1) - 1","- elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):","- cnt += 222","- elif int(i_str[0]) < int(i_str[3]):","- cnt += 22","- continue","- if len(i_str) == 5:","- if int(i_str[0]) == int(i_str[4]):","- cnt += (","- 224","- + 200 * int(i_str[1])","- + 20 * int(i_str[2])","- + 2 * (int(i_str[3]) + 1)","- - 1","- )","- elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):","- cnt += 2222","- elif int(i_str[0]) < int(i_str[4]):","- cnt += 222","- continue","- if len(i_str) == 6:","- if int(i_str[0]) == int(i_str[5]):","- cnt += (","- 2224","- + 2000 * int(i_str[1])","- + 200 * int(i_str[2])","- + 20 * int(i_str[3])","- + 2 * (int(i_str[4]) + 1)","- - 1","- )","- elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):","- cnt += 22222","- elif int(i_str[0]) < int(i_str[5]):","- cnt += 2222","- continue","+for i in range(10):","+ for j in range(10):","+ cnt += c[i][j] * c[j][i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.528624272,"measured_runtime_v1":0.3498814137,"runtime_lift":1.5108669718,"key":["s161079550","s476355973"]} +{"user_id":"u285681431","problem_id":"p03796","language":"python","submission_id_v0":"s922366861","submission_id_v1":"s031671477","cpu_time_v0":154,"cpu_time_v1":82,"memory_v0":9940,"memory_v1":62860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.75,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\nN = int(eval(input()))\n\nans = math.factorial(N) % (10**9 + 7)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nmod = 10**9 + 7\n\nans = 1\n\nfor i in range(1, N + 1):\n\n ans *= i\n\n ans %= mod\n\nprint(ans)\n","code_v0_loc":5,"code_v1_loc":7,"code_v0_num_chars":82,"code_v1_num_chars":112,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nmod = 10**9 + 7\nans = 1\nfor i in range(1, N + 1):\n ans *= i\n ans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-import math","-","-ans = math.factorial(N) % (10**9 + 7)","+mod = 10**9 + 7","+ans = 1","+for i in range(1, N + 1):","+ ans *= i","+ ans %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.599384095,"measured_runtime_v1":0.2730524833,"runtime_lift":2.1951241301,"key":["s922366861","s031671477"]} +{"user_id":"u562935282","problem_id":"p03038","language":"python","submission_id_v0":"s653342727","submission_id_v1":"s579349204","cpu_time_v0":535,"cpu_time_v1":476,"memory_v0":31964,"memory_v1":42656,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom heapq import heappop, heappush\n\n\n\nn, m = list(map(int, input().split()))\n\na = tuple(map(int, input().split()))\n\n\n\nhq = []\n\nfor aa in a:\n\n heappush(hq, (-aa, 1))\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(hq, (-c, b))\n\n\n\nrest = n\n\nans = 0\n\nwhile rest > 0:\n\n num, cnt = heappop(hq)\n\n\n\n num *= (-1)\n\n use = min(rest, cnt)\n\n ans += use * num\n\n rest -= use\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"def main():\n\n from collections import Counter\n\n from operator import itemgetter\n\n\n\n import sys\n\n input = sys.stdin.readline\n\n\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n\n\n ctr = Counter(a)\n\n for _ in range(M):\n\n b, c = list(map(int, input().split()))\n\n ctr[c] += b\n\n\n\n ans = 0\n\n rest = N\n\n for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):\n\n take = min(rest, count)\n\n ans += take * integer\n\n rest -= take\n\n if not rest:\n\n break\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n# import sys\n\n# input = sys.stdin.readline\n\n# \n\n# sys.setrecursionlimit(10 ** 7)\n\n# \n\n# (int(x)-1 for x in input().split())\n\n# rstrip()\n","code_v0_loc":24,"code_v1_loc":37,"code_v0_num_chars":414,"code_v1_num_chars":760,"code_v0_no_empty_lines":"from heapq import heappop, heappush\n\nn, m = list(map(int, input().split()))\na = tuple(map(int, input().split()))\nhq = []\nfor aa in a:\n heappush(hq, (-aa, 1))\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n heappush(hq, (-c, b))\nrest = n\nans = 0\nwhile rest > 0:\n num, cnt = heappop(hq)\n num *= -1\n use = min(rest, cnt)\n ans += use * num\n rest -= use\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n from collections import Counter\n from operator import itemgetter\n import sys\n\n input = sys.stdin.readline\n N, M = list(map(int, input().split()))\n a = list(map(int, input().split()))\n ctr = Counter(a)\n for _ in range(M):\n b, c = list(map(int, input().split()))\n ctr[c] += b\n ans = 0\n rest = N\n for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):\n take = min(rest, count)\n ans += take * integer\n rest -= take\n if not rest:\n break\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n# import sys\n# input = sys.stdin.readline\n#\n# sys.setrecursionlimit(10 ** 7)\n#\n# (int(x)-1 for x in input().split())\n# rstrip()\n","code_same":false,"relative_loc_diff_percent":35.1351351351,"diff":["-from heapq import heappop, heappush","+def main():","+ from collections import Counter","+ from operator import itemgetter","+ import sys","-n, m = list(map(int, input().split()))","-a = tuple(map(int, input().split()))","-hq = []","-for aa in a:","- heappush(hq, (-aa, 1))","-for _ in range(m):","- b, c = list(map(int, input().split()))","- heappush(hq, (-c, b))","-rest = n","-ans = 0","-while rest > 0:","- num, cnt = heappop(hq)","- num *= -1","- use = min(rest, cnt)","- ans += use * num","- rest -= use","-print(ans)","+ input = sys.stdin.readline","+ N, M = list(map(int, input().split()))","+ a = list(map(int, input().split()))","+ ctr = Counter(a)","+ for _ in range(M):","+ b, c = list(map(int, input().split()))","+ ctr[c] += b","+ ans = 0","+ rest = N","+ for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):","+ take = min(rest, count)","+ ans += take * integer","+ rest -= take","+ if not rest:","+ break","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()","+# import sys","+# input = sys.stdin.readline","+#","+# sys.setrecursionlimit(10 ** 7)","+#","+# (int(x)-1 for x in input().split())","+# rstrip()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3003652287,"measured_runtime_v1":0.218658349,"runtime_lift":1.3736737242,"key":["s653342727","s579349204"]} +{"user_id":"u808806124","problem_id":"p03837","language":"python","submission_id_v0":"s131974158","submission_id_v1":"s793289076","cpu_time_v0":1652,"cpu_time_v1":347,"memory_v0":14552,"memory_v1":3556,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn, m = list(map(int, input().split()))\n\n\n\nd = np.ones((n, n)) * 1001\n\n\n\nes = []\n\nfor i in range(m):\n\n es.append(list(map(int, input().split())))\n\n\n\nfor (i, j, w) in es:\n\n d[i - 1][j - 1] = w\n\n d[j - 1][i - 1] = w\n\n\n\n\n\nfor k in range(n):\n\n for i in range(n):\n\n for j in range(n):\n\n l = d[i][k] + d[k][j]\n\n if d[i][j] > l:\n\n d[i][j] = l\n\n\n\nc = 0\n\nfor (i, j, w) in es:\n\n if d[i - 1][j - 1] < w:\n\n c += 1\n\n\n\nprint(c)\n\n\n# optimized version of the same code:\n","target":"n, m = list(map(int, input().split()))\n\n\n\nd = [[1001] * n for i in range(n)]\n\n\n\nes = []\n\nfor i in range(m):\n\n es.append(list(map(int, input().split())))\n\n\n\nfor (i, j, w) in es:\n\n d[i - 1][j - 1] = w\n\n d[j - 1][i - 1] = w\n\n\n\n\n\nfor k in range(n):\n\n for i in range(n):\n\n for j in range(n):\n\n l = d[i][k] + d[k][j]\n\n if d[i][j] > l:\n\n d[i][j] = l\n\n\n\nc = 0\n\nfor (i, j, w) in es:\n\n if d[i - 1][j - 1] < w:\n\n c += 1\n\n\n\nprint(c)","code_v0_loc":28,"code_v1_loc":26,"code_v0_num_chars":495,"code_v1_num_chars":480,"code_v0_no_empty_lines":"import numpy as np\n\nn, m = list(map(int, input().split()))\nd = np.ones((n, n)) * 1001\nes = []\nfor i in range(m):\n es.append(list(map(int, input().split())))\nfor (i, j, w) in es:\n d[i - 1][j - 1] = w\n d[j - 1][i - 1] = w\nfor k in range(n):\n for i in range(n):\n for j in range(n):\n l = d[i][k] + d[k][j]\n if d[i][j] > l:\n d[i][j] = l\nc = 0\nfor (i, j, w) in es:\n if d[i - 1][j - 1] < w:\n c += 1\nprint(c)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nd = [[1001] * n for i in range(n)]\nes = []\nfor i in range(m):\n es.append(list(map(int, input().split())))\nfor (i, j, w) in es:\n d[i - 1][j - 1] = w\n d[j - 1][i - 1] = w\nfor k in range(n):\n for i in range(n):\n for j in range(n):\n l = d[i][k] + d[k][j]\n if d[i][j] > l:\n d[i][j] = l\nc = 0\nfor (i, j, w) in es:\n if d[i - 1][j - 1] < w:\n c += 1\nprint(c)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-import numpy as np","-","-d = np.ones((n, n)) * 1001","+d = [[1001] * n for i in range(n)]"],"diff_only_import_comment":false,"measured_runtime_v0":2.1350366999,"measured_runtime_v1":0.2769060681,"runtime_lift":7.710328324,"key":["s131974158","s793289076"]} +{"user_id":"u170201762","problem_id":"p03371","language":"python","submission_id_v0":"s850530798","submission_id_v1":"s933367975","cpu_time_v0":94,"cpu_time_v1":18,"memory_v0":7096,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.85,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA,B,C,X,Y = list(map(int,input().split()))\n\nl = []\n\nfor i in range(max(X,Y)+1):\n\n T = i * C * 2\n\n if i < X: \n\n T += (X-i)*A\n\n if i < Y:\n\n T += (Y-i)*B\n\n l.append(T)\n\nl.sort()\n\nprint((l[0]))\n\n# optimized version of the same code:\n","target":"A,B,C,X,Y = list(map(int,input().split()))\n\nans = 0\n\nif 2*C <= A+B:\n\n Z = min(X,Y)\n\n ans = 2*C*Z\n\n X -= Z\n\n Y -= Z\n\nans += min(2*C*X,A*X)\n\nans += min(2*C*Y,B*Y)\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":207,"code_v1_num_chars":178,"code_v0_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nl = []\nfor i in range(max(X, Y) + 1):\n T = i * C * 2\n if i < X:\n T += (X - i) * A\n if i < Y:\n T += (Y - i) * B\n l.append(T)\nl.sort()\nprint((l[0]))\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nans = 0\nif 2 * C <= A + B:\n Z = min(X, Y)\n ans = 2 * C * Z\n X -= Z\n Y -= Z\nans += min(2 * C * X, A * X)\nans += min(2 * C * Y, B * Y)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-l = []","-for i in range(max(X, Y) + 1):","- T = i * C * 2","- if i < X:","- T += (X - i) * A","- if i < Y:","- T += (Y - i) * B","- l.append(T)","-l.sort()","-print((l[0]))","+ans = 0","+if 2 * C <= A + B:","+ Z = min(X, Y)","+ ans = 2 * C * Z","+ X -= Z","+ Y -= Z","+ans += min(2 * C * X, A * X)","+ans += min(2 * C * Y, B * Y)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.290536653,"measured_runtime_v1":0.1943999538,"runtime_lift":1.494530463,"key":["s850530798","s933367975"]} +{"user_id":"u426764965","problem_id":"p02983","language":"python","submission_id_v0":"s922780742","submission_id_v1":"s448047238","cpu_time_v0":151,"cpu_time_v1":48,"memory_v0":14312,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.21,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# \u53c2\u8003 https:\/\/atcoder.jp\/contests\/abc133\/submissions\/7966658\n\n\n\nimport numpy as np\n\n\n\ndef abc133_c():\n\n L, R = list(map(int, input().split()))\n\n if R - L > 673: return 0\n\n x = np.arange(L, R+1, dtype=np.int64)\n\n #y = x[:, None] * x[None, :] % 2019\n\n y = x.reshape(-1, 1) * x.reshape(1, -1) # \u533a\u9593\u5185\u306e\u3059\u3079\u3066\u306e\u7d44\u5408\u305b\u306e\u7a4d\n\n y %= 2019\n\n np.fill_diagonal(y, 2019) # \u5bfe\u89d2\u6210\u5206\u306f\u7121\u8996\u3059\u308b (\u540c\u3058\u6570\u30922\u56de\u9078\u3079\u306a\u3044) \u306e\u3067inf\u5024\u3067\u57cb\u3081\u308b\n\n return y.min()\n\n\n\nprint((abc133_c()))\n\n# optimized version of the same code:\n","target":"def abc133_c():\n\n L, R = list(map(int, input().split()))\n\n # \u533a\u9593\u306e\u5e45\u304c673\u3042\u308c\u3070\u3001673\u306e\u500d\u6570\u30683\u306e\u500d\u6570\u304c\u542b\u307e\u308c\u3066\u30012019\u306e\u500d\u6570\u304c\u4f5c\u308c\u308b\n\n if R - L > 673: return 0\n\n # \u305d\u308c\u4ee5\u5916\u306f\u8a66\u3059\n\n ans = 2019\n\n for i in range(L, R+1):\n\n for j in range(L, i):\n\n m = i * j % 2019\n\n ans = min(m, ans)\n\n return ans\n\n\n\nprint((abc133_c()))","code_v0_loc":15,"code_v1_loc":13,"code_v0_num_chars":438,"code_v1_num_chars":320,"code_v0_no_empty_lines":"# \u53c2\u8003 https:\/\/atcoder.jp\/contests\/abc133\/submissions\/7966658\nimport numpy as np\n\n\ndef abc133_c():\n L, R = list(map(int, input().split()))\n if R - L > 673:\n return 0\n x = np.arange(L, R + 1, dtype=np.int64)\n # y = x[:, None] * x[None, :] % 2019\n y = x.reshape(-1, 1) * x.reshape(1, -1) # \u533a\u9593\u5185\u306e\u3059\u3079\u3066\u306e\u7d44\u5408\u305b\u306e\u7a4d\n y %= 2019\n np.fill_diagonal(y, 2019) # \u5bfe\u89d2\u6210\u5206\u306f\u7121\u8996\u3059\u308b (\u540c\u3058\u6570\u30922\u56de\u9078\u3079\u306a\u3044) \u306e\u3067inf\u5024\u3067\u57cb\u3081\u308b\n return y.min()\n\n\nprint((abc133_c()))\n","code_v1_no_empty_lines":"def abc133_c():\n L, R = list(map(int, input().split()))\n # \u533a\u9593\u306e\u5e45\u304c673\u3042\u308c\u3070\u3001673\u306e\u500d\u6570\u30683\u306e\u500d\u6570\u304c\u542b\u307e\u308c\u3066\u30012019\u306e\u500d\u6570\u304c\u4f5c\u308c\u308b\n if R - L > 673:\n return 0\n # \u305d\u308c\u4ee5\u5916\u306f\u8a66\u3059\n ans = 2019\n for i in range(L, R + 1):\n for j in range(L, i):\n m = i * j % 2019\n ans = min(m, ans)\n return ans\n\n\nprint((abc133_c()))\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-# \u53c2\u8003 https:\/\/atcoder.jp\/contests\/abc133\/submissions\/7966658","-import numpy as np","-","-","+ # \u533a\u9593\u306e\u5e45\u304c673\u3042\u308c\u3070\u3001673\u306e\u500d\u6570\u30683\u306e\u500d\u6570\u304c\u542b\u307e\u308c\u3066\u30012019\u306e\u500d\u6570\u304c\u4f5c\u308c\u308b","- x = np.arange(L, R + 1, dtype=np.int64)","- # y = x[:, None] * x[None, :] % 2019","- y = x.reshape(-1, 1) * x.reshape(1, -1) # \u533a\u9593\u5185\u306e\u3059\u3079\u3066\u306e\u7d44\u5408\u305b\u306e\u7a4d","- y %= 2019","- np.fill_diagonal(y, 2019) # \u5bfe\u89d2\u6210\u5206\u306f\u7121\u8996\u3059\u308b (\u540c\u3058\u6570\u30922\u56de\u9078\u3079\u306a\u3044) \u306e\u3067inf\u5024\u3067\u57cb\u3081\u308b","- return y.min()","+ # \u305d\u308c\u4ee5\u5916\u306f\u8a66\u3059","+ ans = 2019","+ for i in range(L, R + 1):","+ for j in range(L, i):","+ m = i * j % 2019","+ ans = min(m, ans)","+ return ans"],"diff_only_import_comment":false,"measured_runtime_v0":1.2400364937,"measured_runtime_v1":0.302429297,"runtime_lift":4.1002525409,"key":["s922780742","s448047238"]} +{"user_id":"u708211626","problem_id":"p04012","language":"python","submission_id_v0":"s951351679","submission_id_v1":"s246688975","cpu_time_v0":32,"cpu_time_v1":26,"memory_v0":9372,"memory_v1":9000,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.75,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport collections\n\nimport sys\n\na=eval(input())\n\nb=[]\n\n\n\nfor i in a:\n\n b.append(i)\n\n \n\nb.sort()\n\nc=collections.Counter(b)\n\nc=list(c.values())\n\n\n\nfor i in range(len(c)):\n\n if int(c[i])%2==0:\n\n q=0\n\n else:\n\n q=1\n\n print('No')\n\n sys.exit()\n\n \n\nprint('Yes')\n\n\n# optimized version of the same code:\n","target":"w = list(eval(input()))\n\ns = set(w)\n\nfor i in s:\n\n if w.count(i)%2 != 0:\n\n print(\"No\")\n\n break\n\nelse:\n\n print(\"Yes\")\n\n ","code_v0_loc":21,"code_v1_loc":9,"code_v0_num_chars":267,"code_v1_num_chars":122,"code_v0_no_empty_lines":"import collections\nimport sys\n\na = eval(input())\nb = []\nfor i in a:\n b.append(i)\nb.sort()\nc = collections.Counter(b)\nc = list(c.values())\nfor i in range(len(c)):\n if int(c[i]) % 2 == 0:\n q = 0\n else:\n q = 1\n print(\"No\")\n sys.exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"w = list(eval(input()))\ns = set(w)\nfor i in s:\n if w.count(i) % 2 != 0:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-import collections","-import sys","-","-a = eval(input())","-b = []","-for i in a:","- b.append(i)","-b.sort()","-c = collections.Counter(b)","-c = list(c.values())","-for i in range(len(c)):","- if int(c[i]) % 2 == 0:","- q = 0","- else:","- q = 1","+w = list(eval(input()))","+s = set(w)","+for i in s:","+ if w.count(i) % 2 != 0:","- sys.exit()","-print(\"Yes\")","+ break","+else:","+ print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.2393270415,"measured_runtime_v1":0.1892163638,"runtime_lift":1.2648326847,"key":["s951351679","s246688975"]} +{"user_id":"u379959788","problem_id":"p03835","language":"python","submission_id_v0":"s258964318","submission_id_v1":"s303783261","cpu_time_v0":1751,"cpu_time_v1":1557,"memory_v0":2940,"memory_v1":3444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#ABC951B\/Sum_of_Three_Integers\n\n\n\nK, S = list(map(int, input().split()))\n\nans = 0\n\nfor x in range(0, K+1):\n\n for y in range(0, K+1):\n\n z = S - x - y\n\n if 0 <= z and z <= K:\n\n ans += 1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"K, S = list(map(int, input().split()))\n\nans = 0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z = S - X - Y\n\n if Z >= 0 and Z <= K:\n\n ans += 1\n\nprint(ans) ","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":217,"code_v1_num_chars":184,"code_v0_no_empty_lines":"# ABC951B\/Sum_of_Three_Integers\nK, S = list(map(int, input().split()))\nans = 0\nfor x in range(0, K + 1):\n for y in range(0, K + 1):\n z = S - x - y\n if 0 <= z and z <= K:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"K, S = list(map(int, input().split()))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if Z >= 0 and Z <= K:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-# ABC951B\/Sum_of_Three_Integers","-for x in range(0, K + 1):","- for y in range(0, K + 1):","- z = S - x - y","- if 0 <= z and z <= K:","+for X in range(K + 1):","+ for Y in range(K + 1):","+ Z = S - X - Y","+ if Z >= 0 and Z <= K:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2646004359,"measured_runtime_v1":0.0728798735,"runtime_lift":3.6306379676,"key":["s258964318","s303783261"]} +{"user_id":"u150984829","problem_id":"p02276","language":"python","submission_id_v0":"s439916574","submission_id_v1":"s927428389","cpu_time_v0":80,"cpu_time_v1":60,"memory_v0":16392,"memory_v1":16388,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))-1\n\nA=list(map(int,input().split()))\n\ni=0\n\nfor j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\nA[i],A[n]=A[n],A[i]\n\nprint((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n\n\n# optimized version of the same code:\n","target":"def s():\n\n n=int(eval(input()))-1\n\n A=list(map(int,input().split()))\n\n i=0\n\n for j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\n A[i],A[n]=A[n],A[i]\n\n print((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n\nif'__main__'==__name__:s()\n","code_v0_loc":7,"code_v1_loc":9,"code_v0_num_chars":219,"code_v1_num_chars":264,"code_v0_no_empty_lines":"n = int(eval(input())) - 1\nA = list(map(int, input().split()))\ni = 0\nfor j in range(n):\n if A[j] <= A[-1]:\n A[i], A[j] = A[j], A[i]\n i += 1\nA[i], A[n] = A[n], A[i]\nprint(\n (\n \" \".join(map(str, A[:i]))\n + \" [\"\n + str(A[i])\n + \"] \"\n + \" \".join(map(str, A[i + 1 :]))\n )\n)\n","code_v1_no_empty_lines":"def s():\n n = int(eval(input())) - 1\n A = list(map(int, input().split()))\n i = 0\n for j in range(n):\n if A[j] <= A[-1]:\n A[i], A[j] = A[j], A[i]\n i += 1\n A[i], A[n] = A[n], A[i]\n print(\n (\n \" \".join(map(str, A[:i]))\n + \" [\"\n + str(A[i])\n + \"] \"\n + \" \".join(map(str, A[i + 1 :]))\n )\n )\n\n\nif \"__main__\" == __name__:\n s()\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-n = int(eval(input())) - 1","-A = list(map(int, input().split()))","-i = 0","-for j in range(n):","- if A[j] <= A[-1]:","- A[i], A[j] = A[j], A[i]","- i += 1","-A[i], A[n] = A[n], A[i]","-print(","- (","- \" \".join(map(str, A[:i]))","- + \" [\"","- + str(A[i])","- + \"] \"","- + \" \".join(map(str, A[i + 1 :]))","+def s():","+ n = int(eval(input())) - 1","+ A = list(map(int, input().split()))","+ i = 0","+ for j in range(n):","+ if A[j] <= A[-1]:","+ A[i], A[j] = A[j], A[i]","+ i += 1","+ A[i], A[n] = A[n], A[i]","+ print(","+ (","+ \" \".join(map(str, A[:i]))","+ + \" [\"","+ + str(A[i])","+ + \"] \"","+ + \" \".join(map(str, A[i + 1 :]))","+ )","-)","+","+","+if \"__main__\" == __name__:","+ s()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2844968953,"measured_runtime_v1":0.0927553341,"runtime_lift":3.0671755746,"key":["s439916574","s927428389"]} +{"user_id":"u580404776","problem_id":"p02792","language":"python","submission_id_v0":"s545080507","submission_id_v1":"s376438645","cpu_time_v0":492,"cpu_time_v1":192,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.98,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nmem = [[0]*10 for _ in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nmem=[[0] * 10 for _ in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n mem[int(s[0])][int(s[-1])] += 1 \n\n \n\nans = 0\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += mem[i][j] * mem[j][i]\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":265,"code_v1_num_chars":249,"code_v0_no_empty_lines":"N = int(eval(input()))\nmem = [[0] * 10 for _ in range(10)]\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n mem[a][b] += 1\nans = 0\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n ans += mem[b][a]\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nmem = [[0] * 10 for _ in range(10)]\nfor i in range(1, N + 1):\n s = str(i)\n mem[int(s[0])][int(s[-1])] += 1\nans = 0\nfor i in range(1, 10):\n for j in range(1, 10):\n ans += mem[i][j] * mem[j][i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["- a = int(str(i)[0])","- b = int(str(i)[-1])","- mem[a][b] += 1","+ s = str(i)","+ mem[int(s[0])][int(s[-1])] += 1","-for i in range(1, N + 1):","- a = int(str(i)[0])","- b = int(str(i)[-1])","- ans += mem[b][a]","+for i in range(1, 10):","+ for j in range(1, 10):","+ ans += mem[i][j] * mem[j][i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.4534644659,"measured_runtime_v1":0.3052516449,"runtime_lift":1.4855430706,"key":["s545080507","s376438645"]} +{"user_id":"u107077660","problem_id":"p04012","language":"python","submission_id_v0":"s204906128","submission_id_v1":"s764910207","cpu_time_v0":38,"cpu_time_v1":29,"memory_v0":3064,"memory_v1":3444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.68,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nw = eval(input())\n\nfor l in w:\n\n\tif w.count(l) % 2 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")\n\n# optimized version of the same code:\n","target":"from collections import Counter\n\ns = eval(input())\n\nc = list(Counter(s).values())\n\nfor n in c:\n\n\tif n & 1 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")\n\n\n","code_v0_loc":7,"code_v1_loc":10,"code_v0_num_chars":96,"code_v1_num_chars":148,"code_v0_no_empty_lines":"w = eval(input())\nfor l in w:\n if w.count(l) % 2 == 1:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"from collections import Counter\n\ns = eval(input())\nc = list(Counter(s).values())\nfor n in c:\n if n & 1 == 1:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-w = eval(input())","-for l in w:","- if w.count(l) % 2 == 1:","+from collections import Counter","+","+s = eval(input())","+c = list(Counter(s).values())","+for n in c:","+ if n & 1 == 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3070713311,"measured_runtime_v1":0.212444066,"runtime_lift":1.44542202,"key":["s204906128","s764910207"]} +{"user_id":"u391875425","problem_id":"p03416","language":"python","submission_id_v0":"s339057919","submission_id_v1":"s254043060","cpu_time_v0":204,"cpu_time_v1":57,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.06,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b = list(map(int, input().split()))\n\ntmp=str(a)\n\nc=0\n\nfor i in range(a,b+1):\n\n tmp=str(i)\n\n tmp2=\"\"\n\n for s in range(len(tmp)):\n\n tmp2=tmp2+tmp[len(tmp)-1-s]\n\n if tmp==tmp2:\n\n c=c+1\n\nprint(c)\n\n# optimized version of the same code:\n","target":"def main():\n\n #1. input\n\n a, b = list(map(int, input().split()))\n\n\n\n ans = 0\n\n\n\n #2. from A to B\n\n for i in range(a, b+1):\n\n #2.1. judge if the number is palindromic\n\n if (str(i)[0]==str(i)[4]) and (str(i)[1]==str(i)[3]):\n\n ans = ans+1\n\n\n\n #3. output\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":11,"code_v1_loc":18,"code_v0_num_chars":214,"code_v1_num_chars":347,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\ntmp = str(a)\nc = 0\nfor i in range(a, b + 1):\n tmp = str(i)\n tmp2 = \"\"\n for s in range(len(tmp)):\n tmp2 = tmp2 + tmp[len(tmp) - 1 - s]\n if tmp == tmp2:\n c = c + 1\nprint(c)\n","code_v1_no_empty_lines":"def main():\n # 1. input\n a, b = list(map(int, input().split()))\n ans = 0\n # 2. from A to B\n for i in range(a, b + 1):\n # 2.1. judge if the number is palindromic\n if (str(i)[0] == str(i)[4]) and (str(i)[1] == str(i)[3]):\n ans = ans + 1\n # 3. output\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":38.8888888889,"diff":["-a, b = list(map(int, input().split()))","-tmp = str(a)","-c = 0","-for i in range(a, b + 1):","- tmp = str(i)","- tmp2 = \"\"","- for s in range(len(tmp)):","- tmp2 = tmp2 + tmp[len(tmp) - 1 - s]","- if tmp == tmp2:","- c = c + 1","-print(c)","+def main():","+ # 1. input","+ a, b = list(map(int, input().split()))","+ ans = 0","+ # 2. from A to B","+ for i in range(a, b + 1):","+ # 2.1. judge if the number is palindromic","+ if (str(i)[0] == str(i)[4]) and (str(i)[1] == str(i)[3]):","+ ans = ans + 1","+ # 3. output","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.5203332471,"measured_runtime_v1":0.2634068646,"runtime_lift":1.9753974444,"key":["s339057919","s254043060"]} +{"user_id":"u505420467","problem_id":"p03835","language":"python","submission_id_v0":"s014481361","submission_id_v1":"s844546698","cpu_time_v0":1491,"cpu_time_v1":1254,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.9,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n z=s-i-j\n\n if 0<=z<=k:\n\n ans+=1\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0<=s-i-j<=k:\n\n ans+=1\n\nprint(ans)\n","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":154,"code_v1_num_chars":141,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n z = s - i - j\n if 0 <= z <= k:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["- z = s - i - j","- if 0 <= z <= k:","+ if 0 <= s - i - j <= k:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2451675486,"measured_runtime_v1":0.0064913454,"runtime_lift":37.7683720217,"key":["s014481361","s844546698"]} +{"user_id":"u285891772","problem_id":"p03078","language":"python","submission_id_v0":"s323914382","submission_id_v1":"s323368336","cpu_time_v0":910,"cpu_time_v1":524,"memory_v0":69644,"memory_v1":18184,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return map(int, input().split())\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nAB = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tAB.append(A[i]+B[j])\n\n\n\nAB.sort(reverse = True)\n\nAB = AB[:3000]\n\nABC = sorted([C[0]+AB[i] for i in range(min(3000, X*Y))], reverse = True)\n\n\n\nfor j in range(1, Z):\n\n\tABC_tmp = sorted([C[j]+AB[i] for i in range(min(3000, X*Y))])\n\n\tABC += ABC_tmp\n\n\tABC.sort(reverse = True)\n\n\tABC = ABC[:3000]\n\n\n\nprint(*ABC[:K], sep= \"\\n\")\n\n\n\n\n# optimized version of the same code:\n","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nans = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tfor k in range(Z):\n\n\t\t\tif (i+1)*(j+1)*(k+1) <= K:\n\n\t\t\t\tans.append(A[i]+B[j]+C[k])\n\n\t\t\telse:\n\n\t\t\t\tbreak\n\n\n\nfor a in sorted(ans)[::-1][:K]:\n\n\tprint(a)\n","code_v0_loc":46,"code_v1_loc":40,"code_v0_num_chars":1517,"code_v1_num_chars":1344,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return map(int, input().split())\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return zip(*(MAP() for _ in range(n)))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nAB = []\nfor i in range(X):\n for j in range(Y):\n AB.append(A[i] + B[j])\nAB.sort(reverse=True)\nAB = AB[:3000]\nABC = sorted([C[0] + AB[i] for i in range(min(3000, X * Y))], reverse=True)\nfor j in range(1, Z):\n ABC_tmp = sorted([C[j] + AB[i] for i in range(min(3000, X * Y))])\n ABC += ABC_tmp\n ABC.sort(reverse=True)\n ABC = ABC[:3000]\nprint(*ABC[:K], sep=\"\\n\")\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nans = []\nfor i in range(X):\n for j in range(Y):\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) <= K:\n ans.append(A[i] + B[j] + C[k])\n else:\n break\nfor a in sorted(ans)[::-1][:K]:\n print(a)\n","code_same":false,"relative_loc_diff_percent":13.0434782609,"diff":["- return int(input())","+ return int(eval(input()))","- return map(int, input().split())","+ return list(map(int, input().split()))","- return zip(*(MAP() for _ in range(n)))","+ return list(zip(*(MAP() for _ in range(n))))","-AB = []","+ans = []","- AB.append(A[i] + B[j])","-AB.sort(reverse=True)","-AB = AB[:3000]","-ABC = sorted([C[0] + AB[i] for i in range(min(3000, X * Y))], reverse=True)","-for j in range(1, Z):","- ABC_tmp = sorted([C[j] + AB[i] for i in range(min(3000, X * Y))])","- ABC += ABC_tmp","- ABC.sort(reverse=True)","- ABC = ABC[:3000]","-print(*ABC[:K], sep=\"\\n\")","+ for k in range(Z):","+ if (i + 1) * (j + 1) * (k + 1) <= K:","+ ans.append(A[i] + B[j] + C[k])","+ else:","+ break","+for a in sorted(ans)[::-1][:K]:","+ print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3039683881,"measured_runtime_v1":0.2292593994,"runtime_lift":1.3258709952,"key":["s323914382","s323368336"]} +{"user_id":"u498487134","problem_id":"p02814","language":"python","submission_id_v0":"s444255215","submission_id_v1":"s830443344","cpu_time_v0":445,"cpu_time_v1":157,"memory_v0":85440,"memory_v1":85732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.72,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport fractions\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN,M=list(map(int,input().split()))\n\na = list(map(int, input().split()))\n\n\n\n\n\nlcm = a[0]\n\nfor i in range(1, N):\n\n g= fractions.gcd(lcm, a[i])\n\n lcm = lcm * a[i] \/\/ g\n\n\n\n\n\ng=a[0]\n\nfor i in range(N):\n\n g=fractions.gcd(g,a[i])\n\n\n\nfor i in range(N):\n\n if (a[i]\/\/g)%2==0:\n\n lcm=0\n\n break \n\n \n\n \n\nans=0\n\nl=lcm\/\/2\n\nif l:\n\n ans=(M\/\/l)-(M\/\/(l+l))\n\nprint(ans)\n\n\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\n\"\"\"\n\n2X = ak * (2p+1)\n\n\u57fa\u672c\u7684\u306b\u306f\u6700\u5c0f\u516c\u500d\u6570\/2\u3092\u57fa\u672c\u3068\u3057\uff0c\u3053\u308c\u306e\u5947\u6570\u500d\u304b\uff0e\n\n\n\nX = (ak\/\/2) * (2p+1)\n\n\u3068\u66f8\u3051\u308b\uff0e\u7b2c\u4e8c\u9805\u304c\u5947\u6570\u306a\u306e\u3067\uff0c\u5404ak\u304c2\u3067\u5272\u308a\u5207\u308c\u308c\u3046\u56de\u6570\u304c\u540c\u3058\u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\n\na=[2,4]\u3060\u3068\u7121\u7406\n\n\"\"\"\n\ndef main():\n\n from math import gcd\n\n N,M=MI()\n\n A=LI()\n\n \n\n def count(X):\n\n cnt=0\n\n while X%2==0:\n\n cnt+=1\n\n X=X\/\/2\n\n return cnt\n\n \n\n C=count(A[0])\n\n for i in range(1,N):\n\n if count(A[i])!=C:\n\n print((0))\n\n exit()\n\n \n\n lca=1\n\n for i in range(N):\n\n g=gcd(lca,A[i])\n\n lca=(lca*A[i])\/\/g\n\n \n\n lca2=lca\/\/2\n\n ans=M\/\/lca2 - M\/\/lca\n\n \n\n print(ans)\n\n \n\n \n\n \n\n\n\nmain()\n","code_v0_loc":30,"code_v1_loc":47,"code_v0_num_chars":443,"code_v1_num_chars":825,"code_v0_no_empty_lines":"import fractions\nimport sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\na = list(map(int, input().split()))\nlcm = a[0]\nfor i in range(1, N):\n g = fractions.gcd(lcm, a[i])\n lcm = lcm * a[i] \/\/ g\ng = a[0]\nfor i in range(N):\n g = fractions.gcd(g, a[i])\nfor i in range(N):\n if (a[i] \/\/ g) % 2 == 0:\n lcm = 0\n break\nans = 0\nl = lcm \/\/ 2\nif l:\n ans = (M \/\/ l) - (M \/\/ (l + l))\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\n\"\"\"\n2X = ak * (2p+1)\n\u57fa\u672c\u7684\u306b\u306f\u6700\u5c0f\u516c\u500d\u6570\/2\u3092\u57fa\u672c\u3068\u3057\uff0c\u3053\u308c\u306e\u5947\u6570\u500d\u304b\uff0e\nX = (ak\/\/2) * (2p+1)\n\u3068\u66f8\u3051\u308b\uff0e\u7b2c\u4e8c\u9805\u304c\u5947\u6570\u306a\u306e\u3067\uff0c\u5404ak\u304c2\u3067\u5272\u308a\u5207\u308c\u308c\u3046\u56de\u6570\u304c\u540c\u3058\u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\na=[2,4]\u3060\u3068\u7121\u7406\n\"\"\"\n\n\ndef main():\n from math import gcd\n\n N, M = MI()\n A = LI()\n\n def count(X):\n cnt = 0\n while X % 2 == 0:\n cnt += 1\n X = X \/\/ 2\n return cnt\n\n C = count(A[0])\n for i in range(1, N):\n if count(A[i]) != C:\n print((0))\n exit()\n lca = 1\n for i in range(N):\n g = gcd(lca, A[i])\n lca = (lca * A[i]) \/\/ g\n lca2 = lca \/\/ 2\n ans = M \/\/ lca2 - M \/\/ lca\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":36.170212766,"diff":["-import fractions","-N, M = list(map(int, input().split()))","-a = list(map(int, input().split()))","-lcm = a[0]","-for i in range(1, N):","- g = fractions.gcd(lcm, a[i])","- lcm = lcm * a[i] \/\/ g","-g = a[0]","-for i in range(N):","- g = fractions.gcd(g, a[i])","-for i in range(N):","- if (a[i] \/\/ g) % 2 == 0:","- lcm = 0","- break","-ans = 0","-l = lcm \/\/ 2","-if l:","- ans = (M \/\/ l) - (M \/\/ (l + l))","-print(ans)","+","+","+def I():","+ return int(eval(input()))","+","+","+def MI():","+ return list(map(int, input().split()))","+","+","+def LI():","+ return list(map(int, input().split()))","+","+","+\"\"\"","+2X = ak * (2p+1)","+\u57fa\u672c\u7684\u306b\u306f\u6700\u5c0f\u516c\u500d\u6570\/2\u3092\u57fa\u672c\u3068\u3057\uff0c\u3053\u308c\u306e\u5947\u6570\u500d\u304b\uff0e","+X = (ak\/\/2) * (2p+1)","+\u3068\u66f8\u3051\u308b\uff0e\u7b2c\u4e8c\u9805\u304c\u5947\u6570\u306a\u306e\u3067\uff0c\u5404ak\u304c2\u3067\u5272\u308a\u5207\u308c\u308c\u3046\u56de\u6570\u304c\u540c\u3058\u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044","+a=[2,4]\u3060\u3068\u7121\u7406","+\"\"\"","+","+","+def main():","+ from math import gcd","+","+ N, M = MI()","+ A = LI()","+","+ def count(X):","+ cnt = 0","+ while X % 2 == 0:","+ cnt += 1","+ X = X \/\/ 2","+ return cnt","+","+ C = count(A[0])","+ for i in range(1, N):","+ if count(A[i]) != C:","+ print((0))","+ exit()","+ lca = 1","+ for i in range(N):","+ g = gcd(lca, A[i])","+ lca = (lca * A[i]) \/\/ g","+ lca2 = lca \/\/ 2","+ ans = M \/\/ lca2 - M \/\/ lca","+ print(ans)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.4226276507,"measured_runtime_v1":0.3026728499,"runtime_lift":1.396318338,"key":["s444255215","s830443344"]} +{"user_id":"u408260374","problem_id":"p00744","language":"python","submission_id_v0":"s226218538","submission_id_v1":"s459214194","cpu_time_v0":30250,"cpu_time_v1":21820,"memory_v0":106708,"memory_v1":188428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.87,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport collections\n\nimport math\n\n\n\n\n\nclass Dinic:\n\n \"\"\"Dinic Algorithm: find max-flow\n\n complexity: O(EV^2)\n\n used in GRL6A(AOJ)\n\n \"\"\"\n\n class edge:\n\n def __init__(self, to, cap, rev):\n\n self.to, self.cap, self.rev = to, cap, rev\n\n\n\n def __init__(self, V, E, source, sink):\n\n \"\"\" V: the number of vertexes\n\n E: adjacency list\n\n source: start point\n\n sink: goal point\n\n \"\"\"\n\n self.V = V\n\n self.E = [[] for _ in range(V)]\n\n for fr in range(V):\n\n for to, cap in E[fr]:\n\n self.E[fr].append(self.edge(to, cap, len(self.E[to])))\n\n self.E[to].append(self.edge(fr, 0, len(self.E[fr])-1))\n\n self.maxflow = self.dinic(source, sink)\n\n\n\n def dinic(self, source, sink):\n\n \"\"\"find max-flow\"\"\"\n\n INF = float('inf')\n\n maxflow = 0\n\n while True:\n\n self.bfs(source)\n\n if self.level[sink] < 0:\n\n return maxflow\n\n self.itr = [0] * self.V\n\n while True:\n\n flow = self.dfs(source, sink, INF)\n\n if flow > 0:\n\n maxflow += flow\n\n else:\n\n break\n\n\n\n def dfs(self, vertex, sink, flow):\n\n \"\"\"find augmenting path\"\"\"\n\n if vertex == sink:\n\n return flow\n\n for i in range(self.itr[vertex], len(self.E[vertex])):\n\n self.itr[vertex] = i\n\n e = self.E[vertex][i]\n\n if e.cap > 0 and self.level[vertex] < self.level[e.to]:\n\n d = self.dfs(e.to, sink, min(flow, e.cap))\n\n if d > 0:\n\n e.cap -= d\n\n self.E[e.to][e.rev].cap += d\n\n return d\n\n return 0\n\n\n\n def bfs(self, start):\n\n \"\"\"find shortest path from start\"\"\"\n\n que = collections.deque()\n\n self.level = [-1] * self.V\n\n que.append(start)\n\n self.level[start] = 0\n\n\n\n while que:\n\n fr = que.popleft()\n\n for e in self.E[fr]:\n\n if e.cap > 0 and self.level[e.to] < 0:\n\n self.level[e.to] = self.level[fr] + 1\n\n que.append(e.to)\n\n\n\nwhile True:\n\n M, N = list(map(int, input().split()))\n\n if M == 0 and N == 0:\n\n break\n\n blue, red = [], []\n\n while True:\n\n for x in input().split():\n\n blue.append(int(x))\n\n if len(blue) == M:\n\n break\n\n while True:\n\n for x in input().split():\n\n red.append(int(x))\n\n if len(red) == N:\n\n break\n\n V = M + N + 2\n\n edge = [set() for _ in range(V)]\n\n for i, b in enumerate(blue):\n\n if b != 1:\n\n for j, r in enumerate(red):\n\n if r % b == 0:\n\n edge[i].add((M+j, 1))\n\n for j in range(2, int(math.sqrt(b)) + 1):\n\n if b % j == 0:\n\n for k, r in enumerate(red):\n\n if r % j == 0 or r % (b \/\/ j) == 0:\n\n edge[i].add((M+k, 1))\n\n for i in range(M):\n\n edge[M+N].add((i, 1))\n\n for j in range(N):\n\n edge[M+j].add((M+N+1, 1))\n\n d = Dinic(V, edge, M+N, M+N+1)\n\n print((d.maxflow))\n\n# optimized version of the same code:\n","target":"import collections\n\nimport math\n\nrange = xrange; input = raw_input\n\n\n\n\n\nclass Dinic:\n\n \"\"\"Dinic Algorithm: find max-flow\n\n complexity: O(EV^2)\n\n used in GRL6A(AOJ)\n\n \"\"\"\n\n class edge:\n\n def __init__(self, to, cap, rev):\n\n self.to, self.cap, self.rev = to, cap, rev\n\n\n\n def __init__(self, V, E, source, sink):\n\n \"\"\" V: the number of vertexes\n\n E: adjacency list\n\n source: start point\n\n sink: goal point\n\n \"\"\"\n\n self.V = V\n\n self.E = [[] for _ in range(V)]\n\n for fr in range(V):\n\n for to, cap in E[fr]:\n\n self.E[fr].append(self.edge(to, cap, len(self.E[to])))\n\n self.E[to].append(self.edge(fr, 0, len(self.E[fr])-1))\n\n self.maxflow = self.dinic(source, sink)\n\n\n\n def dinic(self, source, sink):\n\n \"\"\"find max-flow\"\"\"\n\n INF = float('inf')\n\n maxflow = 0\n\n while True:\n\n self.bfs(source)\n\n if self.level[sink] < 0:\n\n return maxflow\n\n self.itr = [0] * self.V\n\n while True:\n\n flow = self.dfs(source, sink, INF)\n\n if flow > 0:\n\n maxflow += flow\n\n else:\n\n break\n\n\n\n def dfs(self, vertex, sink, flow):\n\n \"\"\"find augmenting path\"\"\"\n\n if vertex == sink:\n\n return flow\n\n for i in range(self.itr[vertex], len(self.E[vertex])):\n\n self.itr[vertex] = i\n\n e = self.E[vertex][i]\n\n if e.cap > 0 and self.level[vertex] < self.level[e.to]:\n\n d = self.dfs(e.to, sink, min(flow, e.cap))\n\n if d > 0:\n\n e.cap -= d\n\n self.E[e.to][e.rev].cap += d\n\n return d\n\n return 0\n\n\n\n def bfs(self, start):\n\n \"\"\"find shortest path from start\"\"\"\n\n que = collections.deque()\n\n self.level = [-1] * self.V\n\n que.append(start)\n\n self.level[start] = 0\n\n\n\n while que:\n\n fr = que.popleft()\n\n for e in self.E[fr]:\n\n if e.cap > 0 and self.level[e.to] < 0:\n\n self.level[e.to] = self.level[fr] + 1\n\n que.append(e.to)\n\n\n\nwhile True:\n\n M, N = list(map(int, input().split()))\n\n if M == 0 and N == 0:\n\n break\n\n blue, red = [], []\n\n while True:\n\n for x in input().split():\n\n blue.append(int(x))\n\n if len(blue) == M:\n\n break\n\n while True:\n\n for x in input().split():\n\n red.append(int(x))\n\n if len(red) == N:\n\n break\n\n V = M + N + 2\n\n edge = [set() for _ in range(V)]\n\n for i, b in enumerate(blue):\n\n if b != 1:\n\n for j, r in enumerate(red):\n\n if r % b == 0:\n\n edge[i].add((M+j, 1))\n\n for j in range(2, int(math.sqrt(b)) + 1):\n\n if b % j == 0:\n\n for k, r in enumerate(red):\n\n if r % j == 0 or r % (b \/\/ j) == 0:\n\n edge[i].add((M+k, 1))\n\n for i in range(M):\n\n edge[M+N].add((i, 1))\n\n for j in range(N):\n\n edge[M+j].add((M+N+1, 1))\n\n d = Dinic(V, edge, M+N, M+N+1)\n\n print((d.maxflow))","code_v0_loc":105,"code_v1_loc":106,"code_v0_num_chars":3249,"code_v1_num_chars":3284,"code_v0_no_empty_lines":"import collections\nimport math\n\n\nclass Dinic:\n \"\"\"Dinic Algorithm: find max-flow\n complexity: O(EV^2)\n used in GRL6A(AOJ)\n \"\"\"\n\n class edge:\n def __init__(self, to, cap, rev):\n self.to, self.cap, self.rev = to, cap, rev\n\n def __init__(self, V, E, source, sink):\n \"\"\"V: the number of vertexes\n E: adjacency list\n source: start point\n sink: goal point\n \"\"\"\n self.V = V\n self.E = [[] for _ in range(V)]\n for fr in range(V):\n for to, cap in E[fr]:\n self.E[fr].append(self.edge(to, cap, len(self.E[to])))\n self.E[to].append(self.edge(fr, 0, len(self.E[fr]) - 1))\n self.maxflow = self.dinic(source, sink)\n\n def dinic(self, source, sink):\n \"\"\"find max-flow\"\"\"\n INF = float(\"inf\")\n maxflow = 0\n while True:\n self.bfs(source)\n if self.level[sink] < 0:\n return maxflow\n self.itr = [0] * self.V\n while True:\n flow = self.dfs(source, sink, INF)\n if flow > 0:\n maxflow += flow\n else:\n break\n\n def dfs(self, vertex, sink, flow):\n \"\"\"find augmenting path\"\"\"\n if vertex == sink:\n return flow\n for i in range(self.itr[vertex], len(self.E[vertex])):\n self.itr[vertex] = i\n e = self.E[vertex][i]\n if e.cap > 0 and self.level[vertex] < self.level[e.to]:\n d = self.dfs(e.to, sink, min(flow, e.cap))\n if d > 0:\n e.cap -= d\n self.E[e.to][e.rev].cap += d\n return d\n return 0\n\n def bfs(self, start):\n \"\"\"find shortest path from start\"\"\"\n que = collections.deque()\n self.level = [-1] * self.V\n que.append(start)\n self.level[start] = 0\n while que:\n fr = que.popleft()\n for e in self.E[fr]:\n if e.cap > 0 and self.level[e.to] < 0:\n self.level[e.to] = self.level[fr] + 1\n que.append(e.to)\n\n\nwhile True:\n M, N = list(map(int, input().split()))\n if M == 0 and N == 0:\n break\n blue, red = [], []\n while True:\n for x in input().split():\n blue.append(int(x))\n if len(blue) == M:\n break\n while True:\n for x in input().split():\n red.append(int(x))\n if len(red) == N:\n break\n V = M + N + 2\n edge = [set() for _ in range(V)]\n for i, b in enumerate(blue):\n if b != 1:\n for j, r in enumerate(red):\n if r % b == 0:\n edge[i].add((M + j, 1))\n for j in range(2, int(math.sqrt(b)) + 1):\n if b % j == 0:\n for k, r in enumerate(red):\n if r % j == 0 or r % (b \/\/ j) == 0:\n edge[i].add((M + k, 1))\n for i in range(M):\n edge[M + N].add((i, 1))\n for j in range(N):\n edge[M + j].add((M + N + 1, 1))\n d = Dinic(V, edge, M + N, M + N + 1)\n print((d.maxflow))\n","code_v1_no_empty_lines":"import collections\nimport math\n\nrange = xrange\ninput = raw_input\n\n\nclass Dinic:\n \"\"\"Dinic Algorithm: find max-flow\n complexity: O(EV^2)\n used in GRL6A(AOJ)\n \"\"\"\n\n class edge:\n def __init__(self, to, cap, rev):\n self.to, self.cap, self.rev = to, cap, rev\n\n def __init__(self, V, E, source, sink):\n \"\"\"V: the number of vertexes\n E: adjacency list\n source: start point\n sink: goal point\n \"\"\"\n self.V = V\n self.E = [[] for _ in range(V)]\n for fr in range(V):\n for to, cap in E[fr]:\n self.E[fr].append(self.edge(to, cap, len(self.E[to])))\n self.E[to].append(self.edge(fr, 0, len(self.E[fr]) - 1))\n self.maxflow = self.dinic(source, sink)\n\n def dinic(self, source, sink):\n \"\"\"find max-flow\"\"\"\n INF = float(\"inf\")\n maxflow = 0\n while True:\n self.bfs(source)\n if self.level[sink] < 0:\n return maxflow\n self.itr = [0] * self.V\n while True:\n flow = self.dfs(source, sink, INF)\n if flow > 0:\n maxflow += flow\n else:\n break\n\n def dfs(self, vertex, sink, flow):\n \"\"\"find augmenting path\"\"\"\n if vertex == sink:\n return flow\n for i in range(self.itr[vertex], len(self.E[vertex])):\n self.itr[vertex] = i\n e = self.E[vertex][i]\n if e.cap > 0 and self.level[vertex] < self.level[e.to]:\n d = self.dfs(e.to, sink, min(flow, e.cap))\n if d > 0:\n e.cap -= d\n self.E[e.to][e.rev].cap += d\n return d\n return 0\n\n def bfs(self, start):\n \"\"\"find shortest path from start\"\"\"\n que = collections.deque()\n self.level = [-1] * self.V\n que.append(start)\n self.level[start] = 0\n while que:\n fr = que.popleft()\n for e in self.E[fr]:\n if e.cap > 0 and self.level[e.to] < 0:\n self.level[e.to] = self.level[fr] + 1\n que.append(e.to)\n\n\nwhile True:\n M, N = list(map(int, input().split()))\n if M == 0 and N == 0:\n break\n blue, red = [], []\n while True:\n for x in input().split():\n blue.append(int(x))\n if len(blue) == M:\n break\n while True:\n for x in input().split():\n red.append(int(x))\n if len(red) == N:\n break\n V = M + N + 2\n edge = [set() for _ in range(V)]\n for i, b in enumerate(blue):\n if b != 1:\n for j, r in enumerate(red):\n if r % b == 0:\n edge[i].add((M + j, 1))\n for j in range(2, int(math.sqrt(b)) + 1):\n if b % j == 0:\n for k, r in enumerate(red):\n if r % j == 0 or r % (b \/\/ j) == 0:\n edge[i].add((M + k, 1))\n for i in range(M):\n edge[M + N].add((i, 1))\n for j in range(N):\n edge[M + j].add((M + N + 1, 1))\n d = Dinic(V, edge, M + N, M + N + 1)\n print((d.maxflow))\n","code_same":false,"relative_loc_diff_percent":0.9433962264,"diff":["+","+range = xrange","+input = raw_input"],"diff_only_import_comment":false,"measured_runtime_v0":0.4880815578,"measured_runtime_v1":0.2093546903,"runtime_lift":2.3313619437,"key":["s226218538","s459214194"]} +{"user_id":"u759934006","problem_id":"p00174","language":"python","submission_id_v0":"s437122774","submission_id_v1":"s723923476","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4228,"memory_v1":4232,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nwhile True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n a = b = 0\n\n for i, s in enumerate(line):\n\n if i != 0:\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break\n\n# optimized version of the same code:\n","target":"while True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n if line[0] == 'A':\n\n a = -1\n\n b = 0\n\n else:\n\n a = 0\n\n b = -1\n\n for i, s in enumerate(line):\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break","code_v0_loc":22,"code_v1_loc":26,"code_v0_num_chars":515,"code_v1_num_chars":593,"code_v0_no_empty_lines":"while True:\n try:\n for i in range(3):\n line = input().strip()\n if line == \"0\":\n raise Exception\n a = b = 0\n for i, s in enumerate(line):\n if i != 0:\n if s == \"A\":\n a += 1\n else:\n b += 1\n if a > b:\n a += 1\n else:\n b += 1\n print(a, b)\n except:\n break\n","code_v1_no_empty_lines":"while True:\n try:\n for i in range(3):\n line = input().strip()\n if line == \"0\":\n raise Exception\n if line[0] == \"A\":\n a = -1\n b = 0\n else:\n a = 0\n b = -1\n for i, s in enumerate(line):\n if s == \"A\":\n a += 1\n else:\n b += 1\n if a > b:\n a += 1\n else:\n b += 1\n print(a, b)\n except:\n break\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["- a = b = 0","+ if line[0] == \"A\":","+ a = -1","+ b = 0","+ else:","+ a = 0","+ b = -1","- if i != 0:","- if s == \"A\":","- a += 1","- else:","- b += 1","+ if s == \"A\":","+ a += 1","+ else:","+ b += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.1803158569,"measured_runtime_v1":0.0065688469,"runtime_lift":27.4501534712,"key":["s437122774","s723923476"]} +{"user_id":"u867848444","problem_id":"p03559","language":"python","submission_id_v0":"s912886810","submission_id_v1":"s338115037","cpu_time_v0":472,"cpu_time_v1":254,"memory_v0":106340,"memory_v1":29384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.19,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom bisect import *\n\nn = int(eval(input()))\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na = sorted(a)\n\nc = sorted(c)\n\n\n\nrec = 0\n\nfor i in range(n):\n\n temp = b[i]\n\n l = bisect_left(a, temp)\n\n r = bisect_right(c, temp)\n\n rec += l * (n - r)\n\nprint(rec)\n\n# optimized version of the same code:\n","target":"from bisect import *\n\nn = int(eval(input()))\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na.sort()\n\nc.sort()\n\nres = 0\n\nfor i in b:\n\n temp_a = bisect_left(a, i)\n\n temp_c = n - bisect_right(c, i)\n\n res += temp_a*temp_c\n\nprint(res)","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":323,"code_v1_num_chars":297,"code_v0_no_empty_lines":"from bisect import *\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na = sorted(a)\nc = sorted(c)\nrec = 0\nfor i in range(n):\n temp = b[i]\n l = bisect_left(a, temp)\n r = bisect_right(c, temp)\n rec += l * (n - r)\nprint(rec)\n","code_v1_no_empty_lines":"from bisect import *\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort()\nc.sort()\nres = 0\nfor i in b:\n temp_a = bisect_left(a, i)\n temp_c = n - bisect_right(c, i)\n res += temp_a * temp_c\nprint(res)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-a = sorted(a)","-c = sorted(c)","-rec = 0","-for i in range(n):","- temp = b[i]","- l = bisect_left(a, temp)","- r = bisect_right(c, temp)","- rec += l * (n - r)","-print(rec)","+a.sort()","+c.sort()","+res = 0","+for i in b:","+ temp_a = bisect_left(a, i)","+ temp_c = n - bisect_right(c, i)","+ res += temp_a * temp_c","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2357759671,"measured_runtime_v1":0.1661899195,"runtime_lift":1.4187140102,"key":["s912886810","s338115037"]} +{"user_id":"u784022244","problem_id":"p02837","language":"python","submission_id_v0":"s559335403","submission_id_v1":"s607948233","cpu_time_v0":1624,"cpu_time_v1":1457,"memory_v0":3064,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.28,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN=int(eval(input()))\n\n\n\nS=[[-1]*N for _ in range(N)]\n\nfor i in range(N):\n\n A=int(eval(input()))\n\n for _ in range(A):\n\n x, y=list(map(int, input().split()))\n\n S[i][x-1]=y\n\nans=0 \n\nfor s in range(2**N):\n\n ok=True\n\n for i in range(N):\n\n #\u6b63\u76f4\u8005\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304f\n\n if (s>>i&1)==1:\n\n for j in range(N):\n\n #\u305d\u308c\u305e\u308c\u6b63\u76f4\u8005\u306e\u8a3c\u8a00\u304c\u77db\u76fe\u306a\u3044\u304b\n\n if S[i][j]!=-1 and (s>>j&1)!=S[i][j]:\n\n ok=False\n\n if ok:\n\n ans=max(ans, bin(s).count(\"1\"))\n\n \n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\n\n\nA=[[-1]*N for _ in range(N)]\n\nfor i in range(N):\n\n a=int(eval(input()))\n\n for j in range(a):\n\n x,y=list(map(int, input().split()))\n\n A[i][x-1]=y\n\n#\u6b63\u76f4\u8005\u304c\u6b63\u76f4\u8005\u306b\u4e0d\u89aa\u5207\u3068\u8a00\u308f\u308c\u3066\u3044\u306a\u3044\n\n#\u2192\u6b63\u76f4\u3082\u306e\u304c\u4e0d\u89aa\u5207\u3092\u6b63\u76f4\u8005\u3068\u8a00\u3063\u3066\u3044\u306a\u3044\u304b\n\nans=0\n\nfor i in range(2**N):\n\n ok=True\n\n for j in range(N):\n\n if (i>>j&1)==1:\n\n for k in range(N):\n\n if A[j][k]!=-1 and (i>>k&1)!=A[j][k]:\n\n ok=False\n\n if ok:\n\n ans=max(ans, bin(i).count(\"1\"))\n\n \n\nprint(ans)","code_v0_loc":22,"code_v1_loc":22,"code_v0_num_chars":450,"code_v1_num_chars":444,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = [[-1] * N for _ in range(N)]\nfor i in range(N):\n A = int(eval(input()))\n for _ in range(A):\n x, y = list(map(int, input().split()))\n S[i][x - 1] = y\nans = 0\nfor s in range(2**N):\n ok = True\n for i in range(N):\n # \u6b63\u76f4\u8005\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304f\n if (s >> i & 1) == 1:\n for j in range(N):\n # \u305d\u308c\u305e\u308c\u6b63\u76f4\u8005\u306e\u8a3c\u8a00\u304c\u77db\u76fe\u306a\u3044\u304b\n if S[i][j] != -1 and (s >> j & 1) != S[i][j]:\n ok = False\n if ok:\n ans = max(ans, bin(s).count(\"1\"))\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [[-1] * N for _ in range(N)]\nfor i in range(N):\n a = int(eval(input()))\n for j in range(a):\n x, y = list(map(int, input().split()))\n A[i][x - 1] = y\n# \u6b63\u76f4\u8005\u304c\u6b63\u76f4\u8005\u306b\u4e0d\u89aa\u5207\u3068\u8a00\u308f\u308c\u3066\u3044\u306a\u3044\n# \u2192\u6b63\u76f4\u3082\u306e\u304c\u4e0d\u89aa\u5207\u3092\u6b63\u76f4\u8005\u3068\u8a00\u3063\u3066\u3044\u306a\u3044\u304b\nans = 0\nfor i in range(2**N):\n ok = True\n for j in range(N):\n if (i >> j & 1) == 1:\n for k in range(N):\n if A[j][k] != -1 and (i >> k & 1) != A[j][k]:\n ok = False\n if ok:\n ans = max(ans, bin(i).count(\"1\"))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S = [[-1] * N for _ in range(N)]","+A = [[-1] * N for _ in range(N)]","- A = int(eval(input()))","- for _ in range(A):","+ a = int(eval(input()))","+ for j in range(a):","- S[i][x - 1] = y","+ A[i][x - 1] = y","+# \u6b63\u76f4\u8005\u304c\u6b63\u76f4\u8005\u306b\u4e0d\u89aa\u5207\u3068\u8a00\u308f\u308c\u3066\u3044\u306a\u3044","+# \u2192\u6b63\u76f4\u3082\u306e\u304c\u4e0d\u89aa\u5207\u3092\u6b63\u76f4\u8005\u3068\u8a00\u3063\u3066\u3044\u306a\u3044\u304b","-for s in range(2**N):","+for i in range(2**N):","- for i in range(N):","- # \u6b63\u76f4\u8005\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304f","- if (s >> i & 1) == 1:","- for j in range(N):","- # \u305d\u308c\u305e\u308c\u6b63\u76f4\u8005\u306e\u8a3c\u8a00\u304c\u77db\u76fe\u306a\u3044\u304b","- if S[i][j] != -1 and (s >> j & 1) != S[i][j]:","+ for j in range(N):","+ if (i >> j & 1) == 1:","+ for k in range(N):","+ if A[j][k] != -1 and (i >> k & 1) != A[j][k]:","- ans = max(ans, bin(s).count(\"1\"))","+ ans = max(ans, bin(i).count(\"1\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3389718752,"measured_runtime_v1":0.2550898321,"runtime_lift":1.3288333464,"key":["s559335403","s607948233"]} +{"user_id":"u842747358","problem_id":"p02899","language":"python","submission_id_v0":"s407352029","submission_id_v1":"s941706304","cpu_time_v0":381,"cpu_time_v1":79,"memory_v0":55248,"memory_v1":21068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nfrom copy import deepcopy\n\n\n\nN = int(eval(input()))\n\nA = []\n\nA.append(list(map(int, input().split())))\n\na = deepcopy(A[0])\n\na.sort()\n\nA.append(a)\n\nA_t = np.array(A).T.tolist()\n\nA_t.sort()\n\n\n\nout = []\n\nfor i in range(N):\n\n out.append(str(A_t[i][1]))\n\nprint((\" \".join(out)))\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nrev = [\"\"] * N\n\nfor i in range(N):\n\n rev[A[i]-1] = str(i+1)\n\nprint((\" \".join(rev)))\n","code_v0_loc":16,"code_v1_loc":7,"code_v0_num_chars":288,"code_v1_num_chars":142,"code_v0_no_empty_lines":"import numpy as np\nfrom copy import deepcopy\n\nN = int(eval(input()))\nA = []\nA.append(list(map(int, input().split())))\na = deepcopy(A[0])\na.sort()\nA.append(a)\nA_t = np.array(A).T.tolist()\nA_t.sort()\nout = []\nfor i in range(N):\n out.append(str(A_t[i][1]))\nprint((\" \".join(out)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nrev = [\"\"] * N\nfor i in range(N):\n rev[A[i] - 1] = str(i + 1)\nprint((\" \".join(rev)))\n","code_same":false,"relative_loc_diff_percent":56.25,"diff":["-import numpy as np","-from copy import deepcopy","-","-A = []","-A.append(list(map(int, input().split())))","-a = deepcopy(A[0])","-a.sort()","-A.append(a)","-A_t = np.array(A).T.tolist()","-A_t.sort()","-out = []","+A = list(map(int, input().split()))","+rev = [\"\"] * N","- out.append(str(A_t[i][1]))","-print((\" \".join(out)))","+ rev[A[i] - 1] = str(i + 1)","+print((\" \".join(rev)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3604369454,"measured_runtime_v1":0.1764305278,"runtime_lift":7.7108931321,"key":["s407352029","s941706304"]} +{"user_id":"u761320129","problem_id":"p03592","language":"python","submission_id_v0":"s651607907","submission_id_v1":"s022339691","cpu_time_v0":277,"cpu_time_v1":242,"memory_v0":9168,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n t = i*M + j*N - i*j*2\n\n if t==K:\n\n print('Yes')\n\n exit()\n\nprint('No')\n\n# optimized version of the same code:\n","target":"N,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n if i*(M-j) + j*(N-i) == K:\n\n print('Yes')\n\n exit()\n\nprint('No')","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":190,"code_v1_num_chars":177,"code_v0_no_empty_lines":"N, M, K = list(map(int, input().split()))\nfor i in range(N + 1):\n for j in range(M + 1):\n t = i * M + j * N - i * j * 2\n if t == K:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_v1_no_empty_lines":"N, M, K = list(map(int, input().split()))\nfor i in range(N + 1):\n for j in range(M + 1):\n if i * (M - j) + j * (N - i) == K:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["- t = i * M + j * N - i * j * 2","- if t == K:","+ if i * (M - j) + j * (N - i) == K:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2590724151,"measured_runtime_v1":0.2069754691,"runtime_lift":1.2517058964,"key":["s651607907","s022339691"]} +{"user_id":"u078042885","problem_id":"p00542","language":"python","submission_id_v0":"s237799080","submission_id_v1":"s666902384","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7744,"memory_v1":7736,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c,d,e,f=[int(eval(input())) for _ in range(6)]\n\nprint((sum([a,b,c,d,max(e,f)])-min([a,b,c,d])))\n\n# optimized version of the same code:\n","target":"print((sum(sorted(int(eval(input())) for _ in range(4))[1:])+max([int(eval(input())) for _ in range(2)])))","code_v0_loc":2,"code_v1_loc":1,"code_v0_num_chars":91,"code_v1_num_chars":92,"code_v0_no_empty_lines":"a, b, c, d, e, f = [int(eval(input())) for _ in range(6)]\nprint((sum([a, b, c, d, max(e, f)]) - min([a, b, c, d])))\n","code_v1_no_empty_lines":"print(\n (\n sum(sorted(int(eval(input())) for _ in range(4))[1:])\n + max([int(eval(input())) for _ in range(2)])\n )\n)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-a, b, c, d, e, f = [int(eval(input())) for _ in range(6)]","-print((sum([a, b, c, d, max(e, f)]) - min([a, b, c, d])))","+print(","+ (","+ sum(sorted(int(eval(input())) for _ in range(4))[1:])","+ + max([int(eval(input())) for _ in range(2)])","+ )","+)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1785885925,"measured_runtime_v1":0.1362432997,"runtime_lift":1.3108064241,"key":["s237799080","s666902384"]} +{"user_id":"u135454978","problem_id":"p03371","language":"python","submission_id_v0":"s681762997","submission_id_v1":"s948041496","cpu_time_v0":154,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.96,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z \/ 2), 0)\n\n y = max(Y - int(z \/ 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\n\"\"\"\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z \/ 2), 0)\n\n y = max(Y - int(z \/ 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n\n\"\"\"\n\n\n\nprice1 = A * X + B * Y\n\nprice2 = C * 2 * X + B * max(Y - X, 0)\n\nprice3 = A * max(X - Y, 0) + C * 2 * Y\n\nprint((min(price1, price2, price3)))\n\n\n","code_v0_loc":14,"code_v1_loc":22,"code_v0_num_chars":332,"code_v1_num_chars":486,"code_v0_no_empty_lines":"# AtCoder Beginner Contest 095 C - Half and Half\nimport sys\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\nans = A * X + B * Y\nfor z in range(2, 2 * 10**5 + 1, 2):\n x = max(X - int(z \/ 2), 0)\n y = max(Y - int(z \/ 2), 0)\n price = A * x + B * y + C * z\n ans = min(price, ans)\nprint(ans)\n","code_v1_no_empty_lines":"# AtCoder Beginner Contest 095 C - Half and Half\nimport sys\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\"\"\"\nans = A * X + B * Y\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n x = max(X - int(z \/ 2), 0)\n y = max(Y - int(z \/ 2), 0)\n price = A * x + B * y + C * z\n ans = min(price, ans)\nprint(ans)\n\"\"\"\nprice1 = A * X + B * Y\nprice2 = C * 2 * X + B * max(Y - X, 0)\nprice3 = A * max(X - Y, 0) + C * 2 * Y\nprint((min(price1, price2, price3)))\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["+\"\"\"","-for z in range(2, 2 * 10**5 + 1, 2):","+for z in range(2, 2 * 10 ** 5 + 1, 2):","+\"\"\"","+price1 = A * X + B * Y","+price2 = C * 2 * X + B * max(Y - X, 0)","+price3 = A * max(X - Y, 0) + C * 2 * Y","+print((min(price1, price2, price3)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.7125969741,"measured_runtime_v1":0.2827094927,"runtime_lift":6.0577979106,"key":["s681762997","s948041496"]} +{"user_id":"u545368057","problem_id":"p02773","language":"python","submission_id_v0":"s347160213","submission_id_v1":"s313812634","cpu_time_v0":801,"cpu_time_v1":714,"memory_v0":32480,"memory_v1":35572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import defaultdict\n\nN = int(eval(input()))\n\nd = defaultdict(int)\n\n\n\nfor i in range(N):\n\n S = eval(input())\n\n d[S] += 1\n\n\n\nm = 0\n\nfor k in list(d.keys()):\n\n m = max(d[k],m)\n\n\n\nli = []\n\nfor k in list(d.keys()):\n\n if d[k] == m:\n\n li.append(k)\n\n\n\nli.sort()\n\nfor l in li:\n\n print(l)\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\nN = int(eval(input()))\n\nSs = [eval(input()) for i in range(N)]\n\n\n\nd = defaultdict(int)\n\nfor S in Ss:\n\n d[S] += 1\n\n\n\nmx = max([d[k] for k in list(d.keys())])\n\n\n\nans = []\n\nfor k in list(d.keys()):\n\n if d[k] == mx:\n\n ans.append(k)\n\n \n\nfor a in sorted(ans):\n\n print(a)","code_v0_loc":20,"code_v1_loc":17,"code_v0_num_chars":292,"code_v1_num_chars":298,"code_v0_no_empty_lines":"from collections import defaultdict\n\nN = int(eval(input()))\nd = defaultdict(int)\nfor i in range(N):\n S = eval(input())\n d[S] += 1\nm = 0\nfor k in list(d.keys()):\n m = max(d[k], m)\nli = []\nfor k in list(d.keys()):\n if d[k] == m:\n li.append(k)\nli.sort()\nfor l in li:\n print(l)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nN = int(eval(input()))\nSs = [eval(input()) for i in range(N)]\nd = defaultdict(int)\nfor S in Ss:\n d[S] += 1\nmx = max([d[k] for k in list(d.keys())])\nans = []\nfor k in list(d.keys()):\n if d[k] == mx:\n ans.append(k)\nfor a in sorted(ans):\n print(a)\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["+Ss = [eval(input()) for i in range(N)]","-for i in range(N):","- S = eval(input())","+for S in Ss:","-m = 0","+mx = max([d[k] for k in list(d.keys())])","+ans = []","- m = max(d[k], m)","-li = []","-for k in list(d.keys()):","- if d[k] == m:","- li.append(k)","-li.sort()","-for l in li:","- print(l)","+ if d[k] == mx:","+ ans.append(k)","+for a in sorted(ans):","+ print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1866922059,"measured_runtime_v1":0.0060809708,"runtime_lift":30.7010529798,"key":["s347160213","s313812634"]} +{"user_id":"u600402037","problem_id":"p03037","language":"python","submission_id_v0":"s181457641","submission_id_v1":"s911516772","cpu_time_v0":300,"cpu_time_v1":197,"memory_v0":11012,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,M = list(map(int,input().split()))\n\nL,R = [],[]\n\nfor i in range(M):\n\n l,r = list(map(int,input().split()))\n\n L.append(l)\n\n R.append(r)\n\nans = min(R)-max(L)+1\n\nprint((ans if ans >= 0 else 0))\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nimport sys\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN, M = lr()\n\nL = 0; R = 10 ** 6\n\nfor _ in range(M):\n\n l, r = lr()\n\n if l > L:\n\n L = l\n\n if r < R:\n\n R = r\n\n\n\nanswer = max(0, R - L + 1)\n\nprint(answer)\n","code_v0_loc":8,"code_v1_loc":18,"code_v0_num_chars":187,"code_v1_num_chars":318,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nL, R = [], []\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\nans = min(R) - max(L) + 1\nprint((ans if ans >= 0 else 0))\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN, M = lr()\nL = 0\nR = 10**6\nfor _ in range(M):\n l, r = lr()\n if l > L:\n L = l\n if r < R:\n R = r\nanswer = max(0, R - L + 1)\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-N, M = list(map(int, input().split()))","-L, R = [], []","-for i in range(M):","- l, r = list(map(int, input().split()))","- L.append(l)","- R.append(r)","-ans = min(R) - max(L) + 1","-print((ans if ans >= 0 else 0))","+# coding: utf-8","+import sys","+","+sr = lambda: sys.stdin.readline().rstrip()","+ir = lambda: int(sr())","+lr = lambda: list(map(int, sr().split()))","+N, M = lr()","+L = 0","+R = 10**6","+for _ in range(M):","+ l, r = lr()","+ if l > L:","+ L = l","+ if r < R:","+ R = r","+answer = max(0, R - L + 1)","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2034662783,"measured_runtime_v1":0.0060762894,"runtime_lift":33.4852842041,"key":["s181457641","s911516772"]} +{"user_id":"u554953477","problem_id":"p02555","language":"python","submission_id_v0":"s871406737","submission_id_v1":"s010236218","cpu_time_v0":390,"cpu_time_v1":26,"memory_v0":9068,"memory_v1":8996,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nMOD = 1000000007\n\n\n\n\n\nS = int(eval(input()))\n\n\n\n#dp[i]:=i\u6841\u306e\u6570\u5217\u3067\u6761\u4ef6\u3092\u6e80\u305f\u3059\u3082\u306e\u306e\u6570\n\ndp = [0]*(S+1)\n\n\n\nfor i in range(3,S+1):\n\n #dp[i]=sum(dp[0],..,dp[i-3])+1\n\n for j in range(i-3+1):\n\n dp[i] = (dp[i]+dp[j])%MOD\n\n dp[i] = (dp[i]+1)%MOD\n\n\n\nprint((dp[S]))\n\n# optimized version of the same code:\n","target":"MOD = 1000000007\n\n\n\n\n\nS = int(eval(input()))\n\n\n\n#dp[i]:=i\u6841\u306e\u6570\u5217\u3067\u6761\u4ef6\u3092\u6e80\u305f\u3059\u3082\u306e\u306e\u6570\n\ndp = [0]*(S+1)\n\ndp_sum = [0]*(S+1)\n\n\n\nfor i in range(3,S+1):\n\n #dp[i]=sum(dp[0],..,dp[i-3])+1\n\n \n\n dp[i] = (dp_sum[i-3]+1)%MOD\n\n dp_sum[i] = (dp[i]+dp_sum[i-1])%MOD\n\n\n\nprint((dp[S]))","code_v0_loc":15,"code_v1_loc":16,"code_v0_num_chars":250,"code_v1_num_chars":260,"code_v0_no_empty_lines":"MOD = 1000000007\nS = int(eval(input()))\n# dp[i]:=i\u6841\u306e\u6570\u5217\u3067\u6761\u4ef6\u3092\u6e80\u305f\u3059\u3082\u306e\u306e\u6570\ndp = [0] * (S + 1)\nfor i in range(3, S + 1):\n # dp[i]=sum(dp[0],..,dp[i-3])+1\n for j in range(i - 3 + 1):\n dp[i] = (dp[i] + dp[j]) % MOD\n dp[i] = (dp[i] + 1) % MOD\nprint((dp[S]))\n","code_v1_no_empty_lines":"MOD = 1000000007\nS = int(eval(input()))\n# dp[i]:=i\u6841\u306e\u6570\u5217\u3067\u6761\u4ef6\u3092\u6e80\u305f\u3059\u3082\u306e\u306e\u6570\ndp = [0] * (S + 1)\ndp_sum = [0] * (S + 1)\nfor i in range(3, S + 1):\n # dp[i]=sum(dp[0],..,dp[i-3])+1\n dp[i] = (dp_sum[i - 3] + 1) % MOD\n dp_sum[i] = (dp[i] + dp_sum[i - 1]) % MOD\nprint((dp[S]))\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["+dp_sum = [0] * (S + 1)","- for j in range(i - 3 + 1):","- dp[i] = (dp[i] + dp[j]) % MOD","- dp[i] = (dp[i] + 1) % MOD","+ dp[i] = (dp_sum[i - 3] + 1) % MOD","+ dp_sum[i] = (dp[i] + dp_sum[i - 1]) % MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.581069243,"measured_runtime_v1":0.1960333576,"runtime_lift":2.9641345227,"key":["s871406737","s010236218"]} +{"user_id":"u952708174","problem_id":"p03273","language":"python","submission_id_v0":"s363239082","submission_id_v1":"s852466512","cpu_time_v0":1303,"cpu_time_v1":18,"memory_v0":21264,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":98.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy\n\nH, W = [int(i) for i in input().split()]\n\nA = numpy.array([list(input().strip()) for _ in range(H)])\n\n\n\nrow_space = []\n\ncol_space = []\n\n\n\nfor k, row in enumerate(A):\n\n if '#' not in row:\n\n row_space.append(k)\n\n\n\nA_rot = numpy.rot90(A, k=-1)\n\nfor k, row in enumerate(A_rot):\n\n if '#' not in row:\n\n col_space.append(k)\n\n\n\nA = numpy.delete(A, row_space, axis=0)\n\nA = numpy.delete(A, col_space, axis=1)\n\nans = '\\n'.join([''.join(row) for row in A])\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"def rotate_clockwise(matrix):\n\n tmp = list(map(list, list(zip(*matrix))))[::-1]\n\n return list(''.join(row) for row in tmp)\n\n # \u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3092\u5165\u308c\u308b\u306e\u3067\u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n\n\n\n\n\ndef rotate_counterclockwise(matrix):\n\n tmp = list([list(x[::-1]) for x in zip(*matrix)])\n\n return list(''.join(row) for row in tmp)\n\n # \u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3092\u5165\u308c\u308b\u306e\u3067\u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n\n\n\n\n\nH, W = [int(i) for i in input().split()]\n\nA = [eval(input()) for _ in range(H)]\n\n\n\nrow_remove_count = 0\n\nwhile '.' * W in A:\n\n A.remove('.' * W) # \u884c\u307e\u308b\u3054\u3068\u767d\u306a\u3089\u3001\u56de\u6570\u3092\u8a18\u9332\u3057\u3066\u9664\u304f\n\n row_remove_count += 1\n\n\n\nA = rotate_clockwise(A) # \u53cd\u6642\u8a08\u56de\u308a\u306b\u56de\u3059\n\nwhile '.' * (H - row_remove_count) in A:\n\n A.remove('.' * (H - row_remove_count))\n\n\n\nA = rotate_counterclockwise(A) # \u6642\u8a08\u56de\u308a\u306b\u56de\u3057\u3066\u5143\u306b\u623b\u3059\n\nprint(('\\n'.join(A)))","code_v0_loc":20,"code_v1_loc":26,"code_v0_num_chars":490,"code_v1_num_chars":724,"code_v0_no_empty_lines":"import numpy\n\nH, W = [int(i) for i in input().split()]\nA = numpy.array([list(input().strip()) for _ in range(H)])\nrow_space = []\ncol_space = []\nfor k, row in enumerate(A):\n if \"#\" not in row:\n row_space.append(k)\nA_rot = numpy.rot90(A, k=-1)\nfor k, row in enumerate(A_rot):\n if \"#\" not in row:\n col_space.append(k)\nA = numpy.delete(A, row_space, axis=0)\nA = numpy.delete(A, col_space, axis=1)\nans = \"\\n\".join([\"\".join(row) for row in A])\nprint(ans)\n","code_v1_no_empty_lines":"def rotate_clockwise(matrix):\n tmp = list(map(list, list(zip(*matrix))))[::-1]\n return list(\"\".join(row) for row in tmp)\n # \u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3092\u5165\u308c\u308b\u306e\u3067\u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n\n\ndef rotate_counterclockwise(matrix):\n tmp = list([list(x[::-1]) for x in zip(*matrix)])\n return list(\"\".join(row) for row in tmp)\n # \u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3092\u5165\u308c\u308b\u306e\u3067\u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n\n\nH, W = [int(i) for i in input().split()]\nA = [eval(input()) for _ in range(H)]\nrow_remove_count = 0\nwhile \".\" * W in A:\n A.remove(\".\" * W) # \u884c\u307e\u308b\u3054\u3068\u767d\u306a\u3089\u3001\u56de\u6570\u3092\u8a18\u9332\u3057\u3066\u9664\u304f\n row_remove_count += 1\nA = rotate_clockwise(A) # \u53cd\u6642\u8a08\u56de\u308a\u306b\u56de\u3059\nwhile \".\" * (H - row_remove_count) in A:\n A.remove(\".\" * (H - row_remove_count))\nA = rotate_counterclockwise(A) # \u6642\u8a08\u56de\u308a\u306b\u56de\u3057\u3066\u5143\u306b\u623b\u3059\nprint((\"\\n\".join(A)))\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-import numpy","+def rotate_clockwise(matrix):","+ tmp = list(map(list, list(zip(*matrix))))[::-1]","+ return list(\"\".join(row) for row in tmp)","+ # \u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3092\u5165\u308c\u308b\u306e\u3067\u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3067\u8fd4\u3059","+","+","+def rotate_counterclockwise(matrix):","+ tmp = list([list(x[::-1]) for x in zip(*matrix)])","+ return list(\"\".join(row) for row in tmp)","+ # \u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3092\u5165\u308c\u308b\u306e\u3067\u6587\u5b57\u5217\u306e\u30ea\u30b9\u30c8\u3067\u8fd4\u3059","+","-A = numpy.array([list(input().strip()) for _ in range(H)])","-row_space = []","-col_space = []","-for k, row in enumerate(A):","- if \"#\" not in row:","- row_space.append(k)","-A_rot = numpy.rot90(A, k=-1)","-for k, row in enumerate(A_rot):","- if \"#\" not in row:","- col_space.append(k)","-A = numpy.delete(A, row_space, axis=0)","-A = numpy.delete(A, col_space, axis=1)","-ans = \"\\n\".join([\"\".join(row) for row in A])","-print(ans)","+A = [eval(input()) for _ in range(H)]","+row_remove_count = 0","+while \".\" * W in A:","+ A.remove(\".\" * W) # \u884c\u307e\u308b\u3054\u3068\u767d\u306a\u3089\u3001\u56de\u6570\u3092\u8a18\u9332\u3057\u3066\u9664\u304f","+ row_remove_count += 1","+A = rotate_clockwise(A) # \u53cd\u6642\u8a08\u56de\u308a\u306b\u56de\u3059","+while \".\" * (H - row_remove_count) in A:","+ A.remove(\".\" * (H - row_remove_count))","+A = rotate_counterclockwise(A) # \u6642\u8a08\u56de\u308a\u306b\u56de\u3057\u3066\u5143\u306b\u623b\u3059","+print((\"\\n\".join(A)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3900156258,"measured_runtime_v1":0.2221083821,"runtime_lift":6.2582763077,"key":["s363239082","s852466512"]} +{"user_id":"u175590965","problem_id":"p02881","language":"python","submission_id_v0":"s837964487","submission_id_v1":"s558772824","cpu_time_v0":232,"cpu_time_v1":167,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.02,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nl = []\n\nfor i in range(1,1000001):\n\n a = n \/ i\n\n if a.is_integer():\n\n l.append(i+n\/i)\n\nprint((int(min(l)-2)))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na = 10**20\n\nfor i in range(1,int(n**0.5)+1):\n\n if n%i==0:\n\n a = min(a,i+n\/\/i)\n\nprint((a-2))","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":138,"code_v1_num_chars":117,"code_v0_no_empty_lines":"n = int(eval(input()))\nl = []\nfor i in range(1, 1000001):\n a = n \/ i\n if a.is_integer():\n l.append(i + n \/ i)\nprint((int(min(l) - 2)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = 10**20\nfor i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n a = min(a, i + n \/\/ i)\nprint((a - 2))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-l = []","-for i in range(1, 1000001):","- a = n \/ i","- if a.is_integer():","- l.append(i + n \/ i)","-print((int(min(l) - 2)))","+a = 10**20","+for i in range(1, int(n**0.5) + 1):","+ if n % i == 0:","+ a = min(a, i + n \/\/ i)","+print((a - 2))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3549120984,"measured_runtime_v1":0.219868273,"runtime_lift":6.1623811373,"key":["s837964487","s558772824"]} +{"user_id":"u597455618","problem_id":"p03640","language":"python","submission_id_v0":"s574129545","submission_id_v1":"s549640590","cpu_time_v0":121,"cpu_time_v1":34,"memory_v0":27292,"memory_v1":9536,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":71.9,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\n\n\ndef main():\n\n h, w = list(map(int, sys.stdin.buffer.readline().split()))\n\n n = int(sys.stdin.buffer.readline())\n\n a = list(map(int, sys.stdin.buffer.readline().split()))\n\n ans = np.zeros(w*h, np.int64)\n\n now = 0\n\n for i, x in enumerate(a):\n\n for j in range(x):\n\n ans[now + j] = i+1\n\n now += x\n\n\n\n ans = ans.reshape(h, w)\n\n for i in range(h):\n\n if i % 2:\n\n print((*ans[i, ::-1]))\n\n else:\n\n print((*ans[i]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\n\n\ndef main():\n\n h, w = list(map(int, sys.stdin.buffer.readline().split()))\n\n n = int(sys.stdin.buffer.readline())\n\n a = list(map(int, sys.stdin.buffer.readline().split()))\n\n ans = [0]*(w*h)\n\n now = 0\n\n for i, x in enumerate(a):\n\n for j in range(x):\n\n ans[now + j] = i+1\n\n now += x\n\n\n\n for i in range(h):\n\n if i % 2:\n\n print((*reversed(ans[i*w:(i+1)*w])))\n\n else:\n\n print((*ans[i*w:(i+1)*w]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":25,"code_v1_loc":23,"code_v0_num_chars":561,"code_v1_num_chars":522,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\n\ndef main():\n h, w = list(map(int, sys.stdin.buffer.readline().split()))\n n = int(sys.stdin.buffer.readline())\n a = list(map(int, sys.stdin.buffer.readline().split()))\n ans = np.zeros(w * h, np.int64)\n now = 0\n for i, x in enumerate(a):\n for j in range(x):\n ans[now + j] = i + 1\n now += x\n ans = ans.reshape(h, w)\n for i in range(h):\n if i % 2:\n print((*ans[i, ::-1]))\n else:\n print((*ans[i]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef main():\n h, w = list(map(int, sys.stdin.buffer.readline().split()))\n n = int(sys.stdin.buffer.readline())\n a = list(map(int, sys.stdin.buffer.readline().split()))\n ans = [0] * (w * h)\n now = 0\n for i, x in enumerate(a):\n for j in range(x):\n ans[now + j] = i + 1\n now += x\n for i in range(h):\n if i % 2:\n print((*reversed(ans[i * w : (i + 1) * w])))\n else:\n print((*ans[i * w : (i + 1) * w]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["-import numpy as np","- ans = np.zeros(w * h, np.int64)","+ ans = [0] * (w * h)","- ans = ans.reshape(h, w)","- print((*ans[i, ::-1]))","+ print((*reversed(ans[i * w : (i + 1) * w])))","- print((*ans[i]))","+ print((*ans[i * w : (i + 1) * w]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4232974133,"measured_runtime_v1":0.1936318126,"runtime_lift":7.3505349889,"key":["s574129545","s549640590"]} +{"user_id":"u186838327","problem_id":"p02881","language":"python","submission_id_v0":"s806961932","submission_id_v1":"s386327339","cpu_time_v0":218,"cpu_time_v1":179,"memory_v0":40428,"memory_v1":39280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.89,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nimport math\n\nm = int(math.sqrt(n))+1\n\nanss = []\n\nfor x in range(1, m+1):\n\n y = n\/\/x\n\n z = n%x\n\n if z == 0:\n\n anss.append(abs(x-1)+abs(y-1))\n\nprint((min(anss)))\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\ndef make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n \/\/ i:\n\n divisors.append(n\/\/i)\n\n\n\n #divisors.sort(reverse=True)\n\n return divisors\n\n\n\nl = make_divisors(n)\n\nmin_ = float('inf')\n\nfor i in range(len(l)):\n\n min_ = min(min_, l[i]-1+n\/\/l[i]-1)\n\nprint(min_)\n","code_v0_loc":10,"code_v1_loc":17,"code_v0_num_chars":182,"code_v1_num_chars":402,"code_v0_no_empty_lines":"n = int(eval(input()))\nimport math\n\nm = int(math.sqrt(n)) + 1\nanss = []\nfor x in range(1, m + 1):\n y = n \/\/ x\n z = n % x\n if z == 0:\n anss.append(abs(x - 1) + abs(y - 1))\nprint((min(anss)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n \/\/ i:\n divisors.append(n \/\/ i)\n # divisors.sort(reverse=True)\n return divisors\n\n\nl = make_divisors(n)\nmin_ = float(\"inf\")\nfor i in range(len(l)):\n min_ = min(min_, l[i] - 1 + n \/\/ l[i] - 1)\nprint(min_)\n","code_same":false,"relative_loc_diff_percent":41.1764705882,"diff":["-import math","-m = int(math.sqrt(n)) + 1","-anss = []","-for x in range(1, m + 1):","- y = n \/\/ x","- z = n % x","- if z == 0:","- anss.append(abs(x - 1) + abs(y - 1))","-print((min(anss)))","+","+def make_divisors(n):","+ divisors = []","+ for i in range(1, int(n**0.5) + 1):","+ if n % i == 0:","+ divisors.append(i)","+ if i != n \/\/ i:","+ divisors.append(n \/\/ i)","+ # divisors.sort(reverse=True)","+ return divisors","+","+","+l = make_divisors(n)","+min_ = float(\"inf\")","+for i in range(len(l)):","+ min_ = min(min_, l[i] - 1 + n \/\/ l[i] - 1)","+print(min_)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3428507342,"measured_runtime_v1":0.2632945333,"runtime_lift":1.302156676,"key":["s806961932","s386327339"]} +{"user_id":"u348868667","problem_id":"p02994","language":"python","submission_id_v0":"s647144203","submission_id_v1":"s608787131","cpu_time_v0":154,"cpu_time_v1":17,"memory_v0":12508,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.96,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN,L = list(map(int,input().split()))\n\napple = np.array(list(range(N))) + 1\n\ntaste = apple + L - 1\n\ntaste_applepie = sum(taste)\n\nif L <= 0 and abs(N) > abs(L):\n\n print(taste_applepie)\n\nelif L > 0:\n\n print((taste_applepie - L))\n\nelse:\n\n print((taste_applepie - (N+L-1)))\n\n# optimized version of the same code:\n","target":"N,L = list(map(int,input().split()))\n\nt = [L+i-1 for i in range(1,N+1)]\n\nabst = list(map(abs,t))\n\nminind = abst.index(min(abst))\n\nprint((sum(t)-t[minind]))","code_v0_loc":11,"code_v1_loc":5,"code_v0_num_chars":281,"code_v1_num_chars":147,"code_v0_no_empty_lines":"import numpy as np\n\nN, L = list(map(int, input().split()))\napple = np.array(list(range(N))) + 1\ntaste = apple + L - 1\ntaste_applepie = sum(taste)\nif L <= 0 and abs(N) > abs(L):\n print(taste_applepie)\nelif L > 0:\n print((taste_applepie - L))\nelse:\n print((taste_applepie - (N + L - 1)))\n","code_v1_no_empty_lines":"N, L = list(map(int, input().split()))\nt = [L + i - 1 for i in range(1, N + 1)]\nabst = list(map(abs, t))\nminind = abst.index(min(abst))\nprint((sum(t) - t[minind]))\n","code_same":false,"relative_loc_diff_percent":54.5454545455,"diff":["-import numpy as np","-","-apple = np.array(list(range(N))) + 1","-taste = apple + L - 1","-taste_applepie = sum(taste)","-if L <= 0 and abs(N) > abs(L):","- print(taste_applepie)","-elif L > 0:","- print((taste_applepie - L))","-else:","- print((taste_applepie - (N + L - 1)))","+t = [L + i - 1 for i in range(1, N + 1)]","+abst = list(map(abs, t))","+minind = abst.index(min(abst))","+print((sum(t) - t[minind]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.7270206907,"measured_runtime_v1":0.2688547273,"runtime_lift":6.4236203252,"key":["s647144203","s608787131"]} +{"user_id":"u104282757","problem_id":"p02850","language":"python","submission_id_v0":"s359310316","submission_id_v1":"s846229505","cpu_time_v0":784,"cpu_time_v1":653,"memory_v0":59328,"memory_v1":59280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import deque\n\n\n\nn = int(eval(input()))\n\n\n\ng = {i: dict() for i in range(n)}\n\n\n\na_list = [0] * (n - 1)\n\nb_list = [0] * (n - 1)\n\nfor i in range(n - 1):\n\n a, b = list(map(int, input().split()))\n\n a_list[i] = a - 1\n\n b_list[i] = b - 1\n\n g[a - 1][b - 1] = -1\n\n g[b - 1][a - 1] = -1\n\n\n\nk = max([len(g[a]) for a in range(n)])\n\n\n\nused_color = [-1] * n\n\nused_color[0] = k - 1\n\n# BFS\n\nqueue = deque([0])\n\nwhile len(queue) > 0:\n\n p = queue.popleft()\n\n c = used_color[p]\n\n for q in list(g[p].keys()):\n\n if used_color[q] != -1:\n\n continue\n\n c += 1\n\n c %= k\n\n # print(p, q, c)\n\n g[p][q] = c\n\n g[q][p] = c\n\n used_color[q] = c\n\n queue.append(q)\n\n\n\nprint(k)\n\nfor i in range(n - 1):\n\n print((g[a_list[i]][b_list[i]] + 1))\n\n\n# optimized version of the same code:\n","target":"from collections import deque\n\n\n\n\n\ndef solve(n, a_list, b_list):\n\n\n\n # create graph\n\n g = {i: dict() for i in range(n)}\n\n for i in range(n - 1):\n\n a, b = a_list[i] - 1, b_list[i] - 1\n\n g[a][b] = -1\n\n g[b][a] = -1\n\n\n\n k = max([len(g[a]) for a in range(n)])\n\n\n\n used_color = [-1] * n\n\n used_color[0] = k - 1\n\n # BFS\n\n queue = deque([0])\n\n while len(queue) > 0:\n\n p = queue.popleft()\n\n c = used_color[p]\n\n for q in list(g[p].keys()):\n\n if used_color[q] != -1:\n\n continue\n\n c += 1\n\n c %= k\n\n # print(p, q, c)\n\n g[p][q] = c\n\n g[q][p] = c\n\n used_color[q] = c\n\n queue.append(q)\n\n\n\n res_list = [0] * (n - 1)\n\n for i in range(n - 1):\n\n res_list[i] = g[a_list[i] - 1][b_list[i] - 1] + 1\n\n\n\n return k, res_list\n\n\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n a_list = [0] * (n - 1)\n\n b_list = [0] * (n - 1)\n\n for i in range(n - 1):\n\n a, b = list(map(int, input().split()))\n\n a_list[i] = a\n\n b_list[i] = b\n\n\n\n k, res_list = solve(n, a_list, b_list)\n\n print(k)\n\n for i in range(n - 1):\n\n print((res_list[i]))\n\n\n\n\n\ndef test():\n\n print((solve(3, [1, 2], [2, 3])))\n\n print((solve(8, [1, 2, 2, 2, 4, 5, 6], [2, 3, 4, 5, 7, 6, 8])))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n # test()\n\n main()\n","code_v0_loc":38,"code_v1_loc":62,"code_v0_num_chars":795,"code_v1_num_chars":1388,"code_v0_no_empty_lines":"from collections import deque\n\nn = int(eval(input()))\ng = {i: dict() for i in range(n)}\na_list = [0] * (n - 1)\nb_list = [0] * (n - 1)\nfor i in range(n - 1):\n a, b = list(map(int, input().split()))\n a_list[i] = a - 1\n b_list[i] = b - 1\n g[a - 1][b - 1] = -1\n g[b - 1][a - 1] = -1\nk = max([len(g[a]) for a in range(n)])\nused_color = [-1] * n\nused_color[0] = k - 1\n# BFS\nqueue = deque([0])\nwhile len(queue) > 0:\n p = queue.popleft()\n c = used_color[p]\n for q in list(g[p].keys()):\n if used_color[q] != -1:\n continue\n c += 1\n c %= k\n # print(p, q, c)\n g[p][q] = c\n g[q][p] = c\n used_color[q] = c\n queue.append(q)\nprint(k)\nfor i in range(n - 1):\n print((g[a_list[i]][b_list[i]] + 1))\n","code_v1_no_empty_lines":"from collections import deque\n\n\ndef solve(n, a_list, b_list):\n # create graph\n g = {i: dict() for i in range(n)}\n for i in range(n - 1):\n a, b = a_list[i] - 1, b_list[i] - 1\n g[a][b] = -1\n g[b][a] = -1\n k = max([len(g[a]) for a in range(n)])\n used_color = [-1] * n\n used_color[0] = k - 1\n # BFS\n queue = deque([0])\n while len(queue) > 0:\n p = queue.popleft()\n c = used_color[p]\n for q in list(g[p].keys()):\n if used_color[q] != -1:\n continue\n c += 1\n c %= k\n # print(p, q, c)\n g[p][q] = c\n g[q][p] = c\n used_color[q] = c\n queue.append(q)\n res_list = [0] * (n - 1)\n for i in range(n - 1):\n res_list[i] = g[a_list[i] - 1][b_list[i] - 1] + 1\n return k, res_list\n\n\ndef main():\n n = int(eval(input()))\n a_list = [0] * (n - 1)\n b_list = [0] * (n - 1)\n for i in range(n - 1):\n a, b = list(map(int, input().split()))\n a_list[i] = a\n b_list[i] = b\n k, res_list = solve(n, a_list, b_list)\n print(k)\n for i in range(n - 1):\n print((res_list[i]))\n\n\ndef test():\n print((solve(3, [1, 2], [2, 3])))\n print((solve(8, [1, 2, 2, 2, 4, 5, 6], [2, 3, 4, 5, 7, 6, 8])))\n\n\nif __name__ == \"__main__\":\n # test()\n main()\n","code_same":false,"relative_loc_diff_percent":38.7096774194,"diff":["-n = int(eval(input()))","-g = {i: dict() for i in range(n)}","-a_list = [0] * (n - 1)","-b_list = [0] * (n - 1)","-for i in range(n - 1):","- a, b = list(map(int, input().split()))","- a_list[i] = a - 1","- b_list[i] = b - 1","- g[a - 1][b - 1] = -1","- g[b - 1][a - 1] = -1","-k = max([len(g[a]) for a in range(n)])","-used_color = [-1] * n","-used_color[0] = k - 1","-# BFS","-queue = deque([0])","-while len(queue) > 0:","- p = queue.popleft()","- c = used_color[p]","- for q in list(g[p].keys()):","- if used_color[q] != -1:","- continue","- c += 1","- c %= k","- # print(p, q, c)","- g[p][q] = c","- g[q][p] = c","- used_color[q] = c","- queue.append(q)","-print(k)","-for i in range(n - 1):","- print((g[a_list[i]][b_list[i]] + 1))","+","+def solve(n, a_list, b_list):","+ # create graph","+ g = {i: dict() for i in range(n)}","+ for i in range(n - 1):","+ a, b = a_list[i] - 1, b_list[i] - 1","+ g[a][b] = -1","+ g[b][a] = -1","+ k = max([len(g[a]) for a in range(n)])","+ used_color = [-1] * n","+ used_color[0] = k - 1","+ # BFS","+ queue = deque([0])","+ while len(queue) > 0:","+ p = queue.popleft()","+ c = used_color[p]","+ for q in list(g[p].keys()):","+ if used_color[q] != -1:","+ continue","+ c += 1","+ c %= k","+ # print(p, q, c)","+ g[p][q] = c","+ g[q][p] = c","+ used_color[q] = c","+ queue.append(q)","+ res_list = [0] * (n - 1)","+ for i in range(n - 1):","+ res_list[i] = g[a_list[i] - 1][b_list[i] - 1] + 1","+ return k, res_list","+","+","+def main():","+ n = int(eval(input()))","+ a_list = [0] * (n - 1)","+ b_list = [0] * (n - 1)","+ for i in range(n - 1):","+ a, b = list(map(int, input().split()))","+ a_list[i] = a","+ b_list[i] = b","+ k, res_list = solve(n, a_list, b_list)","+ print(k)","+ for i in range(n - 1):","+ print((res_list[i]))","+","+","+def test():","+ print((solve(3, [1, 2], [2, 3])))","+ print((solve(8, [1, 2, 2, 2, 4, 5, 6], [2, 3, 4, 5, 7, 6, 8])))","+","+","+if __name__ == \"__main__\":","+ # test()","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2052914531,"measured_runtime_v1":0.0066894548,"runtime_lift":30.6888168229,"key":["s359310316","s846229505"]} +{"user_id":"u784022244","problem_id":"p03774","language":"python","submission_id_v0":"s225721289","submission_id_v1":"s121271513","cpu_time_v0":149,"cpu_time_v1":19,"memory_v0":12448,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.25,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN,M=list(map(int, input().split()))\n\nhuman=[]\n\nfor i in range(N):\n\n a,b=list(map(int, input().split()))\n\n human.append((a,b))\n\nC=[]\n\nfor i in range(M):\n\n c,d=list(map(int, input().split()))\n\n C.append((c,d))\n\n \n\nfor h in human:\n\n a,b=h\n\n now=0\n\n mini=np.inf\n\n for i,ch in enumerate(C):\n\n c,d=ch\n\n L=abs(a-c)+abs(b-d)\n\n if mini>L:\n\n mini=L\n\n now=i+1\n\n print(now)\n\n# optimized version of the same code:\n","target":"N,M=list(map(int, input().split()))\n\nS=[]\n\nfor i in range(N):\n\n a,b=list(map(int, input().split()))\n\n S.append((a,b))\n\n\n\nC=[]\n\nfor i in range(M):\n\n c,d=list(map(int, input().split()))\n\n C.append((c,d,i+1))\n\n#print(C)\n\nfor s in S:\n\n a,b=s\n\n now=0\n\n dis=10**9\n\n\n\n for t in C:\n\n c,d,n=t\n\n D=abs(c-a)+abs(d-b)\n\n \n\n if D L:\n mini = L\n now = i + 1\n print(now)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nS = []\nfor i in range(N):\n a, b = list(map(int, input().split()))\n S.append((a, b))\nC = []\nfor i in range(M):\n c, d = list(map(int, input().split()))\n C.append((c, d, i + 1))\n# print(C)\nfor s in S:\n a, b = s\n now = 0\n dis = 10**9\n for t in C:\n c, d, n = t\n D = abs(c - a) + abs(d - b)\n if D < dis:\n dis = D\n now = n\n print(now)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import numpy as np","-","-human = []","+S = []","- human.append((a, b))","+ S.append((a, b))","- C.append((c, d))","-for h in human:","- a, b = h","+ C.append((c, d, i + 1))","+# print(C)","+for s in S:","+ a, b = s","- mini = np.inf","- for i, ch in enumerate(C):","- c, d = ch","- L = abs(a - c) + abs(b - d)","- if mini > L:","- mini = L","- now = i + 1","+ dis = 10**9","+ for t in C:","+ c, d, n = t","+ D = abs(c - a) + abs(d - b)","+ if D < dis:","+ dis = D","+ now = n"],"diff_only_import_comment":false,"measured_runtime_v0":1.7596903191,"measured_runtime_v1":0.2910071514,"runtime_lift":6.0468971664,"key":["s225721289","s121271513"]} +{"user_id":"u850516963","problem_id":"p03455","language":"python","submission_id_v0":"s887829630","submission_id_v1":"s071542109","cpu_time_v0":67,"cpu_time_v1":30,"memory_v0":61732,"memory_v1":9060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b = list(map(int, input().split()))\n\nif a*b%2 == 1:\n\n print(\"Odd\")\n\nelse:\n\n print(\"Even\")\n\n# optimized version of the same code:\n","target":"a, b = list(map(int, input().split()))\n\nprint(('Odd'if a&b&1 else 'Even'))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":92,"code_v1_num_chars":66,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nif a * b % 2 == 1:\n print(\"Odd\")\nelse:\n print(\"Even\")\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nprint((\"Odd\" if a & b & 1 else \"Even\"))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-if a * b % 2 == 1:","- print(\"Odd\")","-else:","- print(\"Even\")","+print((\"Odd\" if a & b & 1 else \"Even\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1895228839,"measured_runtime_v1":0.0064490705,"runtime_lift":29.3876276628,"key":["s887829630","s071542109"]} +{"user_id":"u634079249","problem_id":"p02555","language":"python","submission_id_v0":"s319738471","submission_id_v1":"s179019070","cpu_time_v0":343,"cpu_time_v1":55,"memory_v0":9820,"memory_v1":9920,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.97,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys, os, math, bisect, itertools, collections, heapq, queue, copy, array\n\n\n\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n\n# from decimal import Decimal\n\n# from collections import defaultdict, deque\n\n\n\nsys.setrecursionlimit(10000000)\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\nlcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)\n\n\n\nMOD = 10 ** 9 + 7\n\nINF = float('inf')\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n S = ii()\n\n dp = [0] * (S + 1)\n\n\n\n dp[0] = 1\n\n # 0 <= i <= S\u306e\u7bc4\u56f2\u3092\u63a2\u7d22\n\n for i in range(1, S + 1):\n\n # 0 <= j <= i - 3\u306e\u7bc4\u56f2\u3067\u3001\n\n # \u9593\u4ed5\u5207\u308a\u3092\u7f6e\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u500b\u6570\u306e\u5408\u8a08\u3092\u96c6\u8a08\n\n for j in range(0, i - 3 + 1):\n\n dp[i] += dp[j]\n\n dp[i] %= MOD\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array\n\n\n\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n\n# from decimal import Decimal\n\n# from collections import defaultdict, deque\n\n\n\nsys.setrecursionlimit(10000000)\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\nlcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)\n\n\n\nMOD = 10 ** 9 + 7\n\nINF = float('inf')\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n S = ii()\n\n dp = [0] * (S + 1)\n\n\n\n dp[0] = 1\n\n # 0 <= i <= S\u306e\u7bc4\u56f2\u3092\u63a2\u7d22\n\n for i in range(1, S + 1):\n\n # 0 <= j <= i - 3\u306e\u7bc4\u56f2\u3067\u3001\n\n # \u9593\u4ed5\u5207\u308a\u3092\u7f6e\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u500b\u6570\u306e\u5408\u8a08\u3092\u96c6\u8a08\n\n if i > 2:\n\n dp[i] = sum(dp[0:i - 2])\n\n dp[i] %= MOD\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":43,"code_v1_loc":43,"code_v0_num_chars":1269,"code_v1_num_chars":1259,"code_v0_no_empty_lines":"import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array\n\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n# from decimal import Decimal\n# from collections import defaultdict, deque\nsys.setrecursionlimit(10000000)\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\nlcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)\nMOD = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n S = ii()\n dp = [0] * (S + 1)\n dp[0] = 1\n # 0 <= i <= S\u306e\u7bc4\u56f2\u3092\u63a2\u7d22\n for i in range(1, S + 1):\n # 0 <= j <= i - 3\u306e\u7bc4\u56f2\u3067\u3001\n # \u9593\u4ed5\u5207\u308a\u3092\u7f6e\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u500b\u6570\u306e\u5408\u8a08\u3092\u96c6\u8a08\n for j in range(0, i - 3 + 1):\n dp[i] += dp[j]\n dp[i] %= MOD\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array\n\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n# from decimal import Decimal\n# from collections import defaultdict, deque\nsys.setrecursionlimit(10000000)\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\nlcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)\nMOD = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n S = ii()\n dp = [0] * (S + 1)\n dp[0] = 1\n # 0 <= i <= S\u306e\u7bc4\u56f2\u3092\u63a2\u7d22\n for i in range(1, S + 1):\n # 0 <= j <= i - 3\u306e\u7bc4\u56f2\u3067\u3001\n # \u9593\u4ed5\u5207\u308a\u3092\u7f6e\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u500b\u6570\u306e\u5408\u8a08\u3092\u96c6\u8a08\n if i > 2:\n dp[i] = sum(dp[0 : i - 2])\n dp[i] %= MOD\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for j in range(0, i - 3 + 1):","- dp[i] += dp[j]","+ if i > 2:","+ dp[i] = sum(dp[0 : i - 2])"],"diff_only_import_comment":false,"measured_runtime_v0":0.530304636,"measured_runtime_v1":0.2333806806,"runtime_lift":2.2722730721,"key":["s319738471","s179019070"]} +{"user_id":"u503228842","problem_id":"p02555","language":"python","submission_id_v0":"s264986040","submission_id_v1":"s936814116","cpu_time_v0":455,"cpu_time_v1":29,"memory_v0":9180,"memory_v1":9188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.63,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n for j in range(i - 2):\n\n ans[i] += ans[j]\n\n ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n ans[i] = ans[i - 1] + ans[i - 3]\n\n ans[i] %= m\n\n # for j in range(i - 2):\n\n # ans[i] += ans[j]\n\n # ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n","code_v0_loc":14,"code_v1_loc":16,"code_v0_num_chars":263,"code_v1_num_chars":324,"code_v0_no_empty_lines":"n = int(eval(input()))\nm = 10**9 + 7\n# ans = [0] * (n + 1)\nans = [0] * 2200\nans[0] = 1\n# ans[3] = 1\n# ans[4] = 1\n# ans[5] = 1\nfor i in range(3, n + 1):\n for j in range(i - 2):\n ans[i] += ans[j]\n ans[i] %= m\nprint((ans[n]))\n# print(ans[:10])\n","code_v1_no_empty_lines":"n = int(eval(input()))\nm = 10**9 + 7\n# ans = [0] * (n + 1)\nans = [0] * 2200\nans[0] = 1\n# ans[3] = 1\n# ans[4] = 1\n# ans[5] = 1\nfor i in range(3, n + 1):\n ans[i] = ans[i - 1] + ans[i - 3]\n ans[i] %= m\n # for j in range(i - 2):\n # ans[i] += ans[j]\n # ans[i] %= m\nprint((ans[n]))\n# print(ans[:10])\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["- for j in range(i - 2):","- ans[i] += ans[j]","- ans[i] %= m","+ ans[i] = ans[i - 1] + ans[i - 3]","+ ans[i] %= m","+ # for j in range(i - 2):","+ # ans[i] += ans[j]","+ # ans[i] %= m"],"diff_only_import_comment":false,"measured_runtime_v0":0.6218082716,"measured_runtime_v1":0.188438025,"runtime_lift":3.2998025299,"key":["s264986040","s936814116"]} +{"user_id":"u678167152","problem_id":"p03608","language":"python","submission_id_v0":"s000797516","submission_id_v1":"s627408472","cpu_time_v0":303,"cpu_time_v1":214,"memory_v0":70760,"memory_v1":74992,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.37,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, M, R = list(map(int, input().split()))\n\nr = list(map(int, input().split()))\n\nd = [[float('inf')]*N for _ in range(N)]\n\nfor i in range(M): #\u3072\u3068\u307e\u305a\u679d\u304c\u3042\u308b\u30da\u30a2\u306f\u679d\u306e\u9577\u3055\u3092\u30bb\u30c3\u30c8\n\n a,b,t = list(map(int, input().split()))\n\n d[a-1][b-1] = t\n\n d[b-1][a-1] = t\n\n\n\nfor i in range(N):\n\n d[i][i] = 0 #\u81ea\u8eab\u3078\u306e\u6700\u77ed\u7d4c\u8def\u306f0\n\n#\u4e09\u91cd\u30eb\u30fc\u30d7\n\nfor k in range(N):\n\n for i in range(N):\n\n for j in range(N):\n\n d[i][j] = min(d[i][j], d[i][k]+d[k][j])\n\n\n\nfrom itertools import groupby, accumulate, product, permutations, combinations\n\n\n\nans = float('inf')\n\nfor p in permutations(r,R):\n\n cnt = 0\n\n for i in range(1,R):\n\n cnt += d[p[i-1]-1][p[i]-1]\n\n ans = min(ans,cnt)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N, M, r = list(map(int, input().split()))\n\nR = list([int(x)-1 for x in input().split()])\n\nd = [[1<<30]*N for _ in range(N)]\n\nfor i in range(M): #\u3072\u3068\u307e\u305a\u679d\u304c\u3042\u308b\u30da\u30a2\u306f\u679d\u306e\u9577\u3055\u3092\u30bb\u30c3\u30c8\n\n a,b,t = list(map(int, input().split()))\n\n d[a-1][b-1] = t\n\n d[b-1][a-1] = t\n\n\n\nfor i in range(N):\n\n d[i][i] = 0 #\u81ea\u8eab\u3078\u306e\u6700\u77ed\u7d4c\u8def\u306f0\n\n#\u4e09\u91cd\u30eb\u30fc\u30d7\n\nfor k in range(N):\n\n for i in range(N):\n\n for j in range(N):\n\n d[i][j] = min(d[i][j], d[i][k]+d[k][j])\n\nfrom itertools import groupby, accumulate, product, permutations, combinations\n\nans = 1<<30\n\nfor per in permutations(R,r):\n\n cnt = 0\n\n for i in range(r-1):\n\n cnt += d[per[i]][per[i+1]]\n\n ans = min(ans, cnt)\n\nprint(ans)","code_v0_loc":25,"code_v1_loc":23,"code_v0_num_chars":634,"code_v1_num_chars":633,"code_v0_no_empty_lines":"N, M, R = list(map(int, input().split()))\nr = list(map(int, input().split()))\nd = [[float(\"inf\")] * N for _ in range(N)]\nfor i in range(M): # \u3072\u3068\u307e\u305a\u679d\u304c\u3042\u308b\u30da\u30a2\u306f\u679d\u306e\u9577\u3055\u3092\u30bb\u30c3\u30c8\n a, b, t = list(map(int, input().split()))\n d[a - 1][b - 1] = t\n d[b - 1][a - 1] = t\nfor i in range(N):\n d[i][i] = 0 # \u81ea\u8eab\u3078\u306e\u6700\u77ed\u7d4c\u8def\u306f0\n# \u4e09\u91cd\u30eb\u30fc\u30d7\nfor k in range(N):\n for i in range(N):\n for j in range(N):\n d[i][j] = min(d[i][j], d[i][k] + d[k][j])\nfrom itertools import groupby, accumulate, product, permutations, combinations\n\nans = float(\"inf\")\nfor p in permutations(r, R):\n cnt = 0\n for i in range(1, R):\n cnt += d[p[i - 1] - 1][p[i] - 1]\n ans = min(ans, cnt)\nprint(ans)\n","code_v1_no_empty_lines":"N, M, r = list(map(int, input().split()))\nR = list([int(x) - 1 for x in input().split()])\nd = [[1 << 30] * N for _ in range(N)]\nfor i in range(M): # \u3072\u3068\u307e\u305a\u679d\u304c\u3042\u308b\u30da\u30a2\u306f\u679d\u306e\u9577\u3055\u3092\u30bb\u30c3\u30c8\n a, b, t = list(map(int, input().split()))\n d[a - 1][b - 1] = t\n d[b - 1][a - 1] = t\nfor i in range(N):\n d[i][i] = 0 # \u81ea\u8eab\u3078\u306e\u6700\u77ed\u7d4c\u8def\u306f0\n# \u4e09\u91cd\u30eb\u30fc\u30d7\nfor k in range(N):\n for i in range(N):\n for j in range(N):\n d[i][j] = min(d[i][j], d[i][k] + d[k][j])\nfrom itertools import groupby, accumulate, product, permutations, combinations\n\nans = 1 << 30\nfor per in permutations(R, r):\n cnt = 0\n for i in range(r - 1):\n cnt += d[per[i]][per[i + 1]]\n ans = min(ans, cnt)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["-N, M, R = list(map(int, input().split()))","-r = list(map(int, input().split()))","-d = [[float(\"inf\")] * N for _ in range(N)]","+N, M, r = list(map(int, input().split()))","+R = list([int(x) - 1 for x in input().split()])","+d = [[1 << 30] * N for _ in range(N)]","-ans = float(\"inf\")","-for p in permutations(r, R):","+ans = 1 << 30","+for per in permutations(R, r):","- for i in range(1, R):","- cnt += d[p[i - 1] - 1][p[i] - 1]","+ for i in range(r - 1):","+ cnt += d[per[i]][per[i + 1]]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2899598975,"measured_runtime_v1":0.2122670105,"runtime_lift":1.3660148927,"key":["s000797516","s627408472"]} +{"user_id":"u046187684","problem_id":"p02982","language":"python","submission_id_v0":"s670004614","submission_id_v1":"s451570283","cpu_time_v0":341,"cpu_time_v1":18,"memory_v0":19892,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.72,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom scipy.spatial import distance\n\n\n\n\n\ndef solve(string):\n\n n, d, *x = list(map(int, string.split()))\n\n x = [tuple(c) for c in zip(*[iter(x)] * d)]\n\n dist = distance.cdist(x, x)\n\n return str(((dist == dist.astype(\"int32\")).sum() - n) \/\/ 2)\n\n\n\n\n\nif __name__ == '__main__':\n\n n, m = list(map(int, input().split()))\n\n print((solve('{} {}\\n'.format(n, m)+'\\n'.join([eval(input()) for _ in range(n)]))))\n\n\n# optimized version of the same code:\n","target":"import math\n\nN,D = list(map(int,input().split()))\n\nX = [list(map(float, input().split())) for i in range(N)]\n\ncounter = 0\n\nfor i, x0 in enumerate(X): \n\n for x1 in X[i+1:]:\n\n if math.sqrt(sum([(a-b)**2 for a, b in zip(x0,x1)])).is_integer():\n\n counter+=1\n\nprint(counter)\n","code_v0_loc":13,"code_v1_loc":9,"code_v0_num_chars":398,"code_v1_num_chars":285,"code_v0_no_empty_lines":"from scipy.spatial import distance\n\n\ndef solve(string):\n n, d, *x = list(map(int, string.split()))\n x = [tuple(c) for c in zip(*[iter(x)] * d)]\n dist = distance.cdist(x, x)\n return str(((dist == dist.astype(\"int32\")).sum() - n) \/\/ 2)\n\n\nif __name__ == \"__main__\":\n n, m = list(map(int, input().split()))\n print(\n (solve(\"{} {}\\n\".format(n, m) + \"\\n\".join([eval(input()) for _ in range(n)])))\n )\n","code_v1_no_empty_lines":"import math\n\nN, D = list(map(int, input().split()))\nX = [list(map(float, input().split())) for i in range(N)]\ncounter = 0\nfor i, x0 in enumerate(X):\n for x1 in X[i + 1 :]:\n if math.sqrt(sum([(a - b) ** 2 for a, b in zip(x0, x1)])).is_integer():\n counter += 1\nprint(counter)\n","code_same":false,"relative_loc_diff_percent":30.7692307692,"diff":["-from scipy.spatial import distance","+import math","-","-def solve(string):","- n, d, *x = list(map(int, string.split()))","- x = [tuple(c) for c in zip(*[iter(x)] * d)]","- dist = distance.cdist(x, x)","- return str(((dist == dist.astype(\"int32\")).sum() - n) \/\/ 2)","-","-","-if __name__ == \"__main__\":","- n, m = list(map(int, input().split()))","- print(","- (solve(\"{} {}\\n\".format(n, m) + \"\\n\".join([eval(input()) for _ in range(n)])))","- )","+N, D = list(map(int, input().split()))","+X = [list(map(float, input().split())) for i in range(N)]","+counter = 0","+for i, x0 in enumerate(X):","+ for x1 in X[i + 1 :]:","+ if math.sqrt(sum([(a - b) ** 2 for a, b in zip(x0, x1)])).is_integer():","+ counter += 1","+print(counter)"],"diff_only_import_comment":false,"measured_runtime_v0":2.3489351194,"measured_runtime_v1":0.198756752,"runtime_lift":11.8181399901,"key":["s670004614","s451570283"]} +{"user_id":"u219494936","problem_id":"p02615","language":"python","submission_id_v0":"s106486265","submission_id_v1":"s107268546","cpu_time_v0":790,"cpu_time_v1":143,"memory_v0":70788,"memory_v1":31436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.9,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nimport heapq\n\n\n\nN = int(eval(input()))\n\nA = np.sort([int(x) for x in input().split(\" \")])[::-1]\n\n\n\nq = [(-A[1], (0, 1)), (-A[1], (0, 1))]\n\nconfort = A[0]\n\nheapq.heapify(q)\n\n\n\ni = 2\n\nwhile N > i:\n\n m = heapq.heappop(q)\n\n # print(f\"{m[1][0]}\u3068{m[1][1]}\u306e\u9593\u306b\u5272\u308a\u8fbc\u3080. \u6c17\u6301\u3061\u826f\u3055 {-m[0]}\")\n\n confort -= m[0]\n\n heapq.heappush(q, (-A[i], (i, m[1][0])))\n\n heapq.heappush(q, (-A[i], (i, m[1][1])))\n\n i += 1\n\nprint(confort)\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = sorted([int(x) for x in input().split(\" \")])[::-1]\n\n\n\nN -= 2\n\nS = A[0]\n\n\n\ni = 1\n\nwhile 1:\n\n if N == 0:\n\n break \n\n if N == 1:\n\n S += A[i]\n\n break\n\n S += 2 * A[i]\n\n N -= 2\n\n i += 1\n\nprint(S)","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":436,"code_v1_num_chars":246,"code_v0_no_empty_lines":"import numpy as np\nimport heapq\n\nN = int(eval(input()))\nA = np.sort([int(x) for x in input().split(\" \")])[::-1]\nq = [(-A[1], (0, 1)), (-A[1], (0, 1))]\nconfort = A[0]\nheapq.heapify(q)\ni = 2\nwhile N > i:\n m = heapq.heappop(q)\n # print(f\"{m[1][0]}\u3068{m[1][1]}\u306e\u9593\u306b\u5272\u308a\u8fbc\u3080. \u6c17\u6301\u3061\u826f\u3055 {-m[0]}\")\n confort -= m[0]\n heapq.heappush(q, (-A[i], (i, m[1][0])))\n heapq.heappush(q, (-A[i], (i, m[1][1])))\n i += 1\nprint(confort)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = sorted([int(x) for x in input().split(\" \")])[::-1]\nN -= 2\nS = A[0]\ni = 1\nwhile 1:\n if N == 0:\n break\n if N == 1:\n S += A[i]\n break\n S += 2 * A[i]\n N -= 2\n i += 1\nprint(S)\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-import numpy as np","-import heapq","-","-A = np.sort([int(x) for x in input().split(\" \")])[::-1]","-q = [(-A[1], (0, 1)), (-A[1], (0, 1))]","-confort = A[0]","-heapq.heapify(q)","-i = 2","-while N > i:","- m = heapq.heappop(q)","- # print(f\"{m[1][0]}\u3068{m[1][1]}\u306e\u9593\u306b\u5272\u308a\u8fbc\u3080. \u6c17\u6301\u3061\u826f\u3055 {-m[0]}\")","- confort -= m[0]","- heapq.heappush(q, (-A[i], (i, m[1][0])))","- heapq.heappush(q, (-A[i], (i, m[1][1])))","+A = sorted([int(x) for x in input().split(\" \")])[::-1]","+N -= 2","+S = A[0]","+i = 1","+while 1:","+ if N == 0:","+ break","+ if N == 1:","+ S += A[i]","+ break","+ S += 2 * A[i]","+ N -= 2","-print(confort)","+print(S)"],"diff_only_import_comment":false,"measured_runtime_v0":1.866351433,"measured_runtime_v1":0.2910247389,"runtime_lift":6.4130336141,"key":["s106486265","s107268546"]} +{"user_id":"u754022296","problem_id":"p04021","language":"python","submission_id_v0":"s724849949","submission_id_v1":"s422278370","cpu_time_v0":219,"cpu_time_v1":182,"memory_v0":23552,"memory_v1":23552,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.89,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(eval(input()))\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n if (L[i][1]-i)%2:\n\n count += 1\n\nans = (count+1) \/\/ 2\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(eval(input()))\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n count += (L[i][1]-i)%2\n\nans = (count+1) \/\/ 2\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":260,"code_v1_num_chars":250,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nread = sys.stdin.read\nn = int(eval(input()))\nA = list(map(int, read().split()))\nL = sorted([(j, i) for i, j in enumerate(A)])\ncount = 0\nfor i in range(n):\n if (L[i][1] - i) % 2:\n count += 1\nans = (count + 1) \/\/ 2\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nread = sys.stdin.read\nn = int(eval(input()))\nA = list(map(int, read().split()))\nL = sorted([(j, i) for i, j in enumerate(A)])\ncount = 0\nfor i in range(n):\n count += (L[i][1] - i) % 2\nans = (count + 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["- if (L[i][1] - i) % 2:","- count += 1","+ count += (L[i][1] - i) % 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.2933020202,"measured_runtime_v1":0.2201511685,"runtime_lift":1.3322755547,"key":["s724849949","s422278370"]} +{"user_id":"u072053884","problem_id":"p02378","language":"python","submission_id_v0":"s432486243","submission_id_v1":"s242092393","cpu_time_v0":350,"cpu_time_v1":120,"memory_v0":8348,"memory_v1":8420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if unvisited[v] and (r_capacity > 0):\n\n parent[v].append(u)\n\n queue.append(v)\n\n unvisited[v] = False\n\n return unvisited[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while not bfs(source, sink, parent):\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))\n\n# optimized version of the same code:\n","target":"# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n level = [v_num] * v_num\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n level[start] = 0\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n next_level = level[u] + 1\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if (level[v] >= next_level) and (r_capacity > 0):\n\n level[v] = next_level\n\n parent[v].append(u)\n\n if unvisited[v]:\n\n queue.append(v)\n\n unvisited[v] = False\n\n return level[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while bfs(source, sink, parent) != v_num:\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))","code_v0_loc":75,"code_v1_loc":80,"code_v0_num_chars":1953,"code_v1_num_chars":2133,"code_v0_no_empty_lines":"# Acceptance of input\nimport sys\n\nfile_input = sys.stdin\nX, Y, E = list(map(int, file_input.readline().split()))\nv_num = X + Y + 2\nadj_mat = [[0] * (v_num) for i in range(v_num)]\nfor line in file_input:\n x, y = list(map(int, line.split()))\n adj_mat[x][X + y] = 1\ns = X + Y\nt = s + 1\nfor i in range(X):\n adj_mat[s][i] = 1\nfor i in range(X, s):\n adj_mat[i][t] = 1\n# Dinic's algorithm\nimport collections\n\n# BFS for residual capacity network to construct level graph\ndef bfs(start, goal, parent):\n unvisited = [True] * v_num\n queue = collections.deque()\n queue.append(start)\n unvisited[start] = False\n while queue:\n u = queue.popleft()\n for v, r_capacity in enumerate(adj_mat[u]):\n if unvisited[v] and (r_capacity > 0):\n parent[v].append(u)\n queue.append(v)\n unvisited[v] = False\n return unvisited[goal]\n\n\n# DFS for level graph and construct blocking flow\ndef dfs(goal, path, parent, blocking_flow):\n v = path[-1]\n if v == goal:\n aug_path_flow = 10000\n for x, y in zip(path[1:], path[:-1]):\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n for x, y in zip(path[1:], path[:-1]):\n adj_mat[x][y] -= aug_path_flow\n adj_mat[y][x] += aug_path_flow\n blocking_flow[0] += aug_path_flow\n else:\n for u in parent[v]:\n path.append(u)\n dfs(goal, path, parent, blocking_flow)\n path.pop()\n\n\ndef dinic(source, sink):\n max_flow = 0\n parent = [[] for i in range(v_num)]\n while not bfs(source, sink, parent):\n blocking_flow = [0]\n path = [sink]\n # search in reverse direction from sink\n dfs(source, path, parent, blocking_flow)\n max_flow += blocking_flow[0]\n parent = [[] for i in range(v_num)]\n return max_flow\n\n\n# output\nprint((dinic(s, t)))\n","code_v1_no_empty_lines":"# Acceptance of input\nimport sys\n\nfile_input = sys.stdin\nX, Y, E = list(map(int, file_input.readline().split()))\nv_num = X + Y + 2\nadj_mat = [[0] * (v_num) for i in range(v_num)]\nfor line in file_input:\n x, y = list(map(int, line.split()))\n adj_mat[x][X + y] = 1\ns = X + Y\nt = s + 1\nfor i in range(X):\n adj_mat[s][i] = 1\nfor i in range(X, s):\n adj_mat[i][t] = 1\n# Dinic's algorithm\nimport collections\n\n# BFS for residual capacity network to construct level graph\ndef bfs(start, goal, parent):\n level = [v_num] * v_num\n unvisited = [True] * v_num\n queue = collections.deque()\n queue.append(start)\n level[start] = 0\n unvisited[start] = False\n while queue:\n u = queue.popleft()\n next_level = level[u] + 1\n for v, r_capacity in enumerate(adj_mat[u]):\n if (level[v] >= next_level) and (r_capacity > 0):\n level[v] = next_level\n parent[v].append(u)\n if unvisited[v]:\n queue.append(v)\n unvisited[v] = False\n return level[goal]\n\n\n# DFS for level graph and construct blocking flow\ndef dfs(goal, path, parent, blocking_flow):\n v = path[-1]\n if v == goal:\n aug_path_flow = 10000\n for x, y in zip(path[1:], path[:-1]):\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n for x, y in zip(path[1:], path[:-1]):\n adj_mat[x][y] -= aug_path_flow\n adj_mat[y][x] += aug_path_flow\n blocking_flow[0] += aug_path_flow\n else:\n for u in parent[v]:\n path.append(u)\n dfs(goal, path, parent, blocking_flow)\n path.pop()\n\n\ndef dinic(source, sink):\n max_flow = 0\n parent = [[] for i in range(v_num)]\n while bfs(source, sink, parent) != v_num:\n blocking_flow = [0]\n path = [sink]\n # search in reverse direction from sink\n dfs(source, path, parent, blocking_flow)\n max_flow += blocking_flow[0]\n parent = [[] for i in range(v_num)]\n return max_flow\n\n\n# output\nprint((dinic(s, t)))\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["+ level = [v_num] * v_num","+ level[start] = 0","+ next_level = level[u] + 1","- if unvisited[v] and (r_capacity > 0):","+ if (level[v] >= next_level) and (r_capacity > 0):","+ level[v] = next_level","- queue.append(v)","- unvisited[v] = False","- return unvisited[goal]","+ if unvisited[v]:","+ queue.append(v)","+ unvisited[v] = False","+ return level[goal]","- while not bfs(source, sink, parent):","+ while bfs(source, sink, parent) != v_num:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2959556043,"measured_runtime_v1":0.2352844019,"runtime_lift":1.2578632579,"key":["s432486243","s242092393"]} +{"user_id":"u285891772","problem_id":"p02837","language":"python","submission_id_v0":"s234390283","submission_id_v1":"s698943579","cpu_time_v0":281,"cpu_time_v1":125,"memory_v0":5204,"memory_v1":5964,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\nfrom decimal import Decimal\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\nfrom decimal import *\n\n\n\nN = INT()\n\nxy = []\n\n\n\nfor i in range(N):\n\n\tA = INT()\n\n\txy.append([LIST() for _ in range(A)])\n\n\n\nans = 0\n\nfor i in range(1< mx:\n\n mx = a[i]\n\n continue\n\n else:\n\n mx += 1\n\n cost += mx-a[i] \n\n continue\n\n mx = max(mx, a[i])\n\n ans = min(cost, ans)\n\n print(ans)\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"from itertools import combinations \n\nINF = int(1e9)*15\n\ndef main():\n\n n, k = list(map(int, input().split())) \n\n a = [int(i) for i in input().split()]\n\n c = [int(i) for i in range(1, n)]\n\n ans = INF\n\n for comb in combinations(c, k-1):\n\n s = set(comb)\n\n mx = a[0]\n\n cost = 0\n\n for i in range(n):\n\n if i in s:\n\n if a[i] > mx:\n\n mx = a[i]\n\n continue\n\n else:\n\n mx += 1\n\n cost += mx-a[i] \n\n continue\n\n mx = max(mx, a[i])\n\n ans = min(cost, ans)\n\n print(ans)\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":26,"code_v1_loc":25,"code_v0_num_chars":717,"code_v1_num_chars":685,"code_v0_no_empty_lines":"import numpy as np\nfrom itertools import combinations\n\nINF = int(1e9) * 15\n\n\ndef main():\n n, k = list(map(int, input().split()))\n a = np.array(input().split(), np.int32)\n c = np.array([int(i) for i in range(1, n)])\n ans = INF\n for comb in combinations(c, k - 1):\n s = set(comb)\n mx = a[0]\n cost = 0\n for i in range(n):\n if i in s:\n if a[i] > mx:\n mx = a[i]\n continue\n else:\n mx += 1\n cost += mx - a[i]\n continue\n mx = max(mx, a[i])\n ans = min(cost, ans)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from itertools import combinations\n\nINF = int(1e9) * 15\n\n\ndef main():\n n, k = list(map(int, input().split()))\n a = [int(i) for i in input().split()]\n c = [int(i) for i in range(1, n)]\n ans = INF\n for comb in combinations(c, k - 1):\n s = set(comb)\n mx = a[0]\n cost = 0\n for i in range(n):\n if i in s:\n if a[i] > mx:\n mx = a[i]\n continue\n else:\n mx += 1\n cost += mx - a[i]\n continue\n mx = max(mx, a[i])\n ans = min(cost, ans)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.8461538462,"diff":["-import numpy as np","- a = np.array(input().split(), np.int32)","- c = np.array([int(i) for i in range(1, n)])","+ a = [int(i) for i in input().split()]","+ c = [int(i) for i in range(1, n)]"],"diff_only_import_comment":false,"measured_runtime_v0":1.8447637084,"measured_runtime_v1":0.2996491623,"runtime_lift":6.1564120326,"key":["s912626788","s563152491"]} +{"user_id":"u600402037","problem_id":"p02772","language":"python","submission_id_v0":"s645978955","submission_id_v1":"s362972720","cpu_time_v0":1475,"cpu_time_v1":17,"memory_v0":21396,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":98.85,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN = ir()\n\nA = np.array(lr())\n\nA = A[A%2==0].tolist()\n\nbool = True\n\nfor a in A:\n\n if a%3 != 0 and a%5 != 0:\n\n bool = False\n\n\n\nprint(('APPROVED' if bool else 'DENIED'))\n\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nimport sys\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN = ir()\n\nA = lr()\n\nbl = all(x % 3 == 0 or x % 5 == 0 for x in A if x % 2 == 0)\n\nprint(('APPROVED' if bl else 'DENIED'))\n","code_v0_loc":16,"code_v1_loc":11,"code_v0_num_chars":322,"code_v1_num_chars":263,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN = ir()\nA = np.array(lr())\nA = A[A % 2 == 0].tolist()\nbool = True\nfor a in A:\n if a % 3 != 0 and a % 5 != 0:\n bool = False\nprint((\"APPROVED\" if bool else \"DENIED\"))\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN = ir()\nA = lr()\nbl = all(x % 3 == 0 or x % 5 == 0 for x in A if x % 2 == 0)\nprint((\"APPROVED\" if bl else \"DENIED\"))\n","code_same":false,"relative_loc_diff_percent":31.25,"diff":["+# coding: utf-8","-import numpy as np","-A = np.array(lr())","-A = A[A % 2 == 0].tolist()","-bool = True","-for a in A:","- if a % 3 != 0 and a % 5 != 0:","- bool = False","-print((\"APPROVED\" if bool else \"DENIED\"))","+A = lr()","+bl = all(x % 3 == 0 or x % 5 == 0 for x in A if x % 2 == 0)","+print((\"APPROVED\" if bl else \"DENIED\"))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4299331548,"measured_runtime_v1":0.2156274381,"runtime_lift":6.6314990663,"key":["s645978955","s362972720"]} +{"user_id":"u057109575","problem_id":"p02851","language":"python","submission_id_v0":"s203769987","submission_id_v1":"s522861811","cpu_time_v0":293,"cpu_time_v1":166,"memory_v0":103224,"memory_v1":144972,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import defaultdict\n\n\n\nN, K, *A = list(map(int, open(0).read().split()))\n\n\n\nS = [0] * (N + 1)\n\nfor i in range(N):\n\n S[i + 1] = S[i] + A[i]\n\n\n\nd = defaultdict(int)\n\nans = 0\n\nfor j in range(N + 1):\n\n v = (S[j] - j) % K\n\n ans += d[v]\n\n d[v] += 1\n\n if j >= K - 1:\n\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\n\n \n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\n\n\nN, K, *A = list(map(int, open(0).read().split()))\n\n\n\nx = [0] * (N + 1)\n\nfor i in range(N):\n\n x[i + 1] = x[i] + A[i]\n\n \n\ny = [(x[i] - i) % K for i in range(N + 1)]\n\n\n\nctr = defaultdict(int)\n\nans = 0\n\nfor j in range(N + 1):\n\n ans += ctr[y[j]]\n\n ctr[y[j]] += 1\n\n if j - K + 1 >= 0:\n\n ctr[y[j - K + 1]] -= 1\n\nprint(ans)\n","code_v0_loc":18,"code_v1_loc":18,"code_v0_num_chars":357,"code_v1_num_chars":371,"code_v0_no_empty_lines":"from collections import defaultdict\n\nN, K, *A = list(map(int, open(0).read().split()))\nS = [0] * (N + 1)\nfor i in range(N):\n S[i + 1] = S[i] + A[i]\nd = defaultdict(int)\nans = 0\nfor j in range(N + 1):\n v = (S[j] - j) % K\n ans += d[v]\n d[v] += 1\n if j >= K - 1:\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nN, K, *A = list(map(int, open(0).read().split()))\nx = [0] * (N + 1)\nfor i in range(N):\n x[i + 1] = x[i] + A[i]\ny = [(x[i] - i) % K for i in range(N + 1)]\nctr = defaultdict(int)\nans = 0\nfor j in range(N + 1):\n ans += ctr[y[j]]\n ctr[y[j]] += 1\n if j - K + 1 >= 0:\n ctr[y[j - K + 1]] -= 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S = [0] * (N + 1)","+x = [0] * (N + 1)","- S[i + 1] = S[i] + A[i]","-d = defaultdict(int)","+ x[i + 1] = x[i] + A[i]","+y = [(x[i] - i) % K for i in range(N + 1)]","+ctr = defaultdict(int)","- v = (S[j] - j) % K","- ans += d[v]","- d[v] += 1","- if j >= K - 1:","- d[(S[j - K + 1] - (j - K + 1)) % K] -= 1","+ ans += ctr[y[j]]","+ ctr[y[j]] += 1","+ if j - K + 1 >= 0:","+ ctr[y[j - K + 1]] -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.2436300242,"measured_runtime_v1":0.1409657106,"runtime_lift":1.7282928102,"key":["s203769987","s522861811"]} +{"user_id":"u576432509","problem_id":"p02767","language":"python","submission_id_v0":"s320006452","submission_id_v1":"s025352649","cpu_time_v0":403,"cpu_time_v1":21,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\nfor p in range(x[0],x[len(x)-1]+1):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\n pmin=psum \n\n for j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) \n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\npsum=0\n\nfor i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\npmin=psum \n\nfor j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) \n","code_v0_loc":19,"code_v1_loc":18,"code_v0_num_chars":421,"code_v1_num_chars":353,"code_v0_no_empty_lines":"n = int(eval(input()))\nx = list(map(int, input().split()))\nx.sort()\nfor p in range(x[0], x[len(x) - 1] + 1):\n psum = 0\n for i in range(len(x)):\n psum = psum + (x[0] - x[i]) ** 2\n # print(psum)\n pmin = psum\n for j in range(x[0] + 1, x[len(x) - 1]):\n psum = 0\n for i in range(len(x)):\n psum = psum + (j - x[i]) ** 2\n # print(psum)\n if pmin > psum:\n pmin = psum\nprint(pmin)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nx = list(map(int, input().split()))\nx.sort()\npsum = 0\nfor i in range(len(x)):\n psum = psum + (x[0] - x[i]) ** 2\n# print(psum)\npmin = psum\nfor j in range(x[0] + 1, x[len(x) - 1]):\n psum = 0\n for i in range(len(x)):\n psum = psum + (j - x[i]) ** 2\n # print(psum)\n if pmin > psum:\n pmin = psum\nprint(pmin)\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-for p in range(x[0], x[len(x) - 1] + 1):","+psum = 0","+for i in range(len(x)):","+ psum = psum + (x[0] - x[i]) ** 2","+# print(psum)","+pmin = psum","+for j in range(x[0] + 1, x[len(x) - 1]):","- psum = psum + (x[0] - x[i]) ** 2","- # print(psum)","- pmin = psum","- for j in range(x[0] + 1, x[len(x) - 1]):","- psum = 0","- for i in range(len(x)):","- psum = psum + (j - x[i]) ** 2","- # print(psum)","- if pmin > psum:","- pmin = psum","+ psum = psum + (j - x[i]) ** 2","+ # print(psum)","+ if pmin > psum:","+ pmin = psum"],"diff_only_import_comment":false,"measured_runtime_v0":0.298344056,"measured_runtime_v1":0.1876089347,"runtime_lift":1.59024439,"key":["s320006452","s025352649"]} +{"user_id":"u797106134","problem_id":"p02880","language":"python","submission_id_v0":"s138475257","submission_id_v1":"s540944662","cpu_time_v0":150,"cpu_time_v1":29,"memory_v0":12484,"memory_v1":9040,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\n# N>81\u306e\u3068\u304d\u306fn*n\u3067\u8868\u305b\u306a\u3044\u306e\u3067\u4e0d\u6575\n\nif N>81:\n\n print('No')\n\nelse:\n\n import numpy as np\n\n n=np.array([1,2,3,4,5,6,7,8,9])\n\n amari=N%n\n\n shou=N\/\/n\n\n if np.any((amari==0)*(shou<=9)):\n\n print('Yes')\n\n else:\n\n print('No')\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nfor i in range(1,10):\n\n if not N%i == 0:\n\n continue\n\n rest = N\/i\n\n if rest<10:\n\n print('Yes')\n\n exit()\n\n\n\nprint('No')","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":258,"code_v1_num_chars":165,"code_v0_no_empty_lines":"N = int(eval(input()))\n# N>81\u306e\u3068\u304d\u306fn*n\u3067\u8868\u305b\u306a\u3044\u306e\u3067\u4e0d\u6575\nif N > 81:\n print(\"No\")\nelse:\n import numpy as np\n\n n = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])\n amari = N % n\n shou = N \/\/ n\n if np.any((amari == 0) * (shou <= 9)):\n print(\"Yes\")\n else:\n print(\"No\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nfor i in range(1, 10):\n if not N % i == 0:\n continue\n rest = N \/ i\n if rest < 10:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-# N>81\u306e\u3068\u304d\u306fn*n\u3067\u8868\u305b\u306a\u3044\u306e\u3067\u4e0d\u6575","-if N > 81:","- print(\"No\")","-else:","- import numpy as np","-","- n = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])","- amari = N % n","- shou = N \/\/ n","- if np.any((amari == 0) * (shou <= 9)):","+for i in range(1, 10):","+ if not N % i == 0:","+ continue","+ rest = N \/ i","+ if rest < 10:","- else:","- print(\"No\")","+ exit()","+print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":1.2369615827,"measured_runtime_v1":0.1891755185,"runtime_lift":6.5386979897,"key":["s138475257","s540944662"]} +{"user_id":"u542605091","problem_id":"p02880","language":"python","submission_id_v0":"s300843143","submission_id_v1":"s824414586","cpu_time_v0":148,"cpu_time_v1":17,"memory_v0":12496,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.51,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nimport math\n\n\n\ndef bigger_devisor(n):\n\n s = np.sqrt(n)\n\n i = math.ceil(s)\n\n while(n % i != 0):\n\n i += 1\n\n return i\n\n\n\nn = int(eval(input()))\n\nif bigger_devisor(n) > 9:\n\n print('No')\n\nelse:\n\n print('Yes')\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nans = 0\n\nfor i in range(1, 10):\n\n if n % i == 0:\n\n if n \/ i < 10:\n\n ans = 1\n\nif ans == 0:\n\n print('No')\n\nelse:\n\n print('Yes')","code_v0_loc":15,"code_v1_loc":10,"code_v0_num_chars":226,"code_v1_num_chars":154,"code_v0_no_empty_lines":"import numpy as np\nimport math\n\n\ndef bigger_devisor(n):\n s = np.sqrt(n)\n i = math.ceil(s)\n while n % i != 0:\n i += 1\n return i\n\n\nn = int(eval(input()))\nif bigger_devisor(n) > 9:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = 0\nfor i in range(1, 10):\n if n % i == 0:\n if n \/ i < 10:\n ans = 1\nif ans == 0:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-import numpy as np","-import math","-","-","-def bigger_devisor(n):","- s = np.sqrt(n)","- i = math.ceil(s)","- while n % i != 0:","- i += 1","- return i","-","-","-if bigger_devisor(n) > 9:","+ans = 0","+for i in range(1, 10):","+ if n % i == 0:","+ if n \/ i < 10:","+ ans = 1","+if ans == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":1.5299629567,"measured_runtime_v1":0.1968936365,"runtime_lift":7.7705048475,"key":["s300843143","s824414586"]} +{"user_id":"u682672120","problem_id":"p03172","language":"python","submission_id_v0":"s523132470","submission_id_v1":"s175761939","cpu_time_v0":314,"cpu_time_v1":131,"memory_v0":146396,"memory_v1":67544,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.28,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\n\n\ndp = [[0] * (k + 1) for _ in range(n + 1)]\n\ndp[0][0] = 1\n\nfor i in range(n):\n\n dp[i + 1][0] = dp[i][0]\n\n for j in range(1, k+1):\n\n dp[i + 1][j] = (dp[i + 1][j - 1] + dp[i][j]) % mod\n\n for j in range(k, a[i], -1):\n\n dp[i + 1][j] = (dp[i + 1][j] - dp[i + 1][j - a[i] - 1]) % mod\n\nprint((dp[n][-1]))\n\n# optimized version of the same code:\n","target":"n, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\n\n\nf = [0] * (k + 1)\n\nf[0] = 1\n\nfor i in range(n):\n\n for j in range(1, k+1):\n\n f[j] = (f[j] + f[j - 1]) % mod # 1\/(1-x):\u7d2f\u7a4d\u548c\n\n for j in range(k, a[i], -1): # 1-x^(a[i]+1) a[i]+1\u6b21\u3057\u305f\u306e\u9805\u3092\u5f15\u304f\n\n f[j] = (f[j] - f[j - a[i] - 1]) % mod\n\nprint((f[-1]))","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":409,"code_v1_num_chars":347,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nmod = 10**9 + 7\ndp = [[0] * (k + 1) for _ in range(n + 1)]\ndp[0][0] = 1\nfor i in range(n):\n dp[i + 1][0] = dp[i][0]\n for j in range(1, k + 1):\n dp[i + 1][j] = (dp[i + 1][j - 1] + dp[i][j]) % mod\n for j in range(k, a[i], -1):\n dp[i + 1][j] = (dp[i + 1][j] - dp[i + 1][j - a[i] - 1]) % mod\nprint((dp[n][-1]))\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nmod = 10**9 + 7\nf = [0] * (k + 1)\nf[0] = 1\nfor i in range(n):\n for j in range(1, k + 1):\n f[j] = (f[j] + f[j - 1]) % mod # 1\/(1-x):\u7d2f\u7a4d\u548c\n for j in range(k, a[i], -1): # 1-x^(a[i]+1) a[i]+1\u6b21\u3057\u305f\u306e\u9805\u3092\u5f15\u304f\n f[j] = (f[j] - f[j - a[i] - 1]) % mod\nprint((f[-1]))\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-dp = [[0] * (k + 1) for _ in range(n + 1)]","-dp[0][0] = 1","+f = [0] * (k + 1)","+f[0] = 1","- dp[i + 1][0] = dp[i][0]","- dp[i + 1][j] = (dp[i + 1][j - 1] + dp[i][j]) % mod","- for j in range(k, a[i], -1):","- dp[i + 1][j] = (dp[i + 1][j] - dp[i + 1][j - a[i] - 1]) % mod","-print((dp[n][-1]))","+ f[j] = (f[j] + f[j - 1]) % mod # 1\/(1-x):\u7d2f\u7a4d\u548c","+ for j in range(k, a[i], -1): # 1-x^(a[i]+1) a[i]+1\u6b21\u3057\u305f\u306e\u9805\u3092\u5f15\u304f","+ f[j] = (f[j] - f[j - a[i] - 1]) % mod","+print((f[-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.165174345,"measured_runtime_v1":0.7766242659,"runtime_lift":1.5003063851,"key":["s523132470","s175761939"]} +{"user_id":"u438662618","problem_id":"p03086","language":"python","submission_id_v0":"s956521892","submission_id_v1":"s325345686","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport re\n\n\n\nS = eval(input())\n\nmax = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i + 1, len(S) + 1) :\n\n pattern = re.compile(r'[A|T|C|G]{%d}' % int(j - i))\n\n subStr = S[i:j]\n\n\n\n if pattern.match(subStr) and j - i > max :\n\n max = j - i\n\n\n\nprint(max)\n\n\n# optimized version of the same code:\n","target":"S = eval(input())\n\n\n\nans = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i, len(S)) :\n\n if all('ACGT'.count(c) == 1 for c in S[i : j + 1]) :\n\n ans = max(ans, j - i + 1)\n\n\n\n\n\nprint(ans)\n","code_v0_loc":14,"code_v1_loc":11,"code_v0_num_chars":282,"code_v1_num_chars":201,"code_v0_no_empty_lines":"import re\n\nS = eval(input())\nmax = 0\nfor i in range(len(S)):\n for j in range(i + 1, len(S) + 1):\n pattern = re.compile(r\"[A|T|C|G]{%d}\" % int(j - i))\n subStr = S[i:j]\n if pattern.match(subStr) and j - i > max:\n max = j - i\nprint(max)\n","code_v1_no_empty_lines":"S = eval(input())\nans = 0\nfor i in range(len(S)):\n for j in range(i, len(S)):\n if all(\"ACGT\".count(c) == 1 for c in S[i : j + 1]):\n ans = max(ans, j - i + 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-import re","-","-max = 0","+ans = 0","- for j in range(i + 1, len(S) + 1):","- pattern = re.compile(r\"[A|T|C|G]{%d}\" % int(j - i))","- subStr = S[i:j]","- if pattern.match(subStr) and j - i > max:","- max = j - i","-print(max)","+ for j in range(i, len(S)):","+ if all(\"ACGT\".count(c) == 1 for c in S[i : j + 1]):","+ ans = max(ans, j - i + 1)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3271781678,"measured_runtime_v1":0.2537176473,"runtime_lift":1.2895365036,"key":["s956521892","s325345686"]} +{"user_id":"u207097826","problem_id":"p02792","language":"python","submission_id_v0":"s736173164","submission_id_v1":"s628306332","cpu_time_v0":499,"cpu_time_v1":86,"memory_v0":3064,"memory_v1":68180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.77,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport itertools\n\nN = int(eval(input()))\n\nNketa = len(str(N))\n\n\n\nrange_count = [[0 for j in range(10)]for i in range(10)]\n\n\n\n\n\nfor p in range(1,N+1):\n\n mae = int(str(p)[0])\n\n ato = int(str(p)[-1])\n\n range_count[mae][ato] += 1\n\n\n\n \n\n\n\ncount = 0\n\nfor j in range(1,N+1):\n\n a_mae = int(str(j)[0])\n\n a_ato = int(str(j)[-1])\n\n \n\n b_mae = a_ato\n\n b_ato = a_mae\n\n \n\n if b_mae == 0:\n\n continue\n\n else:\n\n count += range_count[b_mae][b_ato]\n\nprint(count)\n\n \n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\n\n\nall_count = 0\n\noptions = [str(i) for i in range(10)]\n\n\n\nmaeato = [[0 for i in range(10)] for j in range(10)]\n\n\n\nfor i in range(n+1):\n\n checking = str(i)\n\n maeato[int(checking[0])][int(checking[-1])]+=1\n\nall_count = 0\n\nfor i in range(1,10):\n\n for j in range(1,10):\n\n for k in range(1,10):\n\n for p in range(1,10):\n\n if i == p and j == k:\n\n all_count+=maeato[i][j]*maeato[k][p]\n\nprint(all_count)","code_v0_loc":28,"code_v1_loc":18,"code_v0_num_chars":491,"code_v1_num_chars":473,"code_v0_no_empty_lines":"import itertools\n\nN = int(eval(input()))\nNketa = len(str(N))\nrange_count = [[0 for j in range(10)] for i in range(10)]\nfor p in range(1, N + 1):\n mae = int(str(p)[0])\n ato = int(str(p)[-1])\n range_count[mae][ato] += 1\ncount = 0\nfor j in range(1, N + 1):\n a_mae = int(str(j)[0])\n a_ato = int(str(j)[-1])\n b_mae = a_ato\n b_ato = a_mae\n if b_mae == 0:\n continue\n else:\n count += range_count[b_mae][b_ato]\nprint(count)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nall_count = 0\noptions = [str(i) for i in range(10)]\nmaeato = [[0 for i in range(10)] for j in range(10)]\nfor i in range(n + 1):\n checking = str(i)\n maeato[int(checking[0])][int(checking[-1])] += 1\nall_count = 0\nfor i in range(1, 10):\n for j in range(1, 10):\n for k in range(1, 10):\n for p in range(1, 10):\n if i == p and j == k:\n all_count += maeato[i][j] * maeato[k][p]\nprint(all_count)\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-import itertools","-","-N = int(eval(input()))","-Nketa = len(str(N))","-range_count = [[0 for j in range(10)] for i in range(10)]","-for p in range(1, N + 1):","- mae = int(str(p)[0])","- ato = int(str(p)[-1])","- range_count[mae][ato] += 1","-count = 0","-for j in range(1, N + 1):","- a_mae = int(str(j)[0])","- a_ato = int(str(j)[-1])","- b_mae = a_ato","- b_ato = a_mae","- if b_mae == 0:","- continue","- else:","- count += range_count[b_mae][b_ato]","-print(count)","+n = int(eval(input()))","+all_count = 0","+options = [str(i) for i in range(10)]","+maeato = [[0 for i in range(10)] for j in range(10)]","+for i in range(n + 1):","+ checking = str(i)","+ maeato[int(checking[0])][int(checking[-1])] += 1","+all_count = 0","+for i in range(1, 10):","+ for j in range(1, 10):","+ for k in range(1, 10):","+ for p in range(1, 10):","+ if i == p and j == k:","+ all_count += maeato[i][j] * maeato[k][p]","+print(all_count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5609512657,"measured_runtime_v1":0.4347667047,"runtime_lift":1.2902351069,"key":["s736173164","s628306332"]} +{"user_id":"u074220993","problem_id":"p03436","language":"python","submission_id_v0":"s307409656","submission_id_v1":"s939897094","cpu_time_v0":134,"cpu_time_v1":37,"memory_v0":26588,"memory_v1":9536,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.39,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nH, W = list(map(int, input().split()))\n\nimport numpy as np\n\nGrid = np.array([[0 if x == '.' else -1 for x in eval(input())] for _ in range(H)],dtype='int64')\n\n\n\ndef solveMase(Grid, start, goal): #bfs\u3067\u8ff7\u8def\u3092\u89e3\u304d\u3001\u30b9\u30bf\u30fc\u30c8-\u30b4\u30fc\u30eb\u9593\u306e\u6700\u4f4e\u5fc5\u8981\u767d\u30de\u30b9\u6570\u3092\u8fd4\u3059\n\n seen = {start}\n\n V = [start]\n\n while len(V) != 0: #bfs\n\n v = V.pop(0)\n\n if v == goal:\n\n return Grid[goal]\n\n #\u79fb\u52d5\u5148nv\u3092\u30ea\u30b9\u30c8\u306b\u307e\u3068\u3081\u308b\n\n y,x = v\n\n nV = []\n\n if x > 0: nV.append((y,x-1))\n\n if y > 0: nV.append((y-1,x))\n\n if x < W-1: nV.append((y,x+1))\n\n if y < H-1: nV.append((y+1,x))\n\n #bfs\n\n for nv in nV:\n\n if Grid[nv] == -1 or nv in seen:\n\n continue\n\n Grid[nv] = Grid[v] + 1\n\n V.append(nv)\n\n seen.add(nv)\n\n return 0\n\n\n\nwhite = len(Grid[Grid == 0])-1\n\nnes_white = solveMase(Grid, (0,0), (H-1,W-1))\n\nprint((white-nes_white if nes_white > 0 else -1))\n\n# optimized version of the same code:\n","target":"from collections import deque, Counter\n\n\n\ndef main():\n\n with open(0) as f:\n\n H, W = list(map(int, f.readline().split()))\n\n maze = [list(line) for line in f.readlines()]\n\n\n\n rank = [[None]*W for _ in range(H)]\n\n rank[0][0] = 0\n\n #bfs\n\n reserved = deque([(0,0)])\n\n while len(reserved) > 0:\n\n x, y = reserved.popleft()\n\n for u,v in [(s,t) for s,t in [(x-1,y), (x+1,y), (x,y-1), (x,y+1)] if 0<=s 0:\n nV.append((y, x - 1))\n if y > 0:\n nV.append((y - 1, x))\n if x < W - 1:\n nV.append((y, x + 1))\n if y < H - 1:\n nV.append((y + 1, x))\n # bfs\n for nv in nV:\n if Grid[nv] == -1 or nv in seen:\n continue\n Grid[nv] = Grid[v] + 1\n V.append(nv)\n seen.add(nv)\n return 0\n\n\nwhite = len(Grid[Grid == 0]) - 1\nnes_white = solveMase(Grid, (0, 0), (H - 1, W - 1))\nprint((white - nes_white if nes_white > 0 else -1))\n","code_v1_no_empty_lines":"from collections import deque, Counter\n\n\ndef main():\n with open(0) as f:\n H, W = list(map(int, f.readline().split()))\n maze = [list(line) for line in f.readlines()]\n rank = [[None] * W for _ in range(H)]\n rank[0][0] = 0\n # bfs\n reserved = deque([(0, 0)])\n while len(reserved) > 0:\n x, y = reserved.popleft()\n for u, v in [\n (s, t)\n for s, t in [(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1)]\n if 0 <= s < H and 0 <= t < W\n ]:\n if rank[u][v] is not None:\n continue\n if maze[u][v] == \".\":\n rank[u][v] = rank[x][y] + 1\n reserved.append((u, v))\n if rank[H - 1][W - 1] is None:\n print((-1))\n else:\n counter = Counter()\n for line in maze:\n counter.update(line)\n print((counter[\".\"] - rank[H - 1][W - 1] - 1))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":3.3333333333,"diff":["-H, W = list(map(int, input().split()))","-import numpy as np","-","-Grid = np.array(","- [[0 if x == \".\" else -1 for x in eval(input())] for _ in range(H)], dtype=\"int64\"","-)","+from collections import deque, Counter","-def solveMase(Grid, start, goal): # bfs\u3067\u8ff7\u8def\u3092\u89e3\u304d\u3001\u30b9\u30bf\u30fc\u30c8-\u30b4\u30fc\u30eb\u9593\u306e\u6700\u4f4e\u5fc5\u8981\u767d\u30de\u30b9\u6570\u3092\u8fd4\u3059","- seen = {start}","- V = [start]","- while len(V) != 0: # bfs","- v = V.pop(0)","- if v == goal:","- return Grid[goal]","- # \u79fb\u52d5\u5148nv\u3092\u30ea\u30b9\u30c8\u306b\u307e\u3068\u3081\u308b","- y, x = v","- nV = []","- if x > 0:","- nV.append((y, x - 1))","- if y > 0:","- nV.append((y - 1, x))","- if x < W - 1:","- nV.append((y, x + 1))","- if y < H - 1:","- nV.append((y + 1, x))","- # bfs","- for nv in nV:","- if Grid[nv] == -1 or nv in seen:","+def main():","+ with open(0) as f:","+ H, W = list(map(int, f.readline().split()))","+ maze = [list(line) for line in f.readlines()]","+ rank = [[None] * W for _ in range(H)]","+ rank[0][0] = 0","+ # bfs","+ reserved = deque([(0, 0)])","+ while len(reserved) > 0:","+ x, y = reserved.popleft()","+ for u, v in [","+ (s, t)","+ for s, t in [(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1)]","+ if 0 <= s < H and 0 <= t < W","+ ]:","+ if rank[u][v] is not None:","- Grid[nv] = Grid[v] + 1","- V.append(nv)","- seen.add(nv)","- return 0","+ if maze[u][v] == \".\":","+ rank[u][v] = rank[x][y] + 1","+ reserved.append((u, v))","+ if rank[H - 1][W - 1] is None:","+ print((-1))","+ else:","+ counter = Counter()","+ for line in maze:","+ counter.update(line)","+ print((counter[\".\"] - rank[H - 1][W - 1] - 1))","-white = len(Grid[Grid == 0]) - 1","-nes_white = solveMase(Grid, (0, 0), (H - 1, W - 1))","-print((white - nes_white if nes_white > 0 else -1))","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":2.0024964819,"measured_runtime_v1":0.2990579379,"runtime_lift":6.6960151473,"key":["s307409656","s939897094"]} +{"user_id":"u671446913","problem_id":"p02916","language":"python","submission_id_v0":"s992896151","submission_id_v1":"s662353537","cpu_time_v0":309,"cpu_time_v1":17,"memory_v0":21428,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nA = list(np.array(A) - 1)\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nsum_ = 0\n\ndiff = list(np.array(A[1:]) - np.array(A[:-1]))\n\ndiff.insert(0, -1)\n\nfor i in range(N):\n\n sum_ += B[A[i]]\n\n \n\n if diff[i] == 1:\n\n sum_ += C[A[i-1]]\n\n \n\nprint(sum_)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor i in range(len(A)):\n\n ans += B[A[i]-1]\n\n\n\n if i != 0:\n\n if A[i-1] + 1 == A[i]:\n\n ans += C[A[i-1]-1]\n\n\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":14,"code_v0_num_chars":358,"code_v1_num_chars":267,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nA = list(np.array(A) - 1)\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nsum_ = 0\ndiff = list(np.array(A[1:]) - np.array(A[:-1]))\ndiff.insert(0, -1)\nfor i in range(N):\n sum_ += B[A[i]]\n if diff[i] == 1:\n sum_ += C[A[i - 1]]\nprint(sum_)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nans = 0\nfor i in range(len(A)):\n ans += B[A[i] - 1]\n if i != 0:\n if A[i - 1] + 1 == A[i]:\n ans += C[A[i - 1] - 1]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["-import numpy as np","-","-A = list(np.array(A) - 1)","-sum_ = 0","-diff = list(np.array(A[1:]) - np.array(A[:-1]))","-diff.insert(0, -1)","-for i in range(N):","- sum_ += B[A[i]]","- if diff[i] == 1:","- sum_ += C[A[i - 1]]","-print(sum_)","+ans = 0","+for i in range(len(A)):","+ ans += B[A[i] - 1]","+ if i != 0:","+ if A[i - 1] + 1 == A[i]:","+ ans += C[A[i - 1] - 1]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.4381271441,"measured_runtime_v1":0.189556915,"runtime_lift":7.5867828071,"key":["s992896151","s662353537"]} +{"user_id":"u075012704","problem_id":"p02863","language":"python","submission_id_v0":"s881828060","submission_id_v1":"s407504441","cpu_time_v0":601,"cpu_time_v1":526,"memory_v0":119000,"memory_v1":119000,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, W = list(map(int, input().split()))\n\nitems = sorted([list(map(int, input().split())) for i in range(N)])\n\n\n\n# dp1[i][j] := \u5546\u54c10 ~ i \u304c\u5bfe\u8c61\n\ndp = [[0] * (W + 1) for i in range(N + 1)]\n\n\n\n# dp\u30c6\u30fc\u30d6\u30eb\u3092\u57cb\u3081\u308b\n\nfor i in range(N):\n\n wi, vi = items[i]\n\n for j in range(W + 1):\n\n if j + wi <= W:\n\n dp[i + 1][j + wi] = max(dp[i + 1][j + wi], dp[i][j] + vi)\n\n dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])\n\n\n\n\n\nans = 0\n\nfor i, (wi, vi) in enumerate(items):\n\n for j in range(W):\n\n ans = max(ans, dp[i][j] + vi)\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"N, W = list(map(int, input().split()))\n\nitems = sorted([list(map(int, input().split())) for i in range(N)])\n\n\n\n# dp1[i][j] := \u5546\u54c10 ~ i \u304c\u5bfe\u8c61\n\ndp = [[0] * (W + 1) for i in range(N + 1)]\n\n\n\n# dp\u30c6\u30fc\u30d6\u30eb\u3092\u57cb\u3081\u308b\n\nfor i in range(N):\n\n wi, vi = items[i]\n\n for j in range(W + 1):\n\n if j + wi <= W:\n\n dp[i + 1][j + wi] = max(dp[i + 1][j + wi], dp[i][j] + vi)\n\n dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])\n\n\n\n\n\nans = 0\n\nfor i, (wi, vi) in enumerate(items):\n\n ans = max(ans, dp[i][W - 1] + vi)\n\n\n\nprint(ans)\n","code_v0_loc":21,"code_v1_loc":20,"code_v0_num_chars":539,"code_v1_num_chars":515,"code_v0_no_empty_lines":"N, W = list(map(int, input().split()))\nitems = sorted([list(map(int, input().split())) for i in range(N)])\n# dp1[i][j] := \u5546\u54c10 ~ i \u304c\u5bfe\u8c61\ndp = [[0] * (W + 1) for i in range(N + 1)]\n# dp\u30c6\u30fc\u30d6\u30eb\u3092\u57cb\u3081\u308b\nfor i in range(N):\n wi, vi = items[i]\n for j in range(W + 1):\n if j + wi <= W:\n dp[i + 1][j + wi] = max(dp[i + 1][j + wi], dp[i][j] + vi)\n dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])\nans = 0\nfor i, (wi, vi) in enumerate(items):\n for j in range(W):\n ans = max(ans, dp[i][j] + vi)\nprint(ans)\n","code_v1_no_empty_lines":"N, W = list(map(int, input().split()))\nitems = sorted([list(map(int, input().split())) for i in range(N)])\n# dp1[i][j] := \u5546\u54c10 ~ i \u304c\u5bfe\u8c61\ndp = [[0] * (W + 1) for i in range(N + 1)]\n# dp\u30c6\u30fc\u30d6\u30eb\u3092\u57cb\u3081\u308b\nfor i in range(N):\n wi, vi = items[i]\n for j in range(W + 1):\n if j + wi <= W:\n dp[i + 1][j + wi] = max(dp[i + 1][j + wi], dp[i][j] + vi)\n dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])\nans = 0\nfor i, (wi, vi) in enumerate(items):\n ans = max(ans, dp[i][W - 1] + vi)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["- for j in range(W):","- ans = max(ans, dp[i][j] + vi)","+ ans = max(ans, dp[i][W - 1] + vi)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2747145832,"measured_runtime_v1":0.2133797197,"runtime_lift":1.2874446713,"key":["s881828060","s407504441"]} +{"user_id":"u971091945","problem_id":"p02690","language":"python","submission_id_v0":"s227979120","submission_id_v1":"s776767072","cpu_time_v0":40,"cpu_time_v1":33,"memory_v0":9172,"memory_v1":9132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\n\n\nfor a in range(-118, 120):\n\n for b in range(-119, 119):\n\n if a**5-b**5 == x:\n\n print((a, b))\n\n exit()\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\n\n\nfor a in range(1, 120):\n\n for b in range(-119, 119):\n\n if a**5-b**5 == x:\n\n print((a, b))\n\n exit()","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":151,"code_v1_num_chars":148,"code_v0_no_empty_lines":"x = int(eval(input()))\nfor a in range(-118, 120):\n for b in range(-119, 119):\n if a**5 - b**5 == x:\n print((a, b))\n exit()\n","code_v1_no_empty_lines":"x = int(eval(input()))\nfor a in range(1, 120):\n for b in range(-119, 119):\n if a**5 - b**5 == x:\n print((a, b))\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for a in range(-118, 120):","+for a in range(1, 120):"],"diff_only_import_comment":false,"measured_runtime_v0":0.3259610315,"measured_runtime_v1":0.2110695004,"runtime_lift":1.5443303311,"key":["s227979120","s776767072"]} +{"user_id":"u379136995","problem_id":"p02921","language":"python","submission_id_v0":"s545345968","submission_id_v1":"s346622706","cpu_time_v0":27,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.04,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns=eval(input())\n\nt=eval(input())\n\nans=0\n\nif s[0]==t[0]:\n\n ans+=1\n\nif s[1]==t[1]:\n\n ans+=1\n\nif s[2]==t[2]:\n\n ans+=1\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"s=eval(input())\n\nt=eval(input())\n\nans=0\n\nfor i in range(0,3):\n\n if s[i]==t[i]:\n\n ans+=1\n\nprint(ans)\n","code_v0_loc":10,"code_v1_loc":7,"code_v0_num_chars":124,"code_v1_num_chars":98,"code_v0_no_empty_lines":"s = eval(input())\nt = eval(input())\nans = 0\nif s[0] == t[0]:\n ans += 1\nif s[1] == t[1]:\n ans += 1\nif s[2] == t[2]:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"s = eval(input())\nt = eval(input())\nans = 0\nfor i in range(0, 3):\n if s[i] == t[i]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-if s[0] == t[0]:","- ans += 1","-if s[1] == t[1]:","- ans += 1","-if s[2] == t[2]:","- ans += 1","+for i in range(0, 3):","+ if s[i] == t[i]:","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3561623907,"measured_runtime_v1":0.2681128595,"runtime_lift":1.3284047299,"key":["s545345968","s346622706"]} +{"user_id":"u179169725","problem_id":"p03013","language":"python","submission_id_v0":"s455496434","submission_id_v1":"s062412783","cpu_time_v0":438,"cpu_time_v1":334,"memory_v0":17820,"memory_v1":19904,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# https:\/\/atcoder.jp\/contests\/abc129\/tasks\/abc129_c\n\n# \u5178\u578b\u7684\u306aDP\n\n\n\nMOD = 10**9 + 7\n\nimport numpy as np\n\n# dp[i]\u3092i\u6bb5\u76ee\u307e\u3067\u306e\u901a\u308a\u306e\u6570\u3068\u3059\u308b\u3002\n\nN, M = list(map(int, input().split()))\n\nto_zero = np.full((N + 1), False, dtype=bool)\n\nfor _ in range(M):\n\n to_zero[int(eval(input()))] = True # \u5e8a\u304c\u629c\u3051\u3066\u3044\u308b\u3068\u3053\u308d\n\n\n\n# dp\u30c6\u30fc\u30d6\u30eb\u306e\u7528\u610f\n\ndp = np.full((N + 1), -1, dtype='int64')\n\ndp[0] = 1\n\ndp[1] = 0 if to_zero[1] else 1\n\nfor i in range(2, N + 1):\n\n dp[i] = 0 if to_zero[i] else dp[i - 2] + dp[i - 1]\n\n if dp[i] > MOD:\n\n dp[i] %= MOD\n\n\n\nprint((dp[-1]))\n\n\n# optimized version of the same code:\n","target":"# https:\/\/atcoder.jp\/contests\/abc129\/tasks\/abc129_c\n\n# \u5178\u578b\u7684\u306aDP\n\n\n\nMOD = 10**9 + 7\n\nimport numpy as np\n\n# dp[i]\u3092i\u6bb5\u76ee\u307e\u3067\u306e\u901a\u308a\u306e\u6570\u3068\u3059\u308b\u3002\n\nN, M = list(map(int, input().split()))\n\nto_zero = np.full((N + 1), False).tolist()\n\nfor _ in range(M):\n\n to_zero[int(eval(input()))] = True # \u5e8a\u304c\u629c\u3051\u3066\u3044\u308b\u3068\u3053\u308d\n\n\n\n# dp\u30c6\u30fc\u30d6\u30eb\u306e\u7528\u610f\n\ndp = np.full((N + 1), -1).tolist()\n\ndp[0] = 1\n\ndp[1] = 0 if to_zero[1] else 1\n\nfor i in range(2, N + 1):\n\n dp[i] = 0 if to_zero[i] else dp[i - 2] + dp[i - 1]\n\n if dp[i] > MOD:\n\n dp[i] %= MOD\n\n\n\nprint((dp[-1]))\n","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":523,"code_v1_num_chars":514,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc129\/tasks\/abc129_c\n# \u5178\u578b\u7684\u306aDP\nMOD = 10**9 + 7\nimport numpy as np\n\n# dp[i]\u3092i\u6bb5\u76ee\u307e\u3067\u306e\u901a\u308a\u306e\u6570\u3068\u3059\u308b\u3002\nN, M = list(map(int, input().split()))\nto_zero = np.full((N + 1), False, dtype=bool)\nfor _ in range(M):\n to_zero[int(eval(input()))] = True # \u5e8a\u304c\u629c\u3051\u3066\u3044\u308b\u3068\u3053\u308d\n# dp\u30c6\u30fc\u30d6\u30eb\u306e\u7528\u610f\ndp = np.full((N + 1), -1, dtype=\"int64\")\ndp[0] = 1\ndp[1] = 0 if to_zero[1] else 1\nfor i in range(2, N + 1):\n dp[i] = 0 if to_zero[i] else dp[i - 2] + dp[i - 1]\n if dp[i] > MOD:\n dp[i] %= MOD\nprint((dp[-1]))\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc129\/tasks\/abc129_c\n# \u5178\u578b\u7684\u306aDP\nMOD = 10**9 + 7\nimport numpy as np\n\n# dp[i]\u3092i\u6bb5\u76ee\u307e\u3067\u306e\u901a\u308a\u306e\u6570\u3068\u3059\u308b\u3002\nN, M = list(map(int, input().split()))\nto_zero = np.full((N + 1), False).tolist()\nfor _ in range(M):\n to_zero[int(eval(input()))] = True # \u5e8a\u304c\u629c\u3051\u3066\u3044\u308b\u3068\u3053\u308d\n# dp\u30c6\u30fc\u30d6\u30eb\u306e\u7528\u610f\ndp = np.full((N + 1), -1).tolist()\ndp[0] = 1\ndp[1] = 0 if to_zero[1] else 1\nfor i in range(2, N + 1):\n dp[i] = 0 if to_zero[i] else dp[i - 2] + dp[i - 1]\n if dp[i] > MOD:\n dp[i] %= MOD\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-to_zero = np.full((N + 1), False, dtype=bool)","+to_zero = np.full((N + 1), False).tolist()","-dp = np.full((N + 1), -1, dtype=\"int64\")","+dp = np.full((N + 1), -1).tolist()"],"diff_only_import_comment":false,"measured_runtime_v0":1.9272715452,"measured_runtime_v1":1.3572561545,"runtime_lift":1.4199762799,"key":["s455496434","s062412783"]} +{"user_id":"u735069283","problem_id":"p03494","language":"python","submission_id_v0":"s562092829","submission_id_v1":"s247847404","cpu_time_v0":151,"cpu_time_v1":19,"memory_v0":12468,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\neval(input())\n\nx = np.array(input().split(),dtype=np.int32)\n\n\n\nans = 0\n\nwhile (x%2 == 0).all():\n\n x = x\/\/2\n\n ans += 1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = [int(x) for x in input().split()]\n\nresult = float('inf')\n\nfor i in range(N):\n\n r=0\n\n while A[i]%2==0:\n\n A[i]=A[i]\/2\n\n r +=1\n\n result=min(result,r)\n\nprint(result)","code_v0_loc":9,"code_v1_loc":10,"code_v0_num_chars":145,"code_v1_num_chars":192,"code_v0_no_empty_lines":"import numpy as np\n\neval(input())\nx = np.array(input().split(), dtype=np.int32)\nans = 0\nwhile (x % 2 == 0).all():\n x = x \/\/ 2\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(x) for x in input().split()]\nresult = float(\"inf\")\nfor i in range(N):\n r = 0\n while A[i] % 2 == 0:\n A[i] = A[i] \/ 2\n r += 1\n result = min(result, r)\nprint(result)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-import numpy as np","-","-eval(input())","-x = np.array(input().split(), dtype=np.int32)","-ans = 0","-while (x % 2 == 0).all():","- x = x \/\/ 2","- ans += 1","-print(ans)","+N = int(eval(input()))","+A = [int(x) for x in input().split()]","+result = float(\"inf\")","+for i in range(N):","+ r = 0","+ while A[i] % 2 == 0:","+ A[i] = A[i] \/ 2","+ r += 1","+ result = min(result, r)","+print(result)"],"diff_only_import_comment":false,"measured_runtime_v0":1.2939765534,"measured_runtime_v1":0.2053932648,"runtime_lift":6.2999950598,"key":["s562092829","s247847404"]} +{"user_id":"u074220993","problem_id":"p03416","language":"python","submission_id_v0":"s333786892","submission_id_v1":"s249043055","cpu_time_v0":109,"cpu_time_v1":88,"memory_v0":19168,"memory_v1":9452,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = {} #10000\u4ee5\u4e0akey\u4ee5\u4e0b\u306e\u56de\u6587\u6570\u306e\u500b\u6570\n\ncnt = 0\n\nfor i in range(10000, 100000):\n\n L = list(str(i))\n\n if L == list(reversed(L)):\n\n cnt += 1\n\n N[i] = cnt\n\nA, B = list(map(int, input().split()))\n\nprint((N[B]-N[A-1] if A > 10000 else N[B]))\n\n# optimized version of the same code:\n","target":"A, B =list(map(int, input().split()))\n\nnum_palin = [0] * (B+1)\n\nfor i in range(1,B+1):\n\n if str(i) == str(i)[::-1]:\n\n num_palin[i] = num_palin[i-1] + 1\n\n else:\n\n num_palin[i] = num_palin[i-1]\n\nprint((num_palin[B]-num_palin[A-1]))\n","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":233,"code_v1_num_chars":242,"code_v0_no_empty_lines":"N = {} # 10000\u4ee5\u4e0akey\u4ee5\u4e0b\u306e\u56de\u6587\u6570\u306e\u500b\u6570\ncnt = 0\nfor i in range(10000, 100000):\n L = list(str(i))\n if L == list(reversed(L)):\n cnt += 1\n N[i] = cnt\nA, B = list(map(int, input().split()))\nprint((N[B] - N[A - 1] if A > 10000 else N[B]))\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\nnum_palin = [0] * (B + 1)\nfor i in range(1, B + 1):\n if str(i) == str(i)[::-1]:\n num_palin[i] = num_palin[i - 1] + 1\n else:\n num_palin[i] = num_palin[i - 1]\nprint((num_palin[B] - num_palin[A - 1]))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-N = {} # 10000\u4ee5\u4e0akey\u4ee5\u4e0b\u306e\u56de\u6587\u6570\u306e\u500b\u6570","-cnt = 0","-for i in range(10000, 100000):","- L = list(str(i))","- if L == list(reversed(L)):","- cnt += 1","- N[i] = cnt","-print((N[B] - N[A - 1] if A > 10000 else N[B]))","+num_palin = [0] * (B + 1)","+for i in range(1, B + 1):","+ if str(i) == str(i)[::-1]:","+ num_palin[i] = num_palin[i - 1] + 1","+ else:","+ num_palin[i] = num_palin[i - 1]","+print((num_palin[B] - num_palin[A - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.9776612727,"measured_runtime_v1":0.3707281357,"runtime_lift":2.6371380497,"key":["s333786892","s249043055"]} +{"user_id":"u263753244","problem_id":"p03835","language":"python","submission_id_v0":"s871403539","submission_id_v1":"s899034376","cpu_time_v0":1228,"cpu_time_v1":261,"memory_v0":2940,"memory_v1":42092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.75,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk,s=list(map(int,input().split()))\n\ncnt=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0 <= s-i-j <= k:\n\n cnt+=1\n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"k,s=list(map(int,input().split()))\n\na=0\n\nfor i in range(0,k+1):\n\n for j in range(0,k+1):\n\n if 0<=s-i-j<=k:\n\n a+=1\n\nprint(a)","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":144,"code_v1_num_chars":138,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"k, s = list(map(int, input().split()))\na = 0\nfor i in range(0, k + 1):\n for j in range(0, k + 1):\n if 0 <= s - i - j <= k:\n a += 1\nprint(a)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-cnt = 0","-for i in range(k + 1):","- for j in range(k + 1):","+a = 0","+for i in range(0, k + 1):","+ for j in range(0, k + 1):","- cnt += 1","-print(cnt)","+ a += 1","+print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2440719529,"measured_runtime_v1":0.12879462,"runtime_lift":1.8950477354,"key":["s871403539","s899034376"]} +{"user_id":"u761529120","problem_id":"p03806","language":"python","submission_id_v0":"s948329967","submission_id_v1":"s910945254","cpu_time_v0":1465,"cpu_time_v1":943,"memory_v0":59504,"memory_v1":59504,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.63,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,Ma,Mb = list(map(int, input().split()))\n\narr=[list(map(int,input().split())) for _ in range(N)]\n\ndp=[[[5000]*401 for _ in range(401)] for _ in range(41)]\n\ndp[0][0][0] = 0\n\nfor i in range(N):\n\n a,b,c=arr[i]\n\n for j in range(10*N+1):\n\n for k in range(10*N+1):\n\n if dp[i][j][k] == 5000:\n\n continue\n\n dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k])\n\n dp[i+1][j+a][k+b]=min(dp[i+1][j+a][k+b],dp[i][j][k]+c)\n\n\n\nans=5000\n\nfor i in range(1,401):\n\n if i*Ma>400 or i*Mb>400:\n\n break\n\n ans = min(ans, dp[N][i*Ma][i*Mb])\n\nif ans == 5000:\n\n print((-1))\n\nelse:\n\n print(ans)\n\n# optimized version of the same code:\n","target":"def calc():\n\n N,Ma,Mb = list(map(int, input().split()))\n\n arr=[list(map(int,input().split())) for _ in range(N)]\n\n dp=[[[5000]*401 for _ in range(401)] for _ in range(41)]\n\n dp[0][0][0] = 0\n\n for i in range(N):\n\n a,b,c=arr[i]\n\n for j in range(10*N+1):\n\n for k in range(10*N+1):\n\n if dp[i][j][k] == 5000:\n\n continue\n\n dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k])\n\n dp[i+1][j+a][k+b]=min(dp[i+1][j+a][k+b],dp[i][j][k]+c)\n\n\n\n ans=5000\n\n for i in range(1,401):\n\n if i*Ma>400 or i*Mb>400:\n\n break\n\n ans = min(ans, dp[N][i*Ma][i*Mb])\n\n if ans == 5000:\n\n print((-1))\n\n else:\n\n print(ans)\n\n\n\ncalc()","code_v0_loc":22,"code_v1_loc":25,"code_v0_num_chars":642,"code_v1_num_chars":749,"code_v0_no_empty_lines":"N, Ma, Mb = list(map(int, input().split()))\narr = [list(map(int, input().split())) for _ in range(N)]\ndp = [[[5000] * 401 for _ in range(401)] for _ in range(41)]\ndp[0][0][0] = 0\nfor i in range(N):\n a, b, c = arr[i]\n for j in range(10 * N + 1):\n for k in range(10 * N + 1):\n if dp[i][j][k] == 5000:\n continue\n dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k])\n dp[i + 1][j + a][k + b] = min(dp[i + 1][j + a][k + b], dp[i][j][k] + c)\nans = 5000\nfor i in range(1, 401):\n if i * Ma > 400 or i * Mb > 400:\n break\n ans = min(ans, dp[N][i * Ma][i * Mb])\nif ans == 5000:\n print((-1))\nelse:\n print(ans)\n","code_v1_no_empty_lines":"def calc():\n N, Ma, Mb = list(map(int, input().split()))\n arr = [list(map(int, input().split())) for _ in range(N)]\n dp = [[[5000] * 401 for _ in range(401)] for _ in range(41)]\n dp[0][0][0] = 0\n for i in range(N):\n a, b, c = arr[i]\n for j in range(10 * N + 1):\n for k in range(10 * N + 1):\n if dp[i][j][k] == 5000:\n continue\n dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k])\n dp[i + 1][j + a][k + b] = min(dp[i + 1][j + a][k + b], dp[i][j][k] + c)\n ans = 5000\n for i in range(1, 401):\n if i * Ma > 400 or i * Mb > 400:\n break\n ans = min(ans, dp[N][i * Ma][i * Mb])\n if ans == 5000:\n print((-1))\n else:\n print(ans)\n\n\ncalc()\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["-N, Ma, Mb = list(map(int, input().split()))","-arr = [list(map(int, input().split())) for _ in range(N)]","-dp = [[[5000] * 401 for _ in range(401)] for _ in range(41)]","-dp[0][0][0] = 0","-for i in range(N):","- a, b, c = arr[i]","- for j in range(10 * N + 1):","- for k in range(10 * N + 1):","- if dp[i][j][k] == 5000:","- continue","- dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k])","- dp[i + 1][j + a][k + b] = min(dp[i + 1][j + a][k + b], dp[i][j][k] + c)","-ans = 5000","-for i in range(1, 401):","- if i * Ma > 400 or i * Mb > 400:","- break","- ans = min(ans, dp[N][i * Ma][i * Mb])","-if ans == 5000:","- print((-1))","-else:","- print(ans)","+def calc():","+ N, Ma, Mb = list(map(int, input().split()))","+ arr = [list(map(int, input().split())) for _ in range(N)]","+ dp = [[[5000] * 401 for _ in range(401)] for _ in range(41)]","+ dp[0][0][0] = 0","+ for i in range(N):","+ a, b, c = arr[i]","+ for j in range(10 * N + 1):","+ for k in range(10 * N + 1):","+ if dp[i][j][k] == 5000:","+ continue","+ dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k])","+ dp[i + 1][j + a][k + b] = min(dp[i + 1][j + a][k + b], dp[i][j][k] + c)","+ ans = 5000","+ for i in range(1, 401):","+ if i * Ma > 400 or i * Mb > 400:","+ break","+ ans = min(ans, dp[N][i * Ma][i * Mb])","+ if ans == 5000:","+ print((-1))","+ else:","+ print(ans)","+","+","+calc()"],"diff_only_import_comment":false,"measured_runtime_v0":1.7420692999,"measured_runtime_v1":1.3671779791,"runtime_lift":1.2742081328,"key":["s948329967","s910945254"]} +{"user_id":"u936985471","problem_id":"p03608","language":"python","submission_id_v0":"s080314510","submission_id_v1":"s650231829","cpu_time_v0":661,"cpu_time_v1":174,"memory_v0":18216,"memory_v1":74412,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.68,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# \u30ef\u30fc\u30b7\u30e3\u30eb\u30d5\u30ed\u30a4\u30c9\u3067\u3001\u5404\u753a\u9593\u306e\u6700\u77ed\u8ddd\u96e2\u306e\u66f4\u65b0\u306f200^3 = 8,000,000\n\n# \u8a2a\u308c\u308b\u3079\u304d\u753aR\u306f\u305f\u304b\u3060\u304b8\u500b\u306a\u306e\u3067\u3001\u9806\u756a\u306e\u5168\u901a\u308a\u3092\u8a66\u3057\u30668! = \u7d0440000\u901a\u308a\n\n\n\nimport numpy as np\n\nfrom scipy.sparse.csgraph import shortest_path, floyd_warshall\n\nfrom scipy.sparse import csr_matrix\n\n\n\nN,M,R = list(map(int,input().split()))\n\nr = list(map(int,input().split()))\n\nr = list([x-1 for x in r])\n\n\n\nE = [[0 for j in range(N)] for i in range(N)]\n\nfor i in range(M):\n\n a,b,c = list(map(int,input().split()))\n\n E[a-1][b-1] = c\n\n E[b-1][a-1] = c\n\n\n\nE = np.array(E)\n\nE = shortest_path(E,method = \"FW\")\n\n\n\n# DFS\u3067\u3059\u3079\u3066\u306e\u6570\u3092\u8a66\u3059\n\nstack = []\n\nfor i in range(len(r)):\n\n stack.append([r[i],[],0])\n\nans = 10 ** 18\n\nwhile stack:\n\n v,visited,dist = stack.pop()\n\n if len(visited) != 0:\n\n dist += E[visited[-1]][v]\n\n visited2 = visited.copy()\n\n visited2.append(v)\n\n if len(visited2) == len(r):\n\n if dist < ans:\n\n ans = dist\n\n continue\n\n for i in range(len(r)):\n\n if r[i] not in visited2:\n\n stack.append([r[i],visited2,dist])\n\n \n\nprint((int(ans)))\n\n# optimized version of the same code:\n","target":"import sys\n\nreadline = sys.stdin.readline\n\n\n\nN,M,R = list(map(int,readline().split()))\n\nr = list(map(int,readline().split()))\n\nINF = 10 ** 10\n\n\n\nG = [[INF] * N for i in range(N)]\n\nfor i in range(M):\n\n a,b,c = list(map(int,readline().split()))\n\n G[a - 1][b - 1] = c\n\n G[b - 1][a - 1] = c\n\n \n\nfor i in range(N):\n\n G[i][i] = 0\n\n \n\nfor k in range(N):\n\n for i in range(N):\n\n for j in range(N):\n\n G[i][j] = min(G[i][j], G[i][k] + G[k][j])\n\n \n\nimport itertools\n\nans = INF\n\nfor perm in itertools.permutations(list(range(R))):\n\n dist = 0\n\n for i in range(1, len(perm)):\n\n dist += G[r[perm[i - 1]] - 1][r[perm[i]] - 1]\n\n if ans > dist:\n\n ans = dist\n\n \n\nprint(ans)\n","code_v0_loc":40,"code_v1_loc":31,"code_v0_num_chars":969,"code_v1_num_chars":668,"code_v0_no_empty_lines":"# \u30ef\u30fc\u30b7\u30e3\u30eb\u30d5\u30ed\u30a4\u30c9\u3067\u3001\u5404\u753a\u9593\u306e\u6700\u77ed\u8ddd\u96e2\u306e\u66f4\u65b0\u306f200^3 = 8,000,000\n# \u8a2a\u308c\u308b\u3079\u304d\u753aR\u306f\u305f\u304b\u3060\u304b8\u500b\u306a\u306e\u3067\u3001\u9806\u756a\u306e\u5168\u901a\u308a\u3092\u8a66\u3057\u30668! = \u7d0440000\u901a\u308a\nimport numpy as np\nfrom scipy.sparse.csgraph import shortest_path, floyd_warshall\nfrom scipy.sparse import csr_matrix\n\nN, M, R = list(map(int, input().split()))\nr = list(map(int, input().split()))\nr = list([x - 1 for x in r])\nE = [[0 for j in range(N)] for i in range(N)]\nfor i in range(M):\n a, b, c = list(map(int, input().split()))\n E[a - 1][b - 1] = c\n E[b - 1][a - 1] = c\nE = np.array(E)\nE = shortest_path(E, method=\"FW\")\n# DFS\u3067\u3059\u3079\u3066\u306e\u6570\u3092\u8a66\u3059\nstack = []\nfor i in range(len(r)):\n stack.append([r[i], [], 0])\nans = 10**18\nwhile stack:\n v, visited, dist = stack.pop()\n if len(visited) != 0:\n dist += E[visited[-1]][v]\n visited2 = visited.copy()\n visited2.append(v)\n if len(visited2) == len(r):\n if dist < ans:\n ans = dist\n continue\n for i in range(len(r)):\n if r[i] not in visited2:\n stack.append([r[i], visited2, dist])\nprint((int(ans)))\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nN, M, R = list(map(int, readline().split()))\nr = list(map(int, readline().split()))\nINF = 10**10\nG = [[INF] * N for i in range(N)]\nfor i in range(M):\n a, b, c = list(map(int, readline().split()))\n G[a - 1][b - 1] = c\n G[b - 1][a - 1] = c\nfor i in range(N):\n G[i][i] = 0\nfor k in range(N):\n for i in range(N):\n for j in range(N):\n G[i][j] = min(G[i][j], G[i][k] + G[k][j])\nimport itertools\n\nans = INF\nfor perm in itertools.permutations(list(range(R))):\n dist = 0\n for i in range(1, len(perm)):\n dist += G[r[perm[i - 1]] - 1][r[perm[i]] - 1]\n if ans > dist:\n ans = dist\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":22.5,"diff":["-# \u30ef\u30fc\u30b7\u30e3\u30eb\u30d5\u30ed\u30a4\u30c9\u3067\u3001\u5404\u753a\u9593\u306e\u6700\u77ed\u8ddd\u96e2\u306e\u66f4\u65b0\u306f200^3 = 8,000,000","-# \u8a2a\u308c\u308b\u3079\u304d\u753aR\u306f\u305f\u304b\u3060\u304b8\u500b\u306a\u306e\u3067\u3001\u9806\u756a\u306e\u5168\u901a\u308a\u3092\u8a66\u3057\u30668! = \u7d0440000\u901a\u308a","-import numpy as np","-from scipy.sparse.csgraph import shortest_path, floyd_warshall","-from scipy.sparse import csr_matrix","+import sys","-N, M, R = list(map(int, input().split()))","-r = list(map(int, input().split()))","-r = list([x - 1 for x in r])","-E = [[0 for j in range(N)] for i in range(N)]","+readline = sys.stdin.readline","+N, M, R = list(map(int, readline().split()))","+r = list(map(int, readline().split()))","+INF = 10**10","+G = [[INF] * N for i in range(N)]","- a, b, c = list(map(int, input().split()))","- E[a - 1][b - 1] = c","- E[b - 1][a - 1] = c","-E = np.array(E)","-E = shortest_path(E, method=\"FW\")","-# DFS\u3067\u3059\u3079\u3066\u306e\u6570\u3092\u8a66\u3059","-stack = []","-for i in range(len(r)):","- stack.append([r[i], [], 0])","-ans = 10**18","-while stack:","- v, visited, dist = stack.pop()","- if len(visited) != 0:","- dist += E[visited[-1]][v]","- visited2 = visited.copy()","- visited2.append(v)","- if len(visited2) == len(r):","- if dist < ans:","- ans = dist","- continue","- for i in range(len(r)):","- if r[i] not in visited2:","- stack.append([r[i], visited2, dist])","-print((int(ans)))","+ a, b, c = list(map(int, readline().split()))","+ G[a - 1][b - 1] = c","+ G[b - 1][a - 1] = c","+for i in range(N):","+ G[i][i] = 0","+for k in range(N):","+ for i in range(N):","+ for j in range(N):","+ G[i][j] = min(G[i][j], G[i][k] + G[k][j])","+import itertools","+","+ans = INF","+for perm in itertools.permutations(list(range(R))):","+ dist = 0","+ for i in range(1, len(perm)):","+ dist += G[r[perm[i - 1]] - 1][r[perm[i]] - 1]","+ if ans > dist:","+ ans = dist","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.8536462879,"measured_runtime_v1":0.2095541062,"runtime_lift":8.8456691264,"key":["s080314510","s650231829"]} +{"user_id":"u750990077","problem_id":"p02690","language":"python","submission_id_v0":"s458163886","submission_id_v1":"s605160476","cpu_time_v0":47,"cpu_time_v1":42,"memory_v0":9036,"memory_v1":8860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n x = int(eval(input()))\n\n for a in range(-120, 121):\n\n for b in range(-120, 121):\n\n if a**5 - b**5 == x:\n\n print((a, b))\n\n return\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n# optimized version of the same code:\n","target":"def main():\n\n x = int(eval(input()))\n\n for i in range(-120, 121):\n\n for j in range(-120, 121):\n\n if i**5 - j**5 == x:\n\n print((i, j))\n\n return\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":230,"code_v1_num_chars":230,"code_v0_no_empty_lines":"def main():\n x = int(eval(input()))\n for a in range(-120, 121):\n for b in range(-120, 121):\n if a**5 - b**5 == x:\n print((a, b))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n x = int(eval(input()))\n for i in range(-120, 121):\n for j in range(-120, 121):\n if i**5 - j**5 == x:\n print((i, j))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for a in range(-120, 121):","- for b in range(-120, 121):","- if a**5 - b**5 == x:","- print((a, b))","+ for i in range(-120, 121):","+ for j in range(-120, 121):","+ if i**5 - j**5 == x:","+ print((i, j))"],"diff_only_import_comment":false,"measured_runtime_v0":0.47585452,"measured_runtime_v1":0.3591731171,"runtime_lift":1.3248611807,"key":["s458163886","s605160476"]} +{"user_id":"u457901067","problem_id":"p02814","language":"python","submission_id_v0":"s285073705","submission_id_v1":"s453740847","cpu_time_v0":523,"cpu_time_v1":158,"memory_v0":21860,"memory_v1":97668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom fractions import gcd\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a \/\/ 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x \/\/ pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b\/\/gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M \/\/ x + 1) \/\/ 2))\n\n# optimized version of the same code:\n","target":"N, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a \/\/ 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x \/\/ pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b\/\/gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M \/\/ x + 1) \/\/ 2))","code_v0_loc":33,"code_v1_loc":32,"code_v0_num_chars":560,"code_v1_num_chars":533,"code_v0_no_empty_lines":"from fractions import gcd\n\nN, M = list(map(int, input().split()))\nA = list([int(x) for x in input().split()])\ncnt = [0 for _ in range(N)]\nfor i in range(N):\n a = A[i]\n while a % 2 == 0:\n a = a \/\/ 2\n cnt[i] += 1\nif max(cnt) > min(cnt):\n print((0))\n exit(0)\nC = max(cnt)\nA = list([x \/\/ pow(2, C) for x in A])\n\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n while a % b > 0:\n a, b = b, a % b\n return b\n\n\ndef lcm(a, b):\n return a * b \/\/ gcd(a, b)\n\n\nx = A[0]\nfor a in A[1:]:\n x = lcm(x, a)\nx = x * pow(2, C - 1)\nprint(((M \/\/ x + 1) \/\/ 2))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nA = list([int(x) for x in input().split()])\ncnt = [0 for _ in range(N)]\nfor i in range(N):\n a = A[i]\n while a % 2 == 0:\n a = a \/\/ 2\n cnt[i] += 1\nif max(cnt) > min(cnt):\n print((0))\n exit(0)\nC = max(cnt)\nA = list([x \/\/ pow(2, C) for x in A])\n\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n while a % b > 0:\n a, b = b, a % b\n return b\n\n\ndef lcm(a, b):\n return a * b \/\/ gcd(a, b)\n\n\nx = A[0]\nfor a in A[1:]:\n x = lcm(x, a)\nx = x * pow(2, C - 1)\nprint(((M \/\/ x + 1) \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":3.0303030303,"diff":["-from fractions import gcd","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.2484916873,"measured_runtime_v1":0.192324806,"runtime_lift":1.2920417937,"key":["s285073705","s453740847"]} +{"user_id":"u027685417","problem_id":"p03038","language":"python","submission_id_v0":"s124992398","submission_id_v1":"s099446399","cpu_time_v0":678,"cpu_time_v1":544,"memory_v0":33104,"memory_v1":28888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.76,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom heapq import *\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nPAIRS = [[-a, -1] for a in map(int, input().split())]\n\nheapify(PAIRS)\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(PAIRS, [-c, -b])\n\n\n\nanswer = 0\n\nfor _ in range(n):\n\n pair = heappop(PAIRS)\n\n answer += -pair[0]\n\n pair[1] += 1\n\n if pair[1] != 0:\n\n heappush(PAIRS, pair)\n\n\n\nprint(answer)\n\n\n# optimized version of the same code:\n","target":"n, m = list(map(int, input().split()))\n\nPAIRS = [(a, 1) for a in map(int, input().split())]\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n PAIRS.append((c, b))\n\nPAIRS.sort(reverse = True)\n\n\n\nanswer, count = 0, 0\n\nfor pair in PAIRS:\n\n answer += pair[0] * pair[1]\n\n count += pair[1]\n\n if count > n:\n\n answer -= pair[0] * (count - n)\n\n break\n\n\n\nprint(answer)\n","code_v0_loc":20,"code_v1_loc":17,"code_v0_num_chars":393,"code_v1_num_chars":391,"code_v0_no_empty_lines":"from heapq import *\n\nn, m = list(map(int, input().split()))\nPAIRS = [[-a, -1] for a in map(int, input().split())]\nheapify(PAIRS)\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n heappush(PAIRS, [-c, -b])\nanswer = 0\nfor _ in range(n):\n pair = heappop(PAIRS)\n answer += -pair[0]\n pair[1] += 1\n if pair[1] != 0:\n heappush(PAIRS, pair)\nprint(answer)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nPAIRS = [(a, 1) for a in map(int, input().split())]\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n PAIRS.append((c, b))\nPAIRS.sort(reverse=True)\nanswer, count = 0, 0\nfor pair in PAIRS:\n answer += pair[0] * pair[1]\n count += pair[1]\n if count > n:\n answer -= pair[0] * (count - n)\n break\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-from heapq import *","-","-PAIRS = [[-a, -1] for a in map(int, input().split())]","-heapify(PAIRS)","+PAIRS = [(a, 1) for a in map(int, input().split())]","- heappush(PAIRS, [-c, -b])","-answer = 0","-for _ in range(n):","- pair = heappop(PAIRS)","- answer += -pair[0]","- pair[1] += 1","- if pair[1] != 0:","- heappush(PAIRS, pair)","+ PAIRS.append((c, b))","+PAIRS.sort(reverse=True)","+answer, count = 0, 0","+for pair in PAIRS:","+ answer += pair[0] * pair[1]","+ count += pair[1]","+ if count > n:","+ answer -= pair[0] * (count - n)","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.2969929054,"measured_runtime_v1":0.0828762929,"runtime_lift":3.5835688928,"key":["s124992398","s099446399"]} +{"user_id":"u277448038","problem_id":"p04012","language":"python","submission_id_v0":"s508164374","submission_id_v1":"s917345627","cpu_time_v0":169,"cpu_time_v1":17,"memory_v0":13048,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.94,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nimport sys\n\nw = eval(input())\n\ncountn = np.zeros(26)\n\new = \"abcdefghijklmnopqrstuvwxyz\"\n\ni = 0\n\nwhile i < 26:\n\n countn[i] = w.count(ew[i])\n\n if countn[i] %2 != 0:\n\n print(\"No\")\n\n sys.exit()\n\n i +=1\n\n \n\nprint(\"Yes\")\n\n \n\n \n\n# optimized version of the same code:\n","target":"#ABC044B\n\nw = eval(input())\n\nl = len(w)\n\nsig = 0\n\n\n\nfor i in range(l):\n\n if w.count(w[i])%2 !=0:\n\n sig = 1\n\n break\n\n\n\nif sig == 1:\n\n print(\"No\")\n\nelse:\n\n print(\"Yes\")","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":264,"code_v1_num_chars":183,"code_v0_no_empty_lines":"import numpy as np\nimport sys\n\nw = eval(input())\ncountn = np.zeros(26)\new = \"abcdefghijklmnopqrstuvwxyz\"\ni = 0\nwhile i < 26:\n countn[i] = w.count(ew[i])\n if countn[i] % 2 != 0:\n print(\"No\")\n sys.exit()\n i += 1\nprint(\"Yes\")\n","code_v1_no_empty_lines":"# ABC044B\nw = eval(input())\nl = len(w)\nsig = 0\nfor i in range(l):\n if w.count(w[i]) % 2 != 0:\n sig = 1\n break\nif sig == 1:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import numpy as np","-import sys","-","+# ABC044B","-countn = np.zeros(26)","-ew = \"abcdefghijklmnopqrstuvwxyz\"","-i = 0","-while i < 26:","- countn[i] = w.count(ew[i])","- if countn[i] % 2 != 0:","- print(\"No\")","- sys.exit()","- i += 1","-print(\"Yes\")","+l = len(w)","+sig = 0","+for i in range(l):","+ if w.count(w[i]) % 2 != 0:","+ sig = 1","+ break","+if sig == 1:","+ print(\"No\")","+else:","+ print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":1.6324973707,"measured_runtime_v1":0.2494062472,"runtime_lift":6.5455352015,"key":["s508164374","s917345627"]} +{"user_id":"u803617136","problem_id":"p03796","language":"python","submission_id_v0":"s262574211","submission_id_v1":"s998310124","cpu_time_v0":230,"cpu_time_v1":37,"memory_v0":3980,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\nn = int(eval(input()))\n\nans = math.factorial(n) % (pow(10, 9) + 7)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nans = 1\n\nmod = 10 ** 9 + 7\n\nfor i in range(1, n + 1):\n\n ans = (ans * i % mod) % mod\n\nprint(ans)","code_v0_loc":5,"code_v1_loc":6,"code_v0_num_chars":87,"code_v1_num_chars":116,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nans = math.factorial(n) % (pow(10, 9) + 7)\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = 1\nmod = 10**9 + 7\nfor i in range(1, n + 1):\n ans = (ans * i % mod) % mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-import math","-","-ans = math.factorial(n) % (pow(10, 9) + 7)","+ans = 1","+mod = 10**9 + 7","+for i in range(1, n + 1):","+ ans = (ans * i % mod) % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.5572224624,"measured_runtime_v1":0.2586410534,"runtime_lift":2.154423882,"key":["s262574211","s998310124"]} +{"user_id":"u991567869","problem_id":"p02596","language":"python","submission_id_v0":"s146225899","submission_id_v1":"s204753661","cpu_time_v0":292,"cpu_time_v1":175,"memory_v0":9152,"memory_v1":9164,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.07,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk = int(eval(input()))\n\nx = 1\n\n\n\nif k%7 != 0:\n\n mod = 9*k\n\nelse:\n\n mod = 9*k\/\/7\n\n\n\nfor i in range(10**6):\n\n x = x*10%mod\n\n if x == 1:\n\n print((i + 1))\n\n exit()\n\n\n\nprint((-1))\n\n# optimized version of the same code:\n","target":"k = int(eval(input()))\n\na = 0\n\n\n\nfor i in range(k + 10):\n\n a = (a*10 + 7)%k\n\n if a == 0:\n\n print((i + 1))\n\n exit()\n\nprint((-1))","code_v0_loc":15,"code_v1_loc":9,"code_v0_num_chars":190,"code_v1_num_chars":137,"code_v0_no_empty_lines":"k = int(eval(input()))\nx = 1\nif k % 7 != 0:\n mod = 9 * k\nelse:\n mod = 9 * k \/\/ 7\nfor i in range(10**6):\n x = x * 10 % mod\n if x == 1:\n print((i + 1))\n exit()\nprint((-1))\n","code_v1_no_empty_lines":"k = int(eval(input()))\na = 0\nfor i in range(k + 10):\n a = (a * 10 + 7) % k\n if a == 0:\n print((i + 1))\n exit()\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-x = 1","-if k % 7 != 0:","- mod = 9 * k","-else:","- mod = 9 * k \/\/ 7","-for i in range(10**6):","- x = x * 10 % mod","- if x == 1:","+a = 0","+for i in range(k + 10):","+ a = (a * 10 + 7) % k","+ if a == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.5332653046,"measured_runtime_v1":0.4200988929,"runtime_lift":1.2693804091,"key":["s146225899","s204753661"]} +{"user_id":"u562935282","problem_id":"p03200","language":"python","submission_id_v0":"s639682353","submission_id_v1":"s546135650","cpu_time_v0":48,"cpu_time_v1":43,"memory_v0":3500,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = eval(input())\n\n\n\ncnt = 0\n\nans = 0\n\nfor c in s:\n\n if c == 'B':\n\n cnt += 1\n\n elif c == 'W':\n\n ans += cnt\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"s = eval(input())\n\n\n\nans = 0\n\nb = 0\n\nfor ss in s:\n\n if ss == 'W':\n\n ans += b\n\n else:\n\n b += 1\n\nprint(ans)\n","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":133,"code_v1_num_chars":120,"code_v0_no_empty_lines":"s = eval(input())\ncnt = 0\nans = 0\nfor c in s:\n if c == \"B\":\n cnt += 1\n elif c == \"W\":\n ans += cnt\nprint(ans)\n","code_v1_no_empty_lines":"s = eval(input())\nans = 0\nb = 0\nfor ss in s:\n if ss == \"W\":\n ans += b\n else:\n b += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-cnt = 0","-for c in s:","- if c == \"B\":","- cnt += 1","- elif c == \"W\":","- ans += cnt","+b = 0","+for ss in s:","+ if ss == \"W\":","+ ans += b","+ else:","+ b += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.2094221431,"measured_runtime_v1":0.1051600281,"runtime_lift":1.9914614603,"key":["s639682353","s546135650"]} +{"user_id":"u744114948","problem_id":"p00053","language":"python","submission_id_v0":"s391855332","submission_id_v1":"s612183692","cpu_time_v0":660,"cpu_time_v1":70,"memory_v0":7228,"memory_v1":8024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.39,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\ndef pri(n):\n\n if n < 2:\n\n return False\n\n elif n == 2:\n\n return True\n\n elif n % 2 == 0:\n\n return False\n\n\n\n i = 3\n\n while i <= math.sqrt(n):\n\n if n % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nl=[i for i in range(110000)if pri(i) ]\n\n\n\nwhile True:\n\n n = int(eval(input()))\n\n if n == 0: break\n\n print((sum(l[:n])))\n\n# optimized version of the same code:\n","target":"import math\n\ndef pri(n):\n\n l =[True] * n\n\n l[0] = l[1] = False\n\n for i in range(2,n):\n\n if l[i]:\n\n for j in range(i*2, n, i):\n\n l[j] = False\n\n return l\n\nn=105000\n\ns=pri(n)\n\nl=[i for i in range(n) if s[i]]\n\nwhile True:\n\n n = int(eval(input()))\n\n if n == 0: break\n\n print((sum(l[:n])))","code_v0_loc":22,"code_v1_loc":16,"code_v0_num_chars":394,"code_v1_num_chars":329,"code_v0_no_empty_lines":"import math\n\n\ndef pri(n):\n if n < 2:\n return False\n elif n == 2:\n return True\n elif n % 2 == 0:\n return False\n i = 3\n while i <= math.sqrt(n):\n if n % i == 0:\n return False\n i += 2\n return True\n\n\nl = [i for i in range(110000) if pri(i)]\nwhile True:\n n = int(eval(input()))\n if n == 0:\n break\n print((sum(l[:n])))\n","code_v1_no_empty_lines":"import math\n\n\ndef pri(n):\n l = [True] * n\n l[0] = l[1] = False\n for i in range(2, n):\n if l[i]:\n for j in range(i * 2, n, i):\n l[j] = False\n return l\n\n\nn = 105000\ns = pri(n)\nl = [i for i in range(n) if s[i]]\nwhile True:\n n = int(eval(input()))\n if n == 0:\n break\n print((sum(l[:n])))\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["- if n < 2:","- return False","- elif n == 2:","- return True","- elif n % 2 == 0:","- return False","- i = 3","- while i <= math.sqrt(n):","- if n % i == 0:","- return False","- i += 2","- return True","+ l = [True] * n","+ l[0] = l[1] = False","+ for i in range(2, n):","+ if l[i]:","+ for j in range(i * 2, n, i):","+ l[j] = False","+ return l","-l = [i for i in range(110000) if pri(i)]","+n = 105000","+s = pri(n)","+l = [i for i in range(n) if s[i]]"],"diff_only_import_comment":false,"measured_runtime_v0":2.8203961465,"measured_runtime_v1":0.4705428715,"runtime_lift":5.9939196138,"key":["s391855332","s612183692"]} +{"user_id":"u133936772","problem_id":"p02988","language":"python","submission_id_v0":"s657683547","submission_id_v1":"s740427744","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nl = list(map(int, input().split()))\n\nprint((sum(l[i]l[i+1]>l[i+2] for i in range(n-2))))\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\nl=list(map(int,input().split()))\n\na=0\n\nfor i in range(n-2):\n\n p,q,r=l[i:i+3]\n\n if p l[i + 1] > l[i + 2]\n for i in range(n - 2)\n )\n )\n)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nl = list(map(int, input().split()))\na = 0\nfor i in range(n - 2):\n p, q, r = l[i : i + 3]\n if p < q < r or r < q < p:\n a += 1\nprint(a)\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-print(","- (","- sum(","- l[i] < l[i + 1] < l[i + 2] or l[i] > l[i + 1] > l[i + 2]","- for i in range(n - 2)","- )","- )","-)","+a = 0","+for i in range(n - 2):","+ p, q, r = l[i : i + 3]","+ if p < q < r or r < q < p:","+ a += 1","+print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1639216754,"measured_runtime_v1":0.0058678908,"runtime_lift":27.9353658749,"key":["s657683547","s740427744"]} +{"user_id":"u729133443","problem_id":"p02661","language":"python","submission_id_v0":"s665964860","submission_id_v1":"s988833610","cpu_time_v0":854,"cpu_time_v1":417,"memory_v0":47316,"memory_v1":155828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom numpy import*\n\na,b=median(t:=loadtxt(open(0),skiprows=1),0)\n\nprint((int((a-b)*~(~len(t)%2))+1))\n\n# optimized version of the same code:\n","target":"from statistics import*\n\n(n,),*t=[list(map(int,t.split()))for t in open(0)]\n\na,b=list(map(median,list(zip(*t))))\n\nprint((int((b-a)*(2-n%2))+1))","code_v0_loc":3,"code_v1_loc":4,"code_v0_num_chars":98,"code_v1_num_chars":123,"code_v0_no_empty_lines":"from numpy import *\n\na, b = median(t := loadtxt(open(0), skiprows=1), 0)\nprint((int((a - b) * ~(~len(t) % 2)) + 1))\n","code_v1_no_empty_lines":"from statistics import *\n\n(n,), *t = [list(map(int, t.split())) for t in open(0)]\na, b = list(map(median, list(zip(*t))))\nprint((int((b - a) * (2 - n % 2)) + 1))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-from numpy import *","+from statistics import *","-a, b = median(t := loadtxt(open(0), skiprows=1), 0)","-print((int((a - b) * ~(~len(t) % 2)) + 1))","+(n,), *t = [list(map(int, t.split())) for t in open(0)]","+a, b = list(map(median, list(zip(*t))))","+print((int((b - a) * (2 - n % 2)) + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":2.1291211085,"measured_runtime_v1":0.4275847787,"runtime_lift":4.9794127725,"key":["s665964860","s988833610"]} +{"user_id":"u102461423","problem_id":"p04021","language":"python","submission_id_v0":"s472972485","submission_id_v1":"s043283938","cpu_time_v0":176,"cpu_time_v1":126,"memory_v0":18796,"memory_v1":21220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.41,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\n\"\"\"\n\n\u5947\u6570\u756a\u76ee\u96c6\u5408\u3001\u5076\u6570\u756a\u76ee\u96c6\u5408\u306e\u4e2d\u3067\u81ea\u7531\u306b\u3067\u304d\u308b\u306e\u304c\u64cd\u4f5c2\uff0e\n\n\u64cd\u4f5c1\u3067\u96c6\u5408\u9593\u306e\u3084\u308a\u3068\u308a\u3092\u3059\u308b\n\n\"\"\"\n\n\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nA = np.fromstring(sys.stdin.read(),dtype=np.int64,sep='\\n')\n\n\n\nB = np.sort(A)\n\n\n\nanswer = len(np.setdiff1d(A[::2],B[::2]))\n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n\"\"\"\n\n\u30fb\u5076\u6570\u756a\u53f7\u3001\u5947\u6570\u756a\u53f7\u306e\u4e2d\u3067\u306f\u5165\u308c\u66ff\u3048\u653e\u984c\n\n\u30fb\u5076\u3001\u5947\u306e\u9593\uff1a\u4e26\u3079\u3066\u304b\u3089\u30b9\u30ef\u30c3\u30d7\u3002\u64cd\u4f5c2\u30921\u56de\u3067\u3001\u6b63\u3057\u3044\u3082\u306e\u30922\u3064\u5897\u3084\u305b\u308b\n\n\"\"\"\n\n\n\nN,*A = list(map(int,read().split()))\n\n\n\nx_to_i = {x:i for i,x in enumerate(sorted(A))}\n\nrank = [x_to_i[x] for x in A]\n\n\n\nanswer = sum((x^i) & 1 for i,x in enumerate(rank)) \/\/ 2\n\nprint(answer)","code_v0_loc":18,"code_v1_loc":17,"code_v0_num_chars":310,"code_v1_num_chars":380,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\n\"\"\"\n\u5947\u6570\u756a\u76ee\u96c6\u5408\u3001\u5076\u6570\u756a\u76ee\u96c6\u5408\u306e\u4e2d\u3067\u81ea\u7531\u306b\u3067\u304d\u308b\u306e\u304c\u64cd\u4f5c2\uff0e\n\u64cd\u4f5c1\u3067\u96c6\u5408\u9593\u306e\u3084\u308a\u3068\u308a\u3092\u3059\u308b\n\"\"\"\nimport numpy as np\n\nN = int(eval(input()))\nA = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=\"\\n\")\nB = np.sort(A)\nanswer = len(np.setdiff1d(A[::2], B[::2]))\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\"\"\"\n\u30fb\u5076\u6570\u756a\u53f7\u3001\u5947\u6570\u756a\u53f7\u306e\u4e2d\u3067\u306f\u5165\u308c\u66ff\u3048\u653e\u984c\n\u30fb\u5076\u3001\u5947\u306e\u9593\uff1a\u4e26\u3079\u3066\u304b\u3089\u30b9\u30ef\u30c3\u30d7\u3002\u64cd\u4f5c2\u30921\u56de\u3067\u3001\u6b63\u3057\u3044\u3082\u306e\u30922\u3064\u5897\u3084\u305b\u308b\n\"\"\"\nN, *A = list(map(int, read().split()))\nx_to_i = {x: i for i, x in enumerate(sorted(A))}\nrank = [x_to_i[x] for x in A]\nanswer = sum((x ^ i) & 1 for i, x in enumerate(rank)) \/\/ 2\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["-input = sys.stdin.readline","-sys.setrecursionlimit(10**7)","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","-\u5947\u6570\u756a\u76ee\u96c6\u5408\u3001\u5076\u6570\u756a\u76ee\u96c6\u5408\u306e\u4e2d\u3067\u81ea\u7531\u306b\u3067\u304d\u308b\u306e\u304c\u64cd\u4f5c2\uff0e","-\u64cd\u4f5c1\u3067\u96c6\u5408\u9593\u306e\u3084\u308a\u3068\u308a\u3092\u3059\u308b","+\u30fb\u5076\u6570\u756a\u53f7\u3001\u5947\u6570\u756a\u53f7\u306e\u4e2d\u3067\u306f\u5165\u308c\u66ff\u3048\u653e\u984c","+\u30fb\u5076\u3001\u5947\u306e\u9593\uff1a\u4e26\u3079\u3066\u304b\u3089\u30b9\u30ef\u30c3\u30d7\u3002\u64cd\u4f5c2\u30921\u56de\u3067\u3001\u6b63\u3057\u3044\u3082\u306e\u30922\u3064\u5897\u3084\u305b\u308b","-import numpy as np","-","-N = int(eval(input()))","-A = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=\"\\n\")","-B = np.sort(A)","-answer = len(np.setdiff1d(A[::2], B[::2]))","+N, *A = list(map(int, read().split()))","+x_to_i = {x: i for i, x in enumerate(sorted(A))}","+rank = [x_to_i[x] for x in A]","+answer = sum((x ^ i) & 1 for i, x in enumerate(rank)) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":1.8491418537,"measured_runtime_v1":0.0781715259,"runtime_lift":23.6549284766,"key":["s472972485","s043283938"]} +{"user_id":"u379716238","problem_id":"p03494","language":"python","submission_id_v0":"s321227388","submission_id_v1":"s000982817","cpu_time_v0":155,"cpu_time_v1":19,"memory_v0":12448,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nx = int(eval(input()))\n\ny = input().split()\n\ny = [int(i) for i in y]\n\ny = np.array(y)\n\ncount = 0\n\nwhile sum([y[i] % 2 for i in range(len(y))]) == 0:\n\n y = y\/2\n\n count += 1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = input().split()\n\nA = [int(i) for i in A]\n\n\n\nc = 0 \n\n\n\nwhile True:\n\n exist_odd = False\n\n for a in A:\n\n if a % 2 != 0:\n\n exist_odd = True\n\n \n\n if exist_odd: break\n\n\n\n for i in range(N):\n\n A[i] = A[i] \/ 2\n\n \n\n c = c + 1\n\nprint(c)","code_v0_loc":11,"code_v1_loc":19,"code_v0_num_chars":207,"code_v1_num_chars":268,"code_v0_no_empty_lines":"import numpy as np\n\nx = int(eval(input()))\ny = input().split()\ny = [int(i) for i in y]\ny = np.array(y)\ncount = 0\nwhile sum([y[i] % 2 for i in range(len(y))]) == 0:\n y = y \/ 2\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = input().split()\nA = [int(i) for i in A]\nc = 0\nwhile True:\n exist_odd = False\n for a in A:\n if a % 2 != 0:\n exist_odd = True\n if exist_odd:\n break\n for i in range(N):\n A[i] = A[i] \/ 2\n c = c + 1\nprint(c)\n","code_same":false,"relative_loc_diff_percent":42.1052631579,"diff":["-import numpy as np","-","-x = int(eval(input()))","-y = input().split()","-y = [int(i) for i in y]","-y = np.array(y)","-count = 0","-while sum([y[i] % 2 for i in range(len(y))]) == 0:","- y = y \/ 2","- count += 1","-print(count)","+N = int(eval(input()))","+A = input().split()","+A = [int(i) for i in A]","+c = 0","+while True:","+ exist_odd = False","+ for a in A:","+ if a % 2 != 0:","+ exist_odd = True","+ if exist_odd:","+ break","+ for i in range(N):","+ A[i] = A[i] \/ 2","+ c = c + 1","+print(c)"],"diff_only_import_comment":false,"measured_runtime_v0":1.7057790201,"measured_runtime_v1":0.3239225752,"runtime_lift":5.2660084552,"key":["s321227388","s000982817"]} +{"user_id":"u813098295","problem_id":"p03363","language":"python","submission_id_v0":"s373502740","submission_id_v1":"s912924761","cpu_time_v0":217,"cpu_time_v1":194,"memory_v0":31620,"memory_v1":45788,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.6,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\n\n\nans, s = 0, 0\n\nd = {0:1}\n\n\n\nfor i in A:\n\n s += i\n\n ans += d.get(s, 0)\n\n d[s] = d.get(s, 0) + 1\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\n\n\nfrom collections import defaultdict\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nd = defaultdict(int)\n\nd[0] = 1\n\n\n\ns, ans = 0, 0\n\n\n\nfor a in A:\n\n s += a\n\n ans += d[s]\n\n d[s] += 1\n\n\n\nprint (ans)","code_v0_loc":12,"code_v1_loc":18,"code_v0_num_chars":175,"code_v1_num_chars":237,"code_v0_no_empty_lines":"N = int(input())\nA = list(map(int, input().split()))\nans, s = 0, 0\nd = {0: 1}\nfor i in A:\n s += i\n ans += d.get(s, 0)\n d[s] = d.get(s, 0) + 1\nprint(ans)\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nfrom collections import defaultdict\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nd = defaultdict(int)\nd[0] = 1\ns, ans = 0, 0\nfor a in A:\n s += a\n ans += d[s]\n d[s] += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-N = int(input())","+#!\/usr\/bin\/env python3","+from collections import defaultdict","+","+N = int(eval(input()))","-ans, s = 0, 0","-d = {0: 1}","-for i in A:","- s += i","- ans += d.get(s, 0)","- d[s] = d.get(s, 0) + 1","+d = defaultdict(int)","+d[0] = 1","+s, ans = 0, 0","+for a in A:","+ s += a","+ ans += d[s]","+ d[s] += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.2992557037,"measured_runtime_v1":0.2235582159,"runtime_lift":1.3386030235,"key":["s373502740","s912924761"]} +{"user_id":"u625963200","problem_id":"p03162","language":"python","submission_id_v0":"s320395863","submission_id_v1":"s758503304","cpu_time_v0":1881,"cpu_time_v1":1669,"memory_v0":41792,"memory_v1":43596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn=int(eval(input()))\n\nABC=[list(map(int,input().split())) for _ in range(n)]\n\n\n\ndp=np.zeros((n,3),int)\n\nfor i in range(3):\n\n dp[0][i]=ABC[0][i]\n\nfor i in range(n-1):\n\n for j in range(3):\n\n dp[i+1][j]=max(dp[i][(j+1)%3]+ABC[i+1][j], dp[i][(j+2)%3]+ABC[i+1][j])\n\nprint((max(dp[-1])))\n\n# optimized version of the same code:\n","target":"import numpy as np\n\nn=int(eval(input()))\n\nABC=[list(map(int,input().split())) for _ in range(n)]\n\n\n\ndp=np.zeros((n,3),int)\n\nfor i in range(3):\n\n dp[0,i]=ABC[0][i]\n\nfor i in range(1,n):\n\n for j in range(3):\n\n dp[i,j]=max(dp[i-1,(j+1)%3]+ABC[i][j],dp[i-1,(j+2)%3]+ABC[i][j])\n\nprint((max(dp[-1])))","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":298,"code_v1_num_chars":291,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nABC = [list(map(int, input().split())) for _ in range(n)]\ndp = np.zeros((n, 3), int)\nfor i in range(3):\n dp[0][i] = ABC[0][i]\nfor i in range(n - 1):\n for j in range(3):\n dp[i + 1][j] = max(\n dp[i][(j + 1) % 3] + ABC[i + 1][j], dp[i][(j + 2) % 3] + ABC[i + 1][j]\n )\nprint((max(dp[-1])))\n","code_v1_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nABC = [list(map(int, input().split())) for _ in range(n)]\ndp = np.zeros((n, 3), int)\nfor i in range(3):\n dp[0, i] = ABC[0][i]\nfor i in range(1, n):\n for j in range(3):\n dp[i, j] = max(\n dp[i - 1, (j + 1) % 3] + ABC[i][j], dp[i - 1, (j + 2) % 3] + ABC[i][j]\n )\nprint((max(dp[-1])))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dp[0][i] = ABC[0][i]","-for i in range(n - 1):","+ dp[0, i] = ABC[0][i]","+for i in range(1, n):","- dp[i + 1][j] = max(","- dp[i][(j + 1) % 3] + ABC[i + 1][j], dp[i][(j + 2) % 3] + ABC[i + 1][j]","+ dp[i, j] = max(","+ dp[i - 1, (j + 1) % 3] + ABC[i][j], dp[i - 1, (j + 2) % 3] + ABC[i][j]"],"diff_only_import_comment":false,"measured_runtime_v0":1.5948334725,"measured_runtime_v1":0.0064303148,"runtime_lift":248.0179469827,"key":["s320395863","s758503304"]} +{"user_id":"u120865944","problem_id":"p03162","language":"python","submission_id_v0":"s595235842","submission_id_v1":"s886147212","cpu_time_v0":1019,"cpu_time_v1":680,"memory_v0":47328,"memory_v1":59484,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nl = [list(map(int, input().split())) for _ in range(N)]\n\n\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\n\n\nfor i in range(1, N+1):\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k]+l[i-1][k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n\n\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\nfor i in range(1, N+1):\n\n hapiness = list(map(int, input().split()))\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k] + hapiness[k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))","code_v0_loc":14,"code_v1_loc":11,"code_v0_num_chars":341,"code_v1_num_chars":329,"code_v0_no_empty_lines":"N = int(eval(input()))\nl = [list(map(int, input().split())) for _ in range(N)]\ndp = [[0 for i in range(3)] for j in range(N + 1)]\nfor i in range(1, N + 1):\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[i][j] = max(dp[i][j], dp[i - 1][k] + l[i - 1][k])\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\ndp = [[0 for i in range(3)] for j in range(N + 1)]\nfor i in range(1, N + 1):\n hapiness = list(map(int, input().split()))\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[i][j] = max(dp[i][j], dp[i - 1][k] + hapiness[k])\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-l = [list(map(int, input().split())) for _ in range(N)]","+ hapiness = list(map(int, input().split()))","- dp[i][j] = max(dp[i][j], dp[i - 1][k] + l[i - 1][k])","+ dp[i][j] = max(dp[i][j], dp[i - 1][k] + hapiness[k])"],"diff_only_import_comment":false,"measured_runtime_v0":0.267745409,"measured_runtime_v1":0.0801038151,"runtime_lift":3.3424801143,"key":["s595235842","s886147212"]} +{"user_id":"u394731058","problem_id":"p02899","language":"python","submission_id_v0":"s948462743","submission_id_v1":"s673167226","cpu_time_v0":210,"cpu_time_v1":76,"memory_v0":13304,"memory_v1":17740,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.81,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(input())\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n for i in range(len(l)):\n\n if i != len(l)-1:\n\n print(\"{} \".format(l[i]), end='')\n\n else:\n\n print(l[i])\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(eval(input()))\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n print((\" \".join(map(str,l))))\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":19,"code_v1_loc":14,"code_v0_num_chars":381,"code_v1_num_chars":268,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n ans = 0\n n = int(input())\n o = list(map(int, input().split()))\n l = [0] * n\n for i in range(n):\n l[o[i] - 1] = i + 1\n for i in range(len(l)):\n if i != len(l) - 1:\n print(\"{} \".format(l[i]), end=\"\")\n else:\n print(l[i])\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n ans = 0\n n = int(eval(input()))\n o = list(map(int, input().split()))\n l = [0] * n\n for i in range(n):\n l[o[i] - 1] = i + 1\n print((\" \".join(map(str, l))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":26.3157894737,"diff":["- n = int(input())","+ n = int(eval(input()))","- for i in range(len(l)):","- if i != len(l) - 1:","- print(\"{} \".format(l[i]), end=\"\")","- else:","- print(l[i])","+ print((\" \".join(map(str, l))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3305146998,"measured_runtime_v1":0.2638847903,"runtime_lift":1.2524962104,"key":["s948462743","s673167226"]} +{"user_id":"u531220228","problem_id":"p02994","language":"python","submission_id_v0":"s512634929","submission_id_v1":"s713379557","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,L = list(map(int, input().split()))\n\ntaste = [L+i-1 for i in range(1,N+1)]\n\nif taste[-1] < 0:\n\n print((sum(taste) + min([abs(x) for x in taste])))\n\nelse:\n\n print((sum(taste) - min([abs(x) for x in taste])))\n\n# optimized version of the same code:\n","target":"N, L = list(map(int, input().split()))\n\n\n\ntaste = [L+i-1 for i in range(1, N+1)]\n\n\n\nif 0 in taste:\n\n select = 0\n\nelse:\n\n select_with_ind = min(enumerate(taste), key = lambda x: abs(x[1]))\n\n select = select_with_ind[1]\n\n \n\nprint((sum(taste) - select))","code_v0_loc":6,"code_v1_loc":11,"code_v0_num_chars":200,"code_v1_num_chars":254,"code_v0_no_empty_lines":"N, L = list(map(int, input().split()))\ntaste = [L + i - 1 for i in range(1, N + 1)]\nif taste[-1] < 0:\n print((sum(taste) + min([abs(x) for x in taste])))\nelse:\n print((sum(taste) - min([abs(x) for x in taste])))\n","code_v1_no_empty_lines":"N, L = list(map(int, input().split()))\ntaste = [L + i - 1 for i in range(1, N + 1)]\nif 0 in taste:\n select = 0\nelse:\n select_with_ind = min(enumerate(taste), key=lambda x: abs(x[1]))\n select = select_with_ind[1]\nprint((sum(taste) - select))\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-if taste[-1] < 0:","- print((sum(taste) + min([abs(x) for x in taste])))","+if 0 in taste:","+ select = 0","- print((sum(taste) - min([abs(x) for x in taste])))","+ select_with_ind = min(enumerate(taste), key=lambda x: abs(x[1]))","+ select = select_with_ind[1]","+print((sum(taste) - select))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3334629779,"measured_runtime_v1":0.1486533701,"runtime_lift":2.2432251455,"key":["s512634929","s713379557"]} +{"user_id":"u077291787","problem_id":"p03416","language":"python","submission_id_v0":"s642708796","submission_id_v1":"s868202811","cpu_time_v0":245,"cpu_time_v1":42,"memory_v0":40940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# ABC090B - Palindromic Numbers\n\na, b = list(map(int, input().rstrip().split()))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n lst = list(map(int, list(str(i))))\n\n if lst[0] == lst[4] and lst[1] == lst[3]:\n\n count += 1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"# ABC090B - Palindromic Numbers\n\ndef main():\n\n a, b = list(map(int, input().rstrip().split()))\n\n cnt = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n if s == s[::-1]:\n\n cnt += 1\n\n print(cnt)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":8,"code_v1_loc":13,"code_v0_num_chars":239,"code_v1_num_chars":269,"code_v0_no_empty_lines":"# ABC090B - Palindromic Numbers\na, b = list(map(int, input().rstrip().split()))\ncount = 0\nfor i in range(a, b + 1):\n lst = list(map(int, list(str(i))))\n if lst[0] == lst[4] and lst[1] == lst[3]:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"# ABC090B - Palindromic Numbers\ndef main():\n a, b = list(map(int, input().rstrip().split()))\n cnt = 0\n for i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n cnt += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":38.4615384615,"diff":["-a, b = list(map(int, input().rstrip().split()))","-count = 0","-for i in range(a, b + 1):","- lst = list(map(int, list(str(i))))","- if lst[0] == lst[4] and lst[1] == lst[3]:","- count += 1","-print(count)","+def main():","+ a, b = list(map(int, input().rstrip().split()))","+ cnt = 0","+ for i in range(a, b + 1):","+ s = str(i)","+ if s == s[::-1]:","+ cnt += 1","+ print(cnt)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3956292481,"measured_runtime_v1":0.2484657222,"runtime_lift":1.5922890477,"key":["s642708796","s868202811"]} +{"user_id":"u977389981","problem_id":"p03720","language":"python","submission_id_v0":"s310815601","submission_id_v1":"s089084009","cpu_time_v0":25,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, m = list(map(int, input().split()))\n\ndp = [0] * n\n\nfor i in range(m):\n\n x, y = list(map(int, input().split()))\n\n dp[x - 1] += 1\n\n dp[y - 1] += 1\n\nfor i in range(n):\n\n print((dp[i]))\n\n# optimized version of the same code:\n","target":"n, m = list(map(int, input().split()))\n\nA = [0] * n\n\nfor i in range(m):\n\n a, b = list(map(int, input().split()))\n\n A[a - 1] += 1\n\n A[b - 1] += 1\n\n \n\nfor i in range(n):\n\n print((A[i]))","code_v0_loc":8,"code_v1_loc":9,"code_v0_num_chars":182,"code_v1_num_chars":184,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\ndp = [0] * n\nfor i in range(m):\n x, y = list(map(int, input().split()))\n dp[x - 1] += 1\n dp[y - 1] += 1\nfor i in range(n):\n print((dp[i]))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nA = [0] * n\nfor i in range(m):\n a, b = list(map(int, input().split()))\n A[a - 1] += 1\n A[b - 1] += 1\nfor i in range(n):\n print((A[i]))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-dp = [0] * n","+A = [0] * n","- x, y = list(map(int, input().split()))","- dp[x - 1] += 1","- dp[y - 1] += 1","+ a, b = list(map(int, input().split()))","+ A[a - 1] += 1","+ A[b - 1] += 1","- print((dp[i]))","+ print((A[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2766861832,"measured_runtime_v1":0.17692909,"runtime_lift":1.5638252769,"key":["s310815601","s089084009"]} +{"user_id":"u440566786","problem_id":"p03558","language":"python","submission_id_v0":"s333680155","submission_id_v1":"s106353030","cpu_time_v0":260,"cpu_time_v1":131,"memory_v0":62004,"memory_v1":79416,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\n\n\nfrom collections import deque\n\ndef resolve():\n\n k=int(eval(input()))\n\n E=[[] for _ in range(k)]\n\n for i in range(k):\n\n E[i].append(((i+1)%k,1))\n\n E[i].append(((10*i)%k,0))\n\n\n\n # 0-1 BFS\n\n dist=[INF]*k\n\n dist[1]=0\n\n Q=deque([1])\n\n while(Q):\n\n v=Q.popleft()\n\n for nv,w in E[v]:\n\n if(dist[nv]<=dist[v]+w): continue\n\n dist[nv]=dist[v]+w\n\n if(w==0): Q.appendleft(nv)\n\n else: Q.append(nv)\n\n print((dist[0]+1))\n\nresolve()\n\n# optimized version of the same code:\n","target":"import sys\n\nINF = 1 << 60\n\nMOD = 10**9 + 7 # 998244353\n\nsys.setrecursionlimit(2147483647)\n\ninput = lambda:sys.stdin.readline().rstrip()\n\nfrom collections import deque\n\ndef resolve():\n\n k = int(eval(input()))\n\n dist = [INF] * k\n\n dist[1] = 1\n\n queue = deque([1])\n\n\n\n while queue:\n\n v = queue.pop()\n\n if dist[10 * v % k] > dist[v]:\n\n dist[10 * v % k] = dist[v]\n\n queue.appendleft(10 * v % k)\n\n if dist[(v + 1) % k] > dist[v] + 1:\n\n dist[(v + 1) % k] = dist[v] + 1\n\n queue.append((v + 1) % k)\n\n\n\n print((dist[0]))\n\nresolve()","code_v0_loc":27,"code_v1_loc":23,"code_v0_num_chars":630,"code_v1_num_chars":596,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nMOD = 10**9 + 7\ninput = lambda: sys.stdin.readline().rstrip()\nfrom collections import deque\n\n\ndef resolve():\n k = int(eval(input()))\n E = [[] for _ in range(k)]\n for i in range(k):\n E[i].append(((i + 1) % k, 1))\n E[i].append(((10 * i) % k, 0))\n # 0-1 BFS\n dist = [INF] * k\n dist[1] = 0\n Q = deque([1])\n while Q:\n v = Q.popleft()\n for nv, w in E[v]:\n if dist[nv] <= dist[v] + w:\n continue\n dist[nv] = dist[v] + w\n if w == 0:\n Q.appendleft(nv)\n else:\n Q.append(nv)\n print((dist[0] + 1))\n\n\nresolve()\n","code_v1_no_empty_lines":"import sys\n\nINF = 1 << 60\nMOD = 10**9 + 7 # 998244353\nsys.setrecursionlimit(2147483647)\ninput = lambda: sys.stdin.readline().rstrip()\nfrom collections import deque\n\n\ndef resolve():\n k = int(eval(input()))\n dist = [INF] * k\n dist[1] = 1\n queue = deque([1])\n while queue:\n v = queue.pop()\n if dist[10 * v % k] > dist[v]:\n dist[10 * v % k] = dist[v]\n queue.appendleft(10 * v % k)\n if dist[(v + 1) % k] > dist[v] + 1:\n dist[(v + 1) % k] = dist[v] + 1\n queue.append((v + 1) % k)\n print((dist[0]))\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":14.8148148148,"diff":["+INF = 1 << 60","+MOD = 10**9 + 7 # 998244353","-INF = float(\"inf\")","-MOD = 10**9 + 7","- E = [[] for _ in range(k)]","- for i in range(k):","- E[i].append(((i + 1) % k, 1))","- E[i].append(((10 * i) % k, 0))","- # 0-1 BFS","- dist[1] = 0","- Q = deque([1])","- while Q:","- v = Q.popleft()","- for nv, w in E[v]:","- if dist[nv] <= dist[v] + w:","- continue","- dist[nv] = dist[v] + w","- if w == 0:","- Q.appendleft(nv)","- else:","- Q.append(nv)","- print((dist[0] + 1))","+ dist[1] = 1","+ queue = deque([1])","+ while queue:","+ v = queue.pop()","+ if dist[10 * v % k] > dist[v]:","+ dist[10 * v % k] = dist[v]","+ queue.appendleft(10 * v % k)","+ if dist[(v + 1) % k] > dist[v] + 1:","+ dist[(v + 1) % k] = dist[v] + 1","+ queue.append((v + 1) % k)","+ print((dist[0]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.412358222,"measured_runtime_v1":0.3278088195,"runtime_lift":1.2579229033,"key":["s333680155","s106353030"]} +{"user_id":"u171065106","problem_id":"p03796","language":"python","submission_id_v0":"s258128729","submission_id_v1":"s727911974","cpu_time_v0":230,"cpu_time_v1":43,"memory_v0":3976,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.3,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\nn = int(eval(input()))\n\n\n\nprint((math.factorial(n) % (10**9 + 7)))\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\n\n\nans = 1\n\n\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= 10**9 + 7\n\n\n\nprint(ans)\n","code_v0_loc":5,"code_v1_loc":9,"code_v0_num_chars":74,"code_v1_num_chars":105,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nprint((math.factorial(n) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= 10**9 + 7\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-import math","-","-print((math.factorial(n) % (10**9 + 7)))","+ans = 1","+for i in range(1, n + 1):","+ ans *= i","+ ans %= 10**9 + 7","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.6649877462,"measured_runtime_v1":0.4034042664,"runtime_lift":1.6484400431,"key":["s258128729","s727911974"]} +{"user_id":"u761320129","problem_id":"p03839","language":"python","submission_id_v0":"s934844992","submission_id_v1":"s135860240","cpu_time_v0":205,"cpu_time_v1":174,"memory_v0":17404,"memory_v1":17532,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.12,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,K = list(map(int,input().split()))\n\nsrc = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncump = [0]\n\nfor a in src:\n\n cums.append(cums[-1] + a)\n\n cump.append(cump[-1] + max(0,a))\n\n\n\nans = 0\n\nfor i in range(N-K+1):\n\n tmp = cump[i]\n\n tmp += max(0, cums[i+K] - cums[i])\n\n tmp += cump[N] - cump[i+K]\n\n ans = max(tmp, ans)\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncums_p = [0]\n\nfor a in A:\n\n cums.append(cums[-1] + a)\n\n cums_p.append(cums_p[-1] + max(0,a))\n\n\n\nans = -float('inf')\n\nfor l in range(N-K+1):\n\n free = cums_p[l] + cums_p[-1] - cums_p[l+K]\n\n cont = cums[l+K] - cums[l]\n\n ans = max(ans, free, free+cont)\n\nprint(ans)","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":342,"code_v1_num_chars":357,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nsrc = list(map(int, input().split()))\ncums = [0]\ncump = [0]\nfor a in src:\n cums.append(cums[-1] + a)\n cump.append(cump[-1] + max(0, a))\nans = 0\nfor i in range(N - K + 1):\n tmp = cump[i]\n tmp += max(0, cums[i + K] - cums[i])\n tmp += cump[N] - cump[i + K]\n ans = max(tmp, ans)\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\ncums = [0]\ncums_p = [0]\nfor a in A:\n cums.append(cums[-1] + a)\n cums_p.append(cums_p[-1] + max(0, a))\nans = -float(\"inf\")\nfor l in range(N - K + 1):\n free = cums_p[l] + cums_p[-1] - cums_p[l + K]\n cont = cums[l + K] - cums[l]\n ans = max(ans, free, free + cont)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["-src = list(map(int, input().split()))","+A = list(map(int, input().split()))","-cump = [0]","-for a in src:","+cums_p = [0]","+for a in A:","- cump.append(cump[-1] + max(0, a))","-ans = 0","-for i in range(N - K + 1):","- tmp = cump[i]","- tmp += max(0, cums[i + K] - cums[i])","- tmp += cump[N] - cump[i + K]","- ans = max(tmp, ans)","+ cums_p.append(cums_p[-1] + max(0, a))","+ans = -float(\"inf\")","+for l in range(N - K + 1):","+ free = cums_p[l] + cums_p[-1] - cums_p[l + K]","+ cont = cums[l + K] - cums[l]","+ ans = max(ans, free, free + cont)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3907449563,"measured_runtime_v1":0.3033102551,"runtime_lift":1.2882681998,"key":["s934844992","s135860240"]} +{"user_id":"u488127128","problem_id":"p03796","language":"python","submission_id_v0":"s637972642","submission_id_v1":"s581563839","cpu_time_v0":32,"cpu_time_v1":28,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r *= n\n\n power_r %= 10**9+7\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(eval(input()))\n\n print((factorial(N)))\n\n# optimized version of the same code:\n","target":"def factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r = power_r*n % (10**9+7)\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(eval(input()))\n\n print((factorial(N)))","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":209,"code_v1_num_chars":200,"code_v0_no_empty_lines":"def factorial(N):\n power_r = 1\n for n in range(2, N + 1):\n power_r *= n\n power_r %= 10**9 + 7\n return power_r\n\n\nif __name__ == \"__main__\":\n N = int(eval(input()))\n print((factorial(N)))\n","code_v1_no_empty_lines":"def factorial(N):\n power_r = 1\n for n in range(2, N + 1):\n power_r = power_r * n % (10**9 + 7)\n return power_r\n\n\nif __name__ == \"__main__\":\n N = int(eval(input()))\n print((factorial(N)))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["- power_r *= n","- power_r %= 10**9 + 7","+ power_r = power_r * n % (10**9 + 7)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3227770622,"measured_runtime_v1":0.2497183731,"runtime_lift":1.2925643324,"key":["s637972642","s581563839"]} +{"user_id":"u189479417","problem_id":"p02596","language":"python","submission_id_v0":"s892012548","submission_id_v1":"s295850055","cpu_time_v0":350,"cpu_time_v1":211,"memory_v0":9176,"memory_v1":9188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nK = int(eval(input()))\n\n\n\npower = 7\n\nSUM = 0\n\n\n\nfor i in range(1, 10 ** 6):\n\n SUM += power\n\n if SUM % K == 0:\n\n print(i)\n\n sys.exit()\n\n power *= 10\n\n power %= K\n\n\n\nprint((-1))\n\n# optimized version of the same code:\n","target":"import sys\n\nK = int(eval(input()))\n\n\n\nL = 9 * K\n\n\n\nif K % 7 == 0:\n\n L \/\/= 7\n\n\n\npower = 1\n\n\n\nfor i in range(1, 10 ** 6):\n\n power *= 10\n\n power %= L\n\n if power == 1:\n\n print(i)\n\n sys.exit()\n\n\n\nprint((-1))","code_v0_loc":15,"code_v1_loc":18,"code_v0_num_chars":205,"code_v1_num_chars":220,"code_v0_no_empty_lines":"import sys\n\nK = int(eval(input()))\npower = 7\nSUM = 0\nfor i in range(1, 10**6):\n SUM += power\n if SUM % K == 0:\n print(i)\n sys.exit()\n power *= 10\n power %= K\nprint((-1))\n","code_v1_no_empty_lines":"import sys\n\nK = int(eval(input()))\nL = 9 * K\nif K % 7 == 0:\n L \/\/= 7\npower = 1\nfor i in range(1, 10**6):\n power *= 10\n power %= L\n if power == 1:\n print(i)\n sys.exit()\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-power = 7","-SUM = 0","+L = 9 * K","+if K % 7 == 0:","+ L \/\/= 7","+power = 1","- SUM += power","- if SUM % K == 0:","+ power *= 10","+ power %= L","+ if power == 1:","- power *= 10","- power %= K"],"diff_only_import_comment":false,"measured_runtime_v0":0.9885553987,"measured_runtime_v1":0.6379526145,"runtime_lift":1.5495749624,"key":["s892012548","s295850055"]} +{"user_id":"u581187895","problem_id":"p02780","language":"python","submission_id_v0":"s723376959","submission_id_v1":"s506730917","cpu_time_v0":187,"cpu_time_v1":105,"memory_v0":23344,"memory_v1":25116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.85,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nimport sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN, K = list(map(int, readline().split()))\n\nA = np.array(readline().split(), dtype=np.int64) + 1\n\n\n\n\n\nAcum = np.zeros(N+1, np.float64)\n\nAcum[1:] = A.cumsum()\n\n\n\nx = Acum[K:] - Acum[:-K]\n\nprint((x.max()\/2))\n\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10 ** 7)\n\nread = sys.stdin.buffer.read \n\ninput = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines \n\n\n\nfrom itertools import accumulate\n\n\n\nN, K = list(map(int, input().split()))\n\nP = list(map(int, input().split()))\n\nPcum = list(accumulate([0] + [(1+p)\/2 for p in P]))\n\n\n\nans = max(right - left for left, right in zip(Pcum, Pcum[K:]))\n\nprint(ans) ","code_v0_loc":15,"code_v1_loc":14,"code_v0_num_chars":339,"code_v1_num_chars":392,"code_v0_no_empty_lines":"import numpy as np\nimport sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN, K = list(map(int, readline().split()))\nA = np.array(readline().split(), dtype=np.int64) + 1\nAcum = np.zeros(N + 1, np.float64)\nAcum[1:] = A.cumsum()\nx = Acum[K:] - Acum[:-K]\nprint((x.max() \/ 2))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nread = sys.stdin.buffer.read\ninput = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom itertools import accumulate\n\nN, K = list(map(int, input().split()))\nP = list(map(int, input().split()))\nPcum = list(accumulate([0] + [(1 + p) \/ 2 for p in P]))\nans = max(right - left for left, right in zip(Pcum, Pcum[K:]))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["-import numpy as np","+sys.setrecursionlimit(10**7)","-readline = sys.stdin.buffer.readline","+input = sys.stdin.buffer.readline","-N, K = list(map(int, readline().split()))","-A = np.array(readline().split(), dtype=np.int64) + 1","-Acum = np.zeros(N + 1, np.float64)","-Acum[1:] = A.cumsum()","-x = Acum[K:] - Acum[:-K]","-print((x.max() \/ 2))","+from itertools import accumulate","+","+N, K = list(map(int, input().split()))","+P = list(map(int, input().split()))","+Pcum = list(accumulate([0] + [(1 + p) \/ 2 for p in P]))","+ans = max(right - left for left, right in zip(Pcum, Pcum[K:]))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3171086328,"measured_runtime_v1":0.2014067566,"runtime_lift":6.539545419,"key":["s723376959","s506730917"]} +{"user_id":"u519939795","problem_id":"p02982","language":"python","submission_id_v0":"s108105198","submission_id_v1":"s959516011","cpu_time_v0":151,"cpu_time_v1":18,"memory_v0":12480,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn,d=list(map(int,input().split()))\n\nx=[list(map(int,input().split())) for i in range(n)]\n\ncount=0\n\nfor i in range(n-1):\n\n for j in range(i+1,n):\n\n a=np.array(x[i])\n\n b=np.array(x[j])\n\n ab=sum(np.power((a-b),2))**0.5\n\n if ab%1==0:\n\n count+=1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"n,d=list(map(int,input().split()))\n\nL=[list(map(int,input().split())) for i in range(n)]\n\nans=0\n\nfor i in range(n-1):\n\n for j in range(i+1,n):\n\n a=0\n\n for k in range(d):\n\n a+=(L[i][k]-L[j][k])**2\n\n if int(a**0.5)==a**0.5:\n\n ans+=1\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":310,"code_v1_num_chars":282,"code_v0_no_empty_lines":"import numpy as np\n\nn, d = list(map(int, input().split()))\nx = [list(map(int, input().split())) for i in range(n)]\ncount = 0\nfor i in range(n - 1):\n for j in range(i + 1, n):\n a = np.array(x[i])\n b = np.array(x[j])\n ab = sum(np.power((a - b), 2)) ** 0.5\n if ab % 1 == 0:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"n, d = list(map(int, input().split()))\nL = [list(map(int, input().split())) for i in range(n)]\nans = 0\nfor i in range(n - 1):\n for j in range(i + 1, n):\n a = 0\n for k in range(d):\n a += (L[i][k] - L[j][k]) ** 2\n if int(a**0.5) == a**0.5:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import numpy as np","-","-x = [list(map(int, input().split())) for i in range(n)]","-count = 0","+L = [list(map(int, input().split())) for i in range(n)]","+ans = 0","- a = np.array(x[i])","- b = np.array(x[j])","- ab = sum(np.power((a - b), 2)) ** 0.5","- if ab % 1 == 0:","- count += 1","-print(count)","+ a = 0","+ for k in range(d):","+ a += (L[i][k] - L[j][k]) ** 2","+ if int(a**0.5) == a**0.5:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.8732560987,"measured_runtime_v1":0.2386262383,"runtime_lift":7.8501681611,"key":["s108105198","s959516011"]} +{"user_id":"u912237403","problem_id":"p00003","language":"python","submission_id_v0":"s588310858","submission_id_v1":"s978758272","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4212,"memory_v1":4212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfor n in range(eval(input())):\n\n a,b,c=sorted(map(int,input().split()))\n\n s=\"YES\" if a*a+b*b==c*c else \"NO\"\n\n print(s)\n\n# optimized version of the same code:\n","target":"for n in range(eval(input())):\n\n a,b,c=sorted(map(int,input().split()))\n\n print(\"YES\" if a*a + b*b == c*c else \"NO\")","code_v0_loc":4,"code_v1_loc":3,"code_v0_num_chars":118,"code_v1_num_chars":115,"code_v0_no_empty_lines":"for n in range(eval(input())):\n a, b, c = sorted(map(int, input().split()))\n s = \"YES\" if a * a + b * b == c * c else \"NO\"\n print(s)\n","code_v1_no_empty_lines":"for n in range(eval(input())):\n a, b, c = sorted(map(int, input().split()))\n print(\"YES\" if a * a + b * b == c * c else \"NO\")\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["- s = \"YES\" if a * a + b * b == c * c else \"NO\"","- print(s)","+ print(\"YES\" if a * a + b * b == c * c else \"NO\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1218309853,"measured_runtime_v1":0.0062354748,"runtime_lift":19.5383653264,"key":["s588310858","s978758272"]} +{"user_id":"u764215612","problem_id":"p02690","language":"python","submission_id_v0":"s260490264","submission_id_v1":"s471661437","cpu_time_v0":40,"cpu_time_v1":34,"memory_v0":9168,"memory_v1":9040,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx=int(eval(input()))\n\nfor i in range(-118,120):\n\n for j in range(-119,129):\n\n if i**5-j**5==x:\n\n print((i,j))\n\n exit()\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\nfor i in range(120):\n\n for j in range(-119,129):\n\n if i**5 - j**5 == x:\n\n print((i, j))\n\n exit()","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":124,"code_v1_num_chars":126,"code_v0_no_empty_lines":"x = int(eval(input()))\nfor i in range(-118, 120):\n for j in range(-119, 129):\n if i**5 - j**5 == x:\n print((i, j))\n exit()\n","code_v1_no_empty_lines":"x = int(eval(input()))\nfor i in range(120):\n for j in range(-119, 129):\n if i**5 - j**5 == x:\n print((i, j))\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(-118, 120):","+for i in range(120):"],"diff_only_import_comment":false,"measured_runtime_v0":0.5536552926,"measured_runtime_v1":0.1323317309,"runtime_lift":4.1838438044,"key":["s260490264","s471661437"]} +{"user_id":"u766684188","problem_id":"p02821","language":"python","submission_id_v0":"s756543404","submission_id_v1":"s283463453","cpu_time_v0":1684,"cpu_time_v1":1054,"memory_v0":58816,"memory_v1":60104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.41,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#E\n\nfrom itertools import accumulate\n\nfrom bisect import bisect_left\n\ndef main():\n\n n,m=list(map(int,input().split()))\n\n A=list(map(int,input().split()))\n\n A.sort()\n\n \n\n def count(k):\n\n cnt=0\n\n for a in A:\n\n cnt+=bisect_left(A,k-a)\n\n return cnt\n\n \n\n ok=0\n\n ng=10**10+1\n\n while ng-ok>1:\n\n mid=(ok+ng)\/\/2\n\n if count(mid)1:\n\n mid=(ok+ng)\/\/2\n\n if count(mid) 1:\n mid = (ok + ng) \/\/ 2\n if count(mid) < n**2 - m:\n ok = mid\n else:\n ng = mid\n border = ok\n k = n**2 - count(border)\n Acc = [0] + list(accumulate(A))\n s = Acc[-1]\n ans = 0\n for a in A:\n idx = bisect_left(A, border - a)\n ans += a * (n - idx) + (s - Acc[idx])\n ans -= border * (k - m)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from itertools import accumulate\nfrom bisect import bisect_left\n\n\ndef main():\n n, m = list(map(int, input().split()))\n A = list(map(int, input().split()))\n A.sort()\n\n def count(k):\n cnt = 0\n for a in A:\n cnt += bisect_left(A, k - a)\n return cnt\n\n ok = 0\n ng = 2 * 10**5 + 1\n while ng - ok > 1:\n mid = (ok + ng) \/\/ 2\n if count(mid) < n**2 - m:\n ok = mid\n else:\n ng = mid\n border = ok\n k = n**2 - count(border)\n Acc = [0] + list(accumulate(A))\n s = Acc[-1]\n ans = 0\n for a in A:\n idx = bisect_left(A, border - a)\n ans += a * (n - idx) + (s - Acc[idx])\n ans -= border * (k - m)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.7777777778,"diff":["-# E","- ng = 10**10 + 1","+ ng = 2 * 10**5 + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.329581742,"measured_runtime_v1":0.2004272747,"runtime_lift":1.6443956668,"key":["s756543404","s283463453"]} +{"user_id":"u738898077","problem_id":"p03634","language":"python","submission_id_v0":"s144783413","submission_id_v1":"s080655040","cpu_time_v0":845,"cpu_time_v1":724,"memory_v0":48964,"memory_v1":48916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.32,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nn = int(eval(input()))\n\nv = [[0]+[]*(n+1) for i in range(n+1)]\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\n\n\nq,k = list(map(int,input().split()))\n\nl = [k]\n\nwhile l:\n\n now = l.pop()\n\n for i in v[now][1:]:\n\n if v[i[0]][0] == 0:\n\n v[i[0]][0] = i[1]+v[now][0]\n\n l.append(i[0])\n\n\n\nfor i in range(q):\n\n x,y = list(map(int,input().split()))\n\n print((v[x][0]+v[y][0]))\n\n# optimized version of the same code:\n","target":"import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n n = int(eval(input()))\n\n v = [[0]+[]*(n+1) for i in range(n+1)]\n\n for i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\n\n\n q,k = list(map(int,input().split()))\n\n l = [k]\n\n while l:\n\n now = l.pop()\n\n for i in v[now][1:]:\n\n if v[i[0]][0] == 0:\n\n v[i[0]][0] = i[1]+v[now][0]\n\n l.append(i[0])\n\n\n\n for i in range(q):\n\n x,y = list(map(int,input().split()))\n\n print((v[x][0]+v[y][0]))\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":21,"code_v1_loc":25,"code_v0_num_chars":486,"code_v1_num_chars":613,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn = int(eval(input()))\nv = [[0] + [] * (n + 1) for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n v[a].append([b, c])\n v[b].append([a, c])\nq, k = list(map(int, input().split()))\nl = [k]\nwhile l:\n now = l.pop()\n for i in v[now][1:]:\n if v[i[0]][0] == 0:\n v[i[0]][0] = i[1] + v[now][0]\n l.append(i[0])\nfor i in range(q):\n x, y = list(map(int, input().split()))\n print((v[x][0] + v[y][0]))\n","code_v1_no_empty_lines":"import sys\n\n\ndef main():\n input = sys.stdin.readline\n n = int(eval(input()))\n v = [[0] + [] * (n + 1) for i in range(n + 1)]\n for i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n v[a].append([b, c])\n v[b].append([a, c])\n q, k = list(map(int, input().split()))\n l = [k]\n while l:\n now = l.pop()\n for i in v[now][1:]:\n if v[i[0]][0] == 0:\n v[i[0]][0] = i[1] + v[now][0]\n l.append(i[0])\n for i in range(q):\n x, y = list(map(int, input().split()))\n print((v[x][0] + v[y][0]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":16.0,"diff":["-input = sys.stdin.readline","-n = int(eval(input()))","-v = [[0] + [] * (n + 1) for i in range(n + 1)]","-for i in range(n - 1):","- a, b, c = list(map(int, input().split()))","- v[a].append([b, c])","- v[b].append([a, c])","-q, k = list(map(int, input().split()))","-l = [k]","-while l:","- now = l.pop()","- for i in v[now][1:]:","- if v[i[0]][0] == 0:","- v[i[0]][0] = i[1] + v[now][0]","- l.append(i[0])","-for i in range(q):","- x, y = list(map(int, input().split()))","- print((v[x][0] + v[y][0]))","+","+def main():","+ input = sys.stdin.readline","+ n = int(eval(input()))","+ v = [[0] + [] * (n + 1) for i in range(n + 1)]","+ for i in range(n - 1):","+ a, b, c = list(map(int, input().split()))","+ v[a].append([b, c])","+ v[b].append([a, c])","+ q, k = list(map(int, input().split()))","+ l = [k]","+ while l:","+ now = l.pop()","+ for i in v[now][1:]:","+ if v[i[0]][0] == 0:","+ v[i[0]][0] = i[1] + v[now][0]","+ l.append(i[0])","+ for i in range(q):","+ x, y = list(map(int, input().split()))","+ print((v[x][0] + v[y][0]))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3066135428,"measured_runtime_v1":0.2174853971,"runtime_lift":1.4098120925,"key":["s144783413","s080655040"]} +{"user_id":"u977193988","problem_id":"p02767","language":"python","submission_id_v0":"s390092370","submission_id_v1":"s517686236","cpu_time_v0":150,"cpu_time_v1":21,"memory_v0":12508,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nX = np.array(list(map(int, input().split())))\n\ncost = float(\"inf\")\n\nfor i in range(max(X) - min(X) + 1):\n\n p = min(X) + i\n\n cost = min(np.sum((X - p) ** 2), cost)\n\nprint(cost)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nX = sorted(list(map(int, input().split())))\n\nif N == 1:\n\n print((0))\n\nelse:\n\n r = X[-1] - X[0]\n\n ans = float(\"inf\")\n\n for i in range(r + 1):\n\n R = X[0] + i\n\n hp = 0\n\n for j in range(N):\n\n hp = hp + (R - X[j]) ** 2\n\n\n\n ans = min(hp, ans)\n\n\n\n print(ans)\n","code_v0_loc":9,"code_v1_loc":16,"code_v0_num_chars":221,"code_v1_num_chars":322,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nX = np.array(list(map(int, input().split())))\ncost = float(\"inf\")\nfor i in range(max(X) - min(X) + 1):\n p = min(X) + i\n cost = min(np.sum((X - p) ** 2), cost)\nprint(cost)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nX = sorted(list(map(int, input().split())))\nif N == 1:\n print((0))\nelse:\n r = X[-1] - X[0]\n ans = float(\"inf\")\n for i in range(r + 1):\n R = X[0] + i\n hp = 0\n for j in range(N):\n hp = hp + (R - X[j]) ** 2\n ans = min(hp, ans)\n print(ans)\n","code_same":false,"relative_loc_diff_percent":43.75,"diff":["-import numpy as np","-","-X = np.array(list(map(int, input().split())))","-cost = float(\"inf\")","-for i in range(max(X) - min(X) + 1):","- p = min(X) + i","- cost = min(np.sum((X - p) ** 2), cost)","-print(cost)","+X = sorted(list(map(int, input().split())))","+if N == 1:","+ print((0))","+else:","+ r = X[-1] - X[0]","+ ans = float(\"inf\")","+ for i in range(r + 1):","+ R = X[0] + i","+ hp = 0","+ for j in range(N):","+ hp = hp + (R - X[j]) ** 2","+ ans = min(hp, ans)","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":2.2545192011,"measured_runtime_v1":0.3218237295,"runtime_lift":7.0054473747,"key":["s390092370","s517686236"]} +{"user_id":"u497046426","problem_id":"p03568","language":"python","submission_id_v0":"s711599117","submission_id_v1":"s424536945","cpu_time_v0":181,"cpu_time_v1":17,"memory_v0":3572,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom functools import reduce\n\nfrom itertools import product\n\n\n\nN = int(eval(input()))\n\n*A, = list(map(int, input().split()))\n\nans = 0\n\nfor t in product([-1, 0, 1], repeat=N):\n\n prod = reduce(lambda x, y: x*y, [a + t[i] for i, a in enumerate(A)])\n\n if prod % 2 == 0: ans += 1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\n*A, = list(map(int, input().split()))\n\nevens = 0\n\nfor a in A:\n\n if a % 2 == 0: evens += 1\n\nans = 3**N - 2**evens\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":7,"code_v0_num_chars":280,"code_v1_num_chars":139,"code_v0_no_empty_lines":"from functools import reduce\nfrom itertools import product\n\nN = int(eval(input()))\n(*A,) = list(map(int, input().split()))\nans = 0\nfor t in product([-1, 0, 1], repeat=N):\n prod = reduce(lambda x, y: x * y, [a + t[i] for i, a in enumerate(A)])\n if prod % 2 == 0:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\n(*A,) = list(map(int, input().split()))\nevens = 0\nfor a in A:\n if a % 2 == 0:\n evens += 1\nans = 3**N - 2**evens\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-from functools import reduce","-from itertools import product","-","-ans = 0","-for t in product([-1, 0, 1], repeat=N):","- prod = reduce(lambda x, y: x * y, [a + t[i] for i, a in enumerate(A)])","- if prod % 2 == 0:","- ans += 1","+evens = 0","+for a in A:","+ if a % 2 == 0:","+ evens += 1","+ans = 3**N - 2**evens"],"diff_only_import_comment":false,"measured_runtime_v0":0.6547077734,"measured_runtime_v1":0.2760411811,"runtime_lift":2.3717757287,"key":["s711599117","s424536945"]} +{"user_id":"u628707847","problem_id":"p02748","language":"python","submission_id_v0":"s393648468","submission_id_v1":"s394235092","cpu_time_v0":533,"cpu_time_v1":471,"memory_v0":30260,"memory_v1":21668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.63,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, m = list(map(int,input().split()))\n\ndr = list(map(int,input().split()))\n\nwa = list(map(int,input().split()))\n\nxyc = [list(map(int,input().split())) for i in range(m)]\n\nlow = 200001\n\n\n\nfor i in range(m):\n\n f = xyc[i][0] - 1\n\n d = xyc[i][1] - 1\n\n if low >= dr[f]+wa[d]-xyc[i][2]:\n\n low = dr[f]+wa[d]-xyc[i][2]\n\n\n\ndr.sort()\n\nwa.sort()\n\n\n\nif low >= (dr[0] + wa[0]):\n\n print((dr[0] + wa[0]))\n\nelse:\n\n print(low)\n\n# optimized version of the same code:\n","target":"a, b, m = list(map(int,input().split()))\n\nal = list(map(int,input().split()))\n\nbl = list(map(int,input().split()))\n\nlow = min(al)+min(bl)\n\nx = [0] * m\n\ny = [0] * m\n\nc = [0] * m\n\n\n\nfor i in range(m):\n\n x[i],y[i],c[i] = list(map(int, input().split()))\n\n x[i] -= 1\n\n y[i] -= 1\n\n \n\nfor i in range(m):\n\n low = min(low,al[x[i]]+bl[y[i]]-c[i])\n\n\n\nprint(low)","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":424,"code_v1_num_chars":353,"code_v0_no_empty_lines":"a, b, m = list(map(int, input().split()))\ndr = list(map(int, input().split()))\nwa = list(map(int, input().split()))\nxyc = [list(map(int, input().split())) for i in range(m)]\nlow = 200001\nfor i in range(m):\n f = xyc[i][0] - 1\n d = xyc[i][1] - 1\n if low >= dr[f] + wa[d] - xyc[i][2]:\n low = dr[f] + wa[d] - xyc[i][2]\ndr.sort()\nwa.sort()\nif low >= (dr[0] + wa[0]):\n print((dr[0] + wa[0]))\nelse:\n print(low)\n","code_v1_no_empty_lines":"a, b, m = list(map(int, input().split()))\nal = list(map(int, input().split()))\nbl = list(map(int, input().split()))\nlow = min(al) + min(bl)\nx = [0] * m\ny = [0] * m\nc = [0] * m\nfor i in range(m):\n x[i], y[i], c[i] = list(map(int, input().split()))\n x[i] -= 1\n y[i] -= 1\nfor i in range(m):\n low = min(low, al[x[i]] + bl[y[i]] - c[i])\nprint(low)\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-dr = list(map(int, input().split()))","-wa = list(map(int, input().split()))","-xyc = [list(map(int, input().split())) for i in range(m)]","-low = 200001","+al = list(map(int, input().split()))","+bl = list(map(int, input().split()))","+low = min(al) + min(bl)","+x = [0] * m","+y = [0] * m","+c = [0] * m","- f = xyc[i][0] - 1","- d = xyc[i][1] - 1","- if low >= dr[f] + wa[d] - xyc[i][2]:","- low = dr[f] + wa[d] - xyc[i][2]","-dr.sort()","-wa.sort()","-if low >= (dr[0] + wa[0]):","- print((dr[0] + wa[0]))","-else:","- print(low)","+ x[i], y[i], c[i] = list(map(int, input().split()))","+ x[i] -= 1","+ y[i] -= 1","+for i in range(m):","+ low = min(low, al[x[i]] + bl[y[i]] - c[i])","+print(low)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2055197518,"measured_runtime_v1":0.0063774352,"runtime_lift":32.2260822388,"key":["s393648468","s394235092"]} +{"user_id":"u428199834","problem_id":"p02690","language":"python","submission_id_v0":"s731409863","submission_id_v1":"s859547087","cpu_time_v0":78,"cpu_time_v1":64,"memory_v0":9088,"memory_v1":9044,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nX=int(eval(input()))\n\na=[]\n\nfor i in range(-100,200):\n\n for j in range(-100,200):\n\n if i**5-j**5==X:\n\n a.append(str(i))\n\n a.append(str(j))\n\n break\n\nprint((' '.join(a[0:2])))\n\n\n\n \n\n# optimized version of the same code:\n","target":"X=int(eval(input()))\n\na=[]\n\nfor i in range(-100,200):\n\n for j in range(-100,200):\n\n if i**5-j**5==X:\n\n a.append(str(i))\n\n a.append(str(j))\n\n break\n\n else:\n\n continue\n\n break \n\nprint((' '.join(a[0:2])))\n\n\n\n \n","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":192,"code_v1_num_chars":227,"code_v0_no_empty_lines":"X = int(eval(input()))\na = []\nfor i in range(-100, 200):\n for j in range(-100, 200):\n if i**5 - j**5 == X:\n a.append(str(i))\n a.append(str(j))\n break\nprint((\" \".join(a[0:2])))\n","code_v1_no_empty_lines":"X = int(eval(input()))\na = []\nfor i in range(-100, 200):\n for j in range(-100, 200):\n if i**5 - j**5 == X:\n a.append(str(i))\n a.append(str(j))\n break\n else:\n continue\n break\nprint((\" \".join(a[0:2])))\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["+ else:","+ continue","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.2243127763,"measured_runtime_v1":0.1643264433,"runtime_lift":1.3650437011,"key":["s731409863","s859547087"]} +{"user_id":"u624689667","problem_id":"p03835","language":"python","submission_id_v0":"s909731438","submission_id_v1":"s120194088","cpu_time_v0":274,"cpu_time_v1":201,"memory_v0":40684,"memory_v1":41308,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nK, S = [int(i) for i in input().split()]\n\n\n\nc = 0\n\nfor X in range(K + 1):\n\n for Y in range(K + 1):\n\n Z = S - X - Y\n\n if 0 <= Z <= K:\n\n c += 1\n\n\n\nprint(c)\n\n# optimized version of the same code:\n","target":"K, S = [int(i) for i in input().split()]\n\n\n\nans = 0\n\n# X <= Y <= Z\u3068\u3057\u3066\u3082\u4e00\u822c\u6027\u3092\u5931\u308f\u306a\u3044\n\nfor x in range(K + 1):\n\n for y in range(x, K + 1):\n\n z = S - x - y\n\n if z < y:\n\n break\n\n if z <= K:\n\n if x == y == z:\n\n ans += 1\n\n elif x == y or y == z or z == x:\n\n ans += 3\n\n else:\n\n ans += 6\n\nprint(ans)\n","code_v0_loc":10,"code_v1_loc":17,"code_v0_num_chars":181,"code_v1_num_chars":399,"code_v0_no_empty_lines":"K, S = [int(i) for i in input().split()]\nc = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if 0 <= Z <= K:\n c += 1\nprint(c)\n","code_v1_no_empty_lines":"K, S = [int(i) for i in input().split()]\nans = 0\n# X <= Y <= Z\u3068\u3057\u3066\u3082\u4e00\u822c\u6027\u3092\u5931\u308f\u306a\u3044\nfor x in range(K + 1):\n for y in range(x, K + 1):\n z = S - x - y\n if z < y:\n break\n if z <= K:\n if x == y == z:\n ans += 1\n elif x == y or y == z or z == x:\n ans += 3\n else:\n ans += 6\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":41.1764705882,"diff":["-c = 0","-for X in range(K + 1):","- for Y in range(K + 1):","- Z = S - X - Y","- if 0 <= Z <= K:","- c += 1","-print(c)","+ans = 0","+# X <= Y <= Z\u3068\u3057\u3066\u3082\u4e00\u822c\u6027\u3092\u5931\u308f\u306a\u3044","+for x in range(K + 1):","+ for y in range(x, K + 1):","+ z = S - x - y","+ if z < y:","+ break","+ if z <= K:","+ if x == y == z:","+ ans += 1","+ elif x == y or y == z or z == x:","+ ans += 3","+ else:","+ ans += 6","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2592413317,"measured_runtime_v1":0.105755719,"runtime_lift":2.4513221044,"key":["s909731438","s120194088"]} +{"user_id":"u580697892","problem_id":"p03126","language":"python","submission_id_v0":"s815650621","submission_id_v1":"s504616042","cpu_time_v0":326,"cpu_time_v1":18,"memory_v0":20760,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN, M = list(map(int, input().split()))\n\nmenu = np.array([])\n\nfor i in range(N):\n\n a = np.array(input().split())\n\n menu = np.append(menu, a[1:])\n\nmenu = np.array(menu).astype(int).ravel()\n\ncount = 0\n\nfor i in range(1, M+1):\n\n if np.sum(menu == i) == N:\n\n count += 1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nn, m = list(map(int, input().split()))\n\nll = [0] * m\n\nfor i in range(n):\n\n l = list(map(int, input().split()))\n\n for j in range(l[0]):\n\n ll[l[j+1] - 1] += 1\n\nprint((ll.count(max(ll)) if max(ll)==n else 0))","code_v0_loc":12,"code_v1_loc":8,"code_v0_num_chars":298,"code_v1_num_chars":227,"code_v0_no_empty_lines":"import numpy as np\n\nN, M = list(map(int, input().split()))\nmenu = np.array([])\nfor i in range(N):\n a = np.array(input().split())\n menu = np.append(menu, a[1:])\nmenu = np.array(menu).astype(int).ravel()\ncount = 0\nfor i in range(1, M + 1):\n if np.sum(menu == i) == N:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"# coding: utf-8\nn, m = list(map(int, input().split()))\nll = [0] * m\nfor i in range(n):\n l = list(map(int, input().split()))\n for j in range(l[0]):\n ll[l[j + 1] - 1] += 1\nprint((ll.count(max(ll)) if max(ll) == n else 0))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-import numpy as np","-","-N, M = list(map(int, input().split()))","-menu = np.array([])","-for i in range(N):","- a = np.array(input().split())","- menu = np.append(menu, a[1:])","-menu = np.array(menu).astype(int).ravel()","-count = 0","-for i in range(1, M + 1):","- if np.sum(menu == i) == N:","- count += 1","-print(count)","+# coding: utf-8","+n, m = list(map(int, input().split()))","+ll = [0] * m","+for i in range(n):","+ l = list(map(int, input().split()))","+ for j in range(l[0]):","+ ll[l[j + 1] - 1] += 1","+print((ll.count(max(ll)) if max(ll) == n else 0))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4087881777,"measured_runtime_v1":0.1976648209,"runtime_lift":7.1271568263,"key":["s815650621","s504616042"]} +{"user_id":"u306664745","problem_id":"p02983","language":"python","submission_id_v0":"s965697641","submission_id_v1":"s560038811","cpu_time_v0":68,"cpu_time_v1":56,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.65,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nl, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (((i%2019)*(j%2019))%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)\n\n# optimized version of the same code:\n","target":"l, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (i*j%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":217,"code_v1_num_chars":201,"code_v0_no_empty_lines":"l, r = list(map(int, input().split()))\nif r - l > 672:\n p = 0\nelse:\n p = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n p = min(p, (((i % 2019) * (j % 2019)) % 2019))\n if not p:\n break\n if not p:\n break\nprint(p)\n","code_v1_no_empty_lines":"l, r = list(map(int, input().split()))\nif r - l > 672:\n p = 0\nelse:\n p = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n p = min(p, (i * j % 2019))\n if not p:\n break\n if not p:\n break\nprint(p)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- p = min(p, (((i % 2019) * (j % 2019)) % 2019))","+ p = min(p, (i * j % 2019))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3854847456,"measured_runtime_v1":0.191389215,"runtime_lift":2.0141403766,"key":["s965697641","s560038811"]} +{"user_id":"u046592970","problem_id":"p03371","language":"python","submission_id_v0":"s911937877","submission_id_v1":"s225349134","cpu_time_v0":121,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c,x,y = list(map(int,input().split()))\n\nprice = 10**10\n\nfor k in range(10**5+1):\n\n re = 2*c*k + max(0,x-k)*a + max(0,y-k)*b\n\n price = min(re,price)\n\nprint(price)\n\n# optimized version of the same code:\n","target":"a,b,c,x,y = list(map(int,input().split()))\n\na1 = a*x + b*y\n\na2 = max(x,y) * 2*c\n\nif y >= x:\n\n a3 = 2*c*x + (y-x)*b\n\nelse:\n\n a3 = 2*c*y + (x-y)*a\n\nprint((min(a1,a2,a3)))","code_v0_loc":6,"code_v1_loc":8,"code_v0_num_chars":165,"code_v1_num_chars":166,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nprice = 10**10\nfor k in range(10**5 + 1):\n re = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b\n price = min(re, price)\nprint(price)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\na1 = a * x + b * y\na2 = max(x, y) * 2 * c\nif y >= x:\n a3 = 2 * c * x + (y - x) * b\nelse:\n a3 = 2 * c * y + (x - y) * a\nprint((min(a1, a2, a3)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-price = 10**10","-for k in range(10**5 + 1):","- re = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b","- price = min(re, price)","-print(price)","+a1 = a * x + b * y","+a2 = max(x, y) * 2 * c","+if y >= x:","+ a3 = 2 * c * x + (y - x) * b","+else:","+ a3 = 2 * c * y + (x - y) * a","+print((min(a1, a2, a3)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4459569323,"measured_runtime_v1":0.1564870899,"runtime_lift":2.8498001506,"key":["s911937877","s225349134"]} +{"user_id":"u562016607","problem_id":"p04021","language":"python","submission_id_v0":"s141985189","submission_id_v1":"s196716457","cpu_time_v0":455,"cpu_time_v1":352,"memory_v0":20612,"memory_v1":18400,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN=int(eval(input()))\n\nA=[int(eval(input())) for i in range(N)]\n\nB=list(np.argsort(np.array(A)))\n\nX=[[0,0],[0,0]]\n\nfor i in range(N):\n\n X[i%2][B[i]%2]+=1\n\nprint((X[0][1]))\n\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\nA=[int(eval(input())) for i in range(N)]\n\nAT=[(A[i],i) for i in range(N)]\n\nAT.sort()\n\nB=[AT[i][1] for i in range(N)]\n\nX=[[0,0],[0,0]]\n\nfor i in range(N):\n\n X[i%2][B[i]%2]+=1\n\nY=[X[0][1],X[1][0]]\n\nprint((min(Y)))\n","code_v0_loc":8,"code_v1_loc":10,"code_v0_num_chars":180,"code_v1_num_chars":223,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = [int(eval(input())) for i in range(N)]\nB = list(np.argsort(np.array(A)))\nX = [[0, 0], [0, 0]]\nfor i in range(N):\n X[i % 2][B[i] % 2] += 1\nprint((X[0][1]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(eval(input())) for i in range(N)]\nAT = [(A[i], i) for i in range(N)]\nAT.sort()\nB = [AT[i][1] for i in range(N)]\nX = [[0, 0], [0, 0]]\nfor i in range(N):\n X[i % 2][B[i] % 2] += 1\nY = [X[0][1], X[1][0]]\nprint((min(Y)))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import numpy as np","-","-B = list(np.argsort(np.array(A)))","+AT = [(A[i], i) for i in range(N)]","+AT.sort()","+B = [AT[i][1] for i in range(N)]","-print((X[0][1]))","+Y = [X[0][1], X[1][0]]","+print((min(Y)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.1501710873,"measured_runtime_v1":0.2093672077,"runtime_lift":5.4935589007,"key":["s141985189","s196716457"]} +{"user_id":"u597374218","problem_id":"p03796","language":"python","submission_id_v0":"s873197292","submission_id_v1":"s712740845","cpu_time_v0":231,"cpu_time_v1":40,"memory_v0":3980,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.68,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nprint((math.factorial(int(eval(input())))%(10**9+7)))\n\n# optimized version of the same code:\n","target":"ans=1\n\nn=int(eval(input()))\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)","code_v0_loc":2,"code_v1_loc":6,"code_v0_num_chars":58,"code_v1_num_chars":92,"code_v0_no_empty_lines":"import math\n\nprint((math.factorial(int(eval(input()))) % (10**9 + 7)))\n","code_v1_no_empty_lines":"ans = 1\nn = int(eval(input()))\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-import math","-","-print((math.factorial(int(eval(input()))) % (10**9 + 7)))","+ans = 1","+n = int(eval(input()))","+for i in range(1, n + 1):","+ ans *= i","+ ans = ans % (10**9 + 7)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5415332041,"measured_runtime_v1":0.2632789848,"runtime_lift":2.0568797183,"key":["s873197292","s712740845"]} +{"user_id":"u222668979","problem_id":"p02996","language":"python","submission_id_v0":"s000658921","submission_id_v1":"s911267857","cpu_time_v0":791,"cpu_time_v1":572,"memory_v0":38028,"memory_v1":117796,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.69,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(eval(input()))\n\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\n\n\n\ncnt = 0\n\nfor b, a in ab:\n\n cnt += a\n\n if cnt > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nab = [list(map(int, input().split())) for _ in range(n)]\n\nab = sorted(ab, key=lambda x: x[1])\n\n\n\nt = 0\n\nfor a, b in ab:\n\n t += a\n\n if t > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":251,"code_v1_num_chars":226,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn = int(eval(input()))\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\ncnt = 0\nfor b, a in ab:\n cnt += a\n if cnt > b:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\nab = [list(map(int, input().split())) for _ in range(n)]\nab = sorted(ab, key=lambda x: x[1])\nt = 0\nfor a, b in ab:\n t += a\n if t > b:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-import sys","-","-input = sys.stdin.readline","-ab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])","-cnt = 0","-for b, a in ab:","- cnt += a","- if cnt > b:","+ab = [list(map(int, input().split())) for _ in range(n)]","+ab = sorted(ab, key=lambda x: x[1])","+t = 0","+for a, b in ab:","+ t += a","+ if t > b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2345721078,"measured_runtime_v1":0.0064230425,"runtime_lift":36.5204038616,"key":["s000658921","s911267857"]} +{"user_id":"u927807968","problem_id":"p02777","language":"python","submission_id_v0":"s786603084","submission_id_v1":"s913426920","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS, T = input().split()\n\nA, B= list(map(int, input().split()))\n\nU = eval(input())\n\nif S == U:\n\n print((A - 1, B))\n\nelse:\n\n print((A, B - 1))\n\n# optimized version of the same code:\n","target":"S, T = input().split()\n\nA, B= list(map(int, input().split()))\n\nU = eval(input())\n\nif S == U:\n\n A-=1\n\nelse:\n\n B-=1\n\nprint((A,B))","code_v0_loc":7,"code_v1_loc":8,"code_v0_num_chars":129,"code_v1_num_chars":119,"code_v0_no_empty_lines":"S, T = input().split()\nA, B = list(map(int, input().split()))\nU = eval(input())\nif S == U:\n print((A - 1, B))\nelse:\n print((A, B - 1))\n","code_v1_no_empty_lines":"S, T = input().split()\nA, B = list(map(int, input().split()))\nU = eval(input())\nif S == U:\n A -= 1\nelse:\n B -= 1\nprint((A, B))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["- print((A - 1, B))","+ A -= 1","- print((A, B - 1))","+ B -= 1","+print((A, B))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2984414142,"measured_runtime_v1":0.2207367195,"runtime_lift":1.3520243248,"key":["s786603084","s913426920"]} +{"user_id":"u281303342","problem_id":"p03828","language":"python","submission_id_v0":"s909168869","submission_id_v1":"s458659043","cpu_time_v0":68,"cpu_time_v1":27,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\nN = int(eval(input()))\n\ndiv = []\n\nfor i in range(2,N+1):\n\n while i != 1:\n\n for d in range(2,i+1):\n\n while i%d==0:\n\n i = i\/\/d\n\n div.append(d)\n\nC = Counter(div).most_common()\n\nAns = 1\n\nfor k,v in C:\n\n Ans = Ans*(v+1) % (10**9+7)\n\n\n\nprint(Ans)\n\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\nN = int(eval(input()))\n\n\n\nF = [True]*(N+1)\n\nF[0]=F[1]=False\n\nP = []\n\n\n\nfor i in range(2,N+1):\n\n if F[i]==True:\n\n P.append(i)\n\n for j in range(i*2,N+1,i):\n\n F[j]=False\n\n\n\ndic = defaultdict(int)\n\nfor i in range(2,N+1):\n\n for p in P:\n\n while i%p==0:\n\n dic[p] += 1\n\n i = i\/\/p\n\n if i==1:\n\n break\n\n\n\nans = 1\n\nmodulo = 10**9+7\n\nfor v in list(dic.values()):\n\n ans *= (v+1)\n\n ans %= modulo\n\n\n\nprint(ans)","code_v0_loc":15,"code_v1_loc":29,"code_v0_num_chars":322,"code_v1_num_chars":503,"code_v0_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\ndiv = []\nfor i in range(2, N + 1):\n while i != 1:\n for d in range(2, i + 1):\n while i % d == 0:\n i = i \/\/ d\n div.append(d)\nC = Counter(div).most_common()\nAns = 1\nfor k, v in C:\n Ans = Ans * (v + 1) % (10**9 + 7)\nprint(Ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nN = int(eval(input()))\nF = [True] * (N + 1)\nF[0] = F[1] = False\nP = []\nfor i in range(2, N + 1):\n if F[i] == True:\n P.append(i)\n for j in range(i * 2, N + 1, i):\n F[j] = False\ndic = defaultdict(int)\nfor i in range(2, N + 1):\n for p in P:\n while i % p == 0:\n dic[p] += 1\n i = i \/\/ p\n if i == 1:\n break\nans = 1\nmodulo = 10**9 + 7\nfor v in list(dic.values()):\n ans *= v + 1\n ans %= modulo\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":48.275862069,"diff":["-from collections import Counter","+from collections import defaultdict","-div = []","+F = [True] * (N + 1)","+F[0] = F[1] = False","+P = []","- while i != 1:","- for d in range(2, i + 1):","- while i % d == 0:","- i = i \/\/ d","- div.append(d)","-C = Counter(div).most_common()","-Ans = 1","-for k, v in C:","- Ans = Ans * (v + 1) % (10**9 + 7)","-print(Ans)","+ if F[i] == True:","+ P.append(i)","+ for j in range(i * 2, N + 1, i):","+ F[j] = False","+dic = defaultdict(int)","+for i in range(2, N + 1):","+ for p in P:","+ while i % p == 0:","+ dic[p] += 1","+ i = i \/\/ p","+ if i == 1:","+ break","+ans = 1","+modulo = 10**9 + 7","+for v in list(dic.values()):","+ ans *= v + 1","+ ans %= modulo","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3373793194,"measured_runtime_v1":0.2469508071,"runtime_lift":1.3661802664,"key":["s909168869","s458659043"]} +{"user_id":"u426534722","problem_id":"p02245","language":"python","submission_id_v0":"s804728708","submission_id_v1":"s622088378","cpu_time_v0":760,"cpu_time_v1":650,"memory_v0":25996,"memory_v1":31348,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.47,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import deque\n\nfrom copy import deepcopy, copy\n\ndy = [-1, 0, 0, 1]\n\ndx = [0, -1, 1, 0]\n\nN = 3\n\ndef g(i, j, a):\n\n t = a \/\/ (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef MAIN():\n\n m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n goal = ('1', '2', '3', '4', '5', '6', '7', '8', '0')\n\n goal = 123456780\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n print(cnt)\n\n break\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\nMAIN()\n\n\n\n\n# optimized version of the same code:\n","target":"from collections import deque\n\nfrom copy import deepcopy, copy\n\nN = 3\n\ndef g(i, j, a):\n\n if i > j:\n\n i, j = j, i\n\n return a[:i] + a[j] + a[i + 1:j] + a[i] + a[j + 1:]\n\ndef MAIN():\n\n m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = MAP.find(\"0\")\n\n goal = \"123456780\"\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n print(cnt)\n\n break\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\nMAIN()\n\n\n","code_v0_loc":30,"code_v1_loc":27,"code_v0_num_chars":885,"code_v1_num_chars":783,"code_v0_no_empty_lines":"from collections import deque\nfrom copy import deepcopy, copy\n\ndy = [-1, 0, 0, 1]\ndx = [0, -1, 1, 0]\nN = 3\n\n\ndef g(i, j, a):\n t = a \/\/ (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef MAIN():\n m = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n }\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = 8 - MAP.find(\"0\")\n MAP = int(MAP)\n goal = (\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"0\")\n goal = 123456780\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n print(cnt)\n break\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\nMAIN()\n","code_v1_no_empty_lines":"from collections import deque\nfrom copy import deepcopy, copy\n\nN = 3\n\n\ndef g(i, j, a):\n if i > j:\n i, j = j, i\n return a[:i] + a[j] + a[i + 1 : j] + a[i] + a[j + 1 :]\n\n\ndef MAIN():\n m = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n }\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = MAP.find(\"0\")\n goal = \"123456780\"\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n print(cnt)\n break\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\nMAIN()\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-dy = [-1, 0, 0, 1]","-dx = [0, -1, 1, 0]","- t = a \/\/ (10**j) % 10","- return a - t * (10**j) + t * (10**i)","+ if i > j:","+ i, j = j, i","+ return a[:i] + a[j] + a[i + 1 : j] + a[i] + a[j + 1 :]","- start = 8 - MAP.find(\"0\")","- MAP = int(MAP)","- goal = (\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"0\")","- goal = 123456780","+ start = MAP.find(\"0\")","+ goal = \"123456780\""],"diff_only_import_comment":false,"measured_runtime_v0":0.3641724348,"measured_runtime_v1":0.096000421,"runtime_lift":3.7934462245,"key":["s804728708","s622088378"]} +{"user_id":"u556358547","problem_id":"p03416","language":"python","submission_id_v0":"s971943319","submission_id_v1":"s985131399","cpu_time_v0":94,"cpu_time_v1":70,"memory_v0":73744,"memory_v1":64480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n r = \"\".join(reversed(list(s)))\n\n if s == r:\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n # s = str(i)\n\n # r = \"\".join(reversed(list(s)))\n\n # if s == r:\n\n # c += 1\n\n if (i % 10) == (i \/\/ 10000 % 10) and (i \/\/ 10 % 10) == (i \/\/ 1000 % 10):\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":16,"code_v1_loc":18,"code_v0_num_chars":281,"code_v1_num_chars":407,"code_v0_no_empty_lines":"# vim: fileencoding=utf-8\ndef main():\n a, b = list(map(int, input().split()))\n c = 0\n for i in range(a, b + 1):\n s = str(i)\n r = \"\".join(reversed(list(s)))\n if s == r:\n c += 1\n print(c)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# vim: fileencoding=utf-8\ndef main():\n a, b = list(map(int, input().split()))\n c = 0\n for i in range(a, b + 1):\n # s = str(i)\n # r = \"\".join(reversed(list(s)))\n # if s == r:\n # c += 1\n if (i % 10) == (i \/\/ 10000 % 10) and (i \/\/ 10 % 10) == (i \/\/ 1000 % 10):\n c += 1\n print(c)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["- s = str(i)","- r = \"\".join(reversed(list(s)))","- if s == r:","+ # s = str(i)","+ # r = \"\".join(reversed(list(s)))","+ # if s == r:","+ # c += 1","+ if (i % 10) == (i \/\/ 10000 % 10) and (i \/\/ 10 % 10) == (i \/\/ 1000 % 10):"],"diff_only_import_comment":false,"measured_runtime_v0":0.319033144,"measured_runtime_v1":0.2127196875,"runtime_lift":1.4997819327,"key":["s971943319","s985131399"]} +{"user_id":"u764401543","problem_id":"p03371","language":"python","submission_id_v0":"s157366337","submission_id_v1":"s208344914","cpu_time_v0":114,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.09,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float('inf')\n\n\n\nfor i in range(10 ** 5 + 1):\n\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n# ans = float('inf')\n\n\n\n# for i in range(10 ** 5 + 1):\n\n# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\n# print(ans)\n\n\n\nmin_xy = min(X, Y)\n\nmax_xy = max(X, Y)\n\nans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)\n\nans2 = A * X + B * Y\n\nans3 = 2 * C * max_xy\n\nprint((min(ans1, ans2, ans3)))","code_v0_loc":7,"code_v1_loc":14,"code_v0_num_chars":178,"code_v1_num_chars":364,"code_v0_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(10**5 + 1):\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\nprint(ans)\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\n# ans = float('inf')\n# for i in range(10 ** 5 + 1):\n# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n# print(ans)\nmin_xy = min(X, Y)\nmax_xy = max(X, Y)\nans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)\nans2 = A * X + B * Y\nans3 = 2 * C * max_xy\nprint((min(ans1, ans2, ans3)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-ans = float(\"inf\")","-for i in range(10**5 + 1):","- ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)","-print(ans)","+# ans = float('inf')","+# for i in range(10 ** 5 + 1):","+# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)","+# print(ans)","+min_xy = min(X, Y)","+max_xy = max(X, Y)","+ans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)","+ans2 = A * X + B * Y","+ans3 = 2 * C * max_xy","+print((min(ans1, ans2, ans3)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.8766576855,"measured_runtime_v1":0.1948450158,"runtime_lift":4.4992564066,"key":["s157366337","s208344914"]} +{"user_id":"u145231176","problem_id":"p02555","language":"python","submission_id_v0":"s435485475","submission_id_v1":"s123950040","cpu_time_v0":820,"cpu_time_v1":175,"memory_v0":97132,"memory_v1":83224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.66,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef getN():\n\n return int(eval(input()))\n\ndef getNM():\n\n return list(map(int, input().split()))\n\ndef getList():\n\n return list(map(int, input().split()))\n\ndef getArray(intn):\n\n return [int(eval(input())) for i in range(intn)]\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\ndef rand_N(ran1, ran2):\n\n return random.randint(ran1, ran2)\n\ndef rand_List(ran1, ran2, rantime):\n\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n\n ns = []\n\n while len(ns) < rantime:\n\n n = random.randint(ran1, ran2)\n\n if not n in ns:\n\n ns.append(n)\n\n return sorted(ns)\n\n\n\ndef rand_query(ran1, ran2, rantime):\n\n r_query = []\n\n while len(r_query) < rantime:\n\n n_q = rand_ints_nodup(ran1, ran2, 2)\n\n if not n_q in r_query:\n\n r_query.append(n_q)\n\n return sorted(r_query)\n\n\n\nfrom collections import defaultdict, deque, Counter\n\nfrom sys import exit\n\nfrom decimal import *\n\nfrom heapq import heapify, heappop, heappush\n\nimport math\n\nimport random\n\nimport string\n\nfrom copy import deepcopy\n\nfrom itertools import combinations, permutations, product\n\nfrom operator import mul, itemgetter\n\nfrom functools import reduce\n\nfrom bisect import bisect_left, bisect_right\n\n\n\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\nmod = 10 ** 9 + 7\n\n\n\n#############\n\n# Main Code #\n\n#############\n\n\n\nS = getN()\n\n\n\n# \u9006\u5143\u4e8b\u524d\u51e6\u7406ver\n\n# n\u304c\u5c0f\u3055\u3044\u5834\u5408\u306b\n\nlim = 10 ** 5 + 1\n\nfact = [1, 1]\n\nfactinv = [1, 1]\n\ninv = [0, 1]\n\n\n\nfor i in range(2, lim + 1):\n\n fact.append((fact[-1] * i) % mod)\n\n inv.append((-inv[mod % i] * (mod \/\/ i)) % mod)\n\n # \u7d2f\u8a08\n\n factinv.append((factinv[-1] * inv[-1]) % mod)\n\n\n\ndef cmb(n, r):\n\n if (r < 0) or (n < r):\n\n return 0\n\n r = min(r, n - r)\n\n return fact[n] * factinv[r] * factinv[n - r] % mod\n\n\n\nans = 0\n\n# \u9577\u3055N\u306e\u6642\u6700\u4f4e\u3067\u30823 * N\u4f7f\u3046\n\n# \u6b8b\u308a\u306f\u5206\u914d\u3059\u308b\n\nfor i in range(1, 2001):\n\n s = S - (3 * i)\n\n if s < 0:\n\n break\n\n # s\u3092N\u500b\u306b\u5206\u914d\u3059\u308b\u901a\u308a\u304c\u3044\u304f\u3064\u3042\u308b\u304b\n\n # \u91cd\u8907\u7d44\u307f\u5408\u308f\u305b\n\n # \u4ed5\u5207\u308a\u306e\u6570\u306fi - 1\u500b\n\n ans += cmb(s + i - 1, i - 1)\n\nprint((ans % mod))\n\n# optimized version of the same code:\n","target":"def getN():\n\n return int(eval(input()))\n\ndef getNM():\n\n return list(map(int, input().split()))\n\ndef getList():\n\n return list(map(int, input().split()))\n\ndef getArray(intn):\n\n return [int(eval(input())) for i in range(intn)]\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\ndef rand_N(ran1, ran2):\n\n return random.randint(ran1, ran2)\n\ndef rand_List(ran1, ran2, rantime):\n\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n\n ns = []\n\n while len(ns) < rantime:\n\n n = random.randint(ran1, ran2)\n\n if not n in ns:\n\n ns.append(n)\n\n return sorted(ns)\n\n\n\ndef rand_query(ran1, ran2, rantime):\n\n r_query = []\n\n while len(r_query) < rantime:\n\n n_q = rand_ints_nodup(ran1, ran2, 2)\n\n if not n_q in r_query:\n\n r_query.append(n_q)\n\n return sorted(r_query)\n\n\n\nfrom collections import defaultdict, deque, Counter\n\nfrom sys import exit\n\nfrom decimal import *\n\nfrom heapq import heapify, heappop, heappush\n\nimport math\n\nimport random\n\nimport string\n\nfrom copy import deepcopy\n\nfrom itertools import combinations, permutations, product\n\nfrom operator import mul, itemgetter\n\nfrom functools import reduce\n\nfrom bisect import bisect_left, bisect_right\n\n\n\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\nmod = 10 ** 9 + 7\n\n\n\n#############\n\n# Main Code #\n\n#############\n\n\n\nN = getN()\n\nlogk = N.bit_length()\n\n\n\n# \u6f38\u5316\u5f0f\u306b\u3067\u304d\u308b\u306a\u3089\u884c\u5217\u8a08\u7b97\u306b\u843d\u3068\u3057\u8fbc\u3081\u308b\n\n# A[n] = A[n - 1] + A[n - 3]\u306a\u306e\u3067\n\n# [a2, a1, a0] = [0, 0, 1]\n\n# [[1, 1, 0], [0, 0, 1], [1, 0, 0]]\u306eN\u4e57\u3092\u3059\u308c\u3070\n\n# [an+2, an+1, an] \u304c\u51fa\u308b\n\n\n\ndp = [[[0, 0, 0] for i in range(3)] for i in range(logk)]\n\ndp[0] = [\n\n[1, 1, 0],\n\n[0, 0, 1],\n\n[1, 0, 0]\n\n]\n\n\n\n# \u884c\u5217\u639b\u3051\u7b97 O(n3)\u304b\u304b\u308b\n\ndef array_cnt(ar1, ar2):\n\n h = len(ar1)\n\n w = len(ar2[0])\n\n row = ar1\n\n col = []\n\n for j in range(w):\n\n opt = []\n\n for i in range(len(ar2)):\n\n opt.append(ar2[i][j])\n\n col.append(opt)\n\n\n\n res = [[[0, 0] for i in range(w)] for i in range(h)]\n\n for i in range(h):\n\n for j in range(w):\n\n cnt = 0\n\n for x, y in zip(row[i], col[j]):\n\n cnt += x * y\n\n res[i][j] = cnt\n\n res[i][j] %= mod\n\n return res\n\n\n\nfor i in range(1, logk):\n\n dp[i] = array_cnt(dp[i - 1], dp[i - 1])\n\n\n\nans = [[0, 0, 1]]\n\nfor i in range(logk):\n\n if N & (1 << i):\n\n ans = array_cnt(ans, dp[i])\n\nprint((ans[0][2] % mod))","code_v0_loc":84,"code_v1_loc":97,"code_v0_num_chars":2000,"code_v1_num_chars":2372,"code_v0_no_empty_lines":"def getN():\n return int(eval(input()))\n\n\ndef getNM():\n return list(map(int, input().split()))\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\ndef getArray(intn):\n return [int(eval(input())) for i in range(intn)]\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef rand_N(ran1, ran2):\n return random.randint(ran1, ran2)\n\n\ndef rand_List(ran1, ran2, rantime):\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n ns = []\n while len(ns) < rantime:\n n = random.randint(ran1, ran2)\n if not n in ns:\n ns.append(n)\n return sorted(ns)\n\n\ndef rand_query(ran1, ran2, rantime):\n r_query = []\n while len(r_query) < rantime:\n n_q = rand_ints_nodup(ran1, ran2, 2)\n if not n_q in r_query:\n r_query.append(n_q)\n return sorted(r_query)\n\n\nfrom collections import defaultdict, deque, Counter\nfrom sys import exit\nfrom decimal import *\nfrom heapq import heapify, heappop, heappush\nimport math\nimport random\nimport string\nfrom copy import deepcopy\nfrom itertools import combinations, permutations, product\nfrom operator import mul, itemgetter\nfrom functools import reduce\nfrom bisect import bisect_left, bisect_right\nimport sys\n\nsys.setrecursionlimit(1000000000)\nmod = 10**9 + 7\n#############\n# Main Code #\n#############\nS = getN()\n# \u9006\u5143\u4e8b\u524d\u51e6\u7406ver\n# n\u304c\u5c0f\u3055\u3044\u5834\u5408\u306b\nlim = 10**5 + 1\nfact = [1, 1]\nfactinv = [1, 1]\ninv = [0, 1]\nfor i in range(2, lim + 1):\n fact.append((fact[-1] * i) % mod)\n inv.append((-inv[mod % i] * (mod \/\/ i)) % mod)\n # \u7d2f\u8a08\n factinv.append((factinv[-1] * inv[-1]) % mod)\n\n\ndef cmb(n, r):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n - r] % mod\n\n\nans = 0\n# \u9577\u3055N\u306e\u6642\u6700\u4f4e\u3067\u30823 * N\u4f7f\u3046\n# \u6b8b\u308a\u306f\u5206\u914d\u3059\u308b\nfor i in range(1, 2001):\n s = S - (3 * i)\n if s < 0:\n break\n # s\u3092N\u500b\u306b\u5206\u914d\u3059\u308b\u901a\u308a\u304c\u3044\u304f\u3064\u3042\u308b\u304b\n # \u91cd\u8907\u7d44\u307f\u5408\u308f\u305b\n # \u4ed5\u5207\u308a\u306e\u6570\u306fi - 1\u500b\n ans += cmb(s + i - 1, i - 1)\nprint((ans % mod))\n","code_v1_no_empty_lines":"def getN():\n return int(eval(input()))\n\n\ndef getNM():\n return list(map(int, input().split()))\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\ndef getArray(intn):\n return [int(eval(input())) for i in range(intn)]\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef rand_N(ran1, ran2):\n return random.randint(ran1, ran2)\n\n\ndef rand_List(ran1, ran2, rantime):\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n ns = []\n while len(ns) < rantime:\n n = random.randint(ran1, ran2)\n if not n in ns:\n ns.append(n)\n return sorted(ns)\n\n\ndef rand_query(ran1, ran2, rantime):\n r_query = []\n while len(r_query) < rantime:\n n_q = rand_ints_nodup(ran1, ran2, 2)\n if not n_q in r_query:\n r_query.append(n_q)\n return sorted(r_query)\n\n\nfrom collections import defaultdict, deque, Counter\nfrom sys import exit\nfrom decimal import *\nfrom heapq import heapify, heappop, heappush\nimport math\nimport random\nimport string\nfrom copy import deepcopy\nfrom itertools import combinations, permutations, product\nfrom operator import mul, itemgetter\nfrom functools import reduce\nfrom bisect import bisect_left, bisect_right\nimport sys\n\nsys.setrecursionlimit(1000000000)\nmod = 10**9 + 7\n#############\n# Main Code #\n#############\nN = getN()\nlogk = N.bit_length()\n# \u6f38\u5316\u5f0f\u306b\u3067\u304d\u308b\u306a\u3089\u884c\u5217\u8a08\u7b97\u306b\u843d\u3068\u3057\u8fbc\u3081\u308b\n# A[n] = A[n - 1] + A[n - 3]\u306a\u306e\u3067\n# [a2, a1, a0] = [0, 0, 1]\n# [[1, 1, 0], [0, 0, 1], [1, 0, 0]]\u306eN\u4e57\u3092\u3059\u308c\u3070\n# [an+2, an+1, an] \u304c\u51fa\u308b\ndp = [[[0, 0, 0] for i in range(3)] for i in range(logk)]\ndp[0] = [[1, 1, 0], [0, 0, 1], [1, 0, 0]]\n# \u884c\u5217\u639b\u3051\u7b97 O(n3)\u304b\u304b\u308b\ndef array_cnt(ar1, ar2):\n h = len(ar1)\n w = len(ar2[0])\n row = ar1\n col = []\n for j in range(w):\n opt = []\n for i in range(len(ar2)):\n opt.append(ar2[i][j])\n col.append(opt)\n res = [[[0, 0] for i in range(w)] for i in range(h)]\n for i in range(h):\n for j in range(w):\n cnt = 0\n for x, y in zip(row[i], col[j]):\n cnt += x * y\n res[i][j] = cnt\n res[i][j] %= mod\n return res\n\n\nfor i in range(1, logk):\n dp[i] = array_cnt(dp[i - 1], dp[i - 1])\nans = [[0, 0, 1]]\nfor i in range(logk):\n if N & (1 << i):\n ans = array_cnt(ans, dp[i])\nprint((ans[0][2] % mod))\n","code_same":false,"relative_loc_diff_percent":13.4020618557,"diff":["-S = getN()","-# \u9006\u5143\u4e8b\u524d\u51e6\u7406ver","-# n\u304c\u5c0f\u3055\u3044\u5834\u5408\u306b","-lim = 10**5 + 1","-fact = [1, 1]","-factinv = [1, 1]","-inv = [0, 1]","-for i in range(2, lim + 1):","- fact.append((fact[-1] * i) % mod)","- inv.append((-inv[mod % i] * (mod \/\/ i)) % mod)","- # \u7d2f\u8a08","- factinv.append((factinv[-1] * inv[-1]) % mod)","+N = getN()","+logk = N.bit_length()","+# \u6f38\u5316\u5f0f\u306b\u3067\u304d\u308b\u306a\u3089\u884c\u5217\u8a08\u7b97\u306b\u843d\u3068\u3057\u8fbc\u3081\u308b","+# A[n] = A[n - 1] + A[n - 3]\u306a\u306e\u3067","+# [a2, a1, a0] = [0, 0, 1]","+# [[1, 1, 0], [0, 0, 1], [1, 0, 0]]\u306eN\u4e57\u3092\u3059\u308c\u3070","+# [an+2, an+1, an] \u304c\u51fa\u308b","+dp = [[[0, 0, 0] for i in range(3)] for i in range(logk)]","+dp[0] = [[1, 1, 0], [0, 0, 1], [1, 0, 0]]","+# \u884c\u5217\u639b\u3051\u7b97 O(n3)\u304b\u304b\u308b","+def array_cnt(ar1, ar2):","+ h = len(ar1)","+ w = len(ar2[0])","+ row = ar1","+ col = []","+ for j in range(w):","+ opt = []","+ for i in range(len(ar2)):","+ opt.append(ar2[i][j])","+ col.append(opt)","+ res = [[[0, 0] for i in range(w)] for i in range(h)]","+ for i in range(h):","+ for j in range(w):","+ cnt = 0","+ for x, y in zip(row[i], col[j]):","+ cnt += x * y","+ res[i][j] = cnt","+ res[i][j] %= mod","+ return res","-def cmb(n, r):","- if (r < 0) or (n < r):","- return 0","- r = min(r, n - r)","- return fact[n] * factinv[r] * factinv[n - r] % mod","-","-","-ans = 0","-# \u9577\u3055N\u306e\u6642\u6700\u4f4e\u3067\u30823 * N\u4f7f\u3046","-# \u6b8b\u308a\u306f\u5206\u914d\u3059\u308b","-for i in range(1, 2001):","- s = S - (3 * i)","- if s < 0:","- break","- # s\u3092N\u500b\u306b\u5206\u914d\u3059\u308b\u901a\u308a\u304c\u3044\u304f\u3064\u3042\u308b\u304b","- # \u91cd\u8907\u7d44\u307f\u5408\u308f\u305b","- # \u4ed5\u5207\u308a\u306e\u6570\u306fi - 1\u500b","- ans += cmb(s + i - 1, i - 1)","-print((ans % mod))","+for i in range(1, logk):","+ dp[i] = array_cnt(dp[i - 1], dp[i - 1])","+ans = [[0, 0, 1]]","+for i in range(logk):","+ if N & (1 << i):","+ ans = array_cnt(ans, dp[i])","+print((ans[0][2] % mod))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3269546282,"measured_runtime_v1":0.2049855587,"runtime_lift":6.4734054256,"key":["s435485475","s123950040"]} +{"user_id":"u896741788","problem_id":"p03037","language":"python","submission_id_v0":"s129241236","submission_id_v1":"s743438543","cpu_time_v0":355,"cpu_time_v1":218,"memory_v0":7832,"memory_v1":15472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk,m=list(map(int,input().split()))\n\nl=[0 for i in range(k+1)]\n\nfor i in range(m):\n\n a,s=list(map(int,input().split()))\n\n l[a-1]+=1;l[s]-=1\n\nans=0\n\nf=0\n\nfor j in range(k):\n\n l[j]+=f\n\n f=l[j]\n\nprint((len([1 for i in l if i==m])))\n\n# optimized version of the same code:\n","target":"n,m=list(map(int,input().split()))\n\ntable=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n table[l]+=1\n\n table[r+1]-=1\n\nfrom itertools import accumulate\n\nfrom collections import Counter as co\n\nvar=co((accumulate(table)))\n\n\n\nif m not in var:print((0))\n\nelse:print((var[m]))\n\n\n\n\n","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":217,"code_v1_num_chars":290,"code_v0_no_empty_lines":"k, m = list(map(int, input().split()))\nl = [0 for i in range(k + 1)]\nfor i in range(m):\n a, s = list(map(int, input().split()))\n l[a - 1] += 1\n l[s] -= 1\nans = 0\nf = 0\nfor j in range(k):\n l[j] += f\n f = l[j]\nprint((len([1 for i in l if i == m])))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\ntable = [0] * (n + 2)\nfor i in range(m):\n l, r = list(map(int, input().split()))\n table[l] += 1\n table[r + 1] -= 1\nfrom itertools import accumulate\nfrom collections import Counter as co\n\nvar = co((accumulate(table)))\nif m not in var:\n print((0))\nelse:\n print((var[m]))\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-k, m = list(map(int, input().split()))","-l = [0 for i in range(k + 1)]","+n, m = list(map(int, input().split()))","+table = [0] * (n + 2)","- a, s = list(map(int, input().split()))","- l[a - 1] += 1","- l[s] -= 1","-ans = 0","-f = 0","-for j in range(k):","- l[j] += f","- f = l[j]","-print((len([1 for i in l if i == m])))","+ l, r = list(map(int, input().split()))","+ table[l] += 1","+ table[r + 1] -= 1","+from itertools import accumulate","+from collections import Counter as co","+","+var = co((accumulate(table)))","+if m not in var:","+ print((0))","+else:","+ print((var[m]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4122046263,"measured_runtime_v1":0.3202181025,"runtime_lift":1.2872620978,"key":["s129241236","s743438543"]} +{"user_id":"u969850098","problem_id":"p02982","language":"python","submission_id_v0":"s201924324","submission_id_v1":"s693837759","cpu_time_v0":323,"cpu_time_v1":17,"memory_v0":21432,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN, D = list(map(int, input().split()))\n\npoints = [list(map(int, input().split())) for _ in range(N)]\n\ncount = 0\n\nfor i in range(N):\n\n for j in range(N):\n\n if j == i:\n\n continue\n\n dist = np.sqrt(sum([(points[i][d] - points[j][d]) ** 2 for d in range(D)]))\n\n if dist.is_integer():\n\n count += 1\n\nprint((count \/\/ 2))\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef calc_dist(x, y):\n\n dist = 0\n\n for xi, yi in zip(x, y):\n\n dist += (yi - xi) ** 2\n\n return dist ** (1\/2)\n\n\n\n\n\ndef main():\n\n N, D = list(map(int, sys.stdin.readline().rstrip().split()))\n\n X = [list(map(int, sys.stdin.readline().rstrip().split())) for _ in range(N)]\n\n\n\n ans = 0\n\n for i in range(N):\n\n for j in range(i+1, N):\n\n dist = calc_dist(X[i], X[j])\n\n if dist.is_integer():\n\n ans += 1\n\n \n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":13,"code_v1_loc":27,"code_v0_num_chars":372,"code_v1_num_chars":571,"code_v0_no_empty_lines":"import numpy as np\n\nN, D = list(map(int, input().split()))\npoints = [list(map(int, input().split())) for _ in range(N)]\ncount = 0\nfor i in range(N):\n for j in range(N):\n if j == i:\n continue\n dist = np.sqrt(sum([(points[i][d] - points[j][d]) ** 2 for d in range(D)]))\n if dist.is_integer():\n count += 1\nprint((count \/\/ 2))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef calc_dist(x, y):\n dist = 0\n for xi, yi in zip(x, y):\n dist += (yi - xi) ** 2\n return dist ** (1 \/ 2)\n\n\ndef main():\n N, D = list(map(int, sys.stdin.readline().rstrip().split()))\n X = [list(map(int, sys.stdin.readline().rstrip().split())) for _ in range(N)]\n ans = 0\n for i in range(N):\n for j in range(i + 1, N):\n dist = calc_dist(X[i], X[j])\n if dist.is_integer():\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":51.8518518519,"diff":["-import numpy as np","+import sys","-N, D = list(map(int, input().split()))","-points = [list(map(int, input().split())) for _ in range(N)]","-count = 0","-for i in range(N):","- for j in range(N):","- if j == i:","- continue","- dist = np.sqrt(sum([(points[i][d] - points[j][d]) ** 2 for d in range(D)]))","- if dist.is_integer():","- count += 1","-print((count \/\/ 2))","+sys.setrecursionlimit(10**6)","+","+","+def calc_dist(x, y):","+ dist = 0","+ for xi, yi in zip(x, y):","+ dist += (yi - xi) ** 2","+ return dist ** (1 \/ 2)","+","+","+def main():","+ N, D = list(map(int, sys.stdin.readline().rstrip().split()))","+ X = [list(map(int, sys.stdin.readline().rstrip().split())) for _ in range(N)]","+ ans = 0","+ for i in range(N):","+ for j in range(i + 1, N):","+ dist = calc_dist(X[i], X[j])","+ if dist.is_integer():","+ ans += 1","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":1.3888782218,"measured_runtime_v1":0.1985105653,"runtime_lift":6.9964952229,"key":["s201924324","s693837759"]} +{"user_id":"u426764965","problem_id":"p02983","language":"python","submission_id_v0":"s448047238","submission_id_v1":"s995159069","cpu_time_v0":48,"cpu_time_v1":19,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef abc133_c():\n\n L, R = list(map(int, input().split()))\n\n # \u533a\u9593\u306e\u5e45\u304c673\u3042\u308c\u3070\u3001673\u306e\u500d\u6570\u30683\u306e\u500d\u6570\u304c\u542b\u307e\u308c\u3066\u30012019\u306e\u500d\u6570\u304c\u4f5c\u308c\u308b\n\n if R - L > 673: return 0\n\n # \u305d\u308c\u4ee5\u5916\u306f\u8a66\u3059\n\n ans = 2019\n\n for i in range(L, R+1):\n\n for j in range(L, i):\n\n m = i * j % 2019\n\n ans = min(m, ans)\n\n return ans\n\n\n\nprint((abc133_c()))\n\n# optimized version of the same code:\n","target":"def abc133_c():\n\n L, R = list(map(int, input().split()))\n\n # \u533a\u9593\u306e\u5e45\u304c673\u3042\u308c\u3070\u3001673\u306e\u500d\u6570\u30683\u306e\u500d\u6570\u304c\u542b\u307e\u308c\u3066\u30012019\u306e\u500d\u6570\u304c\u4f5c\u308c\u308b\n\n if R - L > 673: return 0\n\n # \u305d\u308c\u4ee5\u5916\u306f\u8a66\u3059\n\n ans = 2019\n\n for i in range(L, R+1):\n\n for j in range(L, i):\n\n m = i * j % 2019\n\n ans = min(m, ans)\n\n if ans == 1: return 1\n\n return ans\n\n\n\nprint((abc133_c()))","code_v0_loc":13,"code_v1_loc":14,"code_v0_num_chars":320,"code_v1_num_chars":355,"code_v0_no_empty_lines":"def abc133_c():\n L, R = list(map(int, input().split()))\n # \u533a\u9593\u306e\u5e45\u304c673\u3042\u308c\u3070\u3001673\u306e\u500d\u6570\u30683\u306e\u500d\u6570\u304c\u542b\u307e\u308c\u3066\u30012019\u306e\u500d\u6570\u304c\u4f5c\u308c\u308b\n if R - L > 673:\n return 0\n # \u305d\u308c\u4ee5\u5916\u306f\u8a66\u3059\n ans = 2019\n for i in range(L, R + 1):\n for j in range(L, i):\n m = i * j % 2019\n ans = min(m, ans)\n return ans\n\n\nprint((abc133_c()))\n","code_v1_no_empty_lines":"def abc133_c():\n L, R = list(map(int, input().split()))\n # \u533a\u9593\u306e\u5e45\u304c673\u3042\u308c\u3070\u3001673\u306e\u500d\u6570\u30683\u306e\u500d\u6570\u304c\u542b\u307e\u308c\u3066\u30012019\u306e\u500d\u6570\u304c\u4f5c\u308c\u308b\n if R - L > 673:\n return 0\n # \u305d\u308c\u4ee5\u5916\u306f\u8a66\u3059\n ans = 2019\n for i in range(L, R + 1):\n for j in range(L, i):\n m = i * j % 2019\n ans = min(m, ans)\n if ans == 1:\n return 1\n return ans\n\n\nprint((abc133_c()))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["+ if ans == 1:","+ return 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.302429297,"measured_runtime_v1":0.2001894107,"runtime_lift":1.5107157566,"key":["s448047238","s995159069"]} +{"user_id":"u025501820","problem_id":"p02792","language":"python","submission_id_v0":"s746150122","submission_id_v1":"s989284284","cpu_time_v0":318,"cpu_time_v1":169,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\ncount = [[0 for _ in range(9)] for _ in range(9)]\n\nfor i in range(1, N + 1):\n\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\n\nans = 0\n\nfor i in range(0, 9):\n\n for k in range(0, 9):\n\n ans += count[i][k] * count[k][i]\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nnums = [0 for i in range(100)]\n\nfor i in range(1, N + 1):\n\n i = str(i)\n\n nums[int(i[0] + i[-1])] += 1\n\nans = 0\n\nfor i in range(1, 10):\n\n for j in range(i, 10):\n\n i = str(i)\n\n j = str(j)\n\n if i != j:\n\n ans += nums[int(i + j)] * nums[int(j + i)] * 2\n\n else:\n\n n = nums[int(i + j)]\n\n ans += n * (n - 1)\n\n ans += n\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":17,"code_v0_num_chars":316,"code_v1_num_chars":421,"code_v0_no_empty_lines":"N = int(eval(input()))\ncount = [[0 for _ in range(9)] for _ in range(9)]\nfor i in range(1, N + 1):\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\nans = 0\nfor i in range(0, 9):\n for k in range(0, 9):\n ans += count[i][k] * count[k][i]\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nnums = [0 for i in range(100)]\nfor i in range(1, N + 1):\n i = str(i)\n nums[int(i[0] + i[-1])] += 1\nans = 0\nfor i in range(1, 10):\n for j in range(i, 10):\n i = str(i)\n j = str(j)\n if i != j:\n ans += nums[int(i + j)] * nums[int(j + i)] * 2\n else:\n n = nums[int(i + j)]\n ans += n * (n - 1)\n ans += n\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":41.1764705882,"diff":["-count = [[0 for _ in range(9)] for _ in range(9)]","+nums = [0 for i in range(100)]","- if str(i)[0] != \"0\" and str(i)[-1] != \"0\":","- count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1","+ i = str(i)","+ nums[int(i[0] + i[-1])] += 1","-for i in range(0, 9):","- for k in range(0, 9):","- ans += count[i][k] * count[k][i]","+for i in range(1, 10):","+ for j in range(i, 10):","+ i = str(i)","+ j = str(j)","+ if i != j:","+ ans += nums[int(i + j)] * nums[int(j + i)] * 2","+ else:","+ n = nums[int(i + j)]","+ ans += n * (n - 1)","+ ans += n"],"diff_only_import_comment":false,"measured_runtime_v0":0.4702084679,"measured_runtime_v1":0.3054097801,"runtime_lift":1.5395985934,"key":["s746150122","s989284284"]} +{"user_id":"u934442292","problem_id":"p02690","language":"python","submission_id_v0":"s609043772","submission_id_v1":"s337405796","cpu_time_v0":74,"cpu_time_v1":53,"memory_v0":9148,"memory_v1":9132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.38,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef main():\n\n X = int(eval(input()))\n\n\n\n for A in range(-200, 201):\n\n for B in range(-200, 201):\n\n if A ** 5 - B ** 5 == X:\n\n print((A, B))\n\n exit()\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef main():\n\n X = int(eval(input()))\n\n\n\n for A in range(-119, 120 + 1):\n\n for B in range(-119, 120 + 1):\n\n if A ** 5 - B ** 5 == X:\n\n print((A, B))\n\n exit()\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":17,"code_v1_loc":17,"code_v0_num_chars":285,"code_v1_num_chars":293,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n X = int(eval(input()))\n for A in range(-200, 201):\n for B in range(-200, 201):\n if A**5 - B**5 == X:\n print((A, B))\n exit()\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n X = int(eval(input()))\n for A in range(-119, 120 + 1):\n for B in range(-119, 120 + 1):\n if A**5 - B**5 == X:\n print((A, B))\n exit()\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for A in range(-200, 201):","- for B in range(-200, 201):","+ for A in range(-119, 120 + 1):","+ for B in range(-119, 120 + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.4475147168,"measured_runtime_v1":0.2975374639,"runtime_lift":1.5040617437,"key":["s609043772","s337405796"]} +{"user_id":"u588341295","problem_id":"p03078","language":"python","submission_id_v0":"s622309249","submission_id_v1":"s171509372","cpu_time_v0":118,"cpu_time_v1":37,"memory_v0":8728,"memory_v1":4976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\nABC=[]\n\nfor i in range(X):\n\n for j in range(Y):\n\n if (i+1)*(j+1)>K:\n\n break\n\n for k in range(Z):\n\n if (i+1)*(j+1)*(k+1)>K:\n\n break\n\n ABC.append(A[i]+B[j]+C[k])\n\nABC.sort(reverse=True)\n\nfor i in range(K):\n\n print((ABC[i]))\n\n\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\nfrom heapq import heappush, heappop\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\n\n\nque=[]\n\nheappush(que, (-(A[0]+B[0]+C[0]), 0, 0, 0))\n\nS={(0,0,0)}\n\nfor i in range(K):\n\n ans=heappop(que)\n\n print((-ans[0]))\n\n a,b,c=ans[1:]\n\n if a+1 K:\n break\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) > K:\n break\n ABC.append(A[i] + B[j] + C[k])\nABC.sort(reverse=True)\nfor i in range(K):\n print((ABC[i]))\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\nfrom heapq import heappush, heappop\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x \/\/ y))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nMOD = 10**9 + 7\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nque = []\nheappush(que, (-(A[0] + B[0] + C[0]), 0, 0, 0))\nS = {(0, 0, 0)}\nfor i in range(K):\n ans = heappop(que)\n print((-ans[0]))\n a, b, c = ans[1:]\n if a + 1 < X and (a + 1, b, c) not in S:\n heappush(que, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))\n S.add((a + 1, b, c))\n if b + 1 < Y and (a, b + 1, c) not in S:\n heappush(que, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))\n S.add((a, b + 1, c))\n if c + 1 < Z and (a, b, c + 1) not in S:\n heappush(que, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))\n S.add((a, b, c + 1))\n","code_same":false,"relative_loc_diff_percent":11.9047619048,"diff":["+from heapq import heappush, heappop","-ABC = []","-for i in range(X):","- for j in range(Y):","- if (i + 1) * (j + 1) > K:","- break","- for k in range(Z):","- if (i + 1) * (j + 1) * (k + 1) > K:","- break","- ABC.append(A[i] + B[j] + C[k])","-ABC.sort(reverse=True)","+que = []","+heappush(que, (-(A[0] + B[0] + C[0]), 0, 0, 0))","+S = {(0, 0, 0)}","- print((ABC[i]))","+ ans = heappop(que)","+ print((-ans[0]))","+ a, b, c = ans[1:]","+ if a + 1 < X and (a + 1, b, c) not in S:","+ heappush(que, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))","+ S.add((a + 1, b, c))","+ if b + 1 < Y and (a, b + 1, c) not in S:","+ heappush(que, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))","+ S.add((a, b + 1, c))","+ if c + 1 < Z and (a, b, c + 1) not in S:","+ heappush(que, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))","+ S.add((a, b, c + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2840606916,"measured_runtime_v1":0.2124910862,"runtime_lift":1.3368122711,"key":["s622309249","s171509372"]} +{"user_id":"u216928054","problem_id":"p02560","language":"python","submission_id_v0":"s978863609","submission_id_v1":"s598945859","cpu_time_v0":297,"cpu_time_v1":234,"memory_v0":78412,"memory_v1":70336,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.21,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a \/\/ m) \/\/ 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b \/\/ m)\n\n b %= m\n\n y_max = (a * n + b) \/\/ m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) \/\/ a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum_1(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a \/\/ m) \/\/ 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b \/\/ m)\n\n b %= m\n\n y_max = (a * n + b) \/\/ m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) \/\/ a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n while True:\n\n if a >= m:\n\n ret += (n - 1) * n * (a \/\/ m) \/\/ 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b \/\/ m)\n\n b %= m\n\n y_max = (a * n + b) \/\/ m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) \/\/ a) * y_max\n\n n = y_max\n\n m, a, b = a, m, (a - x_max % a) % a\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n","code_v0_loc":87,"code_v1_loc":105,"code_v0_num_chars":1613,"code_v1_num_chars":2066,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\nsys.setrecursionlimit(10**6)\nINF = 10**9 + 1 # sys.maxsize # float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef floor_sum(n, m, a, b):\n ret = 0\n if a >= m:\n ret += (n - 1) * n * (a \/\/ m) \/\/ 2\n a %= m\n if b >= m:\n ret += n * (b \/\/ m)\n b %= m\n y_max = (a * n + b) \/\/ m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) \/\/ a) * y_max\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n return ret\n\n\ndef debug(*x):\n print(*x, file=sys.stderr)\n\n\ndef solve(SOLVE_PARAMS):\n pass\n\n\ndef main():\n # parse input\n T = int(input())\n for _t in range(T):\n N, M, A, B = map(int, input().split())\n print(floor_sum(N, M, A, B))\n\n\n# tests\nT1 = \"\"\"\n5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n\"\"\"\nTEST_T1 = \"\"\"\n>>> as_input(T1)\n>>> main()\n3\n13\n0\n314095480\n499999999500000000\n\"\"\"\n\n\ndef _test():\n import doctest\n\n doctest.testmod()\n g = globals()\n for k in sorted(g):\n if k.startswith(\"TEST_\"):\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\ndef as_input(s):\n \"use in test, use given string as input file\"\n import io\n\n f = io.StringIO(s.strip())\n g = globals()\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\ninput = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nif sys.argv[-1] == \"-t\":\n print(\"testing\")\n _test()\n sys.exit()\nmain()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\nsys.setrecursionlimit(10**6)\nINF = 10**9 + 1 # sys.maxsize # float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef floor_sum_1(n, m, a, b):\n ret = 0\n if a >= m:\n ret += (n - 1) * n * (a \/\/ m) \/\/ 2\n a %= m\n if b >= m:\n ret += n * (b \/\/ m)\n b %= m\n y_max = (a * n + b) \/\/ m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) \/\/ a) * y_max\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n return ret\n\n\ndef floor_sum(n, m, a, b):\n ret = 0\n while True:\n if a >= m:\n ret += (n - 1) * n * (a \/\/ m) \/\/ 2\n a %= m\n if b >= m:\n ret += n * (b \/\/ m)\n b %= m\n y_max = (a * n + b) \/\/ m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) \/\/ a) * y_max\n n = y_max\n m, a, b = a, m, (a - x_max % a) % a\n\n\ndef debug(*x):\n print(*x, file=sys.stderr)\n\n\ndef solve(SOLVE_PARAMS):\n pass\n\n\ndef main():\n # parse input\n T = int(input())\n for _t in range(T):\n N, M, A, B = map(int, input().split())\n print(floor_sum(N, M, A, B))\n\n\n# tests\nT1 = \"\"\"\n5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n\"\"\"\nTEST_T1 = \"\"\"\n>>> as_input(T1)\n>>> main()\n3\n13\n0\n314095480\n499999999500000000\n\"\"\"\n\n\ndef _test():\n import doctest\n\n doctest.testmod()\n g = globals()\n for k in sorted(g):\n if k.startswith(\"TEST_\"):\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\ndef as_input(s):\n \"use in test, use given string as input file\"\n import io\n\n f = io.StringIO(s.strip())\n g = globals()\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\ninput = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nif sys.argv[-1] == \"-t\":\n print(\"testing\")\n _test()\n sys.exit()\nmain()\n","code_same":false,"relative_loc_diff_percent":17.1428571429,"diff":["-def floor_sum(n, m, a, b):","+def floor_sum_1(n, m, a, b):","+","+","+def floor_sum(n, m, a, b):","+ ret = 0","+ while True:","+ if a >= m:","+ ret += (n - 1) * n * (a \/\/ m) \/\/ 2","+ a %= m","+ if b >= m:","+ ret += n * (b \/\/ m)","+ b %= m","+ y_max = (a * n + b) \/\/ m","+ x_max = y_max * m - b","+ if y_max == 0:","+ return ret","+ ret += (n - (x_max + a - 1) \/\/ a) * y_max","+ n = y_max","+ m, a, b = a, m, (a - x_max % a) % a"],"diff_only_import_comment":false,"measured_runtime_v0":0.1788789105,"measured_runtime_v1":0.0066359096,"runtime_lift":26.9562007629,"key":["s978863609","s598945859"]} +{"user_id":"u595289165","problem_id":"p03060","language":"python","submission_id_v0":"s881584489","submission_id_v1":"s205765913","cpu_time_v0":149,"cpu_time_v1":17,"memory_v0":12508,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn = int(eval(input()))\n\nvalue = np.array(tuple(map(int, input().split())))\n\ncost = np.array(tuple(map(int, input().split())))\n\nxy = value - cost\n\nans = 0\n\nfor i in range(n):\n\n if xy[i] < 0:\n\n continue\n\n else:\n\n ans += xy[i]\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nvalue = tuple(map(int, input().split()))\n\ncost = tuple(map(int, input().split()))\n\n# i\u3053\u3081\u307e\u3067\u306ex\u30fcy\u306e\u6700\u5927\u5024\n\ninf = -100\n\ndp = [inf] * (n+1)\n\ndp[1] = max(0, value[0]-cost[0])\n\nfor i in range(2, n+1):\n\n dp[i] = max(dp[i-1], dp[i-1]+value[i-1]-cost[i-1])\n\n\n\nprint((dp[n]))\n","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":269,"code_v1_num_chars":280,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nvalue = np.array(tuple(map(int, input().split())))\ncost = np.array(tuple(map(int, input().split())))\nxy = value - cost\nans = 0\nfor i in range(n):\n if xy[i] < 0:\n continue\n else:\n ans += xy[i]\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nvalue = tuple(map(int, input().split()))\ncost = tuple(map(int, input().split()))\n# i\u3053\u3081\u307e\u3067\u306ex\u30fcy\u306e\u6700\u5927\u5024\ninf = -100\ndp = [inf] * (n + 1)\ndp[1] = max(0, value[0] - cost[0])\nfor i in range(2, n + 1):\n dp[i] = max(dp[i - 1], dp[i - 1] + value[i - 1] - cost[i - 1])\nprint((dp[n]))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import numpy as np","-","-value = np.array(tuple(map(int, input().split())))","-cost = np.array(tuple(map(int, input().split())))","-xy = value - cost","-ans = 0","-for i in range(n):","- if xy[i] < 0:","- continue","- else:","- ans += xy[i]","-print(ans)","+value = tuple(map(int, input().split()))","+cost = tuple(map(int, input().split()))","+# i\u3053\u3081\u307e\u3067\u306ex\u30fcy\u306e\u6700\u5927\u5024","+inf = -100","+dp = [inf] * (n + 1)","+dp[1] = max(0, value[0] - cost[0])","+for i in range(2, n + 1):","+ dp[i] = max(dp[i - 1], dp[i - 1] + value[i - 1] - cost[i - 1])","+print((dp[n]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4092471268,"measured_runtime_v1":0.2268988938,"runtime_lift":6.2109034687,"key":["s881584489","s205765913"]} +{"user_id":"u442877951","problem_id":"p02881","language":"python","submission_id_v0":"s498895748","submission_id_v1":"s605488454","cpu_time_v0":574,"cpu_time_v1":295,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nN = int(eval(input()))\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = math.ceil(N\/(i+1))\n\n if (1+i)*j == N:\n\n ans = min(i+j-1,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = N\/\/i\n\n if i*j == N:\n\n ans = min(i+j-2,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":217,"code_v1_num_chars":186,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nans = 10**12\nfor i in range(1, 10**6 + 1):\n j = math.ceil(N \/ (i + 1))\n if (1 + i) * j == N:\n ans = min(i + j - 1, ans)\n if i == 10**6 and ans == 10**12:\n ans = N - 1\n break\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nans = 10**12\nfor i in range(1, 10**6 + 1):\n j = N \/\/ i\n if i * j == N:\n ans = min(i + j - 2, ans)\n if i == 10**6 and ans == 10**12:\n ans = N - 1\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-import math","-","- j = math.ceil(N \/ (i + 1))","- if (1 + i) * j == N:","- ans = min(i + j - 1, ans)","+ j = N \/\/ i","+ if i * j == N:","+ ans = min(i + j - 2, ans)"],"diff_only_import_comment":false,"measured_runtime_v0":3.3566168053,"measured_runtime_v1":2.0076369724,"runtime_lift":1.6719241832,"key":["s498895748","s605488454"]} +{"user_id":"u951601135","problem_id":"p03434","language":"python","submission_id_v0":"s638983666","submission_id_v1":"s443344147","cpu_time_v0":149,"cpu_time_v1":17,"memory_v0":12504,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nvalue = list(map(int,input().split()))\n\nvalue=np.sort(value)[::-1]\n\n#print(N,value)\n\na = np.sum(value[::2])\n\nb = np.sum(value[1::2])\n\nprint((a-b))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na = sorted(list(map(int, input().split())), reverse=True)\n\nprint((sum(a[::2]) - sum(a[1::2])))\n","code_v0_loc":8,"code_v1_loc":3,"code_v0_num_chars":182,"code_v1_num_chars":111,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nvalue = list(map(int, input().split()))\nvalue = np.sort(value)[::-1]\n# print(N,value)\na = np.sum(value[::2])\nb = np.sum(value[1::2])\nprint((a - b))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = sorted(list(map(int, input().split())), reverse=True)\nprint((sum(a[::2]) - sum(a[1::2])))\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-import numpy as np","-","-N = int(eval(input()))","-value = list(map(int, input().split()))","-value = np.sort(value)[::-1]","-# print(N,value)","-a = np.sum(value[::2])","-b = np.sum(value[1::2])","-print((a - b))","+n = int(eval(input()))","+a = sorted(list(map(int, input().split())), reverse=True)","+print((sum(a[::2]) - sum(a[1::2])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3596615281,"measured_runtime_v1":0.1847207425,"runtime_lift":7.3606326496,"key":["s638983666","s443344147"]} +{"user_id":"u864197622","problem_id":"p02758","language":"python","submission_id_v0":"s598598719","submission_id_v1":"s066197035","cpu_time_v0":1348,"cpu_time_v1":954,"memory_v0":102564,"memory_v1":97192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.23,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nmod = 998244353\n\nN = int(eval(input()))\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nmod = 998244353\n\nN = int(eval(input()))\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))","code_v0_loc":32,"code_v1_loc":35,"code_v0_num_chars":675,"code_v1_num_chars":717,"code_v0_no_empty_lines":"mod = 998244353\nN = int(eval(input()))\nX = []\nfor _ in range(N):\n x, d = list(map(int, input().split()))\n X.append((x, x + d))\nX = sorted(X, key=lambda x: x[0])\nL = [(0, -(10**9 + 1), 10**9 + 1)]\nP = [-1] * (N + 1)\nfor i, (x, y) in enumerate(X):\n while L[-1][2] <= y:\n if L[-1][2] > x and P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.pop()\n if P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.append((i + 1, x, y))\nC = [[] for _ in range(N + 1)]\nfor i, p in enumerate(P):\n if p >= 0:\n C[p].append(i)\nY = [1] * (N + 1)\nfor i in range(N + 1)[::-1]:\n s = 1\n for j in C[i]:\n s = s * (Y[j] + 1) % mod\n Y[i] = s\nprint((Y[0]))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nmod = 998244353\nN = int(eval(input()))\nX = []\nfor _ in range(N):\n x, d = list(map(int, input().split()))\n X.append((x, x + d))\nX = sorted(X, key=lambda x: x[0])\nL = [(0, -(10**9 + 1), 10**9 + 1)]\nP = [-1] * (N + 1)\nfor i, (x, y) in enumerate(X):\n while L[-1][2] <= y:\n if L[-1][2] > x and P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.pop()\n if P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.append((i + 1, x, y))\nC = [[] for _ in range(N + 1)]\nfor i, p in enumerate(P):\n if p >= 0:\n C[p].append(i)\nY = [1] * (N + 1)\nfor i in range(N + 1)[::-1]:\n s = 1\n for j in C[i]:\n s = s * (Y[j] + 1) % mod\n Y[i] = s\nprint((Y[0]))\n","code_same":false,"relative_loc_diff_percent":8.5714285714,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.2547301891,"measured_runtime_v1":0.0065454967,"runtime_lift":38.9168615134,"key":["s598598719","s066197035"]} +{"user_id":"u539692012","problem_id":"p02622","language":"python","submission_id_v0":"s511745855","submission_id_v1":"s953276742","cpu_time_v0":78,"cpu_time_v1":44,"memory_v0":68212,"memory_v1":9464,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nprint((sum(si != ti for si, ti in zip(eval(input()), eval(input())))))\n\n\n# optimized version of the same code:\n","target":"print((sum(a!=b for a,b in zip(*open(0)))))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":57,"code_v1_num_chars":41,"code_v0_no_empty_lines":"print((sum(si != ti for si, ti in zip(eval(input()), eval(input())))))\n","code_v1_no_empty_lines":"print((sum(a != b for a, b in zip(*open(0)))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((sum(si != ti for si, ti in zip(eval(input()), eval(input())))))","+print((sum(a != b for a, b in zip(*open(0)))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3334237881,"measured_runtime_v1":0.1220404458,"runtime_lift":2.7320761232,"key":["s511745855","s953276742"]} +{"user_id":"u739959951","problem_id":"p02994","language":"python","submission_id_v0":"s666163340","submission_id_v1":"s556555369","cpu_time_v0":150,"cpu_time_v1":17,"memory_v0":12500,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,a=list(map(int,input().split()))\n\n\n\nl=[a+i-1 for i in range(1,n+1)]\n\n\n\nimport numpy as np\n\nb=min(np.abs(l))\n\n\n\nif b==0:\n\n l.remove(0)\n\nelif b in l:\n\n l.remove(b)\n\nelif -b in l:\n\n l.remove(-b)\n\n \n\nprint((sum(l)))\n\n# optimized version of the same code:\n","target":"n,a=list(map(int,input().split()))\n\n\n\napples=[a+i for i in range(n)]\n\neat=min(apples,key=lambda x:abs(x))\n\nres=sum(apples)-eat\n\n\n\nprint(res)","code_v0_loc":15,"code_v1_loc":7,"code_v0_num_chars":209,"code_v1_num_chars":134,"code_v0_no_empty_lines":"n, a = list(map(int, input().split()))\nl = [a + i - 1 for i in range(1, n + 1)]\nimport numpy as np\n\nb = min(np.abs(l))\nif b == 0:\n l.remove(0)\nelif b in l:\n l.remove(b)\nelif -b in l:\n l.remove(-b)\nprint((sum(l)))\n","code_v1_no_empty_lines":"n, a = list(map(int, input().split()))\napples = [a + i for i in range(n)]\neat = min(apples, key=lambda x: abs(x))\nres = sum(apples) - eat\nprint(res)\n","code_same":false,"relative_loc_diff_percent":53.3333333333,"diff":["-l = [a + i - 1 for i in range(1, n + 1)]","-import numpy as np","-","-b = min(np.abs(l))","-if b == 0:","- l.remove(0)","-elif b in l:","- l.remove(b)","-elif -b in l:","- l.remove(-b)","-print((sum(l)))","+apples = [a + i for i in range(n)]","+eat = min(apples, key=lambda x: abs(x))","+res = sum(apples) - eat","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":1.1117280972,"measured_runtime_v1":0.1730254316,"runtime_lift":6.4252294396,"key":["s666163340","s556555369"]} +{"user_id":"u540631540","problem_id":"p02767","language":"python","submission_id_v0":"s304816826","submission_id_v1":"s138180908","cpu_time_v0":22,"cpu_time_v1":19,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n # else:\n\n # break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n else:\n\n break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":269,"code_v1_num_chars":265,"code_v0_no_empty_lines":"n = int(eval(input()))\nx = [int(i) for i in input().split()]\np = 10000000\nfor i in range(100):\n pi = 0\n for j in range(n):\n pi += (x[j] - (i + 1)) ** 2\n if pi < p:\n p = pi\n # else:\n # break\n # p[i] += (x[j]-(i+1))**2\nprint(p)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nx = [int(i) for i in input().split()]\np = 10000000\nfor i in range(100):\n pi = 0\n for j in range(n):\n pi += (x[j] - (i + 1)) ** 2\n if pi < p:\n p = pi\n else:\n break\n # p[i] += (x[j]-(i+1))**2\nprint(p)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- # else:","- # break","- # p[i] += (x[j]-(i+1))**2","+ else:","+ break","+ # p[i] += (x[j]-(i+1))**2"],"diff_only_import_comment":false,"measured_runtime_v0":0.18753242,"measured_runtime_v1":0.0060767163,"runtime_lift":30.860815536,"key":["s304816826","s138180908"]} +{"user_id":"u994988729","problem_id":"p03575","language":"python","submission_id_v0":"s496930898","submission_id_v1":"s370133718","cpu_time_v0":237,"cpu_time_v1":22,"memory_v0":16952,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.72,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\nimport numpy as np\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\n\n\nN, M = list(map(int, input().split()))\n\nAB = []\n\nedge = np.zeros((N, N), dtype=int)\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n AB.append((a, b))\n\n edge[a][b] = 1\n\n edge[b][a] = 1\n\n\n\nans = 0\n\nfor i in range(M):\n\n graph = np.copy(edge)\n\n a, b = AB[i]\n\n graph[a][b] = 0\n\n graph[b][a] = 0\n\n fw = floyd_warshall(graph)\n\n if fw.max() > 10000:\n\n ans += 1\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\n\n\nclass UF_tree:\n\n def __init__(self, n):\n\n self.root = [-1] * (n + 1) # -1\u306a\u3089\u305d\u306e\u30ce\u30fc\u30c9\u304c\u6839,\u3067\u7d76\u5bfe\u5024\u304c\u6728\u306e\u8981\u7d20\u6570\n\n self.rank = [0] * (n + 1)\n\n\n\n def find(self, x): # x\u306e\u6839\u3068\u306a\u308b\u8981\u7d20\u756a\u53f7\u3092\u8fd4\u3059\n\n if self.root[x] < 0:\n\n return x\n\n else:\n\n self.root[x] = self.find(self.root[x])\n\n return self.root[x]\n\n\n\n def isSame(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def unite(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:\n\n return\n\n elif self.rank[x] < self.rank[y]:\n\n self.root[y] += self.root[x]\n\n self.root[x] = y\n\n else:\n\n self.root[x] += self.root[y]\n\n self.root[y] = x\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n\n\n def getNodeLen(self, x):\n\n return -self.root[self.find(x)]\n\n\n\n\n\nif __name__ == \"__main__\":\n\n N, M = list(map(int, input().split()))\n\n AB = tuple(tuple(map(int, input().split())) for _ in range(M))\n\n\n\n ans = 0\n\n for i in range(M):\n\n uf = UF_tree(N)\n\n for j, (a, b) in enumerate(AB):\n\n if i == j:\n\n continue\n\n uf.unite(a, b)\n\n a, b = AB[i]\n\n if not uf.isSame(a, b):\n\n ans += 1\n\n print(ans)","code_v0_loc":28,"code_v1_loc":53,"code_v0_num_chars":544,"code_v1_num_chars":1385,"code_v0_no_empty_lines":"from scipy.sparse.csgraph import floyd_warshall\nimport numpy as np\nimport sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nAB = []\nedge = np.zeros((N, N), dtype=int)\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n AB.append((a, b))\n edge[a][b] = 1\n edge[b][a] = 1\nans = 0\nfor i in range(M):\n graph = np.copy(edge)\n a, b = AB[i]\n graph[a][b] = 0\n graph[b][a] = 0\n fw = floyd_warshall(graph)\n if fw.max() > 10000:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nsys.setrecursionlimit(10**7)\n\n\nclass UF_tree:\n def __init__(self, n):\n self.root = [-1] * (n + 1) # -1\u306a\u3089\u305d\u306e\u30ce\u30fc\u30c9\u304c\u6839,\u3067\u7d76\u5bfe\u5024\u304c\u6728\u306e\u8981\u7d20\u6570\n self.rank = [0] * (n + 1)\n\n def find(self, x): # x\u306e\u6839\u3068\u306a\u308b\u8981\u7d20\u756a\u53f7\u3092\u8fd4\u3059\n if self.root[x] < 0:\n return x\n else:\n self.root[x] = self.find(self.root[x])\n return self.root[x]\n\n def isSame(self, x, y):\n return self.find(x) == self.find(y)\n\n def unite(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n elif self.rank[x] < self.rank[y]:\n self.root[y] += self.root[x]\n self.root[x] = y\n else:\n self.root[x] += self.root[y]\n self.root[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n def getNodeLen(self, x):\n return -self.root[self.find(x)]\n\n\nif __name__ == \"__main__\":\n N, M = list(map(int, input().split()))\n AB = tuple(tuple(map(int, input().split())) for _ in range(M))\n ans = 0\n for i in range(M):\n uf = UF_tree(N)\n for j, (a, b) in enumerate(AB):\n if i == j:\n continue\n uf.unite(a, b)\n a, b = AB[i]\n if not uf.isSame(a, b):\n ans += 1\n print(ans)\n","code_same":false,"relative_loc_diff_percent":47.1698113208,"diff":["-from scipy.sparse.csgraph import floyd_warshall","-import numpy as np","-input = sys.stdin.readline","-N, M = list(map(int, input().split()))","-AB = []","-edge = np.zeros((N, N), dtype=int)","-for _ in range(M):","- a, b = list(map(int, input().split()))","- a -= 1","- b -= 1","- AB.append((a, b))","- edge[a][b] = 1","- edge[b][a] = 1","-ans = 0","-for i in range(M):","- graph = np.copy(edge)","- a, b = AB[i]","- graph[a][b] = 0","- graph[b][a] = 0","- fw = floyd_warshall(graph)","- if fw.max() > 10000:","- ans += 1","-print(ans)","+input = sys.stdin.buffer.readline","+sys.setrecursionlimit(10**7)","+","+","+class UF_tree:","+ def __init__(self, n):","+ self.root = [-1] * (n + 1) # -1\u306a\u3089\u305d\u306e\u30ce\u30fc\u30c9\u304c\u6839,\u3067\u7d76\u5bfe\u5024\u304c\u6728\u306e\u8981\u7d20\u6570","+ self.rank = [0] * (n + 1)","+","+ def find(self, x): # x\u306e\u6839\u3068\u306a\u308b\u8981\u7d20\u756a\u53f7\u3092\u8fd4\u3059","+ if self.root[x] < 0:","+ return x","+ else:","+ self.root[x] = self.find(self.root[x])","+ return self.root[x]","+","+ def isSame(self, x, y):","+ return self.find(x) == self.find(y)","+","+ def unite(self, x, y):","+ x = self.find(x)","+ y = self.find(y)","+ if x == y:","+ return","+ elif self.rank[x] < self.rank[y]:","+ self.root[y] += self.root[x]","+ self.root[x] = y","+ else:","+ self.root[x] += self.root[y]","+ self.root[y] = x","+ if self.rank[x] == self.rank[y]:","+ self.rank[x] += 1","+","+ def getNodeLen(self, x):","+ return -self.root[self.find(x)]","+","+","+if __name__ == \"__main__\":","+ N, M = list(map(int, input().split()))","+ AB = tuple(tuple(map(int, input().split())) for _ in range(M))","+ ans = 0","+ for i in range(M):","+ uf = UF_tree(N)","+ for j, (a, b) in enumerate(AB):","+ if i == j:","+ continue","+ uf.unite(a, b)","+ a, b = AB[i]","+ if not uf.isSame(a, b):","+ ans += 1","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.9811262887,"measured_runtime_v1":0.2078541028,"runtime_lift":9.5313311664,"key":["s496930898","s370133718"]} +{"user_id":"u314837274","problem_id":"p03680","language":"python","submission_id_v0":"s559205616","submission_id_v1":"s048885906","cpu_time_v0":239,"cpu_time_v1":97,"memory_v0":15992,"memory_v1":15984,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.41,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN=int(eval(input()))\n\n\n\n\n\na = []\n\n\n\nfor i in range(N):\n\n a.append(int(eval(input())))\n\n# a=[0]*N\n\n# for i in range(N):\n\n# a[i]=int(input())\n\ncount=0\n\n\n\n#loop\u306e\u5b9a\u7fa9\u2192\u540c\u3058\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u7528\u3057\u305f\u3089loop\u5224\u5b9a\n\n#in \u306e\u51e6\u7406\u3092\u7206\u901f\u3067\u5b9f\u884c\u3059\u308b\u305f\u3081\u306bset\u3092\u4f7f\u7528\u3059\u308b\n\n#loop=[]\n\nloop=set()\n\n\n\ntmp=1\n\nwhile True: \n\n tmp=a[tmp-1]\n\n count+=1\n\n if tmp==2:\n\n print(count)\n\n exit()\n\n if tmp-1 in loop:\n\n print((-1))\n\n exit()\n\n #loop.append(tmp-1)\n\n loop.add(tmp-1)\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\n#\u8907\u6570\u884c\u306e\u5165\u529b\u3092\u9ad8\u901f\u5316\n\n#a=[0]*N\n\n#for i in range(N):\n\n# a[i]=int(input())\n\nimport sys\n\na=[int(i) for i in sys.stdin]\n\n\n\ncount=0\n\n\n\n#loop\u306e\u5b9a\u7fa9\u2192\u540c\u3058\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u7528\u3057\u305f\u3089loop\u5224\u5b9a\n\n#in \u306e\u51e6\u7406\u3092\u7206\u901f\u3067\u5b9f\u884c\u3059\u308b\u305f\u3081\u306bset\u3092\u4f7f\u7528\u3059\u308b\n\n#loop=[]\n\nloop=set()\n\n\n\ntmp=1\n\nwhile True: \n\n tmp=a[tmp-1]\n\n count+=1\n\n if tmp==2:\n\n print(count)\n\n exit()\n\n if tmp-1 in loop:\n\n print((-1))\n\n exit()\n\n #loop.append(tmp-1)\n\n loop.add(tmp-1)","code_v0_loc":29,"code_v1_loc":27,"code_v0_num_chars":410,"code_v1_num_chars":403,"code_v0_no_empty_lines":"N = int(eval(input()))\na = []\nfor i in range(N):\n a.append(int(eval(input())))\n# a=[0]*N\n# for i in range(N):\n# a[i]=int(input())\ncount = 0\n# loop\u306e\u5b9a\u7fa9\u2192\u540c\u3058\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u7528\u3057\u305f\u3089loop\u5224\u5b9a\n# in \u306e\u51e6\u7406\u3092\u7206\u901f\u3067\u5b9f\u884c\u3059\u308b\u305f\u3081\u306bset\u3092\u4f7f\u7528\u3059\u308b\n# loop=[]\nloop = set()\ntmp = 1\nwhile True:\n tmp = a[tmp - 1]\n count += 1\n if tmp == 2:\n print(count)\n exit()\n if tmp - 1 in loop:\n print((-1))\n exit()\n # loop.append(tmp-1)\n loop.add(tmp - 1)\n","code_v1_no_empty_lines":"N = int(eval(input()))\n# \u8907\u6570\u884c\u306e\u5165\u529b\u3092\u9ad8\u901f\u5316\n# a=[0]*N\n# for i in range(N):\n# a[i]=int(input())\nimport sys\n\na = [int(i) for i in sys.stdin]\ncount = 0\n# loop\u306e\u5b9a\u7fa9\u2192\u540c\u3058\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u7528\u3057\u305f\u3089loop\u5224\u5b9a\n# in \u306e\u51e6\u7406\u3092\u7206\u901f\u3067\u5b9f\u884c\u3059\u308b\u305f\u3081\u306bset\u3092\u4f7f\u7528\u3059\u308b\n# loop=[]\nloop = set()\ntmp = 1\nwhile True:\n tmp = a[tmp - 1]\n count += 1\n if tmp == 2:\n print(count)\n exit()\n if tmp - 1 in loop:\n print((-1))\n exit()\n # loop.append(tmp-1)\n loop.add(tmp - 1)\n","code_same":false,"relative_loc_diff_percent":6.8965517241,"diff":["-a = []","-for i in range(N):","- a.append(int(eval(input())))","+# \u8907\u6570\u884c\u306e\u5165\u529b\u3092\u9ad8\u901f\u5316","-# a[i]=int(input())","+# a[i]=int(input())","+import sys","+","+a = [int(i) for i in sys.stdin]"],"diff_only_import_comment":false,"measured_runtime_v0":0.214360534,"measured_runtime_v1":0.0060836313,"runtime_lift":35.2356222521,"key":["s559205616","s048885906"]} +{"user_id":"u867069435","problem_id":"p03494","language":"python","submission_id_v0":"s169961096","submission_id_v1":"s264260313","cpu_time_v0":335,"cpu_time_v1":17,"memory_v0":20580,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.93,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn = int(eval(input()))\n\nballs = np.array(list(map(int, input().split())))\n\ntime = 0\n\nwhile np.all(balls % 2 == 0) and np.all(balls > 0):\n\n time += 1\n\n balls = balls \/ 2\n\nprint(time)\n\n# optimized version of the same code:\n","target":"import math\n\nn = eval(input())\n\na = list(map(int, input().split()))\n\nans = float(\"inf\")\n\nfor i in a:\n\n ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1)\n\nprint((round(ans)))","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":201,"code_v1_num_chars":170,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nballs = np.array(list(map(int, input().split())))\ntime = 0\nwhile np.all(balls % 2 == 0) and np.all(balls > 0):\n time += 1\n balls = balls \/ 2\nprint(time)\n","code_v1_no_empty_lines":"import math\n\nn = eval(input())\na = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in a:\n ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1)\nprint((round(ans)))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import numpy as np","+import math","-n = int(eval(input()))","-balls = np.array(list(map(int, input().split())))","-time = 0","-while np.all(balls % 2 == 0) and np.all(balls > 0):","- time += 1","- balls = balls \/ 2","-print(time)","+n = eval(input())","+a = list(map(int, input().split()))","+ans = float(\"inf\")","+for i in a:","+ ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1)","+print((round(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3781843102,"measured_runtime_v1":0.2403370705,"runtime_lift":5.7343809154,"key":["s169961096","s264260313"]} +{"user_id":"u316386814","problem_id":"p03608","language":"python","submission_id_v0":"s433890015","submission_id_v1":"s895796017","cpu_time_v0":713,"cpu_time_v1":509,"memory_v0":13028,"memory_v1":13576,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, m, r = list(map(int, input().split()))\n\nrs = list(map(int, input().split()))\n\n# construct map\n\nimport numpy as np\n\ndists = np.ones((n + 1, n + 1)) * float('inf')\n\nfor _ in range(m):\n\n a, b, c = list(map(int, input().split()))\n\n dists[a, b] = dists[b, a] = c\n\nfor i in range(1, n + 1):\n\n dists[i, i] = 0\n\n\n\nfrom itertools import product, permutations\n\nfor i, j in product(list(range(1, 1 + n)), repeat=2):\n\n dists[j] = np.minimum(dists[j], dists[i] + dists[j, i])\n\n\n\nans = float('inf')\n\nfor path in permutations(rs):\n\n val = sum(dists[i, j] for i, j in zip(path, path[1:]))\n\n val = int(val)\n\n if val < ans:\n\n ans = val\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n, m, r = list(map(int, input().split()))\n\nrs = list(map(int, input().split()))\n\n# construct map\n\nimport numpy as np\n\ndists = np.ones((n + 1, n + 1)) * float('inf')\n\nfor _ in range(m):\n\n a, b, c = list(map(int, input().split()))\n\n dists[a, b] = dists[b, a] = c\n\nfor i in range(1, n + 1):\n\n dists[i, i] = 0\n\n\n\nfrom itertools import permutations\n\nfor i in range(1, 1 + n):\n\n dists = np.minimum(dists, dists[i: i + 1] + dists[:, i: i + 1])\n\n\n\nans = float('inf')\n\nfor path in permutations(rs):\n\n val = sum(dists[i, j] for i, j in zip(path, path[1:]))\n\n val = int(val)\n\n if val < ans:\n\n ans = val\n\n\n\nprint(ans)","code_v0_loc":23,"code_v1_loc":23,"code_v0_num_chars":656,"code_v1_num_chars":633,"code_v0_no_empty_lines":"n, m, r = list(map(int, input().split()))\nrs = list(map(int, input().split()))\n# construct map\nimport numpy as np\n\ndists = np.ones((n + 1, n + 1)) * float(\"inf\")\nfor _ in range(m):\n a, b, c = list(map(int, input().split()))\n dists[a, b] = dists[b, a] = c\nfor i in range(1, n + 1):\n dists[i, i] = 0\nfrom itertools import product, permutations\n\nfor i, j in product(list(range(1, 1 + n)), repeat=2):\n dists[j] = np.minimum(dists[j], dists[i] + dists[j, i])\nans = float(\"inf\")\nfor path in permutations(rs):\n val = sum(dists[i, j] for i, j in zip(path, path[1:]))\n val = int(val)\n if val < ans:\n ans = val\nprint(ans)\n","code_v1_no_empty_lines":"n, m, r = list(map(int, input().split()))\nrs = list(map(int, input().split()))\n# construct map\nimport numpy as np\n\ndists = np.ones((n + 1, n + 1)) * float(\"inf\")\nfor _ in range(m):\n a, b, c = list(map(int, input().split()))\n dists[a, b] = dists[b, a] = c\nfor i in range(1, n + 1):\n dists[i, i] = 0\nfrom itertools import permutations\n\nfor i in range(1, 1 + n):\n dists = np.minimum(dists, dists[i : i + 1] + dists[:, i : i + 1])\nans = float(\"inf\")\nfor path in permutations(rs):\n val = sum(dists[i, j] for i, j in zip(path, path[1:]))\n val = int(val)\n if val < ans:\n ans = val\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-from itertools import product, permutations","+from itertools import permutations","-for i, j in product(list(range(1, 1 + n)), repeat=2):","- dists[j] = np.minimum(dists[j], dists[i] + dists[j, i])","+for i in range(1, 1 + n):","+ dists = np.minimum(dists, dists[i : i + 1] + dists[:, i : i + 1])"],"diff_only_import_comment":false,"measured_runtime_v0":1.845153213,"measured_runtime_v1":0.7010826969,"runtime_lift":2.6318624338,"key":["s433890015","s895796017"]} +{"user_id":"u297574184","problem_id":"p02792","language":"python","submission_id_v0":"s401307257","submission_id_v1":"s179676165","cpu_time_v0":236,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.37,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef solve():\n\n N = int(eval(input()))\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, 5):\n\n for i in range(10**d):\n\n j = x*10**(d+1) + i*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n else:\n\n break\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for A in range(1, N+1):\n\n ss = str(A)\n\n ans += numss[int(ss[-1])][int(ss[0])]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n\n\n# optimized version of the same code:\n","target":"def solve():\n\n strN = eval(input())\n\n N = int(strN)\n\n\n\n maxD = len(strN)\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, maxD-2):\n\n num += 10**d\n\n if maxD-2 > 0:\n\n if x < int(strN[0]):\n\n num += 10**(maxD-2)\n\n elif x == int(strN[0]):\n\n num += int(strN[1:-1]) + 1\n\n if y > int(strN[-1]):\n\n num -= 1\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += numss[i][j]*numss[j][i]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n","code_v0_loc":32,"code_v1_loc":37,"code_v0_num_chars":778,"code_v1_num_chars":917,"code_v0_no_empty_lines":"def solve():\n N = int(eval(input()))\n numss = [[0] * (10) for _ in range(10)]\n for x in range(1, 10):\n for y in range(1, 10):\n num = 0\n for d in range(1, 5):\n for i in range(10**d):\n j = x * 10 ** (d + 1) + i * 10 + y\n if 1 <= j <= N:\n num += 1\n else:\n break\n j = x * 10 + y\n if 1 <= j <= N:\n num += 1\n if x == y:\n j = x\n if 1 <= j <= N:\n num += 1\n numss[x][y] = num\n ans = 0\n for A in range(1, N + 1):\n ss = str(A)\n ans += numss[int(ss[-1])][int(ss[0])]\n print(ans)\n\n\nsolve()\n","code_v1_no_empty_lines":"def solve():\n strN = eval(input())\n N = int(strN)\n maxD = len(strN)\n numss = [[0] * (10) for _ in range(10)]\n for x in range(1, 10):\n for y in range(1, 10):\n num = 0\n for d in range(1, maxD - 2):\n num += 10**d\n if maxD - 2 > 0:\n if x < int(strN[0]):\n num += 10 ** (maxD - 2)\n elif x == int(strN[0]):\n num += int(strN[1:-1]) + 1\n if y > int(strN[-1]):\n num -= 1\n j = x * 10 + y\n if 1 <= j <= N:\n num += 1\n if x == y:\n j = x\n if 1 <= j <= N:\n num += 1\n numss[x][y] = num\n ans = 0\n for i in range(1, 10):\n for j in range(1, 10):\n ans += numss[i][j] * numss[j][i]\n print(ans)\n\n\nsolve()\n","code_same":false,"relative_loc_diff_percent":13.5135135135,"diff":["- N = int(eval(input()))","+ strN = eval(input())","+ N = int(strN)","+ maxD = len(strN)","- for d in range(1, 5):","- for i in range(10**d):","- j = x * 10 ** (d + 1) + i * 10 + y","- if 1 <= j <= N:","- num += 1","- else:","- break","+ for d in range(1, maxD - 2):","+ num += 10**d","+ if maxD - 2 > 0:","+ if x < int(strN[0]):","+ num += 10 ** (maxD - 2)","+ elif x == int(strN[0]):","+ num += int(strN[1:-1]) + 1","+ if y > int(strN[-1]):","+ num -= 1","- for A in range(1, N + 1):","- ss = str(A)","- ans += numss[int(ss[-1])][int(ss[0])]","+ for i in range(1, 10):","+ for j in range(1, 10):","+ ans += numss[i][j] * numss[j][i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.3220527915,"measured_runtime_v1":0.2179562147,"runtime_lift":1.4776031599,"key":["s401307257","s179676165"]} +{"user_id":"u777923818","problem_id":"p03086","language":"python","submission_id_v0":"s716593637","submission_id_v1":"s955967436","cpu_time_v0":22,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\nfrom collections import deque\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nS = eval(input())\n\nA = set(\"ATCG\")\n\nans = 0\n\nmode = 0\n\nfor i, s in enumerate(S):\n\n if s in A:\n\n if mode == 0:\n\n mode = 1\n\n start = i\n\n else:\n\n if mode == 1:\n\n ans = max(i - start, ans)\n\n mode = 0\n\nif mode == 1:\n\n ans = max(len(S) - start, ans)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"def inpl(): return list(map(int, input().split()))\n\nS = eval(input())\n\nC = set(\"ACGT\")\n\n\n\ntmp = 0\n\nans = 0\n\n\n\nfor s in S:\n\n if s in C:\n\n tmp += 1\n\n else:\n\n ans = max(ans, tmp)\n\n tmp = 0\n\nans = max(ans, tmp)\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":15,"code_v0_num_chars":426,"code_v1_num_chars":239,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nfrom collections import deque\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\nS = eval(input())\nA = set(\"ATCG\")\nans = 0\nmode = 0\nfor i, s in enumerate(S):\n if s in A:\n if mode == 0:\n mode = 1\n start = i\n else:\n if mode == 1:\n ans = max(i - start, ans)\n mode = 0\nif mode == 1:\n ans = max(len(S) - start, ans)\nprint(ans)\n","code_v1_no_empty_lines":"def inpl():\n return list(map(int, input().split()))\n\n\nS = eval(input())\nC = set(\"ACGT\")\ntmp = 0\nans = 0\nfor s in S:\n if s in C:\n tmp += 1\n else:\n ans = max(ans, tmp)\n tmp = 0\nans = max(ans, tmp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-# -*- coding: utf-8 -*-","-from collections import deque","-","-","-A = set(\"ATCG\")","+C = set(\"ACGT\")","+tmp = 0","-mode = 0","-for i, s in enumerate(S):","- if s in A:","- if mode == 0:","- mode = 1","- start = i","+for s in S:","+ if s in C:","+ tmp += 1","- if mode == 1:","- ans = max(i - start, ans)","- mode = 0","-if mode == 1:","- ans = max(len(S) - start, ans)","+ ans = max(ans, tmp)","+ tmp = 0","+ans = max(ans, tmp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1640799,"measured_runtime_v1":0.006362747,"runtime_lift":25.7875884356,"key":["s716593637","s955967436"]} +{"user_id":"u678167152","problem_id":"p02574","language":"python","submission_id_v0":"s474626212","submission_id_v1":"s470012575","cpu_time_v0":803,"cpu_time_v1":363,"memory_v0":216812,"memory_v1":219860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nimport numba\n\nfrom numba import njit, b1, i4, i8, f8\n\n\n\n@njit((i8, i8[:]), cache=True)\n\ndef main(N,A):\n\n Amax = np.max(A)\n\n lis = np.zeros(Amax+1, np.int64)\n\n for i in range(N):\n\n lis[A[i]] += 1\n\n setwise = False\n\n for t in range(2,Amax+1):\n\n cnt = np.sum(lis[t:Amax+1:t])\n\n if cnt==N:\n\n return 'not'\n\n if 2<=cntb:\n\n return a\n\n else: \n\n return b\n\n \n\nfor i in range(1, n+1):\n\n a, b, c = list(map(int, input().split()))\n\n # a\n\n dp[i][0] = cmax(dp[i-1][1]+a, dp[i-1][2]+a)\n\n # b\n\n dp[i][1] = cmax(dp[i-1][0]+b, dp[i-1][2]+b)\n\n # c\n\n dp[i][2] = cmax(dp[i-1][0]+c, dp[i-1][1]+c)\n\n\n\nprint((int(max(dp[i,:]))))\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\n# Your code here!\n\n\n\n\n\nN = int(eval(input()))\n\n\n\ndp = [[0]*3 for _ in range(N+1)]\n\n\n\nfor i in range(1, N+1):\n\n a, b, c = list(map(int, input().split()))\n\n dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a\n\n dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b\n\n dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c\n\n \n\nprint((max(dp[N])))","code_v0_loc":22,"code_v1_loc":15,"code_v0_num_chars":438,"code_v1_num_chars":329,"code_v0_no_empty_lines":"# coding: utf-8\nimport numpy as np\n\nn = int(eval(input()))\ndp = np.zeros((n + 10, 3))\n\n\ndef cmax(a, b):\n if a > b:\n return a\n else:\n return b\n\n\nfor i in range(1, n + 1):\n a, b, c = list(map(int, input().split()))\n # a\n dp[i][0] = cmax(dp[i - 1][1] + a, dp[i - 1][2] + a)\n # b\n dp[i][1] = cmax(dp[i - 1][0] + b, dp[i - 1][2] + b)\n # c\n dp[i][2] = cmax(dp[i - 1][0] + c, dp[i - 1][1] + c)\nprint((int(max(dp[i, :]))))\n","code_v1_no_empty_lines":"# coding: utf-8\n# Your code here!\nN = int(eval(input()))\ndp = [[0] * 3 for _ in range(N + 1)]\nfor i in range(1, N + 1):\n a, b, c = list(map(int, input().split()))\n dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a\n dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b\n dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c\nprint((max(dp[N])))\n","code_same":false,"relative_loc_diff_percent":31.8181818182,"diff":["-import numpy as np","-","-n = int(eval(input()))","-dp = np.zeros((n + 10, 3))","-","-","-def cmax(a, b):","- if a > b:","- return a","- else:","- return b","-","-","-for i in range(1, n + 1):","+# Your code here!","+N = int(eval(input()))","+dp = [[0] * 3 for _ in range(N + 1)]","+for i in range(1, N + 1):","- # a","- dp[i][0] = cmax(dp[i - 1][1] + a, dp[i - 1][2] + a)","- # b","- dp[i][1] = cmax(dp[i - 1][0] + b, dp[i - 1][2] + b)","- # c","- dp[i][2] = cmax(dp[i - 1][0] + c, dp[i - 1][1] + c)","-print((int(max(dp[i, :]))))","+ dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a","+ dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b","+ dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c","+print((max(dp[N])))"],"diff_only_import_comment":false,"measured_runtime_v0":2.3404879334,"measured_runtime_v1":0.3881756427,"runtime_lift":6.0294559362,"key":["s853720576","s353209478"]} +{"user_id":"u762420987","problem_id":"p03060","language":"python","submission_id_v0":"s726202703","submission_id_v1":"s079907574","cpu_time_v0":334,"cpu_time_v1":17,"memory_v0":21668,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nVlist = np.array(list(map(int,input().split())))\n\nClist = np.array(list(map(int,input().split())))\n\n\n\nDlist = Vlist-Clist\n\n\n\nsum_ = 0\n\nfor d in Dlist:\n\n if d >= 0:\n\n sum_ += d\n\n\n\nprint(sum_)\n\n\n# optimized version of the same code:\n","target":"# \u5165\u529b\n\nN = int(eval(input()))\n\nVlist = list(map(int, input().split()))\n\nClist = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor i in range(N):\n\n Z = Vlist[i] - Clist[i]\n\n if Z > 0:\n\n ans += Z\n\n\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":239,"code_v1_num_chars":212,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nVlist = np.array(list(map(int, input().split())))\nClist = np.array(list(map(int, input().split())))\nDlist = Vlist - Clist\nsum_ = 0\nfor d in Dlist:\n if d >= 0:\n sum_ += d\nprint(sum_)\n","code_v1_no_empty_lines":"# \u5165\u529b\nN = int(eval(input()))\nVlist = list(map(int, input().split()))\nClist = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n Z = Vlist[i] - Clist[i]\n if Z > 0:\n ans += Z\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-import numpy as np","-","+# \u5165\u529b","-Vlist = np.array(list(map(int, input().split())))","-Clist = np.array(list(map(int, input().split())))","-Dlist = Vlist - Clist","-sum_ = 0","-for d in Dlist:","- if d >= 0:","- sum_ += d","-print(sum_)","+Vlist = list(map(int, input().split()))","+Clist = list(map(int, input().split()))","+ans = 0","+for i in range(N):","+ Z = Vlist[i] - Clist[i]","+ if Z > 0:","+ ans += Z","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.6892928483,"measured_runtime_v1":0.2294992757,"runtime_lift":7.3607763826,"key":["s726202703","s079907574"]} +{"user_id":"u506858457","problem_id":"p02780","language":"python","submission_id_v0":"s008520493","submission_id_v1":"s067462181","cpu_time_v0":1402,"cpu_time_v1":232,"memory_v0":34008,"memory_v1":71792,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.45,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN,K=list(map(int,input().split()))\n\nP=list(map(int,input().split()))\n\nQ=[0]\n\ndef ex(A):\n\n return (1+A)\/2.0\n\nfor i in range(N):\n\n Q.append(ex(P[i]))\n\nQ=np.array(Q)\n\nR=Q.cumsum()\n\nans=0\n\nfor i in range(K,N+1):\n\n S=R[i]-R[i-K]\n\n if ans= 0:\n\n dp[i][j] = min(dp[i-1][j-v] + w, dp[i-1][j])\n\n else:\n\n dp[i][j] = dp[i-1][j]\n\nfor v in range(MAX_V, -1, -1):\n\n if dp[N][v] <= W:\n\n break\n\nprint(v)","code_v0_loc":20,"code_v1_loc":19,"code_v0_num_chars":514,"code_v1_num_chars":528,"code_v0_no_empty_lines":"import numpy as np\n\nN, W = list(map(int, input().split()))\nitems = []\nfor _ in range(N):\n items.append(tuple(map(int, input().split())))\nv_max = sum([i[1] for i in items])\nINF = 10**12\ndp = np.array([[INF for j in range(v_max + 1)] for _ in range(N + 1)])\ndp[0, 0] = 0\nfor i in range(1, N + 1):\n w, v = items[i - 1]\n dp[i, :v] = dp[i - 1, :v]\n dp[i, v:] = np.minimum(dp[i - 1, :-v] + w, dp[i - 1, v:])\nans = 0\nfor v in range(v_max, -1, -1):\n if dp[N][v] <= W:\n ans = v\n break\nprint(ans)\n","code_v1_no_empty_lines":"N, W = list(map(int, input().split()))\nitems = []\nINF = 10**12\nfor _ in range(N):\n items.append(tuple(map(int, input().split())))\nMAX_V = sum([v for _, v in items])\ndp = [[INF for j in range(MAX_V + 1)] for i in range(N + 1)]\ndp[0][0] = 0\nfor i in range(1, N + 1):\n w, v = items[i - 1]\n for j in range(MAX_V + 1):\n if j - v >= 0:\n dp[i][j] = min(dp[i - 1][j - v] + w, dp[i - 1][j])\n else:\n dp[i][j] = dp[i - 1][j]\nfor v in range(MAX_V, -1, -1):\n if dp[N][v] <= W:\n break\nprint(v)\n","code_same":false,"relative_loc_diff_percent":5.0,"diff":["-import numpy as np","-","+INF = 10**12","-v_max = sum([i[1] for i in items])","-INF = 10**12","-dp = np.array([[INF for j in range(v_max + 1)] for _ in range(N + 1)])","-dp[0, 0] = 0","+MAX_V = sum([v for _, v in items])","+dp = [[INF for j in range(MAX_V + 1)] for i in range(N + 1)]","+dp[0][0] = 0","- dp[i, :v] = dp[i - 1, :v]","- dp[i, v:] = np.minimum(dp[i - 1, :-v] + w, dp[i - 1, v:])","-ans = 0","-for v in range(v_max, -1, -1):","+ for j in range(MAX_V + 1):","+ if j - v >= 0:","+ dp[i][j] = min(dp[i - 1][j - v] + w, dp[i - 1][j])","+ else:","+ dp[i][j] = dp[i - 1][j]","+for v in range(MAX_V, -1, -1):","- ans = v","-print(ans)","+print(v)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3271882429,"measured_runtime_v1":0.2112405212,"runtime_lift":6.2828298063,"key":["s932824364","s969626696"]} +{"user_id":"u372144784","problem_id":"p02850","language":"python","submission_id_v0":"s665504655","submission_id_v1":"s801203655","cpu_time_v0":438,"cpu_time_v1":244,"memory_v0":79580,"memory_v1":98504,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(readline())\n\nAB = [list(map(int,readline().split())) for i in range(N-1)]\n\n\n\ngraph = [[] for _ in range(N+1)] #\u96a3\u63a5\u30ea\u30b9\u30c8\n\nfor a,b in AB:\n\n graph[a].append(b)\n\n graph[b].append(a)\n\n\n\n#\u89aa\u306e\u30ce\u30fc\u30c9\u306b\u5b50\u3092\u5165\u308c\u3066\u304fdfs\n\nstack = [1]\n\nparent = [0]*(N+1)\n\norder = []\n\nwhile stack:\n\n x = stack.pop()\n\n order.append(x)\n\n for i in graph[x]:\n\n if i == parent[x]:\n\n continue\n\n parent[i] = x\n\n stack.append(i)\n\n\n\n#\u5404\u5b50\u306e\u8272\u3092\u6c7a\u3081\u3066\u3044\u304f\u3002\n\ncolor = [-1]*(N+1)\n\nfor x in order:\n\n ng = color[x]\n\n c = 1\n\n for y in graph[x]:\n\n if parent[x] == y:\n\n continue\n\n if c == ng:\n\n c += 1\n\n color[y] = c\n\n c += 1\n\n\n\nans = []\n\nfor a,b in AB:\n\n if parent[a] == b: #\u5b50\u306e\u9802\u70b9\u306e\u8272\u3092\u5165\u308c\u308b\n\n ans.append(color[a])\n\n else:\n\n ans.append(color[b])\n\n\n\nprint((max(ans)))\n\nfor i in ans:\n\n print(i)\n\n \n\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom collections import deque\n\nreadline = sys.stdin.buffer.readline\n\ndef even(n): return 1 if n%2==0 else 0\n\nn = int(readline())\n\ng = [[] for _ in range(n)] #\u96a3\u63a5\u30ea\u30b9\u30c8\n\nab = []\n\nfor i in range(n-1):\n\n a,b = list(map(int,readline().split()))\n\n a,b = a-1,b-1\n\n ab.append((a,b))\n\n g[a].append(b)\n\n g[b].append(a)\n\n\n\nroot = 0\n\nparent = [0]*n\n\ndeq = deque([root])\n\norder = [root]\n\n\n\ncolor = [-1]*n\n\ndeq = deque([root])\n\nwhile deq:\n\n fr = deq.pop()\n\n ng = color[fr]\n\n c = 0\n\n for go in g[fr]:\n\n if go == parent[fr]:\n\n continue\n\n if c == ng:\n\n c += 1\n\n parent[go] = fr\n\n color[go] = c\n\n c += 1\n\n deq.append(go)\n\n order.append(go)\n\nrank = [0]*n\n\nfor i,j in enumerate(order):\n\n rank[j] = i\n\nprint((max(color)+1))\n\nfor a,b in ab:\n\n if rank[a] < rank[b]:\n\n print((color[b]+1))\n\n else:\n\n print((color[a]+1))","code_v0_loc":50,"code_v1_loc":44,"code_v0_num_chars":983,"code_v1_num_chars":912,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nAB = [list(map(int, readline().split())) for i in range(N - 1)]\ngraph = [[] for _ in range(N + 1)] # \u96a3\u63a5\u30ea\u30b9\u30c8\nfor a, b in AB:\n graph[a].append(b)\n graph[b].append(a)\n# \u89aa\u306e\u30ce\u30fc\u30c9\u306b\u5b50\u3092\u5165\u308c\u3066\u304fdfs\nstack = [1]\nparent = [0] * (N + 1)\norder = []\nwhile stack:\n x = stack.pop()\n order.append(x)\n for i in graph[x]:\n if i == parent[x]:\n continue\n parent[i] = x\n stack.append(i)\n# \u5404\u5b50\u306e\u8272\u3092\u6c7a\u3081\u3066\u3044\u304f\u3002\ncolor = [-1] * (N + 1)\nfor x in order:\n ng = color[x]\n c = 1\n for y in graph[x]:\n if parent[x] == y:\n continue\n if c == ng:\n c += 1\n color[y] = c\n c += 1\nans = []\nfor a, b in AB:\n if parent[a] == b: # \u5b50\u306e\u9802\u70b9\u306e\u8272\u3092\u5165\u308c\u308b\n ans.append(color[a])\n else:\n ans.append(color[b])\nprint((max(ans)))\nfor i in ans:\n print(i)\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque\n\nreadline = sys.stdin.buffer.readline\n\n\ndef even(n):\n return 1 if n % 2 == 0 else 0\n\n\nn = int(readline())\ng = [[] for _ in range(n)] # \u96a3\u63a5\u30ea\u30b9\u30c8\nab = []\nfor i in range(n - 1):\n a, b = list(map(int, readline().split()))\n a, b = a - 1, b - 1\n ab.append((a, b))\n g[a].append(b)\n g[b].append(a)\nroot = 0\nparent = [0] * n\ndeq = deque([root])\norder = [root]\ncolor = [-1] * n\ndeq = deque([root])\nwhile deq:\n fr = deq.pop()\n ng = color[fr]\n c = 0\n for go in g[fr]:\n if go == parent[fr]:\n continue\n if c == ng:\n c += 1\n parent[go] = fr\n color[go] = c\n c += 1\n deq.append(go)\n order.append(go)\nrank = [0] * n\nfor i, j in enumerate(order):\n rank[j] = i\nprint((max(color) + 1))\nfor a, b in ab:\n if rank[a] < rank[b]:\n print((color[b] + 1))\n else:\n print((color[a] + 1))\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["+from collections import deque","-read = sys.stdin.buffer.read","-readlines = sys.stdin.buffer.readlines","-N = int(readline())","-AB = [list(map(int, readline().split())) for i in range(N - 1)]","-graph = [[] for _ in range(N + 1)] # \u96a3\u63a5\u30ea\u30b9\u30c8","-for a, b in AB:","- graph[a].append(b)","- graph[b].append(a)","-# \u89aa\u306e\u30ce\u30fc\u30c9\u306b\u5b50\u3092\u5165\u308c\u3066\u304fdfs","-stack = [1]","-parent = [0] * (N + 1)","-order = []","-while stack:","- x = stack.pop()","- order.append(x)","- for i in graph[x]:","- if i == parent[x]:","- continue","- parent[i] = x","- stack.append(i)","-# \u5404\u5b50\u306e\u8272\u3092\u6c7a\u3081\u3066\u3044\u304f\u3002","-color = [-1] * (N + 1)","-for x in order:","- ng = color[x]","- c = 1","- for y in graph[x]:","- if parent[x] == y:","+","+","+def even(n):","+ return 1 if n % 2 == 0 else 0","+","+","+n = int(readline())","+g = [[] for _ in range(n)] # \u96a3\u63a5\u30ea\u30b9\u30c8","+ab = []","+for i in range(n - 1):","+ a, b = list(map(int, readline().split()))","+ a, b = a - 1, b - 1","+ ab.append((a, b))","+ g[a].append(b)","+ g[b].append(a)","+root = 0","+parent = [0] * n","+deq = deque([root])","+order = [root]","+color = [-1] * n","+deq = deque([root])","+while deq:","+ fr = deq.pop()","+ ng = color[fr]","+ c = 0","+ for go in g[fr]:","+ if go == parent[fr]:","- color[y] = c","+ parent[go] = fr","+ color[go] = c","-ans = []","-for a, b in AB:","- if parent[a] == b: # \u5b50\u306e\u9802\u70b9\u306e\u8272\u3092\u5165\u308c\u308b","- ans.append(color[a])","+ deq.append(go)","+ order.append(go)","+rank = [0] * n","+for i, j in enumerate(order):","+ rank[j] = i","+print((max(color) + 1))","+for a, b in ab:","+ if rank[a] < rank[b]:","+ print((color[b] + 1))","- ans.append(color[b])","-print((max(ans)))","-for i in ans:","- print(i)","+ print((color[a] + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4448740935,"measured_runtime_v1":0.3325786669,"runtime_lift":1.3376507208,"key":["s665504655","s801203655"]} +{"user_id":"u094191970","problem_id":"p03575","language":"python","submission_id_v0":"s633729388","submission_id_v1":"s318413779","cpu_time_v0":213,"cpu_time_v1":33,"memory_v0":15412,"memory_v1":3436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.51,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom copy import deepcopy\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\nn,m=list(map(int,input().split()))\n\nl=[list(map(int,input().split())) for i in range(m)]\n\n\n\ncnt=0\n\nfor i in range(m):\n\n ll=deepcopy(l)\n\n del ll[i]\n\n\n\n d=[[float('inf')]*n for i in range(n)]\n\n for i in range(n):\n\n d[i][i]=0\n\n\n\n for a,b in ll:\n\n a-=1\n\n b-=1\n\n d[a][b]=1\n\n d[b][a]=1\n\n\n\n s=floyd_warshall(d)\n\n for i in s:\n\n if float('inf') in i:\n\n cnt+=1\n\n break\n\n\n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"from collections import deque\n\nfrom copy import deepcopy\n\n\n\nn,m=list(map(int,input().split()))\n\nl=[list(map(int,input().split())) for i in range(m)]\n\n\n\ndef BFS(m):\n\n t_l=deepcopy(l)\n\n del t_l[m]\n\n\n\n tree=[[] for j in range(n)]\n\n for a,b in t_l:\n\n a-=1\n\n b-=1\n\n tree[a].append(b)\n\n tree[b].append(a)\n\n\n\n dist=[-1 for i in range(n)]\n\n dist[0]=0\n\n\n\n que=deque()\n\n que.append(0)\n\n\n\n while que:\n\n x=que.popleft()\n\n for i in tree[x]:\n\n if dist[i]==-1:\n\n que.append(i)\n\n dist[i]=dist[x]+1\n\n\n\n return dist\n\n\n\nans=0\n\nfor i in range(m):\n\n d=BFS(i)\n\n if -1 in d:\n\n ans+=1\n\n\n\nprint(ans)","code_v0_loc":28,"code_v1_loc":39,"code_v0_num_chars":479,"code_v1_num_chars":620,"code_v0_no_empty_lines":"from copy import deepcopy\nfrom scipy.sparse.csgraph import floyd_warshall\n\nn, m = list(map(int, input().split()))\nl = [list(map(int, input().split())) for i in range(m)]\ncnt = 0\nfor i in range(m):\n ll = deepcopy(l)\n del ll[i]\n d = [[float(\"inf\")] * n for i in range(n)]\n for i in range(n):\n d[i][i] = 0\n for a, b in ll:\n a -= 1\n b -= 1\n d[a][b] = 1\n d[b][a] = 1\n s = floyd_warshall(d)\n for i in s:\n if float(\"inf\") in i:\n cnt += 1\n break\nprint(cnt)\n","code_v1_no_empty_lines":"from collections import deque\nfrom copy import deepcopy\n\nn, m = list(map(int, input().split()))\nl = [list(map(int, input().split())) for i in range(m)]\n\n\ndef BFS(m):\n t_l = deepcopy(l)\n del t_l[m]\n tree = [[] for j in range(n)]\n for a, b in t_l:\n a -= 1\n b -= 1\n tree[a].append(b)\n tree[b].append(a)\n dist = [-1 for i in range(n)]\n dist[0] = 0\n que = deque()\n que.append(0)\n while que:\n x = que.popleft()\n for i in tree[x]:\n if dist[i] == -1:\n que.append(i)\n dist[i] = dist[x] + 1\n return dist\n\n\nans = 0\nfor i in range(m):\n d = BFS(i)\n if -1 in d:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":28.2051282051,"diff":["+from collections import deque","-from scipy.sparse.csgraph import floyd_warshall","-cnt = 0","-for i in range(m):","- ll = deepcopy(l)","- del ll[i]","- d = [[float(\"inf\")] * n for i in range(n)]","- for i in range(n):","- d[i][i] = 0","- for a, b in ll:","+","+","+def BFS(m):","+ t_l = deepcopy(l)","+ del t_l[m]","+ tree = [[] for j in range(n)]","+ for a, b in t_l:","- d[a][b] = 1","- d[b][a] = 1","- s = floyd_warshall(d)","- for i in s:","- if float(\"inf\") in i:","- cnt += 1","- break","-print(cnt)","+ tree[a].append(b)","+ tree[b].append(a)","+ dist = [-1 for i in range(n)]","+ dist[0] = 0","+ que = deque()","+ que.append(0)","+ while que:","+ x = que.popleft()","+ for i in tree[x]:","+ if dist[i] == -1:","+ que.append(i)","+ dist[i] = dist[x] + 1","+ return dist","+","+","+ans = 0","+for i in range(m):","+ d = BFS(i)","+ if -1 in d:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.9204517574,"measured_runtime_v1":0.2149319355,"runtime_lift":8.9351624385,"key":["s633729388","s318413779"]} +{"user_id":"u104442591","problem_id":"p03013","language":"python","submission_id_v0":"s155010894","submission_id_v1":"s219302700","cpu_time_v0":466,"cpu_time_v1":178,"memory_v0":460020,"memory_v1":13212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.8,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, m = list(map(int, input().split()))\n\na = []\n\nfor i in range(m):\n\n a.append(int(eval(input())))\n\nans = 0\n\nflag = 0\n\na = set(a)\n\n\n\n#\u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217\u306e\u521d\u671f\u5024\u3092\u8abf\u7bc0\n\ndp = [0] * (n+1)\n\ndp[0] = 1\n\nif 1 in a:\n\n dp[1] = 0\n\nelse:\n\n dp[1] = 1\n\n \n\nfor i in range(2, n+1):\n\n if dp[i-2] == 0 and dp[i-1] == 0:\n\n ans = 0\n\n flag = 1\n\n break\n\n elif i in a:\n\n continue\n\n else:\n\n dp[i] = dp[i-1] + dp[i-2]\n\nif flag == 0:\n\n ans = dp[n]\n\nprint((ans%(10**9+7)))\n\n# optimized version of the same code:\n","target":"n, m = list(map(int, input().split()))\n\na = []\n\nfor i in range(m):\n\n a.append(int(eval(input())))\n\nans = 0\n\nflag = 0\n\na = set(a)\n\n\n\n#\u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217\u306e\u521d\u671f\u5024\u3092\u8abf\u7bc0\n\ndp = [0] * (n+1)\n\ndp[0] = 1\n\nif 1 in a:\n\n dp[1] = 0\n\nelse:\n\n dp[1] = 1\n\n \n\nfor i in range(2, n+1):\n\n if dp[i-2] == 0 and dp[i-1] == 0:\n\n ans = 0\n\n flag = 1\n\n break\n\n elif i in a:\n\n continue\n\n else:\n\n dp[i] = dp[i-1] + dp[i-2]\n\n dp[i] = dp[i] % (10**9+7)\n\nif flag == 0:\n\n ans = dp[n]\n\nprint(ans)","code_v0_loc":28,"code_v1_loc":29,"code_v0_num_chars":437,"code_v1_num_chars":458,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\na = []\nfor i in range(m):\n a.append(int(eval(input())))\nans = 0\nflag = 0\na = set(a)\n# \u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217\u306e\u521d\u671f\u5024\u3092\u8abf\u7bc0\ndp = [0] * (n + 1)\ndp[0] = 1\nif 1 in a:\n dp[1] = 0\nelse:\n dp[1] = 1\nfor i in range(2, n + 1):\n if dp[i - 2] == 0 and dp[i - 1] == 0:\n ans = 0\n flag = 1\n break\n elif i in a:\n continue\n else:\n dp[i] = dp[i - 1] + dp[i - 2]\nif flag == 0:\n ans = dp[n]\nprint((ans % (10**9 + 7)))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\na = []\nfor i in range(m):\n a.append(int(eval(input())))\nans = 0\nflag = 0\na = set(a)\n# \u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217\u306e\u521d\u671f\u5024\u3092\u8abf\u7bc0\ndp = [0] * (n + 1)\ndp[0] = 1\nif 1 in a:\n dp[1] = 0\nelse:\n dp[1] = 1\nfor i in range(2, n + 1):\n if dp[i - 2] == 0 and dp[i - 1] == 0:\n ans = 0\n flag = 1\n break\n elif i in a:\n continue\n else:\n dp[i] = dp[i - 1] + dp[i - 2]\n dp[i] = dp[i] % (10**9 + 7)\nif flag == 0:\n ans = dp[n]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":3.4482758621,"diff":["+ dp[i] = dp[i] % (10**9 + 7)","-print((ans % (10**9 + 7)))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2009983099,"measured_runtime_v1":0.0059565909,"runtime_lift":33.7438499966,"key":["s155010894","s219302700"]} +{"user_id":"u325956328","problem_id":"p02780","language":"python","submission_id_v0":"s608143765","submission_id_v1":"s686875697","cpu_time_v0":606,"cpu_time_v1":256,"memory_v0":33988,"memory_v1":25572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.76,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN, K = list(map(int, input().split()))\n\np = np.array(list(map(int, input().split())))\n\n\n\ns = np.cumsum(p)\n\n# print(p, s)\n\n\n\nm = []\n\n\n\n\n\ndef partsum(s, x):\n\n global K\n\n if x == K - 1:\n\n return s[x]\n\n return s[x] - s[x - K]\n\n\n\n\n\nfor i in range(K - 1, N):\n\n m.append(partsum(s, i))\n\n# print(m)\n\n\n\nidx = m.index(max(m))\n\n# print(idx)\n\n\n\nans = 0\n\nfor j in range(idx, idx + K):\n\n ans += (p[j] + 1) \/ 2\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"from collections import deque\n\n\n\nN, K = list(map(int, input().split()))\n\np = list(map(int, input().split()))\n\n\n\nmx = 0\n\ns = 0\n\nq = deque()\n\n\n\nfor i in range(N):\n\n p[i] += 1\n\n\n\nfor i in range(N):\n\n s += p[i]\n\n q.append(p[i])\n\n if len(q) > K:\n\n s -= q.popleft()\n\n if len(q) == K:\n\n mx = max(mx, s)\n\n\n\nprint((mx \/ 2))\n\n\n","code_v0_loc":29,"code_v1_loc":22,"code_v0_num_chars":446,"code_v1_num_chars":338,"code_v0_no_empty_lines":"import numpy as np\n\nN, K = list(map(int, input().split()))\np = np.array(list(map(int, input().split())))\ns = np.cumsum(p)\n# print(p, s)\nm = []\n\n\ndef partsum(s, x):\n global K\n if x == K - 1:\n return s[x]\n return s[x] - s[x - K]\n\n\nfor i in range(K - 1, N):\n m.append(partsum(s, i))\n# print(m)\nidx = m.index(max(m))\n# print(idx)\nans = 0\nfor j in range(idx, idx + K):\n ans += (p[j] + 1) \/ 2\nprint(ans)\n","code_v1_no_empty_lines":"from collections import deque\n\nN, K = list(map(int, input().split()))\np = list(map(int, input().split()))\nmx = 0\ns = 0\nq = deque()\nfor i in range(N):\n p[i] += 1\nfor i in range(N):\n s += p[i]\n q.append(p[i])\n if len(q) > K:\n s -= q.popleft()\n if len(q) == K:\n mx = max(mx, s)\nprint((mx \/ 2))\n","code_same":false,"relative_loc_diff_percent":24.1379310345,"diff":["-import numpy as np","+from collections import deque","-p = np.array(list(map(int, input().split())))","-s = np.cumsum(p)","-# print(p, s)","-m = []","-","-","-def partsum(s, x):","- global K","- if x == K - 1:","- return s[x]","- return s[x] - s[x - K]","-","-","-for i in range(K - 1, N):","- m.append(partsum(s, i))","-# print(m)","-idx = m.index(max(m))","-# print(idx)","-ans = 0","-for j in range(idx, idx + K):","- ans += (p[j] + 1) \/ 2","-print(ans)","+p = list(map(int, input().split()))","+mx = 0","+s = 0","+q = deque()","+for i in range(N):","+ p[i] += 1","+for i in range(N):","+ s += p[i]","+ q.append(p[i])","+ if len(q) > K:","+ s -= q.popleft()","+ if len(q) == K:","+ mx = max(mx, s)","+print((mx \/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":1.8877932756,"measured_runtime_v1":0.2490595601,"runtime_lift":7.5796860601,"key":["s608143765","s686875697"]} +{"user_id":"u263188345","problem_id":"p03126","language":"python","submission_id_v0":"s215059135","submission_id_v1":"s051824790","cpu_time_v0":163,"cpu_time_v1":17,"memory_v0":13144,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.57,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\nlike_total = np.zeros(M)\n\ncnt = 0\n\nfor _ in range(N):\n\n l = [v for v in map(int, input().split())]\n\n #print(l)\n\n for i in range(1, l[0]+1, 1):\n\n like_total[l[i]-1] += 1\n\n\n\n#print(like_total, N)\n\n#print(like_total[4], like_total[9], like_total[-1])\n\nans = len(np.where(like_total==N)[0])\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"N, M = list(map(int, input().split()))\n\n\n\nlike_total = [0]*M\n\ncnt = 0\n\nfor _ in range(N):\n\n l = list(map(int, input().split()))\n\n for i in range(1, l[0]+1, 1):\n\n like_total[l[i]-1] += 1\n\n\n\nfor v in like_total:\n\n cnt += v==N\n\nprint(cnt)\n","code_v0_loc":17,"code_v1_loc":12,"code_v0_num_chars":375,"code_v1_num_chars":246,"code_v0_no_empty_lines":"import numpy as np\n\nN, M = list(map(int, input().split()))\nlike_total = np.zeros(M)\ncnt = 0\nfor _ in range(N):\n l = [v for v in map(int, input().split())]\n # print(l)\n for i in range(1, l[0] + 1, 1):\n like_total[l[i] - 1] += 1\n# print(like_total, N)\n# print(like_total[4], like_total[9], like_total[-1])\nans = len(np.where(like_total == N)[0])\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nlike_total = [0] * M\ncnt = 0\nfor _ in range(N):\n l = list(map(int, input().split()))\n for i in range(1, l[0] + 1, 1):\n like_total[l[i] - 1] += 1\nfor v in like_total:\n cnt += v == N\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["-import numpy as np","-","-like_total = np.zeros(M)","+like_total = [0] * M","- l = [v for v in map(int, input().split())]","- # print(l)","+ l = list(map(int, input().split()))","-# print(like_total, N)","-# print(like_total[4], like_total[9], like_total[-1])","-ans = len(np.where(like_total == N)[0])","-print(ans)","+for v in like_total:","+ cnt += v == N","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":1.4440002892,"measured_runtime_v1":0.2203136516,"runtime_lift":6.5542932946,"key":["s215059135","s051824790"]} +{"user_id":"u600402037","problem_id":"p03200","language":"python","submission_id_v0":"s238646365","submission_id_v1":"s273593908","cpu_time_v0":247,"cpu_time_v1":188,"memory_v0":24588,"memory_v1":14540,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.89,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nstdin = sys.stdin\n\n \n\nri = lambda: int(rs())\n\nrl = lambda: list(map(int, stdin.readline().split()))\n\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\n\n\nS = list(rs())\n\nW = [0] * len(S)\n\nfor i in range(len(S)):\n\n if S[i] == 'W':\n\n W[i] = 1\n\nW = np.array(W[::-1])\n\nW_cum = W.cumsum()[::-1]\n\nW_cum = W_cum.tolist()\n\nanswer = 0\n\nfor i in range(len(S)):\n\n if S[i] == 'B':\n\n answer += W_cum[i]\n\n\n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\nimport numpy as np\n\n\n\nstdin = sys.stdin\n\n \n\nri = lambda: int(rs())\n\nrl = lambda: list(map(int, stdin.readline().split()))\n\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\n\n\nS = list(rs())\n\ncnt_B = 0\n\nanswer = 0\n\nfor s in S:\n\n if s == 'B':\n\n cnt_B += 1\n\n else:\n\n answer += cnt_B\n\nprint(answer)\n","code_v0_loc":23,"code_v1_loc":18,"code_v0_num_chars":475,"code_v1_num_chars":343,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nstdin = sys.stdin\nri = lambda: int(rs())\nrl = lambda: list(map(int, stdin.readline().split()))\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\nS = list(rs())\nW = [0] * len(S)\nfor i in range(len(S)):\n if S[i] == \"W\":\n W[i] = 1\nW = np.array(W[::-1])\nW_cum = W.cumsum()[::-1]\nW_cum = W_cum.tolist()\nanswer = 0\nfor i in range(len(S)):\n if S[i] == \"B\":\n answer += W_cum[i]\nprint(answer)\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\nstdin = sys.stdin\nri = lambda: int(rs())\nrl = lambda: list(map(int, stdin.readline().split()))\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\nS = list(rs())\ncnt_B = 0\nanswer = 0\nfor s in S:\n if s == \"B\":\n cnt_B += 1\n else:\n answer += cnt_B\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":21.7391304348,"diff":["-W = [0] * len(S)","-for i in range(len(S)):","- if S[i] == \"W\":","- W[i] = 1","-W = np.array(W[::-1])","-W_cum = W.cumsum()[::-1]","-W_cum = W_cum.tolist()","+cnt_B = 0","-for i in range(len(S)):","- if S[i] == \"B\":","- answer += W_cum[i]","+for s in S:","+ if s == \"B\":","+ cnt_B += 1","+ else:","+ answer += cnt_B"],"diff_only_import_comment":false,"measured_runtime_v0":1.3702549627,"measured_runtime_v1":0.2093048743,"runtime_lift":6.5466939885,"key":["s238646365","s273593908"]} +{"user_id":"u712975113","problem_id":"p03126","language":"python","submission_id_v0":"s000173013","submission_id_v1":"s171225616","cpu_time_v0":186,"cpu_time_v1":18,"memory_v0":12396,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.32,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN,M=list(map(int,input().split()))\n\nA=np.zeros((N+1,M+1))\n\nA[0]=np.ones(M+1)\n\nfor i in range(1,N+1):\n\n B=list(map(int,input().split()))\n\n for m in range(1,B[0]+1):\n\n A[i][B[m]]=A[i-1][B[m]]\n\na=sum(A[N])\n\nprint((int(a)))\n\n# optimized version of the same code:\n","target":"N,M=list(map(int,input().split()))\n\nA = [[1 for _ in range(M)]]+[[0 for _ in range(M)] for _ in range(N)]\n\nfor i in range(1,N+1):\n\n B=list(map(int,input().split()))\n\n Ai=B[1:]\n\n for m in Ai:\n\n A[i][m-1]=A[i-1][m-1]\n\na=sum(A[N])\n\nprint((int(a)))","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":244,"code_v1_num_chars":252,"code_v0_no_empty_lines":"import numpy as np\n\nN, M = list(map(int, input().split()))\nA = np.zeros((N + 1, M + 1))\nA[0] = np.ones(M + 1)\nfor i in range(1, N + 1):\n B = list(map(int, input().split()))\n for m in range(1, B[0] + 1):\n A[i][B[m]] = A[i - 1][B[m]]\na = sum(A[N])\nprint((int(a)))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nA = [[1 for _ in range(M)]] + [[0 for _ in range(M)] for _ in range(N)]\nfor i in range(1, N + 1):\n B = list(map(int, input().split()))\n Ai = B[1:]\n for m in Ai:\n A[i][m - 1] = A[i - 1][m - 1]\na = sum(A[N])\nprint((int(a)))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-import numpy as np","-","-A = np.zeros((N + 1, M + 1))","-A[0] = np.ones(M + 1)","+A = [[1 for _ in range(M)]] + [[0 for _ in range(M)] for _ in range(N)]","- for m in range(1, B[0] + 1):","- A[i][B[m]] = A[i - 1][B[m]]","+ Ai = B[1:]","+ for m in Ai:","+ A[i][m - 1] = A[i - 1][m - 1]"],"diff_only_import_comment":false,"measured_runtime_v0":1.536293736,"measured_runtime_v1":0.2500440102,"runtime_lift":6.1440933335,"key":["s000173013","s171225616"]} +{"user_id":"u894258749","problem_id":"p03126","language":"python","submission_id_v0":"s237503515","submission_id_v1":"s632748027","cpu_time_v0":156,"cpu_time_v1":17,"memory_v0":12396,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.1,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\n(N,M) = list(map(int,input().split()))\n\nB = np.ones(M,dtype=np.int)\n\n\n\nfor _ in range(N):\n\n A = np.array(list(map(int,input().split())))[1:]\n\n for i in range(M):\n\n if not i+1 in A:\n\n B[i] = 0\n\nprint((B.sum()))\n\n# optimized version of the same code:\n","target":"(N,M) = list(map(int,input().split()))\n\nr = int(-1)\n\nfor i in range(N):\n\n A = list(map(int,input().split()))\n\n A.pop(0)\n\n c = 0\n\n for a in A:\n\n c |= (1 << (a-1))\n\n r &= c\n\n\n\nans = sum([(r>>n)&1 for n in range(M)])\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":247,"code_v1_num_chars":227,"code_v0_no_empty_lines":"import numpy as np\n\n(N, M) = list(map(int, input().split()))\nB = np.ones(M, dtype=np.int)\nfor _ in range(N):\n A = np.array(list(map(int, input().split())))[1:]\n for i in range(M):\n if not i + 1 in A:\n B[i] = 0\nprint((B.sum()))\n","code_v1_no_empty_lines":"(N, M) = list(map(int, input().split()))\nr = int(-1)\nfor i in range(N):\n A = list(map(int, input().split()))\n A.pop(0)\n c = 0\n for a in A:\n c |= 1 << (a - 1)\n r &= c\nans = sum([(r >> n) & 1 for n in range(M)])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import numpy as np","-","-B = np.ones(M, dtype=np.int)","-for _ in range(N):","- A = np.array(list(map(int, input().split())))[1:]","- for i in range(M):","- if not i + 1 in A:","- B[i] = 0","-print((B.sum()))","+r = int(-1)","+for i in range(N):","+ A = list(map(int, input().split()))","+ A.pop(0)","+ c = 0","+ for a in A:","+ c |= 1 << (a - 1)","+ r &= c","+ans = sum([(r >> n) & 1 for n in range(M)])","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.7091809404,"measured_runtime_v1":0.2837385476,"runtime_lift":6.0237882903,"key":["s237503515","s632748027"]} +{"user_id":"u803848678","problem_id":"p03558","language":"python","submission_id_v0":"s650935446","submission_id_v1":"s013593877","cpu_time_v0":647,"cpu_time_v1":206,"memory_v0":80204,"memory_v1":46940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom heapq import heappush, heappop\n\nk = int(eval(input()))\n\n\n\nheap = [(1,1)]\n\ndist = [float(\"inf\")]*k\n\nwhile heap:\n\n cost, cur = heappop(heap)\n\n if dist[cur] <= cost:\n\n continue\n\n dist[cur] = cost\n\n # +1\n\n nxt = (cur+1)%k\n\n heappush(heap, (cost+1, nxt))\n\n # *10\n\n nxt = cur*10 % k\n\n heappush(heap, (cost, nxt))\n\n\n\nprint((dist[0]))\n\n# optimized version of the same code:\n","target":"from collections import deque\n\nk = int(eval(input()))\n\n\n\nque = deque()\n\nque.append((1,1))\n\ndist = [float(\"inf\")]*k\n\nwhile que:\n\n cost, cur = que.popleft()\n\n if dist[cur] <= cost:\n\n continue\n\n dist[cur] = cost\n\n # +1\n\n nxt = (cur+1)%k\n\n que.append((cost+1,nxt))\n\n # *10\n\n nxt = cur*10 % k\n\n que.appendleft((cost, nxt))\n\nprint((dist[0]))","code_v0_loc":18,"code_v1_loc":18,"code_v0_num_chars":357,"code_v1_num_chars":361,"code_v0_no_empty_lines":"from heapq import heappush, heappop\n\nk = int(eval(input()))\nheap = [(1, 1)]\ndist = [float(\"inf\")] * k\nwhile heap:\n cost, cur = heappop(heap)\n if dist[cur] <= cost:\n continue\n dist[cur] = cost\n # +1\n nxt = (cur + 1) % k\n heappush(heap, (cost + 1, nxt))\n # *10\n nxt = cur * 10 % k\n heappush(heap, (cost, nxt))\nprint((dist[0]))\n","code_v1_no_empty_lines":"from collections import deque\n\nk = int(eval(input()))\nque = deque()\nque.append((1, 1))\ndist = [float(\"inf\")] * k\nwhile que:\n cost, cur = que.popleft()\n if dist[cur] <= cost:\n continue\n dist[cur] = cost\n # +1\n nxt = (cur + 1) % k\n que.append((cost + 1, nxt))\n # *10\n nxt = cur * 10 % k\n que.appendleft((cost, nxt))\nprint((dist[0]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-from heapq import heappush, heappop","+from collections import deque","-heap = [(1, 1)]","+que = deque()","+que.append((1, 1))","-while heap:","- cost, cur = heappop(heap)","+while que:","+ cost, cur = que.popleft()","- heappush(heap, (cost + 1, nxt))","+ que.append((cost + 1, nxt))","- heappush(heap, (cost, nxt))","+ que.appendleft((cost, nxt))"],"diff_only_import_comment":false,"measured_runtime_v0":0.7778599041,"measured_runtime_v1":0.4842932501,"runtime_lift":1.6061753987,"key":["s650935446","s013593877"]} +{"user_id":"u164727245","problem_id":"p02690","language":"python","submission_id_v0":"s738393480","submission_id_v1":"s821832490","cpu_time_v0":29,"cpu_time_v1":25,"memory_v0":9144,"memory_v1":9112,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n x = int(args[0])\n\n\n\n ret = None\n\n for a in range(120):\n\n for b in range(120):\n\n a5, b5 = pow(a, 5), pow(b, 5)\n\n if a5-b5 == x:\n\n ret = (a, b)\n\n elif a5+b5 == x:\n\n ret = (a, -b)\n\n\n\n return ' '.join(map(str, ret))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n x = int(args[0])\n\n\n\n ret = None\n\n for b in range(120):\n\n for a in range(b, 120):\n\n a5, b5 = pow(a, 5), pow(b, 5)\n\n if a5-b5 == x:\n\n ret = (a, b)\n\n elif a5+b5 == x:\n\n ret = (a, -b)\n\n\n\n return ' '.join(map(str, ret))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n","code_v0_loc":20,"code_v1_loc":20,"code_v0_num_chars":429,"code_v1_num_chars":432,"code_v0_no_empty_lines":"# coding: utf-8\ndef solve(*args: str) -> str:\n x = int(args[0])\n ret = None\n for a in range(120):\n for b in range(120):\n a5, b5 = pow(a, 5), pow(b, 5)\n if a5 - b5 == x:\n ret = (a, b)\n elif a5 + b5 == x:\n ret = (a, -b)\n return \" \".join(map(str, ret))\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_v1_no_empty_lines":"# coding: utf-8\ndef solve(*args: str) -> str:\n x = int(args[0])\n ret = None\n for b in range(120):\n for a in range(b, 120):\n a5, b5 = pow(a, 5), pow(b, 5)\n if a5 - b5 == x:\n ret = (a, b)\n elif a5 + b5 == x:\n ret = (a, -b)\n return \" \".join(map(str, ret))\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for a in range(120):","- for b in range(120):","+ for b in range(120):","+ for a in range(b, 120):"],"diff_only_import_comment":false,"measured_runtime_v0":0.3019295235,"measured_runtime_v1":0.2210984349,"runtime_lift":1.3655886964,"key":["s738393480","s821832490"]} +{"user_id":"u853010060","problem_id":"p02921","language":"python","submission_id_v0":"s066833687","submission_id_v1":"s453964878","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = eval(input())\n\nT = eval(input())\n\n\n\nl = len(S)\n\nres = 0\n\nfor n in range(l):\n\n if S[n] == T[n]:\n\n res += 1\n\nprint(res)\n\n# optimized version of the same code:\n","target":"S = eval(input())\n\nT = eval(input())\n\nl = len(S)\n\nans = 0\n\nfor n in range(l):\n\n if S[n] == T[n]:\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":119,"code_v1_num_chars":118,"code_v0_no_empty_lines":"S = eval(input())\nT = eval(input())\nl = len(S)\nres = 0\nfor n in range(l):\n if S[n] == T[n]:\n res += 1\nprint(res)\n","code_v1_no_empty_lines":"S = eval(input())\nT = eval(input())\nl = len(S)\nans = 0\nfor n in range(l):\n if S[n] == T[n]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-res = 0","+ans = 0","- res += 1","-print(res)","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3049550076,"measured_runtime_v1":0.2412325363,"runtime_lift":1.2641537174,"key":["s066833687","s453964878"]} +{"user_id":"u884323674","problem_id":"p03371","language":"python","submission_id_v0":"s486102959","submission_id_v1":"s507293588","cpu_time_v0":228,"cpu_time_v1":129,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA, B, C, X, Y = list(map(int, input().split()))\n\n\n\nmax_iter = max(X, Y) * 2\n\nans = float(\"inf\")\n\nfor i in range(max_iter):\n\n a = max(X - i, 0)\n\n b = max(Y - i, 0)\n\n price = 2*C * i + A * a + B * b\n\n ans = min(ans, price)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float(\"inf\")\n\nfor i in range(max(X, Y)+1):\n\n x = max(X - i, 0)\n\n y = max(Y - i, 0)\n\n cost = 2*C * i + A * x + B * y\n\n ans = min(ans, cost)\n\n\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":240,"code_v1_num_chars":215,"code_v0_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nmax_iter = max(X, Y) * 2\nans = float(\"inf\")\nfor i in range(max_iter):\n a = max(X - i, 0)\n b = max(Y - i, 0)\n price = 2 * C * i + A * a + B * b\n ans = min(ans, price)\nprint(ans)\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(max(X, Y) + 1):\n x = max(X - i, 0)\n y = max(Y - i, 0)\n cost = 2 * C * i + A * x + B * y\n ans = min(ans, cost)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-max_iter = max(X, Y) * 2","-for i in range(max_iter):","- a = max(X - i, 0)","- b = max(Y - i, 0)","- price = 2 * C * i + A * a + B * b","- ans = min(ans, price)","+for i in range(max(X, Y) + 1):","+ x = max(X - i, 0)","+ y = max(Y - i, 0)","+ cost = 2 * C * i + A * x + B * y","+ ans = min(ans, cost)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4454369638,"measured_runtime_v1":0.3371012073,"runtime_lift":1.321374573,"key":["s486102959","s507293588"]} +{"user_id":"u755801379","problem_id":"p02780","language":"python","submission_id_v0":"s334440768","submission_id_v1":"s407777290","cpu_time_v0":402,"cpu_time_v1":240,"memory_v0":32348,"memory_v1":23588,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.3,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn,k=list(map(int, input().split()))\n\nexp=list([(int(x)+1)\/2 for x in input().split()]) # \u5165\u529b\u3068\u540c\u6642\u306b\u671f\u5f85\u5024\u8a08\u7b97\n\n\n\nl=np.cumsum(exp) # \u7d2f\u7a4d\u548c\u306e\u8a08\u7b97\n\n\n\nans=l[k-1]\n\nfor i in range(n-k):\n\n ans=max(ans,l[i+k]-l[i])\n\n \n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n,k=list(map(int, input().split()))\n\nexp=list([(int(x)+1)\/2 for x in input().split()]) # \u5165\u529b\u3068\u540c\u6642\u306b\u671f\u5f85\u5024\u8a08\u7b97\n\n\n\nl=[0]*n\n\nsum1=0\n\nfor i in range(n):# \u7d2f\u7a4d\u548c\u306e\u8a08\u7b97\n\n sum1+=exp[i]\n\n l[i]=sum1 \n\n\n\nans=l[k-1]\n\nfor i in range(n-k):\n\n ans=max(ans,l[i+k]-l[i])\n\n \n\nprint(ans)","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":230,"code_v1_num_chars":262,"code_v0_no_empty_lines":"import numpy as np\n\nn, k = list(map(int, input().split()))\nexp = list([(int(x) + 1) \/ 2 for x in input().split()]) # \u5165\u529b\u3068\u540c\u6642\u306b\u671f\u5f85\u5024\u8a08\u7b97\nl = np.cumsum(exp) # \u7d2f\u7a4d\u548c\u306e\u8a08\u7b97\nans = l[k - 1]\nfor i in range(n - k):\n ans = max(ans, l[i + k] - l[i])\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nexp = list([(int(x) + 1) \/ 2 for x in input().split()]) # \u5165\u529b\u3068\u540c\u6642\u306b\u671f\u5f85\u5024\u8a08\u7b97\nl = [0] * n\nsum1 = 0\nfor i in range(n): # \u7d2f\u7a4d\u548c\u306e\u8a08\u7b97\n sum1 += exp[i]\n l[i] = sum1\nans = l[k - 1]\nfor i in range(n - k):\n ans = max(ans, l[i + k] - l[i])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-import numpy as np","-","-l = np.cumsum(exp) # \u7d2f\u7a4d\u548c\u306e\u8a08\u7b97","+l = [0] * n","+sum1 = 0","+for i in range(n): # \u7d2f\u7a4d\u548c\u306e\u8a08\u7b97","+ sum1 += exp[i]","+ l[i] = sum1"],"diff_only_import_comment":false,"measured_runtime_v0":1.3928545866,"measured_runtime_v1":0.2122811053,"runtime_lift":6.5613686376,"key":["s334440768","s407777290"]} +{"user_id":"u020390084","problem_id":"p03309","language":"python","submission_id_v0":"s289814925","submission_id_v1":"s781437429","cpu_time_v0":334,"cpu_time_v1":258,"memory_v0":27244,"memory_v1":36640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.75,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nimport statistics\n\nn = int(eval(input()))\n\na = list(map(int,input().split()))\n\na = [aa-i-1 for i, aa in enumerate(a)]\n\nanswer = n*10**20\n\nmedian_low = statistics.median_low(a)\n\nmedian_high = statistics.median_high(a)\n\n\n\nfor m in (median_low,median_high):\n\n ans=0\n\n for aa in a:\n\n ans += abs(aa-m)\n\n answer = min(ans,answer)\n\nprint(answer)\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\n\n\n\n\ndef solve(N: int, A: \"List[int]\"):\n\n difA = [0]*N\n\n\n\n for i in range(N):\n\n difA[i] = A[i]-(i+1)\n\n\n\n difA.sort()\n\n if N%2 == 0:\n\n g1 = difA[N\/\/2]\n\n g2 = difA[N\/\/2-1]\n\n a1 = 0\n\n a2 = 0\n\n for i in range(N):\n\n a1 += abs(difA[i]-g1)\n\n a2 += abs(difA[i]-g2)\n\n print((min(a1,a2)))\n\n \n\n else:\n\n g = difA[N\/\/2]\n\n a = 0\n\n for i in range(N):\n\n a += abs(difA[i]-g)\n\n print(a)\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, A)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":15,"code_v1_loc":42,"code_v0_num_chars":352,"code_v1_num_chars":891,"code_v0_no_empty_lines":"import math\nimport statistics\n\nn = int(eval(input()))\na = list(map(int, input().split()))\na = [aa - i - 1 for i, aa in enumerate(a)]\nanswer = n * 10**20\nmedian_low = statistics.median_low(a)\nmedian_high = statistics.median_high(a)\nfor m in (median_low, median_high):\n ans = 0\n for aa in a:\n ans += abs(aa - m)\n answer = min(ans, answer)\nprint(answer)\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\n\ndef solve(N: int, A: \"List[int]\"):\n difA = [0] * N\n for i in range(N):\n difA[i] = A[i] - (i + 1)\n difA.sort()\n if N % 2 == 0:\n g1 = difA[N \/\/ 2]\n g2 = difA[N \/\/ 2 - 1]\n a1 = 0\n a2 = 0\n for i in range(N):\n a1 += abs(difA[i] - g1)\n a2 += abs(difA[i] - g2)\n print((min(a1, a2)))\n else:\n g = difA[N \/\/ 2]\n a = 0\n for i in range(N):\n a += abs(difA[i] - g)\n print(a)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, A)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":64.2857142857,"diff":["-import math","-import statistics","+#!\/usr\/bin\/env python3","+import sys","-n = int(eval(input()))","-a = list(map(int, input().split()))","-a = [aa - i - 1 for i, aa in enumerate(a)]","-answer = n * 10**20","-median_low = statistics.median_low(a)","-median_high = statistics.median_high(a)","-for m in (median_low, median_high):","- ans = 0","- for aa in a:","- ans += abs(aa - m)","- answer = min(ans, answer)","-print(answer)","+","+def solve(N: int, A: \"List[int]\"):","+ difA = [0] * N","+ for i in range(N):","+ difA[i] = A[i] - (i + 1)","+ difA.sort()","+ if N % 2 == 0:","+ g1 = difA[N \/\/ 2]","+ g2 = difA[N \/\/ 2 - 1]","+ a1 = 0","+ a2 = 0","+ for i in range(N):","+ a1 += abs(difA[i] - g1)","+ a2 += abs(difA[i] - g2)","+ print((min(a1, a2)))","+ else:","+ g = difA[N \/\/ 2]","+ a = 0","+ for i in range(N):","+ a += abs(difA[i] - g)","+ print(a)","+ return","+","+","+def main():","+ def iterate_tokens():","+ for line in sys.stdin:","+ for word in line.split():","+ yield word","+","+ tokens = iterate_tokens()","+ N = int(next(tokens)) # type: int","+ A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"","+ solve(N, A)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2912476273,"measured_runtime_v1":0.217194303,"runtime_lift":1.3409542662,"key":["s289814925","s781437429"]} +{"user_id":"u060938295","problem_id":"p03170","language":"python","submission_id_v0":"s305058110","submission_id_v1":"s224120927","cpu_time_v0":751,"cpu_time_v1":224,"memory_v0":14280,"memory_v1":14280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\"\"\"\n\nCreated on Sat Apr 25 18:20:35 2020\n\n\"\"\"\n\n\n\nimport sys\n\nimport numpy as np\n\n\n\nsys.setrecursionlimit(10 ** 9)\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\nmod = 10**9+7\n\n\n\n#N = int(input())\n\nN, K = list(map(int,input().split()))\n\nA = np.array(list(map(int,input().split())))\n\n#N, K, *A = map(int, open(0).read().split())\n\n\n\ndp = [True for i in range(K + A[-1] + 1)]\n\nfor i in range(K):\n\n if dp[i]:\n\n for a in A:\n\n dp[i + a] = False\n\n\n\n# print(i, dp[i],A+i,dp[A+i])\n\n#print(dp)\n\n\n\nif dp[K]:\n\n ans = 'Second'\n\nelse:\n\n ans = 'First'\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nCreated on Sat Apr 25 18:20:35 2020\n\n\"\"\"\n\n\n\nimport sys\n\nimport numpy as np\n\n\n\nsys.setrecursionlimit(10 ** 9)\n\n#def input():\n\n# return sys.stdin.readline()[:-1]\n\nmod = 10**9+7\n\n\n\n#N = int(input())\n\nN, K = list(map(int,input().split()))\n\n#A = np.array(list(map(int,input().split())))\n\nA = list(map(int,input().split()))\n\n\n\ndp = [True for i in range(K + A[-1] + 1)]\n\nfor i in range(K):\n\n if dp[i]:\n\n for a in A:\n\n dp[i + a] = False\n\n\n\n# print(i, dp[i],A+i,dp[A+i])\n\n#print(dp)\n\n\n\nif dp[K]:\n\n ans = 'Second'\n\nelse:\n\n ans = 'First'\n\nprint(ans)","code_v0_loc":32,"code_v1_loc":32,"code_v0_num_chars":602,"code_v1_num_chars":595,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Apr 25 18:20:35 2020\n\"\"\"\nimport sys\nimport numpy as np\n\nsys.setrecursionlimit(10**9)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nmod = 10**9 + 7\n# N = int(input())\nN, K = list(map(int, input().split()))\nA = np.array(list(map(int, input().split())))\n# N, K, *A = map(int, open(0).read().split())\ndp = [True for i in range(K + A[-1] + 1)]\nfor i in range(K):\n if dp[i]:\n for a in A:\n dp[i + a] = False\n# print(i, dp[i],A+i,dp[A+i])\n# print(dp)\nif dp[K]:\n ans = \"Second\"\nelse:\n ans = \"First\"\nprint(ans)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Apr 25 18:20:35 2020\n\"\"\"\nimport sys\nimport numpy as np\n\nsys.setrecursionlimit(10**9)\n# def input():\n# return sys.stdin.readline()[:-1]\nmod = 10**9 + 7\n# N = int(input())\nN, K = list(map(int, input().split()))\n# A = np.array(list(map(int,input().split())))\nA = list(map(int, input().split()))\ndp = [True for i in range(K + A[-1] + 1)]\nfor i in range(K):\n if dp[i]:\n for a in A:\n dp[i + a] = False\n# print(i, dp[i],A+i,dp[A+i])\n# print(dp)\nif dp[K]:\n ans = \"Second\"\nelse:\n ans = \"First\"\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-","-","-def input():","- return sys.stdin.readline()[:-1]","-","-","+# def input():","+# return sys.stdin.readline()[:-1]","-A = np.array(list(map(int, input().split())))","-# N, K, *A = map(int, open(0).read().split())","+# A = np.array(list(map(int,input().split())))","+A = list(map(int, input().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4205468479,"measured_runtime_v1":0.2123065576,"runtime_lift":6.691017292,"key":["s305058110","s224120927"]} +{"user_id":"u562935282","problem_id":"p02837","language":"python","submission_id_v0":"s918027483","submission_id_v1":"s762694988","cpu_time_v0":83,"cpu_time_v1":71,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.46,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n from itertools import product\n\n\n\n N = int(eval(input()))\n\n\n\n g = []\n\n for _ in range(N):\n\n a = int(eval(input()))\n\n t = []\n\n for _ in range(a):\n\n x, y = list(map(int, input().split()))\n\n x -= 1\n\n t.append((x, y))\n\n g.append(t)\n\n\n\n def is_ok(prd):\n\n for j, bl in enumerate(prd):\n\n if bl:\n\n for x, y in g[j]:\n\n if prd[x] != y:\n\n return False\n\n return True\n\n\n\n ans = 0\n\n for prd in product([0, 1], repeat=N):\n\n *prd, = prd # list\u5316\n\n if is_ok(prd):\n\n ans = max(ans, prd.count(1))\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n# bit\u6f14\u7b97\u3057\u3088\u3046\u3068\u3057\u3066\u306f\u307e\u3063\u305f\n\n\n# optimized version of the same code:\n","target":"def main():\n\n from itertools import product\n\n\n\n N = int(eval(input()))\n\n\n\n g = []\n\n for _ in range(N):\n\n a = int(eval(input()))\n\n t = []\n\n for _ in range(a):\n\n x, y = list(map(int, input().split()))\n\n t.append((x - 1, y))\n\n g.append(t)\n\n\n\n def is_ok(prd):\n\n for j, bl in enumerate(prd):\n\n if bl:\n\n for x, y in g[j]:\n\n if prd[x] != y:\n\n return False\n\n return True\n\n\n\n ans = 0\n\n for prd in product([0, 1], repeat=N):\n\n if is_ok(prd):\n\n ans = max(ans, prd.count(1))\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n# bit\u6f14\u7b97\u3057\u3088\u3046\u3068\u3057\u3066\u306f\u307e\u3063\u305f\n","code_v0_loc":35,"code_v1_loc":33,"code_v0_num_chars":743,"code_v1_num_chars":697,"code_v0_no_empty_lines":"def main():\n from itertools import product\n\n N = int(eval(input()))\n g = []\n for _ in range(N):\n a = int(eval(input()))\n t = []\n for _ in range(a):\n x, y = list(map(int, input().split()))\n x -= 1\n t.append((x, y))\n g.append(t)\n\n def is_ok(prd):\n for j, bl in enumerate(prd):\n if bl:\n for x, y in g[j]:\n if prd[x] != y:\n return False\n return True\n\n ans = 0\n for prd in product([0, 1], repeat=N):\n (*prd,) = prd # list\u5316\n if is_ok(prd):\n ans = max(ans, prd.count(1))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n# bit\u6f14\u7b97\u3057\u3088\u3046\u3068\u3057\u3066\u306f\u307e\u3063\u305f\n","code_v1_no_empty_lines":"def main():\n from itertools import product\n\n N = int(eval(input()))\n g = []\n for _ in range(N):\n a = int(eval(input()))\n t = []\n for _ in range(a):\n x, y = list(map(int, input().split()))\n t.append((x - 1, y))\n g.append(t)\n\n def is_ok(prd):\n for j, bl in enumerate(prd):\n if bl:\n for x, y in g[j]:\n if prd[x] != y:\n return False\n return True\n\n ans = 0\n for prd in product([0, 1], repeat=N):\n if is_ok(prd):\n ans = max(ans, prd.count(1))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n# bit\u6f14\u7b97\u3057\u3088\u3046\u3068\u3057\u3066\u306f\u307e\u3063\u305f\n","code_same":false,"relative_loc_diff_percent":5.7142857143,"diff":["- x -= 1","- t.append((x, y))","+ t.append((x - 1, y))","- (*prd,) = prd # list\u5316"],"diff_only_import_comment":false,"measured_runtime_v0":0.1481621904,"measured_runtime_v1":0.0058356328,"runtime_lift":25.3892243111,"key":["s918027483","s762694988"]} +{"user_id":"u982896977","problem_id":"p03371","language":"python","submission_id_v0":"s299972417","submission_id_v1":"s929413776","cpu_time_v0":102,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c,x,y = list(map(int,input().split()))\n\nans = a*x + b*y\n\nfor i in range(max(x,y) + 1):\n\n\tmoney = max(0,(x-i)*a) + max(0,(y-i)*b) + 2*i*c\n\n\tif money <= ans:\n\n\t\tans = money\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"a,b,c,x,y = list(map(int,input().split()))\n\nif a + b >= 2*c:\n\n\tif x >= y:\n\n\t\tans = 2*y*c + (x-y)*min(a,2*c)\n\n\telse:\n\n\t\tans = 2*x*c + (y-x)*min(b,2*c)\n\nelse:\n\n\tans = (x*a + y*b)\n\nprint(ans)","code_v0_loc":7,"code_v1_loc":9,"code_v0_num_chars":180,"code_v1_num_chars":182,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nfor i in range(max(x, y) + 1):\n money = max(0, (x - i) * a) + max(0, (y - i) * b) + 2 * i * c\n if money <= ans:\n ans = money\nprint(ans)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nif a + b >= 2 * c:\n if x >= y:\n ans = 2 * y * c + (x - y) * min(a, 2 * c)\n else:\n ans = 2 * x * c + (y - x) * min(b, 2 * c)\nelse:\n ans = x * a + y * b\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-ans = a * x + b * y","-for i in range(max(x, y) + 1):","- money = max(0, (x - i) * a) + max(0, (y - i) * b) + 2 * i * c","- if money <= ans:","- ans = money","+if a + b >= 2 * c:","+ if x >= y:","+ ans = 2 * y * c + (x - y) * min(a, 2 * c)","+ else:","+ ans = 2 * x * c + (y - x) * min(b, 2 * c)","+else:","+ ans = x * a + y * b"],"diff_only_import_comment":false,"measured_runtime_v0":0.3295188012,"measured_runtime_v1":0.2310098734,"runtime_lift":1.4264273486,"key":["s299972417","s929413776"]} +{"user_id":"u340781749","problem_id":"p02680","language":"python","submission_id_v0":"s341076610","submission_id_v1":"s034276815","cpu_time_v0":2314,"cpu_time_v1":1930,"memory_v0":1000052,"memory_v1":915508,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n# from itertools import chain, accumulate\n\n\n\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\n\n\n\nver_lines = []\n\nhor_lines = []\n\nx_list = set()\n\ny_list = set()\n\nn3 = n * 3\n\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n\n y_list.add(a)\n\n y_list.add(b)\n\n x_list.add(c)\n\n ver_lines.append((a, b, c))\n\n\n\nfor d, e, f in zip(abcdef[n3 + 0::3], abcdef[n3 + 1::3], abcdef[n3 + 2::3]):\n\n y_list.add(d)\n\n x_list.add(e)\n\n x_list.add(f)\n\n hor_lines.append((d, e, f))\n\nx_list.add(0)\n\ny_list.add(0)\n\n\n\nx_list = sorted(x_list)\n\ny_list = sorted(y_list)\n\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\n\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\n\nrow_real = len(x_list)\n\ncol_real = len(y_list)\n\nrow = row_real + 2\n\ncol = col_real + 2\n\nbanned_up_ij = [[0] * row for _ in range(col)]\n\nbanned_down_ij = [[0] * row for _ in range(col)]\n\nbanned_left_ij = [[0] * col for _ in range(row)]\n\nbanned_right_ij = [[0] * col for _ in range(row)]\n\nfor a, b, c in ver_lines:\n\n if a > b:\n\n a, b = b, a\n\n ai = y_dict[a]\n\n bi = y_dict[b]\n\n j = x_dict[c]\n\n banned_left_ij[j][ai] += 1\n\n banned_left_ij[j][bi] -= 1\n\n banned_right_ij[j - 1][ai] += 1\n\n banned_right_ij[j - 1][bi] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n i = y_dict[d]\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up_ij[i][ej] += 1\n\n banned_up_ij[i][fj] -= 1\n\n banned_down_ij[i - 1][ej] += 1\n\n banned_down_ij[i - 1][fj] -= 1\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor i in range(col):\n\n ru = banned_up_ij[i]\n\n rd = banned_down_ij[i]\n\n ri = row * i\n\n banned_up[ri] = ru[0]\n\n banned_down[ri] = rd[0]\n\n for j in range(1, row):\n\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\n\nfor j in range(row):\n\n rl = banned_left_ij[j]\n\n rr = banned_right_ij[j]\n\n banned_left[j] = rl[0]\n\n banned_right[j] = rr[0]\n\n for i in range(1, col):\n\n ri0 = (i - 1) * row\n\n ri1 = i * row\n\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\n# from itertools import chain, accumulate\n\n\n\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\n\n\n\nver_lines = []\n\nhor_lines = []\n\nx_list = set()\n\ny_list = set()\n\nn3 = n * 3\n\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n\n y_list.add(a)\n\n y_list.add(b)\n\n x_list.add(c)\n\n ver_lines.append((a, b, c))\n\n\n\nfor d, e, f in zip(abcdef[n3 + 0::3], abcdef[n3 + 1::3], abcdef[n3 + 2::3]):\n\n y_list.add(d)\n\n x_list.add(e)\n\n x_list.add(f)\n\n hor_lines.append((d, e, f))\n\nx_list.add(0)\n\ny_list.add(0)\n\n\n\nx_list = sorted(x_list)\n\ny_list = sorted(y_list)\n\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\n\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\n\nrow_real = len(x_list)\n\ncol_real = len(y_list)\n\nrow = row_real + 2\n\ncol = col_real + 2\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor a, b, c in ver_lines:\n\n if a > b:\n\n a, b = b, a\n\n ai = y_dict[a] * row\n\n bi = y_dict[b] * row\n\n j = x_dict[c]\n\n banned_left[ai + j] += 1\n\n banned_left[bi + j] -= 1\n\n banned_right[ai + j - 1] += 1\n\n banned_right[bi + j - 1] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n ri = y_dict[d] * row\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up[ri + ej] += 1\n\n banned_up[ri + fj] -= 1\n\n banned_down[ri - row + ej] += 1\n\n banned_down[ri - row + fj] -= 1\n\n\n\nfor i in range(1, col):\n\n ri0 = row * (i - 1)\n\n ri1 = row * i\n\n for j in range(1, row):\n\n banned_up[ri1 + j] += banned_up[ri1 + j - 1]\n\n banned_down[ri1 + j] += banned_down[ri1 + j - 1]\n\n banned_left[ri1 + j] += banned_left[ri0 + j]\n\n banned_right[ri1 + j] += banned_right[ri0 + j]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n","code_v0_loc":128,"code_v1_loc":115,"code_v0_num_chars":3630,"code_v1_num_chars":3124,"code_v0_no_empty_lines":"import sys\n\n# from itertools import chain, accumulate\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\nver_lines = []\nhor_lines = []\nx_list = set()\ny_list = set()\nn3 = n * 3\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n y_list.add(a)\n y_list.add(b)\n x_list.add(c)\n ver_lines.append((a, b, c))\nfor d, e, f in zip(abcdef[n3 + 0 :: 3], abcdef[n3 + 1 :: 3], abcdef[n3 + 2 :: 3]):\n y_list.add(d)\n x_list.add(e)\n x_list.add(f)\n hor_lines.append((d, e, f))\nx_list.add(0)\ny_list.add(0)\nx_list = sorted(x_list)\ny_list = sorted(y_list)\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\nrow_real = len(x_list)\ncol_real = len(y_list)\nrow = row_real + 2\ncol = col_real + 2\nbanned_up_ij = [[0] * row for _ in range(col)]\nbanned_down_ij = [[0] * row for _ in range(col)]\nbanned_left_ij = [[0] * col for _ in range(row)]\nbanned_right_ij = [[0] * col for _ in range(row)]\nfor a, b, c in ver_lines:\n if a > b:\n a, b = b, a\n ai = y_dict[a]\n bi = y_dict[b]\n j = x_dict[c]\n banned_left_ij[j][ai] += 1\n banned_left_ij[j][bi] -= 1\n banned_right_ij[j - 1][ai] += 1\n banned_right_ij[j - 1][bi] -= 1\nfor d, e, f in hor_lines:\n if e > f:\n e, f = f, e\n i = y_dict[d]\n ej = x_dict[e]\n fj = x_dict[f]\n banned_up_ij[i][ej] += 1\n banned_up_ij[i][fj] -= 1\n banned_down_ij[i - 1][ej] += 1\n banned_down_ij[i - 1][fj] -= 1\nbanned_up = [0] * (row * col)\nbanned_down = [0] * (row * col)\nbanned_left = [0] * (row * col)\nbanned_right = [0] * (row * col)\nfor i in range(col):\n ru = banned_up_ij[i]\n rd = banned_down_ij[i]\n ri = row * i\n banned_up[ri] = ru[0]\n banned_down[ri] = rd[0]\n for j in range(1, row):\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\nfor j in range(row):\n rl = banned_left_ij[j]\n rr = banned_right_ij[j]\n banned_left[j] = rl[0]\n banned_right[j] = rr[0]\n for i in range(1, col):\n ri0 = (i - 1) * row\n ri1 = i * row\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n# for i in range(col):\n# print(walls[i * row:(i + 1) * row])\ns = row * y_dict[0] + x_dict[0]\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nq = [s]\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\nwhile q:\n c = q.pop()\n if enable[c] == 1:\n continue\n elif enable[c] == -1:\n print(\"INF\")\n exit()\n enable[c] = 1\n for dc, banned in moves:\n if banned[c]:\n continue\n nc = c + dc\n if enable[nc] == 1:\n continue\n q.append(nc)\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nans = 0\nfor i in range(col):\n ri = i * row\n for j in range(row):\n if enable[ri + j] != 1:\n continue\n t = y_list[i - 1]\n b = y_list[i]\n l = x_list[j - 1]\n r = x_list[j]\n ans += (b - t) * (r - l)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\n# from itertools import chain, accumulate\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\nver_lines = []\nhor_lines = []\nx_list = set()\ny_list = set()\nn3 = n * 3\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n y_list.add(a)\n y_list.add(b)\n x_list.add(c)\n ver_lines.append((a, b, c))\nfor d, e, f in zip(abcdef[n3 + 0 :: 3], abcdef[n3 + 1 :: 3], abcdef[n3 + 2 :: 3]):\n y_list.add(d)\n x_list.add(e)\n x_list.add(f)\n hor_lines.append((d, e, f))\nx_list.add(0)\ny_list.add(0)\nx_list = sorted(x_list)\ny_list = sorted(y_list)\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\nrow_real = len(x_list)\ncol_real = len(y_list)\nrow = row_real + 2\ncol = col_real + 2\nbanned_up = [0] * (row * col)\nbanned_down = [0] * (row * col)\nbanned_left = [0] * (row * col)\nbanned_right = [0] * (row * col)\nfor a, b, c in ver_lines:\n if a > b:\n a, b = b, a\n ai = y_dict[a] * row\n bi = y_dict[b] * row\n j = x_dict[c]\n banned_left[ai + j] += 1\n banned_left[bi + j] -= 1\n banned_right[ai + j - 1] += 1\n banned_right[bi + j - 1] -= 1\nfor d, e, f in hor_lines:\n if e > f:\n e, f = f, e\n ri = y_dict[d] * row\n ej = x_dict[e]\n fj = x_dict[f]\n banned_up[ri + ej] += 1\n banned_up[ri + fj] -= 1\n banned_down[ri - row + ej] += 1\n banned_down[ri - row + fj] -= 1\nfor i in range(1, col):\n ri0 = row * (i - 1)\n ri1 = row * i\n for j in range(1, row):\n banned_up[ri1 + j] += banned_up[ri1 + j - 1]\n banned_down[ri1 + j] += banned_down[ri1 + j - 1]\n banned_left[ri1 + j] += banned_left[ri0 + j]\n banned_right[ri1 + j] += banned_right[ri0 + j]\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n# for i in range(col):\n# print(walls[i * row:(i + 1) * row])\ns = row * y_dict[0] + x_dict[0]\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nq = [s]\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\nwhile q:\n c = q.pop()\n if enable[c] == 1:\n continue\n elif enable[c] == -1:\n print(\"INF\")\n exit()\n enable[c] = 1\n for dc, banned in moves:\n if banned[c]:\n continue\n nc = c + dc\n if enable[nc] == 1:\n continue\n q.append(nc)\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nans = 0\nfor i in range(col):\n ri = i * row\n for j in range(row):\n if enable[ri + j] != 1:\n continue\n t = y_list[i - 1]\n b = y_list[i]\n l = x_list[j - 1]\n r = x_list[j]\n ans += (b - t) * (r - l)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":10.15625,"diff":["-banned_up_ij = [[0] * row for _ in range(col)]","-banned_down_ij = [[0] * row for _ in range(col)]","-banned_left_ij = [[0] * col for _ in range(row)]","-banned_right_ij = [[0] * col for _ in range(row)]","-for a, b, c in ver_lines:","- if a > b:","- a, b = b, a","- ai = y_dict[a]","- bi = y_dict[b]","- j = x_dict[c]","- banned_left_ij[j][ai] += 1","- banned_left_ij[j][bi] -= 1","- banned_right_ij[j - 1][ai] += 1","- banned_right_ij[j - 1][bi] -= 1","-for d, e, f in hor_lines:","- if e > f:","- e, f = f, e","- i = y_dict[d]","- ej = x_dict[e]","- fj = x_dict[f]","- banned_up_ij[i][ej] += 1","- banned_up_ij[i][fj] -= 1","- banned_down_ij[i - 1][ej] += 1","- banned_down_ij[i - 1][fj] -= 1","-for i in range(col):","- ru = banned_up_ij[i]","- rd = banned_down_ij[i]","- ri = row * i","- banned_up[ri] = ru[0]","- banned_down[ri] = rd[0]","+for a, b, c in ver_lines:","+ if a > b:","+ a, b = b, a","+ ai = y_dict[a] * row","+ bi = y_dict[b] * row","+ j = x_dict[c]","+ banned_left[ai + j] += 1","+ banned_left[bi + j] -= 1","+ banned_right[ai + j - 1] += 1","+ banned_right[bi + j - 1] -= 1","+for d, e, f in hor_lines:","+ if e > f:","+ e, f = f, e","+ ri = y_dict[d] * row","+ ej = x_dict[e]","+ fj = x_dict[f]","+ banned_up[ri + ej] += 1","+ banned_up[ri + fj] -= 1","+ banned_down[ri - row + ej] += 1","+ banned_down[ri - row + fj] -= 1","+for i in range(1, col):","+ ri0 = row * (i - 1)","+ ri1 = row * i","- banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]","- banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]","-for j in range(row):","- rl = banned_left_ij[j]","- rr = banned_right_ij[j]","- banned_left[j] = rl[0]","- banned_right[j] = rr[0]","- for i in range(1, col):","- ri0 = (i - 1) * row","- ri1 = i * row","- banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]","- banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]","+ banned_up[ri1 + j] += banned_up[ri1 + j - 1]","+ banned_down[ri1 + j] += banned_down[ri1 + j - 1]","+ banned_left[ri1 + j] += banned_left[ri0 + j]","+ banned_right[ri1 + j] += banned_right[ri0 + j]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2846495706,"measured_runtime_v1":0.092071644,"runtime_lift":3.0916095148,"key":["s341076610","s034276815"]} +{"user_id":"u476068053","problem_id":"p02555","language":"python","submission_id_v0":"s269976358","submission_id_v1":"s000228897","cpu_time_v0":91,"cpu_time_v1":66,"memory_v0":64552,"memory_v1":62952,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.47,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n s = int(eval(input()))\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n for i in range(1, s+1):\n\n for j in range(0, (i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n s = int(eval(input()))\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n# for i in range(1, s+1):\n\n# for j in range(0, (i-3)+1):\n\n# dp[i] += dp[j]\n\n# dp[i] %= mod\n\n for i in range(1, s+1):\n\n if i < 3:\n\n dp[i] = 0\n\n else:\n\n dp[i] = dp[i-1] + dp[i-3]\n\n dp[i] %= mod\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":15,"code_v1_loc":22,"code_v0_num_chars":277,"code_v1_num_chars":434,"code_v0_no_empty_lines":"def main():\n s = int(eval(input()))\n mod = 10**9 + 7\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(1, s + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n s = int(eval(input()))\n mod = 10**9 + 7\n dp = [0] * (s + 1)\n dp[0] = 1\n # for i in range(1, s+1):\n # for j in range(0, (i-3)+1):\n # dp[i] += dp[j]\n # dp[i] %= mod\n for i in range(1, s + 1):\n if i < 3:\n dp[i] = 0\n else:\n dp[i] = dp[i - 1] + dp[i - 3]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":31.8181818182,"diff":["+ # for i in range(1, s+1):","+ # for j in range(0, (i-3)+1):","+ # dp[i] += dp[j]","+ # dp[i] %= mod","- for j in range(0, (i - 3) + 1):","- dp[i] += dp[j]","+ if i < 3:","+ dp[i] = 0","+ else:","+ dp[i] = dp[i - 1] + dp[i - 3]"],"diff_only_import_comment":false,"measured_runtime_v0":0.5094247258,"measured_runtime_v1":0.2087815866,"runtime_lift":2.4399887649,"key":["s269976358","s000228897"]} +{"user_id":"u546338822","problem_id":"p02792","language":"python","submission_id_v0":"s925566735","submission_id_v1":"s918927310","cpu_time_v0":742,"cpu_time_v1":154,"memory_v0":12884,"memory_v1":9096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.25,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n n = int(eval(input()))\n\n import numpy as np\n\n ans = np.zeros((10,10))\n\n for i in range(1,n+1):\n\n h,t = str(i)[0],str(i)[-1]\n\n ans[int(h)-1][int(t)-1]+=1\n\n s = 0\n\n for i in range(10):\n\n for j in range(10):\n\n s += ans[i][j]*ans[j][i]\n\n\n\n print((int(s)))\n\nif __name__ == \"__main__\":\n\n main()\n\n# optimized version of the same code:\n","target":"def main():\n\n n = int(eval(input()))\n\n dp = [[0 for i in range(10)] for i in range(10)]\n\n for i in range(1,n+1):\n\n h,t = int(str(i)[0]), int(str(i)[-1])\n\n dp[h][t] += 1\n\n ans = 0\n\n for i in range(10):\n\n for j in range(10):\n\n ans += dp[i][j] * dp[j][i]\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":15,"code_v1_loc":14,"code_v0_num_chars":350,"code_v1_num_chars":351,"code_v0_no_empty_lines":"def main():\n n = int(eval(input()))\n import numpy as np\n\n ans = np.zeros((10, 10))\n for i in range(1, n + 1):\n h, t = str(i)[0], str(i)[-1]\n ans[int(h) - 1][int(t) - 1] += 1\n s = 0\n for i in range(10):\n for j in range(10):\n s += ans[i][j] * ans[j][i]\n print((int(s)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n dp = [[0 for i in range(10)] for i in range(10)]\n for i in range(1, n + 1):\n h, t = int(str(i)[0]), int(str(i)[-1])\n dp[h][t] += 1\n ans = 0\n for i in range(10):\n for j in range(10):\n ans += dp[i][j] * dp[j][i]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["- import numpy as np","-","- ans = np.zeros((10, 10))","+ dp = [[0 for i in range(10)] for i in range(10)]","- h, t = str(i)[0], str(i)[-1]","- ans[int(h) - 1][int(t) - 1] += 1","- s = 0","+ h, t = int(str(i)[0]), int(str(i)[-1])","+ dp[h][t] += 1","+ ans = 0","- s += ans[i][j] * ans[j][i]","- print((int(s)))","+ ans += dp[i][j] * dp[j][i]","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.6066912649,"measured_runtime_v1":0.3226509961,"runtime_lift":4.9796569178,"key":["s925566735","s918927310"]} +{"user_id":"u606045429","problem_id":"p02850","language":"python","submission_id_v0":"s091418798","submission_id_v1":"s913698899","cpu_time_v0":551,"cpu_time_v1":429,"memory_v0":55084,"memory_v1":59020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.14,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import deque\n\n\n\nN, *AB = list(map(int, open(0).read().split()))\n\n\n\nE = [set() for _ in range(N + 1)]\n\nfor i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):\n\n E[a].add((b, i))\n\n E[b].add((a, i))\n\n\n\nA = [0] * (N - 1)\n\nQ = deque([(0, 1)])\n\nwhile Q:\n\n p, v = Q.popleft()\n\n c = 0\n\n for u, i in E[v]:\n\n E[u].remove((v, i))\n\n c += 1 + (c + 1 == p)\n\n Q.append((c, u))\n\n A[i] = c\n\n\n\nprint((max(A), *A))\n\n# optimized version of the same code:\n","target":"from collections import deque\n\n\n\nN, *AB = list(map(int, open(0).read().split()))\n\n\n\nE = [set() for _ in range(N + 1)]\n\nfor i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):\n\n E[a].add((b, i))\n\n E[b].add((a, i))\n\n\n\nA = [0] * (N - 1)\n\nQ = deque([1])\n\nwhile Q:\n\n p, v = divmod(Q.popleft(), N + 1)\n\n c = 0\n\n for u, i in E[v]:\n\n E[u].remove((v, i))\n\n c += 1 + (c + 1 == p)\n\n Q.append(c * (N + 1) + u)\n\n A[i] = c\n\n\n\nprint((max(A)))\n\nprint((\"\\n\".join(map(str, A))))","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":441,"code_v1_num_chars":487,"code_v0_no_empty_lines":"from collections import deque\n\nN, *AB = list(map(int, open(0).read().split()))\nE = [set() for _ in range(N + 1)]\nfor i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):\n E[a].add((b, i))\n E[b].add((a, i))\nA = [0] * (N - 1)\nQ = deque([(0, 1)])\nwhile Q:\n p, v = Q.popleft()\n c = 0\n for u, i in E[v]:\n E[u].remove((v, i))\n c += 1 + (c + 1 == p)\n Q.append((c, u))\n A[i] = c\nprint((max(A), *A))\n","code_v1_no_empty_lines":"from collections import deque\n\nN, *AB = list(map(int, open(0).read().split()))\nE = [set() for _ in range(N + 1)]\nfor i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):\n E[a].add((b, i))\n E[b].add((a, i))\nA = [0] * (N - 1)\nQ = deque([1])\nwhile Q:\n p, v = divmod(Q.popleft(), N + 1)\n c = 0\n for u, i in E[v]:\n E[u].remove((v, i))\n c += 1 + (c + 1 == p)\n Q.append(c * (N + 1) + u)\n A[i] = c\nprint((max(A)))\nprint((\"\\n\".join(map(str, A))))\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-Q = deque([(0, 1)])","+Q = deque([1])","- p, v = Q.popleft()","+ p, v = divmod(Q.popleft(), N + 1)","- Q.append((c, u))","+ Q.append(c * (N + 1) + u)","-print((max(A), *A))","+print((max(A)))","+print((\"\\n\".join(map(str, A))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3621242929,"measured_runtime_v1":0.2839822152,"runtime_lift":1.2751653924,"key":["s091418798","s913698899"]} +{"user_id":"u753803401","problem_id":"p03078","language":"python","submission_id_v0":"s362357786","submission_id_v1":"s175109634","cpu_time_v0":451,"cpu_time_v1":323,"memory_v0":62572,"memory_v1":53208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.38,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef slove():\n\n import sys\n\n import heapq\n\n import collections\n\n input = sys.stdin.readline\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n b.sort(reverse=True)\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n c.sort(reverse=True)\n\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(q)\n\n fq = collections.defaultdict(list)\n\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n\n t = 0\n\n for _ in range(k):\n\n if len(q) != 0:\n\n p = heapq.heappop(q)\n\n t = p[0]\n\n aq = p[1]\n\n bq = p[2]\n\n cq = p[3]\n\n if aq + 1 < len(a):\n\n if (-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq])\n\n fq[(-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq)] = 1\n\n if bq + 1 < len(b):\n\n if (-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq])\n\n fq[(-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq)] = 1\n\n if cq + 1 < len(c):\n\n if (-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1])\n\n fq[(-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1)] = 1\n\n print((-t))\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nimport collections\n\nimport heapq\n\n\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n mod = 10 ** 9 + 7\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b.sort(reverse=True)\n\n c.sort(reverse=True)\n\n ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(ql)\n\n fq = collections.defaultdict(int)\n\n fq[0, 0, 0]\n\n for i in range(k):\n\n s, ap, bp, cp = heapq.heappop(ql)\n\n for app, bpp, cpp in ([[ap+1, bp, cp], [ap, bp+1, cp], [ap, bp, cp+1]]):\n\n if app < x and bpp < y and cpp < z:\n\n if (app, bpp, cpp) not in fq:\n\n heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])\n\n fq[app, bpp, cpp]\n\n print((-s))\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","code_v0_loc":41,"code_v1_loc":31,"code_v0_num_chars":1596,"code_v1_num_chars":979,"code_v0_no_empty_lines":"def slove():\n import sys\n import heapq\n import collections\n\n input = sys.stdin.readline\n x, y, z, k = list(map(int, input().rstrip(\"\\n\").split()))\n a = list(map(int, input().rstrip(\"\\n\").split()))\n a.sort(reverse=True)\n b = list(map(int, input().rstrip(\"\\n\").split()))\n b.sort(reverse=True)\n c = list(map(int, input().rstrip(\"\\n\").split()))\n c.sort(reverse=True)\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n heapq.heapify(q)\n fq = collections.defaultdict(list)\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n t = 0\n for _ in range(k):\n if len(q) != 0:\n p = heapq.heappop(q)\n t = p[0]\n aq = p[1]\n bq = p[2]\n cq = p[3]\n if aq + 1 < len(a):\n if (-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq) not in fq:\n heapq.heappush(q, [-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq])\n fq[(-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq)] = 1\n if bq + 1 < len(b):\n if (-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq) not in fq:\n heapq.heappush(q, [-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq])\n fq[(-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq)] = 1\n if cq + 1 < len(c):\n if (-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1) not in fq:\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1])\n fq[(-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1)] = 1\n print((-t))\n\n\nif __name__ == \"__main__\":\n slove()\n","code_v1_no_empty_lines":"import sys\nimport collections\nimport heapq\n\n\ndef solve():\n input = sys.stdin.readline\n mod = 10**9 + 7\n x, y, z, k = list(map(int, input().rstrip(\"\\n\").split()))\n a = list(map(int, input().rstrip(\"\\n\").split()))\n b = list(map(int, input().rstrip(\"\\n\").split()))\n c = list(map(int, input().rstrip(\"\\n\").split()))\n a.sort(reverse=True)\n b.sort(reverse=True)\n c.sort(reverse=True)\n ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n heapq.heapify(ql)\n fq = collections.defaultdict(int)\n fq[0, 0, 0]\n for i in range(k):\n s, ap, bp, cp = heapq.heappop(ql)\n for app, bpp, cpp in [[ap + 1, bp, cp], [ap, bp + 1, cp], [ap, bp, cp + 1]]:\n if app < x and bpp < y and cpp < z:\n if (app, bpp, cpp) not in fq:\n heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])\n fq[app, bpp, cpp]\n print((-s))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":24.3902439024,"diff":["-def slove():","- import sys","- import heapq","- import collections","+import sys","+import collections","+import heapq","+","+def solve():","+ mod = 10**9 + 7","+ b = list(map(int, input().rstrip(\"\\n\").split()))","+ c = list(map(int, input().rstrip(\"\\n\").split()))","- b = list(map(int, input().rstrip(\"\\n\").split()))","- c = list(map(int, input().rstrip(\"\\n\").split()))","- q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]","- heapq.heapify(q)","- fq = collections.defaultdict(list)","- fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1","- t = 0","- for _ in range(k):","- if len(q) != 0:","- p = heapq.heappop(q)","- t = p[0]","- aq = p[1]","- bq = p[2]","- cq = p[3]","- if aq + 1 < len(a):","- if (-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq) not in fq:","- heapq.heappush(q, [-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq])","- fq[(-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq)] = 1","- if bq + 1 < len(b):","- if (-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq) not in fq:","- heapq.heappush(q, [-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq])","- fq[(-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq)] = 1","- if cq + 1 < len(c):","- if (-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1) not in fq:","- heapq.heappush(q, [-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1])","- fq[(-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1)] = 1","- print((-t))","+ ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]","+ heapq.heapify(ql)","+ fq = collections.defaultdict(int)","+ fq[0, 0, 0]","+ for i in range(k):","+ s, ap, bp, cp = heapq.heappop(ql)","+ for app, bpp, cpp in [[ap + 1, bp, cp], [ap, bp + 1, cp], [ap, bp, cp + 1]]:","+ if app < x and bpp < y and cpp < z:","+ if (app, bpp, cpp) not in fq:","+ heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])","+ fq[app, bpp, cpp]","+ print((-s))","- slove()","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3093440776,"measured_runtime_v1":0.1565137908,"runtime_lift":1.9764653063,"key":["s362357786","s175109634"]} +{"user_id":"u546285759","problem_id":"p00500","language":"python","submission_id_v0":"s199562246","submission_id_v1":"s512442556","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7644,"memory_v1":7672,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(input())\n\nscore = [list(map(int, input().split())) for _ in range(N)]\n\nplayers = [0 for _ in range(N)]\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += p\n\nprint(*players, sep='\\n')\n\n\n# optimized version of the same code:\n","target":"N = int(input())\n\nscore = [input().split() for _ in range(N)]\n\nplayers = [0]*N\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += int(p)\n\nprint(*players, sep='\\n')\n","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":264,"code_v1_num_chars":237,"code_v0_no_empty_lines":"N = int(input())\nscore = [list(map(int, input().split())) for _ in range(N)]\nplayers = [0 for _ in range(N)]\nfor play in list(zip(*score)):\n for i, p in enumerate(play):\n if play.count(p) == 1:\n players[i] += p\nprint(*players, sep=\"\\n\")\n","code_v1_no_empty_lines":"N = int(input())\nscore = [input().split() for _ in range(N)]\nplayers = [0] * N\nfor play in list(zip(*score)):\n for i, p in enumerate(play):\n if play.count(p) == 1:\n players[i] += int(p)\nprint(*players, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-score = [list(map(int, input().split())) for _ in range(N)]","-players = [0 for _ in range(N)]","+score = [input().split() for _ in range(N)]","+players = [0] * N","- players[i] += p","+ players[i] += int(p)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3026783457,"measured_runtime_v1":0.2355215042,"runtime_lift":1.2851410182,"key":["s199562246","s512442556"]} +{"user_id":"u363074342","problem_id":"p02690","language":"python","submission_id_v0":"s803789731","submission_id_v1":"s755247007","cpu_time_v0":1398,"cpu_time_v1":133,"memory_v0":11140,"memory_v1":9176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.49,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\n\n\npoypoyo = 'po'\n\nfor i in range(10000):\n\n for j in range(10000):\n\n if i**5 - j**5 == x:\n\n print((i,j))\n\n quit()\n\n break\n\n if i**5 - (-j)**5 ==x:\n\n print((i,-j))\n\n quit()\n\n break\n\n po = 'po'\n\n poypoyo += po\n\n\n\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\n\n\nfor i in range(10000):\n\n for j in range(1000):\n\n if i**5 - j**5 == x:\n\n print((i,j))\n\n quit()\n\n break\n\n if i**5 - (-j)**5 ==x:\n\n print((i,-j))\n\n quit()\n\n break\n\n\n\n\n","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":320,"code_v1_num_chars":263,"code_v0_no_empty_lines":"x = int(eval(input()))\npoypoyo = \"po\"\nfor i in range(10000):\n for j in range(10000):\n if i**5 - j**5 == x:\n print((i, j))\n quit()\n break\n if i**5 - (-j) ** 5 == x:\n print((i, -j))\n quit()\n break\n po = \"po\"\n poypoyo += po\n","code_v1_no_empty_lines":"x = int(eval(input()))\nfor i in range(10000):\n for j in range(1000):\n if i**5 - j**5 == x:\n print((i, j))\n quit()\n break\n if i**5 - (-j) ** 5 == x:\n print((i, -j))\n quit()\n break\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-poypoyo = \"po\"","- for j in range(10000):","+ for j in range(1000):","- po = \"po\"","- poypoyo += po"],"diff_only_import_comment":false,"measured_runtime_v0":0.3036803842,"measured_runtime_v1":0.2216325402,"runtime_lift":1.3701976426,"key":["s803789731","s755247007"]} +{"user_id":"u419963262","problem_id":"p03170","language":"python","submission_id_v0":"s690193516","submission_id_v1":"s176737022","cpu_time_v0":1807,"cpu_time_v1":395,"memory_v0":3828,"memory_v1":43416,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.14,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,k = list(map(int,input().split()))\n\narr = list(map(int,input().split()))\n\n\n\ndp = [False]*(k+1)\n\n\n\nfor stones in range(k+1):\n\n for x in arr:\n\n if stones >= x and dp[stones-x] == False:\n\n dp[stones] = True\n\n\n\nif dp[k]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")\n\n\n# optimized version of the same code:\n","target":"N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\n\n\ndp = [False]*(K+1)\n\n\n\nfor i in range(K+1):\n\n for j in range(N):\n\n if i-A[j]>=0 and dp[i-A[j]] == False:\n\n dp[i] = True\n\n\n\n \n\nif dp[K]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")","code_v0_loc":14,"code_v1_loc":15,"code_v0_num_chars":282,"code_v1_num_chars":280,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\narr = list(map(int, input().split()))\ndp = [False] * (k + 1)\nfor stones in range(k + 1):\n for x in arr:\n if stones >= x and dp[stones - x] == False:\n dp[stones] = True\nif dp[k]:\n print(\"First\")\nelse:\n print(\"Second\")\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\ndp = [False] * (K + 1)\nfor i in range(K + 1):\n for j in range(N):\n if i - A[j] >= 0 and dp[i - A[j]] == False:\n dp[i] = True\nif dp[K]:\n print(\"First\")\nelse:\n print(\"Second\")\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["-n, k = list(map(int, input().split()))","-arr = list(map(int, input().split()))","-dp = [False] * (k + 1)","-for stones in range(k + 1):","- for x in arr:","- if stones >= x and dp[stones - x] == False:","- dp[stones] = True","-if dp[k]:","+N, K = list(map(int, input().split()))","+A = list(map(int, input().split()))","+dp = [False] * (K + 1)","+for i in range(K + 1):","+ for j in range(N):","+ if i - A[j] >= 0 and dp[i - A[j]] == False:","+ dp[i] = True","+if dp[K]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2082244466,"measured_runtime_v1":0.0065503952,"runtime_lift":31.7880739295,"key":["s690193516","s176737022"]} +{"user_id":"u179169725","problem_id":"p02780","language":"python","submission_id_v0":"s465820766","submission_id_v1":"s149560631","cpu_time_v0":414,"cpu_time_v1":235,"memory_v0":27932,"memory_v1":25720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.24,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nread = sys.stdin.readline\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\ndef read_a_int():\n\n return int(read())\n\n\n\n\n\ndef read_matrix(H):\n\n '''\n\n H is number of rows\n\n '''\n\n return [list(map(int, read().split())) for _ in range(H)]\n\n\n\n\n\ndef read_map(H):\n\n '''\n\n H is number of rows\n\n \u6587\u5b57\u5217\u3067\u4e0e\u3048\u3089\u308c\u305f\u76e4\u9762\u3092\u8aad\u307f\u53d6\u308b\u7528\n\n '''\n\n return [read()[:-1] for _ in range(H)]\n\n\n\n\n\ndef read_tuple(H):\n\n '''\n\n H is number of rows\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(tuple(map(int, read().split())))\n\n return ret\n\n\n\n\n\ndef read_col(H, n_cols):\n\n '''\n\n H is number of rows\n\n n_cols is number of cols\n\n\n\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n\n '''\n\n ret = [[] for _ in range(n_cols)]\n\n for _ in range(H):\n\n tmp = list(map(int, read().split()))\n\n for col in range(n_cols):\n\n ret[col].append(tmp[col])\n\n\n\n return ret\n\n\n\n\n\nN, K = read_ints()\n\nP = read_ints()\n\n\n\n\n\ndef ret_mean(X):\n\n return (X + 1) \/ 2\n\n\n\n\n\n\n\n\n\nimport numpy as np\n\nP_mean = np.array([ret_mean(p) for p in P])\n\nP_accum = np.zeros(N+1)\n\nP_accum[1:] = P_mean.cumsum()\n\n\n\nans = 0\n\n# print(P_accum)\n\nfor i in range(N - K + 1):\n\n j = i + K\n\n ans = max(ans, P_accum[j] - P_accum[i])\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.readline\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\ndef read_a_int():\n\n return int(read())\n\n\n\n\n\ndef read_matrix(H):\n\n '''\n\n H is number of rows\n\n '''\n\n return [list(map(int, read().split())) for _ in range(H)]\n\n\n\n\n\ndef read_map(H):\n\n '''\n\n H is number of rows\n\n \u6587\u5b57\u5217\u3067\u4e0e\u3048\u3089\u308c\u305f\u76e4\u9762\u3092\u8aad\u307f\u53d6\u308b\u7528\n\n '''\n\n return [read()[:-1] for _ in range(H)]\n\n\n\n\n\ndef read_tuple(H):\n\n '''\n\n H is number of rows\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(tuple(map(int, read().split())))\n\n return ret\n\n\n\n\n\ndef read_col(H, n_cols):\n\n '''\n\n H is number of rows\n\n n_cols is number of cols\n\n\n\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n\n '''\n\n ret = [[] for _ in range(n_cols)]\n\n for _ in range(H):\n\n tmp = list(map(int, read().split()))\n\n for col in range(n_cols):\n\n ret[col].append(tmp[col])\n\n\n\n return ret\n\n\n\n\n\nN, K = read_ints()\n\nP = read_ints()\n\n\n\n\n\ndef ret_mean(X):\n\n return (X + 1) \/ 2\n\n\n\n\n\n\n\nclass cumsum1d:\n\n def __init__(self, ls: list):\n\n '''\n\n 1\u6b21\u5143\u30ea\u30b9\u30c8\u3092\u53d7\u3051\u53d6\u308b\n\n '''\n\n from itertools import accumulate\n\n self.ls_accum = [0] + list(accumulate(ls))\n\n\n\n def total(self, i, j):\n\n # \u3082\u3068\u306e\u914d\u5217ls\u306b\u304a\u3051\u308b[i,j)\u306e\u4e2d\u5408\u8a08\n\n return self.ls_accum[j] - self.ls_accum[i]\n\n \n\nP_mean = [ret_mean(p) for p in P]\n\nP_accum = cumsum1d(P_mean)\n\n\n\nans = 0\n\n# print(P_accum)\n\nfor i in range(N - K + 1):\n\n j = i + K\n\n ans = max(ans, P_accum.total(i,j))\n\nprint(ans)\n","code_v0_loc":74,"code_v1_loc":83,"code_v0_num_chars":1260,"code_v1_num_chars":1510,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_a_int():\n return int(read())\n\n\ndef read_matrix(H):\n \"\"\"\n H is number of rows\n \"\"\"\n return [list(map(int, read().split())) for _ in range(H)]\n\n\ndef read_map(H):\n \"\"\"\n H is number of rows\n \u6587\u5b57\u5217\u3067\u4e0e\u3048\u3089\u308c\u305f\u76e4\u9762\u3092\u8aad\u307f\u53d6\u308b\u7528\n \"\"\"\n return [read()[:-1] for _ in range(H)]\n\n\ndef read_tuple(H):\n \"\"\"\n H is number of rows\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, read().split())))\n return ret\n\n\ndef read_col(H, n_cols):\n \"\"\"\n H is number of rows\n n_cols is number of cols\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n \"\"\"\n ret = [[] for _ in range(n_cols)]\n for _ in range(H):\n tmp = list(map(int, read().split()))\n for col in range(n_cols):\n ret[col].append(tmp[col])\n return ret\n\n\nN, K = read_ints()\nP = read_ints()\n\n\ndef ret_mean(X):\n return (X + 1) \/ 2\n\n\nimport numpy as np\n\nP_mean = np.array([ret_mean(p) for p in P])\nP_accum = np.zeros(N + 1)\nP_accum[1:] = P_mean.cumsum()\nans = 0\n# print(P_accum)\nfor i in range(N - K + 1):\n j = i + K\n ans = max(ans, P_accum[j] - P_accum[i])\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_a_int():\n return int(read())\n\n\ndef read_matrix(H):\n \"\"\"\n H is number of rows\n \"\"\"\n return [list(map(int, read().split())) for _ in range(H)]\n\n\ndef read_map(H):\n \"\"\"\n H is number of rows\n \u6587\u5b57\u5217\u3067\u4e0e\u3048\u3089\u308c\u305f\u76e4\u9762\u3092\u8aad\u307f\u53d6\u308b\u7528\n \"\"\"\n return [read()[:-1] for _ in range(H)]\n\n\ndef read_tuple(H):\n \"\"\"\n H is number of rows\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, read().split())))\n return ret\n\n\ndef read_col(H, n_cols):\n \"\"\"\n H is number of rows\n n_cols is number of cols\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n \"\"\"\n ret = [[] for _ in range(n_cols)]\n for _ in range(H):\n tmp = list(map(int, read().split()))\n for col in range(n_cols):\n ret[col].append(tmp[col])\n return ret\n\n\nN, K = read_ints()\nP = read_ints()\n\n\ndef ret_mean(X):\n return (X + 1) \/ 2\n\n\nclass cumsum1d:\n def __init__(self, ls: list):\n \"\"\"\n 1\u6b21\u5143\u30ea\u30b9\u30c8\u3092\u53d7\u3051\u53d6\u308b\n \"\"\"\n from itertools import accumulate\n\n self.ls_accum = [0] + list(accumulate(ls))\n\n def total(self, i, j):\n # \u3082\u3068\u306e\u914d\u5217ls\u306b\u304a\u3051\u308b[i,j)\u306e\u4e2d\u5408\u8a08\n return self.ls_accum[j] - self.ls_accum[i]\n\n\nP_mean = [ret_mean(p) for p in P]\nP_accum = cumsum1d(P_mean)\nans = 0\n# print(P_accum)\nfor i in range(N - K + 1):\n j = i + K\n ans = max(ans, P_accum.total(i, j))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":10.843373494,"diff":["-import numpy as np","+class cumsum1d:","+ def __init__(self, ls: list):","+ \"\"\"","+ 1\u6b21\u5143\u30ea\u30b9\u30c8\u3092\u53d7\u3051\u53d6\u308b","+ \"\"\"","+ from itertools import accumulate","-P_mean = np.array([ret_mean(p) for p in P])","-P_accum = np.zeros(N + 1)","-P_accum[1:] = P_mean.cumsum()","+ self.ls_accum = [0] + list(accumulate(ls))","+","+ def total(self, i, j):","+ # \u3082\u3068\u306e\u914d\u5217ls\u306b\u304a\u3051\u308b[i,j)\u306e\u4e2d\u5408\u8a08","+ return self.ls_accum[j] - self.ls_accum[i]","+","+","+P_mean = [ret_mean(p) for p in P]","+P_accum = cumsum1d(P_mean)","- ans = max(ans, P_accum[j] - P_accum[i])","+ ans = max(ans, P_accum.total(i, j))"],"diff_only_import_comment":false,"measured_runtime_v0":1.407651695,"measured_runtime_v1":0.2221130846,"runtime_lift":6.3375451193,"key":["s465820766","s149560631"]} +{"user_id":"u579833671","problem_id":"p02419","language":"python","submission_id_v0":"s913061371","submission_id_v1":"s394956399","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4220,"memory_v1":4212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nW = input().lower()\n\ns = []\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n s.append(T[i].lower())\n\nans = 0\n\nfor i in range(len(s)):\n\n if(s[i] == W):\n\n ans += 1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"W = input().lower()\n\ns = []\n\nans = 0\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n if(W == T[i].lower()):\n\n ans += 1\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":294,"code_v1_num_chars":257,"code_v0_no_empty_lines":"W = input().lower()\ns = []\nwhile True:\n T = list(map(str, input().split()))\n if T[0] == \"END_OF_TEXT\":\n break\n else:\n for i in range(len(T)):\n s.append(T[i].lower())\nans = 0\nfor i in range(len(s)):\n if s[i] == W:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"W = input().lower()\ns = []\nans = 0\nwhile True:\n T = list(map(str, input().split()))\n if T[0] == \"END_OF_TEXT\":\n break\n else:\n for i in range(len(T)):\n if W == T[i].lower():\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+ans = 0","- s.append(T[i].lower())","-ans = 0","-for i in range(len(s)):","- if s[i] == W:","- ans += 1","+ if W == T[i].lower():","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.1894613738,"measured_runtime_v1":0.0060594826,"runtime_lift":31.2669227389,"key":["s913061371","s394956399"]} +{"user_id":"u860002137","problem_id":"p02702","language":"python","submission_id_v0":"s837932378","submission_id_v1":"s385994697","cpu_time_v0":458,"cpu_time_v1":162,"memory_v0":30188,"memory_v1":23528,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.63,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\ns = input()[::-1]\n\nlength = len(s)\n\na = np.zeros(length, dtype=int)\n\nd = np.zeros(length, dtype=int)\n\nans = np.zeros(2019, dtype=int)\n\nx = 10\n\n\n\na[0] = int(s[0])\n\nd[0] = a[0]\n\nans[d[0]] += 1\n\n\n\nfor i in range(1, length):\n\n a[i] = int(s[i]) * x % 2019\n\n d[i] = (d[i-1] + a[i]) % 2019\n\n ans[d[i]] += 1\n\n x = x * 10 % 2019\n\n\n\nans_c = ans[np.nonzero(ans)]\n\n\n\nprint((int(sum([ans_c[i] * (ans_c[i]-1) for i in range(ans_c.shape[0])]) \/ 2) + ans[0]))\n\n# optimized version of the same code:\n","target":"s = input()[::-1]\n\nlength = len(s)\n\na = [0] * length\n\nd = [0] * length\n\nans = [0] * 2019\n\nx = 10\n\n\n\na[0] = int(s[0])\n\nd[0] = a[0]\n\nans[d[0]] += 1\n\n\n\nfor i in range(1, length):\n\n a[i] = int(s[i]) * x % 2019\n\n d[i] = (d[i-1] + a[i]) % 2019\n\n ans[d[i]] += 1\n\n x = x * 10 % 2019\n\n\n\nprint((int(sum([ans[i] * (ans[i]-1) for i in range(2019)]) \/ 2) + ans[0]))","code_v0_loc":22,"code_v1_loc":18,"code_v0_num_chars":475,"code_v1_num_chars":362,"code_v0_no_empty_lines":"import numpy as np\n\ns = input()[::-1]\nlength = len(s)\na = np.zeros(length, dtype=int)\nd = np.zeros(length, dtype=int)\nans = np.zeros(2019, dtype=int)\nx = 10\na[0] = int(s[0])\nd[0] = a[0]\nans[d[0]] += 1\nfor i in range(1, length):\n a[i] = int(s[i]) * x % 2019\n d[i] = (d[i - 1] + a[i]) % 2019\n ans[d[i]] += 1\n x = x * 10 % 2019\nans_c = ans[np.nonzero(ans)]\nprint(\n (int(sum([ans_c[i] * (ans_c[i] - 1) for i in range(ans_c.shape[0])]) \/ 2) + ans[0])\n)\n","code_v1_no_empty_lines":"s = input()[::-1]\nlength = len(s)\na = [0] * length\nd = [0] * length\nans = [0] * 2019\nx = 10\na[0] = int(s[0])\nd[0] = a[0]\nans[d[0]] += 1\nfor i in range(1, length):\n a[i] = int(s[i]) * x % 2019\n d[i] = (d[i - 1] + a[i]) % 2019\n ans[d[i]] += 1\n x = x * 10 % 2019\nprint((int(sum([ans[i] * (ans[i] - 1) for i in range(2019)]) \/ 2) + ans[0]))\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-import numpy as np","-","-a = np.zeros(length, dtype=int)","-d = np.zeros(length, dtype=int)","-ans = np.zeros(2019, dtype=int)","+a = [0] * length","+d = [0] * length","+ans = [0] * 2019","-ans_c = ans[np.nonzero(ans)]","-print(","- (int(sum([ans_c[i] * (ans_c[i] - 1) for i in range(ans_c.shape[0])]) \/ 2) + ans[0])","-)","+print((int(sum([ans[i] * (ans[i] - 1) for i in range(2019)]) \/ 2) + ans[0]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3979822321,"measured_runtime_v1":0.206037255,"runtime_lift":6.785094432,"key":["s837932378","s385994697"]} +{"user_id":"u353797797","problem_id":"p03273","language":"python","submission_id_v0":"s255169106","submission_id_v1":"s752105173","cpu_time_v0":312,"cpu_time_v1":25,"memory_v0":21368,"memory_v1":4596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.99,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nh,w=map(int,input().split())\n\nt=[list(input()) for _ in range(h)]\n\nfor i in range(h):\n\n t[i]=[(tij==\"#\")*1 for tij in t[i]]\n\nt=np.array(t,dtype=\"i2\")\n\nrows=[]\n\ncolumns=[]\n\nfor i in range(h):\n\n if np.sum(t[i])==0:\n\n rows+=[i]\n\nfor j in range(w):\n\n if np.sum(t[:,j])==0:\n\n columns+=[j]\n\nt=np.delete(t,rows,0)\n\nt=np.delete(t,columns,1)\n\nfor i in range(h-len(rows)):\n\n print(*[\"#\" if tij else \".\" for tij in t[i]],sep=\"\")\n\n\n# optimized version of the same code:\n","target":"h,w=map(int,input().split())\n\nt=[list(input()) for _ in range(h)]\n\nfor i in range(h):\n\n t[i]=[(tij==\"#\")*1 for tij in t[i]]\n\nrows=[]\n\ncolumns=[]\n\nfor i,ti in enumerate(t):\n\n if sum(ti)==0:\n\n rows+=[i]\n\nfor j,tj in enumerate(zip(*t)):\n\n if sum(tj)==0:\n\n columns+=[j]\n\nnt=[]\n\nfor i,ti in enumerate(t):\n\n if i in rows:continue\n\n nti=[]\n\n for j,tij in enumerate(ti):\n\n if j in columns:continue\n\n nti+=[\"#\" if tij else \".\"]\n\n print(*nti,sep=\"\")\n","code_v0_loc":18,"code_v1_loc":20,"code_v0_num_chars":464,"code_v1_num_chars":489,"code_v0_no_empty_lines":"import numpy as np\n\nh, w = map(int, input().split())\nt = [list(input()) for _ in range(h)]\nfor i in range(h):\n t[i] = [(tij == \"#\") * 1 for tij in t[i]]\nt = np.array(t, dtype=\"i2\")\nrows = []\ncolumns = []\nfor i in range(h):\n if np.sum(t[i]) == 0:\n rows += [i]\nfor j in range(w):\n if np.sum(t[:, j]) == 0:\n columns += [j]\nt = np.delete(t, rows, 0)\nt = np.delete(t, columns, 1)\nfor i in range(h - len(rows)):\n print(*[\"#\" if tij else \".\" for tij in t[i]], sep=\"\")\n","code_v1_no_empty_lines":"h, w = map(int, input().split())\nt = [list(input()) for _ in range(h)]\nfor i in range(h):\n t[i] = [(tij == \"#\") * 1 for tij in t[i]]\nrows = []\ncolumns = []\nfor i, ti in enumerate(t):\n if sum(ti) == 0:\n rows += [i]\nfor j, tj in enumerate(zip(*t)):\n if sum(tj) == 0:\n columns += [j]\nnt = []\nfor i, ti in enumerate(t):\n if i in rows:\n continue\n nti = []\n for j, tij in enumerate(ti):\n if j in columns:\n continue\n nti += [\"#\" if tij else \".\"]\n print(*nti, sep=\"\")\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-import numpy as np","-","-t = np.array(t, dtype=\"i2\")","-for i in range(h):","- if np.sum(t[i]) == 0:","+for i, ti in enumerate(t):","+ if sum(ti) == 0:","-for j in range(w):","- if np.sum(t[:, j]) == 0:","+for j, tj in enumerate(zip(*t)):","+ if sum(tj) == 0:","-t = np.delete(t, rows, 0)","-t = np.delete(t, columns, 1)","-for i in range(h - len(rows)):","- print(*[\"#\" if tij else \".\" for tij in t[i]], sep=\"\")","+nt = []","+for i, ti in enumerate(t):","+ if i in rows:","+ continue","+ nti = []","+ for j, tij in enumerate(ti):","+ if j in columns:","+ continue","+ nti += [\"#\" if tij else \".\"]","+ print(*nti, sep=\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":1.9158326536,"measured_runtime_v1":0.3161913253,"runtime_lift":6.0590930236,"key":["s255169106","s752105173"]} +{"user_id":"u919633157","problem_id":"p03796","language":"python","submission_id_v0":"s593917202","submission_id_v1":"s901232961","cpu_time_v0":230,"cpu_time_v1":42,"memory_v0":3980,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nprint((math.factorial(int(eval(input())))%(10**9+7)))\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\nans=1\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans%=10**9+7\n\nprint(ans)","code_v0_loc":2,"code_v1_loc":6,"code_v0_num_chars":58,"code_v1_num_chars":87,"code_v0_no_empty_lines":"import math\n\nprint((math.factorial(int(eval(input()))) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= 10**9 + 7\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-import math","-","-print((math.factorial(int(eval(input()))) % (10**9 + 7)))","+n = int(eval(input()))","+ans = 1","+for i in range(1, n + 1):","+ ans *= i","+ ans %= 10**9 + 7","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.9124054093,"measured_runtime_v1":0.4053284261,"runtime_lift":2.2510274398,"key":["s593917202","s901232961"]} +{"user_id":"u414980766","problem_id":"p02773","language":"python","submission_id_v0":"s498649498","submission_id_v1":"s794455280","cpu_time_v0":480,"cpu_time_v1":421,"memory_v0":47872,"memory_v1":43256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nS = sorted(S)\n\nls = [[] for i in range(N + 1)]\n\nmax_num = 0\n\nleft = 0\n\nright = 0\n\nwhile right < N:\n\n while right < N and S[left] == S[right]:\n\n right += 1\n\n if (right - left) >= max_num:\n\n ls[right - left].append(S[left].decode())\n\n max_num = right - left\n\n left = right\n\n \n\nprint(('\\n'.join(ls[max_num])))\n\n\n# optimized version of the same code:\n","target":"from collections import Counter\n\n\n\nimport sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nres = []\n\nc = Counter(S)\n\nmax_num = c.most_common(1)[0][1]\n\nfor i, j in list(c.items()):\n\n if j == max_num:\n\n res.append(i)\n\n \n\nres.sort()\n\n\n\n \n\nprint(('\\n'.join(list([x.decode() for x in res]))))\n","code_v0_loc":21,"code_v1_loc":20,"code_v0_num_chars":502,"code_v1_num_chars":421,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nS = read().split()\nS = sorted(S)\nls = [[] for i in range(N + 1)]\nmax_num = 0\nleft = 0\nright = 0\nwhile right < N:\n while right < N and S[left] == S[right]:\n right += 1\n if (right - left) >= max_num:\n ls[right - left].append(S[left].decode())\n max_num = right - left\n left = right\nprint((\"\\n\".join(ls[max_num])))\n","code_v1_no_empty_lines":"from collections import Counter\nimport sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nS = read().split()\nres = []\nc = Counter(S)\nmax_num = c.most_common(1)[0][1]\nfor i, j in list(c.items()):\n if j == max_num:\n res.append(i)\nres.sort()\nprint((\"\\n\".join(list([x.decode() for x in res]))))\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["+from collections import Counter","-S = sorted(S)","-ls = [[] for i in range(N + 1)]","-max_num = 0","-left = 0","-right = 0","-while right < N:","- while right < N and S[left] == S[right]:","- right += 1","- if (right - left) >= max_num:","- ls[right - left].append(S[left].decode())","- max_num = right - left","- left = right","-print((\"\\n\".join(ls[max_num])))","+res = []","+c = Counter(S)","+max_num = c.most_common(1)[0][1]","+for i, j in list(c.items()):","+ if j == max_num:","+ res.append(i)","+res.sort()","+print((\"\\n\".join(list([x.decode() for x in res]))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2394288239,"measured_runtime_v1":0.0062145643,"runtime_lift":38.5270488971,"key":["s498649498","s794455280"]} +{"user_id":"u077291787","problem_id":"p03164","language":"python","submission_id_v0":"s644346369","submission_id_v1":"s649660252","cpu_time_v0":472,"cpu_time_v1":351,"memory_v0":93244,"memory_v1":70732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# temp\n\nn,w = list(map(int,input().split()))\n\nwv = [tuple(map(int,input().split())) for i in range(n)]\n\n\n\ndp = [0] + [float(\"inf\")]*(10**5)\n\nfor i in range(n):\n\n for j in range(10**5,wv[i][1]-1,-1):\n\n dp[j] = min(dp[j],dp[j-wv[i][1]]+wv[i][0])\n\n\n\nres = 0\n\nfor v,e in enumerate(dp):\n\n if e <= w:\n\n res = v\n\nprint(res)\n\n# optimized version of the same code:\n","target":"# dpE - Knapsack 2\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, W = tuple(map(int, input().rstrip().split()))\n\n A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))\n\n _, v = list(zip(*A))\n\n lim = sum(v)\n\n dp = [0] + [float(\"inf\")] * lim\n\n for i in range(n):\n\n for j in range(lim, A[i][1] - 1, -1):\n\n dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])\n\n ans = max(v for v, w in enumerate(dp) if w <= W)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":14,"code_v1_loc":19,"code_v0_num_chars":330,"code_v1_num_chars":522,"code_v0_no_empty_lines":"# temp\nn, w = list(map(int, input().split()))\nwv = [tuple(map(int, input().split())) for i in range(n)]\ndp = [0] + [float(\"inf\")] * (10**5)\nfor i in range(n):\n for j in range(10**5, wv[i][1] - 1, -1):\n dp[j] = min(dp[j], dp[j - wv[i][1]] + wv[i][0])\nres = 0\nfor v, e in enumerate(dp):\n if e <= w:\n res = v\nprint(res)\n","code_v1_no_empty_lines":"# dpE - Knapsack 2\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, W = tuple(map(int, input().rstrip().split()))\n A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))\n _, v = list(zip(*A))\n lim = sum(v)\n dp = [0] + [float(\"inf\")] * lim\n for i in range(n):\n for j in range(lim, A[i][1] - 1, -1):\n dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])\n ans = max(v for v, w in enumerate(dp) if w <= W)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":26.3157894737,"diff":["-# temp","-n, w = list(map(int, input().split()))","-wv = [tuple(map(int, input().split())) for i in range(n)]","-dp = [0] + [float(\"inf\")] * (10**5)","-for i in range(n):","- for j in range(10**5, wv[i][1] - 1, -1):","- dp[j] = min(dp[j], dp[j - wv[i][1]] + wv[i][0])","-res = 0","-for v, e in enumerate(dp):","- if e <= w:","- res = v","-print(res)","+# dpE - Knapsack 2","+import sys","+","+input = sys.stdin.readline","+","+","+def main():","+ n, W = tuple(map(int, input().rstrip().split()))","+ A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))","+ _, v = list(zip(*A))","+ lim = sum(v)","+ dp = [0] + [float(\"inf\")] * lim","+ for i in range(n):","+ for j in range(lim, A[i][1] - 1, -1):","+ dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])","+ ans = max(v for v, w in enumerate(dp) if w <= W)","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":1.6859776349,"measured_runtime_v1":0.2345220137,"runtime_lift":7.1889952184,"key":["s644346369","s649660252"]} +{"user_id":"u021548497","problem_id":"p02555","language":"python","submission_id_v0":"s983449721","submission_id_v1":"s321084928","cpu_time_v0":330,"cpu_time_v1":30,"memory_v0":9192,"memory_v1":9108,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n n = int(eval(input()))\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(n+1):\n\n for j in range(i-2):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n# optimized version of the same code:\n","target":"def main():\n\n n = int(eval(input()))\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(3, n+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":15,"code_v1_loc":14,"code_v0_num_chars":242,"code_v1_num_chars":226,"code_v0_no_empty_lines":"def main():\n n = int(eval(input()))\n dp = [0] * (n + 1)\n dp[0] = 1\n mod = pow(10, 9) + 7\n for i in range(n + 1):\n for j in range(i - 2):\n dp[i] += dp[j]\n dp[i] %= mod\n print((dp[n]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n dp = [0] * (n + 1)\n dp[0] = 1\n mod = pow(10, 9) + 7\n for i in range(3, n + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n dp[i] %= mod\n print((dp[n]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["- for i in range(n + 1):","- for j in range(i - 2):","- dp[i] += dp[j]","- dp[i] %= mod","+ for i in range(3, n + 1):","+ dp[i] = dp[i - 1] + dp[i - 3]","+ dp[i] %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.6721006331,"measured_runtime_v1":0.344866425,"runtime_lift":1.9488723295,"key":["s983449721","s321084928"]} +{"user_id":"u588341295","problem_id":"p03253","language":"python","submission_id_v0":"s242527358","submission_id_v1":"s893815197","cpu_time_v0":171,"cpu_time_v1":71,"memory_v0":19188,"memory_v1":11240,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\n\n\"\"\"\n\n\u53c2\u8003\uff1ahttp:\/\/drken1215.hatenablog.com\/entry\/2018\/09\/23\/224100\n\n\u3000\u3000\u3000http:\/\/tutuz.hateblo.jp\/entry\/2018\/09\/24\/121248\n\n\u30fb\u7d20\u56e0\u6570\u5206\u89e3\u3068\u91cd\u8907\u7d44\u307f\u5408\u308f\u305b\n\n\u30fb\u6bce\u56de\u968e\u4e57\u3084\u308b\u3068\u6b7b\u306c\u304b\u3089\u968e\u4e57\u3068\u9006\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u4f5c\u308b(\u5fd8\u308c\u3066\u305f)\n\n\"\"\"\n\n\n\nfrom collections import defaultdict\n\nfrom math import sqrt\n\n\n\nMOD = 10 ** 9 + 7\n\n\n\ndef fact_prime(num):\n\n d = defaultdict(int)\n\n # \u7d42\u70b9\u306f\u30eb\u30fc\u30c8\u5207\u308a\u6368\u3066+1\n\n end = int(sqrt(num)) + 1\n\n for i in range(2, end+1):\n\n cnt = 0\n\n # \u7d20\u56e0\u6570\u5206\u89e3\uff1a\u5c0f\u3055\u3044\u65b9\u304b\u3089\u5272\u308c\u308b\u3060\u3051\u5272\u3063\u3066\u7d20\u6570\u3092\u30ab\u30a6\u30f3\u30c8\n\n while num % i == 0:\n\n num \/\/= i\n\n d[i] += 1\n\n # 1\u307e\u3067\u6765\u305f\u3089\u7d42\u4e86\n\n if num == 1:\n\n break\n\n # \u6700\u5f8c\u307e\u3067\u305d\u306e\u307e\u307e\u6765\u305f\u3084\u3064\u306fnum\u304c\u7d20\u6570(\u305f\u3060\u30571^1\u306f1^0\u306a\u306e\u3067\u6570\u306b\u5165\u308c\u306a\u3044)\n\n if num != 1:\n\n d[num] += 1\n\n return d\n\n\n\n# \u3068\u308a\u3042\u3048\u305av+N-1\u304c\u53ce\u307e\u308c\u3070\u3044\u3044\u306f\u305a\n\nMAX = 10 ** 5 * 2\n\n# \u4e88\u3081\u7d44\u307f\u5408\u308f\u305b\u8a08\u7b97\u306b\u5fc5\u8981\u306a\u968e\u4e57\u3068\u9006\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u3063\u3066\u304a\u304f\n\nfactorial = [1] * (MAX)\n\nfactorial[0] = factorial[1] = 1\n\nfor i in range(2, MAX):\n\n factorial[i] = factorial[i-1] * i % MOD\n\n\n\ninverse = [1] * (MAX)\n\n# pow\u306b\u7b2c\u4e09\u5f15\u6570\u5165\u308c\u308b\u3068\u51aa\u4e57\u306emod\u4ed8\u8a08\u7b97\u3092\u9ad8\u901f\u306b\u3084\u3063\u3066\u304f\u308c\u308b\n\ninverse[MAX-1] = pow(factorial[MAX-1], MOD-2, MOD)\n\nfor i in range(MAX-2, 0, -1):\n\n # \u6700\u5f8c\u304b\u3089\u623b\u3063\u3066\u3044\u304f\u3053\u306e\u30eb\u30fc\u30d7\u306a\u3089H+W\u56depow\u3059\u308b\u3088\u308a\u51e6\u7406\u304c\u901f\u3044\n\n inverse[i] = inverse[i+1] * (i+1) % MOD\n\n\n\n# \u7d44\u307f\u5408\u308f\u305b\u306e\u6570\n\ndef nCr(n, r):\n\n # 10C7 = 10C3\n\n r = min(r, n-r)\n\n # \u5206\u5b50\u306e\u8a08\u7b97\n\n numerator = factorial[n]\n\n # \u5206\u6bcd\u306e\u8a08\u7b97\n\n denominator = inverse[r] * inverse[n-r] % MOD\n\n return numerator * denominator % MOD\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\n# d = fact_prime(M)\n\n# print(d)\n\nans = 1\n\nfor k, v in list(fact_prime(M).items()):\n\n # \u91cd\u8907\u7d44\u307f\u5408\u308f\u305b\n\n # v\u500b\u306ek\u3068N-1\u500b\u306e\u4ed5\u5207\u308a\u304b\u3089\u3001v\u500b\u3092\u4e26\u3079\u308b(v+N-1\u500b\u306e\u30de\u30b9\u304b\u3089v\u500b\u3092\u9078\u3073\u51fa\u3059\u7d44\u307f\u5408\u308f\u305b)\n\n ans = (ans * nCr(v+N-1, v)) % MOD\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\ndef factorize(num: int) -> dict:\n\n \"\"\" \u7d20\u56e0\u6570\u5206\u89e3 \"\"\"\n\n from math import sqrt\n\n from collections import Counter\n\n\n\n d = Counter()\n\n # \u7d42\u70b9\u306f\u30eb\u30fc\u30c8\u5207\u308a\u6368\u3066+1\n\n for i in range(2, int(sqrt(num))+1):\n\n # \u7d20\u56e0\u6570\u5206\u89e3\uff1a\u5c0f\u3055\u3044\u65b9\u304b\u3089\u5272\u308c\u308b\u3060\u3051\u5272\u3063\u3066\u7d20\u6570\u3092\u30ab\u30a6\u30f3\u30c8\n\n while num % i == 0:\n\n num \/\/= i\n\n d[i] += 1\n\n # 1\u307e\u3067\u5206\u89e3\u3057\u305f\u3089\u7d42\u4e86\n\n if num == 1:\n\n break\n\n # \u6700\u5f8c\u306b\u6b8b\u3063\u305fnum\u306f\u7d20\u6570(\u305f\u3060\u30571^1\u306f1^0\u306a\u306e\u3067\u6570\u306b\u5165\u308c\u306a\u3044)\n\n if num != 1:\n\n d[num] += 1\n\n return d\n\n\n\nclass FactInvMOD:\n\n \"\"\" \u968e\u4e57\u305f\u304f\u3055\u3093\u4f7f\u3046\u6642\u7528\u306e\u30c6\u30fc\u30d6\u30eb\u6e96\u5099 \"\"\"\n\n\n\n def __init__(self, MAX, MOD):\n\n \"\"\" MAX\uff1a\u968e\u4e57\u306b\u4f7f\u3046\u6570\u5024\u306e\u6700\u5927\u4ee5\u4e0a\u307e\u3067\u4f5c\u308b \"\"\"\n\n \n\n MAX += 1\n\n self.MAX = MAX\n\n self.MOD = MOD\n\n # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\n\n factorial = [1] * MAX\n\n factorial[0] = factorial[1] = 1\n\n for i in range(2, MAX):\n\n factorial[i] = factorial[i-1] * i % MOD\n\n # \u968e\u4e57\u306e\u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\n inverse = [1] * MAX\n\n # pow\u306b\u7b2c\u4e09\u5f15\u6570\u5165\u308c\u308b\u3068\u51aa\u4e57\u306emod\u4ed8\u8a08\u7b97\u3092\u9ad8\u901f\u306b\u3084\u3063\u3066\u304f\u308c\u308b\n\n inverse[MAX-1] = pow(factorial[MAX-1], MOD-2, MOD)\n\n for i in range(MAX-2, 0, -1):\n\n # \u6700\u5f8c\u304b\u3089\u623b\u3063\u3066\u3044\u304f\u3053\u306e\u30eb\u30fc\u30d7\u306a\u3089MAX\u56depow\u3059\u308b\u3088\u308a\u51e6\u7406\u304c\u901f\u3044\n\n inverse[i] = inverse[i+1] * (i+1) % MOD\n\n self.fact = factorial\n\n self.inv = inverse\n\n \n\n def nCr(self, n, r):\n\n \"\"\" \u7d44\u307f\u5408\u308f\u305b\u306e\u6570 (\u5fc5\u8981\u306a\u968e\u4e57\u3068\u9006\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4e8b\u524d\u306b\u4f5c\u3063\u3066\u304a\u304f) \"\"\"\n\n\n\n if n < r: return 0\n\n # 10C7 = 10C3\n\n r = min(r, n-r)\n\n # \u5206\u5b50\u306e\u8a08\u7b97\n\n numerator = self.fact[n]\n\n # \u5206\u6bcd\u306e\u8a08\u7b97\n\n denominator = self.inv[r] * self.inv[n-r] % self.MOD\n\n return numerator * denominator % self.MOD\n\n\n\n def nPr(self, n, r):\n\n \"\"\" \u9806\u5217 \"\"\"\n\n\n\n if n < r: return 0\n\n return self.fact[n] * self.inv[n-r] % self.MOD\n\n\n\n def nHr(self, n, r):\n\n \"\"\" \u91cd\u8907\u7d44\u307f\u5408\u308f\u305b \"\"\"\n\n\n\n # r\u500b\u9078\u3076\u3068\u3053\u308d\u306bN-1\u500b\u306e\u4ed5\u5207\u308a\u3092\u5165\u308c\u308b\n\n return self.nCr(r+n-1, r)\n\n\n\nN, M = MAP()\n\n\n\nd = factorize(M)\n\n\n\n# \u4f8b\u5916\u51e6\u7406\n\nif not d:\n\n print((1))\n\n exit()\n\n\n\nMAX = N + max(d.values())\n\nfim = FactInvMOD(MAX, MOD)\n\nans = 1\n\nfor k, v in list(d.items()):\n\n ans *= fim.nHr(N, v)\n\n ans %= MOD\n\nprint(ans)\n","code_v0_loc":67,"code_v1_loc":104,"code_v0_num_chars":1591,"code_v1_num_chars":2726,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\n\u53c2\u8003\uff1ahttp:\/\/drken1215.hatenablog.com\/entry\/2018\/09\/23\/224100\n\u3000\u3000\u3000http:\/\/tutuz.hateblo.jp\/entry\/2018\/09\/24\/121248\n\u30fb\u7d20\u56e0\u6570\u5206\u89e3\u3068\u91cd\u8907\u7d44\u307f\u5408\u308f\u305b\n\u30fb\u6bce\u56de\u968e\u4e57\u3084\u308b\u3068\u6b7b\u306c\u304b\u3089\u968e\u4e57\u3068\u9006\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u4f5c\u308b(\u5fd8\u308c\u3066\u305f)\n\"\"\"\nfrom collections import defaultdict\nfrom math import sqrt\n\nMOD = 10**9 + 7\n\n\ndef fact_prime(num):\n d = defaultdict(int)\n # \u7d42\u70b9\u306f\u30eb\u30fc\u30c8\u5207\u308a\u6368\u3066+1\n end = int(sqrt(num)) + 1\n for i in range(2, end + 1):\n cnt = 0\n # \u7d20\u56e0\u6570\u5206\u89e3\uff1a\u5c0f\u3055\u3044\u65b9\u304b\u3089\u5272\u308c\u308b\u3060\u3051\u5272\u3063\u3066\u7d20\u6570\u3092\u30ab\u30a6\u30f3\u30c8\n while num % i == 0:\n num \/\/= i\n d[i] += 1\n # 1\u307e\u3067\u6765\u305f\u3089\u7d42\u4e86\n if num == 1:\n break\n # \u6700\u5f8c\u307e\u3067\u305d\u306e\u307e\u307e\u6765\u305f\u3084\u3064\u306fnum\u304c\u7d20\u6570(\u305f\u3060\u30571^1\u306f1^0\u306a\u306e\u3067\u6570\u306b\u5165\u308c\u306a\u3044)\n if num != 1:\n d[num] += 1\n return d\n\n\n# \u3068\u308a\u3042\u3048\u305av+N-1\u304c\u53ce\u307e\u308c\u3070\u3044\u3044\u306f\u305a\nMAX = 10**5 * 2\n# \u4e88\u3081\u7d44\u307f\u5408\u308f\u305b\u8a08\u7b97\u306b\u5fc5\u8981\u306a\u968e\u4e57\u3068\u9006\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u3063\u3066\u304a\u304f\nfactorial = [1] * (MAX)\nfactorial[0] = factorial[1] = 1\nfor i in range(2, MAX):\n factorial[i] = factorial[i - 1] * i % MOD\ninverse = [1] * (MAX)\n# pow\u306b\u7b2c\u4e09\u5f15\u6570\u5165\u308c\u308b\u3068\u51aa\u4e57\u306emod\u4ed8\u8a08\u7b97\u3092\u9ad8\u901f\u306b\u3084\u3063\u3066\u304f\u308c\u308b\ninverse[MAX - 1] = pow(factorial[MAX - 1], MOD - 2, MOD)\nfor i in range(MAX - 2, 0, -1):\n # \u6700\u5f8c\u304b\u3089\u623b\u3063\u3066\u3044\u304f\u3053\u306e\u30eb\u30fc\u30d7\u306a\u3089H+W\u56depow\u3059\u308b\u3088\u308a\u51e6\u7406\u304c\u901f\u3044\n inverse[i] = inverse[i + 1] * (i + 1) % MOD\n# \u7d44\u307f\u5408\u308f\u305b\u306e\u6570\ndef nCr(n, r):\n # 10C7 = 10C3\n r = min(r, n - r)\n # \u5206\u5b50\u306e\u8a08\u7b97\n numerator = factorial[n]\n # \u5206\u6bcd\u306e\u8a08\u7b97\n denominator = inverse[r] * inverse[n - r] % MOD\n return numerator * denominator % MOD\n\n\nN, M = list(map(int, input().split()))\n# d = fact_prime(M)\n# print(d)\nans = 1\nfor k, v in list(fact_prime(M).items()):\n # \u91cd\u8907\u7d44\u307f\u5408\u308f\u305b\n # v\u500b\u306ek\u3068N-1\u500b\u306e\u4ed5\u5207\u308a\u304b\u3089\u3001v\u500b\u3092\u4e26\u3079\u308b(v+N-1\u500b\u306e\u30de\u30b9\u304b\u3089v\u500b\u3092\u9078\u3073\u51fa\u3059\u7d44\u307f\u5408\u308f\u305b)\n ans = (ans * nCr(v + N - 1, v)) % MOD\nprint(ans)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef list4d(a, b, c, d, e):\n return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x \/\/ y))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST(N=None):\n return list(MAP()) if N is None else [INT() for i in range(N)]\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef factorize(num: int) -> dict:\n \"\"\"\u7d20\u56e0\u6570\u5206\u89e3\"\"\"\n from math import sqrt\n from collections import Counter\n\n d = Counter()\n # \u7d42\u70b9\u306f\u30eb\u30fc\u30c8\u5207\u308a\u6368\u3066+1\n for i in range(2, int(sqrt(num)) + 1):\n # \u7d20\u56e0\u6570\u5206\u89e3\uff1a\u5c0f\u3055\u3044\u65b9\u304b\u3089\u5272\u308c\u308b\u3060\u3051\u5272\u3063\u3066\u7d20\u6570\u3092\u30ab\u30a6\u30f3\u30c8\n while num % i == 0:\n num \/\/= i\n d[i] += 1\n # 1\u307e\u3067\u5206\u89e3\u3057\u305f\u3089\u7d42\u4e86\n if num == 1:\n break\n # \u6700\u5f8c\u306b\u6b8b\u3063\u305fnum\u306f\u7d20\u6570(\u305f\u3060\u30571^1\u306f1^0\u306a\u306e\u3067\u6570\u306b\u5165\u308c\u306a\u3044)\n if num != 1:\n d[num] += 1\n return d\n\n\nclass FactInvMOD:\n \"\"\"\u968e\u4e57\u305f\u304f\u3055\u3093\u4f7f\u3046\u6642\u7528\u306e\u30c6\u30fc\u30d6\u30eb\u6e96\u5099\"\"\"\n\n def __init__(self, MAX, MOD):\n \"\"\"MAX\uff1a\u968e\u4e57\u306b\u4f7f\u3046\u6570\u5024\u306e\u6700\u5927\u4ee5\u4e0a\u307e\u3067\u4f5c\u308b\"\"\"\n MAX += 1\n self.MAX = MAX\n self.MOD = MOD\n # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\n factorial = [1] * MAX\n factorial[0] = factorial[1] = 1\n for i in range(2, MAX):\n factorial[i] = factorial[i - 1] * i % MOD\n # \u968e\u4e57\u306e\u9006\u5143\u30c6\u30fc\u30d6\u30eb\n inverse = [1] * MAX\n # pow\u306b\u7b2c\u4e09\u5f15\u6570\u5165\u308c\u308b\u3068\u51aa\u4e57\u306emod\u4ed8\u8a08\u7b97\u3092\u9ad8\u901f\u306b\u3084\u3063\u3066\u304f\u308c\u308b\n inverse[MAX - 1] = pow(factorial[MAX - 1], MOD - 2, MOD)\n for i in range(MAX - 2, 0, -1):\n # \u6700\u5f8c\u304b\u3089\u623b\u3063\u3066\u3044\u304f\u3053\u306e\u30eb\u30fc\u30d7\u306a\u3089MAX\u56depow\u3059\u308b\u3088\u308a\u51e6\u7406\u304c\u901f\u3044\n inverse[i] = inverse[i + 1] * (i + 1) % MOD\n self.fact = factorial\n self.inv = inverse\n\n def nCr(self, n, r):\n \"\"\"\u7d44\u307f\u5408\u308f\u305b\u306e\u6570 (\u5fc5\u8981\u306a\u968e\u4e57\u3068\u9006\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4e8b\u524d\u306b\u4f5c\u3063\u3066\u304a\u304f)\"\"\"\n if n < r:\n return 0\n # 10C7 = 10C3\n r = min(r, n - r)\n # \u5206\u5b50\u306e\u8a08\u7b97\n numerator = self.fact[n]\n # \u5206\u6bcd\u306e\u8a08\u7b97\n denominator = self.inv[r] * self.inv[n - r] % self.MOD\n return numerator * denominator % self.MOD\n\n def nPr(self, n, r):\n \"\"\"\u9806\u5217\"\"\"\n if n < r:\n return 0\n return self.fact[n] * self.inv[n - r] % self.MOD\n\n def nHr(self, n, r):\n \"\"\"\u91cd\u8907\u7d44\u307f\u5408\u308f\u305b\"\"\"\n # r\u500b\u9078\u3076\u3068\u3053\u308d\u306bN-1\u500b\u306e\u4ed5\u5207\u308a\u3092\u5165\u308c\u308b\n return self.nCr(r + n - 1, r)\n\n\nN, M = MAP()\nd = factorize(M)\n# \u4f8b\u5916\u51e6\u7406\nif not d:\n print((1))\n exit()\nMAX = N + max(d.values())\nfim = FactInvMOD(MAX, MOD)\nans = 1\nfor k, v in list(d.items()):\n ans *= fim.nHr(N, v)\n ans %= MOD\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":35.5769230769,"diff":["-\"\"\"","-\u53c2\u8003\uff1ahttp:\/\/drken1215.hatenablog.com\/entry\/2018\/09\/23\/224100","-\u3000\u3000\u3000http:\/\/tutuz.hateblo.jp\/entry\/2018\/09\/24\/121248","-\u30fb\u7d20\u56e0\u6570\u5206\u89e3\u3068\u91cd\u8907\u7d44\u307f\u5408\u308f\u305b","-\u30fb\u6bce\u56de\u968e\u4e57\u3084\u308b\u3068\u6b7b\u306c\u304b\u3089\u968e\u4e57\u3068\u9006\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u4f5c\u308b(\u5fd8\u308c\u3066\u305f)","-\"\"\"","-from collections import defaultdict","-from math import sqrt","+import sys","+","+def input():","+ return sys.stdin.readline().strip()","+","+","+def list2d(a, b, c):","+ return [[c] * b for i in range(a)]","+","+","+def list3d(a, b, c, d):","+ return [[[d] * c for j in range(b)] for i in range(a)]","+","+","+def list4d(a, b, c, d, e):","+ return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]","+","+","+def ceil(x, y=1):","+ return int(-(-x \/\/ y))","+","+","+def INT():","+ return int(eval(input()))","+","+","+def MAP():","+ return list(map(int, input().split()))","+","+","+def LIST(N=None):","+ return list(MAP()) if N is None else [INT() for i in range(N)]","+","+","+def Yes():","+ print(\"Yes\")","+","+","+def No():","+ print(\"No\")","+","+","+def YES():","+ print(\"YES\")","+","+","+def NO():","+ print(\"NO\")","+","+","+sys.setrecursionlimit(10**9)","+INF = float(\"inf\")","-def fact_prime(num):","- d = defaultdict(int)","+def factorize(num: int) -> dict:","+ \"\"\"\u7d20\u56e0\u6570\u5206\u89e3\"\"\"","+ from math import sqrt","+ from collections import Counter","+","+ d = Counter()","- end = int(sqrt(num)) + 1","- for i in range(2, end + 1):","- cnt = 0","+ for i in range(2, int(sqrt(num)) + 1):","- # 1\u307e\u3067\u6765\u305f\u3089\u7d42\u4e86","+ # 1\u307e\u3067\u5206\u89e3\u3057\u305f\u3089\u7d42\u4e86","- # \u6700\u5f8c\u307e\u3067\u305d\u306e\u307e\u307e\u6765\u305f\u3084\u3064\u306fnum\u304c\u7d20\u6570(\u305f\u3060\u30571^1\u306f1^0\u306a\u306e\u3067\u6570\u306b\u5165\u308c\u306a\u3044)","+ # \u6700\u5f8c\u306b\u6b8b\u3063\u305fnum\u306f\u7d20\u6570(\u305f\u3060\u30571^1\u306f1^0\u306a\u306e\u3067\u6570\u306b\u5165\u308c\u306a\u3044)","-# \u3068\u308a\u3042\u3048\u305av+N-1\u304c\u53ce\u307e\u308c\u3070\u3044\u3044\u306f\u305a","-MAX = 10**5 * 2","-# \u4e88\u3081\u7d44\u307f\u5408\u308f\u305b\u8a08\u7b97\u306b\u5fc5\u8981\u306a\u968e\u4e57\u3068\u9006\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u3063\u3066\u304a\u304f","-factorial = [1] * (MAX)","-factorial[0] = factorial[1] = 1","-for i in range(2, MAX):","- factorial[i] = factorial[i - 1] * i % MOD","-inverse = [1] * (MAX)","-# pow\u306b\u7b2c\u4e09\u5f15\u6570\u5165\u308c\u308b\u3068\u51aa\u4e57\u306emod\u4ed8\u8a08\u7b97\u3092\u9ad8\u901f\u306b\u3084\u3063\u3066\u304f\u308c\u308b","-inverse[MAX - 1] = pow(factorial[MAX - 1], MOD - 2, MOD)","-for i in range(MAX - 2, 0, -1):","- # \u6700\u5f8c\u304b\u3089\u623b\u3063\u3066\u3044\u304f\u3053\u306e\u30eb\u30fc\u30d7\u306a\u3089H+W\u56depow\u3059\u308b\u3088\u308a\u51e6\u7406\u304c\u901f\u3044","- inverse[i] = inverse[i + 1] * (i + 1) % MOD","-# \u7d44\u307f\u5408\u308f\u305b\u306e\u6570","-def nCr(n, r):","- # 10C7 = 10C3","- r = min(r, n - r)","- # \u5206\u5b50\u306e\u8a08\u7b97","- numerator = factorial[n]","- # \u5206\u6bcd\u306e\u8a08\u7b97","- denominator = inverse[r] * inverse[n - r] % MOD","- return numerator * denominator % MOD","+class FactInvMOD:","+ \"\"\"\u968e\u4e57\u305f\u304f\u3055\u3093\u4f7f\u3046\u6642\u7528\u306e\u30c6\u30fc\u30d6\u30eb\u6e96\u5099\"\"\"","+","+ def __init__(self, MAX, MOD):","+ \"\"\"MAX\uff1a\u968e\u4e57\u306b\u4f7f\u3046\u6570\u5024\u306e\u6700\u5927\u4ee5\u4e0a\u307e\u3067\u4f5c\u308b\"\"\"","+ MAX += 1","+ self.MAX = MAX","+ self.MOD = MOD","+ # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb","+ factorial = [1] * MAX","+ factorial[0] = factorial[1] = 1","+ for i in range(2, MAX):","+ factorial[i] = factorial[i - 1] * i % MOD","+ # \u968e\u4e57\u306e\u9006\u5143\u30c6\u30fc\u30d6\u30eb","+ inverse = [1] * MAX","+ # pow\u306b\u7b2c\u4e09\u5f15\u6570\u5165\u308c\u308b\u3068\u51aa\u4e57\u306emod\u4ed8\u8a08\u7b97\u3092\u9ad8\u901f\u306b\u3084\u3063\u3066\u304f\u308c\u308b","+ inverse[MAX - 1] = pow(factorial[MAX - 1], MOD - 2, MOD)","+ for i in range(MAX - 2, 0, -1):","+ # \u6700\u5f8c\u304b\u3089\u623b\u3063\u3066\u3044\u304f\u3053\u306e\u30eb\u30fc\u30d7\u306a\u3089MAX\u56depow\u3059\u308b\u3088\u308a\u51e6\u7406\u304c\u901f\u3044","+ inverse[i] = inverse[i + 1] * (i + 1) % MOD","+ self.fact = factorial","+ self.inv = inverse","+","+ def nCr(self, n, r):","+ \"\"\"\u7d44\u307f\u5408\u308f\u305b\u306e\u6570 (\u5fc5\u8981\u306a\u968e\u4e57\u3068\u9006\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4e8b\u524d\u306b\u4f5c\u3063\u3066\u304a\u304f)\"\"\"","+ if n < r:","+ return 0","+ # 10C7 = 10C3","+ r = min(r, n - r)","+ # \u5206\u5b50\u306e\u8a08\u7b97","+ numerator = self.fact[n]","+ # \u5206\u6bcd\u306e\u8a08\u7b97","+ denominator = self.inv[r] * self.inv[n - r] % self.MOD","+ return numerator * denominator % self.MOD","+","+ def nPr(self, n, r):","+ \"\"\"\u9806\u5217\"\"\"","+ if n < r:","+ return 0","+ return self.fact[n] * self.inv[n - r] % self.MOD","+","+ def nHr(self, n, r):","+ \"\"\"\u91cd\u8907\u7d44\u307f\u5408\u308f\u305b\"\"\"","+ # r\u500b\u9078\u3076\u3068\u3053\u308d\u306bN-1\u500b\u306e\u4ed5\u5207\u308a\u3092\u5165\u308c\u308b","+ return self.nCr(r + n - 1, r)","-N, M = list(map(int, input().split()))","-# d = fact_prime(M)","-# print(d)","+N, M = MAP()","+d = factorize(M)","+# \u4f8b\u5916\u51e6\u7406","+if not d:","+ print((1))","+ exit()","+MAX = N + max(d.values())","+fim = FactInvMOD(MAX, MOD)","-for k, v in list(fact_prime(M).items()):","- # \u91cd\u8907\u7d44\u307f\u5408\u308f\u305b","- # v\u500b\u306ek\u3068N-1\u500b\u306e\u4ed5\u5207\u308a\u304b\u3089\u3001v\u500b\u3092\u4e26\u3079\u308b(v+N-1\u500b\u306e\u30de\u30b9\u304b\u3089v\u500b\u3092\u9078\u3073\u51fa\u3059\u7d44\u307f\u5408\u308f\u305b)","- ans = (ans * nCr(v + N - 1, v)) % MOD","+for k, v in list(d.items()):","+ ans *= fim.nHr(N, v)","+ ans %= MOD"],"diff_only_import_comment":false,"measured_runtime_v0":1.4126218548,"measured_runtime_v1":0.2794496491,"runtime_lift":5.0550138793,"key":["s242527358","s893815197"]} +{"user_id":"u254871849","problem_id":"p03436","language":"python","submission_id_v0":"s717556991","submission_id_v1":"s757336484","cpu_time_v0":300,"cpu_time_v1":25,"memory_v0":20384,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\nfrom heapq import heappop, heappush\n\n\n\n# Dijikstra\n\ndef main():\n\n H, W = list(map(int, sys.stdin.readline().split()))\n\n\n\n grid = np.array([list(sys.stdin.readline().rstrip()) for _ in range(H)])\n\n grid = np.pad(grid, 1, 'constant')\n\n # atcoder\u3067\u306fnp.pad() \u306earg\u306bconstant_values\u3092\u6307\u5b9a\u3067\u304d\u306a\u3044\n\n q = []\n\n heappush(q, (0, 1, 1))\n\n visited = set()\n\n cost = np.full((H + 1, W + 1), np.inf)\n\n cost[1][1] = 0\n\n while q:\n\n c, i, j = heappop(q)\n\n if (i, j) in visited:\n\n continue\n\n visited.add((i, j))\n\n cost[i][j] = c\n\n if i == H and j == W:\n\n break\n\n for dy, dx in [(1, 0), (0, 1), (-1, 0), (0, -1)]:\n\n y = i + dy\n\n x = j + dx\n\n if grid[y][x] == '.' and not (y, x) in visited:\n\n heappush(q, (c + 1, y, x))\n\n \n\n\n\n if cost[H][W] != np.inf:\n\n ans = int(np.sum(grid == '.') - (cost[H][W] + 1))\n\n else:\n\n ans = -1\n\n\n\n print(ans) \n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom heapq import heappop, heappush\n\n\n\nH, W = list(map(int, sys.stdin.readline().split()))\n\ngrid = ['#' * (W + 2)]\n\ngrid += ['#' + sys.stdin.readline().rstrip() + '#' for _ in range(H)]\n\ngrid += ['#' * (W + 2)]\n\n\n\ndef heuristic_cost(y, x):\n\n return abs(H - y) + abs(W - x)\n\n\n\ndef main():\n\n h = heuristic_cost(1, 1)\n\n c = 0\n\n s = h + c\n\n hq = [(s, c, 1, 1)]\n\n nex = [(1, 0), (0, 1), (-1, 0), (0, -1)]\n\n cost = [[None] * (W+1) for _ in range(H+1)]\n\n while hq:\n\n s, c, y, x = heappop(hq)\n\n if not cost[y][x] is None:\n\n continue\n\n cost[y][x] = c\n\n for dy, dx in nex:\n\n i = y + dy\n\n j = x + dx\n\n if grid[i][j] == '.' and cost[i][j] is None:\n\n h = heuristic_cost(i, j)\n\n s = h + (c + 1)\n\n heappush(hq, (s, c+1, i, j))\n\n\n\n white_cnt = 0\n\n for i in range(1, H+1):\n\n for j in range(1, W+1):\n\n white_cnt += (grid[i][j] == '.') & 1\n\n \n\n ans = white_cnt - (cost[H][W] + 1) if not cost[H][W] is None else -1\n\n return ans \n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":40,"code_v1_loc":42,"code_v0_num_chars":1044,"code_v1_num_chars":1152,"code_v0_no_empty_lines":"import sys\nimport numpy as np\nfrom heapq import heappop, heappush\n\n# Dijikstra\ndef main():\n H, W = list(map(int, sys.stdin.readline().split()))\n grid = np.array([list(sys.stdin.readline().rstrip()) for _ in range(H)])\n grid = np.pad(grid, 1, \"constant\")\n # atcoder\u3067\u306fnp.pad() \u306earg\u306bconstant_values\u3092\u6307\u5b9a\u3067\u304d\u306a\u3044\n q = []\n heappush(q, (0, 1, 1))\n visited = set()\n cost = np.full((H + 1, W + 1), np.inf)\n cost[1][1] = 0\n while q:\n c, i, j = heappop(q)\n if (i, j) in visited:\n continue\n visited.add((i, j))\n cost[i][j] = c\n if i == H and j == W:\n break\n for dy, dx in [(1, 0), (0, 1), (-1, 0), (0, -1)]:\n y = i + dy\n x = j + dx\n if grid[y][x] == \".\" and not (y, x) in visited:\n heappush(q, (c + 1, y, x))\n if cost[H][W] != np.inf:\n ans = int(np.sum(grid == \".\") - (cost[H][W] + 1))\n else:\n ans = -1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nfrom heapq import heappop, heappush\n\nH, W = list(map(int, sys.stdin.readline().split()))\ngrid = [\"#\" * (W + 2)]\ngrid += [\"#\" + sys.stdin.readline().rstrip() + \"#\" for _ in range(H)]\ngrid += [\"#\" * (W + 2)]\n\n\ndef heuristic_cost(y, x):\n return abs(H - y) + abs(W - x)\n\n\ndef main():\n h = heuristic_cost(1, 1)\n c = 0\n s = h + c\n hq = [(s, c, 1, 1)]\n nex = [(1, 0), (0, 1), (-1, 0), (0, -1)]\n cost = [[None] * (W + 1) for _ in range(H + 1)]\n while hq:\n s, c, y, x = heappop(hq)\n if not cost[y][x] is None:\n continue\n cost[y][x] = c\n for dy, dx in nex:\n i = y + dy\n j = x + dx\n if grid[i][j] == \".\" and cost[i][j] is None:\n h = heuristic_cost(i, j)\n s = h + (c + 1)\n heappush(hq, (s, c + 1, i, j))\n white_cnt = 0\n for i in range(1, H + 1):\n for j in range(1, W + 1):\n white_cnt += (grid[i][j] == \".\") & 1\n ans = white_cnt - (cost[H][W] + 1) if not cost[H][W] is None else -1\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["-import numpy as np","-# Dijikstra","+H, W = list(map(int, sys.stdin.readline().split()))","+grid = [\"#\" * (W + 2)]","+grid += [\"#\" + sys.stdin.readline().rstrip() + \"#\" for _ in range(H)]","+grid += [\"#\" * (W + 2)]","+","+","+def heuristic_cost(y, x):","+ return abs(H - y) + abs(W - x)","+","+","- H, W = list(map(int, sys.stdin.readline().split()))","- grid = np.array([list(sys.stdin.readline().rstrip()) for _ in range(H)])","- grid = np.pad(grid, 1, \"constant\")","- # atcoder\u3067\u306fnp.pad() \u306earg\u306bconstant_values\u3092\u6307\u5b9a\u3067\u304d\u306a\u3044","- q = []","- heappush(q, (0, 1, 1))","- visited = set()","- cost = np.full((H + 1, W + 1), np.inf)","- cost[1][1] = 0","- while q:","- c, i, j = heappop(q)","- if (i, j) in visited:","+ h = heuristic_cost(1, 1)","+ c = 0","+ s = h + c","+ hq = [(s, c, 1, 1)]","+ nex = [(1, 0), (0, 1), (-1, 0), (0, -1)]","+ cost = [[None] * (W + 1) for _ in range(H + 1)]","+ while hq:","+ s, c, y, x = heappop(hq)","+ if not cost[y][x] is None:","- visited.add((i, j))","- cost[i][j] = c","- if i == H and j == W:","- break","- for dy, dx in [(1, 0), (0, 1), (-1, 0), (0, -1)]:","- y = i + dy","- x = j + dx","- if grid[y][x] == \".\" and not (y, x) in visited:","- heappush(q, (c + 1, y, x))","- if cost[H][W] != np.inf:","- ans = int(np.sum(grid == \".\") - (cost[H][W] + 1))","- else:","- ans = -1","- print(ans)","+ cost[y][x] = c","+ for dy, dx in nex:","+ i = y + dy","+ j = x + dx","+ if grid[i][j] == \".\" and cost[i][j] is None:","+ h = heuristic_cost(i, j)","+ s = h + (c + 1)","+ heappush(hq, (s, c + 1, i, j))","+ white_cnt = 0","+ for i in range(1, H + 1):","+ for j in range(1, W + 1):","+ white_cnt += (grid[i][j] == \".\") & 1","+ ans = white_cnt - (cost[H][W] + 1) if not cost[H][W] is None else -1","+ return ans","- main()","+ ans = main()","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.9877221048,"measured_runtime_v1":0.2343174028,"runtime_lift":4.2153168855,"key":["s717556991","s757336484"]} +{"user_id":"u062560908","problem_id":"p02690","language":"python","submission_id_v0":"s405829600","submission_id_v1":"s667622299","cpu_time_v0":288,"cpu_time_v1":54,"memory_v0":135980,"memory_v1":66236,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.25,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef sol(n):\n\n d = {}\n\n N = 100000\n\n for i in range(-N, N+1):\n\n d[i**5]=i\n\n for i in d:\n\n j = n+i\n\n if j in d:\n\n print(d[j], d[i])\n\n return\n\n\n\ndef main():\n\n n = eval(input())\n\n sol(n)\n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"def sol(n):\n\n d = {}\n\n N = 1000\n\n for i in range(-N, N+1):\n\n d[i**5]=i\n\n for i in d:\n\n j = n+i\n\n if j in d:\n\n print(d[j], d[i])\n\n return\n\n\n\ndef main():\n\n n = eval(input())\n\n sol(n)\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":277,"code_v1_num_chars":275,"code_v0_no_empty_lines":"def sol(n):\n d = {}\n N = 100000\n for i in range(-N, N + 1):\n d[i**5] = i\n for i in d:\n j = n + i\n if j in d:\n print(d[j], d[i])\n return\n\n\ndef main():\n n = eval(input())\n sol(n)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def sol(n):\n d = {}\n N = 1000\n for i in range(-N, N + 1):\n d[i**5] = i\n for i in d:\n j = n + i\n if j in d:\n print(d[j], d[i])\n return\n\n\ndef main():\n n = eval(input())\n sol(n)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- N = 100000","+ N = 1000"],"diff_only_import_comment":false,"measured_runtime_v0":1.1436646879,"measured_runtime_v1":0.1839788636,"runtime_lift":6.2162830322,"key":["s405829600","s667622299"]} +{"user_id":"u881590806","problem_id":"p02264","language":"python","submission_id_v0":"s309974156","submission_id_v1":"s779537604","cpu_time_v0":780,"cpu_time_v1":600,"memory_v0":14072,"memory_v1":28548,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nclass Queue:\n\n def __init__(self,values):\n\n self.values = values\n\n\n\n def empty(self):\n\n if len(self.values) == 0:\n\n return True\n\n else:\n\n return False\n\n\n\n def enqueue(self,v):\n\n self.values.append(v)\n\n\n\n def dequeue(self):\n\n if len(self.values) <= 0:\n\n raise\n\n else:\n\n v = self.values[0]\n\n del self.values[0]\n\n return v\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nprocesses = []\n\nfor i in range(n):\n\n n,t = input().split(' ')\n\n processes.append((n,int(t)))\n\n\n\nqueue = Queue(processes)\n\n\n\nclock = 0\n\ndone = []\n\nwhile not queue.empty():\n\n p = queue.dequeue()\n\n n = p[0]\n\n t = p[1]\n\n if t <= q:\n\n clock+=t\n\n done.append((n,clock))\n\n else:\n\n queue.enqueue((n,t-q))\n\n clock+=q\n\n\n\nfor p in done:\n\n print(p[0],p[1])\n\n# optimized version of the same code:\n","target":"class Queue:\n\n def __init__(self,l):\n\n self.values = []\n\n self.l = l\n\n for _ in range(l):\n\n self.values.append(None)\n\n self.head = 0\n\n self.tail = 0\n\n def inc(self,n):\n\n if n+1 >= self.l:\n\n return 0\n\n else:\n\n return n+1\n\n def enqueue(self,v):\n\n if self.inc(self.head) == self.tail:\n\n print('overflow')\n\n exit()\n\n self.values[self.head] = v\n\n self.head = self.inc(self.head)\n\n def dequeue(self):\n\n if self.head == self.tail:\n\n print('underflow')\n\n exit()\n\n v = self.values[self.tail]\n\n self.tail = self.inc(self.tail)\n\n return v\n\n def size(self):\n\n if self.head >= self.tail:\n\n return self.head-self.tail\n\n else:\n\n self.head + (self.l-self.tail)\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nqueue = Queue(200000)\n\nfor _ in range(n):\n\n n,t = input().split(' ')\n\n t = int(t)\n\n queue.enqueue((n,t))\n\n\n\nc = 0\n\nwhile queue.size()>0:\n\n n,t = queue.dequeue()\n\n if t <= q:\n\n c += t\n\n print(n,c)\n\n else:\n\n queue.enqueue((n,t-q))\n\n c += q","code_v0_loc":44,"code_v1_loc":48,"code_v0_num_chars":881,"code_v1_num_chars":1197,"code_v0_no_empty_lines":"class Queue:\n def __init__(self, values):\n self.values = values\n\n def empty(self):\n if len(self.values) == 0:\n return True\n else:\n return False\n\n def enqueue(self, v):\n self.values.append(v)\n\n def dequeue(self):\n if len(self.values) <= 0:\n raise\n else:\n v = self.values[0]\n del self.values[0]\n return v\n\n\nn, q = list(map(int, input().split(\" \")))\nprocesses = []\nfor i in range(n):\n n, t = input().split(\" \")\n processes.append((n, int(t)))\nqueue = Queue(processes)\nclock = 0\ndone = []\nwhile not queue.empty():\n p = queue.dequeue()\n n = p[0]\n t = p[1]\n if t <= q:\n clock += t\n done.append((n, clock))\n else:\n queue.enqueue((n, t - q))\n clock += q\nfor p in done:\n print(p[0], p[1])\n","code_v1_no_empty_lines":"class Queue:\n def __init__(self, l):\n self.values = []\n self.l = l\n for _ in range(l):\n self.values.append(None)\n self.head = 0\n self.tail = 0\n\n def inc(self, n):\n if n + 1 >= self.l:\n return 0\n else:\n return n + 1\n\n def enqueue(self, v):\n if self.inc(self.head) == self.tail:\n print(\"overflow\")\n exit()\n self.values[self.head] = v\n self.head = self.inc(self.head)\n\n def dequeue(self):\n if self.head == self.tail:\n print(\"underflow\")\n exit()\n v = self.values[self.tail]\n self.tail = self.inc(self.tail)\n return v\n\n def size(self):\n if self.head >= self.tail:\n return self.head - self.tail\n else:\n self.head + (self.l - self.tail)\n\n\nn, q = list(map(int, input().split(\" \")))\nqueue = Queue(200000)\nfor _ in range(n):\n n, t = input().split(\" \")\n t = int(t)\n queue.enqueue((n, t))\nc = 0\nwhile queue.size() > 0:\n n, t = queue.dequeue()\n if t <= q:\n c += t\n print(n, c)\n else:\n queue.enqueue((n, t - q))\n c += q\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["- def __init__(self, values):","- self.values = values","+ def __init__(self, l):","+ self.values = []","+ self.l = l","+ for _ in range(l):","+ self.values.append(None)","+ self.head = 0","+ self.tail = 0","- def empty(self):","- if len(self.values) == 0:","- return True","+ def inc(self, n):","+ if n + 1 >= self.l:","+ return 0","- return False","+ return n + 1","- self.values.append(v)","+ if self.inc(self.head) == self.tail:","+ print(\"overflow\")","+ exit()","+ self.values[self.head] = v","+ self.head = self.inc(self.head)","- if len(self.values) <= 0:","- raise","+ if self.head == self.tail:","+ print(\"underflow\")","+ exit()","+ v = self.values[self.tail]","+ self.tail = self.inc(self.tail)","+ return v","+","+ def size(self):","+ if self.head >= self.tail:","+ return self.head - self.tail","- v = self.values[0]","- del self.values[0]","- return v","+ self.head + (self.l - self.tail)","-processes = []","-for i in range(n):","+queue = Queue(200000)","+for _ in range(n):","- processes.append((n, int(t)))","-queue = Queue(processes)","-clock = 0","-done = []","-while not queue.empty():","- p = queue.dequeue()","- n = p[0]","- t = p[1]","+ t = int(t)","+ queue.enqueue((n, t))","+c = 0","+while queue.size() > 0:","+ n, t = queue.dequeue()","- clock += t","- done.append((n, clock))","+ c += t","+ print(n, c)","- clock += q","-for p in done:","- print(p[0], p[1])","+ c += q"],"diff_only_import_comment":false,"measured_runtime_v0":0.3044010155,"measured_runtime_v1":0.1198908706,"runtime_lift":2.5389841115,"key":["s309974156","s779537604"]} +{"user_id":"u581187895","problem_id":"p03371","language":"python","submission_id_v0":"s830313150","submission_id_v1":"s841516254","cpu_time_v0":132,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.12,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA, B, C, X, Y = list(map(int, input().split()))\n\n\n\n# C\u3092\u8cb7\u3063\u305f\u500b\u6570\u3068A\u3001B\u5358\u54c1\u3067\u8cb7\u3063\u305f\u5834\u5408\u306e\u30b3\u30b9\u30c8\u3092\u611a\u76f4\u306b\u8a66\u3059\n\ntotal = 1<<60\n\nfor i in range(10**5+1):\n\n cost = 2*C*i + max(X-i, 0)*A + max(Y-i, 0)*B\n\n total = min(cost, total)\n\n\n\nprint(total)\n\n# optimized version of the same code:\n","target":"A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nif (A+B) <= 2*C: # \u5358\u54c1\u3060\u3051\u3067\u8cfc\u5165\n\n print((X*A + Y*B))\n\nelse:\n\n # AB\u3092\u8cb7\u3044\u6b8b\u308a\u3092\u5358\u54c1\u3067\u88dc\u3046\n\n if X >= Y:\n\n # AB\u3067Y\u306f\u8cc4\u3048\u308b\n\n print((min(X*2*C, Y*2*C + A*(X-Y))))\n\n else:\n\n # AB\u3067X\u306f\u8cc4\u3048\u308b\n\n print((min(Y*2*C, X*(2*C)+B*(Y-X))))","code_v0_loc":9,"code_v1_loc":12,"code_v0_num_chars":209,"code_v1_num_chars":252,"code_v0_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\n# C\u3092\u8cb7\u3063\u305f\u500b\u6570\u3068A\u3001B\u5358\u54c1\u3067\u8cb7\u3063\u305f\u5834\u5408\u306e\u30b3\u30b9\u30c8\u3092\u611a\u76f4\u306b\u8a66\u3059\ntotal = 1 << 60\nfor i in range(10**5 + 1):\n cost = 2 * C * i + max(X - i, 0) * A + max(Y - i, 0) * B\n total = min(cost, total)\nprint(total)\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nif (A + B) <= 2 * C: # \u5358\u54c1\u3060\u3051\u3067\u8cfc\u5165\n print((X * A + Y * B))\nelse:\n # AB\u3092\u8cb7\u3044\u6b8b\u308a\u3092\u5358\u54c1\u3067\u88dc\u3046\n if X >= Y:\n # AB\u3067Y\u306f\u8cc4\u3048\u308b\n print((min(X * 2 * C, Y * 2 * C + A * (X - Y))))\n else:\n # AB\u3067X\u306f\u8cc4\u3048\u308b\n print((min(Y * 2 * C, X * (2 * C) + B * (Y - X))))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-# C\u3092\u8cb7\u3063\u305f\u500b\u6570\u3068A\u3001B\u5358\u54c1\u3067\u8cb7\u3063\u305f\u5834\u5408\u306e\u30b3\u30b9\u30c8\u3092\u611a\u76f4\u306b\u8a66\u3059","-total = 1 << 60","-for i in range(10**5 + 1):","- cost = 2 * C * i + max(X - i, 0) * A + max(Y - i, 0) * B","- total = min(cost, total)","-print(total)","+if (A + B) <= 2 * C: # \u5358\u54c1\u3060\u3051\u3067\u8cfc\u5165","+ print((X * A + Y * B))","+else:","+ # AB\u3092\u8cb7\u3044\u6b8b\u308a\u3092\u5358\u54c1\u3067\u88dc\u3046","+ if X >= Y:","+ # AB\u3067Y\u306f\u8cc4\u3048\u308b","+ print((min(X * 2 * C, Y * 2 * C + A * (X - Y))))","+ else:","+ # AB\u3067X\u306f\u8cc4\u3048\u308b","+ print((min(Y * 2 * C, X * (2 * C) + B * (Y - X))))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4378738942,"measured_runtime_v1":0.35371227,"runtime_lift":4.0650947565,"key":["s830313150","s841516254"]} +{"user_id":"u709304134","problem_id":"p02690","language":"python","submission_id_v0":"s716751946","submission_id_v1":"s847137300","cpu_time_v0":140,"cpu_time_v1":33,"memory_v0":9172,"memory_v1":9052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**7)\n\nINF = 10**10\n\nMOD = 10**9 + 7\n\nX = int(eval(input()))\n\nfor i in range(1000):\n\n for j in range(-1000,1000):\n\n #print (i**5 - j**5)\n\n if i**5 - j**5 == X:\n\n print((i,j))\n\n exit()\n\n \n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**7)\n\nINF = 10**10\n\nMOD = 10**9 + 7\n\nX = int(eval(input()))\n\nMAX_X = 10**9\n\nn = 0\n\nwhile(1):\n\n n+=1\n\n if n**5 - (n-1)**5 > MAX_X:\n\n break\n\nfor i in range(n):\n\n for j in range(-n+1,n-1):\n\n if i**5 - j**5 == X:\n\n print((i,j))\n\n exit()\n\n ","code_v0_loc":13,"code_v1_loc":18,"code_v0_num_chars":283,"code_v1_num_chars":339,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nINF = 10**10\nMOD = 10**9 + 7\nX = int(eval(input()))\nfor i in range(1000):\n for j in range(-1000, 1000):\n # print (i**5 - j**5)\n if i**5 - j**5 == X:\n print((i, j))\n exit()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nINF = 10**10\nMOD = 10**9 + 7\nX = int(eval(input()))\nMAX_X = 10**9\nn = 0\nwhile 1:\n n += 1\n if n**5 - (n - 1) ** 5 > MAX_X:\n break\nfor i in range(n):\n for j in range(-n + 1, n - 1):\n if i**5 - j**5 == X:\n print((i, j))\n exit()\n","code_same":false,"relative_loc_diff_percent":27.7777777778,"diff":["-for i in range(1000):","- for j in range(-1000, 1000):","- # print (i**5 - j**5)","+MAX_X = 10**9","+n = 0","+while 1:","+ n += 1","+ if n**5 - (n - 1) ** 5 > MAX_X:","+ break","+for i in range(n):","+ for j in range(-n + 1, n - 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.2435716569,"measured_runtime_v1":0.1900340259,"runtime_lift":1.2817265527,"key":["s716751946","s847137300"]} +{"user_id":"u672220554","problem_id":"p02983","language":"python","submission_id_v0":"s554161170","submission_id_v1":"s606893257","cpu_time_v0":990,"cpu_time_v1":76,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.32,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nl,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n print(tres)\n\n\n# optimized version of the same code:\n","target":"l,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n if tres == 0:\n\n break\n\n if tres == 0:\n\n break\n\n print(tres)\n","code_v0_loc":11,"code_v1_loc":15,"code_v0_num_chars":250,"code_v1_num_chars":342,"code_v0_no_empty_lines":"l, r = list(map(int, input().split()))\nif r - l > 2019:\n print((0))\nelse:\n tres = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n mod = (i % 2019) * (j % 2019) % 2019\n tres = min(tres, mod)\n print(tres)\n","code_v1_no_empty_lines":"l, r = list(map(int, input().split()))\nif r - l > 2019:\n print((0))\nelse:\n tres = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n mod = (i % 2019) * (j % 2019) % 2019\n tres = min(tres, mod)\n if tres == 0:\n break\n if tres == 0:\n break\n print(tres)\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["+ if tres == 0:","+ break","+ if tres == 0:","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.2616734529,"measured_runtime_v1":0.2086780975,"runtime_lift":1.2539574397,"key":["s554161170","s606893257"]} +{"user_id":"u254871849","problem_id":"p03086","language":"python","submission_id_v0":"s827296868","submission_id_v1":"s358574733","cpu_time_v0":604,"cpu_time_v1":18,"memory_v0":102680,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":97.02,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\nimport itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n all_words = []\n\n for i in range(1, len(s) + 1):\n\n for letters in itertools.product('ATCG', repeat=i):\n\n word = ''.join(letters)\n\n all_words.append(word)\n\n \n\n for i in range(len(all_words)-1, 0-1, -1):\n\n if all_words[i] in s:\n\n print((len(all_words[i])))\n\n sys.exit()\n\n print((0))\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n permitted = 'ACGT'\n\n continuous_count = []\n\n count = 0\n\n\n\n for i in range(len(s)):\n\n char = s[i]\n\n if char in permitted:\n\n count += 1\n\n else:\n\n continuous_count.append(count)\n\n count = 0\n\n if i == len(s) - 1:\n\n continuous_count.append(count)\n\n \n\n if not continuous_count:\n\n print((len(s)))\n\n else:\n\n print((max(continuous_count)))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":32,"code_v1_loc":38,"code_v0_num_chars":799,"code_v1_num_chars":884,"code_v0_no_empty_lines":"# 2019-11-12 22:21:08(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\nimport itertools\n\n# from functools import reduce\n# import operator as op\n# from scipy.misc import comb # float\n# import numpy as np\ndef main():\n s = sys.stdin.readline().rstrip()\n all_words = []\n for i in range(1, len(s) + 1):\n for letters in itertools.product(\"ATCG\", repeat=i):\n word = \"\".join(letters)\n all_words.append(word)\n for i in range(len(all_words) - 1, 0 - 1, -1):\n if all_words[i] in s:\n print((len(all_words[i])))\n sys.exit()\n print((0))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# 2019-11-12 22:21:08(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# from scipy.misc import comb # float\n# import numpy as np\ndef main():\n s = sys.stdin.readline().rstrip()\n permitted = \"ACGT\"\n continuous_count = []\n count = 0\n for i in range(len(s)):\n char = s[i]\n if char in permitted:\n count += 1\n else:\n continuous_count.append(count)\n count = 0\n if i == len(s) - 1:\n continuous_count.append(count)\n if not continuous_count:\n print((len(s)))\n else:\n print((max(continuous_count)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-import itertools","-","+# import itertools","- all_words = []","- for i in range(1, len(s) + 1):","- for letters in itertools.product(\"ATCG\", repeat=i):","- word = \"\".join(letters)","- all_words.append(word)","- for i in range(len(all_words) - 1, 0 - 1, -1):","- if all_words[i] in s:","- print((len(all_words[i])))","- sys.exit()","- print((0))","+ permitted = \"ACGT\"","+ continuous_count = []","+ count = 0","+ for i in range(len(s)):","+ char = s[i]","+ if char in permitted:","+ count += 1","+ else:","+ continuous_count.append(count)","+ count = 0","+ if i == len(s) - 1:","+ continuous_count.append(count)","+ if not continuous_count:","+ print((len(s)))","+ else:","+ print((max(continuous_count)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4624249086,"measured_runtime_v1":0.2736470122,"runtime_lift":1.6898591541,"key":["s827296868","s358574733"]} +{"user_id":"u591503175","problem_id":"p03425","language":"python","submission_id_v0":"s516575345","submission_id_v1":"s622826688","cpu_time_v0":224,"cpu_time_v1":139,"memory_v0":28380,"memory_v1":10528,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef resolve():\n\n '''\n\n code here\n\n '''\n\n import collections\n\n import itertools\n\n import numpy as np\n\n N = int(eval(input()))\n\n Ss = [input()[0] for _ in range(N)]\n\n\n\n march_letter = [item for item in Ss if item in ['M', 'A', 'R', 'C', 'H']]\n\n march_cnt = collections.Counter(march_letter)\n\n\n\n if len(march_cnt) < 3:\n\n res = 0\n\n else:\n\n res_list = itertools.combinations(list(march_cnt.values()),3)\n\n\n\n res = 0\n\n for element in res_list:\n\n res += np.prod(np.array(element))\n\n print(res)\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n\n\n# optimized version of the same code:\n","target":"def resolve():\n\n '''\n\n code here\n\n '''\n\n import collections\n\n import itertools\n\n N = int(eval(input()))\n\n Ss = [input()[0] for _ in range(N)]\n\n\n\n march_letter = [item for item in Ss if item in ['M', 'A', 'R', 'C', 'H']]\n\n march_cnt = collections.Counter(march_letter)\n\n\n\n if len(march_cnt) < 3:\n\n res = 0\n\n else:\n\n res_list = itertools.combinations(list(march_cnt.values()),3)\n\n\n\n res = 0\n\n for element in res_list:\n\n res += element[0]*element[1]*element[2]\n\n print(res)\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n","code_v0_loc":25,"code_v1_loc":24,"code_v0_num_chars":597,"code_v1_num_chars":579,"code_v0_no_empty_lines":"def resolve():\n \"\"\"\n code here\n \"\"\"\n import collections\n import itertools\n import numpy as np\n\n N = int(eval(input()))\n Ss = [input()[0] for _ in range(N)]\n march_letter = [item for item in Ss if item in [\"M\", \"A\", \"R\", \"C\", \"H\"]]\n march_cnt = collections.Counter(march_letter)\n if len(march_cnt) < 3:\n res = 0\n else:\n res_list = itertools.combinations(list(march_cnt.values()), 3)\n res = 0\n for element in res_list:\n res += np.prod(np.array(element))\n print(res)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"def resolve():\n \"\"\"\n code here\n \"\"\"\n import collections\n import itertools\n\n N = int(eval(input()))\n Ss = [input()[0] for _ in range(N)]\n march_letter = [item for item in Ss if item in [\"M\", \"A\", \"R\", \"C\", \"H\"]]\n march_cnt = collections.Counter(march_letter)\n if len(march_cnt) < 3:\n res = 0\n else:\n res_list = itertools.combinations(list(march_cnt.values()), 3)\n res = 0\n for element in res_list:\n res += element[0] * element[1] * element[2]\n print(res)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["- import numpy as np","- res += np.prod(np.array(element))","+ res += element[0] * element[1] * element[2]"],"diff_only_import_comment":false,"measured_runtime_v0":1.6003547316,"measured_runtime_v1":0.2577111022,"runtime_lift":6.209878882,"key":["s516575345","s622826688"]} +{"user_id":"u254871849","problem_id":"p03309","language":"python","submission_id_v0":"s802702568","submission_id_v1":"s939867576","cpu_time_v0":372,"cpu_time_v1":200,"memory_v0":27268,"memory_v1":25180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.24,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# author: kagemeka \n\n# created: 2019-11-08 14:51:29(JST)\n\n## internal modules\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\nimport statistics\n\n# import functools\n\n# import operator\n\n## external modules\n\n# import scipy.special # if use comb function on AtCoder, \n\n# import scipy.misc # select scipy.misc.comb (old version) \n\n\n\ndef main():\n\n n, *a = (int(x) for x in sys.stdin.read().split())\n\n \n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n\n\n if n % 2 != 0:\n\n b = statistics.median(a)\n\n else:\n\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n\n b = statistics.median_high(a)\n\n else:\n\n b = statistics.median_low(a)\n\n \n\n ans = sum([abs(a[i] - b) for i in range(n)])\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n\n\n\n\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\n\n\ndef main():\n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n a.sort()\n\n b = a[n \/\/ 2]\n\n res = 0\n\n for i in range(n):\n\n res += abs(a[i] - b)\n\n \n\n return res\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":40,"code_v1_loc":18,"code_v0_num_chars":987,"code_v1_num_chars":310,"code_v0_no_empty_lines":"# author: kagemeka\n# created: 2019-11-08 14:51:29(JST)\n## internal modules\nimport sys\n\n# import collections\n# import math\n# import string\n# import bisect\n# import re\n# import itertools\nimport statistics\n\n# import functools\n# import operator\n## external modules\n# import scipy.special # if use comb function on AtCoder,\n# import scipy.misc # select scipy.misc.comb (old version)\ndef main():\n n, *a = (int(x) for x in sys.stdin.read().split())\n for i in range(n):\n a[i] -= i + 1\n if n % 2 != 0:\n b = statistics.median(a)\n else:\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n b = statistics.median_high(a)\n else:\n b = statistics.median_low(a)\n ans = sum([abs(a[i] - b) for i in range(n)])\n print(ans)\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n","code_v1_no_empty_lines":"import sys\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\n\ndef main():\n for i in range(n):\n a[i] -= i + 1\n a.sort()\n b = a[n \/\/ 2]\n res = 0\n for i in range(n):\n res += abs(a[i] - b)\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":55.0,"diff":["-# author: kagemeka","-# created: 2019-11-08 14:51:29(JST)","-## internal modules","-# import collections","-# import math","-# import string","-# import bisect","-# import re","-# import itertools","-import statistics","+n, *a = list(map(int, sys.stdin.read().split()))","-# import functools","-# import operator","-## external modules","-# import scipy.special # if use comb function on AtCoder,","-# import scipy.misc # select scipy.misc.comb (old version)","+","- n, *a = (int(x) for x in sys.stdin.read().split())","- if n % 2 != 0:","- b = statistics.median(a)","- else:","- if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):","- b = statistics.median_high(a)","- else:","- b = statistics.median_low(a)","- ans = sum([abs(a[i] - b) for i in range(n)])","- print(ans)","+ a.sort()","+ b = a[n \/\/ 2]","+ res = 0","+ for i in range(n):","+ res += abs(a[i] - b)","+ return res","- # execute only if run as a script","- main()","+ ans = main()","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2726693273,"measured_runtime_v1":0.2052652476,"runtime_lift":1.3283755066,"key":["s802702568","s939867576"]} +{"user_id":"u371409687","problem_id":"p02690","language":"python","submission_id_v0":"s077527302","submission_id_v1":"s532076785","cpu_time_v0":39,"cpu_time_v1":22,"memory_v0":9172,"memory_v1":9344,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\nfor i in range(-118, 120):\n\n for j in range(-119, 119):\n\n if i**5 - j**5 == x:\n\n print(('{} {}'.format(i,j)))\n\n break\n\n else:\n\n continue\n\n break\n\n# optimized version of the same code:\n","target":"def make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n \/\/ i:\n\n divisors.append(n\/\/i)\n\n\n\n divisors.sort()\n\n return divisors\n\nx = int(eval(input()))\n\nL = make_divisors(x)\n\nfor i in L:\n\n for a in range(-118,120):\n\n if a**5 - (a-i)**5 == x:\n\n print(('{} {}'.format(a,a-i)))\n\n break\n\n else:\n\n continue\n\n break","code_v0_loc":9,"code_v1_loc":20,"code_v0_num_chars":205,"code_v1_num_chars":466,"code_v0_no_empty_lines":"x = int(eval(input()))\nfor i in range(-118, 120):\n for j in range(-119, 119):\n if i**5 - j**5 == x:\n print((\"{} {}\".format(i, j)))\n break\n else:\n continue\n break\n","code_v1_no_empty_lines":"def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n \/\/ i:\n divisors.append(n \/\/ i)\n divisors.sort()\n return divisors\n\n\nx = int(eval(input()))\nL = make_divisors(x)\nfor i in L:\n for a in range(-118, 120):\n if a**5 - (a - i) ** 5 == x:\n print((\"{} {}\".format(a, a - i)))\n break\n else:\n continue\n break\n","code_same":false,"relative_loc_diff_percent":55.0,"diff":["+def make_divisors(n):","+ divisors = []","+ for i in range(1, int(n**0.5) + 1):","+ if n % i == 0:","+ divisors.append(i)","+ if i != n \/\/ i:","+ divisors.append(n \/\/ i)","+ divisors.sort()","+ return divisors","+","+","-for i in range(-118, 120):","- for j in range(-119, 119):","- if i**5 - j**5 == x:","- print((\"{} {}\".format(i, j)))","+L = make_divisors(x)","+for i in L:","+ for a in range(-118, 120):","+ if a**5 - (a - i) ** 5 == x:","+ print((\"{} {}\".format(a, a - i)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.530296878,"measured_runtime_v1":0.2904120326,"runtime_lift":1.8260155175,"key":["s077527302","s532076785"]} +{"user_id":"u416758623","problem_id":"p03416","language":"python","submission_id_v0":"s698254896","submission_id_v1":"s209236188","cpu_time_v0":210,"cpu_time_v1":54,"memory_v0":3060,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef findSumDigit(num):\n\n global total\n\n total = \"\"\n\n while num > 0:\n\n total += str(num % 10)\n\n num \/\/= 10\n\n return total\n\n\n\ndef main():\n\n a,b = list(map(int, input().split()))\n\n ans = 0\n\n for i in range(a,b+1):\n\n tmp = str(findSumDigit(i))\n\n if tmp == str(i):\n\n ans += 1\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"a, b = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor i in range(a,b+1):\n\n seki_gyaku = str(i)\n\n if seki_gyaku == seki_gyaku[::-1]:\n\n ans += 1\n\n\n\nprint(ans)\n","code_v0_loc":19,"code_v1_loc":9,"code_v0_num_chars":382,"code_v1_num_chars":165,"code_v0_no_empty_lines":"def findSumDigit(num):\n global total\n total = \"\"\n while num > 0:\n total += str(num % 10)\n num \/\/= 10\n return total\n\n\ndef main():\n a, b = list(map(int, input().split()))\n ans = 0\n for i in range(a, b + 1):\n tmp = str(findSumDigit(i))\n if tmp == str(i):\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n seki_gyaku = str(i)\n if seki_gyaku == seki_gyaku[::-1]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":52.6315789474,"diff":["-def findSumDigit(num):","- global total","- total = \"\"","- while num > 0:","- total += str(num % 10)","- num \/\/= 10","- return total","-","-","-def main():","- a, b = list(map(int, input().split()))","- ans = 0","- for i in range(a, b + 1):","- tmp = str(findSumDigit(i))","- if tmp == str(i):","- ans += 1","- print(ans)","-","-","-if __name__ == \"__main__\":","- main()","+a, b = list(map(int, input().split()))","+ans = 0","+for i in range(a, b + 1):","+ seki_gyaku = str(i)","+ if seki_gyaku == seki_gyaku[::-1]:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.908202547,"measured_runtime_v1":0.4125540495,"runtime_lift":2.2014146949,"key":["s698254896","s209236188"]} +{"user_id":"u759412327","problem_id":"p03680","language":"python","submission_id_v0":"s086989807","submission_id_v1":"s510724514","cpu_time_v0":397,"cpu_time_v1":201,"memory_v0":7084,"memory_v1":13724,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.37,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\na = [int(eval(input())) for i in range(N)]\n\nnow = a[0]\n\ncount = 1\n\nc = 0\n\nfor i in range(10**6):\n\n if now != 2:\n\n count += 1\n\n now = a[now - 1]\n\n else:\n\n print(count)\n\n c = 1\n\n break\n\nif c == 0:\n\n print((-1))\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\na = [0] + [int(eval(input())) for _ in range(N)]\n\nx = 1\n\nvisited = set([1])\n\nanswer = 0\n\n\n\nwhile True:\n\n x = a[x]\n\n if x in visited:\n\n answer = -1\n\n break\n\n visited.add(x)\n\n answer += 1\n\n if x == 2:\n\n break\n\n \n\nprint(answer)\n","code_v0_loc":15,"code_v1_loc":17,"code_v0_num_chars":263,"code_v1_num_chars":254,"code_v0_no_empty_lines":"N = int(eval(input()))\na = [int(eval(input())) for i in range(N)]\nnow = a[0]\ncount = 1\nc = 0\nfor i in range(10**6):\n if now != 2:\n count += 1\n now = a[now - 1]\n else:\n print(count)\n c = 1\n break\nif c == 0:\n print((-1))\n","code_v1_no_empty_lines":"N = int(eval(input()))\na = [0] + [int(eval(input())) for _ in range(N)]\nx = 1\nvisited = set([1])\nanswer = 0\nwhile True:\n x = a[x]\n if x in visited:\n answer = -1\n break\n visited.add(x)\n answer += 1\n if x == 2:\n break\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":11.7647058824,"diff":["-a = [int(eval(input())) for i in range(N)]","-now = a[0]","-count = 1","-c = 0","-for i in range(10**6):","- if now != 2:","- count += 1","- now = a[now - 1]","- else:","- print(count)","- c = 1","+a = [0] + [int(eval(input())) for _ in range(N)]","+x = 1","+visited = set([1])","+answer = 0","+while True:","+ x = a[x]","+ if x in visited:","+ answer = -1","-if c == 0:","- print((-1))","+ visited.add(x)","+ answer += 1","+ if x == 2:","+ break","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.8020722582,"measured_runtime_v1":0.2096916373,"runtime_lift":3.8250083246,"key":["s086989807","s510724514"]} +{"user_id":"u620238824","problem_id":"p02690","language":"python","submission_id_v0":"s361313136","submission_id_v1":"s308076339","cpu_time_v0":1222,"cpu_time_v1":629,"memory_v0":9168,"memory_v1":73340,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nX = int(eval(input()))#\u6570\u5b57\n\n\n\nfor i in range(10 ** 8):\n\n for j in range(-10000,10 ** 4):\n\n if i ** 5 - j ** 5 == X:\n\n print((i, j))\n\n exit()\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\ny = 10**4\n\n\n\nfor i in range(y):\n\n for j in range(-y,y):\n\n if i ** 5 - j ** 5 == x:\n\n print((i, j))\n\n exit()","code_v0_loc":7,"code_v1_loc":8,"code_v0_num_chars":163,"code_v1_num_chars":155,"code_v0_no_empty_lines":"X = int(eval(input())) # \u6570\u5b57\nfor i in range(10**8):\n for j in range(-10000, 10**4):\n if i**5 - j**5 == X:\n print((i, j))\n exit()\n","code_v1_no_empty_lines":"x = int(eval(input()))\ny = 10**4\nfor i in range(y):\n for j in range(-y, y):\n if i**5 - j**5 == x:\n print((i, j))\n exit()\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-X = int(eval(input())) # \u6570\u5b57","-for i in range(10**8):","- for j in range(-10000, 10**4):","- if i**5 - j**5 == X:","+x = int(eval(input()))","+y = 10**4","+for i in range(y):","+ for j in range(-y, y):","+ if i**5 - j**5 == x:"],"diff_only_import_comment":false,"measured_runtime_v0":0.5543799698,"measured_runtime_v1":0.3403863927,"runtime_lift":1.628678413,"key":["s361313136","s308076339"]} +{"user_id":"u150984829","problem_id":"p02386","language":"python","submission_id_v0":"s352388599","submission_id_v1":"s199670495","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":5616,"memory_v1":5616,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\na=[[int(s)for s in input().split()]for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":457,"code_v1_num_chars":459,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\n [0, 1, 2, 3, 4, 5],\n [1, 5, 2, 0, 4, 3],\n [2, 1, 5, 3, 0, 4],\n [3, 0, 2, 5, 4, 1],\n [4, 1, 0, 3, 5, 2],\n [5, 1, 4, 3, 2, 0],\n ):\n f = [d[k] for k in p]\n if f[0] == e[0] and f[5] == e[5]:\n f = f[1:5] * 2\n for k in range(4):\n if f[k : k + 4] == e[1:5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = [[int(s) for s in input().split()] for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\n [0, 1, 2, 3, 4, 5],\n [1, 5, 2, 0, 4, 3],\n [2, 1, 5, 3, 0, 4],\n [3, 0, 2, 5, 4, 1],\n [4, 1, 0, 3, 5, 2],\n [5, 1, 4, 3, 2, 0],\n ):\n f = [d[k] for k in p]\n if f[0] == e[0] and f[5] == e[5]:\n f = f[1:5] * 2\n for k in range(4):\n if f[k : k + 4] == e[1:5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a = [list(map(int, input().split())) for _ in range(n)]","+a = [[int(s) for s in input().split()] for _ in range(n)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2724710764,"measured_runtime_v1":0.2146971788,"runtime_lift":1.2690948152,"key":["s352388599","s199670495"]} +{"user_id":"u456353530","problem_id":"p03273","language":"python","submission_id_v0":"s657571871","submission_id_v1":"s367684184","cpu_time_v0":156,"cpu_time_v1":19,"memory_v0":12500,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nH, W = list(map(int, input().split()))\n\n\n\na = np.array([list(eval(input())) for i in range(H)])\n\n\n\nat = np.all(a == '.', axis = 1)\n\nfor i in reversed(list(range(len(at)))):\n\n if at[i]:\n\n a = np.delete(a, i, 0)\n\n\n\nat = np.all(a == '.', axis = 0)\n\nfor i in reversed(list(range(len(at)))):\n\n if at[i]:\n\n a = np.delete(a, i, 1)\n\nfor i in a:\n\n print((''.join(i)))\n\n# optimized version of the same code:\n","target":"H, W = list(map(int, input().split()))\n\n\n\na = [list(eval(input())) for i in range(H)]\n\n\n\nfor i in reversed(list(range(len(a)))):\n\n if '#' not in a[i]:\n\n del a[i]\n\n\n\na = list(zip(*a))\n\nfor i in reversed(list(range(len(a)))):\n\n if '#' not in a[i]:\n\n del a[i]\n\n\n\na = list(zip(*a))\n\n \n\nfor i in a:\n\n print((''.join(i)))","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":367,"code_v1_num_chars":312,"code_v0_no_empty_lines":"import numpy as np\n\nH, W = list(map(int, input().split()))\na = np.array([list(eval(input())) for i in range(H)])\nat = np.all(a == \".\", axis=1)\nfor i in reversed(list(range(len(at)))):\n if at[i]:\n a = np.delete(a, i, 0)\nat = np.all(a == \".\", axis=0)\nfor i in reversed(list(range(len(at)))):\n if at[i]:\n a = np.delete(a, i, 1)\nfor i in a:\n print((\"\".join(i)))\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\na = [list(eval(input())) for i in range(H)]\nfor i in reversed(list(range(len(a)))):\n if \"#\" not in a[i]:\n del a[i]\na = list(zip(*a))\nfor i in reversed(list(range(len(a)))):\n if \"#\" not in a[i]:\n del a[i]\na = list(zip(*a))\nfor i in a:\n print((\"\".join(i)))\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-import numpy as np","-","-a = np.array([list(eval(input())) for i in range(H)])","-at = np.all(a == \".\", axis=1)","-for i in reversed(list(range(len(at)))):","- if at[i]:","- a = np.delete(a, i, 0)","-at = np.all(a == \".\", axis=0)","-for i in reversed(list(range(len(at)))):","- if at[i]:","- a = np.delete(a, i, 1)","+a = [list(eval(input())) for i in range(H)]","+for i in reversed(list(range(len(a)))):","+ if \"#\" not in a[i]:","+ del a[i]","+a = list(zip(*a))","+for i in reversed(list(range(len(a)))):","+ if \"#\" not in a[i]:","+ del a[i]","+a = list(zip(*a))"],"diff_only_import_comment":false,"measured_runtime_v0":1.6232817362,"measured_runtime_v1":0.2846437557,"runtime_lift":5.7028538438,"key":["s657571871","s367684184"]} +{"user_id":"u860002137","problem_id":"p02952","language":"python","submission_id_v0":"s726498671","submission_id_v1":"s714071292","cpu_time_v0":61,"cpu_time_v1":26,"memory_v0":2940,"memory_v1":9004,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.38,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\n\n\nans = 0\n\n\n\nfor i in range(1, N+1):\n\n if len(str(i))%2==1:\n\n ans += 1\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\n\n\ndef rec(length):\n\n if length == 1:\n\n return 9\n\n else:\n\n return 9 * 10**(length - 1) + rec(length - 2)\n\n\n\n\n\nn = eval(input())\n\nlength = len(n)\n\n\n\nif length == 1:\n\n print(n)\n\n sys.exit()\n\n\n\nif length % 2 == 0:\n\n ans = rec(length - 1)\n\nelse:\n\n ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1\n\n\n\nprint(ans)","code_v0_loc":9,"code_v1_loc":23,"code_v0_num_chars":112,"code_v1_num_chars":363,"code_v0_no_empty_lines":"N = int(eval(input()))\nans = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 == 1:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\n\ndef rec(length):\n if length == 1:\n return 9\n else:\n return 9 * 10 ** (length - 1) + rec(length - 2)\n\n\nn = eval(input())\nlength = len(n)\nif length == 1:\n print(n)\n sys.exit()\nif length % 2 == 0:\n ans = rec(length - 1)\nelse:\n ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":60.8695652174,"diff":["-N = int(eval(input()))","-ans = 0","-for i in range(1, N + 1):","- if len(str(i)) % 2 == 1:","- ans += 1","+import sys","+","+","+def rec(length):","+ if length == 1:","+ return 9","+ else:","+ return 9 * 10 ** (length - 1) + rec(length - 2)","+","+","+n = eval(input())","+length = len(n)","+if length == 1:","+ print(n)","+ sys.exit()","+if length % 2 == 0:","+ ans = rec(length - 1)","+else:","+ ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.2155013096,"measured_runtime_v1":0.1672313638,"runtime_lift":1.2886417043,"key":["s726498671","s714071292"]} +{"user_id":"u252828980","problem_id":"p03568","language":"python","submission_id_v0":"s580844178","submission_id_v1":"s651852186","cpu_time_v0":306,"cpu_time_v1":168,"memory_v0":27248,"memory_v1":8704,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.1,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nfrom itertools import product\n\n\n\nn = int(eval(input()))\n\na = list(map(int,input().split()))\n\n\n\na = np.array(a)\n\n\n\nli = [-1,0,1]\n\ncnt = 0\n\nfor v in product(li,repeat = n):\n\n v = np.array(v)\n\n L =a+v\n\n cum = L.cumprod()\n\n if cum[-1]%2 ==0 :\n\n cnt +=1\n\nprint(cnt)\n\n \n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na = list(map(int,input().split()))\n\n\n\nfrom itertools import product\n\n\n\nli = [-1,0,1]\n\ncnt = 0\n\nfor v in product(li,repeat = n):\n\n L = []\n\n for i in range(n):\n\n L.append(v[i]+a[i])\n\n if any(x%2==0 for x in L):\n\n cnt +=1\n\n\n\nprint(cnt)","code_v0_loc":18,"code_v1_loc":15,"code_v0_num_chars":303,"code_v1_num_chars":273,"code_v0_no_empty_lines":"import numpy as np\nfrom itertools import product\n\nn = int(eval(input()))\na = list(map(int, input().split()))\na = np.array(a)\nli = [-1, 0, 1]\ncnt = 0\nfor v in product(li, repeat=n):\n v = np.array(v)\n L = a + v\n cum = L.cumprod()\n if cum[-1] % 2 == 0:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nfrom itertools import product\n\nli = [-1, 0, 1]\ncnt = 0\nfor v in product(li, repeat=n):\n L = []\n for i in range(n):\n L.append(v[i] + a[i])\n if any(x % 2 == 0 for x in L):\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-import numpy as np","+n = int(eval(input()))","+a = list(map(int, input().split()))","-n = int(eval(input()))","-a = list(map(int, input().split()))","-a = np.array(a)","- v = np.array(v)","- L = a + v","- cum = L.cumprod()","- if cum[-1] % 2 == 0:","+ L = []","+ for i in range(n):","+ L.append(v[i] + a[i])","+ if any(x % 2 == 0 for x in L):"],"diff_only_import_comment":false,"measured_runtime_v0":1.8323921626,"measured_runtime_v1":0.5995062318,"runtime_lift":3.056502277,"key":["s580844178","s651852186"]} +{"user_id":"u761320129","problem_id":"p03425","language":"python","submission_id_v0":"s293375746","submission_id_v1":"s279901441","cpu_time_v0":180,"cpu_time_v1":149,"memory_v0":10112,"memory_v1":10876,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport itertools\n\nfrom collections import Counter\n\nN = int(eval(input()))\n\nsrc = [eval(input()) for i in range(N)]\n\nctr = Counter()\n\nfor s in src:\n\n ctr[s[0]] += 1\n\n\n\nans = 0\n\nfor ptn in itertools.combinations('MARCH',3):\n\n a,b,c = ptn\n\n ans += ctr[a]*ctr[b]*ctr[c]\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nS = [eval(input()) for i in range(N)]\n\nfrom collections import Counter\n\nctr = Counter([s[0] for s in S])\n\n\n\nans = 0\n\nimport itertools\n\nfor ptn in itertools.combinations('MARCH', 3):\n\n t = 1\n\n for c in ptn:\n\n t *= ctr[c]\n\n ans += t\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":274,"code_v1_num_chars":270,"code_v0_no_empty_lines":"import itertools\nfrom collections import Counter\n\nN = int(eval(input()))\nsrc = [eval(input()) for i in range(N)]\nctr = Counter()\nfor s in src:\n ctr[s[0]] += 1\nans = 0\nfor ptn in itertools.combinations(\"MARCH\", 3):\n a, b, c = ptn\n ans += ctr[a] * ctr[b] * ctr[c]\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = [eval(input()) for i in range(N)]\nfrom collections import Counter\n\nctr = Counter([s[0] for s in S])\nans = 0\nimport itertools\n\nfor ptn in itertools.combinations(\"MARCH\", 3):\n t = 1\n for c in ptn:\n t *= ctr[c]\n ans += t\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import itertools","+N = int(eval(input()))","+S = [eval(input()) for i in range(N)]","-N = int(eval(input()))","-src = [eval(input()) for i in range(N)]","-ctr = Counter()","-for s in src:","- ctr[s[0]] += 1","+ctr = Counter([s[0] for s in S])","+import itertools","+","- a, b, c = ptn","- ans += ctr[a] * ctr[b] * ctr[c]","+ t = 1","+ for c in ptn:","+ t *= ctr[c]","+ ans += t"],"diff_only_import_comment":false,"measured_runtime_v0":0.206595207,"measured_runtime_v1":0.1454657862,"runtime_lift":1.420232292,"key":["s293375746","s279901441"]} +{"user_id":"u047102107","problem_id":"p02952","language":"python","submission_id_v0":"s855248831","submission_id_v1":"s153783643","cpu_time_v0":193,"cpu_time_v1":64,"memory_v0":40812,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.84,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n num_dig = 0\n\n ii = i\n\n while ii > 0:\n\n ii = int(ii \/ 10)\n\n num_dig += 1\n\n if num_dig % 2 != 0:\n\n count += 1\n\n\n\nprint(count)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n if len(str(i)) % 2 != 0:\n\n count += 1\n\nprint(count)","code_v0_loc":13,"code_v1_loc":7,"code_v0_num_chars":215,"code_v1_num_chars":120,"code_v0_no_empty_lines":"N = int(eval(input()))\ncount = 0\nfor i in range(1, N + 1):\n num_dig = 0\n ii = i\n while ii > 0:\n ii = int(ii \/ 10)\n num_dig += 1\n if num_dig % 2 != 0:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"N = int(eval(input()))\ncount = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 != 0:\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":46.1538461538,"diff":["- num_dig = 0","- ii = i","- while ii > 0:","- ii = int(ii \/ 10)","- num_dig += 1","- if num_dig % 2 != 0:","+ if len(str(i)) % 2 != 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3673675511,"measured_runtime_v1":0.2702338476,"runtime_lift":1.3594431427,"key":["s855248831","s153783643"]} +{"user_id":"u372550522","problem_id":"p02801","language":"python","submission_id_v0":"s439687684","submission_id_v1":"s397132828","cpu_time_v0":25,"cpu_time_v1":17,"memory_v0":3768,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom string import ascii_lowercase as lower\n\nprint((lower[lower.find(eval(input()))+1]))\n\n# optimized version of the same code:\n","target":"print((chr(ord(eval(input()))+1)))","code_v0_loc":2,"code_v1_loc":1,"code_v0_num_chars":80,"code_v1_num_chars":26,"code_v0_no_empty_lines":"from string import ascii_lowercase as lower\n\nprint((lower[lower.find(eval(input())) + 1]))\n","code_v1_no_empty_lines":"print((chr(ord(eval(input())) + 1)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-from string import ascii_lowercase as lower","-","-print((lower[lower.find(eval(input())) + 1]))","+print((chr(ord(eval(input())) + 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3241319713,"measured_runtime_v1":0.2361063808,"runtime_lift":1.3728217348,"key":["s439687684","s397132828"]} +{"user_id":"u759412327","problem_id":"p03575","language":"python","submission_id_v0":"s189199377","submission_id_v1":"s590295023","cpu_time_v0":249,"cpu_time_v1":43,"memory_v0":17568,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom scipy.sparse import *\n\nN,M,*A=list(map(int,open(0).read().split()));g=csr_matrix(([1]*M,(A[::2],A[1::2])),shape=(N+1,N+1)).tolil()\n\nc = 0\n\n\n\nfor a,b in zip(*g.nonzero()):\n\n g[a,b]=0\n\n n,_=csgraph.connected_components(g)\n\n c+=n!=2\n\n g[a,b]=1\n\n\n\nprint(c)\n\n# optimized version of the same code:\n","target":"N,M=list(map(int,input().split()))\n\nedges=[list(map(int,input().split())) for i in range(M)]\n\nans=0\n\nfor x in edges:\n\n l=list(range(N))\n\n for y in edges:\n\n if y!=x:l=[l[y[0]-1] if l[i]==l[y[1]-1] else l[i] for i in range(N)]\n\n if len(set(l))!=1:ans+=1\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":255,"code_v1_num_chars":273,"code_v0_no_empty_lines":"from scipy.sparse import *\n\nN, M, *A = list(map(int, open(0).read().split()))\ng = csr_matrix(([1] * M, (A[::2], A[1::2])), shape=(N + 1, N + 1)).tolil()\nc = 0\nfor a, b in zip(*g.nonzero()):\n g[a, b] = 0\n n, _ = csgraph.connected_components(g)\n c += n != 2\n g[a, b] = 1\nprint(c)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for i in range(M)]\nans = 0\nfor x in edges:\n l = list(range(N))\n for y in edges:\n if y != x:\n l = [l[y[0] - 1] if l[i] == l[y[1] - 1] else l[i] for i in range(N)]\n if len(set(l)) != 1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-from scipy.sparse import *","-","-N, M, *A = list(map(int, open(0).read().split()))","-g = csr_matrix(([1] * M, (A[::2], A[1::2])), shape=(N + 1, N + 1)).tolil()","-c = 0","-for a, b in zip(*g.nonzero()):","- g[a, b] = 0","- n, _ = csgraph.connected_components(g)","- c += n != 2","- g[a, b] = 1","-print(c)","+N, M = list(map(int, input().split()))","+edges = [list(map(int, input().split())) for i in range(M)]","+ans = 0","+for x in edges:","+ l = list(range(N))","+ for y in edges:","+ if y != x:","+ l = [l[y[0] - 1] if l[i] == l[y[1] - 1] else l[i] for i in range(N)]","+ if len(set(l)) != 1:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.8243682652,"measured_runtime_v1":0.2276114681,"runtime_lift":8.0152739248,"key":["s189199377","s590295023"]} +{"user_id":"u585482323","problem_id":"p03634","language":"python","submission_id_v0":"s798160758","submission_id_v1":"s876456894","cpu_time_v0":777,"cpu_time_v1":659,"memory_v0":85552,"memory_v1":85552,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.19,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!usr\/bin\/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]\/\/g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.pop()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n\n\n# optimized version of the same code:\n","target":"#!usr\/bin\/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]\/\/g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.popleft()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n","code_v0_loc":105,"code_v1_loc":105,"code_v0_num_chars":1535,"code_v1_num_chars":1539,"code_v0_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\n\"\"\"\ndef gcd(a,b):\n if a == 0:\n return b\n return gcd(b%a,a)\nn = I()\na = IR(n)\nl = a[0]\nfor i in range(1,n):\n g = gcd(l,a[i])\n l *= a[i]\/\/g\nprint(l)\n\"\"\"\n# B\nn = I()\nv = [[] for i in range(n)]\nfor i in range(n - 1):\n a, b, c = LI()\n a -= 1\n b -= 1\n v[a].append([b, c])\n v[b].append([a, c])\nQ, k = LI()\nd = [-1 for i in range(n)]\nd[k - 1] = 0\nq = deque()\nq.append(k - 1)\nwhile q:\n x = q.pop()\n for y, c in v[x]:\n if d[y] == -1:\n d[y] = d[x] + c\n q.append(y)\nfor i in range(Q):\n x, y = LI()\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n# C\n# D\n# E\n# F\n# G\n# H\n# I\n# J\n# K\n# L\n# M\n# N\n# O\n# P\n# Q\n# R\n# S\n# T\n","code_v1_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\n\"\"\"\ndef gcd(a,b):\n if a == 0:\n return b\n return gcd(b%a,a)\nn = I()\na = IR(n)\nl = a[0]\nfor i in range(1,n):\n g = gcd(l,a[i])\n l *= a[i]\/\/g\nprint(l)\n\"\"\"\n# B\nn = I()\nv = [[] for i in range(n)]\nfor i in range(n - 1):\n a, b, c = LI()\n a -= 1\n b -= 1\n v[a].append([b, c])\n v[b].append([a, c])\nQ, k = LI()\nd = [-1 for i in range(n)]\nd[k - 1] = 0\nq = deque()\nq.append(k - 1)\nwhile q:\n x = q.popleft()\n for y, c in v[x]:\n if d[y] == -1:\n d[y] = d[x] + c\n q.append(y)\nfor i in range(Q):\n x, y = LI()\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n# C\n# D\n# E\n# F\n# G\n# H\n# I\n# J\n# K\n# L\n# M\n# N\n# O\n# P\n# Q\n# R\n# S\n# T\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- x = q.pop()","+ x = q.popleft()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3495916958,"measured_runtime_v1":0.1121557097,"runtime_lift":3.1170209395,"key":["s798160758","s876456894"]} +{"user_id":"u764860452","problem_id":"p02837","language":"python","submission_id_v0":"s640707950","submission_id_v1":"s941679143","cpu_time_v0":91,"cpu_time_v1":80,"memory_v0":3064,"memory_v1":9092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.09,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom itertools import product\n\nN=int(eval(input()))\n\ndata=[]\n\nfor i in range(N):\n\n for j in range(int(eval(input()))):\n\n x,y=list(map(int,input().split()))\n\n data.append((i,x-1,y))\n\n#print(data)\n\n\n\nans=0\n\nfor i in product([1,0],repeat=N):\n\n #print(i)\n\n s=True\n\n for k in data:\n\n if i[k[0]]==1 and i[k[1]]!=k[2]:\n\n s=False\n\n break\n\n if s:\n\n ans=max(ans,sum(i))\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"from itertools import product\n\n\n\nN=int(eval(input()))\n\ndata=[]\n\nfor i in range(N):\n\n for j in range(int(eval(input()))):\n\n x,y=list(map(int,input().split()))\n\n data.append((i,x-1,y)) #i\u3055\u3093\u304cx-1\u3055\u3093\u306b\u5618(0)or\u6b63\u76f4(1)\n\n\n\n\n\nans=0\n\nfor i in product([0,1],repeat=N):\n\n ok=True\n\n for j in data:\n\n if i[j[0]]==1 and i[j[1]]!=j[2]:\n\n ok = False\n\n break\n\n if ok:\n\n ans=max(ans,sum(i))\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":20,"code_v0_num_chars":419,"code_v1_num_chars":421,"code_v0_no_empty_lines":"from itertools import product\n\nN = int(eval(input()))\ndata = []\nfor i in range(N):\n for j in range(int(eval(input()))):\n x, y = list(map(int, input().split()))\n data.append((i, x - 1, y))\n# print(data)\nans = 0\nfor i in product([1, 0], repeat=N):\n # print(i)\n s = True\n for k in data:\n if i[k[0]] == 1 and i[k[1]] != k[2]:\n s = False\n break\n if s:\n ans = max(ans, sum(i))\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import product\n\nN = int(eval(input()))\ndata = []\nfor i in range(N):\n for j in range(int(eval(input()))):\n x, y = list(map(int, input().split()))\n data.append((i, x - 1, y)) # i\u3055\u3093\u304cx-1\u3055\u3093\u306b\u5618(0)or\u6b63\u76f4(1)\nans = 0\nfor i in product([0, 1], repeat=N):\n ok = True\n for j in data:\n if i[j[0]] == 1 and i[j[1]] != j[2]:\n ok = False\n break\n if ok:\n ans = max(ans, sum(i))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- data.append((i, x - 1, y))","-# print(data)","+ data.append((i, x - 1, y)) # i\u3055\u3093\u304cx-1\u3055\u3093\u306b\u5618(0)or\u6b63\u76f4(1)","-for i in product([1, 0], repeat=N):","- # print(i)","- s = True","- for k in data:","- if i[k[0]] == 1 and i[k[1]] != k[2]:","- s = False","+for i in product([0, 1], repeat=N):","+ ok = True","+ for j in data:","+ if i[j[0]] == 1 and i[j[1]] != j[2]:","+ ok = False","- if s:","+ if ok:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2105706298,"measured_runtime_v1":0.1425504391,"runtime_lift":1.4771657746,"key":["s640707950","s941679143"]} +{"user_id":"u419874471","problem_id":"p04012","language":"python","submission_id_v0":"s872816747","submission_id_v1":"s223982270","cpu_time_v0":32,"cpu_time_v1":17,"memory_v0":3956,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.88,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport string\n\nw = eval(input())\n\nfor a in string.ascii_lowercase:\n\n cnt = 0\n\n for t in w:\n\n if t == a:\n\n cnt = cnt + 1\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")\n\n# optimized version of the same code:\n","target":"w = eval(input())\n\nm = [0] * 26\n\nfor t in w:\n\n m[ord(t) - ord('a')] += 1\n\n\n\nfor cnt in m:\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":212,"code_v1_num_chars":161,"code_v0_no_empty_lines":"import string\n\nw = eval(input())\nfor a in string.ascii_lowercase:\n cnt = 0\n for t in w:\n if t == a:\n cnt = cnt + 1\n if cnt % 2 == 1:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"w = eval(input())\nm = [0] * 26\nfor t in w:\n m[ord(t) - ord(\"a\")] += 1\nfor cnt in m:\n if cnt % 2 == 1:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import string","-","-for a in string.ascii_lowercase:","- cnt = 0","- for t in w:","- if t == a:","- cnt = cnt + 1","+m = [0] * 26","+for t in w:","+ m[ord(t) - ord(\"a\")] += 1","+for cnt in m:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2442542629,"measured_runtime_v1":0.193693031,"runtime_lift":1.2610379509,"key":["s872816747","s223982270"]} +{"user_id":"u133936772","problem_id":"p03013","language":"python","submission_id_v0":"s323963688","submission_id_v1":"s220101257","cpu_time_v0":187,"cpu_time_v1":70,"memory_v0":3828,"memory_v1":3828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.57,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nmod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(eval(input()))-1] = 1\n\n\n\ns = 0\n\nt = 1\n\n\n\nfor i in range(n):\n\n if l[i] > 0:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nmod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(eval(input()))-1] = 1\n\n\n\nt, s = 1, 0\n\n\n\nfor i in range(n):\n\n if l[i]:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)","code_v0_loc":16,"code_v1_loc":18,"code_v0_num_chars":220,"code_v1_num_chars":257,"code_v0_no_empty_lines":"mod = 10**9 + 7\nn, m = list(map(int, input().split()))\nl = [0] * n\nfor _ in range(m):\n l[int(eval(input())) - 1] = 1\ns = 0\nt = 1\nfor i in range(n):\n if l[i] > 0:\n t, s = 0, t\n else:\n t, s = (s + t) % mod, t\nprint(t)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nmod = 10**9 + 7\nn, m = list(map(int, input().split()))\nl = [0] * n\nfor _ in range(m):\n l[int(eval(input())) - 1] = 1\nt, s = 1, 0\nfor i in range(n):\n if l[i]:\n t, s = 0, t\n else:\n t, s = (s + t) % mod, t\nprint(t)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["+import sys","+","+input = sys.stdin.readline","-s = 0","-t = 1","+t, s = 1, 0","- if l[i] > 0:","+ if l[i]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3071881404,"measured_runtime_v1":0.1884790037,"runtime_lift":1.6298268475,"key":["s323963688","s220101257"]} +{"user_id":"u911856499","problem_id":"p03774","language":"python","submission_id_v0":"s205905114","submission_id_v1":"s474977819","cpu_time_v0":31,"cpu_time_v1":26,"memory_v0":9140,"memory_v1":9144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.13,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 2*10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n\n\n# optimized version of the same code:\n","target":"N,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":360,"code_v1_num_chars":358,"code_v0_no_empty_lines":"N, M = [int(c) for c in input().split()]\nab = [list(map(int, input().split())) for c in range(N)]\ncd = [list(map(int, input().split())) for c in range(M)]\nfor i in range(N):\n mi = 2 * 10**9\n for j in range(M):\n tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n if mi > tmp:\n mi = tmp\n ans = j + 1\n print(ans)\n","code_v1_no_empty_lines":"N, M = [int(c) for c in input().split()]\nab = [list(map(int, input().split())) for c in range(N)]\ncd = [list(map(int, input().split())) for c in range(M)]\nfor i in range(N):\n mi = 10**9\n for j in range(M):\n tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n if mi > tmp:\n mi = tmp\n ans = j + 1\n print(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- mi = 2 * 10**9","+ mi = 10**9"],"diff_only_import_comment":false,"measured_runtime_v0":0.2982070241,"measured_runtime_v1":0.232865705,"runtime_lift":1.2805965742,"key":["s205905114","s474977819"]} +{"user_id":"u638456847","problem_id":"p02690","language":"python","submission_id_v0":"s949059753","submission_id_v1":"s838856402","cpu_time_v0":40,"cpu_time_v1":25,"memory_v0":9176,"memory_v1":9400,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom bisect import bisect_right\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\ndef main():\n\n x = int(readline())\n\n\n\n for a in range(-120, 120):\n\n for b in range(-120, 120):\n\n if a**5 - b**5 == x:\n\n print((a, b))\n\n exit()\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"# AC: 33 msec(Python3)\n\nfrom itertools import combinations_with_replacement\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\ndef main():\n\n x = int(readline())\n\n\n\n ab = [i**5 for i in range(200)]\n\n\n\n C = combinations_with_replacement(ab, 2)\n\n for a, b in C:\n\n if a + b == x:\n\n print((int(pow(b, 0.2)), -int(pow(a, 0.2))))\n\n break\n\n \n\n if b - a == x:\n\n print((int(pow(b, 0.2)), int(pow(a, 0.2))))\n\n break\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":18,"code_v1_loc":25,"code_v0_num_chars":372,"code_v1_num_chars":573,"code_v0_no_empty_lines":"from bisect import bisect_right\nimport sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\n\ndef main():\n x = int(readline())\n for a in range(-120, 120):\n for b in range(-120, 120):\n if a**5 - b**5 == x:\n print((a, b))\n exit()\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# AC: 33 msec(Python3)\nfrom itertools import combinations_with_replacement\nimport sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\n\ndef main():\n x = int(readline())\n ab = [i**5 for i in range(200)]\n C = combinations_with_replacement(ab, 2)\n for a, b in C:\n if a + b == x:\n print((int(pow(b, 0.2)), -int(pow(a, 0.2))))\n break\n if b - a == x:\n print((int(pow(b, 0.2)), int(pow(a, 0.2))))\n break\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":28.0,"diff":["-from bisect import bisect_right","+# AC: 33 msec(Python3)","+from itertools import combinations_with_replacement","- for a in range(-120, 120):","- for b in range(-120, 120):","- if a**5 - b**5 == x:","- print((a, b))","- exit()","+ ab = [i**5 for i in range(200)]","+ C = combinations_with_replacement(ab, 2)","+ for a, b in C:","+ if a + b == x:","+ print((int(pow(b, 0.2)), -int(pow(a, 0.2))))","+ break","+ if b - a == x:","+ print((int(pow(b, 0.2)), int(pow(a, 0.2))))","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.3611294071,"measured_runtime_v1":0.2064747095,"runtime_lift":1.7490248947,"key":["s949059753","s838856402"]} +{"user_id":"u187857228","problem_id":"p03416","language":"python","submission_id_v0":"s720217601","submission_id_v1":"s964731712","cpu_time_v0":154,"cpu_time_v1":57,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.99,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n j = list(map(int,list(str(i))))\n\n if j[0] == j[4] and j[1] == j[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n\n\n# optimized version of the same code:\n","target":"def test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":261,"code_v1_num_chars":240,"code_v0_no_empty_lines":"def test():\n a, b = list(map(int, input().split()))\n count = 0\n for i in range(a, b + 1):\n j = list(map(int, list(str(i))))\n if j[0] == j[4] and j[1] == j[3]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n test()\n","code_v1_no_empty_lines":"def test():\n a, b = list(map(int, input().split()))\n count = 0\n for i in range(a, b + 1):\n if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n test()\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["- j = list(map(int, list(str(i))))","- if j[0] == j[4] and j[1] == j[3]:","+ if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.4881631348,"measured_runtime_v1":0.3868406759,"runtime_lift":1.2619229704,"key":["s720217601","s964731712"]} +{"user_id":"u285891772","problem_id":"p02725","language":"python","submission_id_v0":"s026186608","submission_id_v1":"s563865299","cpu_time_v0":309,"cpu_time_v1":236,"memory_v0":35140,"memory_v1":27236,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import accumulate, permutations, combinations, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\nimport numpy as np\n\n\n\nK, N = MAP()\n\nA = LIST()\n\nA.append(A[0]+K)\n\n\n\nB = np.zeros(N)\n\nfor i in range(N):\n\n \t\tB[i] = A[i+1] - A[i]\n\n\n\nprint((int(K - max(B))))\n\n# optimized version of the same code:\n","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import accumulate, permutations, combinations, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nK, N = MAP()\n\nA = LIST()\n\ndiff = abs(K - A[-1] + A[0])\n\nd = abs(K - A[-1] + A[0])\n\nif N == 2:\n\n print((min(d, A[1] - A[0])))\n\n exit()\n\nfor i in range(1, N):\n\n d += abs(A[i] - A[i-1])\n\n diff = max(diff, abs(A[i] - A[i-1]))\n\nprint((d - diff))","code_v0_loc":30,"code_v1_loc":31,"code_v0_num_chars":936,"code_v1_num_chars":1023,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import accumulate, permutations, combinations, product, groupby\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nimport numpy as np\n\nK, N = MAP()\nA = LIST()\nA.append(A[0] + K)\nB = np.zeros(N)\nfor i in range(N):\n B[i] = A[i + 1] - A[i]\nprint((int(K - max(B))))\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import accumulate, permutations, combinations, product, groupby\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nK, N = MAP()\nA = LIST()\ndiff = abs(K - A[-1] + A[0])\nd = abs(K - A[-1] + A[0])\nif N == 2:\n print((min(d, A[1] - A[0])))\n exit()\nfor i in range(1, N):\n d += abs(A[i] - A[i - 1])\n diff = max(diff, abs(A[i] - A[i - 1]))\nprint((d - diff))\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["-import numpy as np","-","-A.append(A[0] + K)","-B = np.zeros(N)","-for i in range(N):","- B[i] = A[i + 1] - A[i]","-print((int(K - max(B))))","+diff = abs(K - A[-1] + A[0])","+d = abs(K - A[-1] + A[0])","+if N == 2:","+ print((min(d, A[1] - A[0])))","+ exit()","+for i in range(1, N):","+ d += abs(A[i] - A[i - 1])","+ diff = max(diff, abs(A[i] - A[i - 1]))","+print((d - diff))"],"diff_only_import_comment":false,"measured_runtime_v0":1.6886389652,"measured_runtime_v1":0.2032547581,"runtime_lift":8.3079922987,"key":["s026186608","s563865299"]} +{"user_id":"u906428167","problem_id":"p02821","language":"python","submission_id_v0":"s228028161","submission_id_v1":"s587768475","cpu_time_v0":305,"cpu_time_v1":262,"memory_v0":55448,"memory_v1":54460,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.1,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom bisect import bisect_left\n\nfrom bisect import bisect_right\n\n\n\nn,m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = sorted(a)\n\n\n\na_count = [0]*100010\n\na_sum = [0]*100010\n\n\n\nfor i in range(n):\n\n a_count[a[i]] += 1\n\n a_sum[a[i]] += a[i]\n\n\n\nfor i in range(100005,-1,-1):\n\n a_count[i] += a_count[i+1]\n\n a_sum[i] += a_sum[i+1]\n\n\n\ndef chk(x):\n\n case = 0\n\n for i in range(n):\n\n if 0<= x-a[i]<= 10**5+5:\n\n case += a_count[x-a[i]]\n\n elif x-a[i] < 0:\n\n case += n\n\n if case >= m:\n\n ch = True\n\n else:\n\n ch = False\n\n return ch\n\n\n\nl = 2*a[-1]+1 #NG\n\nr = 1 #OK\n\n\n\nwhile abs(r-l) > 1:\n\n kk = (r+l)\/\/2\n\n if chk(kk):\n\n r = kk\n\n else:\n\n l = kk\n\n\n\nans = 0\n\nsm = sum(a)\n\n\n\nl = r\n\n\n\ncase = 0\n\nfor i in range(n):\n\n num = n-bisect_right(a,l-a[i]-1)\n\n case += num\n\n ans += num*a[i]*2\n\n\n\nans -= (case-m)*l\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n, m = list(map(int, input().split()))\n\na = [int(x) for x in input().split()]\n\n\n\naa = [0]*(10**5+1)\n\naa_sum = [0]*(10**5+1)\n\n\n\nfor x in a:\n\n aa[x] += 1\n\n aa_sum[x] += x\n\n\n\nfor i in range(10**5)[::-1]:\n\n aa[i] = aa[i] + aa[i+1]\n\n aa_sum[i] = aa_sum[i] + aa_sum[i+1]\n\n\n\n\n\ndef count(x):\n\n cnt = 0\n\n sm = 0\n\n for i in range(n):\n\n if x-a[i] < 0:\n\n cnt += n\n\n sm += aa_sum[0]+n*a[i]\n\n elif x-a[i] > 10**5:\n\n continue\n\n else:\n\n cnt += aa[x-a[i]]\n\n sm += aa_sum[x-a[i]]+aa[x-a[i]]*a[i]\n\n\n\n return cnt, sm\n\n\n\n\n\nbottom = 0\n\ntop = 10**6\n\n\n\nwhile top - bottom > 1:\n\n mid = (top+bottom) \/\/ 2\n\n cnt, sm = count(mid)\n\n if cnt < m:\n\n top = mid\n\n else:\n\n bottom = mid\n\n\n\ncnt, sm = count(bottom)\n\nans = sm - (cnt-m)*bottom\n\n\n\nprint(ans)\n","code_v0_loc":55,"code_v1_loc":46,"code_v0_num_chars":930,"code_v1_num_chars":839,"code_v0_no_empty_lines":"from bisect import bisect_left\nfrom bisect import bisect_right\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = sorted(a)\na_count = [0] * 100010\na_sum = [0] * 100010\nfor i in range(n):\n a_count[a[i]] += 1\n a_sum[a[i]] += a[i]\nfor i in range(100005, -1, -1):\n a_count[i] += a_count[i + 1]\n a_sum[i] += a_sum[i + 1]\n\n\ndef chk(x):\n case = 0\n for i in range(n):\n if 0 <= x - a[i] <= 10**5 + 5:\n case += a_count[x - a[i]]\n elif x - a[i] < 0:\n case += n\n if case >= m:\n ch = True\n else:\n ch = False\n return ch\n\n\nl = 2 * a[-1] + 1 # NG\nr = 1 # OK\nwhile abs(r - l) > 1:\n kk = (r + l) \/\/ 2\n if chk(kk):\n r = kk\n else:\n l = kk\nans = 0\nsm = sum(a)\nl = r\ncase = 0\nfor i in range(n):\n num = n - bisect_right(a, l - a[i] - 1)\n case += num\n ans += num * a[i] * 2\nans -= (case - m) * l\nprint(ans)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\na = [int(x) for x in input().split()]\naa = [0] * (10**5 + 1)\naa_sum = [0] * (10**5 + 1)\nfor x in a:\n aa[x] += 1\n aa_sum[x] += x\nfor i in range(10**5)[::-1]:\n aa[i] = aa[i] + aa[i + 1]\n aa_sum[i] = aa_sum[i] + aa_sum[i + 1]\n\n\ndef count(x):\n cnt = 0\n sm = 0\n for i in range(n):\n if x - a[i] < 0:\n cnt += n\n sm += aa_sum[0] + n * a[i]\n elif x - a[i] > 10**5:\n continue\n else:\n cnt += aa[x - a[i]]\n sm += aa_sum[x - a[i]] + aa[x - a[i]] * a[i]\n return cnt, sm\n\n\nbottom = 0\ntop = 10**6\nwhile top - bottom > 1:\n mid = (top + bottom) \/\/ 2\n cnt, sm = count(mid)\n if cnt < m:\n top = mid\n else:\n bottom = mid\ncnt, sm = count(bottom)\nans = sm - (cnt - m) * bottom\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.3636363636,"diff":["-from bisect import bisect_left","-from bisect import bisect_right","-","-a = list(map(int, input().split()))","-a = sorted(a)","-a_count = [0] * 100010","-a_sum = [0] * 100010","-for i in range(n):","- a_count[a[i]] += 1","- a_sum[a[i]] += a[i]","-for i in range(100005, -1, -1):","- a_count[i] += a_count[i + 1]","- a_sum[i] += a_sum[i + 1]","+a = [int(x) for x in input().split()]","+aa = [0] * (10**5 + 1)","+aa_sum = [0] * (10**5 + 1)","+for x in a:","+ aa[x] += 1","+ aa_sum[x] += x","+for i in range(10**5)[::-1]:","+ aa[i] = aa[i] + aa[i + 1]","+ aa_sum[i] = aa_sum[i] + aa_sum[i + 1]","-def chk(x):","- case = 0","+def count(x):","+ cnt = 0","+ sm = 0","- if 0 <= x - a[i] <= 10**5 + 5:","- case += a_count[x - a[i]]","- elif x - a[i] < 0:","- case += n","- if case >= m:","- ch = True","- else:","- ch = False","- return ch","+ if x - a[i] < 0:","+ cnt += n","+ sm += aa_sum[0] + n * a[i]","+ elif x - a[i] > 10**5:","+ continue","+ else:","+ cnt += aa[x - a[i]]","+ sm += aa_sum[x - a[i]] + aa[x - a[i]] * a[i]","+ return cnt, sm","-l = 2 * a[-1] + 1 # NG","-r = 1 # OK","-while abs(r - l) > 1:","- kk = (r + l) \/\/ 2","- if chk(kk):","- r = kk","+bottom = 0","+top = 10**6","+while top - bottom > 1:","+ mid = (top + bottom) \/\/ 2","+ cnt, sm = count(mid)","+ if cnt < m:","+ top = mid","- l = kk","-ans = 0","-sm = sum(a)","-l = r","-case = 0","-for i in range(n):","- num = n - bisect_right(a, l - a[i] - 1)","- case += num","- ans += num * a[i] * 2","-ans -= (case - m) * l","+ bottom = mid","+cnt, sm = count(bottom)","+ans = sm - (cnt - m) * bottom"],"diff_only_import_comment":false,"measured_runtime_v0":0.6311447213,"measured_runtime_v1":0.3899716654,"runtime_lift":1.6184373822,"key":["s228028161","s587768475"]} +{"user_id":"u624475441","problem_id":"p03548","language":"python","submission_id_v0":"s161926153","submission_id_v1":"s067842786","cpu_time_v0":36,"cpu_time_v1":18,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nX, Y, Z = list(map(int, input().split()))\n\nfor n in range(10 ** 5, 0, -1):\n\n if X >= n * (Y + Z) + Z:\n\n break\n\nprint(n)\n\n# optimized version of the same code:\n","target":"X, Y, Z = list(map(int, input().split()))\n\nprint(((X - Z) \/\/ (Y + Z)))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":123,"code_v1_num_chars":62,"code_v0_no_empty_lines":"X, Y, Z = list(map(int, input().split()))\nfor n in range(10**5, 0, -1):\n if X >= n * (Y + Z) + Z:\n break\nprint(n)\n","code_v1_no_empty_lines":"X, Y, Z = list(map(int, input().split()))\nprint(((X - Z) \/\/ (Y + Z)))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-for n in range(10**5, 0, -1):","- if X >= n * (Y + Z) + Z:","- break","-print(n)","+print(((X - Z) \/\/ (Y + Z)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4167550103,"measured_runtime_v1":0.2488601058,"runtime_lift":1.6746557624,"key":["s161926153","s067842786"]} +{"user_id":"u465961647","problem_id":"p02576","language":"python","submission_id_v0":"s578033438","submission_id_v1":"s457299018","cpu_time_v0":28,"cpu_time_v1":25,"memory_v0":9032,"memory_v1":9096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\narray = list(map(int, input().split()))\n\nif array[0] % array[1] > 0:\n\n print(((array[0] \/\/ array[1] + 1) * array[2]))\n\nelse:\n\n print(((array[0] \/\/ array[1]) * array[2]))\n\n# optimized version of the same code:\n","target":"n, x, t = list(map(int, input().split()))\n\n\n\nprint((0--n\/\/x*t))","code_v0_loc":5,"code_v1_loc":3,"code_v0_num_chars":171,"code_v1_num_chars":55,"code_v0_no_empty_lines":"array = list(map(int, input().split()))\nif array[0] % array[1] > 0:\n print(((array[0] \/\/ array[1] + 1) * array[2]))\nelse:\n print(((array[0] \/\/ array[1]) * array[2]))\n","code_v1_no_empty_lines":"n, x, t = list(map(int, input().split()))\nprint((0 - -n \/\/ x * t))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-array = list(map(int, input().split()))","-if array[0] % array[1] > 0:","- print(((array[0] \/\/ array[1] + 1) * array[2]))","-else:","- print(((array[0] \/\/ array[1]) * array[2]))","+n, x, t = list(map(int, input().split()))","+print((0 - -n \/\/ x * t))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1827679622,"measured_runtime_v1":0.0061908547,"runtime_lift":29.5222502437,"key":["s578033438","s457299018"]} +{"user_id":"u153665391","problem_id":"p02268","language":"python","submission_id_v0":"s156684058","submission_id_v1":"s820654012","cpu_time_v0":520,"cpu_time_v1":390,"memory_v0":16712,"memory_v1":16712,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nS = list(map(int, input().split()))\n\nQ = int(eval(input()))\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n idx = int((head+tail)\/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n if head == idx:\n\n return False\n\n return binary_search(target_num, head, idx-1)\n\n else:\n\n if tail == idx:\n\n return False\n\n return binary_search(target_num, idx+1, tail)\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nS = list(map(int, input().split()))\n\nQ = int(eval(input()))\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n while head <= tail:\n\n idx = int((head+tail)\/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n tail = idx - 1\n\n else:\n\n head = idx + 1\n\n return False\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n","code_v0_loc":25,"code_v1_loc":23,"code_v0_num_chars":634,"code_v1_num_chars":541,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = list(map(int, input().split()))\nQ = int(eval(input()))\nT = list(map(int, input().split()))\n\n\ndef binary_search(target_num, head, tail):\n idx = int((head + tail) \/ 2)\n if target_num == S[idx]:\n return True\n elif target_num < S[idx]:\n if head == idx:\n return False\n return binary_search(target_num, head, idx - 1)\n else:\n if tail == idx:\n return False\n return binary_search(target_num, idx + 1, tail)\n\n\nmatch_count = 0\nfor target_num in T:\n if binary_search(target_num, 0, len(S) - 1):\n match_count += 1\nprint((str(match_count)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = list(map(int, input().split()))\nQ = int(eval(input()))\nT = list(map(int, input().split()))\n\n\ndef binary_search(target_num, head, tail):\n while head <= tail:\n idx = int((head + tail) \/ 2)\n if target_num == S[idx]:\n return True\n elif target_num < S[idx]:\n tail = idx - 1\n else:\n head = idx + 1\n return False\n\n\nmatch_count = 0\nfor target_num in T:\n if binary_search(target_num, 0, len(S) - 1):\n match_count += 1\nprint((str(match_count)))\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["- idx = int((head + tail) \/ 2)","- if target_num == S[idx]:","- return True","- elif target_num < S[idx]:","- if head == idx:","- return False","- return binary_search(target_num, head, idx - 1)","- else:","- if tail == idx:","- return False","- return binary_search(target_num, idx + 1, tail)","+ while head <= tail:","+ idx = int((head + tail) \/ 2)","+ if target_num == S[idx]:","+ return True","+ elif target_num < S[idx]:","+ tail = idx - 1","+ else:","+ head = idx + 1","+ return False"],"diff_only_import_comment":false,"measured_runtime_v0":0.3635195796,"measured_runtime_v1":0.2206529045,"runtime_lift":1.6474724429,"key":["s156684058","s820654012"]} +{"user_id":"u924353076","problem_id":"p03796","language":"python","submission_id_v0":"s982585501","submission_id_v1":"s413088188","cpu_time_v0":118,"cpu_time_v1":40,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.1,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=eval(input())\n\nn=int(n)\n\na=1\n\nfor i in range(n):\n\n a=a*(i+1)\n\n if a>=pow(10,9)+7:\n\n a=a%(pow(10,9)+7)\n\nprint(a)\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\na=1\n\nfor i in range(1,n+1):\n\n a*=i\n\n a %= (10**9+7)\n\nprint(a)","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":120,"code_v1_num_chars":83,"code_v0_no_empty_lines":"n = eval(input())\nn = int(n)\na = 1\nfor i in range(n):\n a = a * (i + 1)\n if a >= pow(10, 9) + 7:\n a = a % (pow(10, 9) + 7)\nprint(a)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = 1\nfor i in range(1, n + 1):\n a *= i\n a %= 10**9 + 7\nprint(a)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-n = eval(input())","-n = int(n)","+n = int(eval(input()))","-for i in range(n):","- a = a * (i + 1)","- if a >= pow(10, 9) + 7:","- a = a % (pow(10, 9) + 7)","+for i in range(1, n + 1):","+ a *= i","+ a %= 10**9 + 7"],"diff_only_import_comment":false,"measured_runtime_v0":0.4161043401,"measured_runtime_v1":0.2489673834,"runtime_lift":1.6713206943,"key":["s982585501","s413088188"]} +{"user_id":"u724687935","problem_id":"p02537","language":"python","submission_id_v0":"s645565645","submission_id_v1":"s012232464","cpu_time_v0":1422,"cpu_time_v1":1269,"memory_v0":187312,"memory_v1":195352,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.76,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nclass SegmentTree():\n\n \"\"\"\n\n update, get \u3092\u63d0\u4f9b\u3059\u308bSegmentTree\n\n\n\n Attributes\n\n ----------\n\n __n : int\n\n \u8449\u306e\u6570\u30022 ^ i - 1\n\n __dot :\n\n Segment function\n\n __e: int\n\n \u5358\u4f4d\u5143\n\n __node: list\n\n Segment Tree\n\n \"\"\"\n\n def __init__(self, A, dot, e):\n\n \"\"\"\n\n Parameters\n\n ----------\n\n A : list\n\n \u5bfe\u8c61\u306e\u914d\u5217\n\n dot :\n\n Segment function\n\n e : int\n\n \u5358\u4f4d\u5143\n\n \"\"\"\n\n n = 2 ** (len(A) - 1).bit_length()\n\n self.__n = n\n\n self.__dot = dot\n\n self.__e = e\n\n self.__node = [e] * (2 * n)\n\n for i in range(len(A)):\n\n self.__node[i + n] = A[i]\n\n for i in range(n - 1, 0, -1):\n\n self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])\n\n \n\n def update(self, i, c):\n\n i += self.__n\n\n node = self.__node\n\n node[i] = c\n\n while i > 1:\n\n i \/\/= 2\n\n node[i] = self.__dot(node[2 * i], node[2 * i + 1])\n\n\n\n def get(self, l, r):\n\n vl, vr = self.__e, self.__e\n\n l += self.__n\n\n r += self.__n\n\n while (l < r):\n\n if l & 1:\n\n vl = self.__dot(vl, self.__node[l])\n\n l += 1\n\n l \/\/= 2\n\n if r & 1:\n\n r -= 1\n\n vr = self.__dot(vr, self.__node[r])\n\n r \/\/= 2\n\n return self.__dot(vl, vr)\n\n\n\n\n\nN, K = list(map(int, input().split()))\n\nA = [int(eval(input())) for _ in range(N)]\n\nmax_A = max(A)\n\n\n\nst = SegmentTree([N] * (max_A + 1), min, N)\n\nedge = [set() for _ in range(N)]\n\nfor i, a in enumerate(reversed(A)):\n\n j = N - 1 - i\n\n p1 = st.get(a, min(max_A + 1, a + K + 1))\n\n if p1 < N:\n\n edge[j].add(p1)\n\n p2 = st.get(max(0, a - K), a)\n\n if p2 < N:\n\n edge[j].add(p2)\n\n p0 = st.get(a, a + 1)\n\n if p0 < N:\n\n edge[j].add(p0)\n\n st.update(a, j)\n\n\n\ndp = [1] * N\n\nfor i in range(N - 1):\n\n here = dp[i]\n\n for ni in edge[i]:\n\n if ni < N:\n\n dp[ni] = max(dp[ni], dp[i] + 1)\n\n\n\nprint((max(dp)))\n\n\n# optimized version of the same code:\n","target":"class SegmentTree():\n\n \"\"\"\n\n update, get \u3092\u63d0\u4f9b\u3059\u308bSegmentTree\n\n\n\n Attributes\n\n ----------\n\n __n : int\n\n \u8449\u306e\u6570\u30022 ^ i - 1\n\n __dot :\n\n Segment function\n\n __e: int\n\n \u5358\u4f4d\u5143\n\n __node: list\n\n Segment Tree\n\n \"\"\"\n\n def __init__(self, A, dot, e):\n\n \"\"\"\n\n Parameters\n\n ----------\n\n A : list\n\n \u5bfe\u8c61\u306e\u914d\u5217\n\n dot :\n\n Segment function\n\n e : int\n\n \u5358\u4f4d\u5143\n\n \"\"\"\n\n n = 2 ** (len(A) - 1).bit_length()\n\n self.__n = n\n\n self.__dot = dot\n\n self.__e = e\n\n self.__node = [e] * (2 * n)\n\n for i in range(len(A)):\n\n self.__node[i + n] = A[i]\n\n for i in range(n - 1, 0, -1):\n\n self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])\n\n \n\n def update(self, i, c):\n\n i += self.__n\n\n node = self.__node\n\n node[i] = c\n\n while i > 1:\n\n i \/\/= 2\n\n node[i] = self.__dot(node[2 * i], node[2 * i + 1])\n\n\n\n def get(self, l, r):\n\n vl, vr = self.__e, self.__e\n\n l += self.__n\n\n r += self.__n\n\n while (l < r):\n\n if l & 1:\n\n vl = self.__dot(vl, self.__node[l])\n\n l += 1\n\n l \/\/= 2\n\n if r & 1:\n\n r -= 1\n\n vr = self.__dot(vr, self.__node[r])\n\n r \/\/= 2\n\n return self.__dot(vl, vr)\n\n\n\n\n\nN, K = list(map(int, input().split()))\n\nA = [int(eval(input())) for _ in range(N)]\n\nmax_A = max(A)\n\n\n\nst = SegmentTree([N] * (max_A + 1), min, N)\n\nedge = [set() for _ in range(N)]\n\nfor i, a in enumerate(reversed(A)):\n\n j = N - 1 - i\n\n p1 = st.get(a, min(max_A + 1, a + K + 1))\n\n if p1 < N:\n\n edge[j].add(p1)\n\n p2 = st.get(max(0, a - K), a)\n\n if p2 < N:\n\n edge[j].add(p2)\n\n st.update(a, j)\n\n\n\ndp = [1] * N\n\nfor i in range(N - 1):\n\n here = dp[i]\n\n for ni in edge[i]:\n\n if ni < N:\n\n dp[ni] = max(dp[ni], dp[i] + 1)\n\n\n\nprint((max(dp)))\n","code_v0_loc":87,"code_v1_loc":84,"code_v0_num_chars":2089,"code_v1_num_chars":2021,"code_v0_no_empty_lines":"class SegmentTree:\n \"\"\"\n update, get \u3092\u63d0\u4f9b\u3059\u308bSegmentTree\n Attributes\n ----------\n __n : int\n \u8449\u306e\u6570\u30022 ^ i - 1\n __dot :\n Segment function\n __e: int\n \u5358\u4f4d\u5143\n __node: list\n Segment Tree\n \"\"\"\n\n def __init__(self, A, dot, e):\n \"\"\"\n Parameters\n ----------\n A : list\n \u5bfe\u8c61\u306e\u914d\u5217\n dot :\n Segment function\n e : int\n \u5358\u4f4d\u5143\n \"\"\"\n n = 2 ** (len(A) - 1).bit_length()\n self.__n = n\n self.__dot = dot\n self.__e = e\n self.__node = [e] * (2 * n)\n for i in range(len(A)):\n self.__node[i + n] = A[i]\n for i in range(n - 1, 0, -1):\n self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])\n\n def update(self, i, c):\n i += self.__n\n node = self.__node\n node[i] = c\n while i > 1:\n i \/\/= 2\n node[i] = self.__dot(node[2 * i], node[2 * i + 1])\n\n def get(self, l, r):\n vl, vr = self.__e, self.__e\n l += self.__n\n r += self.__n\n while l < r:\n if l & 1:\n vl = self.__dot(vl, self.__node[l])\n l += 1\n l \/\/= 2\n if r & 1:\n r -= 1\n vr = self.__dot(vr, self.__node[r])\n r \/\/= 2\n return self.__dot(vl, vr)\n\n\nN, K = list(map(int, input().split()))\nA = [int(eval(input())) for _ in range(N)]\nmax_A = max(A)\nst = SegmentTree([N] * (max_A + 1), min, N)\nedge = [set() for _ in range(N)]\nfor i, a in enumerate(reversed(A)):\n j = N - 1 - i\n p1 = st.get(a, min(max_A + 1, a + K + 1))\n if p1 < N:\n edge[j].add(p1)\n p2 = st.get(max(0, a - K), a)\n if p2 < N:\n edge[j].add(p2)\n p0 = st.get(a, a + 1)\n if p0 < N:\n edge[j].add(p0)\n st.update(a, j)\ndp = [1] * N\nfor i in range(N - 1):\n here = dp[i]\n for ni in edge[i]:\n if ni < N:\n dp[ni] = max(dp[ni], dp[i] + 1)\nprint((max(dp)))\n","code_v1_no_empty_lines":"class SegmentTree:\n \"\"\"\n update, get \u3092\u63d0\u4f9b\u3059\u308bSegmentTree\n Attributes\n ----------\n __n : int\n \u8449\u306e\u6570\u30022 ^ i - 1\n __dot :\n Segment function\n __e: int\n \u5358\u4f4d\u5143\n __node: list\n Segment Tree\n \"\"\"\n\n def __init__(self, A, dot, e):\n \"\"\"\n Parameters\n ----------\n A : list\n \u5bfe\u8c61\u306e\u914d\u5217\n dot :\n Segment function\n e : int\n \u5358\u4f4d\u5143\n \"\"\"\n n = 2 ** (len(A) - 1).bit_length()\n self.__n = n\n self.__dot = dot\n self.__e = e\n self.__node = [e] * (2 * n)\n for i in range(len(A)):\n self.__node[i + n] = A[i]\n for i in range(n - 1, 0, -1):\n self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])\n\n def update(self, i, c):\n i += self.__n\n node = self.__node\n node[i] = c\n while i > 1:\n i \/\/= 2\n node[i] = self.__dot(node[2 * i], node[2 * i + 1])\n\n def get(self, l, r):\n vl, vr = self.__e, self.__e\n l += self.__n\n r += self.__n\n while l < r:\n if l & 1:\n vl = self.__dot(vl, self.__node[l])\n l += 1\n l \/\/= 2\n if r & 1:\n r -= 1\n vr = self.__dot(vr, self.__node[r])\n r \/\/= 2\n return self.__dot(vl, vr)\n\n\nN, K = list(map(int, input().split()))\nA = [int(eval(input())) for _ in range(N)]\nmax_A = max(A)\nst = SegmentTree([N] * (max_A + 1), min, N)\nedge = [set() for _ in range(N)]\nfor i, a in enumerate(reversed(A)):\n j = N - 1 - i\n p1 = st.get(a, min(max_A + 1, a + K + 1))\n if p1 < N:\n edge[j].add(p1)\n p2 = st.get(max(0, a - K), a)\n if p2 < N:\n edge[j].add(p2)\n st.update(a, j)\ndp = [1] * N\nfor i in range(N - 1):\n here = dp[i]\n for ni in edge[i]:\n if ni < N:\n dp[ni] = max(dp[ni], dp[i] + 1)\nprint((max(dp)))\n","code_same":false,"relative_loc_diff_percent":3.4482758621,"diff":["- p0 = st.get(a, a + 1)","- if p0 < N:","- edge[j].add(p0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3663016255,"measured_runtime_v1":0.2110150833,"runtime_lift":1.7359025702,"key":["s645565645","s012232464"]} +{"user_id":"u935184340","problem_id":"p00003","language":"python","submission_id_v0":"s695745765","submission_id_v1":"s444816349","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":7832,"memory_v1":7708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nr = []\n\nn = int(eval(input()))\n\nl = sys.stdin.readlines()\n\nfor i in l:\n\n x, y, z = sorted([x*x for x in list(map(int, i.split()))])\n\n if x + y == z:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nn = int(input())\n\nl = sys.stdin.readlines()\n\ns = \"\"\n\nfor i in l:\n\n x, y, z = sorted(map(lambda x:x*x,map(int, i.split())))\n\n if x + y == z:\n\n s += \"YES\\n\"\n\n else:\n\n s += \"NO\\n\"\n\n\n\nprint(s,end=\"\")\n","code_v0_loc":10,"code_v1_loc":13,"code_v0_num_chars":201,"code_v1_num_chars":222,"code_v0_no_empty_lines":"import sys\n\nr = []\nn = int(eval(input()))\nl = sys.stdin.readlines()\nfor i in l:\n x, y, z = sorted([x * x for x in list(map(int, i.split()))])\n if x + y == z:\n print(\"YES\")\n else:\n print(\"NO\")\n","code_v1_no_empty_lines":"import sys\n\nn = int(input())\nl = sys.stdin.readlines()\ns = \"\"\nfor i in l:\n x, y, z = sorted(map(lambda x: x * x, map(int, i.split())))\n if x + y == z:\n s += \"YES\\n\"\n else:\n s += \"NO\\n\"\nprint(s, end=\"\")\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-r = []","-n = int(eval(input()))","+n = int(input())","+s = \"\"","- x, y, z = sorted([x * x for x in list(map(int, i.split()))])","+ x, y, z = sorted(map(lambda x: x * x, map(int, i.split())))","- print(\"YES\")","+ s += \"YES\\n\"","- print(\"NO\")","+ s += \"NO\\n\"","+print(s, end=\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.3577006006,"measured_runtime_v1":0.2704619627,"runtime_lift":1.3225541848,"key":["s695745765","s444816349"]} +{"user_id":"u887207211","problem_id":"p03086","language":"python","submission_id_v0":"s916999030","submission_id_v1":"s575230730","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport re\n\nptn = re.compile(r\"(A|C|G|T)*\")\n\n\n\nS = eval(input())\n\n\n\nans = 0\n\nfor i in range(len(S)):\n\n for j in range(len(S)):\n\n x = ptn.match(S[i:i+j+1]).group(0)\n\n if(x):\n\n ans = max(ans, len(x))\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nstdin = sys.stdin\n\n\n\nns = lambda : stdin.readline().rstrip()\n\nni = lambda : int(ns())\n\nna = lambda : list(map(int, stdin.readline().split()))\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef check(In):\n\n return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"\n\n\n\ndef main():\n\n s = ns()\n\n\n\n count = 0\n\n ans = 0\n\n for i in range(len(s)):\n\n if check(s[i]):\n\n count = 0\n\n else:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":12,"code_v1_loc":27,"code_v0_num_chars":214,"code_v1_num_chars":537,"code_v0_no_empty_lines":"import re\n\nptn = re.compile(r\"(A|C|G|T)*\")\nS = eval(input())\nans = 0\nfor i in range(len(S)):\n for j in range(len(S)):\n x = ptn.match(S[i : i + j + 1]).group(0)\n if x:\n ans = max(ans, len(x))\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nstdin = sys.stdin\nns = lambda: stdin.readline().rstrip()\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nsys.setrecursionlimit(10**7)\n\n\ndef check(In):\n return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"\n\n\ndef main():\n s = ns()\n count = 0\n ans = 0\n for i in range(len(s)):\n if check(s[i]):\n count = 0\n else:\n count += 1\n ans = max(ans, count)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-import re","+import sys","-ptn = re.compile(r\"(A|C|G|T)*\")","-S = eval(input())","-ans = 0","-for i in range(len(S)):","- for j in range(len(S)):","- x = ptn.match(S[i : i + j + 1]).group(0)","- if x:","- ans = max(ans, len(x))","-print(ans)","+stdin = sys.stdin","+ns = lambda: stdin.readline().rstrip()","+ni = lambda: int(ns())","+na = lambda: list(map(int, stdin.readline().split()))","+sys.setrecursionlimit(10**7)","+","+","+def check(In):","+ return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"","+","+","+def main():","+ s = ns()","+ count = 0","+ ans = 0","+ for i in range(len(s)):","+ if check(s[i]):","+ count = 0","+ else:","+ count += 1","+ ans = max(ans, count)","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3654596429,"measured_runtime_v1":0.2052364919,"runtime_lift":1.7806757436,"key":["s916999030","s575230730"]} +{"user_id":"u489959379","problem_id":"p03371","language":"python","submission_id_v0":"s775348159","submission_id_v1":"s575049266","cpu_time_v0":62,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.58,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c, x, y = list(map(int, input().split()))\n\nab = c * 2\n\n\n\nres = float(\"inf\")\n\nif a + b <= ab:\n\n res = x * a + y * b\n\nelse:\n\n if x == y:\n\n res = x * ab\n\n elif x > y:\n\n for i in range(y, x + 1):\n\n cost = i * ab + (x - i) * a\n\n res = min(res, cost)\n\n else:\n\n for i in range(x, y + 1):\n\n cost = i * ab + (y - i) * b\n\n res = min(res, cost)\n\nprint(res)\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\ninput = sys.stdin.readline\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n c *= 2\n\n if a + b > c:\n\n cost1 = max(x, y) * c\n\n cost2 = min(x, y) * c\n\n plus = ((y - x) * b) if x < y else (x - y) * a\n\n res = min(cost1, cost2 + plus)\n\n else:\n\n res = x * a + y * b\n\n print(res)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","code_v0_loc":18,"code_v1_loc":22,"code_v0_num_chars":423,"code_v1_num_chars":471,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nab = c * 2\nres = float(\"inf\")\nif a + b <= ab:\n res = x * a + y * b\nelse:\n if x == y:\n res = x * ab\n elif x > y:\n for i in range(y, x + 1):\n cost = i * ab + (x - i) * a\n res = min(res, cost)\n else:\n for i in range(x, y + 1):\n cost = i * ab + (y - i) * b\n res = min(res, cost)\nprint(res)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef resolve():\n a, b, c, x, y = list(map(int, input().split()))\n c *= 2\n if a + b > c:\n cost1 = max(x, y) * c\n cost2 = min(x, y) * c\n plus = ((y - x) * b) if x < y else (x - y) * a\n res = min(cost1, cost2 + plus)\n else:\n res = x * a + y * b\n print(res)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-a, b, c, x, y = list(map(int, input().split()))","-ab = c * 2","-res = float(\"inf\")","-if a + b <= ab:","- res = x * a + y * b","-else:","- if x == y:","- res = x * ab","- elif x > y:","- for i in range(y, x + 1):","- cost = i * ab + (x - i) * a","- res = min(res, cost)","+import sys","+","+sys.setrecursionlimit(10**7)","+input = sys.stdin.readline","+f_inf = float(\"inf\")","+mod = 10**9 + 7","+","+","+def resolve():","+ a, b, c, x, y = list(map(int, input().split()))","+ c *= 2","+ if a + b > c:","+ cost1 = max(x, y) * c","+ cost2 = min(x, y) * c","+ plus = ((y - x) * b) if x < y else (x - y) * a","+ res = min(cost1, cost2 + plus)","- for i in range(x, y + 1):","- cost = i * ab + (y - i) * b","- res = min(res, cost)","-print(res)","+ res = x * a + y * b","+ print(res)","+","+","+if __name__ == \"__main__\":","+ resolve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3014842281,"measured_runtime_v1":0.1645996099,"runtime_lift":1.8316217662,"key":["s775348159","s575049266"]} +{"user_id":"u243699903","problem_id":"p03371","language":"python","submission_id_v0":"s088381244","submission_id_v1":"s357905210","cpu_time_v0":104,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.65,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c,x,y=list(map(int,input().split()))\n\n\n\nans=a*x+b*y\n\nfor ci in range(max(x,y)+1):\n\n sumc = 2*ci*c\n\n sumc += (x-ci)*a if (x-ci)>0 else 0\n\n sumc += (y-ci)*b if (y-ci)>0 else 0\n\n ans=min(ans,sumc)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nif x==y:\n\n ans=min(ans,2*x*c)\n\nelif x>y:\n\n ans=min(ans,a*(x-y)+2*y*c)\n\n ans=min(ans,2*x*c)\n\nelse:\n\n ans=min(ans,b*(y-x)+2*x*c)\n\n ans=min(ans,2*y*c)\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":11,"code_v0_num_chars":217,"code_v1_num_chars":223,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nfor ci in range(max(x, y) + 1):\n sumc = 2 * ci * c\n sumc += (x - ci) * a if (x - ci) > 0 else 0\n sumc += (y - ci) * b if (y - ci) > 0 else 0\n ans = min(ans, sumc)\nprint(ans)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nif x == y:\n ans = min(ans, 2 * x * c)\nelif x > y:\n ans = min(ans, a * (x - y) + 2 * y * c)\n ans = min(ans, 2 * x * c)\nelse:\n ans = min(ans, b * (y - x) + 2 * x * c)\n ans = min(ans, 2 * y * c)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-for ci in range(max(x, y) + 1):","- sumc = 2 * ci * c","- sumc += (x - ci) * a if (x - ci) > 0 else 0","- sumc += (y - ci) * b if (y - ci) > 0 else 0","- ans = min(ans, sumc)","+if x == y:","+ ans = min(ans, 2 * x * c)","+elif x > y:","+ ans = min(ans, a * (x - y) + 2 * y * c)","+ ans = min(ans, 2 * x * c)","+else:","+ ans = min(ans, b * (y - x) + 2 * x * c)","+ ans = min(ans, 2 * y * c)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2025436199,"measured_runtime_v1":0.1559800074,"runtime_lift":1.2985229532,"key":["s088381244","s357905210"]} +{"user_id":"u260980560","problem_id":"p01105","language":"python","submission_id_v0":"s936098014","submission_id_v1":"s480075396","cpu_time_v0":50,"cpu_time_v1":40,"memory_v0":8604,"memory_v1":8508,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p ^ e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&%s\"%\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n\n\n# optimized version of the same code:\n","target":"a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nQ = [(1, a), (1, b), (1, c), (1, d)]\n\nL = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n l < 15 and heappush(Q, (l+1, p ^ e))\n\n if l < 13:\n\n li = 13-l; l3 = 3+l\n\n for q, r in H:\n\n if r <= li:\n\n k = p & q\n\n if r < get(k, 17)-l3:\n\n L[k] = l3+r\n\n r < li and heappush(Q, (l3+r, k))\n\n k = p ^ q\n\n if r < get(k, 17)-l3:\n\n L[k] = l3+r\n\n r < li and heappush(Q, (l3+r, k))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&\"+\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n","code_v0_loc":26,"code_v1_loc":28,"code_v0_num_chars":917,"code_v1_num_chars":953,"code_v0_no_empty_lines":"a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\nQ = [(1, el) for el in base]\nL = {el: 1 for el in base}\nH = []\nget = L.get\npush = H.append\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < get(p ^ e, 17):\n L[p ^ e] = l + 1\n if l + 1 < 16:\n heappush(Q, (l + 1, p ^ e))\n if l + 3 < 16:\n for q, r in H:\n if l + r + 3 <= 16:\n if l + r + 3 < get(p & q, 17):\n L[p & q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p & q))\n if l + r + 3 < get(p ^ q, 17):\n L[p ^ q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p ^ q))\n else:\n break\n if l < 7:\n push((p, l))\nprint(\n *map(\n L.__getitem__,\n eval(\n \"e&%s\"\n % \",e&\".join(\n open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]\n )\n ),\n ),\n sep=\"\\n\"\n)\n","code_v1_no_empty_lines":"a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nQ = [(1, a), (1, b), (1, c), (1, d)]\nL = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}\nH = []\nget = L.get\npush = H.append\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < get(p ^ e, 17):\n L[p ^ e] = l + 1\n l < 15 and heappush(Q, (l + 1, p ^ e))\n if l < 13:\n li = 13 - l\n l3 = 3 + l\n for q, r in H:\n if r <= li:\n k = p & q\n if r < get(k, 17) - l3:\n L[k] = l3 + r\n r < li and heappush(Q, (l3 + r, k))\n k = p ^ q\n if r < get(k, 17) - l3:\n L[k] = l3 + r\n r < li and heappush(Q, (l3 + r, k))\n else:\n break\n if l < 7:\n push((p, l))\nprint(\n *map(\n L.__getitem__,\n eval(\n \"e&\"\n + \",e&\".join(\n open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]\n )\n ),\n ),\n sep=\"\\n\"\n)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-base = [a, b, c, d, e, 0]","-Q = [(1, el) for el in base]","-L = {el: 1 for el in base}","+Q = [(1, a), (1, b), (1, c), (1, d)]","+L = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}","- if l + 1 < 16:","- heappush(Q, (l + 1, p ^ e))","- if l + 3 < 16:","+ l < 15 and heappush(Q, (l + 1, p ^ e))","+ if l < 13:","+ li = 13 - l","+ l3 = 3 + l","- if l + r + 3 <= 16:","- if l + r + 3 < get(p & q, 17):","- L[p & q] = l + r + 3","- if l + r + 3 < 16:","- heappush(Q, (l + r + 3, p & q))","- if l + r + 3 < get(p ^ q, 17):","- L[p ^ q] = l + r + 3","- if l + r + 3 < 16:","- heappush(Q, (l + r + 3, p ^ q))","+ if r <= li:","+ k = p & q","+ if r < get(k, 17) - l3:","+ L[k] = l3 + r","+ r < li and heappush(Q, (l3 + r, k))","+ k = p ^ q","+ if r < get(k, 17) - l3:","+ L[k] = l3 + r","+ r < li and heappush(Q, (l3 + r, k))","- \"e&%s\"","- % \",e&\".join(","+ \"e&\"","+ + \",e&\".join("],"diff_only_import_comment":false,"measured_runtime_v0":0.4434673564,"measured_runtime_v1":0.3305070457,"runtime_lift":1.3417788278,"key":["s936098014","s480075396"]} +{"user_id":"u940568210","problem_id":"p03273","language":"python","submission_id_v0":"s276670685","submission_id_v1":"s252609642","cpu_time_v0":167,"cpu_time_v1":19,"memory_v0":13884,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nh, w = tuple(map(int, input().split()))\n\nmatrix = np.zeros((h, w), dtype=bool)\n\nfor i in range(h):\n\n row = np.array(list(input()))\n\n matrix[i, :] = row == \".\"\n\n\n\nfor i in range(h)[::-1]:\n\n if np.all(matrix[i, :]):\n\n matrix = np.delete(matrix, i, 0)\n\n\n\nfor i in range(w)[::-1]:\n\n if np.all(matrix[:, i]):\n\n matrix = np.delete(matrix, i, 1)\n\n\n\nmatrix = np.where(matrix, \".\", \"#\")\n\nfor row in matrix:\n\n for e in row:\n\n print(e, end=\"\")\n\n print()\n\n\n# optimized version of the same code:\n","target":"# h w\u306e\u8aad\u307f\u8fbc\u307f\n\nh, w = list(map(int, input().split()))\n\n# \u884c\u5217\u4f5c\u6210\n\nmat = [eval(input()) for _ in range(h)]\n\n\n\n# #\u304c\u542b\u307e\u308c\u3066\u3044\u306a\u3044\u884c\u3092\u524a\u9664\n\n[mat.remove(row) for row in mat[::-1] if (\"#\" not in row)]\n\n# #\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u5217\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u53d6\u5f97\n\nshowCol = [i for i in range(w) if \"#\" in [row[i] for row in mat]]\n\n\n\n# \u8868\u793a\n\nprint((\"\\n\".join([\"\".join([row[c] for c in showCol]) for row in mat])))\n","code_v0_loc":21,"code_v1_loc":12,"code_v0_num_chars":504,"code_v1_num_chars":336,"code_v0_no_empty_lines":"import numpy as np\n\nh, w = tuple(map(int, input().split()))\nmatrix = np.zeros((h, w), dtype=bool)\nfor i in range(h):\n row = np.array(list(input()))\n matrix[i, :] = row == \".\"\nfor i in range(h)[::-1]:\n if np.all(matrix[i, :]):\n matrix = np.delete(matrix, i, 0)\nfor i in range(w)[::-1]:\n if np.all(matrix[:, i]):\n matrix = np.delete(matrix, i, 1)\nmatrix = np.where(matrix, \".\", \"#\")\nfor row in matrix:\n for e in row:\n print(e, end=\"\")\n print()\n","code_v1_no_empty_lines":"# h w\u306e\u8aad\u307f\u8fbc\u307f\nh, w = list(map(int, input().split()))\n# \u884c\u5217\u4f5c\u6210\nmat = [eval(input()) for _ in range(h)]\n# #\u304c\u542b\u307e\u308c\u3066\u3044\u306a\u3044\u884c\u3092\u524a\u9664\n[mat.remove(row) for row in mat[::-1] if (\"#\" not in row)]\n# #\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u5217\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u53d6\u5f97\nshowCol = [i for i in range(w) if \"#\" in [row[i] for row in mat]]\n# \u8868\u793a\nprint((\"\\n\".join([\"\".join([row[c] for c in showCol]) for row in mat])))\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-import numpy as np","-","-h, w = tuple(map(int, input().split()))","-matrix = np.zeros((h, w), dtype=bool)","-for i in range(h):","- row = np.array(list(input()))","- matrix[i, :] = row == \".\"","-for i in range(h)[::-1]:","- if np.all(matrix[i, :]):","- matrix = np.delete(matrix, i, 0)","-for i in range(w)[::-1]:","- if np.all(matrix[:, i]):","- matrix = np.delete(matrix, i, 1)","-matrix = np.where(matrix, \".\", \"#\")","-for row in matrix:","- for e in row:","- print(e, end=\"\")","- print()","+# h w\u306e\u8aad\u307f\u8fbc\u307f","+h, w = list(map(int, input().split()))","+# \u884c\u5217\u4f5c\u6210","+mat = [eval(input()) for _ in range(h)]","+# #\u304c\u542b\u307e\u308c\u3066\u3044\u306a\u3044\u884c\u3092\u524a\u9664","+[mat.remove(row) for row in mat[::-1] if (\"#\" not in row)]","+# #\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u5217\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u53d6\u5f97","+showCol = [i for i in range(w) if \"#\" in [row[i] for row in mat]]","+# \u8868\u793a","+print((\"\\n\".join([\"\".join([row[c] for c in showCol]) for row in mat])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.5763139927,"measured_runtime_v1":0.2879686127,"runtime_lift":5.4739090419,"key":["s276670685","s252609642"]} +{"user_id":"u579699847","problem_id":"p03273","language":"python","submission_id_v0":"s947664162","submission_id_v1":"s915143710","cpu_time_v0":285,"cpu_time_v1":21,"memory_v0":20888,"memory_v1":4468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.63,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np,sys\n\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\ndef S(): return sys.stdin.readline().rstrip()\n\nH,W = LI()\n\na = np.array([[s for s in S()] for _ in range(H)])\n\na = a[(a=='#').any(axis=1)]\n\na = a.T\n\na = a[(a=='#').any(axis=1)]\n\na = a.T.tolist()\n\nfor x in a:\n\n print(*x,sep='')\n\n\n# optimized version of the same code:\n","target":"import sys\n\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\ndef S(): return sys.stdin.readline().rstrip()\n\nH,W = LI()\n\na = [S() for _ in range(H)]\n\na2,a3 = [],[]\n\nfor x in a:\n\n if '#' in x:\n\n a2.append(x)\n\nfor y in zip(*a2):\n\n if '#' in y:\n\n a3.append(y)\n\nfor z in zip(*a3):\n\n print(*z,sep='')\n","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":325,"code_v1_num_chars":340,"code_v0_no_empty_lines":"import numpy as np, sys\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\ndef S():\n return sys.stdin.readline().rstrip()\n\n\nH, W = LI()\na = np.array([[s for s in S()] for _ in range(H)])\na = a[(a == \"#\").any(axis=1)]\na = a.T\na = a[(a == \"#\").any(axis=1)]\na = a.T.tolist()\nfor x in a:\n print(*x, sep=\"\")\n","code_v1_no_empty_lines":"import sys\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\ndef S():\n return sys.stdin.readline().rstrip()\n\n\nH, W = LI()\na = [S() for _ in range(H)]\na2, a3 = [], []\nfor x in a:\n if \"#\" in x:\n a2.append(x)\nfor y in zip(*a2):\n if \"#\" in y:\n a3.append(y)\nfor z in zip(*a3):\n print(*z, sep=\"\")\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-import numpy as np, sys","+import sys","-a = np.array([[s for s in S()] for _ in range(H)])","-a = a[(a == \"#\").any(axis=1)]","-a = a.T","-a = a[(a == \"#\").any(axis=1)]","-a = a.T.tolist()","+a = [S() for _ in range(H)]","+a2, a3 = [], []","- print(*x, sep=\"\")","+ if \"#\" in x:","+ a2.append(x)","+for y in zip(*a2):","+ if \"#\" in y:","+ a3.append(y)","+for z in zip(*a3):","+ print(*z, sep=\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":1.9641072226,"measured_runtime_v1":0.3075638639,"runtime_lift":6.3860142655,"key":["s947664162","s915143710"]} +{"user_id":"u638795007","problem_id":"p04020","language":"python","submission_id_v0":"s043977447","submission_id_v1":"s372001933","cpu_time_v0":265,"cpu_time_v1":111,"memory_v0":44252,"memory_v1":8004,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef examB():\n\n N = I(); A = [I() for _ in range(N)]\n\n ans = 0; cur= 0\n\n for i in A:\n\n if i==0:\n\n ans += cur\/\/2\n\n cur = 0\n\n else:\n\n cur += i\n\n ans += cur \/\/ 2\n\n print(ans)\n\n return\n\n\n\nimport sys,copy,bisect,itertools,heapq,math\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\n\n\nif __name__ == '__main__':\n\n examB()\n\n\n# optimized version of the same code:\n","target":"def examA():\n\n S = SI()\n\n if \"W\" in S and not \"E\" in S:\n\n print(\"No\")\n\n elif \"E\" in S and not \"W\" in S:\n\n print(\"No\")\n\n elif \"N\" in S and not \"S\" in S:\n\n print(\"No\")\n\n elif \"S\" in S and not \"N\" in S:\n\n print(\"No\")\n\n else:\n\n print(\"Yes\")\n\n return\n\n\n\ndef examB():\n\n N = I()\n\n A = [I()for _ in range(N)]\n\n ans = 0\n\n for i in range(N-1):\n\n ans += A[i]\/\/2\n\n if A[i]%2 and A[i+1]>=1:\n\n ans += 1\n\n A[i+1] -= 1\n\n ans += A[N-1]\/\/2\n\n print(ans)\n\n return\n\n\n\ndef examC():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examD():\n\n N = I()\n\n S = [I()for _ in range(N)]\n\n\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examE():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examF():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\nimport sys,bisect,itertools,heapq,math,random\n\nfrom copy import deepcopy\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nglobal mod,mod2,inf,alphabet,_ep\n\nmod = 10**9 + 7\n\nmod2 = 998244353\n\ninf = 10**18\n\n_ep = 10**(-12)\n\nalphabet = [chr(ord('a') + i) for i in range(26)]\n\n\n\nsys.setrecursionlimit(10**6)\n\n\n\nif __name__ == '__main__':\n\n examB()\n\n\n\n\"\"\"\n\n\n\n\"\"\"","code_v0_loc":26,"code_v1_loc":74,"code_v0_num_chars":729,"code_v1_num_chars":1504,"code_v0_no_empty_lines":"def examB():\n N = I()\n A = [I() for _ in range(N)]\n ans = 0\n cur = 0\n for i in A:\n if i == 0:\n ans += cur \/\/ 2\n cur = 0\n else:\n cur += i\n ans += cur \/\/ 2\n print(ans)\n return\n\n\nimport sys, copy, bisect, itertools, heapq, math\nfrom heapq import heappop, heappush, heapify\nfrom collections import Counter, defaultdict, deque\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LSI():\n return list(map(str, sys.stdin.readline().split()))\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef SI():\n return sys.stdin.readline().strip()\n\n\nmod = 10**9 + 7\ninf = float(\"inf\")\nif __name__ == \"__main__\":\n examB()\n","code_v1_no_empty_lines":"def examA():\n S = SI()\n if \"W\" in S and not \"E\" in S:\n print(\"No\")\n elif \"E\" in S and not \"W\" in S:\n print(\"No\")\n elif \"N\" in S and not \"S\" in S:\n print(\"No\")\n elif \"S\" in S and not \"N\" in S:\n print(\"No\")\n else:\n print(\"Yes\")\n return\n\n\ndef examB():\n N = I()\n A = [I() for _ in range(N)]\n ans = 0\n for i in range(N - 1):\n ans += A[i] \/\/ 2\n if A[i] % 2 and A[i + 1] >= 1:\n ans += 1\n A[i + 1] -= 1\n ans += A[N - 1] \/\/ 2\n print(ans)\n return\n\n\ndef examC():\n ans = 0\n print(ans)\n return\n\n\ndef examD():\n N = I()\n S = [I() for _ in range(N)]\n ans = 0\n print(ans)\n return\n\n\ndef examE():\n ans = 0\n print(ans)\n return\n\n\ndef examF():\n ans = 0\n print(ans)\n return\n\n\nimport sys, bisect, itertools, heapq, math, random\nfrom copy import deepcopy\nfrom heapq import heappop, heappush, heapify\nfrom collections import Counter, defaultdict, deque\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LSI():\n return list(map(str, sys.stdin.readline().split()))\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef SI():\n return sys.stdin.readline().strip()\n\n\nglobal mod, mod2, inf, alphabet, _ep\nmod = 10**9 + 7\nmod2 = 998244353\ninf = 10**18\n_ep = 10 ** (-12)\nalphabet = [chr(ord(\"a\") + i) for i in range(26)]\nsys.setrecursionlimit(10**6)\nif __name__ == \"__main__\":\n examB()\n\"\"\"\n\"\"\"\n","code_same":false,"relative_loc_diff_percent":64.8648648649,"diff":["+def examA():","+ S = SI()","+ if \"W\" in S and not \"E\" in S:","+ print(\"No\")","+ elif \"E\" in S and not \"W\" in S:","+ print(\"No\")","+ elif \"N\" in S and not \"S\" in S:","+ print(\"No\")","+ elif \"S\" in S and not \"N\" in S:","+ print(\"No\")","+ else:","+ print(\"Yes\")","+ return","+","+","- cur = 0","- for i in A:","- if i == 0:","- ans += cur \/\/ 2","- cur = 0","- else:","- cur += i","- ans += cur \/\/ 2","+ for i in range(N - 1):","+ ans += A[i] \/\/ 2","+ if A[i] % 2 and A[i + 1] >= 1:","+ ans += 1","+ A[i + 1] -= 1","+ ans += A[N - 1] \/\/ 2","-import sys, copy, bisect, itertools, heapq, math","+def examC():","+ ans = 0","+ print(ans)","+ return","+","+","+def examD():","+ N = I()","+ S = [I() for _ in range(N)]","+ ans = 0","+ print(ans)","+ return","+","+","+def examE():","+ ans = 0","+ print(ans)","+ return","+","+","+def examF():","+ ans = 0","+ print(ans)","+ return","+","+","+import sys, bisect, itertools, heapq, math, random","+from copy import deepcopy","+global mod, mod2, inf, alphabet, _ep","-inf = float(\"inf\")","+mod2 = 998244353","+inf = 10**18","+_ep = 10 ** (-12)","+alphabet = [chr(ord(\"a\") + i) for i in range(26)]","+sys.setrecursionlimit(10**6)","+\"\"\"","+\"\"\""],"diff_only_import_comment":false,"measured_runtime_v0":0.1928541586,"measured_runtime_v1":0.006450581,"runtime_lift":29.8971764609,"key":["s043977447","s372001933"]} +{"user_id":"u193598069","problem_id":"p03544","language":"python","submission_id_v0":"s403516424","submission_id_v1":"s258691406","cpu_time_v0":27,"cpu_time_v1":17,"memory_v0":10740,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.04,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nL = [ 0 ] * 1000000\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nL = [ 0 ] * (N+1)\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":129,"code_v1_num_chars":127,"code_v0_no_empty_lines":"N = int(eval(input()))\nL = [0] * 1000000\nL[0] = 2\nL[1] = 1\nfor i in range(2, N + 1):\n L[i] = L[i - 2] + L[i - 1]\nprint((L[N]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nL = [0] * (N + 1)\nL[0] = 2\nL[1] = 1\nfor i in range(2, N + 1):\n L[i] = L[i - 2] + L[i - 1]\nprint((L[N]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-L = [0] * 1000000","+L = [0] * (N + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4811118691,"measured_runtime_v1":0.3226976706,"runtime_lift":1.4909059249,"key":["s403516424","s258691406"]} +{"user_id":"u218834617","problem_id":"p03013","language":"python","submission_id_v0":"s048931274","submission_id_v1":"s960526895","cpu_time_v0":127,"cpu_time_v1":59,"memory_v0":17264,"memory_v1":17228,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.54,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nN,M=list(map(int,input().split()))\n\nS=set(map(int,sys.stdin))\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in S:\n\n a,b=b,0\n\n else:\n\n a,b=b,a+b\n\n\n\nprint((b%(10**9+7)))\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nN,M=list(map(int,input().split()))\n\nbad=set(map(int,sys.stdin))\n\nMOD=10**9+7\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in bad:\n\n a,b=b,0\n\n if a==0:\n\n break\n\n else:\n\n a,b=b,(a+b)%MOD\n\n\n\nprint(b)\n","code_v0_loc":12,"code_v1_loc":16,"code_v0_num_chars":188,"code_v1_num_chars":240,"code_v0_no_empty_lines":"import sys\n\nN, M = list(map(int, input().split()))\nS = set(map(int, sys.stdin))\na, b = 0, 1\nfor i in range(1, N + 1):\n if i in S:\n a, b = b, 0\n else:\n a, b = b, a + b\nprint((b % (10**9 + 7)))\n","code_v1_no_empty_lines":"import sys\n\nN, M = list(map(int, input().split()))\nbad = set(map(int, sys.stdin))\nMOD = 10**9 + 7\na, b = 0, 1\nfor i in range(1, N + 1):\n if i in bad:\n a, b = b, 0\n if a == 0:\n break\n else:\n a, b = b, (a + b) % MOD\nprint(b)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-S = set(map(int, sys.stdin))","+bad = set(map(int, sys.stdin))","+MOD = 10**9 + 7","- if i in S:","+ if i in bad:","+ if a == 0:","+ break","- a, b = b, a + b","-print((b % (10**9 + 7)))","+ a, b = b, (a + b) % MOD","+print(b)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3212681165,"measured_runtime_v1":0.212405349,"runtime_lift":1.5125236626,"key":["s048931274","s960526895"]} +{"user_id":"u094191970","problem_id":"p02982","language":"python","submission_id_v0":"s464229180","submission_id_v1":"s820370642","cpu_time_v0":152,"cpu_time_v1":17,"memory_v0":12540,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nimport itertools\n\n\n\nn, d = list(map(int, input().split()))\n\nx = [list(map(int, input().split())) for i in range(n)]\n\n\n\ncnt = 0\n\nfor i1, i2 in itertools.product(list(range(n)), list(range(n))):\n\n if i1 == i2:\n\n continue\n\n x1 = np.array(x[i1])\n\n x2 = np.array(x[i2])\n\n d = sum(list([x ** 2 for x in list(x1 - x2)])) ** 0.5\n\n if d == int(d):\n\n cnt += 1\n\n\n\nprint((int(cnt \/ 2)))\n\n# optimized version of the same code:\n","target":"n,d=list(map(int,input().split()))\n\nl=[list(map(int,input().split())) for i in range(n)]\n\n\n\ncnt=0\n\nfor i in range(n-1):\n\n for j in range(i+1,n):\n\n l1=l[i]\n\n l2=l[j]\n\n sum=0\n\n for y,z in zip(l1,l2):\n\n sum+=(y-z)**2\n\n dist=sum**0.5\n\n if dist==int(dist):\n\n cnt+=1\n\nprint(cnt)","code_v0_loc":17,"code_v1_loc":15,"code_v0_num_chars":409,"code_v1_num_chars":276,"code_v0_no_empty_lines":"import numpy as np\nimport itertools\n\nn, d = list(map(int, input().split()))\nx = [list(map(int, input().split())) for i in range(n)]\ncnt = 0\nfor i1, i2 in itertools.product(list(range(n)), list(range(n))):\n if i1 == i2:\n continue\n x1 = np.array(x[i1])\n x2 = np.array(x[i2])\n d = sum(list([x**2 for x in list(x1 - x2)])) ** 0.5\n if d == int(d):\n cnt += 1\nprint((int(cnt \/ 2)))\n","code_v1_no_empty_lines":"n, d = list(map(int, input().split()))\nl = [list(map(int, input().split())) for i in range(n)]\ncnt = 0\nfor i in range(n - 1):\n for j in range(i + 1, n):\n l1 = l[i]\n l2 = l[j]\n sum = 0\n for y, z in zip(l1, l2):\n sum += (y - z) ** 2\n dist = sum**0.5\n if dist == int(dist):\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":11.7647058824,"diff":["-import numpy as np","-import itertools","-","-x = [list(map(int, input().split())) for i in range(n)]","+l = [list(map(int, input().split())) for i in range(n)]","-for i1, i2 in itertools.product(list(range(n)), list(range(n))):","- if i1 == i2:","- continue","- x1 = np.array(x[i1])","- x2 = np.array(x[i2])","- d = sum(list([x**2 for x in list(x1 - x2)])) ** 0.5","- if d == int(d):","- cnt += 1","-print((int(cnt \/ 2)))","+for i in range(n - 1):","+ for j in range(i + 1, n):","+ l1 = l[i]","+ l2 = l[j]","+ sum = 0","+ for y, z in zip(l1, l2):","+ sum += (y - z) ** 2","+ dist = sum**0.5","+ if dist == int(dist):","+ cnt += 1","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3349185867,"measured_runtime_v1":0.2063240778,"runtime_lift":6.4700087387,"key":["s464229180","s820370642"]} +{"user_id":"u813384600","problem_id":"p01138","language":"python","submission_id_v0":"s409826221","submission_id_v1":"s148489336","cpu_time_v0":6790,"cpu_time_v1":260,"memory_v0":9596,"memory_v1":7608,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":96.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport re\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = [0] * (24*60*60+1)\n\n for _ in range(n):\n\n h1,m1,s1,h2,m2,s2 = list(map(int, re.split(':| ', input())))\n\n l[h1*60*60 + m1*60 + s1] += 1\n\n l[h2*60*60 + m2*60 + s2] -= 1\n\n r = 0\n\n for i in range(24*60*60):\n\n l[i+1] += l[i]\n\n r = max(r, l[i+1])\n\n print(r)\n\n# optimized version of the same code:\n","target":"while True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = []\n\n for _ in range(n):\n\n hms1, hms2 = input().split()\n\n l.append((hms1, True))\n\n l.append((hms2, False))\n\n l.sort()\n\n r, t = 0, 0\n\n for i in range(len(l)):\n\n if l[i][1]:\n\n t += 1\n\n else:\n\n t -= 1\n\n r = max(r, t)\n\n print(r)","code_v0_loc":16,"code_v1_loc":18,"code_v0_num_chars":386,"code_v1_num_chars":383,"code_v0_no_empty_lines":"import re\n\nwhile True:\n n = int(input())\n if n == 0:\n break\n l = [0] * (24 * 60 * 60 + 1)\n for _ in range(n):\n h1, m1, s1, h2, m2, s2 = list(map(int, re.split(\":| \", input())))\n l[h1 * 60 * 60 + m1 * 60 + s1] += 1\n l[h2 * 60 * 60 + m2 * 60 + s2] -= 1\n r = 0\n for i in range(24 * 60 * 60):\n l[i + 1] += l[i]\n r = max(r, l[i + 1])\n print(r)\n","code_v1_no_empty_lines":"while True:\n n = int(input())\n if n == 0:\n break\n l = []\n for _ in range(n):\n hms1, hms2 = input().split()\n l.append((hms1, True))\n l.append((hms2, False))\n l.sort()\n r, t = 0, 0\n for i in range(len(l)):\n if l[i][1]:\n t += 1\n else:\n t -= 1\n r = max(r, t)\n print(r)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-import re","-","- l = [0] * (24 * 60 * 60 + 1)","+ l = []","- h1, m1, s1, h2, m2, s2 = list(map(int, re.split(\":| \", input())))","- l[h1 * 60 * 60 + m1 * 60 + s1] += 1","- l[h2 * 60 * 60 + m2 * 60 + s2] -= 1","- r = 0","- for i in range(24 * 60 * 60):","- l[i + 1] += l[i]","- r = max(r, l[i + 1])","+ hms1, hms2 = input().split()","+ l.append((hms1, True))","+ l.append((hms2, False))","+ l.sort()","+ r, t = 0, 0","+ for i in range(len(l)):","+ if l[i][1]:","+ t += 1","+ else:","+ t -= 1","+ r = max(r, t)"],"diff_only_import_comment":false,"measured_runtime_v0":1.2066217821,"measured_runtime_v1":0.2932185929,"runtime_lift":4.1150930102,"key":["s409826221","s148489336"]} +{"user_id":"u188827677","problem_id":"p02690","language":"python","submission_id_v0":"s854593654","submission_id_v1":"s214318281","cpu_time_v0":39,"cpu_time_v1":35,"memory_v0":9156,"memory_v1":9120,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.26,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\n\n\nfor a in range(-118,119):\n\n for b in range(-119,118):\n\n if a**5 - b**5 == x:\n\n print((a,b))\n\n exit()\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\n\n\nfor i in range(0, 120):\n\n for j in range(-119, 120):\n\n if (i**5 - j**5) == x:\n\n print((i,j))\n\n exit()\n","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":132,"code_v1_num_chars":134,"code_v0_no_empty_lines":"x = int(eval(input()))\nfor a in range(-118, 119):\n for b in range(-119, 118):\n if a**5 - b**5 == x:\n print((a, b))\n exit()\n","code_v1_no_empty_lines":"x = int(eval(input()))\nfor i in range(0, 120):\n for j in range(-119, 120):\n if (i**5 - j**5) == x:\n print((i, j))\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for a in range(-118, 119):","- for b in range(-119, 118):","- if a**5 - b**5 == x:","- print((a, b))","+for i in range(0, 120):","+ for j in range(-119, 120):","+ if (i**5 - j**5) == x:","+ print((i, j))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3689326783,"measured_runtime_v1":0.2223354737,"runtime_lift":1.6593513943,"key":["s854593654","s214318281"]} +{"user_id":"u291766461","problem_id":"p03074","language":"python","submission_id_v0":"s221518045","submission_id_v1":"s305948108","cpu_time_v0":149,"cpu_time_v1":123,"memory_v0":4212,"memory_v1":7884,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.45,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, K = list(map(int, input().split()))\n\nS = eval(input())\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\nleft = 0\n\nright = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n\n\n next_left = i\n\n next_right = min(i + add, len(nums))\n\n\n\n while next_left > left:\n\n tmp -= nums[left]\n\n left += 1\n\n\n\n while next_right > right:\n\n tmp += nums[right]\n\n right += 1\n\n\n\n ans = max(ans, tmp)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N, K = list(map(int, input().split()))\n\nS = eval(input())\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\ncsum = [0] * (len(nums) + 1)\n\nfor i in range(len(nums)):\n\n csum[i + 1] = csum[i] + nums[i]\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n left = i\n\n right = min(i + add, len(nums))\n\n tmp = csum[right] - csum[left]\n\n ans = max(ans, tmp)\n\nprint(ans)","code_v0_loc":37,"code_v1_loc":30,"code_v0_num_chars":647,"code_v1_num_chars":587,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nS = eval(input())\nnums = []\nnow = 1\ncnt = 0\nfor i in range(N):\n if S[i] == str(now):\n cnt += 1\n else:\n nums.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:\n nums.append(cnt)\nif len(nums) % 2 == 0:\n nums.append(0)\nadd = 2 * K + 1\nans = 0\nleft = 0\nright = 0\ntmp = 0\nfor i in range(0, len(nums), 2):\n next_left = i\n next_right = min(i + add, len(nums))\n while next_left > left:\n tmp -= nums[left]\n left += 1\n while next_right > right:\n tmp += nums[right]\n right += 1\n ans = max(ans, tmp)\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nS = eval(input())\nnums = []\nnow = 1\ncnt = 0\nfor i in range(N):\n if S[i] == str(now):\n cnt += 1\n else:\n nums.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:\n nums.append(cnt)\nif len(nums) % 2 == 0:\n nums.append(0)\ncsum = [0] * (len(nums) + 1)\nfor i in range(len(nums)):\n csum[i + 1] = csum[i] + nums[i]\nadd = 2 * K + 1\nans = 0\ntmp = 0\nfor i in range(0, len(nums), 2):\n left = i\n right = min(i + add, len(nums))\n tmp = csum[right] - csum[left]\n ans = max(ans, tmp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.9189189189,"diff":["+csum = [0] * (len(nums) + 1)","+for i in range(len(nums)):","+ csum[i + 1] = csum[i] + nums[i]","-left = 0","-right = 0","- next_left = i","- next_right = min(i + add, len(nums))","- while next_left > left:","- tmp -= nums[left]","- left += 1","- while next_right > right:","- tmp += nums[right]","- right += 1","+ left = i","+ right = min(i + add, len(nums))","+ tmp = csum[right] - csum[left]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2166490428,"measured_runtime_v1":0.0894378448,"runtime_lift":2.422341945,"key":["s221518045","s305948108"]} +{"user_id":"u598229387","problem_id":"p03038","language":"python","submission_id_v0":"s447256606","submission_id_v1":"s009222448","cpu_time_v0":1160,"cpu_time_v1":569,"memory_v0":32484,"memory_v1":27852,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn,m=list(map(int,input().split()))\n\na=np.array([int(i) for i in input().split()])\n\nbc=np.array([[int(i) for i in input().split()] for j in range(m)])\n\n\n\na.sort()\n\nb=bc[:,0]\n\nc=bc[:,1]\n\n\n\nidx=np.argsort(c)\n\nb=b[idx][::-1]\n\nc=c[idx][::-1]\n\n\n\np=0\n\nfor b,c in zip(b,c):\n\n a[p:p+b]=np.maximum(a[p:p+b],c)\n\n p+=b\n\n \n\n \n\nprint((a.sum()))\n\n# optimized version of the same code:\n","target":"from heapq import heappop,heappush\n\nn,m=list(map(int,input().split()))\n\na=[int(i) for i in input().split()]\n\na.sort()\n\nbc=[[int(i) for i in input().split()]for j in range(m)]\n\nbc=sorted(bc, key=lambda x:x[1],reverse=True)\n\n\n\nans=[]\n\nfor b,c in bc: \n\n while b>0 and a: \n\n x = heappop(a)\n\n if x 0 and a:\n x = heappop(a)\n if x < c:\n ans.append(c)\n b -= 1\n else:\n ans.append(x)\nprint((sum(ans) + sum(a)))\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-import numpy as np","+from heapq import heappop, heappush","-a = np.array([int(i) for i in input().split()])","-bc = np.array([[int(i) for i in input().split()] for j in range(m)])","+a = [int(i) for i in input().split()]","-b = bc[:, 0]","-c = bc[:, 1]","-idx = np.argsort(c)","-b = b[idx][::-1]","-c = c[idx][::-1]","-p = 0","-for b, c in zip(b, c):","- a[p : p + b] = np.maximum(a[p : p + b], c)","- p += b","-print((a.sum()))","+bc = [[int(i) for i in input().split()] for j in range(m)]","+bc = sorted(bc, key=lambda x: x[1], reverse=True)","+ans = []","+for b, c in bc:","+ while b > 0 and a:","+ x = heappop(a)","+ if x < c:","+ ans.append(c)","+ b -= 1","+ else:","+ ans.append(x)","+print((sum(ans) + sum(a)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4106310596,"measured_runtime_v1":0.1876150353,"runtime_lift":7.518752734,"key":["s447256606","s009222448"]} +{"user_id":"u150984829","problem_id":"p02414","language":"python","submission_id_v0":"s966401245","submission_id_v1":"s281717363","cpu_time_v0":630,"cpu_time_v1":130,"memory_v0":7076,"memory_v1":6584,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.37,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,m,l=list(map(int,input().split()))\n\ne=[input().split()for _ in[0]*(n+m)]\n\nfor c in e[:n]:print((*[sum(int(s)*int(t)for s,t in zip(c,l))for l in zip(*e[n:])]))\n\n\n# optimized version of the same code:\n","target":"import sys\n\nn,m,l=list(map(int,input().split()))\n\ne=[list(map(int,e.split()))for e in sys.stdin]\n\nfor c in e[:n]:print((*[sum(s*t for s,t in zip(c,l))for l in zip(*e[n:])]))\n","code_v0_loc":3,"code_v1_loc":4,"code_v0_num_chars":153,"code_v1_num_chars":166,"code_v0_no_empty_lines":"n, m, l = list(map(int, input().split()))\ne = [input().split() for _ in [0] * (n + m)]\nfor c in e[:n]:\n print((*[sum(int(s) * int(t) for s, t in zip(c, l)) for l in zip(*e[n:])]))\n","code_v1_no_empty_lines":"import sys\n\nn, m, l = list(map(int, input().split()))\ne = [list(map(int, e.split())) for e in sys.stdin]\nfor c in e[:n]:\n print((*[sum(s * t for s, t in zip(c, l)) for l in zip(*e[n:])]))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["+import sys","+","-e = [input().split() for _ in [0] * (n + m)]","+e = [list(map(int, e.split())) for e in sys.stdin]","- print((*[sum(int(s) * int(t) for s, t in zip(c, l)) for l in zip(*e[n:])]))","+ print((*[sum(s * t for s, t in zip(c, l)) for l in zip(*e[n:])]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3404335606,"measured_runtime_v1":0.2443783689,"runtime_lift":1.3930593047,"key":["s966401245","s281717363"]} +{"user_id":"u242518667","problem_id":"p03424","language":"python","submission_id_v0":"s488879497","submission_id_v1":"s152130126","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\ns=list(map(str,input().split()))\n\ntotal=[]\n\nfor i in range(n):\n\n if s[i] not in total:\n\n total.append(s[i])\n\nprint(('Three' if len(total)==3 else 'Four'))\n\n# optimized version of the same code:\n","target":"eval(input())\n\nl=list(map(str,input().split()))\n\nprint(('Three' if len(set(l))==3 else 'Four'))","code_v0_loc":7,"code_v1_loc":3,"code_v0_num_chars":178,"code_v1_num_chars":81,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = list(map(str, input().split()))\ntotal = []\nfor i in range(n):\n if s[i] not in total:\n total.append(s[i])\nprint((\"Three\" if len(total) == 3 else \"Four\"))\n","code_v1_no_empty_lines":"eval(input())\nl = list(map(str, input().split()))\nprint((\"Three\" if len(set(l)) == 3 else \"Four\"))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-n = int(eval(input()))","-s = list(map(str, input().split()))","-total = []","-for i in range(n):","- if s[i] not in total:","- total.append(s[i])","-print((\"Three\" if len(total) == 3 else \"Four\"))","+eval(input())","+l = list(map(str, input().split()))","+print((\"Three\" if len(set(l)) == 3 else \"Four\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3119253957,"measured_runtime_v1":0.2361336248,"runtime_lift":1.3209698364,"key":["s488879497","s152130126"]} +{"user_id":"u298297089","problem_id":"p03608","language":"python","submission_id_v0":"s886496644","submission_id_v1":"s630862877","cpu_time_v0":754,"cpu_time_v1":614,"memory_v0":22600,"memory_v1":17008,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.57,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom scipy.sparse.csgraph import dijkstra as di\n\nfrom itertools import permutations\n\nN,M,R = list(map(int, input().split()))\n\nr = list(map(int, input().split()))\n\n\n\nroute = [[0 for i in range(N)] for j in range(N)]\n\nfor i in range(M):\n\n a,b,c = list(map(int, input().split()))\n\n route[a-1][b-1] = route[b-1][a-1] = c\n\n# for i in range(N):\n\n# print(route[i])\n\n\n\n\n\np_route = di(route)\n\n# print(p_route)\n\n\n\nmn = float('INF')\n\nfor tmp in permutations(r):\n\n t_sum = 0\n\n for i in range(len(tmp)-1):\n\n t_sum += p_route[tmp[i]-1][tmp[i+1]-1]\n\n if t_sum < mn:\n\n mn = t_sum\n\n\n\nprint((int(mn)))\n\n# optimized version of the same code:\n","target":"from itertools import permutations as perm\n\nfrom scipy.sparse.csgraph import dijkstra as di\n\n\n\ndef warshall(d, n):\n\n for k in range(n):\n\n for i in range(n):\n\n for j in range(n):\n\n if d[i][k] + d[k][j] < d[i][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\nn,m,r = list(map(int, input().split()))\n\nrr = [i-1 for i in map(int, input().split())]\n\n\n\ninf = float('INF')\n\nroute = [[0 for j in range(n)] for i in range(n)]\n\nfor _ in range(m):\n\n a,b,c = list(map(int, input().split()))\n\n route[a-1][b-1] = route[b-1][a-1] = c\n\n\n\nroute = di(route, n)\n\n\n\nans = inf\n\nfor tmp in perm(rr):\n\n cost = 0\n\n for i in range(r-1):\n\n cost += route[tmp[i]][tmp[i+1]]\n\n if cost < ans:\n\n ans = cost\n\nprint((int(ans)))\n","code_v0_loc":25,"code_v1_loc":29,"code_v0_num_chars":602,"code_v1_num_chars":753,"code_v0_no_empty_lines":"from scipy.sparse.csgraph import dijkstra as di\nfrom itertools import permutations\n\nN, M, R = list(map(int, input().split()))\nr = list(map(int, input().split()))\nroute = [[0 for i in range(N)] for j in range(N)]\nfor i in range(M):\n a, b, c = list(map(int, input().split()))\n route[a - 1][b - 1] = route[b - 1][a - 1] = c\n# for i in range(N):\n# print(route[i])\np_route = di(route)\n# print(p_route)\nmn = float(\"INF\")\nfor tmp in permutations(r):\n t_sum = 0\n for i in range(len(tmp) - 1):\n t_sum += p_route[tmp[i] - 1][tmp[i + 1] - 1]\n if t_sum < mn:\n mn = t_sum\nprint((int(mn)))\n","code_v1_no_empty_lines":"from itertools import permutations as perm\nfrom scipy.sparse.csgraph import dijkstra as di\n\n\ndef warshall(d, n):\n for k in range(n):\n for i in range(n):\n for j in range(n):\n if d[i][k] + d[k][j] < d[i][j]:\n d[i][j] = d[i][k] + d[k][j]\n\n\nn, m, r = list(map(int, input().split()))\nrr = [i - 1 for i in map(int, input().split())]\ninf = float(\"INF\")\nroute = [[0 for j in range(n)] for i in range(n)]\nfor _ in range(m):\n a, b, c = list(map(int, input().split()))\n route[a - 1][b - 1] = route[b - 1][a - 1] = c\nroute = di(route, n)\nans = inf\nfor tmp in perm(rr):\n cost = 0\n for i in range(r - 1):\n cost += route[tmp[i]][tmp[i + 1]]\n if cost < ans:\n ans = cost\nprint((int(ans)))\n","code_same":false,"relative_loc_diff_percent":13.7931034483,"diff":["+from itertools import permutations as perm","-from itertools import permutations","-N, M, R = list(map(int, input().split()))","-r = list(map(int, input().split()))","-route = [[0 for i in range(N)] for j in range(N)]","-for i in range(M):","+","+def warshall(d, n):","+ for k in range(n):","+ for i in range(n):","+ for j in range(n):","+ if d[i][k] + d[k][j] < d[i][j]:","+ d[i][j] = d[i][k] + d[k][j]","+","+","+n, m, r = list(map(int, input().split()))","+rr = [i - 1 for i in map(int, input().split())]","+inf = float(\"INF\")","+route = [[0 for j in range(n)] for i in range(n)]","+for _ in range(m):","-# for i in range(N):","-# print(route[i])","-p_route = di(route)","-# print(p_route)","-mn = float(\"INF\")","-for tmp in permutations(r):","- t_sum = 0","- for i in range(len(tmp) - 1):","- t_sum += p_route[tmp[i] - 1][tmp[i + 1] - 1]","- if t_sum < mn:","- mn = t_sum","-print((int(mn)))","+route = di(route, n)","+ans = inf","+for tmp in perm(rr):","+ cost = 0","+ for i in range(r - 1):","+ cost += route[tmp[i]][tmp[i + 1]]","+ if cost < ans:","+ ans = cost","+print((int(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.8585113499,"measured_runtime_v1":0.6205561209,"runtime_lift":1.3834548094,"key":["s886496644","s630862877"]} +{"user_id":"u607865971","problem_id":"p03164","language":"python","submission_id_v0":"s900171177","submission_id_v1":"s494365384","cpu_time_v0":1438,"cpu_time_v1":1016,"memory_v0":27184,"memory_v1":19300,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.35,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = [float('inf')] * 1000 * 100*10\n\nvs = set()\n\nvs.add(0)\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n tmpDP = dp.copy()\n\n for vv in list(vs):\n\n if dp[vv + v] > dp[vv] + w:\n\n tmpDP[vv + v] = dp[vv] + w\n\n vs.add(vv + v)\n\n dp = tmpDP\n\n\n\n\n\nans = 0\n\nfor v in list(vs):\n\n if dp[v] <= W:\n\n ans = max(ans, v)\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = defaultdict(lambda: float('inf'))\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n add = defaultdict(lambda: float('inf'))\n\n for vv in list(dp.keys()):\n\n if dp[vv + v] > dp[vv] + w:\n\n add[vv + v] = dp[vv] + w\n\n dp.update(add)\n\n\n\nprint((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x:x[0])[0]))\n","code_v0_loc":37,"code_v1_loc":29,"code_v0_num_chars":908,"code_v1_num_chars":876,"code_v0_no_empty_lines":"import sys\nfrom collections import Counter, deque, defaultdict\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\nfrom functools import reduce\nfrom math import ceil, floor, log10, log2, factorial\nfrom pprint import pprint\n\nsys.setrecursionlimit(1000000)\n# MOD = 10 ** 9 + 7\n# N = int(input())\n# A = [int(x) for x in input().split()]\n# V = [[0] * 100 for _ in range(100)]\n# A = [int(input()) for _ in range(N)]\nN, W = [int(x) for x in input().split()]\ndp = [float(\"inf\")] * 1000 * 100 * 10\nvs = set()\nvs.add(0)\ndp[0] = 0\nfor i in range(N):\n w, v = [int(x) for x in input().split()]\n tmpDP = dp.copy()\n for vv in list(vs):\n if dp[vv + v] > dp[vv] + w:\n tmpDP[vv + v] = dp[vv] + w\n vs.add(vv + v)\n dp = tmpDP\nans = 0\nfor v in list(vs):\n if dp[v] <= W:\n ans = max(ans, v)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\nfrom collections import Counter, deque, defaultdict\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\nfrom functools import reduce\nfrom math import ceil, floor, log10, log2, factorial\nfrom pprint import pprint\n\nsys.setrecursionlimit(1000000)\n# MOD = 10 ** 9 + 7\n# N = int(input())\n# A = [int(x) for x in input().split()]\n# V = [[0] * 100 for _ in range(100)]\n# A = [int(input()) for _ in range(N)]\nN, W = [int(x) for x in input().split()]\ndp = defaultdict(lambda: float(\"inf\"))\ndp[0] = 0\nfor i in range(N):\n w, v = [int(x) for x in input().split()]\n add = defaultdict(lambda: float(\"inf\"))\n for vv in list(dp.keys()):\n if dp[vv + v] > dp[vv] + w:\n add[vv + v] = dp[vv] + w\n dp.update(add)\nprint((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x: x[0])[0]))\n","code_same":false,"relative_loc_diff_percent":21.6216216216,"diff":["-dp = [float(\"inf\")] * 1000 * 100 * 10","-vs = set()","-vs.add(0)","+dp = defaultdict(lambda: float(\"inf\"))","- tmpDP = dp.copy()","- for vv in list(vs):","+ add = defaultdict(lambda: float(\"inf\"))","+ for vv in list(dp.keys()):","- tmpDP[vv + v] = dp[vv] + w","- vs.add(vv + v)","- dp = tmpDP","-ans = 0","-for v in list(vs):","- if dp[v] <= W:","- ans = max(ans, v)","-print(ans)","+ add[vv + v] = dp[vv] + w","+ dp.update(add)","+print((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x: x[0])[0]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5805827644,"measured_runtime_v1":0.1952783756,"runtime_lift":2.9731032046,"key":["s900171177","s494365384"]} +{"user_id":"u882209234","problem_id":"p03796","language":"python","submission_id_v0":"s179415880","submission_id_v1":"s895771571","cpu_time_v0":230,"cpu_time_v1":42,"memory_v0":3984,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import factorial\n\nN = int(eval(input()))\n\nprint((factorial(N) % (10**9 + 7)))\n\n# optimized version of the same code:\n","target":"from math import factorial\n\nN = int(eval(input()))\n\nans = 1\n\nfor i in range(1,N+1):\n\n ans *= i % (10**9 + 7)\n\n ans %= 10**9 + 7\n\nprint(ans)","code_v0_loc":3,"code_v1_loc":7,"code_v0_num_chars":79,"code_v1_num_chars":139,"code_v0_no_empty_lines":"from math import factorial\n\nN = int(eval(input()))\nprint((factorial(N) % (10**9 + 7)))\n","code_v1_no_empty_lines":"from math import factorial\n\nN = int(eval(input()))\nans = 1\nfor i in range(1, N + 1):\n ans *= i % (10**9 + 7)\n ans %= 10**9 + 7\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-print((factorial(N) % (10**9 + 7)))","+ans = 1","+for i in range(1, N + 1):","+ ans *= i % (10**9 + 7)","+ ans %= 10**9 + 7","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.9434056597,"measured_runtime_v1":0.3957924933,"runtime_lift":2.3835865397,"key":["s179415880","s895771571"]} +{"user_id":"u402629484","problem_id":"p02702","language":"python","submission_id_v0":"s641082621","submission_id_v1":"s046213774","cpu_time_v0":1692,"cpu_time_v1":128,"memory_v0":75572,"memory_v1":24100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\nimport math\n\nfrom math import gcd\n\ndef lcm(a, b): return a * b \/\/ gcd(a, b)\n\nfrom itertools import count, permutations, chain\n\nfrom functools import lru_cache\n\nfrom collections import deque, defaultdict\n\nfrom pprint import pprint\n\nii = lambda: int(eval(input()))\n\nmis = lambda: list(map(int, input().split()))\n\nlmis = lambda: list(mis())\n\nINF = float('inf')\n\nN1097 = 10**9 + 7\n\n\n\ndef meg(f, ok, ng):\n\n while abs(ok-ng)>1:\n\n mid = (ok+ng)\/\/2\n\n if f(mid):\n\n ok=mid\n\n else:\n\n ng=mid\n\n return ok\n\n\n\ndef get_inv(n, modp):\n\n return pow(n, modp-2, modp)\n\n\n\ndef factorials_list(n, modp): # 10**6\n\n fs = [1]\n\n for i in range(1, n+1):\n\n fs.append(fs[-1] * i % modp)\n\n return fs\n\n\n\ndef invs_list(n, fs, modp): # 10**6\n\n invs = [get_inv(fs[-1], modp)]\n\n for i in range(n, 1-1, -1):\n\n invs.append(invs[-1] * i % modp)\n\n invs.reverse()\n\n return invs\n\n\n\ndef comb(n, k, modp):\n\n num = 1\n\n for i in range(n, n-k, -1):\n\n num = num * i % modp\n\n den = 1\n\n for i in range(2, k+1):\n\n den = den * i % modp\n\n return num * get_inv(den, modp) % modp\n\n\n\ndef comb_from_list(n, k, modp, fs, invs): \n\n return fs[n] * invs[n-k] * invs[k] % modp\n\n\n\n#\n\n\n\nclass UnionFindEx:\n\n def __init__(self, size):\n\n #\u6b63\u306a\u3089\u6839\u306e\u756a\u53f7\u3001\u8ca0\u306a\u3089\u30b0\u30eb\u30fc\u30d7\u30b5\u30a4\u30ba\n\n self.roots = [-1] * size\n\n def getRootID(self, i):\n\n r = self.roots[i]\n\n if r < 0: #\u8ca0\u306a\u3089\u6839\n\n return i\n\n else:\n\n r = self.getRootID(r)\n\n self.roots[i] = r\n\n return r\n\n def getGroupSize(self, i):\n\n return -self.roots[self.getRootID(i)]\n\n def connect(self, i, j):\n\n r1, r2 = self.getRootID(i), self.getRootID(j)\n\n if r1 == r2:\n\n return False\n\n if self.getGroupSize(r1) < self.getGroupSize(r2):\n\n r1, r2 = r2, r1\n\n self.roots[r1] += self.roots[r2] #\u30b5\u30a4\u30ba\u66f4\u65b0\n\n self.roots[r2] = r1\n\n return True\n\n\n\nYes = 'Yes'\n\nNo = 'No'\n\n\n\n\n\ndef main():\n\n S = eval(input())\n\n d = [0]*2019\n\n dn = [0]*2019\n\n ans = 0\n\n for s in S:\n\n sn = int(s)\n\n dn[sn] += 1\n\n for i in range(2019):\n\n dn[(i*10+sn)%2019] += d[i]\n\n d, dn = dn, d\n\n for i in range(2019):\n\n dn[i] = 0\n\n ans += d[0]\n\n print(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\nmain()\n\n\n\n\n# optimized version of the same code:\n","target":"'''\n\n[point 1]\n\n1817181712114 \u306e\u90e8\u5206 \"18171\"\u306b\u3064\u3044\u3066\u8003\u3048\u308b...\n\n\n\n 181710000 \/ 10000 \u2261 0 (MOD 2019) \u306a\u3089\u3070\u30012019\u306e\u500d\u6570\n\n 181710000 \u2261 0 (MOD 2019) \u3067\u3088\u3044\n\n\n\n[point 2]\n\n 181710000\n\n =\n\n 181712114\n\n -\n\n 2114\n\n\n\n \u306a\u306e\u3067\u3001\u7279\u5b9a\u533a\u9593\u306e\u5024 \u306f \u7d2f\u7a4d\u548c\u306e\u5dee \u304b\u3089\u77ac\u6642\u306b\u6c42\u3081\u3089\u308c\u308b\u3002\n\n \u3055\u3089\u306b\u3001181710000 \u2261 0 (MOD 2019) \u3092\u8003\u3048\u308b\u3068\u3001\n\n\n\n 0 \u2261 181712114 - 2114\n\n \u2192 181712114 \u2261 2114\n\n\n\n \u3068\u306a\u308b\u3002\n\n \u7d50\u5c40\u306e\u6240\u3001MOD2019\u306b\u304a\u3044\u3066\u5408\u540c\u306a\u7d2f\u7a4d\u548c\u306e\u30da\u30a2\u306e\u6570\u306e\u6570\u3048\u4e0a\u3052\u3002\n\n'''\n\n\n\nfrom collections import defaultdict\n\n\n\ndef gen_10exp_mod(n, mod):\n\n a = 1\n\n yield a\n\n for _ in range(1, n):\n\n a = (a*10) % mod\n\n yield a\n\n\n\ndef main():\n\n MOD = 2019\n\n S = input()[::-1]\n\n # \u6841\u3054\u3068\u306e\u5b9f\u969b\u306e\u5024\u3092\u8a08\u7b97 (MOD)\n\n A = [int(s)*n % MOD for s, n in zip(S, gen_10exp_mod(len(S), MOD))]\n\n # \u7d2f\u7a4d\u548c\u3092\u8a08\u7b97\n\n ACC = [0]\n\n for a in A:\n\n ACC.append((ACC[-1] + a) % MOD)\n\n # \u30da\u30a2\u6570\u3048\u4e0a\u3052\n\n d = defaultdict(int)\n\n for acc in ACC:\n\n d[acc] += 1\n\n ans = sum(v*(v-1)\/\/2 for v in list(d.values()))\n\n print(ans)\n\n\n\n\n\nmain()\n","code_v0_loc":105,"code_v1_loc":51,"code_v0_num_chars":2384,"code_v1_num_chars":956,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1000000000)\nimport math\nfrom math import gcd\n\n\ndef lcm(a, b):\n return a * b \/\/ gcd(a, b)\n\n\nfrom itertools import count, permutations, chain\nfrom functools import lru_cache\nfrom collections import deque, defaultdict\nfrom pprint import pprint\n\nii = lambda: int(eval(input()))\nmis = lambda: list(map(int, input().split()))\nlmis = lambda: list(mis())\nINF = float(\"inf\")\nN1097 = 10**9 + 7\n\n\ndef meg(f, ok, ng):\n while abs(ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n if f(mid):\n ok = mid\n else:\n ng = mid\n return ok\n\n\ndef get_inv(n, modp):\n return pow(n, modp - 2, modp)\n\n\ndef factorials_list(n, modp): # 10**6\n fs = [1]\n for i in range(1, n + 1):\n fs.append(fs[-1] * i % modp)\n return fs\n\n\ndef invs_list(n, fs, modp): # 10**6\n invs = [get_inv(fs[-1], modp)]\n for i in range(n, 1 - 1, -1):\n invs.append(invs[-1] * i % modp)\n invs.reverse()\n return invs\n\n\ndef comb(n, k, modp):\n num = 1\n for i in range(n, n - k, -1):\n num = num * i % modp\n den = 1\n for i in range(2, k + 1):\n den = den * i % modp\n return num * get_inv(den, modp) % modp\n\n\ndef comb_from_list(n, k, modp, fs, invs):\n return fs[n] * invs[n - k] * invs[k] % modp\n\n\n#\nclass UnionFindEx:\n def __init__(self, size):\n # \u6b63\u306a\u3089\u6839\u306e\u756a\u53f7\u3001\u8ca0\u306a\u3089\u30b0\u30eb\u30fc\u30d7\u30b5\u30a4\u30ba\n self.roots = [-1] * size\n\n def getRootID(self, i):\n r = self.roots[i]\n if r < 0: # \u8ca0\u306a\u3089\u6839\n return i\n else:\n r = self.getRootID(r)\n self.roots[i] = r\n return r\n\n def getGroupSize(self, i):\n return -self.roots[self.getRootID(i)]\n\n def connect(self, i, j):\n r1, r2 = self.getRootID(i), self.getRootID(j)\n if r1 == r2:\n return False\n if self.getGroupSize(r1) < self.getGroupSize(r2):\n r1, r2 = r2, r1\n self.roots[r1] += self.roots[r2] # \u30b5\u30a4\u30ba\u66f4\u65b0\n self.roots[r2] = r1\n return True\n\n\nYes = \"Yes\"\nNo = \"No\"\n\n\ndef main():\n S = eval(input())\n d = [0] * 2019\n dn = [0] * 2019\n ans = 0\n for s in S:\n sn = int(s)\n dn[sn] += 1\n for i in range(2019):\n dn[(i * 10 + sn) % 2019] += d[i]\n d, dn = dn, d\n for i in range(2019):\n dn[i] = 0\n ans += d[0]\n print(ans)\n\n\nmain()\n","code_v1_no_empty_lines":"\"\"\"\n[point 1]\n1817181712114 \u306e\u90e8\u5206 \"18171\"\u306b\u3064\u3044\u3066\u8003\u3048\u308b...\n 181710000 \/ 10000 \u2261 0 (MOD 2019) \u306a\u3089\u3070\u30012019\u306e\u500d\u6570\n 181710000 \u2261 0 (MOD 2019) \u3067\u3088\u3044\n[point 2]\n 181710000\n =\n 181712114\n -\n 2114\n \u306a\u306e\u3067\u3001\u7279\u5b9a\u533a\u9593\u306e\u5024 \u306f \u7d2f\u7a4d\u548c\u306e\u5dee \u304b\u3089\u77ac\u6642\u306b\u6c42\u3081\u3089\u308c\u308b\u3002\n \u3055\u3089\u306b\u3001181710000 \u2261 0 (MOD 2019) \u3092\u8003\u3048\u308b\u3068\u3001\n 0 \u2261 181712114 - 2114\n \u2192 181712114 \u2261 2114\n \u3068\u306a\u308b\u3002\n \u7d50\u5c40\u306e\u6240\u3001MOD2019\u306b\u304a\u3044\u3066\u5408\u540c\u306a\u7d2f\u7a4d\u548c\u306e\u30da\u30a2\u306e\u6570\u306e\u6570\u3048\u4e0a\u3052\u3002\n\"\"\"\nfrom collections import defaultdict\n\n\ndef gen_10exp_mod(n, mod):\n a = 1\n yield a\n for _ in range(1, n):\n a = (a * 10) % mod\n yield a\n\n\ndef main():\n MOD = 2019\n S = input()[::-1]\n # \u6841\u3054\u3068\u306e\u5b9f\u969b\u306e\u5024\u3092\u8a08\u7b97 (MOD)\n A = [int(s) * n % MOD for s, n in zip(S, gen_10exp_mod(len(S), MOD))]\n # \u7d2f\u7a4d\u548c\u3092\u8a08\u7b97\n ACC = [0]\n for a in A:\n ACC.append((ACC[-1] + a) % MOD)\n # \u30da\u30a2\u6570\u3048\u4e0a\u3052\n d = defaultdict(int)\n for acc in ACC:\n d[acc] += 1\n ans = sum(v * (v - 1) \/\/ 2 for v in list(d.values()))\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":51.4285714286,"diff":["-import sys","-","-sys.setrecursionlimit(1000000000)","-import math","-from math import gcd","+\"\"\"","+[point 1]","+1817181712114 \u306e\u90e8\u5206 \"18171\"\u306b\u3064\u3044\u3066\u8003\u3048\u308b...","+ 181710000 \/ 10000 \u2261 0 (MOD 2019) \u306a\u3089\u3070\u30012019\u306e\u500d\u6570","+ 181710000 \u2261 0 (MOD 2019) \u3067\u3088\u3044","+[point 2]","+ 181710000","+ =","+ 181712114","+ -","+ 2114","+ \u306a\u306e\u3067\u3001\u7279\u5b9a\u533a\u9593\u306e\u5024 \u306f \u7d2f\u7a4d\u548c\u306e\u5dee \u304b\u3089\u77ac\u6642\u306b\u6c42\u3081\u3089\u308c\u308b\u3002","+ \u3055\u3089\u306b\u3001181710000 \u2261 0 (MOD 2019) \u3092\u8003\u3048\u308b\u3068\u3001","+ 0 \u2261 181712114 - 2114","+ \u2192 181712114 \u2261 2114","+ \u3068\u306a\u308b\u3002","+ \u7d50\u5c40\u306e\u6240\u3001MOD2019\u306b\u304a\u3044\u3066\u5408\u540c\u306a\u7d2f\u7a4d\u548c\u306e\u30da\u30a2\u306e\u6570\u306e\u6570\u3048\u4e0a\u3052\u3002","+\"\"\"","+from collections import defaultdict","-def lcm(a, b):","- return a * b \/\/ gcd(a, b)","-","-","-from itertools import count, permutations, chain","-from functools import lru_cache","-from collections import deque, defaultdict","-from pprint import pprint","-","-ii = lambda: int(eval(input()))","-mis = lambda: list(map(int, input().split()))","-lmis = lambda: list(mis())","-INF = float(\"inf\")","-N1097 = 10**9 + 7","-","-","-def meg(f, ok, ng):","- while abs(ok - ng) > 1:","- mid = (ok + ng) \/\/ 2","- if f(mid):","- ok = mid","- else:","- ng = mid","- return ok","-","-","-def get_inv(n, modp):","- return pow(n, modp - 2, modp)","-","-","-def factorials_list(n, modp): # 10**6","- fs = [1]","- for i in range(1, n + 1):","- fs.append(fs[-1] * i % modp)","- return fs","-","-","-def invs_list(n, fs, modp): # 10**6","- invs = [get_inv(fs[-1], modp)]","- for i in range(n, 1 - 1, -1):","- invs.append(invs[-1] * i % modp)","- invs.reverse()","- return invs","-","-","-def comb(n, k, modp):","- num = 1","- for i in range(n, n - k, -1):","- num = num * i % modp","- den = 1","- for i in range(2, k + 1):","- den = den * i % modp","- return num * get_inv(den, modp) % modp","-","-","-def comb_from_list(n, k, modp, fs, invs):","- return fs[n] * invs[n - k] * invs[k] % modp","-","-","-#","-class UnionFindEx:","- def __init__(self, size):","- # \u6b63\u306a\u3089\u6839\u306e\u756a\u53f7\u3001\u8ca0\u306a\u3089\u30b0\u30eb\u30fc\u30d7\u30b5\u30a4\u30ba","- self.roots = [-1] * size","-","- def getRootID(self, i):","- r = self.roots[i]","- if r < 0: # \u8ca0\u306a\u3089\u6839","- return i","- else:","- r = self.getRootID(r)","- self.roots[i] = r","- return r","-","- def getGroupSize(self, i):","- return -self.roots[self.getRootID(i)]","-","- def connect(self, i, j):","- r1, r2 = self.getRootID(i), self.getRootID(j)","- if r1 == r2:","- return False","- if self.getGroupSize(r1) < self.getGroupSize(r2):","- r1, r2 = r2, r1","- self.roots[r1] += self.roots[r2] # \u30b5\u30a4\u30ba\u66f4\u65b0","- self.roots[r2] = r1","- return True","-","-","-Yes = \"Yes\"","-No = \"No\"","+def gen_10exp_mod(n, mod):","+ a = 1","+ yield a","+ for _ in range(1, n):","+ a = (a * 10) % mod","+ yield a","- S = eval(input())","- d = [0] * 2019","- dn = [0] * 2019","- ans = 0","- for s in S:","- sn = int(s)","- dn[sn] += 1","- for i in range(2019):","- dn[(i * 10 + sn) % 2019] += d[i]","- d, dn = dn, d","- for i in range(2019):","- dn[i] = 0","- ans += d[0]","+ MOD = 2019","+ S = input()[::-1]","+ # \u6841\u3054\u3068\u306e\u5b9f\u969b\u306e\u5024\u3092\u8a08\u7b97 (MOD)","+ A = [int(s) * n % MOD for s, n in zip(S, gen_10exp_mod(len(S), MOD))]","+ # \u7d2f\u7a4d\u548c\u3092\u8a08\u7b97","+ ACC = [0]","+ for a in A:","+ ACC.append((ACC[-1] + a) % MOD)","+ # \u30da\u30a2\u6570\u3048\u4e0a\u3052","+ d = defaultdict(int)","+ for acc in ACC:","+ d[acc] += 1","+ ans = sum(v * (v - 1) \/\/ 2 for v in list(d.values()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3964794042,"measured_runtime_v1":0.2964991529,"runtime_lift":1.3372024855,"key":["s641082621","s046213774"]} +{"user_id":"u680851063","problem_id":"p03013","language":"python","submission_id_v0":"s906106174","submission_id_v1":"s036157730","cpu_time_v0":71,"cpu_time_v1":61,"memory_v0":13192,"memory_v1":13192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nn, m = list(map(int, input().split()))\n\nbroken = set([int(eval(input())) for _ in range(m)]) # \u3053\u3053\u304c'list'\u3060\u3068Pypy\u3067\u3082\u901a\u3089\u306a\u3044\n\n\n\ndef ptn_num(x): # 'x'step\u307e\u3067\u306e\u30d1\u30bf\u30fc\u30f3\u6570\n\n dp = [0] * (x+1) # DP\u67a0_including step'0'\n\n if 1 in broken: # in case, step'1' broken \n\n dp[:2] = 1, 0\n\n else:\n\n dp[:2] = 1, 1 # Usually\n\n\n\n for i in range(2, x+1):\n\n if i not in broken: # \u968e\u6bb5\u304c\u58ca\u308c\u3066\u306a\u3044\u5834\u5408...\n\n dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7) # -1\u6bb5\u76ee\u3068-2\u6bb5\u76ee\u306e\u5408\u8a08\n\n print((dp[-1]))\n\n\n\nptn_num(n)\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nn, m = list(map(int, input().split()))\n\nbroken = set([int(eval(input())) for _ in range(m)]) # \u3053\u3053\u304c'list'\u3060\u3068Pypy\u3067\u3082\u901a\u3089\u306a\u3044\n\n\n\ndef ptn_num(x): # 'x'step\u307e\u3067\u306e\u30d1\u30bf\u30fc\u30f3\u6570\n\n dp = [0] * (x+1) # DP\u67a0_including step'0'\n\n if 1 in broken: # \u56fa\u5b9a\u90e8\u5206_in case, step'1' broken \n\n dp[:2] = 1, 0\n\n else:\n\n dp[:2] = 1, 1 # \u56fa\u5b9a\u90e8\u5206_Usually\n\n\n\n for i in range(2, x+1):\n\n if i not in broken: # \u968e\u6bb5\u304c\u58ca\u308c\u3066\u306a\u3044\u5834\u5408...\n\n dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7) # -1\u6bb5\u76ee\u3068-2\u6bb5\u76ee\u306e\u5408\u8a08\n\n print((dp[-1]))\n\n\n\nptn_num(n)","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":522,"code_v1_num_chars":531,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, m = list(map(int, input().split()))\nbroken = set([int(eval(input())) for _ in range(m)]) # \u3053\u3053\u304c'list'\u3060\u3068Pypy\u3067\u3082\u901a\u3089\u306a\u3044\n\n\ndef ptn_num(x): # 'x'step\u307e\u3067\u306e\u30d1\u30bf\u30fc\u30f3\u6570\n dp = [0] * (x + 1) # DP\u67a0_including step'0'\n if 1 in broken: # in case, step'1' broken\n dp[:2] = 1, 0\n else:\n dp[:2] = 1, 1 # Usually\n for i in range(2, x + 1):\n if i not in broken: # \u968e\u6bb5\u304c\u58ca\u308c\u3066\u306a\u3044\u5834\u5408...\n dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7) # -1\u6bb5\u76ee\u3068-2\u6bb5\u76ee\u306e\u5408\u8a08\n print((dp[-1]))\n\n\nptn_num(n)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, m = list(map(int, input().split()))\nbroken = set([int(eval(input())) for _ in range(m)]) # \u3053\u3053\u304c'list'\u3060\u3068Pypy\u3067\u3082\u901a\u3089\u306a\u3044\n\n\ndef ptn_num(x): # 'x'step\u307e\u3067\u306e\u30d1\u30bf\u30fc\u30f3\u6570\n dp = [0] * (x + 1) # DP\u67a0_including step'0'\n if 1 in broken: # \u56fa\u5b9a\u90e8\u5206_in case, step'1' broken\n dp[:2] = 1, 0\n else:\n dp[:2] = 1, 1 # \u56fa\u5b9a\u90e8\u5206_Usually\n for i in range(2, x + 1):\n if i not in broken: # \u968e\u6bb5\u304c\u58ca\u308c\u3066\u306a\u3044\u5834\u5408...\n dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7) # -1\u6bb5\u76ee\u3068-2\u6bb5\u76ee\u306e\u5408\u8a08\n print((dp[-1]))\n\n\nptn_num(n)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if 1 in broken: # in case, step'1' broken","+ if 1 in broken: # \u56fa\u5b9a\u90e8\u5206_in case, step'1' broken","- dp[:2] = 1, 1 # Usually","+ dp[:2] = 1, 1 # \u56fa\u5b9a\u90e8\u5206_Usually"],"diff_only_import_comment":false,"measured_runtime_v0":0.2961144955,"measured_runtime_v1":0.2031981165,"runtime_lift":1.4572698829,"key":["s906106174","s036157730"]} +{"user_id":"u146816547","problem_id":"p00005","language":"python","submission_id_v0":"s153581221","submission_id_v1":"s486237781","cpu_time_v0":30,"cpu_time_v1":10,"memory_v0":5872,"memory_v1":6452,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport fractions\n\nwhile True:\n\n\ttry:\n\n\t\tx,y = list(map(int,input().split()))\n\n\t\tprint('%d %d' % (fractions.gcd(x,y),x\/fractions.gcd(x,y)*y))\n\n\texcept EOFError:\n\n\t\tbreak\n\n# optimized version of the same code:\n","target":"def gcd(x, y):\n\n if y == 0:\n\n return x\n\n else:\n\n return gcd(y, x%y)\n\n\n\n\n\ndef lcm(x,y):\n\n return x\/gcd(x, y)*y\n\n\n\n\n\nwhile True:\n\n try:\n\n x, y = list(map(int, input().split()))\n\n except EOFError:\n\n break\n\n\n\n print(\"%d %d\" % (gcd(x, y), lcm(x, y)))","code_v0_loc":7,"code_v1_loc":18,"code_v0_num_chars":165,"code_v1_num_chars":288,"code_v0_no_empty_lines":"import fractions\n\nwhile True:\n try:\n x, y = list(map(int, input().split()))\n print(\"%d %d\" % (fractions.gcd(x, y), x \/ fractions.gcd(x, y) * y))\n except EOFError:\n break\n","code_v1_no_empty_lines":"def gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\n\ndef lcm(x, y):\n return x \/ gcd(x, y) * y\n\n\nwhile True:\n try:\n x, y = list(map(int, input().split()))\n except EOFError:\n break\n print(\"%d %d\" % (gcd(x, y), lcm(x, y)))\n","code_same":false,"relative_loc_diff_percent":61.1111111111,"diff":["-import fractions","+def gcd(x, y):","+ if y == 0:","+ return x","+ else:","+ return gcd(y, x % y)","+","+","+def lcm(x, y):","+ return x \/ gcd(x, y) * y","+","- print(\"%d %d\" % (fractions.gcd(x, y), x \/ fractions.gcd(x, y) * y))","+ print(\"%d %d\" % (gcd(x, y), lcm(x, y)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2843708012,"measured_runtime_v1":0.2133130357,"runtime_lift":1.3331149699,"key":["s153581221","s486237781"]} +{"user_id":"u815878613","problem_id":"p03000","language":"python","submission_id_v0":"s551428668","submission_id_v1":"s698553150","cpu_time_v0":156,"cpu_time_v1":17,"memory_v0":12396,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.1,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nN, X = list(map(int, input().split()))\n\n\n\nL = np.array(list(map(int, input().split())))\n\n\n\nx = np.zeros(N+1)\n\n\n\nfor n in range(1,N+1):\n\n x[n] = x[n-1] + L[n-1]\n\n if x[n] > X:\n\n print(n)\n\n sys.exit()\n\n\n\nprint((N+1))\n\n\n\n\n# optimized version of the same code:\n","target":"N, X = list(map(int, input().split()))\n\nL = list(map(int, input().split()))\n\n\n\ncnt = 1\n\nsum_L = 0\n\nfor l in L:\n\n sum_L += l\n\n if sum_L <= X:\n\n cnt += 1\n\n else:\n\n break\n\n\n\nprint(cnt)\n","code_v0_loc":17,"code_v1_loc":13,"code_v0_num_chars":270,"code_v1_num_chars":199,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nN, X = list(map(int, input().split()))\nL = np.array(list(map(int, input().split())))\nx = np.zeros(N + 1)\nfor n in range(1, N + 1):\n x[n] = x[n - 1] + L[n - 1]\n if x[n] > X:\n print(n)\n sys.exit()\nprint((N + 1))\n","code_v1_no_empty_lines":"N, X = list(map(int, input().split()))\nL = list(map(int, input().split()))\ncnt = 1\nsum_L = 0\nfor l in L:\n sum_L += l\n if sum_L <= X:\n cnt += 1\n else:\n break\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":23.5294117647,"diff":["-import sys","-import numpy as np","-","-L = np.array(list(map(int, input().split())))","-x = np.zeros(N + 1)","-for n in range(1, N + 1):","- x[n] = x[n - 1] + L[n - 1]","- if x[n] > X:","- print(n)","- sys.exit()","-print((N + 1))","+L = list(map(int, input().split()))","+cnt = 1","+sum_L = 0","+for l in L:","+ sum_L += l","+ if sum_L <= X:","+ cnt += 1","+ else:","+ break","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.9238229019,"measured_runtime_v1":0.1570141087,"runtime_lift":5.883693572,"key":["s551428668","s698553150"]} +{"user_id":"u111365362","problem_id":"p02881","language":"python","submission_id_v0":"s326793866","submission_id_v1":"s577051886","cpu_time_v0":202,"cpu_time_v1":174,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nr = int(n**.5)\n\nfor i in range(r):\n\n if n % (r-i) == 0:\n\n print(( (r-i) + n\/\/(r-i) - 2 ))\n\n break\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\ns = int(n**.5)\n\nfor i in range(s):\n\n if n % (s-i) == 0:\n\n print(((s-i) + n \/\/ (s-i) - 2))\n\n break","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":120,"code_v1_num_chars":120,"code_v0_no_empty_lines":"n = int(eval(input()))\nr = int(n**0.5)\nfor i in range(r):\n if n % (r - i) == 0:\n print(((r - i) + n \/\/ (r - i) - 2))\n break\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = int(n**0.5)\nfor i in range(s):\n if n % (s - i) == 0:\n print(((s - i) + n \/\/ (s - i) - 2))\n break\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-r = int(n**0.5)","-for i in range(r):","- if n % (r - i) == 0:","- print(((r - i) + n \/\/ (r - i) - 2))","+s = int(n**0.5)","+for i in range(s):","+ if n % (s - i) == 0:","+ print(((s - i) + n \/\/ (s - i) - 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3217455449,"measured_runtime_v1":0.1190871449,"runtime_lift":2.7017655456,"key":["s326793866","s577051886"]} +{"user_id":"u670180528","problem_id":"p03253","language":"python","submission_id_v0":"s289323588","submission_id_v1":"s397757622","cpu_time_v0":97,"cpu_time_v1":24,"memory_v0":11252,"memory_v1":3564,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.26,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:\n\n\t\treturn [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn \/\/= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:\n\n\t\tret.append(n)\n\n\treturn ret\n\n\n\nn,m = list(map(int,input().split()))\n\nmod = 10**9+7\n\nif m==1:\n\n\tprint((1));exit()\n\n\n\nfactors = Counter(factorization(m))\n\nmx = n+max(factors.values())\n\n\n\nfac = [1]*(mx+1)\n\ninv = [1]*(mx+1)\n\nfor i in range(1,mx+1):\n\n\tfac[i] = fac[i-1] * i % mod\n\ninv[-1] = pow(fac[-1], mod - 2, mod)\n\nfor i in range(mx-1, -1, -1):\n\n\tinv[i] = inv[i+1] * (i+1) % mod\n\ndef cmb(n,r):\n\n\tassert n >= r >= 0\n\n\treturn fac[n] * inv[n-r] * inv[r] % mod\n\n\t\n\nans=1\n\nfor v in list(factors.values()):\n\n\tans*=cmb(n+v-1,v)\n\n\tans%=mod\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"from collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:return [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn \/\/= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:ret.append(n)\n\n\treturn ret\n\n\t\n\nfrom operator import mul\n\nfrom functools import reduce\n\ndef cmb(n,r):\n\n\tif n < r:return 0\n\n\tr = min(n-r,r)\n\n\tif r==0:return 1\n\n\tu = reduce(mul, list(range(n, n-r, -1)))\n\n\td = reduce(mul, list(range(1,r+1)))\n\n\treturn u\/\/d\n\n\n\ndef main():\n\n\tn,m = list(map(int,input().split()))\n\n\tmod = 10**9+7\n\n\tif m==1:\n\n\t\tprint((1))\n\n\t\texit()\n\n\tans=1\n\n\tfor v in list(Counter(factorization(m)).values()):\n\n\t\tans*=cmb(n+v-1,v)\n\n\t\tans%=mod\n\n\tprint(ans)\n\n\t\n\nif __name__==\"__main__\":main()","code_v0_loc":40,"code_v1_loc":36,"code_v0_num_chars":723,"code_v1_num_chars":658,"code_v0_no_empty_lines":"from collections import Counter\n\n\ndef factorization(n) -> list:\n if n == 1:\n return [1]\n ret = []\n i = 2\n while i * i <= n:\n while n % i == 0:\n n \/\/= i\n ret.append(i)\n i += 1\n if n != 1:\n ret.append(n)\n return ret\n\n\nn, m = list(map(int, input().split()))\nmod = 10**9 + 7\nif m == 1:\n print((1))\n exit()\nfactors = Counter(factorization(m))\nmx = n + max(factors.values())\nfac = [1] * (mx + 1)\ninv = [1] * (mx + 1)\nfor i in range(1, mx + 1):\n fac[i] = fac[i - 1] * i % mod\ninv[-1] = pow(fac[-1], mod - 2, mod)\nfor i in range(mx - 1, -1, -1):\n inv[i] = inv[i + 1] * (i + 1) % mod\n\n\ndef cmb(n, r):\n assert n >= r >= 0\n return fac[n] * inv[n - r] * inv[r] % mod\n\n\nans = 1\nfor v in list(factors.values()):\n ans *= cmb(n + v - 1, v)\n ans %= mod\nprint(ans)\n","code_v1_no_empty_lines":"from collections import Counter\n\n\ndef factorization(n) -> list:\n if n == 1:\n return [1]\n ret = []\n i = 2\n while i * i <= n:\n while n % i == 0:\n n \/\/= i\n ret.append(i)\n i += 1\n if n != 1:\n ret.append(n)\n return ret\n\n\nfrom operator import mul\nfrom functools import reduce\n\n\ndef cmb(n, r):\n if n < r:\n return 0\n r = min(n - r, r)\n if r == 0:\n return 1\n u = reduce(mul, list(range(n, n - r, -1)))\n d = reduce(mul, list(range(1, r + 1)))\n return u \/\/ d\n\n\ndef main():\n n, m = list(map(int, input().split()))\n mod = 10**9 + 7\n if m == 1:\n print((1))\n exit()\n ans = 1\n for v in list(Counter(factorization(m)).values()):\n ans *= cmb(n + v - 1, v)\n ans %= mod\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-n, m = list(map(int, input().split()))","-mod = 10**9 + 7","-if m == 1:","- print((1))","- exit()","-factors = Counter(factorization(m))","-mx = n + max(factors.values())","-fac = [1] * (mx + 1)","-inv = [1] * (mx + 1)","-for i in range(1, mx + 1):","- fac[i] = fac[i - 1] * i % mod","-inv[-1] = pow(fac[-1], mod - 2, mod)","-for i in range(mx - 1, -1, -1):","- inv[i] = inv[i + 1] * (i + 1) % mod","+from operator import mul","+from functools import reduce","- assert n >= r >= 0","- return fac[n] * inv[n - r] * inv[r] % mod","+ if n < r:","+ return 0","+ r = min(n - r, r)","+ if r == 0:","+ return 1","+ u = reduce(mul, list(range(n, n - r, -1)))","+ d = reduce(mul, list(range(1, r + 1)))","+ return u \/\/ d","-ans = 1","-for v in list(factors.values()):","- ans *= cmb(n + v - 1, v)","- ans %= mod","-print(ans)","+def main():","+ n, m = list(map(int, input().split()))","+ mod = 10**9 + 7","+ if m == 1:","+ print((1))","+ exit()","+ ans = 1","+ for v in list(Counter(factorization(m)).values()):","+ ans *= cmb(n + v - 1, v)","+ ans %= mod","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.4340592513,"measured_runtime_v1":0.2881658652,"runtime_lift":1.5062826786,"key":["s289323588","s397757622"]} +{"user_id":"u346812984","problem_id":"p02725","language":"python","submission_id_v0":"s133823600","submission_id_v1":"s446849062","cpu_time_v0":124,"cpu_time_v1":97,"memory_v0":26420,"memory_v1":26444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.77,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nK, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\ndiff = A[0] + K - A[-1]\n\nans = A[-1] - A[0]\n\nfor i in range(1, N):\n\n dist = K - A[i] + A[i - 1]\n\n if dist < ans:\n\n ans = dist\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\n\n\ndef input():\n\n return sys.stdin.readline().strip()\n\n\n\n\n\ndef main():\n\n K, N = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n\n\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n\n print((min(min(ans), A[-1] - A[0])))\n\n\n\n\n\nmain()\n","code_v0_loc":11,"code_v1_loc":16,"code_v0_num_chars":226,"code_v1_num_chars":274,"code_v0_no_empty_lines":"K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\ndiff = A[0] + K - A[-1]\nans = A[-1] - A[0]\nfor i in range(1, N):\n dist = K - A[i] + A[i - 1]\n if dist < ans:\n ans = dist\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n K, N = list(map(int, input().split()))\n A = list(map(int, input().split()))\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n print((min(min(ans), A[-1] - A[0])))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":31.25,"diff":["-K, N = list(map(int, input().split()))","-A = list(map(int, input().split()))","-diff = A[0] + K - A[-1]","-ans = A[-1] - A[0]","-for i in range(1, N):","- dist = K - A[i] + A[i - 1]","- if dist < ans:","- ans = dist","-print(ans)","+import sys","+","+","+def input():","+ return sys.stdin.readline().strip()","+","+","+def main():","+ K, N = list(map(int, input().split()))","+ A = list(map(int, input().split()))","+ ans = [K - A[i] + A[i - 1] for i in range(1, N)]","+ print((min(min(ans), A[-1] - A[0])))","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2153115588,"measured_runtime_v1":0.0063990955,"runtime_lift":33.6471865365,"key":["s133823600","s446849062"]} +{"user_id":"u254871849","problem_id":"p02837","language":"python","submission_id_v0":"s091639988","submission_id_v1":"s838166037","cpu_time_v0":602,"cpu_time_v1":120,"memory_v0":12496,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.07,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nn = int(sys.stdin.readline().rstrip())\n\nx = []\n\ny = []\n\nfor i in range(n):\n\n a = int(sys.stdin.readline().rstrip())\n\n xy = [sys.stdin.readline().split() for _ in range(a)]\n\n if not xy:\n\n x.append(None)\n\n y.append(None)\n\n continue\n\n xi, yi = np.array(xy, np.int64).T\n\n x.append(xi-1)\n\n y.append(yi)\n\n\n\ndef main():\n\n\n\n ans = 0\n\n for comb in range(2 ** n):\n\n cnt = 0\n\n for i in range(n):\n\n if not comb >> i & 1:\n\n continue\n\n if x[i] is None:\n\n cnt += 1\n\n continue\n\n if np.count_nonzero(comb >> x[i] & 1 ^ y[i]):\n\n break\n\n cnt += 1\n\n else:\n\n ans = max(ans, cnt)\n\n return ans\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nn = int(sys.stdin.readline().rstrip())\n\nxy = [[] for _ in range(n)]\n\nfor i in range(n):\n\n a = int(sys.stdin.readline().rstrip())\n\n for j in range(a):\n\n x, y = list(map(int, sys.stdin.readline().split()))\n\n xy[i].append((x-1, y))\n\n\n\ndef main():\n\n ans = 0\n\n for comb in range(2 ** n):\n\n cnt = 0\n\n for i in range(n):\n\n if comb >> i & 1 ^ 1:\n\n continue\n\n for x, y in xy[i]:\n\n if comb >> x & 1 ^ y:\n\n break\n\n else:\n\n cnt += 1\n\n continue\n\n break\n\n else:\n\n ans = max(ans, cnt)\n\n return ans\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":38,"code_v1_loc":31,"code_v0_num_chars":868,"code_v1_num_chars":754,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nn = int(sys.stdin.readline().rstrip())\nx = []\ny = []\nfor i in range(n):\n a = int(sys.stdin.readline().rstrip())\n xy = [sys.stdin.readline().split() for _ in range(a)]\n if not xy:\n x.append(None)\n y.append(None)\n continue\n xi, yi = np.array(xy, np.int64).T\n x.append(xi - 1)\n y.append(yi)\n\n\ndef main():\n ans = 0\n for comb in range(2**n):\n cnt = 0\n for i in range(n):\n if not comb >> i & 1:\n continue\n if x[i] is None:\n cnt += 1\n continue\n if np.count_nonzero(comb >> x[i] & 1 ^ y[i]):\n break\n cnt += 1\n else:\n ans = max(ans, cnt)\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_v1_no_empty_lines":"import sys\n\nn = int(sys.stdin.readline().rstrip())\nxy = [[] for _ in range(n)]\nfor i in range(n):\n a = int(sys.stdin.readline().rstrip())\n for j in range(a):\n x, y = list(map(int, sys.stdin.readline().split()))\n xy[i].append((x - 1, y))\n\n\ndef main():\n ans = 0\n for comb in range(2**n):\n cnt = 0\n for i in range(n):\n if comb >> i & 1 ^ 1:\n continue\n for x, y in xy[i]:\n if comb >> x & 1 ^ y:\n break\n else:\n cnt += 1\n continue\n break\n else:\n ans = max(ans, cnt)\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":18.4210526316,"diff":["-import numpy as np","-x = []","-y = []","+xy = [[] for _ in range(n)]","- xy = [sys.stdin.readline().split() for _ in range(a)]","- if not xy:","- x.append(None)","- y.append(None)","- continue","- xi, yi = np.array(xy, np.int64).T","- x.append(xi - 1)","- y.append(yi)","+ for j in range(a):","+ x, y = list(map(int, sys.stdin.readline().split()))","+ xy[i].append((x - 1, y))","- if not comb >> i & 1:","+ if comb >> i & 1 ^ 1:","- if x[i] is None:","+ for x, y in xy[i]:","+ if comb >> x & 1 ^ y:","+ break","+ else:","- if np.count_nonzero(comb >> x[i] & 1 ^ y[i]):","- break","- cnt += 1","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":1.7658371491,"measured_runtime_v1":0.3071119606,"runtime_lift":5.7498156221,"key":["s091639988","s838166037"]} +{"user_id":"u392319141","problem_id":"p03837","language":"python","submission_id_v0":"s034918940","submission_id_v1":"s264008956","cpu_time_v0":415,"cpu_time_v1":231,"memory_v0":25716,"memory_v1":41836,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n\n\n\nINF = float('inf')\n\n\n\ndef sol():\n\n N, M = list(map(int, input().split()))\n\n\n\n edges = []\n\n\n\n for _ in range(M):\n\n fr, to, cost = list(map(int, input().split()))\n\n fr -= 1\n\n to -= 1\n\n edges.append((fr, to, cost))\n\n\n\n graph = [[INF] * N for _ in range(N)]\n\n for fr, to, cost in edges:\n\n graph[fr][to] = cost\n\n\n\n graph = csgraph_from_dense(graph, null_value=INF)\n\n\n\n dist = floyd_warshall(graph, directed=False)\n\n ans = (graph > dist).sum()\n\n print(ans)\n\n\n\nsol()\n\n# optimized version of the same code:\n","target":"N, M = list(map(int, input().split()))\n\nINF = 10**18\n\n\n\nminDist = [[INF] * N for _ in range(N)]\n\nfor i in range(N):\n\n minDist[i][i] = 0\n\n\n\nedges = []\n\nfor _ in range(M):\n\n fr, to, d = list(map(int, input().split()))\n\n fr -= 1\n\n to -= 1\n\n edges.append((fr, to, d))\n\n minDist[fr][to] = d\n\n minDist[to][fr] = d\n\n\n\nfor k in range(N):\n\n for i in range(N):\n\n for j in range(N):\n\n d = minDist[i][k] + minDist[k][j]\n\n if minDist[i][j] > d:\n\n minDist[i][j] = d\n\n\n\nans = 0\n\nfor fr, to, d in edges:\n\n if minDist[fr][to] < d:\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":26,"code_v1_loc":28,"code_v0_num_chars":580,"code_v1_num_chars":603,"code_v0_no_empty_lines":"from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n\nINF = float(\"inf\")\n\n\ndef sol():\n N, M = list(map(int, input().split()))\n edges = []\n for _ in range(M):\n fr, to, cost = list(map(int, input().split()))\n fr -= 1\n to -= 1\n edges.append((fr, to, cost))\n graph = [[INF] * N for _ in range(N)]\n for fr, to, cost in edges:\n graph[fr][to] = cost\n graph = csgraph_from_dense(graph, null_value=INF)\n dist = floyd_warshall(graph, directed=False)\n ans = (graph > dist).sum()\n print(ans)\n\n\nsol()\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nINF = 10**18\nminDist = [[INF] * N for _ in range(N)]\nfor i in range(N):\n minDist[i][i] = 0\nedges = []\nfor _ in range(M):\n fr, to, d = list(map(int, input().split()))\n fr -= 1\n to -= 1\n edges.append((fr, to, d))\n minDist[fr][to] = d\n minDist[to][fr] = d\nfor k in range(N):\n for i in range(N):\n for j in range(N):\n d = minDist[i][k] + minDist[k][j]\n if minDist[i][j] > d:\n minDist[i][j] = d\nans = 0\nfor fr, to, d in edges:\n if minDist[fr][to] < d:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall","-","-INF = float(\"inf\")","-","-","-def sol():","- N, M = list(map(int, input().split()))","- edges = []","- for _ in range(M):","- fr, to, cost = list(map(int, input().split()))","- fr -= 1","- to -= 1","- edges.append((fr, to, cost))","- graph = [[INF] * N for _ in range(N)]","- for fr, to, cost in edges:","- graph[fr][to] = cost","- graph = csgraph_from_dense(graph, null_value=INF)","- dist = floyd_warshall(graph, directed=False)","- ans = (graph > dist).sum()","- print(ans)","-","-","-sol()","+N, M = list(map(int, input().split()))","+INF = 10**18","+minDist = [[INF] * N for _ in range(N)]","+for i in range(N):","+ minDist[i][i] = 0","+edges = []","+for _ in range(M):","+ fr, to, d = list(map(int, input().split()))","+ fr -= 1","+ to -= 1","+ edges.append((fr, to, d))","+ minDist[fr][to] = d","+ minDist[to][fr] = d","+for k in range(N):","+ for i in range(N):","+ for j in range(N):","+ d = minDist[i][k] + minDist[k][j]","+ if minDist[i][j] > d:","+ minDist[i][j] = d","+ans = 0","+for fr, to, d in edges:","+ if minDist[fr][to] < d:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.8897204494,"measured_runtime_v1":0.2072854909,"runtime_lift":9.1165109578,"key":["s034918940","s264008956"]} +{"user_id":"u648881683","problem_id":"p03371","language":"python","submission_id_v0":"s115897723","submission_id_v1":"s652896869","cpu_time_v0":101,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.18,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = float('inf')\n\n for i in range(0, max(X, Y)*2+1, 2):\n\n ans = min(A*max(X-i\/\/2, 0)+B*max(Y-i\/\/2, 0)+C*i, ans)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = 0\n\n if A+B > 2*C:\n\n ans = 2*C*min(X, Y)+min((A if X>Y else B)*abs(X-Y), 2*C*abs(X-Y))\n\n else:\n\n ans = A*X+B*Y\n\n \n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","code_v0_loc":13,"code_v1_loc":16,"code_v0_num_chars":316,"code_v1_num_chars":334,"code_v0_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = float(\"inf\")\n for i in range(0, max(X, Y) * 2 + 1, 2):\n ans = min(A * max(X - i \/\/ 2, 0) + B * max(Y - i \/\/ 2, 0) + C * i, ans)\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = 0\n if A + B > 2 * C:\n ans = 2 * C * min(X, Y) + min(\n (A if X > Y else B) * abs(X - Y), 2 * C * abs(X - Y)\n )\n else:\n ans = A * X + B * Y\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["- ans = float(\"inf\")","- for i in range(0, max(X, Y) * 2 + 1, 2):","- ans = min(A * max(X - i \/\/ 2, 0) + B * max(Y - i \/\/ 2, 0) + C * i, ans)","+ ans = 0","+ if A + B > 2 * C:","+ ans = 2 * C * min(X, Y) + min(","+ (A if X > Y else B) * abs(X - Y), 2 * C * abs(X - Y)","+ )","+ else:","+ ans = A * X + B * Y"],"diff_only_import_comment":false,"measured_runtime_v0":0.4475863097,"measured_runtime_v1":0.2669118404,"runtime_lift":1.6769069102,"key":["s115897723","s652896869"]} +{"user_id":"u556589653","problem_id":"p03416","language":"python","submission_id_v0":"s253072561","submission_id_v1":"s839464643","cpu_time_v0":58,"cpu_time_v1":50,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n i = str(i)\n\n if i[0] == i[4]:\n\n if i[1] == i[3]:\n\n ans += 1\n\n else:\n\n ans += 0\n\n else:\n\n ans += 0\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n k = str(i)\n\n if k[0] == k[4] and k[1] == k[3]:\n\n ans += 1\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":7,"code_v0_num_chars":227,"code_v1_num_chars":148,"code_v0_no_empty_lines":"A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n i = str(i)\n if i[0] == i[4]:\n if i[1] == i[3]:\n ans += 1\n else:\n ans += 0\n else:\n ans += 0\nprint(ans)\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n k = str(i)\n if k[0] == k[4] and k[1] == k[3]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["- i = str(i)","- if i[0] == i[4]:","- if i[1] == i[3]:","- ans += 1","- else:","- ans += 0","- else:","- ans += 0","+ k = str(i)","+ if k[0] == k[4] and k[1] == k[3]:","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.1907642818,"measured_runtime_v1":0.0059664835,"runtime_lift":31.9726487264,"key":["s253072561","s839464643"]} +{"user_id":"u312025627","problem_id":"p03568","language":"python","submission_id_v0":"s088632051","submission_id_v1":"s935108099","cpu_time_v0":196,"cpu_time_v1":167,"memory_v0":41068,"memory_v1":38256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.8,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n N = int(input())\n\n A = [int(i) for i in input().split()]\n\n if N == 1:\n\n return print(1 if A[0] % 2 == 0 else 2)\n\n ans = 0\n\n d = (-1, 0, 1)\n\n from itertools import product\n\n for i in product(range(3), repeat=N):\n\n cur = 1\n\n for j in range(N):\n\n cur *= (A[j] + d[i[j]])\n\n if cur % 2 == 0:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n N = int(eval(input()))\n\n A = [int(i) for i in input().split()]\n\n ans = 3**N\n\n cnt = len([a for a in A if a % 2 == 0])\n\n ans -= 2**cnt\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":19,"code_v1_loc":11,"code_v0_num_chars":443,"code_v1_num_chars":217,"code_v0_no_empty_lines":"def main():\n N = int(input())\n A = [int(i) for i in input().split()]\n if N == 1:\n return print(1 if A[0] % 2 == 0 else 2)\n ans = 0\n d = (-1, 0, 1)\n from itertools import product\n\n for i in product(range(3), repeat=N):\n cur = 1\n for j in range(N):\n cur *= A[j] + d[i[j]]\n if cur % 2 == 0:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n A = [int(i) for i in input().split()]\n ans = 3**N\n cnt = len([a for a in A if a % 2 == 0])\n ans -= 2**cnt\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":42.1052631579,"diff":["- N = int(input())","+ N = int(eval(input()))","- if N == 1:","- return print(1 if A[0] % 2 == 0 else 2)","- ans = 0","- d = (-1, 0, 1)","- from itertools import product","-","- for i in product(range(3), repeat=N):","- cur = 1","- for j in range(N):","- cur *= A[j] + d[i[j]]","- if cur % 2 == 0:","- ans += 1","+ ans = 3**N","+ cnt = len([a for a in A if a % 2 == 0])","+ ans -= 2**cnt"],"diff_only_import_comment":false,"measured_runtime_v0":0.4432550566,"measured_runtime_v1":0.2109588499,"runtime_lift":2.1011446393,"key":["s088632051","s935108099"]} +{"user_id":"u893063840","problem_id":"p02982","language":"python","submission_id_v0":"s467181004","submission_id_v1":"s228678870","cpu_time_v0":173,"cpu_time_v1":20,"memory_v0":13416,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.44,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as\tnp\n\n\n\nn, d = list(map(int, input().split()))\n\nx = []\n\nfor i in range(n):\n\n x.append(list(map(int, input().split())))\n\n\n\nx = np.array(x)\n\n\n\ncount =\t0\n\nfor i in range(n):\n\n for j in range(i+1, n):\n\n dist = np.linalg.norm(x[i] - x[j])\n\n if dist == int(dist):\n\n count += 1\n\n\n\nprint(count)\n\n# optimized version of the same code:\n","target":"n, d = list(map(int, input().split()))\n\nx = [list(map(int, input().split())) for _ in range(n)]\n\n\n\n\n\ndef dist(a, b):\n\n sm = 0\n\n for ea, eb in zip(a, b):\n\n sm += (ea - eb) ** 2\n\n\n\n return sm ** 0.5\n\n\n\n\n\nans = 0\n\nfor i in range(n):\n\n for j in range(i + 1, n):\n\n dst = dist(x[i], x[j])\n\n for k in range(int(16000 ** 0.5) + 1):\n\n if k == dst:\n\n ans += 1\n\n break\n\n\n\nprint(ans)\n","code_v0_loc":17,"code_v1_loc":22,"code_v0_num_chars":325,"code_v1_num_chars":440,"code_v0_no_empty_lines":"import numpy as np\n\nn, d = list(map(int, input().split()))\nx = []\nfor i in range(n):\n x.append(list(map(int, input().split())))\nx = np.array(x)\ncount = 0\nfor i in range(n):\n for j in range(i + 1, n):\n dist = np.linalg.norm(x[i] - x[j])\n if dist == int(dist):\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"n, d = list(map(int, input().split()))\nx = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef dist(a, b):\n sm = 0\n for ea, eb in zip(a, b):\n sm += (ea - eb) ** 2\n return sm**0.5\n\n\nans = 0\nfor i in range(n):\n for j in range(i + 1, n):\n dst = dist(x[i], x[j])\n for k in range(int(16000**0.5) + 1):\n if k == dst:\n ans += 1\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":22.7272727273,"diff":["-import numpy as np","+n, d = list(map(int, input().split()))","+x = [list(map(int, input().split())) for _ in range(n)]","-n, d = list(map(int, input().split()))","-x = []","-for i in range(n):","- x.append(list(map(int, input().split())))","-x = np.array(x)","-count = 0","+","+def dist(a, b):","+ sm = 0","+ for ea, eb in zip(a, b):","+ sm += (ea - eb) ** 2","+ return sm**0.5","+","+","+ans = 0","- dist = np.linalg.norm(x[i] - x[j])","- if dist == int(dist):","- count += 1","-print(count)","+ dst = dist(x[i], x[j])","+ for k in range(int(16000**0.5) + 1):","+ if k == dst:","+ ans += 1","+ break","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.4700319977,"measured_runtime_v1":0.24048966,"runtime_lift":6.1126619642,"key":["s467181004","s228678870"]} +{"user_id":"u102461423","problem_id":"p03254","language":"python","submission_id_v0":"s442957356","submission_id_v1":"s444535945","cpu_time_v0":149,"cpu_time_v1":18,"memory_v0":14444,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.92,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN,x = list(map(int,input().split()))\n\nA = np.array(input().split(), dtype = np.int64)\n\nA.sort()\n\nnp.cumsum(A, out = A)\n\nanswer = (A <= x).sum()\n\n\n\nif answer == N and A[-1] != x:\n\n answer -= 1\n\nprint(answer)\n\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom bisect import bisect_right\n\nimport itertools\n\n\n\nN,X,*A = list(map(int,read().split()))\n\n\n\nA.sort()\n\nAcum = list(itertools.accumulate(A))\n\n\n\nanswer = bisect_right(Acum,X)\n\nif answer == N:\n\n if Acum[-1] < X:\n\n answer -= 1\n\nprint(answer)","code_v0_loc":10,"code_v1_loc":18,"code_v0_num_chars":222,"code_v1_num_chars":365,"code_v0_no_empty_lines":"import numpy as np\n\nN, x = list(map(int, input().split()))\nA = np.array(input().split(), dtype=np.int64)\nA.sort()\nnp.cumsum(A, out=A)\nanswer = (A <= x).sum()\nif answer == N and A[-1] != x:\n answer -= 1\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom bisect import bisect_right\nimport itertools\n\nN, X, *A = list(map(int, read().split()))\nA.sort()\nAcum = list(itertools.accumulate(A))\nanswer = bisect_right(Acum, X)\nif answer == N:\n if Acum[-1] < X:\n answer -= 1\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-import numpy as np","+import sys","-N, x = list(map(int, input().split()))","-A = np.array(input().split(), dtype=np.int64)","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+from bisect import bisect_right","+import itertools","+","+N, X, *A = list(map(int, read().split()))","-np.cumsum(A, out=A)","-answer = (A <= x).sum()","-if answer == N and A[-1] != x:","- answer -= 1","+Acum = list(itertools.accumulate(A))","+answer = bisect_right(Acum, X)","+if answer == N:","+ if Acum[-1] < X:","+ answer -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":1.3272022178,"measured_runtime_v1":0.2483567362,"runtime_lift":5.3439348502,"key":["s442957356","s444535945"]} +{"user_id":"u777923818","problem_id":"p03425","language":"python","submission_id_v0":"s258539301","submission_id_v1":"s541501179","cpu_time_v0":165,"cpu_time_v1":142,"memory_v0":3316,"memory_v1":9336,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.94,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\nfrom collections import defaultdict\n\nfrom itertools import combinations\n\nN = int(eval(input()))\n\nC = [0, 0, 0, 0, 0, 0]\n\nD = defaultdict(int)\n\nfor i, m in enumerate(\"MARCH\", start=1):\n\n D[m] = i\n\n\n\nfor _ in range(N):\n\n C[D[input()[0]]] += 1\n\n\n\nans = 0\n\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n\n ans += C[a]*C[b]*C[c]\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\nfrom itertools import combinations\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nC = defaultdict(int)\n\nN = int(eval(input()))\n\nfor _ in range(N):\n\n C[input()[0]] += 1\n\n\n\nres = 0\n\nfor H in combinations(\"MARCH\", r=3):\n\n res += C[H[0]] * C[H[1]] * C[H[2]]\n\nprint(res)","code_v0_loc":16,"code_v1_loc":13,"code_v0_num_chars":363,"code_v1_num_chars":310,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nfrom collections import defaultdict\nfrom itertools import combinations\n\nN = int(eval(input()))\nC = [0, 0, 0, 0, 0, 0]\nD = defaultdict(int)\nfor i, m in enumerate(\"MARCH\", start=1):\n D[m] = i\nfor _ in range(N):\n C[D[input()[0]]] += 1\nans = 0\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n ans += C[a] * C[b] * C[c]\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\nfrom itertools import combinations\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\nC = defaultdict(int)\nN = int(eval(input()))\nfor _ in range(N):\n C[input()[0]] += 1\nres = 0\nfor H in combinations(\"MARCH\", r=3):\n res += C[H[0]] * C[H[1]] * C[H[2]]\nprint(res)\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-# -*- coding: utf-8 -*-","+","+def inpl():","+ return list(map(int, input().split()))","+","+","+C = defaultdict(int)","-C = [0, 0, 0, 0, 0, 0]","-D = defaultdict(int)","-for i, m in enumerate(\"MARCH\", start=1):","- D[m] = i","- C[D[input()[0]]] += 1","-ans = 0","-for a, b, c in combinations(list(range(1, 6)), r=3):","- ans += C[a] * C[b] * C[c]","-print(ans)","+ C[input()[0]] += 1","+res = 0","+for H in combinations(\"MARCH\", r=3):","+ res += C[H[0]] * C[H[1]] * C[H[2]]","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.388673193,"measured_runtime_v1":0.2150466468,"runtime_lift":1.8073901578,"key":["s258539301","s541501179"]} +{"user_id":"u964904181","problem_id":"p03796","language":"python","submission_id_v0":"s459904551","submission_id_v1":"s685671735","cpu_time_v0":153,"cpu_time_v1":46,"memory_v0":9880,"memory_v1":9092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.93,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\nN = int(eval(input()))\n\n\n\nprint((math.factorial(N) % (1000000000 + 7)))\n\n\n# optimized version of the same code:\n","target":"import math\n\n\n\nN = int(eval(input()))\n\n\n\np = 1\n\nfor i in range(2, N+1):\n\n p *= i\n\n p = p % (1000000000 + 7)\n\n \n\nprint(p)\n","code_v0_loc":5,"code_v1_loc":10,"code_v0_num_chars":79,"code_v1_num_chars":118,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nprint((math.factorial(N) % (1000000000 + 7)))\n","code_v1_no_empty_lines":"import math\n\nN = int(eval(input()))\np = 1\nfor i in range(2, N + 1):\n p *= i\n p = p % (1000000000 + 7)\nprint(p)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-print((math.factorial(N) % (1000000000 + 7)))","+p = 1","+for i in range(2, N + 1):","+ p *= i","+ p = p % (1000000000 + 7)","+print(p)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5259809067,"measured_runtime_v1":0.2554857254,"runtime_lift":2.0587487065,"key":["s459904551","s685671735"]} +{"user_id":"u127499732","problem_id":"p03309","language":"python","submission_id_v0":"s031191514","submission_id_v1":"s488102802","cpu_time_v0":214,"cpu_time_v1":169,"memory_v0":27212,"memory_v1":25180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n from statistics import median\n\n\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n m = int(median(a))\n\n\n\n ans = sum([abs(x - m) for x in a])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n if n % 2 == 0:\n\n ans = sum(a[n \/\/ 2:]) - sum(a[:n \/\/ 2])\n\n else:\n\n ans = sum(a[n \/\/ 2 + 1:]) - sum(a[:n \/\/ 2])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":281,"code_v1_num_chars":311,"code_v0_no_empty_lines":"def main():\n from statistics import median\n\n (\n n,\n *a,\n ) = list(map(int, open(0).read().split()))\n a = [x - i for i, x in enumerate(a, 1)]\n a.sort()\n m = int(median(a))\n ans = sum([abs(x - m) for x in a])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n (\n n,\n *a,\n ) = list(map(int, open(0).read().split()))\n a = [x - i for i, x in enumerate(a, 1)]\n a.sort()\n if n % 2 == 0:\n ans = sum(a[n \/\/ 2 :]) - sum(a[: n \/\/ 2])\n else:\n ans = sum(a[n \/\/ 2 + 1 :]) - sum(a[: n \/\/ 2])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["- from statistics import median","-","- m = int(median(a))","- ans = sum([abs(x - m) for x in a])","+ if n % 2 == 0:","+ ans = sum(a[n \/\/ 2 :]) - sum(a[: n \/\/ 2])","+ else:","+ ans = sum(a[n \/\/ 2 + 1 :]) - sum(a[: n \/\/ 2])"],"diff_only_import_comment":false,"measured_runtime_v0":0.2784859991,"measured_runtime_v1":0.2092100859,"runtime_lift":1.3311308484,"key":["s031191514","s488102802"]} +{"user_id":"u578323547","problem_id":"p02690","language":"python","submission_id_v0":"s188140590","submission_id_v1":"s074739481","cpu_time_v0":1208,"cpu_time_v1":136,"memory_v0":9100,"memory_v1":9028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\n\n\nfor a in range(10**4):\n\n for b in range(10**4):\n\n if(a**5 + b**5 == x):\n\n print((a, -b))\n\n break\n\n elif(a**5 - b**5 == x):\n\n print((a, b))\n\n break\n\n else:\n\n continue\n\n break\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\n\n\nfor a in range(10**3):\n\n for b in range(10**3):\n\n if(a**5 + b**5 == x):\n\n print((a, -b))\n\n break\n\n elif(a**5 - b**5 == x):\n\n print((a, b))\n\n break\n\n else:\n\n continue\n\n break\n","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":263,"code_v1_num_chars":264,"code_v0_no_empty_lines":"x = int(eval(input()))\nfor a in range(10**4):\n for b in range(10**4):\n if a**5 + b**5 == x:\n print((a, -b))\n break\n elif a**5 - b**5 == x:\n print((a, b))\n break\n else:\n continue\n break\n","code_v1_no_empty_lines":"x = int(eval(input()))\nfor a in range(10**3):\n for b in range(10**3):\n if a**5 + b**5 == x:\n print((a, -b))\n break\n elif a**5 - b**5 == x:\n print((a, b))\n break\n else:\n continue\n break\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for a in range(10**4):","- for b in range(10**4):","+for a in range(10**3):","+ for b in range(10**3):"],"diff_only_import_comment":false,"measured_runtime_v0":0.4177670181,"measured_runtime_v1":0.3141400119,"runtime_lift":1.3298752221,"key":["s188140590","s074739481"]} +{"user_id":"u159994501","problem_id":"p03037","language":"python","submission_id_v0":"s060142514","submission_id_v1":"s502871070","cpu_time_v0":326,"cpu_time_v1":290,"memory_v0":10996,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.04,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, M = list(map(int, input().split()))\n\nL, R = [], []\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n\n\n# optimized version of the same code:\n","target":"N, M = list(map(int, input().split()))\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":283,"code_v1_num_chars":234,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nL, R = [], []\nlow = -float(\"INF\")\nhigh = float(\"INF\")\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\n if l > low:\n low = l\n if r < high:\n high = r\nprint((max(0, high - low + 1)))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nlow = -float(\"INF\")\nhigh = float(\"INF\")\nfor i in range(M):\n l, r = list(map(int, input().split()))\n if l > low:\n low = l\n if r < high:\n high = r\nprint((max(0, high - low + 1)))\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-L, R = [], []","- L.append(l)","- R.append(r)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2778050728,"measured_runtime_v1":0.0913613791,"runtime_lift":3.0407276614,"key":["s060142514","s502871070"]} +{"user_id":"u070201429","problem_id":"p03837","language":"python","submission_id_v0":"s719627889","submission_id_v1":"s550164411","cpu_time_v0":1368,"cpu_time_v1":267,"memory_v0":27336,"memory_v1":71572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n from sys import stdin\n\n def input():\n\n return stdin.readline().strip()\n\n\n\n n, m = list(map(int, input().split()))\n\n tree = [[] for _ in range(n)]\n\n for _ in range(m):\n\n i, j, k = list(map(int, input().split()))\n\n i -= 1\n\n j -= 1\n\n tree[i].append((k, j))\n\n tree[j].append((k, i))\n\n\n\n # dijkstra\n\n import heapq\n\n from numpy import zeros\n\n\n\n ans = 0\n\n for i in range(n):\n\n for j in tree[i]:\n\n seen = zeros(n)\n\n goal = j[1]\n\n base = j[0]\n\n seen[i] = 1\n\n todo = []\n\n heapq.heapify(todo)\n\n for k in tree[i]:\n\n if k[0] < base and k != j:\n\n heapq.heappush(todo, k)\n\n while len(todo) > 0:\n\n k = heapq.heappop(todo)\n\n if k[1] == goal:\n\n if k[0] < base:\n\n ans += 1\n\n break\n\n seen[k[1]] = 1\n\n for l in tree[k[1]]:\n\n if seen[l[1]] == 0 and k[0] + l[0] < base:\n\n heapq.heappush(todo, (k[0] + l[0], l[1]))\n\n\n\n print((ans \/\/ 2))\n\n\n\nmain()\n\n# optimized version of the same code:\n","target":"def main():\n\n from sys import stdin\n\n def input():\n\n return stdin.readline().strip()\n\n\n\n n, m = list(map(int, input().split()))\n\n tree = [[] for _ in range(n)]\n\n for _ in range(m):\n\n i, j, k = list(map(int, input().split()))\n\n i -= 1\n\n j -= 1\n\n tree[i].append((k, j))\n\n tree[j].append((k, i))\n\n\n\n # dijkstra\n\n import heapq\n\n\n\n ans = 0\n\n for i in range(n):\n\n for j in tree[i]:\n\n seen = [0] * n\n\n goal = j[1]\n\n base = j[0]\n\n seen[i] = 1\n\n todo = []\n\n heapq.heapify(todo)\n\n for k in tree[i]:\n\n if k[0] < base and k != j:\n\n heapq.heappush(todo, k)\n\n while len(todo) > 0:\n\n k = heapq.heappop(todo)\n\n if k[1] == goal:\n\n if k[0] < base:\n\n ans += 1\n\n break\n\n seen[k[1]] = 1\n\n for l in tree[k[1]]:\n\n if seen[l[1]] == 0 and k[0] + l[0] < base:\n\n heapq.heappush(todo, (k[0] + l[0], l[1]))\n\n\n\n print((ans \/\/ 2))\n\n\n\nmain()","code_v0_loc":44,"code_v1_loc":43,"code_v0_num_chars":1189,"code_v1_num_chars":1159,"code_v0_no_empty_lines":"def main():\n from sys import stdin\n\n def input():\n return stdin.readline().strip()\n\n n, m = list(map(int, input().split()))\n tree = [[] for _ in range(n)]\n for _ in range(m):\n i, j, k = list(map(int, input().split()))\n i -= 1\n j -= 1\n tree[i].append((k, j))\n tree[j].append((k, i))\n # dijkstra\n import heapq\n from numpy import zeros\n\n ans = 0\n for i in range(n):\n for j in tree[i]:\n seen = zeros(n)\n goal = j[1]\n base = j[0]\n seen[i] = 1\n todo = []\n heapq.heapify(todo)\n for k in tree[i]:\n if k[0] < base and k != j:\n heapq.heappush(todo, k)\n while len(todo) > 0:\n k = heapq.heappop(todo)\n if k[1] == goal:\n if k[0] < base:\n ans += 1\n break\n seen[k[1]] = 1\n for l in tree[k[1]]:\n if seen[l[1]] == 0 and k[0] + l[0] < base:\n heapq.heappush(todo, (k[0] + l[0], l[1]))\n print((ans \/\/ 2))\n\n\nmain()\n","code_v1_no_empty_lines":"def main():\n from sys import stdin\n\n def input():\n return stdin.readline().strip()\n\n n, m = list(map(int, input().split()))\n tree = [[] for _ in range(n)]\n for _ in range(m):\n i, j, k = list(map(int, input().split()))\n i -= 1\n j -= 1\n tree[i].append((k, j))\n tree[j].append((k, i))\n # dijkstra\n import heapq\n\n ans = 0\n for i in range(n):\n for j in tree[i]:\n seen = [0] * n\n goal = j[1]\n base = j[0]\n seen[i] = 1\n todo = []\n heapq.heapify(todo)\n for k in tree[i]:\n if k[0] < base and k != j:\n heapq.heappush(todo, k)\n while len(todo) > 0:\n k = heapq.heappop(todo)\n if k[1] == goal:\n if k[0] < base:\n ans += 1\n break\n seen[k[1]] = 1\n for l in tree[k[1]]:\n if seen[l[1]] == 0 and k[0] + l[0] < base:\n heapq.heappush(todo, (k[0] + l[0], l[1]))\n print((ans \/\/ 2))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":2.2727272727,"diff":["- from numpy import zeros","- seen = zeros(n)","+ seen = [0] * n"],"diff_only_import_comment":false,"measured_runtime_v0":2.1406116307,"measured_runtime_v1":0.1031825858,"runtime_lift":20.7458614645,"key":["s719627889","s550164411"]} +{"user_id":"u707498674","problem_id":"p03197","language":"python","submission_id_v0":"s897143120","submission_id_v1":"s183884077","cpu_time_v0":161,"cpu_time_v1":94,"memory_v0":14548,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n \n\ndef main():\n\n stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=' ')\n\n A = stdin[1:]\n\n A = np.mod(A, 2)\n\n print(\"first\") if np.count_nonzero(A) else print(\"second\")\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\ndef input(): return sys.stdin.readline().strip()\n\ndef main():\n\n N = int(input())\n\n A = (int(input()) for _ in range(N))\n\n print(\"second\") if all(( a%2==0 for a in A)) else print(\"first\")\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":248,"code_v1_num_chars":247,"code_v0_no_empty_lines":"import numpy as np\n\n\ndef main():\n stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=\" \")\n A = stdin[1:]\n A = np.mod(A, 2)\n print(\"first\") if np.count_nonzero(A) else print(\"second\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n N = int(input())\n A = (int(input()) for _ in range(N))\n print(\"second\") if all((a % 2 == 0 for a in A)) else print(\"first\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-import numpy as np","+import sys","+","+","+def input():","+ return sys.stdin.readline().strip()","- stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=\" \")","- A = stdin[1:]","- A = np.mod(A, 2)","- print(\"first\") if np.count_nonzero(A) else print(\"second\")","+ N = int(input())","+ A = (int(input()) for _ in range(N))","+ print(\"second\") if all((a % 2 == 0 for a in A)) else print(\"first\")"],"diff_only_import_comment":false,"measured_runtime_v0":1.294229298,"measured_runtime_v1":0.3298476092,"runtime_lift":3.9237188987,"key":["s897143120","s183884077"]} +{"user_id":"u729133443","problem_id":"p02555","language":"python","submission_id_v0":"s039277419","submission_id_v1":"s210669705","cpu_time_v0":66,"cpu_time_v1":51,"memory_v0":29052,"memory_v1":22328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c=1,0,0\n\nexec('a,b,c=b,c,(a+c)%(10**9+7);'*(int(eval(input()))-2))\n\nprint(c)\n\n# optimized version of the same code:\n","target":"a,b,c=1,0,0\n\nexec('a,b,c=b,c,a+c;'*(int(eval(input()))-2))\n\nprint((c%(10**9+7)))","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":74,"code_v1_num_chars":72,"code_v0_no_empty_lines":"a, b, c = 1, 0, 0\nexec(\"a,b,c=b,c,(a+c)%(10**9+7);\" * (int(eval(input())) - 2))\nprint(c)\n","code_v1_no_empty_lines":"a, b, c = 1, 0, 0\nexec(\"a,b,c=b,c,a+c;\" * (int(eval(input())) - 2))\nprint((c % (10**9 + 7)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-exec(\"a,b,c=b,c,(a+c)%(10**9+7);\" * (int(eval(input())) - 2))","-print(c)","+exec(\"a,b,c=b,c,a+c;\" * (int(eval(input())) - 2))","+print((c % (10**9 + 7)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4045331192,"measured_runtime_v1":0.1489405618,"runtime_lift":2.7160708565,"key":["s039277419","s210669705"]} +{"user_id":"u416011173","problem_id":"p02615","language":"python","submission_id_v0":"s077290395","submission_id_v1":"s490562127","cpu_time_v0":209,"cpu_time_v1":168,"memory_v0":49528,"memory_v1":32840,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n# \u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\n\nimport math\n\nimport numpy as np\n\n\n\n# \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\n# \u6c42\u89e3\u51e6\u7406\n\nA = sorted(A, reverse=True)\n\nA = np.array(A)\n\nans = 2 * np.sum(A[:(N \/\/ 2)]) - A[0] + (N % 2) * A[math.floor(N \/ 2)]\n\n\n\n# \u7d50\u679c\u51fa\u529b\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n# \u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\n\nimport math\n\n\n\n# \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\n# \u6c42\u89e3\u51e6\u7406\n\nA = sorted(A, reverse=True)\n\nans = 0\n\nfor n in range(1, N + 1):\n\n if n == 1:\n\n continue\n\n ans += A[math.ceil(n \/ 2) - 1]\n\n\n\n# \u7d50\u679c\u51fa\u529b\n\nprint(ans)\n","code_v0_loc":16,"code_v1_loc":18,"code_v0_num_chars":290,"code_v1_num_chars":287,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n# \u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\nimport math\nimport numpy as np\n\n# \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\nN = int(eval(input()))\nA = list(map(int, input().split()))\n# \u6c42\u89e3\u51e6\u7406\nA = sorted(A, reverse=True)\nA = np.array(A)\nans = 2 * np.sum(A[: (N \/\/ 2)]) - A[0] + (N % 2) * A[math.floor(N \/ 2)]\n# \u7d50\u679c\u51fa\u529b\nprint(ans)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n# \u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\nimport math\n\n# \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\nN = int(eval(input()))\nA = list(map(int, input().split()))\n# \u6c42\u89e3\u51e6\u7406\nA = sorted(A, reverse=True)\nans = 0\nfor n in range(1, N + 1):\n if n == 1:\n continue\n ans += A[math.ceil(n \/ 2) - 1]\n# \u7d50\u679c\u51fa\u529b\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-import numpy as np","-A = np.array(A)","-ans = 2 * np.sum(A[: (N \/\/ 2)]) - A[0] + (N % 2) * A[math.floor(N \/ 2)]","+ans = 0","+for n in range(1, N + 1):","+ if n == 1:","+ continue","+ ans += A[math.ceil(n \/ 2) - 1]"],"diff_only_import_comment":false,"measured_runtime_v0":1.7039060501,"measured_runtime_v1":0.2517175666,"runtime_lift":6.7691185533,"key":["s077290395","s490562127"]} +{"user_id":"u768896740","problem_id":"p03371","language":"python","submission_id_v0":"s303630482","submission_id_v1":"s785488691","cpu_time_v0":197,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.37,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c, x, y = list(map(int, input().split()))\n\n\n\nz = max(x,y) * 2\n\nmin_sum = c * z\n\n\n\nfor i in range(z):\n\n r = max(0, y - i) * b\n\n t = max(0, x - i) * a\n\n sum = c * i * 2 + r + t\n\n if sum < min_sum:\n\n min_sum = sum\n\n\n\nprint(min_sum)\n\n# optimized version of the same code:\n","target":"a,b,c,x,y = list(map(int, input().split()))\n\n\n\nplan_a = c * (2*x) + max(0, y-x) * b\n\nplan_b = c * (2*y) + max(0, x-y) * a\n\nplan_c = a * x + b * y\n\n\n\nprint((min(plan_a, plan_b, plan_c)))","code_v0_loc":13,"code_v1_loc":7,"code_v0_num_chars":247,"code_v1_num_chars":177,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nz = max(x, y) * 2\nmin_sum = c * z\nfor i in range(z):\n r = max(0, y - i) * b\n t = max(0, x - i) * a\n sum = c * i * 2 + r + t\n if sum < min_sum:\n min_sum = sum\nprint(min_sum)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nplan_a = c * (2 * x) + max(0, y - x) * b\nplan_b = c * (2 * y) + max(0, x - y) * a\nplan_c = a * x + b * y\nprint((min(plan_a, plan_b, plan_c)))\n","code_same":false,"relative_loc_diff_percent":46.1538461538,"diff":["-z = max(x, y) * 2","-min_sum = c * z","-for i in range(z):","- r = max(0, y - i) * b","- t = max(0, x - i) * a","- sum = c * i * 2 + r + t","- if sum < min_sum:","- min_sum = sum","-print(min_sum)","+plan_a = c * (2 * x) + max(0, y - x) * b","+plan_b = c * (2 * y) + max(0, x - y) * a","+plan_c = a * x + b * y","+print((min(plan_a, plan_b, plan_c)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.7115524154,"measured_runtime_v1":0.3421670091,"runtime_lift":2.0795471112,"key":["s303630482","s785488691"]} +{"user_id":"u488127128","problem_id":"p03796","language":"python","submission_id_v0":"s349010345","submission_id_v1":"s174569561","cpu_time_v0":35,"cpu_time_v1":29,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.14,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)\n\n# optimized version of the same code:\n","target":"def factorial(N):\n\n a = 1\n\n for n in range(2,N+1):\n\n a = a*n % (10**9 + 7)\n\n return a\n\n\n\nif __name__ == '__main__':\n\n N = int(eval(input()))\n\n print((factorial(N)))","code_v0_loc":5,"code_v1_loc":9,"code_v0_num_chars":82,"code_v1_num_chars":178,"code_v0_no_empty_lines":"N = int(eval(input()))\na = 1\nfor n in range(2, N + 1):\n a = a * n % (10**9 + 7)\nprint(a)\n","code_v1_no_empty_lines":"def factorial(N):\n a = 1\n for n in range(2, N + 1):\n a = a * n % (10**9 + 7)\n return a\n\n\nif __name__ == \"__main__\":\n N = int(eval(input()))\n print((factorial(N)))\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-N = int(eval(input()))","-a = 1","-for n in range(2, N + 1):","- a = a * n % (10**9 + 7)","-print(a)","+def factorial(N):","+ a = 1","+ for n in range(2, N + 1):","+ a = a * n % (10**9 + 7)","+ return a","+","+","+if __name__ == \"__main__\":","+ N = int(eval(input()))","+ print((factorial(N)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3416386657,"measured_runtime_v1":0.2695478878,"runtime_lift":1.2674507244,"key":["s349010345","s174569561"]} +{"user_id":"u047102107","problem_id":"p03371","language":"python","submission_id_v0":"s941907428","submission_id_v1":"s244206976","cpu_time_v0":181,"cpu_time_v1":162,"memory_v0":39920,"memory_v1":38384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\n\nA, B, C, X, Y = list(map(int, input().split()))\n\n\n\ncost = int(1e10)\n\nfor num_ac in range(0, int(1e5) + 1):\n\n num_A = max(0, X - num_ac)\n\n num_B = max(0, Y - num_ac)\n\n c = 2 * C * num_ac + A * num_A + B * num_B\n\n cost = min(c, cost)\n\nprint(cost)\n\n# optimized version of the same code:\n","target":"A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 0\n\nif A + B > 2 * C:\n\n z = min(X, Y)\n\n X -= z\n\n Y -= z\n\n ans += 2 * z * C\n\n\n\n# \u504f\u308a\u5206\n\nif 2 * C < A:\n\n k = X\n\n X -= k\n\n Y -= k\n\n ans += 2 * C * k\n\nif 2 * C < B:\n\n k = Y\n\n X -= k\n\n Y -= k\n\n ans += 2 * C * k\n\n\n\n# \u3042\u307e\u308a\u5206\n\nans += A * max(0, X) + B * max(0, Y)\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":24,"code_v0_num_chars":283,"code_v1_num_chars":355,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nA, B, C, X, Y = list(map(int, input().split()))\ncost = int(1e10)\nfor num_ac in range(0, int(1e5) + 1):\n num_A = max(0, X - num_ac)\n num_B = max(0, Y - num_ac)\n c = 2 * C * num_ac + A * num_A + B * num_B\n cost = min(c, cost)\nprint(cost)\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nans = 0\nif A + B > 2 * C:\n z = min(X, Y)\n X -= z\n Y -= z\n ans += 2 * z * C\n# \u504f\u308a\u5206\nif 2 * C < A:\n k = X\n X -= k\n Y -= k\n ans += 2 * C * k\nif 2 * C < B:\n k = Y\n X -= k\n Y -= k\n ans += 2 * C * k\n# \u3042\u307e\u308a\u5206\nans += A * max(0, X) + B * max(0, Y)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":54.1666666667,"diff":["-# -*- coding: utf-8 -*-","-cost = int(1e10)","-for num_ac in range(0, int(1e5) + 1):","- num_A = max(0, X - num_ac)","- num_B = max(0, Y - num_ac)","- c = 2 * C * num_ac + A * num_A + B * num_B","- cost = min(c, cost)","-print(cost)","+ans = 0","+if A + B > 2 * C:","+ z = min(X, Y)","+ X -= z","+ Y -= z","+ ans += 2 * z * C","+# \u504f\u308a\u5206","+if 2 * C < A:","+ k = X","+ X -= k","+ Y -= k","+ ans += 2 * C * k","+if 2 * C < B:","+ k = Y","+ X -= k","+ Y -= k","+ ans += 2 * C * k","+# \u3042\u307e\u308a\u5206","+ans += A * max(0, X) + B * max(0, Y)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4463407636,"measured_runtime_v1":0.1532134106,"runtime_lift":2.9131964477,"key":["s941907428","s244206976"]} +{"user_id":"u102461423","problem_id":"p03170","language":"python","submission_id_v0":"s503646377","submission_id_v1":"s803807514","cpu_time_v0":1298,"cpu_time_v1":123,"memory_v0":3684,"memory_v1":3828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom operator import xor\n\nfrom functools import reduce\n\n\n\nN,K,*A = list(map(int,read().split()))\n\n\n\na = reduce(xor,(1<K:\n\n break\n\n dp[n+a]=1\n\n\n\nanswer = 'First' if dp[-1] else 'Second'\n\nprint(answer)","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":396,"code_v1_num_chars":369,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom operator import xor\nfrom functools import reduce\n\nN, K, *A = list(map(int, read().split()))\na = reduce(xor, (1 << a for a in A))\ndp = 0 # bitset\nfor n in range(K):\n if not (dp & (1 << n)):\n dp |= a << n\nanswer = \"First\" if dp & (1 << K) else \"Second\"\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN, K, *A = list(map(int, read().split()))\ndp = [0] * (K + 1) # bitset\nfor n in range(K):\n if not dp[n]:\n for a in A:\n if n + a > K:\n break\n dp[n + a] = 1\nanswer = \"First\" if dp[-1] else \"Second\"\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-from operator import xor","-from functools import reduce","-","-a = reduce(xor, (1 << a for a in A))","-dp = 0 # bitset","+dp = [0] * (K + 1) # bitset","- if not (dp & (1 << n)):","- dp |= a << n","-answer = \"First\" if dp & (1 << K) else \"Second\"","+ if not dp[n]:","+ for a in A:","+ if n + a > K:","+ break","+ dp[n + a] = 1","+answer = \"First\" if dp[-1] else \"Second\""],"diff_only_import_comment":false,"measured_runtime_v0":0.510753959,"measured_runtime_v1":0.2748723721,"runtime_lift":1.8581494935,"key":["s503646377","s803807514"]} +{"user_id":"u186206732","problem_id":"p03060","language":"python","submission_id_v0":"s984369136","submission_id_v1":"s748536221","cpu_time_v0":260,"cpu_time_v1":18,"memory_v0":17204,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn = int(eval(input()))\n\n\n\nv_list = np.array(list(map(int,input().split())))\n\nc_list = np.array(list(map(int,input().split())))\n\ne_list = list(v_list - c_list)\n\n\n\nans = 0\n\n\n\nfor i in range(n):\n\n if e_list[i] > 0:\n\n ans += e_list[i]\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\n\n\nv_list = list(map(int,input().split()))\n\nc_list = list(map(int,input().split()))\n\n\n\ne_list = [v-c if (v-c > 0) else 0 for v,c in zip(v_list, c_list)]\n\n\n\nprint((sum(e_list)))\n","code_v0_loc":15,"code_v1_loc":8,"code_v0_num_chars":271,"code_v1_num_chars":192,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nv_list = np.array(list(map(int, input().split())))\nc_list = np.array(list(map(int, input().split())))\ne_list = list(v_list - c_list)\nans = 0\nfor i in range(n):\n if e_list[i] > 0:\n ans += e_list[i]\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nv_list = list(map(int, input().split()))\nc_list = list(map(int, input().split()))\ne_list = [v - c if (v - c > 0) else 0 for v, c in zip(v_list, c_list)]\nprint((sum(e_list)))\n","code_same":false,"relative_loc_diff_percent":46.6666666667,"diff":["-import numpy as np","-","-v_list = np.array(list(map(int, input().split())))","-c_list = np.array(list(map(int, input().split())))","-e_list = list(v_list - c_list)","-ans = 0","-for i in range(n):","- if e_list[i] > 0:","- ans += e_list[i]","-print(ans)","+v_list = list(map(int, input().split()))","+c_list = list(map(int, input().split()))","+e_list = [v - c if (v - c > 0) else 0 for v, c in zip(v_list, c_list)]","+print((sum(e_list)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.8478024924,"measured_runtime_v1":0.3072949107,"runtime_lift":6.0131242925,"key":["s984369136","s748536221"]} +{"user_id":"u102960641","problem_id":"p02624","language":"python","submission_id_v0":"s523843051","submission_id_v1":"s066295883","cpu_time_v0":36,"cpu_time_v1":31,"memory_v0":9312,"memory_v1":9436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.89,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nans = 0\n\nSQRT = int(n ** 0.5)\n\nfor m in range(1,SQRT + 1):\n\n b = int(n\/m)\n\n ans += m * (m + b) * (b + 1 - m)\n\nans -= SQRT * (SQRT+1) * (2*SQRT+1) \/\/ 6\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"def main():\n\n n = int(eval(input()))\n\n ans = 0\n\n SQRT = int(n ** 0.5)\n\n for m in range(1,SQRT + 1):\n\n b = int(n\/m)\n\n ans += m * (m + b) * (b + 1 - m)\n\n ans -= SQRT * (SQRT+1) * (2*SQRT+1) \/\/ 6\n\n print(ans)\n\nmain()\n","code_v0_loc":8,"code_v1_loc":10,"code_v0_num_chars":186,"code_v1_num_chars":220,"code_v0_no_empty_lines":"n = int(eval(input()))\nans = 0\nSQRT = int(n**0.5)\nfor m in range(1, SQRT + 1):\n b = int(n \/ m)\n ans += m * (m + b) * (b + 1 - m)\nans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) \/\/ 6\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n ans = 0\n SQRT = int(n**0.5)\n for m in range(1, SQRT + 1):\n b = int(n \/ m)\n ans += m * (m + b) * (b + 1 - m)\n ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) \/\/ 6\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-n = int(eval(input()))","-ans = 0","-SQRT = int(n**0.5)","-for m in range(1, SQRT + 1):","- b = int(n \/ m)","- ans += m * (m + b) * (b + 1 - m)","-ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) \/\/ 6","-print(ans)","+def main():","+ n = int(eval(input()))","+ ans = 0","+ SQRT = int(n**0.5)","+ for m in range(1, SQRT + 1):","+ b = int(n \/ m)","+ ans += m * (m + b) * (b + 1 - m)","+ ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) \/\/ 6","+ print(ans)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3880330081,"measured_runtime_v1":0.212660579,"runtime_lift":1.8246588529,"key":["s523843051","s066295883"]} +{"user_id":"u263830634","problem_id":"p03173","language":"python","submission_id_v0":"s585052356","submission_id_v1":"s189629023","cpu_time_v0":1975,"cpu_time_v1":405,"memory_v0":15668,"memory_v1":42732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.49,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nA = [0] + list(map(int, input().split()))\n\n\n\nA = np.array(A, dtype = np.int64)\n\nA = np.cumsum(A)\n\n\n\ndp = np.zeros((N, N), dtype = np.int64)\n\n\n\nfor j in range(1, N):\n\n for i in range(N - j):\n\n # print (dp[i, i:i + j], dp[i + 1:i + j + 1, i + j])\n\n tmp = min(dp[i, i:i + j] + dp[i + 1:i + j + 1, i + j])\n\n dp[i][i + j] = tmp + A[i + j + 1] - A[i]\n\n\n\nprint((dp[0][N - 1]))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = [0] + list(map(int, input().split()))\n\n\n\nINF = 10 ** 18\n\n\n\ndp = [[0] * (N) for _ in range(N)]\n\n\n\nfor i in range(N):\n\n A[i + 1] += A[i]\n\n\n\nfor j in range(1, N):\n\n for i in range(N - j):\n\n tmp = INF\n\n for k in range(i, i + j):\n\n # print (i, i + j, k + 1)\n\n tmp = min(tmp, dp[i][k] + dp[k + 1][i + j])\n\n dp[i][i + j] = tmp + A[i + j + 1] - A[i]\n\n\n\nprint((dp[0][N - 1]))\n","code_v0_loc":17,"code_v1_loc":19,"code_v0_num_chars":432,"code_v1_num_chars":437,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = [0] + list(map(int, input().split()))\nA = np.array(A, dtype=np.int64)\nA = np.cumsum(A)\ndp = np.zeros((N, N), dtype=np.int64)\nfor j in range(1, N):\n for i in range(N - j):\n # print (dp[i, i:i + j], dp[i + 1:i + j + 1, i + j])\n tmp = min(dp[i, i : i + j] + dp[i + 1 : i + j + 1, i + j])\n dp[i][i + j] = tmp + A[i + j + 1] - A[i]\nprint((dp[0][N - 1]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [0] + list(map(int, input().split()))\nINF = 10**18\ndp = [[0] * (N) for _ in range(N)]\nfor i in range(N):\n A[i + 1] += A[i]\nfor j in range(1, N):\n for i in range(N - j):\n tmp = INF\n for k in range(i, i + j):\n # print (i, i + j, k + 1)\n tmp = min(tmp, dp[i][k] + dp[k + 1][i + j])\n dp[i][i + j] = tmp + A[i + j + 1] - A[i]\nprint((dp[0][N - 1]))\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-import numpy as np","-","-A = np.array(A, dtype=np.int64)","-A = np.cumsum(A)","-dp = np.zeros((N, N), dtype=np.int64)","+INF = 10**18","+dp = [[0] * (N) for _ in range(N)]","+for i in range(N):","+ A[i + 1] += A[i]","- # print (dp[i, i:i + j], dp[i + 1:i + j + 1, i + j])","- tmp = min(dp[i, i : i + j] + dp[i + 1 : i + j + 1, i + j])","+ tmp = INF","+ for k in range(i, i + j):","+ # print (i, i + j, k + 1)","+ tmp = min(tmp, dp[i][k] + dp[k + 1][i + j])"],"diff_only_import_comment":false,"measured_runtime_v0":1.3938372128,"measured_runtime_v1":0.1987130241,"runtime_lift":7.0143223816,"key":["s585052356","s189629023"]} +{"user_id":"u513081876","problem_id":"p03828","language":"python","submission_id_v0":"s988350400","submission_id_v1":"s443952708","cpu_time_v0":39,"cpu_time_v1":35,"memory_v0":3316,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.26,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nimport collections\n\n\n\nN = int(eval(input()))\n\na = math.factorial(N)\n\ncheck = []\n\nans = 1\n\ni = 2\n\n\n\nwhile a != 1:\n\n if a % i == 0:\n\n a \/\/= i\n\n check.append(i)\n\n else:\n\n i += 1\n\n \n\ncheck = list(collections.Counter(check).values())\n\nfor i in check:\n\n ans *= (i+1)\n\n ans %= 10**9+7\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"from math import factorial\n\n\n\nN = factorial(int(eval(input())))\n\n\n\ni = 2\n\ncheck = 1\n\nans = 1\n\nwhile N != 1:\n\n if N % i == 0:\n\n N \/\/= i\n\n check += 1\n\n else:\n\n ans *= check\n\n check = 1\n\n i += 1\n\nprint(((ans*check)%(10**9+7)))","code_v0_loc":21,"code_v1_loc":16,"code_v0_num_chars":330,"code_v1_num_chars":256,"code_v0_no_empty_lines":"import math\nimport collections\n\nN = int(eval(input()))\na = math.factorial(N)\ncheck = []\nans = 1\ni = 2\nwhile a != 1:\n if a % i == 0:\n a \/\/= i\n check.append(i)\n else:\n i += 1\ncheck = list(collections.Counter(check).values())\nfor i in check:\n ans *= i + 1\n ans %= 10**9 + 7\nprint(ans)\n","code_v1_no_empty_lines":"from math import factorial\n\nN = factorial(int(eval(input())))\ni = 2\ncheck = 1\nans = 1\nwhile N != 1:\n if N % i == 0:\n N \/\/= i\n check += 1\n else:\n ans *= check\n check = 1\n i += 1\nprint(((ans * check) % (10**9 + 7)))\n","code_same":false,"relative_loc_diff_percent":23.8095238095,"diff":["-import math","-import collections","+from math import factorial","-N = int(eval(input()))","-a = math.factorial(N)","-check = []","+N = factorial(int(eval(input())))","+i = 2","+check = 1","-i = 2","-while a != 1:","- if a % i == 0:","- a \/\/= i","- check.append(i)","+while N != 1:","+ if N % i == 0:","+ N \/\/= i","+ check += 1","+ ans *= check","+ check = 1","-check = list(collections.Counter(check).values())","-for i in check:","- ans *= i + 1","- ans %= 10**9 + 7","-print(ans)","+print(((ans * check) % (10**9 + 7)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1990540142,"measured_runtime_v1":0.0063210642,"runtime_lift":31.4905855295,"key":["s988350400","s443952708"]} +{"user_id":"u600402037","problem_id":"p02988","language":"python","submission_id_v0":"s600247338","submission_id_v1":"s499312131","cpu_time_v0":150,"cpu_time_v1":18,"memory_v0":12500,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN = ir()\n\nP = np.array(lr())\n\n\n\nP_diff = np.diff(P)\n\nP_diff = P_diff > 0\n\nseries = P_diff[:-1] == P_diff[1:]\n\nanswer = series.sum()\n\nprint(answer)\n\n# 23\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nP = list(map(int, input().split()))\n\nanswer = sum(x>y>z or x 0\nseries = P_diff[:-1] == P_diff[1:]\nanswer = series.sum()\nprint(answer)\n# 23\n","code_v1_no_empty_lines":"N = int(eval(input()))\nP = list(map(int, input().split()))\nanswer = sum(x > y > z or x < y < z for x, y, z in zip(P[:-2], P[1:-1], P[2:]))\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":68.75,"diff":["-import sys","-import numpy as np","-","-sr = lambda: sys.stdin.readline().rstrip()","-ir = lambda: int(sr())","-lr = lambda: list(map(int, sr().split()))","-N = ir()","-P = np.array(lr())","-P_diff = np.diff(P)","-P_diff = P_diff > 0","-series = P_diff[:-1] == P_diff[1:]","-answer = series.sum()","+N = int(eval(input()))","+P = list(map(int, input().split()))","+answer = sum(x > y > z or x < y < z for x, y, z in zip(P[:-2], P[1:-1], P[2:]))","-# 23"],"diff_only_import_comment":false,"measured_runtime_v0":1.3571075095,"measured_runtime_v1":0.1919195701,"runtime_lift":7.071230456,"key":["s600247338","s499312131"]} +{"user_id":"u369133448","problem_id":"p02982","language":"python","submission_id_v0":"s601267167","submission_id_v1":"s993032779","cpu_time_v0":855,"cpu_time_v1":17,"memory_v0":21024,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":98.01,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn,d=list(map(int,input().split()))\n\nnda=np.empty((0,d),int)\n\nans=0\n\nfor i in range(0,n):\n\n a=np.array([list(map(int,input().split()))])\n\n for j in range(i):\n\n chklen=np.linalg.norm(a-nda[j])\n\n if chklen==chklen\/\/1:\n\n ans+=1\n\n nda=np.append(nda,a,axis=0)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import math\n\nn,d=list(map(int,input().split()))\n\na=[0]*n\n\nfor i in range(n):\n\n a[i]=list(map(int,input().split()))\n\nans=0\n\nfor i in range(n-1):\n\n for j in range(i+1,n):\n\n chklen=0\n\n wk=0\n\n for k in range(d):\n\n wk+=abs(a[i][k]-a[j][k])**2\n\n chklen=math.sqrt(wk)\n\n if chklen==chklen\/\/1:\n\n ans+=1\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":16,"code_v0_num_chars":293,"code_v1_num_chars":326,"code_v0_no_empty_lines":"import numpy as np\n\nn, d = list(map(int, input().split()))\nnda = np.empty((0, d), int)\nans = 0\nfor i in range(0, n):\n a = np.array([list(map(int, input().split()))])\n for j in range(i):\n chklen = np.linalg.norm(a - nda[j])\n if chklen == chklen \/\/ 1:\n ans += 1\n nda = np.append(nda, a, axis=0)\nprint(ans)\n","code_v1_no_empty_lines":"import math\n\nn, d = list(map(int, input().split()))\na = [0] * n\nfor i in range(n):\n a[i] = list(map(int, input().split()))\nans = 0\nfor i in range(n - 1):\n for j in range(i + 1, n):\n chklen = 0\n wk = 0\n for k in range(d):\n wk += abs(a[i][k] - a[j][k]) ** 2\n chklen = math.sqrt(wk)\n if chklen == chklen \/\/ 1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import numpy as np","+import math","-nda = np.empty((0, d), int)","+a = [0] * n","+for i in range(n):","+ a[i] = list(map(int, input().split()))","-for i in range(0, n):","- a = np.array([list(map(int, input().split()))])","- for j in range(i):","- chklen = np.linalg.norm(a - nda[j])","+for i in range(n - 1):","+ for j in range(i + 1, n):","+ chklen = 0","+ wk = 0","+ for k in range(d):","+ wk += abs(a[i][k] - a[j][k]) ** 2","+ chklen = math.sqrt(wk)","- nda = np.append(nda, a, axis=0)"],"diff_only_import_comment":false,"measured_runtime_v0":1.8428332808,"measured_runtime_v1":0.3216582146,"runtime_lift":5.7291659198,"key":["s601267167","s993032779"]} +{"user_id":"u693694535","problem_id":"p03371","language":"python","submission_id_v0":"s328045307","submission_id_v1":"s953197610","cpu_time_v0":105,"cpu_time_v1":26,"memory_v0":9176,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.24,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA,B,C,X,Y=list(map(int,input().split()))\n\n\n\nK=10**9\n\nfor i in range(10**5+1):\n\n S=i*2*C+max(0,X-i)*A+max(0,Y-i)*B\n\n K=min(K,S)\n\nprint(K)\n\n# optimized version of the same code:\n","target":"A,B,C,X,Y=list(map(int,input().split()))\n\n\n\na=min(X,Y)*min(A+B,2*C)\n\n\n\na+=max(0,X-Y)*min(A,2*C)\n\na+=max(0,Y-X)*min(B,2*C)\n\n\n\n\n\nprint(a)","code_v0_loc":7,"code_v1_loc":9,"code_v0_num_chars":136,"code_v1_num_chars":129,"code_v0_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nK = 10**9\nfor i in range(10**5 + 1):\n S = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n K = min(K, S)\nprint(K)\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\na = min(X, Y) * min(A + B, 2 * C)\na += max(0, X - Y) * min(A, 2 * C)\na += max(0, Y - X) * min(B, 2 * C)\nprint(a)\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-K = 10**9","-for i in range(10**5 + 1):","- S = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B","- K = min(K, S)","-print(K)","+a = min(X, Y) * min(A + B, 2 * C)","+a += max(0, X - Y) * min(A, 2 * C)","+a += max(0, Y - X) * min(B, 2 * C)","+print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3979784026,"measured_runtime_v1":0.2418090019,"runtime_lift":5.7813331656,"key":["s328045307","s953197610"]} +{"user_id":"u600402037","problem_id":"p03032","language":"python","submission_id_v0":"s390254937","submission_id_v1":"s816896537","cpu_time_v0":285,"cpu_time_v1":192,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.63,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, K = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\nanswer = 0\n\nlimit = min(N, K)\n\nfor a in range(limit+1): #\u5de6\u304b\u3089\u53d6\u308a\u51fa\u3059\n\n for b in range(limit-a+1): #\u53f3\u304b\u3089\u53d6\u308a\u51fa\u3059\n\n for c in range(K-(a+b)+1):\n\n use = V[:a] + V[N-b:]\n\n use.sort()\n\n s = sum(use[c:])\n\n answer = max(answer, s)\n\n\n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10 ** 9)\n\n\n\nN, K = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\nV2 = V * 2\n\nanswer = 0\n\nfor i in range(1, min(N, K)+1): # i\u306f\u5b9d\u77f3\u3092\u53d6\u308a\u51fa\u3059\u500b\u6570\n\n for j in range(0, min(i, K-i)+1): # j\u306f\u4f55\u500b\u306e\u5b9d\u77f3\u3092\u624b\u96e2\u3059\u304b\n\n for k in range(max(0, N-i), N+1): # V2\u306e\u4e2d\u3067\u4f55\u756a\u76ee\u304b\u3089\u53d6\u308a\u51fa\u3059\u304b\n\n use = V2[k:k+i]\n\n use.sort()\n\n s = sum(use[j:])\n\n if s > answer:\n\n answer = s\n\n\n\nprint(answer)\n","code_v0_loc":14,"code_v1_loc":17,"code_v0_num_chars":357,"code_v1_num_chars":458,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nV = list(map(int, input().split()))\nanswer = 0\nlimit = min(N, K)\nfor a in range(limit + 1): # \u5de6\u304b\u3089\u53d6\u308a\u51fa\u3059\n for b in range(limit - a + 1): # \u53f3\u304b\u3089\u53d6\u308a\u51fa\u3059\n for c in range(K - (a + b) + 1):\n use = V[:a] + V[N - b :]\n use.sort()\n s = sum(use[c:])\n answer = max(answer, s)\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nN, K = list(map(int, input().split()))\nV = list(map(int, input().split()))\nV2 = V * 2\nanswer = 0\nfor i in range(1, min(N, K) + 1): # i\u306f\u5b9d\u77f3\u3092\u53d6\u308a\u51fa\u3059\u500b\u6570\n for j in range(0, min(i, K - i) + 1): # j\u306f\u4f55\u500b\u306e\u5b9d\u77f3\u3092\u624b\u96e2\u3059\u304b\n for k in range(max(0, N - i), N + 1): # V2\u306e\u4e2d\u3067\u4f55\u756a\u76ee\u304b\u3089\u53d6\u308a\u51fa\u3059\u304b\n use = V2[k : k + i]\n use.sort()\n s = sum(use[j:])\n if s > answer:\n answer = s\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["+import sys","+","+sys.setrecursionlimit(10**9)","+V2 = V * 2","-limit = min(N, K)","-for a in range(limit + 1): # \u5de6\u304b\u3089\u53d6\u308a\u51fa\u3059","- for b in range(limit - a + 1): # \u53f3\u304b\u3089\u53d6\u308a\u51fa\u3059","- for c in range(K - (a + b) + 1):","- use = V[:a] + V[N - b :]","+for i in range(1, min(N, K) + 1): # i\u306f\u5b9d\u77f3\u3092\u53d6\u308a\u51fa\u3059\u500b\u6570","+ for j in range(0, min(i, K - i) + 1): # j\u306f\u4f55\u500b\u306e\u5b9d\u77f3\u3092\u624b\u96e2\u3059\u304b","+ for k in range(max(0, N - i), N + 1): # V2\u306e\u4e2d\u3067\u4f55\u756a\u76ee\u304b\u3089\u53d6\u308a\u51fa\u3059\u304b","+ use = V2[k : k + i]","- s = sum(use[c:])","- answer = max(answer, s)","+ s = sum(use[j:])","+ if s > answer:","+ answer = s"],"diff_only_import_comment":false,"measured_runtime_v0":0.24001915,"measured_runtime_v1":0.147559453,"runtime_lift":1.6265928418,"key":["s390254937","s816896537"]} +{"user_id":"u365686736","problem_id":"p02390","language":"python","submission_id_v0":"s143749551","submission_id_v1":"s514847697","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7676,"memory_v1":5584,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = int(input())\n\n\n\nif S >= 3600:\n\n h=S\/\/3600\n\n m=S%3600\/\/60\n\n s=S%60\n\nelif 3600 > S >= 60:\n\n h=0\n\n m=S\/\/60\n\n s=S%60\n\nelse:\n\n h=m=0\n\n s=S\n\nprint(h, m, s, sep=\":\")\n\n\n# optimized version of the same code:\n","target":"s = int(input())\n\nh = s \/\/ 3600\n\nm = (s - h * 3600) \/\/ 60\n\ns = s - h * 3600 - m * 60\n\nprint(h, m, s, sep=\":\")\n","code_v0_loc":14,"code_v1_loc":5,"code_v0_num_chars":186,"code_v1_num_chars":110,"code_v0_no_empty_lines":"S = int(input())\nif S >= 3600:\n h = S \/\/ 3600\n m = S % 3600 \/\/ 60\n s = S % 60\nelif 3600 > S >= 60:\n h = 0\n m = S \/\/ 60\n s = S % 60\nelse:\n h = m = 0\n s = S\nprint(h, m, s, sep=\":\")\n","code_v1_no_empty_lines":"s = int(input())\nh = s \/\/ 3600\nm = (s - h * 3600) \/\/ 60\ns = s - h * 3600 - m * 60\nprint(h, m, s, sep=\":\")\n","code_same":false,"relative_loc_diff_percent":64.2857142857,"diff":["-S = int(input())","-if S >= 3600:","- h = S \/\/ 3600","- m = S % 3600 \/\/ 60","- s = S % 60","-elif 3600 > S >= 60:","- h = 0","- m = S \/\/ 60","- s = S % 60","-else:","- h = m = 0","- s = S","+s = int(input())","+h = s \/\/ 3600","+m = (s - h * 3600) \/\/ 60","+s = s - h * 3600 - m * 60"],"diff_only_import_comment":false,"measured_runtime_v0":0.3295819011,"measured_runtime_v1":0.255378567,"runtime_lift":1.2905621053,"key":["s143749551","s514847697"]} +{"user_id":"u670180528","problem_id":"p03806","language":"python","submission_id_v0":"s355426542","submission_id_v1":"s468498336","cpu_time_v0":1133,"cpu_time_v1":172,"memory_v0":4980,"memory_v1":4980,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1<<30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(400, -1, -1):\n\n\t\t\tfor j in range(400, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\nif __name__==\"__main__\":\n\n\tmain()\n\n# optimized version of the same code:\n","target":"def main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1 << 30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tua = ub = 15\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(ua, -1, -1):\n\n\t\t\tfor j in range(ub, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\t\t\t\t\tif ua < i + a:\n\n\t\t\t\t\t\tua = i + a\n\n\t\t\t\t\tif ub < j + b:\n\n\t\t\t\t\t\tub = j + b\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()\n","code_v0_loc":21,"code_v1_loc":27,"code_v0_num_chars":492,"code_v1_num_chars":590,"code_v0_no_empty_lines":"def main():\n n, ma, mb, *L = list(map(int, open(0).read().split()))\n M = 1 << 30\n dp = [[M] * 420 for _ in range(420)]\n dp[0][0] = 0\n for a, b, c in zip(*[iter(L)] * 3):\n for i in range(400, -1, -1):\n for j in range(400, -1, -1):\n t = dp[i][j] + c\n if dp[i + a][j + b] > t:\n dp[i + a][j + b] = t\n ans = M\n _ma, _mb = ma, mb\n while _ma < 410 > _mb:\n ans = min(ans, dp[_ma][_mb])\n _ma += ma\n _mb += mb\n print((ans if ans < M else -1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n, ma, mb, *L = list(map(int, open(0).read().split()))\n M = 1 << 30\n dp = [[M] * 420 for _ in range(420)]\n dp[0][0] = 0\n ua = ub = 15\n for a, b, c in zip(*[iter(L)] * 3):\n for i in range(ua, -1, -1):\n for j in range(ub, -1, -1):\n t = dp[i][j] + c\n if dp[i + a][j + b] > t:\n dp[i + a][j + b] = t\n if ua < i + a:\n ua = i + a\n if ub < j + b:\n ub = j + b\n ans = M\n _ma, _mb = ma, mb\n while _ma < 410 > _mb:\n ans = min(ans, dp[_ma][_mb])\n _ma += ma\n _mb += mb\n print((ans if ans < M else -1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["+ ua = ub = 15","- for i in range(400, -1, -1):","- for j in range(400, -1, -1):","+ for i in range(ua, -1, -1):","+ for j in range(ub, -1, -1):","+ if ua < i + a:","+ ua = i + a","+ if ub < j + b:","+ ub = j + b"],"diff_only_import_comment":false,"measured_runtime_v0":1.1710306553,"measured_runtime_v1":0.275720624,"runtime_lift":4.2471638081,"key":["s355426542","s468498336"]} +{"user_id":"u556594202","problem_id":"p03494","language":"python","submission_id_v0":"s386053727","submission_id_v1":"s802119805","cpu_time_v0":120,"cpu_time_v1":25,"memory_v0":27180,"memory_v1":9224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn = int(eval(input()))\n\na = np.array(list(map(int,input().split())))\n\n\n\ncount = 0\n\nwhile np.all(a%2==0):\n\n count+=1\n\n a=a\/2\n\nprint(count)\n\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\na = [int(i) for i in input().split()]\n\n\n\ncount=0\n\nwhile 1:\n\n if sum([i%2 for i in a]) == 0:\n\n a = [i\/2 for i in a]\n\n count=count+1\n\n else:\n\n print(count)\n\n break\n","code_v0_loc":10,"code_v1_loc":11,"code_v0_num_chars":160,"code_v1_num_chars":212,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\na = np.array(list(map(int, input().split())))\ncount = 0\nwhile np.all(a % 2 == 0):\n count += 1\n a = a \/ 2\nprint(count)\n","code_v1_no_empty_lines":"N = int(eval(input()))\na = [int(i) for i in input().split()]\ncount = 0\nwhile 1:\n if sum([i % 2 for i in a]) == 0:\n a = [i \/ 2 for i in a]\n count = count + 1\n else:\n print(count)\n break\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-import numpy as np","-","-n = int(eval(input()))","-a = np.array(list(map(int, input().split())))","+N = int(eval(input()))","+a = [int(i) for i in input().split()]","-while np.all(a % 2 == 0):","- count += 1","- a = a \/ 2","-print(count)","+while 1:","+ if sum([i % 2 for i in a]) == 0:","+ a = [i \/ 2 for i in a]","+ count = count + 1","+ else:","+ print(count)","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":2.1324696655,"measured_runtime_v1":0.2760572641,"runtime_lift":7.7247366501,"key":["s386053727","s802119805"]} +{"user_id":"u729133443","problem_id":"p03434","language":"python","submission_id_v0":"s231475572","submission_id_v1":"s619171000","cpu_time_v0":35,"cpu_time_v1":30,"memory_v0":9016,"memory_v1":9012,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n_,s=open(c:=0)\n\nfor a in sorted(map(int,s.split())):c=a-c\n\nprint(c)\n\n# optimized version of the same code:\n","target":"for a in sorted(map(int,[*open(c:=0)][1].split())):c=a-c\n\nprint(c)","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":67,"code_v1_num_chars":66,"code_v0_no_empty_lines":"_, s = open(c := 0)\nfor a in sorted(map(int, s.split())):\n c = a - c\nprint(c)\n","code_v1_no_empty_lines":"for a in sorted(map(int, [*open(c := 0)][1].split())):\n c = a - c\nprint(c)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-_, s = open(c := 0)","-for a in sorted(map(int, s.split())):","+for a in sorted(map(int, [*open(c := 0)][1].split())):"],"diff_only_import_comment":false,"measured_runtime_v0":0.269129122,"measured_runtime_v1":0.112153646,"runtime_lift":2.3996466598,"key":["s231475572","s619171000"]} +{"user_id":"u168139048","problem_id":"p02883","language":"python","submission_id_v0":"s505691060","submission_id_v1":"s145470826","cpu_time_v0":1986,"cpu_time_v1":1272,"memory_v0":119628,"memory_v1":120140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(10000000)\n\nimport heapq\n\nimport math\n\n \n\ndef main():\n\n N, K = list(map(int, input().split()))\n\n A = [int(c) for c in input().split()]\n\n F = [int(c) for c in input().split()]\n\n \n\n A.sort()\n\n F.sort(reverse=True)\n\n \n\n num = 0\n\n sum_ = []\n\n for i in range(N):\n\n sum_.append(A[i] * F[i])\n\n left = 0\n\n right = 10 ** 12\n\n while(num < 90):\n\n number = 0\n\n mid = (left + right) \/\/ 2\n\n # print(mid)\n\n for i in range(len(A)):\n\n if sum_[i] <= mid:\n\n continue\n\n else:\n\n number += math.ceil((sum_[i] - mid) \/ F[i])\n\n # print(number)\n\n if number > K:\n\n # \u6700\u5927\u5024\u3092mid\u3088\u308a\u5c0f\u3055\u304f\u3067\u304d\u306a\u3044 -> \u6700\u5927\u5024\u306f\u3082\u3063\u3068\u3067\u304b\u3044\n\n left = mid + 1\n\n else:\n\n right = mid\n\n num += 1\n\n print(mid)\n\n \n\n \n\n \n\n \n\n \n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10000000)\n\nimport heapq\n\nimport math\n\n\n\ndef main():\n\n N, K = list(map(int, input().split()))\n\n A = [int(c) for c in input().split()]\n\n F = [int(c) for c in input().split()]\n\n \n\n A.sort()\n\n F.sort(reverse=True)\n\n\n\n num = 0\n\n sum_ = []\n\n for i in range(len(A)):\n\n sum_.append(A[i] * F[i])\n\n left = 0\n\n right = 10 ** 12\n\n while(num < 50):\n\n number = 0\n\n mid = (left + right) \/\/ 2\n\n # print(mid)\n\n for i in range(len(A)):\n\n if sum_[i] <= mid:\n\n continue\n\n else:\n\n number += math.ceil((sum_[i] - mid) \/ F[i])\n\n # print(number)\n\n if number > K:\n\n # \u6700\u5927\u5024\u3092mid\u3088\u308a\u5c0f\u3055\u304f\u3067\u304d\u306a\u3044 -> \u6700\u5927\u5024\u306f\u3082\u3063\u3068\u3067\u304b\u3044\n\n left = mid + 1\n\n else:\n\n right = mid\n\n num += 1\n\n print(mid)\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":43,"code_v1_loc":40,"code_v0_num_chars":927,"code_v1_num_chars":916,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10000000)\nimport heapq\nimport math\n\n\ndef main():\n N, K = list(map(int, input().split()))\n A = [int(c) for c in input().split()]\n F = [int(c) for c in input().split()]\n A.sort()\n F.sort(reverse=True)\n num = 0\n sum_ = []\n for i in range(N):\n sum_.append(A[i] * F[i])\n left = 0\n right = 10**12\n while num < 90:\n number = 0\n mid = (left + right) \/\/ 2\n # print(mid)\n for i in range(len(A)):\n if sum_[i] <= mid:\n continue\n else:\n number += math.ceil((sum_[i] - mid) \/ F[i])\n # print(number)\n if number > K:\n # \u6700\u5927\u5024\u3092mid\u3088\u308a\u5c0f\u3055\u304f\u3067\u304d\u306a\u3044 -> \u6700\u5927\u5024\u306f\u3082\u3063\u3068\u3067\u304b\u3044\n left = mid + 1\n else:\n right = mid\n num += 1\n print(mid)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10000000)\nimport heapq\nimport math\n\n\ndef main():\n N, K = list(map(int, input().split()))\n A = [int(c) for c in input().split()]\n F = [int(c) for c in input().split()]\n A.sort()\n F.sort(reverse=True)\n num = 0\n sum_ = []\n for i in range(len(A)):\n sum_.append(A[i] * F[i])\n left = 0\n right = 10**12\n while num < 50:\n number = 0\n mid = (left + right) \/\/ 2\n # print(mid)\n for i in range(len(A)):\n if sum_[i] <= mid:\n continue\n else:\n number += math.ceil((sum_[i] - mid) \/ F[i])\n # print(number)\n if number > K:\n # \u6700\u5927\u5024\u3092mid\u3088\u308a\u5c0f\u3055\u304f\u3067\u304d\u306a\u3044 -> \u6700\u5927\u5024\u306f\u3082\u3063\u3068\u3067\u304b\u3044\n left = mid + 1\n else:\n right = mid\n num += 1\n print(mid)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.976744186,"diff":["- for i in range(N):","+ for i in range(len(A)):","- while num < 90:","+ while num < 50:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2338457465,"measured_runtime_v1":0.006493052,"runtime_lift":36.0147656217,"key":["s505691060","s145470826"]} +{"user_id":"u738622346","problem_id":"p03854","language":"python","submission_id_v0":"s146499990","submission_id_v1":"s321967328","cpu_time_v0":123,"cpu_time_v1":50,"memory_v0":3316,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.35,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = eval(input())\n\nt = \"\"\n\nwhile len(t) < len(s):\n\n target_len = len(s) - len(t)\n\n\n\n if s[len(t)] == 'd':\n\n if target_len == 5:\n\n t += \"dream\"\n\n elif target_len == 7:\n\n t += \"dreamer\"\n\n elif target_len > 7:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 7 + 1] != \"era\":\n\n t += \"dreamer\"\n\n else:\n\n t += \"dream\"\n\n else:\n\n break\n\n else:\n\n if target_len == 5:\n\n t += \"erase\"\n\n elif target_len == 6:\n\n t += \"eraser\"\n\n elif target_len > 6:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 6 + 2] != \"era\":\n\n t += \"eraser\"\n\n else:\n\n t += \"erase\"\n\n else:\n\n break\n\n\n\n if s[0:len(t)] != t:\n\n break\n\n\n\nprint((\"YES\" if s == t else \"NO\"))\n\n\n# optimized version of the same code:\n","target":"s = eval(input())\n\ndiv = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\n\nrev = []\n\nt = \"\"\n\ns_rev = s[::-1]\n\nfor d in div:\n\n rev.append(d[::-1])\n\n\n\nresult = True\n\ni = 0\n\nwhile i < len(s):\n\n can_divide = False\n\n for d in rev:\n\n if len(s_rev) - i >= len(d) and s_rev[i:i + len(d)] == d:\n\n can_divide = True\n\n i += len(d)\n\n break\n\n if not can_divide:\n\n result = False\n\n break\n\n\n\nprint((\"YES\" if result else \"NO\"))\n","code_v0_loc":34,"code_v1_loc":22,"code_v0_num_chars":872,"code_v1_num_chars":461,"code_v0_no_empty_lines":"s = eval(input())\nt = \"\"\nwhile len(t) < len(s):\n target_len = len(s) - len(t)\n if s[len(t)] == \"d\":\n if target_len == 5:\n t += \"dream\"\n elif target_len == 7:\n t += \"dreamer\"\n elif target_len > 7:\n if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 7 + 1] != \"era\":\n t += \"dreamer\"\n else:\n t += \"dream\"\n else:\n break\n else:\n if target_len == 5:\n t += \"erase\"\n elif target_len == 6:\n t += \"eraser\"\n elif target_len > 6:\n if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 6 + 2] != \"era\":\n t += \"eraser\"\n else:\n t += \"erase\"\n else:\n break\n if s[0 : len(t)] != t:\n break\nprint((\"YES\" if s == t else \"NO\"))\n","code_v1_no_empty_lines":"s = eval(input())\ndiv = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nrev = []\nt = \"\"\ns_rev = s[::-1]\nfor d in div:\n rev.append(d[::-1])\nresult = True\ni = 0\nwhile i < len(s):\n can_divide = False\n for d in rev:\n if len(s_rev) - i >= len(d) and s_rev[i : i + len(d)] == d:\n can_divide = True\n i += len(d)\n break\n if not can_divide:\n result = False\n break\nprint((\"YES\" if result else \"NO\"))\n","code_same":false,"relative_loc_diff_percent":35.2941176471,"diff":["+div = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]","+rev = []","-while len(t) < len(s):","- target_len = len(s) - len(t)","- if s[len(t)] == \"d\":","- if target_len == 5:","- t += \"dream\"","- elif target_len == 7:","- t += \"dreamer\"","- elif target_len > 7:","- if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 7 + 1] != \"era\":","- t += \"dreamer\"","- else:","- t += \"dream\"","- else:","+s_rev = s[::-1]","+for d in div:","+ rev.append(d[::-1])","+result = True","+i = 0","+while i < len(s):","+ can_divide = False","+ for d in rev:","+ if len(s_rev) - i >= len(d) and s_rev[i : i + len(d)] == d:","+ can_divide = True","+ i += len(d)","- else:","- if target_len == 5:","- t += \"erase\"","- elif target_len == 6:","- t += \"eraser\"","- elif target_len > 6:","- if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 6 + 2] != \"era\":","- t += \"eraser\"","- else:","- t += \"erase\"","- else:","- break","- if s[0 : len(t)] != t:","+ if not can_divide:","+ result = False","-print((\"YES\" if s == t else \"NO\"))","+print((\"YES\" if result else \"NO\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3984818382,"measured_runtime_v1":0.3150180125,"runtime_lift":1.2649493755,"key":["s146499990","s321967328"]} +{"user_id":"u808429775","problem_id":"p00134","language":"python","submission_id_v0":"s571351483","submission_id_v1":"s722552691","cpu_time_v0":100,"cpu_time_v1":60,"memory_v0":7404,"memory_v1":5952,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom statistics import mean\n\n\n\ninputCount = int(eval(input()))\n\nprices = [int(eval(input())) for lp in range(inputCount)]\n\naverage = mean(prices)\n\nprint((int(average)))\n\n\n\n\n# optimized version of the same code:\n","target":"inputCount = int(eval(input()))\n\nprices = [int(eval(input())) for lp in range(inputCount)]\n\naverage = sum(prices) \/\/ inputCount\n\nprint(average)\n\n\n","code_v0_loc":7,"code_v1_loc":5,"code_v0_num_chars":157,"code_v1_num_chars":134,"code_v0_no_empty_lines":"from statistics import mean\n\ninputCount = int(eval(input()))\nprices = [int(eval(input())) for lp in range(inputCount)]\naverage = mean(prices)\nprint((int(average)))\n","code_v1_no_empty_lines":"inputCount = int(eval(input()))\nprices = [int(eval(input())) for lp in range(inputCount)]\naverage = sum(prices) \/\/ inputCount\nprint(average)\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-from statistics import mean","-","-average = mean(prices)","-print((int(average)))","+average = sum(prices) \/\/ inputCount","+print(average)"],"diff_only_import_comment":false,"measured_runtime_v0":0.453101104,"measured_runtime_v1":0.2992461076,"runtime_lift":1.514142014,"key":["s571351483","s722552691"]} +{"user_id":"u645250356","problem_id":"p03559","language":"python","submission_id_v0":"s643210131","submission_id_v1":"s973528764","cpu_time_v0":585,"cpu_time_v1":431,"memory_v0":124300,"memory_v1":30272,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.32,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,fractions,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\nA = sorted(inpl())\n\nB = sorted(inpl())\n\nC = sorted(inpl())\n\ncnt = [0] * n\n\nres = 0\n\nfor i,b in enumerate(B):\n\n c = bisect.bisect_left(C,b+1)\n\n cnt[i] = n-c\n\n\n\nacc = [0]\n\nfor x in cnt:\n\n acc += [acc[-1] + x]\n\nsu = sum(cnt) \n\nfor i,a in enumerate(A):\n\n c = bisect.bisect_left(B,a+1)\n\n res += su - acc[c]\n\nprint(res)\n\n# optimized version of the same code:\n","target":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,fractions,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\na = inpl()\n\nb = inpl()\n\nc = inpl()\n\na.sort()\n\nb.sort()\n\nc.sort()\n\nlb = [0] * n\n\nres = 0\n\nfor i in range(n):\n\n tmp = bisect.bisect_right(b,a[i])\n\n if tmp == n: continue\n\n lb[tmp] += 1\n\nllb = list(itertools.accumulate(lb))\n\n# print(lb,llb)\n\nrr = [0] * n\n\nfor i in range(n):\n\n tmp = bisect.bisect_right(c,b[i])\n\n if tmp == n: continue\n\n rr[tmp] += llb[i]\n\nprint((sum(list(itertools.accumulate(rr)))))","code_v0_loc":27,"code_v1_loc":30,"code_v0_num_chars":662,"code_v1_num_chars":747,"code_v0_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, fractions, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = inp()\nA = sorted(inpl())\nB = sorted(inpl())\nC = sorted(inpl())\ncnt = [0] * n\nres = 0\nfor i, b in enumerate(B):\n c = bisect.bisect_left(C, b + 1)\n cnt[i] = n - c\nacc = [0]\nfor x in cnt:\n acc += [acc[-1] + x]\nsu = sum(cnt)\nfor i, a in enumerate(A):\n c = bisect.bisect_left(B, a + 1)\n res += su - acc[c]\nprint(res)\n","code_v1_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, fractions, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = inp()\na = inpl()\nb = inpl()\nc = inpl()\na.sort()\nb.sort()\nc.sort()\nlb = [0] * n\nres = 0\nfor i in range(n):\n tmp = bisect.bisect_right(b, a[i])\n if tmp == n:\n continue\n lb[tmp] += 1\nllb = list(itertools.accumulate(lb))\n# print(lb,llb)\nrr = [0] * n\nfor i in range(n):\n tmp = bisect.bisect_right(c, b[i])\n if tmp == n:\n continue\n rr[tmp] += llb[i]\nprint((sum(list(itertools.accumulate(rr)))))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-A = sorted(inpl())","-B = sorted(inpl())","-C = sorted(inpl())","-cnt = [0] * n","+a = inpl()","+b = inpl()","+c = inpl()","+a.sort()","+b.sort()","+c.sort()","+lb = [0] * n","-for i, b in enumerate(B):","- c = bisect.bisect_left(C, b + 1)","- cnt[i] = n - c","-acc = [0]","-for x in cnt:","- acc += [acc[-1] + x]","-su = sum(cnt)","-for i, a in enumerate(A):","- c = bisect.bisect_left(B, a + 1)","- res += su - acc[c]","-print(res)","+for i in range(n):","+ tmp = bisect.bisect_right(b, a[i])","+ if tmp == n:","+ continue","+ lb[tmp] += 1","+llb = list(itertools.accumulate(lb))","+# print(lb,llb)","+rr = [0] * n","+for i in range(n):","+ tmp = bisect.bisect_right(c, b[i])","+ if tmp == n:","+ continue","+ rr[tmp] += llb[i]","+print((sum(list(itertools.accumulate(rr)))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2585086877,"measured_runtime_v1":0.0062210422,"runtime_lift":41.5539198783,"key":["s643210131","s973528764"]} +{"user_id":"u194472175","problem_id":"p02690","language":"python","submission_id_v0":"s141708536","submission_id_v1":"s386181536","cpu_time_v0":50,"cpu_time_v1":40,"memory_v0":9192,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nX=int(eval(input()))\n\nx=0\n\nlist=[]\n\nfor i in range(-118,120,1):\n\n\n\n for j in range(-119,119,1):\n\n x=i**5-j**5\n\n if x==X:\n\n list.append((str(i)+' '+str(j)))\n\n\n\nprint((list[0]))\n\n# optimized version of the same code:\n","target":"X=int(eval(input()))\n\nx=0\n\nlist=[]\n\nfor i in range(-118,120,1):\n\n for j in range(-119,119,1):\n\n x=i**5-j**5\n\n if x==X:\n\n print((str(i)+' '+str(j)))\n\n break\n\n else:\n\n continue\n\n break\n","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":195,"code_v1_num_chars":229,"code_v0_no_empty_lines":"X = int(eval(input()))\nx = 0\nlist = []\nfor i in range(-118, 120, 1):\n for j in range(-119, 119, 1):\n x = i**5 - j**5\n if x == X:\n list.append((str(i) + \" \" + str(j)))\nprint((list[0]))\n","code_v1_no_empty_lines":"X = int(eval(input()))\nx = 0\nlist = []\nfor i in range(-118, 120, 1):\n for j in range(-119, 119, 1):\n x = i**5 - j**5\n if x == X:\n print((str(i) + \" \" + str(j)))\n break\n else:\n continue\n break\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["- list.append((str(i) + \" \" + str(j)))","-print((list[0]))","+ print((str(i) + \" \" + str(j)))","+ break","+ else:","+ continue","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.2096992373,"measured_runtime_v1":0.1602732539,"runtime_lift":1.3083857238,"key":["s141708536","s386181536"]} +{"user_id":"u811733736","problem_id":"p00144","language":"python","submission_id_v0":"s682125154","submission_id_v1":"s595229787","cpu_time_v0":600,"cpu_time_v1":370,"memory_v0":8556,"memory_v1":8432,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\"\"\"\n\nhttp:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=0144\n\n\n\n\"\"\"\n\nimport sys\n\nfrom sys import stdin\n\ninput = stdin.readline\n\nfrom enum import Enum\n\n\n\n\n\nclass Graph(object):\n\n \"\"\" single source shortest path \"\"\"\n\n class Status(Enum):\n\n \"\"\" ?????????????\u00a8??????\u00b6??? \"\"\"\n\n white = 1 # ????\u00a8????\n\n gray = 2 # ?\u00a8???????\n\n black = 3 #?\u00a8???????\n\n\n\n def __init__(self, n, data):\n\n self.num_of_nodes = n+1\n\n self.color = [Graph.Status.white] * self.num_of_nodes # ????????????????\u00a8??????\u00b6???\n\n self.M = [[float('inf')] * self.num_of_nodes for _ in range(self.num_of_nodes)]\n\n for i in range(self.num_of_nodes):\n\n self.M[i][i] = 0\n\n self._make_matrix(data) # data????????????????????\u00a3??\\??????(?????\\?\u00b6???\u00a8???????????????????????\u00a7????????????)\n\n self.d = [float('inf')] * self.num_of_nodes # ?\u00a7???????????????????(?????????)\n\n self.p = [-1] * self.num_of_nodes # ????????????????????????????\u00a8?????????????????????????\n\n\n\n def _make_matrix(self, data):\n\n for d in data:\n\n r = d[0]\n\n for t in d[2:]:\n\n self.M[r][t] = 1\n\n\n\n def dijkstra(self, start):\n\n self.d[start] = 0\n\n self.p[start] = -1\n\n while True:\n\n mincost = float('inf')\n\n # ??\\??????????????\u00a7??????????????\u00a8?????????????????????u???????????????\n\n for i in range(len(self.d)):\n\n if self.color[i] != Graph.Status.black and self.d[i] < mincost: # S????\u00b1???????????????????S??\u00a8??\\?\u00b6?????????????????????????????????????????\u00b0???????????????????\n\n mincost = self.d[i]\n\n u = i # u??????????????????ID\n\n if mincost == float('inf'):\n\n break\n\n self.color[u] = Graph.Status.black # ?????????u???S????\u00b1???????????????\u00b4???\n\n for v in range(len(self.d)):\n\n if self.color[v] != Graph.Status.black and self.M[u][v] != float('inf'):\n\n # v????????????????????????????????\u00b0??????S???????????\u00a3???u????????????????????????????????????????????\u00b0??????????????\u00b1??\u00a7??\u00b4??\u00b0??????\n\n if self.d[u] + self.M[u][v] < self.d[v]:\n\n self.d[v] = self.d[u] + self.M[u][v]\n\n self.p[v] = u\n\n self.color[v] = Graph.Status.gray\n\n\n\n def warshallFloyd(self):\n\n V = self.num_of_nodes\n\n for k in range(V):\n\n for i in range(V):\n\n for j in range(V):\n\n self.M[i][j] = min(self.M[i][j], self.M[i][k] + self.M[k][j])\n\n\n\n\n\n\n\ndef main(args):\n\n n = int(eval(input()))\n\n network = []\n\n for _ in range(n):\n\n network.append([int(x) for x in input().split()])\n\n\n\n packets = []\n\n p = int(eval(input()))\n\n for _ in range(p):\n\n packets.append([int(x) for x in input().split()])\n\n\n\n g = Graph(n, network)\n\n g.warshallFloyd()\n\n\n\n for s, d, v in packets:\n\n if g.M[s][d] < v:\n\n print((g.M[s][d]+1))\n\n else:\n\n print('NA')\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main(sys.argv[1:])\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nhttp:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=0144\n\n\n\n\"\"\"\n\nimport sys\n\nfrom sys import stdin\n\ninput = stdin.readline\n\nfrom enum import Enum\n\n\n\n\n\nclass Graph(object):\n\n \"\"\" single source shortest path \"\"\"\n\n class Status(Enum):\n\n \"\"\" ?????????????\u00a8??????\u00b6??? \"\"\"\n\n white = 1 # ????\u00a8????\n\n gray = 2 # ?\u00a8???????\n\n black = 3 #?\u00a8???????\n\n\n\n def __init__(self, n, data):\n\n self.num_of_nodes = n+1\n\n self.color = [Graph.Status.white] * self.num_of_nodes # ????????????????\u00a8??????\u00b6???\n\n self.M = [[float('inf')] * self.num_of_nodes for _ in range(self.num_of_nodes)]\n\n for i in range(self.num_of_nodes):\n\n self.M[i][i] = 0\n\n self._make_matrix(data) # data????????????????????\u00a3??\\??????(?????\\?\u00b6???\u00a8???????????????????????\u00a7????????????)\n\n self.d = [float('inf')] * self.num_of_nodes # ?\u00a7???????????????????(?????????)\n\n self.p = [-1] * self.num_of_nodes # ????????????????????????????\u00a8?????????????????????????\n\n\n\n def _make_matrix(self, data):\n\n for d in data:\n\n r = d[0]\n\n for t in d[2:]:\n\n self.M[r][t] = 1\n\n\n\n def dijkstra(self, start):\n\n self.d[start] = 0\n\n self.p[start] = -1\n\n while True:\n\n mincost = float('inf')\n\n # ??\\??????????????\u00a7??????????????\u00a8?????????????????????u???????????????\n\n for i in range(len(self.d)):\n\n if self.color[i] != Graph.Status.black and self.d[i] < mincost: # S????\u00b1???????????????????S??\u00a8??\\?\u00b6?????????????????????????????????????????\u00b0???????????????????\n\n mincost = self.d[i]\n\n u = i # u??????????????????ID\n\n if mincost == float('inf'):\n\n break\n\n self.color[u] = Graph.Status.black # ?????????u???S????\u00b1???????????????\u00b4???\n\n for v in range(len(self.d)):\n\n if self.color[v] != Graph.Status.black and self.M[u][v] != float('inf'):\n\n # v????????????????????????????????\u00b0??????S???????????\u00a3???u????????????????????????????????????????????\u00b0??????????????\u00b1??\u00a7??\u00b4??\u00b0??????\n\n if self.d[u] + self.M[u][v] < self.d[v]:\n\n self.d[v] = self.d[u] + self.M[u][v]\n\n self.p[v] = u\n\n self.color[v] = Graph.Status.gray\n\n\n\n def warshallFloyd(self):\n\n for k in range(self.num_of_nodes):\n\n for i in range(self.num_of_nodes):\n\n for j in range(self.num_of_nodes):\n\n if self.M[i][k] + self.M[k][j] < self.M[i][j]: \n\n self.M[i][j] = self.M[i][k] + self.M[k][j]\n\n\n\n\n\ndef main(args):\n\n n = int(eval(input()))\n\n network = []\n\n for _ in range(n):\n\n network.append([int(x) for x in input().split()])\n\n\n\n packets = []\n\n p = int(eval(input()))\n\n for _ in range(p):\n\n packets.append([int(x) for x in input().split()])\n\n\n\n g = Graph(n, network)\n\n g.warshallFloyd()\n\n\n\n for s, d, v in packets:\n\n if g.M[s][d] < v:\n\n print((g.M[s][d]+1))\n\n else:\n\n print('NA')\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main(sys.argv[1:])","code_v0_loc":89,"code_v1_loc":88,"code_v0_num_chars":3155,"code_v1_num_chars":3224,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nhttp:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=0144\n\"\"\"\nimport sys\nfrom sys import stdin\n\ninput = stdin.readline\nfrom enum import Enum\n\n\nclass Graph(object):\n \"\"\"single source shortest path\"\"\"\n\n class Status(Enum):\n \"\"\"?????????????\u00a8??????\u00b6???\"\"\"\n\n white = 1 # ????\u00a8????\n gray = 2 # ?\u00a8???????\n black = 3 # ?\u00a8???????\n\n def __init__(self, n, data):\n self.num_of_nodes = n + 1\n self.color = [\n Graph.Status.white\n ] * self.num_of_nodes # ????????????????\u00a8??????\u00b6???\n self.M = [[float(\"inf\")] * self.num_of_nodes for _ in range(self.num_of_nodes)]\n for i in range(self.num_of_nodes):\n self.M[i][i] = 0\n self._make_matrix(\n data\n ) # data????????????????????\u00a3??\\??????(?????\\?\u00b6???\u00a8???????????????????????\u00a7????????????)\n self.d = [float(\"inf\")] * self.num_of_nodes # ?\u00a7???????????????????(?????????)\n self.p = [\n -1\n ] * self.num_of_nodes # ????????????????????????????\u00a8?????????????????????????\n\n def _make_matrix(self, data):\n for d in data:\n r = d[0]\n for t in d[2:]:\n self.M[r][t] = 1\n\n def dijkstra(self, start):\n self.d[start] = 0\n self.p[start] = -1\n while True:\n mincost = float(\"inf\")\n # ??\\??????????????\u00a7??????????????\u00a8?????????????????????u???????????????\n for i in range(len(self.d)):\n if (\n self.color[i] != Graph.Status.black and self.d[i] < mincost\n ): # S????\u00b1???????????????????S??\u00a8??\\?\u00b6?????????????????????????????????????????\u00b0???????????????????\n mincost = self.d[i]\n u = i # u??????????????????ID\n if mincost == float(\"inf\"):\n break\n self.color[u] = Graph.Status.black # ?????????u???S????\u00b1???????????????\u00b4???\n for v in range(len(self.d)):\n if self.color[v] != Graph.Status.black and self.M[u][v] != float(\"inf\"):\n # v????????????????????????????????\u00b0??????S???????????\u00a3???u????????????????????????????????????????????\u00b0??????????????\u00b1??\u00a7??\u00b4??\u00b0??????\n if self.d[u] + self.M[u][v] < self.d[v]:\n self.d[v] = self.d[u] + self.M[u][v]\n self.p[v] = u\n self.color[v] = Graph.Status.gray\n\n def warshallFloyd(self):\n V = self.num_of_nodes\n for k in range(V):\n for i in range(V):\n for j in range(V):\n self.M[i][j] = min(self.M[i][j], self.M[i][k] + self.M[k][j])\n\n\ndef main(args):\n n = int(eval(input()))\n network = []\n for _ in range(n):\n network.append([int(x) for x in input().split()])\n packets = []\n p = int(eval(input()))\n for _ in range(p):\n packets.append([int(x) for x in input().split()])\n g = Graph(n, network)\n g.warshallFloyd()\n for s, d, v in packets:\n if g.M[s][d] < v:\n print((g.M[s][d] + 1))\n else:\n print(\"NA\")\n\n\nif __name__ == \"__main__\":\n main(sys.argv[1:])\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nhttp:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=0144\n\"\"\"\nimport sys\nfrom sys import stdin\n\ninput = stdin.readline\nfrom enum import Enum\n\n\nclass Graph(object):\n \"\"\"single source shortest path\"\"\"\n\n class Status(Enum):\n \"\"\"?????????????\u00a8??????\u00b6???\"\"\"\n\n white = 1 # ????\u00a8????\n gray = 2 # ?\u00a8???????\n black = 3 # ?\u00a8???????\n\n def __init__(self, n, data):\n self.num_of_nodes = n + 1\n self.color = [\n Graph.Status.white\n ] * self.num_of_nodes # ????????????????\u00a8??????\u00b6???\n self.M = [[float(\"inf\")] * self.num_of_nodes for _ in range(self.num_of_nodes)]\n for i in range(self.num_of_nodes):\n self.M[i][i] = 0\n self._make_matrix(\n data\n ) # data????????????????????\u00a3??\\??????(?????\\?\u00b6???\u00a8???????????????????????\u00a7????????????)\n self.d = [float(\"inf\")] * self.num_of_nodes # ?\u00a7???????????????????(?????????)\n self.p = [\n -1\n ] * self.num_of_nodes # ????????????????????????????\u00a8?????????????????????????\n\n def _make_matrix(self, data):\n for d in data:\n r = d[0]\n for t in d[2:]:\n self.M[r][t] = 1\n\n def dijkstra(self, start):\n self.d[start] = 0\n self.p[start] = -1\n while True:\n mincost = float(\"inf\")\n # ??\\??????????????\u00a7??????????????\u00a8?????????????????????u???????????????\n for i in range(len(self.d)):\n if (\n self.color[i] != Graph.Status.black and self.d[i] < mincost\n ): # S????\u00b1???????????????????S??\u00a8??\\?\u00b6?????????????????????????????????????????\u00b0???????????????????\n mincost = self.d[i]\n u = i # u??????????????????ID\n if mincost == float(\"inf\"):\n break\n self.color[u] = Graph.Status.black # ?????????u???S????\u00b1???????????????\u00b4???\n for v in range(len(self.d)):\n if self.color[v] != Graph.Status.black and self.M[u][v] != float(\"inf\"):\n # v????????????????????????????????\u00b0??????S???????????\u00a3???u????????????????????????????????????????????\u00b0??????????????\u00b1??\u00a7??\u00b4??\u00b0??????\n if self.d[u] + self.M[u][v] < self.d[v]:\n self.d[v] = self.d[u] + self.M[u][v]\n self.p[v] = u\n self.color[v] = Graph.Status.gray\n\n def warshallFloyd(self):\n for k in range(self.num_of_nodes):\n for i in range(self.num_of_nodes):\n for j in range(self.num_of_nodes):\n if self.M[i][k] + self.M[k][j] < self.M[i][j]:\n self.M[i][j] = self.M[i][k] + self.M[k][j]\n\n\ndef main(args):\n n = int(eval(input()))\n network = []\n for _ in range(n):\n network.append([int(x) for x in input().split()])\n packets = []\n p = int(eval(input()))\n for _ in range(p):\n packets.append([int(x) for x in input().split()])\n g = Graph(n, network)\n g.warshallFloyd()\n for s, d, v in packets:\n if g.M[s][d] < v:\n print((g.M[s][d] + 1))\n else:\n print(\"NA\")\n\n\nif __name__ == \"__main__\":\n main(sys.argv[1:])\n","code_same":false,"relative_loc_diff_percent":1.1235955056,"diff":["- V = self.num_of_nodes","- for k in range(V):","- for i in range(V):","- for j in range(V):","- self.M[i][j] = min(self.M[i][j], self.M[i][k] + self.M[k][j])","+ for k in range(self.num_of_nodes):","+ for i in range(self.num_of_nodes):","+ for j in range(self.num_of_nodes):","+ if self.M[i][k] + self.M[k][j] < self.M[i][j]:","+ self.M[i][j] = self.M[i][k] + self.M[k][j]"],"diff_only_import_comment":false,"measured_runtime_v0":0.3833627119,"measured_runtime_v1":0.2694868836,"runtime_lift":1.4225653832,"key":["s682125154","s595229787"]} +{"user_id":"u102461423","problem_id":"p03553","language":"python","submission_id_v0":"s825327687","submission_id_v1":"s119429791","cpu_time_v0":227,"cpu_time_v1":22,"memory_v0":17084,"memory_v1":3444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.31,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nfrom scipy.sparse.csgraph import dijkstra\n\nimport numpy as np\n\n\n\n\"\"\"\n\n\u6700\u5c0f\u30ab\u30c3\u30c8\n\n\"\"\"\n\n\n\nN = int(eval(input()))\n\nstart = 0\n\ngoal = N+1\n\n\n\nA = [0] + [int(x) for x in input().split()]\n\n\n\nINF = 10 ** 12\n\ngraph = np.zeros((N+2,N+2),dtype=np.int64)\n\nfor i,a in enumerate(A[1:],1):\n\n if a >= 0:\n\n graph[start,i] = a\n\n else:\n\n graph[i,goal] = -a\n\nfor i in range(1,N+1):\n\n for j in range(2*i,N+1,i):\n\n if A[i] < 0 and A[j] > 0:\n\n graph[j][i] = INF\n\n\n\ndef max_flow(graph):\n\n flow = 0\n\n while True:\n\n dist,pred = dijkstra(graph, indices = start, return_predecessors = True, unweighted = True)\n\n if dist[goal] == np.inf:\n\n return flow\n\n path = []\n\n v = goal\n\n while True:\n\n path.append((pred[v],v))\n\n v = pred[v]\n\n if v == start:\n\n break\n\n add_flow = min(graph[x][y] for x,y in path)\n\n for x,y in path:\n\n graph[x][y] -= add_flow\n\n graph[y][x] += add_flow\n\n flow += add_flow\n\n\n\nanswer = sum(x for x in A if x > 0) - max_flow(graph)\n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom collections import deque\n\n\n\nN,*A = list(map(int,read().split()))\n\n\n\nclass Dinic:\n\n def __init__(self, N, source, sink):\n\n self.N = N\n\n self.G = [[] for _ in range(N)]\n\n self.source = source\n\n self.sink = sink\n\n\n\n def add_edge(self, fr, to, cap):\n\n n1 = len(self.G[fr])\n\n n2 = len(self.G[to])\n\n self.G[fr].append([to, cap, n2])\n\n self.G[to].append([fr, 0, n1]) # \u9006\u8fba\u3092 cap 0 \u3067\u8ffd\u52a0\n\n \n\n def add_edge_undirected(self, fr, to, cap):\n\n n1 = len(self.G[fr])\n\n n2 = len(self.G[to])\n\n self.G[fr].append([to, cap, n2])\n\n self.G[to].append([fr, cap, n1])\n\n \n\n def bfs(self):\n\n level = [0] * self.N\n\n G = self.G; source = self.source; sink = self.sink\n\n q = deque([source])\n\n level[source] = 1\n\n pop = q.popleft; append = q.append\n\n while q:\n\n v = pop()\n\n lv = level[v] + 1\n\n for to, cap, rev in G[v]:\n\n if not cap:\n\n continue\n\n if level[to]:\n\n continue\n\n level[to] = lv\n\n if to == sink:\n\n self.level = level\n\n return\n\n append(to)\n\n self.level = level\n\n \n\n def dfs(self,v,f):\n\n if v == self.sink:\n\n return f\n\n G = self.G\n\n prog = self.progress\n\n level = self.level\n\n lv = level[v]\n\n E = G[v]\n\n for i in range(prog[v],len(E)):\n\n to, cap, rev = E[i]\n\n prog[v] = i\n\n if not cap:\n\n continue\n\n if level[to] <= lv:\n\n continue\n\n x = f if f < cap else cap\n\n ff = self.dfs(to, x)\n\n if ff:\n\n E[i][1] -= ff\n\n G[to][rev][1] += ff\n\n return ff\n\n return 0\n\n \n\n def max_flow(self):\n\n INF = 10**18\n\n flow = 0\n\n while True:\n\n self.bfs()\n\n if not self.level[self.sink]:\n\n return flow\n\n self.progress = [0] * self.N\n\n while True:\n\n f = self.dfs(self.source, INF)\n\n if not f:\n\n break\n\n flow += f\n\n return flow\n\n\n\nsource = 0; sink = N+1; INF = 10 ** 18\n\ndinic = Dinic(N+2,source,sink)\n\nadd = dinic.add_edge\n\n\n\nfor i,x in enumerate(A,1):\n\n if x < 0:\n\n # source\u5074\uff1a\u5272\u308b\u3082\u306e\u3092\u8868\u73fe\u3002sink\u5074\u306b\u3046\u3064\u3059\u3068\u304d\u306b\u30ab\u30c3\u30c8-x\u304c\u5fc5\u8981\u3002\n\n add(source,i,-x)\n\n else:\n\n # sink\u5074\uff1a\u5272\u3089\u306a\u3044\u3082\u306e\u3092\u8868\u73fe\u3002source\u5074\u306b\u3046\u3064\u3059\u3068\u304d\u306b\u30ab\u30c3\u30c8x\u304c\u5fc5\u8981\u3002\n\n add(i,sink,x)\n\n\n\nfor i in range(1,N+1):\n\n for j in range(i+i,N+1,i):\n\n # i\u3092\u5272\u308b\u306a\u3089j\u3082\u5272\u308b\u3002i\u3092\u5272\u3063\u3066j\u3092\u5272\u3089\u306a\u3044\u306e\u306f\u7981\u6b62\n\n # i\u304csource\u3067j\u304csink\u306a\u306e\u306f\u7981\u6b62\n\n add(i,j,INF)\n\n\n\nf = dinic.max_flow()\n\nx = sum(x for x in A if x >= 0)\n\nanswer = x - f\n\n\n\nprint(answer)","code_v0_loc":48,"code_v1_loc":110,"code_v0_num_chars":1147,"code_v1_num_chars":2963,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom scipy.sparse.csgraph import dijkstra\nimport numpy as np\n\n\"\"\"\n\u6700\u5c0f\u30ab\u30c3\u30c8\n\"\"\"\nN = int(eval(input()))\nstart = 0\ngoal = N + 1\nA = [0] + [int(x) for x in input().split()]\nINF = 10**12\ngraph = np.zeros((N + 2, N + 2), dtype=np.int64)\nfor i, a in enumerate(A[1:], 1):\n if a >= 0:\n graph[start, i] = a\n else:\n graph[i, goal] = -a\nfor i in range(1, N + 1):\n for j in range(2 * i, N + 1, i):\n if A[i] < 0 and A[j] > 0:\n graph[j][i] = INF\n\n\ndef max_flow(graph):\n flow = 0\n while True:\n dist, pred = dijkstra(\n graph, indices=start, return_predecessors=True, unweighted=True\n )\n if dist[goal] == np.inf:\n return flow\n path = []\n v = goal\n while True:\n path.append((pred[v], v))\n v = pred[v]\n if v == start:\n break\n add_flow = min(graph[x][y] for x, y in path)\n for x, y in path:\n graph[x][y] -= add_flow\n graph[y][x] += add_flow\n flow += add_flow\n\n\nanswer = sum(x for x in A if x > 0) - max_flow(graph)\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom collections import deque\n\nN, *A = list(map(int, read().split()))\n\n\nclass Dinic:\n def __init__(self, N, source, sink):\n self.N = N\n self.G = [[] for _ in range(N)]\n self.source = source\n self.sink = sink\n\n def add_edge(self, fr, to, cap):\n n1 = len(self.G[fr])\n n2 = len(self.G[to])\n self.G[fr].append([to, cap, n2])\n self.G[to].append([fr, 0, n1]) # \u9006\u8fba\u3092 cap 0 \u3067\u8ffd\u52a0\n\n def add_edge_undirected(self, fr, to, cap):\n n1 = len(self.G[fr])\n n2 = len(self.G[to])\n self.G[fr].append([to, cap, n2])\n self.G[to].append([fr, cap, n1])\n\n def bfs(self):\n level = [0] * self.N\n G = self.G\n source = self.source\n sink = self.sink\n q = deque([source])\n level[source] = 1\n pop = q.popleft\n append = q.append\n while q:\n v = pop()\n lv = level[v] + 1\n for to, cap, rev in G[v]:\n if not cap:\n continue\n if level[to]:\n continue\n level[to] = lv\n if to == sink:\n self.level = level\n return\n append(to)\n self.level = level\n\n def dfs(self, v, f):\n if v == self.sink:\n return f\n G = self.G\n prog = self.progress\n level = self.level\n lv = level[v]\n E = G[v]\n for i in range(prog[v], len(E)):\n to, cap, rev = E[i]\n prog[v] = i\n if not cap:\n continue\n if level[to] <= lv:\n continue\n x = f if f < cap else cap\n ff = self.dfs(to, x)\n if ff:\n E[i][1] -= ff\n G[to][rev][1] += ff\n return ff\n return 0\n\n def max_flow(self):\n INF = 10**18\n flow = 0\n while True:\n self.bfs()\n if not self.level[self.sink]:\n return flow\n self.progress = [0] * self.N\n while True:\n f = self.dfs(self.source, INF)\n if not f:\n break\n flow += f\n return flow\n\n\nsource = 0\nsink = N + 1\nINF = 10**18\ndinic = Dinic(N + 2, source, sink)\nadd = dinic.add_edge\nfor i, x in enumerate(A, 1):\n if x < 0:\n # source\u5074\uff1a\u5272\u308b\u3082\u306e\u3092\u8868\u73fe\u3002sink\u5074\u306b\u3046\u3064\u3059\u3068\u304d\u306b\u30ab\u30c3\u30c8-x\u304c\u5fc5\u8981\u3002\n add(source, i, -x)\n else:\n # sink\u5074\uff1a\u5272\u3089\u306a\u3044\u3082\u306e\u3092\u8868\u73fe\u3002source\u5074\u306b\u3046\u3064\u3059\u3068\u304d\u306b\u30ab\u30c3\u30c8x\u304c\u5fc5\u8981\u3002\n add(i, sink, x)\nfor i in range(1, N + 1):\n for j in range(i + i, N + 1, i):\n # i\u3092\u5272\u308b\u306a\u3089j\u3082\u5272\u308b\u3002i\u3092\u5272\u3063\u3066j\u3092\u5272\u3089\u306a\u3044\u306e\u306f\u7981\u6b62\n # i\u304csource\u3067j\u304csink\u306a\u306e\u306f\u7981\u6b62\n add(i, j, INF)\nf = dinic.max_flow()\nx = sum(x for x in A if x >= 0)\nanswer = x - f\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":56.3636363636,"diff":["-input = sys.stdin.readline","-from scipy.sparse.csgraph import dijkstra","-import numpy as np","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+from collections import deque","-\"\"\"","-\u6700\u5c0f\u30ab\u30c3\u30c8","-\"\"\"","-N = int(eval(input()))","-start = 0","-goal = N + 1","-A = [0] + [int(x) for x in input().split()]","-INF = 10**12","-graph = np.zeros((N + 2, N + 2), dtype=np.int64)","-for i, a in enumerate(A[1:], 1):","- if a >= 0:","- graph[start, i] = a","- else:","- graph[i, goal] = -a","-for i in range(1, N + 1):","- for j in range(2 * i, N + 1, i):","- if A[i] < 0 and A[j] > 0:","- graph[j][i] = INF","+N, *A = list(map(int, read().split()))","-def max_flow(graph):","- flow = 0","- while True:","- dist, pred = dijkstra(","- graph, indices=start, return_predecessors=True, unweighted=True","- )","- if dist[goal] == np.inf:","- return flow","- path = []","- v = goal","+class Dinic:","+ def __init__(self, N, source, sink):","+ self.N = N","+ self.G = [[] for _ in range(N)]","+ self.source = source","+ self.sink = sink","+","+ def add_edge(self, fr, to, cap):","+ n1 = len(self.G[fr])","+ n2 = len(self.G[to])","+ self.G[fr].append([to, cap, n2])","+ self.G[to].append([fr, 0, n1]) # \u9006\u8fba\u3092 cap 0 \u3067\u8ffd\u52a0","+","+ def add_edge_undirected(self, fr, to, cap):","+ n1 = len(self.G[fr])","+ n2 = len(self.G[to])","+ self.G[fr].append([to, cap, n2])","+ self.G[to].append([fr, cap, n1])","+","+ def bfs(self):","+ level = [0] * self.N","+ G = self.G","+ source = self.source","+ sink = self.sink","+ q = deque([source])","+ level[source] = 1","+ pop = q.popleft","+ append = q.append","+ while q:","+ v = pop()","+ lv = level[v] + 1","+ for to, cap, rev in G[v]:","+ if not cap:","+ continue","+ if level[to]:","+ continue","+ level[to] = lv","+ if to == sink:","+ self.level = level","+ return","+ append(to)","+ self.level = level","+","+ def dfs(self, v, f):","+ if v == self.sink:","+ return f","+ G = self.G","+ prog = self.progress","+ level = self.level","+ lv = level[v]","+ E = G[v]","+ for i in range(prog[v], len(E)):","+ to, cap, rev = E[i]","+ prog[v] = i","+ if not cap:","+ continue","+ if level[to] <= lv:","+ continue","+ x = f if f < cap else cap","+ ff = self.dfs(to, x)","+ if ff:","+ E[i][1] -= ff","+ G[to][rev][1] += ff","+ return ff","+ return 0","+","+ def max_flow(self):","+ INF = 10**18","+ flow = 0","- path.append((pred[v], v))","- v = pred[v]","- if v == start:","- break","- add_flow = min(graph[x][y] for x, y in path)","- for x, y in path:","- graph[x][y] -= add_flow","- graph[y][x] += add_flow","- flow += add_flow","+ self.bfs()","+ if not self.level[self.sink]:","+ return flow","+ self.progress = [0] * self.N","+ while True:","+ f = self.dfs(self.source, INF)","+ if not f:","+ break","+ flow += f","+ return flow","-answer = sum(x for x in A if x > 0) - max_flow(graph)","+source = 0","+sink = N + 1","+INF = 10**18","+dinic = Dinic(N + 2, source, sink)","+add = dinic.add_edge","+for i, x in enumerate(A, 1):","+ if x < 0:","+ # source\u5074\uff1a\u5272\u308b\u3082\u306e\u3092\u8868\u73fe\u3002sink\u5074\u306b\u3046\u3064\u3059\u3068\u304d\u306b\u30ab\u30c3\u30c8-x\u304c\u5fc5\u8981\u3002","+ add(source, i, -x)","+ else:","+ # sink\u5074\uff1a\u5272\u3089\u306a\u3044\u3082\u306e\u3092\u8868\u73fe\u3002source\u5074\u306b\u3046\u3064\u3059\u3068\u304d\u306b\u30ab\u30c3\u30c8x\u304c\u5fc5\u8981\u3002","+ add(i, sink, x)","+for i in range(1, N + 1):","+ for j in range(i + i, N + 1, i):","+ # i\u3092\u5272\u308b\u306a\u3089j\u3082\u5272\u308b\u3002i\u3092\u5272\u3063\u3066j\u3092\u5272\u3089\u306a\u3044\u306e\u306f\u7981\u6b62","+ # i\u304csource\u3067j\u304csink\u306a\u306e\u306f\u7981\u6b62","+ add(i, j, INF)","+f = dinic.max_flow()","+x = sum(x for x in A if x >= 0)","+answer = x - f"],"diff_only_import_comment":false,"measured_runtime_v0":2.1869269931,"measured_runtime_v1":0.2612461398,"runtime_lift":8.3711361057,"key":["s825327687","s119429791"]} +{"user_id":"u600402037","problem_id":"p02814","language":"python","submission_id_v0":"s318797824","submission_id_v1":"s144298652","cpu_time_v0":728,"cpu_time_v1":566,"memory_v0":25020,"memory_v1":16292,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.25,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\nfrom fractions import gcd\n\nfrom functools import reduce\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN, M = lr()\n\nA = np.array(lr())\n\nB = A \/\/ 2\n\n# B\u306e\u8981\u7d20\u304c\u5168\u30662\u306e\u540c\u3058\u51aa\u4e57\n\n# B\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u308b\n\ndef merge(a, b):\n\n g = gcd(a, b)\n\n a, b = a \/\/ g, b \/\/ g\n\n if a%2 == 0 or b%2 == 0:\n\n return 0\n\n ret = a * b * g\n\n if ret > 10 ** 9:\n\n return 0\n\n return ret\n\n\n\nx = reduce(merge, B)\n\nif x == 0:\n\n answer = 0\n\nelse:\n\n answer = M \/\/ x - M \/\/ (2*x)\n\n\n\nprint(answer)\n\n# 56\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom fractions import gcd\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\n# A \u304c2\u3067\u4f55\u56de\u5272\u308c\u308b\u304b\n\nN, M = lr()\n\nA = lr()\n\nA = [x \/\/ 2 for x in A]\n\ncnt = 0\n\nwhile all(x%2 == 0 for x in A):\n\n cnt += 1\n\n A = [x \/\/ 2 for x in A]\n\n\n\nif any(x%2 == 0 for x in A):\n\n print((0)); exit()\n\n\n\nlcm = 1\n\nfor a in A:\n\n lcm *= a \/\/ gcd(lcm, a)\n\n\n\nanswer = M \/\/ (2 ** cnt * lcm) - M \/\/ (2 ** (cnt+1) * lcm)\n\nprint(answer)\n\n# 21\n","code_v0_loc":32,"code_v1_loc":26,"code_v0_num_chars":585,"code_v1_num_chars":491,"code_v0_no_empty_lines":"import sys\nimport numpy as np\nfrom fractions import gcd\nfrom functools import reduce\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN, M = lr()\nA = np.array(lr())\nB = A \/\/ 2\n# B\u306e\u8981\u7d20\u304c\u5168\u30662\u306e\u540c\u3058\u51aa\u4e57\n# B\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u308b\ndef merge(a, b):\n g = gcd(a, b)\n a, b = a \/\/ g, b \/\/ g\n if a % 2 == 0 or b % 2 == 0:\n return 0\n ret = a * b * g\n if ret > 10**9:\n return 0\n return ret\n\n\nx = reduce(merge, B)\nif x == 0:\n answer = 0\nelse:\n answer = M \/\/ x - M \/\/ (2 * x)\nprint(answer)\n# 56\n","code_v1_no_empty_lines":"import sys\nfrom fractions import gcd\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n# A \u304c2\u3067\u4f55\u56de\u5272\u308c\u308b\u304b\nN, M = lr()\nA = lr()\nA = [x \/\/ 2 for x in A]\ncnt = 0\nwhile all(x % 2 == 0 for x in A):\n cnt += 1\n A = [x \/\/ 2 for x in A]\nif any(x % 2 == 0 for x in A):\n print((0))\n exit()\nlcm = 1\nfor a in A:\n lcm *= a \/\/ gcd(lcm, a)\nanswer = M \/\/ (2**cnt * lcm) - M \/\/ (2 ** (cnt + 1) * lcm)\nprint(answer)\n# 21\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-import numpy as np","-from functools import reduce","+# A \u304c2\u3067\u4f55\u56de\u5272\u308c\u308b\u304b","-A = np.array(lr())","-B = A \/\/ 2","-# B\u306e\u8981\u7d20\u304c\u5168\u30662\u306e\u540c\u3058\u51aa\u4e57","-# B\u306e\u6700\u5c0f\u516c\u500d\u6570\u3092\u6c42\u3081\u308b","-def merge(a, b):","- g = gcd(a, b)","- a, b = a \/\/ g, b \/\/ g","- if a % 2 == 0 or b % 2 == 0:","- return 0","- ret = a * b * g","- if ret > 10**9:","- return 0","- return ret","-","-","-x = reduce(merge, B)","-if x == 0:","- answer = 0","-else:","- answer = M \/\/ x - M \/\/ (2 * x)","+A = lr()","+A = [x \/\/ 2 for x in A]","+cnt = 0","+while all(x % 2 == 0 for x in A):","+ cnt += 1","+ A = [x \/\/ 2 for x in A]","+if any(x % 2 == 0 for x in A):","+ print((0))","+ exit()","+lcm = 1","+for a in A:","+ lcm *= a \/\/ gcd(lcm, a)","+answer = M \/\/ (2**cnt * lcm) - M \/\/ (2 ** (cnt + 1) * lcm)","-# 56","+# 21"],"diff_only_import_comment":false,"measured_runtime_v0":1.3948377199,"measured_runtime_v1":0.2599134052,"runtime_lift":5.3665478273,"key":["s318797824","s144298652"]} +{"user_id":"u145950990","problem_id":"p02552","language":"python","submission_id_v0":"s431367942","submission_id_v1":"s270499104","cpu_time_v0":32,"cpu_time_v1":25,"memory_v0":9148,"memory_v1":9028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.88,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\nprint((0 if x==1 else 1))\n\n# optimized version of the same code:\n","target":"s = eval(input())\n\nif s == '0':\n\n print((1))\n\nelse:\n\n print((0))","code_v0_loc":2,"code_v1_loc":5,"code_v0_num_chars":41,"code_v1_num_chars":56,"code_v0_no_empty_lines":"x = int(eval(input()))\nprint((0 if x == 1 else 1))\n","code_v1_no_empty_lines":"s = eval(input())\nif s == \"0\":\n print((1))\nelse:\n print((0))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-x = int(eval(input()))","-print((0 if x == 1 else 1))","+s = eval(input())","+if s == \"0\":","+ print((1))","+else:","+ print((0))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2680207849,"measured_runtime_v1":0.0548314691,"runtime_lift":4.8880832377,"key":["s431367942","s270499104"]} +{"user_id":"u600065151","problem_id":"p02268","language":"python","submission_id_v0":"s783851867","submission_id_v1":"s366216704","cpu_time_v0":50,"cpu_time_v1":40,"memory_v0":18684,"memory_v1":20588,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef binarySearch():\n\n n = int(eval(input()))\n\n S = set(map(int, input().split()))\n\n q = int(eval(input()))\n\n T = set(map(int, input().split()))\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()\n\n# optimized version of the same code:\n","target":"def binarySearch():\n\n n = int(eval(input()))\n\n S = set(input().split())\n\n q = int(eval(input()))\n\n T = set(input().split())\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":202,"code_v1_num_chars":182,"code_v0_no_empty_lines":"def binarySearch():\n n = int(eval(input()))\n S = set(map(int, input().split()))\n q = int(eval(input()))\n T = set(map(int, input().split()))\n print((len(S.intersection(T))))\n\n\nbinarySearch()\n","code_v1_no_empty_lines":"def binarySearch():\n n = int(eval(input()))\n S = set(input().split())\n q = int(eval(input()))\n T = set(input().split())\n print((len(S.intersection(T))))\n\n\nbinarySearch()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- S = set(map(int, input().split()))","+ S = set(input().split())","- T = set(map(int, input().split()))","+ T = set(input().split())"],"diff_only_import_comment":false,"measured_runtime_v0":0.3310329242,"measured_runtime_v1":0.2247743328,"runtime_lift":1.4727345427,"key":["s783851867","s366216704"]} +{"user_id":"u996434204","problem_id":"p03416","language":"python","submission_id_v0":"s285618885","submission_id_v1":"s172989285","cpu_time_v0":114,"cpu_time_v1":57,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n #print(buf[0:int(len(buf)\/2)],buf[int(len(buf)\/2+1):])\n\n str1=buf[0:int(len(buf)\/2)]\n\n str2=buf[int(len(buf)\/2+1):]\n\n if str1[0]==str2[1] and str1[1]==str2[0]:\n\n ans+=1\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"a,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n str1=buf[::-1]\n\n if buf==str1:\n\n ans+=1\n\n\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":284,"code_v1_num_chars":149,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n buf = str(i)\n # print(buf[0:int(len(buf)\/2)],buf[int(len(buf)\/2+1):])\n str1 = buf[0 : int(len(buf) \/ 2)]\n str2 = buf[int(len(buf) \/ 2 + 1) :]\n if str1[0] == str2[1] and str1[1] == str2[0]:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n buf = str(i)\n str1 = buf[::-1]\n if buf == str1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["- # print(buf[0:int(len(buf)\/2)],buf[int(len(buf)\/2+1):])","- str1 = buf[0 : int(len(buf) \/ 2)]","- str2 = buf[int(len(buf) \/ 2 + 1) :]","- if str1[0] == str2[1] and str1[1] == str2[0]:","+ str1 = buf[::-1]","+ if buf == str1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3597218115,"measured_runtime_v1":0.2724662972,"runtime_lift":1.3202433295,"key":["s285618885","s172989285"]} +{"user_id":"u490553751","problem_id":"p02725","language":"python","submission_id_v0":"s026624237","submission_id_v1":"s811488510","cpu_time_v0":185,"cpu_time_v1":132,"memory_v0":26444,"memory_v1":31604,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.65,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#template\n\ndef inputlist(): return [int(j) for j in input().split()]\n\n#template\n\n#issue\u304b\u3089\u59cb\u3081\u308b\n\nK,N = inputlist()\n\nA = inputlist()\n\nlia = [0]*N\n\nfor i in range(1,N):\n\n k = A[i] - A[i-1]\n\n lia[i] = k\n\nlia[0] = (K+A[0]-A[-1])\n\nlia.sort()\n\nans = 0\n\nfor i in range(N-1):\n\n ans += lia[i]\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"#template\n\ndef inputlist(): return [int(j) for j in input().split()]\n\ndef listinput(): return input().split()\n\n#template\n\nK,N = inputlist()\n\nA = inputlist()\n\ndis = [0]*(N)\n\nfor i in range(N):\n\n if i == N-1:\n\n dis[i] = K+A[0] - A[i]\n\n continue\n\n dis[i] = A[i+1] - A[i]\n\ndis.sort()\n\nprint((sum(dis[:-1])))","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":301,"code_v1_num_chars":321,"code_v0_no_empty_lines":"# template\ndef inputlist():\n return [int(j) for j in input().split()]\n\n\n# template\n# issue\u304b\u3089\u59cb\u3081\u308b\nK, N = inputlist()\nA = inputlist()\nlia = [0] * N\nfor i in range(1, N):\n k = A[i] - A[i - 1]\n lia[i] = k\nlia[0] = K + A[0] - A[-1]\nlia.sort()\nans = 0\nfor i in range(N - 1):\n ans += lia[i]\nprint(ans)\n","code_v1_no_empty_lines":"# template\ndef inputlist():\n return [int(j) for j in input().split()]\n\n\ndef listinput():\n return input().split()\n\n\n# template\nK, N = inputlist()\nA = inputlist()\ndis = [0] * (N)\nfor i in range(N):\n if i == N - 1:\n dis[i] = K + A[0] - A[i]\n continue\n dis[i] = A[i + 1] - A[i]\ndis.sort()\nprint((sum(dis[:-1])))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["+def listinput():","+ return input().split()","+","+","-# issue\u304b\u3089\u59cb\u3081\u308b","-lia = [0] * N","-for i in range(1, N):","- k = A[i] - A[i - 1]","- lia[i] = k","-lia[0] = K + A[0] - A[-1]","-lia.sort()","-ans = 0","-for i in range(N - 1):","- ans += lia[i]","-print(ans)","+dis = [0] * (N)","+for i in range(N):","+ if i == N - 1:","+ dis[i] = K + A[0] - A[i]","+ continue","+ dis[i] = A[i + 1] - A[i]","+dis.sort()","+print((sum(dis[:-1])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3599109902,"measured_runtime_v1":0.2745016385,"runtime_lift":1.3111433221,"key":["s026624237","s811488510"]} +{"user_id":"u600402037","problem_id":"p03000","language":"python","submission_id_v0":"s741155786","submission_id_v1":"s174835156","cpu_time_v0":150,"cpu_time_v1":17,"memory_v0":12508,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN, X = lr()\n\nL = np.array([0] + lr())\n\nLcum = L.cumsum()\n\ni = np.searchsorted(Lcum, X, side='right')\n\nprint(i)\n\n# \n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nimport sys\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN, X = lr()\n\nL = lr()\n\ncnt = 1\n\ncur = 0\n\nfor l in L: \n\n cur += l\n\n if cur > X:\n\n break\n\n cnt += 1\n\n\n\nanswer = cnt\n\nprint(answer)\n","code_v0_loc":13,"code_v1_loc":19,"code_v0_num_chars":261,"code_v1_num_chars":291,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN, X = lr()\nL = np.array([0] + lr())\nLcum = L.cumsum()\ni = np.searchsorted(Lcum, X, side=\"right\")\nprint(i)\n#\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN, X = lr()\nL = lr()\ncnt = 1\ncur = 0\nfor l in L:\n cur += l\n if cur > X:\n break\n cnt += 1\nanswer = cnt\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":31.5789473684,"diff":["+# coding: utf-8","-import numpy as np","-L = np.array([0] + lr())","-Lcum = L.cumsum()","-i = np.searchsorted(Lcum, X, side=\"right\")","-print(i)","-#","+L = lr()","+cnt = 1","+cur = 0","+for l in L:","+ cur += l","+ if cur > X:","+ break","+ cnt += 1","+answer = cnt","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":1.5985637542,"measured_runtime_v1":0.2292145673,"runtime_lift":6.9740931968,"key":["s741155786","s174835156"]} +{"user_id":"u624696727","problem_id":"p02767","language":"python","submission_id_v0":"s619004796","submission_id_v1":"s352340154","cpu_time_v0":149,"cpu_time_v1":21,"memory_v0":12220,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nint1 = lambda x: int(x) - 1\n\nprintV = lambda x: print(*x, sep=\"\\n\")\n\nprintH = lambda x: print(\" \".join(map(str,x)))\n\ndef IS(): return sys.stdin.readline()[:-1]\n\ndef II(): return int(sys.stdin.readline())\n\ndef MI(): return map(int, sys.stdin.readline().split())\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef LI1(): return list(map(int1, sys.stdin.readline().split()))\n\ndef LII(rows_number): return [II() for _ in range(rows_number)]\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef LLI1(rows_number): return [LI1() for _ in range(rows_number)]\n\n\n\ndef main():\n\n\tN = II()\n\n\tX = LI()\n\n\tX = np.array(X)\n\n\tm = round(np.sum(X) \/ N)\n\n\tprint(int(np.sum((X-m)**2)))\n\n\n\nif __name__ == '__main__':\n\n\tmain()\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nint1 = lambda x: int(x) - 1\n\nprintV = lambda x: print(*x, sep=\"\\n\")\n\nprintH = lambda x: print(\" \".join(map(str,x)))\n\ndef IS(): return sys.stdin.readline()[:-1]\n\ndef II(): return int(sys.stdin.readline())\n\ndef MI(): return map(int, sys.stdin.readline().split())\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef LI1(): return list(map(int1, sys.stdin.readline().split()))\n\ndef LII(rows_number): return [II() for _ in range(rows_number)]\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef LLI1(rows_number): return [LI1() for _ in range(rows_number)]\n\n\n\ndef main():\n\n\tN = II()\n\n\tX = LI()\n\n\tm = round(sum(X) \/ N)\n\n\tans = 0\n\n\tfor x in X:\n\n\t\tans += ((x-m)**2)\n\n\tprint(ans)\n\n\n\nif __name__ == '__main__':\n\n\tmain()\n","code_v0_loc":25,"code_v1_loc":26,"code_v0_num_chars":803,"code_v1_num_chars":789,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nsys.setrecursionlimit(10**6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep=\"\\n\")\nprintH = lambda x: print(\" \".join(map(str, x)))\n\n\ndef IS():\n return sys.stdin.readline()[:-1]\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef MI():\n return map(int, sys.stdin.readline().split())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LI1():\n return list(map(int1, sys.stdin.readline().split()))\n\n\ndef LII(rows_number):\n return [II() for _ in range(rows_number)]\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef LLI1(rows_number):\n return [LI1() for _ in range(rows_number)]\n\n\ndef main():\n N = II()\n X = LI()\n X = np.array(X)\n m = round(np.sum(X) \/ N)\n print(int(np.sum((X - m) ** 2)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep=\"\\n\")\nprintH = lambda x: print(\" \".join(map(str, x)))\n\n\ndef IS():\n return sys.stdin.readline()[:-1]\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef MI():\n return map(int, sys.stdin.readline().split())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LI1():\n return list(map(int1, sys.stdin.readline().split()))\n\n\ndef LII(rows_number):\n return [II() for _ in range(rows_number)]\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef LLI1(rows_number):\n return [LI1() for _ in range(rows_number)]\n\n\ndef main():\n N = II()\n X = LI()\n m = round(sum(X) \/ N)\n ans = 0\n for x in X:\n ans += (x - m) ** 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.8461538462,"diff":["-import numpy as np","- X = np.array(X)","- m = round(np.sum(X) \/ N)","- print(int(np.sum((X - m) ** 2)))","+ m = round(sum(X) \/ N)","+ ans = 0","+ for x in X:","+ ans += (x - m) ** 2","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.5154907587,"measured_runtime_v1":0.201975739,"runtime_lift":7.5033306776,"key":["s619004796","s352340154"]} +{"user_id":"u537976628","problem_id":"p03720","language":"python","submission_id_v0":"s957846271","submission_id_v1":"s235024999","cpu_time_v0":28,"cpu_time_v1":25,"memory_v0":9128,"memory_v1":9136,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, m = list(map(int, input().split()))\n\nRD = list(list(map(int, input().split())) for _ in range(m))\n\nfor i in range(1, n + 1):\n\n ans = 0\n\n for j in RD:\n\n ans += j.count(i)\n\n print(ans)\n\n# optimized version of the same code:\n","target":"n, m = list(map(int, input().split()))\n\nNRD = list(0 for i in range(n))\n\nfor i in range(m):\n\n r1, r2 = list(map(int, input().split()))\n\n NRD[r1 - 1] += 1\n\n NRD[r2 - 1] += 1\n\nfor i in range(n):\n\n print((NRD[i]))","code_v0_loc":7,"code_v1_loc":8,"code_v0_num_chars":195,"code_v1_num_chars":208,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nRD = list(list(map(int, input().split())) for _ in range(m))\nfor i in range(1, n + 1):\n ans = 0\n for j in RD:\n ans += j.count(i)\n print(ans)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nNRD = list(0 for i in range(n))\nfor i in range(m):\n r1, r2 = list(map(int, input().split()))\n NRD[r1 - 1] += 1\n NRD[r2 - 1] += 1\nfor i in range(n):\n print((NRD[i]))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-RD = list(list(map(int, input().split())) for _ in range(m))","-for i in range(1, n + 1):","- ans = 0","- for j in RD:","- ans += j.count(i)","- print(ans)","+NRD = list(0 for i in range(n))","+for i in range(m):","+ r1, r2 = list(map(int, input().split()))","+ NRD[r1 - 1] += 1","+ NRD[r2 - 1] += 1","+for i in range(n):","+ print((NRD[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2888841586,"measured_runtime_v1":0.0609361191,"runtime_lift":4.7407705467,"key":["s957846271","s235024999"]} +{"user_id":"u393253137","problem_id":"p03371","language":"python","submission_id_v0":"s794256283","submission_id_v1":"s949005771","cpu_time_v0":118,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nfor HaH in range(0,2*max(x,y)+1,2):\n\n ans = min(ans, c*HaH+max(0, a*(x-HaH\/\/2))+max(0, b*(y-HaH\/\/2)))\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"a,b,c,x,y=list(map(int,input().split()))\n\nans=0\n\nm=min(x,y)\n\nif a+b>=2*c: #Half and Half\u8cfc\u5165\u3067\u5b89\u304f\u306a\u308b\u53ef\u80fd\u6027\u3042\u308b\u30d1\u30bf\u30fc\u30f3\n\n # HaH\u3092m\u679a\u8cb7\u3063\u3066\u6b8b\u308aHaH\u8cfc\u5165,\u307e\u305f\u306f\u5168\u90e8HaH\u8cfc\u5165,\u3053\u306e\u3044\u305a\u308c\u304b\u3057\u304b\u3042\u308a\u5f97\u306a\u3044\n\n ans = min(2*c*m+a*(x-m)+b*(y-m), 2*c*max(x,y))\n\nelse:\n\n ans = a*x+b*y\n\nprint(ans)","code_v0_loc":5,"code_v1_loc":9,"code_v0_num_chars":165,"code_v1_num_chars":237,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nfor HaH in range(0, 2 * max(x, y) + 1, 2):\n ans = min(ans, c * HaH + max(0, a * (x - HaH \/\/ 2)) + max(0, b * (y - HaH \/\/ 2)))\nprint(ans)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = 0\nm = min(x, y)\nif a + b >= 2 * c: # Half and Half\u8cfc\u5165\u3067\u5b89\u304f\u306a\u308b\u53ef\u80fd\u6027\u3042\u308b\u30d1\u30bf\u30fc\u30f3\n # HaH\u3092m\u679a\u8cb7\u3063\u3066\u6b8b\u308aHaH\u8cfc\u5165,\u307e\u305f\u306f\u5168\u90e8HaH\u8cfc\u5165,\u3053\u306e\u3044\u305a\u308c\u304b\u3057\u304b\u3042\u308a\u5f97\u306a\u3044\n ans = min(2 * c * m + a * (x - m) + b * (y - m), 2 * c * max(x, y))\nelse:\n ans = a * x + b * y\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-ans = a * x + b * y","-for HaH in range(0, 2 * max(x, y) + 1, 2):","- ans = min(ans, c * HaH + max(0, a * (x - HaH \/\/ 2)) + max(0, b * (y - HaH \/\/ 2)))","+ans = 0","+m = min(x, y)","+if a + b >= 2 * c: # Half and Half\u8cfc\u5165\u3067\u5b89\u304f\u306a\u308b\u53ef\u80fd\u6027\u3042\u308b\u30d1\u30bf\u30fc\u30f3","+ # HaH\u3092m\u679a\u8cb7\u3063\u3066\u6b8b\u308aHaH\u8cfc\u5165,\u307e\u305f\u306f\u5168\u90e8HaH\u8cfc\u5165,\u3053\u306e\u3044\u305a\u308c\u304b\u3057\u304b\u3042\u308a\u5f97\u306a\u3044","+ ans = min(2 * c * m + a * (x - m) + b * (y - m), 2 * c * max(x, y))","+else:","+ ans = a * x + b * y"],"diff_only_import_comment":false,"measured_runtime_v0":0.479530653,"measured_runtime_v1":0.260008795,"runtime_lift":1.8442862786,"key":["s794256283","s949005771"]} +{"user_id":"u600402037","problem_id":"p02994","language":"python","submission_id_v0":"s047908470","submission_id_v1":"s794089628","cpu_time_v0":151,"cpu_time_v1":17,"memory_v0":14456,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN, L = lr()\n\nA = np.arange(1, N+1)\n\nA += (L - 1)\n\nanswer = A.sum() - A[np.argmin(np.abs(A))]\n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN, L = lr()\n\ntotal = sum(range(L, L+N))\n\nsub = min(list(range(L, L+N)), key=abs)\n\nprint((total-sub))\n","code_v0_loc":12,"code_v1_loc":10,"code_v0_num_chars":254,"code_v1_num_chars":220,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN, L = lr()\nA = np.arange(1, N + 1)\nA += L - 1\nanswer = A.sum() - A[np.argmin(np.abs(A))]\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN, L = lr()\ntotal = sum(range(L, L + N))\nsub = min(list(range(L, L + N)), key=abs)\nprint((total - sub))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-import numpy as np","-A = np.arange(1, N + 1)","-A += L - 1","-answer = A.sum() - A[np.argmin(np.abs(A))]","-print(answer)","+total = sum(range(L, L + N))","+sub = min(list(range(L, L + N)), key=abs)","+print((total - sub))"],"diff_only_import_comment":false,"measured_runtime_v0":1.7525720541,"measured_runtime_v1":0.2779020016,"runtime_lift":6.3064391184,"key":["s047908470","s794089628"]} +{"user_id":"u892487306","problem_id":"p03078","language":"python","submission_id_v0":"s223961880","submission_id_v1":"s091600532","cpu_time_v0":1331,"cpu_time_v1":35,"memory_v0":130692,"memory_v1":5012,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":97.37,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split(' ')))\n\n A = np.array(list(map(int, input().split(' '))))\n\n B = np.array(list(map(int, input().split(' '))))\n\n C = np.array(list(map(int, input().split(' '))))\n\n AB = np.array(np.meshgrid(A, B)).T.reshape(-1, 2).sum(axis=1)\n\n AB[::-1].sort()\n\n AB = AB[:min([K, X * Y])]\n\n ABC = np.array(np.meshgrid(AB, C)).T.reshape(-1, 2).sum(axis=1)\n\n ABC[::-1].sort()\n\n for ans in ABC[:K]:\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"from heapq import heappush, heappop\n\nfrom collections import defaultdict\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split(' ')))\n\n A = list(map(int, input().split(' ')))\n\n B = list(map(int, input().split(' ')))\n\n C = list(map(int, input().split(' ')))\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n que = [(- A[0] - B[0] - C[0], 0, 0, 0)] # multiply -1 to change min to max\n\n already_inserted = defaultdict(int)\n\n answer = list()\n\n for _ in range(K):\n\n q, i, j, k = heappop(que)\n\n answer.append(-q)\n\n if i + 1 < X:\n\n item_a = (- A[i + 1] - B[j] - C[k], i + 1, j, k)\n\n if already_inserted[item_a] == 0:\n\n heappush(que, item_a)\n\n already_inserted[item_a] = 1\n\n if j + 1 < Y:\n\n item_b = (- A[i] - B[j + 1] - C[k], i, j + 1, k)\n\n if already_inserted[item_b] == 0:\n\n heappush(que, item_b)\n\n already_inserted[item_b] = 1\n\n if k + 1 < Z:\n\n item_c = (- A[i] - B[j] - C[k + 1], i, j, k + 1)\n\n if already_inserted[item_c] == 0:\n\n heappush(que, item_c)\n\n already_inserted[item_c] = 1\n\n for ans in answer:\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":19,"code_v1_loc":39,"code_v0_num_chars":549,"code_v1_num_chars":1320,"code_v0_no_empty_lines":"import numpy as np\n\n\ndef main():\n X, Y, Z, K = list(map(int, input().split(\" \")))\n A = np.array(list(map(int, input().split(\" \"))))\n B = np.array(list(map(int, input().split(\" \"))))\n C = np.array(list(map(int, input().split(\" \"))))\n AB = np.array(np.meshgrid(A, B)).T.reshape(-1, 2).sum(axis=1)\n AB[::-1].sort()\n AB = AB[: min([K, X * Y])]\n ABC = np.array(np.meshgrid(AB, C)).T.reshape(-1, 2).sum(axis=1)\n ABC[::-1].sort()\n for ans in ABC[:K]:\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from heapq import heappush, heappop\nfrom collections import defaultdict\n\n\ndef main():\n X, Y, Z, K = list(map(int, input().split(\" \")))\n A = list(map(int, input().split(\" \")))\n B = list(map(int, input().split(\" \")))\n C = list(map(int, input().split(\" \")))\n A.sort(reverse=True)\n B.sort(reverse=True)\n C.sort(reverse=True)\n que = [(-A[0] - B[0] - C[0], 0, 0, 0)] # multiply -1 to change min to max\n already_inserted = defaultdict(int)\n answer = list()\n for _ in range(K):\n q, i, j, k = heappop(que)\n answer.append(-q)\n if i + 1 < X:\n item_a = (-A[i + 1] - B[j] - C[k], i + 1, j, k)\n if already_inserted[item_a] == 0:\n heappush(que, item_a)\n already_inserted[item_a] = 1\n if j + 1 < Y:\n item_b = (-A[i] - B[j + 1] - C[k], i, j + 1, k)\n if already_inserted[item_b] == 0:\n heappush(que, item_b)\n already_inserted[item_b] = 1\n if k + 1 < Z:\n item_c = (-A[i] - B[j] - C[k + 1], i, j, k + 1)\n if already_inserted[item_c] == 0:\n heappush(que, item_c)\n already_inserted[item_c] = 1\n for ans in answer:\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":51.2820512821,"diff":["-import numpy as np","+from heapq import heappush, heappop","+from collections import defaultdict","- A = np.array(list(map(int, input().split(\" \"))))","- B = np.array(list(map(int, input().split(\" \"))))","- C = np.array(list(map(int, input().split(\" \"))))","- AB = np.array(np.meshgrid(A, B)).T.reshape(-1, 2).sum(axis=1)","- AB[::-1].sort()","- AB = AB[: min([K, X * Y])]","- ABC = np.array(np.meshgrid(AB, C)).T.reshape(-1, 2).sum(axis=1)","- ABC[::-1].sort()","- for ans in ABC[:K]:","+ A = list(map(int, input().split(\" \")))","+ B = list(map(int, input().split(\" \")))","+ C = list(map(int, input().split(\" \")))","+ A.sort(reverse=True)","+ B.sort(reverse=True)","+ C.sort(reverse=True)","+ que = [(-A[0] - B[0] - C[0], 0, 0, 0)] # multiply -1 to change min to max","+ already_inserted = defaultdict(int)","+ answer = list()","+ for _ in range(K):","+ q, i, j, k = heappop(que)","+ answer.append(-q)","+ if i + 1 < X:","+ item_a = (-A[i + 1] - B[j] - C[k], i + 1, j, k)","+ if already_inserted[item_a] == 0:","+ heappush(que, item_a)","+ already_inserted[item_a] = 1","+ if j + 1 < Y:","+ item_b = (-A[i] - B[j + 1] - C[k], i, j + 1, k)","+ if already_inserted[item_b] == 0:","+ heappush(que, item_b)","+ already_inserted[item_b] = 1","+ if k + 1 < Z:","+ item_c = (-A[i] - B[j] - C[k + 1], i, j, k + 1)","+ if already_inserted[item_c] == 0:","+ heappush(que, item_c)","+ already_inserted[item_c] = 1","+ for ans in answer:"],"diff_only_import_comment":false,"measured_runtime_v0":1.8347421198,"measured_runtime_v1":0.2379373548,"runtime_lift":7.7110301627,"key":["s223961880","s091600532"]} +{"user_id":"u298297089","problem_id":"p03325","language":"python","submission_id_v0":"s106132375","submission_id_v1":"s827937559","cpu_time_v0":122,"cpu_time_v1":72,"memory_v0":4148,"memory_v1":3828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.98,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nx = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in x:\n\n while i % 2 == 0:\n\n cnt += 1\n\n i \/= 2\n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nans = 0\n\nfor i in map(int, input().split()):\n\n cnt = 0\n\n while i % 2 == 0:\n\n i >>= 1\n\n cnt += 1\n\n ans += cnt\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":9,"code_v0_num_chars":134,"code_v1_num_chars":161,"code_v0_no_empty_lines":"N = int(eval(input()))\nx = list(map(int, input().split()))\ncnt = 0\nfor i in x:\n while i % 2 == 0:\n cnt += 1\n i \/= 2\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = 0\nfor i in map(int, input().split()):\n cnt = 0\n while i % 2 == 0:\n i >>= 1\n cnt += 1\n ans += cnt\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-N = int(eval(input()))","-x = list(map(int, input().split()))","-cnt = 0","-for i in x:","+n = int(eval(input()))","+ans = 0","+for i in map(int, input().split()):","+ cnt = 0","+ i >>= 1","- i \/= 2","-print(cnt)","+ ans += cnt","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2336064763,"measured_runtime_v1":0.0059840708,"runtime_lift":39.0380536239,"key":["s106132375","s827937559"]} +{"user_id":"u600402037","problem_id":"p03273","language":"python","submission_id_v0":"s376562926","submission_id_v1":"s211637431","cpu_time_v0":153,"cpu_time_v1":21,"memory_v0":12680,"memory_v1":4468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# coding: utf-8\n\nimport sys\n\nimport numpy as np\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nH, W = lr()\n\nB = np.array([list(sr()) for _ in range(H)])\n\nA = [[1 if x == '#' else 0 for x in b] for b in B]\n\nrow = np.sum(A, axis=1)\n\ncolumn = np.sum(A, axis=0)\n\nr = row != 0\n\nc = column != 0\n\nanswer = B[r]\n\nanswer = answer[:, c].tolist()\n\nfor a in answer:\n\n print((''.join(a)))\n\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nimport sys\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nH, W = lr()\n\nA = [sr() for _ in range(H)]\n\nB = []\n\nfor a in A:\n\n if '#' in a:\n\n B.append(a)\n\n\n\nB = zip(*[b for b in zip(*B) if '#' in b])\n\nfor b in B:\n\n print(*b, sep='')\n","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":446,"code_v1_num_chars":328,"code_v0_no_empty_lines":"# coding: utf-8\nimport sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nH, W = lr()\nB = np.array([list(sr()) for _ in range(H)])\nA = [[1 if x == \"#\" else 0 for x in b] for b in B]\nrow = np.sum(A, axis=1)\ncolumn = np.sum(A, axis=0)\nr = row != 0\nc = column != 0\nanswer = B[r]\nanswer = answer[:, c].tolist()\nfor a in answer:\n print((\"\".join(a)))\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nH, W = lr()\nA = [sr() for _ in range(H)]\nB = []\nfor a in A:\n if \"#\" in a:\n B.append(a)\nB = zip(*[b for b in zip(*B) if \"#\" in b])\nfor b in B:\n print(*b, sep=\"\")\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-import numpy as np","-B = np.array([list(sr()) for _ in range(H)])","-A = [[1 if x == \"#\" else 0 for x in b] for b in B]","-row = np.sum(A, axis=1)","-column = np.sum(A, axis=0)","-r = row != 0","-c = column != 0","-answer = B[r]","-answer = answer[:, c].tolist()","-for a in answer:","- print((\"\".join(a)))","+A = [sr() for _ in range(H)]","+B = []","+for a in A:","+ if \"#\" in a:","+ B.append(a)","+B = zip(*[b for b in zip(*B) if \"#\" in b])","+for b in B:","+ print(*b, sep=\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":1.2545773008,"measured_runtime_v1":0.1868477131,"runtime_lift":6.7144375496,"key":["s376562926","s211637431"]} +{"user_id":"u488401358","problem_id":"p02649","language":"python","submission_id_v0":"s231020544","submission_id_v1":"s831601953","cpu_time_v0":688,"cpu_time_v1":413,"memory_v0":76468,"memory_v1":102912,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.97,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50 and j!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\nfor i in range(2**n):\n\n t=set([])\n\n for a in A:\n\n data[a&i]+=1\n\n t.add(a&i)\n\n temp=0\n\n for val in t:\n\n temp+=cmb[data[val]][min(K,data[val])]\n\n ans+=temp*(-1)**popcount(i)\n\n for val in t:\n\n data[val]=0\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"def popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n if j!=50 and i!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nimport random\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\npc=[popcount(i) for i in range(2**n)]\n\nfor i in range(2**n):\n\n for a in A:\n\n data[a&i]+=1\n\n for a in A:\n\n if data[a&i]:\n\n ans+=cmb[data[a&i]][min(K,data[a&i])]*(-1)**pc[i]\n\n data[a&i]=0\n\n\n\nprint(ans)","code_v0_loc":68,"code_v1_loc":67,"code_v0_num_chars":1445,"code_v1_num_chars":1441,"code_v0_no_empty_lines":"def popcount(x):\n x = x - ((x >> 1) & 0x55555555)\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0F0F0F0F\n x = x + (x >> 8)\n x = x + (x >> 16)\n return x & 0x0000007F\n\n\ncmb = [[0 for i in range(51)] for j in range(51)]\ncmb[0][0] = 1\nfor i in range(51):\n for j in range(51):\n if i != 50 and j != 50:\n cmb[i + 1][j + 1] += cmb[i][j]\n if i != 50:\n cmb[i + 1][j] += cmb[i][j]\nfor i in range(1, 51):\n for j in range(2, 51):\n cmb[i][j] += cmb[i][j - 1]\nN, K, T, S = list(map(int, input().split()))\na = list(map(int, input().split()))\nmust0 = [i for i in range(18) if S >> i & 1 == 0]\nmust1 = [i for i in range(18) if T >> i & 1 == 1]\nA = []\nfor val in a:\n check = True\n for j in must0:\n check = check & (val >> j & 1 == 0)\n for j in must1:\n check = check & (val >> j & 1 == 1)\n if check:\n A.append(val)\nif not A:\n print((0))\n exit()\nbit = []\nfor i in range(18):\n if i not in must0 and i not in must1:\n bit.append(i)\nfor i in range(len(A)):\n temp = 0\n for j in range(len(bit)):\n temp += (A[i] >> bit[j] & 1 == 1) * 2**j\n A[i] = temp\nans = 0\nn = len(bit)\ndata = [0] * (2**n)\nfor i in range(2**n):\n t = set([])\n for a in A:\n data[a & i] += 1\n t.add(a & i)\n temp = 0\n for val in t:\n temp += cmb[data[val]][min(K, data[val])]\n ans += temp * (-1) ** popcount(i)\n for val in t:\n data[val] = 0\nprint(ans)\n","code_v1_no_empty_lines":"def popcount(x):\n x = x - ((x >> 1) & 0x55555555)\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0F0F0F0F\n x = x + (x >> 8)\n x = x + (x >> 16)\n return x & 0x0000007F\n\n\ncmb = [[0 for i in range(51)] for j in range(51)]\ncmb[0][0] = 1\nfor i in range(51):\n for j in range(51):\n if i != 50:\n cmb[i + 1][j] += cmb[i][j]\n if j != 50 and i != 50:\n cmb[i + 1][j + 1] += cmb[i][j]\nfor i in range(1, 51):\n for j in range(2, 51):\n cmb[i][j] += cmb[i][j - 1]\nimport random\n\nN, K, T, S = list(map(int, input().split()))\na = list(map(int, input().split()))\nmust0 = [i for i in range(18) if S >> i & 1 == 0]\nmust1 = [i for i in range(18) if T >> i & 1 == 1]\nA = []\nfor val in a:\n check = True\n for j in must0:\n check = check & (val >> j & 1 == 0)\n for j in must1:\n check = check & (val >> j & 1 == 1)\n if check:\n A.append(val)\nif not A:\n print((0))\n exit()\nbit = []\nfor i in range(18):\n if i not in must0 and i not in must1:\n bit.append(i)\nfor i in range(len(A)):\n temp = 0\n for j in range(len(bit)):\n temp += (A[i] >> bit[j] & 1 == 1) * 2**j\n A[i] = temp\nans = 0\nn = len(bit)\ndata = [0] * (2**n)\npc = [popcount(i) for i in range(2**n)]\nfor i in range(2**n):\n for a in A:\n data[a & i] += 1\n for a in A:\n if data[a & i]:\n ans += cmb[data[a & i]][min(K, data[a & i])] * (-1) ** pc[i]\n data[a & i] = 0\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":1.4705882353,"diff":["- if i != 50 and j != 50:","- cmb[i + 1][j + 1] += cmb[i][j]","+ if j != 50 and i != 50:","+ cmb[i + 1][j + 1] += cmb[i][j]","+import random","+","+pc = [popcount(i) for i in range(2**n)]","- t = set([])","- t.add(a & i)","- temp = 0","- for val in t:","- temp += cmb[data[val]][min(K, data[val])]","- ans += temp * (-1) ** popcount(i)","- for val in t:","- data[val] = 0","+ for a in A:","+ if data[a & i]:","+ ans += cmb[data[a & i]][min(K, data[a & i])] * (-1) ** pc[i]","+ data[a & i] = 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.3163019059,"measured_runtime_v1":0.2340069544,"runtime_lift":1.3516773748,"key":["s231020544","s831601953"]} +{"user_id":"u324314500","problem_id":"p03078","language":"python","submission_id_v0":"s506003546","submission_id_v1":"s782884160","cpu_time_v0":751,"cpu_time_v1":520,"memory_v0":49756,"memory_v1":66776,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.76,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n#import numpy as np\n\n\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\n\nss2nn = lambda ss: [int(s) for s in ss]\n\nss2nnn = lambda ss: [s2nn(s) for s in ss]\n\ni2s = lambda: sys.stdin.readline().rstrip()\n\ni2n = lambda: int(i2s())\n\ni2nn = lambda: s2nn(i2s())\n\nii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]\n\nii2nn = lambda n: ss2nn(ii2ss(n))\n\nii2nnn = lambda n: ss2nnn(ii2ss(n))\n\n\n\nN = 10000\n\ndef tokey(i, j, k):\n\n return i*N*N + j*N + k\n\ndef dekey(n):\n\n i = int(n \/ N \/ N)\n\n j = int(n \/ N) % N\n\n k = n % N\n\n return i, j, k\n\n\n\ndef main():\n\n X, Y, Z, K = i2nn()\n\n A = i2nn()\n\n B = i2nn()\n\n C = i2nn()\n\n A.sort()\n\n A.reverse()\n\n B.sort()\n\n B.reverse()\n\n C.sort()\n\n C.reverse()\n\n Q = [(A[0] + B[0] + C[0], 0, 0, 0)]\n\n loop = 0\n\n stored = set()\n\n def next(i, j, k):\n\n if i >= X or j >= Y or k >= Z:\n\n return\n\n key = tokey(i, j, k)\n\n if key not in stored:\n\n stored.add(key)\n\n n = A[i] + B[j] + C[k]\n\n Q.append((n, i, j, k))\n\n while True:\n\n v = max(Q, key=lambda v: v[0])\n\n Q.remove(v)\n\n print((v[0]))\n\n loop += 1\n\n if loop >= K:\n\n break\n\n next(v[1]+1, v[2], v[3])\n\n next(v[1], v[2]+1, v[3])\n\n next(v[1], v[2], v[3]+1)\n\n\n\nmain()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom collections import deque # \u53cc\u65b9\u5411\u30ad\u30e5\u30fc\n\nfrom collections import defaultdict # \u521d\u671f\u5316\u6e08\u307f\u8f9e\u66f8\n\nfrom heapq import heapify, heappush, heappop, heappushpop # \u30d7\u30e9\u30a4\u30aa\u30ea\u30c6\u30a3\u30ad\u30e5\u30fc\n\nfrom bisect import bisect_left, bisect_right # \u4e8c\u5206\u63a2\u7d22\n\n#import numpy as np # 1.8.2\n\n#import scipy # 0.13.3\n\n#sys.setrecursionlimit(int(1e+6))\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\n\nss2nn = lambda ss: [int(s) for s in ss]\n\nss2nnn = lambda ss: [s2nn(s) for s in ss]\n\ni2s = lambda: sys.stdin.readline().rstrip()\n\ni2n = lambda: int(i2s())\n\ni2nn = lambda: s2nn(i2s())\n\nii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]\n\nii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]\n\nii2nn = lambda n: ss2nn(ii2ss(n))\n\nii2nnn = lambda n: ss2nnn(ii2ss(n))\n\nMOD = int(1e+9) + 7\n\n\n\ndef main():\n\n X, Y, Z, K = i2nn()\n\n A = i2nn()\n\n B = i2nn()\n\n C = i2nn()\n\n A.sort()\n\n A.reverse()\n\n B.sort()\n\n B.reverse()\n\n C.sort()\n\n C.reverse()\n\n s = set()\n\n hq = []\n\n n = 0\n\n heappush(hq, ((A[0] + B[0] + C[0]) * -1, (0, 0, 0)))\n\n while n < K:\n\n t, abc = heappop(hq)\n\n if abc in s:\n\n continue\n\n s.add(abc)\n\n (a, b, c) = abc\n\n if a+1 < X:\n\n heappush(hq, ((A[a+1] + B[b] + C[c]) * -1, (a+1, b, c)))\n\n if b+1 < Y:\n\n heappush(hq, ((A[a] + B[b+1] + C[c]) * -1, (a, b+1, c)))\n\n if c+1 < Z:\n\n heappush(hq, ((A[a] + B[b] + C[c+1]) * -1, (a, b, c+1)))\n\n print((-t))\n\n n += 1\n\n\n\nmain()\n","code_v0_loc":56,"code_v1_loc":51,"code_v0_num_chars":1341,"code_v1_num_chars":1520,"code_v0_no_empty_lines":"import sys\n\n# import numpy as np\ns2nn = lambda s: [int(c) for c in s.split(\" \")]\nss2nn = lambda ss: [int(s) for s in ss]\nss2nnn = lambda ss: [s2nn(s) for s in ss]\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\nii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]\nii2nn = lambda n: ss2nn(ii2ss(n))\nii2nnn = lambda n: ss2nnn(ii2ss(n))\nN = 10000\n\n\ndef tokey(i, j, k):\n return i * N * N + j * N + k\n\n\ndef dekey(n):\n i = int(n \/ N \/ N)\n j = int(n \/ N) % N\n k = n % N\n return i, j, k\n\n\ndef main():\n X, Y, Z, K = i2nn()\n A = i2nn()\n B = i2nn()\n C = i2nn()\n A.sort()\n A.reverse()\n B.sort()\n B.reverse()\n C.sort()\n C.reverse()\n Q = [(A[0] + B[0] + C[0], 0, 0, 0)]\n loop = 0\n stored = set()\n\n def next(i, j, k):\n if i >= X or j >= Y or k >= Z:\n return\n key = tokey(i, j, k)\n if key not in stored:\n stored.add(key)\n n = A[i] + B[j] + C[k]\n Q.append((n, i, j, k))\n\n while True:\n v = max(Q, key=lambda v: v[0])\n Q.remove(v)\n print((v[0]))\n loop += 1\n if loop >= K:\n break\n next(v[1] + 1, v[2], v[3])\n next(v[1], v[2] + 1, v[3])\n next(v[1], v[2], v[3] + 1)\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque # \u53cc\u65b9\u5411\u30ad\u30e5\u30fc\nfrom collections import defaultdict # \u521d\u671f\u5316\u6e08\u307f\u8f9e\u66f8\nfrom heapq import heapify, heappush, heappop, heappushpop # \u30d7\u30e9\u30a4\u30aa\u30ea\u30c6\u30a3\u30ad\u30e5\u30fc\nfrom bisect import bisect_left, bisect_right # \u4e8c\u5206\u63a2\u7d22\n\n# import numpy as np # 1.8.2\n# import scipy # 0.13.3\n# sys.setrecursionlimit(int(1e+6))\ns2nn = lambda s: [int(c) for c in s.split(\" \")]\nss2nn = lambda ss: [int(s) for s in ss]\nss2nnn = lambda ss: [s2nn(s) for s in ss]\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\nii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]\nii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]\nii2nn = lambda n: ss2nn(ii2ss(n))\nii2nnn = lambda n: ss2nnn(ii2ss(n))\nMOD = int(1e9) + 7\n\n\ndef main():\n X, Y, Z, K = i2nn()\n A = i2nn()\n B = i2nn()\n C = i2nn()\n A.sort()\n A.reverse()\n B.sort()\n B.reverse()\n C.sort()\n C.reverse()\n s = set()\n hq = []\n n = 0\n heappush(hq, ((A[0] + B[0] + C[0]) * -1, (0, 0, 0)))\n while n < K:\n t, abc = heappop(hq)\n if abc in s:\n continue\n s.add(abc)\n (a, b, c) = abc\n if a + 1 < X:\n heappush(hq, ((A[a + 1] + B[b] + C[c]) * -1, (a + 1, b, c)))\n if b + 1 < Y:\n heappush(hq, ((A[a] + B[b + 1] + C[c]) * -1, (a, b + 1, c)))\n if c + 1 < Z:\n heappush(hq, ((A[a] + B[b] + C[c + 1]) * -1, (a, b, c + 1)))\n print((-t))\n n += 1\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":8.9285714286,"diff":["+from collections import deque # \u53cc\u65b9\u5411\u30ad\u30e5\u30fc","+from collections import defaultdict # \u521d\u671f\u5316\u6e08\u307f\u8f9e\u66f8","+from heapq import heapify, heappush, heappop, heappushpop # \u30d7\u30e9\u30a4\u30aa\u30ea\u30c6\u30a3\u30ad\u30e5\u30fc","+from bisect import bisect_left, bisect_right # \u4e8c\u5206\u63a2\u7d22","-# import numpy as np","+# import numpy as np # 1.8.2","+# import scipy # 0.13.3","+# sys.setrecursionlimit(int(1e+6))","+ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]","-N = 10000","-","-","-def tokey(i, j, k):","- return i * N * N + j * N + k","-","-","-def dekey(n):","- i = int(n \/ N \/ N)","- j = int(n \/ N) % N","- k = n % N","- return i, j, k","+MOD = int(1e9) + 7","- Q = [(A[0] + B[0] + C[0], 0, 0, 0)]","- loop = 0","- stored = set()","-","- def next(i, j, k):","- if i >= X or j >= Y or k >= Z:","- return","- key = tokey(i, j, k)","- if key not in stored:","- stored.add(key)","- n = A[i] + B[j] + C[k]","- Q.append((n, i, j, k))","-","- while True:","- v = max(Q, key=lambda v: v[0])","- Q.remove(v)","- print((v[0]))","- loop += 1","- if loop >= K:","- break","- next(v[1] + 1, v[2], v[3])","- next(v[1], v[2] + 1, v[3])","- next(v[1], v[2], v[3] + 1)","+ s = set()","+ hq = []","+ n = 0","+ heappush(hq, ((A[0] + B[0] + C[0]) * -1, (0, 0, 0)))","+ while n < K:","+ t, abc = heappop(hq)","+ if abc in s:","+ continue","+ s.add(abc)","+ (a, b, c) = abc","+ if a + 1 < X:","+ heappush(hq, ((A[a + 1] + B[b] + C[c]) * -1, (a + 1, b, c)))","+ if b + 1 < Y:","+ heappush(hq, ((A[a] + B[b + 1] + C[c]) * -1, (a, b + 1, c)))","+ if c + 1 < Z:","+ heappush(hq, ((A[a] + B[b] + C[c + 1]) * -1, (a, b, c + 1)))","+ print((-t))","+ n += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.2744265182,"measured_runtime_v1":0.1831091979,"runtime_lift":1.4987041689,"key":["s506003546","s782884160"]} +{"user_id":"u968166680","problem_id":"p02814","language":"python","submission_id_v0":"s703991862","submission_id_v1":"s702868581","cpu_time_v0":61,"cpu_time_v1":44,"memory_v0":13352,"memory_v1":14092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.87,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nfrom fractions import gcd\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef lcm(x, y):\n\n return x * y \/\/ gcd(x, y)\n\n\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n A = list(set(map(int, input().split(\" \"))))\n\n A = [a \/\/ 2 for a in A]\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a)\n\n if semi_lcm > M:\n\n print((0))\n\n return\n\n\n\n for a in A:\n\n if semi_lcm \/\/ a % 2 == 0:\n\n print((0))\n\n return\n\n\n\n print(((M \/\/ semi_lcm + 1) \/\/ 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n\n\n\n\ndef lcm(a, b):\n\n return a * b \/\/ gcd(a, b)\n\n\n\n\n\ndef main():\n\n N, M, *A = list(map(int, read().split()))\n\n A = list(set(A))\n\n B = A.copy()\n\n\n\n while not any(b % 2 for b in B):\n\n B = [b \/\/ 2 for b in B]\n\n\n\n if not all(b % 2 for b in B):\n\n print((0))\n\n return\n\n\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a \/\/ 2)\n\n\n\n print(((M \/\/ semi_lcm + 1) \/\/ 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":36,"code_v1_loc":41,"code_v0_num_chars":690,"code_v1_num_chars":687,"code_v0_no_empty_lines":"import sys\nfrom fractions import gcd\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef lcm(x, y):\n return x * y \/\/ gcd(x, y)\n\n\ndef main():\n N, M = list(map(int, input().split()))\n A = list(set(map(int, input().split(\" \"))))\n A = [a \/\/ 2 for a in A]\n semi_lcm = 1\n for a in A:\n semi_lcm = lcm(semi_lcm, a)\n if semi_lcm > M:\n print((0))\n return\n for a in A:\n if semi_lcm \/\/ a % 2 == 0:\n print((0))\n return\n print(((M \/\/ semi_lcm + 1) \/\/ 2))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return a * b \/\/ gcd(a, b)\n\n\ndef main():\n N, M, *A = list(map(int, read().split()))\n A = list(set(A))\n B = A.copy()\n while not any(b % 2 for b in B):\n B = [b \/\/ 2 for b in B]\n if not all(b % 2 for b in B):\n print((0))\n return\n semi_lcm = 1\n for a in A:\n semi_lcm = lcm(semi_lcm, a \/\/ 2)\n print(((M \/\/ semi_lcm + 1) \/\/ 2))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":12.1951219512,"diff":["-from fractions import gcd","-def lcm(x, y):","- return x * y \/\/ gcd(x, y)","+def gcd(a, b):","+ while b:","+ a, b = b, a % b","+ return a","+","+","+def lcm(a, b):","+ return a * b \/\/ gcd(a, b)","- N, M = list(map(int, input().split()))","- A = list(set(map(int, input().split(\" \"))))","- A = [a \/\/ 2 for a in A]","+ N, M, *A = list(map(int, read().split()))","+ A = list(set(A))","+ B = A.copy()","+ while not any(b % 2 for b in B):","+ B = [b \/\/ 2 for b in B]","+ if not all(b % 2 for b in B):","+ print((0))","+ return","- semi_lcm = lcm(semi_lcm, a)","- if semi_lcm > M:","- print((0))","- return","- for a in A:","- if semi_lcm \/\/ a % 2 == 0:","- print((0))","- return","+ semi_lcm = lcm(semi_lcm, a \/\/ 2)"],"diff_only_import_comment":false,"measured_runtime_v0":0.284781249,"measured_runtime_v1":0.212113862,"runtime_lift":1.3425866952,"key":["s703991862","s702868581"]} +{"user_id":"u268210555","problem_id":"p02702","language":"python","submission_id_v0":"s447095273","submission_id_v1":"s107946427","cpu_time_v0":620,"cpu_time_v1":135,"memory_v0":27172,"memory_v1":9292,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.23,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\ns = eval(input())\n\ny = 2019\n\ndp = np.zeros(y, dtype=\"int64\")\n\ntmp = np.zeros(y, dtype=\"int64\")\n\nk = 1\n\nr = 0\n\nfor c in s[::-1]:\n\n i = int(c)*k%y\n\n tmp[i:] = dp[:y-i]\n\n tmp[:i] = dp[y-i:]\n\n tmp[i] += 1\n\n dp, tmp = tmp, dp\n\n r += dp[0]\n\n k *= 10\n\n k %= y\n\nprint(r)\n\n# optimized version of the same code:\n","target":"y=2019\n\na=[0]*y\n\nk=1\n\nr=p=0\n\nfor c in input()[::-1]:\n\n a[p]+=1\n\n p-=int(c)*k\n\n p%=y\n\n r+=a[p]\n\n k*=10\n\n k%=y\n\nprint(r)\n\n\n","code_v0_loc":17,"code_v1_loc":13,"code_v0_num_chars":300,"code_v1_num_chars":139,"code_v0_no_empty_lines":"import numpy as np\n\ns = eval(input())\ny = 2019\ndp = np.zeros(y, dtype=\"int64\")\ntmp = np.zeros(y, dtype=\"int64\")\nk = 1\nr = 0\nfor c in s[::-1]:\n i = int(c) * k % y\n tmp[i:] = dp[: y - i]\n tmp[:i] = dp[y - i :]\n tmp[i] += 1\n dp, tmp = tmp, dp\n r += dp[0]\n k *= 10\n k %= y\nprint(r)\n","code_v1_no_empty_lines":"y = 2019\na = [0] * y\nk = 1\nr = p = 0\nfor c in input()[::-1]:\n a[p] += 1\n p -= int(c) * k\n p %= y\n r += a[p]\n k *= 10\n k %= y\nprint(r)\n","code_same":false,"relative_loc_diff_percent":23.5294117647,"diff":["-import numpy as np","-","-s = eval(input())","-dp = np.zeros(y, dtype=\"int64\")","-tmp = np.zeros(y, dtype=\"int64\")","+a = [0] * y","-r = 0","-for c in s[::-1]:","- i = int(c) * k % y","- tmp[i:] = dp[: y - i]","- tmp[:i] = dp[y - i :]","- tmp[i] += 1","- dp, tmp = tmp, dp","- r += dp[0]","+r = p = 0","+for c in input()[::-1]:","+ a[p] += 1","+ p -= int(c) * k","+ p %= y","+ r += a[p]"],"diff_only_import_comment":false,"measured_runtime_v0":1.860732609,"measured_runtime_v1":0.344029563,"runtime_lift":5.4086416092,"key":["s447095273","s107946427"]} +{"user_id":"u636251914","problem_id":"p02761","language":"python","submission_id_v0":"s225166241","submission_id_v1":"s824370296","cpu_time_v0":120,"cpu_time_v1":30,"memory_v0":26936,"memory_v1":9132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nN, M = [int(_) for _ in input().split()]\n\n\n\nif M == 0:\n\n if N == 1:\n\n print(\"0\")\n\n else:\n\n ans = [0] * N\n\n ans[0] = 1\n\n print((\"\".join(map(str, ans))))\n\n sys.exit()\n\n\n\nS, C = np.array([[int(_) for _ in input().split()] for i in range(M)]).T\n\n\n\nans = [-1] * N\n\n\n\nfor i in range(M):\n\n j = int(S[i]) - 1\n\n if ans[j] == -1 or ans[j] == C[i]:\n\n ans[j] = C[i]\n\n else:\n\n print(\"-1\")\n\n sys.exit()\n\n\n\nif N >= 2 and ans[0] == 0:\n\n print(\"-1\")\n\n sys.exit()\n\n\n\nif N >= 2 and ans[0] == -1:\n\n ans[0] = 1\n\n\n\nfor i in range(1, N):\n\n if ans[i] == -1:\n\n ans[i] = 0\n\n\n\ns = \"\".join(map(str, ans))\n\nprint(s)\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nN, M = [int(_) for _ in input().split()]\n\nSC = [[int(_) for _ in input().split()] for i in range(M)]\n\n\n\nif N == 1:\n\n start = 0\n\n end = 10\n\nelse:\n\n start = 10 ** (N - 1)\n\n end = 10 ** N\n\n\n\nfor i in range(start, end):\n\n ans = list(map(int, str(i)))\n\n valid = True\n\n for s, c in SC:\n\n if ans[s-1] != c:\n\n valid = False\n\n break\n\n if valid:\n\n print(i)\n\n sys.exit()\n\n\n\nprint((-1))\n","code_v0_loc":39,"code_v1_loc":24,"code_v0_num_chars":705,"code_v1_num_chars":454,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nN, M = [int(_) for _ in input().split()]\nif M == 0:\n if N == 1:\n print(\"0\")\n else:\n ans = [0] * N\n ans[0] = 1\n print((\"\".join(map(str, ans))))\n sys.exit()\nS, C = np.array([[int(_) for _ in input().split()] for i in range(M)]).T\nans = [-1] * N\nfor i in range(M):\n j = int(S[i]) - 1\n if ans[j] == -1 or ans[j] == C[i]:\n ans[j] = C[i]\n else:\n print(\"-1\")\n sys.exit()\nif N >= 2 and ans[0] == 0:\n print(\"-1\")\n sys.exit()\nif N >= 2 and ans[0] == -1:\n ans[0] = 1\nfor i in range(1, N):\n if ans[i] == -1:\n ans[i] = 0\ns = \"\".join(map(str, ans))\nprint(s)\n","code_v1_no_empty_lines":"import sys\n\nN, M = [int(_) for _ in input().split()]\nSC = [[int(_) for _ in input().split()] for i in range(M)]\nif N == 1:\n start = 0\n end = 10\nelse:\n start = 10 ** (N - 1)\n end = 10**N\nfor i in range(start, end):\n ans = list(map(int, str(i)))\n valid = True\n for s, c in SC:\n if ans[s - 1] != c:\n valid = False\n break\n if valid:\n print(i)\n sys.exit()\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":38.4615384615,"diff":["-import numpy as np","-if M == 0:","- if N == 1:","- print(\"0\")","- else:","- ans = [0] * N","- ans[0] = 1","- print((\"\".join(map(str, ans))))","- sys.exit()","-S, C = np.array([[int(_) for _ in input().split()] for i in range(M)]).T","-ans = [-1] * N","-for i in range(M):","- j = int(S[i]) - 1","- if ans[j] == -1 or ans[j] == C[i]:","- ans[j] = C[i]","- else:","- print(\"-1\")","+SC = [[int(_) for _ in input().split()] for i in range(M)]","+if N == 1:","+ start = 0","+ end = 10","+else:","+ start = 10 ** (N - 1)","+ end = 10**N","+for i in range(start, end):","+ ans = list(map(int, str(i)))","+ valid = True","+ for s, c in SC:","+ if ans[s - 1] != c:","+ valid = False","+ break","+ if valid:","+ print(i)","-if N >= 2 and ans[0] == 0:","- print(\"-1\")","- sys.exit()","-if N >= 2 and ans[0] == -1:","- ans[0] = 1","-for i in range(1, N):","- if ans[i] == -1:","- ans[i] = 0","-s = \"\".join(map(str, ans))","-print(s)","+print((-1))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3151718793,"measured_runtime_v1":0.2178794563,"runtime_lift":6.0362362826,"key":["s225166241","s824370296"]} +{"user_id":"u572142121","problem_id":"p03363","language":"python","submission_id_v0":"s475305567","submission_id_v1":"s723214591","cpu_time_v0":418,"cpu_time_v1":188,"memory_v0":34640,"memory_v1":31600,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.02,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy\n\nN=int(eval(input()))\n\nA=list(map(int,input().split()))\n\nB=list(numpy.cumsum(A))+[0]\n\nC=sorted(B)\n\nd=C[0]\n\ncnt=1\n\nans=0\n\nfor i in range(N):\n\n if C[i+1]==d:\n\n cnt+=1\n\n else:\n\n ans+=cnt*(cnt-1)\/\/2\n\n cnt=1\n\n d=C[i+1]\n\nans+=cnt*(cnt-1)\/\/2\n\nprint(ans) \n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\nA=list(map(int, input().split()))\n\nD=[0]\n\nd=0\n\nfor i in A:\n\n d+=i\n\n D.append(d)\n\nD=sorted(D)\n\nans=0\n\nd=-10**9+1\n\nD.append(10**9+1)\n\ncnt=0\n\nfor i in range(N+2):\n\n if D[i]==d:\n\n cnt+=1\n\n else:\n\n if cnt>1:\n\n ans+=cnt*(cnt-1)\/\/2\n\n cnt=1\n\n else:\n\n cnt=1\n\n d=D[i]\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":23,"code_v0_num_chars":271,"code_v1_num_chars":316,"code_v0_no_empty_lines":"import numpy\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nB = list(numpy.cumsum(A)) + [0]\nC = sorted(B)\nd = C[0]\ncnt = 1\nans = 0\nfor i in range(N):\n if C[i + 1] == d:\n cnt += 1\n else:\n ans += cnt * (cnt - 1) \/\/ 2\n cnt = 1\n d = C[i + 1]\nans += cnt * (cnt - 1) \/\/ 2\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nD = [0]\nd = 0\nfor i in A:\n d += i\n D.append(d)\nD = sorted(D)\nans = 0\nd = -(10**9) + 1\nD.append(10**9 + 1)\ncnt = 0\nfor i in range(N + 2):\n if D[i] == d:\n cnt += 1\n else:\n if cnt > 1:\n ans += cnt * (cnt - 1) \/\/ 2\n cnt = 1\n else:\n cnt = 1\n d = D[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":26.0869565217,"diff":["-import numpy","-","-B = list(numpy.cumsum(A)) + [0]","-C = sorted(B)","-d = C[0]","-cnt = 1","+D = [0]","+d = 0","+for i in A:","+ d += i","+ D.append(d)","+D = sorted(D)","-for i in range(N):","- if C[i + 1] == d:","+d = -(10**9) + 1","+D.append(10**9 + 1)","+cnt = 0","+for i in range(N + 2):","+ if D[i] == d:","- ans += cnt * (cnt - 1) \/\/ 2","- cnt = 1","- d = C[i + 1]","-ans += cnt * (cnt - 1) \/\/ 2","+ if cnt > 1:","+ ans += cnt * (cnt - 1) \/\/ 2","+ cnt = 1","+ else:","+ cnt = 1","+ d = D[i]"],"diff_only_import_comment":false,"measured_runtime_v0":1.3420555761,"measured_runtime_v1":0.3643712389,"runtime_lift":3.6832094101,"key":["s475305567","s723214591"]} +{"user_id":"u761529120","problem_id":"p03634","language":"python","submission_id_v0":"s135133436","submission_id_v1":"s083939253","cpu_time_v0":1459,"cpu_time_v1":754,"memory_v0":135740,"memory_v1":94752,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.32,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\ndef dfs(v,p,d):\n\n for i, j in tree[v]:\n\n if i != p:\n\n depth[i] = d + j\n\n dfs(i,v,d+j)\n\n\n\nN = int(eval(input()))\n\n\n\ntree = [[] for _ in range(N)]\n\n\n\nfor i in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n tree[a].append((b,c))\n\n tree[b].append((a,c))\n\n\n\nQ, K = list(map(int, input().split()))\n\n\n\ndepth = [0 for i in range(N)]\n\ndepth[K-1] = 0\n\n\n\ndfs(K-1,-1,0)\n\n\n\nfor _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n print((depth[x-1] + depth[y-1]))\n\n# optimized version of the same code:\n","target":"import heapq\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef dijkstra(s, edge, N):\n\n d = [float('inf')] * N\n\n used = [True] * N\n\n d[s] = 0\n\n used[s] = False\n\n edgelist = []\n\n for a, b in edge[s]:\n\n heapq.heappush(edgelist, a * (10 ** 6) + b)\n\n while len(edgelist):\n\n minedge = heapq.heappop(edgelist)\n\n\n\n if not used[minedge%(10 ** 6)]:\n\n continue\n\n v = minedge % (10 ** 6)\n\n d[v] = minedge \/\/ (10 ** 6)\n\n used[v] = False\n\n for e in edge[v]:\n\n if used[e[1]]:\n\n heapq.heappush(edgelist, (e[0] + d[v]) * (10 ** 6) + e[1])\n\n return d\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n edge = [[] for _ in range(N)]\n\n for _ in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n edge[a].append([c,b])\n\n edge[b].append([c,a])\n\n Q, K = list(map(int, input().split()))\n\n K -= 1\n\n d = dijkstra(K, edge, N)\n\n for _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n x -= 1\n\n y -= 1\n\n print((d[x] + d[y]))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":29,"code_v1_loc":48,"code_v0_num_chars":553,"code_v1_num_chars":1130,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef dfs(v, p, d):\n for i, j in tree[v]:\n if i != p:\n depth[i] = d + j\n dfs(i, v, d + j)\n\n\nN = int(eval(input()))\ntree = [[] for _ in range(N)]\nfor i in range(N - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n tree[a].append((b, c))\n tree[b].append((a, c))\nQ, K = list(map(int, input().split()))\ndepth = [0 for i in range(N)]\ndepth[K - 1] = 0\ndfs(K - 1, -1, 0)\nfor _ in range(Q):\n x, y = list(map(int, input().split()))\n print((depth[x - 1] + depth[y - 1]))\n","code_v1_no_empty_lines":"import heapq\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef dijkstra(s, edge, N):\n d = [float(\"inf\")] * N\n used = [True] * N\n d[s] = 0\n used[s] = False\n edgelist = []\n for a, b in edge[s]:\n heapq.heappush(edgelist, a * (10**6) + b)\n while len(edgelist):\n minedge = heapq.heappop(edgelist)\n if not used[minedge % (10**6)]:\n continue\n v = minedge % (10**6)\n d[v] = minedge \/\/ (10**6)\n used[v] = False\n for e in edge[v]:\n if used[e[1]]:\n heapq.heappush(edgelist, (e[0] + d[v]) * (10**6) + e[1])\n return d\n\n\ndef main():\n N = int(eval(input()))\n edge = [[] for _ in range(N)]\n for _ in range(N - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n edge[a].append([c, b])\n edge[b].append([c, a])\n Q, K = list(map(int, input().split()))\n K -= 1\n d = dijkstra(K, edge, N)\n for _ in range(Q):\n x, y = list(map(int, input().split()))\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":39.5833333333,"diff":["+import heapq","-sys.setrecursionlimit(10**6)","+input = sys.stdin.readline","-def dfs(v, p, d):","- for i, j in tree[v]:","- if i != p:","- depth[i] = d + j","- dfs(i, v, d + j)","+def dijkstra(s, edge, N):","+ d = [float(\"inf\")] * N","+ used = [True] * N","+ d[s] = 0","+ used[s] = False","+ edgelist = []","+ for a, b in edge[s]:","+ heapq.heappush(edgelist, a * (10**6) + b)","+ while len(edgelist):","+ minedge = heapq.heappop(edgelist)","+ if not used[minedge % (10**6)]:","+ continue","+ v = minedge % (10**6)","+ d[v] = minedge \/\/ (10**6)","+ used[v] = False","+ for e in edge[v]:","+ if used[e[1]]:","+ heapq.heappush(edgelist, (e[0] + d[v]) * (10**6) + e[1])","+ return d","-N = int(eval(input()))","-tree = [[] for _ in range(N)]","-for i in range(N - 1):","- a, b, c = list(map(int, input().split()))","- a -= 1","- b -= 1","- tree[a].append((b, c))","- tree[b].append((a, c))","-Q, K = list(map(int, input().split()))","-depth = [0 for i in range(N)]","-depth[K - 1] = 0","-dfs(K - 1, -1, 0)","-for _ in range(Q):","- x, y = list(map(int, input().split()))","- print((depth[x - 1] + depth[y - 1]))","+def main():","+ N = int(eval(input()))","+ edge = [[] for _ in range(N)]","+ for _ in range(N - 1):","+ a, b, c = list(map(int, input().split()))","+ a -= 1","+ b -= 1","+ edge[a].append([c, b])","+ edge[b].append([c, a])","+ Q, K = list(map(int, input().split()))","+ K -= 1","+ d = dijkstra(K, edge, N)","+ for _ in range(Q):","+ x, y = list(map(int, input().split()))","+ x -= 1","+ y -= 1","+ print((d[x] + d[y]))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.5217886055,"measured_runtime_v1":0.3235212803,"runtime_lift":1.6128416807,"key":["s135133436","s083939253"]} +{"user_id":"u230717961","problem_id":"p03796","language":"python","submission_id_v0":"s450924156","submission_id_v1":"s743009434","cpu_time_v0":229,"cpu_time_v1":35,"memory_v0":3984,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.72,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nn = int(eval(input()))\n\n\n\npower = math.factorial(n)\n\n\n\nprint((power % (10**9 + 7)))\n\n\n# optimized version of the same code:\n","target":"import math\n\nn = int(eval(input()))\n\n\n\npower = 1\n\n\n\nfor i in range(1, n+1):\n\n power = i * power % (10**9 + 7)\n\n\n\nprint(power)\n","code_v0_loc":6,"code_v1_loc":9,"code_v0_num_chars":89,"code_v1_num_chars":123,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\npower = math.factorial(n)\nprint((power % (10**9 + 7)))\n","code_v1_no_empty_lines":"import math\n\nn = int(eval(input()))\npower = 1\nfor i in range(1, n + 1):\n power = i * power % (10**9 + 7)\nprint(power)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-power = math.factorial(n)","-print((power % (10**9 + 7)))","+power = 1","+for i in range(1, n + 1):","+ power = i * power % (10**9 + 7)","+print(power)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5500237288,"measured_runtime_v1":0.2133381867,"runtime_lift":2.5781775744,"key":["s450924156","s743009434"]} +{"user_id":"u947883560","problem_id":"p02883","language":"python","submission_id_v0":"s930888083","submission_id_v1":"s224851007","cpu_time_v0":856,"cpu_time_v1":625,"memory_v0":144812,"memory_v1":49884,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.99,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env python3\n\nimport sys\n\nINF = float(\"inf\")\n\nfrom bisect import bisect_left\n\n\n\n\n\ndef solve(N: int, K: int, A: \"List[int]\", F: \"List[int]\"):\n\n A.sort()\n\n F.sort(reverse=True)\n\n h = []\n\n for a, f in zip(A, F):\n\n h.append((a*f, a, f))\n\n h.sort()\n\n maxtime = h[-1][0]\n\n\n\n def isOK(y):\n\n i = bisect_left(h, (y+1, -1, -1))\n\n counter = 0\n\n # print(h[i:])\n\n for p, a, f in h[i:]:\n\n counter += a-y\/\/f\n\n return counter <= K\n\n\n\n def binary_search(x):\n\n ng = -1\n\n ok = len(x)\n\n while abs(ok - ng) > 1:\n\n mid = (ok + ng)\/\/2\n\n # print(\"mid: {}, in ({}, {})\".format(mid, ng, ok))\n\n if isOK(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n return ng, ok\n\n\n\n ng, ok = binary_search(list(range(maxtime)))\n\n print(ok)\n\n\n\n # while k > 0:\n\n # p1, a1, f1 = heapq.heappop(h)\n\n # p2, a2, f2 = heapq.heappop(h)\n\n # p1, p2 = -p1, -p2\n\n # sub = min(a1 - math.ceil((p2\/f1)-1), k)\n\n # a1 -= sub\n\n # k -= sub\n\n # heapq.heappush(h, (-a1*f1, a1, f1))\n\n # heapq.heappush(h, (-a2*f2, a2, f2))\n\n # # print(h)\n\n # p, a, f = heapq.heappop(h)\n\n # print(-p)\n\n\n\n return\n\n\n\n\n\ndef main():\n\n\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n K = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n F = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, K, A, F)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\nINF = float(\"inf\")\n\nimport numpy as np\n\n\n\n\n\ndef solve(N: int, K: int, A: \"List[int]\", F: \"List[int]\"):\n\n A.sort()\n\n F.sort(reverse=True)\n\n A = np.asarray(A, dtype=np.int)\n\n F = np.asarray(F, dtype=np.int)\n\n\n\n Asum = A.sum()\n\n\n\n def isOK(y):\n\n return Asum-np.minimum(A, y\/\/F).sum() <= K\n\n\n\n def binary_search(x):\n\n ng = -1\n\n ok = len(x)\n\n while abs(ok - ng) > 1:\n\n mid = (ok + ng)\/\/2\n\n # print(\"mid: {}, in ({}, {})\".format(mid, ng, ok))\n\n if isOK(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n return ng, ok\n\n\n\n ng, ok = binary_search(list(range(A.max()*F.max())))\n\n print(ok)\n\n\n\n # while k > 0:\n\n # p1, a1, f1 = heapq.heappop(h)\n\n # p2, a2, f2 = heapq.heappop(h)\n\n # p1, p2 = -p1, -p2\n\n # sub = min(a1 - math.ceil((p2\/f1)-1), k)\n\n # a1 -= sub\n\n # k -= sub\n\n # heapq.heappush(h, (-a1*f1, a1, f1))\n\n # heapq.heappush(h, (-a2*f2, a2, f2))\n\n # # print(h)\n\n # p, a, f = heapq.heappop(h)\n\n # print(-p)\n\n\n\n return\n\n\n\n\n\ndef main():\n\n\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n K = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n F = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, K, A, F)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":70,"code_v1_loc":64,"code_v0_num_chars":1739,"code_v1_num_chars":1595,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\nINF = float(\"inf\")\nfrom bisect import bisect_left\n\n\ndef solve(N: int, K: int, A: \"List[int]\", F: \"List[int]\"):\n A.sort()\n F.sort(reverse=True)\n h = []\n for a, f in zip(A, F):\n h.append((a * f, a, f))\n h.sort()\n maxtime = h[-1][0]\n\n def isOK(y):\n i = bisect_left(h, (y + 1, -1, -1))\n counter = 0\n # print(h[i:])\n for p, a, f in h[i:]:\n counter += a - y \/\/ f\n return counter <= K\n\n def binary_search(x):\n ng = -1\n ok = len(x)\n while abs(ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n # print(\"mid: {}, in ({}, {})\".format(mid, ng, ok))\n if isOK(mid):\n ok = mid\n else:\n ng = mid\n return ng, ok\n\n ng, ok = binary_search(list(range(maxtime)))\n print(ok)\n # while k > 0:\n # p1, a1, f1 = heapq.heappop(h)\n # p2, a2, f2 = heapq.heappop(h)\n # p1, p2 = -p1, -p2\n # sub = min(a1 - math.ceil((p2\/f1)-1), k)\n # a1 -= sub\n # k -= sub\n # heapq.heappush(h, (-a1*f1, a1, f1))\n # heapq.heappush(h, (-a2*f2, a2, f2))\n # # print(h)\n # p, a, f = heapq.heappop(h)\n # print(-p)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n K = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n F = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, K, A, F)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\nINF = float(\"inf\")\nimport numpy as np\n\n\ndef solve(N: int, K: int, A: \"List[int]\", F: \"List[int]\"):\n A.sort()\n F.sort(reverse=True)\n A = np.asarray(A, dtype=np.int)\n F = np.asarray(F, dtype=np.int)\n Asum = A.sum()\n\n def isOK(y):\n return Asum - np.minimum(A, y \/\/ F).sum() <= K\n\n def binary_search(x):\n ng = -1\n ok = len(x)\n while abs(ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n # print(\"mid: {}, in ({}, {})\".format(mid, ng, ok))\n if isOK(mid):\n ok = mid\n else:\n ng = mid\n return ng, ok\n\n ng, ok = binary_search(list(range(A.max() * F.max())))\n print(ok)\n # while k > 0:\n # p1, a1, f1 = heapq.heappop(h)\n # p2, a2, f2 = heapq.heappop(h)\n # p1, p2 = -p1, -p2\n # sub = min(a1 - math.ceil((p2\/f1)-1), k)\n # a1 -= sub\n # k -= sub\n # heapq.heappush(h, (-a1*f1, a1, f1))\n # heapq.heappush(h, (-a2*f2, a2, f2))\n # # print(h)\n # p, a, f = heapq.heappop(h)\n # print(-p)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n K = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n F = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, K, A, F)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":8.5714285714,"diff":["-from bisect import bisect_left","+import numpy as np","- h = []","- for a, f in zip(A, F):","- h.append((a * f, a, f))","- h.sort()","- maxtime = h[-1][0]","+ A = np.asarray(A, dtype=np.int)","+ F = np.asarray(F, dtype=np.int)","+ Asum = A.sum()","- i = bisect_left(h, (y + 1, -1, -1))","- counter = 0","- # print(h[i:])","- for p, a, f in h[i:]:","- counter += a - y \/\/ f","- return counter <= K","+ return Asum - np.minimum(A, y \/\/ F).sum() <= K","- ng, ok = binary_search(list(range(maxtime)))","+ ng, ok = binary_search(list(range(A.max() * F.max())))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1431037025,"measured_runtime_v1":0.0063273711,"runtime_lift":22.616612744,"key":["s930888083","s224851007"]} +{"user_id":"u863442865","problem_id":"p03575","language":"python","submission_id_v0":"s261596847","submission_id_v1":"s475565358","cpu_time_v0":36,"cpu_time_v1":25,"memory_v0":4076,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.56,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n'''\n\n\u7121\u5411\u30b0\u30e9\u30d5\u306e\u6a4b\u306e\u6570\u3092\u8abf\u3079\u308b\n\n\u30eb\u30fc\u30d7\u7121\u3057\/2\u91cd\u8fba\u7121\u3057\n\n'''\n\n\n\ndef main():\n\n import sys\n\n #input = sys.stdin.readline\n\n sys.setrecursionlimit(10000000)\n\n from collections import Counter, deque\n\n #from collections import defaultdict\n\n from itertools import combinations\n\n #from itertools import accumulate, product, permutations\n\n from math import floor, ceil\n\n\n\n #mod = 1000000007\n\n\n\n node,m =list(map(int, input().split()))\n\n edge = [list(map(int, input().split())) for _ in range(m)]\n\n res = 0\n\n\n\n def dfs(num):\n\n flag[num-1] = 1\n\n for x, y in edge:\n\n if x==num:\n\n if not flag[y-1]:\n\n dfs(y)\n\n if y==num:\n\n if not flag[x-1]:\n\n dfs(x)\n\n \n\n for i in range(m):\n\n bridge = edge.pop(i)\n\n flag = [0]*node\n\n s = edge[0][0]\n\n dfs(s)\n\n if not all(flag):\n\n res += 1\n\n edge.insert(i, bridge)\n\n print(res)\n\n\n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"'''\n\nhttps:\/\/atcoder.jp\/contests\/abc075\/tasks\/abc075_c?lang=ja\n\n\u6df1\u3055\u512a\u5148\u63a2\u7d22\u3067\u3082\u89e3\u3051\u308b\n\n'''\n\ndef main():\n\n import sys\n\n #input = sys.stdin.readline\n\n sys.setrecursionlimit(10000000)\n\n from collections import Counter, deque\n\n #from collections import defaultdict\n\n from itertools import combinations, permutations\n\n #from itertools import accumulate, product\n\n from bisect import bisect_left,bisect_right\n\n from math import floor, ceil\n\n #from operator import itemgetter\n\n\n\n #mod = 1000000007\n\n\n\n class UnionFind():\n\n #n\u500b\u306e\u8981\u7d20\u3092\u756a\u53f70~n-1\u3067\u7ba1\u7406\u3059\u308b\n\n #parents:\u8981\u7d20\u306e\u89aa(1\u3064\u4e0a), \u8981\u7d20\u304c\u6839\u306e\u5834\u5408\u30b5\u30a4\u30ba\u3092\u8868\u3059\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n \n\n #\u8981\u7d20x\u306e\u6839\u3092\u8fd4\u3059, \u305d\u306e\u904e\u7a0b\u3067\u7d4c\u8def\u5727\u7e2e\u3082\u884c\u3046\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n \n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:\n\n return\n\n #\u305d\u308c\u305e\u308c\u306esize\u3067\u6bd4\u3079\u308b\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x #\u6839\u3092\u304f\u3063\u3064\u3051\u308b(\u7247\u65b9\u3092\u89aa\u306b\u3059\u308b)\n\n \n\n #x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306esize\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n \n\n #x\u3068y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u304b\u3069\u3046\u304b\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n \n\n #x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u5168\u3066\u3092\u8fd4\u3059\n\n def members(self, x):\n\n root = self.find(x)\n\n return [i for i in range(self.n) if self.find(i) == root]\n\n \n\n #\u5168\u3066\u306e\u6839\u306e\u8981\u7d20\u3092\u8fd4\u3059\n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n \n\n #\u5404\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u3092\u8f9e\u66f8\u3067\u8fd4\u3059\n\n def all_group_members(self):\n\n return {r: self.members(r) for r in self.roots()}\n\n \n\n #print(uf)\n\n def __str__(self):\n\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\n n,m = list(map(int, input().split()))\n\n edge = [list(map(int, input().split())) for _ in range(m)]\n\n res = 0\n\n for i in range(m):\n\n uf = UnionFind(n)\n\n for j in range(m):\n\n if i==j:\n\n continue\n\n a,b = edge[j]\n\n uf.union(a-1,b-1)\n\n if uf.size(0)!=n:\n\n res += 1\n\n print(res)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":43,"code_v1_loc":84,"code_v0_num_chars":1013,"code_v1_num_chars":2498,"code_v0_no_empty_lines":"\"\"\"\n\u7121\u5411\u30b0\u30e9\u30d5\u306e\u6a4b\u306e\u6570\u3092\u8abf\u3079\u308b\n\u30eb\u30fc\u30d7\u7121\u3057\/2\u91cd\u8fba\u7121\u3057\n\"\"\"\n\n\ndef main():\n import sys\n\n # input = sys.stdin.readline\n sys.setrecursionlimit(10000000)\n from collections import Counter, deque\n\n # from collections import defaultdict\n from itertools import combinations\n\n # from itertools import accumulate, product, permutations\n from math import floor, ceil\n\n # mod = 1000000007\n node, m = list(map(int, input().split()))\n edge = [list(map(int, input().split())) for _ in range(m)]\n res = 0\n\n def dfs(num):\n flag[num - 1] = 1\n for x, y in edge:\n if x == num:\n if not flag[y - 1]:\n dfs(y)\n if y == num:\n if not flag[x - 1]:\n dfs(x)\n\n for i in range(m):\n bridge = edge.pop(i)\n flag = [0] * node\n s = edge[0][0]\n dfs(s)\n if not all(flag):\n res += 1\n edge.insert(i, bridge)\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"\"\"\"\nhttps:\/\/atcoder.jp\/contests\/abc075\/tasks\/abc075_c?lang=ja\n\u6df1\u3055\u512a\u5148\u63a2\u7d22\u3067\u3082\u89e3\u3051\u308b\n\"\"\"\n\n\ndef main():\n import sys\n\n # input = sys.stdin.readline\n sys.setrecursionlimit(10000000)\n from collections import Counter, deque\n\n # from collections import defaultdict\n from itertools import combinations, permutations\n\n # from itertools import accumulate, product\n from bisect import bisect_left, bisect_right\n from math import floor, ceil\n\n # from operator import itemgetter\n # mod = 1000000007\n class UnionFind:\n # n\u500b\u306e\u8981\u7d20\u3092\u756a\u53f70~n-1\u3067\u7ba1\u7406\u3059\u308b\n # parents:\u8981\u7d20\u306e\u89aa(1\u3064\u4e0a), \u8981\u7d20\u304c\u6839\u306e\u5834\u5408\u30b5\u30a4\u30ba\u3092\u8868\u3059\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n # \u8981\u7d20x\u306e\u6839\u3092\u8fd4\u3059, \u305d\u306e\u904e\u7a0b\u3067\u7d4c\u8def\u5727\u7e2e\u3082\u884c\u3046\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n # \u305d\u308c\u305e\u308c\u306esize\u3067\u6bd4\u3079\u308b\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x # \u6839\u3092\u304f\u3063\u3064\u3051\u308b(\u7247\u65b9\u3092\u89aa\u306b\u3059\u308b)\n\n # x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306esize\n def size(self, x):\n return -self.parents[self.find(x)]\n\n # x\u3068y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u304b\u3069\u3046\u304b\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n # x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u5168\u3066\u3092\u8fd4\u3059\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n # \u5168\u3066\u306e\u6839\u306e\u8981\u7d20\u3092\u8fd4\u3059\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n # \u5404\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u3092\u8f9e\u66f8\u3067\u8fd4\u3059\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n # print(uf)\n def __str__(self):\n return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())\n\n n, m = list(map(int, input().split()))\n edge = [list(map(int, input().split())) for _ in range(m)]\n res = 0\n for i in range(m):\n uf = UnionFind(n)\n for j in range(m):\n if i == j:\n continue\n a, b = edge[j]\n uf.union(a - 1, b - 1)\n if uf.size(0) != n:\n res += 1\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":48.8095238095,"diff":["-\u7121\u5411\u30b0\u30e9\u30d5\u306e\u6a4b\u306e\u6570\u3092\u8abf\u3079\u308b","-\u30eb\u30fc\u30d7\u7121\u3057\/2\u91cd\u8fba\u7121\u3057","+https:\/\/atcoder.jp\/contests\/abc075\/tasks\/abc075_c?lang=ja","+\u6df1\u3055\u512a\u5148\u63a2\u7d22\u3067\u3082\u89e3\u3051\u308b","- from itertools import combinations","+ from itertools import combinations, permutations","- # from itertools import accumulate, product, permutations","+ # from itertools import accumulate, product","+ from bisect import bisect_left, bisect_right","+ # from operator import itemgetter","- node, m = list(map(int, input().split()))","+ class UnionFind:","+ # n\u500b\u306e\u8981\u7d20\u3092\u756a\u53f70~n-1\u3067\u7ba1\u7406\u3059\u308b","+ # parents:\u8981\u7d20\u306e\u89aa(1\u3064\u4e0a), \u8981\u7d20\u304c\u6839\u306e\u5834\u5408\u30b5\u30a4\u30ba\u3092\u8868\u3059","+ def __init__(self, n):","+ self.n = n","+ self.parents = [-1] * n","+","+ # \u8981\u7d20x\u306e\u6839\u3092\u8fd4\u3059, \u305d\u306e\u904e\u7a0b\u3067\u7d4c\u8def\u5727\u7e2e\u3082\u884c\u3046","+ def find(self, x):","+ if self.parents[x] < 0:","+ return x","+ else:","+ self.parents[x] = self.find(self.parents[x])","+ return self.parents[x]","+","+ def union(self, x, y):","+ x = self.find(x)","+ y = self.find(y)","+ if x == y:","+ return","+ # \u305d\u308c\u305e\u308c\u306esize\u3067\u6bd4\u3079\u308b","+ if self.parents[x] > self.parents[y]:","+ x, y = y, x","+ self.parents[x] += self.parents[y]","+ self.parents[y] = x # \u6839\u3092\u304f\u3063\u3064\u3051\u308b(\u7247\u65b9\u3092\u89aa\u306b\u3059\u308b)","+","+ # x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306esize","+ def size(self, x):","+ return -self.parents[self.find(x)]","+","+ # x\u3068y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u304b\u3069\u3046\u304b","+ def same(self, x, y):","+ return self.find(x) == self.find(y)","+","+ # x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u5168\u3066\u3092\u8fd4\u3059","+ def members(self, x):","+ root = self.find(x)","+ return [i for i in range(self.n) if self.find(i) == root]","+","+ # \u5168\u3066\u306e\u6839\u306e\u8981\u7d20\u3092\u8fd4\u3059","+ def roots(self):","+ return [i for i, x in enumerate(self.parents) if x < 0]","+","+ # \u5404\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u3092\u8f9e\u66f8\u3067\u8fd4\u3059","+ def all_group_members(self):","+ return {r: self.members(r) for r in self.roots()}","+","+ # print(uf)","+ def __str__(self):","+ return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())","+","+ n, m = list(map(int, input().split()))","-","- def dfs(num):","- flag[num - 1] = 1","- for x, y in edge:","- if x == num:","- if not flag[y - 1]:","- dfs(y)","- if y == num:","- if not flag[x - 1]:","- dfs(x)","-","- bridge = edge.pop(i)","- flag = [0] * node","- s = edge[0][0]","- dfs(s)","- if not all(flag):","+ uf = UnionFind(n)","+ for j in range(m):","+ if i == j:","+ continue","+ a, b = edge[j]","+ uf.union(a - 1, b - 1)","+ if uf.size(0) != n:","- edge.insert(i, bridge)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1590786695,"measured_runtime_v1":0.0066230161,"runtime_lift":24.0190672119,"key":["s261596847","s475565358"]} +{"user_id":"u077898957","problem_id":"p03796","language":"python","submission_id_v0":"s080864979","submission_id_v1":"s354066004","cpu_time_v0":230,"cpu_time_v1":42,"memory_v0":3980,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nn = int(eval(input()))\n\nprint((math.factorial(n)%(10**9+7)))\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\npw = 1\n\nfor i in range(n):\n\n pw *= (i+1)\n\n pw %= 10**9+7\n\nprint(pw)","code_v0_loc":3,"code_v1_loc":6,"code_v0_num_chars":66,"code_v1_num_chars":87,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nprint((math.factorial(n) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\npw = 1\nfor i in range(n):\n pw *= i + 1\n pw %= 10**9 + 7\nprint(pw)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import math","-","-print((math.factorial(n) % (10**9 + 7)))","+pw = 1","+for i in range(n):","+ pw *= i + 1","+ pw %= 10**9 + 7","+print(pw)"],"diff_only_import_comment":false,"measured_runtime_v0":0.9190823469,"measured_runtime_v1":0.4266894727,"runtime_lift":2.1539841167,"key":["s080864979","s354066004"]} +{"user_id":"u391731808","problem_id":"p03634","language":"python","submission_id_v0":"s145761901","submission_id_v1":"s949294302","cpu_time_v0":1740,"cpu_time_v1":1056,"memory_v0":98856,"memory_v1":98636,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.31,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport heapq\n\n\n\nN = int(eval(input()))\n\nabc = [list(map(int,input().split())) for _ in range(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nxy = [list(map(int,input().split())) for _ in range(Q)]\n\n\n\nconnect = [[] for _ in range(N)]\n\nINFTY = 10**15\n\nfor a,b,c in abc:\n\n connect[a-1].append([b-1,c])\n\n connect[b-1].append([a-1,c])\n\n\n\ncost = [[INFTY,False] for _ in range(N)]\n\ncost[K-1][0] = 0\n\nq = [(0,K-1)]\n\nwhile q:\n\n _,i = heapq.heappop(q)\n\n if cost[i][1]:\n\n continue\n\n cost[i][1] = True\n\n ci0 = cost[i][0]\n\n for j,c in connect[i]:\n\n if cost[j][1]:\n\n continue\n\n tmp_cost = ci0+c\n\n if tmp_cost < cost[j][0]:\n\n cost[j][0] = tmp_cost\n\n heapq.heappush(q,(tmp_cost,j))\n\n\n\nfor x,y in xy:\n\n print((cost[x-1][0] + cost[y-1][0]))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nABC = [list(map(int,input().split())) for _ in [0]*(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nXY = [list(map(int,input().split())) for _ in [0]*Q]\n\n\n\nE = [{} for _ in [0]*N]\n\nfor a,b,c in ABC:\n\n E[a-1][b-1] = c\n\n E[b-1][a-1] = c\n\n\n\ndef dist_dfs_tree(N,E,start):\n\n d = [-1]*N\n\n d[start] = 0\n\n q = [start]\n\n while q:\n\n i = q.pop()\n\n ci = d[i]\n\n for j,cj in list(E[i].items()):\n\n if d[j] !=-1:continue\n\n d[j] = ci+cj\n\n q.append(j)\n\n return d\n\n\n\nd = dist_dfs_tree(N,E,K-1)\n\nfor x,y in XY:\n\n print((d[x-1]+d[y-1]))","code_v0_loc":32,"code_v1_loc":26,"code_v0_num_chars":797,"code_v1_num_chars":594,"code_v0_no_empty_lines":"import heapq\n\nN = int(eval(input()))\nabc = [list(map(int, input().split())) for _ in range(N - 1)]\nQ, K = list(map(int, input().split()))\nxy = [list(map(int, input().split())) for _ in range(Q)]\nconnect = [[] for _ in range(N)]\nINFTY = 10**15\nfor a, b, c in abc:\n connect[a - 1].append([b - 1, c])\n connect[b - 1].append([a - 1, c])\ncost = [[INFTY, False] for _ in range(N)]\ncost[K - 1][0] = 0\nq = [(0, K - 1)]\nwhile q:\n _, i = heapq.heappop(q)\n if cost[i][1]:\n continue\n cost[i][1] = True\n ci0 = cost[i][0]\n for j, c in connect[i]:\n if cost[j][1]:\n continue\n tmp_cost = ci0 + c\n if tmp_cost < cost[j][0]:\n cost[j][0] = tmp_cost\n heapq.heappush(q, (tmp_cost, j))\nfor x, y in xy:\n print((cost[x - 1][0] + cost[y - 1][0]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nABC = [list(map(int, input().split())) for _ in [0] * (N - 1)]\nQ, K = list(map(int, input().split()))\nXY = [list(map(int, input().split())) for _ in [0] * Q]\nE = [{} for _ in [0] * N]\nfor a, b, c in ABC:\n E[a - 1][b - 1] = c\n E[b - 1][a - 1] = c\n\n\ndef dist_dfs_tree(N, E, start):\n d = [-1] * N\n d[start] = 0\n q = [start]\n while q:\n i = q.pop()\n ci = d[i]\n for j, cj in list(E[i].items()):\n if d[j] != -1:\n continue\n d[j] = ci + cj\n q.append(j)\n return d\n\n\nd = dist_dfs_tree(N, E, K - 1)\nfor x, y in XY:\n print((d[x - 1] + d[y - 1]))\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-import heapq","+N = int(eval(input()))","+ABC = [list(map(int, input().split())) for _ in [0] * (N - 1)]","+Q, K = list(map(int, input().split()))","+XY = [list(map(int, input().split())) for _ in [0] * Q]","+E = [{} for _ in [0] * N]","+for a, b, c in ABC:","+ E[a - 1][b - 1] = c","+ E[b - 1][a - 1] = c","-N = int(eval(input()))","-abc = [list(map(int, input().split())) for _ in range(N - 1)]","-Q, K = list(map(int, input().split()))","-xy = [list(map(int, input().split())) for _ in range(Q)]","-connect = [[] for _ in range(N)]","-INFTY = 10**15","-for a, b, c in abc:","- connect[a - 1].append([b - 1, c])","- connect[b - 1].append([a - 1, c])","-cost = [[INFTY, False] for _ in range(N)]","-cost[K - 1][0] = 0","-q = [(0, K - 1)]","-while q:","- _, i = heapq.heappop(q)","- if cost[i][1]:","- continue","- cost[i][1] = True","- ci0 = cost[i][0]","- for j, c in connect[i]:","- if cost[j][1]:","- continue","- tmp_cost = ci0 + c","- if tmp_cost < cost[j][0]:","- cost[j][0] = tmp_cost","- heapq.heappush(q, (tmp_cost, j))","-for x, y in xy:","- print((cost[x - 1][0] + cost[y - 1][0]))","+","+def dist_dfs_tree(N, E, start):","+ d = [-1] * N","+ d[start] = 0","+ q = [start]","+ while q:","+ i = q.pop()","+ ci = d[i]","+ for j, cj in list(E[i].items()):","+ if d[j] != -1:","+ continue","+ d[j] = ci + cj","+ q.append(j)","+ return d","+","+","+d = dist_dfs_tree(N, E, K - 1)","+for x, y in XY:","+ print((d[x - 1] + d[y - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2932223577,"measured_runtime_v1":0.2194568303,"runtime_lift":1.3361277359,"key":["s145761901","s949294302"]} +{"user_id":"u467041847","problem_id":"p03416","language":"python","submission_id_v0":"s364629573","submission_id_v1":"s490395080","cpu_time_v0":93,"cpu_time_v1":62,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(n):\n\n\tkey = 0\n\n\tfor i in range(1,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(B)-kaibun(A-1)))\n\n# optimized version of the same code:\n","target":"A,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(m, n):\n\n\tkey = 0\n\n\tfor i in range(m,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(A,B)))","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":173,"code_v1_num_chars":166,"code_v0_no_empty_lines":"A, B = list(map(int, input().split()))\n\n\ndef kaibun(n):\n key = 0\n for i in range(1, n + 1):\n if str(i) == str(i)[::-1]:\n key += 1\n return key\n\n\nprint((kaibun(B) - kaibun(A - 1)))\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\n\n\ndef kaibun(m, n):\n key = 0\n for i in range(m, n + 1):\n if str(i) == str(i)[::-1]:\n key += 1\n return key\n\n\nprint((kaibun(A, B)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-def kaibun(n):","+def kaibun(m, n):","- for i in range(1, n + 1):","+ for i in range(m, n + 1):","-print((kaibun(B) - kaibun(A - 1)))","+print((kaibun(A, B)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5900465159,"measured_runtime_v1":0.3264039189,"runtime_lift":1.8077188467,"key":["s364629573","s490395080"]} +{"user_id":"u802963389","problem_id":"p03575","language":"python","submission_id_v0":"s237263897","submission_id_v1":"s723941772","cpu_time_v0":737,"cpu_time_v1":23,"memory_v0":26508,"memory_v1":3436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":96.88,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom scipy.sparse.csgraph import dijkstra\n\nN, M = list(map(int, input().split()))\n\nedge = [list(map(int, input().split())) for _ in range(M)]\n\n\n\n# \u96a3\u63a5\u884c\u5217\n\ngraph = [[0] * (N + 1) for _ in range(N + 1)]\n\n\n\nfor i, j in edge:\n\n graph[i][j] = 1\n\n \n\nans = 0\n\nINF = 10 ** 9\n\nfor a, b in edge:\n\n # \u8fba\u3092\u53d6\u308a\u9664\u304f-> INF\n\n graph[a][b] = INF\n\n dist = dijkstra(graph, indices=a, directed=False) # directed=False -> \u7121\u52b9\u30b0\u30e9\u30d5\u7528\n\n if dist[b] >= INF:\n\n ans += 1\n\n # \u5143\u306b\u623b\u3059 -> 1\n\n graph[a][b] = 1\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"# C - Bridge\n\n# https:\/\/atcoder.jp\/contests\/abc075\/tasks\/abc075_c\n\n\n\nfrom collections import deque\n\n\n\ndef dfs(n, start, graph):\n\n visited = [False] * n\n\n stack = deque()\n\n stack.append(start)\n\n visited[start] = True\n\n while stack:\n\n q = stack.popleft()\n\n nxts = graph[q]\n\n for nxt in nxts:\n\n if not visited[nxt]:\n\n visited[nxt] = True\n\n stack.append(nxt)\n\n return visited\n\n\n\nn, m = list(map(int, input().split()))\n\nedge = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nans = 0\n\nfor i in range(m):\n\n graph = [[] for _ in range(n)]\n\n for itr, (a, b) in enumerate(edge):\n\n if itr != i:\n\n graph[a - 1].append(b - 1)\n\n graph[b - 1].append(a - 1)\n\n\n\n if not all(dfs(n, 0, graph)):\n\n ans += 1\n\n\n\nprint(ans)\n","code_v0_loc":22,"code_v1_loc":34,"code_v0_num_chars":482,"code_v1_num_chars":755,"code_v0_no_empty_lines":"from scipy.sparse.csgraph import dijkstra\n\nN, M = list(map(int, input().split()))\nedge = [list(map(int, input().split())) for _ in range(M)]\n# \u96a3\u63a5\u884c\u5217\ngraph = [[0] * (N + 1) for _ in range(N + 1)]\nfor i, j in edge:\n graph[i][j] = 1\nans = 0\nINF = 10**9\nfor a, b in edge:\n # \u8fba\u3092\u53d6\u308a\u9664\u304f-> INF\n graph[a][b] = INF\n dist = dijkstra(graph, indices=a, directed=False) # directed=False -> \u7121\u52b9\u30b0\u30e9\u30d5\u7528\n if dist[b] >= INF:\n ans += 1\n # \u5143\u306b\u623b\u3059 -> 1\n graph[a][b] = 1\nprint(ans)\n","code_v1_no_empty_lines":"# C - Bridge\n# https:\/\/atcoder.jp\/contests\/abc075\/tasks\/abc075_c\nfrom collections import deque\n\n\ndef dfs(n, start, graph):\n visited = [False] * n\n stack = deque()\n stack.append(start)\n visited[start] = True\n while stack:\n q = stack.popleft()\n nxts = graph[q]\n for nxt in nxts:\n if not visited[nxt]:\n visited[nxt] = True\n stack.append(nxt)\n return visited\n\n\nn, m = list(map(int, input().split()))\nedge = [list(map(int, input().split())) for _ in range(m)]\nans = 0\nfor i in range(m):\n graph = [[] for _ in range(n)]\n for itr, (a, b) in enumerate(edge):\n if itr != i:\n graph[a - 1].append(b - 1)\n graph[b - 1].append(a - 1)\n if not all(dfs(n, 0, graph)):\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":35.2941176471,"diff":["-from scipy.sparse.csgraph import dijkstra","+# C - Bridge","+# https:\/\/atcoder.jp\/contests\/abc075\/tasks\/abc075_c","+from collections import deque","-N, M = list(map(int, input().split()))","-edge = [list(map(int, input().split())) for _ in range(M)]","-# \u96a3\u63a5\u884c\u5217","-graph = [[0] * (N + 1) for _ in range(N + 1)]","-for i, j in edge:","- graph[i][j] = 1","+","+def dfs(n, start, graph):","+ visited = [False] * n","+ stack = deque()","+ stack.append(start)","+ visited[start] = True","+ while stack:","+ q = stack.popleft()","+ nxts = graph[q]","+ for nxt in nxts:","+ if not visited[nxt]:","+ visited[nxt] = True","+ stack.append(nxt)","+ return visited","+","+","+n, m = list(map(int, input().split()))","+edge = [list(map(int, input().split())) for _ in range(m)]","-INF = 10**9","-for a, b in edge:","- # \u8fba\u3092\u53d6\u308a\u9664\u304f-> INF","- graph[a][b] = INF","- dist = dijkstra(graph, indices=a, directed=False) # directed=False -> \u7121\u52b9\u30b0\u30e9\u30d5\u7528","- if dist[b] >= INF:","+for i in range(m):","+ graph = [[] for _ in range(n)]","+ for itr, (a, b) in enumerate(edge):","+ if itr != i:","+ graph[a - 1].append(b - 1)","+ graph[b - 1].append(a - 1)","+ if not all(dfs(n, 0, graph)):","- # \u5143\u306b\u623b\u3059 -> 1","- graph[a][b] = 1"],"diff_only_import_comment":false,"measured_runtime_v0":2.4053020849,"measured_runtime_v1":0.2385866599,"runtime_lift":10.0814609071,"key":["s237263897","s723941772"]} +{"user_id":"u868628468","problem_id":"p02555","language":"python","submission_id_v0":"s517832809","submission_id_v1":"s490323912","cpu_time_v0":151,"cpu_time_v1":62,"memory_v0":73984,"memory_v1":63380,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.94,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n for x in range(3,i+1):\n\n if x in [i-1,i-2]:\n\n continue\n\n dp[i] += dp[i-x]\n\n return dp[s]%mod\n\nprint((solve()))\n\n# optimized version of the same code:\n","target":"from sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n return dp[s]%mod\n\nprint((solve()))","code_v0_loc":14,"code_v1_loc":11,"code_v0_num_chars":330,"code_v1_num_chars":245,"code_v0_no_empty_lines":"from sys import stdin\n\n\ndef solve():\n s = int(stdin.readline())\n mod = 10**9 + 7\n if s < 3:\n return 0\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(3, s + 1):\n for x in range(3, i + 1):\n if x in [i - 1, i - 2]:\n continue\n dp[i] += dp[i - x]\n return dp[s] % mod\n\n\nprint((solve()))\n","code_v1_no_empty_lines":"from sys import stdin\n\n\ndef solve():\n s = int(stdin.readline())\n mod = 10**9 + 7\n if s < 3:\n return 0\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(3, s + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n return dp[s] % mod\n\n\nprint((solve()))\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["- for x in range(3, i + 1):","- if x in [i - 1, i - 2]:","- continue","- dp[i] += dp[i - x]","+ dp[i] = dp[i - 1] + dp[i - 3]"],"diff_only_import_comment":false,"measured_runtime_v0":0.6190335753,"measured_runtime_v1":0.2015811858,"runtime_lift":3.0708896406,"key":["s517832809","s490323912"]} +{"user_id":"u595289165","problem_id":"p02780","language":"python","submission_id_v0":"s893034804","submission_id_v1":"s639832443","cpu_time_v0":386,"cpu_time_v1":218,"memory_v0":33972,"memory_v1":25060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn, k = list(map(int, input().split()))\n\np = np.array(list(map(int, input().split())))\n\np += 1\n\nsum_E = np.cumsum(p)\n\nsum_e = np.append([0], sum_E)\n\nans = -1\n\nfor i in range(n-k+1):\n\n ans = max(ans, sum_e[i+k] - sum_e[i])\n\nprint((ans\/2))\n\n# optimized version of the same code:\n","target":"n, k = list(map(int, input().split()))\n\np = list(map(int, input().split()))\n\n\n\ndef calc(x):\n\n return (x + 1) \/ 2\n\n\n\n\n\nw = 0\n\n\n\nfor i in range(k):\n\n w += calc(p[i])\n\n\n\nans = w\n\nfor i in range(k, n):\n\n w += calc(p[i]) - calc(p[i - k])\n\n ans = max(ans, w)\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":17,"code_v0_num_chars":251,"code_v1_num_chars":270,"code_v0_no_empty_lines":"import numpy as np\n\nn, k = list(map(int, input().split()))\np = np.array(list(map(int, input().split())))\np += 1\nsum_E = np.cumsum(p)\nsum_e = np.append([0], sum_E)\nans = -1\nfor i in range(n - k + 1):\n ans = max(ans, sum_e[i + k] - sum_e[i])\nprint((ans \/ 2))\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\np = list(map(int, input().split()))\n\n\ndef calc(x):\n return (x + 1) \/ 2\n\n\nw = 0\nfor i in range(k):\n w += calc(p[i])\nans = w\nfor i in range(k, n):\n w += calc(p[i]) - calc(p[i - k])\n ans = max(ans, w)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":41.1764705882,"diff":["-import numpy as np","+n, k = list(map(int, input().split()))","+p = list(map(int, input().split()))","-n, k = list(map(int, input().split()))","-p = np.array(list(map(int, input().split())))","-p += 1","-sum_E = np.cumsum(p)","-sum_e = np.append([0], sum_E)","-ans = -1","-for i in range(n - k + 1):","- ans = max(ans, sum_e[i + k] - sum_e[i])","-print((ans \/ 2))","+","+def calc(x):","+ return (x + 1) \/ 2","+","+","+w = 0","+for i in range(k):","+ w += calc(p[i])","+ans = w","+for i in range(k, n):","+ w += calc(p[i]) - calc(p[i - k])","+ ans = max(ans, w)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3460690436,"measured_runtime_v1":0.2107389896,"runtime_lift":6.3873754267,"key":["s893034804","s639832443"]} +{"user_id":"u606878291","problem_id":"p03013","language":"python","submission_id_v0":"s651904471","submission_id_v1":"s107901717","cpu_time_v0":460,"cpu_time_v1":177,"memory_v0":21064,"memory_v1":11968,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\n\n\ndef main(n, m, a):\n\n dp = np.zeros(n + 1, dtype=int)\n\n dp[0] = 1\n\n dp[1] = 1 if 1 not in a else 0\n\n\n\n for i in range(2, len(dp)):\n\n dp[i] = dp[i - 1] + dp[i - 2] if i not in a else 0\n\n dp[i] %= 1000000007\n\n\n\n return dp[-1]\n\n\n\n\n\nif __name__ == '__main__':\n\n N, M = list(map(int, input().split()))\n\n A = set()\n\n for _ in range(M):\n\n A.add(int(eval(input())))\n\n\n\n print((main(N, M, A)))\n\n\n# optimized version of the same code:\n","target":"import math\n\n\n\nMOD = int(math.pow(10, 9)) + 7\n\nN, M = list(map(int, input().split(' ')))\n\nbroken_steps = {int(eval(input())) for _ in range(M)}\n\n\n\ndp = [0] * (N + 1)\n\n\n\ndp[0] = 1\n\nif 1 not in broken_steps:\n\n dp[1] = 1\n\n\n\nfor step in range(2, N + 1):\n\n if step not in broken_steps:\n\n dp[step] = (dp[step - 1] + dp[step - 2]) % MOD\n\n\n\nprint((dp[N]))\n","code_v0_loc":22,"code_v1_loc":17,"code_v0_num_chars":442,"code_v1_num_chars":347,"code_v0_no_empty_lines":"import numpy as np\n\n\ndef main(n, m, a):\n dp = np.zeros(n + 1, dtype=int)\n dp[0] = 1\n dp[1] = 1 if 1 not in a else 0\n for i in range(2, len(dp)):\n dp[i] = dp[i - 1] + dp[i - 2] if i not in a else 0\n dp[i] %= 1000000007\n return dp[-1]\n\n\nif __name__ == \"__main__\":\n N, M = list(map(int, input().split()))\n A = set()\n for _ in range(M):\n A.add(int(eval(input())))\n print((main(N, M, A)))\n","code_v1_no_empty_lines":"import math\n\nMOD = int(math.pow(10, 9)) + 7\nN, M = list(map(int, input().split(\" \")))\nbroken_steps = {int(eval(input())) for _ in range(M)}\ndp = [0] * (N + 1)\ndp[0] = 1\nif 1 not in broken_steps:\n dp[1] = 1\nfor step in range(2, N + 1):\n if step not in broken_steps:\n dp[step] = (dp[step - 1] + dp[step - 2]) % MOD\nprint((dp[N]))\n","code_same":false,"relative_loc_diff_percent":22.7272727273,"diff":["-import numpy as np","+import math","-","-def main(n, m, a):","- dp = np.zeros(n + 1, dtype=int)","- dp[0] = 1","- dp[1] = 1 if 1 not in a else 0","- for i in range(2, len(dp)):","- dp[i] = dp[i - 1] + dp[i - 2] if i not in a else 0","- dp[i] %= 1000000007","- return dp[-1]","-","-","-if __name__ == \"__main__\":","- N, M = list(map(int, input().split()))","- A = set()","- for _ in range(M):","- A.add(int(eval(input())))","- print((main(N, M, A)))","+MOD = int(math.pow(10, 9)) + 7","+N, M = list(map(int, input().split(\" \")))","+broken_steps = {int(eval(input())) for _ in range(M)}","+dp = [0] * (N + 1)","+dp[0] = 1","+if 1 not in broken_steps:","+ dp[1] = 1","+for step in range(2, N + 1):","+ if step not in broken_steps:","+ dp[step] = (dp[step - 1] + dp[step - 2]) % MOD","+print((dp[N]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3399993193,"measured_runtime_v1":0.5207966185,"runtime_lift":2.572980069,"key":["s651904471","s107901717"]} +{"user_id":"u813993459","problem_id":"p02690","language":"python","submission_id_v0":"s822177134","submission_id_v1":"s188572308","cpu_time_v0":110,"cpu_time_v1":41,"memory_v0":27216,"memory_v1":9056,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nx = int(eval(input()))\n\ntmp_list=[]\n\nc=0\n\ntmp_2=0\n\nwhile(1):\n\n tmp_1=c**5\n\n if (tmp_1 - tmp_2)<=x:\n\n tmp_list+=[tmp_1]\n\n else:\n\n break\n\n tmp_2=tmp_1\n\n c+=1\n\n \n\ndef \u305b\u3044\u304c\u308f(target:list,x) -> list:\n\n for i in np.flipud(target):\n\n for j in target:\n\n tmp=i+j\n\n if tmp==x:\n\n return [int(i**(1\/5)),int(j**(1\/5))*-1]\n\n if tmp>x:\n\n break\n\n return 0\n\n \n\ndef \u3075\u304c\u308f(target:list,x) -> list:\n\n for i in np.flipud(target):\n\n for j in target:\n\n tmp=i-j\n\n if tmp==x:\n\n return [int(i**(1\/5)),int(j**(1\/5))]\n\n if tmp list:\n for i in np.flipud(target):\n for j in target:\n tmp = i + j\n if tmp == x:\n return [int(i ** (1 \/ 5)), int(j ** (1 \/ 5)) * -1]\n if tmp > x:\n break\n return 0\n\n\ndef \u3075\u304c\u308f(target: list, x) -> list:\n for i in np.flipud(target):\n for j in target:\n tmp = i - j\n if tmp == x:\n return [int(i ** (1 \/ 5)), int(j ** (1 \/ 5))]\n if tmp < x:\n break\n return 0\n\n\nans = \u3075\u304c\u308f(tmp_list, x)\nif ans == 0:\n ans = \u305b\u3044\u304c\u308f(tmp_list, x)\nprint((ans[0], ans[1]))\n","code_v1_no_empty_lines":"X = int(eval(input()))\nfor a in range(0, 121):\n for b in range(0, 121):\n if X == a**5 - b**5:\n print((a, b))\n exit()\n elif X == a**5 + b**5:\n print((a, -b))\n exit()\n elif X == -(a**5) - (10**4 - b) ** 5:\n print((-a, 10**4 - b))\n exit()\n","code_same":false,"relative_loc_diff_percent":68.4210526316,"diff":["-import numpy as np","-","-x = int(eval(input()))","-tmp_list = []","-c = 0","-tmp_2 = 0","-while 1:","- tmp_1 = c**5","- if (tmp_1 - tmp_2) <= x:","- tmp_list += [tmp_1]","- else:","- break","- tmp_2 = tmp_1","- c += 1","-","-","-def \u305b\u3044\u304c\u308f(target: list, x) -> list:","- for i in np.flipud(target):","- for j in target:","- tmp = i + j","- if tmp == x:","- return [int(i ** (1 \/ 5)), int(j ** (1 \/ 5)) * -1]","- if tmp > x:","- break","- return 0","-","-","-def \u3075\u304c\u308f(target: list, x) -> list:","- for i in np.flipud(target):","- for j in target:","- tmp = i - j","- if tmp == x:","- return [int(i ** (1 \/ 5)), int(j ** (1 \/ 5))]","- if tmp < x:","- break","- return 0","-","-","-ans = \u3075\u304c\u308f(tmp_list, x)","-if ans == 0:","- ans = \u305b\u3044\u304c\u308f(tmp_list, x)","-print((ans[0], ans[1]))","+X = int(eval(input()))","+for a in range(0, 121):","+ for b in range(0, 121):","+ if X == a**5 - b**5:","+ print((a, b))","+ exit()","+ elif X == a**5 + b**5:","+ print((a, -b))","+ exit()","+ elif X == -(a**5) - (10**4 - b) ** 5:","+ print((-a, 10**4 - b))","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":2.0893567204,"measured_runtime_v1":0.3149728358,"runtime_lift":6.6334505171,"key":["s822177134","s188572308"]} +{"user_id":"u172035535","problem_id":"p03038","language":"python","submission_id_v0":"s297180816","submission_id_v1":"s388125708","cpu_time_v0":582,"cpu_time_v1":497,"memory_v0":32968,"memory_v1":32976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.6,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,m = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nA.sort()\n\nbc = [list(map(int,input().split())) for _ in range(m)]\n\n\n\nbc.sort(key=lambda x:x[1],reverse=1)\n\n\n\ni = 0#bc\u306e\u6dfb\u3048\u5b57\n\nj = 0#A\u306e\u6dfb\u3048\u5b57\n\nwhile 1:\n\n\tif i >= m or j >= n:\n\n\t\t#print('i\u304bj\u304c\u8d85\u3048\u305f\uff01')\n\n\t\tbreak\n\n\tif bc[i][1] < A[j]:\n\n\t\t#print('A\u3067\u3063\u304b')\n\n\t\tbreak\n\n\tfor k in range(bc[i][0]):\n\n\t\t#print(i,j,k)\n\n\t\tA[j] = bc[i][1]\n\n\t\tj+=1\n\n\t\tif j >= n:\n\n\t\t\t#print('for\u6587\u5185\u3001j\u304c\u8d85\u3048\u305f')\n\n\t\t\tbreak\n\n\t\tif A[j] > bc[i][1]:\n\n\t\t\t#print('for\u6587\u5185\u3001A\u3067\u3063\u304b')\n\n\t\t\tbreak\n\n\ti+=1\n\n# print(A)\n\nprint((sum(A)))\n\n# optimized version of the same code:\n","target":"from heapq import heapify,heappop,heappush\n\nn,m = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nheapify(A)\n\nbc = [list(map(int,input().split())) for i in range(m)]\n\nbc.sort(key=lambda x:x[1],reverse=1)\n\n\n\nflag = 0\n\n# print(A)\n\nfor b,c in bc:\n\n\tif flag:\n\n\t\tbreak\n\n\tfor i in range(b):\n\n\t\ta = heappop(A)\n\n\t\tif c <= a:\n\n\t\t\theappush(A,a)\n\n\t\t\tflag = 1\n\n\t\t\tbreak\n\n\t\telse:\n\n\t\t\theappush(A,c)\n\nprint((sum(A)))","code_v0_loc":29,"code_v1_loc":21,"code_v0_num_chars":529,"code_v1_num_chars":413,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nA = list(map(int, input().split()))\nA.sort()\nbc = [list(map(int, input().split())) for _ in range(m)]\nbc.sort(key=lambda x: x[1], reverse=1)\ni = 0 # bc\u306e\u6dfb\u3048\u5b57\nj = 0 # A\u306e\u6dfb\u3048\u5b57\nwhile 1:\n if i >= m or j >= n:\n # print('i\u304bj\u304c\u8d85\u3048\u305f\uff01')\n break\n if bc[i][1] < A[j]:\n # print('A\u3067\u3063\u304b')\n break\n for k in range(bc[i][0]):\n # print(i,j,k)\n A[j] = bc[i][1]\n j += 1\n if j >= n:\n # print('for\u6587\u5185\u3001j\u304c\u8d85\u3048\u305f')\n break\n if A[j] > bc[i][1]:\n # print('for\u6587\u5185\u3001A\u3067\u3063\u304b')\n break\n i += 1\n# print(A)\nprint((sum(A)))\n","code_v1_no_empty_lines":"from heapq import heapify, heappop, heappush\n\nn, m = list(map(int, input().split()))\nA = list(map(int, input().split()))\nheapify(A)\nbc = [list(map(int, input().split())) for i in range(m)]\nbc.sort(key=lambda x: x[1], reverse=1)\nflag = 0\n# print(A)\nfor b, c in bc:\n if flag:\n break\n for i in range(b):\n a = heappop(A)\n if c <= a:\n heappush(A, a)\n flag = 1\n break\n else:\n heappush(A, c)\nprint((sum(A)))\n","code_same":false,"relative_loc_diff_percent":27.5862068966,"diff":["+from heapq import heapify, heappop, heappush","+","-A.sort()","-bc = [list(map(int, input().split())) for _ in range(m)]","+heapify(A)","+bc = [list(map(int, input().split())) for i in range(m)]","-i = 0 # bc\u306e\u6dfb\u3048\u5b57","-j = 0 # A\u306e\u6dfb\u3048\u5b57","-while 1:","- if i >= m or j >= n:","- # print('i\u304bj\u304c\u8d85\u3048\u305f\uff01')","+flag = 0","+# print(A)","+for b, c in bc:","+ if flag:","- if bc[i][1] < A[j]:","- # print('A\u3067\u3063\u304b')","- break","- for k in range(bc[i][0]):","- # print(i,j,k)","- A[j] = bc[i][1]","- j += 1","- if j >= n:","- # print('for\u6587\u5185\u3001j\u304c\u8d85\u3048\u305f')","+ for i in range(b):","+ a = heappop(A)","+ if c <= a:","+ heappush(A, a)","+ flag = 1","- if A[j] > bc[i][1]:","- # print('for\u6587\u5185\u3001A\u3067\u3063\u304b')","- break","- i += 1","-# print(A)","+ else:","+ heappush(A, c)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2036247263,"measured_runtime_v1":0.0063813381,"runtime_lift":31.9094086793,"key":["s297180816","s388125708"]} +{"user_id":"u678167152","problem_id":"p02773","language":"python","submission_id_v0":"s779115559","submission_id_v1":"s953043553","cpu_time_v0":682,"cpu_time_v1":392,"memory_v0":32096,"memory_v1":38716,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\ns_list = {}\n\nfor i in range(N):\n\n S = eval(input())\n\n if S in list(s_list.keys()):\n\n s_list[S] += 1\n\n else:\n\n s_list[S] = 0\n\nmax = 0\n\nmaxs = []\n\nfor s,c in list(s_list.items()):\n\n if c > max:\n\n maxs = [s]\n\n max = c\n\n elif c == max:\n\n maxs.append(s)\n\nmaxs.sort()\n\nfor m in maxs:\n\n print(m)\n\n# optimized version of the same code:\n","target":"from collections import Counter\n\ndef solve():\n\n N = int(input())\n\n S = [input() for _ in range(N)]\n\n c = Counter(S)\n\n M = max(c.values())\n\n ans = []\n\n for k,v in c.items():\n\n if v==M:\n\n ans.append(k)\n\n ans.sort()\n\n return ans\n\nprint(*solve(),sep='\\n')\n","code_v0_loc":19,"code_v1_loc":13,"code_v0_num_chars":309,"code_v1_num_chars":267,"code_v0_no_empty_lines":"N = int(eval(input()))\ns_list = {}\nfor i in range(N):\n S = eval(input())\n if S in list(s_list.keys()):\n s_list[S] += 1\n else:\n s_list[S] = 0\nmax = 0\nmaxs = []\nfor s, c in list(s_list.items()):\n if c > max:\n maxs = [s]\n max = c\n elif c == max:\n maxs.append(s)\nmaxs.sort()\nfor m in maxs:\n print(m)\n","code_v1_no_empty_lines":"from collections import Counter\n\n\ndef solve():\n N = int(input())\n S = [input() for _ in range(N)]\n c = Counter(S)\n M = max(c.values())\n ans = []\n for k, v in c.items():\n if v == M:\n ans.append(k)\n ans.sort()\n return ans\n\n\nprint(*solve(), sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":31.5789473684,"diff":["-N = int(eval(input()))","-s_list = {}","-for i in range(N):","- S = eval(input())","- if S in list(s_list.keys()):","- s_list[S] += 1","- else:","- s_list[S] = 0","-max = 0","-maxs = []","-for s, c in list(s_list.items()):","- if c > max:","- maxs = [s]","- max = c","- elif c == max:","- maxs.append(s)","-maxs.sort()","-for m in maxs:","- print(m)","+from collections import Counter","+","+","+def solve():","+ N = int(input())","+ S = [input() for _ in range(N)]","+ c = Counter(S)","+ M = max(c.values())","+ ans = []","+ for k, v in c.items():","+ if v == M:","+ ans.append(k)","+ ans.sort()","+ return ans","+","+","+print(*solve(), sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1935686147,"measured_runtime_v1":0.0062823365,"runtime_lift":30.8115643329,"key":["s779115559","s953043553"]} +{"user_id":"u164727245","problem_id":"p02874","language":"python","submission_id_v0":"s481111092","submission_id_v1":"s203996294","cpu_time_v0":768,"cpu_time_v1":607,"memory_v0":65432,"memory_v1":56424,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.96,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# coding: utf-8\n\nimport numpy as np\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n = int(args[0])\n\n LR = [tuple(map(int, a.split())) for a in args[1:]]\n\n L, R = list(zip(*LR))\n\n\n\n ret = 0\n\n\n\n p, q = np.argmax(L), np.argmin(R)\n\n lp, rq = L[p], R[q]\n\n\n\n ret = max(0, 1+rq-lp) + max(0, max(1+r-l for l, r in LR))\n\n\n\n AB = [[max(0, 1+r-lp), max(0, 1+rq-l)] for l, r in LR]\n\n AB.sort(key=lambda x: (x[0], -x[1]))\n\n A, B = list(map(list, list(zip(*AB))))\n\n\n\n # for i in range(1, n):\n\n # ret = max(ret, min(A[i:]) + min(B[:i]))\n\n b_min = 1+10**9\n\n for i in range(n-1):\n\n b_min = min(b_min, B[i])\n\n ret = max(ret, b_min + A[i+1])\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n = int(args[0])\n\n LR = [tuple(map(int, a.split())) for a in args[1:]]\n\n L, R = list(zip(*LR))\n\n\n\n ret = 0\n\n\n\n # lp, rq = max(L), min(R)\n\n lp, rq = 0, 1+10**9\n\n for l, r in LR:\n\n lp, rq = max(lp, l), min(rq, r)\n\n\n\n ret = max(0, 1+rq-lp) + max(0, max(1+r-l for l, r in LR))\n\n\n\n AB = [[max(0, 1+r-lp), max(0, 1+rq-l)] for l, r in LR]\n\n AB.sort(key=lambda x: (x[0], -x[1]))\n\n A, B = list(map(list, list(zip(*AB))))\n\n\n\n # for i in range(1, n):\n\n # ret = max(ret, min(A[i:]) + min(B[:i]))\n\n b_min = 1+10**9\n\n for i in range(n-1):\n\n b_min = min(b_min, B[i])\n\n ret = max(ret, b_min + A[i+1])\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n","code_v0_loc":32,"code_v1_loc":33,"code_v0_num_chars":761,"code_v1_num_chars":795,"code_v0_no_empty_lines":"# coding: utf-8\nimport numpy as np\n\n\ndef solve(*args: str) -> str:\n n = int(args[0])\n LR = [tuple(map(int, a.split())) for a in args[1:]]\n L, R = list(zip(*LR))\n ret = 0\n p, q = np.argmax(L), np.argmin(R)\n lp, rq = L[p], R[q]\n ret = max(0, 1 + rq - lp) + max(0, max(1 + r - l for l, r in LR))\n AB = [[max(0, 1 + r - lp), max(0, 1 + rq - l)] for l, r in LR]\n AB.sort(key=lambda x: (x[0], -x[1]))\n A, B = list(map(list, list(zip(*AB))))\n # for i in range(1, n):\n # ret = max(ret, min(A[i:]) + min(B[:i]))\n b_min = 1 + 10**9\n for i in range(n - 1):\n b_min = min(b_min, B[i])\n ret = max(ret, b_min + A[i + 1])\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_v1_no_empty_lines":"# coding: utf-8\ndef solve(*args: str) -> str:\n n = int(args[0])\n LR = [tuple(map(int, a.split())) for a in args[1:]]\n L, R = list(zip(*LR))\n ret = 0\n # lp, rq = max(L), min(R)\n lp, rq = 0, 1 + 10**9\n for l, r in LR:\n lp, rq = max(lp, l), min(rq, r)\n ret = max(0, 1 + rq - lp) + max(0, max(1 + r - l for l, r in LR))\n AB = [[max(0, 1 + r - lp), max(0, 1 + rq - l)] for l, r in LR]\n AB.sort(key=lambda x: (x[0], -x[1]))\n A, B = list(map(list, list(zip(*AB))))\n # for i in range(1, n):\n # ret = max(ret, min(A[i:]) + min(B[:i]))\n b_min = 1 + 10**9\n for i in range(n - 1):\n b_min = min(b_min, B[i])\n ret = max(ret, b_min + A[i + 1])\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_same":false,"relative_loc_diff_percent":3.0303030303,"diff":["-import numpy as np","-","-","- p, q = np.argmax(L), np.argmin(R)","- lp, rq = L[p], R[q]","+ # lp, rq = max(L), min(R)","+ lp, rq = 0, 1 + 10**9","+ for l, r in LR:","+ lp, rq = max(lp, l), min(rq, r)"],"diff_only_import_comment":false,"measured_runtime_v0":1.336892437,"measured_runtime_v1":0.216103163,"runtime_lift":6.1863621908,"key":["s481111092","s203996294"]} +{"user_id":"u324197506","problem_id":"p03164","language":"python","submission_id_v0":"s068179226","submission_id_v1":"s647331136","cpu_time_v0":1752,"cpu_time_v1":324,"memory_v0":35900,"memory_v1":20624,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.51,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nimport numpy as np\n\n \n\nN,W = list(map(int, input().split()))\n\n \n\ndp = [10 ** 10] * N * (10 ** 4)\n\ndp[0] = 0\n\ndp = np.array(dp)\n\n \n\n \n\nfor i in range(N):\n\n w,v = list(map(int, input().split()))\n\n dp[v:] = np.minimum(dp[v:] , dp[:-v] + w)\n\n \n\nfor i,count in enumerate(dp):\n\n if dp[i] <= W:\n\n ans = i\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\nimport numpy as np\n\n \n\nN,W = list(map(int, input().split()))\n\n \n\ndp = [10 ** 10] * (N * (10 ** 3) + 1)\n\ndp[0] = 0\n\ndp = np.array(dp)\n\n \n\n \n\nfor i in range(N):\n\n w,v = list(map(int, input().split()))\n\n dp[v:] = np.minimum(dp[v:] , dp[:-v] + w)\n\n \n\nfor i,count in enumerate(dp):\n\n if dp[i] <= W:\n\n ans = i\n\nprint(ans)","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":354,"code_v1_num_chars":360,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nimport numpy as np\n\nN, W = list(map(int, input().split()))\ndp = [10**10] * N * (10**4)\ndp[0] = 0\ndp = np.array(dp)\nfor i in range(N):\n w, v = list(map(int, input().split()))\n dp[v:] = np.minimum(dp[v:], dp[:-v] + w)\nfor i, count in enumerate(dp):\n if dp[i] <= W:\n ans = i\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nimport numpy as np\n\nN, W = list(map(int, input().split()))\ndp = [10**10] * (N * (10**3) + 1)\ndp[0] = 0\ndp = np.array(dp)\nfor i in range(N):\n w, v = list(map(int, input().split()))\n dp[v:] = np.minimum(dp[v:], dp[:-v] + w)\nfor i, count in enumerate(dp):\n if dp[i] <= W:\n ans = i\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-dp = [10**10] * N * (10**4)","+dp = [10**10] * (N * (10**3) + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":2.3342260687,"measured_runtime_v1":1.6798749726,"runtime_lift":1.3895236889,"key":["s068179226","s647331136"]} +{"user_id":"u018679195","problem_id":"p03796","language":"python","submission_id_v0":"s992615685","submission_id_v1":"s822858934","cpu_time_v0":232,"cpu_time_v1":36,"memory_v0":4024,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nx = int(eval(input()))\n\nprint((math.factorial(x) % (10**9 + 7)))\n\n# optimized version of the same code:\n","target":"M = 1000000007\n\nn=int(eval(input()))\n\nf = 1\n\nfor i in range(1, n + 1): \n\n f = (f * i) % M \n\nprint(f)","code_v0_loc":3,"code_v1_loc":6,"code_v0_num_chars":69,"code_v1_num_chars":98,"code_v0_no_empty_lines":"import math\n\nx = int(eval(input()))\nprint((math.factorial(x) % (10**9 + 7)))\n","code_v1_no_empty_lines":"M = 1000000007\nn = int(eval(input()))\nf = 1\nfor i in range(1, n + 1):\n f = (f * i) % M\nprint(f)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import math","-","-x = int(eval(input()))","-print((math.factorial(x) % (10**9 + 7)))","+M = 1000000007","+n = int(eval(input()))","+f = 1","+for i in range(1, n + 1):","+ f = (f * i) % M","+print(f)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5256081567,"measured_runtime_v1":0.2486211307,"runtime_lift":2.1140928576,"key":["s992615685","s822858934"]} +{"user_id":"u926412290","problem_id":"p02730","language":"python","submission_id_v0":"s449146060","submission_id_v1":"s811980926","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = eval(input())\n\nN = len(S)\n\nleft = S[:int(N\/2)]\n\nright = S[int((N+2)\/2):]\n\nS_reversed = \"\".join(reversed(list(S)))\n\nleft_reversed = \"\".join(reversed(list(left)))\n\nright_reversed = \"\".join(reversed(list(right)))\n\n\n\nif S == S_reversed and left == left_reversed and right == right_reversed:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n# optimized version of the same code:\n","target":"S = eval(input())\n\nN = len(S)\n\nleft = S[:int(N\/2)]\n\nright = S[int((N+2)\/2):]\n\n\n\nif S == S[::-1] and left == left[::-1] and right == right[::-1]:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":12,"code_v1_loc":9,"code_v0_num_chars":326,"code_v1_num_chars":180,"code_v0_no_empty_lines":"S = eval(input())\nN = len(S)\nleft = S[: int(N \/ 2)]\nright = S[int((N + 2) \/ 2) :]\nS_reversed = \"\".join(reversed(list(S)))\nleft_reversed = \"\".join(reversed(list(left)))\nright_reversed = \"\".join(reversed(list(right)))\nif S == S_reversed and left == left_reversed and right == right_reversed:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"S = eval(input())\nN = len(S)\nleft = S[: int(N \/ 2)]\nright = S[int((N + 2) \/ 2) :]\nif S == S[::-1] and left == left[::-1] and right == right[::-1]:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-S_reversed = \"\".join(reversed(list(S)))","-left_reversed = \"\".join(reversed(list(left)))","-right_reversed = \"\".join(reversed(list(right)))","-if S == S_reversed and left == left_reversed and right == right_reversed:","+if S == S[::-1] and left == left[::-1] and right == right[::-1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2928721476,"measured_runtime_v1":0.0555575957,"runtime_lift":5.2715050689,"key":["s449146060","s811980926"]} +{"user_id":"u896741788","problem_id":"p03416","language":"python","submission_id_v0":"s606562684","submission_id_v1":"s721402043","cpu_time_v0":284,"cpu_time_v1":62,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b=list(map(int,input().split()))\n\nans=0\n\nfor i in range(b+1)[a:]:\n\n if len(str(i))%2==0:\n\n p=list(str(i))[:len(str(i))\/\/2]\n\n q=list(reversed(list(str(i))[len(str(i))\/\/2:]))\n\n if p==q:\n\n ans+=1\n\n else:\n\n s=list(str(i))[:len(str(i))\/\/2+1]\n\n d=list(reversed(list(str(i))[len(str(i))\/\/2:]))\n\n if s==d:\n\n ans += 1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"a,s=list(map(int,input().split()))\n\nad=0\n\nfor i in range(a,s+1):\n\n if str(i)==str(i)[::-1]:ad+=1\n\nprint(ad)","code_v0_loc":14,"code_v1_loc":5,"code_v0_num_chars":346,"code_v1_num_chars":102,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nans = 0\nfor i in range(b + 1)[a:]:\n if len(str(i)) % 2 == 0:\n p = list(str(i))[: len(str(i)) \/\/ 2]\n q = list(reversed(list(str(i))[len(str(i)) \/\/ 2 :]))\n if p == q:\n ans += 1\n else:\n s = list(str(i))[: len(str(i)) \/\/ 2 + 1]\n d = list(reversed(list(str(i))[len(str(i)) \/\/ 2 :]))\n if s == d:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"a, s = list(map(int, input().split()))\nad = 0\nfor i in range(a, s + 1):\n if str(i) == str(i)[::-1]:\n ad += 1\nprint(ad)\n","code_same":false,"relative_loc_diff_percent":64.2857142857,"diff":["-a, b = list(map(int, input().split()))","-ans = 0","-for i in range(b + 1)[a:]:","- if len(str(i)) % 2 == 0:","- p = list(str(i))[: len(str(i)) \/\/ 2]","- q = list(reversed(list(str(i))[len(str(i)) \/\/ 2 :]))","- if p == q:","- ans += 1","- else:","- s = list(str(i))[: len(str(i)) \/\/ 2 + 1]","- d = list(reversed(list(str(i))[len(str(i)) \/\/ 2 :]))","- if s == d:","- ans += 1","-print(ans)","+a, s = list(map(int, input().split()))","+ad = 0","+for i in range(a, s + 1):","+ if str(i) == str(i)[::-1]:","+ ad += 1","+print(ad)"],"diff_only_import_comment":false,"measured_runtime_v0":0.6921946588,"measured_runtime_v1":0.3831296915,"runtime_lift":1.8066849794,"key":["s606562684","s721402043"]} +{"user_id":"u036104576","problem_id":"p02814","language":"python","submission_id_v0":"s934732087","submission_id_v1":"s059526149","cpu_time_v0":249,"cpu_time_v1":174,"memory_v0":14544,"memory_v1":90620,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.12,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\n \n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nfrom collections import defaultdict\n\n \n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n \n\n \n\nfrom functools import reduce\n\n# from math import *\n\nfrom fractions import *\n\nN, M = list(map(int, readline().split()))\n\nA = list(sorted([int(x) \/\/ 2 for x in readline().split()]))\n\nmin_cm = reduce(lambda a, b: (a * b) \/\/ gcd(a, b), A)\n\n \n\n# print(all(map(lambda x: (min_cm \/\/ x) % 2 == 1, A)))\n\nif not all([(min_cm \/\/ x) % 2 == 1 for x in A]):\n\n print((0))\n\n exit(0)\n\nif min_cm > M:\n\n print((0))\n\n exit(0)\n\nans = (M \/\/ min_cm + 1) \/\/ 2\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\nimport heapq\n\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nINF = 10 ** 9 + 7\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n# map(int, input().split())\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) \/\/ 2 for x in input().split()])\n\n\n\ndef f(n):\n\n res = 0\n\n while n % 2 == 0:\n\n n \/\/= 2\n\n res += 1\n\n return res\n\n\n\ndef gcd(a, b):\n\n if b == 0:\n\n return a\n\n return gcd(b, a % b)\n\n\n\nx = f(A[0])\n\nfor a in A:\n\n y = f(a)\n\n if y != x:\n\n print((0))\n\n exit()\n\n\n\nlcm = A[0]\n\nfor i in range(1, N):\n\n lcm = lcm * A[i] \/\/ gcd(lcm, A[i])\n\n\n\nprint(((M \/\/ lcm + 1) \/\/ 2))","code_v0_loc":31,"code_v1_loc":43,"code_v0_num_chars":729,"code_v1_num_chars":789,"code_v0_no_empty_lines":"import sys\nimport itertools\n\n# import numpy as np\nimport time\nimport math\n\nsys.setrecursionlimit(10**7)\nfrom collections import defaultdict\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom functools import reduce\n\n# from math import *\nfrom fractions import *\n\nN, M = list(map(int, readline().split()))\nA = list(sorted([int(x) \/\/ 2 for x in readline().split()]))\nmin_cm = reduce(lambda a, b: (a * b) \/\/ gcd(a, b), A)\n# print(all(map(lambda x: (min_cm \/\/ x) % 2 == 1, A)))\nif not all([(min_cm \/\/ x) % 2 == 1 for x in A]):\n print((0))\n exit(0)\nif min_cm > M:\n print((0))\n exit(0)\nans = (M \/\/ min_cm + 1) \/\/ 2\nprint(ans)\n","code_v1_no_empty_lines":"import sys\nimport itertools\n\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**7)\nINF = 10**9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n# map(int, input().split())\nN, M = list(map(int, input().split()))\nA = list([int(x) \/\/ 2 for x in input().split()])\n\n\ndef f(n):\n res = 0\n while n % 2 == 0:\n n \/\/= 2\n res += 1\n return res\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\nx = f(A[0])\nfor a in A:\n y = f(a)\n if y != x:\n print((0))\n exit()\nlcm = A[0]\nfor i in range(1, N):\n lcm = lcm * A[i] \/\/ gcd(lcm, A[i])\nprint(((M \/\/ lcm + 1) \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":27.9069767442,"diff":["+import heapq","+from collections import defaultdict","-from collections import defaultdict","-","+INF = 10**9 + 7","-from functools import reduce","+# map(int, input().split())","+N, M = list(map(int, input().split()))","+A = list([int(x) \/\/ 2 for x in input().split()])","-# from math import *","-from fractions import *","-N, M = list(map(int, readline().split()))","-A = list(sorted([int(x) \/\/ 2 for x in readline().split()]))","-min_cm = reduce(lambda a, b: (a * b) \/\/ gcd(a, b), A)","-# print(all(map(lambda x: (min_cm \/\/ x) % 2 == 1, A)))","-if not all([(min_cm \/\/ x) % 2 == 1 for x in A]):","- print((0))","- exit(0)","-if min_cm > M:","- print((0))","- exit(0)","-ans = (M \/\/ min_cm + 1) \/\/ 2","-print(ans)","+def f(n):","+ res = 0","+ while n % 2 == 0:","+ n \/\/= 2","+ res += 1","+ return res","+","+","+def gcd(a, b):","+ if b == 0:","+ return a","+ return gcd(b, a % b)","+","+","+x = f(A[0])","+for a in A:","+ y = f(a)","+ if y != x:","+ print((0))","+ exit()","+lcm = A[0]","+for i in range(1, N):","+ lcm = lcm * A[i] \/\/ gcd(lcm, A[i])","+print(((M \/\/ lcm + 1) \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.414138025,"measured_runtime_v1":0.277947119,"runtime_lift":1.4899885508,"key":["s934732087","s059526149"]} +{"user_id":"u150984829","problem_id":"p00447","language":"python","submission_id_v0":"s670764208","submission_id_v1":"s671843082","cpu_time_v0":80,"cpu_time_v1":50,"memory_v0":6096,"memory_v1":6104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport operator\n\nfor e in iter(input,'0'):\n\n target = [[*list(map(int,input().split()))]for _ in[0]*int(e)]\n\n bx, by = target[0]\n\n target = {(x - bx, y - by) for x, y in target}\n\n max_tx = max(list(map(operator.itemgetter(0), target)))\n\n b = {tuple(map(int,input().split()))for _ in[0]*int(eval(input()))}\n\n max_sx = max(list(map(operator.itemgetter(0), b)))\n\n lim_x = max_sx - max_tx\n\n for x,y in b:\n\n if x > lim_x:continue\n\n for u,v in target:\n\n if (x + u, y + v) not in b:break\n\n else:\n\n print((x - bx, y - by))\n\n break\n\n\n# optimized version of the same code:\n","target":"import operator\n\nfor e in iter(input,'0'):\n\n target = [[*list(map(int,input().split()))]for _ in[0]*int(e)]\n\n bx, by = min(target)\n\n target = {(x - bx, y - by) for x, y in target}\n\n max_tx = max(list(map(operator.itemgetter(0), target)))\n\n b = {tuple(map(int,input().split()))for _ in[0]*int(eval(input()))}\n\n max_sx = max(list(map(operator.itemgetter(0), b)))\n\n lim_x = max_sx - max_tx\n\n for x,y in b:\n\n if x > lim_x:continue\n\n for u,v in target:\n\n if (x + u, y + v) not in b:break\n\n else:\n\n print((x - bx, y - by))\n\n break\n","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":575,"code_v1_num_chars":577,"code_v0_no_empty_lines":"import operator\n\nfor e in iter(input, \"0\"):\n target = [[*list(map(int, input().split()))] for _ in [0] * int(e)]\n bx, by = target[0]\n target = {(x - bx, y - by) for x, y in target}\n max_tx = max(list(map(operator.itemgetter(0), target)))\n b = {tuple(map(int, input().split())) for _ in [0] * int(eval(input()))}\n max_sx = max(list(map(operator.itemgetter(0), b)))\n lim_x = max_sx - max_tx\n for x, y in b:\n if x > lim_x:\n continue\n for u, v in target:\n if (x + u, y + v) not in b:\n break\n else:\n print((x - bx, y - by))\n break\n","code_v1_no_empty_lines":"import operator\n\nfor e in iter(input, \"0\"):\n target = [[*list(map(int, input().split()))] for _ in [0] * int(e)]\n bx, by = min(target)\n target = {(x - bx, y - by) for x, y in target}\n max_tx = max(list(map(operator.itemgetter(0), target)))\n b = {tuple(map(int, input().split())) for _ in [0] * int(eval(input()))}\n max_sx = max(list(map(operator.itemgetter(0), b)))\n lim_x = max_sx - max_tx\n for x, y in b:\n if x > lim_x:\n continue\n for u, v in target:\n if (x + u, y + v) not in b:\n break\n else:\n print((x - bx, y - by))\n break\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- bx, by = target[0]","+ bx, by = min(target)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3549797328,"measured_runtime_v1":0.2644668722,"runtime_lift":1.3422464968,"key":["s670764208","s671843082"]} +{"user_id":"u102461423","problem_id":"p03718","language":"python","submission_id_v0":"s887046149","submission_id_v1":"s961575139","cpu_time_v0":1273,"cpu_time_v1":312,"memory_v0":17580,"memory_v1":4724,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.49,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nfrom scipy.sparse.csgraph import dijkstra\n\n\n\nH,W = list(map(int,input().split()))\n\n\n\n# start = 0\n\n# rows = 1,2,...,H\n\n# cols = H+1,...,H+W\n\n# goal = H+W+1\n\n\n\nINF = 10 ** 9\n\nstart = 0\n\ngoal = H+W+1\n\nV = H+W+2\n\ngraph = [[0] * V for _ in range(V)]\n\nedges = [] # \u96a3\u63a5\u30ea\u30b9\u30c8\n\nfor i in range(H):\n\n row = eval(input())\n\n for j,cell in enumerate(row):\n\n if cell == 'o':\n\n graph[1+i][1+H+j] = 1\n\n graph[1+H+j][1+i] = 1\n\n s = row.find('S')\n\n t = row.find('T')\n\n if s != -1:\n\n graph[start][1+i] = INF\n\n graph[start][1+H+s] = INF\n\n if t != -1:\n\n graph[1+i][goal] = INF\n\n graph[1+H+t][goal] = INF\n\n\n\n# \u3042\u3068\u306f max flow \u3092\u6c42\u3081\u308c\u3070\u3088\u3044\n\n\n\ndef max_flow(graph):\n\n f = 0\n\n while True:\n\n if f > 200:\n\n return -1\n\n dist,pred = dijkstra(graph, indices = start, unweighted = True, return_predecessors = True)\n\n if dist[goal] > INF:\n\n return f\n\n f += 1\n\n after = goal\n\n while after != start:\n\n before = pred[after]\n\n graph[before][after] -= 1\n\n graph[after][before] += 1\n\n after = before\n\n\n\nanswer = max_flow(graph)\n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom collections import defaultdict\n\n\n\nH,W = list(map(int,readline().split()))\n\nA = [line.rstrip().decode('utf-8') for line in readlines()]\n\n\n\nsource = 0\n\nsink = H+W+1\n\n\n\ngraph = [defaultdict(int) for _ in range(H+W+2)]\n\n\n\nINF = 10 ** 18\n\nfor h in range(1,H+1):\n\n for w,ox in enumerate(A[h-1],1):\n\n if ox == 'x':\n\n continue\n\n elif ox == 'o':\n\n graph[h][H+w] = 1\n\n graph[H+w][h] = 1\n\n elif ox == 'S':\n\n graph[source][h] = INF\n\n graph[h][source] = INF\n\n graph[source][H+w] = INF\n\n graph[H+w][source] = INF\n\n elif ox == 'T':\n\n graph[sink][h] = INF\n\n graph[h][sink] = INF\n\n graph[sink][H+w] = INF\n\n graph[H+w][sink] = INF\n\n\n\n\n\nclass Dinic():\n\n def __init__(self,graph,V,source,sink):\n\n self.graph = graph\n\n self.sink = sink\n\n self.source = source\n\n self.V = V\n\n# self.compress()\n\n self.N = len(V)\n\n \n\n def compress(self):\n\n self.N = len(self.V)\n\n v_to_i = {x:i for i,x in enumerate(self.V)}\n\n self.sink = v_to_i[self.sink]\n\n self.source = v_to_i[self.source]\n\n g = [dict() for _ in range(self.N)]\n\n for v,e in list(self.graph.items()):\n\n vn = v_to_i[v]\n\n g[vn] = {v_to_i[w]:c for w,c in list(e.items())}\n\n self.graph = g\n\n \n\n def bfs(self):\n\n level = [0]*self.N\n\n q = [self.source]\n\n level[self.source] = 1\n\n d = 1\n\n while q:\n\n if level[self.sink]:\n\n break\n\n qq = []\n\n d += 1\n\n for v in q:\n\n for w,cap in list(self.graph[v].items()):\n\n if cap == 0:\n\n continue\n\n if level[w]:\n\n continue\n\n level[w] = d\n\n qq.append(w)\n\n q = qq\n\n self.level = level\n\n \n\n def dfs(self,v,f):\n\n if v == self.sink:\n\n return f\n\n for w,cap in self.itr[v]:\n\n if cap == 0 or self.level[w] != self.level[v] + 1:\n\n continue\n\n d = self.dfs(w,min(f,cap))\n\n if d:\n\n self.graph[v][w] -= d\n\n self.graph[w][v] += d\n\n return d\n\n return 0\n\n \n\n def max_flow(self):\n\n INF = 10**18\n\n flow = 0\n\n while True:\n\n self.bfs()\n\n if self.level[self.sink] == 0:\n\n break\n\n self.itr = [iter(list(e.items())) for e in self.graph]\n\n while True:\n\n f = self.dfs(self.source,INF)\n\n if f == 0:\n\n break\n\n flow += f\n\n return flow\n\n\n\nanswer = Dinic(graph=graph,V=list(range(H+W+2)),source=0,sink=H+W+1).max_flow()\n\nif answer >= INF:\n\n answer = -1\n\nprint(answer)","code_v0_loc":53,"code_v1_loc":108,"code_v0_num_chars":1210,"code_v1_num_chars":3016,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom scipy.sparse.csgraph import dijkstra\n\nH, W = list(map(int, input().split()))\n# start = 0\n# rows = 1,2,...,H\n# cols = H+1,...,H+W\n# goal = H+W+1\nINF = 10**9\nstart = 0\ngoal = H + W + 1\nV = H + W + 2\ngraph = [[0] * V for _ in range(V)]\nedges = [] # \u96a3\u63a5\u30ea\u30b9\u30c8\nfor i in range(H):\n row = eval(input())\n for j, cell in enumerate(row):\n if cell == \"o\":\n graph[1 + i][1 + H + j] = 1\n graph[1 + H + j][1 + i] = 1\n s = row.find(\"S\")\n t = row.find(\"T\")\n if s != -1:\n graph[start][1 + i] = INF\n graph[start][1 + H + s] = INF\n if t != -1:\n graph[1 + i][goal] = INF\n graph[1 + H + t][goal] = INF\n# \u3042\u3068\u306f max flow \u3092\u6c42\u3081\u308c\u3070\u3088\u3044\ndef max_flow(graph):\n f = 0\n while True:\n if f > 200:\n return -1\n dist, pred = dijkstra(\n graph, indices=start, unweighted=True, return_predecessors=True\n )\n if dist[goal] > INF:\n return f\n f += 1\n after = goal\n while after != start:\n before = pred[after]\n graph[before][after] -= 1\n graph[after][before] += 1\n after = before\n\n\nanswer = max_flow(graph)\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom collections import defaultdict\n\nH, W = list(map(int, readline().split()))\nA = [line.rstrip().decode(\"utf-8\") for line in readlines()]\nsource = 0\nsink = H + W + 1\ngraph = [defaultdict(int) for _ in range(H + W + 2)]\nINF = 10**18\nfor h in range(1, H + 1):\n for w, ox in enumerate(A[h - 1], 1):\n if ox == \"x\":\n continue\n elif ox == \"o\":\n graph[h][H + w] = 1\n graph[H + w][h] = 1\n elif ox == \"S\":\n graph[source][h] = INF\n graph[h][source] = INF\n graph[source][H + w] = INF\n graph[H + w][source] = INF\n elif ox == \"T\":\n graph[sink][h] = INF\n graph[h][sink] = INF\n graph[sink][H + w] = INF\n graph[H + w][sink] = INF\n\n\nclass Dinic:\n def __init__(self, graph, V, source, sink):\n self.graph = graph\n self.sink = sink\n self.source = source\n self.V = V\n # self.compress()\n self.N = len(V)\n\n def compress(self):\n self.N = len(self.V)\n v_to_i = {x: i for i, x in enumerate(self.V)}\n self.sink = v_to_i[self.sink]\n self.source = v_to_i[self.source]\n g = [dict() for _ in range(self.N)]\n for v, e in list(self.graph.items()):\n vn = v_to_i[v]\n g[vn] = {v_to_i[w]: c for w, c in list(e.items())}\n self.graph = g\n\n def bfs(self):\n level = [0] * self.N\n q = [self.source]\n level[self.source] = 1\n d = 1\n while q:\n if level[self.sink]:\n break\n qq = []\n d += 1\n for v in q:\n for w, cap in list(self.graph[v].items()):\n if cap == 0:\n continue\n if level[w]:\n continue\n level[w] = d\n qq.append(w)\n q = qq\n self.level = level\n\n def dfs(self, v, f):\n if v == self.sink:\n return f\n for w, cap in self.itr[v]:\n if cap == 0 or self.level[w] != self.level[v] + 1:\n continue\n d = self.dfs(w, min(f, cap))\n if d:\n self.graph[v][w] -= d\n self.graph[w][v] += d\n return d\n return 0\n\n def max_flow(self):\n INF = 10**18\n flow = 0\n while True:\n self.bfs()\n if self.level[self.sink] == 0:\n break\n self.itr = [iter(list(e.items())) for e in self.graph]\n while True:\n f = self.dfs(self.source, INF)\n if f == 0:\n break\n flow += f\n return flow\n\n\nanswer = Dinic(\n graph=graph, V=list(range(H + W + 2)), source=0, sink=H + W + 1\n).max_flow()\nif answer >= INF:\n answer = -1\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":50.9259259259,"diff":["-input = sys.stdin.readline","-from scipy.sparse.csgraph import dijkstra","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+from collections import defaultdict","-H, W = list(map(int, input().split()))","-# start = 0","-# rows = 1,2,...,H","-# cols = H+1,...,H+W","-# goal = H+W+1","-INF = 10**9","-start = 0","-goal = H + W + 1","-V = H + W + 2","-graph = [[0] * V for _ in range(V)]","-edges = [] # \u96a3\u63a5\u30ea\u30b9\u30c8","-for i in range(H):","- row = eval(input())","- for j, cell in enumerate(row):","- if cell == \"o\":","- graph[1 + i][1 + H + j] = 1","- graph[1 + H + j][1 + i] = 1","- s = row.find(\"S\")","- t = row.find(\"T\")","- if s != -1:","- graph[start][1 + i] = INF","- graph[start][1 + H + s] = INF","- if t != -1:","- graph[1 + i][goal] = INF","- graph[1 + H + t][goal] = INF","-# \u3042\u3068\u306f max flow \u3092\u6c42\u3081\u308c\u3070\u3088\u3044","-def max_flow(graph):","- f = 0","- while True:","- if f > 200:","- return -1","- dist, pred = dijkstra(","- graph, indices=start, unweighted=True, return_predecessors=True","- )","- if dist[goal] > INF:","- return f","- f += 1","- after = goal","- while after != start:","- before = pred[after]","- graph[before][after] -= 1","- graph[after][before] += 1","- after = before","+H, W = list(map(int, readline().split()))","+A = [line.rstrip().decode(\"utf-8\") for line in readlines()]","+source = 0","+sink = H + W + 1","+graph = [defaultdict(int) for _ in range(H + W + 2)]","+INF = 10**18","+for h in range(1, H + 1):","+ for w, ox in enumerate(A[h - 1], 1):","+ if ox == \"x\":","+ continue","+ elif ox == \"o\":","+ graph[h][H + w] = 1","+ graph[H + w][h] = 1","+ elif ox == \"S\":","+ graph[source][h] = INF","+ graph[h][source] = INF","+ graph[source][H + w] = INF","+ graph[H + w][source] = INF","+ elif ox == \"T\":","+ graph[sink][h] = INF","+ graph[h][sink] = INF","+ graph[sink][H + w] = INF","+ graph[H + w][sink] = INF","-answer = max_flow(graph)","+class Dinic:","+ def __init__(self, graph, V, source, sink):","+ self.graph = graph","+ self.sink = sink","+ self.source = source","+ self.V = V","+ # self.compress()","+ self.N = len(V)","+","+ def compress(self):","+ self.N = len(self.V)","+ v_to_i = {x: i for i, x in enumerate(self.V)}","+ self.sink = v_to_i[self.sink]","+ self.source = v_to_i[self.source]","+ g = [dict() for _ in range(self.N)]","+ for v, e in list(self.graph.items()):","+ vn = v_to_i[v]","+ g[vn] = {v_to_i[w]: c for w, c in list(e.items())}","+ self.graph = g","+","+ def bfs(self):","+ level = [0] * self.N","+ q = [self.source]","+ level[self.source] = 1","+ d = 1","+ while q:","+ if level[self.sink]:","+ break","+ qq = []","+ d += 1","+ for v in q:","+ for w, cap in list(self.graph[v].items()):","+ if cap == 0:","+ continue","+ if level[w]:","+ continue","+ level[w] = d","+ qq.append(w)","+ q = qq","+ self.level = level","+","+ def dfs(self, v, f):","+ if v == self.sink:","+ return f","+ for w, cap in self.itr[v]:","+ if cap == 0 or self.level[w] != self.level[v] + 1:","+ continue","+ d = self.dfs(w, min(f, cap))","+ if d:","+ self.graph[v][w] -= d","+ self.graph[w][v] += d","+ return d","+ return 0","+","+ def max_flow(self):","+ INF = 10**18","+ flow = 0","+ while True:","+ self.bfs()","+ if self.level[self.sink] == 0:","+ break","+ self.itr = [iter(list(e.items())) for e in self.graph]","+ while True:","+ f = self.dfs(self.source, INF)","+ if f == 0:","+ break","+ flow += f","+ return flow","+","+","+answer = Dinic(","+ graph=graph, V=list(range(H + W + 2)), source=0, sink=H + W + 1","+).max_flow()","+if answer >= INF:","+ answer = -1"],"diff_only_import_comment":false,"measured_runtime_v0":2.0169065313,"measured_runtime_v1":0.3407753515,"runtime_lift":5.9185810307,"key":["s887046149","s961575139"]} +{"user_id":"u590871958","problem_id":"p01093","language":"python","submission_id_v0":"s330226420","submission_id_v1":"s459093378","cpu_time_v0":50,"cpu_time_v1":40,"memory_v0":7684,"memory_v1":7704,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nwhile int(eval(input())) > 0:\n\n s = sorted(map(int, input().split()))\n\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))\n\n# optimized version of the same code:\n","target":"while True:\n\n if int(eval(input())) == 0:\n\n break\n\n s = sorted(map(int, input().split()))\n\n r = min(abs(x - y) for (x, y) in zip(s, s[1:]))\n\n print(r)","code_v0_loc":3,"code_v1_loc":6,"code_v0_num_chars":122,"code_v1_num_chars":163,"code_v0_no_empty_lines":"while int(eval(input())) > 0:\n s = sorted(map(int, input().split()))\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))\n","code_v1_no_empty_lines":"while True:\n if int(eval(input())) == 0:\n break\n s = sorted(map(int, input().split()))\n r = min(abs(x - y) for (x, y) in zip(s, s[1:]))\n print(r)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-while int(eval(input())) > 0:","+while True:","+ if int(eval(input())) == 0:","+ break","- print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))","+ r = min(abs(x - y) for (x, y) in zip(s, s[1:]))","+ print(r)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2760278752,"measured_runtime_v1":0.2140542445,"runtime_lift":1.2895230169,"key":["s330226420","s459093378"]} +{"user_id":"u970197315","problem_id":"p02814","language":"python","submission_id_v0":"s991587805","submission_id_v1":"s856136819","cpu_time_v0":253,"cpu_time_v1":206,"memory_v0":16276,"memory_v1":20232,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.58,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# ABC150 D\n\nsi = lambda: eval(input())\n\nni = lambda: int(eval(input()))\n\nnm = lambda: list(map(int, input().split()))\n\nnl = lambda: list(map(int, input().split()))\n\nfrom fractions import gcd\n\nfrom math import ceil\n\ndef lcm(x, y):\n\n return (x * y) \/\/ gcd(x, y)\n\nn,m=nm()\n\na=nl()\n\nans=0\n\na=[x\/\/2 for x in a] \n\n\n\nlcm_v=a[0]\n\nfor i in range(n):\n\n lcm_v=lcm(lcm_v,a[i])\n\nok_flg=[(lcm_v\/\/i)%2==1 for i in a]\n\nif all(ok_flg):\n\n ans=((m\/\/lcm_v)+1)\/\/2\n\nprint(ans)\n\n\n\n\n# optimized version of the same code:\n","target":"from math import gcd, ceil\n\n\n\n\n\ndef lcm(a, b):\n\n return (a*b)\/\/gcd(a, b)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\nfor i in range(n):\n\n a[i] = a[i]\/\/2\n\n\n\nlcm_v = a[0]\n\nfor i in range(1, n):\n\n lcm_v = lcm(lcm_v, a[i])\n\n\n\nok = True\n\nfor aa in a:\n\n if (lcm_v\/\/aa) % 2 != 1:\n\n ok = False\n\n break\n\nans = 0\n\nif ok:\n\n ans = ((m\/\/lcm_v)+1)\/\/2\n\nprint(ans)\n","code_v0_loc":22,"code_v1_loc":26,"code_v0_num_chars":448,"code_v1_num_chars":412,"code_v0_no_empty_lines":"# ABC150 D\nsi = lambda: eval(input())\nni = lambda: int(eval(input()))\nnm = lambda: list(map(int, input().split()))\nnl = lambda: list(map(int, input().split()))\nfrom fractions import gcd\nfrom math import ceil\n\n\ndef lcm(x, y):\n return (x * y) \/\/ gcd(x, y)\n\n\nn, m = nm()\na = nl()\nans = 0\na = [x \/\/ 2 for x in a]\nlcm_v = a[0]\nfor i in range(n):\n lcm_v = lcm(lcm_v, a[i])\nok_flg = [(lcm_v \/\/ i) % 2 == 1 for i in a]\nif all(ok_flg):\n ans = ((m \/\/ lcm_v) + 1) \/\/ 2\nprint(ans)\n","code_v1_no_empty_lines":"from math import gcd, ceil\n\n\ndef lcm(a, b):\n return (a * b) \/\/ gcd(a, b)\n\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nfor i in range(n):\n a[i] = a[i] \/\/ 2\nlcm_v = a[0]\nfor i in range(1, n):\n lcm_v = lcm(lcm_v, a[i])\nok = True\nfor aa in a:\n if (lcm_v \/\/ aa) % 2 != 1:\n ok = False\n break\nans = 0\nif ok:\n ans = ((m \/\/ lcm_v) + 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-# ABC150 D","-si = lambda: eval(input())","-ni = lambda: int(eval(input()))","-nm = lambda: list(map(int, input().split()))","-nl = lambda: list(map(int, input().split()))","-from fractions import gcd","-from math import ceil","+from math import gcd, ceil","-def lcm(x, y):","- return (x * y) \/\/ gcd(x, y)","+def lcm(a, b):","+ return (a * b) \/\/ gcd(a, b)","-n, m = nm()","-a = nl()","+n, m = list(map(int, input().split()))","+a = list(map(int, input().split()))","+for i in range(n):","+ a[i] = a[i] \/\/ 2","+lcm_v = a[0]","+for i in range(1, n):","+ lcm_v = lcm(lcm_v, a[i])","+ok = True","+for aa in a:","+ if (lcm_v \/\/ aa) % 2 != 1:","+ ok = False","+ break","-a = [x \/\/ 2 for x in a]","-lcm_v = a[0]","-for i in range(n):","- lcm_v = lcm(lcm_v, a[i])","-ok_flg = [(lcm_v \/\/ i) % 2 == 1 for i in a]","-if all(ok_flg):","+if ok:"],"diff_only_import_comment":false,"measured_runtime_v0":0.4063324592,"measured_runtime_v1":0.2545481203,"runtime_lift":1.5962893726,"key":["s991587805","s856136819"]} +{"user_id":"u400765446","problem_id":"p02412","language":"python","submission_id_v0":"s921182397","submission_id_v1":"s148735991","cpu_time_v0":320,"cpu_time_v1":20,"memory_v0":5600,"memory_v1":5600,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.75,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n\n\n while True:\n\n n, x = tuple(map(int, input().split()))\n\n pattern = 0\n\n\n\n if n == x == 0:\n\n break\n\n else:\n\n for a in range(1, n+1):\n\n for b in range(1, a):\n\n for c in range(1, b):\n\n pattern += 1 if a + b + c == x and a > b > c else 0\n\n print(pattern)\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def divide_two(c, z):\n\n min_b = z \/\/ 2 + 1\n\n max_b = min(c-1, z-1)\n\n return max(max_b-min_b+1, 0)\n\n \n\n\n\nnum_set = []\n\ncnt = 0\n\nwhile True:\n\n n, x = list(map(int, input().split()))\n\n if (n, x) == (0, 0):\n\n break\n\n else:\n\n num_set.append((n, x))\n\n cnt += 1\n\n\n\nfor i in range(cnt):\n\n num_count = 0\n\n (n, x) = num_set[i]\n\n for c in range(x\/\/3, n+1):\n\n num_count += divide_two(c, x-c)\n\n print(num_count)\n","code_v0_loc":18,"code_v1_loc":22,"code_v0_num_chars":458,"code_v1_num_chars":454,"code_v0_no_empty_lines":"def main():\n while True:\n n, x = tuple(map(int, input().split()))\n pattern = 0\n if n == x == 0:\n break\n else:\n for a in range(1, n + 1):\n for b in range(1, a):\n for c in range(1, b):\n pattern += 1 if a + b + c == x and a > b > c else 0\n print(pattern)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def divide_two(c, z):\n min_b = z \/\/ 2 + 1\n max_b = min(c - 1, z - 1)\n return max(max_b - min_b + 1, 0)\n\n\nnum_set = []\ncnt = 0\nwhile True:\n n, x = list(map(int, input().split()))\n if (n, x) == (0, 0):\n break\n else:\n num_set.append((n, x))\n cnt += 1\nfor i in range(cnt):\n num_count = 0\n (n, x) = num_set[i]\n for c in range(x \/\/ 3, n + 1):\n num_count += divide_two(c, x - c)\n print(num_count)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-def main():","- while True:","- n, x = tuple(map(int, input().split()))","- pattern = 0","- if n == x == 0:","- break","- else:","- for a in range(1, n + 1):","- for b in range(1, a):","- for c in range(1, b):","- pattern += 1 if a + b + c == x and a > b > c else 0","- print(pattern)","+def divide_two(c, z):","+ min_b = z \/\/ 2 + 1","+ max_b = min(c - 1, z - 1)","+ return max(max_b - min_b + 1, 0)","-if __name__ == \"__main__\":","- main()","+num_set = []","+cnt = 0","+while True:","+ n, x = list(map(int, input().split()))","+ if (n, x) == (0, 0):","+ break","+ else:","+ num_set.append((n, x))","+ cnt += 1","+for i in range(cnt):","+ num_count = 0","+ (n, x) = num_set[i]","+ for c in range(x \/\/ 3, n + 1):","+ num_count += divide_two(c, x - c)","+ print(num_count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2920441294,"measured_runtime_v1":0.2327923727,"runtime_lift":1.2545261942,"key":["s921182397","s148735991"]} +{"user_id":"u392029857","problem_id":"p03416","language":"python","submission_id_v0":"s263636434","submission_id_v1":"s255168613","cpu_time_v0":110,"cpu_time_v1":20,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA, B = list(map(int, input().split()))\n\nnumbers = list(range(A, B+1))\n\ncount = 0\n\nfor i in numbers:\n\n m = str(i)\n\n rm = ''.join(list(reversed(m)))\n\n if m == rm:\n\n count += 1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"A, B = list(map(int, input().split()))\n\nx = list(range(1,10))\n\ny = list(range(10))\n\ncount = 0\n\nfor p in x:\n\n for q in y:\n\n for r in y:\n\n sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))\n\n if A <= sakasama <= B:\n\n count += 1\n\nprint(count)","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":191,"code_v1_num_chars":268,"code_v0_no_empty_lines":"A, B = list(map(int, input().split()))\nnumbers = list(range(A, B + 1))\ncount = 0\nfor i in numbers:\n m = str(i)\n rm = \"\".join(list(reversed(m)))\n if m == rm:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\nx = list(range(1, 10))\ny = list(range(10))\ncount = 0\nfor p in x:\n for q in y:\n for r in y:\n sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))\n if A <= sakasama <= B:\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-numbers = list(range(A, B + 1))","+x = list(range(1, 10))","+y = list(range(10))","-for i in numbers:","- m = str(i)","- rm = \"\".join(list(reversed(m)))","- if m == rm:","- count += 1","+for p in x:","+ for q in y:","+ for r in y:","+ sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))","+ if A <= sakasama <= B:","+ count += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3536295901,"measured_runtime_v1":0.1996227459,"runtime_lift":1.7714894587,"key":["s263636434","s255168613"]} +{"user_id":"u634461820","problem_id":"p02863","language":"python","submission_id_v0":"s061535189","submission_id_v1":"s586045080","cpu_time_v0":1058,"cpu_time_v1":461,"memory_v0":183896,"memory_v1":117976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nfrom operator import itemgetter\n\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return eval(input())\n\n\n\nN, T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort(key=itemgetter(0))\n\n#print(ab)\n\n\n\ndp = [[0]*(T+1+3000+1) for _ in range(N+1)]\n\nans = 0\n\nfor i in range(N):\n\n for j in range(T+1+3000+1):\n\n time, deli = ab[i]\n\n if 0 <= j-time < T:\n\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n\n else:\n\n dp[i + 1][j] = dp[i][j]\n\n ans = max(ans, dp[i + 1][j])\n\nprint(ans)\n\n\n\n#print(dp)\n\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom collections import deque\n\nMAX_INT = int(10e10)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return eval(input())\n\n\n\nN,T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort()\n\n\n\nans = 0\n\ndp = [[0]*T for i in range(N+1)]\n\nfor i in range(1,N+1):\n\n a,b = ab[i-1]\n\n for j in range(T):\n\n if 0 <= j-a < T:\n\n dp[i][j] = max(dp[i-1][j], dp[i-1][j-a] + b)\n\n else:\n\n dp[i][j] = dp[i-1][j]\n\n else:\n\n ans = max(ans, dp[i-1][-1] + b)\n\nprint(ans)","code_v0_loc":30,"code_v1_loc":27,"code_v0_num_chars":737,"code_v1_num_chars":620,"code_v0_no_empty_lines":"import sys\nfrom operator import itemgetter\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\nMIN_INT = -MAX_INT\nmod = 1000000007\nsys.setrecursionlimit(1000000)\n\n\ndef IL():\n return list(map(int, input().split()))\n\n\ndef SL():\n return input().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef S():\n return eval(input())\n\n\nN, T = IL()\nab = [IL() for i in range(N)]\nab.sort(key=itemgetter(0))\n# print(ab)\ndp = [[0] * (T + 1 + 3000 + 1) for _ in range(N + 1)]\nans = 0\nfor i in range(N):\n for j in range(T + 1 + 3000 + 1):\n time, deli = ab[i]\n if 0 <= j - time < T:\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n else:\n dp[i + 1][j] = dp[i][j]\n ans = max(ans, dp[i + 1][j])\nprint(ans)\n# print(dp)\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque\n\nMAX_INT = int(10e10)\nMIN_INT = -MAX_INT\nmod = 1000000007\nsys.setrecursionlimit(1000000)\n\n\ndef IL():\n return list(map(int, input().split()))\n\n\ndef SL():\n return input().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef S():\n return eval(input())\n\n\nN, T = IL()\nab = [IL() for i in range(N)]\nab.sort()\nans = 0\ndp = [[0] * T for i in range(N + 1)]\nfor i in range(1, N + 1):\n a, b = ab[i - 1]\n for j in range(T):\n if 0 <= j - a < T:\n dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a] + b)\n else:\n dp[i][j] = dp[i - 1][j]\n else:\n ans = max(ans, dp[i - 1][-1] + b)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-from operator import itemgetter","-from heapq import heapify, heappop, heappush","+from collections import deque","-MAX_INT = int(10e15)","+MAX_INT = int(10e10)","-ab.sort(key=itemgetter(0))","-# print(ab)","-dp = [[0] * (T + 1 + 3000 + 1) for _ in range(N + 1)]","+ab.sort()","-for i in range(N):","- for j in range(T + 1 + 3000 + 1):","- time, deli = ab[i]","- if 0 <= j - time < T:","- dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)","+dp = [[0] * T for i in range(N + 1)]","+for i in range(1, N + 1):","+ a, b = ab[i - 1]","+ for j in range(T):","+ if 0 <= j - a < T:","+ dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a] + b)","- dp[i + 1][j] = dp[i][j]","- ans = max(ans, dp[i + 1][j])","+ dp[i][j] = dp[i - 1][j]","+ else:","+ ans = max(ans, dp[i - 1][-1] + b)","-# print(dp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4860900669,"measured_runtime_v1":0.3545958745,"runtime_lift":1.3708283197,"key":["s061535189","s586045080"]} +{"user_id":"u562935282","problem_id":"p02792","language":"python","submission_id_v0":"s535465245","submission_id_v1":"s657178579","cpu_time_v0":830,"cpu_time_v1":146,"memory_v0":3572,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.41,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom functools import lru_cache\n\nimport sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\n\n\n@lru_cache(maxsize=None)\n\ndef check(l, r, n, k=1):\n\n t = l + '0' * k + r\n\n e = l + '9' * k + r\n\n\n\n if int(e) <= n:\n\n return pow(10, k) + check(l, r, n, k + 1)\n\n\n\n if int(t) <= n < int(e):\n\n x = int(str(n)[1:-1])\n\n if int(str(n)[-1]) < int(r):\n\n x -= 1\n\n return x + 1\n\n\n\n if n < int(t):\n\n return 0\n\n\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n\n\n ret = 0\n\n for x in range(1, n + 1):\n\n if x % 10 == 0:\n\n continue\n\n s = str(x)\n\n t = s[-1] + s[0]\n\n if s[0] == s[-1]:\n\n ret += 1\n\n if int(t) <= n:\n\n ret += 1\n\n ret += check(s[-1], s[0], n, k=1)\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"# \u89e3\u8aac\u653e\u9001\n\n\n\ndef main():\n\n from collections import defaultdict\n\n\n\n n = int(eval(input()))\n\n\n\n d = defaultdict(int)\n\n for x in range(1, n + 1):\n\n if x % 10 == 0:\n\n continue\n\n\n\n tail = x % 10\n\n head = 0\n\n while x:\n\n head = x\n\n x \/\/= 10\n\n\n\n d[head, tail] += 1\n\n\n\n ret = 0\n\n for (head, tail), cnt in tuple(d.items()):\n\n # RuntimeError: dictionary changed size during iteration\n\n # defaultdict\u306e\u672a\u5b9a\u7fa9(?)\u306ekey\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305b\u3044\u3067\u3001RE\u306b\u306a\u308b\n\n # d.items()\u3092tuple\u5316\u3057\u3066\u56de\u907f\n\n ret += d[head, tail] * d[tail, head]\n\n # (head,tail)\u306e\u51fa\u73fe\u6570\u3092\u8f9e\u66f8\u3067\u7ba1\u7406\u3059\u308b\n\n # (head,tail)*(tail,head)\u306e\u7d44\u307f\u5408\u308f\u305b\u304c\u3042\u308b\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":44,"code_v1_loc":34,"code_v0_num_chars":820,"code_v1_num_chars":726,"code_v0_no_empty_lines":"from functools import lru_cache\nimport sys\n\nsys.setrecursionlimit(10**7)\n\n\n@lru_cache(maxsize=None)\ndef check(l, r, n, k=1):\n t = l + \"0\" * k + r\n e = l + \"9\" * k + r\n if int(e) <= n:\n return pow(10, k) + check(l, r, n, k + 1)\n if int(t) <= n < int(e):\n x = int(str(n)[1:-1])\n if int(str(n)[-1]) < int(r):\n x -= 1\n return x + 1\n if n < int(t):\n return 0\n\n\ndef main():\n n = int(eval(input()))\n ret = 0\n for x in range(1, n + 1):\n if x % 10 == 0:\n continue\n s = str(x)\n t = s[-1] + s[0]\n if s[0] == s[-1]:\n ret += 1\n if int(t) <= n:\n ret += 1\n ret += check(s[-1], s[0], n, k=1)\n print(ret)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# \u89e3\u8aac\u653e\u9001\ndef main():\n from collections import defaultdict\n\n n = int(eval(input()))\n d = defaultdict(int)\n for x in range(1, n + 1):\n if x % 10 == 0:\n continue\n tail = x % 10\n head = 0\n while x:\n head = x\n x \/\/= 10\n d[head, tail] += 1\n ret = 0\n for (head, tail), cnt in tuple(d.items()):\n # RuntimeError: dictionary changed size during iteration\n # defaultdict\u306e\u672a\u5b9a\u7fa9(?)\u306ekey\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305b\u3044\u3067\u3001RE\u306b\u306a\u308b\n # d.items()\u3092tuple\u5316\u3057\u3066\u56de\u907f\n ret += d[head, tail] * d[tail, head]\n # (head,tail)\u306e\u51fa\u73fe\u6570\u3092\u8f9e\u66f8\u3067\u7ba1\u7406\u3059\u308b\n # (head,tail)*(tail,head)\u306e\u7d44\u307f\u5408\u308f\u305b\u304c\u3042\u308b\n print(ret)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":22.7272727273,"diff":["-from functools import lru_cache","-import sys","+# \u89e3\u8aac\u653e\u9001","+def main():","+ from collections import defaultdict","-sys.setrecursionlimit(10**7)","-","-","-@lru_cache(maxsize=None)","-def check(l, r, n, k=1):","- t = l + \"0\" * k + r","- e = l + \"9\" * k + r","- if int(e) <= n:","- return pow(10, k) + check(l, r, n, k + 1)","- if int(t) <= n < int(e):","- x = int(str(n)[1:-1])","- if int(str(n)[-1]) < int(r):","- x -= 1","- return x + 1","- if n < int(t):","- return 0","-","-","-def main():","- ret = 0","+ d = defaultdict(int)","- s = str(x)","- t = s[-1] + s[0]","- if s[0] == s[-1]:","- ret += 1","- if int(t) <= n:","- ret += 1","- ret += check(s[-1], s[0], n, k=1)","+ tail = x % 10","+ head = 0","+ while x:","+ head = x","+ x \/\/= 10","+ d[head, tail] += 1","+ ret = 0","+ for (head, tail), cnt in tuple(d.items()):","+ # RuntimeError: dictionary changed size during iteration","+ # defaultdict\u306e\u672a\u5b9a\u7fa9(?)\u306ekey\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305b\u3044\u3067\u3001RE\u306b\u306a\u308b","+ # d.items()\u3092tuple\u5316\u3057\u3066\u56de\u907f","+ ret += d[head, tail] * d[tail, head]","+ # (head,tail)\u306e\u51fa\u73fe\u6570\u3092\u8f9e\u66f8\u3067\u7ba1\u7406\u3059\u308b","+ # (head,tail)*(tail,head)\u306e\u7d44\u307f\u5408\u308f\u305b\u304c\u3042\u308b"],"diff_only_import_comment":false,"measured_runtime_v0":0.5728231148,"measured_runtime_v1":0.440412906,"runtime_lift":1.3006501557,"key":["s535465245","s657178579"]} +{"user_id":"u699089116","problem_id":"p03325","language":"python","submission_id_v0":"s752541577","submission_id_v1":"s744339126","cpu_time_v0":526,"cpu_time_v1":204,"memory_v0":42860,"memory_v1":42220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\n\n\ndef trial_division(n):\n\n factor = []\n\n tmp = int(math.sqrt(n)) + 1\n\n for _ in range(2,tmp):\n\n while n % 2 == 0:\n\n n \/\/= 2\n\n factor.append(2)\n\n if not factor:\n\n return [n]\n\n else:\n\n factor.append(n)\n\n return factor\n\n\n\n\n\ncount = 0\n\nfor i in a:\n\n temp = trial_division(i)\n\n count += temp.count(2)\n\n\n\nprint(count)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\n\n\ndef trial_division(n):\n\n #\uff12\u3067\u5272\u3063\u305f\u56e0\u6570\u3092\u683c\u7d0d\u3059\u308b\u30ea\u30b9\u30c8\n\n factor = []\n\n #2\u3067\u5272\u308c\u306a\u304f\u306a\u3063\u305f\u6642\u70b9\u3067\u30b9\u30c8\u30c3\u30d7\n\n while n % 2 == 0:\n\n n \/\/= 2 # \uff12\u3067\u5272\u3063\u305f\u5546\u3092\u5207\u308a\u6368\u3066\u3066\u4ee3\u5165\n\n factor.append(2)\n\n #n\u304c\u4e00\u5ea6\u3082\uff12\u3067\u5272\u308c\u306a\u304b\u3063\u305f\u3089\u305d\u306e\u307e\u307e\u8fd4\u3059\n\n if not factor:\n\n return [n]\n\n else:\n\n factor.append(n)\n\n return factor\n\n\n\n\n\ncount = 0\n\nfor i in a:\n\n temp = trial_division(i)\n\n count += temp.count(2)\n\n\n\nprint(count)","code_v0_loc":25,"code_v1_loc":25,"code_v0_num_chars":452,"code_v1_num_chars":458,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\na = list(map(int, input().split()))\n\n\ndef trial_division(n):\n factor = []\n tmp = int(math.sqrt(n)) + 1\n for _ in range(2, tmp):\n while n % 2 == 0:\n n \/\/= 2\n factor.append(2)\n if not factor:\n return [n]\n else:\n factor.append(n)\n return factor\n\n\ncount = 0\nfor i in a:\n temp = trial_division(i)\n count += temp.count(2)\nprint(count)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\n\n\ndef trial_division(n):\n # \uff12\u3067\u5272\u3063\u305f\u56e0\u6570\u3092\u683c\u7d0d\u3059\u308b\u30ea\u30b9\u30c8\n factor = []\n # 2\u3067\u5272\u308c\u306a\u304f\u306a\u3063\u305f\u6642\u70b9\u3067\u30b9\u30c8\u30c3\u30d7\n while n % 2 == 0:\n n \/\/= 2 # \uff12\u3067\u5272\u3063\u305f\u5546\u3092\u5207\u308a\u6368\u3066\u3066\u4ee3\u5165\n factor.append(2)\n # n\u304c\u4e00\u5ea6\u3082\uff12\u3067\u5272\u308c\u306a\u304b\u3063\u305f\u3089\u305d\u306e\u307e\u307e\u8fd4\u3059\n if not factor:\n return [n]\n else:\n factor.append(n)\n return factor\n\n\ncount = 0\nfor i in a:\n temp = trial_division(i)\n count += temp.count(2)\nprint(count)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import math","-","+ # \uff12\u3067\u5272\u3063\u305f\u56e0\u6570\u3092\u683c\u7d0d\u3059\u308b\u30ea\u30b9\u30c8","- tmp = int(math.sqrt(n)) + 1","- for _ in range(2, tmp):","- while n % 2 == 0:","- n \/\/= 2","- factor.append(2)","+ # 2\u3067\u5272\u308c\u306a\u304f\u306a\u3063\u305f\u6642\u70b9\u3067\u30b9\u30c8\u30c3\u30d7","+ while n % 2 == 0:","+ n \/\/= 2 # \uff12\u3067\u5272\u3063\u305f\u5546\u3092\u5207\u308a\u6368\u3066\u3066\u4ee3\u5165","+ factor.append(2)","+ # n\u304c\u4e00\u5ea6\u3082\uff12\u3067\u5272\u308c\u306a\u304b\u3063\u305f\u3089\u305d\u306e\u307e\u307e\u8fd4\u3059"],"diff_only_import_comment":false,"measured_runtime_v0":0.4331856866,"measured_runtime_v1":0.3346704168,"runtime_lift":1.2943650373,"key":["s752541577","s744339126"]} +{"user_id":"u433532588","problem_id":"p03164","language":"python","submission_id_v0":"s155060992","submission_id_v1":"s347020442","cpu_time_v0":1982,"cpu_time_v1":1050,"memory_v0":320832,"memory_v1":314932,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.02,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n\n\n\n\n# N\u500b\u306e\u8377\u7269\u3001\u30ca\u30c3\u30d7\u30b6\u30c3\u30af\u306e\u5bb9\u91cf\u306fW\n\nN, W = list(map(int, input().split()))\n\nw = [0] * N\n\nv = [0] * N\n\n\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n w[i] = a\n\n v[i] = b\n\n\n\n# 1 <= W <= 10^9\u306a\u306e\u3067\u6a2a\u8ef8\u3092W\u306b\u3059\u308b\u3068\u30c6\u30fc\u30d6\u30eb\u304c\u3067\u304b\u3059\u304e\u308b\n\n# \u305d\u306e\u304b\u308f\u308a\u306bV\u306e\u65b9\u3092\u6a2a\u8ef8\u306b\u3059\u308b\n\n\n\n# \u4fa1\u5024\u306e\u7dcf\u5408\u8a08\u306f\u307e\u3060\u4e0d\u660e\u306a\u306e\u3067\u3001\u9069\u5f53\u306b\u3067\u304b\u3044\u5024\u306b\u3057\u3068\u304f\n\n# \u6700\u4e0a\u90e8\u3068\u6700\u5de6\u90e8\u306b0\u304c\u5165\u308b\u306e\u3067\u3001\u305d\u306e\u5206\u3092+1\n\nV = N*1000+1\n\ndp = [ [float('inf') for _ in range(V+1)] for _ in range(N+1) ]\n\n\n\n# \u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\u306e\u3067\u3001\u4e0a\u8a18\u3067inf\u304c\u5165\u3063\u3066\u308b\u306e\u3067\u3001\u521d\u671f\u5024\u306f0\u3092\u3044\u308c\u308b\u5fc5\u8981\u304c\u3042\u308b\n\ndp[0][0] = 0\n\n\n\n# dp[i][sum_v] = \u3053\u308c\u307e\u3067(i-1)\u756a\u76ee\u307e\u3067\u306e\u54c1\u7269\u304b\u3089\u4fa1\u5024\u304csum_v\u4ee5\u4e0a\u306b\u306a\u308b\u3088\u3046\u306b\u9078\u3093\u3060\u3068\u304d\u306e\u3001\u91cd\u3055\u306e\u7dcf\u548c\u306e\u6700\u5c0f\u5024\n\nfor i in range(N):\n\n for sum_v in range(V):\n\n if sum_v - v[i] >= 0:\n\n dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v-v[i]]+w[i])\n\n\n\n dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v])\n\n\n\n\n\n# \u4e2d\u8eab\u304cW\u306a\u306e\u3067\u3001W\u4ee5\u4e0b\u3067\u3042\u308b\u3046\u3061\u306esum_v\u306e\u6700\u5927\u5024\u3092\u6c42\u3081\u308c\u3070\u3044\u3044\n\nfor sum_v in range(V):\n\n # \u6700\u7d42\u884c\u3060\u3051\u898b\u308c\u3070\u3044\u3044\u306e\u3067\u3001\u7aef\u304b\u3089sum_v\u306e\u6700\u5927\u5024\u3092\u306a\u3081\u308b\u3060\u3051\n\n if dp[N][sum_v] <= W:\n\n ans = sum_v\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\n# A = [ int(input()) for _ in range(N) ]\n\n##############################\n\n\n\nN, W = list(map(int, input().split()))\n\nw = []\n\nv = []\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n w.append(a)\n\n v.append(b)\n\n\n\nV = sum(v)\n\n\n\ndp = [ [INF for _ in range(V+1)] for _ in range(N+1) ]\n\n\n\ndp[0][0] = 0\n\n\n\nfor i in range(N):\n\n for j in range(V+1):\n\n if j - v[i] < 0:\n\n dp[i+1][j] = dp[i][j]\n\n else:\n\n dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]]+w[i])\n\n\n\n#print(dp[N])\n\n\n\nans = 0\n\nfor v in range(V+1):\n\n if dp[N][v] <= W:\n\n ans = v\n\n\n\nprint(ans)\n","code_v0_loc":39,"code_v1_loc":39,"code_v0_num_chars":877,"code_v1_num_chars":703,"code_v0_no_empty_lines":"# N\u500b\u306e\u8377\u7269\u3001\u30ca\u30c3\u30d7\u30b6\u30c3\u30af\u306e\u5bb9\u91cf\u306fW\nN, W = list(map(int, input().split()))\nw = [0] * N\nv = [0] * N\nfor i in range(N):\n a, b = list(map(int, input().split()))\n w[i] = a\n v[i] = b\n# 1 <= W <= 10^9\u306a\u306e\u3067\u6a2a\u8ef8\u3092W\u306b\u3059\u308b\u3068\u30c6\u30fc\u30d6\u30eb\u304c\u3067\u304b\u3059\u304e\u308b\n# \u305d\u306e\u304b\u308f\u308a\u306bV\u306e\u65b9\u3092\u6a2a\u8ef8\u306b\u3059\u308b\n# \u4fa1\u5024\u306e\u7dcf\u5408\u8a08\u306f\u307e\u3060\u4e0d\u660e\u306a\u306e\u3067\u3001\u9069\u5f53\u306b\u3067\u304b\u3044\u5024\u306b\u3057\u3068\u304f\n# \u6700\u4e0a\u90e8\u3068\u6700\u5de6\u90e8\u306b0\u304c\u5165\u308b\u306e\u3067\u3001\u305d\u306e\u5206\u3092+1\nV = N * 1000 + 1\ndp = [[float(\"inf\") for _ in range(V + 1)] for _ in range(N + 1)]\n# \u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\u306e\u3067\u3001\u4e0a\u8a18\u3067inf\u304c\u5165\u3063\u3066\u308b\u306e\u3067\u3001\u521d\u671f\u5024\u306f0\u3092\u3044\u308c\u308b\u5fc5\u8981\u304c\u3042\u308b\ndp[0][0] = 0\n# dp[i][sum_v] = \u3053\u308c\u307e\u3067(i-1)\u756a\u76ee\u307e\u3067\u306e\u54c1\u7269\u304b\u3089\u4fa1\u5024\u304csum_v\u4ee5\u4e0a\u306b\u306a\u308b\u3088\u3046\u306b\u9078\u3093\u3060\u3068\u304d\u306e\u3001\u91cd\u3055\u306e\u7dcf\u548c\u306e\u6700\u5c0f\u5024\nfor i in range(N):\n for sum_v in range(V):\n if sum_v - v[i] >= 0:\n dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - v[i]] + w[i])\n dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v])\n# \u4e2d\u8eab\u304cW\u306a\u306e\u3067\u3001W\u4ee5\u4e0b\u3067\u3042\u308b\u3046\u3061\u306esum_v\u306e\u6700\u5927\u5024\u3092\u6c42\u3081\u308c\u3070\u3044\u3044\nfor sum_v in range(V):\n # \u6700\u7d42\u884c\u3060\u3051\u898b\u308c\u3070\u3044\u3044\u306e\u3067\u3001\u7aef\u304b\u3089sum_v\u306e\u6700\u5927\u5024\u3092\u306a\u3081\u308b\u3060\u3051\n if dp[N][sum_v] <= W:\n ans = sum_v\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nMOD = 10**9 + 7\n# A = [ int(input()) for _ in range(N) ]\n##############################\nN, W = list(map(int, input().split()))\nw = []\nv = []\nfor i in range(N):\n a, b = list(map(int, input().split()))\n w.append(a)\n v.append(b)\nV = sum(v)\ndp = [[INF for _ in range(V + 1)] for _ in range(N + 1)]\ndp[0][0] = 0\nfor i in range(N):\n for j in range(V + 1):\n if j - v[i] < 0:\n dp[i + 1][j] = dp[i][j]\n else:\n dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])\n# print(dp[N])\nans = 0\nfor v in range(V + 1):\n if dp[N][v] <= W:\n ans = v\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-# N\u500b\u306e\u8377\u7269\u3001\u30ca\u30c3\u30d7\u30b6\u30c3\u30af\u306e\u5bb9\u91cf\u306fW","+import sys","+","+input = sys.stdin.readline","+sys.setrecursionlimit(2147483647)","+INF = float(\"inf\")","+MOD = 10**9 + 7","+# A = [ int(input()) for _ in range(N) ]","+##############################","-w = [0] * N","-v = [0] * N","+w = []","+v = []","- w[i] = a","- v[i] = b","-# 1 <= W <= 10^9\u306a\u306e\u3067\u6a2a\u8ef8\u3092W\u306b\u3059\u308b\u3068\u30c6\u30fc\u30d6\u30eb\u304c\u3067\u304b\u3059\u304e\u308b","-# \u305d\u306e\u304b\u308f\u308a\u306bV\u306e\u65b9\u3092\u6a2a\u8ef8\u306b\u3059\u308b","-# \u4fa1\u5024\u306e\u7dcf\u5408\u8a08\u306f\u307e\u3060\u4e0d\u660e\u306a\u306e\u3067\u3001\u9069\u5f53\u306b\u3067\u304b\u3044\u5024\u306b\u3057\u3068\u304f","-# \u6700\u4e0a\u90e8\u3068\u6700\u5de6\u90e8\u306b0\u304c\u5165\u308b\u306e\u3067\u3001\u305d\u306e\u5206\u3092+1","-V = N * 1000 + 1","-dp = [[float(\"inf\") for _ in range(V + 1)] for _ in range(N + 1)]","-# \u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\u306e\u3067\u3001\u4e0a\u8a18\u3067inf\u304c\u5165\u3063\u3066\u308b\u306e\u3067\u3001\u521d\u671f\u5024\u306f0\u3092\u3044\u308c\u308b\u5fc5\u8981\u304c\u3042\u308b","+ w.append(a)","+ v.append(b)","+V = sum(v)","+dp = [[INF for _ in range(V + 1)] for _ in range(N + 1)]","-# dp[i][sum_v] = \u3053\u308c\u307e\u3067(i-1)\u756a\u76ee\u307e\u3067\u306e\u54c1\u7269\u304b\u3089\u4fa1\u5024\u304csum_v\u4ee5\u4e0a\u306b\u306a\u308b\u3088\u3046\u306b\u9078\u3093\u3060\u3068\u304d\u306e\u3001\u91cd\u3055\u306e\u7dcf\u548c\u306e\u6700\u5c0f\u5024","- for sum_v in range(V):","- if sum_v - v[i] >= 0:","- dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - v[i]] + w[i])","- dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v])","-# \u4e2d\u8eab\u304cW\u306a\u306e\u3067\u3001W\u4ee5\u4e0b\u3067\u3042\u308b\u3046\u3061\u306esum_v\u306e\u6700\u5927\u5024\u3092\u6c42\u3081\u308c\u3070\u3044\u3044","-for sum_v in range(V):","- # \u6700\u7d42\u884c\u3060\u3051\u898b\u308c\u3070\u3044\u3044\u306e\u3067\u3001\u7aef\u304b\u3089sum_v\u306e\u6700\u5927\u5024\u3092\u306a\u3081\u308b\u3060\u3051","- if dp[N][sum_v] <= W:","- ans = sum_v","+ for j in range(V + 1):","+ if j - v[i] < 0:","+ dp[i + 1][j] = dp[i][j]","+ else:","+ dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])","+# print(dp[N])","+ans = 0","+for v in range(V + 1):","+ if dp[N][v] <= W:","+ ans = v"],"diff_only_import_comment":false,"measured_runtime_v0":0.3746892574,"measured_runtime_v1":0.2039975414,"runtime_lift":1.8367341819,"key":["s155060992","s347020442"]} +{"user_id":"u968166680","problem_id":"p02599","language":"python","submission_id_v0":"s648865207","submission_id_v1":"s892817156","cpu_time_v0":1665,"cpu_time_v1":1042,"memory_v0":247668,"memory_v1":267648,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n# Reference: https:\/\/www.geeksforgeeks.org\/queries-number-distinct-elements-subarray\/\n\n# Python3 code to find number of\n\n# distinct numbers in a subarray\n\nMAX = 1000001\n\n\n\n# structure to store queries\n\nclass Query:\n\n def __init__(self, l, r, idx):\n\n self.l = l\n\n self.r = r\n\n self.idx = idx\n\n\n\n\n\n# updating the bit array\n\ndef update(idx, val, bit, n):\n\n while idx <= n:\n\n bit[idx] += val\n\n idx += idx & -idx\n\n\n\n\n\n# querying the bit array\n\ndef query(idx, bit, n):\n\n summ = 0\n\n while idx:\n\n summ += bit[idx]\n\n idx -= idx & -idx\n\n return summ\n\n\n\n\n\ndef answeringQueries(arr, n, queries, q):\n\n\n\n # initialising bit array\n\n bit = [0] * (n + 1)\n\n\n\n # holds the rightmost index of\n\n # any number as numbers of a[i]\n\n # are less than or equal to 10^6\n\n last_visit = [-1] * MAX\n\n\n\n # answer for each query\n\n ans = [0] * q\n\n\n\n query_counter = 0\n\n for i in range(n):\n\n\n\n # If last visit is not -1 update -1 at the\n\n # idx equal to last_visit[arr[i]]\n\n if last_visit[arr[i]] != -1:\n\n update(last_visit[arr[i]] + 1, -1, bit, n)\n\n\n\n # Setting last_visit[arr[i]] as i and\n\n # updating the bit array accordingly\n\n last_visit[arr[i]] = i\n\n update(i + 1, 1, bit, n)\n\n\n\n # If i is equal to r of any query store answer\n\n # for that query in ans[]\n\n while query_counter < q and queries[query_counter].r == i:\n\n ans[queries[query_counter].idx] = query(queries[query_counter].r + 1, bit, n) - query(\n\n queries[query_counter].l, bit, n\n\n )\n\n query_counter += 1\n\n\n\n # print answer for each query\n\n for i in range(q):\n\n print((ans[i]))\n\n\n\n\n\n# This code is contributed by\n\n# sanjeev2552\n\n\n\n\n\ndef main():\n\n N, Q = list(map(int, readline().split()))\n\n C = list(map(int, readline().split()))\n\n (*LR,) = list(map(int, read().split()))\n\n\n\n queries = [0] * Q\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n queries[i] = Query(l - 1, r - 1, i)\n\n\n\n queries.sort(key=lambda x: x.r)\n\n answeringQueries(C, N, queries, Q)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n\n\nclass BIT:\n\n def __init__(self, n):\n\n self.n = n\n\n self.data = [0] * (n + 1)\n\n\n\n def add(self, i, x=1):\n\n i += 1\n\n while i <= self.n:\n\n self.data[i] += x\n\n i += i & -i\n\n\n\n def get_sum(self, i):\n\n i += 1\n\n x = 0\n\n while i > 0:\n\n x += self.data[i]\n\n i -= i & -i\n\n return x\n\n\n\n # Return sum for [l, r)\n\n def get_sum_range(self, l, r):\n\n return self.get_sum(r - 1) - self.get_sum(l - 1)\n\n\n\n\n\ndef main():\n\n N, Q = map(int, readline().split())\n\n C = list(map(int, readline().split()))\n\n LR = map(int, read().split())\n\n\n\n prev = [-1] * (N + 1)\n\n ps = [[] for _ in range(N)]\n\n for i, c in enumerate(C):\n\n if prev[c] != -1:\n\n ps[prev[c]].append(i)\n\n prev[c] = i\n\n\n\n qs = [[] for _ in range(N + 1)]\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n l -= 1\n\n r -= 1\n\n qs[l].append((r, i))\n\n\n\n ans = [0] * Q\n\n bit = BIT(N)\n\n\n\n for l in range(N - 1, -1, -1):\n\n for r in ps[l]:\n\n bit.add(r)\n\n for r, i in qs[l]:\n\n ans[i] = (r - l + 1) - bit.get_sum(r)\n\n\n\n print(*ans, sep='\\n')\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":99,"code_v1_loc":68,"code_v0_num_chars":2366,"code_v1_num_chars":1436,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n# Reference: https:\/\/www.geeksforgeeks.org\/queries-number-distinct-elements-subarray\/\n# Python3 code to find number of\n# distinct numbers in a subarray\nMAX = 1000001\n# structure to store queries\nclass Query:\n def __init__(self, l, r, idx):\n self.l = l\n self.r = r\n self.idx = idx\n\n\n# updating the bit array\ndef update(idx, val, bit, n):\n while idx <= n:\n bit[idx] += val\n idx += idx & -idx\n\n\n# querying the bit array\ndef query(idx, bit, n):\n summ = 0\n while idx:\n summ += bit[idx]\n idx -= idx & -idx\n return summ\n\n\ndef answeringQueries(arr, n, queries, q):\n # initialising bit array\n bit = [0] * (n + 1)\n # holds the rightmost index of\n # any number as numbers of a[i]\n # are less than or equal to 10^6\n last_visit = [-1] * MAX\n # answer for each query\n ans = [0] * q\n query_counter = 0\n for i in range(n):\n # If last visit is not -1 update -1 at the\n # idx equal to last_visit[arr[i]]\n if last_visit[arr[i]] != -1:\n update(last_visit[arr[i]] + 1, -1, bit, n)\n # Setting last_visit[arr[i]] as i and\n # updating the bit array accordingly\n last_visit[arr[i]] = i\n update(i + 1, 1, bit, n)\n # If i is equal to r of any query store answer\n # for that query in ans[]\n while query_counter < q and queries[query_counter].r == i:\n ans[queries[query_counter].idx] = query(\n queries[query_counter].r + 1, bit, n\n ) - query(queries[query_counter].l, bit, n)\n query_counter += 1\n # print answer for each query\n for i in range(q):\n print((ans[i]))\n\n\n# This code is contributed by\n# sanjeev2552\ndef main():\n N, Q = list(map(int, readline().split()))\n C = list(map(int, readline().split()))\n (*LR,) = list(map(int, read().split()))\n queries = [0] * Q\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n queries[i] = Query(l - 1, r - 1, i)\n queries.sort(key=lambda x: x.r)\n answeringQueries(C, N, queries, Q)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n\n\nclass BIT:\n def __init__(self, n):\n self.n = n\n self.data = [0] * (n + 1)\n\n def add(self, i, x=1):\n i += 1\n while i <= self.n:\n self.data[i] += x\n i += i & -i\n\n def get_sum(self, i):\n i += 1\n x = 0\n while i > 0:\n x += self.data[i]\n i -= i & -i\n return x\n\n # Return sum for [l, r)\n def get_sum_range(self, l, r):\n return self.get_sum(r - 1) - self.get_sum(l - 1)\n\n\ndef main():\n N, Q = map(int, readline().split())\n C = list(map(int, readline().split()))\n LR = map(int, read().split())\n prev = [-1] * (N + 1)\n ps = [[] for _ in range(N)]\n for i, c in enumerate(C):\n if prev[c] != -1:\n ps[prev[c]].append(i)\n prev[c] = i\n qs = [[] for _ in range(N + 1)]\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n l -= 1\n r -= 1\n qs[l].append((r, i))\n ans = [0] * Q\n bit = BIT(N)\n for l in range(N - 1, -1, -1):\n for r in ps[l]:\n bit.add(r)\n for r, i in qs[l]:\n ans[i] = (r - l + 1) - bit.get_sum(r)\n print(*ans, sep=\"\\n\")\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":31.3131313131,"diff":["-# Reference: https:\/\/www.geeksforgeeks.org\/queries-number-distinct-elements-subarray\/","-# Python3 code to find number of","-# distinct numbers in a subarray","-MAX = 1000001","-# structure to store queries","-class Query:","- def __init__(self, l, r, idx):","- self.l = l","- self.r = r","- self.idx = idx","-# updating the bit array","-def update(idx, val, bit, n):","- while idx <= n:","- bit[idx] += val","- idx += idx & -idx","+class BIT:","+ def __init__(self, n):","+ self.n = n","+ self.data = [0] * (n + 1)","+","+ def add(self, i, x=1):","+ i += 1","+ while i <= self.n:","+ self.data[i] += x","+ i += i & -i","+","+ def get_sum(self, i):","+ i += 1","+ x = 0","+ while i > 0:","+ x += self.data[i]","+ i -= i & -i","+ return x","+","+ # Return sum for [l, r)","+ def get_sum_range(self, l, r):","+ return self.get_sum(r - 1) - self.get_sum(l - 1)","-# querying the bit array","-def query(idx, bit, n):","- summ = 0","- while idx:","- summ += bit[idx]","- idx -= idx & -idx","- return summ","-","-","-def answeringQueries(arr, n, queries, q):","- # initialising bit array","- bit = [0] * (n + 1)","- # holds the rightmost index of","- # any number as numbers of a[i]","- # are less than or equal to 10^6","- last_visit = [-1] * MAX","- # answer for each query","- ans = [0] * q","- query_counter = 0","- for i in range(n):","- # If last visit is not -1 update -1 at the","- # idx equal to last_visit[arr[i]]","- if last_visit[arr[i]] != -1:","- update(last_visit[arr[i]] + 1, -1, bit, n)","- # Setting last_visit[arr[i]] as i and","- # updating the bit array accordingly","- last_visit[arr[i]] = i","- update(i + 1, 1, bit, n)","- # If i is equal to r of any query store answer","- # for that query in ans[]","- while query_counter < q and queries[query_counter].r == i:","- ans[queries[query_counter].idx] = query(","- queries[query_counter].r + 1, bit, n","- ) - query(queries[query_counter].l, bit, n)","- query_counter += 1","- # print answer for each query","- for i in range(q):","- print((ans[i]))","-","-","-# This code is contributed by","-# sanjeev2552","- N, Q = list(map(int, readline().split()))","+ N, Q = map(int, readline().split())","- (*LR,) = list(map(int, read().split()))","- queries = [0] * Q","+ LR = map(int, read().split())","+ prev = [-1] * (N + 1)","+ ps = [[] for _ in range(N)]","+ for i, c in enumerate(C):","+ if prev[c] != -1:","+ ps[prev[c]].append(i)","+ prev[c] = i","+ qs = [[] for _ in range(N + 1)]","- queries[i] = Query(l - 1, r - 1, i)","- queries.sort(key=lambda x: x.r)","- answeringQueries(C, N, queries, Q)","+ l -= 1","+ r -= 1","+ qs[l].append((r, i))","+ ans = [0] * Q","+ bit = BIT(N)","+ for l in range(N - 1, -1, -1):","+ for r in ps[l]:","+ bit.add(r)","+ for r, i in qs[l]:","+ ans[i] = (r - l + 1) - bit.get_sum(r)","+ print(*ans, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.264044944,"measured_runtime_v1":0.2106282006,"runtime_lift":1.2536067971,"key":["s648865207","s892817156"]} +{"user_id":"u855831834","problem_id":"p02596","language":"python","submission_id_v0":"s777833838","submission_id_v1":"s349314776","cpu_time_v0":179,"cpu_time_v1":88,"memory_v0":9072,"memory_v1":63520,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.84,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk = int(eval(input()))\n\nnum = 0\n\nif not k%2:\n\n print((-1))\n\nelse:\n\n for i in range(k):\n\n num = (num*10+7)%k\n\n if num == 0:\n\n print((i+1))\n\n break\n\n else:\n\n print((-1))\n\n# optimized version of the same code:\n","target":"K = int(eval(input()))\n\n\n\nans = 1\n\nnum = 0\n\nseven = 7\n\n\n\nif not K%2:\n\n print((-1))\n\nelse:\n\n for i in range(K):\n\n num = num + seven\n\n seven = seven*10%K\n\n num = num%K\n\n if num == 0:\n\n print(ans)\n\n break\n\n ans += 1\n\n else:\n\n print((-1))","code_v0_loc":12,"code_v1_loc":19,"code_v0_num_chars":207,"code_v1_num_chars":297,"code_v0_no_empty_lines":"k = int(eval(input()))\nnum = 0\nif not k % 2:\n print((-1))\nelse:\n for i in range(k):\n num = (num * 10 + 7) % k\n if num == 0:\n print((i + 1))\n break\n else:\n print((-1))\n","code_v1_no_empty_lines":"K = int(eval(input()))\nans = 1\nnum = 0\nseven = 7\nif not K % 2:\n print((-1))\nelse:\n for i in range(K):\n num = num + seven\n seven = seven * 10 % K\n num = num % K\n if num == 0:\n print(ans)\n break\n ans += 1\n else:\n print((-1))\n","code_same":false,"relative_loc_diff_percent":36.8421052632,"diff":["-k = int(eval(input()))","+K = int(eval(input()))","+ans = 1","-if not k % 2:","+seven = 7","+if not K % 2:","- for i in range(k):","- num = (num * 10 + 7) % k","+ for i in range(K):","+ num = num + seven","+ seven = seven * 10 % K","+ num = num % K","- print((i + 1))","+ print(ans)","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.513984643,"measured_runtime_v1":0.3340408325,"runtime_lift":1.5386880672,"key":["s777833838","s349314776"]} +{"user_id":"u488636998","problem_id":"p02886","language":"python","submission_id_v0":"s711137678","submission_id_v1":"s721979470","cpu_time_v0":150,"cpu_time_v1":17,"memory_v0":12496,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN=int(eval(input()))\n\nd=list(map(int, input().split()))\n\n\n\nimport numpy as np\n\nd = np.array(d)\n\n\n\nprint(( ( (np.sum(d))**2 - np.sum(d**2) ) \/\/ 2 ))\n\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\nd=list(map(int, input().split()))\n\n\n\ncumsum = 0\n\nfor n in range(N):\n\n cumsum += d[n]\n\nsub_cumsum = 0\n\nans = 0\n\nfor n in range(N):\n\n sub_cumsum += d[n]\n\n ans += d[n] * (cumsum-sub_cumsum)\n\nprint(ans)\n","code_v0_loc":7,"code_v1_loc":12,"code_v0_num_chars":140,"code_v1_num_chars":224,"code_v0_no_empty_lines":"N = int(eval(input()))\nd = list(map(int, input().split()))\nimport numpy as np\n\nd = np.array(d)\nprint((((np.sum(d)) ** 2 - np.sum(d**2)) \/\/ 2))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nd = list(map(int, input().split()))\ncumsum = 0\nfor n in range(N):\n cumsum += d[n]\nsub_cumsum = 0\nans = 0\nfor n in range(N):\n sub_cumsum += d[n]\n ans += d[n] * (cumsum - sub_cumsum)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["-import numpy as np","-","-d = np.array(d)","-print((((np.sum(d)) ** 2 - np.sum(d**2)) \/\/ 2))","+cumsum = 0","+for n in range(N):","+ cumsum += d[n]","+sub_cumsum = 0","+ans = 0","+for n in range(N):","+ sub_cumsum += d[n]","+ ans += d[n] * (cumsum - sub_cumsum)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.6732356335,"measured_runtime_v1":0.2734009403,"runtime_lift":6.1200800239,"key":["s711137678","s721979470"]} +{"user_id":"u444560129","problem_id":"p02596","language":"python","submission_id_v0":"s838540391","submission_id_v1":"s786083962","cpu_time_v0":192,"cpu_time_v1":156,"memory_v0":9088,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.75,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk = int(eval(input()))\n\ncount = 1\n\nn = 0\n\nif k % 2 == 0 or k % 5 == 0:\n\n print((-1))\n\nelse:\n\n while 1:\n\n n = (n * 10 + 7) % k \n\n if n == 0:\n\n break \n\n count += 1\n\n print(count)\n\n# optimized version of the same code:\n","target":"def main(h):\n\n count = 1\n\n n = 0\n\n for i in range (k):\n\n n = (n * 10 + 7) % k \n\n if n == 0: \n\n print(count)\n\n return 0\n\n count += 1\n\n print((-1))\n\n \n\nif __name__ == '__main__':\n\n k = int(eval(input()))\n\n main(k)","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":196,"code_v1_num_chars":230,"code_v0_no_empty_lines":"k = int(eval(input()))\ncount = 1\nn = 0\nif k % 2 == 0 or k % 5 == 0:\n print((-1))\nelse:\n while 1:\n n = (n * 10 + 7) % k\n if n == 0:\n break\n count += 1\n print(count)\n","code_v1_no_empty_lines":"def main(h):\n count = 1\n n = 0\n for i in range(k):\n n = (n * 10 + 7) % k\n if n == 0:\n print(count)\n return 0\n count += 1\n print((-1))\n\n\nif __name__ == \"__main__\":\n k = int(eval(input()))\n main(k)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-k = int(eval(input()))","-count = 1","-n = 0","-if k % 2 == 0 or k % 5 == 0:","- print((-1))","-else:","- while 1:","+def main(h):","+ count = 1","+ n = 0","+ for i in range(k):","- break","+ print(count)","+ return 0","- print(count)","+ print((-1))","+","+","+if __name__ == \"__main__\":","+ k = int(eval(input()))","+ main(k)"],"diff_only_import_comment":false,"measured_runtime_v0":0.359774395,"measured_runtime_v1":0.0061541715,"runtime_lift":58.4602486856,"key":["s838540391","s786083962"]} +{"user_id":"u089376182","problem_id":"p03250","language":"python","submission_id_v0":"s131709017","submission_id_v1":"s244884559","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c = sorted(map(int, input().split()))\n\n\n\nprint((c*10 + b + a))\n\n# optimized version of the same code:\n","target":"a, b, c = list(map(int, input().split()))\n\n\n\nprint((max(a, b, c)*9 + (a + b + c)))","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":66,"code_v1_num_chars":74,"code_v0_no_empty_lines":"a, b, c = sorted(map(int, input().split()))\nprint((c * 10 + b + a))\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nprint((max(a, b, c) * 9 + (a + b + c)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a, b, c = sorted(map(int, input().split()))","-print((c * 10 + b + a))","+a, b, c = list(map(int, input().split()))","+print((max(a, b, c) * 9 + (a + b + c)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2633334219,"measured_runtime_v1":0.0501041813,"runtime_lift":5.2557174893,"key":["s131709017","s244884559"]} +{"user_id":"u813098295","problem_id":"p03371","language":"python","submission_id_v0":"s229566237","submission_id_v1":"s072536815","cpu_time_v0":222,"cpu_time_v1":129,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.89,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(200005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"a, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(100005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":204,"code_v1_num_chars":204,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(200005):\n tmp = i * 2 * c\n tmp += max(0, x - i) * a\n tmp += max(0, y - i) * b\n ans = min(ans, tmp)\nprint(ans)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(100005):\n tmp = i * 2 * c\n tmp += max(0, x - i) * a\n tmp += max(0, y - i) * b\n ans = min(ans, tmp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(200005):","+for i in range(100005):"],"diff_only_import_comment":false,"measured_runtime_v0":2.0992211397,"measured_runtime_v1":1.3130319312,"runtime_lift":1.5987586363,"key":["s229566237","s072536815"]} +{"user_id":"u179169725","problem_id":"p02574","language":"python","submission_id_v0":"s667619941","submission_id_v1":"s202036773","cpu_time_v0":600,"cpu_time_v1":355,"memory_v0":203704,"memory_v1":215292,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.83,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(1 << 25)\n\nreadline = sys.stdin.buffer.readline\n\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\n\nra = range\n\nenu = enumerate\n\n\n\n\n\ndef exit(*argv, **kwarg):\n\n print(*argv, **kwarg)\n\n sys.exit()\n\n\n\n\n\ndef mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))\n\n# \u53d7\u3051\u6e21\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u8981\u7d20\u304b\u3089sub\u3060\u3051\u5f15\u304f.\u30ea\u30b9\u30c8\u3092*\u3092\u3064\u3051\u3066\u5c55\u958b\u3057\u3066\u304a\u304f\u3053\u3068\n\n\n\n\n\ndef a_int(): return int(readline())\n\n\n\n\n\ndef ints(): return list(map(int, readline().split()))\n\n\n\n\n\ndef _make_minimum_prime(N: int):\n\n # x\u306e\u6700\u5c0f\u306e\u7d20\u56e0\u6570\u8868\u3092\u4f5c\u6210\n\n min_prime = [x for x in range(N + 1)]\n\n # min_prime[0] = 0 # 0\u30681\u306f\u7d20\u6570\u3067\u306f\u306a\u3044\n\n # min_prime[1] = 1\n\n for i in range(2, int(N ** 0.5) + 1):\n\n if min_prime[i] == i: # \u7d20\u6570\u3060\u3063\u305f\u3089\u66f4\u65b0\n\n for j in range(2 * i, N + 1, i): # i\u306e\u500d\u6570\u306f\u7d20\u6570\u3067\u306a\u3044\n\n if min_prime[j] == j:\n\n min_prime[j] = i\n\n return min_prime\n\n\n\n\n\nmin_prime = _make_minimum_prime(10**6)\n\n\n\n\n\nfrom collections import Counter\n\n\n\n\n\ndef fast_factorization(N: int):\n\n # -> List[Tuple[int,int]] (\u7d20\u6570,\u51aa\u6570)\u3092\u683c\u7d0d\n\n # \u6700\u5c0f\u7d20\u6570\u914d\u5217min_prime\u3092\u4f7f\u3063\u3066O(log N)\u3067\u56e0\u6570\u5206\u89e3\n\n if N == 1:\n\n return Counter() # 1\u306f\u7d20\u6570\u3067\u306f\u306a\u3044\n\n # \u7d20\u56e0\u6570\u5206\u89e3\n\n arr = []\n\n tmp = N\n\n while tmp != 1:\n\n p = min_prime[tmp]\n\n tmp \/\/= p\n\n arr.append(p)\n\n\n\n return Counter(arr)\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\nfrom collections import defaultdict, Counter, deque\n\nimport random\n\nfrom math import gcd\n\n\n\n\n\nN = a_int()\n\nA = ints()\n\nrandom.shuffle(A)\n\n\n\n# set\u304b\u306f\u3059\u3050\u308f\u304b\u308b\n\n# set\u3067\u306a\u3051\u308c\u3070 not coprime\n\n# pair\u306f\u4e92\u3044\u306b\u7d20\u304b\u3092\u307f\u308c\u3070\u3044\u3044\u306e\u304b\n\n# \u3064\u307e\u308a\u56e0\u6570\u5206\u89e3\u3057\u3066\u8db3\u3057\u3066\u3063\u305f\u3068\u304d\u306b\u3059\u3079\u3066\u306e\u7d20\u6570\u306e\u3079\u304d\u6570\u304c1\u4ee5\u4e0b\u3067\u3042\u308c\u3070\u826f\u3044\n\n\n\ng_set = 0\n\ncnt = defaultdict(lambda: 0)\n\nflg = 1 # pairwise\u3067\u3042\u308b\u30d5\u30e9\u30b0\n\nfor a in A:\n\n g_set = gcd(g_set, a)\n\n if flg:\n\n for p, n in fast_factorization(a).items():\n\n if cnt[p] != 0:\n\n flg = 0\n\n cnt[p] += n\n\n\n\n\n\n# print(cnt)\n\n# for v in cnt.values():\n\n# if v > 1:\n\n# flg = 0\n\n# break\n\n\n\nif g_set > 1:\n\n print('not coprime')\n\nelif flg:\n\n print('pairwise coprime')\n\nelse:\n\n print('setwise coprime')\n\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(1 << 25)\n\nreadline = sys.stdin.buffer.readline\n\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\n\nra = range\n\nenu = enumerate\n\n\n\n\n\ndef exit(*argv, **kwarg):\n\n print(*argv, **kwarg)\n\n sys.exit()\n\n\n\n\n\ndef mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))\n\n# \u53d7\u3051\u6e21\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u8981\u7d20\u304b\u3089sub\u3060\u3051\u5f15\u304f.\u30ea\u30b9\u30c8\u3092*\u3092\u3064\u3051\u3066\u5c55\u958b\u3057\u3066\u304a\u304f\u3053\u3068\n\n\n\n\n\ndef a_int(): return int(readline())\n\n\n\n\n\ndef ints(): return list(map(int, readline().split()))\n\n\n\n\n\nfrom collections import Counter\n\n\n\n\n\nclass FastFactorization:\n\n def __init__(self, N: int):\n\n '''\u69cb\u7bc9O(NloglogN)\u3001\u30af\u30a8\u30eaO(logN)'''\n\n self.N = N\n\n self.min_prime = self._make_minimum_prime()\n\n\n\n def _make_minimum_prime(self):\n\n # x\u306e\u6700\u5c0f\u306e\u7d20\u56e0\u6570\u8868\u3092\u4f5c\u6210\n\n min_prime = [x for x in range(self.N + 1)]\n\n # min_prime[0] = 0 # 0\u30681\u306f\u7d20\u6570\u3067\u306f\u306a\u3044\n\n # min_prime[1] = 1\n\n for i in range(2, int(self.N ** 0.5) + 1):\n\n if min_prime[i] == i: # \u7d20\u6570\u3060\u3063\u305f\u3089\u66f4\u65b0\n\n for j in range(2 * i, self.N + 1, i): # i\u306e\u500d\u6570\u306f\u7d20\u6570\u3067\u306a\u3044\n\n if min_prime[j] == j:\n\n min_prime[j] = i\n\n return min_prime\n\n\n\n def query(self, x: int):\n\n # -> Counter[p,n] (\u7d20\u6570,\u51aa\u6570) \u3092\u683c\u7d0d\n\n # \u6700\u5c0f\u7d20\u6570\u914d\u5217min_prime\u3092\u4f7f\u3063\u3066O(log N)\u3067\u56e0\u6570\u5206\u89e3\n\n if x == 1:\n\n return Counter() # 1\u306f\u7d20\u6570\u3067\u306f\u306a\u3044\n\n\n\n # \u7d20\u56e0\u6570\u5206\u89e3\n\n arr = []\n\n tmp = x\n\n while tmp != 1:\n\n p = self.min_prime[tmp]\n\n tmp \/\/= p\n\n arr.append(p)\n\n return Counter(arr)\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\nfrom collections import defaultdict, Counter, deque\n\nfrom math import gcd\n\n\n\n\n\nN = a_int()\n\nA = ints()\n\n\n\nfact = FastFactorization(max(A))\n\n\n\n# set\u304b\u306f\u3059\u3050\u308f\u304b\u308b\n\n# set\u3067\u306a\u3051\u308c\u3070 not coprime\n\n# pair\u306f\u4e92\u3044\u306b\u7d20\u304b\u3092\u307f\u308c\u3070\u3044\u3044\u306e\u304b\n\n# \u3064\u307e\u308a\u56e0\u6570\u5206\u89e3\u3057\u3066\u8db3\u3057\u3066\u3063\u305f\u3068\u304d\u306b\u3059\u3079\u3066\u306e\u7d20\u6570\u306e\u3079\u304d\u6570\u304c1\u4ee5\u4e0b\u3067\u3042\u308c\u3070\u826f\u3044\n\n\n\ng_set = 0\n\ncnt = defaultdict(lambda: 0)\n\nflg = 1 # pairwise\u3067\u3042\u308b\u30d5\u30e9\u30b0\n\nfor a in A:\n\n g_set = gcd(g_set, a)\n\n if flg:\n\n for p, n in fact.query(a).items():\n\n if cnt[p] != 0:\n\n flg = 0\n\n cnt[p] += n\n\n\n\n\n\n# print(cnt)\n\n# for v in cnt.values():\n\n# if v > 1:\n\n# flg = 0\n\n# break\n\n\n\nif g_set > 1:\n\n print('not coprime')\n\nelif flg:\n\n print('pairwise coprime')\n\nelse:\n\n print('setwise coprime')\n","code_v0_loc":99,"code_v1_loc":101,"code_v0_num_chars":2049,"code_v1_num_chars":2271,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1 << 25)\nreadline = sys.stdin.buffer.readline\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\nra = range\nenu = enumerate\n\n\ndef exit(*argv, **kwarg):\n print(*argv, **kwarg)\n sys.exit()\n\n\ndef mina(*argv, sub=1):\n return list(map(lambda x: x - sub, argv))\n\n\n# \u53d7\u3051\u6e21\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u8981\u7d20\u304b\u3089sub\u3060\u3051\u5f15\u304f.\u30ea\u30b9\u30c8\u3092*\u3092\u3064\u3051\u3066\u5c55\u958b\u3057\u3066\u304a\u304f\u3053\u3068\ndef a_int():\n return int(readline())\n\n\ndef ints():\n return list(map(int, readline().split()))\n\n\ndef _make_minimum_prime(N: int):\n # x\u306e\u6700\u5c0f\u306e\u7d20\u56e0\u6570\u8868\u3092\u4f5c\u6210\n min_prime = [x for x in range(N + 1)]\n # min_prime[0] = 0 # 0\u30681\u306f\u7d20\u6570\u3067\u306f\u306a\u3044\n # min_prime[1] = 1\n for i in range(2, int(N**0.5) + 1):\n if min_prime[i] == i: # \u7d20\u6570\u3060\u3063\u305f\u3089\u66f4\u65b0\n for j in range(2 * i, N + 1, i): # i\u306e\u500d\u6570\u306f\u7d20\u6570\u3067\u306a\u3044\n if min_prime[j] == j:\n min_prime[j] = i\n return min_prime\n\n\nmin_prime = _make_minimum_prime(10**6)\nfrom collections import Counter\n\n\ndef fast_factorization(N: int):\n # -> List[Tuple[int,int]] (\u7d20\u6570,\u51aa\u6570)\u3092\u683c\u7d0d\n # \u6700\u5c0f\u7d20\u6570\u914d\u5217min_prime\u3092\u4f7f\u3063\u3066O(log N)\u3067\u56e0\u6570\u5206\u89e3\n if N == 1:\n return Counter() # 1\u306f\u7d20\u6570\u3067\u306f\u306a\u3044\n # \u7d20\u56e0\u6570\u5206\u89e3\n arr = []\n tmp = N\n while tmp != 1:\n p = min_prime[tmp]\n tmp \/\/= p\n arr.append(p)\n return Counter(arr)\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nfrom collections import defaultdict, Counter, deque\nimport random\nfrom math import gcd\n\nN = a_int()\nA = ints()\nrandom.shuffle(A)\n# set\u304b\u306f\u3059\u3050\u308f\u304b\u308b\n# set\u3067\u306a\u3051\u308c\u3070 not coprime\n# pair\u306f\u4e92\u3044\u306b\u7d20\u304b\u3092\u307f\u308c\u3070\u3044\u3044\u306e\u304b\n# \u3064\u307e\u308a\u56e0\u6570\u5206\u89e3\u3057\u3066\u8db3\u3057\u3066\u3063\u305f\u3068\u304d\u306b\u3059\u3079\u3066\u306e\u7d20\u6570\u306e\u3079\u304d\u6570\u304c1\u4ee5\u4e0b\u3067\u3042\u308c\u3070\u826f\u3044\ng_set = 0\ncnt = defaultdict(lambda: 0)\nflg = 1 # pairwise\u3067\u3042\u308b\u30d5\u30e9\u30b0\nfor a in A:\n g_set = gcd(g_set, a)\n if flg:\n for p, n in fast_factorization(a).items():\n if cnt[p] != 0:\n flg = 0\n cnt[p] += n\n# print(cnt)\n# for v in cnt.values():\n# if v > 1:\n# flg = 0\n# break\nif g_set > 1:\n print(\"not coprime\")\nelif flg:\n print(\"pairwise coprime\")\nelse:\n print(\"setwise coprime\")\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1 << 25)\nreadline = sys.stdin.buffer.readline\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\nra = range\nenu = enumerate\n\n\ndef exit(*argv, **kwarg):\n print(*argv, **kwarg)\n sys.exit()\n\n\ndef mina(*argv, sub=1):\n return list(map(lambda x: x - sub, argv))\n\n\n# \u53d7\u3051\u6e21\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u8981\u7d20\u304b\u3089sub\u3060\u3051\u5f15\u304f.\u30ea\u30b9\u30c8\u3092*\u3092\u3064\u3051\u3066\u5c55\u958b\u3057\u3066\u304a\u304f\u3053\u3068\ndef a_int():\n return int(readline())\n\n\ndef ints():\n return list(map(int, readline().split()))\n\n\nfrom collections import Counter\n\n\nclass FastFactorization:\n def __init__(self, N: int):\n \"\"\"\u69cb\u7bc9O(NloglogN)\u3001\u30af\u30a8\u30eaO(logN)\"\"\"\n self.N = N\n self.min_prime = self._make_minimum_prime()\n\n def _make_minimum_prime(self):\n # x\u306e\u6700\u5c0f\u306e\u7d20\u56e0\u6570\u8868\u3092\u4f5c\u6210\n min_prime = [x for x in range(self.N + 1)]\n # min_prime[0] = 0 # 0\u30681\u306f\u7d20\u6570\u3067\u306f\u306a\u3044\n # min_prime[1] = 1\n for i in range(2, int(self.N**0.5) + 1):\n if min_prime[i] == i: # \u7d20\u6570\u3060\u3063\u305f\u3089\u66f4\u65b0\n for j in range(2 * i, self.N + 1, i): # i\u306e\u500d\u6570\u306f\u7d20\u6570\u3067\u306a\u3044\n if min_prime[j] == j:\n min_prime[j] = i\n return min_prime\n\n def query(self, x: int):\n # -> Counter[p,n] (\u7d20\u6570,\u51aa\u6570) \u3092\u683c\u7d0d\n # \u6700\u5c0f\u7d20\u6570\u914d\u5217min_prime\u3092\u4f7f\u3063\u3066O(log N)\u3067\u56e0\u6570\u5206\u89e3\n if x == 1:\n return Counter() # 1\u306f\u7d20\u6570\u3067\u306f\u306a\u3044\n # \u7d20\u56e0\u6570\u5206\u89e3\n arr = []\n tmp = x\n while tmp != 1:\n p = self.min_prime[tmp]\n tmp \/\/= p\n arr.append(p)\n return Counter(arr)\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nfrom collections import defaultdict, Counter, deque\nfrom math import gcd\n\nN = a_int()\nA = ints()\nfact = FastFactorization(max(A))\n# set\u304b\u306f\u3059\u3050\u308f\u304b\u308b\n# set\u3067\u306a\u3051\u308c\u3070 not coprime\n# pair\u306f\u4e92\u3044\u306b\u7d20\u304b\u3092\u307f\u308c\u3070\u3044\u3044\u306e\u304b\n# \u3064\u307e\u308a\u56e0\u6570\u5206\u89e3\u3057\u3066\u8db3\u3057\u3066\u3063\u305f\u3068\u304d\u306b\u3059\u3079\u3066\u306e\u7d20\u6570\u306e\u3079\u304d\u6570\u304c1\u4ee5\u4e0b\u3067\u3042\u308c\u3070\u826f\u3044\ng_set = 0\ncnt = defaultdict(lambda: 0)\nflg = 1 # pairwise\u3067\u3042\u308b\u30d5\u30e9\u30b0\nfor a in A:\n g_set = gcd(g_set, a)\n if flg:\n for p, n in fact.query(a).items():\n if cnt[p] != 0:\n flg = 0\n cnt[p] += n\n# print(cnt)\n# for v in cnt.values():\n# if v > 1:\n# flg = 0\n# break\nif g_set > 1:\n print(\"not coprime\")\nelif flg:\n print(\"pairwise coprime\")\nelse:\n print(\"setwise coprime\")\n","code_same":false,"relative_loc_diff_percent":1.9801980198,"diff":["-def _make_minimum_prime(N: int):","- # x\u306e\u6700\u5c0f\u306e\u7d20\u56e0\u6570\u8868\u3092\u4f5c\u6210","- min_prime = [x for x in range(N + 1)]","- # min_prime[0] = 0 # 0\u30681\u306f\u7d20\u6570\u3067\u306f\u306a\u3044","- # min_prime[1] = 1","- for i in range(2, int(N**0.5) + 1):","- if min_prime[i] == i: # \u7d20\u6570\u3060\u3063\u305f\u3089\u66f4\u65b0","- for j in range(2 * i, N + 1, i): # i\u306e\u500d\u6570\u306f\u7d20\u6570\u3067\u306a\u3044","- if min_prime[j] == j:","- min_prime[j] = i","- return min_prime","-","-","-min_prime = _make_minimum_prime(10**6)","-def fast_factorization(N: int):","- # -> List[Tuple[int,int]] (\u7d20\u6570,\u51aa\u6570)\u3092\u683c\u7d0d","- # \u6700\u5c0f\u7d20\u6570\u914d\u5217min_prime\u3092\u4f7f\u3063\u3066O(log N)\u3067\u56e0\u6570\u5206\u89e3","- if N == 1:","- return Counter() # 1\u306f\u7d20\u6570\u3067\u306f\u306a\u3044","- # \u7d20\u56e0\u6570\u5206\u89e3","- arr = []","- tmp = N","- while tmp != 1:","- p = min_prime[tmp]","- tmp \/\/= p","- arr.append(p)","- return Counter(arr)","+class FastFactorization:","+ def __init__(self, N: int):","+ \"\"\"\u69cb\u7bc9O(NloglogN)\u3001\u30af\u30a8\u30eaO(logN)\"\"\"","+ self.N = N","+ self.min_prime = self._make_minimum_prime()","+","+ def _make_minimum_prime(self):","+ # x\u306e\u6700\u5c0f\u306e\u7d20\u56e0\u6570\u8868\u3092\u4f5c\u6210","+ min_prime = [x for x in range(self.N + 1)]","+ # min_prime[0] = 0 # 0\u30681\u306f\u7d20\u6570\u3067\u306f\u306a\u3044","+ # min_prime[1] = 1","+ for i in range(2, int(self.N**0.5) + 1):","+ if min_prime[i] == i: # \u7d20\u6570\u3060\u3063\u305f\u3089\u66f4\u65b0","+ for j in range(2 * i, self.N + 1, i): # i\u306e\u500d\u6570\u306f\u7d20\u6570\u3067\u306a\u3044","+ if min_prime[j] == j:","+ min_prime[j] = i","+ return min_prime","+","+ def query(self, x: int):","+ # -> Counter[p,n] (\u7d20\u6570,\u51aa\u6570) \u3092\u683c\u7d0d","+ # \u6700\u5c0f\u7d20\u6570\u914d\u5217min_prime\u3092\u4f7f\u3063\u3066O(log N)\u3067\u56e0\u6570\u5206\u89e3","+ if x == 1:","+ return Counter() # 1\u306f\u7d20\u6570\u3067\u306f\u306a\u3044","+ # \u7d20\u56e0\u6570\u5206\u89e3","+ arr = []","+ tmp = x","+ while tmp != 1:","+ p = self.min_prime[tmp]","+ tmp \/\/= p","+ arr.append(p)","+ return Counter(arr)","-import random","-random.shuffle(A)","+fact = FastFactorization(max(A))","- for p, n in fast_factorization(a).items():","+ for p, n in fact.query(a).items():"],"diff_only_import_comment":false,"measured_runtime_v0":3.5886808305,"measured_runtime_v1":0.2258392296,"runtime_lift":15.8904227442,"key":["s667619941","s202036773"]} +{"user_id":"u499259667","problem_id":"p03844","language":"python","submission_id_v0":"s838870777","submission_id_v1":"s858116598","cpu_time_v0":12,"cpu_time_v1":10,"memory_v0":2572,"memory_v1":2572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nprint((eval(input())))\n\n# optimized version of the same code:\n","target":"print(eval(input()))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":14,"code_v1_num_chars":13,"code_v0_no_empty_lines":"print((eval(input())))\n","code_v1_no_empty_lines":"print(eval(input()))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((eval(input())))","+print(eval(input()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3375790837,"measured_runtime_v1":0.2112844212,"runtime_lift":1.5977471587,"key":["s838870777","s858116598"]} +{"user_id":"u576434377","problem_id":"p03568","language":"python","submission_id_v0":"s245503579","submission_id_v1":"s305475228","cpu_time_v0":101,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nAs = list(map(int,input().split()))\n\n\n\n\n\ndef dfs(A_s, index,Bss):\n\n if index == N:\n\n tmp = 1\n\n for b in Bss:\n\n tmp *= b\n\n return 1 if tmp % 2 == 0 else 0\n\n b_mi = Bss.copy()\n\n b_mi.append(A_s[index] - 1)\n\n\n\n b = Bss.copy()\n\n b.append(A_s[index])\n\n\n\n b_pl = Bss.copy()\n\n b_pl.append(A_s[index] + 1)\n\n return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)\n\n\n\n\n\nprint((dfs(As,0,[])))\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nAs = list(map(int,input().split()))\n\n\n\ntmp = 1\n\nfor i in range(N):\n\n if As[i] % 2 == 0:\n\n tmp *= 2\n\n\n\nprint((3 ** N - tmp))","code_v0_loc":22,"code_v1_loc":9,"code_v0_num_chars":480,"code_v1_num_chars":148,"code_v0_no_empty_lines":"N = int(eval(input()))\nAs = list(map(int, input().split()))\n\n\ndef dfs(A_s, index, Bss):\n if index == N:\n tmp = 1\n for b in Bss:\n tmp *= b\n return 1 if tmp % 2 == 0 else 0\n b_mi = Bss.copy()\n b_mi.append(A_s[index] - 1)\n b = Bss.copy()\n b.append(A_s[index])\n b_pl = Bss.copy()\n b_pl.append(A_s[index] + 1)\n return (\n dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)\n )\n\n\nprint((dfs(As, 0, [])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nAs = list(map(int, input().split()))\ntmp = 1\nfor i in range(N):\n if As[i] % 2 == 0:\n tmp *= 2\nprint((3**N - tmp))\n","code_same":false,"relative_loc_diff_percent":59.0909090909,"diff":["-","-","-def dfs(A_s, index, Bss):","- if index == N:","- tmp = 1","- for b in Bss:","- tmp *= b","- return 1 if tmp % 2 == 0 else 0","- b_mi = Bss.copy()","- b_mi.append(A_s[index] - 1)","- b = Bss.copy()","- b.append(A_s[index])","- b_pl = Bss.copy()","- b_pl.append(A_s[index] + 1)","- return (","- dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)","- )","-","-","-print((dfs(As, 0, [])))","+tmp = 1","+for i in range(N):","+ if As[i] % 2 == 0:","+ tmp *= 2","+print((3**N - tmp))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4574659042,"measured_runtime_v1":0.2742938831,"runtime_lift":1.6677947721,"key":["s245503579","s305475228"]} +{"user_id":"u638456847","problem_id":"p02767","language":"python","submission_id_v0":"s863703424","submission_id_v1":"s161615946","cpu_time_v0":171,"cpu_time_v1":20,"memory_v0":13232,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.3,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\ndef main():\n\n N = int(readline())\n\n X = [int(i) for i in readline().split()]\n\n X = np.array(X)\n\n\n\n ans = np.min(np.sum((X - np.arange(1,101).reshape(100, 1))**2, axis=1))\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\ndef main():\n\n N = int(readline())\n\n X = [int(i) for i in readline().split()]\n\n\n\n ans = float('inf')\n\n for i in range(1,101):\n\n tmp = 0\n\n for x in X:\n\n tmp += (x - i)**2\n\n \n\n if tmp < ans:\n\n ans = tmp\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":17,"code_v1_loc":23,"code_v0_num_chars":364,"code_v1_num_chars":425,"code_v0_no_empty_lines":"import numpy as np\nimport sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\n\ndef main():\n N = int(readline())\n X = [int(i) for i in readline().split()]\n X = np.array(X)\n ans = np.min(np.sum((X - np.arange(1, 101).reshape(100, 1)) ** 2, axis=1))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\n\ndef main():\n N = int(readline())\n X = [int(i) for i in readline().split()]\n ans = float(\"inf\")\n for i in range(1, 101):\n tmp = 0\n for x in X:\n tmp += (x - i) ** 2\n if tmp < ans:\n ans = tmp\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":26.0869565217,"diff":["-import numpy as np","- X = np.array(X)","- ans = np.min(np.sum((X - np.arange(1, 101).reshape(100, 1)) ** 2, axis=1))","+ ans = float(\"inf\")","+ for i in range(1, 101):","+ tmp = 0","+ for x in X:","+ tmp += (x - i) ** 2","+ if tmp < ans:","+ ans = tmp"],"diff_only_import_comment":false,"measured_runtime_v0":1.4478538656,"measured_runtime_v1":0.2722764146,"runtime_lift":5.3175882587,"key":["s863703424","s161615946"]} +{"user_id":"u414877092","problem_id":"p03796","language":"python","submission_id_v0":"s477602976","submission_id_v1":"s500304823","cpu_time_v0":230,"cpu_time_v1":31,"memory_v0":4024,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nn=int(eval(input()))\n\nprint((math.factorial(n)%(10**9+7)))\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\ndef fact(n):\n\n val=1\n\n for i in range(2,n+1):\n\n val*=i\n\n val%=1000000007\n\n return val\n\nprint((fact(N)))","code_v0_loc":3,"code_v1_loc":8,"code_v0_num_chars":63,"code_v1_num_chars":140,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nprint((math.factorial(n) % (10**9 + 7)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\n\n\ndef fact(n):\n val = 1\n for i in range(2, n + 1):\n val *= i\n val %= 1000000007\n return val\n\n\nprint((fact(N)))\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-import math","+N = int(eval(input()))","-n = int(eval(input()))","-print((math.factorial(n) % (10**9 + 7)))","+","+def fact(n):","+ val = 1","+ for i in range(2, n + 1):","+ val *= i","+ val %= 1000000007","+ return val","+","+","+print((fact(N)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5394072673,"measured_runtime_v1":0.259771318,"runtime_lift":2.0764696871,"key":["s477602976","s500304823"]} +{"user_id":"u503227287","problem_id":"p02555","language":"python","submission_id_v0":"s596282425","submission_id_v1":"s780625634","cpu_time_v0":177,"cpu_time_v1":66,"memory_v0":73480,"memory_v1":64124,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom sys import stdin\n\nfrom math import factorial\n\n\n\n\n\ndef combinations_count(n, r):\n\n return factorial(n) \/\/ (factorial(n - r) * factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n _in = [_.rstrip() for _ in stdin.readlines()]\n\n S = int(_in[0]) # type:int\n\n # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n\n min_ = 1\n\n max_ = S \/\/ 3\n\n ans = 0\n\n for i in range(min_, max_ + 1):\n\n mod = S - i * 3\n\n ans += combinations_with_replacement_count(mod + 1, i - 1) % (10**9 + 7)\n\n ans %= (10**9 + 7)\n\n # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"from sys import stdin\n\n\n\n\n\nclass ModComb():\n\n def __init__(self, n_max, mod):\n\n self.fac = None\n\n self.mod = mod\n\n self.make_fac_table(n_max)\n\n\n\n def make_fac_table(self, n_max):\n\n self.fac = [1] + [0] * n_max\n\n for i in range(1, n_max + 1):\n\n self.fac[i] = self.fac[i - 1] * i % self.mod\n\n\n\n def mod_comb(self, n, k):\n\n if n == 0 and k == 0:\n\n return 1\n\n elif n < k or k < 0:\n\n return 0\n\n else:\n\n return self.fac[n] * pow(self.fac[n - k], self.mod - 2, self.mod) * \\\n\n pow(self.fac[k], self.mod - 2, self.mod) % self.mod\n\n\n\n def mod_comb_with_rep(self, n, k):\n\n return self.mod_comb(n + k - 1, k)\n\n\n\n\n\ndef main():\n\n _in = [_.rstrip() for _ in stdin.readlines()]\n\n S = int(_in[0]) # type:int\n\n # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n\n ans = 0\n\n MOD = 10**9 + 7\n\n modcomb = ModComb(S + 1, MOD)\n\n min_ = 1\n\n max_ = S \/\/ 3\n\n for i in range(min_, max_ + 1):\n\n res = S - i * 3\n\n ans += modcomb.mod_comb_with_rep(res + 1, i - 1)\n\n ans %= MOD\n\n # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":29,"code_v1_loc":46,"code_v0_num_chars":737,"code_v1_num_chars":1252,"code_v0_no_empty_lines":"from sys import stdin\nfrom math import factorial\n\n\ndef combinations_count(n, r):\n return factorial(n) \/\/ (factorial(n - r) * factorial(r))\n\n\ndef combinations_with_replacement_count(n, r):\n return combinations_count(n + r - 1, r)\n\n\ndef main():\n _in = [_.rstrip() for _ in stdin.readlines()]\n S = int(_in[0]) # type:int\n # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n min_ = 1\n max_ = S \/\/ 3\n ans = 0\n for i in range(min_, max_ + 1):\n mod = S - i * 3\n ans += combinations_with_replacement_count(mod + 1, i - 1) % (10**9 + 7)\n ans %= 10**9 + 7\n # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from sys import stdin\n\n\nclass ModComb:\n def __init__(self, n_max, mod):\n self.fac = None\n self.mod = mod\n self.make_fac_table(n_max)\n\n def make_fac_table(self, n_max):\n self.fac = [1] + [0] * n_max\n for i in range(1, n_max + 1):\n self.fac[i] = self.fac[i - 1] * i % self.mod\n\n def mod_comb(self, n, k):\n if n == 0 and k == 0:\n return 1\n elif n < k or k < 0:\n return 0\n else:\n return (\n self.fac[n]\n * pow(self.fac[n - k], self.mod - 2, self.mod)\n * pow(self.fac[k], self.mod - 2, self.mod)\n % self.mod\n )\n\n def mod_comb_with_rep(self, n, k):\n return self.mod_comb(n + k - 1, k)\n\n\ndef main():\n _in = [_.rstrip() for _ in stdin.readlines()]\n S = int(_in[0]) # type:int\n # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n ans = 0\n MOD = 10**9 + 7\n modcomb = ModComb(S + 1, MOD)\n min_ = 1\n max_ = S \/\/ 3\n for i in range(min_, max_ + 1):\n res = S - i * 3\n ans += modcomb.mod_comb_with_rep(res + 1, i - 1)\n ans %= MOD\n # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":36.9565217391,"diff":["-from math import factorial","-def combinations_count(n, r):","- return factorial(n) \/\/ (factorial(n - r) * factorial(r))","+class ModComb:","+ def __init__(self, n_max, mod):","+ self.fac = None","+ self.mod = mod","+ self.make_fac_table(n_max)","+ def make_fac_table(self, n_max):","+ self.fac = [1] + [0] * n_max","+ for i in range(1, n_max + 1):","+ self.fac[i] = self.fac[i - 1] * i % self.mod","-def combinations_with_replacement_count(n, r):","- return combinations_count(n + r - 1, r)","+ def mod_comb(self, n, k):","+ if n == 0 and k == 0:","+ return 1","+ elif n < k or k < 0:","+ return 0","+ else:","+ return (","+ self.fac[n]","+ * pow(self.fac[n - k], self.mod - 2, self.mod)","+ * pow(self.fac[k], self.mod - 2, self.mod)","+ % self.mod","+ )","+","+ def mod_comb_with_rep(self, n, k):","+ return self.mod_comb(n + k - 1, k)","+ ans = 0","+ MOD = 10**9 + 7","+ modcomb = ModComb(S + 1, MOD)","- ans = 0","- mod = S - i * 3","- ans += combinations_with_replacement_count(mod + 1, i - 1) % (10**9 + 7)","- ans %= 10**9 + 7","+ res = S - i * 3","+ ans += modcomb.mod_comb_with_rep(res + 1, i - 1)","+ ans %= MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.1465539389,"measured_runtime_v1":0.1122963901,"runtime_lift":1.3050636693,"key":["s596282425","s780625634"]} +{"user_id":"u970308980","problem_id":"p03309","language":"python","submission_id_v0":"s685396762","submission_id_v1":"s566858224","cpu_time_v0":318,"cpu_time_v1":239,"memory_v0":101332,"memory_v1":27244,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.84,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n# \u4e2d\u592e\u5024\n\nB = []\n\nfor i in range(N):\n\n B.append(A[i] - (i+1))\n\nb = sorted(B)[N\/\/2]\n\n\n\nans = 0\n\nfor i in range(N):\n\n ans += abs(A[i] - (i + 1) - b)\n\n\n\nprint(ans)\n\n\n\n\n# optimized version of the same code:\n","target":"from statistics import median_low\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nD = []\n\nfor i in range(N):\n\n D.append(A[i] - (i+1))\n\n\n\nm = median_low(D)\n\nans = 0\n\nfor d in D:\n\n ans += abs(d - m)\n\n\n\nprint(ans)\n","code_v0_loc":14,"code_v1_loc":15,"code_v0_num_chars":221,"code_v1_num_chars":229,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\n# \u4e2d\u592e\u5024\nB = []\nfor i in range(N):\n B.append(A[i] - (i + 1))\nb = sorted(B)[N \/\/ 2]\nans = 0\nfor i in range(N):\n ans += abs(A[i] - (i + 1) - b)\nprint(ans)\n","code_v1_no_empty_lines":"from statistics import median_low\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nD = []\nfor i in range(N):\n D.append(A[i] - (i + 1))\nm = median_low(D)\nans = 0\nfor d in D:\n ans += abs(d - m)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["+from statistics import median_low","+","-# \u4e2d\u592e\u5024","-B = []","+D = []","- B.append(A[i] - (i + 1))","-b = sorted(B)[N \/\/ 2]","+ D.append(A[i] - (i + 1))","+m = median_low(D)","-for i in range(N):","- ans += abs(A[i] - (i + 1) - b)","+for d in D:","+ ans += abs(d - m)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2779975181,"measured_runtime_v1":0.211870023,"runtime_lift":1.3121135029,"key":["s685396762","s566858224"]} +{"user_id":"u893063840","problem_id":"p03801","language":"python","submission_id_v0":"s790222372","submission_id_v1":"s964537161","cpu_time_v0":316,"cpu_time_v1":278,"memory_v0":40396,"memory_v1":31800,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(input())\n\na = list(map(int, input().split()))\n\n\n\ntmp = [[e, n - i] for i, e in enumerate(a)]\n\ntmp.sort(reverse=True)\n\n\n\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\n\n\n\nv_prev, i_prev = aa[0]\n\ni = 0\n\nans = [0] * n\n\nsm = 0\n\nwhile i < n:\n\n while aa[i][1] >= i_prev:\n\n sm += aa[i][0]\n\n i += 1\n\n\n\n ans[i_prev] += sm - aa[i][0] * i\n\n sm = aa[i][0] * i\n\n v_prev, i_prev = aa[i]\n\n\n\nprint(*ans, sep=\"\\n\")\n\n\n# optimized version of the same code:\n","target":"from bisect import bisect_right\n\n\n\nn = int(input())\n\na = list(map(int, input().split()))\n\n\n\nli = [[0, -1]]\n\nfor i, e in enumerate(a):\n\n if e > li[-1][0]:\n\n li.append([e, i])\n\n\n\nli = li[::-1]\n\n\n\na.sort()\n\nacc = [0] * (n + 1)\n\nfor i in range(n - 1, -1, -1):\n\n acc[i] = acc[i+1] + a[i]\n\n\n\nans = [0] * n\n\nsub = 0\n\nans_prev = 0\n\nfor (ep, ip), (e, i) in zip(li, li[1:]):\n\n j = bisect_right(a, e)\n\n ans[ip] = acc[j] - e * (n - j)\n\n\n\ni_prev = 0\n\nfor i in range(1, n):\n\n if ans[i]:\n\n ans[i_prev] -= ans[i]\n\n i_prev = i\n\n\n\nprint(*ans, sep=\"\\n\")\n","code_v0_loc":22,"code_v1_loc":31,"code_v0_num_chars":431,"code_v1_num_chars":571,"code_v0_no_empty_lines":"n = int(input())\na = list(map(int, input().split()))\ntmp = [[e, n - i] for i, e in enumerate(a)]\ntmp.sort(reverse=True)\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\nv_prev, i_prev = aa[0]\ni = 0\nans = [0] * n\nsm = 0\nwhile i < n:\n while aa[i][1] >= i_prev:\n sm += aa[i][0]\n i += 1\n ans[i_prev] += sm - aa[i][0] * i\n sm = aa[i][0] * i\n v_prev, i_prev = aa[i]\nprint(*ans, sep=\"\\n\")\n","code_v1_no_empty_lines":"from bisect import bisect_right\n\nn = int(input())\na = list(map(int, input().split()))\nli = [[0, -1]]\nfor i, e in enumerate(a):\n if e > li[-1][0]:\n li.append([e, i])\nli = li[::-1]\na.sort()\nacc = [0] * (n + 1)\nfor i in range(n - 1, -1, -1):\n acc[i] = acc[i + 1] + a[i]\nans = [0] * n\nsub = 0\nans_prev = 0\nfor (ep, ip), (e, i) in zip(li, li[1:]):\n j = bisect_right(a, e)\n ans[ip] = acc[j] - e * (n - j)\ni_prev = 0\nfor i in range(1, n):\n if ans[i]:\n ans[i_prev] -= ans[i]\n i_prev = i\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":29.0322580645,"diff":["+from bisect import bisect_right","+","-tmp = [[e, n - i] for i, e in enumerate(a)]","-tmp.sort(reverse=True)","-aa = [[e, n - i] for e, i in tmp] + [[0, -1]]","-v_prev, i_prev = aa[0]","-i = 0","+li = [[0, -1]]","+for i, e in enumerate(a):","+ if e > li[-1][0]:","+ li.append([e, i])","+li = li[::-1]","+a.sort()","+acc = [0] * (n + 1)","+for i in range(n - 1, -1, -1):","+ acc[i] = acc[i + 1] + a[i]","-sm = 0","-while i < n:","- while aa[i][1] >= i_prev:","- sm += aa[i][0]","- i += 1","- ans[i_prev] += sm - aa[i][0] * i","- sm = aa[i][0] * i","- v_prev, i_prev = aa[i]","+sub = 0","+ans_prev = 0","+for (ep, ip), (e, i) in zip(li, li[1:]):","+ j = bisect_right(a, e)","+ ans[ip] = acc[j] - e * (n - j)","+i_prev = 0","+for i in range(1, n):","+ if ans[i]:","+ ans[i_prev] -= ans[i]","+ i_prev = i"],"diff_only_import_comment":false,"measured_runtime_v0":0.2510323788,"measured_runtime_v1":0.1409289612,"runtime_lift":1.7812689216,"key":["s790222372","s964537161"]} +{"user_id":"u970197315","problem_id":"p03013","language":"python","submission_id_v0":"s479618893","submission_id_v1":"s899240371","cpu_time_v0":212,"cpu_time_v1":187,"memory_v0":9612,"memory_v1":7848,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, M = list(map(int, input().split()))\n\nA_ = [int(eval(input())) for _ in range(M)]\n\nA = [0] * (N+3)\n\nfor a in A_:\n\n A[a] = 1\n\ndp = [0] * (N+3)\n\ndp[0] = 1\n\n\n\nmod = 10**9+7\n\n\n\nfor i in range(1, N+1):\n\n if A[i-1] == 0:\n\n dp[i] += dp[i-1]\n\n if A[i-2] == 0:\n\n dp[i] += dp[i-2]\n\n dp[i] %= mod\n\nprint((dp[N]))\n\n# optimized version of the same code:\n","target":"n,m=list(map(int,input().split()))\n\ndp=[0]*(n+3)\n\na=[int(eval(input())) for i in range(m)]\n\nmod=10**9+7\n\nfor i in range(m):\n\n dp[a[i]]=-1\n\n\n\ndp[0]=1\n\nif dp[1]!=-1:\n\n dp[1]+=dp[0]\n\n\n\nfor i in range(n+1):\n\n if dp[i+2]==-1:\n\n continue\n\n if dp[i]!=-1:\n\n dp[i+2]+=dp[i]\n\n if dp[i+1]!=-1:\n\n dp[i+2]+=dp[i+1]\n\n dp[i+2]%=mod\n\nprint((dp[n]%mod))","code_v0_loc":17,"code_v1_loc":20,"code_v0_num_chars":315,"code_v1_num_chars":361,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nA_ = [int(eval(input())) for _ in range(M)]\nA = [0] * (N + 3)\nfor a in A_:\n A[a] = 1\ndp = [0] * (N + 3)\ndp[0] = 1\nmod = 10**9 + 7\nfor i in range(1, N + 1):\n if A[i - 1] == 0:\n dp[i] += dp[i - 1]\n if A[i - 2] == 0:\n dp[i] += dp[i - 2]\n dp[i] %= mod\nprint((dp[N]))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\ndp = [0] * (n + 3)\na = [int(eval(input())) for i in range(m)]\nmod = 10**9 + 7\nfor i in range(m):\n dp[a[i]] = -1\ndp[0] = 1\nif dp[1] != -1:\n dp[1] += dp[0]\nfor i in range(n + 1):\n if dp[i + 2] == -1:\n continue\n if dp[i] != -1:\n dp[i + 2] += dp[i]\n if dp[i + 1] != -1:\n dp[i + 2] += dp[i + 1]\n dp[i + 2] %= mod\nprint((dp[n] % mod))\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-N, M = list(map(int, input().split()))","-A_ = [int(eval(input())) for _ in range(M)]","-A = [0] * (N + 3)","-for a in A_:","- A[a] = 1","-dp = [0] * (N + 3)","+n, m = list(map(int, input().split()))","+dp = [0] * (n + 3)","+a = [int(eval(input())) for i in range(m)]","+mod = 10**9 + 7","+for i in range(m):","+ dp[a[i]] = -1","-mod = 10**9 + 7","-for i in range(1, N + 1):","- if A[i - 1] == 0:","- dp[i] += dp[i - 1]","- if A[i - 2] == 0:","- dp[i] += dp[i - 2]","- dp[i] %= mod","-print((dp[N]))","+if dp[1] != -1:","+ dp[1] += dp[0]","+for i in range(n + 1):","+ if dp[i + 2] == -1:","+ continue","+ if dp[i] != -1:","+ dp[i + 2] += dp[i]","+ if dp[i + 1] != -1:","+ dp[i + 2] += dp[i + 1]","+ dp[i + 2] %= mod","+print((dp[n] % mod))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2706730585,"measured_runtime_v1":0.2065423949,"runtime_lift":1.3104963688,"key":["s479618893","s899240371"]} +{"user_id":"u875291233","problem_id":"p02635","language":"python","submission_id_v0":"s814224345","submission_id_v1":"s367618693","cpu_time_v0":2432,"cpu_time_v1":323,"memory_v0":86376,"memory_v1":73692,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.72,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# coding: utf-8\n\n# Your code here!\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\n\n\n#a,b,c,d = map(int,readline().split())\n\ns,k = readline().split()\n\n\n\n\n\na = [len(i) for i in s.split(\"0\")]\n\nwhile a and a[-1] == 0: a.pop()\n\n\n\nif not a:\n\n print((1))\n\n exit()\n\n\n\nMOD = 998244353\n\n\n\nM = sum(a)+1\n\nk = min(int(k),M)\n\n\n\n\n\ndp = [[0]*M for _ in range(k+1)] # j \u4f7f\u3063\u3066\uff08\u4e0a\u9650 k\uff09\u3001l \u4f59\u3063\u3066\u308b\n\ndp[0][0] = 1\n\n\n\n#print(a)\n\nfor ai in a[::-1]:\n\n ndp = [[0]*M for _ in range(k+1)] # j \u4f7f\u3063\u3066\uff08\u4e0a\u9650 k\uff09\u3001l \u4f59\u3063\u3066\u308b\n\n for j in range(k+1):\n\n for l in range(M):\n\n for ll in range(l):\n\n ndp[j][ll] += dp[j][l]\n\n ndp[j][ll] %= MOD\n\n \n\n V = min(M-l,k-j+1,ai+1)\n\n for i in range(V):\n\n #if j+i > k: break\n\n ndp[j+i][l+i] += dp[j][l]\n\n ndp[j+i][l+i] %= MOD\n\n \n\n dp = ndp\n\n #print(dp)\n\n\n\nans = 0\n\nfor jj in range(k+1):\n\n ans += dp[jj][0]\n\n\n\nprint((ans%MOD))\n\n\n\n\n\n\n\n\n\n\n\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\n# Your code here!\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\n\n\n#a,b,c,d = map(int,readline().split())\n\ns,k = readline().split()\n\n\n\n\n\na = [len(i) for i in s.split(\"0\")]\n\nwhile a and a[-1] == 0: a.pop()\n\n\n\nif not a:\n\n print((1))\n\n exit()\n\n\n\nMOD = 998244353\n\n\n\nM = sum(a)+1\n\nk = min(int(k),M)\n\n\n\n\n\ndp = [[0]*M for _ in range(k+1)] # j \u4f7f\u3063\u3066\uff08\u4e0a\u9650 k\uff09\u3001l \u4f59\u3063\u3066\u308b\n\ndp[0][0] = 1\n\n\n\n#print(a)\n\nfor ai in a[::-1]:\n\n ndp = [[0]*M for _ in range(k+1)] # j \u4f7f\u3063\u3066\uff08\u4e0a\u9650 k\uff09\u3001l \u4f59\u3063\u3066\u308b\n\n for j in range(k+1):\n\n for l in range(M):\n\n if dp[j][l]:\n\n for ll in range(l):\n\n ndp[j][ll] += dp[j][l]\n\n ndp[j][ll] %= MOD\n\n\n\n V = min(M-l,k-j+1,ai+1)\n\n for i in range(V):\n\n #if j+i > k: break\n\n ndp[j+i][l+i] += dp[j][l]\n\n ndp[j+i][l+i] %= MOD\n\n \n\n dp = ndp\n\n #print(dp)\n\n\n\nans = 0\n\nfor jj in range(k+1):\n\n ans += dp[jj][0]\n\n\n\nprint((ans%MOD))\n\n\n\n\n\n\n\n\n\n\n","code_v0_loc":54,"code_v1_loc":55,"code_v0_num_chars":983,"code_v1_num_chars":1029,"code_v0_no_empty_lines":"# coding: utf-8\n# Your code here!\nimport sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\n# a,b,c,d = map(int,readline().split())\ns, k = readline().split()\na = [len(i) for i in s.split(\"0\")]\nwhile a and a[-1] == 0:\n a.pop()\nif not a:\n print((1))\n exit()\nMOD = 998244353\nM = sum(a) + 1\nk = min(int(k), M)\ndp = [[0] * M for _ in range(k + 1)] # j \u4f7f\u3063\u3066\uff08\u4e0a\u9650 k\uff09\u3001l \u4f59\u3063\u3066\u308b\ndp[0][0] = 1\n# print(a)\nfor ai in a[::-1]:\n ndp = [[0] * M for _ in range(k + 1)] # j \u4f7f\u3063\u3066\uff08\u4e0a\u9650 k\uff09\u3001l \u4f59\u3063\u3066\u308b\n for j in range(k + 1):\n for l in range(M):\n for ll in range(l):\n ndp[j][ll] += dp[j][l]\n ndp[j][ll] %= MOD\n V = min(M - l, k - j + 1, ai + 1)\n for i in range(V):\n # if j+i > k: break\n ndp[j + i][l + i] += dp[j][l]\n ndp[j + i][l + i] %= MOD\n dp = ndp\n # print(dp)\nans = 0\nfor jj in range(k + 1):\n ans += dp[jj][0]\nprint((ans % MOD))\n","code_v1_no_empty_lines":"# coding: utf-8\n# Your code here!\nimport sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\n# a,b,c,d = map(int,readline().split())\ns, k = readline().split()\na = [len(i) for i in s.split(\"0\")]\nwhile a and a[-1] == 0:\n a.pop()\nif not a:\n print((1))\n exit()\nMOD = 998244353\nM = sum(a) + 1\nk = min(int(k), M)\ndp = [[0] * M for _ in range(k + 1)] # j \u4f7f\u3063\u3066\uff08\u4e0a\u9650 k\uff09\u3001l \u4f59\u3063\u3066\u308b\ndp[0][0] = 1\n# print(a)\nfor ai in a[::-1]:\n ndp = [[0] * M for _ in range(k + 1)] # j \u4f7f\u3063\u3066\uff08\u4e0a\u9650 k\uff09\u3001l \u4f59\u3063\u3066\u308b\n for j in range(k + 1):\n for l in range(M):\n if dp[j][l]:\n for ll in range(l):\n ndp[j][ll] += dp[j][l]\n ndp[j][ll] %= MOD\n V = min(M - l, k - j + 1, ai + 1)\n for i in range(V):\n # if j+i > k: break\n ndp[j + i][l + i] += dp[j][l]\n ndp[j + i][l + i] %= MOD\n dp = ndp\n # print(dp)\nans = 0\nfor jj in range(k + 1):\n ans += dp[jj][0]\nprint((ans % MOD))\n","code_same":false,"relative_loc_diff_percent":1.8181818182,"diff":["- for ll in range(l):","- ndp[j][ll] += dp[j][l]","- ndp[j][ll] %= MOD","- V = min(M - l, k - j + 1, ai + 1)","- for i in range(V):","- # if j+i > k: break","- ndp[j + i][l + i] += dp[j][l]","- ndp[j + i][l + i] %= MOD","+ if dp[j][l]:","+ for ll in range(l):","+ ndp[j][ll] += dp[j][l]","+ ndp[j][ll] %= MOD","+ V = min(M - l, k - j + 1, ai + 1)","+ for i in range(V):","+ # if j+i > k: break","+ ndp[j + i][l + i] += dp[j][l]","+ ndp[j + i][l + i] %= MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.6928678901,"measured_runtime_v1":0.2517437787,"runtime_lift":2.7522741323,"key":["s814224345","s367618693"]} +{"user_id":"u573754721","problem_id":"p02792","language":"python","submission_id_v0":"s001079757","submission_id_v1":"s791261959","cpu_time_v0":461,"cpu_time_v1":326,"memory_v0":40684,"memory_v1":40428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.28,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\nD={}\n\nDD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n t=(str(i)[-1],str(i)[0])\n\n if s not in D:\n\n D[s]=1\n\n else:\n\n D[s]+=1\n\n if t not in DD:\n\n DD[t]=1\n\n else:\n\n DD[t]+=1\n\nans=0\n\nfor i in D:\n\n if i in DD:\n\n ans+=D[i]*DD[i]\n\nprint(ans)\n\n \n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\nD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n if s in D:\n\n D[s]+=1\n\n else:\n\n D[s]=1\n\n\n\nans=0\n\nfor aj,bj in D:\n\n if (bj,aj) in D:\n\n ans+=D[(aj,bj)]*D[(bj,aj)]\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":14,"code_v0_num_chars":307,"code_v1_num_chars":220,"code_v0_no_empty_lines":"n = int(eval(input()))\nD = {}\nDD = {}\nfor i in range(1, n + 1):\n s = (str(i)[0], str(i)[-1])\n t = (str(i)[-1], str(i)[0])\n if s not in D:\n D[s] = 1\n else:\n D[s] += 1\n if t not in DD:\n DD[t] = 1\n else:\n DD[t] += 1\nans = 0\nfor i in D:\n if i in DD:\n ans += D[i] * DD[i]\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nD = {}\nfor i in range(1, n + 1):\n s = (str(i)[0], str(i)[-1])\n if s in D:\n D[s] += 1\n else:\n D[s] = 1\nans = 0\nfor aj, bj in D:\n if (bj, aj) in D:\n ans += D[(aj, bj)] * D[(bj, aj)]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-DD = {}","- t = (str(i)[-1], str(i)[0])","- if s not in D:","+ if s in D:","+ D[s] += 1","+ else:","- else:","- D[s] += 1","- if t not in DD:","- DD[t] = 1","- else:","- DD[t] += 1","-for i in D:","- if i in DD:","- ans += D[i] * DD[i]","+for aj, bj in D:","+ if (bj, aj) in D:","+ ans += D[(aj, bj)] * D[(bj, aj)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.4521915812,"measured_runtime_v1":0.3498246684,"runtime_lift":1.2926234825,"key":["s001079757","s791261959"]} +{"user_id":"u092301301","problem_id":"p03013","language":"python","submission_id_v0":"s709013905","submission_id_v1":"s416556005","cpu_time_v0":482,"cpu_time_v1":235,"memory_v0":56536,"memory_v1":53084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.24,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,m=[int(i) for i in input().split()]\n\ndp=[1,1] ;a=set() ; mod=(10**9+7)\n\nfor i in range(m):\n\n a.add(int(eval(input())))\n\nif 1 in a: dp[1]=0\n\nfor i in range(2,n+1):\n\n if i not in a:\n\n dp.append((dp[-1]+dp[-2])%mod)\n\n else:\n\n dp.append(0)\n\nprint((dp[-1]))\n\n \n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\nn,m=[int(i) for i in input().split()]\n\ndp=[1,1] ;a=set() ; mod=(10**9+7)\n\nfor i in range(m):\n\n a.add(int(eval(input())))\n\nif 1 in a: dp[1]=0\n\nfor i in range(2,n+1):\n\n if i not in a:\n\n dp.append((dp[-1]+dp[-2])%mod)\n\n else:\n\n dp.append(0)\n\nprint((dp[-1]))\n\n \n","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":276,"code_v1_num_chars":335,"code_v0_no_empty_lines":"n, m = [int(i) for i in input().split()]\ndp = [1, 1]\na = set()\nmod = 10**9 + 7\nfor i in range(m):\n a.add(int(eval(input())))\nif 1 in a:\n dp[1] = 0\nfor i in range(2, n + 1):\n if i not in a:\n dp.append((dp[-1] + dp[-2]) % mod)\n else:\n dp.append(0)\nprint((dp[-1]))\n","code_v1_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\nn, m = [int(i) for i in input().split()]\ndp = [1, 1]\na = set()\nmod = 10**9 + 7\nfor i in range(m):\n a.add(int(eval(input())))\nif 1 in a:\n dp[1] = 0\nfor i in range(2, n + 1):\n if i not in a:\n dp.append((dp[-1] + dp[-2]) % mod)\n else:\n dp.append(0)\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+import sys","+","+input = lambda: sys.stdin.readline().rstrip()"],"diff_only_import_comment":false,"measured_runtime_v0":0.1801067755,"measured_runtime_v1":0.0061562738,"runtime_lift":29.2558095784,"key":["s709013905","s416556005"]} +{"user_id":"u546338822","problem_id":"p03013","language":"python","submission_id_v0":"s185507084","submission_id_v1":"s217859496","cpu_time_v0":410,"cpu_time_v1":152,"memory_v0":21760,"memory_v1":12836,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.93,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom functools import lru_cache\n\n\n\ndef main():\n\n n,m = list(map(int,input().split()))\n\n import numpy as np\n\n ans = np.ones(n+1,dtype=int)*-1\n\n ans[0] = 1\n\n mod = 10**9+7\n\n for _ in range(m):\n\n a = int(eval(input()))\n\n ans[a]=0\n\n if ans[1]!=0:\n\n ans[1]=1\n\n for i in range(2,n+1):\n\n if ans[i]!=0:\n\n ans[i] = (ans[i-1]+ans[i-2])%mod\n\n print((ans[-1]))\n\n \n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n# optimized version of the same code:\n","target":"def main():\n\n n,m = list(map(int,input().split()))\n\n dp = [0 for i in range(n+1)]\n\n mod = 10**9+7\n\n for i in range(m):\n\n a = int(eval(input()))\n\n dp[a] = -1\n\n dp[0] = 1\n\n if dp[1]!=-1:\n\n dp[1] = 1\n\n for i in range(2,n+1):\n\n if dp[i]==-1:\n\n continue\n\n if dp[i-1]!=-1 and dp[i-2]!=-1:\n\n dp[i] = dp[i-1] + dp[i-2]\n\n dp[i] = dp[i]%mod\n\n elif dp[i-1]!=-1 and dp[i-2]==-1:\n\n dp[i] = dp[i-1]\n\n elif dp[i-1]==-1 and dp[i-2]!=-1:\n\n dp[i] = dp[i-2]\n\n else:\n\n dp[i] = 0\n\n print((dp[-1]))\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":21,"code_v1_loc":26,"code_v0_num_chars":452,"code_v1_num_chars":651,"code_v0_no_empty_lines":"from functools import lru_cache\n\n\ndef main():\n n, m = list(map(int, input().split()))\n import numpy as np\n\n ans = np.ones(n + 1, dtype=int) * -1\n ans[0] = 1\n mod = 10**9 + 7\n for _ in range(m):\n a = int(eval(input()))\n ans[a] = 0\n if ans[1] != 0:\n ans[1] = 1\n for i in range(2, n + 1):\n if ans[i] != 0:\n ans[i] = (ans[i - 1] + ans[i - 2]) % mod\n print((ans[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n, m = list(map(int, input().split()))\n dp = [0 for i in range(n + 1)]\n mod = 10**9 + 7\n for i in range(m):\n a = int(eval(input()))\n dp[a] = -1\n dp[0] = 1\n if dp[1] != -1:\n dp[1] = 1\n for i in range(2, n + 1):\n if dp[i] == -1:\n continue\n if dp[i - 1] != -1 and dp[i - 2] != -1:\n dp[i] = dp[i - 1] + dp[i - 2]\n dp[i] = dp[i] % mod\n elif dp[i - 1] != -1 and dp[i - 2] == -1:\n dp[i] = dp[i - 1]\n elif dp[i - 1] == -1 and dp[i - 2] != -1:\n dp[i] = dp[i - 2]\n else:\n dp[i] = 0\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":19.2307692308,"diff":["-from functools import lru_cache","-","-","- import numpy as np","-","- ans = np.ones(n + 1, dtype=int) * -1","- ans[0] = 1","+ dp = [0 for i in range(n + 1)]","- for _ in range(m):","+ for i in range(m):","- ans[a] = 0","- if ans[1] != 0:","- ans[1] = 1","+ dp[a] = -1","+ dp[0] = 1","+ if dp[1] != -1:","+ dp[1] = 1","- if ans[i] != 0:","- ans[i] = (ans[i - 1] + ans[i - 2]) % mod","- print((ans[-1]))","+ if dp[i] == -1:","+ continue","+ if dp[i - 1] != -1 and dp[i - 2] != -1:","+ dp[i] = dp[i - 1] + dp[i - 2]","+ dp[i] = dp[i] % mod","+ elif dp[i - 1] != -1 and dp[i - 2] == -1:","+ dp[i] = dp[i - 1]","+ elif dp[i - 1] == -1 and dp[i - 2] != -1:","+ dp[i] = dp[i - 2]","+ else:","+ dp[i] = 0","+ print((dp[-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3205960586,"measured_runtime_v1":0.2082385263,"runtime_lift":6.3417470423,"key":["s185507084","s217859496"]} +{"user_id":"u486297080","problem_id":"p03796","language":"python","submission_id_v0":"s015826115","submission_id_v1":"s256698183","cpu_time_v0":231,"cpu_time_v1":37,"memory_v0":4020,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.98,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\nN = int(eval(input()))\n\nans = 0\n\n\n\nans =math.factorial(N) % (10**9 +7)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\npower = 1\n\n\n\nfor i in range(N):\n\n power = ((i+1) * power) % 1000000007\n\n\n\nprint(power)","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":93,"code_v1_num_chars":107,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nans = 0\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\npower = 1\nfor i in range(N):\n power = ((i + 1) * power) % 1000000007\nprint(power)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import math","-","-ans = 0","-ans = math.factorial(N) % (10**9 + 7)","-print(ans)","+power = 1","+for i in range(N):","+ power = ((i + 1) * power) % 1000000007","+print(power)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5450858786,"measured_runtime_v1":0.2547745125,"runtime_lift":2.1394835503,"key":["s015826115","s256698183"]} +{"user_id":"u023958502","problem_id":"p03078","language":"python","submission_id_v0":"s928848207","submission_id_v1":"s406476908","cpu_time_v0":1927,"cpu_time_v1":827,"memory_v0":4720,"memory_v1":4592,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nX,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nalready = [[0,0,0]]\n\nx,y,z = 0,0,0\n\nplace_sum = []\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n place_sum.append([x + 1,y,z])\n\n check.append(asort[x + 1] + bsort[y] + csort[z])\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n place_sum.append([x,y + 1,z])\n\n check.append(asort[x] + bsort[y + 1] + csort[z])\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n place_sum.append([x,y,z + 1])\n\n check.append(asort[x] + bsort[y] + csort[z + 1])\n\n print((max(check)))\n\n x,y,z = place_sum[check.index(max(check))][0],place_sum[check.index(max(check))][1],place_sum[check.index(max(check))][2]\n\n place_sum.pop(check.index(max(check)))\n\n check.remove(max(check))\n\n# optimized version of the same code:\n","target":"import heapq\n\nX,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nalready = [[0,0,0]]\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nx,y,z = 0,0,0\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n heapq.heappush(check,(-(asort[x + 1] + bsort[y] + csort[z]),x + 1,y,z))\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n heapq.heappush(check,(-(asort[x] + bsort[y + 1] + csort[z]),x,y + 1,z))\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n heapq.heappush(check,(-(asort[x] + bsort[y] + csort[z + 1]),x,y,z + 1))\n\n maxsum = heapq.heappop(check)\n\n print((-maxsum[0]))\n\n x,y,z = maxsum[1],maxsum[2],maxsum[3]","code_v0_loc":27,"code_v1_loc":23,"code_v0_num_chars":1135,"code_v1_num_chars":962,"code_v0_no_empty_lines":"X, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nasort, bsort, csort = (\n sorted(A, reverse=True),\n sorted(B, reverse=True),\n sorted(C, reverse=True),\n)\nprint((asort[0] + bsort[0] + csort[0]))\nalready = [[0, 0, 0]]\nx, y, z = 0, 0, 0\nplace_sum = []\ncheck = []\nfor k in range(K - 1):\n if [x + 1, y, z] not in already and x + 1 < X:\n already.append([x + 1, y, z])\n place_sum.append([x + 1, y, z])\n check.append(asort[x + 1] + bsort[y] + csort[z])\n if [x, y + 1, z] not in already and y + 1 < Y:\n already.append([x, y + 1, z])\n place_sum.append([x, y + 1, z])\n check.append(asort[x] + bsort[y + 1] + csort[z])\n if [x, y, z + 1] not in already and z + 1 < Z:\n already.append([x, y, z + 1])\n place_sum.append([x, y, z + 1])\n check.append(asort[x] + bsort[y] + csort[z + 1])\n print((max(check)))\n x, y, z = (\n place_sum[check.index(max(check))][0],\n place_sum[check.index(max(check))][1],\n place_sum[check.index(max(check))][2],\n )\n place_sum.pop(check.index(max(check)))\n check.remove(max(check))\n","code_v1_no_empty_lines":"import heapq\n\nX, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nasort, bsort, csort = (\n sorted(A, reverse=True),\n sorted(B, reverse=True),\n sorted(C, reverse=True),\n)\nalready = [[0, 0, 0]]\nprint((asort[0] + bsort[0] + csort[0]))\nx, y, z = 0, 0, 0\ncheck = []\nfor k in range(K - 1):\n if [x + 1, y, z] not in already and x + 1 < X:\n already.append([x + 1, y, z])\n heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))\n if [x, y + 1, z] not in already and y + 1 < Y:\n already.append([x, y + 1, z])\n heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))\n if [x, y, z + 1] not in already and z + 1 < Z:\n already.append([x, y, z + 1])\n heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))\n maxsum = heapq.heappop(check)\n print((-maxsum[0]))\n x, y, z = maxsum[1], maxsum[2], maxsum[3]\n","code_same":false,"relative_loc_diff_percent":14.8148148148,"diff":["+import heapq","+","+already = [[0, 0, 0]]","-already = [[0, 0, 0]]","-place_sum = []","- place_sum.append([x + 1, y, z])","- check.append(asort[x + 1] + bsort[y] + csort[z])","+ heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))","- place_sum.append([x, y + 1, z])","- check.append(asort[x] + bsort[y + 1] + csort[z])","+ heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))","- place_sum.append([x, y, z + 1])","- check.append(asort[x] + bsort[y] + csort[z + 1])","- print((max(check)))","- x, y, z = (","- place_sum[check.index(max(check))][0],","- place_sum[check.index(max(check))][1],","- place_sum[check.index(max(check))][2],","- )","- place_sum.pop(check.index(max(check)))","- check.remove(max(check))","+ heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))","+ maxsum = heapq.heappop(check)","+ print((-maxsum[0]))","+ x, y, z = maxsum[1], maxsum[2], maxsum[3]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2974797392,"measured_runtime_v1":0.2210724421,"runtime_lift":1.3456210843,"key":["s928848207","s406476908"]} +{"user_id":"u589913372","problem_id":"p02725","language":"python","submission_id_v0":"s166950001","submission_id_v1":"s469408932","cpu_time_v0":439,"cpu_time_v1":117,"memory_v0":42676,"memory_v1":26420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.35,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nk,n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = np.zeros(n)\n\nfor i in range(0,n-1):\n\n b[i] = a[i+1] -a[i]\n\n \n\nb[n-1] = k - a[n-1] + a[0]\n\nans = k - max(b)\n\nprint((int(ans)))\n\n# optimized version of the same code:\n","target":"k,n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = [0 for i in range(n)]\n\nfor i in range(0,n-1):\n\n b[i] = a[i+1] -a[i]\n\n\n\nb[n-1] = k - a[n-1] + a[0]\n\nans = k - max(b)\n\nprint((int(ans)))","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":219,"code_v1_num_chars":207,"code_v0_no_empty_lines":"import numpy as np\n\nk, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = np.zeros(n)\nfor i in range(0, n - 1):\n b[i] = a[i + 1] - a[i]\nb[n - 1] = k - a[n - 1] + a[0]\nans = k - max(b)\nprint((int(ans)))\n","code_v1_no_empty_lines":"k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = [0 for i in range(n)]\nfor i in range(0, n - 1):\n b[i] = a[i + 1] - a[i]\nb[n - 1] = k - a[n - 1] + a[0]\nans = k - max(b)\nprint((int(ans)))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-import numpy as np","-","-b = np.zeros(n)","+b = [0 for i in range(n)]"],"diff_only_import_comment":false,"measured_runtime_v0":1.4599362758,"measured_runtime_v1":0.2181204931,"runtime_lift":6.6932558928,"key":["s166950001","s469408932"]} +{"user_id":"u652656291","problem_id":"p02996","language":"python","submission_id_v0":"s858472018","submission_id_v1":"s501268558","cpu_time_v0":821,"cpu_time_v1":719,"memory_v0":49964,"memory_v1":33396,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n# \u7de0\u5207\u304c\u65e9\u3044\u3082\u306e\u304b\u3089\u51e6\u7406\n\nN = int(eval(input()))\n\nAB = np.array([[int(x) for x in input().split()] for _ in range(N)])\n\nA = AB[:,0]\n\nB = AB[:,1]\n\nidx = B.argsort()\n\nA = A[idx]\n\nB = B[idx]\n\nnp.cumsum(A, out = A)\n\nbl = (A <= B).all()\n\nanswer = 'Yes' if bl else 'No'\n\nprint(answer)\n\n\n# optimized version of the same code:\n","target":"def main():\n\n N = int(eval(input()))\n\n A = []\n\n for _ in range(N):\n\n a, b = list(map(int, input().split()))\n\n A.append((a, b))\n\n\n\n A = sorted(A, key=lambda x: x[1])\n\n time = 0\n\n for a, b in A:\n\n time += a\n\n if time > b:\n\n return 'No'\n\n\n\n return 'Yes'\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n","code_v0_loc":13,"code_v1_loc":18,"code_v0_num_chars":282,"code_v1_num_chars":348,"code_v0_no_empty_lines":"import numpy as np\n\n# \u7de0\u5207\u304c\u65e9\u3044\u3082\u306e\u304b\u3089\u51e6\u7406\nN = int(eval(input()))\nAB = np.array([[int(x) for x in input().split()] for _ in range(N)])\nA = AB[:, 0]\nB = AB[:, 1]\nidx = B.argsort()\nA = A[idx]\nB = B[idx]\nnp.cumsum(A, out=A)\nbl = (A <= B).all()\nanswer = \"Yes\" if bl else \"No\"\nprint(answer)\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n A = []\n for _ in range(N):\n a, b = list(map(int, input().split()))\n A.append((a, b))\n A = sorted(A, key=lambda x: x[1])\n time = 0\n for a, b in A:\n time += a\n if time > b:\n return \"No\"\n return \"Yes\"\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_same":false,"relative_loc_diff_percent":27.7777777778,"diff":["-import numpy as np","+def main():","+ N = int(eval(input()))","+ A = []","+ for _ in range(N):","+ a, b = list(map(int, input().split()))","+ A.append((a, b))","+ A = sorted(A, key=lambda x: x[1])","+ time = 0","+ for a, b in A:","+ time += a","+ if time > b:","+ return \"No\"","+ return \"Yes\"","-# \u7de0\u5207\u304c\u65e9\u3044\u3082\u306e\u304b\u3089\u51e6\u7406","-N = int(eval(input()))","-AB = np.array([[int(x) for x in input().split()] for _ in range(N)])","-A = AB[:, 0]","-B = AB[:, 1]","-idx = B.argsort()","-A = A[idx]","-B = B[idx]","-np.cumsum(A, out=A)","-bl = (A <= B).all()","-answer = \"Yes\" if bl else \"No\"","-print(answer)","+","+if __name__ == \"__main__\":","+ print((main()))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3914355583,"measured_runtime_v1":0.2070376647,"runtime_lift":6.7206880477,"key":["s858472018","s501268558"]} +{"user_id":"u969190727","problem_id":"p03371","language":"python","submission_id_v0":"s944521020","submission_id_v1":"s713825460","cpu_time_v0":121,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nn=max(x,y)\n\nfor i in range(1,n+1):\n\n ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))\n\nprint(ans)\n\n\n\n\n\n\n# optimized version of the same code:\n","target":"a,b,c,x,y=list(map(int,input().split()))\n\nans1=a*x+b*y\n\nans2=2*c*max(x,y)\n\nans3=2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y))\n\nprint((min(ans1,ans2,ans3)))","code_v0_loc":8,"code_v1_loc":5,"code_v0_num_chars":148,"code_v1_num_chars":144,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nn = max(x, y)\nfor i in range(1, n + 1):\n ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))\nprint(ans)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans1 = a * x + b * y\nans2 = 2 * c * max(x, y)\nans3 = 2 * c * min(x, y) + a * (x - min(x, y)) + b * (y - min(x, y))\nprint((min(ans1, ans2, ans3)))\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-ans = a * x + b * y","-n = max(x, y)","-for i in range(1, n + 1):","- ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))","-print(ans)","+ans1 = a * x + b * y","+ans2 = 2 * c * max(x, y)","+ans3 = 2 * c * min(x, y) + a * (x - min(x, y)) + b * (y - min(x, y))","+print((min(ans1, ans2, ans3)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.247306282,"measured_runtime_v1":0.1774894836,"runtime_lift":1.3933573811,"key":["s944521020","s713825460"]} +{"user_id":"u879870653","problem_id":"p03325","language":"python","submission_id_v0":"s933212033","submission_id_v1":"s130104970","cpu_time_v0":143,"cpu_time_v1":121,"memory_v0":4148,"memory_v1":4148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.38,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nanswer = 0\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nfor i in range(N) :\n\n while A[i] % 2 == 0 :\n\n A[i] = A[i] \/ 2\n\n answer += 1\n\nprint(answer)\n\n\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nL = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor i in range(N) :\n\n flag = 0\n\n while flag == 0 :\n\n if (L[i] % 2) == 0 :\n\n ans += 1\n\n L[i] = L[i]\/\/2\n\n else :\n\n flag = 1\n\nprint(ans)\n","code_v0_loc":9,"code_v1_loc":13,"code_v0_num_chars":176,"code_v1_num_chars":252,"code_v0_no_empty_lines":"answer = 0\nN = int(eval(input()))\nA = list(map(int, input().split()))\nfor i in range(N):\n while A[i] % 2 == 0:\n A[i] = A[i] \/ 2\n answer += 1\nprint(answer)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nL = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n flag = 0\n while flag == 0:\n if (L[i] % 2) == 0:\n ans += 1\n L[i] = L[i] \/\/ 2\n else:\n flag = 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.7692307692,"diff":["-answer = 0","-A = list(map(int, input().split()))","+L = list(map(int, input().split()))","+ans = 0","- while A[i] % 2 == 0:","- A[i] = A[i] \/ 2","- answer += 1","-print(answer)","+ flag = 0","+ while flag == 0:","+ if (L[i] % 2) == 0:","+ ans += 1","+ L[i] = L[i] \/\/ 2","+ else:","+ flag = 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2890260706,"measured_runtime_v1":0.1461268132,"runtime_lift":1.9779126383,"key":["s933212033","s130104970"]} +{"user_id":"u390193191","problem_id":"p02647","language":"python","submission_id_v0":"s850341435","submission_id_v1":"s306393223","cpu_time_v0":1961,"cpu_time_v1":306,"memory_v0":185864,"memory_v1":162940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.4,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nfrom collections import defaultdict, Counter, namedtuple, deque\n\nimport itertools\n\nimport functools\n\nimport bisect\n\nimport heapq\n\nimport math\n\n# from fractions import gcd\n\n\n\nMOD = 10 ** 9 + 7\n\n# MOD = 998244353\n\n# sys.setrecursionlimit(10**8)\n\n\n\nN, k = list(map(int, input().split()))\n\nprev_arr = list(map(int, input().split()))\n\n\n\n# N = k = 200000\n\n# prev_arr = [0]*N\n\n\n\ncount = 0\n\nfor i in range(min(k, 3*int(math.log(N))+5)):\n\n que = []\n\n arr = [0]*N\n\n for j in range(N):\n\n heapq.heappush(que, j+prev_arr[j])\n\n while que[0] < j:\n\n heapq.heappop(que)\n\n arr[j] += len(que)\n\n # print(arr)\n\n\n\n que = []\n\n for j in reversed(list(range(N))):\n\n heapq.heappush(que, -(j-prev_arr[j]))\n\n while -que[0] > j:\n\n heapq.heappop(que)\n\n arr[j] += len(que) - 1\n\n\n\n prev_arr = arr\n\n count += 1\n\n\n\n# print(count)\n\nprint((*prev_arr))\n\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom collections import defaultdict, Counter, namedtuple, deque\n\nimport itertools\n\nimport functools\n\nimport bisect\n\nimport heapq\n\nimport math\n\n# from fractions import gcd\n\n\n\nMOD = 10 ** 9 + 7\n\n# MOD = 998244353\n\n# sys.setrecursionlimit(10**8)\n\n\n\nN, k = list(map(int, input().split()))\n\nprev_arr = list(map(int, input().split()))\n\n\n\ncount = 0\n\nfor i in range(min(k, 3*int(math.log(N))+10)):\n\n arr = [0]*N\n\n for j in range(N):\n\n left = max(0, j-prev_arr[j])\n\n right = min(N-1, j+prev_arr[j])\n\n arr[left] += 1\n\n if right < N-1:\n\n arr[right+1] -= 1\n\n\n\n # print(arr)\n\n for j in range(1, N):\n\n arr[j] += arr[j-1]\n\n\n\n # print(arr)\n\n prev_arr = arr\n\n count += 1\n\n\n\n# print(count)\n\nprint((*prev_arr))\n","code_v0_loc":42,"code_v1_loc":36,"code_v0_num_chars":902,"code_v1_num_chars":763,"code_v0_no_empty_lines":"import sys\nfrom collections import defaultdict, Counter, namedtuple, deque\nimport itertools\nimport functools\nimport bisect\nimport heapq\nimport math\n\n# from fractions import gcd\nMOD = 10**9 + 7\n# MOD = 998244353\n# sys.setrecursionlimit(10**8)\nN, k = list(map(int, input().split()))\nprev_arr = list(map(int, input().split()))\n# N = k = 200000\n# prev_arr = [0]*N\ncount = 0\nfor i in range(min(k, 3 * int(math.log(N)) + 5)):\n que = []\n arr = [0] * N\n for j in range(N):\n heapq.heappush(que, j + prev_arr[j])\n while que[0] < j:\n heapq.heappop(que)\n arr[j] += len(que)\n # print(arr)\n que = []\n for j in reversed(list(range(N))):\n heapq.heappush(que, -(j - prev_arr[j]))\n while -que[0] > j:\n heapq.heappop(que)\n arr[j] += len(que) - 1\n prev_arr = arr\n count += 1\n# print(count)\nprint((*prev_arr))\n","code_v1_no_empty_lines":"import sys\nfrom collections import defaultdict, Counter, namedtuple, deque\nimport itertools\nimport functools\nimport bisect\nimport heapq\nimport math\n\n# from fractions import gcd\nMOD = 10**9 + 7\n# MOD = 998244353\n# sys.setrecursionlimit(10**8)\nN, k = list(map(int, input().split()))\nprev_arr = list(map(int, input().split()))\ncount = 0\nfor i in range(min(k, 3 * int(math.log(N)) + 10)):\n arr = [0] * N\n for j in range(N):\n left = max(0, j - prev_arr[j])\n right = min(N - 1, j + prev_arr[j])\n arr[left] += 1\n if right < N - 1:\n arr[right + 1] -= 1\n # print(arr)\n for j in range(1, N):\n arr[j] += arr[j - 1]\n # print(arr)\n prev_arr = arr\n count += 1\n# print(count)\nprint((*prev_arr))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-# N = k = 200000","-# prev_arr = [0]*N","-for i in range(min(k, 3 * int(math.log(N)) + 5)):","- que = []","+for i in range(min(k, 3 * int(math.log(N)) + 10)):","- heapq.heappush(que, j + prev_arr[j])","- while que[0] < j:","- heapq.heappop(que)","- arr[j] += len(que)","+ left = max(0, j - prev_arr[j])","+ right = min(N - 1, j + prev_arr[j])","+ arr[left] += 1","+ if right < N - 1:","+ arr[right + 1] -= 1","- que = []","- for j in reversed(list(range(N))):","- heapq.heappush(que, -(j - prev_arr[j]))","- while -que[0] > j:","- heapq.heappop(que)","- arr[j] += len(que) - 1","+ for j in range(1, N):","+ arr[j] += arr[j - 1]","+ # print(arr)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1608536727,"measured_runtime_v1":0.1279424147,"runtime_lift":1.2572349291,"key":["s850341435","s306393223"]} +{"user_id":"u619458041","problem_id":"p03034","language":"python","submission_id_v0":"s001695168","submission_id_v1":"s404140535","cpu_time_v0":1002,"cpu_time_v1":783,"memory_v0":17360,"memory_v1":14388,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(eval(input()))\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n for C in range(1, N\/\/2):\n\n n = N \/\/ C\n\n point = 0\n\n used = set([0])\n\n for k in range(1, n):\n\n A = N - 1 - k*C\n\n\n\n if A in used or k*C in used or A == k*C:\n\n break\n\n used.add(A)\n\n used.add(k*C)\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(eval(input()))\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n # C = A - B\n\n for C in range(1, N\/\/2):\n\n n = (N-1) \/\/ C\n\n point = 0\n\n for k in range(1, n):\n\n A = N-1 - k*C\n\n\n\n # Check A and B are positive integer, and S_i is not used twice.\n\n #\n\n # B = A - C and B >= 0, so A must be over C (A > C).\n\n #\n\n # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1\n\n # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than\n\n # or equal kC, the A's value is already used by kC.\n\n if A < C or ((N-1) % C == 0 and A <= k*C):\n\n break\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n","code_v0_loc":28,"code_v1_loc":33,"code_v0_num_chars":563,"code_v1_num_chars":905,"code_v0_no_empty_lines":"import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(eval(input()))\n S = list(map(int, input().split()))\n ans = 0\n for C in range(1, N \/\/ 2):\n n = N \/\/ C\n point = 0\n used = set([0])\n for k in range(1, n):\n A = N - 1 - k * C\n if A in used or k * C in used or A == k * C:\n break\n used.add(A)\n used.add(k * C)\n point += S[A] + S[k * C]\n ans = max(ans, point)\n return ans\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_v1_no_empty_lines":"import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(eval(input()))\n S = list(map(int, input().split()))\n ans = 0\n # C = A - B\n for C in range(1, N \/\/ 2):\n n = (N - 1) \/\/ C\n point = 0\n for k in range(1, n):\n A = N - 1 - k * C\n # Check A and B are positive integer, and S_i is not used twice.\n #\n # B = A - C and B >= 0, so A must be over C (A > C).\n #\n # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1\n # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than\n # or equal kC, the A's value is already used by kC.\n if A < C or ((N - 1) % C == 0 and A <= k * C):\n break\n point += S[A] + S[k * C]\n ans = max(ans, point)\n return ans\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_same":false,"relative_loc_diff_percent":15.1515151515,"diff":["+ # C = A - B","- n = N \/\/ C","+ n = (N - 1) \/\/ C","- used = set([0])","- if A in used or k * C in used or A == k * C:","+ # Check A and B are positive integer, and S_i is not used twice.","+ #","+ # B = A - C and B >= 0, so A must be over C (A > C).","+ #","+ # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1","+ # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than","+ # or equal kC, the A's value is already used by kC.","+ if A < C or ((N - 1) % C == 0 and A <= k * C):","- used.add(A)","- used.add(k * C)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3095349545,"measured_runtime_v1":0.0814658375,"runtime_lift":3.7995675745,"key":["s001695168","s404140535"]} +{"user_id":"u498487134","problem_id":"p03038","language":"python","submission_id_v0":"s547925628","submission_id_v1":"s764313725","cpu_time_v0":649,"cpu_time_v1":471,"memory_v0":68588,"memory_v1":102672,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N,M=MI()\n\n A=LI()\n\n CB=[[0,0]for _ in range(M)]\n\n A.sort()\n\n for i in range(M):\n\n CB[i][1],CB[i][0]=MI()\n\n \n\n CB.sort(reverse=True)\n\n now=0\n\n \n\n for i in range(N):\n\n if CB[now][1]<=0:\n\n now+=1\n\n \n\n if now>=M:\n\n break \n\n \n\n ch=CB[now][0]\n\n if A[i]=c:\n\n heapq.heappush(A,a)\n\n break\n\n else:\n\n heapq.heappush(A,c)\n\n \n\n ans=0\n\n for i in range(N):\n\n a=heapq.heappop(A)\n\n ans+=a\n\n \n\n print(ans)\n\n\n\nmain()\n","code_v0_loc":37,"code_v1_loc":42,"code_v0_num_chars":685,"code_v1_num_chars":804,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, M = MI()\n A = LI()\n CB = [[0, 0] for _ in range(M)]\n A.sort()\n for i in range(M):\n CB[i][1], CB[i][0] = MI()\n CB.sort(reverse=True)\n now = 0\n for i in range(N):\n if CB[now][1] <= 0:\n now += 1\n if now >= M:\n break\n ch = CB[now][0]\n if A[i] < ch:\n A[i] = ch\n CB[now][1] -= 1\n else:\n break\n print((sum(A)))\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, M = MI()\n A = LI()\n B = [0] * M\n C = [0] * M\n for i in range(M):\n B[i], C[i] = MI()\n C, B = list(zip(*sorted(zip(C, B))))\n B = B[::-1]\n C = C[::-1]\n import heapq\n\n heapq.heapify(A)\n for i in range(M):\n b = B[i]\n c = C[i]\n for _ in range(b):\n a = heapq.heappop(A)\n if a >= c:\n heapq.heappush(A, a)\n break\n else:\n heapq.heappush(A, c)\n ans = 0\n for i in range(N):\n a = heapq.heappop(A)\n ans += a\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":11.9047619048,"diff":["- CB = [[0, 0] for _ in range(M)]","- A.sort()","+ B = [0] * M","+ C = [0] * M","- CB[i][1], CB[i][0] = MI()","- CB.sort(reverse=True)","- now = 0","+ B[i], C[i] = MI()","+ C, B = list(zip(*sorted(zip(C, B))))","+ B = B[::-1]","+ C = C[::-1]","+ import heapq","+","+ heapq.heapify(A)","+ for i in range(M):","+ b = B[i]","+ c = C[i]","+ for _ in range(b):","+ a = heapq.heappop(A)","+ if a >= c:","+ heapq.heappush(A, a)","+ break","+ else:","+ heapq.heappush(A, c)","+ ans = 0","- if CB[now][1] <= 0:","- now += 1","- if now >= M:","- break","- ch = CB[now][0]","- if A[i] < ch:","- A[i] = ch","- CB[now][1] -= 1","- else:","- break","- print((sum(A)))","+ a = heapq.heappop(A)","+ ans += a","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2322117374,"measured_runtime_v1":0.1336252203,"runtime_lift":1.7377837571,"key":["s547925628","s764313725"]} +{"user_id":"u396211450","problem_id":"p03828","language":"python","submission_id_v0":"s749493108","submission_id_v1":"s831049300","cpu_time_v0":39,"cpu_time_v1":31,"memory_v0":9360,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.51,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import factorial\n\n\n\nn = int(eval(input()))\n\nf = factorial(n)\n\n\n\nmod = 10 ** 9 + 7\n\n\n\ndef primes(n):\n\n is_prime = [True] * (n + 1)\n\n is_prime[0] = False\n\n is_prime[1] = False\n\n for i in range(2, int(n ** 0.5) + 1):\n\n if not is_prime[i]:\n\n continue\n\n for j in range(i * 2, n + 1, i):\n\n is_prime[j] = False\n\n return [i for i in range(n + 1) if is_prime[i]]\n\n\n\nans = 1\n\nfor p in primes(n):\n\n temp = 1\n\n while f % p == 0:\n\n temp += 1\n\n f \/\/= p\n\n ans = (ans * temp) % mod\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\nm=10**9+7\n\np=[1 for i in range(10000)]\n\np[0]=0\n\np[1]=0\n\nfor i in range(2,n+1):\n\n if p[i]==1:\n\n for j in range(i*i,n+1,i):\n\n p[j]=0\n\nans=1\n\nfor i in range(2,n+1):\n\n if p[i]:\n\n c=0\n\n k=i\n\n while n\/\/k>0:\n\n c=c+(n\/\/k)%m\n\n k=k*i\n\n ans=(ans*((c+1)%m))%m\n\nprint((ans%m))\n\n \n\n \n\n \n\n \n","code_v0_loc":26,"code_v1_loc":23,"code_v0_num_chars":556,"code_v1_num_chars":340,"code_v0_no_empty_lines":"from math import factorial\n\nn = int(eval(input()))\nf = factorial(n)\nmod = 10**9 + 7\n\n\ndef primes(n):\n is_prime = [True] * (n + 1)\n is_prime[0] = False\n is_prime[1] = False\n for i in range(2, int(n**0.5) + 1):\n if not is_prime[i]:\n continue\n for j in range(i * 2, n + 1, i):\n is_prime[j] = False\n return [i for i in range(n + 1) if is_prime[i]]\n\n\nans = 1\nfor p in primes(n):\n temp = 1\n while f % p == 0:\n temp += 1\n f \/\/= p\n ans = (ans * temp) % mod\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nm = 10**9 + 7\np = [1 for i in range(10000)]\np[0] = 0\np[1] = 0\nfor i in range(2, n + 1):\n if p[i] == 1:\n for j in range(i * i, n + 1, i):\n p[j] = 0\nans = 1\nfor i in range(2, n + 1):\n if p[i]:\n c = 0\n k = i\n while n \/\/ k > 0:\n c = c + (n \/\/ k) % m\n k = k * i\n ans = (ans * ((c + 1) % m)) % m\nprint((ans % m))\n","code_same":false,"relative_loc_diff_percent":11.5384615385,"diff":["-from math import factorial","-","-f = factorial(n)","-mod = 10**9 + 7","-","-","-def primes(n):","- is_prime = [True] * (n + 1)","- is_prime[0] = False","- is_prime[1] = False","- for i in range(2, int(n**0.5) + 1):","- if not is_prime[i]:","- continue","- for j in range(i * 2, n + 1, i):","- is_prime[j] = False","- return [i for i in range(n + 1) if is_prime[i]]","-","-","+m = 10**9 + 7","+p = [1 for i in range(10000)]","+p[0] = 0","+p[1] = 0","+for i in range(2, n + 1):","+ if p[i] == 1:","+ for j in range(i * i, n + 1, i):","+ p[j] = 0","-for p in primes(n):","- temp = 1","- while f % p == 0:","- temp += 1","- f \/\/= p","- ans = (ans * temp) % mod","-print(ans)","+for i in range(2, n + 1):","+ if p[i]:","+ c = 0","+ k = i","+ while n \/\/ k > 0:","+ c = c + (n \/\/ k) % m","+ k = k * i","+ ans = (ans * ((c + 1) % m)) % m","+print((ans % m))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2370509479,"measured_runtime_v1":0.0064624088,"runtime_lift":36.6815154487,"key":["s749493108","s831049300"]} +{"user_id":"u116038906","problem_id":"p02690","language":"python","submission_id_v0":"s071046681","submission_id_v1":"s692199747","cpu_time_v0":65,"cpu_time_v1":22,"memory_v0":9388,"memory_v1":9448,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.15,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# \u521d\u671f\u5165\u529b\n\nimport sys\n\nimport math\n\n#input = sys.stdin.readline\n\nX = int(eval(input()))\n\nlimit =10**5\n\na=0\n\nb=0\n\nfor b in range(-1*limit ,limit):\n\n a5 =X+pow(b,5)\n\n if 0 <= a5: \n\n a=math.pow(a5,0.2)\n\n a_int =int(a)\n\n dif =a_int**5 -b**5 -X\n\n if abs(dif)<10**(-5):\n\n break\n\n else:\n\n continue\n\nprint((a_int,b))\n\n# optimized version of the same code:\n","target":"X = int(eval(input()))\n\ny =120\n\na ={i**5 for i in range(-y,y)}\n\nans_a =0\n\nans_b =0\n\nfor b in range(-y,y):\n\n if X +b**5 in a:\n\n #ans_a =int( (X +b**5 +1)**0.2 )\n\n if X +b**5 >0:\n\n ans_a =int( (X +b**5 )**0.2 )\n\n else:\n\n ans_a = -int( abs(X +b**5 )**0.2 )\n\n ans_b =b\n\n break\n\nprint((ans_a,ans_b))\n","code_v0_loc":19,"code_v1_loc":15,"code_v0_num_chars":352,"code_v1_num_chars":347,"code_v0_no_empty_lines":"# \u521d\u671f\u5165\u529b\nimport sys\nimport math\n\n# input = sys.stdin.readline\nX = int(eval(input()))\nlimit = 10**5\na = 0\nb = 0\nfor b in range(-1 * limit, limit):\n a5 = X + pow(b, 5)\n if 0 <= a5:\n a = math.pow(a5, 0.2)\n a_int = int(a)\n dif = a_int**5 - b**5 - X\n if abs(dif) < 10 ** (-5):\n break\n else:\n continue\nprint((a_int, b))\n","code_v1_no_empty_lines":"X = int(eval(input()))\ny = 120\na = {i**5 for i in range(-y, y)}\nans_a = 0\nans_b = 0\nfor b in range(-y, y):\n if X + b**5 in a:\n # ans_a =int( (X +b**5 +1)**0.2 )\n if X + b**5 > 0:\n ans_a = int((X + b**5) ** 0.2)\n else:\n ans_a = -int(abs(X + b**5) ** 0.2)\n ans_b = b\n break\nprint((ans_a, ans_b))\n","code_same":false,"relative_loc_diff_percent":21.0526315789,"diff":["-# \u521d\u671f\u5165\u529b","-import sys","-import math","-","-# input = sys.stdin.readline","-limit = 10**5","-a = 0","-b = 0","-for b in range(-1 * limit, limit):","- a5 = X + pow(b, 5)","- if 0 <= a5:","- a = math.pow(a5, 0.2)","- a_int = int(a)","- dif = a_int**5 - b**5 - X","- if abs(dif) < 10 ** (-5):","- break","- else:","- continue","-print((a_int, b))","+y = 120","+a = {i**5 for i in range(-y, y)}","+ans_a = 0","+ans_b = 0","+for b in range(-y, y):","+ if X + b**5 in a:","+ # ans_a =int( (X +b**5 +1)**0.2 )","+ if X + b**5 > 0:","+ ans_a = int((X + b**5) ** 0.2)","+ else:","+ ans_a = -int(abs(X + b**5) ** 0.2)","+ ans_b = b","+ break","+print((ans_a, ans_b))"],"diff_only_import_comment":false,"measured_runtime_v0":0.6969227076,"measured_runtime_v1":0.2305529813,"runtime_lift":3.022831037,"key":["s071046681","s692199747"]} +{"user_id":"u648212584","problem_id":"p02883","language":"python","submission_id_v0":"s240795971","submission_id_v1":"s404695253","cpu_time_v0":613,"cpu_time_v1":511,"memory_v0":38924,"memory_v1":83684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.buffer.readline\n\nimport numpy as np\n\n\n\ndef main():\n\n N,K = list(map(int,input().split()))\n\n a = list(map(int,input().split()))\n\n f = list(map(int,input().split()))\n\n a.sort()\n\n f.sort(reverse=True)\n\n\n\n if sum(a) <= K:\n\n print((0))\n\n else:\n\n a = np.array(a)\n\n f = np.array(f)\n\n left,right = 0,max(a)*max(f)\n\n while right-left > 1:\n\n mid = (left+right)\/\/2\n\n pra = a-mid\/\/f\n\n pra[pra<0] = 0\n\n if np.sum(pra) > K:\n\n left = mid\n\n else:\n\n right = mid\n\n print(right)\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\ndef main():\n\n N,K = list(map(int,input().split()))\n\n a = list(map(int,input().split()))\n\n f = list(map(int,input().split()))\n\n \n\n a.sort()\n\n f.sort(reverse=True)\n\n \n\n l,r = -1,max(a)*max(f)+1\n\n \n\n while r-l>1:\n\n mid = (r+l)\/\/2\n\n count = 0\n\n for cost,dif in zip(a,f):\n\n if mid >= cost*dif:\n\n continue\n\n rest = cost*dif-mid\n\n count += -(-rest\/\/dif)\n\n if count <= K:\n\n r = mid\n\n else:\n\n l = mid\n\n \n\n print(r)\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":29,"code_v1_loc":30,"code_v0_num_chars":672,"code_v1_num_chars":640,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nimport numpy as np\n\n\ndef main():\n N, K = list(map(int, input().split()))\n a = list(map(int, input().split()))\n f = list(map(int, input().split()))\n a.sort()\n f.sort(reverse=True)\n if sum(a) <= K:\n print((0))\n else:\n a = np.array(a)\n f = np.array(f)\n left, right = 0, max(a) * max(f)\n while right - left > 1:\n mid = (left + right) \/\/ 2\n pra = a - mid \/\/ f\n pra[pra < 0] = 0\n if np.sum(pra) > K:\n left = mid\n else:\n right = mid\n print(right)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\ndef main():\n N, K = list(map(int, input().split()))\n a = list(map(int, input().split()))\n f = list(map(int, input().split()))\n a.sort()\n f.sort(reverse=True)\n l, r = -1, max(a) * max(f) + 1\n while r - l > 1:\n mid = (r + l) \/\/ 2\n count = 0\n for cost, dif in zip(a, f):\n if mid >= cost * dif:\n continue\n rest = cost * dif - mid\n count += -(-rest \/\/ dif)\n if count <= K:\n r = mid\n else:\n l = mid\n print(r)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.3333333333,"diff":["-import numpy as np","- if sum(a) <= K:","- print((0))","- else:","- a = np.array(a)","- f = np.array(f)","- left, right = 0, max(a) * max(f)","- while right - left > 1:","- mid = (left + right) \/\/ 2","- pra = a - mid \/\/ f","- pra[pra < 0] = 0","- if np.sum(pra) > K:","- left = mid","- else:","- right = mid","- print(right)","+ l, r = -1, max(a) * max(f) + 1","+ while r - l > 1:","+ mid = (r + l) \/\/ 2","+ count = 0","+ for cost, dif in zip(a, f):","+ if mid >= cost * dif:","+ continue","+ rest = cost * dif - mid","+ count += -(-rest \/\/ dif)","+ if count <= K:","+ r = mid","+ else:","+ l = mid","+ print(r)"],"diff_only_import_comment":false,"measured_runtime_v0":1.4018948729,"measured_runtime_v1":0.2158444211,"runtime_lift":6.4949321617,"key":["s240795971","s404695253"]} +{"user_id":"u670180528","problem_id":"p02937","language":"python","submission_id_v0":"s126195271","submission_id_v1":"s641311638","cpu_time_v0":161,"cpu_time_v1":122,"memory_v0":12200,"memory_v1":12072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import defaultdict\n\nfrom bisect import bisect_left\n\n\n\ns = eval(input())\n\nn = len(s)\n\ns = s + s\n\nt = eval(input())\n\nif set(t) - set(s):\n\n\tprint((-1))\n\n\texit()\n\nd = defaultdict(list)\n\nfor i in range(2 * n):\n\n\td[s[i]] += [i]\n\ncur = tot = 0\n\nfor c in t:\n\n\tx = d[c][bisect_left(d[c], cur)]\n\n\tif x < n:\n\n\t\tcur = x + 1\n\n\telse:\n\n\t\tcur = x - n + 1\n\n\t\ttot += n\n\ntot += cur\n\nprint(tot)\n\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\nfrom bisect import bisect_left\n\n\n\n\n\ndef main():\n\n\ts = eval(input())\n\n\tn = len(s)\n\n\ts = s + s\n\n\tt = eval(input())\n\n\tif set(t) - set(s):\n\n\t\tprint((-1))\n\n\t\texit()\n\n\td = defaultdict(list)\n\n\tfor i in range(2 * n):\n\n\t\td[s[i]] += [i]\n\n\tcur = ncnt = 0\n\n\n\n\tfor c in t:\n\n\t\tx = d[c][bisect_left(d[c], cur)]\n\n\t\tif x < n:\n\n\t\t\tcur = x + 1\n\n\t\telse:\n\n\t\t\tcur = x - n + 1\n\n\t\t\tncnt += 1\n\n\tprint((ncnt*n + cur))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()","code_v0_loc":23,"code_v1_loc":29,"code_v0_num_chars":378,"code_v1_num_chars":453,"code_v0_no_empty_lines":"from collections import defaultdict\nfrom bisect import bisect_left\n\ns = eval(input())\nn = len(s)\ns = s + s\nt = eval(input())\nif set(t) - set(s):\n print((-1))\n exit()\nd = defaultdict(list)\nfor i in range(2 * n):\n d[s[i]] += [i]\ncur = tot = 0\nfor c in t:\n x = d[c][bisect_left(d[c], cur)]\n if x < n:\n cur = x + 1\n else:\n cur = x - n + 1\n tot += n\ntot += cur\nprint(tot)\n","code_v1_no_empty_lines":"from collections import defaultdict\nfrom bisect import bisect_left\n\n\ndef main():\n s = eval(input())\n n = len(s)\n s = s + s\n t = eval(input())\n if set(t) - set(s):\n print((-1))\n exit()\n d = defaultdict(list)\n for i in range(2 * n):\n d[s[i]] += [i]\n cur = ncnt = 0\n for c in t:\n x = d[c][bisect_left(d[c], cur)]\n if x < n:\n cur = x + 1\n else:\n cur = x - n + 1\n ncnt += 1\n print((ncnt * n + cur))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":20.6896551724,"diff":["-s = eval(input())","-n = len(s)","-s = s + s","-t = eval(input())","-if set(t) - set(s):","- print((-1))","- exit()","-d = defaultdict(list)","-for i in range(2 * n):","- d[s[i]] += [i]","-cur = tot = 0","-for c in t:","- x = d[c][bisect_left(d[c], cur)]","- if x < n:","- cur = x + 1","- else:","- cur = x - n + 1","- tot += n","-tot += cur","-print(tot)","+","+def main():","+ s = eval(input())","+ n = len(s)","+ s = s + s","+ t = eval(input())","+ if set(t) - set(s):","+ print((-1))","+ exit()","+ d = defaultdict(list)","+ for i in range(2 * n):","+ d[s[i]] += [i]","+ cur = ncnt = 0","+ for c in t:","+ x = d[c][bisect_left(d[c], cur)]","+ if x < n:","+ cur = x + 1","+ else:","+ cur = x - n + 1","+ ncnt += 1","+ print((ncnt * n + cur))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2683695219,"measured_runtime_v1":0.0063027716,"runtime_lift":42.5796046267,"key":["s126195271","s641311638"]} +{"user_id":"u631277801","problem_id":"p02996","language":"python","submission_id_v0":"s825135097","submission_id_v1":"s901008925","cpu_time_v0":649,"cpu_time_v1":495,"memory_v0":54192,"memory_v1":31936,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\nab = [list(li()) for _ in range(n)]\n\n\n\nab.sort(key=lambda x: x[1])\n\n\n\ncur = 0\n\n\n\nans = True\n\n\n\nfor ai, bi in ab:\n\n cur += ai\n\n if cur > bi:\n\n ans = False\n\n\n\nprint((\"Yes\" if ans else \"No\"))\n\n# optimized version of the same code:\n","target":"import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\nab = [tuple(li()) for _ in range(n)]\n\n\n\nab.sort(key=lambda x: x[1])\n\ncur = 0\n\nok = True\n\n\n\nfor ai, bi in ab:\n\n cur += ai\n\n if cur > bi:\n\n ok = False\n\n break\n\n\n\nprint((\"Yes\" if ok else \"No\"))\n","code_v0_loc":29,"code_v1_loc":28,"code_v0_num_chars":655,"code_v1_num_chars":665,"code_v0_no_empty_lines":"import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nab = [list(li()) for _ in range(n)]\nab.sort(key=lambda x: x[1])\ncur = 0\nans = True\nfor ai, bi in ab:\n cur += ai\n if cur > bi:\n ans = False\nprint((\"Yes\" if ans else \"No\"))\n","code_v1_no_empty_lines":"import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nab = [tuple(li()) for _ in range(n)]\nab.sort(key=lambda x: x[1])\ncur = 0\nok = True\nfor ai, bi in ab:\n cur += ai\n if cur > bi:\n ok = False\n break\nprint((\"Yes\" if ok else \"No\"))\n","code_same":false,"relative_loc_diff_percent":3.4482758621,"diff":["-ab = [list(li()) for _ in range(n)]","+ab = [tuple(li()) for _ in range(n)]","-ans = True","+ok = True","- ans = False","-print((\"Yes\" if ans else \"No\"))","+ ok = False","+ break","+print((\"Yes\" if ok else \"No\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2910801413,"measured_runtime_v1":0.1842719517,"runtime_lift":1.5796226102,"key":["s825135097","s901008925"]} +{"user_id":"u728498511","problem_id":"p03416","language":"python","submission_id_v0":"s773095214","submission_id_v1":"s841162290","cpu_time_v0":111,"cpu_time_v1":67,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, m = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n, m+1):\n\n if str(i)[0]+str(i)[1] == str(i)[-1]+str(i)[-2]: ans += 1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"a, b = list(map(int, input().split()))\n\nans = 0\n\nfor n in range(a, b+1):\n\n if str(n) == str(n)[::-1]: ans += 1\n\nprint(ans)","code_v0_loc":5,"code_v1_loc":5,"code_v0_num_chars":141,"code_v1_num_chars":119,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nans = 0\nfor i in range(n, m + 1):\n if str(i)[0] + str(i)[1] == str(i)[-1] + str(i)[-2]:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nans = 0\nfor n in range(a, b + 1):\n if str(n) == str(n)[::-1]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-n, m = list(map(int, input().split()))","+a, b = list(map(int, input().split()))","-for i in range(n, m + 1):","- if str(i)[0] + str(i)[1] == str(i)[-1] + str(i)[-2]:","+for n in range(a, b + 1):","+ if str(n) == str(n)[::-1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.6137721554,"measured_runtime_v1":0.3378130706,"runtime_lift":1.8168987785,"key":["s773095214","s841162290"]} +{"user_id":"u498511622","problem_id":"p00001","language":"python","submission_id_v0":"s534000808","submission_id_v1":"s891056906","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7536,"memory_v1":7656,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nans=[]\n\nfor i in range (0,10):\n\n ans.append(int(eval(input())))\n\nans.sort(reverse=True)\n\nfor i in range (0,3):\n\n print((ans[i]))\n\n# optimized version of the same code:\n","target":"mountain=[]\n\nfor s in range(0,10):\n\n mountain.append(int(eval(input())))\n\nmountain.sort(reverse=True)\n\nfor s in range(0,3):\n\n print((mountain[s]))","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":126,"code_v1_num_chars":141,"code_v0_no_empty_lines":"ans = []\nfor i in range(0, 10):\n ans.append(int(eval(input())))\nans.sort(reverse=True)\nfor i in range(0, 3):\n print((ans[i]))\n","code_v1_no_empty_lines":"mountain = []\nfor s in range(0, 10):\n mountain.append(int(eval(input())))\nmountain.sort(reverse=True)\nfor s in range(0, 3):\n print((mountain[s]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-ans = []","-for i in range(0, 10):","- ans.append(int(eval(input())))","-ans.sort(reverse=True)","-for i in range(0, 3):","- print((ans[i]))","+mountain = []","+for s in range(0, 10):","+ mountain.append(int(eval(input())))","+mountain.sort(reverse=True)","+for s in range(0, 3):","+ print((mountain[s]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3030959003,"measured_runtime_v1":0.0643225815,"runtime_lift":4.7121227575,"key":["s534000808","s891056906"]} +{"user_id":"u609061751","problem_id":"p03273","language":"python","submission_id_v0":"s992799348","submission_id_v1":"s715280512","cpu_time_v0":181,"cpu_time_v1":21,"memory_v0":13552,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.4,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nH, W = [int(x) for x in input().split()]\n\na = []\n\nfor _ in range(H):\n\n a.append(list(input().rstrip()))\n\nimport numpy as np\n\na = np.array(a, np.object)\n\na = a.T\n\nretsu = []\n\ngyou = []\n\nfor i in range(W):\n\n if \"#\" not in a[i]:\n\n retsu.append(i)\n\na = a.T\n\nfor i in range(H):\n\n if \"#\" not in a[i]:\n\n gyou.append(i)\n\na = np.delete(a, retsu, 1)\n\na = np.delete(a, gyou, 0)\n\nfor j in a:\n\n j = list(j)\n\n print((\"\".join(j)))\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nh, w = [int(x) for x in input().split()]\n\na = []\n\nfor _ in range(h):\n\n b = list(input().rstrip())\n\n if '#' in b:\n\n a.append(b)\n\nh = len(a)\n\nc = [1]*w\n\nfor i in range(w):\n\n flag = 1\n\n for j in range(h):\n\n if a[j][i] == \"#\":\n\n flag = 0\n\n break\n\n if flag:\n\n c[i] = 0\n\nans = []\n\nfor i in range(h):\n\n res = []\n\n for j in range(w):\n\n if c[j]:\n\n res.append(a[i][j])\n\n ans.append(\"\".join(res))\n\nfor i in ans:\n\n print(i)\n\n\n","code_v0_loc":23,"code_v1_loc":29,"code_v0_num_chars":482,"code_v1_num_chars":544,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nH, W = [int(x) for x in input().split()]\na = []\nfor _ in range(H):\n a.append(list(input().rstrip()))\nimport numpy as np\n\na = np.array(a, np.object)\na = a.T\nretsu = []\ngyou = []\nfor i in range(W):\n if \"#\" not in a[i]:\n retsu.append(i)\na = a.T\nfor i in range(H):\n if \"#\" not in a[i]:\n gyou.append(i)\na = np.delete(a, retsu, 1)\na = np.delete(a, gyou, 0)\nfor j in a:\n j = list(j)\n print((\"\".join(j)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nh, w = [int(x) for x in input().split()]\na = []\nfor _ in range(h):\n b = list(input().rstrip())\n if \"#\" in b:\n a.append(b)\nh = len(a)\nc = [1] * w\nfor i in range(w):\n flag = 1\n for j in range(h):\n if a[j][i] == \"#\":\n flag = 0\n break\n if flag:\n c[i] = 0\nans = []\nfor i in range(h):\n res = []\n for j in range(w):\n if c[j]:\n res.append(a[i][j])\n ans.append(\"\".join(res))\nfor i in ans:\n print(i)\n","code_same":false,"relative_loc_diff_percent":20.6896551724,"diff":["-H, W = [int(x) for x in input().split()]","+h, w = [int(x) for x in input().split()]","-for _ in range(H):","- a.append(list(input().rstrip()))","-import numpy as np","-","-a = np.array(a, np.object)","-a = a.T","-retsu = []","-gyou = []","-for i in range(W):","- if \"#\" not in a[i]:","- retsu.append(i)","-a = a.T","-for i in range(H):","- if \"#\" not in a[i]:","- gyou.append(i)","-a = np.delete(a, retsu, 1)","-a = np.delete(a, gyou, 0)","-for j in a:","- j = list(j)","- print((\"\".join(j)))","+for _ in range(h):","+ b = list(input().rstrip())","+ if \"#\" in b:","+ a.append(b)","+h = len(a)","+c = [1] * w","+for i in range(w):","+ flag = 1","+ for j in range(h):","+ if a[j][i] == \"#\":","+ flag = 0","+ break","+ if flag:","+ c[i] = 0","+ans = []","+for i in range(h):","+ res = []","+ for j in range(w):","+ if c[j]:","+ res.append(a[i][j])","+ ans.append(\"\".join(res))","+for i in ans:","+ print(i)"],"diff_only_import_comment":false,"measured_runtime_v0":1.198312089,"measured_runtime_v1":0.1897079278,"runtime_lift":6.316615773,"key":["s992799348","s715280512"]} +{"user_id":"u530383736","problem_id":"p02555","language":"python","submission_id_v0":"s720124366","submission_id_v1":"s340965185","cpu_time_v0":275,"cpu_time_v1":33,"memory_v0":9116,"memory_v1":9000,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n cnt = 0\n\n\n\n for j in range(3, i+1):\n\n cnt += dp[i-j]\n\n cnt %= mod\n\n \n\n dp[i] = cnt\n\n\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n dp[i] = dp[i-3] + dp[i-1]\n\n dp[i] %= mod\n\n \n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":26,"code_v1_loc":21,"code_v0_num_chars":381,"code_v1_num_chars":307,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n\ndef main():\n S = int(sys.stdin.readline())\n dp = [0] * (S + 1)\n dp[0] = 1\n mod = 10**9 + 7\n for i in range(3, S + 1):\n cnt = 0\n for j in range(3, i + 1):\n cnt += dp[i - j]\n cnt %= mod\n dp[i] = cnt\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n\ndef main():\n S = int(sys.stdin.readline())\n dp = [0] * (S + 1)\n dp[0] = 1\n mod = 10**9 + 7\n for i in range(3, S + 1):\n dp[i] = dp[i - 3] + dp[i - 1]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":19.2307692308,"diff":["- cnt = 0","- for j in range(3, i + 1):","- cnt += dp[i - j]","- cnt %= mod","- dp[i] = cnt","+ dp[i] = dp[i - 3] + dp[i - 1]","+ dp[i] %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.4620170944,"measured_runtime_v1":0.1881556332,"runtime_lift":2.4555049799,"key":["s720124366","s340965185"]} +{"user_id":"u102461423","problem_id":"p03363","language":"python","submission_id_v0":"s190694143","submission_id_v1":"s770093154","cpu_time_v0":295,"cpu_time_v1":188,"memory_v0":39356,"memory_v1":41444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nA = np.array(input().split(), dtype = np.int64)\n\n\n\nc = Counter(A.cumsum())\n\nc[0] += 1\n\nanswer = sum(x*(x-1)\/\/2 for x in list(c.values()))\n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nimport itertools\n\nfrom collections import defaultdict\n\n\n\nN,*A = list(map(int,read().split()))\n\n\n\nAcum = [0] + list(itertools.accumulate(A))\n\n\n\ncounter = defaultdict(int)\n\nanswer = 0\n\nfor x in Acum:\n\n answer += counter[x]\n\n counter[x] += 1\n\n\n\nprint(answer)","code_v0_loc":10,"code_v1_loc":19,"code_v0_num_chars":219,"code_v1_num_chars":377,"code_v0_no_empty_lines":"from collections import Counter\nimport numpy as np\n\nN = int(eval(input()))\nA = np.array(input().split(), dtype=np.int64)\nc = Counter(A.cumsum())\nc[0] += 1\nanswer = sum(x * (x - 1) \/\/ 2 for x in list(c.values()))\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport itertools\nfrom collections import defaultdict\n\nN, *A = list(map(int, read().split()))\nAcum = [0] + list(itertools.accumulate(A))\ncounter = defaultdict(int)\nanswer = 0\nfor x in Acum:\n answer += counter[x]\n counter[x] += 1\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":47.3684210526,"diff":["-from collections import Counter","-import numpy as np","+import sys","-N = int(eval(input()))","-A = np.array(input().split(), dtype=np.int64)","-c = Counter(A.cumsum())","-c[0] += 1","-answer = sum(x * (x - 1) \/\/ 2 for x in list(c.values()))","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+import itertools","+from collections import defaultdict","+","+N, *A = list(map(int, read().split()))","+Acum = [0] + list(itertools.accumulate(A))","+counter = defaultdict(int)","+answer = 0","+for x in Acum:","+ answer += counter[x]","+ counter[x] += 1"],"diff_only_import_comment":false,"measured_runtime_v0":1.3316387413,"measured_runtime_v1":0.2116157196,"runtime_lift":6.2927212779,"key":["s190694143","s770093154"]} +{"user_id":"u903005414","problem_id":"p02731","language":"python","submission_id_v0":"s953070867","submission_id_v1":"s699633695","cpu_time_v0":299,"cpu_time_v1":152,"memory_v0":21532,"memory_v1":12420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nL = np.array(int(eval(input())), dtype='float128')\n\nans = (L \/ 3)**3\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"import numpy as np\n\nL = int(eval(input()))\n\nans = (L \/ 3)**3\n\nprint(ans)\n","code_v0_loc":4,"code_v1_loc":4,"code_v0_num_chars":95,"code_v1_num_chars":67,"code_v0_no_empty_lines":"import numpy as np\n\nL = np.array(int(eval(input())), dtype=\"float128\")\nans = (L \/ 3) ** 3\nprint(ans)\n","code_v1_no_empty_lines":"import numpy as np\n\nL = int(eval(input()))\nans = (L \/ 3) ** 3\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-L = np.array(int(eval(input())), dtype=\"float128\")","+L = int(eval(input()))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3999788343,"measured_runtime_v1":0.259592965,"runtime_lift":5.3929767875,"key":["s953070867","s699633695"]} +{"user_id":"u678167152","problem_id":"p02785","language":"python","submission_id_v0":"s271865493","submission_id_v1":"s007549888","cpu_time_v0":145,"cpu_time_v1":112,"memory_v0":104796,"memory_v1":31552,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.76,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n if K>=N:\n\n return 0\n\n H.sort()\n\n ans = sum(H[:N-K])\n\n return ans\n\nprint((solve()))\n\n# optimized version of the same code:\n","target":"def solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n H.sort()\n\n ans = sum(H[:max(N-K,0)])\n\n return ans\n\nprint((solve()))","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":177,"code_v1_num_chars":158,"code_v0_no_empty_lines":"def solve():\n N, K = list(map(int, input().split()))\n H = list(map(int, input().split()))\n if K >= N:\n return 0\n H.sort()\n ans = sum(H[: N - K])\n return ans\n\n\nprint((solve()))\n","code_v1_no_empty_lines":"def solve():\n N, K = list(map(int, input().split()))\n H = list(map(int, input().split()))\n H.sort()\n ans = sum(H[: max(N - K, 0)])\n return ans\n\n\nprint((solve()))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["- if K >= N:","- return 0","- ans = sum(H[: N - K])","+ ans = sum(H[: max(N - K, 0)])"],"diff_only_import_comment":false,"measured_runtime_v0":0.1896718335,"measured_runtime_v1":0.0060620093,"runtime_lift":31.2886079077,"key":["s271865493","s007549888"]} +{"user_id":"u583507988","problem_id":"p03835","language":"python","submission_id_v0":"s254920914","submission_id_v1":"s788748142","cpu_time_v0":1001,"cpu_time_v1":785,"memory_v0":9104,"memory_v1":9072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.58,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk, s = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n if 0<=s-x-y<=k:\n\n ans += 1\n\n \n\nprint(ans)\n\n# optimized version of the same code:\n","target":"k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n num=s-i\n\n for j in range(min(num+1,k+1)):\n\n if 0<=num-j<=k:\n\n ans+=1\n\nprint(ans)","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":146,"code_v1_num_chars":150,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\nans = 0\nfor x in range(k + 1):\n for y in range(k + 1):\n if 0 <= s - x - y <= k:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n num = s - i\n for j in range(min(num + 1, k + 1)):\n if 0 <= num - j <= k:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-for x in range(k + 1):","- for y in range(k + 1):","- if 0 <= s - x - y <= k:","+for i in range(k + 1):","+ num = s - i","+ for j in range(min(num + 1, k + 1)):","+ if 0 <= num - j <= k:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2276177601,"measured_runtime_v1":0.0063076721,"runtime_lift":36.0858579862,"key":["s254920914","s788748142"]} +{"user_id":"u528470578","problem_id":"p03680","language":"python","submission_id_v0":"s142356798","submission_id_v1":"s532531190","cpu_time_v0":547,"cpu_time_v1":248,"memory_v0":7084,"memory_v1":7084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.66,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\nN = int(eval(input()))\n\na = [int(eval(input())) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(1e6):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nN = int(eval(input()))\n\na = [int(eval(input())) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(2e5):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":280,"code_v1_num_chars":280,"code_v0_no_empty_lines":"import sys\n\nN = int(eval(input()))\na = [int(eval(input())) for _ in range(N)]\nl = 1\np = a[0] - 1\nif a[0] == 2:\n print(l)\n sys.exit()\nwhile l < int(1e6):\n l += 1\n if a[p] == 2:\n print(l)\n break\n else:\n p = a[p] - 1\nelse:\n print((-1))\n","code_v1_no_empty_lines":"import sys\n\nN = int(eval(input()))\na = [int(eval(input())) for _ in range(N)]\nl = 1\np = a[0] - 1\nif a[0] == 2:\n print(l)\n sys.exit()\nwhile l < int(2e5):\n l += 1\n if a[p] == 2:\n print(l)\n break\n else:\n p = a[p] - 1\nelse:\n print((-1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-while l < int(1e6):","+while l < int(2e5):"],"diff_only_import_comment":false,"measured_runtime_v0":1.1321929171,"measured_runtime_v1":0.4105077217,"runtime_lift":2.7580307442,"key":["s142356798","s532531190"]} +{"user_id":"u285891772","problem_id":"p02760","language":"python","submission_id_v0":"s467740941","submission_id_v1":"s972156170","cpu_time_v0":157,"cpu_time_v1":38,"memory_v0":13684,"memory_v1":5204,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.8,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import accumulate, permutations, combinations, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\nimport numpy as np\n\n\n\nA1 = LIST()\n\nA2 = LIST()\n\nA3 = LIST()\n\nN = INT()\n\nB = np.ones(N)\n\nfor i in range(N):\n\n B[i] = INT()\n\n \n\nB = list(B)\n\n\n\ndef bingo_array(A, B):\n\n for i in range(3):\n\n for x in B:\n\n if A[i] == x:\n\n A[i] *= 0\n\n \n\nbingo_array(A1, B)\n\nbingo_array(A2, B)\n\nbingo_array(A3, B)\n\n\n\nif sum(A1) == 0 or sum(A2) == 0 or sum(A3) == 0:\n\n print(\"Yes\")\n\nelif A1[0]+A2[0]+A3[0] == 0 or A1[1]+A2[1]+A3[1] == 0 or A1[2]+A2[2]+A3[2] == 0:\n\n print(\"Yes\")\n\nelif A1[0]+A2[1]+A3[2] == 0 or A1[2]+A2[1]+A3[0] == 0:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n# optimized version of the same code:\n","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import accumulate, permutations, combinations, product\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nA = [LIST() for _ in range(3)]\n\nN = INT()\n\nb = [INT() for _ in range(N)]\n\n\n\ncheck = [[0]*3 for _ in range(3)]\n\n\n\nfor n in b:\n\n for i in range(3):\n\n for j in range(3):\n\n if A[i][j] == n:\n\n check[i][j] = 1\n\n\n\nfor i in range(3):\n\n if sum(check[i]) == 3:\n\n print(\"Yes\")\n\n exit()\n\n\n\nfor i in range(3):\n\n if check[0][i] and check[1][i] and check[2][i]:\n\n print(\"Yes\")\n\n exit()\n\n \n\nif check[0][0] and check[1][1] and check[2][2]:\n\n print(\"Yes\")\n\n exit()\n\n \n\nif check[0][2] and check[1][1] and check[2][0]:\n\n print(\"Yes\")\n\n exit()\n\n \n\nprint(\"No\")","code_v0_loc":49,"code_v1_loc":50,"code_v0_num_chars":1354,"code_v1_num_chars":1299,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import accumulate, permutations, combinations, product, groupby\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nimport numpy as np\n\nA1 = LIST()\nA2 = LIST()\nA3 = LIST()\nN = INT()\nB = np.ones(N)\nfor i in range(N):\n B[i] = INT()\nB = list(B)\n\n\ndef bingo_array(A, B):\n for i in range(3):\n for x in B:\n if A[i] == x:\n A[i] *= 0\n\n\nbingo_array(A1, B)\nbingo_array(A2, B)\nbingo_array(A3, B)\nif sum(A1) == 0 or sum(A2) == 0 or sum(A3) == 0:\n print(\"Yes\")\nelif (\n A1[0] + A2[0] + A3[0] == 0\n or A1[1] + A2[1] + A3[1] == 0\n or A1[2] + A2[2] + A3[2] == 0\n):\n print(\"Yes\")\nelif A1[0] + A2[1] + A3[2] == 0 or A1[2] + A2[1] + A3[0] == 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import accumulate, permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nA = [LIST() for _ in range(3)]\nN = INT()\nb = [INT() for _ in range(N)]\ncheck = [[0] * 3 for _ in range(3)]\nfor n in b:\n for i in range(3):\n for j in range(3):\n if A[i][j] == n:\n check[i][j] = 1\nfor i in range(3):\n if sum(check[i]) == 3:\n print(\"Yes\")\n exit()\nfor i in range(3):\n if check[0][i] and check[1][i] and check[2][i]:\n print(\"Yes\")\n exit()\nif check[0][0] and check[1][1] and check[2][2]:\n print(\"Yes\")\n exit()\nif check[0][2] and check[1][1] and check[2][0]:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_same":false,"relative_loc_diff_percent":2.0,"diff":["-from itertools import accumulate, permutations, combinations, product, groupby","+from itertools import accumulate, permutations, combinations, product","-def ZIP(n):","- return list(zip(*(MAP() for _ in range(n))))","-","-","-import numpy as np","-","-A1 = LIST()","-A2 = LIST()","-A3 = LIST()","+A = [LIST() for _ in range(3)]","-B = np.ones(N)","-for i in range(N):","- B[i] = INT()","-B = list(B)","-","-","-def bingo_array(A, B):","+b = [INT() for _ in range(N)]","+check = [[0] * 3 for _ in range(3)]","+for n in b:","- for x in B:","- if A[i] == x:","- A[i] *= 0","-","-","-bingo_array(A1, B)","-bingo_array(A2, B)","-bingo_array(A3, B)","-if sum(A1) == 0 or sum(A2) == 0 or sum(A3) == 0:","+ for j in range(3):","+ if A[i][j] == n:","+ check[i][j] = 1","+for i in range(3):","+ if sum(check[i]) == 3:","+ print(\"Yes\")","+ exit()","+for i in range(3):","+ if check[0][i] and check[1][i] and check[2][i]:","+ print(\"Yes\")","+ exit()","+if check[0][0] and check[1][1] and check[2][2]:","-elif (","- A1[0] + A2[0] + A3[0] == 0","- or A1[1] + A2[1] + A3[1] == 0","- or A1[2] + A2[2] + A3[2] == 0","-):","+ exit()","+if check[0][2] and check[1][1] and check[2][0]:","-elif A1[0] + A2[1] + A3[2] == 0 or A1[2] + A2[1] + A3[0] == 0:","- print(\"Yes\")","-else:","- print(\"No\")","+ exit()","+print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":1.2329144027,"measured_runtime_v1":0.183397862,"runtime_lift":6.7226214608,"key":["s467740941","s972156170"]} +{"user_id":"u477977638","problem_id":"p03752","language":"python","submission_id_v0":"s572800870","submission_id_v1":"s011317183","cpu_time_v0":481,"cpu_time_v1":42,"memory_v0":12524,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\ninput = sys.stdin.buffer.readline\n\n\n\n\n\ndef RD(): return sys.stdin.read()\n\ndef II(): return int(eval(input()))\n\ndef MI(): return list(map(int,input().split()))\n\ndef LI(): return list(map(int,input().split()))\n\ndef TI(): return tuple(map(int,input().split()))\n\n\n\n# mod=10**9+7\n\n# rstrip().decode('utf-8')\n\n\n\nimport numpy as np\n\nfrom itertools import combinations\n\n\n\ndef main():\n\n\tn,k=MI()\n\n\tans=10**18\n\n\n\n\tA=LI()\n\n\tA=[A[0]-1]+A\n\n\tA=np.array(A)\n\n\n\n\tfor t in combinations(list(range(n)),k):\n\n\t\tB=A.copy()\n\n\t\ttmp=0\n\n\t\tfor i in t:\n\n\t\t\ti+=1\n\n\t\t\tB[i]=max(B[:i].max()+1,A[i])\n\n\t\t\ttmp+=B[i]-A[i]\n\n\t\tans=min(ans,tmp)\n\n\tprint(ans)\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\ninput = sys.stdin.buffer.readline\n\n\n\n\n\ndef RD(): return sys.stdin.read()\n\ndef II(): return int(eval(input()))\n\ndef MI(): return list(map(int,input().split()))\n\ndef LI(): return list(map(int,input().split()))\n\ndef TI(): return tuple(map(int,input().split()))\n\n\n\n# mod=10**9+7\n\n# rstrip().decode('utf-8')\n\n\n\n#import numpy as np\n\nfrom itertools import combinations\n\n\n\ndef main():\n\n\tn,k=MI()\n\n\tans=10**18\n\n\n\n\tA=LI()\n\n\tA=[A[0]-1]+A\n\n\n\n\tfor t in combinations(list(range(n)),k):\n\n\t\tB=A.copy()\n\n\t\ttmp=0\n\n\t\tfor i in t:\n\n\t\t\ti+=1\n\n\t\t\tB[i]=max(max(B[:i])+1,A[i])\n\n\t\t\ttmp+=B[i]-A[i]\n\n\t\tans=min(ans,tmp)\n\n\tprint(ans)\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()\n","code_v0_loc":37,"code_v1_loc":36,"code_v0_num_chars":680,"code_v1_num_chars":664,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\ninput = sys.stdin.buffer.readline\n\n\ndef RD():\n return sys.stdin.read()\n\n\ndef II():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef TI():\n return tuple(map(int, input().split()))\n\n\n# mod=10**9+7\n# rstrip().decode('utf-8')\nimport numpy as np\nfrom itertools import combinations\n\n\ndef main():\n n, k = MI()\n ans = 10**18\n A = LI()\n A = [A[0] - 1] + A\n A = np.array(A)\n for t in combinations(list(range(n)), k):\n B = A.copy()\n tmp = 0\n for i in t:\n i += 1\n B[i] = max(B[:i].max() + 1, A[i])\n tmp += B[i] - A[i]\n ans = min(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\ninput = sys.stdin.buffer.readline\n\n\ndef RD():\n return sys.stdin.read()\n\n\ndef II():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef TI():\n return tuple(map(int, input().split()))\n\n\n# mod=10**9+7\n# rstrip().decode('utf-8')\n# import numpy as np\nfrom itertools import combinations\n\n\ndef main():\n n, k = MI()\n ans = 10**18\n A = LI()\n A = [A[0] - 1] + A\n for t in combinations(list(range(n)), k):\n B = A.copy()\n tmp = 0\n for i in t:\n i += 1\n B[i] = max(max(B[:i]) + 1, A[i])\n tmp += B[i] - A[i]\n ans = min(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.7027027027,"diff":["-import numpy as np","+# import numpy as np","- A = np.array(A)","- B[i] = max(B[:i].max() + 1, A[i])","+ B[i] = max(max(B[:i]) + 1, A[i])"],"diff_only_import_comment":false,"measured_runtime_v0":1.4463615463,"measured_runtime_v1":0.2103404913,"runtime_lift":6.8762868115,"key":["s572800870","s011317183"]} +{"user_id":"u933622697","problem_id":"p03434","language":"python","submission_id_v0":"s339676301","submission_id_v1":"s687508322","cpu_time_v0":150,"cpu_time_v1":18,"memory_v0":12388,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn = int(eval(input()))\n\na_list = list(map(int, input().split()))\n\n\n\nalice_point = 0\n\nbob_point = 0\n\nfor i in range(n):\n\n argmax_a = np.argmax(a_list)\n\n max_a = np.max(a_list)\n\n if i % 2 == 0: # If Alice takes a card\n\n alice_point += max_a\n\n else: # If Bob takes a card\n\n bob_point += max_a\n\n del a_list[argmax_a] # No confidence -> Review how to delete list element!\n\n\n\nprint((alice_point - bob_point))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na_list = list(map(int, input().split()))\n\na_list = sorted(a_list, reverse=True)\n\n\n\nalice_point = 0\n\nbob_point = 0\n\nfor i in range(n):\n\n if i % 2 == 0:\n\n alice_point += a_list[i]\n\n else:\n\n bob_point += a_list[i]\n\n\n\nprint((alice_point - bob_point))","code_v0_loc":17,"code_v1_loc":13,"code_v0_num_chars":445,"code_v1_num_chars":282,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\na_list = list(map(int, input().split()))\nalice_point = 0\nbob_point = 0\nfor i in range(n):\n argmax_a = np.argmax(a_list)\n max_a = np.max(a_list)\n if i % 2 == 0: # If Alice takes a card\n alice_point += max_a\n else: # If Bob takes a card\n bob_point += max_a\n del a_list[argmax_a] # No confidence -> Review how to delete list element!\nprint((alice_point - bob_point))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na_list = list(map(int, input().split()))\na_list = sorted(a_list, reverse=True)\nalice_point = 0\nbob_point = 0\nfor i in range(n):\n if i % 2 == 0:\n alice_point += a_list[i]\n else:\n bob_point += a_list[i]\nprint((alice_point - bob_point))\n","code_same":false,"relative_loc_diff_percent":23.5294117647,"diff":["-import numpy as np","-","+a_list = sorted(a_list, reverse=True)","- argmax_a = np.argmax(a_list)","- max_a = np.max(a_list)","- if i % 2 == 0: # If Alice takes a card","- alice_point += max_a","- else: # If Bob takes a card","- bob_point += max_a","- del a_list[argmax_a] # No confidence -> Review how to delete list element!","+ if i % 2 == 0:","+ alice_point += a_list[i]","+ else:","+ bob_point += a_list[i]"],"diff_only_import_comment":false,"measured_runtime_v0":1.5290555863,"measured_runtime_v1":0.1577071764,"runtime_lift":9.6955358703,"key":["s339676301","s687508322"]} +{"user_id":"u359358631","problem_id":"p03796","language":"python","submission_id_v0":"s916466489","submission_id_v1":"s520315696","cpu_time_v0":158,"cpu_time_v1":44,"memory_v0":10172,"memory_v1":8932,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.15,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n power = math.factorial(N)\n\n print((power % (10 ** 9 + 7)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n N = int(eval(input()))\n\n power = 1\n\n for i in range(1, N + 1):\n\n power *= i\n\n power %= 10 ** 9 + 7\n\n print(power)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":160,"code_v1_num_chars":192,"code_v0_no_empty_lines":"import math\n\n\ndef main():\n N = int(eval(input()))\n power = math.factorial(N)\n print((power % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n power = 1\n for i in range(1, N + 1):\n power *= i\n power %= 10**9 + 7\n print(power)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import math","-","-","- power = math.factorial(N)","- print((power % (10**9 + 7)))","+ power = 1","+ for i in range(1, N + 1):","+ power *= i","+ power %= 10**9 + 7","+ print(power)"],"diff_only_import_comment":false,"measured_runtime_v0":0.7842813587,"measured_runtime_v1":0.3569579227,"runtime_lift":2.1971255121,"key":["s916466489","s520315696"]} +{"user_id":"u072053884","problem_id":"p02282","language":"python","submission_id_v0":"s375368636","submission_id_v1":"s582750093","cpu_time_v0":40,"cpu_time_v1":20,"memory_v0":7716,"memory_v1":7752,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef post_from_pre_in(preorder_elements, inorder_elements):\n\n if preorder_elements:\n\n global cnt\n\n root = preorder_elements[0]\n\n root_index = inorder_elements.index(root)\n\n preorder_left = preorder_elements[1:root_index+1]\n\n inorder_left = inorder_elements[:root_index]\n\n preorder_right = preorder_elements[root_index+1:]\n\n inorder_right = inorder_elements[root_index+1:]\n\n post_from_pre_in(preorder_left, inorder_left)\n\n post_from_pre_in(preorder_right, inorder_right)\n\n if cnt:\n\n print(root, end = ' ')\n\n cnt -= 1\n\n else:\n\n print(root)\n\n\n\n\n\ncnt = int(input()) - 1\n\n\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\n\n\npost_from_pre_in(a, b)\n\n\n# optimized version of the same code:\n","target":"postorder_elements = []\n\n\n\ndef post_from_pre_in(preorder_elements, inorder_elements):\n\n if preorder_elements:\n\n root = preorder_elements[0]\n\n root_index = inorder_elements.index(root)\n\n preorder_left = preorder_elements[1:root_index+1]\n\n inorder_left = inorder_elements[:root_index]\n\n preorder_right = preorder_elements[root_index+1:]\n\n inorder_right = inorder_elements[root_index+1:]\n\n post_from_pre_in(preorder_left, inorder_left)\n\n post_from_pre_in(preorder_right, inorder_right)\n\n postorder_elements.append(root)\n\n\n\n\n\n\n\nn = int(eval(input()))\n\n\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\n\n\npost_from_pre_in(a, b)\n\n\n\nprint((*postorder_elements))","code_v0_loc":24,"code_v1_loc":24,"code_v0_num_chars":779,"code_v1_num_chars":738,"code_v0_no_empty_lines":"def post_from_pre_in(preorder_elements, inorder_elements):\n if preorder_elements:\n global cnt\n root = preorder_elements[0]\n root_index = inorder_elements.index(root)\n preorder_left = preorder_elements[1 : root_index + 1]\n inorder_left = inorder_elements[:root_index]\n preorder_right = preorder_elements[root_index + 1 :]\n inorder_right = inorder_elements[root_index + 1 :]\n post_from_pre_in(preorder_left, inorder_left)\n post_from_pre_in(preorder_right, inorder_right)\n if cnt:\n print(root, end=\" \")\n cnt -= 1\n else:\n print(root)\n\n\ncnt = int(input()) - 1\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\npost_from_pre_in(a, b)\n","code_v1_no_empty_lines":"postorder_elements = []\n\n\ndef post_from_pre_in(preorder_elements, inorder_elements):\n if preorder_elements:\n root = preorder_elements[0]\n root_index = inorder_elements.index(root)\n preorder_left = preorder_elements[1 : root_index + 1]\n inorder_left = inorder_elements[:root_index]\n preorder_right = preorder_elements[root_index + 1 :]\n inorder_right = inorder_elements[root_index + 1 :]\n post_from_pre_in(preorder_left, inorder_left)\n post_from_pre_in(preorder_right, inorder_right)\n postorder_elements.append(root)\n\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\npost_from_pre_in(a, b)\nprint((*postorder_elements))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+postorder_elements = []","+","+","- global cnt","- if cnt:","- print(root, end=\" \")","- cnt -= 1","- else:","- print(root)","+ postorder_elements.append(root)","-cnt = int(input()) - 1","+n = int(eval(input()))","+print((*postorder_elements))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2366878937,"measured_runtime_v1":0.1182743947,"runtime_lift":2.0011761158,"key":["s375368636","s582750093"]} +{"user_id":"u167751176","problem_id":"p03078","language":"python","submission_id_v0":"s149883415","submission_id_v1":"s931960732","cpu_time_v0":641,"cpu_time_v1":91,"memory_v0":97660,"memory_v1":8708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.8,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\td = [0]*x*y\n\n\tfor i in range(x):\n\n\t\tfor j in range(y):\n\n\t\t\td[i*y+j] = a[i]+b[j]\n\n\td.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\n\n\tc_len = min(k, z)\n\n\td_len = min(k, x*y)\n\n\te = [0]*d_len*c_len\n\n\tfor i in range(d_len):\n\n\t\tfor j in range(c_len):\n\n\t\t\te[i*c_len+j] = d[i] + c[j]\n\n\te.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((e[i]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"def main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\n\n\tsolve(a, b, c, x, y, z, k)\n\n\n\ndef solve(a, b, c, x, y, z, k):\n\n\ta.sort(reverse=True)\n\n\tb.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\tstack = list()\n\n\tfor p in range(x):\n\n\t\tfor q in range(y):\n\n\t\t\tif (p+1)*(q+1) > k:\n\n\t\t\t\tbreak\n\n\t\t\tfor r in range(z):\n\n\t\t\t\tif (p+1)*(q+1)*(r+1) > k:\n\n\t\t\t\t\tbreak\n\n\t\t\t\tstack.append(a[p]+b[q]+c[r])\n\n\tstack.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((stack[i]))\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":25,"code_v1_loc":27,"code_v0_num_chars":545,"code_v1_num_chars":605,"code_v0_no_empty_lines":"def main():\n x, y, z, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n d = [0] * x * y\n for i in range(x):\n for j in range(y):\n d[i * y + j] = a[i] + b[j]\n d.sort(reverse=True)\n c.sort(reverse=True)\n c_len = min(k, z)\n d_len = min(k, x * y)\n e = [0] * d_len * c_len\n for i in range(d_len):\n for j in range(c_len):\n e[i * c_len + j] = d[i] + c[j]\n e.sort(reverse=True)\n for i in range(k):\n print((e[i]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n x, y, z, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n solve(a, b, c, x, y, z, k)\n\n\ndef solve(a, b, c, x, y, z, k):\n a.sort(reverse=True)\n b.sort(reverse=True)\n c.sort(reverse=True)\n stack = list()\n for p in range(x):\n for q in range(y):\n if (p + 1) * (q + 1) > k:\n break\n for r in range(z):\n if (p + 1) * (q + 1) * (r + 1) > k:\n break\n stack.append(a[p] + b[q] + c[r])\n stack.sort(reverse=True)\n for i in range(k):\n print((stack[i]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":7.4074074074,"diff":["- d = [0] * x * y","- for i in range(x):","- for j in range(y):","- d[i * y + j] = a[i] + b[j]","- d.sort(reverse=True)","+ solve(a, b, c, x, y, z, k)","+","+","+def solve(a, b, c, x, y, z, k):","+ a.sort(reverse=True)","+ b.sort(reverse=True)","- c_len = min(k, z)","- d_len = min(k, x * y)","- e = [0] * d_len * c_len","- for i in range(d_len):","- for j in range(c_len):","- e[i * c_len + j] = d[i] + c[j]","- e.sort(reverse=True)","+ stack = list()","+ for p in range(x):","+ for q in range(y):","+ if (p + 1) * (q + 1) > k:","+ break","+ for r in range(z):","+ if (p + 1) * (q + 1) * (r + 1) > k:","+ break","+ stack.append(a[p] + b[q] + c[r])","+ stack.sort(reverse=True)","- print((e[i]))","+ print((stack[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3135767848,"measured_runtime_v1":0.0401056306,"runtime_lift":7.8187720726,"key":["s149883415","s931960732"]} +{"user_id":"u260980560","problem_id":"p00713","language":"python","submission_id_v0":"s376249504","submission_id_v1":"s496295641","cpu_time_v0":32130,"cpu_time_v1":27750,"memory_v0":6520,"memory_v1":6552,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.63,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) \/ d) \/ 2.0\n\n xc = (x1 + x2) \/ 2.0\n\n yc = (y1 + y2) \/ 2.0\n\n return [[xc - k*yd, yc + k*xd], [xc + k*yd, yc - k*xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = [list(map(float, input().split())) for i in range(n)]\n\n p.sort()\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - bx >= 2.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)\n\n# optimized version of the same code:\n","target":"from math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) \/ d) \/ 2.0\n\n xc = (x1 + x2) \/ 2.0; yc = (y1 + y2) \/ 2.0\n\n xd *= k; yd *= k\n\n return [[xc - yd, yc + xd], [xc + yd, yc - xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = sorted(list(map(float, input().split())) for i in range(n))\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - ex >= 1.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)","code_v0_loc":33,"code_v1_loc":32,"code_v0_num_chars":1141,"code_v1_num_chars":1143,"code_v0_no_empty_lines":"from math import sqrt\nfrom bisect import bisect_left\n\n\ndef circle_center(x1, y1, x2, y2):\n xd = x2 - x1\n yd = y2 - y1\n d = xd**2 + yd**2\n k = sqrt((4.0 - d) \/ d) \/ 2.0\n xc = (x1 + x2) \/ 2.0\n yc = (y1 + y2) \/ 2.0\n return [[xc - k * yd, yc + k * xd], [xc + k * yd, yc - k * xd]]\n\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n p = [list(map(float, input().split())) for i in range(n)]\n p.sort()\n prev = 0\n ans = 1\n for i in range(n):\n bx, by = p[i]\n while bx - p[prev][0] >= 2.0:\n prev += 1\n for j in range(i + 1, n):\n cx, cy = p[j]\n if cx - bx >= 2.0:\n break\n if (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0:\n for ex, ey in circle_center(bx, by, cx, cy):\n count = 2\n for k in range(prev, n):\n if k == i or k == j:\n continue\n dx, dy = p[k]\n if dx - bx >= 2.0:\n break\n if (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0:\n count += 1\n ans = max(ans, count)\n print(ans)\n","code_v1_no_empty_lines":"from math import sqrt\nfrom bisect import bisect_left\n\n\ndef circle_center(x1, y1, x2, y2):\n xd = x2 - x1\n yd = y2 - y1\n d = xd**2 + yd**2\n k = sqrt((4.0 - d) \/ d) \/ 2.0\n xc = (x1 + x2) \/ 2.0\n yc = (y1 + y2) \/ 2.0\n xd *= k\n yd *= k\n return [[xc - yd, yc + xd], [xc + yd, yc - xd]]\n\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n p = sorted(list(map(float, input().split())) for i in range(n))\n prev = 0\n ans = 1\n for i in range(n):\n bx, by = p[i]\n while bx - p[prev][0] >= 2.0:\n prev += 1\n for j in range(i + 1, n):\n cx, cy = p[j]\n if cx - bx >= 2.0:\n break\n if (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0:\n for ex, ey in circle_center(bx, by, cx, cy):\n count = 2\n for k in range(prev, n):\n if k == i or k == j:\n continue\n dx, dy = p[k]\n if dx - ex >= 1.0:\n break\n if (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0:\n count += 1\n ans = max(ans, count)\n print(ans)\n","code_same":false,"relative_loc_diff_percent":3.0303030303,"diff":["- return [[xc - k * yd, yc + k * xd], [xc + k * yd, yc - k * xd]]","+ xd *= k","+ yd *= k","+ return [[xc - yd, yc + xd], [xc + yd, yc - xd]]","- p = [list(map(float, input().split())) for i in range(n)]","- p.sort()","+ p = sorted(list(map(float, input().split())) for i in range(n))","- if dx - bx >= 2.0:","+ if dx - ex >= 1.0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3026192219,"measured_runtime_v1":0.1054183228,"runtime_lift":2.8706510771,"key":["s376249504","s496295641"]} +{"user_id":"u849229491","problem_id":"p02690","language":"python","submission_id_v0":"s006550541","submission_id_v1":"s560841752","cpu_time_v0":67,"cpu_time_v1":54,"memory_v0":9152,"memory_v1":9064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.4,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\nfor i in range(-200,200,1):\n\n for j in range(-200,200,1):\n\n if i**5-j**5==x:\n\n print((i,j))\n\n exit()\n\n# optimized version of the same code:\n","target":"import sys\n\nx = int(eval(input()))\n\nfor i in range(-159,159,1):\n\n for j in range(-159,159,1):\n\n if i**5 - j**5 == x:\n\n print((str(i)+' '+str(j)))\n\n sys.exit()","code_v0_loc":6,"code_v1_loc":7,"code_v0_num_chars":144,"code_v1_num_chars":182,"code_v0_no_empty_lines":"x = int(eval(input()))\nfor i in range(-200, 200, 1):\n for j in range(-200, 200, 1):\n if i**5 - j**5 == x:\n print((i, j))\n exit()\n","code_v1_no_empty_lines":"import sys\n\nx = int(eval(input()))\nfor i in range(-159, 159, 1):\n for j in range(-159, 159, 1):\n if i**5 - j**5 == x:\n print((str(i) + \" \" + str(j)))\n sys.exit()\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+import sys","+","-for i in range(-200, 200, 1):","- for j in range(-200, 200, 1):","+for i in range(-159, 159, 1):","+ for j in range(-159, 159, 1):","- print((i, j))","- exit()","+ print((str(i) + \" \" + str(j)))","+ sys.exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.6085173706,"measured_runtime_v1":0.478621159,"runtime_lift":1.2713967178,"key":["s006550541","s560841752"]} +{"user_id":"u185249212","problem_id":"p03545","language":"python","submission_id_v0":"s924705208","submission_id_v1":"s871428991","cpu_time_v0":341,"cpu_time_v1":173,"memory_v0":64748,"memory_v1":38384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n\n\n# import numpy as np\n\n# import numpypy as np\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef eprint(*args, **kwargs):\n\n print(*args, file=sys.stderr, **kwargs)\n\n return\n\n\n\nimport math\n\nimport string\n\nimport fractions\n\nfrom fractions import Fraction\n\nfrom fractions import gcd\n\n\n\ndef lcm(n,m):\n\n return int(n*m\/gcd(n,m))\n\n\n\nimport re\n\nimport array\n\nimport copy\n\nimport functools\n\nimport operator\n\n\n\nimport collections\n\nimport itertools\n\nimport bisect\n\nimport heapq\n\n\n\n\n\nfrom heapq import heappush\n\nfrom heapq import heappop\n\nfrom heapq import heappushpop\n\nfrom heapq import heapify\n\nfrom heapq import heapreplace\n\n\n\nfrom queue import PriorityQueue as pq\n\n\n\ndef reduce(p, q):\n\n common = fractions.gcd(p, q)\n\n return (p\/\/common , q\/\/common )\n\n# from itertools import accumulate\n\n# from collections import deque\n\n\n\nimport random\n\n\n\n\n\ndef main():\n\n # l = list(map(int, input().split()))\n\n ll=input().strip()\n\n l=[0 for i in range(4)]\n\n for i in range(len(l)):\n\n l[i]=int(ll[i])\n\n NUM_CASE=3\n\n\n\n for case in range(2**NUM_CASE):\n\n # eprint(\"case : \" + str(case))\n\n sum=l[0]\n\n \n\n stack=[]\n\n S=\"\"\n\n for index in range(NUM_CASE):\n\n if (case>>index) & 1 == 1:\n\n # eprint(\"l[%d] : %d\" % (index+1,l[index+1]) )\n\n sum+=l[index+1]\n\n stack.append(\"+\")\n\n else:\n\n # eprint(\"l[%d] : %d\" % (index+1,l[index+1]) )\n\n sum-=l[index+1]\n\n stack.append(\"-\")\n\n # eprint(\"sum : \" + str(sum))\n\n if sum==7:\n\n for i in range(4):\n\n S+=str(l[i])\n\n if i!=3:\n\n S+=str(stack[i])\n\n S+=\"=7\"\n\n print(S)\n\n return\n\n return\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"\n\n# import numpy as np\n\n# import numpypy as np\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef eprint(*args, **kwargs):\n\n print(*args, file=sys.stderr, **kwargs)\n\n return\n\n\n\n# import math\n\n# import string\n\n# import fractions\n\n# from fractions import Fraction\n\n# from fractions import gcd\n\n\n\n# def lcm(n,m):\n\n# return int(n*m\/gcd(n,m))\n\n\n\n# import re\n\n# import array\n\n# import copy\n\n# import functools\n\n# import operator\n\n\n\n# import collections\n\n# import itertools\n\n# import bisect\n\n# import heapq\n\n\n\n\n\n# from heapq import heappush\n\n# from heapq import heappop\n\n# from heapq import heappushpop\n\n# from heapq import heapify\n\n# from heapq import heapreplace\n\n\n\n# from queue import PriorityQueue as pq\n\n\n\n# def reduce(p, q):\n\n# common = fractions.gcd(p, q)\n\n# return (p\/\/common , q\/\/common )\n\n# # from itertools import accumulate\n\n# # from collections import deque\n\n\n\n# from operator import mul\n\n# from functools import reduce\n\n\n\n# def combinations_count(n, r):\n\n# r = min(r, n - r)\n\n# numer = reduce(mul, range(n, n - r, -1), 1)\n\n# denom = reduce(mul, range(1, r + 1), 1)\n\n# return numer \/\/ denom\n\n\n\n# import random\n\n\n\n\n\ndef main():\n\n # a,b,c,d = map(int, input().strip().split())\n\n l_abcd = list(map(int,input().strip()))\n\n eprint(\"l_abcd \",end=\": \")\n\n eprint(l_abcd)\n\n for case in range(2 ** 3): # \u5834\u5408\u30eb\u30fc\u30d7 # n\u306f\u4eba\u3068\u304b\u30e2\u30ce\u3068\u304b\u306e\u500b\u6570\n\n l_op_bin = list(map(int,(format(case,'b').zfill(3))))\n\n # eprint(\"l_op_bin \",end=\": \")\n\n # eprint(l_op_bin)\n\n \n\n #flag=0\n\n sum_x=l_abcd[0]\n\n l_op=[]\n\n for index_location in range(3): # \u4eba\u3068\u304b\u30e2\u30ce\u3068\u304b\u30eb\u30fc\u30d7\n\n if l_op_bin[index_location]==1: # \u305d\u306e\u6841\u304cyes\u3060\u3068\u4eee\u5b9a\u3057\u3066\u3044\u308b\u5834\u5408\n\n sum_x += l_abcd[1+index_location]\n\n l_op.append(\"+\")\n\n else: # \u305d\u306e\u6841\u304cno\u3060\u3068\u4eee\u5b9a\u3057\u3066\u3044\u308b\u5834\u5408\n\n sum_x -= l_abcd[1+index_location]\n\n l_op.append(\"-\")\n\n if sum_x==7:\n\n print(l_abcd[0], end=\"\")\n\n print(l_op[0],end=\"\")\n\n print(l_abcd[1], end=\"\") \n\n print(l_op[1],end=\"\")\n\n print(l_abcd[2], end=\"\") \n\n print(l_op[2],end=\"\")\n\n print(l_abcd[3], end=\"=7\\n\")\n\n return\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":84,"code_v1_loc":88,"code_v0_num_chars":1865,"code_v1_num_chars":2336,"code_v0_no_empty_lines":"# import numpy as np\n# import numpypy as np\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef eprint(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)\n return\n\n\nimport math\nimport string\nimport fractions\nfrom fractions import Fraction\nfrom fractions import gcd\n\n\ndef lcm(n, m):\n return int(n * m \/ gcd(n, m))\n\n\nimport re\nimport array\nimport copy\nimport functools\nimport operator\nimport collections\nimport itertools\nimport bisect\nimport heapq\nfrom heapq import heappush\nfrom heapq import heappop\nfrom heapq import heappushpop\nfrom heapq import heapify\nfrom heapq import heapreplace\nfrom queue import PriorityQueue as pq\n\n\ndef reduce(p, q):\n common = fractions.gcd(p, q)\n return (p \/\/ common, q \/\/ common)\n\n\n# from itertools import accumulate\n# from collections import deque\nimport random\n\n\ndef main():\n # l = list(map(int, input().split()))\n ll = input().strip()\n l = [0 for i in range(4)]\n for i in range(len(l)):\n l[i] = int(ll[i])\n NUM_CASE = 3\n for case in range(2**NUM_CASE):\n # eprint(\"case : \" + str(case))\n sum = l[0]\n stack = []\n S = \"\"\n for index in range(NUM_CASE):\n if (case >> index) & 1 == 1:\n # eprint(\"l[%d] : %d\" % (index+1,l[index+1]) )\n sum += l[index + 1]\n stack.append(\"+\")\n else:\n # eprint(\"l[%d] : %d\" % (index+1,l[index+1]) )\n sum -= l[index + 1]\n stack.append(\"-\")\n # eprint(\"sum : \" + str(sum))\n if sum == 7:\n for i in range(4):\n S += str(l[i])\n if i != 3:\n S += str(stack[i])\n S += \"=7\"\n print(S)\n return\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# import numpy as np\n# import numpypy as np\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef eprint(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)\n return\n\n\n# import math\n# import string\n# import fractions\n# from fractions import Fraction\n# from fractions import gcd\n# def lcm(n,m):\n# return int(n*m\/gcd(n,m))\n# import re\n# import array\n# import copy\n# import functools\n# import operator\n# import collections\n# import itertools\n# import bisect\n# import heapq\n# from heapq import heappush\n# from heapq import heappop\n# from heapq import heappushpop\n# from heapq import heapify\n# from heapq import heapreplace\n# from queue import PriorityQueue as pq\n# def reduce(p, q):\n# common = fractions.gcd(p, q)\n# return (p\/\/common , q\/\/common )\n# # from itertools import accumulate\n# # from collections import deque\n# from operator import mul\n# from functools import reduce\n# def combinations_count(n, r):\n# r = min(r, n - r)\n# numer = reduce(mul, range(n, n - r, -1), 1)\n# denom = reduce(mul, range(1, r + 1), 1)\n# return numer \/\/ denom\n# import random\ndef main():\n # a,b,c,d = map(int, input().strip().split())\n l_abcd = list(map(int, input().strip()))\n eprint(\"l_abcd \", end=\": \")\n eprint(l_abcd)\n for case in range(2**3): # \u5834\u5408\u30eb\u30fc\u30d7 # n\u306f\u4eba\u3068\u304b\u30e2\u30ce\u3068\u304b\u306e\u500b\u6570\n l_op_bin = list(map(int, (format(case, \"b\").zfill(3))))\n # eprint(\"l_op_bin \",end=\": \")\n # eprint(l_op_bin)\n # flag=0\n sum_x = l_abcd[0]\n l_op = []\n for index_location in range(3): # \u4eba\u3068\u304b\u30e2\u30ce\u3068\u304b\u30eb\u30fc\u30d7\n if l_op_bin[index_location] == 1: # \u305d\u306e\u6841\u304cyes\u3060\u3068\u4eee\u5b9a\u3057\u3066\u3044\u308b\u5834\u5408\n sum_x += l_abcd[1 + index_location]\n l_op.append(\"+\")\n else: # \u305d\u306e\u6841\u304cno\u3060\u3068\u4eee\u5b9a\u3057\u3066\u3044\u308b\u5834\u5408\n sum_x -= l_abcd[1 + index_location]\n l_op.append(\"-\")\n if sum_x == 7:\n print(l_abcd[0], end=\"\")\n print(l_op[0], end=\"\")\n print(l_abcd[1], end=\"\")\n print(l_op[1], end=\"\")\n print(l_abcd[2], end=\"\")\n print(l_op[2], end=\"\")\n print(l_abcd[3], end=\"=7\\n\")\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-import math","-import string","-import fractions","-from fractions import Fraction","-from fractions import gcd","-","-","-def lcm(n, m):","- return int(n * m \/ gcd(n, m))","-","-","-import re","-import array","-import copy","-import functools","-import operator","-import collections","-import itertools","-import bisect","-import heapq","-from heapq import heappush","-from heapq import heappop","-from heapq import heappushpop","-from heapq import heapify","-from heapq import heapreplace","-from queue import PriorityQueue as pq","-","-","-def reduce(p, q):","- common = fractions.gcd(p, q)","- return (p \/\/ common, q \/\/ common)","-","-","-# from itertools import accumulate","-# from collections import deque","-import random","-","-","+# import math","+# import string","+# import fractions","+# from fractions import Fraction","+# from fractions import gcd","+# def lcm(n,m):","+# return int(n*m\/gcd(n,m))","+# import re","+# import array","+# import copy","+# import functools","+# import operator","+# import collections","+# import itertools","+# import bisect","+# import heapq","+# from heapq import heappush","+# from heapq import heappop","+# from heapq import heappushpop","+# from heapq import heapify","+# from heapq import heapreplace","+# from queue import PriorityQueue as pq","+# def reduce(p, q):","+# common = fractions.gcd(p, q)","+# return (p\/\/common , q\/\/common )","+# # from itertools import accumulate","+# # from collections import deque","+# from operator import mul","+# from functools import reduce","+# def combinations_count(n, r):","+# r = min(r, n - r)","+# numer = reduce(mul, range(n, n - r, -1), 1)","+# denom = reduce(mul, range(1, r + 1), 1)","+# return numer \/\/ denom","+# import random","- # l = list(map(int, input().split()))","- ll = input().strip()","- l = [0 for i in range(4)]","- for i in range(len(l)):","- l[i] = int(ll[i])","- NUM_CASE = 3","- for case in range(2**NUM_CASE):","- # eprint(\"case : \" + str(case))","- sum = l[0]","- stack = []","- S = \"\"","- for index in range(NUM_CASE):","- if (case >> index) & 1 == 1:","- # eprint(\"l[%d] : %d\" % (index+1,l[index+1]) )","- sum += l[index + 1]","- stack.append(\"+\")","- else:","- # eprint(\"l[%d] : %d\" % (index+1,l[index+1]) )","- sum -= l[index + 1]","- stack.append(\"-\")","- # eprint(\"sum : \" + str(sum))","- if sum == 7:","- for i in range(4):","- S += str(l[i])","- if i != 3:","- S += str(stack[i])","- S += \"=7\"","- print(S)","+ # a,b,c,d = map(int, input().strip().split())","+ l_abcd = list(map(int, input().strip()))","+ eprint(\"l_abcd \", end=\": \")","+ eprint(l_abcd)","+ for case in range(2**3): # \u5834\u5408\u30eb\u30fc\u30d7 # n\u306f\u4eba\u3068\u304b\u30e2\u30ce\u3068\u304b\u306e\u500b\u6570","+ l_op_bin = list(map(int, (format(case, \"b\").zfill(3))))","+ # eprint(\"l_op_bin \",end=\": \")","+ # eprint(l_op_bin)","+ # flag=0","+ sum_x = l_abcd[0]","+ l_op = []","+ for index_location in range(3): # \u4eba\u3068\u304b\u30e2\u30ce\u3068\u304b\u30eb\u30fc\u30d7","+ if l_op_bin[index_location] == 1: # \u305d\u306e\u6841\u304cyes\u3060\u3068\u4eee\u5b9a\u3057\u3066\u3044\u308b\u5834\u5408","+ sum_x += l_abcd[1 + index_location]","+ l_op.append(\"+\")","+ else: # \u305d\u306e\u6841\u304cno\u3060\u3068\u4eee\u5b9a\u3057\u3066\u3044\u308b\u5834\u5408","+ sum_x -= l_abcd[1 + index_location]","+ l_op.append(\"-\")","+ if sum_x == 7:","+ print(l_abcd[0], end=\"\")","+ print(l_op[0], end=\"\")","+ print(l_abcd[1], end=\"\")","+ print(l_op[1], end=\"\")","+ print(l_abcd[2], end=\"\")","+ print(l_op[2], end=\"\")","+ print(l_abcd[3], end=\"=7\\n\")","- return"],"diff_only_import_comment":false,"measured_runtime_v0":0.3214388018,"measured_runtime_v1":0.2510136111,"runtime_lift":1.2805632347,"key":["s924705208","s871428991"]} +{"user_id":"u057964173","problem_id":"p03371","language":"python","submission_id_v0":"s236240914","submission_id_v1":"s892922951","cpu_time_v0":286,"cpu_time_v1":86,"memory_v0":62304,"memory_v1":7064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.93,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n import math\n\n a,b,c,x,y=list(map(int, input().split()))\n\n cmax=max(x,y)*2\n\n l=[]\n\n for i in range(cmax+1):\n\n amai = max(math.ceil(x - 0.5 * i),0)\n\n bmai = max(math.ceil(y - 0.5 * i),0)\n\n l.append(amai*a+bmai*b+i*c)\n\n print((min(l)))\n\nresolve()\n\n# optimized version of the same code:\n","target":"import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n import math\n\n a,b,c,x,y=list(map(int, input().split()))\n\n # AB\u30d4\u30b6\u3092\u5947\u6570\u679a\u8cb7\u3063\u3066\u30821\u679a\u7121\u99c4\u306b\u306a\u308b\u304b\u3089\u3001AB\u30d4\u30b6\u306f2\u679a\u30921\u679a\u3060\u3068\u8003\u3048\u308b\n\n # c\u306e\u5024\u6bb5\u30922\u500d\u306b\u3057\u3066\u679a\u6570\u3092\u534a\u5206\u306b\n\n cmax=max(x,y) # AB\u30d4\u30b6\u306e\u6700\u5927\u679a\u6570(2\u679a\u30921\u679a\u3068\u8003\u3048\u305f\u3068\u304d)\n\n c=2*c\n\n l=[]\n\n for i in range(cmax+1):\n\n amai = max(x - i,0)\n\n bmai = max(y - i,0)\n\n l.append(amai*a+bmai*b+i*c)\n\n print((min(l)))\n\nresolve()","code_v0_loc":14,"code_v1_loc":17,"code_v0_num_chars":355,"code_v1_num_chars":424,"code_v0_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n import math\n\n a, b, c, x, y = list(map(int, input().split()))\n cmax = max(x, y) * 2\n l = []\n for i in range(cmax + 1):\n amai = max(math.ceil(x - 0.5 * i), 0)\n bmai = max(math.ceil(y - 0.5 * i), 0)\n l.append(amai * a + bmai * b + i * c)\n print((min(l)))\n\n\nresolve()\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n import math\n\n a, b, c, x, y = list(map(int, input().split()))\n # AB\u30d4\u30b6\u3092\u5947\u6570\u679a\u8cb7\u3063\u3066\u30821\u679a\u7121\u99c4\u306b\u306a\u308b\u304b\u3089\u3001AB\u30d4\u30b6\u306f2\u679a\u30921\u679a\u3060\u3068\u8003\u3048\u308b\n # c\u306e\u5024\u6bb5\u30922\u500d\u306b\u3057\u3066\u679a\u6570\u3092\u534a\u5206\u306b\n cmax = max(x, y) # AB\u30d4\u30b6\u306e\u6700\u5927\u679a\u6570(2\u679a\u30921\u679a\u3068\u8003\u3048\u305f\u3068\u304d)\n c = 2 * c\n l = []\n for i in range(cmax + 1):\n amai = max(x - i, 0)\n bmai = max(y - i, 0)\n l.append(amai * a + bmai * b + i * c)\n print((min(l)))\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["- cmax = max(x, y) * 2","+ # AB\u30d4\u30b6\u3092\u5947\u6570\u679a\u8cb7\u3063\u3066\u30821\u679a\u7121\u99c4\u306b\u306a\u308b\u304b\u3089\u3001AB\u30d4\u30b6\u306f2\u679a\u30921\u679a\u3060\u3068\u8003\u3048\u308b","+ # c\u306e\u5024\u6bb5\u30922\u500d\u306b\u3057\u3066\u679a\u6570\u3092\u534a\u5206\u306b","+ cmax = max(x, y) # AB\u30d4\u30b6\u306e\u6700\u5927\u679a\u6570(2\u679a\u30921\u679a\u3068\u8003\u3048\u305f\u3068\u304d)","+ c = 2 * c","- amai = max(math.ceil(x - 0.5 * i), 0)","- bmai = max(math.ceil(y - 0.5 * i), 0)","+ amai = max(x - i, 0)","+ bmai = max(y - i, 0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4395413058,"measured_runtime_v1":0.288304507,"runtime_lift":1.5245731338,"key":["s236240914","s892922951"]} +{"user_id":"u286955577","problem_id":"p03074","language":"python","submission_id_v0":"s853547546","submission_id_v1":"s138697044","cpu_time_v0":74,"cpu_time_v1":66,"memory_v0":4596,"memory_v1":4596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.81,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef solve():\n\n N, K = list(map(int, input().split()))\n\n _S = eval(input())\n\n S = []\n\n b = _S[0]\n\n s = 0\n\n if b == '0': S.append(0)\n\n for _s in _S:\n\n if b == _s:\n\n s = s + 1\n\n else:\n\n b = _s\n\n S.append(s)\n\n s = 1\n\n S.append(s)\n\n if b == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n\n n = sum(S[0:num])\n\n m = n\n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n\n for i in range(0, len(S) - num, 2):\n\n n = n - sum(S[i:i+2])\n\n n = n + sum(S[i + num:i + num + 2])\n\n m = max(m, n)\n\n\n\n return m\n\n\n\nprint((solve()))\n\n# optimized version of the same code:\n","target":"def solve():\n\n N, K = list(map(int, input().split()))\n\n s = eval(input())\n\n S = []\n\n b = s[0]\n\n cnt = 0\n\n\n\n if s[0] == '0': S.append(0)\n\n for c in s:\n\n if b == c: cnt = cnt + 1\n\n else:\n\n b = c\n\n S.append(cnt)\n\n cnt = 1\n\n S.append(cnt)\n\n if s[-1] == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n part = sum(S[0:num])\n\n ans = part\n\n\n\n for i in range(0, len(S) - num, 2):\n\n part = part - sum(S[i:i+2]) + sum(S[i + num:i + num + 2])\n\n ans = max(ans, part)\n\n\n\n return ans\n\n\n\nprint((solve()))\n","code_v0_loc":30,"code_v1_loc":28,"code_v0_num_chars":616,"code_v1_num_chars":520,"code_v0_no_empty_lines":"def solve():\n N, K = list(map(int, input().split()))\n _S = eval(input())\n S = []\n b = _S[0]\n s = 0\n if b == \"0\":\n S.append(0)\n for _s in _S:\n if b == _s:\n s = s + 1\n else:\n b = _s\n S.append(s)\n s = 1\n S.append(s)\n if b == \"0\":\n S.append(0)\n num = min(len(S), 2 * K + 1)\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n n = sum(S[0:num])\n m = n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n for i in range(0, len(S) - num, 2):\n n = n - sum(S[i : i + 2])\n n = n + sum(S[i + num : i + num + 2])\n m = max(m, n)\n return m\n\n\nprint((solve()))\n","code_v1_no_empty_lines":"def solve():\n N, K = list(map(int, input().split()))\n s = eval(input())\n S = []\n b = s[0]\n cnt = 0\n if s[0] == \"0\":\n S.append(0)\n for c in s:\n if b == c:\n cnt = cnt + 1\n else:\n b = c\n S.append(cnt)\n cnt = 1\n S.append(cnt)\n if s[-1] == \"0\":\n S.append(0)\n num = min(len(S), 2 * K + 1)\n part = sum(S[0:num])\n ans = part\n for i in range(0, len(S) - num, 2):\n part = part - sum(S[i : i + 2]) + sum(S[i + num : i + num + 2])\n ans = max(ans, part)\n return ans\n\n\nprint((solve()))\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["- _S = eval(input())","+ s = eval(input())","- b = _S[0]","- s = 0","- if b == \"0\":","+ b = s[0]","+ cnt = 0","+ if s[0] == \"0\":","- for _s in _S:","- if b == _s:","- s = s + 1","+ for c in s:","+ if b == c:","+ cnt = cnt + 1","- b = _s","- S.append(s)","- s = 1","- S.append(s)","- if b == \"0\":","+ b = c","+ S.append(cnt)","+ cnt = 1","+ S.append(cnt)","+ if s[-1] == \"0\":","- # n = sum(S[0:num if _S[0] == '1' else (num - 1)])","- n = sum(S[0:num])","- m = n","- # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):","+ part = sum(S[0:num])","+ ans = part","- n = n - sum(S[i : i + 2])","- n = n + sum(S[i + num : i + num + 2])","- m = max(m, n)","- return m","+ part = part - sum(S[i : i + 2]) + sum(S[i + num : i + num + 2])","+ ans = max(ans, part)","+ return ans"],"diff_only_import_comment":false,"measured_runtime_v0":0.3473945413,"measured_runtime_v1":0.2136866565,"runtime_lift":1.625719392,"key":["s853547546","s138697044"]} +{"user_id":"u259738923","problem_id":"p03796","language":"python","submission_id_v0":"s911512169","submission_id_v1":"s353747803","cpu_time_v0":231,"cpu_time_v1":41,"memory_v0":3972,"memory_v1":7396,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.25,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nN = int(eval(input()))\n\nans = math.factorial(N) % (10 ** 9 + 7)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nfrom functools import reduce\n\nprint((reduce(lambda x,y:x*y%1000000007,list(range(1,n+1)))))","code_v0_loc":4,"code_v1_loc":3,"code_v0_num_chars":82,"code_v1_num_chars":107,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nfrom functools import reduce\n\nprint((reduce(lambda x, y: x * y % 1000000007, list(range(1, n + 1)))))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import math","+n = int(eval(input()))","+from functools import reduce","-N = int(eval(input()))","-ans = math.factorial(N) % (10**9 + 7)","-print(ans)","+print((reduce(lambda x, y: x * y % 1000000007, list(range(1, n + 1)))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5315986769,"measured_runtime_v1":0.2369310765,"runtime_lift":2.2436848922,"key":["s911512169","s353747803"]} +{"user_id":"u775681539","problem_id":"p03371","language":"python","submission_id_v0":"s986639109","submission_id_v1":"s095330807","cpu_time_v0":186,"cpu_time_v1":89,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.15,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#python3\n\nINF = int(1e9)\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF\n\n for i in range(2*10**5+100):\n\n t = 2*c*i + max(x-i, 0) * a + max(y-i, 0) * b\n\n ans = min(ans, t)\n\n print(ans)\n\nmain()\n\n# optimized version of the same code:\n","target":"INF = int(1e5)+5\n\n\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF*INF\n\n for i in range(INF):\n\n tmp = 2*i*c + a*max(x-i, 0) + b*max(y-i, 0) \n\n ans = min(tmp, ans)\n\n print(ans)\n\nmain()\n","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":239,"code_v1_num_chars":231,"code_v0_no_empty_lines":"# python3\nINF = int(1e9)\n\n\ndef main():\n a, b, c, x, y = list(map(int, input().split()))\n ans = INF\n for i in range(2 * 10**5 + 100):\n t = 2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b\n ans = min(ans, t)\n print(ans)\n\n\nmain()\n","code_v1_no_empty_lines":"INF = int(1e5) + 5\n\n\ndef main():\n a, b, c, x, y = list(map(int, input().split()))\n ans = INF * INF\n for i in range(INF):\n tmp = 2 * i * c + a * max(x - i, 0) + b * max(y - i, 0)\n ans = min(tmp, ans)\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-# python3","-INF = int(1e9)","+INF = int(1e5) + 5","- ans = INF","- for i in range(2 * 10**5 + 100):","- t = 2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b","- ans = min(ans, t)","+ ans = INF * INF","+ for i in range(INF):","+ tmp = 2 * i * c + a * max(x - i, 0) + b * max(y - i, 0)","+ ans = min(tmp, ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3276309614,"measured_runtime_v1":0.7168484554,"runtime_lift":1.8520385325,"key":["s986639109","s095330807"]} +{"user_id":"u575431498","problem_id":"p03828","language":"python","submission_id_v0":"s058426510","submission_id_v1":"s587454237","cpu_time_v0":73,"cpu_time_v1":18,"memory_v0":3572,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom functools import reduce\n\nN = int(eval(input()))\n\n\n\nprime_table = [1] * (N+1)\n\n\n\nfor x in range(2, N+1):\n\n for t in range(2, x+1):\n\n while x % t == 0:\n\n prime_table[t] += 1\n\n x \/\/= t\n\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))\n\n# optimized version of the same code:\n","target":"def prime_factorize(n):\n\n while n % 2 == 0:\n\n a[2] += 1\n\n n \/\/= 2\n\n f = 3\n\n while f * f <= n:\n\n if n % f == 0:\n\n a[f] += 1\n\n n \/\/= f\n\n else:\n\n f += 2\n\n if n != 1:\n\n a[n] += 1\n\n\n\nN = int(eval(input()))\n\na = [0]*(N+1)\n\nfor i in range(2, N+1):\n\n prime_factorize(i)\n\nans = 1\n\nfor i in a:\n\n if i > 0:\n\n ans *= (i+1)\n\nbig = 10**9 + 7\n\nprint((ans % big))","code_v0_loc":11,"code_v1_loc":24,"code_v0_num_chars":277,"code_v1_num_chars":432,"code_v0_no_empty_lines":"from functools import reduce\n\nN = int(eval(input()))\nprime_table = [1] * (N + 1)\nfor x in range(2, N + 1):\n for t in range(2, x + 1):\n while x % t == 0:\n prime_table[t] += 1\n x \/\/= t\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))\n","code_v1_no_empty_lines":"def prime_factorize(n):\n while n % 2 == 0:\n a[2] += 1\n n \/\/= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a[f] += 1\n n \/\/= f\n else:\n f += 2\n if n != 1:\n a[n] += 1\n\n\nN = int(eval(input()))\na = [0] * (N + 1)\nfor i in range(2, N + 1):\n prime_factorize(i)\nans = 1\nfor i in a:\n if i > 0:\n ans *= i + 1\nbig = 10**9 + 7\nprint((ans % big))\n","code_same":false,"relative_loc_diff_percent":54.1666666667,"diff":["-from functools import reduce","+def prime_factorize(n):","+ while n % 2 == 0:","+ a[2] += 1","+ n \/\/= 2","+ f = 3","+ while f * f <= n:","+ if n % f == 0:","+ a[f] += 1","+ n \/\/= f","+ else:","+ f += 2","+ if n != 1:","+ a[n] += 1","+","-prime_table = [1] * (N + 1)","-for x in range(2, N + 1):","- for t in range(2, x + 1):","- while x % t == 0:","- prime_table[t] += 1","- x \/\/= t","-print((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))","+a = [0] * (N + 1)","+for i in range(2, N + 1):","+ prime_factorize(i)","+ans = 1","+for i in a:","+ if i > 0:","+ ans *= i + 1","+big = 10**9 + 7","+print((ans % big))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2580870204,"measured_runtime_v1":0.1952191839,"runtime_lift":1.3220371851,"key":["s058426510","s587454237"]} +{"user_id":"u394853232","problem_id":"p03457","language":"python","submission_id_v0":"s138460182","submission_id_v1":"s158223063","cpu_time_v0":868,"cpu_time_v1":399,"memory_v0":21636,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn = int(eval(input()))\n\nT = []\n\nX = []\n\nY = []\n\nt1 = 0\n\nx1 = 0\n\ny1 = 0\n\nfor i in range(n):\n\n m = input().split()\n\n T.append(int(m[0]) - t1)\n\n t1 = int(m[0])\n\n X.append(abs(int(m[1]) - x1))\n\n x1 = int(m[1])\n\n Y.append(abs(int(m[2]) - y1))\n\n y1 = int(m[2])\n\nT = np.array(T)\n\nX = np.array(X)\n\nY = np.array(Y)\n\nfor i in range(n):\n\n if X[i] + Y[i] > T[i] or (X[i] + Y[i] + T[i]) % 2 == 1:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nt1 = 0\n\nx1 = 0\n\ny1 = 0\n\nboolean = True\n\n\n\nfor __ in range(n):\n\n t, x, y = [int(_) for _ in input().split()]\n\n if boolean:\n\n temp1 = x\n\n temp2 = t\n\n x = abs(x - x1) + abs(y - y1)\n\n t -= t1\n\n x1 = temp1\n\n y1 = y\n\n t1 = temp2\n\n if x > t or (x + t) % 2 == 1:\n\n boolean = False\n\nif boolean:\n\n print('Yes')\n\nelse:\n\n print('No')","code_v0_loc":25,"code_v1_loc":22,"code_v0_num_chars":482,"code_v1_num_chars":418,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nT = []\nX = []\nY = []\nt1 = 0\nx1 = 0\ny1 = 0\nfor i in range(n):\n m = input().split()\n T.append(int(m[0]) - t1)\n t1 = int(m[0])\n X.append(abs(int(m[1]) - x1))\n x1 = int(m[1])\n Y.append(abs(int(m[2]) - y1))\n y1 = int(m[2])\nT = np.array(T)\nX = np.array(X)\nY = np.array(Y)\nfor i in range(n):\n if X[i] + Y[i] > T[i] or (X[i] + Y[i] + T[i]) % 2 == 1:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\nt1 = 0\nx1 = 0\ny1 = 0\nboolean = True\nfor __ in range(n):\n t, x, y = [int(_) for _ in input().split()]\n if boolean:\n temp1 = x\n temp2 = t\n x = abs(x - x1) + abs(y - y1)\n t -= t1\n x1 = temp1\n y1 = y\n t1 = temp2\n if x > t or (x + t) % 2 == 1:\n boolean = False\nif boolean:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["-import numpy as np","-","-T = []","-X = []","-Y = []","-for i in range(n):","- m = input().split()","- T.append(int(m[0]) - t1)","- t1 = int(m[0])","- X.append(abs(int(m[1]) - x1))","- x1 = int(m[1])","- Y.append(abs(int(m[2]) - y1))","- y1 = int(m[2])","-T = np.array(T)","-X = np.array(X)","-Y = np.array(Y)","-for i in range(n):","- if X[i] + Y[i] > T[i] or (X[i] + Y[i] + T[i]) % 2 == 1:","- print(\"No\")","- break","+boolean = True","+for __ in range(n):","+ t, x, y = [int(_) for _ in input().split()]","+ if boolean:","+ temp1 = x","+ temp2 = t","+ x = abs(x - x1) + abs(y - y1)","+ t -= t1","+ x1 = temp1","+ y1 = y","+ t1 = temp2","+ if x > t or (x + t) % 2 == 1:","+ boolean = False","+if boolean:","+ print(\"Yes\")","- print(\"Yes\")","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":1.386622709,"measured_runtime_v1":0.2001591682,"runtime_lift":6.927600275,"key":["s138460182","s158223063"]} +{"user_id":"u925364229","problem_id":"p03835","language":"python","submission_id_v0":"s889927917","submission_id_v1":"s987244986","cpu_time_v0":1777,"cpu_time_v1":266,"memory_v0":2940,"memory_v1":42092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nK,S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor i in range(K+1):\n\n\tfor j in range(K+1):\n\n\t\tif (S - i - j) <= K and (S-i-j) >= 0:\n\n\t\t\tans += 1\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"K, S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n if 0 <= (S - X - Y) <= K:\n\n ans += 1\n\n\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":156,"code_v1_num_chars":162,"code_v0_no_empty_lines":"K, S = list(map(int, input().split(\" \")))\nans = 0\nfor i in range(K + 1):\n for j in range(K + 1):\n if (S - i - j) <= K and (S - i - j) >= 0:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"K, S = list(map(int, input().split(\" \")))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n if 0 <= (S - X - Y) <= K:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(K + 1):","- for j in range(K + 1):","- if (S - i - j) <= K and (S - i - j) >= 0:","+for X in range(K + 1):","+ for Y in range(K + 1):","+ if 0 <= (S - X - Y) <= K:"],"diff_only_import_comment":false,"measured_runtime_v0":0.441297763,"measured_runtime_v1":0.3279348275,"runtime_lift":1.3456873926,"key":["s889927917","s987244986"]} +{"user_id":"u140201022","problem_id":"p02412","language":"python","submission_id_v0":"s179146540","submission_id_v1":"s419434066","cpu_time_v0":420,"cpu_time_v1":30,"memory_v0":4208,"memory_v1":4204,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nwhile 1:\n\n ans=0\n\n n,x=list(map(int,input().split()))\n\n if n:\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n for k in range(j+1,n+1):\n\n if i+j+k==x:ans+=1\n\n else:break\n\n print(ans)\n\n# optimized version of the same code:\n","target":"while 1:\n\n a=0\n\n n,x=list(map(int,input().split()))\n\n if n==0:break\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n c=x-i-j\n\n if c>j and c<=n:a+=1\n\n print(a)","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":249,"code_v1_num_chars":202,"code_v0_no_empty_lines":"while 1:\n ans = 0\n n, x = list(map(int, input().split()))\n if n:\n for i in range(1, n - 1):\n for j in range(i + 1, n):\n for k in range(j + 1, n + 1):\n if i + j + k == x:\n ans += 1\n else:\n break\n print(ans)\n","code_v1_no_empty_lines":"while 1:\n a = 0\n n, x = list(map(int, input().split()))\n if n == 0:\n break\n for i in range(1, n - 1):\n for j in range(i + 1, n):\n c = x - i - j\n if c > j and c <= n:\n a += 1\n print(a)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["- ans = 0","+ a = 0","- if n:","- for i in range(1, n - 1):","- for j in range(i + 1, n):","- for k in range(j + 1, n + 1):","- if i + j + k == x:","- ans += 1","- else:","+ if n == 0:","- print(ans)","+ for i in range(1, n - 1):","+ for j in range(i + 1, n):","+ c = x - i - j","+ if c > j and c <= n:","+ a += 1","+ print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3642889087,"measured_runtime_v1":0.2896689522,"runtime_lift":1.2576042614,"key":["s179146540","s419434066"]} +{"user_id":"u390727364","problem_id":"p02690","language":"python","submission_id_v0":"s052815695","submission_id_v1":"s461844743","cpu_time_v0":103,"cpu_time_v1":51,"memory_v0":9116,"memory_v1":9132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.49,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\na = 0\n\nb = 0\n\nfor i in range(-200, 200):\n\n for j in range(-200, 200):\n\n if i ** 5 - j ** 5 == x:\n\n a = i\n\n b = j\n\nprint((a, b))\n\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\na = 0\n\nb = 0\n\nfor i in range(-120, 120):\n\n for j in range(-120, 120):\n\n if i ** 5 - j ** 5 == x:\n\n a = i\n\n b = j\n\nprint((a, b))\n","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":176,"code_v1_num_chars":176,"code_v0_no_empty_lines":"x = int(eval(input()))\na = 0\nb = 0\nfor i in range(-200, 200):\n for j in range(-200, 200):\n if i**5 - j**5 == x:\n a = i\n b = j\nprint((a, b))\n","code_v1_no_empty_lines":"x = int(eval(input()))\na = 0\nb = 0\nfor i in range(-120, 120):\n for j in range(-120, 120):\n if i**5 - j**5 == x:\n a = i\n b = j\nprint((a, b))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(-200, 200):","- for j in range(-200, 200):","+for i in range(-120, 120):","+ for j in range(-120, 120):"],"diff_only_import_comment":false,"measured_runtime_v0":0.9439397931,"measured_runtime_v1":0.4738806367,"runtime_lift":1.9919357745,"key":["s052815695","s461844743"]} +{"user_id":"u072717685","problem_id":"p02767","language":"python","submission_id_v0":"s067063811","submission_id_v1":"s910505357","cpu_time_v0":35,"cpu_time_v1":31,"memory_v0":5084,"memory_v1":9036,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n from statistics import mean\n\n from math import floor,ceil\n\n\n\n n = int(eval(input()))\n\n x = list(map(int, input().split()))\n\n x_mean = mean(x) \n\n if x_mean == 0.5:\n\n greater_than_x = len([i for i in x if i > x_mean])\n\n if greater_than_x * 2 >= n:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n elif x_mean % 1 > 0.5:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n x2 = [(num - x_mean)**2 for num in x]\n\n print((sum(x2)))\n\n\n\nmain()\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.read\n\ndef main():\n\n n, *x = list(map(int, read().split()))\n\n r = float('inf')\n\n for i1 in range(1, 101):\n\n rt = 0\n\n for xe in x:\n\n rt += (xe - i1)**2\n\n r = min(r, rt)\n\n print(r)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":21,"code_v1_loc":14,"code_v0_num_chars":512,"code_v1_num_chars":287,"code_v0_no_empty_lines":"def main():\n from statistics import mean\n from math import floor, ceil\n\n n = int(eval(input()))\n x = list(map(int, input().split()))\n x_mean = mean(x)\n if x_mean == 0.5:\n greater_than_x = len([i for i in x if i > x_mean])\n if greater_than_x * 2 >= n:\n x_mean = ceil(x_mean)\n else:\n x_mean = floor(x_mean)\n elif x_mean % 1 > 0.5:\n x_mean = ceil(x_mean)\n else:\n x_mean = floor(x_mean)\n x2 = [(num - x_mean) ** 2 for num in x]\n print((sum(x2)))\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\n\n\ndef main():\n n, *x = list(map(int, read().split()))\n r = float(\"inf\")\n for i1 in range(1, 101):\n rt = 0\n for xe in x:\n rt += (xe - i1) ** 2\n r = min(r, rt)\n print(r)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-def main():","- from statistics import mean","- from math import floor, ceil","+import sys","- n = int(eval(input()))","- x = list(map(int, input().split()))","- x_mean = mean(x)","- if x_mean == 0.5:","- greater_than_x = len([i for i in x if i > x_mean])","- if greater_than_x * 2 >= n:","- x_mean = ceil(x_mean)","- else:","- x_mean = floor(x_mean)","- elif x_mean % 1 > 0.5:","- x_mean = ceil(x_mean)","- else:","- x_mean = floor(x_mean)","- x2 = [(num - x_mean) ** 2 for num in x]","- print((sum(x2)))","+read = sys.stdin.read","-main()","+def main():","+ n, *x = list(map(int, read().split()))","+ r = float(\"inf\")","+ for i1 in range(1, 101):","+ rt = 0","+ for xe in x:","+ rt += (xe - i1) ** 2","+ r = min(r, rt)","+ print(r)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3305953437,"measured_runtime_v1":0.2443374534,"runtime_lift":1.3530277041,"key":["s067063811","s910505357"]} +{"user_id":"u190086340","problem_id":"p03854","language":"python","submission_id_v0":"s952373499","submission_id_v1":"s487524594","cpu_time_v0":320,"cpu_time_v1":262,"memory_v0":79600,"memory_v1":58480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.12,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef solve():\n\n S = eval(input())\n\n # print(S, len(S))\n\n\n\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n\n\n\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n\n\n def recur(i, w):\n\n if not TABLE[w][i] == -1:\n\n return TABLE[w][i]\n\n\n\n if i >= len(S):\n\n # print(\"jey\", log)\n\n return True\n\n\n\n r1, r2, r3, r4 = False, False, False, False\n\n if S[i:i + 5] == words[0]:\n\n r1 = recur(i + 5, 0)\n\n if S[i:i + 7] == words[1]:\n\n r2 = recur(i + 7, 1)\n\n if S[i:i + 5] == words[2]:\n\n r3 = recur(i + 5, 2)\n\n if S[i:i + 6] == words[3]:\n\n r4 = recur(i + 6, 3)\n\n\n\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n\n\n\n return TABLE[w][i]\n\n\n\n ans = recur(0, 0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\ndef solve():\n\n S = eval(input())\n\n # print(S, len(S))\n\n\n\n S = S[::-1]\n\n words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])\n\n\n\n def recur(i):\n\n if i >= len(S):\n\n return True\n\n\n\n for word in words:\n\n if S[i:i + len(word)] == word:\n\n if recur(i + len(word)):\n\n return True\n\n return False\n\n\n\n ans = recur(0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n","code_v0_loc":45,"code_v1_loc":31,"code_v0_num_chars":1006,"code_v1_num_chars":596,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef solve():\n S = eval(input())\n # print(S, len(S))\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n def recur(i, w):\n if not TABLE[w][i] == -1:\n return TABLE[w][i]\n if i >= len(S):\n # print(\"jey\", log)\n return True\n r1, r2, r3, r4 = False, False, False, False\n if S[i : i + 5] == words[0]:\n r1 = recur(i + 5, 0)\n if S[i : i + 7] == words[1]:\n r2 = recur(i + 7, 1)\n if S[i : i + 5] == words[2]:\n r3 = recur(i + 5, 2)\n if S[i : i + 6] == words[3]:\n r4 = recur(i + 6, 3)\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n return TABLE[w][i]\n\n ans = recur(0, 0)\n return ans\n\n\nif __name__ == \"__main__\":\n res = solve()\n if res:\n print(\"YES\")\n else:\n print(\"NO\")\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef solve():\n S = eval(input())\n # print(S, len(S))\n S = S[::-1]\n words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])\n\n def recur(i):\n if i >= len(S):\n return True\n for word in words:\n if S[i : i + len(word)] == word:\n if recur(i + len(word)):\n return True\n return False\n\n ans = recur(0)\n return ans\n\n\nif __name__ == \"__main__\":\n res = solve()\n if res:\n print(\"YES\")\n else:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":31.1111111111,"diff":["- words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}","- TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]","+ S = S[::-1]","+ words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])","- def recur(i, w):","- if not TABLE[w][i] == -1:","- return TABLE[w][i]","+ def recur(i):","- # print(\"jey\", log)","- r1, r2, r3, r4 = False, False, False, False","- if S[i : i + 5] == words[0]:","- r1 = recur(i + 5, 0)","- if S[i : i + 7] == words[1]:","- r2 = recur(i + 7, 1)","- if S[i : i + 5] == words[2]:","- r3 = recur(i + 5, 2)","- if S[i : i + 6] == words[3]:","- r4 = recur(i + 6, 3)","- TABLE[w][i] = r1 or r2 or r3 or r4 or False","- return TABLE[w][i]","+ for word in words:","+ if S[i : i + len(word)] == word:","+ if recur(i + len(word)):","+ return True","+ return False","- ans = recur(0, 0)","+ ans = recur(0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3275957136,"measured_runtime_v1":0.2137343092,"runtime_lift":1.5327240387,"key":["s952373499","s487524594"]} +{"user_id":"u794910686","problem_id":"p03494","language":"python","submission_id_v0":"s844467922","submission_id_v1":"s428626489","cpu_time_v0":148,"cpu_time_v1":19,"memory_v0":12496,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\neval(input())\n\nA = np.array(list(map(int, input().split())))\n\n\n\nans = 0\n\nwhile(all(A%2==0)):\n\n A = A\/2\n\n ans += 1\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"eval(input())\n\nA = list(map(int, input().split()))\n\n\n\nans = 0\n\nwhile all(a%2==0 for a in A):\n\n A=[a\/2 for a in A]\n\n ans += 1\n\n\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":150,"code_v1_num_chars":138,"code_v0_no_empty_lines":"import numpy as np\n\neval(input())\nA = np.array(list(map(int, input().split())))\nans = 0\nwhile all(A % 2 == 0):\n A = A \/ 2\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"eval(input())\nA = list(map(int, input().split()))\nans = 0\nwhile all(a % 2 == 0 for a in A):\n A = [a \/ 2 for a in A]\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-import numpy as np","-","-A = np.array(list(map(int, input().split())))","+A = list(map(int, input().split()))","-while all(A % 2 == 0):","- A = A \/ 2","+while all(a % 2 == 0 for a in A):","+ A = [a \/ 2 for a in A]"],"diff_only_import_comment":false,"measured_runtime_v0":1.3495693932,"measured_runtime_v1":0.2052214348,"runtime_lift":6.5761619599,"key":["s844467922","s428626489"]} +{"user_id":"u112317104","problem_id":"p02773","language":"python","submission_id_v0":"s565064219","submission_id_v1":"s656135042","cpu_time_v0":1126,"cpu_time_v1":742,"memory_v0":46132,"memory_v1":32480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.1,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import defaultdict\n\n\n\nN = int(eval(input()))\n\nA = [eval(input()) for _ in range(N)]\n\nA.sort()\n\nd = defaultdict(int)\n\nfor a in A:\n\n d[a] += 1\n\n\n\nl = sorted(d.items())\n\nmax_v = 0\n\n\n\nfor _, v in l:\n\n if v > max_v:\n\n max_v = v\n\n \n\nfor k, v in l:\n\n if v == max_v:\n\n print(k)\n\n else:\n\n continue\n\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\n\n\ndef solve():\n\n N = int(eval(input()))\n\n d = defaultdict(int)\n\n for _ in range(N):\n\n a = eval(input())\n\n d[a] += 1\n\n\n\n m = 0\n\n for k, v in list(d.items()):\n\n m = max(m, v)\n\n \n\n l = []\n\n for k, v in list(d.items()):\n\n if m == v:\n\n l.append(k)\n\n l.sort()\n\n for ans in l:\n\n print(ans)\n\n \n\nsolve()","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":330,"code_v1_num_chars":386,"code_v0_no_empty_lines":"from collections import defaultdict\n\nN = int(eval(input()))\nA = [eval(input()) for _ in range(N)]\nA.sort()\nd = defaultdict(int)\nfor a in A:\n d[a] += 1\nl = sorted(d.items())\nmax_v = 0\nfor _, v in l:\n if v > max_v:\n max_v = v\nfor k, v in l:\n if v == max_v:\n print(k)\n else:\n continue\n","code_v1_no_empty_lines":"from collections import defaultdict\n\n\ndef solve():\n N = int(eval(input()))\n d = defaultdict(int)\n for _ in range(N):\n a = eval(input())\n d[a] += 1\n m = 0\n for k, v in list(d.items()):\n m = max(m, v)\n l = []\n for k, v in list(d.items()):\n if m == v:\n l.append(k)\n l.sort()\n for ans in l:\n print(ans)\n\n\nsolve()\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-N = int(eval(input()))","-A = [eval(input()) for _ in range(N)]","-A.sort()","-d = defaultdict(int)","-for a in A:","- d[a] += 1","-l = sorted(d.items())","-max_v = 0","-for _, v in l:","- if v > max_v:","- max_v = v","-for k, v in l:","- if v == max_v:","- print(k)","- else:","- continue","+","+def solve():","+ N = int(eval(input()))","+ d = defaultdict(int)","+ for _ in range(N):","+ a = eval(input())","+ d[a] += 1","+ m = 0","+ for k, v in list(d.items()):","+ m = max(m, v)","+ l = []","+ for k, v in list(d.items()):","+ if m == v:","+ l.append(k)","+ l.sort()","+ for ans in l:","+ print(ans)","+","+","+solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2730668259,"measured_runtime_v1":0.1417047331,"runtime_lift":1.9270127385,"key":["s565064219","s656135042"]} +{"user_id":"u657901243","problem_id":"p02921","language":"python","submission_id_v0":"s942582713","submission_id_v1":"s970883644","cpu_time_v0":124,"cpu_time_v1":29,"memory_v0":27104,"memory_v1":9024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\ns = np.array(list(eval(input())))\n\nt = np.array(list(eval(input())))\n\nprint((len(s[s==t])))\n\n\n# optimized version of the same code:\n","target":"s = eval(input())\n\nt = eval(input())\n\nans = 0\n\nfor i in range(len(s)):\n\n if s[i] == t[i]:\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":4,"code_v1_loc":7,"code_v0_num_chars":98,"code_v1_num_chars":111,"code_v0_no_empty_lines":"import numpy as np\n\ns = np.array(list(eval(input())))\nt = np.array(list(eval(input())))\nprint((len(s[s == t])))\n","code_v1_no_empty_lines":"s = eval(input())\nt = eval(input())\nans = 0\nfor i in range(len(s)):\n if s[i] == t[i]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-import numpy as np","-","-s = np.array(list(eval(input())))","-t = np.array(list(eval(input())))","-print((len(s[s == t])))","+s = eval(input())","+t = eval(input())","+ans = 0","+for i in range(len(s)):","+ if s[i] == t[i]:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.4444875236,"measured_runtime_v1":0.1914589086,"runtime_lift":7.5446346914,"key":["s942582713","s970883644"]} +{"user_id":"u038408819","problem_id":"p02691","language":"python","submission_id_v0":"s116716284","submission_id_v1":"s825945845","cpu_time_v0":328,"cpu_time_v1":178,"memory_v0":73948,"memory_v1":132600,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\na_index = []\n\nfor i in range(n):\n\n a_index.append((i, a[i]))\n\ndic1 = {}\n\ndic2 = {}\n\nfor i in range(n):\n\n one = a_index[i][0] + a_index[i][1]\n\n two = a_index[i][0] - a_index[i][1]\n\n if one not in dic1:\n\n dic1[one] = 1\n\n else:\n\n dic1[one] += 1\n\n if two not in dic2:\n\n dic2[two] = 1\n\n else:\n\n dic2[two] += 1\n\nans = 0\n\nfor i in list(dic1.keys()):\n\n if i in dic2:\n\n ans += dic2[i] * dic1[i]\n\nfor i in list(dic2.keys()):\n\n if i in dic1:\n\n ans += dic1[i] * dic2[i]\n\n #print(i)\n\nprint((ans \/\/ 2))\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\nimport collections\n\nans = 0\n\ndic = collections.defaultdict(int)\n\nfor i in range(1, n + 1):\n\n ans += dic[i - a[i - 1]]\n\n dic[i + a[i - 1]] += 1\n\nprint(ans)","code_v0_loc":27,"code_v1_loc":9,"code_v0_num_chars":606,"code_v1_num_chars":215,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\na_index = []\nfor i in range(n):\n a_index.append((i, a[i]))\ndic1 = {}\ndic2 = {}\nfor i in range(n):\n one = a_index[i][0] + a_index[i][1]\n two = a_index[i][0] - a_index[i][1]\n if one not in dic1:\n dic1[one] = 1\n else:\n dic1[one] += 1\n if two not in dic2:\n dic2[two] = 1\n else:\n dic2[two] += 1\nans = 0\nfor i in list(dic1.keys()):\n if i in dic2:\n ans += dic2[i] * dic1[i]\nfor i in list(dic2.keys()):\n if i in dic1:\n ans += dic1[i] * dic2[i]\n # print(i)\nprint((ans \/\/ 2))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nimport collections\n\nans = 0\ndic = collections.defaultdict(int)\nfor i in range(1, n + 1):\n ans += dic[i - a[i - 1]]\n dic[i + a[i - 1]] += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-a_index = []","-for i in range(n):","- a_index.append((i, a[i]))","-dic1 = {}","-dic2 = {}","-for i in range(n):","- one = a_index[i][0] + a_index[i][1]","- two = a_index[i][0] - a_index[i][1]","- if one not in dic1:","- dic1[one] = 1","- else:","- dic1[one] += 1","- if two not in dic2:","- dic2[two] = 1","- else:","- dic2[two] += 1","+import collections","+","-for i in list(dic1.keys()):","- if i in dic2:","- ans += dic2[i] * dic1[i]","-for i in list(dic2.keys()):","- if i in dic1:","- ans += dic1[i] * dic2[i]","- # print(i)","-print((ans \/\/ 2))","+dic = collections.defaultdict(int)","+for i in range(1, n + 1):","+ ans += dic[i - a[i - 1]]","+ dic[i + a[i - 1]] += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3792731187,"measured_runtime_v1":0.2976846831,"runtime_lift":1.2740767002,"key":["s116716284","s825945845"]} +{"user_id":"u123756661","problem_id":"p03835","language":"python","submission_id_v0":"s113088304","submission_id_v1":"s025062934","cpu_time_v0":1218,"cpu_time_v1":258,"memory_v0":2940,"memory_v1":41580,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk,s=list(map(int,input().split()))\n\nans=chk=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if (0<=s-i-j<=k): ans+=1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"k,s=list(map(int,input().split()))\n\nans=0\n\nx=min(k+1,s+1)\n\ny=max(0,s-k-k)\n\nfor i in range(y,x):\n\n for j in range(y,x):\n\n if i+j>s: break\n\n if 0<=s-i-j<=k:\n\n ans+=1\n\nprint(ans)","code_v0_loc":6,"code_v1_loc":10,"code_v0_num_chars":133,"code_v1_num_chars":197,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\nans = chk = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"k, s = list(map(int, input().split()))\nans = 0\nx = min(k + 1, s + 1)\ny = max(0, s - k - k)\nfor i in range(y, x):\n for j in range(y, x):\n if i + j > s:\n break\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-ans = chk = 0","-for i in range(k + 1):","- for j in range(k + 1):","+ans = 0","+x = min(k + 1, s + 1)","+y = max(0, s - k - k)","+for i in range(y, x):","+ for j in range(y, x):","+ if i + j > s:","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.3946401063,"measured_runtime_v1":0.3009130723,"runtime_lift":1.3114754477,"key":["s113088304","s025062934"]} +{"user_id":"u761320129","problem_id":"p03564","language":"python","submission_id_v0":"s515134391","submission_id_v1":"s980600609","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,K = int(eval(input())), int(eval(input()))\n\nnow = 1\n\nfor i in range(N):\n\n if now*2 < now + K:\n\n now *= 2\n\n else:\n\n now += K\n\nprint(now)\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nK = int(eval(input()))\n\nans = 1\n\nfor i in range(N):\n\n if ans < K:\n\n ans *= 2\n\n else:\n\n ans += K\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":9,"code_v0_num_chars":146,"code_v1_num_chars":139,"code_v0_no_empty_lines":"N, K = int(eval(input())), int(eval(input()))\nnow = 1\nfor i in range(N):\n if now * 2 < now + K:\n now *= 2\n else:\n now += K\nprint(now)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nK = int(eval(input()))\nans = 1\nfor i in range(N):\n if ans < K:\n ans *= 2\n else:\n ans += K\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-N, K = int(eval(input())), int(eval(input()))","-now = 1","+N = int(eval(input()))","+K = int(eval(input()))","+ans = 1","- if now * 2 < now + K:","- now *= 2","+ if ans < K:","+ ans *= 2","- now += K","-print(now)","+ ans += K","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2990638907,"measured_runtime_v1":0.1086408798,"runtime_lift":2.7527749338,"key":["s515134391","s980600609"]} +{"user_id":"u029000441","problem_id":"p02850","language":"python","submission_id_v0":"s037775300","submission_id_v1":"s014062604","cpu_time_v0":655,"cpu_time_v1":577,"memory_v0":74684,"memory_v1":85652,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#d3\u3068\u540c\u4e00\u89e3\u6cd5\n\nn=int(eval(input()))\n\nimport sys\n\n#\u518d\u5e30\u95a2\u6570\u306e\u518d\u5e30\u56de\u6570\u3092\u5909\u66f4\n\nsys.setrecursionlimit(10**6)\n\ns=[[] for _ in range(n)]\n\n\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n s[a-1].append((b-1,i))\n\n s[b-1].append((a-1,i))\n\n\n\nl=[0]*(n-1)\n\n\n\ndef dfs(node,pre_col,par):\n\n col=1\n\n for nei,i in s[node]:\n\n if nei==par:\n\n continue\n\n if col==pre_col:\n\n col+=1\n\n l[i]=col\n\n dfs(nei,col,node)\n\n col+=1\n\ndfs(0,-1,-1)\n\nprint((max(l)))\n\nfor i in l:\n\n print(i)\n\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(500000)\n\nN = int(eval(input()))\n\nE = [[] for _ in range(N+1)]\n\nfor i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n E[a].append((b, i))\n\n E[b].append((a, i))\n\nK = max(len(e) for e in E)\n\nprint(K)\n\nAns = [-1] * (N-1)\n\ndef dfs(v=1, p=0, p_col=-1):\n\n col = 1\n\n for u, idx in E[v]:\n\n if u!=p: #\u6728\u69cb\u9020\u306e\u9006\u5411\u304d\u306e\u77e2\u5370\u3092\u9664\u304f\u305f\u3081\u306e\u6761\u4ef6\n\n if col == p_col:\n\n col += 1\n\n Ans[idx] = col\n\n #print(p_col)\n\n dfs(u, v, col) #u;\u8abf\u3079\u308b\u9802\u70b9 v;\u76f4\u524d\u306b\u8abf\u3079\u305f\u8fba\u3067\u3001\u8abf\u3079\u308b\u9802\u70b9\u3068\u7d50\u3070\u308c\u3066\u3044\u308b\u9802\u70b9\u3000col;\u76f4\u524d\u306b\u8abf\u3079\u305f\u8fba\u306e\u8272\u756a\u53f7\n\n col += 1 #\u6700\u6df1\u90e8\u307e\u3067\u8abf\u3079\u305f\u3089 \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8272=\u6700\u5f8c\u306b\u8abf\u3079\u305f\u8fba\u306e\u8272+1\u3068\u3059\u308b\n\n #\u6700\u6df1\u90e8\u306b\u7e4b\u304c\u3063\u305f\u8fba\u306e\u8272+1\u3057\u3066\u3084\u308c\u3070\u3001\u6b21\u306e\u8fba\u306e\u8272\u306f\u5fc5\u305a\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u304f\u308c\u308b\n\n\n\ndfs()\n\nprint((\"\\n\".join(map(str, Ans))))\n","code_v0_loc":28,"code_v1_loc":25,"code_v0_num_chars":512,"code_v1_num_chars":704,"code_v0_no_empty_lines":"# d3\u3068\u540c\u4e00\u89e3\u6cd5\nn = int(eval(input()))\nimport sys\n\n# \u518d\u5e30\u95a2\u6570\u306e\u518d\u5e30\u56de\u6570\u3092\u5909\u66f4\nsys.setrecursionlimit(10**6)\ns = [[] for _ in range(n)]\nfor i in range(n - 1):\n a, b = list(map(int, input().split()))\n s[a - 1].append((b - 1, i))\n s[b - 1].append((a - 1, i))\nl = [0] * (n - 1)\n\n\ndef dfs(node, pre_col, par):\n col = 1\n for nei, i in s[node]:\n if nei == par:\n continue\n if col == pre_col:\n col += 1\n l[i] = col\n dfs(nei, col, node)\n col += 1\n\n\ndfs(0, -1, -1)\nprint((max(l)))\nfor i in l:\n print(i)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(500000)\nN = int(eval(input()))\nE = [[] for _ in range(N + 1)]\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n E[a].append((b, i))\n E[b].append((a, i))\nK = max(len(e) for e in E)\nprint(K)\nAns = [-1] * (N - 1)\n\n\ndef dfs(v=1, p=0, p_col=-1):\n col = 1\n for u, idx in E[v]:\n if u != p: # \u6728\u69cb\u9020\u306e\u9006\u5411\u304d\u306e\u77e2\u5370\u3092\u9664\u304f\u305f\u3081\u306e\u6761\u4ef6\n if col == p_col:\n col += 1\n Ans[idx] = col\n # print(p_col)\n dfs(u, v, col) # u;\u8abf\u3079\u308b\u9802\u70b9 v;\u76f4\u524d\u306b\u8abf\u3079\u305f\u8fba\u3067\u3001\u8abf\u3079\u308b\u9802\u70b9\u3068\u7d50\u3070\u308c\u3066\u3044\u308b\u9802\u70b9\u3000col;\u76f4\u524d\u306b\u8abf\u3079\u305f\u8fba\u306e\u8272\u756a\u53f7\n col += 1 # \u6700\u6df1\u90e8\u307e\u3067\u8abf\u3079\u305f\u3089 \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8272=\u6700\u5f8c\u306b\u8abf\u3079\u305f\u8fba\u306e\u8272+1\u3068\u3059\u308b\n # \u6700\u6df1\u90e8\u306b\u7e4b\u304c\u3063\u305f\u8fba\u306e\u8272+1\u3057\u3066\u3084\u308c\u3070\u3001\u6b21\u306e\u8fba\u306e\u8272\u306f\u5fc5\u305a\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u304f\u308c\u308b\n\n\ndfs()\nprint((\"\\n\".join(map(str, Ans))))\n","code_same":false,"relative_loc_diff_percent":10.7142857143,"diff":["-# d3\u3068\u540c\u4e00\u89e3\u6cd5","-n = int(eval(input()))","-# \u518d\u5e30\u95a2\u6570\u306e\u518d\u5e30\u56de\u6570\u3092\u5909\u66f4","-sys.setrecursionlimit(10**6)","-s = [[] for _ in range(n)]","-for i in range(n - 1):","+sys.setrecursionlimit(500000)","+N = int(eval(input()))","+E = [[] for _ in range(N + 1)]","+for i in range(N - 1):","- s[a - 1].append((b - 1, i))","- s[b - 1].append((a - 1, i))","-l = [0] * (n - 1)","+ E[a].append((b, i))","+ E[b].append((a, i))","+K = max(len(e) for e in E)","+print(K)","+Ans = [-1] * (N - 1)","-def dfs(node, pre_col, par):","+def dfs(v=1, p=0, p_col=-1):","- for nei, i in s[node]:","- if nei == par:","- continue","- if col == pre_col:","- col += 1","- l[i] = col","- dfs(nei, col, node)","- col += 1","+ for u, idx in E[v]:","+ if u != p: # \u6728\u69cb\u9020\u306e\u9006\u5411\u304d\u306e\u77e2\u5370\u3092\u9664\u304f\u305f\u3081\u306e\u6761\u4ef6","+ if col == p_col:","+ col += 1","+ Ans[idx] = col","+ # print(p_col)","+ dfs(u, v, col) # u;\u8abf\u3079\u308b\u9802\u70b9 v;\u76f4\u524d\u306b\u8abf\u3079\u305f\u8fba\u3067\u3001\u8abf\u3079\u308b\u9802\u70b9\u3068\u7d50\u3070\u308c\u3066\u3044\u308b\u9802\u70b9\u3000col;\u76f4\u524d\u306b\u8abf\u3079\u305f\u8fba\u306e\u8272\u756a\u53f7","+ col += 1 # \u6700\u6df1\u90e8\u307e\u3067\u8abf\u3079\u305f\u3089 \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8272=\u6700\u5f8c\u306b\u8abf\u3079\u305f\u8fba\u306e\u8272+1\u3068\u3059\u308b","+ # \u6700\u6df1\u90e8\u306b\u7e4b\u304c\u3063\u305f\u8fba\u306e\u8272+1\u3057\u3066\u3084\u308c\u3070\u3001\u6b21\u306e\u8fba\u306e\u8272\u306f\u5fc5\u305a\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u304f\u308c\u308b","-dfs(0, -1, -1)","-print((max(l)))","-for i in l:","- print(i)","+dfs()","+print((\"\\n\".join(map(str, Ans))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2935128241,"measured_runtime_v1":0.2145129414,"runtime_lift":1.3682756023,"key":["s037775300","s014062604"]} +{"user_id":"u055875839","problem_id":"p03494","language":"python","submission_id_v0":"s284976980","submission_id_v1":"s533147628","cpu_time_v0":151,"cpu_time_v1":19,"memory_v0":12508,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\neval(input())\n\n\n\nimport numpy as np\n\nA = np.array(list(map(int, input().split(\" \"))))\n\na = 0\n\n\n\nwhile np.sum(A%2) == 0:\n\n A = A\/2\n\n a = a + 1\n\n\n\nprint(a)\n\n# optimized version of the same code:\n","target":"eval(input())\n\n\n\nA = list(map(int, input().split(\" \")))\n\nB = 0\n\n\n\nwhile all(a%2 == 0 for a in A):\n\n A = [a\/2 for a in A]\n\n B += 1\n\n \n\nprint(B)\n\n ","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":149,"code_v1_num_chars":145,"code_v0_no_empty_lines":"eval(input())\nimport numpy as np\n\nA = np.array(list(map(int, input().split(\" \"))))\na = 0\nwhile np.sum(A % 2) == 0:\n A = A \/ 2\n a = a + 1\nprint(a)\n","code_v1_no_empty_lines":"eval(input())\nA = list(map(int, input().split(\" \")))\nB = 0\nwhile all(a % 2 == 0 for a in A):\n A = [a \/ 2 for a in A]\n B += 1\nprint(B)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","-","-A = np.array(list(map(int, input().split(\" \"))))","-a = 0","-while np.sum(A % 2) == 0:","- A = A \/ 2","- a = a + 1","-print(a)","+A = list(map(int, input().split(\" \")))","+B = 0","+while all(a % 2 == 0 for a in A):","+ A = [a \/ 2 for a in A]","+ B += 1","+print(B)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3803981676,"measured_runtime_v1":0.2073892272,"runtime_lift":6.6560746019,"key":["s284976980","s533147628"]} +{"user_id":"u177388368","problem_id":"p02881","language":"python","submission_id_v0":"s386884404","submission_id_v1":"s516418112","cpu_time_v0":474,"cpu_time_v1":256,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.99,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nn=int(eval(input()))\n\nans=n\n\ni=1\n\nwhile(i<=math.sqrt(n)):\n\n if n%i==0:\n\n d=i+n\/i-2\n\n ans=min(ans,d)\n\n i+=1\n\nprint((int(ans)))\n\n# optimized version of the same code:\n","target":"from math import floor\n\nfrom math import sqrt\n\nn=int(eval(input()))\n\nnn=floor(sqrt(n))\n\nrest=n%nn\n\nwhile rest!=0:\n\n nn-=1\n\n rest=n%nn\n\nnnn=n\/nn\n\nprint((int(nn+nnn-2)))","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":150,"code_v1_num_chars":165,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nans = n\ni = 1\nwhile i <= math.sqrt(n):\n if n % i == 0:\n d = i + n \/ i - 2\n ans = min(ans, d)\n i += 1\nprint((int(ans)))\n","code_v1_no_empty_lines":"from math import floor\nfrom math import sqrt\n\nn = int(eval(input()))\nnn = floor(sqrt(n))\nrest = n % nn\nwhile rest != 0:\n nn -= 1\n rest = n % nn\nnnn = n \/ nn\nprint((int(nn + nnn - 2)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import math","+from math import floor","+from math import sqrt","-ans = n","-i = 1","-while i <= math.sqrt(n):","- if n % i == 0:","- d = i + n \/ i - 2","- ans = min(ans, d)","- i += 1","-print((int(ans)))","+nn = floor(sqrt(n))","+rest = n % nn","+while rest != 0:","+ nn -= 1","+ rest = n % nn","+nnn = n \/ nn","+print((int(nn + nnn - 2)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3770523396,"measured_runtime_v1":0.2395324836,"runtime_lift":1.5741177727,"key":["s386884404","s516418112"]} +{"user_id":"u275934251","problem_id":"p03796","language":"python","submission_id_v0":"s111144925","submission_id_v1":"s028336395","cpu_time_v0":229,"cpu_time_v1":37,"memory_v0":3980,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.84,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\nN = int(eval(input()))\n\n\n\npower = math.factorial(N)\n\n\n\nprint((power % 1000000007))\n\n\n\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\nans=1\n\nfor i in range(n):\n\n ans=(ans*(i+1))%(10**9+7)\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":5,"code_v0_num_chars":92,"code_v1_num_chars":84,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\npower = math.factorial(N)\nprint((power % 1000000007))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = 1\nfor i in range(n):\n ans = (ans * (i + 1)) % (10**9 + 7)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-import math","-","-N = int(eval(input()))","-power = math.factorial(N)","-print((power % 1000000007))","+n = int(eval(input()))","+ans = 1","+for i in range(n):","+ ans = (ans * (i + 1)) % (10**9 + 7)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.7185150633,"measured_runtime_v1":0.3322105608,"runtime_lift":2.1628302891,"key":["s111144925","s028336395"]} +{"user_id":"u353797797","problem_id":"p03170","language":"python","submission_id_v0":"s365373544","submission_id_v1":"s835744397","cpu_time_v0":126,"cpu_time_v1":112,"memory_v0":3828,"memory_v1":3828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii <= k:\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n\n\n# optimized version of the same code:\n","target":"n, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii > k:break\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":271,"code_v1_num_chars":271,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\na_s = list(map(int, input().split()))\ndp = [\"Second\"] * (k + 1)\nfor i in range(k + 1):\n if dp[i] == \"Second\":\n for a in a_s:\n ii = i + a\n if ii <= k:\n dp[ii] = \"First\"\nprint((dp[-1]))\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\na_s = list(map(int, input().split()))\ndp = [\"Second\"] * (k + 1)\nfor i in range(k + 1):\n if dp[i] == \"Second\":\n for a in a_s:\n ii = i + a\n if ii > k:\n break\n dp[ii] = \"First\"\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if ii <= k:","- dp[ii] = \"First\"","+ if ii > k:","+ break","+ dp[ii] = \"First\""],"diff_only_import_comment":false,"measured_runtime_v0":0.3611531999,"measured_runtime_v1":0.2298232606,"runtime_lift":1.5714388476,"key":["s365373544","s835744397"]} +{"user_id":"u604839890","problem_id":"p02622","language":"python","submission_id_v0":"s830524393","submission_id_v1":"s723518358","cpu_time_v0":83,"cpu_time_v1":70,"memory_v0":85616,"memory_v1":73748,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.66,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS, T = [list(eval(input())) for _ in range(2)]\n\ncnt = 0\n\nfor i in range(len(S)):\n\n if S[i] != T[i]:\n\n cnt += 1\n\nprint(cnt)\n\n\n# optimized version of the same code:\n","target":"s, t = [eval(input()) for i in range(2)]\n\nans = 0\n\nfor i in range(len(s)):\n\n if s[i] != t[i]:\n\n ans += 1\n\nprint(ans)","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":127,"code_v1_num_chars":114,"code_v0_no_empty_lines":"S, T = [list(eval(input())) for _ in range(2)]\ncnt = 0\nfor i in range(len(S)):\n if S[i] != T[i]:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"s, t = [eval(input()) for i in range(2)]\nans = 0\nfor i in range(len(s)):\n if s[i] != t[i]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S, T = [list(eval(input())) for _ in range(2)]","-cnt = 0","-for i in range(len(S)):","- if S[i] != T[i]:","- cnt += 1","-print(cnt)","+s, t = [eval(input()) for i in range(2)]","+ans = 0","+for i in range(len(s)):","+ if s[i] != t[i]:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2683959379,"measured_runtime_v1":0.2054475396,"runtime_lift":1.3063964576,"key":["s830524393","s723518358"]} +{"user_id":"u644907318","problem_id":"p02886","language":"python","submission_id_v0":"s745140004","submission_id_v1":"s021490246","cpu_time_v0":167,"cpu_time_v1":89,"memory_v0":38512,"memory_v1":61656,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N-1):\n\n for j in range(i+1,N):\n\n cnt += D[i]*D[j]\n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += D[i]**2\n\ntot = 0\n\nfor i in range(N):\n\n tot += D[i]\n\ntot = tot**2\n\ntot -= cnt\n\nprint((tot\/\/2))","code_v0_loc":7,"code_v1_loc":11,"code_v0_num_chars":149,"code_v1_num_chars":188,"code_v0_no_empty_lines":"N = int(eval(input()))\nD = list(map(int, input().split()))\ncnt = 0\nfor i in range(N - 1):\n for j in range(i + 1, N):\n cnt += D[i] * D[j]\nprint(cnt)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nD = list(map(int, input().split()))\ncnt = 0\nfor i in range(N):\n cnt += D[i] ** 2\ntot = 0\nfor i in range(N):\n tot += D[i]\ntot = tot**2\ntot -= cnt\nprint((tot \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-for i in range(N - 1):","- for j in range(i + 1, N):","- cnt += D[i] * D[j]","-print(cnt)","+for i in range(N):","+ cnt += D[i] ** 2","+tot = 0","+for i in range(N):","+ tot += D[i]","+tot = tot**2","+tot -= cnt","+print((tot \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2884610276,"measured_runtime_v1":0.2260356005,"runtime_lift":1.2761751997,"key":["s745140004","s021490246"]} +{"user_id":"u257162238","problem_id":"p02691","language":"python","submission_id_v0":"s433671213","submission_id_v1":"s939654113","cpu_time_v0":930,"cpu_time_v1":228,"memory_v0":50980,"memory_v1":66228,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import deque\n\nfrom itertools import product\n\nimport sys\n\nimport math\n\nimport numpy as np\n\nimport bisect\n\n\n\nsys.setrecursionlimit(200000)\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef read():\n\n N = int(input().strip())\n\n A = list(map(int, input().strip().split()))\n\n return N, A\n\n\n\n\n\ndef argsort(seq):\n\n return sorted(list(range(len(seq))), key=seq.__getitem__)\n\n\n\ndef solve(N, A):\n\n # x: i-A[i]\u306e\u5217\n\n X = np.array([i-A[i] for i in range(N)], dtype=np.int)\n\n # y: i+A[i]\u306e\u5217\n\n Y = np.array([i+A[i] for i in range(N)], dtype=np.int)\n\n keys = np.argsort(X)\n\n X = X[keys] # x[i] <= x[i+1]\n\n Y = Y[keys]\n\n ans = 0\n\n for y in Y:\n\n l = bisect.bisect_left(X, y)\n\n r = bisect.bisect_left(X, y+1)\n\n ans += r - l\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n inputs = read()\n\n outputs = solve(*inputs)\n\n print((\"{}\".format(outputs)))\n\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\nfrom itertools import product\n\nimport sys\n\nimport math\n\nimport bisect\n\n\n\nsys.setrecursionlimit(200000)\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef read():\n\n N = int(input().strip())\n\n A = list(map(int, input().strip().split()))\n\n return N, A\n\n\n\n\n\ndef solve(N, A):\n\n # x: i-A[i]\u306e\u5217\n\n X = [i-A[i] for i in range(N)]\n\n # y: i+A[i]\u306e\u5217\n\n Y = [i+A[i] for i in range(N)]\n\n z = defaultdict(int)\n\n for y in Y:\n\n z[y] += 1\n\n return sum([z[x] for x in X])\n\n\n\n\n\nif __name__ == '__main__':\n\n inputs = read()\n\n outputs = solve(*inputs)\n\n print((\"{}\".format(outputs)))\n","code_v0_loc":40,"code_v1_loc":31,"code_v0_num_chars":893,"code_v1_num_chars":626,"code_v0_no_empty_lines":"from collections import deque\nfrom itertools import product\nimport sys\nimport math\nimport numpy as np\nimport bisect\n\nsys.setrecursionlimit(200000)\ninput = sys.stdin.readline\n\n\ndef read():\n N = int(input().strip())\n A = list(map(int, input().strip().split()))\n return N, A\n\n\ndef argsort(seq):\n return sorted(list(range(len(seq))), key=seq.__getitem__)\n\n\ndef solve(N, A):\n # x: i-A[i]\u306e\u5217\n X = np.array([i - A[i] for i in range(N)], dtype=np.int)\n # y: i+A[i]\u306e\u5217\n Y = np.array([i + A[i] for i in range(N)], dtype=np.int)\n keys = np.argsort(X)\n X = X[keys] # x[i] <= x[i+1]\n Y = Y[keys]\n ans = 0\n for y in Y:\n l = bisect.bisect_left(X, y)\n r = bisect.bisect_left(X, y + 1)\n ans += r - l\n return ans\n\n\nif __name__ == \"__main__\":\n inputs = read()\n outputs = solve(*inputs)\n print((\"{}\".format(outputs)))\n","code_v1_no_empty_lines":"from collections import defaultdict\nfrom itertools import product\nimport sys\nimport math\nimport bisect\n\nsys.setrecursionlimit(200000)\ninput = sys.stdin.readline\n\n\ndef read():\n N = int(input().strip())\n A = list(map(int, input().strip().split()))\n return N, A\n\n\ndef solve(N, A):\n # x: i-A[i]\u306e\u5217\n X = [i - A[i] for i in range(N)]\n # y: i+A[i]\u306e\u5217\n Y = [i + A[i] for i in range(N)]\n z = defaultdict(int)\n for y in Y:\n z[y] += 1\n return sum([z[x] for x in X])\n\n\nif __name__ == \"__main__\":\n inputs = read()\n outputs = solve(*inputs)\n print((\"{}\".format(outputs)))\n","code_same":false,"relative_loc_diff_percent":22.5,"diff":["-from collections import deque","+from collections import defaultdict","-import numpy as np","-def argsort(seq):","- return sorted(list(range(len(seq))), key=seq.__getitem__)","-","-","- X = np.array([i - A[i] for i in range(N)], dtype=np.int)","+ X = [i - A[i] for i in range(N)]","- Y = np.array([i + A[i] for i in range(N)], dtype=np.int)","- keys = np.argsort(X)","- X = X[keys] # x[i] <= x[i+1]","- Y = Y[keys]","- ans = 0","+ Y = [i + A[i] for i in range(N)]","+ z = defaultdict(int)","- l = bisect.bisect_left(X, y)","- r = bisect.bisect_left(X, y + 1)","- ans += r - l","- return ans","+ z[y] += 1","+ return sum([z[x] for x in X])"],"diff_only_import_comment":false,"measured_runtime_v0":1.2892834942,"measured_runtime_v1":0.2085203347,"runtime_lift":6.1830108603,"key":["s433671213","s939654113"]} +{"user_id":"u094191970","problem_id":"p02899","language":"python","submission_id_v0":"s681282504","submission_id_v1":"s043765093","cpu_time_v0":508,"cpu_time_v1":204,"memory_v0":23412,"memory_v1":23592,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.84,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn=int(eval(input()))\n\ns=np.argsort(np.array(list(map(int,input().split()))))+1\n\nprint((*s))\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\nl=sorted([[inx+1,j] for inx,j in enumerate(a)],key=lambda x:x[1])\n\nans=[i for i,j in l]\n\nprint((*ans))","code_v0_loc":4,"code_v1_loc":5,"code_v0_num_chars":103,"code_v1_num_chars":150,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\ns = np.argsort(np.array(list(map(int, input().split())))) + 1\nprint((*s))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nl = sorted([[inx + 1, j] for inx, j in enumerate(a)], key=lambda x: x[1])\nans = [i for i, j in l]\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import numpy as np","-","-s = np.argsort(np.array(list(map(int, input().split())))) + 1","-print((*s))","+a = list(map(int, input().split()))","+l = sorted([[inx + 1, j] for inx, j in enumerate(a)], key=lambda x: x[1])","+ans = [i for i, j in l]","+print((*ans))"],"diff_only_import_comment":false,"measured_runtime_v0":1.8138762745,"measured_runtime_v1":0.2870095253,"runtime_lift":6.3199166387,"key":["s681282504","s043765093"]} +{"user_id":"u337765821","problem_id":"p03078","language":"python","submission_id_v0":"s578367863","submission_id_v1":"s821092078","cpu_time_v0":1959,"cpu_time_v1":1759,"memory_v0":14660,"memory_v1":4712,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.21,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nimport itertools\n\n\n\nX, Y, Z, K = tuple([int(x) for x in str(eval(input())).split(' ')])\n\n\n\nA = np.array(sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True))\n\nB = np.array(sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True))\n\nC = np.array(sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True))\n\n\n\ntmp = {(0, 0, 0) : A[0] + B[0] + C[0]}\n\ntmp_keys = [(0, 0 ,0)]\n\nout = []\n\n\n\nfor i in range(K):\n\n (a, b, c), p = max(list(tmp.items()), key=lambda x : x[1])\n\n out.append(tmp.pop((a, b, c)))\n\n\n\n keys = []\n\n if a < X - 1:\n\n keys.append((a+1, b, c))\n\n if b < Y - 1:\n\n keys.append((a, b+1, c))\n\n if c < Z - 1:\n\n keys.append((a, b, c+1))\n\n \n\n for key in keys:\n\n if key not in tmp_keys:\n\n tmp[key] = A[key[0]] + B[key[1]] + C[key[2]]\n\n tmp_keys.append(key)\n\n\n\nfor x in out:\n\n print(x)\n\n# optimized version of the same code:\n","target":"import itertools\n\n\n\nX, Y, Z, K = tuple([int(x) for x in str(eval(input())).split(' ')])\n\n\n\nA = sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True)\n\nB = sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True)\n\nC = sorted([int(x) for x in str(eval(input())).split(' ')], reverse=True)\n\n\n\ntmp = {(0, 0, 0) : A[0] + B[0] + C[0]}\n\ntmp_keys = [(0, 0 ,0)]\n\nout = []\n\n\n\nfor i in range(K):\n\n (a, b, c), p = max(list(tmp.items()), key=lambda x : x[1])\n\n out.append(tmp.pop((a, b, c)))\n\n\n\n keys = []\n\n if a < X - 1:\n\n keys.append((a+1, b, c))\n\n if b < Y - 1:\n\n keys.append((a, b+1, c))\n\n if c < Z - 1:\n\n keys.append((a, b, c+1))\n\n \n\n for key in keys:\n\n if key not in tmp_keys:\n\n tmp[key] = A[key[0]] + B[key[1]] + C[key[2]]\n\n tmp_keys.append(key)\n\n\n\nfor x in out:\n\n print(x)","code_v0_loc":32,"code_v1_loc":31,"code_v0_num_chars":893,"code_v1_num_chars":843,"code_v0_no_empty_lines":"import numpy as np\nimport itertools\n\nX, Y, Z, K = tuple([int(x) for x in str(eval(input())).split(\" \")])\nA = np.array(sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True))\nB = np.array(sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True))\nC = np.array(sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True))\ntmp = {(0, 0, 0): A[0] + B[0] + C[0]}\ntmp_keys = [(0, 0, 0)]\nout = []\nfor i in range(K):\n (a, b, c), p = max(list(tmp.items()), key=lambda x: x[1])\n out.append(tmp.pop((a, b, c)))\n keys = []\n if a < X - 1:\n keys.append((a + 1, b, c))\n if b < Y - 1:\n keys.append((a, b + 1, c))\n if c < Z - 1:\n keys.append((a, b, c + 1))\n for key in keys:\n if key not in tmp_keys:\n tmp[key] = A[key[0]] + B[key[1]] + C[key[2]]\n tmp_keys.append(key)\nfor x in out:\n print(x)\n","code_v1_no_empty_lines":"import itertools\n\nX, Y, Z, K = tuple([int(x) for x in str(eval(input())).split(\" \")])\nA = sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True)\nB = sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True)\nC = sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True)\ntmp = {(0, 0, 0): A[0] + B[0] + C[0]}\ntmp_keys = [(0, 0, 0)]\nout = []\nfor i in range(K):\n (a, b, c), p = max(list(tmp.items()), key=lambda x: x[1])\n out.append(tmp.pop((a, b, c)))\n keys = []\n if a < X - 1:\n keys.append((a + 1, b, c))\n if b < Y - 1:\n keys.append((a, b + 1, c))\n if c < Z - 1:\n keys.append((a, b, c + 1))\n for key in keys:\n if key not in tmp_keys:\n tmp[key] = A[key[0]] + B[key[1]] + C[key[2]]\n tmp_keys.append(key)\nfor x in out:\n print(x)\n","code_same":false,"relative_loc_diff_percent":3.125,"diff":["-import numpy as np","-A = np.array(sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True))","-B = np.array(sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True))","-C = np.array(sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True))","+A = sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True)","+B = sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True)","+C = sorted([int(x) for x in str(eval(input())).split(\" \")], reverse=True)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3399388783,"measured_runtime_v1":0.2194988892,"runtime_lift":6.1045360324,"key":["s578367863","s821092078"]} +{"user_id":"u609061751","problem_id":"p02792","language":"python","submission_id_v0":"s119665759","submission_id_v1":"s980465183","cpu_time_v0":262,"cpu_time_v1":107,"memory_v0":40556,"memory_v1":68292,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nN = int(eval(input()))\n\nketa = len(str(N))\n\nif keta == 1:\n\n print(N)\n\n sys.exit()\n\nans = {}\n\nfor i in [1,2,3,4,5,6,7,8,9]:\n\n for j in [1,2,3,4,5,6,7,8,9]:\n\n ans[(i, j)] = 0\n\nfor i in range(1, N+1):\n\n maxdigit = int(str(i)[0])\n\n mindigit = int(str(i)[-1])\n\n if mindigit != 0:\n\n ans[(maxdigit, mindigit)] += 1\n\ncnt = 0\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n if i == j:\n\n cnt += ans[(i, i)] ** 2\n\n else:\n\n cnt += ans[(i, j)] * ans[(j, i)] * 2\n\n ans[(i, j)] = 0\n\n ans[(j, i)] = 0\n\nprint(cnt)\n\n\n\n \n\n\n\n \n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(eval(input()))\n\n\n\nfrom collections import defaultdict\n\n\n\nd = defaultdict(int) # d[(a, b)] : \u5148\u982da, \u672b\u5c3eb\n\n\n\nfor i in range(1, n + 1):\n\n i_str = str(i)\n\n d[(i_str[0], i_str[-1])] += 1\n\n\n\nans = 0\n\n\n\nfor i in range(1, 10):\n\n for j in range(10):\n\n ans += d[(str(i), str(j))] * d[(str(j), str(i))]\n\n\n\nprint(ans)","code_v0_loc":30,"code_v1_loc":20,"code_v0_num_chars":646,"code_v1_num_chars":362,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nketa = len(str(N))\nif keta == 1:\n print(N)\n sys.exit()\nans = {}\nfor i in [1, 2, 3, 4, 5, 6, 7, 8, 9]:\n for j in [1, 2, 3, 4, 5, 6, 7, 8, 9]:\n ans[(i, j)] = 0\nfor i in range(1, N + 1):\n maxdigit = int(str(i)[0])\n mindigit = int(str(i)[-1])\n if mindigit != 0:\n ans[(maxdigit, mindigit)] += 1\ncnt = 0\nfor i in range(1, 10):\n for j in range(1, 10):\n if i == j:\n cnt += ans[(i, i)] ** 2\n else:\n cnt += ans[(i, j)] * ans[(j, i)] * 2\n ans[(i, j)] = 0\n ans[(j, i)] = 0\nprint(cnt)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn = int(eval(input()))\nfrom collections import defaultdict\n\nd = defaultdict(int) # d[(a, b)] : \u5148\u982da, \u672b\u5c3eb\nfor i in range(1, n + 1):\n i_str = str(i)\n d[(i_str[0], i_str[-1])] += 1\nans = 0\nfor i in range(1, 10):\n for j in range(10):\n ans += d[(str(i), str(j))] * d[(str(j), str(i))]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-N = int(eval(input()))","-keta = len(str(N))","-if keta == 1:","- print(N)","- sys.exit()","-ans = {}","-for i in [1, 2, 3, 4, 5, 6, 7, 8, 9]:","- for j in [1, 2, 3, 4, 5, 6, 7, 8, 9]:","- ans[(i, j)] = 0","-for i in range(1, N + 1):","- maxdigit = int(str(i)[0])","- mindigit = int(str(i)[-1])","- if mindigit != 0:","- ans[(maxdigit, mindigit)] += 1","-cnt = 0","+n = int(eval(input()))","+from collections import defaultdict","+","+d = defaultdict(int) # d[(a, b)] : \u5148\u982da, \u672b\u5c3eb","+for i in range(1, n + 1):","+ i_str = str(i)","+ d[(i_str[0], i_str[-1])] += 1","+ans = 0","- for j in range(1, 10):","- if i == j:","- cnt += ans[(i, i)] ** 2","- else:","- cnt += ans[(i, j)] * ans[(j, i)] * 2","- ans[(i, j)] = 0","- ans[(j, i)] = 0","-print(cnt)","+ for j in range(10):","+ ans += d[(str(i), str(j))] * d[(str(j), str(i))]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3769399883,"measured_runtime_v1":0.2785774942,"runtime_lift":1.3530884443,"key":["s119665759","s980465183"]} +{"user_id":"u161164709","problem_id":"p02555","language":"python","submission_id_v0":"s764735536","submission_id_v1":"s736916531","cpu_time_v0":121,"cpu_time_v1":27,"memory_v0":9164,"memory_v1":9180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":77.69,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import factorial\n\n\n\ns = int(eval(input()))\n\nmod = pow(10, 9) + 7\n\n\n\n\n\ndef nCr(n, r):\n\n return int(factorial(n) \/\/ factorial(r) \/\/ factorial (n - r) % mod)\n\n\n\nans = 0\n\nseq_len = s \/\/ 3\n\n\n\nfor i in range(1, seq_len + 1):\n\n ans += nCr(s - 3 * i + (i - 1), i - 1)\n\n\n\nprint((ans % mod))\n\n# optimized version of the same code:\n","target":"# \u52d5\u7684\u8a08\u753b\u6cd5\u306b\u3088\u308b\u89e3\u6cd5\n\n\n\ns = int(eval(input()))\n\nmod = pow(10, 9) + 7\n\n\n\nA = [0] * (s + 1)\n\n\n\nif s >= 3:\n\n A[3] = 1\n\n\n\nfor i in range(4, s + 1):\n\n A[i] = (A[i - 3] + A[i - 1]) % mod\n\n\n\nprint((A[s]))","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":289,"code_v1_num_chars":187,"code_v0_no_empty_lines":"from math import factorial\n\ns = int(eval(input()))\nmod = pow(10, 9) + 7\n\n\ndef nCr(n, r):\n return int(factorial(n) \/\/ factorial(r) \/\/ factorial(n - r) % mod)\n\n\nans = 0\nseq_len = s \/\/ 3\nfor i in range(1, seq_len + 1):\n ans += nCr(s - 3 * i + (i - 1), i - 1)\nprint((ans % mod))\n","code_v1_no_empty_lines":"# \u52d5\u7684\u8a08\u753b\u6cd5\u306b\u3088\u308b\u89e3\u6cd5\ns = int(eval(input()))\nmod = pow(10, 9) + 7\nA = [0] * (s + 1)\nif s >= 3:\n A[3] = 1\nfor i in range(4, s + 1):\n A[i] = (A[i - 3] + A[i - 1]) % mod\nprint((A[s]))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-from math import factorial","-","+# \u52d5\u7684\u8a08\u753b\u6cd5\u306b\u3088\u308b\u89e3\u6cd5","-","-","-def nCr(n, r):","- return int(factorial(n) \/\/ factorial(r) \/\/ factorial(n - r) % mod)","-","-","-ans = 0","-seq_len = s \/\/ 3","-for i in range(1, seq_len + 1):","- ans += nCr(s - 3 * i + (i - 1), i - 1)","-print((ans % mod))","+A = [0] * (s + 1)","+if s >= 3:","+ A[3] = 1","+for i in range(4, s + 1):","+ A[i] = (A[i - 3] + A[i - 1]) % mod","+print((A[s]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3023663192,"measured_runtime_v1":0.197884347,"runtime_lift":1.5279951336,"key":["s764735536","s736916531"]} +{"user_id":"u258073778","problem_id":"p03370","language":"python","submission_id_v0":"s864579791","submission_id_v1":"s018766024","cpu_time_v0":712,"cpu_time_v1":525,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.26,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(eval(input()))\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x \/\/ min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n if x >= min(mn):\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(eval(input()))\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x \/\/ min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)","code_v0_loc":18,"code_v1_loc":17,"code_v0_num_chars":293,"code_v1_num_chars":267,"code_v0_no_empty_lines":"N, X = list(map(int, input().split()))\nmn = [0] * N\nfor i in range(N):\n mn[i] = int(eval(input()))\nans = N\nx = X - sum(mn)\nwhile x >= min(mn):\n if x \/\/ min(mn) == 0:\n mn[mn.index(min(mn))] = 1000000\n else:\n if x >= min(mn):\n x -= min(mn)\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N, X = list(map(int, input().split()))\nmn = [0] * N\nfor i in range(N):\n mn[i] = int(eval(input()))\nans = N\nx = X - sum(mn)\nwhile x >= min(mn):\n if x \/\/ min(mn) == 0:\n mn[mn.index(min(mn))] = 1000000\n else:\n x -= min(mn)\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["- if x >= min(mn):","- x -= min(mn)","- ans += 1","+ x -= min(mn)","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.2841449485,"measured_runtime_v1":0.2087575016,"runtime_lift":1.3611244927,"key":["s864579791","s018766024"]} +{"user_id":"u597374218","problem_id":"p03644","language":"python","submission_id_v0":"s675566275","submission_id_v1":"s569588989","cpu_time_v0":118,"cpu_time_v1":28,"memory_v0":27172,"memory_v1":9256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN=int(eval(input()))\n\nprint((2**int(np.log2(N))))\n\n# optimized version of the same code:\n","target":"import math\n\nN=int(eval(input()))\n\nprint((2**int(math.log2(N))))","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":61,"code_v1_num_chars":56,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nprint((2 ** int(np.log2(N))))\n","code_v1_no_empty_lines":"import math\n\nN = int(eval(input()))\nprint((2 ** int(math.log2(N))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","+import math","-print((2 ** int(np.log2(N))))","+print((2 ** int(math.log2(N))))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3166776929,"measured_runtime_v1":0.2254950373,"runtime_lift":5.8390539699,"key":["s675566275","s569588989"]} +{"user_id":"u961683878","problem_id":"p02596","language":"python","submission_id_v0":"s650878996","submission_id_v1":"s172963527","cpu_time_v0":1976,"cpu_time_v1":198,"memory_v0":165028,"memory_v1":9244,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.98,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#! \/usr\/bin\/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\n\n\ndef isMultiple(s, m):\n\n tmp = 0\n\n for i in range(len(s)):\n\n tmp = (tmp * 10 + int(s[i])) % m\n\n if tmp == 0:\n\n return i\n\n return -1\n\n\n\n\n\nk = int(readline())\n\nacc = \"7\" * 50000000\n\nif k % 2 == 0:\n\n ans = -1\n\nelse:\n\n\n\n ans = isMultiple(acc, k)\n\n if ans != -1:\n\n ans += 1\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"#! \/usr\/bin\/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\nk = int(readline())\n\n\n\nans = -1\n\nacc = 7 % k\n\nfor n in range(1, k + 10):\n\n if acc == 0:\n\n ans = n\n\n break\n\n acc = (10 * acc + 7) % k\n\n\n\nprint(ans)\n","code_v0_loc":30,"code_v1_loc":20,"code_v0_num_chars":543,"code_v1_num_chars":376,"code_v0_no_empty_lines":"#! \/usr\/bin\/env python3\nimport sys\n\nint1 = lambda x: int(x) - 1\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(500000)\n\n\ndef isMultiple(s, m):\n tmp = 0\n for i in range(len(s)):\n tmp = (tmp * 10 + int(s[i])) % m\n if tmp == 0:\n return i\n return -1\n\n\nk = int(readline())\nacc = \"7\" * 50000000\nif k % 2 == 0:\n ans = -1\nelse:\n ans = isMultiple(acc, k)\n if ans != -1:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"#! \/usr\/bin\/env python3\nimport sys\n\nint1 = lambda x: int(x) - 1\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(500000)\nk = int(readline())\nans = -1\nacc = 7 % k\nfor n in range(1, k + 10):\n if acc == 0:\n ans = n\n break\n acc = (10 * acc + 7) % k\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-","-","-def isMultiple(s, m):","- tmp = 0","- for i in range(len(s)):","- tmp = (tmp * 10 + int(s[i])) % m","- if tmp == 0:","- return i","- return -1","-","-","-acc = \"7\" * 50000000","-if k % 2 == 0:","- ans = -1","-else:","- ans = isMultiple(acc, k)","- if ans != -1:","- ans += 1","+ans = -1","+acc = 7 % k","+for n in range(1, k + 10):","+ if acc == 0:","+ ans = n","+ break","+ acc = (10 * acc + 7) % k"],"diff_only_import_comment":false,"measured_runtime_v0":0.8533027549,"measured_runtime_v1":0.4769769247,"runtime_lift":1.788981208,"key":["s650878996","s172963527"]} +{"user_id":"u297574184","problem_id":"p03253","language":"python","submission_id_v0":"s948054289","submission_id_v1":"s568239171","cpu_time_v0":101,"cpu_time_v1":25,"memory_v0":12132,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.25,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import floor, sqrt\n\nfrom collections import Counter\n\n\n\nMOD = 10 ** 9 + 7\n\n\n\n# x\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\n\ndef getPrimeFactor(x):\n\n ans = []\n\n for d in range(2, floor(sqrt(x)) + 1):\n\n while x % d == 0:\n\n ans.append(d)\n\n x \/\/= d\n\n\n\n if x != 1:\n\n ans.append(x)\n\n\n\n return ans\n\n\n\n# x\u306en\u4e57\uff08\u4e8c\u5206\u7d2f\u4e57\u6cd5\uff09\n\ndef power(x, n):\n\n ans = 1\n\n while n:\n\n if n % 2 == 1:\n\n ans = (ans * x) % MOD\n\n x = (x * x) % MOD\n\n n \/\/= 2\n\n return ans\n\n\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\nPFs = getPrimeFactor(M)\n\ncnt = Counter(PFs)\n\n\n\nN2 = N\n\nif len(cnt):\n\n N2 += max(cnt.values())\n\n\n\n# facts[x]: x\u306e\u968e\u4e57\n\nfacts = [1] + [0] * N2\n\nfor x in range(1, N2 + 1):\n\n facts[x] = (facts[x - 1] * x) % MOD\n\n\n\n# invFs[x]: x\u306e\u968e\u4e57\u306e\u9006\u5143\n\ninvFs = [0] * N2 + [power(facts[N2], MOD - 2)]\n\nfor x in reversed(list(range(N2))):\n\n invFs[x] = (invFs[x + 1] * (x + 1)) % MOD\n\n\n\ndef comb(n, k):\n\n return ((facts[n] * invFs[k]) % MOD * invFs[n - k]) % MOD\n\n\n\n\n\nans = 1\n\nfor num in list(cnt.values()):\n\n ans = (ans * comb(N + num - 1, num)) % MOD\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"from math import floor, sqrt\n\nfrom collections import Counter\n\n\n\nMOD = 10 ** 9 + 7\n\n\n\n# x\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\n\ndef getPrimeFactor(x):\n\n ans = []\n\n for d in range(2, floor(sqrt(x)) + 1):\n\n while x % d == 0:\n\n ans.append(d)\n\n x \/\/= d\n\n if x != 1:\n\n ans.append(x)\n\n return ans\n\n\n\ndef comb(n, k):\n\n k = min(k, n - k)\n\n ans = 1\n\n for i in range(n, n - k, -1):\n\n ans *= i\n\n for i in range(1, k + 1):\n\n ans \/\/= i \n\n return ans\n\n\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\nPFs = getPrimeFactor(M)\n\ncnt = Counter(PFs)\n\n\n\nans = 1\n\nfor num in list(cnt.values()):\n\n ans *= comb(N + num - 1, num)\n\nprint((ans % MOD))\n","code_v0_loc":56,"code_v1_loc":35,"code_v0_num_chars":1076,"code_v1_num_chars":660,"code_v0_no_empty_lines":"from math import floor, sqrt\nfrom collections import Counter\n\nMOD = 10**9 + 7\n# x\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\ndef getPrimeFactor(x):\n ans = []\n for d in range(2, floor(sqrt(x)) + 1):\n while x % d == 0:\n ans.append(d)\n x \/\/= d\n if x != 1:\n ans.append(x)\n return ans\n\n\n# x\u306en\u4e57\uff08\u4e8c\u5206\u7d2f\u4e57\u6cd5\uff09\ndef power(x, n):\n ans = 1\n while n:\n if n % 2 == 1:\n ans = (ans * x) % MOD\n x = (x * x) % MOD\n n \/\/= 2\n return ans\n\n\nN, M = list(map(int, input().split()))\nPFs = getPrimeFactor(M)\ncnt = Counter(PFs)\nN2 = N\nif len(cnt):\n N2 += max(cnt.values())\n# facts[x]: x\u306e\u968e\u4e57\nfacts = [1] + [0] * N2\nfor x in range(1, N2 + 1):\n facts[x] = (facts[x - 1] * x) % MOD\n# invFs[x]: x\u306e\u968e\u4e57\u306e\u9006\u5143\ninvFs = [0] * N2 + [power(facts[N2], MOD - 2)]\nfor x in reversed(list(range(N2))):\n invFs[x] = (invFs[x + 1] * (x + 1)) % MOD\n\n\ndef comb(n, k):\n return ((facts[n] * invFs[k]) % MOD * invFs[n - k]) % MOD\n\n\nans = 1\nfor num in list(cnt.values()):\n ans = (ans * comb(N + num - 1, num)) % MOD\nprint(ans)\n","code_v1_no_empty_lines":"from math import floor, sqrt\nfrom collections import Counter\n\nMOD = 10**9 + 7\n# x\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\ndef getPrimeFactor(x):\n ans = []\n for d in range(2, floor(sqrt(x)) + 1):\n while x % d == 0:\n ans.append(d)\n x \/\/= d\n if x != 1:\n ans.append(x)\n return ans\n\n\ndef comb(n, k):\n k = min(k, n - k)\n ans = 1\n for i in range(n, n - k, -1):\n ans *= i\n for i in range(1, k + 1):\n ans \/\/= i\n return ans\n\n\nN, M = list(map(int, input().split()))\nPFs = getPrimeFactor(M)\ncnt = Counter(PFs)\nans = 1\nfor num in list(cnt.values()):\n ans *= comb(N + num - 1, num)\nprint((ans % MOD))\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-# x\u306en\u4e57\uff08\u4e8c\u5206\u7d2f\u4e57\u6cd5\uff09","-def power(x, n):","+def comb(n, k):","+ k = min(k, n - k)","- while n:","- if n % 2 == 1:","- ans = (ans * x) % MOD","- x = (x * x) % MOD","- n \/\/= 2","+ for i in range(n, n - k, -1):","+ ans *= i","+ for i in range(1, k + 1):","+ ans \/\/= i","-N2 = N","-if len(cnt):","- N2 += max(cnt.values())","-# facts[x]: x\u306e\u968e\u4e57","-facts = [1] + [0] * N2","-for x in range(1, N2 + 1):","- facts[x] = (facts[x - 1] * x) % MOD","-# invFs[x]: x\u306e\u968e\u4e57\u306e\u9006\u5143","-invFs = [0] * N2 + [power(facts[N2], MOD - 2)]","-for x in reversed(list(range(N2))):","- invFs[x] = (invFs[x + 1] * (x + 1)) % MOD","-","-","-def comb(n, k):","- return ((facts[n] * invFs[k]) % MOD * invFs[n - k]) % MOD","-","-","- ans = (ans * comb(N + num - 1, num)) % MOD","-print(ans)","+ ans *= comb(N + num - 1, num)","+print((ans % MOD))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4482381222,"measured_runtime_v1":0.277183044,"runtime_lift":1.6171195605,"key":["s948054289","s568239171"]} +{"user_id":"u810356688","problem_id":"p02690","language":"python","submission_id_v0":"s967484686","submission_id_v1":"s277151448","cpu_time_v0":118,"cpu_time_v1":28,"memory_v0":9176,"memory_v1":9040,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ndef input(): return sys.stdin.readline().rstrip()\n\ndef main():\n\n x=int(eval(input()))\n\n for i in range(-300,300):\n\n for j in range(-300,300):\n\n if i**5-j**5==x:\n\n print((i,j))\n\n sys.exit()\n\n\n\nif __name__=='__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"import sys\n\ndef input(): return sys.stdin.readline().rstrip()\n\ndef main():\n\n x=int(eval(input()))\n\n for a in range(-118,120):\n\n for diff in range(238):\n\n if a**5-(a-diff)**5>10**9:\n\n break\n\n if a**5-(a-diff)**5==x:\n\n print((a,a-diff))\n\n sys.exit()\n\n\n\nif __name__=='__main__':\n\n main()","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":286,"code_v1_num_chars":359,"code_v0_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n x = int(eval(input()))\n for i in range(-300, 300):\n for j in range(-300, 300):\n if i**5 - j**5 == x:\n print((i, j))\n sys.exit()\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n x = int(eval(input()))\n for a in range(-118, 120):\n for diff in range(238):\n if a**5 - (a - diff) ** 5 > 10**9:\n break\n if a**5 - (a - diff) ** 5 == x:\n print((a, a - diff))\n sys.exit()\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["- for i in range(-300, 300):","- for j in range(-300, 300):","- if i**5 - j**5 == x:","- print((i, j))","+ for a in range(-118, 120):","+ for diff in range(238):","+ if a**5 - (a - diff) ** 5 > 10**9:","+ break","+ if a**5 - (a - diff) ** 5 == x:","+ print((a, a - diff))"],"diff_only_import_comment":false,"measured_runtime_v0":1.0260130386,"measured_runtime_v1":0.2234877924,"runtime_lift":4.5909131207,"key":["s967484686","s277151448"]} +{"user_id":"u133936772","problem_id":"p02615","language":"python","submission_id_v0":"s324254523","submission_id_v1":"s548223725","cpu_time_v0":146,"cpu_time_v1":118,"memory_v0":31756,"memory_v1":31752,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.18,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,*l=list(map(int,open(0).read().split()));print((sum(sorted(l*2)[-2:~n:-1])))\n\n# optimized version of the same code:\n","target":"n,*l=list(map(int,open(0).read().split()))\n\nl.sort(reverse=1)\n\nprint((sum(l[i\/\/2] for i in range(1,n))))","code_v0_loc":1,"code_v1_loc":3,"code_v0_num_chars":70,"code_v1_num_chars":96,"code_v0_no_empty_lines":"n, *l = list(map(int, open(0).read().split()))\nprint((sum(sorted(l * 2)[-2:~n:-1])))\n","code_v1_no_empty_lines":"n, *l = list(map(int, open(0).read().split()))\nl.sort(reverse=1)\nprint((sum(l[i \/\/ 2] for i in range(1, n))))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-print((sum(sorted(l * 2)[-2:~n:-1])))","+l.sort(reverse=1)","+print((sum(l[i \/\/ 2] for i in range(1, n))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2901719676,"measured_runtime_v1":0.1990829677,"runtime_lift":1.4575429076,"key":["s324254523","s548223725"]} +{"user_id":"u130900604","problem_id":"p03796","language":"python","submission_id_v0":"s800410916","submission_id_v1":"s728597484","cpu_time_v0":374,"cpu_time_v1":55,"memory_v0":13144,"memory_v1":6884,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nmod=10**9+7\n\nd=np.zeros(100100,dtype=np.int64)\n\nd[0]=1\n\nfor i in range(1,10**5+1):\n\n d[i]=d[i-1]*i%mod\n\nprint((d[int(eval(input()))]))\n\n# optimized version of the same code:\n","target":"d,mod=[1]+[0]*100100,10**9+7\n\nfor i in range(1,10**5+1):d[i]=d[i-1]*i%mod\n\nprint((d[int(eval(input()))]))","code_v0_loc":7,"code_v1_loc":3,"code_v0_num_chars":147,"code_v1_num_chars":97,"code_v0_no_empty_lines":"import numpy as np\n\nmod = 10**9 + 7\nd = np.zeros(100100, dtype=np.int64)\nd[0] = 1\nfor i in range(1, 10**5 + 1):\n d[i] = d[i - 1] * i % mod\nprint((d[int(eval(input()))]))\n","code_v1_no_empty_lines":"d, mod = [1] + [0] * 100100, 10**9 + 7\nfor i in range(1, 10**5 + 1):\n d[i] = d[i - 1] * i % mod\nprint((d[int(eval(input()))]))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-import numpy as np","-","-mod = 10**9 + 7","-d = np.zeros(100100, dtype=np.int64)","-d[0] = 1","+d, mod = [1] + [0] * 100100, 10**9 + 7"],"diff_only_import_comment":false,"measured_runtime_v0":1.8401680753,"measured_runtime_v1":0.4502561843,"runtime_lift":4.086935703,"key":["s800410916","s728597484"]} +{"user_id":"u727072969","problem_id":"p02881","language":"python","submission_id_v0":"s064089444","submission_id_v1":"s044740610","cpu_time_v0":519,"cpu_time_v1":181,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.13,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nN = int(eval(input()))\n\nfor i in range(int(math.sqrt(N))):\n\n if N % (int(math.sqrt(N))-i) == 0:\n\n print((int(N\/(int(math.sqrt(N))-i)+int(math.sqrt(N))-i-2)))\n\n break\n\n# optimized version of the same code:\n","target":"import math\n\nN = int(eval(input()))\n\nM = int(math.sqrt(N))\n\nfor i in range(M):\n\n if N % (M-i) == 0:\n\n print((int(N\/(M-i)+M-i-2)))\n\n break\n","code_v0_loc":6,"code_v1_loc":7,"code_v0_num_chars":187,"code_v1_num_chars":147,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nfor i in range(int(math.sqrt(N))):\n if N % (int(math.sqrt(N)) - i) == 0:\n print((int(N \/ (int(math.sqrt(N)) - i) + int(math.sqrt(N)) - i - 2)))\n break\n","code_v1_no_empty_lines":"import math\n\nN = int(eval(input()))\nM = int(math.sqrt(N))\nfor i in range(M):\n if N % (M - i) == 0:\n print((int(N \/ (M - i) + M - i - 2)))\n break\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-for i in range(int(math.sqrt(N))):","- if N % (int(math.sqrt(N)) - i) == 0:","- print((int(N \/ (int(math.sqrt(N)) - i) + int(math.sqrt(N)) - i - 2)))","+M = int(math.sqrt(N))","+for i in range(M):","+ if N % (M - i) == 0:","+ print((int(N \/ (M - i) + M - i - 2)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3627885733,"measured_runtime_v1":0.269237565,"runtime_lift":1.3474664028,"key":["s064089444","s044740610"]} +{"user_id":"u530383736","problem_id":"p02690","language":"python","submission_id_v0":"s540635335","submission_id_v1":"s335532444","cpu_time_v0":50,"cpu_time_v1":35,"memory_v0":8964,"memory_v1":9188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\nX = int(input().strip())\n\n#-----\n\n\n\nfor a in range(-118,120):\n\n for b in range(-118,120):\n\n if (a**5 - b**5) == X:\n\n print((a,b))\n\n sys.exit()\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\nX = int(input().strip())\n\n#-----\n\ncalc = {}\n\n\n\nfor i in range(-118,120):\n\n calc[i] = i**5\n\n\n\n\n\nfor a in range(-118,120):\n\n for b in range(-118,120):\n\n if (calc[a] - calc[b]) == X:\n\n print((a,b))\n\n sys.exit()\n","code_v0_loc":11,"code_v1_loc":16,"code_v0_num_chars":212,"code_v1_num_chars":280,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\nX = int(input().strip())\n# -----\nfor a in range(-118, 120):\n for b in range(-118, 120):\n if (a**5 - b**5) == X:\n print((a, b))\n sys.exit()\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\nX = int(input().strip())\n# -----\ncalc = {}\nfor i in range(-118, 120):\n calc[i] = i**5\nfor a in range(-118, 120):\n for b in range(-118, 120):\n if (calc[a] - calc[b]) == X:\n print((a, b))\n sys.exit()\n","code_same":false,"relative_loc_diff_percent":31.25,"diff":["+calc = {}","+for i in range(-118, 120):","+ calc[i] = i**5","- if (a**5 - b**5) == X:","+ if (calc[a] - calc[b]) == X:"],"diff_only_import_comment":false,"measured_runtime_v0":0.4712231378,"measured_runtime_v1":0.3317169825,"runtime_lift":1.4205577724,"key":["s540635335","s335532444"]} +{"user_id":"u753589982","problem_id":"p02994","language":"python","submission_id_v0":"s918408995","submission_id_v1":"s703264591","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple():\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)\/\/2 - eat_apple()))\n\n# optimized version of the same code:\n","target":"N, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple(N, L, max_):\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)\/\/2 - eat_apple(N, L, max_)))","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":227,"code_v1_num_chars":247,"code_v0_no_empty_lines":"N, L = [int(i) for i in input().split()]\nmin_ = L\nmax_ = L + N - 1\n\n\ndef eat_apple():\n if max_ < 0:\n return max_\n if L < 0:\n return 0\n return L\n\n\nprint(((min_ + max_) * (max_ - min_ + 1) \/\/ 2 - eat_apple()))\n","code_v1_no_empty_lines":"N, L = [int(i) for i in input().split()]\nmin_ = L\nmax_ = L + N - 1\n\n\ndef eat_apple(N, L, max_):\n if max_ < 0:\n return max_\n if L < 0:\n return 0\n return L\n\n\nprint(((min_ + max_) * (max_ - min_ + 1) \/\/ 2 - eat_apple(N, L, max_)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-def eat_apple():","+def eat_apple(N, L, max_):","-print(((min_ + max_) * (max_ - min_ + 1) \/\/ 2 - eat_apple()))","+print(((min_ + max_) * (max_ - min_ + 1) \/\/ 2 - eat_apple(N, L, max_)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2025646191,"measured_runtime_v1":0.0060813091,"runtime_lift":33.309377317,"key":["s918408995","s703264591"]} +{"user_id":"u787562674","problem_id":"p03363","language":"python","submission_id_v0":"s520227607","submission_id_v1":"s241017574","cpu_time_v0":271,"cpu_time_v1":224,"memory_v0":41880,"memory_v1":41472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\n\n\nN = int(eval(input()))\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\nruisekiwa = [0] * (N+1)\n\n\n\nfor i in range(N):\n\n ruisekiwa[i+1] = ruisekiwa[i] + inputs[i]\n\n\n\nruisekiwa = ruisekiwa[1:]\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"from collections import Counter\n\nfrom itertools import accumulate\n\n\n\nN = int(eval(input()))\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\n\n\nruisekiwa = list(accumulate(inputs))\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n","code_v0_loc":25,"code_v1_loc":22,"code_v0_num_chars":534,"code_v1_num_chars":485,"code_v0_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\ninputs = [int(i) for i in input().split()]\nans = 0\nruisekiwa = [0] * (N + 1)\nfor i in range(N):\n ruisekiwa[i + 1] = ruisekiwa[i] + inputs[i]\nruisekiwa = ruisekiwa[1:]\nruisekiwa.sort()\ncounter_ruiseki = Counter(ruisekiwa)\nfor key, value in list(counter_ruiseki.items()):\n if key == 0 and value == 1:\n ans += value\n continue\n elif key == 0 and value > 1:\n ans += value\n if value > 1:\n ans += sum(list(range(value)))\nprint(ans)\n","code_v1_no_empty_lines":"from collections import Counter\nfrom itertools import accumulate\n\nN = int(eval(input()))\ninputs = [int(i) for i in input().split()]\nans = 0\nruisekiwa = list(accumulate(inputs))\nruisekiwa.sort()\ncounter_ruiseki = Counter(ruisekiwa)\nfor key, value in list(counter_ruiseki.items()):\n if key == 0 and value == 1:\n ans += value\n continue\n elif key == 0 and value > 1:\n ans += value\n if value > 1:\n ans += sum(list(range(value)))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["+from itertools import accumulate","-ruisekiwa = [0] * (N + 1)","-for i in range(N):","- ruisekiwa[i + 1] = ruisekiwa[i] + inputs[i]","-ruisekiwa = ruisekiwa[1:]","+ruisekiwa = list(accumulate(inputs))"],"diff_only_import_comment":false,"measured_runtime_v0":0.19887093,"measured_runtime_v1":0.1327844608,"runtime_lift":1.4976973116,"key":["s520227607","s241017574"]} +{"user_id":"u868701750","problem_id":"p03457","language":"python","submission_id_v0":"s991338937","submission_id_v1":"s211926413","cpu_time_v0":209,"cpu_time_v1":173,"memory_v0":27480,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n T = [list(map(int, _input().split())) for _ in range(N)]\n\n t, x, y = 0, 0, 0\n\n for next_t, next_x, next_y in T:\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n\n# optimized version of the same code:\n","target":"import sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n t, x, y = 0, 0, 0\n\n for _ in range(N):\n\n next_t, next_x, next_y = list(map(int, _input().split()))\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":459,"code_v1_num_chars":444,"code_v0_no_empty_lines":"import sys\n\n_input = sys.stdin.readline\n\n\ndef resolve():\n N = int(_input())\n T = [list(map(int, _input().split())) for _ in range(N)]\n t, x, y = 0, 0, 0\n for next_t, next_x, next_y in T:\n diff_xy = abs(x - next_x) + abs(y - next_y)\n diff_t = next_t - t\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n print(\"No\")\n exit(0)\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"import sys\n\n_input = sys.stdin.readline\n\n\ndef resolve():\n N = int(_input())\n t, x, y = 0, 0, 0\n for _ in range(N):\n next_t, next_x, next_y = list(map(int, _input().split()))\n diff_xy = abs(x - next_x) + abs(y - next_y)\n diff_t = next_t - t\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n print(\"No\")\n exit(0)\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- T = [list(map(int, _input().split())) for _ in range(N)]","- for next_t, next_x, next_y in T:","+ for _ in range(N):","+ next_t, next_x, next_y = list(map(int, _input().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2834033267,"measured_runtime_v1":0.1166054926,"runtime_lift":2.4304457743,"key":["s991338937","s211926413"]} +{"user_id":"u280978334","problem_id":"p03107","language":"python","submission_id_v0":"s353947972","submission_id_v1":"s266533401","cpu_time_v0":65,"cpu_time_v1":18,"memory_v0":5400,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.31,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = [int(_) for _ in eval(input())]\n\nlength = len(S)\n\ntemp = [S[0]]\n\nfor x in S[1:]:\n\n if(len(temp) == 0):\n\n temp.append(x)\n\n elif( temp[-1] == x):\n\n temp.append(x)\n\n else:\n\n temp.pop(-1)\n\nprint((length-len(temp)))\n\n \n\n# optimized version of the same code:\n","target":"def main():\n\n A = eval(input())\n\n print((2*min(A.count(\"0\"),A.count(\"1\"))))\n\n \n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":12,"code_v1_loc":6,"code_v0_num_chars":246,"code_v1_num_chars":119,"code_v0_no_empty_lines":"S = [int(_) for _ in eval(input())]\nlength = len(S)\ntemp = [S[0]]\nfor x in S[1:]:\n if len(temp) == 0:\n temp.append(x)\n elif temp[-1] == x:\n temp.append(x)\n else:\n temp.pop(-1)\nprint((length - len(temp)))\n","code_v1_no_empty_lines":"def main():\n A = eval(input())\n print((2 * min(A.count(\"0\"), A.count(\"1\"))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-S = [int(_) for _ in eval(input())]","-length = len(S)","-temp = [S[0]]","-for x in S[1:]:","- if len(temp) == 0:","- temp.append(x)","- elif temp[-1] == x:","- temp.append(x)","- else:","- temp.pop(-1)","-print((length - len(temp)))","+def main():","+ A = eval(input())","+ print((2 * min(A.count(\"0\"), A.count(\"1\"))))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2279973624,"measured_runtime_v1":0.00614361,"runtime_lift":37.1113013328,"key":["s353947972","s266533401"]} +{"user_id":"u423966555","problem_id":"p02596","language":"python","submission_id_v0":"s734835984","submission_id_v1":"s256781932","cpu_time_v0":338,"cpu_time_v1":178,"memory_v0":16560,"memory_v1":9056,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nK = int(eval(input()))\n\n\n\nflg = [False]*K\n\n\n\ntmp = 7 % K\n\ncnt = 1\n\nif tmp == 0:\n\n print(cnt)\n\n exit()\n\nwhile True:\n\n tmp = (tmp*10+7)%K\n\n if flg[tmp]:\n\n print((-1))\n\n break\n\n else:\n\n cnt += 1\n\n if tmp == 0:\n\n print(cnt)\n\n break\n\n flg[tmp] = True\n\n\n# optimized version of the same code:\n","target":"K = int(eval(input()))\n\nt = 7\n\nt %= K\n\n\n\nfor i in range(K+1):\n\n if t == 0:\n\n print((i+1))\n\n exit()\n\n t = (t*10+7)%K\n\nprint((-1))\n","code_v0_loc":20,"code_v1_loc":10,"code_v0_num_chars":310,"code_v1_num_chars":139,"code_v0_no_empty_lines":"K = int(eval(input()))\nflg = [False] * K\ntmp = 7 % K\ncnt = 1\nif tmp == 0:\n print(cnt)\n exit()\nwhile True:\n tmp = (tmp * 10 + 7) % K\n if flg[tmp]:\n print((-1))\n break\n else:\n cnt += 1\n if tmp == 0:\n print(cnt)\n break\n flg[tmp] = True\n","code_v1_no_empty_lines":"K = int(eval(input()))\nt = 7\nt %= K\nfor i in range(K + 1):\n if t == 0:\n print((i + 1))\n exit()\n t = (t * 10 + 7) % K\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-flg = [False] * K","-tmp = 7 % K","-cnt = 1","-if tmp == 0:","- print(cnt)","- exit()","-while True:","- tmp = (tmp * 10 + 7) % K","- if flg[tmp]:","- print((-1))","- break","- else:","- cnt += 1","- if tmp == 0:","- print(cnt)","- break","- flg[tmp] = True","+t = 7","+t %= K","+for i in range(K + 1):","+ if t == 0:","+ print((i + 1))","+ exit()","+ t = (t * 10 + 7) % K","+print((-1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.6767371264,"measured_runtime_v1":0.4369205115,"runtime_lift":1.5488792779,"key":["s734835984","s256781932"]} +{"user_id":"u239981649","problem_id":"p03796","language":"python","submission_id_v0":"s383796227","submission_id_v1":"s138334572","cpu_time_v0":232,"cpu_time_v1":34,"memory_v0":3972,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import factorial\n\nprint((factorial(int(eval(input()))) % (10**9+7)))\n\n# optimized version of the same code:\n","target":"ans = 1\n\nfor k in range(1, int(eval(input()))+1):\n\n ans = ans*k % (10**9+7)\n\nprint(ans)","code_v0_loc":2,"code_v1_loc":4,"code_v0_num_chars":70,"code_v1_num_chars":84,"code_v0_no_empty_lines":"from math import factorial\n\nprint((factorial(int(eval(input()))) % (10**9 + 7)))\n","code_v1_no_empty_lines":"ans = 1\nfor k in range(1, int(eval(input())) + 1):\n ans = ans * k % (10**9 + 7)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-from math import factorial","-","-print((factorial(int(eval(input()))) % (10**9 + 7)))","+ans = 1","+for k in range(1, int(eval(input())) + 1):","+ ans = ans * k % (10**9 + 7)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3382144179,"measured_runtime_v1":0.1644267938,"runtime_lift":2.0569300785,"key":["s383796227","s138334572"]} +{"user_id":"u761320129","problem_id":"p03822","language":"python","submission_id_v0":"s508015569","submission_id_v1":"s203932637","cpu_time_v0":763,"cpu_time_v1":637,"memory_v0":227992,"memory_v1":123792,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.51,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(202020)\n\n\n\nN = int(eval(input()))\n\nwon = [[] for i in range(N)]\n\nfor i in range(1,N):\n\n a = int(eval(input())) - 1\n\n won[a].append(i)\n\n\n\ndef height(v):\n\n if not won[v]: return 0\n\n hs = [height(op) for op in won[v]]\n\n ret = 0\n\n for i,h in enumerate(sorted(hs)):\n\n ret = max(ret, h + len(hs) - i)\n\n return ret\n\n\n\nprint((height(0)))\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10**8)\n\nN = int(eval(input()))\n\nA = [int(eval(input()))-1 for i in range(N-1)]\n\nwins = [[] for _ in range(N)]\n\n\n\nfor i,a in enumerate(A):\n\n wins[a].append(i+1)\n\n\n\ndepth = [-1] * N\n\ndef dep(v):\n\n if len(wins[v])==0: return 0\n\n if depth[v] >= 0:\n\n return depth[v]\n\n ds = []\n\n for w in wins[v]:\n\n ds.append(dep(w))\n\n ds.sort(reverse=True)\n\n ret = 0\n\n for i,d in enumerate(ds):\n\n ret = max(ret, i+d+1)\n\n depth[v] = ret\n\n return ret\n\nprint((dep(0)))","code_v0_loc":18,"code_v1_loc":24,"code_v0_num_chars":377,"code_v1_num_chars":515,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(202020)\nN = int(eval(input()))\nwon = [[] for i in range(N)]\nfor i in range(1, N):\n a = int(eval(input())) - 1\n won[a].append(i)\n\n\ndef height(v):\n if not won[v]:\n return 0\n hs = [height(op) for op in won[v]]\n ret = 0\n for i, h in enumerate(sorted(hs)):\n ret = max(ret, h + len(hs) - i)\n return ret\n\n\nprint((height(0)))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**8)\nN = int(eval(input()))\nA = [int(eval(input())) - 1 for i in range(N - 1)]\nwins = [[] for _ in range(N)]\nfor i, a in enumerate(A):\n wins[a].append(i + 1)\ndepth = [-1] * N\n\n\ndef dep(v):\n if len(wins[v]) == 0:\n return 0\n if depth[v] >= 0:\n return depth[v]\n ds = []\n for w in wins[v]:\n ds.append(dep(w))\n ds.sort(reverse=True)\n ret = 0\n for i, d in enumerate(ds):\n ret = max(ret, i + d + 1)\n depth[v] = ret\n return ret\n\n\nprint((dep(0)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-sys.setrecursionlimit(202020)","+sys.setrecursionlimit(10**8)","-won = [[] for i in range(N)]","-for i in range(1, N):","- a = int(eval(input())) - 1","- won[a].append(i)","+A = [int(eval(input())) - 1 for i in range(N - 1)]","+wins = [[] for _ in range(N)]","+for i, a in enumerate(A):","+ wins[a].append(i + 1)","+depth = [-1] * N","-def height(v):","- if not won[v]:","+def dep(v):","+ if len(wins[v]) == 0:","- hs = [height(op) for op in won[v]]","+ if depth[v] >= 0:","+ return depth[v]","+ ds = []","+ for w in wins[v]:","+ ds.append(dep(w))","+ ds.sort(reverse=True)","- for i, h in enumerate(sorted(hs)):","- ret = max(ret, h + len(hs) - i)","+ for i, d in enumerate(ds):","+ ret = max(ret, i + d + 1)","+ depth[v] = ret","-print((height(0)))","+print((dep(0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3026691139,"measured_runtime_v1":0.2050500124,"runtime_lift":1.4760745946,"key":["s508015569","s203932637"]} +{"user_id":"u263737105","problem_id":"p02595","language":"python","submission_id_v0":"s947121829","submission_id_v1":"s479170385","cpu_time_v0":481,"cpu_time_v1":391,"memory_v0":9072,"memory_v1":9124,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a**2 + b**2) <= D**2:\n\n count += 1\n\nprint(count)\n\n\n# optimized version of the same code:\n","target":"N, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a*a + b*b) <= D*D:\n\n count += 1\n\nprint(count)\n","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":167,"code_v1_num_chars":164,"code_v0_no_empty_lines":"N, D = list(map(int, input().split()))\ncount = 0\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if (a**2 + b**2) <= D**2:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"N, D = list(map(int, input().split()))\ncount = 0\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if (a * a + b * b) <= D * D:\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if (a**2 + b**2) <= D**2:","+ if (a * a + b * b) <= D * D:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2832637064,"measured_runtime_v1":0.1751975398,"runtime_lift":1.6168246811,"key":["s947121829","s479170385"]} +{"user_id":"u077291787","problem_id":"p03309","language":"python","submission_id_v0":"s828043733","submission_id_v1":"s360156642","cpu_time_v0":210,"cpu_time_v1":183,"memory_v0":27472,"memory_v1":25324,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# ABC102C - Linear Approximation (ARC100C)\n\nfrom statistics import median\n\n\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = tuple(j - i for i, j in enumerate(A, start=1))\n\n b = median(A)\n\n ans = sum(abs(a - b) for a in A)\n\n print((int(ans)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n# optimized version of the same code:\n","target":"# ABC102C - Linear Approximation (ARC100C)\n\ndef main():\n\n n = int(eval(input()))\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = sorted(j - i for i, j in enumerate(A, start=1))\n\n b = A[n \/\/ 2]\n\n ans = sum(abs(a - b) for a in A)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":15,"code_v1_loc":12,"code_v0_num_chars":341,"code_v1_num_chars":302,"code_v0_no_empty_lines":"# ABC102C - Linear Approximation (ARC100C)\nfrom statistics import median\n\n\ndef main():\n n = int(eval(input()))\n A = tuple(map(int, input().rstrip().split()))\n A = tuple(j - i for i, j in enumerate(A, start=1))\n b = median(A)\n ans = sum(abs(a - b) for a in A)\n print((int(ans)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# ABC102C - Linear Approximation (ARC100C)\ndef main():\n n = int(eval(input()))\n A = tuple(map(int, input().rstrip().split()))\n A = sorted(j - i for i, j in enumerate(A, start=1))\n b = A[n \/\/ 2]\n ans = sum(abs(a - b) for a in A)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-from statistics import median","-","-","- A = tuple(j - i for i, j in enumerate(A, start=1))","- b = median(A)","+ A = sorted(j - i for i, j in enumerate(A, start=1))","+ b = A[n \/\/ 2]","- print((int(ans)))","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2185840318,"measured_runtime_v1":0.1650515537,"runtime_lift":1.3243379227,"key":["s828043733","s360156642"]} +{"user_id":"u260980560","problem_id":"p01105","language":"python","submission_id_v0":"s457180384","submission_id_v1":"s699385465","cpu_time_v0":130,"cpu_time_v1":50,"memory_v0":7848,"memory_v1":7824,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.54,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na=65280; b=61680; c=52428; d=43690; e=65535\n\nL = {el: 1 for el in [a, b, c, d, e, 0]}\n\nfor i in range(6):\n\n R = sorted(L.items(), key=lambda x: x[1])\n\n for p, l in R:\n\n if l < 16:\n\n L[p ^ e] = min(L.get(p ^ e, 16), l+1)\n\n if l+3 < 16:\n\n for q, r in R:\n\n if l+r+3 <= 16:\n\n L[p & q] = min(L.get(p & q, 16), l+r+3)\n\n L[p ^ q] = min(L.get(p ^ q, 16), l+r+3)\n\n else: break\n\n else: break\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n\n\n# optimized version of the same code:\n","target":"a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < L.get(p ^ e, 17):\n\n L[p^e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p^e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < L.get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < L.get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: H.append((p, l))\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n","code_v0_loc":15,"code_v1_loc":24,"code_v0_num_chars":639,"code_v1_num_chars":874,"code_v0_no_empty_lines":"a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nL = {el: 1 for el in [a, b, c, d, e, 0]}\nfor i in range(6):\n R = sorted(L.items(), key=lambda x: x[1])\n for p, l in R:\n if l < 16:\n L[p ^ e] = min(L.get(p ^ e, 16), l + 1)\n if l + 3 < 16:\n for q, r in R:\n if l + r + 3 <= 16:\n L[p & q] = min(L.get(p & q, 16), l + r + 3)\n L[p ^ q] = min(L.get(p ^ q, 16), l + r + 3)\n else:\n break\n else:\n break\nprint(\n *(\n L[e & eval(s)]\n for s in open(0)\n .read()\n .replace(*\"-~\")\n .replace(*\"*&\")\n .replace(*\"1e\")\n .split()[:-1]\n ),\n sep=\"\\n\"\n)\n","code_v1_no_empty_lines":"a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\nQ = [(1, el) for el in base]\nL = {el: 1 for el in base}\nH = []\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < L.get(p ^ e, 17):\n L[p ^ e] = l + 1\n if l + 1 < 16:\n heappush(Q, (l + 1, p ^ e))\n if l + 3 < 16:\n for q, r in H:\n if l + r + 3 <= 16:\n if l + r + 3 < L.get(p & q, 17):\n L[p & q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p & q))\n if l + r + 3 < L.get(p ^ q, 17):\n L[p ^ q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p ^ q))\n else:\n break\n if l < 7:\n H.append((p, l))\nprint(\n *(\n L[e & eval(s)]\n for s in open(0)\n .read()\n .replace(*\"-~\")\n .replace(*\"*&\")\n .replace(*\"1e\")\n .split()[:-1]\n ),\n sep=\"\\n\"\n)\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-L = {el: 1 for el in [a, b, c, d, e, 0]}","-for i in range(6):","- R = sorted(L.items(), key=lambda x: x[1])","- for p, l in R:","- if l < 16:","- L[p ^ e] = min(L.get(p ^ e, 16), l + 1)","- if l + 3 < 16:","- for q, r in R:","- if l + r + 3 <= 16:","- L[p & q] = min(L.get(p & q, 16), l + r + 3)","- L[p ^ q] = min(L.get(p ^ q, 16), l + r + 3)","- else:","- break","- else:","- break","+from heapq import heappush, heappop","+","+base = [a, b, c, d, e, 0]","+Q = [(1, el) for el in base]","+L = {el: 1 for el in base}","+H = []","+while Q:","+ l, p = heappop(Q)","+ if L[p] < l:","+ continue","+ if l + 1 < L.get(p ^ e, 17):","+ L[p ^ e] = l + 1","+ if l + 1 < 16:","+ heappush(Q, (l + 1, p ^ e))","+ if l + 3 < 16:","+ for q, r in H:","+ if l + r + 3 <= 16:","+ if l + r + 3 < L.get(p & q, 17):","+ L[p & q] = l + r + 3","+ if l + r + 3 < 16:","+ heappush(Q, (l + r + 3, p & q))","+ if l + r + 3 < L.get(p ^ q, 17):","+ L[p ^ q] = l + r + 3","+ if l + r + 3 < 16:","+ heappush(Q, (l + r + 3, p ^ q))","+ else:","+ break","+ if l < 7:","+ H.append((p, l))"],"diff_only_import_comment":false,"measured_runtime_v0":1.012686343,"measured_runtime_v1":0.2560091887,"runtime_lift":3.9556640457,"key":["s457180384","s699385465"]} +{"user_id":"u775681539","problem_id":"p02792","language":"python","submission_id_v0":"s313172456","submission_id_v1":"s731114638","cpu_time_v0":533,"cpu_time_v1":247,"memory_v0":3444,"memory_v1":40556,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.66,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#python3\n\nfrom collections import defaultdict\n\nfrom collections import namedtuple\n\n\n\nP = namedtuple('P', ['front', 'end'])\n\n\n\ndef f(x):\n\n return P(str(x)[0], str(x)[-1]) \n\n\n\ndef main():\n\n\n\n n = int(eval(input()))\n\n freq = defaultdict(int)\n\n\n\n for i in range(1, n+1):\n\n p = f(i)\n\n freq[p]+=1\n\n\n\n\n\n ans = 0\n\n for i in range(1, n + 1):\n\n p = f(i)\n\n q = (p.end, p.front)\n\n ans += freq[q]\n\n\n\n print(ans)\n\n\n\nmain()\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom collections import defaultdict\n\n\n\ndef f(x):\n\n return (int(str(x)[0]), int(str(x)[-1])) \n\ndef main():\n\n N = int(readline())\n\n df = defaultdict(int)\n\n for i in range(1, N+1):\n\n df[f(i)] += 1\n\n ans = 0\n\n for i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += df[(i, j)]*df[(j, i)]\n\n print(ans)\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":28,"code_v1_loc":21,"code_v0_num_chars":458,"code_v1_num_chars":507,"code_v0_no_empty_lines":"# python3\nfrom collections import defaultdict\nfrom collections import namedtuple\n\nP = namedtuple(\"P\", [\"front\", \"end\"])\n\n\ndef f(x):\n return P(str(x)[0], str(x)[-1])\n\n\ndef main():\n n = int(eval(input()))\n freq = defaultdict(int)\n for i in range(1, n + 1):\n p = f(i)\n freq[p] += 1\n ans = 0\n for i in range(1, n + 1):\n p = f(i)\n q = (p.end, p.front)\n ans += freq[q]\n print(ans)\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom collections import defaultdict\n\n\ndef f(x):\n return (int(str(x)[0]), int(str(x)[-1]))\n\n\ndef main():\n N = int(readline())\n df = defaultdict(int)\n for i in range(1, N + 1):\n df[f(i)] += 1\n ans = 0\n for i in range(1, 10):\n for j in range(1, 10):\n ans += df[(i, j)] * df[(j, i)]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-# python3","+import sys","+","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","-from collections import namedtuple","-","-P = namedtuple(\"P\", [\"front\", \"end\"])","- return P(str(x)[0], str(x)[-1])","+ return (int(str(x)[0]), int(str(x)[-1]))","- n = int(eval(input()))","- freq = defaultdict(int)","- for i in range(1, n + 1):","- p = f(i)","- freq[p] += 1","+ N = int(readline())","+ df = defaultdict(int)","+ for i in range(1, N + 1):","+ df[f(i)] += 1","- for i in range(1, n + 1):","- p = f(i)","- q = (p.end, p.front)","- ans += freq[q]","+ for i in range(1, 10):","+ for j in range(1, 10):","+ ans += df[(i, j)] * df[(j, i)]","-main()","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.4672443939,"measured_runtime_v1":0.3355342689,"runtime_lift":1.3925385189,"key":["s313172456","s731114638"]} +{"user_id":"u893063840","problem_id":"p03038","language":"python","submission_id_v0":"s696312664","submission_id_v1":"s914180377","cpu_time_v0":588,"cpu_time_v1":493,"memory_v0":32888,"memory_v1":36036,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(key=lambda x: x[1], reverse=True)\n\na.sort()\n\n\n\ni = 0\n\nfor b, c in bc:\n\n for _ in range(b):\n\n if i < n and a[i] < c:\n\n a[i] = c\n\n i += 1\n\n else:\n\n break\n\n\n\nans = sum(a)\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"n, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(reverse=True, key=lambda x: x[1])\n\n\n\nli = []\n\nl = 0\n\ni = 0\n\nwhile i < m and l < n:\n\n b, c = bc[i]\n\n li += [c] * b\n\n i += 1\n\n l += b\n\n\n\na += li\n\na.sort(reverse=True)\n\nans = sum(a[:n])\n\nprint(ans)\n","code_v0_loc":18,"code_v1_loc":19,"code_v0_num_chars":369,"code_v1_num_chars":346,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = [list(map(int, input().split())) for _ in range(m)]\nbc.sort(key=lambda x: x[1], reverse=True)\na.sort()\ni = 0\nfor b, c in bc:\n for _ in range(b):\n if i < n and a[i] < c:\n a[i] = c\n i += 1\n else:\n break\nans = sum(a)\nprint(ans)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = [list(map(int, input().split())) for _ in range(m)]\nbc.sort(reverse=True, key=lambda x: x[1])\nli = []\nl = 0\ni = 0\nwhile i < m and l < n:\n b, c = bc[i]\n li += [c] * b\n i += 1\n l += b\na += li\na.sort(reverse=True)\nans = sum(a[:n])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-bc.sort(key=lambda x: x[1], reverse=True)","-a.sort()","+bc.sort(reverse=True, key=lambda x: x[1])","+li = []","+l = 0","-for b, c in bc:","- for _ in range(b):","- if i < n and a[i] < c:","- a[i] = c","- i += 1","- else:","- break","-ans = sum(a)","+while i < m and l < n:","+ b, c = bc[i]","+ li += [c] * b","+ i += 1","+ l += b","+a += li","+a.sort(reverse=True)","+ans = sum(a[:n])"],"diff_only_import_comment":false,"measured_runtime_v0":0.2346956289,"measured_runtime_v1":0.006594183,"runtime_lift":35.5913127767,"key":["s696312664","s914180377"]} +{"user_id":"u475584892","problem_id":"p02837","language":"python","submission_id_v0":"s384273193","submission_id_v1":"s761835868","cpu_time_v0":294,"cpu_time_v1":210,"memory_v0":18424,"memory_v1":51184,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.57,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport itertools\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nstl = []\n\nfor i in range(N):\n\n a = int(eval(input()))\n\n for _ in range(a):\n\n x, y = list(map(int, input().split()))\n\n stl.append((i, x-1, y))\n\ndl = np.array(list(itertools.product([0, 1], repeat=N)), np.bool)\n\nfor i, x, y in stl:\n\n bl = (dl[:, i] == False) | (dl[:, x] == bool(y))\n\n dl = dl[bl]\n\nres = dl.sum(axis=1).max()\n\nprint(res)\n\n\n# optimized version of the same code:\n","target":"import sys\n\nimport itertools\n\nimport collections\n\n\n\n\n\ndef solve():\n\n readline = sys.stdin.buffer.readline\n\n mod = 10 ** 9 + 7\n\n n = int(readline())\n\n xy = []\n\n for i in range(n):\n\n a = int(readline())\n\n for j in range(a):\n\n x, y = list(map(int, readline().split()))\n\n xy.append([i, x-1, y])\n\n ls = collections.deque([v for v in itertools.product([True, False], repeat=n)])\n\n for i, x, y in xy:\n\n for j in range(len(ls)):\n\n lsv = ls.pop()\n\n if not lsv[i] or lsv[x] == bool(y):\n\n ls.appendleft(lsv)\n\n t = 0\n\n for i in range(len(ls)):\n\n t = max(t, ls[i].count(True))\n\n print(t)\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","code_v0_loc":16,"code_v1_loc":29,"code_v0_num_chars":407,"code_v1_num_chars":737,"code_v0_no_empty_lines":"import itertools\nimport numpy as np\n\nN = int(eval(input()))\nstl = []\nfor i in range(N):\n a = int(eval(input()))\n for _ in range(a):\n x, y = list(map(int, input().split()))\n stl.append((i, x - 1, y))\ndl = np.array(list(itertools.product([0, 1], repeat=N)), np.bool)\nfor i, x, y in stl:\n bl = (dl[:, i] == False) | (dl[:, x] == bool(y))\n dl = dl[bl]\nres = dl.sum(axis=1).max()\nprint(res)\n","code_v1_no_empty_lines":"import sys\nimport itertools\nimport collections\n\n\ndef solve():\n readline = sys.stdin.buffer.readline\n mod = 10**9 + 7\n n = int(readline())\n xy = []\n for i in range(n):\n a = int(readline())\n for j in range(a):\n x, y = list(map(int, readline().split()))\n xy.append([i, x - 1, y])\n ls = collections.deque([v for v in itertools.product([True, False], repeat=n)])\n for i, x, y in xy:\n for j in range(len(ls)):\n lsv = ls.pop()\n if not lsv[i] or lsv[x] == bool(y):\n ls.appendleft(lsv)\n t = 0\n for i in range(len(ls)):\n t = max(t, ls[i].count(True))\n print(t)\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":44.8275862069,"diff":["+import sys","-import numpy as np","+import collections","-N = int(eval(input()))","-stl = []","-for i in range(N):","- a = int(eval(input()))","- for _ in range(a):","- x, y = list(map(int, input().split()))","- stl.append((i, x - 1, y))","-dl = np.array(list(itertools.product([0, 1], repeat=N)), np.bool)","-for i, x, y in stl:","- bl = (dl[:, i] == False) | (dl[:, x] == bool(y))","- dl = dl[bl]","-res = dl.sum(axis=1).max()","-print(res)","+","+def solve():","+ readline = sys.stdin.buffer.readline","+ mod = 10**9 + 7","+ n = int(readline())","+ xy = []","+ for i in range(n):","+ a = int(readline())","+ for j in range(a):","+ x, y = list(map(int, readline().split()))","+ xy.append([i, x - 1, y])","+ ls = collections.deque([v for v in itertools.product([True, False], repeat=n)])","+ for i, x, y in xy:","+ for j in range(len(ls)):","+ lsv = ls.pop()","+ if not lsv[i] or lsv[x] == bool(y):","+ ls.appendleft(lsv)","+ t = 0","+ for i in range(len(ls)):","+ t = max(t, ls[i].count(True))","+ print(t)","+","+","+if __name__ == \"__main__\":","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":1.8206197913,"measured_runtime_v1":0.3057051079,"runtime_lift":5.9554771706,"key":["s384273193","s761835868"]} +{"user_id":"u297574184","problem_id":"p02901","language":"python","submission_id_v0":"s249297018","submission_id_v1":"s597922218","cpu_time_v0":1727,"cpu_time_v1":694,"memory_v0":3440,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.81,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nINF = 10**10\n\n\n\nN, M = list(map(int, input().split()))\n\ncosts = []\n\nkeys = []\n\nfor _ in range(M):\n\n A, B = list(map(int, input().split()))\n\n cs = list(map(int, input().split()))\n\n costs.append(A)\n\n # \u9375\u30922\u9032\u6570\u5316\u3059\u308b\n\n key = 0\n\n for c in cs:\n\n key |= 1<<(c-1)\n\n keys.append(key)\n\n\n\n# [1]\u306e\u500b\u6570\u3067\u5206\u985e\u3059\u308b\n\nmaskss = [[] for _ in range(N+1)]\n\nnum1s = [0] * (2**N)\n\nfor S in range(2**N):\n\n num = bin(S).count('1')\n\n maskss[num].append(S)\n\n num1s[S] = num\n\n\n\ndpAll = [INF] * (2**N)\n\nfor S in range(2**N):\n\n for cost, key in zip(costs, keys):\n\n if S & key == S:\n\n if cost < dpAll[S]:\n\n dpAll[S] = cost\n\n\n\ndp = [INF] * (2**N)\n\nfor S in range(2**N):\n\n cost = dpAll[S]\n\n num1 = num1s[S]\n\n for k in range(1, (num1+1)\/\/2+1):\n\n for mask in maskss[k]:\n\n if mask & S == mask:\n\n m2 = S^mask\n\n c2 = dp[mask] + dp[m2]\n\n if c2 < cost:\n\n cost = c2\n\n dp[S] = cost\n\n\n\nif dp[2**N-1] == INF:\n\n print((-1))\n\nelse:\n\n print((dp[2**N-1]))\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef solve():\n\n INF = 10**10\n\n\n\n N, M = list(map(int, input().split()))\n\n keys = []\n\n costs = []\n\n for _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n costs.append(a)\n\n cs = list(map(int, input().split()))\n\n key = 0\n\n for c in cs:\n\n key |= 1<<(c-1)\n\n keys.append(key)\n\n\n\n dp = [INF] * (1< 0: yield r - 1, c\n\n if r < h - 1: yield r + 1, c\n\n if c > 0: yield r, c - 1\n\n if c < w - 1: yield r, c + 1\n\n\n\n q = deque()\n\n q.append((0, 0))\n\n count = [[-1] * w for _ in range(h)]\n\n count[0][0] = 1\n\n while q:\n\n r, c = q.popleft()\n\n k = count[r][c]\n\n for nr, nc in coods(r, c):\n\n nchar = s[nr][nc]\n\n if nchar == '#': continue\n\n if count[nr][nc] != -1: continue\n\n count[nr][nc] = k + 1\n\n if (nr, nc) == (h - 1, w - 1):\n\n print((h * w - (k + 1) - bk))\n\n return\n\n q.append((nr, nc))\n\n print((-1))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":41,"code_v1_loc":40,"code_v0_num_chars":837,"code_v1_num_chars":967,"code_v0_no_empty_lines":"from collections import deque\n\nINF = float(\"inf\")\ndr = (-1, 0, 0, 1)\ndc = (0, -1, 1, 0)\nH, W = list(map(int, input().split()))\ns = []\ntotal_white_count = 0\nfor _ in range(H):\n t = eval(input())\n s.append(t)\n total_white_count += t.count(\".\")\np = [[INF for _ in range(W)] for _ in range(H)]\nans = -1\ndq = deque()\ndq.append((0, 0, 1))\nwhile dq:\n r, c, d = dq.popleft() # \u76f4\u3057\u305f\n nd = d + 1\n for i in range(4):\n nr = r + dr[i]\n nc = c + dc[i]\n if not (0 <= nr < H and 0 <= nc < W):\n continue\n if s[nr][nc] == \"#\":\n continue\n if p[nr][nc] <= nd:\n continue\n p[nr][nc] = nd\n if nr == H - 1 and nc == W - 1:\n ans = total_white_count - nd\n break\n dq.append((nr, nc, nd))\n else:\n continue\n break\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n from collections import deque\n import sys\n\n input = sys.stdin.readline\n h, w = list(map(int, input().split()))\n s = [eval(input()) for _ in range(h)]\n bk = 0\n for row in s:\n bk += row.count(\"#\")\n\n def coods(r, c):\n if r > 0:\n yield r - 1, c\n if r < h - 1:\n yield r + 1, c\n if c > 0:\n yield r, c - 1\n if c < w - 1:\n yield r, c + 1\n\n q = deque()\n q.append((0, 0))\n count = [[-1] * w for _ in range(h)]\n count[0][0] = 1\n while q:\n r, c = q.popleft()\n k = count[r][c]\n for nr, nc in coods(r, c):\n nchar = s[nr][nc]\n if nchar == \"#\":\n continue\n if count[nr][nc] != -1:\n continue\n count[nr][nc] = k + 1\n if (nr, nc) == (h - 1, w - 1):\n print((h * w - (k + 1) - bk))\n return\n q.append((nr, nc))\n print((-1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.4390243902,"diff":["-from collections import deque","+def main():","+ from collections import deque","+ import sys","-INF = float(\"inf\")","-dr = (-1, 0, 0, 1)","-dc = (0, -1, 1, 0)","-H, W = list(map(int, input().split()))","-s = []","-total_white_count = 0","-for _ in range(H):","- t = eval(input())","- s.append(t)","- total_white_count += t.count(\".\")","-p = [[INF for _ in range(W)] for _ in range(H)]","-ans = -1","-dq = deque()","-dq.append((0, 0, 1))","-while dq:","- r, c, d = dq.popleft() # \u76f4\u3057\u305f","- nd = d + 1","- for i in range(4):","- nr = r + dr[i]","- nc = c + dc[i]","- if not (0 <= nr < H and 0 <= nc < W):","- continue","- if s[nr][nc] == \"#\":","- continue","- if p[nr][nc] <= nd:","- continue","- p[nr][nc] = nd","- if nr == H - 1 and nc == W - 1:","- ans = total_white_count - nd","- break","- dq.append((nr, nc, nd))","- else:","- continue","- break","-print(ans)","+ input = sys.stdin.readline","+ h, w = list(map(int, input().split()))","+ s = [eval(input()) for _ in range(h)]","+ bk = 0","+ for row in s:","+ bk += row.count(\"#\")","+","+ def coods(r, c):","+ if r > 0:","+ yield r - 1, c","+ if r < h - 1:","+ yield r + 1, c","+ if c > 0:","+ yield r, c - 1","+ if c < w - 1:","+ yield r, c + 1","+","+ q = deque()","+ q.append((0, 0))","+ count = [[-1] * w for _ in range(h)]","+ count[0][0] = 1","+ while q:","+ r, c = q.popleft()","+ k = count[r][c]","+ for nr, nc in coods(r, c):","+ nchar = s[nr][nc]","+ if nchar == \"#\":","+ continue","+ if count[nr][nc] != -1:","+ continue","+ count[nr][nc] = k + 1","+ if (nr, nc) == (h - 1, w - 1):","+ print((h * w - (k + 1) - bk))","+ return","+ q.append((nr, nc))","+ print((-1))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.172286804,"measured_runtime_v1":0.0058592412,"runtime_lift":29.4042857085,"key":["s361663353","s061031658"]} +{"user_id":"u189326411","problem_id":"p03796","language":"python","submission_id_v0":"s862494830","submission_id_v1":"s415254610","cpu_time_v0":230,"cpu_time_v1":37,"memory_v0":4020,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nn = int(eval(input()))\n\nprint((math.factorial(n)%(10**9+7)))\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nmod = 10**9 + 7\n\n\n\npow = 1\n\nfor i in range(n):\n\n pow = pow*(i+1)%mod\n\n\n\nprint(pow)\n","code_v0_loc":3,"code_v1_loc":8,"code_v0_num_chars":66,"code_v1_num_chars":104,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nprint((math.factorial(n) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nmod = 10**9 + 7\npow = 1\nfor i in range(n):\n pow = pow * (i + 1) % mod\nprint(pow)\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-import math","-","-print((math.factorial(n) % (10**9 + 7)))","+mod = 10**9 + 7","+pow = 1","+for i in range(n):","+ pow = pow * (i + 1) % mod","+print(pow)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5275577738,"measured_runtime_v1":0.2526761317,"runtime_lift":2.0878813135,"key":["s862494830","s415254610"]} +{"user_id":"u579699847","problem_id":"p02982","language":"python","submission_id_v0":"s394430512","submission_id_v1":"s562354145","cpu_time_v0":152,"cpu_time_v1":18,"memory_v0":12500,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy\n\nN, D = list(map(int, input().split()))\n\nlistx = []\n\ncount = 0\n\nfor i in range(N):\n\n x = list(map(int, input().split()))\n\n listx.append(x)\n\n\n\nfor j in range(0, N):\n\n for k in range(j+1,N):\n\n a = numpy.array(listx[j])\n\n b = numpy.array(listx[k])\n\n u = b - a\n\n c = float(numpy.linalg.norm(u))\n\n if c.is_integer() :\n\n count += 1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"def LI(): return list(map(int,input().split()))\n\nN,D = LI()\n\nX = [LI() for _ in range(N)]\n\nans = 0\n\nfor i in range(N):\n\n for j in range(i+1,N):\n\n temp = 0\n\n for k in range(D):\n\n temp += (X[j][k]-X[i][k])**2\n\n if temp **0.5%1==0:\n\n ans += 1\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":12,"code_v0_num_chars":401,"code_v1_num_chars":297,"code_v0_no_empty_lines":"import numpy\n\nN, D = list(map(int, input().split()))\nlistx = []\ncount = 0\nfor i in range(N):\n x = list(map(int, input().split()))\n listx.append(x)\nfor j in range(0, N):\n for k in range(j + 1, N):\n a = numpy.array(listx[j])\n b = numpy.array(listx[k])\n u = b - a\n c = float(numpy.linalg.norm(u))\n if c.is_integer():\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"def LI():\n return list(map(int, input().split()))\n\n\nN, D = LI()\nX = [LI() for _ in range(N)]\nans = 0\nfor i in range(N):\n for j in range(i + 1, N):\n temp = 0\n for k in range(D):\n temp += (X[j][k] - X[i][k]) ** 2\n if temp**0.5 % 1 == 0:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["-import numpy","+def LI():","+ return list(map(int, input().split()))","-N, D = list(map(int, input().split()))","-listx = []","-count = 0","+","+N, D = LI()","+X = [LI() for _ in range(N)]","+ans = 0","- x = list(map(int, input().split()))","- listx.append(x)","-for j in range(0, N):","- for k in range(j + 1, N):","- a = numpy.array(listx[j])","- b = numpy.array(listx[k])","- u = b - a","- c = float(numpy.linalg.norm(u))","- if c.is_integer():","- count += 1","-print(count)","+ for j in range(i + 1, N):","+ temp = 0","+ for k in range(D):","+ temp += (X[j][k] - X[i][k]) ** 2","+ if temp**0.5 % 1 == 0:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.65457302,"measured_runtime_v1":0.2349083569,"runtime_lift":7.0434830064,"key":["s394430512","s562354145"]} +{"user_id":"u362599643","problem_id":"p02690","language":"python","submission_id_v0":"s891055347","submission_id_v1":"s676876891","cpu_time_v0":67,"cpu_time_v1":47,"memory_v0":9088,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.85,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nX=int(eval(input()))\n\nfor i in range(-200,201):\n\n for j in range(-200,201):\n\n if i**5-j**5==X:\n\n print((i,j))\n\n exit()\n\n# optimized version of the same code:\n","target":"X=int(eval(input()))\n\nfor i in range(-150,151):\n\n for j in range(-150,151):\n\n if i**5-j**5==X:\n\n print((i,j))\n\n exit()","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":142,"code_v1_num_chars":142,"code_v0_no_empty_lines":"X = int(eval(input()))\nfor i in range(-200, 201):\n for j in range(-200, 201):\n if i**5 - j**5 == X:\n print((i, j))\n exit()\n","code_v1_no_empty_lines":"X = int(eval(input()))\nfor i in range(-150, 151):\n for j in range(-150, 151):\n if i**5 - j**5 == X:\n print((i, j))\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(-200, 201):","- for j in range(-200, 201):","+for i in range(-150, 151):","+ for j in range(-150, 151):"],"diff_only_import_comment":false,"measured_runtime_v0":0.6261565427,"measured_runtime_v1":0.3813971301,"runtime_lift":1.6417442431,"key":["s891055347","s676876891"]} +{"user_id":"u982591663","problem_id":"p03107","language":"python","submission_id_v0":"s749413264","submission_id_v1":"s028114766","cpu_time_v0":22,"cpu_time_v1":19,"memory_v0":3956,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = list(eval(input()))\n\nnum_one = S.count(\"1\")\n\nnum_zero = S.count(\"0\")\n\nans = min(num_one, num_zero) *2\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"S = eval(input())\n\n\n\nans = min(S.count(\"0\"), S.count(\"1\")) * 2\n\nprint(ans)\n","code_v0_loc":5,"code_v1_loc":4,"code_v0_num_chars":112,"code_v1_num_chars":69,"code_v0_no_empty_lines":"S = list(eval(input()))\nnum_one = S.count(\"1\")\nnum_zero = S.count(\"0\")\nans = min(num_one, num_zero) * 2\nprint(ans)\n","code_v1_no_empty_lines":"S = eval(input())\nans = min(S.count(\"0\"), S.count(\"1\")) * 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-S = list(eval(input()))","-num_one = S.count(\"1\")","-num_zero = S.count(\"0\")","-ans = min(num_one, num_zero) * 2","+S = eval(input())","+ans = min(S.count(\"0\"), S.count(\"1\")) * 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.2118026633,"measured_runtime_v1":0.0063807995,"runtime_lift":33.1937497698,"key":["s749413264","s028114766"]} +{"user_id":"u624475441","problem_id":"p03457","language":"python","submission_id_v0":"s302891502","submission_id_v1":"s171916715","cpu_time_v0":228,"cpu_time_v1":146,"memory_v0":28148,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.96,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ncan = True; eval(input())\n\ne = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]\n\nfor a, b in zip(e[1:], e):\n\n t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])\n\n if t < 0 or t % 2 == 1: can = False; break\n\nprint((['No', 'Yes'][can]))\n\n# optimized version of the same code:\n","target":"import sys\n\nans = 'Yes'; eval(input())\n\nfor e in sys.stdin:\n\n t, x, y = list(map(int, e.split()))\n\n t = t - x - y\n\n if t < 0 or t % 2 == 1: ans = 'No'; break\n\nprint(ans)","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":259,"code_v1_num_chars":166,"code_v0_no_empty_lines":"import sys\n\ncan = True\neval(input())\ne = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]\nfor a, b in zip(e[1:], e):\n t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])\n if t < 0 or t % 2 == 1:\n can = False\n break\nprint(([\"No\", \"Yes\"][can]))\n","code_v1_no_empty_lines":"import sys\n\nans = \"Yes\"\neval(input())\nfor e in sys.stdin:\n t, x, y = list(map(int, e.split()))\n t = t - x - y\n if t < 0 or t % 2 == 1:\n ans = \"No\"\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-can = True","+ans = \"Yes\"","-e = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]","-for a, b in zip(e[1:], e):","- t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])","+for e in sys.stdin:","+ t, x, y = list(map(int, e.split()))","+ t = t - x - y","- can = False","+ ans = \"No\"","-print(([\"No\", \"Yes\"][can]))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2223628902,"measured_runtime_v1":0.1447919474,"runtime_lift":1.5357407251,"key":["s302891502","s171916715"]} +{"user_id":"u936985471","problem_id":"p02901","language":"python","submission_id_v0":"s462370890","submission_id_v1":"s446448975","cpu_time_v0":1278,"cpu_time_v1":790,"memory_v0":9056,"memory_v1":9192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.18,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nreadline = sys.stdin.readline\n\n\n\nN,M = list(map(int,readline().split()))\n\nINF = 10 ** 10\n\ndp = [INF] * (2 ** N)\n\ndp[0] = 0\n\n\n\nfor i in range(M):\n\n a,b = list(map(int,readline().split()))\n\n c = list(map(int,readline().split()))\n\n key = 0\n\n for j in range(len(c)):\n\n key += (1 << (c[j] - 1))\n\n for j in range(len(dp)):\n\n if dp[j] == INF:\n\n continue\n\n if j | key == j:\n\n continue\n\n dp[j | key] = min(dp[j | key], dp[j] + a)\n\n\n\nif dp[-1] == INF:\n\n print((-1))\n\nelse:\n\n print((dp[-1]))\n\n# optimized version of the same code:\n","target":"import sys\n\nreadline = sys.stdin.readline\n\n\n\nN,M = list(map(int,readline().split()))\n\nINF = 10 ** 10\n\ndp = [INF] * (2 ** N)\n\ndp[0] = 0\n\n\n\nfor i in range(M):\n\n a,b = list(map(int,readline().split()))\n\n c = list(map(int,readline().split()))\n\n key = 0\n\n for j in range(len(c)):\n\n key += (1 << (c[j] - 1))\n\n for j in range(len(dp)):\n\n if dp[j] == INF:\n\n continue\n\n if j | key == j:\n\n continue\n\n if dp[j | key] > dp[j] + a:\n\n dp[j | key] = dp[j] + a\n\n\n\nif dp[-1] == INF:\n\n print((-1))\n\nelse:\n\n print((dp[-1]))","code_v0_loc":25,"code_v1_loc":26,"code_v0_num_chars":505,"code_v1_num_chars":522,"code_v0_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nN, M = list(map(int, readline().split()))\nINF = 10**10\ndp = [INF] * (2**N)\ndp[0] = 0\nfor i in range(M):\n a, b = list(map(int, readline().split()))\n c = list(map(int, readline().split()))\n key = 0\n for j in range(len(c)):\n key += 1 << (c[j] - 1)\n for j in range(len(dp)):\n if dp[j] == INF:\n continue\n if j | key == j:\n continue\n dp[j | key] = min(dp[j | key], dp[j] + a)\nif dp[-1] == INF:\n print((-1))\nelse:\n print((dp[-1]))\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nN, M = list(map(int, readline().split()))\nINF = 10**10\ndp = [INF] * (2**N)\ndp[0] = 0\nfor i in range(M):\n a, b = list(map(int, readline().split()))\n c = list(map(int, readline().split()))\n key = 0\n for j in range(len(c)):\n key += 1 << (c[j] - 1)\n for j in range(len(dp)):\n if dp[j] == INF:\n continue\n if j | key == j:\n continue\n if dp[j | key] > dp[j] + a:\n dp[j | key] = dp[j] + a\nif dp[-1] == INF:\n print((-1))\nelse:\n print((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":3.8461538462,"diff":["- dp[j | key] = min(dp[j | key], dp[j] + a)","+ if dp[j | key] > dp[j] + a:","+ dp[j | key] = dp[j] + a"],"diff_only_import_comment":false,"measured_runtime_v0":0.2747366824,"measured_runtime_v1":0.0058527424,"runtime_lift":46.941529559,"key":["s462370890","s446448975"]} +{"user_id":"u837673618","problem_id":"p02721","language":"python","submission_id_v0":"s949081681","submission_id_v1":"s434725940","cpu_time_v0":326,"cpu_time_v1":177,"memory_v0":12688,"memory_v1":12576,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, K, C = list(map(int, input().split()))\n\nS = eval(input())\n\n\n\nlatest = [None]*K\n\ni = len(S)+C\n\nfor j in range(K-1, -1, -1):\n\n i = S.rindex(\"o\", 0, i-C)\n\n latest[j] = i\n\n\n\nif i<=C or \"o\" not in S[:i-C]:\n\n i = -C-1\n\n for j in latest:\n\n i = S.index(\"o\", i+C+1)\n\n if i == j:\n\n print((i+1))\n\n\n# optimized version of the same code:\n","target":"def solve():\n\n N, K, C = list(map(int, input().split()))\n\n workable = [i for i, s in enumerate(eval(input())) if s==\"o\"]\n\n if len(workable) == K:\n\n return workable\n\n \n\n prev = workable[-1]\n\n latest = {prev}\n\n i = len(workable)-1\n\n while i > 0:\n\n i -= 1\n\n if prev - workable[i] > C:\n\n latest.add(workable[i])\n\n prev = workable[i]\n\n if len(latest) > K:\n\n return []\n\n must = []\n\n i = -1\n\n prev = -C-1\n\n while i < len(workable)-1:\n\n i += 1\n\n if workable[i] - prev > C:\n\n if workable[i] in latest:\n\n must.append(workable[i])\n\n prev = workable[i]\n\n return must\n\n\n\nfor i in solve():\n\n print((i+1))","code_v0_loc":15,"code_v1_loc":29,"code_v0_num_chars":289,"code_v1_num_chars":646,"code_v0_no_empty_lines":"N, K, C = list(map(int, input().split()))\nS = eval(input())\nlatest = [None] * K\ni = len(S) + C\nfor j in range(K - 1, -1, -1):\n i = S.rindex(\"o\", 0, i - C)\n latest[j] = i\nif i <= C or \"o\" not in S[: i - C]:\n i = -C - 1\n for j in latest:\n i = S.index(\"o\", i + C + 1)\n if i == j:\n print((i + 1))\n","code_v1_no_empty_lines":"def solve():\n N, K, C = list(map(int, input().split()))\n workable = [i for i, s in enumerate(eval(input())) if s == \"o\"]\n if len(workable) == K:\n return workable\n prev = workable[-1]\n latest = {prev}\n i = len(workable) - 1\n while i > 0:\n i -= 1\n if prev - workable[i] > C:\n latest.add(workable[i])\n prev = workable[i]\n if len(latest) > K:\n return []\n must = []\n i = -1\n prev = -C - 1\n while i < len(workable) - 1:\n i += 1\n if workable[i] - prev > C:\n if workable[i] in latest:\n must.append(workable[i])\n prev = workable[i]\n return must\n\n\nfor i in solve():\n print((i + 1))\n","code_same":false,"relative_loc_diff_percent":48.275862069,"diff":["-N, K, C = list(map(int, input().split()))","-S = eval(input())","-latest = [None] * K","-i = len(S) + C","-for j in range(K - 1, -1, -1):","- i = S.rindex(\"o\", 0, i - C)","- latest[j] = i","-if i <= C or \"o\" not in S[: i - C]:","- i = -C - 1","- for j in latest:","- i = S.index(\"o\", i + C + 1)","- if i == j:","- print((i + 1))","+def solve():","+ N, K, C = list(map(int, input().split()))","+ workable = [i for i, s in enumerate(eval(input())) if s == \"o\"]","+ if len(workable) == K:","+ return workable","+ prev = workable[-1]","+ latest = {prev}","+ i = len(workable) - 1","+ while i > 0:","+ i -= 1","+ if prev - workable[i] > C:","+ latest.add(workable[i])","+ prev = workable[i]","+ if len(latest) > K:","+ return []","+ must = []","+ i = -1","+ prev = -C - 1","+ while i < len(workable) - 1:","+ i += 1","+ if workable[i] - prev > C:","+ if workable[i] in latest:","+ must.append(workable[i])","+ prev = workable[i]","+ return must","+","+","+for i in solve():","+ print((i + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3840038183,"measured_runtime_v1":0.2943901448,"runtime_lift":1.3044044613,"key":["s949081681","s434725940"]} +{"user_id":"u102461423","problem_id":"p03747","language":"python","submission_id_v0":"s216230376","submission_id_v1":"s376589884","cpu_time_v0":268,"cpu_time_v1":169,"memory_v0":34272,"memory_v1":41876,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.94,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN,L,T = list(map(int,input().split()))\n\nXW = [[int(x) for x in input().split()] for _ in range(N)]\n\n\n\nX,W = list(zip(*XW))\n\n\n\nDX = [1 if w == 1 else -1 for w in W]\n\n\n\nY = [(x+dx*T)%L for x,dx in zip(X,DX)]\n\ny0 = Y[0]\n\nY.sort()\n\n\n\n# \u756a\u53f71\u304c\u3059\u308c\u9055\u308f\u305a\u9032\u3093\u3060\u5834\u6240\u306b\u76f8\u5f53\u3059\u308b\u30a2\u30ea\u306e\u756a\u53f7\n\n# \u3059\u308c\u9055\u3046\u305f\u3073\u306b1\u5897\u3048\u308b\uff08W1=1\uff09 or 1\u6e1b\u308b\uff08W1=-1\uff09\n\n# T\u79d2\u3061\u3087\u3046\u3069\u3082\u3059\u308c\u9055\u3044\u7d42\u308f\u3063\u305f\u3068\u8003\u3048\u308b\n\n\n\nx = 0\n\nx0,dx0 = X[0],DX[0]\n\nfor y,dy in zip(X[1:],DX[1:]):\n\n if dx0 == dy:\n\n continue\n\n if dx0 == 1 and dy == -1:\n\n # \u6b63\u306e\u5411\u304d\u306b\u8ffd\u3044\u8d8a\u3059\u306e\u3067\u756a\u53f7\u304c\u3072\u3068\u3064\u5897\u3048\u308b\n\n x += (2*T-(y-x0)-1)\/\/L + 1\n\n if dx0 == -1 and dy == 1:\n\n x -= (2*T-(L+x0-y))\/\/L + 1\n\nx %= N\n\n\n\ni = Y.index(y0)\n\n\n\nY += Y\n\n\n\nanswer = [None] * N\n\nanswer[x:N] = Y[i:i+N-x]\n\nanswer[0:x] = Y[i+N-x:i+N]\n\n\n\nprint(('\\n'.join(map(str,answer))))\n\n\n\n\n# optimized version of the same code:\n","target":"import sys\n\nimport numpy as np\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n\"\"\"\n\n\u30fb\u9806\u5e8f\u304c\u56fa\u5b9a\u3055\u308c\u308b\u306e\u3067\u3001\u533a\u9593\u3060\u3063\u305f\u3089\u7c21\u5358\n\n\u30fb\u5186\u306e\u3068\u304d\u3082\u3001\u5730\u70b9 0 \u3092\u305d\u308c\u305e\u308c\u306e\u65b9\u5411\u306b\u901a\u3063\u305f\u4eba\u6570\u3092\u898b\u308c\u3070\u8a08\u7b97\u3067\u304d\u308b\n\n\"\"\"\n\n\n\nN, L, T = list(map(int, readline().split()))\n\nXW = np.array(read().split(), np.int64)\n\nX = XW[::2]\n\nW = XW[1::2]\n\n\n\nspeed = np.where(W == 1, 1, -1)\n\n\n\nY = X + speed * T\n\n\n\nn = (Y \/\/ L - X \/\/ L).sum()\n\nn %= N\n\n\n\nY %= L\n\nY.sort()\n\nY = np.concatenate((Y[n:], Y[:n]))\n\n\n\nprint(('\\n'.join(map(str, Y.tolist()))))","code_v0_loc":40,"code_v1_loc":29,"code_v0_num_chars":763,"code_v1_num_chars":514,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, L, T = list(map(int, input().split()))\nXW = [[int(x) for x in input().split()] for _ in range(N)]\nX, W = list(zip(*XW))\nDX = [1 if w == 1 else -1 for w in W]\nY = [(x + dx * T) % L for x, dx in zip(X, DX)]\ny0 = Y[0]\nY.sort()\n# \u756a\u53f71\u304c\u3059\u308c\u9055\u308f\u305a\u9032\u3093\u3060\u5834\u6240\u306b\u76f8\u5f53\u3059\u308b\u30a2\u30ea\u306e\u756a\u53f7\n# \u3059\u308c\u9055\u3046\u305f\u3073\u306b1\u5897\u3048\u308b\uff08W1=1\uff09 or 1\u6e1b\u308b\uff08W1=-1\uff09\n# T\u79d2\u3061\u3087\u3046\u3069\u3082\u3059\u308c\u9055\u3044\u7d42\u308f\u3063\u305f\u3068\u8003\u3048\u308b\nx = 0\nx0, dx0 = X[0], DX[0]\nfor y, dy in zip(X[1:], DX[1:]):\n if dx0 == dy:\n continue\n if dx0 == 1 and dy == -1:\n # \u6b63\u306e\u5411\u304d\u306b\u8ffd\u3044\u8d8a\u3059\u306e\u3067\u756a\u53f7\u304c\u3072\u3068\u3064\u5897\u3048\u308b\n x += (2 * T - (y - x0) - 1) \/\/ L + 1\n if dx0 == -1 and dy == 1:\n x -= (2 * T - (L + x0 - y)) \/\/ L + 1\nx %= N\ni = Y.index(y0)\nY += Y\nanswer = [None] * N\nanswer[x:N] = Y[i : i + N - x]\nanswer[0:x] = Y[i + N - x : i + N]\nprint((\"\\n\".join(map(str, answer))))\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\"\"\"\n\u30fb\u9806\u5e8f\u304c\u56fa\u5b9a\u3055\u308c\u308b\u306e\u3067\u3001\u533a\u9593\u3060\u3063\u305f\u3089\u7c21\u5358\n\u30fb\u5186\u306e\u3068\u304d\u3082\u3001\u5730\u70b9 0 \u3092\u305d\u308c\u305e\u308c\u306e\u65b9\u5411\u306b\u901a\u3063\u305f\u4eba\u6570\u3092\u898b\u308c\u3070\u8a08\u7b97\u3067\u304d\u308b\n\"\"\"\nN, L, T = list(map(int, readline().split()))\nXW = np.array(read().split(), np.int64)\nX = XW[::2]\nW = XW[1::2]\nspeed = np.where(W == 1, 1, -1)\nY = X + speed * T\nn = (Y \/\/ L - X \/\/ L).sum()\nn %= N\nY %= L\nY.sort()\nY = np.concatenate((Y[n:], Y[:n]))\nprint((\"\\n\".join(map(str, Y.tolist()))))\n","code_same":false,"relative_loc_diff_percent":27.5,"diff":["+import numpy as np","-input = sys.stdin.readline","-N, L, T = list(map(int, input().split()))","-XW = [[int(x) for x in input().split()] for _ in range(N)]","-X, W = list(zip(*XW))","-DX = [1 if w == 1 else -1 for w in W]","-Y = [(x + dx * T) % L for x, dx in zip(X, DX)]","-y0 = Y[0]","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+\"\"\"","+\u30fb\u9806\u5e8f\u304c\u56fa\u5b9a\u3055\u308c\u308b\u306e\u3067\u3001\u533a\u9593\u3060\u3063\u305f\u3089\u7c21\u5358","+\u30fb\u5186\u306e\u3068\u304d\u3082\u3001\u5730\u70b9 0 \u3092\u305d\u308c\u305e\u308c\u306e\u65b9\u5411\u306b\u901a\u3063\u305f\u4eba\u6570\u3092\u898b\u308c\u3070\u8a08\u7b97\u3067\u304d\u308b","+\"\"\"","+N, L, T = list(map(int, readline().split()))","+XW = np.array(read().split(), np.int64)","+X = XW[::2]","+W = XW[1::2]","+speed = np.where(W == 1, 1, -1)","+Y = X + speed * T","+n = (Y \/\/ L - X \/\/ L).sum()","+n %= N","+Y %= L","-# \u756a\u53f71\u304c\u3059\u308c\u9055\u308f\u305a\u9032\u3093\u3060\u5834\u6240\u306b\u76f8\u5f53\u3059\u308b\u30a2\u30ea\u306e\u756a\u53f7","-# \u3059\u308c\u9055\u3046\u305f\u3073\u306b1\u5897\u3048\u308b\uff08W1=1\uff09 or 1\u6e1b\u308b\uff08W1=-1\uff09","-# T\u79d2\u3061\u3087\u3046\u3069\u3082\u3059\u308c\u9055\u3044\u7d42\u308f\u3063\u305f\u3068\u8003\u3048\u308b","-x = 0","-x0, dx0 = X[0], DX[0]","-for y, dy in zip(X[1:], DX[1:]):","- if dx0 == dy:","- continue","- if dx0 == 1 and dy == -1:","- # \u6b63\u306e\u5411\u304d\u306b\u8ffd\u3044\u8d8a\u3059\u306e\u3067\u756a\u53f7\u304c\u3072\u3068\u3064\u5897\u3048\u308b","- x += (2 * T - (y - x0) - 1) \/\/ L + 1","- if dx0 == -1 and dy == 1:","- x -= (2 * T - (L + x0 - y)) \/\/ L + 1","-x %= N","-i = Y.index(y0)","-Y += Y","-answer = [None] * N","-answer[x:N] = Y[i : i + N - x]","-answer[0:x] = Y[i + N - x : i + N]","-print((\"\\n\".join(map(str, answer))))","+Y = np.concatenate((Y[n:], Y[:n]))","+print((\"\\n\".join(map(str, Y.tolist()))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2011978789,"measured_runtime_v1":0.0059206796,"runtime_lift":33.9822267906,"key":["s216230376","s376589884"]} +{"user_id":"u628794221","problem_id":"p02688","language":"python","submission_id_v0":"s048784054","submission_id_v1":"s441243732","cpu_time_v0":24,"cpu_time_v1":20,"memory_v0":9192,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, K = list(map(int, input().split()))\n\nsunuke = [True]*N\n\nfor i in range(K):\n\n d = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n sunuke[a-1] = False\n\n\n\nans = 0\n\nfor i in range(N):\n\n if sunuke[i]:\n\n ans += 1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N, K = list(map(int, input().split()))\n\nflag = [True]*N\n\nfor i in range(K):\n\n d = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n flag[a-1] = False\n\nans = 0\n\nfor i in range(N):\n\n if flag[i]:\n\n ans += 1\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":260,"code_v1_num_chars":252,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nsunuke = [True] * N\nfor i in range(K):\n d = int(eval(input()))\n A = list(map(int, input().split()))\n for a in A:\n sunuke[a - 1] = False\nans = 0\nfor i in range(N):\n if sunuke[i]:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nflag = [True] * N\nfor i in range(K):\n d = int(eval(input()))\n A = list(map(int, input().split()))\n for a in A:\n flag[a - 1] = False\nans = 0\nfor i in range(N):\n if flag[i]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-sunuke = [True] * N","+flag = [True] * N","- sunuke[a - 1] = False","+ flag[a - 1] = False","- if sunuke[i]:","+ if flag[i]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3757941551,"measured_runtime_v1":0.2950303654,"runtime_lift":1.2737473806,"key":["s048784054","s441243732"]} +{"user_id":"u638456847","problem_id":"p02937","language":"python","submission_id_v0":"s386654104","submission_id_v1":"s129869478","cpu_time_v0":375,"cpu_time_v1":87,"memory_v0":7284,"memory_v1":7924,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.8,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\ndef main():\n\n S = readline().strip()\n\n T = readline().strip()\n\n\n\n idx_in_S = []\n\n last_idx = 0\n\n for t in T:\n\n t_idx = S.find(t, last_idx) + 1\n\n if t_idx:\n\n idx_in_S.append(t_idx)\n\n last_idx = t_idx\n\n else:\n\n t_idx = S.find(t, 0, last_idx) + 1\n\n if not t_idx:\n\n print((-1))\n\n exit()\n\n else:\n\n idx_in_S.append(t_idx)\n\n last_idx = t_idx\n\n\n\n \n\n rep = 0\n\n for i in range(len(T) - 1):\n\n if idx_in_S[i] < idx_in_S[i+1]:\n\n continue\n\n else:\n\n rep += 1\n\n\n\n ans = len(S) * rep + idx_in_S[-1]\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"# S.find()\u306e\u90e8\u5206\u3092\u9ad8\u901f\u5316\u3059\u308b\n\nfrom collections import defaultdict\n\nfrom bisect import bisect_right\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\ndef main():\n\n S = readline().strip()\n\n T = readline().strip()\n\n\n\n S_idx = defaultdict(list)\n\n for i, s in enumerate(S):\n\n S_idx[s].append(i)\n\n \n\n rep = 0\n\n last_idx = -1\n\n for t in T:\n\n t_idx_list = S_idx[t]\n\n if t_idx_list:\n\n t_idx = bisect_right(t_idx_list, last_idx)\n\n if t_idx < len(t_idx_list):\n\n last_idx = t_idx_list[t_idx]\n\n else:\n\n last_idx = t_idx_list[0]\n\n rep += 1\n\n else:\n\n print((-1))\n\n exit()\n\n \n\n ans = len(S) * rep + last_idx + 1\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":39,"code_v1_loc":37,"code_v0_num_chars":840,"code_v1_num_chars":855,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\n\ndef main():\n S = readline().strip()\n T = readline().strip()\n idx_in_S = []\n last_idx = 0\n for t in T:\n t_idx = S.find(t, last_idx) + 1\n if t_idx:\n idx_in_S.append(t_idx)\n last_idx = t_idx\n else:\n t_idx = S.find(t, 0, last_idx) + 1\n if not t_idx:\n print((-1))\n exit()\n else:\n idx_in_S.append(t_idx)\n last_idx = t_idx\n rep = 0\n for i in range(len(T) - 1):\n if idx_in_S[i] < idx_in_S[i + 1]:\n continue\n else:\n rep += 1\n ans = len(S) * rep + idx_in_S[-1]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# S.find()\u306e\u90e8\u5206\u3092\u9ad8\u901f\u5316\u3059\u308b\nfrom collections import defaultdict\nfrom bisect import bisect_right\nimport sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\n\ndef main():\n S = readline().strip()\n T = readline().strip()\n S_idx = defaultdict(list)\n for i, s in enumerate(S):\n S_idx[s].append(i)\n rep = 0\n last_idx = -1\n for t in T:\n t_idx_list = S_idx[t]\n if t_idx_list:\n t_idx = bisect_right(t_idx_list, last_idx)\n if t_idx < len(t_idx_list):\n last_idx = t_idx_list[t_idx]\n else:\n last_idx = t_idx_list[0]\n rep += 1\n else:\n print((-1))\n exit()\n ans = len(S) * rep + last_idx + 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":5.1282051282,"diff":["+# S.find()\u306e\u90e8\u5206\u3092\u9ad8\u901f\u5316\u3059\u308b","+from collections import defaultdict","+from bisect import bisect_right","- idx_in_S = []","- last_idx = 0","+ S_idx = defaultdict(list)","+ for i, s in enumerate(S):","+ S_idx[s].append(i)","+ rep = 0","+ last_idx = -1","- t_idx = S.find(t, last_idx) + 1","- if t_idx:","- idx_in_S.append(t_idx)","- last_idx = t_idx","+ t_idx_list = S_idx[t]","+ if t_idx_list:","+ t_idx = bisect_right(t_idx_list, last_idx)","+ if t_idx < len(t_idx_list):","+ last_idx = t_idx_list[t_idx]","+ else:","+ last_idx = t_idx_list[0]","+ rep += 1","- t_idx = S.find(t, 0, last_idx) + 1","- if not t_idx:","- print((-1))","- exit()","- else:","- idx_in_S.append(t_idx)","- last_idx = t_idx","- rep = 0","- for i in range(len(T) - 1):","- if idx_in_S[i] < idx_in_S[i + 1]:","- continue","- else:","- rep += 1","- ans = len(S) * rep + idx_in_S[-1]","+ print((-1))","+ exit()","+ ans = len(S) * rep + last_idx + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3716950469,"measured_runtime_v1":0.2723373818,"runtime_lift":1.3648330037,"key":["s386654104","s129869478"]} +{"user_id":"u647766105","problem_id":"p00149","language":"python","submission_id_v0":"s470531137","submission_id_v1":"s067459842","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4324,"memory_v1":4316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom bisect import bisect\n\nD = [0.2,0.6,1.1]\n\nL = [0,0,0,0]\n\nR = [0,0,0,0]\n\nwhile True:\n\n try:\n\n left,right = list(map(float,input().split()))\n\n except:\n\n break\n\n L[bisect(D,left)] += 1\n\n R[bisect(D,right)] += 1\n\nfor left,right in zip(L,R)[::-1]:\n\n print(left,right)\n\n# optimized version of the same code:\n","target":"from bisect import bisect\n\nD = [0.2,0.6,1.1]\n\nL = [0]*4\n\nR = [0]*4\n\nwhile True:\n\n try:\n\n left,right = list(map(float,input().split()))\n\n except:\n\n break\n\n L[bisect(D,left)] += 1\n\n R[bisect(D,right)] += 1\n\nfor left,right in zip(L,R)[::-1]:\n\n print(left,right)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":292,"code_v1_num_chars":284,"code_v0_no_empty_lines":"from bisect import bisect\n\nD = [0.2, 0.6, 1.1]\nL = [0, 0, 0, 0]\nR = [0, 0, 0, 0]\nwhile True:\n try:\n left, right = list(map(float, input().split()))\n except:\n break\n L[bisect(D, left)] += 1\n R[bisect(D, right)] += 1\nfor left, right in zip(L, R)[::-1]:\n print(left, right)\n","code_v1_no_empty_lines":"from bisect import bisect\n\nD = [0.2, 0.6, 1.1]\nL = [0] * 4\nR = [0] * 4\nwhile True:\n try:\n left, right = list(map(float, input().split()))\n except:\n break\n L[bisect(D, left)] += 1\n R[bisect(D, right)] += 1\nfor left, right in zip(L, R)[::-1]:\n print(left, right)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-L = [0, 0, 0, 0]","-R = [0, 0, 0, 0]","+L = [0] * 4","+R = [0] * 4"],"diff_only_import_comment":false,"measured_runtime_v0":0.4541368237,"measured_runtime_v1":0.349680768,"runtime_lift":1.2987183316,"key":["s470531137","s067459842"]} +{"user_id":"u057964173","problem_id":"p03796","language":"python","submission_id_v0":"s018166938","submission_id_v1":"s633160279","cpu_time_v0":298,"cpu_time_v1":42,"memory_v0":42992,"memory_v1":28396,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n import math\n\n n=int(eval(input()))\n\n print((math.factorial(n)%(10**9+7)))\n\nresolve()\n\n# optimized version of the same code:\n","target":"import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n answer=1\n\n n=int(eval(input()))\n\n for i in range(1,n+1):\n\n answer*=i\n\n answer%=10**9+7\n\n print(answer)\n\nresolve()","code_v0_loc":8,"code_v1_loc":11,"code_v0_num_chars":166,"code_v1_num_chars":214,"code_v0_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n import math\n\n n = int(eval(input()))\n print((math.factorial(n) % (10**9 + 7)))\n\n\nresolve()\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n answer = 1\n n = int(eval(input()))\n for i in range(1, n + 1):\n answer *= i\n answer %= 10**9 + 7\n print(answer)\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["- import math","-","+ answer = 1","- print((math.factorial(n) % (10**9 + 7)))","+ for i in range(1, n + 1):","+ answer *= i","+ answer %= 10**9 + 7","+ print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5731575236,"measured_runtime_v1":0.2333363581,"runtime_lift":2.4563575447,"key":["s018166938","s633160279"]} +{"user_id":"u503228842","problem_id":"p03363","language":"python","submission_id_v0":"s333415387","submission_id_v1":"s550734009","cpu_time_v0":299,"cpu_time_v1":187,"memory_v0":39380,"memory_v1":41492,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.46,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nA = np.array(input().split(), dtype = np.int64)\n\n\n\nc = Counter(A.cumsum())\n\nc[0] += 1\n\nanswer = sum(x*(x-1)\/\/2 for x in list(c.values()))\n\nprint(answer)\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\ncsum = [0]\n\ntemp = 0\n\nfor a in A:\n\n temp += a\n\n csum.append(temp)\n\n# csum.sort()\n\n# print(csum)\n\nfrom collections import Counter\n\nfreq = Counter(csum)\n\nans = 0\n\nfor v in list(freq.values()):\n\n ans += (v*(v-1))\/\/2\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":15,"code_v0_num_chars":220,"code_v1_num_chars":281,"code_v0_no_empty_lines":"from collections import Counter\nimport numpy as np\n\nN = int(eval(input()))\nA = np.array(input().split(), dtype=np.int64)\nc = Counter(A.cumsum())\nc[0] += 1\nanswer = sum(x * (x - 1) \/\/ 2 for x in list(c.values()))\nprint(answer)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\ncsum = [0]\ntemp = 0\nfor a in A:\n temp += a\n csum.append(temp)\n# csum.sort()\n# print(csum)\nfrom collections import Counter\n\nfreq = Counter(csum)\nans = 0\nfor v in list(freq.values()):\n ans += (v * (v - 1)) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["+N = int(eval(input()))","+A = list(map(int, input().split()))","+csum = [0]","+temp = 0","+for a in A:","+ temp += a","+ csum.append(temp)","+# csum.sort()","+# print(csum)","-import numpy as np","-N = int(eval(input()))","-A = np.array(input().split(), dtype=np.int64)","-c = Counter(A.cumsum())","-c[0] += 1","-answer = sum(x * (x - 1) \/\/ 2 for x in list(c.values()))","-print(answer)","+freq = Counter(csum)","+ans = 0","+for v in list(freq.values()):","+ ans += (v * (v - 1)) \/\/ 2","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3650826566,"measured_runtime_v1":0.2447019732,"runtime_lift":5.5785518961,"key":["s333415387","s550734009"]} +{"user_id":"u955547613","problem_id":"p03494","language":"python","submission_id_v0":"s456783513","submission_id_v1":"s818987623","cpu_time_v0":150,"cpu_time_v1":17,"memory_v0":12496,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\nimport numpy as np\n\n\n\n\n\nif __name__ == '__main__':\n\n n = int(eval(input()))\n\n A = np.array([int(a) for a in input().split()], dtype=np.int)\n\n\n\n isEven = True\n\n count = 0\n\n while isEven:\n\n if (A%2).any() != 0 :\n\n isEven = False\n\n break\n\n A = A\/2\n\n count+=1\n\n print(count)\n\n# optimized version of the same code:\n","target":"import math\n\nn = eval(input())\n\na = list(map(int, input().split()))\n\nans = float(\"inf\")\n\nfor i in a:\n\n ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1)\n\nprint((round(ans)))","code_v0_loc":17,"code_v1_loc":7,"code_v0_num_chars":350,"code_v1_num_chars":170,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport numpy as np\n\nif __name__ == \"__main__\":\n n = int(eval(input()))\n A = np.array([int(a) for a in input().split()], dtype=np.int)\n isEven = True\n count = 0\n while isEven:\n if (A % 2).any() != 0:\n isEven = False\n break\n A = A \/ 2\n count += 1\n print(count)\n","code_v1_no_empty_lines":"import math\n\nn = eval(input())\na = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in a:\n ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1)\nprint((round(ans)))\n","code_same":false,"relative_loc_diff_percent":58.8235294118,"diff":["-# -*- coding: utf-8 -*-","-import numpy as np","+import math","-if __name__ == \"__main__\":","- n = int(eval(input()))","- A = np.array([int(a) for a in input().split()], dtype=np.int)","- isEven = True","- count = 0","- while isEven:","- if (A % 2).any() != 0:","- isEven = False","- break","- A = A \/ 2","- count += 1","- print(count)","+n = eval(input())","+a = list(map(int, input().split()))","+ans = float(\"inf\")","+for i in a:","+ ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1)","+print((round(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.5910281873,"measured_runtime_v1":0.231145987,"runtime_lift":6.8832178643,"key":["s456783513","s818987623"]} +{"user_id":"u983918956","problem_id":"p03416","language":"python","submission_id_v0":"s018952102","submission_id_v1":"s778219351","cpu_time_v0":118,"cpu_time_v1":60,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.15,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA,B = list(map(int,input().split()))\n\nj = 0\n\nfor i in range(A,B+1):\n\n l = list(str(i))\n\n l_reverse = list(reversed(l))\n\n if l == l_reverse:\n\n j += 1\n\nprint(j)\n\n# optimized version of the same code:\n","target":"A, B = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor n in range(A, B+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n ans += 1\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":158,"code_v1_num_chars":135,"code_v0_no_empty_lines":"A, B = list(map(int, input().split()))\nj = 0\nfor i in range(A, B + 1):\n l = list(str(i))\n l_reverse = list(reversed(l))\n if l == l_reverse:\n j += 1\nprint(j)\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\nans = 0\nfor n in range(A, B + 1):\n n = str(n)\n if n == n[::-1]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-j = 0","-for i in range(A, B + 1):","- l = list(str(i))","- l_reverse = list(reversed(l))","- if l == l_reverse:","- j += 1","-print(j)","+ans = 0","+for n in range(A, B + 1):","+ n = str(n)","+ if n == n[::-1]:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4538340874,"measured_runtime_v1":0.3384370139,"runtime_lift":1.340970605,"key":["s018952102","s778219351"]} +{"user_id":"u811841526","problem_id":"p02390","language":"python","submission_id_v0":"s941329471","submission_id_v1":"s549187322","cpu_time_v0":40,"cpu_time_v1":20,"memory_v0":7664,"memory_v1":5592,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = int(eval(input()))\n\nm, s = s \/\/ 60, s % 60\n\nh, m = m \/\/ 60, m % 60\n\nprint((':'.join(map(str, [h,m,s]))))\n\n# optimized version of the same code:\n","target":"s = int(eval(input()))\n\n\n\nsecond = s % 60\n\ns = s \/\/ 60\n\nmin = s % 60\n\nhour = s \/\/ 60\n\n\n\nprint(f'{hour}:{min}:{second}')\n","code_v0_loc":4,"code_v1_loc":8,"code_v0_num_chars":100,"code_v1_num_chars":114,"code_v0_no_empty_lines":"s = int(eval(input()))\nm, s = s \/\/ 60, s % 60\nh, m = m \/\/ 60, m % 60\nprint((\":\".join(map(str, [h, m, s]))))\n","code_v1_no_empty_lines":"s = int(eval(input()))\nsecond = s % 60\ns = s \/\/ 60\nmin = s % 60\nhour = s \/\/ 60\nprint(f\"{hour}:{min}:{second}\")\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-m, s = s \/\/ 60, s % 60","-h, m = m \/\/ 60, m % 60","-print((\":\".join(map(str, [h, m, s]))))","+second = s % 60","+s = s \/\/ 60","+min = s % 60","+hour = s \/\/ 60","+print(f\"{hour}:{min}:{second}\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1672595444,"measured_runtime_v1":0.0066597962,"runtime_lift":25.1148140492,"key":["s941329471","s549187322"]} +{"user_id":"u488127128","problem_id":"p03796","language":"python","submission_id_v0":"s848409194","submission_id_v1":"s870468874","cpu_time_v0":231,"cpu_time_v1":35,"memory_v0":4020,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.85,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nN = int(eval(input()))\n\nprint((math.factorial(N)%(10**9+7)))\n\n# optimized version of the same code:\n","target":"import math\n\nN = int(eval(input()))\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)","code_v0_loc":3,"code_v1_loc":6,"code_v0_num_chars":65,"code_v1_num_chars":95,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nprint((math.factorial(N) % (10**9 + 7)))\n","code_v1_no_empty_lines":"import math\n\nN = int(eval(input()))\na = 1\nfor n in range(2, N + 1):\n a = a * n % (10**9 + 7)\nprint(a)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-print((math.factorial(N) % (10**9 + 7)))","+a = 1","+for n in range(2, N + 1):","+ a = a * n % (10**9 + 7)","+print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.8454835632,"measured_runtime_v1":0.3383059211,"runtime_lift":2.4991686828,"key":["s848409194","s870468874"]} +{"user_id":"u706786134","problem_id":"p03162","language":"python","submission_id_v0":"s594464036","submission_id_v1":"s976355345","cpu_time_v0":1103,"cpu_time_v1":647,"memory_v0":56196,"memory_v1":47192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn = int(eval(input()))\n\nX = np.array([input().split() for _ in range(n)], np.int64)\n\ndp = np.zeros((n + 1, 3), np.int64)\n\ndp[0, 0] = dp[0, 1] = dp[0, 2] = 0\n\nfor i in range(n):\n\n for j in range(3):\n\n dp[i + 1, j] = X[i, j] + max(dp[i, k] for k in range(3) if j != k)\n\nprint((max(dp[n])))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nx, y, z = 0, 0, 0\n\nfor _ in range(N):\n\n a, b, c = list(map(int, input().split()))\n\n x, y, z = max(y, z) + a, max(z, x) + b, max(x, y) + c\n\nprint((max(x, y, z)))","code_v0_loc":10,"code_v1_loc":6,"code_v0_num_chars":311,"code_v1_num_chars":176,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nX = np.array([input().split() for _ in range(n)], np.int64)\ndp = np.zeros((n + 1, 3), np.int64)\ndp[0, 0] = dp[0, 1] = dp[0, 2] = 0\nfor i in range(n):\n for j in range(3):\n dp[i + 1, j] = X[i, j] + max(dp[i, k] for k in range(3) if j != k)\nprint((max(dp[n])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nx, y, z = 0, 0, 0\nfor _ in range(N):\n a, b, c = list(map(int, input().split()))\n x, y, z = max(y, z) + a, max(z, x) + b, max(x, y) + c\nprint((max(x, y, z)))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-import numpy as np","-","-n = int(eval(input()))","-X = np.array([input().split() for _ in range(n)], np.int64)","-dp = np.zeros((n + 1, 3), np.int64)","-dp[0, 0] = dp[0, 1] = dp[0, 2] = 0","-for i in range(n):","- for j in range(3):","- dp[i + 1, j] = X[i, j] + max(dp[i, k] for k in range(3) if j != k)","-print((max(dp[n])))","+N = int(eval(input()))","+x, y, z = 0, 0, 0","+for _ in range(N):","+ a, b, c = list(map(int, input().split()))","+ x, y, z = max(y, z) + a, max(z, x) + b, max(x, y) + c","+print((max(x, y, z)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.9783216975,"measured_runtime_v1":0.3213120236,"runtime_lift":6.157011104,"key":["s594464036","s976355345"]} +{"user_id":"u659159398","problem_id":"p02690","language":"python","submission_id_v0":"s007764866","submission_id_v1":"s730023385","cpu_time_v0":60,"cpu_time_v1":40,"memory_v0":9352,"memory_v1":9000,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\n\n\nroot = int(x**(0.2))\n\n\n\nflag = 0\n\nfor i in range(root - 400, root + 400):\n\n for j in range(-100, root + 400):\n\n if i!=j:\n\n if x%(i-j) == 0:\n\n if i**5-j**5 == x:\n\n print((i, j))\n\n flag = 1\n\n break\n\n if flag:\n\n break\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\n\n\nfor a in range(-120, 120):\n\n for b in range(-120, 120):\n\n if a**5-b**5 == x:\n\n print((a, b))\n\n exit()","code_v0_loc":15,"code_v1_loc":7,"code_v0_num_chars":335,"code_v1_num_chars":133,"code_v0_no_empty_lines":"x = int(eval(input()))\nroot = int(x ** (0.2))\nflag = 0\nfor i in range(root - 400, root + 400):\n for j in range(-100, root + 400):\n if i != j:\n if x % (i - j) == 0:\n if i**5 - j**5 == x:\n print((i, j))\n flag = 1\n break\n if flag:\n break\n","code_v1_no_empty_lines":"x = int(eval(input()))\nfor a in range(-120, 120):\n for b in range(-120, 120):\n if a**5 - b**5 == x:\n print((a, b))\n exit()\n","code_same":false,"relative_loc_diff_percent":53.3333333333,"diff":["-root = int(x ** (0.2))","-flag = 0","-for i in range(root - 400, root + 400):","- for j in range(-100, root + 400):","- if i != j:","- if x % (i - j) == 0:","- if i**5 - j**5 == x:","- print((i, j))","- flag = 1","- break","- if flag:","- break","+for a in range(-120, 120):","+ for b in range(-120, 120):","+ if a**5 - b**5 == x:","+ print((a, b))","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2328919073,"measured_runtime_v1":0.1760219514,"runtime_lift":1.3230844527,"key":["s007764866","s730023385"]} +{"user_id":"u754022296","problem_id":"p03819","language":"python","submission_id_v0":"s951638556","submission_id_v1":"s089571448","cpu_time_v0":1762,"cpu_time_v1":852,"memory_v0":127784,"memory_v1":82324,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.65,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = map(int, input().split())\n\n LR = [list(map(int, input().split())) for _ in range(n)]\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n \n\n S = sorted([(r-l+1, l, r) for l, r in LR], reverse=True)\n\n cnt = n\n\n L = []\n\n for i in range(1, m+1):\n\n while S and S[-1][0] == i:\n\n c, l, r = S.pop()\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n L.append(res)\n\n print(*L, sep=\"\\n\")\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = list(map(int, input().split()))\n\n S = [[] for _ in range(m+1)]\n\n for _ in range(n):\n\n l, r = list(map(int, input().split()))\n\n S[r-l+1].append((l, r))\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n cnt = n\n\n for i in range(1, m+1):\n\n for l, r in S[i]:\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n print(res)\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":36,"code_v1_loc":34,"code_v0_num_chars":731,"code_v1_num_chars":658,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, m = map(int, input().split())\n LR = [list(map(int, input().split())) for _ in range(n)]\n BIT = [0] * (m + 2)\n\n def add(i, a):\n while i <= m + 1:\n BIT[i] += a\n i += i & (-i)\n\n def bit_sum(i):\n res = 0\n while i > 0:\n res += BIT[i]\n i -= i & (-i)\n return res\n\n S = sorted([(r - l + 1, l, r) for l, r in LR], reverse=True)\n cnt = n\n L = []\n for i in range(1, m + 1):\n while S and S[-1][0] == i:\n c, l, r = S.pop()\n cnt -= 1\n add(l, 1)\n add(r + 1, -1)\n res = cnt\n for j in range(0, m + 1, i):\n res += bit_sum(j)\n L.append(res)\n print(*L, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, m = list(map(int, input().split()))\n S = [[] for _ in range(m + 1)]\n for _ in range(n):\n l, r = list(map(int, input().split()))\n S[r - l + 1].append((l, r))\n BIT = [0] * (m + 2)\n\n def add(i, a):\n while i <= m + 1:\n BIT[i] += a\n i += i & (-i)\n\n def bit_sum(i):\n res = 0\n while i > 0:\n res += BIT[i]\n i -= i & (-i)\n return res\n\n cnt = n\n for i in range(1, m + 1):\n for l, r in S[i]:\n cnt -= 1\n add(l, 1)\n add(r + 1, -1)\n res = cnt\n for j in range(0, m + 1, i):\n res += bit_sum(j)\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["- n, m = map(int, input().split())","- LR = [list(map(int, input().split())) for _ in range(n)]","+ n, m = list(map(int, input().split()))","+ S = [[] for _ in range(m + 1)]","+ for _ in range(n):","+ l, r = list(map(int, input().split()))","+ S[r - l + 1].append((l, r))","- S = sorted([(r - l + 1, l, r) for l, r in LR], reverse=True)","- L = []","- while S and S[-1][0] == i:","- c, l, r = S.pop()","+ for l, r in S[i]:","- L.append(res)","- print(*L, sep=\"\\n\")","+ print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3067650649,"measured_runtime_v1":0.0989195189,"runtime_lift":3.1011580763,"key":["s951638556","s089571448"]} +{"user_id":"u254871849","problem_id":"p03078","language":"python","submission_id_v0":"s785699428","submission_id_v1":"s355827371","cpu_time_v0":419,"cpu_time_v1":84,"memory_v0":67256,"memory_v1":9548,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nx, y, z, k = map(int, sys.stdin.readline().split())\n\na, b, c = (np.array(sys.stdin.readline().split(), dtype=np.int64) for _ in range(3))\n\n\n\ndef main():\n\n res = np.sort(np.ravel(a[:, None] + b))[::-1]\n\n res = np.sort(np.ravel(c[:, None] + res[:min(k, x*y)]))[::-1]\n\n return res[:k]\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(*ans, sep='\\n')\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nx, y, z, K = map(int, sys.stdin.readline().split())\n\na, b, c = (sorted(map(int, sys.stdin.readline().split()), reverse=True) for _ in range(3))\n\ndef main():\n\n res = []\n\n for i in range(1, min(K, x) + 1):\n\n for j in range(1, min(K \/\/ i, y) + 1):\n\n for k in range(1, min(K \/\/ (i * j), z) + 1):\n\n res.append(a[i-1] + b[j-1] + c[k-1])\n\n\n\n return sorted(res, reverse=True)[:K]\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(*ans, sep='\\n')\n","code_v0_loc":14,"code_v1_loc":16,"code_v0_num_chars":399,"code_v1_num_chars":502,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nx, y, z, k = map(int, sys.stdin.readline().split())\na, b, c = (np.array(sys.stdin.readline().split(), dtype=np.int64) for _ in range(3))\n\n\ndef main():\n res = np.sort(np.ravel(a[:, None] + b))[::-1]\n res = np.sort(np.ravel(c[:, None] + res[: min(k, x * y)]))[::-1]\n return res[:k]\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(*ans, sep=\"\\n\")\n","code_v1_no_empty_lines":"import sys\n\nx, y, z, K = map(int, sys.stdin.readline().split())\na, b, c = (\n sorted(map(int, sys.stdin.readline().split()), reverse=True) for _ in range(3)\n)\n\n\ndef main():\n res = []\n for i in range(1, min(K, x) + 1):\n for j in range(1, min(K \/\/ i, y) + 1):\n for k in range(1, min(K \/\/ (i * j), z) + 1):\n res.append(a[i - 1] + b[j - 1] + c[k - 1])\n return sorted(res, reverse=True)[:K]\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import numpy as np","-x, y, z, k = map(int, sys.stdin.readline().split())","-a, b, c = (np.array(sys.stdin.readline().split(), dtype=np.int64) for _ in range(3))","+x, y, z, K = map(int, sys.stdin.readline().split())","+a, b, c = (","+ sorted(map(int, sys.stdin.readline().split()), reverse=True) for _ in range(3)","+)","- res = np.sort(np.ravel(a[:, None] + b))[::-1]","- res = np.sort(np.ravel(c[:, None] + res[: min(k, x * y)]))[::-1]","- return res[:k]","+ res = []","+ for i in range(1, min(K, x) + 1):","+ for j in range(1, min(K \/\/ i, y) + 1):","+ for k in range(1, min(K \/\/ (i * j), z) + 1):","+ res.append(a[i - 1] + b[j - 1] + c[k - 1])","+ return sorted(res, reverse=True)[:K]"],"diff_only_import_comment":false,"measured_runtime_v0":1.2671924386,"measured_runtime_v1":0.2012458158,"runtime_lift":6.2967393076,"key":["s785699428","s355827371"]} +{"user_id":"u550574002","problem_id":"p03126","language":"python","submission_id_v0":"s757696098","submission_id_v1":"s038854174","cpu_time_v0":23,"cpu_time_v1":19,"memory_v0":3572,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.39,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport functools\n\nprint((len(functools.reduce(lambda x, y: x&y,[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))\n\n# optimized version of the same code:\n","target":"print((len(set.intersection(*[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))","code_v0_loc":2,"code_v1_loc":1,"code_v0_num_chars":128,"code_v1_num_chars":94,"code_v0_no_empty_lines":"import functools\n\nprint(\n (\n len(\n functools.reduce(\n lambda x, y: x & y,\n [set(input().split()[1:]) for _ in [0] * int(input().split()[0])],\n )\n )\n )\n)\n","code_v1_no_empty_lines":"print(\n (\n len(\n set.intersection(\n *[set(input().split()[1:]) for _ in [0] * int(input().split()[0])]\n )\n )\n )\n)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import functools","-","- functools.reduce(","- lambda x, y: x & y,","- [set(input().split()[1:]) for _ in [0] * int(input().split()[0])],","+ set.intersection(","+ *[set(input().split()[1:]) for _ in [0] * int(input().split()[0])]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2541026509,"measured_runtime_v1":0.0938221338,"runtime_lift":2.7083444025,"key":["s757696098","s038854174"]} +{"user_id":"u046187684","problem_id":"p03480","language":"python","submission_id_v0":"s964601714","submission_id_v1":"s413566853","cpu_time_v0":40,"cpu_time_v1":33,"memory_v0":6244,"memory_v1":6388,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env python3\n\n# coding=utf-8\n\n\n\nimport sys\n\n\n\ns = sys.stdin.readline().strip()\n\nl = [_s is \"1\" for _s in list(s)]\n\nl_r = l[::-1]\n\nindex = 0\n\nfor i, (c, n, c_r, n_r) in enumerate(\n\n zip(l[:len(s) \/\/ 2], l[1:len(s) \/\/ 2 + 1], l_r[:len(s) \/\/ 2], l_r[1:len(s) \/\/ 2 + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\nprint((len(s) - index))\n\n# optimized version of the same code:\n","target":"def solve(string):\n\n l = [s == \"1\" for s in string]\n\n l_r = l[::-1]\n\n index = 0\n\n h = len(string) \/\/ 2\n\n for i, (c, n, c_r, n_r) in enumerate(zip(l[:h], l[1:h + 1], l_r[:h], l_r[1:h + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\n return str(len(string) - index)\n\n\n\n\n\nif __name__ == '__main__':\n\n print((solve(eval(input()))))\n","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":359,"code_v1_num_chars":360,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\n# coding=utf-8\nimport sys\n\ns = sys.stdin.readline().strip()\nl = [_s is \"1\" for _s in list(s)]\nl_r = l[::-1]\nindex = 0\nfor i, (c, n, c_r, n_r) in enumerate(\n zip(\n l[: len(s) \/\/ 2],\n l[1 : len(s) \/\/ 2 + 1],\n l_r[: len(s) \/\/ 2],\n l_r[1 : len(s) \/\/ 2 + 1],\n )\n):\n if c ^ n or c_r ^ n_r:\n index = i + 1\nprint((len(s) - index))\n","code_v1_no_empty_lines":"def solve(string):\n l = [s == \"1\" for s in string]\n l_r = l[::-1]\n index = 0\n h = len(string) \/\/ 2\n for i, (c, n, c_r, n_r) in enumerate(\n zip(l[:h], l[1 : h + 1], l_r[:h], l_r[1 : h + 1])\n ):\n if c ^ n or c_r ^ n_r:\n index = i + 1\n return str(len(string) - index)\n\n\nif __name__ == \"__main__\":\n print((solve(eval(input()))))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-#!\/usr\/bin\/env python3","-# coding=utf-8","-import sys","+def solve(string):","+ l = [s == \"1\" for s in string]","+ l_r = l[::-1]","+ index = 0","+ h = len(string) \/\/ 2","+ for i, (c, n, c_r, n_r) in enumerate(","+ zip(l[:h], l[1 : h + 1], l_r[:h], l_r[1 : h + 1])","+ ):","+ if c ^ n or c_r ^ n_r:","+ index = i + 1","+ return str(len(string) - index)","-s = sys.stdin.readline().strip()","-l = [_s is \"1\" for _s in list(s)]","-l_r = l[::-1]","-index = 0","-for i, (c, n, c_r, n_r) in enumerate(","- zip(","- l[: len(s) \/\/ 2],","- l[1 : len(s) \/\/ 2 + 1],","- l_r[: len(s) \/\/ 2],","- l_r[1 : len(s) \/\/ 2 + 1],","- )","-):","- if c ^ n or c_r ^ n_r:","- index = i + 1","-print((len(s) - index))","+","+if __name__ == \"__main__\":","+ print((solve(eval(input()))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3417459049,"measured_runtime_v1":0.2085829885,"runtime_lift":1.6384169551,"key":["s964601714","s413566853"]} +{"user_id":"u561083515","problem_id":"p03371","language":"python","submission_id_v0":"s270393964","submission_id_v1":"s470107269","cpu_time_v0":111,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.68,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# https:\/\/atcoder.jp\/contests\/abc095\/tasks\/arc096_a\n\n\"\"\"\n\n\u5225\u89e3(\u5b9a\u6570\u6642\u9593)\n\nhttps:\/\/atcoder.jp\/contests\/abc095\/submissions\/10226556\n\n\"\"\"\n\n\n\nA,B,C,X,Y = list(map(int,input().split()))\n\n\n\nans = float(\"inf\")\n\n\n\n# AB\u30d4\u30b6\u30922\u679a1\u7d44\u3067\u8003\u3048\u308b -> AB\u30bb\u30c3\u30c8\n\n# i: AB\u30bb\u30c3\u30c8\u306e\u500b\u6570\n\nfor i in range(10**5 + 1):\n\n ans = min(ans, i*(2*C) + max(0, X-i)*A + max(0, Y-i)*B)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"A,B,C,X,Y = list(map(int,input().split()))\n\n\n\nAB_set = C * 2\n\n\n\nans = min(A*X + B*Y, AB_set*max(X,Y), AB_set*min(X,Y) + A*abs(X-min(X,Y)) + B*abs(Y-min(X,Y)))\n\n\n\nprint(ans)","code_v0_loc":16,"code_v1_loc":7,"code_v0_num_chars":336,"code_v1_num_chars":166,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc095\/tasks\/arc096_a\n\"\"\"\n\u5225\u89e3(\u5b9a\u6570\u6642\u9593)\nhttps:\/\/atcoder.jp\/contests\/abc095\/submissions\/10226556\n\"\"\"\nA, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\n# AB\u30d4\u30b6\u30922\u679a1\u7d44\u3067\u8003\u3048\u308b -> AB\u30bb\u30c3\u30c8\n# i: AB\u30bb\u30c3\u30c8\u306e\u500b\u6570\nfor i in range(10**5 + 1):\n ans = min(ans, i * (2 * C) + max(0, X - i) * A + max(0, Y - i) * B)\nprint(ans)\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nAB_set = C * 2\nans = min(\n A * X + B * Y,\n AB_set * max(X, Y),\n AB_set * min(X, Y) + A * abs(X - min(X, Y)) + B * abs(Y - min(X, Y)),\n)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":56.25,"diff":["-# https:\/\/atcoder.jp\/contests\/abc095\/tasks\/arc096_a","-\"\"\"","-\u5225\u89e3(\u5b9a\u6570\u6642\u9593)","-https:\/\/atcoder.jp\/contests\/abc095\/submissions\/10226556","-\"\"\"","-ans = float(\"inf\")","-# AB\u30d4\u30b6\u30922\u679a1\u7d44\u3067\u8003\u3048\u308b -> AB\u30bb\u30c3\u30c8","-# i: AB\u30bb\u30c3\u30c8\u306e\u500b\u6570","-for i in range(10**5 + 1):","- ans = min(ans, i * (2 * C) + max(0, X - i) * A + max(0, Y - i) * B)","+AB_set = C * 2","+ans = min(","+ A * X + B * Y,","+ AB_set * max(X, Y),","+ AB_set * min(X, Y) + A * abs(X - min(X, Y)) + B * abs(Y - min(X, Y)),","+)"],"diff_only_import_comment":false,"measured_runtime_v0":0.801804817,"measured_runtime_v1":0.1832828865,"runtime_lift":4.3746845775,"key":["s270393964","s470107269"]} +{"user_id":"u130900604","problem_id":"p02748","language":"python","submission_id_v0":"s052578373","submission_id_v1":"s213675683","cpu_time_v0":863,"cpu_time_v1":430,"memory_v0":24304,"memory_v1":18608,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef mi():return list(map(int,input().split()))\n\nimport numpy as np\n\nA,B,M=mi()\n\na=np.array(list(mi()))\n\nb=np.array(list(mi()))\n\nminab=min(a)+min(b)\n\n\n\nans=float(\"inf\")\n\n\n\nfor i in range(M):\n\n x,y,c=mi()\n\n tmp=a[x-1]+b[y-1]-c\n\n ans=min(ans,tmp)\n\nprint((min(ans,minab)))\n\n\n# optimized version of the same code:\n","target":"def mi():return list(map(int,input().split()))\n\nA,B,M=mi()\n\na=list(mi())\n\nb=list(mi())\n\nans=min(a)+min(b)\n\nfor _ in range(M):\n\n x,y,c=mi()\n\n ans=min(ans,a[x-1]+b[y-1]-c)\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":9,"code_v0_num_chars":270,"code_v1_num_chars":181,"code_v0_no_empty_lines":"def mi():\n return list(map(int, input().split()))\n\n\nimport numpy as np\n\nA, B, M = mi()\na = np.array(list(mi()))\nb = np.array(list(mi()))\nminab = min(a) + min(b)\nans = float(\"inf\")\nfor i in range(M):\n x, y, c = mi()\n tmp = a[x - 1] + b[y - 1] - c\n ans = min(ans, tmp)\nprint((min(ans, minab)))\n","code_v1_no_empty_lines":"def mi():\n return list(map(int, input().split()))\n\n\nA, B, M = mi()\na = list(mi())\nb = list(mi())\nans = min(a) + min(b)\nfor _ in range(M):\n x, y, c = mi()\n ans = min(ans, a[x - 1] + b[y - 1] - c)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-import numpy as np","-","-a = np.array(list(mi()))","-b = np.array(list(mi()))","-minab = min(a) + min(b)","-ans = float(\"inf\")","-for i in range(M):","+a = list(mi())","+b = list(mi())","+ans = min(a) + min(b)","+for _ in range(M):","- tmp = a[x - 1] + b[y - 1] - c","- ans = min(ans, tmp)","-print((min(ans, minab)))","+ ans = min(ans, a[x - 1] + b[y - 1] - c)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3690658715,"measured_runtime_v1":0.1998904405,"runtime_lift":6.8490812679,"key":["s052578373","s213675683"]} +{"user_id":"u191680842","problem_id":"p02994","language":"python","submission_id_v0":"s527614113","submission_id_v1":"s764252397","cpu_time_v0":149,"cpu_time_v1":18,"memory_v0":12440,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.92,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn,l = list(map(int,input().split()))\n\ntaste = np.array([l+i-1 for i in range(1,n+1)])\n\ntaste[np.fabs(taste).argmin()]=0\n\nprint((taste.sum()))\n\n# optimized version of the same code:\n","target":"n,l = list(map(int,input().split()))\n\ntaste = [l+i for i in range(0,n)]\n\ntaste.sort(key=lambda x:abs(x))\n\nprint((sum(taste[1:])))","code_v0_loc":5,"code_v1_loc":4,"code_v0_num_chars":153,"code_v1_num_chars":121,"code_v0_no_empty_lines":"import numpy as np\n\nn, l = list(map(int, input().split()))\ntaste = np.array([l + i - 1 for i in range(1, n + 1)])\ntaste[np.fabs(taste).argmin()] = 0\nprint((taste.sum()))\n","code_v1_no_empty_lines":"n, l = list(map(int, input().split()))\ntaste = [l + i for i in range(0, n)]\ntaste.sort(key=lambda x: abs(x))\nprint((sum(taste[1:])))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import numpy as np","-","-taste = np.array([l + i - 1 for i in range(1, n + 1)])","-taste[np.fabs(taste).argmin()] = 0","-print((taste.sum()))","+taste = [l + i for i in range(0, n)]","+taste.sort(key=lambda x: abs(x))","+print((sum(taste[1:])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.7210805004,"measured_runtime_v1":0.271107127,"runtime_lift":6.3483410401,"key":["s527614113","s764252397"]} +{"user_id":"u801359367","problem_id":"p03325","language":"python","submission_id_v0":"s586527827","submission_id_v1":"s564078636","cpu_time_v0":89,"cpu_time_v1":80,"memory_v0":4148,"memory_v1":4148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nSUM = 0\n\nfor i in A:\n\n count = 0\n\n while i%2 == 0:\n\n i\/\/=2\n\n count += 1\n\n SUM+=count\n\nprint(SUM)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nSUM = 0\n\nfor i in A:\n\n while i%2 == 0:\n\n i\/\/=2\n\n SUM += 1\n\nprint(SUM)","code_v0_loc":11,"code_v1_loc":8,"code_v0_num_chars":175,"code_v1_num_chars":140,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nSUM = 0\nfor i in A:\n count = 0\n while i % 2 == 0:\n i \/\/= 2\n count += 1\n SUM += count\nprint(SUM)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nSUM = 0\nfor i in A:\n while i % 2 == 0:\n i \/\/= 2\n SUM += 1\nprint(SUM)\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["- count = 0","- count += 1","- SUM += count","+ SUM += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3107097435,"measured_runtime_v1":0.2124449382,"runtime_lift":1.4625424646,"key":["s586527827","s564078636"]} +{"user_id":"u253681061","problem_id":"p03796","language":"python","submission_id_v0":"s618901729","submission_id_v1":"s057938516","cpu_time_v0":49,"cpu_time_v1":34,"memory_v0":6900,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\n\n\nINF = 10**9 + 7\n\n\n\nans = [0] * (10**5 + 1)\n\nans[0] = 1\n\n\n\nfor i in range(1,10**5 + 1):\n\n ans[i] = ans[i-1] * i % INF\n\n\n\nprint((ans[n]))\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nmod = 10**9 + 7\n\n\n\nans = 1\n\n\n\nfor i in range(1,n+1):\n\n ans = ans * i % mod\n\n\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":157,"code_v1_num_chars":109,"code_v0_no_empty_lines":"n = int(eval(input()))\nINF = 10**9 + 7\nans = [0] * (10**5 + 1)\nans[0] = 1\nfor i in range(1, 10**5 + 1):\n ans[i] = ans[i - 1] * i % INF\nprint((ans[n]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nmod = 10**9 + 7\nans = 1\nfor i in range(1, n + 1):\n ans = ans * i % mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-INF = 10**9 + 7","-ans = [0] * (10**5 + 1)","-ans[0] = 1","-for i in range(1, 10**5 + 1):","- ans[i] = ans[i - 1] * i % INF","-print((ans[n]))","+mod = 10**9 + 7","+ans = 1","+for i in range(1, n + 1):","+ ans = ans * i % mod","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.8708683834,"measured_runtime_v1":0.4576160941,"runtime_lift":1.9030545354,"key":["s618901729","s057938516"]} +{"user_id":"u102461423","problem_id":"p03038","language":"python","submission_id_v0":"s819255712","submission_id_v1":"s993166511","cpu_time_v0":1171,"cpu_time_v1":206,"memory_v0":32776,"memory_v1":31536,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.41,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN,M = list(map(int,input().split()))\n\n\n\nA = np.array([int(x) for x in input().split()],dtype=np.int64)\n\nA.sort()\n\n\n\nBC = np.array([[int(x) for x in input().split()] for _ in range(M)])\n\nB = BC[:,0]\n\nC = BC[:,1]\n\n\n\nidx = C.argsort()\n\nB = B[idx][::-1]\n\nC = C[idx][::-1]\n\n\n\np = 0\n\nfor b,c in zip(B,C):\n\n A[p:p+b] = np.maximum(A[p:p+b],c)\n\n p += b\n\n\n\nanswer = A.sum()\n\nprint(answer)\n\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom operator import itemgetter\n\n\n\nN,M = list(map(int,readline().split()))\n\nA = list(map(int,readline().split()))\n\nm = list(map(int,read().split()))\n\nBC = list(zip(m,m))\n\n\n\nBC.sort(key = itemgetter(1),reverse=True)\n\n\n\nBC.append((N,-1))\n\n\n\nchange = []\n\nfor b,c in BC:\n\n change += [c] * b\n\n if len(change) > N:\n\n break\n\n\n\nA += change\n\nA.sort()\n\nanswer = sum(A[-N:])\n\nprint(answer)","code_v0_loc":22,"code_v1_loc":26,"code_v0_num_chars":397,"code_v1_num_chars":501,"code_v0_no_empty_lines":"import numpy as np\n\nN, M = list(map(int, input().split()))\nA = np.array([int(x) for x in input().split()], dtype=np.int64)\nA.sort()\nBC = np.array([[int(x) for x in input().split()] for _ in range(M)])\nB = BC[:, 0]\nC = BC[:, 1]\nidx = C.argsort()\nB = B[idx][::-1]\nC = C[idx][::-1]\np = 0\nfor b, c in zip(B, C):\n A[p : p + b] = np.maximum(A[p : p + b], c)\n p += b\nanswer = A.sum()\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom operator import itemgetter\n\nN, M = list(map(int, readline().split()))\nA = list(map(int, readline().split()))\nm = list(map(int, read().split()))\nBC = list(zip(m, m))\nBC.sort(key=itemgetter(1), reverse=True)\nBC.append((N, -1))\nchange = []\nfor b, c in BC:\n change += [c] * b\n if len(change) > N:\n break\nA += change\nA.sort()\nanswer = sum(A[-N:])\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-import numpy as np","+import sys","-N, M = list(map(int, input().split()))","-A = np.array([int(x) for x in input().split()], dtype=np.int64)","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+from operator import itemgetter","+","+N, M = list(map(int, readline().split()))","+A = list(map(int, readline().split()))","+m = list(map(int, read().split()))","+BC = list(zip(m, m))","+BC.sort(key=itemgetter(1), reverse=True)","+BC.append((N, -1))","+change = []","+for b, c in BC:","+ change += [c] * b","+ if len(change) > N:","+ break","+A += change","-BC = np.array([[int(x) for x in input().split()] for _ in range(M)])","-B = BC[:, 0]","-C = BC[:, 1]","-idx = C.argsort()","-B = B[idx][::-1]","-C = C[idx][::-1]","-p = 0","-for b, c in zip(B, C):","- A[p : p + b] = np.maximum(A[p : p + b], c)","- p += b","-answer = A.sum()","+answer = sum(A[-N:])"],"diff_only_import_comment":false,"measured_runtime_v0":2.1412646892,"measured_runtime_v1":0.3274382627,"runtime_lift":6.5394455476,"key":["s819255712","s993166511"]} +{"user_id":"u813450984","problem_id":"p03371","language":"python","submission_id_v0":"s722861535","submission_id_v1":"s015018251","cpu_time_v0":77,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":77.92,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nm = max(x, y)\n\nfor i in range(1, m+1):\n\n x -= 1\n\n y -= 1\n\n if x < 0:\n\n x = 0\n\n if y < 0:\n\n y = 0\n\n temp = c*(i*2) + x*a + y*b\n\n if temp < ans:\n\n ans = temp\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"a, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nans = min(c * max(x, y) * 2, ans)\n\nif x < y:\n\n ans = min(c * x * 2 + (y - x) * b, ans)\n\nelse:\n\n ans = min(c * y * 2 + (x - y) * a, ans)\n\n\n\nprint(ans)","code_v0_loc":15,"code_v1_loc":9,"code_v0_num_chars":249,"code_v1_num_chars":219,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nm = max(x, y)\nfor i in range(1, m + 1):\n x -= 1\n y -= 1\n if x < 0:\n x = 0\n if y < 0:\n y = 0\n temp = c * (i * 2) + x * a + y * b\n if temp < ans:\n ans = temp\nprint(ans)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nans = min(c * max(x, y) * 2, ans)\nif x < y:\n ans = min(c * x * 2 + (y - x) * b, ans)\nelse:\n ans = min(c * y * 2 + (x - y) * a, ans)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-m = max(x, y)","-for i in range(1, m + 1):","- x -= 1","- y -= 1","- if x < 0:","- x = 0","- if y < 0:","- y = 0","- temp = c * (i * 2) + x * a + y * b","- if temp < ans:","- ans = temp","+ans = min(c * max(x, y) * 2, ans)","+if x < y:","+ ans = min(c * x * 2 + (y - x) * b, ans)","+else:","+ ans = min(c * y * 2 + (x - y) * a, ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2966257923,"measured_runtime_v1":0.2002350025,"runtime_lift":1.4813883113,"key":["s722861535","s015018251"]} +{"user_id":"u989345508","problem_id":"p03798","language":"python","submission_id_v0":"s244589711","submission_id_v1":"s160001244","cpu_time_v0":1408,"cpu_time_v1":1267,"memory_v0":3892,"memory_v1":3880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.01,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\ns=eval(input())\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\n\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n #print(x[i])\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\ns=eval(input())\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\na=[\"S\",\"W\"]\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n x[i]+=a[x[i][j]!=\"S\"]\n\n else:\n\n x[i]+=a[x[i][j]==\"S\"]\n\n else:\n\n if s[j+1]==\"o\":\n\n x[i]+=a[x[i][j]==\"S\"]\n\n else:\n\n x[i]+=a[x[i][j]!=\"S\"]\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n","code_v0_loc":82,"code_v1_loc":69,"code_v0_num_chars":2079,"code_v1_num_chars":1752,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\nx = [\"SS\", \"SW\", \"WS\", \"WW\"]\n\n\ndef check0(i):\n if x[i][0] == \"S\":\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n\n\ndef check1(i):\n if x[i][n - 1] == \"S\":\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n\n\nfor i in range(4):\n for j in range(n - 2):\n if x[i][j + 1] == \"S\":\n if s[j + 1] == \"o\":\n if x[i][j] == \"S\":\n x[i] += \"S\"\n else:\n x[i] += \"W\"\n else:\n if x[i][j] == \"S\":\n x[i] += \"W\"\n else:\n x[i] += \"S\"\n else:\n if s[j + 1] == \"o\":\n if x[i][j] == \"S\":\n x[i] += \"W\"\n else:\n x[i] += \"S\"\n else:\n if x[i][j] == \"S\":\n x[i] += \"S\"\n else:\n x[i] += \"W\"\n # print(x[i])\n if check0(i) and check1(i):\n print((x[i]))\n break\nelse:\n print((-1))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\nx = [\"SS\", \"SW\", \"WS\", \"WW\"]\n\n\ndef check0(i):\n if x[i][0] == \"S\":\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n\n\ndef check1(i):\n if x[i][n - 1] == \"S\":\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n\n\na = [\"S\", \"W\"]\nfor i in range(4):\n for j in range(n - 2):\n if x[i][j + 1] == \"S\":\n if s[j + 1] == \"o\":\n x[i] += a[x[i][j] != \"S\"]\n else:\n x[i] += a[x[i][j] == \"S\"]\n else:\n if s[j + 1] == \"o\":\n x[i] += a[x[i][j] == \"S\"]\n else:\n x[i] += a[x[i][j] != \"S\"]\n if check0(i) and check1(i):\n print((x[i]))\n break\nelse:\n print((-1))\n","code_same":false,"relative_loc_diff_percent":15.8536585366,"diff":["+a = [\"S\", \"W\"]","- if x[i][j] == \"S\":","- x[i] += \"S\"","- else:","- x[i] += \"W\"","+ x[i] += a[x[i][j] != \"S\"]","- if x[i][j] == \"S\":","- x[i] += \"W\"","- else:","- x[i] += \"S\"","+ x[i] += a[x[i][j] == \"S\"]","- if x[i][j] == \"S\":","- x[i] += \"W\"","- else:","- x[i] += \"S\"","+ x[i] += a[x[i][j] == \"S\"]","- if x[i][j] == \"S\":","- x[i] += \"S\"","- else:","- x[i] += \"W\"","- # print(x[i])","+ x[i] += a[x[i][j] != \"S\"]"],"diff_only_import_comment":false,"measured_runtime_v0":0.206637172,"measured_runtime_v1":0.0056119666,"runtime_lift":36.8208127342,"key":["s244589711","s160001244"]} +{"user_id":"u260216890","problem_id":"p02881","language":"python","submission_id_v0":"s285612655","submission_id_v1":"s586502539","cpu_time_v0":1324,"cpu_time_v1":196,"memory_v0":21280,"memory_v1":40044,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.2,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN=int(eval(input()))\n\nroot=int(np.sqrt(N)\/\/1)\n\na=N\n\nb=N\n\nfor i in range(root, 0, -1):\n\n if N%i==0:\n\n a=i\n\n b=N\/\/i\n\n break\n\nprint((a-1+b-1))\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\nroot=int((N**0.5)\/\/1)\n\na=N\n\nb=N\n\nfor i in range(root, 0, -1):\n\n if N%i==0:\n\n a=i\n\n b=N\/\/i\n\n break\n\nprint((a-1+b-1))\n","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":175,"code_v1_num_chars":154,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nroot = int(np.sqrt(N) \/\/ 1)\na = N\nb = N\nfor i in range(root, 0, -1):\n if N % i == 0:\n a = i\n b = N \/\/ i\n break\nprint((a - 1 + b - 1))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nroot = int((N**0.5) \/\/ 1)\na = N\nb = N\nfor i in range(root, 0, -1):\n if N % i == 0:\n a = i\n b = N \/\/ i\n break\nprint((a - 1 + b - 1))\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-import numpy as np","-","-root = int(np.sqrt(N) \/\/ 1)","+root = int((N**0.5) \/\/ 1)"],"diff_only_import_comment":false,"measured_runtime_v0":2.2620700173,"measured_runtime_v1":0.2775772495,"runtime_lift":8.149335081,"key":["s285612655","s586502539"]} +{"user_id":"u593934357","problem_id":"p02952","language":"python","submission_id_v0":"s443742997","submission_id_v1":"s952596957","cpu_time_v0":201,"cpu_time_v1":89,"memory_v0":51968,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.72,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn_str = eval(input())\n\nn_int = int(n_str)\n\n# 1 ~ 50000\n\n# \u6841\u6570\u304c\u5947\u6570= 1\u6841, 3\u6841, 5\u6841\n\n# 1 ~ 9, 100 ~ 999,10000 ~ 99999\u306e90909\u500b\u3057\u304b\u306a\u3044\u306e\u3067\u5168\u63a2\u7d22\u3044\u3051\u308b\u304b?\n\nexs_list = []\n\nfor i in range(1, 100000):\n\n if len(str(i)) % 2 == 1:\n\n exs_list.append(i)\n\n\n\nexs = {i: i for i in exs_list}\n\n\n\nn_s = []\n\nans = 0\n\nfor i in range(1, n_int + 1):\n\n if len(str(i)) % 2 == 0:\n\n continue\n\n if i in exs:\n\n ans += 1\n\n\n\nprint(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n# optimized version of the same code:\n","target":"def digit_sum(n):\n\n # \u5404\u6841\u306e\u548c\u3092\u6c42\u3081\u308b\n\n # \u8a08\u7b97\u91cf: O(logN)\n\n ans = 0\n\n while n > 0:\n\n ans += 1\n\n n \/\/= 10\n\n return ans\n\n\n\nn = int(eval(input()))\n\ncnt = 0\n\n\n\nfor i in range(1, n+1):\n\n cnt += digit_sum(i) % 2\n\n\n\nprint(cnt)\n","code_v0_loc":26,"code_v1_loc":16,"code_v0_num_chars":420,"code_v1_num_chars":236,"code_v0_no_empty_lines":"n_str = eval(input())\nn_int = int(n_str)\n# 1 ~ 50000\n# \u6841\u6570\u304c\u5947\u6570= 1\u6841, 3\u6841, 5\u6841\n# 1 ~ 9, 100 ~ 999,10000 ~ 99999\u306e90909\u500b\u3057\u304b\u306a\u3044\u306e\u3067\u5168\u63a2\u7d22\u3044\u3051\u308b\u304b?\nexs_list = []\nfor i in range(1, 100000):\n if len(str(i)) % 2 == 1:\n exs_list.append(i)\nexs = {i: i for i in exs_list}\nn_s = []\nans = 0\nfor i in range(1, n_int + 1):\n if len(str(i)) % 2 == 0:\n continue\n if i in exs:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"def digit_sum(n):\n # \u5404\u6841\u306e\u548c\u3092\u6c42\u3081\u308b\n # \u8a08\u7b97\u91cf: O(logN)\n ans = 0\n while n > 0:\n ans += 1\n n \/\/= 10\n return ans\n\n\nn = int(eval(input()))\ncnt = 0\nfor i in range(1, n + 1):\n cnt += digit_sum(i) % 2\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":38.4615384615,"diff":["-n_str = eval(input())","-n_int = int(n_str)","-# 1 ~ 50000","-# \u6841\u6570\u304c\u5947\u6570= 1\u6841, 3\u6841, 5\u6841","-# 1 ~ 9, 100 ~ 999,10000 ~ 99999\u306e90909\u500b\u3057\u304b\u306a\u3044\u306e\u3067\u5168\u63a2\u7d22\u3044\u3051\u308b\u304b?","-exs_list = []","-for i in range(1, 100000):","- if len(str(i)) % 2 == 1:","- exs_list.append(i)","-exs = {i: i for i in exs_list}","-n_s = []","-ans = 0","-for i in range(1, n_int + 1):","- if len(str(i)) % 2 == 0:","- continue","- if i in exs:","+def digit_sum(n):","+ # \u5404\u6841\u306e\u548c\u3092\u6c42\u3081\u308b","+ # \u8a08\u7b97\u91cf: O(logN)","+ ans = 0","+ while n > 0:","-print(ans)","+ n \/\/= 10","+ return ans","+","+","+n = int(eval(input()))","+cnt = 0","+for i in range(1, n + 1):","+ cnt += digit_sum(i) % 2","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":1.187838645,"measured_runtime_v1":0.4033198857,"runtime_lift":2.9451526864,"key":["s443742997","s952596957"]} +{"user_id":"u318414416","problem_id":"p03162","language":"python","submission_id_v0":"s337419843","submission_id_v1":"s763303888","cpu_time_v0":672,"cpu_time_v1":308,"memory_v0":47336,"memory_v1":30580,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# coding: utf-8\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [[0] * 3 for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n for j in range(3):\n\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] \\\n\n for k in range(3) if k != j)\n\n return(max(dp[n]))\n\n\n\nn = int(eval(input())) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [0] * 3\n\n for i in range(1, n + 1):\n\n a, b, c = abc[i - 1]\n\n dp = [ max(dp[1] + a, dp[2] + a), \\\n\n max(dp[0] + b, dp[2] + b), \\\n\n max(dp[0] + c, dp[1] + c) ]\n\n return(max(dp))\n\n\n\nn = int(eval(input())) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n","code_v0_loc":17,"code_v1_loc":17,"code_v0_num_chars":434,"code_v1_num_chars":436,"code_v0_no_empty_lines":"# coding: utf-8\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef f(n, abc):\n dp = [[0] * 3 for _ in range(n + 1)]\n for i in range(1, n + 1):\n for j in range(3):\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)\n return max(dp[n])\n\n\nn = int(eval(input())) # 1 <= n <= 10^5\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\nprint((f(n, abc)))\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef f(n, abc):\n dp = [0] * 3\n for i in range(1, n + 1):\n a, b, c = abc[i - 1]\n dp = [\n max(dp[1] + a, dp[2] + a),\n max(dp[0] + b, dp[2] + b),\n max(dp[0] + c, dp[1] + c),\n ]\n return max(dp)\n\n\nn = int(eval(input())) # 1 <= n <= 10^5\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\nprint((f(n, abc)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dp = [[0] * 3 for _ in range(n + 1)]","+ dp = [0] * 3","- for j in range(3):","- dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)","- return max(dp[n])","+ a, b, c = abc[i - 1]","+ dp = [","+ max(dp[1] + a, dp[2] + a),","+ max(dp[0] + b, dp[2] + b),","+ max(dp[0] + c, dp[1] + c),","+ ]","+ return max(dp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2527067475,"measured_runtime_v1":0.1473037755,"runtime_lift":1.7155483393,"key":["s337419843","s763303888"]} +{"user_id":"u826929627","problem_id":"p03162","language":"python","submission_id_v0":"s202497340","submission_id_v1":"s462008938","cpu_time_v0":1254,"cpu_time_v1":403,"memory_v0":42120,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nABC = []\n\n\n\nfor n in range(N):\n\n ABC.append(list(map(int, input().split())))\n\n\n\nimport numpy as np\n\nABC = np.array(ABC)\n\n\n\n## \u300c\u65e5\u4ed8\u300d\u3001\u300c\u9078\u629e\u3057\u305f\u884c\u52d5\u300d\u3054\u3068\u306e\u5e78\u798f\u5ea6\u306e\u6700\u5927\u5024\u3092\u683c\u7d0d\u3059\u308barray\n\nhp=np.zeros((N,3),dtype=int)\n\nhp[0] = ABC[0]\n\n\n\nfor n in range(1,N):# \u65e5\u5358\u4f4d\u3067\u306e\u30eb\u30fc\u30d7\n\n for c in range(3): # \u9078\u629e\u80a2\u3054\u3068\u306e\u30eb\u30fc\u30d7\n\n ## n\u65e5\u306bc\u3092\u9078\u629e\u3057\u305f\u5834\u5408\u306e\u5e78\u798f\u5ea6\u3002\u3064\u307e\u308a\u524d\u65e5\u306fc\u4ee5\u5916\u3092\u9078\u629e\u3057\u3066\u3044\u308b\n\n if c == 0:\n\n hp[n][0] = max(hp[n-1][1],hp[n-1][2]) + ABC[n][0]\n\n elif c == 1:\n\n hp[n][1] = max(hp[n-1][0],hp[n-1][2]) + ABC[n][1]\n\n elif c == 2:\n\n hp[n][2] = max(hp[n-1][0],hp[n-1][1]) + ABC[n][2]\n\n\n\n\n\nans = max(hp[-1])\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\n\n\ndpa,dpb,dpc = 0,0,0\n\nfor n in range(N):\n\n a,b,c = list(map(int, input().split())) \n\n dpa,dpb,dpc = max(dpb+a,dpc+a),max(dpa+b,dpc+b),max(dpa+c,dpb+c)\n\n \n\nans = max(dpa,dpb,dpc)\n\nprint(ans)","code_v0_loc":26,"code_v1_loc":9,"code_v0_num_chars":591,"code_v1_num_chars":206,"code_v0_no_empty_lines":"N = int(eval(input()))\nABC = []\nfor n in range(N):\n ABC.append(list(map(int, input().split())))\nimport numpy as np\n\nABC = np.array(ABC)\n## \u300c\u65e5\u4ed8\u300d\u3001\u300c\u9078\u629e\u3057\u305f\u884c\u52d5\u300d\u3054\u3068\u306e\u5e78\u798f\u5ea6\u306e\u6700\u5927\u5024\u3092\u683c\u7d0d\u3059\u308barray\nhp = np.zeros((N, 3), dtype=int)\nhp[0] = ABC[0]\nfor n in range(1, N): # \u65e5\u5358\u4f4d\u3067\u306e\u30eb\u30fc\u30d7\n for c in range(3): # \u9078\u629e\u80a2\u3054\u3068\u306e\u30eb\u30fc\u30d7\n ## n\u65e5\u306bc\u3092\u9078\u629e\u3057\u305f\u5834\u5408\u306e\u5e78\u798f\u5ea6\u3002\u3064\u307e\u308a\u524d\u65e5\u306fc\u4ee5\u5916\u3092\u9078\u629e\u3057\u3066\u3044\u308b\n if c == 0:\n hp[n][0] = max(hp[n - 1][1], hp[n - 1][2]) + ABC[n][0]\n elif c == 1:\n hp[n][1] = max(hp[n - 1][0], hp[n - 1][2]) + ABC[n][1]\n elif c == 2:\n hp[n][2] = max(hp[n - 1][0], hp[n - 1][1]) + ABC[n][2]\nans = max(hp[-1])\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\ndpa, dpb, dpc = 0, 0, 0\nfor n in range(N):\n a, b, c = list(map(int, input().split()))\n dpa, dpb, dpc = max(dpb + a, dpc + a), max(dpa + b, dpc + b), max(dpa + c, dpb + c)\nans = max(dpa, dpb, dpc)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":65.3846153846,"diff":["-ABC = []","+dpa, dpb, dpc = 0, 0, 0","- ABC.append(list(map(int, input().split())))","-import numpy as np","-","-ABC = np.array(ABC)","-## \u300c\u65e5\u4ed8\u300d\u3001\u300c\u9078\u629e\u3057\u305f\u884c\u52d5\u300d\u3054\u3068\u306e\u5e78\u798f\u5ea6\u306e\u6700\u5927\u5024\u3092\u683c\u7d0d\u3059\u308barray","-hp = np.zeros((N, 3), dtype=int)","-hp[0] = ABC[0]","-for n in range(1, N): # \u65e5\u5358\u4f4d\u3067\u306e\u30eb\u30fc\u30d7","- for c in range(3): # \u9078\u629e\u80a2\u3054\u3068\u306e\u30eb\u30fc\u30d7","- ## n\u65e5\u306bc\u3092\u9078\u629e\u3057\u305f\u5834\u5408\u306e\u5e78\u798f\u5ea6\u3002\u3064\u307e\u308a\u524d\u65e5\u306fc\u4ee5\u5916\u3092\u9078\u629e\u3057\u3066\u3044\u308b","- if c == 0:","- hp[n][0] = max(hp[n - 1][1], hp[n - 1][2]) + ABC[n][0]","- elif c == 1:","- hp[n][1] = max(hp[n - 1][0], hp[n - 1][2]) + ABC[n][1]","- elif c == 2:","- hp[n][2] = max(hp[n - 1][0], hp[n - 1][1]) + ABC[n][2]","-ans = max(hp[-1])","+ a, b, c = list(map(int, input().split()))","+ dpa, dpb, dpc = max(dpb + a, dpc + a), max(dpa + b, dpc + b), max(dpa + c, dpb + c)","+ans = max(dpa, dpb, dpc)"],"diff_only_import_comment":false,"measured_runtime_v0":1.8550028729,"measured_runtime_v1":0.2768508897,"runtime_lift":6.7003681115,"key":["s202497340","s462008938"]} +{"user_id":"u945199633","problem_id":"p02595","language":"python","submission_id_v0":"s028374925","submission_id_v1":"s480019615","cpu_time_v0":580,"cpu_time_v1":443,"memory_v0":45308,"memory_v1":9156,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, D = list(map(int, input().split()))\n\npoint = []\n\nfor i in range(N):\n\n point.append(list(map(int, input().split())))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in point:\n\n if (i[0]**2 + i[1]**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)\n\n# optimized version of the same code:\n","target":"N, D = list(map(int, input().split()))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in range(N):\n\n X, Y = list(map(int, input().split()))\n\n if (X**2 + Y**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)","code_v0_loc":12,"code_v1_loc":10,"code_v0_num_chars":219,"code_v1_num_chars":171,"code_v0_no_empty_lines":"N, D = list(map(int, input().split()))\npoint = []\nfor i in range(N):\n point.append(list(map(int, input().split())))\nct = 0\nD2 = D * D\nfor i in point:\n if (i[0] ** 2 + i[1] ** 2) <= D2:\n ct += 1\nprint(ct)\n","code_v1_no_empty_lines":"N, D = list(map(int, input().split()))\nct = 0\nD2 = D * D\nfor i in range(N):\n X, Y = list(map(int, input().split()))\n if (X**2 + Y**2) <= D2:\n ct += 1\nprint(ct)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-point = []","-for i in range(N):","- point.append(list(map(int, input().split())))","-for i in point:","- if (i[0] ** 2 + i[1] ** 2) <= D2:","+for i in range(N):","+ X, Y = list(map(int, input().split()))","+ if (X**2 + Y**2) <= D2:"],"diff_only_import_comment":false,"measured_runtime_v0":0.399467237,"measured_runtime_v1":0.2084539161,"runtime_lift":1.9163335691,"key":["s028374925","s480019615"]} +{"user_id":"u624696727","problem_id":"p02767","language":"python","submission_id_v0":"s196711845","submission_id_v1":"s619004796","cpu_time_v0":338,"cpu_time_v1":149,"memory_v0":22124,"memory_v1":12220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.92,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nint1 = lambda x: int(x) - 1\n\nprintV = lambda x: print(*x, sep=\"\\n\")\n\nprintH = lambda x: print(\" \".join(map(str,x)))\n\ndef IS(): return sys.stdin.readline()[:-1]\n\ndef II(): return int(sys.stdin.readline())\n\ndef MI(): return map(int, sys.stdin.readline().split())\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef LI1(): return list(map(int1, sys.stdin.readline().split()))\n\ndef LII(rows_number): return [II() for _ in range(rows_number)]\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef LLI1(rows_number): return [LI1() for _ in range(rows_number)]\n\n\n\ndef main():\n\n\tN = II()\n\n\tX = LI()\n\n\tX = np.array(X, dtype=\"int32\")\n\n\tm = round(np.sum(X) \/ N)\n\n\tprint(int(np.sum((X-m)**2)))\n\n\n\nif __name__ == '__main__':\n\n\tmain()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nimport numpy as np\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nint1 = lambda x: int(x) - 1\n\nprintV = lambda x: print(*x, sep=\"\\n\")\n\nprintH = lambda x: print(\" \".join(map(str,x)))\n\ndef IS(): return sys.stdin.readline()[:-1]\n\ndef II(): return int(sys.stdin.readline())\n\ndef MI(): return map(int, sys.stdin.readline().split())\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef LI1(): return list(map(int1, sys.stdin.readline().split()))\n\ndef LII(rows_number): return [II() for _ in range(rows_number)]\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef LLI1(rows_number): return [LI1() for _ in range(rows_number)]\n\n\n\ndef main():\n\n\tN = II()\n\n\tX = LI()\n\n\tX = np.array(X)\n\n\tm = round(np.sum(X) \/ N)\n\n\tprint(int(np.sum((X-m)**2)))\n\n\n\nif __name__ == '__main__':\n\n\tmain()\n","code_v0_loc":25,"code_v1_loc":25,"code_v0_num_chars":818,"code_v1_num_chars":803,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nsys.setrecursionlimit(10**6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep=\"\\n\")\nprintH = lambda x: print(\" \".join(map(str, x)))\n\n\ndef IS():\n return sys.stdin.readline()[:-1]\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef MI():\n return map(int, sys.stdin.readline().split())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LI1():\n return list(map(int1, sys.stdin.readline().split()))\n\n\ndef LII(rows_number):\n return [II() for _ in range(rows_number)]\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef LLI1(rows_number):\n return [LI1() for _ in range(rows_number)]\n\n\ndef main():\n N = II()\n X = LI()\n X = np.array(X, dtype=\"int32\")\n m = round(np.sum(X) \/ N)\n print(int(np.sum((X - m) ** 2)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\nsys.setrecursionlimit(10**6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep=\"\\n\")\nprintH = lambda x: print(\" \".join(map(str, x)))\n\n\ndef IS():\n return sys.stdin.readline()[:-1]\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef MI():\n return map(int, sys.stdin.readline().split())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LI1():\n return list(map(int1, sys.stdin.readline().split()))\n\n\ndef LII(rows_number):\n return [II() for _ in range(rows_number)]\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef LLI1(rows_number):\n return [LI1() for _ in range(rows_number)]\n\n\ndef main():\n N = II()\n X = LI()\n X = np.array(X)\n m = round(np.sum(X) \/ N)\n print(int(np.sum((X - m) ** 2)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- X = np.array(X, dtype=\"int32\")","+ X = np.array(X)"],"diff_only_import_comment":false,"measured_runtime_v0":2.6973853536,"measured_runtime_v1":1.5154907587,"runtime_lift":1.7798758179,"key":["s196711845","s619004796"]} +{"user_id":"u698176039","problem_id":"p03162","language":"python","submission_id_v0":"s642203251","submission_id_v1":"s153299342","cpu_time_v0":638,"cpu_time_v1":395,"memory_v0":74456,"memory_v1":70108,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.09,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\na = [list(map(int,input().split())) for _ in range(N)]\n\n\n\ndp = [[0]*3 for _ in range(100010)] \n\n# dp[i][j] : i\u65e5\u76ee\u306bj\u756a\u76ee\u306e\u6d3b\u52d5\u3092\u3057\u305f\u3068\u304d\u306e\u5e78\u798f\u5ea6\u306e\u7dcf\u548c\n\nidx = [[1,2],[2,0],[0,1]]\n\n\n\nfor i in range(3):\n\n dp[0][i] = a[0][i]\n\n \n\nfor i in range(1,N):\n\n for j in range(3):\n\n dp[i][j] = max(dp[i-1][idx[j][0]],dp[i-1][idx[j][1]])+a[i][j]\n\n \n\nprint((max(dp[N-1])))\n\n# optimized version of the same code:\n","target":"import sys\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\n\n\nN = int(eval(input()))\n\nABC = [list(map(int,input().split())) for _ in range(N)]\n\n\n\ninf = 10**9+7\n\ndp = [[0] * 3 for _ in range(N+10)]\n\ndp[0] = [ABC[0][0],ABC[0][1],ABC[0][2]]\n\n\n\nfor i in range(N-1):\n\n for j in range(3):\n\n for k in range(3):\n\n if j==k:continue\n\n dp[i+1][j] = max(dp[i+1][j],dp[i][k]+ABC[i+1][j])\n\n \n\n \n\n\n\nprint((max(dp[N-1][:])))\n","code_v0_loc":15,"code_v1_loc":20,"code_v0_num_chars":372,"code_v1_num_chars":447,"code_v0_no_empty_lines":"N = int(eval(input()))\na = [list(map(int, input().split())) for _ in range(N)]\ndp = [[0] * 3 for _ in range(100010)]\n# dp[i][j] : i\u65e5\u76ee\u306bj\u756a\u76ee\u306e\u6d3b\u52d5\u3092\u3057\u305f\u3068\u304d\u306e\u5e78\u798f\u5ea6\u306e\u7dcf\u548c\nidx = [[1, 2], [2, 0], [0, 1]]\nfor i in range(3):\n dp[0][i] = a[0][i]\nfor i in range(1, N):\n for j in range(3):\n dp[i][j] = max(dp[i - 1][idx[j][0]], dp[i - 1][idx[j][1]]) + a[i][j]\nprint((max(dp[N - 1])))\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nN = int(eval(input()))\nABC = [list(map(int, input().split())) for _ in range(N)]\ninf = 10**9 + 7\ndp = [[0] * 3 for _ in range(N + 10)]\ndp[0] = [ABC[0][0], ABC[0][1], ABC[0][2]]\nfor i in range(N - 1):\n for j in range(3):\n for k in range(3):\n if j == k:\n continue\n dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + ABC[i + 1][j])\nprint((max(dp[N - 1][:])))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["+import sys","+","+","+def input():","+ return sys.stdin.readline()[:-1]","+","+","-a = [list(map(int, input().split())) for _ in range(N)]","-dp = [[0] * 3 for _ in range(100010)]","-# dp[i][j] : i\u65e5\u76ee\u306bj\u756a\u76ee\u306e\u6d3b\u52d5\u3092\u3057\u305f\u3068\u304d\u306e\u5e78\u798f\u5ea6\u306e\u7dcf\u548c","-idx = [[1, 2], [2, 0], [0, 1]]","-for i in range(3):","- dp[0][i] = a[0][i]","-for i in range(1, N):","+ABC = [list(map(int, input().split())) for _ in range(N)]","+inf = 10**9 + 7","+dp = [[0] * 3 for _ in range(N + 10)]","+dp[0] = [ABC[0][0], ABC[0][1], ABC[0][2]]","+for i in range(N - 1):","- dp[i][j] = max(dp[i - 1][idx[j][0]], dp[i - 1][idx[j][1]]) + a[i][j]","-print((max(dp[N - 1])))","+ for k in range(3):","+ if j == k:","+ continue","+ dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + ABC[i + 1][j])","+print((max(dp[N - 1][:])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.7135980439,"measured_runtime_v1":0.2380394118,"runtime_lift":2.9978146835,"key":["s642203251","s153299342"]} +{"user_id":"u780962115","problem_id":"p02850","language":"python","submission_id_v0":"s056526441","submission_id_v1":"s495635102","cpu_time_v0":872,"cpu_time_v1":745,"memory_v0":119396,"memory_v1":45168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.56,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\nnode={i:[] for i in range(1,n+1)}\n\nvisited=[False for i in range(n+1)]\n\nq=[]\n\nfor _ in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n node[a].append(b)\n\n node[b].append(a)\n\n q.append((a,b))\n\n\n\nmother=q[0][0]\n\nvisited[mother]=True\n\n\n\nd=[]\n\ne=[]\n\n\n\n\n\npaint={i:{} for i in range(1,n+1)}\n\n\n\nmother_paint=[0 for i in range(n+1)]\n\n\n\n#\u4f7f\u3046\u8981\u7d20 node visited paint mother_paint \u306e\u56db\u3064\u306e\u30ea\u30b9\u30c8\n\nc=1\n\nfor child in node[mother]:\n\n visited[child]=True\n\n paint[mother][child]=c\n\n paint[child][mother]=c\n\n mother_paint[child]=c\n\n c+=1\n\n d.append(child)\n\n \n\nwhile d:\n\n for parent in d:\n\n p=1 \n\n for child in node[parent]:\n\n if visited[child]==False:\n\n visited[child]=True\n\n if p!=mother_paint[parent]:\n\n paint[parent][child]=p\n\n paint[child][parent]=p\n\n mother_paint[child]=p\n\n p+=1\n\n e.append(child)\n\n else:\n\n p+=1\n\n paint[parent][child]=p\n\n paint[child][parent]=p\n\n mother_paint[child]=p\n\n p+=1\n\n e.append(child)\n\n if e:\n\n d=e\n\n e=[]\n\n else:\n\n d=[]\n\n e=[]\n\nK=0\n\nfor i in range(1,n+1):\n\n K=max(K,len(node[i]))\n\nprint(K)\n\nfor i in range(n-1):\n\n s,t=q[i][0],q[i][1]\n\n print((paint[s][t]))\n\n# optimized version of the same code:\n","target":"#problem1\n\nfrom collections import deque\n\nd=deque()\n\ne=deque()\n\n\n\nN=int(eval(input()))\n\ngraph=[[] for i in range(N+1)]\n\nD=[]\n\nfor _ in range(N-1):\n\n a,b=list(map(int,input().split()))\n\n graph[a].append(b)\n\n graph[b].append(a)\n\n D.append((a,b))\n\n \n\n#\u9802\u70b91\u304b\u3089\u30b9\u30bf\u30fc\u30c8\n\nK=0\n\nd.append(1)\n\nvisited=[False for i in range(N+1)]\n\ncolor=[-1 for i in range(N+1)]\n\nvisited[1]=True\n\ncolor[1]=-1\n\ndic={}\n\nwhile d:\n\n while d:\n\n x=d.popleft()\n\n par_color=color[x]\n\n c=1\n\n for node in graph[x]:\n\n if visited[node]==False:\n\n visited[node]=True\n\n e.append(node) \n\n if c!=par_color:\n\n color[node]=c\n\n dic[(x,node)]=c\n\n elif c==par_color:\n\n c+=1\n\n color[node]=c\n\n dic[(x,node)]=c\n\n c+=1\n\n if e:\n\n d=e\n\n e=deque()\n\n\n\nA=max(color)\n\nprint(A)\n\nfor que in D:\n\n a,b=que\n\n if (a,b) in list(dic.keys()):\n\n print((dic[que]))\n\n else:\n\n print((dic[(b,a)]))\n\n ","code_v0_loc":63,"code_v1_loc":52,"code_v0_num_chars":1430,"code_v1_num_chars":1084,"code_v0_no_empty_lines":"n = int(eval(input()))\nnode = {i: [] for i in range(1, n + 1)}\nvisited = [False for i in range(n + 1)]\nq = []\nfor _ in range(n - 1):\n a, b = list(map(int, input().split()))\n node[a].append(b)\n node[b].append(a)\n q.append((a, b))\nmother = q[0][0]\nvisited[mother] = True\nd = []\ne = []\npaint = {i: {} for i in range(1, n + 1)}\nmother_paint = [0 for i in range(n + 1)]\n# \u4f7f\u3046\u8981\u7d20 node visited paint mother_paint \u306e\u56db\u3064\u306e\u30ea\u30b9\u30c8\nc = 1\nfor child in node[mother]:\n visited[child] = True\n paint[mother][child] = c\n paint[child][mother] = c\n mother_paint[child] = c\n c += 1\n d.append(child)\nwhile d:\n for parent in d:\n p = 1\n for child in node[parent]:\n if visited[child] == False:\n visited[child] = True\n if p != mother_paint[parent]:\n paint[parent][child] = p\n paint[child][parent] = p\n mother_paint[child] = p\n p += 1\n e.append(child)\n else:\n p += 1\n paint[parent][child] = p\n paint[child][parent] = p\n mother_paint[child] = p\n p += 1\n e.append(child)\n if e:\n d = e\n e = []\n else:\n d = []\n e = []\nK = 0\nfor i in range(1, n + 1):\n K = max(K, len(node[i]))\nprint(K)\nfor i in range(n - 1):\n s, t = q[i][0], q[i][1]\n print((paint[s][t]))\n","code_v1_no_empty_lines":"# problem1\nfrom collections import deque\n\nd = deque()\ne = deque()\nN = int(eval(input()))\ngraph = [[] for i in range(N + 1)]\nD = []\nfor _ in range(N - 1):\n a, b = list(map(int, input().split()))\n graph[a].append(b)\n graph[b].append(a)\n D.append((a, b))\n# \u9802\u70b91\u304b\u3089\u30b9\u30bf\u30fc\u30c8\nK = 0\nd.append(1)\nvisited = [False for i in range(N + 1)]\ncolor = [-1 for i in range(N + 1)]\nvisited[1] = True\ncolor[1] = -1\ndic = {}\nwhile d:\n while d:\n x = d.popleft()\n par_color = color[x]\n c = 1\n for node in graph[x]:\n if visited[node] == False:\n visited[node] = True\n e.append(node)\n if c != par_color:\n color[node] = c\n dic[(x, node)] = c\n elif c == par_color:\n c += 1\n color[node] = c\n dic[(x, node)] = c\n c += 1\n if e:\n d = e\n e = deque()\nA = max(color)\nprint(A)\nfor que in D:\n a, b = que\n if (a, b) in list(dic.keys()):\n print((dic[que]))\n else:\n print((dic[(b, a)]))\n","code_same":false,"relative_loc_diff_percent":17.4603174603,"diff":["-n = int(eval(input()))","-node = {i: [] for i in range(1, n + 1)}","-visited = [False for i in range(n + 1)]","-q = []","-for _ in range(n - 1):","+# problem1","+from collections import deque","+","+d = deque()","+e = deque()","+N = int(eval(input()))","+graph = [[] for i in range(N + 1)]","+D = []","+for _ in range(N - 1):","- node[a].append(b)","- node[b].append(a)","- q.append((a, b))","-mother = q[0][0]","-visited[mother] = True","-d = []","-e = []","-paint = {i: {} for i in range(1, n + 1)}","-mother_paint = [0 for i in range(n + 1)]","-# \u4f7f\u3046\u8981\u7d20 node visited paint mother_paint \u306e\u56db\u3064\u306e\u30ea\u30b9\u30c8","-c = 1","-for child in node[mother]:","- visited[child] = True","- paint[mother][child] = c","- paint[child][mother] = c","- mother_paint[child] = c","- c += 1","- d.append(child)","+ graph[a].append(b)","+ graph[b].append(a)","+ D.append((a, b))","+# \u9802\u70b91\u304b\u3089\u30b9\u30bf\u30fc\u30c8","+K = 0","+d.append(1)","+visited = [False for i in range(N + 1)]","+color = [-1 for i in range(N + 1)]","+visited[1] = True","+color[1] = -1","+dic = {}","- for parent in d:","- p = 1","- for child in node[parent]:","- if visited[child] == False:","- visited[child] = True","- if p != mother_paint[parent]:","- paint[parent][child] = p","- paint[child][parent] = p","- mother_paint[child] = p","- p += 1","- e.append(child)","- else:","- p += 1","- paint[parent][child] = p","- paint[child][parent] = p","- mother_paint[child] = p","- p += 1","- e.append(child)","+ while d:","+ x = d.popleft()","+ par_color = color[x]","+ c = 1","+ for node in graph[x]:","+ if visited[node] == False:","+ visited[node] = True","+ e.append(node)","+ if c != par_color:","+ color[node] = c","+ dic[(x, node)] = c","+ elif c == par_color:","+ c += 1","+ color[node] = c","+ dic[(x, node)] = c","+ c += 1","- e = []","+ e = deque()","+A = max(color)","+print(A)","+for que in D:","+ a, b = que","+ if (a, b) in list(dic.keys()):","+ print((dic[que]))","- d = []","- e = []","-K = 0","-for i in range(1, n + 1):","- K = max(K, len(node[i]))","-print(K)","-for i in range(n - 1):","- s, t = q[i][0], q[i][1]","- print((paint[s][t]))","+ print((dic[(b, a)]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3284679053,"measured_runtime_v1":0.2336777339,"runtime_lift":1.4056448588,"key":["s056526441","s495635102"]} +{"user_id":"u624689667","problem_id":"p03796","language":"python","submission_id_v0":"s800016333","submission_id_v1":"s112879561","cpu_time_v0":271,"cpu_time_v1":164,"memory_v0":42736,"memory_v1":38512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import factorial\n\n\n\nmod = 10**9 + 7\n\nn = int(eval(input()))\n\n\n\nans = factorial(n) % mod\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nMOD = 10**9 + 7\n\nans = 1\n\nfor i in range(2, N+1):\n\n ans *= i\n\n ans %= MOD\n\nprint(ans)\n","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":103,"code_v1_num_chars":110,"code_v0_no_empty_lines":"from math import factorial\n\nmod = 10**9 + 7\nn = int(eval(input()))\nans = factorial(n) % mod\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nMOD = 10**9 + 7\nans = 1\nfor i in range(2, N + 1):\n ans *= i\n ans %= MOD\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-from math import factorial","-","-mod = 10**9 + 7","-n = int(eval(input()))","-ans = factorial(n) % mod","+N = int(eval(input()))","+MOD = 10**9 + 7","+ans = 1","+for i in range(2, N + 1):","+ ans *= i","+ ans %= MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.5071064572,"measured_runtime_v1":0.006458343,"runtime_lift":78.5195915066,"key":["s800016333","s112879561"]} +{"user_id":"u945228737","problem_id":"p02555","language":"python","submission_id_v0":"s973678433","submission_id_v1":"s713708426","cpu_time_v0":115,"cpu_time_v1":28,"memory_v0":9184,"memory_v1":9092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.65,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# import sys\n\n# sys.setrecursionlimit(10 ** 6)\n\n# import bisect\n\n# from collections import deque\n\n\n\ndef cmb(n, r):\n\n \"\"\"\u7d44\u307f\u5408\u308f\u305b\"\"\"\n\n import math\n\n if n < r:\n\n return 0\n\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\n\n\n\n# from decorator import stop_watch\n\n#\n\n#\n\n# @stop_watch\n\ndef solve(S):\n\n mod = 10 ** 9 + 7\n\n ans = 0\n\n for i in range(1, S \/\/ 3 + 1):\n\n tama = i + (S - (i * 3))\n\n tama -= 2\n\n bo = i - 1\n\n ans += cmb(tama + 1, bo)\n\n ans %= mod\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n # S = input()\n\n S = int(eval(input()))\n\n # N, M = map(int, input().split())\n\n # Ai = [int(i) for i in input().split()]\n\n # Bi = [int(i) for i in input().split()]\n\n # ABi = [[int(i) for i in input().split()] for _ in range(N)]\n\n solve(S)\n\n\n\n # # test\n\n # from random import randint\n\n # from func import random_str\n\n # solve()\n\n\n# optimized version of the same code:\n","target":"# \u89e3\u8aac\u3092\u53c2\u8003\u306b\u4f5c\u6210\n\n# import sys\n\n# sys.setrecursionlimit(10 ** 6)\n\n# import bisect\n\n# from collections import deque\n\n# from decorator import stop_watch\n\n#\n\n#\n\n# @stop_watch\n\ndef solve(S):\n\n mod = 10 ** 9 + 7\n\n dp = [0] * (S + 1)\n\n dp[0] = 1\n\n for i in range(3, S + 1):\n\n dp[i] = dp[i - 1] + dp[i - 3]\n\n dp[i] %= mod\n\n print((dp[S]))\n\n\n\n\n\nif __name__ == '__main__':\n\n S = int(eval(input()))\n\n solve(S)\n\n\n\n # # test\n\n # from random import randint\n\n # from func import random_str\n\n # solve()\n","code_v0_loc":42,"code_v1_loc":27,"code_v0_num_chars":936,"code_v1_num_chars":521,"code_v0_no_empty_lines":"# import sys\n# sys.setrecursionlimit(10 ** 6)\n# import bisect\n# from collections import deque\ndef cmb(n, r):\n \"\"\"\u7d44\u307f\u5408\u308f\u305b\"\"\"\n import math\n\n if n < r:\n return 0\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\n# from decorator import stop_watch\n#\n#\n# @stop_watch\ndef solve(S):\n mod = 10**9 + 7\n ans = 0\n for i in range(1, S \/\/ 3 + 1):\n tama = i + (S - (i * 3))\n tama -= 2\n bo = i - 1\n ans += cmb(tama + 1, bo)\n ans %= mod\n print(ans)\n\n\nif __name__ == \"__main__\":\n # S = input()\n S = int(eval(input()))\n # N, M = map(int, input().split())\n # Ai = [int(i) for i in input().split()]\n # Bi = [int(i) for i in input().split()]\n # ABi = [[int(i) for i in input().split()] for _ in range(N)]\n solve(S)\n # # test\n # from random import randint\n # from func import random_str\n # solve()\n","code_v1_no_empty_lines":"# \u89e3\u8aac\u3092\u53c2\u8003\u306b\u4f5c\u6210\n# import sys\n# sys.setrecursionlimit(10 ** 6)\n# import bisect\n# from collections import deque\n# from decorator import stop_watch\n#\n#\n# @stop_watch\ndef solve(S):\n mod = 10**9 + 7\n dp = [0] * (S + 1)\n dp[0] = 1\n for i in range(3, S + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n dp[i] %= mod\n print((dp[S]))\n\n\nif __name__ == \"__main__\":\n S = int(eval(input()))\n solve(S)\n # # test\n # from random import randint\n # from func import random_str\n # solve()\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["+# \u89e3\u8aac\u3092\u53c2\u8003\u306b\u4f5c\u6210","-def cmb(n, r):","- \"\"\"\u7d44\u307f\u5408\u308f\u305b\"\"\"","- import math","-","- if n < r:","- return 0","- return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))","-","-","- ans = 0","- for i in range(1, S \/\/ 3 + 1):","- tama = i + (S - (i * 3))","- tama -= 2","- bo = i - 1","- ans += cmb(tama + 1, bo)","- ans %= mod","- print(ans)","+ dp = [0] * (S + 1)","+ dp[0] = 1","+ for i in range(3, S + 1):","+ dp[i] = dp[i - 1] + dp[i - 3]","+ dp[i] %= mod","+ print((dp[S]))","- # S = input()","- # N, M = map(int, input().split())","- # Ai = [int(i) for i in input().split()]","- # Bi = [int(i) for i in input().split()]","- # ABi = [[int(i) for i in input().split()] for _ in range(N)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.4257377865,"measured_runtime_v1":0.2429736164,"runtime_lift":1.7521975961,"key":["s973678433","s713708426"]} +{"user_id":"u816872429","problem_id":"p03078","language":"python","submission_id_v0":"s052587697","submission_id_v1":"s157699880","cpu_time_v0":41,"cpu_time_v1":28,"memory_v0":4096,"memory_v1":4460,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.71,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\ndef diff(l):\n\n m = max(l)\n\n return sorted(m - v for v in l)[1:]\n\n\n\ns = sum(map(max, [a, b, c]))\n\nsa, sb, sc = list(map(diff, [a, b, c]))\n\nda, db, dc = [0], [0], [0]\n\nq = [0]\n\nwhile k > 0:\n\n while True:\n\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n\n heapq.heappush(q, v)\n\n da.append(sa[0])\n\n sa = sa[1:]\n\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n\n heapq.heappush(q, v)\n\n db.append(sb[0])\n\n sb = sb[1:]\n\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n\n heapq.heappush(q, v)\n\n dc.append(sc[0])\n\n sc = sc[1:]\n\n else:\n\n break\n\n v = heapq.heappop(q)\n\n print(s - v)\n\n k -= 1\n\n\n# optimized version of the same code:\n","target":"import heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = sorted(map(int, input().split()))\n\nb = sorted(map(int, input().split()))\n\nc = sorted(map(int, input().split()))\n\n\n\nq = []\n\nmemo = set()\n\ndef qpush(q, ai, bi, ci):\n\n t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)\n\n if not t in memo:\n\n memo.add(t)\n\n heapq.heappush(q, t)\n\n\n\nqpush(q, len(a) - 1, len(b) - 1, len(c) - 1)\n\nfor _ in range(k):\n\n s, ai, bi, ci = heapq.heappop(q)\n\n if ai > 0:\n\n qpush(q, ai - 1, bi, ci)\n\n if bi > 0:\n\n qpush(q, ai, bi - 1, ci)\n\n if ci > 0:\n\n qpush(q, ai, bi, ci - 1)\n\n print(-s)\n","code_v0_loc":37,"code_v1_loc":25,"code_v0_num_chars":1122,"code_v1_num_chars":631,"code_v0_no_empty_lines":"import heapq\n\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\n\ndef diff(l):\n m = max(l)\n return sorted(m - v for v in l)[1:]\n\n\ns = sum(map(max, [a, b, c]))\nsa, sb, sc = list(map(diff, [a, b, c]))\nda, db, dc = [0], [0], [0]\nq = [0]\nwhile k > 0:\n while True:\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n heapq.heappush(q, v)\n da.append(sa[0])\n sa = sa[1:]\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n heapq.heappush(q, v)\n db.append(sb[0])\n sb = sb[1:]\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n heapq.heappush(q, v)\n dc.append(sc[0])\n sc = sc[1:]\n else:\n break\n v = heapq.heappop(q)\n print(s - v)\n k -= 1\n","code_v1_no_empty_lines":"import heapq\n\nx, y, z, k = list(map(int, input().split()))\na = sorted(map(int, input().split()))\nb = sorted(map(int, input().split()))\nc = sorted(map(int, input().split()))\nq = []\nmemo = set()\n\n\ndef qpush(q, ai, bi, ci):\n t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)\n if not t in memo:\n memo.add(t)\n heapq.heappush(q, t)\n\n\nqpush(q, len(a) - 1, len(b) - 1, len(c) - 1)\nfor _ in range(k):\n s, ai, bi, ci = heapq.heappop(q)\n if ai > 0:\n qpush(q, ai - 1, bi, ci)\n if bi > 0:\n qpush(q, ai, bi - 1, ci)\n if ci > 0:\n qpush(q, ai, bi, ci - 1)\n print(-s)\n","code_same":false,"relative_loc_diff_percent":32.4324324324,"diff":["-a = list(map(int, input().split()))","-b = list(map(int, input().split()))","-c = list(map(int, input().split()))","+a = sorted(map(int, input().split()))","+b = sorted(map(int, input().split()))","+c = sorted(map(int, input().split()))","+q = []","+memo = set()","-def diff(l):","- m = max(l)","- return sorted(m - v for v in l)[1:]","+def qpush(q, ai, bi, ci):","+ t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)","+ if not t in memo:","+ memo.add(t)","+ heapq.heappush(q, t)","-s = sum(map(max, [a, b, c]))","-sa, sb, sc = list(map(diff, [a, b, c]))","-da, db, dc = [0], [0], [0]","-q = [0]","-while k > 0:","- while True:","- if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):","- for v in [sa[0] + bb + cc for bb in db for cc in dc]:","- heapq.heappush(q, v)","- da.append(sa[0])","- sa = sa[1:]","- elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):","- for v in [sb[0] + aa + cc for aa in da for cc in dc]:","- heapq.heappush(q, v)","- db.append(sb[0])","- sb = sb[1:]","- elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):","- for v in [sc[0] + aa + bb for aa in da for bb in db]:","- heapq.heappush(q, v)","- dc.append(sc[0])","- sc = sc[1:]","- else:","- break","- v = heapq.heappop(q)","- print(s - v)","- k -= 1","+qpush(q, len(a) - 1, len(b) - 1, len(c) - 1)","+for _ in range(k):","+ s, ai, bi, ci = heapq.heappop(q)","+ if ai > 0:","+ qpush(q, ai - 1, bi, ci)","+ if bi > 0:","+ qpush(q, ai, bi - 1, ci)","+ if ci > 0:","+ qpush(q, ai, bi, ci - 1)","+ print(-s)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2304672,"measured_runtime_v1":0.0062596636,"runtime_lift":36.8178252168,"key":["s052587697","s157699880"]} +{"user_id":"u924691798","problem_id":"p02837","language":"python","submission_id_v0":"s473277676","submission_id_v1":"s669766257","cpu_time_v0":175,"cpu_time_v1":139,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.57,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nA = [0]*N\n\nX = []\n\nY = []\n\nfor i in range(N):\n\n A[i] = int(eval(input()))\n\n X.append([])\n\n Y.append([])\n\n for j in range(A[i]):\n\n x, y = list(map(int, input().split()))\n\n X[i].append(x-1)\n\n Y[i].append(y)\n\nans = 0\n\nfor bit in range(1<= (10 ** 9)+7:\n\n ans = ans % ((10 ** 9)+7)\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\n\n\nans = 1\n\nfor i in range(1, n+1):\n\n ans = ans * i\n\n ans = ans % ((10 ** 9)+7) # \u9014\u4e2d\u3067\u5272\u308a\u7b97\u306e\u4f59\u308a\u3092\u6c42\u3081\u3066\u3082\u3001\u6700\u7d42\u7d50\u679c\u306f\u540c\u3058\u306b\u306a\u308b\n\n\n\nprint(ans)","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":139,"code_v1_num_chars":145,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nans = math.factorial(n) # n\u306e\u968e\u4e57\u3092\u8a08\u7b97\nif ans >= (10**9) + 7:\n ans = ans % ((10**9) + 7)\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = 1\nfor i in range(1, n + 1):\n ans = ans * i\n ans = ans % ((10**9) + 7) # \u9014\u4e2d\u3067\u5272\u308a\u7b97\u306e\u4f59\u308a\u3092\u6c42\u3081\u3066\u3082\u3001\u6700\u7d42\u7d50\u679c\u306f\u540c\u3058\u306b\u306a\u308b\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-import math","-","-ans = math.factorial(n) # n\u306e\u968e\u4e57\u3092\u8a08\u7b97","-if ans >= (10**9) + 7:","- ans = ans % ((10**9) + 7)","+ans = 1","+for i in range(1, n + 1):","+ ans = ans * i","+ ans = ans % ((10**9) + 7) # \u9014\u4e2d\u3067\u5272\u308a\u7b97\u306e\u4f59\u308a\u3092\u6c42\u3081\u3066\u3082\u3001\u6700\u7d42\u7d50\u679c\u306f\u540c\u3058\u306b\u306a\u308b"],"diff_only_import_comment":false,"measured_runtime_v0":0.5420387263,"measured_runtime_v1":0.2535338807,"runtime_lift":2.1379340891,"key":["s008235718","s090392182"]} +{"user_id":"u072053884","problem_id":"p02278","language":"python","submission_id_v0":"s595158290","submission_id_v1":"s757741528","cpu_time_v0":80,"cpu_time_v1":60,"memory_v0":7788,"memory_v1":7812,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n\"\"\"Minimum cost Sort.\"\"\"\n\n\n\ndef min_cost_sort(A):\n\n \"\"\"Sort list A in ascending order.\n\n \n\n And return the switching cost in sorting.\n\n \"\"\"\n\n B = list(A)\n\n B.sort()\n\n cost = 0\n\n min_w = B[0]\n\n for i, b in enumerate(B):\n\n tmp_cost = 0\n\n bi = A.index(b)\n\n n = 1\n\n while bi != i:\n\n n += 1\n\n st = B[bi]\n\n si = A.index(st)\n\n tmp_cost += b + st\n\n A[bi], A[si] = st, b\n\n bi = si\n\n dec = (n - 1) * (b - min_w)\n\n inc = 2 * (min_w + b)\n\n if dec < inc:\n\n cost += tmp_cost\n\n else:\n\n cost += tmp_cost - dec + inc\n\n return cost\n\n\n\n\n\nn = eval(input())\n\n\n\nA = list(map(int, input().split()))\n\n\n\nans = min_cost_sort(A)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"\"\"\"Minimum cost Sort.\"\"\"\n\n\n\ndef min_cost_sort(A):\n\n \"\"\"Sort list A in ascending order.\n\n \n\n And return the switching cost in sorting.\n\n \"\"\"\n\n B = list(A)\n\n B.sort()\n\n cost = 0\n\n min_w = B[0]\n\n for i, b in enumerate(B):\n\n tmp_cost = 0\n\n bi = A.index(b)\n\n cnt = 0\n\n while bi != i:\n\n cnt += 1\n\n st = B[bi]\n\n si = A.index(st)\n\n tmp_cost += b + st\n\n A[bi], A[si] = st, b\n\n bi = si\n\n if cnt:\n\n dec = cnt * (b - min_w)\n\n inc = 2 * (min_w + b)\n\n if dec < inc:\n\n cost += tmp_cost\n\n else:\n\n cost += tmp_cost - dec + inc\n\n return cost\n\n\n\n\n\nn = eval(input())\n\n\n\nA = list(map(int, input().split()))\n\n\n\nans = min_cost_sort(A)\n\n\n\nprint(ans)","code_v0_loc":38,"code_v1_loc":39,"code_v0_num_chars":780,"code_v1_num_chars":821,"code_v0_no_empty_lines":"\"\"\"Minimum cost Sort.\"\"\"\n\n\ndef min_cost_sort(A):\n \"\"\"Sort list A in ascending order.\n And return the switching cost in sorting.\n \"\"\"\n B = list(A)\n B.sort()\n cost = 0\n min_w = B[0]\n for i, b in enumerate(B):\n tmp_cost = 0\n bi = A.index(b)\n n = 1\n while bi != i:\n n += 1\n st = B[bi]\n si = A.index(st)\n tmp_cost += b + st\n A[bi], A[si] = st, b\n bi = si\n dec = (n - 1) * (b - min_w)\n inc = 2 * (min_w + b)\n if dec < inc:\n cost += tmp_cost\n else:\n cost += tmp_cost - dec + inc\n return cost\n\n\nn = eval(input())\nA = list(map(int, input().split()))\nans = min_cost_sort(A)\nprint(ans)\n","code_v1_no_empty_lines":"\"\"\"Minimum cost Sort.\"\"\"\n\n\ndef min_cost_sort(A):\n \"\"\"Sort list A in ascending order.\n And return the switching cost in sorting.\n \"\"\"\n B = list(A)\n B.sort()\n cost = 0\n min_w = B[0]\n for i, b in enumerate(B):\n tmp_cost = 0\n bi = A.index(b)\n cnt = 0\n while bi != i:\n cnt += 1\n st = B[bi]\n si = A.index(st)\n tmp_cost += b + st\n A[bi], A[si] = st, b\n bi = si\n if cnt:\n dec = cnt * (b - min_w)\n inc = 2 * (min_w + b)\n if dec < inc:\n cost += tmp_cost\n else:\n cost += tmp_cost - dec + inc\n return cost\n\n\nn = eval(input())\nA = list(map(int, input().split()))\nans = min_cost_sort(A)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":2.5641025641,"diff":["- n = 1","+ cnt = 0","- n += 1","+ cnt += 1","- dec = (n - 1) * (b - min_w)","- inc = 2 * (min_w + b)","- if dec < inc:","- cost += tmp_cost","- else:","- cost += tmp_cost - dec + inc","+ if cnt:","+ dec = cnt * (b - min_w)","+ inc = 2 * (min_w + b)","+ if dec < inc:","+ cost += tmp_cost","+ else:","+ cost += tmp_cost - dec + inc"],"diff_only_import_comment":false,"measured_runtime_v0":0.3540196879,"measured_runtime_v1":0.1982511323,"runtime_lift":1.7857133208,"key":["s595158290","s757741528"]} +{"user_id":"u328364772","problem_id":"p02982","language":"python","submission_id_v0":"s700480138","submission_id_v1":"s244745375","cpu_time_v0":164,"cpu_time_v1":17,"memory_v0":13336,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.63,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nimport numpy as np\n\n\n\nn, d = list(map(int, input().split()))\n\n\n\nx = np.zeros([n, d])\n\n\n\nfor i in range(n):\n\n line = list(map(int, input().split()))\n\n for j in range(d):\n\n x[i, j] = line[j]\n\n\n\ncnt = 0\n\n\n\nfor i in range(n):\n\n for j in range(i+1, n):\n\n xx = (x[i] - x[j]) ** 2\n\n dist = math.sqrt(xx.sum())\n\n if dist % 1 == 0:\n\n cnt += 1\n\n\n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"import math\n\n\n\nn, d = list(map(int, input().split()))\n\n\n\nx = [list(map(int, input().split())) for i in range(n)]\n\n\n\ncnt = 0\n\n\n\nfor i in range(n):\n\n for j in range(i+1, n):\n\n dist = 0\n\n for k in range(d):\n\n dist += (x[i][k] - x[j][k]) ** 2\n\n if math.sqrt(dist).is_integer():\n\n cnt += 1\n\n\n\nprint(cnt)","code_v0_loc":22,"code_v1_loc":17,"code_v0_num_chars":402,"code_v1_num_chars":338,"code_v0_no_empty_lines":"import math\nimport numpy as np\n\nn, d = list(map(int, input().split()))\nx = np.zeros([n, d])\nfor i in range(n):\n line = list(map(int, input().split()))\n for j in range(d):\n x[i, j] = line[j]\ncnt = 0\nfor i in range(n):\n for j in range(i + 1, n):\n xx = (x[i] - x[j]) ** 2\n dist = math.sqrt(xx.sum())\n if dist % 1 == 0:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"import math\n\nn, d = list(map(int, input().split()))\nx = [list(map(int, input().split())) for i in range(n)]\ncnt = 0\nfor i in range(n):\n for j in range(i + 1, n):\n dist = 0\n for k in range(d):\n dist += (x[i][k] - x[j][k]) ** 2\n if math.sqrt(dist).is_integer():\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":22.7272727273,"diff":["-import numpy as np","-x = np.zeros([n, d])","-for i in range(n):","- line = list(map(int, input().split()))","- for j in range(d):","- x[i, j] = line[j]","+x = [list(map(int, input().split())) for i in range(n)]","- xx = (x[i] - x[j]) ** 2","- dist = math.sqrt(xx.sum())","- if dist % 1 == 0:","+ dist = 0","+ for k in range(d):","+ dist += (x[i][k] - x[j][k]) ** 2","+ if math.sqrt(dist).is_integer():"],"diff_only_import_comment":false,"measured_runtime_v0":1.5958364801,"measured_runtime_v1":0.2940665908,"runtime_lift":5.4267860753,"key":["s700480138","s244745375"]} +{"user_id":"u811436126","problem_id":"p02555","language":"python","submission_id_v0":"s082576202","submission_id_v1":"s465570710","cpu_time_v0":367,"cpu_time_v1":30,"memory_v0":9988,"memory_v1":9128,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.83,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom functools import lru_cache\n\nimport sys\n\n\n\nsys.setrecursionlimit(2000)\n\n\n\ns = int(eval(input()))\n\nmod = 10 ** 9 + 7\n\n\n\n\n\n@lru_cache(maxsize=None)\n\ndef dfs(n):\n\n if n <= 2:\n\n return 0\n\n elif 3<=n<=5:\n\n return 1\n\n else:\n\n count = 1\n\n for i in range(3, n + 1):\n\n count += dfs(n - i)\n\n count %= mod\n\n\n\n return count % mod\n\n\n\n\n\nans = dfs(s)\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"s = int(eval(input()))\n\nmod = 10 ** 9 + 7\n\n\n\ndp = [0] * (s + 1)\n\ndp[0] = 1\n\n\n\nx = 0\n\nfor i in range(3, s + 1):\n\n x += dp[i - 3]\n\n dp[i] = x % mod\n\n\n\nans = dp[s] % mod\n\nprint(ans)\n","code_v0_loc":26,"code_v1_loc":13,"code_v0_num_chars":412,"code_v1_num_chars":179,"code_v0_no_empty_lines":"from functools import lru_cache\nimport sys\n\nsys.setrecursionlimit(2000)\ns = int(eval(input()))\nmod = 10**9 + 7\n\n\n@lru_cache(maxsize=None)\ndef dfs(n):\n if n <= 2:\n return 0\n elif 3 <= n <= 5:\n return 1\n else:\n count = 1\n for i in range(3, n + 1):\n count += dfs(n - i)\n count %= mod\n return count % mod\n\n\nans = dfs(s)\nprint(ans)\n","code_v1_no_empty_lines":"s = int(eval(input()))\nmod = 10**9 + 7\ndp = [0] * (s + 1)\ndp[0] = 1\nx = 0\nfor i in range(3, s + 1):\n x += dp[i - 3]\n dp[i] = x % mod\nans = dp[s] % mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-from functools import lru_cache","-import sys","-","-sys.setrecursionlimit(2000)","-","-","-@lru_cache(maxsize=None)","-def dfs(n):","- if n <= 2:","- return 0","- elif 3 <= n <= 5:","- return 1","- else:","- count = 1","- for i in range(3, n + 1):","- count += dfs(n - i)","- count %= mod","- return count % mod","-","-","-ans = dfs(s)","+dp = [0] * (s + 1)","+dp[0] = 1","+x = 0","+for i in range(3, s + 1):","+ x += dp[i - 3]","+ dp[i] = x % mod","+ans = dp[s] % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.5571973288,"measured_runtime_v1":0.21483691,"runtime_lift":2.593582866,"key":["s082576202","s465570710"]} +{"user_id":"u820560680","problem_id":"p03457","language":"python","submission_id_v0":"s760019873","submission_id_v1":"s278197966","cpu_time_v0":899,"cpu_time_v1":539,"memory_v0":38664,"memory_v1":36444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.04,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nplan = np.array([[0, 0, 0]] + [list(map(int, input().split())) for i in range(N)])\n\n\n\ndiff = np.diff(plan, axis = 0)\n\n\n\ndef is_possible(t, x, y):\n\n if (t + x + y) % 2 == 0 and abs(x) + abs(y) <= t:\n\n return True\n\n else:\n\n return False\n\n\n\nfor i in range(N):\n\n ti, xi, yi = diff[i]\n\n if not is_possible(ti, xi, yi):\n\n print('No')\n\n exit()\n\nprint('Yes')\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nplan = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]\n\ndiff = [[plan[i + 1][j] - plan[i][j] for j in range(3)] for i in range(N)]\n\n\n\ndef is_possible(t, x, y):\n\n if (t + x + y) % 2 == 0 and abs(x) + abs(y) <= t:\n\n return True\n\n else:\n\n return False\n\n\n\nfor i in range(N):\n\n ti, xi, yi = diff[i]\n\n if not is_possible(ti, xi, yi):\n\n print('No')\n\n exit()\n\nprint('Yes')","code_v0_loc":18,"code_v1_loc":16,"code_v0_num_chars":428,"code_v1_num_chars":440,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nplan = np.array([[0, 0, 0]] + [list(map(int, input().split())) for i in range(N)])\ndiff = np.diff(plan, axis=0)\n\n\ndef is_possible(t, x, y):\n if (t + x + y) % 2 == 0 and abs(x) + abs(y) <= t:\n return True\n else:\n return False\n\n\nfor i in range(N):\n ti, xi, yi = diff[i]\n if not is_possible(ti, xi, yi):\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nplan = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]\ndiff = [[plan[i + 1][j] - plan[i][j] for j in range(3)] for i in range(N)]\n\n\ndef is_possible(t, x, y):\n if (t + x + y) % 2 == 0 and abs(x) + abs(y) <= t:\n return True\n else:\n return False\n\n\nfor i in range(N):\n ti, xi, yi = diff[i]\n if not is_possible(ti, xi, yi):\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-import numpy as np","-","-plan = np.array([[0, 0, 0]] + [list(map(int, input().split())) for i in range(N)])","-diff = np.diff(plan, axis=0)","+plan = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]","+diff = [[plan[i + 1][j] - plan[i][j] for j in range(3)] for i in range(N)]"],"diff_only_import_comment":false,"measured_runtime_v0":1.4244329751,"measured_runtime_v1":0.2356190042,"runtime_lift":6.0454927205,"key":["s760019873","s278197966"]} +{"user_id":"u599114793","problem_id":"p03721","language":"python","submission_id_v0":"s168629717","submission_id_v1":"s331365181","cpu_time_v0":827,"cpu_time_v1":370,"memory_v0":54036,"memory_v1":83348,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.26,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,k = list(map(int,input().split()))\n\nnum = 0\n\nq = []\n\nfor i in range(n):\n\n a,b = list(map(int,input().split()))\n\n q.append((a,b))\n\nq.sort()\n\nfor i in range(n):\n\n a, b = q[i][0], q[i][1]\n\n num += b\n\n if num >= k:\n\n print(a)\n\n exit()\n\n\n\n\n# optimized version of the same code:\n","target":"n,k = list(map(int,input().split()))\n\ncnt = 0\n\nnum = []\n\nfor i in range(n):\n\n a,b = list(map(int,input().split()))\n\n num.append((a,b))\n\nnum.sort()\n\nfor i in range(n):\n\n cnt += num[i][1]\n\n if cnt >= k:\n\n print((num[i][0]))\n\n exit()","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":252,"code_v1_num_chars":242,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nnum = 0\nq = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n q.append((a, b))\nq.sort()\nfor i in range(n):\n a, b = q[i][0], q[i][1]\n num += b\n if num >= k:\n print(a)\n exit()\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\ncnt = 0\nnum = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n num.append((a, b))\nnum.sort()\nfor i in range(n):\n cnt += num[i][1]\n if cnt >= k:\n print((num[i][0]))\n exit()\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-num = 0","-q = []","+cnt = 0","+num = []","- q.append((a, b))","-q.sort()","+ num.append((a, b))","+num.sort()","- a, b = q[i][0], q[i][1]","- num += b","- if num >= k:","- print(a)","+ cnt += num[i][1]","+ if cnt >= k:","+ print((num[i][0]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3024329725,"measured_runtime_v1":0.2289340452,"runtime_lift":1.3210484801,"key":["s168629717","s331365181"]} +{"user_id":"u047796752","problem_id":"p03197","language":"python","submission_id_v0":"s531607176","submission_id_v1":"s450058032","cpu_time_v0":356,"cpu_time_v1":241,"memory_v0":49496,"memory_v1":43868,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.3,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\ndef dfs(x, y):\n\n if x==0 and y==0:\n\n t[x][y] = False\n\n return False\n\n \n\n if x>=1:\n\n t[x][y] |= not dfs(x-1, y)\n\n \n\n if y>=1:\n\n t[x][y] |= not dfs(x, y-1)\n\n \n\n if min(x, y)>=1:\n\n t[x][y] |= not dfs(x-1, y-1)\n\n \n\n return t[x][y]\n\n \n\nt = [[False]*7 for _ in range(7)]\n\n\n\nfor i in range(7):\n\n for j in range(7):\n\n dfs(i, j)\n\n\n\n\"\"\"\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(eval(input()))\n\nflag = True\n\n\n\nfor _ in range(N):\n\n a = int(eval(input()))\n\n \n\n if a%2==1:\n\n flag = False\n\n \n\nif flag:\n\n print('second')\n\nelse:\n\n print('first')\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\n\"\"\"\n\ndef dfs(x, y):\n\n if x==0 and y==0:\n\n return False\n\n \n\n res = False\n\n \n\n if x>0:\n\n res |= not dfs(x-1, y)\n\n \n\n if y>0:\n\n res |= not dfs(x, y-1)\n\n \n\n if min(x, y)>0:\n\n res |= not dfs(x-1, y-1)\n\n \n\n return res\n\n \n\nt = [[False]*5 for _ in range(5)]\n\n\n\nfor i in range(5):\n\n for j in range(5):\n\n t[i][j] = dfs(i, j)\n\n\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(eval(input()))\n\na = [int(eval(input())) for _ in range(N)]\n\n\n\nfor ai in a:\n\n if ai%2==1:\n\n print('first')\n\n exit()\n\n\n\nprint('second')","code_v0_loc":44,"code_v1_loc":40,"code_v0_num_chars":701,"code_v1_num_chars":621,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\n\ndef dfs(x, y):\n if x == 0 and y == 0:\n t[x][y] = False\n return False\n if x >= 1:\n t[x][y] |= not dfs(x - 1, y)\n if y >= 1:\n t[x][y] |= not dfs(x, y - 1)\n if min(x, y) >= 1:\n t[x][y] |= not dfs(x - 1, y - 1)\n return t[x][y]\n\n\nt = [[False] * 7 for _ in range(7)]\nfor i in range(7):\n for j in range(7):\n dfs(i, j)\n\"\"\"\nfor ti in t:\n print(*ti)\n\"\"\"\nN = int(eval(input()))\nflag = True\nfor _ in range(N):\n a = int(eval(input()))\n if a % 2 == 1:\n flag = False\nif flag:\n print(\"second\")\nelse:\n print(\"first\")\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\"\"\"\ndef dfs(x, y):\n if x==0 and y==0:\n return False\n res = False\n if x>0:\n res |= not dfs(x-1, y)\n if y>0:\n res |= not dfs(x, y-1)\n if min(x, y)>0:\n res |= not dfs(x-1, y-1)\n return res\nt = [[False]*5 for _ in range(5)]\nfor i in range(5):\n for j in range(5):\n t[i][j] = dfs(i, j)\nfor ti in t:\n print(*ti)\n\"\"\"\nN = int(eval(input()))\na = [int(eval(input())) for _ in range(N)]\nfor ai in a:\n if ai % 2 == 1:\n print(\"first\")\n exit()\nprint(\"second\")\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-from collections import *","-","-","+\"\"\"","- if x == 0 and y == 0:","- t[x][y] = False","+ if x==0 and y==0:","- if x >= 1:","- t[x][y] |= not dfs(x - 1, y)","- if y >= 1:","- t[x][y] |= not dfs(x, y - 1)","- if min(x, y) >= 1:","- t[x][y] |= not dfs(x - 1, y - 1)","- return t[x][y]","-","-","-t = [[False] * 7 for _ in range(7)]","-for i in range(7):","- for j in range(7):","- dfs(i, j)","-\"\"\"","+ res = False","+ if x>0:","+ res |= not dfs(x-1, y)","+ if y>0:","+ res |= not dfs(x, y-1)","+ if min(x, y)>0:","+ res |= not dfs(x-1, y-1)","+ return res","+t = [[False]*5 for _ in range(5)]","+for i in range(5):","+ for j in range(5):","+ t[i][j] = dfs(i, j)","-flag = True","-for _ in range(N):","- a = int(eval(input()))","- if a % 2 == 1:","- flag = False","-if flag:","- print(\"second\")","-else:","- print(\"first\")","+a = [int(eval(input())) for _ in range(N)]","+for ai in a:","+ if ai % 2 == 1:","+ print(\"first\")","+ exit()","+print(\"second\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.4127988609,"measured_runtime_v1":0.1956315268,"runtime_lift":2.1100835213,"key":["s531607176","s450058032"]} +{"user_id":"u094191970","problem_id":"p03416","language":"python","submission_id_v0":"s196951264","submission_id_v1":"s755826464","cpu_time_v0":127,"cpu_time_v1":57,"memory_v0":2940,"memory_v1":9184,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.12,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b=list(map(int, input().split()))\n\ncnt=0\n\nfor i in range(a,b+1):\n\n n=list(str(i))\n\n if n==list(reversed(n)):\n\n cnt+=1\n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"from sys import stdin\n\nnii=lambda:list(map(int,stdin.readline().split()))\n\nlnii=lambda:list(map(int,stdin.readline().split()))\n\n\n\na,b=nii()\n\nans=0\n\nfor i in range(a,b+1):\n\n s=str(i)\n\n if s==s[::-1]:\n\n ans+=1\n\n\n\nprint(ans)","code_v0_loc":7,"code_v1_loc":12,"code_v0_num_chars":138,"code_v1_num_chars":220,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(a, b + 1):\n n = list(str(i))\n if n == list(reversed(n)):\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"from sys import stdin\n\nnii = lambda: list(map(int, stdin.readline().split()))\nlnii = lambda: list(map(int, stdin.readline().split()))\na, b = nii()\nans = 0\nfor i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["-a, b = list(map(int, input().split()))","-cnt = 0","+from sys import stdin","+","+nii = lambda: list(map(int, stdin.readline().split()))","+lnii = lambda: list(map(int, stdin.readline().split()))","+a, b = nii()","+ans = 0","- n = list(str(i))","- if n == list(reversed(n)):","- cnt += 1","-print(cnt)","+ s = str(i)","+ if s == s[::-1]:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4537812017,"measured_runtime_v1":0.1270140123,"runtime_lift":3.5726861437,"key":["s196951264","s755826464"]} +{"user_id":"u046187684","problem_id":"p03416","language":"python","submission_id_v0":"s340270167","submission_id_v1":"s097893502","cpu_time_v0":67,"cpu_time_v1":60,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.45,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b = list(map(int, input().strip().split(\" \")))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\nprint(count)\n\n\n# optimized version of the same code:\n","target":"def solve(string):\n\n a, b = list(map(int, string.split()))\n\n count = 0\n\n for i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\n return str(count)\n\n\n\n\n\nif __name__ == '__main__':\n\n print((solve(eval(input()))))\n","code_v0_loc":6,"code_v1_loc":11,"code_v0_num_chars":148,"code_v1_num_chars":244,"code_v0_no_empty_lines":"a, b = list(map(int, input().strip().split(\" \")))\ncount = 0\nfor i in range(a, b + 1):\n if str(i) == str(i)[::-1]:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"def solve(string):\n a, b = list(map(int, string.split()))\n count = 0\n for i in range(a, b + 1):\n if str(i) == str(i)[::-1]:\n count += 1\n return str(count)\n\n\nif __name__ == \"__main__\":\n print((solve(eval(input()))))\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-a, b = list(map(int, input().strip().split(\" \")))","-count = 0","-for i in range(a, b + 1):","- if str(i) == str(i)[::-1]:","- count += 1","-print(count)","+def solve(string):","+ a, b = list(map(int, string.split()))","+ count = 0","+ for i in range(a, b + 1):","+ if str(i) == str(i)[::-1]:","+ count += 1","+ return str(count)","+","+","+if __name__ == \"__main__\":","+ print((solve(eval(input()))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2889559059,"measured_runtime_v1":0.2039610577,"runtime_lift":1.4167209624,"key":["s340270167","s097893502"]} +{"user_id":"u257162238","problem_id":"p02624","language":"python","submission_id_v0":"s814809556","submission_id_v1":"s037607801","cpu_time_v0":1856,"cpu_time_v1":667,"memory_v0":151556,"memory_v1":108988,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.06,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nfrom collections import Counter\n\nimport numpy as np\n\nfrom numba import njit\n\n\n\n\n\ndef read():\n\n N = int(input().strip())\n\n return N,\n\n\n\n\n\n@njit\n\ndef f(n):\n\n \"\"\"\n\n \u7d04\u6570\u306e\u500b\u6570\u3092\u6c42\u3081\u308b\n\n \"\"\"\n\n ndivs = np.ones((n+1), dtype=np.int32)\n\n for i in range(2, n+1):\n\n for j in range(i, n+1, i):\n\n ndivs[j] += 1\n\n return ndivs\n\n\n\n\n\n@njit\n\ndef solve(N):\n\n fn = f(N)\n\n ans = 0\n\n for k in range(1, N+1):\n\n ans += k * fn[k]\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n inputs = read()\n\n outputs = solve(*inputs)\n\n if outputs is not None:\n\n print((\"%s\" % str(outputs)))\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\nimport numpy as np\n\nfrom numba import njit\n\n\n\n\n\ndef read():\n\n N = int(input().strip())\n\n return N,\n\n\n\n\n\n@njit\n\ndef solve(N):\n\n ndivs = 0\n\n for i in range(1, N+1):\n\n for j in range(i, N+1, i):\n\n ndivs += j\n\n return ndivs\n\n\n\n\n\nif __name__ == '__main__':\n\n inputs = read()\n\n outputs = solve(*inputs)\n\n if outputs is not None:\n\n print((\"%s\" % str(outputs)))\n","code_v0_loc":38,"code_v1_loc":25,"code_v0_num_chars":660,"code_v1_num_chars":441,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom collections import Counter\nimport numpy as np\nfrom numba import njit\n\n\ndef read():\n N = int(input().strip())\n return (N,)\n\n\n@njit\ndef f(n):\n \"\"\"\n \u7d04\u6570\u306e\u500b\u6570\u3092\u6c42\u3081\u308b\n \"\"\"\n ndivs = np.ones((n + 1), dtype=np.int32)\n for i in range(2, n + 1):\n for j in range(i, n + 1, i):\n ndivs[j] += 1\n return ndivs\n\n\n@njit\ndef solve(N):\n fn = f(N)\n ans = 0\n for k in range(1, N + 1):\n ans += k * fn[k]\n return ans\n\n\nif __name__ == \"__main__\":\n inputs = read()\n outputs = solve(*inputs)\n if outputs is not None:\n print((\"%s\" % str(outputs)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nimport numpy as np\nfrom numba import njit\n\n\ndef read():\n N = int(input().strip())\n return (N,)\n\n\n@njit\ndef solve(N):\n ndivs = 0\n for i in range(1, N + 1):\n for j in range(i, N + 1, i):\n ndivs += j\n return ndivs\n\n\nif __name__ == \"__main__\":\n inputs = read()\n outputs = solve(*inputs)\n if outputs is not None:\n print((\"%s\" % str(outputs)))\n","code_same":false,"relative_loc_diff_percent":34.2105263158,"diff":["-from collections import Counter","-def f(n):","- \"\"\"","- \u7d04\u6570\u306e\u500b\u6570\u3092\u6c42\u3081\u308b","- \"\"\"","- ndivs = np.ones((n + 1), dtype=np.int32)","- for i in range(2, n + 1):","- for j in range(i, n + 1, i):","- ndivs[j] += 1","+def solve(N):","+ ndivs = 0","+ for i in range(1, N + 1):","+ for j in range(i, N + 1, i):","+ ndivs += j","-","-","-@njit","-def solve(N):","- fn = f(N)","- ans = 0","- for k in range(1, N + 1):","- ans += k * fn[k]","- return ans"],"diff_only_import_comment":false,"measured_runtime_v0":0.4968368752,"measured_runtime_v1":0.1134250557,"runtime_lift":4.3803097288,"key":["s814809556","s037607801"]} +{"user_id":"u581187895","problem_id":"p02881","language":"python","submission_id_v0":"s424797203","submission_id_v1":"s436835790","cpu_time_v0":169,"cpu_time_v1":116,"memory_v0":29000,"memory_v1":3464,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.36,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# a+b-2\n\n# N = a*b \u3088\u3063\u3066N\u306e\u7d04\u6570\u3092\u6c42\u3081\u308b\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nU = 10**6+100\n\nx = np.arange(1, U, dtype=np.int64)\n\ndiv = x[N%x==0]\n\nans = (div + N\/\/div).min() - 2\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10 ** 7)\n\nread = sys.stdin.buffer.read \n\ninput = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines \n\n\n\ndef make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append((i, n\/\/i))\n\n \n\n # divisors.sort()\n\n return divisors\n\n\n\nN = int(eval(input()))\n\ndiv = make_divisors(N)\n\n\n\nans = 10**15\n\nfor a, b in div:\n\n ans = min(ans, a+b-2)\n\nprint(ans) \n\n\n","code_v0_loc":10,"code_v1_loc":23,"code_v0_num_chars":184,"code_v1_num_chars":475,"code_v0_no_empty_lines":"# a+b-2\n# N = a*b \u3088\u3063\u3066N\u306e\u7d04\u6570\u3092\u6c42\u3081\u308b\nimport numpy as np\n\nN = int(eval(input()))\nU = 10**6 + 100\nx = np.arange(1, U, dtype=np.int64)\ndiv = x[N % x == 0]\nans = (div + N \/\/ div).min() - 2\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nread = sys.stdin.buffer.read\ninput = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append((i, n \/\/ i))\n # divisors.sort()\n return divisors\n\n\nN = int(eval(input()))\ndiv = make_divisors(N)\nans = 10**15\nfor a, b in div:\n ans = min(ans, a + b - 2)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":56.5217391304,"diff":["-# a+b-2","-# N = a*b \u3088\u3063\u3066N\u306e\u7d04\u6570\u3092\u6c42\u3081\u308b","-import numpy as np","+import sys","+","+sys.setrecursionlimit(10**7)","+read = sys.stdin.buffer.read","+input = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+","+","+def make_divisors(n):","+ divisors = []","+ for i in range(1, int(n**0.5) + 1):","+ if n % i == 0:","+ divisors.append((i, n \/\/ i))","+ # divisors.sort()","+ return divisors","+","-U = 10**6 + 100","-x = np.arange(1, U, dtype=np.int64)","-div = x[N % x == 0]","-ans = (div + N \/\/ div).min() - 2","+div = make_divisors(N)","+ans = 10**15","+for a, b in div:","+ ans = min(ans, a + b - 2)"],"diff_only_import_comment":false,"measured_runtime_v0":1.7032481675,"measured_runtime_v1":0.2399272685,"runtime_lift":7.099018707,"key":["s424797203","s436835790"]} +{"user_id":"u254871849","problem_id":"p02994","language":"python","submission_id_v0":"s625520179","submission_id_v1":"s190948033","cpu_time_v0":151,"cpu_time_v1":17,"memory_v0":12488,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np \n\n\n\nn, l = list(map(int, sys.stdin.readline().split()))\n\n\n\ndef main():\n\n f = l + np.arange(1, n+1) - 1\n\n s = f.sum()\n\n a = np.absolute(f)\n\n mi = np.amin(a)\n\n i = np.argwhere(a == mi)[0, 0]\n\n return s - f[i]\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nn, l = list(map(int, sys.stdin.readline().split()))\n\n\n\ndef main():\n\n s = (l - 1) * n + (1 + n) * n \/\/ 2\n\n res = []\n\n for i in range(1, n+1):\n\n f = l + i - 1\n\n res.append((abs(f), s - f))\n\n \n\n res.sort()\n\n return res[0][1]\n\n\n\nif __name__=='__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":313,"code_v1_num_chars":323,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nn, l = list(map(int, sys.stdin.readline().split()))\n\n\ndef main():\n f = l + np.arange(1, n + 1) - 1\n s = f.sum()\n a = np.absolute(f)\n mi = np.amin(a)\n i = np.argwhere(a == mi)[0, 0]\n return s - f[i]\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_v1_no_empty_lines":"import sys\n\nn, l = list(map(int, sys.stdin.readline().split()))\n\n\ndef main():\n s = (l - 1) * n + (1 + n) * n \/\/ 2\n res = []\n for i in range(1, n + 1):\n f = l + i - 1\n res.append((abs(f), s - f))\n res.sort()\n return res[0][1]\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-import numpy as np","- f = l + np.arange(1, n + 1) - 1","- s = f.sum()","- a = np.absolute(f)","- mi = np.amin(a)","- i = np.argwhere(a == mi)[0, 0]","- return s - f[i]","+ s = (l - 1) * n + (1 + n) * n \/\/ 2","+ res = []","+ for i in range(1, n + 1):","+ f = l + i - 1","+ res.append((abs(f), s - f))","+ res.sort()","+ return res[0][1]"],"diff_only_import_comment":false,"measured_runtime_v0":1.3280655489,"measured_runtime_v1":0.2091949449,"runtime_lift":6.3484590879,"key":["s625520179","s190948033"]} +{"user_id":"u580697892","problem_id":"p02982","language":"python","submission_id_v0":"s380388533","submission_id_v1":"s555933357","cpu_time_v0":150,"cpu_time_v1":20,"memory_v0":12412,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# coding: utf-8\n\nimport numpy as np\n\nn, d = list(map(int, input().split()))\n\ncnt = 0\n\nX = []\n\nfor i in range(n):\n\n x = list(map(int, input().split()))\n\n X.append(x[:])\n\nX = np.array(X)\n\nfor i in range(n):\n\n X_tmp = X[:]\n\n X_tmp -= X[i]\n\n for i in range(n):\n\n x = X_tmp[i]\n\n x_sq = x**2\n\n x_sq = np.sqrt(sum(x_sq))\n\n if x_sq % 1 == 0:\n\n cnt += 1\n\nprint(((cnt-n)\/\/2))\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nN, D = list(map(int, input().split()))\n\nX = []\n\nans = 0\n\nfor i in range(N):\n\n X.append(list(map(int, input().split())))\n\nfor i in range(N):\n\n for j in range(N):\n\n dist = 0\n\n if i == j:\n\n continue\n\n for d in range(D):\n\n dist += ((X[i][d] - X[j][d])**2)\n\n if dist**0.5 == int(dist**0.5):\n\n ans += 1\n\nprint((ans\/\/2))","code_v0_loc":19,"code_v1_loc":16,"code_v0_num_chars":411,"code_v1_num_chars":389,"code_v0_no_empty_lines":"# coding: utf-8\nimport numpy as np\n\nn, d = list(map(int, input().split()))\ncnt = 0\nX = []\nfor i in range(n):\n x = list(map(int, input().split()))\n X.append(x[:])\nX = np.array(X)\nfor i in range(n):\n X_tmp = X[:]\n X_tmp -= X[i]\n for i in range(n):\n x = X_tmp[i]\n x_sq = x**2\n x_sq = np.sqrt(sum(x_sq))\n if x_sq % 1 == 0:\n cnt += 1\nprint(((cnt - n) \/\/ 2))\n","code_v1_no_empty_lines":"# coding: utf-8\nN, D = list(map(int, input().split()))\nX = []\nans = 0\nfor i in range(N):\n X.append(list(map(int, input().split())))\nfor i in range(N):\n for j in range(N):\n dist = 0\n if i == j:\n continue\n for d in range(D):\n dist += (X[i][d] - X[j][d]) ** 2\n if dist**0.5 == int(dist**0.5):\n ans += 1\nprint((ans \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-import numpy as np","-","-n, d = list(map(int, input().split()))","-cnt = 0","+N, D = list(map(int, input().split()))","-for i in range(n):","- x = list(map(int, input().split()))","- X.append(x[:])","-X = np.array(X)","-for i in range(n):","- X_tmp = X[:]","- X_tmp -= X[i]","- for i in range(n):","- x = X_tmp[i]","- x_sq = x**2","- x_sq = np.sqrt(sum(x_sq))","- if x_sq % 1 == 0:","- cnt += 1","-print(((cnt - n) \/\/ 2))","+ans = 0","+for i in range(N):","+ X.append(list(map(int, input().split())))","+for i in range(N):","+ for j in range(N):","+ dist = 0","+ if i == j:","+ continue","+ for d in range(D):","+ dist += (X[i][d] - X[j][d]) ** 2","+ if dist**0.5 == int(dist**0.5):","+ ans += 1","+print((ans \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3454763293,"measured_runtime_v1":0.2011937041,"runtime_lift":6.6874673593,"key":["s380388533","s555933357"]} +{"user_id":"u228223940","problem_id":"p02647","language":"python","submission_id_v0":"s621197357","submission_id_v1":"s626568623","cpu_time_v0":912,"cpu_time_v1":246,"memory_v0":179240,"memory_v1":155944,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport copy\n\nn,k = list(map(int,input().split()))\n\nai = [int(i) for i in input().split()]\n\n\n\nold_ai = ai\n\ncnt = 0\n\n\n\nwhile 1 == 1:\n\n old_ai = copy.deepcopy(ai)\n\n li = [0]*(n+1)\n\n for i in range(n):\n\n li[max(0,i-ai[i])] += 1\n\n li[min(n,i+1+ai[i])] -= 1\n\n #print(li)\n\n #print(li)\n\n tmp = 0\n\n for i in range(n):\n\n if i == 0:\n\n ai[i] = li[i]\n\n tmp += ai[i]\n\n else:\n\n ai[i] = li[i] + ai[i-1]\n\n tmp += ai[i]\n\n #print(rui)\n\n if ai == old_ai:\n\n print((*ai))\n\n exit()\n\n break\n\n cnt += 1\n\n if cnt == k:\n\n print((*ai))\n\n exit()\n\n old_ai = ai\n\n# optimized version of the same code:\n","target":"import copy\n\nn,k = list(map(int,input().split()))\n\nai = [int(i) for i in input().split()]\n\n\n\n#old_ai = ai\n\ncnt = 0\n\nold_tmp = sum(ai)\n\n\n\nwhile 1 == 1:\n\n #old_ai = copy.deepcopy(ai)\n\n li = [0]*(n+1)\n\n for i in range(n):\n\n li[max(0,i-ai[i])] += 1\n\n li[min(n,i+1+ai[i])] -= 1\n\n #print(li)\n\n #print(li)\n\n tmp = 0\n\n for i in range(n):\n\n if i == 0:\n\n ai[i] = li[i]\n\n tmp += ai[i]\n\n else:\n\n ai[i] = li[i] + ai[i-1]\n\n tmp += ai[i]\n\n #print(rui)\n\n if old_tmp == tmp:\n\n print((*ai))\n\n exit()\n\n break\n\n cnt += 1\n\n if cnt == k:\n\n print((*ai))\n\n exit()\n\n old_tmp = tmp","code_v0_loc":33,"code_v1_loc":34,"code_v0_num_chars":667,"code_v1_num_chars":692,"code_v0_no_empty_lines":"import copy\n\nn, k = list(map(int, input().split()))\nai = [int(i) for i in input().split()]\nold_ai = ai\ncnt = 0\nwhile 1 == 1:\n old_ai = copy.deepcopy(ai)\n li = [0] * (n + 1)\n for i in range(n):\n li[max(0, i - ai[i])] += 1\n li[min(n, i + 1 + ai[i])] -= 1\n # print(li)\n # print(li)\n tmp = 0\n for i in range(n):\n if i == 0:\n ai[i] = li[i]\n tmp += ai[i]\n else:\n ai[i] = li[i] + ai[i - 1]\n tmp += ai[i]\n # print(rui)\n if ai == old_ai:\n print((*ai))\n exit()\n break\n cnt += 1\n if cnt == k:\n print((*ai))\n exit()\n old_ai = ai\n","code_v1_no_empty_lines":"import copy\n\nn, k = list(map(int, input().split()))\nai = [int(i) for i in input().split()]\n# old_ai = ai\ncnt = 0\nold_tmp = sum(ai)\nwhile 1 == 1:\n # old_ai = copy.deepcopy(ai)\n li = [0] * (n + 1)\n for i in range(n):\n li[max(0, i - ai[i])] += 1\n li[min(n, i + 1 + ai[i])] -= 1\n # print(li)\n # print(li)\n tmp = 0\n for i in range(n):\n if i == 0:\n ai[i] = li[i]\n tmp += ai[i]\n else:\n ai[i] = li[i] + ai[i - 1]\n tmp += ai[i]\n # print(rui)\n if old_tmp == tmp:\n print((*ai))\n exit()\n break\n cnt += 1\n if cnt == k:\n print((*ai))\n exit()\n old_tmp = tmp\n","code_same":false,"relative_loc_diff_percent":2.9411764706,"diff":["-old_ai = ai","+# old_ai = ai","+old_tmp = sum(ai)","- old_ai = copy.deepcopy(ai)","+ # old_ai = copy.deepcopy(ai)","- if ai == old_ai:","+ if old_tmp == tmp:","- old_ai = ai","+ old_tmp = tmp"],"diff_only_import_comment":false,"measured_runtime_v0":0.2951365216,"measured_runtime_v1":0.2292118037,"runtime_lift":1.2876148472,"key":["s621197357","s626568623"]} +{"user_id":"u952708174","problem_id":"p03078","language":"python","submission_id_v0":"s922291815","submission_id_v1":"s412525457","cpu_time_v0":717,"cpu_time_v1":455,"memory_v0":194972,"memory_v1":129708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.54,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef d_cake_123_binary_search(X, Y, Z, K, A, B, C):\n\n # editional\u306e\u89e3\u6cd54 O(K^2log(max(P))\n\n # \u53c2\u8003: https:\/\/atcoder.jp\/contests\/abc123\/submissions\/4871511\n\n import bisect\n\n ab = sorted([e1 + e2 for e2 in B for e1 in A]) # A, B\u306e\u8981\u7d20\u306f\u5168\u90e8\u8abf\u3079\u308b\n\n\n\n # rejected \u4ee5\u4e0a\u306e\u5024\u306f\u3001\u7f8e\u5473\u3057\u3055\u306e\u5408\u8a08\u304c\u305d\u308c\u4ee5\u4e0a\u3067\u3042\u308b\u500b\u6570\u304cK\u500b\u672a\u6e80\u3067\u3042\u308b\n\n accepted, rejected = -1, 10**11\n\n while abs(accepted - rejected) > 1:\n\n mid = (accepted + rejected) \/\/ 2\n\n count = sum([len(ab) - bisect.bisect_left(ab, mid - e) for e in C])\n\n if count >= K:\n\n accepted = mid\n\n else:\n\n rejected = mid\n\n\n\n ans = []\n\n for e in C:\n\n idx = bisect.bisect_left(ab, accepted - e)\n\n for i in range(idx, len(ab)):\n\n ans.append(e + ab[i])\n\n ans.sort(reverse=True)\n\n return '\\n'.join(map(str, ans[:K]))\n\n\n\nX, Y, Z, K = [int(i) for i in input().split()]\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\nC = [int(i) for i in input().split()]\n\nprint((d_cake_123_binary_search(X, Y, Z, K, A, B, C)))\n\n# optimized version of the same code:\n","target":"def d_cake_123_sort_modified():\n\n \"\"\"editorial \u306e\u89e3\u6cd5 1.\"\"\"\n\n import sys\n\n import numpy as np\n\n input = sys.stdin.readline\n\n X, Y, Z, K = [int(i) for i in input().split()]\n\n A = np.array([int(i) for i in input().split()])\n\n B = np.array([int(i) for i in input().split()])\n\n C = np.array([int(i) for i in input().split()])\n\n\n\n _a, _b = np.meshgrid(A, B)\n\n ab = np.sort((_a + _b).flatten())[::-1][:K]\n\n _ab, _c = np.meshgrid(ab, C)\n\n ans = np.sort((_ab + _c).flatten())[::-1][:K]\n\n return '\\n'.join(map(str, ans))\n\n\n\nprint((d_cake_123_sort_modified()))","code_v0_loc":29,"code_v1_loc":17,"code_v0_num_chars":1033,"code_v1_num_chars":584,"code_v0_no_empty_lines":"def d_cake_123_binary_search(X, Y, Z, K, A, B, C):\n # editional\u306e\u89e3\u6cd54 O(K^2log(max(P))\n # \u53c2\u8003: https:\/\/atcoder.jp\/contests\/abc123\/submissions\/4871511\n import bisect\n\n ab = sorted([e1 + e2 for e2 in B for e1 in A]) # A, B\u306e\u8981\u7d20\u306f\u5168\u90e8\u8abf\u3079\u308b\n # rejected \u4ee5\u4e0a\u306e\u5024\u306f\u3001\u7f8e\u5473\u3057\u3055\u306e\u5408\u8a08\u304c\u305d\u308c\u4ee5\u4e0a\u3067\u3042\u308b\u500b\u6570\u304cK\u500b\u672a\u6e80\u3067\u3042\u308b\n accepted, rejected = -1, 10**11\n while abs(accepted - rejected) > 1:\n mid = (accepted + rejected) \/\/ 2\n count = sum([len(ab) - bisect.bisect_left(ab, mid - e) for e in C])\n if count >= K:\n accepted = mid\n else:\n rejected = mid\n ans = []\n for e in C:\n idx = bisect.bisect_left(ab, accepted - e)\n for i in range(idx, len(ab)):\n ans.append(e + ab[i])\n ans.sort(reverse=True)\n return \"\\n\".join(map(str, ans[:K]))\n\n\nX, Y, Z, K = [int(i) for i in input().split()]\nA = [int(i) for i in input().split()]\nB = [int(i) for i in input().split()]\nC = [int(i) for i in input().split()]\nprint((d_cake_123_binary_search(X, Y, Z, K, A, B, C)))\n","code_v1_no_empty_lines":"def d_cake_123_sort_modified():\n \"\"\"editorial \u306e\u89e3\u6cd5 1.\"\"\"\n import sys\n import numpy as np\n\n input = sys.stdin.readline\n X, Y, Z, K = [int(i) for i in input().split()]\n A = np.array([int(i) for i in input().split()])\n B = np.array([int(i) for i in input().split()])\n C = np.array([int(i) for i in input().split()])\n _a, _b = np.meshgrid(A, B)\n ab = np.sort((_a + _b).flatten())[::-1][:K]\n _ab, _c = np.meshgrid(ab, C)\n ans = np.sort((_ab + _c).flatten())[::-1][:K]\n return \"\\n\".join(map(str, ans))\n\n\nprint((d_cake_123_sort_modified()))\n","code_same":false,"relative_loc_diff_percent":41.3793103448,"diff":["-def d_cake_123_binary_search(X, Y, Z, K, A, B, C):","- # editional\u306e\u89e3\u6cd54 O(K^2log(max(P))","- # \u53c2\u8003: https:\/\/atcoder.jp\/contests\/abc123\/submissions\/4871511","- import bisect","+def d_cake_123_sort_modified():","+ \"\"\"editorial \u306e\u89e3\u6cd5 1.\"\"\"","+ import sys","+ import numpy as np","- ab = sorted([e1 + e2 for e2 in B for e1 in A]) # A, B\u306e\u8981\u7d20\u306f\u5168\u90e8\u8abf\u3079\u308b","- # rejected \u4ee5\u4e0a\u306e\u5024\u306f\u3001\u7f8e\u5473\u3057\u3055\u306e\u5408\u8a08\u304c\u305d\u308c\u4ee5\u4e0a\u3067\u3042\u308b\u500b\u6570\u304cK\u500b\u672a\u6e80\u3067\u3042\u308b","- accepted, rejected = -1, 10**11","- while abs(accepted - rejected) > 1:","- mid = (accepted + rejected) \/\/ 2","- count = sum([len(ab) - bisect.bisect_left(ab, mid - e) for e in C])","- if count >= K:","- accepted = mid","- else:","- rejected = mid","- ans = []","- for e in C:","- idx = bisect.bisect_left(ab, accepted - e)","- for i in range(idx, len(ab)):","- ans.append(e + ab[i])","- ans.sort(reverse=True)","- return \"\\n\".join(map(str, ans[:K]))","+ input = sys.stdin.readline","+ X, Y, Z, K = [int(i) for i in input().split()]","+ A = np.array([int(i) for i in input().split()])","+ B = np.array([int(i) for i in input().split()])","+ C = np.array([int(i) for i in input().split()])","+ _a, _b = np.meshgrid(A, B)","+ ab = np.sort((_a + _b).flatten())[::-1][:K]","+ _ab, _c = np.meshgrid(ab, C)","+ ans = np.sort((_ab + _c).flatten())[::-1][:K]","+ return \"\\n\".join(map(str, ans))","-X, Y, Z, K = [int(i) for i in input().split()]","-A = [int(i) for i in input().split()]","-B = [int(i) for i in input().split()]","-C = [int(i) for i in input().split()]","-print((d_cake_123_binary_search(X, Y, Z, K, A, B, C)))","+print((d_cake_123_sort_modified()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1953599396,"measured_runtime_v1":0.0065046697,"runtime_lift":30.0337986858,"key":["s922291815","s412525457"]} +{"user_id":"u257974487","problem_id":"p03796","language":"python","submission_id_v0":"s235320519","submission_id_v1":"s032021754","cpu_time_v0":230,"cpu_time_v1":40,"memory_v0":3980,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nN = int(eval(input()))\n\np = math.factorial(N)\n\nprint((p % 1000000007))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\np = 1\n\nfor i in range(1,N+1):\n\n p *= i\n\n p %= 1000000007\n\nprint(p)\n","code_v0_loc":4,"code_v1_loc":6,"code_v0_num_chars":75,"code_v1_num_chars":91,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\np = math.factorial(N)\nprint((p % 1000000007))\n","code_v1_no_empty_lines":"N = int(eval(input()))\np = 1\nfor i in range(1, N + 1):\n p *= i\n p %= 1000000007\nprint(p)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-import math","-","-p = math.factorial(N)","-print((p % 1000000007))","+p = 1","+for i in range(1, N + 1):","+ p *= i","+ p %= 1000000007","+print(p)"],"diff_only_import_comment":false,"measured_runtime_v0":0.768677109,"measured_runtime_v1":0.410683428,"runtime_lift":1.8717022808,"key":["s235320519","s032021754"]} +{"user_id":"u577170763","problem_id":"p03608","language":"python","submission_id_v0":"s067652861","submission_id_v1":"s587574381","cpu_time_v0":1958,"cpu_time_v1":443,"memory_v0":17188,"memory_v1":48088,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":77.37,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport itertools\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\nN, M, R = list(map(int, input().split()))\n\nr = tuple(map(int, input().split()))\n\n\n\nINF = 10**10\n\n\n\nd = [[INF] * N for _ in range(N)]\n\n\n\nfor i in range(N):\n\n d[i][i] = 0\n\n\n\nfor _ in range(M):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n if d[a][b] > c:\n\n d[a][b] = c\n\n d[b][a] = c\n\n\n\n\n\ndef warshall(d):\n\n for k in range(N):\n\n for i in range(N):\n\n for j in range(N):\n\n if d[i][j] > d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\n\n\n# d = floyd_warshall(d)\n\nwarshall(d)\n\n\n\n\n\nans = INF\n\nfor p in itertools.permutations(r):\n\n dist = 0\n\n for i in range(R-1):\n\n dist += d[p[i]-1][p[i+1]-1]\n\n\n\n if ans > dist:\n\n ans = dist\n\n\n\nprint((int(ans)))\n\n# optimized version of the same code:\n","target":"import itertools\n\n\n\nN, M, R = list(map(int, input().split()))\n\nr = tuple(map(int, input().split()))\n\n\n\nINF = 10**10\n\n\n\nd = [[INF] * N for _ in range(N)]\n\n\n\nfor i in range(N):\n\n d[i][i] = 0\n\n\n\nfor _ in range(M):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n if d[a][b] > c:\n\n d[a][b] = c\n\n d[b][a] = c\n\n\n\n\n\ndef warshall(d):\n\n for k in range(N):\n\n for i in range(N):\n\n for j in range(N):\n\n if d[i][j] > d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\n\n\n# d = floyd_warshall(d)\n\nwarshall(d)\n\n\n\n\n\nans = INF\n\nfor p in itertools.permutations(r):\n\n dist = 0\n\n for i in range(R-1):\n\n dist += d[p[i]-1][p[i+1]-1]\n\n\n\n if ans > dist:\n\n ans = dist\n\n\n\nprint((int(ans)))\n","code_v0_loc":44,"code_v1_loc":43,"code_v0_num_chars":820,"code_v1_num_chars":772,"code_v0_no_empty_lines":"import itertools\nfrom scipy.sparse.csgraph import floyd_warshall\n\nN, M, R = list(map(int, input().split()))\nr = tuple(map(int, input().split()))\nINF = 10**10\nd = [[INF] * N for _ in range(N)]\nfor i in range(N):\n d[i][i] = 0\nfor _ in range(M):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n if d[a][b] > c:\n d[a][b] = c\n d[b][a] = c\n\n\ndef warshall(d):\n for k in range(N):\n for i in range(N):\n for j in range(N):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\n\n\n# d = floyd_warshall(d)\nwarshall(d)\nans = INF\nfor p in itertools.permutations(r):\n dist = 0\n for i in range(R - 1):\n dist += d[p[i] - 1][p[i + 1] - 1]\n if ans > dist:\n ans = dist\nprint((int(ans)))\n","code_v1_no_empty_lines":"import itertools\n\nN, M, R = list(map(int, input().split()))\nr = tuple(map(int, input().split()))\nINF = 10**10\nd = [[INF] * N for _ in range(N)]\nfor i in range(N):\n d[i][i] = 0\nfor _ in range(M):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n if d[a][b] > c:\n d[a][b] = c\n d[b][a] = c\n\n\ndef warshall(d):\n for k in range(N):\n for i in range(N):\n for j in range(N):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\n\n\n# d = floyd_warshall(d)\nwarshall(d)\nans = INF\nfor p in itertools.permutations(r):\n dist = 0\n for i in range(R - 1):\n dist += d[p[i] - 1][p[i + 1] - 1]\n if ans > dist:\n ans = dist\nprint((int(ans)))\n","code_same":false,"relative_loc_diff_percent":2.2727272727,"diff":["-from scipy.sparse.csgraph import floyd_warshall"],"diff_only_import_comment":false,"measured_runtime_v0":0.2044888918,"measured_runtime_v1":0.0065318277,"runtime_lift":31.3065349069,"key":["s067652861","s587574381"]} +{"user_id":"u381572531","problem_id":"p02891","language":"python","submission_id_v0":"s581989830","submission_id_v1":"s729822755","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(eval(input()))\n\n \n\ndef check_count(s):\n\n cnt_list = [1]\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt_list[-1] += 1\n\n else:\n\n cnt_list.append(1)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c\/\/2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k\/\/2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)\/\/2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(eval(input()))\n\n\n\ndef check_count(s):\n\n cnt_list = []\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt += 1\n\n else:\n\n cnt_list.append(cnt)\n\n cnt = 1\n\n if cnt>1:\n\n cnt_list.append(cnt)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c\/\/2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k\/\/2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)\/\/2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)","code_v0_loc":35,"code_v1_loc":38,"code_v0_num_chars":711,"code_v1_num_chars":765,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\ns = input().rstrip()\nk = int(eval(input()))\n\n\ndef check_count(s):\n cnt_list = [1]\n cnt = 1\n for i in range(1, len(s)):\n if s[i - 1] == s[i]:\n cnt_list[-1] += 1\n else:\n cnt_list.append(1)\n return cnt_list\n\n\ndef calc_ans(cnt_list, k):\n _ans = 0\n for c in cnt_list:\n _ans += c \/\/ 2\n return _ans * k\n\n\nif len(s) == 1:\n ans = k \/\/ 2\nelse:\n cnt_list = check_count(s)\n if len(cnt_list) == 1:\n ans = (len(s) * k) \/\/ 2\n else:\n ans = calc_ans(cnt_list, k)\n if s[0] == s[-1]:\n if cnt_list[0] % 2 == 1 and cnt_list[-1] % 2 == 1:\n ans += k - 1\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\ns = input().rstrip()\nk = int(eval(input()))\n\n\ndef check_count(s):\n cnt_list = []\n cnt = 1\n for i in range(1, len(s)):\n if s[i - 1] == s[i]:\n cnt += 1\n else:\n cnt_list.append(cnt)\n cnt = 1\n if cnt > 1:\n cnt_list.append(cnt)\n return cnt_list\n\n\ndef calc_ans(cnt_list, k):\n _ans = 0\n for c in cnt_list:\n _ans += c \/\/ 2\n return _ans * k\n\n\nif len(s) == 1:\n ans = k \/\/ 2\nelse:\n cnt_list = check_count(s)\n if len(cnt_list) == 1:\n ans = (len(s) * k) \/\/ 2\n else:\n ans = calc_ans(cnt_list, k)\n if s[0] == s[-1]:\n if cnt_list[0] % 2 == 1 and cnt_list[-1] % 2 == 1:\n ans += k - 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.8947368421,"diff":["- cnt_list = [1]","+ cnt_list = []","- cnt_list[-1] += 1","+ cnt += 1","- cnt_list.append(1)","+ cnt_list.append(cnt)","+ cnt = 1","+ if cnt > 1:","+ cnt_list.append(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3312115214,"measured_runtime_v1":0.249056649,"runtime_lift":1.3298642006,"key":["s581989830","s729822755"]} +{"user_id":"u706929073","problem_id":"p02881","language":"python","submission_id_v0":"s504662720","submission_id_v1":"s470778572","cpu_time_v0":504,"cpu_time_v1":137,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\n\n\n\n\ndef dist(i, j):\n\n return i + j - 2\n\n\n\n\n\nmin = 10 ** 24\n\ni = 1\n\nwhile (i ** 2) <= N:\n\n if 0 == N % i:\n\n j = N \/\/ i\n\n d = dist(i, j)\n\n if min > d:\n\n min = d\n\n i += 1\n\nprint(d)\n\n\n# optimized version of the same code:\n","target":"import math\n\nn = int(eval(input()))\n\n\n\nans = 0\n\nfor i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:\n\n if 0 == n % i:\n\n ans = i\n\n break\n\nans_partner = n \/\/ ans\n\nprint((ans + ans_partner - 2))\n","code_v0_loc":17,"code_v1_loc":10,"code_v0_num_chars":237,"code_v1_num_chars":200,"code_v0_no_empty_lines":"N = int(eval(input()))\n\n\ndef dist(i, j):\n return i + j - 2\n\n\nmin = 10**24\ni = 1\nwhile (i**2) <= N:\n if 0 == N % i:\n j = N \/\/ i\n d = dist(i, j)\n if min > d:\n min = d\n i += 1\nprint(d)\n","code_v1_no_empty_lines":"import math\n\nn = int(eval(input()))\nans = 0\nfor i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:\n if 0 == n % i:\n ans = i\n break\nans_partner = n \/\/ ans\nprint((ans + ans_partner - 2))\n","code_same":false,"relative_loc_diff_percent":41.1764705882,"diff":["-N = int(eval(input()))","+import math","-","-def dist(i, j):","- return i + j - 2","-","-","-min = 10**24","-i = 1","-while (i**2) <= N:","- if 0 == N % i:","- j = N \/\/ i","- d = dist(i, j)","- if min > d:","- min = d","- i += 1","-print(d)","+n = int(eval(input()))","+ans = 0","+for i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:","+ if 0 == n % i:","+ ans = i","+ break","+ans_partner = n \/\/ ans","+print((ans + ans_partner - 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.327980933,"measured_runtime_v1":0.2062122526,"runtime_lift":1.5905016738,"key":["s504662720","s470778572"]} +{"user_id":"u127499732","problem_id":"p02690","language":"python","submission_id_v0":"s520089371","submission_id_v1":"s515596030","cpu_time_v0":35,"cpu_time_v1":29,"memory_v0":9048,"memory_v1":9104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.14,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n x = int(eval(input()))\n\n for i in range(150, 0, -1):\n\n for j in range(i, -150, -1):\n\n cal = i ** 5 - j ** 5\n\n if cal == x:\n\n print((i, j))\n\n exit()\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n x = int(eval(input()))\n\n for i in range(120):\n\n for j in range(i, -i, -1):\n\n cal = i ** 5 - j ** 5\n\n if cal == x:\n\n print((i, j))\n\n exit()\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":263,"code_v1_num_chars":254,"code_v0_no_empty_lines":"def main():\n x = int(eval(input()))\n for i in range(150, 0, -1):\n for j in range(i, -150, -1):\n cal = i**5 - j**5\n if cal == x:\n print((i, j))\n exit()\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n x = int(eval(input()))\n for i in range(120):\n for j in range(i, -i, -1):\n cal = i**5 - j**5\n if cal == x:\n print((i, j))\n exit()\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for i in range(150, 0, -1):","- for j in range(i, -150, -1):","+ for i in range(120):","+ for j in range(i, -i, -1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.3632839104,"measured_runtime_v1":0.2308181783,"runtime_lift":1.5738964456,"key":["s520089371","s515596030"]} +{"user_id":"u222668979","problem_id":"p02552","language":"python","submission_id_v0":"s235847366","submission_id_v1":"s896909207","cpu_time_v0":81,"cpu_time_v1":70,"memory_v0":61596,"memory_v1":61788,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.58,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nprint((1 if n == 0 else 0))\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nprint((0 if n else 1))\n","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":44,"code_v1_num_chars":39,"code_v0_no_empty_lines":"n = int(eval(input()))\nprint((1 if n == 0 else 0))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nprint((0 if n else 1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((1 if n == 0 else 0))","+print((0 if n else 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.340472885,"measured_runtime_v1":0.2658090671,"runtime_lift":1.2808926674,"key":["s235847366","s896909207"]} +{"user_id":"u564589929","problem_id":"p02792","language":"python","submission_id_v0":"s828672272","submission_id_v1":"s142357126","cpu_time_v0":836,"cpu_time_v1":221,"memory_v0":14044,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.56,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(eval(input()))\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\nimport numpy as np\n\n\n\ndef solve():\n\n n = II()\n\n D = np.zeros((10, 10))\n\n\n\n for i in range(1, n+1):\n\n s = list(str(i))\n\n l = int(s[0])\n\n r = int(s[-1])\n\n # print(s, l, r)\n\n D[l][r] += 1\n\n # print(D)\n\n\n\n ans = 0\n\n for i in range(10):\n\n for j in range(10):\n\n ans += D[i][j] * D[j][i]\n\n print((int(ans)))\n\n\n\nif __name__ == '__main__':\n\n solve()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(eval(input()))\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n n = II()\n\n D = [[0]*10 for _ in range(10)]\n\n\n\n for i in range(1, n+1):\n\n s = list(str(i))\n\n l = int(s[0])\n\n r = int(s[-1])\n\n # print(s, l, r)\n\n D[l][r] += 1\n\n # print(D)\n\n\n\n ans = 0\n\n for i in range(10):\n\n for j in range(10):\n\n ans += D[i][j] * D[j][i]\n\n print((int(ans)))\n\n\n\nif __name__ == '__main__':\n\n solve()\n","code_v0_loc":38,"code_v1_loc":36,"code_v0_num_chars":907,"code_v1_num_chars":894,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\n\n\ndef II():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MI1():\n return list(map(int1, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI1():\n return list(map(int1, input().split()))\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef printlist(lst, k=\"\\n\"):\n print((k.join(list(map(str, lst)))))\n\n\nINF = float(\"inf\")\nimport numpy as np\n\n\ndef solve():\n n = II()\n D = np.zeros((10, 10))\n for i in range(1, n + 1):\n s = list(str(i))\n l = int(s[0])\n r = int(s[-1])\n # print(s, l, r)\n D[l][r] += 1\n # print(D)\n ans = 0\n for i in range(10):\n for j in range(10):\n ans += D[i][j] * D[j][i]\n print((int(ans)))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\n\n\ndef II():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MI1():\n return list(map(int1, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI1():\n return list(map(int1, input().split()))\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef printlist(lst, k=\"\\n\"):\n print((k.join(list(map(str, lst)))))\n\n\nINF = float(\"inf\")\n\n\ndef solve():\n n = II()\n D = [[0] * 10 for _ in range(10)]\n for i in range(1, n + 1):\n s = list(str(i))\n l = int(s[0])\n r = int(s[-1])\n # print(s, l, r)\n D[l][r] += 1\n # print(D)\n ans = 0\n for i in range(10):\n for j in range(10):\n ans += D[i][j] * D[j][i]\n print((int(ans)))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-import numpy as np","- D = np.zeros((10, 10))","+ D = [[0] * 10 for _ in range(10)]"],"diff_only_import_comment":false,"measured_runtime_v0":1.6453994412,"measured_runtime_v1":0.3645976332,"runtime_lift":4.512918602,"key":["s828672272","s142357126"]} +{"user_id":"u747602774","problem_id":"p03039","language":"python","submission_id_v0":"s108635717","submission_id_v1":"s387237372","cpu_time_v0":543,"cpu_time_v1":230,"memory_v0":9432,"memory_v1":9412,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)\/\/2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)\/\/2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n ans += f1(x,y,n,m)+f1(1,1,x,y)+f1(1,y,x,m)+f1(x,1,n,y)\n\n ans -= f2(x,n) + f2(1,x) + f2(1,y) + f2(y,m)\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)\/\/2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)\/\/2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)\/\/2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n","code_v0_loc":38,"code_v1_loc":42,"code_v0_num_chars":796,"code_v1_num_chars":809,"code_v0_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) \/\/ 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) \/\/ 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n ans += f1(x, y, n, m) + f1(1, 1, x, y) + f1(1, y, x, m) + f1(x, 1, n, y)\n ans -= f2(x, n) + f2(1, x) + f2(1, y) + f2(y, m)\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) \/\/ 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) \/\/ 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n a = n - x + 1\n b = m - y + 1\n c = m * (a * (a - 1) + x * (x - 1))\n d = n * (b * (b - 1) + y * (y - 1))\n ans += (c + d) \/\/ 2\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.5238095238,"diff":["- ans += f1(x, y, n, m) + f1(1, 1, x, y) + f1(1, y, x, m) + f1(x, 1, n, y)","- ans -= f2(x, n) + f2(1, x) + f2(1, y) + f2(y, m)","+ a = n - x + 1","+ b = m - y + 1","+ c = m * (a * (a - 1) + x * (x - 1))","+ d = n * (b * (b - 1) + y * (y - 1))","+ ans += (c + d) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.4582999928,"measured_runtime_v1":0.3618569455,"runtime_lift":1.2665225816,"key":["s108635717","s387237372"]} +{"user_id":"u952708174","problem_id":"p02596","language":"python","submission_id_v0":"s416996588","submission_id_v1":"s856754977","cpu_time_v0":161,"cpu_time_v1":106,"memory_v0":9088,"memory_v1":9192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef c_repsept():\n\n K = int(eval(input()))\n\n\n\n if (K % 2 == 0 or K % 5 == 0):\n\n return -1 # repsept \u306e\u56e0\u6570\u306b 2, 5 \u306f\u306a\u3044\n\n\n\n repsept = 7 % K\n\n count = 1\n\n while repsept % K !=0:\n\n repsept = ((repsept * 10) + 7) % K\n\n count += 1\n\n return count\n\n\n\nprint((c_repsept()))\n\n# optimized version of the same code:\n","target":"def c_repsept():\n\n K = int(eval(input()))\n\n\n\n L = 9 * K \/\/ 7 if K % 7 == 0 else 9 * K\n\n if L % 2 == 0 or L % 5 == 0:\n\n return -1\n\n\n\n remainder = 1\n\n for n in range(1, L + 1):\n\n remainder = (10 * remainder) % L\n\n if remainder == 1:\n\n return n\n\n return -1\n\n\n\nprint((c_repsept()))","code_v0_loc":14,"code_v1_loc":15,"code_v0_num_chars":290,"code_v1_num_chars":319,"code_v0_no_empty_lines":"def c_repsept():\n K = int(eval(input()))\n if K % 2 == 0 or K % 5 == 0:\n return -1 # repsept \u306e\u56e0\u6570\u306b 2, 5 \u306f\u306a\u3044\n repsept = 7 % K\n count = 1\n while repsept % K != 0:\n repsept = ((repsept * 10) + 7) % K\n count += 1\n return count\n\n\nprint((c_repsept()))\n","code_v1_no_empty_lines":"def c_repsept():\n K = int(eval(input()))\n L = 9 * K \/\/ 7 if K % 7 == 0 else 9 * K\n if L % 2 == 0 or L % 5 == 0:\n return -1\n remainder = 1\n for n in range(1, L + 1):\n remainder = (10 * remainder) % L\n if remainder == 1:\n return n\n return -1\n\n\nprint((c_repsept()))\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["- if K % 2 == 0 or K % 5 == 0:","- return -1 # repsept \u306e\u56e0\u6570\u306b 2, 5 \u306f\u306a\u3044","- repsept = 7 % K","- count = 1","- while repsept % K != 0:","- repsept = ((repsept * 10) + 7) % K","- count += 1","- return count","+ L = 9 * K \/\/ 7 if K % 7 == 0 else 9 * K","+ if L % 2 == 0 or L % 5 == 0:","+ return -1","+ remainder = 1","+ for n in range(1, L + 1):","+ remainder = (10 * remainder) % L","+ if remainder == 1:","+ return n","+ return -1"],"diff_only_import_comment":false,"measured_runtime_v0":0.4354579542,"measured_runtime_v1":0.338304636,"runtime_lift":1.2871770228,"key":["s416996588","s856754977"]} +{"user_id":"u821588465","problem_id":"p02886","language":"python","submission_id_v0":"s336470673","submission_id_v1":"s316957674","cpu_time_v0":117,"cpu_time_v1":30,"memory_v0":27116,"memory_v1":9044,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.36,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom itertools import combinations\n\nimport numpy as np\n\nN = int(eval(input()))\n\nD = list(map(int, input().split()))\n\nList = np.array(list(combinations(D,2)))\n\nprint((sum(np.product(List, axis = 1))))\n\n\n\n\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nD = list(map(int, input().split()))\n\nfrom itertools import accumulate\n\nprint((sum(list(d*c for d, c in zip(D[1:], accumulate(D))))))\n","code_v0_loc":8,"code_v1_loc":4,"code_v0_num_chars":196,"code_v1_num_chars":149,"code_v0_no_empty_lines":"from itertools import combinations\nimport numpy as np\n\nN = int(eval(input()))\nD = list(map(int, input().split()))\nList = np.array(list(combinations(D, 2)))\nprint((sum(np.product(List, axis=1))))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nD = list(map(int, input().split()))\nfrom itertools import accumulate\n\nprint((sum(list(d * c for d, c in zip(D[1:], accumulate(D))))))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-from itertools import combinations","-import numpy as np","-","-List = np.array(list(combinations(D, 2)))","-print((sum(np.product(List, axis=1))))","+from itertools import accumulate","+","+print((sum(list(d * c for d, c in zip(D[1:], accumulate(D))))))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3450187897,"measured_runtime_v1":0.2237710453,"runtime_lift":6.0106918118,"key":["s336470673","s316957674"]} +{"user_id":"u827885761","problem_id":"p03013","language":"python","submission_id_v0":"s193052587","submission_id_v1":"s829443238","cpu_time_v0":509,"cpu_time_v1":195,"memory_v0":46168,"memory_v1":7668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.69,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\n\n\nl = [0] * (n+1)\n\nl[0] = 1\n\n\n\na = 0\n\nif m != 0:\n\n a = int(eval(input()))\n\nk = 1\n\nfor i in range(n+1):\n\n\n\n if i != a:\n\n if i == 1:\n\n l[i] = 1\n\n elif i >= 2:\n\n l[i] = l[i-1] + l[i-2]\n\n l[i] %= 1000000007\n\n else:\n\n k += 1\n\n if k <= m:\n\n a = int(eval(input()))\n\n\n\n\n\n\n\n#print(l)\n\nprint((l[n] % 1000000007))\n\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\na = [1] * (n+1)\n\nfor i in range(m):\n\n a[int(eval(input()))] = 0\n\nk = [0] * (n+1)\n\nk[0] = 1\n\nfor i in range(1,n+1):\n\n if i == 1 and a[1]:\n\n k[1] = 1\n\n elif i >= 2 and a[i]:\n\n k[i] = k[i-1] + k[i-2]\n\n k[i] %= 10 ** 9 + 7\n\n\n\nprint((k[n]))\n","code_v0_loc":30,"code_v1_loc":18,"code_v0_num_chars":479,"code_v1_num_chars":367,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef lmi():\n return list(map(int, input().split()))\n\n\nn, m = lmi()\nl = [0] * (n + 1)\nl[0] = 1\na = 0\nif m != 0:\n a = int(eval(input()))\nk = 1\nfor i in range(n + 1):\n if i != a:\n if i == 1:\n l[i] = 1\n elif i >= 2:\n l[i] = l[i - 1] + l[i - 2]\n l[i] %= 1000000007\n else:\n k += 1\n if k <= m:\n a = int(eval(input()))\n# print(l)\nprint((l[n] % 1000000007))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef lmi():\n return list(map(int, input().split()))\n\n\nn, m = lmi()\na = [1] * (n + 1)\nfor i in range(m):\n a[int(eval(input()))] = 0\nk = [0] * (n + 1)\nk[0] = 1\nfor i in range(1, n + 1):\n if i == 1 and a[1]:\n k[1] = 1\n elif i >= 2 and a[i]:\n k[i] = k[i - 1] + k[i - 2]\n k[i] %= 10**9 + 7\nprint((k[n]))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-l = [0] * (n + 1)","-l[0] = 1","-a = 0","-if m != 0:","- a = int(eval(input()))","-k = 1","-for i in range(n + 1):","- if i != a:","- if i == 1:","- l[i] = 1","- elif i >= 2:","- l[i] = l[i - 1] + l[i - 2]","- l[i] %= 1000000007","- else:","- k += 1","- if k <= m:","- a = int(eval(input()))","-# print(l)","-print((l[n] % 1000000007))","+a = [1] * (n + 1)","+for i in range(m):","+ a[int(eval(input()))] = 0","+k = [0] * (n + 1)","+k[0] = 1","+for i in range(1, n + 1):","+ if i == 1 and a[1]:","+ k[1] = 1","+ elif i >= 2 and a[i]:","+ k[i] = k[i - 1] + k[i - 2]","+ k[i] %= 10**9 + 7","+print((k[n]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3120539634,"measured_runtime_v1":0.1110639279,"runtime_lift":2.8096787978,"key":["s193052587","s829443238"]} +{"user_id":"u952708174","problem_id":"p02767","language":"python","submission_id_v0":"s118619526","submission_id_v1":"s336379737","cpu_time_v0":387,"cpu_time_v1":17,"memory_v0":21724,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef c_rally():\n\n import numpy as np\n\n import math\n\n N = int(eval(input()))\n\n X = [int(i) for i in input().split()]\n\n m = np.average(X)\n\n ans = float('inf')\n\n for j in (math.floor(m), math.ceil(m)):\n\n ans = min(ans, sum([(x - j)**2 for x in X]))\n\n return ans\n\n\n\nprint((c_rally()))\n\n# optimized version of the same code:\n","target":"def c_rally():\n\n N = int(eval(input()))\n\n X = [int(i) for i in input().split()]\n\n\n\n x_sum = sum(X)\n\n option = (x_sum \/\/ N, (x_sum + N - 1) \/\/ N)\n\n return min(sum([(x - p)**2 for x in X]) for p in option)\n\n\n\nprint((c_rally()))","code_v0_loc":12,"code_v1_loc":9,"code_v0_num_chars":302,"code_v1_num_chars":232,"code_v0_no_empty_lines":"def c_rally():\n import numpy as np\n import math\n\n N = int(eval(input()))\n X = [int(i) for i in input().split()]\n m = np.average(X)\n ans = float(\"inf\")\n for j in (math.floor(m), math.ceil(m)):\n ans = min(ans, sum([(x - j) ** 2 for x in X]))\n return ans\n\n\nprint((c_rally()))\n","code_v1_no_empty_lines":"def c_rally():\n N = int(eval(input()))\n X = [int(i) for i in input().split()]\n x_sum = sum(X)\n option = (x_sum \/\/ N, (x_sum + N - 1) \/\/ N)\n return min(sum([(x - p) ** 2 for x in X]) for p in option)\n\n\nprint((c_rally()))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["- import numpy as np","- import math","-","- m = np.average(X)","- ans = float(\"inf\")","- for j in (math.floor(m), math.ceil(m)):","- ans = min(ans, sum([(x - j) ** 2 for x in X]))","- return ans","+ x_sum = sum(X)","+ option = (x_sum \/\/ N, (x_sum + N - 1) \/\/ N)","+ return min(sum([(x - p) ** 2 for x in X]) for p in option)"],"diff_only_import_comment":false,"measured_runtime_v0":1.7275265524,"measured_runtime_v1":0.2677062051,"runtime_lift":6.4530687716,"key":["s118619526","s336379737"]} +{"user_id":"u282228874","problem_id":"p03013","language":"python","submission_id_v0":"s600331807","submission_id_v1":"s809304917","cpu_time_v0":241,"cpu_time_v1":180,"memory_v0":9592,"memory_v1":13192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.31,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,M = list(map(int,input().split()))\n\nMOD = 10**9+7\n\ndp = [0]*(N+1)\n\ndp[0]=1\n\nA = [int(eval(input())) for i in range(M)]\n\nban = [1]*(N+1)\n\nfor a in A:\n\n ban[a]=0\n\nfor i in range(N):\n\n if i-1>=0:\n\n dp[i+1]=dp[i]*ban[i]+dp[i-1]*ban[i-1]\n\n else:\n\n dp[i+1]=dp[i]*ban[i]\n\n dp[i+1] %= MOD \n\nprint((dp[N]))\n\n# optimized version of the same code:\n","target":"N,M = list(map(int,input().split()))\n\nA = [int(eval(input())) for i in range(M)]\n\nMOD = 10**9+7\n\nA = set(A)\n\ndp = [0]*(N+1)\n\ndp[0] = 1\n\nfor i in range(1,N+1):\n\n if i in A:\n\n continue\n\n if i == 1:\n\n dp[1] = dp[0]\n\n else:\n\n dp[i] = (dp[i-1]+dp[i-2])%MOD\n\nprint((dp[N]))","code_v0_loc":15,"code_v1_loc":14,"code_v0_num_chars":311,"code_v1_num_chars":283,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nMOD = 10**9 + 7\ndp = [0] * (N + 1)\ndp[0] = 1\nA = [int(eval(input())) for i in range(M)]\nban = [1] * (N + 1)\nfor a in A:\n ban[a] = 0\nfor i in range(N):\n if i - 1 >= 0:\n dp[i + 1] = dp[i] * ban[i] + dp[i - 1] * ban[i - 1]\n else:\n dp[i + 1] = dp[i] * ban[i]\n dp[i + 1] %= MOD\nprint((dp[N]))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nA = [int(eval(input())) for i in range(M)]\nMOD = 10**9 + 7\nA = set(A)\ndp = [0] * (N + 1)\ndp[0] = 1\nfor i in range(1, N + 1):\n if i in A:\n continue\n if i == 1:\n dp[1] = dp[0]\n else:\n dp[i] = (dp[i - 1] + dp[i - 2]) % MOD\nprint((dp[N]))\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["+A = [int(eval(input())) for i in range(M)]","+A = set(A)","-A = [int(eval(input())) for i in range(M)]","-ban = [1] * (N + 1)","-for a in A:","- ban[a] = 0","-for i in range(N):","- if i - 1 >= 0:","- dp[i + 1] = dp[i] * ban[i] + dp[i - 1] * ban[i - 1]","+for i in range(1, N + 1):","+ if i in A:","+ continue","+ if i == 1:","+ dp[1] = dp[0]","- dp[i + 1] = dp[i] * ban[i]","- dp[i + 1] %= MOD","+ dp[i] = (dp[i - 1] + dp[i - 2]) % MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.2076114528,"measured_runtime_v1":0.0063931749,"runtime_lift":32.4739204186,"key":["s600331807","s809304917"]} +{"user_id":"u069838609","problem_id":"p03253","language":"python","submission_id_v0":"s651142165","submission_id_v1":"s962802291","cpu_time_v0":233,"cpu_time_v1":21,"memory_v0":4408,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.99,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import sqrt, ceil, factorial\n\nfrom collections import defaultdict\n\n\n\n\n\ndef prime_factors(n):\n\n i = 2\n\n factors = defaultdict(int)\n\n while i * i <= n:\n\n if n % i:\n\n i += 1\n\n else:\n\n n \/\/= i\n\n factors[i] += 1\n\n if n > 1:\n\n factors[n] += 1\n\n return factors\n\n\n\n\n\nN, M = [int(elem) for elem in input().split(' ')]\n\n\n\n# \u7d20\u56e0\u6570\u5206\u89e3\n\nprime_numbers = prime_factors(M)\n\nsum = 1\n\nfac_N_m1 = factorial(N - 1)\n\n\n\nfor value in list(prime_numbers.values()):\n\n bunshi = 1\n\n saisho = value + N - 1\n\n for _ in range(value):\n\n bunshi *= saisho\n\n saisho -= 1\n\n sum *= (bunshi \/\/ factorial(value))\n\nprint((sum % (10**9 + 7)))\n\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\n\n\n\n\ndef prime_factorize(num):\n\n prime_numbers = defaultdict(int)\n\n i = 2\n\n while i * i <= num:\n\n if num % i == 0:\n\n while num % i == 0:\n\n prime_numbers[i] += 1\n\n num \/\/= i\n\n i += 1\n\n if num != 1:\n\n prime_numbers[num] += 1\n\n return prime_numbers\n\n\n\n\n\nMOD = 10**9 + 7\n\nN, M = [int(elem) for elem in input().split()]\n\n\n\nprime_numbers = prime_factorize(M)\n\n\n\nnum_sequences = 1\n\nfor exponent in list(prime_numbers.values()):\n\n denomimator = 1\n\n numerator = 1\n\n for i in range(1, exponent + 1):\n\n denomimator *= (N + exponent - i)\n\n numerator *= i\n\n num_sequences *= denomimator \/\/ numerator\n\n num_sequences %= MOD\n\n\n\nprint(num_sequences)\n","code_v0_loc":33,"code_v1_loc":33,"code_v0_num_chars":697,"code_v1_num_chars":770,"code_v0_no_empty_lines":"from math import sqrt, ceil, factorial\nfrom collections import defaultdict\n\n\ndef prime_factors(n):\n i = 2\n factors = defaultdict(int)\n while i * i <= n:\n if n % i:\n i += 1\n else:\n n \/\/= i\n factors[i] += 1\n if n > 1:\n factors[n] += 1\n return factors\n\n\nN, M = [int(elem) for elem in input().split(\" \")]\n# \u7d20\u56e0\u6570\u5206\u89e3\nprime_numbers = prime_factors(M)\nsum = 1\nfac_N_m1 = factorial(N - 1)\nfor value in list(prime_numbers.values()):\n bunshi = 1\n saisho = value + N - 1\n for _ in range(value):\n bunshi *= saisho\n saisho -= 1\n sum *= bunshi \/\/ factorial(value)\nprint((sum % (10**9 + 7)))\n","code_v1_no_empty_lines":"from collections import defaultdict\n\n\ndef prime_factorize(num):\n prime_numbers = defaultdict(int)\n i = 2\n while i * i <= num:\n if num % i == 0:\n while num % i == 0:\n prime_numbers[i] += 1\n num \/\/= i\n i += 1\n if num != 1:\n prime_numbers[num] += 1\n return prime_numbers\n\n\nMOD = 10**9 + 7\nN, M = [int(elem) for elem in input().split()]\nprime_numbers = prime_factorize(M)\nnum_sequences = 1\nfor exponent in list(prime_numbers.values()):\n denomimator = 1\n numerator = 1\n for i in range(1, exponent + 1):\n denomimator *= N + exponent - i\n numerator *= i\n num_sequences *= denomimator \/\/ numerator\n num_sequences %= MOD\nprint(num_sequences)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-from math import sqrt, ceil, factorial","-def prime_factors(n):","+def prime_factorize(num):","+ prime_numbers = defaultdict(int)","- factors = defaultdict(int)","- while i * i <= n:","- if n % i:","- i += 1","- else:","- n \/\/= i","- factors[i] += 1","- if n > 1:","- factors[n] += 1","- return factors","+ while i * i <= num:","+ if num % i == 0:","+ while num % i == 0:","+ prime_numbers[i] += 1","+ num \/\/= i","+ i += 1","+ if num != 1:","+ prime_numbers[num] += 1","+ return prime_numbers","-N, M = [int(elem) for elem in input().split(\" \")]","-# \u7d20\u56e0\u6570\u5206\u89e3","-prime_numbers = prime_factors(M)","-sum = 1","-fac_N_m1 = factorial(N - 1)","-for value in list(prime_numbers.values()):","- bunshi = 1","- saisho = value + N - 1","- for _ in range(value):","- bunshi *= saisho","- saisho -= 1","- sum *= bunshi \/\/ factorial(value)","-print((sum % (10**9 + 7)))","+MOD = 10**9 + 7","+N, M = [int(elem) for elem in input().split()]","+prime_numbers = prime_factorize(M)","+num_sequences = 1","+for exponent in list(prime_numbers.values()):","+ denomimator = 1","+ numerator = 1","+ for i in range(1, exponent + 1):","+ denomimator *= N + exponent - i","+ numerator *= i","+ num_sequences *= denomimator \/\/ numerator","+ num_sequences %= MOD","+print(num_sequences)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3638904934,"measured_runtime_v1":0.1944270425,"runtime_lift":1.8716043238,"key":["s651142165","s962802291"]} +{"user_id":"u562935282","problem_id":"p03371","language":"python","submission_id_v0":"s471284270","submission_id_v1":"s058926350","cpu_time_v0":98,"cpu_time_v1":81,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.35,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = 1 << 30\n\n c = 0 # even\n\n while True:\n\n j = c \/\/ 2\n\n t = A * max(0, X - j) + B * max(0, Y - j) + C * c\n\n if ans <= t: break\n\n ans = t\n\n c += 2\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":20,"code_v1_loc":17,"code_v0_num_chars":353,"code_v1_num_chars":318,"code_v0_no_empty_lines":"def main():\n A, B, AB, X, Y = list(map(int, input().split()))\n M = max(X, Y)\n k = 0\n ans = A * X + B * Y\n while True:\n ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)\n if k >= M:\n break\n k += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = 1 << 30\n c = 0 # even\n while True:\n j = c \/\/ 2\n t = A * max(0, X - j) + B * max(0, Y - j) + C * c\n if ans <= t:\n break\n ans = t\n c += 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["- A, B, AB, X, Y = list(map(int, input().split()))","- M = max(X, Y)","- k = 0","- ans = A * X + B * Y","+ A, B, C, X, Y = list(map(int, input().split()))","+ ans = 1 << 30","+ c = 0 # even","- ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)","- if k >= M:","+ j = c \/\/ 2","+ t = A * max(0, X - j) + B * max(0, Y - j) + C * c","+ if ans <= t:","- k += 1","+ ans = t","+ c += 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.3021148317,"measured_runtime_v1":0.1545656888,"runtime_lift":1.9546047633,"key":["s471284270","s058926350"]} +{"user_id":"u072053884","problem_id":"p02245","language":"python","submission_id_v0":"s696240934","submission_id_v1":"s480327836","cpu_time_v0":120,"cpu_time_v1":60,"memory_v0":10724,"memory_v1":13476,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\ninit = ''.join(sys.stdin.read().split())\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start, goal):\n\n if start == goal:\n\n return 0\n\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n\n step = {start: 0, goal: 0}\n\n s = 0\n\n c_d = [(start, 0), (goal, 1)] # configure and direction\n\n while True:\n\n q = iter(c_d)\n\n c_d = []\n\n s += 1\n\n for c, d in q:\n\n i = c.find('0')\n\n if 0 <= i <= 5:\n\n t = str.maketrans('0' + c[i+3], c[i+3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i >= 3:\n\n t = str.maketrans('0' + c[i-3], c[i-3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n\n t = str.maketrans('0' + c[i+1], c[i+1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n\n t = str.maketrans('0' + c[i-1], c[i-1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n\n\nprint((solve(init, '123456780')))\n\n# optimized version of the same code:\n","target":"adjacent = (\n\n (1, 3), # 0\n\n (0, 2, 4), # 1\n\n (1, 5), # 2\n\n (0, 4, 6), # 3\n\n (1, 3, 5, 7), # 4\n\n (2, 4, 8), # 5\n\n (3, 7), # 6\n\n (4, 6, 8), # 7\n\n (5, 7) # 8\n\n)\n\n\n\nimport collections\n\n\n\nGOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start):\n\n if start == GOAL:\n\n return 0\n\n # 0: forward, 1: backward\n\n generated_state = {tuple(start): 0, tuple(GOAL): 1}\n\n step = {tuple(start): 0, tuple(GOAL): 0}\n\n s = 0\n\n state1 = [(start, 0), (GOAL, 1)]\n\n while state1:\n\n state2 = state1[:]\n\n state1 = []\n\n s += 1\n\n for s2, d in state2:\n\n i = s2.index(0)\n\n for p in adjacent[i]:\n\n s1 = s2[:]\n\n s1[i], s1[p] = s1[p], 0\n\n key = tuple(s1)\n\n if key in generated_state:\n\n if generated_state[key] != d:\n\n return s + step[key]\n\n continue\n\n state1.append((s1, d))\n\n generated_state[key] = d\n\n step[key] = s\n\n\n\nimport sys\n\n\n\nstart = list(map(int, sys.stdin.read().split()))\n\n\n\nprint((solve(start)))","code_v0_loc":60,"code_v1_loc":48,"code_v0_num_chars":2264,"code_v1_num_chars":1231,"code_v0_no_empty_lines":"import sys\n\ninit = \"\".join(sys.stdin.read().split())\n# Bidirectional search using breadth-first search\ndef solve(start, goal):\n if start == goal:\n return 0\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n step = {start: 0, goal: 0}\n s = 0\n c_d = [(start, 0), (goal, 1)] # configure and direction\n while True:\n q = iter(c_d)\n c_d = []\n s += 1\n for c, d in q:\n i = c.find(\"0\")\n if 0 <= i <= 5:\n t = str.maketrans(\"0\" + c[i + 3], c[i + 3] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i >= 3:\n t = str.maketrans(\"0\" + c[i - 3], c[i - 3] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n t = str.maketrans(\"0\" + c[i + 1], c[i + 1] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n t = str.maketrans(\"0\" + c[i - 1], c[i - 1] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n\n\nprint((solve(init, \"123456780\")))\n","code_v1_no_empty_lines":"adjacent = (\n (1, 3), # 0\n (0, 2, 4), # 1\n (1, 5), # 2\n (0, 4, 6), # 3\n (1, 3, 5, 7), # 4\n (2, 4, 8), # 5\n (3, 7), # 6\n (4, 6, 8), # 7\n (5, 7), # 8\n)\nimport collections\n\nGOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]\n# Bidirectional search using breadth-first search\ndef solve(start):\n if start == GOAL:\n return 0\n # 0: forward, 1: backward\n generated_state = {tuple(start): 0, tuple(GOAL): 1}\n step = {tuple(start): 0, tuple(GOAL): 0}\n s = 0\n state1 = [(start, 0), (GOAL, 1)]\n while state1:\n state2 = state1[:]\n state1 = []\n s += 1\n for s2, d in state2:\n i = s2.index(0)\n for p in adjacent[i]:\n s1 = s2[:]\n s1[i], s1[p] = s1[p], 0\n key = tuple(s1)\n if key in generated_state:\n if generated_state[key] != d:\n return s + step[key]\n continue\n state1.append((s1, d))\n generated_state[key] = d\n step[key] = s\n\n\nimport sys\n\nstart = list(map(int, sys.stdin.read().split()))\nprint((solve(start)))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["+adjacent = (","+ (1, 3), # 0","+ (0, 2, 4), # 1","+ (1, 5), # 2","+ (0, 4, 6), # 3","+ (1, 3, 5, 7), # 4","+ (2, 4, 8), # 5","+ (3, 7), # 6","+ (4, 6, 8), # 7","+ (5, 7), # 8","+)","+import collections","+","+GOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]","+# Bidirectional search using breadth-first search","+def solve(start):","+ if start == GOAL:","+ return 0","+ # 0: forward, 1: backward","+ generated_state = {tuple(start): 0, tuple(GOAL): 1}","+ step = {tuple(start): 0, tuple(GOAL): 0}","+ s = 0","+ state1 = [(start, 0), (GOAL, 1)]","+ while state1:","+ state2 = state1[:]","+ state1 = []","+ s += 1","+ for s2, d in state2:","+ i = s2.index(0)","+ for p in adjacent[i]:","+ s1 = s2[:]","+ s1[i], s1[p] = s1[p], 0","+ key = tuple(s1)","+ if key in generated_state:","+ if generated_state[key] != d:","+ return s + step[key]","+ continue","+ state1.append((s1, d))","+ generated_state[key] = d","+ step[key] = s","+","+","-init = \"\".join(sys.stdin.read().split())","-# Bidirectional search using breadth-first search","-def solve(start, goal):","- if start == goal:","- return 0","- generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward","- step = {start: 0, goal: 0}","- s = 0","- c_d = [(start, 0), (goal, 1)] # configure and direction","- while True:","- q = iter(c_d)","- c_d = []","- s += 1","- for c, d in q:","- i = c.find(\"0\")","- if 0 <= i <= 5:","- t = str.maketrans(\"0\" + c[i + 3], c[i + 3] + \"0\")","- t_c = c.translate(t)","- if t_c in generated_state:","- if generated_state[t_c] != d:","- return s + step[t_c]","- else:","- generated_state[t_c] = d","- step[t_c] = s","- c_d.append((t_c, d))","- if i >= 3:","- t = str.maketrans(\"0\" + c[i - 3], c[i - 3] + \"0\")","- t_c = c.translate(t)","- if t_c in generated_state:","- if generated_state[t_c] != d:","- return s + step[t_c]","- else:","- generated_state[t_c] = d","- step[t_c] = s","- c_d.append((t_c, d))","- if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:","- t = str.maketrans(\"0\" + c[i + 1], c[i + 1] + \"0\")","- t_c = c.translate(t)","- if t_c in generated_state:","- if generated_state[t_c] != d:","- return s + step[t_c]","- else:","- generated_state[t_c] = d","- step[t_c] = s","- c_d.append((t_c, d))","- if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:","- t = str.maketrans(\"0\" + c[i - 1], c[i - 1] + \"0\")","- t_c = c.translate(t)","- if t_c in generated_state:","- if generated_state[t_c] != d:","- return s + step[t_c]","- else:","- generated_state[t_c] = d","- step[t_c] = s","- c_d.append((t_c, d))","-","-","-print((solve(init, \"123456780\")))","+start = list(map(int, sys.stdin.read().split()))","+print((solve(start)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3218115091,"measured_runtime_v1":0.2098443508,"runtime_lift":1.533572421,"key":["s696240934","s480327836"]} +{"user_id":"u034782764","problem_id":"p03434","language":"python","submission_id_v0":"s168786498","submission_id_v1":"s082866179","cpu_time_v0":149,"cpu_time_v1":17,"memory_v0":12504,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn=int(eval(input()))\n\na_list=list(map(int,input().split()))\n\na_list_2=sorted(a_list,reverse=True)\n\na=np.array(a_list_2,dtype='uint8')\n\n\n\nalice=0\n\nbob=0\n\nfor i in range(n):\n\n\tif i%2==0:\n\n\t\talice+=a[i]\n\n\telse:\n\n\t\tbob+=a[i]\n\n\n\nprint((alice-bob))\n\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\na.sort(reverse=True)\n\n\n\nalice=0\n\nbob=0\n\n\n\nfor i in range(n):\n\n if i%2==0:\n\n alice+=a[i]\n\n else:\n\n bob+=a[i]\n\n \n\nprint((alice-bob))","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":257,"code_v1_num_chars":205,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\na_list = list(map(int, input().split()))\na_list_2 = sorted(a_list, reverse=True)\na = np.array(a_list_2, dtype=\"uint8\")\nalice = 0\nbob = 0\nfor i in range(n):\n if i % 2 == 0:\n alice += a[i]\n else:\n bob += a[i]\nprint((alice - bob))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\na.sort(reverse=True)\nalice = 0\nbob = 0\nfor i in range(n):\n if i % 2 == 0:\n alice += a[i]\n else:\n bob += a[i]\nprint((alice - bob))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import numpy as np","-","-a_list = list(map(int, input().split()))","-a_list_2 = sorted(a_list, reverse=True)","-a = np.array(a_list_2, dtype=\"uint8\")","+a = list(map(int, input().split()))","+a.sort(reverse=True)"],"diff_only_import_comment":false,"measured_runtime_v0":1.7632728631,"measured_runtime_v1":0.2690178177,"runtime_lift":6.5544835577,"key":["s168786498","s082866179"]} +{"user_id":"u021019433","problem_id":"p02837","language":"python","submission_id_v0":"s456284110","submission_id_v1":"s644980365","cpu_time_v0":95,"cpu_time_v1":55,"memory_v0":6500,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef popcount(x):\n\n r, q = 0, x\n\n while x:\n\n r += 1\n\n x &= x - 1\n\n return r, q\n\n \n\nn = int(eval(input()))\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(eval(input()))):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\nl = (1 << n) - 1 \n\nb = sorted(map(popcount, list(range(1, l + 1))))\n\nans = next((i for i, x in reversed(b)\n\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)), 0)\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"from itertools import combinations, count\n\n \n\nn = int(eval(input()))\n\nr = list(range(n))\n\na = [(set(), set()) for _ in r]\n\nfor i in r:\n\n for _ in range(int(eval(input()))):\n\n x, y = list(map(int, input().split()))\n\n a[i][y].add(x - 1)\n\nr = next(i for i in count(n, - 1) for x in map(set, combinations(r, i))\n\n if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x))\n\nprint(r)\n","code_v0_loc":19,"code_v1_loc":12,"code_v0_num_chars":460,"code_v1_num_chars":369,"code_v0_no_empty_lines":"def popcount(x):\n r, q = 0, x\n while x:\n r += 1\n x &= x - 1\n return r, q\n\n\nn = int(eval(input()))\nr = list(range(n))\na = [[0, 0] for _ in r]\nfor i in r:\n for _ in range(int(eval(input()))):\n x, y = list(map(int, input().split()))\n a[i][y] |= 1 << (x - 1)\nl = (1 << n) - 1\nb = sorted(map(popcount, list(range(1, l + 1))))\nans = next(\n (\n i\n for i, x in reversed(b)\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)\n ),\n 0,\n)\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import combinations, count\n\nn = int(eval(input()))\nr = list(range(n))\na = [(set(), set()) for _ in r]\nfor i in r:\n for _ in range(int(eval(input()))):\n x, y = list(map(int, input().split()))\n a[i][y].add(x - 1)\nr = next(\n i\n for i in count(n, -1)\n for x in map(set, combinations(r, i))\n if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x)\n)\nprint(r)\n","code_same":false,"relative_loc_diff_percent":36.8421052632,"diff":["-def popcount(x):","- r, q = 0, x","- while x:","- r += 1","- x &= x - 1","- return r, q","-","+from itertools import combinations, count","-a = [[0, 0] for _ in r]","+a = [(set(), set()) for _ in r]","- a[i][y] |= 1 << (x - 1)","-l = (1 << n) - 1","-b = sorted(map(popcount, list(range(1, l + 1))))","-ans = next(","- (","- i","- for i, x in reversed(b)","- if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)","- ),","- 0,","+ a[i][y].add(x - 1)","+r = next(","+ i","+ for i in count(n, -1)","+ for x in map(set, combinations(r, i))","+ if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x)","-print(ans)","+print(r)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3135637941,"measured_runtime_v1":0.2051509681,"runtime_lift":1.5284538848,"key":["s456284110","s644980365"]} +{"user_id":"u836939578","problem_id":"p02555","language":"python","submission_id_v0":"s134270128","submission_id_v1":"s044449964","cpu_time_v0":73,"cpu_time_v1":62,"memory_v0":64852,"memory_v1":63756,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.07,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = int(eval(input()))\n\nMOD = 10 ** 9 + 7\n\n\n\n#dp[i]\u6700\u5f8c\u306b\u5207\u3063\u305f\u5834\u6240\u304ci\u3000\u30b9\u30bf\u30fc\u30c8\u304c1\u306a\u306e\u306f\u3001\u305d\u3053\u307e\u3067\u306e\u5207\u308a\u65b9\u304c1\u901a\u308a\u306a\u306e\u3067\n\n#\uff13\u4ee5\u4e0b\u306f\u30c0\u30e1\u306a\u306e\u3067\u30013\u500b\u524d\u306e\u7d50\u679c\u3092\u898b\u308b\u3088\u3046\u306b\u3059\u308b\n\ndp = [0] * (S+1)\n\ndp[0] = 1\n\n\n\nfor i in range(1, S+1):\n\n #\u305f\u3068\u3048\u3070i=6\u306e\u3068\u304d\u3001i=6\u3067\u521d\u3081\u3066\u5207\u308c\u76ee\u3092\u5165\u308c\u308b\u6642\u3067\uff0b\uff11\u3001i=3\u306b\u5207\u308c\u76ee\u3092\u3044\u308c\u308b\u3068\u304d\u3067\uff0b\uff11\u3067\u5408\u8a08\uff0b\uff12\n\n for j in range(0, (i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= MOD\n\nprint((dp[S])) \n\n# optimized version of the same code:\n","target":"S = int(eval(input()))\n\nMOD = 10 ** 9 + 7\n\n\n\n#dp[i]\u6700\u5f8c\u306b\u5207\u3063\u305f\u5834\u6240\u304ci\u3000\u30b9\u30bf\u30fc\u30c8\u304c1\u306a\u306e\u306f\u3001\u305d\u3053\u307e\u3067\u306e\u5207\u308a\u65b9\u304c1\u901a\u308a\u306a\u306e\u3067\n\n#\uff13\u4ee5\u4e0b\u306f\u30c0\u30e1\u306a\u306e\u3067\u30013\u500b\u524d\u306e\u7d50\u679c\u3092\u898b\u308b\u3088\u3046\u306b\u3059\u308b\n\ndp = [0] * (S+1)\n\ndp[0] = 1\n\n\n\n#\u3053\u308c\u307e\u3067\u306e\u548c\u3092x\u306b\u4fdd\u5b58\u3057\u3066\u304a\u304f\n\nx = 0\n\nfor i in range(1, S+1):\n\n if i-3 >= 0:\n\n x += dp[i-3]\n\n x %= MOD\n\n dp[i] = x\n\nprint((dp[S])) ","code_v0_loc":14,"code_v1_loc":16,"code_v0_num_chars":324,"code_v1_num_chars":285,"code_v0_no_empty_lines":"S = int(eval(input()))\nMOD = 10**9 + 7\n# dp[i]\u6700\u5f8c\u306b\u5207\u3063\u305f\u5834\u6240\u304ci\u3000\u30b9\u30bf\u30fc\u30c8\u304c1\u306a\u306e\u306f\u3001\u305d\u3053\u307e\u3067\u306e\u5207\u308a\u65b9\u304c1\u901a\u308a\u306a\u306e\u3067\n# \uff13\u4ee5\u4e0b\u306f\u30c0\u30e1\u306a\u306e\u3067\u30013\u500b\u524d\u306e\u7d50\u679c\u3092\u898b\u308b\u3088\u3046\u306b\u3059\u308b\ndp = [0] * (S + 1)\ndp[0] = 1\nfor i in range(1, S + 1):\n # \u305f\u3068\u3048\u3070i=6\u306e\u3068\u304d\u3001i=6\u3067\u521d\u3081\u3066\u5207\u308c\u76ee\u3092\u5165\u308c\u308b\u6642\u3067\uff0b\uff11\u3001i=3\u306b\u5207\u308c\u76ee\u3092\u3044\u308c\u308b\u3068\u304d\u3067\uff0b\uff11\u3067\u5408\u8a08\uff0b\uff12\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= MOD\nprint((dp[S]))\n","code_v1_no_empty_lines":"S = int(eval(input()))\nMOD = 10**9 + 7\n# dp[i]\u6700\u5f8c\u306b\u5207\u3063\u305f\u5834\u6240\u304ci\u3000\u30b9\u30bf\u30fc\u30c8\u304c1\u306a\u306e\u306f\u3001\u305d\u3053\u307e\u3067\u306e\u5207\u308a\u65b9\u304c1\u901a\u308a\u306a\u306e\u3067\n# \uff13\u4ee5\u4e0b\u306f\u30c0\u30e1\u306a\u306e\u3067\u30013\u500b\u524d\u306e\u7d50\u679c\u3092\u898b\u308b\u3088\u3046\u306b\u3059\u308b\ndp = [0] * (S + 1)\ndp[0] = 1\n# \u3053\u308c\u307e\u3067\u306e\u548c\u3092x\u306b\u4fdd\u5b58\u3057\u3066\u304a\u304f\nx = 0\nfor i in range(1, S + 1):\n if i - 3 >= 0:\n x += dp[i - 3]\n x %= MOD\n dp[i] = x\nprint((dp[S]))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["+# \u3053\u308c\u307e\u3067\u306e\u548c\u3092x\u306b\u4fdd\u5b58\u3057\u3066\u304a\u304f","+x = 0","- # \u305f\u3068\u3048\u3070i=6\u306e\u3068\u304d\u3001i=6\u3067\u521d\u3081\u3066\u5207\u308c\u76ee\u3092\u5165\u308c\u308b\u6642\u3067\uff0b\uff11\u3001i=3\u306b\u5207\u308c\u76ee\u3092\u3044\u308c\u308b\u3068\u304d\u3067\uff0b\uff11\u3067\u5408\u8a08\uff0b\uff12","- for j in range(0, (i - 3) + 1):","- dp[i] += dp[j]","- dp[i] %= MOD","+ if i - 3 >= 0:","+ x += dp[i - 3]","+ x %= MOD","+ dp[i] = x"],"diff_only_import_comment":false,"measured_runtime_v0":0.7110086412,"measured_runtime_v1":0.2124667544,"runtime_lift":3.3464465681,"key":["s134270128","s044449964"]} +{"user_id":"u562935282","problem_id":"p03634","language":"python","submission_id_v0":"s143869460","submission_id_v1":"s902304606","cpu_time_v0":731,"cpu_time_v1":602,"memory_v0":163764,"memory_v1":59480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.65,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# bellman_ford : O(V E)\n\n# dijkstra : O(E log V), \u8ca0\u8fba\u306f\u7121\u7406\n\n# warshall_floyd : O(V**3)\n\n\n\nimport sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef solve():\n\n inf = 10 ** 14 + 10\n\n\n\n def dfs(v: 'vertex_index, 0-indexed') -> None:\n\n for c, t in e[v]:\n\n if d[t] != inf:\n\n continue\n\n d[t] = d[v] + c\n\n dfs(t)\n\n\n\n n = int(eval(input()))\n\n e = tuple(set() for _ in range(n))\n\n for _ in range(n - 1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n e[a].add((c, b))\n\n e[b].add((c, a))\n\n\n\n q, v = list(map(int, input().split()))\n\n v -= 1\n\n\n\n d = [inf] * n\n\n d[v] = 0\n\n\n\n dfs(v)\n\n\n\n for _ in range(q):\n\n x, y = list(map(int, input().split()))\n\n x -= 1\n\n y -= 1\n\n print((d[x] + d[y]))\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n\n\n# optimized version of the same code:\n","target":"# bellman_ford : O(V E)\n\n# dijkstra : O(E log V), \u8ca0\u8fba\u306f\u7121\u7406\n\n# warshall_floyd : O(V**3)\n\n# deque\n\n\n\nfrom collections import deque\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef solve():\n\n inf = 10 ** 14 + 10\n\n\n\n n = int(eval(input()))\n\n e = tuple(set() for _ in range(n))\n\n for _ in range(n - 1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n e[a].add((c, b))\n\n e[b].add((c, a))\n\n\n\n q, v = list(map(int, input().split()))\n\n v -= 1\n\n\n\n d = [inf] * n\n\n d[v] = 0\n\n\n\n dq = deque()\n\n for cost, to in e[v]:\n\n dq.append((cost, to, v))\n\n # (cost, to, parent)\n\n\n\n while dq:\n\n c, v, p = dq.popleft()\n\n if d[v] != inf:\n\n continue\n\n d[v] = d[p] + c\n\n for cost, to in e[v]:\n\n if to == p:\n\n continue\n\n dq.append((cost, to, v))\n\n \n\n for _ in range(q):\n\n x, y = list(map(int, input().split()))\n\n x -= 1\n\n y -= 1\n\n print((d[x] + d[y]))\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","code_v0_loc":46,"code_v1_loc":53,"code_v0_num_chars":883,"code_v1_num_chars":1056,"code_v0_no_empty_lines":"# bellman_ford : O(V E)\n# dijkstra : O(E log V), \u8ca0\u8fba\u306f\u7121\u7406\n# warshall_floyd : O(V**3)\nimport sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\n\n\ndef solve():\n inf = 10**14 + 10\n\n def dfs(v: \"vertex_index, 0-indexed\") -> None:\n for c, t in e[v]:\n if d[t] != inf:\n continue\n d[t] = d[v] + c\n dfs(t)\n\n n = int(eval(input()))\n e = tuple(set() for _ in range(n))\n for _ in range(n - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n e[a].add((c, b))\n e[b].add((c, a))\n q, v = list(map(int, input().split()))\n v -= 1\n d = [inf] * n\n d[v] = 0\n dfs(v)\n for _ in range(q):\n x, y = list(map(int, input().split()))\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"# bellman_ford : O(V E)\n# dijkstra : O(E log V), \u8ca0\u8fba\u306f\u7121\u7406\n# warshall_floyd : O(V**3)\n# deque\nfrom collections import deque\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef solve():\n inf = 10**14 + 10\n n = int(eval(input()))\n e = tuple(set() for _ in range(n))\n for _ in range(n - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n e[a].add((c, b))\n e[b].add((c, a))\n q, v = list(map(int, input().split()))\n v -= 1\n d = [inf] * n\n d[v] = 0\n dq = deque()\n for cost, to in e[v]:\n dq.append((cost, to, v))\n # (cost, to, parent)\n while dq:\n c, v, p = dq.popleft()\n if d[v] != inf:\n continue\n d[v] = d[p] + c\n for cost, to in e[v]:\n if to == p:\n continue\n dq.append((cost, to, v))\n for _ in range(q):\n x, y = list(map(int, input().split()))\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":13.2075471698,"diff":["+# deque","+from collections import deque","-sys.setrecursionlimit(10**7)","-","- def dfs(v: \"vertex_index, 0-indexed\") -> None:","- for c, t in e[v]:","- if d[t] != inf:","- continue","- d[t] = d[v] + c","- dfs(t)","-","- dfs(v)","+ dq = deque()","+ for cost, to in e[v]:","+ dq.append((cost, to, v))","+ # (cost, to, parent)","+ while dq:","+ c, v, p = dq.popleft()","+ if d[v] != inf:","+ continue","+ d[v] = d[p] + c","+ for cost, to in e[v]:","+ if to == p:","+ continue","+ dq.append((cost, to, v))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3453437109,"measured_runtime_v1":0.1126016858,"runtime_lift":3.06694974,"key":["s143869460","s902304606"]} +{"user_id":"u228223940","problem_id":"p03634","language":"python","submission_id_v0":"s279386500","submission_id_v1":"s990337521","cpu_time_v0":1565,"cpu_time_v1":1313,"memory_v0":113180,"memory_v1":156176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.1,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport queue\n\nn = int(eval(input()))\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\nwhile not q.empty():\n\n tmp = q.get()\n\n for i in range(len(abc[tmp])):\n\n #print(abc[tmp])\n\n #exit()\n\n num = abc[tmp][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[tmp] + abc[tmp][i][1]\n\n q.put(num)\n\n \n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))\n\n# optimized version of the same code:\n","target":"import queue\n\nimport sys\n\nsys.setrecursionlimit(10**7)\n\nn = int(eval(input()))\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\ndef dfs(p):\n\n for i in range(len(abc[p])):\n\n num = abc[p][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[p] + abc[p][i][1]\n\n dfs(num)\n\n\n\ndfs(k)\n\n\n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))","code_v0_loc":34,"code_v1_loc":35,"code_v0_num_chars":709,"code_v1_num_chars":668,"code_v0_no_empty_lines":"import queue\n\nn = int(eval(input()))\nabc = [[] for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n abc[a].append([b, c])\n abc[b].append([a, c])\nQ, k = list(map(int, input().split()))\nxy = [[int(i) for i in input().split()] for j in range(Q)]\nq = queue.Queue()\nq.put(k)\npath = [-1] * (n + 1)\npath[k] = 0\nwhile not q.empty():\n tmp = q.get()\n for i in range(len(abc[tmp])):\n # print(abc[tmp])\n # exit()\n num = abc[tmp][i][0]\n if path[num] != -1:\n continue\n else:\n path[num] = path[tmp] + abc[tmp][i][1]\n q.put(num)\nfor i in range(Q):\n print((path[xy[i][0]] + path[xy[i][1]]))\n","code_v1_no_empty_lines":"import queue\nimport sys\n\nsys.setrecursionlimit(10**7)\nn = int(eval(input()))\nabc = [[] for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n abc[a].append([b, c])\n abc[b].append([a, c])\nQ, k = list(map(int, input().split()))\nxy = [[int(i) for i in input().split()] for j in range(Q)]\nq = queue.Queue()\nq.put(k)\npath = [-1] * (n + 1)\npath[k] = 0\n\n\ndef dfs(p):\n for i in range(len(abc[p])):\n num = abc[p][i][0]\n if path[num] != -1:\n continue\n else:\n path[num] = path[p] + abc[p][i][1]\n dfs(num)\n\n\ndfs(k)\nfor i in range(Q):\n print((path[xy[i][0]] + path[xy[i][1]]))\n","code_same":false,"relative_loc_diff_percent":2.8571428571,"diff":["+import sys","+sys.setrecursionlimit(10**7)","-while not q.empty():","- tmp = q.get()","- for i in range(len(abc[tmp])):","- # print(abc[tmp])","- # exit()","- num = abc[tmp][i][0]","+","+","+def dfs(p):","+ for i in range(len(abc[p])):","+ num = abc[p][i][0]","- path[num] = path[tmp] + abc[tmp][i][1]","- q.put(num)","+ path[num] = path[p] + abc[p][i][1]","+ dfs(num)","+","+","+dfs(k)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3961623552,"measured_runtime_v1":0.2607869017,"runtime_lift":1.5191037302,"key":["s279386500","s990337521"]} +{"user_id":"u488178971","problem_id":"p03000","language":"python","submission_id_v0":"s975287095","submission_id_v1":"s789478825","cpu_time_v0":148,"cpu_time_v1":17,"memory_v0":12516,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.51,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#ABC 130 B\n\nN,X=list(map(int,input().split()))\n\nL= [int(j) for j in input().split()]\n\ncnt=0\n\nimport numpy as np\n\njump = list(np.cumsum(L))\n\nfor j in jump:\n\n if j <= X:\n\n cnt+=1\n\n else:\n\n break\n\nprint((cnt+1))\n\n# optimized version of the same code:\n","target":"#ABC 130 B\n\nN,X=list(map(int,input().split()))\n\nL= [int(j) for j in input().split()]\n\ncnt=0\n\nd = 0\n\n\n\nfor l in L :\n\n d+=l\n\n if d <= X:\n\n cnt+=1\n\n else:\n\n break\n\nprint((cnt+1))","code_v0_loc":12,"code_v1_loc":13,"code_v0_num_chars":220,"code_v1_num_chars":190,"code_v0_no_empty_lines":"# ABC 130 B\nN, X = list(map(int, input().split()))\nL = [int(j) for j in input().split()]\ncnt = 0\nimport numpy as np\n\njump = list(np.cumsum(L))\nfor j in jump:\n if j <= X:\n cnt += 1\n else:\n break\nprint((cnt + 1))\n","code_v1_no_empty_lines":"# ABC 130 B\nN, X = list(map(int, input().split()))\nL = [int(j) for j in input().split()]\ncnt = 0\nd = 0\nfor l in L:\n d += l\n if d <= X:\n cnt += 1\n else:\n break\nprint((cnt + 1))\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-import numpy as np","-","-jump = list(np.cumsum(L))","-for j in jump:","- if j <= X:","+d = 0","+for l in L:","+ d += l","+ if d <= X:"],"diff_only_import_comment":false,"measured_runtime_v0":1.4958784676,"measured_runtime_v1":0.1985901146,"runtime_lift":7.5324920912,"key":["s975287095","s789478825"]} +{"user_id":"u033272694","problem_id":"p03309","language":"python","submission_id_v0":"s079823927","submission_id_v1":"s432379861","cpu_time_v0":247,"cpu_time_v1":215,"memory_v0":34212,"memory_v1":34216,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.96,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nlist_ai = list(map(int,input().split()))\n\nlist1 = [x-(i+1) for i,x in enumerate(list_ai)]\n\na1 = np.array(list1)\n\nmedian1 = int(np.floor(np.median(a1)))\n\nans = np.sum(np.abs(a1-median1))\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import numpy as np\n\nN = int(eval(input()))\n\nlist_ai = list(map(int,input().split()))\n\na1 = np.array(list_ai)-np.arange(1,N+1)\n\nmedian1 = int(np.floor(np.median(a1)))\n\nans = np.sum(np.abs(a1-median1))\n\nprint(ans)\n","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":235,"code_v1_num_chars":206,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nlist_ai = list(map(int, input().split()))\nlist1 = [x - (i + 1) for i, x in enumerate(list_ai)]\na1 = np.array(list1)\nmedian1 = int(np.floor(np.median(a1)))\nans = np.sum(np.abs(a1 - median1))\nprint(ans)\n","code_v1_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nlist_ai = list(map(int, input().split()))\na1 = np.array(list_ai) - np.arange(1, N + 1)\nmedian1 = int(np.floor(np.median(a1)))\nans = np.sum(np.abs(a1 - median1))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-list1 = [x - (i + 1) for i, x in enumerate(list_ai)]","-a1 = np.array(list1)","+a1 = np.array(list_ai) - np.arange(1, N + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":1.879177295,"measured_runtime_v1":0.625532125,"runtime_lift":3.0041259591,"key":["s079823927","s432379861"]} +{"user_id":"u046187684","problem_id":"p02690","language":"python","submission_id_v0":"s323317183","submission_id_v1":"s843253005","cpu_time_v0":35,"cpu_time_v1":24,"memory_v0":11112,"memory_v1":9128,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef solve(string):\n\n x = int(string)\n\n a = {i**5: i for i in range(-10000, 10000)}\n\n for i in range(-10000, 10000):\n\n if x + i ** 5 in a:\n\n return str(f\"{a[x+i**5]} {i}\")\n\n\n\n\n\nif __name__ == '__main__':\n\n import sys\n\n print((solve(sys.stdin.read().strip())))\n\n\n# optimized version of the same code:\n","target":"def solve(string):\n\n x = int(string)\n\n a = {i**5: i for i in range(-120, 121)}\n\n for i in range(-121, 121):\n\n if x + i ** 5 in a:\n\n return str(f\"{a[x+i**5]} {i}\")\n\n\n\n\n\nif __name__ == '__main__':\n\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":290,"code_v1_num_chars":282,"code_v0_no_empty_lines":"def solve(string):\n x = int(string)\n a = {i**5: i for i in range(-10000, 10000)}\n for i in range(-10000, 10000):\n if x + i**5 in a:\n return str(f\"{a[x+i**5]} {i}\")\n\n\nif __name__ == \"__main__\":\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","code_v1_no_empty_lines":"def solve(string):\n x = int(string)\n a = {i**5: i for i in range(-120, 121)}\n for i in range(-121, 121):\n if x + i**5 in a:\n return str(f\"{a[x+i**5]} {i}\")\n\n\nif __name__ == \"__main__\":\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- a = {i**5: i for i in range(-10000, 10000)}","- for i in range(-10000, 10000):","+ a = {i**5: i for i in range(-120, 121)}","+ for i in range(-121, 121):"],"diff_only_import_comment":false,"measured_runtime_v0":0.3328460753,"measured_runtime_v1":0.2083550632,"runtime_lift":1.5974945373,"key":["s323317183","s843253005"]} +{"user_id":"u227438830","problem_id":"p02394","language":"python","submission_id_v0":"s015330345","submission_id_v1":"s144446421","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7644,"memory_v1":5592,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nW,H,x,y,r = [int(i) for i in input().split()]\n\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n# optimized version of the same code:\n","target":"W, H, x, y, r = list(map(int, input().split()))\n\nif r <= x <= W-r and r <= y <= H-r:\n\n print('Yes')\n\nelse:\n\n print('No')\n","code_v0_loc":5,"code_v1_loc":5,"code_v0_num_chars":148,"code_v1_num_chars":121,"code_v0_no_empty_lines":"W, H, x, y, r = [int(i) for i in input().split()]\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"W, H, x, y, r = list(map(int, input().split()))\nif r <= x <= W - r and r <= y <= H - r:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-W, H, x, y, r = [int(i) for i in input().split()]","-if x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:","+W, H, x, y, r = list(map(int, input().split()))","+if r <= x <= W - r and r <= y <= H - r:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1765992579,"measured_runtime_v1":0.0064357525,"runtime_lift":27.44034336,"key":["s015330345","s144446421"]} +{"user_id":"u945228737","problem_id":"p02690","language":"python","submission_id_v0":"s563805552","submission_id_v1":"s994521496","cpu_time_v0":98,"cpu_time_v1":48,"memory_v0":9100,"memory_v1":9176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.02,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# \u89e3\u8aac\u3092\u53c2\u8003\u306b\u4f5c\u6210\n\n\n\ndef solve():\n\n X = int(eval(input()))\n\n A, B = 0, 0\n\n for a in range(-200, 200):\n\n for b in range(-200, 200):\n\n if a ** 5 - b ** 5 == X:\n\n A, B = a, b\n\n break\n\n print((A, B))\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n\n\n# optimized version of the same code:\n","target":"# \u89e3\u8aac\u3092\u53c2\u8003\u306b\u4f5c\u6210\n\n\n\ndef solve():\n\n X = int(eval(input()))\n\n A, B = 0, 0\n\n # A \u3068 B \u306e\u5dee\u304c\u6700\u3082\u5c0f\u3055\u3044\u6642(A - B = 1)\u306b, ans < 10**9 \u3068\u306a\u308b\u306e\u306f\n\n # -118 <= A <= 119, -119 <= B <= 118 \u306e\u5834\u5408\u3068\u306a\u308b.\n\n # A - B > 1 \u306e\u5834\u5408\u3067\u3082\u540c\u3058\u7bc4\u56f2\u3060\u3051\u898b\u308c\u3070\u5341\u5206\u3068\u306a\u308b.\n\n # A - B < 1 \u306e\u5834\u5408\u306f\u7b54\u3048\u304c\u8ca0\u306b\u306a\u308b\u306e\u3067, X >= 1 \u306e\u5236\u7d04\u304b\u3089\u691c\u8a0e\u4e0d\u8981.\n\n for a in range(-118, 119 + 1):\n\n for b in range(-119, 118 + 1):\n\n if a ** 5 - b ** 5 == X:\n\n A, B = a, b\n\n break\n\n print((A, B))\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","code_v0_loc":16,"code_v1_loc":19,"code_v0_num_chars":288,"code_v1_num_chars":486,"code_v0_no_empty_lines":"# \u89e3\u8aac\u3092\u53c2\u8003\u306b\u4f5c\u6210\ndef solve():\n X = int(eval(input()))\n A, B = 0, 0\n for a in range(-200, 200):\n for b in range(-200, 200):\n if a**5 - b**5 == X:\n A, B = a, b\n break\n print((A, B))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"# \u89e3\u8aac\u3092\u53c2\u8003\u306b\u4f5c\u6210\ndef solve():\n X = int(eval(input()))\n A, B = 0, 0\n # A \u3068 B \u306e\u5dee\u304c\u6700\u3082\u5c0f\u3055\u3044\u6642(A - B = 1)\u306b, ans < 10**9 \u3068\u306a\u308b\u306e\u306f\n # -118 <= A <= 119, -119 <= B <= 118 \u306e\u5834\u5408\u3068\u306a\u308b.\n # A - B > 1 \u306e\u5834\u5408\u3067\u3082\u540c\u3058\u7bc4\u56f2\u3060\u3051\u898b\u308c\u3070\u5341\u5206\u3068\u306a\u308b.\n # A - B < 1 \u306e\u5834\u5408\u306f\u7b54\u3048\u304c\u8ca0\u306b\u306a\u308b\u306e\u3067, X >= 1 \u306e\u5236\u7d04\u304b\u3089\u691c\u8a0e\u4e0d\u8981.\n for a in range(-118, 119 + 1):\n for b in range(-119, 118 + 1):\n if a**5 - b**5 == X:\n A, B = a, b\n break\n print((A, B))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["- for a in range(-200, 200):","- for b in range(-200, 200):","+ # A \u3068 B \u306e\u5dee\u304c\u6700\u3082\u5c0f\u3055\u3044\u6642(A - B = 1)\u306b, ans < 10**9 \u3068\u306a\u308b\u306e\u306f","+ # -118 <= A <= 119, -119 <= B <= 118 \u306e\u5834\u5408\u3068\u306a\u308b.","+ # A - B > 1 \u306e\u5834\u5408\u3067\u3082\u540c\u3058\u7bc4\u56f2\u3060\u3051\u898b\u308c\u3070\u5341\u5206\u3068\u306a\u308b.","+ # A - B < 1 \u306e\u5834\u5408\u306f\u7b54\u3048\u304c\u8ca0\u306b\u306a\u308b\u306e\u3067, X >= 1 \u306e\u5236\u7d04\u304b\u3089\u691c\u8a0e\u4e0d\u8981.","+ for a in range(-118, 119 + 1):","+ for b in range(-119, 118 + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":1.5065554937,"measured_runtime_v1":0.7134095093,"runtime_lift":2.1117681697,"key":["s563805552","s994521496"]} +{"user_id":"u600402037","problem_id":"p03060","language":"python","submission_id_v0":"s117395180","submission_id_v1":"s327543146","cpu_time_v0":265,"cpu_time_v1":18,"memory_v0":17848,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.21,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# coding: utf-8\n\nimport sys\n\nimport numpy as np\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN = ir()\n\nV = np.array(lr())\n\nC = np.array(lr())\n\nV -= C\n\nV = V[V>0]\n\nanswer = V.sum()\n\nprint(answer)\n\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nimport sys\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN = ir()\n\nV = lr()\n\nC = lr()\n\ntotal = 0\n\nfor i in range(N):\n\n result = V[i] - C[i]\n\n if result > 0:\n\n total += result\n\n\n\nprint(total)\n","code_v0_loc":15,"code_v1_loc":17,"code_v0_num_chars":266,"code_v1_num_chars":291,"code_v0_no_empty_lines":"# coding: utf-8\nimport sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN = ir()\nV = np.array(lr())\nC = np.array(lr())\nV -= C\nV = V[V > 0]\nanswer = V.sum()\nprint(answer)\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN = ir()\nV = lr()\nC = lr()\ntotal = 0\nfor i in range(N):\n result = V[i] - C[i]\n if result > 0:\n total += result\nprint(total)\n","code_same":false,"relative_loc_diff_percent":11.7647058824,"diff":["-import numpy as np","-V = np.array(lr())","-C = np.array(lr())","-V -= C","-V = V[V > 0]","-answer = V.sum()","-print(answer)","+V = lr()","+C = lr()","+total = 0","+for i in range(N):","+ result = V[i] - C[i]","+ if result > 0:","+ total += result","+print(total)"],"diff_only_import_comment":false,"measured_runtime_v0":1.1957234194,"measured_runtime_v1":0.2010130272,"runtime_lift":5.9484872004,"key":["s117395180","s327543146"]} +{"user_id":"u353895424","problem_id":"p03325","language":"python","submission_id_v0":"s954474488","submission_id_v1":"s311308759","cpu_time_v0":81,"cpu_time_v1":56,"memory_v0":4148,"memory_v1":10088,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import log2\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor _a in a:\n\n if _a%2 == 0:\n\n cnt =0\n\n while _a%2 == 0:\n\n _a \/\/= 2\n\n cnt += 1\n\n ans += cnt\n\n\n\nprint((int(ans)))\n\n# optimized version of the same code:\n","target":"def f(k):\n\n cnt = 0\n\n while k%2 == 0:\n\n k \/\/= 2\n\n cnt += 1\n\n # print(k)\n\n # print(\"-----\")\n\n return cnt\n\n\n\nn = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor a in A:\n\n if a%2 == 0:\n\n ans += f(a)\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":17,"code_v0_num_chars":245,"code_v1_num_chars":272,"code_v0_no_empty_lines":"from math import log2\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nans = 0\nfor _a in a:\n if _a % 2 == 0:\n cnt = 0\n while _a % 2 == 0:\n _a \/\/= 2\n cnt += 1\n ans += cnt\nprint((int(ans)))\n","code_v1_no_empty_lines":"def f(k):\n cnt = 0\n while k % 2 == 0:\n k \/\/= 2\n cnt += 1\n # print(k)\n # print(\"-----\")\n return cnt\n\n\nn = int(eval(input()))\nA = list(map(int, input().split()))\nans = 0\nfor a in A:\n if a % 2 == 0:\n ans += f(a)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["-from math import log2","+def f(k):","+ cnt = 0","+ while k % 2 == 0:","+ k \/\/= 2","+ cnt += 1","+ # print(k)","+ return cnt","+","-a = list(map(int, input().split()))","+A = list(map(int, input().split()))","-for _a in a:","- if _a % 2 == 0:","- cnt = 0","- while _a % 2 == 0:","- _a \/\/= 2","- cnt += 1","- ans += cnt","-print((int(ans)))","+for a in A:","+ if a % 2 == 0:","+ ans += f(a)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3309142907,"measured_runtime_v1":0.2479304838,"runtime_lift":1.3347059448,"key":["s954474488","s311308759"]} +{"user_id":"u164727245","problem_id":"p02685","language":"python","submission_id_v0":"s549338354","submission_id_v1":"s173586541","cpu_time_v0":842,"cpu_time_v1":187,"memory_v0":9192,"memory_v1":16648,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":77.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n ret = p\n\n inv = pow(m-1, mod-2, mod)\n\n for i in range(1, k+1):\n\n ncr = (ncr * (n-i)*pow(i, mod-2, mod)) % mod\n\n p = (p*inv) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n\n\n ret = p\n\n iR = [1]*(k+1)\n\n im = pow(m-1, mod-2, mod)\n\n\n\n for i in range(1, k+1):\n\n iR[i] = max(1, (-(mod\/\/i) * iR[mod % i]) % mod)\n\n ncr = (ncr * (n-i)*iR[i]) % mod\n\n p = (p*im) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n","code_v0_loc":24,"code_v1_loc":28,"code_v0_num_chars":512,"code_v1_num_chars":578,"code_v0_no_empty_lines":"# coding: utf-8\ndef solve(*args: str) -> str:\n n, m, k = list(map(int, args[0].split()))\n mod = 998244353\n if m == 1 and n - 1 == k:\n return str(1)\n ncr = 1\n p = m * pow(m - 1, n - 1, mod) % mod\n ret = p\n inv = pow(m - 1, mod - 2, mod)\n for i in range(1, k + 1):\n ncr = (ncr * (n - i) * pow(i, mod - 2, mod)) % mod\n p = (p * inv) % mod\n ret += p * ncr % mod\n return str(ret % mod)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_v1_no_empty_lines":"# coding: utf-8\ndef solve(*args: str) -> str:\n n, m, k = list(map(int, args[0].split()))\n mod = 998244353\n if m == 1 and n - 1 == k:\n return str(1)\n ncr = 1\n p = m * pow(m - 1, n - 1, mod) % mod\n ret = p\n iR = [1] * (k + 1)\n im = pow(m - 1, mod - 2, mod)\n for i in range(1, k + 1):\n iR[i] = max(1, (-(mod \/\/ i) * iR[mod % i]) % mod)\n ncr = (ncr * (n - i) * iR[i]) % mod\n p = (p * im) % mod\n ret += p * ncr % mod\n return str(ret % mod)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["- inv = pow(m - 1, mod - 2, mod)","+ iR = [1] * (k + 1)","+ im = pow(m - 1, mod - 2, mod)","- ncr = (ncr * (n - i) * pow(i, mod - 2, mod)) % mod","- p = (p * inv) % mod","+ iR[i] = max(1, (-(mod \/\/ i) * iR[mod % i]) % mod)","+ ncr = (ncr * (n - i) * iR[i]) % mod","+ p = (p * im) % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.4946005352,"measured_runtime_v1":0.3604053538,"runtime_lift":1.3723451385,"key":["s549338354","s173586541"]} +{"user_id":"u390727364","problem_id":"p02690","language":"python","submission_id_v0":"s461844743","submission_id_v1":"s642120834","cpu_time_v0":51,"cpu_time_v1":44,"memory_v0":9132,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\na = 0\n\nb = 0\n\nfor i in range(-120, 120):\n\n for j in range(-120, 120):\n\n if i ** 5 - j ** 5 == x:\n\n a = i\n\n b = j\n\nprint((a, b))\n\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\nfor i in range(-120, 120):\n\n for j in range(-120, 120):\n\n if i ** 5 - j ** 5 == x:\n\n print((i, j))\n\n exit()\n","code_v0_loc":9,"code_v1_loc":6,"code_v0_num_chars":176,"code_v1_num_chars":156,"code_v0_no_empty_lines":"x = int(eval(input()))\na = 0\nb = 0\nfor i in range(-120, 120):\n for j in range(-120, 120):\n if i**5 - j**5 == x:\n a = i\n b = j\nprint((a, b))\n","code_v1_no_empty_lines":"x = int(eval(input()))\nfor i in range(-120, 120):\n for j in range(-120, 120):\n if i**5 - j**5 == x:\n print((i, j))\n exit()\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-a = 0","-b = 0","- a = i","- b = j","-print((a, b))","+ print((i, j))","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.4738806367,"measured_runtime_v1":0.3552351197,"runtime_lift":1.3339915184,"key":["s461844743","s642120834"]} +{"user_id":"u054556734","problem_id":"p03828","language":"python","submission_id_v0":"s442927172","submission_id_v1":"s952876179","cpu_time_v0":83,"cpu_time_v1":25,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.88,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,n+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num \/\/= i ; ans.append(i)\n\n return ans\n\n\n\nn = int(eval(input()))\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"import collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,int(n**0.5)+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num \/\/= i ; ans.append(i)\n\n if num != 1: ans.append(num)\n\n return ans\n\n\n\nn = int(eval(input()))\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n","code_v0_loc":20,"code_v1_loc":21,"code_v0_num_chars":409,"code_v1_num_chars":453,"code_v0_no_empty_lines":"import collections as col\n\n\ndef prime(n):\n ans = []\n num = n\n for i in range(2, n + 1):\n if i % 2 == 0 and i != 2:\n continue\n while num % i == 0:\n num \/\/= i\n ans.append(i)\n return ans\n\n\nn = int(eval(input()))\nmod = 10**9 + 7\nprimes = []\nfor i in range(2, n + 1):\n primes += prime(i)\ncnt = col.Counter(primes)\nans = 1\nfor key, val in list(cnt.items()):\n ans *= val + 1\n ans %= mod\nprint(ans)\n","code_v1_no_empty_lines":"import collections as col\n\n\ndef prime(n):\n ans = []\n num = n\n for i in range(2, int(n**0.5) + 1):\n if i % 2 == 0 and i != 2:\n continue\n while num % i == 0:\n num \/\/= i\n ans.append(i)\n if num != 1:\n ans.append(num)\n return ans\n\n\nn = int(eval(input()))\nmod = 10**9 + 7\nprimes = []\nfor i in range(2, n + 1):\n primes += prime(i)\ncnt = col.Counter(primes)\nans = 1\nfor key, val in list(cnt.items()):\n ans *= val + 1\n ans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["- for i in range(2, n + 1):","+ for i in range(2, int(n**0.5) + 1):","+ if num != 1:","+ ans.append(num)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3365422637,"measured_runtime_v1":0.2564944384,"runtime_lift":1.3120840585,"key":["s442927172","s952876179"]} +{"user_id":"u852690916","problem_id":"p02794","language":"python","submission_id_v0":"s356881403","submission_id_v1":"s623982203","cpu_time_v0":2735,"cpu_time_v1":2229,"memory_v0":44580,"memory_v1":43936,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(eval(input()))\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(eval(input()))\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(eval(input()))\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(eval(input()))\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":52,"code_v1_loc":54,"code_v0_num_chars":1262,"code_v1_num_chars":1288,"code_v0_no_empty_lines":"import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(eval(input()))\n E = [[] for _ in range(N)]\n for i in range(N - 1):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n E[a].append((b, i))\n E[b].append((a, i))\n\n def dfs(s, g):\n par = [(-1, -1)] * N\n par[s] = (s, -1)\n stack = [s]\n while stack:\n v = stack.pop()\n for to, i in E[v]:\n if par[to][0] >= 0:\n continue\n par[to] = (v, i)\n if to == g:\n break\n stack.append(to)\n r = set()\n v = g\n while v != s:\n v, i = par[v]\n r.add(i)\n return r\n\n M = int(eval(input()))\n path = [None] * M\n for i in range(M):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n path[i] = dfs(u, v)\n\n def calc(s):\n return 1 << (N - 1 - len(s))\n\n i_ans = 0\n for p in range(1, 1 << M):\n is_odd = bin(p).count(\"1\") & 1\n s = set()\n for i in range(M):\n if p & 1:\n s |= path[i]\n p >>= 1\n if is_odd:\n i_ans += calc(s)\n else:\n i_ans -= calc(s)\n print(((1 << (N - 1)) - i_ans))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(eval(input()))\n E = [[] for _ in range(N)]\n for i in range(N - 1):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n E[a].append((b, i))\n E[b].append((a, i))\n\n def dfs(s, g):\n par = [(-1, -1)] * N\n par[s] = (s, -1)\n stack = [s]\n while stack:\n v = stack.pop()\n for to, i in E[v]:\n if par[to][0] >= 0:\n continue\n par[to] = (v, i)\n if to == g:\n break\n stack.append(to)\n r = set()\n v = g\n while v != s:\n v, i = par[v]\n r.add(i)\n return r\n\n M = int(eval(input()))\n path = [None] * M\n for i in range(M):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n path[i] = dfs(u, v)\n\n def calc(s):\n return 1 << (N - 1 - len(s))\n\n i_ans = 0\n for p in range(1, 1 << M):\n is_odd = 0\n s = set()\n for i in range(M):\n if p & 1:\n s |= path[i]\n is_odd ^= 1\n p >>= 1\n if is_odd:\n i_ans += calc(s)\n else:\n i_ans -= calc(s)\n print(((1 << (N - 1)) - i_ans))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.7037037037,"diff":["- is_odd = bin(p).count(\"1\") & 1","+ is_odd = 0","+ is_odd ^= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3895377469,"measured_runtime_v1":0.2566085732,"runtime_lift":1.5180231199,"key":["s356881403","s623982203"]} +{"user_id":"u729133443","problem_id":"p02899","language":"python","submission_id_v0":"s646220831","submission_id_v1":"s894161830","cpu_time_v0":493,"cpu_time_v1":357,"memory_v0":21804,"memory_v1":62060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom numpy import*;_,a=open(0);print((*argsort(int32(a.split()))+1))\n\n# optimized version of the same code:\n","target":"n,a=open(0);a=a.split();print((*sorted(list(range(1,int(n)+1)),key=lambda x:int(a[x-1]))))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":66,"code_v1_num_chars":82,"code_v0_no_empty_lines":"from numpy import *\n\n_, a = open(0)\nprint((*argsort(int32(a.split())) + 1))\n","code_v1_no_empty_lines":"n, a = open(0)\na = a.split()\nprint((*sorted(list(range(1, int(n) + 1)), key=lambda x: int(a[x - 1]))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-from numpy import *","-","-_, a = open(0)","-print((*argsort(int32(a.split())) + 1))","+n, a = open(0)","+a = a.split()","+print((*sorted(list(range(1, int(n) + 1)), key=lambda x: int(a[x - 1]))))"],"diff_only_import_comment":false,"measured_runtime_v0":2.3151512724,"measured_runtime_v1":0.2950551372,"runtime_lift":7.8465038569,"key":["s646220831","s894161830"]} +{"user_id":"u020390084","problem_id":"p03575","language":"python","submission_id_v0":"s815945561","submission_id_v1":"s404136326","cpu_time_v0":206,"cpu_time_v1":21,"memory_v0":13852,"memory_v1":3192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.81,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nfrom scipy.sparse import csr_matrix\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\ndef solve(N: int, M: int, a: \"List[int]\", b: \"List[int]\"):\n\n answer = 0\n\n for i in range(M): ## i\u306e\u8fba\u3092\u6d88\u3059\n\n matrix = [[0]*(N) for _ in range(N)]\n\n for j in range(M):\n\n if j == i:\n\n continue\n\n aa = a[j]-1\n\n bb = b[j]-1\n\n matrix[aa][bb] = 1\n\n \n\n dist_matrix = floyd_warshall(csgraph=csr_matrix(matrix), directed=False)\n\n \n\n if dist_matrix[a[i]-1][b[i]-1] == float('inf'):\n\n answer += 1\n\n \n\n print(answer)\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n M = int(next(tokens)) # type: int\n\n a = [int()] * (M) # type: \"List[int]\"\n\n b = [int()] * (M) # type: \"List[int]\"\n\n for i in range(M):\n\n a[i] = int(next(tokens))\n\n b[i] = int(next(tokens))\n\n solve(N, M, a, b)\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\ninput = sys.stdin.readline\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int,input().split()))\n\ndef LI(): return list(map(int,input().split()))\n\n\n\nclass UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n \n\n def find(self, x): # \u6839\u3092\u63a2\u3059\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n \n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n \n\n if x == y:\n\n return\n\n \n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n \n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n \n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n \n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n \n\n def members(self, x):\n\n root = self.find(x)\n\n return [i for i in range(self.n) if self.find(i) == root]\n\n \n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n\n\n def group_count(self):\n\n return len(self.roots())\n\n \n\n def all_group_members(self):\n\n return {r: self.members(r) for r in self.roots()}\n\n \n\n def __str__(self):\n\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\n\n\ndef main():\n\n N,M=MAP()\n\n \n\n edges = []\n\n for _ in range(M):\n\n a,b = MAP()\n\n edges.append((a-1,b-1))\n\n\n\n answer = 0\n\n for i in range(M): # i\u756a\u76ee\u306e\u8fba\u3092\u4f7f\u308f\u306a\u3044\n\n uf = UnionFind(N)\n\n\n\n for j in range(M):\n\n if i == j:\n\n continue\n\n\n\n a,b = edges[j]\n\n uf.union(a,b)\n\n if uf.group_count() > 1:\n\n answer += 1\n\n print(answer)\n\n return\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":41,"code_v1_loc":79,"code_v0_num_chars":1146,"code_v1_num_chars":1934,"code_v0_no_empty_lines":"import sys\nfrom scipy.sparse import csr_matrix\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\ndef solve(N: int, M: int, a: \"List[int]\", b: \"List[int]\"):\n answer = 0\n for i in range(M): ## i\u306e\u8fba\u3092\u6d88\u3059\n matrix = [[0] * (N) for _ in range(N)]\n for j in range(M):\n if j == i:\n continue\n aa = a[j] - 1\n bb = b[j] - 1\n matrix[aa][bb] = 1\n dist_matrix = floyd_warshall(csgraph=csr_matrix(matrix), directed=False)\n if dist_matrix[a[i] - 1][b[i] - 1] == float(\"inf\"):\n answer += 1\n print(answer)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n M = int(next(tokens)) # type: int\n a = [int()] * (M) # type: \"List[int]\"\n b = [int()] * (M) # type: \"List[int]\"\n for i in range(M):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n solve(N, M, a, b)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\nclass UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x): # \u6839\u3092\u63a2\u3059\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())\n\n\ndef main():\n N, M = MAP()\n edges = []\n for _ in range(M):\n a, b = MAP()\n edges.append((a - 1, b - 1))\n answer = 0\n for i in range(M): # i\u756a\u76ee\u306e\u8fba\u3092\u4f7f\u308f\u306a\u3044\n uf = UnionFind(N)\n for j in range(M):\n if i == j:\n continue\n a, b = edges[j]\n uf.union(a, b)\n if uf.group_count() > 1:\n answer += 1\n print(answer)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":48.1012658228,"diff":["+#!\/usr\/bin\/env python3","-from scipy.sparse import csr_matrix","-from scipy.sparse.csgraph import floyd_warshall","+","+input = sys.stdin.readline","-def solve(N: int, M: int, a: \"List[int]\", b: \"List[int]\"):","+def INT():","+ return int(eval(input()))","+","+","+def MAP():","+ return list(map(int, input().split()))","+","+","+def LI():","+ return list(map(int, input().split()))","+","+","+class UnionFind:","+ def __init__(self, n):","+ self.n = n","+ self.parents = [-1] * n","+","+ def find(self, x): # \u6839\u3092\u63a2\u3059","+ if self.parents[x] < 0:","+ return x","+ else:","+ self.parents[x] = self.find(self.parents[x])","+ return self.parents[x]","+","+ def union(self, x, y):","+ x = self.find(x)","+ y = self.find(y)","+ if x == y:","+ return","+ if self.parents[x] > self.parents[y]:","+ x, y = y, x","+ self.parents[x] += self.parents[y]","+ self.parents[y] = x","+","+ def size(self, x):","+ return -self.parents[self.find(x)]","+","+ def same(self, x, y):","+ return self.find(x) == self.find(y)","+","+ def members(self, x):","+ root = self.find(x)","+ return [i for i in range(self.n) if self.find(i) == root]","+","+ def roots(self):","+ return [i for i, x in enumerate(self.parents) if x < 0]","+","+ def group_count(self):","+ return len(self.roots())","+","+ def all_group_members(self):","+ return {r: self.members(r) for r in self.roots()}","+","+ def __str__(self):","+ return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())","+","+","+def main():","+ N, M = MAP()","+ edges = []","+ for _ in range(M):","+ a, b = MAP()","+ edges.append((a - 1, b - 1))","- for i in range(M): ## i\u306e\u8fba\u3092\u6d88\u3059","- matrix = [[0] * (N) for _ in range(N)]","+ for i in range(M): # i\u756a\u76ee\u306e\u8fba\u3092\u4f7f\u308f\u306a\u3044","+ uf = UnionFind(N)","- if j == i:","+ if i == j:","- aa = a[j] - 1","- bb = b[j] - 1","- matrix[aa][bb] = 1","- dist_matrix = floyd_warshall(csgraph=csr_matrix(matrix), directed=False)","- if dist_matrix[a[i] - 1][b[i] - 1] == float(\"inf\"):","+ a, b = edges[j]","+ uf.union(a, b)","+ if uf.group_count() > 1:","-def main():","- def iterate_tokens():","- for line in sys.stdin:","- for word in line.split():","- yield word","-","- tokens = iterate_tokens()","- N = int(next(tokens)) # type: int","- M = int(next(tokens)) # type: int","- a = [int()] * (M) # type: \"List[int]\"","- b = [int()] * (M) # type: \"List[int]\"","- for i in range(M):","- a[i] = int(next(tokens))","- b[i] = int(next(tokens))","- solve(N, M, a, b)","-","-"],"diff_only_import_comment":false,"measured_runtime_v0":2.0324458141,"measured_runtime_v1":0.2175420785,"runtime_lift":9.3427709623,"key":["s815945561","s404136326"]} +{"user_id":"u295361373","problem_id":"p02612","language":"python","submission_id_v0":"s197156959","submission_id_v1":"s836901225","cpu_time_v0":226,"cpu_time_v1":180,"memory_v0":68124,"memory_v1":68072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.35,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(eval(input()))\n\ndef si():return eval(input())\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n#mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile = 0\n\n\n\ndef solve():\n\n \n\n\n\n\n\n\n\n # for _ in range(ii()):\n\n\n\n n=ii()\n\n n%=1000\n\n if n!=0:\n\n n=1000-n\n\n print(n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()\n\n# optimized version of the same code:\n","target":"'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom heapq import heappush,heappop\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(eval(input()))\n\ndef si():return eval(input())\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n# mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile=0\n\n\n\n\n\n\n\n\n\n\n\ndef solve():\n\n\n\n\n\n # for _ in range(ii()):\n\n \n\n \n\n\n\n n=ii()\n\n n%=1000\n\n if(n!=0):\n\n n=1000-n\n\n print(n)\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()\n","code_v0_loc":77,"code_v1_loc":66,"code_v0_num_chars":1162,"code_v1_num_chars":1190,"code_v0_no_empty_lines":"\"\"\"\n Auther: ghoshashis545 Ashis Ghosh\n College: jalpaiguri Govt Enggineering College\n\"\"\"\nfrom os import path\nimport sys\nfrom functools import cmp_to_key as ctk\nfrom collections import deque, defaultdict as dd\nfrom bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right\nfrom itertools import permutations\nfrom datetime import datetime\nfrom math import ceil, sqrt, log, gcd\n\n\ndef ii():\n return int(eval(input()))\n\n\ndef si():\n return eval(input())\n\n\ndef mi():\n return list(map(int, input().split()))\n\n\ndef li():\n return list(mi())\n\n\nabc = \"abcdefghijklmnopqrstuvwxyz\"\nmod = 1000000007\n# mod=998244353\ninf = float(\"inf\")\nvow = [\"a\", \"e\", \"i\", \"o\", \"u\"]\ndx, dy = [-1, 1, 0, 0], [0, 0, 1, -1]\n\n\ndef bo(i):\n return ord(i) - ord(\"a\")\n\n\nfile = 0\n\n\ndef solve():\n # for _ in range(ii()):\n n = ii()\n n %= 1000\n if n != 0:\n n = 1000 - n\n print(n)\n\n\nif __name__ == \"__main__\":\n if file:\n if path.exists(\"input1.txt\"):\n sys.stdin = open(\"input1.txt\", \"r\")\n sys.stdout = open(\"output1.txt\", \"w\")\n else:\n input = sys.stdin.readline\n solve()\n","code_v1_no_empty_lines":"\"\"\"\n Auther: ghoshashis545 Ashis Ghosh\n College: jalpaiguri Govt Enggineering College\n\"\"\"\nfrom os import path\nimport sys\nfrom heapq import heappush, heappop\nfrom functools import cmp_to_key as ctk\nfrom collections import deque, defaultdict as dd\nfrom bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right\nfrom itertools import permutations\nfrom datetime import datetime\nfrom math import ceil, sqrt, log, gcd\n\n\ndef ii():\n return int(eval(input()))\n\n\ndef si():\n return eval(input())\n\n\ndef mi():\n return list(map(int, input().split()))\n\n\ndef li():\n return list(mi())\n\n\nabc = \"abcdefghijklmnopqrstuvwxyz\"\nmod = 1000000007\n# mod=998244353\ninf = float(\"inf\")\nvow = [\"a\", \"e\", \"i\", \"o\", \"u\"]\ndx, dy = [-1, 1, 0, 0], [0, 0, 1, -1]\n\n\ndef bo(i):\n return ord(i) - ord(\"a\")\n\n\nfile = 0\n\n\ndef solve():\n # for _ in range(ii()):\n n = ii()\n n %= 1000\n if n != 0:\n n = 1000 - n\n print(n)\n\n\nif __name__ == \"__main__\":\n if file:\n if path.exists(\"input1.txt\"):\n sys.stdin = open(\"input1.txt\", \"r\")\n sys.stdout = open(\"output1.txt\", \"w\")\n else:\n input = sys.stdin.readline\n solve()\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+from heapq import heappush, heappop"],"diff_only_import_comment":false,"measured_runtime_v0":0.3258618799,"measured_runtime_v1":0.2078528001,"runtime_lift":1.5677531392,"key":["s197156959","s836901225"]} +{"user_id":"u254871849","problem_id":"p02850","language":"python","submission_id_v0":"s960505941","submission_id_v1":"s699117089","cpu_time_v0":1118,"cpu_time_v1":274,"memory_v0":34416,"memory_v1":33444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.49,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nfrom collections import deque\n\nimport numpy as np\n\n\n\ndef main():\n\n n = int(sys.stdin.readline().rstrip())\n\n ab = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(-1, 2)\n\n\n\n G = [[] for _ in range(n + 1)]\n\n for a, b in ab:\n\n G[a].append(b)\n\n G[b].append(a)\n\n \n\n parent = np.zeros(n + 1, dtype=np.int64)\n\n color = np.zeros(n + 1, dtype=np.int64) # color of the edge(parent[y], y)\n\n\n\n q = deque([1]) # root = 1\n\n while q:\n\n x = q.popleft()\n\n ng = color[x]\n\n c = 1\n\n for y in G[x]:\n\n if y == parent[x]:\n\n continue\n\n parent[y] = x\n\n if c == ng:\n\n c += 1\n\n color[y] = c\n\n q.append(y)\n\n c += 1\n\n\n\n print((np.amax(color)))\n\n\n\n for a, b in ab:\n\n if a == parent[b]:\n\n print((color[b]))\n\n else:\n\n print((color[a]))\n\n \n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom collections import deque\n\n\n\ndef main():\n\n n = int(sys.stdin.readline().rstrip())\n\n ab = list(map(int, sys.stdin.read().split()))\n\n ab = list(zip(ab, ab))\n\n\n\n G = [[] for _ in range(n + 1)]\n\n for a, b in ab:\n\n G[a].append(b)\n\n G[b].append(a)\n\n \n\n q = deque([1]) # root = 1\n\n parent = [None] * (n + 1)\n\n color = [0] * (n + 1) # color of the edge(parent[y], y)\n\n\n\n while q:\n\n x = q.popleft()\n\n ng = color[x]\n\n c = 1\n\n for y in G[x]:\n\n if y == parent[x]:\n\n continue\n\n parent[y] = x\n\n if c == ng:\n\n c += 1\n\n color[y] = c\n\n q.append(y)\n\n c += 1\n\n \n\n print((max(color)))\n\n\n\n for a, b in ab:\n\n if a == parent[b]:\n\n print((color[b]))\n\n else:\n\n print((color[a]))\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":41,"code_v1_loc":41,"code_v0_num_chars":980,"code_v1_num_chars":920,"code_v0_no_empty_lines":"import sys\nfrom collections import deque\nimport numpy as np\n\n\ndef main():\n n = int(sys.stdin.readline().rstrip())\n ab = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(-1, 2)\n G = [[] for _ in range(n + 1)]\n for a, b in ab:\n G[a].append(b)\n G[b].append(a)\n parent = np.zeros(n + 1, dtype=np.int64)\n color = np.zeros(n + 1, dtype=np.int64) # color of the edge(parent[y], y)\n q = deque([1]) # root = 1\n while q:\n x = q.popleft()\n ng = color[x]\n c = 1\n for y in G[x]:\n if y == parent[x]:\n continue\n parent[y] = x\n if c == ng:\n c += 1\n color[y] = c\n q.append(y)\n c += 1\n print((np.amax(color)))\n for a, b in ab:\n if a == parent[b]:\n print((color[b]))\n else:\n print((color[a]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque\n\n\ndef main():\n n = int(sys.stdin.readline().rstrip())\n ab = list(map(int, sys.stdin.read().split()))\n ab = list(zip(ab, ab))\n G = [[] for _ in range(n + 1)]\n for a, b in ab:\n G[a].append(b)\n G[b].append(a)\n q = deque([1]) # root = 1\n parent = [None] * (n + 1)\n color = [0] * (n + 1) # color of the edge(parent[y], y)\n while q:\n x = q.popleft()\n ng = color[x]\n c = 1\n for y in G[x]:\n if y == parent[x]:\n continue\n parent[y] = x\n if c == ng:\n c += 1\n color[y] = c\n q.append(y)\n c += 1\n print((max(color)))\n for a, b in ab:\n if a == parent[b]:\n print((color[b]))\n else:\n print((color[a]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","- ab = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(-1, 2)","+ ab = list(map(int, sys.stdin.read().split()))","+ ab = list(zip(ab, ab))","- parent = np.zeros(n + 1, dtype=np.int64)","- color = np.zeros(n + 1, dtype=np.int64) # color of the edge(parent[y], y)","+ parent = [None] * (n + 1)","+ color = [0] * (n + 1) # color of the edge(parent[y], y)","- print((np.amax(color)))","+ print((max(color)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3834958427,"measured_runtime_v1":0.2106900873,"runtime_lift":6.5664970775,"key":["s960505941","s699117089"]} +{"user_id":"u133936772","problem_id":"p02685","language":"python","submission_id_v0":"s693454638","submission_id_v1":"s088786085","cpu_time_v0":1252,"cpu_time_v1":782,"memory_v0":9184,"memory_v1":9192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.54,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nM=998244353\n\nn,m,k=list(map(int,input().split()))\n\na=0\n\nc=1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n-i-1,M)\n\n c=c*(n-i-1)*pow(i+1,M-2,M)%M\n\nprint((a%M))\n\n# optimized version of the same code:\n","target":"M=998244353\n\nn,m,k=list(map(int,input().split()))\n\na,c=0,1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n+~i,M)\n\n c=c*(n+~i)*pow(i+1,-1,M)%M\n\nprint((a%M))","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":146,"code_v1_num_chars":142,"code_v0_no_empty_lines":"M = 998244353\nn, m, k = list(map(int, input().split()))\na = 0\nc = 1\nfor i in range(k + 1):\n a += c * m * pow(m - 1, n - i - 1, M)\n c = c * (n - i - 1) * pow(i + 1, M - 2, M) % M\nprint((a % M))\n","code_v1_no_empty_lines":"M = 998244353\nn, m, k = list(map(int, input().split()))\na, c = 0, 1\nfor i in range(k + 1):\n a += c * m * pow(m - 1, n + ~i, M)\n c = c * (n + ~i) * pow(i + 1, -1, M) % M\nprint((a % M))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-a = 0","-c = 1","+a, c = 0, 1","- a += c * m * pow(m - 1, n - i - 1, M)","- c = c * (n - i - 1) * pow(i + 1, M - 2, M) % M","+ a += c * m * pow(m - 1, n + ~i, M)","+ c = c * (n + ~i) * pow(i + 1, -1, M) % M"],"diff_only_import_comment":false,"measured_runtime_v0":0.5053028598,"measured_runtime_v1":0.3381624324,"runtime_lift":1.4942607792,"key":["s693454638","s088786085"]} +{"user_id":"u038408819","problem_id":"p03680","language":"python","submission_id_v0":"s808331415","submission_id_v1":"s267927939","cpu_time_v0":450,"cpu_time_v1":202,"memory_v0":7084,"memory_v1":7084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\na = [int(eval(input())) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(10 ** 6):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\na = [int(eval(input())) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(len(a)):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":226,"code_v1_num_chars":225,"code_v0_no_empty_lines":"N = int(eval(input()))\na = [int(eval(input())) for _ in range(N)]\ncnt, i = 0, 0\nfor j in range(10**6):\n cnt += 1\n if a[i] == 2:\n print(cnt)\n # break\n quit()\n else:\n i = a[i] - 1\nprint((-1))\n","code_v1_no_empty_lines":"N = int(eval(input()))\na = [int(eval(input())) for _ in range(N)]\ncnt, i = 0, 0\nfor j in range(len(a)):\n cnt += 1\n if a[i] == 2:\n print(cnt)\n # break\n quit()\n else:\n i = a[i] - 1\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for j in range(10**6):","+for j in range(len(a)):"],"diff_only_import_comment":false,"measured_runtime_v0":0.6719723573,"measured_runtime_v1":0.1459480231,"runtime_lift":4.6041895124,"key":["s808331415","s267927939"]} +{"user_id":"u581511366","problem_id":"p02555","language":"python","submission_id_v0":"s399411060","submission_id_v1":"s856192378","cpu_time_v0":183,"cpu_time_v1":64,"memory_v0":72444,"memory_v1":63820,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\n\n\ndef combinations_count(n, r):\n\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n s = int(eval(input()))\n\n ans = 0\n\n n = s \/\/ 3\n\n\n\n for i in range(1, n + 1):\n\n ans += combinations_with_replacement_count(i, 3*(n-i)+s % 3)\n\n\n\n print((ans % (10**9 + 7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n s = int(eval(input()))\n\n dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]\n\n\n\n for i in range(6, s+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n\n\n print((dp[s] % (10**9+7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":24,"code_v1_loc":12,"code_v0_num_chars":468,"code_v1_num_chars":228,"code_v0_no_empty_lines":"import math\n\n\ndef combinations_count(n, r):\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\ndef combinations_with_replacement_count(n, r):\n return combinations_count(n + r - 1, r)\n\n\ndef main():\n s = int(eval(input()))\n ans = 0\n n = s \/\/ 3\n for i in range(1, n + 1):\n ans += combinations_with_replacement_count(i, 3 * (n - i) + s % 3)\n print((ans % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n s = int(eval(input()))\n dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]\n for i in range(6, s + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n print((dp[s] % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import math","-","-","-def combinations_count(n, r):","- return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))","-","-","-def combinations_with_replacement_count(n, r):","- return combinations_count(n + r - 1, r)","-","-","- ans = 0","- n = s \/\/ 3","- for i in range(1, n + 1):","- ans += combinations_with_replacement_count(i, 3 * (n - i) + s % 3)","- print((ans % (10**9 + 7)))","+ dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]","+ for i in range(6, s + 1):","+ dp[i] = dp[i - 1] + dp[i - 3]","+ print((dp[s] % (10**9 + 7)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2865847409,"measured_runtime_v1":0.2083418293,"runtime_lift":1.3755506603,"key":["s399411060","s856192378"]} +{"user_id":"u001024152","problem_id":"p03806","language":"python","submission_id_v0":"s636298531","submission_id_v1":"s857325561","cpu_time_v0":1682,"cpu_time_v1":292,"memory_v0":59496,"memory_v1":48860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nG_MAX = 40*10\n\nN_MAX = 40\n\nINF = float('inf')\n\n\n\ndp = [[[INF]*(G_MAX+1) for _ in range(G_MAX+1)] \n\n for _ in range(N_MAX+1)]\n\nN,Ma,Mb = list(map(int, input().split()))\n\na,b,c = [],[],[]\n\nfor _ in range(N):\n\n ai,bi,ci = list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\n c.append(ci)\n\n\n\ndp[0][0][0] = 0\n\nfrom math import isinf\n\nfor i in range(N):\n\n for ca in range(G_MAX+1):\n\n for cb in range(G_MAX+1):\n\n if isinf(dp[i][ca][cb]): continue\n\n dp[i+1][ca][cb] = min(dp[i+1][ca][cb],\n\n dp[i][ca][cb])\n\n dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]],\n\n dp[i][ca][cb]+c[i])\n\n \n\n \n\nans = INF\n\nfor ca in range(1,G_MAX+1):\n\n for cb in range(1,G_MAX+1):\n\n if ca*Mb==cb*Ma:\n\n ans = min(ans, dp[N][ca][cb])\n\n \n\nif isinf(ans): ans = -1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"from math import isinf\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\na = [0]*N\n\nb = [0]*N\n\nc = [0]*N\n\nfor i in range(N):\n\n a[i],b[i],c[i] = list(map(int, input().split()))\n\n\n\nW_MAX = 40*10\n\ndp = [[float('inf')]*(W_MAX+1) for _ in range(W_MAX+1)]\n\ndp[0][0] = 0\n\n\n\nfor i in range(N):\n\n for wa in reversed(list(range(W_MAX+1))):\n\n for wb in reversed(list(range(W_MAX+1))):\n\n if isinf(dp[wa][wb]): continue\n\n if wa+a[i]<=W_MAX and wb+b[i]<=W_MAX:\n\n dp[wa+a[i]][wb+b[i]] = min(dp[wa+a[i]][wb+b[i]],\n\n dp[wa][wb]+c[i])\n\n\n\nans = float('inf')\n\nfor wa in range(1, W_MAX+1):\n\n for wb in range(1, W_MAX+1):\n\n if wa*Mb == wb*Ma:\n\n ans = min(ans, dp[wa][wb])\n\n\n\nif isinf(ans): ans = -1\n\nprint(ans)","code_v0_loc":34,"code_v1_loc":29,"code_v0_num_chars":926,"code_v1_num_chars":775,"code_v0_no_empty_lines":"G_MAX = 40 * 10\nN_MAX = 40\nINF = float(\"inf\")\ndp = [[[INF] * (G_MAX + 1) for _ in range(G_MAX + 1)] for _ in range(N_MAX + 1)]\nN, Ma, Mb = list(map(int, input().split()))\na, b, c = [], [], []\nfor _ in range(N):\n ai, bi, ci = list(map(int, input().split()))\n a.append(ai)\n b.append(bi)\n c.append(ci)\ndp[0][0][0] = 0\nfrom math import isinf\n\nfor i in range(N):\n for ca in range(G_MAX + 1):\n for cb in range(G_MAX + 1):\n if isinf(dp[i][ca][cb]):\n continue\n dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb])\n dp[i + 1][ca + a[i]][cb + b[i]] = min(\n dp[i + 1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]\n )\nans = INF\nfor ca in range(1, G_MAX + 1):\n for cb in range(1, G_MAX + 1):\n if ca * Mb == cb * Ma:\n ans = min(ans, dp[N][ca][cb])\nif isinf(ans):\n ans = -1\nprint(ans)\n","code_v1_no_empty_lines":"from math import isinf\n\nN, Ma, Mb = list(map(int, input().split()))\na = [0] * N\nb = [0] * N\nc = [0] * N\nfor i in range(N):\n a[i], b[i], c[i] = list(map(int, input().split()))\nW_MAX = 40 * 10\ndp = [[float(\"inf\")] * (W_MAX + 1) for _ in range(W_MAX + 1)]\ndp[0][0] = 0\nfor i in range(N):\n for wa in reversed(list(range(W_MAX + 1))):\n for wb in reversed(list(range(W_MAX + 1))):\n if isinf(dp[wa][wb]):\n continue\n if wa + a[i] <= W_MAX and wb + b[i] <= W_MAX:\n dp[wa + a[i]][wb + b[i]] = min(\n dp[wa + a[i]][wb + b[i]], dp[wa][wb] + c[i]\n )\nans = float(\"inf\")\nfor wa in range(1, W_MAX + 1):\n for wb in range(1, W_MAX + 1):\n if wa * Mb == wb * Ma:\n ans = min(ans, dp[wa][wb])\nif isinf(ans):\n ans = -1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":14.7058823529,"diff":["-G_MAX = 40 * 10","-N_MAX = 40","-INF = float(\"inf\")","-dp = [[[INF] * (G_MAX + 1) for _ in range(G_MAX + 1)] for _ in range(N_MAX + 1)]","-N, Ma, Mb = list(map(int, input().split()))","-a, b, c = [], [], []","-for _ in range(N):","- ai, bi, ci = list(map(int, input().split()))","- a.append(ai)","- b.append(bi)","- c.append(ci)","-dp[0][0][0] = 0","+N, Ma, Mb = list(map(int, input().split()))","+a = [0] * N","+b = [0] * N","+c = [0] * N","- for ca in range(G_MAX + 1):","- for cb in range(G_MAX + 1):","- if isinf(dp[i][ca][cb]):","+ a[i], b[i], c[i] = list(map(int, input().split()))","+W_MAX = 40 * 10","+dp = [[float(\"inf\")] * (W_MAX + 1) for _ in range(W_MAX + 1)]","+dp[0][0] = 0","+for i in range(N):","+ for wa in reversed(list(range(W_MAX + 1))):","+ for wb in reversed(list(range(W_MAX + 1))):","+ if isinf(dp[wa][wb]):","- dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb])","- dp[i + 1][ca + a[i]][cb + b[i]] = min(","- dp[i + 1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]","- )","-ans = INF","-for ca in range(1, G_MAX + 1):","- for cb in range(1, G_MAX + 1):","- if ca * Mb == cb * Ma:","- ans = min(ans, dp[N][ca][cb])","+ if wa + a[i] <= W_MAX and wb + b[i] <= W_MAX:","+ dp[wa + a[i]][wb + b[i]] = min(","+ dp[wa + a[i]][wb + b[i]], dp[wa][wb] + c[i]","+ )","+ans = float(\"inf\")","+for wa in range(1, W_MAX + 1):","+ for wb in range(1, W_MAX + 1):","+ if wa * Mb == wb * Ma:","+ ans = min(ans, dp[wa][wb])"],"diff_only_import_comment":false,"measured_runtime_v0":2.4082550259,"measured_runtime_v1":0.8679478877,"runtime_lift":2.7746539396,"key":["s636298531","s857325561"]} +{"user_id":"u170183831","problem_id":"p03568","language":"python","submission_id_v0":"s971455595","submission_id_v1":"s272804435","cpu_time_v0":148,"cpu_time_v1":29,"memory_v0":9116,"memory_v1":9072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.41,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom itertools import product\n\n\n\nn = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\ncount = 0\n\nfor C in product((-1, 0, 1), repeat=n):\n\n total = 1\n\n for a, c in zip(A, C):\n\n total *= (a + c)\n\n if total % 2 == 0:\n\n count += 1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\ncount = 1\n\nfor a in A:\n\n count *= 2 if a % 2 == 0 else 1\n\nprint((3 ** n - count))","code_v0_loc":13,"code_v1_loc":7,"code_v0_num_chars":253,"code_v1_num_chars":137,"code_v0_no_empty_lines":"from itertools import product\n\nn = int(eval(input()))\nA = list(map(int, input().split()))\ncount = 0\nfor C in product((-1, 0, 1), repeat=n):\n total = 1\n for a, c in zip(A, C):\n total *= a + c\n if total % 2 == 0:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\ncount = 1\nfor a in A:\n count *= 2 if a % 2 == 0 else 1\nprint((3**n - count))\n","code_same":false,"relative_loc_diff_percent":46.1538461538,"diff":["-from itertools import product","-","-count = 0","-for C in product((-1, 0, 1), repeat=n):","- total = 1","- for a, c in zip(A, C):","- total *= a + c","- if total % 2 == 0:","- count += 1","-print(count)","+count = 1","+for a in A:","+ count *= 2 if a % 2 == 0 else 1","+print((3**n - count))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2956474931,"measured_runtime_v1":0.0067464924,"runtime_lift":43.8224007049,"key":["s971455595","s272804435"]} +{"user_id":"u655663334","problem_id":"p02690","language":"python","submission_id_v0":"s658520982","submission_id_v1":"s071725046","cpu_time_v0":70,"cpu_time_v1":60,"memory_v0":65588,"memory_v1":63880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nX = int(eval(input()))\n\n\n\ngojyous = []\n\n\n\nfor i in range(-200, 201):\n\n gojyous.append(i ** 5)\n\n\n\n#print(gojyous)\n\n\n\nfor i in range(-200,201):\n\n for j in range(-200,201):\n\n if(X == (int(i**5) - int(j**5))):\n\n print((i, j))\n\n exit()\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nX= int(eval(input()))\n\n\n\n#\u6dfb\u5b57\u306e\u6700\u5927\u5024\u3092\u7b97\u51fa\n\n\n\na = 1\n\nb = 0\n\ndif = 0\n\nwhile dif < 10**9:\n\n a += 1\n\n b += 1\n\n\n\n dif = a ** 5 - b ** 5\n\n\n\nloop_sequence = a - 1\n\n\n\nfor i in range(-(loop_sequence),loop_sequence):\n\n\tfor j in range(-(loop_sequence),loop_sequence):\n\n\t\tif(X == i ** 5 - j ** 5):\n\n\t\t\tprint((i,j))\n\n\t\t\tsys.exit()\n","code_v0_loc":14,"code_v1_loc":22,"code_v0_num_chars":257,"code_v1_num_chars":327,"code_v0_no_empty_lines":"X = int(eval(input()))\ngojyous = []\nfor i in range(-200, 201):\n gojyous.append(i**5)\n# print(gojyous)\nfor i in range(-200, 201):\n for j in range(-200, 201):\n if X == (int(i**5) - int(j**5)):\n print((i, j))\n exit()\n","code_v1_no_empty_lines":"import sys\n\nX = int(eval(input()))\n# \u6dfb\u5b57\u306e\u6700\u5927\u5024\u3092\u7b97\u51fa\na = 1\nb = 0\ndif = 0\nwhile dif < 10**9:\n a += 1\n b += 1\n dif = a**5 - b**5\nloop_sequence = a - 1\nfor i in range(-(loop_sequence), loop_sequence):\n for j in range(-(loop_sequence), loop_sequence):\n if X == i**5 - j**5:\n print((i, j))\n sys.exit()\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["+import sys","+","-gojyous = []","-for i in range(-200, 201):","- gojyous.append(i**5)","-# print(gojyous)","-for i in range(-200, 201):","- for j in range(-200, 201):","- if X == (int(i**5) - int(j**5)):","+# \u6dfb\u5b57\u306e\u6700\u5927\u5024\u3092\u7b97\u51fa","+a = 1","+b = 0","+dif = 0","+while dif < 10**9:","+ a += 1","+ b += 1","+ dif = a**5 - b**5","+loop_sequence = a - 1","+for i in range(-(loop_sequence), loop_sequence):","+ for j in range(-(loop_sequence), loop_sequence):","+ if X == i**5 - j**5:","- exit()","+ sys.exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.5855294764,"measured_runtime_v1":0.26911816,"runtime_lift":2.175733798,"key":["s658520982","s071725046"]} +{"user_id":"u440566786","problem_id":"p03164","language":"python","submission_id_v0":"s415436180","submission_id_v1":"s201445864","cpu_time_v0":345,"cpu_time_v1":221,"memory_v0":70988,"memory_v1":40176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.94,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n,W=list(map(int,input().split()))\n\n WV=[tuple(map(int,input().split())) for _ in range(n)]\n\n\n\n V=100000\n\n dp=[INF]*(V+1)\n\n dp[0]=0\n\n\n\n for w,v in WV:\n\n for x in range(V,-1,-1):\n\n if(x+v<=V):\n\n dp[x+v]=min(dp[x+v],dp[x]+w)\n\n\n\n for x in range(V,-1,-1):\n\n if(dp[x]<=W):\n\n print(x)\n\n return\n\nresolve()\n\n# optimized version of the same code:\n","target":"import sys\n\nINF = 1 << 60\n\nMOD = 10**9 + 7 # 998244353\n\nsys.setrecursionlimit(2147483647)\n\ninput = lambda:sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n, W = list(map(int, input().split()))\n\n dp = [INF] * (n * 1001 + 1)\n\n dp[0] = 0\n\n for _ in range(n):\n\n w, v = list(map(int, input().split()))\n\n for v0 in range(n * 1001, -1, -1):\n\n if dp[v0] == INF:\n\n continue\n\n if v + v0 <= n * 1001:\n\n dp[v + v0] = min(dp[v + v0], dp[v0] + w)\n\n for v in range(n * 1001, -1, -1):\n\n if dp[v] <= W:\n\n print(v)\n\n return\n\nresolve()","code_v0_loc":23,"code_v1_loc":21,"code_v0_num_chars":515,"code_v1_num_chars":614,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nMOD = 10**9 + 7\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n n, W = list(map(int, input().split()))\n WV = [tuple(map(int, input().split())) for _ in range(n)]\n V = 100000\n dp = [INF] * (V + 1)\n dp[0] = 0\n for w, v in WV:\n for x in range(V, -1, -1):\n if x + v <= V:\n dp[x + v] = min(dp[x + v], dp[x] + w)\n for x in range(V, -1, -1):\n if dp[x] <= W:\n print(x)\n return\n\n\nresolve()\n","code_v1_no_empty_lines":"import sys\n\nINF = 1 << 60\nMOD = 10**9 + 7 # 998244353\nsys.setrecursionlimit(2147483647)\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n n, W = list(map(int, input().split()))\n dp = [INF] * (n * 1001 + 1)\n dp[0] = 0\n for _ in range(n):\n w, v = list(map(int, input().split()))\n for v0 in range(n * 1001, -1, -1):\n if dp[v0] == INF:\n continue\n if v + v0 <= n * 1001:\n dp[v + v0] = min(dp[v + v0], dp[v0] + w)\n for v in range(n * 1001, -1, -1):\n if dp[v] <= W:\n print(v)\n return\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["+INF = 1 << 60","+MOD = 10**9 + 7 # 998244353","-INF = float(\"inf\")","-MOD = 10**9 + 7","- WV = [tuple(map(int, input().split())) for _ in range(n)]","- V = 100000","- dp = [INF] * (V + 1)","+ dp = [INF] * (n * 1001 + 1)","- for w, v in WV:","- for x in range(V, -1, -1):","- if x + v <= V:","- dp[x + v] = min(dp[x + v], dp[x] + w)","- for x in range(V, -1, -1):","- if dp[x] <= W:","- print(x)","+ for _ in range(n):","+ w, v = list(map(int, input().split()))","+ for v0 in range(n * 1001, -1, -1):","+ if dp[v0] == INF:","+ continue","+ if v + v0 <= n * 1001:","+ dp[v + v0] = min(dp[v + v0], dp[v0] + w)","+ for v in range(n * 1001, -1, -1):","+ if dp[v] <= W:","+ print(v)"],"diff_only_import_comment":false,"measured_runtime_v0":1.2692114379,"measured_runtime_v1":0.2021781888,"runtime_lift":6.2776872491,"key":["s415436180","s201445864"]} +{"user_id":"u764956288","problem_id":"p02691","language":"python","submission_id_v0":"s430506044","submission_id_v1":"s372862352","cpu_time_v0":215,"cpu_time_v1":188,"memory_v0":57704,"memory_v1":36612,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.56,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import defaultdict\n\n\n\n\n\ndef main():\n\n _ = int(eval(input()))\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n L[i + height] += 1\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n if i + height < N:\n\n L[i + height] += 1\n\n \n\n if i - height > 0:\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":30,"code_v1_loc":33,"code_v0_num_chars":565,"code_v1_num_chars":639,"code_v0_no_empty_lines":"from collections import defaultdict\n\n\ndef main():\n _ = int(eval(input()))\n heights = list(map(int, input().split()))\n \"\"\"\n for j>i, j-i = Ai + Aj\n i + Ai = j -Aj\n \"\"\"\n L = defaultdict(int)\n R = defaultdict(int)\n for i, height in enumerate(heights):\n L[i + height] += 1\n R[i - height] += 1\n total_count = 0\n for x, count_l in list(L.items()):\n if x in R:\n count_r = R[x]\n total_count += count_l * count_r\n print(total_count)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import defaultdict\n\n\ndef main():\n N = int(eval(input()))\n heights = list(map(int, input().split()))\n \"\"\"\n for j>i, j-i = Ai + Aj\n i + Ai = j -Aj\n \"\"\"\n L = defaultdict(int)\n R = defaultdict(int)\n for i, height in enumerate(heights):\n if i + height < N:\n L[i + height] += 1\n if i - height > 0:\n R[i - height] += 1\n total_count = 0\n for x, count_l in list(L.items()):\n if x in R:\n count_r = R[x]\n total_count += count_l * count_r\n print(total_count)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["- _ = int(eval(input()))","+ N = int(eval(input()))","- L[i + height] += 1","- R[i - height] += 1","+ if i + height < N:","+ L[i + height] += 1","+ if i - height > 0:","+ R[i - height] += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3616042199,"measured_runtime_v1":0.2114392846,"runtime_lift":1.7102035728,"key":["s430506044","s372862352"]} +{"user_id":"u747602774","problem_id":"p03039","language":"python","submission_id_v0":"s387237372","submission_id_v1":"s322645394","cpu_time_v0":230,"cpu_time_v1":47,"memory_v0":9412,"memory_v1":9476,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.57,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)\/\/2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)\/\/2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)\/\/2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n\n\n# optimized version of the same code:\n","target":"import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\nans = m*n*(m+n)*(m*n-1)\/\/3\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n","code_v0_loc":42,"code_v1_loc":27,"code_v0_num_chars":809,"code_v1_num_chars":519,"code_v0_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) \/\/ 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) \/\/ 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n a = n - x + 1\n b = m - y + 1\n c = m * (a * (a - 1) + x * (x - 1))\n d = n * (b * (b - 1) + y * (y - 1))\n ans += (c + d) \/\/ 2\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\nans = m * n * (m + n) * (m * n - 1) \/\/ 3\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-def f1(x, y, a, b):","- return (a + b - x - y) * (a - x + 1) * (b - y + 1) \/\/ 2","-","-","-def f2(x, a):","- return (a - x) * (a - x + 1) \/\/ 2","-","-","-ans = 0","-for x in range(1, n + 1):","- for y in range(1, m + 1):","- a = n - x + 1","- b = m - y + 1","- c = m * (a * (a - 1) + x * (x - 1))","- d = n * (b * (b - 1) + y * (y - 1))","- ans += (c + d) \/\/ 2","- ans %= mod","+ans = m * n * (m + n) * (m * n - 1) \/\/ 3"],"diff_only_import_comment":false,"measured_runtime_v0":0.3618569455,"measured_runtime_v1":0.2781652772,"runtime_lift":1.3008702923,"key":["s387237372","s322645394"]} +{"user_id":"u800396927","problem_id":"p03253","language":"python","submission_id_v0":"s723979708","submission_id_v1":"s327831897","cpu_time_v0":110,"cpu_time_v1":67,"memory_v0":10868,"memory_v1":66752,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.09,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,M = list(map(int,input().split()))\n\ndiv =[]\n\nfor i in range(2,int(M**(1\/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M = M\/\/i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1: div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum = len(frac)\n\nfor i in range(len(frac)-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1] * (N+50)\n\nfinv[-1] = pow(frac[-1], mod-2, mod)\n\nfor i in range(1, num):\n\n finv[num-1-i] = finv[num-i] * (num-i) % mod\n\nans = 1\n\nfor i in div:\n\n ans = ans * frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N,M = list(map(int,input().split()))\n\ndiv = []\n\nfor i in range(2,int(M**(1\/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M\/\/=i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1:div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum=len(frac)\n\nfor i in range(num-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1]*(N+50)\n\nfinv[-1] = pow(frac[-1],mod-2,mod)\n\nans = 1\n\nfor i in range(1,num):\n\n finv[num-1-i] = finv[num-i]*(num-i)%mod\n\nfor i in div:\n\n ans =ans*frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)","code_v0_loc":24,"code_v1_loc":24,"code_v0_num_chars":554,"code_v1_num_chars":534,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\ndiv = []\nfor i in range(2, int(M ** (1 \/ 2)) + 2):\n cur = 0\n while M % i == 0:\n M = M \/\/ i\n cur += 1\n if cur >= 1:\n div.append(cur)\nif M > 1:\n div.append(1)\ndiv.sort()\nmod = 10**9 + 7\nfrac = [1] * (N + 50)\nnum = len(frac)\nfor i in range(len(frac) - 1):\n frac[i + 1] = frac[i] * (i + 1) % mod\nfinv = [1] * (N + 50)\nfinv[-1] = pow(frac[-1], mod - 2, mod)\nfor i in range(1, num):\n finv[num - 1 - i] = finv[num - i] * (num - i) % mod\nans = 1\nfor i in div:\n ans = ans * frac[N + i - 1] * finv[N - 1] * finv[i] % mod\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\ndiv = []\nfor i in range(2, int(M ** (1 \/ 2)) + 2):\n cur = 0\n while M % i == 0:\n M \/\/= i\n cur += 1\n if cur >= 1:\n div.append(cur)\nif M > 1:\n div.append(1)\ndiv.sort()\nmod = 10**9 + 7\nfrac = [1] * (N + 50)\nnum = len(frac)\nfor i in range(num - 1):\n frac[i + 1] = frac[i] * (i + 1) % mod\nfinv = [1] * (N + 50)\nfinv[-1] = pow(frac[-1], mod - 2, mod)\nans = 1\nfor i in range(1, num):\n finv[num - 1 - i] = finv[num - i] * (num - i) % mod\nfor i in div:\n ans = ans * frac[N + i - 1] * finv[N - 1] * finv[i] % mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- M = M \/\/ i","+ M \/\/= i","-for i in range(len(frac) - 1):","+for i in range(num - 1):","+ans = 1","-ans = 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.47082161,"measured_runtime_v1":0.3749034932,"runtime_lift":1.2558474875,"key":["s723979708","s327831897"]} +{"user_id":"u290563917","problem_id":"p03371","language":"python","submission_id_v0":"s511736682","submission_id_v1":"s377839923","cpu_time_v0":188,"cpu_time_v1":64,"memory_v0":40940,"memory_v1":65396,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.96,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(c_max+1):\n\n ac = x - (cc \/\/ 2)\n\n bc = y - (cc \/\/ 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"a, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(0, c_max+1, 2):\n\n ac = x - (cc \/\/ 2)\n\n bc = y - (cc \/\/ 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)\n\n ","code_v0_loc":23,"code_v1_loc":24,"code_v0_num_chars":436,"code_v1_num_chars":446,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\n# print(a, b, c, x, y)\nans = 10000 * (10**5) + 7\nc_max = 0\nif x > y:\n c_max = x * 2\nelse:\n c_max = y * 2\nfor cc in range(c_max + 1):\n ac = x - (cc \/\/ 2)\n bc = y - (cc \/\/ 2)\n if ac < 0:\n ac = 0\n if bc < 0:\n bc = 0\n price = ac * a + bc * b + cc * c\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n ans = min(ans, price)\nprint(ans)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\n# print(a, b, c, x, y)\nans = 10000 * (10**5) + 7\nc_max = 0\nif x > y:\n c_max = x * 2\nelse:\n c_max = y * 2\nfor cc in range(0, c_max + 1, 2):\n ac = x - (cc \/\/ 2)\n bc = y - (cc \/\/ 2)\n if ac < 0:\n ac = 0\n if bc < 0:\n bc = 0\n price = ac * a + bc * b + cc * c\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n ans = min(ans, price)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":4.1666666667,"diff":["-for cc in range(c_max + 1):","+for cc in range(0, c_max + 1, 2):"],"diff_only_import_comment":false,"measured_runtime_v0":0.4004499781,"measured_runtime_v1":0.3093135242,"runtime_lift":1.2946410251,"key":["s511736682","s377839923"]} +{"user_id":"u887207211","problem_id":"p03425","language":"python","submission_id_v0":"s819679830","submission_id_v1":"s546088432","cpu_time_v0":172,"cpu_time_v1":153,"memory_v0":3064,"memory_v1":9752,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.05,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nname = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor _ in range(N):\n\n S = eval(input())\n\n if(S[0] in name):\n\n name[S[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += name[march[i]] * name[march[j]] * name[march[k]]\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nS = [eval(input()) for _ in range(N)]\n\n\n\nhead = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor s in S:\n\n if(s[0] in head):\n\n head[s[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += head[march[i]] * head[march[j]] * head[march[k]]\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":14,"code_v0_num_chars":312,"code_v1_num_chars":325,"code_v0_no_empty_lines":"N = int(eval(input()))\nname = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}\nmarch = \"MARCH\"\nfor _ in range(N):\n S = eval(input())\n if S[0] in name:\n name[S[0]] += 1\nans = 0\nfor i in range(3):\n for j in range(i + 1, 4):\n for k in range(j + 1, 5):\n ans += name[march[i]] * name[march[j]] * name[march[k]]\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = [eval(input()) for _ in range(N)]\nhead = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}\nmarch = \"MARCH\"\nfor s in S:\n if s[0] in head:\n head[s[0]] += 1\nans = 0\nfor i in range(3):\n for j in range(i + 1, 4):\n for k in range(j + 1, 5):\n ans += head[march[i]] * head[march[j]] * head[march[k]]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-name = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}","+S = [eval(input()) for _ in range(N)]","+head = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}","-for _ in range(N):","- S = eval(input())","- if S[0] in name:","- name[S[0]] += 1","+for s in S:","+ if s[0] in head:","+ head[s[0]] += 1","- ans += name[march[i]] * name[march[j]] * name[march[k]]","+ ans += head[march[i]] * head[march[j]] * head[march[k]]"],"diff_only_import_comment":false,"measured_runtime_v0":0.4009393435,"measured_runtime_v1":0.3106073449,"runtime_lift":1.2908237686,"key":["s819679830","s546088432"]} +{"user_id":"u023958502","problem_id":"p02899","language":"python","submission_id_v0":"s601919152","submission_id_v1":"s937084523","cpu_time_v0":140,"cpu_time_v1":86,"memory_v0":19300,"memory_v1":15588,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.57,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\na = list(map(int,input().split()))\n\nans = [i for i in range(n)]\n\na1 = sorted(a)\n\nfor i in range(n):\n\n num = a[i]\n\n ans[num - 1] = str(i + 1)\n\n \n\nprint((' '.join(ans)))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\n# n,k = map(int,input().split())\n\na = list(map(int,input().split()))\n\nans = [0 for _ in range(n)]\n\nfor i in range(n):\n\n ans[a[i] - 1] = str(i + 1)\n\nprint((\" \".join(ans)))","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":192,"code_v1_num_chars":187,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nans = [i for i in range(n)]\na1 = sorted(a)\nfor i in range(n):\n num = a[i]\n ans[num - 1] = str(i + 1)\nprint((\" \".join(ans)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\n# n,k = map(int,input().split())\na = list(map(int, input().split()))\nans = [0 for _ in range(n)]\nfor i in range(n):\n ans[a[i] - 1] = str(i + 1)\nprint((\" \".join(ans)))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["+# n,k = map(int,input().split())","-ans = [i for i in range(n)]","-a1 = sorted(a)","+ans = [0 for _ in range(n)]","- num = a[i]","- ans[num - 1] = str(i + 1)","+ ans[a[i] - 1] = str(i + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2984062884,"measured_runtime_v1":0.2260574257,"runtime_lift":1.3200463887,"key":["s601919152","s937084523"]} +{"user_id":"u981931040","problem_id":"p02574","language":"python","submission_id_v0":"s619395499","submission_id_v1":"s155750651","cpu_time_v0":1188,"cpu_time_v1":436,"memory_v0":126768,"memory_v1":188012,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.3,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nclass prime_factorize_by_osa_k():\n\n def __init__(self, max_val):\n\n '''\n\n \u5272\u308b\u3053\u3068\u304c\u51fa\u6765\u308b\u6700\u5c0f\u306e\u5024\u3092\u683c\u7d0d\u3057\u305f\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n\n :param max_val:\n\n :return:\n\n '''\n\n self.minFactor = [-1] * (max_val + 1)\n\n for i in range(2, max_val + 1):\n\n if self.minFactor[i] == -1:\n\n self.minFactor[i] = i\n\n # \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u3068\u540c\u69d8\u306e\u51e6\u7406\u3092\u884c\u3046\n\n for j in range(i * i, max_val + 1, i):\n\n if self.minFactor[j] == -1:\n\n self.minFactor[j] = i\n\n\n\n def osa_k(self, n):\n\n '''\n\n preprocess\u3092\u3057\u305f\u3042\u3068\u3001O(logN)\u3067\u7d20\u56e0\u6570\u5206\u89e3\u3092\u884c\u3046\u3002n\u306e\u6700\u5927\u5024\u3092n_max\u3068\u3059\u308b\u3002\n\n :param n:\n\n :return:\n\n '''\n\n from collections import defaultdict\n\n d = defaultdict(int)\n\n now = n\n\n while now > 1:\n\n d[self.minFactor[now]] += 1\n\n now \/\/= self.minFactor[now]\n\n return d\n\ndef gcd(a, b):\n\n while b: a, b = b, a % b\n\n return a\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n# N = 10 ** 6\n\n# A = [10 ** 6] * N\n\nob = prime_factorize_by_osa_k(10 ** 6)\n\npairwise = False\n\nprime_key = set(ob.osa_k(A[-1]).keys())\n\nbreak_flag = False\n\nprime_flags = [False] * (10 ** 6 + 1)\n\nfor i in range(N):\n\n for key in list(ob.osa_k(A[i]).keys()):\n\n if prime_flags[key]:\n\n break_flag = True\n\n break\n\n else:\n\n prime_flags[key] = True\n\n if break_flag:\n\n break\n\nelse:\n\n pairwise = True\n\nif pairwise:\n\n print('pairwise coprime')\n\n exit()\n\nwork = gcd(A[0], A[1])\n\nfor i in range(2, N):\n\n work = gcd(work, A[i])\n\nif work != 1:\n\n print('not coprime')\n\nelse:\n\n print('setwise coprime')\n\n# optimized version of the same code:\n","target":"def gcd(a, b):\n\n while b: a, b = b, a % b\n\n return a\n\ndef isPrimeMR(n):\n\n d = n - 1\n\n d = d \/\/ (d & -d)\n\n L = [2]\n\n for a in L:\n\n t = d\n\n y = pow(a, t, n)\n\n if y == 1: continue\n\n while y != n - 1:\n\n y = (y * y) % n\n\n if y == 1 or t == n - 1: return 0\n\n t <<= 1\n\n return 1\n\ndef findFactorRho(n):\n\n m = 1 << n.bit_length() \/\/ 8\n\n for c in range(1, 99):\n\n f = lambda x: (x * x + c) % n\n\n y, r, q, g = 2, 1, 1, 1\n\n while g == 1:\n\n x = y\n\n for i in range(r):\n\n y = f(y)\n\n k = 0\n\n while k < r and g == 1:\n\n ys = y\n\n for i in range(min(m, r - k)):\n\n y = f(y)\n\n q = q * abs(x - y) % n\n\n g = gcd(q, n)\n\n k += m\n\n r <<= 1\n\n if g == n:\n\n g = 1\n\n while g == 1:\n\n ys = f(ys)\n\n g = gcd(abs(x - ys), n)\n\n if g < n:\n\n if isPrimeMR(g): return g\n\n elif isPrimeMR(n \/\/ g): return n \/\/ g\n\n return findFactorRho(g)\n\ndef primeFactor(n):\n\n i = 2\n\n ret = {}\n\n rhoFlg = 0\n\n while i*i <= n:\n\n k = 0\n\n while n % i == 0:\n\n n \/\/= i\n\n k += 1\n\n if k: ret[i] = k\n\n i += 1 + i % 2\n\n if i == 101 and n >= 2 ** 20:\n\n while n > 1:\n\n if isPrimeMR(n):\n\n ret[n], n = 1, 1\n\n else:\n\n rhoFlg = 1\n\n j = findFactorRho(n)\n\n k = 0\n\n while n % j == 0:\n\n n \/\/= j\n\n k += 1\n\n ret[j] = k\n\n\n\n if n > 1: ret[n] = 1\n\n if rhoFlg: ret = {x: ret[x] for x in sorted(ret)}\n\n return ret\n\ndef gcd(a, b):\n\n while b: a, b = b, a % b\n\n return a\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n# N = 10 ** 6\n\n# A = [10 ** 6] * N\n\npairwise = False\n\nprime_key = set(primeFactor(A[-1]).keys())\n\nbreak_flag = False\n\nprime_flags = [False] * (10 ** 6 + 1)\n\nfor i in range(N):\n\n for key in list(primeFactor(A[i]).keys()):\n\n if prime_flags[key]:\n\n break_flag = True\n\n break\n\n else:\n\n prime_flags[key] = True\n\n if break_flag:\n\n break\n\nelse:\n\n pairwise = True\n\nif pairwise:\n\n print('pairwise coprime')\n\n exit()\n\nwork = gcd(A[0], A[1])\n\nfor i in range(2, N):\n\n work = gcd(work, A[i])\n\nif work != 1:\n\n print('not coprime')\n\nelse:\n\n print('setwise coprime')","code_v0_loc":63,"code_v1_loc":103,"code_v0_num_chars":1666,"code_v1_num_chars":2622,"code_v0_no_empty_lines":"class prime_factorize_by_osa_k:\n def __init__(self, max_val):\n \"\"\"\n \u5272\u308b\u3053\u3068\u304c\u51fa\u6765\u308b\u6700\u5c0f\u306e\u5024\u3092\u683c\u7d0d\u3057\u305f\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n :param max_val:\n :return:\n \"\"\"\n self.minFactor = [-1] * (max_val + 1)\n for i in range(2, max_val + 1):\n if self.minFactor[i] == -1:\n self.minFactor[i] = i\n # \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u3068\u540c\u69d8\u306e\u51e6\u7406\u3092\u884c\u3046\n for j in range(i * i, max_val + 1, i):\n if self.minFactor[j] == -1:\n self.minFactor[j] = i\n\n def osa_k(self, n):\n \"\"\"\n preprocess\u3092\u3057\u305f\u3042\u3068\u3001O(logN)\u3067\u7d20\u56e0\u6570\u5206\u89e3\u3092\u884c\u3046\u3002n\u306e\u6700\u5927\u5024\u3092n_max\u3068\u3059\u308b\u3002\n :param n:\n :return:\n \"\"\"\n from collections import defaultdict\n\n d = defaultdict(int)\n now = n\n while now > 1:\n d[self.minFactor[now]] += 1\n now \/\/= self.minFactor[now]\n return d\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\n# N = 10 ** 6\n# A = [10 ** 6] * N\nob = prime_factorize_by_osa_k(10**6)\npairwise = False\nprime_key = set(ob.osa_k(A[-1]).keys())\nbreak_flag = False\nprime_flags = [False] * (10**6 + 1)\nfor i in range(N):\n for key in list(ob.osa_k(A[i]).keys()):\n if prime_flags[key]:\n break_flag = True\n break\n else:\n prime_flags[key] = True\n if break_flag:\n break\nelse:\n pairwise = True\nif pairwise:\n print(\"pairwise coprime\")\n exit()\nwork = gcd(A[0], A[1])\nfor i in range(2, N):\n work = gcd(work, A[i])\nif work != 1:\n print(\"not coprime\")\nelse:\n print(\"setwise coprime\")\n","code_v1_no_empty_lines":"def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef isPrimeMR(n):\n d = n - 1\n d = d \/\/ (d & -d)\n L = [2]\n for a in L:\n t = d\n y = pow(a, t, n)\n if y == 1:\n continue\n while y != n - 1:\n y = (y * y) % n\n if y == 1 or t == n - 1:\n return 0\n t <<= 1\n return 1\n\n\ndef findFactorRho(n):\n m = 1 << n.bit_length() \/\/ 8\n for c in range(1, 99):\n f = lambda x: (x * x + c) % n\n y, r, q, g = 2, 1, 1, 1\n while g == 1:\n x = y\n for i in range(r):\n y = f(y)\n k = 0\n while k < r and g == 1:\n ys = y\n for i in range(min(m, r - k)):\n y = f(y)\n q = q * abs(x - y) % n\n g = gcd(q, n)\n k += m\n r <<= 1\n if g == n:\n g = 1\n while g == 1:\n ys = f(ys)\n g = gcd(abs(x - ys), n)\n if g < n:\n if isPrimeMR(g):\n return g\n elif isPrimeMR(n \/\/ g):\n return n \/\/ g\n return findFactorRho(g)\n\n\ndef primeFactor(n):\n i = 2\n ret = {}\n rhoFlg = 0\n while i * i <= n:\n k = 0\n while n % i == 0:\n n \/\/= i\n k += 1\n if k:\n ret[i] = k\n i += 1 + i % 2\n if i == 101 and n >= 2**20:\n while n > 1:\n if isPrimeMR(n):\n ret[n], n = 1, 1\n else:\n rhoFlg = 1\n j = findFactorRho(n)\n k = 0\n while n % j == 0:\n n \/\/= j\n k += 1\n ret[j] = k\n if n > 1:\n ret[n] = 1\n if rhoFlg:\n ret = {x: ret[x] for x in sorted(ret)}\n return ret\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\n# N = 10 ** 6\n# A = [10 ** 6] * N\npairwise = False\nprime_key = set(primeFactor(A[-1]).keys())\nbreak_flag = False\nprime_flags = [False] * (10**6 + 1)\nfor i in range(N):\n for key in list(primeFactor(A[i]).keys()):\n if prime_flags[key]:\n break_flag = True\n break\n else:\n prime_flags[key] = True\n if break_flag:\n break\nelse:\n pairwise = True\nif pairwise:\n print(\"pairwise coprime\")\n exit()\nwork = gcd(A[0], A[1])\nfor i in range(2, N):\n work = gcd(work, A[i])\nif work != 1:\n print(\"not coprime\")\nelse:\n print(\"setwise coprime\")\n","code_same":false,"relative_loc_diff_percent":38.8349514563,"diff":["-class prime_factorize_by_osa_k:","- def __init__(self, max_val):","- \"\"\"","- \u5272\u308b\u3053\u3068\u304c\u51fa\u6765\u308b\u6700\u5c0f\u306e\u5024\u3092\u683c\u7d0d\u3057\u305f\u30ea\u30b9\u30c8\u3092\u8fd4\u3059","- :param max_val:","- :return:","- \"\"\"","- self.minFactor = [-1] * (max_val + 1)","- for i in range(2, max_val + 1):","- if self.minFactor[i] == -1:","- self.minFactor[i] = i","- # \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\u3068\u540c\u69d8\u306e\u51e6\u7406\u3092\u884c\u3046","- for j in range(i * i, max_val + 1, i):","- if self.minFactor[j] == -1:","- self.minFactor[j] = i","+def gcd(a, b):","+ while b:","+ a, b = b, a % b","+ return a","- def osa_k(self, n):","- \"\"\"","- preprocess\u3092\u3057\u305f\u3042\u3068\u3001O(logN)\u3067\u7d20\u56e0\u6570\u5206\u89e3\u3092\u884c\u3046\u3002n\u306e\u6700\u5927\u5024\u3092n_max\u3068\u3059\u308b\u3002","- :param n:","- :return:","- \"\"\"","- from collections import defaultdict","- d = defaultdict(int)","- now = n","- while now > 1:","- d[self.minFactor[now]] += 1","- now \/\/= self.minFactor[now]","- return d","+def isPrimeMR(n):","+ d = n - 1","+ d = d \/\/ (d & -d)","+ L = [2]","+ for a in L:","+ t = d","+ y = pow(a, t, n)","+ if y == 1:","+ continue","+ while y != n - 1:","+ y = (y * y) % n","+ if y == 1 or t == n - 1:","+ return 0","+ t <<= 1","+ return 1","+","+","+def findFactorRho(n):","+ m = 1 << n.bit_length() \/\/ 8","+ for c in range(1, 99):","+ f = lambda x: (x * x + c) % n","+ y, r, q, g = 2, 1, 1, 1","+ while g == 1:","+ x = y","+ for i in range(r):","+ y = f(y)","+ k = 0","+ while k < r and g == 1:","+ ys = y","+ for i in range(min(m, r - k)):","+ y = f(y)","+ q = q * abs(x - y) % n","+ g = gcd(q, n)","+ k += m","+ r <<= 1","+ if g == n:","+ g = 1","+ while g == 1:","+ ys = f(ys)","+ g = gcd(abs(x - ys), n)","+ if g < n:","+ if isPrimeMR(g):","+ return g","+ elif isPrimeMR(n \/\/ g):","+ return n \/\/ g","+ return findFactorRho(g)","+","+","+def primeFactor(n):","+ i = 2","+ ret = {}","+ rhoFlg = 0","+ while i * i <= n:","+ k = 0","+ while n % i == 0:","+ n \/\/= i","+ k += 1","+ if k:","+ ret[i] = k","+ i += 1 + i % 2","+ if i == 101 and n >= 2**20:","+ while n > 1:","+ if isPrimeMR(n):","+ ret[n], n = 1, 1","+ else:","+ rhoFlg = 1","+ j = findFactorRho(n)","+ k = 0","+ while n % j == 0:","+ n \/\/= j","+ k += 1","+ ret[j] = k","+ if n > 1:","+ ret[n] = 1","+ if rhoFlg:","+ ret = {x: ret[x] for x in sorted(ret)}","+ return ret","-ob = prime_factorize_by_osa_k(10**6)","-prime_key = set(ob.osa_k(A[-1]).keys())","+prime_key = set(primeFactor(A[-1]).keys())","- for key in list(ob.osa_k(A[i]).keys()):","+ for key in list(primeFactor(A[i]).keys()):"],"diff_only_import_comment":false,"measured_runtime_v0":3.7835959957,"measured_runtime_v1":0.3455400517,"runtime_lift":10.9498044495,"key":["s619395499","s155750651"]} +{"user_id":"u600402037","problem_id":"p03074","language":"python","submission_id_v0":"s931234571","submission_id_v1":"s204237470","cpu_time_v0":1852,"cpu_time_v1":78,"memory_v0":16724,"memory_v1":7924,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN, K = list(map(int, input().split()))\n\nS = list(eval(input())) + ['2']\n\n\n\nblocks = []\n\ncur = 1\n\nseq = 0\n\nfor s in S:\n\n if int(s) == cur:\n\n seq += 1\n\n else:\n\n blocks.append(seq)\n\n cur = 1 - cur\n\n seq = 1\n\nanswer = 0\n\nblocks = np.array(blocks)\n\nfor i in range(0, len(blocks), 2):\n\n answer = max(answer, blocks[i:i+2*K+1].sum())\n\nprint(answer)\n\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nimport sys\n\nimport itertools\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\n# 0\u304b1\u306e\u9023\u7d9a\u3057\u3066\u3044\u308b\u4eba\u6570\u306e\u30ea\u30b9\u30c8\u3001\u7d2f\u7a4d\u548c\n\nstreak = [0, 0]\n\nN, K = lr()\n\nS = sr() + '2'\n\ncur = 1\n\nfor i in range(N):\n\n if S[i] != S[i+1]:\n\n streak.append(cur)\n\n cur = 1\n\n else:\n\n cur += 1\n\n\n\nstreak_cum = list(itertools.accumulate(streak))\n\nstreak_cum.extend([streak_cum[-1], streak_cum[-1]])\n\nif S[0] == '0':\n\n start = 0\n\nelse:\n\n start = 1\n\nanswer = 0\n\n\n\nlimit = len(streak_cum) - 1\n\nfor i in range(start, len(streak_cum), 2):\n\n result = streak_cum[min(limit, i+2*K+1)] - streak_cum[i]\n\n if result > answer:\n\n answer = result\n\n\n\nprint(answer)\n\n# 52","code_v0_loc":20,"code_v1_loc":36,"code_v0_num_chars":389,"code_v1_num_chars":737,"code_v0_no_empty_lines":"import numpy as np\n\nN, K = list(map(int, input().split()))\nS = list(eval(input())) + [\"2\"]\nblocks = []\ncur = 1\nseq = 0\nfor s in S:\n if int(s) == cur:\n seq += 1\n else:\n blocks.append(seq)\n cur = 1 - cur\n seq = 1\nanswer = 0\nblocks = np.array(blocks)\nfor i in range(0, len(blocks), 2):\n answer = max(answer, blocks[i : i + 2 * K + 1].sum())\nprint(answer)\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\nimport itertools\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n# 0\u304b1\u306e\u9023\u7d9a\u3057\u3066\u3044\u308b\u4eba\u6570\u306e\u30ea\u30b9\u30c8\u3001\u7d2f\u7a4d\u548c\nstreak = [0, 0]\nN, K = lr()\nS = sr() + \"2\"\ncur = 1\nfor i in range(N):\n if S[i] != S[i + 1]:\n streak.append(cur)\n cur = 1\n else:\n cur += 1\nstreak_cum = list(itertools.accumulate(streak))\nstreak_cum.extend([streak_cum[-1], streak_cum[-1]])\nif S[0] == \"0\":\n start = 0\nelse:\n start = 1\nanswer = 0\nlimit = len(streak_cum) - 1\nfor i in range(start, len(streak_cum), 2):\n result = streak_cum[min(limit, i + 2 * K + 1)] - streak_cum[i]\n if result > answer:\n answer = result\nprint(answer)\n# 52\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-import numpy as np","+# coding: utf-8","+import sys","+import itertools","-N, K = list(map(int, input().split()))","-S = list(eval(input())) + [\"2\"]","-blocks = []","+sr = lambda: sys.stdin.readline().rstrip()","+ir = lambda: int(sr())","+lr = lambda: list(map(int, sr().split()))","+# 0\u304b1\u306e\u9023\u7d9a\u3057\u3066\u3044\u308b\u4eba\u6570\u306e\u30ea\u30b9\u30c8\u3001\u7d2f\u7a4d\u548c","+streak = [0, 0]","+N, K = lr()","+S = sr() + \"2\"","-seq = 0","-for s in S:","- if int(s) == cur:","- seq += 1","+for i in range(N):","+ if S[i] != S[i + 1]:","+ streak.append(cur)","+ cur = 1","- blocks.append(seq)","- cur = 1 - cur","- seq = 1","+ cur += 1","+streak_cum = list(itertools.accumulate(streak))","+streak_cum.extend([streak_cum[-1], streak_cum[-1]])","+if S[0] == \"0\":","+ start = 0","+else:","+ start = 1","-blocks = np.array(blocks)","-for i in range(0, len(blocks), 2):","- answer = max(answer, blocks[i : i + 2 * K + 1].sum())","+limit = len(streak_cum) - 1","+for i in range(start, len(streak_cum), 2):","+ result = streak_cum[min(limit, i + 2 * K + 1)] - streak_cum[i]","+ if result > answer:","+ answer = result","+# 52"],"diff_only_import_comment":false,"measured_runtime_v0":1.9750818772,"measured_runtime_v1":0.2859025445,"runtime_lift":6.9082346945,"key":["s931234571","s204237470"]} +{"user_id":"u315485238","problem_id":"p03945","language":"python","submission_id_v0":"s413240170","submission_id_v1":"s770974666","cpu_time_v0":334,"cpu_time_v1":28,"memory_v0":22828,"memory_v1":3956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nS=eval(input())\n\nS=np.array([1 if s=='B' else 0 for s in S])\n\n\n\nprint((np.abs(np.diff(S)).sum()))\n\n\n# optimized version of the same code:\n","target":"from itertools import groupby\n\n\n\nS=eval(input())\n\nanswer = sum([1 for _ in groupby(S)]) -1\n\n\n\nprint(answer)","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":112,"code_v1_num_chars":101,"code_v0_no_empty_lines":"import numpy as np\n\nS = eval(input())\nS = np.array([1 if s == \"B\" else 0 for s in S])\nprint((np.abs(np.diff(S)).sum()))\n","code_v1_no_empty_lines":"from itertools import groupby\n\nS = eval(input())\nanswer = sum([1 for _ in groupby(S)]) - 1\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","+from itertools import groupby","-S = np.array([1 if s == \"B\" else 0 for s in S])","-print((np.abs(np.diff(S)).sum()))","+answer = sum([1 for _ in groupby(S)]) - 1","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3748412957,"measured_runtime_v1":0.214818702,"runtime_lift":6.400007462,"key":["s413240170","s770974666"]} +{"user_id":"u312025627","problem_id":"p02901","language":"python","submission_id_v0":"s827366183","submission_id_v1":"s086626630","cpu_time_v0":364,"cpu_time_v1":311,"memory_v0":78552,"memory_v1":75116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.56,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nINF = 2*10**7\n\n\n\n\n\ndef main():\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"INF = 2*10**7\n\n\n\n\n\ndef main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":34,"code_v1_loc":36,"code_v0_num_chars":827,"code_v1_num_chars":882,"code_v0_no_empty_lines":"INF = 2 * 10**7\n\n\ndef main():\n N, M = (int(i) for i in input().split())\n A = []\n B = []\n C = []\n for _ in range(M):\n a, b = (int(i) for i in input().split())\n A.append(a)\n B.append(b)\n bit = 0\n for i in input().split():\n bit |= 1 << (int(i) - 1)\n C.append(bit)\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n if dp[i][j] != INF:\n next_bit = j | C[i]\n dp[i + 1][next_bit] = min(dp[i + 1][next_bit], dp[i][j] + A[i])\n ans = dp[-1][-1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n # print(*dp, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"INF = 2 * 10**7\n\n\ndef main():\n import sys\n\n input = sys.stdin.buffer.readline\n N, M = (int(i) for i in input().split())\n A = []\n B = []\n C = []\n for _ in range(M):\n a, b = (int(i) for i in input().split())\n A.append(a)\n B.append(b)\n bit = 0\n for i in input().split():\n bit |= 1 << (int(i) - 1)\n C.append(bit)\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n if dp[i][j] != INF:\n next_bit = j | C[i]\n dp[i + 1][next_bit] = min(dp[i + 1][next_bit], dp[i][j] + A[i])\n ans = dp[-1][-1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n # print(*dp, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["+ import sys","+","+ input = sys.stdin.buffer.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.4147989278,"measured_runtime_v1":0.289175185,"runtime_lift":1.4344208955,"key":["s827366183","s086626630"]} +{"user_id":"u025501820","problem_id":"p03575","language":"python","submission_id_v0":"s588340205","submission_id_v1":"s864359385","cpu_time_v0":156,"cpu_time_v1":24,"memory_v0":12108,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env python3\n\nclass UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n \n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n \n\nimport numpy as np\n\nN, M = list(map(int, input().split()))\n\nedge = []\n\nfor _ in range(M):\n\n edge.append(list(map(int, input().split())))\n\nans = 0 \n\nfor i in range(M):\n\n unionfind = UnionFind(N)\n\n for j in [k for k in range(M) if k != i]:\n\n a, b = edge[j][0] - 1, edge[j][1] - 1\n\n unionfind.union(a, b)\n\n if np.count_nonzero(np.array(unionfind.parents) < 0) >= 2:\n\n ans += 1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\nfrom collections import deque\n\nN, M = list(map(int, input().split()))\n\nedge = []\n\nfor _ in range(M):\n\n edge.append(list(map(int, input().split())))\n\nans = 0 \n\nfor i in range(M):\n\n done = [True for _ in range(N + 1)]\n\n renketu = [[] for _ in range(N + 1)]\n\n for j in [k for k in range(M) if k != i]:\n\n a, b = edge[j][0], edge[j][1]\n\n renketu[a].append(b)\n\n renketu[b].append(a)\n\n q = deque([1])\n\n while q:\n\n now = q.pop()\n\n done[now] = False\n\n\n\n for r in renketu[now]:\n\n if done[r]:\n\n q.append(r)\n\n if sum(done) > 1:\n\n ans += 1\n\nprint(ans)","code_v0_loc":44,"code_v1_loc":25,"code_v0_num_chars":1090,"code_v1_num_chars":652,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nclass UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n\nimport numpy as np\n\nN, M = list(map(int, input().split()))\nedge = []\nfor _ in range(M):\n edge.append(list(map(int, input().split())))\nans = 0\nfor i in range(M):\n unionfind = UnionFind(N)\n for j in [k for k in range(M) if k != i]:\n a, b = edge[j][0] - 1, edge[j][1] - 1\n unionfind.union(a, b)\n if np.count_nonzero(np.array(unionfind.parents) < 0) >= 2:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nfrom collections import deque\n\nN, M = list(map(int, input().split()))\nedge = []\nfor _ in range(M):\n edge.append(list(map(int, input().split())))\nans = 0\nfor i in range(M):\n done = [True for _ in range(N + 1)]\n renketu = [[] for _ in range(N + 1)]\n for j in [k for k in range(M) if k != i]:\n a, b = edge[j][0], edge[j][1]\n renketu[a].append(b)\n renketu[b].append(a)\n q = deque([1])\n while q:\n now = q.pop()\n done[now] = False\n for r in renketu[now]:\n if done[r]:\n q.append(r)\n if sum(done) > 1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":43.1818181818,"diff":["-class UnionFind:","- def __init__(self, n):","- self.n = n","- self.parents = [-1] * n","-","- def find(self, x):","- if self.parents[x] < 0:","- return x","- else:","- self.parents[x] = self.find(self.parents[x])","- return self.parents[x]","-","- def union(self, x, y):","- x = self.find(x)","- y = self.find(y)","- if x == y:","- return","- if self.parents[x] > self.parents[y]:","- x, y = y, x","- self.parents[x] += self.parents[y]","- self.parents[y] = x","-","- def same(self, x, y):","- return self.find(x) == self.find(y)","-","-","-import numpy as np","+from collections import deque","- unionfind = UnionFind(N)","+ done = [True for _ in range(N + 1)]","+ renketu = [[] for _ in range(N + 1)]","- a, b = edge[j][0] - 1, edge[j][1] - 1","- unionfind.union(a, b)","- if np.count_nonzero(np.array(unionfind.parents) < 0) >= 2:","+ a, b = edge[j][0], edge[j][1]","+ renketu[a].append(b)","+ renketu[b].append(a)","+ q = deque([1])","+ while q:","+ now = q.pop()","+ done[now] = False","+ for r in renketu[now]:","+ if done[r]:","+ q.append(r)","+ if sum(done) > 1:"],"diff_only_import_comment":false,"measured_runtime_v0":1.8508614221,"measured_runtime_v1":0.3169867847,"runtime_lift":5.8389229815,"key":["s588340205","s864359385"]} +{"user_id":"u123942276","problem_id":"p03494","language":"python","submission_id_v0":"s417323905","submission_id_v1":"s556297736","cpu_time_v0":112,"cpu_time_v1":29,"memory_v0":26812,"memory_v1":9020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nA = np.array(list(map(int, input().split())))\n\ncount = 0\n\nwhile True:\n\n if np.sum(A%2) > 0:\n\n break\n\n count +=1\n\n A = A\/\/2\n\nprint(count)\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\nans = float(\"inf\")\n\n\n\nfor i in a:\n\n ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1) # (1)\u20262\u3067\u5272\u3063\u305f\u56de\u6570\u304c\u6700\u5c0f\u306e\u3082\u306e\u3092\u63a2\u7d22\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":191,"code_v1_num_chars":182,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = np.array(list(map(int, input().split())))\ncount = 0\nwhile True:\n if np.sum(A % 2) > 0:\n break\n count += 1\n A = A \/\/ 2\nprint(count)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in a:\n ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1) # (1)\u20262\u3067\u5272\u3063\u305f\u56de\u6570\u304c\u6700\u5c0f\u306e\u3082\u306e\u3092\u63a2\u7d22\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import numpy as np","-","-N = int(eval(input()))","-A = np.array(list(map(int, input().split())))","-count = 0","-while True:","- if np.sum(A % 2) > 0:","- break","- count += 1","- A = A \/\/ 2","-print(count)","+n = int(eval(input()))","+a = list(map(int, input().split()))","+ans = float(\"inf\")","+for i in a:","+ ans = min(ans, len(bin(i)) - bin(i).rfind(\"1\") - 1) # (1)\u20262\u3067\u5272\u3063\u305f\u56de\u6570\u304c\u6700\u5c0f\u306e\u3082\u306e\u3092\u63a2\u7d22","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3099729173,"measured_runtime_v1":0.2131767328,"runtime_lift":6.1450088862,"key":["s417323905","s556297736"]} +{"user_id":"u427344224","problem_id":"p03253","language":"python","submission_id_v0":"s043094515","submission_id_v1":"s952701444","cpu_time_v0":1290,"cpu_time_v1":20,"memory_v0":5164,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":98.45,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num \/\/= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\nfrom math import factorial\n\n\n\n\n\ndef comb(n, r, R):\n\n if n not in R:\n\n a = factorial(n)\n\n R[n] = a\n\n else:\n\n a = R[n]\n\n\n\n if n - r not in R:\n\n b = factorial(n - r)\n\n R[n - r] = b\n\n else:\n\n b = R[n - r]\n\n\n\n if r not in R:\n\n c = factorial(r)\n\n R[r] = c\n\n else:\n\n c = R[r]\n\n return a \/\/ (b * c)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nR = dict()\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= comb(v + n - 1, v, R)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n\n\n# optimized version of the same code:\n","target":"def prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num \/\/= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\n\n\ndef combination(n, r):\n\n r = min(n-r, r)\n\n result = 1\n\n for i in range(n, n-r, -1):\n\n result *= i\n\n for i in range(1, r+1):\n\n result \/\/= i\n\n return result\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= combination(v + n - 1, v)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n","code_v0_loc":56,"code_v1_loc":42,"code_v0_num_chars":1269,"code_v1_num_chars":1072,"code_v0_no_empty_lines":"def prime_factorize(num):\n \"\"\"\n This function performs prime factorization on the input natural number.\n The result is returned in the form of a dictionary with the prime number as the key\n and its number as the value.\n :param num:\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n \"\"\"\n prime_factor = {}\n i = 2\n while i**2 <= num:\n while num % i == 0:\n num \/\/= i\n if i in list(prime_factor.keys()):\n prime_factor[i] += 1\n else:\n prime_factor[i] = 1\n i += 1\n if num > 1:\n prime_factor[num] = 1\n return prime_factor\n\n\nfrom math import factorial\n\n\ndef comb(n, r, R):\n if n not in R:\n a = factorial(n)\n R[n] = a\n else:\n a = R[n]\n if n - r not in R:\n b = factorial(n - r)\n R[n - r] = b\n else:\n b = R[n - r]\n if r not in R:\n c = factorial(r)\n R[r] = c\n else:\n c = R[r]\n return a \/\/ (b * c)\n\n\nn, m = list(map(int, input().split()))\nr = 1\nR = dict()\nprime_fac = prime_factorize(m)\nfor v in list(prime_fac.values()):\n r *= comb(v + n - 1, v, R)\nmod = 1000000000 + 7\nprint((r % mod))\n","code_v1_no_empty_lines":"def prime_factorize(num):\n \"\"\"\n This function performs prime factorization on the input natural number.\n The result is returned in the form of a dictionary with the prime number as the key\n and its number as the value.\n :param num:\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n \"\"\"\n prime_factor = {}\n i = 2\n while i**2 <= num:\n while num % i == 0:\n num \/\/= i\n if i in list(prime_factor.keys()):\n prime_factor[i] += 1\n else:\n prime_factor[i] = 1\n i += 1\n if num > 1:\n prime_factor[num] = 1\n return prime_factor\n\n\ndef combination(n, r):\n r = min(n - r, r)\n result = 1\n for i in range(n, n - r, -1):\n result *= i\n for i in range(1, r + 1):\n result \/\/= i\n return result\n\n\nn, m = list(map(int, input().split()))\nr = 1\nprime_fac = prime_factorize(m)\nfor v in list(prime_fac.values()):\n r *= combination(v + n - 1, v)\nmod = 1000000000 + 7\nprint((r % mod))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-from math import factorial","-","-","-def comb(n, r, R):","- if n not in R:","- a = factorial(n)","- R[n] = a","- else:","- a = R[n]","- if n - r not in R:","- b = factorial(n - r)","- R[n - r] = b","- else:","- b = R[n - r]","- if r not in R:","- c = factorial(r)","- R[r] = c","- else:","- c = R[r]","- return a \/\/ (b * c)","+def combination(n, r):","+ r = min(n - r, r)","+ result = 1","+ for i in range(n, n - r, -1):","+ result *= i","+ for i in range(1, r + 1):","+ result \/\/= i","+ return result","-R = dict()","- r *= comb(v + n - 1, v, R)","+ r *= combination(v + n - 1, v)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4743831277,"measured_runtime_v1":0.1920195122,"runtime_lift":2.4704943903,"key":["s043094515","s952701444"]} +{"user_id":"u768896740","problem_id":"p02951","language":"python","submission_id_v0":"s688063139","submission_id_v1":"s870650241","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c = list(map(int, input().split()))\n\n\n\nif a < b + c:\n\n print((b+c-a))\n\nelse:\n\n print((0))\n\n# optimized version of the same code:\n","target":"a,b,c = list(map(int, input().split()))\n\n\n\nprint((max(0, c-(a-b))))","code_v0_loc":6,"code_v1_loc":3,"code_v0_num_chars":91,"code_v1_num_chars":59,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nif a < b + c:\n print((b + c - a))\nelse:\n print((0))\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nprint((max(0, c - (a - b))))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-if a < b + c:","- print((b + c - a))","-else:","- print((0))","+print((max(0, c - (a - b))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2555535069,"measured_runtime_v1":0.0829026203,"runtime_lift":3.0825745416,"key":["s688063139","s870650241"]} +{"user_id":"u075012704","problem_id":"p03038","language":"python","submission_id_v0":"s846597544","submission_id_v1":"s758849446","cpu_time_v0":756,"cpu_time_v1":520,"memory_v0":43296,"memory_v1":25512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\nX = Counter(A)\n\nfor i in range(M):\n\n B, C = list(map(int, input().split()))\n\n X[C] += B\n\n\n\nZ = []\n\nfor key, value in list(X.items()):\n\n Z.append((key, value))\n\n\n\nZ.sort(key=lambda x: x[0], reverse=True)\n\n\n\nans = 0\n\ncnt = 0\n\n\n\nfor value, key in Z:\n\n if cnt + key <= N:\n\n ans += key * value\n\n cnt += key\n\n else:\n\n ans += (N - cnt) * value\n\n break\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"N, M = list(map(int, input().split()))\n\nA = sorted(list(map(int, input().split())))\n\nquery = []\n\nfor i in range(M):\n\n b, c = list(map(int, input().split()))\n\n query.append([b, c])\n\nquery.sort(key=lambda q: q[1], reverse=True)\n\n\n\n\n\ni = 0\n\nfor b, c in query:\n\n while i < N and b > 0:\n\n if A[i] < c:\n\n A[i] = c\n\n b -= 1\n\n i += 1\n\n\n\nprint((sum(A)))\n","code_v0_loc":27,"code_v1_loc":18,"code_v0_num_chars":496,"code_v1_num_chars":376,"code_v0_no_empty_lines":"from collections import Counter\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nX = Counter(A)\nfor i in range(M):\n B, C = list(map(int, input().split()))\n X[C] += B\nZ = []\nfor key, value in list(X.items()):\n Z.append((key, value))\nZ.sort(key=lambda x: x[0], reverse=True)\nans = 0\ncnt = 0\nfor value, key in Z:\n if cnt + key <= N:\n ans += key * value\n cnt += key\n else:\n ans += (N - cnt) * value\n break\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())))\nquery = []\nfor i in range(M):\n b, c = list(map(int, input().split()))\n query.append([b, c])\nquery.sort(key=lambda q: q[1], reverse=True)\ni = 0\nfor b, c in query:\n while i < N and b > 0:\n if A[i] < c:\n A[i] = c\n b -= 1\n i += 1\nprint((sum(A)))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-from collections import Counter","-","-A = list(map(int, input().split()))","-X = Counter(A)","+A = sorted(list(map(int, input().split())))","+query = []","- B, C = list(map(int, input().split()))","- X[C] += B","-Z = []","-for key, value in list(X.items()):","- Z.append((key, value))","-Z.sort(key=lambda x: x[0], reverse=True)","-ans = 0","-cnt = 0","-for value, key in Z:","- if cnt + key <= N:","- ans += key * value","- cnt += key","- else:","- ans += (N - cnt) * value","- break","-print(ans)","+ b, c = list(map(int, input().split()))","+ query.append([b, c])","+query.sort(key=lambda q: q[1], reverse=True)","+i = 0","+for b, c in query:","+ while i < N and b > 0:","+ if A[i] < c:","+ A[i] = c","+ b -= 1","+ i += 1","+print((sum(A)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.254084451,"measured_runtime_v1":0.0066267376,"runtime_lift":38.3423135365,"key":["s846597544","s758849446"]} +{"user_id":"u576335153","problem_id":"p03723","language":"python","submission_id_v0":"s032726803","submission_id_v1":"s012708150","cpu_time_v0":58,"cpu_time_v1":26,"memory_v0":32492,"memory_v1":9200,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c = list(map(int, input().split()))\n\n\n\nif any(i % 2 != 0 for i in [a, b, c]):\n\n print((0))\n\n exit()\n\n\n\nif a == b and b == c:\n\n print((-1))\n\n exit()\n\n\n\ncnt = 0\n\na_list = [0]*(1001001)\n\nb_list = [0]*(1001001)\n\nc_list = [0]*(1001001)\n\na_list[0] = a\n\nb_list[0] = b\n\nc_list[0] = c\n\n\n\nfor i in range(1, 1001001):\n\n a_list[i] = (b_list[i-1] + c_list[i-1]) \/\/ 2\n\n b_list[i] = (c_list[i-1] + a_list[i-1]) \/\/ 2\n\n c_list[i] = (a_list[i-1] + b_list[i-1]) \/\/ 2\n\n cnt += 1\n\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n\n break\n\n\n\nprint(cnt)\n\n\n# optimized version of the same code:\n","target":"def solve(a, b, c):\n\n if any(i % 2 == 1 for i in [a, b, c]):\n\n return 0\n\n if a == b == c:\n\n return -1\n\n a, b, c = (b + c) \/\/ 2, (c + a) \/\/ 2, (a + b) \/\/ 2\n\n return solve(a, b, c) + 1\n\n\n\na, b, c = list(map(int, input().split()))\n\n\n\nprint((solve(a, b, c)))","code_v0_loc":27,"code_v1_loc":11,"code_v0_num_chars":580,"code_v1_num_chars":272,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nif any(i % 2 != 0 for i in [a, b, c]):\n print((0))\n exit()\nif a == b and b == c:\n print((-1))\n exit()\ncnt = 0\na_list = [0] * (1001001)\nb_list = [0] * (1001001)\nc_list = [0] * (1001001)\na_list[0] = a\nb_list[0] = b\nc_list[0] = c\nfor i in range(1, 1001001):\n a_list[i] = (b_list[i - 1] + c_list[i - 1]) \/\/ 2\n b_list[i] = (c_list[i - 1] + a_list[i - 1]) \/\/ 2\n c_list[i] = (a_list[i - 1] + b_list[i - 1]) \/\/ 2\n cnt += 1\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n break\nprint(cnt)\n","code_v1_no_empty_lines":"def solve(a, b, c):\n if any(i % 2 == 1 for i in [a, b, c]):\n return 0\n if a == b == c:\n return -1\n a, b, c = (b + c) \/\/ 2, (c + a) \/\/ 2, (a + b) \/\/ 2\n return solve(a, b, c) + 1\n\n\na, b, c = list(map(int, input().split()))\nprint((solve(a, b, c)))\n","code_same":false,"relative_loc_diff_percent":59.2592592593,"diff":["+def solve(a, b, c):","+ if any(i % 2 == 1 for i in [a, b, c]):","+ return 0","+ if a == b == c:","+ return -1","+ a, b, c = (b + c) \/\/ 2, (c + a) \/\/ 2, (a + b) \/\/ 2","+ return solve(a, b, c) + 1","+","+","-if any(i % 2 != 0 for i in [a, b, c]):","- print((0))","- exit()","-if a == b and b == c:","- print((-1))","- exit()","-cnt = 0","-a_list = [0] * (1001001)","-b_list = [0] * (1001001)","-c_list = [0] * (1001001)","-a_list[0] = a","-b_list[0] = b","-c_list[0] = c","-for i in range(1, 1001001):","- a_list[i] = (b_list[i - 1] + c_list[i - 1]) \/\/ 2","- b_list[i] = (c_list[i - 1] + a_list[i - 1]) \/\/ 2","- c_list[i] = (a_list[i - 1] + b_list[i - 1]) \/\/ 2","- cnt += 1","- if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:","- break","-print(cnt)","+print((solve(a, b, c)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.6101216149,"measured_runtime_v1":0.3266951015,"runtime_lift":1.8675566671,"key":["s032726803","s012708150"]} +{"user_id":"u463655976","problem_id":"p03013","language":"python","submission_id_v0":"s227334045","submission_id_v1":"s524241188","cpu_time_v0":285,"cpu_time_v1":189,"memory_v0":22940,"memory_v1":7836,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.68,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom functools import lru_cache\n\nimport sys\n\nsys.setrecursionlimit(30000)\n\n\n\nN, M = list(map(int, input().split()))\n\na = list(int(eval(input())) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nisOk = True\n\nfor i in range(M-1):\n\n if a[i] + 1 == a[i+1]:\n\n isOk = False\n\n \n\nfuncb = [-1] * 100001\n\ndef func(n):\n\n if n <= 0:\n\n return 1\n\n cnt = funcb[n]\n\n if cnt > 0:\n\n return cnt\n\n cnt = 0\n\n if n >= 2:\n\n cnt += func(n-2)\n\n if n >= 1:\n\n cnt += func(n-1)\n\n funcb[n] = cnt % MOD\n\n return funcb[n]\n\n\n\nfunc(30000)\n\nfunc(50000)\n\nfunc(80000)\n\nfunc(100000)\n\n\n\nif not isOk:\n\n print((0))\n\nelse:\n\n ans = 1\n\n s = 0\n\n for i in range(M+1):\n\n if i >= M:\n\n e = N\n\n else:\n\n e = a[i] - 1\n\n\n\n ans = ans * func(e-s) % MOD\n\n\n\n if i >= M:\n\n break\n\n\n\n s = a[i] + 1\n\n\n\n print(ans)\n\n\n# optimized version of the same code:\n","target":"N, M = list(map(int, input().split()))\n\na = list(int(eval(input())) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nMAP = [0] * (N + 1)\n\n\n\nfor x in a:\n\n MAP[x] = -1\n\n\n\nMAP[0] = 1 \n\nfor i in range(N):\n\n if MAP[i] < 0:\n\n continue\n\n\n\n MAP[i] %= MOD\n\n if i + 1 <= N and MAP[i+1] >= 0:\n\n MAP[i+1] += MAP[i]\n\n if i + 2 <= N and MAP[i+2] >= 0:\n\n MAP[i+2] += MAP[i]\n\n\n\nprint((MAP[N] % MOD))\n","code_v0_loc":53,"code_v1_loc":22,"code_v0_num_chars":885,"code_v1_num_chars":403,"code_v0_no_empty_lines":"from functools import lru_cache\nimport sys\n\nsys.setrecursionlimit(30000)\nN, M = list(map(int, input().split()))\na = list(int(eval(input())) for _ in range(M))\nMOD = pow(10, 9) + 7\nisOk = True\nfor i in range(M - 1):\n if a[i] + 1 == a[i + 1]:\n isOk = False\nfuncb = [-1] * 100001\n\n\ndef func(n):\n if n <= 0:\n return 1\n cnt = funcb[n]\n if cnt > 0:\n return cnt\n cnt = 0\n if n >= 2:\n cnt += func(n - 2)\n if n >= 1:\n cnt += func(n - 1)\n funcb[n] = cnt % MOD\n return funcb[n]\n\n\nfunc(30000)\nfunc(50000)\nfunc(80000)\nfunc(100000)\nif not isOk:\n print((0))\nelse:\n ans = 1\n s = 0\n for i in range(M + 1):\n if i >= M:\n e = N\n else:\n e = a[i] - 1\n ans = ans * func(e - s) % MOD\n if i >= M:\n break\n s = a[i] + 1\n print(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\na = list(int(eval(input())) for _ in range(M))\nMOD = pow(10, 9) + 7\nMAP = [0] * (N + 1)\nfor x in a:\n MAP[x] = -1\nMAP[0] = 1\nfor i in range(N):\n if MAP[i] < 0:\n continue\n MAP[i] %= MOD\n if i + 1 <= N and MAP[i + 1] >= 0:\n MAP[i + 1] += MAP[i]\n if i + 2 <= N and MAP[i + 2] >= 0:\n MAP[i + 2] += MAP[i]\nprint((MAP[N] % MOD))\n","code_same":false,"relative_loc_diff_percent":58.4905660377,"diff":["-from functools import lru_cache","-import sys","-","-sys.setrecursionlimit(30000)","-isOk = True","-for i in range(M - 1):","- if a[i] + 1 == a[i + 1]:","- isOk = False","-funcb = [-1] * 100001","-","-","-def func(n):","- if n <= 0:","- return 1","- cnt = funcb[n]","- if cnt > 0:","- return cnt","- cnt = 0","- if n >= 2:","- cnt += func(n - 2)","- if n >= 1:","- cnt += func(n - 1)","- funcb[n] = cnt % MOD","- return funcb[n]","-","-","-func(30000)","-func(50000)","-func(80000)","-func(100000)","-if not isOk:","- print((0))","-else:","- ans = 1","- s = 0","- for i in range(M + 1):","- if i >= M:","- e = N","- else:","- e = a[i] - 1","- ans = ans * func(e - s) % MOD","- if i >= M:","- break","- s = a[i] + 1","- print(ans)","+MAP = [0] * (N + 1)","+for x in a:","+ MAP[x] = -1","+MAP[0] = 1","+for i in range(N):","+ if MAP[i] < 0:","+ continue","+ MAP[i] %= MOD","+ if i + 1 <= N and MAP[i + 1] >= 0:","+ MAP[i + 1] += MAP[i]","+ if i + 2 <= N and MAP[i + 2] >= 0:","+ MAP[i + 2] += MAP[i]","+print((MAP[N] % MOD))"],"diff_only_import_comment":false,"measured_runtime_v0":1.0640589638,"measured_runtime_v1":0.2648930094,"runtime_lift":4.0169386351,"key":["s227334045","s524241188"]} +{"user_id":"u062484507","problem_id":"p02780","language":"python","submission_id_v0":"s309433375","submission_id_v1":"s915228066","cpu_time_v0":279,"cpu_time_v1":182,"memory_v0":52432,"memory_v1":32532,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.77,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nn, k = list(map(int, readline().split()))\n\np = list(map(int, readline().split()))\n\n\n\ntmp = [(i+1)\/2 for i in p]\n\ncs = list(np.cumsum(tmp))\n\n\n\nif n == k:\n\n print((cs[-1]))\n\n exit()\n\nans = 0\n\nfor i in range(n - k):\n\n ans = max(ans, cs[i + k] - cs[i])\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\n# import numpy as np\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nn, k = list(map(int, readline().split()))\n\np = list(map(int, readline().split()))\n\n\n\ntmp = [(i+1)\/2 for i in p]\n\n# cs = list(np.cumsum(tmp))\n\n\n\ncs = [0]*n\n\ncs[0] = tmp[0]\n\nfor i in range(len(tmp)-1):\n\n cs[i + 1] = cs[i] + tmp[i + 1]\n\n\n\nif n == k:\n\n print((cs[-1]))\n\n exit()\n\nans = 0\n\nfor i in range(n - k):\n\n ans = max(ans, cs[i + k] - cs[i])\n\nprint(ans)","code_v0_loc":19,"code_v1_loc":24,"code_v0_num_chars":403,"code_v1_num_chars":502,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nn, k = list(map(int, readline().split()))\np = list(map(int, readline().split()))\ntmp = [(i + 1) \/ 2 for i in p]\ncs = list(np.cumsum(tmp))\nif n == k:\n print((cs[-1]))\n exit()\nans = 0\nfor i in range(n - k):\n ans = max(ans, cs[i + k] - cs[i])\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\n# import numpy as np\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nn, k = list(map(int, readline().split()))\np = list(map(int, readline().split()))\ntmp = [(i + 1) \/ 2 for i in p]\n# cs = list(np.cumsum(tmp))\ncs = [0] * n\ncs[0] = tmp[0]\nfor i in range(len(tmp) - 1):\n cs[i + 1] = cs[i] + tmp[i + 1]\nif n == k:\n print((cs[-1]))\n exit()\nans = 0\nfor i in range(n - k):\n ans = max(ans, cs[i + k] - cs[i])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.8333333333,"diff":["-import numpy as np","+# import numpy as np","-cs = list(np.cumsum(tmp))","+# cs = list(np.cumsum(tmp))","+cs = [0] * n","+cs[0] = tmp[0]","+for i in range(len(tmp) - 1):","+ cs[i + 1] = cs[i] + tmp[i + 1]"],"diff_only_import_comment":false,"measured_runtime_v0":1.3658499551,"measured_runtime_v1":0.2102261074,"runtime_lift":6.4970520178,"key":["s309433375","s915228066"]} +{"user_id":"u402629484","problem_id":"p02690","language":"python","submission_id_v0":"s210362874","submission_id_v1":"s375403495","cpu_time_v0":52,"cpu_time_v1":31,"memory_v0":9156,"memory_v1":8904,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.38,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n'''\n\nA = 500 \u3068\u3059\u308b\u3002\n\n\u3053\u306e\u3068\u304d\u3001X = 10^9 \u3068\u306a\u308b\u306e\u306f\u3001 B = 499.9968... \u306e\u3068\u304d\u3002\n\n\u2192 A\u307e\u305f\u306fB (\u306e\u7d76\u5bfe\u5024) \u304c\u5927\u304d\u3059\u304e\u308b\u3068\u3001X\u304c10^9\u306b\u53ce\u307e\u3089\u306a\u3044\u3002\n\n\n\nA, B\u306e\u63a2\u7d22\u7bc4\u56f2\u306f -120~120\u3067\u5341\u5206\u3002\n\n'''\n\n\n\nfrom itertools import product\n\n\n\ndef main():\n\n X = int(eval(input()))\n\n for A, B in product(list(range(-150, 150)), list(range(-150, 150))):\n\n if A**5 - B**5 == X:\n\n print((A, B))\n\n return\n\n\n\nmain()\n\n\n\n\n# optimized version of the same code:\n","target":"from itertools import count\n\n\n\ndef main():\n\n X = int(eval(input()))\n\n for i in count():\n\n for A in (-i, i):\n\n for B in range(-i, i+1):\n\n if A**5 - B**5 == X:\n\n print((A, B))\n\n return\n\n\n\n\n\nmain()\n","code_v0_loc":19,"code_v1_loc":13,"code_v0_num_chars":350,"code_v1_num_chars":264,"code_v0_no_empty_lines":"\"\"\"\nA = 500 \u3068\u3059\u308b\u3002\n\u3053\u306e\u3068\u304d\u3001X = 10^9 \u3068\u306a\u308b\u306e\u306f\u3001 B = 499.9968... \u306e\u3068\u304d\u3002\n\u2192 A\u307e\u305f\u306fB (\u306e\u7d76\u5bfe\u5024) \u304c\u5927\u304d\u3059\u304e\u308b\u3068\u3001X\u304c10^9\u306b\u53ce\u307e\u3089\u306a\u3044\u3002\nA, B\u306e\u63a2\u7d22\u7bc4\u56f2\u306f -120~120\u3067\u5341\u5206\u3002\n\"\"\"\nfrom itertools import product\n\n\ndef main():\n X = int(eval(input()))\n for A, B in product(list(range(-150, 150)), list(range(-150, 150))):\n if A**5 - B**5 == X:\n print((A, B))\n return\n\n\nmain()\n","code_v1_no_empty_lines":"from itertools import count\n\n\ndef main():\n X = int(eval(input()))\n for i in count():\n for A in (-i, i):\n for B in range(-i, i + 1):\n if A**5 - B**5 == X:\n print((A, B))\n return\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":31.5789473684,"diff":["-\"\"\"","-A = 500 \u3068\u3059\u308b\u3002","-\u3053\u306e\u3068\u304d\u3001X = 10^9 \u3068\u306a\u308b\u306e\u306f\u3001 B = 499.9968... \u306e\u3068\u304d\u3002","-\u2192 A\u307e\u305f\u306fB (\u306e\u7d76\u5bfe\u5024) \u304c\u5927\u304d\u3059\u304e\u308b\u3068\u3001X\u304c10^9\u306b\u53ce\u307e\u3089\u306a\u3044\u3002","-A, B\u306e\u63a2\u7d22\u7bc4\u56f2\u306f -120~120\u3067\u5341\u5206\u3002","-\"\"\"","-from itertools import product","+from itertools import count","- for A, B in product(list(range(-150, 150)), list(range(-150, 150))):","- if A**5 - B**5 == X:","- print((A, B))","- return","+ for i in count():","+ for A in (-i, i):","+ for B in range(-i, i + 1):","+ if A**5 - B**5 == X:","+ print((A, B))","+ return"],"diff_only_import_comment":false,"measured_runtime_v0":0.5383961856,"measured_runtime_v1":0.3121367236,"runtime_lift":1.724872932,"key":["s210362874","s375403495"]} +{"user_id":"u254871849","problem_id":"p02921","language":"python","submission_id_v0":"s533958811","submission_id_v1":"s140590362","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# 2019-11-17 20:44:23(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# import re\n\n# import heapq\n\n# import array\n\n# from scipy.misc import comb # (default: exact=False)\n\n# import numpy as np \n\n\n\n\n\ndef main():\n\n s, t = sys.stdin.read().split()\n\n\n\n count = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\ns, t = sys.stdin.read().split()\n\n\n\ndef main():\n\n cnt = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n cnt += 1\n\n return cnt\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":28,"code_v1_loc":14,"code_v0_num_chars":611,"code_v1_num_chars":229,"code_v0_no_empty_lines":"# 2019-11-17 20:44:23(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# import re\n# import heapq\n# import array\n# from scipy.misc import comb # (default: exact=False)\n# import numpy as np\ndef main():\n s, t = sys.stdin.read().split()\n count = 0\n for i in range(3):\n if s[i] == t[i]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ns, t = sys.stdin.read().split()\n\n\ndef main():\n cnt = 0\n for i in range(3):\n if s[i] == t[i]:\n cnt += 1\n return cnt\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-# 2019-11-17 20:44:23(JST)","-# import collections","-# import math","-# from string import ascii_lowercase, ascii_uppercase, digits","-# from bisect import bisect_left as bi_l, bisect_right as bi_r","-# import itertools","-# from functools import reduce","-# import operator as op","-# import re","-# import heapq","-# import array","-# from scipy.misc import comb # (default: exact=False)","-# import numpy as np","+s, t = sys.stdin.read().split()","+","+","- s, t = sys.stdin.read().split()","- count = 0","+ cnt = 0","- count += 1","- print(count)","+ cnt += 1","+ return cnt","- main()","+ ans = main()","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2871051877,"measured_runtime_v1":0.085240711,"runtime_lift":3.3681697905,"key":["s533958811","s140590362"]} +{"user_id":"u925626880","problem_id":"p03494","language":"python","submission_id_v0":"s424280278","submission_id_v1":"s408493869","cpu_time_v0":151,"cpu_time_v1":19,"memory_v0":12396,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\n\nimport numpy as np\n\n\n\nn = int(eval(input()))\n\nl = np.array(list(map(int, input().split())))\n\n\n\ncount = 0\n\n\n\nwhile(1):\n\n if all(1 - (l % 2)):\n\n count += 1\n\n l = l \/ 2\n\n else:\n\n break\n\n\n\nprint(count)\n\n\n# optimized version of the same code:\n","target":"N = eval(input())\n\nA = list(map(int, input().split()))\n\n\n\ncount = 0\n\nwhile all(a%2==0 for a in A):\n\n count += 1\n\n A = [a\/2 for a in A]\n\n\n\nprint(count)\n","code_v0_loc":17,"code_v1_loc":9,"code_v0_num_chars":246,"code_v1_num_chars":151,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport numpy as np\n\nn = int(eval(input()))\nl = np.array(list(map(int, input().split())))\ncount = 0\nwhile 1:\n if all(1 - (l % 2)):\n count += 1\n l = l \/ 2\n else:\n break\nprint(count)\n","code_v1_no_empty_lines":"N = eval(input())\nA = list(map(int, input().split()))\ncount = 0\nwhile all(a % 2 == 0 for a in A):\n count += 1\n A = [a \/ 2 for a in A]\nprint(count)\n","code_same":false,"relative_loc_diff_percent":47.0588235294,"diff":["-# -*- coding: utf-8 -*-","-import numpy as np","-","-n = int(eval(input()))","-l = np.array(list(map(int, input().split())))","+N = eval(input())","+A = list(map(int, input().split()))","-while 1:","- if all(1 - (l % 2)):","- count += 1","- l = l \/ 2","- else:","- break","+while all(a % 2 == 0 for a in A):","+ count += 1","+ A = [a \/ 2 for a in A]"],"diff_only_import_comment":false,"measured_runtime_v0":3.0328897429,"measured_runtime_v1":0.4000873275,"runtime_lift":7.5805693769,"key":["s424280278","s408493869"]} +{"user_id":"u254871849","problem_id":"p03416","language":"python","submission_id_v0":"s286428945","submission_id_v1":"s838954646","cpu_time_v0":41,"cpu_time_v1":20,"memory_v0":2940,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# author: kagemeka \n\n# created: 2019-11-06 21:30:22(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\n# import statistics\n\n# import functools\n\n# import operator\n\n\n\ndef main():\n\n a, b = (int(x) for x in sys.stdin.read().split())\n\n\n\n count = 0\n\n for n in range(a, b+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n count += 1\n\n\n\n print(count) \n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom bisect import bisect_left as bi_l, bisect_right as bi_r\n\n\n\na, b = list(map(int, sys.stdin.readline().split()))\n\n\n\ndef main():\n\n palindromic_nums = []\n\n for i in range(1, 10):\n\n for j in range(10):\n\n for k in range(10):\n\n x = [i, j, k, j, i]\n\n palindromic_nums.append(int(''.join(list(map(str, x)))))\n\n\n\n return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":27,"code_v1_loc":18,"code_v0_num_chars":576,"code_v1_num_chars":512,"code_v0_no_empty_lines":"# author: kagemeka\n# created: 2019-11-06 21:30:22(JST)\nimport sys\n\n# import collections\n# import math\n# import string\n# import bisect\n# import re\n# import itertools\n# import statistics\n# import functools\n# import operator\ndef main():\n a, b = (int(x) for x in sys.stdin.read().split())\n count = 0\n for n in range(a, b + 1):\n n = str(n)\n if n == n[::-1]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n","code_v1_no_empty_lines":"import sys\nfrom bisect import bisect_left as bi_l, bisect_right as bi_r\n\na, b = list(map(int, sys.stdin.readline().split()))\n\n\ndef main():\n palindromic_nums = []\n for i in range(1, 10):\n for j in range(10):\n for k in range(10):\n x = [i, j, k, j, i]\n palindromic_nums.append(int(\"\".join(list(map(str, x)))))\n return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-# author: kagemeka","-# created: 2019-11-06 21:30:22(JST)","+from bisect import bisect_left as bi_l, bisect_right as bi_r","-# import collections","-# import math","-# import string","-# import bisect","-# import re","-# import itertools","-# import statistics","-# import functools","-# import operator","+a, b = list(map(int, sys.stdin.readline().split()))","+","+","- a, b = (int(x) for x in sys.stdin.read().split())","- count = 0","- for n in range(a, b + 1):","- n = str(n)","- if n == n[::-1]:","- count += 1","- print(count)","+ palindromic_nums = []","+ for i in range(1, 10):","+ for j in range(10):","+ for k in range(10):","+ x = [i, j, k, j, i]","+ palindromic_nums.append(int(\"\".join(list(map(str, x)))))","+ return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)","- # execute only if run as a script","- main()","+ ans = main()","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2528932301,"measured_runtime_v1":0.1923888798,"runtime_lift":1.314489852,"key":["s286428945","s838954646"]} +{"user_id":"u729939940","problem_id":"p02767","language":"python","submission_id_v0":"s286517602","submission_id_v1":"s316820501","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nX = list(map(int, input().split()))\n\nX = list(sorted(X))\n\nif N == 1:\n\n print((0))\n\n exit()\n\nans = float('inf')\n\nfor p in range(X[0], X[N - 1] + 1):\n\n sum = 0\n\n for x in X:\n\n sum += (x - p) ** 2\n\n ans = min(sum, ans)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nX = list(map(int, input().split()))\n\navg = round(sum(X) \/ N)\n\nprint((sum([(x - avg) ** 2 for x in X])))","code_v0_loc":13,"code_v1_loc":4,"code_v0_num_chars":251,"code_v1_num_chars":119,"code_v0_no_empty_lines":"N = int(eval(input()))\nX = list(map(int, input().split()))\nX = list(sorted(X))\nif N == 1:\n print((0))\n exit()\nans = float(\"inf\")\nfor p in range(X[0], X[N - 1] + 1):\n sum = 0\n for x in X:\n sum += (x - p) ** 2\n ans = min(sum, ans)\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nX = list(map(int, input().split()))\navg = round(sum(X) \/ N)\nprint((sum([(x - avg) ** 2 for x in X])))\n","code_same":false,"relative_loc_diff_percent":69.2307692308,"diff":["-X = list(sorted(X))","-if N == 1:","- print((0))","- exit()","-ans = float(\"inf\")","-for p in range(X[0], X[N - 1] + 1):","- sum = 0","- for x in X:","- sum += (x - p) ** 2","- ans = min(sum, ans)","-print(ans)","+avg = round(sum(X) \/ N)","+print((sum([(x - avg) ** 2 for x in X])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2590025333,"measured_runtime_v1":0.1089487125,"runtime_lift":2.3772886094,"key":["s286517602","s316820501"]} +{"user_id":"u340781749","problem_id":"p03428","language":"python","submission_id_v0":"s069460199","submission_id_v1":"s625881490","cpu_time_v0":611,"cpu_time_v1":495,"memory_v0":179524,"memory_v1":175124,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.99,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\n\n\nimport numpy as np\n\n\n\n\n\ndef part(pts, a, ans):\n\n b = np.dot(pts, [np.sin(a), np.cos(a)])\n\n c = np.argmax(b, axis=0)\n\n for i, v in list(Counter(c).items()):\n\n ans[i] += v\n\n\n\n\n\ndef solve(n, pts):\n\n ans = [0] * n\n\n part(pts, np.linspace(0, np.pi, 100000, endpoint=False), ans)\n\n part(pts, np.linspace(np.pi, 2 * np.pi, 100000, endpoint=False), ans)\n\n return [v \/ 200000 for v in ans]\n\n\n\n\n\nn = int(eval(input()))\n\npts = np.array([list(map(int, input().split())) for _ in range(n)])\n\nprint(('\\n'.join(map(str, solve(n, pts)))))\n\n\n# optimized version of the same code:\n","target":"from collections import Counter\n\nimport numpy as np\n\n\n\n\n\ndef part(pts, s, t, num, ans):\n\n a = np.linspace(s, t, num, endpoint=False)\n\n for i, v in list(Counter(np.argmax(np.dot(pts, [np.sin(a), np.cos(a)]), axis=0)).items()):\n\n ans[i] += v\n\n\n\n\n\ndef solve(n, pts):\n\n ans = np.zeros(n)\n\n part(pts, 0, np.pi, 1e5, ans)\n\n part(pts, np.pi, 2 * np.pi, 1e5, ans)\n\n return ans \/ 2e5\n\n\n\n\n\nn = int(eval(input()))\n\nprint(('\\n'.join(map(str, solve(n, [list(map(int, input().split())) for _ in range(n)])))))\n","code_v0_loc":22,"code_v1_loc":19,"code_v0_num_chars":572,"code_v1_num_chars":507,"code_v0_no_empty_lines":"from collections import Counter\nimport numpy as np\n\n\ndef part(pts, a, ans):\n b = np.dot(pts, [np.sin(a), np.cos(a)])\n c = np.argmax(b, axis=0)\n for i, v in list(Counter(c).items()):\n ans[i] += v\n\n\ndef solve(n, pts):\n ans = [0] * n\n part(pts, np.linspace(0, np.pi, 100000, endpoint=False), ans)\n part(pts, np.linspace(np.pi, 2 * np.pi, 100000, endpoint=False), ans)\n return [v \/ 200000 for v in ans]\n\n\nn = int(eval(input()))\npts = np.array([list(map(int, input().split())) for _ in range(n)])\nprint((\"\\n\".join(map(str, solve(n, pts)))))\n","code_v1_no_empty_lines":"from collections import Counter\nimport numpy as np\n\n\ndef part(pts, s, t, num, ans):\n a = np.linspace(s, t, num, endpoint=False)\n for i, v in list(\n Counter(np.argmax(np.dot(pts, [np.sin(a), np.cos(a)]), axis=0)).items()\n ):\n ans[i] += v\n\n\ndef solve(n, pts):\n ans = np.zeros(n)\n part(pts, 0, np.pi, 1e5, ans)\n part(pts, np.pi, 2 * np.pi, 1e5, ans)\n return ans \/ 2e5\n\n\nn = int(eval(input()))\nprint(\n (\"\\n\".join(map(str, solve(n, [list(map(int, input().split())) for _ in range(n)]))))\n)\n","code_same":false,"relative_loc_diff_percent":13.6363636364,"diff":["-def part(pts, a, ans):","- b = np.dot(pts, [np.sin(a), np.cos(a)])","- c = np.argmax(b, axis=0)","- for i, v in list(Counter(c).items()):","+def part(pts, s, t, num, ans):","+ a = np.linspace(s, t, num, endpoint=False)","+ for i, v in list(","+ Counter(np.argmax(np.dot(pts, [np.sin(a), np.cos(a)]), axis=0)).items()","+ ):","- ans = [0] * n","- part(pts, np.linspace(0, np.pi, 100000, endpoint=False), ans)","- part(pts, np.linspace(np.pi, 2 * np.pi, 100000, endpoint=False), ans)","- return [v \/ 200000 for v in ans]","+ ans = np.zeros(n)","+ part(pts, 0, np.pi, 1e5, ans)","+ part(pts, np.pi, 2 * np.pi, 1e5, ans)","+ return ans \/ 2e5","-pts = np.array([list(map(int, input().split())) for _ in range(n)])","-print((\"\\n\".join(map(str, solve(n, pts)))))","+print(","+ (\"\\n\".join(map(str, solve(n, [list(map(int, input().split())) for _ in range(n)]))))","+)"],"diff_only_import_comment":false,"measured_runtime_v0":1.1121708891,"measured_runtime_v1":0.8332911707,"runtime_lift":1.334672595,"key":["s069460199","s625881490"]} +{"user_id":"u628335443","problem_id":"p02725","language":"python","submission_id_v0":"s320196234","submission_id_v1":"s733866625","cpu_time_v0":189,"cpu_time_v1":163,"memory_v0":26444,"memory_v1":26444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.76,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd = [0] * n\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d[i] = a[i + 1] - a[i]\n\n d_max = max(d_max, d[i])\n\n\n\nd[-1] = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d[-1])\n\n\n\nprint((k - d_max))\n\n\n# optimized version of the same code:\n","target":"k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d = a[i + 1] - a[i]\n\n d_max = max(d_max, d)\n\n\n\nd = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d)\n\n\n\nprint((k - d_max))\n","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":255,"code_v1_num_chars":228,"code_v0_no_empty_lines":"k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nd = [0] * n\nd_max = 0\nfor i in range(n - 1):\n d[i] = a[i + 1] - a[i]\n d_max = max(d_max, d[i])\nd[-1] = (k - a[-1]) + a[0]\nd_max = max(d_max, d[-1])\nprint((k - d_max))\n","code_v1_no_empty_lines":"k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nd_max = 0\nfor i in range(n - 1):\n d = a[i + 1] - a[i]\n d_max = max(d_max, d)\nd = (k - a[-1]) + a[0]\nd_max = max(d_max, d)\nprint((k - d_max))\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-d = [0] * n","- d[i] = a[i + 1] - a[i]","- d_max = max(d_max, d[i])","-d[-1] = (k - a[-1]) + a[0]","-d_max = max(d_max, d[-1])","+ d = a[i + 1] - a[i]","+ d_max = max(d_max, d)","+d = (k - a[-1]) + a[0]","+d_max = max(d_max, d)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3049341288,"measured_runtime_v1":0.200526454,"runtime_lift":1.5206678356,"key":["s320196234","s733866625"]} +{"user_id":"u864197622","problem_id":"p02822","language":"python","submission_id_v0":"s981663077","submission_id_v1":"s820806781","cpu_time_v0":1240,"cpu_time_v1":890,"memory_v0":93784,"memory_v1":100756,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.23,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(eval(input()))\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\ninv2 = (mod + 1) \/\/ 2\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n\n for j in X[i]:\n\n s = (s * pow(inv2, A[j], mod)) % mod\n\n t = (t + (1-pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(eval(input()))\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\npow2 = [1]\n\nfor i in range(N + 10):\n\n pow2.append(pow2[-1] * 2 % mod)\n\ninv2 = (mod + 1) \/\/ 2\n\n\n\ninvpow2 = [pow(pow2[-1], mod-2, mod)]\n\nfor i in range(N + 10)[::-1]:\n\n invpow2.append(invpow2[-1] * 2 % mod)\n\ninvpow2 = invpow2[::-1]\n\n\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-invpow2[N-A[i]]) * pow2[N-A[i]]\n\n for j in X[i]:\n\n s = (s * invpow2[A[j]]) % mod\n\n t = (t + (1-invpow2[A[j]]) * pow2[A[j]]) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))","code_v0_loc":41,"code_v1_loc":50,"code_v0_num_chars":951,"code_v1_num_chars":1128,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom collections import deque\n\nN = int(eval(input()))\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\ni0 = min([i for i in range(N) if len(X[i]) == 1])\nP = [-1] * N\nQ = deque([i0])\nR = []\nwhile Q:\n i = deque.popleft(Q)\n R.append(i)\n for a in X[i]:\n if a != P[i]:\n P[a] = i\n X[a].remove(i)\n deque.append(Q, a)\nmod = 10**9 + 7\ninv2 = (mod + 1) \/\/ 2\nA = [1] * N\nfor i in R[::-1]:\n s = 0\n for j in X[i]:\n A[i] += A[j]\nans = 0\nfor i in range(N):\n s = pow(inv2, N - A[i], mod)\n t = 1 + (1 - pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n for j in X[i]:\n s = (s * pow(inv2, A[j], mod)) % mod\n t = (t + (1 - pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n ans = (ans + 1 - s * t) % mod\nprint((ans * inv2 % mod))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom collections import deque\n\nN = int(eval(input()))\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\ni0 = min([i for i in range(N) if len(X[i]) == 1])\nP = [-1] * N\nQ = deque([i0])\nR = []\nwhile Q:\n i = deque.popleft(Q)\n R.append(i)\n for a in X[i]:\n if a != P[i]:\n P[a] = i\n X[a].remove(i)\n deque.append(Q, a)\nmod = 10**9 + 7\npow2 = [1]\nfor i in range(N + 10):\n pow2.append(pow2[-1] * 2 % mod)\ninv2 = (mod + 1) \/\/ 2\ninvpow2 = [pow(pow2[-1], mod - 2, mod)]\nfor i in range(N + 10)[::-1]:\n invpow2.append(invpow2[-1] * 2 % mod)\ninvpow2 = invpow2[::-1]\nA = [1] * N\nfor i in R[::-1]:\n s = 0\n for j in X[i]:\n A[i] += A[j]\nans = 0\nfor i in range(N):\n s = pow(inv2, N - A[i], mod)\n t = 1 + (1 - invpow2[N - A[i]]) * pow2[N - A[i]]\n for j in X[i]:\n s = (s * invpow2[A[j]]) % mod\n t = (t + (1 - invpow2[A[j]]) * pow2[A[j]]) % mod\n ans = (ans + 1 - s * t) % mod\nprint((ans * inv2 % mod))\n","code_same":false,"relative_loc_diff_percent":18.0,"diff":["+pow2 = [1]","+for i in range(N + 10):","+ pow2.append(pow2[-1] * 2 % mod)","+invpow2 = [pow(pow2[-1], mod - 2, mod)]","+for i in range(N + 10)[::-1]:","+ invpow2.append(invpow2[-1] * 2 % mod)","+invpow2 = invpow2[::-1]","- t = 1 + (1 - pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)","+ t = 1 + (1 - invpow2[N - A[i]]) * pow2[N - A[i]]","- s = (s * pow(inv2, A[j], mod)) % mod","- t = (t + (1 - pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod","+ s = (s * invpow2[A[j]]) % mod","+ t = (t + (1 - invpow2[A[j]]) * pow2[A[j]]) % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.2550587091,"measured_runtime_v1":0.1362446928,"runtime_lift":1.8720634461,"key":["s981663077","s820806781"]} +{"user_id":"u474423089","problem_id":"p03575","language":"python","submission_id_v0":"s795258153","submission_id_v1":"s793995977","cpu_time_v0":206,"cpu_time_v1":23,"memory_v0":14300,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.83,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nfrom scipy.sparse.csgraph import connected_components\n\nfrom scipy.sparse import csr_matrix\n\ndef main():\n\n n,m=list(map(int,input().split(' ')))\n\n graph=[[0 for i in range(n)] for j in range(n)]\n\n graph_del=[]\n\n ans = 0\n\n\n\n for i in range(m):\n\n e_1,e_2=list(map(int,input().split(' ')))\n\n graph[e_1-1][e_2-1]=1\n\n graph[e_2-1][e_1-1]=1\n\n graph_del.append((e_1,e_2))\n\n\n\n for i,j in graph_del:\n\n graph[i-1][j-1]=0\n\n graph[j-1][i-1]=0\n\n if connected_components(np.array(graph),return_labels=False)!=1:\n\n ans += 1\n\n graph[i-1][j-1]=1\n\n graph[j-1][i-1]=1\n\n print(ans)\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"class UnionFind:\n\n def __init__(self,N):\n\n self.par =[-1 for i in range(N)]\n\n def find(self,x):\n\n if self.par[x] < 0:\n\n return x\n\n else:\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n\n\n def unite(self,x,y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x==y:\n\n return\n\n if self.par[x] > self.par[y]:\n\n x,y = y,x\n\n self.par[x] +=self.par[y]\n\n self.par[y] = x\n\n\n\n def size(self,x):\n\n return -self.par[self.find(x)]\n\n def same(self,x,y):\n\n return self.find(x)==self.find(y)\n\n\n\nN,M=list(map(int,input().split(' ')))\n\nq = [list(map(int,input().split(' '))) for i in range(M)]\n\nans = 0\n\nfor i in range(M):\n\n tmp = q[:i]+q[i+1:]\n\n uf = UnionFind(N)\n\n for j,k in tmp:\n\n uf.unite(j-1,k-1)\n\n for l in range(N):\n\n if uf.size(l) != N:\n\n ans += 1\n\n break\n\nprint(ans)","code_v0_loc":29,"code_v1_loc":38,"code_v0_num_chars":712,"code_v1_num_chars":954,"code_v0_no_empty_lines":"import numpy as np\nfrom scipy.sparse.csgraph import connected_components\nfrom scipy.sparse import csr_matrix\n\n\ndef main():\n n, m = list(map(int, input().split(\" \")))\n graph = [[0 for i in range(n)] for j in range(n)]\n graph_del = []\n ans = 0\n for i in range(m):\n e_1, e_2 = list(map(int, input().split(\" \")))\n graph[e_1 - 1][e_2 - 1] = 1\n graph[e_2 - 1][e_1 - 1] = 1\n graph_del.append((e_1, e_2))\n for i, j in graph_del:\n graph[i - 1][j - 1] = 0\n graph[j - 1][i - 1] = 0\n if connected_components(np.array(graph), return_labels=False) != 1:\n ans += 1\n graph[i - 1][j - 1] = 1\n graph[j - 1][i - 1] = 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"class UnionFind:\n def __init__(self, N):\n self.par = [-1 for i in range(N)]\n\n def find(self, x):\n if self.par[x] < 0:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def unite(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.par[x] > self.par[y]:\n x, y = y, x\n self.par[x] += self.par[y]\n self.par[y] = x\n\n def size(self, x):\n return -self.par[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n\nN, M = list(map(int, input().split(\" \")))\nq = [list(map(int, input().split(\" \"))) for i in range(M)]\nans = 0\nfor i in range(M):\n tmp = q[:i] + q[i + 1 :]\n uf = UnionFind(N)\n for j, k in tmp:\n uf.unite(j - 1, k - 1)\n for l in range(N):\n if uf.size(l) != N:\n ans += 1\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":23.6842105263,"diff":["-import numpy as np","-from scipy.sparse.csgraph import connected_components","-from scipy.sparse import csr_matrix","+class UnionFind:","+ def __init__(self, N):","+ self.par = [-1 for i in range(N)]","+","+ def find(self, x):","+ if self.par[x] < 0:","+ return x","+ else:","+ self.par[x] = self.find(self.par[x])","+ return self.par[x]","+","+ def unite(self, x, y):","+ x = self.find(x)","+ y = self.find(y)","+ if x == y:","+ return","+ if self.par[x] > self.par[y]:","+ x, y = y, x","+ self.par[x] += self.par[y]","+ self.par[y] = x","+","+ def size(self, x):","+ return -self.par[self.find(x)]","+","+ def same(self, x, y):","+ return self.find(x) == self.find(y)","-def main():","- n, m = list(map(int, input().split(\" \")))","- graph = [[0 for i in range(n)] for j in range(n)]","- graph_del = []","- ans = 0","- for i in range(m):","- e_1, e_2 = list(map(int, input().split(\" \")))","- graph[e_1 - 1][e_2 - 1] = 1","- graph[e_2 - 1][e_1 - 1] = 1","- graph_del.append((e_1, e_2))","- for i, j in graph_del:","- graph[i - 1][j - 1] = 0","- graph[j - 1][i - 1] = 0","- if connected_components(np.array(graph), return_labels=False) != 1:","+N, M = list(map(int, input().split(\" \")))","+q = [list(map(int, input().split(\" \"))) for i in range(M)]","+ans = 0","+for i in range(M):","+ tmp = q[:i] + q[i + 1 :]","+ uf = UnionFind(N)","+ for j, k in tmp:","+ uf.unite(j - 1, k - 1)","+ for l in range(N):","+ if uf.size(l) != N:","- graph[i - 1][j - 1] = 1","- graph[j - 1][i - 1] = 1","- print(ans)","-","-","-if __name__ == \"__main__\":","- main()","+ break","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.9810539348,"measured_runtime_v1":0.2057695253,"runtime_lift":9.6275380522,"key":["s795258153","s793995977"]} +{"user_id":"u898080410","problem_id":"p03060","language":"python","submission_id_v0":"s092296313","submission_id_v1":"s809303091","cpu_time_v0":150,"cpu_time_v1":17,"memory_v0":12488,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn = int(eval(input()))\n\nv = np.array(list(map(int, input().split())))\n\nc = np.array(list(map(int, input().split())))\n\np = v-c\n\nans = 0\n\nfor i in p:\n\n if i>0:\n\n ans+=i\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\nV=list(map(int,input().split()))\n\nC=list(map(int,input().split()))\n\nans=0\n\nfor v,c in zip(V,C):\n\n diff=v-c\n\n if 0 0:\n ans += i\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nV = list(map(int, input().split()))\nC = list(map(int, input().split()))\nans = 0\nfor v, c in zip(V, C):\n diff = v - c\n if 0 < diff:\n ans += diff\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import numpy as np","-","-v = np.array(list(map(int, input().split())))","-c = np.array(list(map(int, input().split())))","-p = v - c","+V = list(map(int, input().split()))","+C = list(map(int, input().split()))","-for i in p:","- if i > 0:","- ans += i","+for v, c in zip(V, C):","+ diff = v - c","+ if 0 < diff:","+ ans += diff"],"diff_only_import_comment":false,"measured_runtime_v0":1.3782214599,"measured_runtime_v1":0.1984234223,"runtime_lift":6.9458607435,"key":["s092296313","s809303091"]} +{"user_id":"u624696727","problem_id":"p02725","language":"python","submission_id_v0":"s863705375","submission_id_v1":"s938285380","cpu_time_v0":334,"cpu_time_v1":121,"memory_v0":40120,"memory_v1":25692,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.77,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nint1 = lambda x: int(x) - 1\n\nprintV = lambda x: print(*x, sep=\"\\n\")\n\nprintH = lambda x: print(\" \".join(map(str,x)))\n\ndef IS(): return sys.stdin.readline()[:-1]\n\ndef II(): return int(sys.stdin.readline())\n\ndef MI(): return map(int, sys.stdin.readline().split())\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef LI1(): return list(map(int1, sys.stdin.readline().split()))\n\ndef LII(rows_number): return [II() for _ in range(rows_number)]\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef LLI1(rows_number): return [LI1() for _ in range(rows_number)]\n\n\n\ndef main():\n\n\tK,N = MI()\n\n\tA = np.array(LI())\n\n\tA_LAST = K+A[0] - A[N-1]\n\n\tB = A[1:]-A[:N-1]\n\n\tB = np.sort(B)\n\n\tprint(K-max(B[N-2],A_LAST))\n\n\n\nif __name__ == '__main__':\n\n\tmain()\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nint1 = lambda x: int(x) - 1\n\nprintV = lambda x: print(*x, sep=\"\\n\")\n\nprintH = lambda x: print(\" \".join(map(str,x)))\n\ndef IS(): return sys.stdin.readline()[:-1]\n\ndef II(): return int(sys.stdin.readline())\n\ndef MI(): return map(int, sys.stdin.readline().split())\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef LI1(): return list(map(int1, sys.stdin.readline().split()))\n\ndef LII(rows_number): return [II() for _ in range(rows_number)]\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef LLI1(rows_number): return [LI1() for _ in range(rows_number)]\n\n\n\ndef main():\n\n\tk,n = MI()\n\n\ta = LI()\n\n\tb = [0]*n\n\n\tfor i in range(n):\n\n\t\tif i == n-1:\n\n\t\t\tb[i] = a[0]+k-a[i]\n\n\t\telse:\n\n\t\t\tb[i] = a[i+1]-a[i]\n\n\tb.sort()\n\n\tprint(k-b[-1])\n\n\n\n\n\nif __name__ == '__main__':\n\n\tmain()\n","code_v0_loc":26,"code_v1_loc":30,"code_v0_num_chars":833,"code_v1_num_chars":843,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nsys.setrecursionlimit(10**6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep=\"\\n\")\nprintH = lambda x: print(\" \".join(map(str, x)))\n\n\ndef IS():\n return sys.stdin.readline()[:-1]\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef MI():\n return map(int, sys.stdin.readline().split())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LI1():\n return list(map(int1, sys.stdin.readline().split()))\n\n\ndef LII(rows_number):\n return [II() for _ in range(rows_number)]\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef LLI1(rows_number):\n return [LI1() for _ in range(rows_number)]\n\n\ndef main():\n K, N = MI()\n A = np.array(LI())\n A_LAST = K + A[0] - A[N - 1]\n B = A[1:] - A[: N - 1]\n B = np.sort(B)\n print(K - max(B[N - 2], A_LAST))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\nint1 = lambda x: int(x) - 1\nprintV = lambda x: print(*x, sep=\"\\n\")\nprintH = lambda x: print(\" \".join(map(str, x)))\n\n\ndef IS():\n return sys.stdin.readline()[:-1]\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef MI():\n return map(int, sys.stdin.readline().split())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LI1():\n return list(map(int1, sys.stdin.readline().split()))\n\n\ndef LII(rows_number):\n return [II() for _ in range(rows_number)]\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef LLI1(rows_number):\n return [LI1() for _ in range(rows_number)]\n\n\ndef main():\n k, n = MI()\n a = LI()\n b = [0] * n\n for i in range(n):\n if i == n - 1:\n b[i] = a[0] + k - a[i]\n else:\n b[i] = a[i + 1] - a[i]\n b.sort()\n print(k - b[-1])\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-import numpy as np","- K, N = MI()","- A = np.array(LI())","- A_LAST = K + A[0] - A[N - 1]","- B = A[1:] - A[: N - 1]","- B = np.sort(B)","- print(K - max(B[N - 2], A_LAST))","+ k, n = MI()","+ a = LI()","+ b = [0] * n","+ for i in range(n):","+ if i == n - 1:","+ b[i] = a[0] + k - a[i]","+ else:","+ b[i] = a[i + 1] - a[i]","+ b.sort()","+ print(k - b[-1])"],"diff_only_import_comment":false,"measured_runtime_v0":1.0759786758,"measured_runtime_v1":0.207579791,"runtime_lift":5.1834461855,"key":["s863705375","s938285380"]} +{"user_id":"u135847648","problem_id":"p02702","language":"python","submission_id_v0":"s407946242","submission_id_v1":"s697976094","cpu_time_v0":286,"cpu_time_v1":107,"memory_v0":27184,"memory_v1":9584,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import defaultdict\n\nimport numpy as np\n\ndef main():\n\n s = eval(input())\n\n n = len(s)\n\n d = np.zeros(2019,np.int64)\n\n ans = 0\n\n num = 0\n\n pow10 = 1\n\n d[0] = 1\n\n for i in reversed(list(range(n))):\n\n pow10 = pow10 * 10 % 2019\n\n num += int(s[i]) * pow10\n\n #print(num, num % 2019, i)\n\n mod = num % 2019\n\n ans += d[mod]\n\n d[mod] += 1\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\n\n\ndef main():\n\n s = eval(input())\n\n n = len(s)\n\n ans = 0\n\n num = 0\n\n pow10 = 1\n\n d = defaultdict(int)\n\n d[0] = 1\n\n for i in reversed(list(range(n))):\n\n # pow10\u309210 ** (n-1-i)\u306b\u3057\u3066\u308b\u3060\u3051\u3067TLE\u3057\u3066\u3044\u305f\n\n pow10 = pow10 * 10 % 2019\n\n num += int(s[i]) * pow10\n\n mod = num % 2019\n\n ans += d[mod]\n\n d[mod] += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":457,"code_v1_num_chars":443,"code_v0_no_empty_lines":"from collections import defaultdict\nimport numpy as np\n\n\ndef main():\n s = eval(input())\n n = len(s)\n d = np.zeros(2019, np.int64)\n ans = 0\n num = 0\n pow10 = 1\n d[0] = 1\n for i in reversed(list(range(n))):\n pow10 = pow10 * 10 % 2019\n num += int(s[i]) * pow10\n # print(num, num % 2019, i)\n mod = num % 2019\n ans += d[mod]\n d[mod] += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import defaultdict\n\n\ndef main():\n s = eval(input())\n n = len(s)\n ans = 0\n num = 0\n pow10 = 1\n d = defaultdict(int)\n d[0] = 1\n for i in reversed(list(range(n))):\n # pow10\u309210 ** (n-1-i)\u306b\u3057\u3066\u308b\u3060\u3051\u3067TLE\u3057\u3066\u3044\u305f\n pow10 = pow10 * 10 % 2019\n num += int(s[i]) * pow10\n mod = num % 2019\n ans += d[mod]\n d[mod] += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-import numpy as np","- d = np.zeros(2019, np.int64)","+ d = defaultdict(int)","+ # pow10\u309210 ** (n-1-i)\u306b\u3057\u3066\u308b\u3060\u3051\u3067TLE\u3057\u3066\u3044\u305f","- # print(num, num % 2019, i)"],"diff_only_import_comment":false,"measured_runtime_v0":1.7964013727,"measured_runtime_v1":0.2822417974,"runtime_lift":6.3647602476,"key":["s407946242","s697976094"]} +{"user_id":"u301624971","problem_id":"p03796","language":"python","submission_id_v0":"s825153134","submission_id_v1":"s210395809","cpu_time_v0":230,"cpu_time_v1":29,"memory_v0":3972,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.39,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import factorial\n\ndef myAnswer(N:int) ->int:\n\n ans =factorial(N)\n\n return ans % (10**9 + 7)\n\n\n\ndef modelAnswer():\n\n tmp=1\n\ndef main():\n\n N = int(eval(input()))\n\n print((myAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"def modelAnswer(N:int) -> int:\n\n ans = 1\n\n for i in range(1,N+1):\n\n ans = (ans*i) % (10**9 + 7)\n\n return ans \n\ndef main():\n\n N = int(eval(input()))\n\n print((modelAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":237,"code_v1_num_chars":224,"code_v0_no_empty_lines":"from math import factorial\n\n\ndef myAnswer(N: int) -> int:\n ans = factorial(N)\n return ans % (10**9 + 7)\n\n\ndef modelAnswer():\n tmp = 1\n\n\ndef main():\n N = int(eval(input()))\n print((myAnswer(N)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def modelAnswer(N: int) -> int:\n ans = 1\n for i in range(1, N + 1):\n ans = (ans * i) % (10**9 + 7)\n return ans\n\n\ndef main():\n N = int(eval(input()))\n print((modelAnswer(N)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-from math import factorial","-","-","-def myAnswer(N: int) -> int:","- ans = factorial(N)","- return ans % (10**9 + 7)","-","-","-def modelAnswer():","- tmp = 1","+def modelAnswer(N: int) -> int:","+ ans = 1","+ for i in range(1, N + 1):","+ ans = (ans * i) % (10**9 + 7)","+ return ans","- print((myAnswer(N)))","+ print((modelAnswer(N)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.7093277271,"measured_runtime_v1":0.3704600389,"runtime_lift":1.9147212994,"key":["s825153134","s210395809"]} +{"user_id":"u714642969","problem_id":"p02881","language":"python","submission_id_v0":"s395457883","submission_id_v1":"s001240926","cpu_time_v0":284,"cpu_time_v1":184,"memory_v0":14132,"memory_v1":39024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.21,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN=int(eval(input()))\n\na=int(np.sqrt(N))\n\nb=float('inf')\n\nfor i in range(1,a+1):\n\n if N%i==0:\n\n if i+N\/\/i n):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\n\n\ng1 = [1, 1]\n\ng2 = [1, 1]\n\ninverse = [0, 1]\n\nfor i in range(2, 2*10**5 + 1):\n\n g1.append((g1[-1] * i) % mod)\n\n inverse.append((-inverse[mod % i] * (mod\/\/i)) % mod)\n\n g2.append((g2[-1] * inverse[-1]) % mod)\n\n\n\n\n\nprimes = factorization(M)\n\n# \u4f55\u7b87\u6240\u306b\u5206\u3051\u308b\u304b\uff08cnt\u4ee5\u4e0b\uff09,\u305d\u306e\u4e2d\u3067\u3069\u3046\u5206\u3051\u308b\u304b\uff08\u3057\u304d\u308a\u3092\u3069\u3053\u306b\u304a\u304f\u304b\uff08\u632f\u308a\u5206\u3051\u3089\u308c\u306a\u3044\u3082\u306e\u304c\u51fa\u308b\u3068\u9078\u3079\u308c\u306a\u3044\u306e\u3068\u304a\u306a\u3058\u306b\u306a\u308b\u306e\u3067\u3001cnt - \u9078\u3093\u3060\u6570\uff09\uff09\n\n\n\nans = 1\n\n\n\nfor p, cnt in primes:\n\n tmp = cmb(N+cnt-1, N-1, mod)\n\n ans *= tmp\n\n ans %= mod\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"def main():\n\n N, M = list(map(int, input().split()))\n\n\n\n def factorization(n):\n\n arr = []\n\n temp = n\n\n for i in range(2, int(-(-n**0.5\/\/1))+1):\n\n if temp % i == 0:\n\n cnt = 0\n\n while temp % i == 0:\n\n cnt += 1\n\n temp \/\/= i\n\n arr.append([i, cnt])\n\n if temp != 1:\n\n arr.append([temp, 1])\n\n\n\n if arr == [] and n != 1:\n\n arr.append([n, 1])\n\n\n\n return arr\n\n\n\n mod = 10**9 + 7\n\n\n\n def cmb(n, r, mod):\n\n if (r < 0 or r > n):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\n g1 = [1, 1]\n\n g2 = [1, 1]\n\n inverse = [0, 1]\n\n for i in range(2, N+100 + 1):\n\n g1.append((g1[-1] * i) % mod)\n\n inverse.append((-inverse[mod % i] * (mod\/\/i)) % mod)\n\n g2.append((g2[-1] * inverse[-1]) % mod)\n\n\n\n primes = factorization(M)\n\n # \u4f55\u7b87\u6240\u306b\u5206\u3051\u308b\u304b\uff08cnt\u4ee5\u4e0b\uff09,\u305d\u306e\u4e2d\u3067\u3069\u3046\u5206\u3051\u308b\u304b\uff08\u3057\u304d\u308a\u3092\u3069\u3053\u306b\u304a\u304f\u304b\uff08\u632f\u308a\u5206\u3051\u3089\u308c\u306a\u3044\u3082\u306e\u304c\u51fa\u308b\u3068\u9078\u3079\u308c\u306a\u3044\u306e\u3068\u304a\u306a\u3058\u306b\u306a\u308b\u306e\u3067\u3001cnt - \u9078\u3093\u3060\u6570\uff09\uff09\n\n\n\n ans = 1\n\n\n\n for p, cnt in primes:\n\n tmp = cmb(N+cnt-1, N-1, mod)\n\n ans *= tmp\n\n ans %= mod\n\n\n\n print(ans)\n\n\n\n\n\nmain()\n","code_v0_loc":53,"code_v1_loc":51,"code_v0_num_chars":1048,"code_v1_num_chars":1196,"code_v0_no_empty_lines":"import math\n\nN, M = list(map(int, input().split()))\n\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-(n**0.5) \/\/ 1)) + 1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp \/\/= i\n arr.append([i, cnt])\n if temp != 1:\n arr.append([temp, 1])\n if arr == [] and n != 1:\n arr.append([n, 1])\n return arr\n\n\nmod = 10**9 + 7\n\n\ndef cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\ng1 = [1, 1]\ng2 = [1, 1]\ninverse = [0, 1]\nfor i in range(2, 2 * 10**5 + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\nprimes = factorization(M)\n# \u4f55\u7b87\u6240\u306b\u5206\u3051\u308b\u304b\uff08cnt\u4ee5\u4e0b\uff09,\u305d\u306e\u4e2d\u3067\u3069\u3046\u5206\u3051\u308b\u304b\uff08\u3057\u304d\u308a\u3092\u3069\u3053\u306b\u304a\u304f\u304b\uff08\u632f\u308a\u5206\u3051\u3089\u308c\u306a\u3044\u3082\u306e\u304c\u51fa\u308b\u3068\u9078\u3079\u308c\u306a\u3044\u306e\u3068\u304a\u306a\u3058\u306b\u306a\u308b\u306e\u3067\u3001cnt - \u9078\u3093\u3060\u6570\uff09\uff09\nans = 1\nfor p, cnt in primes:\n tmp = cmb(N + cnt - 1, N - 1, mod)\n ans *= tmp\n ans %= mod\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n N, M = list(map(int, input().split()))\n\n def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-(n**0.5) \/\/ 1)) + 1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp \/\/= i\n arr.append([i, cnt])\n if temp != 1:\n arr.append([temp, 1])\n if arr == [] and n != 1:\n arr.append([n, 1])\n return arr\n\n mod = 10**9 + 7\n\n def cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n g1 = [1, 1]\n g2 = [1, 1]\n inverse = [0, 1]\n for i in range(2, N + 100 + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\n primes = factorization(M)\n # \u4f55\u7b87\u6240\u306b\u5206\u3051\u308b\u304b\uff08cnt\u4ee5\u4e0b\uff09,\u305d\u306e\u4e2d\u3067\u3069\u3046\u5206\u3051\u308b\u304b\uff08\u3057\u304d\u308a\u3092\u3069\u3053\u306b\u304a\u304f\u304b\uff08\u632f\u308a\u5206\u3051\u3089\u308c\u306a\u3044\u3082\u306e\u304c\u51fa\u308b\u3068\u9078\u3079\u308c\u306a\u3044\u306e\u3068\u304a\u306a\u3058\u306b\u306a\u308b\u306e\u3067\u3001cnt - \u9078\u3093\u3060\u6570\uff09\uff09\n ans = 1\n for p, cnt in primes:\n tmp = cmb(N + cnt - 1, N - 1, mod)\n ans *= tmp\n ans %= mod\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":3.7735849057,"diff":["-import math","+def main():","+ N, M = list(map(int, input().split()))","-N, M = list(map(int, input().split()))","+ def factorization(n):","+ arr = []","+ temp = n","+ for i in range(2, int(-(-(n**0.5) \/\/ 1)) + 1):","+ if temp % i == 0:","+ cnt = 0","+ while temp % i == 0:","+ cnt += 1","+ temp \/\/= i","+ arr.append([i, cnt])","+ if temp != 1:","+ arr.append([temp, 1])","+ if arr == [] and n != 1:","+ arr.append([n, 1])","+ return arr","+","+ mod = 10**9 + 7","+","+ def cmb(n, r, mod):","+ if r < 0 or r > n:","+ return 0","+ r = min(r, n - r)","+ return g1[n] * g2[r] * g2[n - r] % mod","+","+ g1 = [1, 1]","+ g2 = [1, 1]","+ inverse = [0, 1]","+ for i in range(2, N + 100 + 1):","+ g1.append((g1[-1] * i) % mod)","+ inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)","+ g2.append((g2[-1] * inverse[-1]) % mod)","+ primes = factorization(M)","+ # \u4f55\u7b87\u6240\u306b\u5206\u3051\u308b\u304b\uff08cnt\u4ee5\u4e0b\uff09,\u305d\u306e\u4e2d\u3067\u3069\u3046\u5206\u3051\u308b\u304b\uff08\u3057\u304d\u308a\u3092\u3069\u3053\u306b\u304a\u304f\u304b\uff08\u632f\u308a\u5206\u3051\u3089\u308c\u306a\u3044\u3082\u306e\u304c\u51fa\u308b\u3068\u9078\u3079\u308c\u306a\u3044\u306e\u3068\u304a\u306a\u3058\u306b\u306a\u308b\u306e\u3067\u3001cnt - \u9078\u3093\u3060\u6570\uff09\uff09","+ ans = 1","+ for p, cnt in primes:","+ tmp = cmb(N + cnt - 1, N - 1, mod)","+ ans *= tmp","+ ans %= mod","+ print(ans)","-def factorization(n):","- arr = []","- temp = n","- for i in range(2, int(-(-(n**0.5) \/\/ 1)) + 1):","- if temp % i == 0:","- cnt = 0","- while temp % i == 0:","- cnt += 1","- temp \/\/= i","- arr.append([i, cnt])","- if temp != 1:","- arr.append([temp, 1])","- if arr == [] and n != 1:","- arr.append([n, 1])","- return arr","-","-","-mod = 10**9 + 7","-","-","-def cmb(n, r, mod):","- if r < 0 or r > n:","- return 0","- r = min(r, n - r)","- return g1[n] * g2[r] * g2[n - r] % mod","-","-","-g1 = [1, 1]","-g2 = [1, 1]","-inverse = [0, 1]","-for i in range(2, 2 * 10**5 + 1):","- g1.append((g1[-1] * i) % mod)","- inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)","- g2.append((g2[-1] * inverse[-1]) % mod)","-primes = factorization(M)","-# \u4f55\u7b87\u6240\u306b\u5206\u3051\u308b\u304b\uff08cnt\u4ee5\u4e0b\uff09,\u305d\u306e\u4e2d\u3067\u3069\u3046\u5206\u3051\u308b\u304b\uff08\u3057\u304d\u308a\u3092\u3069\u3053\u306b\u304a\u304f\u304b\uff08\u632f\u308a\u5206\u3051\u3089\u308c\u306a\u3044\u3082\u306e\u304c\u51fa\u308b\u3068\u9078\u3079\u308c\u306a\u3044\u306e\u3068\u304a\u306a\u3058\u306b\u306a\u308b\u306e\u3067\u3001cnt - \u9078\u3093\u3060\u6570\uff09\uff09","-ans = 1","-for p, cnt in primes:","- tmp = cmb(N + cnt - 1, N - 1, mod)","- ans *= tmp","- ans %= mod","-print(ans)","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":2.4385202043,"measured_runtime_v1":0.358972928,"runtime_lift":6.7930476471,"key":["s485862909","s605189811"]} +{"user_id":"u991567869","problem_id":"p03854","language":"python","submission_id_v0":"s135519212","submission_id_v1":"s896370774","cpu_time_v0":59,"cpu_time_v1":42,"memory_v0":9264,"memory_v1":12828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.81,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = input()[::-1]\n\n\n\nwhile True:\n\n if len(s) == 0:\n\n break\n\n if s[:7] == \"remaerd\":\n\n s = s[7:]\n\n elif s[:6] == \"resare\":\n\n s = s[6:]\n\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n\n s = s[5:]\n\n else:\n\n print(\"NO\")\n\n exit()\n\n\n\nprint(\"YES\")\n\n# optimized version of the same code:\n","target":"import re\n\n\n\ns = eval(input())\n\n\n\nif re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")","code_v0_loc":16,"code_v1_loc":8,"code_v0_num_chars":294,"code_v1_num_chars":123,"code_v0_no_empty_lines":"s = input()[::-1]\nwhile True:\n if len(s) == 0:\n break\n if s[:7] == \"remaerd\":\n s = s[7:]\n elif s[:6] == \"resare\":\n s = s[6:]\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n s = s[5:]\n else:\n print(\"NO\")\n exit()\nprint(\"YES\")\n","code_v1_no_empty_lines":"import re\n\ns = eval(input())\nif re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-s = input()[::-1]","-while True:","- if len(s) == 0:","- break","- if s[:7] == \"remaerd\":","- s = s[7:]","- elif s[:6] == \"resare\":","- s = s[6:]","- elif s[:5] == \"maerd\" or s[:5] == \"esare\":","- s = s[5:]","- else:","- print(\"NO\")","- exit()","-print(\"YES\")","+import re","+","+s = eval(input())","+if re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):","+ print(\"YES\")","+else:","+ print(\"NO\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1782437842,"measured_runtime_v1":0.0065195048,"runtime_lift":27.340080233,"key":["s135519212","s896370774"]} +{"user_id":"u687343821","problem_id":"p03074","language":"python","submission_id_v0":"s599311447","submission_id_v1":"s168736691","cpu_time_v0":62,"cpu_time_v1":44,"memory_v0":5568,"memory_v1":4596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nstdin = sys.stdin \n\nni = lambda: int(ns())\n\nna = lambda: list(map(int, stdin.readline().split()))\n\nns = lambda: stdin.readline()\n\n\n\ndef Solve():\n\n N,K=na()\n\n S=[int(d) for d in eval(input())]\n\n l=[]\n\n N=len(S)\n\n if(S[0]==0):\n\n l.append(0)\n\n b=S[0]\n\n ct=1\n\n for i in S[1:]:\n\n if(b!=i):\n\n l.append(ct)\n\n ct=1\n\n b=i\n\n else:\n\n ct+=1\n\n l.append(ct)\n\n len_l=len(l)\n\n if(len_l\/\/2 <= K):\n\n return sum(l)\n\n ans = res = sum(l[:2*K+1])\n\n \n\n if(len_l%2==0):\n\n l.append(0)\n\n len_l+=1\n\n g = K * 2 + 1\n\n for i in range(K*2+1,len_l-1,2):\n\n ans -= l[i-g] + l[i-g+1]\n\n ans += l[i] + l[1+i]\n\n if(res= 0 and a % 2 == 0:\n\n prev_dst = [t, x, y]\n\n else:\n\n print(\"No\")\n\n exit(0)\n\n\n\nprint(\"Yes\")\n\n\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/python3\n\n# -*- coding: utf-8 -*-\n\n\n\nN = int(eval(input()))\n\nprev_dst = [0,0,0]\n\n\n\nfor n in range(N):\n\n t, x, y = list(map(int, input().split(\" \")))\n\n a = (t - prev_dst[0]) - (abs(prev_dst[1]-x) + abs(prev_dst[2]-y))\n\n if a >= 0 and a % 2 == 0:\n\n prev_dst = [t, x, y]\n\n else:\n\n print(\"No\")\n\n exit(0)\n\n\n\nprint(\"Yes\")\n\n\n","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":377,"code_v1_num_chars":349,"code_v0_no_empty_lines":"#!\/usr\/bin\/python3\n# -*- coding: utf-8 -*-\nimport numpy as np\n\nN = int(eval(input()))\nprev_dst = [0, 0, 0]\nfor n in range(N):\n t, x, y = list(map(int, input().split(\" \")))\n a = (t - prev_dst[0]) - (np.abs(prev_dst[1] - x) + np.abs(prev_dst[2] - y))\n if a >= 0 and a % 2 == 0:\n prev_dst = [t, x, y]\n else:\n print(\"No\")\n exit(0)\nprint(\"Yes\")\n","code_v1_no_empty_lines":"#!\/usr\/bin\/python3\n# -*- coding: utf-8 -*-\nN = int(eval(input()))\nprev_dst = [0, 0, 0]\nfor n in range(N):\n t, x, y = list(map(int, input().split(\" \")))\n a = (t - prev_dst[0]) - (abs(prev_dst[1] - x) + abs(prev_dst[2] - y))\n if a >= 0 and a % 2 == 0:\n prev_dst = [t, x, y]\n else:\n print(\"No\")\n exit(0)\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-import numpy as np","-","- a = (t - prev_dst[0]) - (np.abs(prev_dst[1] - x) + np.abs(prev_dst[2] - y))","+ a = (t - prev_dst[0]) - (abs(prev_dst[1] - x) + abs(prev_dst[2] - y))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4061109214,"measured_runtime_v1":0.2246652768,"runtime_lift":6.2586926719,"key":["s352352642","s152929645"]} +{"user_id":"u141786930","problem_id":"p02767","language":"python","submission_id_v0":"s650122850","submission_id_v1":"s038671040","cpu_time_v0":401,"cpu_time_v1":17,"memory_v0":19980,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.76,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nX = np.array(list(int(x) for x in input().split()))\n\nm = round(np.mean(X))\n\n\n\nprint((int(sum((X-m)**2))))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nX = list(int(x) for x in input().split())\n\np = round(sum(X)\/len(X))\n\nans = 0\n\n\n\nfor i in range(N):\n\n ans += (X[i] - p)**2\n\n\n\nprint(ans)","code_v0_loc":7,"code_v1_loc":9,"code_v0_num_chars":143,"code_v1_num_chars":156,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nX = np.array(list(int(x) for x in input().split()))\nm = round(np.mean(X))\nprint((int(sum((X - m) ** 2))))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nX = list(int(x) for x in input().split())\np = round(sum(X) \/ len(X))\nans = 0\nfor i in range(N):\n ans += (X[i] - p) ** 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-import numpy as np","-","-X = np.array(list(int(x) for x in input().split()))","-m = round(np.mean(X))","-print((int(sum((X - m) ** 2))))","+X = list(int(x) for x in input().split())","+p = round(sum(X) \/ len(X))","+ans = 0","+for i in range(N):","+ ans += (X[i] - p) ** 2","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.840335056,"measured_runtime_v1":0.2786408437,"runtime_lift":6.6046851977,"key":["s650122850","s038671040"]} +{"user_id":"u721446434","problem_id":"p02390","language":"python","submission_id_v0":"s466287089","submission_id_v1":"s267092190","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":7676,"memory_v1":7660,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na = int(eval(input()))\n\nh = int(a \/ 3600)\n\nm = int((a - h * 3600) \/ 60)\n\ns = int(a - h * 3600 - m * 60)\n\nprint((\":\" .join(map(str, [h, m, s]))))\n\n# optimized version of the same code:\n","target":"num = int(input())\n\nprint(int(num\/3600), int((num%3600)\/60), num%60, sep=\":\")\n","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":136,"code_v1_num_chars":77,"code_v0_no_empty_lines":"a = int(eval(input()))\nh = int(a \/ 3600)\nm = int((a - h * 3600) \/ 60)\ns = int(a - h * 3600 - m * 60)\nprint((\":\".join(map(str, [h, m, s]))))\n","code_v1_no_empty_lines":"num = int(input())\nprint(int(num \/ 3600), int((num % 3600) \/ 60), num % 60, sep=\":\")\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-a = int(eval(input()))","-h = int(a \/ 3600)","-m = int((a - h * 3600) \/ 60)","-s = int(a - h * 3600 - m * 60)","-print((\":\".join(map(str, [h, m, s]))))","+num = int(input())","+print(int(num \/ 3600), int((num % 3600) \/ 60), num % 60, sep=\":\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.3158221226,"measured_runtime_v1":0.2260731559,"runtime_lift":1.3969908162,"key":["s466287089","s267092190"]} +{"user_id":"u141786930","problem_id":"p02899","language":"python","submission_id_v0":"s528079976","submission_id_v1":"s501403941","cpu_time_v0":88,"cpu_time_v1":79,"memory_v0":17832,"memory_v1":17764,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.23,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\na = [int(x) for x in input().split()]\n\n\n\nans = list(range(n))\n\n\n\nfor i in range(n):\n\n ans[a[i]-1] = i+1\n\n \n\nprint((' '.join(map(str,ans))))\n\n# optimized version of the same code:\n","target":"def main():\n\n\n\n N = int(eval(input()))\n\n A = list(int(x) for x in input().split())\n\n ans = [0] * N\n\n\n\n for i, a in enumerate(A):\n\n ans[a-1] = i+1\n\n\n\n print((' '.join(map(str, ans))))\n\n \n\nif __name__ == '__main__':\n\n main()","code_v0_loc":9,"code_v1_loc":13,"code_v0_num_chars":161,"code_v1_num_chars":242,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [int(x) for x in input().split()]\nans = list(range(n))\nfor i in range(n):\n ans[a[i] - 1] = i + 1\nprint((\" \".join(map(str, ans))))\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n A = list(int(x) for x in input().split())\n ans = [0] * N\n for i, a in enumerate(A):\n ans[a - 1] = i + 1\n print((\" \".join(map(str, ans))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":30.7692307692,"diff":["-n = int(eval(input()))","-a = [int(x) for x in input().split()]","-ans = list(range(n))","-for i in range(n):","- ans[a[i] - 1] = i + 1","-print((\" \".join(map(str, ans))))","+def main():","+ N = int(eval(input()))","+ A = list(int(x) for x in input().split())","+ ans = [0] * N","+ for i, a in enumerate(A):","+ ans[a - 1] = i + 1","+ print((\" \".join(map(str, ans))))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3514640877,"measured_runtime_v1":0.2437312019,"runtime_lift":1.4420151581,"key":["s528079976","s501403941"]} +{"user_id":"u562935282","problem_id":"p03416","language":"python","submission_id_v0":"s637446217","submission_id_v1":"s864775628","cpu_time_v0":111,"cpu_time_v1":46,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.56,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b = list(map(int, input().split()))\n\ncnt = 0\n\nfor x in range(a, b + 1):\n\n s = str(x)\n\n l = len(s)\n\n flg = True\n\n for i in range(l \/\/ 2):\n\n if s[i] != s[l - 1 - i]:\n\n flg = False\n\n break\n\n if flg:\n\n cnt += 1\n\nprint(cnt)\n\n\n# optimized version of the same code:\n","target":"a, b = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(a, b + 1):\n\n s = str(i)\n\n if s[0] == s[4] and s[1] == s[3]:\n\n cnt += 1\n\nprint(cnt)","code_v0_loc":13,"code_v1_loc":7,"code_v0_num_chars":267,"code_v1_num_chars":153,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\ncnt = 0\nfor x in range(a, b + 1):\n s = str(x)\n l = len(s)\n flg = True\n for i in range(l \/\/ 2):\n if s[i] != s[l - 1 - i]:\n flg = False\n break\n if flg:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(a, b + 1):\n s = str(i)\n if s[0] == s[4] and s[1] == s[3]:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":46.1538461538,"diff":["-for x in range(a, b + 1):","- s = str(x)","- l = len(s)","- flg = True","- for i in range(l \/\/ 2):","- if s[i] != s[l - 1 - i]:","- flg = False","- break","- if flg:","+for i in range(a, b + 1):","+ s = str(i)","+ if s[0] == s[4] and s[1] == s[3]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.334243765,"measured_runtime_v1":0.2510879046,"runtime_lift":1.3311822625,"key":["s637446217","s864775628"]} +{"user_id":"u803617136","problem_id":"p02959","language":"python","submission_id_v0":"s395849964","submission_id_v1":"s383743178","cpu_time_v0":279,"cpu_time_v1":251,"memory_v0":82148,"memory_v1":18624,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.04,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\na.reverse()\n\nb.reverse()\n\nans = 0\n\ncapacity = 0\n\nfor i in range(N):\n\n ans += min(b[i] + capacity, a[i])\n\n capacity = max(b[i] - max(a[i] - capacity, 0), 0)\n\nans += min(a[-1], capacity)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\n\n\na = a[::-1]\n\nb = b[::-1]\n\nans = 0\n\nfor i, bi in enumerate(b):\n\n ans += min(a[i], b[i])\n\n remain = max(0, b[i] - a[i])\n\n ans += min(a[i + 1], remain)\n\n a[i + 1] = max(0, a[i + 1] - remain)\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":13,"code_v0_num_chars":294,"code_v1_num_chars":305,"code_v0_no_empty_lines":"N = int(eval(input()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\na.reverse()\nb.reverse()\nans = 0\ncapacity = 0\nfor i in range(N):\n ans += min(b[i] + capacity, a[i])\n capacity = max(b[i] - max(a[i] - capacity, 0), 0)\nans += min(a[-1], capacity)\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\na = a[::-1]\nb = b[::-1]\nans = 0\nfor i, bi in enumerate(b):\n ans += min(a[i], b[i])\n remain = max(0, b[i] - a[i])\n ans += min(a[i + 1], remain)\n a[i + 1] = max(0, a[i + 1] - remain)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-N = int(eval(input()))","+n = int(eval(input()))","-a.reverse()","-b.reverse()","+a = a[::-1]","+b = b[::-1]","-capacity = 0","-for i in range(N):","- ans += min(b[i] + capacity, a[i])","- capacity = max(b[i] - max(a[i] - capacity, 0), 0)","-ans += min(a[-1], capacity)","+for i, bi in enumerate(b):","+ ans += min(a[i], b[i])","+ remain = max(0, b[i] - a[i])","+ ans += min(a[i + 1], remain)","+ a[i + 1] = max(0, a[i + 1] - remain)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2854677742,"measured_runtime_v1":0.2055514226,"runtime_lift":1.3887900679,"key":["s395849964","s383743178"]} +{"user_id":"u126227204","problem_id":"p02863","language":"python","submission_id_v0":"s185891854","submission_id_v1":"s652115022","cpu_time_v0":742,"cpu_time_v1":402,"memory_v0":176904,"memory_v1":114908,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#coding:utf-8\n\nimport bisect\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nwrite = sys.stdout.write\n\ndbg = lambda *something : print(*something) if DEBUG else 0\n\nDEBUG = True\n\n\n\n\n\n\n\ndef main(given = sys.stdin.readline):\n\n input = lambda : given().rstrip()\n\n LMIIS = lambda : list(map(int,input().split()))\n\n II = lambda : int(input())\n\n XLMIIS = lambda x : [LMIIS() for _ in range(x)]\n\n\n\n n, t = LMIIS()\n\n ab = XLMIIS(n)\n\n\n\n dp1 = [[0]*t for _ in range(n)]\n\n for i in range(1, n):\n\n for j in range(1, t):\n\n if j < ab[i-1][0]:\n\n dp1[i][j] = dp1[i-1][j]\n\n else:\n\n dp1[i][j] = max(dp1[i-1][j], dp1[i-1][j-ab[i-1][0]] + ab[i-1][1])\n\n\n\n\n\n dp2 = [[0]*t for _ in range(n)]\n\n for i in range(1, n):\n\n for j in range(1, t):\n\n if j < ab[n - i][0]:\n\n dp2[i][j] = dp2[i-1][j]\n\n else:\n\n dp2[i][j] = max(dp2[i-1][j], dp2[i-1][j-ab[n-i][0]] + ab[n-i][1])\n\n\n\n ans = 0\n\n for i in range(n):\n\n for j in range(t - 1):\n\n ans = max(ans, dp1[i][j] + dp2[n - i - 1][t - j - 1] + ab[i][1])\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"#coding:utf-8\n\nimport bisect\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nwrite = sys.stdout.write\n\ndbg = lambda *something : print(*something) if DEBUG else 0\n\nDEBUG = True\n\n\n\n\n\n\n\ndef main(given = sys.stdin.readline):\n\n input = lambda : given().rstrip()\n\n LMIIS = lambda : list(map(int,input().split()))\n\n II = lambda : int(input())\n\n XLMIIS = lambda x : [LMIIS() for _ in range(x)]\n\n\n\n n, t = LMIIS()\n\n ab = XLMIIS(n)\n\n ab.sort()\n\n\n\n dp1 = [[0]*t for _ in range(n+1)]\n\n for i in range(1, n+1):\n\n for j in range(1, t):\n\n if j < ab[i-1][0]:\n\n dp1[i][j] = dp1[i-1][j]\n\n else:\n\n dp1[i][j] = max(dp1[i-1][j], dp1[i-1][j-ab[i-1][0]] + ab[i-1][1])\n\n\n\n ans = 0\n\n for i in range(n):\n\n ans = max(ans, dp1[i][t-1] + ab[i][1])\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":44,"code_v1_loc":35,"code_v0_num_chars":1191,"code_v1_num_chars":872,"code_v0_no_empty_lines":"# coding:utf-8\nimport bisect\nimport sys\n\nsys.setrecursionlimit(10**6)\nwrite = sys.stdout.write\ndbg = lambda *something: print(*something) if DEBUG else 0\nDEBUG = True\n\n\ndef main(given=sys.stdin.readline):\n input = lambda: given().rstrip()\n LMIIS = lambda: list(map(int, input().split()))\n II = lambda: int(input())\n XLMIIS = lambda x: [LMIIS() for _ in range(x)]\n n, t = LMIIS()\n ab = XLMIIS(n)\n dp1 = [[0] * t for _ in range(n)]\n for i in range(1, n):\n for j in range(1, t):\n if j < ab[i - 1][0]:\n dp1[i][j] = dp1[i - 1][j]\n else:\n dp1[i][j] = max(\n dp1[i - 1][j], dp1[i - 1][j - ab[i - 1][0]] + ab[i - 1][1]\n )\n dp2 = [[0] * t for _ in range(n)]\n for i in range(1, n):\n for j in range(1, t):\n if j < ab[n - i][0]:\n dp2[i][j] = dp2[i - 1][j]\n else:\n dp2[i][j] = max(\n dp2[i - 1][j], dp2[i - 1][j - ab[n - i][0]] + ab[n - i][1]\n )\n ans = 0\n for i in range(n):\n for j in range(t - 1):\n ans = max(ans, dp1[i][j] + dp2[n - i - 1][t - j - 1] + ab[i][1])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# coding:utf-8\nimport bisect\nimport sys\n\nsys.setrecursionlimit(10**6)\nwrite = sys.stdout.write\ndbg = lambda *something: print(*something) if DEBUG else 0\nDEBUG = True\n\n\ndef main(given=sys.stdin.readline):\n input = lambda: given().rstrip()\n LMIIS = lambda: list(map(int, input().split()))\n II = lambda: int(input())\n XLMIIS = lambda x: [LMIIS() for _ in range(x)]\n n, t = LMIIS()\n ab = XLMIIS(n)\n ab.sort()\n dp1 = [[0] * t for _ in range(n + 1)]\n for i in range(1, n + 1):\n for j in range(1, t):\n if j < ab[i - 1][0]:\n dp1[i][j] = dp1[i - 1][j]\n else:\n dp1[i][j] = max(\n dp1[i - 1][j], dp1[i - 1][j - ab[i - 1][0]] + ab[i - 1][1]\n )\n ans = 0\n for i in range(n):\n ans = max(ans, dp1[i][t - 1] + ab[i][1])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":20.4545454545,"diff":["- dp1 = [[0] * t for _ in range(n)]","- for i in range(1, n):","+ ab.sort()","+ dp1 = [[0] * t for _ in range(n + 1)]","+ for i in range(1, n + 1):","- dp2 = [[0] * t for _ in range(n)]","- for i in range(1, n):","- for j in range(1, t):","- if j < ab[n - i][0]:","- dp2[i][j] = dp2[i - 1][j]","- else:","- dp2[i][j] = max(","- dp2[i - 1][j], dp2[i - 1][j - ab[n - i][0]] + ab[n - i][1]","- )","- for j in range(t - 1):","- ans = max(ans, dp1[i][j] + dp2[n - i - 1][t - j - 1] + ab[i][1])","+ ans = max(ans, dp1[i][t - 1] + ab[i][1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.3189357283,"measured_runtime_v1":0.0702446496,"runtime_lift":4.5403561675,"key":["s185891854","s652115022"]} +{"user_id":"u326609687","problem_id":"p03074","language":"python","submission_id_v0":"s171288721","submission_id_v1":"s319292568","cpu_time_v0":80,"cpu_time_v1":65,"memory_v0":3316,"memory_v1":4460,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.75,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\nN, K = list(map(int, input().split()))\n\nS = eval(input())\n\n\n\n\n\ndef nexti(n):\n\n while S[n] == '1':\n\n n += 1\n\n while S[n] == '0':\n\n n += 1\n\n return n\n\n\n\n\n\ndef nextj(n):\n\n while S[n] == '0':\n\n n += 1\n\n if n == N:\n\n return N\n\n while S[n] == '1':\n\n n += 1\n\n if n == N:\n\n return N\n\n return n\n\n\n\n\n\ni = 0\n\nj = 0\n\nwhile S[j] == '1':\n\n j += 1\n\n if j == N:\n\n print(N)\n\n sys.exit(0)\n\nfor _ in range(K):\n\n j = nextj(j)\n\n if j == N:\n\n print(N)\n\n sys.exit(0)\n\n\n\nans = j - i\n\nwhile True:\n\n i = nexti(i)\n\n j = nextj(j)\n\n ans = max(ans, j - i)\n\n if j == N:\n\n break\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"from collections import deque\n\n\n\n\n\ndef nextj(n):\n\n while S[n] == '0':\n\n n += 1\n\n if n == N:\n\n return N\n\n q.appendleft(n)\n\n while S[n] == '1':\n\n n += 1\n\n if n == N:\n\n return N\n\n return n\n\n\n\n\n\ndef init(n):\n\n while S[n] == '1':\n\n n += 1\n\n if n == N:\n\n return N\n\n return n\n\n\n\n\n\ndef calc():\n\n q.appendleft(0)\n\n ans = 0\n\n j = init(0)\n\n if j == N:\n\n return N\n\n for _ in range(K - 1):\n\n j = nextj(j)\n\n if j == N:\n\n return N\n\n while True:\n\n j = nextj(j)\n\n ans = max(ans, j - q.pop())\n\n if j == N:\n\n return ans\n\n\n\n\n\nN, K = list(map(int, input().split()))\n\nS = eval(input())\n\nq = deque()\n\nprint((calc()))\n","code_v0_loc":48,"code_v1_loc":45,"code_v0_num_chars":703,"code_v1_num_chars":755,"code_v0_no_empty_lines":"import sys\n\nN, K = list(map(int, input().split()))\nS = eval(input())\n\n\ndef nexti(n):\n while S[n] == \"1\":\n n += 1\n while S[n] == \"0\":\n n += 1\n return n\n\n\ndef nextj(n):\n while S[n] == \"0\":\n n += 1\n if n == N:\n return N\n while S[n] == \"1\":\n n += 1\n if n == N:\n return N\n return n\n\n\ni = 0\nj = 0\nwhile S[j] == \"1\":\n j += 1\n if j == N:\n print(N)\n sys.exit(0)\nfor _ in range(K):\n j = nextj(j)\n if j == N:\n print(N)\n sys.exit(0)\nans = j - i\nwhile True:\n i = nexti(i)\n j = nextj(j)\n ans = max(ans, j - i)\n if j == N:\n break\nprint(ans)\n","code_v1_no_empty_lines":"from collections import deque\n\n\ndef nextj(n):\n while S[n] == \"0\":\n n += 1\n if n == N:\n return N\n q.appendleft(n)\n while S[n] == \"1\":\n n += 1\n if n == N:\n return N\n return n\n\n\ndef init(n):\n while S[n] == \"1\":\n n += 1\n if n == N:\n return N\n return n\n\n\ndef calc():\n q.appendleft(0)\n ans = 0\n j = init(0)\n if j == N:\n return N\n for _ in range(K - 1):\n j = nextj(j)\n if j == N:\n return N\n while True:\n j = nextj(j)\n ans = max(ans, j - q.pop())\n if j == N:\n return ans\n\n\nN, K = list(map(int, input().split()))\nS = eval(input())\nq = deque()\nprint((calc()))\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["-import sys","-","-N, K = list(map(int, input().split()))","-S = eval(input())","-","-","-def nexti(n):","- while S[n] == \"1\":","- n += 1","- while S[n] == \"0\":","- n += 1","- return n","+from collections import deque","+ q.appendleft(n)","-i = 0","-j = 0","-while S[j] == \"1\":","- j += 1","+def init(n):","+ while S[n] == \"1\":","+ n += 1","+ if n == N:","+ return N","+ return n","+","+","+def calc():","+ q.appendleft(0)","+ ans = 0","+ j = init(0)","- print(N)","- sys.exit(0)","-for _ in range(K):","- j = nextj(j)","- if j == N:","- print(N)","- sys.exit(0)","-ans = j - i","-while True:","- i = nexti(i)","- j = nextj(j)","- ans = max(ans, j - i)","- if j == N:","- break","-print(ans)","+ return N","+ for _ in range(K - 1):","+ j = nextj(j)","+ if j == N:","+ return N","+ while True:","+ j = nextj(j)","+ ans = max(ans, j - q.pop())","+ if j == N:","+ return ans","+","+","+N, K = list(map(int, input().split()))","+S = eval(input())","+q = deque()","+print((calc()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3886394203,"measured_runtime_v1":0.2086165268,"runtime_lift":1.8629368734,"key":["s171288721","s319292568"]} +{"user_id":"u060938295","problem_id":"p03039","language":"python","submission_id_v0":"s392943696","submission_id_v1":"s780766335","cpu_time_v0":987,"cpu_time_v1":315,"memory_v0":26896,"memory_v1":27024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.09,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\"\"\"\n\nCreated on Sat May 25 21:24:29 2019\n\n\n\n@author: Yamazaki Kenichi\n\n\"\"\"\n\n\n\nN, M, K = list(map(int,input().split()))\n\nmod = 10**9+7\n\n\n\ndef cmb(n, r, mod):\n\n if (r < 0 or r > n):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\ng1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\ng2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\n\nfor i in range(2, N*M+1):\n\n g1.append((g1[-1] * i) % mod)\n\n inv.append((-inv[mod % i] * (mod\/\/i)) % mod)\n\n g2.append((g2[-1] * inv[-1]) % mod)\n\n\n\ndef a(N,M):\n\n return N*(N+1)\/\/2*(M+1) + M*(M+1)\/\/2*(N+1)\n\ndef b(N):\n\n return N*(N+1)\/\/2\n\n\n\nans = 0\n\nfor i in range(N):\n\n for j in range(M):\n\n ans += a(i,j) + a(N-i-1,j) + a(i,M-j-1) + a(N-i-1,M-j-1)\n\n ans -= b(i) + b(j) + b(N-i-1) + b(M-j-1)\n\n ans %= mod\n\n# print(i,j,a(i,j),a(N-i-1,j),a(i,M-j-1),a(N-i-1,M-j-1),b(i),b(j),ans)\n\nans *= g2[2]\n\n\n\nans *= cmb(N*M-2,K-2,mod)\n\nans %= mod\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nCreated on Wed May 29 22:49:19 2019\n\n\n\n@author: Yamazaki Kenichi\n\n\"\"\"\n\n\n\n# -*- coding: utf-8 -*-\n\n\"\"\"\n\nCreated on Sat May 25 21:24:29 2019\n\n\n\n@author: Yamazaki Kenichi\n\n\"\"\"\n\n\n\nN, M, K = list(map(int,input().split()))\n\nmod = 10**9+7\n\n\n\ndef cmb(n, r, mod):\n\n if (r < 0 or r > n):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\ng1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\ng2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\n\nfor i in range(2, N*M+1):\n\n g1.append((g1[-1] * i) % mod)\n\n inv.append((-inv[mod % i] * (mod\/\/i)) % mod)\n\n g2.append((g2[-1] * inv[-1]) % mod)\n\n\n\nans1 = 0\n\ndef c(N,M):\n\n res = 0\n\n for i in range(1,N):\n\n res += i*(N-i)*M*M\n\n return res\n\nans1 += c(N,M) + c(M,N)\n\nans1 %= mod\n\n\n\nans1 *= cmb(N*M-2,K-2,mod)\n\nans1 %= mod\n\n\n\nprint(ans1)\n","code_v0_loc":43,"code_v1_loc":45,"code_v0_num_chars":949,"code_v1_num_chars":820,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat May 25 21:24:29 2019\n@author: Yamazaki Kenichi\n\"\"\"\nN, M, K = list(map(int, input().split()))\nmod = 10**9 + 7\n\n\ndef cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\ng1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\ng2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\nfor i in range(2, N * M + 1):\n g1.append((g1[-1] * i) % mod)\n inv.append((-inv[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inv[-1]) % mod)\n\n\ndef a(N, M):\n return N * (N + 1) \/\/ 2 * (M + 1) + M * (M + 1) \/\/ 2 * (N + 1)\n\n\ndef b(N):\n return N * (N + 1) \/\/ 2\n\n\nans = 0\nfor i in range(N):\n for j in range(M):\n ans += a(i, j) + a(N - i - 1, j) + a(i, M - j - 1) + a(N - i - 1, M - j - 1)\n ans -= b(i) + b(j) + b(N - i - 1) + b(M - j - 1)\n ans %= mod\n# print(i,j,a(i,j),a(N-i-1,j),a(i,M-j-1),a(N-i-1,M-j-1),b(i),b(j),ans)\nans *= g2[2]\nans *= cmb(N * M - 2, K - 2, mod)\nans %= mod\nprint(ans)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed May 29 22:49:19 2019\n@author: Yamazaki Kenichi\n\"\"\"\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat May 25 21:24:29 2019\n@author: Yamazaki Kenichi\n\"\"\"\nN, M, K = list(map(int, input().split()))\nmod = 10**9 + 7\n\n\ndef cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\ng1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\ng2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\nfor i in range(2, N * M + 1):\n g1.append((g1[-1] * i) % mod)\n inv.append((-inv[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inv[-1]) % mod)\nans1 = 0\n\n\ndef c(N, M):\n res = 0\n for i in range(1, N):\n res += i * (N - i) * M * M\n return res\n\n\nans1 += c(N, M) + c(M, N)\nans1 %= mod\nans1 *= cmb(N * M - 2, K - 2, mod)\nans1 %= mod\nprint(ans1)\n","code_same":false,"relative_loc_diff_percent":4.4444444444,"diff":["+# -*- coding: utf-8 -*-","+\"\"\"","+Created on Wed May 29 22:49:19 2019","+@author: Yamazaki Kenichi","+\"\"\"","+ans1 = 0","-def a(N, M):","- return N * (N + 1) \/\/ 2 * (M + 1) + M * (M + 1) \/\/ 2 * (N + 1)","+def c(N, M):","+ res = 0","+ for i in range(1, N):","+ res += i * (N - i) * M * M","+ return res","-def b(N):","- return N * (N + 1) \/\/ 2","-","-","-ans = 0","-for i in range(N):","- for j in range(M):","- ans += a(i, j) + a(N - i - 1, j) + a(i, M - j - 1) + a(N - i - 1, M - j - 1)","- ans -= b(i) + b(j) + b(N - i - 1) + b(M - j - 1)","- ans %= mod","-# print(i,j,a(i,j),a(N-i-1,j),a(i,M-j-1),a(N-i-1,M-j-1),b(i),b(j),ans)","-ans *= g2[2]","-ans *= cmb(N * M - 2, K - 2, mod)","-ans %= mod","-print(ans)","+ans1 += c(N, M) + c(M, N)","+ans1 %= mod","+ans1 *= cmb(N * M - 2, K - 2, mod)","+ans1 %= mod","+print(ans1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3568273056,"measured_runtime_v1":0.2588016932,"runtime_lift":1.3787672759,"key":["s392943696","s780766335"]} +{"user_id":"u537976628","problem_id":"p04044","language":"python","submission_id_v0":"s532034645","submission_id_v1":"s761755032","cpu_time_v0":23,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.09,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, L = list(map(int, input().split()))\n\nS = list(eval(input()) for i in range(N))\n\nstr = \"\"\n\nfor i in range(N-1):\n\n for j in range(N-1):\n\n if S[j+1] + S[j] <= S[j] + S[j+1]:\n\n S[j], S[j+1] = S[j+1], S[j]\n\nfor i in S:\n\n str += i\n\nprint(str)\n\n\n# optimized version of the same code:\n","target":"N, L = list(map(int, input().split()))\n\nS = list(eval(input()) for i in range(N))\n\nS.sort()\n\nstr = \"\"\n\nfor i in S:\n\n str += i\n\nprint(str)\n","code_v0_loc":10,"code_v1_loc":7,"code_v0_num_chars":252,"code_v1_num_chars":129,"code_v0_no_empty_lines":"N, L = list(map(int, input().split()))\nS = list(eval(input()) for i in range(N))\nstr = \"\"\nfor i in range(N - 1):\n for j in range(N - 1):\n if S[j + 1] + S[j] <= S[j] + S[j + 1]:\n S[j], S[j + 1] = S[j + 1], S[j]\nfor i in S:\n str += i\nprint(str)\n","code_v1_no_empty_lines":"N, L = list(map(int, input().split()))\nS = list(eval(input()) for i in range(N))\nS.sort()\nstr = \"\"\nfor i in S:\n str += i\nprint(str)\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["+S.sort()","-for i in range(N - 1):","- for j in range(N - 1):","- if S[j + 1] + S[j] <= S[j] + S[j + 1]:","- S[j], S[j + 1] = S[j + 1], S[j]"],"diff_only_import_comment":false,"measured_runtime_v0":0.3469125528,"measured_runtime_v1":0.2633319349,"runtime_lift":1.317396437,"key":["s532034645","s761755032"]} +{"user_id":"u344655022","problem_id":"p02555","language":"python","submission_id_v0":"s549296835","submission_id_v1":"s211921463","cpu_time_v0":71,"cpu_time_v1":60,"memory_v0":64940,"memory_v1":63572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.49,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = int(eval(input()))\n\nmod = 10**9 + 7\n\n\n\n# dp[i]: \u6700\u5f8c\u306b\u5207\u3063\u305f\u5834\u6240\u304ci\n\ndp = [0]*(s + 1)\n\ndp[0] = 1\n\n\n\nfor i in range(3, s+1):\n\n for j in range(0, (i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n\n\nprint((dp[s]))\n\n# optimized version of the same code:\n","target":"s = int(eval(input()))\n\nmod = 10**9 + 7\n\n\n\n# dp[i]: \u6700\u5f8c\u306b\u5207\u3063\u305f\u5834\u6240\u304ci\n\ndp = [0]*(s + 1)\n\ndp[0] = 1\n\ntotal = 0\n\nfor i in range(3, s+1):\n\n total += dp[i-3]\n\n total %= mod\n\n dp[i] = total\n\n\n\nprint((dp[s]))","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":207,"code_v1_num_chars":196,"code_v0_no_empty_lines":"s = int(eval(input()))\nmod = 10**9 + 7\n# dp[i]: \u6700\u5f8c\u306b\u5207\u3063\u305f\u5834\u6240\u304ci\ndp = [0] * (s + 1)\ndp[0] = 1\nfor i in range(3, s + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\nprint((dp[s]))\n","code_v1_no_empty_lines":"s = int(eval(input()))\nmod = 10**9 + 7\n# dp[i]: \u6700\u5f8c\u306b\u5207\u3063\u305f\u5834\u6240\u304ci\ndp = [0] * (s + 1)\ndp[0] = 1\ntotal = 0\nfor i in range(3, s + 1):\n total += dp[i - 3]\n total %= mod\n dp[i] = total\nprint((dp[s]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+total = 0","- for j in range(0, (i - 3) + 1):","- dp[i] += dp[j]","- dp[i] %= mod","+ total += dp[i - 3]","+ total %= mod","+ dp[i] = total"],"diff_only_import_comment":false,"measured_runtime_v0":0.6875757372,"measured_runtime_v1":0.2074076123,"runtime_lift":3.3150940291,"key":["s549296835","s211921463"]} +{"user_id":"u617990214","problem_id":"p02412","language":"python","submission_id_v0":"s470319892","submission_id_v1":"s042746843","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":6348,"memory_v1":6436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nwhile True:\n\n\tk=list(map(int,input().split(\" \")))\n\n\tif k[0]==k[1]==0:\n\n\t\tbreak\n\n\tct=0\n\n\ta=0\n\n\tb=0\n\n\tc=0\t\n\n\tmax=k[0]\n\n\tsum=k[1]\n\n\ta=max+1\n\n\t\n\n\twhile True:\n\n\t\ta-=1\n\n\t\tb=a-1\n\n\t\tc=sum-a-b\n\n\t\tif not a>b>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile a>b>c:\n\n\t\t\tif a>b>c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1\n\n\t\t\t\n\n# optimized version of the same code:\n","target":"while True:\n\n\tk=list(map(int,input().split(\" \")))\n\n\tif k[0]==k[1]==0:\n\n\t\tbreak\n\n\tct=0\n\n\ta=0\n\n\tb=0\n\n\tc=0\t\n\n\tmax=k[0]\n\n\tsum=k[1]\n\n\ta=max+1\n\n\twhile True:\n\n\t\ta-=1\n\n\t\tb=a-1\n\n\t\tc=sum-a-b\n\n\t\tif not a>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile b>c:\n\n\t\t\tif c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1","code_v0_loc":25,"code_v1_loc":23,"code_v0_num_chars":287,"code_v1_num_chars":271,"code_v0_no_empty_lines":"while True:\n k = list(map(int, input().split(\" \")))\n if k[0] == k[1] == 0:\n break\n ct = 0\n a = 0\n b = 0\n c = 0\n max = k[0]\n sum = k[1]\n a = max + 1\n while True:\n a -= 1\n b = a - 1\n c = sum - a - b\n if not a > b > c:\n print(ct)\n break\n while a > b > c:\n if a > b > c > 0:\n ct += 1\n b -= 1\n c += 1\n","code_v1_no_empty_lines":"while True:\n k = list(map(int, input().split(\" \")))\n if k[0] == k[1] == 0:\n break\n ct = 0\n a = 0\n b = 0\n c = 0\n max = k[0]\n sum = k[1]\n a = max + 1\n while True:\n a -= 1\n b = a - 1\n c = sum - a - b\n if not a > c:\n print(ct)\n break\n while b > c:\n if c > 0:\n ct += 1\n b -= 1\n c += 1\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["- if not a > b > c:","+ if not a > c:","- while a > b > c:","- if a > b > c > 0:","+ while b > c:","+ if c > 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2289849162,"measured_runtime_v1":0.1798006518,"runtime_lift":1.273548866,"key":["s470319892","s042746843"]} +{"user_id":"u536034761","problem_id":"p04044","language":"python","submission_id_v0":"s161300550","submission_id_v1":"s718856768","cpu_time_v0":29,"cpu_time_v1":24,"memory_v0":9032,"memory_v1":9016,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.24,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, l = list(map(int, input().split()))\n\nS = [eval(input()) for i in range(n)]\n\nS.sort()\n\nprint((\"\".join(S)))\n\n# optimized version of the same code:\n","target":"n, l = list(map(int, input().split()))\n\nA = [eval(input()) for _ in range(n)]\n\nA.sort()\n\nprint((\"\".join(A)))\n","code_v0_loc":4,"code_v1_loc":4,"code_v0_num_chars":94,"code_v1_num_chars":95,"code_v0_no_empty_lines":"n, l = list(map(int, input().split()))\nS = [eval(input()) for i in range(n)]\nS.sort()\nprint((\"\".join(S)))\n","code_v1_no_empty_lines":"n, l = list(map(int, input().split()))\nA = [eval(input()) for _ in range(n)]\nA.sort()\nprint((\"\".join(A)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S = [eval(input()) for i in range(n)]","-S.sort()","-print((\"\".join(S)))","+A = [eval(input()) for _ in range(n)]","+A.sort()","+print((\"\".join(A)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3658422339,"measured_runtime_v1":0.2564776862,"runtime_lift":1.4264096006,"key":["s161300550","s718856768"]} +{"user_id":"u996564551","problem_id":"p03644","language":"python","submission_id_v0":"s317462383","submission_id_v1":"s803396146","cpu_time_v0":32,"cpu_time_v1":25,"memory_v0":9180,"memory_v1":9176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.88,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nif N < 2:\n\n print(N)\n\nelif 2<=N<4:\n\n print((2))\n\nelif 4<=N<8:\n\n print((4))\n\nelif 8<=N<16:\n\n print((8))\n\nelif 16<=N<32:\n\n print((16))\n\nelif 32<=N<64:\n\n print((32))\n\nelif 64<=N:\n\n print((64))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nNum = [int(2**i) for i in range(7)]\n\nif N in Num:\n\n print(N)\n\nelse:\n\n Num.append(N)\n\n Num = sorted(Num)\n\n print((2 ** (Num.index(N) - 1)))","code_v0_loc":15,"code_v1_loc":8,"code_v0_num_chars":202,"code_v1_num_chars":158,"code_v0_no_empty_lines":"N = int(eval(input()))\nif N < 2:\n print(N)\nelif 2 <= N < 4:\n print((2))\nelif 4 <= N < 8:\n print((4))\nelif 8 <= N < 16:\n print((8))\nelif 16 <= N < 32:\n print((16))\nelif 32 <= N < 64:\n print((32))\nelif 64 <= N:\n print((64))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nNum = [int(2**i) for i in range(7)]\nif N in Num:\n print(N)\nelse:\n Num.append(N)\n Num = sorted(Num)\n print((2 ** (Num.index(N) - 1)))\n","code_same":false,"relative_loc_diff_percent":46.6666666667,"diff":["-if N < 2:","+Num = [int(2**i) for i in range(7)]","+if N in Num:","-elif 2 <= N < 4:","- print((2))","-elif 4 <= N < 8:","- print((4))","-elif 8 <= N < 16:","- print((8))","-elif 16 <= N < 32:","- print((16))","-elif 32 <= N < 64:","- print((32))","-elif 64 <= N:","- print((64))","+else:","+ Num.append(N)","+ Num = sorted(Num)","+ print((2 ** (Num.index(N) - 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3866926632,"measured_runtime_v1":0.2723876703,"runtime_lift":1.4196408479,"key":["s317462383","s803396146"]} +{"user_id":"u815878613","problem_id":"p03037","language":"python","submission_id_v0":"s043802358","submission_id_v1":"s120994164","cpu_time_v0":220,"cpu_time_v1":195,"memory_v0":27220,"memory_v1":9100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.36,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, M = list(map(int, input().split()))\n\nLR = [list(map(int, input().split())) for _ in range(M)]\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor l, r in LR:\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n\n\n# optimized version of the same code:\n","target":"N, M = list(map(int, input().split()))\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor _ in range(M):\n\n l, r = list(map(int, input().split()))\n\n\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n","code_v0_loc":15,"code_v1_loc":16,"code_v0_num_chars":266,"code_v1_num_chars":251,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nLR = [list(map(int, input().split())) for _ in range(M)]\nleft = 1\nright = N\nfor l, r in LR:\n if left < l:\n left = l\n if right > r:\n right = r\nans = right - left\nprint((ans + 1 if ans >= 0 else 0))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nleft = 1\nright = N\nfor _ in range(M):\n l, r = list(map(int, input().split()))\n if left < l:\n left = l\n if right > r:\n right = r\nans = right - left\nprint((ans + 1 if ans >= 0 else 0))\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["-LR = [list(map(int, input().split())) for _ in range(M)]","-for l, r in LR:","+for _ in range(M):","+ l, r = list(map(int, input().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2458969798,"measured_runtime_v1":0.1910107524,"runtime_lift":1.2873462706,"key":["s043802358","s120994164"]} +{"user_id":"u282228874","problem_id":"p03293","language":"python","submission_id_v0":"s664706993","submission_id_v1":"s616247709","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = eval(input())\n\nt = eval(input())\n\nfor i in range(len(s)):\n\n if s[i:]+s[:i]==t:\n\n print('Yes')\n\n exit()\n\nprint('No')\n\n# optimized version of the same code:\n","target":"s = eval(input())\n\nt = eval(input())\n\n\n\nfor i in range(len(s)):\n\n s = s[1:] + s[0]\n\n if s == t:\n\n print(\"Yes\")\n\n exit()\n\nprint(\"No\")","code_v0_loc":7,"code_v1_loc":9,"code_v0_num_chars":144,"code_v1_num_chars":140,"code_v0_no_empty_lines":"s = eval(input())\nt = eval(input())\nfor i in range(len(s)):\n if s[i:] + s[:i] == t:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_v1_no_empty_lines":"s = eval(input())\nt = eval(input())\nfor i in range(len(s)):\n s = s[1:] + s[0]\n if s == t:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["- if s[i:] + s[:i] == t:","+ s = s[1:] + s[0]","+ if s == t:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1894659722,"measured_runtime_v1":0.0060859642,"runtime_lift":31.1316277188,"key":["s664706993","s616247709"]} +{"user_id":"u466335531","problem_id":"p03309","language":"python","submission_id_v0":"s648346082","submission_id_v1":"s083367920","cpu_time_v0":1558,"cpu_time_v1":225,"memory_v0":34220,"memory_v1":26360,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.56,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN=int(eval(input()))\n\nA=list(map(int, input().split()))\n\n\n\nAA=[]\n\nfor i,a in enumerate(A):\n\n AA.append(a-i+1)\n\n\n\nb=np.median(AA)\n\nans=0\n\n\n\nfor a in AA:\n\n ans+=abs(a-b)\n\nprint((int(ans)))\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\nA=list(map(int,input().split()))\n\nB=[]\n\nfor i in range(N):\n\n B.append(A[i]-i-1)\n\nB.sort()\n\nif N%2:\n\n b=B[N\/\/2]\n\nelse:\n\n b=(B[N\/\/2]+B[N\/\/2-1])\/\/2\n\nans=0\n\nfor k in B:\n\n ans+=abs(k-b)\n\nprint(ans)","code_v0_loc":15,"code_v1_loc":14,"code_v0_num_chars":206,"code_v1_num_chars":220,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nAA = []\nfor i, a in enumerate(A):\n AA.append(a - i + 1)\nb = np.median(AA)\nans = 0\nfor a in AA:\n ans += abs(a - b)\nprint((int(ans)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nB = []\nfor i in range(N):\n B.append(A[i] - i - 1)\nB.sort()\nif N % 2:\n b = B[N \/\/ 2]\nelse:\n b = (B[N \/\/ 2] + B[N \/\/ 2 - 1]) \/\/ 2\nans = 0\nfor k in B:\n ans += abs(k - b)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["-import numpy as np","-","-AA = []","-for i, a in enumerate(A):","- AA.append(a - i + 1)","-b = np.median(AA)","+B = []","+for i in range(N):","+ B.append(A[i] - i - 1)","+B.sort()","+if N % 2:","+ b = B[N \/\/ 2]","+else:","+ b = (B[N \/\/ 2] + B[N \/\/ 2 - 1]) \/\/ 2","-for a in AA:","- ans += abs(a - b)","-print((int(ans)))","+for k in B:","+ ans += abs(k - b)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5822621562,"measured_runtime_v1":0.1663134053,"runtime_lift":3.5009935324,"key":["s648346082","s083367920"]} +{"user_id":"u285121325","problem_id":"p03060","language":"python","submission_id_v0":"s176163369","submission_id_v1":"s307096938","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nv = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\nresult = 0\n\nfor i in range(n):\n\n if v[i] > c[i]:\n\n result += v[i] - c[i]\n\nprint(result)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nV = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\nprint((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))\n","code_v0_loc":8,"code_v1_loc":4,"code_v0_num_chars":183,"code_v1_num_chars":151,"code_v0_no_empty_lines":"n = int(eval(input()))\nv = list(map(int, input().split()))\nc = list(map(int, input().split()))\nresult = 0\nfor i in range(n):\n if v[i] > c[i]:\n result += v[i] - c[i]\nprint(result)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nV = list(map(int, input().split()))\nC = list(map(int, input().split()))\nprint((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-n = int(eval(input()))","-v = list(map(int, input().split()))","-c = list(map(int, input().split()))","-result = 0","-for i in range(n):","- if v[i] > c[i]:","- result += v[i] - c[i]","-print(result)","+N = int(eval(input()))","+V = list(map(int, input().split()))","+C = list(map(int, input().split()))","+print((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1697382522,"measured_runtime_v1":0.0057968805,"runtime_lift":29.2809645377,"key":["s176163369","s307096938"]} +{"user_id":"u222207357","problem_id":"p02760","language":"python","submission_id_v0":"s817889698","submission_id_v1":"s477297423","cpu_time_v0":276,"cpu_time_v1":18,"memory_v0":18000,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\na = [list(map(int, input().split())) for _ in range(3)]\n\na = np.array(a)\n\nn = int(eval(input()))\n\n\n\nfor _ in range(n):\n\n b = int(eval(input()))\n\n \n\n for j in range(3):\n\n for i in range(3):\n\n if a[j][i] == b:\n\n a[j][i] = 0\n\n\n\nat = a.transpose()\n\nflag = False\n\nfor i in range(3):\n\n if sum(a[:][i]) == 0 or sum(at[:][i]) == 0:\n\n flag = True\n\n break\n\ndiag = a[0][0] + a[1][1] + a[2][2]\n\ndiag2 = a[2][0] + a[1][1] + a[0][2]\n\nif diag == 0 or diag2 == 0:\n\n flag = True\n\n\n\nprint((\"Yes\" if flag else \"No\"))\n\n# optimized version of the same code:\n","target":"a = [list(map(int, input().split())) for _ in range(3)]\n\nn = int(eval(input()))\n\nb = [int(eval(input())) for _ in range(n)]\n\n\n\nflag = False\n\nfor i in range(3):\n\n if a[i][0] in b and a[i][1] in b and a[i][2] in b:\n\n flag = True\n\n break\n\n if a[0][i] in b and a[1][i] in b and a[2][i] in b:\n\n flag = True\n\n break\n\nif a[0][0] in b and a[1][1] in b and a[2][2] in b:\n\n flag = True\n\nif a[2][0] in b and a[1][1] in b and a[0][2] in b:\n\n flag = True\n\n \n\nprint((\"Yes\" if flag else \"No\"))","code_v0_loc":26,"code_v1_loc":18,"code_v0_num_chars":567,"code_v1_num_chars":507,"code_v0_no_empty_lines":"import numpy as np\n\na = [list(map(int, input().split())) for _ in range(3)]\na = np.array(a)\nn = int(eval(input()))\nfor _ in range(n):\n b = int(eval(input()))\n for j in range(3):\n for i in range(3):\n if a[j][i] == b:\n a[j][i] = 0\nat = a.transpose()\nflag = False\nfor i in range(3):\n if sum(a[:][i]) == 0 or sum(at[:][i]) == 0:\n flag = True\n break\ndiag = a[0][0] + a[1][1] + a[2][2]\ndiag2 = a[2][0] + a[1][1] + a[0][2]\nif diag == 0 or diag2 == 0:\n flag = True\nprint((\"Yes\" if flag else \"No\"))\n","code_v1_no_empty_lines":"a = [list(map(int, input().split())) for _ in range(3)]\nn = int(eval(input()))\nb = [int(eval(input())) for _ in range(n)]\nflag = False\nfor i in range(3):\n if a[i][0] in b and a[i][1] in b and a[i][2] in b:\n flag = True\n break\n if a[0][i] in b and a[1][i] in b and a[2][i] in b:\n flag = True\n break\nif a[0][0] in b and a[1][1] in b and a[2][2] in b:\n flag = True\nif a[2][0] in b and a[1][1] in b and a[0][2] in b:\n flag = True\nprint((\"Yes\" if flag else \"No\"))\n","code_same":false,"relative_loc_diff_percent":30.7692307692,"diff":["-import numpy as np","-","-a = np.array(a)","-for _ in range(n):","- b = int(eval(input()))","- for j in range(3):","- for i in range(3):","- if a[j][i] == b:","- a[j][i] = 0","-at = a.transpose()","+b = [int(eval(input())) for _ in range(n)]","- if sum(a[:][i]) == 0 or sum(at[:][i]) == 0:","+ if a[i][0] in b and a[i][1] in b and a[i][2] in b:","-diag = a[0][0] + a[1][1] + a[2][2]","-diag2 = a[2][0] + a[1][1] + a[0][2]","-if diag == 0 or diag2 == 0:","+ if a[0][i] in b and a[1][i] in b and a[2][i] in b:","+ flag = True","+ break","+if a[0][0] in b and a[1][1] in b and a[2][2] in b:","+ flag = True","+if a[2][0] in b and a[1][1] in b and a[0][2] in b:"],"diff_only_import_comment":false,"measured_runtime_v0":1.1347907202,"measured_runtime_v1":0.1888160048,"runtime_lift":6.0100345924,"key":["s817889698","s477297423"]} +{"user_id":"u102242691","problem_id":"p03592","language":"python","submission_id_v0":"s217761930","submission_id_v1":"s778426463","cpu_time_v0":406,"cpu_time_v1":310,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.65,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n\n\nn,m,k = list(map(int,input().split()))\n\n#\uff11\u56de\u62bc\u3059\u3068\u5909\u308f\u308b\u30de\u30b9\u3000= N * M -1\n\n#\uff12\u56de\u76ee\u62bc\u3059\u3068\u9ed2\u306b\u5909\u308f\u308b\u30de\u30b9 N * M -1 -2\n\n# 3 = N * M -1 -4\n\n\n\ncnt = 0\n\nfor i in range(n+1):\n\n for j in range(m + 1):\n\n cnt = i * m + j * n -2 * i * j\n\n if cnt == k:\n\n print(\"Yes\")\n\n exit()\n\nprint(\"No\")\n\n\n# optimized version of the same code:\n","target":"\n\nn,m,k = list(map(int,input().split()))\n\n\n\nfor i in range(n+1):\n\n for j in range(m+1):\n\n if i*(m-j) + j*(n-i) == k:\n\n print(\"Yes\")\n\n exit()\n\nprint(\"No\")\n","code_v0_loc":14,"code_v1_loc":9,"code_v0_num_chars":288,"code_v1_num_chars":180,"code_v0_no_empty_lines":"n, m, k = list(map(int, input().split()))\n# \uff11\u56de\u62bc\u3059\u3068\u5909\u308f\u308b\u30de\u30b9\u3000= N * M -1\n# \uff12\u56de\u76ee\u62bc\u3059\u3068\u9ed2\u306b\u5909\u308f\u308b\u30de\u30b9 N * M -1 -2\n# 3 = N * M -1 -4\ncnt = 0\nfor i in range(n + 1):\n for j in range(m + 1):\n cnt = i * m + j * n - 2 * i * j\n if cnt == k:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_v1_no_empty_lines":"n, m, k = list(map(int, input().split()))\nfor i in range(n + 1):\n for j in range(m + 1):\n if i * (m - j) + j * (n - i) == k:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-# \uff11\u56de\u62bc\u3059\u3068\u5909\u308f\u308b\u30de\u30b9\u3000= N * M -1","-# \uff12\u56de\u76ee\u62bc\u3059\u3068\u9ed2\u306b\u5909\u308f\u308b\u30de\u30b9 N * M -1 -2","-# 3 = N * M -1 -4","-cnt = 0","- cnt = i * m + j * n - 2 * i * j","- if cnt == k:","+ if i * (m - j) + j * (n - i) == k:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2209630473,"measured_runtime_v1":0.0057685788,"runtime_lift":38.3045903988,"key":["s217761930","s778426463"]} +{"user_id":"u879870653","problem_id":"p03416","language":"python","submission_id_v0":"s279175230","submission_id_v1":"s789865740","cpu_time_v0":111,"cpu_time_v1":45,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.46,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b = list(map(int,input().split()))\n\nanswer = 0\n\nfor i in range(a,b+1) :\n\n j = str(i)\n\n p1 = j[4]\n\n p2 = j[3]\n\n p3 = j[2]\n\n p4 = j[1]\n\n p5 = j[0]\n\n k = int(p1+p2+p3+p4+p5)\n\n if i == k :\n\n answer += 1\n\nprint(answer)\n\n\n\n\n# optimized version of the same code:\n","target":"A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1) :\n\n l = str(i)\n\n if l[0] == l[4] and l[1] == l[3] :\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":14,"code_v1_loc":7,"code_v0_num_chars":243,"code_v1_num_chars":151,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nanswer = 0\nfor i in range(a, b + 1):\n j = str(i)\n p1 = j[4]\n p2 = j[3]\n p3 = j[2]\n p4 = j[1]\n p5 = j[0]\n k = int(p1 + p2 + p3 + p4 + p5)\n if i == k:\n answer += 1\nprint(answer)\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n l = str(i)\n if l[0] == l[4] and l[1] == l[3]:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-a, b = list(map(int, input().split()))","-answer = 0","-for i in range(a, b + 1):","- j = str(i)","- p1 = j[4]","- p2 = j[3]","- p3 = j[2]","- p4 = j[1]","- p5 = j[0]","- k = int(p1 + p2 + p3 + p4 + p5)","- if i == k:","- answer += 1","-print(answer)","+A, B = list(map(int, input().split()))","+ans = 0","+for i in range(A, B + 1):","+ l = str(i)","+ if l[0] == l[4] and l[1] == l[3]:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5475045266,"measured_runtime_v1":0.378210106,"runtime_lift":1.4476200343,"key":["s279175230","s789865740"]} +{"user_id":"u936985471","problem_id":"p03721","language":"python","submission_id_v0":"s865752287","submission_id_v1":"s921873406","cpu_time_v0":343,"cpu_time_v1":288,"memory_v0":15072,"memory_v1":29824,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,K=list(map(int,input().split()))\n\ndic={}\n\nfor i in range(N):\n\n a,b=list(map(int,input().split()))\n\n if a in dic:\n\n dic[a]+=b\n\n else:\n\n dic[a]=b\n\n \n\ndic=sorted(list(dic.items()),key=lambda x:x[0])\n\nfor d in range(len(dic)):\n\n amount=dic[d][1]\n\n if amount>=K:\n\n print((dic[d][0]))\n\n exit(0)\n\n else:\n\n K-=amount\n\n \n\n# optimized version of the same code:\n","target":"import sys\n\nreadline = sys.stdin.readline\n\n\n\nN,K = list(map(int,readline().split()))\n\n\n\nAB = [list(map(int,readline().split())) for i in range(N)]\n\n\n\nAB = sorted(AB, key = lambda x:x[0])\n\namount = 0\n\nfor a,b in AB:\n\n amount += b\n\n if amount >= K:\n\n print(a)\n\n break\n","code_v0_loc":18,"code_v1_loc":14,"code_v0_num_chars":318,"code_v1_num_chars":268,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\ndic = {}\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if a in dic:\n dic[a] += b\n else:\n dic[a] = b\ndic = sorted(list(dic.items()), key=lambda x: x[0])\nfor d in range(len(dic)):\n amount = dic[d][1]\n if amount >= K:\n print((dic[d][0]))\n exit(0)\n else:\n K -= amount\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nN, K = list(map(int, readline().split()))\nAB = [list(map(int, readline().split())) for i in range(N)]\nAB = sorted(AB, key=lambda x: x[0])\namount = 0\nfor a, b in AB:\n amount += b\n if amount >= K:\n print(a)\n break\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-N, K = list(map(int, input().split()))","-dic = {}","-for i in range(N):","- a, b = list(map(int, input().split()))","- if a in dic:","- dic[a] += b","- else:","- dic[a] = b","-dic = sorted(list(dic.items()), key=lambda x: x[0])","-for d in range(len(dic)):","- amount = dic[d][1]","+import sys","+","+readline = sys.stdin.readline","+N, K = list(map(int, readline().split()))","+AB = [list(map(int, readline().split())) for i in range(N)]","+AB = sorted(AB, key=lambda x: x[0])","+amount = 0","+for a, b in AB:","+ amount += b","- print((dic[d][0]))","- exit(0)","- else:","- K -= amount","+ print(a)","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.3684674098,"measured_runtime_v1":0.2810288085,"runtime_lift":1.3111375012,"key":["s865752287","s921873406"]} +{"user_id":"u197300260","problem_id":"p03814","language":"python","submission_id_v0":"s932284243","submission_id_v1":"s708109984","cpu_time_v0":36,"cpu_time_v1":29,"memory_v0":4012,"memory_v1":3516,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.44,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# Problem https:\/\/atcoder.jp\/contests\/abc053\/tasks\/abc053_b\n\n# Python 1st Try\n\nimport copy\n\n\n\n\n\nclass Problem:\n\n def __init__(self, stringdata):\n\n self.stringdata = stringdata\n\n\n\n def solver(self):\n\n strcont = copy.copy(self.stringdata)\n\n result = 0\n\n rightposition = 0\n\n leftposition = len(strcont)\n\n j = 0\n\n while True:\n\n if strcont[j] == 'A':\n\n rightposition = j\n\n break\n\n else:\n\n j = j + 1\n\n j = leftposition - 1\n\n while True:\n\n if strcont[j] == 'Z':\n\n leftposition = j\n\n break\n\n else:\n\n j = j - 1\n\n\n\n result = leftposition - rightposition + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = eval(input())\n\n print((\"{}\".format(Problem(s).solver())))\n\n\n# optimized version of the same code:\n","target":"# Problem https:\/\/atcoder.jp\/contests\/abc053\/tasks\/abc053_b\n\n# Python 2nd Try\n\n\n\n\n\ndef solver(string):\n\n result = 200000\n\n aposi = 0\n\n zposi = len(string)\n\n for j in range(0, len(string), 1):\n\n if string[j] == 'A':\n\n aposi = j\n\n break\n\n for j in range(len(string)-1, -1, -1):\n\n if string[j] == 'Z':\n\n zposi = j\n\n break\n\n result = zposi - aposi + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = eval(input())\n\n print(('{}'.format(solver(s))))\n","code_v0_loc":36,"code_v1_loc":23,"code_v0_num_chars":875,"code_v1_num_chars":527,"code_v0_no_empty_lines":"# Problem https:\/\/atcoder.jp\/contests\/abc053\/tasks\/abc053_b\n# Python 1st Try\nimport copy\n\n\nclass Problem:\n def __init__(self, stringdata):\n self.stringdata = stringdata\n\n def solver(self):\n strcont = copy.copy(self.stringdata)\n result = 0\n rightposition = 0\n leftposition = len(strcont)\n j = 0\n while True:\n if strcont[j] == \"A\":\n rightposition = j\n break\n else:\n j = j + 1\n j = leftposition - 1\n while True:\n if strcont[j] == \"Z\":\n leftposition = j\n break\n else:\n j = j - 1\n result = leftposition - rightposition + 1\n return result\n\n\nif __name__ == \"__main__\":\n s = eval(input())\n print((\"{}\".format(Problem(s).solver())))\n","code_v1_no_empty_lines":"# Problem https:\/\/atcoder.jp\/contests\/abc053\/tasks\/abc053_b\n# Python 2nd Try\ndef solver(string):\n result = 200000\n aposi = 0\n zposi = len(string)\n for j in range(0, len(string), 1):\n if string[j] == \"A\":\n aposi = j\n break\n for j in range(len(string) - 1, -1, -1):\n if string[j] == \"Z\":\n zposi = j\n break\n result = zposi - aposi + 1\n return result\n\n\nif __name__ == \"__main__\":\n s = eval(input())\n print((\"{}\".format(solver(s))))\n","code_same":false,"relative_loc_diff_percent":36.1111111111,"diff":["-# Python 1st Try","-import copy","-","-","-class Problem:","- def __init__(self, stringdata):","- self.stringdata = stringdata","-","- def solver(self):","- strcont = copy.copy(self.stringdata)","- result = 0","- rightposition = 0","- leftposition = len(strcont)","- j = 0","- while True:","- if strcont[j] == \"A\":","- rightposition = j","- break","- else:","- j = j + 1","- j = leftposition - 1","- while True:","- if strcont[j] == \"Z\":","- leftposition = j","- break","- else:","- j = j - 1","- result = leftposition - rightposition + 1","- return result","+# Python 2nd Try","+def solver(string):","+ result = 200000","+ aposi = 0","+ zposi = len(string)","+ for j in range(0, len(string), 1):","+ if string[j] == \"A\":","+ aposi = j","+ break","+ for j in range(len(string) - 1, -1, -1):","+ if string[j] == \"Z\":","+ zposi = j","+ break","+ result = zposi - aposi + 1","+ return result","- print((\"{}\".format(Problem(s).solver())))","+ print((\"{}\".format(solver(s))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2169195101,"measured_runtime_v1":0.1208960545,"runtime_lift":1.7942645936,"key":["s932284243","s708109984"]} +{"user_id":"u691874710","problem_id":"p02690","language":"python","submission_id_v0":"s109040531","submission_id_v1":"s154929994","cpu_time_v0":142,"cpu_time_v1":38,"memory_v0":9168,"memory_v1":9132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.24,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx=int(eval(input()))\n\nA=0\n\nB=0\n\nfor a in range(-120,120):\n\n for b in range(-500,500):\n\n if a**5-b**5==x:\n\n A=a\n\n B=b\n\n break\n\nprint((A,B))\n\n# optimized version of the same code:\n","target":"x=int(eval(input()))\n\nA=0\n\nB=0\n\nfor a in range(-120, 120):\n\n a5 = a**5\n\n for b in range(-120, 120):\n\n if a5 - b**5 == x:\n\n A = a\n\n B = b\n\n break\n\nprint((A,B))","code_v0_loc":10,"code_v1_loc":11,"code_v0_num_chars":173,"code_v1_num_chars":196,"code_v0_no_empty_lines":"x = int(eval(input()))\nA = 0\nB = 0\nfor a in range(-120, 120):\n for b in range(-500, 500):\n if a**5 - b**5 == x:\n A = a\n B = b\n break\nprint((A, B))\n","code_v1_no_empty_lines":"x = int(eval(input()))\nA = 0\nB = 0\nfor a in range(-120, 120):\n a5 = a**5\n for b in range(-120, 120):\n if a5 - b**5 == x:\n A = a\n B = b\n break\nprint((A, B))\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["- for b in range(-500, 500):","- if a**5 - b**5 == x:","+ a5 = a**5","+ for b in range(-120, 120):","+ if a5 - b**5 == x:"],"diff_only_import_comment":false,"measured_runtime_v0":1.9916155219,"measured_runtime_v1":0.3713067094,"runtime_lift":5.363801599,"key":["s109040531","s154929994"]} +{"user_id":"u633068244","problem_id":"p00827","language":"python","submission_id_v0":"s400923829","submission_id_v1":"s127207739","cpu_time_v0":2670,"cpu_time_v1":1630,"memory_v0":4240,"memory_v1":4240,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef judge(x,y):\n\n global xx,yy,xy,axby\n\n if min(x,y) >= 0 and x+y <= xy:\n\n if x+y < xy or (x+y == xy and a*x+b*y < axby):\n\n xy = x+y\n\n axby = a*x+b*y\n\n xx,yy = x,y\n\n \n\nwhile 1:\n\n a,b,d = list(map(int,input().split()))\n\n if a == 0: break\n\n xy = axby = 10**10\n\n for y in range(50001):\n\n if (d+b*y)%a == 0: judge((d+b*y)\/a,y)\n\n if (b*y-d)%a == 0: judge((b*y-d)\/a,y)\n\n if (d-b*y)%a == 0: judge((d-b*y)\/a,y)\n\n print(xx,yy)\n\n# optimized version of the same code:\n","target":"def judge(x,y):\n\n global xx,yy,xy,axby\n\n if min(x,y) >= 0 and x+y <= xy:\n\n if x+y < xy or (x+y == xy and a*x+b*y < axby):\n\n xy = x+y\n\n axby = a*x+b*y\n\n xx,yy = x,y\n\n \n\nwhile 1:\n\n a,b,d = list(map(int,input().split()))\n\n if a == 0: break\n\n xy = axby = 10**10\n\n for y in range(30001):\n\n if (d+b*y)%a == 0: judge((d+b*y)\/a,y)\n\n if (b*y-d)%a == 0: judge((b*y-d)\/a,y)\n\n if (d-b*y)%a == 0: judge((d-b*y)\/a,y)\n\n print(xx,yy)","code_v0_loc":17,"code_v1_loc":17,"code_v0_num_chars":500,"code_v1_num_chars":500,"code_v0_no_empty_lines":"def judge(x, y):\n global xx, yy, xy, axby\n if min(x, y) >= 0 and x + y <= xy:\n if x + y < xy or (x + y == xy and a * x + b * y < axby):\n xy = x + y\n axby = a * x + b * y\n xx, yy = x, y\n\n\nwhile 1:\n a, b, d = list(map(int, input().split()))\n if a == 0:\n break\n xy = axby = 10**10\n for y in range(50001):\n if (d + b * y) % a == 0:\n judge((d + b * y) \/ a, y)\n if (b * y - d) % a == 0:\n judge((b * y - d) \/ a, y)\n if (d - b * y) % a == 0:\n judge((d - b * y) \/ a, y)\n print(xx, yy)\n","code_v1_no_empty_lines":"def judge(x, y):\n global xx, yy, xy, axby\n if min(x, y) >= 0 and x + y <= xy:\n if x + y < xy or (x + y == xy and a * x + b * y < axby):\n xy = x + y\n axby = a * x + b * y\n xx, yy = x, y\n\n\nwhile 1:\n a, b, d = list(map(int, input().split()))\n if a == 0:\n break\n xy = axby = 10**10\n for y in range(30001):\n if (d + b * y) % a == 0:\n judge((d + b * y) \/ a, y)\n if (b * y - d) % a == 0:\n judge((b * y - d) \/ a, y)\n if (d - b * y) % a == 0:\n judge((d - b * y) \/ a, y)\n print(xx, yy)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for y in range(50001):","+ for y in range(30001):"],"diff_only_import_comment":false,"measured_runtime_v0":2.061502672,"measured_runtime_v1":1.2161544886,"runtime_lift":1.6950993409,"key":["s400923829","s127207739"]} +{"user_id":"u934402094","problem_id":"p02982","language":"python","submission_id_v0":"s019304466","submission_id_v1":"s281685543","cpu_time_v0":150,"cpu_time_v1":60,"memory_v0":12392,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nimport numpy as np\n\nn, d = list(map(int, input().split()))\n\na = []\n\ncnt = 0\n\nfor x in range(n):\n\n a.append(list(map(int, input().split())))\n\nfor i in range(len(a)):\n\n for j in range(len(a)):\n\n if i < j:\n\n dis = np.array(a[i]) - np.array(a[j])\n\n if np.linalg.norm(dis).is_integer():\n\n cnt += 1\n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"n, d = list(map(int, input().split()))\n\na = [[int(i) for i in input().split()] for i in range(n)]\n\nans = 0\n\ndef dis(x,y):\n\n T = []\n\n for i in range(len(x)):\n\n T.append((x[i]-y[i])**2)\n\n return sum(T)\n\nfor i in range(n):\n\n for j in range(i+1,n):\n\n r = dis(a[i], a[j])\n\n for k in range(r + 1):\n\n if k ** 2 == r:\n\n ans += 1\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":15,"code_v0_num_chars":361,"code_v1_num_chars":385,"code_v0_no_empty_lines":"import math\nimport numpy as np\n\nn, d = list(map(int, input().split()))\na = []\ncnt = 0\nfor x in range(n):\n a.append(list(map(int, input().split())))\nfor i in range(len(a)):\n for j in range(len(a)):\n if i < j:\n dis = np.array(a[i]) - np.array(a[j])\n if np.linalg.norm(dis).is_integer():\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"n, d = list(map(int, input().split()))\na = [[int(i) for i in input().split()] for i in range(n)]\nans = 0\n\n\ndef dis(x, y):\n T = []\n for i in range(len(x)):\n T.append((x[i] - y[i]) ** 2)\n return sum(T)\n\n\nfor i in range(n):\n for j in range(i + 1, n):\n r = dis(a[i], a[j])\n for k in range(r + 1):\n if k**2 == r:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["-import math","-import numpy as np","+n, d = list(map(int, input().split()))","+a = [[int(i) for i in input().split()] for i in range(n)]","+ans = 0","-n, d = list(map(int, input().split()))","-a = []","-cnt = 0","-for x in range(n):","- a.append(list(map(int, input().split())))","-for i in range(len(a)):","- for j in range(len(a)):","- if i < j:","- dis = np.array(a[i]) - np.array(a[j])","- if np.linalg.norm(dis).is_integer():","- cnt += 1","-print(cnt)","+","+def dis(x, y):","+ T = []","+ for i in range(len(x)):","+ T.append((x[i] - y[i]) ** 2)","+ return sum(T)","+","+","+for i in range(n):","+ for j in range(i + 1, n):","+ r = dis(a[i], a[j])","+ for k in range(r + 1):","+ if k**2 == r:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.7124312692,"measured_runtime_v1":0.2432892454,"runtime_lift":7.0386640664,"key":["s019304466","s281685543"]} +{"user_id":"u821588465","problem_id":"p03000","language":"python","submission_id_v0":"s259788442","submission_id_v1":"s163625054","cpu_time_v0":29,"cpu_time_v1":25,"memory_v0":9172,"memory_v1":8984,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom itertools import accumulate\n\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\n\nL = list(tuple(map(int, input().split())))\n\n\n\nacc = sorted(list(accumulate(L)) + [0])\n\n\n\nn = bisect_right(acc,X)\n\nprint(n)\n\n\n\n\n# optimized version of the same code:\n","target":"N,X = list(map(int,input().split()))\n\nL = list(map(int,input().split()))\n\nList = [0]*(N+1)\n\nfor i in range(1,N+1):\n\n List[i] = List[i-1] + L[i-1]\n\nA = [i for i in List if i <=X]\n\nprint((len(A)))","code_v0_loc":10,"code_v1_loc":7,"code_v0_num_chars":215,"code_v1_num_chars":189,"code_v0_no_empty_lines":"from itertools import accumulate\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\nL = list(tuple(map(int, input().split())))\nacc = sorted(list(accumulate(L)) + [0])\nn = bisect_right(acc, X)\nprint(n)\n","code_v1_no_empty_lines":"N, X = list(map(int, input().split()))\nL = list(map(int, input().split()))\nList = [0] * (N + 1)\nfor i in range(1, N + 1):\n List[i] = List[i - 1] + L[i - 1]\nA = [i for i in List if i <= X]\nprint((len(A)))\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-from itertools import accumulate","-from bisect import *","-","-L = list(tuple(map(int, input().split())))","-acc = sorted(list(accumulate(L)) + [0])","-n = bisect_right(acc, X)","-print(n)","+L = list(map(int, input().split()))","+List = [0] * (N + 1)","+for i in range(1, N + 1):","+ List[i] = List[i - 1] + L[i - 1]","+A = [i for i in List if i <= X]","+print((len(A)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2199657279,"measured_runtime_v1":0.1756561113,"runtime_lift":1.2522520635,"key":["s259788442","s163625054"]} +{"user_id":"u460245024","problem_id":"p03416","language":"python","submission_id_v0":"s770002751","submission_id_v1":"s323286862","cpu_time_v0":51,"cpu_time_v1":32,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.25,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n n_s = str(n)\n\n n_s_rvs = n_s[::-1]\n\n if n_s == n_s_rvs:\n\n cnt += 1\n\n\n\nprint(cnt)\n\n\n# optimized version of the same code:\n","target":"A, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n if n\/\/10000 == n%10 and (n\/\/1000)%10 == (n\/\/10)%10:\n\n cnt += 1\n\n\n\nprint(cnt)\n","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":168,"code_v1_num_chars":158,"code_v0_no_empty_lines":"A, B = list(map(int, input().split()))\ncnt = 0\nfor n in range(A, B + 1):\n n_s = str(n)\n n_s_rvs = n_s[::-1]\n if n_s == n_s_rvs:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\ncnt = 0\nfor n in range(A, B + 1):\n if n \/\/ 10000 == n % 10 and (n \/\/ 1000) % 10 == (n \/\/ 10) % 10:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["- n_s = str(n)","- n_s_rvs = n_s[::-1]","- if n_s == n_s_rvs:","+ if n \/\/ 10000 == n % 10 and (n \/\/ 1000) % 10 == (n \/\/ 10) % 10:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3429904201,"measured_runtime_v1":0.2179555298,"runtime_lift":1.5736715671,"key":["s770002751","s323286862"]} +{"user_id":"u606045429","problem_id":"p03649","language":"python","submission_id_v0":"s241047741","submission_id_v1":"s915089659","cpu_time_v0":182,"cpu_time_v1":44,"memory_v0":12504,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.82,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom numpy import*\n\nN,*A=open(0)\n\nN,A,S,a=int(N),loadtxt(A,int),1,0\n\nwhile S:B=A\/\/N;S=sum(B);a+=S;A+=S-B*-~N\n\nprint(a)\n\n# optimized version of the same code:\n","target":"N, *A = list(map(int, open(0).read().split()))\n\n\n\nans = 0\n\nS = -1\n\nwhile S:\n\n S = sum(a \/\/ N for a in A)\n\n ans += S\n\n A = [a % N + (S - a \/\/ N) for a in A]\n\n\n\nprint(ans)\n","code_v0_loc":5,"code_v1_loc":10,"code_v0_num_chars":118,"code_v1_num_chars":173,"code_v0_no_empty_lines":"from numpy import *\n\nN, *A = open(0)\nN, A, S, a = int(N), loadtxt(A, int), 1, 0\nwhile S:\n B = A \/\/ N\n S = sum(B)\n a += S\n A += S - B * -~N\nprint(a)\n","code_v1_no_empty_lines":"N, *A = list(map(int, open(0).read().split()))\nans = 0\nS = -1\nwhile S:\n S = sum(a \/\/ N for a in A)\n ans += S\n A = [a % N + (S - a \/\/ N) for a in A]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-from numpy import *","-","-N, *A = open(0)","-N, A, S, a = int(N), loadtxt(A, int), 1, 0","+N, *A = list(map(int, open(0).read().split()))","+ans = 0","+S = -1","- B = A \/\/ N","- S = sum(B)","- a += S","- A += S - B * -~N","-print(a)","+ S = sum(a \/\/ N for a in A)","+ ans += S","+ A = [a % N + (S - a \/\/ N) for a in A]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.776489467,"measured_runtime_v1":0.278480018,"runtime_lift":6.379234962,"key":["s241047741","s915089659"]} +{"user_id":"u829249049","problem_id":"p02702","language":"python","submission_id_v0":"s047602834","submission_id_v1":"s942020484","cpu_time_v0":745,"cpu_time_v1":112,"memory_v0":27280,"memory_v1":9336,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.97,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nS=eval(input())\n\nN=len(S)\n\nmod=[0 for i in range(2019)]\n\nmod2=0\n\nten=1\n\nfor i in range(N-1,-1,-1): \n\n s=int(S[i])*ten\n\n mod2+=np.mod(s,2019)\n\n mod2=np.mod(mod2,2019)\n\n mod[mod2]+=1\n\n ten=(ten*10)%2019\n\nans=0\n\nfor i in range(2019):\n\n k=mod[i]\n\n if i==0:\n\n if k>=2:\n\n ans+=k*(k-1)\/\/2+k\n\n else:\n\n ans+=k\n\n else:\n\n if k>=2:\n\n ans+=k*(k-1)\/\/2\n\nprint(ans) \n\n# optimized version of the same code:\n","target":"S=eval(input())\n\nN=len(S)\n\nmod=[0 for i in range(2019)]\n\ns=0\n\nten=1\n\nfor i in range(N-1,-1,-1): \n\n s+=int(S[i])*ten\n\n mod2=s%2019\n\n mod[mod2]+=1\n\n ten=(ten*10)%2019\n\nans=0\n\nfor i in range(2019):\n\n k=mod[i]\n\n if i==0:\n\n if k>=2:\n\n ans+=k*(k-1)\/\/2+k\n\n else:\n\n ans+=k\n\n else:\n\n if k>=2:\n\n ans+=k*(k-1)\/\/2\n\nprint(ans) ","code_v0_loc":24,"code_v1_loc":22,"code_v0_num_chars":396,"code_v1_num_chars":339,"code_v0_no_empty_lines":"import numpy as np\n\nS = eval(input())\nN = len(S)\nmod = [0 for i in range(2019)]\nmod2 = 0\nten = 1\nfor i in range(N - 1, -1, -1):\n s = int(S[i]) * ten\n mod2 += np.mod(s, 2019)\n mod2 = np.mod(mod2, 2019)\n mod[mod2] += 1\n ten = (ten * 10) % 2019\nans = 0\nfor i in range(2019):\n k = mod[i]\n if i == 0:\n if k >= 2:\n ans += k * (k - 1) \/\/ 2 + k\n else:\n ans += k\n else:\n if k >= 2:\n ans += k * (k - 1) \/\/ 2\nprint(ans)\n","code_v1_no_empty_lines":"S = eval(input())\nN = len(S)\nmod = [0 for i in range(2019)]\ns = 0\nten = 1\nfor i in range(N - 1, -1, -1):\n s += int(S[i]) * ten\n mod2 = s % 2019\n mod[mod2] += 1\n ten = (ten * 10) % 2019\nans = 0\nfor i in range(2019):\n k = mod[i]\n if i == 0:\n if k >= 2:\n ans += k * (k - 1) \/\/ 2 + k\n else:\n ans += k\n else:\n if k >= 2:\n ans += k * (k - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import numpy as np","-","-mod2 = 0","+s = 0","- s = int(S[i]) * ten","- mod2 += np.mod(s, 2019)","- mod2 = np.mod(mod2, 2019)","+ s += int(S[i]) * ten","+ mod2 = s % 2019"],"diff_only_import_comment":false,"measured_runtime_v0":0.3945806601,"measured_runtime_v1":0.1306606822,"runtime_lift":3.0198882589,"key":["s047602834","s942020484"]} +{"user_id":"u216015528","problem_id":"p03162","language":"python","submission_id_v0":"s221937243","submission_id_v1":"s826522174","cpu_time_v0":984,"cpu_time_v1":281,"memory_v0":50312,"memory_v1":30052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":71.44,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env python3\n\ndef main():\n\n import numpy as np\n\n\n\n N = int(eval(input()))\n\n happiness = [list(map(int, input().split())) for _ in range(N)]\n\n\n\n dp = np.zeros((N, 3), dtype=np.int64)\n\n dp[0] = happiness[0]\n\n for i in range(1, N):\n\n for a, yesterday in enumerate(dp[i - 1]):\n\n for b, today in enumerate(happiness[i]):\n\n if a == b:\n\n continue\n\n dp[i][b] = max(dp[i][b], yesterday + today)\n\n print((max(dp[-1])))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\ndef main():\n\n N = int(eval(input()))\n\n happiness = [list(map(int, input().split())) for _ in range(N)]\n\n\n\n dp = [0, 0, 0]\n\n for a, b, c in happiness:\n\n dp = [max(dp[1], dp[2]) + a,\n\n max(dp[0], dp[2]) + b,\n\n max(dp[0], dp[1]) + c]\n\n print((max(dp)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":20,"code_v1_loc":15,"code_v0_num_chars":543,"code_v1_num_chars":358,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\ndef main():\n import numpy as np\n\n N = int(eval(input()))\n happiness = [list(map(int, input().split())) for _ in range(N)]\n dp = np.zeros((N, 3), dtype=np.int64)\n dp[0] = happiness[0]\n for i in range(1, N):\n for a, yesterday in enumerate(dp[i - 1]):\n for b, today in enumerate(happiness[i]):\n if a == b:\n continue\n dp[i][b] = max(dp[i][b], yesterday + today)\n print((max(dp[-1])))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\ndef main():\n N = int(eval(input()))\n happiness = [list(map(int, input().split())) for _ in range(N)]\n dp = [0, 0, 0]\n for a, b, c in happiness:\n dp = [max(dp[1], dp[2]) + a, max(dp[0], dp[2]) + b, max(dp[0], dp[1]) + c]\n print((max(dp)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["- import numpy as np","-","- dp = np.zeros((N, 3), dtype=np.int64)","- dp[0] = happiness[0]","- for i in range(1, N):","- for a, yesterday in enumerate(dp[i - 1]):","- for b, today in enumerate(happiness[i]):","- if a == b:","- continue","- dp[i][b] = max(dp[i][b], yesterday + today)","- print((max(dp[-1])))","+ dp = [0, 0, 0]","+ for a, b, c in happiness:","+ dp = [max(dp[1], dp[2]) + a, max(dp[0], dp[2]) + b, max(dp[0], dp[1]) + c]","+ print((max(dp)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.24619206,"measured_runtime_v1":0.1905300226,"runtime_lift":6.5406598015,"key":["s221937243","s826522174"]} +{"user_id":"u840247626","problem_id":"p02264","language":"python","submission_id_v0":"s571730090","submission_id_v1":"s740509038","cpu_time_v0":620,"cpu_time_v1":400,"memory_v0":13012,"memory_v1":12536,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,q = list(map(int,input().split()))\n\nqueue = []\n\nfor i in range(n):\n\n\tname,time = input().split()\n\n\tqueue.append([name, int(time)])\n\n\n\nt = 0\n\ni = 0\n\nwhile queue:\n\n\ti %= len(queue)\n\n\tp = queue[i]\n\n\tt += min(q, p[1])\n\n\tif p[1] > q:\n\n\t\tp[1] -= q\n\n\t\ti += 1\n\n\telse:\n\n\t\tprint((p[0], t))\n\n\t\tqueue.pop(i)\n\n\n# optimized version of the same code:\n","target":"from collections import deque\n\n\n\nn,q = list(map(int,input().split()))\n\nqueue = deque()\n\nfor i in range(n):\n\n\tname,time = input().split()\n\n\tqueue.append((name, int(time)))\n\n\n\nt = 0\n\nwhile queue:\n\n\tname,time = queue.popleft()\n\n\tt += min(q, time)\n\n\tif time > q:\n\n\t\tqueue.append((name, time-q))\n\n\telse:\n\n\t\tprint((name,t))\n","code_v0_loc":18,"code_v1_loc":16,"code_v0_num_chars":290,"code_v1_num_chars":310,"code_v0_no_empty_lines":"n, q = list(map(int, input().split()))\nqueue = []\nfor i in range(n):\n name, time = input().split()\n queue.append([name, int(time)])\nt = 0\ni = 0\nwhile queue:\n i %= len(queue)\n p = queue[i]\n t += min(q, p[1])\n if p[1] > q:\n p[1] -= q\n i += 1\n else:\n print((p[0], t))\n queue.pop(i)\n","code_v1_no_empty_lines":"from collections import deque\n\nn, q = list(map(int, input().split()))\nqueue = deque()\nfor i in range(n):\n name, time = input().split()\n queue.append((name, int(time)))\nt = 0\nwhile queue:\n name, time = queue.popleft()\n t += min(q, time)\n if time > q:\n queue.append((name, time - q))\n else:\n print((name, t))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["+from collections import deque","+","-queue = []","+queue = deque()","- queue.append([name, int(time)])","+ queue.append((name, int(time)))","-i = 0","- i %= len(queue)","- p = queue[i]","- t += min(q, p[1])","- if p[1] > q:","- p[1] -= q","- i += 1","+ name, time = queue.popleft()","+ t += min(q, time)","+ if time > q:","+ queue.append((name, time - q))","- print((p[0], t))","- queue.pop(i)","+ print((name, t))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3202849953,"measured_runtime_v1":0.2467377391,"runtime_lift":1.2980786664,"key":["s571730090","s740509038"]} +{"user_id":"u597374218","problem_id":"p03796","language":"python","submission_id_v0":"s636787028","submission_id_v1":"s575140392","cpu_time_v0":154,"cpu_time_v1":44,"memory_v0":10168,"memory_v1":9028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":71.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nN=int(eval(input()))\n\nprint((math.factorial(N)%(10**9+7)))\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\npower=1\n\nfor i in range(1,N+1):\n\n power*=i\n\n power%=10**9+7\n\nprint(power)","code_v0_loc":3,"code_v1_loc":6,"code_v0_num_chars":63,"code_v1_num_chars":95,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nprint((math.factorial(N) % (10**9 + 7)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\npower = 1\nfor i in range(1, N + 1):\n power *= i\n power %= 10**9 + 7\nprint(power)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import math","-","-print((math.factorial(N) % (10**9 + 7)))","+power = 1","+for i in range(1, N + 1):","+ power *= i","+ power %= 10**9 + 7","+print(power)"],"diff_only_import_comment":false,"measured_runtime_v0":0.6653705416,"measured_runtime_v1":0.3042658694,"runtime_lift":2.1868063707,"key":["s636787028","s575140392"]} +{"user_id":"u970197315","problem_id":"p03371","language":"python","submission_id_v0":"s588181559","submission_id_v1":"s154731902","cpu_time_v0":63,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.02,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# ABC95 C -Half and Half\n\na,b,c,x,y = list(map(float,input().split()))\n\nans = 0\n\nif a+b > 2*c:\n\n while x != 0.0 and y != 0.0:\n\n ans += 2*c\n\n x -= 1.0\n\n y -= 1.0\n\n if y == 0.0:\n\n while x != 0.0:\n\n if a > 2*c:\n\n ans += 2*c\n\n x -= 1.0\n\n else:\n\n ans += a\n\n x -= 1.0\n\n if x == 0.0:\n\n while y != 0.0:\n\n if b > 2*c:\n\n ans += 2*c\n\n y -= 1.0\n\n else:\n\n ans += b\n\n y -= 1.0\n\nelse:\n\n ans += a*x + b*y\n\nprint((int(ans)))\n\n\n\n \n\n# optimized version of the same code:\n","target":"a,b,c,x,y=list(map(int,input().split()))\n\nans=0\n\nans1=0\n\n\n\ne=max(x,y)\n\nans1=e*(2*c)\n\nif 2*c 2 * c:\n while x != 0.0 and y != 0.0:\n ans += 2 * c\n x -= 1.0\n y -= 1.0\n if y == 0.0:\n while x != 0.0:\n if a > 2 * c:\n ans += 2 * c\n x -= 1.0\n else:\n ans += a\n x -= 1.0\n if x == 0.0:\n while y != 0.0:\n if b > 2 * c:\n ans += 2 * c\n y -= 1.0\n else:\n ans += b\n y -= 1.0\nelse:\n ans += a * x + b * y\nprint((int(ans)))\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = 0\nans1 = 0\ne = max(x, y)\nans1 = e * (2 * c)\nif 2 * c < a + b:\n d = min(x, y)\n ans += c * (2 * d)\n x -= d\n y -= d\nelse:\n ans = a * x + b * y\n x -= x\n y -= y\nans += x * a\nans += y * b\nprint((min(ans, ans1)))\n","code_same":false,"relative_loc_diff_percent":37.9310344828,"diff":["-# ABC95 C -Half and Half","-a, b, c, x, y = list(map(float, input().split()))","+a, b, c, x, y = list(map(int, input().split()))","-if a + b > 2 * c:","- while x != 0.0 and y != 0.0:","- ans += 2 * c","- x -= 1.0","- y -= 1.0","- if y == 0.0:","- while x != 0.0:","- if a > 2 * c:","- ans += 2 * c","- x -= 1.0","- else:","- ans += a","- x -= 1.0","- if x == 0.0:","- while y != 0.0:","- if b > 2 * c:","- ans += 2 * c","- y -= 1.0","- else:","- ans += b","- y -= 1.0","+ans1 = 0","+e = max(x, y)","+ans1 = e * (2 * c)","+if 2 * c < a + b:","+ d = min(x, y)","+ ans += c * (2 * d)","+ x -= d","+ y -= d","- ans += a * x + b * y","-print((int(ans)))","+ ans = a * x + b * y","+ x -= x","+ y -= y","+ans += x * a","+ans += y * b","+print((min(ans, ans1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3221288462,"measured_runtime_v1":0.2473681471,"runtime_lift":1.3022244371,"key":["s588181559","s154731902"]} +{"user_id":"u341087021","problem_id":"p03640","language":"python","submission_id_v0":"s359248340","submission_id_v1":"s719148337","cpu_time_v0":284,"cpu_time_v1":25,"memory_v0":20484,"memory_v1":3568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.2,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nh,w = [int(x) for x in sys.stdin.readline().split()]\n\nn = int(eval(input()))\n\na = [int(x) for x in sys.stdin.readline().split()]\n\ns = h*w\n\n\n\nl = []\n\n\n\nfor i,x in enumerate(a):\n\n\tfor j in range(x):\n\n\t\tl.append(i+1)\n\n\n\nl = np.array(l).reshape((h,w))\n\n\n\nfor i,x in enumerate(l):\n\n\tif i % 2 == 0:\n\n\t\tprint((' '.join(map(str, x))))\n\n\telse:\n\n\t\tprint((' '.join(map(str, reversed(x)))))\n\n# optimized version of the same code:\n","target":"h,w = list(map(int, input().split()))\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\nl = []\n\n\n\nfor i,x in enumerate(a):\n\n\tfor j in range(x):\n\n\t\tl.append(i+1)\n\n\n\nfor i in range(h):\n\n\tt = l[i*w:(i+1)*w]\n\n\tif i % 2 == 1:\n\n\t\tt.reverse()\n\n\tprint((' '.join(map(str, t))))","code_v0_loc":21,"code_v1_loc":15,"code_v0_num_chars":402,"code_v1_num_chars":262,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nh, w = [int(x) for x in sys.stdin.readline().split()]\nn = int(eval(input()))\na = [int(x) for x in sys.stdin.readline().split()]\ns = h * w\nl = []\nfor i, x in enumerate(a):\n for j in range(x):\n l.append(i + 1)\nl = np.array(l).reshape((h, w))\nfor i, x in enumerate(l):\n if i % 2 == 0:\n print((\" \".join(map(str, x))))\n else:\n print((\" \".join(map(str, reversed(x)))))\n","code_v1_no_empty_lines":"h, w = list(map(int, input().split()))\nn = int(eval(input()))\na = list(map(int, input().split()))\nl = []\nfor i, x in enumerate(a):\n for j in range(x):\n l.append(i + 1)\nfor i in range(h):\n t = l[i * w : (i + 1) * w]\n if i % 2 == 1:\n t.reverse()\n print((\" \".join(map(str, t))))\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-import sys","-import numpy as np","-","-h, w = [int(x) for x in sys.stdin.readline().split()]","+h, w = list(map(int, input().split()))","-a = [int(x) for x in sys.stdin.readline().split()]","-s = h * w","+a = list(map(int, input().split()))","-l = np.array(l).reshape((h, w))","-for i, x in enumerate(l):","- if i % 2 == 0:","- print((\" \".join(map(str, x))))","- else:","- print((\" \".join(map(str, reversed(x)))))","+for i in range(h):","+ t = l[i * w : (i + 1) * w]","+ if i % 2 == 1:","+ t.reverse()","+ print((\" \".join(map(str, t))))"],"diff_only_import_comment":false,"measured_runtime_v0":2.9760328727,"measured_runtime_v1":0.443032949,"runtime_lift":6.7174075416,"key":["s359248340","s719148337"]} +{"user_id":"u693378622","problem_id":"p03032","language":"python","submission_id_v0":"s328121940","submission_id_v1":"s024934592","cpu_time_v0":295,"cpu_time_v1":35,"memory_v0":21272,"memory_v1":3572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.14,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# coding: utf-8\n\nimport copy\n\nimport numpy as np\n\n\n\nn, k = list(map(int, input().split()))\n\nv = list(map(int, input().split()))\n\nrev = copy.copy(v)\n\nrev.reverse()\n\n\n\nlcs = [0]+np.cumsum(v)\n\nrcs = [0]+np.cumsum(rev)\n\n# print(lcs,rcs)\n\n\n\nans = -10**20\n\nfor l in range(n+1):\n\n for r in range(n+1-l):\n\n able = True\n\n d = k - ( l + r )\n\n if d < 0:\n\n able = False\n\n break\n\n # m = lcs[l] + rcs[r]\n\n t = v[0:l] + rev[0:r]\n\n m = sum(t)\n\n # print(t,l,r,m)\n\n t.sort()\n\n # print(t)\n\n d = min(d,l+r)\n\n for i in range(d):\n\n if 0 > t[i]:\n\n m -= t[i]\n\n else:\n\n break\n\n # print(m)\n\n ans = max(ans,m)\n\n\n\nprint(ans)\n\n \n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nimport copy\n\n\n\nn, k = list(map(int, input().split()))\n\nv = list(map(int, input().split()))\n\nrev = copy.copy(v)\n\nrev.reverse()\n\n\n\nans = -10**20\n\nfor l in range(n+1):\n\n for r in range(n+1-l):\n\n able = True\n\n d = k - ( l + r )\n\n if d < 0:\n\n able = False\n\n break\n\n t = v[0:l] + rev[0:r]\n\n m = sum(t)\n\n t.sort()\n\n d = min(d,l+r)\n\n for i in range(d):\n\n if 0 > t[i]:\n\n m -= t[i]\n\n else:\n\n break\n\n ans = max(ans,m)\n\n\n\nprint(ans)","code_v0_loc":38,"code_v1_loc":28,"code_v0_num_chars":670,"code_v1_num_chars":493,"code_v0_no_empty_lines":"# coding: utf-8\nimport copy\nimport numpy as np\n\nn, k = list(map(int, input().split()))\nv = list(map(int, input().split()))\nrev = copy.copy(v)\nrev.reverse()\nlcs = [0] + np.cumsum(v)\nrcs = [0] + np.cumsum(rev)\n# print(lcs,rcs)\nans = -(10**20)\nfor l in range(n + 1):\n for r in range(n + 1 - l):\n able = True\n d = k - (l + r)\n if d < 0:\n able = False\n break\n # m = lcs[l] + rcs[r]\n t = v[0:l] + rev[0:r]\n m = sum(t)\n # print(t,l,r,m)\n t.sort()\n # print(t)\n d = min(d, l + r)\n for i in range(d):\n if 0 > t[i]:\n m -= t[i]\n else:\n break\n # print(m)\n ans = max(ans, m)\nprint(ans)\n","code_v1_no_empty_lines":"# coding: utf-8\nimport copy\n\nn, k = list(map(int, input().split()))\nv = list(map(int, input().split()))\nrev = copy.copy(v)\nrev.reverse()\nans = -(10**20)\nfor l in range(n + 1):\n for r in range(n + 1 - l):\n able = True\n d = k - (l + r)\n if d < 0:\n able = False\n break\n t = v[0:l] + rev[0:r]\n m = sum(t)\n t.sort()\n d = min(d, l + r)\n for i in range(d):\n if 0 > t[i]:\n m -= t[i]\n else:\n break\n ans = max(ans, m)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":26.3157894737,"diff":["-import numpy as np","-lcs = [0] + np.cumsum(v)","-rcs = [0] + np.cumsum(rev)","-# print(lcs,rcs)","- # m = lcs[l] + rcs[r]","- # print(t,l,r,m)","- # print(t)","- # print(m)"],"diff_only_import_comment":false,"measured_runtime_v0":1.380007833,"measured_runtime_v1":0.1766864235,"runtime_lift":7.8104916341,"key":["s328121940","s024934592"]} +{"user_id":"u894934980","problem_id":"p03162","language":"python","submission_id_v0":"s199056850","submission_id_v1":"s898635714","cpu_time_v0":704,"cpu_time_v1":544,"memory_v0":31732,"memory_v1":22772,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\ndp = [[0, 0, 0] for i in range(N+1)]\n\nfor i in range(1, N+1):\n\n a, b, c = list(map(int, input().split(' ')))\n\n dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a\n\n dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b\n\n dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c\n\nprint((np.max(dp[-1])))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\ndp = [[0, 0, 0] for i in range(N+1)]\n\nfor i in range(1, N+1):\n\n a, b, c = list(map(int, input().split(' ')))\n\n dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a\n\n dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b\n\n dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c\n\nprint((max(dp[-1])))","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":316,"code_v1_num_chars":293,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\ndp = [[0, 0, 0] for i in range(N + 1)]\nfor i in range(1, N + 1):\n a, b, c = list(map(int, input().split(\" \")))\n dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a\n dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b\n dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c\nprint((np.max(dp[-1])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\ndp = [[0, 0, 0] for i in range(N + 1)]\nfor i in range(1, N + 1):\n a, b, c = list(map(int, input().split(\" \")))\n dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a\n dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b\n dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c\nprint((max(dp[-1])))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-import numpy as np","-","-print((np.max(dp[-1])))","+print((max(dp[-1])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4440617442,"measured_runtime_v1":0.3020155485,"runtime_lift":4.7814152334,"key":["s199056850","s898635714"]} +{"user_id":"u632413369","problem_id":"p02595","language":"python","submission_id_v0":"s512106161","submission_id_v1":"s251902862","cpu_time_v0":491,"cpu_time_v1":390,"memory_v0":9080,"memory_v1":9188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.57,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x ** 2 + y ** 2 <= D ** 2:\n\n cnt += 1\n\n \n\nprint(cnt)\n\n# optimized version of the same code:\n","target":"N, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x * x + y * y <= D * D:\n\n cnt += 1\n\n \n\nprint(cnt)","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":174,"code_v1_num_chars":171,"code_v0_no_empty_lines":"N, D = list(map(int, input().split()))\ncnt = 0\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if x**2 + y**2 <= D**2:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"N, D = list(map(int, input().split()))\ncnt = 0\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if x * x + y * y <= D * D:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if x**2 + y**2 <= D**2:","+ if x * x + y * y <= D * D:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1756704731,"measured_runtime_v1":0.0073727348,"runtime_lift":23.8270435573,"key":["s512106161","s251902862"]} +{"user_id":"u072717685","problem_id":"p02690","language":"python","submission_id_v0":"s483749071","submission_id_v1":"s341017329","cpu_time_v0":162,"cpu_time_v1":124,"memory_v0":27024,"memory_v1":27028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.46,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nread = sys.stdin.read\n\nreadlines = sys.stdin.readlines\n\nimport numpy as np\n\ndef main():\n\n x = int(eval(input()))\n\n for i1 in range(-201, 201):\n\n for i2 in range(-201, 201):\n\n if i1**5 - i2**5 == x:\n\n print((i1, i2))\n\n sys.exit()\n\n\n\nif __name__ == '__main__':\n\n main()\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.read\n\nreadlines = sys.stdin.readlines\n\nimport numpy as np\n\nfrom itertools import product\n\ndef main():\n\n x = int(input())\n\n n5 = [i**5 for i in range(201)]\n\n\n\n c = product(n5, repeat=2)\n\n for ce in c:\n\n if ce[0] + ce[1] == x:\n\n r = (int(ce[0]**0.2), int(ce[1]**0.2)* -1)\n\n break\n\n elif ce[0] - ce[1] == x:\n\n r = (int(ce[0] ** 0.2), int(ce[1] ** 0.2))\n\n break\n\n print(*r, sep=' ')\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":14,"code_v1_loc":21,"code_v0_num_chars":328,"code_v1_num_chars":522,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nimport numpy as np\n\n\ndef main():\n x = int(eval(input()))\n for i1 in range(-201, 201):\n for i2 in range(-201, 201):\n if i1**5 - i2**5 == x:\n print((i1, i2))\n sys.exit()\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nimport numpy as np\nfrom itertools import product\n\n\ndef main():\n x = int(input())\n n5 = [i**5 for i in range(201)]\n c = product(n5, repeat=2)\n for ce in c:\n if ce[0] + ce[1] == x:\n r = (int(ce[0] ** 0.2), int(ce[1] ** 0.2) * -1)\n break\n elif ce[0] - ce[1] == x:\n r = (int(ce[0] ** 0.2), int(ce[1] ** 0.2))\n break\n print(*r, sep=\" \")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["+from itertools import product","- x = int(eval(input()))","- for i1 in range(-201, 201):","- for i2 in range(-201, 201):","- if i1**5 - i2**5 == x:","- print((i1, i2))","- sys.exit()","+ x = int(input())","+ n5 = [i**5 for i in range(201)]","+ c = product(n5, repeat=2)","+ for ce in c:","+ if ce[0] + ce[1] == x:","+ r = (int(ce[0] ** 0.2), int(ce[1] ** 0.2) * -1)","+ break","+ elif ce[0] - ce[1] == x:","+ r = (int(ce[0] ** 0.2), int(ce[1] ** 0.2))","+ break","+ print(*r, sep=\" \")"],"diff_only_import_comment":false,"measured_runtime_v0":0.6760180672,"measured_runtime_v1":0.2428507467,"runtime_lift":2.7836771199,"key":["s483749071","s341017329"]} +{"user_id":"u588341295","problem_id":"p03696","language":"python","submission_id_v0":"s490534414","submission_id_v1":"s928447020","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\ndef input(): return sys.stdin.readline().strip()\n\nsys.setrecursionlimit(10 ** 9)\n\n\n\nfrom collections import deque\n\n\n\nN = int(eval(input()))\n\nS = eval(input())\n\n\n\nans = deque()\n\ntmp = ''\n\nl = r = 0\n\nfor c in S:\n\n if c == '(':\n\n l += 1\n\n tmp += '('\n\n else:\n\n if l == 0:\n\n ans.appendleft('(')\n\n ans.append(')')\n\n else:\n\n r += 1\n\n tmp += ')'\n\n if l == r:\n\n ans.append(tmp)\n\n tmp = ''\n\n l = r = 0\n\nif l > r:\n\n tmp += ')' * (l-r)\n\n ans.append(tmp)\n\nprint((''.join(ans)))\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\n\n\nN = INT()\n\nS = eval(input())\n\n\n\n# \u305d\u308c\u305e\u308c\u5fc5\u8981\u306a\u6570\u3092\u78ba\u8a8d\n\nlneed = cnt = 0\n\nfor s in S:\n\n if s == ')':\n\n cnt += 1\n\n lneed = max(lneed, cnt)\n\n else:\n\n cnt -= 1\n\nrneed = cnt = 0\n\nfor s in S[::-1]:\n\n if s == '(':\n\n cnt += 1\n\n rneed = max(rneed, cnt)\n\n else:\n\n cnt -= 1\n\n\n\n# \u8f9e\u66f8\u9806\u6700\u5c0f\u306a\u306e\u3067\u3001(\u306f\u5168\u90e8\u5de6\u306b\u3001)\u306f\u5168\u90e8\u53f3\u306b\u4ed8\u3051\u308b\n\nans = ('(' * lneed) + S + (')' * rneed)\n\nprint(ans)\n","code_v0_loc":33,"code_v1_loc":42,"code_v0_num_chars":630,"code_v1_num_chars":1083,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\nsys.setrecursionlimit(10**9)\nfrom collections import deque\n\nN = int(eval(input()))\nS = eval(input())\nans = deque()\ntmp = \"\"\nl = r = 0\nfor c in S:\n if c == \"(\":\n l += 1\n tmp += \"(\"\n else:\n if l == 0:\n ans.appendleft(\"(\")\n ans.append(\")\")\n else:\n r += 1\n tmp += \")\"\n if l == r:\n ans.append(tmp)\n tmp = \"\"\n l = r = 0\nif l > r:\n tmp += \")\" * (l - r)\n ans.append(tmp)\nprint((\"\".join(ans)))\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef list4d(a, b, c, d, e):\n return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x \/\/ y))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST(N=None):\n return list(MAP()) if N is None else [INT() for i in range(N)]\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = 10**18\nMOD = 10**9 + 7\nN = INT()\nS = eval(input())\n# \u305d\u308c\u305e\u308c\u5fc5\u8981\u306a\u6570\u3092\u78ba\u8a8d\nlneed = cnt = 0\nfor s in S:\n if s == \")\":\n cnt += 1\n lneed = max(lneed, cnt)\n else:\n cnt -= 1\nrneed = cnt = 0\nfor s in S[::-1]:\n if s == \"(\":\n cnt += 1\n rneed = max(rneed, cnt)\n else:\n cnt -= 1\n# \u8f9e\u66f8\u9806\u6700\u5c0f\u306a\u306e\u3067\u3001(\u306f\u5168\u90e8\u5de6\u306b\u3001)\u306f\u5168\u90e8\u53f3\u306b\u4ed8\u3051\u308b\nans = (\"(\" * lneed) + S + (\")\" * rneed)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["+def list2d(a, b, c):","+ return [[c] * b for i in range(a)]","+","+","+def list3d(a, b, c, d):","+ return [[[d] * c for j in range(b)] for i in range(a)]","+","+","+def list4d(a, b, c, d, e):","+ return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]","+","+","+def ceil(x, y=1):","+ return int(-(-x \/\/ y))","+","+","+def INT():","+ return int(eval(input()))","+","+","+def MAP():","+ return list(map(int, input().split()))","+","+","+def LIST(N=None):","+ return list(MAP()) if N is None else [INT() for i in range(N)]","+","+","+def Yes():","+ print(\"Yes\")","+","+","+def No():","+ print(\"No\")","+","+","+def YES():","+ print(\"YES\")","+","+","+def NO():","+ print(\"NO\")","+","+","-from collections import deque","-","-N = int(eval(input()))","+INF = 10**18","+MOD = 10**9 + 7","+N = INT()","-ans = deque()","-tmp = \"\"","-l = r = 0","-for c in S:","- if c == \"(\":","- l += 1","- tmp += \"(\"","+# \u305d\u308c\u305e\u308c\u5fc5\u8981\u306a\u6570\u3092\u78ba\u8a8d","+lneed = cnt = 0","+for s in S:","+ if s == \")\":","+ cnt += 1","+ lneed = max(lneed, cnt)","- if l == 0:","- ans.appendleft(\"(\")","- ans.append(\")\")","- else:","- r += 1","- tmp += \")\"","- if l == r:","- ans.append(tmp)","- tmp = \"\"","- l = r = 0","-if l > r:","- tmp += \")\" * (l - r)","- ans.append(tmp)","-print((\"\".join(ans)))","+ cnt -= 1","+rneed = cnt = 0","+for s in S[::-1]:","+ if s == \"(\":","+ cnt += 1","+ rneed = max(rneed, cnt)","+ else:","+ cnt -= 1","+# \u8f9e\u66f8\u9806\u6700\u5c0f\u306a\u306e\u3067\u3001(\u306f\u5168\u90e8\u5de6\u306b\u3001)\u306f\u5168\u90e8\u53f3\u306b\u4ed8\u3051\u308b","+ans = (\"(\" * lneed) + S + (\")\" * rneed)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2003027639,"measured_runtime_v1":0.0062589979,"runtime_lift":32.0023694319,"key":["s490534414","s928447020"]} +{"user_id":"u617515020","problem_id":"p02814","language":"python","submission_id_v0":"s956521329","submission_id_v1":"s164820491","cpu_time_v0":67,"cpu_time_v1":51,"memory_v0":16316,"memory_v1":20372,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.88,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom fractions import gcd\n\n\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\n\n\na=list([x\/\/2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) \/\/ gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\n\n\nif (lcma\/\/a[0])%2==0:\n\n print((0))\n\nelse:\n\n flg=0\n\n for i in range(1,len(a)):\n\n if (lcma\/\/a[i])%2==0:\n\n print((0))\n\n flg=1\n\n break\n\n if flg==0:\n\n temp=m\/\/lcma\n\n print((temp\/\/2 if temp%2==0 else temp\/\/2+1))\n\n# optimized version of the same code:\n","target":"from math import gcd\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\na=list([x\/\/2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) \/\/ gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\nfor i in range(len(a)):\n\n if (lcma\/\/a[i])%2==0:\n\n print((0))\n\n exit()\n\ntemp=m\/\/lcma\n\nprint((temp\/\/2 if temp%2==0 else temp\/\/2+1))","code_v0_loc":28,"code_v1_loc":19,"code_v0_num_chars":492,"code_v1_num_chars":386,"code_v0_no_empty_lines":"from fractions import gcd\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = list(set(a))\na = list([x \/\/ 2 for x in a])\n\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) \/\/ gcd(x, q[i])\n return x\n\n\nlcma = lcm(a)\nif (lcma \/\/ a[0]) % 2 == 0:\n print((0))\nelse:\n flg = 0\n for i in range(1, len(a)):\n if (lcma \/\/ a[i]) % 2 == 0:\n print((0))\n flg = 1\n break\n if flg == 0:\n temp = m \/\/ lcma\n print((temp \/\/ 2 if temp % 2 == 0 else temp \/\/ 2 + 1))\n","code_v1_no_empty_lines":"from math import gcd\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = list(set(a))\na = list([x \/\/ 2 for x in a])\n\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) \/\/ gcd(x, q[i])\n return x\n\n\nlcma = lcm(a)\nfor i in range(len(a)):\n if (lcma \/\/ a[i]) % 2 == 0:\n print((0))\n exit()\ntemp = m \/\/ lcma\nprint((temp \/\/ 2 if temp % 2 == 0 else temp \/\/ 2 + 1))\n","code_same":false,"relative_loc_diff_percent":32.1428571429,"diff":["-from fractions import gcd","+from math import gcd","-if (lcma \/\/ a[0]) % 2 == 0:","- print((0))","-else:","- flg = 0","- for i in range(1, len(a)):","- if (lcma \/\/ a[i]) % 2 == 0:","- print((0))","- flg = 1","- break","- if flg == 0:","- temp = m \/\/ lcma","- print((temp \/\/ 2 if temp % 2 == 0 else temp \/\/ 2 + 1))","+for i in range(len(a)):","+ if (lcma \/\/ a[i]) % 2 == 0:","+ print((0))","+ exit()","+temp = m \/\/ lcma","+print((temp \/\/ 2 if temp % 2 == 0 else temp \/\/ 2 + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2803374403,"measured_runtime_v1":0.2137892873,"runtime_lift":1.3112791747,"key":["s956521329","s164820491"]} +{"user_id":"u209275335","problem_id":"p02693","language":"python","submission_id_v0":"s337733409","submission_id_v1":"s217218479","cpu_time_v0":61,"cpu_time_v1":22,"memory_v0":61660,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.93,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = int(eval(input()))\n\na = 0\n\ncount = 0\n\nn,m = list(map(int,input().split()))\n\nwhile count == 0:\n\n a += S\n\n if n <= a and m >= a:\n\n count = 1\n\n if a >= 1000:\n\n break\n\nif count == 0:\n\n print(\"NG\")\n\nelse:\n\n print(\"OK\")\n\n# optimized version of the same code:\n","target":"k = int(eval(input()))\n\nn = 0\n\na,b = list(map(int,input().split()))\n\nwhile True:\n\n n += k\n\n if n >= a and n <= b:\n\n print(\"OK\")\n\n break\n\n if n > b:\n\n print(\"NG\")\n\n break","code_v0_loc":14,"code_v1_loc":11,"code_v0_num_chars":234,"code_v1_num_chars":194,"code_v0_no_empty_lines":"S = int(eval(input()))\na = 0\ncount = 0\nn, m = list(map(int, input().split()))\nwhile count == 0:\n a += S\n if n <= a and m >= a:\n count = 1\n if a >= 1000:\n break\nif count == 0:\n print(\"NG\")\nelse:\n print(\"OK\")\n","code_v1_no_empty_lines":"k = int(eval(input()))\nn = 0\na, b = list(map(int, input().split()))\nwhile True:\n n += k\n if n >= a and n <= b:\n print(\"OK\")\n break\n if n > b:\n print(\"NG\")\n break\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-S = int(eval(input()))","-a = 0","-count = 0","-n, m = list(map(int, input().split()))","-while count == 0:","- a += S","- if n <= a and m >= a:","- count = 1","- if a >= 1000:","+k = int(eval(input()))","+n = 0","+a, b = list(map(int, input().split()))","+while True:","+ n += k","+ if n >= a and n <= b:","+ print(\"OK\")","-if count == 0:","- print(\"NG\")","-else:","- print(\"OK\")","+ if n > b:","+ print(\"NG\")","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.2075882792,"measured_runtime_v1":0.0060749435,"runtime_lift":34.1712276754,"key":["s337733409","s217218479"]} +{"user_id":"u038021590","problem_id":"p03171","language":"python","submission_id_v0":"s330952971","submission_id_v1":"s165498833","cpu_time_v0":615,"cpu_time_v1":234,"memory_v0":115036,"memory_v1":135316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.95,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nn = N % 2\n\n\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor w in range(1, N+1):\n\n for i in range(N):\n\n j = i + w\n\n if j > N:\n\n continue\n\n if (w+n) % 2 == 1:\n\n DP[i][j] = min(DP[i+1][j] - A[i], DP[i][j-1] - A[j-1])\n\n else:\n\n DP[i][j] = max(DP[i+1][j] + A[i], DP[i][j-1] + A[j-1])\n\n\n\nprint((DP[0][N]))\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor num in range(1, N + 1):\n\n for start in range(N):\n\n end = start + num\n\n if end > N:\n\n break\n\n if num == 1:\n\n DP[start][end] = A[start]\n\n else:\n\n DP[start][end] = max(A[start] - DP[start+1][end], A[end - 1] - DP[start][end - 1])\n\nprint((DP[0][N]))\n","code_v0_loc":17,"code_v1_loc":14,"code_v0_num_chars":416,"code_v1_num_chars":409,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nn = N % 2\nDP = [[0] * (N + 1) for _ in range(N + 1)]\nfor w in range(1, N + 1):\n for i in range(N):\n j = i + w\n if j > N:\n continue\n if (w + n) % 2 == 1:\n DP[i][j] = min(DP[i + 1][j] - A[i], DP[i][j - 1] - A[j - 1])\n else:\n DP[i][j] = max(DP[i + 1][j] + A[i], DP[i][j - 1] + A[j - 1])\nprint((DP[0][N]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nDP = [[0] * (N + 1) for _ in range(N + 1)]\nfor num in range(1, N + 1):\n for start in range(N):\n end = start + num\n if end > N:\n break\n if num == 1:\n DP[start][end] = A[start]\n else:\n DP[start][end] = max(\n A[start] - DP[start + 1][end], A[end - 1] - DP[start][end - 1]\n )\nprint((DP[0][N]))\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["-n = N % 2","-for w in range(1, N + 1):","- for i in range(N):","- j = i + w","- if j > N:","- continue","- if (w + n) % 2 == 1:","- DP[i][j] = min(DP[i + 1][j] - A[i], DP[i][j - 1] - A[j - 1])","+for num in range(1, N + 1):","+ for start in range(N):","+ end = start + num","+ if end > N:","+ break","+ if num == 1:","+ DP[start][end] = A[start]","- DP[i][j] = max(DP[i + 1][j] + A[i], DP[i][j - 1] + A[j - 1])","+ DP[start][end] = max(","+ A[start] - DP[start + 1][end], A[end - 1] - DP[start][end - 1]","+ )"],"diff_only_import_comment":false,"measured_runtime_v0":0.1878290408,"measured_runtime_v1":0.0068282696,"runtime_lift":27.5075605354,"key":["s330952971","s165498833"]} +{"user_id":"u949115942","problem_id":"p02837","language":"python","submission_id_v0":"s340353046","submission_id_v1":"s559860999","cpu_time_v0":262,"cpu_time_v1":184,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.77,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\n\n\nXY = []\n\nfor i in range(n):\n\n a = int(eval(input()))\n\n xy = []\n\n for j in range(a):\n\n xy.append(list(map(int, input().split())))\n\n \n\n XY.append(xy)\n\n \n\ndef check(i, xiyj, HoU):\n\n # \u77db\u76fe\u3057\u305f\u3089False \u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3057\u305f\u8a3c\u8a00\u3088\u308a \u6b63\u76f4&\u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b \/ \u4e0d\u89aa\u5207&\u4e0d\u89aa\u5207\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b True\n\n if ((i >> xiyj) & 1) ^ HoU:\n\n return False\n\n\n\n return True\n\n \n\nmax_honest = 0\n\nfor i in range(2 ** len(XY)):\n\n count = 0\n\n is_contradiction = True\n\n for j in range(len(XY)):\n\n # \u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3057\u305f\u3068\u304d\u3060\u3051\u63a1\u7528\n\n if not ((i >> j) & 1): continue\n\n for k in range(len(XY[j])):\n\n xiyj = XY[j][k][0] - 1\n\n HoU = XY[j][k][1]\n\n \n\n if not check(i, xiyj, HoU):\n\n is_contradiction = False\n\n break\n\n \n\n if not is_contradiction:\n\n break\n\n\n\n if is_contradiction:\n\n for j in range(len(XY)):\n\n if ((i >> j) & 1): count+=1 \n\n \n\n if count > max_honest:\n\n max_honest =count\n\n \n\nprint(max_honest)\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\n\n\nXY = []\n\nfor i in range(n):\n\n a = int(eval(input()))\n\n xy = []\n\n for j in range(a):\n\n xy.append(list(map(int, input().split())))\n\n \n\n XY.append(xy)\n\n\n\n\"\"\"\n\n \u77db\u76fe\u3057\u305f\u3089False\n\n \u77db\u76fe\u3057\u306a\u3051\u308c\u3070True\n\n \u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3057\u305f\u8005\u306e\u8a3c\u8a00\n\n \u6b63\u76f4&\u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b\n\n \u4e0d\u89aa\u5207&\u4e0d\u89aa\u5207\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b\n\n\"\"\"\n\ndef check(i, xiyj, HoU):\n\n # XOR\n\n if HoU ^ ((i >> xiyj) & 1):\n\n return False\n\n\n\n return True\n\n\n\nmax_honest = 0\n\nfor i in range(2 ** len(XY)):\n\n count = 0\n\n is_contradiction = True\n\n for j in range(len(XY)):\n\n # \u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3057\u305f\u3068\u304d\u3060\u3051\u63a1\u7528\n\n if not ((i >> j) & 1): continue\n\n count+=1\n\n for k in range(len(XY[j])):\n\n xiyj = XY[j][k][0] - 1\n\n HoU = XY[j][k][1]\n\n \n\n if not check(i, xiyj, HoU):\n\n is_contradiction = False\n\n break # TLE\u5bfe\u7b56\n\n \n\n if not is_contradiction:\n\n break # TLE\u5bfe\u7b56\n\n\n\n # \u77db\u76fe\u304c\u306a\u304f\u3001\u6b63\u76f4\u8005\u306e\u6570\u304c\u66f4\u65b0\u3067\u304d\u308c\u3070\u66f4\u65b0\n\n if is_contradiction and (count > max_honest):\n\n max_honest =count\n\n \n\nprint(max_honest)","code_v0_loc":44,"code_v1_loc":49,"code_v0_num_chars":1065,"code_v1_num_chars":1066,"code_v0_no_empty_lines":"n = int(eval(input()))\nXY = []\nfor i in range(n):\n a = int(eval(input()))\n xy = []\n for j in range(a):\n xy.append(list(map(int, input().split())))\n XY.append(xy)\n\n\ndef check(i, xiyj, HoU):\n # \u77db\u76fe\u3057\u305f\u3089False \u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3057\u305f\u8a3c\u8a00\u3088\u308a \u6b63\u76f4&\u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b \/ \u4e0d\u89aa\u5207&\u4e0d\u89aa\u5207\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b True\n if ((i >> xiyj) & 1) ^ HoU:\n return False\n return True\n\n\nmax_honest = 0\nfor i in range(2 ** len(XY)):\n count = 0\n is_contradiction = True\n for j in range(len(XY)):\n # \u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3057\u305f\u3068\u304d\u3060\u3051\u63a1\u7528\n if not ((i >> j) & 1):\n continue\n for k in range(len(XY[j])):\n xiyj = XY[j][k][0] - 1\n HoU = XY[j][k][1]\n if not check(i, xiyj, HoU):\n is_contradiction = False\n break\n if not is_contradiction:\n break\n if is_contradiction:\n for j in range(len(XY)):\n if (i >> j) & 1:\n count += 1\n if count > max_honest:\n max_honest = count\nprint(max_honest)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nXY = []\nfor i in range(n):\n a = int(eval(input()))\n xy = []\n for j in range(a):\n xy.append(list(map(int, input().split())))\n XY.append(xy)\n\"\"\"\n \u77db\u76fe\u3057\u305f\u3089False\n \u77db\u76fe\u3057\u306a\u3051\u308c\u3070True\n \u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3057\u305f\u8005\u306e\u8a3c\u8a00\n \u6b63\u76f4&\u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b\n \u4e0d\u89aa\u5207&\u4e0d\u89aa\u5207\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b\n\"\"\"\n\n\ndef check(i, xiyj, HoU):\n # XOR\n if HoU ^ ((i >> xiyj) & 1):\n return False\n return True\n\n\nmax_honest = 0\nfor i in range(2 ** len(XY)):\n count = 0\n is_contradiction = True\n for j in range(len(XY)):\n # \u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3057\u305f\u3068\u304d\u3060\u3051\u63a1\u7528\n if not ((i >> j) & 1):\n continue\n count += 1\n for k in range(len(XY[j])):\n xiyj = XY[j][k][0] - 1\n HoU = XY[j][k][1]\n if not check(i, xiyj, HoU):\n is_contradiction = False\n break # TLE\u5bfe\u7b56\n if not is_contradiction:\n break # TLE\u5bfe\u7b56\n # \u77db\u76fe\u304c\u306a\u304f\u3001\u6b63\u76f4\u8005\u306e\u6570\u304c\u66f4\u65b0\u3067\u304d\u308c\u3070\u66f4\u65b0\n if is_contradiction and (count > max_honest):\n max_honest = count\nprint(max_honest)\n","code_same":false,"relative_loc_diff_percent":10.2040816327,"diff":["+\"\"\"","+ \u77db\u76fe\u3057\u305f\u3089False","+ \u77db\u76fe\u3057\u306a\u3051\u308c\u3070True","+ \u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3057\u305f\u8005\u306e\u8a3c\u8a00","+ \u6b63\u76f4&\u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b","+ \u4e0d\u89aa\u5207&\u4e0d\u89aa\u5207\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b","+\"\"\"","- # \u77db\u76fe\u3057\u305f\u3089False \u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3057\u305f\u8a3c\u8a00\u3088\u308a \u6b63\u76f4&\u6b63\u76f4\u8005\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b \/ \u4e0d\u89aa\u5207&\u4e0d\u89aa\u5207\u3068\u4eee\u5b9a\u3055\u308c\u3066\u3044\u308b True","- if ((i >> xiyj) & 1) ^ HoU:","+ # XOR","+ if HoU ^ ((i >> xiyj) & 1):","+ count += 1","- break","+ break # TLE\u5bfe\u7b56","- break","- if is_contradiction:","- for j in range(len(XY)):","- if (i >> j) & 1:","- count += 1","- if count > max_honest:","- max_honest = count","+ break # TLE\u5bfe\u7b56","+ # \u77db\u76fe\u304c\u306a\u304f\u3001\u6b63\u76f4\u8005\u306e\u6570\u304c\u66f4\u65b0\u3067\u304d\u308c\u3070\u66f4\u65b0","+ if is_contradiction and (count > max_honest):","+ max_honest = count"],"diff_only_import_comment":false,"measured_runtime_v0":0.357986707,"measured_runtime_v1":0.2736512365,"runtime_lift":1.3081859651,"key":["s340353046","s559860999"]} +{"user_id":"u754022296","problem_id":"p03796","language":"python","submission_id_v0":"s893557911","submission_id_v1":"s686331748","cpu_time_v0":230,"cpu_time_v1":48,"memory_v0":3984,"memory_v1":9008,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.13,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import factorial as fc\n\na = int(eval(input()))\n\nprint((fc(a)%(10**9+7)))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nm = 10**9+7\n\nans = 1\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= m\n\nprint(ans)","code_v0_loc":3,"code_v1_loc":7,"code_v0_num_chars":74,"code_v1_num_chars":99,"code_v0_no_empty_lines":"from math import factorial as fc\n\na = int(eval(input()))\nprint((fc(a) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nm = 10**9 + 7\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= m\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-from math import factorial as fc","-","-a = int(eval(input()))","-print((fc(a) % (10**9 + 7)))","+n = int(eval(input()))","+m = 10**9 + 7","+ans = 1","+for i in range(1, n + 1):","+ ans *= i","+ ans %= m","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4826196883,"measured_runtime_v1":0.2178869207,"runtime_lift":2.2150007294,"key":["s893557911","s686331748"]} +{"user_id":"u957843607","problem_id":"p02574","language":"python","submission_id_v0":"s835620267","submission_id_v1":"s021486096","cpu_time_v0":703,"cpu_time_v1":584,"memory_v0":134500,"memory_v1":134400,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.93,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import gcd\n\n\n\nN = int(eval(input()))\n\nnum_lis = list(map(int, input().split()))\n\nc = True\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(10**6+10)\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num \/\/= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n c = False\n\n break\n\n else:\n\n tmp.add(j)\n\n else:\n\n continue\n\n break\n\n\n\nif c:\n\n print(\"pairwise coprime\")\n\nelse:\n\n print(\"setwise coprime\")\n\n# optimized version of the same code:\n","target":"from math import gcd\n\n\n\nN = int(eval(input()))\n\nnum_lis = list(map(int, input().split()))\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(max(num_lis))\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num \/\/= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n print(\"setwise coprime\")\n\n exit()\n\n else:\n\n tmp.add(j)\n\nprint(\"pairwise coprime\")","code_v0_loc":47,"code_v1_loc":39,"code_v0_num_chars":793,"code_v1_num_chars":725,"code_v0_no_empty_lines":"from math import gcd\n\nN = int(eval(input()))\nnum_lis = list(map(int, input().split()))\nc = True\n\n\ndef osa_k(max_num):\n lis = [i for i in range(max_num + 1)]\n p = 2\n while p**2 <= max_num:\n if lis[p] == p:\n for q in range(2 * p, max_num + 1, p):\n if lis[q] == q:\n lis[q] = p\n p += 1\n return lis\n\n\nhoge = 0\nfor i in num_lis:\n hoge = gcd(hoge, i)\nif hoge > 1:\n print(\"not coprime\")\n exit()\nd_lis = osa_k(10**6 + 10)\ntmp = set()\nfor i in num_lis:\n num = i\n new_tmp = set()\n while num > 1:\n d = d_lis[num]\n new_tmp.add(d)\n num \/\/= d\n for j in new_tmp:\n if j in tmp:\n c = False\n break\n else:\n tmp.add(j)\n else:\n continue\n break\nif c:\n print(\"pairwise coprime\")\nelse:\n print(\"setwise coprime\")\n","code_v1_no_empty_lines":"from math import gcd\n\nN = int(eval(input()))\nnum_lis = list(map(int, input().split()))\n\n\ndef osa_k(max_num):\n lis = [i for i in range(max_num + 1)]\n p = 2\n while p**2 <= max_num:\n if lis[p] == p:\n for q in range(2 * p, max_num + 1, p):\n if lis[q] == q:\n lis[q] = p\n p += 1\n return lis\n\n\nhoge = 0\nfor i in num_lis:\n hoge = gcd(hoge, i)\nif hoge > 1:\n print(\"not coprime\")\n exit()\nd_lis = osa_k(max(num_lis))\ntmp = set()\nfor i in num_lis:\n num = i\n new_tmp = set()\n while num > 1:\n d = d_lis[num]\n new_tmp.add(d)\n num \/\/= d\n for j in new_tmp:\n if j in tmp:\n print(\"setwise coprime\")\n exit()\n else:\n tmp.add(j)\nprint(\"pairwise coprime\")\n","code_same":false,"relative_loc_diff_percent":17.0212765957,"diff":["-c = True","-d_lis = osa_k(10**6 + 10)","+d_lis = osa_k(max(num_lis))","- c = False","- break","+ print(\"setwise coprime\")","+ exit()","- else:","- continue","- break","-if c:","- print(\"pairwise coprime\")","-else:","- print(\"setwise coprime\")","+print(\"pairwise coprime\")"],"diff_only_import_comment":false,"measured_runtime_v0":2.272307416,"measured_runtime_v1":0.2046107306,"runtime_lift":11.1055144012,"key":["s835620267","s021486096"]} +{"user_id":"u380524497","problem_id":"p02850","language":"python","submission_id_v0":"s943818401","submission_id_v1":"s978957689","cpu_time_v0":583,"cpu_time_v1":446,"memory_v0":25092,"memory_v1":25184,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(eval(input()))\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n","code_v0_loc":27,"code_v1_loc":30,"code_v0_num_chars":455,"code_v1_num_chars":497,"code_v0_no_empty_lines":"n = int(eval(input()))\nedges = []\nfor id in range(n - 1):\n a, b = list(map(int, input().split()))\n edges.append([a - 1, b - 1, id])\nedges.sort()\nused = [0] * (n)\nans = [0] * (n - 1)\nnum = 1\nprev = 0\nfor edge in edges:\n _from, to, id = edge\n if _from != prev:\n num = 1\n if used[_from] == num:\n num += 1\n ans[id] = num\n used[to] = num\n num += 1\n prev = _from\nprint((max(ans)))\nfor color in ans:\n print(color)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn = int(eval(input()))\nedges = []\nfor id in range(n - 1):\n a, b = list(map(int, input().split()))\n edges.append([a - 1, b - 1, id])\nedges.sort()\nused = [0] * (n)\nans = [0] * (n - 1)\nnum = 1\nprev = 0\nfor edge in edges:\n _from, to, id = edge\n if _from != prev:\n num = 1\n if used[_from] == num:\n num += 1\n ans[id] = num\n used[to] = num\n num += 1\n prev = _from\nprint((max(ans)))\nfor color in ans:\n print(color)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.2558188839,"measured_runtime_v1":0.0060829046,"runtime_lift":42.0553832838,"key":["s943818401","s978957689"]} +{"user_id":"u234052535","problem_id":"p00003","language":"python","submission_id_v0":"s822995507","submission_id_v1":"s034189952","cpu_time_v0":50,"cpu_time_v1":30,"memory_v0":7724,"memory_v1":7764,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfor i in range(0, int(eval(input()))):\n\n sidelen = [int(j) for j in input().split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n# optimized version of the same code:\n","target":"import sys\n\nfor i in sys.stdin:\n\n try:\n\n sidelen = [int(j) for j in i.split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n except:\n\n continue","code_v0_loc":7,"code_v1_loc":11,"code_v0_num_chars":227,"code_v1_num_chars":285,"code_v0_no_empty_lines":"for i in range(0, int(eval(input()))):\n sidelen = [int(j) for j in input().split(\" \")]\n sidelen.sort(reverse=True)\n if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:\n print(\"YES\")\n else:\n print(\"NO\")\n","code_v1_no_empty_lines":"import sys\n\nfor i in sys.stdin:\n try:\n sidelen = [int(j) for j in i.split(\" \")]\n sidelen.sort(reverse=True)\n if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:\n print(\"YES\")\n else:\n print(\"NO\")\n except:\n continue\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-for i in range(0, int(eval(input()))):","- sidelen = [int(j) for j in input().split(\" \")]","- sidelen.sort(reverse=True)","- if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:","- print(\"YES\")","- else:","- print(\"NO\")","+import sys","+","+for i in sys.stdin:","+ try:","+ sidelen = [int(j) for j in i.split(\" \")]","+ sidelen.sort(reverse=True)","+ if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:","+ print(\"YES\")","+ else:","+ print(\"NO\")","+ except:","+ continue"],"diff_only_import_comment":false,"measured_runtime_v0":0.3279889946,"measured_runtime_v1":0.2582271154,"runtime_lift":1.2701570634,"key":["s822995507","s034189952"]} +{"user_id":"u247680229","problem_id":"p02760","language":"python","submission_id_v0":"s347634405","submission_id_v1":"s207417039","cpu_time_v0":151,"cpu_time_v1":18,"memory_v0":12472,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN_1=list(map(int, input().split()))\n\nN_2=list(map(int, input().split()))\n\nN_3=list(map(int, input().split()))\n\nN=int(eval(input()))\n\na=[int(eval(input())) for i in range(N)]\n\n\n\nn=np.array([N_1,N_2,N_3])\n\n\n\nfor a_n in a:\n\n if a_n in n:\n\n n[n==a_n]=0\n\n else:\n\n pass\n\ni=0\n\n \n\nif np.all(n[0:,0]==0)==True:\n\n i=+1\n\n \n\nelif np.all(n[0:,1]==0)==True:\n\n i+=1\n\n \n\nelif np.all(n[0:,2]==0)==True:\n\n i+=1\n\n \n\nelif np.all(n[0,0:]==0)==True:\n\n i+=1\n\n \n\nelif np.all(n[1,0:]==0)==True:\n\n i+=1\n\n\n\nelif np.all(n[2,0:]==0)==True:\n\n i+=1\n\n\n\nelif n[0,0]==0 and n[1,1]==0 and n[2,2] ==0:\n\n i+=1\n\n \n\nelif n[0,2]==0 and n[1,1]==0 and n[2,0] ==0:\n\n i+=1\n\n \n\nif i>0:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n# optimized version of the same code:\n","target":"a_1=list(map(int, input().split()))\n\na_2=list(map(int, input().split()))\n\na_3=list(map(int, input().split()))\n\n\n\nc=[a_1,a_2,a_3]\n\n\n\nN=int(eval(input()))\n\n\n\nb=[int(eval(input())) for _ in range(N)]\n\n\n\nfor i in range(3):\n\n for j in range(3):\n\n if c[i][j] in b:\n\n c[i][j]=0\n\n \n\n \n\ni=0\n\nif c[0][0]==0 and c[0][1]==0 and c[0][2]==0:\n\n i+=1\n\nif c[1][0]==0 and c[1][1]==0 and c[1][2]==0:\n\n i+=1\n\nif c[2][0]==0 and c[2][1]==0 and c[2][2]==0:\n\n i+=1\n\nif c[0][0]==0 and c[1][0]==0 and c[2][0]==0:\n\n i+=1\n\nif c[0][1]==0 and c[1][1]==0 and c[2][1]==0:\n\n i+=1\n\nif c[0][2]==0 and c[1][2]==0 and c[2][2]==0:\n\n i+=1\n\nif c[0][0]==0 and c[1][1]==0 and c[2][2]==0:\n\n i+=1\n\nif c[0][2]==0 and c[1][1]==0 and c[2][0]==0:\n\n i+=1\n\n \n\nif i>0:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":44,"code_v1_loc":38,"code_v0_num_chars":756,"code_v1_num_chars":815,"code_v0_no_empty_lines":"import numpy as np\n\nN_1 = list(map(int, input().split()))\nN_2 = list(map(int, input().split()))\nN_3 = list(map(int, input().split()))\nN = int(eval(input()))\na = [int(eval(input())) for i in range(N)]\nn = np.array([N_1, N_2, N_3])\nfor a_n in a:\n if a_n in n:\n n[n == a_n] = 0\n else:\n pass\ni = 0\nif np.all(n[0:, 0] == 0) == True:\n i = +1\nelif np.all(n[0:, 1] == 0) == True:\n i += 1\nelif np.all(n[0:, 2] == 0) == True:\n i += 1\nelif np.all(n[0, 0:] == 0) == True:\n i += 1\nelif np.all(n[1, 0:] == 0) == True:\n i += 1\nelif np.all(n[2, 0:] == 0) == True:\n i += 1\nelif n[0, 0] == 0 and n[1, 1] == 0 and n[2, 2] == 0:\n i += 1\nelif n[0, 2] == 0 and n[1, 1] == 0 and n[2, 0] == 0:\n i += 1\nif i > 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"a_1 = list(map(int, input().split()))\na_2 = list(map(int, input().split()))\na_3 = list(map(int, input().split()))\nc = [a_1, a_2, a_3]\nN = int(eval(input()))\nb = [int(eval(input())) for _ in range(N)]\nfor i in range(3):\n for j in range(3):\n if c[i][j] in b:\n c[i][j] = 0\ni = 0\nif c[0][0] == 0 and c[0][1] == 0 and c[0][2] == 0:\n i += 1\nif c[1][0] == 0 and c[1][1] == 0 and c[1][2] == 0:\n i += 1\nif c[2][0] == 0 and c[2][1] == 0 and c[2][2] == 0:\n i += 1\nif c[0][0] == 0 and c[1][0] == 0 and c[2][0] == 0:\n i += 1\nif c[0][1] == 0 and c[1][1] == 0 and c[2][1] == 0:\n i += 1\nif c[0][2] == 0 and c[1][2] == 0 and c[2][2] == 0:\n i += 1\nif c[0][0] == 0 and c[1][1] == 0 and c[2][2] == 0:\n i += 1\nif c[0][2] == 0 and c[1][1] == 0 and c[2][0] == 0:\n i += 1\nif i > 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":13.6363636364,"diff":["-import numpy as np","-","-N_1 = list(map(int, input().split()))","-N_2 = list(map(int, input().split()))","-N_3 = list(map(int, input().split()))","+a_1 = list(map(int, input().split()))","+a_2 = list(map(int, input().split()))","+a_3 = list(map(int, input().split()))","+c = [a_1, a_2, a_3]","-a = [int(eval(input())) for i in range(N)]","-n = np.array([N_1, N_2, N_3])","-for a_n in a:","- if a_n in n:","- n[n == a_n] = 0","- else:","- pass","+b = [int(eval(input())) for _ in range(N)]","+for i in range(3):","+ for j in range(3):","+ if c[i][j] in b:","+ c[i][j] = 0","-if np.all(n[0:, 0] == 0) == True:","- i = +1","-elif np.all(n[0:, 1] == 0) == True:","+if c[0][0] == 0 and c[0][1] == 0 and c[0][2] == 0:","-elif np.all(n[0:, 2] == 0) == True:","+if c[1][0] == 0 and c[1][1] == 0 and c[1][2] == 0:","-elif np.all(n[0, 0:] == 0) == True:","+if c[2][0] == 0 and c[2][1] == 0 and c[2][2] == 0:","-elif np.all(n[1, 0:] == 0) == True:","+if c[0][0] == 0 and c[1][0] == 0 and c[2][0] == 0:","-elif np.all(n[2, 0:] == 0) == True:","+if c[0][1] == 0 and c[1][1] == 0 and c[2][1] == 0:","-elif n[0, 0] == 0 and n[1, 1] == 0 and n[2, 2] == 0:","+if c[0][2] == 0 and c[1][2] == 0 and c[2][2] == 0:","-elif n[0, 2] == 0 and n[1, 1] == 0 and n[2, 0] == 0:","+if c[0][0] == 0 and c[1][1] == 0 and c[2][2] == 0:","+ i += 1","+if c[0][2] == 0 and c[1][1] == 0 and c[2][0] == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":1.9163406978,"measured_runtime_v1":0.2546290116,"runtime_lift":7.5260108242,"key":["s347634405","s207417039"]} +{"user_id":"u341543478","problem_id":"p03424","language":"python","submission_id_v0":"s841365629","submission_id_v1":"s932855105","cpu_time_v0":29,"cpu_time_v1":25,"memory_v0":9156,"memory_v1":8908,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\ns = input().split()\n\ns = set(s)\n\nprint(('Four' if len(s) == 4 else 'Three'))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\ns = input().split()\n\nprint(('Four' if len(set(s)) == 4 else 'Three'))","code_v0_loc":4,"code_v1_loc":3,"code_v0_num_chars":92,"code_v1_num_chars":85,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = input().split()\ns = set(s)\nprint((\"Four\" if len(s) == 4 else \"Three\"))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = input().split()\nprint((\"Four\" if len(set(s)) == 4 else \"Three\"))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-s = set(s)","-print((\"Four\" if len(s) == 4 else \"Three\"))","+print((\"Four\" if len(set(s)) == 4 else \"Three\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2928216946,"measured_runtime_v1":0.09356422,"runtime_lift":3.1296332587,"key":["s841365629","s932855105"]} +{"user_id":"u784022244","problem_id":"p02899","language":"python","submission_id_v0":"s740817012","submission_id_v1":"s743309565","cpu_time_v0":819,"cpu_time_v1":165,"memory_v0":23368,"memory_v1":13880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.85,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\n\n\nN=int(input())\n\n\n\nA=np.array([list(map(int, input().split()))])\n\n\n\n\n\nB=np.argsort(A[0,:])\n\nfor b in B:\n\n print(b+1, end=' ')\n\n\n# optimized version of the same code:\n","target":"N=int(input())\n\n\n\nA=list(map(int, input().split()))\n\nB=[-1]*N\n\nfor i in range(N):\n\n B[A[i]-1]=i+1\n\n \n\nfor b in B:\n\n print(b, end=\" \")\n","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":149,"code_v1_num_chars":136,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(input())\nA = np.array([list(map(int, input().split()))])\nB = np.argsort(A[0, :])\nfor b in B:\n print(b + 1, end=\" \")\n","code_v1_no_empty_lines":"N = int(input())\nA = list(map(int, input().split()))\nB = [-1] * N\nfor i in range(N):\n B[A[i] - 1] = i + 1\nfor b in B:\n print(b, end=\" \")\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-import numpy as np","-","-A = np.array([list(map(int, input().split()))])","-B = np.argsort(A[0, :])","+A = list(map(int, input().split()))","+B = [-1] * N","+for i in range(N):","+ B[A[i] - 1] = i + 1","- print(b + 1, end=\" \")","+ print(b, end=\" \")"],"diff_only_import_comment":false,"measured_runtime_v0":1.8078299961,"measured_runtime_v1":0.2674438229,"runtime_lift":6.7596625581,"key":["s740817012","s743309565"]} +{"user_id":"u633068244","problem_id":"p00122","language":"python","submission_id_v0":"s871701752","submission_id_v1":"s889694954","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4272,"memory_v1":4268,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return \"OK\"\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = eval(input())\n\n\txy = list(map(int,input().split()))\n\n\tans = solve(x,y,xy)\n\n\tprint(ans if ans else \"NA\")\n\n# optimized version of the same code:\n","target":"dX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return True\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = eval(input())\n\n\txy = list(map(int,input().split()))\n\n\tprint(\"OK\" if solve(x,y,xy) else \"NA\")","code_v0_loc":22,"code_v1_loc":21,"code_v0_num_chars":579,"code_v1_num_chars":568,"code_v0_no_empty_lines":"dX = [2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1]\ndY = [-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2]\n\n\ndef solve(x, y, XY):\n xy = XY[:]\n if len(xy) == 0:\n return \"OK\"\n sx, sy = xy.pop(0), xy.pop(0)\n for dx, dy in zip(dX, dY):\n if doa(x + dx, y + dy, sx, sy):\n r = solve(x + dx, y + dy, xy)\n if r:\n return r\n\n\ndef doa(x, y, sx, sy):\n if not (0 <= x <= 9 and 0 <= y <= 9):\n return False\n return True if abs(x - sx) < 2 and abs(y - sy) < 2 else False\n\n\nwhile 1:\n x, y = list(map(int, input().split()))\n if x == y == 0:\n break\n n = eval(input())\n xy = list(map(int, input().split()))\n ans = solve(x, y, xy)\n print(ans if ans else \"NA\")\n","code_v1_no_empty_lines":"dX = [2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1]\ndY = [-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2]\n\n\ndef solve(x, y, XY):\n xy = XY[:]\n if len(xy) == 0:\n return True\n sx, sy = xy.pop(0), xy.pop(0)\n for dx, dy in zip(dX, dY):\n if doa(x + dx, y + dy, sx, sy):\n r = solve(x + dx, y + dy, xy)\n if r:\n return r\n\n\ndef doa(x, y, sx, sy):\n if not (0 <= x <= 9 and 0 <= y <= 9):\n return False\n return True if abs(x - sx) < 2 and abs(y - sy) < 2 else False\n\n\nwhile 1:\n x, y = list(map(int, input().split()))\n if x == y == 0:\n break\n n = eval(input())\n xy = list(map(int, input().split()))\n print(\"OK\" if solve(x, y, xy) else \"NA\")\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["- return \"OK\"","+ return True","- ans = solve(x, y, xy)","- print(ans if ans else \"NA\")","+ print(\"OK\" if solve(x, y, xy) else \"NA\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.2335389843,"measured_runtime_v1":0.183096947,"runtime_lift":1.2754936015,"key":["s871701752","s889694954"]} +{"user_id":"u827202523","problem_id":"p03988","language":"python","submission_id_v0":"s661300903","submission_id_v1":"s790648502","cpu_time_v0":180,"cpu_time_v1":75,"memory_v0":38384,"memory_v1":69368,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(1000000)\n\nfrom collections import deque\n\ndef getN():\n\n return int(eval(input()))\n\ndef getList():\n\n return list(map(int, input().split()))\n\nimport math\n\n\n\nn = getN()\n\nnums = getList()\n\n\n\n# nums.sort(reverse=True)\n\nmx = max(nums)\n\nmn = (mx+1) \/\/ 2\n\nmndx = (mx % 2) + 1\n\n\n\nfrom collections import Counter\n\n\n\ncnt = Counter(nums)\n\n\n\nfor i in range(mn+1, mx+1):\n\n if cnt[i] < 2:\n\n print(\"Impossible\")\n\n sys.exit()\n\n\n\nif cnt[mn] != mndx:\n\n print(\"Impossible\")\n\nelse:\n\n print(\"Possible\")\n\n# optimized version of the same code:\n","target":"import sys\n\nimport math\n\nimport copy\n\nfrom heapq import heappush, heappop, heapify\n\nfrom functools import cmp_to_key\n\nfrom bisect import bisect_left, bisect_right\n\nfrom collections import defaultdict, deque, Counter\n\n# sys.setrecursionlimit(1000000)\n\n\n\n# input aliases\n\ninput = sys.stdin.readline\n\ngetS = lambda: input().strip()\n\ngetN = lambda: int(eval(input()))\n\ngetList = lambda: list(map(int, input().split()))\n\ngetZList = lambda: [int(x) - 1 for x in input().split()]\n\n\n\nINF = float(\"inf\")\n\nMOD = 10**9 + 7\n\ndivide = lambda x: pow(x, MOD-2, MOD)\n\n\n\ndef pim():\n\n print(\"Impossible\")\n\n sys.exit()\n\ndef pp():\n\n print(\"Possible\")\n\n sys.exit()\n\ndef solve():\n\n n = getN()\n\n nums = getList()\n\n cnt = Counter(nums)\n\n mx = max(nums)\n\n mn = min(nums)\n\n\n\n if cnt[mx] < 2:\n\n pim()\n\n if mn < (mx + 1) \/\/ 2:\n\n pim()\n\n\n\n if mx % 2 == 0:\n\n if cnt[mx\/\/2] != 1:\n\n pim()\n\n else:\n\n if cnt[(mx+1) \/\/ 2] != 2:\n\n pim()\n\n\n\n for i in range((mx + 1) \/\/ 2 + 1, mx+1):\n\n if cnt[i] < 2:\n\n pim()\n\n\n\n pp()\n\n\n\n\n\ndef main():\n\n n = getN()\n\n for _ in range(n):\n\n solve()\n\n\n\n return\n\nif __name__ == \"__main__\":\n\n # main()\n\n solve()\n\n\n\n\n\n\n\n\n\n\n","code_v0_loc":31,"code_v1_loc":66,"code_v0_num_chars":564,"code_v1_num_chars":1240,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(1000000)\nfrom collections import deque\n\n\ndef getN():\n return int(eval(input()))\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\nimport math\n\nn = getN()\nnums = getList()\n# nums.sort(reverse=True)\nmx = max(nums)\nmn = (mx + 1) \/\/ 2\nmndx = (mx % 2) + 1\nfrom collections import Counter\n\ncnt = Counter(nums)\nfor i in range(mn + 1, mx + 1):\n if cnt[i] < 2:\n print(\"Impossible\")\n sys.exit()\nif cnt[mn] != mndx:\n print(\"Impossible\")\nelse:\n print(\"Possible\")\n","code_v1_no_empty_lines":"import sys\nimport math\nimport copy\nfrom heapq import heappush, heappop, heapify\nfrom functools import cmp_to_key\nfrom bisect import bisect_left, bisect_right\nfrom collections import defaultdict, deque, Counter\n\n# sys.setrecursionlimit(1000000)\n# input aliases\ninput = sys.stdin.readline\ngetS = lambda: input().strip()\ngetN = lambda: int(eval(input()))\ngetList = lambda: list(map(int, input().split()))\ngetZList = lambda: [int(x) - 1 for x in input().split()]\nINF = float(\"inf\")\nMOD = 10**9 + 7\ndivide = lambda x: pow(x, MOD - 2, MOD)\n\n\ndef pim():\n print(\"Impossible\")\n sys.exit()\n\n\ndef pp():\n print(\"Possible\")\n sys.exit()\n\n\ndef solve():\n n = getN()\n nums = getList()\n cnt = Counter(nums)\n mx = max(nums)\n mn = min(nums)\n if cnt[mx] < 2:\n pim()\n if mn < (mx + 1) \/\/ 2:\n pim()\n if mx % 2 == 0:\n if cnt[mx \/\/ 2] != 1:\n pim()\n else:\n if cnt[(mx + 1) \/\/ 2] != 2:\n pim()\n for i in range((mx + 1) \/\/ 2 + 1, mx + 1):\n if cnt[i] < 2:\n pim()\n pp()\n\n\ndef main():\n n = getN()\n for _ in range(n):\n solve()\n return\n\n\nif __name__ == \"__main__\":\n # main()\n solve()\n","code_same":false,"relative_loc_diff_percent":53.0303030303,"diff":["+import math","+import copy","+from heapq import heappush, heappop, heapify","+from functools import cmp_to_key","+from bisect import bisect_left, bisect_right","+from collections import defaultdict, deque, Counter","+# sys.setrecursionlimit(1000000)","+# input aliases","-sys.setrecursionlimit(1000000)","-from collections import deque","+getS = lambda: input().strip()","+getN = lambda: int(eval(input()))","+getList = lambda: list(map(int, input().split()))","+getZList = lambda: [int(x) - 1 for x in input().split()]","+INF = float(\"inf\")","+MOD = 10**9 + 7","+divide = lambda x: pow(x, MOD - 2, MOD)","-def getN():","- return int(eval(input()))","+def pim():","+ print(\"Impossible\")","+ sys.exit()","-def getList():","- return list(map(int, input().split()))","+def pp():","+ print(\"Possible\")","+ sys.exit()","-import math","+def solve():","+ n = getN()","+ nums = getList()","+ cnt = Counter(nums)","+ mx = max(nums)","+ mn = min(nums)","+ if cnt[mx] < 2:","+ pim()","+ if mn < (mx + 1) \/\/ 2:","+ pim()","+ if mx % 2 == 0:","+ if cnt[mx \/\/ 2] != 1:","+ pim()","+ else:","+ if cnt[(mx + 1) \/\/ 2] != 2:","+ pim()","+ for i in range((mx + 1) \/\/ 2 + 1, mx + 1):","+ if cnt[i] < 2:","+ pim()","+ pp()","-n = getN()","-nums = getList()","-# nums.sort(reverse=True)","-mx = max(nums)","-mn = (mx + 1) \/\/ 2","-mndx = (mx % 2) + 1","-from collections import Counter","-cnt = Counter(nums)","-for i in range(mn + 1, mx + 1):","- if cnt[i] < 2:","- print(\"Impossible\")","- sys.exit()","-if cnt[mn] != mndx:","- print(\"Impossible\")","-else:","- print(\"Possible\")","+def main():","+ n = getN()","+ for _ in range(n):","+ solve()","+ return","+","+","+if __name__ == \"__main__\":","+ # main()","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.200920903,"measured_runtime_v1":0.0064778831,"runtime_lift":31.0164448269,"key":["s661300903","s790648502"]} +{"user_id":"u990900604","problem_id":"p02390","language":"python","submission_id_v0":"s359089221","submission_id_v1":"s084524983","cpu_time_v0":50,"cpu_time_v1":10,"memory_v0":9852,"memory_v1":4632,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\nif __name__ == '__main__':\n\n import doctest\n\n doctest.testmod()\n\n S = int(sys.stdin.read())\n\n h = S \/ 3600\n\n m = (S % 3600) \/ 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python\n\n#-*- coding: utf-8 -*-\n\n\n\n# http:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=ITP1_1_D\n\n\n\nif __name__ == '__main__':\n\n S = int(input())\n\n h = S \/ 3600\n\n m = (S % 3600) \/ 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n","code_v0_loc":10,"code_v1_loc":11,"code_v0_num_chars":208,"code_v1_num_chars":266,"code_v0_no_empty_lines":"import sys\n\nif __name__ == \"__main__\":\n import doctest\n\n doctest.testmod()\n S = int(sys.stdin.read())\n h = S \/ 3600\n m = (S % 3600) \/ 60\n s = S % 60\n print(\"%d:%d:%d\" % (h, m, s))\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python\n# -*- coding: utf-8 -*-\n# http:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=ITP1_1_D\nif __name__ == \"__main__\":\n S = int(input())\n h = S \/ 3600\n m = (S % 3600) \/ 60\n s = S % 60\n print(\"%d:%d:%d\" % (h, m, s))\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-import sys","-","+#!\/usr\/bin\/env python","+# -*- coding: utf-8 -*-","+# http:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=ITP1_1_D","- import doctest","-","- doctest.testmod()","- S = int(sys.stdin.read())","+ S = int(input())"],"diff_only_import_comment":false,"measured_runtime_v0":0.7406475422,"measured_runtime_v1":0.2172099149,"runtime_lift":3.4098238217,"key":["s359089221","s084524983"]} +{"user_id":"u780698286","problem_id":"p02880","language":"python","submission_id_v0":"s530137772","submission_id_v1":"s289678775","cpu_time_v0":31,"cpu_time_v1":26,"memory_v0":9160,"memory_v1":9096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.13,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\ns = []\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n s.append(i*j)\n\nif n in s:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nn = int(eval(input()))\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n if i*j == n:\n\n print(\"Yes\")\n\n sys.exit()\n\nprint(\"No\")\n","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":143,"code_v1_num_chars":150,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = []\nfor i in range(1, 10):\n for j in range(1, 10):\n s.append(i * j)\nif n in s:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"import sys\n\nn = int(eval(input()))\nfor i in range(1, 10):\n for j in range(1, 10):\n if i * j == n:\n print(\"Yes\")\n sys.exit()\nprint(\"No\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+import sys","+","-s = []","- s.append(i * j)","-if n in s:","- print(\"Yes\")","-else:","- print(\"No\")","+ if i * j == n:","+ print(\"Yes\")","+ sys.exit()","+print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.2618995297,"measured_runtime_v1":0.0062340605,"runtime_lift":42.0110661723,"key":["s530137772","s289678775"]} +{"user_id":"u861109991","problem_id":"p02773","language":"python","submission_id_v0":"s393491495","submission_id_v1":"s671436001","cpu_time_v0":1842,"cpu_time_v1":304,"memory_v0":60120,"memory_v1":38476,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# ABC 155 C\n\nfrom collections import Counter\n\nimport numpy as np\n\nN = int(eval(input()))\n\nS = [str(eval(input())) for i in range(N)]\n\nS = np.array(S)\n\n\n\ncount = Counter(S)\n\nmax_num = max(count.values())\n\nmax_list = [i for i,j in list(count.items()) if j==max_num]\n\n\n\nmax_list.sort()\n\nprint(('\\n'.join(max_list)))\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom collections import Counter\n\nN = int(sys.stdin.readline())\n\nS = sys.stdin.read().split()\n\n\n\ncount = Counter(S)\n\nmax_num = max(count.values())\n\nmax_list = [i for i,j in list(count.items()) if j==max_num]\n\n \n\nmax_list.sort()\n\nprint(('\\n'.join(max_list)))","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":292,"code_v1_num_chars":260,"code_v0_no_empty_lines":"# ABC 155 C\nfrom collections import Counter\nimport numpy as np\n\nN = int(eval(input()))\nS = [str(eval(input())) for i in range(N)]\nS = np.array(S)\ncount = Counter(S)\nmax_num = max(count.values())\nmax_list = [i for i, j in list(count.items()) if j == max_num]\nmax_list.sort()\nprint((\"\\n\".join(max_list)))\n","code_v1_no_empty_lines":"import sys\nfrom collections import Counter\n\nN = int(sys.stdin.readline())\nS = sys.stdin.read().split()\ncount = Counter(S)\nmax_num = max(count.values())\nmax_list = [i for i, j in list(count.items()) if j == max_num]\nmax_list.sort()\nprint((\"\\n\".join(max_list)))\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-# ABC 155 C","+import sys","-import numpy as np","-N = int(eval(input()))","-S = [str(eval(input())) for i in range(N)]","-S = np.array(S)","+N = int(sys.stdin.readline())","+S = sys.stdin.read().split()"],"diff_only_import_comment":false,"measured_runtime_v0":1.8564253402,"measured_runtime_v1":0.2880120206,"runtime_lift":6.4456522902,"key":["s393491495","s671436001"]} +{"user_id":"u814986259","problem_id":"p03796","language":"python","submission_id_v0":"s294020052","submission_id_v1":"s579876547","cpu_time_v0":229,"cpu_time_v1":40,"memory_v0":3968,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nN=int(eval(input()))\n\nans=math.factorial(N)\n\nprint((ans%(10**9 +7)))\n\n# optimized version of the same code:\n","target":"mod=10**9+7\n\nN=int(eval(input()))\n\nans=1\n\nfor i in range(1,N+1):\n\n ans*=i\n\n ans%=mod\n\nprint(ans)","code_v0_loc":4,"code_v1_loc":7,"code_v0_num_chars":73,"code_v1_num_chars":92,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nans = math.factorial(N)\nprint((ans % (10**9 + 7)))\n","code_v1_no_empty_lines":"mod = 10**9 + 7\nN = int(eval(input()))\nans = 1\nfor i in range(1, N + 1):\n ans *= i\n ans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-import math","-","+mod = 10**9 + 7","-ans = math.factorial(N)","-print((ans % (10**9 + 7)))","+ans = 1","+for i in range(1, N + 1):","+ ans *= i","+ ans %= mod","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3063099709,"measured_runtime_v1":0.2071282012,"runtime_lift":1.4788424222,"key":["s294020052","s579876547"]} +{"user_id":"u328510800","problem_id":"p02899","language":"python","submission_id_v0":"s903355789","submission_id_v1":"s800578512","cpu_time_v0":617,"cpu_time_v1":144,"memory_v0":23416,"memory_v1":30160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.66,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn = int(eval(input()))\n\na = np.array(list(map(int, input().split())))\n\n\n\nprint((*list([x + 1 for x in np.argsort(a)])))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nm = [(x, 0) for x in range(1, n+1)]\n\n\n\nfor i, x in enumerate(map(int, input().split())):\n\n m[i] = (m[i][0], x)\n\nm.sort(key=lambda x : x[1])\n\nprint((' '.join([str(x[0]) for x in m])))","code_v0_loc":5,"code_v1_loc":7,"code_v0_num_chars":137,"code_v1_num_chars":199,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\na = np.array(list(map(int, input().split())))\nprint((*list([x + 1 for x in np.argsort(a)])))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nm = [(x, 0) for x in range(1, n + 1)]\nfor i, x in enumerate(map(int, input().split())):\n m[i] = (m[i][0], x)\nm.sort(key=lambda x: x[1])\nprint((\" \".join([str(x[0]) for x in m])))\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-import numpy as np","-","-a = np.array(list(map(int, input().split())))","-print((*list([x + 1 for x in np.argsort(a)])))","+m = [(x, 0) for x in range(1, n + 1)]","+for i, x in enumerate(map(int, input().split())):","+ m[i] = (m[i][0], x)","+m.sort(key=lambda x: x[1])","+print((\" \".join([str(x[0]) for x in m])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3737991261,"measured_runtime_v1":0.1981218202,"runtime_lift":6.9341131869,"key":["s903355789","s800578512"]} +{"user_id":"u670180528","problem_id":"p03634","language":"python","submission_id_v0":"s592706363","submission_id_v1":"s081294326","cpu_time_v0":718,"cpu_time_v1":476,"memory_v0":63540,"memory_v1":64180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.7,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import deque\n\nn,*t=list(map(int,open(0).read().split()))\n\ncon=[[] for _ in range(n)]\n\ndist_f_k=[0]*n\n\n\n\nfor a,b,c in zip(t[:3*n-3:3],t[1::3],t[2::3]):\n\n\tcon[a-1].append((b-1,c))\n\n\tcon[b-1].append((a-1,c))\n\n\n\nk=t[3*n-2]\n\nque=deque([k-1])\n\nwhile que:\n\n\tcur=que.popleft()\n\n\tfor nxt,dd in con[cur]:\n\n\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\tque.append(nxt)\n\n\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\nfor x,y in zip(t[3*n-1::2],t[3*n::2]):\n\n\tprint((dist_f_k[x-1]+dist_f_k[y-1]))\n\n# optimized version of the same code:\n","target":"def solve():\n\n\tfrom collections import deque\n\n\tn,*t=list(map(int,open(0).read().split()))\n\n\tcon=[[] for _ in range(n)]\n\n\tdist_f_k=[0]*n\n\n\tl1,l2=t[:3*n-3],t[3*n-1:]\n\n\n\n\tfor a,b,c in zip(*[iter(l1)]*3):\n\n\t\tcon[a-1].append((b-1,c))\n\n\t\tcon[b-1].append((a-1,c))\n\n\n\n\tk=t[3*n-2]\n\n\tque=deque([k-1])\n\n\twhile que:\n\n\t\tcur=que.popleft()\n\n\t\tfor nxt,dd in con[cur]:\n\n\t\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\t\tque.append(nxt)\n\n\t\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\n\tfor x,y in zip(*[iter(l2)]*2):\n\n\t\tprint((dist_f_k[x-1]+dist_f_k[y-1]))\n\n\t\t\n\nif __name__==\"__main__\":\n\n\tsolve()","code_v0_loc":20,"code_v1_loc":25,"code_v0_num_chars":476,"code_v1_num_chars":553,"code_v0_no_empty_lines":"from collections import deque\n\nn, *t = list(map(int, open(0).read().split()))\ncon = [[] for _ in range(n)]\ndist_f_k = [0] * n\nfor a, b, c in zip(t[: 3 * n - 3 : 3], t[1::3], t[2::3]):\n con[a - 1].append((b - 1, c))\n con[b - 1].append((a - 1, c))\nk = t[3 * n - 2]\nque = deque([k - 1])\nwhile que:\n cur = que.popleft()\n for nxt, dd in con[cur]:\n if dist_f_k[nxt] == 0 and nxt != k - 1:\n que.append(nxt)\n dist_f_k[nxt] = dist_f_k[cur] + dd\nfor x, y in zip(t[3 * n - 1 :: 2], t[3 * n :: 2]):\n print((dist_f_k[x - 1] + dist_f_k[y - 1]))\n","code_v1_no_empty_lines":"def solve():\n from collections import deque\n\n n, *t = list(map(int, open(0).read().split()))\n con = [[] for _ in range(n)]\n dist_f_k = [0] * n\n l1, l2 = t[: 3 * n - 3], t[3 * n - 1 :]\n for a, b, c in zip(*[iter(l1)] * 3):\n con[a - 1].append((b - 1, c))\n con[b - 1].append((a - 1, c))\n k = t[3 * n - 2]\n que = deque([k - 1])\n while que:\n cur = que.popleft()\n for nxt, dd in con[cur]:\n if dist_f_k[nxt] == 0 and nxt != k - 1:\n que.append(nxt)\n dist_f_k[nxt] = dist_f_k[cur] + dd\n for x, y in zip(*[iter(l2)] * 2):\n print((dist_f_k[x - 1] + dist_f_k[y - 1]))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-from collections import deque","+def solve():","+ from collections import deque","-n, *t = list(map(int, open(0).read().split()))","-con = [[] for _ in range(n)]","-dist_f_k = [0] * n","-for a, b, c in zip(t[: 3 * n - 3 : 3], t[1::3], t[2::3]):","- con[a - 1].append((b - 1, c))","- con[b - 1].append((a - 1, c))","-k = t[3 * n - 2]","-que = deque([k - 1])","-while que:","- cur = que.popleft()","- for nxt, dd in con[cur]:","- if dist_f_k[nxt] == 0 and nxt != k - 1:","- que.append(nxt)","- dist_f_k[nxt] = dist_f_k[cur] + dd","-for x, y in zip(t[3 * n - 1 :: 2], t[3 * n :: 2]):","- print((dist_f_k[x - 1] + dist_f_k[y - 1]))","+ n, *t = list(map(int, open(0).read().split()))","+ con = [[] for _ in range(n)]","+ dist_f_k = [0] * n","+ l1, l2 = t[: 3 * n - 3], t[3 * n - 1 :]","+ for a, b, c in zip(*[iter(l1)] * 3):","+ con[a - 1].append((b - 1, c))","+ con[b - 1].append((a - 1, c))","+ k = t[3 * n - 2]","+ que = deque([k - 1])","+ while que:","+ cur = que.popleft()","+ for nxt, dd in con[cur]:","+ if dist_f_k[nxt] == 0 and nxt != k - 1:","+ que.append(nxt)","+ dist_f_k[nxt] = dist_f_k[cur] + dd","+ for x, y in zip(*[iter(l2)] * 2):","+ print((dist_f_k[x - 1] + dist_f_k[y - 1]))","+","+","+if __name__ == \"__main__\":","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.331901531,"measured_runtime_v1":0.2149364519,"runtime_lift":1.5441844695,"key":["s592706363","s081294326"]} +{"user_id":"u724687935","problem_id":"p02622","language":"python","submission_id_v0":"s346270661","submission_id_v1":"s299240564","cpu_time_v0":67,"cpu_time_v1":60,"memory_v0":9408,"memory_v1":9320,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.45,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = eval(input())\n\nT = eval(input())\n\nN = len(S)\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)\n\n\n# optimized version of the same code:\n","target":"S = eval(input())\n\nT = eval(input())\n\ncnt = 0\n\nfor i in range(len(S)):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":107,"code_v1_num_chars":99,"code_v0_no_empty_lines":"S = eval(input())\nT = eval(input())\nN = len(S)\ncnt = 0\nfor i in range(N):\n cnt += S[i] != T[i]\nprint(cnt)\n","code_v1_no_empty_lines":"S = eval(input())\nT = eval(input())\ncnt = 0\nfor i in range(len(S)):\n cnt += S[i] != T[i]\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-N = len(S)","-for i in range(N):","+for i in range(len(S)):"],"diff_only_import_comment":false,"measured_runtime_v0":0.3924936354,"measured_runtime_v1":0.2147260756,"runtime_lift":1.8278806345,"key":["s346270661","s299240564"]} +{"user_id":"u638456847","problem_id":"p03253","language":"python","submission_id_v0":"s213127805","submission_id_v1":"s828879500","cpu_time_v0":45,"cpu_time_v1":18,"memory_v0":7084,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\nMOD = 10**9+7\n\n\n\nfac = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\nf_inv = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\ndef prepare(n, mod):\n\n for i in range(2, n+1):\n\n fac.append((fac[-1] * i) % mod)\n\n\n\n\n\ndef cmb(n, r, mod):\n\n if n < 0 or r < 0:\n\n return 0\n\n if r > n:\n\n return 0\n\n\n\n return fac[n] * pow(fac[r],MOD-2,MOD) * pow(fac[n-r],MOD-2,MOD) % mod\n\n\n\n\n\ndef prime_factorization(n):\n\n d = []\n\n i, e = 2, 0 # factor, exponent\n\n while i * i <= n:\n\n while n % i == 0:\n\n n \/\/= i\n\n e += 1\n\n if e > 0:\n\n d.append((i, e))\n\n i += 1\n\n e = 0\n\n if n > 1:\n\n d.append((n, 1))\n\n return d\n\n\n\n\n\ndef main():\n\n N,M = list(map(int, readline().split()))\n\n\n\n prepare(N+100, MOD)\n\n d = prime_factorization(M)\n\n\n\n ans = 1\n\n for i, e in d:\n\n ans *= cmb(N-1+e, e, MOD)\n\n ans %= MOD\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"# AC: msec(Python3)\n\nfrom math import factorial\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\nMOD = 10**9+7\n\n\n\ndef cmb(n, r):\n\n if n < 0 or r < 0:\n\n return 0\n\n if r > n:\n\n return 0\n\n\n\n r = min(n-r, r)\n\n res = 1\n\n for i in range(r):\n\n res *= n - i\n\n\n\n return res \/\/ factorial(r)\n\n\n\n\n\ndef prime_factorization(n):\n\n d = []\n\n i, e = 2, 0 # factor, exponent\n\n while i * i <= n:\n\n while n % i == 0:\n\n n \/\/= i\n\n e += 1\n\n if e > 0:\n\n d.append((i, e))\n\n i += 1\n\n e = 0\n\n if n > 1:\n\n d.append((n, 1))\n\n return d\n\n\n\n\n\ndef main():\n\n N,M = list(map(int, readline().split()))\n\n\n\n d = prime_factorization(M)\n\n\n\n ans = 1\n\n for i, e in d:\n\n ans *= cmb(N-1+e, e)\n\n ans %= MOD\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":56,"code_v1_loc":54,"code_v0_num_chars":1049,"code_v1_num_chars":919,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nMOD = 10**9 + 7\nfac = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\nf_inv = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\ndef prepare(n, mod):\n for i in range(2, n + 1):\n fac.append((fac[-1] * i) % mod)\n\n\ndef cmb(n, r, mod):\n if n < 0 or r < 0:\n return 0\n if r > n:\n return 0\n return fac[n] * pow(fac[r], MOD - 2, MOD) * pow(fac[n - r], MOD - 2, MOD) % mod\n\n\ndef prime_factorization(n):\n d = []\n i, e = 2, 0 # factor, exponent\n while i * i <= n:\n while n % i == 0:\n n \/\/= i\n e += 1\n if e > 0:\n d.append((i, e))\n i += 1\n e = 0\n if n > 1:\n d.append((n, 1))\n return d\n\n\ndef main():\n N, M = list(map(int, readline().split()))\n prepare(N + 100, MOD)\n d = prime_factorization(M)\n ans = 1\n for i, e in d:\n ans *= cmb(N - 1 + e, e, MOD)\n ans %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# AC: msec(Python3)\nfrom math import factorial\nimport sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nMOD = 10**9 + 7\n\n\ndef cmb(n, r):\n if n < 0 or r < 0:\n return 0\n if r > n:\n return 0\n r = min(n - r, r)\n res = 1\n for i in range(r):\n res *= n - i\n return res \/\/ factorial(r)\n\n\ndef prime_factorization(n):\n d = []\n i, e = 2, 0 # factor, exponent\n while i * i <= n:\n while n % i == 0:\n n \/\/= i\n e += 1\n if e > 0:\n d.append((i, e))\n i += 1\n e = 0\n if n > 1:\n d.append((n, 1))\n return d\n\n\ndef main():\n N, M = list(map(int, readline().split()))\n d = prime_factorization(M)\n ans = 1\n for i, e in d:\n ans *= cmb(N - 1 + e, e)\n ans %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.5714285714,"diff":["+# AC: msec(Python3)","+from math import factorial","-fac = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb","-f_inv = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb","-inv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb","-def prepare(n, mod):","- for i in range(2, n + 1):","- fac.append((fac[-1] * i) % mod)","-","-","-def cmb(n, r, mod):","+def cmb(n, r):","- return fac[n] * pow(fac[r], MOD - 2, MOD) * pow(fac[n - r], MOD - 2, MOD) % mod","+ r = min(n - r, r)","+ res = 1","+ for i in range(r):","+ res *= n - i","+ return res \/\/ factorial(r)","- prepare(N + 100, MOD)","- ans *= cmb(N - 1 + e, e, MOD)","+ ans *= cmb(N - 1 + e, e)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3783175611,"measured_runtime_v1":0.2571354423,"runtime_lift":1.4712773852,"key":["s213127805","s828879500"]} +{"user_id":"u047178225","problem_id":"p02690","language":"python","submission_id_v0":"s842823347","submission_id_v1":"s836367972","cpu_time_v0":81,"cpu_time_v1":27,"memory_v0":9444,"memory_v1":9444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nX = int(eval(input()))\n\n#print(X)\n\nn = X\n\ndiv = []\n\nfor i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n div.append(i)\n\n if i != n \/\/ i:\n\n div.append(n\/\/i)\n\n#print(div)\n\n\n\nfor i in div:\n\n for a in range(0, 10001): \n\n b = a - i\n\n #print(a, b)\n\n if a**5 - b**5 == X:\n\n print((a, b))\n\n break\n\n else:\n\n continue\n\n break\n\n \n\n \n\n# optimized version of the same code:\n","target":"X = int(eval(input()))\n\n#print(X)\n\nn = X\n\ndiv = []\n\nfor i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n div.append(i)\n\n if i != n \/\/ i:\n\n div.append(n\/\/i)\n\n#print(div)\n\n\n\nfor i in div:\n\n for a in range(0, 1001): \n\n b = a - i\n\n #print(a, b)\n\n if a**5 - b**5 == X:\n\n print((a, b))\n\n break\n\n else:\n\n continue\n\n break","code_v0_loc":23,"code_v1_loc":21,"code_v0_num_chars":355,"code_v1_num_chars":343,"code_v0_no_empty_lines":"X = int(eval(input()))\n# print(X)\nn = X\ndiv = []\nfor i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n div.append(i)\n if i != n \/\/ i:\n div.append(n \/\/ i)\n# print(div)\nfor i in div:\n for a in range(0, 10001):\n b = a - i\n # print(a, b)\n if a**5 - b**5 == X:\n print((a, b))\n break\n else:\n continue\n break\n","code_v1_no_empty_lines":"X = int(eval(input()))\n# print(X)\nn = X\ndiv = []\nfor i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n div.append(i)\n if i != n \/\/ i:\n div.append(n \/\/ i)\n# print(div)\nfor i in div:\n for a in range(0, 1001):\n b = a - i\n # print(a, b)\n if a**5 - b**5 == X:\n print((a, b))\n break\n else:\n continue\n break\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["- for a in range(0, 10001):","+ for a in range(0, 1001):"],"diff_only_import_comment":false,"measured_runtime_v0":0.4829796672,"measured_runtime_v1":0.3715977311,"runtime_lift":1.2997379336,"key":["s842823347","s836367972"]} +{"user_id":"u604774382","problem_id":"p02264","language":"python","submission_id_v0":"s685908626","submission_id_v1":"s418135932","cpu_time_v0":1410,"cpu_time_v1":1260,"memory_v0":17580,"memory_v1":11516,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n\tps[i], t[i] = input( ).split( \" \" )\n\n\n\n\n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n\tpsi = ps.pop( 0 )\n\n\tti = int( t.pop( 0 ) )\n\n\tif ti <= q:\n\n\t\tqsum += ti\t\n\n\t\toutput.append( psi+\" \"+str( qsum ) )\n\n\telse:\n\n\t\tt.append( ti - q )\n\n\t\tps.append( psi )\n\n\t\tqsum += q\n\n\n\nprint(( \"\\n\".join( output ) ))\n\n# optimized version of the same code:\n","target":"n, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n ps[i], t[i] = input( ).split( \" \" )\n\n \n\n \n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n psi = ps.pop( 0 )\n\n ti = int( t.pop( 0 ) )\n\n if ti <= q:\n\n qsum += ti\n\n output.append( \"\".join( ( psi, \" \", str( qsum ) ) ) )\n\n else:\n\n t.append( ti - q )\n\n ps.append( psi )\n\n qsum += q\n\n \n\nprint(( \"\\n\".join( output ) ))","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":383,"code_v1_num_chars":455,"code_v0_no_empty_lines":"n, q = [int(val) for val in input().split(\" \")]\nps = [0] * n\nt = [0] * n\nfor i in range(n):\n ps[i], t[i] = input().split(\" \")\noutput = []\nqsum = 0\nwhile t:\n psi = ps.pop(0)\n ti = int(t.pop(0))\n if ti <= q:\n qsum += ti\n output.append(psi + \" \" + str(qsum))\n else:\n t.append(ti - q)\n ps.append(psi)\n qsum += q\nprint((\"\\n\".join(output)))\n","code_v1_no_empty_lines":"n, q = [int(val) for val in input().split(\" \")]\nps = [0] * n\nt = [0] * n\nfor i in range(n):\n ps[i], t[i] = input().split(\" \")\noutput = []\nqsum = 0\nwhile t:\n psi = ps.pop(0)\n ti = int(t.pop(0))\n if ti <= q:\n qsum += ti\n output.append(\"\".join((psi, \" \", str(qsum))))\n else:\n t.append(ti - q)\n ps.append(psi)\n qsum += q\nprint((\"\\n\".join(output)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- output.append(psi + \" \" + str(qsum))","+ output.append(\"\".join((psi, \" \", str(qsum))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2516228666,"measured_runtime_v1":0.0710392208,"runtime_lift":3.5420274002,"key":["s685908626","s418135932"]} +{"user_id":"u759412327","problem_id":"p03273","language":"python","submission_id_v0":"s715481285","submission_id_v1":"s158996242","cpu_time_v0":157,"cpu_time_v1":19,"memory_v0":12444,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.9,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nimport sys\n\n\n\nbuf = sys.stdin.buffer\n\nH,W = list(map(int,buf.readline().split()))\n\n\n\ngrid = np.frombuffer(buf.read(H*(W+1)), dtype='S1').reshape((H,W+1))\n\ngrid = grid[:,:-1]\n\n\n\nselect_col = (grid == b'#').any(axis = 0)\n\nselect_row = (grid == b'#').any(axis = 1)\n\n\n\ngrid = grid[select_row, :]\n\ngrid = grid[:, select_col]\n\ngrid = grid.astype(str)\n\n\n\nprint(('\\n'.join(''.join(row) for row in grid)))\n\n\n# optimized version of the same code:\n","target":"H,W = list(map(int,input().split()))\n\nA = [eval(input()) for _ in range(H)]\n\nA = list([a for a in A if any(x=='#' for x in a)]) \n\nA = list([a for a in zip(*A) if any(x=='#' for x in a)])\n\n\n\nfor a in zip(*A):\n\n print((''.join(a)))","code_v0_loc":17,"code_v1_loc":7,"code_v0_num_chars":409,"code_v1_num_chars":222,"code_v0_no_empty_lines":"import numpy as np\nimport sys\n\nbuf = sys.stdin.buffer\nH, W = list(map(int, buf.readline().split()))\ngrid = np.frombuffer(buf.read(H * (W + 1)), dtype=\"S1\").reshape((H, W + 1))\ngrid = grid[:, :-1]\nselect_col = (grid == b\"#\").any(axis=0)\nselect_row = (grid == b\"#\").any(axis=1)\ngrid = grid[select_row, :]\ngrid = grid[:, select_col]\ngrid = grid.astype(str)\nprint((\"\\n\".join(\"\".join(row) for row in grid)))\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nA = [eval(input()) for _ in range(H)]\nA = list([a for a in A if any(x == \"#\" for x in a)])\nA = list([a for a in zip(*A) if any(x == \"#\" for x in a)])\nfor a in zip(*A):\n print((\"\".join(a)))\n","code_same":false,"relative_loc_diff_percent":58.8235294118,"diff":["-import numpy as np","-import sys","-","-buf = sys.stdin.buffer","-H, W = list(map(int, buf.readline().split()))","-grid = np.frombuffer(buf.read(H * (W + 1)), dtype=\"S1\").reshape((H, W + 1))","-grid = grid[:, :-1]","-select_col = (grid == b\"#\").any(axis=0)","-select_row = (grid == b\"#\").any(axis=1)","-grid = grid[select_row, :]","-grid = grid[:, select_col]","-grid = grid.astype(str)","-print((\"\\n\".join(\"\".join(row) for row in grid)))","+H, W = list(map(int, input().split()))","+A = [eval(input()) for _ in range(H)]","+A = list([a for a in A if any(x == \"#\" for x in a)])","+A = list([a for a in zip(*A) if any(x == \"#\" for x in a)])","+for a in zip(*A):","+ print((\"\".join(a)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.2476984263,"measured_runtime_v1":0.1928220473,"runtime_lift":6.4707249179,"key":["s715481285","s158996242"]} +{"user_id":"u629538480","problem_id":"p02688","language":"python","submission_id_v0":"s093466568","submission_id_v1":"s996398988","cpu_time_v0":24,"cpu_time_v1":21,"memory_v0":9192,"memory_v1":8948,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(eval(input()))\n\n b=input().split(' ')\n\n for j in range(count):\n\n if int(b[j]) in a:\n\n a.remove(int(b[j]))\n\nprint((len(a)))\n\n# optimized version of the same code:\n","target":"N,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(eval(input()))\n\n b=[int(x.strip()) for x in input().split(' ')]\n\n for j in range(count):\n\n if b[j] in a:\n\n a.remove(b[j])\n\nprint((len(a)))","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":214,"code_v1_num_chars":230,"code_v0_no_empty_lines":"N, K = list(map(int, input().split(\" \")))\na = list(range(1, N + 1))\nfor i in range(K):\n count = int(eval(input()))\n b = input().split(\" \")\n for j in range(count):\n if int(b[j]) in a:\n a.remove(int(b[j]))\nprint((len(a)))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split(\" \")))\na = list(range(1, N + 1))\nfor i in range(K):\n count = int(eval(input()))\n b = [int(x.strip()) for x in input().split(\" \")]\n for j in range(count):\n if b[j] in a:\n a.remove(b[j])\nprint((len(a)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- b = input().split(\" \")","+ b = [int(x.strip()) for x in input().split(\" \")]","- if int(b[j]) in a:","- a.remove(int(b[j]))","+ if b[j] in a:","+ a.remove(b[j])"],"diff_only_import_comment":false,"measured_runtime_v0":0.2616522854,"measured_runtime_v1":0.1381282375,"runtime_lift":1.8942707889,"key":["s093466568","s996398988"]} +{"user_id":"u780342333","problem_id":"p02416","language":"python","submission_id_v0":"s248122741","submission_id_v1":"s360997133","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7732,"memory_v1":5624,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nres = []\n\nwhile True:\n\n s = eval(input())\n\n if s == '0':\n\n break\n\n\n\n res.append(sum([int(x) for x in s]))\n\n\n\nfor e in res:\n\n print(e)\n\n# optimized version of the same code:\n","target":"def sum_of_numbers(n):\n\n '''\n\n (* int -> int *)\n\n '''\n\n res = [int(n) for n in list(str(n))]\n\n \n\n return sum(res)\n\n\n\nif __name__ == \"__main__\":\n\n while True:\n\n n = eval(input())\n\n if n == '0':\n\n break\n\n print((sum_of_numbers(n)))\n","code_v0_loc":10,"code_v1_loc":14,"code_v0_num_chars":146,"code_v1_num_chars":275,"code_v0_no_empty_lines":"res = []\nwhile True:\n s = eval(input())\n if s == \"0\":\n break\n res.append(sum([int(x) for x in s]))\nfor e in res:\n print(e)\n","code_v1_no_empty_lines":"def sum_of_numbers(n):\n \"\"\"\n (* int -> int *)\n \"\"\"\n res = [int(n) for n in list(str(n))]\n return sum(res)\n\n\nif __name__ == \"__main__\":\n while True:\n n = eval(input())\n if n == \"0\":\n break\n print((sum_of_numbers(n)))\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-res = []","-while True:","- s = eval(input())","- if s == \"0\":","- break","- res.append(sum([int(x) for x in s]))","-for e in res:","- print(e)","+def sum_of_numbers(n):","+ \"\"\"","+ (* int -> int *)","+ \"\"\"","+ res = [int(n) for n in list(str(n))]","+ return sum(res)","+","+","+if __name__ == \"__main__\":","+ while True:","+ n = eval(input())","+ if n == \"0\":","+ break","+ print((sum_of_numbers(n)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2668570542,"measured_runtime_v1":0.0949980106,"runtime_lift":2.8090804473,"key":["s248122741","s360997133"]} +{"user_id":"u989345508","problem_id":"p03796","language":"python","submission_id_v0":"s438142944","submission_id_v1":"s382070647","cpu_time_v0":48,"cpu_time_v1":40,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\nx=1\n\nfor i in range(n):\n\n x*=(i+1)\n\n if x>10**9+7:\n\n x=x%(10**9+7)\n\n\n\nprint(x)\n\n#import numpy as np\n\n#n=int(input())\n\n#print(np.prod([i+1 for i in range(n)]))\n\n#print(np.prod([i+1 for i in range(n)])%((10**9)+7))\n\n\n\n#\u30aa\u30fc\u30d0\u30fc\u30d5\u30ed\u30fc\uff1f\n\n\n# optimized version of the same code:\n","target":"power=1\n\nn=int(eval(input()))\n\nmod=10**9+7\n\nfor i in range(1,n+1):\n\n power*=i\n\n power%=mod\n\n #print(power)\n\nprint(power)\n","code_v0_loc":14,"code_v1_loc":8,"code_v0_num_chars":255,"code_v1_num_chars":124,"code_v0_no_empty_lines":"n = int(eval(input()))\nx = 1\nfor i in range(n):\n x *= i + 1\n if x > 10**9 + 7:\n x = x % (10**9 + 7)\nprint(x)\n# import numpy as np\n# n=int(input())\n# print(np.prod([i+1 for i in range(n)]))\n# print(np.prod([i+1 for i in range(n)])%((10**9)+7))\n# \u30aa\u30fc\u30d0\u30fc\u30d5\u30ed\u30fc\uff1f\n","code_v1_no_empty_lines":"power = 1\nn = int(eval(input()))\nmod = 10**9 + 7\nfor i in range(1, n + 1):\n power *= i\n power %= mod\n # print(power)\nprint(power)\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["+power = 1","-x = 1","-for i in range(n):","- x *= i + 1","- if x > 10**9 + 7:","- x = x % (10**9 + 7)","-print(x)","-# import numpy as np","-# n=int(input())","-# print(np.prod([i+1 for i in range(n)]))","-# print(np.prod([i+1 for i in range(n)])%((10**9)+7))","-# \u30aa\u30fc\u30d0\u30fc\u30d5\u30ed\u30fc\uff1f","+mod = 10**9 + 7","+for i in range(1, n + 1):","+ power *= i","+ power %= mod","+ # print(power)","+print(power)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4326640232,"measured_runtime_v1":0.3277085986,"runtime_lift":1.3202705848,"key":["s438142944","s382070647"]} +{"user_id":"u729133443","problem_id":"p03086","language":"python","submission_id_v0":"s780520490","submission_id_v1":"s016683067","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport re;print((max(list(map(len,re.split('[^ACGT]',eval(input())))))))\n\n# optimized version of the same code:\n","target":"p=m=0\n\nfor c in eval(input()):p=-~p*(c in'ATGC');m=max(m,p)\n\nprint(m)","code_v0_loc":1,"code_v1_loc":3,"code_v0_num_chars":58,"code_v1_num_chars":63,"code_v0_no_empty_lines":"import re\n\nprint((max(list(map(len, re.split(\"[^ACGT]\", eval(input())))))))\n","code_v1_no_empty_lines":"p = m = 0\nfor c in eval(input()):\n p = -~p * (c in \"ATGC\")\n m = max(m, p)\nprint(m)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-import re","-","-print((max(list(map(len, re.split(\"[^ACGT]\", eval(input())))))))","+p = m = 0","+for c in eval(input()):","+ p = -~p * (c in \"ATGC\")","+ m = max(m, p)","+print(m)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2963340635,"measured_runtime_v1":0.1579363909,"runtime_lift":1.8762874209,"key":["s780520490","s016683067"]} +{"user_id":"u119982001","problem_id":"p02690","language":"python","submission_id_v0":"s761984261","submission_id_v1":"s930653030","cpu_time_v0":42,"cpu_time_v1":32,"memory_v0":9160,"memory_v1":9092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.81,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nX=int(eval(input()))\n\n\n\nfor i in range(200):\n\n for j in range(-200,200):\n\n if X == (i**5-j**5):\n\n print((i, j))\n\n exit()\n\n\n# optimized version of the same code:\n","target":"X=int(eval(input()))\n\n\n\nfor i in range(120):\n\n for j in range(-120,120):\n\n if X == (i**5-j**5):\n\n print((i, j))\n\n exit()\n","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":145,"code_v1_num_chars":145,"code_v0_no_empty_lines":"X = int(eval(input()))\nfor i in range(200):\n for j in range(-200, 200):\n if X == (i**5 - j**5):\n print((i, j))\n exit()\n","code_v1_no_empty_lines":"X = int(eval(input()))\nfor i in range(120):\n for j in range(-120, 120):\n if X == (i**5 - j**5):\n print((i, j))\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(200):","- for j in range(-200, 200):","+for i in range(120):","+ for j in range(-120, 120):"],"diff_only_import_comment":false,"measured_runtime_v0":0.2879281123,"measured_runtime_v1":0.1173316002,"runtime_lift":2.4539690233,"key":["s761984261","s930653030"]} +{"user_id":"u389910364","problem_id":"p03575","language":"python","submission_id_v0":"s425131512","submission_id_v1":"s549163277","cpu_time_v0":194,"cpu_time_v1":18,"memory_v0":14880,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.72,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport os\n\nimport sys\n\n\n\nimport numpy as np\n\nfrom scipy.sparse import csr_matrix\n\nfrom scipy.sparse.csgraph import connected_components\n\n\n\nif os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"_in.txt\", \"r\")\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = float(\"inf\")\n\nIINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\n\n\nN, M = list(map(int, sys.stdin.readline().split()))\n\nA, B = list(zip(*[list(map(int, sys.stdin.readline().split())) for _ in range(M)]))\n\nA = np.array(A) - 1\n\nB = np.array(B) - 1\n\n\n\n\n\ndef is_bridge(i):\n\n a = np.concatenate([A[:i], A[i + 1:]])\n\n b = np.concatenate([B[:i], B[i + 1:]])\n\n graph = csr_matrix(([True] * (M - 1), (a, b)), shape=(N, N))\n\n _, components = connected_components(graph, directed=False)\n\n return components.max() >= 1\n\n\n\n\n\nans = 0\n\nfor i in range(M):\n\n ans += is_bridge(i)\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"import os\n\n\n\nimport sys\n\n\n\nif os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"_in.txt\", \"r\")\n\n\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float(\"inf\")\n\nIINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\n# MOD = 998244353\n\n\n\n\n\ndef enumerate_bridges(graph):\n\n \"\"\"\n\n \u6a4b\u3092\u5217\u6319\u3059\u308b\n\n http:\/\/nupioca.hatenadiary.jp\/entry\/2013\/11\/03\/200006\n\n :param list of (list of int) graph:\n\n \"\"\"\n\n N = len(graph)\n\n ret_bridges = []\n\n pres = [-1] * N\n\n lows = [-1] * N\n\n order = -1\n\n for v in range(N):\n\n if pres[v] >= 0:\n\n continue\n\n edges = [(None, v, True)]\n\n while edges:\n\n v, u, forward = edges.pop()\n\n if forward:\n\n if pres[u] >= 0:\n\n # \u3082\u3046\u6765\u305f\u3053\u3068\u304c\u3042\u308b\n\n lows[v] = min(lows[v], lows[u])\n\n continue\n\n edges.append((v, u, False))\n\n parent, v = v, u\n\n order += 1\n\n pres[v] = lows[v] = order\n\n for u in graph[v]:\n\n if u == parent:\n\n continue\n\n edges.append((v, u, True))\n\n else:\n\n if v is None:\n\n continue\n\n if lows[u] == pres[u]:\n\n ret_bridges.append((v, u))\n\n lows[v] = min(lows[v], lows[u])\n\n return ret_bridges\n\n\n\n\n\nN, M = list(map(int, sys.stdin.buffer.readline().split()))\n\nAB = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]\n\ngraph = [[] for _ in range(N + 1)]\n\nfor a, b in AB:\n\n graph[a].append(b)\n\n graph[b].append(a)\n\nbridges = enumerate_bridges(graph)\n\nprint((len(bridges)))\n","code_v0_loc":33,"code_v1_loc":63,"code_v0_num_chars":815,"code_v1_num_chars":1657,"code_v0_no_empty_lines":"import os\nimport sys\nimport numpy as np\nfrom scipy.sparse import csr_matrix\nfrom scipy.sparse.csgraph import connected_components\n\nif os.getenv(\"LOCAL\"):\n sys.stdin = open(\"_in.txt\", \"r\")\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nIINF = 10**18\nMOD = 10**9 + 7\nN, M = list(map(int, sys.stdin.readline().split()))\nA, B = list(zip(*[list(map(int, sys.stdin.readline().split())) for _ in range(M)]))\nA = np.array(A) - 1\nB = np.array(B) - 1\n\n\ndef is_bridge(i):\n a = np.concatenate([A[:i], A[i + 1 :]])\n b = np.concatenate([B[:i], B[i + 1 :]])\n graph = csr_matrix(([True] * (M - 1), (a, b)), shape=(N, N))\n _, components = connected_components(graph, directed=False)\n return components.max() >= 1\n\n\nans = 0\nfor i in range(M):\n ans += is_bridge(i)\nprint(ans)\n","code_v1_no_empty_lines":"import os\nimport sys\n\nif os.getenv(\"LOCAL\"):\n sys.stdin = open(\"_in.txt\", \"r\")\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nIINF = 10**18\nMOD = 10**9 + 7\n# MOD = 998244353\ndef enumerate_bridges(graph):\n \"\"\"\n \u6a4b\u3092\u5217\u6319\u3059\u308b\n http:\/\/nupioca.hatenadiary.jp\/entry\/2013\/11\/03\/200006\n :param list of (list of int) graph:\n \"\"\"\n N = len(graph)\n ret_bridges = []\n pres = [-1] * N\n lows = [-1] * N\n order = -1\n for v in range(N):\n if pres[v] >= 0:\n continue\n edges = [(None, v, True)]\n while edges:\n v, u, forward = edges.pop()\n if forward:\n if pres[u] >= 0:\n # \u3082\u3046\u6765\u305f\u3053\u3068\u304c\u3042\u308b\n lows[v] = min(lows[v], lows[u])\n continue\n edges.append((v, u, False))\n parent, v = v, u\n order += 1\n pres[v] = lows[v] = order\n for u in graph[v]:\n if u == parent:\n continue\n edges.append((v, u, True))\n else:\n if v is None:\n continue\n if lows[u] == pres[u]:\n ret_bridges.append((v, u))\n lows[v] = min(lows[v], lows[u])\n return ret_bridges\n\n\nN, M = list(map(int, sys.stdin.buffer.readline().split()))\nAB = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]\ngraph = [[] for _ in range(N + 1)]\nfor a, b in AB:\n graph[a].append(b)\n graph[b].append(a)\nbridges = enumerate_bridges(graph)\nprint((len(bridges)))\n","code_same":false,"relative_loc_diff_percent":47.619047619,"diff":["-import numpy as np","-from scipy.sparse import csr_matrix","-from scipy.sparse.csgraph import connected_components","-sys.setrecursionlimit(2147483647)","+sys.setrecursionlimit(10**9)","-N, M = list(map(int, sys.stdin.readline().split()))","-A, B = list(zip(*[list(map(int, sys.stdin.readline().split())) for _ in range(M)]))","-A = np.array(A) - 1","-B = np.array(B) - 1","+# MOD = 998244353","+def enumerate_bridges(graph):","+ \"\"\"","+ \u6a4b\u3092\u5217\u6319\u3059\u308b","+ http:\/\/nupioca.hatenadiary.jp\/entry\/2013\/11\/03\/200006","+ :param list of (list of int) graph:","+ \"\"\"","+ N = len(graph)","+ ret_bridges = []","+ pres = [-1] * N","+ lows = [-1] * N","+ order = -1","+ for v in range(N):","+ if pres[v] >= 0:","+ continue","+ edges = [(None, v, True)]","+ while edges:","+ v, u, forward = edges.pop()","+ if forward:","+ if pres[u] >= 0:","+ # \u3082\u3046\u6765\u305f\u3053\u3068\u304c\u3042\u308b","+ lows[v] = min(lows[v], lows[u])","+ continue","+ edges.append((v, u, False))","+ parent, v = v, u","+ order += 1","+ pres[v] = lows[v] = order","+ for u in graph[v]:","+ if u == parent:","+ continue","+ edges.append((v, u, True))","+ else:","+ if v is None:","+ continue","+ if lows[u] == pres[u]:","+ ret_bridges.append((v, u))","+ lows[v] = min(lows[v], lows[u])","+ return ret_bridges","-def is_bridge(i):","- a = np.concatenate([A[:i], A[i + 1 :]])","- b = np.concatenate([B[:i], B[i + 1 :]])","- graph = csr_matrix(([True] * (M - 1), (a, b)), shape=(N, N))","- _, components = connected_components(graph, directed=False)","- return components.max() >= 1","-","-","-ans = 0","-for i in range(M):","- ans += is_bridge(i)","-print(ans)","+N, M = list(map(int, sys.stdin.buffer.readline().split()))","+AB = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]","+graph = [[] for _ in range(N + 1)]","+for a, b in AB:","+ graph[a].append(b)","+ graph[b].append(a)","+bridges = enumerate_bridges(graph)","+print((len(bridges)))"],"diff_only_import_comment":false,"measured_runtime_v0":2.0045171101,"measured_runtime_v1":0.2124494145,"runtime_lift":9.4352677545,"key":["s425131512","s549163277"]} +{"user_id":"u018679195","problem_id":"p03162","language":"python","submission_id_v0":"s697147605","submission_id_v1":"s734272026","cpu_time_v0":243,"cpu_time_v1":200,"memory_v0":90436,"memory_v1":74632,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.7,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\n\n\nfelicidade = []\n\n\n\nfor x in range(n):\n\n felicidade.append(list(map(int,input().split())))\n\n\n\nDP = [0,0,0]\n\n\n\nif n == 1:\n\n print((max(felicidade[0])))\n\n\n\nelse:\n\n\n\n for x in range(3):\n\n DP[x] = felicidade[0][x]\n\n\n\n\n\n for dia in range(1,n):\n\n m = [0] * 3\n\n for x in range(3):#As duas poss\u00edveis escolhas s\u00e3o x e y\n\n for y in range(3):\n\n if x != y: #Se elas forem diferentes\n\n m[x] = max(m[x], DP[y] + felicidade[dia][x])\n\n DP = m\n\n \n\n print((max(DP)))\n\n\n# optimized version of the same code:\n","target":"nDays = int(eval(input()))\n\n\n\ntoday = [int(x) for x in input().split()]\n\n\n\nfor i in range(nDays - 1):\n\n tomorrow = [int(x) for x in input().split()]\n\n tomorrow[0] += max(today[1], today[2])\n\n tomorrow[1] += max(today[0], today[2])\n\n tomorrow[2] += max(today[0], today[1])\n\n today = tomorrow\n\n\n\nprint((max(today)))","code_v0_loc":27,"code_v1_loc":12,"code_v0_num_chars":557,"code_v1_num_chars":320,"code_v0_no_empty_lines":"n = int(eval(input()))\nfelicidade = []\nfor x in range(n):\n felicidade.append(list(map(int, input().split())))\nDP = [0, 0, 0]\nif n == 1:\n print((max(felicidade[0])))\nelse:\n for x in range(3):\n DP[x] = felicidade[0][x]\n for dia in range(1, n):\n m = [0] * 3\n for x in range(3): # As duas poss\u00edveis escolhas s\u00e3o x e y\n for y in range(3):\n if x != y: # Se elas forem diferentes\n m[x] = max(m[x], DP[y] + felicidade[dia][x])\n DP = m\n print((max(DP)))\n","code_v1_no_empty_lines":"nDays = int(eval(input()))\ntoday = [int(x) for x in input().split()]\nfor i in range(nDays - 1):\n tomorrow = [int(x) for x in input().split()]\n tomorrow[0] += max(today[1], today[2])\n tomorrow[1] += max(today[0], today[2])\n tomorrow[2] += max(today[0], today[1])\n today = tomorrow\nprint((max(today)))\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-n = int(eval(input()))","-felicidade = []","-for x in range(n):","- felicidade.append(list(map(int, input().split())))","-DP = [0, 0, 0]","-if n == 1:","- print((max(felicidade[0])))","-else:","- for x in range(3):","- DP[x] = felicidade[0][x]","- for dia in range(1, n):","- m = [0] * 3","- for x in range(3): # As duas poss\u00edveis escolhas s\u00e3o x e y","- for y in range(3):","- if x != y: # Se elas forem diferentes","- m[x] = max(m[x], DP[y] + felicidade[dia][x])","- DP = m","- print((max(DP)))","+nDays = int(eval(input()))","+today = [int(x) for x in input().split()]","+for i in range(nDays - 1):","+ tomorrow = [int(x) for x in input().split()]","+ tomorrow[0] += max(today[1], today[2])","+ tomorrow[1] += max(today[0], today[2])","+ tomorrow[2] += max(today[0], today[1])","+ today = tomorrow","+print((max(today)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2760919194,"measured_runtime_v1":0.0735631361,"runtime_lift":3.7531287275,"key":["s697147605","s734272026"]} +{"user_id":"u654470292","problem_id":"p03828","language":"python","submission_id_v0":"s594973511","submission_id_v1":"s914422541","cpu_time_v0":386,"cpu_time_v1":305,"memory_v0":54360,"memory_v1":67304,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.98,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nn=int(eval(input()))\n\nwaru=10**9+7\n\n\n\nli=[]\n\nli2=[]\n\n\n\nfor i in range(2,n+1):\n\n tmp=math.factorial(n)\n\n flag=1\n\n for j in range(len(li)):\n\n if i%li[j]==0:\n\n flag=0\n\n break\n\n if flag==1:\n\n li.append(i)\n\n li2.append(0)\n\n while tmp%i==0:\n\n li2[len(li)-1]+=1\n\n tmp=tmp\/\/i\n\nans=1\n\n# print(li)\n\n# print(li2)\n\nfor i in range(len(li2)):\n\n ans*=li2[i]+1\n\nprint((ans%waru))\n\n# optimized version of the same code:\n","target":"import sys\n\nfrom collections import *\n\nimport heapq\n\nimport math\n\nimport bisect\n\nfrom itertools import permutations,accumulate,combinations,product\n\nfrom fractions import gcd\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\ndef ruiseki(lst):\n\n return [0]+list(accumulate(lst))\n\nmod=pow(10,9)+7\n\nal=[chr(ord('a') + i) for i in range(26)]\n\n\n\ndef factorization(n):\n\n arr = []\n\n temp = n\n\n for i in range(2, int(-(-n**0.5\/\/1))+1):\n\n if temp%i==0:\n\n cnt=0\n\n while temp%i==0:\n\n cnt+=1\n\n temp \/\/= i\n\n arr.append([i, cnt])\n\n if temp!=1:\n\n arr.append([temp, 1])\n\n if arr==[]:\n\n arr.append([n, 1])\n\n return arr\n\n\n\nn=int(eval(input()))\n\nif n==1:\n\n print((1))\n\n exit()\n\nd=defaultdict(int)\n\nfor i in range(2,n+1):\n\n tmp=factorization(i)\n\n for j in tmp:\n\n yaku,ko=j\n\n d[yaku]+=ko\n\n# print(d)\n\nans=1\n\nfor i in list(d.values()):\n\n ans*=i+1\n\n ans%=mod\n\nprint(ans)","code_v0_loc":26,"code_v1_loc":46,"code_v0_num_chars":455,"code_v1_num_chars":973,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nwaru = 10**9 + 7\nli = []\nli2 = []\nfor i in range(2, n + 1):\n tmp = math.factorial(n)\n flag = 1\n for j in range(len(li)):\n if i % li[j] == 0:\n flag = 0\n break\n if flag == 1:\n li.append(i)\n li2.append(0)\n while tmp % i == 0:\n li2[len(li) - 1] += 1\n tmp = tmp \/\/ i\nans = 1\n# print(li)\n# print(li2)\nfor i in range(len(li2)):\n ans *= li2[i] + 1\nprint((ans % waru))\n","code_v1_no_empty_lines":"import sys\nfrom collections import *\nimport heapq\nimport math\nimport bisect\nfrom itertools import permutations, accumulate, combinations, product\nfrom fractions import gcd\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\ndef ruiseki(lst):\n return [0] + list(accumulate(lst))\n\n\nmod = pow(10, 9) + 7\nal = [chr(ord(\"a\") + i) for i in range(26)]\n\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-(n**0.5) \/\/ 1)) + 1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp \/\/= i\n arr.append([i, cnt])\n if temp != 1:\n arr.append([temp, 1])\n if arr == []:\n arr.append([n, 1])\n return arr\n\n\nn = int(eval(input()))\nif n == 1:\n print((1))\n exit()\nd = defaultdict(int)\nfor i in range(2, n + 1):\n tmp = factorization(i)\n for j in tmp:\n yaku, ko = j\n d[yaku] += ko\n# print(d)\nans = 1\nfor i in list(d.values()):\n ans *= i + 1\n ans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":43.4782608696,"diff":["+import sys","+from collections import *","+import heapq","+import bisect","+from itertools import permutations, accumulate, combinations, product","+from fractions import gcd","+","+","+def input():","+ return sys.stdin.readline()[:-1]","+","+","+def ruiseki(lst):","+ return [0] + list(accumulate(lst))","+","+","+mod = pow(10, 9) + 7","+al = [chr(ord(\"a\") + i) for i in range(26)]","+","+","+def factorization(n):","+ arr = []","+ temp = n","+ for i in range(2, int(-(-(n**0.5) \/\/ 1)) + 1):","+ if temp % i == 0:","+ cnt = 0","+ while temp % i == 0:","+ cnt += 1","+ temp \/\/= i","+ arr.append([i, cnt])","+ if temp != 1:","+ arr.append([temp, 1])","+ if arr == []:","+ arr.append([n, 1])","+ return arr","+","-waru = 10**9 + 7","-li = []","-li2 = []","+if n == 1:","+ print((1))","+ exit()","+d = defaultdict(int)","- tmp = math.factorial(n)","- flag = 1","- for j in range(len(li)):","- if i % li[j] == 0:","- flag = 0","- break","- if flag == 1:","- li.append(i)","- li2.append(0)","- while tmp % i == 0:","- li2[len(li) - 1] += 1","- tmp = tmp \/\/ i","+ tmp = factorization(i)","+ for j in tmp:","+ yaku, ko = j","+ d[yaku] += ko","+# print(d)","-# print(li)","-# print(li2)","-for i in range(len(li2)):","- ans *= li2[i] + 1","-print((ans % waru))","+for i in list(d.values()):","+ ans *= i + 1","+ ans %= mod","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4593854201,"measured_runtime_v1":0.0895126674,"runtime_lift":5.1320716194,"key":["s594973511","s914422541"]} +{"user_id":"u832039789","problem_id":"p03013","language":"python","submission_id_v0":"s697210381","submission_id_v1":"s891872184","cpu_time_v0":235,"cpu_time_v1":207,"memory_v0":11656,"memory_v1":8592,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,m = list(map(int, input().split()))\n\na = [-1] + [int(eval(input())) for _ in range(m)] + [n + 1]\n\nMOD = 10 ** 9 + 7\n\n\n\nfib = [0, 1]\n\nfor i in range(100100):\n\n\tfib.append((fib[i] + fib[i + 1] % MOD))\n\n\n\nres = 1\n\nfor i in range(m + 1):\n\n\tp, q = a[i], a[i + 1]\n\n\tres = (res * fib[q - p - 1]) % MOD\n\n\n\nprint(res)\n\n# optimized version of the same code:\n","target":"n,m = list(map(int, input().split()))\n\na = [int(eval(input())) for _ in range(m)]\n\nMOD = 10 ** 9 + 7\n\n\n\n# broken[i] : i\u6bb5\u76ee\u304c\u58ca\u308c\u3066\u3044\u305f\u3089True\n\nbroken = [False] * 100100\n\nfor i in a:\n\n\tbroken[i] = True\n\n\n\n# dp[i] : i\u6bb5\u76ee\u306b\u884c\u304f\u901a\u308a\u6570\n\ndp = [0] * 100100\n\n\n\n# 0\u6bb5\u76ee\u306b\u884c\u304f\u65b9\u6cd5\u306f1\u901a\u308a\n\ndp[0] = 1\n\n\n\n# 1\u6bb5\u76ee\u304b\u3089n\u6bb5\u76ee\u306b\u3064\u3044\u3066\u8abf\u3079\u308b\n\nfor i in range(1, n + 1):\n\n\t# \u58ca\u308c\u3066\u308b\u306a\u3089\n\n\tif broken[i]:\n\n\t\t# \u305d\u306e\u6bb5\u306b\u306f\u9032\u3081\u306a\u3044\u306e\u30670\u901a\u308a\n\n\t\tdp[i] = 0\n\n\t# \u58ca\u308c\u3066\u306a\u3044\u306a\u3089\n\n\telse:\n\n\t\t# i - 1\u6bb5\u76ee\u304b\u3089\u79fb\u52d5\u53ef\u80fd (i - 1\u6bb5\u76ee\u306f, i == 0 \u306e\u3068\u304d\u306b\u306f\u306a\u3044\u306e\u3067\u5206\u5c90)\n\n\t\tif i > 0:\n\n\t\t\tdp[i] += dp[i - 1]\n\n\t\t# i - 2\u6bb5\u76ee\u304b\u3089\u79fb\u52d5\u53ef\u80fd (i - 2\u6bb5\u76ee\u306f, i == 0, 1 \u306e\u3068\u304d\u306b\u306f\u306a\u3044\u306e\u3067\u5206\u5c90)\n\n\t\tif i > 1:\n\n\t\t\tdp[i] += dp[i - 2]\n\n\tdp[i] %= MOD\n\n\n\nprint((dp[n]))","code_v0_loc":14,"code_v1_loc":32,"code_v0_num_chars":298,"code_v1_num_chars":584,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\na = [-1] + [int(eval(input())) for _ in range(m)] + [n + 1]\nMOD = 10**9 + 7\nfib = [0, 1]\nfor i in range(100100):\n fib.append((fib[i] + fib[i + 1] % MOD))\nres = 1\nfor i in range(m + 1):\n p, q = a[i], a[i + 1]\n res = (res * fib[q - p - 1]) % MOD\nprint(res)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\na = [int(eval(input())) for _ in range(m)]\nMOD = 10**9 + 7\n# broken[i] : i\u6bb5\u76ee\u304c\u58ca\u308c\u3066\u3044\u305f\u3089True\nbroken = [False] * 100100\nfor i in a:\n broken[i] = True\n# dp[i] : i\u6bb5\u76ee\u306b\u884c\u304f\u901a\u308a\u6570\ndp = [0] * 100100\n# 0\u6bb5\u76ee\u306b\u884c\u304f\u65b9\u6cd5\u306f1\u901a\u308a\ndp[0] = 1\n# 1\u6bb5\u76ee\u304b\u3089n\u6bb5\u76ee\u306b\u3064\u3044\u3066\u8abf\u3079\u308b\nfor i in range(1, n + 1):\n # \u58ca\u308c\u3066\u308b\u306a\u3089\n if broken[i]:\n # \u305d\u306e\u6bb5\u306b\u306f\u9032\u3081\u306a\u3044\u306e\u30670\u901a\u308a\n dp[i] = 0\n # \u58ca\u308c\u3066\u306a\u3044\u306a\u3089\n else:\n # i - 1\u6bb5\u76ee\u304b\u3089\u79fb\u52d5\u53ef\u80fd (i - 1\u6bb5\u76ee\u306f, i == 0 \u306e\u3068\u304d\u306b\u306f\u306a\u3044\u306e\u3067\u5206\u5c90)\n if i > 0:\n dp[i] += dp[i - 1]\n # i - 2\u6bb5\u76ee\u304b\u3089\u79fb\u52d5\u53ef\u80fd (i - 2\u6bb5\u76ee\u306f, i == 0, 1 \u306e\u3068\u304d\u306b\u306f\u306a\u3044\u306e\u3067\u5206\u5c90)\n if i > 1:\n dp[i] += dp[i - 2]\n dp[i] %= MOD\nprint((dp[n]))\n","code_same":false,"relative_loc_diff_percent":56.25,"diff":["-a = [-1] + [int(eval(input())) for _ in range(m)] + [n + 1]","+a = [int(eval(input())) for _ in range(m)]","-fib = [0, 1]","-for i in range(100100):","- fib.append((fib[i] + fib[i + 1] % MOD))","-res = 1","-for i in range(m + 1):","- p, q = a[i], a[i + 1]","- res = (res * fib[q - p - 1]) % MOD","-print(res)","+# broken[i] : i\u6bb5\u76ee\u304c\u58ca\u308c\u3066\u3044\u305f\u3089True","+broken = [False] * 100100","+for i in a:","+ broken[i] = True","+# dp[i] : i\u6bb5\u76ee\u306b\u884c\u304f\u901a\u308a\u6570","+dp = [0] * 100100","+# 0\u6bb5\u76ee\u306b\u884c\u304f\u65b9\u6cd5\u306f1\u901a\u308a","+dp[0] = 1","+# 1\u6bb5\u76ee\u304b\u3089n\u6bb5\u76ee\u306b\u3064\u3044\u3066\u8abf\u3079\u308b","+for i in range(1, n + 1):","+ # \u58ca\u308c\u3066\u308b\u306a\u3089","+ if broken[i]:","+ # \u305d\u306e\u6bb5\u306b\u306f\u9032\u3081\u306a\u3044\u306e\u30670\u901a\u308a","+ dp[i] = 0","+ # \u58ca\u308c\u3066\u306a\u3044\u306a\u3089","+ else:","+ # i - 1\u6bb5\u76ee\u304b\u3089\u79fb\u52d5\u53ef\u80fd (i - 1\u6bb5\u76ee\u306f, i == 0 \u306e\u3068\u304d\u306b\u306f\u306a\u3044\u306e\u3067\u5206\u5c90)","+ if i > 0:","+ dp[i] += dp[i - 1]","+ # i - 2\u6bb5\u76ee\u304b\u3089\u79fb\u52d5\u53ef\u80fd (i - 2\u6bb5\u76ee\u306f, i == 0, 1 \u306e\u3068\u304d\u306b\u306f\u306a\u3044\u306e\u3067\u5206\u5c90)","+ if i > 1:","+ dp[i] += dp[i - 2]","+ dp[i] %= MOD","+print((dp[n]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5020096426,"measured_runtime_v1":0.2284468935,"runtime_lift":2.197489469,"key":["s697210381","s891872184"]} +{"user_id":"u513081876","problem_id":"p03325","language":"python","submission_id_v0":"s352799823","submission_id_v1":"s651648403","cpu_time_v0":118,"cpu_time_v1":82,"memory_v0":4148,"memory_v1":4148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.51,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nans = 0\n\ncheck = [0]*30\n\nfor i in range(1, 31):\n\n check[i-1] = 2**i\n\n\n\nfor i in A:\n\n if i % 2 == 0:\n\n j = 0\n\n while check[j] <= i:\n\n if i % check[j] == 0:\n\n add = check[j]\n\n else:\n\n break\n\n \n\n j += 1\n\n ans += j\n\n \n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in a:\n\n while i % 2 == 0:\n\n i \/\/= 2\n\n ans += 1\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":9,"code_v0_num_chars":394,"code_v1_num_chars":149,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [int(i) for i in input().split()]\nans = 0\ncheck = [0] * 30\nfor i in range(1, 31):\n check[i - 1] = 2**i\nfor i in A:\n if i % 2 == 0:\n j = 0\n while check[j] <= i:\n if i % check[j] == 0:\n add = check[j]\n else:\n break\n j += 1\n ans += j\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\na = [int(i) for i in input().split()]\nans = 0\nfor i in a:\n while i % 2 == 0:\n i \/\/= 2\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":55.0,"diff":["-A = [int(i) for i in input().split()]","+a = [int(i) for i in input().split()]","-check = [0] * 30","-for i in range(1, 31):","- check[i - 1] = 2**i","-for i in A:","- if i % 2 == 0:","- j = 0","- while check[j] <= i:","- if i % check[j] == 0:","- add = check[j]","- else:","- break","- j += 1","- ans += j","+for i in a:","+ while i % 2 == 0:","+ i \/\/= 2","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3522037606,"measured_runtime_v1":0.279608284,"runtime_lift":1.2596327819,"key":["s352799823","s651648403"]} +{"user_id":"u861466636","problem_id":"p03074","language":"python","submission_id_v0":"s859028171","submission_id_v1":"s566775006","cpu_time_v0":328,"cpu_time_v1":144,"memory_v0":17700,"memory_v1":7440,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.1,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN, K = list(map(int, input().split()))\n\nS = eval(input())\n\n\n\nl = [[], []]\n\nans = []\n\nk = [int(s) for s in S]\n\nif k[0] == 0:\n\n l[1].append(0)\n\nv0 = 1 if k[0] == 0 else 0\n\nv1 = 1 if k[0] == 1 else 0\n\nfor i in range(1, N):\n\n if (k[i]==0) & (k[i-1]==0):\n\n v0 += 1\n\n elif (k[i]==1) & (k[i-1]==0):\n\n l[0].append(v0)\n\n v0 = 0\n\n v1 += 1\n\n elif (k[i]==0) & (k[i-1]==1):\n\n l[1].append(v1)\n\n v0 += 1\n\n v1 = 0 \n\n else:\n\n v1 += 1\n\n \n\nfor i, v in enumerate([v0, v1]):\n\n if v > 0:\n\n l[i].append(v)\n\n \n\nif k[0] == 0:\n\n l[1].append(0)\n\n\n\nif len(l[0]) <= K:\n\n print(N)\n\n\n\nelse:\n\n l[0].extend(np.repeat(0,K+1))\n\n l[1].extend(np.repeat(0,K+1))\n\n a = sum(l[0][:K]) + sum(l[1][:K+1])\n\n ans.append(a)\n\n for i in range(1, len(l[0])-K-1):\n\n a -= l[0][i-1] + l[1][i-1]\n\n a += l[0][i+K-1] + l[1][i+K]\n\n ans.append(a)\n\n print((max(ans)))\n\n# optimized version of the same code:\n","target":"N, K = list(map(int, input().split()))\n\nS = eval(input())\n\n \n\nl = [[], []]\n\nans = []\n\nk = [int(s) for s in S]\n\nif k[0] == 0:\n\n l[1].append(0)\n\nv0 = 1 if k[0] == 0 else 0\n\nv1 = 1 if k[0] == 1 else 0\n\nfor i in range(1, N):\n\n if (k[i]==0) & (k[i-1]==0):\n\n v0 += 1\n\n elif (k[i]==1) & (k[i-1]==0):\n\n l[0].append(v0)\n\n v0 = 0\n\n v1 += 1\n\n elif (k[i]==0) & (k[i-1]==1):\n\n l[1].append(v1)\n\n v0 += 1\n\n v1 = 0 \n\n else:\n\n v1 += 1\n\n \n\nfor i, v in enumerate([v0, v1]):\n\n if v > 0:\n\n l[i].append(v)\n\n \n\nif k[0] == 0:\n\n l[1].append(0)\n\n \n\nl[0] += [0]*(K+1)\n\nl[1] += [0]*(K+1)\n\na = sum(l[0][:K]) + sum(l[1][:K+1])\n\nans.append(a)\n\nfor i in range(1, len(l[0])-K-1):\n\n a -= l[0][i-1] + l[1][i-1]\n\n a += l[0][i+K-1] + l[1][i+K]\n\n ans.append(a)\n\nprint((max(ans)))","code_v0_loc":46,"code_v1_loc":40,"code_v0_num_chars":957,"code_v1_num_chars":837,"code_v0_no_empty_lines":"import numpy as np\n\nN, K = list(map(int, input().split()))\nS = eval(input())\nl = [[], []]\nans = []\nk = [int(s) for s in S]\nif k[0] == 0:\n l[1].append(0)\nv0 = 1 if k[0] == 0 else 0\nv1 = 1 if k[0] == 1 else 0\nfor i in range(1, N):\n if (k[i] == 0) & (k[i - 1] == 0):\n v0 += 1\n elif (k[i] == 1) & (k[i - 1] == 0):\n l[0].append(v0)\n v0 = 0\n v1 += 1\n elif (k[i] == 0) & (k[i - 1] == 1):\n l[1].append(v1)\n v0 += 1\n v1 = 0\n else:\n v1 += 1\nfor i, v in enumerate([v0, v1]):\n if v > 0:\n l[i].append(v)\nif k[0] == 0:\n l[1].append(0)\nif len(l[0]) <= K:\n print(N)\nelse:\n l[0].extend(np.repeat(0, K + 1))\n l[1].extend(np.repeat(0, K + 1))\n a = sum(l[0][:K]) + sum(l[1][: K + 1])\n ans.append(a)\n for i in range(1, len(l[0]) - K - 1):\n a -= l[0][i - 1] + l[1][i - 1]\n a += l[0][i + K - 1] + l[1][i + K]\n ans.append(a)\n print((max(ans)))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nS = eval(input())\nl = [[], []]\nans = []\nk = [int(s) for s in S]\nif k[0] == 0:\n l[1].append(0)\nv0 = 1 if k[0] == 0 else 0\nv1 = 1 if k[0] == 1 else 0\nfor i in range(1, N):\n if (k[i] == 0) & (k[i - 1] == 0):\n v0 += 1\n elif (k[i] == 1) & (k[i - 1] == 0):\n l[0].append(v0)\n v0 = 0\n v1 += 1\n elif (k[i] == 0) & (k[i - 1] == 1):\n l[1].append(v1)\n v0 += 1\n v1 = 0\n else:\n v1 += 1\nfor i, v in enumerate([v0, v1]):\n if v > 0:\n l[i].append(v)\nif k[0] == 0:\n l[1].append(0)\nl[0] += [0] * (K + 1)\nl[1] += [0] * (K + 1)\na = sum(l[0][:K]) + sum(l[1][: K + 1])\nans.append(a)\nfor i in range(1, len(l[0]) - K - 1):\n a -= l[0][i - 1] + l[1][i - 1]\n a += l[0][i + K - 1] + l[1][i + K]\n ans.append(a)\nprint((max(ans)))\n","code_same":false,"relative_loc_diff_percent":13.0434782609,"diff":["-import numpy as np","-","-if len(l[0]) <= K:","- print(N)","-else:","- l[0].extend(np.repeat(0, K + 1))","- l[1].extend(np.repeat(0, K + 1))","- a = sum(l[0][:K]) + sum(l[1][: K + 1])","+l[0] += [0] * (K + 1)","+l[1] += [0] * (K + 1)","+a = sum(l[0][:K]) + sum(l[1][: K + 1])","+ans.append(a)","+for i in range(1, len(l[0]) - K - 1):","+ a -= l[0][i - 1] + l[1][i - 1]","+ a += l[0][i + K - 1] + l[1][i + K]","- for i in range(1, len(l[0]) - K - 1):","- a -= l[0][i - 1] + l[1][i - 1]","- a += l[0][i + K - 1] + l[1][i + K]","- ans.append(a)","- print((max(ans)))","+print((max(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3263938189,"measured_runtime_v1":0.209388869,"runtime_lift":6.3345956489,"key":["s859028171","s566775006"]} +{"user_id":"u513081876","problem_id":"p03845","language":"python","submission_id_v0":"s710663686","submission_id_v1":"s021252857","cpu_time_v0":28,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.29,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nT = list(map(int, input().split()))\n\nM = int(eval(input()))\n\np = []\n\nx = []\n\nans = []\n\nfor i in range(M):\n\n p, x = list(map(int, input().split()))\n\n ans.append(sum(T[:p-1])+x+sum(T[p:]))\n\n\n\nfor _ in ans:\n\n print(_)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nT = list(map(int, input().split()))\n\nM = int(eval(input()))\n\nP, X, ans = [0]*M, [0]*M, []\n\nbase = sum(T)\n\n\n\nfor i in range(M):\n\n P, X = list(map(int, input().split()))\n\n ans.append(base-T[P-1]+X)\n\n\n\nfor i in ans:\n\n print(i)","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":229,"code_v1_num_chars":238,"code_v0_no_empty_lines":"N = int(eval(input()))\nT = list(map(int, input().split()))\nM = int(eval(input()))\np = []\nx = []\nans = []\nfor i in range(M):\n p, x = list(map(int, input().split()))\n ans.append(sum(T[: p - 1]) + x + sum(T[p:]))\nfor _ in ans:\n print(_)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nT = list(map(int, input().split()))\nM = int(eval(input()))\nP, X, ans = [0] * M, [0] * M, []\nbase = sum(T)\nfor i in range(M):\n P, X = list(map(int, input().split()))\n ans.append(base - T[P - 1] + X)\nfor i in ans:\n print(i)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-p = []","-x = []","-ans = []","+P, X, ans = [0] * M, [0] * M, []","+base = sum(T)","- p, x = list(map(int, input().split()))","- ans.append(sum(T[: p - 1]) + x + sum(T[p:]))","-for _ in ans:","- print(_)","+ P, X = list(map(int, input().split()))","+ ans.append(base - T[P - 1] + X)","+for i in ans:","+ print(i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2214040067,"measured_runtime_v1":0.1726463588,"runtime_lift":1.2824134157,"key":["s710663686","s021252857"]} +{"user_id":"u678505520","problem_id":"p03162","language":"python","submission_id_v0":"s129714630","submission_id_v1":"s550114997","cpu_time_v0":422,"cpu_time_v1":247,"memory_v0":108028,"memory_v1":87616,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.47,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\ndp=[[0 for i in range(3)] for i in range(n)]\n\nS=[[0 for i in range(3)] for i in range(n)]\n\ndp[0]=list(map(int,input().split()))\n\nS[0]=dp[0].copy()\n\nfor i in range(1,n):\n\n S[i]=list(map(int,input().split()))\n\n for j in range(3):\n\n dp[i][j]=max(dp[i-1][j-1],dp[i-1][j-2])+S[i][j]\n\n\n\nprint((max(dp[n-1][0],dp[n-1][1],dp[n-1][2])))\n\n#dp[i][j]=i\u756a\u76ee\u306bj\u3092\u9078\u3093\u3060\u6642\u306e\u6700\u5927\u5024(j\u306fa,b,c\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3002)\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\ndp=[[0 for i in range(3)] for i in range(n)]\n\ndp[0]=list(map(int,input().split()))\n\nfor i in range(1,n):\n\n S=list(map(int,input().split()))\n\n for j in range(3):\n\n dp[i][j]=max(dp[i-1][j-1],dp[i-1][j-2])+S[j]\n\n\n\nprint((max(dp[n-1][0],dp[n-1][1],dp[n-1][2])))\n\n#dp[i][j]=i\u756a\u76ee\u306bj\u3092\u9078\u3093\u3060\u6642\u306e\u6700\u5927\u5024(j\u306fa,b,c\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3002)","code_v0_loc":12,"code_v1_loc":10,"code_v0_num_chars":397,"code_v1_num_chars":327,"code_v0_no_empty_lines":"n = int(eval(input()))\ndp = [[0 for i in range(3)] for i in range(n)]\nS = [[0 for i in range(3)] for i in range(n)]\ndp[0] = list(map(int, input().split()))\nS[0] = dp[0].copy()\nfor i in range(1, n):\n S[i] = list(map(int, input().split()))\n for j in range(3):\n dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j - 2]) + S[i][j]\nprint((max(dp[n - 1][0], dp[n - 1][1], dp[n - 1][2])))\n# dp[i][j]=i\u756a\u76ee\u306bj\u3092\u9078\u3093\u3060\u6642\u306e\u6700\u5927\u5024(j\u306fa,b,c\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3002)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ndp = [[0 for i in range(3)] for i in range(n)]\ndp[0] = list(map(int, input().split()))\nfor i in range(1, n):\n S = list(map(int, input().split()))\n for j in range(3):\n dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j - 2]) + S[j]\nprint((max(dp[n - 1][0], dp[n - 1][1], dp[n - 1][2])))\n# dp[i][j]=i\u756a\u76ee\u306bj\u3092\u9078\u3093\u3060\u6642\u306e\u6700\u5927\u5024(j\u306fa,b,c\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3002)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-S = [[0 for i in range(3)] for i in range(n)]","-S[0] = dp[0].copy()","- S[i] = list(map(int, input().split()))","+ S = list(map(int, input().split()))","- dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j - 2]) + S[i][j]","+ dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j - 2]) + S[j]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2710427818,"measured_runtime_v1":0.006285902,"runtime_lift":43.1191546405,"key":["s129714630","s550114997"]} +{"user_id":"u869919400","problem_id":"p03162","language":"python","submission_id_v0":"s203896708","submission_id_v1":"s149433895","cpu_time_v0":1653,"cpu_time_v1":675,"memory_v0":43728,"memory_v1":76760,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\ndp = np.zeros((N, 3), dtype=int)\n\n\n\nfor i in range(N):\n\n dp[i][0] = L[0][0] if i == 0 else max(dp[i-1][1]+L[i][0], dp[i-1][2]+L[i][0])\n\n dp[i][1] = L[0][1] if i == 0 else max(dp[i-1][0]+L[i][1], dp[i-1][2]+L[i][1])\n\n dp[i][2] = L[0][2] if i == 0 else max(dp[i-1][0]+L[i][2], dp[i-1][1]+L[i][2])\n\n\n\nprint((max(dp[-1])))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nabc = [list(map(int, input().split())) for i in range(N)]\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\nfor i in range(N):\n\n dp[i+1][0] = max(dp[i][1]+abc[i][0], dp[i][2]+abc[i][0])\n\n dp[i+1][1] = max(dp[i][0]+abc[i][1], dp[i][2]+abc[i][1])\n\n dp[i+1][2] = max(dp[i][0]+abc[i][2], dp[i][1]+abc[i][2])\n\nprint((max(dp[-1])))","code_v0_loc":11,"code_v1_loc":8,"code_v0_num_chars":420,"code_v1_num_chars":351,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nL = [list(map(int, input().split())) for i in range(N)]\ndp = np.zeros((N, 3), dtype=int)\nfor i in range(N):\n dp[i][0] = (\n L[0][0] if i == 0 else max(dp[i - 1][1] + L[i][0], dp[i - 1][2] + L[i][0])\n )\n dp[i][1] = (\n L[0][1] if i == 0 else max(dp[i - 1][0] + L[i][1], dp[i - 1][2] + L[i][1])\n )\n dp[i][2] = (\n L[0][2] if i == 0 else max(dp[i - 1][0] + L[i][2], dp[i - 1][1] + L[i][2])\n )\nprint((max(dp[-1])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nabc = [list(map(int, input().split())) for i in range(N)]\ndp = [[0 for i in range(3)] for j in range(N + 1)]\nfor i in range(N):\n dp[i + 1][0] = max(dp[i][1] + abc[i][0], dp[i][2] + abc[i][0])\n dp[i + 1][1] = max(dp[i][0] + abc[i][1], dp[i][2] + abc[i][1])\n dp[i + 1][2] = max(dp[i][0] + abc[i][2], dp[i][1] + abc[i][2])\nprint((max(dp[-1])))\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-import numpy as np","-","-L = [list(map(int, input().split())) for i in range(N)]","-dp = np.zeros((N, 3), dtype=int)","+abc = [list(map(int, input().split())) for i in range(N)]","+dp = [[0 for i in range(3)] for j in range(N + 1)]","- dp[i][0] = (","- L[0][0] if i == 0 else max(dp[i - 1][1] + L[i][0], dp[i - 1][2] + L[i][0])","- )","- dp[i][1] = (","- L[0][1] if i == 0 else max(dp[i - 1][0] + L[i][1], dp[i - 1][2] + L[i][1])","- )","- dp[i][2] = (","- L[0][2] if i == 0 else max(dp[i - 1][0] + L[i][2], dp[i - 1][1] + L[i][2])","- )","+ dp[i + 1][0] = max(dp[i][1] + abc[i][0], dp[i][2] + abc[i][0])","+ dp[i + 1][1] = max(dp[i][0] + abc[i][1], dp[i][2] + abc[i][1])","+ dp[i + 1][2] = max(dp[i][0] + abc[i][2], dp[i][1] + abc[i][2])"],"diff_only_import_comment":false,"measured_runtime_v0":1.439308491,"measured_runtime_v1":0.1934893382,"runtime_lift":7.4386966466,"key":["s203896708","s149433895"]} +{"user_id":"u581603131","problem_id":"p03796","language":"python","submission_id_v0":"s669812244","submission_id_v1":"s638032890","cpu_time_v0":230,"cpu_time_v1":41,"memory_v0":3984,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nN = int(eval(input()))\n\nprint((math.factorial(N)%(10**9+7)))\n\n# optimized version of the same code:\n","target":"ans=1\n\nn=int(eval(input()))\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)","code_v0_loc":3,"code_v1_loc":6,"code_v0_num_chars":65,"code_v1_num_chars":92,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nprint((math.factorial(N) % (10**9 + 7)))\n","code_v1_no_empty_lines":"ans = 1\nn = int(eval(input()))\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import math","-","-N = int(eval(input()))","-print((math.factorial(N) % (10**9 + 7)))","+ans = 1","+n = int(eval(input()))","+for i in range(1, n + 1):","+ ans *= i","+ ans = ans % (10**9 + 7)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.8658925366,"measured_runtime_v1":0.3537542467,"runtime_lift":2.4477233692,"key":["s669812244","s638032890"]} +{"user_id":"u197300773","problem_id":"p02901","language":"python","submission_id_v0":"s172477662","submission_id_v1":"s096488733","cpu_time_v0":1463,"cpu_time_v1":1316,"memory_v0":36468,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.05,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n import math\n\n N,M=list(map(int,input().split()))\n\n a=[]\n\n for i in range(M):\n\n tmp=list(map(int,input().split()))\n\n tmpc=list(map(int,input().split()))\n\n c=0\n\n for j in range(len(tmpc)):\n\n c+=2**(tmpc[j]-1)\n\n tmp[1]=c\n\n a+=[tmp]\n\n\n\n\n\n dp=[[10**10 for j in range(2**N)] for i in range(M)]\n\n dp[0][0]=0\n\n dp[0][a[0][1]]=a[0][0]\n\n\n\n\n\n for i in range(1,M):\n\n dp[i]=dp[i-1]\n\n for j in range(2**N):\n\n z,p=a[i][0],a[i][1]\n\n q=j|p\n\n x=dp[i-1][j]+z\n\n if dp[i][q]>x: dp[i][q]=x\n\n\n\n ans=dp[M-1][2**N-1]\n\n print((ans if ans<10**10 else -1))\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"n,m=list(map(int,input().split()))\n\nL=2**n\n\ncost=[0]+[10**8 for i in range(L-1)]\n\n\n\nfor i in range(m):\n\n a,b=list(map(int,input().split()))\n\n c=sum([2**(int(i)-1) for i in input().split()])\n\n for j in range(L):\n\n q=j|c\n\n x=cost[j]+a\n\n if cost[q]>x:\n\n cost[q]=x\n\nprint((cost[L-1] if cost[L-1]<10**8 else -1))","code_v0_loc":32,"code_v1_loc":13,"code_v0_num_chars":718,"code_v1_num_chars":334,"code_v0_no_empty_lines":"def main():\n import math\n\n N, M = list(map(int, input().split()))\n a = []\n for i in range(M):\n tmp = list(map(int, input().split()))\n tmpc = list(map(int, input().split()))\n c = 0\n for j in range(len(tmpc)):\n c += 2 ** (tmpc[j] - 1)\n tmp[1] = c\n a += [tmp]\n dp = [[10**10 for j in range(2**N)] for i in range(M)]\n dp[0][0] = 0\n dp[0][a[0][1]] = a[0][0]\n for i in range(1, M):\n dp[i] = dp[i - 1]\n for j in range(2**N):\n z, p = a[i][0], a[i][1]\n q = j | p\n x = dp[i - 1][j] + z\n if dp[i][q] > x:\n dp[i][q] = x\n ans = dp[M - 1][2**N - 1]\n print((ans if ans < 10**10 else -1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nL = 2**n\ncost = [0] + [10**8 for i in range(L - 1)]\nfor i in range(m):\n a, b = list(map(int, input().split()))\n c = sum([2 ** (int(i) - 1) for i in input().split()])\n for j in range(L):\n q = j | c\n x = cost[j] + a\n if cost[q] > x:\n cost[q] = x\nprint((cost[L - 1] if cost[L - 1] < 10**8 else -1))\n","code_same":false,"relative_loc_diff_percent":59.375,"diff":["-def main():","- import math","-","- N, M = list(map(int, input().split()))","- a = []","- for i in range(M):","- tmp = list(map(int, input().split()))","- tmpc = list(map(int, input().split()))","- c = 0","- for j in range(len(tmpc)):","- c += 2 ** (tmpc[j] - 1)","- tmp[1] = c","- a += [tmp]","- dp = [[10**10 for j in range(2**N)] for i in range(M)]","- dp[0][0] = 0","- dp[0][a[0][1]] = a[0][0]","- for i in range(1, M):","- dp[i] = dp[i - 1]","- for j in range(2**N):","- z, p = a[i][0], a[i][1]","- q = j | p","- x = dp[i - 1][j] + z","- if dp[i][q] > x:","- dp[i][q] = x","- ans = dp[M - 1][2**N - 1]","- print((ans if ans < 10**10 else -1))","-","-","-if __name__ == \"__main__\":","- main()","+n, m = list(map(int, input().split()))","+L = 2**n","+cost = [0] + [10**8 for i in range(L - 1)]","+for i in range(m):","+ a, b = list(map(int, input().split()))","+ c = sum([2 ** (int(i) - 1) for i in input().split()])","+ for j in range(L):","+ q = j | c","+ x = cost[j] + a","+ if cost[q] > x:","+ cost[q] = x","+print((cost[L - 1] if cost[L - 1] < 10**8 else -1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3366471643,"measured_runtime_v1":0.2183672116,"runtime_lift":1.5416561941,"key":["s172477662","s096488733"]} +{"user_id":"u829796346","problem_id":"p02574","language":"python","submission_id_v0":"s911286307","submission_id_v1":"s843819881","cpu_time_v0":997,"cpu_time_v1":462,"memory_v0":203940,"memory_v1":203640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.66,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env pypy3\n\n# N,M = map(int,sys.stdin.readline().split())\n\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n\n# s = sys.stdin.readline().rstrip()\n\n# N = int(sys.stdin.readline())\n\n# INF = float(\"inf\")\n\nimport math,sys\n\n\n\nn = int(sys.stdin.readline())\n\na = tuple(map(int,sys.stdin.readline().split()))\n\n#n = int(input())\n\n#a = list(map(int,input().split()))\n\ng = math.gcd(a[0],a[1])\n\nfor i in range(2,n):\n\n g = math.gcd(g,a[i])\n\nM = max(a)\n\nacc = a[0]\n\nfor i in range(n):\n\n acc = math.gcd(acc,a[i])\n\nif acc != 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nLIMIT=max(a)\n\nminPrime = [0]*(LIMIT+1)\n\nminPrime[1] = 1\n\ndef make():\n\n for i in range(2,LIMIT+1):\n\n if minPrime[i] == 0:\n\n minPrime[i] = i\n\n #print(i)\n\n for j in range(i+i,LIMIT+1,i):\n\n #print(i,j)\n\n if minPrime[j] == 0:\n\n minPrime[j] = i\n\nmake()\n\ndef factrial(N):\n\n ret = []\n\n while minPrime[N] != N:\n\n ret.append(minPrime[N])\n\n N = N\/\/minPrime[N]\n\n if N != 1:\n\n ret.append(N)\n\n return ret\n\n\n\njudge = set([])\n\npc = True\n\n\n\npairwise = True\n\np = set() #all prime\n\n\n\nfor e in a:\n\n if not pairwise:\n\n break\n\n asf = set(factrial(e))\n\n if judge & asf != set():\n\n pc = False\n\n # #pairwise = False\n\n # print(\"setwise coprime\")\n\n # exit(0)\n\n judge |= asf\n\n# for i in a:\n\n# if not pc:\n\n# break\n\n# asf = set(factrial(i))\n\n\n\n# if judge & asf != set():\n\n# pc = False\n\n# judge |= asf\n\nif pc:\n\n print(\"pairwise coprime\")\n\nelif g == 1:\n\n print(\"setwise coprime\")\n\nelse:\n\n print(\"not coprime\")\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env pypy3\n\n# N,M = map(int,sys.stdin.readline().split())\n\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n\n# s = sys.stdin.readline().rstrip()\n\n# N = int(sys.stdin.readline())\n\n# INF = float(\"inf\")\n\nimport math,sys\n\n\n\nn = int(sys.stdin.readline())\n\na = tuple(map(int,sys.stdin.readline().split()))\n\n#n = int(input())\n\n#a = list(map(int,input().split()))\n\ng = math.gcd(a[0],a[1])\n\nfor i in range(2,n):\n\n g = math.gcd(g,a[i])\n\nM = max(a)\n\nacc = a[0]\n\nfor i in range(n):\n\n acc = math.gcd(acc,a[i])\n\nif acc != 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nLIMIT=max(a)\n\nminPrime = [0]*(LIMIT+1)\n\nminPrime[1] = 1\n\ndef make():\n\n for i in range(2,LIMIT+1):\n\n if minPrime[i] == 0:\n\n minPrime[i] = i\n\n #print(i)\n\n for j in range(i+i,LIMIT+1,i):\n\n #print(i,j)\n\n if minPrime[j] == 0:\n\n minPrime[j] = i\n\nmake()\n\ndef factrial(N):\n\n ret = []\n\n while minPrime[N] != N:\n\n ret.append(minPrime[N])\n\n N = N\/\/minPrime[N]\n\n if N != 1:\n\n ret.append(N)\n\n return ret\n\n\n\njudge = set([])\n\n\n\nfor e in a:\n\n asf = set(factrial(e))\n\n if judge & asf != set():\n\n print(\"setwise coprime\")\n\n exit()\n\n judge |= asf\n\n #judge = judge | asf #too slow\n\nprint(\"pairwise coprime\")\n","code_v0_loc":77,"code_v1_loc":57,"code_v0_num_chars":1904,"code_v1_num_chars":1552,"code_v0_no_empty_lines":"#!\/usr\/bin\/env pypy3\n# N,M = map(int,sys.stdin.readline().split())\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n# s = sys.stdin.readline().rstrip()\n# N = int(sys.stdin.readline())\n# INF = float(\"inf\")\nimport math, sys\n\nn = int(sys.stdin.readline())\na = tuple(map(int, sys.stdin.readline().split()))\n# n = int(input())\n# a = list(map(int,input().split()))\ng = math.gcd(a[0], a[1])\nfor i in range(2, n):\n g = math.gcd(g, a[i])\nM = max(a)\nacc = a[0]\nfor i in range(n):\n acc = math.gcd(acc, a[i])\nif acc != 1:\n print(\"not coprime\")\n exit()\nLIMIT = max(a)\nminPrime = [0] * (LIMIT + 1)\nminPrime[1] = 1\n\n\ndef make():\n for i in range(2, LIMIT + 1):\n if minPrime[i] == 0:\n minPrime[i] = i\n # print(i)\n for j in range(i + i, LIMIT + 1, i):\n # print(i,j)\n if minPrime[j] == 0:\n minPrime[j] = i\n\n\nmake()\n\n\ndef factrial(N):\n ret = []\n while minPrime[N] != N:\n ret.append(minPrime[N])\n N = N \/\/ minPrime[N]\n if N != 1:\n ret.append(N)\n return ret\n\n\njudge = set([])\npc = True\npairwise = True\np = set() # all prime\nfor e in a:\n if not pairwise:\n break\n asf = set(factrial(e))\n if judge & asf != set():\n pc = False\n # #pairwise = False\n # print(\"setwise coprime\")\n # exit(0)\n judge |= asf\n# for i in a:\n# if not pc:\n# break\n# asf = set(factrial(i))\n# if judge & asf != set():\n# pc = False\n# judge |= asf\nif pc:\n print(\"pairwise coprime\")\nelif g == 1:\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env pypy3\n# N,M = map(int,sys.stdin.readline().split())\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n# s = sys.stdin.readline().rstrip()\n# N = int(sys.stdin.readline())\n# INF = float(\"inf\")\nimport math, sys\n\nn = int(sys.stdin.readline())\na = tuple(map(int, sys.stdin.readline().split()))\n# n = int(input())\n# a = list(map(int,input().split()))\ng = math.gcd(a[0], a[1])\nfor i in range(2, n):\n g = math.gcd(g, a[i])\nM = max(a)\nacc = a[0]\nfor i in range(n):\n acc = math.gcd(acc, a[i])\nif acc != 1:\n print(\"not coprime\")\n exit()\nLIMIT = max(a)\nminPrime = [0] * (LIMIT + 1)\nminPrime[1] = 1\n\n\ndef make():\n for i in range(2, LIMIT + 1):\n if minPrime[i] == 0:\n minPrime[i] = i\n # print(i)\n for j in range(i + i, LIMIT + 1, i):\n # print(i,j)\n if minPrime[j] == 0:\n minPrime[j] = i\n\n\nmake()\n\n\ndef factrial(N):\n ret = []\n while minPrime[N] != N:\n ret.append(minPrime[N])\n N = N \/\/ minPrime[N]\n if N != 1:\n ret.append(N)\n return ret\n\n\njudge = set([])\nfor e in a:\n asf = set(factrial(e))\n if judge & asf != set():\n print(\"setwise coprime\")\n exit()\n judge |= asf\n # judge = judge | asf #too slow\nprint(\"pairwise coprime\")\n","code_same":false,"relative_loc_diff_percent":25.974025974,"diff":["-pc = True","-pairwise = True","-p = set() # all prime","- if not pairwise:","- break","- pc = False","- # #pairwise = False","- # print(\"setwise coprime\")","- # exit(0)","+ print(\"setwise coprime\")","+ exit()","-# for i in a:","-# if not pc:","-# break","-# asf = set(factrial(i))","-# if judge & asf != set():","-# pc = False","-# judge |= asf","-if pc:","- print(\"pairwise coprime\")","-elif g == 1:","- print(\"setwise coprime\")","-else:","- print(\"not coprime\")","+ # judge = judge | asf #too slow","+print(\"pairwise coprime\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1574707303,"measured_runtime_v1":0.0059050472,"runtime_lift":26.6671417322,"key":["s911286307","s843819881"]} +{"user_id":"u864197622","problem_id":"p02599","language":"python","submission_id_v0":"s844952454","submission_id_v1":"s272405166","cpu_time_v0":1464,"cpu_time_v1":1163,"memory_v0":208840,"memory_v1":175860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.56,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nNN = 19\n\nXX = [0] * (2**(NN+1)-1)\n\n\n\ndef addvalue(j, x):\n\n i = 2**NN + j - 1\n\n while i >= 0:\n\n XX[i] += x\n\n i = (i-1) \/\/ 2\n\n\n\ndef rangesum(a, b):\n\n l = a + (1<>= 1\n\n r >>= 1\n\n return s\n\n\n\nN, Q = map(int, input().split())\n\nC = [int(a) - 1 for a in input().split()]\n\nX = [[] for _ in range(N)]\n\nfor i in range(Q):\n\n l, r = map(int, input().split())\n\n X[r-1].append((l - 1, i))\n\nlast = [-1] * N\n\nANS = [-1] * Q\n\naddvalue(1, N)\n\nfor r in range(N):\n\n c = C[r]\n\n addvalue(last[c] + 2, -1)\n\n addvalue(r + 2, 1)\n\n last[c] = r\n\n for l, i in X[r]:\n\n ANS[i] = rangesum(l + 2, 1 << NN)\n\n \n\nprint(*ANS, sep = \"\\n\")\n\n\n# optimized version of the same code:\n","target":"##### https:\/\/atcoder.jp\/contests\/abc174\/submissions\/15644075 \u30921\u6b21\u5143\u5316\n\n\n\nimport sys\n\nINF = 1 << 60\n\nMOD = 10**9 + 7 # 998244353\n\nsys.setrecursionlimit(2147483647)\n\ninput = lambda:sys.stdin.buffer.readline().rstrip()\n\n \n\nclass SegmentTree(object):\n\n def __init__(self, A, dot, unit):\n\n n = 1 << (len(A) - 1).bit_length()\n\n tree = [unit] * (2 * n)\n\n for i, v in enumerate(A):\n\n tree[i + n] = v\n\n for i in range(n - 1, 0, -1):\n\n tree[i] = dot(tree[i << 1], tree[i << 1 | 1])\n\n self._n = n\n\n self._tree = tree\n\n self._dot = dot\n\n self._unit = unit\n\n \n\n def __getitem__(self, i):\n\n return self._tree[i + self._n]\n\n \n\n def update(self, i, v):\n\n i += self._n\n\n self._tree[i] = v\n\n while i != 1:\n\n i >>= 1\n\n self._tree[i] = self._dot(self._tree[i << 1], self._tree[i << 1 | 1])\n\n \n\n def add(self, i, v):\n\n self.update(i, self[i] + v)\n\n \n\n def sum(self, l, r):\n\n l += self._n\n\n r += self._n\n\n l_val = r_val = self._unit\n\n while l < r:\n\n if l & 1:\n\n l_val = self._dot(l_val, self._tree[l])\n\n l += 1\n\n if r & 1:\n\n r -= 1\n\n r_val = self._dot(self._tree[r], r_val)\n\n l >>= 1\n\n r >>= 1\n\n return self._dot(l_val, r_val)\n\n\n\nfrom operator import add\n\ndef resolve():\n\n n, q = map(int, input().split())\n\n C = list(map(lambda x : int(x) - 1, input().split()))\n\n \n\n A = [0] * n\n\n used = [0] * n\n\n for i, c in enumerate(C):\n\n if used[c]:\n\n continue\n\n used[c] = 1\n\n A[i] = 1\n\n tree = SegmentTree(A, add, 0)\n\n \n\n next = [-1] * n\n\n used = [-1] * n\n\n for i in range(n - 1, -1, -1):\n\n c = C[i]\n\n if used[c] != -1:\n\n next[i] = used[c]\n\n used[c] = i\n\n \n\n queries = [None] * q\n\n for i in range(q):\n\n l, r = map(int, input().split())\n\n queries[i] = (l - 1 << 40) + (r << 20) + i\n\n queries.sort(reverse = 1)\n\n \n\n m = (1 << 20) - 1\n\n ans = [0] * q\n\n for l in range(n):\n\n while queries and queries[-1] >> 40 == l:\n\n lri = queries.pop()\n\n l = lri >> 40\n\n r = (lri >> 20) & m\n\n i = lri & m\n\n ans[i] = tree.sum(l, r)\n\n if next[l] != -1:\n\n tree.add(next[l], 1)\n\n \n\n print(*ans, sep = '\\n')\n\nresolve()\n","code_v0_loc":42,"code_v1_loc":91,"code_v0_num_chars":858,"code_v1_num_chars":2458,"code_v0_no_empty_lines":"NN = 19\nXX = [0] * (2 ** (NN + 1) - 1)\n\n\ndef addvalue(j, x):\n i = 2**NN + j - 1\n while i >= 0:\n XX[i] += x\n i = (i - 1) \/\/ 2\n\n\ndef rangesum(a, b):\n l = a + (1 << NN)\n r = b + (1 << NN)\n s = 0\n while l < r:\n if l % 2:\n s += XX[l - 1]\n l += 1\n if r % 2:\n r -= 1\n s += XX[r - 1]\n l >>= 1\n r >>= 1\n return s\n\n\nN, Q = map(int, input().split())\nC = [int(a) - 1 for a in input().split()]\nX = [[] for _ in range(N)]\nfor i in range(Q):\n l, r = map(int, input().split())\n X[r - 1].append((l - 1, i))\nlast = [-1] * N\nANS = [-1] * Q\naddvalue(1, N)\nfor r in range(N):\n c = C[r]\n addvalue(last[c] + 2, -1)\n addvalue(r + 2, 1)\n last[c] = r\n for l, i in X[r]:\n ANS[i] = rangesum(l + 2, 1 << NN)\nprint(*ANS, sep=\"\\n\")\n","code_v1_no_empty_lines":"##### https:\/\/atcoder.jp\/contests\/abc174\/submissions\/15644075 \u30921\u6b21\u5143\u5316\nimport sys\n\nINF = 1 << 60\nMOD = 10**9 + 7 # 998244353\nsys.setrecursionlimit(2147483647)\ninput = lambda: sys.stdin.buffer.readline().rstrip()\n\n\nclass SegmentTree(object):\n def __init__(self, A, dot, unit):\n n = 1 << (len(A) - 1).bit_length()\n tree = [unit] * (2 * n)\n for i, v in enumerate(A):\n tree[i + n] = v\n for i in range(n - 1, 0, -1):\n tree[i] = dot(tree[i << 1], tree[i << 1 | 1])\n self._n = n\n self._tree = tree\n self._dot = dot\n self._unit = unit\n\n def __getitem__(self, i):\n return self._tree[i + self._n]\n\n def update(self, i, v):\n i += self._n\n self._tree[i] = v\n while i != 1:\n i >>= 1\n self._tree[i] = self._dot(self._tree[i << 1], self._tree[i << 1 | 1])\n\n def add(self, i, v):\n self.update(i, self[i] + v)\n\n def sum(self, l, r):\n l += self._n\n r += self._n\n l_val = r_val = self._unit\n while l < r:\n if l & 1:\n l_val = self._dot(l_val, self._tree[l])\n l += 1\n if r & 1:\n r -= 1\n r_val = self._dot(self._tree[r], r_val)\n l >>= 1\n r >>= 1\n return self._dot(l_val, r_val)\n\n\nfrom operator import add\n\n\ndef resolve():\n n, q = map(int, input().split())\n C = list(map(lambda x: int(x) - 1, input().split()))\n A = [0] * n\n used = [0] * n\n for i, c in enumerate(C):\n if used[c]:\n continue\n used[c] = 1\n A[i] = 1\n tree = SegmentTree(A, add, 0)\n next = [-1] * n\n used = [-1] * n\n for i in range(n - 1, -1, -1):\n c = C[i]\n if used[c] != -1:\n next[i] = used[c]\n used[c] = i\n queries = [None] * q\n for i in range(q):\n l, r = map(int, input().split())\n queries[i] = (l - 1 << 40) + (r << 20) + i\n queries.sort(reverse=1)\n m = (1 << 20) - 1\n ans = [0] * q\n for l in range(n):\n while queries and queries[-1] >> 40 == l:\n lri = queries.pop()\n l = lri >> 40\n r = (lri >> 20) & m\n i = lri & m\n ans[i] = tree.sum(l, r)\n if next[l] != -1:\n tree.add(next[l], 1)\n print(*ans, sep=\"\\n\")\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":53.8461538462,"diff":["-NN = 19","-XX = [0] * (2 ** (NN + 1) - 1)","+##### https:\/\/atcoder.jp\/contests\/abc174\/submissions\/15644075 \u30921\u6b21\u5143\u5316","+import sys","+","+INF = 1 << 60","+MOD = 10**9 + 7 # 998244353","+sys.setrecursionlimit(2147483647)","+input = lambda: sys.stdin.buffer.readline().rstrip()","-def addvalue(j, x):","- i = 2**NN + j - 1","- while i >= 0:","- XX[i] += x","- i = (i - 1) \/\/ 2","+class SegmentTree(object):","+ def __init__(self, A, dot, unit):","+ n = 1 << (len(A) - 1).bit_length()","+ tree = [unit] * (2 * n)","+ for i, v in enumerate(A):","+ tree[i + n] = v","+ for i in range(n - 1, 0, -1):","+ tree[i] = dot(tree[i << 1], tree[i << 1 | 1])","+ self._n = n","+ self._tree = tree","+ self._dot = dot","+ self._unit = unit","+","+ def __getitem__(self, i):","+ return self._tree[i + self._n]","+","+ def update(self, i, v):","+ i += self._n","+ self._tree[i] = v","+ while i != 1:","+ i >>= 1","+ self._tree[i] = self._dot(self._tree[i << 1], self._tree[i << 1 | 1])","+","+ def add(self, i, v):","+ self.update(i, self[i] + v)","+","+ def sum(self, l, r):","+ l += self._n","+ r += self._n","+ l_val = r_val = self._unit","+ while l < r:","+ if l & 1:","+ l_val = self._dot(l_val, self._tree[l])","+ l += 1","+ if r & 1:","+ r -= 1","+ r_val = self._dot(self._tree[r], r_val)","+ l >>= 1","+ r >>= 1","+ return self._dot(l_val, r_val)","-def rangesum(a, b):","- l = a + (1 << NN)","- r = b + (1 << NN)","- s = 0","- while l < r:","- if l % 2:","- s += XX[l - 1]","- l += 1","- if r % 2:","- r -= 1","- s += XX[r - 1]","- l >>= 1","- r >>= 1","- return s","+from operator import add","-N, Q = map(int, input().split())","-C = [int(a) - 1 for a in input().split()]","-X = [[] for _ in range(N)]","-for i in range(Q):","- l, r = map(int, input().split())","- X[r - 1].append((l - 1, i))","-last = [-1] * N","-ANS = [-1] * Q","-addvalue(1, N)","-for r in range(N):","- c = C[r]","- addvalue(last[c] + 2, -1)","- addvalue(r + 2, 1)","- last[c] = r","- for l, i in X[r]:","- ANS[i] = rangesum(l + 2, 1 << NN)","-print(*ANS, sep=\"\\n\")","+def resolve():","+ n, q = map(int, input().split())","+ C = list(map(lambda x: int(x) - 1, input().split()))","+ A = [0] * n","+ used = [0] * n","+ for i, c in enumerate(C):","+ if used[c]:","+ continue","+ used[c] = 1","+ A[i] = 1","+ tree = SegmentTree(A, add, 0)","+ next = [-1] * n","+ used = [-1] * n","+ for i in range(n - 1, -1, -1):","+ c = C[i]","+ if used[c] != -1:","+ next[i] = used[c]","+ used[c] = i","+ queries = [None] * q","+ for i in range(q):","+ l, r = map(int, input().split())","+ queries[i] = (l - 1 << 40) + (r << 20) + i","+ queries.sort(reverse=1)","+ m = (1 << 20) - 1","+ ans = [0] * q","+ for l in range(n):","+ while queries and queries[-1] >> 40 == l:","+ lri = queries.pop()","+ l = lri >> 40","+ r = (lri >> 20) & m","+ i = lri & m","+ ans[i] = tree.sum(l, r)","+ if next[l] != -1:","+ tree.add(next[l], 1)","+ print(*ans, sep=\"\\n\")","+","+","+resolve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3892713579,"measured_runtime_v1":0.2184136535,"runtime_lift":1.7822665926,"key":["s844952454","s272405166"]} +{"user_id":"u987846648","problem_id":"p02627","language":"python","submission_id_v0":"s793826721","submission_id_v1":"s875451520","cpu_time_v0":75,"cpu_time_v1":67,"memory_v0":61796,"memory_v1":61608,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.67,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nalph = eval(input())\n\nif alph.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")\n\n\n# optimized version of the same code:\n","target":"a = eval(input())\n\n\n\nif a.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")","code_v0_loc":5,"code_v1_loc":6,"code_v0_num_chars":74,"code_v1_num_chars":69,"code_v0_no_empty_lines":"alph = eval(input())\nif alph.isupper():\n print(\"A\")\nelse:\n print(\"a\")\n","code_v1_no_empty_lines":"a = eval(input())\nif a.isupper():\n print(\"A\")\nelse:\n print(\"a\")\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-alph = eval(input())","-if alph.isupper():","+a = eval(input())","+if a.isupper():"],"diff_only_import_comment":false,"measured_runtime_v0":0.1834881261,"measured_runtime_v1":0.0064039894,"runtime_lift":28.6521595413,"key":["s793826721","s875451520"]} +{"user_id":"u816872429","problem_id":"p03039","language":"python","submission_id_v0":"s871362008","submission_id_v1":"s362897835","cpu_time_v0":1991,"cpu_time_v1":98,"memory_v0":18912,"memory_v1":11052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, m, k = list(map(int, input().split()))\n\n\n\nmod = 1000000007\n\ndef pow(x, n):\n\n ret = 1\n\n while n > 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\nfac = [1]\n\ninv = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n inv.append(pow(fac[i], mod - 2))\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\n\ndef doit(n, m, k):\n\n ret = 0\n\n for d in range(m):\n\n ret = (ret + d * (m - d)) % mod\n\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))\n\n# optimized version of the same code:\n","target":"n, m, k = list(map(int, input().split()))\n\n\n\nmod = 1000000007\n\nfac = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n\n\ndef pow(x, n):\n\n ret = 1\n\n while n > 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\ndef inv(i):\n\n return pow(fac[i], mod - 2)\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv(k) * inv(n - k)) % mod\n\n\n\nx = sum(d * (m - d) for d in range(m)) % mod\n\ny = sum(d * (n - d) for d in range(n)) % mod\n\n\n\nc = cmb(n * m - 2, k - 2)\n\nx = (x * n * n * c) % mod\n\ny = (y * m * m * c) % mod\n\n\n\nprint(((x + y) % mod))","code_v0_loc":28,"code_v1_loc":30,"code_v0_num_chars":624,"code_v1_num_chars":620,"code_v0_no_empty_lines":"n, m, k = list(map(int, input().split()))\nmod = 1000000007\n\n\ndef pow(x, n):\n ret = 1\n while n > 0:\n if (n & 1) == 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n n >>= 1\n return ret\n\n\nfac = [1]\ninv = [1]\nfor i in range(1, n * m + 1):\n fac.append((fac[-1] * i) % mod)\n inv.append(pow(fac[i], mod - 2))\n\n\ndef cmb(n, k):\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\ndef doit(n, m, k):\n ret = 0\n for d in range(m):\n ret = (ret + d * (m - d)) % mod\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))\n","code_v1_no_empty_lines":"n, m, k = list(map(int, input().split()))\nmod = 1000000007\nfac = [1]\nfor i in range(1, n * m + 1):\n fac.append((fac[-1] * i) % mod)\n\n\ndef pow(x, n):\n ret = 1\n while n > 0:\n if (n & 1) == 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n n >>= 1\n return ret\n\n\ndef inv(i):\n return pow(fac[i], mod - 2)\n\n\ndef cmb(n, k):\n return (fac[n] * inv(k) * inv(n - k)) % mod\n\n\nx = sum(d * (m - d) for d in range(m)) % mod\ny = sum(d * (n - d) for d in range(n)) % mod\nc = cmb(n * m - 2, k - 2)\nx = (x * n * n * c) % mod\ny = (y * m * m * c) % mod\nprint(((x + y) % mod))\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["+fac = [1]","+for i in range(1, n * m + 1):","+ fac.append((fac[-1] * i) % mod)","-fac = [1]","-inv = [1]","-for i in range(1, n * m + 1):","- fac.append((fac[-1] * i) % mod)","- inv.append(pow(fac[i], mod - 2))","+def inv(i):","+ return pow(fac[i], mod - 2)","- return (fac[n] * inv[k] * inv[n - k]) % mod","+ return (fac[n] * inv(k) * inv(n - k)) % mod","-def doit(n, m, k):","- ret = 0","- for d in range(m):","- ret = (ret + d * (m - d)) % mod","- return (ret * n * n * cmb(n * m - 2, k - 2)) % mod","-","-","-print(((doit(n, m, k) + doit(m, n, k)) % mod))","+x = sum(d * (m - d) for d in range(m)) % mod","+y = sum(d * (n - d) for d in range(n)) % mod","+c = cmb(n * m - 2, k - 2)","+x = (x * n * n * c) % mod","+y = (y * m * m * c) % mod","+print(((x + y) % mod))"],"diff_only_import_comment":false,"measured_runtime_v0":0.7987827396,"measured_runtime_v1":0.3213389852,"runtime_lift":2.4857946791,"key":["s871362008","s362897835"]} +{"user_id":"u806976856","problem_id":"p02555","language":"python","submission_id_v0":"s550500681","submission_id_v1":"s439989437","cpu_time_v0":123,"cpu_time_v1":70,"memory_v0":9160,"memory_v1":64844,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.09,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns=int(eval(input()))\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s\/\/3\n\nans=0\n\ndef f(n,k,p):\n\n if k==0:\n\n return 1\n\n elif k%2==0:\n\n return (f(n,k\/\/2,p)**2)%p\n\n else:\n\n return (n*f(n,k-1,p))%p\n\n\n\nfor k in range(1,n+1):\n\n a=1\n\n b=1\n\n for j in range(k-1):\n\n a=(a*(s-3*k+1+j))%p\n\n b=(b*(j+1))%p\n\n ans=(ans+a*f(b,p-2,p))%p\n\n\n\nprint((ans%p))\n\n\n\n\n# optimized version of the same code:\n","target":"s=int(eval(input()))\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s\/\/3\n\nans=0\n\nx=[0]*(s+1)\n\nx[0]=1\n\nx[1]=1\n\ny=[0]*(s+1)\n\n\n\nfor i in range(2,s+1):\n\n x[i]=x[i-1]*i%p\n\n\n\ny[s]=pow(x[s],p-2,p)\n\nfor i in range(s):\n\n y[s-1-i]=y[s-i]*(s-i)%p\n\n\n\nfor k in range(1,n+1):\n\n ans+=x[s-2*k-1]*y[k-1]*y[s-3*k]%p\n\n\n\nprint((ans%p))\n\n\n","code_v0_loc":25,"code_v1_loc":24,"code_v0_num_chars":391,"code_v1_num_chars":322,"code_v0_no_empty_lines":"s = int(eval(input()))\np = 10**9 + 7\nif s <= 2:\n print((0))\n exit()\nn = s \/\/ 3\nans = 0\n\n\ndef f(n, k, p):\n if k == 0:\n return 1\n elif k % 2 == 0:\n return (f(n, k \/\/ 2, p) ** 2) % p\n else:\n return (n * f(n, k - 1, p)) % p\n\n\nfor k in range(1, n + 1):\n a = 1\n b = 1\n for j in range(k - 1):\n a = (a * (s - 3 * k + 1 + j)) % p\n b = (b * (j + 1)) % p\n ans = (ans + a * f(b, p - 2, p)) % p\nprint((ans % p))\n","code_v1_no_empty_lines":"s = int(eval(input()))\np = 10**9 + 7\nif s <= 2:\n print((0))\n exit()\nn = s \/\/ 3\nans = 0\nx = [0] * (s + 1)\nx[0] = 1\nx[1] = 1\ny = [0] * (s + 1)\nfor i in range(2, s + 1):\n x[i] = x[i - 1] * i % p\ny[s] = pow(x[s], p - 2, p)\nfor i in range(s):\n y[s - 1 - i] = y[s - i] * (s - i) % p\nfor k in range(1, n + 1):\n ans += x[s - 2 * k - 1] * y[k - 1] * y[s - 3 * k] % p\nprint((ans % p))\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["-","-","-def f(n, k, p):","- if k == 0:","- return 1","- elif k % 2 == 0:","- return (f(n, k \/\/ 2, p) ** 2) % p","- else:","- return (n * f(n, k - 1, p)) % p","-","-","+x = [0] * (s + 1)","+x[0] = 1","+x[1] = 1","+y = [0] * (s + 1)","+for i in range(2, s + 1):","+ x[i] = x[i - 1] * i % p","+y[s] = pow(x[s], p - 2, p)","+for i in range(s):","+ y[s - 1 - i] = y[s - i] * (s - i) % p","- a = 1","- b = 1","- for j in range(k - 1):","- a = (a * (s - 3 * k + 1 + j)) % p","- b = (b * (j + 1)) % p","- ans = (ans + a * f(b, p - 2, p)) % p","+ ans += x[s - 2 * k - 1] * y[k - 1] * y[s - 3 * k] % p"],"diff_only_import_comment":false,"measured_runtime_v0":0.3091425891,"measured_runtime_v1":0.216736346,"runtime_lift":1.4263532387,"key":["s550500681","s439989437"]} +{"user_id":"u224353074","problem_id":"p03162","language":"python","submission_id_v0":"s119181910","submission_id_v1":"s673450457","cpu_time_v0":1121,"cpu_time_v1":611,"memory_v0":41852,"memory_v1":60888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\n\n\nabc = np.array([list(map(int, input().split())) for i in range(N)])\n\n\n\ndp = [[0]*3 for i in range(N+1)]\n\n\n\nfor i in range(1, N+1):\n\n dp[i][0] = max(dp[i - 1][1] + abc[i - 1][1], dp[i - 1][2] + abc[i - 1][2])\n\n dp[i][1] = max(dp[i - 1][0] + abc[i - 1][0], dp[i - 1][2] + abc[i - 1][2])\n\n dp[i][2] = max(dp[i - 1][1] + abc[i - 1][1], dp[i - 1][0] + abc[i - 1][0])\n\n\n\nprint((max(dp[-1])))\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\n\n\nA = [0] * (N + 1)\n\nB = [0] * (N + 1)\n\nC = [0] * (N + 1)\n\n\n\nfor i in range(1, N + 1):\n\n A[i], B[i], C[i] = list(map(int, input().split()))\n\n\n\ndp = [[0] * 3 for _ in range(N + 1)]\n\nfor i in range(1, N + 1):\n\n dp[i][0] = A[i] + max(dp[i-1][1], dp[i-1][2])\n\n dp[i][1] = B[i] + max(dp[i-1][2], dp[i-1][0])\n\n dp[i][2] = C[i] + max(dp[i-1][0], dp[i-1][1])\n\n\n\nprint((max(dp[N])))","code_v0_loc":13,"code_v1_loc":16,"code_v0_num_chars":433,"code_v1_num_chars":395,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nabc = np.array([list(map(int, input().split())) for i in range(N)])\ndp = [[0] * 3 for i in range(N + 1)]\nfor i in range(1, N + 1):\n dp[i][0] = max(dp[i - 1][1] + abc[i - 1][1], dp[i - 1][2] + abc[i - 1][2])\n dp[i][1] = max(dp[i - 1][0] + abc[i - 1][0], dp[i - 1][2] + abc[i - 1][2])\n dp[i][2] = max(dp[i - 1][1] + abc[i - 1][1], dp[i - 1][0] + abc[i - 1][0])\nprint((max(dp[-1])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [0] * (N + 1)\nB = [0] * (N + 1)\nC = [0] * (N + 1)\nfor i in range(1, N + 1):\n A[i], B[i], C[i] = list(map(int, input().split()))\ndp = [[0] * 3 for _ in range(N + 1)]\nfor i in range(1, N + 1):\n dp[i][0] = A[i] + max(dp[i - 1][1], dp[i - 1][2])\n dp[i][1] = B[i] + max(dp[i - 1][2], dp[i - 1][0])\n dp[i][2] = C[i] + max(dp[i - 1][0], dp[i - 1][1])\nprint((max(dp[N])))\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-import numpy as np","-","-abc = np.array([list(map(int, input().split())) for i in range(N)])","-dp = [[0] * 3 for i in range(N + 1)]","+A = [0] * (N + 1)","+B = [0] * (N + 1)","+C = [0] * (N + 1)","- dp[i][0] = max(dp[i - 1][1] + abc[i - 1][1], dp[i - 1][2] + abc[i - 1][2])","- dp[i][1] = max(dp[i - 1][0] + abc[i - 1][0], dp[i - 1][2] + abc[i - 1][2])","- dp[i][2] = max(dp[i - 1][1] + abc[i - 1][1], dp[i - 1][0] + abc[i - 1][0])","-print((max(dp[-1])))","+ A[i], B[i], C[i] = list(map(int, input().split()))","+dp = [[0] * 3 for _ in range(N + 1)]","+for i in range(1, N + 1):","+ dp[i][0] = A[i] + max(dp[i - 1][1], dp[i - 1][2])","+ dp[i][1] = B[i] + max(dp[i - 1][2], dp[i - 1][0])","+ dp[i][2] = C[i] + max(dp[i - 1][0], dp[i - 1][1])","+print((max(dp[N])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.7828589861,"measured_runtime_v1":0.2997257252,"runtime_lift":5.9483015181,"key":["s119181910","s673450457"]} +{"user_id":"u729133443","problem_id":"p03371","language":"python","submission_id_v0":"s416055764","submission_id_v1":"s218640380","cpu_time_v0":227,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.51,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c,x,y=list(map(int,input().split()));print((min(k*c*2+a*max(x-k,0)+b*max(y-k,0)for k in range(max(x,y)*3))))\n\n# optimized version of the same code:\n","target":"a,b,c,x,y=list(map(int,input().split()));print((min(x*a+y*b,2*x*c+b*max(0,y-x),2*y*c+a*max(0,x-y))))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":104,"code_v1_num_chars":92,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nprint(\n (\n min(\n k * c * 2 + a * max(x - k, 0) + b * max(y - k, 0)\n for k in range(max(x, y) * 3)\n )\n )\n)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nprint(\n (min(x * a + y * b, 2 * x * c + b * max(0, y - x), 2 * y * c + a * max(0, x - y)))\n)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- (","- min(","- k * c * 2 + a * max(x - k, 0) + b * max(y - k, 0)","- for k in range(max(x, y) * 3)","- )","- )","+ (min(x * a + y * b, 2 * x * c + b * max(0, y - x), 2 * y * c + a * max(0, x - y)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4340552337,"measured_runtime_v1":0.2001633718,"runtime_lift":2.1685048058,"key":["s416055764","s218640380"]} +{"user_id":"u207799478","problem_id":"p03545","language":"python","submission_id_v0":"s023850696","submission_id_v1":"s177314828","cpu_time_v0":173,"cpu_time_v1":104,"memory_v0":38512,"memory_v1":77244,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.88,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nimport string\n\nimport collections\n\nfrom collections import Counter\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)\/\/(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\na, b, c, d = list(map(int, eval(input())))\n\n#print(a, b, c, d)\n\nif a+b+c+d == 7:\n\n print((str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a+b-c+d == 7:\n\n print((str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a+b+c-d == 7:\n\n print((str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a+b-c-d == 7:\n\n print((str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a-b+c+d == 7:\n\n print((str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a-b-c+d == 7:\n\n print((str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a-b+c-d == 7:\n\n print((str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a-b-c-d == 7:\n\n print((str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\n\n# optimized version of the same code:\n","target":"from copy import deepcopy\n\nimport math\n\nimport string\n\nimport collections\n\nfrom collections import Counter\n\nfrom collections import deque\n\nfrom decimal import Decimal\n\nimport sys\n\nimport fractions\n\nfrom operator import itemgetter\n\nimport itertools\n\nimport copy\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)\/\/(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\n\ns = list(map(int, input()))\n\n\n\nif s[0]+s[1]+s[2]+s[3] == 7:\n\n print(str(s[0]), '+', str(s[1]), '+',\n\n str(s[2]), '+', str(s[3]), '=', 7, sep='')\n\n exit()\n\nif s[0]+s[1]-s[2]+s[3] == 7:\n\n print(str(s[0]), '+', str(s[1]), '-', str(s[2]),\n\n '+', str(s[3]), '=', 7, sep='')\n\n exit()\n\nif s[0]-s[1]+s[2]+s[3] == 7:\n\n print(str(s[0]), '-', str(s[1]), '+', str(s[2]),\n\n '+', str(s[3]), '=', 7, sep='')\n\n exit()\n\nif s[0]-s[1]-s[2]+s[3] == 7:\n\n print(str(s[0]), '-', str(s[1]), '-', str(s[2]),\n\n '+', str(s[3]), '=', 7, sep='')\n\n exit()\n\nif s[0]+s[1]+s[2]-s[3] == 7:\n\n print(str(s[0]), '+', str(s[1]), '+', str(s[2]),\n\n '-', str(s[3]), '=', 7, sep='')\n\n exit()\n\nif s[0]-s[1]-s[2]-s[3] == 7:\n\n print(str(s[0]), '-', str(s[1]), '-', str(s[2]),\n\n '-', str(s[3]), '=', 7, sep='')\n\n exit()\n\nif s[0]-s[1]+s[2]-s[3] == 7:\n\n print(str(s[0]), '-', str(s[1]), '+', str(s[2]),\n\n '-', str(s[3]), '=', 7, sep='')\n\n exit()\n\nif s[0]+s[1]-s[2]-s[3] == 7:\n\n print(str(s[0]), '+', str(s[1]), '-', str(s[2]),\n\n '-', str(s[3]), '=', 7, sep='')\n\n exit()\n","code_v0_loc":59,"code_v1_loc":76,"code_v0_num_chars":1378,"code_v1_num_chars":1963,"code_v0_no_empty_lines":"import math\nimport string\nimport collections\nfrom collections import Counter\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not (item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n + 1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\na, b, c, d = list(map(int, eval(input())))\n# print(a, b, c, d)\nif a + b + c + d == 7:\n print((str(a) + \"+\" + str(b) + \"+\" + str(c) + \"+\" + str(d) + \"=7\"))\n exit()\nif a + b - c + d == 7:\n print((str(a) + \"+\" + str(b) + \"-\" + str(c) + \"+\" + str(d) + \"=7\"))\n exit()\nif a + b + c - d == 7:\n print((str(a) + \"+\" + str(b) + \"+\" + str(c) + \"-\" + str(d) + \"=7\"))\n exit()\nif a + b - c - d == 7:\n print((str(a) + \"+\" + str(b) + \"-\" + str(c) + \"-\" + str(d) + \"=7\"))\n exit()\nif a - b + c + d == 7:\n print((str(a) + \"-\" + str(b) + \"+\" + str(c) + \"+\" + str(d) + \"=7\"))\n exit()\nif a - b - c + d == 7:\n print((str(a) + \"-\" + str(b) + \"-\" + str(c) + \"+\" + str(d) + \"=7\"))\n exit()\nif a - b + c - d == 7:\n print((str(a) + \"-\" + str(b) + \"+\" + str(c) + \"-\" + str(d) + \"=7\"))\n exit()\nif a - b - c - d == 7:\n print((str(a) + \"-\" + str(b) + \"-\" + str(c) + \"-\" + str(d) + \"=7\"))\n exit()\n","code_v1_no_empty_lines":"from copy import deepcopy\nimport math\nimport string\nimport collections\nfrom collections import Counter\nfrom collections import deque\nfrom decimal import Decimal\nimport sys\nimport fractions\nfrom operator import itemgetter\nimport itertools\nimport copy\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not (item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n + 1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\ns = list(map(int, input()))\nif s[0] + s[1] + s[2] + s[3] == 7:\n print(str(s[0]), \"+\", str(s[1]), \"+\", str(s[2]), \"+\", str(s[3]), \"=\", 7, sep=\"\")\n exit()\nif s[0] + s[1] - s[2] + s[3] == 7:\n print(str(s[0]), \"+\", str(s[1]), \"-\", str(s[2]), \"+\", str(s[3]), \"=\", 7, sep=\"\")\n exit()\nif s[0] - s[1] + s[2] + s[3] == 7:\n print(str(s[0]), \"-\", str(s[1]), \"+\", str(s[2]), \"+\", str(s[3]), \"=\", 7, sep=\"\")\n exit()\nif s[0] - s[1] - s[2] + s[3] == 7:\n print(str(s[0]), \"-\", str(s[1]), \"-\", str(s[2]), \"+\", str(s[3]), \"=\", 7, sep=\"\")\n exit()\nif s[0] + s[1] + s[2] - s[3] == 7:\n print(str(s[0]), \"+\", str(s[1]), \"+\", str(s[2]), \"-\", str(s[3]), \"=\", 7, sep=\"\")\n exit()\nif s[0] - s[1] - s[2] - s[3] == 7:\n print(str(s[0]), \"-\", str(s[1]), \"-\", str(s[2]), \"-\", str(s[3]), \"=\", 7, sep=\"\")\n exit()\nif s[0] - s[1] + s[2] - s[3] == 7:\n print(str(s[0]), \"-\", str(s[1]), \"+\", str(s[2]), \"-\", str(s[3]), \"=\", 7, sep=\"\")\n exit()\nif s[0] + s[1] - s[2] - s[3] == 7:\n print(str(s[0]), \"+\", str(s[1]), \"-\", str(s[2]), \"-\", str(s[3]), \"=\", 7, sep=\"\")\n exit()\n","code_same":false,"relative_loc_diff_percent":22.3684210526,"diff":["+from copy import deepcopy","+from collections import deque","+from decimal import Decimal","+import sys","+import fractions","+from operator import itemgetter","+import itertools","+import copy","-a, b, c, d = list(map(int, eval(input())))","-# print(a, b, c, d)","-if a + b + c + d == 7:","- print((str(a) + \"+\" + str(b) + \"+\" + str(c) + \"+\" + str(d) + \"=7\"))","+s = list(map(int, input()))","+if s[0] + s[1] + s[2] + s[3] == 7:","+ print(str(s[0]), \"+\", str(s[1]), \"+\", str(s[2]), \"+\", str(s[3]), \"=\", 7, sep=\"\")","-if a + b - c + d == 7:","- print((str(a) + \"+\" + str(b) + \"-\" + str(c) + \"+\" + str(d) + \"=7\"))","+if s[0] + s[1] - s[2] + s[3] == 7:","+ print(str(s[0]), \"+\", str(s[1]), \"-\", str(s[2]), \"+\", str(s[3]), \"=\", 7, sep=\"\")","-if a + b + c - d == 7:","- print((str(a) + \"+\" + str(b) + \"+\" + str(c) + \"-\" + str(d) + \"=7\"))","+if s[0] - s[1] + s[2] + s[3] == 7:","+ print(str(s[0]), \"-\", str(s[1]), \"+\", str(s[2]), \"+\", str(s[3]), \"=\", 7, sep=\"\")","-if a + b - c - d == 7:","- print((str(a) + \"+\" + str(b) + \"-\" + str(c) + \"-\" + str(d) + \"=7\"))","+if s[0] - s[1] - s[2] + s[3] == 7:","+ print(str(s[0]), \"-\", str(s[1]), \"-\", str(s[2]), \"+\", str(s[3]), \"=\", 7, sep=\"\")","-if a - b + c + d == 7:","- print((str(a) + \"-\" + str(b) + \"+\" + str(c) + \"+\" + str(d) + \"=7\"))","+if s[0] + s[1] + s[2] - s[3] == 7:","+ print(str(s[0]), \"+\", str(s[1]), \"+\", str(s[2]), \"-\", str(s[3]), \"=\", 7, sep=\"\")","-if a - b - c + d == 7:","- print((str(a) + \"-\" + str(b) + \"-\" + str(c) + \"+\" + str(d) + \"=7\"))","+if s[0] - s[1] - s[2] - s[3] == 7:","+ print(str(s[0]), \"-\", str(s[1]), \"-\", str(s[2]), \"-\", str(s[3]), \"=\", 7, sep=\"\")","-if a - b + c - d == 7:","- print((str(a) + \"-\" + str(b) + \"+\" + str(c) + \"-\" + str(d) + \"=7\"))","+if s[0] - s[1] + s[2] - s[3] == 7:","+ print(str(s[0]), \"-\", str(s[1]), \"+\", str(s[2]), \"-\", str(s[3]), \"=\", 7, sep=\"\")","-if a - b - c - d == 7:","- print((str(a) + \"-\" + str(b) + \"-\" + str(c) + \"-\" + str(d) + \"=7\"))","+if s[0] + s[1] - s[2] - s[3] == 7:","+ print(str(s[0]), \"+\", str(s[1]), \"-\", str(s[2]), \"-\", str(s[3]), \"=\", 7, sep=\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.2534237525,"measured_runtime_v1":0.1793848307,"runtime_lift":1.4127379195,"key":["s023850696","s177314828"]} +{"user_id":"u102461423","problem_id":"p02599","language":"python","submission_id_v0":"s861498168","submission_id_v1":"s937881941","cpu_time_v0":1554,"cpu_time_v1":1387,"memory_v0":102172,"memory_v1":102328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.75,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nBsize = 700\n\n\n\ndef Mo_argsort(LR):\n\n L = LR[:, 0]\n\n R = LR[:, 1]\n\n key1 = L \/\/ Bsize\n\n key2 = np.where(key1 & 1, -R, R)\n\n key = (key1 << 32) + key2\n\n return np.argsort(key)\n\n\n\ndef main(A, LR):\n\n N = len(A)\n\n Q = len(LR)\n\n ind = Mo_argsort(LR)\n\n count = np.zeros(N + 1, np.int64)\n\n ans = 0\n\n\n\n def add(x):\n\n nonlocal ans\n\n if not count[x]:\n\n ans += 1\n\n count[x] += 1\n\n\n\n def rem(x):\n\n nonlocal ans\n\n count[x] -= 1\n\n if not count[x]:\n\n ans -= 1\n\n\n\n answers = np.empty(Q, np.int64)\n\n nl, nr = 0, 0\n\n for i in ind:\n\n l, r = LR[i]\n\n l -= 1\n\n # \u533a\u9593 [l, r) \u306b\u5bfe\u3059\u308b\u8a08\u7b97\n\n while nl > l:\n\n nl -= 1\n\n add(A[nl])\n\n while nr < r:\n\n add(A[nr])\n\n nr += 1\n\n while nl < l:\n\n rem(A[nl])\n\n nl += 1\n\n while nr > r:\n\n nr -= 1\n\n rem(A[nr])\n\n # \u7b54\u3092\u6c42\u3081\u3066 ans[i] \u306b\u683c\u7d0d\u3059\u308b\n\n answers[i] = ans\n\n return answers\n\n\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n import numba\n\n from numba.pycc import CC\n\n i4 = numba.int32\n\n i8 = numba.int64\n\n cc = CC('my_module')\n\n\n\n def cc_export(f, signature):\n\n cc.export(f.__name__, signature)(f)\n\n return numba.njit(f)\n\n\n\n Mo_argsort = cc_export(Mo_argsort, (i8[:,:],))\n\n main = cc_export(main, (i8[:], i8[:, :]))\n\n cc.compile()\n\n\n\nfrom my_module import main\n\n\n\nN, Q = list(map(int, readline().split()))\n\nA = np.array(readline().split(), np.int64)\n\nLR = np.array(read().split(), np.int64).reshape(Q, 2)\n\n\n\nans = main(A, LR)\n\nprint(('\\n'.join(map(str, ans.tolist()))))\n\n# optimized version of the same code:\n","target":"import sys\n\nimport numpy as np\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nBsize = 1000\n\n\n\ndef Mo_argsort(LR):\n\n L = LR[:, 0]\n\n R = LR[:, 1]\n\n key1 = L \/\/ Bsize\n\n key2 = np.where(key1 & 1, -R, R)\n\n key = (key1 << 32) + key2\n\n return np.argsort(key)\n\n\n\ndef main(A, LR):\n\n N = len(A)\n\n Q = len(LR)\n\n ind = Mo_argsort(LR)\n\n count = np.zeros(N + 1, np.int64)\n\n ans = 0\n\n\n\n def add(x):\n\n nonlocal ans\n\n if not count[x]:\n\n ans += 1\n\n count[x] += 1\n\n\n\n def rem(x):\n\n nonlocal ans\n\n count[x] -= 1\n\n if not count[x]:\n\n ans -= 1\n\n\n\n answers = np.empty(Q, np.int64)\n\n nl, nr = 0, 0\n\n for i in ind:\n\n l, r = LR[i]\n\n l -= 1\n\n # \u533a\u9593 [l, r) \u306b\u5bfe\u3059\u308b\u8a08\u7b97\n\n while nl > l:\n\n nl -= 1\n\n add(A[nl])\n\n while nr < r:\n\n add(A[nr])\n\n nr += 1\n\n while nl < l:\n\n rem(A[nl])\n\n nl += 1\n\n while nr > r:\n\n nr -= 1\n\n rem(A[nr])\n\n # \u7b54\u3092\u6c42\u3081\u3066 ans[i] \u306b\u683c\u7d0d\u3059\u308b\n\n answers[i] = ans\n\n return answers\n\n\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n import numba\n\n from numba.pycc import CC\n\n i4 = numba.int32\n\n i8 = numba.int64\n\n cc = CC('my_module')\n\n\n\n def cc_export(f, signature):\n\n cc.export(f.__name__, signature)(f)\n\n return numba.njit(f)\n\n\n\n Mo_argsort = cc_export(Mo_argsort, (i8[:,:],))\n\n main = cc_export(main, (i8[:], i8[:, :]))\n\n cc.compile()\n\n\n\nfrom my_module import main\n\n\n\nN, Q = list(map(int, readline().split()))\n\nA = np.array(readline().split(), np.int64)\n\nLR = np.array(read().split(), np.int64).reshape(Q, 2)\n\n\n\nans = main(A, LR)\n\nprint(('\\n'.join(map(str, ans.tolist()))))\n","code_v0_loc":81,"code_v1_loc":81,"code_v0_num_chars":1799,"code_v1_num_chars":1801,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nBsize = 700\n\n\ndef Mo_argsort(LR):\n L = LR[:, 0]\n R = LR[:, 1]\n key1 = L \/\/ Bsize\n key2 = np.where(key1 & 1, -R, R)\n key = (key1 << 32) + key2\n return np.argsort(key)\n\n\ndef main(A, LR):\n N = len(A)\n Q = len(LR)\n ind = Mo_argsort(LR)\n count = np.zeros(N + 1, np.int64)\n ans = 0\n\n def add(x):\n nonlocal ans\n if not count[x]:\n ans += 1\n count[x] += 1\n\n def rem(x):\n nonlocal ans\n count[x] -= 1\n if not count[x]:\n ans -= 1\n\n answers = np.empty(Q, np.int64)\n nl, nr = 0, 0\n for i in ind:\n l, r = LR[i]\n l -= 1\n # \u533a\u9593 [l, r) \u306b\u5bfe\u3059\u308b\u8a08\u7b97\n while nl > l:\n nl -= 1\n add(A[nl])\n while nr < r:\n add(A[nr])\n nr += 1\n while nl < l:\n rem(A[nl])\n nl += 1\n while nr > r:\n nr -= 1\n rem(A[nr])\n # \u7b54\u3092\u6c42\u3081\u3066 ans[i] \u306b\u683c\u7d0d\u3059\u308b\n answers[i] = ans\n return answers\n\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n import numba\n from numba.pycc import CC\n\n i4 = numba.int32\n i8 = numba.int64\n cc = CC(\"my_module\")\n\n def cc_export(f, signature):\n cc.export(f.__name__, signature)(f)\n return numba.njit(f)\n\n Mo_argsort = cc_export(Mo_argsort, (i8[:, :],))\n main = cc_export(main, (i8[:], i8[:, :]))\n cc.compile()\nfrom my_module import main\n\nN, Q = list(map(int, readline().split()))\nA = np.array(readline().split(), np.int64)\nLR = np.array(read().split(), np.int64).reshape(Q, 2)\nans = main(A, LR)\nprint((\"\\n\".join(map(str, ans.tolist()))))\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nBsize = 1000\n\n\ndef Mo_argsort(LR):\n L = LR[:, 0]\n R = LR[:, 1]\n key1 = L \/\/ Bsize\n key2 = np.where(key1 & 1, -R, R)\n key = (key1 << 32) + key2\n return np.argsort(key)\n\n\ndef main(A, LR):\n N = len(A)\n Q = len(LR)\n ind = Mo_argsort(LR)\n count = np.zeros(N + 1, np.int64)\n ans = 0\n\n def add(x):\n nonlocal ans\n if not count[x]:\n ans += 1\n count[x] += 1\n\n def rem(x):\n nonlocal ans\n count[x] -= 1\n if not count[x]:\n ans -= 1\n\n answers = np.empty(Q, np.int64)\n nl, nr = 0, 0\n for i in ind:\n l, r = LR[i]\n l -= 1\n # \u533a\u9593 [l, r) \u306b\u5bfe\u3059\u308b\u8a08\u7b97\n while nl > l:\n nl -= 1\n add(A[nl])\n while nr < r:\n add(A[nr])\n nr += 1\n while nl < l:\n rem(A[nl])\n nl += 1\n while nr > r:\n nr -= 1\n rem(A[nr])\n # \u7b54\u3092\u6c42\u3081\u3066 ans[i] \u306b\u683c\u7d0d\u3059\u308b\n answers[i] = ans\n return answers\n\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n import numba\n from numba.pycc import CC\n\n i4 = numba.int32\n i8 = numba.int64\n cc = CC(\"my_module\")\n\n def cc_export(f, signature):\n cc.export(f.__name__, signature)(f)\n return numba.njit(f)\n\n Mo_argsort = cc_export(Mo_argsort, (i8[:, :],))\n main = cc_export(main, (i8[:], i8[:, :]))\n cc.compile()\nfrom my_module import main\n\nN, Q = list(map(int, readline().split()))\nA = np.array(readline().split(), np.int64)\nLR = np.array(read().split(), np.int64).reshape(Q, 2)\nans = main(A, LR)\nprint((\"\\n\".join(map(str, ans.tolist()))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-Bsize = 700","+Bsize = 1000"],"diff_only_import_comment":false,"measured_runtime_v0":2.3248852704,"measured_runtime_v1":1.8262778948,"runtime_lift":1.2730183489,"key":["s861498168","s937881941"]} +{"user_id":"u064408584","problem_id":"p03723","language":"python","submission_id_v0":"s414644536","submission_id_v1":"s610159769","cpu_time_v0":146,"cpu_time_v1":26,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.19,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b,c=list(map(int, input().split()))\n\nd=0\n\nwhile d<10**5:\n\n if a%2==1 or b%2==1 or c%2==1:break\n\n a,b,c=b\/2+c\/2,a\/2+c\/2,a\/2+b\/2\n\n d+=1\n\nelse:d=-1\n\nprint(d)\n\n# optimized version of the same code:\n","target":"a,b,c=list(map(int, input().split()))\n\nans=0\n\nwhile a%2==0 and b%2==0 and c%2==0 and ans<10000:\n\n a,b,c=b\/\/2+c\/\/2,a\/\/2+c\/\/2,a\/\/2+b\/\/2\n\n ans+=1\n\nif ans==10000:ans=-1\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":159,"code_v1_num_chars":176,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nd = 0\nwhile d < 10**5:\n if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:\n break\n a, b, c = b \/ 2 + c \/ 2, a \/ 2 + c \/ 2, a \/ 2 + b \/ 2\n d += 1\nelse:\n d = -1\nprint(d)\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nans = 0\nwhile a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and ans < 10000:\n a, b, c = b \/\/ 2 + c \/\/ 2, a \/\/ 2 + c \/\/ 2, a \/\/ 2 + b \/\/ 2\n ans += 1\nif ans == 10000:\n ans = -1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-d = 0","-while d < 10**5:","- if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:","- break","- a, b, c = b \/ 2 + c \/ 2, a \/ 2 + c \/ 2, a \/ 2 + b \/ 2","- d += 1","-else:","- d = -1","-print(d)","+ans = 0","+while a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and ans < 10000:","+ a, b, c = b \/\/ 2 + c \/\/ 2, a \/\/ 2 + c \/\/ 2, a \/\/ 2 + b \/\/ 2","+ ans += 1","+if ans == 10000:","+ ans = -1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5153860836,"measured_runtime_v1":0.3941329796,"runtime_lift":1.307645161,"key":["s414644536","s610159769"]} +{"user_id":"u179169725","problem_id":"p03013","language":"python","submission_id_v0":"s062412783","submission_id_v1":"s752380372","cpu_time_v0":334,"cpu_time_v1":193,"memory_v0":19904,"memory_v1":7668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# https:\/\/atcoder.jp\/contests\/abc129\/tasks\/abc129_c\n\n# \u5178\u578b\u7684\u306aDP\n\n\n\nMOD = 10**9 + 7\n\nimport numpy as np\n\n# dp[i]\u3092i\u6bb5\u76ee\u307e\u3067\u306e\u901a\u308a\u306e\u6570\u3068\u3059\u308b\u3002\n\nN, M = list(map(int, input().split()))\n\nto_zero = np.full((N + 1), False).tolist()\n\nfor _ in range(M):\n\n to_zero[int(eval(input()))] = True # \u5e8a\u304c\u629c\u3051\u3066\u3044\u308b\u3068\u3053\u308d\n\n\n\n# dp\u30c6\u30fc\u30d6\u30eb\u306e\u7528\u610f\n\ndp = np.full((N + 1), -1).tolist()\n\ndp[0] = 1\n\ndp[1] = 0 if to_zero[1] else 1\n\nfor i in range(2, N + 1):\n\n dp[i] = 0 if to_zero[i] else dp[i - 2] + dp[i - 1]\n\n if dp[i] > MOD:\n\n dp[i] %= MOD\n\n\n\nprint((dp[-1]))\n\n\n# optimized version of the same code:\n","target":"# https:\/\/atcoder.jp\/contests\/abc129\/tasks\/abc129_c\n\n# \u5178\u578b\u7684\u306aDP\n\n\n\n\n\ndef full(shape, full_value):\n\n if isinstance(shape, tuple):\n\n NotImplementedError()\n\n else:\n\n return [full_value] * shape\n\n\n\n\n\nMOD = 10**9 + 7\n\n# dp[i]\u3092i\u6bb5\u76ee\u307e\u3067\u306e\u901a\u308a\u306e\u6570\u3068\u3059\u308b\u3002\n\nN, M = list(map(int, input().split()))\n\nto_zero = full((N + 1), False)\n\nfor _ in range(M):\n\n to_zero[int(eval(input()))] = True # \u5e8a\u304c\u629c\u3051\u3066\u3044\u308b\u3068\u3053\u308d\n\n\n\n# dp\u30c6\u30fc\u30d6\u30eb\u306e\u7528\u610f\n\ndp = full((N + 1), -1)\n\ndp[0] = 1\n\ndp[1] = 0 if to_zero[1] else 1\n\nfor i in range(2, N + 1):\n\n dp[i] = 0 if to_zero[i] else dp[i - 2] + dp[i - 1]\n\n if dp[i] > MOD:\n\n dp[i] %= MOD\n\n\n\nprint((dp[-1]))\n","code_v0_loc":21,"code_v1_loc":28,"code_v0_num_chars":514,"code_v1_num_chars":619,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc129\/tasks\/abc129_c\n# \u5178\u578b\u7684\u306aDP\nMOD = 10**9 + 7\nimport numpy as np\n\n# dp[i]\u3092i\u6bb5\u76ee\u307e\u3067\u306e\u901a\u308a\u306e\u6570\u3068\u3059\u308b\u3002\nN, M = list(map(int, input().split()))\nto_zero = np.full((N + 1), False).tolist()\nfor _ in range(M):\n to_zero[int(eval(input()))] = True # \u5e8a\u304c\u629c\u3051\u3066\u3044\u308b\u3068\u3053\u308d\n# dp\u30c6\u30fc\u30d6\u30eb\u306e\u7528\u610f\ndp = np.full((N + 1), -1).tolist()\ndp[0] = 1\ndp[1] = 0 if to_zero[1] else 1\nfor i in range(2, N + 1):\n dp[i] = 0 if to_zero[i] else dp[i - 2] + dp[i - 1]\n if dp[i] > MOD:\n dp[i] %= MOD\nprint((dp[-1]))\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc129\/tasks\/abc129_c\n# \u5178\u578b\u7684\u306aDP\ndef full(shape, full_value):\n if isinstance(shape, tuple):\n NotImplementedError()\n else:\n return [full_value] * shape\n\n\nMOD = 10**9 + 7\n# dp[i]\u3092i\u6bb5\u76ee\u307e\u3067\u306e\u901a\u308a\u306e\u6570\u3068\u3059\u308b\u3002\nN, M = list(map(int, input().split()))\nto_zero = full((N + 1), False)\nfor _ in range(M):\n to_zero[int(eval(input()))] = True # \u5e8a\u304c\u629c\u3051\u3066\u3044\u308b\u3068\u3053\u308d\n# dp\u30c6\u30fc\u30d6\u30eb\u306e\u7528\u610f\ndp = full((N + 1), -1)\ndp[0] = 1\ndp[1] = 0 if to_zero[1] else 1\nfor i in range(2, N + 1):\n dp[i] = 0 if to_zero[i] else dp[i - 2] + dp[i - 1]\n if dp[i] > MOD:\n dp[i] %= MOD\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["+def full(shape, full_value):","+ if isinstance(shape, tuple):","+ NotImplementedError()","+ else:","+ return [full_value] * shape","+","+","-import numpy as np","-","-to_zero = np.full((N + 1), False).tolist()","+to_zero = full((N + 1), False)","-dp = np.full((N + 1), -1).tolist()","+dp = full((N + 1), -1)"],"diff_only_import_comment":false,"measured_runtime_v0":1.3572561545,"measured_runtime_v1":0.1989456849,"runtime_lift":6.8222447503,"key":["s062412783","s752380372"]} +{"user_id":"u341087021","problem_id":"p03720","language":"python","submission_id_v0":"s071290860","submission_id_v1":"s320305187","cpu_time_v0":316,"cpu_time_v1":17,"memory_v0":21660,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\nn,m = [int(x) for x in sys.stdin.readline().split()]\n\nr = np.zeros(n)\n\nfor i in range(m):\n\n\ta, b = [int(x) for x in sys.stdin.readline().split()]\n\n\tr[a-1] += 1\n\n\tr[b-1] += 1\n\nfor i in range(n):\n\n\tprint((int(r[i])))\n\n# optimized version of the same code:\n","target":"import sys\n\nn,m = [int(x) for x in sys.stdin.readline().split()]\n\nr = [0]*n\n\nfor _ in range(m):\n\n\ta, b = [int(x) for x in sys.stdin.readline().split()]\n\n\tr[a-1] += 1\n\n\tr[b-1] += 1\n\nfor i in r:\n\n\tprint(i)","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":244,"code_v1_num_chars":203,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nn, m = [int(x) for x in sys.stdin.readline().split()]\nr = np.zeros(n)\nfor i in range(m):\n a, b = [int(x) for x in sys.stdin.readline().split()]\n r[a - 1] += 1\n r[b - 1] += 1\nfor i in range(n):\n print((int(r[i])))\n","code_v1_no_empty_lines":"import sys\n\nn, m = [int(x) for x in sys.stdin.readline().split()]\nr = [0] * n\nfor _ in range(m):\n a, b = [int(x) for x in sys.stdin.readline().split()]\n r[a - 1] += 1\n r[b - 1] += 1\nfor i in r:\n print(i)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-import numpy as np","-r = np.zeros(n)","-for i in range(m):","+r = [0] * n","+for _ in range(m):","-for i in range(n):","- print((int(r[i])))","+for i in r:","+ print(i)"],"diff_only_import_comment":false,"measured_runtime_v0":1.5877735901,"measured_runtime_v1":0.2398138795,"runtime_lift":6.620857781,"key":["s071290860","s320305187"]} +{"user_id":"u285443936","problem_id":"p03309","language":"python","submission_id_v0":"s057200482","submission_id_v1":"s045600813","cpu_time_v0":246,"cpu_time_v1":216,"memory_v0":27232,"memory_v1":25200,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.2,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport statistics\n\nN = int(eval(input()))\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in range(1,N+1):\n\n a[i-1] -= i\n\n\n\nb = statistics.median(a)\n\nfor i in range(N):\n\n ans += abs(a[i]-b)\n\nprint((int(ans)))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nC = [A[i]-i for i in range(N)]\n\nC.sort()\n\nans = 0\n\nmed = C[N\/\/2]\n\nfor i in range(N):\n\n ans += abs(C[i]-med)\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":9,"code_v0_num_chars":211,"code_v1_num_chars":177,"code_v0_no_empty_lines":"import statistics\n\nN = int(eval(input()))\na = [int(i) for i in input().split()]\nans = 0\nfor i in range(1, N + 1):\n a[i - 1] -= i\nb = statistics.median(a)\nfor i in range(N):\n ans += abs(a[i] - b)\nprint((int(ans)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(i) for i in input().split()]\nC = [A[i] - i for i in range(N)]\nC.sort()\nans = 0\nmed = C[N \/\/ 2]\nfor i in range(N):\n ans += abs(C[i] - med)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import statistics","-","-a = [int(i) for i in input().split()]","+A = [int(i) for i in input().split()]","+C = [A[i] - i for i in range(N)]","+C.sort()","-for i in range(1, N + 1):","- a[i - 1] -= i","-b = statistics.median(a)","+med = C[N \/\/ 2]","- ans += abs(a[i] - b)","-print((int(ans)))","+ ans += abs(C[i] - med)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2933883266,"measured_runtime_v1":0.2086455548,"runtime_lift":1.406156613,"key":["s057200482","s045600813"]} +{"user_id":"u652583512","problem_id":"p03078","language":"python","submission_id_v0":"s221829319","submission_id_v1":"s354836218","cpu_time_v0":342,"cpu_time_v1":121,"memory_v0":19068,"memory_v1":8728,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = np.array([int(i) for i in input().split()])\n\nB = np.array([int(i) for i in input().split()])\n\nC =np.array([int(i) for i in input().split()])\n\nA = -np.sort(-A) #\u8981\u30c1\u30a7\u30c3\u30af\u3084\n\nB = -np.sort(-B)\n\nC = -np.sort(-C)\n\nD = []\n\nfor i in range(min(K, X)):\n\n for j in range(min(K, Y)):\n\n if (i + 1) * (j + 1) > K:\n\n break\n\n for k in range(min(K, Z)):\n\n if (i + 1) * (j + 1) * (k + 1) > K:\n\n break\n\n else:\n\n\n\n D.append(A[i] + B[j] + C[k])\n\n\n\nX = np.array(D)\n\nX = -np.sort(-X)\n\nfor i in range(K):\n\n print((X[i]))\n\n# optimized version of the same code:\n","target":"X, Y, Z, K = list(map(int, input().split()))\n\nA = sorted([int(i) for i in input().split()], reverse=True)\n\nB = sorted([int(i) for i in input().split()], reverse=True)\n\nC = sorted([int(i) for i in input().split()], reverse=True)\n\nD = []\n\nfor i in range(min(K, X)):\n\n for j in range(min(K, Y)):\n\n if (i + 1) * (j + 1) > K:\n\n break\n\n for k in range(min(K, Z)):\n\n if (i + 1) * (j + 1) * (k + 1) > K:\n\n break\n\n else:\n\n\n\n D.append(A[i] + B[j] + C[k])\n\n\n\nD.sort(reverse=True)\n\nfor i in range(K):\n\n print((D[i]))","code_v0_loc":25,"code_v1_loc":19,"code_v0_num_chars":639,"code_v1_num_chars":579,"code_v0_no_empty_lines":"import numpy as np\n\nX, Y, Z, K = list(map(int, input().split()))\nA = np.array([int(i) for i in input().split()])\nB = np.array([int(i) for i in input().split()])\nC = np.array([int(i) for i in input().split()])\nA = -np.sort(-A) # \u8981\u30c1\u30a7\u30c3\u30af\u3084\nB = -np.sort(-B)\nC = -np.sort(-C)\nD = []\nfor i in range(min(K, X)):\n for j in range(min(K, Y)):\n if (i + 1) * (j + 1) > K:\n break\n for k in range(min(K, Z)):\n if (i + 1) * (j + 1) * (k + 1) > K:\n break\n else:\n D.append(A[i] + B[j] + C[k])\nX = np.array(D)\nX = -np.sort(-X)\nfor i in range(K):\n print((X[i]))\n","code_v1_no_empty_lines":"X, Y, Z, K = list(map(int, input().split()))\nA = sorted([int(i) for i in input().split()], reverse=True)\nB = sorted([int(i) for i in input().split()], reverse=True)\nC = sorted([int(i) for i in input().split()], reverse=True)\nD = []\nfor i in range(min(K, X)):\n for j in range(min(K, Y)):\n if (i + 1) * (j + 1) > K:\n break\n for k in range(min(K, Z)):\n if (i + 1) * (j + 1) * (k + 1) > K:\n break\n else:\n D.append(A[i] + B[j] + C[k])\nD.sort(reverse=True)\nfor i in range(K):\n print((D[i]))\n","code_same":false,"relative_loc_diff_percent":24.0,"diff":["-import numpy as np","-","-A = np.array([int(i) for i in input().split()])","-B = np.array([int(i) for i in input().split()])","-C = np.array([int(i) for i in input().split()])","-A = -np.sort(-A) # \u8981\u30c1\u30a7\u30c3\u30af\u3084","-B = -np.sort(-B)","-C = -np.sort(-C)","+A = sorted([int(i) for i in input().split()], reverse=True)","+B = sorted([int(i) for i in input().split()], reverse=True)","+C = sorted([int(i) for i in input().split()], reverse=True)","-X = np.array(D)","-X = -np.sort(-X)","+D.sort(reverse=True)","- print((X[i]))","+ print((D[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3790917091,"measured_runtime_v1":0.1937455821,"runtime_lift":7.1180549982,"key":["s221829319","s354836218"]} +{"user_id":"u479719434","problem_id":"p02665","language":"python","submission_id_v0":"s890279539","submission_id_v1":"s923250526","cpu_time_v0":175,"cpu_time_v1":149,"memory_v0":26380,"memory_v1":22304,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nleaves = list(map(int, input().split()))\n\n\n\nans = 0\n\nnodes_min = [0] * (n + 1)\n\nnodes_max = [0] * (n + 1)\n\nnodes_min[n] = leaves[n]\n\nnodes_max[n] = leaves[n]\n\n\n\nfor depth in range(n, 0, -1):\n\n root_min = nodes_min[depth] \/\/ 2 + nodes_min[depth] % 2\n\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n\n root_max = nodes_max[depth]\n\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\n\nnodes = [0] * (n + 1)\n\nnodes[0] = 1\n\nif nodes[0] < nodes_min[0]:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n roots = nodes[depth]-leaves[depth]\n\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n\n if nodes[depth+1] < nodes_min[depth+1]:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(nodes)))\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nleaves = list(map(int, input().split()))\n\n\n\nsum_leaves = [0]*(n+1)\n\nsum_leaves[0] = leaves[0]\n\nfor depth in range(n):\n\n sum_leaves[depth+1] = sum_leaves[depth] + leaves[depth+1]\n\n\n\nans = 0\n\n\n\nroot = [None] * (n + 1)\n\nif n == 0:\n\n root[0] = 0\n\nelse:\n\n root[0] = 1\n\nif root[0] + leaves[0] != 1:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n root[depth+1] = min(2*root[depth]-leaves[depth+1],\n\n sum_leaves[n]-sum_leaves[depth+1])\n\n if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth+1] < 0:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(root)+sum(leaves)))\n","code_v0_loc":27,"code_v1_loc":26,"code_v0_num_chars":771,"code_v1_num_chars":669,"code_v0_no_empty_lines":"n = int(eval(input()))\nleaves = list(map(int, input().split()))\nans = 0\nnodes_min = [0] * (n + 1)\nnodes_max = [0] * (n + 1)\nnodes_min[n] = leaves[n]\nnodes_max[n] = leaves[n]\nfor depth in range(n, 0, -1):\n root_min = nodes_min[depth] \/\/ 2 + nodes_min[depth] % 2\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n root_max = nodes_max[depth]\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\nnodes = [0] * (n + 1)\nnodes[0] = 1\nif nodes[0] < nodes_min[0]:\n print((-1))\nelse:\n for depth in range(n):\n roots = nodes[depth] - leaves[depth]\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n if nodes[depth + 1] < nodes_min[depth + 1]:\n print((-1))\n break\n else:\n print((sum(nodes)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nleaves = list(map(int, input().split()))\nsum_leaves = [0] * (n + 1)\nsum_leaves[0] = leaves[0]\nfor depth in range(n):\n sum_leaves[depth + 1] = sum_leaves[depth] + leaves[depth + 1]\nans = 0\nroot = [None] * (n + 1)\nif n == 0:\n root[0] = 0\nelse:\n root[0] = 1\nif root[0] + leaves[0] != 1:\n print((-1))\nelse:\n for depth in range(n):\n root[depth + 1] = min(\n 2 * root[depth] - leaves[depth + 1], sum_leaves[n] - sum_leaves[depth + 1]\n )\n if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth + 1] < 0:\n print((-1))\n break\n else:\n print((sum(root) + sum(leaves)))\n","code_same":false,"relative_loc_diff_percent":3.7037037037,"diff":["+sum_leaves = [0] * (n + 1)","+sum_leaves[0] = leaves[0]","+for depth in range(n):","+ sum_leaves[depth + 1] = sum_leaves[depth] + leaves[depth + 1]","-nodes_min = [0] * (n + 1)","-nodes_max = [0] * (n + 1)","-nodes_min[n] = leaves[n]","-nodes_max[n] = leaves[n]","-for depth in range(n, 0, -1):","- root_min = nodes_min[depth] \/\/ 2 + nodes_min[depth] % 2","- nodes_min[depth - 1] = leaves[depth - 1] + root_min","- root_max = nodes_max[depth]","- nodes_max[depth - 1] = leaves[depth - 1] + root_max","-nodes = [0] * (n + 1)","-nodes[0] = 1","-if nodes[0] < nodes_min[0]:","+root = [None] * (n + 1)","+if n == 0:","+ root[0] = 0","+else:","+ root[0] = 1","+if root[0] + leaves[0] != 1:","- roots = nodes[depth] - leaves[depth]","- nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])","- if nodes[depth + 1] < nodes_min[depth + 1]:","+ root[depth + 1] = min(","+ 2 * root[depth] - leaves[depth + 1], sum_leaves[n] - sum_leaves[depth + 1]","+ )","+ if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth + 1] < 0:","- print((sum(nodes)))","+ print((sum(root) + sum(leaves)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.455775662,"measured_runtime_v1":0.2425963848,"runtime_lift":1.8787405363,"key":["s890279539","s923250526"]} +{"user_id":"u440985596","problem_id":"p03013","language":"python","submission_id_v0":"s706783355","submission_id_v1":"s449961507","cpu_time_v0":252,"cpu_time_v1":161,"memory_v0":20632,"memory_v1":7848,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\ndef cmb(n, r, mod, g1, g2):\n\n if ( r<0 or r>n ):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n A = [-1] + [int(eval(input())) for i in range(M)] + [N + 1]\n\n\n\n mod = 10**9+7 #\u51fa\u529b\u306e\u5236\u9650\n\n N = 10**5\n\n g1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\n g2 = [1, 1] #\u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\n inverse = [0, 1] #\u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n for i in range( 2, N + 1 ):\n\n g1.append( ( g1[-1] * i ) % mod )\n\n inverse.append( ( -inverse[mod % i] * (mod\/\/i) ) % mod )\n\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\n\n\n d = [0] * (len(A) - 1)\n\n for i in range(len(A) - 1):\n\n if A[i+1] - A[i] == 1:\n\n print((0))\n\n exit(0)\n\n d[i] = A[i+1] - 1 - (A[i] + 1)\n\n\n\n ans = 1\n\n for dd in d:\n\n if dd > 1:\n\n tmp = 0\n\n for j in range(dd\/\/2 + 1):\n\n tmp += cmb(dd - j, j, mod, g1, g2)\n\n ans *= tmp\n\n\n\n print((ans % 1000000007))\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n N, M = list(map(int, input().split()))\n\n A = [int(eval(input())) for i in range(M)] + [0]\n\n\n\n a = 0\n\n b = 1\n\n j = 0\n\n tmp = 0\n\n if N == 1:\n\n print((1))\n\n else:\n\n for i in range(1, N + 1):\n\n if A[j] == i:\n\n if tmp == 1:\n\n print((0))\n\n exit()\n\n tmp = 1\n\n j += 1\n\n a = 0\n\n else:\n\n if tmp == 1:\n\n b = a + b\n\n a = 0\n\n else:\n\n c = a + b\n\n a = b\n\n b = c\n\n tmp = 0\n\n print((b % 1000000007))\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":40,"code_v1_loc":32,"code_v0_num_chars":1022,"code_v1_num_chars":726,"code_v0_no_empty_lines":"import math\n\n\ndef cmb(n, r, mod, g1, g2):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\ndef main():\n N, M = list(map(int, input().split()))\n A = [-1] + [int(eval(input())) for i in range(M)] + [N + 1]\n mod = 10**9 + 7 # \u51fa\u529b\u306e\u5236\u9650\n N = 10**5\n g1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n g2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n inverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n for i in range(2, N + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\n d = [0] * (len(A) - 1)\n for i in range(len(A) - 1):\n if A[i + 1] - A[i] == 1:\n print((0))\n exit(0)\n d[i] = A[i + 1] - 1 - (A[i] + 1)\n ans = 1\n for dd in d:\n if dd > 1:\n tmp = 0\n for j in range(dd \/\/ 2 + 1):\n tmp += cmb(dd - j, j, mod, g1, g2)\n ans *= tmp\n print((ans % 1000000007))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N, M = list(map(int, input().split()))\n A = [int(eval(input())) for i in range(M)] + [0]\n a = 0\n b = 1\n j = 0\n tmp = 0\n if N == 1:\n print((1))\n else:\n for i in range(1, N + 1):\n if A[j] == i:\n if tmp == 1:\n print((0))\n exit()\n tmp = 1\n j += 1\n a = 0\n else:\n if tmp == 1:\n b = a + b\n a = 0\n else:\n c = a + b\n a = b\n b = c\n tmp = 0\n print((b % 1000000007))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import math","-","-","-def cmb(n, r, mod, g1, g2):","- if r < 0 or r > n:","- return 0","- r = min(r, n - r)","- return g1[n] * g2[r] * g2[n - r] % mod","-","-","- A = [-1] + [int(eval(input())) for i in range(M)] + [N + 1]","- mod = 10**9 + 7 # \u51fa\u529b\u306e\u5236\u9650","- N = 10**5","- g1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb","- g2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb","- inverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb","- for i in range(2, N + 1):","- g1.append((g1[-1] * i) % mod)","- inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)","- g2.append((g2[-1] * inverse[-1]) % mod)","- d = [0] * (len(A) - 1)","- for i in range(len(A) - 1):","- if A[i + 1] - A[i] == 1:","- print((0))","- exit(0)","- d[i] = A[i + 1] - 1 - (A[i] + 1)","- ans = 1","- for dd in d:","- if dd > 1:","- tmp = 0","- for j in range(dd \/\/ 2 + 1):","- tmp += cmb(dd - j, j, mod, g1, g2)","- ans *= tmp","- print((ans % 1000000007))","+ A = [int(eval(input())) for i in range(M)] + [0]","+ a = 0","+ b = 1","+ j = 0","+ tmp = 0","+ if N == 1:","+ print((1))","+ else:","+ for i in range(1, N + 1):","+ if A[j] == i:","+ if tmp == 1:","+ print((0))","+ exit()","+ tmp = 1","+ j += 1","+ a = 0","+ else:","+ if tmp == 1:","+ b = a + b","+ a = 0","+ else:","+ c = a + b","+ a = b","+ b = c","+ tmp = 0","+ print((b % 1000000007))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4844854877,"measured_runtime_v1":0.2640559788,"runtime_lift":5.621859026,"key":["s706783355","s449961507"]} +{"user_id":"u060896757","problem_id":"p02691","language":"python","submission_id_v0":"s720467562","submission_id_v1":"s807450341","cpu_time_v0":266,"cpu_time_v1":106,"memory_v0":97968,"memory_v1":92728,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.15,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\ndp = [0] * 10 ** 7\n\nans = 0\n\nfor i in range(N):\n\n x = i + 1 - A[i]\n\n if x >= 0:\n\n ans += dp[x]\n\n y = i + 1 + A[i]\n\n if y < 10 ** 7:\n\n dp[y] += 1\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nINF = 2 * 10 ** 5\n\ndp = [0] * INF\n\nans = 0\n\nfor i in range(N):\n\n i_i_ = i + 1 - A[i]\n\n if 0 < i_i_ < INF:\n\n ans += dp[i_i_]\n\n i_ = i + 1 + A[i]\n\n if 0 < i_ < INF:\n\n dp[i_] += 1\n\n\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":14,"code_v0_num_chars":242,"code_v1_num_chars":273,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [int(i) for i in input().split()]\ndp = [0] * 10**7\nans = 0\nfor i in range(N):\n x = i + 1 - A[i]\n if x >= 0:\n ans += dp[x]\n y = i + 1 + A[i]\n if y < 10**7:\n dp[y] += 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(i) for i in input().split()]\nINF = 2 * 10**5\ndp = [0] * INF\nans = 0\nfor i in range(N):\n i_i_ = i + 1 - A[i]\n if 0 < i_i_ < INF:\n ans += dp[i_i_]\n i_ = i + 1 + A[i]\n if 0 < i_ < INF:\n dp[i_] += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-dp = [0] * 10**7","+INF = 2 * 10**5","+dp = [0] * INF","- x = i + 1 - A[i]","- if x >= 0:","- ans += dp[x]","- y = i + 1 + A[i]","- if y < 10**7:","- dp[y] += 1","+ i_i_ = i + 1 - A[i]","+ if 0 < i_i_ < INF:","+ ans += dp[i_i_]","+ i_ = i + 1 + A[i]","+ if 0 < i_ < INF:","+ dp[i_] += 1"],"diff_only_import_comment":false,"measured_runtime_v0":1.4942608066,"measured_runtime_v1":0.2557353399,"runtime_lift":5.8429969327,"key":["s720467562","s807450341"]} +{"user_id":"u657913472","problem_id":"p03544","language":"python","submission_id_v0":"s581568984","submission_id_v1":"s775677409","cpu_time_v0":17,"cpu_time_v1":10,"memory_v0":2940,"memory_v1":2568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.18,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b=2,1\n\nfor i in[0]*int(eval(input())):a,b=b,a+b\n\nprint(a)\n\n# optimized version of the same code:\n","target":"a,b=2,1\n\nfor i in[0]*eval(input()):a,b=b,a+b\n\nprint(a)","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":53,"code_v1_num_chars":47,"code_v0_no_empty_lines":"a, b = 2, 1\nfor i in [0] * int(eval(input())):\n a, b = b, a + b\nprint(a)\n","code_v1_no_empty_lines":"a, b = 2, 1\nfor i in [0] * eval(input()):\n a, b = b, a + b\nprint(a)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in [0] * int(eval(input())):","+for i in [0] * eval(input()):"],"diff_only_import_comment":false,"measured_runtime_v0":0.2172925947,"measured_runtime_v1":0.0059480793,"runtime_lift":36.5315560885,"key":["s581568984","s775677409"]} +{"user_id":"u880730787","problem_id":"p02555","language":"python","submission_id_v0":"s669686668","submission_id_v1":"s427616795","cpu_time_v0":487,"cpu_time_v1":297,"memory_v0":9116,"memory_v1":9128,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.01,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = int(eval(input()))\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))\n\n# optimized version of the same code:\n","target":"S = int(eval(input()))\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":176,"code_v1_num_chars":172,"code_v0_no_empty_lines":"S = int(eval(input()))\nmod = 10**9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\nfor i in range(1, S + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\nprint((dp[S]))\n","code_v1_no_empty_lines":"S = int(eval(input()))\nmod = 10**9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\nfor i in range(1, S + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\nprint((dp[S]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dp[i] %= mod","+ dp[i] %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.6781705019,"measured_runtime_v1":0.481741133,"runtime_lift":1.4077488002,"key":["s669686668","s427616795"]} +{"user_id":"u733814820","problem_id":"p03107","language":"python","submission_id_v0":"s607050481","submission_id_v1":"s627055692","cpu_time_v0":41,"cpu_time_v1":35,"memory_v0":3316,"memory_v1":3956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.63,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# ABC 120 C\n\n\n\nimport re\n\n\n\nS = eval(input())\n\n\n\nl0 = 0\n\nl1 = 0\n\n\n\nfor i in range(len(S)):\n\n if S[i] == '0':\n\n l0 += 1\n\n elif S[i] == '1':\n\n l1 += 1\n\n\n\nprint((min(l0, l1) * 2))\n\n\n# optimized version of the same code:\n","target":"def resolve():\n\n S = eval(input())\n\n arr = []\n\n for s in S:\n\n if len(arr) != 0 and arr[-1] != s:\n\n arr.pop()\n\n else:\n\n arr.append(s)\n\n\n\n print((len(S) - len(arr)))\n\n return\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":189,"code_v1_num_chars":229,"code_v0_no_empty_lines":"# ABC 120 C\nimport re\n\nS = eval(input())\nl0 = 0\nl1 = 0\nfor i in range(len(S)):\n if S[i] == \"0\":\n l0 += 1\n elif S[i] == \"1\":\n l1 += 1\nprint((min(l0, l1) * 2))\n","code_v1_no_empty_lines":"def resolve():\n S = eval(input())\n arr = []\n for s in S:\n if len(arr) != 0 and arr[-1] != s:\n arr.pop()\n else:\n arr.append(s)\n print((len(S) - len(arr)))\n return\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-# ABC 120 C","-import re","+def resolve():","+ S = eval(input())","+ arr = []","+ for s in S:","+ if len(arr) != 0 and arr[-1] != s:","+ arr.pop()","+ else:","+ arr.append(s)","+ print((len(S) - len(arr)))","+ return","-S = eval(input())","-l0 = 0","-l1 = 0","-for i in range(len(S)):","- if S[i] == \"0\":","- l0 += 1","- elif S[i] == \"1\":","- l1 += 1","-print((min(l0, l1) * 2))","+","+if __name__ == \"__main__\":","+ resolve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.4207458491,"measured_runtime_v1":0.3073607309,"runtime_lift":1.3688991691,"key":["s607050481","s627055692"]} +{"user_id":"u811733736","problem_id":"p00106","language":"python","submission_id_v0":"s822597744","submission_id_v1":"s769405427","cpu_time_v0":2250,"cpu_time_v1":40,"memory_v0":7564,"memory_v1":7920,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":98.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\"\"\"\n\nhttp:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=0106&lang=jp\n\n\"\"\"\n\nimport sys\n\n\n\n\n\ndef solve(amount):\n\n \"\"\"\n\n :param amount: ?????\\???????????\u00b0?????????\n\n :return: ?????????\n\n \"\"\"\n\n best_price = (amount + 199) \/\/ 200 * 380\n\n for a in range(amount \/\/ 200 + 1):\n\n for b in range(amount \/\/ 300 + 1):\n\n for c in range(amount \/\/ 500 + 1):\n\n for a1 in range(amount \/\/ 1000 + 1):\n\n for b1 in range(amount \/\/ 1200 + 1):\n\n for c1 in range(amount \/\/ 1500 + 1):\n\n if a*200 + b*300 + c*500 + a1*1000 + b1*1200 + c1*1500 == amount:\n\n price = a*380 + b*550 + c*850 + a1*1520 + b1*1870 + c1*2244\n\n if price < best_price:\n\n best_price = price\n\n return best_price\n\n\n\n\n\n\n\n\n\ndef main(args):\n\n while True:\n\n amount = int(eval(input()))\n\n if amount == 0:\n\n break\n\n result = solve(amount)\n\n print(result)\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main(sys.argv[1:])\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nhttp:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=0106&lang=jp\n\n\"\"\"\n\nimport sys\n\n\n\n\n\ndef solve(amount):\n\n \"\"\"\n\n :param amount: ?????\\???????????\u00b0?????????\n\n :return: ?????????\n\n \"\"\"\n\n best_price = (amount + 199) \/\/ 200 * 380\n\n for a in range(amount \/\/ 200 + 1):\n\n for b in range(amount \/\/ 300 + 1):\n\n for c in range(amount \/\/ 500 + 1):\n\n for a1 in range(amount \/\/ 1000 + 1):\n\n for b1 in range(amount \/\/ 1200 + 1):\n\n for c1 in range(amount \/\/ 1500 + 1):\n\n if a*200 + b*300 + c*500 + a1*1000 + b1*1200 + c1*1500 == amount:\n\n price = a*380 + b*550 + c*850 + a1*1520 + b1*1870 + c1*2244\n\n if price < best_price:\n\n best_price = price\n\n return best_price\n\n\n\n\n\ndef solve2(amount):\n\n \"\"\"\n\n ???????\u00a8???????????????\u00a8?????????????????\u00a7???\n\n \"\"\"\n\n packages = [(0, 0), (2, 380), (3, 550), (5, 850), (10, 1520), (12, 1870), (15, 2244)] # 1?\u00a2??????????(100g??????)??\u00a8??????????????\u00a2l\n\n # dp??\u00a8???2?\u00ac??????????????\u00a8?????????????(100g??????)?????????????????\u00a8??\u00a7??????packages????\u00a8????\n\n # 999999...??????INF??\u00a8?????? (phthon 3.5??\\??????????????????math.inf????????\u00a8??\u00a7??????)\n\n cart = [[99999999] * (amount\/\/100 + 1) for _ in range(len(packages))]\n\n for i in range(len(packages)):\n\n cart[i][0] = 0 # 0g???????????\\????????\u00b4??????0???????????????\n\n\n\n for i in range(1, len(packages)):\n\n for j in range(1, len(cart[0])):\n\n w = packages[i][0] # ??????\n\n p = packages[i][1] # ??????\n\n if j < w:\n\n cart[i][j] = cart[i-1][j]\n\n else:\n\n # ???????????????????????????????????????????????????????????????????????????????\u00a8????\n\n cart[i][j] = min(cart[i-1][j], cart[i-1][max(0, j-w)]+p, cart[i][max(0, j-w)]+p)\n\n return cart[-1][-1]\n\n\n\n\n\ndef main(args):\n\n while True:\n\n amount = int(eval(input()))\n\n if amount == 0:\n\n break\n\n #result = solve(amount)\n\n #print(result)\n\n result = solve2(amount)\n\n print(result)\n\n\n\n\n\nif __name__ == '__main__':\n\n main(sys.argv[1:])","code_v0_loc":40,"code_v1_loc":62,"code_v0_num_chars":1135,"code_v1_num_chars":2291,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nhttp:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=0106&lang=jp\n\"\"\"\nimport sys\n\n\ndef solve(amount):\n \"\"\"\n :param amount: ?????\\???????????\u00b0?????????\n :return: ?????????\n \"\"\"\n best_price = (amount + 199) \/\/ 200 * 380\n for a in range(amount \/\/ 200 + 1):\n for b in range(amount \/\/ 300 + 1):\n for c in range(amount \/\/ 500 + 1):\n for a1 in range(amount \/\/ 1000 + 1):\n for b1 in range(amount \/\/ 1200 + 1):\n for c1 in range(amount \/\/ 1500 + 1):\n if (\n a * 200\n + b * 300\n + c * 500\n + a1 * 1000\n + b1 * 1200\n + c1 * 1500\n == amount\n ):\n price = (\n a * 380\n + b * 550\n + c * 850\n + a1 * 1520\n + b1 * 1870\n + c1 * 2244\n )\n if price < best_price:\n best_price = price\n return best_price\n\n\ndef main(args):\n while True:\n amount = int(eval(input()))\n if amount == 0:\n break\n result = solve(amount)\n print(result)\n\n\nif __name__ == \"__main__\":\n main(sys.argv[1:])\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nhttp:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=0106&lang=jp\n\"\"\"\nimport sys\n\n\ndef solve(amount):\n \"\"\"\n :param amount: ?????\\???????????\u00b0?????????\n :return: ?????????\n \"\"\"\n best_price = (amount + 199) \/\/ 200 * 380\n for a in range(amount \/\/ 200 + 1):\n for b in range(amount \/\/ 300 + 1):\n for c in range(amount \/\/ 500 + 1):\n for a1 in range(amount \/\/ 1000 + 1):\n for b1 in range(amount \/\/ 1200 + 1):\n for c1 in range(amount \/\/ 1500 + 1):\n if (\n a * 200\n + b * 300\n + c * 500\n + a1 * 1000\n + b1 * 1200\n + c1 * 1500\n == amount\n ):\n price = (\n a * 380\n + b * 550\n + c * 850\n + a1 * 1520\n + b1 * 1870\n + c1 * 2244\n )\n if price < best_price:\n best_price = price\n return best_price\n\n\ndef solve2(amount):\n \"\"\"\n ???????\u00a8???????????????\u00a8?????????????????\u00a7???\n \"\"\"\n packages = [\n (0, 0),\n (2, 380),\n (3, 550),\n (5, 850),\n (10, 1520),\n (12, 1870),\n (15, 2244),\n ] # 1?\u00a2??????????(100g??????)??\u00a8??????????????\u00a2l\n # dp??\u00a8???2?\u00ac??????????????\u00a8?????????????(100g??????)?????????????????\u00a8??\u00a7??????packages????\u00a8????\n # 999999...??????INF??\u00a8?????? (phthon 3.5??\\??????????????????math.inf????????\u00a8??\u00a7??????)\n cart = [[99999999] * (amount \/\/ 100 + 1) for _ in range(len(packages))]\n for i in range(len(packages)):\n cart[i][0] = 0 # 0g???????????\\????????\u00b4??????0???????????????\n for i in range(1, len(packages)):\n for j in range(1, len(cart[0])):\n w = packages[i][0] # ??????\n p = packages[i][1] # ??????\n if j < w:\n cart[i][j] = cart[i - 1][j]\n else:\n # ???????????????????????????????????????????????????????????????????????????????\u00a8????\n cart[i][j] = min(\n cart[i - 1][j],\n cart[i - 1][max(0, j - w)] + p,\n cart[i][max(0, j - w)] + p,\n )\n return cart[-1][-1]\n\n\ndef main(args):\n while True:\n amount = int(eval(input()))\n if amount == 0:\n break\n # result = solve(amount)\n # print(result)\n result = solve2(amount)\n print(result)\n\n\nif __name__ == \"__main__\":\n main(sys.argv[1:])\n","code_same":false,"relative_loc_diff_percent":35.4838709677,"diff":["+def solve2(amount):","+ \"\"\"","+ ???????\u00a8???????????????\u00a8?????????????????\u00a7???","+ \"\"\"","+ packages = [","+ (0, 0),","+ (2, 380),","+ (3, 550),","+ (5, 850),","+ (10, 1520),","+ (12, 1870),","+ (15, 2244),","+ ] # 1?\u00a2??????????(100g??????)??\u00a8??????????????\u00a2l","+ # dp??\u00a8???2?\u00ac??????????????\u00a8?????????????(100g??????)?????????????????\u00a8??\u00a7??????packages????\u00a8????","+ # 999999...??????INF??\u00a8?????? (phthon 3.5??\\??????????????????math.inf????????\u00a8??\u00a7??????)","+ cart = [[99999999] * (amount \/\/ 100 + 1) for _ in range(len(packages))]","+ for i in range(len(packages)):","+ cart[i][0] = 0 # 0g???????????\\????????\u00b4??????0???????????????","+ for i in range(1, len(packages)):","+ for j in range(1, len(cart[0])):","+ w = packages[i][0] # ??????","+ p = packages[i][1] # ??????","+ if j < w:","+ cart[i][j] = cart[i - 1][j]","+ else:","+ # ???????????????????????????????????????????????????????????????????????????????\u00a8????","+ cart[i][j] = min(","+ cart[i - 1][j],","+ cart[i - 1][max(0, j - w)] + p,","+ cart[i][max(0, j - w)] + p,","+ )","+ return cart[-1][-1]","+","+","- result = solve(amount)","+ # result = solve(amount)","+ # print(result)","+ result = solve2(amount)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3584752986,"measured_runtime_v1":0.2651723213,"runtime_lift":1.3518579045,"key":["s822597744","s769405427"]} +{"user_id":"u075304271","problem_id":"p02657","language":"python","submission_id_v0":"s027336468","submission_id_v1":"s218994202","cpu_time_v0":65,"cpu_time_v1":22,"memory_v0":61680,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.15,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef iput(): return int(eval(input()))\n\ndef mput(): return list(map(int, input().split()))\n\ndef lput(): return list(map(int, input().split()))\n\n\n\ndef solve():\n\n a, b = mput()\n\n print((a*b))\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()\n\n# optimized version of the same code:\n","target":"import math\n\ndef solve():\n\n a, b = input().split()\n\n a = int(a)\n\n b = float(b)\n\n print((int(a*b)))\n\n return 0\n\n \n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":237,"code_v1_num_chars":166,"code_v0_no_empty_lines":"def iput():\n return int(eval(input()))\n\n\ndef mput():\n return list(map(int, input().split()))\n\n\ndef lput():\n return list(map(int, input().split()))\n\n\ndef solve():\n a, b = mput()\n print((a * b))\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import math\n\n\ndef solve():\n a, b = input().split()\n a = int(a)\n b = float(b)\n print((int(a * b)))\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-def iput():","- return int(eval(input()))","-","-","-def mput():","- return list(map(int, input().split()))","-","-","-def lput():","- return list(map(int, input().split()))","+import math","- a, b = mput()","- print((a * b))","+ a, b = input().split()","+ a = int(a)","+ b = float(b)","+ print((int(a * b)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2298483524,"measured_runtime_v1":0.0062991838,"runtime_lift":36.4885924311,"key":["s027336468","s218994202"]} +{"user_id":"u762420987","problem_id":"p03759","language":"python","submission_id_v0":"s246152829","submission_id_v1":"s501080791","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c = list(map(int, input().split()))\n\nif (b - a) == (c - b):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")\n\n# optimized version of the same code:\n","target":"a, b, c = list(map(int, input().split()))\n\nif b - a == c - b:\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")","code_v0_loc":5,"code_v1_loc":5,"code_v0_num_chars":101,"code_v1_num_chars":97,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nif (b - a) == (c - b):\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nif b - a == c - b:\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-if (b - a) == (c - b):","+if b - a == c - b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1914725397,"measured_runtime_v1":0.0060755644,"runtime_lift":31.5151856242,"key":["s246152829","s501080791"]} +{"user_id":"u033606236","problem_id":"p03796","language":"python","submission_id_v0":"s645296559","submission_id_v1":"s055332014","cpu_time_v0":229,"cpu_time_v1":39,"memory_v0":4020,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.97,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nprint((math.factorial(int(eval(input())))%1000000007))\n\n# optimized version of the same code:\n","target":"num = int(eval(input()))\n\nresult = 1\n\nfor i in range(1,num+1):\n\n result = result *i % 1000000007\n\nprint(result)","code_v0_loc":2,"code_v1_loc":5,"code_v0_num_chars":59,"code_v1_num_chars":108,"code_v0_no_empty_lines":"import math\n\nprint((math.factorial(int(eval(input()))) % 1000000007))\n","code_v1_no_empty_lines":"num = int(eval(input()))\nresult = 1\nfor i in range(1, num + 1):\n result = result * i % 1000000007\nprint(result)\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-import math","-","-print((math.factorial(int(eval(input()))) % 1000000007))","+num = int(eval(input()))","+result = 1","+for i in range(1, num + 1):","+ result = result * i % 1000000007","+print(result)"],"diff_only_import_comment":false,"measured_runtime_v0":0.7005937328,"measured_runtime_v1":0.3298725822,"runtime_lift":2.1238313537,"key":["s645296559","s055332014"]} +{"user_id":"u488127128","problem_id":"p03416","language":"python","submission_id_v0":"s570028181","submission_id_v1":"s434791726","cpu_time_v0":103,"cpu_time_v1":46,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n j = str(i)\n\n if j==''.join(reversed(j)):\n\n count += 1\n\nprint(count)\n\n# optimized version of the same code:\n","target":"a,b = list(map(int, input().split()))\n\nn = [i for i in map(str, list(range(a,b+1))) if i==i[::-1]]\n\nprint((len(n)))","code_v0_loc":7,"code_v1_loc":3,"code_v0_num_chars":149,"code_v1_num_chars":101,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n j = str(i)\n if j == \"\".join(reversed(j)):\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nn = [i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]\nprint((len(n)))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-count = 0","-for i in range(a, b + 1):","- j = str(i)","- if j == \"\".join(reversed(j)):","- count += 1","-print(count)","+n = [i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]","+print((len(n)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4183517286,"measured_runtime_v1":0.2983190859,"runtime_lift":1.4023632692,"key":["s570028181","s434791726"]} +{"user_id":"u759412327","problem_id":"p02899","language":"python","submission_id_v0":"s615112852","submission_id_v1":"s878311039","cpu_time_v0":459,"cpu_time_v1":87,"memory_v0":22876,"memory_v1":20400,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.05,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom numpy import *\n\neval(input())\n\nprint((\" \".join(map(str,argsort(list(map(int,input().split())))+1))))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nB = N*[0]\n\n\n\nfor n in range(N):\n\n B[A[n]-1]=n+1\n\n\n\nprint((*B))","code_v0_loc":3,"code_v1_loc":8,"code_v0_num_chars":97,"code_v1_num_chars":115,"code_v0_no_empty_lines":"from numpy import *\n\neval(input())\nprint((\" \".join(map(str, argsort(list(map(int, input().split()))) + 1))))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nB = N * [0]\nfor n in range(N):\n B[A[n] - 1] = n + 1\nprint((*B))\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-from numpy import *","-","-eval(input())","-print((\" \".join(map(str, argsort(list(map(int, input().split()))) + 1))))","+N = int(eval(input()))","+A = list(map(int, input().split()))","+B = N * [0]","+for n in range(N):","+ B[A[n] - 1] = n + 1","+print((*B))"],"diff_only_import_comment":false,"measured_runtime_v0":1.7102132904,"measured_runtime_v1":0.1885396422,"runtime_lift":9.0708419192,"key":["s615112852","s878311039"]} +{"user_id":"u581187895","problem_id":"p03363","language":"python","submission_id_v0":"s713142800","submission_id_v1":"s742671433","cpu_time_v0":298,"cpu_time_v1":167,"memory_v0":39380,"memory_v1":44480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.96,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nA = np.array(input().split(), dtype=np.int64)\n\n\n\nc = Counter(A.cumsum())\n\nc[0] += 1 # np.cumsum(), 0start \u3067\u306f\u7121\u3044\u70ba 0\u3092\u52a0\u3048\u308b\n\nans = sum(v*(v-1)\/\/2 for v in list(c.values()))\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"\n\nfrom itertools import accumulate\n\nfrom collections import defaultdict\n\ndef resolve():\n\n N = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n\n\n Acum = [0] + list(accumulate(A))\n\n dic = defaultdict(int)\n\n ans = 0\n\n for i in range(N + 1):\n\n ans += dic[Acum[i]]\n\n dic[Acum[i]] += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n resolve()","code_v0_loc":10,"code_v1_loc":19,"code_v0_num_chars":245,"code_v1_num_chars":380,"code_v0_no_empty_lines":"from collections import Counter\nimport numpy as np\n\nN = int(eval(input()))\nA = np.array(input().split(), dtype=np.int64)\nc = Counter(A.cumsum())\nc[0] += 1 # np.cumsum(), 0start \u3067\u306f\u7121\u3044\u70ba 0\u3092\u52a0\u3048\u308b\nans = sum(v * (v - 1) \/\/ 2 for v in list(c.values()))\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import accumulate\nfrom collections import defaultdict\n\n\ndef resolve():\n N = int(eval(input()))\n A = list(map(int, input().split()))\n Acum = [0] + list(accumulate(A))\n dic = defaultdict(int)\n ans = 0\n for i in range(N + 1):\n ans += dic[Acum[i]]\n dic[Acum[i]] += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":47.3684210526,"diff":["-from collections import Counter","-import numpy as np","+from itertools import accumulate","+from collections import defaultdict","-N = int(eval(input()))","-A = np.array(input().split(), dtype=np.int64)","-c = Counter(A.cumsum())","-c[0] += 1 # np.cumsum(), 0start \u3067\u306f\u7121\u3044\u70ba 0\u3092\u52a0\u3048\u308b","-ans = sum(v * (v - 1) \/\/ 2 for v in list(c.values()))","-print(ans)","+","+def resolve():","+ N = int(eval(input()))","+ A = list(map(int, input().split()))","+ Acum = [0] + list(accumulate(A))","+ dic = defaultdict(int)","+ ans = 0","+ for i in range(N + 1):","+ ans += dic[Acum[i]]","+ dic[Acum[i]] += 1","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ resolve()"],"diff_only_import_comment":false,"measured_runtime_v0":1.2848177447,"measured_runtime_v1":0.2021386924,"runtime_lift":6.3561197985,"key":["s713142800","s742671433"]} +{"user_id":"u642883360","problem_id":"p03796","language":"python","submission_id_v0":"s671319819","submission_id_v1":"s345697128","cpu_time_v0":230,"cpu_time_v1":167,"memory_v0":3984,"memory_v1":38512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.39,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env pypy3\n\n\n\nimport math\n\nprint((math.factorial(int(eval(input()))) % 1000000007))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nfor i in range(n - 1, 1, -1):\n\n\tn *= i\n\n\tn %= 10**9 + 7\n\nprint(n)","code_v0_loc":4,"code_v1_loc":5,"code_v0_num_chars":85,"code_v1_num_chars":83,"code_v0_no_empty_lines":"#!\/usr\/bin\/env pypy3\nimport math\n\nprint((math.factorial(int(eval(input()))) % 1000000007))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nfor i in range(n - 1, 1, -1):\n n *= i\n n %= 10**9 + 7\nprint(n)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-#!\/usr\/bin\/env pypy3","-import math","-","-print((math.factorial(int(eval(input()))) % 1000000007))","+n = int(eval(input()))","+for i in range(n - 1, 1, -1):","+ n *= i","+ n %= 10**9 + 7","+print(n)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5574923191,"measured_runtime_v1":0.2242465372,"runtime_lift":2.4860687974,"key":["s671319819","s345697128"]} +{"user_id":"u060938295","problem_id":"p03170","language":"python","submission_id_v0":"s262531692","submission_id_v1":"s447405152","cpu_time_v0":775,"cpu_time_v1":215,"memory_v0":14308,"memory_v1":14256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.26,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\"\"\"\n\nCreated on Sat Apr 25 18:20:35 2020\n\n\"\"\"\n\n\n\nimport sys\n\nimport numpy as np\n\n\n\nsys.setrecursionlimit(10 ** 9)\n\n#def input():\n\n# return sys.stdin.readline()[:-1]\n\nmod = 10**9+7\n\n\n\n#N = int(input())\n\nN, K = list(map(int,input().split()))\n\nA = np.array(list(map(int,input().split())))\n\n\n\ndp = [True for i in range(K + A[-1] + 1)]\n\nfor i in range(K):\n\n if dp[i]:\n\n for a in A:\n\n dp[i + a] = False\n\n\n\n# print(i, dp[i],A+i,dp[A+i])\n\n#print(dp)\n\n\n\nif dp[K]:\n\n ans = 'Second'\n\nelse:\n\n ans = 'First'\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nCreated on Sat Apr 25 18:20:35 2020\n\n\"\"\"\n\n\n\nimport sys\n\nimport numpy as np\n\n\n\nsys.setrecursionlimit(10 ** 9)\n\n#def input():\n\n# return sys.stdin.readline()[:-1]\n\nmod = 10**9+7\n\n\n\n#N = int(input())\n\n#N, K = map(int,input().split())\n\n#A = np.array(list(map(int,input().split())))\n\nN, K, *A = list(map(int, open(0).read().split()))\n\n\n\ndp = [True for i in range(K + A[-1] + 1)]\n\nfor i in range(K):\n\n if dp[i]:\n\n for a in A:\n\n dp[i + a] = False\n\n\n\n# print(i, dp[i],A+i,dp[A+i])\n\n#print(dp)\n\n\n\nif dp[K]:\n\n ans = 'Second'\n\nelse:\n\n ans = 'First'\n\nprint(ans)","code_v0_loc":31,"code_v1_loc":32,"code_v0_num_chars":558,"code_v1_num_chars":605,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Apr 25 18:20:35 2020\n\"\"\"\nimport sys\nimport numpy as np\n\nsys.setrecursionlimit(10**9)\n# def input():\n# return sys.stdin.readline()[:-1]\nmod = 10**9 + 7\n# N = int(input())\nN, K = list(map(int, input().split()))\nA = np.array(list(map(int, input().split())))\ndp = [True for i in range(K + A[-1] + 1)]\nfor i in range(K):\n if dp[i]:\n for a in A:\n dp[i + a] = False\n# print(i, dp[i],A+i,dp[A+i])\n# print(dp)\nif dp[K]:\n ans = \"Second\"\nelse:\n ans = \"First\"\nprint(ans)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Apr 25 18:20:35 2020\n\"\"\"\nimport sys\nimport numpy as np\n\nsys.setrecursionlimit(10**9)\n# def input():\n# return sys.stdin.readline()[:-1]\nmod = 10**9 + 7\n# N = int(input())\n# N, K = map(int,input().split())\n# A = np.array(list(map(int,input().split())))\nN, K, *A = list(map(int, open(0).read().split()))\ndp = [True for i in range(K + A[-1] + 1)]\nfor i in range(K):\n if dp[i]:\n for a in A:\n dp[i + a] = False\n# print(i, dp[i],A+i,dp[A+i])\n# print(dp)\nif dp[K]:\n ans = \"Second\"\nelse:\n ans = \"First\"\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":3.125,"diff":["-N, K = list(map(int, input().split()))","-A = np.array(list(map(int, input().split())))","+# N, K = map(int,input().split())","+# A = np.array(list(map(int,input().split())))","+N, K, *A = list(map(int, open(0).read().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3617031952,"measured_runtime_v1":0.2231245196,"runtime_lift":6.102884603,"key":["s262531692","s447405152"]} +{"user_id":"u888092736","problem_id":"p03721","language":"python","submission_id_v0":"s705162733","submission_id_v1":"s360654843","cpu_time_v0":281,"cpu_time_v1":145,"memory_v0":28552,"memory_v1":31636,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.4,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\n\nfor a, b in sorted(AB):\n\n K -= b\n\n if K <= 0:\n\n print(a)\n\n break\n\n\n# optimized version of the same code:\n","target":"N, K, *AB = list(map(int, open(0).read().split()))\n\nli = [(a, b) for a, b in zip(*[iter(AB)] * 2)]\n\nli.sort()\n\nfor a, b in li:\n\n if K > b:\n\n K -= b\n\n else:\n\n print(a)\n\n break\n","code_v0_loc":6,"code_v1_loc":9,"code_v0_num_chars":145,"code_v1_num_chars":196,"code_v0_no_empty_lines":"(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\nfor a, b in sorted(AB):\n K -= b\n if K <= 0:\n print(a)\n break\n","code_v1_no_empty_lines":"N, K, *AB = list(map(int, open(0).read().split()))\nli = [(a, b) for a, b in zip(*[iter(AB)] * 2)]\nli.sort()\nfor a, b in li:\n if K > b:\n K -= b\n else:\n print(a)\n break\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-(N, K), *AB = [list(map(int, s.split())) for s in open(0)]","-for a, b in sorted(AB):","- K -= b","- if K <= 0:","+N, K, *AB = list(map(int, open(0).read().split()))","+li = [(a, b) for a, b in zip(*[iter(AB)] * 2)]","+li.sort()","+for a, b in li:","+ if K > b:","+ K -= b","+ else:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2949739402,"measured_runtime_v1":0.0817868489,"runtime_lift":3.6066182276,"key":["s705162733","s360654843"]} +{"user_id":"u254871849","problem_id":"p03796","language":"python","submission_id_v0":"s710953077","submission_id_v1":"s484408635","cpu_time_v0":36,"cpu_time_v1":32,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nmod = int(1e9+7)\n\nn = int(eval(input()))\n\n\n\npower = 1\n\nfor i in range(1, n+1):\n\n power = power * i % mod\n\nprint(power)\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\nMOD = 10 ** 9 + 7\n\nn = int(sys.stdin.readline().rstrip())\n\n\n\ndef main():\n\n res = 1\n\n for i in range(1, n+1):\n\n res *= i\n\n res %= MOD\n\n\n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":7,"code_v1_loc":16,"code_v0_num_chars":115,"code_v1_num_chars":248,"code_v0_no_empty_lines":"mod = int(1e9 + 7)\nn = int(eval(input()))\npower = 1\nfor i in range(1, n + 1):\n power = power * i % mod\nprint(power)\n","code_v1_no_empty_lines":"import sys\n\nMOD = 10**9 + 7\nn = int(sys.stdin.readline().rstrip())\n\n\ndef main():\n res = 1\n for i in range(1, n + 1):\n res *= i\n res %= MOD\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":56.25,"diff":["-mod = int(1e9 + 7)","-n = int(eval(input()))","-power = 1","-for i in range(1, n + 1):","- power = power * i % mod","-print(power)","+import sys","+","+MOD = 10**9 + 7","+n = int(sys.stdin.readline().rstrip())","+","+","+def main():","+ res = 1","+ for i in range(1, n + 1):","+ res *= i","+ res %= MOD","+ return res","+","+","+if __name__ == \"__main__\":","+ ans = main()","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3650334806,"measured_runtime_v1":0.2122802832,"runtime_lift":1.7195825967,"key":["s710953077","s484408635"]} +{"user_id":"u623052494","problem_id":"p03307","language":"python","submission_id_v0":"s987197453","submission_id_v1":"s279142481","cpu_time_v0":1774,"cpu_time_v1":17,"memory_v0":21764,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":99.04,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN=int(eval(input()))\n\ndef gcd(a,b):\n\n c=int(np.floor(a\/b))\n\n return a-b*c\n\nif gcd(N,2)==0:\n\n print(N)\n\nelse:\n\n print((2*N))\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\nif N%2==0:\n\n print(N)\n\nelse:\n\n print((2*N))","code_v0_loc":9,"code_v1_loc":5,"code_v0_num_chars":147,"code_v1_num_chars":63,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\n\n\ndef gcd(a, b):\n c = int(np.floor(a \/ b))\n return a - b * c\n\n\nif gcd(N, 2) == 0:\n print(N)\nelse:\n print((2 * N))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nif N % 2 == 0:\n print(N)\nelse:\n print((2 * N))\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-import numpy as np","-","-","-","-def gcd(a, b):","- c = int(np.floor(a \/ b))","- return a - b * c","-","-","-if gcd(N, 2) == 0:","+if N % 2 == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":1.8725976269,"measured_runtime_v1":0.2854303327,"runtime_lift":6.5606118642,"key":["s987197453","s279142481"]} +{"user_id":"u492605584","problem_id":"p03164","language":"python","submission_id_v0":"s292196170","submission_id_v1":"s917581247","cpu_time_v0":446,"cpu_time_v1":321,"memory_v0":119916,"memory_v1":41964,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.03,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [[10**9+1] * (V + 1) for i in range(N+1)]\n\ndp[0][0] = 0\n\nfor i in range(N):\n\n for j in range(V+1):\n\n if j - L[i][1] >= 0:\n\n dp[i+1][j] = min(dp[i][j], dp[i][j-L[i][1]] + L[i][0])\n\n else:\n\n dp[i+1][j] = dp[i][j]\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[-1][j]:\n\n ans = max(ans, j)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [10**9+1] * (V + 1)\n\ndp[0] = 0\n\nfor i in range(N):\n\n for j in range(V, -1, -1):\n\n dp[j] = min(dp[j], dp[j-L[i][1]] + L[i][0])\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[j]:\n\n ans = max(ans, j)\n\nprint(ans)","code_v0_loc":19,"code_v1_loc":16,"code_v0_num_chars":481,"code_v1_num_chars":367,"code_v0_no_empty_lines":"N, W = list(map(int, input().split()))\nL = [list(map(int, input().split())) for i in range(N)]\nV = 0\nfor i in range(N):\n V += L[i][1]\ndp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]\ndp[0][0] = 0\nfor i in range(N):\n for j in range(V + 1):\n if j - L[i][1] >= 0:\n dp[i + 1][j] = min(dp[i][j], dp[i][j - L[i][1]] + L[i][0])\n else:\n dp[i + 1][j] = dp[i][j]\nans = 0\nfor j in range(V + 1):\n if W >= dp[-1][j]:\n ans = max(ans, j)\nprint(ans)\n","code_v1_no_empty_lines":"N, W = list(map(int, input().split()))\nL = [list(map(int, input().split())) for i in range(N)]\nV = 0\nfor i in range(N):\n V += L[i][1]\ndp = [10**9 + 1] * (V + 1)\ndp[0] = 0\nfor i in range(N):\n for j in range(V, -1, -1):\n dp[j] = min(dp[j], dp[j - L[i][1]] + L[i][0])\nans = 0\nfor j in range(V + 1):\n if W >= dp[j]:\n ans = max(ans, j)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-dp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]","-dp[0][0] = 0","+dp = [10**9 + 1] * (V + 1)","+dp[0] = 0","- for j in range(V + 1):","- if j - L[i][1] >= 0:","- dp[i + 1][j] = min(dp[i][j], dp[i][j - L[i][1]] + L[i][0])","- else:","- dp[i + 1][j] = dp[i][j]","+ for j in range(V, -1, -1):","+ dp[j] = min(dp[j], dp[j - L[i][1]] + L[i][0])","- if W >= dp[-1][j]:","+ if W >= dp[j]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3010064836,"measured_runtime_v1":0.1980076838,"runtime_lift":1.5201757721,"key":["s292196170","s917581247"]} +{"user_id":"u494927057","problem_id":"p03814","language":"python","submission_id_v0":"s883482084","submission_id_v1":"s072538424","cpu_time_v0":59,"cpu_time_v1":35,"memory_v0":3516,"memory_v1":3516,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.68,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = eval(input())\n\n\n\nstart = -1\n\nend = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A' and start < 0:\n\n start = i\n\n elif s[i] == 'Z':\n\n end = i\n\nprint((end - start + 1))\n\n\n# optimized version of the same code:\n","target":"s = eval(input())\n\n\n\nstart = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A':\n\n start = i\n\n break\n\n\n\nend = 0\n\nfor i in reversed(list(range(len(s)))):\n\n if s[i] == 'Z':\n\n end = i\n\n break\n\nprint((end - start + 1))\n","code_v0_loc":10,"code_v1_loc":14,"code_v0_num_chars":178,"code_v1_num_chars":228,"code_v0_no_empty_lines":"s = eval(input())\nstart = -1\nend = 0\nfor i in range(len(s)):\n if s[i] == \"A\" and start < 0:\n start = i\n elif s[i] == \"Z\":\n end = i\nprint((end - start + 1))\n","code_v1_no_empty_lines":"s = eval(input())\nstart = 0\nfor i in range(len(s)):\n if s[i] == \"A\":\n start = i\n break\nend = 0\nfor i in reversed(list(range(len(s)))):\n if s[i] == \"Z\":\n end = i\n break\nprint((end - start + 1))\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-start = -1","+start = 0","+for i in range(len(s)):","+ if s[i] == \"A\":","+ start = i","+ break","-for i in range(len(s)):","- if s[i] == \"A\" and start < 0:","- start = i","- elif s[i] == \"Z\":","+for i in reversed(list(range(len(s)))):","+ if s[i] == \"Z\":","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.2661928608,"measured_runtime_v1":0.1145644054,"runtime_lift":2.3235215143,"key":["s883482084","s072538424"]} +{"user_id":"u150984829","problem_id":"p02412","language":"python","submission_id_v0":"s777094380","submission_id_v1":"s391711407","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":5608,"memory_v1":5612,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nwhile 1:\n\n n,x=list(map(int,input().split()))\n\n if n+x==0:break\n\n print((len([1 for i in range(3,n+1)for j in range(2,x-i)if x-i-j d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n from sys import stdin\n\n input = stdin.readline\n\n\n\n n, m, r = list(map(int, input().split()))\n\n l = list(map(int, input().split()))\n\n for i in range(r):\n\n l[i] -= 1\n\n d = [[10**8] * n for _ in range(n)]\n\n for _ in range(m):\n\n i, j, k = list(map(int, input().split()))\n\n d[i-1][j-1] = k\n\n d[j-1][i-1] = k\n\n\n\n # Warshall-Floyd algorithm\n\n for k in range(n):\n\n for i in range(n-1):\n\n for j in range(i+1, n):\n\n if d[i][j] > d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n d[j][i] = d[i][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n","code_v0_loc":36,"code_v1_loc":37,"code_v0_num_chars":868,"code_v1_num_chars":914,"code_v0_no_empty_lines":"def main():\n from sys import stdin\n\n input = stdin.readline\n n, m, r = list(map(int, input().split()))\n l = list(map(int, input().split()))\n for i in range(r):\n l[i] -= 1\n d = [[10**8] * n for _ in range(n)]\n for _ in range(m):\n i, j, k = list(map(int, input().split()))\n d[i - 1][j - 1] = k\n d[j - 1][i - 1] = k\n # Warshall-Floyd algorithm\n for k in range(n):\n for i in range(n):\n for j in range(n):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\n # full search\n # 8! = 40320\n from itertools import permutations\n\n answer = 10**8\n for i in permutations(l):\n ans = 0\n for j in range(r - 1):\n ans += d[i[j]][i[j + 1]]\n if ans < answer:\n answer = ans\n print(answer)\n\n\nmain()\n","code_v1_no_empty_lines":"def main():\n from sys import stdin\n\n input = stdin.readline\n n, m, r = list(map(int, input().split()))\n l = list(map(int, input().split()))\n for i in range(r):\n l[i] -= 1\n d = [[10**8] * n for _ in range(n)]\n for _ in range(m):\n i, j, k = list(map(int, input().split()))\n d[i - 1][j - 1] = k\n d[j - 1][i - 1] = k\n # Warshall-Floyd algorithm\n for k in range(n):\n for i in range(n - 1):\n for j in range(i + 1, n):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\n d[j][i] = d[i][j]\n # full search\n # 8! = 40320\n from itertools import permutations\n\n answer = 10**8\n for i in permutations(l):\n ans = 0\n for j in range(r - 1):\n ans += d[i[j]][i[j + 1]]\n if ans < answer:\n answer = ans\n print(answer)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":2.7027027027,"diff":["- for i in range(n):","- for j in range(n):","+ for i in range(n - 1):","+ for j in range(i + 1, n):","+ d[j][i] = d[i][j]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2599997888,"measured_runtime_v1":0.1532082543,"runtime_lift":1.697035123,"key":["s030633020","s301564470"]} +{"user_id":"u994988729","problem_id":"p02702","language":"python","submission_id_v0":"s376874744","submission_id_v1":"s887269917","cpu_time_v0":337,"cpu_time_v1":135,"memory_v0":16640,"memory_v1":9800,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.94,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\nS = input()[::-1]\n\n\n\nmemo = [0]\n\nd = 0\n\nmod = 2019\n\n\n\nfor s in S:\n\n tmp = int(s) * pow(10, d, mod) % mod\n\n tmp = memo[-1] + tmp\n\n memo.append(tmp % mod)\n\n d += 1\n\n\n\nc = Counter(memo)\n\nans = sum(v * (v - 1) \/\/ 2 for v in list(c.values()))\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\nS = eval(input())\n\nN = len(S)\n\n\n\nmemo = defaultdict(int)\n\nmemo[0] += 1\n\n\n\nmod = 2019\n\nd = 1\n\nval = 0\n\n\n\nfor s in S[::-1]:\n\n s = int(s)\n\n val += s * d\n\n val %= mod\n\n memo[val] += 1\n\n d *= 10\n\n d %= mod\n\n\n\nprint((sum(v * (v - 1) \/\/ 2 for v in list(memo.values()))))","code_v0_loc":16,"code_v1_loc":20,"code_v0_num_chars":288,"code_v1_num_chars":304,"code_v0_no_empty_lines":"from collections import Counter\n\nS = input()[::-1]\nmemo = [0]\nd = 0\nmod = 2019\nfor s in S:\n tmp = int(s) * pow(10, d, mod) % mod\n tmp = memo[-1] + tmp\n memo.append(tmp % mod)\n d += 1\nc = Counter(memo)\nans = sum(v * (v - 1) \/\/ 2 for v in list(c.values()))\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nS = eval(input())\nN = len(S)\nmemo = defaultdict(int)\nmemo[0] += 1\nmod = 2019\nd = 1\nval = 0\nfor s in S[::-1]:\n s = int(s)\n val += s * d\n val %= mod\n memo[val] += 1\n d *= 10\n d %= mod\nprint((sum(v * (v - 1) \/\/ 2 for v in list(memo.values()))))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-from collections import Counter","+from collections import defaultdict","-S = input()[::-1]","-memo = [0]","-d = 0","+S = eval(input())","+N = len(S)","+memo = defaultdict(int)","+memo[0] += 1","-for s in S:","- tmp = int(s) * pow(10, d, mod) % mod","- tmp = memo[-1] + tmp","- memo.append(tmp % mod)","- d += 1","-c = Counter(memo)","-ans = sum(v * (v - 1) \/\/ 2 for v in list(c.values()))","-print(ans)","+d = 1","+val = 0","+for s in S[::-1]:","+ s = int(s)","+ val += s * d","+ val %= mod","+ memo[val] += 1","+ d *= 10","+ d %= mod","+print((sum(v * (v - 1) \/\/ 2 for v in list(memo.values()))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2615414739,"measured_runtime_v1":0.0063235409,"runtime_lift":41.3599716541,"key":["s376874744","s887269917"]} +{"user_id":"u790710233","problem_id":"p02627","language":"python","submission_id_v0":"s724454634","submission_id_v1":"s209300808","cpu_time_v0":29,"cpu_time_v1":25,"memory_v0":9064,"memory_v1":9076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na = eval(input())\n\nprint(('A' if not a.islower() else 'a'))\n\n\n# optimized version of the same code:\n","target":"print(('A' if input().isupper() else 'a'))\n","code_v0_loc":2,"code_v1_loc":1,"code_v0_num_chars":52,"code_v1_num_chars":41,"code_v0_no_empty_lines":"a = eval(input())\nprint((\"A\" if not a.islower() else \"a\"))\n","code_v1_no_empty_lines":"print((\"A\" if input().isupper() else \"a\"))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-a = eval(input())","-print((\"A\" if not a.islower() else \"a\"))","+print((\"A\" if input().isupper() else \"a\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3926431958,"measured_runtime_v1":0.2988653038,"runtime_lift":1.3137797892,"key":["s724454634","s209300808"]} +{"user_id":"u296518383","problem_id":"p03325","language":"python","submission_id_v0":"s558724347","submission_id_v1":"s377057284","cpu_time_v0":137,"cpu_time_v1":60,"memory_v0":4148,"memory_v1":3956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.2,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN=int(eval(input()))\n\na=list(map(int,input().split()))\n\nfor i in range(N):\n\n for j in range(1,31):\n\n if a[i]%(2**j)!=0:\n\n a[i]=j-1\n\n break\n\nprint((sum(a)))\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\ndef f(n):\n\n res = 0\n\n while n % 2 == 0:\n\n n \/\/= 2\n\n res += 1\n\n return res\n\n\n\nanswer = 0\n\nfor a in A:\n\n answer += f(a)\n\n\n\nprint(answer)","code_v0_loc":8,"code_v1_loc":18,"code_v0_num_chars":161,"code_v1_num_chars":250,"code_v0_no_empty_lines":"N = int(eval(input()))\na = list(map(int, input().split()))\nfor i in range(N):\n for j in range(1, 31):\n if a[i] % (2**j) != 0:\n a[i] = j - 1\n break\nprint((sum(a)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nN = int(eval(input()))\nA = list(map(int, input().split()))\n\n\ndef f(n):\n res = 0\n while n % 2 == 0:\n n \/\/= 2\n res += 1\n return res\n\n\nanswer = 0\nfor a in A:\n answer += f(a)\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["+import sys","+","+input = sys.stdin.buffer.readline","-a = list(map(int, input().split()))","-for i in range(N):","- for j in range(1, 31):","- if a[i] % (2**j) != 0:","- a[i] = j - 1","- break","-print((sum(a)))","+A = list(map(int, input().split()))","+","+","+def f(n):","+ res = 0","+ while n % 2 == 0:","+ n \/\/= 2","+ res += 1","+ return res","+","+","+answer = 0","+for a in A:","+ answer += f(a)","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4158020542,"measured_runtime_v1":0.3166491349,"runtime_lift":1.313131818,"key":["s558724347","s377057284"]} +{"user_id":"u211706121","problem_id":"p02821","language":"python","submission_id_v0":"s417724663","submission_id_v1":"s715320802","cpu_time_v0":1145,"cpu_time_v1":532,"memory_v0":47196,"memory_v1":37156,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.54,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn,m = [int(i) for i in input().split()]\n\na = [int(i) for i in input().split()]\n\nd = 2**18\n\n\n\nf = np.zeros(d,dtype=int)\n\nfor i in a:\n\n f[i]+=1\n\n\n\ntf = np.fft.fft(f)\n\nf = np.fft.ifft(tf*tf)\n\nf = [int(i+0.5) for i in f]\n\n\n\nans=0\n\nfor i in range(len(f)-1,0,-1):\n\n if f[i]<=m:\n\n ans+=i*f[i]\n\n m-=f[i]\n\n elif f[i]>m:\n\n ans+=i*m\n\n break\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import numpy as np\n\n\n\nn,m = [int(i) for i in input().split()]\n\na = [int(i) for i in input().split()]\n\nd = 2**18\n\n\n\nf = np.zeros(d,dtype=int)\n\nfor i in a:\n\n f[i]+=1\n\n\n\ntf = np.fft.rfft(f)\n\nf = np.fft.irfft(tf*tf)\n\nf = [int(i+0.5) for i in f]\n\n\n\nans=0\n\nfor i in range(len(f)-1,0,-1):\n\n if f[i]<=m:\n\n ans+=i*f[i]\n\n m-=f[i]\n\n elif f[i]>m:\n\n ans+=i*m\n\n break\n\nprint(ans)","code_v0_loc":23,"code_v1_loc":23,"code_v0_num_chars":400,"code_v1_num_chars":402,"code_v0_no_empty_lines":"import numpy as np\n\nn, m = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\nd = 2**18\nf = np.zeros(d, dtype=int)\nfor i in a:\n f[i] += 1\ntf = np.fft.fft(f)\nf = np.fft.ifft(tf * tf)\nf = [int(i + 0.5) for i in f]\nans = 0\nfor i in range(len(f) - 1, 0, -1):\n if f[i] <= m:\n ans += i * f[i]\n m -= f[i]\n elif f[i] > m:\n ans += i * m\n break\nprint(ans)\n","code_v1_no_empty_lines":"import numpy as np\n\nn, m = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\nd = 2**18\nf = np.zeros(d, dtype=int)\nfor i in a:\n f[i] += 1\ntf = np.fft.rfft(f)\nf = np.fft.irfft(tf * tf)\nf = [int(i + 0.5) for i in f]\nans = 0\nfor i in range(len(f) - 1, 0, -1):\n if f[i] <= m:\n ans += i * f[i]\n m -= f[i]\n elif f[i] > m:\n ans += i * m\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-tf = np.fft.fft(f)","-f = np.fft.ifft(tf * tf)","+tf = np.fft.rfft(f)","+f = np.fft.irfft(tf * tf)"],"diff_only_import_comment":false,"measured_runtime_v0":3.91252525,"measured_runtime_v1":2.866683816,"runtime_lift":1.3648262247,"key":["s417724663","s715320802"]} +{"user_id":"u280552586","problem_id":"p03416","language":"python","submission_id_v0":"s181217545","submission_id_v1":"s674939126","cpu_time_v0":47,"cpu_time_v1":18,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.7,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b = list(map(int, input().split()))\n\ncnt = 0\n\n\n\nfor i in range(a, b+1):\n\n i = str(i)\n\n if i[0] == i[-1] and i[1] == i[-2]:\n\n cnt += 1\n\n\n\nprint(cnt)\n\n\n# optimized version of the same code:\n","target":"a, b = list(map(int, input().split()))\n\ncnt = 0\n\n\n\nfor i in range(10):\n\n for j in range(10):\n\n for k in range(10):\n\n c = 10000*i+1000*j+100*k+10*j+i\n\n if a <= c <= b:\n\n cnt += 1\n\n\n\nprint(cnt)\n","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":158,"code_v1_num_chars":233,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(a, b + 1):\n i = str(i)\n if i[0] == i[-1] and i[1] == i[-2]:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(10):\n for j in range(10):\n for k in range(10):\n c = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n if a <= c <= b:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-for i in range(a, b + 1):","- i = str(i)","- if i[0] == i[-1] and i[1] == i[-2]:","- cnt += 1","+for i in range(10):","+ for j in range(10):","+ for k in range(10):","+ c = 10000 * i + 1000 * j + 100 * k + 10 * j + i","+ if a <= c <= b:","+ cnt += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3654750098,"measured_runtime_v1":0.273478784,"runtime_lift":1.3363925508,"key":["s181217545","s674939126"]} +{"user_id":"u753803401","problem_id":"p03835","language":"python","submission_id_v0":"s742815481","submission_id_v1":"s376437490","cpu_time_v0":1589,"cpu_time_v1":1250,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk, s = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if i + j > s:\n\n break\n\n elif s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n\n\n# optimized version of the same code:\n","target":"k, s = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if 0 <= s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":200,"code_v1_num_chars":161,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if i + j > s:\n break\n elif s - i - j <= k:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["- if i + j > s:","- break","- elif s - i - j <= k:","+ if 0 <= s - i - j <= k:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3744940901,"measured_runtime_v1":0.2492418245,"runtime_lift":1.5025330956,"key":["s742815481","s376437490"]} +{"user_id":"u893063840","problem_id":"p02702","language":"python","submission_id_v0":"s375368375","submission_id_v1":"s846087139","cpu_time_v0":644,"cpu_time_v1":545,"memory_v0":26036,"memory_v1":24420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.37,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\n\n\ns = eval(input())\n\nmod1 = 673\n\nmod2 = 3\n\n\n\nnum1 = 0\n\nnum2 = 0\n\nli1 = []\n\nli2 = []\n\npw1 = 10\n\npw2 = 10\n\nfor i, e in enumerate(s, 1):\n\n num1 *= 10\n\n num1 += int(e)\n\n num1 %= mod1\n\n inv = pow(pw1, mod1 - 2, mod1)\n\n li1.append(num1 * inv % mod1)\n\n\n\n num2 *= 10\n\n num2 += int(e)\n\n num2 %= mod2\n\n inv = pow(pw2, mod2 - 2, mod2)\n\n li2.append(num2 * inv % mod2)\n\n\n\n pw1 *= 10\n\n pw1 %= mod1\n\n pw2 *= 10\n\n pw2 %= mod2\n\n\n\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\n\nc = Counter(li)\n\n\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) \/\/ 2\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"from collections import Counter\n\n\n\n\n\ndef f(mod):\n\n ret = [0]\n\n power = 1\n\n num = 0\n\n for i, e in enumerate(s, 1):\n\n num *= 10\n\n num += int(e)\n\n num %= mod\n\n\n\n power *= 10\n\n power %= mod\n\n inv = pow(power, mod - 2, mod)\n\n\n\n ret.append(num * inv % mod)\n\n\n\n return ret\n\n\n\n\n\ns = eval(input())\n\n\n\nmod3 = f(3)\n\nmod673 = f(673)\n\n\n\nli = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]\n\n\n\nc = Counter(li)\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) \/\/ 2\n\nprint(ans)\n","code_v0_loc":38,"code_v1_loc":33,"code_v0_num_chars":629,"code_v1_num_chars":529,"code_v0_no_empty_lines":"from collections import Counter\n\ns = eval(input())\nmod1 = 673\nmod2 = 3\nnum1 = 0\nnum2 = 0\nli1 = []\nli2 = []\npw1 = 10\npw2 = 10\nfor i, e in enumerate(s, 1):\n num1 *= 10\n num1 += int(e)\n num1 %= mod1\n inv = pow(pw1, mod1 - 2, mod1)\n li1.append(num1 * inv % mod1)\n num2 *= 10\n num2 += int(e)\n num2 %= mod2\n inv = pow(pw2, mod2 - 2, mod2)\n li2.append(num2 * inv % mod2)\n pw1 *= 10\n pw1 %= mod1\n pw2 *= 10\n pw2 %= mod2\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\nc = Counter(li)\nans = 0\nfor v in list(c.values()):\n ans += v * (v - 1) \/\/ 2\nprint(ans)\n","code_v1_no_empty_lines":"from collections import Counter\n\n\ndef f(mod):\n ret = [0]\n power = 1\n num = 0\n for i, e in enumerate(s, 1):\n num *= 10\n num += int(e)\n num %= mod\n power *= 10\n power %= mod\n inv = pow(power, mod - 2, mod)\n ret.append(num * inv % mod)\n return ret\n\n\ns = eval(input())\nmod3 = f(3)\nmod673 = f(673)\nli = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]\nc = Counter(li)\nans = 0\nfor v in list(c.values()):\n ans += v * (v - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":13.1578947368,"diff":["+","+def f(mod):","+ ret = [0]","+ power = 1","+ num = 0","+ for i, e in enumerate(s, 1):","+ num *= 10","+ num += int(e)","+ num %= mod","+ power *= 10","+ power %= mod","+ inv = pow(power, mod - 2, mod)","+ ret.append(num * inv % mod)","+ return ret","+","+","-mod1 = 673","-mod2 = 3","-num1 = 0","-num2 = 0","-li1 = []","-li2 = []","-pw1 = 10","-pw2 = 10","-for i, e in enumerate(s, 1):","- num1 *= 10","- num1 += int(e)","- num1 %= mod1","- inv = pow(pw1, mod1 - 2, mod1)","- li1.append(num1 * inv % mod1)","- num2 *= 10","- num2 += int(e)","- num2 %= mod2","- inv = pow(pw2, mod2 - 2, mod2)","- li2.append(num2 * inv % mod2)","- pw1 *= 10","- pw1 %= mod1","- pw2 *= 10","- pw2 %= mod2","-li = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]","+mod3 = f(3)","+mod673 = f(673)","+li = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.4600284932,"measured_runtime_v1":0.2683121743,"runtime_lift":1.7145270963,"key":["s375368375","s846087139"]} +{"user_id":"u545368057","problem_id":"p02537","language":"python","submission_id_v0":"s842030357","submission_id_v1":"s767194684","cpu_time_v0":1764,"cpu_time_v1":1543,"memory_v0":141700,"memory_v1":111052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nn,k = list(map(int, input().split()))\n\nAs = [int(eval(input())) for i in range(n)]\n\n\n\n# N: \u51e6\u7406\u3059\u308b\u533a\u9593\u306e\u9577\u3055\n\n\n\nINF = 0\n\n\n\nmx = 300001\n\nLV = (mx-1).bit_length()\n\nN0 = 2**LV\n\ndata = [INF]*(2*N0)\n\nlazy = [None]*(2*N0)\n\n\n\n# \u4f1d\u642c\u5bfe\u8c61\u306e\u533a\u9593\u3092\u6c42\u3081\u308b\n\ndef gindex(l, r):\n\n L = (l + N0) >> 1; R = (r + N0) >> 1\n\n lc = 0 if l & 1 else (L & -L).bit_length()\n\n rc = 0 if r & 1 else (R & -R).bit_length()\n\n for i in range(LV):\n\n if rc <= i:\n\n yield R\n\n if L < R and lc <= i:\n\n yield L\n\n L >>= 1; R >>= 1\n\n\n\n# \u9045\u5ef6\u4f1d\u642c\u51e6\u7406\n\ndef propagates(*ids):\n\n for i in reversed(ids):\n\n v = lazy[i-1]\n\n if v is None:\n\n continue\n\n lazy[2*i-1] = data[2*i-1] = lazy[2*i] = data[2*i] = v\n\n lazy[i-1] = None\n\n\n\n# \u533a\u9593[l, r)\u3092x\u3067\u66f4\u65b0\n\ndef update(l, r, x):\n\n *ids, = gindex(l, r)\n\n propagates(*ids)\n\n\n\n L = N0 + l; R = N0 + r\n\n while L < R:\n\n if R & 1:\n\n R -= 1\n\n lazy[R-1] = data[R-1] = x\n\n if L & 1:\n\n lazy[L-1] = data[L-1] = x\n\n L += 1\n\n L >>= 1; R >>= 1\n\n for i in ids:\n\n data[i-1] = max(data[2*i-1], data[2*i])\n\n\n\n# \u533a\u9593[l, r)\u5185\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\n\ndef query(l, r):\n\n propagates(*gindex(l, r))\n\n L = N0 + l; R = N0 + r\n\n\n\n s = INF\n\n while L < R:\n\n if R & 1:\n\n R -= 1\n\n s = max(s, data[R-1])\n\n if L & 1:\n\n s = max(s, data[L-1])\n\n L += 1\n\n L >>= 1; R >>= 1\n\n return s\n\n\n\nupdate(As[0],As[0]+1,1)\n\nfor i, a in enumerate(As[1:]):\n\n l = max(0,a-k)\n\n r = min(mx,a+k)\n\n upd = query(l,r+1)\n\n if upd == -1:continue\n\n # print(\"i\",i,\"a\",a,\"upd\",upd,\"l\",l,\"r\",r)\n\n update(a, a+1, upd+1)\n\n\n\nans = 0\n\nfor a in set(As):\n\n ans = max(ans,query(a,a+1))\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nn,k = list(map(int, input().split()))\n\nAs = [int(eval(input())) for i in range(n)]\n\n\n\n# N: \u51e6\u7406\u3059\u308b\u533a\u9593\u306e\u9577\u3055\n\n\n\nINF = 0\n\n\n\nmx = 300001\n\nLV = (mx-1).bit_length()\n\nN0 = 2**LV\n\ndata = [INF]*(2*N0)\n\nlazy = [None]*(2*N0)\n\n\n\n# \u4f1d\u642c\u5bfe\u8c61\u306e\u533a\u9593\u3092\u6c42\u3081\u308b\n\ndef gindex(l, r):\n\n L = (l + N0) >> 1; R = (r + N0) >> 1\n\n lc = 0 if l & 1 else (L & -L).bit_length()\n\n rc = 0 if r & 1 else (R & -R).bit_length()\n\n for i in range(LV):\n\n if rc <= i:\n\n yield R\n\n if L < R and lc <= i:\n\n yield L\n\n L >>= 1; R >>= 1\n\n\n\n# \u9045\u5ef6\u4f1d\u642c\u51e6\u7406\n\ndef propagates(*ids):\n\n for i in reversed(ids):\n\n v = lazy[i-1]\n\n if v is None:\n\n continue\n\n lazy[2*i-1] = data[2*i-1] = lazy[2*i] = data[2*i] = v\n\n lazy[i-1] = None\n\n\n\n# \u533a\u9593[l, r)\u3092x\u3067\u66f4\u65b0\n\ndef update(l, r, x):\n\n *ids, = gindex(l, r)\n\n propagates(*ids)\n\n\n\n L = N0 + l; R = N0 + r\n\n while L < R:\n\n if R & 1:\n\n R -= 1\n\n lazy[R-1] = data[R-1] = x\n\n if L & 1:\n\n lazy[L-1] = data[L-1] = x\n\n L += 1\n\n L >>= 1; R >>= 1\n\n for i in ids:\n\n data[i-1] = max(data[2*i-1], data[2*i])\n\n\n\n# \u533a\u9593[l, r)\u5185\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\n\ndef query(l, r):\n\n propagates(*gindex(l, r))\n\n L = N0 + l; R = N0 + r\n\n\n\n s = INF\n\n while L < R:\n\n if R & 1:\n\n R -= 1\n\n s = max(s, data[R-1])\n\n if L & 1:\n\n s = max(s, data[L-1])\n\n L += 1\n\n L >>= 1; R >>= 1\n\n return s\n\n\n\nans = 0\n\nupdate(As[0],As[0]+1,1)\n\nfor i, a in enumerate(As[1:]):\n\n l = max(0,a-k)\n\n r = min(mx,a+k)\n\n upd = query(l,r+1)\n\n if upd == -1:continue\n\n # print(\"i\",i,\"a\",a,\"upd\",upd,\"l\",l,\"r\",r)\n\n update(a, a+1, upd+1)\n\n ans = max(ans, upd+1)\n\nprint(ans)\n\n\n","code_v0_loc":83,"code_v1_loc":82,"code_v0_num_chars":1786,"code_v1_num_chars":1762,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, k = list(map(int, input().split()))\nAs = [int(eval(input())) for i in range(n)]\n# N: \u51e6\u7406\u3059\u308b\u533a\u9593\u306e\u9577\u3055\nINF = 0\nmx = 300001\nLV = (mx - 1).bit_length()\nN0 = 2**LV\ndata = [INF] * (2 * N0)\nlazy = [None] * (2 * N0)\n# \u4f1d\u642c\u5bfe\u8c61\u306e\u533a\u9593\u3092\u6c42\u3081\u308b\ndef gindex(l, r):\n L = (l + N0) >> 1\n R = (r + N0) >> 1\n lc = 0 if l & 1 else (L & -L).bit_length()\n rc = 0 if r & 1 else (R & -R).bit_length()\n for i in range(LV):\n if rc <= i:\n yield R\n if L < R and lc <= i:\n yield L\n L >>= 1\n R >>= 1\n\n\n# \u9045\u5ef6\u4f1d\u642c\u51e6\u7406\ndef propagates(*ids):\n for i in reversed(ids):\n v = lazy[i - 1]\n if v is None:\n continue\n lazy[2 * i - 1] = data[2 * i - 1] = lazy[2 * i] = data[2 * i] = v\n lazy[i - 1] = None\n\n\n# \u533a\u9593[l, r)\u3092x\u3067\u66f4\u65b0\ndef update(l, r, x):\n (*ids,) = gindex(l, r)\n propagates(*ids)\n L = N0 + l\n R = N0 + r\n while L < R:\n if R & 1:\n R -= 1\n lazy[R - 1] = data[R - 1] = x\n if L & 1:\n lazy[L - 1] = data[L - 1] = x\n L += 1\n L >>= 1\n R >>= 1\n for i in ids:\n data[i - 1] = max(data[2 * i - 1], data[2 * i])\n\n\n# \u533a\u9593[l, r)\u5185\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\ndef query(l, r):\n propagates(*gindex(l, r))\n L = N0 + l\n R = N0 + r\n s = INF\n while L < R:\n if R & 1:\n R -= 1\n s = max(s, data[R - 1])\n if L & 1:\n s = max(s, data[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\nupdate(As[0], As[0] + 1, 1)\nfor i, a in enumerate(As[1:]):\n l = max(0, a - k)\n r = min(mx, a + k)\n upd = query(l, r + 1)\n if upd == -1:\n continue\n # print(\"i\",i,\"a\",a,\"upd\",upd,\"l\",l,\"r\",r)\n update(a, a + 1, upd + 1)\nans = 0\nfor a in set(As):\n ans = max(ans, query(a, a + 1))\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, k = list(map(int, input().split()))\nAs = [int(eval(input())) for i in range(n)]\n# N: \u51e6\u7406\u3059\u308b\u533a\u9593\u306e\u9577\u3055\nINF = 0\nmx = 300001\nLV = (mx - 1).bit_length()\nN0 = 2**LV\ndata = [INF] * (2 * N0)\nlazy = [None] * (2 * N0)\n# \u4f1d\u642c\u5bfe\u8c61\u306e\u533a\u9593\u3092\u6c42\u3081\u308b\ndef gindex(l, r):\n L = (l + N0) >> 1\n R = (r + N0) >> 1\n lc = 0 if l & 1 else (L & -L).bit_length()\n rc = 0 if r & 1 else (R & -R).bit_length()\n for i in range(LV):\n if rc <= i:\n yield R\n if L < R and lc <= i:\n yield L\n L >>= 1\n R >>= 1\n\n\n# \u9045\u5ef6\u4f1d\u642c\u51e6\u7406\ndef propagates(*ids):\n for i in reversed(ids):\n v = lazy[i - 1]\n if v is None:\n continue\n lazy[2 * i - 1] = data[2 * i - 1] = lazy[2 * i] = data[2 * i] = v\n lazy[i - 1] = None\n\n\n# \u533a\u9593[l, r)\u3092x\u3067\u66f4\u65b0\ndef update(l, r, x):\n (*ids,) = gindex(l, r)\n propagates(*ids)\n L = N0 + l\n R = N0 + r\n while L < R:\n if R & 1:\n R -= 1\n lazy[R - 1] = data[R - 1] = x\n if L & 1:\n lazy[L - 1] = data[L - 1] = x\n L += 1\n L >>= 1\n R >>= 1\n for i in ids:\n data[i - 1] = max(data[2 * i - 1], data[2 * i])\n\n\n# \u533a\u9593[l, r)\u5185\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\ndef query(l, r):\n propagates(*gindex(l, r))\n L = N0 + l\n R = N0 + r\n s = INF\n while L < R:\n if R & 1:\n R -= 1\n s = max(s, data[R - 1])\n if L & 1:\n s = max(s, data[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\nans = 0\nupdate(As[0], As[0] + 1, 1)\nfor i, a in enumerate(As[1:]):\n l = max(0, a - k)\n r = min(mx, a + k)\n upd = query(l, r + 1)\n if upd == -1:\n continue\n # print(\"i\",i,\"a\",a,\"upd\",upd,\"l\",l,\"r\",r)\n update(a, a + 1, upd + 1)\n ans = max(ans, upd + 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":1.2048192771,"diff":["+ans = 0","-ans = 0","-for a in set(As):","- ans = max(ans, query(a, a + 1))","+ ans = max(ans, upd + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.820688494,"measured_runtime_v1":0.5116031129,"runtime_lift":1.6041507043,"key":["s842030357","s767194684"]} +{"user_id":"u199290844","problem_id":"p02725","language":"python","submission_id_v0":"s958779549","submission_id_v1":"s995029254","cpu_time_v0":279,"cpu_time_v1":126,"memory_v0":35108,"memory_v1":26420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.84,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nK, N = [int(i) for i in input().rstrip().split(' ')]\n\nA = [int(i) for i in input().rstrip().split(' ')]\n\n\n\nx = A[0]\n\ny = K - A[-1]\n\nn = [int(A[i+1] - A[i]) for i in range(N-1)]\n\nn.append(x+y)\n\n\n\nnp_list = np.array(n)\n\nn.pop(np_list.argmax())\n\nprint((sum(n)))\n\n# optimized version of the same code:\n","target":"k,n = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\n\n\ndp = [0 for i in range(n)]\n\ndp[0] = abs(k-a[-1]) + a[0]\n\n\n\nfor i in range(1,n):\n\n dp[i] = abs(a[i]-a[i-1])\n\n\n\nprint((sum(dp) - max(dp)))","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":278,"code_v1_num_chars":213,"code_v0_no_empty_lines":"import numpy as np\n\nK, N = [int(i) for i in input().rstrip().split(\" \")]\nA = [int(i) for i in input().rstrip().split(\" \")]\nx = A[0]\ny = K - A[-1]\nn = [int(A[i + 1] - A[i]) for i in range(N - 1)]\nn.append(x + y)\nnp_list = np.array(n)\nn.pop(np_list.argmax())\nprint((sum(n)))\n","code_v1_no_empty_lines":"k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\ndp = [0 for i in range(n)]\ndp[0] = abs(k - a[-1]) + a[0]\nfor i in range(1, n):\n dp[i] = abs(a[i] - a[i - 1])\nprint((sum(dp) - max(dp)))\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-import numpy as np","-","-K, N = [int(i) for i in input().rstrip().split(\" \")]","-A = [int(i) for i in input().rstrip().split(\" \")]","-x = A[0]","-y = K - A[-1]","-n = [int(A[i + 1] - A[i]) for i in range(N - 1)]","-n.append(x + y)","-np_list = np.array(n)","-n.pop(np_list.argmax())","-print((sum(n)))","+k, n = list(map(int, input().split()))","+a = list(map(int, input().split()))","+dp = [0 for i in range(n)]","+dp[0] = abs(k - a[-1]) + a[0]","+for i in range(1, n):","+ dp[i] = abs(a[i] - a[i - 1])","+print((sum(dp) - max(dp)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.5235492842,"measured_runtime_v1":0.2507305129,"runtime_lift":6.0764414622,"key":["s958779549","s995029254"]} +{"user_id":"u029315034","problem_id":"p03253","language":"python","submission_id_v0":"s594579996","submission_id_v1":"s281376329","cpu_time_v0":178,"cpu_time_v1":23,"memory_v0":14168,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom math import sqrt\n\nfrom scipy.misc import comb\n\n\n\ndef cal_factors(num):\n\n factors = {}\n\n maxmod = int(sqrt(num)) + 1\n\n for mod in range(2, maxmod):\n\n i = 0\n\n while True:\n\n d, q = divmod(num, mod)\n\n if q == 0:\n\n num = d\n\n i += 1\n\n factors[mod] = i\n\n else:\n\n break\n\n\n\n if num > 1:\n\n factors[num] = 1\n\n\n\n return factors\n\n\n\n\n\nn, m = [int(v) for v in input().split()]\n\n\n\nmod = 1000000000 + 7\n\nfactors = cal_factors(m)\n\nans = 1\n\nfor v in list(factors.values()):\n\n ans *= comb(v + n - 1, v, exact=True) % mod\n\n ans %= mod\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"from math import sqrt\n\n\n\ndef cal_factors(num):\n\n factors = {}\n\n maxmod = int(sqrt(num)) + 1\n\n for mod in range(2, maxmod):\n\n i = 0\n\n while True:\n\n d, q = divmod(num, mod)\n\n if q == 0:\n\n num = d\n\n i += 1\n\n factors[mod] = i\n\n else:\n\n break\n\n\n\n if num > 1:\n\n factors[num] = 1\n\n\n\n return factors\n\n\n\n\n\ndef comb(n, r, mod):\n\n result = 1\n\n r = min(r, n-r)\n\n for i in range(n, n-r, -1):\n\n result *= i\n\n for i in range(2, r+1):\n\n result \/\/= i\n\n\n\n return result % mod\n\n\n\n\n\nn, m = [int(v) for v in input().split()]\n\n\n\nmod = 1000000000 + 7\n\nfactors = cal_factors(m)\n\nans = 1\n\nfor v in list(factors.values()):\n\n ans *= comb(v + n - 1, v, mod)\n\n ans %= mod\n\n\n\nprint(ans)","code_v0_loc":33,"code_v1_loc":43,"code_v0_num_chars":661,"code_v1_num_chars":814,"code_v0_no_empty_lines":"from math import sqrt\nfrom scipy.misc import comb\n\n\ndef cal_factors(num):\n factors = {}\n maxmod = int(sqrt(num)) + 1\n for mod in range(2, maxmod):\n i = 0\n while True:\n d, q = divmod(num, mod)\n if q == 0:\n num = d\n i += 1\n factors[mod] = i\n else:\n break\n if num > 1:\n factors[num] = 1\n return factors\n\n\nn, m = [int(v) for v in input().split()]\nmod = 1000000000 + 7\nfactors = cal_factors(m)\nans = 1\nfor v in list(factors.values()):\n ans *= comb(v + n - 1, v, exact=True) % mod\n ans %= mod\nprint(ans)\n","code_v1_no_empty_lines":"from math import sqrt\n\n\ndef cal_factors(num):\n factors = {}\n maxmod = int(sqrt(num)) + 1\n for mod in range(2, maxmod):\n i = 0\n while True:\n d, q = divmod(num, mod)\n if q == 0:\n num = d\n i += 1\n factors[mod] = i\n else:\n break\n if num > 1:\n factors[num] = 1\n return factors\n\n\ndef comb(n, r, mod):\n result = 1\n r = min(r, n - r)\n for i in range(n, n - r, -1):\n result *= i\n for i in range(2, r + 1):\n result \/\/= i\n return result % mod\n\n\nn, m = [int(v) for v in input().split()]\nmod = 1000000000 + 7\nfactors = cal_factors(m)\nans = 1\nfor v in list(factors.values()):\n ans *= comb(v + n - 1, v, mod)\n ans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":23.2558139535,"diff":["-from scipy.misc import comb","+def comb(n, r, mod):","+ result = 1","+ r = min(r, n - r)","+ for i in range(n, n - r, -1):","+ result *= i","+ for i in range(2, r + 1):","+ result \/\/= i","+ return result % mod","+","+","- ans *= comb(v + n - 1, v, exact=True) % mod","+ ans *= comb(v + n - 1, v, mod)"],"diff_only_import_comment":false,"measured_runtime_v0":0.6768635447,"measured_runtime_v1":0.1470470848,"runtime_lift":4.6030395335,"key":["s594579996","s281376329"]} +{"user_id":"u882564128","problem_id":"p03371","language":"python","submission_id_v0":"s136733954","submission_id_v1":"s827725289","cpu_time_v0":100,"cpu_time_v1":70,"memory_v0":9180,"memory_v1":9068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na, b, c, x, y = list(map(int, input().split(' ')))\n\n\n\nc = int(c*2)\n\nm = float('inf')\n\nfor i in range(10**5+1):\n\n m = min(m, a*max(0, x-i)+b*max(0,y-i)+c*i)\n\nprint(m)\n\n# optimized version of the same code:\n","target":"import math\n\na, b, c, x, y = list(map(int, input().split(' ')))\n\nans = float('inf')\n\nc = c*2\n\nfor i in range(max(x, y)+1):\n\n if i > x:\n\n price = b*(y-i) + c*i\n\n elif i > y:\n\n price = a*(x-i) + c*i\n\n else:\n\n price = a*(x-i) + b*(y-i) + c*i\n\n\n\n if ans > price:\n\n ans = price\n\nprint(ans)","code_v0_loc":7,"code_v1_loc":15,"code_v0_num_chars":162,"code_v1_num_chars":318,"code_v0_no_empty_lines":"a, b, c, x, y = list(map(int, input().split(\" \")))\nc = int(c * 2)\nm = float(\"inf\")\nfor i in range(10**5 + 1):\n m = min(m, a * max(0, x - i) + b * max(0, y - i) + c * i)\nprint(m)\n","code_v1_no_empty_lines":"import math\n\na, b, c, x, y = list(map(int, input().split(\" \")))\nans = float(\"inf\")\nc = c * 2\nfor i in range(max(x, y) + 1):\n if i > x:\n price = b * (y - i) + c * i\n elif i > y:\n price = a * (x - i) + c * i\n else:\n price = a * (x - i) + b * (y - i) + c * i\n if ans > price:\n ans = price\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":53.3333333333,"diff":["+import math","+","-c = int(c * 2)","-m = float(\"inf\")","-for i in range(10**5 + 1):","- m = min(m, a * max(0, x - i) + b * max(0, y - i) + c * i)","-print(m)","+ans = float(\"inf\")","+c = c * 2","+for i in range(max(x, y) + 1):","+ if i > x:","+ price = b * (y - i) + c * i","+ elif i > y:","+ price = a * (x - i) + c * i","+ else:","+ price = a * (x - i) + b * (y - i) + c * i","+ if ans > price:","+ ans = price","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.0457227323,"measured_runtime_v1":0.348341011,"runtime_lift":3.0020086614,"key":["s136733954","s827725289"]} +{"user_id":"u094191970","problem_id":"p03575","language":"python","submission_id_v0":"s541572320","submission_id_v1":"s786496298","cpu_time_v0":431,"cpu_time_v1":33,"memory_v0":22604,"memory_v1":3444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.34,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\nn,m=list(map(int,input().split()))\n\nl=[list(map(int,input().split())) for i in range(m)]\n\n\n\nans=0\n\nfor i in range(m):\n\n ll=l[:i]+l[i+1:]\n\n\n\n d=[[float('inf')]*n for i in range(n)]\n\n for i in range(n):\n\n d[i][i]=0\n\n\n\n for j in ll:\n\n d[j[0]-1][j[1]-1]=1\n\n d[j[1]-1][j[0]-1]=1\n\n\n\n d=floyd_warshall(d)\n\n\n\n if float('inf') in d:\n\n ans+=1\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"class UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n\n\n def group_count(self):\n\n return len(self.roots())\n\n\n\nfrom copy import deepcopy\n\n\n\nn,m=list(map(int,input().split()))\n\nl=[list(map(int,input().split())) for i in range(m)]\n\n\n\ncnt=0\n\nfor i in range(m):\n\n uf=UnionFind(n)\n\n ll=deepcopy(l)\n\n del ll[i]\n\n for a,b in ll:\n\n a-=1\n\n b-=1\n\n uf.union(a,b)\n\n if uf.group_count()>=2:\n\n cnt+=1\n\nprint(cnt)","code_v0_loc":23,"code_v1_loc":48,"code_v0_num_chars":437,"code_v1_num_chars":1017,"code_v0_no_empty_lines":"from scipy.sparse.csgraph import floyd_warshall\n\nn, m = list(map(int, input().split()))\nl = [list(map(int, input().split())) for i in range(m)]\nans = 0\nfor i in range(m):\n ll = l[:i] + l[i + 1 :]\n d = [[float(\"inf\")] * n for i in range(n)]\n for i in range(n):\n d[i][i] = 0\n for j in ll:\n d[j[0] - 1][j[1] - 1] = 1\n d[j[1] - 1][j[0] - 1] = 1\n d = floyd_warshall(d)\n if float(\"inf\") in d:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"class UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n\nfrom copy import deepcopy\n\nn, m = list(map(int, input().split()))\nl = [list(map(int, input().split())) for i in range(m)]\ncnt = 0\nfor i in range(m):\n uf = UnionFind(n)\n ll = deepcopy(l)\n del ll[i]\n for a, b in ll:\n a -= 1\n b -= 1\n uf.union(a, b)\n if uf.group_count() >= 2:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":52.0833333333,"diff":["-from scipy.sparse.csgraph import floyd_warshall","+class UnionFind:","+ def __init__(self, n):","+ self.n = n","+ self.parents = [-1] * n","+","+ def find(self, x):","+ if self.parents[x] < 0:","+ return x","+ else:","+ self.parents[x] = self.find(self.parents[x])","+ return self.parents[x]","+","+ def union(self, x, y):","+ x = self.find(x)","+ y = self.find(y)","+ if x == y:","+ return","+ if self.parents[x] > self.parents[y]:","+ x, y = y, x","+ self.parents[x] += self.parents[y]","+ self.parents[y] = x","+","+ def roots(self):","+ return [i for i, x in enumerate(self.parents) if x < 0]","+","+ def group_count(self):","+ return len(self.roots())","+","+","+from copy import deepcopy","-ans = 0","+cnt = 0","- ll = l[:i] + l[i + 1 :]","- d = [[float(\"inf\")] * n for i in range(n)]","- for i in range(n):","- d[i][i] = 0","- for j in ll:","- d[j[0] - 1][j[1] - 1] = 1","- d[j[1] - 1][j[0] - 1] = 1","- d = floyd_warshall(d)","- if float(\"inf\") in d:","- ans += 1","-print(ans)","+ uf = UnionFind(n)","+ ll = deepcopy(l)","+ del ll[i]","+ for a, b in ll:","+ a -= 1","+ b -= 1","+ uf.union(a, b)","+ if uf.group_count() >= 2:","+ cnt += 1","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":2.1057568979,"measured_runtime_v1":0.2238623059,"runtime_lift":9.4064826571,"key":["s541572320","s786496298"]} +{"user_id":"u547492399","problem_id":"p02414","language":"python","submission_id_v0":"s921780738","submission_id_v1":"s807901791","cpu_time_v0":510,"cpu_time_v1":320,"memory_v0":9192,"memory_v1":9076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.25,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, m, l = list(map(int, input().split()))\n\n\n\na = [0]*n\n\nb = [0]*m\n\nc = [[0 for col in range(l)] for row in range(n)]\n\n\n\nfor i in range(n):\n\n a[i] = list(map(int,input().split()))\n\n\n\nfor i in range(m):\n\n b[i] = list(map(int,input().split()))\n\n\n\n\n\nfor i in range(n):\n\n for j in range(l):\n\n for k in range(m):\n\n c[i][j] += a[i][k]*b[k][j]\n\n print((*c[i]))\n\n# optimized version of the same code:\n","target":"n, m, l = list(map(int, input().split()))\n\n\n\na = [0]*n\n\nb = [0]*m\n\nc = [[0 for col in range(l)] for row in range(n)]\n\n\n\nfor i in range(n):\n\n a[i] = list(map(int,input().split()))\n\n\n\nfor i in range(m):\n\n b[i] = list(map(int,input().split()))\n\n\n\n\n\nfor i in range(n):\n\n for j in range(l):\n\n c[i][j] = sum([a[i][k]*b[k][j] for k in range(m)])\n\n# for k in range(m):\n\n# c[i][j] += a[i][k]*b[k][j]\n\n print((*c[i]))","code_v0_loc":18,"code_v1_loc":19,"code_v0_num_chars":380,"code_v1_num_chars":442,"code_v0_no_empty_lines":"n, m, l = list(map(int, input().split()))\na = [0] * n\nb = [0] * m\nc = [[0 for col in range(l)] for row in range(n)]\nfor i in range(n):\n a[i] = list(map(int, input().split()))\nfor i in range(m):\n b[i] = list(map(int, input().split()))\nfor i in range(n):\n for j in range(l):\n for k in range(m):\n c[i][j] += a[i][k] * b[k][j]\n print((*c[i]))\n","code_v1_no_empty_lines":"n, m, l = list(map(int, input().split()))\na = [0] * n\nb = [0] * m\nc = [[0 for col in range(l)] for row in range(n)]\nfor i in range(n):\n a[i] = list(map(int, input().split()))\nfor i in range(m):\n b[i] = list(map(int, input().split()))\nfor i in range(n):\n for j in range(l):\n c[i][j] = sum([a[i][k] * b[k][j] for k in range(m)])\n # for k in range(m):\n # c[i][j] += a[i][k]*b[k][j]\n print((*c[i]))\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["- for k in range(m):","- c[i][j] += a[i][k] * b[k][j]","+ c[i][j] = sum([a[i][k] * b[k][j] for k in range(m)])","+ # for k in range(m):","+ # c[i][j] += a[i][k]*b[k][j]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2572952261,"measured_runtime_v1":0.1473404789,"runtime_lift":1.7462629958,"key":["s921780738","s807901791"]} +{"user_id":"u729133443","problem_id":"p02983","language":"python","submission_id_v0":"s140577970","submission_id_v1":"s371672772","cpu_time_v0":591,"cpu_time_v1":74,"memory_v0":40556,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nl,r=list(map(int,input().split()))\n\ns=list(range(l,r+1))[:2019]\n\nprint((min(i*j%2019for i in s for j in s if i= Mod:\n\n b[i] %= Mod\n\nprint((b[N]))\n\n# optimized version of the same code:\n","target":"# https:\/\/atcoder.jp\/contests\/abc129\/submissions\/5841482 \u3092\u53c2\u8003 \n\nN,M = list(map(int, input().split()))\n\nA = [int(eval(input())) for _ in range(M)]\n\nMOD = 10**9 + 7\n\nF = [1]*(N+1)\n\nfor j in A:\n\n F[j-1] = 0\n\n \n\na = 1; b = 0\n\nfor i in range(N):\n\n if not F[i]: #F[i] == 0\n\n a, b = 0, a\n\n else:\n\n a, b = ((a+b) % MOD), a\n\nprint(a)","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":320,"code_v1_num_chars":337,"code_v0_no_empty_lines":"Mod = 10**9 + 7\nN, M = list(map(int, input().split()))\na = [int(eval(input())) for _ in range(M)]\nb = [1] * (N + 1)\nfor j in a:\n b[j] = 0\nfor i in range(1, N + 1):\n if b[i] == 0:\n continue\n if i == 1:\n b[1] = 1\n continue\n b[i] = b[i - 1] + b[i - 2]\n if b[i] >= Mod:\n b[i] %= Mod\nprint((b[N]))\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc129\/submissions\/5841482 \u3092\u53c2\u8003\nN, M = list(map(int, input().split()))\nA = [int(eval(input())) for _ in range(M)]\nMOD = 10**9 + 7\nF = [1] * (N + 1)\nfor j in A:\n F[j - 1] = 0\na = 1\nb = 0\nfor i in range(N):\n if not F[i]: # F[i] == 0\n a, b = 0, a\n else:\n a, b = ((a + b) % MOD), a\nprint(a)\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["-Mod = 10**9 + 7","+# https:\/\/atcoder.jp\/contests\/abc129\/submissions\/5841482 \u3092\u53c2\u8003","-a = [int(eval(input())) for _ in range(M)]","-b = [1] * (N + 1)","-for j in a:","- b[j] = 0","-for i in range(1, N + 1):","- if b[i] == 0:","- continue","- if i == 1:","- b[1] = 1","- continue","- b[i] = b[i - 1] + b[i - 2]","- if b[i] >= Mod:","- b[i] %= Mod","-print((b[N]))","+A = [int(eval(input())) for _ in range(M)]","+MOD = 10**9 + 7","+F = [1] * (N + 1)","+for j in A:","+ F[j - 1] = 0","+a = 1","+b = 0","+for i in range(N):","+ if not F[i]: # F[i] == 0","+ a, b = 0, a","+ else:","+ a, b = ((a + b) % MOD), a","+print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2807373931,"measured_runtime_v1":0.2199227238,"runtime_lift":1.2765274471,"key":["s190076821","s577413214"]} +{"user_id":"u247830763","problem_id":"p02555","language":"python","submission_id_v0":"s099094742","submission_id_v1":"s047523250","cpu_time_v0":119,"cpu_time_v1":62,"memory_v0":9192,"memory_v1":63452,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.9,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input()))\n\nmx = n\/\/3\n\nans = 0\n\nmod = 10**9+7\n\nimport math\n\ndef combinations_count(n, r): #\u7d44\u307f\u5408\u308f\u305b(nCr)\n\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\nfor i in range(1,mx+1):\n\n if i == 1:\n\n ans += 1\n\n else:\n\n ans += combinations_count(n-2*i-1,i-1) % mod\n\nprint((ans%mod))\n\n# optimized version of the same code:\n","target":"s = int(eval(input()))\n\ndp = [0]*(2001)\n\ndp[3] = 1\n\nmod = 10**9+7\n\nfor i in range(4,s+1):\n\n dp[i] = (dp[i-1] + dp[i-3]) % mod\n\nprint((dp[s]))","code_v0_loc":13,"code_v1_loc":7,"code_v0_num_chars":324,"code_v1_num_chars":136,"code_v0_no_empty_lines":"n = int(eval(input()))\nmx = n \/\/ 3\nans = 0\nmod = 10**9 + 7\nimport math\n\n\ndef combinations_count(n, r): # \u7d44\u307f\u5408\u308f\u305b(nCr)\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\nfor i in range(1, mx + 1):\n if i == 1:\n ans += 1\n else:\n ans += combinations_count(n - 2 * i - 1, i - 1) % mod\nprint((ans % mod))\n","code_v1_no_empty_lines":"s = int(eval(input()))\ndp = [0] * (2001)\ndp[3] = 1\nmod = 10**9 + 7\nfor i in range(4, s + 1):\n dp[i] = (dp[i - 1] + dp[i - 3]) % mod\nprint((dp[s]))\n","code_same":false,"relative_loc_diff_percent":46.1538461538,"diff":["-n = int(eval(input()))","-mx = n \/\/ 3","-ans = 0","+s = int(eval(input()))","+dp = [0] * (2001)","+dp[3] = 1","-import math","-","-","-def combinations_count(n, r): # \u7d44\u307f\u5408\u308f\u305b(nCr)","- return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))","-","-","-for i in range(1, mx + 1):","- if i == 1:","- ans += 1","- else:","- ans += combinations_count(n - 2 * i - 1, i - 1) % mod","-print((ans % mod))","+for i in range(4, s + 1):","+ dp[i] = (dp[i - 1] + dp[i - 3]) % mod","+print((dp[s]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2684851468,"measured_runtime_v1":0.2075273387,"runtime_lift":1.2937338684,"key":["s099094742","s047523250"]} +{"user_id":"u321071346","problem_id":"p03494","language":"python","submission_id_v0":"s013135216","submission_id_v1":"s040740173","cpu_time_v0":118,"cpu_time_v1":30,"memory_v0":27148,"memory_v1":9044,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.58,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn = int(eval(input()))\n\na_list = np.array(list(map(int, input().split())))\n\n\n\ncounter = 0\n\nwhile True:\n\n if np.sum(a_list % 2) > 0:\n\n break\n\n counter += 1\n\n a_list = a_list \/ 2\n\nprint(counter)\n\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\na_list = list(map(int, input().split()))\n\n\n\nstatus = True\n\nexecute = 0\n\nwhile status:\n\n for i in range(n):\n\n if a_list[i] % 2 == 1:\n\n status = False\n\n break\n\n else:\n\n a_list[i] = a_list[i] \/ 2\n\n if status:\n\n execute += 1\n\nprint(execute)\n","code_v0_loc":11,"code_v1_loc":15,"code_v0_num_chars":223,"code_v1_num_chars":315,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\na_list = np.array(list(map(int, input().split())))\ncounter = 0\nwhile True:\n if np.sum(a_list % 2) > 0:\n break\n counter += 1\n a_list = a_list \/ 2\nprint(counter)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na_list = list(map(int, input().split()))\nstatus = True\nexecute = 0\nwhile status:\n for i in range(n):\n if a_list[i] % 2 == 1:\n status = False\n break\n else:\n a_list[i] = a_list[i] \/ 2\n if status:\n execute += 1\nprint(execute)\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["-import numpy as np","-","-a_list = np.array(list(map(int, input().split())))","-counter = 0","-while True:","- if np.sum(a_list % 2) > 0:","- break","- counter += 1","- a_list = a_list \/ 2","-print(counter)","+a_list = list(map(int, input().split()))","+status = True","+execute = 0","+while status:","+ for i in range(n):","+ if a_list[i] % 2 == 1:","+ status = False","+ break","+ else:","+ a_list[i] = a_list[i] \/ 2","+ if status:","+ execute += 1","+print(execute)"],"diff_only_import_comment":false,"measured_runtime_v0":1.2315113308,"measured_runtime_v1":0.1929617555,"runtime_lift":6.3821523985,"key":["s013135216","s040740173"]} +{"user_id":"u207799478","problem_id":"p03568","language":"python","submission_id_v0":"s195491532","submission_id_v1":"s278252901","cpu_time_v0":90,"cpu_time_v1":25,"memory_v0":3832,"memory_v1":3832,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.22,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nimport string\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)\/\/(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\n\nn = int(eval(input()))\n\na = readints()\n\n\n\n\n\ndef func(l):\n\n if len(l) == n:\n\n for i in range(len(l)):\n\n if l[i] % 2 == 0:\n\n return 1\n\n\n\n return 0\n\n return func(l+[(a[len(l)])])+func(l+[(a[len(l)]-1)])+func(l+[(a[len(l)]+1)])\n\n\n\n\n\nprint((func([])))\n\n\n# optimized version of the same code:\n","target":"import math\n\nimport string\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)\/\/(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\n\nn = int(eval(input()))\n\na = readints()\n\nsum = 1\n\nfor i in range(len(a)):\n\n if a[i] % 2 == 0:\n\n sum *= 2\n\n else:\n\n sum *= 1\n\nprint((3**len(a)-sum))\n","code_v0_loc":47,"code_v1_loc":41,"code_v0_num_chars":865,"code_v1_num_chars":739,"code_v0_no_empty_lines":"import math\nimport string\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not (item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n + 1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\nn = int(eval(input()))\na = readints()\n\n\ndef func(l):\n if len(l) == n:\n for i in range(len(l)):\n if l[i] % 2 == 0:\n return 1\n return 0\n return (\n func(l + [(a[len(l)])])\n + func(l + [(a[len(l)] - 1)])\n + func(l + [(a[len(l)] + 1)])\n )\n\n\nprint((func([])))\n","code_v1_no_empty_lines":"import math\nimport string\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not (item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n + 1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\nn = int(eval(input()))\na = readints()\nsum = 1\nfor i in range(len(a)):\n if a[i] % 2 == 0:\n sum *= 2\n else:\n sum *= 1\nprint((3 ** len(a) - sum))\n","code_same":false,"relative_loc_diff_percent":12.7659574468,"diff":["-","-","-def func(l):","- if len(l) == n:","- for i in range(len(l)):","- if l[i] % 2 == 0:","- return 1","- return 0","- return (","- func(l + [(a[len(l)])])","- + func(l + [(a[len(l)] - 1)])","- + func(l + [(a[len(l)] + 1)])","- )","-","-","-print((func([])))","+sum = 1","+for i in range(len(a)):","+ if a[i] % 2 == 0:","+ sum *= 2","+ else:","+ sum *= 1","+print((3 ** len(a) - sum))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3073070612,"measured_runtime_v1":0.2000235903,"runtime_lift":1.5363540904,"key":["s195491532","s278252901"]} +{"user_id":"u378157957","problem_id":"p03796","language":"python","submission_id_v0":"s064171222","submission_id_v1":"s323999427","cpu_time_v0":230,"cpu_time_v1":58,"memory_v0":3984,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.78,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\nN = int(eval(input()))\n\n\n\nnum = math.factorial(N)\n\n\n\nk, r = divmod(num, 10**9 + 7)\n\nprint(r)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\n\n\nFACTOR = 10 ** 9 + 7\n\n\n\nnum = 1\n\nfor i in range(1, N+1):\n\n num *= i\n\n k, r = divmod(num, FACTOR)\n\n num = r\n\n\n\nprint(r)","code_v0_loc":8,"code_v1_loc":11,"code_v0_num_chars":101,"code_v1_num_chars":147,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nnum = math.factorial(N)\nk, r = divmod(num, 10**9 + 7)\nprint(r)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nFACTOR = 10**9 + 7\nnum = 1\nfor i in range(1, N + 1):\n num *= i\n k, r = divmod(num, FACTOR)\n num = r\nprint(r)\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-import math","-","-num = math.factorial(N)","-k, r = divmod(num, 10**9 + 7)","+FACTOR = 10**9 + 7","+num = 1","+for i in range(1, N + 1):","+ num *= i","+ k, r = divmod(num, FACTOR)","+ num = r"],"diff_only_import_comment":false,"measured_runtime_v0":0.6578995652,"measured_runtime_v1":0.3768342862,"runtime_lift":1.7458590932,"key":["s064171222","s323999427"]} +{"user_id":"u312025627","problem_id":"p03241","language":"python","submission_id_v0":"s848556972","submission_id_v1":"s836748791","cpu_time_v0":174,"cpu_time_v1":20,"memory_v0":38640,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.51,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n N, M = (int(i) for i in input().split())\n\n\n\n def trial_division(n):\n\n divs = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divs.append(i)\n\n if i != n\/\/i:\n\n divs.append(n\/\/i)\n\n divs.sort(reverse=True)\n\n return divs\n\n divs = trial_division(M)\n\n for d in divs:\n\n if d*N <= M:\n\n return print(d)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"def main():\n\n def trial_division(n):\n\n divs = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divs.append(i)\n\n if i != n\/\/i:\n\n divs.append(n\/\/i)\n\n divs.sort(reverse=True)\n\n return divs\n\n\n\n N, M = (int(i) for i in input().split())\n\n divs = trial_division(M)\n\n for d in divs:\n\n if N*d <= M:\n\n return print(d)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":20,"code_v1_loc":20,"code_v0_num_chars":479,"code_v1_num_chars":479,"code_v0_no_empty_lines":"def main():\n N, M = (int(i) for i in input().split())\n\n def trial_division(n):\n divs = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divs.append(i)\n if i != n \/\/ i:\n divs.append(n \/\/ i)\n divs.sort(reverse=True)\n return divs\n\n divs = trial_division(M)\n for d in divs:\n if d * N <= M:\n return print(d)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n def trial_division(n):\n divs = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divs.append(i)\n if i != n \/\/ i:\n divs.append(n \/\/ i)\n divs.sort(reverse=True)\n return divs\n\n N, M = (int(i) for i in input().split())\n divs = trial_division(M)\n for d in divs:\n if N * d <= M:\n return print(d)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- N, M = (int(i) for i in input().split())","-","+ N, M = (int(i) for i in input().split())","- if d * N <= M:","+ if N * d <= M:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3135980744,"measured_runtime_v1":0.0063253348,"runtime_lift":49.5780989437,"key":["s848556972","s836748791"]} +{"user_id":"u010110540","problem_id":"p03796","language":"python","submission_id_v0":"s700640855","submission_id_v1":"s281752333","cpu_time_v0":230,"cpu_time_v1":40,"memory_v0":3984,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\n\n\nN = int(eval(input()))\n\nC = 10**9 + 7\n\n\n\nprint((math.factorial(N) % C))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nC = 10**9+7\n\nans = 1\n\nfor i in range(1, N + 1):\n\n ans *= i\n\n ans %= C\n\nprint(ans)","code_v0_loc":6,"code_v1_loc":7,"code_v0_num_chars":78,"code_v1_num_chars":105,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nC = 10**9 + 7\nprint((math.factorial(N) % C))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nC = 10**9 + 7\nans = 1\nfor i in range(1, N + 1):\n ans *= i\n ans %= C\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-import math","-","-print((math.factorial(N) % C))","+ans = 1","+for i in range(1, N + 1):","+ ans *= i","+ ans %= C","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.7524980175,"measured_runtime_v1":0.4259025633,"runtime_lift":1.7668313889,"key":["s700640855","s281752333"]} +{"user_id":"u754022296","problem_id":"p04017","language":"python","submission_id_v0":"s083196734","submission_id_v1":"s862767700","cpu_time_v0":1272,"cpu_time_v1":635,"memory_v0":90144,"memory_v1":80288,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.08,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nimport bisect\n\n\n\nn = int(eval(input()))\n\nX = list(map(int, input().split()))\n\nl = int(eval(input()))\n\nU = 17\n\ndp = [[0]*n for _ in range(U+1)]\n\nfor i, x in enumerate(X):\n\n t = bisect.bisect_left(X, x+l)\n\n dp[0][i] = bisect.bisect_right(X, x+l) - 1\n\nfor k in range(U):\n\n for i in range(n):\n\n dp[k+1][i] = dp[k][dp[k][i]]\n\ndef test(x, a, b):\n\n for i in range(U, -1, -1):\n\n if x >> i & 1:\n\n a = dp[i][a]\n\n return a >= b\n\ndef solve(a, b):\n\n if a > b:\n\n a, b = b, a\n\n ng = 0\n\n ok = n-1\n\n while ok - ng > 1:\n\n mid = (ng + ok) \/\/ 2\n\n if test(mid, a, b):\n\n ok = mid\n\n else:\n\n ng = mid\n\n print(ok)\n\nq = int(eval(input()))\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n solve(a, b)\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.readline\n\nimport bisect\n\n\n\nn = int(eval(input()))\n\nX = list(map(int, input().split()))\n\nl = int(eval(input()))\n\nU = 17\n\ndp = [[0]*n for _ in range(U+1)]\n\nfor i, x in enumerate(X):\n\n t = bisect.bisect_left(X, x+l)\n\n dp[0][i] = bisect.bisect_right(X, x+l) - 1\n\nfor k in range(U):\n\n for i in range(n):\n\n dp[k+1][i] = dp[k][dp[k][i]]\n\nq = int(eval(input()))\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n if a > b:\n\n a, b = b, a\n\n res = 1\n\n for k in range(U, -1, -1):\n\n if dp[k][a] < b:\n\n a = dp[k][a]\n\n res += (1<> i & 1:\n a = dp[i][a]\n return a >= b\n\n\ndef solve(a, b):\n if a > b:\n a, b = b, a\n ng = 0\n ok = n - 1\n while ok - ng > 1:\n mid = (ng + ok) \/\/ 2\n if test(mid, a, b):\n ok = mid\n else:\n ng = mid\n print(ok)\n\n\nq = int(eval(input()))\nfor _ in range(q):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n solve(a, b)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nimport bisect\n\nn = int(eval(input()))\nX = list(map(int, input().split()))\nl = int(eval(input()))\nU = 17\ndp = [[0] * n for _ in range(U + 1)]\nfor i, x in enumerate(X):\n t = bisect.bisect_left(X, x + l)\n dp[0][i] = bisect.bisect_right(X, x + l) - 1\nfor k in range(U):\n for i in range(n):\n dp[k + 1][i] = dp[k][dp[k][i]]\nq = int(eval(input()))\nfor _ in range(q):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n if a > b:\n a, b = b, a\n res = 1\n for k in range(U, -1, -1):\n if dp[k][a] < b:\n a = dp[k][a]\n res += 1 << k\n if a == b:\n break\n print(res)\n","code_same":false,"relative_loc_diff_percent":21.0526315789,"diff":["-","-","-def test(x, a, b):","- for i in range(U, -1, -1):","- if x >> i & 1:","- a = dp[i][a]","- return a >= b","-","-","-def solve(a, b):","- if a > b:","- a, b = b, a","- ng = 0","- ok = n - 1","- while ok - ng > 1:","- mid = (ng + ok) \/\/ 2","- if test(mid, a, b):","- ok = mid","- else:","- ng = mid","- print(ok)","-","-","- solve(a, b)","+ if a > b:","+ a, b = b, a","+ res = 1","+ for k in range(U, -1, -1):","+ if dp[k][a] < b:","+ a = dp[k][a]","+ res += 1 << k","+ if a == b:","+ break","+ print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.33038889,"measured_runtime_v1":0.2620919657,"runtime_lift":1.2605838152,"key":["s083196734","s862767700"]} +{"user_id":"u216015528","problem_id":"p03164","language":"python","submission_id_v0":"s162537560","submission_id_v1":"s108250483","cpu_time_v0":915,"cpu_time_v1":682,"memory_v0":50204,"memory_v1":50172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.46,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!\/usr\/bin\/env python3\n\ndef main():\n\n import numpy as np\n\n\n\n np.set_printoptions(linewidth=200)\n\n\n\n N, W = list(map(int, input().split()))\n\n lst = [list(map(int, input().split())) for _ in range(N)]\n\n v_max = 10 ** 3 * 100 * 10\n\n w_max = 10 ** 9 * v_max\n\n\n\n # i\u4ee5\u4e0a\u306e\u4fa1\u5024\u3092\u6301\u3064\u3068\u304d\u306e\u6700\u5c0f\u91cd\u91cf\n\n dp = np.full(v_max, w_max, dtype=np.int64)\n\n # initialize\n\n dp[0] = 0\n\n\n\n for n in range(N):\n\n w, v = lst[n]\n\n dp[v:] = np.minimum(dp[v:], dp[:-v] + w)\n\n\n\n ans = 0\n\n for i, w in enumerate(dp):\n\n if w <= W:\n\n ans = i\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"#!\/usr\/bin\/env python3\n\ndef main():\n\n import numpy as np\n\n\n\n N, W = list(map(int, input().split()))\n\n lst = [list(map(int, input().split())) for _ in range(N)]\n\n v_max = 10 ** 3 * 100 * 10\n\n w_max = 10 ** 9 * v_max\n\n\n\n # i\u4ee5\u4e0a\u306e\u4fa1\u5024\u3092\u6301\u3064\u3068\u304d\u306e\u6700\u5c0f\u91cd\u91cf\n\n dp = np.full(v_max, w_max, dtype=np.int64)\n\n # initialize\n\n dp[0] = 0\n\n\n\n for w, v in lst:\n\n dp[v:] = np.minimum(dp[v:], dp[:-v] + w)\n\n\n\n print((np.asarray(dp <= W).nonzero()[0].max()))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":29,"code_v1_loc":22,"code_v0_num_chars":620,"code_v1_num_chars":502,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\ndef main():\n import numpy as np\n\n np.set_printoptions(linewidth=200)\n N, W = list(map(int, input().split()))\n lst = [list(map(int, input().split())) for _ in range(N)]\n v_max = 10**3 * 100 * 10\n w_max = 10**9 * v_max\n # i\u4ee5\u4e0a\u306e\u4fa1\u5024\u3092\u6301\u3064\u3068\u304d\u306e\u6700\u5c0f\u91cd\u91cf\n dp = np.full(v_max, w_max, dtype=np.int64)\n # initialize\n dp[0] = 0\n for n in range(N):\n w, v = lst[n]\n dp[v:] = np.minimum(dp[v:], dp[:-v] + w)\n ans = 0\n for i, w in enumerate(dp):\n if w <= W:\n ans = i\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\ndef main():\n import numpy as np\n\n N, W = list(map(int, input().split()))\n lst = [list(map(int, input().split())) for _ in range(N)]\n v_max = 10**3 * 100 * 10\n w_max = 10**9 * v_max\n # i\u4ee5\u4e0a\u306e\u4fa1\u5024\u3092\u6301\u3064\u3068\u304d\u306e\u6700\u5c0f\u91cd\u91cf\n dp = np.full(v_max, w_max, dtype=np.int64)\n # initialize\n dp[0] = 0\n for w, v in lst:\n dp[v:] = np.minimum(dp[v:], dp[:-v] + w)\n print((np.asarray(dp <= W).nonzero()[0].max()))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":24.1379310345,"diff":["- np.set_printoptions(linewidth=200)","- for n in range(N):","- w, v = lst[n]","+ for w, v in lst:","- ans = 0","- for i, w in enumerate(dp):","- if w <= W:","- ans = i","- print(ans)","+ print((np.asarray(dp <= W).nonzero()[0].max()))"],"diff_only_import_comment":false,"measured_runtime_v0":2.6562573321,"measured_runtime_v1":1.670549144,"runtime_lift":1.5900503984,"key":["s162537560","s108250483"]} +{"user_id":"u844005364","problem_id":"p02994","language":"python","submission_id_v0":"s135697405","submission_id_v1":"s243236458","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn, like = list(map(int, input().split()))\n\n\n\narr = [like + i for i in range(n)]\n\n\n\narr.sort(key=lambda x:abs(x))\n\n\n\nprint((sum(arr[1:])))\n\n\n# optimized version of the same code:\n","target":"n, like = list(map(int, input().split()))\n\narr = [like + i for i in range(n)]\n\narr.sort(key=abs)\n\nprint((sum(arr[1:])))\n","code_v0_loc":7,"code_v1_loc":4,"code_v0_num_chars":130,"code_v1_num_chars":112,"code_v0_no_empty_lines":"n, like = list(map(int, input().split()))\narr = [like + i for i in range(n)]\narr.sort(key=lambda x: abs(x))\nprint((sum(arr[1:])))\n","code_v1_no_empty_lines":"n, like = list(map(int, input().split()))\narr = [like + i for i in range(n)]\narr.sort(key=abs)\nprint((sum(arr[1:])))\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-arr.sort(key=lambda x: abs(x))","+arr.sort(key=abs)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2677221475,"measured_runtime_v1":0.0993615375,"runtime_lift":2.6944243647,"key":["s135697405","s243236458"]} +{"user_id":"u296150111","problem_id":"p02937","language":"python","submission_id_v0":"s421754829","submission_id_v1":"s024807040","cpu_time_v0":1985,"cpu_time_v1":360,"memory_v0":114612,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns=eval(input())\n\nt=eval(input())\n\ns*=2\n\nnext=[[-1]*26 for _ in range(len(s))]\n\nalph=[[]for _ in range(26)]\n\nfor i in range(len(s)):\n\n\talph[ord(s[i])-ord(\"a\")].append(i)\n\nfrom bisect import bisect_right\n\nfor i in range(len(s)\/\/2):\n\n\tfor j in range(26):\n\n\t\tif len(alph[j])>bisect_right(alph[j],i):\n\n\t\t\tnext[i][j]=alph[j][bisect_right(alph[j],i)]\n\nans=1\n\nnow=len(s)\/\/2-1\n\nfor x in t:\n\n\tr=ord(x)-ord(\"a\")\n\n\tnow=next[now][r]\n\n\tif now==-1:\n\n\t\tprint((-1))\n\n\t\texit()\n\n\tif now>=len(s)\/\/2:\n\n\t\tans+=len(s)\/\/2\n\n\t\tnow-=len(s)\/\/2\n\nprint((ans+now-len(s)\/\/2))\n\n# optimized version of the same code:\n","target":"#O(|S|log|s|)\n\ndef main():\n\n\ts=eval(input())\n\n\tt=eval(input())\n\n\tn=len(s)\n\n\tnow=-1\n\n\tans=1\n\n\tif not set(t)<=set(s):#t\u304cs\u306e\u90e8\u5206\u96c6\u5408\u3067\u306a\u3044\n\n\t\tprint((-1))\n\n\t\texit()\n\n\tfor x in t:\n\n\t\tnow=s.find(x,now+1)#now\u3088\u308a\u5927\u304d\u3044\u3068\u3053\u308d\u304b\u3089x\u3092\u63a2\u3059\n\n\t\tif now==-1:#now\u3088\u308a\u5927\u304d\u3044\u3068\u3053\u308d\u3067x\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u3089\n\n\t\t\tans+=n\n\n\t\t\tnow=s.find(x)\n\n\tprint((ans+now))\n\nif __name__ == '__main__':\n\n\tmain()","code_v0_loc":24,"code_v1_loc":18,"code_v0_num_chars":527,"code_v1_num_chars":315,"code_v0_no_empty_lines":"s = eval(input())\nt = eval(input())\ns *= 2\nnext = [[-1] * 26 for _ in range(len(s))]\nalph = [[] for _ in range(26)]\nfor i in range(len(s)):\n alph[ord(s[i]) - ord(\"a\")].append(i)\nfrom bisect import bisect_right\n\nfor i in range(len(s) \/\/ 2):\n for j in range(26):\n if len(alph[j]) > bisect_right(alph[j], i):\n next[i][j] = alph[j][bisect_right(alph[j], i)]\nans = 1\nnow = len(s) \/\/ 2 - 1\nfor x in t:\n r = ord(x) - ord(\"a\")\n now = next[now][r]\n if now == -1:\n print((-1))\n exit()\n if now >= len(s) \/\/ 2:\n ans += len(s) \/\/ 2\n now -= len(s) \/\/ 2\nprint((ans + now - len(s) \/\/ 2))\n","code_v1_no_empty_lines":"# O(|S|log|s|)\ndef main():\n s = eval(input())\n t = eval(input())\n n = len(s)\n now = -1\n ans = 1\n if not set(t) <= set(s): # t\u304cs\u306e\u90e8\u5206\u96c6\u5408\u3067\u306a\u3044\n print((-1))\n exit()\n for x in t:\n now = s.find(x, now + 1) # now\u3088\u308a\u5927\u304d\u3044\u3068\u3053\u308d\u304b\u3089x\u3092\u63a2\u3059\n if now == -1: # now\u3088\u308a\u5927\u304d\u3044\u3068\u3053\u308d\u3067x\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u3089\n ans += n\n now = s.find(x)\n print((ans + now))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-s = eval(input())","-t = eval(input())","-s *= 2","-next = [[-1] * 26 for _ in range(len(s))]","-alph = [[] for _ in range(26)]","-for i in range(len(s)):","- alph[ord(s[i]) - ord(\"a\")].append(i)","-from bisect import bisect_right","-","-for i in range(len(s) \/\/ 2):","- for j in range(26):","- if len(alph[j]) > bisect_right(alph[j], i):","- next[i][j] = alph[j][bisect_right(alph[j], i)]","-ans = 1","-now = len(s) \/\/ 2 - 1","-for x in t:","- r = ord(x) - ord(\"a\")","- now = next[now][r]","- if now == -1:","+# O(|S|log|s|)","+def main():","+ s = eval(input())","+ t = eval(input())","+ n = len(s)","+ now = -1","+ ans = 1","+ if not set(t) <= set(s): # t\u304cs\u306e\u90e8\u5206\u96c6\u5408\u3067\u306a\u3044","- if now >= len(s) \/\/ 2:","- ans += len(s) \/\/ 2","- now -= len(s) \/\/ 2","-print((ans + now - len(s) \/\/ 2))","+ for x in t:","+ now = s.find(x, now + 1) # now\u3088\u308a\u5927\u304d\u3044\u3068\u3053\u308d\u304b\u3089x\u3092\u63a2\u3059","+ if now == -1: # now\u3088\u308a\u5927\u304d\u3044\u3068\u3053\u308d\u3067x\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u3089","+ ans += n","+ now = s.find(x)","+ print((ans + now))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2948810172,"measured_runtime_v1":0.1485264051,"runtime_lift":1.9853777313,"key":["s421754829","s024807040"]} +{"user_id":"u325282913","problem_id":"p03371","language":"python","submission_id_v0":"s614340278","submission_id_v1":"s677161923","cpu_time_v0":117,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nA, B, C, X, Y = list(map(int, input().split()))\n\nans = float('inf')\n\nfor i in range(max(X,Y)+1):\n\n cost = 2 * C * i + max(0,X-i)*A +max(0,Y-i)*B\n\n ans = min(ans,cost)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"A, B, C, X, Y = list(map(int, input().split()))\n\ntmp = A*X + B*Y\n\nif X >= Y:\n\n tmp = min(tmp,2*Y*C+(X-Y)*A)\n\nelse:\n\n tmp = min(tmp,2*X*C+(Y-X)*B)\n\ntmp = min(tmp,max(X,Y)*2*C)\n\nprint(tmp)","code_v0_loc":6,"code_v1_loc":8,"code_v0_num_chars":178,"code_v1_num_chars":186,"code_v0_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(max(X, Y) + 1):\n cost = 2 * C * i + max(0, X - i) * A + max(0, Y - i) * B\n ans = min(ans, cost)\nprint(ans)\n","code_v1_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\ntmp = A * X + B * Y\nif X >= Y:\n tmp = min(tmp, 2 * Y * C + (X - Y) * A)\nelse:\n tmp = min(tmp, 2 * X * C + (Y - X) * B)\ntmp = min(tmp, max(X, Y) * 2 * C)\nprint(tmp)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-ans = float(\"inf\")","-for i in range(max(X, Y) + 1):","- cost = 2 * C * i + max(0, X - i) * A + max(0, Y - i) * B","- ans = min(ans, cost)","-print(ans)","+tmp = A * X + B * Y","+if X >= Y:","+ tmp = min(tmp, 2 * Y * C + (X - Y) * A)","+else:","+ tmp = min(tmp, 2 * X * C + (Y - X) * B)","+tmp = min(tmp, max(X, Y) * 2 * C)","+print(tmp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.571060118,"measured_runtime_v1":0.3373241339,"runtime_lift":1.6929121299,"key":["s614340278","s677161923"]} +{"user_id":"u873917047","problem_id":"p03828","language":"python","submission_id_v0":"s924740576","submission_id_v1":"s078000611","cpu_time_v0":523,"cpu_time_v1":182,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.2,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#coding: UTF-8\n\nimport math\n\nN=int(eval(input()))\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N):\n\n plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k\/(i+1)\n\n lis[i]=n\n\n return lis\n\nout_lis=[0]*N\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\nprint((out%1000000007))\n\n# optimized version of the same code:\n","target":"#coding: UTF-8\n\nimport math\n\nN=int(eval(input()))\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N,plist):\n\n# plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k\/(i+1)\n\n lis[i]=n\n\n return lis\n\n# print(lis)\n\nout_lis=[0]*N\n\nplist=prime_list(N)\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N,plist)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\n#print(out%1000000007)\n\nprint((out%(10**9+7)))","code_v0_loc":36,"code_v1_loc":39,"code_v0_num_chars":791,"code_v1_num_chars":865,"code_v0_no_empty_lines":"# coding: UTF-8\nimport math\n\nN = int(eval(input()))\n\n\ndef prime_list(k):\n lis = [True for i in range(1, k + 1)]\n lis[0] = False\n for i in range(2, k + 1):\n j = 2\n while j * j <= i:\n if i % j == 0:\n lis[i - 1] = False\n break\n else:\n j += 1\n return lis\n\n\n# print(lis)\ndef p_fact(k, N):\n plist = prime_list(k)\n lis = [0] * N\n for i in range(0, k):\n n = 0\n if plist[i]:\n while k % (i + 1) == 0:\n n += 1\n k = k \/ (i + 1)\n lis[i] = n\n return lis\n\n\nout_lis = [0] * N\nfor i in range(1, N + 1):\n input_lis = p_fact(i, N)\n out_lis = [out_lis[j] + input_lis[j] for j in range(0, N)]\n# print(out_lis)\nout = 1\nfor i in range(0, N):\n out = out * (out_lis[i] + 1)\nprint((out % 1000000007))\n","code_v1_no_empty_lines":"# coding: UTF-8\nimport math\n\nN = int(eval(input()))\n\n\ndef prime_list(k):\n lis = [True for i in range(1, k + 1)]\n lis[0] = False\n for i in range(2, k + 1):\n j = 2\n while j * j <= i:\n if i % j == 0:\n lis[i - 1] = False\n break\n else:\n j += 1\n return lis\n\n\n# print(lis)\ndef p_fact(k, N, plist):\n # plist=prime_list(k)\n lis = [0] * N\n for i in range(0, k):\n n = 0\n if plist[i]:\n while k % (i + 1) == 0:\n n += 1\n k = k \/ (i + 1)\n lis[i] = n\n return lis\n\n\n# print(lis)\nout_lis = [0] * N\nplist = prime_list(N)\nfor i in range(1, N + 1):\n input_lis = p_fact(i, N, plist)\n out_lis = [out_lis[j] + input_lis[j] for j in range(0, N)]\n# print(out_lis)\nout = 1\nfor i in range(0, N):\n out = out * (out_lis[i] + 1)\n# print(out%1000000007)\nprint((out % (10**9 + 7)))\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-def p_fact(k, N):","- plist = prime_list(k)","+def p_fact(k, N, plist):","+ # plist=prime_list(k)","+# print(lis)","+plist = prime_list(N)","- input_lis = p_fact(i, N)","+ input_lis = p_fact(i, N, plist)","-print((out % 1000000007))","+# print(out%1000000007)","+print((out % (10**9 + 7)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.6020502172,"measured_runtime_v1":0.3540123932,"runtime_lift":1.7006472899,"key":["s924740576","s078000611"]} +{"user_id":"u800534567","problem_id":"p02245","language":"python","submission_id_v0":"s424620538","submission_id_v1":"s007973982","cpu_time_v0":3310,"cpu_time_v1":2340,"memory_v0":34416,"memory_v1":34452,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.31,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport queue\n\n\n\nN = 3\n\nf= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = queue.Queue()\n\nV = dict()\n\n\n\nQ.put([f,f.index('0'),0])\n\nV[f] = True\n\n\n\nwhile not Q.empty():\n\n u = Q.get()\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]\/\/N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 \n\n Q.put(v)\n\n\n\nprint((u[2]))\n\n\n# optimized version of the same code:\n","target":"import sys\n\nimport queue\n\n\n\nN = 3\n\n\n\nf = ''.join(sys.stdin.readline().split())\n\nf += ''.join(sys.stdin.readline().split())\n\nf += ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = [[f,f.index('0'),0]]\n\nV = { f: True }\n\n\n\nwhile len(Q)>0:\n\n u = Q.pop(0)\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]\/\/N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 # dir[r] \n\n Q.append(v)\n\n\n\nprint((u[2]))\n","code_v0_loc":34,"code_v1_loc":32,"code_v0_num_chars":845,"code_v1_num_chars":831,"code_v0_no_empty_lines":"import sys\nimport queue\n\nN = 3\nf = \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\nQ = queue.Queue()\nV = dict()\nQ.put([f, f.index(\"0\"), 0])\nV[f] = True\nwhile not Q.empty():\n u = Q.get()\n if u[0] == \"123456780\":\n break\n sx, sy = u[1] \/\/ N, u[1] % N\n for dx, dy in dd:\n tx, ty = sx + dx, sy + dy\n if tx < 0 or ty < 0 or tx >= N or ty >= N:\n continue\n v = u[:]\n n1, n2 = u[1], tx * N + ty\n v[1] = n2\n if n1 > n2:\n n1, n2 = n2, n1\n v[0] = v[0][0:n1] + v[0][n2] + v[0][n1 + 1 : n2] + v[0][n1] + v[0][n2 + 1 :]\n if not V.get(v[0], False):\n V[v[0]] = True\n v[2] += 1\n Q.put(v)\nprint((u[2]))\n","code_v1_no_empty_lines":"import sys\nimport queue\n\nN = 3\nf = \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\nQ = [[f, f.index(\"0\"), 0]]\nV = {f: True}\nwhile len(Q) > 0:\n u = Q.pop(0)\n if u[0] == \"123456780\":\n break\n sx, sy = u[1] \/\/ N, u[1] % N\n for dx, dy in dd:\n tx, ty = sx + dx, sy + dy\n if tx < 0 or ty < 0 or tx >= N or ty >= N:\n continue\n v = u[:]\n n1, n2 = u[1], tx * N + ty\n v[1] = n2\n if n1 > n2:\n n1, n2 = n2, n1\n v[0] = v[0][0:n1] + v[0][n2] + v[0][n1 + 1 : n2] + v[0][n1] + v[0][n2 + 1 :]\n if not V.get(v[0], False):\n V[v[0]] = True\n v[2] += 1 # dir[r]\n Q.append(v)\nprint((u[2]))\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-Q = queue.Queue()","-V = dict()","-Q.put([f, f.index(\"0\"), 0])","-V[f] = True","-while not Q.empty():","- u = Q.get()","+Q = [[f, f.index(\"0\"), 0]]","+V = {f: True}","+while len(Q) > 0:","+ u = Q.pop(0)","- v[2] += 1","- Q.put(v)","+ v[2] += 1 # dir[r]","+ Q.append(v)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5507428885,"measured_runtime_v1":0.3782181978,"runtime_lift":1.4561512154,"key":["s424620538","s007973982"]} +{"user_id":"u484780899","problem_id":"p02899","language":"python","submission_id_v0":"s524734651","submission_id_v1":"s003316364","cpu_time_v0":684,"cpu_time_v1":151,"memory_v0":23488,"memory_v1":13880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":77.92,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN = int(input())\n\n\n\nA = np.array([int(i) for i in input().split()])\n\n\n\nx = np.argsort(A)\n\nx += 1\n\n\n\nfor i in range(N):\n\n print(x[i], end=\" \")\n\n \n\nprint()\n\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\n\n\nA = [int(i) for i in input().split()]\n\n\n\nB = [0]*N\n\nfor i in range(N):\n\n B[A[i]-1] = i+1\n\n\n\nfor i in range(N):\n\n print((B[i]))\n","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":181,"code_v1_num_chars":151,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(input())\nA = np.array([int(i) for i in input().split()])\nx = np.argsort(A)\nx += 1\nfor i in range(N):\n print(x[i], end=\" \")\nprint()\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(i) for i in input().split()]\nB = [0] * N\nfor i in range(N):\n B[A[i] - 1] = i + 1\nfor i in range(N):\n print((B[i]))\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-import numpy as np","-","-N = int(input())","-A = np.array([int(i) for i in input().split()])","-x = np.argsort(A)","-x += 1","+N = int(eval(input()))","+A = [int(i) for i in input().split()]","+B = [0] * N","- print(x[i], end=\" \")","-print()","+ B[A[i] - 1] = i + 1","+for i in range(N):","+ print((B[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4031675689,"measured_runtime_v1":0.1788432901,"runtime_lift":7.8457937574,"key":["s524734651","s003316364"]} +{"user_id":"u002459665","problem_id":"p03854","language":"python","submission_id_v0":"s451133157","submission_id_v1":"s498631928","cpu_time_v0":759,"cpu_time_v1":146,"memory_v0":3936,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.76,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef main():\n\n S = eval(input())\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n # print(w1,w2,w3,w4)\n\n S = S[::-1]\n\n # print(S)\n\n\n\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n\n words = [w1, w2, w3, w4]\n\n T = ''\n\n while S != T:\n\n cand = []\n\n for w in words:\n\n new_t = T + w\n\n cand.append(new_t) \n\n # print('cand', cand)\n\n ans = False\n\n for c in cand:\n\n if c == S[:len(c)]:\n\n T = c\n\n ans = True\n\n\n\n if not ans:\n\n break\n\n\n\n if S == T:\n\n print('YES')\n\n else:\n\n print(\"NO\")\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n# optimized version of the same code:\n","target":"def main():\n\n S = eval(input())\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n S = S[::-1]\n\n words = [w1, w2, w3, w4]\n\n\n\n flag = False\n\n i = 0\n\n while i < len(S):\n\n for w in words:\n\n if S[i:].startswith(w):\n\n i += len(w)\n\n flag = True\n\n break\n\n\n\n if not flag:\n\n print(\"NO\")\n\n exit()\n\n flag = False\n\n\n\n print(\"YES\")\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":35,"code_v1_loc":29,"code_v0_num_chars":724,"code_v1_num_chars":528,"code_v0_no_empty_lines":"def main():\n S = eval(input())\n w1 = \"dream\"[::-1]\n w2 = \"dreamer\"[::-1]\n w3 = \"erase\"[::-1]\n w4 = \"eraser\"[::-1]\n # print(w1,w2,w3,w4)\n S = S[::-1]\n # print(S)\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n words = [w1, w2, w3, w4]\n T = \"\"\n while S != T:\n cand = []\n for w in words:\n new_t = T + w\n cand.append(new_t)\n # print('cand', cand)\n ans = False\n for c in cand:\n if c == S[: len(c)]:\n T = c\n ans = True\n if not ans:\n break\n if S == T:\n print(\"YES\")\n else:\n print(\"NO\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n S = eval(input())\n w1 = \"dream\"[::-1]\n w2 = \"dreamer\"[::-1]\n w3 = \"erase\"[::-1]\n w4 = \"eraser\"[::-1]\n S = S[::-1]\n words = [w1, w2, w3, w4]\n flag = False\n i = 0\n while i < len(S):\n for w in words:\n if S[i:].startswith(w):\n i += len(w)\n flag = True\n break\n if not flag:\n print(\"NO\")\n exit()\n flag = False\n print(\"YES\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":17.1428571429,"diff":["- # print(w1,w2,w3,w4)","- # print(S)","- # words = ['dream', 'dreamer', 'erase', 'eraser']","- T = \"\"","- while S != T:","- cand = []","+ flag = False","+ i = 0","+ while i < len(S):","- new_t = T + w","- cand.append(new_t)","- # print('cand', cand)","- ans = False","- for c in cand:","- if c == S[: len(c)]:","- T = c","- ans = True","- if not ans:","- break","- if S == T:","- print(\"YES\")","- else:","- print(\"NO\")","+ if S[i:].startswith(w):","+ i += len(w)","+ flag = True","+ break","+ if not flag:","+ print(\"NO\")","+ exit()","+ flag = False","+ print(\"YES\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.3388795207,"measured_runtime_v1":0.2570693116,"runtime_lift":1.3182418333,"key":["s451133157","s498631928"]} +{"user_id":"u761320129","problem_id":"p03806","language":"python","submission_id_v0":"s128261336","submission_id_v1":"s895482909","cpu_time_v0":493,"cpu_time_v1":263,"memory_v0":4852,"memory_v1":4852,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.65,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\nmaxa = maxb = 0\n\nfor a,b,c in src:\n\n for ai in range(maxa,-1,-1):\n\n for bi in range(maxb,-1,-1):\n\n dp[ai+a][bi+b] = min(dp[ai+a][bi+b], dp[ai][bi] + c)\n\n maxa += a\n\n maxb += b\n\n\n\nans = INF\n\nfor i in range(1,401):\n\n if MA*i > 400 or MB*i > 400: break\n\n ans = min(ans, dp[MA*i][MB*i])\n\nprint((-1 if ans == INF else ans))\n\n# optimized version of the same code:\n","target":"N,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\nMAX = 401\n\ndp = [[INF] * MAX for i in range(MAX)]\n\ndp[0][0] = 0\n\namax = bmax = 0\n\nfor a,b,n in src:\n\n for i in reversed(list(range(bmax+1))):\n\n for j in range(amax+1):\n\n if dp[i][j] == INF: continue\n\n dp[i+b][j+a] = min(dp[i+b][j+a], dp[i][j] + n)\n\n amax += a\n\n bmax += b\n\n\n\nans = INF\n\nfor i in range(1,MAX):\n\n if i*MA >= MAX or i*MB >= MAX: break\n\n ans = min(ans, dp[i*MB][i*MA])\n\nprint((-1 if ans == INF else ans))","code_v0_loc":19,"code_v1_loc":21,"code_v0_num_chars":527,"code_v1_num_chars":562,"code_v0_no_empty_lines":"N, MA, MB = list(map(int, input().split()))\nsrc = [tuple(map(int, input().split())) for i in range(N)]\nINF = 10**9\ndp = [[INF for j in range(401)] for i in range(401)]\ndp[0][0] = 0\nmaxa = maxb = 0\nfor a, b, c in src:\n for ai in range(maxa, -1, -1):\n for bi in range(maxb, -1, -1):\n dp[ai + a][bi + b] = min(dp[ai + a][bi + b], dp[ai][bi] + c)\n maxa += a\n maxb += b\nans = INF\nfor i in range(1, 401):\n if MA * i > 400 or MB * i > 400:\n break\n ans = min(ans, dp[MA * i][MB * i])\nprint((-1 if ans == INF else ans))\n","code_v1_no_empty_lines":"N, MA, MB = list(map(int, input().split()))\nsrc = [tuple(map(int, input().split())) for i in range(N)]\nINF = 10**9\nMAX = 401\ndp = [[INF] * MAX for i in range(MAX)]\ndp[0][0] = 0\namax = bmax = 0\nfor a, b, n in src:\n for i in reversed(list(range(bmax + 1))):\n for j in range(amax + 1):\n if dp[i][j] == INF:\n continue\n dp[i + b][j + a] = min(dp[i + b][j + a], dp[i][j] + n)\n amax += a\n bmax += b\nans = INF\nfor i in range(1, MAX):\n if i * MA >= MAX or i * MB >= MAX:\n break\n ans = min(ans, dp[i * MB][i * MA])\nprint((-1 if ans == INF else ans))\n","code_same":false,"relative_loc_diff_percent":9.5238095238,"diff":["-dp = [[INF for j in range(401)] for i in range(401)]","+MAX = 401","+dp = [[INF] * MAX for i in range(MAX)]","-maxa = maxb = 0","-for a, b, c in src:","- for ai in range(maxa, -1, -1):","- for bi in range(maxb, -1, -1):","- dp[ai + a][bi + b] = min(dp[ai + a][bi + b], dp[ai][bi] + c)","- maxa += a","- maxb += b","+amax = bmax = 0","+for a, b, n in src:","+ for i in reversed(list(range(bmax + 1))):","+ for j in range(amax + 1):","+ if dp[i][j] == INF:","+ continue","+ dp[i + b][j + a] = min(dp[i + b][j + a], dp[i][j] + n)","+ amax += a","+ bmax += b","-for i in range(1, 401):","- if MA * i > 400 or MB * i > 400:","+for i in range(1, MAX):","+ if i * MA >= MAX or i * MB >= MAX:","- ans = min(ans, dp[MA * i][MB * i])","+ ans = min(ans, dp[i * MB][i * MA])"],"diff_only_import_comment":false,"measured_runtime_v0":0.4613628248,"measured_runtime_v1":0.3376750898,"runtime_lift":1.3662921511,"key":["s128261336","s895482909"]} +{"user_id":"u638456847","problem_id":"p03253","language":"python","submission_id_v0":"s318779524","submission_id_v1":"s213127805","cpu_time_v0":120,"cpu_time_v1":45,"memory_v0":15264,"memory_v1":7084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\nMOD = 10**9+7\n\n\n\nfac = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\nf_inv = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\ndef prepare(n, mod):\n\n for i in range(2, n+1):\n\n fac.append((fac[-1] * i) % mod)\n\n inv.append((-inv[mod % i] * (mod\/\/i)) % mod)\n\n f_inv.append((f_inv[-1] * inv[-1]) % mod)\n\n\n\n\n\ndef cmb(n, r, mod):\n\n if n < 0 or r < 0:\n\n return 0\n\n if r > n:\n\n return 0\n\n\n\n return fac[n] * f_inv[r] * f_inv[n-r] % mod\n\n\n\n\n\ndef prime_factorization(n):\n\n d = []\n\n i, e = 2, 0 # factor, exponent\n\n while i * i <= n:\n\n while n % i == 0:\n\n n \/\/= i\n\n e += 1\n\n if e > 0:\n\n d.append((i, e))\n\n i += 1\n\n e = 0\n\n if n > 1:\n\n d.append((n, 1))\n\n return d\n\n\n\n\n\ndef main():\n\n N,M = list(map(int, readline().split()))\n\n\n\n prepare(N+100, MOD)\n\n d = prime_factorization(M)\n\n\n\n ans = 1\n\n for i, e in d:\n\n ans *= cmb(N-1+e, e, MOD)\n\n ans %= MOD\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\nMOD = 10**9+7\n\n\n\nfac = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\nf_inv = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\ndef prepare(n, mod):\n\n for i in range(2, n+1):\n\n fac.append((fac[-1] * i) % mod)\n\n\n\n\n\ndef cmb(n, r, mod):\n\n if n < 0 or r < 0:\n\n return 0\n\n if r > n:\n\n return 0\n\n\n\n return fac[n] * pow(fac[r],MOD-2,MOD) * pow(fac[n-r],MOD-2,MOD) % mod\n\n\n\n\n\ndef prime_factorization(n):\n\n d = []\n\n i, e = 2, 0 # factor, exponent\n\n while i * i <= n:\n\n while n % i == 0:\n\n n \/\/= i\n\n e += 1\n\n if e > 0:\n\n d.append((i, e))\n\n i += 1\n\n e = 0\n\n if n > 1:\n\n d.append((n, 1))\n\n return d\n\n\n\n\n\ndef main():\n\n N,M = list(map(int, readline().split()))\n\n\n\n prepare(N+100, MOD)\n\n d = prime_factorization(M)\n\n\n\n ans = 1\n\n for i, e in d:\n\n ans *= cmb(N-1+e, e, MOD)\n\n ans %= MOD\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":58,"code_v1_loc":56,"code_v0_num_chars":1128,"code_v1_num_chars":1049,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nMOD = 10**9 + 7\nfac = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\nf_inv = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\ndef prepare(n, mod):\n for i in range(2, n + 1):\n fac.append((fac[-1] * i) % mod)\n inv.append((-inv[mod % i] * (mod \/\/ i)) % mod)\n f_inv.append((f_inv[-1] * inv[-1]) % mod)\n\n\ndef cmb(n, r, mod):\n if n < 0 or r < 0:\n return 0\n if r > n:\n return 0\n return fac[n] * f_inv[r] * f_inv[n - r] % mod\n\n\ndef prime_factorization(n):\n d = []\n i, e = 2, 0 # factor, exponent\n while i * i <= n:\n while n % i == 0:\n n \/\/= i\n e += 1\n if e > 0:\n d.append((i, e))\n i += 1\n e = 0\n if n > 1:\n d.append((n, 1))\n return d\n\n\ndef main():\n N, M = list(map(int, readline().split()))\n prepare(N + 100, MOD)\n d = prime_factorization(M)\n ans = 1\n for i, e in d:\n ans *= cmb(N - 1 + e, e, MOD)\n ans %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nMOD = 10**9 + 7\nfac = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\nf_inv = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\ndef prepare(n, mod):\n for i in range(2, n + 1):\n fac.append((fac[-1] * i) % mod)\n\n\ndef cmb(n, r, mod):\n if n < 0 or r < 0:\n return 0\n if r > n:\n return 0\n return fac[n] * pow(fac[r], MOD - 2, MOD) * pow(fac[n - r], MOD - 2, MOD) % mod\n\n\ndef prime_factorization(n):\n d = []\n i, e = 2, 0 # factor, exponent\n while i * i <= n:\n while n % i == 0:\n n \/\/= i\n e += 1\n if e > 0:\n d.append((i, e))\n i += 1\n e = 0\n if n > 1:\n d.append((n, 1))\n return d\n\n\ndef main():\n N, M = list(map(int, readline().split()))\n prepare(N + 100, MOD)\n d = prime_factorization(M)\n ans = 1\n for i, e in d:\n ans *= cmb(N - 1 + e, e, MOD)\n ans %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.4482758621,"diff":["- inv.append((-inv[mod % i] * (mod \/\/ i)) % mod)","- f_inv.append((f_inv[-1] * inv[-1]) % mod)","- return fac[n] * f_inv[r] * f_inv[n - r] % mod","+ return fac[n] * pow(fac[r], MOD - 2, MOD) * pow(fac[n - r], MOD - 2, MOD) % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.6358441951,"measured_runtime_v1":0.3783175611,"runtime_lift":1.6807155163,"key":["s318779524","s213127805"]} +{"user_id":"u678167152","problem_id":"p03814","language":"python","submission_id_v0":"s292011694","submission_id_v1":"s577750700","cpu_time_v0":173,"cpu_time_v1":33,"memory_v0":41456,"memory_v1":9328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.92,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = eval(input())\n\na = s.find('A')\n\nz = s[::-1].find('Z')\n\nans = len(s)-a-z\n\n\n\nprint(ans)\n\n\n\n#print(*ans, sep='\\n')\n\n# optimized version of the same code:\n","target":"def solve():\n\n S = eval(input())\n\n a = S.find('A')\n\n z = S[::-1].find('Z')\n\n ans = len(S)-a-z\n\n return ans\n\nprint((solve()))","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":109,"code_v1_num_chars":121,"code_v0_no_empty_lines":"s = eval(input())\na = s.find(\"A\")\nz = s[::-1].find(\"Z\")\nans = len(s) - a - z\nprint(ans)\n# print(*ans, sep='\\n')\n","code_v1_no_empty_lines":"def solve():\n S = eval(input())\n a = S.find(\"A\")\n z = S[::-1].find(\"Z\")\n ans = len(S) - a - z\n return ans\n\n\nprint((solve()))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-s = eval(input())","-a = s.find(\"A\")","-z = s[::-1].find(\"Z\")","-ans = len(s) - a - z","-print(ans)","-# print(*ans, sep='\\n')","+def solve():","+ S = eval(input())","+ a = S.find(\"A\")","+ z = S[::-1].find(\"Z\")","+ ans = len(S) - a - z","+ return ans","+","+","+print((solve()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3115016568,"measured_runtime_v1":0.2242342863,"runtime_lift":1.3891794243,"key":["s292011694","s577750700"]} +{"user_id":"u729133443","problem_id":"p03494","language":"python","submission_id_v0":"s130510697","submission_id_v1":"s993121873","cpu_time_v0":166,"cpu_time_v1":32,"memory_v0":38256,"memory_v1":9048,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.72,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n_,t=open(0);n=eval(t.replace(' ','|'));print((len(bin(n&-n))-3))\n\n# optimized version of the same code:\n","target":"n=eval([*open(0)][1].replace(*' |'))\n\nprint((len(bin(n&-n))-3))","code_v0_loc":1,"code_v1_loc":2,"code_v0_num_chars":62,"code_v1_num_chars":61,"code_v0_no_empty_lines":"_, t = open(0)\nn = eval(t.replace(\" \", \"|\"))\nprint((len(bin(n & -n)) - 3))\n","code_v1_no_empty_lines":"n = eval([*open(0)][1].replace(*\" |\"))\nprint((len(bin(n & -n)) - 3))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-_, t = open(0)","-n = eval(t.replace(\" \", \"|\"))","+n = eval([*open(0)][1].replace(*\" |\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2380404282,"measured_runtime_v1":0.1070810323,"runtime_lift":2.2229934012,"key":["s130510697","s993121873"]} +{"user_id":"u293528047","problem_id":"p02780","language":"python","submission_id_v0":"s372211236","submission_id_v1":"s213603098","cpu_time_v0":393,"cpu_time_v1":115,"memory_v0":33764,"memory_v1":25060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN, K= list(map(int, input().split()))\n\np = np.array(list(map(int, input().split())))\n\n\n\ntmp = np.sum(p[:K])\n\nmax = tmp\n\nfor i in range(N-K):\n\n tmp = tmp-p[i]+p[i+K]\n\n if tmp>max:\n\n max = tmp\n\n\n\nprint(((max+K)\/2))\n\n# optimized version of the same code:\n","target":"N, K= list(map(int, input().split()))\n\np = list(map(int, input().split()))\n\n\n\ntmp = sum(p[:K])\n\nmax = tmp\n\nfor i in range(N-K):\n\n tmp = tmp-p[i]+p[i+K]\n\n if tmp>max:\n\n max = tmp\n\n\n\nprint(((max+K)\/2))","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":239,"code_v1_num_chars":204,"code_v0_no_empty_lines":"import numpy as np\n\nN, K = list(map(int, input().split()))\np = np.array(list(map(int, input().split())))\ntmp = np.sum(p[:K])\nmax = tmp\nfor i in range(N - K):\n tmp = tmp - p[i] + p[i + K]\n if tmp > max:\n max = tmp\nprint(((max + K) \/ 2))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\np = list(map(int, input().split()))\ntmp = sum(p[:K])\nmax = tmp\nfor i in range(N - K):\n tmp = tmp - p[i] + p[i + K]\n if tmp > max:\n max = tmp\nprint(((max + K) \/ 2))\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-import numpy as np","-","-p = np.array(list(map(int, input().split())))","-tmp = np.sum(p[:K])","+p = list(map(int, input().split()))","+tmp = sum(p[:K])"],"diff_only_import_comment":false,"measured_runtime_v0":1.5991840155,"measured_runtime_v1":0.2738144584,"runtime_lift":5.8403928886,"key":["s372211236","s213603098"]} +{"user_id":"u923662841","problem_id":"p03309","language":"python","submission_id_v0":"s990999147","submission_id_v1":"s307361938","cpu_time_v0":211,"cpu_time_v1":159,"memory_v0":34024,"memory_v1":31160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport statistics\n\nN = int(eval(input()))\n\nA = [int(a)-i-1 for i,a in enumerate(input().split(),1)]\n\nb = statistics.median_low(A)\n\nc = statistics.median_high(A)\n\nd = sum([abs(x-b) for x in A])\n\ne = sum([abs(x-c) for x in A])\n\nprint((min(d,e)))\n\n# optimized version of the same code:\n","target":"N=int(eval(input()))\n\nA=sorted(a-i-1 for i,a in enumerate(map(int,input().split())))\n\nprint((sum(abs(a-A[N\/\/2]) for a in A)))","code_v0_loc":8,"code_v1_loc":3,"code_v0_num_chars":241,"code_v1_num_chars":117,"code_v0_no_empty_lines":"import statistics\n\nN = int(eval(input()))\nA = [int(a) - i - 1 for i, a in enumerate(input().split(), 1)]\nb = statistics.median_low(A)\nc = statistics.median_high(A)\nd = sum([abs(x - b) for x in A])\ne = sum([abs(x - c) for x in A])\nprint((min(d, e)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = sorted(a - i - 1 for i, a in enumerate(map(int, input().split())))\nprint((sum(abs(a - A[N \/\/ 2]) for a in A)))\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-import statistics","-","-A = [int(a) - i - 1 for i, a in enumerate(input().split(), 1)]","-b = statistics.median_low(A)","-c = statistics.median_high(A)","-d = sum([abs(x - b) for x in A])","-e = sum([abs(x - c) for x in A])","-print((min(d, e)))","+A = sorted(a - i - 1 for i, a in enumerate(map(int, input().split())))","+print((sum(abs(a - A[N \/\/ 2]) for a in A)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3014758439,"measured_runtime_v1":0.2369829128,"runtime_lift":1.2721416931,"key":["s990999147","s307361938"]} +{"user_id":"u060793972","problem_id":"p02690","language":"python","submission_id_v0":"s517275230","submission_id_v1":"s191136547","cpu_time_v0":69,"cpu_time_v1":37,"memory_v0":9100,"memory_v1":9100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.38,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nx = int(eval(input()))\n\nfor i in range(-200,201):\n\n for j in range(-200,201):\n\n if (i**5)-(j**5)==x:\n\n print((i,j))\n\n exit()\n\n\n# optimized version of the same code:\n","target":"x = int(eval(input()))\n\nfor i in range(-120,121):\n\n for j in range(-120,121):\n\n if (i**5)-(j**5)==x:\n\n print((i,j))\n\n exit()\n","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":149,"code_v1_num_chars":149,"code_v0_no_empty_lines":"x = int(eval(input()))\nfor i in range(-200, 201):\n for j in range(-200, 201):\n if (i**5) - (j**5) == x:\n print((i, j))\n exit()\n","code_v1_no_empty_lines":"x = int(eval(input()))\nfor i in range(-120, 121):\n for j in range(-120, 121):\n if (i**5) - (j**5) == x:\n print((i, j))\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(-200, 201):","- for j in range(-200, 201):","+for i in range(-120, 121):","+ for j in range(-120, 121):"],"diff_only_import_comment":false,"measured_runtime_v0":0.5919232865,"measured_runtime_v1":0.3199627697,"runtime_lift":1.8499755049,"key":["s517275230","s191136547"]} +{"user_id":"u294385082","problem_id":"p03416","language":"python","submission_id_v0":"s823919342","submission_id_v1":"s499216276","cpu_time_v0":175,"cpu_time_v1":125,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.57,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\na,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n new = list(reversed(list(str(i))))\n\n if new == list(str(i)):\n\n c += 1\n\n \n\n \n\nprint(c)\n\n# optimized version of the same code:\n","target":"a,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n if list(str(i)) == list(str(i))[::-1]:\n\n c += 1\n\n \n\n \n\nprint(c)","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":162,"code_v1_num_chars":139,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nc = 0\nfor i in range(a, b + 1):\n new = list(reversed(list(str(i))))\n if new == list(str(i)):\n c += 1\nprint(c)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nc = 0\nfor i in range(a, b + 1):\n if list(str(i)) == list(str(i))[::-1]:\n c += 1\nprint(c)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["- new = list(reversed(list(str(i))))","- if new == list(str(i)):","+ if list(str(i)) == list(str(i))[::-1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.7237584333,"measured_runtime_v1":0.3522657444,"runtime_lift":2.0545807954,"key":["s823919342","s499216276"]} +{"user_id":"u325282913","problem_id":"p03013","language":"python","submission_id_v0":"s961535130","submission_id_v1":"s147927462","cpu_time_v0":230,"cpu_time_v1":192,"memory_v0":40940,"memory_v1":7668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.52,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int,input().split()))\n\nhole = [0] * (N+1)\n\nfor i in range(M):\n\n hole[int(eval(input()))] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nif N == 2:\n\n if hole[1] == 1:\n\n print((1))\n\n exit()\n\n if hole[1] == 0:\n\n print((2))\n\n exit()\n\nflg_one = False\n\nflg_two = False\n\nfirst = 1\n\nsecond = 2\n\nif hole[1] == 1:\n\n first = 0\n\n second = 1\n\n flg_one = True\n\nif hole[2] == 1:\n\n first = 1\n\n second = 0\n\n flg_two = True\n\nif flg_one and flg_two:\n\n print((0))\n\n exit()\n\n\n\nfor i in range(3,N):\n\n if hole[i] == 1:\n\n first = second\n\n second = 0\n\n continue\n\n tmp = first + second\n\n tmp %= 1000000007\n\n first = second\n\n second = tmp\n\ntmp = first + second\n\ntmp %= 1000000007\n\nprint(tmp)\n\n# optimized version of the same code:\n","target":"MOD = 10**9 + 7\n\nN, M = list(map(int, input().split()))\n\nstairs = [0]*(N+1)\n\nfor _ in range(M):\n\n stairs[int(eval(input()))] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nans = [0]*(N+1)\n\nans[1] = 1 if stairs[1] == 0 else 0\n\nans[2] = 1 + ans[1] if stairs[2] == 0 else 0\n\nfor i in range(3,N+1):\n\n if stairs[i] == 1:\n\n ans[i] = 0\n\n continue\n\n ans[i] = (ans[i-1] + ans[i-2]) % MOD\n\nprint((ans[N]))","code_v0_loc":44,"code_v1_loc":17,"code_v0_num_chars":795,"code_v1_num_chars":400,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nhole = [0] * (N + 1)\nfor i in range(M):\n hole[int(eval(input()))] = 1\nif N == 1:\n print((1))\n exit()\nif N == 2:\n if hole[1] == 1:\n print((1))\n exit()\n if hole[1] == 0:\n print((2))\n exit()\nflg_one = False\nflg_two = False\nfirst = 1\nsecond = 2\nif hole[1] == 1:\n first = 0\n second = 1\n flg_one = True\nif hole[2] == 1:\n first = 1\n second = 0\n flg_two = True\nif flg_one and flg_two:\n print((0))\n exit()\nfor i in range(3, N):\n if hole[i] == 1:\n first = second\n second = 0\n continue\n tmp = first + second\n tmp %= 1000000007\n first = second\n second = tmp\ntmp = first + second\ntmp %= 1000000007\nprint(tmp)\n","code_v1_no_empty_lines":"MOD = 10**9 + 7\nN, M = list(map(int, input().split()))\nstairs = [0] * (N + 1)\nfor _ in range(M):\n stairs[int(eval(input()))] = 1\nif N == 1:\n print((1))\n exit()\nans = [0] * (N + 1)\nans[1] = 1 if stairs[1] == 0 else 0\nans[2] = 1 + ans[1] if stairs[2] == 0 else 0\nfor i in range(3, N + 1):\n if stairs[i] == 1:\n ans[i] = 0\n continue\n ans[i] = (ans[i - 1] + ans[i - 2]) % MOD\nprint((ans[N]))\n","code_same":false,"relative_loc_diff_percent":61.3636363636,"diff":["-import sys","-","-input = sys.stdin.readline","+MOD = 10**9 + 7","-hole = [0] * (N + 1)","-for i in range(M):","- hole[int(eval(input()))] = 1","+stairs = [0] * (N + 1)","+for _ in range(M):","+ stairs[int(eval(input()))] = 1","-if N == 2:","- if hole[1] == 1:","- print((1))","- exit()","- if hole[1] == 0:","- print((2))","- exit()","-flg_one = False","-flg_two = False","-first = 1","-second = 2","-if hole[1] == 1:","- first = 0","- second = 1","- flg_one = True","-if hole[2] == 1:","- first = 1","- second = 0","- flg_two = True","-if flg_one and flg_two:","- print((0))","- exit()","-for i in range(3, N):","- if hole[i] == 1:","- first = second","- second = 0","+ans = [0] * (N + 1)","+ans[1] = 1 if stairs[1] == 0 else 0","+ans[2] = 1 + ans[1] if stairs[2] == 0 else 0","+for i in range(3, N + 1):","+ if stairs[i] == 1:","+ ans[i] = 0","- tmp = first + second","- tmp %= 1000000007","- first = second","- second = tmp","-tmp = first + second","-tmp %= 1000000007","-print(tmp)","+ ans[i] = (ans[i - 1] + ans[i - 2]) % MOD","+print((ans[N]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3368466201,"measured_runtime_v1":0.2647972648,"runtime_lift":1.2720925207,"key":["s961535130","s147927462"]} +{"user_id":"u585482323","problem_id":"p03558","language":"python","submission_id_v0":"s378178699","submission_id_v1":"s370816259","cpu_time_v0":982,"cpu_time_v1":230,"memory_v0":88880,"memory_v1":47180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.58,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!usr\/bin\/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n s = S()\n\n t = S()\n\n if s+t == t[::-1]+s[::-1]:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n\n\n#B\n\ndef B():\n\n n = I()\n\n for i in range(int(n**0.5)+2)[::-1]:\n\n if i*i <= n:\n\n print((i*i))\n\n quit()\n\n#C\n\ndef C():\n\n n = I()\n\n a = LI()\n\n b = LI()\n\n c = LI()\n\n q = [0 for i in range(n)]\n\n ans = 0\n\n a.sort()\n\n b.sort()\n\n c.sort()\n\n for i in range(n):\n\n j = bisect.bisect_left(a,b[i])\n\n q[i] = j\n\n for i in range(n-1):\n\n q[i+1] += q[i]\n\n q.insert(0,0)\n\n for i in range(n):\n\n j = bisect.bisect_left(b,c[i])\n\n ans += q[j]\n\n print(ans)\n\n#D\n\ndef D():\n\n def dijkstra():\n\n d = [float(\"inf\") for i in range(k)]\n\n q = [[0,1]]\n\n d[1] = 0\n\n while q:\n\n dx,x = heappop(q)\n\n for y,dy in v[x]:\n\n if d[y] > dx+dy:\n\n d[y] = dx+dy\n\n heappush(q,[d[y],y])\n\n print((d[0]+1))\n\n k = I()\n\n if k == 1:\n\n print((1))\n\n quit()\n\n v = [[] for i in range(k)]\n\n for i in range(1,k):\n\n v[i].append([(i+1)%k,1])\n\n v[i].append([i*10%k,0])\n\n dijkstra()\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n return\n\n\n\n#G\n\ndef G():\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n D()\n\n\n# optimized version of the same code:\n","target":"#!usr\/bin\/env python3\n\nfrom collections import defaultdict,deque\n\nfrom heapq import heappush, heappop\n\nfrom itertools import permutations\n\nimport sys\n\nimport math\n\nimport bisect\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\n\ndef S():\n\n res = list(sys.stdin.readline())\n\n if res[-1] == \"\\n\":\n\n return res[:-1]\n\n return res\n\ndef IR(n):\n\n return [I() for i in range(n)]\n\ndef LIR(n):\n\n return [LI() for i in range(n)]\n\ndef SR(n):\n\n return [S() for i in range(n)]\n\ndef LSR(n):\n\n return [LS() for i in range(n)]\n\n\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\ndef solve():\n\n def v(n):\n\n return [n*10%k, (n+1)%k]\n\n k = I()\n\n d = [float(\"inf\")]*k\n\n d[1] = 1\n\n q = deque([1])\n\n while q:\n\n x = q.popleft()\n\n vx = v(x)\n\n dx = d[x]\n\n for c in range(2):\n\n nd = dx+c\n\n y = vx[c]\n\n if nd < d[y]:\n\n d[y] = nd\n\n if c:\n\n q.append(y)\n\n else:\n\n q.appendleft(y)\n\n print((d[0]))\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n solve()\n","code_v0_loc":108,"code_v1_loc":53,"code_v0_num_chars":2164,"code_v1_num_chars":1252,"code_v0_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\ndef A():\n s = S()\n t = S()\n if s + t == t[::-1] + s[::-1]:\n print(\"YES\")\n else:\n print(\"NO\")\n\n\n# B\ndef B():\n n = I()\n for i in range(int(n**0.5) + 2)[::-1]:\n if i * i <= n:\n print((i * i))\n quit()\n\n\n# C\ndef C():\n n = I()\n a = LI()\n b = LI()\n c = LI()\n q = [0 for i in range(n)]\n ans = 0\n a.sort()\n b.sort()\n c.sort()\n for i in range(n):\n j = bisect.bisect_left(a, b[i])\n q[i] = j\n for i in range(n - 1):\n q[i + 1] += q[i]\n q.insert(0, 0)\n for i in range(n):\n j = bisect.bisect_left(b, c[i])\n ans += q[j]\n print(ans)\n\n\n# D\ndef D():\n def dijkstra():\n d = [float(\"inf\") for i in range(k)]\n q = [[0, 1]]\n d[1] = 0\n while q:\n dx, x = heappop(q)\n for y, dy in v[x]:\n if d[y] > dx + dy:\n d[y] = dx + dy\n heappush(q, [d[y], y])\n print((d[0] + 1))\n\n k = I()\n if k == 1:\n print((1))\n quit()\n v = [[] for i in range(k)]\n for i in range(1, k):\n v[i].append([(i + 1) % k, 1])\n v[i].append([i * 10 % k, 0])\n dijkstra()\n\n\n# E\ndef E():\n return\n\n\n# F\ndef F():\n return\n\n\n# G\ndef G():\n return\n\n\n# H\ndef H():\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n D()\n","code_v1_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations\nimport sys\nimport math\nimport bisect\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == \"\\n\":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n\n\ndef solve():\n def v(n):\n return [n * 10 % k, (n + 1) % k]\n\n k = I()\n d = [float(\"inf\")] * k\n d[1] = 1\n q = deque([1])\n while q:\n x = q.popleft()\n vx = v(x)\n dx = d[x]\n for c in range(2):\n nd = dx + c\n y = vx[c]\n if nd < d[y]:\n d[y] = nd\n if c:\n q.append(y)\n else:\n q.appendleft(y)\n print((d[0]))\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":50.9259259259,"diff":["-from collections import defaultdict","-from collections import deque","+from collections import defaultdict, deque","+from itertools import permutations","-import random","- return list(map(int, sys.stdin.readline().split()))","+ return [int(x) for x in sys.stdin.readline().split()]","- return list(map(list, sys.stdin.readline().split()))","+ return [list(x) for x in sys.stdin.readline().split()]","- return list(sys.stdin.readline())[:-1]","+ res = list(sys.stdin.readline())","+ if res[-1] == \"\\n\":","+ return res[:-1]","+ return res","- l = [None for i in range(n)]","- for i in range(n):","- l[i] = I()","- return l","+ return [I() for i in range(n)]","- l = [None for i in range(n)]","- for i in range(n):","- l[i] = LI()","- return l","+ return [LI() for i in range(n)]","- l = [None for i in range(n)]","- for i in range(n):","- l[i] = S()","- return l","+ return [S() for i in range(n)]","- l = [None for i in range(n)]","- for i in range(n):","- l[i] = SR()","- return l","+ return [LS() for i in range(n)]","+sys.setrecursionlimit(1000000)","-# A","-def A():","- s = S()","- t = S()","- if s + t == t[::-1] + s[::-1]:","- print(\"YES\")","- else:","- print(\"NO\")","-# B","-def B():","- n = I()","- for i in range(int(n**0.5) + 2)[::-1]:","- if i * i <= n:","- print((i * i))","- quit()","-","-","-# C","-def C():","- n = I()","- a = LI()","- b = LI()","- c = LI()","- q = [0 for i in range(n)]","- ans = 0","- a.sort()","- b.sort()","- c.sort()","- for i in range(n):","- j = bisect.bisect_left(a, b[i])","- q[i] = j","- for i in range(n - 1):","- q[i + 1] += q[i]","- q.insert(0, 0)","- for i in range(n):","- j = bisect.bisect_left(b, c[i])","- ans += q[j]","- print(ans)","-","-","-# D","-def D():","- def dijkstra():","- d = [float(\"inf\") for i in range(k)]","- q = [[0, 1]]","- d[1] = 0","- while q:","- dx, x = heappop(q)","- for y, dy in v[x]:","- if d[y] > dx + dy:","- d[y] = dx + dy","- heappush(q, [d[y], y])","- print((d[0] + 1))","+def solve():","+ def v(n):","+ return [n * 10 % k, (n + 1) % k]","- if k == 1:","- print((1))","- quit()","- v = [[] for i in range(k)]","- for i in range(1, k):","- v[i].append([(i + 1) % k, 1])","- v[i].append([i * 10 % k, 0])","- dijkstra()","-","-","-# E","-def E():","- return","-","-","-# F","-def F():","- return","-","-","-# G","-def G():","- return","-","-","-# H","-def H():","+ d = [float(\"inf\")] * k","+ d[1] = 1","+ q = deque([1])","+ while q:","+ x = q.popleft()","+ vx = v(x)","+ dx = d[x]","+ for c in range(2):","+ nd = dx + c","+ y = vx[c]","+ if nd < d[y]:","+ d[y] = nd","+ if c:","+ q.append(y)","+ else:","+ q.appendleft(y)","+ print((d[0]))","- D()","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.6112481251,"measured_runtime_v1":0.2866115916,"runtime_lift":2.1326706352,"key":["s378178699","s370816259"]} +{"user_id":"u815878613","problem_id":"p02994","language":"python","submission_id_v0":"s699978858","submission_id_v1":"s611045566","cpu_time_v0":314,"cpu_time_v1":31,"memory_v0":21116,"memory_v1":9068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.13,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nN, L = list(map(int, input().split()))\n\n\n\n# \u5473\n\nLL = np.arange(L,L+N)\n\n\n\nm = abs(LL[0])\n\n\n\nfor i in range(N):\n\n if abs(m) > abs(LL[i]):\n\n m = LL[i]\n\n\n\nprint((np.sum(LL)-m))\n\n\n# optimized version of the same code:\n","target":"N, L = list(map(int, input().split()))\n\n\n\nA = [i for i in range(L, L + N)]\n\n\n\nif A[0] < 0:\n\n if A[-1] < 0:\n\n print((sum(A) - max(A)))\n\n else:\n\n print((sum(A)))\n\nelse:\n\n print((sum(A) - min(A)))\n","code_v0_loc":15,"code_v1_loc":11,"code_v0_num_chars":214,"code_v1_num_chars":205,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nN, L = list(map(int, input().split()))\n# \u5473\nLL = np.arange(L, L + N)\nm = abs(LL[0])\nfor i in range(N):\n if abs(m) > abs(LL[i]):\n m = LL[i]\nprint((np.sum(LL) - m))\n","code_v1_no_empty_lines":"N, L = list(map(int, input().split()))\nA = [i for i in range(L, L + N)]\nif A[0] < 0:\n if A[-1] < 0:\n print((sum(A) - max(A)))\n else:\n print((sum(A)))\nelse:\n print((sum(A) - min(A)))\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["-import sys","-import numpy as np","-","-# \u5473","-LL = np.arange(L, L + N)","-m = abs(LL[0])","-for i in range(N):","- if abs(m) > abs(LL[i]):","- m = LL[i]","-print((np.sum(LL) - m))","+A = [i for i in range(L, L + N)]","+if A[0] < 0:","+ if A[-1] < 0:","+ print((sum(A) - max(A)))","+ else:","+ print((sum(A)))","+else:","+ print((sum(A) - min(A)))"],"diff_only_import_comment":false,"measured_runtime_v0":1.5312956157,"measured_runtime_v1":0.2108477986,"runtime_lift":7.2625639246,"key":["s699978858","s611045566"]} +{"user_id":"u089230684","problem_id":"p03796","language":"python","submission_id_v0":"s560811979","submission_id_v1":"s868944422","cpu_time_v0":230,"cpu_time_v1":37,"memory_v0":3984,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\nx = int(eval(input()))\n\nprint((math.factorial(x) % (10**9 + 7)))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nfact = 1\n\nfor i in range(1,n+1):\n\n fact = fact * i % (10**9 +7)\n\nres = fact % (10**9 + 7)\n\nprint(res)","code_v0_loc":3,"code_v1_loc":6,"code_v0_num_chars":69,"code_v1_num_chars":120,"code_v0_no_empty_lines":"import math\n\nx = int(eval(input()))\nprint((math.factorial(x) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nfact = 1\nfor i in range(1, n + 1):\n fact = fact * i % (10**9 + 7)\nres = fact % (10**9 + 7)\nprint(res)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import math","-","-x = int(eval(input()))","-print((math.factorial(x) % (10**9 + 7)))","+n = int(eval(input()))","+fact = 1","+for i in range(1, n + 1):","+ fact = fact * i % (10**9 + 7)","+res = fact % (10**9 + 7)","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5532854562,"measured_runtime_v1":0.2473686228,"runtime_lift":2.2366840626,"key":["s560811979","s868944422"]} +{"user_id":"u545368057","problem_id":"p02537","language":"python","submission_id_v0":"s767194684","submission_id_v1":"s838681052","cpu_time_v0":1543,"cpu_time_v1":497,"memory_v0":111052,"memory_v1":90604,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nn,k = list(map(int, input().split()))\n\nAs = [int(eval(input())) for i in range(n)]\n\n\n\n# N: \u51e6\u7406\u3059\u308b\u533a\u9593\u306e\u9577\u3055\n\n\n\nINF = 0\n\n\n\nmx = 300001\n\nLV = (mx-1).bit_length()\n\nN0 = 2**LV\n\ndata = [INF]*(2*N0)\n\nlazy = [None]*(2*N0)\n\n\n\n# \u4f1d\u642c\u5bfe\u8c61\u306e\u533a\u9593\u3092\u6c42\u3081\u308b\n\ndef gindex(l, r):\n\n L = (l + N0) >> 1; R = (r + N0) >> 1\n\n lc = 0 if l & 1 else (L & -L).bit_length()\n\n rc = 0 if r & 1 else (R & -R).bit_length()\n\n for i in range(LV):\n\n if rc <= i:\n\n yield R\n\n if L < R and lc <= i:\n\n yield L\n\n L >>= 1; R >>= 1\n\n\n\n# \u9045\u5ef6\u4f1d\u642c\u51e6\u7406\n\ndef propagates(*ids):\n\n for i in reversed(ids):\n\n v = lazy[i-1]\n\n if v is None:\n\n continue\n\n lazy[2*i-1] = data[2*i-1] = lazy[2*i] = data[2*i] = v\n\n lazy[i-1] = None\n\n\n\n# \u533a\u9593[l, r)\u3092x\u3067\u66f4\u65b0\n\ndef update(l, r, x):\n\n *ids, = gindex(l, r)\n\n propagates(*ids)\n\n\n\n L = N0 + l; R = N0 + r\n\n while L < R:\n\n if R & 1:\n\n R -= 1\n\n lazy[R-1] = data[R-1] = x\n\n if L & 1:\n\n lazy[L-1] = data[L-1] = x\n\n L += 1\n\n L >>= 1; R >>= 1\n\n for i in ids:\n\n data[i-1] = max(data[2*i-1], data[2*i])\n\n\n\n# \u533a\u9593[l, r)\u5185\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\n\ndef query(l, r):\n\n propagates(*gindex(l, r))\n\n L = N0 + l; R = N0 + r\n\n\n\n s = INF\n\n while L < R:\n\n if R & 1:\n\n R -= 1\n\n s = max(s, data[R-1])\n\n if L & 1:\n\n s = max(s, data[L-1])\n\n L += 1\n\n L >>= 1; R >>= 1\n\n return s\n\n\n\nans = 0\n\nupdate(As[0],As[0]+1,1)\n\nfor i, a in enumerate(As[1:]):\n\n l = max(0,a-k)\n\n r = min(mx,a+k)\n\n upd = query(l,r+1)\n\n if upd == -1:continue\n\n # print(\"i\",i,\"a\",a,\"upd\",upd,\"l\",l,\"r\",r)\n\n update(a, a+1, upd+1)\n\n ans = max(ans, upd+1)\n\nprint(ans)\n\n\n\n\n# optimized version of the same code:\n","target":"# \u30bb\u30b0\u30e1\u30f3\u30c8\u6728\n\n# segment tree\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nclass segmented_tree:\n\n X_unit = 0\n\n X_f = lambda self, a, b: max(a,b)\n\n def __init__(self, N):\n\n self.N = N\n\n self.X = [self.X_unit] * (2*N)\n\n \n\n def build(self, seq):\n\n for i, x in enumerate(seq, self.N):\n\n self.X[i] = x \n\n # \u5f8c\u308d\u304b\u3089\u5165\u308c\u3066\u3044\u304f\n\n for i in range(self.N-1, 0, -1):\n\n self.X[i] = self.X_f(self.X[i<<1], self.X[i<<1|1])\n\n\n\n # 1\u70b9\u66f4\u65b0\n\n def set_val(self, i, x):\n\n i += self.N\n\n self.X[i] = x\n\n while i > 1:\n\n i >>= 1\n\n self.X[i] = self.X_f(self.X[i<<1],self.X[i<<1|1])\n\n \n\n # \u533a\u9593\u53d6\u5f97\n\n def fold(self, l, r):\n\n l += self.N\n\n r += self.N\n\n vl = self.X_unit\n\n vr = self.X_unit\n\n # \u5916\u304b\u3089\u6c7a\u3081\u3066\u3044\u304f\n\n while l < r:\n\n # print(l,r)\n\n if l & 1:\n\n vl = self.X_f(vl, self.X[l])\n\n l += 1\n\n if r & 1:\n\n r -= 1\n\n vr = self.X_f(vr, self.X[r])\n\n l >>= 1\n\n r >>= 1\n\n return self.X_f(vl,vr)\n\n\n\nn,k = list(map(int, input().split()))\n\nAs = [int(eval(input())) for i in range(n)]\n\nmx = 300001\n\nans = 0\n\nsg = segmented_tree(330000)\n\n\n\nfor a in As:\n\n l = max(0,a-k)\n\n r = min(mx,a+k)\n\n\n\n upd = sg.fold(l,r+1)\n\n ans = max(ans, upd+1)\n\n\n\n sg.set_val(a, upd+1)\n\nprint(ans)\n\n\n","code_v0_loc":82,"code_v1_loc":62,"code_v0_num_chars":1762,"code_v1_num_chars":1410,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, k = list(map(int, input().split()))\nAs = [int(eval(input())) for i in range(n)]\n# N: \u51e6\u7406\u3059\u308b\u533a\u9593\u306e\u9577\u3055\nINF = 0\nmx = 300001\nLV = (mx - 1).bit_length()\nN0 = 2**LV\ndata = [INF] * (2 * N0)\nlazy = [None] * (2 * N0)\n# \u4f1d\u642c\u5bfe\u8c61\u306e\u533a\u9593\u3092\u6c42\u3081\u308b\ndef gindex(l, r):\n L = (l + N0) >> 1\n R = (r + N0) >> 1\n lc = 0 if l & 1 else (L & -L).bit_length()\n rc = 0 if r & 1 else (R & -R).bit_length()\n for i in range(LV):\n if rc <= i:\n yield R\n if L < R and lc <= i:\n yield L\n L >>= 1\n R >>= 1\n\n\n# \u9045\u5ef6\u4f1d\u642c\u51e6\u7406\ndef propagates(*ids):\n for i in reversed(ids):\n v = lazy[i - 1]\n if v is None:\n continue\n lazy[2 * i - 1] = data[2 * i - 1] = lazy[2 * i] = data[2 * i] = v\n lazy[i - 1] = None\n\n\n# \u533a\u9593[l, r)\u3092x\u3067\u66f4\u65b0\ndef update(l, r, x):\n (*ids,) = gindex(l, r)\n propagates(*ids)\n L = N0 + l\n R = N0 + r\n while L < R:\n if R & 1:\n R -= 1\n lazy[R - 1] = data[R - 1] = x\n if L & 1:\n lazy[L - 1] = data[L - 1] = x\n L += 1\n L >>= 1\n R >>= 1\n for i in ids:\n data[i - 1] = max(data[2 * i - 1], data[2 * i])\n\n\n# \u533a\u9593[l, r)\u5185\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\ndef query(l, r):\n propagates(*gindex(l, r))\n L = N0 + l\n R = N0 + r\n s = INF\n while L < R:\n if R & 1:\n R -= 1\n s = max(s, data[R - 1])\n if L & 1:\n s = max(s, data[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\nans = 0\nupdate(As[0], As[0] + 1, 1)\nfor i, a in enumerate(As[1:]):\n l = max(0, a - k)\n r = min(mx, a + k)\n upd = query(l, r + 1)\n if upd == -1:\n continue\n # print(\"i\",i,\"a\",a,\"upd\",upd,\"l\",l,\"r\",r)\n update(a, a + 1, upd + 1)\n ans = max(ans, upd + 1)\nprint(ans)\n","code_v1_no_empty_lines":"# \u30bb\u30b0\u30e1\u30f3\u30c8\u6728\n# segment tree\nimport sys\n\ninput = sys.stdin.readline\n\n\nclass segmented_tree:\n X_unit = 0\n X_f = lambda self, a, b: max(a, b)\n\n def __init__(self, N):\n self.N = N\n self.X = [self.X_unit] * (2 * N)\n\n def build(self, seq):\n for i, x in enumerate(seq, self.N):\n self.X[i] = x\n # \u5f8c\u308d\u304b\u3089\u5165\u308c\u3066\u3044\u304f\n for i in range(self.N - 1, 0, -1):\n self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1])\n\n # 1\u70b9\u66f4\u65b0\n def set_val(self, i, x):\n i += self.N\n self.X[i] = x\n while i > 1:\n i >>= 1\n self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1])\n\n # \u533a\u9593\u53d6\u5f97\n def fold(self, l, r):\n l += self.N\n r += self.N\n vl = self.X_unit\n vr = self.X_unit\n # \u5916\u304b\u3089\u6c7a\u3081\u3066\u3044\u304f\n while l < r:\n # print(l,r)\n if l & 1:\n vl = self.X_f(vl, self.X[l])\n l += 1\n if r & 1:\n r -= 1\n vr = self.X_f(vr, self.X[r])\n l >>= 1\n r >>= 1\n return self.X_f(vl, vr)\n\n\nn, k = list(map(int, input().split()))\nAs = [int(eval(input())) for i in range(n)]\nmx = 300001\nans = 0\nsg = segmented_tree(330000)\nfor a in As:\n l = max(0, a - k)\n r = min(mx, a + k)\n upd = sg.fold(l, r + 1)\n ans = max(ans, upd + 1)\n sg.set_val(a, upd + 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":24.3902439024,"diff":["+# \u30bb\u30b0\u30e1\u30f3\u30c8\u6728","+# segment tree","+","+","+class segmented_tree:","+ X_unit = 0","+ X_f = lambda self, a, b: max(a, b)","+","+ def __init__(self, N):","+ self.N = N","+ self.X = [self.X_unit] * (2 * N)","+","+ def build(self, seq):","+ for i, x in enumerate(seq, self.N):","+ self.X[i] = x","+ # \u5f8c\u308d\u304b\u3089\u5165\u308c\u3066\u3044\u304f","+ for i in range(self.N - 1, 0, -1):","+ self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1])","+","+ # 1\u70b9\u66f4\u65b0","+ def set_val(self, i, x):","+ i += self.N","+ self.X[i] = x","+ while i > 1:","+ i >>= 1","+ self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1])","+","+ # \u533a\u9593\u53d6\u5f97","+ def fold(self, l, r):","+ l += self.N","+ r += self.N","+ vl = self.X_unit","+ vr = self.X_unit","+ # \u5916\u304b\u3089\u6c7a\u3081\u3066\u3044\u304f","+ while l < r:","+ # print(l,r)","+ if l & 1:","+ vl = self.X_f(vl, self.X[l])","+ l += 1","+ if r & 1:","+ r -= 1","+ vr = self.X_f(vr, self.X[r])","+ l >>= 1","+ r >>= 1","+ return self.X_f(vl, vr)","+","+","-# N: \u51e6\u7406\u3059\u308b\u533a\u9593\u306e\u9577\u3055","-INF = 0","-LV = (mx - 1).bit_length()","-N0 = 2**LV","-data = [INF] * (2 * N0)","-lazy = [None] * (2 * N0)","-# \u4f1d\u642c\u5bfe\u8c61\u306e\u533a\u9593\u3092\u6c42\u3081\u308b","-def gindex(l, r):","- L = (l + N0) >> 1","- R = (r + N0) >> 1","- lc = 0 if l & 1 else (L & -L).bit_length()","- rc = 0 if r & 1 else (R & -R).bit_length()","- for i in range(LV):","- if rc <= i:","- yield R","- if L < R and lc <= i:","- yield L","- L >>= 1","- R >>= 1","-","-","-# \u9045\u5ef6\u4f1d\u642c\u51e6\u7406","-def propagates(*ids):","- for i in reversed(ids):","- v = lazy[i - 1]","- if v is None:","- continue","- lazy[2 * i - 1] = data[2 * i - 1] = lazy[2 * i] = data[2 * i] = v","- lazy[i - 1] = None","-","-","-# \u533a\u9593[l, r)\u3092x\u3067\u66f4\u65b0","-def update(l, r, x):","- (*ids,) = gindex(l, r)","- propagates(*ids)","- L = N0 + l","- R = N0 + r","- while L < R:","- if R & 1:","- R -= 1","- lazy[R - 1] = data[R - 1] = x","- if L & 1:","- lazy[L - 1] = data[L - 1] = x","- L += 1","- L >>= 1","- R >>= 1","- for i in ids:","- data[i - 1] = max(data[2 * i - 1], data[2 * i])","-","-","-# \u533a\u9593[l, r)\u5185\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b","-def query(l, r):","- propagates(*gindex(l, r))","- L = N0 + l","- R = N0 + r","- s = INF","- while L < R:","- if R & 1:","- R -= 1","- s = max(s, data[R - 1])","- if L & 1:","- s = max(s, data[L - 1])","- L += 1","- L >>= 1","- R >>= 1","- return s","-","-","-update(As[0], As[0] + 1, 1)","-for i, a in enumerate(As[1:]):","+sg = segmented_tree(330000)","+for a in As:","- upd = query(l, r + 1)","- if upd == -1:","- continue","- # print(\"i\",i,\"a\",a,\"upd\",upd,\"l\",l,\"r\",r)","- update(a, a + 1, upd + 1)","+ upd = sg.fold(l, r + 1)","+ sg.set_val(a, upd + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5116031129,"measured_runtime_v1":0.2937918727,"runtime_lift":1.7413793927,"key":["s767194684","s838681052"]} +{"user_id":"u164727245","problem_id":"p02596","language":"python","submission_id_v0":"s121951272","submission_id_v1":"s390007993","cpu_time_v0":131,"cpu_time_v1":33,"memory_v0":9476,"memory_v1":9244,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.81,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k\/\/7 if k % 7 == 0 else k)\n\n if l % 2 == 0 or l % 5 == 0:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(-pow(l, 1\/2))):\n\n if r % i == 0:\n\n phi = phi\/\/i*(i-1)\n\n while r % i:\n\n r \/\/= i\n\n\n\n a = 10 % l\n\n ret = 1\n\n while(a != 1):\n\n a = a*10 % l\n\n ret += 1\n\n if phi < ret:\n\n ret = -1\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n\n\n# optimized version of the same code:\n","target":"# coding: utf-8\n\nfrom math import sqrt\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k\/\/7 if 0 == k % 7 else k)\n\n if 0 == l % 2 or 0 == l % 5:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(sqrt(l)+1)):\n\n if 0 == r % i:\n\n phi = phi*(i-1)\/\/i\n\n while 0 == r % i:\n\n r \/\/= i\n\n if 1 < r:\n\n phi = phi*(r-1)\/\/r\n\n\n\n D = set()\n\n for d in range(1, int(sqrt(phi)+1)):\n\n if 0 == phi % d:\n\n D.add(d)\n\n D.add(phi\/\/d)\n\n\n\n ret = -1\n\n for m in sorted(D):\n\n if 1 == pow(10, m, l):\n\n ret = m\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n","code_v0_loc":31,"code_v1_loc":37,"code_v0_num_chars":598,"code_v1_num_chars":758,"code_v0_no_empty_lines":"# coding: utf-8\ndef solve(*args: str) -> str:\n k = int(args[0])\n l = 9 * (k \/\/ 7 if k % 7 == 0 else k)\n if l % 2 == 0 or l % 5 == 0:\n return \"-1\"\n r = phi = l\n for i in range(2, int(-pow(l, 1 \/ 2))):\n if r % i == 0:\n phi = phi \/\/ i * (i - 1)\n while r % i:\n r \/\/= i\n a = 10 % l\n ret = 1\n while a != 1:\n a = a * 10 % l\n ret += 1\n if phi < ret:\n ret = -1\n break\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_v1_no_empty_lines":"# coding: utf-8\nfrom math import sqrt\n\n\ndef solve(*args: str) -> str:\n k = int(args[0])\n l = 9 * (k \/\/ 7 if 0 == k % 7 else k)\n if 0 == l % 2 or 0 == l % 5:\n return \"-1\"\n r = phi = l\n for i in range(2, int(sqrt(l) + 1)):\n if 0 == r % i:\n phi = phi * (i - 1) \/\/ i\n while 0 == r % i:\n r \/\/= i\n if 1 < r:\n phi = phi * (r - 1) \/\/ r\n D = set()\n for d in range(1, int(sqrt(phi) + 1)):\n if 0 == phi % d:\n D.add(d)\n D.add(phi \/\/ d)\n ret = -1\n for m in sorted(D):\n if 1 == pow(10, m, l):\n ret = m\n break\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_same":false,"relative_loc_diff_percent":16.2162162162,"diff":["+from math import sqrt","+","+","- l = 9 * (k \/\/ 7 if k % 7 == 0 else k)","- if l % 2 == 0 or l % 5 == 0:","+ l = 9 * (k \/\/ 7 if 0 == k % 7 else k)","+ if 0 == l % 2 or 0 == l % 5:","- for i in range(2, int(-pow(l, 1 \/ 2))):","- if r % i == 0:","- phi = phi \/\/ i * (i - 1)","- while r % i:","+ for i in range(2, int(sqrt(l) + 1)):","+ if 0 == r % i:","+ phi = phi * (i - 1) \/\/ i","+ while 0 == r % i:","- a = 10 % l","- ret = 1","- while a != 1:","- a = a * 10 % l","- ret += 1","- if phi < ret:","- ret = -1","+ if 1 < r:","+ phi = phi * (r - 1) \/\/ r","+ D = set()","+ for d in range(1, int(sqrt(phi) + 1)):","+ if 0 == phi % d:","+ D.add(d)","+ D.add(phi \/\/ d)","+ ret = -1","+ for m in sorted(D):","+ if 1 == pow(10, m, l):","+ ret = m"],"diff_only_import_comment":false,"measured_runtime_v0":0.4349818358,"measured_runtime_v1":0.2757263954,"runtime_lift":1.5775850377,"key":["s121951272","s390007993"]} +{"user_id":"u440566786","problem_id":"p02863","language":"python","submission_id_v0":"s564882715","submission_id_v1":"s252011051","cpu_time_v0":496,"cpu_time_v1":355,"memory_v0":47580,"memory_v1":43228,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n,T=list(map(int,input().split()))\n\n AB=[tuple(map(int,input().split())) for _ in range(n)]\n\n ans=-INF\n\n\n\n # \u4f55\u3082\u8003\u3048\u305a\u3084\u308b\n\n dp=[0]*T\n\n for i in range(n):\n\n a,b=AB[i]\n\n ndp=dp[:]\n\n for t in range(T):\n\n if(t+a 0:\n\n ans += 1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"\n\nclass node:\n\n def __init__(self, id):\n\n self.id = id\n\n self.root = self\n\n\n\n def findRoot(self):\n\n if self == self.root:\n\n return self\n\n else:\n\n self.root = self.root.findRoot()\n\n return self.root\n\n\n\n def resetRoot(self):\n\n self.root = self\n\n\n\nclass Tree:\n\n def __init__(self, num):\n\n self.nodes = {i:node(i) for i in range(num)}\n\n\n\n def union(self, one, other):\n\n root1 = one.findRoot()\n\n root2 = other.findRoot()\n\n root1.root = root2.root = self.nodes[min(root1.id, root2.id)]\n\n\n\n def resetTree(self):\n\n for n in list(self.nodes.values()):\n\n n.resetRoot()\n\n\n\n def makeTree(self, Edge):\n\n self.edge = Edge\n\n for x,y in Edge:\n\n self.union(self.nodes[x-1], self.nodes[y-1])\n\n\n\n\n\ndef main():\n\n with open(0) as f:\n\n N, M = list(map(int, f.readline().split()))\n\n Edge = [tuple(map(int, line.split())) for line in f.readlines()]\n\n \n\n tree = Tree(N)\n\n ans = 0\n\n for i in range(M):\n\n edge = [v for v in Edge if v != Edge[i]]\n\n tree.makeTree(edge)\n\n if any(x.findRoot().id != 0 for x in list(tree.nodes.values())):\n\n ans += 1\n\n tree.resetTree()\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":20,"code_v1_loc":52,"code_v0_num_chars":599,"code_v1_num_chars":1306,"code_v0_no_empty_lines":"N, M = (int(x) for x in input().split())\nedge = [tuple(int(x) for x in input().split()) for _ in range(M)]\nimport numpy as np\nfrom scipy.sparse.csgraph import floyd_warshall\n\nINF = 100\ntmpl_graph = [[INF if i != j else 0 for j in range(N)] for i in range(N)]\nans = 0\nfor E in edge:\n edgeWithoutE = edge.copy()\n edgeWithoutE.remove(E)\n graph = np.array(tmpl_graph)\n for x in edgeWithoutE:\n graph[x[0] - 1, x[1] - 1] = 1\n graph[x[1] - 1, x[0] - 1] = 1\n graph = floyd_warshall(graph, directed=False)\n if len(graph[graph == 100]) > 0:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"class node:\n def __init__(self, id):\n self.id = id\n self.root = self\n\n def findRoot(self):\n if self == self.root:\n return self\n else:\n self.root = self.root.findRoot()\n return self.root\n\n def resetRoot(self):\n self.root = self\n\n\nclass Tree:\n def __init__(self, num):\n self.nodes = {i: node(i) for i in range(num)}\n\n def union(self, one, other):\n root1 = one.findRoot()\n root2 = other.findRoot()\n root1.root = root2.root = self.nodes[min(root1.id, root2.id)]\n\n def resetTree(self):\n for n in list(self.nodes.values()):\n n.resetRoot()\n\n def makeTree(self, Edge):\n self.edge = Edge\n for x, y in Edge:\n self.union(self.nodes[x - 1], self.nodes[y - 1])\n\n\ndef main():\n with open(0) as f:\n N, M = list(map(int, f.readline().split()))\n Edge = [tuple(map(int, line.split())) for line in f.readlines()]\n tree = Tree(N)\n ans = 0\n for i in range(M):\n edge = [v for v in Edge if v != Edge[i]]\n tree.makeTree(edge)\n if any(x.findRoot().id != 0 for x in list(tree.nodes.values())):\n ans += 1\n tree.resetTree()\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":61.5384615385,"diff":["-N, M = (int(x) for x in input().split())","-edge = [tuple(int(x) for x in input().split()) for _ in range(M)]","-import numpy as np","-from scipy.sparse.csgraph import floyd_warshall","+class node:","+ def __init__(self, id):","+ self.id = id","+ self.root = self","-INF = 100","-tmpl_graph = [[INF if i != j else 0 for j in range(N)] for i in range(N)]","-ans = 0","-for E in edge:","- edgeWithoutE = edge.copy()","- edgeWithoutE.remove(E)","- graph = np.array(tmpl_graph)","- for x in edgeWithoutE:","- graph[x[0] - 1, x[1] - 1] = 1","- graph[x[1] - 1, x[0] - 1] = 1","- graph = floyd_warshall(graph, directed=False)","- if len(graph[graph == 100]) > 0:","- ans += 1","-print(ans)","+ def findRoot(self):","+ if self == self.root:","+ return self","+ else:","+ self.root = self.root.findRoot()","+ return self.root","+","+ def resetRoot(self):","+ self.root = self","+","+","+class Tree:","+ def __init__(self, num):","+ self.nodes = {i: node(i) for i in range(num)}","+","+ def union(self, one, other):","+ root1 = one.findRoot()","+ root2 = other.findRoot()","+ root1.root = root2.root = self.nodes[min(root1.id, root2.id)]","+","+ def resetTree(self):","+ for n in list(self.nodes.values()):","+ n.resetRoot()","+","+ def makeTree(self, Edge):","+ self.edge = Edge","+ for x, y in Edge:","+ self.union(self.nodes[x - 1], self.nodes[y - 1])","+","+","+def main():","+ with open(0) as f:","+ N, M = list(map(int, f.readline().split()))","+ Edge = [tuple(map(int, line.split())) for line in f.readlines()]","+ tree = Tree(N)","+ ans = 0","+ for i in range(M):","+ edge = [v for v in Edge if v != Edge[i]]","+ tree.makeTree(edge)","+ if any(x.findRoot().id != 0 for x in list(tree.nodes.values())):","+ ans += 1","+ tree.resetTree()","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":2.0407500911,"measured_runtime_v1":0.2041443679,"runtime_lift":9.9966024615,"key":["s277296975","s689362610"]} +{"user_id":"u440161695","problem_id":"p03107","language":"python","submission_id_v0":"s703980325","submission_id_v1":"s025529722","cpu_time_v0":26,"cpu_time_v1":18,"memory_v0":3444,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.77,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\nd={chr(i):0 for i in range(2)}\n\ns=Counter(eval(input()))\n\nd=d.update(s)\n\nprint((min(s[\"0\"],s[\"1\"])*2))\n\n# optimized version of the same code:\n","target":"s=eval(input())\n\nprint((min(s.count(\"0\"),s.count(\"1\"))*2))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":127,"code_v1_num_chars":50,"code_v0_no_empty_lines":"from collections import Counter\n\nd = {chr(i): 0 for i in range(2)}\ns = Counter(eval(input()))\nd = d.update(s)\nprint((min(s[\"0\"], s[\"1\"]) * 2))\n","code_v1_no_empty_lines":"s = eval(input())\nprint((min(s.count(\"0\"), s.count(\"1\")) * 2))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-from collections import Counter","-","-d = {chr(i): 0 for i in range(2)}","-s = Counter(eval(input()))","-d = d.update(s)","-print((min(s[\"0\"], s[\"1\"]) * 2))","+s = eval(input())","+print((min(s.count(\"0\"), s.count(\"1\")) * 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5096813786,"measured_runtime_v1":0.1983500416,"runtime_lift":2.5696056043,"key":["s703980325","s025529722"]} +{"user_id":"u841531687","problem_id":"p03000","language":"python","submission_id_v0":"s390185170","submission_id_v1":"s766981142","cpu_time_v0":22,"cpu_time_v1":18,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport bisect\n\n\n\nN, X = list(map(int, input().split()))\n\nl = list(map(int, input().split()))\n\nd = [-1]*(N+1) #0-index #\u30d0\u30a6\u30f3\u30c9\u3059\u308b\u4f4d\u7f6e\u3092\u683c\u7d0d\u3059\u308b\u30ea\u30b9\u30c8\n\nd[0] = 0 #\u30d0\u30a6\u30f3\u30c9\u3059\u308b\u521d\u671f\u5024\u306f0\n\n\n\nfor i in range(1, N+1):\n\n d[i] = d[i-1] + l[i-1]\n\n\n\n#print(d)\n\n#print('left:', bisect.bisect_left(d, X))\n\n#print('right:', bisect.bisect_right(d, X))\n\nprint((bisect.bisect_right(d, X)))\n\n# optimized version of the same code:\n","target":"import bisect\n\n\n\nn,x = list(map(int, input().split()))\n\nl = tuple(map(int, input().split()))\n\n\n\nd = [-1]*(n+1)\n\nd[0] = 0\n\nfor i in range(1, n+1):\n\n d[i] = d[i-1] + l[i-1]\n\nres = bisect.bisect_right(sorted(d), x)\n\nprint(res)","code_v0_loc":14,"code_v1_loc":11,"code_v0_num_chars":342,"code_v1_num_chars":220,"code_v0_no_empty_lines":"import bisect\n\nN, X = list(map(int, input().split()))\nl = list(map(int, input().split()))\nd = [-1] * (N + 1) # 0-index #\u30d0\u30a6\u30f3\u30c9\u3059\u308b\u4f4d\u7f6e\u3092\u683c\u7d0d\u3059\u308b\u30ea\u30b9\u30c8\nd[0] = 0 # \u30d0\u30a6\u30f3\u30c9\u3059\u308b\u521d\u671f\u5024\u306f0\nfor i in range(1, N + 1):\n d[i] = d[i - 1] + l[i - 1]\n# print(d)\n# print('left:', bisect.bisect_left(d, X))\n# print('right:', bisect.bisect_right(d, X))\nprint((bisect.bisect_right(d, X)))\n","code_v1_no_empty_lines":"import bisect\n\nn, x = list(map(int, input().split()))\nl = tuple(map(int, input().split()))\nd = [-1] * (n + 1)\nd[0] = 0\nfor i in range(1, n + 1):\n d[i] = d[i - 1] + l[i - 1]\nres = bisect.bisect_right(sorted(d), x)\nprint(res)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-N, X = list(map(int, input().split()))","-l = list(map(int, input().split()))","-d = [-1] * (N + 1) # 0-index #\u30d0\u30a6\u30f3\u30c9\u3059\u308b\u4f4d\u7f6e\u3092\u683c\u7d0d\u3059\u308b\u30ea\u30b9\u30c8","-d[0] = 0 # \u30d0\u30a6\u30f3\u30c9\u3059\u308b\u521d\u671f\u5024\u306f0","-for i in range(1, N + 1):","+n, x = list(map(int, input().split()))","+l = tuple(map(int, input().split()))","+d = [-1] * (n + 1)","+d[0] = 0","+for i in range(1, n + 1):","-# print(d)","-# print('left:', bisect.bisect_left(d, X))","-# print('right:', bisect.bisect_right(d, X))","-print((bisect.bisect_right(d, X)))","+res = bisect.bisect_right(sorted(d), x)","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.359830588,"measured_runtime_v1":0.2651810681,"runtime_lift":1.356924122,"key":["s390185170","s766981142"]} +{"user_id":"u017415492","problem_id":"p02690","language":"python","submission_id_v0":"s441153846","submission_id_v1":"s191790319","cpu_time_v0":115,"cpu_time_v1":38,"memory_v0":28112,"memory_v1":9176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.96,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nx=int(eval(input()))\n\n#\uff41\u2075\uff0d\uff42\u2075\uff1d(\uff41\uff0d\uff42)(\uff41\u2074\uff0b\uff41\u00b3\uff42\uff0b\uff41\u00b2\uff42\u00b2\uff0b\uff41\uff42\u00b3\uff0b\uff42\u2074)\n\ndef make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n \/\/ i:\n\n divisors.append(n\/\/i)\n\n return divisors\n\nd=make_divisors(x)\n\nfor i in range(len(d)):\n\n d.append(-d[i])\n\nflag=False\n\n\n\nfor i in d:\n\n if flag==True:\n\n break\n\n tui=x\/\/i\n\n ans=np.roots([5,10*i,10*i**2,5*i**3,i**4-tui])\n\n for j in ans:\n\n if flag==True:\n\n break\n\n if j.imag==0:\n\n a=i+round(j.real)\n\n if a**5-(round(j.real))**5==x:\n\n print((int(a),int(round(j.real))))\n\n flag=True\n\n break\n\n# optimized version of the same code:\n","target":"x=int(eval(input()))\n\nflag=True\n\nfor i in range(-118,120):\n\n if flag==False:\n\n break\n\n for j in range(-119,119):\n\n if x==(i**5-j**5):\n\n print((i,j))\n\n flag=False\n\n break","code_v0_loc":30,"code_v1_loc":10,"code_v0_num_chars":676,"code_v1_num_chars":184,"code_v0_no_empty_lines":"import numpy as np\n\nx = int(eval(input()))\n# \uff41\u2075\uff0d\uff42\u2075\uff1d(\uff41\uff0d\uff42)(\uff41\u2074\uff0b\uff41\u00b3\uff42\uff0b\uff41\u00b2\uff42\u00b2\uff0b\uff41\uff42\u00b3\uff0b\uff42\u2074)\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n \/\/ i:\n divisors.append(n \/\/ i)\n return divisors\n\n\nd = make_divisors(x)\nfor i in range(len(d)):\n d.append(-d[i])\nflag = False\nfor i in d:\n if flag == True:\n break\n tui = x \/\/ i\n ans = np.roots([5, 10 * i, 10 * i**2, 5 * i**3, i**4 - tui])\n for j in ans:\n if flag == True:\n break\n if j.imag == 0:\n a = i + round(j.real)\n if a**5 - (round(j.real)) ** 5 == x:\n print((int(a), int(round(j.real))))\n flag = True\n break\n","code_v1_no_empty_lines":"x = int(eval(input()))\nflag = True\nfor i in range(-118, 120):\n if flag == False:\n break\n for j in range(-119, 119):\n if x == (i**5 - j**5):\n print((i, j))\n flag = False\n break\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-import numpy as np","-","-# \uff41\u2075\uff0d\uff42\u2075\uff1d(\uff41\uff0d\uff42)(\uff41\u2074\uff0b\uff41\u00b3\uff42\uff0b\uff41\u00b2\uff42\u00b2\uff0b\uff41\uff42\u00b3\uff0b\uff42\u2074)","-def make_divisors(n):","- divisors = []","- for i in range(1, int(n**0.5) + 1):","- if n % i == 0:","- divisors.append(i)","- if i != n \/\/ i:","- divisors.append(n \/\/ i)","- return divisors","-","-","-d = make_divisors(x)","-for i in range(len(d)):","- d.append(-d[i])","-flag = False","-for i in d:","- if flag == True:","+flag = True","+for i in range(-118, 120):","+ if flag == False:","- tui = x \/\/ i","- ans = np.roots([5, 10 * i, 10 * i**2, 5 * i**3, i**4 - tui])","- for j in ans:","- if flag == True:","+ for j in range(-119, 119):","+ if x == (i**5 - j**5):","+ print((i, j))","+ flag = False","- if j.imag == 0:","- a = i + round(j.real)","- if a**5 - (round(j.real)) ** 5 == x:","- print((int(a), int(round(j.real))))","- flag = True","- break"],"diff_only_import_comment":false,"measured_runtime_v0":1.4192973773,"measured_runtime_v1":0.0068819066,"runtime_lift":206.2360709024,"key":["s441153846","s191790319"]} +{"user_id":"u912237403","problem_id":"p00145","language":"python","submission_id_v0":"s120507501","submission_id_v1":"s768605614","cpu_time_v0":160,"cpu_time_v1":130,"memory_v0":4524,"memory_v1":4520,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.75,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom functools import reduce\ndef f(a,b): return [Card[a][0], Card[b][1]]\n\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, f(j, k) + f(k+1, a)) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])\n\n# optimized version of the same code:\n","target":"from functools import reduce\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, [Card[j][0],Card[k][1],Card[k+1][0],Card[a][1]]) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":397,"code_v1_num_chars":380,"code_v0_no_empty_lines":"from functools import reduce\n\n\ndef f(a, b):\n return [Card[a][0], Card[b][1]]\n\n\nn = int(input())\nCard = [[] for _ in [0] * n]\nCost = {}\nfor i in range(n):\n Card[i] = list(map(int, input().split()))\n Cost[(i, i)] = 0\nfor i in range(1, n):\n for j in range(0, n - i):\n a = j + i\n Cost[(j, a)] = min(\n [\n reduce(lambda a, b: a * b, f(j, k) + f(k + 1, a))\n + Cost[(j, k)]\n + Cost[(k + 1, a)]\n for k in range(j, j + i)\n ]\n )\nprint(Cost[0, n - 1])\n","code_v1_no_empty_lines":"from functools import reduce\n\nn = int(input())\nCard = [[] for _ in [0] * n]\nCost = {}\nfor i in range(n):\n Card[i] = list(map(int, input().split()))\n Cost[(i, i)] = 0\nfor i in range(1, n):\n for j in range(0, n - i):\n a = j + i\n Cost[(j, a)] = min(\n [\n reduce(\n lambda a, b: a * b,\n [Card[j][0], Card[k][1], Card[k + 1][0], Card[a][1]],\n )\n + Cost[(j, k)]\n + Cost[(k + 1, a)]\n for k in range(j, j + i)\n ]\n )\nprint(Cost[0, n - 1])\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-","-","-def f(a, b):","- return [Card[a][0], Card[b][1]]","-","- reduce(lambda a, b: a * b, f(j, k) + f(k + 1, a))","+ reduce(","+ lambda a, b: a * b,","+ [Card[j][0], Card[k][1], Card[k + 1][0], Card[a][1]],","+ )"],"diff_only_import_comment":false,"measured_runtime_v0":0.2898506114,"measured_runtime_v1":0.2096236434,"runtime_lift":1.3827190804,"key":["s120507501","s768605614"]} +{"user_id":"u532966492","problem_id":"p03039","language":"python","submission_id_v0":"s814969347","submission_id_v1":"s884180243","cpu_time_v0":555,"cpu_time_v1":399,"memory_v0":27096,"memory_v1":3192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef cmb(n, r, mod):\n\n if ( r<0 or r>n ):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\nA=2*10**5\n\nmod = 10**9+7\n\ng1 = [1, 1]\n\ng2 = [1, 1]\n\ninverse = [0, 1]\n\n\n\nfor i in range( 2, A + 1 ):\n\n g1.append( ( g1[-1] * i ) % mod )\n\n inverse.append( ( -inverse[mod % i] * (mod\/\/i) ) % mod )\n\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=cmb(N*M-2,K-2,mod)\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)\/\/2)+(b*(b+1)\/\/2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)\/\/2)+(b*(b+1)\/\/2))\n\nprint(((keisuu * (sum_\/\/2))%mod))\n\n# optimized version of the same code:\n","target":"def power_mod(a,b,mod=10**9+7):\n\n i,temp,box=0,b,[]\n\n while(2**i<=b):\n\n i+=1\n\n for j in range(i-1,-1,-1):\n\n box=[[j,temp\/\/2**j]]+box\n\n temp-=2**j*(temp\/\/2**j)\n\n box[0].append(a)\n\n ans=box[0][1]*a%mod\n\n for j in range(1,i):\n\n box[j].append(box[j-1][2]**2%mod)\n\n if box[j][1]==1:\n\n ans=(ans*box[j][2])%mod\n\n return ans\n\ndef n_func(n,mod=10**9+7):\n\n ans=1\n\n for i in range(1,n+1):\n\n ans=(ans*i)%mod\n\n return ans\n\ndef nPr(n,r,mod=10**9+7):\n\n ans=n_func(n-r,mod)\n\n ans=power_mod(ans,mod-2,mod)\n\n return ans*n_func(n,mod)%mod\n\ndef nCr(n,r,mod=10**9+7):\n\n ans=n_func(n-r,mod)*n_func(r,mod)%mod\n\n ans=power_mod(ans,mod-2,mod)\n\n return ans*n_func(n,mod)%mod\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=nCr(N*M-2,K-2)\n\nmod=10**9+7\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)\/\/2)+(b*(b+1)\/\/2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)\/\/2)+(b*(b+1)\/\/2))\n\nprint(((keisuu * (sum_\/\/2))%mod))","code_v0_loc":30,"code_v1_loc":42,"code_v0_num_chars":731,"code_v1_num_chars":1114,"code_v0_no_empty_lines":"def cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\nA = 2 * 10**5\nmod = 10**9 + 7\ng1 = [1, 1]\ng2 = [1, 1]\ninverse = [0, 1]\nfor i in range(2, A + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\nN, M, K = list(map(int, input().split()))\nkeisuu = cmb(N * M - 2, K - 2, mod)\nsum_ = 0\nfor i in range(N):\n a = min(abs(i), abs(N - i - 1))\n b = max(abs(i), abs(N - i - 1))\n sum_ += (M**2) * ((a * (a + 1) \/\/ 2) + (b * (b + 1) \/\/ 2))\nfor i in range(M):\n a = min(abs(i), abs(M - i - 1))\n b = max(abs(i), abs(M - i - 1))\n sum_ += (N**2) * ((a * (a + 1) \/\/ 2) + (b * (b + 1) \/\/ 2))\nprint(((keisuu * (sum_ \/\/ 2)) % mod))\n","code_v1_no_empty_lines":"def power_mod(a, b, mod=10**9 + 7):\n i, temp, box = 0, b, []\n while 2**i <= b:\n i += 1\n for j in range(i - 1, -1, -1):\n box = [[j, temp \/\/ 2**j]] + box\n temp -= 2**j * (temp \/\/ 2**j)\n box[0].append(a)\n ans = box[0][1] * a % mod\n for j in range(1, i):\n box[j].append(box[j - 1][2] ** 2 % mod)\n if box[j][1] == 1:\n ans = (ans * box[j][2]) % mod\n return ans\n\n\ndef n_func(n, mod=10**9 + 7):\n ans = 1\n for i in range(1, n + 1):\n ans = (ans * i) % mod\n return ans\n\n\ndef nPr(n, r, mod=10**9 + 7):\n ans = n_func(n - r, mod)\n ans = power_mod(ans, mod - 2, mod)\n return ans * n_func(n, mod) % mod\n\n\ndef nCr(n, r, mod=10**9 + 7):\n ans = n_func(n - r, mod) * n_func(r, mod) % mod\n ans = power_mod(ans, mod - 2, mod)\n return ans * n_func(n, mod) % mod\n\n\nN, M, K = list(map(int, input().split()))\nkeisuu = nCr(N * M - 2, K - 2)\nmod = 10**9 + 7\nsum_ = 0\nfor i in range(N):\n a = min(abs(i), abs(N - i - 1))\n b = max(abs(i), abs(N - i - 1))\n sum_ += (M**2) * ((a * (a + 1) \/\/ 2) + (b * (b + 1) \/\/ 2))\nfor i in range(M):\n a = min(abs(i), abs(M - i - 1))\n b = max(abs(i), abs(M - i - 1))\n sum_ += (N**2) * ((a * (a + 1) \/\/ 2) + (b * (b + 1) \/\/ 2))\nprint(((keisuu * (sum_ \/\/ 2)) % mod))\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-def cmb(n, r, mod):","- if r < 0 or r > n:","- return 0","- r = min(r, n - r)","- return g1[n] * g2[r] * g2[n - r] % mod","+def power_mod(a, b, mod=10**9 + 7):","+ i, temp, box = 0, b, []","+ while 2**i <= b:","+ i += 1","+ for j in range(i - 1, -1, -1):","+ box = [[j, temp \/\/ 2**j]] + box","+ temp -= 2**j * (temp \/\/ 2**j)","+ box[0].append(a)","+ ans = box[0][1] * a % mod","+ for j in range(1, i):","+ box[j].append(box[j - 1][2] ** 2 % mod)","+ if box[j][1] == 1:","+ ans = (ans * box[j][2]) % mod","+ return ans","-A = 2 * 10**5","+def n_func(n, mod=10**9 + 7):","+ ans = 1","+ for i in range(1, n + 1):","+ ans = (ans * i) % mod","+ return ans","+","+","+def nPr(n, r, mod=10**9 + 7):","+ ans = n_func(n - r, mod)","+ ans = power_mod(ans, mod - 2, mod)","+ return ans * n_func(n, mod) % mod","+","+","+def nCr(n, r, mod=10**9 + 7):","+ ans = n_func(n - r, mod) * n_func(r, mod) % mod","+ ans = power_mod(ans, mod - 2, mod)","+ return ans * n_func(n, mod) % mod","+","+","+N, M, K = list(map(int, input().split()))","+keisuu = nCr(N * M - 2, K - 2)","-g1 = [1, 1]","-g2 = [1, 1]","-inverse = [0, 1]","-for i in range(2, A + 1):","- g1.append((g1[-1] * i) % mod)","- inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)","- g2.append((g2[-1] * inverse[-1]) % mod)","-N, M, K = list(map(int, input().split()))","-keisuu = cmb(N * M - 2, K - 2, mod)"],"diff_only_import_comment":false,"measured_runtime_v0":2.5172936699,"measured_runtime_v1":0.2314554,"runtime_lift":10.8759340674,"key":["s814969347","s884180243"]} +{"user_id":"u580316619","problem_id":"p03494","language":"python","submission_id_v0":"s104933715","submission_id_v1":"s431749405","cpu_time_v0":148,"cpu_time_v1":21,"memory_v0":12396,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.81,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn=int(eval(input()))\n\na=np.array(list(map(int,input().split())))\n\nb=0\n\nwhile np.all(a%2==0):\n\n\ta=a\/2\n\n\tb+=1\n\n\t\n\nprint(b)\n\n# optimized version of the same code:\n","target":"a = int(eval(input(\"\")))\n\nb = input(\"\").split(\" \")\n\nc = 0\n\nd = []\n\n\n\nfor i in range(a):\n\n\tc = 0\n\n\twhile (int(b[i]) % 2 == 0):\n\n\t\tb[i] = int(b[i]) \/ 2\n\n\t\tc += 1\n\n\td.append(c)\n\nprint((min(d)))","code_v0_loc":9,"code_v1_loc":12,"code_v0_num_chars":134,"code_v1_num_chars":182,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\na = np.array(list(map(int, input().split())))\nb = 0\nwhile np.all(a % 2 == 0):\n a = a \/ 2\n b += 1\nprint(b)\n","code_v1_no_empty_lines":"a = int(eval(input(\"\")))\nb = input(\"\").split(\" \")\nc = 0\nd = []\nfor i in range(a):\n c = 0\n while int(b[i]) % 2 == 0:\n b[i] = int(b[i]) \/ 2\n c += 1\n d.append(c)\nprint((min(d)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import numpy as np","-","-n = int(eval(input()))","-a = np.array(list(map(int, input().split())))","-b = 0","-while np.all(a % 2 == 0):","- a = a \/ 2","- b += 1","-print(b)","+a = int(eval(input(\"\")))","+b = input(\"\").split(\" \")","+c = 0","+d = []","+for i in range(a):","+ c = 0","+ while int(b[i]) % 2 == 0:","+ b[i] = int(b[i]) \/ 2","+ c += 1","+ d.append(c)","+print((min(d)))"],"diff_only_import_comment":false,"measured_runtime_v0":2.2201787407,"measured_runtime_v1":0.3198084066,"runtime_lift":6.9422150729,"key":["s104933715","s431749405"]} +{"user_id":"u525065967","problem_id":"p02574","language":"python","submission_id_v0":"s426798312","submission_id_v1":"s281371619","cpu_time_v0":542,"cpu_time_v1":466,"memory_v0":127576,"memory_v1":127552,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.02,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef gen_d_prim(n):\n\n D = [n+1 if i%2 else 2 for i in range(n+1)]\n\n D[0] = D[1] = 0\n\n for i in range(3, n+1, 2):\n\n if D[i] != n+1: continue\n\n for j in range(i, n+1, i): D[j] = i\n\n return D\n\n\n\ndef is_pairwise(A):\n\n D = gen_d_prim(10**6)\n\n past = set()\n\n for a in A:\n\n now = set()\n\n while a != 1:\n\n # \u7d20\u6570 D[a]: \u4eca\u56de\u306f\u672a\u6e08 & \u904e\u53bb\u3067\u6e08\n\n if not D[a] in now and D[a] in past: return False\n\n now.add(D[a])\n\n past.add(D[a])\n\n a \/\/= D[a]\n\n return True\n\n\n\ndef gcd_all(A):\n\n from math import gcd\n\n g = 0\n\n for a in A: g = gcd(g, a)\n\n return g\n\n\n\ndef solve():\n\n if is_pairwise(A): return 0\n\n if gcd_all(A) == 1: return 1\n\n return 2\n\n\n\nn = int(eval(input()))\n\nA = [*list(map(int, input().split()))]\n\nprint((['pairwise','setwise','not'][solve()], 'coprime'))\n\n\n# optimized version of the same code:\n","target":"def gen_d_prim(n):\n\n D = [0,0] + [-1] * (n-1)\n\n for i in range(2, n+1, 2): D[i] = 2\n\n for i in range(3, n+1, 2):\n\n if D[i] > 0: continue\n\n for j in range(i, n+1, i): D[j] = i\n\n return D\n\n\n\ndef is_pairwise(A):\n\n D = gen_d_prim(10**6)\n\n past = set()\n\n for a in A:\n\n now = set()\n\n while a != 1:\n\n # \u7d20\u6570 D[a]: \u4eca\u56de\u306f\u672a\u6e08 & \u904e\u53bb\u3067\u6e08\n\n if not D[a] in now and D[a] in past: return False\n\n now.add(D[a])\n\n past.add(D[a])\n\n a \/\/= D[a]\n\n return True\n\n\n\ndef gcd_all(A):\n\n from math import gcd\n\n g = 0\n\n for a in A: g = gcd(g, a)\n\n return g\n\n\n\ndef solve():\n\n if is_pairwise(A): return 0\n\n if gcd_all(A) == 1: return 1\n\n return 2\n\n\n\nn = int(eval(input()))\n\nA = [*list(map(int, input().split()))]\n\nprint((['pairwise','setwise','not'][solve()], 'coprime'))\n","code_v0_loc":35,"code_v1_loc":35,"code_v0_num_chars":848,"code_v1_num_chars":846,"code_v0_no_empty_lines":"def gen_d_prim(n):\n D = [n + 1 if i % 2 else 2 for i in range(n + 1)]\n D[0] = D[1] = 0\n for i in range(3, n + 1, 2):\n if D[i] != n + 1:\n continue\n for j in range(i, n + 1, i):\n D[j] = i\n return D\n\n\ndef is_pairwise(A):\n D = gen_d_prim(10**6)\n past = set()\n for a in A:\n now = set()\n while a != 1:\n # \u7d20\u6570 D[a]: \u4eca\u56de\u306f\u672a\u6e08 & \u904e\u53bb\u3067\u6e08\n if not D[a] in now and D[a] in past:\n return False\n now.add(D[a])\n past.add(D[a])\n a \/\/= D[a]\n return True\n\n\ndef gcd_all(A):\n from math import gcd\n\n g = 0\n for a in A:\n g = gcd(g, a)\n return g\n\n\ndef solve():\n if is_pairwise(A):\n return 0\n if gcd_all(A) == 1:\n return 1\n return 2\n\n\nn = int(eval(input()))\nA = [*list(map(int, input().split()))]\nprint(([\"pairwise\", \"setwise\", \"not\"][solve()], \"coprime\"))\n","code_v1_no_empty_lines":"def gen_d_prim(n):\n D = [0, 0] + [-1] * (n - 1)\n for i in range(2, n + 1, 2):\n D[i] = 2\n for i in range(3, n + 1, 2):\n if D[i] > 0:\n continue\n for j in range(i, n + 1, i):\n D[j] = i\n return D\n\n\ndef is_pairwise(A):\n D = gen_d_prim(10**6)\n past = set()\n for a in A:\n now = set()\n while a != 1:\n # \u7d20\u6570 D[a]: \u4eca\u56de\u306f\u672a\u6e08 & \u904e\u53bb\u3067\u6e08\n if not D[a] in now and D[a] in past:\n return False\n now.add(D[a])\n past.add(D[a])\n a \/\/= D[a]\n return True\n\n\ndef gcd_all(A):\n from math import gcd\n\n g = 0\n for a in A:\n g = gcd(g, a)\n return g\n\n\ndef solve():\n if is_pairwise(A):\n return 0\n if gcd_all(A) == 1:\n return 1\n return 2\n\n\nn = int(eval(input()))\nA = [*list(map(int, input().split()))]\nprint(([\"pairwise\", \"setwise\", \"not\"][solve()], \"coprime\"))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- D = [n + 1 if i % 2 else 2 for i in range(n + 1)]","- D[0] = D[1] = 0","+ D = [0, 0] + [-1] * (n - 1)","+ for i in range(2, n + 1, 2):","+ D[i] = 2","- if D[i] != n + 1:","+ if D[i] > 0:"],"diff_only_import_comment":false,"measured_runtime_v0":4.0933866422,"measured_runtime_v1":3.0755219285,"runtime_lift":1.3309567408,"key":["s426798312","s281371619"]} +{"user_id":"u843175622","problem_id":"p03298","language":"python","submission_id_v0":"s154354411","submission_id_v1":"s298686601","cpu_time_v0":1580,"cpu_time_v1":641,"memory_v0":300724,"memory_v1":222320,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import defaultdict\n\nn = int(eval(input()))\n\ns = eval(input())\n\n\n\na = s[:n]\n\nb = s[n:][::-1]\n\nd = defaultdict(int)\n\ne = defaultdict(int)\n\n\n\ndef cnt(c, d):\n\n for bit in range(1 << n):\n\n x = []\n\n y = []\n\n for i in range(n):\n\n if bit >> i & 1:\n\n x.append(c[i])\n\n else:\n\n y.append(c[i])\n\n d[(str(x), str(y))] += 1\n\n\n\n\n\ncnt(a, d)\n\ncnt(b, e)\n\n\n\nans = 0\n\nfor k, v in list(d.items()):\n\n ans += e[k] * v\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"from collections import defaultdict\n\nn = int(eval(input()))\n\ns = eval(input())\n\n\n\na = s[:n]\n\nb = s[n:][::-1]\n\nd = defaultdict(int)\n\ne = defaultdict(int)\n\n\n\nfor bit in range(1 << n):\n\n x = \"\"\n\n y = \"\"\n\n z = \"\"\n\n w = \"\"\n\n for i in range(n):\n\n if bit >> i & 1:\n\n x += a[i]\n\n z += b[i]\n\n else:\n\n y += a[i]\n\n w += b[i]\n\n d[x+'\u03c9'+y] += 1\n\n e[z+'\u03c9'+w] += 1\n\n\n\nprint((sum([e[k] * v for k, v in list(d.items())])))\n","code_v0_loc":28,"code_v1_loc":25,"code_v0_num_chars":491,"code_v1_num_chars":465,"code_v0_no_empty_lines":"from collections import defaultdict\n\nn = int(eval(input()))\ns = eval(input())\na = s[:n]\nb = s[n:][::-1]\nd = defaultdict(int)\ne = defaultdict(int)\n\n\ndef cnt(c, d):\n for bit in range(1 << n):\n x = []\n y = []\n for i in range(n):\n if bit >> i & 1:\n x.append(c[i])\n else:\n y.append(c[i])\n d[(str(x), str(y))] += 1\n\n\ncnt(a, d)\ncnt(b, e)\nans = 0\nfor k, v in list(d.items()):\n ans += e[k] * v\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nn = int(eval(input()))\ns = eval(input())\na = s[:n]\nb = s[n:][::-1]\nd = defaultdict(int)\ne = defaultdict(int)\nfor bit in range(1 << n):\n x = \"\"\n y = \"\"\n z = \"\"\n w = \"\"\n for i in range(n):\n if bit >> i & 1:\n x += a[i]\n z += b[i]\n else:\n y += a[i]\n w += b[i]\n d[x + \"\u03c9\" + y] += 1\n e[z + \"\u03c9\" + w] += 1\nprint((sum([e[k] * v for k, v in list(d.items())])))\n","code_same":false,"relative_loc_diff_percent":10.7142857143,"diff":["-","-","-def cnt(c, d):","- for bit in range(1 << n):","- x = []","- y = []","- for i in range(n):","- if bit >> i & 1:","- x.append(c[i])","- else:","- y.append(c[i])","- d[(str(x), str(y))] += 1","-","-","-cnt(a, d)","-cnt(b, e)","-ans = 0","-for k, v in list(d.items()):","- ans += e[k] * v","-print(ans)","+for bit in range(1 << n):","+ x = \"\"","+ y = \"\"","+ z = \"\"","+ w = \"\"","+ for i in range(n):","+ if bit >> i & 1:","+ x += a[i]","+ z += b[i]","+ else:","+ y += a[i]","+ w += b[i]","+ d[x + \"\u03c9\" + y] += 1","+ e[z + \"\u03c9\" + w] += 1","+print((sum([e[k] * v for k, v in list(d.items())])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2700868397,"measured_runtime_v1":0.1086692932,"runtime_lift":2.4854016418,"key":["s154354411","s298686601"]} +{"user_id":"u821284362","problem_id":"p02959","language":"python","submission_id_v0":"s294034147","submission_id_v1":"s880787880","cpu_time_v0":443,"cpu_time_v1":280,"memory_v0":23968,"memory_v1":85468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n\n\nimport numpy as np\n\nN = int(eval(input()))\n\n\n\nA_ls = np.array(list(map(int,input().split(\" \"))))\n\nB_ls = np.array(list(map(int,input().split(\" \"))))\n\n\n\nS = 0\n\n\n\nfor i,b in enumerate(B_ls):\n\n if b > A_ls[i]:\n\n b -= A_ls[i]\n\n S += A_ls[i]\n\n if A_ls[i+1] >= b:\n\n A_ls[i+1] -=b\n\n S+=b\n\n else:\n\n S+=A_ls[i+1]\n\n A_ls[i+1] = 0 \n\n else:\n\n S += b\n\n\n\nprint(S)\n\n\n# optimized version of the same code:\n","target":"\n\nN = int(eval(input()))\n\n\n\nA_ls = list(map(int,input().split(\" \")))\n\nB_ls = list(map(int,input().split(\" \")))\n\n\n\nS = 0\n\n\n\nfor i,b in enumerate(B_ls):\n\n if b > A_ls[i]:\n\n b -= A_ls[i]\n\n S += A_ls[i]\n\n if A_ls[i+1] >= b:\n\n A_ls[i+1] -=b\n\n S+=b\n\n else:\n\n S+=A_ls[i+1]\n\n A_ls[i+1] = 0 \n\n else:\n\n S += b\n\n\n\nprint(S)\n","code_v0_loc":23,"code_v1_loc":22,"code_v0_num_chars":431,"code_v1_num_chars":391,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA_ls = np.array(list(map(int, input().split(\" \"))))\nB_ls = np.array(list(map(int, input().split(\" \"))))\nS = 0\nfor i, b in enumerate(B_ls):\n if b > A_ls[i]:\n b -= A_ls[i]\n S += A_ls[i]\n if A_ls[i + 1] >= b:\n A_ls[i + 1] -= b\n S += b\n else:\n S += A_ls[i + 1]\n A_ls[i + 1] = 0\n else:\n S += b\nprint(S)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA_ls = list(map(int, input().split(\" \")))\nB_ls = list(map(int, input().split(\" \")))\nS = 0\nfor i, b in enumerate(B_ls):\n if b > A_ls[i]:\n b -= A_ls[i]\n S += A_ls[i]\n if A_ls[i + 1] >= b:\n A_ls[i + 1] -= b\n S += b\n else:\n S += A_ls[i + 1]\n A_ls[i + 1] = 0\n else:\n S += b\nprint(S)\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["-import numpy as np","-","-A_ls = np.array(list(map(int, input().split(\" \"))))","-B_ls = np.array(list(map(int, input().split(\" \"))))","+A_ls = list(map(int, input().split(\" \")))","+B_ls = list(map(int, input().split(\" \")))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4409986854,"measured_runtime_v1":0.2063152339,"runtime_lift":6.9844512096,"key":["s294034147","s880787880"]} +{"user_id":"u238940874","problem_id":"p02725","language":"python","submission_id_v0":"s425361145","submission_id_v1":"s820245641","cpu_time_v0":183,"cpu_time_v1":162,"memory_v0":25840,"memory_v1":25840,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nk,n = list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\nlongd=0\n\nfor i in range(n):\n\n tmp=abs(a[i+1]-a[i])\n\n longd=max(longd,tmp)\n\nprint((k-longd))\n\n# optimized version of the same code:\n","target":"k,n=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\n\n\nx=0\n\nfor i in range(len(a)-1):\n\n dis=abs(a[i+1]-a[i])\n\n x=max(x,dis)\n\n\n\nprint((k-x))","code_v0_loc":8,"code_v1_loc":10,"code_v0_num_chars":179,"code_v1_num_chars":172,"code_v0_no_empty_lines":"k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(a[0] + k)\nlongd = 0\nfor i in range(n):\n tmp = abs(a[i + 1] - a[i])\n longd = max(longd, tmp)\nprint((k - longd))\n","code_v1_no_empty_lines":"k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(a[0] + k)\nx = 0\nfor i in range(len(a) - 1):\n dis = abs(a[i + 1] - a[i])\n x = max(x, dis)\nprint((k - x))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-longd = 0","-for i in range(n):","- tmp = abs(a[i + 1] - a[i])","- longd = max(longd, tmp)","-print((k - longd))","+x = 0","+for i in range(len(a) - 1):","+ dis = abs(a[i + 1] - a[i])","+ x = max(x, dis)","+print((k - x))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2313908032,"measured_runtime_v1":0.1406400898,"runtime_lift":1.645269165,"key":["s425361145","s820245641"]} +{"user_id":"u342869120","problem_id":"p02690","language":"python","submission_id_v0":"s557028395","submission_id_v1":"s922919122","cpu_time_v0":65,"cpu_time_v1":58,"memory_v0":64700,"memory_v1":63784,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.77,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n\n\nX = int(eval(input()))\n\nfor a in range(-200, 200):\n\n find = False\n\n for b in range(-200, 200):\n\n x = a**5-b**5\n\n if x == X:\n\n find = True\n\n print((a, b))\n\n break\n\n if find:\n\n break\n\n\n# optimized version of the same code:\n","target":"\n\nX = int(eval(input()))\n\nfor a in range(-120, 120):\n\n find = False\n\n for b in range(-120, 120):\n\n x = a**5-b**5\n\n if x == X:\n\n find = True\n\n print((a, b))\n\n break\n\n if find:\n\n break\n","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":238,"code_v1_num_chars":238,"code_v0_no_empty_lines":"X = int(eval(input()))\nfor a in range(-200, 200):\n find = False\n for b in range(-200, 200):\n x = a**5 - b**5\n if x == X:\n find = True\n print((a, b))\n break\n if find:\n break\n","code_v1_no_empty_lines":"X = int(eval(input()))\nfor a in range(-120, 120):\n find = False\n for b in range(-120, 120):\n x = a**5 - b**5\n if x == X:\n find = True\n print((a, b))\n break\n if find:\n break\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for a in range(-200, 200):","+for a in range(-120, 120):","- for b in range(-200, 200):","+ for b in range(-120, 120):"],"diff_only_import_comment":false,"measured_runtime_v0":0.6603648007,"measured_runtime_v1":0.3721980631,"runtime_lift":1.7742295463,"key":["s557028395","s922919122"]} +{"user_id":"u195054737","problem_id":"p03162","language":"python","submission_id_v0":"s669133667","submission_id_v1":"s547309192","cpu_time_v0":1799,"cpu_time_v1":388,"memory_v0":42816,"memory_v1":40452,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport itertools\n\nfrom operator import itemgetter #sorted\u306e\u5bfe\u8c61\u3092\u6c7a\u3081\u305f\u3044\n\nfrom fractions import gcd #\u6700\u5927\u516c\u7d04\u6570\n\nfrom math import ceil, floor, sqrt, isinf #\u5c0f\u6570\u70b9\u5207\u308a\u4e0a\u3052\u3001\u5207\u308a\u6368\u3066\u3001\u5e73\u65b9\u6839\n\nfrom copy import deepcopy #\u53c2\u7167\u3067\u5f71\u97ff\u3055\u308c\u306a\u3044\u30b3\u30d4\u30fc\n\nfrom collections import Counter, deque #\u8981\u7d20\u3054\u3068\u306e\u51fa\u73fe\u56de\u6570\u3001\u53cc\u65b9\u5411\u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u30c7\u30fc\u30bf\u578b\n\nimport heapq\n\nimport numpy as np\n\nfrom functools import reduce\n\nsys.setrecursionlimit(200000)\n\n\n\ninput = sys.stdin.readline\n\n# template\n\n\n\ndef retmax(a, b):\n\n if a > b:\n\n return a\n\n else:\n\n return b\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n a = [list(map(int, input().split())) for _ in range(n)]\n\n\n\n dp = np.zeros([3, n+1])\n\n\n\n for i, a_l in enumerate(a):\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[k, i+1] = retmax(dp[k, i+1], dp[j, i] + a_l[k])\n\n\n\n print((int(np.max(dp[:, n], axis=0))))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n\n\n# optimized version of the same code:\n","target":"import sys\n\nimport itertools\n\nfrom operator import itemgetter #sorted\u306e\u5bfe\u8c61\u3092\u6c7a\u3081\u305f\u3044\n\nfrom fractions import gcd #\u6700\u5927\u516c\u7d04\u6570\n\nfrom math import ceil, floor, sqrt, isinf #\u5c0f\u6570\u70b9\u5207\u308a\u4e0a\u3052\u3001\u5207\u308a\u6368\u3066\u3001\u5e73\u65b9\u6839\n\nfrom copy import deepcopy #\u53c2\u7167\u3067\u5f71\u97ff\u3055\u308c\u306a\u3044\u30b3\u30d4\u30fc\n\nfrom collections import Counter, deque #\u8981\u7d20\u3054\u3068\u306e\u51fa\u73fe\u56de\u6570\u3001\u53cc\u65b9\u5411\u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u30c7\u30fc\u30bf\u578b\n\nimport heapq\n\nimport numpy as np\n\nfrom functools import reduce\n\nsys.setrecursionlimit(200000)\n\n\n\ninput = sys.stdin.readline\n\n# template\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n abc = [list(map(int, input().split())) for _ in range(n)]\n\n\n\n a, b, c = 0, 0, 0\n\n for x, y, z in abc:\n\n a, b, c = max(b, c) + x, max(a, c) + y, max(a, b) + z\n\n\n\n print((max(a, b, c)))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n","code_v0_loc":39,"code_v1_loc":30,"code_v0_num_chars":913,"code_v1_num_chars":704,"code_v0_no_empty_lines":"import sys\nimport itertools\nfrom operator import itemgetter # sorted\u306e\u5bfe\u8c61\u3092\u6c7a\u3081\u305f\u3044\nfrom fractions import gcd # \u6700\u5927\u516c\u7d04\u6570\nfrom math import ceil, floor, sqrt, isinf # \u5c0f\u6570\u70b9\u5207\u308a\u4e0a\u3052\u3001\u5207\u308a\u6368\u3066\u3001\u5e73\u65b9\u6839\nfrom copy import deepcopy # \u53c2\u7167\u3067\u5f71\u97ff\u3055\u308c\u306a\u3044\u30b3\u30d4\u30fc\nfrom collections import Counter, deque # \u8981\u7d20\u3054\u3068\u306e\u51fa\u73fe\u56de\u6570\u3001\u53cc\u65b9\u5411\u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u30c7\u30fc\u30bf\u578b\nimport heapq\nimport numpy as np\nfrom functools import reduce\n\nsys.setrecursionlimit(200000)\ninput = sys.stdin.readline\n# template\ndef retmax(a, b):\n if a > b:\n return a\n else:\n return b\n\n\ndef main():\n n = int(eval(input()))\n a = [list(map(int, input().split())) for _ in range(n)]\n dp = np.zeros([3, n + 1])\n for i, a_l in enumerate(a):\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[k, i + 1] = retmax(dp[k, i + 1], dp[j, i] + a_l[k])\n print((int(np.max(dp[:, n], axis=0))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport itertools\nfrom operator import itemgetter # sorted\u306e\u5bfe\u8c61\u3092\u6c7a\u3081\u305f\u3044\nfrom fractions import gcd # \u6700\u5927\u516c\u7d04\u6570\nfrom math import ceil, floor, sqrt, isinf # \u5c0f\u6570\u70b9\u5207\u308a\u4e0a\u3052\u3001\u5207\u308a\u6368\u3066\u3001\u5e73\u65b9\u6839\nfrom copy import deepcopy # \u53c2\u7167\u3067\u5f71\u97ff\u3055\u308c\u306a\u3044\u30b3\u30d4\u30fc\nfrom collections import Counter, deque # \u8981\u7d20\u3054\u3068\u306e\u51fa\u73fe\u56de\u6570\u3001\u53cc\u65b9\u5411\u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u30c7\u30fc\u30bf\u578b\nimport heapq\nimport numpy as np\nfrom functools import reduce\n\nsys.setrecursionlimit(200000)\ninput = sys.stdin.readline\n# template\ndef main():\n n = int(eval(input()))\n abc = [list(map(int, input().split())) for _ in range(n)]\n a, b, c = 0, 0, 0\n for x, y, z in abc:\n a, b, c = max(b, c) + x, max(a, c) + y, max(a, b) + z\n print((max(a, b, c)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-def retmax(a, b):","- if a > b:","- return a","- else:","- return b","-","-","- a = [list(map(int, input().split())) for _ in range(n)]","- dp = np.zeros([3, n + 1])","- for i, a_l in enumerate(a):","- for j in range(3):","- for k in range(3):","- if j != k:","- dp[k, i + 1] = retmax(dp[k, i + 1], dp[j, i] + a_l[k])","- print((int(np.max(dp[:, n], axis=0))))","+ abc = [list(map(int, input().split())) for _ in range(n)]","+ a, b, c = 0, 0, 0","+ for x, y, z in abc:","+ a, b, c = max(b, c) + x, max(a, c) + y, max(a, b) + z","+ print((max(a, b, c)))"],"diff_only_import_comment":false,"measured_runtime_v0":2.2678967826,"measured_runtime_v1":0.4848643332,"runtime_lift":4.6773842238,"key":["s669133667","s547309192"]} +{"user_id":"u021916304","problem_id":"p02886","language":"python","submission_id_v0":"s631255245","submission_id_v1":"s295881998","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ndef ii():return int(eval(input()))\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nans = 0\n\nfor i in range(n):\n\n for j in range(i+1,n):\n\n# print(i,j)\n\n ans += D[i]*D[j] \n\nprint(ans)\n\n# optimized version of the same code:\n","target":"def ii():return int(eval(input()))\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nsumD = sum(D)\n\nans = 0\n\nfor i in range(n):\n\n ans += D[i]*(sum(D)-D[i])\n\nprint((ans\/\/2))","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":352,"code_v1_num_chars":325,"code_v0_no_empty_lines":"def ii():\n return int(eval(input()))\n\n\ndef iim():\n return list(map(int, input().split()))\n\n\ndef iil():\n return list(map(int, input().split()))\n\n\ndef ism():\n return list(map(str, input().split()))\n\n\ndef isl():\n return list(map(str, input().split()))\n\n\nn = ii()\nD = iil()\nans = 0\nfor i in range(n):\n for j in range(i + 1, n):\n # print(i,j)\n ans += D[i] * D[j]\nprint(ans)\n","code_v1_no_empty_lines":"def ii():\n return int(eval(input()))\n\n\ndef iim():\n return list(map(int, input().split()))\n\n\ndef iil():\n return list(map(int, input().split()))\n\n\ndef ism():\n return list(map(str, input().split()))\n\n\ndef isl():\n return list(map(str, input().split()))\n\n\nn = ii()\nD = iil()\nsumD = sum(D)\nans = 0\nfor i in range(n):\n ans += D[i] * (sum(D) - D[i])\nprint((ans \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["+sumD = sum(D)","- for j in range(i + 1, n):","- # print(i,j)","- ans += D[i] * D[j]","-print(ans)","+ ans += D[i] * (sum(D) - D[i])","+print((ans \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2355280421,"measured_runtime_v1":0.0063002633,"runtime_lift":37.3838408874,"key":["s631255245","s295881998"]} +{"user_id":"u175034939","problem_id":"p03353","language":"python","submission_id_v0":"s387813464","submission_id_v1":"s460839958","cpu_time_v0":62,"cpu_time_v1":40,"memory_v0":5068,"memory_v1":5068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.48,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = eval(input())\n\nK = int(eval(input()))\n\na = list(set(S))\n\na.sort()\n\n\n\nk = []\n\nl = 0\n\nwhile l < len(a):\n\n for i in range(len(S)):\n\n if S[i] == a[l]:\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n k.append(S[i:i+j])\n\n else:\n\n break\n\n l += 1\n\n\n\nk = list(set(k))\n\nk.sort()\n\nprint((k[K-1]))\n\n# optimized version of the same code:\n","target":"S = eval(input())\n\nK = int(eval(input()))\n\na = []\n\nfor i in range(len(S)+1):\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n a.append(S[i:i+j])\n\n else:\n\n break\n\n \n\na = list(set(a))\n\na.sort()\n\nprint((a[K-1]))","code_v0_loc":20,"code_v1_loc":13,"code_v0_num_chars":364,"code_v1_num_chars":240,"code_v0_no_empty_lines":"S = eval(input())\nK = int(eval(input()))\na = list(set(S))\na.sort()\nk = []\nl = 0\nwhile l < len(a):\n for i in range(len(S)):\n if S[i] == a[l]:\n for j in range(1, 6):\n if i + j <= len(S):\n k.append(S[i : i + j])\n else:\n break\n l += 1\nk = list(set(k))\nk.sort()\nprint((k[K - 1]))\n","code_v1_no_empty_lines":"S = eval(input())\nK = int(eval(input()))\na = []\nfor i in range(len(S) + 1):\n for j in range(1, 6):\n if i + j <= len(S):\n a.append(S[i : i + j])\n else:\n break\na = list(set(a))\na.sort()\nprint((a[K - 1]))\n","code_same":false,"relative_loc_diff_percent":35.0,"diff":["-a = list(set(S))","+a = []","+for i in range(len(S) + 1):","+ for j in range(1, 6):","+ if i + j <= len(S):","+ a.append(S[i : i + j])","+ else:","+ break","+a = list(set(a))","-k = []","-l = 0","-while l < len(a):","- for i in range(len(S)):","- if S[i] == a[l]:","- for j in range(1, 6):","- if i + j <= len(S):","- k.append(S[i : i + j])","- else:","- break","- l += 1","-k = list(set(k))","-k.sort()","-print((k[K - 1]))","+print((a[K - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3274912031,"measured_runtime_v1":0.2526222069,"runtime_lift":1.2963674375,"key":["s387813464","s460839958"]} +{"user_id":"u653837719","problem_id":"p02702","language":"python","submission_id_v0":"s121665958","submission_id_v1":"s794197403","cpu_time_v0":113,"cpu_time_v1":101,"memory_v0":9288,"memory_v1":9236,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ns = input()[::-1]\n\nl = len(s)\n\nc = [0] * 2019\n\nc[0] = 1\n\nten = 1\n\nmod = 0\n\nans = 0\n\n\n\nfor i in range(l):\n\n mod = (mod + int(s[i]) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) \/\/ 2\n\n\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"s = input()[::-1]\n\nc = [0] * 2019\n\nc[0] = 1\n\nmod = 0\n\nten = 1\n\nans = 0\n\n\n\nfor i in s:\n\n mod = (mod + int(i) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) \/\/ 2\n\n\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":16,"code_v0_num_chars":248,"code_v1_num_chars":226,"code_v0_no_empty_lines":"s = input()[::-1]\nl = len(s)\nc = [0] * 2019\nc[0] = 1\nten = 1\nmod = 0\nans = 0\nfor i in range(l):\n mod = (mod + int(s[i]) * ten) % 2019\n ten = ten * 10 % 2019\n c[mod] += 1\nfor i in c:\n ans += i * (i - 1) \/\/ 2\nprint(ans)\n","code_v1_no_empty_lines":"s = input()[::-1]\nc = [0] * 2019\nc[0] = 1\nmod = 0\nten = 1\nans = 0\nfor i in s:\n mod = (mod + int(i) * ten) % 2019\n ten = ten * 10 % 2019\n c[mod] += 1\nfor i in c:\n ans += i * (i - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-l = len(s)","+mod = 0","-mod = 0","-for i in range(l):","- mod = (mod + int(s[i]) * ten) % 2019","+for i in s:","+ mod = (mod + int(i) * ten) % 2019"],"diff_only_import_comment":false,"measured_runtime_v0":0.2661841769,"measured_runtime_v1":0.1600983288,"runtime_lift":1.6626293282,"key":["s121665958","s794197403"]} +{"user_id":"u271752889","problem_id":"p02994","language":"python","submission_id_v0":"s550736524","submission_id_v1":"s101169834","cpu_time_v0":149,"cpu_time_v1":17,"memory_v0":12504,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.59,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nn,l=list(map(int,input().split()))\n\nli=[]\n\nfor i in range(n):\n\n li.append(l+i)\n\ns=sum(li)\n\np=np.array(li)\n\na=np.abs(p).tolist()\n\nk=min(a)\n\nb=a.index(k)\n\nprint((s-li[b]))\n\n# optimized version of the same code:\n","target":"n,l=list(map(int,input().split()))\n\na=0\n\nfor i in range(n):\n\n a+=i+l\n\nif l>=0:\n\n print((a-l))\n\nelif l+n-1<0:\n\n print((a-(l+n-1)))\n\nelse:\n\n print(a)","code_v0_loc":12,"code_v1_loc":10,"code_v0_num_chars":184,"code_v1_num_chars":141,"code_v0_no_empty_lines":"import numpy as np\n\nn, l = list(map(int, input().split()))\nli = []\nfor i in range(n):\n li.append(l + i)\ns = sum(li)\np = np.array(li)\na = np.abs(p).tolist()\nk = min(a)\nb = a.index(k)\nprint((s - li[b]))\n","code_v1_no_empty_lines":"n, l = list(map(int, input().split()))\na = 0\nfor i in range(n):\n a += i + l\nif l >= 0:\n print((a - l))\nelif l + n - 1 < 0:\n print((a - (l + n - 1)))\nelse:\n print(a)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-import numpy as np","-","-li = []","+a = 0","- li.append(l + i)","-s = sum(li)","-p = np.array(li)","-a = np.abs(p).tolist()","-k = min(a)","-b = a.index(k)","-print((s - li[b]))","+ a += i + l","+if l >= 0:","+ print((a - l))","+elif l + n - 1 < 0:","+ print((a - (l + n - 1)))","+else:","+ print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":1.6350720274,"measured_runtime_v1":0.006301439,"runtime_lift":259.4759725026,"key":["s550736524","s101169834"]} +{"user_id":"u762420987","problem_id":"p02780","language":"python","submission_id_v0":"s906856884","submission_id_v1":"s911933040","cpu_time_v0":571,"cpu_time_v1":234,"memory_v0":33780,"memory_v1":25060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.02,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN, K = list(map(int, input().split()))\n\nplist = list(map(int, input().split()))\n\nkitaiti = np.array([(0.5*(p+1)) for p in plist])\n\nans = 0\n\nval = sum(kitaiti[:K])\n\nans = max(ans, val)\n\nfor i in range(1, N-K+1):\n\n # print(i-1, i+K)\n\n val -= kitaiti[i-1]\n\n val += kitaiti[i+K-1]\n\n ans = max(ans, val)\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N, K = list(map(int, input().split()))\n\nplist = [((num*(num+1))\/\/2)\/num for num in list(map(int, input().split()))]\n\n# print(plist)\n\nans = 0\n\nfor i in range(K):\n\n ans += plist[i]\n\n_ = ans\n\nfor i in range(N-K):\n\n temp = _\n\n temp -= plist[i]\n\n temp += plist[i+K]\n\n # print(i, i+K, ans, temp)\n\n ans = max(ans, temp)\n\n _ = temp\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":15,"code_v0_num_chars":336,"code_v1_num_chars":350,"code_v0_no_empty_lines":"import numpy as np\n\nN, K = list(map(int, input().split()))\nplist = list(map(int, input().split()))\nkitaiti = np.array([(0.5 * (p + 1)) for p in plist])\nans = 0\nval = sum(kitaiti[:K])\nans = max(ans, val)\nfor i in range(1, N - K + 1):\n # print(i-1, i+K)\n val -= kitaiti[i - 1]\n val += kitaiti[i + K - 1]\n ans = max(ans, val)\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nplist = [((num * (num + 1)) \/\/ 2) \/ num for num in list(map(int, input().split()))]\n# print(plist)\nans = 0\nfor i in range(K):\n ans += plist[i]\n_ = ans\nfor i in range(N - K):\n temp = _\n temp -= plist[i]\n temp += plist[i + K]\n # print(i, i+K, ans, temp)\n ans = max(ans, temp)\n _ = temp\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-import numpy as np","-","-plist = list(map(int, input().split()))","-kitaiti = np.array([(0.5 * (p + 1)) for p in plist])","+plist = [((num * (num + 1)) \/\/ 2) \/ num for num in list(map(int, input().split()))]","+# print(plist)","-val = sum(kitaiti[:K])","-ans = max(ans, val)","-for i in range(1, N - K + 1):","- # print(i-1, i+K)","- val -= kitaiti[i - 1]","- val += kitaiti[i + K - 1]","- ans = max(ans, val)","+for i in range(K):","+ ans += plist[i]","+_ = ans","+for i in range(N - K):","+ temp = _","+ temp -= plist[i]","+ temp += plist[i + K]","+ # print(i, i+K, ans, temp)","+ ans = max(ans, temp)","+ _ = temp"],"diff_only_import_comment":false,"measured_runtime_v0":2.2856271963,"measured_runtime_v1":0.3424234481,"runtime_lift":6.6748559686,"key":["s906856884","s911933040"]} +{"user_id":"u488178971","problem_id":"p03000","language":"python","submission_id_v0":"s335888065","submission_id_v1":"s975287095","cpu_time_v0":287,"cpu_time_v1":148,"memory_v0":21148,"memory_v1":12516,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.43,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#ABC 130 B\n\nN,X=list(map(int,input().split()))\n\nL= [int(j) for j in input().split()]\n\ncnt=0\n\nimport numpy as np\n\njump = list(np.cumsum(L))\n\nfor j in jump:\n\n if j <= X:\n\n cnt+=1\n\nprint((cnt+1))\n\n# optimized version of the same code:\n","target":"#ABC 130 B\n\nN,X=list(map(int,input().split()))\n\nL= [int(j) for j in input().split()]\n\ncnt=0\n\nimport numpy as np\n\njump = list(np.cumsum(L))\n\nfor j in jump:\n\n if j <= X:\n\n cnt+=1\n\n else:\n\n break\n\nprint((cnt+1))","code_v0_loc":10,"code_v1_loc":12,"code_v0_num_chars":194,"code_v1_num_chars":220,"code_v0_no_empty_lines":"# ABC 130 B\nN, X = list(map(int, input().split()))\nL = [int(j) for j in input().split()]\ncnt = 0\nimport numpy as np\n\njump = list(np.cumsum(L))\nfor j in jump:\n if j <= X:\n cnt += 1\nprint((cnt + 1))\n","code_v1_no_empty_lines":"# ABC 130 B\nN, X = list(map(int, input().split()))\nL = [int(j) for j in input().split()]\ncnt = 0\nimport numpy as np\n\njump = list(np.cumsum(L))\nfor j in jump:\n if j <= X:\n cnt += 1\n else:\n break\nprint((cnt + 1))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["+ else:","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":2.1490399387,"measured_runtime_v1":1.4958784676,"runtime_lift":1.4366407333,"key":["s335888065","s975287095"]} +{"user_id":"u561231954","problem_id":"p03545","language":"python","submission_id_v0":"s357290049","submission_id_v1":"s861261131","cpu_time_v0":152,"cpu_time_v1":18,"memory_v0":12488,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nnum=np.array(list(eval(input())))\n\n\n\nfor bit in range(1<<3):\n\n op=np.array(['-']*3)\n\n for i in range(3):\n\n if (bit>>i)&1:\n\n op[i]='+'\n\n formula=np.insert(num,[1,2,3],op)\n\n \n\n if eval(''.join(formula))==7:\n\n flag=True\n\n print((''.join(formula)+'=7'))\n\n break\n\n# optimized version of the same code:\n","target":"INF = 10 ** 9\n\nimport sys\n\nsys.setrecursionlimit(100000000)\n\ndy = (-1,0,1,0)\n\ndx = (0,1,0,-1)\n\nfrom heapq import heappop,heapify,heappush\n\nfrom bisect import bisect_left\n\n\n\ndef main():\n\n s = eval(input())\n\n for bit in range(8):\n\n op = []\n\n for i in range(3):\n\n if (bit>>i)&1:\n\n op.append('+')\n\n else:\n\n op.append('-')\n\n \n\n tmp = s[0]\n\n for i in range(3):\n\n tmp += op[i]\n\n tmp += s[i + 1]\n\n\n\n if eval(tmp) == 7:\n\n ans = tmp + '=7'\n\n break\n\n print(ans)\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":14,"code_v1_loc":29,"code_v0_num_chars":292,"code_v1_num_chars":633,"code_v0_no_empty_lines":"import numpy as np\n\nnum = np.array(list(eval(input())))\nfor bit in range(1 << 3):\n op = np.array([\"-\"] * 3)\n for i in range(3):\n if (bit >> i) & 1:\n op[i] = \"+\"\n formula = np.insert(num, [1, 2, 3], op)\n if eval(\"\".join(formula)) == 7:\n flag = True\n print((\"\".join(formula) + \"=7\"))\n break\n","code_v1_no_empty_lines":"INF = 10**9\nimport sys\n\nsys.setrecursionlimit(100000000)\ndy = (-1, 0, 1, 0)\ndx = (0, 1, 0, -1)\nfrom heapq import heappop, heapify, heappush\nfrom bisect import bisect_left\n\n\ndef main():\n s = eval(input())\n for bit in range(8):\n op = []\n for i in range(3):\n if (bit >> i) & 1:\n op.append(\"+\")\n else:\n op.append(\"-\")\n tmp = s[0]\n for i in range(3):\n tmp += op[i]\n tmp += s[i + 1]\n if eval(tmp) == 7:\n ans = tmp + \"=7\"\n break\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":51.724137931,"diff":["-import numpy as np","+INF = 10**9","+import sys","-num = np.array(list(eval(input())))","-for bit in range(1 << 3):","- op = np.array([\"-\"] * 3)","- for i in range(3):","- if (bit >> i) & 1:","- op[i] = \"+\"","- formula = np.insert(num, [1, 2, 3], op)","- if eval(\"\".join(formula)) == 7:","- flag = True","- print((\"\".join(formula) + \"=7\"))","- break","+sys.setrecursionlimit(100000000)","+dy = (-1, 0, 1, 0)","+dx = (0, 1, 0, -1)","+from heapq import heappop, heapify, heappush","+from bisect import bisect_left","+","+","+def main():","+ s = eval(input())","+ for bit in range(8):","+ op = []","+ for i in range(3):","+ if (bit >> i) & 1:","+ op.append(\"+\")","+ else:","+ op.append(\"-\")","+ tmp = s[0]","+ for i in range(3):","+ tmp += op[i]","+ tmp += s[i + 1]","+ if eval(tmp) == 7:","+ ans = tmp + \"=7\"","+ break","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":1.58260882,"measured_runtime_v1":0.259734097,"runtime_lift":6.0931885269,"key":["s357290049","s861261131"]} +{"user_id":"u045939752","problem_id":"p03814","language":"python","submission_id_v0":"s574890983","submission_id_v1":"s839527046","cpu_time_v0":23,"cpu_time_v1":18,"memory_v0":3516,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS=eval(input())\n\nprint((S.rfind('Z')-S.find('A')+1))\n\n# optimized version of the same code:\n","target":"s=input().strip()\n\na = s.find('A')\n\nz = s.rfind('Z')\n\nprint((z-a+1))\n","code_v0_loc":2,"code_v1_loc":4,"code_v0_num_chars":44,"code_v1_num_chars":67,"code_v0_no_empty_lines":"S = eval(input())\nprint((S.rfind(\"Z\") - S.find(\"A\") + 1))\n","code_v1_no_empty_lines":"s = input().strip()\na = s.find(\"A\")\nz = s.rfind(\"Z\")\nprint((z - a + 1))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-S = eval(input())","-print((S.rfind(\"Z\") - S.find(\"A\") + 1))","+s = input().strip()","+a = s.find(\"A\")","+z = s.rfind(\"Z\")","+print((z - a + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.286565238,"measured_runtime_v1":0.2292430663,"runtime_lift":1.2500497511,"key":["s574890983","s839527046"]} +{"user_id":"u585482323","problem_id":"p03371","language":"python","submission_id_v0":"s026349855","submission_id_v1":"s676818074","cpu_time_v0":206,"cpu_time_v1":183,"memory_v0":40944,"memory_v1":39408,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.17,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n#!usr\/bin\/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LS()\n\n return l\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n return\n\n\n\n#B\n\ndef B():\n\n return\n\n\n\n#C\n\ndef C():\n\n return\n\n\n\n#D\n\ndef D():\n\n return\n\n\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n a,b,c,X,Y = LI()\n\n ans = float(\"inf\")\n\n for z in range(300001):\n\n if z%2 == 0:\n\n m = c*z\n\n x = z\/\/2\n\n y = z\/\/2\n\n m += a*max(0,X-x)\n\n m += b*max(0,Y-y)\n\n if m < ans:\n\n ans = m\n\n print(ans)\n\n return\n\n\n\n#G\n\ndef G():\n\n n = I()\n\n x = LI()\n\n f = [(i,x[i]) for i in range(n)]\n\n f.sort(key = lambda x:x[1])\n\n g = [(f[i][0],i) for i in range(n)]\n\n g.sort(key = lambda x:x[0])\n\n for i in range(n):\n\n if g[i][1] < n\/\/2:\n\n print((f[n\/\/2][1]))\n\n else:\n\n print((f[n\/\/2-1][1]))\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#I\n\ndef I_():\n\n return\n\n\n\n#J\n\ndef J():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n F()\n\n\n# optimized version of the same code:\n","target":"#!usr\/bin\/env python3\n\nfrom collections import defaultdict,deque\n\nfrom heapq import heappush, heappop\n\nfrom itertools import permutations\n\nimport sys\n\nimport math\n\nimport bisect\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\n\ndef S():\n\n res = list(sys.stdin.readline())\n\n if res[-1] == \"\\n\":\n\n return res[:-1]\n\n return res\n\ndef IR(n):\n\n return [I() for i in range(n)]\n\ndef LIR(n):\n\n return [LI() for i in range(n)]\n\ndef SR(n):\n\n return [S() for i in range(n)]\n\ndef LSR(n):\n\n return [LS() for i in range(n)]\n\n\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\ndef solve():\n\n A,B,C,x,y = LI()\n\n ans = float(\"inf\")\n\n for c in range(200001)[::2]:\n\n a = b = c >> 1\n\n a = max(0,x-a)\n\n b = max(0,y-b)\n\n s = A*a+B*b+C*c\n\n if s < ans:\n\n ans = s\n\n print(ans)\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n solve()\n","code_v0_loc":97,"code_v1_loc":43,"code_v0_num_chars":1751,"code_v1_num_chars":1027,"code_v0_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LS()\n return l\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n# A\ndef A():\n return\n\n\n# B\ndef B():\n return\n\n\n# C\ndef C():\n return\n\n\n# D\ndef D():\n return\n\n\n# E\ndef E():\n return\n\n\n# F\ndef F():\n a, b, c, X, Y = LI()\n ans = float(\"inf\")\n for z in range(300001):\n if z % 2 == 0:\n m = c * z\n x = z \/\/ 2\n y = z \/\/ 2\n m += a * max(0, X - x)\n m += b * max(0, Y - y)\n if m < ans:\n ans = m\n print(ans)\n return\n\n\n# G\ndef G():\n n = I()\n x = LI()\n f = [(i, x[i]) for i in range(n)]\n f.sort(key=lambda x: x[1])\n g = [(f[i][0], i) for i in range(n)]\n g.sort(key=lambda x: x[0])\n for i in range(n):\n if g[i][1] < n \/\/ 2:\n print((f[n \/\/ 2][1]))\n else:\n print((f[n \/\/ 2 - 1][1]))\n return\n\n\n# H\ndef H():\n return\n\n\n# I\ndef I_():\n return\n\n\n# J\ndef J():\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n F()\n","code_v1_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations\nimport sys\nimport math\nimport bisect\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == \"\\n\":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n\n\ndef solve():\n A, B, C, x, y = LI()\n ans = float(\"inf\")\n for c in range(200001)[::2]:\n a = b = c >> 1\n a = max(0, x - a)\n b = max(0, y - b)\n s = A * a + B * b + C * c\n if s < ans:\n ans = s\n print(ans)\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":55.6701030928,"diff":["-from collections import defaultdict","-from collections import deque","+from collections import defaultdict, deque","+from itertools import permutations","-import random","- return list(map(int, sys.stdin.readline().split()))","+ return [int(x) for x in sys.stdin.readline().split()]","- return list(map(list, sys.stdin.readline().split()))","+ return [list(x) for x in sys.stdin.readline().split()]","- return list(sys.stdin.readline())[:-1]","+ res = list(sys.stdin.readline())","+ if res[-1] == \"\\n\":","+ return res[:-1]","+ return res","- l = [None for i in range(n)]","- for i in range(n):","- l[i] = I()","- return l","+ return [I() for i in range(n)]","- l = [None for i in range(n)]","- for i in range(n):","- l[i] = LI()","- return l","+ return [LI() for i in range(n)]","- l = [None for i in range(n)]","- for i in range(n):","- l[i] = S()","- return l","+ return [S() for i in range(n)]","- l = [None for i in range(n)]","- for i in range(n):","- l[i] = LS()","- return l","+ return [LS() for i in range(n)]","-# A","-def A():","- return","-# B","-def B():","- return","-","-","-# C","-def C():","- return","-","-","-# D","-def D():","- return","-","-","-# E","-def E():","- return","-","-","-# F","-def F():","- a, b, c, X, Y = LI()","+def solve():","+ A, B, C, x, y = LI()","- for z in range(300001):","- if z % 2 == 0:","- m = c * z","- x = z \/\/ 2","- y = z \/\/ 2","- m += a * max(0, X - x)","- m += b * max(0, Y - y)","- if m < ans:","- ans = m","+ for c in range(200001)[::2]:","+ a = b = c >> 1","+ a = max(0, x - a)","+ b = max(0, y - b)","+ s = A * a + B * b + C * c","+ if s < ans:","+ ans = s","- return","-","-","-# G","-def G():","- n = I()","- x = LI()","- f = [(i, x[i]) for i in range(n)]","- f.sort(key=lambda x: x[1])","- g = [(f[i][0], i) for i in range(n)]","- g.sort(key=lambda x: x[0])","- for i in range(n):","- if g[i][1] < n \/\/ 2:","- print((f[n \/\/ 2][1]))","- else:","- print((f[n \/\/ 2 - 1][1]))","- return","-","-","-# H","-def H():","- return","-","-","-# I","-def I_():","- return","-","-","-# J","-def J():","- F()","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":1.3533082061,"measured_runtime_v1":0.0063346879,"runtime_lift":213.6345491689,"key":["s026349855","s676818074"]} +{"user_id":"u183422236","problem_id":"p02612","language":"python","submission_id_v0":"s828418851","submission_id_v1":"s809335980","cpu_time_v0":81,"cpu_time_v1":70,"memory_v0":61540,"memory_v1":61736,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.58,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn = int(eval(input())) % 1000\n\nif n == 0:\n\n print((0))\n\nelse:\n\n print((1000 - n))\n\n# optimized version of the same code:\n","target":"n = int(eval(input()))\n\nprint(((1000 - n % 1000) % 1000))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":77,"code_v1_num_chars":49,"code_v0_no_empty_lines":"n = int(eval(input())) % 1000\nif n == 0:\n print((0))\nelse:\n print((1000 - n))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nprint(((1000 - n % 1000) % 1000))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-n = int(eval(input())) % 1000","-if n == 0:","- print((0))","-else:","- print((1000 - n))","+n = int(eval(input()))","+print(((1000 - n % 1000) % 1000))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2545247498,"measured_runtime_v1":0.1889497155,"runtime_lift":1.3470501881,"key":["s828418851","s809335980"]} +{"user_id":"u724687935","problem_id":"p02599","language":"python","submission_id_v0":"s870922238","submission_id_v1":"s250640318","cpu_time_v0":1686,"cpu_time_v1":1507,"memory_v0":281560,"memory_v1":281720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.62,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\n\n\n\n\nclass BinaryIndexedTree():\n\n '''\n\n 1-indexed\n\n '''\n\n def __init__(self, A):\n\n self.__n = len(A)\n\n self.__node = [0] * (self.__n + 1)\n\n self.__data = [0] * (self.__n + 1)\n\n\n\n S = [0] * (self.__n + 1)\n\n for i in range(1, self.__n + 1):\n\n S[i] = S[i - 1] + A[i - 1]\n\n self.__data[i] = A[i - 1]\n\n self.__node[i] = S[i] - S[i - (i & -i)]\n\n\n\n def add(self, i, v):\n\n self.__data[i] += v\n\n while i <= self.__n:\n\n self.__node[i] += v\n\n i += i & -i\n\n\n\n def sum(self, i):\n\n ''' [1, i]\u306e\u548c\n\n '''\n\n rst = 0\n\n while i > 0:\n\n rst += self.__node[i]\n\n i -= i & -i\n\n return rst\n\n \n\n def get(self, i, j):\n\n '''[i, j]\u306e\u548c\n\n '''\n\n if i == j:\n\n return self.__data[i]\n\n else:\n\n return self.sum(j) - self.sum(i - 1)\n\n\n\n\n\ndef main():\n\n N, Q = map(int, input().split())\n\n C = list(map(int, input().split()))\n\n\n\n P = [[] for _ in range(N)]\n\n for i, c in enumerate(C):\n\n P[c - 1].append(i)\n\n\n\n right = [0] * N\n\n for p in P:\n\n if len(p):\n\n right[p.pop()] = 1\n\n BIT = BinaryIndexedTree(right)\n\n\n\n query = [[] for _ in range(N)]\n\n for i, s in enumerate(sys.stdin.readlines()):\n\n l, r = map(int, s.split())\n\n query[r - 1].append((l - 1, i))\n\n\n\n ans = [None] * Q\n\n\n\n cur = N - 1\n\n for r, q in enumerate(reversed(query)):\n\n r = (N - 1) - r\n\n while q:\n\n l, i = q.pop()\n\n while r < cur:\n\n c = C[cur] - 1\n\n p = P[c]\n\n if len(p):\n\n BIT.add(p.pop() + 1, 1)\n\n cur -= 1\n\n tmp = BIT.get(l + 1, r + 1)\n\n ans[i] = tmp\n\n\n\n print(*ans, sep='\\n')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\n\n\n\n\nclass BinaryIndexedTree():\n\n '''\n\n 1-indexed\n\n '''\n\n def __init__(self, A):\n\n self.__n = len(A)\n\n self.__node = [0] * (self.__n + 1)\n\n self.__data = [0] * (self.__n + 1)\n\n\n\n S = [0] * (self.__n + 1)\n\n for i in range(self.__n):\n\n S[i + 1] = S[i] + A[i]\n\n\n\n for i in range(1, self.__n + 1):\n\n self.__data[i] = A[i - 1]\n\n self.__node[i] = S[i] - S[i - (i & -i)]\n\n\n\n def add(self, i, v):\n\n self.__data[i] += v\n\n while i <= self.__n:\n\n self.__node[i] += v\n\n i += i & -i\n\n\n\n def sum(self, i):\n\n ''' [1, i]\u306e\u548c\n\n '''\n\n rst = 0\n\n while i > 0:\n\n rst += self.__node[i]\n\n i -= i & -i\n\n return rst\n\n \n\n def get(self, i, j):\n\n '''[i, j]\u306e\u548c\n\n '''\n\n if i == j:\n\n return self.__data[i]\n\n else:\n\n return self.sum(j) - self.sum(i - 1)\n\n\n\n\n\ndef main():\n\n N, Q = map(int, input().split())\n\n C = list(map(int, input().split()))\n\n\n\n P = [[] for _ in range(N)]\n\n for i, c in enumerate(C):\n\n P[c - 1].append(i)\n\n\n\n right = [0] * N\n\n for p in P:\n\n if len(p):\n\n right[p.pop()] = 1\n\n BIT = BinaryIndexedTree(right)\n\n\n\n query = [[] for _ in range(N)]\n\n for i, s in enumerate(sys.stdin.readlines()):\n\n l, r = map(int, s.split())\n\n query[r - 1].append((l - 1, i))\n\n\n\n ans = [None] * Q\n\n\n\n cur = N - 1\n\n for r, q in enumerate(reversed(query)):\n\n r = (N - 1) - r\n\n while q:\n\n l, i = q.pop()\n\n while r < cur:\n\n c = C[cur] - 1\n\n p = P[c]\n\n if len(p):\n\n BIT.add(p.pop() + 1, 1)\n\n cur -= 1\n\n tmp = BIT.get(l + 1, r + 1)\n\n ans[i] = tmp\n\n\n\n print(*ans, sep='\\n')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":82,"code_v1_loc":84,"code_v0_num_chars":1906,"code_v1_num_chars":1939,"code_v0_no_empty_lines":"import sys\n\n\nclass BinaryIndexedTree:\n \"\"\"\n 1-indexed\n \"\"\"\n\n def __init__(self, A):\n self.__n = len(A)\n self.__node = [0] * (self.__n + 1)\n self.__data = [0] * (self.__n + 1)\n S = [0] * (self.__n + 1)\n for i in range(1, self.__n + 1):\n S[i] = S[i - 1] + A[i - 1]\n self.__data[i] = A[i - 1]\n self.__node[i] = S[i] - S[i - (i & -i)]\n\n def add(self, i, v):\n self.__data[i] += v\n while i <= self.__n:\n self.__node[i] += v\n i += i & -i\n\n def sum(self, i):\n \"\"\"[1, i]\u306e\u548c\"\"\"\n rst = 0\n while i > 0:\n rst += self.__node[i]\n i -= i & -i\n return rst\n\n def get(self, i, j):\n \"\"\"[i, j]\u306e\u548c\"\"\"\n if i == j:\n return self.__data[i]\n else:\n return self.sum(j) - self.sum(i - 1)\n\n\ndef main():\n N, Q = map(int, input().split())\n C = list(map(int, input().split()))\n P = [[] for _ in range(N)]\n for i, c in enumerate(C):\n P[c - 1].append(i)\n right = [0] * N\n for p in P:\n if len(p):\n right[p.pop()] = 1\n BIT = BinaryIndexedTree(right)\n query = [[] for _ in range(N)]\n for i, s in enumerate(sys.stdin.readlines()):\n l, r = map(int, s.split())\n query[r - 1].append((l - 1, i))\n ans = [None] * Q\n cur = N - 1\n for r, q in enumerate(reversed(query)):\n r = (N - 1) - r\n while q:\n l, i = q.pop()\n while r < cur:\n c = C[cur] - 1\n p = P[c]\n if len(p):\n BIT.add(p.pop() + 1, 1)\n cur -= 1\n tmp = BIT.get(l + 1, r + 1)\n ans[i] = tmp\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\nclass BinaryIndexedTree:\n \"\"\"\n 1-indexed\n \"\"\"\n\n def __init__(self, A):\n self.__n = len(A)\n self.__node = [0] * (self.__n + 1)\n self.__data = [0] * (self.__n + 1)\n S = [0] * (self.__n + 1)\n for i in range(self.__n):\n S[i + 1] = S[i] + A[i]\n for i in range(1, self.__n + 1):\n self.__data[i] = A[i - 1]\n self.__node[i] = S[i] - S[i - (i & -i)]\n\n def add(self, i, v):\n self.__data[i] += v\n while i <= self.__n:\n self.__node[i] += v\n i += i & -i\n\n def sum(self, i):\n \"\"\"[1, i]\u306e\u548c\"\"\"\n rst = 0\n while i > 0:\n rst += self.__node[i]\n i -= i & -i\n return rst\n\n def get(self, i, j):\n \"\"\"[i, j]\u306e\u548c\"\"\"\n if i == j:\n return self.__data[i]\n else:\n return self.sum(j) - self.sum(i - 1)\n\n\ndef main():\n N, Q = map(int, input().split())\n C = list(map(int, input().split()))\n P = [[] for _ in range(N)]\n for i, c in enumerate(C):\n P[c - 1].append(i)\n right = [0] * N\n for p in P:\n if len(p):\n right[p.pop()] = 1\n BIT = BinaryIndexedTree(right)\n query = [[] for _ in range(N)]\n for i, s in enumerate(sys.stdin.readlines()):\n l, r = map(int, s.split())\n query[r - 1].append((l - 1, i))\n ans = [None] * Q\n cur = N - 1\n for r, q in enumerate(reversed(query)):\n r = (N - 1) - r\n while q:\n l, i = q.pop()\n while r < cur:\n c = C[cur] - 1\n p = P[c]\n if len(p):\n BIT.add(p.pop() + 1, 1)\n cur -= 1\n tmp = BIT.get(l + 1, r + 1)\n ans[i] = tmp\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.380952381,"diff":["+ for i in range(self.__n):","+ S[i + 1] = S[i] + A[i]","- S[i] = S[i - 1] + A[i - 1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.1911105648,"measured_runtime_v1":0.00684015,"runtime_lift":27.9395284689,"key":["s870922238","s250640318"]} +{"user_id":"u912650255","problem_id":"p02983","language":"python","submission_id_v0":"s074902378","submission_id_v1":"s358904585","cpu_time_v0":618,"cpu_time_v1":67,"memory_v0":75568,"memory_v1":6888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nL ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nif R - L <= 2019:\n\n for i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n\n\nelse:\n\n for i in range(R-L-1010,R-L+1010):\n\n for j in range(i,R-L+1010):\n\n ans.append(i*j%2019)\n\n\n\nprint((min(ans)))\n\n\n# optimized version of the same code:\n","target":"L ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nfor i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n if (i * j % 2019) == 0:\n\n break\n\n else:\n\n continue\n\n break\n\n\n\nprint((min(ans)))","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":297,"code_v1_num_chars":237,"code_v0_no_empty_lines":"L, R = list(map(int, input().split()))\nans = []\nif R - L <= 2019:\n for i in range(L, R + 1):\n for j in range(i + 1, R + 1):\n ans.append(i * j % 2019)\nelse:\n for i in range(R - L - 1010, R - L + 1010):\n for j in range(i, R - L + 1010):\n ans.append(i * j % 2019)\nprint((min(ans)))\n","code_v1_no_empty_lines":"L, R = list(map(int, input().split()))\nans = []\nfor i in range(L, R + 1):\n for j in range(i + 1, R + 1):\n ans.append(i * j % 2019)\n if (i * j % 2019) == 0:\n break\n else:\n continue\n break\nprint((min(ans)))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-if R - L <= 2019:","- for i in range(L, R + 1):","- for j in range(i + 1, R + 1):","- ans.append(i * j % 2019)","-else:","- for i in range(R - L - 1010, R - L + 1010):","- for j in range(i, R - L + 1010):","- ans.append(i * j % 2019)","+for i in range(L, R + 1):","+ for j in range(i + 1, R + 1):","+ ans.append(i * j % 2019)","+ if (i * j % 2019) == 0:","+ break","+ else:","+ continue","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.3668963638,"measured_runtime_v1":0.2102679547,"runtime_lift":1.7448990943,"key":["s074902378","s358904585"]} +{"user_id":"u622570247","problem_id":"p02773","language":"python","submission_id_v0":"s074380513","submission_id_v1":"s228830644","cpu_time_v0":1054,"cpu_time_v1":898,"memory_v0":45492,"memory_v1":47732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.8,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import Counter\n\nimport heapq\n\n\n\nn = int(eval(input()))\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\nheap = [(-v, k) for k, v in list(ctr.items())]\n\nheapq.heapify(heap)\n\nmaxv = heap[0][0]\n\nwhile heap:\n\n c = heapq.heappop(heap)\n\n if c[0] != maxv:\n\n break\n\n print((c[1]))\n\n\n# optimized version of the same code:\n","target":"from collections import Counter\n\n\n\nn = int(eval(input()))\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\n\n\na = sorted([(-v, k) for k, v in list(ctr.items())])\n\nmaxv = a[0][0]\n\nfor i in range(len(a)):\n\n if a[i][0] != maxv:\n\n break\n\n print((a[i][1]))","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":325,"code_v1_num_chars":282,"code_v0_no_empty_lines":"from collections import Counter\nimport heapq\n\nn = int(eval(input()))\nss = []\nfor _ in range(n):\n ss.append(input().rstrip())\nctr = Counter(ss)\nheap = [(-v, k) for k, v in list(ctr.items())]\nheapq.heapify(heap)\nmaxv = heap[0][0]\nwhile heap:\n c = heapq.heappop(heap)\n if c[0] != maxv:\n break\n print((c[1]))\n","code_v1_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\nss = []\nfor _ in range(n):\n ss.append(input().rstrip())\nctr = Counter(ss)\na = sorted([(-v, k) for k, v in list(ctr.items())])\nmaxv = a[0][0]\nfor i in range(len(a)):\n if a[i][0] != maxv:\n break\n print((a[i][1]))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import heapq","-heap = [(-v, k) for k, v in list(ctr.items())]","-heapq.heapify(heap)","-maxv = heap[0][0]","-while heap:","- c = heapq.heappop(heap)","- if c[0] != maxv:","+a = sorted([(-v, k) for k, v in list(ctr.items())])","+maxv = a[0][0]","+for i in range(len(a)):","+ if a[i][0] != maxv:","- print((c[1]))","+ print((a[i][1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3121475418,"measured_runtime_v1":0.0064239368,"runtime_lift":48.5913153977,"key":["s074380513","s228830644"]} +{"user_id":"u638456847","problem_id":"p02685","language":"python","submission_id_v0":"s295745028","submission_id_v1":"s749223274","cpu_time_v0":1095,"cpu_time_v1":852,"memory_v0":32948,"memory_v1":9220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.19,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\nfac = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\nf_inv = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\n\ndef prepare(n, mod):\n\n for i in range(2, n+1):\n\n fac.append((fac[-1] * i) % mod)\n\n inv.append((-inv[mod % i] * (mod\/\/i)) % mod)\n\n f_inv.append((f_inv[-1] * inv[-1]) % mod)\n\n\n\ndef cmb(n, r, mod):\n\n if n < 0 or r < 0:\n\n return 0\n\n if r > n:\n\n return 0\n\n\n\n return fac[n] * f_inv[r] * f_inv[n-r] % mod\n\n\n\n\n\ndef main():\n\n N,M,K = list(map(int, readline().split()))\n\n\n\n MOD = 998244353\n\n prepare(N + 10, MOD)\n\n\n\n if M == 1 and K == N - 1:\n\n print((1))\n\n exit()\n\n\n\n m = M\n\n for _ in range(N-1):\n\n m *= M - 1\n\n m %= MOD\n\n\n\n ans = 0\n\n for k in range(K+1):\n\n ans += (m * cmb(N-1, k, MOD)) % MOD\n\n ans %= MOD\n\n\n\n m *= pow(M-1, MOD-2, MOD)\n\n m %= MOD\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\n\n\n# 0^0 = 1\n\n\n\ndef main():\n\n N,M,K = list(map(int, readline().split()))\n\n\n\n MOD = 998244353\n\n\n\n if M == 1:\n\n if K == N - 1:\n\n print((1))\n\n else:\n\n print((0))\n\n exit()\n\n\n\n m = pow(M-1, N-1, MOD)\n\n m_1_inv = pow(M-1, MOD-2, MOD)\n\n comb = 1\n\n ans = comb * m\n\n for k in range(1,K+1):\n\n m *= m_1_inv\n\n m %= MOD\n\n comb *= N - k\n\n comb %= MOD\n\n comb *= pow(k, MOD-2, MOD)\n\n \n\n ans += (m * comb) % MOD\n\n ans %= MOD\n\n\n\n print((ans * M % MOD))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":52,"code_v1_loc":38,"code_v0_num_chars":1010,"code_v1_num_chars":691,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nfac = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\nf_inv = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\ninv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\ndef prepare(n, mod):\n for i in range(2, n + 1):\n fac.append((fac[-1] * i) % mod)\n inv.append((-inv[mod % i] * (mod \/\/ i)) % mod)\n f_inv.append((f_inv[-1] * inv[-1]) % mod)\n\n\ndef cmb(n, r, mod):\n if n < 0 or r < 0:\n return 0\n if r > n:\n return 0\n return fac[n] * f_inv[r] * f_inv[n - r] % mod\n\n\ndef main():\n N, M, K = list(map(int, readline().split()))\n MOD = 998244353\n prepare(N + 10, MOD)\n if M == 1 and K == N - 1:\n print((1))\n exit()\n m = M\n for _ in range(N - 1):\n m *= M - 1\n m %= MOD\n ans = 0\n for k in range(K + 1):\n ans += (m * cmb(N - 1, k, MOD)) % MOD\n ans %= MOD\n m *= pow(M - 1, MOD - 2, MOD)\n m %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n# 0^0 = 1\ndef main():\n N, M, K = list(map(int, readline().split()))\n MOD = 998244353\n if M == 1:\n if K == N - 1:\n print((1))\n else:\n print((0))\n exit()\n m = pow(M - 1, N - 1, MOD)\n m_1_inv = pow(M - 1, MOD - 2, MOD)\n comb = 1\n ans = comb * m\n for k in range(1, K + 1):\n m *= m_1_inv\n m %= MOD\n comb *= N - k\n comb %= MOD\n comb *= pow(k, MOD - 2, MOD)\n ans += (m * comb) % MOD\n ans %= MOD\n print((ans * M % MOD))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":26.9230769231,"diff":["-fac = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb","-f_inv = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb","-inv = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb","-","-","-def prepare(n, mod):","- for i in range(2, n + 1):","- fac.append((fac[-1] * i) % mod)","- inv.append((-inv[mod % i] * (mod \/\/ i)) % mod)","- f_inv.append((f_inv[-1] * inv[-1]) % mod)","-","-","-def cmb(n, r, mod):","- if n < 0 or r < 0:","- return 0","- if r > n:","- return 0","- return fac[n] * f_inv[r] * f_inv[n - r] % mod","-","-","+# 0^0 = 1","- prepare(N + 10, MOD)","- if M == 1 and K == N - 1:","- print((1))","+ if M == 1:","+ if K == N - 1:","+ print((1))","+ else:","+ print((0))","- m = M","- for _ in range(N - 1):","- m *= M - 1","+ m = pow(M - 1, N - 1, MOD)","+ m_1_inv = pow(M - 1, MOD - 2, MOD)","+ comb = 1","+ ans = comb * m","+ for k in range(1, K + 1):","+ m *= m_1_inv","- ans = 0","- for k in range(K + 1):","- ans += (m * cmb(N - 1, k, MOD)) % MOD","+ comb *= N - k","+ comb %= MOD","+ comb *= pow(k, MOD - 2, MOD)","+ ans += (m * comb) % MOD","- m *= pow(M - 1, MOD - 2, MOD)","- m %= MOD","- print(ans)","+ print((ans * M % MOD))"],"diff_only_import_comment":false,"measured_runtime_v0":0.9888417046,"measured_runtime_v1":0.3609299815,"runtime_lift":2.7397050823,"key":["s295745028","s749223274"]} +{"user_id":"u588341295","problem_id":"p02748","language":"python","submission_id_v0":"s850163388","submission_id_v1":"s734063266","cpu_time_v0":667,"cpu_time_v1":325,"memory_v0":36848,"memory_v1":18864,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.27,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\nfrom collections import Counter\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\n\n\ndef fft(A, B):\n\n \"\"\" \n\n \u9ad8\u901f\u30d5\u30fc\u30ea\u30a8\u5909\u63db(FFT)\n\n A\uff1a\u51fa\u73fe\u56de\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u30ea\u30b9\u30c8\n\n B\uff1a\u51fa\u73fe\u56de\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u30ea\u30b9\u30c8\n\n \"\"\"\n\n import numpy as np\n\n from numpy.fft import rfft, irfft\n\n\n\n # \u51fa\u73fe\u6570\u30ab\u30a6\u30f3\u30c8\n\n MAXA = max(A)\n\n MAXB = max(B)\n\n C1 = [0] * (MAXA+1)\n\n C2 = [0] * (MAXB+1)\n\n for a in A:\n\n C1[a] += 1\n\n for b in B:\n\n C2[b] += 1\n\n # max(A)+max(B)\u3088\u308a\u5927\u304d\u30442\u51aa\n\n L = 1\n\n k = 0\n\n while L <= MAXA + MAXB:\n\n k += 1\n\n L = 2**k\n\n # FFT\n\n res = irfft(rfft(C1, L) * rfft(C2, L), L)\n\n # \u56db\u6368\u4e94\u5165\u3057\u3066\u6574\u6570\u306b\n\n res = np.rint(res).astype(np.int64)\n\n return res\n\n\n\nN, M, L = MAP()\n\nA = LIST()\n\nB = LIST()\n\n\n\nres = list(fft(A, B))\n\n\n\nmn = INF\n\nfor i, a in enumerate(res):\n\n if a != 0:\n\n mn = i\n\n break\n\n\n\nfor _ in range(L):\n\n x, y, c = MAP()\n\n x -= 1; y -= 1\n\n mn = min(mn, A[x] + B[y] - c)\n\nprint(mn)\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\nfrom collections import Counter\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\n\n\nN, M, L = MAP()\n\nA = LIST()\n\nB = LIST()\n\n\n\nmn = min(A) + min(B)\n\nfor _ in range(L):\n\n x, y, c = MAP()\n\n x -= 1; y -= 1\n\n mn = min(mn, A[x] + B[y] - c)\n\nprint(mn)\n","code_v0_loc":68,"code_v1_loc":31,"code_v0_num_chars":1587,"code_v1_num_chars":901,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\nfrom collections import Counter\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef list4d(a, b, c, d, e):\n return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x \/\/ y))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST(N=None):\n return list(MAP()) if N is None else [INT() for i in range(N)]\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = 10**18\nMOD = 10**9 + 7\n\n\ndef fft(A, B):\n \"\"\"\n \u9ad8\u901f\u30d5\u30fc\u30ea\u30a8\u5909\u63db(FFT)\n A\uff1a\u51fa\u73fe\u56de\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u30ea\u30b9\u30c8\n B\uff1a\u51fa\u73fe\u56de\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u30ea\u30b9\u30c8\n \"\"\"\n import numpy as np\n from numpy.fft import rfft, irfft\n\n # \u51fa\u73fe\u6570\u30ab\u30a6\u30f3\u30c8\n MAXA = max(A)\n MAXB = max(B)\n C1 = [0] * (MAXA + 1)\n C2 = [0] * (MAXB + 1)\n for a in A:\n C1[a] += 1\n for b in B:\n C2[b] += 1\n # max(A)+max(B)\u3088\u308a\u5927\u304d\u30442\u51aa\n L = 1\n k = 0\n while L <= MAXA + MAXB:\n k += 1\n L = 2**k\n # FFT\n res = irfft(rfft(C1, L) * rfft(C2, L), L)\n # \u56db\u6368\u4e94\u5165\u3057\u3066\u6574\u6570\u306b\n res = np.rint(res).astype(np.int64)\n return res\n\n\nN, M, L = MAP()\nA = LIST()\nB = LIST()\nres = list(fft(A, B))\nmn = INF\nfor i, a in enumerate(res):\n if a != 0:\n mn = i\n break\nfor _ in range(L):\n x, y, c = MAP()\n x -= 1\n y -= 1\n mn = min(mn, A[x] + B[y] - c)\nprint(mn)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\nfrom collections import Counter\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef list4d(a, b, c, d, e):\n return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x \/\/ y))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST(N=None):\n return list(MAP()) if N is None else [INT() for i in range(N)]\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = 10**18\nMOD = 10**9 + 7\nN, M, L = MAP()\nA = LIST()\nB = LIST()\nmn = min(A) + min(B)\nfor _ in range(L):\n x, y, c = MAP()\n x -= 1\n y -= 1\n mn = min(mn, A[x] + B[y] - c)\nprint(mn)\n","code_same":false,"relative_loc_diff_percent":54.4117647059,"diff":["-","-","-def fft(A, B):","- \"\"\"","- \u9ad8\u901f\u30d5\u30fc\u30ea\u30a8\u5909\u63db(FFT)","- A\uff1a\u51fa\u73fe\u56de\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u30ea\u30b9\u30c8","- B\uff1a\u51fa\u73fe\u56de\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u30ea\u30b9\u30c8","- \"\"\"","- import numpy as np","- from numpy.fft import rfft, irfft","-","- # \u51fa\u73fe\u6570\u30ab\u30a6\u30f3\u30c8","- MAXA = max(A)","- MAXB = max(B)","- C1 = [0] * (MAXA + 1)","- C2 = [0] * (MAXB + 1)","- for a in A:","- C1[a] += 1","- for b in B:","- C2[b] += 1","- # max(A)+max(B)\u3088\u308a\u5927\u304d\u30442\u51aa","- L = 1","- k = 0","- while L <= MAXA + MAXB:","- k += 1","- L = 2**k","- # FFT","- res = irfft(rfft(C1, L) * rfft(C2, L), L)","- # \u56db\u6368\u4e94\u5165\u3057\u3066\u6574\u6570\u306b","- res = np.rint(res).astype(np.int64)","- return res","-","-","-res = list(fft(A, B))","-mn = INF","-for i, a in enumerate(res):","- if a != 0:","- mn = i","- break","+mn = min(A) + min(B)"],"diff_only_import_comment":false,"measured_runtime_v0":2.0354720068,"measured_runtime_v1":0.3338449564,"runtime_lift":6.097057834,"key":["s850163388","s734063266"]} +{"user_id":"u945405878","problem_id":"p02899","language":"python","submission_id_v0":"s615780042","submission_id_v1":"s374426185","cpu_time_v0":230,"cpu_time_v1":119,"memory_v0":30320,"memory_v1":18956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.26,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\n\n\nN = int(eval(input()))\n\nA = [int(_) for _ in input().split(\" \")]\n\n\n\ntmp = np.argsort(A)\n\ntmp2= tmp + np.ones(N)\n\ntmp3 = [int(_) for _ in tmp2.tolist()]\n\nans = [str(_) for _ in tmp3]\n\n\n\nprint((\" \".join(ans)))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nA = [int(_) for _ in input().split(\" \")]\n\n\n\ntmp = sorted(list(range(1, len(A) + 1)), key=lambda x:A[x - 1])\n\nans = [str(_) for _ in tmp]\n\nprint((\" \".join(ans)))","code_v0_loc":11,"code_v1_loc":6,"code_v0_num_chars":221,"code_v1_num_chars":170,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = [int(_) for _ in input().split(\" \")]\ntmp = np.argsort(A)\ntmp2 = tmp + np.ones(N)\ntmp3 = [int(_) for _ in tmp2.tolist()]\nans = [str(_) for _ in tmp3]\nprint((\" \".join(ans)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(_) for _ in input().split(\" \")]\ntmp = sorted(list(range(1, len(A) + 1)), key=lambda x: A[x - 1])\nans = [str(_) for _ in tmp]\nprint((\" \".join(ans)))\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-import numpy as np","-","-tmp = np.argsort(A)","-tmp2 = tmp + np.ones(N)","-tmp3 = [int(_) for _ in tmp2.tolist()]","-ans = [str(_) for _ in tmp3]","+tmp = sorted(list(range(1, len(A) + 1)), key=lambda x: A[x - 1])","+ans = [str(_) for _ in tmp]"],"diff_only_import_comment":false,"measured_runtime_v0":1.608368429,"measured_runtime_v1":0.1298276195,"runtime_lift":12.3884920241,"key":["s615780042","s374426185"]} +{"user_id":"u599114793","problem_id":"p03273","language":"python","submission_id_v0":"s483518668","submission_id_v1":"s544930407","cpu_time_v0":317,"cpu_time_v1":185,"memory_v0":20624,"memory_v1":39152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.64,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy\n\nh,w = list(map(int,input().split()))\n\ngrid = numpy.empty([h,w], str)\n\nwhite_h = []\n\nwhite_w = []\n\nfor i in range(h):\n\n grid[i] = list(eval(input()))\n\nfor i in range(h):\n\n if \"#\" not in grid[i]:\n\n white_h.append(i)\n\nfor i in range(w):\n\n if \"#\" not in grid[:, i]:\n\n white_w.append(i)\n\nans_grid = numpy.empty([h-len(white_h), w-len(white_w)], str)\n\ncnt_h = 0\n\nfor i in range(h):\n\n if i not in white_h:\n\n cnt_w = 0\n\n for j in range(w):\n\n if j not in white_w:\n\n ans_grid[cnt_h, cnt_w] = grid[i,j]\n\n cnt_w += 1\n\n cnt_h += 1\n\nfor i in range(len(ans_grid)):\n\n print((\"\".join(ans_grid[i])))\n\n\n\n\n\n\n\n\n# optimized version of the same code:\n","target":"h,w = list(map(int,input().split()))\n\ngrid = []\n\nfor i in range(h):\n\n grid.append(list(eval(input())))\n\nh_b = []\n\nw_b = []\n\nfor i in range(h):\n\n if \"#\" in grid[i]:\n\n h_b.append(i)\n\ngrid_t = [list(x) for x in zip(*grid)]\n\nfor i in range(w):\n\n if \"#\" in grid_t[i]:\n\n w_b.append(i)\n\nans = []\n\nfor i in h_b:\n\n crt = []\n\n for j in w_b:\n\n crt.append(grid[i][j])\n\n ans.append(crt)\n\nfor i in range(len(ans)):\n\n print((\"\".join(ans[i])))\n\n\n","code_v0_loc":28,"code_v1_loc":22,"code_v0_num_chars":679,"code_v1_num_chars":458,"code_v0_no_empty_lines":"import numpy\n\nh, w = list(map(int, input().split()))\ngrid = numpy.empty([h, w], str)\nwhite_h = []\nwhite_w = []\nfor i in range(h):\n grid[i] = list(eval(input()))\nfor i in range(h):\n if \"#\" not in grid[i]:\n white_h.append(i)\nfor i in range(w):\n if \"#\" not in grid[:, i]:\n white_w.append(i)\nans_grid = numpy.empty([h - len(white_h), w - len(white_w)], str)\ncnt_h = 0\nfor i in range(h):\n if i not in white_h:\n cnt_w = 0\n for j in range(w):\n if j not in white_w:\n ans_grid[cnt_h, cnt_w] = grid[i, j]\n cnt_w += 1\n cnt_h += 1\nfor i in range(len(ans_grid)):\n print((\"\".join(ans_grid[i])))\n","code_v1_no_empty_lines":"h, w = list(map(int, input().split()))\ngrid = []\nfor i in range(h):\n grid.append(list(eval(input())))\nh_b = []\nw_b = []\nfor i in range(h):\n if \"#\" in grid[i]:\n h_b.append(i)\ngrid_t = [list(x) for x in zip(*grid)]\nfor i in range(w):\n if \"#\" in grid_t[i]:\n w_b.append(i)\nans = []\nfor i in h_b:\n crt = []\n for j in w_b:\n crt.append(grid[i][j])\n ans.append(crt)\nfor i in range(len(ans)):\n print((\"\".join(ans[i])))\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-import numpy","-","-grid = numpy.empty([h, w], str)","-white_h = []","-white_w = []","+grid = []","- grid[i] = list(eval(input()))","+ grid.append(list(eval(input())))","+h_b = []","+w_b = []","- if \"#\" not in grid[i]:","- white_h.append(i)","+ if \"#\" in grid[i]:","+ h_b.append(i)","+grid_t = [list(x) for x in zip(*grid)]","- if \"#\" not in grid[:, i]:","- white_w.append(i)","-ans_grid = numpy.empty([h - len(white_h), w - len(white_w)], str)","-cnt_h = 0","-for i in range(h):","- if i not in white_h:","- cnt_w = 0","- for j in range(w):","- if j not in white_w:","- ans_grid[cnt_h, cnt_w] = grid[i, j]","- cnt_w += 1","- cnt_h += 1","-for i in range(len(ans_grid)):","- print((\"\".join(ans_grid[i])))","+ if \"#\" in grid_t[i]:","+ w_b.append(i)","+ans = []","+for i in h_b:","+ crt = []","+ for j in w_b:","+ crt.append(grid[i][j])","+ ans.append(crt)","+for i in range(len(ans)):","+ print((\"\".join(ans[i])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.7529192381,"measured_runtime_v1":0.3749449561,"runtime_lift":4.675137536,"key":["s483518668","s544930407"]} +{"user_id":"u428397309","problem_id":"p03037","language":"python","submission_id_v0":"s058389905","submission_id_v1":"s302443687","cpu_time_v0":285,"cpu_time_v1":131,"memory_v0":10868,"memory_v1":10868,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.04,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# -*- coding: utf-8 -*-\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nl = max(L)\n\nr = min(R)\n\n\n\nans = max(r - l + 1, 0)\n\n\n\nprint(ans)\n\n\n# optimized version of the same code:\n","target":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nans = max(min(R) - max(L) + 1, 0)\n\n\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":222,"code_v1_num_chars":248,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nN, M = list(map(int, input().split()))\nL, R = [None] * M, [None] * M\nfor i in range(M):\n L[i], R[i] = list(map(int, input().split()))\nl = max(L)\nr = min(R)\nans = max(r - l + 1, 0)\nprint(ans)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nL, R = [None] * M, [None] * M\nfor i in range(M):\n L[i], R[i] = list(map(int, input().split()))\nans = max(min(R) - max(L) + 1, 0)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+import sys","+","+input = sys.stdin.readline","-l = max(L)","-r = min(R)","-ans = max(r - l + 1, 0)","+ans = max(min(R) - max(L) + 1, 0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2363609416,"measured_runtime_v1":0.0060358713,"runtime_lift":39.1593741465,"key":["s058389905","s302443687"]} +{"user_id":"u756270013","problem_id":"p02881","language":"python","submission_id_v0":"s868775809","submission_id_v1":"s345973481","cpu_time_v0":439,"cpu_time_v1":210,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.16,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport math\n\ninput_num = int(eval(input()))\n\nnum_sqrt = int(math.sqrt(input_num))\n\n\n\nminimam = input_num\n\nfor i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n distance = q + i -2\n\n if mod == 0 and minimam > distance:\n\n minimam = distance\n\nprint(minimam)\n\n# optimized version of the same code:\n","target":"import math\n\ndef main1():\n\n input_num = int(eval(input()))\n\n num_sqrt = int(math.sqrt(input_num))\n\n\n\n minimam = input_num\n\n for i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n if mod == 0:\n\n distance = q + i -2\n\n if minimam > distance:\n\n minimam = distance\n\n print(minimam)\n\nmain1()","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":277,"code_v1_num_chars":357,"code_v0_no_empty_lines":"import math\n\ninput_num = int(eval(input()))\nnum_sqrt = int(math.sqrt(input_num))\nminimam = input_num\nfor i in range(num_sqrt + 1, 0, -1):\n q, mod = divmod(input_num, i)\n distance = q + i - 2\n if mod == 0 and minimam > distance:\n minimam = distance\nprint(minimam)\n","code_v1_no_empty_lines":"import math\n\n\ndef main1():\n input_num = int(eval(input()))\n num_sqrt = int(math.sqrt(input_num))\n minimam = input_num\n for i in range(num_sqrt + 1, 0, -1):\n q, mod = divmod(input_num, i)\n if mod == 0:\n distance = q + i - 2\n if minimam > distance:\n minimam = distance\n print(minimam)\n\n\nmain1()\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-input_num = int(eval(input()))","-num_sqrt = int(math.sqrt(input_num))","-minimam = input_num","-for i in range(num_sqrt + 1, 0, -1):","- q, mod = divmod(input_num, i)","- distance = q + i - 2","- if mod == 0 and minimam > distance:","- minimam = distance","-print(minimam)","+","+def main1():","+ input_num = int(eval(input()))","+ num_sqrt = int(math.sqrt(input_num))","+ minimam = input_num","+ for i in range(num_sqrt + 1, 0, -1):","+ q, mod = divmod(input_num, i)","+ if mod == 0:","+ distance = q + i - 2","+ if minimam > distance:","+ minimam = distance","+ print(minimam)","+","+","+main1()"],"diff_only_import_comment":false,"measured_runtime_v0":0.27158184,"measured_runtime_v1":0.2170004892,"runtime_lift":1.2515263951,"key":["s868775809","s345973481"]} +{"user_id":"u802963389","problem_id":"p02881","language":"python","submission_id_v0":"s879601223","submission_id_v1":"s706921267","cpu_time_v0":178,"cpu_time_v1":148,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.85,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# C - Walk on Multiplication Table\n\n# https:\/\/atcoder.jp\/contests\/abc144\/tasks\/abc144_c\n\n\n\nn = int(eval(input()))\n\n\n\nans = 10 ** 12\n\nfor i in range(1, 10 ** 6 + 1):\n\n if n % i == 0:\n\n ans = min(ans, n \/\/ i + i)\n\n\n\nprint((ans - 2))\n\n# optimized version of the same code:\n","target":"# C - Walk on Multiplication Table\n\n# https:\/\/atcoder.jp\/contests\/abc144\/tasks\/abc144_c\n\n\n\nn = int(eval(input()))\n\n\n\nans = n\n\nfor i in range(1, int(n**.5) + 2):\n\n if n % i == 0:\n\n ans = min(ans, n \/\/ i + i - 2)\n\n\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":226,"code_v1_num_chars":222,"code_v0_no_empty_lines":"# C - Walk on Multiplication Table\n# https:\/\/atcoder.jp\/contests\/abc144\/tasks\/abc144_c\nn = int(eval(input()))\nans = 10**12\nfor i in range(1, 10**6 + 1):\n if n % i == 0:\n ans = min(ans, n \/\/ i + i)\nprint((ans - 2))\n","code_v1_no_empty_lines":"# C - Walk on Multiplication Table\n# https:\/\/atcoder.jp\/contests\/abc144\/tasks\/abc144_c\nn = int(eval(input()))\nans = n\nfor i in range(1, int(n**0.5) + 2):\n if n % i == 0:\n ans = min(ans, n \/\/ i + i - 2)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-ans = 10**12","-for i in range(1, 10**6 + 1):","+ans = n","+for i in range(1, int(n**0.5) + 2):","- ans = min(ans, n \/\/ i + i)","-print((ans - 2))","+ ans = min(ans, n \/\/ i + i - 2)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.0824642203,"measured_runtime_v1":0.2210092547,"runtime_lift":4.8978230425,"key":["s879601223","s706921267"]} +{"user_id":"u077291787","problem_id":"p04020","language":"python","submission_id_v0":"s648607888","submission_id_v1":"s112859245","cpu_time_v0":58,"cpu_time_v1":46,"memory_v0":14252,"memory_v1":14092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.69,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# AGC003B - Simplified mahjong\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur \/\/ 2\n\n N = int(eval(input()))\n\n A = list(map(int, [eval(input()) for _ in range(N)])) + [0]\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur \/\/ 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n# optimized version of the same code:\n","target":"# AGC003B - Simplified mahjong\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur \/\/ 2\n\n N, *A = list(map(int, open(0).read().split()))\n\n A.append(0)\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur \/\/ 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":20,"code_v1_loc":17,"code_v0_num_chars":429,"code_v1_num_chars":369,"code_v0_no_empty_lines":"# AGC003B - Simplified mahjong\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n # split in subsequences when 0 appears -> sum up cur \/\/ 2\n N = int(eval(input()))\n A = list(map(int, [eval(input()) for _ in range(N)])) + [0]\n ans, cur = 0, 0\n for i in A:\n if i:\n cur += i\n else:\n ans += cur \/\/ 2\n cur = 0\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# AGC003B - Simplified mahjong\ndef main():\n # split in subsequences when 0 appears -> sum up cur \/\/ 2\n N, *A = list(map(int, open(0).read().split()))\n A.append(0)\n ans, cur = 0, 0\n for i in A:\n if i:\n cur += i\n else:\n ans += cur \/\/ 2\n cur = 0\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-import sys","-","-input = sys.stdin.readline","-","-","- N = int(eval(input()))","- A = list(map(int, [eval(input()) for _ in range(N)])) + [0]","+ N, *A = list(map(int, open(0).read().split()))","+ A.append(0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.282343082,"measured_runtime_v1":0.1984000847,"runtime_lift":1.4230996042,"key":["s648607888","s112859245"]} +{"user_id":"u131984977","problem_id":"p02412","language":"python","submission_id_v0":"s229334190","submission_id_v1":"s721700065","cpu_time_v0":1150,"cpu_time_v1":900,"memory_v0":6724,"memory_v1":6720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.74,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nwhile True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for a in range(1, n + 1):\n\n for b in range(a + 1, n + 1):\n\n for c in range(b + 1, n + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)\n\n# optimized version of the same code:\n","target":"while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n limit = n if n < x else x\n\n for a in range(1, limit + 1):\n\n for b in range(a + 1, limit + 1):\n\n for c in range(b + 1, limit + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)","code_v0_loc":13,"code_v1_loc":14,"code_v0_num_chars":316,"code_v1_num_chars":359,"code_v0_no_empty_lines":"while True:\n (n, x) = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for a in range(1, n + 1):\n for b in range(a + 1, n + 1):\n for c in range(b + 1, n + 1):\n if sum([a, b, c]) == x:\n count += 1\n print(count)\n","code_v1_no_empty_lines":"while True:\n (n, x) = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n limit = n if n < x else x\n for a in range(1, limit + 1):\n for b in range(a + 1, limit + 1):\n for c in range(b + 1, limit + 1):\n if sum([a, b, c]) == x:\n count += 1\n print(count)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["- for a in range(1, n + 1):","- for b in range(a + 1, n + 1):","- for c in range(b + 1, n + 1):","+ limit = n if n < x else x","+ for a in range(1, limit + 1):","+ for b in range(a + 1, limit + 1):","+ for c in range(b + 1, limit + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.2860648324,"measured_runtime_v1":0.2158536868,"runtime_lift":1.3252719315,"key":["s229334190","s721700065"]} +{"user_id":"u857428111","problem_id":"p03200","language":"python","submission_id_v0":"s495063826","submission_id_v1":"s740606838","cpu_time_v0":91,"cpu_time_v1":46,"memory_v0":6208,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.45,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(10000000)\n\n\n\n#const\n\ndxdy=((1,0),(0,1))\n\n#my functions here!\n\ndef pin(type=int):\n\n return list(map(type,input().rstrip().split()))\n\n\n\n\n\n#your code here!\n\ndef resolve():\n\n S=eval(input())\n\n ans=0\n\n \n\n hidari=0\n\n for i,c in enumerate(S):\n\n if c==\"W\":\n\n ans+=i-hidari\n\n hidari+=1\n\n print(ans)\n\n\n\nimport sys\n\nfrom io import StringIO\n\nimport unittest\n\n\n\n\n\nclass TestClass(unittest.TestCase):\n\n def assertIO(self, input, output):\n\n stdout, stdin = sys.stdout, sys.stdin\n\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n\n resolve()\n\n sys.stdout.seek(0)\n\n out = sys.stdout.read()[:-1]\n\n sys.stdout, sys.stdin = stdout, stdin\n\n self.assertEqual(out, output)\n\n\n\n def test_\u5165\u529b\u4f8b_1(self):\n\n input = \"\"\"BBW\"\"\"\n\n output = \"\"\"2\"\"\"\n\n self.assertIO(input, output)\n\n\n\n def test_\u5165\u529b\u4f8b_2(self):\n\n input = \"\"\"BWBWBW\"\"\"\n\n output = \"\"\"6\"\"\"\n\n self.assertIO(input, output)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n #unittest.main()\n\n\n\n\n\n resolve()#and submit 2 atcoder!\n\n\n\n\n# optimized version of the same code:\n","target":"import sys\n\ninput= lambda: sys.stdin.readline().rstrip()\n\ndef pin(type=int):\n\n return list(map(type,input().split()))\n\n\n\n#%%code\n\n\n\ndef resolve():\n\n \n\n S=eval(input())\n\n index=0\n\n ans=0\n\n for i in range(len(S)):\n\n if S[i]==\"W\":\n\n ans+=i-index\n\n index+=1\n\n print(ans)\n\n#%%submit!\n\nresolve()","code_v0_loc":54,"code_v1_loc":19,"code_v0_num_chars":1118,"code_v1_num_chars":327,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10000000)\n# const\ndxdy = ((1, 0), (0, 1))\n# my functions here!\ndef pin(type=int):\n return list(map(type, input().rstrip().split()))\n\n\n# your code here!\ndef resolve():\n S = eval(input())\n ans = 0\n hidari = 0\n for i, c in enumerate(S):\n if c == \"W\":\n ans += i - hidari\n hidari += 1\n print(ans)\n\n\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_\u5165\u529b\u4f8b_1(self):\n input = \"\"\"BBW\"\"\"\n output = \"\"\"2\"\"\"\n self.assertIO(input, output)\n\n def test_\u5165\u529b\u4f8b_2(self):\n input = \"\"\"BWBWBW\"\"\"\n output = \"\"\"6\"\"\"\n self.assertIO(input, output)\n\n\nif __name__ == \"__main__\":\n # unittest.main()\n resolve() # and submit 2 atcoder!\n","code_v1_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef pin(type=int):\n return list(map(type, input().split()))\n\n\n#%%code\ndef resolve():\n S = eval(input())\n index = 0\n ans = 0\n for i in range(len(S)):\n if S[i] == \"W\":\n ans += i - index\n index += 1\n print(ans)\n\n\n#%%submit!\nresolve()\n","code_same":false,"relative_loc_diff_percent":64.8148148148,"diff":["-sys.setrecursionlimit(10000000)","-# const","-dxdy = ((1, 0), (0, 1))","-# my functions here!","-def pin(type=int):","- return list(map(type, input().rstrip().split()))","+input = lambda: sys.stdin.readline().rstrip()","-# your code here!","+def pin(type=int):","+ return list(map(type, input().split()))","+","+","+#%%code","+ index = 0","- hidari = 0","- for i, c in enumerate(S):","- if c == \"W\":","- ans += i - hidari","- hidari += 1","+ for i in range(len(S)):","+ if S[i] == \"W\":","+ ans += i - index","+ index += 1","-import sys","-from io import StringIO","-import unittest","-","-","-class TestClass(unittest.TestCase):","- def assertIO(self, input, output):","- stdout, stdin = sys.stdout, sys.stdin","- sys.stdout, sys.stdin = StringIO(), StringIO(input)","- resolve()","- sys.stdout.seek(0)","- out = sys.stdout.read()[:-1]","- sys.stdout, sys.stdin = stdout, stdin","- self.assertEqual(out, output)","-","- def test_\u5165\u529b\u4f8b_1(self):","- input = \"\"\"BBW\"\"\"","- output = \"\"\"2\"\"\"","- self.assertIO(input, output)","-","- def test_\u5165\u529b\u4f8b_2(self):","- input = \"\"\"BWBWBW\"\"\"","- output = \"\"\"6\"\"\"","- self.assertIO(input, output)","-","-","-if __name__ == \"__main__\":","- # unittest.main()","- resolve() # and submit 2 atcoder!","+#%%submit!","+resolve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.7679491718,"measured_runtime_v1":0.21292143,"runtime_lift":3.6067255965,"key":["s495063826","s740606838"]} +{"user_id":"u562935282","problem_id":"p04005","language":"python","submission_id_v0":"s576816693","submission_id_v1":"s557622241","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n'''\n\n\u3042\u308b\u5e73\u9762\u306e\u30d6\u30ed\u30c3\u30af\u6570\u00d7(0,1)\n\n\u4e00\u3064\u3067\u3082\u5076\u6570\u304c\u3042\u308c\u3070\u3001\u5747\u7b49\u5206\u5272\u53ef\u80fd\n\n\u3059\u3079\u3066\u5947\u6570\u306e\u3068\u304d\u3001\n\n\u3042\u308b\u5e73\u9762\u306e\u30d6\u30ed\u30c3\u30af\u6570\u3092\u6700\u5c0f\u3068\u306a\u308b\u3088\u3046\u306b\u3059\u308b\u3068\u3001\u305d\u306e\u6570\u304c\u7b54\u3048\u306b\u306a\u308b\n\n'''\n\n\n\narr = list(map(int, input().split()))\n\n\n\nret = -1\n\nif 0 in list([x % 2 for x in arr]):\n\n ret = 0\n\nelse:\n\n arr_sorted = sorted(arr)\n\n ret = arr_sorted[0] * arr_sorted[1]\n\nprint(ret)\n\n# optimized version of the same code:\n","target":"a = list(map(int, input().split()))\n\n\n\nif any([x % 2 == 0 for x in a]):\n\n print((0))\n\nelse:\n\n a = list(sorted(a))\n\n print((a[0] * a[1]))\n","code_v0_loc":16,"code_v1_loc":7,"code_v0_num_chars":288,"code_v1_num_chars":147,"code_v0_no_empty_lines":"\"\"\"\n\u3042\u308b\u5e73\u9762\u306e\u30d6\u30ed\u30c3\u30af\u6570\u00d7(0,1)\n\u4e00\u3064\u3067\u3082\u5076\u6570\u304c\u3042\u308c\u3070\u3001\u5747\u7b49\u5206\u5272\u53ef\u80fd\n\u3059\u3079\u3066\u5947\u6570\u306e\u3068\u304d\u3001\n\u3042\u308b\u5e73\u9762\u306e\u30d6\u30ed\u30c3\u30af\u6570\u3092\u6700\u5c0f\u3068\u306a\u308b\u3088\u3046\u306b\u3059\u308b\u3068\u3001\u305d\u306e\u6570\u304c\u7b54\u3048\u306b\u306a\u308b\n\"\"\"\narr = list(map(int, input().split()))\nret = -1\nif 0 in list([x % 2 for x in arr]):\n ret = 0\nelse:\n arr_sorted = sorted(arr)\n ret = arr_sorted[0] * arr_sorted[1]\nprint(ret)\n","code_v1_no_empty_lines":"a = list(map(int, input().split()))\nif any([x % 2 == 0 for x in a]):\n print((0))\nelse:\n a = list(sorted(a))\n print((a[0] * a[1]))\n","code_same":false,"relative_loc_diff_percent":56.25,"diff":["-\"\"\"","-\u3042\u308b\u5e73\u9762\u306e\u30d6\u30ed\u30c3\u30af\u6570\u00d7(0,1)","-\u4e00\u3064\u3067\u3082\u5076\u6570\u304c\u3042\u308c\u3070\u3001\u5747\u7b49\u5206\u5272\u53ef\u80fd","-\u3059\u3079\u3066\u5947\u6570\u306e\u3068\u304d\u3001","-\u3042\u308b\u5e73\u9762\u306e\u30d6\u30ed\u30c3\u30af\u6570\u3092\u6700\u5c0f\u3068\u306a\u308b\u3088\u3046\u306b\u3059\u308b\u3068\u3001\u305d\u306e\u6570\u304c\u7b54\u3048\u306b\u306a\u308b","-\"\"\"","-arr = list(map(int, input().split()))","-ret = -1","-if 0 in list([x % 2 for x in arr]):","- ret = 0","+a = list(map(int, input().split()))","+if any([x % 2 == 0 for x in a]):","+ print((0))","- arr_sorted = sorted(arr)","- ret = arr_sorted[0] * arr_sorted[1]","-print(ret)","+ a = list(sorted(a))","+ print((a[0] * a[1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1621806974,"measured_runtime_v1":0.0068150451,"runtime_lift":23.7974502571,"key":["s576816693","s557622241"]} +{"user_id":"u940342887","problem_id":"p03162","language":"python","submission_id_v0":"s060379978","submission_id_v1":"s122581978","cpu_time_v0":1633,"cpu_time_v1":622,"memory_v0":43156,"memory_v1":50048,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.91,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nN = int(eval(input()))\n\nabc = []\n\nfor i in range(N):\n\n abc.append(list(map(int, input().split())))\n\n \n\ndp = np.zeros(shape=(N, 3), dtype=int)\n\ndp[0, :] = abc[0]\n\nfor i in range(N-1):\n\n dp[i+1, 0] = max(dp[i+1, 0], dp[i, 1] + abc[i+1][0], dp[i, 2] + abc[i+1][0])\n\n dp[i+1, 1] = max(dp[i+1, 1], dp[i, 0] + abc[i+1][1], dp[i, 2] + abc[i+1][1])\n\n dp[i+1, 2] = max(dp[i+1, 2], dp[i, 0] + abc[i+1][2], dp[i, 1] + abc[i+1][2])\n\nprint((max(dp[N-1, :])))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nabc = []\n\nfor i in range(N):\n\n data = list(map(int, input().split()))\n\n abc.append(data)\n\n\n\ndp = [[0 for i in range(3)] for j in range(N)]\n\ndp[0][0] = abc[0][0]\n\ndp[0][1] = abc[0][1]\n\ndp[0][2] = abc[0][2]\n\n\n\nfor i in range(N-1):\n\n for j in range(3):\n\n if j == 0:\n\n dp[i+1][1] = max(dp[i][0] + abc[i+1][1], dp[i+1][1])\n\n dp[i+1][2] = max(dp[i][0] + abc[i+1][2], dp[i+1][2])\n\n if j == 1:\n\n dp[i+1][0] = max(dp[i][1] + abc[i+1][0], dp[i+1][0])\n\n dp[i+1][2] = max(dp[i][1] + abc[i+1][2], dp[i+1][2])\n\n if j == 2:\n\n dp[i+1][1] = max(dp[i][2] + abc[i+1][1], dp[i+1][1])\n\n dp[i+1][0] = max(dp[i][2] + abc[i+1][0], dp[i+1][0])\n\n\n\nprint((max(dp[N-1])))","code_v0_loc":13,"code_v1_loc":24,"code_v0_num_chars":472,"code_v1_num_chars":755,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nabc = []\nfor i in range(N):\n abc.append(list(map(int, input().split())))\ndp = np.zeros(shape=(N, 3), dtype=int)\ndp[0, :] = abc[0]\nfor i in range(N - 1):\n dp[i + 1, 0] = max(dp[i + 1, 0], dp[i, 1] + abc[i + 1][0], dp[i, 2] + abc[i + 1][0])\n dp[i + 1, 1] = max(dp[i + 1, 1], dp[i, 0] + abc[i + 1][1], dp[i, 2] + abc[i + 1][1])\n dp[i + 1, 2] = max(dp[i + 1, 2], dp[i, 0] + abc[i + 1][2], dp[i, 1] + abc[i + 1][2])\nprint((max(dp[N - 1, :])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nabc = []\nfor i in range(N):\n data = list(map(int, input().split()))\n abc.append(data)\ndp = [[0 for i in range(3)] for j in range(N)]\ndp[0][0] = abc[0][0]\ndp[0][1] = abc[0][1]\ndp[0][2] = abc[0][2]\nfor i in range(N - 1):\n for j in range(3):\n if j == 0:\n dp[i + 1][1] = max(dp[i][0] + abc[i + 1][1], dp[i + 1][1])\n dp[i + 1][2] = max(dp[i][0] + abc[i + 1][2], dp[i + 1][2])\n if j == 1:\n dp[i + 1][0] = max(dp[i][1] + abc[i + 1][0], dp[i + 1][0])\n dp[i + 1][2] = max(dp[i][1] + abc[i + 1][2], dp[i + 1][2])\n if j == 2:\n dp[i + 1][1] = max(dp[i][2] + abc[i + 1][1], dp[i + 1][1])\n dp[i + 1][0] = max(dp[i][2] + abc[i + 1][0], dp[i + 1][0])\nprint((max(dp[N - 1])))\n","code_same":false,"relative_loc_diff_percent":45.8333333333,"diff":["-import numpy as np","-","- abc.append(list(map(int, input().split())))","-dp = np.zeros(shape=(N, 3), dtype=int)","-dp[0, :] = abc[0]","+ data = list(map(int, input().split()))","+ abc.append(data)","+dp = [[0 for i in range(3)] for j in range(N)]","+dp[0][0] = abc[0][0]","+dp[0][1] = abc[0][1]","+dp[0][2] = abc[0][2]","- dp[i + 1, 0] = max(dp[i + 1, 0], dp[i, 1] + abc[i + 1][0], dp[i, 2] + abc[i + 1][0])","- dp[i + 1, 1] = max(dp[i + 1, 1], dp[i, 0] + abc[i + 1][1], dp[i, 2] + abc[i + 1][1])","- dp[i + 1, 2] = max(dp[i + 1, 2], dp[i, 0] + abc[i + 1][2], dp[i, 1] + abc[i + 1][2])","-print((max(dp[N - 1, :])))","+ for j in range(3):","+ if j == 0:","+ dp[i + 1][1] = max(dp[i][0] + abc[i + 1][1], dp[i + 1][1])","+ dp[i + 1][2] = max(dp[i][0] + abc[i + 1][2], dp[i + 1][2])","+ if j == 1:","+ dp[i + 1][0] = max(dp[i][1] + abc[i + 1][0], dp[i + 1][0])","+ dp[i + 1][2] = max(dp[i][1] + abc[i + 1][2], dp[i + 1][2])","+ if j == 2:","+ dp[i + 1][1] = max(dp[i][2] + abc[i + 1][1], dp[i + 1][1])","+ dp[i + 1][0] = max(dp[i][2] + abc[i + 1][0], dp[i + 1][0])","+print((max(dp[N - 1])))"],"diff_only_import_comment":false,"measured_runtime_v0":1.3918258445,"measured_runtime_v1":0.1973543379,"runtime_lift":7.0524208338,"key":["s060379978","s122581978"]} +{"user_id":"u272075541","problem_id":"p02767","language":"python","submission_id_v0":"s628544873","submission_id_v1":"s617455512","cpu_time_v0":325,"cpu_time_v1":158,"memory_v0":21516,"memory_v1":13284,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.38,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn = int(eval(input()))\n\na = np.array(input().split(), np.int)\n\na.sort()\n\n\n\nans = []\n\nfor x in range(a[0], a[-1]+1):\n\n ans.append(np.sum((a - x) ** 2))\n\n\n\nprint((min(ans)))\n\n# optimized version of the same code:\n","target":"from decimal import Decimal, ROUND_HALF_UP\n\nimport numpy as np\n\nn = int(eval(input()))\n\nx = np.array(input().split(), int)\n\n\n\nm = Decimal(np.sum(x) \/ n)\n\nmq = int(m.quantize(0, rounding=ROUND_HALF_UP))\n\n\n\ns = np.sum((x-mq)**2)\n\nprint(s)","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":186,"code_v1_num_chars":230,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\na = np.array(input().split(), np.int)\na.sort()\nans = []\nfor x in range(a[0], a[-1] + 1):\n ans.append(np.sum((a - x) ** 2))\nprint((min(ans)))\n","code_v1_no_empty_lines":"from decimal import Decimal, ROUND_HALF_UP\nimport numpy as np\n\nn = int(eval(input()))\nx = np.array(input().split(), int)\nm = Decimal(np.sum(x) \/ n)\nmq = int(m.quantize(0, rounding=ROUND_HALF_UP))\ns = np.sum((x - mq) ** 2)\nprint(s)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+from decimal import Decimal, ROUND_HALF_UP","-a = np.array(input().split(), np.int)","-a.sort()","-ans = []","-for x in range(a[0], a[-1] + 1):","- ans.append(np.sum((a - x) ** 2))","-print((min(ans)))","+x = np.array(input().split(), int)","+m = Decimal(np.sum(x) \/ n)","+mq = int(m.quantize(0, rounding=ROUND_HALF_UP))","+s = np.sum((x - mq) ** 2)","+print(s)"],"diff_only_import_comment":false,"measured_runtime_v0":2.7178692944,"measured_runtime_v1":2.1309513599,"runtime_lift":1.2754253079,"key":["s628544873","s617455512"]} +{"user_id":"u883040023","problem_id":"p02994","language":"python","submission_id_v0":"s336365694","submission_id_v1":"s043859026","cpu_time_v0":170,"cpu_time_v1":17,"memory_v0":13596,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.0,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN , L = list(map(int , input().split()))\n\n\n\napple_taste = []\n\n\n\nfor i in range(N):\n\n taste = L + i + 1 - 1\n\n apple_taste.append(taste)\n\n \n\nimport numpy as np\n\n\n\nabs_apple_taste = np.abs(apple_taste)\n\nm = min(abs_apple_taste)\n\n\n\nfor j in range(N):\n\n if m == abs_apple_taste[j]:\n\n apple_taste.remove(apple_taste[j])\n\n\n\npie_taste = 0 \n\n\n\nfor k in range(N-1):\n\n pie_taste += apple_taste[k]\n\n \n\nprint(pie_taste)\n\n# optimized version of the same code:\n","target":"n,l = list(map(int,input().split()))\n\nans = l\n\neat = l\n\n\n\nfor i in range(n-1):\n\n l += 1\n\n ans += l\n\n \n\n if abs(l) < abs(eat):\n\n eat = l\n\n \n\nprint((ans-eat))","code_v0_loc":23,"code_v1_loc":12,"code_v0_num_chars":431,"code_v1_num_chars":174,"code_v0_no_empty_lines":"N, L = list(map(int, input().split()))\napple_taste = []\nfor i in range(N):\n taste = L + i + 1 - 1\n apple_taste.append(taste)\nimport numpy as np\n\nabs_apple_taste = np.abs(apple_taste)\nm = min(abs_apple_taste)\nfor j in range(N):\n if m == abs_apple_taste[j]:\n apple_taste.remove(apple_taste[j])\npie_taste = 0\nfor k in range(N - 1):\n pie_taste += apple_taste[k]\nprint(pie_taste)\n","code_v1_no_empty_lines":"n, l = list(map(int, input().split()))\nans = l\neat = l\nfor i in range(n - 1):\n l += 1\n ans += l\n if abs(l) < abs(eat):\n eat = l\nprint((ans - eat))\n","code_same":false,"relative_loc_diff_percent":47.8260869565,"diff":["-N, L = list(map(int, input().split()))","-apple_taste = []","-for i in range(N):","- taste = L + i + 1 - 1","- apple_taste.append(taste)","-import numpy as np","-","-abs_apple_taste = np.abs(apple_taste)","-m = min(abs_apple_taste)","-for j in range(N):","- if m == abs_apple_taste[j]:","- apple_taste.remove(apple_taste[j])","-pie_taste = 0","-for k in range(N - 1):","- pie_taste += apple_taste[k]","-print(pie_taste)","+n, l = list(map(int, input().split()))","+ans = l","+eat = l","+for i in range(n - 1):","+ l += 1","+ ans += l","+ if abs(l) < abs(eat):","+ eat = l","+print((ans - eat))"],"diff_only_import_comment":false,"measured_runtime_v0":1.8756559513,"measured_runtime_v1":0.2713351281,"runtime_lift":6.9126911968,"key":["s336365694","s043859026"]} +{"user_id":"u740909619","problem_id":"p02899","language":"python","submission_id_v0":"s813753303","submission_id_v1":"s285228953","cpu_time_v0":787,"cpu_time_v1":104,"memory_v0":23376,"memory_v1":14008,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# C - Go to School\n\ndef main():\n\n import numpy as np\n\n n = int(input())\n\n a = list(map(int, input().split()))\n\n a = np.array(a)\n\n a = np.argsort(a)\n\n for i in a:\n\n print(i+1,end=\" \")\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n# optimized version of the same code:\n","target":"# C - Go to School\n\ndef main():\n\n n = int(eval(input()))\n\n a = list(map(int, input().split()))\n\n ans = [0] * n\n\n\n\n for i, o in enumerate(a):\n\n ans[o-1] = i + 1 \n\n \n\n print((*ans))\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":12,"code_v1_loc":13,"code_v0_num_chars":250,"code_v1_num_chars":239,"code_v0_no_empty_lines":"# C - Go to School\ndef main():\n import numpy as np\n\n n = int(input())\n a = list(map(int, input().split()))\n a = np.array(a)\n a = np.argsort(a)\n for i in a:\n print(i + 1, end=\" \")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# C - Go to School\ndef main():\n n = int(eval(input()))\n a = list(map(int, input().split()))\n ans = [0] * n\n for i, o in enumerate(a):\n ans[o - 1] = i + 1\n print((*ans))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["- import numpy as np","-","- n = int(input())","+ n = int(eval(input()))","- a = np.array(a)","- a = np.argsort(a)","- for i in a:","- print(i + 1, end=\" \")","+ ans = [0] * n","+ for i, o in enumerate(a):","+ ans[o - 1] = i + 1","+ print((*ans))"],"diff_only_import_comment":false,"measured_runtime_v0":0.7626473089,"measured_runtime_v1":0.1551200287,"runtime_lift":4.9164979856,"key":["s813753303","s285228953"]} +{"user_id":"u426534722","problem_id":"p02245","language":"python","submission_id_v0":"s237914915","submission_id_v1":"s694650984","cpu_time_v0":730,"cpu_time_v1":50,"memory_v0":25688,"memory_v1":8488,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.15,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a \/\/ (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n if MAP == goal:\n\n return 0\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n return cnt\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n\n\n# optimized version of the same code:\n","target":"from collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a \/\/ (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n zero = 8 - MAP.find(\"0\")\n\n start = int(MAP)\n\n if start == goal:\n\n return 0\n\n dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])\n\n TABLE = {start: (1, 0), goal: (0, 0)}\n\n while dp:\n\n cnt, M, yx, flg = dp.popleft()\n\n cnt += 1\n\n for nyx in m[yx]:\n\n key = g(yx, nyx, M)\n\n if key in TABLE:\n\n if TABLE[key][0] != flg:\n\n return TABLE[key][1] + cnt\n\n continue\n\n TABLE[key] = (flg, cnt)\n\n dp.append((cnt, key, nyx, flg))\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n","code_v0_loc":30,"code_v1_loc":31,"code_v0_num_chars":815,"code_v1_num_chars":949,"code_v0_no_empty_lines":"from collections import deque\n\nN = 3\nm = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n}\ngoal = 123456780\n\n\ndef g(i, j, a):\n t = a \/\/ (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef solve():\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = 8 - MAP.find(\"0\")\n MAP = int(MAP)\n if MAP == goal:\n return 0\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n return cnt\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\ndef MAIN():\n print((solve()))\n\n\nMAIN()\n","code_v1_no_empty_lines":"from collections import deque\n\nN = 3\nm = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n}\ngoal = 123456780\n\n\ndef g(i, j, a):\n t = a \/\/ (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef solve():\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n zero = 8 - MAP.find(\"0\")\n start = int(MAP)\n if start == goal:\n return 0\n dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])\n TABLE = {start: (1, 0), goal: (0, 0)}\n while dp:\n cnt, M, yx, flg = dp.popleft()\n cnt += 1\n for nyx in m[yx]:\n key = g(yx, nyx, M)\n if key in TABLE:\n if TABLE[key][0] != flg:\n return TABLE[key][1] + cnt\n continue\n TABLE[key] = (flg, cnt)\n dp.append((cnt, key, nyx, flg))\n\n\ndef MAIN():\n print((solve()))\n\n\nMAIN()\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["- start = 8 - MAP.find(\"0\")","- MAP = int(MAP)","- if MAP == goal:","+ zero = 8 - MAP.find(\"0\")","+ start = int(MAP)","+ if start == goal:","- dp = deque([(0, start, MAP)])","- LOG = {MAP}","+ dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])","+ TABLE = {start: (1, 0), goal: (0, 0)}","- cnt, yx, M = dp.popleft()","- if M == goal:","- return cnt","+ cnt, M, yx, flg = dp.popleft()","- CM = g(yx, nyx, M)","- if not CM in LOG:","- dp.append((cnt, nyx, CM))","- LOG.add(CM)","+ key = g(yx, nyx, M)","+ if key in TABLE:","+ if TABLE[key][0] != flg:","+ return TABLE[key][1] + cnt","+ continue","+ TABLE[key] = (flg, cnt)","+ dp.append((cnt, key, nyx, flg))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2854871392,"measured_runtime_v1":0.2155938864,"runtime_lift":1.3241894008,"key":["s237914915","s694650984"]} +{"user_id":"u562935282","problem_id":"p03371","language":"python","submission_id_v0":"s168362535","submission_id_v1":"s471284270","cpu_time_v0":242,"cpu_time_v1":98,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.5,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\ninf = (5000 * 10 ** 5) * 3\n\n\n\na, b, c, x, y = list(map(int, input().split()))\n\n\n\nret = inf\n\nfor cnt_ab in range(max(x, y) * 2 + 1):\n\n d = cnt_ab \/\/ 2\n\n\n\n cnt_a = max(0, x - d)\n\n cnt_b = max(0, y - d)\n\n\n\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n\n ret = min(ret, t)\n\nprint(ret)\n\n\n# optimized version of the same code:\n","target":"def main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":14,"code_v1_loc":20,"code_v0_num_chars":284,"code_v1_num_chars":353,"code_v0_no_empty_lines":"inf = (5000 * 10**5) * 3\na, b, c, x, y = list(map(int, input().split()))\nret = inf\nfor cnt_ab in range(max(x, y) * 2 + 1):\n d = cnt_ab \/\/ 2\n cnt_a = max(0, x - d)\n cnt_b = max(0, y - d)\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n ret = min(ret, t)\nprint(ret)\n","code_v1_no_empty_lines":"def main():\n A, B, AB, X, Y = list(map(int, input().split()))\n M = max(X, Y)\n k = 0\n ans = A * X + B * Y\n while True:\n ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)\n if k >= M:\n break\n k += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-inf = (5000 * 10**5) * 3","-a, b, c, x, y = list(map(int, input().split()))","-ret = inf","-for cnt_ab in range(max(x, y) * 2 + 1):","- d = cnt_ab \/\/ 2","- cnt_a = max(0, x - d)","- cnt_b = max(0, y - d)","- t = cnt_ab * c + cnt_a * a + cnt_b * b","- ret = min(ret, t)","-print(ret)","+def main():","+ A, B, AB, X, Y = list(map(int, input().split()))","+ M = max(X, Y)","+ k = 0","+ ans = A * X + B * Y","+ while True:","+ ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)","+ if k >= M:","+ break","+ k += 1","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.4937371187,"measured_runtime_v1":0.3021148317,"runtime_lift":1.6342697111,"key":["s168362535","s471284270"]} +{"user_id":"u349449706","problem_id":"p02555","language":"python","submission_id_v0":"s796837031","submission_id_v1":"s077713004","cpu_time_v0":96,"cpu_time_v1":64,"memory_v0":68168,"memory_v1":63448,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nS = int(eval(input()))\n\nf = [0]*(S+1)\n\nf[0] = 1\n\nif S >= 3: f[3] = 1\n\nif S >= 4: f[4] = 1\n\nif S >= 5: f[5] = 1\n\nfor i in range(6, S+1):\n\n f[i] = sum(f[i-j] for j in range(3, i+1))%(10**9+7)\n\nprint((f[S]))\n\n\n# optimized version of the same code:\n","target":"S=int(eval(input()))\n\nf=[1,0,0]\n\nfor i in range(S-2):f.append(f[i]+f[i+2])\n\nprint((f[S]%(10**9+7)))\n","code_v0_loc":9,"code_v1_loc":4,"code_v0_num_chars":200,"code_v1_num_chars":92,"code_v0_no_empty_lines":"S = int(eval(input()))\nf = [0] * (S + 1)\nf[0] = 1\nif S >= 3:\n f[3] = 1\nif S >= 4:\n f[4] = 1\nif S >= 5:\n f[5] = 1\nfor i in range(6, S + 1):\n f[i] = sum(f[i - j] for j in range(3, i + 1)) % (10**9 + 7)\nprint((f[S]))\n","code_v1_no_empty_lines":"S = int(eval(input()))\nf = [1, 0, 0]\nfor i in range(S - 2):\n f.append(f[i] + f[i + 2])\nprint((f[S] % (10**9 + 7)))\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-f = [0] * (S + 1)","-f[0] = 1","-if S >= 3:","- f[3] = 1","-if S >= 4:","- f[4] = 1","-if S >= 5:","- f[5] = 1","-for i in range(6, S + 1):","- f[i] = sum(f[i - j] for j in range(3, i + 1)) % (10**9 + 7)","-print((f[S]))","+f = [1, 0, 0]","+for i in range(S - 2):","+ f.append(f[i] + f[i + 2])","+print((f[S] % (10**9 + 7)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5486869376,"measured_runtime_v1":0.341561399,"runtime_lift":1.6064079231,"key":["s796837031","s077713004"]} +{"user_id":"u296518383","problem_id":"p03806","language":"python","submission_id_v0":"s823150149","submission_id_v1":"s174409855","cpu_time_v0":255,"cpu_time_v1":220,"memory_v0":44124,"memory_v1":43356,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.73,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(400, -1, -1):\n\n for j in range(400, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, 401):\n\n for j in range(1, 401):\n\n if dp[i][j] != INF and i \/ j == Ma \/ Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))\n\n# optimized version of the same code:\n","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nsumA = sum([ABC[i][0] for i in range(N)])\n\nsumB = sum([ABC[i][1] for i in range(N)])\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(sumA, -1, -1):\n\n for j in range(sumB, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, sumA + 1):\n\n for j in range(1, sumB + 1):\n\n if dp[i][j] != INF and i \/ j == Ma \/ Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))","code_v0_loc":23,"code_v1_loc":26,"code_v0_num_chars":611,"code_v1_num_chars":721,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nN, Ma, Mb = list(map(int, input().split()))\nABC = [list(map(int, input().split())) for _ in range(N)]\nINF = 10**15\ndp = [[INF for j in range(401)] for i in range(401)]\ndp[0][0] = 0\nfor a, b, c in ABC:\n for i in range(400, -1, -1):\n for j in range(400, -1, -1):\n if dp[i][j] != INF:\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\nanswer = INF\nfor i in range(1, 401):\n for j in range(1, 401):\n if dp[i][j] != INF and i \/ j == Ma \/ Mb:\n answer = min(answer, dp[i][j])\nprint((answer if answer != INF else -1))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nN, Ma, Mb = list(map(int, input().split()))\nABC = [list(map(int, input().split())) for _ in range(N)]\nsumA = sum([ABC[i][0] for i in range(N)])\nsumB = sum([ABC[i][1] for i in range(N)])\nINF = 10**15\ndp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]\ndp[0][0] = 0\nfor a, b, c in ABC:\n for i in range(sumA, -1, -1):\n for j in range(sumB, -1, -1):\n if dp[i][j] != INF:\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\nanswer = INF\nfor i in range(1, sumA + 1):\n for j in range(1, sumB + 1):\n if dp[i][j] != INF and i \/ j == Ma \/ Mb:\n answer = min(answer, dp[i][j])\nprint((answer if answer != INF else -1))\n","code_same":false,"relative_loc_diff_percent":11.5384615385,"diff":["+sumA = sum([ABC[i][0] for i in range(N)])","+sumB = sum([ABC[i][1] for i in range(N)])","-dp = [[INF for j in range(401)] for i in range(401)]","+dp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]","- for i in range(400, -1, -1):","- for j in range(400, -1, -1):","+ for i in range(sumA, -1, -1):","+ for j in range(sumB, -1, -1):","-for i in range(1, 401):","- for j in range(1, 401):","+for i in range(1, sumA + 1):","+ for j in range(1, sumB + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.8101779278,"measured_runtime_v1":0.2126889092,"runtime_lift":3.8092156792,"key":["s823150149","s174409855"]} +{"user_id":"u064505481","problem_id":"p02555","language":"python","submission_id_v0":"s988049268","submission_id_v1":"s031685542","cpu_time_v0":173,"cpu_time_v1":74,"memory_v0":76464,"memory_v1":70408,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.23,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nfrom sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\nsetrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\t@lru_cache(None)\n\n\tdef dp(currsum):\n\n\t\tif currsum == s: return 1\n\n\t\tcnt = 0\n\n\t\tfor d in range(3, 2001):\n\n\t\t\tif currsum + d <= s:\n\n\t\t\t\tcnt += dp(currsum + d)\n\n\t\t\t\tcnt %= MOD \n\n\t\treturn cnt\n\n\tprint((dp(0)))\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()\n\n# optimized version of the same code:\n","target":"from sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\n#setrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\tdef binom_tables(n, q):\n\n\t\tfact = [1 for _ in range(n + 1)]\n\n\t\tinv = [1 for _ in range(n + 1)]\n\n\t\tfor i in range(1, n+1):\n\n\t\t\tfact[i] = (fact[i-1] * i) % q\n\n\t\t\tinv[i] = pow(fact[i], q-2, q)\n\n\t\treturn fact, inv\n\n\n\n\tF, I = binom_tables(s + 700, MOD)\n\n\n\n\tdef binom(n, k, q):\n\n\t\treturn (F[n]*((I[k]*I[n-k])%q))%q\n\n\n\n\tans = 0\n\n\tfor r in range(1, 700):\n\n\t\tobjects = s - 3*r\n\n\t\tif objects + r - 1 < objects or objects < 0: \n\n\t\t\tbreak\n\n\t\tx = binom(objects + r - 1, objects, MOD)\n\n\t\tans += x\n\n\t\tans %= MOD \n\n\n\n\tprint(ans)\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()","code_v0_loc":32,"code_v1_loc":45,"code_v0_num_chars":739,"code_v1_num_chars":1050,"code_v0_no_empty_lines":"from sys import stdin, stdout, setrecursionlimit\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\nfrom functools import lru_cache\nimport math\n\nsetrecursionlimit(10**6)\nrl = lambda: stdin.readline()\nrll = lambda: stdin.readline().split()\nrli = lambda: list(map(int, stdin.readline().split()))\nrlf = lambda: list(map(float, stdin.readline().split()))\nINF, NINF = float(\"inf\"), float(\"-inf\")\nMOD = 10**9 + 7\n\n\ndef main():\n s = int(rl())\n\n @lru_cache(None)\n def dp(currsum):\n if currsum == s:\n return 1\n cnt = 0\n for d in range(3, 2001):\n if currsum + d <= s:\n cnt += dp(currsum + d)\n cnt %= MOD\n return cnt\n\n print((dp(0)))\n stdout.close()\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from sys import stdin, stdout, setrecursionlimit\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\nfrom functools import lru_cache\nimport math\n\n# setrecursionlimit(10**6)\nrl = lambda: stdin.readline()\nrll = lambda: stdin.readline().split()\nrli = lambda: list(map(int, stdin.readline().split()))\nrlf = lambda: list(map(float, stdin.readline().split()))\nINF, NINF = float(\"inf\"), float(\"-inf\")\nMOD = 10**9 + 7\n\n\ndef main():\n s = int(rl())\n\n def binom_tables(n, q):\n fact = [1 for _ in range(n + 1)]\n inv = [1 for _ in range(n + 1)]\n for i in range(1, n + 1):\n fact[i] = (fact[i - 1] * i) % q\n inv[i] = pow(fact[i], q - 2, q)\n return fact, inv\n\n F, I = binom_tables(s + 700, MOD)\n\n def binom(n, k, q):\n return (F[n] * ((I[k] * I[n - k]) % q)) % q\n\n ans = 0\n for r in range(1, 700):\n objects = s - 3 * r\n if objects + r - 1 < objects or objects < 0:\n break\n x = binom(objects + r - 1, objects, MOD)\n ans += x\n ans %= MOD\n print(ans)\n stdout.close()\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":28.8888888889,"diff":["-setrecursionlimit(10**6)","+# setrecursionlimit(10**6)","- @lru_cache(None)","- def dp(currsum):","- if currsum == s:","- return 1","- cnt = 0","- for d in range(3, 2001):","- if currsum + d <= s:","- cnt += dp(currsum + d)","- cnt %= MOD","- return cnt","+ def binom_tables(n, q):","+ fact = [1 for _ in range(n + 1)]","+ inv = [1 for _ in range(n + 1)]","+ for i in range(1, n + 1):","+ fact[i] = (fact[i - 1] * i) % q","+ inv[i] = pow(fact[i], q - 2, q)","+ return fact, inv","- print((dp(0)))","+ F, I = binom_tables(s + 700, MOD)","+","+ def binom(n, k, q):","+ return (F[n] * ((I[k] * I[n - k]) % q)) % q","+","+ ans = 0","+ for r in range(1, 700):","+ objects = s - 3 * r","+ if objects + r - 1 < objects or objects < 0:","+ break","+ x = binom(objects + r - 1, objects, MOD)","+ ans += x","+ ans %= MOD","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.7214400458,"measured_runtime_v1":0.2090635548,"runtime_lift":3.4508168897,"key":["s988049268","s031685542"]} +{"user_id":"u752898745","problem_id":"p03307","language":"python","submission_id_v0":"s632972821","submission_id_v1":"s560495025","cpu_time_v0":37,"cpu_time_v1":17,"memory_v0":5304,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.05,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport fractions\n\nn=int(eval(input()))\n\nprint(((2*n)\/\/fractions.gcd(2,n)))\n\n# optimized version of the same code:\n","target":"N=int(eval(input()));print((N if N%2==0 else N*2))","code_v0_loc":3,"code_v1_loc":1,"code_v0_num_chars":66,"code_v1_num_chars":42,"code_v0_no_empty_lines":"import fractions\n\nn = int(eval(input()))\nprint(((2 * n) \/\/ fractions.gcd(2, n)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nprint((N if N % 2 == 0 else N * 2))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-import fractions","-","-n = int(eval(input()))","-print(((2 * n) \/\/ fractions.gcd(2, n)))","+N = int(eval(input()))","+print((N if N % 2 == 0 else N * 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4506682441,"measured_runtime_v1":0.3598311198,"runtime_lift":1.2524437697,"key":["s632972821","s560495025"]} +{"user_id":"u347640436","problem_id":"p03854","language":"python","submission_id_v0":"s259161069","submission_id_v1":"s688102427","cpu_time_v0":1216,"cpu_time_v1":697,"memory_v0":3420,"memory_v1":3992,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.68,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\ns = input()\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n if s == t + w:\n\n print('YES')\n\n sys.exit()\n\n if s.startswith(t + w):\n\n nts.append(t + w)\n\n if len(nts) == 0:\n\n print('NO')\n\n sys.exit()\n\n ts = nts\n\n\n# optimized version of the same code:\n","target":"from sys import exit\n\ns = eval(input())\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n tw = t + w\n\n if s == tw:\n\n print('YES')\n\n exit()\n\n if s.startswith(tw):\n\n nts.append(tw)\n\n if len(nts) == 0:\n\n print('NO')\n\n exit()\n\n ts = nts\n","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":320,"code_v1_num_chars":329,"code_v0_no_empty_lines":"import sys\n\ns = input()\nts = [\"\"]\nwhile True:\n nts = []\n for t in ts:\n for w in [\"dreamer\", \"eraser\", \"dream\", \"erase\"]:\n if s == t + w:\n print(\"YES\")\n sys.exit()\n if s.startswith(t + w):\n nts.append(t + w)\n if len(nts) == 0:\n print(\"NO\")\n sys.exit()\n ts = nts\n","code_v1_no_empty_lines":"from sys import exit\n\ns = eval(input())\nts = [\"\"]\nwhile True:\n nts = []\n for t in ts:\n for w in [\"dreamer\", \"eraser\", \"dream\", \"erase\"]:\n tw = t + w\n if s == tw:\n print(\"YES\")\n exit()\n if s.startswith(tw):\n nts.append(tw)\n if len(nts) == 0:\n print(\"NO\")\n exit()\n ts = nts\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-import sys","+from sys import exit","-s = input()","+s = eval(input())","- if s == t + w:","+ tw = t + w","+ if s == tw:","- sys.exit()","- if s.startswith(t + w):","- nts.append(t + w)","+ exit()","+ if s.startswith(tw):","+ nts.append(tw)","- sys.exit()","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2929967599,"measured_runtime_v1":0.1979754126,"runtime_lift":1.4799653958,"key":["s259161069","s688102427"]} +{"user_id":"u584658281","problem_id":"p02688","language":"python","submission_id_v0":"s600438109","submission_id_v1":"s928531547","cpu_time_v0":27,"cpu_time_v1":24,"memory_v0":9216,"memory_v1":9264,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nN,K=list(map(int,input().split()))\n\na = [[0]*N]*K\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(eval(input()))\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)\n\n# optimized version of the same code:\n","target":"N,K=list(map(int,input().split()))\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(eval(input()))\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)","code_v0_loc":21,"code_v1_loc":20,"code_v0_num_chars":365,"code_v1_num_chars":350,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\na = [[0] * N] * K\na = [[0 for n in range(N)] for k in range(K)]\nfor k in range(K):\n d = int(eval(input()))\n have_k = list(map(int, input().split()))\n for h in have_k:\n a[k][h - 1] = 1\nan = [0] * N\nfor k in range(K):\n for n in range(N):\n an[n] = an[n] + a[k][n]\nresult = 0\nfor i in an:\n if i == 0:\n result += 1\nprint(result)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\na = [[0 for n in range(N)] for k in range(K)]\nfor k in range(K):\n d = int(eval(input()))\n have_k = list(map(int, input().split()))\n for h in have_k:\n a[k][h - 1] = 1\nan = [0] * N\nfor k in range(K):\n for n in range(N):\n an[n] = an[n] + a[k][n]\nresult = 0\nfor i in an:\n if i == 0:\n result += 1\nprint(result)\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["-a = [[0] * N] * K"],"diff_only_import_comment":false,"measured_runtime_v0":0.33595281,"measured_runtime_v1":0.2656919487,"runtime_lift":1.264444827,"key":["s600438109","s928531547"]} +{"user_id":"u844646164","problem_id":"p02767","language":"python","submission_id_v0":"s330073490","submission_id_v1":"s440501694","cpu_time_v0":294,"cpu_time_v1":21,"memory_v0":21384,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.86,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np \n\nn = int(eval(input()))\n\nx = list(map(int, input().split()))\n\nx = np.array(x)\n\nans = float('inf')\n\nidx = 200\n\nfor i in range(100):\n\n y = x \n\n ans = min(ans, np.sum((y-i)**2))\n\n \n\nprint(ans)\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nX = list(map(int, input().split()))\n\nmx = max(X)\n\nans = float('inf')\n\nfor i in range(mx+1):\n\n tmp = 0\n\n for x in X:\n\n tmp += (x-(i+1))**2\n\n ans = min(ans, tmp)\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":206,"code_v1_num_chars":195,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nx = list(map(int, input().split()))\nx = np.array(x)\nans = float(\"inf\")\nidx = 200\nfor i in range(100):\n y = x\n ans = min(ans, np.sum((y - i) ** 2))\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nX = list(map(int, input().split()))\nmx = max(X)\nans = float(\"inf\")\nfor i in range(mx + 1):\n tmp = 0\n for x in X:\n tmp += (x - (i + 1)) ** 2\n ans = min(ans, tmp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-import numpy as np","-","-n = int(eval(input()))","-x = list(map(int, input().split()))","-x = np.array(x)","+N = int(eval(input()))","+X = list(map(int, input().split()))","+mx = max(X)","-idx = 200","-for i in range(100):","- y = x","- ans = min(ans, np.sum((y - i) ** 2))","+for i in range(mx + 1):","+ tmp = 0","+ for x in X:","+ tmp += (x - (i + 1)) ** 2","+ ans = min(ans, tmp)"],"diff_only_import_comment":false,"measured_runtime_v0":1.4239430195,"measured_runtime_v1":0.19636644,"runtime_lift":7.2514581394,"key":["s330073490","s440501694"]} +{"user_id":"u156896646","problem_id":"p03854","language":"python","submission_id_v0":"s725954700","submission_id_v1":"s400985362","cpu_time_v0":76,"cpu_time_v1":64,"memory_v0":21348,"memory_v1":21348,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.79,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = eval(input())\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isDream #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n #print('d:', d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #; print(d, pout)\n\n if pout == len(S): \n\n isDream = True #; print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisDream = False\n\ndayDream(0)\n\nif isDream:\n\n print('YES')\n\nelse:\n\n print('NO')\n\n# optimized version of the same code:\n","target":"import sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = eval(input())\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isGoal #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n if isGoal:\n\n return\n\n #print('i, d:', i, d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #;print(d, pout)\n\n if pout == len(S): \n\n isGoal = True #;print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisGoal = False\n\ndayDream(0)\n\nif isGoal:\n\n print('YES')\n\nelse:\n\n print('NO')","code_v0_loc":28,"code_v1_loc":30,"code_v0_num_chars":694,"code_v1_num_chars":735,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1000000)\nS = eval(input())\nT = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nlenT = [len(i) for i in T]\n\n\ndef dayDream(pin):\n global isDream # ;print('dayDream: ', pin, S[pin:])\n for i, d in enumerate(T):\n # print('d:', d)\n if S[pin : pin + lenT[i]] == d:\n pout = pin + lenT[i] # ; print(d, pout)\n if pout == len(S):\n isDream = True # ; print('YES')\n return\n else:\n dayDream(pout)\n # print('dayDream return', pin)\n return\n\n\nisDream = False\ndayDream(0)\nif isDream:\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1000000)\nS = eval(input())\nT = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nlenT = [len(i) for i in T]\n\n\ndef dayDream(pin):\n global isGoal # ;print('dayDream: ', pin, S[pin:])\n for i, d in enumerate(T):\n if isGoal:\n return\n # print('i, d:', i, d)\n if S[pin : pin + lenT[i]] == d:\n pout = pin + lenT[i] # ;print(d, pout)\n if pout == len(S):\n isGoal = True # ;print('YES')\n return\n else:\n dayDream(pout)\n # print('dayDream return', pin)\n return\n\n\nisGoal = False\ndayDream(0)\nif isGoal:\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["- global isDream # ;print('dayDream: ', pin, S[pin:])","+ global isGoal # ;print('dayDream: ', pin, S[pin:])","- # print('d:', d)","+ if isGoal:","+ return","+ # print('i, d:', i, d)","- pout = pin + lenT[i] # ; print(d, pout)","+ pout = pin + lenT[i] # ;print(d, pout)","- isDream = True # ; print('YES')","+ isGoal = True # ;print('YES')","-isDream = False","+isGoal = False","-if isDream:","+if isGoal:"],"diff_only_import_comment":false,"measured_runtime_v0":0.3036904747,"measured_runtime_v1":0.2140211895,"runtime_lift":1.4189738666,"key":["s725954700","s400985362"]} +{"user_id":"u163320134","problem_id":"p03037","language":"python","submission_id_v0":"s012458960","submission_id_v1":"s740832114","cpu_time_v0":351,"cpu_time_v1":278,"memory_v0":6900,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.8,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn,m=list(map(int,input().split()))\n\nc=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n c[l-1]+=1\n\n c[r]-=1\n\nfor i in range(1,n+2):\n\n c[i]=c[i]+c[i-1]\n\nans=0\n\nfor i in range(n+2):\n\n if c[i]==m:\n\n ans+=1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n,m=list(map(int,input().split()))\n\nl,r=list(map(int,input().split()))\n\nfor i in range(m-1):\n\n tl,tr=list(map(int,input().split()))\n\n if l=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]][0]))\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\nedges=[]\n\nrelations={}\n\nnodes=[0,0]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split(\" \")))\n\n edges.append([a,b])\n\n relations.setdefault(a,[]).append(b)\n\n nodes.append(0)\n\n\n\nmax_color=0\n\nfor start in range(1,n+1):\n\n targets=relations.get(start,[])\n\n color=1\n\n for target in targets:\n\n if color == nodes[start]:\n\n color+=1\n\n else:\n\n pass\n\n nodes[target]=color\n\n if color>=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]]))","code_v0_loc":32,"code_v1_loc":27,"code_v0_num_chars":684,"code_v1_num_chars":582,"code_v0_no_empty_lines":"import copy\n\nn = int(eval(input()))\norg_set = set([i for i in range(1, 10**5)])\nedges = []\nrelations = {}\nnodes = []\nfor i in range(n - 1):\n a, b = list(map(int, input().split(\" \")))\n edges.append([a, b])\n relations.setdefault(a, []).append(b)\n nodes.append([])\nnodes.append([])\nnodes.append([])\nmax_color = 0\nfor start in range(1, n + 1):\n targets = relations.get(start, [])\n color = 1\n for target in targets:\n if color in nodes[start]:\n color += 1\n else:\n pass\n nodes[target].append(color)\n if color >= max_color:\n max_color = color\n color += 1\nprint(max_color)\nfor edge in edges:\n print((nodes[edge[1]][0]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nedges = []\nrelations = {}\nnodes = [0, 0]\nfor i in range(n - 1):\n a, b = list(map(int, input().split(\" \")))\n edges.append([a, b])\n relations.setdefault(a, []).append(b)\n nodes.append(0)\nmax_color = 0\nfor start in range(1, n + 1):\n targets = relations.get(start, [])\n color = 1\n for target in targets:\n if color == nodes[start]:\n color += 1\n else:\n pass\n nodes[target] = color\n if color >= max_color:\n max_color = color\n color += 1\nprint(max_color)\nfor edge in edges:\n print((nodes[edge[1]]))\n","code_same":false,"relative_loc_diff_percent":15.625,"diff":["-import copy","-","-org_set = set([i for i in range(1, 10**5)])","-nodes = []","+nodes = [0, 0]","- nodes.append([])","-nodes.append([])","-nodes.append([])","+ nodes.append(0)","- if color in nodes[start]:","+ if color == nodes[start]:","- nodes[target].append(color)","+ nodes[target] = color","- print((nodes[edge[1]][0]))","+ print((nodes[edge[1]]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2673016732,"measured_runtime_v1":0.1941296165,"runtime_lift":1.3769237172,"key":["s596506481","s115492739"]} +{"user_id":"u102461423","problem_id":"p03780","language":"python","submission_id_v0":"s167085688","submission_id_v1":"s483261544","cpu_time_v0":534,"cpu_time_v1":70,"memory_v0":14552,"memory_v1":3572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.89,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\n# x < y\u3067y\u304c\u4e0d\u8981\u3068\u3059\u308b\u3002y\u629c\u304d\u3067[K-y,K)\u3092\u4f5c\u308c\u308b\u3002\n\n# \u3053\u306e\u3068\u304d\u306bx\u3092\u4f7f\u3063\u3066\u3044\u306a\u3044\u306e\u306a\u3089\u3070\u3001x\u3082\u4e0d\u8981\u3002\n\n# x\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u306a\u3089\u3070\u3001xy\u629c\u304d\u3067[K-x-y,K-x)\u3092\u4f5c\u308c\u308b\u3002\n\n# y\u3092\u52a0\u3048\u3066\u3001x\u629c\u304d\u3067[K-x,K)\u3092\u4f5c\u308c\u308b\u3002\n\n# \u3088\u3063\u3066y\u4e0d\u8981\u306a\u3089\u3070x\u4e0d\u8981\u3002\n\nimport numpy as np\n\nimport itertools\n\n\n\nN,K = list(map(int,input().split()))\n\nA = [int(x) for x in input().split()]\n\nA.sort()\n\n\n\n# \u30ab\u30fc\u30c9\u306f[0,N)-indexed\n\n\n\ndef test(i):\n\n # i\u756a\u76ee\u306e\u30ab\u30fc\u30c9\u306f\u4e0d\u8981\n\n dp = np.zeros(K,dtype=np.bool)\n\n dp[0] = True\n\n for a in itertools.chain(A[:i],A[i+1:]):\n\n dp[a:] = np.logical_or(dp[a:],dp[:-a])\n\n return not dp[-A[i]:].any()\n\n\n\nleft = -1 # \u4e0d\u8981\u3060\u3068\u5224\u660e\n\nright = N # \u4e0d\u8981\u3067\u306a\u3044\u3068\u5224\u660e\n\nwhile right - left > 1:\n\n mid = (left+right)\/\/2\n\n if test(mid):\n\n left = mid\n\n else:\n\n right = mid\n\n\n\n \n\nanswer = left+1\n\nprint(answer)\n\n# optimized version of the same code:\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nimport itertools\n\n\n\n\"\"\"\n\n\u30fb\u300c\u5fc5\u8981\u300d\u3068\u306f\uff5e\uff5e\u304c\u5b58\u5728\n\n\u30fbx \u3092\u542b\u307e\u306a\u3044\u3001[K-x,K) \u5185\u306e\u7dcf\u548c\u304c\u5b58\u5728\n\n\u30fb\u96c6\u5408\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u3042\u308b\u5024\u6bb5\u3088\u308a\u4e0a\u5074\n\n\u30fb\u5168\u4f53\u3068\u3057\u3066\u3082\u5358\u8abf\u6027\u304c\u3042\u308b\n\n\"\"\"\n\n\n\nN,K,*A = list(map(int,read().split()))\n\n\n\nA = [x if x <= K else K + 1 for x in A]\n\nA.sort()\n\n\n\nmask = (1 << K) - 1\n\n\n\ndef test(x):\n\n # x\u756a\u76ee\u306f\u5fc5\u8981\n\n if A[x] > K:\n\n return True\n\n dp = 1\n\n for a in itertools.chain(A[:x], A[x+1:]):\n\n dp |= (dp << a)\n\n dp &= mask\n\n dp >>= (K - A[x])\n\n return (dp > 0)\n\n\n\nleft = -1 # \u5fc5\u8981\n\nright = N # \u4e0d\u8981\n\nwhile left + 1 < right:\n\n x = (left + right) \/\/ 2\n\n if test(x):\n\n right = x\n\n else:\n\n left = x\n\n\n\nanswer = left + 1\n\nprint(answer)\n","code_v0_loc":34,"code_v1_loc":43,"code_v0_num_chars":676,"code_v1_num_chars":744,"code_v0_no_empty_lines":"# x < y\u3067y\u304c\u4e0d\u8981\u3068\u3059\u308b\u3002y\u629c\u304d\u3067[K-y,K)\u3092\u4f5c\u308c\u308b\u3002\n# \u3053\u306e\u3068\u304d\u306bx\u3092\u4f7f\u3063\u3066\u3044\u306a\u3044\u306e\u306a\u3089\u3070\u3001x\u3082\u4e0d\u8981\u3002\n# x\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u306a\u3089\u3070\u3001xy\u629c\u304d\u3067[K-x-y,K-x)\u3092\u4f5c\u308c\u308b\u3002\n# y\u3092\u52a0\u3048\u3066\u3001x\u629c\u304d\u3067[K-x,K)\u3092\u4f5c\u308c\u308b\u3002\n# \u3088\u3063\u3066y\u4e0d\u8981\u306a\u3089\u3070x\u4e0d\u8981\u3002\nimport numpy as np\nimport itertools\n\nN, K = list(map(int, input().split()))\nA = [int(x) for x in input().split()]\nA.sort()\n# \u30ab\u30fc\u30c9\u306f[0,N)-indexed\ndef test(i):\n # i\u756a\u76ee\u306e\u30ab\u30fc\u30c9\u306f\u4e0d\u8981\n dp = np.zeros(K, dtype=np.bool)\n dp[0] = True\n for a in itertools.chain(A[:i], A[i + 1 :]):\n dp[a:] = np.logical_or(dp[a:], dp[:-a])\n return not dp[-A[i] :].any()\n\n\nleft = -1 # \u4e0d\u8981\u3060\u3068\u5224\u660e\nright = N # \u4e0d\u8981\u3067\u306a\u3044\u3068\u5224\u660e\nwhile right - left > 1:\n mid = (left + right) \/\/ 2\n if test(mid):\n left = mid\n else:\n right = mid\nanswer = left + 1\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport itertools\n\n\"\"\"\n\u30fb\u300c\u5fc5\u8981\u300d\u3068\u306f\uff5e\uff5e\u304c\u5b58\u5728\n\u30fbx \u3092\u542b\u307e\u306a\u3044\u3001[K-x,K) \u5185\u306e\u7dcf\u548c\u304c\u5b58\u5728\n\u30fb\u96c6\u5408\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u3042\u308b\u5024\u6bb5\u3088\u308a\u4e0a\u5074\n\u30fb\u5168\u4f53\u3068\u3057\u3066\u3082\u5358\u8abf\u6027\u304c\u3042\u308b\n\"\"\"\nN, K, *A = list(map(int, read().split()))\nA = [x if x <= K else K + 1 for x in A]\nA.sort()\nmask = (1 << K) - 1\n\n\ndef test(x):\n # x\u756a\u76ee\u306f\u5fc5\u8981\n if A[x] > K:\n return True\n dp = 1\n for a in itertools.chain(A[:x], A[x + 1 :]):\n dp |= dp << a\n dp &= mask\n dp >>= K - A[x]\n return dp > 0\n\n\nleft = -1 # \u5fc5\u8981\nright = N # \u4e0d\u8981\nwhile left + 1 < right:\n x = (left + right) \/\/ 2\n if test(x):\n right = x\n else:\n left = x\nanswer = left + 1\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":20.9302325581,"diff":["-# x < y\u3067y\u304c\u4e0d\u8981\u3068\u3059\u308b\u3002y\u629c\u304d\u3067[K-y,K)\u3092\u4f5c\u308c\u308b\u3002","-# \u3053\u306e\u3068\u304d\u306bx\u3092\u4f7f\u3063\u3066\u3044\u306a\u3044\u306e\u306a\u3089\u3070\u3001x\u3082\u4e0d\u8981\u3002","-# x\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u306a\u3089\u3070\u3001xy\u629c\u304d\u3067[K-x-y,K-x)\u3092\u4f5c\u308c\u308b\u3002","-# y\u3092\u52a0\u3048\u3066\u3001x\u629c\u304d\u3067[K-x,K)\u3092\u4f5c\u308c\u308b\u3002","-# \u3088\u3063\u3066y\u4e0d\u8981\u306a\u3089\u3070x\u4e0d\u8981\u3002","-import numpy as np","+import sys","+","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","-N, K = list(map(int, input().split()))","-A = [int(x) for x in input().split()]","+\"\"\"","+\u30fb\u300c\u5fc5\u8981\u300d\u3068\u306f\uff5e\uff5e\u304c\u5b58\u5728","+\u30fbx \u3092\u542b\u307e\u306a\u3044\u3001[K-x,K) \u5185\u306e\u7dcf\u548c\u304c\u5b58\u5728","+\u30fb\u96c6\u5408\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u3042\u308b\u5024\u6bb5\u3088\u308a\u4e0a\u5074","+\u30fb\u5168\u4f53\u3068\u3057\u3066\u3082\u5358\u8abf\u6027\u304c\u3042\u308b","+\"\"\"","+N, K, *A = list(map(int, read().split()))","+A = [x if x <= K else K + 1 for x in A]","-# \u30ab\u30fc\u30c9\u306f[0,N)-indexed","-def test(i):","- # i\u756a\u76ee\u306e\u30ab\u30fc\u30c9\u306f\u4e0d\u8981","- dp = np.zeros(K, dtype=np.bool)","- dp[0] = True","- for a in itertools.chain(A[:i], A[i + 1 :]):","- dp[a:] = np.logical_or(dp[a:], dp[:-a])","- return not dp[-A[i] :].any()","+mask = (1 << K) - 1","-left = -1 # \u4e0d\u8981\u3060\u3068\u5224\u660e","-right = N # \u4e0d\u8981\u3067\u306a\u3044\u3068\u5224\u660e","-while right - left > 1:","- mid = (left + right) \/\/ 2","- if test(mid):","- left = mid","+def test(x):","+ # x\u756a\u76ee\u306f\u5fc5\u8981","+ if A[x] > K:","+ return True","+ dp = 1","+ for a in itertools.chain(A[:x], A[x + 1 :]):","+ dp |= dp << a","+ dp &= mask","+ dp >>= K - A[x]","+ return dp > 0","+","+","+left = -1 # \u5fc5\u8981","+right = N # \u4e0d\u8981","+while left + 1 < right:","+ x = (left + right) \/\/ 2","+ if test(x):","+ right = x","- right = mid","+ left = x"],"diff_only_import_comment":false,"measured_runtime_v0":3.0458679354,"measured_runtime_v1":0.4234246819,"runtime_lift":7.1934114036,"key":["s167085688","s483261544"]} +{"user_id":"u046158516","problem_id":"p02691","language":"python","submission_id_v0":"s021965299","submission_id_v1":"s412762136","cpu_time_v0":193,"cpu_time_v1":144,"memory_v0":32248,"memory_v1":111628,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.39,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nn=int(eval(input()))\n\na=list(map(int,input().split()))\n\nk=[]\n\nans=0\n\nfor i in range(400005):\n\n k.append(0)\n\nfor i in range(n):\n\n if i-a[i]>=0:\n\n ans+=k[i-a[i]]\n\n if a[i]+i<400005:\n\n k[a[i]+i]+=1\n\nprint(ans)\n\n# optimized version of the same code:\n","target":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\nthing={}\n\nans=0\n\nfor i in range(n):\n\n if i-a[i] in thing:\n\n ans+=thing[i-a[i]]\n\n if i+a[i] in thing:\n\n thing[i+a[i]]+=1\n\n else:\n\n thing[i+a[i]]=1\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":209,"code_v1_num_chars":219,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nk = []\nans = 0\nfor i in range(400005):\n k.append(0)\nfor i in range(n):\n if i - a[i] >= 0:\n ans += k[i - a[i]]\n if a[i] + i < 400005:\n k[a[i] + i] += 1\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nthing = {}\nans = 0\nfor i in range(n):\n if i - a[i] in thing:\n ans += thing[i - a[i]]\n if i + a[i] in thing:\n thing[i + a[i]] += 1\n else:\n thing[i + a[i]] = 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-k = []","+thing = {}","-for i in range(400005):","- k.append(0)","- if i - a[i] >= 0:","- ans += k[i - a[i]]","- if a[i] + i < 400005:","- k[a[i] + i] += 1","+ if i - a[i] in thing:","+ ans += thing[i - a[i]]","+ if i + a[i] in thing:","+ thing[i + a[i]] += 1","+ else:","+ thing[i + a[i]] = 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.5354380305,"measured_runtime_v1":0.0057934456,"runtime_lift":92.4213443454,"key":["s021965299","s412762136"]} +{"user_id":"u815878613","problem_id":"p03060","language":"python","submission_id_v0":"s435116687","submission_id_v1":"s841872716","cpu_time_v0":291,"cpu_time_v1":25,"memory_v0":21296,"memory_v1":9028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.41,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport numpy as np\n\n\n\nN = eval(input())\n\n\n\nV = input().split()\n\nv = np.array([ int(x) for x in V])\n\n\n\nC = input().split()\n\nc = np.array([ int(x) for x in C])\n\n\n\ndelt = v - c\n\nprint((delt[delt>0].sum()))\n\n# optimized version of the same code:\n","target":"N = int(eval(input()))\n\nV = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor v, c in zip(V, C):\n\n p = v - c\n\n if p > 0:\n\n ans += p\n\n\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":206,"code_v1_num_chars":188,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nN = eval(input())\nV = input().split()\nv = np.array([int(x) for x in V])\nC = input().split()\nc = np.array([int(x) for x in C])\ndelt = v - c\nprint((delt[delt > 0].sum()))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nV = list(map(int, input().split()))\nC = list(map(int, input().split()))\nans = 0\nfor v, c in zip(V, C):\n p = v - c\n if p > 0:\n ans += p\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-import sys","-import numpy as np","-","-N = eval(input())","-V = input().split()","-v = np.array([int(x) for x in V])","-C = input().split()","-c = np.array([int(x) for x in C])","-delt = v - c","-print((delt[delt > 0].sum()))","+N = int(eval(input()))","+V = list(map(int, input().split()))","+C = list(map(int, input().split()))","+ans = 0","+for v, c in zip(V, C):","+ p = v - c","+ if p > 0:","+ ans += p","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.392920809,"measured_runtime_v1":0.2052230692,"runtime_lift":6.7873500501,"key":["s435116687","s841872716"]} +{"user_id":"u389910364","problem_id":"p03007","language":"python","submission_id_v0":"s018798749","submission_id_v1":"s300834964","cpu_time_v0":1421,"cpu_time_v1":375,"memory_v0":124920,"memory_v1":29800,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.61,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport heapq\n\nimport os\n\nimport sys\n\n\n\nif os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"_in.txt\", \"r\")\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = float(\"inf\")\n\n\n\nN = int(sys.stdin.readline())\n\nA = list(map(int, sys.stdin.readline().split()))\n\n\n\n# ans = []\n\n# while len(A) > 2:\n\n# x = max(A)\n\n# y = min(A)\n\n# A = A[1:-1]\n\n# next_max = max(A)\n\n# next_min = min(A)\n\n# if abs(x - y - next_min) < abs(y - x - next_max):\n\n# x, y = y, x\n\n# bisect.insort_left(A, x - y)\n\n# ans.append((x, y))\n\n# x, y = max(A), min(A)\n\n# ans.append((x, y))\n\n# print(x - y)\n\n# for a in ans:\n\n# print(*a)\n\n\n\n\n\nenable = [True] * N\n\nmins = [(a, i) for i, a in enumerate(A)]\n\nmaxes = [(-a, i) for i, a in enumerate(A)]\n\nheapq.heapify(mins)\n\nheapq.heapify(maxes)\n\n\n\nans = []\n\nfor _ in range(N - 2):\n\n x, xi = heapq.heappop(maxes)\n\n x *= -1\n\n y, yi = heapq.heappop(mins)\n\n enable[xi] = False\n\n enable[yi] = False\n\n while not enable[maxes[0][1]]:\n\n heapq.heappop(maxes)\n\n while not enable[mins[0][1]]:\n\n heapq.heappop(mins)\n\n next_max = -maxes[0][0]\n\n next_min = mins[0][0]\n\n if abs(x - y - next_min) < abs(y - x - next_max):\n\n x, y = y, x\n\n enable.append(True)\n\n heapq.heappush(mins, (x - y, len(enable) - 1))\n\n heapq.heappush(maxes, (y - x, len(enable) - 1))\n\n ans.append((x, y))\n\n\n\nx = -maxes[0][0]\n\ny = mins[0][0]\n\nans.append((x, y))\n\nprint((x - y))\n\nfor a in ans:\n\n print((*a))\n\n\n# optimized version of the same code:\n","target":"import bisect\n\nimport os\n\nfrom collections import Counter, deque\n\nfrom fractions import gcd\n\nfrom functools import lru_cache\n\nfrom functools import reduce\n\nimport functools\n\nimport heapq\n\nimport itertools\n\nimport math\n\nimport numpy as np\n\nimport re\n\nimport string\n\nimport sys\n\n\n\nif os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"_in.txt\", \"r\")\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = float(\"inf\")\n\n\n\nN = int(sys.stdin.readline())\n\nA = list(map(int, sys.stdin.readline().split()))\n\n\n\nplus = []\n\nminus = []\n\n\n\nfor a in A:\n\n if a >= 0:\n\n plus.append(a)\n\n else:\n\n minus.append(a)\n\nif not plus:\n\n mm = max(minus)\n\n plus.append(mm)\n\n minus.remove(mm)\n\nif not minus:\n\n mp = min(plus)\n\n minus.append(mp)\n\n plus.remove(mp)\n\n\n\nhist = []\n\nx = minus.pop()\n\nwhile len(plus) > 1:\n\n y = plus.pop()\n\n hist.append((x, y))\n\n x = x - y\n\nminus.append(x)\n\n\n\nx = plus.pop()\n\nwhile len(minus) > 1:\n\n y = minus.pop()\n\n hist.append((x, y))\n\n x = x - y\n\ny = minus.pop()\n\nhist.append((x, y))\n\n\n\nprint((x - y))\n\nfor h in hist:\n\n print((*h))\n","code_v0_loc":63,"code_v1_loc":60,"code_v0_num_chars":1453,"code_v1_num_chars":1068,"code_v0_no_empty_lines":"import heapq\nimport os\nimport sys\n\nif os.getenv(\"LOCAL\"):\n sys.stdin = open(\"_in.txt\", \"r\")\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nN = int(sys.stdin.readline())\nA = list(map(int, sys.stdin.readline().split()))\n# ans = []\n# while len(A) > 2:\n# x = max(A)\n# y = min(A)\n# A = A[1:-1]\n# next_max = max(A)\n# next_min = min(A)\n# if abs(x - y - next_min) < abs(y - x - next_max):\n# x, y = y, x\n# bisect.insort_left(A, x - y)\n# ans.append((x, y))\n# x, y = max(A), min(A)\n# ans.append((x, y))\n# print(x - y)\n# for a in ans:\n# print(*a)\nenable = [True] * N\nmins = [(a, i) for i, a in enumerate(A)]\nmaxes = [(-a, i) for i, a in enumerate(A)]\nheapq.heapify(mins)\nheapq.heapify(maxes)\nans = []\nfor _ in range(N - 2):\n x, xi = heapq.heappop(maxes)\n x *= -1\n y, yi = heapq.heappop(mins)\n enable[xi] = False\n enable[yi] = False\n while not enable[maxes[0][1]]:\n heapq.heappop(maxes)\n while not enable[mins[0][1]]:\n heapq.heappop(mins)\n next_max = -maxes[0][0]\n next_min = mins[0][0]\n if abs(x - y - next_min) < abs(y - x - next_max):\n x, y = y, x\n enable.append(True)\n heapq.heappush(mins, (x - y, len(enable) - 1))\n heapq.heappush(maxes, (y - x, len(enable) - 1))\n ans.append((x, y))\nx = -maxes[0][0]\ny = mins[0][0]\nans.append((x, y))\nprint((x - y))\nfor a in ans:\n print((*a))\n","code_v1_no_empty_lines":"import bisect\nimport os\nfrom collections import Counter, deque\nfrom fractions import gcd\nfrom functools import lru_cache\nfrom functools import reduce\nimport functools\nimport heapq\nimport itertools\nimport math\nimport numpy as np\nimport re\nimport string\nimport sys\n\nif os.getenv(\"LOCAL\"):\n sys.stdin = open(\"_in.txt\", \"r\")\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nN = int(sys.stdin.readline())\nA = list(map(int, sys.stdin.readline().split()))\nplus = []\nminus = []\nfor a in A:\n if a >= 0:\n plus.append(a)\n else:\n minus.append(a)\nif not plus:\n mm = max(minus)\n plus.append(mm)\n minus.remove(mm)\nif not minus:\n mp = min(plus)\n minus.append(mp)\n plus.remove(mp)\nhist = []\nx = minus.pop()\nwhile len(plus) > 1:\n y = plus.pop()\n hist.append((x, y))\n x = x - y\nminus.append(x)\nx = plus.pop()\nwhile len(minus) > 1:\n y = minus.pop()\n hist.append((x, y))\n x = x - y\ny = minus.pop()\nhist.append((x, y))\nprint((x - y))\nfor h in hist:\n print((*h))\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["+import bisect","+import os","+from collections import Counter, deque","+from fractions import gcd","+from functools import lru_cache","+from functools import reduce","+import functools","-import os","+import itertools","+import math","+import numpy as np","+import re","+import string","-# ans = []","-# while len(A) > 2:","-# x = max(A)","-# y = min(A)","-# A = A[1:-1]","-# next_max = max(A)","-# next_min = min(A)","-# if abs(x - y - next_min) < abs(y - x - next_max):","-# x, y = y, x","-# bisect.insort_left(A, x - y)","-# ans.append((x, y))","-# x, y = max(A), min(A)","-# ans.append((x, y))","-# print(x - y)","-# for a in ans:","-# print(*a)","-enable = [True] * N","-mins = [(a, i) for i, a in enumerate(A)]","-maxes = [(-a, i) for i, a in enumerate(A)]","-heapq.heapify(mins)","-heapq.heapify(maxes)","-ans = []","-for _ in range(N - 2):","- x, xi = heapq.heappop(maxes)","- x *= -1","- y, yi = heapq.heappop(mins)","- enable[xi] = False","- enable[yi] = False","- while not enable[maxes[0][1]]:","- heapq.heappop(maxes)","- while not enable[mins[0][1]]:","- heapq.heappop(mins)","- next_max = -maxes[0][0]","- next_min = mins[0][0]","- if abs(x - y - next_min) < abs(y - x - next_max):","- x, y = y, x","- enable.append(True)","- heapq.heappush(mins, (x - y, len(enable) - 1))","- heapq.heappush(maxes, (y - x, len(enable) - 1))","- ans.append((x, y))","-x = -maxes[0][0]","-y = mins[0][0]","-ans.append((x, y))","+plus = []","+minus = []","+for a in A:","+ if a >= 0:","+ plus.append(a)","+ else:","+ minus.append(a)","+if not plus:","+ mm = max(minus)","+ plus.append(mm)","+ minus.remove(mm)","+if not minus:","+ mp = min(plus)","+ minus.append(mp)","+ plus.remove(mp)","+hist = []","+x = minus.pop()","+while len(plus) > 1:","+ y = plus.pop()","+ hist.append((x, y))","+ x = x - y","+minus.append(x)","+x = plus.pop()","+while len(minus) > 1:","+ y = minus.pop()","+ hist.append((x, y))","+ x = x - y","+y = minus.pop()","+hist.append((x, y))","-for a in ans:","- print((*a))","+for h in hist:","+ print((*h))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3442365975,"measured_runtime_v1":0.2437948611,"runtime_lift":1.4119928366,"key":["s018798749","s300834964"]} +{"user_id":"u634079249","problem_id":"p02881","language":"python","submission_id_v0":"s671057519","submission_id_v1":"s116621872","cpu_time_v0":992,"cpu_time_v1":126,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.3,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport sys\n\nimport os\n\nimport math\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n ret = float('inf')\n\n I = int(math.sqrt(N)) * 10\n\n for i in range(1, I):\n\n if N%i == 0:\n\n j = N\/\/i\n\n ret = min(ret, j + i - 2)\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n# optimized version of the same code:\n","target":"import sys\n\nimport os\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n m = int(N ** .5)\n\n while N % m != 0:\n\n m -= 1\n\n else:\n\n print((int(N \/ m + m - 2)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":29,"code_v1_loc":25,"code_v0_num_chars":717,"code_v1_num_chars":627,"code_v0_no_empty_lines":"import sys\nimport os\nimport math\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = ii()\n ret = float(\"inf\")\n I = int(math.sqrt(N)) * 10\n for i in range(1, I):\n if N % i == 0:\n j = N \/\/ i\n ret = min(ret, j + i - 2)\n print(ret)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport os\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = ii()\n m = int(N**0.5)\n while N % m != 0:\n m -= 1\n else:\n print((int(N \/ m + m - 2)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":13.7931034483,"diff":["-import math","- ret = float(\"inf\")","- I = int(math.sqrt(N)) * 10","- for i in range(1, I):","- if N % i == 0:","- j = N \/\/ i","- ret = min(ret, j + i - 2)","- print(ret)","+ m = int(N**0.5)","+ while N % m != 0:","+ m -= 1","+ else:","+ print((int(N \/ m + m - 2)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3067429993,"measured_runtime_v1":0.2119246759,"runtime_lift":1.4474152099,"key":["s671057519","s116621872"]} +{"user_id":"u057993957","problem_id":"p03774","language":"python","submission_id_v0":"s163475264","submission_id_v1":"s392014232","cpu_time_v0":151,"cpu_time_v1":19,"memory_v0":12408,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.42,"input":"\n# slower version:\n\ns = input()\nfor i in range(len(s)):\n if i%2 == 0:\n print(s[i], end = '')\n\n\n# optimized version of the same code:\n\ns = input()\nans = ''\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n\n\n\n# slower version:\n\nimport numpy as np\n\nn, m = list(map(int, input().split()))\n\nab = [list(map(int, input().split())) for i in range(n)]\n\ncd = [list(map(int, input().split())) for i in range(m)]\n\n\n\ndist = np.zeros((n, m))\n\nfor i in range(n):\n\n for j in range(m):\n\n dist[i, j] = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n\n\n\nfor dis in dist:\n\n print((dis.argmin()+1))\n\n# optimized version of the same code:\n","target":"n, m = list(map(int, input().split()))\n\nab = [list(map(int, input().split())) for i in range(n)]\n\ncd = [list(map(int, input().split())) for i in range(m)]\n\n\n\nfor i in range(n):\n\n a, b = ab[i]\n\n \n\n dist = 1e+15\n\n ans = 0\n\n for j in range(m):\n\n c, d = cd[j] \n\n\n\n if dist > abs(a - c) + abs(b - d):\n\n ans = j\n\n dist = abs(a - c) + abs(b - d)\n\n \n\n print((ans+1))\n\n \n\n \n\n ","code_v0_loc":12,"code_v1_loc":20,"code_v0_num_chars":358,"code_v1_num_chars":400,"code_v0_no_empty_lines":"import numpy as np\n\nn, m = list(map(int, input().split()))\nab = [list(map(int, input().split())) for i in range(n)]\ncd = [list(map(int, input().split())) for i in range(m)]\ndist = np.zeros((n, m))\nfor i in range(n):\n for j in range(m):\n dist[i, j] = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\nfor dis in dist:\n print((dis.argmin() + 1))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nab = [list(map(int, input().split())) for i in range(n)]\ncd = [list(map(int, input().split())) for i in range(m)]\nfor i in range(n):\n a, b = ab[i]\n dist = 1e15\n ans = 0\n for j in range(m):\n c, d = cd[j]\n if dist > abs(a - c) + abs(b - d):\n ans = j\n dist = abs(a - c) + abs(b - d)\n print((ans + 1))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-import numpy as np","-","-dist = np.zeros((n, m))","+ a, b = ab[i]","+ dist = 1e15","+ ans = 0","- dist[i, j] = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])","-for dis in dist:","- print((dis.argmin() + 1))","+ c, d = cd[j]","+ if dist > abs(a - c) + abs(b - d):","+ ans = j","+ dist = abs(a - c) + abs(b - d)","+ print((ans + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":2.3915602806,"measured_runtime_v1":0.408453959,"runtime_lift":5.8551526503,"key":["s163475264","s392014232"]} diff --git a/python_splits/command.txt b/python_splits/command.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7e7ffa5560e4673360a8735b3881e16658268b4 --- /dev/null +++ b/python_splits/command.txt @@ -0,0 +1 @@ +python src/make_splits.py --data_file_path data/improvement_pairs_additional_metadata.csv --submission_id_to_runtime_map data/runtime_eval/submission_id_to_avg_time_filled_na.json --f_max_rel_loc_diff 80 --f_min_our_runtime_lift 0.0 --f_min_time_impro_perc 7.5 \ No newline at end of file diff --git a/python_splits/test_input_verified_baseline.jsonl b/python_splits/test_input_verified_baseline.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..915d8cc785e5e2573b91b7fa2bbfcdcff45d5c01 --- /dev/null +++ b/python_splits/test_input_verified_baseline.jsonl @@ -0,0 +1,567 @@ +{"problem_id": "p03371", "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 5000 * 2 * 10 ** 5\n\nfor i in range(10 ** 5 + 1):\n\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n\n ans = min(ans, s)\n\n\n\nprint(ans)"} +{"problem_id": "p02612", "input": "import sys\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(read())\n\nx = N + (-N) % 1000\n\nprint((x - N))"} +{"problem_id": "p03078", "input": "# -*- coding: utf-8 -*-\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nabc = []\n\n\n\nfor i, _a in enumerate(a):\n\n for j, _b in enumerate(b):\n\n if (i+1) * (j+1) > k:\n\n break\n\n for l, _c in enumerate(c):\n\n if (i+1) * (j+1) * (l+1) > k:\n\n break\n\n abc.append(_a + _b + _c)\n\n\n\nabc.sort(reverse=True)\n\nfor x in abc[:k]:\n\n print(x)\n"} +{"problem_id": "p03559", "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nans = 0\n\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n\n i = bisect_left(A, b)\n\n j = bisect(C, b)\n\n ans += i * (N-j)\n\nprint(ans)"} +{"problem_id": "p03674", "input": "n = int(input())\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp //= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp //= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n]*invf[i-1]*invf[n-i+1]%mod\n\n if i <= n-1:\n\n S += fact[n-1]*invf[i]*invf[n-1-i]%mod\n\n S %= mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n if i <= n:\n\n S += fact[n-1]*invf[i-1]*invf[n-i]%mod\n\n S %= mod\n\n print(S)"} +{"problem_id": "p02952", "input": "n = int(input())\n\n\n\n\n\ndef countKeta(num):\n\n count = 1\n\n while num / 10 >= 1:\n\n count += 1\n\n num = num // 10\n\n return count\n\n\n\n\n\ncount = 0\n\n\n\nfor i in range(1, n+1):\n\n if(countKeta(i) % 2 == 1):\n\n count += 1\n\n\n\nprint(count)"} +{"problem_id": "p02996", "input": "\n\n\n\nn = int(input())\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\nabn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))"} +{"problem_id": "p00053", "input": "def isPrime(x):\n\n if x == 2:\n\n return True\n\n if x < 2 or x % 2 == 0:\n\n return False\n\n i, root_x = 3, int(pow(x, 0.5))\n\n while i <= root_x:\n\n if x % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nprimes = [2]\n\nfor i in range(3, 104730):\n\n if isPrime(i):\n\n primes.append(primes[-1]+i)\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n print((primes[n-1]))"} +{"problem_id": "p03835", "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if x >= 0 and x <= K:\n\n ans += 1\n\nprint(ans)"} +{"problem_id": "p02996", "input": "n=int(input())\n\ntask=[] \n\nfor _ in range(n):\n\n a,b=list(map(int,input().split()))\n\n task.append((b, -a))\n\n\n\ntask.sort()\n\n\n\ntime=0\n\nflag=True\n\nfor i in task:\n\n time-=i[1]\n\n if time>i[0]:\n\n flag=False\n\n break\n\n\n\nif flag:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n\n"} +{"problem_id": "p03038", "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heapify,heappop,heappush\n\nfrom bisect import bisect_left,bisect_right\n\nimport sys,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn,m = inpl()\n\na = inpl()\n\nb = [0] * m\n\nfor i in range(m):\n\n x,y = inpl()\n\n b[i] = [x,y]\n\na.sort()\n\nb.sort(key=lambda x:x[1], reverse = True)\n\nres = sum(a)\n\ni = 0\n\nj = 0\n\nwhile True:\n\n # print(i,j)\n\n if a[i] < b[j][1]:\n\n res += b[j][1] - a[i]\n\n i += 1\n\n else:\n\n break\n\n b[j][0] -= 1\n\n if b[j][0] == 0:\n\n j += 1\n\n if i >= n or j >= m:\n\n break\n\nprint(res)\n"} +{"problem_id": "p02891", "input": "s = input()\n\nk = int(input())\n\n\n\nif len(set(s)) == 1:\n\n print(((len(s)*k)//2))\n\n exit()\n\n\n\nss = s + s\n\n\n\nshoko = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(s)):\n\n if s[i] == prev:\n\n cnt += 1\n\n else:\n\n shoko += cnt // 2\n\n cnt = 1\n\n prev = s[i]\n\nshoko += cnt // 2\n\n\n\nkosa = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(ss)):\n\n if ss[i] == prev:\n\n cnt += 1\n\n else:\n\n kosa += cnt // 2\n\n cnt = 1\n\n prev = ss[i]\n\nkosa += cnt // 2\n\nkosa -= shoko\n\n\n\nprint((shoko + (k-1)*kosa))"} +{"problem_id": "p03081", "input": "n,q=list(map(int,input().split()));s=\"_\"+input()+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:L=h==\"L\";R=h==\"R\";l,r=[l,l-1,l+1][(m==s[l]and R)-(m==s[l+1]and L)],[r,r-1,r+1][(m==s[r-1]and R)-(m==s[r]and L)]\n\nprint((max(0,r-l-1)))"} +{"problem_id": "p03796", "input": "import math\n\n\n\nn = int(input())\n\nprint((math.factorial(n) % (10 ** 9 + 7)))"} +{"problem_id": "p03035", "input": "a,b=list(map(int,input().split()))\n\nprint((b if 13<=a else b//2 if 6<=a else 0))"} +{"problem_id": "p02688", "input": "N,K=list(map(int,input().split()))\n\n\n\ncon = 0\n\nans = list(int() for _ in range(100000))\n\npre = 0\n\n\n\n\n\nfor _ in range(K):\n\n\n\n D = int(input())\n\n arr = list(map(int,input().split()))\n\n\n\n for j in range(D):\n\n\n\n ans[pre+j]=arr[j]\n\n\n\n pre += D\n\n\n\n \n\nfin = (N+1) - len(set(ans))\n\n\n\nprint(fin)"} +{"problem_id": "p03162", "input": "def main():\n\n n = int(input())\n\n a = [0]\n\n b = [0]\n\n c = [0]\n\n\n\n for i in range(n):\n\n aa,bb,cc = list(map(int,input().split()))\n\n a.append(max(b[i] + aa, c[i] + aa))\n\n b.append(max(a[i] + bb, c[i] + bb))\n\n c.append(max(a[i] + cc, b[i] + cc))\n\n\n\n print((max(a[-1], b[-1], c[-1])))\n\n\n\nmain()"} +{"problem_id": "p02414", "input": "import sys\n\ne=[list(map(int,e.split()))for e in sys.stdin]\n\nn=e[0][0]+1\n\nfor c in e[1:n]:\n\n t=''\n\n for l in zip(*e[n:]):t+=f'{sum(s*t for s,t in zip(c,l))} '\n\n print((t[:-1]))\n"} +{"problem_id": "p02814", "input": "from functools import reduce\n\nfrom math import gcd\n\n\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\ndef sub_by_2(n):\n\n cnt = 0\n\n while n % 2 == 0:\n\n n //= 2\n\n cnt += 1\n\n return cnt\n\n\n\nlcm_2 = [sub_by_2(n // 2) for n in A]\n\nif all(lcm_2[0] == v for v in lcm_2):\n\n num = reduce(lcm, [v // 2 for v in A])\n\n res = M // num\n\n print((res // 2 + res % 2))\n\nelse:\n\n print((0))\n"} +{"problem_id": "p02552", "input": "x = int(input())\n\nif x == 0:\n\n print((1))\n\nelse:\n\n print((0))"} +{"problem_id": "p02959", "input": "from sys import stdin,stdout\n\n\n\nif __name__==\"__main__\":\n\n n=int(stdin.readline())\n\n\n\n a=[int(x) for x in stdin.readline().split()]\n\n b=[int(x) for x in stdin.readline().split()]\n\n\n\n cnt=0\n\n\n\n for i in range(n):\n\n if(a[i]>=b[i]):\n\n cnt+=b[i]\n\n else:\n\n cnt+=a[i]\n\n d=b[i]-a[i]\n\n cnt+=min(a[i+1],d)\n\n if(d>a[i+1]):\n\n a[i+1]=0\n\n else: a[i+1]-=d\n\n \n\n stdout.write(str(cnt)+\"\\n\")\n"} +{"problem_id": "p03608", "input": "def main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = float(\"Inf\")\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03416", "input": "counter = 0\n\nc = list(map(int, input().split(' ')))\n\nfor i in range(c[0], c[1] + 1):\n\n if str(i)[0] != str(i)[4]:\n\n continue\n\n if str(i)[1] != str(i)[3]:\n\n continue\n\n counter += 1\n\n\n\nprint(counter)"} +{"problem_id": "p03038", "input": "I=lambda:list(map(int,input().split()))\n\nn,m=I()\n\na=I()\n\na.sort(reverse=True)\n\nqq=[I() for i in range(m)]\n\nqq.sort(key=lambda x:x[1],reverse=True)\n\nans=0\n\nfor x,y in qq:\n\n for j in range(x):\n\n if not a:\n\n break\n\n aa=a.pop()\n\n ans+=max(aa,y)\n\nans+=sum(a)\n\nprint(ans)\n\n "} +{"problem_id": "p03723", "input": "a,b,c=list(map(int,input().split()))\n\ne=(a-b)|(b-c)\n\nprint((bool(e|(a|b|c)%2)*(e^~-e).bit_length()-1))"} +{"problem_id": "p03037", "input": "N, M =list(map(int, input().split()))\n\nL = [0 for i in range(N+1)]\n\nR = [0 for i in range(N+1)]\n\nfor i in range(M):\n\n l,r = list(map(int, input().split()))\n\n L[l] += 1\n\n R[r] += 1\n\ncnt = 0\n\ntmp = 0\n\nfor i in range(N+1):\n\n tmp += L[i]\n\n if tmp == M:\n\n cnt += 1\n\n tmp -= R[i]\n\nprint(cnt)\n"} +{"problem_id": "p03558", "input": "from collections import deque\n\nK = int(input())\n\nG = [[] for i in range(K)]\n\n\n\nfor n in range(K):\n\n G[n].append([(n + 1) % K, 1])\n\n G[n].append([(10 * n) % K, 0])\n\n\n\nque = deque([[1, 1]])\n\ndist = [float('inf')] * K\n\n\n\nwhile que:\n\n node, cost = que.pop()\n\n dist[node] = min(cost, dist[node])\n\n for e, e_cost in G[node]:\n\n if dist[e] != float('inf'):\n\n continue\n\n\n\n if e_cost == 0:\n\n que.append([e, cost + 0])\n\n\n\n if e_cost == 1:\n\n que.appendleft([e, cost + 1])\n\n\n\nprint((dist[0]))\n"} +{"problem_id": "p03307", "input": "import math\n\n\n\n\n\ndef lcm(x, y):\n\n return (x * y) // math.gcd(x, y)\n\n\n\n\n\nN = int(input())\n\nprint((lcm(N, 2)))"} +{"problem_id": "p02555", "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n for i in range(x-2):\n\n ret += rec(i)\n\n ret %= mod\n\n return ret\n\n\n\nprint((rec(S)))\n"} +{"problem_id": "p03037", "input": "import sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nlr = list(zip(*[iter(lr)] * 2))\n\n\n\ndef main():\n\n cnt = [0] * (n + 1)\n\n for l, r in lr:\n\n cnt[l-1] += 1\n\n cnt[r] -= 1\n\n \n\n for i in range(n):\n\n cnt[i+1] += cnt[i]\n\n \n\n res = 0\n\n for i in range(n):\n\n res += (cnt[i] == m) & 1\n\n \n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)"} +{"problem_id": "p01438", "input": "from collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n D = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n for s in range(s-6,e-6):\n\n t |= 1 << s\n\n D[man] = t\n\n\n\n dp = [defaultdict(int) for i in range(n)]\n\n dp[0][D[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp[i-1].keys()):\n\n if bit&D[i] == 0:\n\n dp[i][bit|D[i]] = max(dp[i][bit|D[i]], dp[i-1][bit]+L[i])\n\n dp[i][bit] = max(dp[i][bit],dp[i-1][bit])\n\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n\n \n\n ans = max(max(dp[i].values()) for i in range(n))\n\n print(ans)"} +{"problem_id": "p03208", "input": "N, K = list(map(int, input().split()))\n\n\n\nheight = []\n\nfor _ in range(N) :\n\n height.append(int(input()))\n\n\n\nheight.sort()\n\nans = float('inf')\n\n\n\nfor i in range(N-K+1) :\n\n diff = height[i + K - 1] - height[i]\n\n ans = min(ans, diff)\n\n\n\nprint(ans)"} +{"problem_id": "p03032", "input": "from collections import deque\n\n\n\nn, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor t in range(k//2 + 1):\n\n hand = deque(V[:k-t])\n\n rest = deque(V[k-t:])\n\n cur_sum = sum(hand)\n\n\n\n for j in range(k-t+1):\n\n put_back = 0\n\n rev_hand = sorted(hand)\n\n\n\n for i in range(t):\n\n jewel = rev_hand[i]\n\n if jewel < 0:\n\n put_back -= jewel\n\n else:\n\n break\n\n\n\n candidate = cur_sum + put_back\n\n ans = max(candidate, ans)\n\n\n\n to_rest = hand.pop()\n\n rest.appendleft(to_rest)\n\n to_hand = rest.pop()\n\n hand.appendleft(to_hand)\n\n\n\n cur_sum += to_hand - to_rest\n\n\n\nprint(ans)"} +{"problem_id": "p02863", "input": "n,t=list(map(int,input().split()))\n\nab=[list(map(int,input().split()))for _ in range(n)]\n\nab.sort()\n\ndp=[(6007)*[0]for _ in range(n+1)]\n\ndp[0][0]=0\n\nans=0\n\nfor i in range(n):\n\n for j in range(6007):\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\n if j>= 1\n\n return r\n\n\n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\n\n\nm = 0\n\nl = (1 << n) - 1\n\nfor x in range(1, l + 1):\n\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n\n m = max(m, popcount(x))\n\nprint(m)\n"} +{"problem_id": "p03039", "input": "n, m, k = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\nMAX = n * m\n\n\n\n\n\nclass ModInt:\n\n def __init__(self, num):\n\n self.num = num\n\n\n\n def __str__(self):\n\n return str(self.num)\n\n\n\n def __repr__(self):\n\n return \"ModInt(num: {}, mod: {}\".format(self.num, mod)\n\n\n\n def __add__(self, other):\n\n ret = self.num + other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __sub__(self, other):\n\n ret = self.num - other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __mul__(self, other):\n\n ret = self.num * other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def pow(self, times):\n\n pw = pow(self.num, times, mod)\n\n return ModInt(pw)\n\n\n\n def inverse(self):\n\n return ModInt(inv[self.num])\n\n\n\n def __truediv__(self, other):\n\n num = self * other.inverse()\n\n return ModInt(num)\n\n\n\n\n\ndef comb(n, k):\n\n return fact[n] * inv[n-k] * inv[k]\n\n\n\n\n\nfact = [None] * (MAX + 1)\n\nfact[0] = ModInt(1)\n\nfor i in range(1, MAX + 1):\n\n fact[i] = fact[i-1] * ModInt(i)\n\n\n\ninv = [None] * (MAX + 1)\n\ninv[MAX] = fact[MAX].pow(mod - 2)\n\nfor i in range(MAX, 0, -1):\n\n inv[i-1] = inv[i] * ModInt(i)\n\n\n\nans = ModInt(0)\n\nfor i in range(n):\n\n for j in range(m):\n\n add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)\n\n if i != 0 and j != 0:\n\n add *= ModInt(2)\n\n\n\n ans += add\n\n\n\nans *= comb(n * m - 2, k - 2)\n\nprint(ans)\n"} +{"problem_id": "p03241", "input": "N,M = list(map(int,input().split()))\n\nif N==1:\n\n nmax=M\n\nelse:\n\n nmax = 1\n\n for i in range(2,int(M**0.5)+1):\n\n if M%i==0 and M//i>=N:\n\n nmax = max(nmax,i)\n\n if M%i==0 and i>=N:\n\n nmax = max(nmax,M//i)\n\nprint(nmax)"} +{"problem_id": "p02596", "input": "import sys\n\n\n\nreadline = sys.stdin.readline\n\nreadall = sys.stdin.read\n\nns = lambda: readline().rstrip()\n\nni = lambda: int(readline().rstrip())\n\nnm = lambda: map(int, readline().split())\n\nnl = lambda: list(map(int, readline().split()))\n\nprn = lambda x: print(*x, sep='\\n')\n\n\n\ndef solve():\n\n d = dict()\n\n k = ni()\n\n c = 7 % k\n\n x = d[c] = 1\n\n while True:\n\n c = (c * 10 + 7) % k\n\n if c in d:\n\n break\n\n x += 1\n\n d[c] = x\n\n print(d.get(0, -1))\n\n return\n\n\n\nsolve()\n"} +{"problem_id": "p02959", "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nN = int(input())\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\nbefore = sum(A)\n\n\n\nfor i in range(N):\n\n nokori = B[i]\n\n for j in range(i,i+2):\n\n if nokori >= A[j]:\n\n nokori -= A[j]\n\n A[j] = 0\n\n else:\n\n A[j] -= nokori\n\n nokori = 0\n\nafter = sum(A)\n\n\n\nprint((before - after))"} +{"problem_id": "p03457", "input": "N = int(input())\n\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\n\nfor i in range(N):\n\n t1, x1, y1 = txy[i]\n\n t2, x2, y2 = txy[i+1]\n\n if abs(x2-x1) + abs(y2-y1) <= t2 - t1 and (x1+y1+x2+y2) % 2 == (t2-t1) % 2:\n\n continue\n\n else:\n\n print('No')\n\n exit()\n\nprint('Yes')"} +{"problem_id": "p02834", "input": "n,u,v=list(map(int,input().split()))\n\nanss=0\n\nu-=1\n\nv-=1\n\nd=[[]for _ in range(n)]\n\ninf=float('inf')\n\naoki=[inf]*n\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n d[a].append(b)\n\n d[b].append(a)\n\nQ=d[v]\n\naoki[v]=0\n\ndis=1\n\nvisited={v}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n aoki[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[u]\n\nchokudai=[-1]*n\n\nchokudai[u]=0\n\ndis=1\n\nvisited={u}\n\npoint=-1\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if aoki[j]<=dis+1:\n\n if aoki[j]==dis+1:anss=1\n\n if point<0:point=i\n\n continue\n\n if j not in visited:P.append(j)\n\n chokudai[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[point]\n\ndis=chokudai[point]+1\n\nvisited={point}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n if chokudai[i]==-1:continue\n\n chokudai[i]=max(dis,chokudai[i])\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n dis+=1\n\n Q=P\n\nans=0\n\nfor i in range(n):\n\n if aoki[i]>chokudai[i]:ans=max(ans,chokudai[i])\n\nprint((ans+anss))\n\n#print(aoki)\n\n#print(chokudai)"} +{"problem_id": "p02537", "input": "d=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()+d))\n\nfor i in range(n):d[i]=max(d[j]for j in range(i-99,i+1)if abs(a[i]-a[j])<=k)+1\n\nprint((max(d)))"} +{"problem_id": "p02873", "input": "S = input()\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in range(len(lst)):\n\n if lst[i] > 0:\n\n ans += list(range(1,lst[i]+1))\n\n else:\n\n ans[-1] = max(ans[-1], -lst[i])\n\n ans += list(range(-lst[i]-1,-1, -1))\n\n\n\nprint((sum(ans)))\n"} +{"problem_id": "p03253", "input": "from math import floor, sqrt\n\nfrom collections import defaultdict\n\ndef factors(n):\n\n d = defaultdict(int)\n\n for i in range(2,floor(sqrt(n))+1):\n\n while n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n if n == 1:\n\n break\n\n if n != 1:\n\n d[n] += 1\n\n return d\n\ndef inv(x, mod):\n\n k = mod - 2\n\n ret = 1\n\n while k > 0:\n\n if k&1:\n\n ret = (ret*x) % mod\n\n x = (x*x) % mod\n\n k >>= 1\n\n return ret\n\nN, M = list(map(int,input().split()))\n\nmod = 10**9+7\n\ndic = factors(M)\n\nK = len(dic)\n\nSIZE = N+max(dic.values()) if list(dic.values()) else N\n\nfact = [None]*(SIZE+1)\n\nfinv = [None]*(SIZE+1)\n\nfact[0] = 1\n\nfor i in range(1,SIZE+1):\n\n fact[i] = (fact[i-1]*i) % mod\n\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\n\nfor i in range(SIZE, 0, -1):\n\n finv[i-1] = (finv[i]*i) % mod\n\ndef comb(n,k):\n\n tmp = (finv[k]*finv[n-k]) % mod\n\n return (fact[n]*tmp) % mod\n\nans = 1\n\nfor p in dic:\n\n ans = (ans*comb(dic[p]+N-1, dic[p])) % mod\n\nprint(ans)"} +{"problem_id": "p03416", "input": "a , b = input().split()\n\na = int(a)\n\nb = int(b)\n\ncount=0\n\nfor i in range(a,b+1):\n\n test = list(str(i))\n\n if (test[0] == test[4]) and (test[1]==test[3]):\n\n count=count+1\n\nprint(count)"} +{"problem_id": "p03835", "input": "K,S=list(map(int,input().split()))\n\nO=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n O+=1\n\nprint(O)\n"} +{"problem_id": "p04020", "input": "import sys\n\nstdin = sys.stdin\n\n \n\nsys.setrecursionlimit(10**8) \n\n \n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x)-1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\n\n\nn = ni()\n\na = [ni() for _ in range(n)]\n\n\n\ncnt = {i+1: ai for i, ai in enumerate(a)}\n\n\n\nprev = -100\n\ncur = 0\n\nans = 0\n\nfor key in sorted(cnt.keys()):\n\n if cnt[key] == 0:\n\n continue\n\n \n\n if prev == -100:\n\n prev = key\n\n \n\n if (key-prev) < 2:\n\n cur += cnt[key]\n\n else:\n\n cur = cnt[key]\n\n \n\n ans += cur // 2\n\n cur -= 2 * (cur//2)\n\n \n\n prev = key\n\n \n\nprint(ans)"} +{"problem_id": "p03164", "input": "def main():\n\n N, W = list(map(int, input().split()))\n\n w = [0] * N\n\n v = [0] * N\n\n for i in range(N):\n\n w[i], v[i] = list(map(int, input().split()))\n\n\n\n max_v = max(v)\n\n dp = [[float('inf')] * (max_v * N + 5) for _ in range(N + 5)]\n\n\n\n dp[0][0] = 0\n\n\n\n for i in range(N):\n\n for j in range(max_v * N):\n\n if j + v[i] <= max_v * N:\n\n dp[i+1][j + v[i]] = min(dp[i+1][j + v[i]], dp[i][j] + w[i])\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j]) \n\n\n\n ans = 0\n\n for j in range(max_v * N + 1):\n\n if dp[N][j] <= W:\n\n ans = j\n\n\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()"} +{"problem_id": "p03309", "input": "n = int(input())\n\na = list(map(int,input().split()))\n\naa = []\n\nfor i in range(n):\n\n aa.append(a[i]-(i+1))\n\nb = (sorted(aa)[n//2])\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans += abs(a[i]-(b+i+1))\n\nprint(ans)"} +{"problem_id": "p02794", "input": "N = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(input())\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\nD = {1<>= 17\n\n bc += BC[aa % (1<<17)]\n\n aa >>= 17\n\n bc += BC[aa]\n\n CC[N - 1 - bc] += (1 if BC[m%1024] + BC[m>>10] & 1 == 0 else -1)\n\n\n\nprint((sum([2 ** i * CC[i] for i in range(N)])))"} +{"problem_id": "p03078", "input": "\n\nfrom heapq import heappop, heappush\n\n\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\npq = []\n\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\n\nappeared = set((0, 0, 0))\n\n\n\nfor _ in range(K):\n\n # Pop maximum value\n\n val, i, j, k = heappop(pq)\n\n print((-val))\n\n\n\n # Add next value\n\n if i + 1 < X and (i + 1, j, k) not in appeared:\n\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n\n appeared.add((i + 1, j, k))\n\n\n\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n\n appeared.add((i, j + 1, k))\n\n\n\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n\n appeared.add((i, j, k + 1))\n"} +{"problem_id": "p02773", "input": "import collections\n\nn = int(input())\n\na=[input() for _ in range(n)]\n\nanslist=[]\n\nb=collections.Counter(a)\n\nc=max(list(b.values()))\n\nfor i in b:\n\n if b[i]==c:\n\n anslist.append(i)\n\nd=sorted(anslist)\n\nfor i in tuple(d):\n\n print(i)"} +{"problem_id": "p03371", "input": "a,b,c,x,y = list(map(int,input().split()))\n\nxy = max(x,y)*2+1\n\nprint((min([c*i + max(0,a*(x-i//2)) +max(0,b*(y-i//2)) for i in range(0,xy,2)])))"} +{"problem_id": "p02412", "input": "while True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == sum([s, m, e]):\n\n count += 1\n\n\n\n print(count)"} +{"problem_id": "p02837", "input": "n = int(input())\n\nv = [[tuple(map(int, input().split()))for i in range(int(input()))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [False] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = True\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n if f[x - 1] is not bool(y):\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n"} +{"problem_id": "p03000", "input": "N,X = list(map(int,input().split()))\n\nL = [0] + [int(x) for x in input().split()]\n\n\n\nD = [0] * (N+2)\n\nanswer = 1\n\nfor n in range(2,N+2):\n\n D[n] = D[n-1] + L[n-1]\n\n if D[n] <= X:\n\n answer += 1\n\n \n\nprint(answer)"} +{"problem_id": "p02983", "input": "mod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r//mod - l//mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l+1, r+1):\n\n for j in range(l, i):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)"} +{"problem_id": "p03425", "input": "#!/usr/bin/env python3\n\n\n\nn = int(input())\n\ns = [input() for _ in range(n)]\n\n\n\nc = [0 for _ in range(5)]\n\nt = 'MARCH'\n\n\n\nfor i in range(n):\n\n for j in range(5):\n\n if s[i][0] == t[j]:\n\n c[j] += 1\n\nans = 0 \n\nfor i in range(5):\n\n for j in range(i+1, 5): \n\n for k in range(j+1, 5): \n\n ans += c[i]*c[k]*c[j]\n\nprint(ans)\n"} +{"problem_id": "p00053", "input": "prim=[True]*1000000\n\nprim[0],prim[1]=False,False\n\nfor i in range(2,1000):\n\n if prim[i]:\n\n for j in range(i*2,1000000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(input())\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))"} +{"problem_id": "p03037", "input": "n, m = list(map(int, input().split()))\n\ngate = []\n\nl, r = list(map(int, input().split()))\n\nfor i in range(1, m):\n\n m, s = list(map(int, input().split()))\n\n if l < m:\n\n l = m\n\n if s < r:\n\n r = s\n\nprint((len([i for i in range(l, r + 1)])))"} +{"problem_id": "p02596", "input": "K=int(input())\n\n\n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n \n\nans=[0]*(pow(10,6)+1)\n\nans[0]=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n ans[i]=(ans[i-1]*10+7)%K\n\n if ans[i]==0:\n\n print(i)\n\n exit(0)\n\n\n\nprint((-1))"} +{"problem_id": "p02537", "input": "def segfunc(x, y): return max(x, y)\n\n\n\nclass SegmentTree:\n\n def __init__(self, arr):\n\n size = len(arr)\n\n n = 2 ** (size - 1).bit_length()\n\n self.n = n\n\n self.node = [0] * (2*n)\n\n for i in range(size):\n\n self.node[i+n-1] = arr[i]\n\n for i in reversed(list(range(n-2))):\n\n self.node[i] = segfunc(self.node[2*i+1], self.node[2*i+2])\n\n\n\n def update(self, i, x):\n\n i += self.n - 1\n\n self.node[i] = x\n\n while i > 0:\n\n i = (i - 1) // 2\n\n self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])\n\n\n\n def update(self, x, val):\n\n x += (self.n - 1)\n\n self.node[x] = val\n\n while x > 0:\n\n x = (x - 1) // 2\n\n self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])\n\n\n\n def query(self, a, b):\n\n res = 0\n\n l = self.n - 1 + a\n\n r = self.n - 1 + (b - 1)\n\n\n\n while l <= r:\n\n if l == r:\n\n res = segfunc(res, self.node[l])\n\n break\n\n\n\n if l % 2 == 0:\n\n res = segfunc(res, self.node[l])\n\n if r % 2 == 1:\n\n res = segfunc(res, self.node[r])\n\n l = l // 2\n\n r = r // 2 - 1\n\n\n\n return res\n\n\n\nN, K = list(map(int, input().split()))\n\nINF = 0\n\nseg = SegmentTree([0] * 300000)\n\nfor i in range(N):\n\n a = int(input())\n\n tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1\n\n seg.update(a, tmp)\n\nprint((seg.query(0, 300000)))\n"} +{"problem_id": "p03037", "input": "N,M = list(map(int, input().split()))\n\nL = []\n\nR = []\n\nfor _ in range(M):\n\n l,r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n\n\nans = min(R)-max(L)+1\n\nif ans < 0:\n\n print((0))\n\nelse:\n\n print(ans)\n\n "} +{"problem_id": "p03325", "input": "N = int(input())\n\n\n\nseq = list(map(int, input().split()))\n\n\n\ncnt = 0\n\n\n\nfor num in seq:\n\n while num % 2 == 0:\n\n cnt += 1\n\n num /= 2\n\n\n\nprint(cnt)\n"} +{"problem_id": "p03371", "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(input())\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = INF\n\n for k in range(100001):\n\n yen = 2 * c * k + max(0, x-k) * a + max(0, y-k) * b\n\n ans = min(ans, yen)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n"} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))"} +{"problem_id": "p03845", "input": "n,t=int(input()),list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n"} +{"problem_id": "p03363", "input": "n = int(input())\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum={}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n if str(i) in list(num.keys()):\n\n num[str(i)] += 1\n\n else:\n\n num[str(i)] = 1\n\nout = [i*(i-1)//2 for i in list(num.values()) if i>1]\n\nprint((sum(out)))"} +{"problem_id": "p02555", "input": "def resolve():\n\n base = 10**9+7\n\n S = int(input())\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(1, S+1):\n\n for u in range(i-2):\n\n dp[i] += dp[u]\n\n dp[i] %= base\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n"} +{"problem_id": "p02792", "input": "N = int(input())\n\n\n\ntable = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n id1 = int(s[0])\n\n id2 = int(s[-1])\n\n table[id1][id2] += 1\n\n\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += table[i][j]*table[j][i]\n\n\n\nprint(ans)"} +{"problem_id": "p03796", "input": "n = int(input())\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (pow(10,9) + 7)\n\nprint(res)"} +{"problem_id": "p03371", "input": "#!/usr/bin/env python3\n\nimport sys, math, math, itertools\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n mn = 1e9\n\n for i in range(0, 2*(max(X, Y)+1), 2):\n\n mn = min(mn, C*i+A*max(X-i//2, 0)+B*max(Y-i//2, 0))\n\n print((int(mn)))\n\n return\n\n\n\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03038", "input": "import sys\n\nfrom operator import itemgetter\n\n\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, sys.stdin.readline().split()))\n\nbc = [ tuple(map(int, x.split())) for x in sys.stdin.readlines()]\n\nbc.sort(key = itemgetter(1), reverse=True)\n\nbc.append((n,0))\n\ndiff = []\n\nfor b, c in bc:\n\n diff += [c] * b\n\n if len(diff) > n:\n\n break\n\n\n\na += diff\n\na.sort()\n\nprint((sum(a[-n:])))\n"} +{"problem_id": "p02917", "input": "N = int(input())\n\nB =list(map(int,input().split()))\n\nA=[0]*N\n\n\n\nA[0]=B[0]\n\nfor i in range(1,N-1):\n\n A[i]=min(B[i],B[i-1])\n\nA[-1]=B[-1]\n\nprint((sum(A)))"} +{"problem_id": "p02700", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nA, B, C, D = list(map(int, input().split()))\n\n\n\nwhile True:\n\n C -= B\n\n \n\n if C<=0:\n\n print('Yes')\n\n exit()\n\n \n\n A -= D\n\n \n\n if A<=0:\n\n print('No')\n\n exit()"} +{"problem_id": "p03575", "input": "icase=0\n\nif icase==0:\n\n n,m=list(map(int, input().split()))\n\n a=[]\n\n b=[]\n\n for i in range(m):\n\n ai,bi=list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\nelif icase==1:\n\n n=6\n\n m=5\n\n# a=[[1],[2],[3],[4],[5]]\n\n# b=[[2],[3],[4],[5],[6]]\n\n a=[1,2,3,4,5]\n\n b=[2,3,4,5,6]\n\nelif icase==2:\n\n n=7\n\n m=7\n\n a=[1,2,3,4,4,5,6]\n\n b=[3,7,4,5,6,6,7]\n\n\n\n \n\nvtx=[]\n\nfor i in range(n):\n\n vtx.append([i+1])\n\nicnt=0\n\n\n\nfor j in range(m): \n\n vtx1=vtx.copy()\n\n a1=a.copy()\n\n b1=b.copy()\n\n del a1[j]\n\n del b1[j]\n\n \n\n for i in range(m-1):\n\n for v1 in vtx1:\n\n if a1[i] in v1:\n\n if not b1[i] in v1:\n\n for v2 in vtx1:\n\n if v1!=v2:\n\n if b1[i] in v2:\n\n break\n\n vtx1.remove(v1)\n\n vtx1.remove(v2)\n\n v3=v1+v2\n\n vtx1.append(v3)\n\n# print(a[i],b[i],len(vtx1),vtx1)\n\n# print(len(vtx1),vtx1)\n\n if len(vtx1)!=1:\n\n icnt=icnt+1\n\nprint(icnt) "} +{"problem_id": "p02814", "input": "#!/usr/bin/env python3\n\nimport sys\n\nfrom math import gcd\n\nimport math\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n tmp = 1\n\n count = None\n\n for i in range(N):\n\n tmp = (tmp * a[i]//2) // gcd(tmp,a[i]//2)\n\n c = 0\n\n n = a[i]//2\n\n while n % 2 == 0:\n\n c += 1\n\n n //= 2\n\n if i == 0:\n\n count = c\n\n elif count != c:\n\n print((0))\n\n exit()\n\n print(((M//tmp +1)//2))\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p02394", "input": "a=input().split()\n\nb=list(map(int,a))\n\nW=b[0]\n\nH=b[1]\n\nx=b[2]\n\ny=b[3]\n\nr=b[4]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')"} +{"problem_id": "p02394", "input": "ia = [int(i) for i in input().split(\" \")]\n\nW=ia[0]\n\nH=ia[1]\n\nx=ia[2]\n\ny=ia[3]\n\nr=ia[4]\n\nprint((\"Yes\" if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H else \"No\"))"} +{"problem_id": "p03457", "input": "N=input()\n\na=[]\n\nt=True\n\nfor _ in range(int(N)):\n\n a+=[list(map(int,input().split()))]\n\nfor i in range(int(N)):\n\n if a[i][0]%2==0:\n\n if abs(a[i][1]+a[i][2])<=a[i][0] and (a[i][1]+a[i][2])%2==0:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\n else:\n\n if abs(a[i][1]+a[i][2]<=a[i][0]) and (a[i][1]+a[i][2])%2==1:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\nif t:\n\n print('Yes')"} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nyenmin=a*x+b*y\n\nfor zz in range(2*10**5+1):\n\n xx=max(x-zz//2,0)\n\n yy=max(y-zz//2,0)\n\n yen=a*xx+b*yy+c*zz\n\n if yen d[v]+cost:\n\n d[to] = d[v]+cost\n\n par[to] = v\n\n que.put((d[to],to))\n\n\n\n for j in range(n):\n\n if i != j:\n\n a,b = j,par[j]\n\n if a>b:\n\n a,b = b,a\n\n used.add((a,b))\n\n\n\n print((m - len(used)))\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03416", "input": "a,b = list(map(int,input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n s = str(i)\n\n l = len(s)\n\n if all(s[j] == s[l-j-1] for j in range(l)):\n\n count += 1\n\nprint(count)"} +{"problem_id": "p02921", "input": "import itertools\n\nimport math\n\ndef main():\n\n s = input()\n\n t = input()\n\n cnt = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n cnt += 1\n\n print(cnt)\n\nif __name__ == '__main__':\n\n main()"} +{"problem_id": "p03579", "input": "import sys\n\nsys.setrecursionlimit(100000)\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(v, c):\n\n # c: color = 1 or -1\n\n node[v] = c\n\n for i in graph[v]:\n\n if node[i] == c:\n\n return False\n\n \n\n if node[i] == 0 and not dfs(i, -c):\n\n return False\n\n \n\n return True\n\n\n\nnode = [0] * N\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in node) // 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) // 2 - M))\n"} +{"problem_id": "p02248", "input": "def kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return nx\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = input()\n\nP = input()\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n"} +{"problem_id": "p03457", "input": "def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time, px, py = 0, 0, 0\n\n for t, x, y in TXY:\n\n move = abs(x-px) + abs(y-py)\n\n # print(move, t-time)\n\n if (t - time) % 2 != move % 2 or t - time < move:\n\n return print(\"No\")\n\n time, px, py = t, x, y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03553", "input": "import math,string,itertools,math,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf = 10**20\n\neps = 1.0 / 10**15\n\nmod = 10**9+7\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef F(): return float(sys.stdin.readline())\n\ndef S(): return input()\n\ndef pf(s): return print(s, flush=True)\n\ndef divisions(n):\n\n sq = int(math.sqrt(n)+1)\n\n d = collections.defaultdict(int)\n\n while n % 2 == 0:\n\n n //= 2\n\n d[2] += 1\n\n i = 3\n\n while n > 1 and sq >= i:\n\n if n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n else:\n\n i += 2\n\n\n\n if n > 1:\n\n d[n] += 1\n\n\n\n r = [1]\n\n for k, v in d.items():\n\n for c in r[:]:\n\n for i in range(1,v+1):\n\n r.append(c*(k**i))\n\n\n\n return sorted(r)\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n s = set()\n\n for i in range(n,0,-1):\n\n d = divisions(i)\n\n ld = len(d)\n\n for j in range(1,2**ld):\n\n c = []\n\n ff = True\n\n for k in range(ld):\n\n if j & (1< (N ** 0.5):\n\n break\n\n if N % i == 0:\n\n p = i\n\n j = N // i\n\n m = i + j - 2\n\n if m < ans:\n\n ans = m\n\n else:\n\n continue\n\n else:\n\n continue\n\nprint(ans)\n"} +{"problem_id": "p03078", "input": "import sys\n\nimport heapq\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n Q = []\n\n S = set()\n\n heapq.heapify(Q)\n\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n\n for i in range(K):\n\n m, a, b, c = heapq.heappop(Q)\n\n print((-m))\n\n if (a + 1, b, c) not in S and a + 1 < X:\n\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n\n S.add((a + 1, b, c))\n\n if (a, b + 1, c) not in S and b + 1 < Y:\n\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n\n S.add((a, b + 1, c))\n\n if (a, b, c + 1) not in S and c + 1 < Z:\n\n heapq.heappush(Q, (-A[a ] - B[b] - C[c+1], a, b, c + 1))\n\n S.add((a, b, c + 1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n"} +{"problem_id": "p03494", "input": "def two_count(x):\n\n\tif int(str(x)[-1]) % 2 == 0:\n\n\t\treturn 1 + two_count(x//2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(input())\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))"} +{"problem_id": "p02386", "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if(g[k:k+4]==e[1:5])*(f[0]==e[0])*(f[5]==e[5]):return 'No'\n\n return 'Yes'\n\nprint((f()))\n"} +{"problem_id": "p02814", "input": "from math import gcd\n\nn, m = list(map(int, input().split()))\n\na = [int(i) // 2 for i in input().split()]\n\nx = 1\n\nfor i in range(n):\n\n x *= a[i] // gcd(x, a[i])\n\nfor i in a:\n\n if x // i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((m // x + 1) // 2))"} +{"problem_id": "p03038", "input": "import sys\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nn,m=list(map(int,input().split()))\n\na0=list(map(int,input().split()))\n\ndata=[list(map(int,input().split())) for i in range(m)]\n\nfor i in a0:\n\n\tdata.append([1,i])\n\ndata.sort(key=lambda tup:-tup[1])\n\nans=0\n\nfor num,val in data:\n\n\tif n>=num:\n\n\t\tn-=num\n\n\t\tans+=val*num\n\n\telse:\n\n\t\tans+=val*n\n\n\t\tbreak\n\nprint(ans)\n"} +{"problem_id": "p03200", "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(input())\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tA = []\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': A.append(bcnt)\n\n\t\n\n\tprint((sum(A)))\n\n\n\nif __name__ == '__main__':\n\n\tmain()"} +{"problem_id": "p03416", "input": "a,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(a, b + 1):\n\n f = True\n\n s = str(i)\n\n l = len(s)\n\n for j in range(l//2 + 1):\n\n if s[j] != s[- j - 1]:\n\n f = False\n\n break\n\n if f:\n\n n += 1\n\nprint(n)"} +{"problem_id": "p03752", "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for bit in range(1 << N):\n\n if (not (bit & 1)) or bin(bit).count('1') != K:\n\n continue\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if bit & (1 << i):\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p02952", "input": "import math\n\nn = int(input())\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if math.floor(math.log10(i) + 1) % 2:\n\n cnt += 1\n\nprint(cnt)"} +{"problem_id": "p02773", "input": "from collections import defaultdict\n\nn = int(input())\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = input()\n\n d[key] += 1\n\n\n\ndict = sorted(list(d.items()), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nfor s in dict_li:\n\n print(s)\n"} +{"problem_id": "p03721", "input": "n,k = list(map(int,input().split()))\n\nl = [0]*(10**5+1)\n\nfor i in range(n):\n\n ai,bi = list(map(int,input().split()))\n\n l[ai]+=bi\n\nfor index,i in enumerate(l):\n\n if i:\n\n k-=i\n\n if k<=0:\n\n break\n\nprint(index)"} +{"problem_id": "p03416", "input": "A, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = list(str(i))\n\n\n\n if l == list(reversed(l)):\n\n cnt += 1\n\n\n\nprint(cnt)\n"} +{"problem_id": "p03363", "input": "n = int(input())\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nfrom math import factorial\n\ndef combinations_count(n, r):\n\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += combinations_count(j,2)\n\n\n\nprint(ans)"} +{"problem_id": "p02792", "input": "N = int(input())\n\nmem = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)"} +{"problem_id": "p03796", "input": "N = int(input())\n\np = 1\n\nfor i in range(N):\n\n p *= (i + 1)\n\n p %= (1e9 + 7)\n\nprint((int(p)))"} +{"problem_id": "p02725", "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\ndiff = []\n\n\n\nfor i in range(n - 1):\n\n diff.append(a[i + 1] - a[i])\n\ndiff.append(k - a[-1] + a[0])\n\n\n\nprint((k - max(diff)))\n"} +{"problem_id": "p03253", "input": "class Calc:\n\n def __init__(self, max_value, mod):\n\n \"\"\"combination(max_value, all)\"\"\"\n\n fact = [-1] * (max_value + 1)\n\n fact[0] = 1\n\n fact[1] = 1\n\n for x in range(2, max_value + 1):\n\n fact[x] = x * fact[x - 1] % mod\n\n\n\n invs = [1] * (max_value + 1)\n\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n\n for x in range(max_value - 1, 0, -1):\n\n invs[x] = invs[x + 1] * (x + 1) % mod\n\n\n\n self.fact = fact\n\n self.invs = invs\n\n self.mod = mod\n\n\n\n def combination(self, n, r):\n\n if n - r < r:\n\n return self.combination(n, n - r)\n\n if r < 0:\n\n return 0\n\n if r == 0:\n\n return 1\n\n if r == 1:\n\n return n\n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\n\n\n\ndef gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n ma = d * d\n\n while ma <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n ma += d * 4 + 4\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n cal = Calc(max_value=N + 30, mod=MOD)\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p02983", "input": "def c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))"} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nval = float('inf')\n\nfor k in range(10 ** 5 + 1):\n\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\n\nprint(val)"} +{"problem_id": "p03796", "input": "from math import factorial as f\n\nn = int(input())\n\nprint((f(n) % (10 ** 9 + 7)))"} +{"problem_id": "p03039", "input": "n,m,k=list(map(int,input().split()))\n\nmod=10**9+7\n\nf=[1]\n\nfor i in range(2*10**5+7):f+=[f[-1]*(i+1)%mod]\n\ndef comb(a,b):return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod\n\nans=0\n\nfor i in range(1,n):\n\n ans+=(i*(n-i)*m**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nfor i in range(1,m):\n\n ans+=(i*(m-i)*n**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nprint(ans)"} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))"} +{"problem_id": "p03371", "input": "A, B, C, X, Y = [int(_) for _ in input().split()]\n\nans = A * X + B * Y\n\nfor i in range(max(X, Y) + 1):\n\n cost = 2 * C * i\n\n if X > i:\n\n cost += A * (X - i)\n\n if Y > i:\n\n cost += B * (Y - i)\n\n ans = min(ans, cost)\n\nprint(ans)"} +{"problem_id": "p03945", "input": "s = input()\n\nlen_s = len(s)\n\ncnt = [0, 0]\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n memo_1 = s[len_s - i]\n\n if s[i] != memo_0:\n\n cnt[0] += 1\n\n if s[len_s - i - 1] != memo_1:\n\n cnt[1] += 1\n\nprint((min(cnt)))\n"} +{"problem_id": "p03558", "input": "import heapq\n\nK=int(input())\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=[]\n\nheapq.heappush(q,(0,1))\n\nwhile (len(q)!=0):\n\n prc,src=heapq.heappop(q)\n\n if dist[src]dist[src]+1:\n\n dist[(src+1)%K]=dist[src]+1\n\n heapq.heappush(q,(dist[(src+1)%K],(src+1)%K))\n\n if dist[(10*src)%K]>dist[src]:\n\n dist[(10*src)%K]=dist[src]\n\n heapq.heappush(q,(dist[(src*10)%K],(src*10)%K))\n\nprint((dist[0]))\n"} +{"problem_id": "p02792", "input": "n = int(input())\n\n\n\ncnt = 0\n\nfor i in range(1, n+1):\n\n i_str = str(i)\n\n if len(i_str) == 1:\n\n cnt += 1\n\n continue\n\n if len(i_str) == 2:\n\n if int(i_str[0]) == int(i_str[1]):\n\n cnt += 3\n\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 3:\n\n if int(i_str[0]) == int(i_str[2]):\n\n cnt += 4 + (2 * (int(i_str[1])+1) - 1)\n\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n\n cnt += 22\n\n elif int(i_str[0]) < int(i_str[2]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 4:\n\n if int(i_str[0]) == int(i_str[3]):\n\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2])+1) - 1\n\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n\n cnt += 222\n\n elif int(i_str[0]) < int(i_str[3]):\n\n cnt += 22\n\n continue\n\n if len(i_str) == 5:\n\n if int(i_str[0]) == int(i_str[4]):\n\n cnt += 224 + 200 * int(i_str[1]) + 20 * int(i_str[2]) + 2 * (int(i_str[3])+1) - 1\n\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n\n cnt += 2222\n\n elif int(i_str[0]) < int(i_str[4]):\n\n cnt += 222\n\n continue\n\n if len(i_str) == 6:\n\n if int(i_str[0]) == int(i_str[5]):\n\n cnt += 2224 + 2000 * int(i_str[1]) + 200 * int(i_str[2]) + 20 * int(i_str[3]) + 2 * (int(i_str[4])+1) - 1\n\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n\n cnt += 22222\n\n elif int(i_str[0]) < int(i_str[5]):\n\n cnt += 2222\n\n continue\n\n\n\nprint(cnt)"} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\nans = math.factorial(N) % (10**9 + 7)\n\nprint(ans)"} +{"problem_id": "p03038", "input": "from heapq import heappop, heappush\n\n\n\nn, m = list(map(int, input().split()))\n\na = tuple(map(int, input().split()))\n\n\n\nhq = []\n\nfor aa in a:\n\n heappush(hq, (-aa, 1))\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(hq, (-c, b))\n\n\n\nrest = n\n\nans = 0\n\nwhile rest > 0:\n\n num, cnt = heappop(hq)\n\n\n\n num *= (-1)\n\n use = min(rest, cnt)\n\n ans += use * num\n\n rest -= use\n\n\n\nprint(ans)\n"} +{"problem_id": "p03371", "input": "A,B,C,X,Y = list(map(int,input().split()))\n\nl = []\n\nfor i in range(max(X,Y)+1):\n\n T = i * C * 2\n\n if i < X: \n\n T += (X-i)*A\n\n if i < Y:\n\n T += (Y-i)*B\n\n l.append(T)\n\nl.sort()\n\nprint((l[0]))"} +{"problem_id": "p04012", "input": "import collections\n\nimport sys\n\na=input()\n\nb=[]\n\n\n\nfor i in a:\n\n b.append(i)\n\n \n\nb.sort()\n\nc=collections.Counter(b)\n\nc=list(c.values())\n\n\n\nfor i in range(len(c)):\n\n if int(c[i])%2==0:\n\n q=0\n\n else:\n\n q=1\n\n print('No')\n\n sys.exit()\n\n \n\nprint('Yes')\n"} +{"problem_id": "p03835", "input": "#ABC951B/Sum_of_Three_Integers\n\n\n\nK, S = list(map(int, input().split()))\n\nans = 0\n\nfor x in range(0, K+1):\n\n for y in range(0, K+1):\n\n z = S - x - y\n\n if 0 <= z and z <= K:\n\n ans += 1\n\nprint(ans)"} +{"problem_id": "p02276", "input": "n=int(input())-1\n\nA=list(map(int,input().split()))\n\ni=0\n\nfor j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\nA[i],A[n]=A[n],A[i]\n\nprint((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n"} +{"problem_id": "p02792", "input": "N = int(input())\n\nmem = [[0]*10 for _ in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)\n"} +{"problem_id": "p04012", "input": "w = input()\n\nfor l in w:\n\n\tif w.count(l) % 2 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")"} +{"problem_id": "p03416", "input": "a, b = list(map(int, input().split()))\n\ntmp=str(a)\n\nc=0\n\nfor i in range(a,b+1):\n\n tmp=str(i)\n\n tmp2=\"\"\n\n for s in range(len(tmp)):\n\n tmp2=tmp2+tmp[len(tmp)-1-s]\n\n if tmp==tmp2:\n\n c=c+1\n\nprint(c)"} +{"problem_id": "p03835", "input": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n z=s-i-j\n\n if 0<=z<=k:\n\n ans+=1\n\nprint(ans)\n"} +{"problem_id": "p03078", "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return map(int, input().split())\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nAB = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tAB.append(A[i]+B[j])\n\n\n\nAB.sort(reverse = True)\n\nAB = AB[:3000]\n\nABC = sorted([C[0]+AB[i] for i in range(min(3000, X*Y))], reverse = True)\n\n\n\nfor j in range(1, Z):\n\n\tABC_tmp = sorted([C[j]+AB[i] for i in range(min(3000, X*Y))])\n\n\tABC += ABC_tmp\n\n\tABC.sort(reverse = True)\n\n\tABC = ABC[:3000]\n\n\n\nprint(*ABC[:K], sep= \"\\n\")\n\n\n"} +{"problem_id": "p00744", "input": "import collections\n\nimport math\n\n\n\n\n\nclass Dinic:\n\n \"\"\"Dinic Algorithm: find max-flow\n\n complexity: O(EV^2)\n\n used in GRL6A(AOJ)\n\n \"\"\"\n\n class edge:\n\n def __init__(self, to, cap, rev):\n\n self.to, self.cap, self.rev = to, cap, rev\n\n\n\n def __init__(self, V, E, source, sink):\n\n \"\"\" V: the number of vertexes\n\n E: adjacency list\n\n source: start point\n\n sink: goal point\n\n \"\"\"\n\n self.V = V\n\n self.E = [[] for _ in range(V)]\n\n for fr in range(V):\n\n for to, cap in E[fr]:\n\n self.E[fr].append(self.edge(to, cap, len(self.E[to])))\n\n self.E[to].append(self.edge(fr, 0, len(self.E[fr])-1))\n\n self.maxflow = self.dinic(source, sink)\n\n\n\n def dinic(self, source, sink):\n\n \"\"\"find max-flow\"\"\"\n\n INF = float('inf')\n\n maxflow = 0\n\n while True:\n\n self.bfs(source)\n\n if self.level[sink] < 0:\n\n return maxflow\n\n self.itr = [0] * self.V\n\n while True:\n\n flow = self.dfs(source, sink, INF)\n\n if flow > 0:\n\n maxflow += flow\n\n else:\n\n break\n\n\n\n def dfs(self, vertex, sink, flow):\n\n \"\"\"find augmenting path\"\"\"\n\n if vertex == sink:\n\n return flow\n\n for i in range(self.itr[vertex], len(self.E[vertex])):\n\n self.itr[vertex] = i\n\n e = self.E[vertex][i]\n\n if e.cap > 0 and self.level[vertex] < self.level[e.to]:\n\n d = self.dfs(e.to, sink, min(flow, e.cap))\n\n if d > 0:\n\n e.cap -= d\n\n self.E[e.to][e.rev].cap += d\n\n return d\n\n return 0\n\n\n\n def bfs(self, start):\n\n \"\"\"find shortest path from start\"\"\"\n\n que = collections.deque()\n\n self.level = [-1] * self.V\n\n que.append(start)\n\n self.level[start] = 0\n\n\n\n while que:\n\n fr = que.popleft()\n\n for e in self.E[fr]:\n\n if e.cap > 0 and self.level[e.to] < 0:\n\n self.level[e.to] = self.level[fr] + 1\n\n que.append(e.to)\n\n\n\nwhile True:\n\n M, N = list(map(int, input().split()))\n\n if M == 0 and N == 0:\n\n break\n\n blue, red = [], []\n\n while True:\n\n for x in input().split():\n\n blue.append(int(x))\n\n if len(blue) == M:\n\n break\n\n while True:\n\n for x in input().split():\n\n red.append(int(x))\n\n if len(red) == N:\n\n break\n\n V = M + N + 2\n\n edge = [set() for _ in range(V)]\n\n for i, b in enumerate(blue):\n\n if b != 1:\n\n for j, r in enumerate(red):\n\n if r % b == 0:\n\n edge[i].add((M+j, 1))\n\n for j in range(2, int(math.sqrt(b)) + 1):\n\n if b % j == 0:\n\n for k, r in enumerate(red):\n\n if r % j == 0 or r % (b // j) == 0:\n\n edge[i].add((M+k, 1))\n\n for i in range(M):\n\n edge[M+N].add((i, 1))\n\n for j in range(N):\n\n edge[M+j].add((M+N+1, 1))\n\n d = Dinic(V, edge, M+N, M+N+1)\n\n print((d.maxflow))"} +{"problem_id": "p00174", "input": "while True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n a = b = 0\n\n for i, s in enumerate(line):\n\n if i != 0:\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break"} +{"problem_id": "p03559", "input": "from bisect import *\n\nn = int(input())\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na = sorted(a)\n\nc = sorted(c)\n\n\n\nrec = 0\n\nfor i in range(n):\n\n temp = b[i]\n\n l = bisect_left(a, temp)\n\n r = bisect_right(c, temp)\n\n rec += l * (n - r)\n\nprint(rec)"} +{"problem_id": "p03592", "input": "N,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n t = i*M + j*N - i*j*2\n\n if t==K:\n\n print('Yes')\n\n exit()\n\nprint('No')"} +{"problem_id": "p00542", "input": "a,b,c,d,e,f=[int(input()) for _ in range(6)]\n\nprint((sum([a,b,c,d,max(e,f)])-min([a,b,c,d])))"} +{"problem_id": "p03371", "input": "# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z / 2), 0)\n\n y = max(Y - int(z / 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n"} +{"problem_id": "p02773", "input": "from collections import defaultdict\n\nN = int(input())\n\nd = defaultdict(int)\n\n\n\nfor i in range(N):\n\n S = input()\n\n d[S] += 1\n\n\n\nm = 0\n\nfor k in list(d.keys()):\n\n m = max(d[k],m)\n\n\n\nli = []\n\nfor k in list(d.keys()):\n\n if d[k] == m:\n\n li.append(k)\n\n\n\nli.sort()\n\nfor l in li:\n\n print(l)"} +{"problem_id": "p03037", "input": "N,M = list(map(int,input().split()))\n\nL,R = [],[]\n\nfor i in range(M):\n\n l,r = list(map(int,input().split()))\n\n L.append(l)\n\n R.append(r)\n\nans = min(R)-max(L)+1\n\nprint((ans if ans >= 0 else 0))"} +{"problem_id": "p02881", "input": "n = int(input())\n\nl = []\n\nfor i in range(1,1000001):\n\n a = n / i\n\n if a.is_integer():\n\n l.append(i+n/i)\n\nprint((int(min(l)-2)))"} +{"problem_id": "p02881", "input": "n = int(input())\n\nimport math\n\nm = int(math.sqrt(n))+1\n\nanss = []\n\nfor x in range(1, m+1):\n\n y = n//x\n\n z = n%x\n\n if z == 0:\n\n anss.append(abs(x-1)+abs(y-1))\n\nprint((min(anss)))\n"} +{"problem_id": "p03455", "input": "a, b = list(map(int, input().split()))\n\nif a*b%2 == 1:\n\n print(\"Odd\")\n\nelse:\n\n print(\"Even\")"} +{"problem_id": "p02555", "input": "n = int(input())\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n for j in range(i - 2):\n\n ans[i] += ans[j]\n\n ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n"} +{"problem_id": "p04021", "input": "import sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(input())\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n if (L[i][1]-i)%2:\n\n count += 1\n\nans = (count+1) // 2\n\nprint(ans)"} +{"problem_id": "p02378", "input": "# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if unvisited[v] and (r_capacity > 0):\n\n parent[v].append(u)\n\n queue.append(v)\n\n unvisited[v] = False\n\n return unvisited[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while not bfs(source, sink, parent):\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))"} +{"problem_id": "p02837", "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom math import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\nfrom decimal import Decimal\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\nfrom decimal import *\n\n\n\nN = INT()\n\nxy = []\n\n\n\nfor i in range(N):\n\n\tA = INT()\n\n\txy.append([LIST() for _ in range(A)])\n\n\n\nans = 0\n\nfor i in range(1<= K - 1:\n\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\n\n \n\nprint(ans)\n"} +{"problem_id": "p02767", "input": "n=int(input())\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\nfor p in range(x[0],x[len(x)-1]+1):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\n pmin=psum \n\n for j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) "} +{"problem_id": "p03086", "input": "import re\n\n\n\nS = input()\n\nmax = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i + 1, len(S) + 1) :\n\n pattern = re.compile(r'[A|T|C|G]{%d}' % int(j - i))\n\n subStr = S[i:j]\n\n\n\n if pattern.match(subStr) and j - i > max :\n\n max = j - i\n\n\n\nprint(max)\n"} +{"problem_id": "p02792", "input": "import itertools\n\nN = int(input())\n\nNketa = len(str(N))\n\n\n\nrange_count = [[0 for j in range(10)]for i in range(10)]\n\n\n\n\n\nfor p in range(1,N+1):\n\n mae = int(str(p)[0])\n\n ato = int(str(p)[-1])\n\n range_count[mae][ato] += 1\n\n\n\n \n\n\n\ncount = 0\n\nfor j in range(1,N+1):\n\n a_mae = int(str(j)[0])\n\n a_ato = int(str(j)[-1])\n\n \n\n b_mae = a_ato\n\n b_ato = a_mae\n\n \n\n if b_mae == 0:\n\n continue\n\n else:\n\n count += range_count[b_mae][b_ato]\n\nprint(count)\n\n "} +{"problem_id": "p02921", "input": "s=input()\n\nt=input()\n\nans=0\n\nif s[0]==t[0]:\n\n ans+=1\n\nif s[1]==t[1]:\n\n ans+=1\n\nif s[2]==t[2]:\n\n ans+=1\n\nprint(ans)\n"} +{"problem_id": "p03835", "input": "k,s=list(map(int,input().split()))\n\ncnt=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0 <= s-i-j <= k:\n\n cnt+=1\n\nprint(cnt)"} +{"problem_id": "p03806", "input": "N,Ma,Mb = list(map(int, input().split()))\n\narr=[list(map(int,input().split())) for _ in range(N)]\n\ndp=[[[5000]*401 for _ in range(401)] for _ in range(41)]\n\ndp[0][0][0] = 0\n\nfor i in range(N):\n\n a,b,c=arr[i]\n\n for j in range(10*N+1):\n\n for k in range(10*N+1):\n\n if dp[i][j][k] == 5000:\n\n continue\n\n dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k])\n\n dp[i+1][j+a][k+b]=min(dp[i+1][j+a][k+b],dp[i][j][k]+c)\n\n\n\nans=5000\n\nfor i in range(1,401):\n\n if i*Ma>400 or i*Mb>400:\n\n break\n\n ans = min(ans, dp[N][i*Ma][i*Mb])\n\nif ans == 5000:\n\n print((-1))\n\nelse:\n\n print(ans)"} +{"problem_id": "p02814", "input": "from math import gcd\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a // 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x // pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b//gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M // x + 1) // 2))"} +{"problem_id": "p03038", "input": "from heapq import *\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nPAIRS = [[-a, -1] for a in map(int, input().split())]\n\nheapify(PAIRS)\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(PAIRS, [-c, -b])\n\n\n\nanswer = 0\n\nfor _ in range(n):\n\n pair = heappop(PAIRS)\n\n answer += -pair[0]\n\n pair[1] += 1\n\n if pair[1] != 0:\n\n heappush(PAIRS, pair)\n\n\n\nprint(answer)\n"} +{"problem_id": "p03796", "input": "import math\n\n\n\nn = int(input())\n\nans = math.factorial(n) % (pow(10, 9) + 7)\n\nprint(ans)"} +{"problem_id": "p02596", "input": "k = int(input())\n\nx = 1\n\n\n\nif k%7 != 0:\n\n mod = 9*k\n\nelse:\n\n mod = 9*k//7\n\n\n\nfor i in range(10**6):\n\n x = x*10%mod\n\n if x == 1:\n\n print((i + 1))\n\n exit()\n\n\n\nprint((-1))"} +{"problem_id": "p03200", "input": "s = input()\n\n\n\ncnt = 0\n\nans = 0\n\nfor c in s:\n\n if c == 'B':\n\n cnt += 1\n\n elif c == 'W':\n\n ans += cnt\n\nprint(ans)\n"} +{"problem_id": "p00053", "input": "import math\n\ndef pri(n):\n\n if n < 2:\n\n return False\n\n elif n == 2:\n\n return True\n\n elif n % 2 == 0:\n\n return False\n\n\n\n i = 3\n\n while i <= math.sqrt(n):\n\n if n % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nl=[i for i in range(110000)if pri(i) ]\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0: break\n\n print((sum(l[:n])))"} +{"problem_id": "p02988", "input": "n = int(input())\n\nl = list(map(int, input().split()))\n\nprint((sum(l[i]l[i+1]>l[i+2] for i in range(n-2))))"} +{"problem_id": "p03363", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\n\n\nans, s = 0, 0\n\nd = {0:1}\n\n\n\nfor i in A:\n\n s += i\n\n ans += d.get(s, 0)\n\n d[s] = d.get(s, 0) + 1\n\n\n\nprint(ans)"} +{"problem_id": "p03162", "input": "N = int(input())\n\nl = [list(map(int, input().split())) for _ in range(N)]\n\n\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\n\n\nfor i in range(1, N+1):\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k]+l[i-1][k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n\n\n"} +{"problem_id": "p02899", "input": "import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(input())\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n for i in range(len(l)):\n\n if i != len(l)-1:\n\n print(\"{} \".format(l[i]), end='')\n\n else:\n\n print(l[i])\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p02994", "input": "N,L = list(map(int, input().split()))\n\ntaste = [L+i-1 for i in range(1,N+1)]\n\nif taste[-1] < 0:\n\n print((sum(taste) + min([abs(x) for x in taste])))\n\nelse:\n\n print((sum(taste) - min([abs(x) for x in taste])))"} +{"problem_id": "p03416", "input": "# ABC090B - Palindromic Numbers\n\na, b = list(map(int, input().rstrip().split()))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n lst = list(map(int, list(str(i))))\n\n if lst[0] == lst[4] and lst[1] == lst[3]:\n\n count += 1\n\nprint(count)"} +{"problem_id": "p03720", "input": "n, m = list(map(int, input().split()))\n\ndp = [0] * n\n\nfor i in range(m):\n\n x, y = list(map(int, input().split()))\n\n dp[x - 1] += 1\n\n dp[y - 1] += 1\n\nfor i in range(n):\n\n print((dp[i]))"} +{"problem_id": "p03558", "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\n\n\nfrom collections import deque\n\ndef resolve():\n\n k=int(input())\n\n E=[[] for _ in range(k)]\n\n for i in range(k):\n\n E[i].append(((i+1)%k,1))\n\n E[i].append(((10*i)%k,0))\n\n\n\n # 0-1 BFS\n\n dist=[INF]*k\n\n dist[1]=0\n\n Q=deque([1])\n\n while(Q):\n\n v=Q.popleft()\n\n for nv,w in E[v]:\n\n if(dist[nv]<=dist[v]+w): continue\n\n dist[nv]=dist[v]+w\n\n if(w==0): Q.appendleft(nv)\n\n else: Q.append(nv)\n\n print((dist[0]+1))\n\nresolve()"} +{"problem_id": "p03796", "input": "import math\n\n\n\nn = int(input())\n\n\n\nprint((math.factorial(n) % (10**9 + 7)))\n"} +{"problem_id": "p03839", "input": "N,K = list(map(int,input().split()))\n\nsrc = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncump = [0]\n\nfor a in src:\n\n cums.append(cums[-1] + a)\n\n cump.append(cump[-1] + max(0,a))\n\n\n\nans = 0\n\nfor i in range(N-K+1):\n\n tmp = cump[i]\n\n tmp += max(0, cums[i+K] - cums[i])\n\n tmp += cump[N] - cump[i+K]\n\n ans = max(tmp, ans)\n\nprint(ans)\n"} +{"problem_id": "p03796", "input": "def factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r *= n\n\n power_r %= 10**9+7\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))"} +{"problem_id": "p02596", "input": "import sys\n\nK = int(input())\n\n\n\npower = 7\n\nSUM = 0\n\n\n\nfor i in range(1, 10 ** 6):\n\n SUM += power\n\n if SUM % K == 0:\n\n print(i)\n\n sys.exit()\n\n power *= 10\n\n power %= K\n\n\n\nprint((-1))"} +{"problem_id": "p02821", "input": "#E\n\nfrom itertools import accumulate\n\nfrom bisect import bisect_left\n\ndef main():\n\n n,m=list(map(int,input().split()))\n\n A=list(map(int,input().split()))\n\n A.sort()\n\n \n\n def count(k):\n\n cnt=0\n\n for a in A:\n\n cnt+=bisect_left(A,k-a)\n\n return cnt\n\n \n\n ok=0\n\n ng=10**10+1\n\n while ng-ok>1:\n\n mid=(ok+ng)//2\n\n if count(mid)= dr[f]+wa[d]-xyc[i][2]:\n\n low = dr[f]+wa[d]-xyc[i][2]\n\n\n\ndr.sort()\n\nwa.sort()\n\n\n\nif low >= (dr[0] + wa[0]):\n\n print((dr[0] + wa[0]))\n\nelse:\n\n print(low)"} +{"problem_id": "p02983", "input": "l, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (((i%2019)*(j%2019))%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)"} +{"problem_id": "p03371", "input": "a,b,c,x,y = list(map(int,input().split()))\n\nprice = 10**10\n\nfor k in range(10**5+1):\n\n re = 2*c*k + max(0,x-k)*a + max(0,y-k)*b\n\n price = min(re,price)\n\nprint(price)"} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))"} +{"problem_id": "p02996", "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(input())\n\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\n\n\n\ncnt = 0\n\nfor b, a in ab:\n\n cnt += a\n\n if cnt > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n"} +{"problem_id": "p03828", "input": "from collections import Counter\n\nN = int(input())\n\ndiv = []\n\nfor i in range(2,N+1):\n\n while i != 1:\n\n for d in range(2,i+1):\n\n while i%d==0:\n\n i = i//d\n\n div.append(d)\n\nC = Counter(div).most_common()\n\nAns = 1\n\nfor k,v in C:\n\n Ans = Ans*(v+1) % (10**9+7)\n\n\n\nprint(Ans)\n"} +{"problem_id": "p02245", "input": "from collections import deque\n\nfrom copy import deepcopy, copy\n\ndy = [-1, 0, 0, 1]\n\ndx = [0, -1, 1, 0]\n\nN = 3\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef MAIN():\n\n m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n goal = ('1', '2', '3', '4', '5', '6', '7', '8', '0')\n\n goal = 123456780\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n print(cnt)\n\n break\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\nMAIN()\n\n\n"} +{"problem_id": "p03416", "input": "# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n r = \"\".join(reversed(list(s)))\n\n if s == r:\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n"} +{"problem_id": "p03371", "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float('inf')\n\n\n\nfor i in range(10 ** 5 + 1):\n\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\nprint(ans)"} +{"problem_id": "p03037", "input": "k,m=list(map(int,input().split()))\n\nl=[0 for i in range(k+1)]\n\nfor i in range(m):\n\n a,s=list(map(int,input().split()))\n\n l[a-1]+=1;l[s]-=1\n\nans=0\n\nf=0\n\nfor j in range(k):\n\n l[j]+=f\n\n f=l[j]\n\nprint((len([1 for i in l if i==m])))"} +{"problem_id": "p02792", "input": "N = int(input())\n\ncount = [[0 for _ in range(9)] for _ in range(9)]\n\nfor i in range(1, N + 1):\n\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\n\nans = 0\n\nfor i in range(0, 9):\n\n for k in range(0, 9):\n\n ans += count[i][k] * count[k][i]\n\nprint(ans)"} +{"problem_id": "p03078", "input": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x // y))\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\nABC=[]\n\nfor i in range(X):\n\n for j in range(Y):\n\n if (i+1)*(j+1)>K:\n\n break\n\n for k in range(Z):\n\n if (i+1)*(j+1)*(k+1)>K:\n\n break\n\n ABC.append(A[i]+B[j]+C[k])\n\nABC.sort(reverse=True)\n\nfor i in range(K):\n\n print((ABC[i]))\n\n\n"} +{"problem_id": "p02560", "input": "#!/usr/bin/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n"} +{"problem_id": "p02881", "input": "import math\n\nN = int(input())\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = math.ceil(N/(i+1))\n\n if (1+i)*j == N:\n\n ans = min(i+j-1,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)"} +{"problem_id": "p02758", "input": "mod = 998244353\n\nN = int(input())\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))"} +{"problem_id": "p02622", "input": "print((sum(si != ti for si, ti in zip(input(), input()))))\n"} +{"problem_id": "p02767", "input": "n = int(input())\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n # else:\n\n # break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)"} +{"problem_id": "p02792", "input": "def solve():\n\n N = int(input())\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, 5):\n\n for i in range(10**d):\n\n j = x*10**(d+1) + i*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n else:\n\n break\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for A in range(1, N+1):\n\n ss = str(A)\n\n ans += numss[int(ss[-1])][int(ss[0])]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n"} +{"problem_id": "p03086", "input": "# -*- coding: utf-8 -*-\n\nfrom collections import deque\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nS = input()\n\nA = set(\"ATCG\")\n\nans = 0\n\nmode = 0\n\nfor i, s in enumerate(S):\n\n if s in A:\n\n if mode == 0:\n\n mode = 1\n\n start = i\n\n else:\n\n if mode == 1:\n\n ans = max(i - start, ans)\n\n mode = 0\n\nif mode == 1:\n\n ans = max(len(S) - start, ans)\n\nprint(ans)"} +{"problem_id": "p02952", "input": "N = int(input())\n\nans = 0\n\nfor i in range(1, N + 1):\n\n if len(str(i)) % 2 == 1:\n\n ans += 1\n\nprint(ans)"} +{"problem_id": "p03353", "input": "S = input()\n\nk = int(input())\n\nA = set()\n\nfor l in range(k+1):\n\n\tfor i in range(len(S)-l):\n\n\t\t\tA.add(S[i:i+l+1])\n\nA = sorted(list(A))\n\nprint((A[k-1]))"} +{"problem_id": "p02693", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nK = int(input())\n\nA, B = list(map(int, input().split()))\n\n\n\nfor i in range(A, B+1):\n\n if i%K==0:\n\n print('OK')\n\n exit()\n\n \n\nprint('NG')"} +{"problem_id": "p03806", "input": "n, ma, mb = list(map(int, input().split()))\n\nU = 400\n\ndp = [[[float(\"inf\")]*(U+1) for _ in range(U+1)] for i in range(n+1)]\n\ndp[0][0][0] = 0\n\nfor i in range(n):\n\n a, b, c = list(map(int, input().split()))\n\n for j in range(U+1):\n\n for k in range(U+1):\n\n if j b:\n\n a, b = b, a\n\n ai = y_dict[a]\n\n bi = y_dict[b]\n\n j = x_dict[c]\n\n banned_left_ij[j][ai] += 1\n\n banned_left_ij[j][bi] -= 1\n\n banned_right_ij[j - 1][ai] += 1\n\n banned_right_ij[j - 1][bi] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n i = y_dict[d]\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up_ij[i][ej] += 1\n\n banned_up_ij[i][fj] -= 1\n\n banned_down_ij[i - 1][ej] += 1\n\n banned_down_ij[i - 1][fj] -= 1\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor i in range(col):\n\n ru = banned_up_ij[i]\n\n rd = banned_down_ij[i]\n\n ri = row * i\n\n banned_up[ri] = ru[0]\n\n banned_down[ri] = rd[0]\n\n for j in range(1, row):\n\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\n\nfor j in range(row):\n\n rl = banned_left_ij[j]\n\n rr = banned_right_ij[j]\n\n banned_left[j] = rl[0]\n\n banned_right[j] = rr[0]\n\n for i in range(1, col):\n\n ri0 = (i - 1) * row\n\n ri1 = i * row\n\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n"} +{"problem_id": "p02555", "input": "def main():\n\n s = int(input())\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n for i in range(1, s+1):\n\n for j in range(0, (i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n"} +{"problem_id": "p03078", "input": "def slove():\n\n import sys\n\n import heapq\n\n import collections\n\n input = sys.stdin.readline\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n b.sort(reverse=True)\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n c.sort(reverse=True)\n\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(q)\n\n fq = collections.defaultdict(list)\n\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n\n t = 0\n\n for _ in range(k):\n\n if len(q) != 0:\n\n p = heapq.heappop(q)\n\n t = p[0]\n\n aq = p[1]\n\n bq = p[2]\n\n cq = p[3]\n\n if aq + 1 < len(a):\n\n if (-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq])\n\n fq[(-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq)] = 1\n\n if bq + 1 < len(b):\n\n if (-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq])\n\n fq[(-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq)] = 1\n\n if cq + 1 < len(c):\n\n if (-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1])\n\n fq[(-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1)] = 1\n\n print((-t))\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n"} +{"problem_id": "p00500", "input": "N = int(input())\n\nscore = [list(map(int, input().split())) for _ in range(N)]\n\nplayers = [0 for _ in range(N)]\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += p\n\nprint(*players, sep='\\n')\n"} +{"problem_id": "p03170", "input": "n,k = list(map(int,input().split()))\n\narr = list(map(int,input().split()))\n\n\n\ndp = [False]*(k+1)\n\n\n\nfor stones in range(k+1):\n\n for x in arr:\n\n if stones >= x and dp[stones-x] == False:\n\n dp[stones] = True\n\n\n\nif dp[k]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")\n"} +{"problem_id": "p02419", "input": "W = input().lower()\n\ns = []\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n s.append(T[i].lower())\n\nans = 0\n\nfor i in range(len(s)):\n\n if(s[i] == W):\n\n ans += 1\n\nprint(ans)"} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))"} +{"problem_id": "p02773", "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nS = sorted(S)\n\nls = [[] for i in range(N + 1)]\n\nmax_num = 0\n\nleft = 0\n\nright = 0\n\nwhile right < N:\n\n while right < N and S[left] == S[right]:\n\n right += 1\n\n if (right - left) >= max_num:\n\n ls[right - left].append(S[left].decode())\n\n max_num = right - left\n\n left = right\n\n \n\nprint(('\\n'.join(ls[max_num])))\n"} +{"problem_id": "p03164", "input": "# temp\n\nn,w = list(map(int,input().split()))\n\nwv = [tuple(map(int,input().split())) for i in range(n)]\n\n\n\ndp = [0] + [float(\"inf\")]*(10**5)\n\nfor i in range(n):\n\n for j in range(10**5,wv[i][1]-1,-1):\n\n dp[j] = min(dp[j],dp[j-wv[i][1]]+wv[i][0])\n\n\n\nres = 0\n\nfor v,e in enumerate(dp):\n\n if e <= w:\n\n res = v\n\nprint(res)"} +{"problem_id": "p02555", "input": "def main():\n\n n = int(input())\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(n+1):\n\n for j in range(i-2):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()"} +{"problem_id": "p02264", "input": "class Queue:\n\n def __init__(self,values):\n\n self.values = values\n\n\n\n def empty(self):\n\n if len(self.values) == 0:\n\n return True\n\n else:\n\n return False\n\n\n\n def enqueue(self,v):\n\n self.values.append(v)\n\n\n\n def dequeue(self):\n\n if len(self.values) <= 0:\n\n raise\n\n else:\n\n v = self.values[0]\n\n del self.values[0]\n\n return v\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nprocesses = []\n\nfor i in range(n):\n\n n,t = input().split(' ')\n\n processes.append((n,int(t)))\n\n\n\nqueue = Queue(processes)\n\n\n\nclock = 0\n\ndone = []\n\nwhile not queue.empty():\n\n p = queue.dequeue()\n\n n = p[0]\n\n t = p[1]\n\n if t <= q:\n\n clock+=t\n\n done.append((n,clock))\n\n else:\n\n queue.enqueue((n,t-q))\n\n clock+=q\n\n\n\nfor p in done:\n\n print(p[0],p[1])"} +{"problem_id": "p02983", "input": "l,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n print(tres)\n"} +{"problem_id": "p03086", "input": "# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\nimport itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n all_words = []\n\n for i in range(1, len(s) + 1):\n\n for letters in itertools.product('ATCG', repeat=i):\n\n word = ''.join(letters)\n\n all_words.append(word)\n\n \n\n for i in range(len(all_words)-1, 0-1, -1):\n\n if all_words[i] in s:\n\n print((len(all_words[i])))\n\n sys.exit()\n\n print((0))\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n"} +{"problem_id": "p03309", "input": "# author: kagemeka \n\n# created: 2019-11-08 14:51:29(JST)\n\n## internal modules\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\nimport statistics\n\n# import functools\n\n# import operator\n\n## external modules\n\n# import scipy.special # if use comb function on AtCoder, \n\n# import scipy.misc # select scipy.misc.comb (old version) \n\n\n\ndef main():\n\n n, *a = (int(x) for x in sys.stdin.read().split())\n\n \n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n\n\n if n % 2 != 0:\n\n b = statistics.median(a)\n\n else:\n\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n\n b = statistics.median_high(a)\n\n else:\n\n b = statistics.median_low(a)\n\n \n\n ans = sum([abs(a[i] - b) for i in range(n)])\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n\n\n\n\n"} +{"problem_id": "p03416", "input": "def findSumDigit(num):\n\n global total\n\n total = \"\"\n\n while num > 0:\n\n total += str(num % 10)\n\n num //= 10\n\n return total\n\n\n\ndef main():\n\n a,b = list(map(int, input().split()))\n\n ans = 0\n\n for i in range(a,b+1):\n\n tmp = str(findSumDigit(i))\n\n if tmp == str(i):\n\n ans += 1\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()"} +{"problem_id": "p03680", "input": "N = int(input())\n\na = [int(input()) for i in range(N)]\n\nnow = a[0]\n\ncount = 1\n\nc = 0\n\nfor i in range(10**6):\n\n if now != 2:\n\n count += 1\n\n now = a[now - 1]\n\n else:\n\n print(count)\n\n c = 1\n\n break\n\nif c == 0:\n\n print((-1))\n"} +{"problem_id": "p02386", "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n"} +{"problem_id": "p02952", "input": "N = int(input())\n\n\n\nans = 0\n\n\n\nfor i in range(1, N+1):\n\n if len(str(i))%2==1:\n\n ans += 1\n\n\n\nprint(ans)"} +{"problem_id": "p03425", "input": "import itertools\n\nfrom collections import Counter\n\nN = int(input())\n\nsrc = [input() for i in range(N)]\n\nctr = Counter()\n\nfor s in src:\n\n ctr[s[0]] += 1\n\n\n\nans = 0\n\nfor ptn in itertools.combinations('MARCH',3):\n\n a,b,c = ptn\n\n ans += ctr[a]*ctr[b]*ctr[c]\n\nprint(ans)"} +{"problem_id": "p02952", "input": "N = int(input())\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n num_dig = 0\n\n ii = i\n\n while ii > 0:\n\n ii = int(ii / 10)\n\n num_dig += 1\n\n if num_dig % 2 != 0:\n\n count += 1\n\n\n\nprint(count)"} +{"problem_id": "p02801", "input": "from string import ascii_lowercase as lower\n\nprint((lower[lower.find(input())+1]))"} +{"problem_id": "p03634", "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]//g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.pop()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n"} +{"problem_id": "p04012", "input": "import string\n\nw = input()\n\nfor a in string.ascii_lowercase:\n\n cnt = 0\n\n for t in w:\n\n if t == a:\n\n cnt = cnt + 1\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")"} +{"problem_id": "p03013", "input": "mod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(input())-1] = 1\n\n\n\ns = 0\n\nt = 1\n\n\n\nfor i in range(n):\n\n if l[i] > 0:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)"} +{"problem_id": "p03774", "input": "N,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 2*10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n"} +{"problem_id": "p03416", "input": "def test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n j = list(map(int,list(str(i))))\n\n if j[0] == j[4] and j[1] == j[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n"} +{"problem_id": "p02821", "input": "from bisect import bisect_left\n\nfrom bisect import bisect_right\n\n\n\nn,m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = sorted(a)\n\n\n\na_count = [0]*100010\n\na_sum = [0]*100010\n\n\n\nfor i in range(n):\n\n a_count[a[i]] += 1\n\n a_sum[a[i]] += a[i]\n\n\n\nfor i in range(100005,-1,-1):\n\n a_count[i] += a_count[i+1]\n\n a_sum[i] += a_sum[i+1]\n\n\n\ndef chk(x):\n\n case = 0\n\n for i in range(n):\n\n if 0<= x-a[i]<= 10**5+5:\n\n case += a_count[x-a[i]]\n\n elif x-a[i] < 0:\n\n case += n\n\n if case >= m:\n\n ch = True\n\n else:\n\n ch = False\n\n return ch\n\n\n\nl = 2*a[-1]+1 #NG\n\nr = 1 #OK\n\n\n\nwhile abs(r-l) > 1:\n\n kk = (r+l)//2\n\n if chk(kk):\n\n r = kk\n\n else:\n\n l = kk\n\n\n\nans = 0\n\nsm = sum(a)\n\n\n\nl = r\n\n\n\ncase = 0\n\nfor i in range(n):\n\n num = n-bisect_right(a,l-a[i]-1)\n\n case += num\n\n ans += num*a[i]*2\n\n\n\nans -= (case-m)*l\n\n\n\nprint(ans)"} +{"problem_id": "p03548", "input": "X, Y, Z = list(map(int, input().split()))\n\nfor n in range(10 ** 5, 0, -1):\n\n if X >= n * (Y + Z) + Z:\n\n break\n\nprint(n)"} +{"problem_id": "p02576", "input": "array = list(map(int, input().split()))\n\nif array[0] % array[1] > 0:\n\n print(((array[0] // array[1] + 1) * array[2]))\n\nelse:\n\n print(((array[0] // array[1]) * array[2]))"} +{"problem_id": "p02268", "input": "N = int(input())\n\nS = list(map(int, input().split()))\n\nQ = int(input())\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n idx = int((head+tail)/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n if head == idx:\n\n return False\n\n return binary_search(target_num, head, idx-1)\n\n else:\n\n if tail == idx:\n\n return False\n\n return binary_search(target_num, idx+1, tail)\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n"} +{"problem_id": "p03796", "input": "n=input()\n\nn=int(n)\n\na=1\n\nfor i in range(n):\n\n a=a*(i+1)\n\n if a>=pow(10,9)+7:\n\n a=a%(pow(10,9)+7)\n\nprint(a)"} +{"problem_id": "p00003", "input": "import sys\n\nr = []\n\nn = int(input())\n\nl = sys.stdin.readlines()\n\nfor i in l:\n\n x, y, z = sorted([x*x for x in list(map(int, i.split()))])\n\n if x + y == z:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")"} +{"problem_id": "p03086", "input": "import re\n\nptn = re.compile(r\"(A|C|G|T)*\")\n\n\n\nS = input()\n\n\n\nans = 0\n\nfor i in range(len(S)):\n\n for j in range(len(S)):\n\n x = ptn.match(S[i:i+j+1]).group(0)\n\n if(x):\n\n ans = max(ans, len(x))\n\nprint(ans)"} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nab = c * 2\n\n\n\nres = float(\"inf\")\n\nif a + b <= ab:\n\n res = x * a + y * b\n\nelse:\n\n if x == y:\n\n res = x * ab\n\n elif x > y:\n\n for i in range(y, x + 1):\n\n cost = i * ab + (x - i) * a\n\n res = min(res, cost)\n\n else:\n\n for i in range(x, y + 1):\n\n cost = i * ab + (y - i) * b\n\n res = min(res, cost)\n\nprint(res)\n"} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nans=a*x+b*y\n\nfor ci in range(max(x,y)+1):\n\n sumc = 2*ci*c\n\n sumc += (x-ci)*a if (x-ci)>0 else 0\n\n sumc += (y-ci)*b if (y-ci)>0 else 0\n\n ans=min(ans,sumc)\n\n\n\nprint(ans)"} +{"problem_id": "p01105", "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p ^ e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&%s\"%\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n"} +{"problem_id": "p04020", "input": "def examB():\n\n N = I(); A = [I() for _ in range(N)]\n\n ans = 0; cur= 0\n\n for i in A:\n\n if i==0:\n\n ans += cur//2\n\n cur = 0\n\n else:\n\n cur += i\n\n ans += cur // 2\n\n print(ans)\n\n return\n\n\n\nimport sys,copy,bisect,itertools,heapq,math\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\n\n\nif __name__ == '__main__':\n\n examB()\n"} +{"problem_id": "p03544", "input": "N = int(input())\n\nL = [ 0 ] * 1000000\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n"} +{"problem_id": "p03013", "input": "import sys\n\nN,M=list(map(int,input().split()))\n\nS=set(map(int,sys.stdin))\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in S:\n\n a,b=b,0\n\n else:\n\n a,b=b,a+b\n\n\n\nprint((b%(10**9+7)))\n"} +{"problem_id": "p01138", "input": "import re\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = [0] * (24*60*60+1)\n\n for _ in range(n):\n\n h1,m1,s1,h2,m2,s2 = list(map(int, re.split(':| ', input())))\n\n l[h1*60*60 + m1*60 + s1] += 1\n\n l[h2*60*60 + m2*60 + s2] -= 1\n\n r = 0\n\n for i in range(24*60*60):\n\n l[i+1] += l[i]\n\n r = max(r, l[i+1])\n\n print(r)"} +{"problem_id": "p03074", "input": "N, K = list(map(int, input().split()))\n\nS = input()\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\nleft = 0\n\nright = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n\n\n next_left = i\n\n next_right = min(i + add, len(nums))\n\n\n\n while next_left > left:\n\n tmp -= nums[left]\n\n left += 1\n\n\n\n while next_right > right:\n\n tmp += nums[right]\n\n right += 1\n\n\n\n ans = max(ans, tmp)\n\nprint(ans)"} +{"problem_id": "p03424", "input": "n=int(input())\n\ns=list(map(str,input().split()))\n\ntotal=[]\n\nfor i in range(n):\n\n if s[i] not in total:\n\n total.append(s[i])\n\nprint(('Three' if len(total)==3 else 'Four'))"} +{"problem_id": "p03164", "input": "import sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = [float('inf')] * 1000 * 100*10\n\nvs = set()\n\nvs.add(0)\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n tmpDP = dp.copy()\n\n for vv in list(vs):\n\n if dp[vv + v] > dp[vv] + w:\n\n tmpDP[vv + v] = dp[vv] + w\n\n vs.add(vv + v)\n\n dp = tmpDP\n\n\n\n\n\nans = 0\n\nfor v in list(vs):\n\n if dp[v] <= W:\n\n ans = max(ans, v)\n\nprint(ans)\n"} +{"problem_id": "p03796", "input": "from math import factorial\n\nN = int(input())\n\nprint((factorial(N) % (10**9 + 7)))"} +{"problem_id": "p00005", "input": "import math\n\nwhile True:\n\n\ttry:\n\n\t\tx,y = list(map(int,input().split()))\n\n\t\tprint('%d %d' % (math.gcd(x,y),x/math.gcd(x,y)*y))\n\n\texcept EOFError:\n\n\t\tbreak"} +{"problem_id": "p02881", "input": "n = int(input())\n\nr = int(n**.5)\n\nfor i in range(r):\n\n if n % (r-i) == 0:\n\n print(( (r-i) + n//(r-i) - 2 ))\n\n break"} +{"problem_id": "p03253", "input": "from collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:\n\n\t\treturn [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn //= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:\n\n\t\tret.append(n)\n\n\treturn ret\n\n\n\nn,m = list(map(int,input().split()))\n\nmod = 10**9+7\n\nif m==1:\n\n\tprint((1));exit()\n\n\n\nfactors = Counter(factorization(m))\n\nmx = n+max(factors.values())\n\n\n\nfac = [1]*(mx+1)\n\ninv = [1]*(mx+1)\n\nfor i in range(1,mx+1):\n\n\tfac[i] = fac[i-1] * i % mod\n\ninv[-1] = pow(fac[-1], mod - 2, mod)\n\nfor i in range(mx-1, -1, -1):\n\n\tinv[i] = inv[i+1] * (i+1) % mod\n\ndef cmb(n,r):\n\n\tassert n >= r >= 0\n\n\treturn fac[n] * inv[n-r] * inv[r] % mod\n\n\t\n\nans=1\n\nfor v in list(factors.values()):\n\n\tans*=cmb(n+v-1,v)\n\n\tans%=mod\n\n\n\nprint(ans)"} +{"problem_id": "p02725", "input": "K, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\ndiff = A[0] + K - A[-1]\n\nans = A[-1] - A[0]\n\nfor i in range(1, N):\n\n dist = K - A[i] + A[i - 1]\n\n if dist < ans:\n\n ans = dist\n\n\n\nprint(ans)\n"} +{"problem_id": "p03371", "input": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = float('inf')\n\n for i in range(0, max(X, Y)*2+1, 2):\n\n ans = min(A*max(X-i//2, 0)+B*max(Y-i//2, 0)+C*i, ans)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n"} +{"problem_id": "p03416", "input": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n i = str(i)\n\n if i[0] == i[4]:\n\n if i[1] == i[3]:\n\n ans += 1\n\n else:\n\n ans += 0\n\n else:\n\n ans += 0\n\nprint(ans)"} +{"problem_id": "p03568", "input": "def main():\n\n N = int(input())\n\n A = [int(i) for i in input().split()]\n\n if N == 1:\n\n return print(1 if A[0] % 2 == 0 else 2)\n\n ans = 0\n\n d = (-1, 0, 1)\n\n from itertools import product\n\n for i in product(range(3), repeat=N):\n\n cur = 1\n\n for j in range(N):\n\n cur *= (A[j] + d[i[j]])\n\n if cur % 2 == 0:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03425", "input": "# -*- coding: utf-8 -*-\n\nfrom collections import defaultdict\n\nfrom itertools import combinations\n\nN = int(input())\n\nC = [0, 0, 0, 0, 0, 0]\n\nD = defaultdict(int)\n\nfor i, m in enumerate(\"MARCH\", start=1):\n\n D[m] = i\n\n\n\nfor _ in range(N):\n\n C[D[input()[0]]] += 1\n\n\n\nans = 0\n\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n\n ans += C[a]*C[b]*C[c]\n\nprint(ans)"} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\n\n\nprint((math.factorial(N) % (1000000000 + 7)))\n"} +{"problem_id": "p03309", "input": "def main():\n\n from statistics import median\n\n\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n m = int(median(a))\n\n\n\n ans = sum([abs(x - m) for x in a])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03037", "input": "N, M = list(map(int, input().split()))\n\nL, R = [], []\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n"} +{"problem_id": "p02555", "input": "a,b,c=1,0,0\n\nexec('a,b,c=b,c,(a+c)%(10**9+7);'*(int(input())-2))\n\nprint(c)"} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\n\n\nz = max(x,y) * 2\n\nmin_sum = c * z\n\n\n\nfor i in range(z):\n\n r = max(0, y - i) * b\n\n t = max(0, x - i) * a\n\n sum = c * i * 2 + r + t\n\n if sum < min_sum:\n\n min_sum = sum\n\n\n\nprint(min_sum)"} +{"problem_id": "p03796", "input": "N = int(input())\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)"} +{"problem_id": "p03170", "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom operator import xor\n\nfrom functools import reduce\n\n\n\nN,K,*A = list(map(int,read().split()))\n\n\n\na = reduce(xor,(1<= 3600:\n\n h=S//3600\n\n m=S%3600//60\n\n s=S%60\n\nelif 3600 > S >= 60:\n\n h=0\n\n m=S//60\n\n s=S%60\n\nelse:\n\n h=m=0\n\n s=S\n\nprint(h, m, s, sep=\":\")\n"} +{"problem_id": "p03806", "input": "def main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1<<30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(400, -1, -1):\n\n\t\t\tfor j in range(400, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\nif __name__==\"__main__\":\n\n\tmain()"} +{"problem_id": "p03434", "input": "_,s=open(c:=0)\n\nfor a in sorted(map(int,s.split())):c=a-c\n\nprint(c)"} +{"problem_id": "p03854", "input": "s = input()\n\nt = \"\"\n\nwhile len(t) < len(s):\n\n target_len = len(s) - len(t)\n\n\n\n if s[len(t)] == 'd':\n\n if target_len == 5:\n\n t += \"dream\"\n\n elif target_len == 7:\n\n t += \"dreamer\"\n\n elif target_len > 7:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 7 + 1] != \"era\":\n\n t += \"dreamer\"\n\n else:\n\n t += \"dream\"\n\n else:\n\n break\n\n else:\n\n if target_len == 5:\n\n t += \"erase\"\n\n elif target_len == 6:\n\n t += \"eraser\"\n\n elif target_len > 6:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 6 + 2] != \"era\":\n\n t += \"eraser\"\n\n else:\n\n t += \"erase\"\n\n else:\n\n break\n\n\n\n if s[0:len(t)] != t:\n\n break\n\n\n\nprint((\"YES\" if s == t else \"NO\"))\n"} +{"problem_id": "p00134", "input": "from statistics import mean\n\n\n\ninputCount = int(input())\n\nprices = [int(input()) for lp in range(inputCount)]\n\naverage = mean(prices)\n\nprint((int(average)))\n\n\n"} +{"problem_id": "p03559", "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\nA = sorted(inpl())\n\nB = sorted(inpl())\n\nC = sorted(inpl())\n\ncnt = [0] * n\n\nres = 0\n\nfor i,b in enumerate(B):\n\n c = bisect.bisect_left(C,b+1)\n\n cnt[i] = n-c\n\n\n\nacc = [0]\n\nfor x in cnt:\n\n acc += [acc[-1] + x]\n\nsu = sum(cnt) \n\nfor i,a in enumerate(A):\n\n c = bisect.bisect_left(B,a+1)\n\n res += su - acc[c]\n\nprint(res)"} +{"problem_id": "p02552", "input": "x = int(input())\n\nprint((0 if x==1 else 1))"} +{"problem_id": "p02268", "input": "def binarySearch():\n\n n = int(input())\n\n S = set(map(int, input().split()))\n\n q = int(input())\n\n T = set(map(int, input().split()))\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()"} +{"problem_id": "p03416", "input": "a,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])\n\n str1=buf[0:int(len(buf)/2)]\n\n str2=buf[int(len(buf)/2+1):]\n\n if str1[0]==str2[1] and str1[1]==str2[0]:\n\n ans+=1\n\n\n\nprint(ans)\n"} +{"problem_id": "p03720", "input": "n, m = list(map(int, input().split()))\n\nRD = list(list(map(int, input().split())) for _ in range(m))\n\nfor i in range(1, n + 1):\n\n ans = 0\n\n for j in RD:\n\n ans += j.count(i)\n\n print(ans)"} +{"problem_id": "p03325", "input": "N = int(input())\n\nx = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in x:\n\n while i % 2 == 0:\n\n cnt += 1\n\n i /= 2\n\nprint(cnt)"} +{"problem_id": "p02649", "input": "def popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50 and j!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\nfor i in range(2**n):\n\n t=set([])\n\n for a in A:\n\n data[a&i]+=1\n\n t.add(a&i)\n\n temp=0\n\n for val in t:\n\n temp+=cmb[data[val]][min(K,data[val])]\n\n ans+=temp*(-1)**popcount(i)\n\n for val in t:\n\n data[val]=0\n\n\n\nprint(ans)\n"} +{"problem_id": "p02814", "input": "import sys\n\nfrom math import gcd\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n A = list(set(map(int, input().split(\" \"))))\n\n A = [a // 2 for a in A]\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a)\n\n if semi_lcm > M:\n\n print((0))\n\n return\n\n\n\n for a in A:\n\n if semi_lcm // a % 2 == 0:\n\n print((0))\n\n return\n\n\n\n print(((M // semi_lcm + 1) // 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03634", "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\ndef dfs(v,p,d):\n\n for i, j in tree[v]:\n\n if i != p:\n\n depth[i] = d + j\n\n dfs(i,v,d+j)\n\n\n\nN = int(input())\n\n\n\ntree = [[] for _ in range(N)]\n\n\n\nfor i in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n tree[a].append((b,c))\n\n tree[b].append((a,c))\n\n\n\nQ, K = list(map(int, input().split()))\n\n\n\ndepth = [0 for i in range(N)]\n\ndepth[K-1] = 0\n\n\n\ndfs(K-1,-1,0)\n\n\n\nfor _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n print((depth[x-1] + depth[y-1]))"} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\n\n\npower = math.factorial(n)\n\n\n\nprint((power % (10**9 + 7)))\n"} +{"problem_id": "p02883", "input": "#!/usr/bin/env python3\n\nimport sys\n\nINF = float(\"inf\")\n\nfrom bisect import bisect_left\n\n\n\n\n\ndef solve(N: int, K: int, A: \"List[int]\", F: \"List[int]\"):\n\n A.sort()\n\n F.sort(reverse=True)\n\n h = []\n\n for a, f in zip(A, F):\n\n h.append((a*f, a, f))\n\n h.sort()\n\n maxtime = h[-1][0]\n\n\n\n def isOK(y):\n\n i = bisect_left(h, (y+1, -1, -1))\n\n counter = 0\n\n # print(h[i:])\n\n for p, a, f in h[i:]:\n\n counter += a-y//f\n\n return counter <= K\n\n\n\n def binary_search(x):\n\n ng = -1\n\n ok = len(x)\n\n while abs(ok - ng) > 1:\n\n mid = (ok + ng)//2\n\n # print(\"mid: {}, in ({}, {})\".format(mid, ng, ok))\n\n if isOK(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n return ng, ok\n\n\n\n ng, ok = binary_search(list(range(maxtime)))\n\n print(ok)\n\n\n\n # while k > 0:\n\n # p1, a1, f1 = heapq.heappop(h)\n\n # p2, a2, f2 = heapq.heappop(h)\n\n # p1, p2 = -p1, -p2\n\n # sub = min(a1 - math.ceil((p2/f1)-1), k)\n\n # a1 -= sub\n\n # k -= sub\n\n # heapq.heappush(h, (-a1*f1, a1, f1))\n\n # heapq.heappush(h, (-a2*f2, a2, f2))\n\n # # print(h)\n\n # p, a, f = heapq.heappop(h)\n\n # print(-p)\n\n\n\n return\n\n\n\n\n\ndef main():\n\n\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n K = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n F = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, K, A, F)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))\n"} +{"problem_id": "p03634", "input": "import heapq\n\n\n\nN = int(input())\n\nabc = [list(map(int,input().split())) for _ in range(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nxy = [list(map(int,input().split())) for _ in range(Q)]\n\n\n\nconnect = [[] for _ in range(N)]\n\nINFTY = 10**15\n\nfor a,b,c in abc:\n\n connect[a-1].append([b-1,c])\n\n connect[b-1].append([a-1,c])\n\n\n\ncost = [[INFTY,False] for _ in range(N)]\n\ncost[K-1][0] = 0\n\nq = [(0,K-1)]\n\nwhile q:\n\n _,i = heapq.heappop(q)\n\n if cost[i][1]:\n\n continue\n\n cost[i][1] = True\n\n ci0 = cost[i][0]\n\n for j,c in connect[i]:\n\n if cost[j][1]:\n\n continue\n\n tmp_cost = ci0+c\n\n if tmp_cost < cost[j][0]:\n\n cost[j][0] = tmp_cost\n\n heapq.heappush(q,(tmp_cost,j))\n\n\n\nfor x,y in xy:\n\n print((cost[x-1][0] + cost[y-1][0]))"} +{"problem_id": "p03416", "input": "A,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(n):\n\n\tkey = 0\n\n\tfor i in range(1,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(B)-kaibun(A-1)))"} +{"problem_id": "p02555", "input": "from sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n for x in range(3,i+1):\n\n if x in [i-1,i-2]:\n\n continue\n\n dp[i] += dp[i-x]\n\n return dp[s]%mod\n\nprint((solve()))"} +{"problem_id": "p02773", "input": "N = int(input())\n\ns_list = {}\n\nfor i in range(N):\n\n S = input()\n\n if S in list(s_list.keys()):\n\n s_list[S] += 1\n\n else:\n\n s_list[S] = 0\n\nmax = 0\n\nmaxs = []\n\nfor s,c in list(s_list.items()):\n\n if c > max:\n\n maxs = [s]\n\n max = c\n\n elif c == max:\n\n maxs.append(s)\n\nmaxs.sort()\n\nfor m in maxs:\n\n print(m)"} +{"problem_id": "p03796", "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))"} +{"problem_id": "p02730", "input": "S = input()\n\nN = len(S)\n\nleft = S[:int(N/2)]\n\nright = S[int((N+2)/2):]\n\nS_reversed = \"\".join(reversed(list(S)))\n\nleft_reversed = \"\".join(reversed(list(left)))\n\nright_reversed = \"\".join(reversed(list(right)))\n\n\n\nif S == S_reversed and left == left_reversed and right == right_reversed:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")"} +{"problem_id": "p03416", "input": "a,b=list(map(int,input().split()))\n\nans=0\n\nfor i in range(b+1)[a:]:\n\n if len(str(i))%2==0:\n\n p=list(str(i))[:len(str(i))//2]\n\n q=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if p==q:\n\n ans+=1\n\n else:\n\n s=list(str(i))[:len(str(i))//2+1]\n\n d=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if s==d:\n\n ans += 1\n\nprint(ans)"} +{"problem_id": "p02814", "input": "import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\n \n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nfrom collections import defaultdict\n\n \n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n \n\n \n\nfrom functools import reduce\n\n# from math import *\n\nfrom math import *\n\nN, M = list(map(int, readline().split()))\n\nA = list(sorted([int(x) // 2 for x in readline().split()]))\n\nmin_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)\n\n \n\n# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))\n\nif not all([(min_cm // x) % 2 == 1 for x in A]):\n\n print((0))\n\n exit(0)\n\nif min_cm > M:\n\n print((0))\n\n exit(0)\n\nans = (M // min_cm + 1) // 2\n\nprint(ans)"} +{"problem_id": "p01093", "input": "while int(input()) > 0:\n\n s = sorted(map(int, input().split()))\n\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))"} +{"problem_id": "p02814", "input": "# ABC150 D\n\nsi = lambda: input()\n\nni = lambda: int(input())\n\nnm = lambda: list(map(int, input().split()))\n\nnl = lambda: list(map(int, input().split()))\n\nfrom math import gcd\n\nfrom math import ceil\n\ndef lcm(x, y):\n\n return (x * y) // gcd(x, y)\n\nn,m=nm()\n\na=nl()\n\nans=0\n\na=[x//2 for x in a] \n\n\n\nlcm_v=a[0]\n\nfor i in range(n):\n\n lcm_v=lcm(lcm_v,a[i])\n\nok_flg=[(lcm_v//i)%2==1 for i in a]\n\nif all(ok_flg):\n\n ans=((m//lcm_v)+1)//2\n\nprint(ans)\n\n\n"} +{"problem_id": "p02412", "input": "def main():\n\n\n\n while True:\n\n n, x = tuple(map(int, input().split()))\n\n pattern = 0\n\n\n\n if n == x == 0:\n\n break\n\n else:\n\n for a in range(1, n+1):\n\n for b in range(1, a):\n\n for c in range(1, b):\n\n pattern += 1 if a + b + c == x and a > b > c else 0\n\n print(pattern)\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03416", "input": "A, B = list(map(int, input().split()))\n\nnumbers = list(range(A, B+1))\n\ncount = 0\n\nfor i in numbers:\n\n m = str(i)\n\n rm = ''.join(list(reversed(m)))\n\n if m == rm:\n\n count += 1\n\nprint(count)"} +{"problem_id": "p02863", "input": "import sys\n\nfrom operator import itemgetter\n\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return input()\n\n\n\nN, T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort(key=itemgetter(0))\n\n#print(ab)\n\n\n\ndp = [[0]*(T+1+3000+1) for _ in range(N+1)]\n\nans = 0\n\nfor i in range(N):\n\n for j in range(T+1+3000+1):\n\n time, deli = ab[i]\n\n if 0 <= j-time < T:\n\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n\n else:\n\n dp[i + 1][j] = dp[i][j]\n\n ans = max(ans, dp[i + 1][j])\n\nprint(ans)\n\n\n\n#print(dp)\n"} +{"problem_id": "p02599", "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/\n\n# Python3 code to find number of\n\n# distinct numbers in a subarray\n\nMAX = 1000001\n\n\n\n# structure to store queries\n\nclass Query:\n\n def __init__(self, l, r, idx):\n\n self.l = l\n\n self.r = r\n\n self.idx = idx\n\n\n\n\n\n# updating the bit array\n\ndef update(idx, val, bit, n):\n\n while idx <= n:\n\n bit[idx] += val\n\n idx += idx & -idx\n\n\n\n\n\n# querying the bit array\n\ndef query(idx, bit, n):\n\n summ = 0\n\n while idx:\n\n summ += bit[idx]\n\n idx -= idx & -idx\n\n return summ\n\n\n\n\n\ndef answeringQueries(arr, n, queries, q):\n\n\n\n # initialising bit array\n\n bit = [0] * (n + 1)\n\n\n\n # holds the rightmost index of\n\n # any number as numbers of a[i]\n\n # are less than or equal to 10^6\n\n last_visit = [-1] * MAX\n\n\n\n # answer for each query\n\n ans = [0] * q\n\n\n\n query_counter = 0\n\n for i in range(n):\n\n\n\n # If last visit is not -1 update -1 at the\n\n # idx equal to last_visit[arr[i]]\n\n if last_visit[arr[i]] != -1:\n\n update(last_visit[arr[i]] + 1, -1, bit, n)\n\n\n\n # Setting last_visit[arr[i]] as i and\n\n # updating the bit array accordingly\n\n last_visit[arr[i]] = i\n\n update(i + 1, 1, bit, n)\n\n\n\n # If i is equal to r of any query store answer\n\n # for that query in ans[]\n\n while query_counter < q and queries[query_counter].r == i:\n\n ans[queries[query_counter].idx] = query(queries[query_counter].r + 1, bit, n) - query(\n\n queries[query_counter].l, bit, n\n\n )\n\n query_counter += 1\n\n\n\n # print answer for each query\n\n for i in range(q):\n\n print((ans[i]))\n\n\n\n\n\n# This code is contributed by\n\n# sanjeev2552\n\n\n\n\n\ndef main():\n\n N, Q = list(map(int, readline().split()))\n\n C = list(map(int, readline().split()))\n\n (*LR,) = list(map(int, read().split()))\n\n\n\n queries = [0] * Q\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n queries[i] = Query(l - 1, r - 1, i)\n\n\n\n queries.sort(key=lambda x: x.r)\n\n answeringQueries(C, N, queries, Q)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n"} +{"problem_id": "p02596", "input": "k = int(input())\n\nnum = 0\n\nif not k%2:\n\n print((-1))\n\nelse:\n\n for i in range(k):\n\n num = (num*10+7)%k\n\n if num == 0:\n\n print((i+1))\n\n break\n\n else:\n\n print((-1))"} +{"problem_id": "p02596", "input": "k = int(input())\n\ncount = 1\n\nn = 0\n\nif k % 2 == 0 or k % 5 == 0:\n\n print((-1))\n\nelse:\n\n while 1:\n\n n = (n * 10 + 7) % k \n\n if n == 0:\n\n break \n\n count += 1\n\n print(count)"} +{"problem_id": "p03250", "input": "a, b, c = sorted(map(int, input().split()))\n\n\n\nprint((c*10 + b + a))"} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(200005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)"} +{"problem_id": "p03568", "input": "N = int(input())\n\nAs = list(map(int,input().split()))\n\n\n\n\n\ndef dfs(A_s, index,Bss):\n\n if index == N:\n\n tmp = 1\n\n for b in Bss:\n\n tmp *= b\n\n return 1 if tmp % 2 == 0 else 0\n\n b_mi = Bss.copy()\n\n b_mi.append(A_s[index] - 1)\n\n\n\n b = Bss.copy()\n\n b.append(A_s[index])\n\n\n\n b_pl = Bss.copy()\n\n b_pl.append(A_s[index] + 1)\n\n return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)\n\n\n\n\n\nprint((dfs(As,0,[])))\n"} +{"problem_id": "p03796", "input": "import math\n\nn=int(input())\n\nprint((math.factorial(n)%(10**9+7)))"} +{"problem_id": "p02555", "input": "from sys import stdin\n\nfrom math import factorial\n\n\n\n\n\ndef combinations_count(n, r):\n\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n _in = [_.rstrip() for _ in stdin.readlines()]\n\n S = int(_in[0]) # type:int\n\n # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n\n min_ = 1\n\n max_ = S // 3\n\n ans = 0\n\n for i in range(min_, max_ + 1):\n\n mod = S - i * 3\n\n ans += combinations_with_replacement_count(mod + 1, i - 1) % (10**9 + 7)\n\n ans %= (10**9 + 7)\n\n # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n"} +{"problem_id": "p03801", "input": "n = int(input())\n\na = list(map(int, input().split()))\n\n\n\ntmp = [[e, n - i] for i, e in enumerate(a)]\n\ntmp.sort(reverse=True)\n\n\n\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\n\n\n\nv_prev, i_prev = aa[0]\n\ni = 0\n\nans = [0] * n\n\nsm = 0\n\nwhile i < n:\n\n while aa[i][1] >= i_prev:\n\n sm += aa[i][0]\n\n i += 1\n\n\n\n ans[i_prev] += sm - aa[i][0] * i\n\n sm = aa[i][0] * i\n\n v_prev, i_prev = aa[i]\n\n\n\nprint(*ans, sep=\"\\n\")\n"} +{"problem_id": "p03013", "input": "N, M = list(map(int, input().split()))\n\nA_ = [int(input()) for _ in range(M)]\n\nA = [0] * (N+3)\n\nfor a in A_:\n\n A[a] = 1\n\ndp = [0] * (N+3)\n\ndp[0] = 1\n\n\n\nmod = 10**9+7\n\n\n\nfor i in range(1, N+1):\n\n if A[i-1] == 0:\n\n dp[i] += dp[i-1]\n\n if A[i-2] == 0:\n\n dp[i] += dp[i-2]\n\n dp[i] %= mod\n\nprint((dp[N]))"} +{"problem_id": "p02792", "input": "n=int(input())\n\nD={}\n\nDD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n t=(str(i)[-1],str(i)[0])\n\n if s not in D:\n\n D[s]=1\n\n else:\n\n D[s]+=1\n\n if t not in DD:\n\n DD[t]=1\n\n else:\n\n DD[t]+=1\n\nans=0\n\nfor i in D:\n\n if i in DD:\n\n ans+=D[i]*DD[i]\n\nprint(ans)\n\n "} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\nans = 0\n\n\n\nans =math.factorial(N) % (10**9 +7)\n\n\n\nprint(ans)"} +{"problem_id": "p03078", "input": "X,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nalready = [[0,0,0]]\n\nx,y,z = 0,0,0\n\nplace_sum = []\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n place_sum.append([x + 1,y,z])\n\n check.append(asort[x + 1] + bsort[y] + csort[z])\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n place_sum.append([x,y + 1,z])\n\n check.append(asort[x] + bsort[y + 1] + csort[z])\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n place_sum.append([x,y,z + 1])\n\n check.append(asort[x] + bsort[y] + csort[z + 1])\n\n print((max(check)))\n\n x,y,z = place_sum[check.index(max(check))][0],place_sum[check.index(max(check))][1],place_sum[check.index(max(check))][2]\n\n place_sum.pop(check.index(max(check)))\n\n check.remove(max(check))"} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nn=max(x,y)\n\nfor i in range(1,n+1):\n\n ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))\n\nprint(ans)\n\n\n\n\n"} +{"problem_id": "p03325", "input": "answer = 0\n\nN = int(input())\n\nA = list(map(int,input().split()))\n\nfor i in range(N) :\n\n while A[i] % 2 == 0 :\n\n A[i] = A[i] / 2\n\n answer += 1\n\nprint(answer)\n\n\n"} +{"problem_id": "p03034", "input": "import sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n for C in range(1, N//2):\n\n n = N // C\n\n point = 0\n\n used = set([0])\n\n for k in range(1, n):\n\n A = N - 1 - k*C\n\n\n\n if A in used or k*C in used or A == k*C:\n\n break\n\n used.add(A)\n\n used.add(k*C)\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n"} +{"problem_id": "p03038", "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(input())\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N,M=MI()\n\n A=LI()\n\n CB=[[0,0]for _ in range(M)]\n\n A.sort()\n\n for i in range(M):\n\n CB[i][1],CB[i][0]=MI()\n\n \n\n CB.sort(reverse=True)\n\n now=0\n\n \n\n for i in range(N):\n\n if CB[now][1]<=0:\n\n now+=1\n\n \n\n if now>=M:\n\n break \n\n \n\n ch=CB[now][0]\n\n if A[i] bi:\n\n ans = False\n\n\n\nprint((\"Yes\" if ans else \"No\"))"} +{"problem_id": "p03416", "input": "n, m = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n, m+1):\n\n if str(i)[0]+str(i)[1] == str(i)[-1]+str(i)[-2]: ans += 1\n\nprint(ans)"} +{"problem_id": "p00001", "input": "ans=[]\n\nfor i in range (0,10):\n\n ans.append(int(input()))\n\nans.sort(reverse=True)\n\nfor i in range (0,3):\n\n print((ans[i]))"} +{"problem_id": "p02555", "input": "# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n cnt = 0\n\n\n\n for j in range(3, i+1):\n\n cnt += dp[i-j]\n\n cnt %= mod\n\n \n\n dp[i] = cnt\n\n\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n"} +{"problem_id": "p02785", "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n if K>=N:\n\n return 0\n\n H.sort()\n\n ans = sum(H[:N-K])\n\n return ans\n\nprint((solve()))"} +{"problem_id": "p03835", "input": "k, s = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n if 0<=s-x-y<=k:\n\n ans += 1\n\n \n\nprint(ans)"} +{"problem_id": "p03680", "input": "import sys\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(1e6):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))"} +{"problem_id": "p03796", "input": "import math\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n power = math.factorial(N)\n\n print((power % (10 ** 9 + 7)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n"} +{"problem_id": "p02282", "input": "def post_from_pre_in(preorder_elements, inorder_elements):\n\n if preorder_elements:\n\n global cnt\n\n root = preorder_elements[0]\n\n root_index = inorder_elements.index(root)\n\n preorder_left = preorder_elements[1:root_index+1]\n\n inorder_left = inorder_elements[:root_index]\n\n preorder_right = preorder_elements[root_index+1:]\n\n inorder_right = inorder_elements[root_index+1:]\n\n post_from_pre_in(preorder_left, inorder_left)\n\n post_from_pre_in(preorder_right, inorder_right)\n\n if cnt:\n\n print(root, end = ' ')\n\n cnt -= 1\n\n else:\n\n print(root)\n\n\n\n\n\ncnt = int(input()) - 1\n\n\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\n\n\npost_from_pre_in(a, b)\n"} +{"problem_id": "p03078", "input": "def main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\td = [0]*x*y\n\n\tfor i in range(x):\n\n\t\tfor j in range(y):\n\n\t\t\td[i*y+j] = a[i]+b[j]\n\n\td.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\n\n\tc_len = min(k, z)\n\n\td_len = min(k, x*y)\n\n\te = [0]*d_len*c_len\n\n\tfor i in range(d_len):\n\n\t\tfor j in range(c_len):\n\n\t\t\te[i*c_len+j] = d[i] + c[j]\n\n\te.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((e[i]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()"} +{"problem_id": "p00713", "input": "from math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) / d) / 2.0\n\n xc = (x1 + x2) / 2.0\n\n yc = (y1 + y2) / 2.0\n\n return [[xc - k*yd, yc + k*xd], [xc + k*yd, yc - k*xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = [list(map(float, input().split())) for i in range(n)]\n\n p.sort()\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - bx >= 2.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)"} +{"problem_id": "p03074", "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n _S = input()\n\n S = []\n\n b = _S[0]\n\n s = 0\n\n if b == '0': S.append(0)\n\n for _s in _S:\n\n if b == _s:\n\n s = s + 1\n\n else:\n\n b = _s\n\n S.append(s)\n\n s = 1\n\n S.append(s)\n\n if b == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n\n n = sum(S[0:num])\n\n m = n\n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n\n for i in range(0, len(S) - num, 2):\n\n n = n - sum(S[i:i+2])\n\n n = n + sum(S[i + num:i + num + 2])\n\n m = max(m, n)\n\n\n\n return m\n\n\n\nprint((solve()))"} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\nans = math.factorial(N) % (10 ** 9 + 7)\n\nprint(ans)"} +{"problem_id": "p03371", "input": "#python3\n\nINF = int(1e9)\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF\n\n for i in range(2*10**5+100):\n\n t = 2*c*i + max(x-i, 0) * a + max(y-i, 0) * b\n\n ans = min(ans, t)\n\n print(ans)\n\nmain()"} +{"problem_id": "p03828", "input": "from functools import reduce\n\nN = int(input())\n\n\n\nprime_table = [1] * (N+1)\n\n\n\nfor x in range(2, N+1):\n\n for t in range(2, x+1):\n\n while x % t == 0:\n\n prime_table[t] += 1\n\n x //= t\n\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))"} +{"problem_id": "p03835", "input": "K,S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor i in range(K+1):\n\n\tfor j in range(K+1):\n\n\t\tif (S - i - j) <= K and (S-i-j) >= 0:\n\n\t\t\tans += 1\n\n\n\nprint(ans)\n"} +{"problem_id": "p02412", "input": "while 1:\n\n ans=0\n\n n,x=list(map(int,input().split()))\n\n if n:\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n for k in range(j+1,n+1):\n\n if i+j+k==x:ans+=1\n\n else:break\n\n print(ans)"} +{"problem_id": "p02767", "input": "def main():\n\n from statistics import mean\n\n from math import floor,ceil\n\n\n\n n = int(input())\n\n x = list(map(int, input().split()))\n\n x_mean = mean(x) \n\n if x_mean == 0.5:\n\n greater_than_x = len([i for i in x if i > x_mean])\n\n if greater_than_x * 2 >= n:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n elif x_mean % 1 > 0.5:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n x2 = [(num - x_mean)**2 for num in x]\n\n print((sum(x2)))\n\n\n\nmain()"} +{"problem_id": "p03854", "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef solve():\n\n S = input()\n\n # print(S, len(S))\n\n\n\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n\n\n\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n\n\n def recur(i, w):\n\n if not TABLE[w][i] == -1:\n\n return TABLE[w][i]\n\n\n\n if i >= len(S):\n\n # print(\"jey\", log)\n\n return True\n\n\n\n r1, r2, r3, r4 = False, False, False, False\n\n if S[i:i + 5] == words[0]:\n\n r1 = recur(i + 5, 0)\n\n if S[i:i + 7] == words[1]:\n\n r2 = recur(i + 7, 1)\n\n if S[i:i + 5] == words[2]:\n\n r3 = recur(i + 5, 2)\n\n if S[i:i + 6] == words[3]:\n\n r4 = recur(i + 6, 3)\n\n\n\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n\n\n\n return TABLE[w][i]\n\n\n\n ans = recur(0, 0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n"} +{"problem_id": "p02773", "input": "from collections import defaultdict\n\n\n\nN = int(input())\n\nA = [input() for _ in range(N)]\n\nA.sort()\n\nd = defaultdict(int)\n\nfor a in A:\n\n d[a] += 1\n\n\n\nl = sorted(d.items())\n\nmax_v = 0\n\n\n\nfor _, v in l:\n\n if v > max_v:\n\n max_v = v\n\n \n\nfor k, v in l:\n\n if v == max_v:\n\n print(k)\n\n else:\n\n continue\n"} +{"problem_id": "p02691", "input": "n = int(input())\n\na = list(map(int, input().split()))\n\na_index = []\n\nfor i in range(n):\n\n a_index.append((i, a[i]))\n\ndic1 = {}\n\ndic2 = {}\n\nfor i in range(n):\n\n one = a_index[i][0] + a_index[i][1]\n\n two = a_index[i][0] - a_index[i][1]\n\n if one not in dic1:\n\n dic1[one] = 1\n\n else:\n\n dic1[one] += 1\n\n if two not in dic2:\n\n dic2[two] = 1\n\n else:\n\n dic2[two] += 1\n\nans = 0\n\nfor i in list(dic1.keys()):\n\n if i in dic2:\n\n ans += dic2[i] * dic1[i]\n\nfor i in list(dic2.keys()):\n\n if i in dic1:\n\n ans += dic1[i] * dic2[i]\n\n #print(i)\n\nprint((ans // 2))\n"} +{"problem_id": "p03835", "input": "k,s=list(map(int,input().split()))\n\nans=chk=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if (0<=s-i-j<=k): ans+=1\n\nprint(ans)"} +{"problem_id": "p03564", "input": "N,K = int(input()), int(input())\n\nnow = 1\n\nfor i in range(N):\n\n if now*2 < now + K:\n\n now *= 2\n\n else:\n\n now += K\n\nprint(now)\n"} +{"problem_id": "p02881", "input": "import math\n\nn=int(input())\n\nans=n\n\ni=1\n\nwhile(i<=math.sqrt(n)):\n\n if n%i==0:\n\n d=i+n/i-2\n\n ans=min(ans,d)\n\n i+=1\n\nprint((int(ans)))"} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\n\n\npower = math.factorial(N)\n\n\n\nprint((power % 1000000007))\n\n\n"} +{"problem_id": "p03170", "input": "n, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii <= k:\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n"} +{"problem_id": "p02622", "input": "S, T = [list(input()) for _ in range(2)]\n\ncnt = 0\n\nfor i in range(len(S)):\n\n if S[i] != T[i]:\n\n cnt += 1\n\nprint(cnt)\n"} +{"problem_id": "p02886", "input": "N = int(input())\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N-1):\n\n for j in range(i+1,N):\n\n cnt += D[i]*D[j]\n\nprint(cnt)"} +{"problem_id": "p03370", "input": "N, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(input())\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x // min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n if x >= min(mn):\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)"} +{"problem_id": "p02596", "input": "#! /usr/bin/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\n\n\ndef isMultiple(s, m):\n\n tmp = 0\n\n for i in range(len(s)):\n\n tmp = (tmp * 10 + int(s[i])) % m\n\n if tmp == 0:\n\n return i\n\n return -1\n\n\n\n\n\nk = int(readline())\n\nacc = \"7\" * 50000000\n\nif k % 2 == 0:\n\n ans = -1\n\nelse:\n\n\n\n ans = isMultiple(acc, k)\n\n if ans != -1:\n\n ans += 1\n\n\n\nprint(ans)\n"} +{"problem_id": "p02615", "input": "n,*l=list(map(int,open(0).read().split()));print((sum(sorted(l*2)[-2:~n:-1])))"} +{"problem_id": "p02881", "input": "import math\n\nN = int(input())\n\nfor i in range(int(math.sqrt(N))):\n\n if N % (int(math.sqrt(N))-i) == 0:\n\n print((int(N/(int(math.sqrt(N))-i)+int(math.sqrt(N))-i-2)))\n\n break"} +{"problem_id": "p02994", "input": "N, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple():\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)//2 - eat_apple()))"} +{"problem_id": "p03363", "input": "from collections import Counter\n\n\n\nN = int(input())\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\nruisekiwa = [0] * (N+1)\n\n\n\nfor i in range(N):\n\n ruisekiwa[i+1] = ruisekiwa[i] + inputs[i]\n\n\n\nruisekiwa = ruisekiwa[1:]\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n"} +{"problem_id": "p03457", "input": "import sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n T = [list(map(int, _input().split())) for _ in range(N)]\n\n t, x, y = 0, 0, 0\n\n for next_t, next_x, next_y in T:\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()"} +{"problem_id": "p03107", "input": "S = [int(_) for _ in input()]\n\nlength = len(S)\n\ntemp = [S[0]]\n\nfor x in S[1:]:\n\n if(len(temp) == 0):\n\n temp.append(x)\n\n elif( temp[-1] == x):\n\n temp.append(x)\n\n else:\n\n temp.pop(-1)\n\nprint((length-len(temp)))\n\n "} +{"problem_id": "p02596", "input": "K = int(input())\n\n\n\nflg = [False]*K\n\n\n\ntmp = 7 % K\n\ncnt = 1\n\nif tmp == 0:\n\n print(cnt)\n\n exit()\n\nwhile True:\n\n tmp = (tmp*10+7)%K\n\n if flg[tmp]:\n\n print((-1))\n\n break\n\n else:\n\n cnt += 1\n\n if tmp == 0:\n\n print(cnt)\n\n break\n\n flg[tmp] = True\n"} +{"problem_id": "p03796", "input": "from math import factorial\n\nprint((factorial(int(input())) % (10**9+7)))"} +{"problem_id": "p03822", "input": "import sys\n\nsys.setrecursionlimit(202020)\n\n\n\nN = int(input())\n\nwon = [[] for i in range(N)]\n\nfor i in range(1,N):\n\n a = int(input()) - 1\n\n won[a].append(i)\n\n\n\ndef height(v):\n\n if not won[v]: return 0\n\n hs = [height(op) for op in won[v]]\n\n ret = 0\n\n for i,h in enumerate(sorted(hs)):\n\n ret = max(ret, h + len(hs) - i)\n\n return ret\n\n\n\nprint((height(0)))"} +{"problem_id": "p02595", "input": "N, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a**2 + b**2) <= D**2:\n\n count += 1\n\nprint(count)\n"} +{"problem_id": "p03309", "input": "# ABC102C - Linear Approximation (ARC100C)\n\nfrom statistics import median\n\n\n\n\n\ndef main():\n\n n = int(input())\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = tuple(j - i for i, j in enumerate(A, start=1))\n\n b = median(A)\n\n ans = sum(abs(a - b) for a in A)\n\n print((int(ans)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()"} +{"problem_id": "p01105", "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nL = {el: 1 for el in [a, b, c, d, e, 0]}\n\nfor i in range(6):\n\n R = sorted(L.items(), key=lambda x: x[1])\n\n for p, l in R:\n\n if l < 16:\n\n L[p ^ e] = min(L.get(p ^ e, 16), l+1)\n\n if l+3 < 16:\n\n for q, r in R:\n\n if l+r+3 <= 16:\n\n L[p & q] = min(L.get(p & q, 16), l+r+3)\n\n L[p ^ q] = min(L.get(p ^ q, 16), l+r+3)\n\n else: break\n\n else: break\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n"} +{"problem_id": "p02792", "input": "#python3\n\nfrom collections import defaultdict\n\nfrom collections import namedtuple\n\n\n\nP = namedtuple('P', ['front', 'end'])\n\n\n\ndef f(x):\n\n return P(str(x)[0], str(x)[-1]) \n\n\n\ndef main():\n\n\n\n n = int(input())\n\n freq = defaultdict(int)\n\n\n\n for i in range(1, n+1):\n\n p = f(i)\n\n freq[p]+=1\n\n\n\n\n\n ans = 0\n\n for i in range(1, n + 1):\n\n p = f(i)\n\n q = (p.end, p.front)\n\n ans += freq[q]\n\n\n\n print(ans)\n\n\n\nmain()"} +{"problem_id": "p03038", "input": "n, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(key=lambda x: x[1], reverse=True)\n\na.sort()\n\n\n\ni = 0\n\nfor b, c in bc:\n\n for _ in range(b):\n\n if i < n and a[i] < c:\n\n a[i] = c\n\n i += 1\n\n else:\n\n break\n\n\n\nans = sum(a)\n\nprint(ans)\n"} +{"problem_id": "p01138", "input": "def f(s):\n\n s=list(map(int,s.split(':')))\n\n return (s[0]*60+s[1])*60+s[2]\n\na=86401\n\nwhile 1:\n\n t=[0]*a\n\n n=int(input())\n\n if n==0:break\n\n for _ in range(n):\n\n b,c=input().split()\n\n t[f(b)]+=1;t[f(c)]-=1\n\n d=0\n\n for i in range(1,a):\n\n t[i]+=t[i-1]\n\n d=max(d,t[i])\n\n print(d)"} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))\n"} +{"problem_id": "p03107", "input": "S = list(input())\n\nnum_one = S.count(\"1\")\n\nnum_zero = S.count(\"0\")\n\nans = min(num_one, num_zero) *2\n\nprint(ans)\n"} +{"problem_id": "p03457", "input": "import sys\n\ncan = True; input()\n\ne = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]\n\nfor a, b in zip(e[1:], e):\n\n t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])\n\n if t < 0 or t % 2 == 1: can = False; break\n\nprint((['No', 'Yes'][can]))"} +{"problem_id": "p02901", "input": "import sys\n\nreadline = sys.stdin.readline\n\n\n\nN,M = list(map(int,readline().split()))\n\nINF = 10 ** 10\n\ndp = [INF] * (2 ** N)\n\ndp[0] = 0\n\n\n\nfor i in range(M):\n\n a,b = list(map(int,readline().split()))\n\n c = list(map(int,readline().split()))\n\n key = 0\n\n for j in range(len(c)):\n\n key += (1 << (c[j] - 1))\n\n for j in range(len(dp)):\n\n if dp[j] == INF:\n\n continue\n\n if j | key == j:\n\n continue\n\n dp[j | key] = min(dp[j | key], dp[j] + a)\n\n\n\nif dp[-1] == INF:\n\n print((-1))\n\nelse:\n\n print((dp[-1]))"} +{"problem_id": "p02721", "input": "N, K, C = list(map(int, input().split()))\n\nS = input()\n\n\n\nlatest = [None]*K\n\ni = len(S)+C\n\nfor j in range(K-1, -1, -1):\n\n i = S.rindex(\"o\", 0, i-C)\n\n latest[j] = i\n\n\n\nif i<=C or \"o\" not in S[:i-C]:\n\n i = -C-1\n\n for j in latest:\n\n i = S.index(\"o\", i+C+1)\n\n if i == j:\n\n print((i+1))\n"} +{"problem_id": "p02688", "input": "N, K = list(map(int, input().split()))\n\nsunuke = [True]*N\n\nfor i in range(K):\n\n d = int(input())\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n sunuke[a-1] = False\n\n\n\nans = 0\n\nfor i in range(N):\n\n if sunuke[i]:\n\n ans += 1\n\nprint(ans)"} +{"problem_id": "p03796", "input": "import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n import math\n\n n=int(input())\n\n print((math.factorial(n)%(10**9+7)))\n\nresolve()"} +{"problem_id": "p03416", "input": "A,B = list(map(int,input().split()))\n\nj = 0\n\nfor i in range(A,B+1):\n\n l = list(str(i))\n\n l_reverse = list(reversed(l))\n\n if l == l_reverse:\n\n j += 1\n\nprint(j)"} +{"problem_id": "p02390", "input": "s = int(input())\n\nm, s = s // 60, s % 60\n\nh, m = m // 60, m % 60\n\nprint((':'.join(map(str, [h,m,s]))))"} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))"} +{"problem_id": "p03819", "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = map(int, input().split())\n\n LR = [list(map(int, input().split())) for _ in range(n)]\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n \n\n S = sorted([(r-l+1, l, r) for l, r in LR], reverse=True)\n\n cnt = n\n\n L = []\n\n for i in range(1, m+1):\n\n while S and S[-1][0] == i:\n\n c, l, r = S.pop()\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n L.append(res)\n\n print(*L, sep=\"\\n\")\n\n\n\nif __name__ == \"__main__\":\n\n main()\n"} +{"problem_id": "p03126", "input": "import functools\n\nprint((len(functools.reduce(lambda x, y: x&y,[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))"} +{"problem_id": "p03480", "input": "#!/usr/bin/env python3\n\n# coding=utf-8\n\n\n\nimport sys\n\n\n\ns = sys.stdin.readline().strip()\n\nl = [_s is \"1\" for _s in list(s)]\n\nl_r = l[::-1]\n\nindex = 0\n\nfor i, (c, n, c_r, n_r) in enumerate(\n\n zip(l[:len(s) // 2], l[1:len(s) // 2 + 1], l_r[:len(s) // 2], l_r[1:len(s) // 2 + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\nprint((len(s) - index))"} +{"problem_id": "p03325", "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\n\n\nSUM = 0\n\nfor i in A:\n\n count = 0\n\n while i%2 == 0:\n\n i//=2\n\n count += 1\n\n SUM+=count\n\nprint(SUM)"} +{"problem_id": "p03796", "input": "n = int(input())\n\n\n\nINF = 10**9 + 7\n\n\n\nans = [0] * (10**5 + 1)\n\nans[0] = 1\n\n\n\nfor i in range(1,10**5 + 1):\n\n ans[i] = ans[i-1] * i % INF\n\n\n\nprint((ans[n]))\n"} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nm = max(x, y)\n\nfor i in range(1, m+1):\n\n x -= 1\n\n y -= 1\n\n if x < 0:\n\n x = 0\n\n if y < 0:\n\n y = 0\n\n temp = c*(i*2) + x*a + y*b\n\n if temp < ans:\n\n ans = temp\n\n\n\nprint(ans)\n"} +{"problem_id": "p03798", "input": "n=int(input())\n\ns=input()\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\n\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n #print(x[i])\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n"} +{"problem_id": "p03162", "input": "# coding: utf-8\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [[0] * 3 for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n for j in range(3):\n\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] \\\n\n for k in range(3) if k != j)\n\n return(max(dp[n]))\n\n\n\nn = int(input()) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n"} +{"problem_id": "p02595", "input": "N, D = list(map(int, input().split()))\n\npoint = []\n\nfor i in range(N):\n\n point.append(list(map(int, input().split())))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in point:\n\n if (i[0]**2 + i[1]**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)"} +{"problem_id": "p03796", "input": "from math import factorial\n\n\n\nmod = 10**9 + 7\n\nn = int(input())\n\n\n\nans = factorial(n) % mod\n\nprint(ans)"} +{"problem_id": "p03078", "input": "import heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\ndef diff(l):\n\n m = max(l)\n\n return sorted(m - v for v in l)[1:]\n\n\n\ns = sum(map(max, [a, b, c]))\n\nsa, sb, sc = list(map(diff, [a, b, c]))\n\nda, db, dc = [0], [0], [0]\n\nq = [0]\n\nwhile k > 0:\n\n while True:\n\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n\n heapq.heappush(q, v)\n\n da.append(sa[0])\n\n sa = sa[1:]\n\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n\n heapq.heappush(q, v)\n\n db.append(sb[0])\n\n sb = sb[1:]\n\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n\n heapq.heappush(q, v)\n\n dc.append(sc[0])\n\n sc = sc[1:]\n\n else:\n\n break\n\n v = heapq.heappop(q)\n\n print(s - v)\n\n k -= 1\n"} +{"problem_id": "p02837", "input": "N = int(input())\n\nA = [0]*N\n\nX = []\n\nY = []\n\nfor i in range(N):\n\n A[i] = int(input())\n\n X.append([])\n\n Y.append([])\n\n for j in range(A[i]):\n\n x, y = list(map(int, input().split()))\n\n X[i].append(x-1)\n\n Y[i].append(y)\n\nans = 0\n\nfor bit in range(1<= k:\n\n print(a)\n\n exit()\n\n\n"} +{"problem_id": "p03197", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\ndef dfs(x, y):\n\n if x==0 and y==0:\n\n t[x][y] = False\n\n return False\n\n \n\n if x>=1:\n\n t[x][y] |= not dfs(x-1, y)\n\n \n\n if y>=1:\n\n t[x][y] |= not dfs(x, y-1)\n\n \n\n if min(x, y)>=1:\n\n t[x][y] |= not dfs(x-1, y-1)\n\n \n\n return t[x][y]\n\n \n\nt = [[False]*7 for _ in range(7)]\n\n\n\nfor i in range(7):\n\n for j in range(7):\n\n dfs(i, j)\n\n\n\n\"\"\"\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(input())\n\nflag = True\n\n\n\nfor _ in range(N):\n\n a = int(input())\n\n \n\n if a%2==1:\n\n flag = False\n\n \n\nif flag:\n\n print('second')\n\nelse:\n\n print('first')"} +{"problem_id": "p03416", "input": "a,b=list(map(int, input().split()))\n\ncnt=0\n\nfor i in range(a,b+1):\n\n n=list(str(i))\n\n if n==list(reversed(n)):\n\n cnt+=1\n\nprint(cnt)"} +{"problem_id": "p03416", "input": "a, b = list(map(int, input().strip().split(\" \")))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\nprint(count)\n"} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\np = math.factorial(N)\n\nprint((p % 1000000007))"} +{"problem_id": "p02891", "input": "import sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(input())\n\n \n\ndef check_count(s):\n\n cnt_list = [1]\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt_list[-1] += 1\n\n else:\n\n cnt_list.append(1)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c//2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k//2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)//2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)"} +{"problem_id": "p02881", "input": "N = int(input())\n\n\n\n\n\ndef dist(i, j):\n\n return i + j - 2\n\n\n\n\n\nmin = 10 ** 24\n\ni = 1\n\nwhile (i ** 2) <= N:\n\n if 0 == N % i:\n\n j = N // i\n\n d = dist(i, j)\n\n if min > d:\n\n min = d\n\n i += 1\n\nprint(d)\n"} +{"problem_id": "p02552", "input": "n = int(input())\n\nprint((1 if n == 0 else 0))\n"} +{"problem_id": "p03039", "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n ans += f1(x,y,n,m)+f1(1,1,x,y)+f1(1,y,x,m)+f1(x,1,n,y)\n\n ans -= f2(x,n) + f2(1,x) + f2(1,y) + f2(y,m)\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n"} +{"problem_id": "p03013", "input": "import sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\n\n\nl = [0] * (n+1)\n\nl[0] = 1\n\n\n\na = 0\n\nif m != 0:\n\n a = int(input())\n\nk = 1\n\nfor i in range(n+1):\n\n\n\n if i != a:\n\n if i == 1:\n\n l[i] = 1\n\n elif i >= 2:\n\n l[i] = l[i-1] + l[i-2]\n\n l[i] %= 1000000007\n\n else:\n\n k += 1\n\n if k <= m:\n\n a = int(input())\n\n\n\n\n\n\n\n#print(l)\n\nprint((l[n] % 1000000007))\n"} +{"problem_id": "p03013", "input": "N,M = list(map(int,input().split()))\n\nMOD = 10**9+7\n\ndp = [0]*(N+1)\n\ndp[0]=1\n\nA = [int(input()) for i in range(M)]\n\nban = [1]*(N+1)\n\nfor a in A:\n\n ban[a]=0\n\nfor i in range(N):\n\n if i-1>=0:\n\n dp[i+1]=dp[i]*ban[i]+dp[i-1]*ban[i-1]\n\n else:\n\n dp[i+1]=dp[i]*ban[i]\n\n dp[i+1] %= MOD \n\nprint((dp[N]))"} +{"problem_id": "p03371", "input": "def main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p02245", "input": "import sys\n\n\n\ninit = ''.join(sys.stdin.read().split())\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start, goal):\n\n if start == goal:\n\n return 0\n\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n\n step = {start: 0, goal: 0}\n\n s = 0\n\n c_d = [(start, 0), (goal, 1)] # configure and direction\n\n while True:\n\n q = iter(c_d)\n\n c_d = []\n\n s += 1\n\n for c, d in q:\n\n i = c.find('0')\n\n if 0 <= i <= 5:\n\n t = str.maketrans('0' + c[i+3], c[i+3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i >= 3:\n\n t = str.maketrans('0' + c[i-3], c[i-3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n\n t = str.maketrans('0' + c[i+1], c[i+1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n\n t = str.maketrans('0' + c[i-1], c[i-1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n\n\nprint((solve(init, '123456780')))"} +{"problem_id": "p02837", "input": "def popcount(x):\n\n r, q = 0, x\n\n while x:\n\n r += 1\n\n x &= x - 1\n\n return r, q\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\nl = (1 << n) - 1 \n\nb = sorted(map(popcount, list(range(1, l + 1))))\n\nans = next((i for i, x in reversed(b)\n\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)), 0)\n\nprint(ans)\n"} +{"problem_id": "p03634", "input": "import queue\n\nn = int(input())\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\nwhile not q.empty():\n\n tmp = q.get()\n\n for i in range(len(abc[tmp])):\n\n #print(abc[tmp])\n\n #exit()\n\n num = abc[tmp][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[tmp] + abc[tmp][i][1]\n\n q.put(num)\n\n \n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))"} +{"problem_id": "p02394", "input": "W,H,x,y,r = [int(i) for i in input().split()]\n\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")"} +{"problem_id": "p03325", "input": "from math import log2\n\nn = int(input())\n\na = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor _a in a:\n\n if _a%2 == 0:\n\n cnt =0\n\n while _a%2 == 0:\n\n _a //= 2\n\n cnt += 1\n\n ans += cnt\n\n\n\nprint((int(ans)))"} +{"problem_id": "p02685", "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n ret = p\n\n inv = pow(m-1, mod-2, mod)\n\n for i in range(1, k+1):\n\n ncr = (ncr * (n-i)*pow(i, mod-2, mod)) % mod\n\n p = (p*inv) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n"} +{"problem_id": "p03828", "input": "import collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,n+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num //= i ; ans.append(i)\n\n return ans\n\n\n\nn = int(input())\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n"} +{"problem_id": "p02794", "input": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(input())\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()"} +{"problem_id": "p02612", "input": "'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(input())\n\ndef si():return input()\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n#mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile = 0\n\n\n\ndef solve():\n\n \n\n\n\n\n\n\n\n # for _ in range(ii()):\n\n\n\n n=ii()\n\n n%=1000\n\n if n!=0:\n\n n=1000-n\n\n print(n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()"} +{"problem_id": "p02685", "input": "M=998244353\n\nn,m,k=list(map(int,input().split()))\n\na=0\n\nc=1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n-i-1,M)\n\n c=c*(n-i-1)*pow(i+1,M-2,M)%M\n\nprint((a%M))"} +{"problem_id": "p03680", "input": "N = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(10 ** 6):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))"} +{"problem_id": "p02555", "input": "import math\n\n\n\n\n\ndef combinations_count(n, r):\n\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n s = int(input())\n\n ans = 0\n\n n = s // 3\n\n\n\n for i in range(1, n + 1):\n\n ans += combinations_with_replacement_count(i, 3*(n-i)+s % 3)\n\n\n\n print((ans % (10**9 + 7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03806", "input": "G_MAX = 40*10\n\nN_MAX = 40\n\nINF = float('inf')\n\n\n\ndp = [[[INF]*(G_MAX+1) for _ in range(G_MAX+1)] \n\n for _ in range(N_MAX+1)]\n\nN,Ma,Mb = list(map(int, input().split()))\n\na,b,c = [],[],[]\n\nfor _ in range(N):\n\n ai,bi,ci = list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\n c.append(ci)\n\n\n\ndp[0][0][0] = 0\n\nfrom math import isinf\n\nfor i in range(N):\n\n for ca in range(G_MAX+1):\n\n for cb in range(G_MAX+1):\n\n if isinf(dp[i][ca][cb]): continue\n\n dp[i+1][ca][cb] = min(dp[i+1][ca][cb],\n\n dp[i][ca][cb])\n\n dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]],\n\n dp[i][ca][cb]+c[i])\n\n \n\n \n\nans = INF\n\nfor ca in range(1,G_MAX+1):\n\n for cb in range(1,G_MAX+1):\n\n if ca*Mb==cb*Ma:\n\n ans = min(ans, dp[N][ca][cb])\n\n \n\nif isinf(ans): ans = -1\n\nprint(ans)"} +{"problem_id": "p03568", "input": "from itertools import product\n\n\n\nn = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ncount = 0\n\nfor C in product((-1, 0, 1), repeat=n):\n\n total = 1\n\n for a, c in zip(A, C):\n\n total *= (a + c)\n\n if total % 2 == 0:\n\n count += 1\n\nprint(count)"} +{"problem_id": "p03164", "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n,W=list(map(int,input().split()))\n\n WV=[tuple(map(int,input().split())) for _ in range(n)]\n\n\n\n V=100000\n\n dp=[INF]*(V+1)\n\n dp[0]=0\n\n\n\n for w,v in WV:\n\n for x in range(V,-1,-1):\n\n if(x+v<=V):\n\n dp[x+v]=min(dp[x+v],dp[x]+w)\n\n\n\n for x in range(V,-1,-1):\n\n if(dp[x]<=W):\n\n print(x)\n\n return\n\nresolve()"} +{"problem_id": "p02691", "input": "from collections import defaultdict\n\n\n\n\n\ndef main():\n\n _ = int(input())\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n L[i + height] += 1\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n"} +{"problem_id": "p03039", "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)//2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n"} +{"problem_id": "p03253", "input": "N,M = list(map(int,input().split()))\n\ndiv =[]\n\nfor i in range(2,int(M**(1/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M = M//i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1: div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum = len(frac)\n\nfor i in range(len(frac)-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1] * (N+50)\n\nfinv[-1] = pow(frac[-1], mod-2, mod)\n\nfor i in range(1, num):\n\n finv[num-1-i] = finv[num-i] * (num-i) % mod\n\nans = 1\n\nfor i in div:\n\n ans = ans * frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)"} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(c_max+1):\n\n ac = x - (cc // 2)\n\n bc = y - (cc // 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)"} +{"problem_id": "p03425", "input": "N = int(input())\n\nname = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor _ in range(N):\n\n S = input()\n\n if(S[0] in name):\n\n name[S[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += name[march[i]] * name[march[j]] * name[march[k]]\n\nprint(ans)"} +{"problem_id": "p02899", "input": "n = int(input())\n\na = list(map(int,input().split()))\n\nans = [i for i in range(n)]\n\na1 = sorted(a)\n\nfor i in range(n):\n\n num = a[i]\n\n ans[num - 1] = str(i + 1)\n\n \n\nprint((' '.join(ans)))"} +{"problem_id": "p02901", "input": "INF = 2*10**7\n\n\n\n\n\ndef main():\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p03253", "input": "def prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num //= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\nfrom math import factorial\n\n\n\n\n\ndef comb(n, r, R):\n\n if n not in R:\n\n a = factorial(n)\n\n R[n] = a\n\n else:\n\n a = R[n]\n\n\n\n if n - r not in R:\n\n b = factorial(n - r)\n\n R[n - r] = b\n\n else:\n\n b = R[n - r]\n\n\n\n if r not in R:\n\n c = factorial(r)\n\n R[r] = c\n\n else:\n\n c = R[r]\n\n return a // (b * c)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nR = dict()\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= comb(v + n - 1, v, R)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n"} +{"problem_id": "p02951", "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif a < b + c:\n\n print((b+c-a))\n\nelse:\n\n print((0))"} +{"problem_id": "p03038", "input": "from collections import Counter\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\nX = Counter(A)\n\nfor i in range(M):\n\n B, C = list(map(int, input().split()))\n\n X[C] += B\n\n\n\nZ = []\n\nfor key, value in list(X.items()):\n\n Z.append((key, value))\n\n\n\nZ.sort(key=lambda x: x[0], reverse=True)\n\n\n\nans = 0\n\ncnt = 0\n\n\n\nfor value, key in Z:\n\n if cnt + key <= N:\n\n ans += key * value\n\n cnt += key\n\n else:\n\n ans += (N - cnt) * value\n\n break\n\n\n\nprint(ans)\n"} +{"problem_id": "p03723", "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif any(i % 2 != 0 for i in [a, b, c]):\n\n print((0))\n\n exit()\n\n\n\nif a == b and b == c:\n\n print((-1))\n\n exit()\n\n\n\ncnt = 0\n\na_list = [0]*(1001001)\n\nb_list = [0]*(1001001)\n\nc_list = [0]*(1001001)\n\na_list[0] = a\n\nb_list[0] = b\n\nc_list[0] = c\n\n\n\nfor i in range(1, 1001001):\n\n a_list[i] = (b_list[i-1] + c_list[i-1]) // 2\n\n b_list[i] = (c_list[i-1] + a_list[i-1]) // 2\n\n c_list[i] = (a_list[i-1] + b_list[i-1]) // 2\n\n cnt += 1\n\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n\n break\n\n\n\nprint(cnt)\n"} +{"problem_id": "p03013", "input": "from functools import lru_cache\n\nimport sys\n\nsys.setrecursionlimit(30000)\n\n\n\nN, M = list(map(int, input().split()))\n\na = list(int(input()) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nisOk = True\n\nfor i in range(M-1):\n\n if a[i] + 1 == a[i+1]:\n\n isOk = False\n\n \n\nfuncb = [-1] * 100001\n\ndef func(n):\n\n if n <= 0:\n\n return 1\n\n cnt = funcb[n]\n\n if cnt > 0:\n\n return cnt\n\n cnt = 0\n\n if n >= 2:\n\n cnt += func(n-2)\n\n if n >= 1:\n\n cnt += func(n-1)\n\n funcb[n] = cnt % MOD\n\n return funcb[n]\n\n\n\nfunc(30000)\n\nfunc(50000)\n\nfunc(80000)\n\nfunc(100000)\n\n\n\nif not isOk:\n\n print((0))\n\nelse:\n\n ans = 1\n\n s = 0\n\n for i in range(M+1):\n\n if i >= M:\n\n e = N\n\n else:\n\n e = a[i] - 1\n\n\n\n ans = ans * func(e-s) % MOD\n\n\n\n if i >= M:\n\n break\n\n\n\n s = a[i] + 1\n\n\n\n print(ans)\n"} +{"problem_id": "p02921", "input": "# 2019-11-17 20:44:23(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# import re\n\n# import heapq\n\n# import array\n\n# from scipy.misc import comb # (default: exact=False)\n\n# import numpy as np \n\n\n\n\n\ndef main():\n\n s, t = sys.stdin.read().split()\n\n\n\n count = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n"} +{"problem_id": "p03416", "input": "# author: kagemeka \n\n# created: 2019-11-06 21:30:22(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\n# import statistics\n\n# import functools\n\n# import operator\n\n\n\ndef main():\n\n a, b = (int(x) for x in sys.stdin.read().split())\n\n\n\n count = 0\n\n for n in range(a, b+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n count += 1\n\n\n\n print(count) \n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n"} +{"problem_id": "p02767", "input": "N = int(input())\n\nX = list(map(int, input().split()))\n\nX = list(sorted(X))\n\nif N == 1:\n\n print((0))\n\n exit()\n\nans = float('inf')\n\nfor p in range(X[0], X[N - 1] + 1):\n\n sum = 0\n\n for x in X:\n\n sum += (x - p) ** 2\n\n ans = min(sum, ans)\n\nprint(ans)"} +{"problem_id": "p02725", "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd = [0] * n\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d[i] = a[i + 1] - a[i]\n\n d_max = max(d_max, d[i])\n\n\n\nd[-1] = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d[-1])\n\n\n\nprint((k - d_max))\n"} +{"problem_id": "p02822", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\ninv2 = (mod + 1) // 2\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n\n for j in X[i]:\n\n s = (s * pow(inv2, A[j], mod)) % mod\n\n t = (t + (1-pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))"} +{"problem_id": "p03796", "input": "from math import factorial\n\ndef myAnswer(N:int) ->int:\n\n ans =factorial(N)\n\n return ans % (10**9 + 7)\n\n\n\ndef modelAnswer():\n\n tmp=1\n\ndef main():\n\n N = int(input())\n\n print((myAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()"} +{"problem_id": "p03854", "input": "s = input()[::-1]\n\n\n\nwhile True:\n\n if len(s) == 0:\n\n break\n\n if s[:7] == \"remaerd\":\n\n s = s[7:]\n\n elif s[:6] == \"resare\":\n\n s = s[6:]\n\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n\n s = s[5:]\n\n else:\n\n print(\"NO\")\n\n exit()\n\n\n\nprint(\"YES\")"} +{"problem_id": "p03074", "input": "import sys\n\nstdin = sys.stdin \n\nni = lambda: int(ns())\n\nna = lambda: list(map(int, stdin.readline().split()))\n\nns = lambda: stdin.readline()\n\n\n\ndef Solve():\n\n N,K=na()\n\n S=[int(d) for d in input()]\n\n l=[]\n\n N=len(S)\n\n if(S[0]==0):\n\n l.append(0)\n\n b=S[0]\n\n ct=1\n\n for i in S[1:]:\n\n if(b!=i):\n\n l.append(ct)\n\n ct=1\n\n b=i\n\n else:\n\n ct+=1\n\n l.append(ct)\n\n len_l=len(l)\n\n if(len_l//2 <= K):\n\n return sum(l)\n\n ans = res = sum(l[:2*K+1])\n\n \n\n if(len_l%2==0):\n\n l.append(0)\n\n len_l+=1\n\n g = K * 2 + 1\n\n for i in range(K*2+1,len_l-1,2):\n\n ans -= l[i-g] + l[i-g+1]\n\n ans += l[i] + l[1+i]\n\n if(resb>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile a>b>c:\n\n\t\t\tif a>b>c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1\n\n\t\t\t"} +{"problem_id": "p04044", "input": "n, l = list(map(int, input().split()))\n\nS = [input() for i in range(n)]\n\nS.sort()\n\nprint((\"\".join(S)))"} +{"problem_id": "p03644", "input": "N = int(input())\n\nif N < 2:\n\n print(N)\n\nelif 2<=N<4:\n\n print((2))\n\nelif 4<=N<8:\n\n print((4))\n\nelif 8<=N<16:\n\n print((8))\n\nelif 16<=N<32:\n\n print((16))\n\nelif 32<=N<64:\n\n print((32))\n\nelif 64<=N:\n\n print((64))"} +{"problem_id": "p03037", "input": "N, M = list(map(int, input().split()))\n\nLR = [list(map(int, input().split())) for _ in range(M)]\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor l, r in LR:\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n"} +{"problem_id": "p03293", "input": "s = input()\n\nt = input()\n\nfor i in range(len(s)):\n\n if s[i:]+s[:i]==t:\n\n print('Yes')\n\n exit()\n\nprint('No')"} +{"problem_id": "p03060", "input": "n = int(input())\n\nv = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\nresult = 0\n\nfor i in range(n):\n\n if v[i] > c[i]:\n\n result += v[i] - c[i]\n\nprint(result)"} +{"problem_id": "p03416", "input": "a,b = list(map(int,input().split()))\n\nanswer = 0\n\nfor i in range(a,b+1) :\n\n j = str(i)\n\n p1 = j[4]\n\n p2 = j[3]\n\n p3 = j[2]\n\n p4 = j[1]\n\n p5 = j[0]\n\n k = int(p1+p2+p3+p4+p5)\n\n if i == k :\n\n answer += 1\n\nprint(answer)\n\n\n"} +{"problem_id": "p03721", "input": "N,K=list(map(int,input().split()))\n\ndic={}\n\nfor i in range(N):\n\n a,b=list(map(int,input().split()))\n\n if a in dic:\n\n dic[a]+=b\n\n else:\n\n dic[a]=b\n\n \n\ndic=sorted(list(dic.items()),key=lambda x:x[0])\n\nfor d in range(len(dic)):\n\n amount=dic[d][1]\n\n if amount>=K:\n\n print((dic[d][0]))\n\n exit(0)\n\n else:\n\n K-=amount\n\n "} +{"problem_id": "p03814", "input": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n\n# Python 1st Try\n\nimport copy\n\n\n\n\n\nclass Problem:\n\n def __init__(self, stringdata):\n\n self.stringdata = stringdata\n\n\n\n def solver(self):\n\n strcont = copy.copy(self.stringdata)\n\n result = 0\n\n rightposition = 0\n\n leftposition = len(strcont)\n\n j = 0\n\n while True:\n\n if strcont[j] == 'A':\n\n rightposition = j\n\n break\n\n else:\n\n j = j + 1\n\n j = leftposition - 1\n\n while True:\n\n if strcont[j] == 'Z':\n\n leftposition = j\n\n break\n\n else:\n\n j = j - 1\n\n\n\n result = leftposition - rightposition + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = input()\n\n print((\"{}\".format(Problem(s).solver())))\n"} +{"problem_id": "p03000", "input": "from itertools import accumulate\n\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\n\nL = list(tuple(map(int, input().split())))\n\n\n\nacc = sorted(list(accumulate(L)) + [0])\n\n\n\nn = bisect_right(acc,X)\n\nprint(n)\n\n\n"} +{"problem_id": "p03416", "input": "A, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n n_s = str(n)\n\n n_s_rvs = n_s[::-1]\n\n if n_s == n_s_rvs:\n\n cnt += 1\n\n\n\nprint(cnt)\n"} +{"problem_id": "p03796", "input": "import math\n\nN=int(input())\n\nprint((math.factorial(N)%(10**9+7)))"} +{"problem_id": "p03371", "input": "# ABC95 C -Half and Half\n\na,b,c,x,y = list(map(float,input().split()))\n\nans = 0\n\nif a+b > 2*c:\n\n while x != 0.0 and y != 0.0:\n\n ans += 2*c\n\n x -= 1.0\n\n y -= 1.0\n\n if y == 0.0:\n\n while x != 0.0:\n\n if a > 2*c:\n\n ans += 2*c\n\n x -= 1.0\n\n else:\n\n ans += a\n\n x -= 1.0\n\n if x == 0.0:\n\n while y != 0.0:\n\n if b > 2*c:\n\n ans += 2*c\n\n y -= 1.0\n\n else:\n\n ans += b\n\n y -= 1.0\n\nelse:\n\n ans += a*x + b*y\n\nprint((int(ans)))\n\n\n\n "} +{"problem_id": "p02595", "input": "N, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x ** 2 + y ** 2 <= D ** 2:\n\n cnt += 1\n\n \n\nprint(cnt)"} +{"problem_id": "p02814", "input": "from math import gcd\n\n\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\n\n\na=list([x//2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) // gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\n\n\nif (lcma//a[0])%2==0:\n\n print((0))\n\nelse:\n\n flg=0\n\n for i in range(1,len(a)):\n\n if (lcma//a[i])%2==0:\n\n print((0))\n\n flg=1\n\n break\n\n if flg==0:\n\n temp=m//lcma\n\n print((temp//2 if temp%2==0 else temp//2+1))"} +{"problem_id": "p02693", "input": "S = int(input())\n\na = 0\n\ncount = 0\n\nn,m = list(map(int,input().split()))\n\nwhile count == 0:\n\n a += S\n\n if n <= a and m >= a:\n\n count = 1\n\n if a >= 1000:\n\n break\n\nif count == 0:\n\n print(\"NG\")\n\nelse:\n\n print(\"OK\")"} +{"problem_id": "p03171", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nn = N % 2\n\n\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor w in range(1, N+1):\n\n for i in range(N):\n\n j = i + w\n\n if j > N:\n\n continue\n\n if (w+n) % 2 == 1:\n\n DP[i][j] = min(DP[i+1][j] - A[i], DP[i][j-1] - A[j-1])\n\n else:\n\n DP[i][j] = max(DP[i+1][j] + A[i], DP[i][j-1] + A[j-1])\n\n\n\nprint((DP[0][N]))\n"} +{"problem_id": "p03796", "input": "from math import factorial as fc\n\na = int(input())\n\nprint((fc(a)%(10**9+7)))"} +{"problem_id": "p02574", "input": "from math import gcd\n\n\n\nN = int(input())\n\nnum_lis = list(map(int, input().split()))\n\nc = True\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(10**6+10)\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num //= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n c = False\n\n break\n\n else:\n\n tmp.add(j)\n\n else:\n\n continue\n\n break\n\n\n\nif c:\n\n print(\"pairwise coprime\")\n\nelse:\n\n print(\"setwise coprime\")"} +{"problem_id": "p02850", "input": "n = int(input())\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n"} +{"problem_id": "p00003", "input": "for i in range(0, int(input())):\n\n sidelen = [int(j) for j in input().split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")"} +{"problem_id": "p03424", "input": "n = int(input())\n\ns = input().split()\n\ns = set(s)\n\nprint(('Four' if len(s) == 4 else 'Three'))"} +{"problem_id": "p00122", "input": "dX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return \"OK\"\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = input()\n\n\txy = list(map(int,input().split()))\n\n\tans = solve(x,y,xy)\n\n\tprint(ans if ans else \"NA\")"} +{"problem_id": "p03988", "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(1000000)\n\nfrom collections import deque\n\ndef getN():\n\n return int(input())\n\ndef getList():\n\n return list(map(int, input().split()))\n\nimport math\n\n\n\nn = getN()\n\nnums = getList()\n\n\n\n# nums.sort(reverse=True)\n\nmx = max(nums)\n\nmn = (mx+1) // 2\n\nmndx = (mx % 2) + 1\n\n\n\nfrom collections import Counter\n\n\n\ncnt = Counter(nums)\n\n\n\nfor i in range(mn+1, mx+1):\n\n if cnt[i] < 2:\n\n print(\"Impossible\")\n\n sys.exit()\n\n\n\nif cnt[mn] != mndx:\n\n print(\"Impossible\")\n\nelse:\n\n print(\"Possible\")"} +{"problem_id": "p02390", "input": "import sys\n\n\n\nif __name__ == '__main__':\n\n import doctest\n\n doctest.testmod()\n\n S = int(sys.stdin.read())\n\n h = S / 3600\n\n m = (S % 3600) / 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n"} +{"problem_id": "p02880", "input": "n = int(input())\n\ns = []\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n s.append(i*j)\n\nif n in s:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")"} +{"problem_id": "p03796", "input": "import math\n\nN=int(input())\n\nans=math.factorial(N)\n\nprint((ans%(10**9 +7)))"} +{"problem_id": "p03634", "input": "from collections import deque\n\nn,*t=list(map(int,open(0).read().split()))\n\ncon=[[] for _ in range(n)]\n\ndist_f_k=[0]*n\n\n\n\nfor a,b,c in zip(t[:3*n-3:3],t[1::3],t[2::3]):\n\n\tcon[a-1].append((b-1,c))\n\n\tcon[b-1].append((a-1,c))\n\n\n\nk=t[3*n-2]\n\nque=deque([k-1])\n\nwhile que:\n\n\tcur=que.popleft()\n\n\tfor nxt,dd in con[cur]:\n\n\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\tque.append(nxt)\n\n\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\nfor x,y in zip(t[3*n-1::2],t[3*n::2]):\n\n\tprint((dist_f_k[x-1]+dist_f_k[y-1]))"} +{"problem_id": "p02622", "input": "S = input()\n\nT = input()\n\nN = len(S)\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)\n"} +{"problem_id": "p02264", "input": "n, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n\tps[i], t[i] = input( ).split( \" \" )\n\n\n\n\n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n\tpsi = ps.pop( 0 )\n\n\tti = int( t.pop( 0 ) )\n\n\tif ti <= q:\n\n\t\tqsum += ti\t\n\n\t\toutput.append( psi+\" \"+str( qsum ) )\n\n\telse:\n\n\t\tt.append( ti - q )\n\n\t\tps.append( psi )\n\n\t\tqsum += q\n\n\n\nprint(( \"\\n\".join( output ) ))"} +{"problem_id": "p02688", "input": "N,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(input())\n\n b=input().split(' ')\n\n for j in range(count):\n\n if int(b[j]) in a:\n\n a.remove(int(b[j]))\n\nprint((len(a)))"} +{"problem_id": "p02416", "input": "res = []\n\nwhile True:\n\n s = input()\n\n if s == '0':\n\n break\n\n\n\n res.append(sum([int(x) for x in s]))\n\n\n\nfor e in res:\n\n print(e)"} +{"problem_id": "p03086", "input": "import re;print((max(list(map(len,re.split('[^ACGT]',input()))))))"} +{"problem_id": "p03828", "input": "import math\n\nn=int(input())\n\nwaru=10**9+7\n\n\n\nli=[]\n\nli2=[]\n\n\n\nfor i in range(2,n+1):\n\n tmp=math.factorial(n)\n\n flag=1\n\n for j in range(len(li)):\n\n if i%li[j]==0:\n\n flag=0\n\n break\n\n if flag==1:\n\n li.append(i)\n\n li2.append(0)\n\n while tmp%i==0:\n\n li2[len(li)-1]+=1\n\n tmp=tmp//i\n\nans=1\n\n# print(li)\n\n# print(li2)\n\nfor i in range(len(li2)):\n\n ans*=li2[i]+1\n\nprint((ans%waru))"} +{"problem_id": "p03325", "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nans = 0\n\ncheck = [0]*30\n\nfor i in range(1, 31):\n\n check[i-1] = 2**i\n\n\n\nfor i in A:\n\n if i % 2 == 0:\n\n j = 0\n\n while check[j] <= i:\n\n if i % check[j] == 0:\n\n add = check[j]\n\n else:\n\n break\n\n \n\n j += 1\n\n ans += j\n\n \n\nprint(ans)"} +{"problem_id": "p03845", "input": "N = int(input())\n\nT = list(map(int, input().split()))\n\nM = int(input())\n\np = []\n\nx = []\n\nans = []\n\nfor i in range(M):\n\n p, x = list(map(int, input().split()))\n\n ans.append(sum(T[:p-1])+x+sum(T[p:]))\n\n\n\nfor _ in ans:\n\n print(_)"} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))"} +{"problem_id": "p02901", "input": "def main():\n\n import math\n\n N,M=list(map(int,input().split()))\n\n a=[]\n\n for i in range(M):\n\n tmp=list(map(int,input().split()))\n\n tmpc=list(map(int,input().split()))\n\n c=0\n\n for j in range(len(tmpc)):\n\n c+=2**(tmpc[j]-1)\n\n tmp[1]=c\n\n a+=[tmp]\n\n\n\n\n\n dp=[[10**10 for j in range(2**N)] for i in range(M)]\n\n dp[0][0]=0\n\n dp[0][a[0][1]]=a[0][0]\n\n\n\n\n\n for i in range(1,M):\n\n dp[i]=dp[i-1]\n\n for j in range(2**N):\n\n z,p=a[i][0],a[i][1]\n\n q=j|p\n\n x=dp[i-1][j]+z\n\n if dp[i][q]>x: dp[i][q]=x\n\n\n\n ans=dp[M-1][2**N-1]\n\n print((ans if ans<10**10 else -1))\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p02574", "input": "#!/usr/bin/env pypy3\n\n# N,M = map(int,sys.stdin.readline().split())\n\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n\n# s = sys.stdin.readline().rstrip()\n\n# N = int(sys.stdin.readline())\n\n# INF = float(\"inf\")\n\nimport math,sys\n\n\n\nn = int(sys.stdin.readline())\n\na = tuple(map(int,sys.stdin.readline().split()))\n\n#n = int(input())\n\n#a = list(map(int,input().split()))\n\ng = math.gcd(a[0],a[1])\n\nfor i in range(2,n):\n\n g = math.gcd(g,a[i])\n\nM = max(a)\n\nacc = a[0]\n\nfor i in range(n):\n\n acc = math.gcd(acc,a[i])\n\nif acc != 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nLIMIT=max(a)\n\nminPrime = [0]*(LIMIT+1)\n\nminPrime[1] = 1\n\ndef make():\n\n for i in range(2,LIMIT+1):\n\n if minPrime[i] == 0:\n\n minPrime[i] = i\n\n #print(i)\n\n for j in range(i+i,LIMIT+1,i):\n\n #print(i,j)\n\n if minPrime[j] == 0:\n\n minPrime[j] = i\n\nmake()\n\ndef factrial(N):\n\n ret = []\n\n while minPrime[N] != N:\n\n ret.append(minPrime[N])\n\n N = N//minPrime[N]\n\n if N != 1:\n\n ret.append(N)\n\n return ret\n\n\n\njudge = set([])\n\npc = True\n\n\n\npairwise = True\n\np = set() #all prime\n\n\n\nfor e in a:\n\n if not pairwise:\n\n break\n\n asf = set(factrial(e))\n\n if judge & asf != set():\n\n pc = False\n\n # #pairwise = False\n\n # print(\"setwise coprime\")\n\n # exit(0)\n\n judge |= asf\n\n# for i in a:\n\n# if not pc:\n\n# break\n\n# asf = set(factrial(i))\n\n\n\n# if judge & asf != set():\n\n# pc = False\n\n# judge |= asf\n\nif pc:\n\n print(\"pairwise coprime\")\n\nelif g == 1:\n\n print(\"setwise coprime\")\n\nelse:\n\n print(\"not coprime\")\n"} +{"problem_id": "p02627", "input": "alph = input()\n\nif alph.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")\n"} +{"problem_id": "p03039", "input": "n, m, k = list(map(int, input().split()))\n\n\n\nmod = 1000000007\n\ndef pow(x, n):\n\n ret = 1\n\n while n > 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\nfac = [1]\n\ninv = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n inv.append(pow(fac[i], mod - 2))\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\n\ndef doit(n, m, k):\n\n ret = 0\n\n for d in range(m):\n\n ret = (ret + d * (m - d)) % mod\n\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))"} +{"problem_id": "p02555", "input": "s=int(input())\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s//3\n\nans=0\n\ndef f(n,k,p):\n\n if k==0:\n\n return 1\n\n elif k%2==0:\n\n return (f(n,k//2,p)**2)%p\n\n else:\n\n return (n*f(n,k-1,p))%p\n\n\n\nfor k in range(1,n+1):\n\n a=1\n\n b=1\n\n for j in range(k-1):\n\n a=(a*(s-3*k+1+j))%p\n\n b=(b*(j+1))%p\n\n ans=(ans+a*f(b,p-2,p))%p\n\n\n\nprint((ans%p))\n\n\n"} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()));print((min(k*c*2+a*max(x-k,0)+b*max(y-k,0)for k in range(max(x,y)*3))))"} +{"problem_id": "p03545", "input": "import math\n\nimport string\n\nimport collections\n\nfrom collections import Counter\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\na, b, c, d = list(map(int, input()))\n\n#print(a, b, c, d)\n\nif a+b+c+d == 7:\n\n print((str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a+b-c+d == 7:\n\n print((str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a+b+c-d == 7:\n\n print((str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a+b-c-d == 7:\n\n print((str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a-b+c+d == 7:\n\n print((str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a-b-c+d == 7:\n\n print((str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a-b+c-d == 7:\n\n print((str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a-b-c-d == 7:\n\n print((str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n"} +{"problem_id": "p03723", "input": "a,b,c=list(map(int, input().split()))\n\nd=0\n\nwhile d<10**5:\n\n if a%2==1 or b%2==1 or c%2==1:break\n\n a,b,c=b/2+c/2,a/2+c/2,a/2+b/2\n\n d+=1\n\nelse:d=-1\n\nprint(d)"} +{"problem_id": "p03309", "input": "import statistics\n\nN = int(input())\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in range(1,N+1):\n\n a[i-1] -= i\n\n\n\nb = statistics.median(a)\n\nfor i in range(N):\n\n ans += abs(a[i]-b)\n\nprint((int(ans)))"} +{"problem_id": "p02665", "input": "n = int(input())\n\nleaves = list(map(int, input().split()))\n\n\n\nans = 0\n\nnodes_min = [0] * (n + 1)\n\nnodes_max = [0] * (n + 1)\n\nnodes_min[n] = leaves[n]\n\nnodes_max[n] = leaves[n]\n\n\n\nfor depth in range(n, 0, -1):\n\n root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2\n\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n\n root_max = nodes_max[depth]\n\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\n\nnodes = [0] * (n + 1)\n\nnodes[0] = 1\n\nif nodes[0] < nodes_min[0]:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n roots = nodes[depth]-leaves[depth]\n\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n\n if nodes[depth+1] < nodes_min[depth+1]:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(nodes)))\n"} +{"problem_id": "p02691", "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\ndp = [0] * 10 ** 7\n\nans = 0\n\nfor i in range(N):\n\n x = i + 1 - A[i]\n\n if x >= 0:\n\n ans += dp[x]\n\n y = i + 1 + A[i]\n\n if y < 10 ** 7:\n\n dp[y] += 1\n\n\n\nprint(ans)\n"} +{"problem_id": "p03544", "input": "a,b=2,1\n\nfor i in[0]*int(input()):a,b=b,a+b\n\nprint(a)"} +{"problem_id": "p02555", "input": "S = int(input())\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))"} +{"problem_id": "p03107", "input": "# ABC 120 C\n\n\n\nimport re\n\n\n\nS = input()\n\n\n\nl0 = 0\n\nl1 = 0\n\n\n\nfor i in range(len(S)):\n\n if S[i] == '0':\n\n l0 += 1\n\n elif S[i] == '1':\n\n l1 += 1\n\n\n\nprint((min(l0, l1) * 2))\n"} +{"problem_id": "p02657", "input": "def iput(): return int(input())\n\ndef mput(): return list(map(int, input().split()))\n\ndef lput(): return list(map(int, input().split()))\n\n\n\ndef solve():\n\n a, b = mput()\n\n print((a*b))\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()"} +{"problem_id": "p03759", "input": "a, b, c = list(map(int, input().split()))\n\nif (b - a) == (c - b):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")"} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%1000000007))"} +{"problem_id": "p03416", "input": "a,b = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n j = str(i)\n\n if j==''.join(reversed(j)):\n\n count += 1\n\nprint(count)"} +{"problem_id": "p03796", "input": "#!/usr/bin/env pypy3\n\n\n\nimport math\n\nprint((math.factorial(int(input())) % 1000000007))"} +{"problem_id": "p03721", "input": "(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\n\nfor a, b in sorted(AB):\n\n K -= b\n\n if K <= 0:\n\n print(a)\n\n break\n"} +{"problem_id": "p03796", "input": "mod = int(1e9+7)\n\nn = int(input())\n\n\n\npower = 1\n\nfor i in range(1, n+1):\n\n power = power * i % mod\n\nprint(power)"} +{"problem_id": "p03164", "input": "N, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [[10**9+1] * (V + 1) for i in range(N+1)]\n\ndp[0][0] = 0\n\nfor i in range(N):\n\n for j in range(V+1):\n\n if j - L[i][1] >= 0:\n\n dp[i+1][j] = min(dp[i][j], dp[i][j-L[i][1]] + L[i][0])\n\n else:\n\n dp[i+1][j] = dp[i][j]\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[-1][j]:\n\n ans = max(ans, j)\n\nprint(ans)"} +{"problem_id": "p03814", "input": "s = input()\n\n\n\nstart = -1\n\nend = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A' and start < 0:\n\n start = i\n\n elif s[i] == 'Z':\n\n end = i\n\nprint((end - start + 1))\n"} +{"problem_id": "p02412", "input": "while 1:\n\n n,x=list(map(int,input().split()))\n\n if n+x==0:break\n\n print((len([1 for i in range(3,n+1)for j in range(2,x-i)if x-i-j d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n"} +{"problem_id": "p02702", "input": "from collections import Counter\n\nS = input()[::-1]\n\n\n\nmemo = [0]\n\nd = 0\n\nmod = 2019\n\n\n\nfor s in S:\n\n tmp = int(s) * pow(10, d, mod) % mod\n\n tmp = memo[-1] + tmp\n\n memo.append(tmp % mod)\n\n d += 1\n\n\n\nc = Counter(memo)\n\nans = sum(v * (v - 1) // 2 for v in list(c.values()))\n\nprint(ans)"} +{"problem_id": "p02627", "input": "a = input()\n\nprint(('A' if not a.islower() else 'a'))\n"} +{"problem_id": "p03325", "input": "N=int(input())\n\na=list(map(int,input().split()))\n\nfor i in range(N):\n\n for j in range(1,31):\n\n if a[i]%(2**j)!=0:\n\n a[i]=j-1\n\n break\n\nprint((sum(a)))"} +{"problem_id": "p03416", "input": "a, b = list(map(int, input().split()))\n\ncnt = 0\n\n\n\nfor i in range(a, b+1):\n\n i = str(i)\n\n if i[0] == i[-1] and i[1] == i[-2]:\n\n cnt += 1\n\n\n\nprint(cnt)\n"} +{"problem_id": "p03835", "input": "k, s = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if i + j > s:\n\n break\n\n elif s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n"} +{"problem_id": "p02702", "input": "from collections import Counter\n\n\n\ns = input()\n\nmod1 = 673\n\nmod2 = 3\n\n\n\nnum1 = 0\n\nnum2 = 0\n\nli1 = []\n\nli2 = []\n\npw1 = 10\n\npw2 = 10\n\nfor i, e in enumerate(s, 1):\n\n num1 *= 10\n\n num1 += int(e)\n\n num1 %= mod1\n\n inv = pow(pw1, mod1 - 2, mod1)\n\n li1.append(num1 * inv % mod1)\n\n\n\n num2 *= 10\n\n num2 += int(e)\n\n num2 %= mod2\n\n inv = pow(pw2, mod2 - 2, mod2)\n\n li2.append(num2 * inv % mod2)\n\n\n\n pw1 *= 10\n\n pw1 %= mod1\n\n pw2 *= 10\n\n pw2 %= mod2\n\n\n\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\n\nc = Counter(li)\n\n\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) // 2\n\n\n\nprint(ans)\n"} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split(' ')))\n\n\n\nc = int(c*2)\n\nm = float('inf')\n\nfor i in range(10**5+1):\n\n m = min(m, a*max(0, x-i)+b*max(0,y-i)+c*i)\n\nprint(m)"} +{"problem_id": "p02983", "input": "l,r=list(map(int,input().split()))\n\ns=list(range(l,r+1))[:2019]\n\nprint((min(i*j%2019for i in s for j in s if i> i & 1:\n\n a = dp[i][a]\n\n return a >= b\n\ndef solve(a, b):\n\n if a > b:\n\n a, b = b, a\n\n ng = 0\n\n ok = n-1\n\n while ok - ng > 1:\n\n mid = (ng + ok) // 2\n\n if test(mid, a, b):\n\n ok = mid\n\n else:\n\n ng = mid\n\n print(ok)\n\nq = int(input())\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n solve(a, b)"} +{"problem_id": "p02994", "input": "n, like = list(map(int, input().split()))\n\n\n\narr = [like + i for i in range(n)]\n\n\n\narr.sort(key=lambda x:abs(x))\n\n\n\nprint((sum(arr[1:])))\n"} +{"problem_id": "p03371", "input": "A, B, C, X, Y = list(map(int, input().split()))\n\nans = float('inf')\n\nfor i in range(max(X,Y)+1):\n\n cost = 2 * C * i + max(0,X-i)*A +max(0,Y-i)*B\n\n ans = min(ans,cost)\n\nprint(ans)"} +{"problem_id": "p03828", "input": "#coding: UTF-8\n\nimport math\n\nN=int(input())\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N):\n\n plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k/(i+1)\n\n lis[i]=n\n\n return lis\n\nout_lis=[0]*N\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\nprint((out%1000000007))"} +{"problem_id": "p02245", "input": "import sys\n\nimport queue\n\n\n\nN = 3\n\nf= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = queue.Queue()\n\nV = dict()\n\n\n\nQ.put([f,f.index('0'),0])\n\nV[f] = True\n\n\n\nwhile not Q.empty():\n\n u = Q.get()\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]//N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 \n\n Q.put(v)\n\n\n\nprint((u[2]))\n"} +{"problem_id": "p03854", "input": "def main():\n\n S = input()\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n # print(w1,w2,w3,w4)\n\n S = S[::-1]\n\n # print(S)\n\n\n\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n\n words = [w1, w2, w3, w4]\n\n T = ''\n\n while S != T:\n\n cand = []\n\n for w in words:\n\n new_t = T + w\n\n cand.append(new_t) \n\n # print('cand', cand)\n\n ans = False\n\n for c in cand:\n\n if c == S[:len(c)]:\n\n T = c\n\n ans = True\n\n\n\n if not ans:\n\n break\n\n\n\n if S == T:\n\n print('YES')\n\n else:\n\n print(\"NO\")\n\n\n\nif __name__ == \"__main__\":\n\n main()"} +{"problem_id": "p03806", "input": "N,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\nmaxa = maxb = 0\n\nfor a,b,c in src:\n\n for ai in range(maxa,-1,-1):\n\n for bi in range(maxb,-1,-1):\n\n dp[ai+a][bi+b] = min(dp[ai+a][bi+b], dp[ai][bi] + c)\n\n maxa += a\n\n maxb += b\n\n\n\nans = INF\n\nfor i in range(1,401):\n\n if MA*i > 400 or MB*i > 400: break\n\n ans = min(ans, dp[MA*i][MB*i])\n\nprint((-1 if ans == INF else ans))"} +{"problem_id": "p03814", "input": "s = input()\n\na = s.find('A')\n\nz = s[::-1].find('Z')\n\nans = len(s)-a-z\n\n\n\nprint(ans)\n\n\n\n#print(*ans, sep='\\n')"} +{"problem_id": "p03494", "input": "_,t=open(0);n=eval(t.replace(' ','|'));print((len(bin(n&-n))-3))"} +{"problem_id": "p03309", "input": "import statistics\n\nN = int(input())\n\nA = [int(a)-i-1 for i,a in enumerate(input().split(),1)]\n\nb = statistics.median_low(A)\n\nc = statistics.median_high(A)\n\nd = sum([abs(x-b) for x in A])\n\ne = sum([abs(x-c) for x in A])\n\nprint((min(d,e)))"} +{"problem_id": "p03416", "input": "a,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n new = list(reversed(list(str(i))))\n\n if new == list(str(i)):\n\n c += 1\n\n \n\n \n\nprint(c)"} +{"problem_id": "p03013", "input": "import sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int,input().split()))\n\nhole = [0] * (N+1)\n\nfor i in range(M):\n\n hole[int(input())] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nif N == 2:\n\n if hole[1] == 1:\n\n print((1))\n\n exit()\n\n if hole[1] == 0:\n\n print((2))\n\n exit()\n\nflg_one = False\n\nflg_two = False\n\nfirst = 1\n\nsecond = 2\n\nif hole[1] == 1:\n\n first = 0\n\n second = 1\n\n flg_one = True\n\nif hole[2] == 1:\n\n first = 1\n\n second = 0\n\n flg_two = True\n\nif flg_one and flg_two:\n\n print((0))\n\n exit()\n\n\n\nfor i in range(3,N):\n\n if hole[i] == 1:\n\n first = second\n\n second = 0\n\n continue\n\n tmp = first + second\n\n tmp %= 1000000007\n\n first = second\n\n second = tmp\n\ntmp = first + second\n\ntmp %= 1000000007\n\nprint(tmp)"} +{"problem_id": "p03558", "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n s = S()\n\n t = S()\n\n if s+t == t[::-1]+s[::-1]:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n\n\n#B\n\ndef B():\n\n n = I()\n\n for i in range(int(n**0.5)+2)[::-1]:\n\n if i*i <= n:\n\n print((i*i))\n\n quit()\n\n#C\n\ndef C():\n\n n = I()\n\n a = LI()\n\n b = LI()\n\n c = LI()\n\n q = [0 for i in range(n)]\n\n ans = 0\n\n a.sort()\n\n b.sort()\n\n c.sort()\n\n for i in range(n):\n\n j = bisect.bisect_left(a,b[i])\n\n q[i] = j\n\n for i in range(n-1):\n\n q[i+1] += q[i]\n\n q.insert(0,0)\n\n for i in range(n):\n\n j = bisect.bisect_left(b,c[i])\n\n ans += q[j]\n\n print(ans)\n\n#D\n\ndef D():\n\n def dijkstra():\n\n d = [float(\"inf\") for i in range(k)]\n\n q = [[0,1]]\n\n d[1] = 0\n\n while q:\n\n dx,x = heappop(q)\n\n for y,dy in v[x]:\n\n if d[y] > dx+dy:\n\n d[y] = dx+dy\n\n heappush(q,[d[y],y])\n\n print((d[0]+1))\n\n k = I()\n\n if k == 1:\n\n print((1))\n\n quit()\n\n v = [[] for i in range(k)]\n\n for i in range(1,k):\n\n v[i].append([(i+1)%k,1])\n\n v[i].append([i*10%k,0])\n\n dijkstra()\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n return\n\n\n\n#G\n\ndef G():\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n D()\n"} +{"problem_id": "p03796", "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))"} +{"problem_id": "p02596", "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k//7 if k % 7 == 0 else k)\n\n if l % 2 == 0 or l % 5 == 0:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(-pow(l, 1/2))):\n\n if r % i == 0:\n\n phi = phi//i*(i-1)\n\n while r % i:\n\n r //= i\n\n\n\n a = 10 % l\n\n ret = 1\n\n while(a != 1):\n\n a = a*10 % l\n\n ret += 1\n\n if phi < ret:\n\n ret = -1\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n"} +{"problem_id": "p03013", "input": "import sys\n\nsys.setrecursionlimit(100000)\n\n\n\ndef intinput(): return list(map(int,sys.stdin.readline().split()))\n\n\n\nfib={0:0,1:1,2:1}\n\nfor i in range(3,100003):\n\n fib[i]=fib[i-1]+fib[i-2]\n\n # fib.append(fib[i-1]+fib[i-2])\n\n\n\nn,m=intinput()\n\nmod=10**9+7\n\na=[int(sys.stdin.readline()) for _ in range(m)]\n\nif m!=0:\n\n l=[a[0]]\n\n for i in range(len(a)-1):\n\n l.append(a[i+1]-a[i]-1)\n\n l.append(n-a[-1])\n\n k=1\n\n for i in l:\n\n k=fib[i]*k%mod\n\n print((k%mod))\n\nelse:\n\n print((fib[n+1]%mod))"} +{"problem_id": "p02767", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nanswer = 10 ** 9\n\nfor i in range(1,101):\n\n tmp = 0\n\n for a in A:\n\n tmp += abs(a-i) ** 2\n\n answer = min(answer,tmp)\n\nprint(answer)"} +{"problem_id": "p02850", "input": "\"\"\"\n\nchallenge case\n\n\n\nin:\n\n3\n\n1 3\n\n2 3\n\n\n\nout:\n\n1\n\n1\n\n1\n\n\"\"\"\n\n\n\nfrom collections import deque\n\n\n\ndef main():\n\n\tN, *AB = list(map(int, open(0).read().split()))\n\n\tB = AB[1::2]\n\n\n\n\tE = [[] for _ in range(N + 1)]\n\n\tfor a, b in zip(*[iter(AB)] * 2):\n\n\t\tE[a] += b,\n\n\n\n\tQ = deque([1])\n\n\tC = [0] * (N + 1)\n\n\twhile Q:\n\n\t\tv = Q.popleft()\n\n\t\tc = 0\n\n\t\tfor u in E[v]:\n\n\t\t\tc += 1 + (c + 1 == C[v])\n\n\t\t\tC[u] = c\n\n\t\t\tQ += u,\n\n\n\n\tprint((max(C)))\n\n\tfor b in B:\n\n\t\tprint((C[b]))\n\n\n\nmain()"} +{"problem_id": "p03253", "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\nfrom collections import defaultdict\n\nimport copy\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n d = defaultdict(int)\n\n MOD = 10**9+7\n\n R = 10**5+100\n\n fac = [0 for _ in range(R+1)]\n\n fac[0],fac[1] = 1,1\n\n inv = copy.deepcopy(fac)\n\n invfac = copy.deepcopy(fac)\n\n \n\n for i in range(2,R+1):\n\n fac[i] = (fac[i-1]*i)%MOD\n\n inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD\n\n invfac[i] = (invfac[i-1]*inv[i])%MOD\n\n \n\n def coef(x,y):\n\n num = (((fac[x+y]*invfac[y])%MOD)*invfac[x]%MOD)\n\n return num\n\n\n\n while M%2 == 0:\n\n d[2] += 1\n\n M //= 2\n\n f = 3\n\n while f ** 2 <= M:\n\n if M % f == 0:\n\n d[f] += 1\n\n M //= f\n\n else:\n\n f += 2\n\n if M != 1:\n\n d[M] += 1\n\n \n\n l = list(d.values())\n\n ans = 1\n\n for num in l:\n\n ans *= coef(num,N-1)\n\n ans %= MOD\n\n \n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()"} +{"problem_id": "p03107", "input": "from collections import Counter\n\nd={chr(i):0 for i in range(2)}\n\ns=Counter(input())\n\nd=d.update(s)\n\nprint((min(s[\"0\"],s[\"1\"])*2))"} +{"problem_id": "p00145", "input": "from functools import reduce\ndef f(a,b): return [Card[a][0], Card[b][1]]\n\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, f(j, k) + f(k+1, a)) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])"} +{"problem_id": "p03039", "input": "def cmb(n, r, mod):\n\n if ( r<0 or r>n ):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\nA=2*10**5\n\nmod = 10**9+7\n\ng1 = [1, 1]\n\ng2 = [1, 1]\n\ninverse = [0, 1]\n\n\n\nfor i in range( 2, A + 1 ):\n\n g1.append( ( g1[-1] * i ) % mod )\n\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=cmb(N*M-2,K-2,mod)\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nprint(((keisuu * (sum_//2))%mod))"} +{"problem_id": "p02725", "input": "k,n = list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\nlongd=0\n\nfor i in range(n):\n\n tmp=abs(a[i+1]-a[i])\n\n longd=max(longd,tmp)\n\nprint((k-longd))"} +{"problem_id": "p02886", "input": "def ii():return int(input())\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nans = 0\n\nfor i in range(n):\n\n for j in range(i+1,n):\n\n# print(i,j)\n\n ans += D[i]*D[j] \n\nprint(ans)"} +{"problem_id": "p03353", "input": "S = input()\n\nK = int(input())\n\na = list(set(S))\n\na.sort()\n\n\n\nk = []\n\nl = 0\n\nwhile l < len(a):\n\n for i in range(len(S)):\n\n if S[i] == a[l]:\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n k.append(S[i:i+j])\n\n else:\n\n break\n\n l += 1\n\n\n\nk = list(set(k))\n\nk.sort()\n\nprint((k[K-1]))"} +{"problem_id": "p02702", "input": "s = input()[::-1]\n\nl = len(s)\n\nc = [0] * 2019\n\nc[0] = 1\n\nten = 1\n\nmod = 0\n\nans = 0\n\n\n\nfor i in range(l):\n\n mod = (mod + int(s[i]) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) // 2\n\n\n\nprint(ans)"} +{"problem_id": "p03814", "input": "S=input()\n\nprint((S.rfind('Z')-S.find('A')+1))"} +{"problem_id": "p03371", "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LS()\n\n return l\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n return\n\n\n\n#B\n\ndef B():\n\n return\n\n\n\n#C\n\ndef C():\n\n return\n\n\n\n#D\n\ndef D():\n\n return\n\n\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n a,b,c,X,Y = LI()\n\n ans = float(\"inf\")\n\n for z in range(300001):\n\n if z%2 == 0:\n\n m = c*z\n\n x = z//2\n\n y = z//2\n\n m += a*max(0,X-x)\n\n m += b*max(0,Y-y)\n\n if m < ans:\n\n ans = m\n\n print(ans)\n\n return\n\n\n\n#G\n\ndef G():\n\n n = I()\n\n x = LI()\n\n f = [(i,x[i]) for i in range(n)]\n\n f.sort(key = lambda x:x[1])\n\n g = [(f[i][0],i) for i in range(n)]\n\n g.sort(key = lambda x:x[0])\n\n for i in range(n):\n\n if g[i][1] < n//2:\n\n print((f[n//2][1]))\n\n else:\n\n print((f[n//2-1][1]))\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#I\n\ndef I_():\n\n return\n\n\n\n#J\n\ndef J():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n F()\n"} +{"problem_id": "p02612", "input": "n = int(input()) % 1000\n\nif n == 0:\n\n print((0))\n\nelse:\n\n print((1000 - n))"} +{"problem_id": "p02983", "input": "L ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nif R - L <= 2019:\n\n for i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n\n\nelse:\n\n for i in range(R-L-1010,R-L+1010):\n\n for j in range(i,R-L+1010):\n\n ans.append(i*j%2019)\n\n\n\nprint((min(ans)))\n"} +{"problem_id": "p02773", "input": "from collections import Counter\n\nimport heapq\n\n\n\nn = int(input())\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\nheap = [(-v, k) for k, v in list(ctr.items())]\n\nheapq.heapify(heap)\n\nmaxv = heap[0][0]\n\nwhile heap:\n\n c = heapq.heappop(heap)\n\n if c[0] != maxv:\n\n break\n\n print((c[1]))\n"} +{"problem_id": "p03037", "input": "# -*- coding: utf-8 -*-\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nl = max(L)\n\nr = min(R)\n\n\n\nans = max(r - l + 1, 0)\n\n\n\nprint(ans)\n"} +{"problem_id": "p02881", "input": "import math\n\ninput_num = int(input())\n\nnum_sqrt = int(math.sqrt(input_num))\n\n\n\nminimam = input_num\n\nfor i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n distance = q + i -2\n\n if mod == 0 and minimam > distance:\n\n minimam = distance\n\nprint(minimam)"} +{"problem_id": "p02881", "input": "# C - Walk on Multiplication Table\n\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\n\n\n\nn = int(input())\n\n\n\nans = 10 ** 12\n\nfor i in range(1, 10 ** 6 + 1):\n\n if n % i == 0:\n\n ans = min(ans, n // i + i)\n\n\n\nprint((ans - 2))"} +{"problem_id": "p04020", "input": "# AGC003B - Simplified mahjong\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur // 2\n\n N = int(input())\n\n A = list(map(int, [input() for _ in range(N)])) + [0]\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur // 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()"} +{"problem_id": "p02412", "input": "while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for a in range(1, n + 1):\n\n for b in range(a + 1, n + 1):\n\n for c in range(b + 1, n + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)"} +{"problem_id": "p02245", "input": "from collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n if MAP == goal:\n\n return 0\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n return cnt\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n"} +{"problem_id": "p03371", "input": "inf = (5000 * 10 ** 5) * 3\n\n\n\na, b, c, x, y = list(map(int, input().split()))\n\n\n\nret = inf\n\nfor cnt_ab in range(max(x, y) * 2 + 1):\n\n d = cnt_ab // 2\n\n\n\n cnt_a = max(0, x - d)\n\n cnt_b = max(0, y - d)\n\n\n\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n\n ret = min(ret, t)\n\nprint(ret)\n"} +{"problem_id": "p02555", "input": "S = int(input())\n\nf = [0]*(S+1)\n\nf[0] = 1\n\nif S >= 3: f[3] = 1\n\nif S >= 4: f[4] = 1\n\nif S >= 5: f[5] = 1\n\nfor i in range(6, S+1):\n\n f[i] = sum(f[i-j] for j in range(3, i+1))%(10**9+7)\n\nprint((f[S]))\n"} +{"problem_id": "p03806", "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(400, -1, -1):\n\n for j in range(400, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, 401):\n\n for j in range(1, 401):\n\n if dp[i][j] != INF and i / j == Ma / Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))"} +{"problem_id": "p02555", "input": "from sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\nsetrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\t@lru_cache(None)\n\n\tdef dp(currsum):\n\n\t\tif currsum == s: return 1\n\n\t\tcnt = 0\n\n\t\tfor d in range(3, 2001):\n\n\t\t\tif currsum + d <= s:\n\n\t\t\t\tcnt += dp(currsum + d)\n\n\t\t\t\tcnt %= MOD \n\n\t\treturn cnt\n\n\tprint((dp(0)))\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()"} +{"problem_id": "p03307", "input": "import math\n\nn=int(input())\n\nprint(((2*n)//math.gcd(2,n)))"} +{"problem_id": "p03854", "input": "import sys\n\ns = input()\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n if s == t + w:\n\n print('YES')\n\n sys.exit()\n\n if s.startswith(t + w):\n\n nts.append(t + w)\n\n if len(nts) == 0:\n\n print('NO')\n\n sys.exit()\n\n ts = nts\n"} +{"problem_id": "p02688", "input": "N,K=list(map(int,input().split()))\n\na = [[0]*N]*K\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(input())\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)"} +{"problem_id": "p03854", "input": "import sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = input()\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isDream #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n #print('d:', d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #; print(d, pout)\n\n if pout == len(S): \n\n isDream = True #; print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisDream = False\n\ndayDream(0)\n\nif isDream:\n\n print('YES')\n\nelse:\n\n print('NO')"} +{"problem_id": "p03037", "input": "n,m=list(map(int,input().split()))\n\nc=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n c[l-1]+=1\n\n c[r]-=1\n\nfor i in range(1,n+2):\n\n c[i]=c[i]+c[i-1]\n\nans=0\n\nfor i in range(n+2):\n\n if c[i]==m:\n\n ans+=1\n\nprint(ans)"} +{"problem_id": "p03287", "input": "n,m=list(map(int,input().split()))\n\na=[int(x) for x in input().split()]\n\nb=[0 for x in range(n+1)]\n\nl=list([0])\n\n\n\nfor i in range(1,n+1):\n\n b[i]=b[i-1]+a[i-1]\n\n\n\nfor i in range(1,n+1):\n\n l.append(b[i]%m)\n\n\n\nd=list()\n\nl.sort()\n\nt,c=0,1\n\nfor i in range(1,n+1):\n\n if l[i]==l[i-1]:\n\n c+=1\n\n else:\n\n if c!=1:\n\n t += c*(c-1)//2\n\n c=1\n\n\n\nif c!=1:\n\n t += c*(c-1)//2 \n\n\n\nprint(t)\n"} +{"problem_id": "p02850", "input": "import copy\n\n\n\nn=int(input())\n\norg_set=set([i for i in range(1,10**5)])\n\nedges=[]\n\nrelations={}\n\nnodes=[]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split(\" \")))\n\n edges.append([a,b])\n\n relations.setdefault(a,[]).append(b)\n\n nodes.append([])\n\nnodes.append([])\n\nnodes.append([])\n\n\n\nmax_color=0\n\nfor start in range(1,n+1):\n\n targets=relations.get(start,[])\n\n color=1\n\n for target in targets:\n\n if color in nodes[start]:\n\n color+=1\n\n else:\n\n pass\n\n nodes[target].append(color)\n\n if color>=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]][0]))"} +{"problem_id": "p02691", "input": "n=int(input())\n\na=list(map(int,input().split()))\n\nk=[]\n\nans=0\n\nfor i in range(400005):\n\n k.append(0)\n\nfor i in range(n):\n\n if i-a[i]>=0:\n\n ans+=k[i-a[i]]\n\n if a[i]+i<400005:\n\n k[a[i]+i]+=1\n\nprint(ans)"} +{"problem_id": "p02881", "input": "import sys\n\nimport os\n\nimport math\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n ret = float('inf')\n\n I = int(math.sqrt(N)) * 10\n\n for i in range(1, I):\n\n if N%i == 0:\n\n j = N//i\n\n ret = min(ret, j + i - 2)\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} diff --git a/python_splits/test_input_verified_baseline_with_cfg_weights.jsonl b/python_splits/test_input_verified_baseline_with_cfg_weights.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..be5179cc22fe3d712bab413b780dc42713b6235a --- /dev/null +++ b/python_splits/test_input_verified_baseline_with_cfg_weights.jsonl @@ -0,0 +1,565 @@ +{"problem_id": "p03371", "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 5000 * 2 * 10 ** 5\n\nfor i in range(10 ** 5 + 1):\n\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n\n ans = min(ans, s)\n\n\n\nprint(ans)", "input_tokens": ["A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "5", "0", "0", "0", "\u0120*", "\u0120", "2", "\u0120*", "\u0120", "1", "0", "\u0120**", "\u0120", "5", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "\u0120**", "\u0120", "5", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120i", "\u0120*", "\u0120", "2", "\u0120*", "\u0120C", "\u0120+", "\u0120max", "(", "0", ",", "\u0120X", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120A", "\u0120+", "\u0120max", "(", "0", ",", "\u0120Y", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120B", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120s", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02612", "input": "import sys\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(read())\n\nx = N + (-N) % 1000\n\nprint((x - N))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readlines", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(read", "())\u010a\u010a", "x", "\u0120=", "\u0120N", "\u0120+", "\u0120(-", "N", ")", "\u0120%", "\u0120", "1", "0", "0", "0", "\u010a\u010a", "print", "((", "x", "\u0120-", "\u0120N", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03078", "input": "# -*- coding: utf-8 -*-\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nabc = []\n\n\n\nfor i, _a in enumerate(a):\n\n for j, _b in enumerate(b):\n\n if (i+1) * (j+1) > k:\n\n break\n\n for l, _c in enumerate(c):\n\n if (i+1) * (j+1) * (l+1) > k:\n\n break\n\n abc.append(_a + _b + _c)\n\n\n\nabc.sort(reverse=True)\n\nfor x in abc[:k]:\n\n print(x)\n", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-\u010a\u010a", "x", ",", "\u0120y", ",", "\u0120z", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "a", ".sort", "(reverse", "=True", ")\u010a\u010a", "b", ".sort", "(reverse", "=True", ")\u010a\u010a", "c", ".sort", "(reverse", "=True", ")\u010a\u010a\u010a\u010a", "abc", "\u0120=", "\u0120[]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", ",", "\u0120_", "a", "\u0120in", "\u0120enumerate", "(a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", ",", "\u0120_", "b", "\u0120in", "\u0120enumerate", "(b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "+", "1", ")", "\u0120*", "\u0120(", "j", "+", "1", ")", "\u0120>", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120l", ",", "\u0120_", "c", "\u0120in", "\u0120enumerate", "(c", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "+", "1", ")", "\u0120*", "\u0120(", "j", "+", "1", ")", "\u0120*", "\u0120(", "l", "+", "1", ")", "\u0120>", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120abc", ".append", "(_", "a", "\u0120+", "\u0120_", "b", "\u0120+", "\u0120_", "c", ")\u010a\u010a\u010a\u010a", "abc", ".sort", "(reverse", "=True", ")\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120abc", "[:", "k", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(x", ")\u010a"], "input_token_weights": [0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03559", "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nans = 0\n\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n\n i = bisect_left(A, b)\n\n j = bisect(C, b)\n\n ans += i * (N-j)\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "B", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "C", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "A", ".sort", "()\u010a\u010a", "C", ".sort", "()\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", ",", "\u0120bis", "ect", "_left", "\u010a\u010a", "for", "\u0120b", "\u0120in", "\u0120B", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120bis", "ect", "_left", "(A", ",", "\u0120b", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120bis", "ect", "(C", ",", "\u0120b", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120i", "\u0120*", "\u0120(", "N", "-j", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03674", "input": "n = int(input())\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp //= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp //= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n]*invf[i-1]*invf[n-i+1]%mod\n\n if i <= n-1:\n\n S += fact[n-1]*invf[i]*invf[n-1-i]%mod\n\n S %= mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n if i <= n:\n\n S += fact[n-1]*invf[i-1]*invf[n-i]%mod\n\n S %= mod\n\n print(S)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "D", "\u0120=", "\u0120{", "i", ":", "\u0120[", "0", "]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", ")}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120D", "[a", "[i", "]][", "0", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120D", "[a", "[i", "]].", "append", "(i", ")\u010a\u010a", "pl", ",", "\u0120pr", "\u0120=", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120D", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120D", "[i", "][", "0", "]", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120pl", "\u0120=", "\u0120D", "[i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120pr", "\u0120=", "\u0120D", "[i", "][", "2", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "L", "\u0120=", "\u0120pl", "\u010a\u010a", "M", "\u0120=", "\u0120pr", "\u0120-", "\u0120pl", "\u0120-", "\u0120", "1", "\u010a\u010a", "N", "\u0120=", "\u0120n", "\u0120-", "\u0120pr", "\u010a\u010a", "mod", "\u0120=", "\u0120int", "(", "1", "e", "9", ")", "\u0120+", "\u0120", "7", "\u0120#", "\u0120<--", "\u0120input", "\u0120modulo", "\u010a\u010a", "max", "f", "\u0120=", "\u0120n", "+", "1", "1", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120<--", "\u0120input", "\u0120faction", "al", "\u0120limitation", "\u010a\u010a\u010a\u010a", "def", "\u0120make", "_fact", "(n", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120perm", "\u0120=", "\u0120[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[i", "]", "\u0120=", "\u0120tmp", "\u0120%", "\u0120(", "i", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120//=", "\u0120i", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120LL", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120LL", "[i", "]", "\u0120=", "\u0120perm", "[L", "[-", "i", "-", "1", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(L", "[-", "i", "-", "1", "]+", "1", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120perm", "[j", "-", "1", "]", "\u0120=", "\u0120perm", "[j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120LL", "\u010a\u010a\u010a\u010a", "def", "\u0120doubling", "(n", ",", "\u0120m", ",", "\u0120modulo", "=", "mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120base", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120tmp", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120*=", "\u0120base", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120modulo", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120%=", "\u0120modulo", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120base", "\u0120*=", "\u0120base", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120modulo", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120base", "\u0120%=", "\u0120modulo", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120//=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120y", "\u010a\u010a\u010a\u010a", "def", "\u0120inv", "ed", "(a", ",", "\u0120modulo", "=", "mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", ",", "\u0120u", ",", "\u0120v", ",", "\u0120k", ",", "\u0120l", "\u0120=", "\u0120", "1", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "1", ",", "\u0120a", ",", "\u0120modulo", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120l", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", ",", "\u0120u", ",", "\u0120v", "\u0120=", "\u0120u", ",", "\u0120v", ",", "\u0120x", "\u0120-", "\u0120u", "\u0120*", "\u0120(", "k", "\u0120//", "\u0120l", "),", "\u0120y", "\u0120-", "\u0120v", "\u0120*", "\u0120(", "k", "\u0120//", "\u0120l", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", ",", "\u0120l", "\u0120=", "\u0120l", ",", "\u0120k", "\u0120%", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120x", "\u0120%", "\u0120modulo", "\u010a\u010a\u010a\u010a", "fact", "\u0120=", "\u0120[", "1", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(max", "f", "+", "1", ")]\u010a\u010a", "inv", "f", "\u0120=", "\u0120[", "1", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(max", "f", "+", "1", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(max", "f", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fact", "[i", "+", "1", "]", "\u0120=", "\u0120(", "fact", "[i", "]", "\u0120*", "\u0120(", "i", "+", "1", "))", "\u0120%", "\u0120mod", "\u010a\u010a", "inv", "f", "[-", "1", "]", "\u0120=", "\u0120inv", "ed", "(f", "act", "[-", "1", "])\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(max", "f", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "f", "[i", "-", "1", "]", "\u0120=", "\u0120(", "inv", "f", "[i", "]", "\u0120*", "\u0120i", ")", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "2", "):\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120fact", "[n", "]*", "inv", "f", "[i", "-", "1", "]*", "inv", "f", "[n", "-i", "+", "1", "]%", "mod", "\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "\u0120<=", "\u0120n", "-", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120+=", "\u0120fact", "[n", "-", "1", "]*", "inv", "f", "[i", "]*", "inv", "f", "[n", "-", "1", "-i", "]%", "mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "\u0120<=", "\u0120n", "-M", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120-=", "\u0120fact", "[n", "-", "1", "-M", "]*", "inv", "f", "[i", "-", "1", "]*", "inv", "f", "[n", "-M", "-i", "]%", "mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "\u0120<=", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120+=", "\u0120fact", "[n", "-", "1", "]*", "inv", "f", "[i", "-", "1", "]*", "inv", "f", "[n", "-i", "]%", "mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120print", "(S", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.9035222925783293, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.5700083567488032, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.5700083567488032, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.5700083567488032, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.5700083567488032, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399]} +{"problem_id": "p02952", "input": "n = int(input())\n\n\n\n\n\ndef countKeta(num):\n\n count = 1\n\n while num / 10 >= 1:\n\n count += 1\n\n num = num // 10\n\n return count\n\n\n\n\n\ncount = 0\n\n\n\nfor i in range(1, n+1):\n\n if(countKeta(i) % 2 == 1):\n\n count += 1\n\n\n\nprint(count)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a\u010a\u010a", "def", "\u0120count", "K", "eta", "(num", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120num", "\u0120/", "\u0120", "1", "0", "\u0120>=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120num", "\u0120//", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120count", "\u010a\u010a\u010a\u010a\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(count", "K", "eta", "(i", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p02996", "input": "\n\n\n\nn = int(input())\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\nabn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))", "input_tokens": ["\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "ab", "n", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a\u010a\u010a", "ab", "n", ".sort", "()\u010a\u010a", "ab", "n", ".sort", "(key", "\u0120=", "\u0120lambda", "\u0120x", ":x", "[", "1", "])\u010a\u010a", "\u010a\u010a\u010a\u010a", "#print", "(ab", "n", ")\u010a\u010a\u010a\u010a", "ts", "\u0120=", "\u0120", "0", "\u0120#", "\u0120time", "_stamp", "\u010a\u010a", "enable", "\u0120=", "\u0120True", "\u010a\u010a", "for", "\u0120abi", "\u0120in", "\u0120ab", "n", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120abi", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120ts", "\u0120+", "\u0120a", "\u0120<=", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120enable", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ts", "\u0120+=", "\u0120a", "\u010a\u010a\u010a\u010a", "print", "(('", "Yes", "'", "\u0120if", "\u0120enable", "\u0120else", "\u0120'", "No", "'))"], "input_token_weights": [0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p00053", "input": "def isPrime(x):\n\n if x == 2:\n\n return True\n\n if x < 2 or x % 2 == 0:\n\n return False\n\n i, root_x = 3, int(pow(x, 0.5))\n\n while i <= root_x:\n\n if x % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nprimes = [2]\n\nfor i in range(3, 104730):\n\n if isPrime(i):\n\n primes.append(primes[-1]+i)\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n print((primes[n-1]))", "input_tokens": ["def", "\u0120is", "Prime", "(x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120<", "\u0120", "2", "\u0120or", "\u0120x", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", ",", "\u0120root", "_x", "\u0120=", "\u0120", "3", ",", "\u0120int", "(pow", "(x", ",", "\u0120", "0", ".", "5", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120<=", "\u0120root", "_x", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a\u010a\u010a", "pr", "imes", "\u0120=", "\u0120[", "2", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",", "\u0120", "1", "0", "4", "7", "3", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120is", "Prime", "(i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120primes", ".append", "(pr", "imes", "[-", "1", "]+", "i", ")\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "pr", "imes", "[n", "-", "1", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p03162", "input": "# https://atcoder.jp/contests/dp/tasks/dp_c\n\nimport numpy as np\n\nN = int(input())\n\nMax_List=[]\n\nN_List=[i for i in range(3)]\n\nfor i in range(N):\n\n Current_List=list(map(int,input().split())) \n\n if i == 0:\n\n Max_List.append(Current_List)\n\n else:\n\n Current_Max_List = []\n\n for j in range(3):\n\n Index_List=np.array(Max_List[i-1])\n\n ind = np.ones(3, dtype=bool)\n\n ind[j] = False\n\n Current_Max_List.append(max(Index_List[ind])+Current_List[j])\n\n \n\n Max_List.append(Current_Max_List)\n\n \n\n \n\nprint((max(Max_List[-1])))", "input_tokens": ["#", "\u0120https", "://", "at", "coder", ".jp", "/", "cont", "ests", "/d", "p", "/tasks", "/d", "p", "_c", "\u010a\u010a", "import", "\u0120numpy", "\u0120as", "\u0120np", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "Max", "_List", "=[]", "\u010a\u010a", "N", "_List", "=[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120Current", "_List", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Max", "_List", ".append", "(Current", "_List", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Current", "_Max", "_List", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Index", "_List", "=np", ".array", "(Max", "_List", "[i", "-", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ind", "\u0120=", "\u0120np", ".ones", "(", "3", ",", "\u0120dtype", "=bool", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ind", "[j", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Current", "_Max", "_List", ".append", "(max", "(Index", "_List", "[ind", "])+", "Current", "_List", "[j", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Max", "_List", ".append", "(Current", "_Max", "_List", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "((", "max", "(Max", "_List", "[-", "1", "])))"], "input_token_weights": [0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293]} +{"problem_id": "p03835", "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if x >= 0 and x <= K:\n\n ans += 1\n\nprint(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "7", ")\u010a\u010a\u010a\u010a", "K", ",", "\u0120S", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120z", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120S", "\u0120-", "\u0120(", "z", "\u0120+", "\u0120y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120>=", "\u0120", "0", "\u0120and", "\u0120x", "\u0120<=", "\u0120K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02996", "input": "n=int(input())\n\ntask=[] \n\nfor _ in range(n):\n\n a,b=list(map(int,input().split()))\n\n task.append((b, -a))\n\n\n\ntask.sort()\n\n\n\ntime=0\n\nflag=True\n\nfor i in task:\n\n time-=i[1]\n\n if time>i[0]:\n\n flag=False\n\n break\n\n\n\nif flag:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n\n", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "task", "=[]", "\u0120\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120task", ".append", "((", "b", ",", "\u0120-", "a", "))", "\u010a\u010a\u010a\u010a", "task", ".sort", "()\u010a\u010a\u010a\u010a", "time", "=", "0", "\u010a\u010a", "flag", "=True", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120task", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120time", "-=", "i", "[", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120time", ">i", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120flag", "=False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "if", "\u0120flag", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Yes", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "No", "\")\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p03038", "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heapify,heappop,heappush\n\nfrom bisect import bisect_left,bisect_right\n\nimport sys,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn,m = inpl()\n\na = inpl()\n\nb = [0] * m\n\nfor i in range(m):\n\n x,y = inpl()\n\n b[i] = [x,y]\n\na.sort()\n\nb.sort(key=lambda x:x[1], reverse = True)\n\nres = sum(a)\n\ni = 0\n\nj = 0\n\nwhile True:\n\n # print(i,j)\n\n if a[i] < b[j][1]:\n\n res += b[j][1] - a[i]\n\n i += 1\n\n else:\n\n break\n\n b[j][0] -= 1\n\n if b[j][0] == 0:\n\n j += 1\n\n if i >= n or j >= m:\n\n break\n\nprint(res)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", ",default", "dict", ",", "deque", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120heap", "ify", ",", "he", "app", "op", ",", "he", "app", "ush", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", ",b", "is", "ect", "_right", "\u010a\u010a", "import", "\u0120sys", ",", "math", ",it", "ertools", ",string", ",", "queue", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "8", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "def", "\u0120inp", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120in", "pl", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120in", "pl", "_str", "():", "\u0120return", "\u0120list", "(sys", ".stdin", ".readline", "().", "split", "())\u010a\u010a", "def", "\u0120in", "pl", "n", "(n", "):", "\u0120return", "\u0120list", "(int", "(sys", ".stdin", ".readline", "())", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "))", "\u010a\u010a\u010a\u010a", "n", ",m", "\u0120=", "\u0120in", "pl", "()\u010a\u010a", "a", "\u0120=", "\u0120in", "pl", "()\u010a\u010a", "b", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120m", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",y", "\u0120=", "\u0120in", "pl", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "[i", "]", "\u0120=", "\u0120[", "x", ",y", "]\u010a\u010a", "a", ".sort", "()\u010a\u010a", "b", ".sort", "(key", "=lambda", "\u0120x", ":x", "[", "1", "],", "\u0120reverse", "\u0120=", "\u0120True", ")\u010a\u010a", "res", "\u0120=", "\u0120sum", "(a", ")\u010a\u010a", "i", "\u0120=", "\u0120", "0", "\u010a\u010a", "j", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(i", ",j", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[i", "]", "\u0120<", "\u0120b", "[j", "][", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120+=", "\u0120b", "[j", "][", "1", "]", "\u0120-", "\u0120a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "[j", "][", "0", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120b", "[j", "][", "0", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120>=", "\u0120n", "\u0120or", "\u0120j", "\u0120>=", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "print", "(res", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8474406118450124, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.6673426178365944, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348]} +{"problem_id": "p02891", "input": "s = input()\n\nk = int(input())\n\n\n\nif len(set(s)) == 1:\n\n print(((len(s)*k)//2))\n\n exit()\n\n\n\nss = s + s\n\n\n\nshoko = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(s)):\n\n if s[i] == prev:\n\n cnt += 1\n\n else:\n\n shoko += cnt // 2\n\n cnt = 1\n\n prev = s[i]\n\nshoko += cnt // 2\n\n\n\nkosa = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(ss)):\n\n if ss[i] == prev:\n\n cnt += 1\n\n else:\n\n kosa += cnt // 2\n\n cnt = 1\n\n prev = ss[i]\n\nkosa += cnt // 2\n\nkosa -= shoko\n\n\n\nprint((shoko + (k-1)*kosa))", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a", "k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "if", "\u0120len", "(set", "(s", "))", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "len", "(s", ")*", "k", ")//", "2", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "ss", "\u0120=", "\u0120s", "\u0120+", "\u0120s", "\u010a\u010a\u010a\u010a", "sh", "oko", "\u0120=", "\u0120", "0", "\u010a\u010a", "prev", "\u0120=", "\u0120''\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120==", "\u0120prev", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sh", "oko", "\u0120+=", "\u0120cnt", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120s", "[i", "]\u010a\u010a", "sh", "oko", "\u0120+=", "\u0120cnt", "\u0120//", "\u0120", "2", "\u010a\u010a\u010a\u010a", "k", "osa", "\u0120=", "\u0120", "0", "\u010a\u010a", "prev", "\u0120=", "\u0120''\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(ss", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ss", "[i", "]", "\u0120==", "\u0120prev", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "osa", "\u0120+=", "\u0120cnt", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120ss", "[i", "]\u010a\u010a", "k", "osa", "\u0120+=", "\u0120cnt", "\u0120//", "\u0120", "2", "\u010a\u010a", "k", "osa", "\u0120-=", "\u0120sh", "oko", "\u010a\u010a\u010a\u010a", "print", "((", "sh", "oko", "\u0120+", "\u0120(", "k", "-", "1", ")*", "k", "osa", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028]} +{"problem_id": "p03081", "input": "n,q=list(map(int,input().split()));s=\"_\"+input()+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:L=h==\"L\";R=h==\"R\";l,r=[l,l-1,l+1][(m==s[l]and R)-(m==s[l+1]and L)],[r,r-1,r+1][(m==s[r-1]and R)-(m==s[r]and L)]\n\nprint((max(0,r-l-1)))", "input_tokens": ["n", ",q", "=list", "(map", "(int", ",input", "().", "split", "()));", "s", "=\"_", "\"+", "input", "()+\"", "_", "\";", "l", ",r", "=", "0", ",n", "+", "1", "\u010a\u010a", "for", "(m", ",h", ")", "in", "[input", "().", "split", "()", "for", "\u0120i", "\u0120in", "\u0120range", "(q", ")][", "::-", "1", "]:", "L", "=h", "==\"", "L", "\";", "R", "=h", "==\"", "R", "\";", "l", ",r", "=[", "l", ",l", "-", "1", ",l", "+", "1", "][(", "m", "==", "s", "[l", "]", "and", "\u0120R", ")-(", "m", "==", "s", "[l", "+", "1", "]", "and", "\u0120L", ")", "],[", "r", ",r", "-", "1", ",r", "+", "1", "][(", "m", "==", "s", "[r", "-", "1", "]", "and", "\u0120R", ")-(", "m", "==", "s", "[r", "]", "and", "\u0120L", ")]\u010a\u010a", "print", "((", "max", "(", "0", ",r", "-l", "-", "1", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03796", "input": "import math\n\n\n\nn = int(input())\n\nprint((math.factorial(n) % (10 ** 9 + 7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "\u0120%", "\u0120(", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03035", "input": "a,b=list(map(int,input().split()))\n\nprint((b if 13<=a else b//2 if 6<=a else 0))", "input_tokens": ["a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "print", "((", "b", "\u0120if", "\u0120", "1", "3", "<=", "a", "\u0120else", "\u0120b", "//", "2", "\u0120if", "\u0120", "6", "<=", "a", "\u0120else", "\u0120", "0", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02688", "input": "N,K=list(map(int,input().split()))\n\n\n\ncon = 0\n\nans = list(int() for _ in range(100000))\n\npre = 0\n\n\n\n\n\nfor _ in range(K):\n\n\n\n D = int(input())\n\n arr = list(map(int,input().split()))\n\n\n\n for j in range(D):\n\n\n\n ans[pre+j]=arr[j]\n\n\n\n pre += D\n\n\n\n \n\nfin = (N+1) - len(set(ans))\n\n\n\nprint(fin)", "input_tokens": ["N", ",K", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "con", "\u0120=", "\u0120", "0", "\u010a\u010a", "ans", "\u0120=", "\u0120list", "(int", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "1", "0", "0", "0", "0", "0", "))\u010a\u010a", "pre", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(K", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120D", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120arr", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(D", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "[", "pre", "+j", "]=", "arr", "[j", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120pre", "\u0120+=", "\u0120D", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "fin", "\u0120=", "\u0120(", "N", "+", "1", ")", "\u0120-", "\u0120len", "(set", "(ans", "))", "\u010a\u010a\u010a\u010a", "print", "(fin", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03162", "input": "def main():\n\n n = int(input())\n\n a = [0]\n\n b = [0]\n\n c = [0]\n\n\n\n for i in range(n):\n\n aa,bb,cc = list(map(int,input().split()))\n\n a.append(max(b[i] + aa, c[i] + aa))\n\n b.append(max(a[i] + bb, c[i] + bb))\n\n c.append(max(a[i] + cc, b[i] + cc))\n\n\n\n print((max(a[-1], b[-1], c[-1])))\n\n\n\nmain()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120", "\u0120a", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "\u0120", "\u0120b", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "\u0120", "\u0120c", "\u0120=", "\u0120[", "0", "]\u010a\u010a\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120aa", ",", "bb", ",", "cc", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120a", ".append", "(max", "(b", "[i", "]", "\u0120+", "\u0120aa", ",", "\u0120c", "[i", "]", "\u0120+", "\u0120aa", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120b", ".append", "(max", "(a", "[i", "]", "\u0120+", "\u0120bb", ",", "\u0120c", "[i", "]", "\u0120+", "\u0120bb", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120c", ".append", "(max", "(a", "[i", "]", "\u0120+", "\u0120cc", ",", "\u0120b", "[i", "]", "\u0120+", "\u0120cc", "))", "\u010a\u010a\u010a\u010a", "\u0120", "\u0120print", "((", "max", "(a", "[-", "1", "],", "\u0120b", "[-", "1", "],", "\u0120c", "[-", "1", "]))", ")\u010a\u010a\u010a\u010a", "main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02414", "input": "import sys\n\ne=[list(map(int,e.split()))for e in sys.stdin]\n\nn=e[0][0]+1\n\nfor c in e[1:n]:\n\n t=''\n\n for l in zip(*e[n:]):t+=f'{sum(s*t for s,t in zip(c,l))} '\n\n print((t[:-1]))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "e", "=[", "list", "(map", "(int", ",e", ".split", "()))", "for", "\u0120e", "\u0120in", "\u0120sys", ".stdin", "]\u010a\u010a", "n", "=e", "[", "0", "][", "0", "]+", "1", "\u010a\u010a", "for", "\u0120c", "\u0120in", "\u0120e", "[", "1", ":n", "]:\u010a\u010a", "\u0120t", "='", "'\u010a\u010a", "\u0120for", "\u0120l", "\u0120in", "\u0120zip", "(*", "e", "[n", ":", "]):", "t", "+=", "f", "'{", "sum", "(s", "*t", "\u0120for", "\u0120s", ",t", "\u0120in", "\u0120zip", "(c", ",l", "))", "}", "\u0120'\u010a\u010a", "\u0120print", "((", "t", "[:-", "1", "]))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02814", "input": "from functools import reduce\n\nfrom math import gcd\n\n\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\ndef sub_by_2(n):\n\n cnt = 0\n\n while n % 2 == 0:\n\n n //= 2\n\n cnt += 1\n\n return cnt\n\n\n\nlcm_2 = [sub_by_2(n // 2) for n in A]\n\nif all(lcm_2[0] == v for v in lcm_2):\n\n num = reduce(lcm, [v // 2 for v in A])\n\n res = M // num\n\n print((res // 2 + res % 2))\n\nelse:\n\n print((0))\n", "input_tokens": ["from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120M", ",", "\u0120*", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120lcm", "(x", ",", "\u0120y", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120x", "\u0120*", "\u0120y", "\u0120//", "\u0120gcd", "(x", ",", "\u0120y", ")\u010a\u010a\u010a\u010a", "def", "\u0120sub", "_by", "_", "2", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120n", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120//=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120cnt", "\u010a\u010a\u010a\u010a", "l", "cm", "_", "2", "\u0120=", "\u0120[", "sub", "_by", "_", "2", "(n", "\u0120//", "\u0120", "2", ")", "\u0120for", "\u0120n", "\u0120in", "\u0120A", "]\u010a\u010a", "if", "\u0120all", "(l", "cm", "_", "2", "[", "0", "]", "\u0120==", "\u0120v", "\u0120for", "\u0120v", "\u0120in", "\u0120lcm", "_", "2", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120reduce", "(l", "cm", ",", "\u0120[", "v", "\u0120//", "\u0120", "2", "\u0120for", "\u0120v", "\u0120in", "\u0120A", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120M", "\u0120//", "\u0120num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "res", "\u0120//", "\u0120", "2", "\u0120+", "\u0120res", "\u0120%", "\u0120", "2", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02552", "input": "x = int(input())\n\nif x == 0:\n\n print((1))\n\nelse:\n\n print((0))", "input_tokens": ["x", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "if", "\u0120x", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120", "\u0120print", "((", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02959", "input": "from sys import stdin,stdout\n\n\n\nif __name__==\"__main__\":\n\n n=int(stdin.readline())\n\n\n\n a=[int(x) for x in stdin.readline().split()]\n\n b=[int(x) for x in stdin.readline().split()]\n\n\n\n cnt=0\n\n\n\n for i in range(n):\n\n if(a[i]>=b[i]):\n\n cnt+=b[i]\n\n else:\n\n cnt+=a[i]\n\n d=b[i]-a[i]\n\n cnt+=min(a[i+1],d)\n\n if(d>a[i+1]):\n\n a[i+1]=0\n\n else: a[i+1]-=d\n\n \n\n stdout.write(str(cnt)+\"\\n\")\n", "input_tokens": ["from", "\u0120sys", "\u0120import", "\u0120stdin", ",", "stdout", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "==\"", "__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=int", "(stdin", ".readline", "())\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120stdin", ".readline", "().", "split", "()]\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120stdin", ".readline", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "=", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(a", "[i", "]>=", "b", "[i", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "+=", "b", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "+=", "a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "=b", "[i", "]-", "a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "+=", "min", "(a", "[i", "+", "1", "],", "d", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(d", ">a", "[i", "+", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[i", "+", "1", "]=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120a", "[i", "+", "1", "]-", "=", "d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120stdout", ".write", "(str", "(cnt", ")+\"", "\\", "n", "\")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891]} +{"problem_id": "p03608", "input": "def main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = float(\"Inf\")\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120from", "\u0120itertools", "\u0120import", "\u0120permutations", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120m", ",", "\u0120r", ",", "\u0120*", "x", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120to", "\u0120=", "\u0120x", "[:", "r", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120dis", "\u0120=", "\u0120[[", "float", "(\"", "Inf", "\")]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", "\u0120+", "\u0120", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dis", "[i", "][", "i", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120zip", "(*", "[", "iter", "(x", "[r", ":", "])]", "\u0120*", "\u0120", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dis", "[a", "][", "b", "]", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dis", "[b", "][", "a", "]", "\u0120=", "\u0120c", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dis", "[i", "][", "j", "]", "\u0120=", "\u0120min", "(dis", "[i", "][", "j", "],", "\u0120dis", "[i", "][", "k", "]", "\u0120+", "\u0120dis", "[k", "][", "j", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120float", "(\"", "Inf", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120p", "\u0120in", "\u0120permutations", "(to", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nw", "\u0120=", "\u0120p", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120nx", "\u0120in", "\u0120p", "[", "1", ":]", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120dis", "[n", "w", "][", "nx", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nw", "\u0120=", "\u0120nx", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120tmp", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03416", "input": "counter = 0\n\nc = list(map(int, input().split(' ')))\n\nfor i in range(c[0], c[1] + 1):\n\n if str(i)[0] != str(i)[4]:\n\n continue\n\n if str(i)[1] != str(i)[3]:\n\n continue\n\n counter += 1\n\n\n\nprint(counter)", "input_tokens": ["counter", "\u0120=", "\u0120", "0", "\u010a\u010a", "c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "('", "\u0120'", ")))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(c", "[", "0", "],", "\u0120c", "[", "1", "]", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120str", "(i", ")[", "0", "]", "\u0120!=", "\u0120str", "(i", ")[", "4", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120", "\u0120if", "\u0120str", "(i", ")[", "1", "]", "\u0120!=", "\u0120str", "(i", ")[", "3", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120", "\u0120counter", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(counter", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03038", "input": "I=lambda:list(map(int,input().split()))\n\nn,m=I()\n\na=I()\n\na.sort(reverse=True)\n\nqq=[I() for i in range(m)]\n\nqq.sort(key=lambda x:x[1],reverse=True)\n\nans=0\n\nfor x,y in qq:\n\n for j in range(x):\n\n if not a:\n\n break\n\n aa=a.pop()\n\n ans+=max(aa,y)\n\nans+=sum(a)\n\nprint(ans)\n\n ", "input_tokens": ["I", "=lambda", ":list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "n", ",m", "=", "I", "()\u010a\u010a", "a", "=", "I", "()\u010a\u010a", "a", ".sort", "(reverse", "=True", ")\u010a\u010a", "qq", "=[", "I", "()", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(m", ")]\u010a\u010a", "qq", ".sort", "(key", "=lambda", "\u0120x", ":x", "[", "1", "],", "reverse", "=True", ")\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120x", ",y", "\u0120in", "\u0120qq", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(x", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120aa", "=a", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "max", "(aa", ",y", ")\u010a\u010a", "ans", "+=", "sum", "(a", ")\u010a\u010a", "print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428]} +{"problem_id": "p03037", "input": "N, M =list(map(int, input().split()))\n\nL = [0 for i in range(N+1)]\n\nR = [0 for i in range(N+1)]\n\nfor i in range(M):\n\n l,r = list(map(int, input().split()))\n\n L[l] += 1\n\n R[r] += 1\n\ncnt = 0\n\ntmp = 0\n\nfor i in range(N+1):\n\n tmp += L[i]\n\n if tmp == M:\n\n cnt += 1\n\n tmp -= R[i]\n\nprint(cnt)\n", "input_tokens": ["N", ",", "\u0120M", "\u0120=", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", ")]\u010a\u010a", "R", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ",r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", "[l", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", "[r", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "tmp", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120L", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "\u0120==", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120-=", "\u0120R", "[i", "]\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891]} +{"problem_id": "p03558", "input": "from collections import deque\n\nK = int(input())\n\nG = [[] for i in range(K)]\n\n\n\nfor n in range(K):\n\n G[n].append([(n + 1) % K, 1])\n\n G[n].append([(10 * n) % K, 0])\n\n\n\nque = deque([[1, 1]])\n\ndist = [float('inf')] * K\n\n\n\nwhile que:\n\n node, cost = que.pop()\n\n dist[node] = min(cost, dist[node])\n\n for e, e_cost in G[node]:\n\n if dist[e] != float('inf'):\n\n continue\n\n\n\n if e_cost == 0:\n\n que.append([e, cost + 0])\n\n\n\n if e_cost == 1:\n\n que.appendleft([e, cost + 1])\n\n\n\nprint((dist[0]))\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "K", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "G", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(K", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120n", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120G", "[n", "].", "append", "([(", "n", "\u0120+", "\u0120", "1", ")", "\u0120%", "\u0120K", ",", "\u0120", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120G", "[n", "].", "append", "([(", "1", "0", "\u0120*", "\u0120n", ")", "\u0120%", "\u0120K", ",", "\u0120", "0", "])\u010a\u010a", "\u010a\u010a", "que", "\u0120=", "\u0120deque", "([[", "1", ",", "\u0120", "1", "]])\u010a\u010a", "dist", "\u0120=", "\u0120[", "float", "('", "inf", "')]", "\u0120*", "\u0120K", "\u010a\u010a\u010a\u010a", "while", "\u0120que", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120node", ",", "\u0120cost", "\u0120=", "\u0120que", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120dist", "[node", "]", "\u0120=", "\u0120min", "(cost", ",", "\u0120dist", "[node", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120e", ",", "\u0120e", "_cost", "\u0120in", "\u0120G", "[node", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dist", "[e", "]", "\u0120!=", "\u0120float", "('", "inf", "')", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120e", "_cost", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".append", "([", "e", ",", "\u0120cost", "\u0120+", "\u0120", "0", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120e", "_cost", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".append", "left", "([", "e", ",", "\u0120cost", "\u0120+", "\u0120", "1", "])\u010a\u010a", "\u010a\u010a", "print", "((", "dist", "[", "0", "]))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.5886835746651548, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03307", "input": "import math\n\n\n\n\n\ndef lcm(x, y):\n\n return (x * y) // math.gcd(x, y)\n\n\n\n\n\nN = int(input())\n\nprint((lcm(N, 2)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120lcm", "(x", ",", "\u0120y", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "x", "\u0120*", "\u0120y", ")", "\u0120//", "\u0120math", ".g", "cd", "(x", ",", "\u0120y", ")\u010a\u010a\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "l", "cm", "(N", ",", "\u0120", "2", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02555", "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n for i in range(x-2):\n\n ret += rec(i)\n\n ret %= mod\n\n return ret\n\n\n\nprint((rec(S)))\n", "input_tokens": ["import", "\u0120sys", ",", "\u0120re", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", ",", "\u0120defaultdict", ",", "\u0120Counter", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120ceil", ",", "\u0120sqrt", ",", "\u0120hyp", "ot", ",", "\u0120factorial", ",", "\u0120pi", ",", "\u0120sin", ",", "\u0120cos", ",", "\u0120radians", ",", "\u0120gcd", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120accumulate", ",", "\u0120permutations", ",", "\u0120combinations", ",", "\u0120product", ",", "\u0120group", "by", ",", "\u0120combinations", "_with", "_re", "placement", "\u010a\u010a", "from", "\u0120operator", "\u0120import", "\u0120item", "getter", ",", "\u0120mul", "\u010a\u010a", "from", "\u0120copy", "\u0120import", "\u0120deepcopy", "\u010a\u010a", "from", "\u0120string", "\u0120import", "\u0120ascii", "_lowercase", ",", "\u0120ascii", "_upper", "case", ",", "\u0120digits", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", ",", "\u0120bis", "ect", "_left", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120reduce", ",", "\u0120l", "ru", "_cache", "\u010a\u010a", "def", "\u0120input", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a", "def", "\u0120INT", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120MAP", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120LIST", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120ZIP", "(n", "):", "\u0120return", "\u0120list", "(zip", "(*(", "MAP", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", "))))\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120INT", "()\u010a\u010a\u010a\u010a", "@", "l", "ru", "_cache", "(max", "size", "=None", ")\u010a\u010a", "def", "\u0120rec", "(x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120", "0", ":", "\u0120return", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(x", "-", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120rec", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "print", "((", "rec", "(S", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03037", "input": "import sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nlr = list(zip(*[iter(lr)] * 2))\n\n\n\ndef main():\n\n cnt = [0] * (n + 1)\n\n for l, r in lr:\n\n cnt[l-1] += 1\n\n cnt[r] -= 1\n\n \n\n for i in range(n):\n\n cnt[i+1] += cnt[i]\n\n \n\n res = 0\n\n for i in range(n):\n\n res += (cnt[i] == m) & 1\n\n \n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", ",", "\u0120*", "lr", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".read", "().", "split", "()))\u010a\u010a", "lr", "\u0120=", "\u0120list", "(zip", "(*", "[", "iter", "(lr", ")]", "\u0120*", "\u0120", "2", "))", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120l", ",", "\u0120r", "\u0120in", "\u0120lr", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "[l", "-", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "[r", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "[i", "+", "1", "]", "\u0120+=", "\u0120cnt", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120+=", "\u0120(", "cnt", "[i", "]", "\u0120==", "\u0120m", ")", "\u0120&", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120res", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120main", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p01438", "input": "from collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n D = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n for s in range(s-6,e-6):\n\n t |= 1 << s\n\n D[man] = t\n\n\n\n dp = [defaultdict(int) for i in range(n)]\n\n dp[0][D[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp[i-1].keys()):\n\n if bit&D[i] == 0:\n\n dp[i][bit|D[i]] = max(dp[i][bit|D[i]], dp[i-1][bit]+L[i])\n\n dp[i][bit] = max(dp[i][bit],dp[i-1][bit])\n\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n\n \n\n ans = max(max(dp[i].values()) for i in range(n))\n\n print(ans)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "while", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120D", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120man", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", ",l", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[", "man", "]", "\u0120=", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120date", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", ",e", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120s", "\u0120in", "\u0120range", "(s", "-", "6", ",e", "-", "6", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120|=", "\u0120", "1", "\u0120<<", "\u0120s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120D", "[", "man", "]", "\u0120=", "\u0120t", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[", "default", "dict", "(int", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "][", "D", "[", "0", "]]", "\u0120=", "\u0120L", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120bit", "\u0120in", "\u0120list", "(dp", "[i", "-", "1", "].", "keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120bit", "&D", "[i", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "bit", "|", "D", "[i", "]]", "\u0120=", "\u0120max", "(dp", "[i", "][", "bit", "|", "D", "[i", "]],", "\u0120dp", "[i", "-", "1", "][", "bit", "]+", "L", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "bit", "]", "\u0120=", "\u0120max", "(dp", "[i", "][", "bit", "],", "dp", "[i", "-", "1", "][", "bit", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "D", "[i", "]]", "\u0120=", "\u0120max", "(dp", "[i", "][", "D", "[i", "]],", "\u0120L", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(max", "(dp", "[i", "].", "values", "())", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734]} +{"problem_id": "p03208", "input": "N, K = list(map(int, input().split()))\n\n\n\nheight = []\n\nfor _ in range(N) :\n\n height.append(int(input()))\n\n\n\nheight.sort()\n\nans = float('inf')\n\n\n\nfor i in range(N-K+1) :\n\n diff = height[i + K - 1] - height[i]\n\n ans = min(ans, diff)\n\n\n\nprint(ans)", "input_tokens": ["N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "height", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", ")", "\u0120:\u010a\u010a", "\u0120\u0120\u0120", "\u0120height", ".append", "(int", "(input", "()))", "\u010a\u010a\u010a\u010a", "height", ".sort", "()\u010a\u010a", "ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-K", "+", "1", ")", "\u0120:\u010a\u010a", "\u0120\u0120\u0120", "\u0120diff", "\u0120=", "\u0120height", "[i", "\u0120+", "\u0120K", "\u0120-", "\u0120", "1", "]", "\u0120-", "\u0120height", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120diff", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03032", "input": "from collections import deque\n\n\n\nn, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor t in range(k//2 + 1):\n\n hand = deque(V[:k-t])\n\n rest = deque(V[k-t:])\n\n cur_sum = sum(hand)\n\n\n\n for j in range(k-t+1):\n\n put_back = 0\n\n rev_hand = sorted(hand)\n\n\n\n for i in range(t):\n\n jewel = rev_hand[i]\n\n if jewel < 0:\n\n put_back -= jewel\n\n else:\n\n break\n\n\n\n candidate = cur_sum + put_back\n\n ans = max(candidate, ans)\n\n\n\n to_rest = hand.pop()\n\n rest.appendleft(to_rest)\n\n to_hand = rest.pop()\n\n hand.appendleft(to_hand)\n\n\n\n cur_sum += to_hand - to_rest\n\n\n\nprint(ans)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "V", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120t", "\u0120in", "\u0120range", "(k", "//", "2", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120hand", "\u0120=", "\u0120deque", "(V", "[:", "k", "-t", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120rest", "\u0120=", "\u0120deque", "(V", "[k", "-t", ":", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120cur", "_sum", "\u0120=", "\u0120sum", "(hand", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "-t", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120put", "_back", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120rev", "_hand", "\u0120=", "\u0120sorted", "(hand", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(t", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120jewel", "\u0120=", "\u0120rev", "_hand", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120jewel", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120put", "_back", "\u0120-=", "\u0120jewel", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120candidate", "\u0120=", "\u0120cur", "_sum", "\u0120+", "\u0120put", "_back", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(candidate", ",", "\u0120ans", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120to", "_rest", "\u0120=", "\u0120hand", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120rest", ".append", "left", "(to", "_rest", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120to", "_hand", "\u0120=", "\u0120rest", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120hand", ".append", "left", "(to", "_hand", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "_sum", "\u0120+=", "\u0120to", "_hand", "\u0120-", "\u0120to", "_rest", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354]} +{"problem_id": "p02863", "input": "n,t=list(map(int,input().split()))\n\nab=[list(map(int,input().split()))for _ in range(n)]\n\nab.sort()\n\ndp=[(6007)*[0]for _ in range(n+1)]\n\ndp[0][0]=0\n\nans=0\n\nfor i in range(n):\n\n for j in range(6007):\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\n if j>= 1\n\n return r\n\n\n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\n\n\nm = 0\n\nl = (1 << n) - 1\n\nfor x in range(1, l + 1):\n\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n\n m = max(m, popcount(x))\n\nprint(m)\n", "input_tokens": ["def", "\u0120pop", "count", "(x", "):\u010a\u010a", "\u0120", "\u0120r", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120while", "\u0120x", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120&", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120>>=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120return", "\u0120r", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "r", "\u0120=", "\u0120list", "(range", "(n", "))\u010a\u010a", "a", "\u0120=", "\u0120[[", "0", ",", "\u0120", "0", "]", "\u0120for", "\u0120_", "\u0120in", "\u0120r", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120r", ":\u010a\u010a", "\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(int", "(input", "()))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "[i", "][", "y", "]", "\u0120|=", "\u0120", "1", "\u0120<<", "\u0120(", "x", "\u0120-", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "m", "\u0120=", "\u0120", "0", "\u010a\u010a", "l", "\u0120=", "\u0120(", "1", "\u0120<<", "\u0120n", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "1", ",", "\u0120l", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120all", "(a", "[i", "][", "0", "]", "\u0120&", "\u0120x", "\u0120==", "\u0120a", "[i", "][", "1", "]", "\u0120&", "\u0120l", "\u0120-", "\u0120x", "\u0120==", "\u0120", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120r", "\u0120if", "\u0120x", "\u0120>>", "\u0120i", "\u0120&", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120max", "(m", ",", "\u0120pop", "count", "(x", "))\u010a\u010a", "print", "(m", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p03039", "input": "n, m, k = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\nMAX = n * m\n\n\n\n\n\nclass ModInt:\n\n def __init__(self, num):\n\n self.num = num\n\n\n\n def __str__(self):\n\n return str(self.num)\n\n\n\n def __repr__(self):\n\n return \"ModInt(num: {}, mod: {}\".format(self.num, mod)\n\n\n\n def __add__(self, other):\n\n ret = self.num + other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __sub__(self, other):\n\n ret = self.num - other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __mul__(self, other):\n\n ret = self.num * other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def pow(self, times):\n\n pw = pow(self.num, times, mod)\n\n return ModInt(pw)\n\n\n\n def inverse(self):\n\n return ModInt(inv[self.num])\n\n\n\n def __truediv__(self, other):\n\n num = self * other.inverse()\n\n return ModInt(num)\n\n\n\n\n\ndef comb(n, k):\n\n return fact[n] * inv[n-k] * inv[k]\n\n\n\n\n\nfact = [None] * (MAX + 1)\n\nfact[0] = ModInt(1)\n\nfor i in range(1, MAX + 1):\n\n fact[i] = fact[i-1] * ModInt(i)\n\n\n\ninv = [None] * (MAX + 1)\n\ninv[MAX] = fact[MAX].pow(mod - 2)\n\nfor i in range(MAX, 0, -1):\n\n inv[i-1] = inv[i] * ModInt(i)\n\n\n\nans = ModInt(0)\n\nfor i in range(n):\n\n for j in range(m):\n\n add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)\n\n if i != 0 and j != 0:\n\n add *= ModInt(2)\n\n\n\n ans += add\n\n\n\nans *= comb(n * m - 2, k - 2)\n\nprint(ans)\n", "input_tokens": ["n", ",", "\u0120m", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "MAX", "\u0120=", "\u0120n", "\u0120*", "\u0120m", "\u010a\u010a\u010a\u010a\u010a\u010a", "class", "\u0120Mod", "Int", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120num", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".num", "\u0120=", "\u0120num", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "str", "__(", "self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120str", "(self", ".num", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "repr", "__(", "self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120\"", "Mod", "Int", "(num", ":", "\u0120{},", "\u0120mod", ":", "\u0120{}\".", "format", "(self", ".num", ",", "\u0120mod", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "add", "__(", "self", ",", "\u0120other", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120self", ".num", "\u0120+", "\u0120other", ".num", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(ret", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "sub", "__(", "self", ",", "\u0120other", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120self", ".num", "\u0120-", "\u0120other", ".num", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(ret", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "mul", "__(", "self", ",", "\u0120other", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120self", ".num", "\u0120*", "\u0120other", ".num", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(ret", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120pow", "(self", ",", "\u0120times", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pw", "\u0120=", "\u0120pow", "(self", ".num", ",", "\u0120times", ",", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(p", "w", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120inverse", "(self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(inv", "[self", ".num", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "tr", "ued", "iv", "__(", "self", ",", "\u0120other", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120self", "\u0120*", "\u0120other", ".inverse", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(num", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120comb", "(n", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120fact", "[n", "]", "\u0120*", "\u0120inv", "[n", "-k", "]", "\u0120*", "\u0120inv", "[k", "]", "\u010a\u010a\u010a\u010a\u010a\u010a", "fact", "\u0120=", "\u0120[", "None", "]", "\u0120*", "\u0120(", "MAX", "\u0120+", "\u0120", "1", ")\u010a\u010a", "fact", "[", "0", "]", "\u0120=", "\u0120Mod", "Int", "(", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120MAX", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fact", "[i", "]", "\u0120=", "\u0120fact", "[i", "-", "1", "]", "\u0120*", "\u0120Mod", "Int", "(i", ")\u010a\u010a\u010a\u010a", "inv", "\u0120=", "\u0120[", "None", "]", "\u0120*", "\u0120(", "MAX", "\u0120+", "\u0120", "1", ")\u010a\u010a", "inv", "[MAX", "]", "\u0120=", "\u0120fact", "[MAX", "].", "pow", "(mod", "\u0120-", "\u0120", "2", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(MAX", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "[i", "-", "1", "]", "\u0120=", "\u0120inv", "[i", "]", "\u0120*", "\u0120Mod", "Int", "(i", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120Mod", "Int", "(", "0", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120add", "\u0120=", "\u0120Mod", "Int", "(n", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120Mod", "Int", "(m", "\u0120-", "\u0120j", ")", "\u0120*", "\u0120Mod", "Int", "(i", "\u0120+", "\u0120j", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120j", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120add", "\u0120*=", "\u0120Mod", "Int", "(", "2", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120add", "\u010a\u010a\u010a\u010a", "ans", "\u0120*=", "\u0120comb", "(n", "\u0120*", "\u0120m", "\u0120-", "\u0120", "2", ",", "\u0120k", "\u0120-", "\u0120", "2", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.5886835746651548, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.5886835746651548, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.5886835746651548, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03241", "input": "N,M = list(map(int,input().split()))\n\nif N==1:\n\n nmax=M\n\nelse:\n\n nmax = 1\n\n for i in range(2,int(M**0.5)+1):\n\n if M%i==0 and M//i>=N:\n\n nmax = max(nmax,i)\n\n if M%i==0 and i>=N:\n\n nmax = max(nmax,M//i)\n\nprint(nmax)", "input_tokens": ["N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "if", "\u0120N", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "max", "=M", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "max", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",int", "(M", "**", "0", ".", "5", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120M", "%i", "==", "0", "\u0120and", "\u0120M", "//", "i", ">=", "N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "max", "\u0120=", "\u0120max", "(n", "max", ",i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120M", "%i", "==", "0", "\u0120and", "\u0120i", ">=", "N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "max", "\u0120=", "\u0120max", "(n", "max", ",M", "//", "i", ")\u010a\u010a", "print", "(n", "max", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891]} +{"problem_id": "p02596", "input": "import sys\n\n\n\nreadline = sys.stdin.readline\n\nreadall = sys.stdin.read\n\nns = lambda: readline().rstrip()\n\nni = lambda: int(readline().rstrip())\n\nnm = lambda: map(int, readline().split())\n\nnl = lambda: list(map(int, readline().split()))\n\nprn = lambda x: print(*x, sep='\\n')\n\n\n\ndef solve():\n\n d = dict()\n\n k = ni()\n\n c = 7 % k\n\n x = d[c] = 1\n\n while True:\n\n c = (c * 10 + 7) % k\n\n if c in d:\n\n break\n\n x += 1\n\n d[c] = x\n\n print(d.get(0, -1))\n\n return\n\n\n\nsolve()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "read", "all", "\u0120=", "\u0120sys", ".stdin", ".read", "\u010a\u010a", "ns", "\u0120=", "\u0120lambda", ":", "\u0120readline", "().", "rstrip", "()\u010a\u010a", "ni", "\u0120=", "\u0120lambda", ":", "\u0120int", "(read", "line", "().", "rstrip", "())\u010a\u010a", "nm", "\u0120=", "\u0120lambda", ":", "\u0120map", "(int", ",", "\u0120readline", "().", "split", "())\u010a\u010a", "nl", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(int", ",", "\u0120readline", "().", "split", "()))\u010a\u010a", "pr", "n", "\u0120=", "\u0120lambda", "\u0120x", ":", "\u0120print", "(*", "x", ",", "\u0120sep", "='\\", "n", "')\u010a\u010a\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120dict", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120ni", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120", "7", "\u0120%", "\u0120k", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120d", "[c", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120(", "c", "\u0120*", "\u0120", "1", "0", "\u0120+", "\u0120", "7", ")", "\u0120%", "\u0120k", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120c", "\u0120in", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[c", "]", "\u0120=", "\u0120x", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(d", ".get", "(", "0", ",", "\u0120-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "solve", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02959", "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nN = int(input())\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\nbefore = sum(A)\n\n\n\nfor i in range(N):\n\n nokori = B[i]\n\n for j in range(i,i+2):\n\n if nokori >= A[j]:\n\n nokori -= A[j]\n\n A[j] = 0\n\n else:\n\n A[j] -= nokori\n\n nokori = 0\n\nafter = sum(A)\n\n\n\nprint((before - after))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "7", ")\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "B", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "before", "\u0120=", "\u0120sum", "(A", ")\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120nok", "ori", "\u0120=", "\u0120B", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", ",i", "+", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120nok", "ori", "\u0120>=", "\u0120A", "[j", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nok", "ori", "\u0120-=", "\u0120A", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "[j", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "[j", "]", "\u0120-=", "\u0120nok", "ori", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nok", "ori", "\u0120=", "\u0120", "0", "\u010a\u010a", "after", "\u0120=", "\u0120sum", "(A", ")\u010a\u010a\u010a\u010a", "print", "((", "before", "\u0120-", "\u0120after", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p03457", "input": "N = int(input())\n\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\n\nfor i in range(N):\n\n t1, x1, y1 = txy[i]\n\n t2, x2, y2 = txy[i+1]\n\n if abs(x2-x1) + abs(y2-y1) <= t2 - t1 and (x1+y1+x2+y2) % 2 == (t2-t1) % 2:\n\n continue\n\n else:\n\n print('No')\n\n exit()\n\nprint('Yes')", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "tx", "y", "\u0120=", "\u0120[(", "0", ",", "\u0120", "0", ",", "\u0120", "0", ")]", "\u0120+", "\u0120[", "tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "1", ",", "\u0120x", "1", ",", "\u0120y", "1", "\u0120=", "\u0120t", "xy", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "2", ",", "\u0120x", "2", ",", "\u0120y", "2", "\u0120=", "\u0120t", "xy", "[i", "+", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120abs", "(x", "2", "-x", "1", ")", "\u0120+", "\u0120abs", "(y", "2", "-y", "1", ")", "\u0120<=", "\u0120t", "2", "\u0120-", "\u0120t", "1", "\u0120and", "\u0120(", "x", "1", "+y", "1", "+x", "2", "+y", "2", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120(", "t", "2", "-t", "1", ")", "\u0120%", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "print", "('", "Yes", "')"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02834", "input": "n,u,v=list(map(int,input().split()))\n\nanss=0\n\nu-=1\n\nv-=1\n\nd=[[]for _ in range(n)]\n\ninf=float('inf')\n\naoki=[inf]*n\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n d[a].append(b)\n\n d[b].append(a)\n\nQ=d[v]\n\naoki[v]=0\n\ndis=1\n\nvisited={v}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n aoki[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[u]\n\nchokudai=[-1]*n\n\nchokudai[u]=0\n\ndis=1\n\nvisited={u}\n\npoint=-1\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if aoki[j]<=dis+1:\n\n if aoki[j]==dis+1:anss=1\n\n if point<0:point=i\n\n continue\n\n if j not in visited:P.append(j)\n\n chokudai[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[point]\n\ndis=chokudai[point]+1\n\nvisited={point}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n if chokudai[i]==-1:continue\n\n chokudai[i]=max(dis,chokudai[i])\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n dis+=1\n\n Q=P\n\nans=0\n\nfor i in range(n):\n\n if aoki[i]>chokudai[i]:ans=max(ans,chokudai[i])\n\nprint((ans+anss))\n\n#print(aoki)\n\n#print(chokudai)", "input_tokens": ["n", ",u", ",v", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "s", "=", "0", "\u010a\u010a", "u", "-=", "1", "\u010a\u010a", "v", "-=", "1", "\u010a\u010a", "d", "=[", "[]", "for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "inf", "=float", "('", "inf", "')\u010a\u010a", "a", "oki", "=[", "inf", "]*", "n", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120", "\u0120a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120a", "-=", "1", "\u010a\u010a", "\u0120", "\u0120b", "-=", "1", "\u010a\u010a", "\u0120", "\u0120d", "[a", "].", "append", "(b", ")\u010a\u010a", "\u0120", "\u0120d", "[b", "].", "append", "(a", ")\u010a\u010a", "Q", "=d", "[v", "]\u010a\u010a", "a", "oki", "[v", "]=", "0", "\u010a\u010a", "dis", "=", "1", "\u010a\u010a", "visited", "={", "v", "}\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120", "\u0120P", "=[]", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120visited", ".add", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120d", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120not", "\u0120in", "\u0120visited", ":P", ".append", "(j", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "oki", "[i", "]=", "dis", "\u010a\u010a", "\u0120", "\u0120dis", "+=", "1", "\u010a\u010a", "\u0120", "\u0120Q", "=P", "\u010a\u010a", "Q", "=d", "[u", "]\u010a\u010a", "ch", "ok", "ud", "ai", "=[", "-", "1", "]*", "n", "\u010a\u010a", "ch", "ok", "ud", "ai", "[u", "]=", "0", "\u010a\u010a", "dis", "=", "1", "\u010a\u010a", "visited", "={", "u", "}\u010a\u010a", "point", "=-", "1", "\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120", "\u0120P", "=[]", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120visited", ".add", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120d", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "oki", "[j", "]<=", "dis", "+", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "oki", "[j", "]==", "dis", "+", "1", ":", "ans", "s", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120point", "<", "0", ":", "point", "=i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120not", "\u0120in", "\u0120visited", ":P", ".append", "(j", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ch", "ok", "ud", "ai", "[i", "]=", "dis", "\u010a\u010a", "\u0120", "\u0120dis", "+=", "1", "\u010a\u010a", "\u0120", "\u0120Q", "=P", "\u010a\u010a", "Q", "=d", "[", "point", "]\u010a\u010a", "dis", "=", "ch", "ok", "ud", "ai", "[", "point", "]+", "1", "\u010a\u010a", "visited", "={", "point", "}\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120", "\u0120P", "=[]", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120visited", ".add", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ch", "ok", "ud", "ai", "[i", "]==", "-", "1", ":", "continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ch", "ok", "ud", "ai", "[i", "]=", "max", "(dis", ",ch", "ok", "ud", "ai", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120d", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120not", "\u0120in", "\u0120visited", ":P", ".append", "(j", ")\u010a\u010a", "\u0120", "\u0120dis", "+=", "1", "\u010a\u010a", "\u0120", "\u0120Q", "=P", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120a", "oki", "[i", "]>", "ch", "ok", "ud", "ai", "[i", "]:", "ans", "=max", "(ans", ",ch", "ok", "ud", "ai", "[i", "])\u010a\u010a", "print", "((", "ans", "+", "ans", "s", "))\u010a\u010a", "#print", "(a", "oki", ")\u010a\u010a", "#print", "(ch", "ok", "ud", "ai", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5749858371565393, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5749858371565393, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5749858371565393, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5749858371565393, 0.9781224550800401, 0.9781224550800401, 0.9781224550800401, 0.9781224550800401, 0.9781224550800401, 0.9781224550800401, 0.9781224550800401, 0.9781224550800401, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.5749858371565393, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.5749858371565393, 0.6075505590312809, 0.5749858371565393, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.5749858371565393, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.5749858371565393, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.5749858371565393, 0.5749858371565393, 0.5749858371565393, 0.5749858371565393, 0.5749858371565393, 0.5749858371565393, 0.5749858371565393, 0.5749858371565393]} +{"problem_id": "p02537", "input": "d=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()+d))\n\nfor i in range(n):d[i]=max(d[j]for j in range(i-99,i+1)if abs(a[i]-a[j])<=k)+1\n\nprint((max(d)))", "input_tokens": ["d", "=[", "0", "]*", "6", "**", "8", "\u010a\u010a", "n", ",k", ",*", "a", "=list", "(map", "(int", ",", "open", "(", "0", ").", "read", "().", "split", "()+", "d", "))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "d", "[i", "]=", "max", "(d", "[j", "]", "for", "\u0120j", "\u0120in", "\u0120range", "(i", "-", "9", "9", ",i", "+", "1", ")", "if", "\u0120abs", "(a", "[i", "]-", "a", "[j", "])", "<=", "k", ")+", "1", "\u010a\u010a", "print", "((", "max", "(d", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02873", "input": "S = input()\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in range(len(lst)):\n\n if lst[i] > 0:\n\n ans += list(range(1,lst[i]+1))\n\n else:\n\n ans[-1] = max(ans[-1], -lst[i])\n\n ans += list(range(-lst[i]-1,-1, -1))\n\n\n\nprint((sum(ans)))\n", "input_tokens": ["S", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "lst", "\u0120=", "\u0120[", "1", "\u0120if", "\u0120S", "[", "0", "]=='", "<'", "\u0120else", "\u0120-", "1", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120len", "(S", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", "]", "\u0120==", "\u0120S", "[i", "\u0120-", "\u0120", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120lst", "[-", "1", "]", "\u0120+=", "\u0120", "1", "\u0120if", "\u0120S", "[i", "]=='", "<'", "\u0120else", "\u0120-", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120lst", ".append", "(-", "1", "\u0120if", "\u0120S", "[i", "]=='", ">'", "\u0120else", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "ans", "\u0120=", "\u0120[", "0", "]\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(lst", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120lst", "[i", "]", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120list", "(range", "(", "1", ",l", "st", "[i", "]+", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "[-", "1", "]", "\u0120=", "\u0120max", "(ans", "[-", "1", "],", "\u0120-", "lst", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120list", "(range", "(-", "lst", "[i", "]-", "1", ",-", "1", ",", "\u0120-", "1", "))", "\u010a\u010a\u010a\u010a", "print", "((", "sum", "(ans", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p03253", "input": "from math import floor, sqrt\n\nfrom collections import defaultdict\n\ndef factors(n):\n\n d = defaultdict(int)\n\n for i in range(2,floor(sqrt(n))+1):\n\n while n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n if n == 1:\n\n break\n\n if n != 1:\n\n d[n] += 1\n\n return d\n\ndef inv(x, mod):\n\n k = mod - 2\n\n ret = 1\n\n while k > 0:\n\n if k&1:\n\n ret = (ret*x) % mod\n\n x = (x*x) % mod\n\n k >>= 1\n\n return ret\n\nN, M = list(map(int,input().split()))\n\nmod = 10**9+7\n\ndic = factors(M)\n\nK = len(dic)\n\nSIZE = N+max(dic.values()) if list(dic.values()) else N\n\nfact = [None]*(SIZE+1)\n\nfinv = [None]*(SIZE+1)\n\nfact[0] = 1\n\nfor i in range(1,SIZE+1):\n\n fact[i] = (fact[i-1]*i) % mod\n\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\n\nfor i in range(SIZE, 0, -1):\n\n finv[i-1] = (finv[i]*i) % mod\n\ndef comb(n,k):\n\n tmp = (finv[k]*finv[n-k]) % mod\n\n return (fact[n]*tmp) % mod\n\nans = 1\n\nfor p in dic:\n\n ans = (ans*comb(dic[p]+N-1, dic[p])) % mod\n\nprint(ans)", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120floor", ",", "\u0120sqrt", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "def", "\u0120factors", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",f", "loor", "(sqrt", "(n", "))+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120n", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120//=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[i", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[n", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120d", "\u010a\u010a", "def", "\u0120inv", "(x", ",", "\u0120mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120mod", "\u0120-", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120k", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", "&", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120(", "ret", "*x", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "*x", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "\u0120>>=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "dic", "\u0120=", "\u0120factors", "(M", ")\u010a\u010a", "K", "\u0120=", "\u0120len", "(dic", ")\u010a\u010a", "SIZE", "\u0120=", "\u0120N", "+", "max", "(dic", ".values", "())", "\u0120if", "\u0120list", "(dic", ".values", "())", "\u0120else", "\u0120N", "\u010a\u010a", "fact", "\u0120=", "\u0120[", "None", "]*(", "SIZE", "+", "1", ")\u010a\u010a", "fin", "v", "\u0120=", "\u0120[", "None", "]*(", "SIZE", "+", "1", ")\u010a\u010a", "fact", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "SIZE", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fact", "[i", "]", "\u0120=", "\u0120(", "fact", "[i", "-", "1", "]*", "i", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "fin", "v", "[", "SIZE", "]", "\u0120=", "\u0120inv", "(f", "act", "[", "SIZE", "],", "\u0120mod", "=", "mod", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(S", "IZE", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fin", "v", "[i", "-", "1", "]", "\u0120=", "\u0120(", "fin", "v", "[i", "]*", "i", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "def", "\u0120comb", "(n", ",k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120(", "fin", "v", "[k", "]*", "fin", "v", "[n", "-k", "])", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "fact", "[n", "]*", "tmp", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120dic", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120(", "ans", "*", "comb", "(dic", "[p", "]+", "N", "-", "1", ",", "\u0120dic", "[p", "]))", "\u0120%", "\u0120mod", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03416", "input": "a , b = input().split()\n\na = int(a)\n\nb = int(b)\n\ncount=0\n\nfor i in range(a,b+1):\n\n test = list(str(i))\n\n if (test[0] == test[4]) and (test[1]==test[3]):\n\n count=count+1\n\nprint(count)", "input_tokens": ["a", "\u0120,", "\u0120b", "\u0120=", "\u0120input", "().", "split", "()\u010a\u010a", "a", "\u0120=", "\u0120int", "(a", ")\u010a\u010a", "b", "\u0120=", "\u0120int", "(b", ")\u010a\u010a", "count", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120test", "\u0120=", "\u0120list", "(str", "(i", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "test", "[", "0", "]", "\u0120==", "\u0120test", "[", "4", "])", "\u0120and", "\u0120(", "test", "[", "1", "]==", "test", "[", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "=count", "+", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03835", "input": "K,S=list(map(int,input().split()))\n\nO=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n O+=1\n\nprint(O)\n", "input_tokens": ["K", ",S", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "O", "=", "0", "\u010a\u010a", "for", "\u0120X", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120Y", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120Z", "=S", "-X", "-Y", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "<=", "Z", "<=", "K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120O", "+=", "1", "\u010a\u010a", "print", "(O", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p04020", "input": "import sys\n\nstdin = sys.stdin\n\n \n\nsys.setrecursionlimit(10**8) \n\n \n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x)-1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\n\n\nn = ni()\n\na = [ni() for _ in range(n)]\n\n\n\ncnt = {i+1: ai for i, ai in enumerate(a)}\n\n\n\nprev = -100\n\ncur = 0\n\nans = 0\n\nfor key in sorted(cnt.keys()):\n\n if cnt[key] == 0:\n\n continue\n\n \n\n if prev == -100:\n\n prev = key\n\n \n\n if (key-prev) < 2:\n\n cur += cnt[key]\n\n else:\n\n cur = cnt[key]\n\n \n\n ans += cur // 2\n\n cur -= 2 * (cur//2)\n\n \n\n prev = key\n\n \n\nprint(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "stdin", "\u0120=", "\u0120sys", ".stdin", "\u010a\u010a", "\u0120\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "8", ")", "\u0120\u010a\u010a", "\u0120\u010a\u010a", "def", "\u0120li", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120li", "_", "():", "\u0120return", "\u0120[", "int", "(x", ")-", "1", "\u0120for", "\u0120x", "\u0120in", "\u0120stdin", ".readline", "().", "split", "()]\u010a\u010a", "def", "\u0120lf", "():", "\u0120return", "\u0120list", "(map", "(float", ",", "\u0120stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120ls", "():", "\u0120return", "\u0120stdin", ".readline", "().", "split", "()\u010a\u010a", "def", "\u0120ns", "():", "\u0120return", "\u0120stdin", ".readline", "().", "rstrip", "()\u010a\u010a", "def", "\u0120lc", "():", "\u0120return", "\u0120list", "(ns", "())\u010a\u010a", "def", "\u0120ni", "():", "\u0120return", "\u0120int", "(stdin", ".readline", "())\u010a\u010a", "def", "\u0120nf", "():", "\u0120return", "\u0120float", "(stdin", ".readline", "())\u010a\u010a", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120ni", "()\u010a\u010a", "a", "\u0120=", "\u0120[", "ni", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120{", "i", "+", "1", ":", "\u0120ai", "\u0120for", "\u0120i", ",", "\u0120ai", "\u0120in", "\u0120enumerate", "(a", ")", "}\u010a\u010a\u010a\u010a", "prev", "\u0120=", "\u0120-", "1", "0", "0", "\u010a\u010a", "cur", "\u0120=", "\u0120", "0", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120key", "\u0120in", "\u0120sorted", "(cnt", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "[key", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120prev", "\u0120==", "\u0120-", "1", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120key", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "key", "-prev", ")", "\u0120<", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120+=", "\u0120cnt", "[key", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120=", "\u0120cnt", "[key", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cur", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cur", "\u0120-=", "\u0120", "2", "\u0120*", "\u0120(", "cur", "//", "2", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120key", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897]} +{"problem_id": "p03164", "input": "def main():\n\n N, W = list(map(int, input().split()))\n\n w = [0] * N\n\n v = [0] * N\n\n for i in range(N):\n\n w[i], v[i] = list(map(int, input().split()))\n\n\n\n max_v = max(v)\n\n dp = [[float('inf')] * (max_v * N + 5) for _ in range(N + 5)]\n\n\n\n dp[0][0] = 0\n\n\n\n for i in range(N):\n\n for j in range(max_v * N):\n\n if j + v[i] <= max_v * N:\n\n dp[i+1][j + v[i]] = min(dp[i+1][j + v[i]], dp[i][j] + w[i])\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j]) \n\n\n\n ans = 0\n\n for j in range(max_v * N + 1):\n\n if dp[N][j] <= W:\n\n ans = j\n\n\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120W", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120N", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120N", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120w", "[i", "],", "\u0120v", "[i", "]", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "_v", "\u0120=", "\u0120max", "(v", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[[", "float", "('", "inf", "')]", "\u0120*", "\u0120(", "max", "_v", "\u0120*", "\u0120N", "\u0120+", "\u0120", "5", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "\u0120+", "\u0120", "5", ")]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(max", "_v", "\u0120*", "\u0120N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120+", "\u0120v", "[i", "]", "\u0120<=", "\u0120max", "_v", "\u0120*", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "\u0120+", "\u0120v", "[i", "]]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "j", "\u0120+", "\u0120v", "[i", "]],", "\u0120dp", "[i", "][", "j", "]", "\u0120+", "\u0120w", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "j", "],", "\u0120dp", "[i", "][", "j", "])", "\u0120\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(max", "_v", "\u0120*", "\u0120N", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[N", "][", "j", "]", "\u0120<=", "\u0120W", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120j", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03309", "input": "n = int(input())\n\na = list(map(int,input().split()))\n\naa = []\n\nfor i in range(n):\n\n aa.append(a[i]-(i+1))\n\nb = (sorted(aa)[n//2])\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans += abs(a[i]-(b+i+1))\n\nprint(ans)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "aa", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120aa", ".append", "(a", "[i", "]", "-(", "i", "+", "1", "))\u010a\u010a", "b", "\u0120=", "\u0120(", "sorted", "(aa", ")[", "n", "//", "2", "])\u010a\u010a", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120abs", "(a", "[i", "]", "-(", "b", "+i", "+", "1", "))\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02794", "input": "N = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(input())\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\nD = {1<>= 17\n\n bc += BC[aa % (1<<17)]\n\n aa >>= 17\n\n bc += BC[aa]\n\n CC[N - 1 - bc] += (1 if BC[m%1024] + BC[m>>10] & 1 == 0 else -1)\n\n\n\nprint((sum([2 ** i * CC[i] for i in range(N)])))", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "X", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "[x", "-", "1", "].", "append", "(y", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "[y", "-", "1", "].", "append", "(x", "-", "1", ")\u010a\u010a\u010a\u010a", "P", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120N", "\u010a\u010a", "DE", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120N", "\u010a\u010a", "Q", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120Q", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120X", "[i", "][", "::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120!=", "\u0120P", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120P", "[a", "]", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120DE", "[a", "]", "\u0120=", "\u0120DE", "[i", "]", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120X", "[a", "].", "remove", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Q", ".append", "(a", ")\u010a\u010a\u010a\u010a", "def", "\u0120lp", "(u", ",", "\u0120v", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120u", "\u0120!=", "\u0120v", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120DE", "[u", "]", "\u0120>", "\u0120DE", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120", "1", "\u0120<<", "\u0120u", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120u", "\u0120=", "\u0120P", "[u", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120DE", "[u", "]", "\u0120<", "\u0120DE", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120", "1", "\u0120<<", "\u0120v", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120P", "[v", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120", "1", "\u0120<<", "\u0120u", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120", "1", "\u0120<<", "\u0120v", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120u", "\u0120=", "\u0120P", "[u", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120P", "[v", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120t", "\u010a\u010a\u010a\u010a", "Y", "\u0120=", "\u0120[]\u010a\u010a", "M", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120a", "-", "1", ",", "\u0120b", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120Y", ".append", "(lp", "(a", ",", "\u0120b", "))", "\u010a\u010a\u010a\u010a", "D", "\u0120=", "\u0120{", "1", "<<", "i", ":", "\u0120i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "5", "0", ")}\u010a\u010a", "Z", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "1", "<<", "M", ")\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "CC", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120N", "\u010a\u010a", "BC", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "1", "<<", "1", "7", ")\u010a\u010a", "for", "\u0120m", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "<<", "1", "7", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120m", "\u0120&", "\u0120(-", "m", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120BC", "[m", "]", "\u0120=", "\u0120BC", "[m", "^", "a", "]", "\u0120+", "\u0120", "1", "\u010a\u010a", "for", "\u0120m", "\u0120in", "\u0120range", "(", "1", "<<", "M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120m", "\u0120&", "\u0120(-", "m", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120==", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Z", "[m", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Z", "[m", "]", "\u0120=", "\u0120Y", "[D", "[a", "]]\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Z", "[m", "]", "\u0120=", "\u0120Z", "[m", "^", "a", "]", "\u0120|", "\u0120Y", "[D", "[a", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120aa", "\u0120=", "\u0120Z", "[m", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120bc", "\u0120=", "\u0120BC", "[", "aa", "\u0120%", "\u0120(", "1", "<<", "1", "7", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120aa", "\u0120>>=", "\u0120", "1", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120bc", "\u0120+=", "\u0120BC", "[", "aa", "\u0120%", "\u0120(", "1", "<<", "1", "7", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120aa", "\u0120>>=", "\u0120", "1", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120bc", "\u0120+=", "\u0120BC", "[", "aa", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120CC", "[N", "\u0120-", "\u0120", "1", "\u0120-", "\u0120bc", "]", "\u0120+=", "\u0120(", "1", "\u0120if", "\u0120BC", "[m", "%", "1", "0", "2", "4", "]", "\u0120+", "\u0120BC", "[m", ">>", "1", "0", "]", "\u0120&", "\u0120", "1", "\u0120==", "\u0120", "0", "\u0120else", "\u0120-", "1", ")\u010a\u010a\u010a\u010a", "print", "((", "sum", "([", "2", "\u0120**", "\u0120i", "\u0120*", "\u0120CC", "[i", "]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.579389560544, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229]} +{"problem_id": "p03078", "input": "\n\nfrom heapq import heappop, heappush\n\n\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\npq = []\n\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\n\nappeared = set((0, 0, 0))\n\n\n\nfor _ in range(K):\n\n # Pop maximum value\n\n val, i, j, k = heappop(pq)\n\n print((-val))\n\n\n\n # Add next value\n\n if i + 1 < X and (i + 1, j, k) not in appeared:\n\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n\n appeared.add((i + 1, j, k))\n\n\n\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n\n appeared.add((i, j + 1, k))\n\n\n\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n\n appeared.add((i, j, k + 1))\n", "input_tokens": ["\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "op", ",", "\u0120he", "app", "ush", "\u010a\u010a\u010a\u010a", "X", ",", "\u0120Y", ",", "\u0120Z", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "C", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "A", ".sort", "(reverse", "=True", ")\u010a\u010a", "B", ".sort", "(reverse", "=True", ")\u010a\u010a", "C", ".sort", "(reverse", "=True", ")\u010a\u010a\u010a\u010a", "pq", "\u0120=", "\u0120[]\u010a\u010a", "he", "app", "ush", "(p", "q", ",", "\u0120(-", "A", "[", "0", "]", "\u0120-", "\u0120B", "[", "0", "]", "\u0120-", "\u0120C", "[", "0", "],", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "))\u010a\u010a", "appeared", "\u0120=", "\u0120set", "((", "0", ",", "\u0120", "0", ",", "\u0120", "0", "))", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120Pop", "\u0120maximum", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120val", ",", "\u0120i", ",", "\u0120j", ",", "\u0120k", "\u0120=", "\u0120he", "app", "op", "(p", "q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "val", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120Add", "\u0120next", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120+", "\u0120", "1", "\u0120<", "\u0120X", "\u0120and", "\u0120(", "i", "\u0120+", "\u0120", "1", ",", "\u0120j", ",", "\u0120k", ")", "\u0120not", "\u0120in", "\u0120appeared", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120he", "app", "ush", "(p", "q", ",", "\u0120(-", "A", "[i", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120B", "[j", "]", "\u0120-", "\u0120C", "[k", "],", "\u0120i", "\u0120+", "\u0120", "1", ",", "\u0120j", ",", "\u0120k", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120appeared", ".add", "((", "i", "\u0120+", "\u0120", "1", ",", "\u0120j", ",", "\u0120k", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Y", "\u0120and", "\u0120(", "i", ",", "\u0120j", "\u0120+", "\u0120", "1", ",", "\u0120k", ")", "\u0120not", "\u0120in", "\u0120appeared", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120he", "app", "ush", "(p", "q", ",", "\u0120(-", "A", "[i", "]", "\u0120-", "\u0120B", "[j", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120C", "[k", "],", "\u0120i", ",", "\u0120j", "\u0120+", "\u0120", "1", ",", "\u0120k", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120appeared", ".add", "((", "i", ",", "\u0120j", "\u0120+", "\u0120", "1", ",", "\u0120k", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120k", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Z", "\u0120and", "\u0120(", "i", ",", "\u0120j", ",", "\u0120k", "\u0120+", "\u0120", "1", ")", "\u0120not", "\u0120in", "\u0120appeared", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120he", "app", "ush", "(p", "q", ",", "\u0120(-", "A", "[i", "]", "\u0120-", "\u0120B", "[j", "]", "\u0120-", "\u0120C", "[k", "\u0120+", "\u0120", "1", "],", "\u0120i", ",", "\u0120j", ",", "\u0120k", "\u0120+", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120appeared", ".add", "((", "i", ",", "\u0120j", ",", "\u0120k", "\u0120+", "\u0120", "1", "))\u010a"], "input_token_weights": [0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p02773", "input": "import collections\n\nn = int(input())\n\na=[input() for _ in range(n)]\n\nanslist=[]\n\nb=collections.Counter(a)\n\nc=max(list(b.values()))\n\nfor i in b:\n\n if b[i]==c:\n\n anslist.append(i)\n\nd=sorted(anslist)\n\nfor i in tuple(d):\n\n print(i)", "input_tokens": ["import", "\u0120collections", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "=[", "input", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "ans", "list", "=[]", "\u010a\u010a", "b", "=c", "ollections", ".Counter", "(a", ")\u010a\u010a", "c", "=max", "(list", "(b", ".values", "()))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120b", "[i", "]==", "c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "list", ".append", "(i", ")\u010a\u010a", "d", "=", "sorted", "(ans", "list", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120tuple", "(d", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(i", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03371", "input": "a,b,c,x,y = list(map(int,input().split()))\n\nxy = max(x,y)*2+1\n\nprint((min([c*i + max(0,a*(x-i//2)) +max(0,b*(y-i//2)) for i in range(0,xy,2)])))", "input_tokens": ["a", ",b", ",c", ",x", ",y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "xy", "\u0120=", "\u0120max", "(x", ",y", ")*", "2", "+", "1", "\u010a\u010a", "print", "((", "min", "([", "c", "*i", "\u0120+", "\u0120max", "(", "0", ",a", "*(", "x", "-i", "//", "2", "))", "\u0120+", "max", "(", "0", ",b", "*(", "y", "-i", "//", "2", "))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "xy", ",", "2", ")]", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02412", "input": "while True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == sum([s, m, e]):\n\n count += 1\n\n\n\n print(count)", "input_tokens": ["while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120x", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120x", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120s", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120-", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120m", "\u0120in", "\u0120range", "(s", "\u0120+", "\u0120", "1", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120e", "\u0120in", "\u0120range", "(m", "\u0120+", "\u0120", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120sum", "([", "s", ",", "\u0120m", ",", "\u0120e", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(count", ")"], "input_token_weights": [0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891]} +{"problem_id": "p02837", "input": "n = int(input())\n\nv = [[tuple(map(int, input().split()))for i in range(int(input()))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [False] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = True\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n if f[x - 1] is not bool(y):\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "v", "\u0120=", "\u0120[[", "tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "for", "\u0120i", "\u0120in", "\u0120range", "(int", "(input", "()))", "]\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "**", "n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120[", "False", "]", "\u0120*", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120xy", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "\u0120>>", "\u0120j", ")", "\u0120&", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "[j", "]", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120xy", ".append", "(v", "[j", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120flag", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120xy", "i", "\u0120in", "\u0120xy", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", ",", "\u0120y", "\u0120in", "\u0120xy", "i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120f", "[x", "\u0120-", "\u0120", "1", "]", "\u0120is", "\u0120not", "\u0120bool", "(y", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120flag", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120flag", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120len", "(xy", "))\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368]} +{"problem_id": "p03000", "input": "N,X = list(map(int,input().split()))\n\nL = [0] + [int(x) for x in input().split()]\n\n\n\nD = [0] * (N+2)\n\nanswer = 1\n\nfor n in range(2,N+2):\n\n D[n] = D[n-1] + L[n-1]\n\n if D[n] <= X:\n\n answer += 1\n\n \n\nprint(answer)", "input_tokens": ["N", ",X", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120[", "0", "]", "\u0120+", "\u0120[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "D", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "+", "2", ")\u010a\u010a", "answer", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120n", "\u0120in", "\u0120range", "(", "2", ",N", "+", "2", "):\u010a\u010a", "\u0120", "\u0120D", "[n", "]", "\u0120=", "\u0120D", "[n", "-", "1", "]", "\u0120+", "\u0120L", "[n", "-", "1", "]\u010a\u010a", "\u0120", "\u0120if", "\u0120D", "[n", "]", "\u0120<=", "\u0120X", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120answer", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(answer", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02983", "input": "mod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r//mod - l//mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l+1, r+1):\n\n for j in range(l, i):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)", "input_tokens": ["mod", "\u0120=", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "l", ",", "\u0120r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "if", "\u0120r", "//", "mod", "\u0120-", "\u0120l", "//", "mod", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120l", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120r", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120ans", "\u0120=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(l", "+", "1", ",", "\u0120r", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(l", ",", "\u0120i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(i", "*j", "%", "mod", ",", "\u0120ans", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ans", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p03425", "input": "#!/usr/bin/env python3\n\n\n\nn = int(input())\n\ns = [input() for _ in range(n)]\n\n\n\nc = [0 for _ in range(5)]\n\nt = 'MARCH'\n\n\n\nfor i in range(n):\n\n for j in range(5):\n\n if s[i][0] == t[j]:\n\n c[j] += 1\n\nans = 0 \n\nfor i in range(5):\n\n for j in range(i+1, 5): \n\n for k in range(j+1, 5): \n\n ans += c[i]*c[k]*c[j]\n\nprint(ans)\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "s", "\u0120=", "\u0120[", "input", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "c", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "5", ")]\u010a\u010a", "t", "\u0120=", "\u0120'", "M", "ARCH", "'\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "5", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "][", "0", "]", "\u0120==", "\u0120t", "[j", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "[j", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u0120\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "5", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",", "\u0120", "5", "):", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(j", "+", "1", ",", "\u0120", "5", "):", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120c", "[i", "]*", "c", "[k", "]*", "c", "[j", "]\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p00053", "input": "prim=[True]*1000000\n\nprim[0],prim[1]=False,False\n\nfor i in range(2,1000):\n\n if prim[i]:\n\n for j in range(i*2,1000000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(input())\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))", "input_tokens": ["prim", "=[", "True", "]*", "1", "0", "0", "0", "0", "0", "0", "\u010a\u010a", "prim", "[", "0", "],", "prim", "[", "1", "]=", "False", ",False", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",", "1", "0", "0", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120prim", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "*", "2", ",", "1", "0", "0", "0", "0", "0", "0", ",i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prim", "[j", "]=", "False", "\u010a\u010a", "prime", "=[", "i", "\u0120for", "\u0120i", ",j", "\u0120in", "\u0120enumerate", "(", "prim", ")", "\u0120if", "\u0120j", "==", "True", "]\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "sum", "(pr", "ime", "[:", "n", "])))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03037", "input": "n, m = list(map(int, input().split()))\n\ngate = []\n\nl, r = list(map(int, input().split()))\n\nfor i in range(1, m):\n\n m, s = list(map(int, input().split()))\n\n if l < m:\n\n l = m\n\n if s < r:\n\n r = s\n\nprint((len([i for i in range(l, r + 1)])))", "input_tokens": ["n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "gate", "\u0120=", "\u0120[]\u010a\u010a", "l", ",", "\u0120r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", ",", "\u0120s", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120<", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120<", "\u0120r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120s", "\u010a\u010a", "print", "((", "len", "([", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(l", ",", "\u0120r", "\u0120+", "\u0120", "1", ")]", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293]} +{"problem_id": "p02596", "input": "K=int(input())\n\n\n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n \n\nans=[0]*(pow(10,6)+1)\n\nans[0]=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n ans[i]=(ans[i-1]*10+7)%K\n\n if ans[i]==0:\n\n print(i)\n\n exit(0)\n\n\n\nprint((-1))", "input_tokens": ["K", "=int", "(input", "())\u010a\u010a", "\u010a\u010a", "if", "\u0120K", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "ans", "=[", "0", "]*(", "pow", "(", "1", "0", ",", "6", ")+", "1", ")\u010a\u010a", "ans", "[", "0", "]=", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",p", "ow", "(", "1", "0", ",", "6", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "[i", "]=(", "ans", "[i", "-", "1", "]*", "1", "0", "+", "7", ")%", "K", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ans", "[i", "]==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a\u010a\u010a", "print", "((-", "1", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169]} +{"problem_id": "p03037", "input": "N,M = list(map(int, input().split()))\n\nL = []\n\nR = []\n\nfor _ in range(M):\n\n l,r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n\n\nans = min(R)-max(L)+1\n\nif ans < 0:\n\n print((0))\n\nelse:\n\n print(ans)\n\n ", "input_tokens": ["N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120[]\u010a\u010a", "R", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120", "\u0120l", ",r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120L", ".append", "(l", ")\u010a\u010a", "\u0120", "\u0120R", ".append", "(r", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120min", "(R", ")-", "max", "(L", ")+", "1", "\u010a\u010a", "if", "\u0120ans", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428]} +{"problem_id": "p03325", "input": "N = int(input())\n\n\n\nseq = list(map(int, input().split()))\n\n\n\ncnt = 0\n\n\n\nfor num in seq:\n\n while num % 2 == 0:\n\n cnt += 1\n\n num /= 2\n\n\n\nprint(cnt)\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "seq", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120num", "\u0120in", "\u0120seq", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120num", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120/=", "\u0120", "2", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03371", "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(input())\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = INF\n\n for k in range(100001):\n\n yen = 2 * c * k + max(0, x-k) * a + max(0, y-k) * b\n\n ans = min(ans, yen)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "6", ")\u010a\u010a", "#", "\u0120input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u0120\u0120\u0120", "\u0120####", "\u010a\u010a", "int", "1", "\u0120=", "\u0120lambda", "\u0120x", ":", "\u0120int", "(x", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "def", "\u0120II", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "def", "\u0120MI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120MI", "1", "():", "\u0120return", "\u0120list", "(map", "(int", "1", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120LI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120LI", "1", "():", "\u0120return", "\u0120list", "(map", "(int", "1", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120L", "LI", "(rows", "_number", "):", "\u0120return", "\u0120[", "LI", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(rows", "_number", ")]", "\u010a\u010a\u010a\u010a", "def", "\u0120print", "list", "(lst", ",", "\u0120k", "='\\", "n", "'):", "\u0120print", "((", "k", ".join", "(list", "(map", "(str", ",", "\u0120lst", "))", ")))\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120MI", "()\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120INF", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "1", "0", "0", "0", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120yen", "\u0120=", "\u0120", "2", "\u0120*", "\u0120c", "\u0120*", "\u0120k", "\u0120+", "\u0120max", "(", "0", ",", "\u0120x", "-k", ")", "\u0120*", "\u0120a", "\u0120+", "\u0120max", "(", "0", ",", "\u0120y", "-k", ")", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120yen", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120solve", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03845", "input": "n,t=int(input()),list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n", "input_tokens": ["n", ",t", "=int", "(input", "()),", "list", "(map", "(int", ",input", "().", "split", "()));", "T", "=sum", "(t", ")\u010a\u010a", "print", "(*", "[", "T", "-t", "[i", "-", "1", "]+", "j", "\u0120for", "\u0120i", ",j", "\u0120in", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(int", "(input", "()))", "]],", "sep", "='\\", "n", "')\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03363", "input": "n = int(input())\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum={}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n if str(i) in list(num.keys()):\n\n num[str(i)] += 1\n\n else:\n\n num[str(i)] = 1\n\nout = [i*(i-1)//2 for i in list(num.values()) if i>1]\n\nprint((sum(out)))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "S", "\u0120=", "\u0120[", "0", "]*(", "n", "+", "1", ")\u010a\u010a", "num", "={", "}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "[i", "+", "1", "]", "\u0120=", "\u0120S", "[i", "]", "\u0120+", "\u0120A", "[i", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120S", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120str", "(i", ")", "\u0120in", "\u0120list", "(num", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "[str", "(i", ")]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "[str", "(i", ")]", "\u0120=", "\u0120", "1", "\u010a\u010a", "out", "\u0120=", "\u0120[", "i", "*(", "i", "-", "1", ")//", "2", "\u0120for", "\u0120i", "\u0120in", "\u0120list", "(num", ".values", "())", "\u0120if", "\u0120i", ">", "1", "]\u010a\u010a", "print", "((", "sum", "(out", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02555", "input": "def resolve():\n\n base = 10**9+7\n\n S = int(input())\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(1, S+1):\n\n for u in range(i-2):\n\n dp[i] += dp[u]\n\n dp[i] %= base\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n", "input_tokens": ["def", "\u0120resolve", "():\u010a\u010a", "\u0120", "\u0120base", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120", "\u0120dp", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "S", "+", "1", ")\u010a\u010a", "\u0120", "\u0120dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120S", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120u", "\u0120in", "\u0120range", "(i", "-", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[u", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120%=", "\u0120base", "\u010a\u010a", "\u0120", "\u0120#", "\u0120print", "(dp", ")\u010a\u010a", "\u0120", "\u0120print", "((", "dp", "[S", "]%", "base", "))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120", "\u0120resolve", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02792", "input": "N = int(input())\n\n\n\ntable = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n id1 = int(s[0])\n\n id2 = int(s[-1])\n\n table[id1][id2] += 1\n\n\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += table[i][j]*table[j][i]\n\n\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "table", "\u0120=", "\u0120[[", "0", "]*", "1", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120", "\u0120s", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120", "\u0120id", "1", "\u0120=", "\u0120int", "(s", "[", "0", "])\u010a\u010a", "\u0120", "\u0120id", "2", "\u0120=", "\u0120int", "(s", "[-", "1", "])\u010a\u010a", "\u0120", "\u0120table", "[id", "1", "][", "id", "2", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120table", "[i", "][", "j", "]*", "table", "[j", "][", "i", "]\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p03796", "input": "n = int(input())\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (pow(10,9) + 7)\n\nprint(res)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "res", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120num", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120res", "\u0120=", "\u0120res", "\u0120*", "\u0120num", "\u010a\u010a", "\u0120", "\u0120res", "\u0120=", "\u0120res", "\u0120%", "\u0120(", "pow", "(", "1", "0", ",", "9", ")", "\u0120+", "\u0120", "7", ")\u010a\u010a", "print", "(res", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03371", "input": "#!/usr/bin/env python3\n\nimport sys, math, math, itertools\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n mn = 1e9\n\n for i in range(0, 2*(max(X, Y)+1), 2):\n\n mn = min(mn, C*i+A*max(X-i//2, 0)+B*max(Y-i//2, 0))\n\n print((int(mn)))\n\n return\n\n\n\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "import", "\u0120sys", ",", "\u0120math", ",", "\u0120math", ",", "\u0120itertools", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "(A", ":", "\u0120int", ",", "\u0120B", ":", "\u0120int", ",", "\u0120C", ":", "\u0120int", ",", "\u0120X", ":", "\u0120int", ",", "\u0120Y", ":", "\u0120int", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120mn", "\u0120=", "\u0120", "1", "e", "9", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120", "2", "*(", "max", "(X", ",", "\u0120Y", ")+", "1", "),", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mn", "\u0120=", "\u0120min", "(m", "n", ",", "\u0120C", "*i", "+A", "*", "max", "(X", "-i", "//", "2", ",", "\u0120", "0", ")+", "B", "*", "max", "(Y", "-i", "//", "2", ",", "\u0120", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "int", "(m", "n", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120Generated", "\u0120by", "\u0120", "1", ".", "1", ".", "4", "\u0120https", "://", "github", ".com", "/", "ky", "ur", "iden", "am", "ida", "/at", "coder", "-tools", "\u0120", "\u0120(", "tips", ":", "\u0120You", "\u0120use", "\u0120the", "\u0120default", "\u0120template", "\u0120now", ".", "\u0120You", "\u0120can", "\u0120remove", "\u0120this", "\u0120line", "\u0120by", "\u0120using", "\u0120your", "\u0120custom", "\u0120template", ")\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120iterate", "_tokens", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120line", "\u0120in", "\u0120sys", ".stdin", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120word", "\u0120in", "\u0120line", ".split", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120yield", "\u0120word", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tokens", "\u0120=", "\u0120iterate", "_tokens", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120B", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120Y", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120solve", "(A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03038", "input": "import sys\n\nfrom operator import itemgetter\n\n\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, sys.stdin.readline().split()))\n\nbc = [ tuple(map(int, x.split())) for x in sys.stdin.readlines()]\n\nbc.sort(key = itemgetter(1), reverse=True)\n\nbc.append((n,0))\n\ndiff = []\n\nfor b, c in bc:\n\n diff += [c] * b\n\n if len(diff) > n:\n\n break\n\n\n\na += diff\n\na.sort()\n\nprint((sum(a[-n:])))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "from", "\u0120operator", "\u0120import", "\u0120item", "getter", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "bc", "\u0120=", "\u0120[", "\u0120tuple", "(map", "(int", ",", "\u0120x", ".split", "()))", "\u0120for", "\u0120x", "\u0120in", "\u0120sys", ".stdin", ".readlines", "()]\u010a\u010a", "bc", ".sort", "(key", "\u0120=", "\u0120item", "getter", "(", "1", "),", "\u0120reverse", "=True", ")\u010a\u010a", "bc", ".append", "((", "n", ",", "0", "))\u010a\u010a", "diff", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120bc", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120diff", "\u0120+=", "\u0120[", "c", "]", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(diff", ")", "\u0120>", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "a", "\u0120+=", "\u0120diff", "\u010a\u010a", "a", ".sort", "()\u010a\u010a", "print", "((", "sum", "(a", "[-", "n", ":]", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p02917", "input": "N = int(input())\n\nB =list(map(int,input().split()))\n\nA=[0]*N\n\n\n\nA[0]=B[0]\n\nfor i in range(1,N-1):\n\n A[i]=min(B[i],B[i-1])\n\nA[-1]=B[-1]\n\nprint((sum(A)))", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "B", "\u0120=", "list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "A", "=[", "0", "]*", "N", "\u010a\u010a\u010a\u010a", "A", "[", "0", "]=", "B", "[", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "[i", "]=", "min", "(B", "[i", "],", "B", "[i", "-", "1", "])\u010a\u010a", "A", "[-", "1", "]=", "B", "[-", "1", "]\u010a\u010a", "print", "((", "sum", "(A", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02700", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nA, B, C, D = list(map(int, input().split()))\n\n\n\nwhile True:\n\n C -= B\n\n \n\n if C<=0:\n\n print('Yes')\n\n exit()\n\n \n\n A -= D\n\n \n\n if A<=0:\n\n print('No')\n\n exit()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120*", "\u010a\u010a\u010a\u010a", "A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120D", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "\u0120-=", "\u0120B", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120C", "<=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120-=", "\u0120D", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120A", "<=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p03575", "input": "icase=0\n\nif icase==0:\n\n n,m=list(map(int, input().split()))\n\n a=[]\n\n b=[]\n\n for i in range(m):\n\n ai,bi=list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\nelif icase==1:\n\n n=6\n\n m=5\n\n# a=[[1],[2],[3],[4],[5]]\n\n# b=[[2],[3],[4],[5],[6]]\n\n a=[1,2,3,4,5]\n\n b=[2,3,4,5,6]\n\nelif icase==2:\n\n n=7\n\n m=7\n\n a=[1,2,3,4,4,5,6]\n\n b=[3,7,4,5,6,6,7]\n\n\n\n \n\nvtx=[]\n\nfor i in range(n):\n\n vtx.append([i+1])\n\nicnt=0\n\n\n\nfor j in range(m): \n\n vtx1=vtx.copy()\n\n a1=a.copy()\n\n b1=b.copy()\n\n del a1[j]\n\n del b1[j]\n\n \n\n for i in range(m-1):\n\n for v1 in vtx1:\n\n if a1[i] in v1:\n\n if not b1[i] in v1:\n\n for v2 in vtx1:\n\n if v1!=v2:\n\n if b1[i] in v2:\n\n break\n\n vtx1.remove(v1)\n\n vtx1.remove(v2)\n\n v3=v1+v2\n\n vtx1.append(v3)\n\n# print(a[i],b[i],len(vtx1),vtx1)\n\n# print(len(vtx1),vtx1)\n\n if len(vtx1)!=1:\n\n icnt=icnt+1\n\nprint(icnt) ", "input_tokens": ["ic", "ase", "=", "0", "\u010a\u010a", "if", "\u0120ic", "ase", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",m", "=list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=[]", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=[]", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ai", ",", "bi", "=list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ".append", "(ai", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", ".append", "(b", "i", ")\u010a\u010a", "elif", "\u0120ic", "ase", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=", "6", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "=", "5", "\u010a\u010a", "#", "\u0120\u0120\u0120", "\u0120a", "=[[", "1", "],[", "2", "],[", "3", "],[", "4", "],[", "5", "]]\u010a\u010a", "#", "\u0120\u0120\u0120", "\u0120b", "=[[", "2", "],[", "3", "],[", "4", "],[", "5", "],[", "6", "]]\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=[", "1", ",", "2", ",", "3", ",", "4", ",", "5", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=[", "2", ",", "3", ",", "4", ",", "5", ",", "6", "]\u010a\u010a", "elif", "\u0120ic", "ase", "==", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "=", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=[", "1", ",", "2", ",", "3", ",", "4", ",", "4", ",", "5", ",", "6", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=[", "3", ",", "7", ",", "4", ",", "5", ",", "6", ",", "6", ",", "7", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "v", "tx", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120vtx", ".append", "([", "i", "+", "1", "])\u010a\u010a", "ic", "nt", "=", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(m", "):", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120vtx", "1", "=v", "tx", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "1", "=a", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "1", "=b", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120del", "\u0120a", "1", "[j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120del", "\u0120b", "1", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(m", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", "1", "\u0120in", "\u0120vtx", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "1", "[i", "]", "\u0120in", "\u0120v", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120b", "1", "[i", "]", "\u0120in", "\u0120v", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", "2", "\u0120in", "\u0120vtx", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120v", "1", "!=", "v", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120b", "1", "[i", "]", "\u0120in", "\u0120v", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120vtx", "1", ".remove", "(v", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120vtx", "1", ".remove", "(v", "2", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "3", "=v", "1", "+v", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120vtx", "1", ".append", "(v", "3", ")\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(a", "[i", "],", "b", "[i", "],", "len", "(v", "tx", "1", "),", "v", "tx", "1", ")\u010a\u010a", "#", "\u0120\u0120\u0120", "\u0120print", "(len", "(v", "tx", "1", "),", "v", "tx", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(v", "tx", "1", ")!=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ic", "nt", "=", "ic", "nt", "+", "1", "\u010a\u010a", "print", "(ic", "nt", ")", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.981434755330334, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9625183119837646, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.6250192001927346, 0.5700083567488032, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032]} +{"problem_id": "p02814", "input": "#!/usr/bin/env python3\n\nimport sys\n\nfrom math import gcd\n\nimport math\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n tmp = 1\n\n count = None\n\n for i in range(N):\n\n tmp = (tmp * a[i]//2) // gcd(tmp,a[i]//2)\n\n c = 0\n\n n = a[i]//2\n\n while n % 2 == 0:\n\n c += 1\n\n n //= 2\n\n if i == 0:\n\n count = c\n\n elif count != c:\n\n print((0))\n\n exit()\n\n print(((M//tmp +1)//2))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120None", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120(", "tmp", "\u0120*", "\u0120a", "[i", "]", "//", "2", ")", "\u0120//", "\u0120gcd", "(tmp", ",a", "[i", "]", "//", "2", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120a", "[i", "]", "//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120n", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120//=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120count", "\u0120!=", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "M", "//", "tmp", "\u0120+", "1", ")//", "2", "))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02394", "input": "a=input().split()\n\nb=list(map(int,a))\n\nW=b[0]\n\nH=b[1]\n\nx=b[2]\n\ny=b[3]\n\nr=b[4]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')", "input_tokens": ["a", "=input", "().", "split", "()\u010a\u010a", "b", "=list", "(map", "(int", ",a", "))\u010a\u010a", "W", "=b", "[", "0", "]\u010a\u010a", "H", "=b", "[", "1", "]\u010a\u010a", "x", "=b", "[", "2", "]\u010a\u010a", "y", "=b", "[", "3", "]\u010a\u010a", "r", "=b", "[", "4", "]\u010a\u010a", "if", "\u0120(", "r", "\u0120<=", "\u0120x", "\u0120<=", "\u0120(", "W", "\u0120-", "\u0120r", "))", "\u0120and", "\u0120(", "r", "\u0120<=", "\u0120y", "\u0120<=", "\u0120(", "H", "\u0120-", "\u0120r", "))", ":\u010a\u010a", "\u0120", "\u0120print", "('", "Yes", "')\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "('", "No", "')"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02394", "input": "ia = [int(i) for i in input().split(\" \")]\n\nW=ia[0]\n\nH=ia[1]\n\nx=ia[2]\n\ny=ia[3]\n\nr=ia[4]\n\nprint((\"Yes\" if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H else \"No\"))", "input_tokens": ["ia", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "(\"", "\u0120\")", "]\u010a\u010a", "W", "=", "ia", "[", "0", "]\u010a\u010a", "H", "=", "ia", "[", "1", "]\u010a\u010a", "x", "=", "ia", "[", "2", "]\u010a\u010a", "y", "=", "ia", "[", "3", "]\u010a\u010a", "r", "=", "ia", "[", "4", "]\u010a\u010a", "print", "((\"", "Yes", "\"", "\u0120if", "\u0120", "0", "<=", "x", "-r", "\u0120and", "\u0120x", "+r", "<=", "W", "\u0120and", "\u0120", "0", "<=", "y", "-r", "\u0120and", "\u0120y", "+r", "<=", "H", "\u0120else", "\u0120\"", "No", "\"))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03457", "input": "N=input()\n\na=[]\n\nt=True\n\nfor _ in range(int(N)):\n\n a+=[list(map(int,input().split()))]\n\nfor i in range(int(N)):\n\n if a[i][0]%2==0:\n\n if abs(a[i][1]+a[i][2])<=a[i][0] and (a[i][1]+a[i][2])%2==0:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\n else:\n\n if abs(a[i][1]+a[i][2]<=a[i][0]) and (a[i][1]+a[i][2])%2==1:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\nif t:\n\n print('Yes')", "input_tokens": ["N", "=input", "()\u010a\u010a", "a", "=[]", "\u010a\u010a", "t", "=True", "\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(int", "(N", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "+", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(int", "(N", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[i", "][", "0", "]%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120abs", "(a", "[i", "][", "1", "]+", "a", "[i", "][", "2", "])", "<=", "a", "[i", "][", "0", "]", "\u0120and", "\u0120(", "a", "[i", "][", "1", "]+", "a", "[i", "][", "2", "])", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "=False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120abs", "(a", "[i", "][", "1", "]+", "a", "[i", "][", "2", "]<=", "a", "[i", "][", "0", "])", "\u0120and", "\u0120(", "a", "[i", "][", "1", "]+", "a", "[i", "][", "2", "])", "%", "2", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "=False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "if", "\u0120t", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nyenmin=a*x+b*y\n\nfor zz in range(2*10**5+1):\n\n xx=max(x-zz//2,0)\n\n yy=max(y-zz//2,0)\n\n yen=a*xx+b*yy+c*zz\n\n if yen d[v]+cost:\n\n d[to] = d[v]+cost\n\n par[to] = v\n\n que.put((d[to],to))\n\n\n\n for j in range(n):\n\n if i != j:\n\n a,b = j,par[j]\n\n if a>b:\n\n a,b = b,a\n\n used.add((a,b))\n\n\n\n print((m - len(used)))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120queue", "\u010a\u010a\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",m", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120G", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",b", ",c", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120G", "[a", "].", "append", "((", "b", ",c", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120G", "[b", "].", "append", "((", "a", ",c", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120used", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120[", "INF", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120par", "\u0120=", "\u0120[-", "1", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120di", "jk", "stra", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", "\u0120=", "\u0120queue", ".Priority", "Queue", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[i", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".put", "((", "0", ",i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120not", "\u0120que", ".empty", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120que", ".get", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120p", "[", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[v", "]", "\u0120<", "\u0120p", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120(", "to", ",c", "ost", ")", "\u0120in", "\u0120G", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[to", "]", "\u0120>", "\u0120d", "[v", "]+", "cost", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[to", "]", "\u0120=", "\u0120d", "[v", "]+", "cost", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120par", "[to", "]", "\u0120=", "\u0120v", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".put", "((", "d", "[to", "],", "to", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120!=", "\u0120j", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120j", ",", "par", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", ">b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120b", ",a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120used", ".add", "((", "a", ",b", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "m", "\u0120-", "\u0120len", "(", "used", "))", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03416", "input": "a,b = list(map(int,input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n s = str(i)\n\n l = len(s)\n\n if all(s[j] == s[l-j-1] for j in range(l)):\n\n count += 1\n\nprint(count)", "input_tokens": ["a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120all", "(s", "[j", "]", "\u0120==", "\u0120s", "[l", "-j", "-", "1", "]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(l", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02921", "input": "import itertools\n\nimport math\n\ndef main():\n\n s = input()\n\n t = input()\n\n cnt = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n cnt += 1\n\n print(cnt)\n\nif __name__ == '__main__':\n\n main()", "input_tokens": ["import", "\u0120itertools", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120", "\u0120s", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120", "\u0120t", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120==", "\u0120t", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120print", "(cnt", ")\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120", "\u0120main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03579", "input": "import sys\n\nsys.setrecursionlimit(100000)\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(v, c):\n\n # c: color = 1 or -1\n\n node[v] = c\n\n for i in graph[v]:\n\n if node[i] == c:\n\n return False\n\n \n\n if node[i] == 0 and not dfs(i, -c):\n\n return False\n\n \n\n return True\n\n\n\nnode = [0] * N\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in node) // 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) // 2 - M))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", ")\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "edges", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", ")]", "\u010a\u010a\u010a\u010a", "graph", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120x", ",", "\u0120y", "\u0120in", "\u0120edges", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120graph", "[x", "\u0120-", "\u0120", "1", "].", "append", "(y", "\u0120-", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120graph", "[y", "\u0120-", "\u0120", "1", "].", "append", "(x", "\u0120-", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "def", "\u0120dfs", "(v", ",", "\u0120c", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120c", ":", "\u0120color", "\u0120=", "\u0120", "1", "\u0120or", "\u0120-", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120node", "[v", "]", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120graph", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120node", "[i", "]", "\u0120==", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120node", "[i", "]", "\u0120==", "\u0120", "0", "\u0120and", "\u0120not", "\u0120dfs", "(i", ",", "\u0120-", "c", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a\u010a\u010a", "node", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120N", "\u010a\u010a", "if", "\u0120dfs", "(", "0", ",", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120sum", "(v", "\u0120+", "\u0120", "1", "\u0120for", "\u0120v", "\u0120in", "\u0120node", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "x", "\u0120*", "\u0120(", "N", "\u0120-", "\u0120x", ")", "\u0120-", "\u0120M", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "N", "\u0120*", "\u0120(", "N", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u0120-", "\u0120M", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02248", "input": "def kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return nx\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = input()\n\nP = input()\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n", "input_tokens": ["def", "\u0120k", "mp", "Table", "(w", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120lw", "\u0120=", "\u0120len", "(w", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120nx", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120(", "lw", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120-", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(l", "w", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120j", "\u0120>=", "\u0120", "0", "\u0120and", "\u0120w", "[i", "]", "\u0120!=", "\u0120w", "[j", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120nx", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nx", "[i", "\u0120+", "\u0120", "1", "]", "\u0120=", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120nx", "\u010a\u010a", "def", "\u0120k", "mp", "Search", "(s", ",", "\u0120w", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ls", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "_idx", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120nx", "\u0120=", "\u0120k", "mp", "Table", "(w", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120start", "\u0120+", "\u0120w", "_idx", "\u0120<", "\u0120ls", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[start", "\u0120+", "\u0120w", "_idx", "]", "\u0120==", "\u0120w", "[w", "_idx", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120w", "_idx", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120w", "_idx", "\u0120==", "\u0120len", "(w", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", ".append", "(start", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120start", "\u0120+", "\u0120w", "_idx", "\u0120-", "\u0120nx", "[w", "_idx", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120w", "_idx", "\u0120=", "\u0120nx", "[w", "_idx", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120w", "_idx", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120start", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120start", "\u0120+", "\u0120w", "_idx", "\u0120-", "\u0120nx", "[w", "_idx", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120w", "_idx", "\u0120=", "\u0120nx", "[w", "_idx", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a", "T", "\u0120=", "\u0120input", "()\u010a\u010a", "P", "\u0120=", "\u0120input", "()\u010a\u010a", "ans", "\u0120=", "\u0120k", "mp", "Search", "(T", ",", "\u0120P", ")\u010a\u010a", "if", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(", "(\"\\", "n", "\".", "join", "(map", "(str", ",", "\u0120ans", "))))", "\u0109\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378]} +{"problem_id": "p03457", "input": "def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time, px, py = 0, 0, 0\n\n for t, x, y in TXY:\n\n move = abs(x-px) + abs(y-py)\n\n # print(move, t-time)\n\n if (t - time) % 2 != move % 2 or t - time < move:\n\n return print(\"No\")\n\n time, px, py = t, x, y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120sys", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "XY", "\u0120=", "\u0120[[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120time", ",", "\u0120px", ",", "\u0120py", "\u0120=", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120t", ",", "\u0120x", ",", "\u0120y", "\u0120in", "\u0120T", "XY", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120move", "\u0120=", "\u0120abs", "(x", "-", "px", ")", "\u0120+", "\u0120abs", "(y", "-p", "y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120print", "(move", ",", "\u0120t", "-time", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "t", "\u0120-", "\u0120time", ")", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120move", "\u0120%", "\u0120", "2", "\u0120or", "\u0120t", "\u0120-", "\u0120time", "\u0120<", "\u0120move", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120print", "(\"", "No", "\")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120time", ",", "\u0120px", ",", "\u0120py", "\u0120=", "\u0120t", ",", "\u0120x", ",", "\u0120y", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Yes", "\")\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03553", "input": "import math,string,itertools,math,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf = 10**20\n\neps = 1.0 / 10**15\n\nmod = 10**9+7\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef F(): return float(sys.stdin.readline())\n\ndef S(): return input()\n\ndef pf(s): return print(s, flush=True)\n\ndef divisions(n):\n\n sq = int(math.sqrt(n)+1)\n\n d = collections.defaultdict(int)\n\n while n % 2 == 0:\n\n n //= 2\n\n d[2] += 1\n\n i = 3\n\n while n > 1 and sq >= i:\n\n if n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n else:\n\n i += 2\n\n\n\n if n > 1:\n\n d[n] += 1\n\n\n\n r = [1]\n\n for k, v in d.items():\n\n for c in r[:]:\n\n for i in range(1,v+1):\n\n r.append(c*(k**i))\n\n\n\n return sorted(r)\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n s = set()\n\n for i in range(n,0,-1):\n\n d = divisions(i)\n\n ld = len(d)\n\n for j in range(1,2**ld):\n\n c = []\n\n ff = True\n\n for k in range(ld):\n\n if j & (1<", "\u0120", "1", "\u0120and", "\u0120sq", "\u0120>=", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120//=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[i", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "2", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[n", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120[", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", ",", "\u0120v", "\u0120in", "\u0120d", ".items", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120r", "[:", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",v", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", ".append", "(c", "*(", "k", "**", "i", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120sorted", "(r", ")\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ",", "0", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120divisions", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ld", "\u0120=", "\u0120len", "(d", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "2", "**", "ld", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ff", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(ld", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120&", "\u0120(", "1", "<<", "k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120e", "\u0120in", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[k", "]", "\u0120%", "\u0120e", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ff", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120f", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", ".append", "(d", "[k", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120ff", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120ff", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", ".add", "(tuple", "(c", "\u0120+", "\u0120[", "n", "+", "1", "]))\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120sorted", "(list", "(s", "),", "\u0120reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120e", "\u0120in", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "%", "e", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120f", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120a", "[j", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120e", "\u0120in", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "%", "e", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120f", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[j", "-", "1", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120sum", "(a", ")\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "print", "(main", "())\u010a\u010a", "\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679]} +{"problem_id": "p02881", "input": "N = int(input())\n\nans = N - 1\n\np = 1\n\nfor i in range(2, int((N ** 0.5) + 1)):\n\n if p % 2 == 1 and i > (N ** 0.5):\n\n break\n\n if N % i == 0:\n\n p = i\n\n j = N // i\n\n m = i + j - 2\n\n if m < ans:\n\n ans = m\n\n else:\n\n continue\n\n else:\n\n continue\n\nprint(ans)\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120N", "\u0120-", "\u0120", "1", "\u010a\u010a", "p", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",", "\u0120int", "((", "N", "\u0120**", "\u0120", "0", ".", "5", ")", "\u0120+", "\u0120", "1", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120p", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", "\u0120and", "\u0120i", "\u0120>", "\u0120(", "N", "\u0120**", "\u0120", "0", ".", "5", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120N", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120N", "\u0120//", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120i", "\u0120+", "\u0120j", "\u0120-", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120m", "\u0120<", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03078", "input": "import sys\n\nimport heapq\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n Q = []\n\n S = set()\n\n heapq.heapify(Q)\n\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n\n for i in range(K):\n\n m, a, b, c = heapq.heappop(Q)\n\n print((-m))\n\n if (a + 1, b, c) not in S and a + 1 < X:\n\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n\n S.add((a + 1, b, c))\n\n if (a, b + 1, c) not in S and b + 1 < Y:\n\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n\n S.add((a, b + 1, c))\n\n if (a, b, c + 1) not in S and c + 1 < Z:\n\n heapq.heappush(Q, (-A[a ] - B[b] - C[c+1], a, b, c + 1))\n\n S.add((a, b, c + 1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "import", "\u0120heapq", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120\\", "n", "\u010a\u010a", "def", "\u0120input", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "rstrip", "()", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", ",", "\u0120Y", ",", "\u0120Z", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120B", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", ".sort", "(reverse", "=True", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120Q", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120heapq", ".heap", "ify", "(Q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(Q", ",", "\u0120(-", "A", "[", "0", "]", "\u0120-", "\u0120B", "[", "0", "]", "\u0120-", "\u0120C", "[", "0", "],", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", ",", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120heapq", ".he", "app", "op", "(Q", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "m", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "a", "\u0120+", "\u0120", "1", ",", "\u0120b", ",", "\u0120c", ")", "\u0120not", "\u0120in", "\u0120S", "\u0120and", "\u0120a", "\u0120+", "\u0120", "1", "\u0120<", "\u0120X", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(Q", ",", "\u0120(-", "A", "[a", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120B", "[b", "]", "\u0120-", "\u0120C", "[c", "],", "\u0120a", "\u0120+", "\u0120", "1", ",", "\u0120b", ",", "\u0120c", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120S", ".add", "((", "a", "\u0120+", "\u0120", "1", ",", "\u0120b", ",", "\u0120c", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "a", ",", "\u0120b", "\u0120+", "\u0120", "1", ",", "\u0120c", ")", "\u0120not", "\u0120in", "\u0120S", "\u0120and", "\u0120b", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(Q", ",", "\u0120(-", "A", "[a", "]", "\u0120-", "\u0120B", "[b", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120C", "[c", "],", "\u0120a", ",", "\u0120b", "\u0120+", "\u0120", "1", ",", "\u0120c", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120S", ".add", "((", "a", ",", "\u0120b", "\u0120+", "\u0120", "1", ",", "\u0120c", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "a", ",", "\u0120b", ",", "\u0120c", "\u0120+", "\u0120", "1", ")", "\u0120not", "\u0120in", "\u0120S", "\u0120and", "\u0120c", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Z", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(Q", ",", "\u0120(-", "A", "[a", "\u0120]", "\u0120-", "\u0120B", "[b", "]", "\u0120-", "\u0120C", "[c", "+", "1", "],", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120+", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120S", ".add", "((", "a", ",", "\u0120b", ",", "\u0120c", "\u0120+", "\u0120", "1", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03494", "input": "def two_count(x):\n\n\tif int(str(x)[-1]) % 2 == 0:\n\n\t\treturn 1 + two_count(x//2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(input())\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))", "input_tokens": ["def", "\u0120two", "_count", "(x", "):\u010a\u010a", "\u0109if", "\u0120int", "(str", "(x", ")[-", "1", "])", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0109", "\u0109return", "\u0120", "1", "\u0120+", "\u0120two", "_count", "(x", "//", "2", ")\u010a\u010a", "\u0109else", ":\u010a\u010a", "\u0109", "\u0109return", "\u0120", "0", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "n", "_list", "\u0120=", "\u0120[", "int", "(n", ")", "\u0120for", "\u0120n", "\u0120in", "\u0120input", "().", "split", "(\"", "\u0120\"", ")]", "\u010a\u010a\u010a\u010a", "n", "_two", "_count", "_list", "\u0120=", "\u0120[", "two", "_count", "(n", ")", "\u0120for", "\u0120n", "\u0120in", "\u0120n", "_list", "]\u010a\u010a\u010a\u010a", "print", "((", "min", "(n", "_two", "_count", "_list", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7186273667339679, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02386", "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if(g[k:k+4]==e[1:5])*(f[0]==e[0])*(f[5]==e[5]):return 'No'\n\n return 'Yes'\n\nprint((f()))\n", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "a", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "def", "\u0120f", "():\u010a\u010a", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120", "\u0120d", "=a", "[i", "][:", "];", "d", "[", "3", "],", "d", "[", "4", "]=", "d", "[", "4", "],", "d", "[", "3", "]\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",n", "):\u010a\u010a", "\u0120\u0120", "\u0120e", "=a", "[j", "][:", "];", "e", "[", "3", "],", "e", "[", "4", "]=", "e", "[", "4", "],", "e", "[", "3", "]\u010a\u010a", "\u0120\u0120", "\u0120for", "\u0120p", "\u0120in", "('", "0", "1", "2", "3", "4", "5", "','", "1", "5", "2", "0", "4", "3", "','", "2", "1", "5", "3", "0", "4", "','", "3", "0", "2", "5", "4", "1", "','", "4", "1", "0", "3", "5", "2", "','", "5", "1", "4", "3", "2", "0", "')", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "=[", "d", "[int", "(k", ")]", "for", "\u0120k", "\u0120in", "\u0120p", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "=f", "[", "1", ":", "5", "]*", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "4", "):\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120if", "(g", "[k", ":k", "+", "4", "]==", "e", "[", "1", ":", "5", "])", "*(", "f", "[", "0", "]==", "e", "[", "0", "])", "*(", "f", "[", "5", "]==", "e", "[", "5", "]):", "return", "\u0120'", "No", "'\u010a\u010a", "\u0120return", "\u0120'", "Yes", "'\u010a\u010a", "print", "((", "f", "()))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02814", "input": "from math import gcd\n\nn, m = list(map(int, input().split()))\n\na = [int(i) // 2 for i in input().split()]\n\nx = 1\n\nfor i in range(n):\n\n x *= a[i] // gcd(x, a[i])\n\nfor i in a:\n\n if x // i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((m // x + 1) // 2))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120//", "\u0120", "2", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "x", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120*=", "\u0120a", "[i", "]", "\u0120//", "\u0120gcd", "(x", ",", "\u0120a", "[i", "])\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120//", "\u0120i", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "print", "(((", "m", "\u0120//", "\u0120x", "\u0120+", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03038", "input": "import sys\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nn,m=list(map(int,input().split()))\n\na0=list(map(int,input().split()))\n\ndata=[list(map(int,input().split())) for i in range(m)]\n\nfor i in a0:\n\n\tdata.append([1,i])\n\ndata.sort(key=lambda tup:-tup[1])\n\nans=0\n\nfor num,val in data:\n\n\tif n>=num:\n\n\t\tn-=num\n\n\t\tans+=val*num\n\n\telse:\n\n\t\tans+=val*n\n\n\t\tbreak\n\nprint(ans)\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120lambda", ":", "\u0120sys", ".stdin", ".readline", "()", "[:-", "1", "]\u010a\u010a", "n", ",m", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "0", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "data", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(m", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120a", "0", ":\u010a\u010a", "\u0109data", ".append", "([", "1", ",i", "])\u010a\u010a", "data", ".sort", "(key", "=lambda", "\u0120tup", ":-", "t", "up", "[", "1", "])\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120num", ",val", "\u0120in", "\u0120data", ":\u010a\u010a", "\u0109if", "\u0120n", ">=", "num", ":\u010a\u010a", "\u0109", "\u0109n", "-=", "num", "\u010a\u010a", "\u0109", "\u0109ans", "+=", "val", "*num", "\u010a\u010a", "\u0109else", ":\u010a\u010a", "\u0109", "\u0109ans", "+=", "val", "*n", "\u010a\u010a", "\u0109", "\u0109break", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03200", "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(input())\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tA = []\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': A.append(bcnt)\n\n\t\n\n\tprint((sum(A)))\n\n\n\nif __name__ == '__main__':\n\n\tmain()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "6", ")\u010a\u010a", "if", "\u0120sys", ".platform", "\u0120in", "\u0120(", "['", "ios", "','", "darwin", "','", "win", "3", "2", "'])", ":\u010a\u010a", "\u0109sys", ".stdin", "=open", "('", "Untitled", ".txt", "')\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "def", "\u0120INT", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120MAP", "():", "\u0120return", "\u0120[", "int", "(s", ")", "\u0120for", "\u0120s", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0109S", "\u0120=", "\u0120input", "().", "rstrip", "()\u010a\u010a", "\u0109b", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0109A", "\u0120=", "\u0120[]\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0109", "\u0109if", "\u0120S", "[i", "]", "\u0120==", "\u0120'", "B", "':", "\u0120b", "cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0109", "\u0109if", "\u0120S", "[i", "]", "\u0120==", "\u0120'", "W", "':", "\u0120A", ".append", "(b", "cnt", ")\u010a\u010a", "\u0109\u010a\u010a", "\u0109print", "((", "sum", "(A", "))", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0109main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742]} +{"problem_id": "p03416", "input": "a,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(a, b + 1):\n\n f = True\n\n s = str(i)\n\n l = len(s)\n\n for j in range(l//2 + 1):\n\n if s[j] != s[- j - 1]:\n\n f = False\n\n break\n\n if f:\n\n n += 1\n\nprint(n)", "input_tokens": ["a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "n", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(l", "//", "2", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[j", "]", "\u0120!=", "\u0120s", "[-", "\u0120j", "\u0120-", "\u0120", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120f", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(n", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897]} +{"problem_id": "p03752", "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for bit in range(1 << N):\n\n if (not (bit & 1)) or bin(bit).count('1') != K:\n\n continue\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if bit & (1 << i):\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".readlines", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "\u0120<<", "\u0120", "6", "0", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120K", ",", "\u0120*", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120read", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120INF", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120bit", "\u0120in", "\u0120range", "(", "1", "\u0120<<", "\u0120N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "not", "\u0120(", "bit", "\u0120&", "\u0120", "1", "))", "\u0120or", "\u0120bin", "(bit", ").", "count", "('", "1", "')", "\u0120!=", "\u0120K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120total", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_height", "\u0120=", "\u0120A", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120a", "\u0120in", "\u0120enumerate", "(A", "[", "1", ":],", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120<=", "\u0120max", "_height", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120bit", "\u0120&", "\u0120(", "1", "\u0120<<", "\u0120i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120total", "\u0120+=", "\u0120max", "_height", "\u0120-", "\u0120a", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_height", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_height", "\u0120=", "\u0120a", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120ans", "\u0120>", "\u0120total", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120total", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02952", "input": "import math\n\nn = int(input())\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if math.floor(math.log10(i) + 1) % 2:\n\n cnt += 1\n\nprint(cnt)", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120math", ".floor", "(math", ".log", "1", "0", "(i", ")", "\u0120+", "\u0120", "1", ")", "\u0120%", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p02773", "input": "from collections import defaultdict\n\nn = int(input())\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = input()\n\n d[key] += 1\n\n\n\ndict = sorted(list(d.items()), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nfor s in dict_li:\n\n print(s)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120key", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[key", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "dict", "\u0120=", "\u0120sorted", "(list", "(d", ".items", "()),", "\u0120key", "=lambda", "\u0120x", ":x", "[", "1", "],", "\u0120reverse", "=True", ")\u010a\u010a", "max", "_v", "\u0120=", "\u0120max", "(d", ".values", "())\u010a\u010a", "\u010a\u010a", "dict", "_li", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120dict", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[", "1", "]==", "max", "_v", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dict", "_li", ".append", "(a", "[", "0", "])\u010a\u010a", "\u010a\u010a", "dict", "_li", ".sort", "()\u010a\u010a", "for", "\u0120s", "\u0120in", "\u0120dict", "_li", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(s", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03721", "input": "n,k = list(map(int,input().split()))\n\nl = [0]*(10**5+1)\n\nfor i in range(n):\n\n ai,bi = list(map(int,input().split()))\n\n l[ai]+=bi\n\nfor index,i in enumerate(l):\n\n if i:\n\n k-=i\n\n if k<=0:\n\n break\n\nprint(index)", "input_tokens": ["n", ",k", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "l", "\u0120=", "\u0120[", "0", "]*(", "1", "0", "**", "5", "+", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ai", ",", "bi", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "[", "ai", "]+=", "bi", "\u010a\u010a", "for", "\u0120index", ",i", "\u0120in", "\u0120enumerate", "(l", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "-=", "i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", "<=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "print", "(index", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p03416", "input": "A, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = list(str(i))\n\n\n\n if l == list(reversed(l)):\n\n cnt += 1\n\n\n\nprint(cnt)\n", "input_tokens": ["A", ",", "\u0120B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(A", ",", "\u0120B", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120list", "(str", "(i", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120==", "\u0120list", "(re", "versed", "(l", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03363", "input": "n = int(input())\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nfrom math import factorial\n\ndef combinations_count(n, r):\n\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += combinations_count(j,2)\n\n\n\nprint(ans)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ary", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "#print", "(n", ",", "ary", ")\u010a\u010a\u010a\u010a", "ary", "_", "2", "\u0120=", "\u0120[", "ary", "[", "0", "]]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ary", "_", "2", ".append", "(", "ary", "[i", "]", "\u0120+", "\u0120ary", "_", "2", "[i", "-", "1", "])\u010a\u010a", "ary", "_", "2", "\u0120=", "\u0120[", "0", "]", "\u0120+", "\u0120ary", "_", "2", "\u010a\u010a", "#print", "(", "ary", "_", "2", ")\u010a\u010a\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "c", "\u0120=", "\u0120Counter", "(", "ary", "_", "2", ")\u010a\u010a", "v", "\u0120=", "\u0120(", "list", "(c", ".values", "()))\u010a\u010a", "#print", "(v", ")\u010a\u010a\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a", "def", "\u0120combinations", "_count", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120factorial", "(n", ")", "\u0120//", "\u0120(", "factor", "ial", "(n", "\u0120-", "\u0120r", ")", "\u0120*", "\u0120factorial", "(r", "))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120v", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120>", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120combinations", "_count", "(j", ",", "2", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p02792", "input": "N = int(input())\n\nmem = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "mem", "\u0120=", "\u0120[[", "0", "]*", "1", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(str", "(i", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120int", "(str", "(i", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120mem", "[a", "][", "b", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(str", "(i", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120int", "(str", "(i", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120mem", "[b", "][", "a", "]\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03796", "input": "N = int(input())\n\np = 1\n\nfor i in range(N):\n\n p *= (i + 1)\n\n p %= (1e9 + 7)\n\nprint((int(p)))", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "p", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120*=", "\u0120(", "i", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120%=", "\u0120(", "1", "e", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a", "print", "((", "int", "(p", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02725", "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\ndiff = []\n\n\n\nfor i in range(n - 1):\n\n diff.append(a[i + 1] - a[i])\n\ndiff.append(k - a[-1] + a[0])\n\n\n\nprint((k - max(diff)))\n", "input_tokens": ["k", ",", "\u0120n", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "diff", "\u0120=", "\u0120[]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "\u0120-", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120diff", ".append", "(a", "[i", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120a", "[i", "])\u010a\u010a", "diff", ".append", "(k", "\u0120-", "\u0120a", "[-", "1", "]", "\u0120+", "\u0120a", "[", "0", "])\u010a\u010a", "\u010a\u010a", "print", "((", "k", "\u0120-", "\u0120max", "(diff", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03253", "input": "class Calc:\n\n def __init__(self, max_value, mod):\n\n \"\"\"combination(max_value, all)\"\"\"\n\n fact = [-1] * (max_value + 1)\n\n fact[0] = 1\n\n fact[1] = 1\n\n for x in range(2, max_value + 1):\n\n fact[x] = x * fact[x - 1] % mod\n\n\n\n invs = [1] * (max_value + 1)\n\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n\n for x in range(max_value - 1, 0, -1):\n\n invs[x] = invs[x + 1] * (x + 1) % mod\n\n\n\n self.fact = fact\n\n self.invs = invs\n\n self.mod = mod\n\n\n\n def combination(self, n, r):\n\n if n - r < r:\n\n return self.combination(n, n - r)\n\n if r < 0:\n\n return 0\n\n if r == 0:\n\n return 1\n\n if r == 1:\n\n return n\n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\n\n\n\ndef gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n ma = d * d\n\n while ma <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n ma += d * 4 + 4\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n cal = Calc(max_value=N + 30, mod=MOD)\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["class", "\u0120Calc", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120max", "_value", ",", "\u0120mod", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"", "combination", "(max", "_value", ",", "\u0120all", ")", "\"\"\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fact", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120(", "max", "_value", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fact", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fact", "[", "1", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(", "2", ",", "\u0120max", "_value", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fact", "[x", "]", "\u0120=", "\u0120x", "\u0120*", "\u0120fact", "[x", "\u0120-", "\u0120", "1", "]", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inv", "s", "\u0120=", "\u0120[", "1", "]", "\u0120*", "\u0120(", "max", "_value", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inv", "s", "[max", "_value", "]", "\u0120=", "\u0120pow", "(f", "act", "[max", "_value", "],", "\u0120mod", "\u0120-", "\u0120", "2", ",", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(max", "_value", "\u0120-", "\u0120", "1", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inv", "s", "[x", "]", "\u0120=", "\u0120inv", "s", "[x", "\u0120+", "\u0120", "1", "]", "\u0120*", "\u0120(", "x", "\u0120+", "\u0120", "1", ")", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".f", "act", "\u0120=", "\u0120fact", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".in", "vs", "\u0120=", "\u0120inv", "s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".mod", "\u0120=", "\u0120mod", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120combination", "(self", ",", "\u0120n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120-", "\u0120r", "\u0120<", "\u0120r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120self", ".com", "b", "ination", "(n", ",", "\u0120n", "\u0120-", "\u0120r", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120self", ".f", "act", "[n", "]", "\u0120*", "\u0120self", ".in", "vs", "[r", "]", "\u0120*", "\u0120self", ".in", "vs", "[n", "\u0120-", "\u0120r", "]", "\u0120%", "\u0120self", ".mod", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120gen", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120%", "\u0120d", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120//=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120yield", "\u0120cnt", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ma", "\u0120=", "\u0120d", "\u0120*", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120ma", "\u0120<=", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120%", "\u0120d", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120//=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120yield", "\u0120cnt", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ma", "\u0120+=", "\u0120d", "\u0120*", "\u0120", "4", "\u0120+", "\u0120", "4", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120+=", "\u0120", "2", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120yield", "\u0120", "1", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120MOD", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120cal", "\u0120=", "\u0120Calc", "(max", "_value", "=N", "\u0120+", "\u0120", "3", "0", ",", "\u0120mod", "=", "MOD", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120cnt", "\u0120in", "\u0120gen", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120(", "ans", "\u0120*", "\u0120cal", ".com", "b", "ination", "(N", "\u0120+", "\u0120cnt", "\u0120-", "\u0120", "1", ",", "\u0120cnt", "))", "\u0120%", "\u0120MOD", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02983", "input": "def c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))", "input_tokens": ["def", "\u0120c", "_remain", "der", "_min", "imization", "_", "2", "0", "1", "9", "(L", ",", "\u0120R", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(L", ",", "\u0120min", "(R", ",", "\u0120L", "\u0120+", "\u0120", "2", "0", "1", "9", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "\u0120+", "\u0120", "1", ",", "\u0120min", "(R", "\u0120+", "\u0120", "1", ",", "\u0120L", "\u0120+", "\u0120", "2", "0", "2", "0", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120(", "i", "\u0120*", "\u0120j", ")", "\u0120%", "\u0120", "2", "0", "1", "9", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ans", "\u010a\u010a\u010a\u010a", "L", ",", "\u0120R", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "print", "((", "c", "_remain", "der", "_min", "imization", "_", "2", "0", "1", "9", "(L", ",", "\u0120R", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nval = float('inf')\n\nfor k in range(10 ** 5 + 1):\n\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\n\nprint(val)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "val", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(", "1", "0", "\u0120**", "\u0120", "5", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120val", "\u0120=", "\u0120min", "(val", ",", "\u0120", "2", "\u0120*", "\u0120c", "\u0120*", "\u0120k", "\u0120+", "\u0120max", "(x", "\u0120-", "\u0120k", ",", "\u0120", "0", ")", "\u0120*", "\u0120a", "\u0120+", "\u0120max", "(y", "\u0120-", "\u0120k", ",", "\u0120", "0", ")", "\u0120*", "\u0120b", ")\u010a\u010a", "print", "(val", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03796", "input": "from math import factorial as f\n\nn = int(input())\n\nprint((f(n) % (10 ** 9 + 7)))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u0120as", "\u0120f", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "f", "(n", ")", "\u0120%", "\u0120(", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03039", "input": "n,m,k=list(map(int,input().split()))\n\nmod=10**9+7\n\nf=[1]\n\nfor i in range(2*10**5+7):f+=[f[-1]*(i+1)%mod]\n\ndef comb(a,b):return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod\n\nans=0\n\nfor i in range(1,n):\n\n ans+=(i*(n-i)*m**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nfor i in range(1,m):\n\n ans+=(i*(m-i)*n**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nprint(ans)", "input_tokens": ["n", ",m", ",k", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "mod", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "f", "=[", "1", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "*", "1", "0", "**", "5", "+", "7", "):", "f", "+", "=[", "f", "[-", "1", "]*(", "i", "+", "1", ")%", "mod", "]\u010a\u010a", "def", "\u0120comb", "(a", ",b", "):", "return", "\u0120f", "[a", "]*", "pow", "(f", "[b", "],", "mod", "-", "2", ",", "mod", ")*", "pow", "(f", "[a", "-b", "],", "mod", "-", "2", ",", "mod", ")%", "mod", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "):\u010a\u010a", "\u0120", "\u0120ans", "+=(", "i", "*(", "n", "-i", ")*", "m", "**", "2", ")*(", "comb", "(n", "*m", "-", "2", ",k", "-", "2", "))\u010a\u010a", "\u0120", "\u0120ans", "%=", "mod", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",m", "):\u010a\u010a", "\u0120", "\u0120ans", "+=(", "i", "*(", "m", "-i", ")*", "n", "**", "2", ")*(", "comb", "(n", "*m", "-", "2", ",k", "-", "2", "))\u010a\u010a", "\u0120", "\u0120ans", "%=", "mod", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(int", "(input", "()))", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03371", "input": "A, B, C, X, Y = [int(_) for _ in input().split()]\n\nans = A * X + B * Y\n\nfor i in range(max(X, Y) + 1):\n\n cost = 2 * C * i\n\n if X > i:\n\n cost += A * (X - i)\n\n if Y > i:\n\n cost += B * (Y - i)\n\n ans = min(ans, cost)\n\nprint(ans)", "input_tokens": ["A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120[", "int", "(_)", "\u0120for", "\u0120_", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "ans", "\u0120=", "\u0120A", "\u0120*", "\u0120X", "\u0120+", "\u0120B", "\u0120*", "\u0120Y", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(max", "(X", ",", "\u0120Y", ")", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cost", "\u0120=", "\u0120", "2", "\u0120*", "\u0120C", "\u0120*", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120X", "\u0120>", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cost", "\u0120+=", "\u0120A", "\u0120*", "\u0120(", "X", "\u0120-", "\u0120i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120Y", "\u0120>", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cost", "\u0120+=", "\u0120B", "\u0120*", "\u0120(", "Y", "\u0120-", "\u0120i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120cost", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.914713330925897, 0.914713330925897, 0.914713330925897]} +{"problem_id": "p03945", "input": "s = input()\n\nlen_s = len(s)\n\ncnt = [0, 0]\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n memo_1 = s[len_s - i]\n\n if s[i] != memo_0:\n\n cnt[0] += 1\n\n if s[len_s - i - 1] != memo_1:\n\n cnt[1] += 1\n\nprint((min(cnt)))\n", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a", "len", "_s", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "cnt", "\u0120=", "\u0120[", "0", ",", "\u0120", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120memo", "_", "0", "\u0120=", "\u0120s", "[i", "\u0120-", "\u0120", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120memo", "_", "1", "\u0120=", "\u0120s", "[len", "_s", "\u0120-", "\u0120i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120!=", "\u0120memo", "_", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "[", "0", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[len", "_s", "\u0120-", "\u0120i", "\u0120-", "\u0120", "1", "]", "\u0120!=", "\u0120memo", "_", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "[", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "((", "min", "(cnt", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293]} +{"problem_id": "p03558", "input": "import heapq\n\nK=int(input())\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=[]\n\nheapq.heappush(q,(0,1))\n\nwhile (len(q)!=0):\n\n prc,src=heapq.heappop(q)\n\n if dist[src]dist[src]+1:\n\n dist[(src+1)%K]=dist[src]+1\n\n heapq.heappush(q,(dist[(src+1)%K],(src+1)%K))\n\n if dist[(10*src)%K]>dist[src]:\n\n dist[(10*src)%K]=dist[src]\n\n heapq.heappush(q,(dist[(src*10)%K],(src*10)%K))\n\nprint((dist[0]))\n", "input_tokens": ["import", "\u0120heapq", "\u010a\u010a", "K", "=int", "(input", "())\u010a\u010a", "dist", "=[", "1", "0", "**", "1", "5", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(K", ")]\u010a\u010a", "dist", "[", "1", "]=", "1", "\u010a\u010a", "q", "=[]", "\u010a\u010a", "heap", "q", ".he", "app", "ush", "(q", ",(", "0", ",", "1", "))\u010a\u010a", "while", "\u0120(", "len", "(q", ")!=", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120pr", "c", ",", "src", "=", "heap", "q", ".he", "app", "op", "(q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dist", "[src", "]<", "pr", "c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dist", "[(", "src", "+", "1", ")%", "K", "]>", "dist", "[src", "]+", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dist", "[(", "src", "+", "1", ")%", "K", "]=", "dist", "[src", "]+", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",(", "dist", "[(", "src", "+", "1", ")%", "K", "],", "(", "src", "+", "1", ")%", "K", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dist", "[(", "1", "0", "*", "src", ")%", "K", "]>", "dist", "[src", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dist", "[(", "1", "0", "*", "src", ")%", "K", "]=", "dist", "[src", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",(", "dist", "[(", "src", "*", "1", "0", ")%", "K", "],", "(", "src", "*", "1", "0", ")%", "K", "))\u010a\u010a", "print", "((", "dist", "[", "0", "]))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897]} +{"problem_id": "p02792", "input": "n = int(input())\n\n\n\ncnt = 0\n\nfor i in range(1, n+1):\n\n i_str = str(i)\n\n if len(i_str) == 1:\n\n cnt += 1\n\n continue\n\n if len(i_str) == 2:\n\n if int(i_str[0]) == int(i_str[1]):\n\n cnt += 3\n\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 3:\n\n if int(i_str[0]) == int(i_str[2]):\n\n cnt += 4 + (2 * (int(i_str[1])+1) - 1)\n\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n\n cnt += 22\n\n elif int(i_str[0]) < int(i_str[2]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 4:\n\n if int(i_str[0]) == int(i_str[3]):\n\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2])+1) - 1\n\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n\n cnt += 222\n\n elif int(i_str[0]) < int(i_str[3]):\n\n cnt += 22\n\n continue\n\n if len(i_str) == 5:\n\n if int(i_str[0]) == int(i_str[4]):\n\n cnt += 224 + 200 * int(i_str[1]) + 20 * int(i_str[2]) + 2 * (int(i_str[3])+1) - 1\n\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n\n cnt += 2222\n\n elif int(i_str[0]) < int(i_str[4]):\n\n cnt += 222\n\n continue\n\n if len(i_str) == 6:\n\n if int(i_str[0]) == int(i_str[5]):\n\n cnt += 2224 + 2000 * int(i_str[1]) + 200 * int(i_str[2]) + 20 * int(i_str[3]) + 2 * (int(i_str[4])+1) - 1\n\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n\n cnt += 22222\n\n elif int(i_str[0]) < int(i_str[5]):\n\n cnt += 2222\n\n continue\n\n\n\nprint(cnt)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "_str", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120==", "\u0120int", "(i", "_str", "[", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "1", "])", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120>", "\u0120int", "(i", "_str", "[", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "3", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120==", "\u0120int", "(i", "_str", "[", "2", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "4", "\u0120+", "\u0120(", "2", "\u0120*", "\u0120(", "int", "(i", "_str", "[", "1", "])+", "1", ")", "\u0120-", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "2", "])", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120>", "\u0120int", "(i", "_str", "[", "2", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120<", "\u0120int", "(i", "_str", "[", "2", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "4", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120==", "\u0120int", "(i", "_str", "[", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "4", "\u0120+", "\u0120", "2", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "1", "])", "\u0120+", "\u0120", "2", "\u0120*", "\u0120(", "int", "(i", "_str", "[", "2", "])+", "1", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "3", "])", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120>", "\u0120int", "(i", "_str", "[", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120<", "\u0120int", "(i", "_str", "[", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120==", "\u0120int", "(i", "_str", "[", "4", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "4", "\u0120+", "\u0120", "2", "0", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "1", "])", "\u0120+", "\u0120", "2", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "2", "])", "\u0120+", "\u0120", "2", "\u0120*", "\u0120(", "int", "(i", "_str", "[", "3", "])+", "1", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "4", "])", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120>", "\u0120int", "(i", "_str", "[", "4", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120<", "\u0120int", "(i", "_str", "[", "4", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120==", "\u0120int", "(i", "_str", "[", "5", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "4", "\u0120+", "\u0120", "2", "0", "0", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "1", "])", "\u0120+", "\u0120", "2", "0", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "2", "])", "\u0120+", "\u0120", "2", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "3", "])", "\u0120+", "\u0120", "2", "\u0120*", "\u0120(", "int", "(i", "_str", "[", "4", "])+", "1", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "5", "])", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120>", "\u0120int", "(i", "_str", "[", "5", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120<", "\u0120int", "(i", "_str", "[", "5", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.6855929667625797, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.579389560544, 0.6514299043837268, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.579389560544, 0.6160583186229708, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731]} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\nans = math.factorial(N) % (10**9 + 7)\n\nprint(ans)", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120math", ".factor", "ial", "(N", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03038", "input": "from heapq import heappop, heappush\n\n\n\nn, m = list(map(int, input().split()))\n\na = tuple(map(int, input().split()))\n\n\n\nhq = []\n\nfor aa in a:\n\n heappush(hq, (-aa, 1))\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(hq, (-c, b))\n\n\n\nrest = n\n\nans = 0\n\nwhile rest > 0:\n\n num, cnt = heappop(hq)\n\n\n\n num *= (-1)\n\n use = min(rest, cnt)\n\n ans += use * num\n\n rest -= use\n\n\n\nprint(ans)\n", "input_tokens": ["from", "\u0120heapq", "\u0120import", "\u0120he", "app", "op", ",", "\u0120he", "app", "ush", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "hq", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120aa", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120he", "app", "ush", "(h", "q", ",", "\u0120(-", "aa", ",", "\u0120", "1", "))", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120he", "app", "ush", "(h", "q", ",", "\u0120(-", "c", ",", "\u0120b", "))", "\u010a\u010a\u010a\u010a", "rest", "\u0120=", "\u0120n", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120rest", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", ",", "\u0120cnt", "\u0120=", "\u0120he", "app", "op", "(h", "q", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120*=", "\u0120(-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120use", "\u0120=", "\u0120min", "(rest", ",", "\u0120cnt", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120use", "\u0120*", "\u0120num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120rest", "\u0120-=", "\u0120use", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p03371", "input": "A,B,C,X,Y = list(map(int,input().split()))\n\nl = []\n\nfor i in range(max(X,Y)+1):\n\n T = i * C * 2\n\n if i < X: \n\n T += (X-i)*A\n\n if i < Y:\n\n T += (Y-i)*B\n\n l.append(T)\n\nl.sort()\n\nprint((l[0]))", "input_tokens": ["A", ",B", ",C", ",X", ",Y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "l", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(max", "(X", ",Y", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120i", "\u0120*", "\u0120C", "\u0120*", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120<", "\u0120X", ":", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120T", "\u0120+=", "\u0120(", "X", "-i", ")*", "A", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120<", "\u0120Y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120T", "\u0120+=", "\u0120(", "Y", "-i", ")*", "B", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ".append", "(T", ")\u010a\u010a", "l", ".sort", "()\u010a\u010a", "print", "((", "l", "[", "0", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897]} +{"problem_id": "p04012", "input": "import collections\n\nimport sys\n\na=input()\n\nb=[]\n\n\n\nfor i in a:\n\n b.append(i)\n\n \n\nb.sort()\n\nc=collections.Counter(b)\n\nc=list(c.values())\n\n\n\nfor i in range(len(c)):\n\n if int(c[i])%2==0:\n\n q=0\n\n else:\n\n q=1\n\n print('No')\n\n sys.exit()\n\n \n\nprint('Yes')\n", "input_tokens": ["import", "\u0120collections", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "a", "=input", "()\u010a\u010a", "b", "=[]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120", "\u0120b", ".append", "(i", ")\u010a\u010a", "\u0120\u0120\u010a\u010a", "b", ".sort", "()\u010a\u010a", "c", "=c", "ollections", ".Counter", "(b", ")\u010a\u010a", "c", "=list", "(c", ".values", "())\u010a\u010a", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(c", "))", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120int", "(c", "[i", "])", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "=", "0", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "('", "Yes", "')\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p03835", "input": "#ABC951B/Sum_of_Three_Integers\n\n\n\nK, S = list(map(int, input().split()))\n\nans = 0\n\nfor x in range(0, K+1):\n\n for y in range(0, K+1):\n\n z = S - x - y\n\n if 0 <= z and z <= K:\n\n ans += 1\n\nprint(ans)", "input_tokens": ["#", "ABC", "9", "5", "1", "B", "/", "Sum", "_of", "_", "Three", "_Int", "egers", "\u010a\u010a\u010a\u010a", "K", ",", "\u0120S", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "0", ",", "\u0120K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(", "0", ",", "\u0120K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120z", "\u0120=", "\u0120S", "\u0120-", "\u0120x", "\u0120-", "\u0120y", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "\u0120<=", "\u0120z", "\u0120and", "\u0120z", "\u0120<=", "\u0120K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02276", "input": "n=int(input())-1\n\nA=list(map(int,input().split()))\n\ni=0\n\nfor j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\nA[i],A[n]=A[n],A[i]\n\nprint((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n", "input_tokens": ["n", "=int", "(input", "())", "-", "1", "\u010a\u010a", "A", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "i", "=", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120if", "\u0120A", "[j", "]<=", "A", "[-", "1", "]:", "A", "[i", "],", "A", "[j", "]=", "A", "[j", "],", "A", "[i", "];", "i", "+=", "1", "\u010a\u010a", "A", "[i", "],", "A", "[n", "]=", "A", "[n", "],", "A", "[i", "]\u010a\u010a", "print", "((\"", "\u0120\".", "join", "(map", "(str", ",A", "[:", "i", "]))", "+\"", "\u0120[\"", "+", "str", "(A", "[i", "])+", "\"]", "\u0120\"+\"", "\u0120\".", "join", "(map", "(str", ",A", "[i", "+", "1", ":", "]))", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p02792", "input": "N = int(input())\n\nmem = [[0]*10 for _ in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "mem", "\u0120=", "\u0120[[", "0", "]*", "1", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "1", "0", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(str", "(i", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120int", "(str", "(i", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120mem", "[a", "][", "b", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(str", "(i", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120int", "(str", "(i", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120mem", "[b", "][", "a", "]\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p04012", "input": "w = input()\n\nfor l in w:\n\n\tif w.count(l) % 2 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")", "input_tokens": ["w", "\u0120=", "\u0120input", "()\u010a\u010a", "for", "\u0120l", "\u0120in", "\u0120w", ":\u010a\u010a", "\u0109if", "\u0120w", ".count", "(l", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0109", "\u0109print", "(\"", "No", "\")\u010a\u010a", "\u0109", "\u0109break", "\u010a\u010a", "else", ":\u010a\u010a", "\u0109print", "(\"", "Yes", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p03416", "input": "a, b = list(map(int, input().split()))\n\ntmp=str(a)\n\nc=0\n\nfor i in range(a,b+1):\n\n tmp=str(i)\n\n tmp2=\"\"\n\n for s in range(len(tmp)):\n\n tmp2=tmp2+tmp[len(tmp)-1-s]\n\n if tmp==tmp2:\n\n c=c+1\n\nprint(c)", "input_tokens": ["a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "tmp", "=str", "(a", ")\u010a\u010a", "c", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "=str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "2", "=\"", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120s", "\u0120in", "\u0120range", "(len", "(tmp", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "2", "=tmp", "2", "+", "tmp", "[len", "(tmp", ")-", "1", "-s", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "==", "tmp", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "=c", "+", "1", "\u010a\u010a", "print", "(c", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p03835", "input": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n z=s-i-j\n\n if 0<=z<=k:\n\n ans+=1\n\nprint(ans)\n", "input_tokens": ["k", ",s", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120z", "=s", "-i", "-j", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "<=", "z", "<=", "k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p03078", "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return map(int, input().split())\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nAB = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tAB.append(A[i]+B[j])\n\n\n\nAB.sort(reverse = True)\n\nAB = AB[:3000]\n\nABC = sorted([C[0]+AB[i] for i in range(min(3000, X*Y))], reverse = True)\n\n\n\nfor j in range(1, Z):\n\n\tABC_tmp = sorted([C[j]+AB[i] for i in range(min(3000, X*Y))])\n\n\tABC += ABC_tmp\n\n\tABC.sort(reverse = True)\n\n\tABC = ABC[:3000]\n\n\n\nprint(*ABC[:K], sep= \"\\n\")\n\n\n", "input_tokens": ["import", "\u0120sys", ",", "\u0120re", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", ",", "\u0120defaultdict", ",", "\u0120Counter", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120ceil", ",", "\u0120sqrt", ",", "\u0120hyp", "ot", ",", "\u0120factorial", ",", "\u0120pi", ",", "\u0120sin", ",", "\u0120cos", ",", "\u0120tan", ",", "\u0120as", "in", ",", "\u0120acos", ",", "\u0120atan", ",", "\u0120radians", ",", "\u0120degrees", ",", "\u0120log", "2", ",", "\u0120gcd", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120accumulate", ",", "\u0120permutations", ",", "\u0120combinations", ",", "\u0120combinations", "_with", "_re", "placement", ",", "\u0120product", ",", "\u0120group", "by", "\u010a\u010a", "from", "\u0120operator", "\u0120import", "\u0120item", "getter", ",", "\u0120mul", "\u010a\u010a", "from", "\u0120copy", "\u0120import", "\u0120deepcopy", "\u010a\u010a", "from", "\u0120string", "\u0120import", "\u0120ascii", "_lowercase", ",", "\u0120ascii", "_upper", "case", ",", "\u0120digits", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", ",", "\u0120bis", "ect", "_left", ",", "\u0120ins", "ort", ",", "\u0120ins", "ort", "_left", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120reduce", ",", "\u0120l", "ru", "_cache", "\u010a\u010a", "def", "\u0120input", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a", "def", "\u0120INT", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120MAP", "():", "\u0120return", "\u0120map", "(int", ",", "\u0120input", "().", "split", "())\u010a\u010a", "def", "\u0120LIST", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120T", "UPLE", "():", "\u0120return", "\u0120tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120ZIP", "(n", "):", "\u0120return", "\u0120zip", "(*(", "MAP", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")))\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u0120\u010a\u010a", "#", "mod", "\u0120=", "\u0120", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "from", "\u0120decimal", "\u0120import", "\u0120*\u010a\u010a", "#import", "\u0120numpy", "\u0120as", "\u0120np", "\u010a\u010a", "#", "decimal", ".get", "context", "().", "prec", "\u0120=", "\u0120", "1", "0", "\u010a\u010a\u010a\u010a", "X", ",", "\u0120Y", ",", "\u0120Z", ",", "\u0120K", "\u0120=", "\u0120MAP", "()\u010a\u010a", "A", "\u0120=", "\u0120sorted", "(L", "IST", "(),", "\u0120reverse", "\u0120=", "\u0120True", ")\u010a\u010a", "B", "\u0120=", "\u0120sorted", "(L", "IST", "(),", "\u0120reverse", "\u0120=", "\u0120True", ")\u010a\u010a", "C", "\u0120=", "\u0120sorted", "(L", "IST", "(),", "\u0120reverse", "\u0120=", "\u0120True", ")\u010a\u010a\u010a\u010a", "AB", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(X", "):\u010a\u010a", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(Y", "):\u010a\u010a", "\u0109", "\u0109", "AB", ".append", "(A", "[i", "]+", "B", "[j", "])\u010a\u010a", "\u010a\u010a", "AB", ".sort", "(reverse", "\u0120=", "\u0120True", ")\u010a\u010a", "AB", "\u0120=", "\u0120AB", "[:", "3", "0", "0", "0", "]\u010a\u010a", "ABC", "\u0120=", "\u0120sorted", "([", "C", "[", "0", "]+", "AB", "[i", "]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(min", "(", "3", "0", "0", "0", ",", "\u0120X", "*", "Y", "))", "],", "\u0120reverse", "\u0120=", "\u0120True", ")\u010a\u010a\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "\u0120Z", "):\u010a\u010a", "\u0109", "ABC", "_tmp", "\u0120=", "\u0120sorted", "([", "C", "[j", "]+", "AB", "[i", "]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(min", "(", "3", "0", "0", "0", ",", "\u0120X", "*", "Y", "))", "])\u010a\u010a", "\u0109", "ABC", "\u0120+=", "\u0120ABC", "_tmp", "\u010a\u010a", "\u0109", "ABC", ".sort", "(reverse", "\u0120=", "\u0120True", ")\u010a\u010a", "\u0109", "ABC", "\u0120=", "\u0120ABC", "[:", "3", "0", "0", "0", "]\u010a\u010a\u010a\u010a", "print", "(*", "ABC", "[:", "K", "],", "\u0120sep", "=", "\u0120\"\\", "n", "\")\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p00744", "input": "import collections\n\nimport math\n\n\n\n\n\nclass Dinic:\n\n \"\"\"Dinic Algorithm: find max-flow\n\n complexity: O(EV^2)\n\n used in GRL6A(AOJ)\n\n \"\"\"\n\n class edge:\n\n def __init__(self, to, cap, rev):\n\n self.to, self.cap, self.rev = to, cap, rev\n\n\n\n def __init__(self, V, E, source, sink):\n\n \"\"\" V: the number of vertexes\n\n E: adjacency list\n\n source: start point\n\n sink: goal point\n\n \"\"\"\n\n self.V = V\n\n self.E = [[] for _ in range(V)]\n\n for fr in range(V):\n\n for to, cap in E[fr]:\n\n self.E[fr].append(self.edge(to, cap, len(self.E[to])))\n\n self.E[to].append(self.edge(fr, 0, len(self.E[fr])-1))\n\n self.maxflow = self.dinic(source, sink)\n\n\n\n def dinic(self, source, sink):\n\n \"\"\"find max-flow\"\"\"\n\n INF = float('inf')\n\n maxflow = 0\n\n while True:\n\n self.bfs(source)\n\n if self.level[sink] < 0:\n\n return maxflow\n\n self.itr = [0] * self.V\n\n while True:\n\n flow = self.dfs(source, sink, INF)\n\n if flow > 0:\n\n maxflow += flow\n\n else:\n\n break\n\n\n\n def dfs(self, vertex, sink, flow):\n\n \"\"\"find augmenting path\"\"\"\n\n if vertex == sink:\n\n return flow\n\n for i in range(self.itr[vertex], len(self.E[vertex])):\n\n self.itr[vertex] = i\n\n e = self.E[vertex][i]\n\n if e.cap > 0 and self.level[vertex] < self.level[e.to]:\n\n d = self.dfs(e.to, sink, min(flow, e.cap))\n\n if d > 0:\n\n e.cap -= d\n\n self.E[e.to][e.rev].cap += d\n\n return d\n\n return 0\n\n\n\n def bfs(self, start):\n\n \"\"\"find shortest path from start\"\"\"\n\n que = collections.deque()\n\n self.level = [-1] * self.V\n\n que.append(start)\n\n self.level[start] = 0\n\n\n\n while que:\n\n fr = que.popleft()\n\n for e in self.E[fr]:\n\n if e.cap > 0 and self.level[e.to] < 0:\n\n self.level[e.to] = self.level[fr] + 1\n\n que.append(e.to)\n\n\n\nwhile True:\n\n M, N = list(map(int, input().split()))\n\n if M == 0 and N == 0:\n\n break\n\n blue, red = [], []\n\n while True:\n\n for x in input().split():\n\n blue.append(int(x))\n\n if len(blue) == M:\n\n break\n\n while True:\n\n for x in input().split():\n\n red.append(int(x))\n\n if len(red) == N:\n\n break\n\n V = M + N + 2\n\n edge = [set() for _ in range(V)]\n\n for i, b in enumerate(blue):\n\n if b != 1:\n\n for j, r in enumerate(red):\n\n if r % b == 0:\n\n edge[i].add((M+j, 1))\n\n for j in range(2, int(math.sqrt(b)) + 1):\n\n if b % j == 0:\n\n for k, r in enumerate(red):\n\n if r % j == 0 or r % (b // j) == 0:\n\n edge[i].add((M+k, 1))\n\n for i in range(M):\n\n edge[M+N].add((i, 1))\n\n for j in range(N):\n\n edge[M+j].add((M+N+1, 1))\n\n d = Dinic(V, edge, M+N, M+N+1)\n\n print((d.maxflow))", "input_tokens": ["import", "\u0120collections", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a\u010a\u010a\u010a\u010a", "class", "\u0120Din", "ic", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"", "D", "inic", "\u0120Algorithm", ":", "\u0120find", "\u0120max", "-flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120complexity", ":", "\u0120O", "(E", "V", "^", "2", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120used", "\u0120in", "\u0120G", "RL", "6", "A", "(A", "O", "J", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120class", "\u0120edge", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120to", ",", "\u0120cap", ",", "\u0120rev", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".to", ",", "\u0120self", ".cap", ",", "\u0120self", ".rev", "\u0120=", "\u0120to", ",", "\u0120cap", ",", "\u0120rev", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120V", ",", "\u0120E", ",", "\u0120source", ",", "\u0120sink", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"", "\u0120V", ":", "\u0120the", "\u0120number", "\u0120of", "\u0120vertex", "es", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120E", ":", "\u0120adjacency", "\u0120list", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120source", ":", "\u0120start", "\u0120point", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sink", ":", "\u0120goal", "\u0120point", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".V", "\u0120=", "\u0120V", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".E", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(V", ")]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120fr", "\u0120in", "\u0120range", "(V", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120to", ",", "\u0120cap", "\u0120in", "\u0120E", "[", "fr", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".E", "[", "fr", "].", "append", "(self", ".edge", "(to", ",", "\u0120cap", ",", "\u0120len", "(self", ".E", "[to", "]))", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".E", "[to", "].", "append", "(self", ".edge", "(fr", ",", "\u0120", "0", ",", "\u0120len", "(self", ".E", "[", "fr", "])-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".max", "flow", "\u0120=", "\u0120self", ".d", "inic", "(source", ",", "\u0120sink", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120din", "ic", "(self", ",", "\u0120source", ",", "\u0120sink", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"", "find", "\u0120max", "-flow", "\"\"\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "flow", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".b", "fs", "(source", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120self", ".level", "[s", "ink", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120max", "flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".it", "r", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120self", ".V", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120flow", "\u0120=", "\u0120self", ".d", "fs", "(source", ",", "\u0120sink", ",", "\u0120INF", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120flow", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "flow", "\u0120+=", "\u0120flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120dfs", "(self", ",", "\u0120vertex", ",", "\u0120sink", ",", "\u0120flow", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"", "find", "\u0120augment", "ing", "\u0120path", "\"\"\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120vertex", "\u0120==", "\u0120sink", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(self", ".it", "r", "[vertex", "],", "\u0120len", "(self", ".E", "[vertex", "]))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".it", "r", "[vertex", "]", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120e", "\u0120=", "\u0120self", ".E", "[vertex", "][", "i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120e", ".cap", "\u0120>", "\u0120", "0", "\u0120and", "\u0120self", ".level", "[vertex", "]", "\u0120<", "\u0120self", ".level", "[e", ".to", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120self", ".d", "fs", "(e", ".to", ",", "\u0120sink", ",", "\u0120min", "(flow", ",", "\u0120e", ".cap", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120e", ".cap", "\u0120-=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".E", "[e", ".to", "][", "e", ".rev", "].", "cap", "\u0120+=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120bfs", "(self", ",", "\u0120start", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"", "find", "\u0120shortest", "\u0120path", "\u0120from", "\u0120start", "\"\"\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", "\u0120=", "\u0120collections", ".de", "que", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".level", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120self", ".V", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".append", "(start", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".level", "[start", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120que", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fr", "\u0120=", "\u0120que", ".p", "opleft", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120e", "\u0120in", "\u0120self", ".E", "[", "fr", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120e", ".cap", "\u0120>", "\u0120", "0", "\u0120and", "\u0120self", ".level", "[e", ".to", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".level", "[e", ".to", "]", "\u0120=", "\u0120self", ".level", "[", "fr", "]", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".append", "(e", ".to", ")\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120M", ",", "\u0120N", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120M", "\u0120==", "\u0120", "0", "\u0120and", "\u0120N", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120blue", ",", "\u0120red", "\u0120=", "\u0120[],", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120blue", ".append", "(int", "(x", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(bl", "ue", ")", "\u0120==", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120red", ".append", "(int", "(x", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(red", ")", "\u0120==", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120V", "\u0120=", "\u0120M", "\u0120+", "\u0120N", "\u0120+", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120edge", "\u0120=", "\u0120[", "set", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(V", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120b", "\u0120in", "\u0120enumerate", "(bl", "ue", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120b", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", ",", "\u0120r", "\u0120in", "\u0120enumerate", "(red", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120%", "\u0120b", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120edge", "[i", "].", "add", "((", "M", "+j", ",", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "2", ",", "\u0120int", "(math", ".sqrt", "(b", "))", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120b", "\u0120%", "\u0120j", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", ",", "\u0120r", "\u0120in", "\u0120enumerate", "(red", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120%", "\u0120j", "\u0120==", "\u0120", "0", "\u0120or", "\u0120r", "\u0120%", "\u0120(", "b", "\u0120//", "\u0120j", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120edge", "[i", "].", "add", "((", "M", "+k", ",", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120edge", "[M", "+N", "].", "add", "((", "i", ",", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120edge", "[M", "+j", "].", "add", "((", "M", "+N", "+", "1", ",", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120Din", "ic", "(V", ",", "\u0120edge", ",", "\u0120M", "+N", ",", "\u0120M", "+N", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "d", ".max", "flow", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9838759449748289, 0.9838759449748289, 0.9838759449748289, 0.9838759449748289, 0.9838759449748289, 0.9838759449748289, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9838759449748289, 0.9838759449748289, 0.9838759449748289, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9838759449748289, 0.9838759449748289, 0.9838759449748289, 0.9838759449748289, 0.9838759449748289, 0.5663133600873308, 0.9674876381700903, 0.9674876381700903, 0.5663133600873308, 0.5663133600873308, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9838759449748289, 0.9838759449748289, 0.9838759449748289, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5663133600873308, 0.5663133600873308, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9838759449748289, 0.9838759449748289, 0.9838759449748289, 0.5663133600873308, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.9674876381700903, 0.5663133600873308, 0.9508262735978029, 0.9508262735978029, 0.9508262735978029, 0.9508262735978029, 0.9508262735978029, 0.9508262735978029, 0.9508262735978029, 0.9508262735978029, 0.9508262735978029, 0.9508262735978029, 0.9508262735978029, 0.5663133600873308, 0.9338825976214855, 0.5663133600873308, 0.5663133600873308, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.5663133600873308, 0.916646878091049, 0.916646878091049, 0.916646878091049, 0.5663133600873308, 0.8991088707707996, 0.8991088707707996, 0.8991088707707996, 0.8991088707707996, 0.8991088707707996, 0.8991088707707996, 0.8991088707707996, 0.5663133600873308, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.5663133600873308, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.5663133600873308, 0.8630822326531611, 0.5663133600873308, 0.5663133600873308, 0.8445702068487291, 0.8445702068487291, 0.8445702068487291, 0.5663133600873308, 0.8257090119583357, 0.8257090119583357, 0.8257090119583357, 0.8257090119583357, 0.8257090119583357, 0.8257090119583357, 0.8257090119583357, 0.5663133600873308, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.5663133600873308, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.5663133600873308, 0.7868846233634772, 0.5663133600873308, 0.5663133600873308, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.5663133600873308, 0.5663133600873308, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.5663133600873308, 0.7464918032696057, 0.7464918032696057, 0.7464918032696057, 0.7464918032696057, 0.7464918032696057, 0.7464918032696057, 0.7464918032696057, 0.7464918032696057, 0.7464918032696057, 0.5663133600873308, 0.7256666033195373, 0.7256666033195373, 0.7256666033195373, 0.7256666033195373, 0.7256666033195373, 0.7256666033195373, 0.5663133600873308, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.5663133600873308, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.5663133600873308, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.5663133600873308, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.5663133600873308, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.6604551382398354, 0.5663133600873308, 0.6377374631784705, 0.6377374631784705, 0.6377374631784705, 0.6377374631784705, 0.6377374631784705, 0.6377374631784705, 0.6377374631784705, 0.6377374631784705, 0.5663133600873308, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.6144916746054042, 0.5663133600873308, 0.5906926330383026, 0.5906926330383026, 0.5906926330383026, 0.5906926330383026, 0.5906926330383026, 0.5906926330383026, 0.5906926330383026, 0.5906926330383026, 0.5906926330383026, 0.5906926330383026, 0.5906926330383026, 0.5663133600873308, 0.7256666033195373, 0.7256666033195373, 0.7256666033195373, 0.7256666033195373, 0.7256666033195373, 0.7256666033195373, 0.5663133600873308, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.5663133600873308, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.704398473975408, 0.5663133600873308, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.5663133600873308, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.5663133600873308, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003]} +{"problem_id": "p00174", "input": "while True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n a = b = 0\n\n for i, s in enumerate(line):\n\n if i != 0:\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break", "input_tokens": ["while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120try", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120line", "\u0120=", "\u0120input", "().", "strip", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120line", "\u0120==", "\u0120'", "0", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120raise", "\u0120Exception", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120b", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120s", "\u0120in", "\u0120enumerate", "(line", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120==", "\u0120'", "A", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120>", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(a", ",", "\u0120b", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120except", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break"], "input_token_weights": [0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046]} +{"problem_id": "p03559", "input": "from bisect import *\n\nn = int(input())\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na = sorted(a)\n\nc = sorted(c)\n\n\n\nrec = 0\n\nfor i in range(n):\n\n temp = b[i]\n\n l = bisect_left(a, temp)\n\n r = bisect_right(c, temp)\n\n rec += l * (n - r)\n\nprint(rec)", "input_tokens": ["from", "\u0120bis", "ect", "\u0120import", "\u0120*\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "a", "\u0120=", "\u0120sorted", "(a", ")\u010a\u010a", "c", "\u0120=", "\u0120sorted", "(c", ")\u010a\u010a\u010a\u010a", "rec", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120temp", "\u0120=", "\u0120b", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120bis", "ect", "_left", "(a", ",", "\u0120temp", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120bis", "ect", "_right", "(c", ",", "\u0120temp", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120rec", "\u0120+=", "\u0120l", "\u0120*", "\u0120(", "n", "\u0120-", "\u0120r", ")\u010a\u010a", "print", "(rec", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03592", "input": "N,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n t = i*M + j*N - i*j*2\n\n if t==K:\n\n print('Yes')\n\n exit()\n\nprint('No')", "input_tokens": ["N", ",M", ",K", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(M", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120i", "*M", "\u0120+", "\u0120j", "*N", "\u0120-", "\u0120i", "*j", "*", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "==", "K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "print", "('", "No", "')"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p00542", "input": "a,b,c,d,e,f=[int(input()) for _ in range(6)]\n\nprint((sum([a,b,c,d,max(e,f)])-min([a,b,c,d])))", "input_tokens": ["a", ",b", ",c", ",d", ",e", ",f", "=[", "int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "6", ")]\u010a\u010a", "print", "((", "sum", "([", "a", ",b", ",c", ",d", ",max", "(e", ",f", ")])", "-", "min", "([", "a", ",b", ",c", ",d", "])))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03371", "input": "# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z / 2), 0)\n\n y = max(Y - int(z / 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n", "input_tokens": ["#", "\u0120At", "Coder", "\u0120Beginner", "\u0120Contest", "\u0120", "0", "9", "5", "\u0120C", "\u0120-", "\u0120Half", "\u0120and", "\u0120Half", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a\u010a\u010a", "A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "strip", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120A", "\u0120*", "\u0120X", "\u0120+", "\u0120B", "\u0120*", "\u0120Y", "\u010a\u010a", "for", "\u0120z", "\u0120in", "\u0120range", "(", "2", ",", "\u0120", "2", "\u0120*", "\u0120", "1", "0", "\u0120**", "\u0120", "5", "\u0120+", "\u0120", "1", ",", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120max", "(X", "\u0120-", "\u0120int", "(z", "\u0120/", "\u0120", "2", "),", "\u0120", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "\u0120=", "\u0120max", "(Y", "\u0120-", "\u0120int", "(z", "\u0120/", "\u0120", "2", "),", "\u0120", "0", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120price", "\u0120=", "\u0120A", "\u0120*", "\u0120x", "\u0120+", "\u0120B", "\u0120*", "\u0120y", "\u0120+", "\u0120C", "\u0120*", "\u0120z", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(price", ",", "\u0120ans", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02773", "input": "from collections import defaultdict\n\nN = int(input())\n\nd = defaultdict(int)\n\n\n\nfor i in range(N):\n\n S = input()\n\n d[S] += 1\n\n\n\nm = 0\n\nfor k in list(d.keys()):\n\n m = max(d[k],m)\n\n\n\nli = []\n\nfor k in list(d.keys()):\n\n if d[k] == m:\n\n li.append(k)\n\n\n\nli.sort()\n\nfor l in li:\n\n print(l)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[S", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "m", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120list", "(d", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120max", "(d", "[k", "],", "m", ")\u010a\u010a\u010a\u010a", "li", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120list", "(d", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120d", "[k", "]", "\u0120==", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120li", ".append", "(k", ")\u010a\u010a\u010a\u010a", "li", ".sort", "()\u010a\u010a", "for", "\u0120l", "\u0120in", "\u0120li", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(l", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p03037", "input": "N,M = list(map(int,input().split()))\n\nL,R = [],[]\n\nfor i in range(M):\n\n l,r = list(map(int,input().split()))\n\n L.append(l)\n\n R.append(r)\n\nans = min(R)-max(L)+1\n\nprint((ans if ans >= 0 else 0))", "input_tokens": ["N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "L", ",R", "\u0120=", "\u0120[],", "[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ",r", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", ".append", "(l", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", ".append", "(r", ")\u010a\u010a", "ans", "\u0120=", "\u0120min", "(R", ")-", "max", "(L", ")+", "1", "\u010a\u010a", "print", "((", "ans", "\u0120if", "\u0120ans", "\u0120>=", "\u0120", "0", "\u0120else", "\u0120", "0", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02881", "input": "n = int(input())\n\nl = []\n\nfor i in range(1,1000001):\n\n a = n / i\n\n if a.is_integer():\n\n l.append(i+n/i)\n\nprint((int(min(l)-2)))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "l", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "1", "0", "0", "0", "0", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120n", "\u0120/", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", ".is", "_integer", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", ".append", "(i", "+n", "/i", ")\u010a\u010a", "print", "((", "int", "(min", "(l", ")-", "2", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02881", "input": "n = int(input())\n\nimport math\n\nm = int(math.sqrt(n))+1\n\nanss = []\n\nfor x in range(1, m+1):\n\n y = n//x\n\n z = n%x\n\n if z == 0:\n\n anss.append(abs(x-1)+abs(y-1))\n\nprint((min(anss)))\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "m", "\u0120=", "\u0120int", "(math", ".sqrt", "(n", "))+", "1", "\u010a\u010a", "ans", "s", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "1", ",", "\u0120m", "+", "1", "):\u010a\u010a", "\u0120", "\u0120y", "\u0120=", "\u0120n", "//", "x", "\u010a\u010a", "\u0120", "\u0120z", "\u0120=", "\u0120n", "%x", "\u010a\u010a", "\u0120", "\u0120if", "\u0120z", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120an", "ss", ".append", "(abs", "(x", "-", "1", ")+", "abs", "(y", "-", "1", "))\u010a\u010a", "print", "((", "min", "(ans", "s", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03455", "input": "a, b = list(map(int, input().split()))\n\nif a*b%2 == 1:\n\n print(\"Odd\")\n\nelse:\n\n print(\"Even\")", "input_tokens": ["a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "if", "\u0120a", "*b", "%", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Odd", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Even", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02555", "input": "n = int(input())\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n for j in range(i - 2):\n\n ans[i] += ans[j]\n\n ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "m", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "#", "\u0120ans", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "ans", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120", "2", "2", "0", "0", "\u010a\u010a", "ans", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "#", "\u0120ans", "[", "3", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "#", "\u0120ans", "[", "4", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "#", "\u0120ans", "[", "5", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "\u0120-", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "[i", "]", "\u0120+=", "\u0120ans", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "[i", "]", "\u0120%=", "\u0120m", "\u010a\u010a", "print", "((", "ans", "[n", "]))\u010a\u010a", "#", "\u0120print", "(ans", "[:", "1", "0", "])\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p04021", "input": "import sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(input())\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n if (L[i][1]-i)%2:\n\n count += 1\n\nans = (count+1) // 2\n\nprint(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".read", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120read", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120sorted", "([(", "j", ",", "\u0120i", ")", "\u0120for", "\u0120i", ",", "\u0120j", "\u0120in", "\u0120enumerate", "(A", ")])\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120(", "L", "[i", "][", "1", "]-", "i", ")%", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120(", "count", "+", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p02378", "input": "# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if unvisited[v] and (r_capacity > 0):\n\n parent[v].append(u)\n\n queue.append(v)\n\n unvisited[v] = False\n\n return unvisited[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while not bfs(source, sink, parent):\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))", "input_tokens": ["#", "\u0120Accept", "ance", "\u0120of", "\u0120input", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", "\u010a\u010a\u010a\u010a", "file", "_input", "\u0120=", "\u0120sys", ".stdin", "\u010a\u010a\u010a\u010a", "X", ",", "\u0120Y", ",", "\u0120E", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120file", "_input", ".readline", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "v", "_num", "\u0120=", "\u0120X", "\u0120+", "\u0120Y", "\u0120+", "\u0120", "2", "\u010a\u010a\u010a\u010a", "adj", "_mat", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120(", "v", "_num", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(v", "_num", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120line", "\u0120in", "\u0120file", "_input", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120line", ".split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120adj", "_mat", "[x", "][", "X", "\u0120+", "\u0120y", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120X", "\u0120+", "\u0120Y", "\u010a\u010a", "t", "\u0120=", "\u0120s", "\u0120+", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(X", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120adj", "_mat", "[s", "][", "i", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(X", ",", "\u0120s", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120adj", "_mat", "[i", "][", "t", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "#", "\u0120Din", "ic", "'s", "\u0120algorithm", "\u010a\u010a\u010a\u010a", "import", "\u0120collections", "\u010a\u010a\u010a\u010a", "#", "\u0120BFS", "\u0120for", "\u0120residual", "\u0120capacity", "\u0120network", "\u0120to", "\u0120construct", "\u0120level", "\u0120graph", "\u010a\u010a", "def", "\u0120bfs", "(start", ",", "\u0120goal", ",", "\u0120parent", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120un", "visited", "\u0120=", "\u0120[", "True", "]", "\u0120*", "\u0120v", "_num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120queue", "\u0120=", "\u0120collections", ".de", "que", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120queue", ".append", "(start", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120un", "visited", "[start", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120queue", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120u", "\u0120=", "\u0120queue", ".p", "opleft", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", ",", "\u0120r", "_capacity", "\u0120in", "\u0120enumerate", "(adj", "_mat", "[u", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120un", "visited", "[v", "]", "\u0120and", "\u0120(", "r", "_capacity", "\u0120>", "\u0120", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120parent", "[v", "].", "append", "(u", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120queue", ".append", "(v", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120un", "visited", "[v", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120un", "visited", "[", "goal", "]\u010a\u010a\u010a\u010a", "#", "\u0120DFS", "\u0120for", "\u0120level", "\u0120graph", "\u0120and", "\u0120construct", "\u0120blocking", "\u0120flow", "\u010a\u010a", "def", "\u0120dfs", "(goal", ",", "\u0120path", ",", "\u0120parent", ",", "\u0120blocking", "_flow", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120path", "[-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120v", "\u0120==", "\u0120goal", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120aug", "_path", "_flow", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", ",", "\u0120y", "\u0120in", "\u0120zip", "(path", "[", "1", ":],", "\u0120path", "[:-", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120aug", "_path", "_flow", "\u0120=", "\u0120min", "(a", "ug", "_path", "_flow", ",", "\u0120adj", "_mat", "[x", "][", "y", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", ",", "\u0120y", "\u0120in", "\u0120zip", "(path", "[", "1", ":],", "\u0120path", "[:-", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120adj", "_mat", "[x", "][", "y", "]", "\u0120-=", "\u0120aug", "_path", "_flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120adj", "_mat", "[y", "][", "x", "]", "\u0120+=", "\u0120aug", "_path", "_flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120blocking", "_flow", "[", "0", "]", "\u0120+=", "\u0120aug", "_path", "_flow", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120u", "\u0120in", "\u0120parent", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120path", ".append", "(u", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dfs", "(goal", ",", "\u0120path", ",", "\u0120parent", ",", "\u0120blocking", "_flow", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120path", ".pop", "()\u010a\u010a\u010a\u010a", "def", "\u0120din", "ic", "(source", ",", "\u0120sink", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "_flow", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120parent", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(v", "_num", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120not", "\u0120bfs", "(source", ",", "\u0120sink", ",", "\u0120parent", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120blocking", "_flow", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120path", "\u0120=", "\u0120[", "sink", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120search", "\u0120in", "\u0120reverse", "\u0120direction", "\u0120from", "\u0120sink", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dfs", "(source", ",", "\u0120path", ",", "\u0120parent", ",", "\u0120blocking", "_flow", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_flow", "\u0120+=", "\u0120blocking", "_flow", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120parent", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(v", "_num", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120max", "_flow", "\u010a\u010a\u010a\u010a", "#", "\u0120output", "\u010a\u010a", "print", "((", "din", "ic", "(s", ",", "\u0120t", ")))"], "input_token_weights": [0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p02837", "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom math import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\nfrom decimal import Decimal\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\nfrom decimal import *\n\n\n\nN = INT()\n\nxy = []\n\n\n\nfor i in range(N):\n\n\tA = INT()\n\n\txy.append([LIST() for _ in range(A)])\n\n\n\nans = 0\n\nfor i in range(1<= K - 1:\n\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\n\n \n\nprint(ans)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120K", ",", "\u0120*", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "\u0120+", "\u0120", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "[i", "\u0120+", "\u0120", "1", "]", "\u0120=", "\u0120S", "[i", "]", "\u0120+", "\u0120A", "[i", "]\u010a\u010a\u010a\u010a", "d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(N", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120(", "S", "[j", "]", "\u0120-", "\u0120j", ")", "\u0120%", "\u0120K", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120d", "[v", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[v", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120>=", "\u0120K", "\u0120-", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[(", "S", "[j", "\u0120-", "\u0120K", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120(", "j", "\u0120-", "\u0120K", "\u0120+", "\u0120", "1", "))", "\u0120%", "\u0120K", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02767", "input": "n=int(input())\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\nfor p in range(x[0],x[len(x)-1]+1):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\n pmin=psum \n\n for j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) ", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "x", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "x", ".sort", "()\u010a\u010a\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120range", "(x", "[", "0", "],", "x", "[len", "(x", ")-", "1", "]+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "sum", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(x", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "sum", "=p", "sum", "+(", "x", "[", "0", "]-", "x", "[i", "])**", "2", "\u010a\u010a", "#", "\u0120\u0120\u0120", "\u0120print", "(p", "sum", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "min", "=p", "sum", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(x", "[", "0", "]+", "1", ",x", "[len", "(x", ")-", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "sum", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(x", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "sum", "=p", "sum", "+(", "j", "-x", "[i", "])**", "2", "\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(p", "sum", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120p", "min", ">p", "sum", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "min", "=p", "sum", "\u010a\u010a", "print", "(p", "min", ")", "\u0120\u0120\u0120\u0120"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679]} +{"problem_id": "p03086", "input": "import re\n\n\n\nS = input()\n\nmax = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i + 1, len(S) + 1) :\n\n pattern = re.compile(r'[A|T|C|G]{%d}' % int(j - i))\n\n subStr = S[i:j]\n\n\n\n if pattern.match(subStr) and j - i > max :\n\n max = j - i\n\n\n\nprint(max)\n", "input_tokens": ["import", "\u0120re", "\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a", "max", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", "\u0120:\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "\u0120+", "\u0120", "1", ",", "\u0120len", "(S", ")", "\u0120+", "\u0120", "1", ")", "\u0120:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pattern", "\u0120=", "\u0120re", ".compile", "(r", "'[", "A", "|", "T", "|", "C", "|", "G", "]{", "%", "d", "}'", "\u0120%", "\u0120int", "(j", "\u0120-", "\u0120i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sub", "Str", "\u0120=", "\u0120S", "[i", ":j", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120pattern", ".match", "(sub", "Str", ")", "\u0120and", "\u0120j", "\u0120-", "\u0120i", "\u0120>", "\u0120max", "\u0120:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "\u0120=", "\u0120j", "\u0120-", "\u0120i", "\u010a\u010a\u010a\u010a", "print", "(max", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02792", "input": "import itertools\n\nN = int(input())\n\nNketa = len(str(N))\n\n\n\nrange_count = [[0 for j in range(10)]for i in range(10)]\n\n\n\n\n\nfor p in range(1,N+1):\n\n mae = int(str(p)[0])\n\n ato = int(str(p)[-1])\n\n range_count[mae][ato] += 1\n\n\n\n \n\n\n\ncount = 0\n\nfor j in range(1,N+1):\n\n a_mae = int(str(j)[0])\n\n a_ato = int(str(j)[-1])\n\n \n\n b_mae = a_ato\n\n b_ato = a_mae\n\n \n\n if b_mae == 0:\n\n continue\n\n else:\n\n count += range_count[b_mae][b_ato]\n\nprint(count)\n\n ", "input_tokens": ["import", "\u0120itertools", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "N", "k", "eta", "\u0120=", "\u0120len", "(str", "(N", "))", "\u010a\u010a\u010a\u010a", "range", "_count", "\u0120=", "\u0120[[", "0", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "0", ")]", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", ")]", "\u010a\u010a\u010a\u010a\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "ae", "\u0120=", "\u0120int", "(str", "(p", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120at", "o", "\u0120=", "\u0120int", "(str", "(p", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120range", "_count", "[", "ma", "e", "][", "ato", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_m", "ae", "\u0120=", "\u0120int", "(str", "(j", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_at", "o", "\u0120=", "\u0120int", "(str", "(j", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_m", "ae", "\u0120=", "\u0120a", "_at", "o", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_at", "o", "\u0120=", "\u0120a", "_m", "ae", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120b", "_m", "ae", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120range", "_count", "[b", "_m", "ae", "][", "b", "_at", "o", "]\u010a\u010a", "print", "(count", ")\u010a\u010a", "\u0120\u0120"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139]} +{"problem_id": "p02921", "input": "s=input()\n\nt=input()\n\nans=0\n\nif s[0]==t[0]:\n\n ans+=1\n\nif s[1]==t[1]:\n\n ans+=1\n\nif s[2]==t[2]:\n\n ans+=1\n\nprint(ans)\n", "input_tokens": ["s", "=input", "()\u010a\u010a", "t", "=input", "()\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "if", "\u0120s", "[", "0", "]==", "t", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "if", "\u0120s", "[", "1", "]==", "t", "[", "1", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "if", "\u0120s", "[", "2", "]==", "t", "[", "2", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p03835", "input": "k,s=list(map(int,input().split()))\n\ncnt=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0 <= s-i-j <= k:\n\n cnt+=1\n\nprint(cnt)", "input_tokens": ["k", ",s", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "cnt", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "\u0120<=", "\u0120s", "-i", "-j", "\u0120<=", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "+=", "1", "\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03806", "input": "N,Ma,Mb = list(map(int, input().split()))\n\narr=[list(map(int,input().split())) for _ in range(N)]\n\ndp=[[[5000]*401 for _ in range(401)] for _ in range(41)]\n\ndp[0][0][0] = 0\n\nfor i in range(N):\n\n a,b,c=arr[i]\n\n for j in range(10*N+1):\n\n for k in range(10*N+1):\n\n if dp[i][j][k] == 5000:\n\n continue\n\n dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k])\n\n dp[i+1][j+a][k+b]=min(dp[i+1][j+a][k+b],dp[i][j][k]+c)\n\n\n\nans=5000\n\nfor i in range(1,401):\n\n if i*Ma>400 or i*Mb>400:\n\n break\n\n ans = min(ans, dp[N][i*Ma][i*Mb])\n\nif ans == 5000:\n\n print((-1))\n\nelse:\n\n print(ans)", "input_tokens": ["N", ",M", "a", ",M", "b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "arr", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "dp", "=[", "[[", "5", "0", "0", "0", "]*", "4", "0", "1", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "4", "0", "1", ")]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "4", "1", ")]\u010a\u010a", "dp", "[", "0", "][", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "=", "arr", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "0", "*N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "1", "0", "*N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "][", "j", "][", "k", "]", "\u0120==", "\u0120", "5", "0", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "][", "k", "]=", "min", "(dp", "[i", "+", "1", "][", "j", "][", "k", "],", "dp", "[i", "][", "j", "][", "k", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "+a", "][", "k", "+b", "]=", "min", "(dp", "[i", "+", "1", "][", "j", "+a", "][", "k", "+b", "],", "dp", "[i", "][", "j", "][", "k", "]+", "c", ")\u010a\u010a\u010a\u010a", "ans", "=", "5", "0", "0", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "4", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "*", "Ma", ">", "4", "0", "0", "\u0120or", "\u0120i", "*M", "b", ">", "4", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120dp", "[N", "][", "i", "*", "Ma", "][", "i", "*M", "b", "])\u010a\u010a", "if", "\u0120ans", "\u0120==", "\u0120", "5", "0", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p02814", "input": "from math import gcd\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a // 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x // pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b//gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M // x + 1) // 2))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "([", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()", "])\u010a\u010a", "\u010a\u010a", "cnt", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120a", "\u0120=", "\u0120A", "[i", "]\u010a\u010a", "\u0120", "\u0120while", "\u0120a", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120a", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "[i", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "if", "\u0120max", "(cnt", ")", "\u0120>", "\u0120min", "(cnt", "):\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "C", "\u0120=", "\u0120max", "(cnt", ")\u010a\u010a\u010a\u010a", "A", "\u0120=", "\u0120list", "([", "x", "\u0120//", "\u0120pow", "(", "2", ",C", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120A", "])\u010a\u010a", "def", "\u0120gcd", "(a", ",b", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120a", "", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120b", ",a", "%", "b", "\u010a\u010a", "\u0120", "\u0120return", "\u0120b", "\u010a\u010a\u010a\u010a", "def", "\u0120lcm", "(a", ",b", "):\u010a\u010a", "\u0120", "\u0120return", "\u0120a", "*b", "//", "gcd", "(a", ",b", ")\u010a\u010a\u010a\u010a", "x", "\u0120=", "\u0120A", "[", "0", "]\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120A", "[", "1", ":]", ":\u010a\u010a", "\u0120", "\u0120x", "\u0120=", "\u0120lcm", "(x", ",a", ")\u010a\u010a", "x", "\u0120=", "\u0120x", "\u0120*", "\u0120pow", "(", "2", ",C", "-", "1", ")\u010a\u010a\u010a\u010a", "print", "(((", "M", "\u0120//", "\u0120x", "\u0120+", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03038", "input": "from heapq import *\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nPAIRS = [[-a, -1] for a in map(int, input().split())]\n\nheapify(PAIRS)\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(PAIRS, [-c, -b])\n\n\n\nanswer = 0\n\nfor _ in range(n):\n\n pair = heappop(PAIRS)\n\n answer += -pair[0]\n\n pair[1] += 1\n\n if pair[1] != 0:\n\n heappush(PAIRS, pair)\n\n\n\nprint(answer)\n", "input_tokens": ["from", "\u0120heapq", "\u0120import", "\u0120*", "\u010a\u010a\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "PAIR", "S", "\u0120=", "\u0120[[", "-", "a", ",", "\u0120-", "1", "]", "\u0120for", "\u0120a", "\u0120in", "\u0120map", "(int", ",", "\u0120input", "().", "split", "())", "]\u010a\u010a", "heap", "ify", "(P", "AIR", "S", ")\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120he", "app", "ush", "(P", "AIR", "S", ",", "\u0120[-", "c", ",", "\u0120-", "b", "])\u010a\u010a", "\u010a\u010a", "answer", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120pair", "\u0120=", "\u0120he", "app", "op", "(P", "AIR", "S", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120answer", "\u0120+=", "\u0120-", "pair", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120pair", "[", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120pair", "[", "1", "]", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120he", "app", "ush", "(P", "AIR", "S", ",", "\u0120pair", ")\u010a\u010a\u010a\u010a", "print", "(answer", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03796", "input": "import math\n\n\n\nn = int(input())\n\nans = math.factorial(n) % (pow(10, 9) + 7)\n\nprint(ans)", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120math", ".factor", "ial", "(n", ")", "\u0120%", "\u0120(", "pow", "(", "1", "0", ",", "\u0120", "9", ")", "\u0120+", "\u0120", "7", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02596", "input": "k = int(input())\n\nx = 1\n\n\n\nif k%7 != 0:\n\n mod = 9*k\n\nelse:\n\n mod = 9*k//7\n\n\n\nfor i in range(10**6):\n\n x = x*10%mod\n\n if x == 1:\n\n print((i + 1))\n\n exit()\n\n\n\nprint((-1))", "input_tokens": ["k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "x", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "if", "\u0120k", "%", "7", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "9", "*k", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "9", "*k", "//", "7", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "**", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120x", "*", "1", "0", "%", "mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "i", "\u0120+", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "print", "((-", "1", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03200", "input": "s = input()\n\n\n\ncnt = 0\n\nans = 0\n\nfor c in s:\n\n if c == 'B':\n\n cnt += 1\n\n elif c == 'W':\n\n ans += cnt\n\nprint(ans)\n", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120c", "\u0120in", "\u0120s", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120c", "\u0120==", "\u0120'", "B", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120c", "\u0120==", "\u0120'", "W", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cnt", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p00053", "input": "import math\n\ndef pri(n):\n\n if n < 2:\n\n return False\n\n elif n == 2:\n\n return True\n\n elif n % 2 == 0:\n\n return False\n\n\n\n i = 3\n\n while i <= math.sqrt(n):\n\n if n % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nl=[i for i in range(110000)if pri(i) ]\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0: break\n\n print((sum(l[:n])))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "def", "\u0120pri", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120<", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120n", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120n", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120<=", "\u0120math", ".sqrt", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a\u010a\u010a", "l", "=[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "1", "0", "0", "0", "0", ")", "if", "\u0120pri", "(i", ")", "\u0120]", "\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "sum", "(l", "[:", "n", "])))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02988", "input": "n = int(input())\n\nl = list(map(int, input().split()))\n\nprint((sum(l[i]l[i+1]>l[i+2] for i in range(n-2))))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "l", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "print", "((", "sum", "(l", "[i", "]<", "l", "[i", "+", "1", "]<", "l", "[i", "+", "2", "]", "\u0120or", "\u0120l", "[i", "]>", "l", "[i", "+", "1", "]>", "l", "[i", "+", "2", "]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "2", "))))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03363", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\n\n\nans, s = 0, 0\n\nd = {0:1}\n\n\n\nfor i in A:\n\n s += i\n\n ans += d.get(s, 0)\n\n d[s] = d.get(s, 0) + 1\n\n\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", ",", "\u0120s", "\u0120=", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "d", "\u0120=", "\u0120{", "0", ":", "1", "}\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120+=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120d", ".get", "(s", ",", "\u0120", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[s", "]", "\u0120=", "\u0120d", ".get", "(s", ",", "\u0120", "0", ")", "\u0120+", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03162", "input": "import numpy as np\n\nn=int(input())\n\nABC=[list(map(int,input().split())) for _ in range(n)]\n\n\n\ndp=np.zeros((n,3),int)\n\nfor i in range(3):\n\n dp[0][i]=ABC[0][i]\n\nfor i in range(n-1):\n\n for j in range(3):\n\n dp[i+1][j]=max(dp[i][(j+1)%3]+ABC[i+1][j], dp[i][(j+2)%3]+ABC[i+1][j])\n\nprint((max(dp[-1])))", "input_tokens": ["import", "\u0120numpy", "\u0120as", "\u0120np", "\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "ABC", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "dp", "=np", ".zeros", "((", "n", ",", "3", "),", "int", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120", "\u0120dp", "[", "0", "][", "i", "]=", "ABC", "[", "0", "][", "i", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "]=", "max", "(dp", "[i", "][(", "j", "+", "1", ")%", "3", "]+", "ABC", "[i", "+", "1", "][", "j", "],", "\u0120dp", "[i", "][(", "j", "+", "2", ")%", "3", "]+", "ABC", "[i", "+", "1", "][", "j", "])\u010a\u010a", "print", "((", "max", "(dp", "[-", "1", "])))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03162", "input": "N = int(input())\n\nl = [list(map(int, input().split())) for _ in range(N)]\n\n\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\n\n\nfor i in range(1, N+1):\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k]+l[i-1][k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n\n\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "l", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ")]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(N", "+", "1", ")]", "\u010a\u010a\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120!=", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "j", "]", "\u0120=", "\u0120max", "(dp", "[i", "][", "j", "],", "\u0120dp", "[i", "-", "1", "][", "k", "]+", "l", "[i", "-", "1", "][", "k", "])\u010a\u010a", "\u010a\u010a", "print", "((", "max", "(dp", "[N", "][", "0", "],", "\u0120dp", "[N", "][", "1", "],", "\u0120dp", "[N", "][", "2", "]))", ")\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02899", "input": "import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(input())\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n for i in range(len(l)):\n\n if i != len(l)-1:\n\n print(\"{} \".format(l[i]), end='')\n\n else:\n\n print(l[i])\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120o", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[o", "[i", "]-", "1", "]", "\u0120=", "\u0120i", "+", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(l", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "\u0120i", "\u0120!=", "\u0120len", "(l", ")-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"{}", "\u0120\".", "format", "(l", "[i", "]),", "\u0120end", "='", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(l", "[i", "])\u010a\u010a", "\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02994", "input": "N,L = list(map(int, input().split()))\n\ntaste = [L+i-1 for i in range(1,N+1)]\n\nif taste[-1] < 0:\n\n print((sum(taste) + min([abs(x) for x in taste])))\n\nelse:\n\n print((sum(taste) - min([abs(x) for x in taste])))", "input_tokens": ["N", ",L", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "t", "aste", "\u0120=", "\u0120[", "L", "+i", "-", "1", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", ")]\u010a\u010a", "if", "\u0120taste", "[-", "1", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120", "\u0120print", "((", "sum", "(t", "aste", ")", "\u0120+", "\u0120min", "([", "abs", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120taste", "]))", ")\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "((", "sum", "(t", "aste", ")", "\u0120-", "\u0120min", "([", "abs", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120taste", "])))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03416", "input": "# ABC090B - Palindromic Numbers\n\na, b = list(map(int, input().rstrip().split()))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n lst = list(map(int, list(str(i))))\n\n if lst[0] == lst[4] and lst[1] == lst[3]:\n\n count += 1\n\nprint(count)", "input_tokens": ["#", "\u0120ABC", "0", "9", "0", "B", "\u0120-", "\u0120Pal", "ind", "rom", "ic", "\u0120Numbers", "\u010a\u010a", "a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "().", "split", "()))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120lst", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120list", "(str", "(i", "))))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120lst", "[", "0", "]", "\u0120==", "\u0120lst", "[", "4", "]", "\u0120and", "\u0120lst", "[", "1", "]", "\u0120==", "\u0120lst", "[", "3", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03720", "input": "n, m = list(map(int, input().split()))\n\ndp = [0] * n\n\nfor i in range(m):\n\n x, y = list(map(int, input().split()))\n\n dp[x - 1] += 1\n\n dp[y - 1] += 1\n\nfor i in range(n):\n\n print((dp[i]))", "input_tokens": ["n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120n", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[x", "\u0120-", "\u0120", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[y", "\u0120-", "\u0120", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dp", "[i", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229]} +{"problem_id": "p03558", "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\n\n\nfrom collections import deque\n\ndef resolve():\n\n k=int(input())\n\n E=[[] for _ in range(k)]\n\n for i in range(k):\n\n E[i].append(((i+1)%k,1))\n\n E[i].append(((10*i)%k,0))\n\n\n\n # 0-1 BFS\n\n dist=[INF]*k\n\n dist[1]=0\n\n Q=deque([1])\n\n while(Q):\n\n v=Q.popleft()\n\n for nv,w in E[v]:\n\n if(dist[nv]<=dist[v]+w): continue\n\n dist[nv]=dist[v]+w\n\n if(w==0): Q.appendleft(nv)\n\n else: Q.append(nv)\n\n print((dist[0]+1))\n\nresolve()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "2", "1", "4", "7", "4", "8", "3", "6", "4", "7", ")\u010a\u010a", "INF", "=float", "(\"", "inf", "\")\u010a\u010a", "MOD", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "input", "=lambda", "\u0120:", "sys", ".stdin", ".readline", "().", "rstrip", "()\u010a\u010a\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "def", "\u0120resolve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "=int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120E", "=[", "[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120E", "[i", "].", "append", "(((", "i", "+", "1", ")%", "k", ",", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120E", "[i", "].", "append", "(((", "1", "0", "*i", ")%", "k", ",", "0", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120", "0", "-", "1", "\u0120BFS", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dist", "=[", "INF", "]*", "k", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dist", "[", "1", "]=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120Q", "=", "deque", "([", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "(Q", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "=", "Q", ".p", "opleft", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120nv", ",w", "\u0120in", "\u0120E", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(dist", "[n", "v", "]<=", "dist", "[v", "]+", "w", "):", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dist", "[n", "v", "]=", "dist", "[v", "]+", "w", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(w", "==", "0", "):", "\u0120Q", ".append", "left", "(n", "v", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120Q", ".append", "(n", "v", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dist", "[", "0", "]+", "1", "))\u010a\u010a", "resolve", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03796", "input": "import math\n\n\n\nn = int(input())\n\n\n\nprint((math.factorial(n) % (10**9 + 7)))\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03839", "input": "N,K = list(map(int,input().split()))\n\nsrc = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncump = [0]\n\nfor a in src:\n\n cums.append(cums[-1] + a)\n\n cump.append(cump[-1] + max(0,a))\n\n\n\nans = 0\n\nfor i in range(N-K+1):\n\n tmp = cump[i]\n\n tmp += max(0, cums[i+K] - cums[i])\n\n tmp += cump[N] - cump[i+K]\n\n ans = max(tmp, ans)\n\nprint(ans)\n", "input_tokens": ["N", ",K", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "src", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "c", "ums", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "c", "ump", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120src", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "ums", ".append", "(c", "ums", "[-", "1", "]", "\u0120+", "\u0120a", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "ump", ".append", "(c", "ump", "[-", "1", "]", "\u0120+", "\u0120max", "(", "0", ",a", "))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120c", "ump", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120max", "(", "0", ",", "\u0120c", "ums", "[i", "+", "K", "]", "\u0120-", "\u0120c", "ums", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120c", "ump", "[N", "]", "\u0120-", "\u0120c", "ump", "[i", "+", "K", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(tmp", ",", "\u0120ans", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03796", "input": "def factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r *= n\n\n power_r %= 10**9+7\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "input_tokens": ["def", "\u0120factorial", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120power", "_r", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120n", "\u0120in", "\u0120range", "(", "2", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120power", "_r", "\u0120*=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120power", "_r", "\u0120%=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120power", "_r", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "factor", "ial", "(N", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02596", "input": "import sys\n\nK = int(input())\n\n\n\npower = 7\n\nSUM = 0\n\n\n\nfor i in range(1, 10 ** 6):\n\n SUM += power\n\n if SUM % K == 0:\n\n print(i)\n\n sys.exit()\n\n power *= 10\n\n power %= K\n\n\n\nprint((-1))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "K", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "power", "\u0120=", "\u0120", "7", "\u010a\u010a", "SUM", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "\u0120**", "\u0120", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120SUM", "\u0120+=", "\u0120power", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120SUM", "\u0120%", "\u0120K", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120power", "\u0120*=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120power", "\u0120%=", "\u0120K", "\u010a\u010a\u010a\u010a", "print", "((-", "1", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02821", "input": "#E\n\nfrom itertools import accumulate\n\nfrom bisect import bisect_left\n\ndef main():\n\n n,m=list(map(int,input().split()))\n\n A=list(map(int,input().split()))\n\n A.sort()\n\n \n\n def count(k):\n\n cnt=0\n\n for a in A:\n\n cnt+=bisect_left(A,k-a)\n\n return cnt\n\n \n\n ok=0\n\n ng=10**10+1\n\n while ng-ok>1:\n\n mid=(ok+ng)//2\n\n if count(mid)", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mid", "=(", "ok", "+", "ng", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120count", "(mid", ")<", "n", "**", "2", "-m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ok", "=", "mid", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ng", "=", "mid", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120border", "=", "ok", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "=n", "**", "2", "-count", "(border", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120Acc", "=[", "0", "]+", "list", "(", "accumulate", "(A", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=", "Acc", "[-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120idx", "=b", "is", "ect", "_left", "(A", ",b", "order", "-a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "a", "*(", "n", "-", "idx", ")+(", "s", "-A", "cc", "[idx", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "-=", "border", "*(", "k", "-m", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "if", "\u0120__", "name", "__", "=='", "__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03634", "input": "import sys\n\ninput = sys.stdin.readline\n\nn = int(input())\n\nv = [[0]+[]*(n+1) for i in range(n+1)]\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\n\n\nq,k = list(map(int,input().split()))\n\nl = [k]\n\nwhile l:\n\n now = l.pop()\n\n for i in v[now][1:]:\n\n if v[i[0]][0] == 0:\n\n v[i[0]][0] = i[1]+v[now][0]\n\n l.append(i[0])\n\n\n\nfor i in range(q):\n\n x,y = list(map(int,input().split()))\n\n print((v[x][0]+v[y][0]))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "v", "\u0120=", "\u0120[[", "0", "]+", "[]", "*(", "n", "+", "1", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "1", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "[a", "].", "append", "([", "b", ",c", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "[b", "].", "append", "([", "a", ",c", "])\u010a\u010a", "\u010a\u010a", "q", ",k", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "l", "\u0120=", "\u0120[", "k", "]\u010a\u010a", "while", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120now", "\u0120=", "\u0120l", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120v", "[now", "][", "1", ":]", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120v", "[i", "[", "0", "]][", "0", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[i", "[", "0", "]][", "0", "]", "\u0120=", "\u0120i", "[", "1", "]+", "v", "[now", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", ".append", "(i", "[", "0", "])\u010a\u010a", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(q", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "v", "[x", "][", "0", "]+", "v", "[y", "][", "0", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169]} +{"problem_id": "p03568", "input": "from functools import reduce\n\nfrom itertools import product\n\n\n\nN = int(input())\n\n*A, = list(map(int, input().split()))\n\nans = 0\n\nfor t in product([-1, 0, 1], repeat=N):\n\n prod = reduce(lambda x, y: x*y, [a + t[i] for i, a in enumerate(A)])\n\n if prod % 2 == 0: ans += 1\n\nprint(ans)", "input_tokens": ["from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120product", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "*A", ",", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120t", "\u0120in", "\u0120product", "([-", "1", ",", "\u0120", "0", ",", "\u0120", "1", "],", "\u0120repeat", "=N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120prod", "\u0120=", "\u0120reduce", "(lambda", "\u0120x", ",", "\u0120y", ":", "\u0120x", "*y", ",", "\u0120[", "a", "\u0120+", "\u0120t", "[i", "]", "\u0120for", "\u0120i", ",", "\u0120a", "\u0120in", "\u0120enumerate", "(A", ")])\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120prod", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02748", "input": "a, b, m = list(map(int,input().split()))\n\ndr = list(map(int,input().split()))\n\nwa = list(map(int,input().split()))\n\nxyc = [list(map(int,input().split())) for i in range(m)]\n\nlow = 200001\n\n\n\nfor i in range(m):\n\n f = xyc[i][0] - 1\n\n d = xyc[i][1] - 1\n\n if low >= dr[f]+wa[d]-xyc[i][2]:\n\n low = dr[f]+wa[d]-xyc[i][2]\n\n\n\ndr.sort()\n\nwa.sort()\n\n\n\nif low >= (dr[0] + wa[0]):\n\n print((dr[0] + wa[0]))\n\nelse:\n\n print(low)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "dr", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "wa", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "x", "yc", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(m", ")]\u010a\u010a", "low", "\u0120=", "\u0120", "2", "0", "0", "0", "0", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120x", "yc", "[i", "][", "0", "]", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120x", "yc", "[i", "][", "1", "]", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120low", "\u0120>=", "\u0120dr", "[f", "]+", "wa", "[d", "]-", "x", "yc", "[i", "][", "2", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120low", "\u0120=", "\u0120dr", "[f", "]+", "wa", "[d", "]-", "x", "yc", "[i", "][", "2", "]\u010a\u010a\u010a\u010a", "dr", ".sort", "()\u010a\u010a", "wa", ".sort", "()\u010a\u010a\u010a\u010a", "if", "\u0120low", "\u0120>=", "\u0120(", "dr", "[", "0", "]", "\u0120+", "\u0120wa", "[", "0", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dr", "[", "0", "]", "\u0120+", "\u0120wa", "[", "0", "]))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(low", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02983", "input": "l, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (((i%2019)*(j%2019))%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)", "input_tokens": ["l", ",", "\u0120r", "=list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "if", "\u0120r", "-l", ">", "6", "7", "2", ":\u010a\u010a", "\u0109p", "=", "0", "\u010a\u010a", "else", ":\u010a\u010a", "\u0109p", "=", "2", "0", "1", "9", "\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(l", ",", "\u0120r", "):\u010a\u010a", "\u0109", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",", "\u0120r", "+", "1", "):\u010a\u010a", "\u0109\u0109", "\u0109p", "=min", "(p", ",", "\u0120(((", "i", "%", "2", "0", "1", "9", ")*(", "j", "%", "2", "0", "1", "9", "))", "%", "2", "0", "1", "9", "))\u010a\u010a", "\u0109\u0109", "\u0109if", "\u0120not", "\u0120p", ":\u010a\u010a", "\u0109\u0109\u0109", "\u0109break", "\u010a\u010a", "\u0109", "\u0109if", "\u0120not", "\u0120p", ":\u010a\u010a", "\u0109\u0109", "\u0109break", "\u010a\u010a", "print", "(p", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428]} +{"problem_id": "p03371", "input": "a,b,c,x,y = list(map(int,input().split()))\n\nprice = 10**10\n\nfor k in range(10**5+1):\n\n re = 2*c*k + max(0,x-k)*a + max(0,y-k)*b\n\n price = min(re,price)\n\nprint(price)", "input_tokens": ["a", ",b", ",c", ",x", ",y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "price", "\u0120=", "\u0120", "1", "0", "**", "1", "0", "\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(", "1", "0", "**", "5", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120re", "\u0120=", "\u0120", "2", "*c", "*k", "\u0120+", "\u0120max", "(", "0", ",x", "-k", ")*", "a", "\u0120+", "\u0120max", "(", "0", ",y", "-k", ")*", "b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120price", "\u0120=", "\u0120min", "(re", ",", "price", ")\u010a\u010a", "print", "(price", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(int", "(input", "()))", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02996", "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(input())\n\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\n\n\n\ncnt = 0\n\nfor b, a in ab:\n\n cnt += a\n\n if cnt > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ab", "\u0120=", "\u0120sorted", "([", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "[::-", "1", "]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", ")\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120b", ",", "\u0120a", "\u0120in", "\u0120ab", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "\u0120>", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428]} +{"problem_id": "p03828", "input": "from collections import Counter\n\nN = int(input())\n\ndiv = []\n\nfor i in range(2,N+1):\n\n while i != 1:\n\n for d in range(2,i+1):\n\n while i%d==0:\n\n i = i//d\n\n div.append(d)\n\nC = Counter(div).most_common()\n\nAns = 1\n\nfor k,v in C:\n\n Ans = Ans*(v+1) % (10**9+7)\n\n\n\nprint(Ans)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "div", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120d", "\u0120in", "\u0120range", "(", "2", ",i", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120i", "%d", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120i", "//", "d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120div", ".append", "(d", ")\u010a\u010a", "C", "\u0120=", "\u0120Counter", "(div", ").", "most", "_common", "()\u010a\u010a", "Ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120k", ",v", "\u0120in", "\u0120C", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120Ans", "\u0120=", "\u0120Ans", "*(", "v", "+", "1", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "+", "7", ")\u010a\u010a\u010a\u010a", "print", "(", "Ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p02245", "input": "from collections import deque\n\nfrom copy import deepcopy, copy\n\ndy = [-1, 0, 0, 1]\n\ndx = [0, -1, 1, 0]\n\nN = 3\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef MAIN():\n\n m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n goal = ('1', '2', '3', '4', '5', '6', '7', '8', '0')\n\n goal = 123456780\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n print(cnt)\n\n break\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\nMAIN()\n\n\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "from", "\u0120copy", "\u0120import", "\u0120deepcopy", ",", "\u0120copy", "\u010a\u010a", "dy", "\u0120=", "\u0120[-", "1", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "1", "]\u010a\u010a", "dx", "\u0120=", "\u0120[", "0", ",", "\u0120-", "1", ",", "\u0120", "1", ",", "\u0120", "0", "]\u010a\u010a", "N", "\u0120=", "\u0120", "3", "\u010a\u010a", "def", "\u0120g", "(i", ",", "\u0120j", ",", "\u0120a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120a", "\u0120//", "\u0120(", "1", "0", "\u0120**", "\u0120j", ")", "\u0120%", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120a", "\u0120-", "\u0120t", "\u0120*", "\u0120(", "1", "0", "\u0120**", "\u0120j", ")", "\u0120+", "\u0120t", "\u0120*", "\u0120(", "1", "0", "\u0120**", "\u0120i", ")\u010a\u010a", "def", "\u0120MAIN", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120{", "8", ":{", "7", ",", "\u0120", "5", "},", "\u0120", "7", ":{", "8", ",", "\u0120", "6", ",", "\u0120", "4", "},", "\u0120", "6", ":{", "7", ",", "\u0120", "3", "},", "\u0120", "5", ":{", "8", ",", "\u0120", "4", ",", "\u0120", "2", "},", "\u0120", "4", ":{", "7", ",", "\u0120", "5", ",", "\u0120", "3", ",", "\u0120", "1", "},", "\u0120", "3", ":{", "6", ",", "\u0120", "4", ",", "\u0120", "0", "},", "\u0120", "2", ":{", "5", ",", "\u0120", "1", "},", "\u0120", "1", ":{", "4", ",", "\u0120", "2", ",", "\u0120", "0", "},", "\u0120", "0", ":{", "3", ",", "\u0120", "1", "}}\u010a\u010a", "\u0120\u0120\u0120", "\u0120MAP", "\u0120=", "\u0120\"\".", "join", "(input", "().", "replace", "(\"", "\u0120\",", "\u0120\"\")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120", "8", "\u0120-", "\u0120MAP", ".find", "(\"", "0", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120MAP", "\u0120=", "\u0120int", "(M", "AP", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120goal", "\u0120=", "\u0120('", "1", "',", "\u0120'", "2", "',", "\u0120'", "3", "',", "\u0120'", "4", "',", "\u0120'", "5", "',", "\u0120'", "6", "',", "\u0120'", "7", "',", "\u0120'", "8", "',", "\u0120'", "0", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120goal", "\u0120=", "\u0120", "1", "2", "3", "4", "5", "6", "7", "8", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120deque", "([(", "0", ",", "\u0120start", ",", "\u0120MAP", ")])\u010a\u010a", "\u0120\u0120\u0120", "\u0120LOG", "\u0120=", "\u0120{", "MAP", "}\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120dp", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", ",", "\u0120y", "x", ",", "\u0120M", "\u0120=", "\u0120dp", ".p", "opleft", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120M", "\u0120==", "\u0120goal", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(cnt", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120ny", "x", "\u0120in", "\u0120m", "[y", "x", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120CM", "\u0120=", "\u0120g", "(y", "x", ",", "\u0120ny", "x", ",", "\u0120M", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120CM", "\u0120in", "\u0120LOG", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", ".append", "((", "cnt", ",", "\u0120ny", "x", ",", "\u0120CM", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120LOG", ".add", "(C", "M", ")\u010a\u010a", "MAIN", "()\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03416", "input": "# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n r = \"\".join(reversed(list(s)))\n\n if s == r:\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["#", "\u0120vim", ":", "\u0120file", "encoding", "=utf", "-", "8", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120\"\".", "join", "(re", "versed", "(list", "(s", ")))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120==", "\u0120r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(c", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03371", "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float('inf')\n\n\n\nfor i in range(10 ** 5 + 1):\n\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\nprint(ans)", "input_tokens": ["A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "\u0120**", "\u0120", "5", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120A", "\u0120*", "\u0120max", "(X", "\u0120-", "\u0120i", ",", "\u0120", "0", ")", "\u0120+", "\u0120B", "\u0120*", "\u0120max", "(Y", "\u0120-", "\u0120i", ",", "\u0120", "0", ")", "\u0120+", "\u0120", "2", "\u0120*", "\u0120C", "\u0120*", "\u0120i", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03037", "input": "k,m=list(map(int,input().split()))\n\nl=[0 for i in range(k+1)]\n\nfor i in range(m):\n\n a,s=list(map(int,input().split()))\n\n l[a-1]+=1;l[s]-=1\n\nans=0\n\nf=0\n\nfor j in range(k):\n\n l[j]+=f\n\n f=l[j]\n\nprint((len([1 for i in l if i==m])))", "input_tokens": ["k", ",m", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "l", "=[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", "+", "1", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120", "\u0120a", ",s", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120l", "[a", "-", "1", "]+=", "1", ";l", "[s", "]-", "=", "1", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "f", "=", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120", "\u0120l", "[j", "]+=", "f", "\u010a\u010a", "\u0120", "\u0120f", "=l", "[j", "]\u010a\u010a", "print", "((", "len", "([", "1", "\u0120for", "\u0120i", "\u0120in", "\u0120l", "\u0120if", "\u0120i", "==", "m", "])))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02792", "input": "N = int(input())\n\ncount = [[0 for _ in range(9)] for _ in range(9)]\n\nfor i in range(1, N + 1):\n\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\n\nans = 0\n\nfor i in range(0, 9):\n\n for k in range(0, 9):\n\n ans += count[i][k] * count[k][i]\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "count", "\u0120=", "\u0120[[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "9", ")]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "9", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120str", "(i", ")[", "0", "]", "\u0120!=", "\u0120\"", "0", "\"", "\u0120and", "\u0120str", "(i", ")[-", "1", "]", "\u0120!=", "\u0120\"", "0", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "[int", "(str", "(i", ")[", "0", "])", "\u0120-", "\u0120", "1", "][", "int", "(str", "(i", ")[-", "1", "])", "\u0120-", "\u0120", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120", "9", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "0", ",", "\u0120", "9", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120count", "[i", "][", "k", "]", "\u0120*", "\u0120count", "[k", "][", "i", "]\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p03078", "input": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x // y))\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\nABC=[]\n\nfor i in range(X):\n\n for j in range(Y):\n\n if (i+1)*(j+1)>K:\n\n break\n\n for k in range(Z):\n\n if (i+1)*(j+1)*(k+1)>K:\n\n break\n\n ABC.append(A[i]+B[j]+C[k])\n\nABC.sort(reverse=True)\n\nfor i in range(K):\n\n print((ABC[i]))\n\n\n", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", "\u010a\u010a\u010a\u010a", "def", "\u0120input", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a", "def", "\u0120list", "2", "d", "(a", ",", "\u0120b", ",", "\u0120c", "):", "\u0120return", "\u0120[[", "c", "]", "\u0120*", "\u0120b", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(a", ")]\u010a\u010a", "def", "\u0120list", "3", "d", "(a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120d", "):", "\u0120return", "\u0120[[[", "d", "]", "\u0120*", "\u0120c", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(b", ")]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(a", ")]\u010a\u010a", "def", "\u0120ceil", "(x", ",", "\u0120y", "=", "1", "):", "\u0120return", "\u0120int", "(-", "(-", "x", "\u0120//", "\u0120y", "))\u010a\u010a", "def", "\u0120INT", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120MAP", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120LIST", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120Yes", "():", "\u0120print", "('", "Yes", "')\u010a\u010a", "def", "\u0120No", "():", "\u0120print", "('", "No", "')\u010a\u010a", "def", "\u0120YES", "():", "\u0120print", "('", "YES", "')\u010a\u010a", "def", "\u0120NO", "():", "\u0120print", "('", "NO", "')\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "MOD", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "X", ",Y", ",Z", ",K", "=", "MAP", "()\u010a\u010a", "A", "=", "sorted", "(L", "IST", "(),", "\u0120reverse", "=True", ")\u010a\u010a", "B", "=", "sorted", "(L", "IST", "(),", "\u0120reverse", "=True", ")\u010a\u010a", "C", "=", "sorted", "(L", "IST", "(),", "\u0120reverse", "=True", ")\u010a\u010a\u010a\u010a", "ABC", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(X", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(Y", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "+", "1", ")*(", "j", "+", "1", ")>", "K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(Z", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "+", "1", ")*(", "j", "+", "1", ")*(", "k", "+", "1", ")>", "K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ABC", ".append", "(A", "[i", "]+", "B", "[j", "]+", "C", "[k", "])\u010a\u010a", "ABC", ".sort", "(reverse", "=True", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "ABC", "[i", "]))", "\u010a\u010a\u010a"], "input_token_weights": [0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139]} +{"problem_id": "p02560", "input": "#!/usr/bin/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "6", ")\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "1", "\u0120", "\u0120#", "\u0120sys", ".max", "size", "\u0120#", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "MOD", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120floor", "_sum", "(n", ",", "\u0120m", ",", "\u0120a", ",", "\u0120b", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120>=", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120(", "n", "\u0120-", "\u0120", "1", ")", "\u0120*", "\u0120n", "\u0120*", "\u0120(", "a", "\u0120//", "\u0120m", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120%=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120b", "\u0120>=", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120n", "\u0120*", "\u0120(", "b", "\u0120//", "\u0120m", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120%=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "_max", "\u0120=", "\u0120(", "a", "\u0120*", "\u0120n", "\u0120+", "\u0120b", ")", "\u0120//", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "_max", "\u0120=", "\u0120y", "_max", "\u0120*", "\u0120m", "\u0120-", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120y", "_max", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120(", "n", "\u0120-", "\u0120(", "x", "_max", "\u0120+", "\u0120a", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120a", ")", "\u0120*", "\u0120y", "_max", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120floor", "_sum", "(y", "_max", ",", "\u0120a", ",", "\u0120m", ",", "\u0120(", "a", "\u0120-", "\u0120x", "_max", "\u0120%", "\u0120a", ")", "\u0120%", "\u0120a", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120debug", "(*", "x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(*", "x", ",", "\u0120file", "=sys", ".stderr", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "(S", "OLVE", "_PARAMS", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120pass", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120parse", "\u0120input", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "t", "\u0120in", "\u0120range", "(T", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120N", ",", "\u0120M", ",", "\u0120A", ",", "\u0120B", "\u0120=", "\u0120map", "(int", ",", "\u0120input", "().", "split", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(floor", "_sum", "(N", ",", "\u0120M", ",", "\u0120A", ",", "\u0120B", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120tests", "\u010a\u010a", "T", "1", "\u0120=", "\u0120\"\"\"\u010a\u010a", "5", "\u010a\u010a", "4", "\u0120", "1", "0", "\u0120", "6", "\u0120", "3", "\u010a\u010a", "6", "\u0120", "5", "\u0120", "4", "\u0120", "3", "\u010a\u010a", "1", "\u0120", "1", "\u0120", "0", "\u0120", "0", "\u010a\u010a", "3", "1", "4", "1", "5", "\u0120", "9", "2", "6", "5", "3", "\u0120", "5", "8", "9", "7", "9", "\u0120", "3", "2", "3", "8", "4", "\u010a\u010a", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "\u0120", "9", "9", "9", "9", "9", "9", "9", "9", "9", "\u0120", "9", "9", "9", "9", "9", "9", "9", "9", "9", "\u010a\u010a", "\"\"\"\u010a\u010a", "TEST", "_T", "1", "\u0120=", "\u0120\"\"\"\u010a\u010a", ">>>", "\u0120as", "_input", "(T", "1", ")\u010a\u010a", ">>>", "\u0120main", "()\u010a\u010a", "3", "\u010a\u010a", "1", "3", "\u010a\u010a", "0", "\u010a\u010a", "3", "1", "4", "0", "9", "5", "4", "8", "0", "\u010a\u010a", "4", "9", "9", "9", "9", "9", "9", "9", "9", "5", "0", "0", "0", "0", "0", "0", "0", "0", "\u010a\u010a", "\"\"\"", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120_", "test", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120do", "ctest", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120do", "ctest", ".test", "mod", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "\u0120=", "\u0120globals", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120sorted", "(g", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", ".startswith", "(\"", "TEST", "_", "\")", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120do", "ctest", ".run", "_doc", "string", "_examples", "(g", "[k", "],", "\u0120g", ",", "\u0120name", "=k", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120as", "_input", "(s", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"", "use", "\u0120in", "\u0120test", ",", "\u0120use", "\u0120given", "\u0120string", "\u0120as", "\u0120input", "\u0120file", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120io", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120io", ".String", "IO", "(s", ".strip", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "\u0120=", "\u0120globals", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "[\"", "input", "\"]", "\u0120=", "\u0120lambda", ":", "\u0120bytes", "(f", ".readline", "(),", "\u0120\"", "ascii", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "[\"", "read", "\"]", "\u0120=", "\u0120lambda", ":", "\u0120bytes", "(f", ".read", "(),", "\u0120\"", "ascii", "\")\u010a\u010a", "\u010a\u010a\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".read", "\u010a\u010a\u010a\u010a", "if", "\u0120sys", ".argv", "[-", "1", "]", "\u0120==", "\u0120\"-", "t", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "testing", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120_", "test", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a\u010a\u010a", "main", "()\u010a"], "input_token_weights": [0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.883057299767519, 0.883057299767519]} +{"problem_id": "p02881", "input": "import math\n\nN = int(input())\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = math.ceil(N/(i+1))\n\n if (1+i)*j == N:\n\n ans = min(i+j-1,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "0", "**", "1", "2", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "1", "0", "**", "6", "+", "1", "):\u010a\u010a", "\u0120", "\u0120j", "\u0120=", "\u0120math", ".ceil", "(N", "/(", "i", "+", "1", "))\u010a\u010a", "\u0120", "\u0120if", "\u0120(", "1", "+i", ")*", "j", "\u0120==", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(i", "+j", "-", "1", ",", "ans", ")\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "1", "0", "**", "6", "\u0120and", "\u0120ans", "\u0120==", "\u0120", "1", "0", "**", "1", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120N", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p02758", "input": "mod = 998244353\n\nN = int(input())\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))", "input_tokens": ["mod", "\u0120=", "\u0120", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "X", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120d", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", ".append", "((", "x", ",", "\u0120x", "\u0120+", "\u0120d", "))", "\u010a\u010a\u010a\u010a", "X", "\u0120=", "\u0120sorted", "(X", ",", "\u0120key", "\u0120=", "\u0120lambda", "\u0120x", ":", "\u0120x", "[", "0", "])\u010a\u010a", "L", "\u0120=", "\u0120[(", "0", ",", "\u0120-(", "1", "0", "**", "9", "+", "1", "),", "\u0120", "1", "0", "**", "9", "+", "1", ")]\u010a\u010a", "P", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120(", "N", "+", "1", ")\u010a\u010a", "for", "\u0120i", ",", "\u0120(", "x", ",", "\u0120y", ")", "\u0120in", "\u0120enumerate", "(X", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120L", "[-", "1", "][", "2", "]", "\u0120<=", "\u0120y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120L", "[-", "1", "][", "2", "]", "\u0120>", "\u0120x", "\u0120and", "\u0120P", "[i", "+", "1", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120P", "[i", "+", "1", "]", "\u0120=", "\u0120L", "[-", "1", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120P", "[i", "+", "1", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120P", "[i", "+", "1", "]", "\u0120=", "\u0120L", "[-", "1", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", ".append", "((", "i", "+", "1", ",", "\u0120x", ",", "\u0120y", "))", "\u010a\u010a\u010a\u010a", "C", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "+", "1", ")]\u010a\u010a", "for", "\u0120i", ",", "\u0120p", "\u0120in", "\u0120enumerate", "(P", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120p", "\u0120>=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120C", "[p", "].", "append", "(i", ")\u010a\u010a\u010a\u010a", "Y", "\u0120=", "\u0120[", "1", "]", "\u0120*", "\u0120(", "N", "+", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", ")[", "::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120C", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120s", "\u0120*", "\u0120(", "Y", "[j", "]", "\u0120+", "\u0120", "1", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120Y", "[i", "]", "\u0120=", "\u0120s", "\u010a\u010a\u010a\u010a", "print", "((", "Y", "[", "0", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02622", "input": "print((sum(si != ti for si, ti in zip(input(), input()))))\n", "input_tokens": ["print", "((", "sum", "(si", "\u0120!=", "\u0120ti", "\u0120for", "\u0120si", ",", "\u0120ti", "\u0120in", "\u0120zip", "(input", "(),", "\u0120input", "()))", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02767", "input": "n = int(input())\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n # else:\n\n # break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "x", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "p", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120pi", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pi", "\u0120+=", "\u0120(", "x", "[j", "]", "\u0120-", "\u0120(", "i", "\u0120+", "\u0120", "1", "))", "**", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120pi", "\u0120<", "\u0120p", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120pi", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120p", "[i", "]", "\u0120+=", "\u0120(", "x", "[j", "]", "-(", "i", "+", "1", "))", "**", "2", "\u010a\u010a", "print", "(p", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02792", "input": "def solve():\n\n N = int(input())\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, 5):\n\n for i in range(10**d):\n\n j = x*10**(d+1) + i*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n else:\n\n break\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for A in range(1, N+1):\n\n ss = str(A)\n\n ans += numss[int(ss[-1])][int(ss[0])]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n", "input_tokens": ["def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "ss", "\u0120=", "\u0120[[", "0", "]*(", "1", "0", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "1", "0", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120d", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "5", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "**", "d", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120x", "*", "1", "0", "**(", "d", "+", "1", ")", "\u0120+", "\u0120i", "*", "1", "0", "\u0120+", "\u0120y", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "1", "\u0120<=", "\u0120j", "\u0120<=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120x", "*", "1", "0", "\u0120+", "\u0120y", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "1", "\u0120<=", "\u0120j", "\u0120<=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120x", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "1", "\u0120<=", "\u0120j", "\u0120<=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "ss", "[x", "][", "y", "]", "\u0120=", "\u0120num", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120A", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ss", "\u0120=", "\u0120str", "(A", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120num", "ss", "[int", "(ss", "[-", "1", "])", "][", "int", "(ss", "[", "0", "])", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "solve", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.582053818991329, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.582053818991329, 0.582053818991329, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.582053818991329, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03086", "input": "# -*- coding: utf-8 -*-\n\nfrom collections import deque\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nS = input()\n\nA = set(\"ATCG\")\n\nans = 0\n\nmode = 0\n\nfor i, s in enumerate(S):\n\n if s in A:\n\n if mode == 0:\n\n mode = 1\n\n start = i\n\n else:\n\n if mode == 1:\n\n ans = max(i - start, ans)\n\n mode = 0\n\nif mode == 1:\n\n ans = max(len(S) - start, ans)\n\nprint(ans)", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "def", "\u0120in", "pl", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a", "A", "\u0120=", "\u0120set", "(\"", "AT", "CG", "\")\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "mode", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", ",", "\u0120s", "\u0120in", "\u0120enumerate", "(S", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120mode", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mode", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120mode", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(i", "\u0120-", "\u0120start", ",", "\u0120ans", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mode", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120mode", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(len", "(S", ")", "\u0120-", "\u0120start", ",", "\u0120ans", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02952", "input": "N = int(input())\n\nans = 0\n\nfor i in range(1, N + 1):\n\n if len(str(i)) % 2 == 1:\n\n ans += 1\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(str", "(i", "))", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03353", "input": "S = input()\n\nk = int(input())\n\nA = set()\n\nfor l in range(k+1):\n\n\tfor i in range(len(S)-l):\n\n\t\t\tA.add(S[i:i+l+1])\n\nA = sorted(list(A))\n\nprint((A[k-1]))", "input_tokens": ["S", "\u0120=", "\u0120input", "()\u010a\u010a", "k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120set", "()\u010a\u010a", "for", "\u0120l", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", ")-", "l", "):\u010a\u010a", "\u0109\u0109", "\u0109A", ".add", "(S", "[i", ":i", "+l", "+", "1", "])\u010a\u010a", "A", "\u0120=", "\u0120sorted", "(list", "(A", "))\u010a\u010a", "print", "((", "A", "[k", "-", "1", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p02693", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nK = int(input())\n\nA, B = list(map(int, input().split()))\n\n\n\nfor i in range(A, B+1):\n\n if i%K==0:\n\n print('OK')\n\n exit()\n\n \n\nprint('NG')", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120*", "\u010a\u010a\u010a\u010a", "K", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", ",", "\u0120B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(A", ",", "\u0120B", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "%", "K", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "OK", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "('", "NG", "')"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03806", "input": "n, ma, mb = list(map(int, input().split()))\n\nU = 400\n\ndp = [[[float(\"inf\")]*(U+1) for _ in range(U+1)] for i in range(n+1)]\n\ndp[0][0][0] = 0\n\nfor i in range(n):\n\n a, b, c = list(map(int, input().split()))\n\n for j in range(U+1):\n\n for k in range(U+1):\n\n if j b:\n\n a, b = b, a\n\n ai = y_dict[a]\n\n bi = y_dict[b]\n\n j = x_dict[c]\n\n banned_left_ij[j][ai] += 1\n\n banned_left_ij[j][bi] -= 1\n\n banned_right_ij[j - 1][ai] += 1\n\n banned_right_ij[j - 1][bi] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n i = y_dict[d]\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up_ij[i][ej] += 1\n\n banned_up_ij[i][fj] -= 1\n\n banned_down_ij[i - 1][ej] += 1\n\n banned_down_ij[i - 1][fj] -= 1\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor i in range(col):\n\n ru = banned_up_ij[i]\n\n rd = banned_down_ij[i]\n\n ri = row * i\n\n banned_up[ri] = ru[0]\n\n banned_down[ri] = rd[0]\n\n for j in range(1, row):\n\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\n\nfor j in range(row):\n\n rl = banned_left_ij[j]\n\n rr = banned_right_ij[j]\n\n banned_left[j] = rl[0]\n\n banned_right[j] = rr[0]\n\n for i in range(1, col):\n\n ri0 = (i - 1) * row\n\n ri1 = i * row\n\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "#", "\u0120from", "\u0120itertools", "\u0120import", "\u0120chain", ",", "\u0120accumulate", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", ",", "\u0120*", "abcdef", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".buffer", ".read", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ver", "_lines", "\u0120=", "\u0120[]\u010a\u010a", "hor", "_lines", "\u0120=", "\u0120[]\u010a\u010a", "x", "_list", "\u0120=", "\u0120set", "()\u010a\u010a", "y", "_list", "\u0120=", "\u0120set", "()\u010a\u010a", "n", "3", "\u0120=", "\u0120n", "\u0120*", "\u0120", "3", "\u010a\u010a", "for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120zip", "(", "abcdef", "[", "0", ":n", "3", ":", "3", "],", "\u0120abc", "def", "[", "1", ":n", "3", ":", "3", "],", "\u0120abc", "def", "[", "2", ":n", "3", ":", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "_list", ".add", "(a", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "_list", ".add", "(b", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "_list", ".add", "(c", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ver", "_lines", ".append", "((", "a", ",", "\u0120b", ",", "\u0120c", "))", "\u010a\u010a\u010a\u010a", "for", "\u0120d", ",", "\u0120e", ",", "\u0120f", "\u0120in", "\u0120zip", "(", "abcdef", "[n", "3", "\u0120+", "\u0120", "0", "::", "3", "],", "\u0120abc", "def", "[n", "3", "\u0120+", "\u0120", "1", "::", "3", "],", "\u0120abc", "def", "[n", "3", "\u0120+", "\u0120", "2", "::", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "_list", ".add", "(d", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "_list", ".add", "(e", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "_list", ".add", "(f", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120hor", "_lines", ".append", "((", "d", ",", "\u0120e", ",", "\u0120f", "))\u010a\u010a", "x", "_list", ".add", "(", "0", ")\u010a\u010a", "y", "_list", ".add", "(", "0", ")\u010a\u010a\u010a\u010a", "x", "_list", "\u0120=", "\u0120sorted", "(x", "_list", ")\u010a\u010a", "y", "_list", "\u0120=", "\u0120sorted", "(y", "_list", ")\u010a\u010a", "x", "_dict", "\u0120=", "\u0120{", "x", ":", "\u0120i", "\u0120for", "\u0120i", ",", "\u0120x", "\u0120in", "\u0120enumerate", "(x", "_list", ",", "\u0120start", "=", "1", ")}\u010a\u010a", "y", "_dict", "\u0120=", "\u0120{", "y", ":", "\u0120i", "\u0120for", "\u0120i", ",", "\u0120y", "\u0120in", "\u0120enumerate", "(y", "_list", ",", "\u0120start", "=", "1", ")}\u010a\u010a", "row", "_real", "\u0120=", "\u0120len", "(x", "_list", ")\u010a\u010a", "col", "_real", "\u0120=", "\u0120len", "(y", "_list", ")\u010a\u010a", "row", "\u0120=", "\u0120row", "_real", "\u0120+", "\u0120", "2", "\u010a\u010a", "col", "\u0120=", "\u0120col", "_real", "\u0120+", "\u0120", "2", "\u010a\u010a", "b", "anned", "_up", "_ij", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120row", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(col", ")]\u010a\u010a", "b", "anned", "_down", "_ij", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120row", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(col", ")]\u010a\u010a", "b", "anned", "_left", "_ij", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120col", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(row", ")]\u010a\u010a", "b", "anned", "_right", "_ij", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120col", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(row", ")]\u010a\u010a", "for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120ver", "_lines", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120>", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120b", ",", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ai", "\u0120=", "\u0120y", "_dict", "[a", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120bi", "\u0120=", "\u0120y", "_dict", "[b", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120x", "_dict", "[c", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_left", "_ij", "[j", "][", "ai", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_left", "_ij", "[j", "][", "bi", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_right", "_ij", "[j", "\u0120-", "\u0120", "1", "][", "ai", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_right", "_ij", "[j", "\u0120-", "\u0120", "1", "][", "bi", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "for", "\u0120d", ",", "\u0120e", ",", "\u0120f", "\u0120in", "\u0120hor", "_lines", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120e", "\u0120>", "\u0120f", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120e", ",", "\u0120f", "\u0120=", "\u0120f", ",", "\u0120e", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120y", "_dict", "[d", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ej", "\u0120=", "\u0120x", "_dict", "[e", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120fj", "\u0120=", "\u0120x", "_dict", "[f", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_up", "_ij", "[i", "][", "ej", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_up", "_ij", "[i", "][", "f", "j", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_down", "_ij", "[i", "\u0120-", "\u0120", "1", "][", "ej", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_down", "_ij", "[i", "\u0120-", "\u0120", "1", "][", "f", "j", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "b", "anned", "_up", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "row", "\u0120*", "\u0120col", ")\u010a\u010a", "b", "anned", "_down", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "row", "\u0120*", "\u0120col", ")\u010a\u010a", "b", "anned", "_left", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "row", "\u0120*", "\u0120col", ")\u010a\u010a", "b", "anned", "_right", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "row", "\u0120*", "\u0120col", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(col", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ru", "\u0120=", "\u0120banned", "_up", "_ij", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120rd", "\u0120=", "\u0120banned", "_down", "_ij", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ri", "\u0120=", "\u0120row", "\u0120*", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_up", "[", "ri", "]", "\u0120=", "\u0120ru", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_down", "[", "ri", "]", "\u0120=", "\u0120rd", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "\u0120row", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120banned", "_up", "[", "ri", "\u0120+", "\u0120j", "]", "\u0120=", "\u0120banned", "_up", "[", "ri", "\u0120+", "\u0120j", "\u0120-", "\u0120", "1", "]", "\u0120+", "\u0120ru", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120banned", "_down", "[", "ri", "\u0120+", "\u0120j", "]", "\u0120=", "\u0120banned", "_down", "[", "ri", "\u0120+", "\u0120j", "\u0120-", "\u0120", "1", "]", "\u0120+", "\u0120rd", "[j", "]\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(row", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120rl", "\u0120=", "\u0120banned", "_left", "_ij", "[j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120rr", "\u0120=", "\u0120banned", "_right", "_ij", "[j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_left", "[j", "]", "\u0120=", "\u0120rl", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_right", "[j", "]", "\u0120=", "\u0120rr", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120col", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ri", "0", "\u0120=", "\u0120(", "i", "\u0120-", "\u0120", "1", ")", "\u0120*", "\u0120row", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ri", "1", "\u0120=", "\u0120i", "\u0120*", "\u0120row", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120banned", "_left", "[", "ri", "1", "\u0120+", "\u0120j", "]", "\u0120=", "\u0120banned", "_left", "[", "ri", "0", "\u0120+", "\u0120j", "]", "\u0120+", "\u0120rl", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120banned", "_right", "[", "ri", "1", "\u0120+", "\u0120j", "]", "\u0120=", "\u0120banned", "_right", "[", "ri", "0", "\u0120+", "\u0120j", "]", "\u0120+", "\u0120rr", "[i", "]\u010a\u010a\u010a\u010a", "#", "\u0120banned", "_up", "\u0120=", "\u0120list", "(chain", ".from", "_iter", "able", "(map", "(", "accumulate", ",", "\u0120banned", "_up", "_ij", ")))\u010a\u010a", "#", "\u0120banned", "_down", "\u0120=", "\u0120list", "(chain", ".from", "_iter", "able", "(map", "(", "accumulate", ",", "\u0120banned", "_down", "_ij", ")))\u010a\u010a", "#", "\u0120banned", "_left", "\u0120=", "\u0120list", "(chain", ".from", "_iter", "able", "(zip", "(*", "map", "(", "accumulate", ",", "\u0120banned", "_left", "_ij", "))))\u010a\u010a", "#", "\u0120banned", "_right", "\u0120=", "\u0120list", "(chain", ".from", "_iter", "able", "(zip", "(*", "map", "(", "accumulate", ",", "\u0120banned", "_right", "_ij", "))))", "\u010a\u010a\u010a\u010a", "#", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(col", "):\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120print", "(w", "alls", "[i", "\u0120*", "\u0120row", ":(", "i", "\u0120+", "\u0120", "1", ")", "\u0120*", "\u0120row", "])\u010a\u010a", "\u010a\u010a", "s", "\u0120=", "\u0120row", "\u0120*", "\u0120y", "_dict", "[", "0", "]", "\u0120+", "\u0120x", "_dict", "[", "0", "]\u010a\u010a", "enable", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120row", "\u0120+", "\u0120(", "[-", "1", "]", "\u0120+", "\u0120[", "0", "]", "\u0120*", "\u0120(", "row", "\u0120-", "\u0120", "2", ")", "\u0120+", "\u0120[-", "1", "])", "\u0120*", "\u0120(", "col", "\u0120-", "\u0120", "2", ")", "\u0120+", "\u0120[-", "1", "]", "\u0120*", "\u0120row", "\u010a\u010a\u010a\u010a", "#", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(col", "):\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120print", "(enable", "[i", "\u0120*", "\u0120row", ":(", "i", "\u0120+", "\u0120", "1", ")", "\u0120*", "\u0120row", "])\u010a\u010a", "\u010a\u010a", "q", "\u0120=", "\u0120[", "s", "]\u010a\u010a", "moves", "\u0120=", "\u0120[", "(-", "row", ",", "\u0120banned", "_up", "),", "\u0120(-", "1", ",", "\u0120banned", "_left", "),", "\u0120(", "1", ",", "\u0120banned", "_right", "),", "\u0120(", "row", ",", "\u0120banned", "_down", ")]\u010a\u010a", "while", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120q", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120enable", "[c", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120enable", "[c", "]", "\u0120==", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "INF", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120enable", "[c", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120dc", ",", "\u0120banned", "\u0120in", "\u0120moves", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120banned", "[c", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nc", "\u0120=", "\u0120c", "\u0120+", "\u0120dc", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120enable", "[", "nc", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", ".append", "(nc", ")\u010a\u010a", "#", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(col", "):\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120print", "(enable", "[i", "\u0120*", "\u0120row", ":(", "i", "\u0120+", "\u0120", "1", ")", "\u0120*", "\u0120row", "])\u010a\u010a", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(col", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ri", "\u0120=", "\u0120i", "\u0120*", "\u0120row", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(row", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120enable", "[", "ri", "\u0120+", "\u0120j", "]", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120y", "_list", "[i", "\u0120-", "\u0120", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120y", "_list", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120x", "_list", "[j", "\u0120-", "\u0120", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120x", "_list", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120(", "b", "\u0120-", "\u0120t", ")", "\u0120*", "\u0120(", "r", "\u0120-", "\u0120l", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5674344985213602, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5674344985213602, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.9831368196574064, 0.5674344985213602, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5674344985213602, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5674344985213602, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5674344985213602, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5674344985213602, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5674344985213602, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.5674344985213602, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.5674344985213602, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.5674344985213602, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.5674344985213602, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.5674344985213602, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5674344985213602, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5674344985213602, 0.7548877618383746, 0.5674344985213602, 0.5674344985213602, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.5674344985213602, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5674344985213602, 0.7332896764791028, 0.7332896764791028, 0.5674344985213602, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.5674344985213602, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5674344985213602, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.5674344985213602, 0.6419065217751312, 0.5674344985213602, 0.5674344985213602, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5674344985213602, 0.5674344985213602, 0.6176935537080551, 0.6176935537080551, 0.6176935537080551, 0.6176935537080551, 0.6176935537080551, 0.6176935537080551, 0.6176935537080551, 0.6176935537080551, 0.6176935537080551, 0.5674344985213602, 0.5928797394668679, 0.5674344985213602, 0.5674344985213602, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5674344985213602, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.5674344985213602, 0.5674344985213602, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5674344985213602, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.5674344985213602, 0.6886415962350058, 0.5674344985213602, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746]} +{"problem_id": "p02555", "input": "def main():\n\n s = int(input())\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n for i in range(1, s+1):\n\n for j in range(0, (i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "s", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120s", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "0", ",", "\u0120(", "i", "-", "3", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dp", "[-", "1", "]))", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03078", "input": "def slove():\n\n import sys\n\n import heapq\n\n import collections\n\n input = sys.stdin.readline\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n b.sort(reverse=True)\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n c.sort(reverse=True)\n\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(q)\n\n fq = collections.defaultdict(list)\n\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n\n t = 0\n\n for _ in range(k):\n\n if len(q) != 0:\n\n p = heapq.heappop(q)\n\n t = p[0]\n\n aq = p[1]\n\n bq = p[2]\n\n cq = p[3]\n\n if aq + 1 < len(a):\n\n if (-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq])\n\n fq[(-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq)] = 1\n\n if bq + 1 < len(b):\n\n if (-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq])\n\n fq[(-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq)] = 1\n\n if cq + 1 < len(c):\n\n if (-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1])\n\n fq[(-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1)] = 1\n\n print((-t))\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n", "input_tokens": ["def", "\u0120slo", "ve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120sys", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120heapq", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120collections", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", ",", "\u0120z", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "('\\", "n", "').", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "('\\", "n", "').", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "('\\", "n", "').", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "('\\", "n", "').", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120[[", "-(", "a", "[", "0", "]", "\u0120+", "\u0120b", "[", "0", "]", "\u0120+", "\u0120c", "[", "0", "]),", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "]]\u010a\u010a", "\u0120\u0120\u0120", "\u0120heapq", ".heap", "ify", "(q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120fq", "\u0120=", "\u0120collections", ".default", "dict", "(list", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120fq", "[", "(-(", "a", "[", "0", "]", "\u0120+", "\u0120b", "[", "0", "]", "\u0120+", "\u0120c", "[", "0", "]),", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "),", "\u0120", "1", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(q", ")", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120heapq", ".he", "app", "op", "(q", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120p", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "q", "\u0120=", "\u0120p", "[", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bq", "\u0120=", "\u0120p", "[", "2", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cq", "\u0120=", "\u0120p", "[", "3", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "q", "\u0120+", "\u0120", "1", "\u0120<", "\u0120len", "(a", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "-(", "a", "[a", "q", "+", "1", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", "+", "1", ",", "\u0120bq", ",", "\u0120cq", ")", "\u0120not", "\u0120in", "\u0120fq", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120[", "-(", "a", "[a", "q", "+", "1", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", "+", "1", ",", "\u0120bq", ",", "\u0120cq", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fq", "[", "(-(", "a", "[a", "q", "+", "1", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", "+", "1", ",", "\u0120bq", ",", "\u0120cq", ")]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120bq", "\u0120+", "\u0120", "1", "\u0120<", "\u0120len", "(b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "+", "1", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", ",", "\u0120bq", "+", "1", ",", "\u0120cq", ")", "\u0120not", "\u0120in", "\u0120fq", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120[", "-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "+", "1", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", ",", "\u0120bq", "+", "1", ",", "\u0120cq", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fq", "[", "(-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "+", "1", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", ",", "\u0120bq", "+", "1", ",", "\u0120cq", ")]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cq", "\u0120+", "\u0120", "1", "\u0120<", "\u0120len", "(c", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "+", "1", "]),", "\u0120a", "q", ",", "\u0120bq", ",", "\u0120cq", "+", "1", ")", "\u0120not", "\u0120in", "\u0120fq", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120[", "-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "+", "1", "]),", "\u0120a", "q", ",", "\u0120bq", ",", "\u0120cq", "+", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fq", "[", "(-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "+", "1", "]),", "\u0120a", "q", ",", "\u0120bq", ",", "\u0120cq", "+", "1", ")]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "t", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120slo", "ve", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p00500", "input": "N = int(input())\n\nscore = [list(map(int, input().split())) for _ in range(N)]\n\nplayers = [0 for _ in range(N)]\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += p\n\nprint(*players, sep='\\n')\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "score", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "players", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120play", "\u0120in", "\u0120list", "(zip", "(*", "score", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120p", "\u0120in", "\u0120enumerate", "(play", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120play", ".count", "(p", ")", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120players", "[i", "]", "\u0120+=", "\u0120p", "\u010a\u010a", "print", "(*", "players", ",", "\u0120sep", "='\\", "n", "')\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03170", "input": "n,k = list(map(int,input().split()))\n\narr = list(map(int,input().split()))\n\n\n\ndp = [False]*(k+1)\n\n\n\nfor stones in range(k+1):\n\n for x in arr:\n\n if stones >= x and dp[stones-x] == False:\n\n dp[stones] = True\n\n\n\nif dp[k]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")\n", "input_tokens": ["n", ",k", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "arr", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[", "False", "]*(", "k", "+", "1", ")\u010a\u010a\u010a\u010a", "for", "\u0120stones", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120arr", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120stones", "\u0120>=", "\u0120x", "\u0120and", "\u0120dp", "[", "stones", "-x", "]", "\u0120==", "\u0120False", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[", "stones", "]", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "if", "\u0120dp", "[k", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "First", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Second", "\")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02419", "input": "W = input().lower()\n\ns = []\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n s.append(T[i].lower())\n\nans = 0\n\nfor i in range(len(s)):\n\n if(s[i] == W):\n\n ans += 1\n\nprint(ans)", "input_tokens": ["W", "\u0120=", "\u0120input", "().", "lower", "()\u010a\u010a", "s", "\u0120=", "\u0120[]\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120list", "(map", "(str", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(T", "[", "0", "]", "\u0120==", "\u0120\"", "END", "_OF", "_TEXT", "\")", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(T", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", ".append", "(T", "[i", "].", "lower", "())\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(s", "[i", "]", "\u0120==", "\u0120W", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416]} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(int", "(input", "()))", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02773", "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nS = sorted(S)\n\nls = [[] for i in range(N + 1)]\n\nmax_num = 0\n\nleft = 0\n\nright = 0\n\nwhile right < N:\n\n while right < N and S[left] == S[right]:\n\n right += 1\n\n if (right - left) >= max_num:\n\n ls[right - left].append(S[left].decode())\n\n max_num = right - left\n\n left = right\n\n \n\nprint(('\\n'.join(ls[max_num])))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readlines", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(read", "line", "())\u010a\u010a", "S", "\u0120=", "\u0120read", "().", "split", "()\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120sorted", "(S", ")\u010a\u010a", "ls", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "\u0120+", "\u0120", "1", ")]\u010a\u010a", "max", "_num", "\u0120=", "\u0120", "0", "\u010a\u010a", "left", "\u0120=", "\u0120", "0", "\u010a\u010a", "right", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120right", "\u0120<", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120right", "\u0120<", "\u0120N", "\u0120and", "\u0120S", "[left", "]", "\u0120==", "\u0120S", "[right", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120right", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "right", "\u0120", "\u0120-", "\u0120left", ")", "\u0120>=", "\u0120max", "_num", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ls", "[right", "\u0120-", "\u0120left", "].", "append", "(S", "[left", "].", "decode", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_num", "\u0120=", "\u0120right", "\u0120-", "\u0120left", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120left", "\u0120=", "\u0120right", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(", "('\\", "n", "'.", "join", "(ls", "[max", "_num", "])))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p03164", "input": "# temp\n\nn,w = list(map(int,input().split()))\n\nwv = [tuple(map(int,input().split())) for i in range(n)]\n\n\n\ndp = [0] + [float(\"inf\")]*(10**5)\n\nfor i in range(n):\n\n for j in range(10**5,wv[i][1]-1,-1):\n\n dp[j] = min(dp[j],dp[j-wv[i][1]]+wv[i][0])\n\n\n\nres = 0\n\nfor v,e in enumerate(dp):\n\n if e <= w:\n\n res = v\n\nprint(res)", "input_tokens": ["#", "\u0120temp", "\u010a\u010a", "n", ",w", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "w", "v", "\u0120=", "\u0120[", "tuple", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]", "\u0120+", "\u0120[", "float", "(\"", "inf", "\")]", "*(", "1", "0", "**", "5", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "0", "**", "5", ",w", "v", "[i", "][", "1", "]-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[j", "]", "\u0120=", "\u0120min", "(dp", "[j", "],", "dp", "[j", "-w", "v", "[i", "][", "1", "]]", "+", "w", "v", "[i", "][", "0", "])\u010a\u010a", "\u010a\u010a", "res", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120v", ",e", "\u0120in", "\u0120enumerate", "(dp", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120e", "\u0120<=", "\u0120w", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120v", "\u010a\u010a", "print", "(res", ")"], "input_token_weights": [0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p02555", "input": "def main():\n\n n = int(input())\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(n+1):\n\n for j in range(i-2):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u010a\u010a", "\u0120", "\u0120dp", "\u0120=", "\u0120[", "0", "]*(", "n", "+", "1", ")\u010a\u010a", "\u0120", "\u0120dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120mod", "\u0120=", "\u0120pow", "(", "1", "0", ",", "\u0120", "9", ")", "\u0120+", "\u0120", "7", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "-", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u010a\u010a", "\u0120", "\u0120print", "((", "dp", "[n", "]))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120", "\u0120main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02264", "input": "class Queue:\n\n def __init__(self,values):\n\n self.values = values\n\n\n\n def empty(self):\n\n if len(self.values) == 0:\n\n return True\n\n else:\n\n return False\n\n\n\n def enqueue(self,v):\n\n self.values.append(v)\n\n\n\n def dequeue(self):\n\n if len(self.values) <= 0:\n\n raise\n\n else:\n\n v = self.values[0]\n\n del self.values[0]\n\n return v\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nprocesses = []\n\nfor i in range(n):\n\n n,t = input().split(' ')\n\n processes.append((n,int(t)))\n\n\n\nqueue = Queue(processes)\n\n\n\nclock = 0\n\ndone = []\n\nwhile not queue.empty():\n\n p = queue.dequeue()\n\n n = p[0]\n\n t = p[1]\n\n if t <= q:\n\n clock+=t\n\n done.append((n,clock))\n\n else:\n\n queue.enqueue((n,t-q))\n\n clock+=q\n\n\n\nfor p in done:\n\n print(p[0],p[1])", "input_tokens": ["class", "\u0120Queue", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "values", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".values", "\u0120=", "\u0120values", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120empty", "(self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(self", ".values", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120enqueue", "(self", ",v", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".values", ".append", "(v", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120dequeue", "(self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(self", ".values", ")", "\u0120<=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120raise", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120self", ".values", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120del", "\u0120self", ".values", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120v", "\u010a\u010a\u010a\u010a", "n", ",q", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "('", "\u0120'", ")))\u010a\u010a", "process", "es", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",t", "\u0120=", "\u0120input", "().", "split", "('", "\u0120')\u010a\u010a", "\u0120\u0120\u0120", "\u0120processes", ".append", "((", "n", ",int", "(t", "))", ")\u010a\u010a\u010a\u010a", "queue", "\u0120=", "\u0120Queue", "(process", "es", ")\u010a\u010a\u010a\u010a", "clock", "\u0120=", "\u0120", "0", "\u010a\u010a", "done", "\u0120=", "\u0120[]\u010a\u010a", "while", "\u0120not", "\u0120queue", ".empty", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120queue", ".dequeue", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120p", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120p", "[", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120t", "\u0120<=", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120clock", "+=", "t", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120done", ".append", "((", "n", ",c", "lock", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120queue", ".enqueue", "((", "n", ",t", "-q", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120clock", "+=", "q", "\u010a\u010a\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120done", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(p", "[", "0", "],", "p", "[", "1", "])"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986]} +{"problem_id": "p02983", "input": "l,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n print(tres)\n", "input_tokens": ["l", ",r", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "if", "\u0120r", "\u0120-", "\u0120l", "\u0120>", "\u0120", "2", "0", "1", "9", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120tres", "\u0120=", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(l", ",r", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",r", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120(", "i", "\u0120%", "\u0120", "2", "0", "1", "9", ")", "\u0120*", "\u0120(", "j", "\u0120%", "\u0120", "2", "0", "1", "9", ")", "\u0120%", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tres", "\u0120=", "\u0120min", "(t", "res", ",", "mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(t", "res", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p03086", "input": "# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\nimport itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n all_words = []\n\n for i in range(1, len(s) + 1):\n\n for letters in itertools.product('ATCG', repeat=i):\n\n word = ''.join(letters)\n\n all_words.append(word)\n\n \n\n for i in range(len(all_words)-1, 0-1, -1):\n\n if all_words[i] in s:\n\n print((len(all_words[i])))\n\n sys.exit()\n\n print((0))\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["#", "\u0120", "2", "0", "1", "9", "-", "1", "1", "-", "1", "2", "\u0120", "2", "2", ":", "2", "1", ":", "0", "8", "(J", "ST", ")\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "#", "\u0120import", "\u0120collections", "\u010a\u010a", "#", "\u0120import", "\u0120math", "\u010a\u010a", "#", "\u0120from", "\u0120string", "\u0120import", "\u0120ascii", "_lowercase", ",", "\u0120ascii", "_upper", "case", ",", "\u0120digits", "\u010a\u010a", "#", "\u0120from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u0120as", "\u0120bi", "_l", ",", "\u0120bis", "ect", "_right", "\u0120as", "\u0120bi", "_r", "\u010a\u010a", "import", "\u0120itertools", "\u010a\u010a", "#", "\u0120from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "#", "\u0120import", "\u0120operator", "\u0120as", "\u0120op", "\u010a\u010a", "#", "\u0120from", "\u0120scipy", ".misc", "\u0120import", "\u0120comb", "\u0120#", "\u0120float", "\u010a\u010a", "#", "\u0120import", "\u0120numpy", "\u0120as", "\u0120np", "\u0120\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120sys", ".stdin", ".readline", "().", "rstrip", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120all", "_words", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120len", "(s", ")", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120letters", "\u0120in", "\u0120itertools", ".product", "('", "AT", "CG", "',", "\u0120repeat", "=i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120word", "\u0120=", "\u0120''.", "join", "(", "letters", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120all", "_words", ".append", "(word", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(all", "_words", ")-", "1", ",", "\u0120", "0", "-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120all", "_words", "[i", "]", "\u0120in", "\u0120s", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "len", "(all", "_words", "[i", "]))", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03309", "input": "# author: kagemeka \n\n# created: 2019-11-08 14:51:29(JST)\n\n## internal modules\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\nimport statistics\n\n# import functools\n\n# import operator\n\n## external modules\n\n# import scipy.special # if use comb function on AtCoder, \n\n# import scipy.misc # select scipy.misc.comb (old version) \n\n\n\ndef main():\n\n n, *a = (int(x) for x in sys.stdin.read().split())\n\n \n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n\n\n if n % 2 != 0:\n\n b = statistics.median(a)\n\n else:\n\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n\n b = statistics.median_high(a)\n\n else:\n\n b = statistics.median_low(a)\n\n \n\n ans = sum([abs(a[i] - b) for i in range(n)])\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n\n\n\n\n", "input_tokens": ["#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120author", ":", "\u0120", "\u0120k", "agem", "eka", "\u0120\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120created", ":", "\u0120", "2", "0", "1", "9", "-", "1", "1", "-", "0", "8", "\u0120", "1", "4", ":", "5", "1", ":", "2", "9", "(J", "ST", ")\u010a\u010a", "##", "\u0120internal", "\u0120modules", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "#", "\u0120import", "\u0120collections", "\u010a\u010a", "#", "\u0120import", "\u0120math", "\u010a\u010a", "#", "\u0120import", "\u0120string", "\u010a\u010a", "#", "\u0120import", "\u0120bis", "ect", "\u010a\u010a", "#", "\u0120import", "\u0120re", "\u010a\u010a", "#", "\u0120import", "\u0120itertools", "\u010a\u010a", "import", "\u0120statistics", "\u010a\u010a", "#", "\u0120import", "\u0120functools", "\u010a\u010a", "#", "\u0120import", "\u0120operator", "\u010a\u010a", "##", "\u0120external", "\u0120modules", "\u010a\u010a", "#", "\u0120import", "\u0120scipy", ".special", "\u0120\u0120", "\u0120#", "\u0120if", "\u0120use", "\u0120comb", "\u0120function", "\u0120on", "\u0120At", "Coder", ",", "\u0120\u010a\u010a", "#", "\u0120import", "\u0120scipy", ".misc", "\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120select", "\u0120scipy", ".misc", ".com", "b", "\u0120(", "old", "\u0120version", ")", "\u0120\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120*", "a", "\u0120=", "\u0120(", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120sys", ".stdin", ".read", "().", "split", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[i", "]", "\u0120-=", "\u0120(", "i", "\u0120+", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120statistics", ".median", "(a", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", ".count", "(stat", "istics", ".median", "_high", "(a", "))", "\u0120>=", "\u0120a", ".count", "(stat", "istics", ".median", "_low", "(a", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120statistics", ".median", "_high", "(a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120statistics", ".median", "_low", "(a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120sum", "([", "abs", "(a", "[i", "]", "\u0120-", "\u0120b", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")])\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120execute", "\u0120only", "\u0120if", "\u0120run", "\u0120as", "\u0120a", "\u0120script", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()", "\u010a\u010a\u010a\u010a\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378]} +{"problem_id": "p03416", "input": "def findSumDigit(num):\n\n global total\n\n total = \"\"\n\n while num > 0:\n\n total += str(num % 10)\n\n num //= 10\n\n return total\n\n\n\ndef main():\n\n a,b = list(map(int, input().split()))\n\n ans = 0\n\n for i in range(a,b+1):\n\n tmp = str(findSumDigit(i))\n\n if tmp == str(i):\n\n ans += 1\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()", "input_tokens": ["def", "\u0120find", "Sum", "Digit", "(num", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120global", "\u0120total", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120total", "\u0120=", "\u0120\"\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120num", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120total", "\u0120+=", "\u0120str", "(num", "\u0120%", "\u0120", "1", "0", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120//=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120total", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120str", "(find", "Sum", "Digit", "(i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "\u0120==", "\u0120str", "(i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03680", "input": "N = int(input())\n\na = [int(input()) for i in range(N)]\n\nnow = a[0]\n\ncount = 1\n\nc = 0\n\nfor i in range(10**6):\n\n if now != 2:\n\n count += 1\n\n now = a[now - 1]\n\n else:\n\n print(count)\n\n c = 1\n\n break\n\nif c == 0:\n\n print((-1))\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "now", "\u0120=", "\u0120a", "[", "0", "]\u010a\u010a", "count", "\u0120=", "\u0120", "1", "\u010a\u010a", "c", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "**", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120now", "\u0120!=", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120now", "\u0120=", "\u0120a", "[now", "\u0120-", "\u0120", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(count", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "if", "\u0120c", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p02386", "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "a", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "def", "\u0120f", "():\u010a\u010a", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120", "\u0120d", "=a", "[i", "][:", "];", "d", "[", "3", "],", "d", "[", "4", "]=", "d", "[", "4", "],", "d", "[", "3", "]\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",n", "):\u010a\u010a", "\u0120\u0120", "\u0120e", "=a", "[j", "][:", "];", "e", "[", "3", "],", "e", "[", "4", "]=", "e", "[", "4", "],", "e", "[", "3", "]\u010a\u010a", "\u0120\u0120", "\u0120for", "\u0120p", "\u0120in", "([", "0", ",", "1", ",", "2", ",", "3", ",", "4", ",", "5", "],[", "1", ",", "5", ",", "2", ",", "0", ",", "4", ",", "3", "],[", "2", ",", "1", ",", "5", ",", "3", ",", "0", ",", "4", "],[", "3", ",", "0", ",", "2", ",", "5", ",", "4", ",", "1", "],[", "4", ",", "1", ",", "0", ",", "3", ",", "5", ",", "2", "],[", "5", ",", "1", ",", "4", ",", "3", ",", "2", ",", "0", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "=[", "d", "[k", "]", "for", "\u0120k", "\u0120in", "\u0120p", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120f", "[", "0", "]==", "e", "[", "0", "]", "and", "\u0120f", "[", "5", "]==", "e", "[", "5", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120f", "=f", "[", "1", ":", "5", "]*", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "4", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120f", "[k", ":k", "+", "4", "]==", "e", "[", "1", ":", "5", "]:", "return", "'", "No", "'\u010a\u010a", "\u0120return", "'", "Yes", "'\u010a\u010a", "print", "((", "f", "()))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02952", "input": "N = int(input())\n\n\n\nans = 0\n\n\n\nfor i in range(1, N+1):\n\n if len(str(i))%2==1:\n\n ans += 1\n\n\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(str", "(i", "))", "%", "2", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03425", "input": "import itertools\n\nfrom collections import Counter\n\nN = int(input())\n\nsrc = [input() for i in range(N)]\n\nctr = Counter()\n\nfor s in src:\n\n ctr[s[0]] += 1\n\n\n\nans = 0\n\nfor ptn in itertools.combinations('MARCH',3):\n\n a,b,c = ptn\n\n ans += ctr[a]*ctr[b]*ctr[c]\n\nprint(ans)", "input_tokens": ["import", "\u0120itertools", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "src", "\u0120=", "\u0120[", "input", "()", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "ctr", "\u0120=", "\u0120Counter", "()\u010a\u010a", "for", "\u0120s", "\u0120in", "\u0120src", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ctr", "[s", "[", "0", "]]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120p", "tn", "\u0120in", "\u0120itertools", ".com", "binations", "('", "M", "ARCH", "',", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "\u0120=", "\u0120p", "tn", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120ctr", "[a", "]*", "ctr", "[b", "]*", "ctr", "[c", "]\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02952", "input": "N = int(input())\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n num_dig = 0\n\n ii = i\n\n while ii > 0:\n\n ii = int(ii / 10)\n\n num_dig += 1\n\n if num_dig % 2 != 0:\n\n count += 1\n\n\n\nprint(count)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "_d", "ig", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ii", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120ii", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ii", "\u0120=", "\u0120int", "(ii", "\u0120/", "\u0120", "1", "0", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "_d", "ig", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120num", "_d", "ig", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02801", "input": "from string import ascii_lowercase as lower\n\nprint((lower[lower.find(input())+1]))", "input_tokens": ["from", "\u0120string", "\u0120import", "\u0120ascii", "_lowercase", "\u0120as", "\u0120lower", "\u010a\u010a", "print", "((", "lower", "[", "lower", ".find", "(input", "())", "+", "1", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03634", "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]//g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.pop()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n", "input_tokens": ["#!", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "import", "\u0120bis", "ect", "\u010a\u010a", "import", "\u0120random", "\u010a\u010a", "def", "\u0120LI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120I", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120LS", "():", "return", "\u0120list", "(map", "(list", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120S", "():", "\u0120return", "\u0120list", "(sys", ".stdin", ".readline", "())", "[:-", "1", "]\u010a\u010a", "def", "\u0120IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120S", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120SR", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a\u010a\u010a", "#", "A", "\u010a\u010a", "\"\"\"\u010a\u010a", "def", "\u0120gcd", "(a", ",b", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120gcd", "(b", "%", "a", ",a", ")\u010a\u010a", "n", "\u0120=", "\u0120I", "()\u010a\u010a", "a", "\u0120=", "\u0120IR", "(n", ")\u010a\u010a", "l", "\u0120=", "\u0120a", "[", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "\u0120=", "\u0120gcd", "(l", ",a", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120*=", "\u0120a", "[i", "]", "//", "g", "\u010a\u010a", "print", "(l", ")\u010a\u010a", "\"\"\"", "\u010a\u010a\u010a\u010a", "#", "B", "\u010a\u010a", "n", "\u0120=", "\u0120I", "()\u010a\u010a", "v", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "[a", "].", "append", "([", "b", ",c", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "[b", "].", "append", "([", "a", ",c", "])\u010a\u010a", "Q", ",k", "\u0120=", "\u0120LI", "()\u010a\u010a", "d", "\u0120=", "\u0120[-", "1", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "d", "[k", "-", "1", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "q", "\u0120=", "\u0120deque", "()\u010a\u010a", "q", ".append", "(k", "-", "1", ")\u010a\u010a", "while", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120q", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120y", ",c", "\u0120in", "\u0120v", "[x", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[y", "]", "\u0120==", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[y", "]", "\u0120=", "\u0120d", "[x", "]+", "c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", ".append", "(y", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(Q", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",y", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "d", "[x", "]+", "d", "[y", "]))\u010a\u010a", "#", "C", "\u010a\u010a\u010a\u010a", "#", "D", "\u010a\u010a\u010a\u010a", "#", "E", "\u010a\u010a\u010a\u010a", "#", "F", "\u010a\u010a\u010a\u010a", "#", "G", "\u010a\u010a\u010a\u010a", "#", "H", "\u010a\u010a\u010a\u010a", "#", "I", "\u010a\u010a\u010a\u010a", "#", "J", "\u010a\u010a\u010a\u010a", "#", "K", "\u010a\u010a\u010a\u010a", "#", "L", "\u010a\u010a\u010a\u010a", "#", "M", "\u010a\u010a\u010a\u010a", "#", "N", "\u010a\u010a\u010a\u010a", "#", "O", "\u010a\u010a\u010a\u010a", "#", "P", "\u010a\u010a\u010a\u010a", "#", "Q", "\u010a\u010a\u010a\u010a", "#", "R", "\u010a\u010a\u010a\u010a", "#", "S", "\u010a\u010a\u010a\u010a", "#", "T", "\u010a"], "input_token_weights": [0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891]} +{"problem_id": "p04012", "input": "import string\n\nw = input()\n\nfor a in string.ascii_lowercase:\n\n cnt = 0\n\n for t in w:\n\n if t == a:\n\n cnt = cnt + 1\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")", "input_tokens": ["import", "\u0120string", "\u010a\u010a", "w", "\u0120=", "\u0120input", "()\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120string", ".ascii", "_lowercase", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120t", "\u0120in", "\u0120w", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "\u0120==", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120cnt", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "No", "\")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "print", "(\"", "Yes", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p03013", "input": "mod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(input())-1] = 1\n\n\n\ns = 0\n\nt = 1\n\n\n\nfor i in range(n):\n\n if l[i] > 0:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)", "input_tokens": ["mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "l", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120", "\u0120l", "[int", "(input", "())", "-", "1", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120", "0", "\u010a\u010a", "t", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120l", "[i", "]", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", ",", "\u0120s", "\u0120=", "\u0120", "0", ",", "\u0120t", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", ",", "\u0120s", "\u0120=", "\u0120(", "s", "+t", ")%", "mod", ",", "\u0120t", "\u010a\u010a\u010a\u010a", "print", "(t", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p03774", "input": "N,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 2*10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n", "input_tokens": ["N", ",M", "\u0120=", "\u0120[", "int", "(c", ")", "\u0120for", "\u0120c", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "ab", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120c", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "cd", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120c", "\u0120in", "\u0120range", "(M", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120mi", "\u0120=", "\u0120", "2", "*", "1", "0", "**", "9", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120abs", "(ab", "[i", "][", "0", "]-", "cd", "[j", "][", "0", "])+", "abs", "(ab", "[i", "][", "1", "]-", "cd", "[j", "][", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120mi", "\u0120>", "\u0120tmp", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mi", "\u0120=", "\u0120tmp", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120j", "+", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03416", "input": "def test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n j = list(map(int,list(str(i))))\n\n if j[0] == j[4] and j[1] == j[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n", "input_tokens": ["def", "\u0120test", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120list", "(map", "(int", ",list", "(str", "(i", "))))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "[", "0", "]", "\u0120==", "\u0120j", "[", "4", "]", "\u0120and", "\u0120j", "[", "1", "]", "\u0120==", "\u0120j", "[", "3", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(count", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120test", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02821", "input": "from bisect import bisect_left\n\nfrom bisect import bisect_right\n\n\n\nn,m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = sorted(a)\n\n\n\na_count = [0]*100010\n\na_sum = [0]*100010\n\n\n\nfor i in range(n):\n\n a_count[a[i]] += 1\n\n a_sum[a[i]] += a[i]\n\n\n\nfor i in range(100005,-1,-1):\n\n a_count[i] += a_count[i+1]\n\n a_sum[i] += a_sum[i+1]\n\n\n\ndef chk(x):\n\n case = 0\n\n for i in range(n):\n\n if 0<= x-a[i]<= 10**5+5:\n\n case += a_count[x-a[i]]\n\n elif x-a[i] < 0:\n\n case += n\n\n if case >= m:\n\n ch = True\n\n else:\n\n ch = False\n\n return ch\n\n\n\nl = 2*a[-1]+1 #NG\n\nr = 1 #OK\n\n\n\nwhile abs(r-l) > 1:\n\n kk = (r+l)//2\n\n if chk(kk):\n\n r = kk\n\n else:\n\n l = kk\n\n\n\nans = 0\n\nsm = sum(a)\n\n\n\nl = r\n\n\n\ncase = 0\n\nfor i in range(n):\n\n num = n-bisect_right(a,l-a[i]-1)\n\n case += num\n\n ans += num*a[i]*2\n\n\n\nans -= (case-m)*l\n\n\n\nprint(ans)", "input_tokens": ["from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_right", "\u010a\u010a\u010a\u010a", "n", ",m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120sorted", "(a", ")\u010a\u010a\u010a\u010a", "a", "_count", "\u0120=", "\u0120[", "0", "]*", "1", "0", "0", "0", "1", "0", "\u010a\u010a", "a", "_sum", "\u0120=", "\u0120[", "0", "]*", "1", "0", "0", "0", "1", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_count", "[a", "[i", "]]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_sum", "[a", "[i", "]]", "\u0120+=", "\u0120a", "[i", "]\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "0", "0", "0", "5", ",-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_count", "[i", "]", "\u0120+=", "\u0120a", "_count", "[i", "+", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_sum", "[i", "]", "\u0120+=", "\u0120a", "_sum", "[i", "+", "1", "]\u010a\u010a\u010a\u010a", "def", "\u0120chk", "(x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120case", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "<=", "\u0120x", "-a", "[i", "]<=", "\u0120", "1", "0", "**", "5", "+", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120case", "\u0120+=", "\u0120a", "_count", "[x", "-a", "[i", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120x", "-a", "[i", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120case", "\u0120+=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120case", "\u0120>=", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ch", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ch", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ch", "\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120", "2", "*a", "[-", "1", "]+", "1", "\u0120\u0120\u0120", "\u0120#", "NG", "\u010a\u010a", "r", "\u0120=", "\u0120", "1", "\u0120#", "OK", "\u010a\u010a\u010a\u010a", "while", "\u0120abs", "(r", "-l", ")", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120kk", "\u0120=", "\u0120(", "r", "+l", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120chk", "(k", "k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120kk", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120kk", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "sm", "\u0120=", "\u0120sum", "(a", ")\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120r", "\u010a\u010a\u010a\u010a", "case", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120n", "-b", "is", "ect", "_right", "(a", ",l", "-a", "[i", "]-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120case", "\u0120+=", "\u0120num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120num", "*a", "[i", "]*", "2", "\u010a\u010a\u010a\u010a", "ans", "\u0120-=", "\u0120(", "case", "-m", ")*", "l", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p03548", "input": "X, Y, Z = list(map(int, input().split()))\n\nfor n in range(10 ** 5, 0, -1):\n\n if X >= n * (Y + Z) + Z:\n\n break\n\nprint(n)", "input_tokens": ["X", ",", "\u0120Y", ",", "\u0120Z", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "for", "\u0120n", "\u0120in", "\u0120range", "(", "1", "0", "\u0120**", "\u0120", "5", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120X", "\u0120>=", "\u0120n", "\u0120*", "\u0120(", "Y", "\u0120+", "\u0120Z", ")", "\u0120+", "\u0120Z", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "print", "(n", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02576", "input": "array = list(map(int, input().split()))\n\nif array[0] % array[1] > 0:\n\n print(((array[0] // array[1] + 1) * array[2]))\n\nelse:\n\n print(((array[0] // array[1]) * array[2]))", "input_tokens": ["array", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "if", "\u0120array", "[", "0", "]", "\u0120%", "\u0120array", "[", "1", "]", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "array", "[", "0", "]", "\u0120//", "\u0120array", "[", "1", "]", "\u0120+", "\u0120", "1", ")", "\u0120*", "\u0120array", "[", "2", "]))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "array", "[", "0", "]", "\u0120//", "\u0120array", "[", "1", "])", "\u0120*", "\u0120array", "[", "2", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02268", "input": "N = int(input())\n\nS = list(map(int, input().split()))\n\nQ = int(input())\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n idx = int((head+tail)/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n if head == idx:\n\n return False\n\n return binary_search(target_num, head, idx-1)\n\n else:\n\n if tail == idx:\n\n return False\n\n return binary_search(target_num, idx+1, tail)\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "S", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "Q", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "T", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120binary", "_search", "(target", "_num", ",", "\u0120head", ",", "\u0120tail", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120idx", "\u0120=", "\u0120int", "((", "head", "+", "tail", ")/", "2", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120target", "_num", "\u0120==", "\u0120S", "[idx", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120target", "_num", "\u0120<", "\u0120S", "[idx", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120head", "\u0120==", "\u0120idx", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120binary", "_search", "(target", "_num", ",", "\u0120head", ",", "\u0120idx", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tail", "\u0120==", "\u0120idx", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120binary", "_search", "(target", "_num", ",", "\u0120idx", "+", "1", ",", "\u0120tail", ")\u010a\u010a\u010a\u010a\u010a\u010a", "match", "_count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120target", "_num", "\u0120in", "\u0120T", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120binary", "_search", "(target", "_num", ",", "\u0120", "0", ",", "\u0120len", "(S", ")-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120match", "_count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "((", "str", "(match", "_count", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03796", "input": "n=input()\n\nn=int(n)\n\na=1\n\nfor i in range(n):\n\n a=a*(i+1)\n\n if a>=pow(10,9)+7:\n\n a=a%(pow(10,9)+7)\n\nprint(a)", "input_tokens": ["n", "=input", "()\u010a\u010a", "n", "=int", "(n", ")\u010a\u010a", "a", "=", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=a", "*(", "i", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", ">=", "pow", "(", "1", "0", ",", "9", ")+", "7", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "=a", "%(", "pow", "(", "1", "0", ",", "9", ")+", "7", ")\u010a\u010a", "print", "(a", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p00003", "input": "import sys\n\nr = []\n\nn = int(input())\n\nl = sys.stdin.readlines()\n\nfor i in l:\n\n x, y, z = sorted([x*x for x in list(map(int, i.split()))])\n\n if x + y == z:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "r", "\u0120=", "\u0120[]\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "l", "\u0120=", "\u0120sys", ".stdin", ".readlines", "()\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120l", ":\u010a\u010a", "\u0120", "\u0120x", ",", "\u0120y", ",", "\u0120z", "\u0120=", "\u0120sorted", "([", "x", "*x", "\u0120for", "\u0120x", "\u0120in", "\u0120list", "(map", "(int", ",", "\u0120i", ".split", "()))", "])\u010a\u010a", "\u0120", "\u0120if", "\u0120x", "\u0120+", "\u0120y", "\u0120==", "\u0120z", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "YES", "\")\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03086", "input": "import re\n\nptn = re.compile(r\"(A|C|G|T)*\")\n\n\n\nS = input()\n\n\n\nans = 0\n\nfor i in range(len(S)):\n\n for j in range(len(S)):\n\n x = ptn.match(S[i:i+j+1]).group(0)\n\n if(x):\n\n ans = max(ans, len(x))\n\nprint(ans)", "input_tokens": ["import", "\u0120re", "\u010a\u010a", "pt", "n", "\u0120=", "\u0120re", ".compile", "(r", "\"(", "A", "|", "C", "|", "G", "|", "T", ")*", "\")\u010a\u010a", "\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120p", "tn", ".match", "(S", "[i", ":i", "+j", "+", "1", "]).", "group", "(", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(x", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120len", "(x", "))\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nab = c * 2\n\n\n\nres = float(\"inf\")\n\nif a + b <= ab:\n\n res = x * a + y * b\n\nelse:\n\n if x == y:\n\n res = x * ab\n\n elif x > y:\n\n for i in range(y, x + 1):\n\n cost = i * ab + (x - i) * a\n\n res = min(res, cost)\n\n else:\n\n for i in range(x, y + 1):\n\n cost = i * ab + (y - i) * b\n\n res = min(res, cost)\n\nprint(res)\n", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ab", "\u0120=", "\u0120c", "\u0120*", "\u0120", "2", "\u010a\u010a\u010a\u010a", "res", "\u0120=", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "if", "\u0120a", "\u0120+", "\u0120b", "\u0120<=", "\u0120ab", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120x", "\u0120*", "\u0120a", "\u0120+", "\u0120y", "\u0120*", "\u0120b", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120x", "\u0120*", "\u0120ab", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120x", "\u0120>", "\u0120y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(y", ",", "\u0120x", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cost", "\u0120=", "\u0120i", "\u0120*", "\u0120ab", "\u0120+", "\u0120(", "x", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120min", "(res", ",", "\u0120cost", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(x", ",", "\u0120y", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cost", "\u0120=", "\u0120i", "\u0120*", "\u0120ab", "\u0120+", "\u0120(", "y", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120min", "(res", ",", "\u0120cost", ")\u010a\u010a", "print", "(res", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nans=a*x+b*y\n\nfor ci in range(max(x,y)+1):\n\n sumc = 2*ci*c\n\n sumc += (x-ci)*a if (x-ci)>0 else 0\n\n sumc += (y-ci)*b if (y-ci)>0 else 0\n\n ans=min(ans,sumc)\n\n\n\nprint(ans)", "input_tokens": ["a", ",b", ",c", ",x", ",y", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "=a", "*x", "+b", "*y", "\u010a\u010a", "for", "\u0120ci", "\u0120in", "\u0120range", "(max", "(x", ",y", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "c", "\u0120=", "\u0120", "2", "*", "ci", "*c", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "c", "\u0120+=", "\u0120(", "x", "-ci", ")*", "a", "\u0120if", "\u0120(", "x", "-ci", ")>", "0", "\u0120else", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "c", "\u0120+=", "\u0120(", "y", "-ci", ")*", "b", "\u0120if", "\u0120(", "y", "-ci", ")>", "0", "\u0120else", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=min", "(ans", ",sum", "c", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p01105", "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p ^ e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&%s\"%\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n", "input_tokens": ["a", "=", "6", "5", "2", "8", "0", ";", "\u0120b", "=", "6", "1", "6", "8", "0", ";", "\u0120c", "=", "5", "2", "4", "2", "8", ";", "\u0120d", "=", "4", "3", "6", "9", "0", ";", "\u0120e", "=", "6", "5", "5", "3", "5", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "base", "\u0120=", "\u0120[", "a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120d", ",", "\u0120e", ",", "\u0120", "0", "]\u010a\u010a", "Q", "\u0120=", "\u0120[(", "1", ",", "\u0120el", ")", "\u0120for", "\u0120el", "\u0120in", "\u0120base", "]\u010a\u010a", "L", "\u0120=", "\u0120{", "el", ":", "\u0120", "1", "\u0120for", "\u0120el", "\u0120in", "\u0120base", "}\u010a\u010a", "H", "\u0120=", "\u0120[]\u010a\u010a", "get", "\u0120=", "\u0120L", ".get", "\u010a\u010a", "push", "\u0120=", "\u0120H", ".append", "\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ",", "\u0120p", "\u0120=", "\u0120he", "app", "op", "(Q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120L", "[p", "]", "\u0120<", "\u0120l", ":", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "+", "1", "\u0120<", "\u0120get", "(p", "\u0120^", "\u0120e", ",", "\u0120", "1", "7", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120^", "\u0120e", "]", "\u0120=", "\u0120l", "+", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+", "1", "\u0120<", "\u0120", "1", "6", ":", "\u0120he", "app", "ush", "(Q", ",", "\u0120(", "l", "+", "1", ",", "\u0120p", "\u0120^", "\u0120e", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "+", "3", "\u0120<", "\u0120", "1", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120q", ",", "\u0120r", "\u0120in", "\u0120H", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<=", "\u0120", "1", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<", "\u0120get", "(p", "\u0120&", "\u0120q", ",", "\u0120", "1", "7", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120&", "\u0120q", "]", "\u0120=", "\u0120l", "+r", "+", "3", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<", "\u0120", "1", "6", ":", "\u0120he", "app", "ush", "(Q", ",", "\u0120(", "l", "+r", "+", "3", ",", "\u0120p", "\u0120&", "\u0120q", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<", "\u0120get", "(p", "\u0120^", "\u0120q", ",", "\u0120", "1", "7", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120^", "\u0120q", "]", "\u0120=", "\u0120l", "+r", "+", "3", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<", "\u0120", "1", "6", ":", "\u0120he", "app", "ush", "(Q", ",", "\u0120(", "l", "+r", "+", "3", ",", "\u0120p", "\u0120^", "\u0120q", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120<", "\u0120", "7", ":", "\u0120push", "((", "p", ",", "\u0120l", "))\u010a\u010a", "print", "(*", "map", "(L", ".__", "getitem", "__,", "\u0120eval", "(\"", "e", "&", "%", "s", "\"%", "\",", "e", "&", "\".", "join", "(open", "(", "0", ").", "read", "().", "replace", "(*", "\"-", "~", "\").", "replace", "(*", "\"*", "&", "\").", "replace", "(*", "\"", "1", "e", "\").", "split", "()", "[:-", "1", "]))", "),", "sep", "='\\", "n", "')\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646]} +{"problem_id": "p04020", "input": "def examB():\n\n N = I(); A = [I() for _ in range(N)]\n\n ans = 0; cur= 0\n\n for i in A:\n\n if i==0:\n\n ans += cur//2\n\n cur = 0\n\n else:\n\n cur += i\n\n ans += cur // 2\n\n print(ans)\n\n return\n\n\n\nimport sys,copy,bisect,itertools,heapq,math\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\n\n\nif __name__ == '__main__':\n\n examB()\n", "input_tokens": ["def", "\u0120exam", "B", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120I", "();", "\u0120A", "\u0120=", "\u0120[", "I", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", ";", "\u0120cur", "=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cur", "//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120+=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cur", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", ",copy", ",b", "is", "ect", ",it", "ertools", ",", "heap", "q", ",", "math", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "op", ",", "he", "app", "ush", ",", "heap", "ify", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", ",default", "dict", ",", "deque", "\u010a\u010a", "def", "\u0120I", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120LI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120L", "SI", "():", "\u0120return", "\u0120list", "(map", "(str", ",", "sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120LS", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "split", "()\u010a\u010a", "def", "\u0120SI", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "inf", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120exam", "B", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03544", "input": "N = int(input())\n\nL = [ 0 ] * 1000000\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "L", "\u0120=", "\u0120[", "\u0120", "0", "\u0120]", "\u0120*", "\u0120", "1", "0", "0", "0", "0", "0", "0", "\u010a\u010a\u010a\u010a", "L", "[", "0", "]", "\u0120=", "\u0120", "2", "\u010a\u010a", "L", "[", "1", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120", "\u0120L", "[i", "]", "\u0120=", "\u0120L", "[i", "-", "2", "]", "\u0120+", "\u0120L", "[i", "-", "1", "]\u010a\u010a\u010a\u010a", "print", "((", "L", "[N", "]))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03013", "input": "import sys\n\nN,M=list(map(int,input().split()))\n\nS=set(map(int,sys.stdin))\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in S:\n\n a,b=b,0\n\n else:\n\n a,b=b,a+b\n\n\n\nprint((b%(10**9+7)))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "N", ",M", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "S", "=set", "(map", "(int", ",", "sys", ".stdin", "))", "\u010a\u010a\u010a\u010a", "a", ",b", "=", "0", ",", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120in", "\u0120S", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",b", "=b", ",", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",b", "=b", ",a", "+b", "\u010a\u010a\u010a\u010a", "print", "((", "b", "%(", "1", "0", "**", "9", "+", "7", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p01138", "input": "import re\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = [0] * (24*60*60+1)\n\n for _ in range(n):\n\n h1,m1,s1,h2,m2,s2 = list(map(int, re.split(':| ', input())))\n\n l[h1*60*60 + m1*60 + s1] += 1\n\n l[h2*60*60 + m2*60 + s2] -= 1\n\n r = 0\n\n for i in range(24*60*60):\n\n l[i+1] += l[i]\n\n r = max(r, l[i+1])\n\n print(r)", "input_tokens": ["import", "\u0120re", "\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "2", "4", "*", "6", "0", "*", "6", "0", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120h", "1", ",m", "1", ",s", "1", ",h", "2", ",m", "2", ",s", "2", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120re", ".split", "(':", "|", "\u0120',", "\u0120input", "()))", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[h", "1", "*", "6", "0", "*", "6", "0", "\u0120+", "\u0120m", "1", "*", "6", "0", "\u0120+", "\u0120s", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[h", "2", "*", "6", "0", "*", "6", "0", "\u0120+", "\u0120m", "2", "*", "6", "0", "\u0120+", "\u0120s", "2", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "4", "*", "6", "0", "*", "6", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[i", "+", "1", "]", "\u0120+=", "\u0120l", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120max", "(r", ",", "\u0120l", "[i", "+", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(r", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p03074", "input": "N, K = list(map(int, input().split()))\n\nS = input()\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\nleft = 0\n\nright = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n\n\n next_left = i\n\n next_right = min(i + add, len(nums))\n\n\n\n while next_left > left:\n\n tmp -= nums[left]\n\n left += 1\n\n\n\n while next_right > right:\n\n tmp += nums[right]\n\n right += 1\n\n\n\n ans = max(ans, tmp)\n\nprint(ans)", "input_tokens": ["N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a", "nums", "\u0120=", "\u0120[]\u010a\u010a", "now", "\u0120=", "\u0120", "1", "\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", "]", "\u0120==", "\u0120str", "(now", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nums", ".append", "(cnt", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120now", "\u0120=", "\u0120", "1", "\u0120-", "\u0120now", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120cnt", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120nums", ".append", "(cnt", ")\u010a\u010a", "if", "\u0120len", "(nums", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120nums", ".append", "(", "0", ")\u010a\u010a\u010a\u010a", "add", "\u0120=", "\u0120", "2", "\u0120*", "\u0120K", "\u0120+", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "left", "\u0120=", "\u0120", "0", "\u010a\u010a", "right", "\u0120=", "\u0120", "0", "\u010a\u010a", "tmp", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120len", "(nums", "),", "\u0120", "2", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120next", "_left", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120next", "_right", "\u0120=", "\u0120min", "(i", "\u0120+", "\u0120add", ",", "\u0120len", "(nums", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120next", "_left", "\u0120>", "\u0120left", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120-=", "\u0120nums", "[left", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120left", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120next", "_right", "\u0120>", "\u0120right", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120nums", "[right", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120right", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120tmp", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734]} +{"problem_id": "p03424", "input": "n=int(input())\n\ns=list(map(str,input().split()))\n\ntotal=[]\n\nfor i in range(n):\n\n if s[i] not in total:\n\n total.append(s[i])\n\nprint(('Three' if len(total)==3 else 'Four'))", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "s", "=list", "(map", "(str", ",input", "().", "split", "()))\u010a\u010a", "total", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120not", "\u0120in", "\u0120total", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120total", ".append", "(s", "[i", "])\u010a\u010a", "print", "(('", "Three", "'", "\u0120if", "\u0120len", "(total", ")==", "3", "\u0120else", "\u0120'", "Four", "'))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03164", "input": "import sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = [float('inf')] * 1000 * 100*10\n\nvs = set()\n\nvs.add(0)\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n tmpDP = dp.copy()\n\n for vv in list(vs):\n\n if dp[vv + v] > dp[vv] + w:\n\n tmpDP[vv + v] = dp[vv] + w\n\n vs.add(vv + v)\n\n dp = tmpDP\n\n\n\n\n\nans = 0\n\nfor v in list(vs):\n\n if dp[v] <= W:\n\n ans = max(ans, v)\n\nprint(ans)\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", ",", "\u0120deque", ",", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120accumulate", ",", "\u0120permutations", ",", "\u0120combinations", ",", "\u0120tak", "ew", "h", "ile", ",", "\u0120compress", ",", "\u0120cycle", "\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120ceil", ",", "\u0120floor", ",", "\u0120log", "1", "0", ",", "\u0120log", "2", ",", "\u0120factorial", "\u010a\u010a", "from", "\u0120pprint", "\u0120import", "\u0120pprint", "\u010a\u010a\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", "0", ")\u010a\u010a", "#", "\u0120MOD", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "#", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "#", "\u0120A", "\u0120=", "\u0120[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "#", "\u0120V", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120", "1", "0", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "1", "0", "0", ")]\u010a\u010a", "#", "\u0120A", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120W", "\u0120=", "\u0120[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[", "float", "('", "inf", "')]", "\u0120*", "\u0120", "1", "0", "0", "0", "\u0120*", "\u0120", "1", "0", "0", "*", "1", "0", "\u010a\u010a", "vs", "\u0120=", "\u0120set", "()\u010a\u010a", "vs", ".add", "(", "0", ")\u010a\u010a", "dp", "[", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", ",", "\u0120v", "\u0120=", "\u0120[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "DP", "\u0120=", "\u0120dp", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120vv", "\u0120in", "\u0120list", "(vs", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[v", "v", "\u0120+", "\u0120v", "]", "\u0120>", "\u0120dp", "[v", "v", "]", "\u0120+", "\u0120w", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "DP", "[v", "v", "\u0120+", "\u0120v", "]", "\u0120=", "\u0120dp", "[v", "v", "]", "\u0120+", "\u0120w", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120vs", ".add", "(v", "v", "\u0120+", "\u0120v", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120tmp", "DP", "\u010a\u010a\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120v", "\u0120in", "\u0120list", "(vs", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[v", "]", "\u0120<=", "\u0120W", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120v", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p03796", "input": "from math import factorial\n\nN = int(input())\n\nprint((factorial(N) % (10**9 + 7)))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "factor", "ial", "(N", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p00005", "input": "import math\n\nwhile True:\n\n\ttry:\n\n\t\tx,y = list(map(int,input().split()))\n\n\t\tprint('%d %d' % (math.gcd(x,y),x/math.gcd(x,y)*y))\n\n\texcept EOFError:\n\n\t\tbreak", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0109try", ":\u010a\u010a", "\u0109", "\u0109x", ",y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0109", "\u0109print", "('%", "d", "\u0120%", "d", "'", "\u0120%", "\u0120(", "math", ".g", "cd", "(x", ",y", "),", "x", "/math", ".g", "cd", "(x", ",y", ")*", "y", "))\u010a\u010a", "\u0109except", "\u0120EOF", "Error", ":\u010a\u010a", "\u0109", "\u0109break"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p02881", "input": "n = int(input())\n\nr = int(n**.5)\n\nfor i in range(r):\n\n if n % (r-i) == 0:\n\n print(( (r-i) + n//(r-i) - 2 ))\n\n break", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "r", "\u0120=", "\u0120int", "(n", "**", ".", "5", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(r", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120(", "r", "-i", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "\u0120(", "r", "-i", ")", "\u0120+", "\u0120n", "//(", "r", "-i", ")", "\u0120-", "\u0120", "2", "\u0120))\u010a\u010a", "\u0120\u0120\u0120", "\u0120break"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229]} +{"problem_id": "p03253", "input": "from collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:\n\n\t\treturn [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn //= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:\n\n\t\tret.append(n)\n\n\treturn ret\n\n\n\nn,m = list(map(int,input().split()))\n\nmod = 10**9+7\n\nif m==1:\n\n\tprint((1));exit()\n\n\n\nfactors = Counter(factorization(m))\n\nmx = n+max(factors.values())\n\n\n\nfac = [1]*(mx+1)\n\ninv = [1]*(mx+1)\n\nfor i in range(1,mx+1):\n\n\tfac[i] = fac[i-1] * i % mod\n\ninv[-1] = pow(fac[-1], mod - 2, mod)\n\nfor i in range(mx-1, -1, -1):\n\n\tinv[i] = inv[i+1] * (i+1) % mod\n\ndef cmb(n,r):\n\n\tassert n >= r >= 0\n\n\treturn fac[n] * inv[n-r] * inv[r] % mod\n\n\t\n\nans=1\n\nfor v in list(factors.values()):\n\n\tans*=cmb(n+v-1,v)\n\n\tans%=mod\n\n\n\nprint(ans)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "def", "\u0120factor", "ization", "(n", ")", "\u0120->", "\u0120list", ":\u010a\u010a", "\u0109if", "\u0120n", "==", "1", ":\u010a\u010a", "\u0109", "\u0109return", "\u0120[", "1", "]\u010a\u010a", "\u0109ret", "\u0120=", "\u0120[]\u010a\u010a", "\u0109i", "\u0120=", "\u0120", "2", "\u010a\u010a", "\u0109while", "\u0120i", "*i", "<=", "n", ":\u010a\u010a", "\u0109", "\u0109while", "\u0120n", "%i", "==", "0", ":\u010a\u010a", "\u0109\u0109", "\u0109n", "\u0120//=", "\u0120i", "\u010a\u010a", "\u0109\u0109", "\u0109ret", ".append", "(i", ")\u010a\u010a", "\u0109", "\u0109i", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0109if", "\u0120n", "!=", "1", ":\u010a\u010a", "\u0109", "\u0109ret", ".append", "(n", ")\u010a\u010a", "\u0109return", "\u0120ret", "\u010a\u010a\u010a\u010a", "n", ",m", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "if", "\u0120m", "==", "1", ":\u010a\u010a", "\u0109print", "((", "1", "));", "exit", "()\u010a\u010a\u010a\u010a", "f", "actors", "\u0120=", "\u0120Counter", "(factor", "ization", "(m", "))\u010a\u010a", "mx", "\u0120=", "\u0120n", "+", "max", "(f", "actors", ".values", "())\u010a\u010a", "\u010a\u010a", "fac", "\u0120=", "\u0120[", "1", "]*(", "mx", "+", "1", ")\u010a\u010a", "inv", "\u0120=", "\u0120[", "1", "]*(", "mx", "+", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",m", "x", "+", "1", "):\u010a\u010a", "\u0109f", "ac", "[i", "]", "\u0120=", "\u0120fac", "[i", "-", "1", "]", "\u0120*", "\u0120i", "\u0120%", "\u0120mod", "\u010a\u010a", "inv", "[-", "1", "]", "\u0120=", "\u0120pow", "(f", "ac", "[-", "1", "],", "\u0120mod", "\u0120-", "\u0120", "2", ",", "\u0120mod", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(mx", "-", "1", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0109", "inv", "[i", "]", "\u0120=", "\u0120inv", "[i", "+", "1", "]", "\u0120*", "\u0120(", "i", "+", "1", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "def", "\u0120cmb", "(n", ",r", "):\u010a\u010a", "\u0109assert", "\u0120n", "\u0120>=", "\u0120r", "\u0120>=", "\u0120", "0", "\u010a\u010a", "\u0109return", "\u0120fac", "[n", "]", "\u0120*", "\u0120inv", "[n", "-r", "]", "\u0120*", "\u0120inv", "[r", "]", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0109\u010a\u010a", "ans", "=", "1", "\u010a\u010a", "for", "\u0120v", "\u0120in", "\u0120list", "(f", "actors", ".values", "())", ":\u010a\u010a", "\u0109ans", "*=", "cmb", "(n", "+v", "-", "1", ",v", ")\u010a\u010a", "\u0109ans", "%=", "mod", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312]} +{"problem_id": "p02725", "input": "K, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\ndiff = A[0] + K - A[-1]\n\nans = A[-1] - A[0]\n\nfor i in range(1, N):\n\n dist = K - A[i] + A[i - 1]\n\n if dist < ans:\n\n ans = dist\n\n\n\nprint(ans)\n", "input_tokens": ["K", ",", "\u0120N", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "diff", "\u0120=", "\u0120A", "[", "0", "]", "\u0120+", "\u0120K", "\u0120-", "\u0120A", "[-", "1", "]\u010a\u010a", "ans", "\u0120=", "\u0120A", "[-", "1", "]", "\u0120-", "\u0120A", "[", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120dist", "\u0120=", "\u0120K", "\u0120-", "\u0120A", "[i", "]", "\u0120+", "\u0120A", "[i", "\u0120-", "\u0120", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dist", "\u0120<", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120dist", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03371", "input": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = float('inf')\n\n for i in range(0, max(X, Y)*2+1, 2):\n\n ans = min(A*max(X-i//2, 0)+B*max(Y-i//2, 0)+C*i, ans)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120lambda", ":", "\u0120sys", ".stdin", ".readline", "().", "rstrip", "()", "\u0120\u010a\u010a\u010a\u010a", "def", "\u0120resolve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120max", "(X", ",", "\u0120Y", ")*", "2", "+", "1", ",", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(A", "*", "max", "(X", "-i", "//", "2", ",", "\u0120", "0", ")+", "B", "*", "max", "(Y", "-i", "//", "2", ",", "\u0120", "0", ")+", "C", "*i", ",", "\u0120ans", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120resolve", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03416", "input": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n i = str(i)\n\n if i[0] == i[4]:\n\n if i[1] == i[3]:\n\n ans += 1\n\n else:\n\n ans += 0\n\n else:\n\n ans += 0\n\nprint(ans)", "input_tokens": ["A", ",B", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(A", ",B", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "[", "0", "]", "\u0120==", "\u0120i", "[", "4", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "[", "1", "]", "\u0120==", "\u0120i", "[", "3", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "0", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p03568", "input": "def main():\n\n N = int(input())\n\n A = [int(i) for i in input().split()]\n\n if N == 1:\n\n return print(1 if A[0] % 2 == 0 else 2)\n\n ans = 0\n\n d = (-1, 0, 1)\n\n from itertools import product\n\n for i in product(range(3), repeat=N):\n\n cur = 1\n\n for j in range(N):\n\n cur *= (A[j] + d[i[j]])\n\n if cur % 2 == 0:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120N", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120print", "(", "1", "\u0120if", "\u0120A", "[", "0", "]", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", "\u0120else", "\u0120", "2", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120(-", "1", ",", "\u0120", "0", ",", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120from", "\u0120itertools", "\u0120import", "\u0120product", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120product", "(range", "(", "3", "),", "\u0120repeat", "=N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120*=", "\u0120(", "A", "[j", "]", "\u0120+", "\u0120d", "[i", "[j", "]])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cur", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03425", "input": "# -*- coding: utf-8 -*-\n\nfrom collections import defaultdict\n\nfrom itertools import combinations\n\nN = int(input())\n\nC = [0, 0, 0, 0, 0, 0]\n\nD = defaultdict(int)\n\nfor i, m in enumerate(\"MARCH\", start=1):\n\n D[m] = i\n\n\n\nfor _ in range(N):\n\n C[D[input()[0]]] += 1\n\n\n\nans = 0\n\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n\n ans += C[a]*C[b]*C[c]\n\nprint(ans)", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120combinations", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "C", "\u0120=", "\u0120[", "0", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "]\u010a\u010a", "D", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "for", "\u0120i", ",", "\u0120m", "\u0120in", "\u0120enumerate", "(\"", "M", "ARCH", "\",", "\u0120start", "=", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120D", "[m", "]", "\u0120=", "\u0120i", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "[D", "[input", "()[", "0", "]]", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120combinations", "(list", "(range", "(", "1", ",", "\u0120", "6", ")),", "\u0120r", "=", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120C", "[a", "]*", "C", "[b", "]*", "C", "[c", "]\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\n\n\nprint((math.factorial(N) % (1000000000 + 7)))\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(N", ")", "\u0120%", "\u0120(", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "\u0120+", "\u0120", "7", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03309", "input": "def main():\n\n from statistics import median\n\n\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n m = int(median(a))\n\n\n\n ans = sum([abs(x - m) for x in a])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120from", "\u0120statistics", "\u0120import", "\u0120median", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120*", "a", ",", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120[", "x", "\u0120-", "\u0120i", "\u0120for", "\u0120i", ",", "\u0120x", "\u0120in", "\u0120enumerate", "(a", ",", "\u0120", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120int", "(m", "edian", "(a", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120sum", "([", "abs", "(x", "\u0120-", "\u0120m", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120a", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03037", "input": "N, M = list(map(int, input().split()))\n\nL, R = [], []\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n", "input_tokens": ["N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", ",", "\u0120R", "\u0120=", "\u0120[],", "\u0120[]\u010a\u010a", "low", "\u0120=", "\u0120-", "float", "('", "INF", "')\u010a\u010a", "high", "\u0120=", "\u0120float", "('", "INF", "')\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ",", "\u0120r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", ".append", "(l", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", ".append", "(r", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120>", "\u0120low", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120low", "\u0120=", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120<", "\u0120high", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120high", "\u0120=", "\u0120r", "\u010a\u010a", "print", "((", "max", "(", "0", ",", "\u0120high", "\u0120-", "\u0120low", "\u0120+", "\u0120", "1", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293]} +{"problem_id": "p02555", "input": "a,b,c=1,0,0\n\nexec('a,b,c=b,c,(a+c)%(10**9+7);'*(int(input())-2))\n\nprint(c)", "input_tokens": ["a", ",b", ",c", "=", "1", ",", "0", ",", "0", "\u010a\u010a", "exec", "('", "a", ",b", ",c", "=b", ",c", ",(", "a", "+c", ")", "%(", "1", "0", "**", "9", "+", "7", ");", "'", "*(", "int", "(input", "())", "-", "2", "))\u010a\u010a", "print", "(c", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\n\n\nz = max(x,y) * 2\n\nmin_sum = c * z\n\n\n\nfor i in range(z):\n\n r = max(0, y - i) * b\n\n t = max(0, x - i) * a\n\n sum = c * i * 2 + r + t\n\n if sum < min_sum:\n\n min_sum = sum\n\n\n\nprint(min_sum)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "z", "\u0120=", "\u0120max", "(x", ",y", ")", "\u0120*", "\u0120", "2", "\u010a\u010a", "min", "_sum", "\u0120=", "\u0120c", "\u0120*", "\u0120z", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(z", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120max", "(", "0", ",", "\u0120y", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120max", "(", "0", ",", "\u0120x", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "\u0120=", "\u0120c", "\u0120*", "\u0120i", "\u0120*", "\u0120", "2", "\u0120+", "\u0120r", "\u0120+", "\u0120t", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120sum", "\u0120<", "\u0120min", "_sum", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120min", "_sum", "\u0120=", "\u0120sum", "\u010a\u010a\u010a\u010a", "print", "(min", "_sum", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03796", "input": "N = int(input())\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120n", "\u0120in", "\u0120range", "(", "2", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120a", "*n", "\u0120%", "\u0120(", "1", "0", "**", "9", "+", "7", ")\u010a\u010a", "print", "(a", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03170", "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom operator import xor\n\nfrom functools import reduce\n\n\n\nN,K,*A = list(map(int,read().split()))\n\n\n\na = reduce(xor,(1<= 3600:\n\n h=S//3600\n\n m=S%3600//60\n\n s=S%60\n\nelif 3600 > S >= 60:\n\n h=0\n\n m=S//60\n\n s=S%60\n\nelse:\n\n h=m=0\n\n s=S\n\nprint(h, m, s, sep=\":\")\n", "input_tokens": ["S", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "if", "\u0120S", "\u0120>=", "\u0120", "3", "6", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", "=S", "//", "3", "6", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "=S", "%", "3", "6", "0", "0", "//", "6", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=S", "%", "6", "0", "\u010a\u010a", "elif", "\u0120", "3", "6", "0", "0", "\u0120>", "\u0120S", "\u0120>=", "\u0120", "6", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "=S", "//", "6", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=S", "%", "6", "0", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", "=m", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=S", "\u010a\u010a", "print", "(h", ",", "\u0120m", ",", "\u0120s", ",", "\u0120sep", "=\"", ":\")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9367265554405826, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03806", "input": "def main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1<<30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(400, -1, -1):\n\n\t\t\tfor j in range(400, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\nif __name__==\"__main__\":\n\n\tmain()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0109n", ",", "\u0120ma", ",", "\u0120mb", ",", "\u0120*", "L", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))\u010a\u010a", "\u0109M", "\u0120=", "\u0120", "1", "<<", "3", "0", "\u010a\u010a", "\u0109dp", "\u0120=", "\u0120[[", "M", "]", "\u0120*", "\u0120", "4", "2", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "4", "2", "0", ")]\u010a\u010a", "\u0109dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0109for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120zip", "(*", "[", "iter", "(L", ")]", "\u0120*", "\u0120", "3", "):\u010a\u010a", "\u0109", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "0", "0", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0109\u0109", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(", "4", "0", "0", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0109\u0109\u0109", "\u0109t", "\u0120=", "\u0120dp", "[i", "][", "j", "]", "\u0120+", "\u0120c", "\u010a\u010a", "\u0109\u0109\u0109", "\u0109if", "\u0120dp", "[i", "\u0120+", "\u0120a", "][", "j", "\u0120+", "\u0120b", "]", "\u0120>", "\u0120t", ":\u010a\u010a", "\u0109\u0109\u0109\u0109", "\u0109dp", "[i", "\u0120+", "\u0120a", "][", "j", "\u0120+", "\u0120b", "]", "\u0120=", "\u0120t", "\u010a\u010a", "\u0109ans", "\u0120=", "\u0120M", "\u010a\u010a", "\u0109", "_ma", ",", "\u0120_", "mb", "\u0120=", "\u0120ma", ",", "\u0120mb", "\u010a\u010a", "\u0109while", "\u0120_", "ma", "\u0120<", "\u0120", "4", "1", "0", "\u0120>", "\u0120_", "mb", ":\u010a\u010a", "\u0109", "\u0109ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120dp", "[_", "ma", "][_", "mb", "])\u010a\u010a", "\u0109", "\u0109", "_ma", "\u0120+=", "\u0120ma", "\u010a\u010a", "\u0109", "\u0109", "_mb", "\u0120+=", "\u0120mb", "\u010a\u010a", "\u0109print", "((", "ans", "\u0120if", "\u0120ans", "\u0120<", "\u0120M", "\u0120else", "\u0120-", "1", "))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "==\"", "__", "main", "__", "\":\u010a\u010a", "\u0109main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046]} +{"problem_id": "p03434", "input": "_,s=open(c:=0)\n\nfor a in sorted(map(int,s.split())):c=a-c\n\nprint(c)", "input_tokens": ["_,", "s", "=open", "(c", ":=", "0", ")\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120sorted", "(map", "(int", ",s", ".split", "()))", ":", "c", "=a", "-c", "\u010a\u010a", "print", "(c", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03854", "input": "s = input()\n\nt = \"\"\n\nwhile len(t) < len(s):\n\n target_len = len(s) - len(t)\n\n\n\n if s[len(t)] == 'd':\n\n if target_len == 5:\n\n t += \"dream\"\n\n elif target_len == 7:\n\n t += \"dreamer\"\n\n elif target_len > 7:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 7 + 1] != \"era\":\n\n t += \"dreamer\"\n\n else:\n\n t += \"dream\"\n\n else:\n\n break\n\n else:\n\n if target_len == 5:\n\n t += \"erase\"\n\n elif target_len == 6:\n\n t += \"eraser\"\n\n elif target_len > 6:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 6 + 2] != \"era\":\n\n t += \"eraser\"\n\n else:\n\n t += \"erase\"\n\n else:\n\n break\n\n\n\n if s[0:len(t)] != t:\n\n break\n\n\n\nprint((\"YES\" if s == t else \"NO\"))\n", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a", "t", "\u0120=", "\u0120\"\"\u010a\u010a", "while", "\u0120len", "(t", ")", "\u0120<", "\u0120len", "(s", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120target", "_len", "\u0120=", "\u0120len", "(s", ")", "\u0120-", "\u0120len", "(t", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[len", "(t", ")]", "\u0120==", "\u0120'", "d", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120target", "_len", "\u0120==", "\u0120", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "dream", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120target", "_len", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "dream", "er", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120target", "_len", "\u0120>", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[len", "(t", ")", "\u0120+", "\u0120", "5", "]", "\u0120!=", "\u0120'", "d", "'", "\u0120and", "\u0120s", "[len", "(t", ")", "\u0120+", "\u0120", "5", ":len", "(t", ")", "\u0120+", "\u0120", "7", "\u0120+", "\u0120", "1", "]", "\u0120!=", "\u0120\"", "era", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "dream", "er", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "dream", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120target", "_len", "\u0120==", "\u0120", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "erase", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120target", "_len", "\u0120==", "\u0120", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "eras", "er", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120target", "_len", "\u0120>", "\u0120", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[len", "(t", ")", "\u0120+", "\u0120", "5", "]", "\u0120!=", "\u0120'", "d", "'", "\u0120and", "\u0120s", "[len", "(t", ")", "\u0120+", "\u0120", "5", ":len", "(t", ")", "\u0120+", "\u0120", "6", "\u0120+", "\u0120", "2", "]", "\u0120!=", "\u0120\"", "era", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "eras", "er", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "erase", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[", "0", ":len", "(t", ")]", "\u0120!=", "\u0120t", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "print", "((\"", "YES", "\"", "\u0120if", "\u0120s", "\u0120==", "\u0120t", "\u0120else", "\u0120\"", "NO", "\"))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.6673426178365944, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348]} +{"problem_id": "p00134", "input": "from statistics import mean\n\n\n\ninputCount = int(input())\n\nprices = [int(input()) for lp in range(inputCount)]\n\naverage = mean(prices)\n\nprint((int(average)))\n\n\n", "input_tokens": ["from", "\u0120statistics", "\u0120import", "\u0120mean", "\u010a\u010a\u010a\u010a", "input", "Count", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "prices", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120lp", "\u0120in", "\u0120range", "(input", "Count", ")]\u010a\u010a", "average", "\u0120=", "\u0120mean", "(pr", "ices", ")\u010a\u010a", "print", "((", "int", "(", "average", ")))\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03559", "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\nA = sorted(inpl())\n\nB = sorted(inpl())\n\nC = sorted(inpl())\n\ncnt = [0] * n\n\nres = 0\n\nfor i,b in enumerate(B):\n\n c = bisect.bisect_left(C,b+1)\n\n cnt[i] = n-c\n\n\n\nacc = [0]\n\nfor x in cnt:\n\n acc += [acc[-1] + x]\n\nsu = sum(cnt) \n\nfor i,a in enumerate(A):\n\n c = bisect.bisect_left(B,a+1)\n\n res += su - acc[c]\n\nprint(res)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", ",default", "dict", ",", "deque", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "op", ",", "he", "app", "ush", ",", "heap", "ify", "\u010a\u010a", "import", "\u0120sys", ",b", "is", "ect", ",", "math", ",it", "ertools", ",", "math", ",", "pp", "rint", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "8", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "def", "\u0120inp", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120in", "pl", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120inp", "()\u010a\u010a", "A", "\u0120=", "\u0120sorted", "(in", "pl", "())\u010a\u010a", "B", "\u0120=", "\u0120sorted", "(in", "pl", "())\u010a\u010a", "C", "\u0120=", "\u0120sorted", "(in", "pl", "())\u010a\u010a", "cnt", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120n", "\u010a\u010a", "res", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", ",b", "\u0120in", "\u0120enumerate", "(B", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_left", "(C", ",b", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "[i", "]", "\u0120=", "\u0120n", "-c", "\u010a\u010a\u010a\u010a", "acc", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120cnt", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120acc", "\u0120+=", "\u0120[", "acc", "[-", "1", "]", "\u0120+", "\u0120x", "]\u010a\u010a", "su", "\u0120=", "\u0120sum", "(cnt", ")", "\u0120\u010a\u010a", "for", "\u0120i", ",a", "\u0120in", "\u0120enumerate", "(A", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_left", "(B", ",a", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120+=", "\u0120su", "\u0120-", "\u0120acc", "[c", "]\u010a\u010a", "print", "(res", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p02552", "input": "x = int(input())\n\nprint((0 if x==1 else 1))", "input_tokens": ["x", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "0", "\u0120if", "\u0120x", "==", "1", "\u0120else", "\u0120", "1", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02268", "input": "def binarySearch():\n\n n = int(input())\n\n S = set(map(int, input().split()))\n\n q = int(input())\n\n T = set(map(int, input().split()))\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()", "input_tokens": ["def", "\u0120binary", "Search", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120set", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120set", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "len", "(S", ".intersection", "(T", "))))\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a", "binary", "Search", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03416", "input": "a,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])\n\n str1=buf[0:int(len(buf)/2)]\n\n str2=buf[int(len(buf)/2+1):]\n\n if str1[0]==str2[1] and str1[1]==str2[0]:\n\n ans+=1\n\n\n\nprint(ans)\n", "input_tokens": ["a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "=", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120buf", "=str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "print", "(buf", "[", "0", ":int", "(len", "(buf", ")/", "2", ")],", "buf", "[int", "(len", "(buf", ")/", "2", "+", "1", "):", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120str", "1", "=", "buf", "[", "0", ":int", "(len", "(buf", ")/", "2", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120str", "2", "=", "buf", "[int", "(len", "(buf", ")/", "2", "+", "1", "):", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120str", "1", "[", "0", "]==", "str", "2", "[", "1", "]", "\u0120and", "\u0120str", "1", "[", "1", "]==", "str", "2", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03720", "input": "n, m = list(map(int, input().split()))\n\nRD = list(list(map(int, input().split())) for _ in range(m))\n\nfor i in range(1, n + 1):\n\n ans = 0\n\n for j in RD:\n\n ans += j.count(i)\n\n print(ans)", "input_tokens": ["n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "RD", "\u0120=", "\u0120list", "(list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(m", "))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120RD", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120j", ".count", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03325", "input": "N = int(input())\n\nx = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in x:\n\n while i % 2 == 0:\n\n cnt += 1\n\n i /= 2\n\nprint(cnt)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "x", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120x", ":\u010a\u010a", "\u0120", "\u0120while", "\u0120i", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120/=", "\u0120", "2", "\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p02649", "input": "def popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50 and j!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\nfor i in range(2**n):\n\n t=set([])\n\n for a in A:\n\n data[a&i]+=1\n\n t.add(a&i)\n\n temp=0\n\n for val in t:\n\n temp+=cmb[data[val]][min(K,data[val])]\n\n ans+=temp*(-1)**popcount(i)\n\n for val in t:\n\n data[val]=0\n\n\n\nprint(ans)\n", "input_tokens": ["def", "\u0120pop", "count", "(x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120x", "\u0120-", "\u0120((", "x", "\u0120>>", "\u0120", "1", ")", "\u0120&", "\u0120", "0", "x", "5", "5", "5", "5", "5", "5", "5", "5", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "\u0120&", "\u0120", "0", "x", "3", "3", "3", "3", "3", "3", "3", "3", ")", "\u0120+", "\u0120((", "x", "\u0120>>", "\u0120", "2", ")", "\u0120&", "\u0120", "0", "x", "3", "3", "3", "3", "3", "3", "3", "3", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "\u0120+", "\u0120(", "x", "\u0120>>", "\u0120", "4", "))", "\u0120&", "\u0120", "0", "x", "0", "f", "0", "f", "0", "f", "0", "f", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120x", "\u0120+", "\u0120(", "x", "\u0120>>", "\u0120", "8", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120x", "\u0120+", "\u0120(", "x", "\u0120>>", "\u0120", "1", "6", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120x", "\u0120&", "\u0120", "0", "x", "0", "0", "0", "0", "0", "0", "7", "f", "\u010a\u010a\u010a\u010a", "cmb", "=[[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "5", "1", ")]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "5", "1", ")]\u010a\u010a", "cmb", "[", "0", "][", "0", "]=", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "5", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "5", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "!=", "5", "0", "\u0120and", "\u0120j", "!=", "5", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cmb", "[i", "+", "1", "][", "j", "+", "1", "]+=", "cmb", "[i", "][", "j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "!=", "5", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cmb", "[i", "+", "1", "][", "j", "]+=", "cmb", "[i", "][", "j", "]\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "5", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "2", ",", "5", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cmb", "[i", "][", "j", "]+=", "cmb", "[i", "][", "j", "-", "1", "]\u010a\u010a\u010a\u010a", "N", ",K", ",T", ",S", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "must", "0", "=[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "8", ")", "\u0120if", "\u0120S", ">>", "i", "\u0120&", "1", "==", "0", "]\u010a\u010a", "must", "1", "=[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "8", ")", "\u0120if", "\u0120T", ">>", "i", "\u0120&", "1", "==", "1", "]\u010a\u010a\u010a\u010a", "A", "=[]", "\u010a\u010a", "for", "\u0120val", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120check", "=True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120must", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120check", "=", "check", "&(", "val", ">>", "j", "\u0120&", "1", "==", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120must", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120check", "=", "check", "&(", "val", ">>", "j", "\u0120&", "1", "==", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120check", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", ".append", "(val", ")\u010a\u010a\u010a\u010a", "if", "\u0120not", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "bit", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "8", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120not", "\u0120in", "\u0120must", "0", "\u0120and", "\u0120i", "\u0120not", "\u0120in", "\u0120must", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bit", ".append", "(i", ")\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(A", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120temp", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(bit", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", "+=(", "A", "[i", "]", ">>", "bit", "[j", "]", "\u0120&", "1", "==", "1", ")*", "2", "**", "j", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "[i", "]=", "temp", "\u010a\u010a\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "n", "=len", "(bit", ")\u010a\u010a", "data", "=[", "0", "]*(", "2", "**", "n", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "**", "n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "=set", "([]", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120data", "[a", "&", "i", "]+=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", ".add", "(a", "&", "i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120temp", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120val", "\u0120in", "\u0120t", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", "+=", "cmb", "[data", "[val", "]][", "min", "(K", ",data", "[val", "])", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "temp", "*(-", "1", ")**", "pop", "count", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120val", "\u0120in", "\u0120t", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120data", "[val", "]=", "0", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.5700083567488032, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229]} +{"problem_id": "p02814", "input": "import sys\n\nfrom math import gcd\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n A = list(set(map(int, input().split(\" \"))))\n\n A = [a // 2 for a in A]\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a)\n\n if semi_lcm > M:\n\n print((0))\n\n return\n\n\n\n for a in A:\n\n if semi_lcm // a % 2 == 0:\n\n print((0))\n\n return\n\n\n\n print(((M // semi_lcm + 1) // 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".readlines", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "\u0120<<", "\u0120", "6", "0", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120lcm", "(x", ",", "\u0120y", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120x", "\u0120*", "\u0120y", "\u0120//", "\u0120gcd", "(x", ",", "\u0120y", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120list", "(set", "(map", "(int", ",", "\u0120input", "().", "split", "(\"", "\u0120\"", "))))\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120[", "a", "\u0120//", "\u0120", "2", "\u0120for", "\u0120a", "\u0120in", "\u0120A", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120semi", "_l", "cm", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120semi", "_l", "cm", "\u0120=", "\u0120lcm", "(sem", "i", "_l", "cm", ",", "\u0120a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120semi", "_l", "cm", "\u0120>", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120semi", "_l", "cm", "\u0120//", "\u0120a", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "M", "\u0120//", "\u0120semi", "_l", "cm", "\u0120+", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03634", "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\ndef dfs(v,p,d):\n\n for i, j in tree[v]:\n\n if i != p:\n\n depth[i] = d + j\n\n dfs(i,v,d+j)\n\n\n\nN = int(input())\n\n\n\ntree = [[] for _ in range(N)]\n\n\n\nfor i in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n tree[a].append((b,c))\n\n tree[b].append((a,c))\n\n\n\nQ, K = list(map(int, input().split()))\n\n\n\ndepth = [0 for i in range(N)]\n\ndepth[K-1] = 0\n\n\n\ndfs(K-1,-1,0)\n\n\n\nfor _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n print((depth[x-1] + depth[y-1]))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "6", ")\u010a\u010a", "def", "\u0120dfs", "(v", ",p", ",d", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120j", "\u0120in", "\u0120tree", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120!=", "\u0120p", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120depth", "[i", "]", "\u0120=", "\u0120d", "\u0120+", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dfs", "(i", ",v", ",d", "+j", ")\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "tree", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tree", "[a", "].", "append", "((", "b", ",c", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120tree", "[b", "].", "append", "((", "a", ",c", "))", "\u010a\u010a\u010a\u010a", "Q", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "depth", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "depth", "[K", "-", "1", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "dfs", "(K", "-", "1", ",-", "1", ",", "0", ")\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(Q", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "depth", "[x", "-", "1", "]", "\u0120+", "\u0120depth", "[y", "-", "1", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\n\n\npower = math.factorial(n)\n\n\n\nprint((power % (10**9 + 7)))\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "power", "\u0120=", "\u0120math", ".factor", "ial", "(n", ")\u010a\u010a\u010a\u010a", "print", "((", "power", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02883", "input": "#!/usr/bin/env python3\n\nimport sys\n\nINF = float(\"inf\")\n\nfrom bisect import bisect_left\n\n\n\n\n\ndef solve(N: int, K: int, A: \"List[int]\", F: \"List[int]\"):\n\n A.sort()\n\n F.sort(reverse=True)\n\n h = []\n\n for a, f in zip(A, F):\n\n h.append((a*f, a, f))\n\n h.sort()\n\n maxtime = h[-1][0]\n\n\n\n def isOK(y):\n\n i = bisect_left(h, (y+1, -1, -1))\n\n counter = 0\n\n # print(h[i:])\n\n for p, a, f in h[i:]:\n\n counter += a-y//f\n\n return counter <= K\n\n\n\n def binary_search(x):\n\n ng = -1\n\n ok = len(x)\n\n while abs(ok - ng) > 1:\n\n mid = (ok + ng)//2\n\n # print(\"mid: {}, in ({}, {})\".format(mid, ng, ok))\n\n if isOK(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n return ng, ok\n\n\n\n ng, ok = binary_search(list(range(maxtime)))\n\n print(ok)\n\n\n\n # while k > 0:\n\n # p1, a1, f1 = heapq.heappop(h)\n\n # p2, a2, f2 = heapq.heappop(h)\n\n # p1, p2 = -p1, -p2\n\n # sub = min(a1 - math.ceil((p2/f1)-1), k)\n\n # a1 -= sub\n\n # k -= sub\n\n # heapq.heappush(h, (-a1*f1, a1, f1))\n\n # heapq.heappush(h, (-a2*f2, a2, f2))\n\n # # print(h)\n\n # p, a, f = heapq.heappop(h)\n\n # print(-p)\n\n\n\n return\n\n\n\n\n\ndef main():\n\n\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n K = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n F = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, K, A, F)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "INF", "\u0120=", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "(N", ":", "\u0120int", ",", "\u0120K", ":", "\u0120int", ",", "\u0120A", ":", "\u0120\"", "List", "[int", "]\",", "\u0120F", ":", "\u0120\"", "List", "[int", "]\")", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120F", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", ",", "\u0120f", "\u0120in", "\u0120zip", "(A", ",", "\u0120F", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120h", ".append", "((", "a", "*f", ",", "\u0120a", ",", "\u0120f", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "time", "\u0120=", "\u0120h", "[-", "1", "][", "0", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120is", "OK", "(y", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120bis", "ect", "_left", "(h", ",", "\u0120(", "y", "+", "1", ",", "\u0120-", "1", ",", "\u0120-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120counter", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120print", "(h", "[i", ":", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120p", ",", "\u0120a", ",", "\u0120f", "\u0120in", "\u0120h", "[i", ":]", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120counter", "\u0120+=", "\u0120a", "-y", "//", "f", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120counter", "\u0120<=", "\u0120K", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120binary", "_search", "(x", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ng", "\u0120=", "\u0120-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ok", "\u0120=", "\u0120len", "(x", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120abs", "(ok", "\u0120-", "\u0120ng", ")", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mid", "\u0120=", "\u0120(", "ok", "\u0120+", "\u0120ng", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120print", "(\"", "mid", ":", "\u0120{},", "\u0120in", "\u0120({", "},", "\u0120{})", "\".", "format", "(mid", ",", "\u0120ng", ",", "\u0120ok", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120is", "OK", "(mid", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ok", "\u0120=", "\u0120mid", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ng", "\u0120=", "\u0120mid", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120ng", ",", "\u0120ok", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ng", ",", "\u0120ok", "\u0120=", "\u0120binary", "_search", "(list", "(range", "(max", "time", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ok", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120while", "\u0120k", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120p", "1", ",", "\u0120a", "1", ",", "\u0120f", "1", "\u0120=", "\u0120heapq", ".he", "app", "op", "(h", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120p", "2", ",", "\u0120a", "2", ",", "\u0120f", "2", "\u0120=", "\u0120heapq", ".he", "app", "op", "(h", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120p", "1", ",", "\u0120p", "2", "\u0120=", "\u0120-", "p", "1", ",", "\u0120-", "p", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120sub", "\u0120=", "\u0120min", "(a", "1", "\u0120-", "\u0120math", ".ceil", "((", "p", "2", "/f", "1", ")-", "1", "),", "\u0120k", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120a", "1", "\u0120-=", "\u0120sub", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120k", "\u0120-=", "\u0120sub", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(h", ",", "\u0120(-", "a", "1", "*f", "1", ",", "\u0120a", "1", ",", "\u0120f", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(h", ",", "\u0120(-", "a", "2", "*f", "2", ",", "\u0120a", "2", ",", "\u0120f", "2", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120#", "\u0120print", "(h", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120p", ",", "\u0120a", ",", "\u0120f", "\u0120=", "\u0120heapq", ".he", "app", "op", "(h", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(-", "p", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120iterate", "_tokens", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120line", "\u0120in", "\u0120sys", ".stdin", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120word", "\u0120in", "\u0120line", ".split", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120yield", "\u0120word", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tokens", "\u0120=", "\u0120iterate", "_tokens", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120K", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120[", "int", "(next", "(tokens", "))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u0120", "\u0120#", "\u0120type", ":", "\u0120\"", "List", "[int", "]", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120F", "\u0120=", "\u0120[", "int", "(next", "(tokens", "))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u0120", "\u0120#", "\u0120type", ":", "\u0120\"", "List", "[int", "]", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120solve", "(N", ",", "\u0120K", ",", "\u0120A", ",", "\u0120F", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "%(", "1", "0", "**", "9", "+", "7", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03634", "input": "import heapq\n\n\n\nN = int(input())\n\nabc = [list(map(int,input().split())) for _ in range(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nxy = [list(map(int,input().split())) for _ in range(Q)]\n\n\n\nconnect = [[] for _ in range(N)]\n\nINFTY = 10**15\n\nfor a,b,c in abc:\n\n connect[a-1].append([b-1,c])\n\n connect[b-1].append([a-1,c])\n\n\n\ncost = [[INFTY,False] for _ in range(N)]\n\ncost[K-1][0] = 0\n\nq = [(0,K-1)]\n\nwhile q:\n\n _,i = heapq.heappop(q)\n\n if cost[i][1]:\n\n continue\n\n cost[i][1] = True\n\n ci0 = cost[i][0]\n\n for j,c in connect[i]:\n\n if cost[j][1]:\n\n continue\n\n tmp_cost = ci0+c\n\n if tmp_cost < cost[j][0]:\n\n cost[j][0] = tmp_cost\n\n heapq.heappush(q,(tmp_cost,j))\n\n\n\nfor x,y in xy:\n\n print((cost[x-1][0] + cost[y-1][0]))", "input_tokens": ["import", "\u0120heapq", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "abc", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "-", "1", ")]\u010a\u010a", "Q", ",K", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "xy", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(Q", ")]", "\u010a\u010a\u010a\u010a", "connect", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "IN", "FT", "Y", "\u0120=", "\u0120", "1", "0", "**", "1", "5", "\u010a\u010a", "for", "\u0120a", ",b", ",c", "\u0120in", "\u0120abc", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120connect", "[a", "-", "1", "].", "append", "([", "b", "-", "1", ",c", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120connect", "[b", "-", "1", "].", "append", "([", "a", "-", "1", ",c", "])\u010a\u010a", "\u010a\u010a", "cost", "\u0120=", "\u0120[[", "IN", "FT", "Y", ",False", "]", "\u0120for", "\u0120_", "\u0120", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "cost", "[K", "-", "1", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "q", "\u0120=", "\u0120[(", "0", ",K", "-", "1", ")]\u010a\u010a", "while", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120_,", "i", "\u0120=", "\u0120heapq", ".he", "app", "op", "(q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cost", "[i", "][", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cost", "[i", "][", "1", "]", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ci", "0", "\u0120=", "\u0120cost", "[i", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", ",c", "\u0120in", "\u0120connect", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cost", "[j", "][", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "_cost", "\u0120=", "\u0120ci", "0", "+c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "_cost", "\u0120<", "\u0120cost", "[j", "][", "0", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cost", "[j", "][", "0", "]", "\u0120=", "\u0120tmp", "_cost", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",(", "tmp", "_cost", ",j", "))", "\u010a\u010a\u010a\u010a", "for", "\u0120x", ",y", "\u0120in", "\u0120xy", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "cost", "[x", "-", "1", "][", "0", "]", "\u0120+", "\u0120cost", "[y", "-", "1", "][", "0", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7060506397782503, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p03416", "input": "A,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(n):\n\n\tkey = 0\n\n\tfor i in range(1,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(B)-kaibun(A-1)))", "input_tokens": ["A", ",B", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120ka", "ib", "un", "(n", "):\u010a\u010a", "\u0109key", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0109", "\u0109if", "\u0120str", "(i", ")", "\u0120==", "\u0120str", "(i", ")[", "::-", "1", "]:\u010a\u010a", "\u0109\u0109", "\u0109key", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0109return", "\u0120key", "\u010a\u010a\u010a\u010a", "print", "((", "ka", "ib", "un", "(B", ")-", "ka", "ib", "un", "(A", "-", "1", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02555", "input": "from sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n for x in range(3,i+1):\n\n if x in [i-1,i-2]:\n\n continue\n\n dp[i] += dp[i-x]\n\n return dp[s]%mod\n\nprint((solve()))", "input_tokens": ["from", "\u0120sys", "\u0120import", "\u0120stdin", "\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120int", "(stdin", ".readline", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120<", "\u0120", "3", ":", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[", "0", "]*(", "s", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",s", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(", "3", ",i", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120in", "\u0120[", "i", "-", "1", ",i", "-", "2", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[i", "-x", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120dp", "[s", "]%", "mod", "\u010a\u010a", "print", "((", "solve", "()))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02773", "input": "N = int(input())\n\ns_list = {}\n\nfor i in range(N):\n\n S = input()\n\n if S in list(s_list.keys()):\n\n s_list[S] += 1\n\n else:\n\n s_list[S] = 0\n\nmax = 0\n\nmaxs = []\n\nfor s,c in list(s_list.items()):\n\n if c > max:\n\n maxs = [s]\n\n max = c\n\n elif c == max:\n\n maxs.append(s)\n\nmaxs.sort()\n\nfor m in maxs:\n\n print(m)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "s", "_list", "\u0120=", "\u0120{}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120", "\u0120if", "\u0120S", "\u0120in", "\u0120list", "(s", "_list", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "_list", "[S", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "_list", "[S", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "max", "\u0120=", "\u0120", "0", "\u010a\u010a", "max", "s", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120s", ",c", "\u0120in", "\u0120list", "(s", "_list", ".items", "())", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120c", "\u0120>", "\u0120max", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "s", "\u0120=", "\u0120[", "s", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120", "\u0120elif", "\u0120c", "\u0120==", "\u0120max", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "s", ".append", "(s", ")\u010a\u010a", "max", "s", ".sort", "()\u010a\u010a", "for", "\u0120m", "\u0120in", "\u0120max", "s", ":\u010a\u010a", "\u0120", "\u0120print", "(m", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03796", "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "x", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(x", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02730", "input": "S = input()\n\nN = len(S)\n\nleft = S[:int(N/2)]\n\nright = S[int((N+2)/2):]\n\nS_reversed = \"\".join(reversed(list(S)))\n\nleft_reversed = \"\".join(reversed(list(left)))\n\nright_reversed = \"\".join(reversed(list(right)))\n\n\n\nif S == S_reversed and left == left_reversed and right == right_reversed:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "input_tokens": ["S", "\u0120=", "\u0120input", "()\u010a\u010a", "N", "\u0120=", "\u0120len", "(S", ")\u010a\u010a", "left", "\u0120=", "\u0120S", "[:", "int", "(N", "/", "2", ")]\u010a\u010a", "right", "\u0120=", "\u0120S", "[int", "((", "N", "+", "2", ")/", "2", "):", "]\u010a\u010a", "S", "_re", "versed", "\u0120=", "\u0120\"\".", "join", "(re", "versed", "(list", "(S", ")))\u010a\u010a", "left", "_re", "versed", "\u0120=", "\u0120\"\".", "join", "(re", "versed", "(list", "(left", ")))\u010a\u010a", "right", "_re", "versed", "\u0120=", "\u0120\"\".", "join", "(re", "versed", "(list", "(right", "))", ")\u010a\u010a\u010a\u010a", "if", "\u0120S", "\u0120==", "\u0120S", "_re", "versed", "\u0120and", "\u0120left", "\u0120==", "\u0120left", "_re", "versed", "\u0120and", "\u0120right", "\u0120==", "\u0120right", "_re", "versed", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Yes", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "No", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03416", "input": "a,b=list(map(int,input().split()))\n\nans=0\n\nfor i in range(b+1)[a:]:\n\n if len(str(i))%2==0:\n\n p=list(str(i))[:len(str(i))//2]\n\n q=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if p==q:\n\n ans+=1\n\n else:\n\n s=list(str(i))[:len(str(i))//2+1]\n\n d=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if s==d:\n\n ans += 1\n\nprint(ans)", "input_tokens": ["a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(b", "+", "1", ")[", "a", ":]", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120len", "(str", "(i", "))", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "=list", "(str", "(i", "))", "[:", "len", "(str", "(i", "))", "//", "2", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "=list", "(re", "versed", "(list", "(str", "(i", "))[", "len", "(str", "(i", "))", "//", "2", ":]", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120p", "==", "q", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=list", "(str", "(i", "))", "[:", "len", "(str", "(i", "))", "//", "2", "+", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "=list", "(re", "versed", "(list", "(str", "(i", "))[", "len", "(str", "(i", "))", "//", "2", ":]", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "==", "d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02814", "input": "import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\n \n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nfrom collections import defaultdict\n\n \n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n \n\n \n\nfrom functools import reduce\n\n# from math import *\n\nfrom math import *\n\nN, M = list(map(int, readline().split()))\n\nA = list(sorted([int(x) // 2 for x in readline().split()]))\n\nmin_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)\n\n \n\n# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))\n\nif not all([(min_cm // x) % 2 == 1 for x in A]):\n\n print((0))\n\n exit(0)\n\nif min_cm > M:\n\n print((0))\n\n exit(0)\n\nans = (M // min_cm + 1) // 2\n\nprint(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "import", "\u0120itertools", "\u010a\u010a", "#", "\u0120import", "\u0120numpy", "\u0120as", "\u0120np", "\u010a\u010a", "import", "\u0120time", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "\u0120\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "7", ")\u010a\u010a", "\u0120\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "\u0120\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readlines", "\u010a\u010a", "\u0120\u010a\u010a", "\u0120\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "#", "\u0120from", "\u0120math", "\u0120import", "\u0120*\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120*\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120readline", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "(sorted", "([", "int", "(x", ")", "\u0120//", "\u0120", "2", "\u0120for", "\u0120x", "\u0120in", "\u0120readline", "().", "split", "()]", "))\u010a\u010a", "min", "_cm", "\u0120=", "\u0120reduce", "(lambda", "\u0120a", ",", "\u0120b", ":", "\u0120(", "a", "\u0120*", "\u0120b", ")", "\u0120//", "\u0120gcd", "(a", ",", "\u0120b", "),", "\u0120A", ")\u010a\u010a", "\u0120\u010a\u010a", "#", "\u0120print", "(all", "(map", "(lambda", "\u0120x", ":", "\u0120(", "min", "_cm", "\u0120//", "\u0120x", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ",", "\u0120A", ")))\u010a\u010a", "if", "\u0120not", "\u0120all", "([(", "min", "_cm", "\u0120//", "\u0120x", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", "\u0120for", "\u0120x", "\u0120in", "\u0120A", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "if", "\u0120min", "_cm", "\u0120>", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "ans", "\u0120=", "\u0120(", "M", "\u0120//", "\u0120min", "_cm", "\u0120+", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p01093", "input": "while int(input()) > 0:\n\n s = sorted(map(int, input().split()))\n\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))", "input_tokens": ["while", "\u0120int", "(input", "())", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120sorted", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "min", "(abs", "(a", "\u0120-", "\u0120b", ")", "\u0120for", "\u0120(", "a", ",", "\u0120b", ")", "\u0120in", "\u0120zip", "(s", ",", "\u0120s", "[", "1", ":", "]))", "))"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02814", "input": "# ABC150 D\n\nsi = lambda: input()\n\nni = lambda: int(input())\n\nnm = lambda: list(map(int, input().split()))\n\nnl = lambda: list(map(int, input().split()))\n\nfrom math import gcd\n\nfrom math import ceil\n\ndef lcm(x, y):\n\n return (x * y) // gcd(x, y)\n\nn,m=nm()\n\na=nl()\n\nans=0\n\na=[x//2 for x in a] \n\n\n\nlcm_v=a[0]\n\nfor i in range(n):\n\n lcm_v=lcm(lcm_v,a[i])\n\nok_flg=[(lcm_v//i)%2==1 for i in a]\n\nif all(ok_flg):\n\n ans=((m//lcm_v)+1)//2\n\nprint(ans)\n\n\n", "input_tokens": ["#", "\u0120ABC", "1", "5", "0", "\u0120D", "\u010a\u010a", "si", "\u0120=", "\u0120lambda", ":", "\u0120input", "()\u010a\u010a", "ni", "\u0120=", "\u0120lambda", ":", "\u0120int", "(input", "())\u010a\u010a", "nm", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "nl", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120ceil", "\u010a\u010a", "def", "\u0120lcm", "(x", ",", "\u0120y", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "x", "\u0120*", "\u0120y", ")", "\u0120//", "\u0120gcd", "(x", ",", "\u0120y", ")\u010a\u010a", "n", ",m", "=", "nm", "()\u010a\u010a", "a", "=", "nl", "()\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "a", "=[", "x", "//", "2", "\u0120for", "\u0120x", "\u0120in", "\u0120a", "]", "\u0120\u010a\u010a\u010a\u010a", "l", "cm", "_v", "=a", "[", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120lcm", "_v", "=l", "cm", "(l", "cm", "_v", ",a", "[i", "])\u010a\u010a", "ok", "_flg", "=[", "(", "l", "cm", "_v", "//", "i", ")%", "2", "==", "1", "\u0120for", "\u0120i", "\u0120in", "\u0120a", "]\u010a\u010a", "if", "\u0120all", "(ok", "_flg", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=((", "m", "//", "l", "cm", "_v", ")+", "1", ")//", "2", "\u010a\u010a", "print", "(ans", ")\u010a\u010a\u010a"], "input_token_weights": [0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p02412", "input": "def main():\n\n\n\n while True:\n\n n, x = tuple(map(int, input().split()))\n\n pattern = 0\n\n\n\n if n == x == 0:\n\n break\n\n else:\n\n for a in range(1, n+1):\n\n for b in range(1, a):\n\n for c in range(1, b):\n\n pattern += 1 if a + b + c == x and a > b > c else 0\n\n print(pattern)\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", ",", "\u0120x", "\u0120=", "\u0120tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pattern", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120x", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120b", "\u0120in", "\u0120range", "(", "1", ",", "\u0120a", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120range", "(", "1", ",", "\u0120b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pattern", "\u0120+=", "\u0120", "1", "\u0120if", "\u0120a", "\u0120+", "\u0120b", "\u0120+", "\u0120c", "\u0120==", "\u0120x", "\u0120and", "\u0120a", "\u0120>", "\u0120b", "\u0120>", "\u0120c", "\u0120else", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(pattern", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03416", "input": "A, B = list(map(int, input().split()))\n\nnumbers = list(range(A, B+1))\n\ncount = 0\n\nfor i in numbers:\n\n m = str(i)\n\n rm = ''.join(list(reversed(m)))\n\n if m == rm:\n\n count += 1\n\nprint(count)", "input_tokens": ["A", ",", "\u0120B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "numbers", "\u0120=", "\u0120list", "(range", "(A", ",", "\u0120B", "+", "1", "))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120numbers", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120rm", "\u0120=", "\u0120''.", "join", "(list", "(re", "versed", "(m", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120m", "\u0120==", "\u0120rm", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02863", "input": "import sys\n\nfrom operator import itemgetter\n\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return input()\n\n\n\nN, T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort(key=itemgetter(0))\n\n#print(ab)\n\n\n\ndp = [[0]*(T+1+3000+1) for _ in range(N+1)]\n\nans = 0\n\nfor i in range(N):\n\n for j in range(T+1+3000+1):\n\n time, deli = ab[i]\n\n if 0 <= j-time < T:\n\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n\n else:\n\n dp[i + 1][j] = dp[i][j]\n\n ans = max(ans, dp[i + 1][j])\n\nprint(ans)\n\n\n\n#print(dp)\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "from", "\u0120operator", "\u0120import", "\u0120item", "getter", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120heap", "ify", ",", "\u0120he", "app", "op", ",", "\u0120he", "app", "ush", "\u010a\u010a", "MAX", "_INT", "\u0120=", "\u0120int", "(", "1", "0", "e", "1", "5", ")\u010a\u010a", "MIN", "_INT", "\u0120=", "\u0120-", "MAX", "_INT", "\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", "0", ")\u010a\u010a", "def", "\u0120IL", "():", "\u0120return", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "def", "\u0120SL", "():", "\u0120return", "\u0120input", "().", "split", "()\u010a\u010a", "def", "\u0120I", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120S", "():", "\u0120return", "\u0120input", "()\u010a\u010a\u010a\u010a", "N", ",", "\u0120T", "\u0120=", "\u0120IL", "()\u010a\u010a", "ab", "\u0120=", "\u0120[", "IL", "()", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "ab", ".sort", "(key", "=item", "getter", "(", "0", "))\u010a\u010a", "#print", "(ab", ")\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[[", "0", "]*(", "T", "+", "1", "+", "3", "0", "0", "0", "+", "1", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "+", "1", ")]\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(T", "+", "1", "+", "3", "0", "0", "0", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120time", ",", "\u0120del", "i", "\u0120=", "\u0120ab", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "\u0120<=", "\u0120j", "-time", "\u0120<", "\u0120T", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "\u0120+", "\u0120", "1", "][", "j", "]", "\u0120=", "\u0120max", "(dp", "[i", "][", "j", "],", "\u0120dp", "[i", "][", "j", "\u0120-", "\u0120time", "]", "\u0120+", "\u0120del", "i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "\u0120+", "\u0120", "1", "][", "j", "]", "\u0120=", "\u0120dp", "[i", "][", "j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120dp", "[i", "\u0120+", "\u0120", "1", "][", "j", "])\u010a\u010a", "print", "(ans", ")\u010a\u010a\u010a\u010a", "#print", "(dp", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139]} +{"problem_id": "p02599", "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/\n\n# Python3 code to find number of\n\n# distinct numbers in a subarray\n\nMAX = 1000001\n\n\n\n# structure to store queries\n\nclass Query:\n\n def __init__(self, l, r, idx):\n\n self.l = l\n\n self.r = r\n\n self.idx = idx\n\n\n\n\n\n# updating the bit array\n\ndef update(idx, val, bit, n):\n\n while idx <= n:\n\n bit[idx] += val\n\n idx += idx & -idx\n\n\n\n\n\n# querying the bit array\n\ndef query(idx, bit, n):\n\n summ = 0\n\n while idx:\n\n summ += bit[idx]\n\n idx -= idx & -idx\n\n return summ\n\n\n\n\n\ndef answeringQueries(arr, n, queries, q):\n\n\n\n # initialising bit array\n\n bit = [0] * (n + 1)\n\n\n\n # holds the rightmost index of\n\n # any number as numbers of a[i]\n\n # are less than or equal to 10^6\n\n last_visit = [-1] * MAX\n\n\n\n # answer for each query\n\n ans = [0] * q\n\n\n\n query_counter = 0\n\n for i in range(n):\n\n\n\n # If last visit is not -1 update -1 at the\n\n # idx equal to last_visit[arr[i]]\n\n if last_visit[arr[i]] != -1:\n\n update(last_visit[arr[i]] + 1, -1, bit, n)\n\n\n\n # Setting last_visit[arr[i]] as i and\n\n # updating the bit array accordingly\n\n last_visit[arr[i]] = i\n\n update(i + 1, 1, bit, n)\n\n\n\n # If i is equal to r of any query store answer\n\n # for that query in ans[]\n\n while query_counter < q and queries[query_counter].r == i:\n\n ans[queries[query_counter].idx] = query(queries[query_counter].r + 1, bit, n) - query(\n\n queries[query_counter].l, bit, n\n\n )\n\n query_counter += 1\n\n\n\n # print answer for each query\n\n for i in range(q):\n\n print((ans[i]))\n\n\n\n\n\n# This code is contributed by\n\n# sanjeev2552\n\n\n\n\n\ndef main():\n\n N, Q = list(map(int, readline().split()))\n\n C = list(map(int, readline().split()))\n\n (*LR,) = list(map(int, read().split()))\n\n\n\n queries = [0] * Q\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n queries[i] = Query(l - 1, r - 1, i)\n\n\n\n queries.sort(key=lambda x: x.r)\n\n answeringQueries(C, N, queries, Q)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".readlines", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "\u0120<<", "\u0120", "6", "0", "\u010a\u010a", "MOD", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a\u010a\u010a", "#", "\u0120Reference", ":", "\u0120https", "://", "www", ".ge", "eks", "forge", "eks", ".org", "/", "queries", "-number", "-dist", "inct", "-elements", "-sub", "array", "/\u010a\u010a", "#", "\u0120Python", "3", "\u0120code", "\u0120to", "\u0120find", "\u0120number", "\u0120of", "\u010a\u010a", "#", "\u0120distinct", "\u0120numbers", "\u0120in", "\u0120a", "\u0120sub", "array", "\u010a\u010a", "MAX", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "1", "\u010a\u010a\u010a\u010a", "#", "\u0120structure", "\u0120to", "\u0120store", "\u0120queries", "\u010a\u010a", "class", "\u0120Query", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120l", ",", "\u0120r", ",", "\u0120idx", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".l", "\u0120=", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".r", "\u0120=", "\u0120r", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".idx", "\u0120=", "\u0120idx", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120updating", "\u0120the", "\u0120bit", "\u0120array", "\u010a\u010a", "def", "\u0120update", "(idx", ",", "\u0120val", ",", "\u0120bit", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120idx", "\u0120<=", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bit", "[idx", "]", "\u0120+=", "\u0120val", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120idx", "\u0120+=", "\u0120idx", "\u0120&", "\u0120-", "idx", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120querying", "\u0120the", "\u0120bit", "\u0120array", "\u010a\u010a", "def", "\u0120query", "(idx", ",", "\u0120bit", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120summ", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120idx", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120summ", "\u0120+=", "\u0120bit", "[idx", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120idx", "\u0120-=", "\u0120idx", "\u0120&", "\u0120-", "idx", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120summ", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120answering", "Queries", "(arr", ",", "\u0120n", ",", "\u0120queries", ",", "\u0120q", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120initial", "ising", "\u0120bit", "\u0120array", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120bit", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120holds", "\u0120the", "\u0120right", "most", "\u0120index", "\u0120of", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120any", "\u0120number", "\u0120as", "\u0120numbers", "\u0120of", "\u0120a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120are", "\u0120less", "\u0120than", "\u0120or", "\u0120equal", "\u0120to", "\u0120", "1", "0", "^", "6", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120last", "_visit", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120MAX", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120answer", "\u0120for", "\u0120each", "\u0120query", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120q", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120query", "_counter", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120If", "\u0120last", "\u0120visit", "\u0120is", "\u0120not", "\u0120-", "1", "\u0120update", "\u0120-", "1", "\u0120at", "\u0120the", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120idx", "\u0120equal", "\u0120to", "\u0120last", "_visit", "[arr", "[i", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120last", "_visit", "[arr", "[i", "]]", "\u0120!=", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120update", "(last", "_visit", "[arr", "[i", "]]", "\u0120+", "\u0120", "1", ",", "\u0120-", "1", ",", "\u0120bit", ",", "\u0120n", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120Setting", "\u0120last", "_visit", "[arr", "[i", "]]", "\u0120as", "\u0120i", "\u0120and", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120updating", "\u0120the", "\u0120bit", "\u0120array", "\u0120accordingly", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120last", "_visit", "[arr", "[i", "]]", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120update", "(i", "\u0120+", "\u0120", "1", ",", "\u0120", "1", ",", "\u0120bit", ",", "\u0120n", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120If", "\u0120i", "\u0120is", "\u0120equal", "\u0120to", "\u0120r", "\u0120of", "\u0120any", "\u0120query", "\u0120store", "\u0120answer", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120for", "\u0120that", "\u0120query", "\u0120in", "\u0120ans", "[]", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120query", "_counter", "\u0120<", "\u0120q", "\u0120and", "\u0120queries", "[", "query", "_counter", "].", "r", "\u0120==", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "[", "queries", "[", "query", "_counter", "].", "idx", "]", "\u0120=", "\u0120query", "(", "queries", "[", "query", "_counter", "].", "r", "\u0120+", "\u0120", "1", ",", "\u0120bit", ",", "\u0120n", ")", "\u0120-", "\u0120query", "(\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120queries", "[", "query", "_counter", "].", "l", ",", "\u0120bit", ",", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120)\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120query", "_counter", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "\u0120answer", "\u0120for", "\u0120each", "\u0120query", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(q", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "ans", "[i", "]))", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120This", "\u0120code", "\u0120is", "\u0120contributed", "\u0120by", "\u010a\u010a", "#", "\u0120san", "jee", "v", "2", "5", "5", "2", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120Q", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120readline", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120readline", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120(*", "LR", ",)", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120read", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120queries", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120Q", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120(", "l", ",", "\u0120r", ")", "\u0120in", "\u0120enumerate", "(zip", "(*", "[", "iter", "(L", "R", ")]", "\u0120*", "\u0120", "2", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120queries", "[i", "]", "\u0120=", "\u0120Query", "(l", "\u0120-", "\u0120", "1", ",", "\u0120r", "\u0120-", "\u0120", "1", ",", "\u0120i", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120queries", ".sort", "(key", "=lambda", "\u0120x", ":", "\u0120x", ".r", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120answering", "Queries", "(C", ",", "\u0120N", ",", "\u0120queries", ",", "\u0120Q", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02596", "input": "k = int(input())\n\nnum = 0\n\nif not k%2:\n\n print((-1))\n\nelse:\n\n for i in range(k):\n\n num = (num*10+7)%k\n\n if num == 0:\n\n print((i+1))\n\n break\n\n else:\n\n print((-1))", "input_tokens": ["k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "num", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120not", "\u0120k", "%", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120(", "num", "*", "1", "0", "+", "7", ")%", "k", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120num", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "i", "+", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "1", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411]} +{"problem_id": "p02596", "input": "k = int(input())\n\ncount = 1\n\nn = 0\n\nif k % 2 == 0 or k % 5 == 0:\n\n print((-1))\n\nelse:\n\n while 1:\n\n n = (n * 10 + 7) % k \n\n if n == 0:\n\n break \n\n count += 1\n\n print(count)", "input_tokens": ["k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "count", "\u0120=", "\u0120", "1", "\u010a\u010a", "n", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120k", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", "\u0120or", "\u0120k", "\u0120%", "\u0120", "5", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120while", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120(", "n", "\u0120*", "\u0120", "1", "0", "\u0120+", "\u0120", "7", ")", "\u0120%", "\u0120k", "\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120print", "(count", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03250", "input": "a, b, c = sorted(map(int, input().split()))\n\n\n\nprint((c*10 + b + a))", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120sorted", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "print", "((", "c", "*", "1", "0", "\u0120+", "\u0120b", "\u0120+", "\u0120a", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(200005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "0", "0", "0", "0", "5", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120i", "\u0120*", "\u0120", "2", "\u0120*", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120max", "(", "0", ",", "\u0120x", "-i", ")", "\u0120*", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120max", "(", "0", ",", "\u0120y", "-i", ")", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120tmp", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03568", "input": "N = int(input())\n\nAs = list(map(int,input().split()))\n\n\n\n\n\ndef dfs(A_s, index,Bss):\n\n if index == N:\n\n tmp = 1\n\n for b in Bss:\n\n tmp *= b\n\n return 1 if tmp % 2 == 0 else 0\n\n b_mi = Bss.copy()\n\n b_mi.append(A_s[index] - 1)\n\n\n\n b = Bss.copy()\n\n b.append(A_s[index])\n\n\n\n b_pl = Bss.copy()\n\n b_pl.append(A_s[index] + 1)\n\n return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)\n\n\n\n\n\nprint((dfs(As,0,[])))\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "As", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120dfs", "(A", "_s", ",", "\u0120index", ",B", "ss", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120index", "\u0120==", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120b", "\u0120in", "\u0120B", "ss", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120*=", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "1", "\u0120if", "\u0120tmp", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", "\u0120else", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_mi", "\u0120=", "\u0120B", "ss", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_mi", ".append", "(A", "_s", "[index", "]", "\u0120-", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120B", "ss", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ".append", "(A", "_s", "[index", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_pl", "\u0120=", "\u0120B", "ss", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_pl", ".append", "(A", "_s", "[index", "]", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120dfs", "(A", "_s", ",index", "\u0120+", "\u0120", "1", ",", "\u0120b", "_mi", ")", "\u0120+", "\u0120dfs", "(A", "_s", ",index", "\u0120+", "\u0120", "1", ",b", ")", "\u0120+", "\u0120dfs", "(A", "_s", ",index", "\u0120+", "\u0120", "1", ",b", "_pl", ")\u010a\u010a\u010a\u010a\u010a\u010a", "print", "((", "dfs", "(", "As", ",", "0", ",", "[]", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03796", "input": "import math\n\nn=int(input())\n\nprint((math.factorial(n)%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02555", "input": "from sys import stdin\n\nfrom math import factorial\n\n\n\n\n\ndef combinations_count(n, r):\n\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n _in = [_.rstrip() for _ in stdin.readlines()]\n\n S = int(_in[0]) # type:int\n\n # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n\n min_ = 1\n\n max_ = S // 3\n\n ans = 0\n\n for i in range(min_, max_ + 1):\n\n mod = S - i * 3\n\n ans += combinations_with_replacement_count(mod + 1, i - 1) % (10**9 + 7)\n\n ans %= (10**9 + 7)\n\n # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["from", "\u0120sys", "\u0120import", "\u0120stdin", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120combinations", "_count", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120factorial", "(n", ")", "\u0120//", "\u0120(", "factor", "ial", "(n", "\u0120-", "\u0120r", ")", "\u0120*", "\u0120factorial", "(r", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120combinations", "_with", "_re", "placement", "_count", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120combinations", "_count", "(n", "\u0120+", "\u0120r", "\u0120-", "\u0120", "1", ",", "\u0120r", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120_", "in", "\u0120=", "\u0120[", "_.", "rstrip", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120stdin", ".readlines", "()]\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120int", "(_", "in", "[", "0", "])", "\u0120", "\u0120#", "\u0120type", ":int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120v", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120min", "_", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "_", "\u0120=", "\u0120S", "\u0120//", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(min", "_,", "\u0120max", "_", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120S", "\u0120-", "\u0120i", "\u0120*", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120combinations", "_with", "_re", "placement", "_count", "(mod", "\u0120+", "\u0120", "1", ",", "\u0120i", "\u0120-", "\u0120", "1", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120%=", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03801", "input": "n = int(input())\n\na = list(map(int, input().split()))\n\n\n\ntmp = [[e, n - i] for i, e in enumerate(a)]\n\ntmp.sort(reverse=True)\n\n\n\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\n\n\n\nv_prev, i_prev = aa[0]\n\ni = 0\n\nans = [0] * n\n\nsm = 0\n\nwhile i < n:\n\n while aa[i][1] >= i_prev:\n\n sm += aa[i][0]\n\n i += 1\n\n\n\n ans[i_prev] += sm - aa[i][0] * i\n\n sm = aa[i][0] * i\n\n v_prev, i_prev = aa[i]\n\n\n\nprint(*ans, sep=\"\\n\")\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "tmp", "\u0120=", "\u0120[[", "e", ",", "\u0120n", "\u0120-", "\u0120i", "]", "\u0120for", "\u0120i", ",", "\u0120e", "\u0120in", "\u0120enumerate", "(a", ")]\u010a\u010a", "tmp", ".sort", "(reverse", "=True", ")\u010a\u010a\u010a\u010a", "aa", "\u0120=", "\u0120[[", "e", ",", "\u0120n", "\u0120-", "\u0120i", "]", "\u0120for", "\u0120e", ",", "\u0120i", "\u0120in", "\u0120tmp", "]", "\u0120+", "\u0120[[", "0", ",", "\u0120-", "1", "]]", "\u010a\u010a\u010a\u010a", "v", "_prev", ",", "\u0120i", "_prev", "\u0120=", "\u0120aa", "[", "0", "]\u010a\u010a", "i", "\u0120=", "\u0120", "0", "\u010a\u010a", "ans", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120n", "\u010a\u010a", "sm", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120i", "\u0120<", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120aa", "[i", "][", "1", "]", "\u0120>=", "\u0120i", "_prev", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sm", "\u0120+=", "\u0120aa", "[i", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "[i", "_prev", "]", "\u0120+=", "\u0120sm", "\u0120-", "\u0120aa", "[i", "][", "0", "]", "\u0120*", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120sm", "\u0120=", "\u0120aa", "[i", "][", "0", "]", "\u0120*", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "_prev", ",", "\u0120i", "_prev", "\u0120=", "\u0120aa", "[i", "]\u010a\u010a\u010a\u010a", "print", "(*", "ans", ",", "\u0120sep", "=\"\\", "n", "\")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03013", "input": "N, M = list(map(int, input().split()))\n\nA_ = [int(input()) for _ in range(M)]\n\nA = [0] * (N+3)\n\nfor a in A_:\n\n A[a] = 1\n\ndp = [0] * (N+3)\n\ndp[0] = 1\n\n\n\nmod = 10**9+7\n\n\n\nfor i in range(1, N+1):\n\n if A[i-1] == 0:\n\n dp[i] += dp[i-1]\n\n if A[i-2] == 0:\n\n dp[i] += dp[i-2]\n\n dp[i] %= mod\n\nprint((dp[N]))", "input_tokens": ["N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "A", "_", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", ")]\u010a\u010a", "A", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "+", "3", ")\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120A", "_", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "[a", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "+", "3", ")\u010a\u010a", "dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120A", "[i", "-", "1", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[i", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120A", "[i", "-", "2", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[i", "-", "2", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120%=", "\u0120mod", "\u010a\u010a", "print", "((", "dp", "[N", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p02792", "input": "n=int(input())\n\nD={}\n\nDD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n t=(str(i)[-1],str(i)[0])\n\n if s not in D:\n\n D[s]=1\n\n else:\n\n D[s]+=1\n\n if t not in DD:\n\n DD[t]=1\n\n else:\n\n DD[t]+=1\n\nans=0\n\nfor i in D:\n\n if i in DD:\n\n ans+=D[i]*DD[i]\n\nprint(ans)\n\n ", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "D", "={", "}\u010a\u010a", "DD", "={", "}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120", "\u0120s", "=(", "str", "(i", ")[", "0", "],", "str", "(i", ")[-", "1", "])\u010a\u010a", "\u0120\u0120", "\u0120t", "=(", "str", "(i", ")[-", "1", "],", "str", "(i", ")[", "0", "])\u010a\u010a", "\u0120\u0120", "\u0120if", "\u0120s", "\u0120not", "\u0120in", "\u0120D", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120D", "[s", "]=", "1", "\u010a\u010a", "\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120D", "[s", "]+=", "1", "\u010a\u010a", "\u0120\u0120", "\u0120if", "\u0120t", "\u0120not", "\u0120in", "\u0120DD", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120DD", "[t", "]=", "1", "\u010a\u010a", "\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120DD", "[t", "]+=", "1", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120D", ":\u010a\u010a", "\u0120\u0120", "\u0120if", "\u0120i", "\u0120in", "\u0120DD", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "D", "[i", "]*", "DD", "[i", "]\u010a\u010a", "print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139]} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\nans = 0\n\n\n\nans =math.factorial(N) % (10**9 +7)\n\n\n\nprint(ans)", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "math", ".factor", "ial", "(N", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "7", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03078", "input": "X,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nalready = [[0,0,0]]\n\nx,y,z = 0,0,0\n\nplace_sum = []\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n place_sum.append([x + 1,y,z])\n\n check.append(asort[x + 1] + bsort[y] + csort[z])\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n place_sum.append([x,y + 1,z])\n\n check.append(asort[x] + bsort[y + 1] + csort[z])\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n place_sum.append([x,y,z + 1])\n\n check.append(asort[x] + bsort[y] + csort[z + 1])\n\n print((max(check)))\n\n x,y,z = place_sum[check.index(max(check))][0],place_sum[check.index(max(check))][1],place_sum[check.index(max(check))][2]\n\n place_sum.pop(check.index(max(check)))\n\n check.remove(max(check))", "input_tokens": ["X", ",Y", ",Z", ",K", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "B", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "C", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "as", "ort", ",", "bs", "ort", ",", "cs", "ort", "\u0120=", "\u0120sorted", "(A", ",", "reverse", "=True", "),", "sorted", "(B", ",", "reverse", "=True", "),", "sorted", "(C", ",", "reverse", "=True", ")\u010a\u010a", "print", "((", "as", "ort", "[", "0", "]", "\u0120+", "\u0120b", "sort", "[", "0", "]", "\u0120+", "\u0120c", "sort", "[", "0", "]))\u010a\u010a", "already", "\u0120=", "\u0120[[", "0", ",", "0", ",", "0", "]]\u010a\u010a", "x", ",y", ",z", "\u0120=", "\u0120", "0", ",", "0", ",", "0", "\u010a\u010a", "place", "_sum", "\u0120=", "\u0120[]\u010a\u010a", "check", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(K", "\u0120-", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120[", "x", "\u0120+", "\u0120", "1", ",y", ",z", "]", "\u0120not", "\u0120in", "\u0120already", "\u0120and", "\u0120x", "\u0120+", "\u0120", "1", "\u0120<", "\u0120X", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120already", ".append", "([", "x", "\u0120+", "\u0120", "1", ",y", ",z", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120place", "_sum", ".append", "([", "x", "\u0120+", "\u0120", "1", ",y", ",z", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120check", ".append", "(as", "ort", "[x", "\u0120+", "\u0120", "1", "]", "\u0120+", "\u0120b", "sort", "[y", "]", "\u0120+", "\u0120c", "sort", "[z", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120[", "x", ",y", "\u0120+", "\u0120", "1", ",z", "]", "\u0120not", "\u0120in", "\u0120already", "\u0120and", "\u0120y", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120already", ".append", "([", "x", ",y", "\u0120+", "\u0120", "1", ",z", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120place", "_sum", ".append", "([", "x", ",y", "\u0120+", "\u0120", "1", ",z", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120check", ".append", "(as", "ort", "[x", "]", "\u0120+", "\u0120b", "sort", "[y", "\u0120+", "\u0120", "1", "]", "\u0120+", "\u0120c", "sort", "[z", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120[", "x", ",y", ",z", "\u0120+", "\u0120", "1", "]", "\u0120not", "\u0120in", "\u0120already", "\u0120and", "\u0120z", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Z", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120already", ".append", "([", "x", ",y", ",z", "\u0120+", "\u0120", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120place", "_sum", ".append", "([", "x", ",y", ",z", "\u0120+", "\u0120", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120check", ".append", "(as", "ort", "[x", "]", "\u0120+", "\u0120b", "sort", "[y", "]", "\u0120+", "\u0120c", "sort", "[z", "\u0120+", "\u0120", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "max", "(check", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",y", ",z", "\u0120=", "\u0120place", "_sum", "[", "check", ".index", "(max", "(check", "))", "][", "0", "],", "place", "_sum", "[", "check", ".index", "(max", "(check", "))", "][", "1", "],", "place", "_sum", "[", "check", ".index", "(max", "(check", "))", "][", "2", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120place", "_sum", ".pop", "(check", ".index", "(max", "(check", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120check", ".remove", "(max", "(check", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nn=max(x,y)\n\nfor i in range(1,n+1):\n\n ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))\n\nprint(ans)\n\n\n\n\n", "input_tokens": ["a", ",b", ",c", ",x", ",y", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "=a", "*x", "+b", "*y", "\u010a\u010a", "n", "=max", "(x", ",y", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120ans", "=min", "(ans", ",", "2", "*i", "*c", "+a", "*", "max", "(", "0", ",x", "-i", ")+", "b", "*", "max", "(", "0", ",y", "-i", "))\u010a\u010a", "print", "(ans", ")\u010a\u010a\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03325", "input": "answer = 0\n\nN = int(input())\n\nA = list(map(int,input().split()))\n\nfor i in range(N) :\n\n while A[i] % 2 == 0 :\n\n A[i] = A[i] / 2\n\n answer += 1\n\nprint(answer)\n\n\n", "input_tokens": ["answer", "\u0120=", "\u0120", "0", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", ")", "\u0120:\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120A", "[i", "]", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", "\u0120:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "[i", "]", "\u0120=", "\u0120A", "[i", "]", "\u0120/", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120answer", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(answer", ")\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03034", "input": "import sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n for C in range(1, N//2):\n\n n = N // C\n\n point = 0\n\n used = set([0])\n\n for k in range(1, n):\n\n A = N - 1 - k*C\n\n\n\n if A in used or k*C in used or A == k*C:\n\n break\n\n used.add(A)\n\n used.add(k*C)\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120C", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "//", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120N", "\u0120//", "\u0120C", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120point", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120used", "\u0120=", "\u0120set", "([", "0", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120N", "\u0120-", "\u0120", "1", "\u0120-", "\u0120k", "*C", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120A", "\u0120in", "\u0120used", "\u0120or", "\u0120k", "*C", "\u0120in", "\u0120used", "\u0120or", "\u0120A", "\u0120==", "\u0120k", "*C", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120used", ".add", "(A", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120used", ".add", "(k", "*C", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120point", "\u0120+=", "\u0120S", "[A", "]", "\u0120+", "\u0120S", "[k", "*C", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120point", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ans", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "main", "()))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03038", "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(input())\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N,M=MI()\n\n A=LI()\n\n CB=[[0,0]for _ in range(M)]\n\n A.sort()\n\n for i in range(M):\n\n CB[i][1],CB[i][0]=MI()\n\n \n\n CB.sort(reverse=True)\n\n now=0\n\n \n\n for i in range(N):\n\n if CB[now][1]<=0:\n\n now+=1\n\n \n\n if now>=M:\n\n break \n\n \n\n ch=CB[now][0]\n\n if A[i]=", "M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ch", "=", "CB", "[now", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120A", "[i", "]<", "ch", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "[i", "]=", "ch", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120CB", "[now", "][", "1", "]-", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "sum", "(A", ")))\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a", "main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03828", "input": "from math import factorial\n\n\n\nn = int(input())\n\nf = factorial(n)\n\n\n\nmod = 10 ** 9 + 7\n\n\n\ndef primes(n):\n\n is_prime = [True] * (n + 1)\n\n is_prime[0] = False\n\n is_prime[1] = False\n\n for i in range(2, int(n ** 0.5) + 1):\n\n if not is_prime[i]:\n\n continue\n\n for j in range(i * 2, n + 1, i):\n\n is_prime[j] = False\n\n return [i for i in range(n + 1) if is_prime[i]]\n\n\n\nans = 1\n\nfor p in primes(n):\n\n temp = 1\n\n while f % p == 0:\n\n temp += 1\n\n f //= p\n\n ans = (ans * temp) % mod\n\nprint(ans)\n", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "f", "\u0120=", "\u0120factorial", "(n", ")\u010a\u010a\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "def", "\u0120primes", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120is", "_prime", "\u0120=", "\u0120[", "True", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120is", "_prime", "[", "0", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120is", "_prime", "[", "1", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",", "\u0120int", "(n", "\u0120**", "\u0120", "0", ".", "5", ")", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120is", "_prime", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "\u0120*", "\u0120", "2", ",", "\u0120n", "\u0120+", "\u0120", "1", ",", "\u0120i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120is", "_prime", "[j", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "\u0120+", "\u0120", "1", ")", "\u0120if", "\u0120is", "_prime", "[i", "]]", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120primes", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120temp", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120f", "\u0120%", "\u0120p", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120//=", "\u0120p", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120(", "ans", "\u0120*", "\u0120temp", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02937", "input": "from collections import defaultdict\n\nfrom bisect import bisect_left\n\n\n\ns = input()\n\nn = len(s)\n\ns = s + s\n\nt = input()\n\nif set(t) - set(s):\n\n\tprint((-1))\n\n\texit()\n\nd = defaultdict(list)\n\nfor i in range(2 * n):\n\n\td[s[i]] += [i]\n\ncur = tot = 0\n\nfor c in t:\n\n\tx = d[c][bisect_left(d[c], cur)]\n\n\tif x < n:\n\n\t\tcur = x + 1\n\n\telse:\n\n\t\tcur = x - n + 1\n\n\t\ttot += n\n\ntot += cur\n\nprint(tot)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120input", "()\u010a\u010a", "n", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "s", "\u0120=", "\u0120s", "\u0120+", "\u0120s", "\u010a\u010a", "t", "\u0120=", "\u0120input", "()\u010a\u010a", "if", "\u0120set", "(t", ")", "\u0120-", "\u0120set", "(s", "):\u010a\u010a", "\u0109print", "((-", "1", "))\u010a\u010a", "\u0109exit", "()\u010a\u010a", "d", "\u0120=", "\u0120defaultdict", "(list", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "\u0120*", "\u0120n", "):\u010a\u010a", "\u0109d", "[s", "[i", "]]", "\u0120+=", "\u0120[", "i", "]\u010a\u010a", "cur", "\u0120=", "\u0120tot", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120c", "\u0120in", "\u0120t", ":\u010a\u010a", "\u0109x", "\u0120=", "\u0120d", "[c", "][", "bis", "ect", "_left", "(d", "[c", "],", "\u0120cur", ")]\u010a\u010a", "\u0109if", "\u0120x", "\u0120<", "\u0120n", ":\u010a\u010a", "\u0109", "\u0109cur", "\u0120=", "\u0120x", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0109else", ":\u010a\u010a", "\u0109", "\u0109cur", "\u0120=", "\u0120x", "\u0120-", "\u0120n", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0109", "\u0109t", "ot", "\u0120+=", "\u0120n", "\u010a\u010a", "tot", "\u0120+=", "\u0120cur", "\u010a\u010a", "print", "(t", "ot", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028]} +{"problem_id": "p02996", "input": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\nab = [list(li()) for _ in range(n)]\n\n\n\nab.sort(key=lambda x: x[1])\n\n\n\ncur = 0\n\n\n\nans = True\n\n\n\nfor ai, bi in ab:\n\n cur += ai\n\n if cur > bi:\n\n ans = False\n\n\n\nprint((\"Yes\" if ans else \"No\"))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "stdin", "\u0120=", "\u0120sys", ".stdin", "\u010a\u010a\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "7", ")\u010a\u010a\u010a\u010a", "def", "\u0120li", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120li", "_", "():", "\u0120return", "\u0120[", "int", "(x", ")", "\u0120-", "\u0120", "1", "\u0120for", "\u0120x", "\u0120in", "\u0120stdin", ".readline", "().", "split", "()]\u010a\u010a", "def", "\u0120lf", "():", "\u0120return", "\u0120list", "(map", "(float", ",", "\u0120stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120ls", "():", "\u0120return", "\u0120stdin", ".readline", "().", "split", "()\u010a\u010a", "def", "\u0120ns", "():", "\u0120return", "\u0120stdin", ".readline", "().", "rstrip", "()\u010a\u010a", "def", "\u0120lc", "():", "\u0120return", "\u0120list", "(ns", "())\u010a\u010a", "def", "\u0120ni", "():", "\u0120return", "\u0120int", "(stdin", ".readline", "())\u010a\u010a", "def", "\u0120nf", "():", "\u0120return", "\u0120float", "(stdin", ".readline", "())\u010a\u010a", "\u010a\u010a", "n", "\u0120=", "\u0120ni", "()\u010a\u010a", "ab", "\u0120=", "\u0120[", "list", "(li", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "ab", ".sort", "(key", "=lambda", "\u0120x", ":", "\u0120x", "[", "1", "])\u010a\u010a", "\u010a\u010a", "cur", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "for", "\u0120ai", ",", "\u0120bi", "\u0120in", "\u0120ab", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120cur", "\u0120+=", "\u0120ai", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cur", "\u0120>", "\u0120bi", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120False", "\u010a\u010a\u010a\u010a", "print", "((\"", "Yes", "\"", "\u0120if", "\u0120ans", "\u0120else", "\u0120\"", "No", "\"))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03416", "input": "n, m = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n, m+1):\n\n if str(i)[0]+str(i)[1] == str(i)[-1]+str(i)[-2]: ans += 1\n\nprint(ans)", "input_tokens": ["n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", ",", "\u0120m", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120str", "(i", ")[", "0", "]+", "str", "(i", ")[", "1", "]", "\u0120==", "\u0120str", "(i", ")[-", "1", "]+", "str", "(i", ")[-", "2", "]:", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p00001", "input": "ans=[]\n\nfor i in range (0,10):\n\n ans.append(int(input()))\n\nans.sort(reverse=True)\n\nfor i in range (0,3):\n\n print((ans[i]))", "input_tokens": ["ans", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "\u0120(", "0", ",", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", ".append", "(int", "(input", "()))\u010a\u010a", "ans", ".sort", "(reverse", "=True", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "\u0120(", "0", ",", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "ans", "[i", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02555", "input": "# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n cnt = 0\n\n\n\n for j in range(3, i+1):\n\n cnt += dp[i-j]\n\n cnt %= mod\n\n \n\n dp[i] = cnt\n\n\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-\u010a\u010a", "import", "\u0120sys", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120int", "(", "\u0120sys", ".stdin", ".readline", "()", "\u0120)\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[", "0", "]*(", "S", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",", "\u0120S", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", ",", "\u0120i", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120dp", "[i", "-j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120=", "\u0120cnt", "\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dp", "[-", "1", "]))", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02785", "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n if K>=N:\n\n return 0\n\n H.sort()\n\n ans = sum(H[:N-K])\n\n return ans\n\nprint((solve()))", "input_tokens": ["def", "\u0120solve", "():\u010a\u010a", "\u0120", "\u0120N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120H", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120if", "\u0120K", ">=", "N", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120H", ".sort", "()\u010a\u010a", "\u0120", "\u0120ans", "\u0120=", "\u0120sum", "(H", "[:", "N", "-K", "])\u010a\u010a", "\u0120", "\u0120return", "\u0120ans", "\u010a\u010a", "print", "((", "solve", "()))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03835", "input": "k, s = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n if 0<=s-x-y<=k:\n\n ans += 1\n\n \n\nprint(ans)", "input_tokens": ["k", ",", "\u0120s", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "<=", "s", "-x", "-y", "<=", "k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03680", "input": "import sys\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(1e6):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120", "1", "\u010a\u010a", "p", "\u0120=", "\u0120a", "[", "0", "]", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "if", "\u0120a", "[", "0", "]", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(l", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a\u010a\u010a", "while", "\u0120l", "\u0120<", "\u0120int", "(", "1", "e", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[p", "]", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(l", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120a", "[p", "]", "\u0120-", "\u0120", "1", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139]} +{"problem_id": "p03796", "input": "import math\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n power = math.factorial(N)\n\n print((power % (10 ** 9 + 7)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120power", "\u0120=", "\u0120math", ".factor", "ial", "(N", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "power", "\u0120%", "\u0120(", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", ")))\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02282", "input": "def post_from_pre_in(preorder_elements, inorder_elements):\n\n if preorder_elements:\n\n global cnt\n\n root = preorder_elements[0]\n\n root_index = inorder_elements.index(root)\n\n preorder_left = preorder_elements[1:root_index+1]\n\n inorder_left = inorder_elements[:root_index]\n\n preorder_right = preorder_elements[root_index+1:]\n\n inorder_right = inorder_elements[root_index+1:]\n\n post_from_pre_in(preorder_left, inorder_left)\n\n post_from_pre_in(preorder_right, inorder_right)\n\n if cnt:\n\n print(root, end = ' ')\n\n cnt -= 1\n\n else:\n\n print(root)\n\n\n\n\n\ncnt = int(input()) - 1\n\n\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\n\n\npost_from_pre_in(a, b)\n", "input_tokens": ["def", "\u0120post", "_from", "_pre", "_in", "(pre", "order", "_elements", ",", "\u0120inorder", "_elements", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120preorder", "_elements", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120global", "\u0120cnt", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120root", "\u0120=", "\u0120preorder", "_elements", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120root", "_index", "\u0120=", "\u0120inorder", "_elements", ".index", "(root", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120preorder", "_left", "\u0120=", "\u0120preorder", "_elements", "[", "1", ":", "root", "_index", "+", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inorder", "_left", "\u0120=", "\u0120inorder", "_elements", "[:", "root", "_index", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120preorder", "_right", "\u0120=", "\u0120preorder", "_elements", "[root", "_index", "+", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inorder", "_right", "\u0120=", "\u0120inorder", "_elements", "[root", "_index", "+", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120post", "_from", "_pre", "_in", "(pre", "order", "_left", ",", "\u0120inorder", "_left", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120post", "_from", "_pre", "_in", "(pre", "order", "_right", ",", "\u0120inorder", "_right", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cnt", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(root", ",", "\u0120end", "\u0120=", "\u0120'", "\u0120')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(root", ")\u010a\u010a\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120int", "(input", "())", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "post", "_from", "_pre", "_in", "(a", ",", "\u0120b", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03078", "input": "def main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\td = [0]*x*y\n\n\tfor i in range(x):\n\n\t\tfor j in range(y):\n\n\t\t\td[i*y+j] = a[i]+b[j]\n\n\td.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\n\n\tc_len = min(k, z)\n\n\td_len = min(k, x*y)\n\n\te = [0]*d_len*c_len\n\n\tfor i in range(d_len):\n\n\t\tfor j in range(c_len):\n\n\t\t\te[i*c_len+j] = d[i] + c[j]\n\n\te.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((e[i]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0109x", ",", "\u0120y", ",", "\u0120z", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0109a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0109b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0109c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0109d", "\u0120=", "\u0120[", "0", "]*", "x", "*y", "\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(x", "):\u010a\u010a", "\u0109", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(y", "):\u010a\u010a", "\u0109\u0109", "\u0109d", "[i", "*y", "+j", "]", "\u0120=", "\u0120a", "[i", "]+", "b", "[j", "]\u010a\u010a", "\u0109d", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0109c", ".sort", "(reverse", "=True", ")\u010a\u010a\u010a\u010a", "\u0109c", "_len", "\u0120=", "\u0120min", "(k", ",", "\u0120z", ")\u010a\u010a", "\u0109d", "_len", "\u0120=", "\u0120min", "(k", ",", "\u0120x", "*y", ")\u010a\u010a", "\u0109e", "\u0120=", "\u0120[", "0", "]*", "d", "_len", "*c", "_len", "\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(d", "_len", "):\u010a\u010a", "\u0109", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(c", "_len", "):\u010a\u010a", "\u0109\u0109", "\u0109e", "[i", "*c", "_len", "+j", "]", "\u0120=", "\u0120d", "[i", "]", "\u0120+", "\u0120c", "[j", "]\u010a\u010a", "\u0109e", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0109", "\u0109print", "((", "e", "[i", "]))", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p00713", "input": "from math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) / d) / 2.0\n\n xc = (x1 + x2) / 2.0\n\n yc = (y1 + y2) / 2.0\n\n return [[xc - k*yd, yc + k*xd], [xc + k*yd, yc - k*xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = [list(map(float, input().split())) for i in range(n)]\n\n p.sort()\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - bx >= 2.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120sqrt", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u010a\u010a", "def", "\u0120circle", "_center", "(x", "1", ",", "\u0120y", "1", ",", "\u0120x", "2", ",", "\u0120y", "2", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120xd", "\u0120=", "\u0120x", "2", "\u0120-", "\u0120x", "1", ";", "\u0120y", "d", "\u0120=", "\u0120y", "2", "\u0120-", "\u0120y", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120xd", "**", "2", "\u0120+", "\u0120y", "d", "**", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120sqrt", "((", "4", ".", "0", "\u0120-", "\u0120d", ")", "\u0120/", "\u0120d", ")", "\u0120/", "\u0120", "2", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120xc", "\u0120=", "\u0120(", "x", "1", "\u0120+", "\u0120x", "2", ")", "\u0120/", "\u0120", "2", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120yc", "\u0120=", "\u0120(", "y", "1", "\u0120+", "\u0120y", "2", ")", "\u0120/", "\u0120", "2", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120[[", "xc", "\u0120-", "\u0120k", "*y", "d", ",", "\u0120yc", "\u0120+", "\u0120k", "*", "xd", "],", "\u0120[", "xc", "\u0120+", "\u0120k", "*y", "d", ",", "\u0120yc", "\u0120-", "\u0120k", "*", "xd", "]]\u010a\u010a", "while", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "==", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120[", "list", "(map", "(float", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bx", ",", "\u0120by", "\u0120=", "\u0120p", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120bx", "\u0120-", "\u0120p", "[", "prev", "][", "0", "]", "\u0120>=", "\u0120", "2", ".", "0", ":", "\u0120prev", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cx", ",", "\u0120cy", "\u0120=", "\u0120p", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cx", "\u0120-", "\u0120bx", "\u0120>=", "\u0120", "2", ".", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "bx", "\u0120-", "\u0120cx", ")**", "2", "\u0120+", "\u0120(", "by", "\u0120-", "\u0120cy", ")**", "2", "\u0120<=", "\u0120", "4", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120ex", ",", "\u0120ey", "\u0120in", "\u0120circle", "_center", "(b", "x", ",", "\u0120by", ",", "\u0120cx", ",", "\u0120cy", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(prev", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", "==", "i", "\u0120or", "\u0120k", "==", "j", ":", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dx", ",", "\u0120dy", "\u0120=", "\u0120p", "[k", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dx", "\u0120-", "\u0120bx", "\u0120>=", "\u0120", "2", ".", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "ex", "\u0120-", "\u0120dx", ")**", "2", "\u0120+", "\u0120(", "ey", "\u0120-", "\u0120dy", ")**", "2", "\u0120<=", "\u0120", "1", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120count", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5686609715453708, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5686609715453708, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5686609715453708, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5686609715453708, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5686609715453708, 0.5686609715453708, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5686609715453708, 0.5686609715453708, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5686609715453708, 0.5686609715453708, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5686609715453708, 0.5686609715453708, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5686609715453708, 0.5686609715453708, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.9823266741319063, 0.5686609715453708, 0.9643353737236128, 0.9643353737236128, 0.9643353737236128, 0.9643353737236128, 0.9643353737236128, 0.5686609715453708, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.5686609715453708, 0.5686609715453708, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.5686609715453708, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.5686609715453708, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.5686609715453708, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.5686609715453708, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.5686609715453708, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.5686609715453708, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.5686609715453708, 0.5686609715453708, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5686609715453708, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.5686609715453708, 0.5686609715453708, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.5686609715453708, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.5686609715453708, 0.5686609715453708, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.5686609715453708, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5686609715453708, 0.5686609715453708, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p03074", "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n _S = input()\n\n S = []\n\n b = _S[0]\n\n s = 0\n\n if b == '0': S.append(0)\n\n for _s in _S:\n\n if b == _s:\n\n s = s + 1\n\n else:\n\n b = _s\n\n S.append(s)\n\n s = 1\n\n S.append(s)\n\n if b == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n\n n = sum(S[0:num])\n\n m = n\n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n\n for i in range(0, len(S) - num, 2):\n\n n = n - sum(S[i:i+2])\n\n n = n + sum(S[i + num:i + num + 2])\n\n m = max(m, n)\n\n\n\n return m\n\n\n\nprint((solve()))", "input_tokens": ["def", "\u0120solve", "():\u010a\u010a", "\u0120", "\u0120N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120_", "S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120[]\u010a\u010a", "\u0120", "\u0120b", "\u0120=", "\u0120_", "S", "[", "0", "]\u010a\u010a", "\u0120", "\u0120s", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120if", "\u0120b", "\u0120==", "\u0120'", "0", "':", "\u0120S", ".append", "(", "0", ")\u010a\u010a", "\u0120", "\u0120for", "\u0120_", "s", "\u0120in", "\u0120_", "S", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120b", "\u0120==", "\u0120_", "s", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120s", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120_", "s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120S", ".append", "(s", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120S", ".append", "(s", ")\u010a\u010a", "\u0120", "\u0120if", "\u0120b", "\u0120==", "\u0120'", "0", "':", "\u0120S", ".append", "(", "0", ")\u010a\u010a\u010a\u010a", "\u0120", "\u0120num", "\u0120=", "\u0120min", "(len", "(S", "),", "\u0120", "2", "\u0120*", "\u0120K", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120", "\u0120#", "\u0120n", "\u0120=", "\u0120sum", "(S", "[", "0", ":num", "\u0120if", "\u0120_", "S", "[", "0", "]", "\u0120==", "\u0120'", "1", "'", "\u0120else", "\u0120(", "num", "\u0120-", "\u0120", "1", ")])\u010a\u010a", "\u0120", "\u0120n", "\u0120=", "\u0120sum", "(S", "[", "0", ":num", "])\u010a\u010a", "\u0120", "\u0120m", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120", "\u0120#", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", "\u0120if", "\u0120_", "S", "[", "0", "]", "\u0120==", "\u0120'", "1", "'", "\u0120else", "\u0120-", "1", ",", "\u0120len", "(S", ")", "\u0120-", "\u0120num", ",", "\u0120", "2", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120len", "(S", ")", "\u0120-", "\u0120num", ",", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120n", "\u0120-", "\u0120sum", "(S", "[i", ":i", "+", "2", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120n", "\u0120+", "\u0120sum", "(S", "[i", "\u0120+", "\u0120num", ":i", "\u0120+", "\u0120num", "\u0120+", "\u0120", "2", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120max", "(m", ",", "\u0120n", ")\u010a\u010a\u010a\u010a", "\u0120", "\u0120return", "\u0120m", "\u010a\u010a\u010a\u010a", "print", "((", "solve", "()))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\nans = math.factorial(N) % (10 ** 9 + 7)\n\nprint(ans)", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120math", ".factor", "ial", "(N", ")", "\u0120%", "\u0120(", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03371", "input": "#python3\n\nINF = int(1e9)\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF\n\n for i in range(2*10**5+100):\n\n t = 2*c*i + max(x-i, 0) * a + max(y-i, 0) * b\n\n ans = min(ans, t)\n\n print(ans)\n\nmain()", "input_tokens": ["#", "python", "3", "\u010a\u010a", "INF", "\u0120=", "\u0120int", "(", "1", "e", "9", ")\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120INF", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "*", "1", "0", "**", "5", "+", "1", "0", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "2", "*c", "*i", "\u0120+", "\u0120max", "(x", "-i", ",", "\u0120", "0", ")", "\u0120*", "\u0120a", "\u0120+", "\u0120max", "(y", "-i", ",", "\u0120", "0", ")", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120t", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "main", "()"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03828", "input": "from functools import reduce\n\nN = int(input())\n\n\n\nprime_table = [1] * (N+1)\n\n\n\nfor x in range(2, N+1):\n\n for t in range(2, x+1):\n\n while x % t == 0:\n\n prime_table[t] += 1\n\n x //= t\n\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))", "input_tokens": ["from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "prime", "_table", "\u0120=", "\u0120[", "1", "]", "\u0120*", "\u0120(", "N", "+", "1", ")\u010a\u010a\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "2", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120t", "\u0120in", "\u0120range", "(", "2", ",", "\u0120x", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120%", "\u0120t", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prime", "_table", "[t", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120//=", "\u0120t", "\u010a\u010a", "print", "((", "reduce", "(lambda", "\u0120x", ",", "\u0120y", ":", "\u0120x", "\u0120*", "\u0120y", "\u0120%", "\u0120(", "int", "(", "1", "e", "9", ")", "\u0120+", "\u0120", "7", "),", "\u0120prime", "_table", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03835", "input": "K,S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor i in range(K+1):\n\n\tfor j in range(K+1):\n\n\t\tif (S - i - j) <= K and (S-i-j) >= 0:\n\n\t\t\tans += 1\n\n\n\nprint(ans)\n", "input_tokens": ["K", ",S", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "(\"", "\u0120\"", ")))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0109", "\u0109if", "\u0120(", "S", "\u0120-", "\u0120i", "\u0120-", "\u0120j", ")", "\u0120<=", "\u0120K", "\u0120and", "\u0120(", "S", "-i", "-j", ")", "\u0120>=", "\u0120", "0", ":\u010a\u010a", "\u0109\u0109", "\u0109ans", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02412", "input": "while 1:\n\n ans=0\n\n n,x=list(map(int,input().split()))\n\n if n:\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n for k in range(j+1,n+1):\n\n if i+j+k==x:ans+=1\n\n else:break\n\n print(ans)", "input_tokens": ["while", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",x", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(j", "+", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "+j", "+k", "==", "x", ":", "ans", "+=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":", "break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9035222925783293, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506]} +{"problem_id": "p02767", "input": "def main():\n\n from statistics import mean\n\n from math import floor,ceil\n\n\n\n n = int(input())\n\n x = list(map(int, input().split()))\n\n x_mean = mean(x) \n\n if x_mean == 0.5:\n\n greater_than_x = len([i for i in x if i > x_mean])\n\n if greater_than_x * 2 >= n:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n elif x_mean % 1 > 0.5:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n x2 = [(num - x_mean)**2 for num in x]\n\n print((sum(x2)))\n\n\n\nmain()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120", "\u0120from", "\u0120statistics", "\u0120import", "\u0120mean", "\u010a\u010a", "\u0120", "\u0120from", "\u0120math", "\u0120import", "\u0120floor", ",", "ceil", "\u010a\u010a\u010a\u010a", "\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120", "\u0120x", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120x", "_mean", "\u0120=", "\u0120mean", "(x", ")", "\u0120\u010a\u010a", "\u0120", "\u0120if", "\u0120x", "_mean", "\u0120==", "\u0120", "0", ".", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120greater", "_than", "_x", "\u0120=", "\u0120len", "([", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120x", "\u0120if", "\u0120i", "\u0120>", "\u0120x", "_mean", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120greater", "_than", "_x", "\u0120*", "\u0120", "2", "\u0120>=", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "_mean", "\u0120=", "\u0120ceil", "(x", "_mean", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "_mean", "\u0120=", "\u0120floor", "(x", "_mean", ")\u010a\u010a", "\u0120", "\u0120elif", "\u0120x", "_mean", "\u0120%", "\u0120", "1", "\u0120>", "\u0120", "0", ".", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120x", "_mean", "\u0120=", "\u0120ceil", "(x", "_mean", ")\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120x", "_mean", "\u0120=", "\u0120floor", "(x", "_mean", ")\u010a\u010a", "\u0120", "\u0120x", "2", "\u0120=", "\u0120[(", "num", "\u0120-", "\u0120x", "_mean", ")**", "2", "\u0120for", "\u0120num", "\u0120in", "\u0120x", "]\u010a\u010a", "\u0120", "\u0120print", "((", "sum", "(x", "2", "))", ")\u010a\u010a\u010a\u010a", "main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03854", "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef solve():\n\n S = input()\n\n # print(S, len(S))\n\n\n\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n\n\n\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n\n\n def recur(i, w):\n\n if not TABLE[w][i] == -1:\n\n return TABLE[w][i]\n\n\n\n if i >= len(S):\n\n # print(\"jey\", log)\n\n return True\n\n\n\n r1, r2, r3, r4 = False, False, False, False\n\n if S[i:i + 5] == words[0]:\n\n r1 = recur(i + 5, 0)\n\n if S[i:i + 7] == words[1]:\n\n r2 = recur(i + 7, 1)\n\n if S[i:i + 5] == words[2]:\n\n r3 = recur(i + 5, 2)\n\n if S[i:i + 6] == words[3]:\n\n r4 = recur(i + 6, 3)\n\n\n\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n\n\n\n return TABLE[w][i]\n\n\n\n ans = recur(0, 0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "6", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(S", ",", "\u0120len", "(S", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120words", "\u0120=", "\u0120{", "0", ":", "\u0120\"", "dream", "\",", "\u0120", "1", ":", "\u0120\"", "dream", "er", "\",", "\u0120", "2", ":", "\u0120\"", "erase", "\",", "\u0120", "3", ":", "\u0120\"", "eras", "er", "\"", "}\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120TABLE", "\u0120=", "\u0120[[", "-", "1", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(len", "(S", ")", "\u0120+", "\u0120", "1", ")]", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(len", "(words", ")", "\u0120+", "\u0120", "1", ")]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120recur", "(i", ",", "\u0120w", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120TABLE", "[w", "][", "i", "]", "\u0120==", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120TABLE", "[w", "][", "i", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120>=", "\u0120len", "(S", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120print", "(\"", "j", "ey", "\",", "\u0120log", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "1", ",", "\u0120r", "2", ",", "\u0120r", "3", ",", "\u0120r", "4", "\u0120=", "\u0120False", ",", "\u0120False", ",", "\u0120False", ",", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", ":i", "\u0120+", "\u0120", "5", "]", "\u0120==", "\u0120words", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "1", "\u0120=", "\u0120recur", "(i", "\u0120+", "\u0120", "5", ",", "\u0120", "0", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", ":i", "\u0120+", "\u0120", "7", "]", "\u0120==", "\u0120words", "[", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "2", "\u0120=", "\u0120recur", "(i", "\u0120+", "\u0120", "7", ",", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", ":i", "\u0120+", "\u0120", "5", "]", "\u0120==", "\u0120words", "[", "2", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "3", "\u0120=", "\u0120recur", "(i", "\u0120+", "\u0120", "5", ",", "\u0120", "2", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", ":i", "\u0120+", "\u0120", "6", "]", "\u0120==", "\u0120words", "[", "3", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "4", "\u0120=", "\u0120recur", "(i", "\u0120+", "\u0120", "6", ",", "\u0120", "3", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120TABLE", "[w", "][", "i", "]", "\u0120=", "\u0120r", "1", "\u0120or", "\u0120r", "2", "\u0120or", "\u0120r", "3", "\u0120or", "\u0120r", "4", "\u0120or", "\u0120False", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120TABLE", "[w", "][", "i", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120recur", "(", "0", ",", "\u0120", "0", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ans", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120solve", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120res", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "YES", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.582053818991329, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.582053818991329, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.582053818991329, 0.9460144469641688, 0.9460144469641688, 0.582053818991329, 0.582053818991329, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.582053818991329, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9733714842433752, 0.9733714842433752, 0.582053818991329, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.582053818991329, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02773", "input": "from collections import defaultdict\n\n\n\nN = int(input())\n\nA = [input() for _ in range(N)]\n\nA.sort()\n\nd = defaultdict(int)\n\nfor a in A:\n\n d[a] += 1\n\n\n\nl = sorted(d.items())\n\nmax_v = 0\n\n\n\nfor _, v in l:\n\n if v > max_v:\n\n max_v = v\n\n \n\nfor k, v in l:\n\n if v == max_v:\n\n print(k)\n\n else:\n\n continue\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "input", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "A", ".sort", "()\u010a\u010a", "d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[a", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120sorted", "(d", ".items", "())\u010a\u010a", "max", "_v", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120_,", "\u0120v", "\u0120in", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120v", "\u0120>", "\u0120max", "_v", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_v", "\u0120=", "\u0120v", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "for", "\u0120k", ",", "\u0120v", "\u0120in", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120v", "\u0120==", "\u0120max", "_v", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(k", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139]} +{"problem_id": "p02691", "input": "n = int(input())\n\na = list(map(int, input().split()))\n\na_index = []\n\nfor i in range(n):\n\n a_index.append((i, a[i]))\n\ndic1 = {}\n\ndic2 = {}\n\nfor i in range(n):\n\n one = a_index[i][0] + a_index[i][1]\n\n two = a_index[i][0] - a_index[i][1]\n\n if one not in dic1:\n\n dic1[one] = 1\n\n else:\n\n dic1[one] += 1\n\n if two not in dic2:\n\n dic2[two] = 1\n\n else:\n\n dic2[two] += 1\n\nans = 0\n\nfor i in list(dic1.keys()):\n\n if i in dic2:\n\n ans += dic2[i] * dic1[i]\n\nfor i in list(dic2.keys()):\n\n if i in dic1:\n\n ans += dic1[i] * dic2[i]\n\n #print(i)\n\nprint((ans // 2))\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "_index", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_index", ".append", "((", "i", ",", "\u0120a", "[i", "]))\u010a\u010a", "dic", "1", "\u0120=", "\u0120{}\u010a\u010a", "dic", "2", "\u0120=", "\u0120{}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120one", "\u0120=", "\u0120a", "_index", "[i", "][", "0", "]", "\u0120+", "\u0120a", "_index", "[i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120two", "\u0120=", "\u0120a", "_index", "[i", "][", "0", "]", "\u0120-", "\u0120a", "_index", "[i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120one", "\u0120not", "\u0120in", "\u0120dic", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dic", "1", "[", "one", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dic", "1", "[", "one", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120two", "\u0120not", "\u0120in", "\u0120dic", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dic", "2", "[t", "wo", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dic", "2", "[t", "wo", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120list", "(dic", "1", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120in", "\u0120dic", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120dic", "2", "[i", "]", "\u0120*", "\u0120dic", "1", "[i", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120list", "(dic", "2", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120in", "\u0120dic", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120dic", "1", "[i", "]", "\u0120*", "\u0120dic", "2", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "print", "(i", ")\u010a\u010a", "print", "((", "ans", "\u0120//", "\u0120", "2", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416]} +{"problem_id": "p03835", "input": "k,s=list(map(int,input().split()))\n\nans=chk=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if (0<=s-i-j<=k): ans+=1\n\nprint(ans)", "input_tokens": ["k", ",s", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "=", "chk", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "0", "<=", "s", "-i", "-j", "<=", "k", "):", "\u0120ans", "+=", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03564", "input": "N,K = int(input()), int(input())\n\nnow = 1\n\nfor i in range(N):\n\n if now*2 < now + K:\n\n now *= 2\n\n else:\n\n now += K\n\nprint(now)\n", "input_tokens": ["N", ",K", "\u0120=", "\u0120int", "(input", "()),", "\u0120int", "(input", "())\u010a\u010a", "now", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120now", "*", "2", "\u0120<", "\u0120now", "\u0120+", "\u0120K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120now", "\u0120*=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120now", "\u0120+=", "\u0120K", "\u010a\u010a", "print", "(now", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p02881", "input": "import math\n\nn=int(input())\n\nans=n\n\ni=1\n\nwhile(i<=math.sqrt(n)):\n\n if n%i==0:\n\n d=i+n/i-2\n\n ans=min(ans,d)\n\n i+=1\n\nprint((int(ans)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "ans", "=n", "\u010a\u010a", "i", "=", "1", "\u010a\u010a", "while", "(i", "<=", "math", ".sqrt", "(n", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "%i", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "=i", "+n", "/i", "-", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "=min", "(ans", ",d", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "+=", "1", "\u010a\u010a", "print", "((", "int", "(ans", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\n\n\npower = math.factorial(N)\n\n\n\nprint((power % 1000000007))\n\n\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "power", "\u0120=", "\u0120math", ".factor", "ial", "(N", ")\u010a\u010a\u010a\u010a", "print", "((", "power", "\u0120%", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03170", "input": "n, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii <= k:\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n", "input_tokens": ["n", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "_s", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "dp", "\u0120=", "\u0120[\"", "Second", "\"]", "\u0120*", "\u0120(", "k", "\u0120+", "\u0120", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "]", "\u0120==", "\u0120\"", "Second", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120a", "_s", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ii", "\u0120=", "\u0120i", "\u0120+", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120ii", "\u0120<=", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[ii", "]", "\u0120=", "\u0120\"", "First", "\"\u010a\u010a", "print", "((", "dp", "[-", "1", "]))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293]} +{"problem_id": "p02622", "input": "S, T = [list(input()) for _ in range(2)]\n\ncnt = 0\n\nfor i in range(len(S)):\n\n if S[i] != T[i]:\n\n cnt += 1\n\nprint(cnt)\n", "input_tokens": ["S", ",", "\u0120T", "\u0120=", "\u0120[", "list", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "2", ")]\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", "]", "\u0120!=", "\u0120T", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p02886", "input": "N = int(input())\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N-1):\n\n for j in range(i+1,N):\n\n cnt += D[i]*D[j]\n\nprint(cnt)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "D", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120D", "[i", "]*", "D", "[j", "]\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03370", "input": "N, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(input())\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x // min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n if x >= min(mn):\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)", "input_tokens": ["N", ",", "\u0120X", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "mn", "\u0120=", "\u0120[", "0", "]*", "N", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120mn", "[i", "]", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u010a\u010a", "ans", "\u0120=", "\u0120N", "\u010a\u010a", "x", "\u0120=", "\u0120X", "\u0120-", "\u0120sum", "(m", "n", ")\u010a\u010a\u010a\u010a", "while", "(x", "\u0120>=", "\u0120min", "(m", "n", "))", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120x", "\u0120//", "\u0120min", "(m", "n", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120mn", "[m", "n", ".index", "(min", "(m", "n", "))]", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120>=", "\u0120min", "(m", "n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120-=", "\u0120min", "(m", "n", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02596", "input": "#! /usr/bin/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\n\n\ndef isMultiple(s, m):\n\n tmp = 0\n\n for i in range(len(s)):\n\n tmp = (tmp * 10 + int(s[i])) % m\n\n if tmp == 0:\n\n return i\n\n return -1\n\n\n\n\n\nk = int(readline())\n\nacc = \"7\" * 50000000\n\nif k % 2 == 0:\n\n ans = -1\n\nelse:\n\n\n\n ans = isMultiple(acc, k)\n\n if ans != -1:\n\n ans += 1\n\n\n\nprint(ans)\n", "input_tokens": ["#!", "\u0120/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "int", "1", "\u0120=", "\u0120lambda", "\u0120x", ":", "\u0120int", "(x", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readlines", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "5", "0", "0", "0", "0", "0", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120is", "Multiple", "(s", ",", "\u0120m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120(", "tmp", "\u0120*", "\u0120", "1", "0", "\u0120+", "\u0120int", "(s", "[i", "]))", "\u0120%", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120-", "1", "\u010a\u010a\u010a\u010a\u010a\u010a", "k", "\u0120=", "\u0120int", "(read", "line", "())\u010a\u010a", "acc", "\u0120=", "\u0120\"", "7", "\"", "\u0120*", "\u0120", "5", "0", "0", "0", "0", "0", "0", "0", "\u010a\u010a", "if", "\u0120k", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120-", "1", "\u010a\u010a", "else", ":\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120is", "Multiple", "(acc", ",", "\u0120k", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ans", "\u0120!=", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p02615", "input": "n,*l=list(map(int,open(0).read().split()));print((sum(sorted(l*2)[-2:~n:-1])))", "input_tokens": ["n", ",*", "l", "=list", "(map", "(int", ",", "open", "(", "0", ").", "read", "().", "split", "()));", "print", "((", "sum", "(sorted", "(l", "*", "2", ")[-", "2", ":", "~", "n", ":-", "1", "])))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02881", "input": "import math\n\nN = int(input())\n\nfor i in range(int(math.sqrt(N))):\n\n if N % (int(math.sqrt(N))-i) == 0:\n\n print((int(N/(int(math.sqrt(N))-i)+int(math.sqrt(N))-i-2)))\n\n break", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(int", "(math", ".sqrt", "(N", ")))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120N", "\u0120%", "\u0120(", "int", "(math", ".sqrt", "(N", "))-", "i", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "int", "(N", "/(", "int", "(math", ".sqrt", "(N", "))-", "i", ")+", "int", "(math", ".sqrt", "(N", "))-", "i", "-", "2", ")))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229]} +{"problem_id": "p02994", "input": "N, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple():\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)//2 - eat_apple()))", "input_tokens": ["N", ",", "\u0120L", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "min", "_", "\u0120=", "\u0120L", "\u010a\u010a", "max", "_", "\u0120=", "\u0120L", "\u0120+", "\u0120N", "\u0120-", "1", "\u010a\u010a\u010a\u010a", "def", "\u0120eat", "_app", "le", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120max", "_<", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120max", "_", "\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120L", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120L", "\u010a\u010a\u010a\u010a", "print", "(((", "min", "_", "+", "max", "_", ")*(", "max", "_-", "min", "_", "+", "1", ")//", "2", "\u0120-", "\u0120eat", "_app", "le", "()))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03363", "input": "from collections import Counter\n\n\n\nN = int(input())\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\nruisekiwa = [0] * (N+1)\n\n\n\nfor i in range(N):\n\n ruisekiwa[i+1] = ruisekiwa[i] + inputs[i]\n\n\n\nruisekiwa = ruisekiwa[1:]\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "inputs", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "ruise", "ki", "wa", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "+", "1", ")\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ru", "ise", "ki", "wa", "[i", "+", "1", "]", "\u0120=", "\u0120ru", "ise", "ki", "wa", "[i", "]", "\u0120+", "\u0120inputs", "[i", "]\u010a\u010a\u010a\u010a", "ruise", "ki", "wa", "\u0120=", "\u0120ru", "ise", "ki", "wa", "[", "1", ":]\u010a\u010a", "ruise", "ki", "wa", ".sort", "()\u010a\u010a", "counter", "_ru", "ise", "ki", "\u0120=", "\u0120Counter", "(r", "u", "ise", "ki", "wa", ")\u010a\u010a\u010a\u010a", "for", "\u0120key", ",", "\u0120value", "\u0120in", "\u0120list", "(counter", "_ru", "ise", "ki", ".items", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120key", "\u0120==", "\u0120", "0", "\u0120and", "\u0120value", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120key", "\u0120==", "\u0120", "0", "\u0120and", "\u0120value", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120value", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120sum", "(list", "(range", "(value", "))", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03457", "input": "import sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n T = [list(map(int, _input().split())) for _ in range(N)]\n\n t, x, y = 0, 0, 0\n\n for next_t, next_x, next_y in T:\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "_input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120resolve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(_", "input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120_", "input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120next", "_t", ",", "\u0120next", "_x", ",", "\u0120next", "_y", "\u0120in", "\u0120T", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120diff", "_xy", "\u0120=", "\u0120abs", "(x", "\u0120-", "\u0120next", "_x", ")", "\u0120+", "\u0120abs", "(y", "\u0120-", "\u0120next", "_y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120diff", "_t", "\u0120=", "\u0120next", "_t", "\u0120-", "\u0120t", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120diff", "_xy", "\u0120>", "\u0120diff", "_t", "\u0120or", "\u0120(", "diff", "_xy", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120diff", "_t", "\u0120%", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120resolve", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03107", "input": "S = [int(_) for _ in input()]\n\nlength = len(S)\n\ntemp = [S[0]]\n\nfor x in S[1:]:\n\n if(len(temp) == 0):\n\n temp.append(x)\n\n elif( temp[-1] == x):\n\n temp.append(x)\n\n else:\n\n temp.pop(-1)\n\nprint((length-len(temp)))\n\n ", "input_tokens": ["S", "\u0120=", "\u0120[", "int", "(_)", "\u0120for", "\u0120_", "\u0120in", "\u0120input", "()]\u010a\u010a", "length", "\u0120=", "\u0120len", "(S", ")\u010a\u010a", "temp", "\u0120=", "\u0120[", "S", "[", "0", "]]\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120S", "[", "1", ":]", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(len", "(temp", ")", "\u0120==", "\u0120", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", ".append", "(x", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "(", "\u0120temp", "[-", "1", "]", "\u0120==", "\u0120x", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", ".append", "(x", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", ".pop", "(-", "1", ")\u010a\u010a", "print", "((", "length", "-len", "(temp", ")))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428]} +{"problem_id": "p02596", "input": "K = int(input())\n\n\n\nflg = [False]*K\n\n\n\ntmp = 7 % K\n\ncnt = 1\n\nif tmp == 0:\n\n print(cnt)\n\n exit()\n\nwhile True:\n\n tmp = (tmp*10+7)%K\n\n if flg[tmp]:\n\n print((-1))\n\n break\n\n else:\n\n cnt += 1\n\n if tmp == 0:\n\n print(cnt)\n\n break\n\n flg[tmp] = True\n", "input_tokens": ["K", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "fl", "g", "\u0120=", "\u0120[", "False", "]*", "K", "\u010a\u010a\u010a\u010a", "tmp", "\u0120=", "\u0120", "7", "\u0120%", "\u0120K", "\u010a\u010a", "cnt", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120tmp", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(cnt", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120(", "tmp", "*", "1", "0", "+", "7", ")%", "K", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120fl", "g", "[tmp", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(cnt", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fl", "g", "[tmp", "]", "\u0120=", "\u0120True", "\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399]} +{"problem_id": "p03796", "input": "from math import factorial\n\nprint((factorial(int(input())) % (10**9+7)))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a", "print", "((", "factor", "ial", "(int", "(input", "()))", "\u0120%", "\u0120(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03822", "input": "import sys\n\nsys.setrecursionlimit(202020)\n\n\n\nN = int(input())\n\nwon = [[] for i in range(N)]\n\nfor i in range(1,N):\n\n a = int(input()) - 1\n\n won[a].append(i)\n\n\n\ndef height(v):\n\n if not won[v]: return 0\n\n hs = [height(op) for op in won[v]]\n\n ret = 0\n\n for i,h in enumerate(sorted(hs)):\n\n ret = max(ret, h + len(hs) - i)\n\n return ret\n\n\n\nprint((height(0)))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "2", "0", "2", "0", "2", "0", ")\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "won", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(input", "())", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120won", "[a", "].", "append", "(i", ")\u010a\u010a\u010a\u010a", "def", "\u0120height", "(v", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120won", "[v", "]:", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120hs", "\u0120=", "\u0120[", "height", "(op", ")", "\u0120for", "\u0120op", "\u0120in", "\u0120won", "[v", "]]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",h", "\u0120in", "\u0120enumerate", "(sorted", "(h", "s", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120max", "(ret", ",", "\u0120h", "\u0120+", "\u0120len", "(h", "s", ")", "\u0120-", "\u0120i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "print", "((", "height", "(", "0", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02595", "input": "N, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a**2 + b**2) <= D**2:\n\n count += 1\n\nprint(count)\n", "input_tokens": ["N", ",", "\u0120D", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "a", "**", "2", "\u0120+", "\u0120b", "**", "2", ")", "\u0120<=", "\u0120D", "**", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03309", "input": "# ABC102C - Linear Approximation (ARC100C)\n\nfrom statistics import median\n\n\n\n\n\ndef main():\n\n n = int(input())\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = tuple(j - i for i, j in enumerate(A, start=1))\n\n b = median(A)\n\n ans = sum(abs(a - b) for a in A)\n\n print((int(ans)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["#", "\u0120ABC", "1", "0", "2", "C", "\u0120-", "\u0120Linear", "\u0120Approx", "imation", "\u0120(", "ARC", "1", "0", "0", "C", ")\u010a\u010a", "from", "\u0120statistics", "\u0120import", "\u0120median", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120tuple", "(map", "(int", ",", "\u0120input", "().", "rstrip", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120tuple", "(j", "\u0120-", "\u0120i", "\u0120for", "\u0120i", ",", "\u0120j", "\u0120in", "\u0120enumerate", "(A", ",", "\u0120start", "=", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120median", "(A", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120sum", "(abs", "(a", "\u0120-", "\u0120b", ")", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "int", "(ans", ")))\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p01105", "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nL = {el: 1 for el in [a, b, c, d, e, 0]}\n\nfor i in range(6):\n\n R = sorted(L.items(), key=lambda x: x[1])\n\n for p, l in R:\n\n if l < 16:\n\n L[p ^ e] = min(L.get(p ^ e, 16), l+1)\n\n if l+3 < 16:\n\n for q, r in R:\n\n if l+r+3 <= 16:\n\n L[p & q] = min(L.get(p & q, 16), l+r+3)\n\n L[p ^ q] = min(L.get(p ^ q, 16), l+r+3)\n\n else: break\n\n else: break\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n", "input_tokens": ["a", "=", "6", "5", "2", "8", "0", ";", "\u0120b", "=", "6", "1", "6", "8", "0", ";", "\u0120c", "=", "5", "2", "4", "2", "8", ";", "\u0120d", "=", "4", "3", "6", "9", "0", ";", "\u0120e", "=", "6", "5", "5", "3", "5", "\u010a\u010a", "L", "\u0120=", "\u0120{", "el", ":", "\u0120", "1", "\u0120for", "\u0120el", "\u0120in", "\u0120[", "a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120d", ",", "\u0120e", ",", "\u0120", "0", "]", "}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", "\u0120=", "\u0120sorted", "(L", ".items", "(),", "\u0120key", "=lambda", "\u0120x", ":", "\u0120x", "[", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120p", ",", "\u0120l", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120<", "\u0120", "1", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120^", "\u0120e", "]", "\u0120=", "\u0120min", "(L", ".get", "(p", "\u0120^", "\u0120e", ",", "\u0120", "1", "6", "),", "\u0120l", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+", "3", "\u0120<", "\u0120", "1", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120q", ",", "\u0120r", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<=", "\u0120", "1", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120&", "\u0120q", "]", "\u0120=", "\u0120min", "(L", ".get", "(p", "\u0120&", "\u0120q", ",", "\u0120", "1", "6", "),", "\u0120l", "+r", "+", "3", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120^", "\u0120q", "]", "\u0120=", "\u0120min", "(L", ".get", "(p", "\u0120^", "\u0120q", ",", "\u0120", "1", "6", "),", "\u0120l", "+r", "+", "3", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120break", "\u010a\u010a", "print", "(*(", "L", "[e", "\u0120&", "\u0120eval", "(s", ")]", "\u0120for", "\u0120s", "\u0120in", "\u0120open", "(", "0", ").", "read", "().", "replace", "(*", "\"-", "~", "\").", "replace", "(*", "\"*", "&", "\").", "replace", "(*", "\"", "1", "e", "\").", "split", "()", "[:-", "1", "]),", "sep", "='\\", "n", "')\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354]} +{"problem_id": "p02792", "input": "#python3\n\nfrom collections import defaultdict\n\nfrom collections import namedtuple\n\n\n\nP = namedtuple('P', ['front', 'end'])\n\n\n\ndef f(x):\n\n return P(str(x)[0], str(x)[-1]) \n\n\n\ndef main():\n\n\n\n n = int(input())\n\n freq = defaultdict(int)\n\n\n\n for i in range(1, n+1):\n\n p = f(i)\n\n freq[p]+=1\n\n\n\n\n\n ans = 0\n\n for i in range(1, n + 1):\n\n p = f(i)\n\n q = (p.end, p.front)\n\n ans += freq[q]\n\n\n\n print(ans)\n\n\n\nmain()", "input_tokens": ["#", "python", "3", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120namedtuple", "\u010a\u010a\u010a\u010a", "P", "\u0120=", "\u0120namedtuple", "('", "P", "',", "\u0120['", "front", "',", "\u0120'", "end", "']", ")\u010a\u010a\u010a\u010a", "def", "\u0120f", "(x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120P", "(str", "(x", ")[", "0", "],", "\u0120str", "(x", ")[-", "1", "])", "\u0120\u010a\u010a\u010a\u010a", "def", "\u0120main", "():", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120freq", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120f", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120freq", "[p", "]+=", "1", "\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120f", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120(", "p", ".end", ",", "\u0120p", ".front", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120freq", "[q", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a", "main", "()"], "input_token_weights": [0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7186273667339679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03038", "input": "n, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(key=lambda x: x[1], reverse=True)\n\na.sort()\n\n\n\ni = 0\n\nfor b, c in bc:\n\n for _ in range(b):\n\n if i < n and a[i] < c:\n\n a[i] = c\n\n i += 1\n\n else:\n\n break\n\n\n\nans = sum(a)\n\nprint(ans)\n", "input_tokens": ["n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "bc", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(m", ")]", "\u010a\u010a\u010a\u010a", "bc", ".sort", "(key", "=lambda", "\u0120x", ":", "\u0120x", "[", "1", "],", "\u0120reverse", "=True", ")\u010a\u010a", "a", ".sort", "()\u010a\u010a\u010a\u010a", "i", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120bc", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120<", "\u0120n", "\u0120and", "\u0120a", "[i", "]", "\u0120<", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[i", "]", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120sum", "(a", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p01138", "input": "def f(s):\n\n s=list(map(int,s.split(':')))\n\n return (s[0]*60+s[1])*60+s[2]\n\na=86401\n\nwhile 1:\n\n t=[0]*a\n\n n=int(input())\n\n if n==0:break\n\n for _ in range(n):\n\n b,c=input().split()\n\n t[f(b)]+=1;t[f(c)]-=1\n\n d=0\n\n for i in range(1,a):\n\n t[i]+=t[i-1]\n\n d=max(d,t[i])\n\n print(d)", "input_tokens": ["def", "\u0120f", "(s", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=list", "(map", "(int", ",s", ".split", "(':", "'))", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "s", "[", "0", "]*", "6", "0", "+s", "[", "1", "])*", "6", "0", "+s", "[", "2", "]\u010a\u010a", "a", "=", "8", "6", "4", "0", "1", "\u010a\u010a", "while", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "=[", "0", "]*", "a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "==", "0", ":", "break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", ",c", "=input", "().", "split", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[f", "(b", ")]", "+=", "1", ";t", "[f", "(c", ")]", "-=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",a", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[i", "]+=", "t", "[i", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "=max", "(d", ",t", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(d", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "%(", "1", "0", "**", "9", "+", "7", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03107", "input": "S = list(input())\n\nnum_one = S.count(\"1\")\n\nnum_zero = S.count(\"0\")\n\nans = min(num_one, num_zero) *2\n\nprint(ans)\n", "input_tokens": ["S", "\u0120=", "\u0120list", "(input", "())\u010a\u010a", "num", "_one", "\u0120=", "\u0120S", ".count", "(\"", "1", "\")\u010a\u010a", "num", "_zero", "\u0120=", "\u0120S", ".count", "(\"", "0", "\")\u010a\u010a", "ans", "\u0120=", "\u0120min", "(num", "_one", ",", "\u0120num", "_zero", ")", "\u0120*", "2", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03457", "input": "import sys\n\ncan = True; input()\n\ne = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]\n\nfor a, b in zip(e[1:], e):\n\n t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])\n\n if t < 0 or t % 2 == 1: can = False; break\n\nprint((['No', 'Yes'][can]))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "can", "\u0120=", "\u0120True", ";", "\u0120input", "()\u010a\u010a", "e", "\u0120=", "\u0120[[", "0", ",", "\u0120", "0", ",", "\u0120", "0", "]]", "\u0120+", "\u0120[", "list", "(map", "(int", ",", "\u0120e", ".split", "()))", "\u0120for", "\u0120e", "\u0120in", "\u0120sys", ".stdin", "]\u010a\u010a", "for", "\u0120a", ",", "\u0120b", "\u0120in", "\u0120zip", "(e", "[", "1", ":],", "\u0120e", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120a", "[", "0", "]", "\u0120-", "\u0120b", "[", "0", "]", "\u0120-", "\u0120abs", "(a", "[", "1", "]", "\u0120-", "\u0120b", "[", "1", "])", "\u0120-", "\u0120abs", "(a", "[", "2", "]", "\u0120-", "\u0120b", "[", "2", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120t", "\u0120<", "\u0120", "0", "\u0120or", "\u0120t", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":", "\u0120can", "\u0120=", "\u0120False", ";", "\u0120break", "\u010a\u010a", "print", "((", "['", "No", "',", "\u0120'", "Yes", "'][", "can", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p02901", "input": "import sys\n\nreadline = sys.stdin.readline\n\n\n\nN,M = list(map(int,readline().split()))\n\nINF = 10 ** 10\n\ndp = [INF] * (2 ** N)\n\ndp[0] = 0\n\n\n\nfor i in range(M):\n\n a,b = list(map(int,readline().split()))\n\n c = list(map(int,readline().split()))\n\n key = 0\n\n for j in range(len(c)):\n\n key += (1 << (c[j] - 1))\n\n for j in range(len(dp)):\n\n if dp[j] == INF:\n\n continue\n\n if j | key == j:\n\n continue\n\n dp[j | key] = min(dp[j | key], dp[j] + a)\n\n\n\nif dp[-1] == INF:\n\n print((-1))\n\nelse:\n\n print((dp[-1]))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",", "read", "line", "().", "split", "()))\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "1", "0", "\u010a\u010a", "dp", "\u0120=", "\u0120[", "INF", "]", "\u0120*", "\u0120(", "2", "\u0120**", "\u0120N", ")\u010a\u010a", "dp", "[", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120", "\u0120a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",", "read", "line", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "read", "line", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120key", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(c", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120key", "\u0120+=", "\u0120(", "1", "\u0120<<", "\u0120(", "c", "[j", "]", "\u0120-", "\u0120", "1", "))\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(dp", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[j", "]", "\u0120==", "\u0120INF", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120|", "\u0120key", "\u0120==", "\u0120j", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[j", "\u0120|", "\u0120key", "]", "\u0120=", "\u0120min", "(dp", "[j", "\u0120|", "\u0120key", "],", "\u0120dp", "[j", "]", "\u0120+", "\u0120a", ")\u010a\u010a\u010a\u010a", "if", "\u0120dp", "[-", "1", "]", "\u0120==", "\u0120INF", ":\u010a\u010a", "\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "((", "dp", "[-", "1", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02721", "input": "N, K, C = list(map(int, input().split()))\n\nS = input()\n\n\n\nlatest = [None]*K\n\ni = len(S)+C\n\nfor j in range(K-1, -1, -1):\n\n i = S.rindex(\"o\", 0, i-C)\n\n latest[j] = i\n\n\n\nif i<=C or \"o\" not in S[:i-C]:\n\n i = -C-1\n\n for j in latest:\n\n i = S.index(\"o\", i+C+1)\n\n if i == j:\n\n print((i+1))\n", "input_tokens": ["N", ",", "\u0120K", ",", "\u0120C", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "latest", "\u0120=", "\u0120[", "None", "]*", "K", "\u010a\u010a", "i", "\u0120=", "\u0120len", "(S", ")+", "C", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(K", "-", "1", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120", "\u0120i", "\u0120=", "\u0120S", ".r", "index", "(\"", "o", "\",", "\u0120", "0", ",", "\u0120i", "-C", ")\u010a\u010a", "\u0120", "\u0120latest", "[j", "]", "\u0120=", "\u0120i", "\u010a\u010a\u010a\u010a", "if", "\u0120i", "<=", "C", "\u0120or", "\u0120\"", "o", "\"", "\u0120not", "\u0120in", "\u0120S", "[:", "i", "-C", "]:\u010a\u010a", "\u0120", "\u0120i", "\u0120=", "\u0120-", "C", "-", "1", "\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120latest", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120S", ".index", "(\"", "o", "\",", "\u0120i", "+C", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120j", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "i", "+", "1", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p02688", "input": "N, K = list(map(int, input().split()))\n\nsunuke = [True]*N\n\nfor i in range(K):\n\n d = int(input())\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n sunuke[a-1] = False\n\n\n\nans = 0\n\nfor i in range(N):\n\n if sunuke[i]:\n\n ans += 1\n\nprint(ans)", "input_tokens": ["N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "sun", "uke", "\u0120=", "\u0120[", "True", "]*", "N", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sun", "uke", "[a", "-", "1", "]", "\u0120=", "\u0120False", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120sun", "uke", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p03796", "input": "import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n import math\n\n n=int(input())\n\n print((math.factorial(n)%(10**9+7)))\n\nresolve()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "def", "\u0120input", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a\u010a\u010a", "def", "\u0120resolve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120math", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "math", ".factor", "ial", "(n", ")", "%(", "1", "0", "**", "9", "+", "7", ")))\u010a\u010a", "resolve", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03416", "input": "A,B = list(map(int,input().split()))\n\nj = 0\n\nfor i in range(A,B+1):\n\n l = list(str(i))\n\n l_reverse = list(reversed(l))\n\n if l == l_reverse:\n\n j += 1\n\nprint(j)", "input_tokens": ["A", ",B", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "j", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(A", ",B", "+", "1", "):\u010a\u010a", "\u0120", "\u0120l", "\u0120=", "\u0120list", "(str", "(i", "))\u010a\u010a", "\u0120", "\u0120l", "_reverse", "\u0120=", "\u0120list", "(re", "versed", "(l", "))\u010a\u010a", "\u0120", "\u0120if", "\u0120l", "\u0120==", "\u0120l", "_reverse", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(j", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02390", "input": "s = int(input())\n\nm, s = s // 60, s % 60\n\nh, m = m // 60, m % 60\n\nprint((':'.join(map(str, [h,m,s]))))", "input_tokens": ["s", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "m", ",", "\u0120s", "\u0120=", "\u0120s", "\u0120//", "\u0120", "6", "0", ",", "\u0120s", "\u0120%", "\u0120", "6", "0", "\u010a\u010a", "h", ",", "\u0120m", "\u0120=", "\u0120m", "\u0120//", "\u0120", "6", "0", ",", "\u0120m", "\u0120%", "\u0120", "6", "0", "\u010a\u010a", "print", "(", "(':", "'.", "join", "(map", "(str", ",", "\u0120[", "h", ",m", ",s", "]))", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(N", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03819", "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = map(int, input().split())\n\n LR = [list(map(int, input().split())) for _ in range(n)]\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n \n\n S = sorted([(r-l+1, l, r) for l, r in LR], reverse=True)\n\n cnt = n\n\n L = []\n\n for i in range(1, m+1):\n\n while S and S[-1][0] == i:\n\n c, l, r = S.pop()\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n L.append(res)\n\n print(*L, sep=\"\\n\")\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120", "\u0120n", ",", "\u0120m", "\u0120=", "\u0120map", "(int", ",", "\u0120input", "().", "split", "())\u010a\u010a", "\u0120", "\u0120LR", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u010a\u010a", "\u0120", "\u0120BIT", "\u0120=", "\u0120[", "0", "]*(", "m", "+", "2", ")\u010a\u010a", "\u0120", "\u0120def", "\u0120add", "(i", ",", "\u0120a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120<=", "\u0120m", "+", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120BIT", "[i", "]", "\u0120+=", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120i", "&", "(-", "i", ")\u010a\u010a", "\u0120", "\u0120def", "\u0120bit", "_sum", "(i", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120+=", "\u0120BIT", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120-=", "\u0120i", "&", "(-", "i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120res", "\u010a\u010a", "\u0120\u0120\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120sorted", "([(", "r", "-l", "+", "1", ",", "\u0120l", ",", "\u0120r", ")", "\u0120for", "\u0120l", ",", "\u0120r", "\u0120in", "\u0120LR", "],", "\u0120reverse", "=True", ")\u010a\u010a", "\u0120", "\u0120cnt", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120", "\u0120L", "\u0120=", "\u0120[]\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120m", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120S", "\u0120and", "\u0120S", "[-", "1", "][", "0", "]", "\u0120==", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120c", ",", "\u0120l", ",", "\u0120r", "\u0120=", "\u0120S", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120add", "(l", ",", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120add", "(r", "+", "1", ",", "\u0120-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120cnt", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "0", ",", "\u0120m", "+", "1", ",", "\u0120i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120+=", "\u0120bit", "_sum", "(j", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", ".append", "(res", ")\u010a\u010a", "\u0120", "\u0120print", "(*", "L", ",", "\u0120sep", "=\"\\", "n", "\")\u010a\u010a", "\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03126", "input": "import functools\n\nprint((len(functools.reduce(lambda x, y: x&y,[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))", "input_tokens": ["import", "\u0120functools", "\u010a\u010a", "print", "((", "len", "(f", "unct", "ools", ".reduce", "(lambda", "\u0120x", ",", "\u0120y", ":", "\u0120x", "&", "y", ",[", "set", "(input", "().", "split", "()[", "1", ":])", "\u0120for", "\u0120_", "\u0120in", "\u0120[", "0", "]*", "int", "(input", "().", "split", "()[", "0", "])", "]))", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03480", "input": "#!/usr/bin/env python3\n\n# coding=utf-8\n\n\n\nimport sys\n\n\n\ns = sys.stdin.readline().strip()\n\nl = [_s is \"1\" for _s in list(s)]\n\nl_r = l[::-1]\n\nindex = 0\n\nfor i, (c, n, c_r, n_r) in enumerate(\n\n zip(l[:len(s) // 2], l[1:len(s) // 2 + 1], l_r[:len(s) // 2], l_r[1:len(s) // 2 + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\nprint((len(s) - index))", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "#", "\u0120coding", "=utf", "-", "8", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a", "l", "\u0120=", "\u0120[_", "s", "\u0120is", "\u0120\"", "1", "\"", "\u0120for", "\u0120_", "s", "\u0120in", "\u0120list", "(s", ")]\u010a\u010a", "l", "_r", "\u0120=", "\u0120l", "[::-", "1", "]\u010a\u010a", "index", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", ",", "\u0120(", "c", ",", "\u0120n", ",", "\u0120c", "_r", ",", "\u0120n", "_r", ")", "\u0120in", "\u0120enumerate", "(\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120zip", "(l", "[:", "len", "(s", ")", "\u0120//", "\u0120", "2", "],", "\u0120l", "[", "1", ":len", "(s", ")", "\u0120//", "\u0120", "2", "\u0120+", "\u0120", "1", "],", "\u0120l", "_r", "[:", "len", "(s", ")", "\u0120//", "\u0120", "2", "],", "\u0120l", "_r", "[", "1", ":len", "(s", ")", "\u0120//", "\u0120", "2", "\u0120+", "\u0120", "1", "]))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120c", "\u0120^", "\u0120n", "\u0120or", "\u0120c", "_r", "\u0120^", "\u0120n", "_r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120index", "\u0120=", "\u0120i", "\u0120+", "\u0120", "1", "\u010a\u010a", "print", "((", "len", "(s", ")", "\u0120-", "\u0120index", "))"], "input_token_weights": [0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03325", "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\n\n\nSUM = 0\n\nfor i in A:\n\n count = 0\n\n while i%2 == 0:\n\n i//=2\n\n count += 1\n\n SUM+=count\n\nprint(SUM)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "SUM", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "//=", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120SUM", "+=", "count", "\u010a\u010a", "print", "(S", "UM", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03796", "input": "n = int(input())\n\n\n\nINF = 10**9 + 7\n\n\n\nans = [0] * (10**5 + 1)\n\nans[0] = 1\n\n\n\nfor i in range(1,10**5 + 1):\n\n ans[i] = ans[i-1] * i % INF\n\n\n\nprint((ans[n]))\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "1", "0", "**", "5", "\u0120+", "\u0120", "1", ")\u010a\u010a", "ans", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "1", "0", "**", "5", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "[i", "]", "\u0120=", "\u0120ans", "[i", "-", "1", "]", "\u0120*", "\u0120i", "\u0120%", "\u0120INF", "\u010a\u010a\u010a\u010a", "print", "((", "ans", "[n", "]))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nm = max(x, y)\n\nfor i in range(1, m+1):\n\n x -= 1\n\n y -= 1\n\n if x < 0:\n\n x = 0\n\n if y < 0:\n\n y = 0\n\n temp = c*(i*2) + x*a + y*b\n\n if temp < ans:\n\n ans = temp\n\n\n\nprint(ans)\n", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120a", "\u0120*", "\u0120x", "\u0120+", "\u0120b", "\u0120*", "\u0120y", "\u010a\u010a", "m", "\u0120=", "\u0120max", "(x", ",", "\u0120y", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120m", "+", "1", "):\u010a\u010a", "\u0120", "\u0120x", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120y", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120if", "\u0120x", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120if", "\u0120y", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120temp", "\u0120=", "\u0120c", "*(", "i", "*", "2", ")", "\u0120+", "\u0120x", "*a", "\u0120+", "\u0120y", "*b", "\u010a\u010a", "\u0120", "\u0120if", "\u0120temp", "\u0120<", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120temp", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354]} +{"problem_id": "p03798", "input": "n=int(input())\n\ns=input()\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\n\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n #print(x[i])\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "s", "=input", "()\u010a\u010a", "x", "=[\"", "SS", "\",\"", "SW", "\",\"", "WS", "\",\"", "WW", "\"]", "\u010a\u010a\u010a\u010a", "def", "\u0120check", "0", "(i", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "0", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[", "0", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][-", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][-", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[", "0", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][-", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][-", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "W", "\"\u010a\u010a", "def", "\u0120check", "1", "(i", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "n", "-", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[n", "-", "1", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "n", "-", "2", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "n", "-", "2", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[n", "-", "1", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "n", "-", "2", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "n", "-", "2", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "W", "\"", "\u010a\u010a\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(n", "-", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "j", "+", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[j", "+", "1", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "j", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "j", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[j", "+", "1", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "j", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "j", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "print", "(x", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120check", "0", "(i", ")", "\u0120and", "\u0120check", "1", "(i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "x", "[i", "]))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139]} +{"problem_id": "p03162", "input": "# coding: utf-8\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [[0] * 3 for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n for j in range(3):\n\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] \\\n\n for k in range(3) if k != j)\n\n return(max(dp[n]))\n\n\n\nn = int(input()) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n", "input_tokens": ["#", "\u0120coding", ":", "\u0120utf", "-", "8", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "def", "\u0120f", "(n", ",", "\u0120abc", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120", "3", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", "\u0120+", "\u0120", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "j", "]", "\u0120=", "\u0120max", "(dp", "[i", "\u0120-", "\u0120", "1", "][", "k", "]", "\u0120+", "\u0120abc", "[i", "\u0120-", "\u0120", "1", "][", "j", "]", "\u0120\\\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "3", ")", "\u0120if", "\u0120k", "\u0120!=", "\u0120j", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "(max", "(dp", "[n", "]))", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())", "\u0120\u0120\u0120", "\u0120#", "\u0120", "1", "\u0120<=", "\u0120n", "\u0120<=", "\u0120", "1", "0", "^", "5", "\u010a\u010a", "abc", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "print", "((", "f", "(n", ",", "\u0120abc", ")))\u010a"], "input_token_weights": [0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02595", "input": "N, D = list(map(int, input().split()))\n\npoint = []\n\nfor i in range(N):\n\n point.append(list(map(int, input().split())))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in point:\n\n if (i[0]**2 + i[1]**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)", "input_tokens": ["N", ",", "\u0120D", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "point", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120point", ".append", "(list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", ")\u010a\u010a\u010a\u010a", "ct", "\u0120=", "\u0120", "0", "\u010a\u010a", "D", "2", "\u0120=", "\u0120D", "\u0120*", "\u0120D", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120point", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "[", "0", "]**", "2", "\u0120+", "\u0120i", "[", "1", "]**", "2", ")", "\u0120<=", "\u0120D", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ct", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ct", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719]} +{"problem_id": "p03796", "input": "from math import factorial\n\n\n\nmod = 10**9 + 7\n\nn = int(input())\n\n\n\nans = factorial(n) % mod\n\nprint(ans)", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "ans", "\u0120=", "\u0120factorial", "(n", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03078", "input": "import heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\ndef diff(l):\n\n m = max(l)\n\n return sorted(m - v for v in l)[1:]\n\n\n\ns = sum(map(max, [a, b, c]))\n\nsa, sb, sc = list(map(diff, [a, b, c]))\n\nda, db, dc = [0], [0], [0]\n\nq = [0]\n\nwhile k > 0:\n\n while True:\n\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n\n heapq.heappush(q, v)\n\n da.append(sa[0])\n\n sa = sa[1:]\n\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n\n heapq.heappush(q, v)\n\n db.append(sb[0])\n\n sb = sb[1:]\n\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n\n heapq.heappush(q, v)\n\n dc.append(sc[0])\n\n sc = sc[1:]\n\n else:\n\n break\n\n v = heapq.heappop(q)\n\n print(s - v)\n\n k -= 1\n", "input_tokens": ["import", "\u0120heapq", "\u010a\u010a\u010a\u010a", "x", ",", "\u0120y", ",", "\u0120z", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120diff", "(l", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120max", "(l", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120sorted", "(m", "\u0120-", "\u0120v", "\u0120for", "\u0120v", "\u0120in", "\u0120l", ")[", "1", ":]", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120sum", "(map", "(max", ",", "\u0120[", "a", ",", "\u0120b", ",", "\u0120c", "]))\u010a\u010a", "sa", ",", "\u0120sb", ",", "\u0120sc", "\u0120=", "\u0120list", "(map", "(diff", ",", "\u0120[", "a", ",", "\u0120b", ",", "\u0120c", "]))\u010a\u010a", "da", ",", "\u0120db", ",", "\u0120dc", "\u0120=", "\u0120[", "0", "],", "\u0120[", "0", "],", "\u0120[", "0", "]\u010a\u010a", "q", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "while", "\u0120k", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(sa", ")", "\u0120>", "\u0120", "0", "\u0120and", "\u0120(", "len", "(q", ")", "\u0120==", "\u0120", "0", "\u0120or", "\u0120q", "[", "0", "]", "\u0120>", "\u0120sa", "[", "0", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", "\u0120in", "\u0120[", "sa", "[", "0", "]", "\u0120+", "\u0120bb", "\u0120+", "\u0120cc", "\u0120for", "\u0120bb", "\u0120in", "\u0120db", "\u0120for", "\u0120cc", "\u0120in", "\u0120dc", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120v", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120da", ".append", "(sa", "[", "0", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sa", "\u0120=", "\u0120sa", "[", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120len", "(sb", ")", "\u0120>", "\u0120", "0", "\u0120and", "\u0120(", "len", "(q", ")", "\u0120==", "\u0120", "0", "\u0120or", "\u0120q", "[", "0", "]", "\u0120>", "\u0120sb", "[", "0", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", "\u0120in", "\u0120[", "sb", "[", "0", "]", "\u0120+", "\u0120aa", "\u0120+", "\u0120cc", "\u0120for", "\u0120aa", "\u0120in", "\u0120da", "\u0120for", "\u0120cc", "\u0120in", "\u0120dc", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120v", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120db", ".append", "(sb", "[", "0", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sb", "\u0120=", "\u0120sb", "[", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120len", "(sc", ")", "\u0120>", "\u0120", "0", "\u0120and", "\u0120(", "len", "(q", ")", "\u0120==", "\u0120", "0", "\u0120or", "\u0120q", "[", "0", "]", "\u0120>", "\u0120sc", "[", "0", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", "\u0120in", "\u0120[", "sc", "[", "0", "]", "\u0120+", "\u0120aa", "\u0120+", "\u0120bb", "\u0120for", "\u0120aa", "\u0120in", "\u0120da", "\u0120for", "\u0120bb", "\u0120in", "\u0120db", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120v", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dc", ".append", "(sc", "[", "0", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sc", "\u0120=", "\u0120sc", "[", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120heapq", ".he", "app", "op", "(q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(s", "\u0120-", "\u0120v", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120-=", "\u0120", "1", "\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891]} +{"problem_id": "p02837", "input": "N = int(input())\n\nA = [0]*N\n\nX = []\n\nY = []\n\nfor i in range(N):\n\n A[i] = int(input())\n\n X.append([])\n\n Y.append([])\n\n for j in range(A[i]):\n\n x, y = list(map(int, input().split()))\n\n X[i].append(x-1)\n\n Y[i].append(y)\n\nans = 0\n\nfor bit in range(1<= k:\n\n print(a)\n\n exit()\n\n\n", "input_tokens": ["n", ",k", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "num", "\u0120=", "\u0120", "0", "\u010a\u010a", "q", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", ".append", "((", "a", ",b", "))\u010a\u010a", "q", ".sort", "()\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120q", "[i", "][", "0", "],", "\u0120q", "[i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120num", "\u0120>=", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03197", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\ndef dfs(x, y):\n\n if x==0 and y==0:\n\n t[x][y] = False\n\n return False\n\n \n\n if x>=1:\n\n t[x][y] |= not dfs(x-1, y)\n\n \n\n if y>=1:\n\n t[x][y] |= not dfs(x, y-1)\n\n \n\n if min(x, y)>=1:\n\n t[x][y] |= not dfs(x-1, y-1)\n\n \n\n return t[x][y]\n\n \n\nt = [[False]*7 for _ in range(7)]\n\n\n\nfor i in range(7):\n\n for j in range(7):\n\n dfs(i, j)\n\n\n\n\"\"\"\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(input())\n\nflag = True\n\n\n\nfor _ in range(N):\n\n a = int(input())\n\n \n\n if a%2==1:\n\n flag = False\n\n \n\nif flag:\n\n print('second')\n\nelse:\n\n print('first')", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120*", "\u010a\u010a\u010a\u010a", "def", "\u0120dfs", "(x", ",", "\u0120y", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "==", "0", "\u0120and", "\u0120y", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[x", "][", "y", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", ">=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[x", "][", "y", "]", "\u0120|=", "\u0120not", "\u0120dfs", "(x", "-", "1", ",", "\u0120y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120y", ">=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[x", "][", "y", "]", "\u0120|=", "\u0120not", "\u0120dfs", "(x", ",", "\u0120y", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120min", "(x", ",", "\u0120y", ")>=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[x", "][", "y", "]", "\u0120|=", "\u0120not", "\u0120dfs", "(x", "-", "1", ",", "\u0120y", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120t", "[x", "][", "y", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "t", "\u0120=", "\u0120[[", "False", "]*", "7", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "7", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "7", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "7", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dfs", "(i", ",", "\u0120j", ")\u010a\u010a\u010a\u010a", "\"\"\"\u010a\u010a", "for", "\u0120ti", "\u0120in", "\u0120t", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(*", "ti", ")\u010a\u010a", "\"\"\"", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "flag", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "%", "2", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120flag", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "if", "\u0120flag", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "second", "')\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "first", "')"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169]} +{"problem_id": "p03416", "input": "a,b=list(map(int, input().split()))\n\ncnt=0\n\nfor i in range(a,b+1):\n\n n=list(str(i))\n\n if n==list(reversed(n)):\n\n cnt+=1\n\nprint(cnt)", "input_tokens": ["a", ",b", "=list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=list", "(str", "(i", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "==", "list", "(re", "versed", "(n", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "+=", "1", "\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03416", "input": "a, b = list(map(int, input().strip().split(\" \")))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\nprint(count)\n", "input_tokens": ["a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "strip", "().", "split", "(\"", "\u0120\"", ")))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120str", "(i", ")", "\u0120==", "\u0120str", "(i", ")[", "::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\np = math.factorial(N)\n\nprint((p % 1000000007))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "p", "\u0120=", "\u0120math", ".factor", "ial", "(N", ")\u010a\u010a", "print", "((", "p", "\u0120%", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02891", "input": "import sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(input())\n\n \n\ndef check_count(s):\n\n cnt_list = [1]\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt_list[-1] += 1\n\n else:\n\n cnt_list.append(1)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c//2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k//2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)//2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "\u0120\u010a\u010a", "s", "\u0120=", "\u0120input", "().", "rstrip", "()\u010a\u010a", "k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "def", "\u0120check", "_count", "(s", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "_list", "\u0120=", "\u0120[", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "-", "1", "]", "\u0120==", "\u0120s", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "_list", "[-", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "_list", ".append", "(", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120cnt", "_list", "\u010a\u010a\u010a\u010a", "def", "\u0120calc", "_ans", "(cnt", "_list", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120_", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120cnt", "_list", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120_", "ans", "\u0120+=", "\u0120c", "//", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "(_", "ans", "\u0120*", "\u0120k", ")\u010a\u010a\u010a\u010a", "if", "\u0120len", "(s", ")==", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120k", "//", "2", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "_list", "\u0120=", "\u0120check", "_count", "(s", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(cnt", "_list", ")==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120(", "len", "(s", ")*", "k", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120calc", "_ans", "(cnt", "_list", ",", "\u0120k", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[", "0", "]==", "s", "[-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "_list", "[", "0", "]%", "2", "==", "1", "\u0120and", "\u0120cnt", "_list", "[-", "1", "]%", "2", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120k", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p02881", "input": "N = int(input())\n\n\n\n\n\ndef dist(i, j):\n\n return i + j - 2\n\n\n\n\n\nmin = 10 ** 24\n\ni = 1\n\nwhile (i ** 2) <= N:\n\n if 0 == N % i:\n\n j = N // i\n\n d = dist(i, j)\n\n if min > d:\n\n min = d\n\n i += 1\n\nprint(d)\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a\u010a\u010a", "def", "\u0120dist", "(i", ",", "\u0120j", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120i", "\u0120+", "\u0120j", "\u0120-", "\u0120", "2", "\u010a\u010a\u010a\u010a\u010a\u010a", "min", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "2", "4", "\u010a\u010a", "i", "\u0120=", "\u0120", "1", "\u010a\u010a", "while", "\u0120(", "i", "\u0120**", "\u0120", "2", ")", "\u0120<=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "\u0120==", "\u0120N", "\u0120%", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120N", "\u0120//", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120dist", "(i", ",", "\u0120j", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120min", "\u0120>", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120min", "\u0120=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(d", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293]} +{"problem_id": "p02552", "input": "n = int(input())\n\nprint((1 if n == 0 else 0))\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "1", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", "\u0120else", "\u0120", "0", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03039", "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n ans += f1(x,y,n,m)+f1(1,1,x,y)+f1(1,y,x,m)+f1(x,1,n,y)\n\n ans -= f2(x,n) + f2(1,x) + f2(1,y) + f2(y,m)\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "8", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "#", "mod", "\u0120=", "\u0120", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "**", "1", "8", "\u010a\u010a", "eps", "\u0120=", "\u0120", "1", "0", "**", "-", "7", "\u010a\u010a\u010a\u010a", "m", ",n", ",k", "\u0120=", "\u0120list", "(map", "(int", ",", "read", "line", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120comb", "(n", ",", "\u0120r", ",", "\u0120mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120min", "(r", ",", "\u0120n", "-r", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120mol", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120den", "o", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120r", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mol", "\u0120=", "\u0120mol", "\u0120*", "\u0120(", "n", "-r", "+i", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120den", "o", "\u0120=", "\u0120den", "o", "\u0120*", "\u0120i", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120mol", "\u0120*", "\u0120pow", "(d", "eno", ",", "\u0120mod", "-", "2", ",", "\u0120mod", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "def", "\u0120f", "1", "(x", ",y", ",a", ",b", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "a", "+b", "-x", "-y", ")*(", "a", "-x", "+", "1", ")*(", "b", "-y", "+", "1", ")//", "2", "\u010a\u010a\u010a\u010a", "def", "\u0120f", "2", "(x", ",a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "a", "-x", ")*(", "a", "-x", "+", "1", ")//", "2", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(", "1", ",m", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120f", "1", "(x", ",y", ",n", ",m", ")+", "f", "1", "(", "1", ",", "1", ",x", ",y", ")+", "f", "1", "(", "1", ",y", ",x", ",m", ")+", "f", "1", "(x", ",", "1", ",n", ",y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120-=", "\u0120f", "2", "(x", ",n", ")", "\u0120+", "\u0120f", "2", "(", "1", ",x", ")", "\u0120+", "\u0120f", "2", "(", "1", ",y", ")", "\u0120+", "\u0120f", "2", "(y", ",m", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120%=", "\u0120mod", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120(", "ans", "\u0120*", "\u0120comb", "(m", "*n", "-", "2", ",k", "-", "2", ",", "mod", "))", "%", "mod", "\u010a\u010a", "ans", "\u0120=", "\u0120ans", "*pow", "(", "2", ",", "mod", "-", "2", ",", "mod", ")%", "mod", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03013", "input": "import sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\n\n\nl = [0] * (n+1)\n\nl[0] = 1\n\n\n\na = 0\n\nif m != 0:\n\n a = int(input())\n\nk = 1\n\nfor i in range(n+1):\n\n\n\n if i != a:\n\n if i == 1:\n\n l[i] = 1\n\n elif i >= 2:\n\n l[i] = l[i-1] + l[i-2]\n\n l[i] %= 1000000007\n\n else:\n\n k += 1\n\n if k <= m:\n\n a = int(input())\n\n\n\n\n\n\n\n#print(l)\n\nprint((l[n] % 1000000007))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "7", ")\u010a\u010a", "def", "\u0120l", "mi", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120l", "mi", "()\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "+", "1", ")\u010a\u010a", "l", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "a", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120m", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "k", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "1", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120!=", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[i", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120i", "\u0120>=", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[i", "]", "\u0120=", "\u0120l", "[i", "-", "1", "]", "\u0120+", "\u0120l", "[i", "-", "2", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[i", "]", "\u0120%=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", "\u0120<=", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a\u010a\u010a\u010a\u010a", "#print", "(l", ")\u010a\u010a", "print", "((", "l", "[n", "]", "\u0120%", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03013", "input": "N,M = list(map(int,input().split()))\n\nMOD = 10**9+7\n\ndp = [0]*(N+1)\n\ndp[0]=1\n\nA = [int(input()) for i in range(M)]\n\nban = [1]*(N+1)\n\nfor a in A:\n\n ban[a]=0\n\nfor i in range(N):\n\n if i-1>=0:\n\n dp[i+1]=dp[i]*ban[i]+dp[i-1]*ban[i-1]\n\n else:\n\n dp[i+1]=dp[i]*ban[i]\n\n dp[i+1] %= MOD \n\nprint((dp[N]))", "input_tokens": ["N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "MOD", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]*(", "N", "+", "1", ")\u010a\u010a", "dp", "[", "0", "]=", "1", "\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", ")]\u010a\u010a", "ban", "\u0120=", "\u0120[", "1", "]*(", "N", "+", "1", ")\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ban", "[a", "]=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "-", "1", ">=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "]=", "dp", "[i", "]*", "ban", "[i", "]+", "dp", "[i", "-", "1", "]*", "ban", "[i", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "]=", "dp", "[i", "]*", "ban", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "]", "\u0120%=", "\u0120MOD", "\u0120\u010a\u010a", "print", "((", "dp", "[N", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658]} +{"problem_id": "p03371", "input": "def main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", ",", "\u0120B", ",", "\u0120AB", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120M", "\u0120=", "\u0120max", "(X", ",", "\u0120Y", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120A", "\u0120*", "\u0120X", "\u0120+", "\u0120B", "\u0120*", "\u0120Y", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", ",\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120AB", "\u0120*", "\u0120k", "\u0120*", "\u0120", "2", "\u0120+", "\u0120max", "(", "0", ",", "\u0120X", "\u0120-", "\u0120k", ")", "\u0120*", "\u0120A", "\u0120+", "\u0120max", "(", "0", ",", "\u0120Y", "\u0120-", "\u0120k", ")", "\u0120*", "\u0120B", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120)\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", "\u0120>=", "\u0120M", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02245", "input": "import sys\n\n\n\ninit = ''.join(sys.stdin.read().split())\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start, goal):\n\n if start == goal:\n\n return 0\n\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n\n step = {start: 0, goal: 0}\n\n s = 0\n\n c_d = [(start, 0), (goal, 1)] # configure and direction\n\n while True:\n\n q = iter(c_d)\n\n c_d = []\n\n s += 1\n\n for c, d in q:\n\n i = c.find('0')\n\n if 0 <= i <= 5:\n\n t = str.maketrans('0' + c[i+3], c[i+3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i >= 3:\n\n t = str.maketrans('0' + c[i-3], c[i-3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n\n t = str.maketrans('0' + c[i+1], c[i+1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n\n t = str.maketrans('0' + c[i-1], c[i-1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n\n\nprint((solve(init, '123456780')))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "init", "\u0120=", "\u0120''.", "join", "(sys", ".stdin", ".read", "().", "split", "())\u010a\u010a", "\u010a\u010a", "#", "\u0120Bid", "irectional", "\u0120search", "\u0120using", "\u0120breadth", "-first", "\u0120search", "\u010a\u010a", "def", "\u0120solve", "(start", ",", "\u0120goal", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120start", "\u0120==", "\u0120goal", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120generated", "_state", "\u0120=", "\u0120{", "start", ":", "\u0120", "0", ",", "\u0120goal", ":", "\u0120", "1", "}", "\u0120\u0120", "\u0120#", "\u0120", "0", ":", "\u0120fore", "ward", ",", "\u0120", "1", ":", "\u0120backward", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120step", "\u0120=", "\u0120{", "start", ":", "\u0120", "0", ",", "\u0120goal", ":", "\u0120", "0", "}\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "_d", "\u0120=", "\u0120[(", "start", ",", "\u0120", "0", "),", "\u0120(", "goal", ",", "\u0120", "1", ")]", "\u0120#", "\u0120configure", "\u0120and", "\u0120direction", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120iter", "(c", "_d", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "_d", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120c", ",", "\u0120d", "\u0120in", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120c", ".find", "('", "0", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "\u0120<=", "\u0120i", "\u0120<=", "\u0120", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120str", ".m", "ak", "etr", "ans", "('", "0", "'", "\u0120+", "\u0120c", "[i", "+", "3", "],", "\u0120c", "[i", "+", "3", "]", "\u0120+", "\u0120'", "0", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "_c", "\u0120=", "\u0120c", ".translate", "(t", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "_c", "\u0120in", "\u0120generated", "_state", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120generated", "_state", "[t", "_c", "]", "\u0120!=", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120s", "\u0120+", "\u0120step", "[t", "_c", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120generated", "_state", "[t", "_c", "]", "\u0120=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120step", "[t", "_c", "]", "\u0120=", "\u0120s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "_d", ".append", "((", "t", "_c", ",", "\u0120d", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120>=", "\u0120", "3", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120str", ".m", "ak", "etr", "ans", "('", "0", "'", "\u0120+", "\u0120c", "[i", "-", "3", "],", "\u0120c", "[i", "-", "3", "]", "\u0120+", "\u0120'", "0", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "_c", "\u0120=", "\u0120c", ".translate", "(t", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "_c", "\u0120in", "\u0120generated", "_state", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120generated", "_state", "[t", "_c", "]", "\u0120!=", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120s", "\u0120+", "\u0120step", "[t", "_c", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120generated", "_state", "[t", "_c", "]", "\u0120=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120step", "[t", "_c", "]", "\u0120=", "\u0120s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "_d", ".append", "((", "t", "_c", ",", "\u0120d", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "0", "\u0120or", "\u0120i", "\u0120==", "\u0120", "1", "\u0120or", "\u0120i", "\u0120==", "\u0120", "3", "\u0120or", "\u0120i", "\u0120==", "\u0120", "4", "\u0120or", "\u0120i", "\u0120==", "\u0120", "6", "\u0120or", "\u0120i", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120str", ".m", "ak", "etr", "ans", "('", "0", "'", "\u0120+", "\u0120c", "[i", "+", "1", "],", "\u0120c", "[i", "+", "1", "]", "\u0120+", "\u0120'", "0", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "_c", "\u0120=", "\u0120c", ".translate", "(t", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "_c", "\u0120in", "\u0120generated", "_state", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120generated", "_state", "[t", "_c", "]", "\u0120!=", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120s", "\u0120+", "\u0120step", "[t", "_c", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120generated", "_state", "[t", "_c", "]", "\u0120=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120step", "[t", "_c", "]", "\u0120=", "\u0120s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "_d", ".append", "((", "t", "_c", ",", "\u0120d", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "1", "\u0120or", "\u0120i", "\u0120==", "\u0120", "2", "\u0120or", "\u0120i", "\u0120==", "\u0120", "4", "\u0120or", "\u0120i", "\u0120==", "\u0120", "5", "\u0120or", "\u0120i", "\u0120==", "\u0120", "7", "\u0120or", "\u0120i", "\u0120==", "\u0120", "8", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120str", ".m", "ak", "etr", "ans", "('", "0", "'", "\u0120+", "\u0120c", "[i", "-", "1", "],", "\u0120c", "[i", "-", "1", "]", "\u0120+", "\u0120'", "0", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "_c", "\u0120=", "\u0120c", ".translate", "(t", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "_c", "\u0120in", "\u0120generated", "_state", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120generated", "_state", "[t", "_c", "]", "\u0120!=", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120s", "\u0120+", "\u0120step", "[t", "_c", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120generated", "_state", "[t", "_c", "]", "\u0120=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120step", "[t", "_c", "]", "\u0120=", "\u0120s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "_d", ".append", "((", "t", "_c", ",", "\u0120d", "))", "\u010a\u010a\u010a\u010a", "print", "((", "solve", "(init", ",", "\u0120'", "1", "2", "3", "4", "5", "6", "7", "8", "0", "')))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5652845444887389, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5652845444887389, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5652845444887389, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.5652845444887389, 0.5652845444887389, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.5652845444887389, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.5652845444887389, 0.5652845444887389, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.9845529969357061, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.5652845444887389, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5652845444887389, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5652845444887389, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5652845444887389, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5652845444887389, 0.5652845444887389, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5652845444887389, 0.9202622330629227, 0.9202622330629227, 0.9202622330629227, 0.9202622330629227, 0.9202622330629227, 0.9202622330629227, 0.9202622330629227, 0.5652845444887389, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5652845444887389, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.5652845444887389, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.5652845444887389, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5652845444887389, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5652845444887389, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5652845444887389, 0.8691775287719905, 0.8691775287719905, 0.5652845444887389, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5652845444887389, 0.5652845444887389, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5652845444887389, 0.5652845444887389, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5652845444887389, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5652845444887389, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.5652845444887389, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.5652845444887389, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5652845444887389, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.5652845444887389, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5652845444887389, 0.7967329450848046, 0.7967329450848046, 0.5652845444887389, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.5652845444887389, 0.5652845444887389, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.5652845444887389, 0.5652845444887389, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.5652845444887389, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5652845444887389, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5652845444887389, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5652845444887389, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5652845444887389, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.5652845444887389, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5652845444887389, 0.7186273667339679, 0.7186273667339679, 0.5652845444887389, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.5652845444887389, 0.5652845444887389, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.5652845444887389, 0.5652845444887389, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.5652845444887389, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5652845444887389, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.5652845444887389, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.5652845444887389, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5652845444887389, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.5652845444887389, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5652845444887389, 0.6339004969859428, 0.6339004969859428, 0.5652845444887389, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.5652845444887389, 0.5652845444887389, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.5652845444887389, 0.5652845444887389, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.5652845444887389, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02837", "input": "def popcount(x):\n\n r, q = 0, x\n\n while x:\n\n r += 1\n\n x &= x - 1\n\n return r, q\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\nl = (1 << n) - 1 \n\nb = sorted(map(popcount, list(range(1, l + 1))))\n\nans = next((i for i, x in reversed(b)\n\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)), 0)\n\nprint(ans)\n", "input_tokens": ["def", "\u0120pop", "count", "(x", "):\u010a\u010a", "\u0120", "\u0120r", ",", "\u0120q", "\u0120=", "\u0120", "0", ",", "\u0120x", "\u010a\u010a", "\u0120", "\u0120while", "\u0120x", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120&=", "\u0120x", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120return", "\u0120r", ",", "\u0120q", "\u010a\u010a", "\u0120\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "r", "\u0120=", "\u0120list", "(range", "(n", "))\u010a\u010a", "a", "\u0120=", "\u0120[[", "0", ",", "\u0120", "0", "]", "\u0120for", "\u0120_", "\u0120in", "\u0120r", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120r", ":\u010a\u010a", "\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(int", "(input", "()))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "[i", "][", "y", "]", "\u0120|=", "\u0120", "1", "\u0120<<", "\u0120(", "x", "\u0120-", "\u0120", "1", ")\u010a\u010a", "l", "\u0120=", "\u0120(", "1", "\u0120<<", "\u0120n", ")", "\u0120-", "\u0120", "1", "\u0120\u010a\u010a", "b", "\u0120=", "\u0120sorted", "(map", "(pop", "count", ",", "\u0120list", "(range", "(", "1", ",", "\u0120l", "\u0120+", "\u0120", "1", "))))\u010a\u010a", "ans", "\u0120=", "\u0120next", "((", "i", "\u0120for", "\u0120i", ",", "\u0120x", "\u0120in", "\u0120reversed", "(b", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120all", "(a", "[j", "][", "0", "]", "\u0120&", "\u0120x", "\u0120==", "\u0120a", "[j", "][", "1", "]", "\u0120&", "\u0120l", "\u0120-", "\u0120x", "\u0120==", "\u0120", "0", "\u0120for", "\u0120j", "\u0120in", "\u0120r", "\u0120if", "\u0120x", "\u0120>>", "\u0120j", "\u0120&", "\u0120", "1", ")),", "\u0120", "0", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03634", "input": "import queue\n\nn = int(input())\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\nwhile not q.empty():\n\n tmp = q.get()\n\n for i in range(len(abc[tmp])):\n\n #print(abc[tmp])\n\n #exit()\n\n num = abc[tmp][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[tmp] + abc[tmp][i][1]\n\n q.put(num)\n\n \n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))", "input_tokens": ["import", "\u0120queue", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "abc", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "1", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120abc", "[a", "].", "append", "([", "b", ",c", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120abc", "[b", "].", "append", "([", "a", ",c", "])\u010a\u010a", "\u010a\u010a", "Q", ",k", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "xy", "\u0120=", "\u0120[[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(Q", ")]", "\u010a\u010a\u010a\u010a", "q", "\u0120=", "\u0120queue", ".Queue", "()\u010a\u010a\u010a\u010a", "q", ".put", "(k", ")\u010a\u010a\u010a\u010a", "path", "\u0120=", "\u0120[-", "1", "]*(", "n", "+", "1", ")\u010a\u010a", "path", "[k", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "while", "\u0120not", "\u0120q", ".empty", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120q", ".get", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(", "abc", "[tmp", "]))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "print", "(", "abc", "[tmp", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "exit", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120abc", "[tmp", "][", "i", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120path", "[num", "]", "\u0120!=", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120path", "[num", "]", "\u0120=", "\u0120path", "[tmp", "]", "\u0120+", "\u0120abc", "[tmp", "][", "i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", ".put", "(num", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(Q", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "path", "[", "xy", "[i", "][", "0", "]]", "+", "path", "[", "xy", "[i", "][", "1", "]]", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02394", "input": "W,H,x,y,r = [int(i) for i in input().split()]\n\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "input_tokens": ["W", ",H", ",x", ",y", ",r", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "if", "\u0120x", "\u0120-", "\u0120r", "\u0120>=", "\u0120", "0", "\u0120and", "\u0120x", "\u0120+", "\u0120r", "\u0120<=", "\u0120W", "\u0120and", "\u0120y", "\u0120-", "\u0120r", "\u0120>=", "\u0120", "0", "\u0120and", "\u0120y", "\u0120+", "\u0120r", "\u0120<=", "\u0120H", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Yes", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "No", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03325", "input": "from math import log2\n\nn = int(input())\n\na = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor _a in a:\n\n if _a%2 == 0:\n\n cnt =0\n\n while _a%2 == 0:\n\n _a //= 2\n\n cnt += 1\n\n ans += cnt\n\n\n\nprint((int(ans)))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120log", "2", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "a", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120_", "a", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120_", "a", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120_", "a", "\u0120//=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cnt", "\u010a\u010a\u010a\u010a", "print", "((", "int", "(ans", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02685", "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n ret = p\n\n inv = pow(m-1, mod-2, mod)\n\n for i in range(1, k+1):\n\n ncr = (ncr * (n-i)*pow(i, mod-2, mod)) % mod\n\n p = (p*inv) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "input_tokens": ["#", "\u0120coding", ":", "\u0120utf", "-", "8", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "(*", "args", ":", "\u0120str", ")", "\u0120->", "\u0120str", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120m", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120args", "[", "0", "].", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120m", "\u0120==", "\u0120", "1", "\u0120and", "\u0120n", "-", "1", "\u0120==", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120str", "(", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "cr", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120m", "*pow", "(m", "-", "1", ",", "\u0120n", "-", "1", ",", "\u0120mod", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120p", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "\u0120=", "\u0120pow", "(m", "-", "1", ",", "\u0120mod", "-", "2", ",", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "cr", "\u0120=", "\u0120(", "nc", "r", "\u0120*", "\u0120(", "n", "-i", ")*", "pow", "(i", ",", "\u0120mod", "-", "2", ",", "\u0120mod", "))", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120(", "p", "*", "inv", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120p", "*", "nc", "r", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120str", "(ret", "\u0120%", "\u0120mod", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "solve", "(*(", "open", "(", "0", ").", "read", "().", "split", "lines", "()))", "))\u010a"], "input_token_weights": [0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03828", "input": "import collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,n+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num //= i ; ans.append(i)\n\n return ans\n\n\n\nn = int(input())\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n", "input_tokens": ["import", "\u0120collections", "\u0120as", "\u0120col", "\u010a\u010a\u010a\u010a", "def", "\u0120prime", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "%", "2", "==", "0", "\u0120and", "\u0120i", "!=", "2", ":", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120num", "%i", "\u0120==", "\u0120", "0", ":", "\u0120num", "\u0120//=", "\u0120i", "\u0120;", "\u0120ans", ".append", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ans", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "pr", "imes", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",n", "+", "1", "):", "\u0120primes", "\u0120+=", "\u0120prime", "(i", ")\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120col", ".Counter", "(pr", "imes", ")\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120key", ",val", "\u0120in", "\u0120list", "(cnt", ".items", "()):", "\u0120ans", "\u0120*=", "\u0120(", "val", "\u0120+", "\u0120", "1", ")", "\u0120;", "\u0120ans", "\u0120%=", "\u0120mod", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02794", "input": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(input())\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120E", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120a", "-", "1", ",", "\u0120b", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120E", "[a", "].", "append", "((", "b", ",i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120E", "[b", "].", "append", "((", "a", ",i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120dfs", "(s", ",", "\u0120g", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120par", "\u0120=", "\u0120[", "(-", "1", ",-", "1", ")]", "\u0120*", "\u0120N", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120par", "[s", "]", "\u0120=", "\u0120(", "s", ",-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120stack", "\u0120=", "\u0120[", "s", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120stack", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120stack", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120to", ",", "\u0120i", "\u0120in", "\u0120E", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120par", "[to", "][", "0", "]", "\u0120>=", "\u0120", "0", ":", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120par", "[to", "]", "\u0120=", "\u0120(", "v", ",", "\u0120i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120to", "\u0120==", "\u0120g", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120stack", ".append", "(to", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120g", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120v", "\u0120!=", "\u0120s", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", ",", "\u0120i", "\u0120=", "\u0120par", "[v", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", ".add", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120r", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120M", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120path", "\u0120=", "\u0120[", "None", "]", "\u0120*", "\u0120M", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120u", ",", "\u0120v", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120u", ",", "\u0120v", "\u0120=", "\u0120u", "-", "1", ",", "\u0120v", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120path", "[i", "]", "\u0120=", "\u0120dfs", "(u", ",", "\u0120v", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120calc", "(s", "):", "\u0120return", "\u0120", "1", "<<(", "N", "-", "1", "-len", "(s", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "_ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120p", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "<<", "M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120is", "_odd", "\u0120=", "\u0120bin", "(p", ").", "count", "('", "1", "')", "\u0120&", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120p", "&", "1", ":", "\u0120s", "\u0120|=", "\u0120path", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120>>=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120is", "_odd", ":", "\u0120i", "_ans", "\u0120+=", "\u0120calc", "(s", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120i", "_ans", "\u0120-=", "\u0120calc", "(s", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "1", "<<(", "N", "-", "1", "))", "\u0120-", "\u0120i", "_ans", "))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02612", "input": "'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(input())\n\ndef si():return input()\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n#mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile = 0\n\n\n\ndef solve():\n\n \n\n\n\n\n\n\n\n # for _ in range(ii()):\n\n\n\n n=ii()\n\n n%=1000\n\n if n!=0:\n\n n=1000-n\n\n print(n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()", "input_tokens": ["'''\u010a\u010a", "\u0120\u0120\u0120", "\u0120Auth", "er", ":", "\u0120gh", "os", "hash", "is", "5", "4", "5", "\u0120Ash", "is", "\u0120Gh", "osh", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120College", ":", "\u0120jal", "pa", "ig", "uri", "\u0120Gov", "t", "\u0120Eng", "g", "ine", "ering", "\u0120College", "\u010a\u010a\u010a\u010a", "'''\u010a\u010a", "from", "\u0120os", "\u0120import", "\u0120path", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120cmp", "_to", "_key", "\u0120as", "\u0120c", "tk", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", ",default", "dict", "\u0120as", "\u0120dd", "\u0120\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", ",b", "is", "ect", "_left", ",b", "is", "ect", "_right", ",", "ins", "ort", ",", "ins", "ort", "_left", ",", "ins", "ort", "_right", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120permutations", "\u010a\u010a", "from", "\u0120datetime", "\u0120import", "\u0120datetime", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120ceil", ",s", "qrt", ",", "log", ",g", "cd", "\u010a\u010a", "def", "\u0120ii", "():", "return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120si", "():", "return", "\u0120input", "()\u010a\u010a", "def", "\u0120mi", "():", "return", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "def", "\u0120li", "():", "return", "\u0120list", "(mi", "())\u010a\u010a", "abc", "='", "abcdefghijklmnopqrstuvwxyz", "'\u010a\u010a", "mod", "=", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "#", "mod", "=", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "inf", "\u0120=", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "v", "ow", "=['", "a", "','", "e", "','", "i", "','", "o", "','", "u", "']\u010a\u010a", "dx", ",", "dy", "=[", "-", "1", ",", "1", ",", "0", ",", "0", "],[", "0", ",", "0", ",", "1", ",-", "1", "]\u010a\u010a\u010a\u010a", "def", "\u0120bo", "(i", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ord", "(i", ")-", "ord", "('", "a", "')\u010a\u010a\u010a\u010a", "file", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(ii", "()):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=", "ii", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "%=", "1", "0", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "!=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "=", "1", "0", "0", "0", "-n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(n", ")\u010a\u010a", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==\"", "__", "main", "__", "\":", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(file", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120path", ".exists", "('", "input", "1", ".txt", "')", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".stdin", "=open", "('", "input", "1", ".txt", "',", "\u0120'", "r", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".stdout", "=open", "('", "output", "1", ".txt", "','", "w", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120input", "=sys", ".stdin", ".readline", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120solve", "()"], "input_token_weights": [0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p02685", "input": "M=998244353\n\nn,m,k=list(map(int,input().split()))\n\na=0\n\nc=1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n-i-1,M)\n\n c=c*(n-i-1)*pow(i+1,M-2,M)%M\n\nprint((a%M))", "input_tokens": ["M", "=", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "n", ",m", ",k", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=", "0", "\u010a\u010a", "c", "=", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120", "\u0120a", "+=", "c", "*m", "*pow", "(m", "-", "1", ",n", "-i", "-", "1", ",M", ")\u010a\u010a", "\u0120", "\u0120c", "=c", "*(", "n", "-i", "-", "1", ")*", "pow", "(i", "+", "1", ",M", "-", "2", ",M", ")%", "M", "\u010a\u010a", "print", "((", "a", "%M", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03680", "input": "N = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(10 ** 6):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "cnt", ",", "\u0120i", "\u0120=", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "0", "\u0120**", "\u0120", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[i", "]", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(cnt", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120quit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120a", "[i", "]", "\u0120-", "\u0120", "1", "\u010a\u010a", "print", "((-", "1", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02555", "input": "import math\n\n\n\n\n\ndef combinations_count(n, r):\n\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n s = int(input())\n\n ans = 0\n\n n = s // 3\n\n\n\n for i in range(1, n + 1):\n\n ans += combinations_with_replacement_count(i, 3*(n-i)+s % 3)\n\n\n\n print((ans % (10**9 + 7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120combinations", "_count", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120math", ".factor", "ial", "(n", ")", "\u0120//", "\u0120(", "math", ".factor", "ial", "(n", "\u0120-", "\u0120r", ")", "\u0120*", "\u0120math", ".factor", "ial", "(r", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120combinations", "_with", "_re", "placement", "_count", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120combinations", "_count", "(n", "\u0120+", "\u0120r", "\u0120-", "\u0120", "1", ",", "\u0120r", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120s", "\u0120//", "\u0120", "3", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120combinations", "_with", "_re", "placement", "_count", "(i", ",", "\u0120", "3", "*(", "n", "-i", ")+", "s", "\u0120%", "\u0120", "3", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "ans", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03806", "input": "G_MAX = 40*10\n\nN_MAX = 40\n\nINF = float('inf')\n\n\n\ndp = [[[INF]*(G_MAX+1) for _ in range(G_MAX+1)] \n\n for _ in range(N_MAX+1)]\n\nN,Ma,Mb = list(map(int, input().split()))\n\na,b,c = [],[],[]\n\nfor _ in range(N):\n\n ai,bi,ci = list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\n c.append(ci)\n\n\n\ndp[0][0][0] = 0\n\nfrom math import isinf\n\nfor i in range(N):\n\n for ca in range(G_MAX+1):\n\n for cb in range(G_MAX+1):\n\n if isinf(dp[i][ca][cb]): continue\n\n dp[i+1][ca][cb] = min(dp[i+1][ca][cb],\n\n dp[i][ca][cb])\n\n dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]],\n\n dp[i][ca][cb]+c[i])\n\n \n\n \n\nans = INF\n\nfor ca in range(1,G_MAX+1):\n\n for cb in range(1,G_MAX+1):\n\n if ca*Mb==cb*Ma:\n\n ans = min(ans, dp[N][ca][cb])\n\n \n\nif isinf(ans): ans = -1\n\nprint(ans)", "input_tokens": ["G", "_MAX", "\u0120=", "\u0120", "4", "0", "*", "1", "0", "\u010a\u010a", "N", "_MAX", "\u0120=", "\u0120", "4", "0", "\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[[[", "INF", "]*(", "G", "_MAX", "+", "1", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(G", "_MAX", "+", "1", ")]", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "_MAX", "+", "1", ")]\u010a\u010a", "N", ",M", "a", ",M", "b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", ",b", ",c", "\u0120=", "\u0120[],", "[],", "[]", "\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ai", ",", "bi", ",", "ci", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ".append", "(ai", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ".append", "(b", "i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", ".append", "(ci", ")\u010a\u010a\u010a\u010a", "dp", "[", "0", "][", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120is", "inf", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120ca", "\u0120in", "\u0120range", "(G", "_MAX", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120cb", "\u0120in", "\u0120range", "(G", "_MAX", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120is", "inf", "(dp", "[i", "][", "ca", "][", "cb", "]):", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "ca", "][", "cb", "]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "ca", "][", "cb", "],\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "ca", "][", "cb", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "ca", "+a", "[i", "]][", "cb", "+b", "[i", "]]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "ca", "+a", "[i", "]][", "cb", "+b", "[i", "]],", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "ca", "][", "cb", "]+", "c", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "ans", "\u0120=", "\u0120INF", "\u010a\u010a", "for", "\u0120ca", "\u0120in", "\u0120range", "(", "1", ",G", "_MAX", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120cb", "\u0120in", "\u0120range", "(", "1", ",G", "_MAX", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120ca", "*M", "b", "==", "cb", "*", "Ma", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120dp", "[N", "][", "ca", "][", "cb", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "if", "\u0120is", "inf", "(ans", "):", "\u0120ans", "\u0120=", "\u0120-", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p03568", "input": "from itertools import product\n\n\n\nn = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ncount = 0\n\nfor C in product((-1, 0, 1), repeat=n):\n\n total = 1\n\n for a, c in zip(A, C):\n\n total *= (a + c)\n\n if total % 2 == 0:\n\n count += 1\n\nprint(count)", "input_tokens": ["from", "\u0120itertools", "\u0120import", "\u0120product", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120C", "\u0120in", "\u0120product", "((-", "1", ",", "\u0120", "0", ",", "\u0120", "1", "),", "\u0120repeat", "=n", "):\u010a\u010a", "\u0120", "\u0120total", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120for", "\u0120a", ",", "\u0120c", "\u0120in", "\u0120zip", "(A", ",", "\u0120C", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120total", "\u0120*=", "\u0120(", "a", "\u0120+", "\u0120c", ")\u010a\u010a", "\u0120", "\u0120if", "\u0120total", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p03164", "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n,W=list(map(int,input().split()))\n\n WV=[tuple(map(int,input().split())) for _ in range(n)]\n\n\n\n V=100000\n\n dp=[INF]*(V+1)\n\n dp[0]=0\n\n\n\n for w,v in WV:\n\n for x in range(V,-1,-1):\n\n if(x+v<=V):\n\n dp[x+v]=min(dp[x+v],dp[x]+w)\n\n\n\n for x in range(V,-1,-1):\n\n if(dp[x]<=W):\n\n print(x)\n\n return\n\nresolve()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "2", "1", "4", "7", "4", "8", "3", "6", "4", "7", ")\u010a\u010a", "INF", "=float", "(\"", "inf", "\")\u010a\u010a", "MOD", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "input", "=lambda", "\u0120:", "sys", ".stdin", ".readline", "().", "rstrip", "()\u010a\u010a", "def", "\u0120resolve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",W", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120WV", "=[", "tuple", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120V", "=", "1", "0", "0", "0", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "=[", "INF", "]*(", "V", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "]=", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120w", ",v", "\u0120in", "\u0120WV", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(V", ",-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(x", "+v", "<=", "V", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[x", "+v", "]=", "min", "(dp", "[x", "+v", "],", "dp", "[x", "]+", "w", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(V", ",-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(dp", "[x", "]<=", "W", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(x", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u010a\u010a", "resolve", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02691", "input": "from collections import defaultdict\n\n\n\n\n\ndef main():\n\n _ = int(input())\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n L[i + height] += 1\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120_", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120heights", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", ">i", ",", "\u0120j", "-i", "\u0120=", "\u0120Ai", "\u0120+", "\u0120Aj", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120+", "\u0120Ai", "\u0120=", "\u0120j", "\u0120-", "Aj", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120height", "\u0120in", "\u0120enumerate", "(height", "s", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[i", "\u0120+", "\u0120height", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120R", "[i", "\u0120-", "\u0120height", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120total", "_count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120x", ",", "\u0120count", "_l", "\u0120in", "\u0120list", "(L", ".items", "())", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "_r", "\u0120=", "\u0120R", "[x", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120total", "_count", "\u0120+=", "\u0120count", "_l", "\u0120*", "\u0120count", "_r", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(total", "_count", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03039", "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)//2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "8", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "#", "mod", "\u0120=", "\u0120", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "**", "1", "8", "\u010a\u010a", "eps", "\u0120=", "\u0120", "1", "0", "**", "-", "7", "\u010a\u010a\u010a\u010a", "m", ",n", ",k", "\u0120=", "\u0120list", "(map", "(int", ",", "read", "line", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120comb", "(n", ",", "\u0120r", ",", "\u0120mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120min", "(r", ",", "\u0120n", "-r", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120mol", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120den", "o", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120r", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mol", "\u0120=", "\u0120mol", "\u0120*", "\u0120(", "n", "-r", "+i", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120den", "o", "\u0120=", "\u0120den", "o", "\u0120*", "\u0120i", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120mol", "\u0120*", "\u0120pow", "(d", "eno", ",", "\u0120mod", "-", "2", ",", "\u0120mod", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "def", "\u0120f", "1", "(x", ",y", ",a", ",b", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "a", "+b", "-x", "-y", ")*(", "a", "-x", "+", "1", ")*(", "b", "-y", "+", "1", ")//", "2", "\u010a\u010a\u010a\u010a", "def", "\u0120f", "2", "(x", ",a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "a", "-x", ")*(", "a", "-x", "+", "1", ")//", "2", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(", "1", ",m", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120n", "-x", "+", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120m", "-y", "+", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120m", "*(", "a", "*(", "a", "-", "1", ")+", "x", "*(", "x", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120n", "*(", "b", "*(", "b", "-", "1", ")+", "y", "*(", "y", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120(", "c", "+d", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120%=", "\u0120mod", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120(", "ans", "\u0120*", "\u0120comb", "(m", "*n", "-", "2", ",k", "-", "2", ",", "mod", "))", "%", "mod", "\u010a\u010a", "ans", "\u0120=", "\u0120ans", "*pow", "(", "2", ",", "mod", "-", "2", ",", "mod", ")%", "mod", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03253", "input": "N,M = list(map(int,input().split()))\n\ndiv =[]\n\nfor i in range(2,int(M**(1/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M = M//i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1: div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum = len(frac)\n\nfor i in range(len(frac)-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1] * (N+50)\n\nfinv[-1] = pow(frac[-1], mod-2, mod)\n\nfor i in range(1, num):\n\n finv[num-1-i] = finv[num-i] * (num-i) % mod\n\nans = 1\n\nfor i in div:\n\n ans = ans * frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)", "input_tokens": ["N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "div", "\u0120=", "[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",int", "(M", "**(", "1", "/", "2", "))+", "2", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cur", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120M", "%i", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120M", "\u0120=", "\u0120M", "//", "i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cur", "\u0120>=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120div", ".append", "(cur", ")\u010a\u010a", "if", "\u0120M", ">", "1", ":", "\u0120div", ".append", "(", "1", ")\u010a\u010a", "div", ".sort", "()\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "frac", "\u0120=", "\u0120[", "1", "]*(", "N", "+", "5", "0", ")\u010a\u010a", "num", "\u0120=", "\u0120len", "(f", "rac", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(f", "rac", ")-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120frac", "[i", "+", "1", "]", "\u0120=", "\u0120frac", "[i", "]*(", "i", "+", "1", ")%", "mod", "\u010a\u010a", "fin", "v", "\u0120=", "\u0120[", "1", "]", "\u0120*", "\u0120(", "N", "+", "5", "0", ")\u010a\u010a", "fin", "v", "[-", "1", "]", "\u0120=", "\u0120pow", "(f", "rac", "[-", "1", "],", "\u0120mod", "-", "2", ",", "\u0120mod", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120num", "):\u010a\u010a", "\u0120", "\u0120fin", "v", "[num", "-", "1", "-i", "]", "\u0120=", "\u0120fin", "v", "[num", "-i", "]", "\u0120*", "\u0120(", "num", "-i", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120div", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120ans", "\u0120*", "\u0120frac", "[N", "+i", "-", "1", "]*", "fin", "v", "[N", "-", "1", "]*", "fin", "v", "[i", "]%", "mod", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(c_max+1):\n\n ac = x - (cc // 2)\n\n bc = y - (cc // 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "#", "\u0120print", "(a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "\u0120*", "\u0120(", "1", "0", "\u0120**", "5", ")", "\u0120+", "\u0120", "7", "\u010a\u010a", "c", "_max", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120x", "\u0120>", "\u0120y", ":\u010a\u010a", "\u0120", "\u0120c", "_max", "\u0120=", "\u0120x", "\u0120*", "\u0120", "2", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120c", "_max", "\u0120=", "\u0120y", "\u0120*", "\u0120", "2", "\u010a\u010a\u010a\u010a", "for", "\u0120cc", "\u0120in", "\u0120range", "(c", "_max", "+", "1", "):\u010a\u010a", "\u0120", "\u0120ac", "\u0120=", "\u0120x", "\u0120-", "\u0120(", "cc", "\u0120//", "\u0120", "2", ")\u010a\u010a", "\u0120", "\u0120bc", "\u0120=", "\u0120y", "\u0120-", "\u0120(", "cc", "\u0120//", "\u0120", "2", ")\u010a\u010a", "\u0120\u0120\u010a\u010a", "\u0120", "\u0120if", "\u0120ac", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ac", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120if", "\u0120bc", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120bc", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120price", "\u0120=", "\u0120ac", "\u0120*", "\u0120a", "\u0120+", "\u0120bc", "\u0120*", "\u0120b", "\u0120+", "\u0120cc", "\u0120*", "\u0120c", "\u010a\u010a", "\u0120", "\u0120#", "\u0120print", "('", "price", ":", "\u0120{},", "\u0120ac", ":", "\u0120{},", "\u0120bc", ":", "\u0120{},", "\u0120cc", ":", "\u0120{}'.", "format", "(price", ",", "\u0120ac", ",", "\u0120bc", ",", "\u0120cc", "))\u010a\u010a", "\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120price", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833]} +{"problem_id": "p03425", "input": "N = int(input())\n\nname = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor _ in range(N):\n\n S = input()\n\n if(S[0] in name):\n\n name[S[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += name[march[i]] * name[march[j]] * name[march[k]]\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "name", "\u0120=", "\u0120{'", "M", "':", "0", ",", "\u0120'", "A", "':", "0", ",", "\u0120'", "R", "':", "0", ",", "\u0120'", "C", "':", "0", ",", "\u0120'", "H", "':", "0", "}\u010a\u010a", "m", "arch", "\u0120=", "\u0120\"", "M", "ARCH", "\"\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120", "\u0120if", "(S", "[", "0", "]", "\u0120in", "\u0120name", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120name", "[S", "[", "0", "]]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",", "4", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(j", "+", "1", ",", "5", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120name", "[m", "arch", "[i", "]]", "\u0120*", "\u0120name", "[m", "arch", "[j", "]]", "\u0120*", "\u0120name", "[m", "arch", "[k", "]]\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02899", "input": "n = int(input())\n\na = list(map(int,input().split()))\n\nans = [i for i in range(n)]\n\na1 = sorted(a)\n\nfor i in range(n):\n\n num = a[i]\n\n ans[num - 1] = str(i + 1)\n\n \n\nprint((' '.join(ans)))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "a", "1", "\u0120=", "\u0120sorted", "(a", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "[num", "\u0120-", "\u0120", "1", "]", "\u0120=", "\u0120str", "(i", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(('", "\u0120'.", "join", "(ans", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02901", "input": "INF = 2*10**7\n\n\n\n\n\ndef main():\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["INF", "\u0120=", "\u0120", "2", "*", "1", "0", "**", "7", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120M", "\u0120=", "\u0120(", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120B", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120(", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", ".append", "(a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120B", ".append", "(b", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bit", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bit", "\u0120|=", "\u0120(", "1", "\u0120<<", "\u0120(", "int", "(i", ")-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120C", ".append", "(bit", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[[", "INF", "]*(", "1", "\u0120<<", "\u0120N", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", "+", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "\u0120<<", "\u0120N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "j", "],", "\u0120dp", "[i", "][", "j", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "][", "j", "]", "\u0120!=", "\u0120INF", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120next", "_bit", "\u0120=", "\u0120j", "\u0120|", "\u0120C", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "next", "_bit", "]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "next", "_bit", "],", "\u0120dp", "[i", "][", "j", "]", "\u0120+", "\u0120A", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120dp", "[-", "1", "][-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ans", "\u0120==", "\u0120INF", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(*", "dp", ",", "\u0120sep", "=\"\\", "n", "\")\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03253", "input": "def prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num //= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\nfrom math import factorial\n\n\n\n\n\ndef comb(n, r, R):\n\n if n not in R:\n\n a = factorial(n)\n\n R[n] = a\n\n else:\n\n a = R[n]\n\n\n\n if n - r not in R:\n\n b = factorial(n - r)\n\n R[n - r] = b\n\n else:\n\n b = R[n - r]\n\n\n\n if r not in R:\n\n c = factorial(r)\n\n R[r] = c\n\n else:\n\n c = R[r]\n\n return a // (b * c)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nR = dict()\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= comb(v + n - 1, v, R)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n", "input_tokens": ["def", "\u0120prime", "_factor", "ize", "(num", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120This", "\u0120function", "\u0120performs", "\u0120prime", "\u0120factor", "ization", "\u0120on", "\u0120the", "\u0120input", "\u0120natural", "\u0120number", ".\u010a\u010a", "\u0120\u0120\u0120", "\u0120The", "\u0120result", "\u0120is", "\u0120returned", "\u0120in", "\u0120the", "\u0120form", "\u0120of", "\u0120a", "\u0120dictionary", "\u0120with", "\u0120the", "\u0120prime", "\u0120number", "\u0120as", "\u0120the", "\u0120key", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120and", "\u0120its", "\u0120number", "\u0120as", "\u0120the", "\u0120value", ".\u010a\u010a", "\u0120\u0120\u0120", "\u0120:", "param", "\u0120num", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120:", "return", "\u0120prime", "_factor", ":", "\u0120Dictionary", "\u0120with", "\u0120the", "\u0120prime", "\u0120number", "\u0120as", "\u0120the", "\u0120key", "\u0120and", "\u0120its", "\u0120number", "\u0120as", "\u0120the", "\u0120value", ".\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120prime", "_factor", "\u0120=", "\u0120{}\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120**", "\u0120", "2", "\u0120<=", "\u0120num", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120num", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120//=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120in", "\u0120list", "(pr", "ime", "_factor", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prime", "_factor", "[i", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prime", "_factor", "[i", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120num", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prime", "_factor", "[num", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120prime", "_factor", "\u010a\u010a\u010a\u010a\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120comb", "(n", ",", "\u0120r", ",", "\u0120R", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120not", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120factorial", "(n", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120R", "[n", "]", "\u0120=", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120R", "[n", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120-", "\u0120r", "\u0120not", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120factorial", "(n", "\u0120-", "\u0120r", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120R", "[n", "\u0120-", "\u0120r", "]", "\u0120=", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120R", "[n", "\u0120-", "\u0120r", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120not", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120factorial", "(r", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120R", "[r", "]", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120R", "[r", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120a", "\u0120//", "\u0120(", "b", "\u0120*", "\u0120c", ")\u010a\u010a\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "r", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "R", "\u0120=", "\u0120dict", "()\u010a\u010a", "prime", "_fac", "\u0120=", "\u0120prime", "_factor", "ize", "(m", ")\u010a\u010a", "for", "\u0120v", "\u0120in", "\u0120list", "(pr", "ime", "_fac", ".values", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120*=", "\u0120comb", "(v", "\u0120+", "\u0120n", "\u0120-", "\u0120", "1", ",", "\u0120v", ",", "\u0120R", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "\u0120+", "\u0120", "7", "\u010a\u010a", "print", "((", "r", "\u0120%", "\u0120mod", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293]} +{"problem_id": "p02951", "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif a < b + c:\n\n print((b+c-a))\n\nelse:\n\n print((0))", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "if", "\u0120a", "\u0120<", "\u0120b", "\u0120+", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "b", "+c", "-a", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03038", "input": "from collections import Counter\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\nX = Counter(A)\n\nfor i in range(M):\n\n B, C = list(map(int, input().split()))\n\n X[C] += B\n\n\n\nZ = []\n\nfor key, value in list(X.items()):\n\n Z.append((key, value))\n\n\n\nZ.sort(key=lambda x: x[0], reverse=True)\n\n\n\nans = 0\n\ncnt = 0\n\n\n\nfor value, key in Z:\n\n if cnt + key <= N:\n\n ans += key * value\n\n cnt += key\n\n else:\n\n ans += (N - cnt) * value\n\n break\n\n\n\nprint(ans)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "X", "\u0120=", "\u0120Counter", "(A", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120B", ",", "\u0120C", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "[C", "]", "\u0120+=", "\u0120B", "\u010a\u010a\u010a\u010a", "Z", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120key", ",", "\u0120value", "\u0120in", "\u0120list", "(X", ".items", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120Z", ".append", "((", "key", ",", "\u0120value", "))", "\u010a\u010a\u010a\u010a", "Z", ".sort", "(key", "=lambda", "\u0120x", ":", "\u0120x", "[", "0", "],", "\u0120reverse", "=True", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120value", ",", "\u0120key", "\u0120in", "\u0120Z", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "\u0120+", "\u0120key", "\u0120<=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120key", "\u0120*", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120key", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120(", "N", "\u0120-", "\u0120cnt", ")", "\u0120*", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p03723", "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif any(i % 2 != 0 for i in [a, b, c]):\n\n print((0))\n\n exit()\n\n\n\nif a == b and b == c:\n\n print((-1))\n\n exit()\n\n\n\ncnt = 0\n\na_list = [0]*(1001001)\n\nb_list = [0]*(1001001)\n\nc_list = [0]*(1001001)\n\na_list[0] = a\n\nb_list[0] = b\n\nc_list[0] = c\n\n\n\nfor i in range(1, 1001001):\n\n a_list[i] = (b_list[i-1] + c_list[i-1]) // 2\n\n b_list[i] = (c_list[i-1] + a_list[i-1]) // 2\n\n c_list[i] = (a_list[i-1] + b_list[i-1]) // 2\n\n cnt += 1\n\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n\n break\n\n\n\nprint(cnt)\n", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "if", "\u0120any", "(i", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120[", "a", ",", "\u0120b", ",", "\u0120c", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "if", "\u0120a", "\u0120==", "\u0120b", "\u0120and", "\u0120b", "\u0120==", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "a", "_list", "\u0120=", "\u0120[", "0", "]*(", "1", "0", "0", "1", "0", "0", "1", ")\u010a\u010a", "b", "_list", "\u0120=", "\u0120[", "0", "]*(", "1", "0", "0", "1", "0", "0", "1", ")\u010a\u010a", "c", "_list", "\u0120=", "\u0120[", "0", "]*(", "1", "0", "0", "1", "0", "0", "1", ")\u010a\u010a", "a", "_list", "[", "0", "]", "\u0120=", "\u0120a", "\u010a\u010a", "b", "_list", "[", "0", "]", "\u0120=", "\u0120b", "\u010a\u010a", "c", "_list", "[", "0", "]", "\u0120=", "\u0120c", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "0", "1", "0", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_list", "[i", "]", "\u0120=", "\u0120(", "b", "_list", "[i", "-", "1", "]", "\u0120+", "\u0120c", "_list", "[i", "-", "1", "])", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_list", "[i", "]", "\u0120=", "\u0120(", "c", "_list", "[i", "-", "1", "]", "\u0120+", "\u0120a", "_list", "[i", "-", "1", "])", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "_list", "[i", "]", "\u0120=", "\u0120(", "a", "_list", "[i", "-", "1", "]", "\u0120+", "\u0120b", "_list", "[i", "-", "1", "])", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "_list", "[i", "]", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", "\u0120or", "\u0120b", "_list", "[i", "]", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", "\u0120or", "\u0120c", "_list", "[i", "]", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.6771609938949378, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428]} +{"problem_id": "p03013", "input": "from functools import lru_cache\n\nimport sys\n\nsys.setrecursionlimit(30000)\n\n\n\nN, M = list(map(int, input().split()))\n\na = list(int(input()) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nisOk = True\n\nfor i in range(M-1):\n\n if a[i] + 1 == a[i+1]:\n\n isOk = False\n\n \n\nfuncb = [-1] * 100001\n\ndef func(n):\n\n if n <= 0:\n\n return 1\n\n cnt = funcb[n]\n\n if cnt > 0:\n\n return cnt\n\n cnt = 0\n\n if n >= 2:\n\n cnt += func(n-2)\n\n if n >= 1:\n\n cnt += func(n-1)\n\n funcb[n] = cnt % MOD\n\n return funcb[n]\n\n\n\nfunc(30000)\n\nfunc(50000)\n\nfunc(80000)\n\nfunc(100000)\n\n\n\nif not isOk:\n\n print((0))\n\nelse:\n\n ans = 1\n\n s = 0\n\n for i in range(M+1):\n\n if i >= M:\n\n e = N\n\n else:\n\n e = a[i] - 1\n\n\n\n ans = ans * func(e-s) % MOD\n\n\n\n if i >= M:\n\n break\n\n\n\n s = a[i] + 1\n\n\n\n print(ans)\n", "input_tokens": ["from", "\u0120functools", "\u0120import", "\u0120l", "ru", "_cache", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "3", "0", "0", "0", "0", ")\u010a\u010a\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", "))", "\u010a\u010a\u010a\u010a", "MOD", "\u0120=", "\u0120pow", "(", "1", "0", ",", "\u0120", "9", ")", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "isOk", "\u0120=", "\u0120True", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[i", "]", "\u0120+", "\u0120", "1", "\u0120==", "\u0120a", "[i", "+", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120is", "Ok", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "func", "b", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120", "1", "0", "0", "0", "0", "1", "\u010a\u010a", "def", "\u0120func", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120<=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120func", "b", "[n", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120cnt", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120>=", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120func", "(n", "-", "2", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120>=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120func", "(n", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120func", "b", "[n", "]", "\u0120=", "\u0120cnt", "\u0120%", "\u0120MOD", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120func", "b", "[n", "]\u010a\u010a\u010a\u010a", "func", "(", "3", "0", "0", "0", "0", ")\u010a\u010a", "func", "(", "5", "0", "0", "0", "0", ")\u010a\u010a", "func", "(", "8", "0", "0", "0", "0", ")\u010a\u010a", "func", "(", "1", "0", "0", "0", "0", "0", ")\u010a\u010a\u010a\u010a", "if", "\u0120not", "\u0120is", "Ok", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120>=", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120e", "\u0120=", "\u0120N", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120e", "\u0120=", "\u0120a", "[i", "]", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120ans", "\u0120*", "\u0120func", "(e", "-s", ")", "\u0120%", "\u0120MOD", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120>=", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120a", "[i", "]", "\u0120+", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.5851191688414608, 0.5851191688414608, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348]} +{"problem_id": "p02921", "input": "# 2019-11-17 20:44:23(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# import re\n\n# import heapq\n\n# import array\n\n# from scipy.misc import comb # (default: exact=False)\n\n# import numpy as np \n\n\n\n\n\ndef main():\n\n s, t = sys.stdin.read().split()\n\n\n\n count = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["#", "\u0120", "2", "0", "1", "9", "-", "1", "1", "-", "1", "7", "\u0120", "2", "0", ":", "4", "4", ":", "2", "3", "(J", "ST", ")\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "#", "\u0120import", "\u0120collections", "\u010a\u010a", "#", "\u0120import", "\u0120math", "\u010a\u010a", "#", "\u0120from", "\u0120string", "\u0120import", "\u0120ascii", "_lowercase", ",", "\u0120ascii", "_upper", "case", ",", "\u0120digits", "\u010a\u010a", "#", "\u0120from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u0120as", "\u0120bi", "_l", ",", "\u0120bis", "ect", "_right", "\u0120as", "\u0120bi", "_r", "\u010a\u010a", "#", "\u0120import", "\u0120itertools", "\u010a\u010a", "#", "\u0120from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "#", "\u0120import", "\u0120operator", "\u0120as", "\u0120op", "\u010a\u010a", "#", "\u0120import", "\u0120re", "\u010a\u010a", "#", "\u0120import", "\u0120heapq", "\u010a\u010a", "#", "\u0120import", "\u0120array", "\u010a\u010a", "#", "\u0120from", "\u0120scipy", ".misc", "\u0120import", "\u0120comb", "\u0120#", "\u0120(", "default", ":", "\u0120exact", "=False", ")\u010a\u010a", "#", "\u0120import", "\u0120numpy", "\u0120as", "\u0120np", "\u0120", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", ",", "\u0120t", "\u0120=", "\u0120sys", ".stdin", ".read", "().", "split", "()\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120==", "\u0120t", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(count", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03416", "input": "# author: kagemeka \n\n# created: 2019-11-06 21:30:22(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\n# import statistics\n\n# import functools\n\n# import operator\n\n\n\ndef main():\n\n a, b = (int(x) for x in sys.stdin.read().split())\n\n\n\n count = 0\n\n for n in range(a, b+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n count += 1\n\n\n\n print(count) \n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n", "input_tokens": ["#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120author", ":", "\u0120", "\u0120k", "agem", "eka", "\u0120\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120created", ":", "\u0120", "2", "0", "1", "9", "-", "1", "1", "-", "0", "6", "\u0120", "2", "1", ":", "3", "0", ":", "2", "2", "(J", "ST", ")\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "#", "\u0120import", "\u0120collections", "\u010a\u010a", "#", "\u0120import", "\u0120math", "\u010a\u010a", "#", "\u0120import", "\u0120string", "\u010a\u010a", "#", "\u0120import", "\u0120bis", "ect", "\u010a\u010a", "#", "\u0120import", "\u0120re", "\u010a\u010a", "#", "\u0120import", "\u0120itertools", "\u010a\u010a", "#", "\u0120import", "\u0120statistics", "\u010a\u010a", "#", "\u0120import", "\u0120functools", "\u010a\u010a", "#", "\u0120import", "\u0120operator", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120(", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120sys", ".stdin", ".read", "().", "split", "())\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120n", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120str", "(n", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120n", "[::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(count", ")", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120execute", "\u0120only", "\u0120if", "\u0120run", "\u0120as", "\u0120a", "\u0120script", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02767", "input": "N = int(input())\n\nX = list(map(int, input().split()))\n\nX = list(sorted(X))\n\nif N == 1:\n\n print((0))\n\n exit()\n\nans = float('inf')\n\nfor p in range(X[0], X[N - 1] + 1):\n\n sum = 0\n\n for x in X:\n\n sum += (x - p) ** 2\n\n ans = min(sum, ans)\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "X", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "X", "\u0120=", "\u0120list", "(sorted", "(X", "))\u010a\u010a", "if", "\u0120N", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120", "\u0120exit", "()\u010a\u010a", "ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120range", "(X", "[", "0", "],", "\u0120X", "[N", "\u0120-", "\u0120", "1", "]", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120", "\u0120sum", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120X", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "\u0120+=", "\u0120(", "x", "\u0120-", "\u0120p", ")", "\u0120**", "\u0120", "2", "\u010a\u010a", "\u0120", "\u0120ans", "\u0120=", "\u0120min", "(sum", ",", "\u0120ans", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169]} +{"problem_id": "p02725", "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd = [0] * n\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d[i] = a[i + 1] - a[i]\n\n d_max = max(d_max, d[i])\n\n\n\nd[-1] = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d[-1])\n\n\n\nprint((k - d_max))\n", "input_tokens": ["k", ",", "\u0120n", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "d", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120n", "\u010a\u010a", "d", "_max", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "\u0120-", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[i", "]", "\u0120=", "\u0120a", "[i", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "_max", "\u0120=", "\u0120max", "(d", "_max", ",", "\u0120d", "[i", "])\u010a\u010a", "\u010a\u010a", "d", "[-", "1", "]", "\u0120=", "\u0120(", "k", "\u0120-", "\u0120a", "[-", "1", "])", "\u0120+", "\u0120a", "[", "0", "]\u010a\u010a", "d", "_max", "\u0120=", "\u0120max", "(d", "_max", ",", "\u0120d", "[-", "1", "])\u010a\u010a", "\u010a\u010a", "print", "((", "k", "\u0120-", "\u0120d", "_max", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02822", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\ninv2 = (mod + 1) // 2\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n\n for j in X[i]:\n\n s = (s * pow(inv2, A[j], mod)) % mod\n\n t = (t + (1-pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "X", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "[x", "-", "1", "].", "append", "(y", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "[y", "-", "1", "].", "append", "(x", "-", "1", ")\u010a\u010a", "i", "0", "\u0120=", "\u0120min", "([", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")", "\u0120if", "\u0120len", "(X", "[i", "])", "\u0120==", "\u0120", "1", "])\u010a\u010a", "\u010a\u010a", "P", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120N", "\u010a\u010a", "Q", "\u0120=", "\u0120deque", "([", "i", "0", "])\u010a\u010a", "R", "\u0120=", "\u0120[]\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120deque", ".p", "opleft", "(Q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", ".append", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120X", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120!=", "\u0120P", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120P", "[a", "]", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120X", "[a", "].", "remove", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120deque", ".append", "(Q", ",", "\u0120a", ")\u010a\u010a\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "inv", "2", "\u0120=", "\u0120(", "mod", "\u0120+", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "A", "\u0120=", "\u0120[", "1", "]", "\u0120*", "\u0120N", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120R", "[::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120X", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "[i", "]", "\u0120+=", "\u0120A", "[j", "]\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120pow", "(inv", "2", ",", "\u0120N", "\u0120-", "\u0120A", "[i", "],", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "1", "\u0120+", "\u0120(", "1", "-p", "ow", "(inv", "2", ",", "\u0120N", "\u0120-", "\u0120A", "[i", "],", "\u0120mod", "))", "\u0120*", "\u0120pow", "(", "2", ",", "\u0120N", "\u0120-", "\u0120A", "[i", "],", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120X", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120(", "s", "\u0120*", "\u0120pow", "(inv", "2", ",", "\u0120A", "[j", "],", "\u0120mod", "))", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120(", "t", "\u0120+", "\u0120(", "1", "-p", "ow", "(inv", "2", ",", "\u0120A", "[j", "],", "\u0120mod", "))", "\u0120*", "\u0120pow", "(", "2", ",", "\u0120A", "[j", "],", "\u0120mod", "))", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120(", "ans", "\u0120+", "\u0120", "1", "\u0120-", "\u0120s", "\u0120*", "\u0120t", ")", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "print", "((", "ans", "\u0120*", "\u0120inv", "2", "\u0120%", "\u0120mod", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03796", "input": "from math import factorial\n\ndef myAnswer(N:int) ->int:\n\n ans =factorial(N)\n\n return ans % (10**9 + 7)\n\n\n\ndef modelAnswer():\n\n tmp=1\n\ndef main():\n\n N = int(input())\n\n print((myAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a", "def", "\u0120my", "Answer", "(N", ":int", ")", "\u0120->", "int", ":\u010a\u010a", "\u0120\u0120", "\u0120ans", "\u0120=", "factor", "ial", "(N", ")\u010a\u010a", "\u0120\u0120", "\u0120return", "\u0120ans", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a\u010a\u010a", "def", "\u0120model", "Answer", "():\u010a\u010a", "\u0120\u0120", "\u0120tmp", "=", "1", "\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120", "\u0120print", "((", "my", "Answer", "(N", ")))\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03854", "input": "s = input()[::-1]\n\n\n\nwhile True:\n\n if len(s) == 0:\n\n break\n\n if s[:7] == \"remaerd\":\n\n s = s[7:]\n\n elif s[:6] == \"resare\":\n\n s = s[6:]\n\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n\n s = s[5:]\n\n else:\n\n print(\"NO\")\n\n exit()\n\n\n\nprint(\"YES\")", "input_tokens": ["s", "\u0120=", "\u0120input", "()[", "::-", "1", "]\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(s", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[:", "7", "]", "\u0120==", "\u0120\"", "rema", "erd", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120s", "[", "7", ":]\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120s", "[:", "6", "]", "\u0120==", "\u0120\"", "res", "are", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120s", "[", "6", ":]\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120s", "[:", "5", "]", "\u0120==", "\u0120\"", "ma", "erd", "\"", "\u0120or", "\u0120s", "[:", "5", "]", "\u0120==", "\u0120\"", "es", "are", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120s", "[", "5", ":]\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "print", "(\"", "YES", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03074", "input": "import sys\n\nstdin = sys.stdin \n\nni = lambda: int(ns())\n\nna = lambda: list(map(int, stdin.readline().split()))\n\nns = lambda: stdin.readline()\n\n\n\ndef Solve():\n\n N,K=na()\n\n S=[int(d) for d in input()]\n\n l=[]\n\n N=len(S)\n\n if(S[0]==0):\n\n l.append(0)\n\n b=S[0]\n\n ct=1\n\n for i in S[1:]:\n\n if(b!=i):\n\n l.append(ct)\n\n ct=1\n\n b=i\n\n else:\n\n ct+=1\n\n l.append(ct)\n\n len_l=len(l)\n\n if(len_l//2 <= K):\n\n return sum(l)\n\n ans = res = sum(l[:2*K+1])\n\n \n\n if(len_l%2==0):\n\n l.append(0)\n\n len_l+=1\n\n g = K * 2 + 1\n\n for i in range(K*2+1,len_l-1,2):\n\n ans -= l[i-g] + l[i-g+1]\n\n ans += l[i] + l[1+i]\n\n if(resb>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile a>b>c:\n\n\t\t\tif a>b>c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1\n\n\t\t\t", "input_tokens": ["while", "\u0120True", ":\u010a\u010a", "\u0109k", "=list", "(map", "(int", ",input", "().", "split", "(\"", "\u0120\"", ")))\u010a\u010a", "\u0109if", "\u0120k", "[", "0", "]==", "k", "[", "1", "]==", "0", ":\u010a\u010a", "\u0109", "\u0109break", "\u010a\u010a", "\u0109ct", "=", "0", "\u010a\u010a", "\u0109a", "=", "0", "\u010a\u010a", "\u0109b", "=", "0", "\u010a\u010a", "\u0109c", "=", "0", "\u0109\u010a\u010a", "\u0109max", "=k", "[", "0", "]\u010a\u010a", "\u0109sum", "=k", "[", "1", "]\u010a\u010a", "\u0109a", "=max", "+", "1", "\u010a\u010a", "\u0109\u010a\u010a", "\u0109while", "\u0120True", ":\u010a\u010a", "\u0109", "\u0109a", "-=", "1", "\u010a\u010a", "\u0109", "\u0109b", "=a", "-", "1", "\u010a\u010a", "\u0109", "\u0109c", "=sum", "-a", "-b", "\u010a\u010a", "\u0109", "\u0109if", "\u0120not", "\u0120a", ">b", ">c", ":\u010a\u010a", "\u0109\u0109", "\u0109print", "(ct", ")\u010a\u010a", "\u0109\u0109", "\u0109break", "\u010a\u010a", "\u0109", "\u0109while", "\u0120a", ">b", ">c", ":\u010a\u010a", "\u0109\u0109", "\u0109if", "\u0120a", ">b", ">c", ">", "0", ":\u010a\u010a", "\u0109\u0109\u0109", "\u0109ct", "+=", "1", "\u010a\u010a", "\u0109\u0109", "\u0109b", "-=", "1", "\u010a\u010a", "\u0109\u0109", "\u0109c", "+=", "1", "\u010a\u010a", "\u0109\u0109\u0109"], "input_token_weights": [0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679]} +{"problem_id": "p04044", "input": "n, l = list(map(int, input().split()))\n\nS = [input() for i in range(n)]\n\nS.sort()\n\nprint((\"\".join(S)))", "input_tokens": ["n", ",", "\u0120l", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "S", "\u0120=", "\u0120[", "input", "()", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "S", ".sort", "()\u010a\u010a", "print", "((\"", "\".", "join", "(S", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03644", "input": "N = int(input())\n\nif N < 2:\n\n print(N)\n\nelif 2<=N<4:\n\n print((2))\n\nelif 4<=N<8:\n\n print((4))\n\nelif 8<=N<16:\n\n print((8))\n\nelif 16<=N<32:\n\n print((16))\n\nelif 32<=N<64:\n\n print((32))\n\nelif 64<=N:\n\n print((64))", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "if", "\u0120N", "\u0120<", "\u0120", "2", ":\u010a\u010a", "\u0120", "\u0120print", "(N", ")\u010a\u010a", "elif", "\u0120", "2", "<=", "N", "<", "4", ":\u010a\u010a", "\u0120", "\u0120print", "((", "2", "))\u010a\u010a", "elif", "\u0120", "4", "<=", "N", "<", "8", ":\u010a\u010a", "\u0120", "\u0120print", "((", "4", "))\u010a\u010a", "elif", "\u0120", "8", "<=", "N", "<", "1", "6", ":\u010a\u010a", "\u0120", "\u0120print", "((", "8", "))\u010a\u010a", "elif", "\u0120", "1", "6", "<=", "N", "<", "3", "2", ":\u010a\u010a", "\u0120", "\u0120print", "((", "1", "6", "))\u010a\u010a", "elif", "\u0120", "3", "2", "<=", "N", "<", "6", "4", ":\u010a\u010a", "\u0120", "\u0120print", "((", "3", "2", "))\u010a\u010a", "elif", "\u0120", "6", "4", "<=", "N", ":\u010a\u010a", "\u0120", "\u0120print", "((", "6", "4", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9625183119837646, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.9235768548788368, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.883057299767519, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p03037", "input": "N, M = list(map(int, input().split()))\n\nLR = [list(map(int, input().split())) for _ in range(M)]\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor l, r in LR:\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n", "input_tokens": ["N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "LR", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", ")]", "\u010a\u010a\u010a\u010a", "left", "\u0120=", "\u0120", "1", "\u010a\u010a", "right", "\u0120=", "\u0120N", "\u010a\u010a\u010a\u010a", "for", "\u0120l", ",", "\u0120r", "\u0120in", "\u0120LR", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120left", "\u0120<", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120left", "\u0120=", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120right", "\u0120>", "\u0120r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120right", "\u0120=", "\u0120r", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120right", "\u0120-", "\u0120left", "\u010a\u010a\u010a\u010a", "print", "((", "ans", "\u0120+", "\u0120", "1", "\u0120if", "\u0120ans", "\u0120>=", "\u0120", "0", "\u0120else", "\u0120", "0", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p03293", "input": "s = input()\n\nt = input()\n\nfor i in range(len(s)):\n\n if s[i:]+s[:i]==t:\n\n print('Yes')\n\n exit()\n\nprint('No')", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a", "t", "\u0120=", "\u0120input", "()\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", ":", "]+", "s", "[:", "i", "]==", "t", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "print", "('", "No", "')"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03060", "input": "n = int(input())\n\nv = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\nresult = 0\n\nfor i in range(n):\n\n if v[i] > c[i]:\n\n result += v[i] - c[i]\n\nprint(result)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "v", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "result", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120v", "[i", "]", "\u0120>", "\u0120c", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120result", "\u0120+=", "\u0120v", "[i", "]", "\u0120-", "\u0120c", "[i", "]\u010a\u010a", "print", "(result", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03416", "input": "a,b = list(map(int,input().split()))\n\nanswer = 0\n\nfor i in range(a,b+1) :\n\n j = str(i)\n\n p1 = j[4]\n\n p2 = j[3]\n\n p3 = j[2]\n\n p4 = j[1]\n\n p5 = j[0]\n\n k = int(p1+p2+p3+p4+p5)\n\n if i == k :\n\n answer += 1\n\nprint(answer)\n\n\n", "input_tokens": ["a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "answer", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", ")", "\u0120:\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "1", "\u0120=", "\u0120j", "[", "4", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "2", "\u0120=", "\u0120j", "[", "3", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "3", "\u0120=", "\u0120j", "[", "2", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "4", "\u0120=", "\u0120j", "[", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "5", "\u0120=", "\u0120j", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120int", "(p", "1", "+p", "2", "+p", "3", "+p", "4", "+p", "5", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120k", "\u0120:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120answer", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(answer", ")\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03721", "input": "N,K=list(map(int,input().split()))\n\ndic={}\n\nfor i in range(N):\n\n a,b=list(map(int,input().split()))\n\n if a in dic:\n\n dic[a]+=b\n\n else:\n\n dic[a]=b\n\n \n\ndic=sorted(list(dic.items()),key=lambda x:x[0])\n\nfor d in range(len(dic)):\n\n amount=dic[d][1]\n\n if amount>=K:\n\n print((dic[d][0]))\n\n exit(0)\n\n else:\n\n K-=amount\n\n ", "input_tokens": ["N", ",K", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "dic", "={", "}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120if", "\u0120a", "\u0120in", "\u0120dic", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120dic", "[a", "]+=", "b", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120dic", "[a", "]=", "b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "dic", "=", "sorted", "(list", "(dic", ".items", "()),", "key", "=lambda", "\u0120x", ":x", "[", "0", "])\u010a\u010a", "for", "\u0120d", "\u0120in", "\u0120range", "(len", "(dic", "))", ":\u010a\u010a", "\u0120", "\u0120amount", "=d", "ic", "[d", "][", "1", "]\u010a\u010a", "\u0120", "\u0120if", "\u0120amount", ">=", "K", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dic", "[d", "][", "0", "]))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120K", "-=", "amount", "\u010a\u010a", "\u0120\u0120"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139]} +{"problem_id": "p03814", "input": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n\n# Python 1st Try\n\nimport copy\n\n\n\n\n\nclass Problem:\n\n def __init__(self, stringdata):\n\n self.stringdata = stringdata\n\n\n\n def solver(self):\n\n strcont = copy.copy(self.stringdata)\n\n result = 0\n\n rightposition = 0\n\n leftposition = len(strcont)\n\n j = 0\n\n while True:\n\n if strcont[j] == 'A':\n\n rightposition = j\n\n break\n\n else:\n\n j = j + 1\n\n j = leftposition - 1\n\n while True:\n\n if strcont[j] == 'Z':\n\n leftposition = j\n\n break\n\n else:\n\n j = j - 1\n\n\n\n result = leftposition - rightposition + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = input()\n\n print((\"{}\".format(Problem(s).solver())))\n", "input_tokens": ["#", "\u0120Problem", "\u0120https", "://", "at", "coder", ".jp", "/", "cont", "ests", "/", "abc", "0", "5", "3", "/tasks", "/", "abc", "0", "5", "3", "_b", "\u010a\u010a", "#", "\u0120Python", "\u0120", "1", "st", "\u0120Try", "\u010a\u010a", "import", "\u0120copy", "\u010a\u010a\u010a\u010a\u010a\u010a", "class", "\u0120Problem", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120string", "data", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".string", "data", "\u0120=", "\u0120string", "data", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120solver", "(self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120str", "cont", "\u0120=", "\u0120copy", ".copy", "(self", ".string", "data", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120result", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120right", "position", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120left", "position", "\u0120=", "\u0120len", "(str", "cont", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120str", "cont", "[j", "]", "\u0120==", "\u0120'", "A", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120right", "position", "\u0120=", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120j", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120left", "position", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120str", "cont", "[j", "]", "\u0120==", "\u0120'", "Z", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120left", "position", "\u0120=", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120j", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120result", "\u0120=", "\u0120left", "position", "\u0120-", "\u0120right", "position", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120result", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((\"", "{}\".", "format", "(", "Problem", "(s", ").", "solver", "())))\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03000", "input": "from itertools import accumulate\n\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\n\nL = list(tuple(map(int, input().split())))\n\n\n\nacc = sorted(list(accumulate(L)) + [0])\n\n\n\nn = bisect_right(acc,X)\n\nprint(n)\n\n\n", "input_tokens": ["from", "\u0120itertools", "\u0120import", "\u0120accumulate", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120*\u010a\u010a", "N", ",", "\u0120X", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120list", "(tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))", ")\u010a\u010a\u010a\u010a", "acc", "\u0120=", "\u0120sorted", "(list", "(", "accumulate", "(L", "))", "\u0120+", "\u0120[", "0", "])\u010a\u010a", "\u010a\u010a", "n", "\u0120=", "\u0120bis", "ect", "_right", "(acc", ",X", ")\u010a\u010a", "print", "(n", ")\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03416", "input": "A, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n n_s = str(n)\n\n n_s_rvs = n_s[::-1]\n\n if n_s == n_s_rvs:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "input_tokens": ["A", ",", "\u0120B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120n", "\u0120in", "\u0120range", "(A", ",", "\u0120B", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "_s", "\u0120=", "\u0120str", "(n", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "_s", "_r", "vs", "\u0120=", "\u0120n", "_s", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "_s", "\u0120==", "\u0120n", "_s", "_r", "vs", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03796", "input": "import math\n\nN=int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "=int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(N", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03371", "input": "# ABC95 C -Half and Half\n\na,b,c,x,y = list(map(float,input().split()))\n\nans = 0\n\nif a+b > 2*c:\n\n while x != 0.0 and y != 0.0:\n\n ans += 2*c\n\n x -= 1.0\n\n y -= 1.0\n\n if y == 0.0:\n\n while x != 0.0:\n\n if a > 2*c:\n\n ans += 2*c\n\n x -= 1.0\n\n else:\n\n ans += a\n\n x -= 1.0\n\n if x == 0.0:\n\n while y != 0.0:\n\n if b > 2*c:\n\n ans += 2*c\n\n y -= 1.0\n\n else:\n\n ans += b\n\n y -= 1.0\n\nelse:\n\n ans += a*x + b*y\n\nprint((int(ans)))\n\n\n\n ", "input_tokens": ["#", "\u0120ABC", "9", "5", "\u0120C", "\u0120-", "Half", "\u0120and", "\u0120Half", "\u010a\u010a", "a", ",b", ",c", ",x", ",y", "\u0120=", "\u0120list", "(map", "(float", ",input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120a", "+b", "\u0120>", "\u0120", "2", "*c", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120!=", "\u0120", "0", ".", "0", "\u0120and", "\u0120y", "\u0120!=", "\u0120", "0", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "2", "*c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120y", "\u0120==", "\u0120", "0", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120!=", "\u0120", "0", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120>", "\u0120", "2", "*c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "2", "*c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120", "0", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120y", "\u0120!=", "\u0120", "0", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120b", "\u0120>", "\u0120", "2", "*c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "2", "*c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120a", "*x", "\u0120+", "\u0120b", "*y", "\u010a\u010a", "print", "((", "int", "(ans", "))", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120"], "input_token_weights": [0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679]} +{"problem_id": "p02595", "input": "N, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x ** 2 + y ** 2 <= D ** 2:\n\n cnt += 1\n\n \n\nprint(cnt)", "input_tokens": ["N", ",", "\u0120D", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120**", "\u0120", "2", "\u0120+", "\u0120y", "\u0120**", "\u0120", "2", "\u0120<=", "\u0120D", "\u0120**", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02814", "input": "from math import gcd\n\n\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\n\n\na=list([x//2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) // gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\n\n\nif (lcma//a[0])%2==0:\n\n print((0))\n\nelse:\n\n flg=0\n\n for i in range(1,len(a)):\n\n if (lcma//a[i])%2==0:\n\n print((0))\n\n flg=1\n\n break\n\n if flg==0:\n\n temp=m//lcma\n\n print((temp//2 if temp%2==0 else temp//2+1))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a\u010a\u010a", "n", ",m", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=list", "(set", "(a", "))", "\u010a\u010a\u010a\u010a", "a", "=list", "([", "x", "//", "2", "\u0120for", "\u0120x", "\u0120in", "\u0120a", "])\u010a\u010a", "\u010a\u010a", "def", "\u0120lcm", "(q", "):\u010a\u010a", "\u0120", "\u0120x", "\u0120=", "\u0120q", "[", "0", "]\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120len", "(q", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "\u0120*", "\u0120q", "[i", "])", "\u0120//", "\u0120gcd", "(x", ",", "\u0120q", "[i", "])\u010a\u010a", "\u0120", "\u0120return", "\u0120x", "\u010a\u010a\u010a\u010a", "lc", "ma", "=l", "cm", "(a", ")\u010a\u010a\u010a\u010a", "if", "\u0120(", "lc", "ma", "//", "a", "[", "0", "])", "%", "2", "==", "0", ":\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120fl", "g", "=", "0", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",len", "(a", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "lc", "ma", "//", "a", "[i", "])", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120fl", "g", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120", "\u0120if", "\u0120fl", "g", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120temp", "=m", "//", "lc", "ma", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "temp", "//", "2", "\u0120if", "\u0120temp", "%", "2", "==", "0", "\u0120else", "\u0120temp", "//", "2", "+", "1", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p02693", "input": "S = int(input())\n\na = 0\n\ncount = 0\n\nn,m = list(map(int,input().split()))\n\nwhile count == 0:\n\n a += S\n\n if n <= a and m >= a:\n\n count = 1\n\n if a >= 1000:\n\n break\n\nif count == 0:\n\n print(\"NG\")\n\nelse:\n\n print(\"OK\")", "input_tokens": ["S", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120", "0", "\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "n", ",m", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "while", "\u0120count", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120+=", "\u0120S", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120<=", "\u0120a", "\u0120and", "\u0120m", "\u0120>=", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120>=", "\u0120", "1", "0", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "if", "\u0120count", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "NG", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "OK", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p03171", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nn = N % 2\n\n\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor w in range(1, N+1):\n\n for i in range(N):\n\n j = i + w\n\n if j > N:\n\n continue\n\n if (w+n) % 2 == 1:\n\n DP[i][j] = min(DP[i+1][j] - A[i], DP[i][j-1] - A[j-1])\n\n else:\n\n DP[i][j] = max(DP[i+1][j] + A[i], DP[i][j-1] + A[j-1])\n\n\n\nprint((DP[0][N]))\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "n", "\u0120=", "\u0120N", "\u0120%", "\u0120", "2", "\u010a\u010a\u010a\u010a", "DP", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120(", "N", "+", "1", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "+", "1", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120w", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120i", "\u0120+", "\u0120w", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120>", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "w", "+n", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120DP", "[i", "][", "j", "]", "\u0120=", "\u0120min", "(D", "P", "[i", "+", "1", "][", "j", "]", "\u0120-", "\u0120A", "[i", "],", "\u0120DP", "[i", "][", "j", "-", "1", "]", "\u0120-", "\u0120A", "[j", "-", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120DP", "[i", "][", "j", "]", "\u0120=", "\u0120max", "(D", "P", "[i", "+", "1", "][", "j", "]", "\u0120+", "\u0120A", "[i", "],", "\u0120DP", "[i", "][", "j", "-", "1", "]", "\u0120+", "\u0120A", "[j", "-", "1", "])\u010a\u010a", "\u010a\u010a", "print", "((", "DP", "[", "0", "][", "N", "]))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293]} +{"problem_id": "p03796", "input": "from math import factorial as fc\n\na = int(input())\n\nprint((fc(a)%(10**9+7)))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u0120as", "\u0120fc", "\u010a\u010a", "a", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "fc", "(a", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02574", "input": "from math import gcd\n\n\n\nN = int(input())\n\nnum_lis = list(map(int, input().split()))\n\nc = True\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(10**6+10)\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num //= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n c = False\n\n break\n\n else:\n\n tmp.add(j)\n\n else:\n\n continue\n\n break\n\n\n\nif c:\n\n print(\"pairwise coprime\")\n\nelse:\n\n print(\"setwise coprime\")", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "num", "_l", "is", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "def", "\u0120os", "a", "_k", "(max", "_num", "):\u010a\u010a", "\u0120", "\u0120lis", "\u0120=", "\u0120[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(max", "_num", "+", "1", ")]\u010a\u010a", "\u0120", "\u0120p", "\u0120=", "\u0120", "2", "\u010a\u010a", "\u0120", "\u0120while", "\u0120p", "**", "2", "\u0120<=", "\u0120max", "_num", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120lis", "[p", "]", "\u0120==", "\u0120p", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120q", "\u0120in", "\u0120range", "(", "2", "*p", ",", "\u0120max", "_num", "+", "1", ",", "\u0120p", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120lis", "[q", "]", "\u0120==", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120lis", "[q", "]", "\u0120=", "\u0120p", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120return", "\u0120lis", "\u010a\u010a\u010a\u010a", "h", "oge", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120num", "_l", "is", ":\u010a\u010a", "\u0120", "\u0120h", "oge", "\u0120=", "\u0120gcd", "(h", "oge", ",", "\u0120i", ")\u010a\u010a", "if", "\u0120h", "oge", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120", "\u0120print", "(\"", "not", "\u0120cop", "r", "ime", "\")\u010a\u010a", "\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "d", "_l", "is", "\u0120=", "\u0120os", "a", "_k", "(", "1", "0", "**", "6", "+", "1", "0", ")\u010a\u010a", "tmp", "\u0120=", "\u0120set", "()\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120num", "_l", "is", ":\u010a\u010a", "\u0120", "\u0120num", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120", "\u0120new", "_tmp", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120", "\u0120while", "\u0120num", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120d", "_l", "is", "[num", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120new", "_tmp", ".add", "(d", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120//=", "\u0120d", "\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120new", "_tmp", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120in", "\u0120tmp", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", ".add", "(j", ")\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "if", "\u0120c", ":\u010a\u010a", "\u0120", "\u0120print", "(\"", "pair", "wise", "\u0120cop", "r", "ime", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "(\"", "set", "wise", "\u0120cop", "r", "ime", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.579389560544, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.579389560544, 0.579389560544, 0.6855929667625797, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708]} +{"problem_id": "p02850", "input": "n = int(input())\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "edges", "\u0120=", "\u0120[]", "\u010a\u010a\u010a\u010a", "for", "\u0120id", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120edges", ".append", "([", "a", "-", "1", ",", "\u0120b", "-", "1", ",", "\u0120id", "])\u010a\u010a", "\u010a\u010a", "edges", ".sort", "()\u010a\u010a\u010a\u010a", "used", "\u0120=", "\u0120[", "0", "]*(", "n", ")\u010a\u010a", "ans", "\u0120=", "\u0120[", "0", "]*(", "n", "-", "1", ")\u010a\u010a", "num", "\u0120=", "\u0120", "1", "\u010a\u010a", "prev", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120edge", "\u0120in", "\u0120edges", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120_", "from", ",", "\u0120to", ",", "\u0120id", "\u0120=", "\u0120edge", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120_", "from", "\u0120!=", "\u0120prev", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120used", "[_", "from", "]", "\u0120==", "\u0120num", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "[id", "]", "\u0120=", "\u0120num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120used", "[to", "]", "\u0120=", "\u0120num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120_", "from", "\u010a\u010a\u010a\u010a", "print", "((", "max", "(ans", ")))\u010a\u010a", "for", "\u0120color", "\u0120in", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(color", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611]} +{"problem_id": "p00003", "input": "for i in range(0, int(input())):\n\n sidelen = [int(j) for j in input().split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")", "input_tokens": ["for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120int", "(input", "()))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120sid", "elen", "\u0120=", "\u0120[", "int", "(j", ")", "\u0120for", "\u0120j", "\u0120in", "\u0120input", "().", "split", "(\"", "\u0120\")", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120sid", "elen", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(sid", "elen", "[", "0", "]**", "2", "\u0120==", "\u0120sid", "elen", "[", "1", "]**", "2", "\u0120+", "\u0120sid", "elen", "[", "2", "]**", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "YES", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")"], "input_token_weights": [0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03424", "input": "n = int(input())\n\ns = input().split()\n\ns = set(s)\n\nprint(('Four' if len(s) == 4 else 'Three'))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "s", "\u0120=", "\u0120input", "().", "split", "()\u010a\u010a", "s", "\u0120=", "\u0120set", "(s", ")\u010a\u010a", "print", "(('", "Four", "'", "\u0120if", "\u0120len", "(s", ")", "\u0120==", "\u0120", "4", "\u0120else", "\u0120'", "Three", "'))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p00122", "input": "dX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return \"OK\"\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = input()\n\n\txy = list(map(int,input().split()))\n\n\tans = solve(x,y,xy)\n\n\tprint(ans if ans else \"NA\")", "input_tokens": ["d", "X", "\u0120=", "\u0120[", "2", ",", "2", ",", "2", ",", "1", ",", "0", ",-", "1", ",-", "2", ",-", "2", ",-", "2", ",-", "1", ",", "0", ",", "1", "]\u010a\u010a", "d", "Y", "\u0120=", "\u0120[-", "1", ",", "0", ",", "1", ",", "2", ",", "2", ",", "2", ",", "1", ",", "0", ",-", "1", ",-", "2", ",-", "2", ",-", "2", "]\u010a\u010a", "def", "\u0120solve", "(x", ",y", ",", "XY", "):\u010a\u010a", "\u0109", "xy", "\u0120=", "\u0120XY", "[:", "]\u010a\u010a", "\u0109if", "\u0120len", "(xy", ")", "\u0120==", "\u0120", "0", ":", "\u0120return", "\u0120\"", "OK", "\"\u010a\u010a", "\u0109s", "x", ",s", "y", "\u0120=", "\u0120xy", ".pop", "(", "0", "),", "xy", ".pop", "(", "0", ")\u010a\u010a", "\u0109for", "\u0120dx", ",", "dy", "\u0120in", "\u0120zip", "(d", "X", ",d", "Y", "):\u010a\u010a", "\u0109", "\u0109if", "\u0120do", "a", "(x", "+", "dx", ",y", "+", "dy", ",s", "x", ",s", "y", "):", "\u0120\u010a\u010a", "\u0109\u0109", "\u0109r", "\u0120=", "\u0120solve", "(x", "+", "dx", ",y", "+", "dy", ",", "xy", ")\u010a\u010a", "\u0109\u0109", "\u0109if", "\u0120r", ":", "\u0120return", "\u0120r", "\u010a\u010a\u010a\u010a", "def", "\u0120do", "a", "(x", ",y", ",s", "x", ",s", "y", "):\u010a\u010a", "\u0109if", "\u0120not", "\u0120(", "0", "\u0120<=", "\u0120x", "\u0120<=", "\u0120", "9", "\u0120and", "\u0120", "0", "\u0120<=", "\u0120y", "\u0120<=", "\u0120", "9", "):", "\u0120return", "\u0120False", "\u010a\u010a", "\u0109return", "\u0120True", "\u0120if", "\u0120abs", "(x", "-s", "x", ")", "\u0120<", "\u0120", "2", "\u0120and", "\u0120abs", "(y", "-s", "y", ")", "\u0120<", "\u0120", "2", "\u0120else", "\u0120False", "\u010a\u010a\u010a\u010a", "while", "\u0120", "1", ":\u010a\u010a", "\u0109x", ",y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0109if", "\u0120x", "\u0120==", "\u0120y", "\u0120==", "\u0120", "0", ":", "\u0120break", "\u010a\u010a", "\u0109n", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0109", "xy", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0109ans", "\u0120=", "\u0120solve", "(x", ",y", ",", "xy", ")\u010a\u010a", "\u0109print", "(ans", "\u0120if", "\u0120ans", "\u0120else", "\u0120\"", "NA", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03988", "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(1000000)\n\nfrom collections import deque\n\ndef getN():\n\n return int(input())\n\ndef getList():\n\n return list(map(int, input().split()))\n\nimport math\n\n\n\nn = getN()\n\nnums = getList()\n\n\n\n# nums.sort(reverse=True)\n\nmx = max(nums)\n\nmn = (mx+1) // 2\n\nmndx = (mx % 2) + 1\n\n\n\nfrom collections import Counter\n\n\n\ncnt = Counter(nums)\n\n\n\nfor i in range(mn+1, mx+1):\n\n if cnt[i] < 2:\n\n print(\"Impossible\")\n\n sys.exit()\n\n\n\nif cnt[mn] != mndx:\n\n print(\"Impossible\")\n\nelse:\n\n print(\"Possible\")", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", "0", ")\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "def", "\u0120get", "N", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120getList", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "import", "\u0120math", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120get", "N", "()\u010a\u010a", "nums", "\u0120=", "\u0120getList", "()\u010a\u010a\u010a\u010a", "#", "\u0120nums", ".sort", "(reverse", "=True", ")\u010a\u010a", "mx", "\u0120=", "\u0120max", "(nums", ")\u010a\u010a", "mn", "\u0120=", "\u0120(", "mx", "+", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "m", "ndx", "\u0120=", "\u0120(", "mx", "\u0120%", "\u0120", "2", ")", "\u0120+", "\u0120", "1", "\u010a\u010a\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120Counter", "(nums", ")\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "n", "+", "1", ",", "\u0120mx", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "[i", "]", "\u0120<", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "Impossible", "\")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a\u010a\u010a", "if", "\u0120cnt", "[m", "n", "]", "\u0120!=", "\u0120m", "ndx", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Impossible", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Possible", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229]} +{"problem_id": "p02390", "input": "import sys\n\n\n\nif __name__ == '__main__':\n\n import doctest\n\n doctest.testmod()\n\n S = int(sys.stdin.read())\n\n h = S / 3600\n\n m = (S % 3600) / 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120do", "ctest", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120do", "ctest", ".test", "mod", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120int", "(sys", ".stdin", ".read", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", "\u0120=", "\u0120S", "\u0120/", "\u0120", "3", "6", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120(", "S", "\u0120%", "\u0120", "3", "6", "0", "0", ")", "\u0120/", "\u0120", "6", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120S", "\u0120%", "\u0120", "6", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"%", "d", ":%", "d", ":%", "d", "\"", "\u0120%", "\u0120(", "h", ",", "\u0120m", ",", "\u0120s", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02880", "input": "n = int(input())\n\ns = []\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n s.append(i*j)\n\nif n in s:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "s", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", ".append", "(i", "*j", ")\u010a\u010a", "if", "\u0120n", "\u0120in", "\u0120s", ":\u010a\u010a", "\u0120", "\u0120print", "(\"", "Yes", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "(\"", "No", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229]} +{"problem_id": "p03796", "input": "import math\n\nN=int(input())\n\nans=math.factorial(N)\n\nprint((ans%(10**9 +7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "=int", "(input", "())\u010a\u010a", "ans", "=", "math", ".factor", "ial", "(N", ")\u010a\u010a", "print", "((", "ans", "%(", "1", "0", "**", "9", "\u0120+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03634", "input": "from collections import deque\n\nn,*t=list(map(int,open(0).read().split()))\n\ncon=[[] for _ in range(n)]\n\ndist_f_k=[0]*n\n\n\n\nfor a,b,c in zip(t[:3*n-3:3],t[1::3],t[2::3]):\n\n\tcon[a-1].append((b-1,c))\n\n\tcon[b-1].append((a-1,c))\n\n\n\nk=t[3*n-2]\n\nque=deque([k-1])\n\nwhile que:\n\n\tcur=que.popleft()\n\n\tfor nxt,dd in con[cur]:\n\n\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\tque.append(nxt)\n\n\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\nfor x,y in zip(t[3*n-1::2],t[3*n::2]):\n\n\tprint((dist_f_k[x-1]+dist_f_k[y-1]))", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "n", ",*", "t", "=list", "(map", "(int", ",", "open", "(", "0", ").", "read", "().", "split", "()))\u010a\u010a", "con", "=[", "[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "dist", "_f", "_k", "=[", "0", "]*", "n", "\u010a\u010a\u010a\u010a", "for", "\u0120a", ",b", ",c", "\u0120in", "\u0120zip", "(t", "[:", "3", "*n", "-", "3", ":", "3", "],", "t", "[", "1", "::", "3", "],", "t", "[", "2", "::", "3", "])", ":\u010a\u010a", "\u0109con", "[a", "-", "1", "].", "append", "((", "b", "-", "1", ",c", "))\u010a\u010a", "\u0109con", "[b", "-", "1", "].", "append", "((", "a", "-", "1", ",c", "))", "\u010a\u010a\u010a\u010a", "k", "=t", "[", "3", "*n", "-", "2", "]\u010a\u010a", "que", "=", "deque", "([", "k", "-", "1", "])\u010a\u010a", "while", "\u0120que", ":\u010a\u010a", "\u0109cur", "=", "que", ".p", "opleft", "()\u010a\u010a", "\u0109for", "\u0120nxt", ",", "dd", "\u0120in", "\u0120con", "[cur", "]:\u010a\u010a", "\u0109", "\u0109if", "\u0120dist", "_f", "_k", "[n", "xt", "]==", "0", "\u0120and", "\u0120nxt", "!=", "k", "-", "1", ":\u010a\u010a", "\u0109\u0109", "\u0109", "que", ".append", "(n", "xt", ")\u010a\u010a", "\u0109\u0109", "\u0109dist", "_f", "_k", "[n", "xt", "]=", "dist", "_f", "_k", "[cur", "]+", "dd", "\u010a\u010a\u010a\u010a", "for", "\u0120x", ",y", "\u0120in", "\u0120zip", "(t", "[", "3", "*n", "-", "1", "::", "2", "],", "t", "[", "3", "*n", "::", "2", "])", ":\u010a\u010a", "\u0109print", "((", "dist", "_f", "_k", "[x", "-", "1", "]+", "dist", "_f", "_k", "[y", "-", "1", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169]} +{"problem_id": "p02622", "input": "S = input()\n\nT = input()\n\nN = len(S)\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)\n", "input_tokens": ["S", "\u0120=", "\u0120input", "()\u010a\u010a", "T", "\u0120=", "\u0120input", "()\u010a\u010a", "N", "\u0120=", "\u0120len", "(S", ")\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120(", "S", "[i", "]", "\u0120!=", "\u0120T", "[i", "])\u010a\u010a", "\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02264", "input": "n, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n\tps[i], t[i] = input( ).split( \" \" )\n\n\n\n\n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n\tpsi = ps.pop( 0 )\n\n\tti = int( t.pop( 0 ) )\n\n\tif ti <= q:\n\n\t\tqsum += ti\t\n\n\t\toutput.append( psi+\" \"+str( qsum ) )\n\n\telse:\n\n\t\tt.append( ti - q )\n\n\t\tps.append( psi )\n\n\t\tqsum += q\n\n\n\nprint(( \"\\n\".join( output ) ))", "input_tokens": ["n", ",", "\u0120q", "\u0120=", "\u0120[", "\u0120int", "(", "\u0120val", "\u0120)", "\u0120for", "\u0120val", "\u0120in", "\u0120input", "(", "\u0120).", "split", "(", "\u0120\"", "\u0120\"", "\u0120)", "\u0120]\u010a\u010a", "ps", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "t", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "\u0120n", "\u0120):\u010a\u010a", "\u0109ps", "[i", "],", "\u0120t", "[i", "]", "\u0120=", "\u0120input", "(", "\u0120).", "split", "(", "\u0120\"", "\u0120\"", "\u0120)\u010a\u010a", "\u010a\u010a\u010a\u010a", "output", "\u0120=", "\u0120[]\u010a\u010a", "q", "sum", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120t", ":\u010a\u010a", "\u0109", "psi", "\u0120=", "\u0120ps", ".pop", "(", "\u0120", "0", "\u0120)\u010a\u010a", "\u0109ti", "\u0120=", "\u0120int", "(", "\u0120t", ".pop", "(", "\u0120", "0", "\u0120)", "\u0120)\u010a\u010a", "\u0109if", "\u0120ti", "\u0120<=", "\u0120q", ":\u010a\u010a", "\u0109", "\u0109q", "sum", "\u0120+=", "\u0120ti", "\u0109\u010a\u010a", "\u0109", "\u0109output", ".append", "(", "\u0120psi", "+\"", "\u0120\"+", "str", "(", "\u0120q", "sum", "\u0120)", "\u0120)\u010a\u010a", "\u0109else", ":\u010a\u010a", "\u0109", "\u0109t", ".append", "(", "\u0120ti", "\u0120-", "\u0120q", "\u0120)\u010a\u010a", "\u0109", "\u0109ps", ".append", "(", "\u0120psi", "\u0120)\u010a\u010a", "\u0109", "\u0109q", "sum", "\u0120+=", "\u0120q", "\u010a\u010a\u010a\u010a", "print", "((", "\u0120\"\\", "n", "\".", "join", "(", "\u0120output", "\u0120)", "\u0120))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02688", "input": "N,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(input())\n\n b=input().split(' ')\n\n for j in range(count):\n\n if int(b[j]) in a:\n\n a.remove(int(b[j]))\n\nprint((len(a)))", "input_tokens": ["N", ",K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "('", "\u0120'", ")))\u010a\u010a", "a", "=list", "(range", "(", "1", ",N", "+", "1", "))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120", "\u0120count", "=int", "(input", "())\u010a\u010a", "\u0120", "\u0120b", "=input", "().", "split", "('", "\u0120')\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(count", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120int", "(b", "[j", "])", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120a", ".remove", "(int", "(b", "[j", "]))\u010a\u010a", "print", "((", "len", "(a", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02416", "input": "res = []\n\nwhile True:\n\n s = input()\n\n if s == '0':\n\n break\n\n\n\n res.append(sum([int(x) for x in s]))\n\n\n\nfor e in res:\n\n print(e)", "input_tokens": ["res", "\u0120=", "\u0120[]\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120==", "\u0120'", "0", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", ".append", "(sum", "([", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120s", "]))", "\u010a\u010a\u010a\u010a", "for", "\u0120e", "\u0120in", "\u0120res", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(e", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03086", "input": "import re;print((max(list(map(len,re.split('[^ACGT]',input()))))))", "input_tokens": ["import", "\u0120re", ";", "print", "((", "max", "(list", "(map", "(len", ",re", ".split", "('[", "^", "AC", "GT", "]',", "input", "()))", "))))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03828", "input": "import math\n\nn=int(input())\n\nwaru=10**9+7\n\n\n\nli=[]\n\nli2=[]\n\n\n\nfor i in range(2,n+1):\n\n tmp=math.factorial(n)\n\n flag=1\n\n for j in range(len(li)):\n\n if i%li[j]==0:\n\n flag=0\n\n break\n\n if flag==1:\n\n li.append(i)\n\n li2.append(0)\n\n while tmp%i==0:\n\n li2[len(li)-1]+=1\n\n tmp=tmp//i\n\nans=1\n\n# print(li)\n\n# print(li2)\n\nfor i in range(len(li2)):\n\n ans*=li2[i]+1\n\nprint((ans%waru))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "war", "u", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a\u010a\u010a", "li", "=[]", "\u010a\u010a", "li", "2", "=[]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "=", "math", ".factor", "ial", "(n", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120flag", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(li", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "%", "li", "[j", "]==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120flag", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120flag", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120li", ".append", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120li", "2", ".append", "(", "0", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120tmp", "%i", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120li", "2", "[len", "(li", ")-", "1", "]+=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "=tmp", "//", "i", "\u010a\u010a", "ans", "=", "1", "\u010a\u010a", "#", "\u0120print", "(li", ")\u010a\u010a", "#", "\u0120print", "(li", "2", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(li", "2", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "*=", "li", "2", "[i", "]+", "1", "\u010a\u010a", "print", "((", "ans", "%", "war", "u", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5928797394668679, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.965984387791001, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.5928797394668679, 0.8170167109432965, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833]} +{"problem_id": "p03325", "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nans = 0\n\ncheck = [0]*30\n\nfor i in range(1, 31):\n\n check[i-1] = 2**i\n\n\n\nfor i in A:\n\n if i % 2 == 0:\n\n j = 0\n\n while check[j] <= i:\n\n if i % check[j] == 0:\n\n add = check[j]\n\n else:\n\n break\n\n \n\n j += 1\n\n ans += j\n\n \n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "check", "\u0120=", "\u0120[", "0", "]*", "3", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "3", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120check", "[i", "-", "1", "]", "\u0120=", "\u0120", "2", "**", "i", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120check", "[j", "]", "\u0120<=", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120%", "\u0120check", "[j", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120add", "\u0120=", "\u0120check", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519]} +{"problem_id": "p03845", "input": "N = int(input())\n\nT = list(map(int, input().split()))\n\nM = int(input())\n\np = []\n\nx = []\n\nans = []\n\nfor i in range(M):\n\n p, x = list(map(int, input().split()))\n\n ans.append(sum(T[:p-1])+x+sum(T[p:]))\n\n\n\nfor _ in ans:\n\n print(_)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "T", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "M", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "p", "\u0120=", "\u0120[]\u010a\u010a", "x", "\u0120=", "\u0120[]\u010a\u010a", "ans", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", ",", "\u0120x", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", ".append", "(sum", "(T", "[:", "p", "-", "1", "])+", "x", "+", "sum", "(T", "[p", ":", "]))", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(_)"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229]} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(N", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02901", "input": "def main():\n\n import math\n\n N,M=list(map(int,input().split()))\n\n a=[]\n\n for i in range(M):\n\n tmp=list(map(int,input().split()))\n\n tmpc=list(map(int,input().split()))\n\n c=0\n\n for j in range(len(tmpc)):\n\n c+=2**(tmpc[j]-1)\n\n tmp[1]=c\n\n a+=[tmp]\n\n\n\n\n\n dp=[[10**10 for j in range(2**N)] for i in range(M)]\n\n dp[0][0]=0\n\n dp[0][a[0][1]]=a[0][0]\n\n\n\n\n\n for i in range(1,M):\n\n dp[i]=dp[i-1]\n\n for j in range(2**N):\n\n z,p=a[i][0],a[i][1]\n\n q=j|p\n\n x=dp[i-1][j]+z\n\n if dp[i][q]>x: dp[i][q]=x\n\n\n\n ans=dp[M-1][2**N-1]\n\n print((ans if ans<10**10 else -1))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120math", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",M", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=[]", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "c", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(tmp", "c", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "+=", "2", "**(", "tmp", "c", "[j", "]-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "[", "1", "]=", "c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "+", "=[", "tmp", "]", "\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "=[[", "1", "0", "**", "1", "0", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "2", "**", "N", ")]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "][", "0", "]=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "][", "a", "[", "0", "][", "1", "]]=", "a", "[", "0", "][", "0", "]", "\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]=", "dp", "[i", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "2", "**", "N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120z", ",p", "=a", "[i", "][", "0", "],", "a", "[i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "=j", "|", "p", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "=", "dp", "[i", "-", "1", "][", "j", "]+", "z", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "][", "q", "]>", "x", ":", "\u0120dp", "[i", "][", "q", "]=", "x", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=", "dp", "[M", "-", "1", "][", "2", "**", "N", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "ans", "\u0120if", "\u0120ans", "<", "1", "0", "**", "1", "0", "\u0120else", "\u0120-", "1", "))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02574", "input": "#!/usr/bin/env pypy3\n\n# N,M = map(int,sys.stdin.readline().split())\n\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n\n# s = sys.stdin.readline().rstrip()\n\n# N = int(sys.stdin.readline())\n\n# INF = float(\"inf\")\n\nimport math,sys\n\n\n\nn = int(sys.stdin.readline())\n\na = tuple(map(int,sys.stdin.readline().split()))\n\n#n = int(input())\n\n#a = list(map(int,input().split()))\n\ng = math.gcd(a[0],a[1])\n\nfor i in range(2,n):\n\n g = math.gcd(g,a[i])\n\nM = max(a)\n\nacc = a[0]\n\nfor i in range(n):\n\n acc = math.gcd(acc,a[i])\n\nif acc != 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nLIMIT=max(a)\n\nminPrime = [0]*(LIMIT+1)\n\nminPrime[1] = 1\n\ndef make():\n\n for i in range(2,LIMIT+1):\n\n if minPrime[i] == 0:\n\n minPrime[i] = i\n\n #print(i)\n\n for j in range(i+i,LIMIT+1,i):\n\n #print(i,j)\n\n if minPrime[j] == 0:\n\n minPrime[j] = i\n\nmake()\n\ndef factrial(N):\n\n ret = []\n\n while minPrime[N] != N:\n\n ret.append(minPrime[N])\n\n N = N//minPrime[N]\n\n if N != 1:\n\n ret.append(N)\n\n return ret\n\n\n\njudge = set([])\n\npc = True\n\n\n\npairwise = True\n\np = set() #all prime\n\n\n\nfor e in a:\n\n if not pairwise:\n\n break\n\n asf = set(factrial(e))\n\n if judge & asf != set():\n\n pc = False\n\n # #pairwise = False\n\n # print(\"setwise coprime\")\n\n # exit(0)\n\n judge |= asf\n\n# for i in a:\n\n# if not pc:\n\n# break\n\n# asf = set(factrial(i))\n\n\n\n# if judge & asf != set():\n\n# pc = False\n\n# judge |= asf\n\nif pc:\n\n print(\"pairwise coprime\")\n\nelif g == 1:\n\n print(\"setwise coprime\")\n\nelse:\n\n print(\"not coprime\")\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120p", "ypy", "3", "\u010a\u010a", "#", "\u0120N", ",M", "\u0120=", "\u0120map", "(int", ",", "sys", ".stdin", ".readline", "().", "split", "())\u010a\u010a", "#", "\u0120a", "\u0120=", "\u0120tuple", "(map", "(int", ",", "sys", ".stdin", ".readline", "().", "split", "()))", "\u0120#", "\u0120single", "\u0120line", "\u0120with", "\u0120multi", "\u0120param", "\u010a\u010a", "#", "\u0120a", "\u0120=", "\u0120tuple", "(int", "(sys", ".stdin", ".readline", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "))", "\u0120#", "\u0120multi", "\u0120line", "\u0120with", "\u0120single", "\u0120param", "\u010a\u010a", "#", "\u0120a", "\u0120=", "\u0120tuple", "(tuple", "(map", "(int", ",", "sys", ".stdin", ".readline", "().", "rstrip", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "))", "\u0120#", "\u0120multi", "\u0120line", "\u0120with", "\u0120multi", "\u0120param", "\u010a\u010a", "#", "\u0120s", "\u0120=", "\u0120sys", ".stdin", ".readline", "().", "rstrip", "()\u010a\u010a", "#", "\u0120N", "\u0120=", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "#", "\u0120INF", "\u0120=", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "import", "\u0120math", ",", "sys", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "a", "\u0120=", "\u0120tuple", "(map", "(int", ",", "sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "#", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "#a", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "g", "\u0120=", "\u0120math", ".g", "cd", "(a", "[", "0", "],", "a", "[", "1", "])\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "\u0120=", "\u0120math", ".g", "cd", "(g", ",a", "[i", "])\u010a\u010a", "M", "\u0120=", "\u0120max", "(a", ")\u010a\u010a", "acc", "\u0120=", "\u0120a", "[", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120acc", "\u0120=", "\u0120math", ".g", "cd", "(acc", ",a", "[i", "])\u010a\u010a", "if", "\u0120acc", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "not", "\u0120cop", "r", "ime", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "LIMIT", "=max", "(a", ")\u010a\u010a", "min", "Prime", "\u0120=", "\u0120[", "0", "]*(", "LIMIT", "+", "1", ")\u010a\u010a", "min", "Prime", "[", "1", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "def", "\u0120make", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",L", "IMIT", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120min", "Prime", "[i", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120min", "Prime", "[i", "]", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "print", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+i", ",L", "IMIT", "+", "1", ",i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "print", "(i", ",j", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120min", "Prime", "[j", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120min", "Prime", "[j", "]", "\u0120=", "\u0120i", "\u010a\u010a", "make", "()\u010a\u010a", "def", "\u0120fact", "rial", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120while", "\u0120min", "Prime", "[N", "]", "\u0120!=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", ".append", "(min", "Prime", "[N", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120N", "//", "min", "Prime", "[N", "]\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120if", "\u0120N", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", ".append", "(N", ")\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "judge", "\u0120=", "\u0120set", "([]", ")\u010a\u010a", "pc", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "pair", "wise", "\u0120=", "\u0120True", "\u010a\u010a", "p", "\u0120=", "\u0120set", "()", "\u0120#", "all", "\u0120prime", "\u010a\u010a\u010a\u010a", "for", "\u0120e", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120pairwise", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120as", "f", "\u0120=", "\u0120set", "(f", "act", "rial", "(e", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120judge", "\u0120&", "\u0120as", "f", "\u0120!=", "\u0120set", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pc", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120#", "pair", "wise", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "set", "wise", "\u0120cop", "r", "ime", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120judge", "\u0120|=", "\u0120as", "f", "\u010a\u010a", "#", "\u0120for", "\u0120i", "\u0120in", "\u0120a", ":\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120pc", ":\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120as", "f", "\u0120=", "\u0120set", "(f", "act", "rial", "(i", "))", "\u010a\u010a\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120if", "\u0120judge", "\u0120&", "\u0120as", "f", "\u0120!=", "\u0120set", "():\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pc", "\u0120=", "\u0120False", "\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120judge", "\u0120|=", "\u0120as", "f", "\u010a\u010a", "if", "\u0120pc", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "pair", "wise", "\u0120cop", "r", "ime", "\")\u010a\u010a", "elif", "\u0120g", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "set", "wise", "\u0120cop", "r", "ime", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "not", "\u0120cop", "r", "ime", "\")\u010a"], "input_token_weights": [0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.582053818991329, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.9733714842433752, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.9999999999999999, 0.9999999999999999, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411]} +{"problem_id": "p02627", "input": "alph = input()\n\nif alph.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")\n", "input_tokens": ["alph", "\u0120=", "\u0120input", "()\u010a\u010a", "if", "\u0120alph", ".is", "upper", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "A", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "a", "\")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03039", "input": "n, m, k = list(map(int, input().split()))\n\n\n\nmod = 1000000007\n\ndef pow(x, n):\n\n ret = 1\n\n while n > 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\nfac = [1]\n\ninv = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n inv.append(pow(fac[i], mod - 2))\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\n\ndef doit(n, m, k):\n\n ret = 0\n\n for d in range(m):\n\n ret = (ret + d * (m - d)) % mod\n\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))", "input_tokens": ["n", ",", "\u0120m", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "def", "\u0120pow", "(x", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120n", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "n", "\u0120&", "\u0120", "1", ")", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120(", "ret", "\u0120*", "\u0120x", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "\u0120*", "\u0120x", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120>>=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "fac", "\u0120=", "\u0120[", "1", "]\u010a\u010a", "inv", "\u0120=", "\u0120[", "1", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120*", "\u0120m", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fac", ".append", "((", "fac", "[-", "1", "]", "\u0120*", "\u0120i", ")", "\u0120%", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", ".append", "(pow", "(f", "ac", "[i", "],", "\u0120mod", "\u0120-", "\u0120", "2", "))", "\u010a\u010a\u010a\u010a", "def", "\u0120cmb", "(n", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "fac", "[n", "]", "\u0120*", "\u0120inv", "[k", "]", "\u0120*", "\u0120inv", "[n", "\u0120-", "\u0120k", "])", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "def", "\u0120doit", "(n", ",", "\u0120m", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120d", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120(", "ret", "\u0120+", "\u0120d", "\u0120*", "\u0120(", "m", "\u0120-", "\u0120d", "))", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "ret", "\u0120*", "\u0120n", "\u0120*", "\u0120n", "\u0120*", "\u0120cmb", "(n", "\u0120*", "\u0120m", "\u0120-", "\u0120", "2", ",", "\u0120k", "\u0120-", "\u0120", "2", "))", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "print", "(((", "do", "it", "(n", ",", "\u0120m", ",", "\u0120k", ")", "\u0120+", "\u0120doit", "(m", ",", "\u0120n", ",", "\u0120k", "))", "\u0120%", "\u0120mod", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02555", "input": "s=int(input())\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s//3\n\nans=0\n\ndef f(n,k,p):\n\n if k==0:\n\n return 1\n\n elif k%2==0:\n\n return (f(n,k//2,p)**2)%p\n\n else:\n\n return (n*f(n,k-1,p))%p\n\n\n\nfor k in range(1,n+1):\n\n a=1\n\n b=1\n\n for j in range(k-1):\n\n a=(a*(s-3*k+1+j))%p\n\n b=(b*(j+1))%p\n\n ans=(ans+a*f(b,p-2,p))%p\n\n\n\nprint((ans%p))\n\n\n", "input_tokens": ["s", "=int", "(input", "())\u010a\u010a", "p", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "if", "\u0120s", "<=", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "n", "=s", "//", "3", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "def", "\u0120f", "(n", ",k", ",p", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120k", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120k", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120(", "f", "(n", ",k", "//", "2", ",p", ")**", "2", ")%", "p", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120(", "n", "*f", "(n", ",k", "-", "1", ",p", "))", "%", "p", "\u010a\u010a\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "=(", "a", "*(", "s", "-", "3", "*k", "+", "1", "+j", "))", "%", "p", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "=(", "b", "*(", "j", "+", "1", "))", "%", "p", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=(", "ans", "+a", "*f", "(b", ",p", "-", "2", ",p", "))", "%", "p", "\u010a\u010a\u010a\u010a", "print", "((", "ans", "%p", "))\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169]} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()));print((min(k*c*2+a*max(x-k,0)+b*max(y-k,0)for k in range(max(x,y)*3))))", "input_tokens": ["a", ",b", ",c", ",x", ",y", "=list", "(map", "(int", ",input", "().", "split", "()));", "print", "((", "min", "(k", "*c", "*", "2", "+a", "*", "max", "(x", "-k", ",", "0", ")+", "b", "*", "max", "(y", "-k", ",", "0", ")", "for", "\u0120k", "\u0120in", "\u0120range", "(max", "(x", ",y", ")*", "3", "))))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03545", "input": "import math\n\nimport string\n\nimport collections\n\nfrom collections import Counter\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\na, b, c, d = list(map(int, input()))\n\n#print(a, b, c, d)\n\nif a+b+c+d == 7:\n\n print((str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a+b-c+d == 7:\n\n print((str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a+b+c-d == 7:\n\n print((str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a+b-c-d == 7:\n\n print((str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a-b+c+d == 7:\n\n print((str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a-b-c+d == 7:\n\n print((str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a-b+c-d == 7:\n\n print((str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a-b-c-d == 7:\n\n print((str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "import", "\u0120string", "\u010a\u010a", "import", "\u0120collections", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120read", "ints", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120n", "Cr", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120math", ".factor", "ial", "(n", ")//", "(", "math", ".factor", "ial", "(n", "-r", ")*", "math", ".factor", "ial", "(r", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120has", "_duplicates", "2", "(seq", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120seen", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120item", "\u0120in", "\u0120seq", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "(item", "\u0120in", "\u0120seen", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120seen", ".append", "(item", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120len", "(seq", ")", "\u0120!=", "\u0120len", "(se", "en", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120divisor", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120divisor", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120divisor", ".append", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120divisor", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120coordinates", "\u010a\u010a", "dx", "\u0120=", "\u0120[-", "1", ",", "\u0120-", "1", ",", "\u0120-", "1", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "1", ",", "\u0120", "1", ",", "\u0120", "1", "]\u010a\u010a", "dy", "\u0120=", "\u0120[-", "1", ",", "\u0120", "0", ",", "\u0120", "1", ",", "\u0120-", "1", ",", "\u0120", "1", ",", "\u0120-", "1", ",", "\u0120", "0", ",", "\u0120", "1", "]\u010a\u010a", "a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120d", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "()))\u010a\u010a", "#print", "(a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120d", ")\u010a\u010a", "if", "\u0120a", "+b", "+c", "+d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "+'", "+", "str", "(b", ")+'", "+'", "+", "str", "(c", ")+'", "+'", "+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "+b", "-c", "+d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "+'", "+", "str", "(b", ")+'", "-'+", "str", "(c", ")+'", "+'", "+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "+b", "+c", "-d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "+'", "+", "str", "(b", ")+'", "+'", "+", "str", "(c", ")+'", "-'+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "+b", "-c", "-d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "+'", "+", "str", "(b", ")+'", "-'+", "str", "(c", ")+'", "-'+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "-b", "+c", "+d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "-'+", "str", "(b", ")+'", "+'", "+", "str", "(c", ")+'", "+'", "+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "-b", "-c", "+d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "-'+", "str", "(b", ")+'", "-'+", "str", "(c", ")+'", "+'", "+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "-b", "+c", "-d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "-'+", "str", "(b", ")+'", "+'", "+", "str", "(c", ")+'", "-'+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "-b", "-c", "-d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "-'+", "str", "(b", ")+'", "-'+", "str", "(c", ")+'", "-'+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.9793505125525832, 0.5731452134031394, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.958265617022148, 0.958265617022148, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.5731452134031394, 0.6629477592666795, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5731452134031394, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.5731452134031394, 0.60398418480891, 0.60398418480891]} +{"problem_id": "p03723", "input": "a,b,c=list(map(int, input().split()))\n\nd=0\n\nwhile d<10**5:\n\n if a%2==1 or b%2==1 or c%2==1:break\n\n a,b,c=b/2+c/2,a/2+c/2,a/2+b/2\n\n d+=1\n\nelse:d=-1\n\nprint(d)", "input_tokens": ["a", ",b", ",c", "=list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "d", "=", "0", "\u010a\u010a", "while", "\u0120d", "<", "1", "0", "**", "5", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "%", "2", "==", "1", "\u0120or", "\u0120b", "%", "2", "==", "1", "\u0120or", "\u0120c", "%", "2", "==", "1", ":", "break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "=b", "/", "2", "+c", "/", "2", ",a", "/", "2", "+c", "/", "2", ",a", "/", "2", "+b", "/", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "+=", "1", "\u010a\u010a", "else", ":d", "=-", "1", "\u010a\u010a", "print", "(d", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03309", "input": "import statistics\n\nN = int(input())\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in range(1,N+1):\n\n a[i-1] -= i\n\n\n\nb = statistics.median(a)\n\nfor i in range(N):\n\n ans += abs(a[i]-b)\n\nprint((int(ans)))", "input_tokens": ["import", "\u0120statistics", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120", "\u0120a", "[i", "-", "1", "]", "\u0120-=", "\u0120i", "\u010a\u010a\u010a\u010a", "b", "\u0120=", "\u0120statistics", ".median", "(a", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120ans", "\u0120+=", "\u0120abs", "(a", "[i", "]-", "b", ")\u010a\u010a", "print", "((", "int", "(ans", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02665", "input": "n = int(input())\n\nleaves = list(map(int, input().split()))\n\n\n\nans = 0\n\nnodes_min = [0] * (n + 1)\n\nnodes_max = [0] * (n + 1)\n\nnodes_min[n] = leaves[n]\n\nnodes_max[n] = leaves[n]\n\n\n\nfor depth in range(n, 0, -1):\n\n root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2\n\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n\n root_max = nodes_max[depth]\n\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\n\nnodes = [0] * (n + 1)\n\nnodes[0] = 1\n\nif nodes[0] < nodes_min[0]:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n roots = nodes[depth]-leaves[depth]\n\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n\n if nodes[depth+1] < nodes_min[depth+1]:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(nodes)))\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "le", "aves", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "nodes", "_min", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "nodes", "_max", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "nodes", "_min", "[n", "]", "\u0120=", "\u0120leaves", "[n", "]\u010a\u010a", "nodes", "_max", "[n", "]", "\u0120=", "\u0120leaves", "[n", "]\u010a\u010a\u010a\u010a", "for", "\u0120depth", "\u0120in", "\u0120range", "(n", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120root", "_min", "\u0120=", "\u0120nodes", "_min", "[", "depth", "]", "\u0120//", "\u0120", "2", "\u0120+", "\u0120nodes", "_min", "[", "depth", "]", "\u0120%", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120nodes", "_min", "[", "depth", "\u0120-", "\u0120", "1", "]", "\u0120=", "\u0120leaves", "[", "depth", "\u0120-", "\u0120", "1", "]", "\u0120+", "\u0120root", "_min", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120root", "_max", "\u0120=", "\u0120nodes", "_max", "[", "depth", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120nodes", "_max", "[", "depth", "\u0120-", "\u0120", "1", "]", "\u0120=", "\u0120leaves", "[", "depth", "\u0120-", "\u0120", "1", "]", "\u0120+", "\u0120root", "_max", "\u010a\u010a", "nodes", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "nodes", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120nodes", "[", "0", "]", "\u0120<", "\u0120nodes", "_min", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120depth", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120roots", "\u0120=", "\u0120nodes", "[", "depth", "]-", "le", "aves", "[", "depth", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nodes", "[", "depth", "\u0120+", "\u0120", "1", "]", "\u0120=", "\u0120min", "(", "roots", "\u0120*", "\u0120", "2", ",", "\u0120nodes", "_max", "[", "depth", "\u0120+", "\u0120", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120nodes", "[", "depth", "+", "1", "]", "\u0120<", "\u0120nodes", "_min", "[", "depth", "+", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "sum", "(nodes", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891]} +{"problem_id": "p02691", "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\ndp = [0] * 10 ** 7\n\nans = 0\n\nfor i in range(N):\n\n x = i + 1 - A[i]\n\n if x >= 0:\n\n ans += dp[x]\n\n y = i + 1 + A[i]\n\n if y < 10 ** 7:\n\n dp[y] += 1\n\n\n\nprint(ans)\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120", "1", "0", "\u0120**", "\u0120", "7", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120i", "\u0120+", "\u0120", "1", "\u0120-", "\u0120A", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120>=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120dp", "[x", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "\u0120=", "\u0120i", "\u0120+", "\u0120", "1", "\u0120+", "\u0120A", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120y", "\u0120<", "\u0120", "1", "0", "\u0120**", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[y", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897]} +{"problem_id": "p03544", "input": "a,b=2,1\n\nfor i in[0]*int(input()):a,b=b,a+b\n\nprint(a)", "input_tokens": ["a", ",b", "=", "2", ",", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "[", "0", "]*", "int", "(input", "()):", "a", ",b", "=b", ",a", "+b", "\u010a\u010a", "print", "(a", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02555", "input": "S = int(input())\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))", "input_tokens": ["S", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]*(", "S", "+", "1", ")\u010a\u010a", "dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",S", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "0", ",(", "i", "-", "3", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120%=", "\u0120mod", "\u010a\u010a", "print", "((", "dp", "[S", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03107", "input": "# ABC 120 C\n\n\n\nimport re\n\n\n\nS = input()\n\n\n\nl0 = 0\n\nl1 = 0\n\n\n\nfor i in range(len(S)):\n\n if S[i] == '0':\n\n l0 += 1\n\n elif S[i] == '1':\n\n l1 += 1\n\n\n\nprint((min(l0, l1) * 2))\n", "input_tokens": ["#", "\u0120ABC", "\u0120", "1", "2", "0", "\u0120C", "\u010a\u010a\u010a\u010a", "import", "\u0120re", "\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "l", "0", "\u0120=", "\u0120", "0", "\u010a\u010a", "l", "1", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", "]", "\u0120==", "\u0120'", "0", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "0", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120S", "[i", "]", "\u0120==", "\u0120'", "1", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "1", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "((", "min", "(l", "0", ",", "\u0120l", "1", ")", "\u0120*", "\u0120", "2", "))\u010a"], "input_token_weights": [0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02657", "input": "def iput(): return int(input())\n\ndef mput(): return list(map(int, input().split()))\n\ndef lput(): return list(map(int, input().split()))\n\n\n\ndef solve():\n\n a, b = mput()\n\n print((a*b))\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()", "input_tokens": ["def", "\u0120ip", "ut", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120m", "put", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120l", "put", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120m", "put", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "a", "*b", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120solve", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03759", "input": "a, b, c = list(map(int, input().split()))\n\nif (b - a) == (c - b):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "if", "\u0120(", "b", "\u0120-", "\u0120a", ")", "\u0120==", "\u0120(", "c", "\u0120-", "\u0120b", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "YES", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%1000000007))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(int", "(input", "()))", "%", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03416", "input": "a,b = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n j = str(i)\n\n if j==''.join(reversed(j)):\n\n count += 1\n\nprint(count)", "input_tokens": ["a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "=='", "'.", "join", "(re", "versed", "(j", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03796", "input": "#!/usr/bin/env pypy3\n\n\n\nimport math\n\nprint((math.factorial(int(input())) % 1000000007))", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120p", "ypy", "3", "\u010a\u010a\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(int", "(input", "()))", "\u0120%", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))"], "input_token_weights": [0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03721", "input": "(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\n\nfor a, b in sorted(AB):\n\n K -= b\n\n if K <= 0:\n\n print(a)\n\n break\n", "input_tokens": ["(N", ",", "\u0120K", "),", "\u0120*", "AB", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120s", ".split", "()))", "\u0120for", "\u0120s", "\u0120in", "\u0120open", "(", "0", ")]\u010a\u010a", "for", "\u0120a", ",", "\u0120b", "\u0120in", "\u0120sorted", "(", "AB", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120K", "\u0120-=", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120K", "\u0120<=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.6339004969859428]} +{"problem_id": "p03796", "input": "mod = int(1e9+7)\n\nn = int(input())\n\n\n\npower = 1\n\nfor i in range(1, n+1):\n\n power = power * i % mod\n\nprint(power)", "input_tokens": ["mod", "\u0120=", "\u0120int", "(", "1", "e", "9", "+", "7", ")\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "power", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120power", "\u0120=", "\u0120power", "\u0120*", "\u0120i", "\u0120%", "\u0120mod", "\u010a\u010a", "print", "(power", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03164", "input": "N, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [[10**9+1] * (V + 1) for i in range(N+1)]\n\ndp[0][0] = 0\n\nfor i in range(N):\n\n for j in range(V+1):\n\n if j - L[i][1] >= 0:\n\n dp[i+1][j] = min(dp[i][j], dp[i][j-L[i][1]] + L[i][0])\n\n else:\n\n dp[i+1][j] = dp[i][j]\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[-1][j]:\n\n ans = max(ans, j)\n\nprint(ans)", "input_tokens": ["N", ",", "\u0120W", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "V", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120V", "\u0120+=", "\u0120L", "[i", "][", "1", "]\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[[", "1", "0", "**", "9", "+", "1", "]", "\u0120*", "\u0120(", "V", "\u0120+", "\u0120", "1", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", ")]\u010a\u010a", "dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(V", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120-", "\u0120L", "[i", "][", "1", "]", "\u0120>=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "]", "\u0120=", "\u0120min", "(dp", "[i", "][", "j", "],", "\u0120dp", "[i", "][", "j", "-L", "[i", "][", "1", "]]", "\u0120+", "\u0120L", "[i", "][", "0", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "]", "\u0120=", "\u0120dp", "[i", "][", "j", "]\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(V", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120", "\u0120W", "\u0120>=", "\u0120dp", "[-", "1", "][", "j", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120j", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03814", "input": "s = input()\n\n\n\nstart = -1\n\nend = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A' and start < 0:\n\n start = i\n\n elif s[i] == 'Z':\n\n end = i\n\nprint((end - start + 1))\n", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "start", "\u0120=", "\u0120-", "1", "\u010a\u010a", "end", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120==", "\u0120'", "A", "'", "\u0120and", "\u0120start", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120s", "[i", "]", "\u0120==", "\u0120'", "Z", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120end", "\u0120=", "\u0120i", "\u010a\u010a", "print", "((", "end", "\u0120-", "\u0120start", "\u0120+", "\u0120", "1", "))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02412", "input": "while 1:\n\n n,x=list(map(int,input().split()))\n\n if n+x==0:break\n\n print((len([1 for i in range(3,n+1)for j in range(2,x-i)if x-i-j d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120from", "\u0120sys", "\u0120import", "\u0120stdin", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "\u0120=", "\u0120stdin", ".readline", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120m", ",", "\u0120r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(r", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[i", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120[[", "1", "0", "**", "8", "]", "\u0120*", "\u0120n", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", ",", "\u0120j", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[i", "-", "1", "][", "j", "-", "1", "]", "\u0120=", "\u0120k", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[j", "-", "1", "][", "i", "-", "1", "]", "\u0120=", "\u0120k", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120War", "shall", "-F", "loyd", "\u0120algorithm", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[i", "][", "j", "]", "\u0120>", "\u0120d", "[i", "][", "k", "]", "\u0120+", "\u0120d", "[k", "][", "j", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[i", "][", "j", "]", "\u0120=", "\u0120d", "[i", "][", "k", "]", "\u0120+", "\u0120d", "[k", "][", "j", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120full", "\u0120search", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120", "8", "!", "\u0120=", "\u0120", "4", "0", "3", "2", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120from", "\u0120itertools", "\u0120import", "\u0120permutations", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120answer", "\u0120=", "\u0120", "1", "0", "**", "8", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120permutations", "(l", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(r", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120d", "[i", "[j", "]][", "i", "[j", "+", "1", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120ans", "\u0120<", "\u0120answer", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120answer", "\u0120=", "\u0120ans", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(answer", ")\u010a\u010a\u010a\u010a", "main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5886835746651548, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.9688636353604363, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.5886835746651548, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02702", "input": "from collections import Counter\n\nS = input()[::-1]\n\n\n\nmemo = [0]\n\nd = 0\n\nmod = 2019\n\n\n\nfor s in S:\n\n tmp = int(s) * pow(10, d, mod) % mod\n\n tmp = memo[-1] + tmp\n\n memo.append(tmp % mod)\n\n d += 1\n\n\n\nc = Counter(memo)\n\nans = sum(v * (v - 1) // 2 for v in list(c.values()))\n\nprint(ans)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "S", "\u0120=", "\u0120input", "()[", "::-", "1", "]\u010a\u010a\u010a\u010a", "memo", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "d", "\u0120=", "\u0120", "0", "\u010a\u010a", "mod", "\u0120=", "\u0120", "2", "0", "1", "9", "\u010a\u010a\u010a\u010a", "for", "\u0120s", "\u0120in", "\u0120S", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120int", "(s", ")", "\u0120*", "\u0120pow", "(", "1", "0", ",", "\u0120d", ",", "\u0120mod", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120memo", "[-", "1", "]", "\u0120+", "\u0120tmp", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120memo", ".append", "(tmp", "\u0120%", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "c", "\u0120=", "\u0120Counter", "(m", "emo", ")\u010a\u010a", "ans", "\u0120=", "\u0120sum", "(v", "\u0120*", "\u0120(", "v", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u0120for", "\u0120v", "\u0120in", "\u0120list", "(c", ".values", "()))\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02627", "input": "a = input()\n\nprint(('A' if not a.islower() else 'a'))\n", "input_tokens": ["a", "\u0120=", "\u0120input", "()\u010a\u010a", "print", "(('", "A", "'", "\u0120if", "\u0120not", "\u0120a", ".is", "lower", "()", "\u0120else", "\u0120'", "a", "'))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03325", "input": "N=int(input())\n\na=list(map(int,input().split()))\n\nfor i in range(N):\n\n for j in range(1,31):\n\n if a[i]%(2**j)!=0:\n\n a[i]=j-1\n\n break\n\nprint((sum(a)))", "input_tokens": ["N", "=int", "(input", "())\u010a\u010a", "a", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "3", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[i", "]", "%(", "2", "**", "j", ")!=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[i", "]=", "j", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "print", "((", "sum", "(a", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03416", "input": "a, b = list(map(int, input().split()))\n\ncnt = 0\n\n\n\nfor i in range(a, b+1):\n\n i = str(i)\n\n if i[0] == i[-1] and i[1] == i[-2]:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "input_tokens": ["a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "[", "0", "]", "\u0120==", "\u0120i", "[-", "1", "]", "\u0120and", "\u0120i", "[", "1", "]", "\u0120==", "\u0120i", "[-", "2", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03835", "input": "k, s = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if i + j > s:\n\n break\n\n elif s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n", "input_tokens": ["k", ",", "\u0120s", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120+", "\u0120j", "\u0120>", "\u0120s", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120s", "\u0120-", "\u0120i", "\u0120-", "\u0120j", "\u0120<=", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781]} +{"problem_id": "p02702", "input": "from collections import Counter\n\n\n\ns = input()\n\nmod1 = 673\n\nmod2 = 3\n\n\n\nnum1 = 0\n\nnum2 = 0\n\nli1 = []\n\nli2 = []\n\npw1 = 10\n\npw2 = 10\n\nfor i, e in enumerate(s, 1):\n\n num1 *= 10\n\n num1 += int(e)\n\n num1 %= mod1\n\n inv = pow(pw1, mod1 - 2, mod1)\n\n li1.append(num1 * inv % mod1)\n\n\n\n num2 *= 10\n\n num2 += int(e)\n\n num2 %= mod2\n\n inv = pow(pw2, mod2 - 2, mod2)\n\n li2.append(num2 * inv % mod2)\n\n\n\n pw1 *= 10\n\n pw1 %= mod1\n\n pw2 *= 10\n\n pw2 %= mod2\n\n\n\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\n\nc = Counter(li)\n\n\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) // 2\n\n\n\nprint(ans)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120input", "()\u010a\u010a", "mod", "1", "\u0120=", "\u0120", "6", "7", "3", "\u010a\u010a", "mod", "2", "\u0120=", "\u0120", "3", "\u010a\u010a\u010a\u010a", "num", "1", "\u0120=", "\u0120", "0", "\u010a\u010a", "num", "2", "\u0120=", "\u0120", "0", "\u010a\u010a", "li", "1", "\u0120=", "\u0120[]\u010a\u010a", "li", "2", "\u0120=", "\u0120[]\u010a\u010a", "pw", "1", "\u0120=", "\u0120", "1", "0", "\u010a\u010a", "pw", "2", "\u0120=", "\u0120", "1", "0", "\u010a\u010a", "for", "\u0120i", ",", "\u0120e", "\u0120in", "\u0120enumerate", "(s", ",", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "1", "\u0120*=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "1", "\u0120+=", "\u0120int", "(e", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "1", "\u0120%=", "\u0120mod", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "\u0120=", "\u0120pow", "(p", "w", "1", ",", "\u0120mod", "1", "\u0120-", "\u0120", "2", ",", "\u0120mod", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120li", "1", ".append", "(num", "1", "\u0120*", "\u0120inv", "\u0120%", "\u0120mod", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "2", "\u0120*=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "2", "\u0120+=", "\u0120int", "(e", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "2", "\u0120%=", "\u0120mod", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "\u0120=", "\u0120pow", "(p", "w", "2", ",", "\u0120mod", "2", "\u0120-", "\u0120", "2", ",", "\u0120mod", "2", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120li", "2", ".append", "(num", "2", "\u0120*", "\u0120inv", "\u0120%", "\u0120mod", "2", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120pw", "1", "\u0120*=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120pw", "1", "\u0120%=", "\u0120mod", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120pw", "2", "\u0120*=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120pw", "2", "\u0120%=", "\u0120mod", "2", "\u010a\u010a\u010a\u010a", "li", "\u0120=", "\u0120[", "0", "]", "\u0120+", "\u0120[", "1", "0", "\u0120*", "\u0120e", "1", "\u0120+", "\u0120e", "2", "\u0120for", "\u0120e", "1", ",", "\u0120e", "2", "\u0120in", "\u0120zip", "(li", "1", ",", "\u0120li", "2", ")]\u010a\u010a", "c", "\u0120=", "\u0120Counter", "(li", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120v", "\u0120in", "\u0120list", "(c", ".values", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120v", "\u0120*", "\u0120(", "v", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split(' ')))\n\n\n\nc = int(c*2)\n\nm = float('inf')\n\nfor i in range(10**5+1):\n\n m = min(m, a*max(0, x-i)+b*max(0,y-i)+c*i)\n\nprint(m)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "('", "\u0120'", "))", ")\u010a\u010a\u010a\u010a", "c", "\u0120=", "\u0120int", "(c", "*", "2", ")\u010a\u010a", "m", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "**", "5", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120min", "(m", ",", "\u0120a", "*", "max", "(", "0", ",", "\u0120x", "-i", ")+", "b", "*", "max", "(", "0", ",y", "-i", ")+", "c", "*i", ")\u010a\u010a", "print", "(m", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02983", "input": "l,r=list(map(int,input().split()))\n\ns=list(range(l,r+1))[:2019]\n\nprint((min(i*j%2019for i in s for j in s if i> i & 1:\n\n a = dp[i][a]\n\n return a >= b\n\ndef solve(a, b):\n\n if a > b:\n\n a, b = b, a\n\n ng = 0\n\n ok = n-1\n\n while ok - ng > 1:\n\n mid = (ng + ok) // 2\n\n if test(mid, a, b):\n\n ok = mid\n\n else:\n\n ng = mid\n\n print(ok)\n\nq = int(input())\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n solve(a, b)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "import", "\u0120bis", "ect", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "X", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "l", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "U", "\u0120=", "\u0120", "1", "7", "\u010a\u010a", "dp", "\u0120=", "\u0120[[", "0", "]*", "n", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(U", "+", "1", ")]\u010a\u010a", "for", "\u0120i", ",", "\u0120x", "\u0120in", "\u0120enumerate", "(X", "):\u010a\u010a", "\u0120", "\u0120t", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_left", "(X", ",", "\u0120x", "+l", ")\u010a\u010a", "\u0120", "\u0120dp", "[", "0", "][", "i", "]", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_right", "(X", ",", "\u0120x", "+l", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(U", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[k", "+", "1", "][", "i", "]", "\u0120=", "\u0120dp", "[k", "][", "dp", "[k", "][", "i", "]]\u010a\u010a", "def", "\u0120test", "(x", ",", "\u0120a", ",", "\u0120b", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(U", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120>>", "\u0120i", "\u0120&", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120dp", "[i", "][", "a", "]\u010a\u010a", "\u0120", "\u0120return", "\u0120a", "\u0120>=", "\u0120b", "\u010a\u010a", "def", "\u0120solve", "(a", ",", "\u0120b", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120a", "\u0120>", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120b", ",", "\u0120a", "\u010a\u010a", "\u0120", "\u0120ng", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120ok", "\u0120=", "\u0120n", "-", "1", "\u010a\u010a", "\u0120", "\u0120while", "\u0120ok", "\u0120-", "\u0120ng", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120mid", "\u0120=", "\u0120(", "ng", "\u0120+", "\u0120ok", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120test", "(mid", ",", "\u0120a", ",", "\u0120b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ok", "\u0120=", "\u0120mid", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ng", "\u0120=", "\u0120mid", "\u010a\u010a", "\u0120", "\u0120print", "(ok", ")\u010a\u010a", "q", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(q", "):\u010a\u010a", "\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120a", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120b", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120solve", "(a", ",", "\u0120b", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p02994", "input": "n, like = list(map(int, input().split()))\n\n\n\narr = [like + i for i in range(n)]\n\n\n\narr.sort(key=lambda x:abs(x))\n\n\n\nprint((sum(arr[1:])))\n", "input_tokens": ["n", ",", "\u0120like", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "arr", "\u0120=", "\u0120[", "like", "\u0120+", "\u0120i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "arr", ".sort", "(key", "=lambda", "\u0120x", ":", "abs", "(x", "))", "\u010a\u010a\u010a\u010a", "print", "((", "sum", "(arr", "[", "1", ":]", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03371", "input": "A, B, C, X, Y = list(map(int, input().split()))\n\nans = float('inf')\n\nfor i in range(max(X,Y)+1):\n\n cost = 2 * C * i + max(0,X-i)*A +max(0,Y-i)*B\n\n ans = min(ans,cost)\n\nprint(ans)", "input_tokens": ["A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(max", "(X", ",Y", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cost", "\u0120=", "\u0120", "2", "\u0120*", "\u0120C", "\u0120*", "\u0120i", "\u0120+", "\u0120max", "(", "0", ",X", "-i", ")*", "A", "\u0120+", "max", "(", "0", ",Y", "-i", ")*", "B", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",c", "ost", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03828", "input": "#coding: UTF-8\n\nimport math\n\nN=int(input())\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N):\n\n plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k/(i+1)\n\n lis[i]=n\n\n return lis\n\nout_lis=[0]*N\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\nprint((out%1000000007))", "input_tokens": ["#", "coding", ":", "\u0120UTF", "-", "8", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "N", "=int", "(input", "())\u010a\u010a", "def", "\u0120prime", "_list", "(k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120lis", "=[", "True", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",k", "+", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120lis", "[", "0", "]=", "False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "=", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120j", "*j", "<=", "i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "%", "j", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120lis", "[i", "-", "1", "]=", "False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "+=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120lis", "\u010a\u010a", "#", "\u0120\u0120\u0120", "\u0120print", "(l", "is", ")\u010a\u010a", "def", "\u0120p", "_fact", "(k", ",N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120plist", "=", "prime", "_list", "(k", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120lis", "=[", "0", "]*", "N", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120plist", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120k", "%(", "i", "+", "1", ")==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "+=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "=k", "/(", "i", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120lis", "[i", "]=", "n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120lis", "\u010a\u010a", "out", "_l", "is", "=[", "0", "]*", "N", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "_l", "is", "=p", "_fact", "(i", ",N", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120out", "_l", "is", "=[", "out", "_l", "is", "[j", "]+", "input", "_l", "is", "[j", "]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "0", ",N", ")]\u010a\u010a", "#print", "(out", "_l", "is", ")\u010a\u010a", "out", "=", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120out", "=out", "*(", "out", "_l", "is", "[i", "]+", "1", ")\u010a\u010a", "print", "((", "out", "%", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))"], "input_token_weights": [0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p02245", "input": "import sys\n\nimport queue\n\n\n\nN = 3\n\nf= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = queue.Queue()\n\nV = dict()\n\n\n\nQ.put([f,f.index('0'),0])\n\nV[f] = True\n\n\n\nwhile not Q.empty():\n\n u = Q.get()\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]//N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 \n\n Q.put(v)\n\n\n\nprint((u[2]))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "import", "\u0120queue", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120", "3", "\u010a\u010a", "f", "=", "\u0120''.", "join", "(sys", ".stdin", ".readline", "().", "split", "())\u010a\u010a", "f", "+=", "\u0120''.", "join", "(sys", ".stdin", ".readline", "().", "split", "())\u010a\u010a", "f", "+=", "\u0120''.", "join", "(sys", ".stdin", ".readline", "().", "split", "())\u010a\u010a", "\u010a\u010a", "dd", "\u0120=", "\u0120[[", "-", "1", ",", "\u0120", "0", "],", "\u0120[", "0", ",", "\u0120-", "1", "],", "\u0120[", "1", ",", "\u0120", "0", "],", "\u0120[", "0", ",", "\u0120", "1", "]]", "\u010a\u010a\u010a\u010a", "Q", "\u0120=", "\u0120queue", ".Queue", "()\u010a\u010a", "V", "\u0120=", "\u0120dict", "()\u010a\u010a\u010a\u010a", "Q", ".put", "([", "f", ",f", ".index", "('", "0", "'),", "0", "])\u010a\u010a", "V", "[f", "]", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "while", "\u0120not", "\u0120Q", ".empty", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120u", "\u0120=", "\u0120Q", ".get", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120u", "[", "0", "]", "\u0120==", "\u0120'", "1", "2", "3", "4", "5", "6", "7", "8", "0", "':", "\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120sx", ",", "\u0120sy", "\u0120=", "\u0120u", "[", "1", "]", "//", "N", ",", "\u0120u", "[", "1", "]%", "N", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120dx", ",", "\u0120dy", "\u0120in", "\u0120dd", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tx", ",", "\u0120ty", "\u0120=", "\u0120sx", "+", "dx", ",", "\u0120sy", "+", "dy", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tx", "<", "0", "\u0120or", "\u0120ty", "<", "0", "\u0120or", "\u0120tx", ">=", "N", "\u0120or", "\u0120ty", ">=", "N", ":", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120u", "[:", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "1", ",", "\u0120n", "2", "\u0120=", "\u0120u", "[", "1", "],", "\u0120tx", "*N", "+", "ty", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[", "1", "]", "\u0120=", "\u0120n", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "1", ">n", "2", ":", "\u0120n", "1", ",", "\u0120n", "2", "\u0120=", "\u0120n", "2", ",", "\u0120n", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[", "0", "]", "\u0120=", "\u0120v", "[", "0", "][", "0", ":n", "1", "]+", "v", "[", "0", "][", "n", "2", "]+", "v", "[", "0", "][", "n", "1", "+", "1", ":n", "2", "]+", "v", "[", "0", "][", "n", "1", "]+", "v", "[", "0", "][", "n", "2", "+", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120V", ".get", "(v", "[", "0", "],", "\u0120False", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120V", "[v", "[", "0", "]]", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[", "2", "]", "\u0120+=", "\u0120", "1", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Q", ".put", "(v", ")\u010a\u010a\u010a\u010a", "print", "((", "u", "[", "2", "]))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.579389560544, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.9751689493474733, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.579389560544, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03854", "input": "def main():\n\n S = input()\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n # print(w1,w2,w3,w4)\n\n S = S[::-1]\n\n # print(S)\n\n\n\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n\n words = [w1, w2, w3, w4]\n\n T = ''\n\n while S != T:\n\n cand = []\n\n for w in words:\n\n new_t = T + w\n\n cand.append(new_t) \n\n # print('cand', cand)\n\n ans = False\n\n for c in cand:\n\n if c == S[:len(c)]:\n\n T = c\n\n ans = True\n\n\n\n if not ans:\n\n break\n\n\n\n if S == T:\n\n print('YES')\n\n else:\n\n print(\"NO\")\n\n\n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "1", "\u0120=", "\u0120'", "dream", "'", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "2", "\u0120=", "\u0120'", "dream", "er", "'", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "3", "\u0120=", "\u0120'", "erase", "'", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "4", "\u0120=", "\u0120'", "eras", "er", "'", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(w", "1", ",w", "2", ",w", "3", ",w", "4", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120S", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(S", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120words", "\u0120=", "\u0120['", "dream", "',", "\u0120'", "dream", "er", "',", "\u0120'", "erase", "',", "\u0120'", "eras", "er", "']\u010a\u010a", "\u0120\u0120\u0120", "\u0120words", "\u0120=", "\u0120[", "w", "1", ",", "\u0120w", "2", ",", "\u0120w", "3", ",", "\u0120w", "4", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120''\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120S", "\u0120!=", "\u0120T", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cand", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120w", "\u0120in", "\u0120words", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120new", "_t", "\u0120=", "\u0120T", "\u0120+", "\u0120w", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cand", ".append", "(new", "_t", ")", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120print", "('", "c", "and", "',", "\u0120cand", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120cand", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120c", "\u0120==", "\u0120S", "[:", "len", "(c", ")]", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120S", "\u0120==", "\u0120T", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "YES", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")\u010a\u010a", "\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03806", "input": "N,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\nmaxa = maxb = 0\n\nfor a,b,c in src:\n\n for ai in range(maxa,-1,-1):\n\n for bi in range(maxb,-1,-1):\n\n dp[ai+a][bi+b] = min(dp[ai+a][bi+b], dp[ai][bi] + c)\n\n maxa += a\n\n maxb += b\n\n\n\nans = INF\n\nfor i in range(1,401):\n\n if MA*i > 400 or MB*i > 400: break\n\n ans = min(ans, dp[MA*i][MB*i])\n\nprint((-1 if ans == INF else ans))", "input_tokens": ["N", ",", "MA", ",", "MB", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "src", "\u0120=", "\u0120[", "tuple", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "**", "9", "\u010a\u010a", "dp", "\u0120=", "\u0120[[", "INF", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "4", "0", "1", ")]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "0", "1", ")]\u010a\u010a", "dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "max", "a", "\u0120=", "\u0120max", "b", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120a", ",b", ",c", "\u0120in", "\u0120src", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120ai", "\u0120in", "\u0120range", "(max", "a", ",-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120bi", "\u0120in", "\u0120range", "(max", "b", ",-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[", "ai", "+a", "][", "bi", "+b", "]", "\u0120=", "\u0120min", "(dp", "[", "ai", "+a", "][", "bi", "+b", "],", "\u0120dp", "[", "ai", "][", "bi", "]", "\u0120+", "\u0120c", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "a", "\u0120+=", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "b", "\u0120+=", "\u0120b", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120INF", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "4", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120MA", "*i", "\u0120>", "\u0120", "4", "0", "0", "\u0120or", "\u0120MB", "*i", "\u0120>", "\u0120", "4", "0", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120dp", "[", "MA", "*i", "][", "MB", "*i", "])\u010a\u010a", "print", "((-", "1", "\u0120if", "\u0120ans", "\u0120==", "\u0120INF", "\u0120else", "\u0120ans", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03814", "input": "s = input()\n\na = s.find('A')\n\nz = s[::-1].find('Z')\n\nans = len(s)-a-z\n\n\n\nprint(ans)\n\n\n\n#print(*ans, sep='\\n')", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a", "a", "\u0120=", "\u0120s", ".find", "('", "A", "')\u010a\u010a", "z", "\u0120=", "\u0120s", "[::-", "1", "].", "find", "('", "Z", "')\u010a\u010a", "ans", "\u0120=", "\u0120len", "(s", ")-", "a", "-z", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a\u010a\u010a\u010a", "#print", "(*", "ans", ",", "\u0120sep", "='\\", "n", "')"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03494", "input": "_,t=open(0);n=eval(t.replace(' ','|'));print((len(bin(n&-n))-3))", "input_tokens": ["_,", "t", "=open", "(", "0", ");", "n", "=", "eval", "(t", ".replace", "('", "\u0120','", "|", "'));", "print", "((", "len", "(bin", "(n", "&", "-", "n", "))-", "3", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03309", "input": "import statistics\n\nN = int(input())\n\nA = [int(a)-i-1 for i,a in enumerate(input().split(),1)]\n\nb = statistics.median_low(A)\n\nc = statistics.median_high(A)\n\nd = sum([abs(x-b) for x in A])\n\ne = sum([abs(x-c) for x in A])\n\nprint((min(d,e)))", "input_tokens": ["import", "\u0120statistics", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(a", ")-", "i", "-", "1", "\u0120for", "\u0120i", ",a", "\u0120in", "\u0120enumerate", "(input", "().", "split", "(),", "1", ")]\u010a\u010a", "b", "\u0120=", "\u0120statistics", ".median", "_low", "(A", ")\u010a\u010a", "c", "\u0120=", "\u0120statistics", ".median", "_high", "(A", ")\u010a\u010a", "d", "\u0120=", "\u0120sum", "([", "abs", "(x", "-b", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120A", "])\u010a\u010a", "e", "\u0120=", "\u0120sum", "([", "abs", "(x", "-c", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120A", "])\u010a\u010a", "print", "((", "min", "(d", ",e", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03416", "input": "a,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n new = list(reversed(list(str(i))))\n\n if new == list(str(i)):\n\n c += 1\n\n \n\n \n\nprint(c)", "input_tokens": ["a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120", "\u0120new", "\u0120=", "\u0120list", "(re", "versed", "(list", "(str", "(i", "))))\u010a\u010a", "\u0120", "\u0120if", "\u0120new", "\u0120==", "\u0120list", "(str", "(i", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(c", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03013", "input": "import sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int,input().split()))\n\nhole = [0] * (N+1)\n\nfor i in range(M):\n\n hole[int(input())] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nif N == 2:\n\n if hole[1] == 1:\n\n print((1))\n\n exit()\n\n if hole[1] == 0:\n\n print((2))\n\n exit()\n\nflg_one = False\n\nflg_two = False\n\nfirst = 1\n\nsecond = 2\n\nif hole[1] == 1:\n\n first = 0\n\n second = 1\n\n flg_one = True\n\nif hole[2] == 1:\n\n first = 1\n\n second = 0\n\n flg_two = True\n\nif flg_one and flg_two:\n\n print((0))\n\n exit()\n\n\n\nfor i in range(3,N):\n\n if hole[i] == 1:\n\n first = second\n\n second = 0\n\n continue\n\n tmp = first + second\n\n tmp %= 1000000007\n\n first = second\n\n second = tmp\n\ntmp = first + second\n\ntmp %= 1000000007\n\nprint(tmp)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "hole", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "+", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120hole", "[int", "(input", "())", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120N", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120N", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120hole", "[", "1", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120hole", "[", "1", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "2", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "fl", "g", "_one", "\u0120=", "\u0120False", "\u010a\u010a", "fl", "g", "_two", "\u0120=", "\u0120False", "\u010a\u010a", "first", "\u0120=", "\u0120", "1", "\u010a\u010a", "second", "\u0120=", "\u0120", "2", "\u010a\u010a", "if", "\u0120hole", "[", "1", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120first", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120second", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120fl", "g", "_one", "\u0120=", "\u0120True", "\u010a\u010a", "if", "\u0120hole", "[", "2", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120first", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120second", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120fl", "g", "_two", "\u0120=", "\u0120True", "\u010a\u010a", "if", "\u0120fl", "g", "_one", "\u0120and", "\u0120fl", "g", "_two", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120hole", "[i", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120first", "\u0120=", "\u0120second", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120second", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120first", "\u0120+", "\u0120second", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120%=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120first", "\u0120=", "\u0120second", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120second", "\u0120=", "\u0120tmp", "\u010a\u010a", "tmp", "\u0120=", "\u0120first", "\u0120+", "\u0120second", "\u010a\u010a", "tmp", "\u0120%=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "print", "(tmp", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5700083567488032, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.981434755330334, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.6771609938949378, 0.6771609938949378, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5700083567488032, 0.5978920048953399, 0.5700083567488032, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346]} +{"problem_id": "p03558", "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n s = S()\n\n t = S()\n\n if s+t == t[::-1]+s[::-1]:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n\n\n#B\n\ndef B():\n\n n = I()\n\n for i in range(int(n**0.5)+2)[::-1]:\n\n if i*i <= n:\n\n print((i*i))\n\n quit()\n\n#C\n\ndef C():\n\n n = I()\n\n a = LI()\n\n b = LI()\n\n c = LI()\n\n q = [0 for i in range(n)]\n\n ans = 0\n\n a.sort()\n\n b.sort()\n\n c.sort()\n\n for i in range(n):\n\n j = bisect.bisect_left(a,b[i])\n\n q[i] = j\n\n for i in range(n-1):\n\n q[i+1] += q[i]\n\n q.insert(0,0)\n\n for i in range(n):\n\n j = bisect.bisect_left(b,c[i])\n\n ans += q[j]\n\n print(ans)\n\n#D\n\ndef D():\n\n def dijkstra():\n\n d = [float(\"inf\") for i in range(k)]\n\n q = [[0,1]]\n\n d[1] = 0\n\n while q:\n\n dx,x = heappop(q)\n\n for y,dy in v[x]:\n\n if d[y] > dx+dy:\n\n d[y] = dx+dy\n\n heappush(q,[d[y],y])\n\n print((d[0]+1))\n\n k = I()\n\n if k == 1:\n\n print((1))\n\n quit()\n\n v = [[] for i in range(k)]\n\n for i in range(1,k):\n\n v[i].append([(i+1)%k,1])\n\n v[i].append([i*10%k,0])\n\n dijkstra()\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n return\n\n\n\n#G\n\ndef G():\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n D()\n", "input_tokens": ["#!", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "import", "\u0120bis", "ect", "\u010a\u010a", "import", "\u0120random", "\u010a\u010a", "def", "\u0120LI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120I", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120LS", "():", "return", "\u0120list", "(map", "(list", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120S", "():", "\u0120return", "\u0120list", "(sys", ".stdin", ".readline", "())", "[:-", "1", "]\u010a\u010a", "def", "\u0120IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120S", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120SR", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a\u010a\u010a", "#", "A", "\u010a\u010a", "def", "\u0120A", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120S", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120S", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "+t", "\u0120==", "\u0120t", "[::-", "1", "]+", "s", "[::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "YES", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")\u010a\u010a", "\u010a\u010a", "#", "B", "\u010a\u010a", "def", "\u0120B", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(int", "(n", "**", "0", ".", "5", ")+", "2", ")[", "::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "*i", "\u0120<=", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "i", "*i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120quit", "()\u010a\u010a", "#", "C", "\u010a\u010a", "def", "\u0120C", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_left", "(a", ",b", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "[i", "]", "\u0120=", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "[i", "+", "1", "]", "\u0120+=", "\u0120q", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", ".insert", "(", "0", ",", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_left", "(b", ",c", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120q", "[j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "#", "D", "\u010a\u010a", "def", "\u0120D", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120di", "jk", "stra", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120[", "float", "(\"", "inf", "\")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120[[", "0", ",", "1", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[", "1", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dx", ",x", "\u0120=", "\u0120he", "app", "op", "(q", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120y", ",", "dy", "\u0120in", "\u0120v", "[x", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[y", "]", "\u0120>", "\u0120dx", "+", "dy", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[y", "]", "\u0120=", "\u0120dx", "+", "dy", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120he", "app", "ush", "(q", ",[", "d", "[y", "],", "y", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "d", "[", "0", "]+", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120k", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120quit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[i", "].", "append", "([(", "i", "+", "1", ")%", "k", ",", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[i", "].", "append", "([", "i", "*", "1", "0", "%", "k", ",", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120di", "jk", "stra", "()\u010a\u010a", "#", "E", "\u010a\u010a", "def", "\u0120E", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "F", "\u010a\u010a", "def", "\u0120F", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "G", "\u010a\u010a", "def", "\u0120G", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "H", "\u010a\u010a", "def", "\u0120H", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "S", "olve", "\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120D", "()\u010a"], "input_token_weights": [0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03796", "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "x", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(x", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p02596", "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k//7 if k % 7 == 0 else k)\n\n if l % 2 == 0 or l % 5 == 0:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(-pow(l, 1/2))):\n\n if r % i == 0:\n\n phi = phi//i*(i-1)\n\n while r % i:\n\n r //= i\n\n\n\n a = 10 % l\n\n ret = 1\n\n while(a != 1):\n\n a = a*10 % l\n\n ret += 1\n\n if phi < ret:\n\n ret = -1\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "input_tokens": ["#", "\u0120coding", ":", "\u0120utf", "-", "8", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "(*", "args", ":", "\u0120str", ")", "\u0120->", "\u0120str", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120int", "(args", "[", "0", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120", "9", "*(", "k", "//", "7", "\u0120if", "\u0120k", "\u0120%", "\u0120", "7", "\u0120==", "\u0120", "0", "\u0120else", "\u0120k", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", "\u0120or", "\u0120l", "\u0120%", "\u0120", "5", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120'-", "1", "'\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120phi", "\u0120=", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",", "\u0120int", "(-", "pow", "(l", ",", "\u0120", "1", "/", "2", ")))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120phi", "\u0120=", "\u0120phi", "//", "i", "*(", "i", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120r", "\u0120%", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120//=", "\u0120i", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120", "1", "0", "\u0120%", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "(a", "\u0120!=", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120a", "*", "1", "0", "\u0120%", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120phi", "\u0120<", "\u0120ret", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120str", "(ret", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "solve", "(*(", "open", "(", "0", ").", "read", "().", "split", "lines", "()))", "))\u010a"], "input_token_weights": [0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03013", "input": "import sys\n\nsys.setrecursionlimit(100000)\n\n\n\ndef intinput(): return list(map(int,sys.stdin.readline().split()))\n\n\n\nfib={0:0,1:1,2:1}\n\nfor i in range(3,100003):\n\n fib[i]=fib[i-1]+fib[i-2]\n\n # fib.append(fib[i-1]+fib[i-2])\n\n\n\nn,m=intinput()\n\nmod=10**9+7\n\na=[int(sys.stdin.readline()) for _ in range(m)]\n\nif m!=0:\n\n l=[a[0]]\n\n for i in range(len(a)-1):\n\n l.append(a[i+1]-a[i]-1)\n\n l.append(n-a[-1])\n\n k=1\n\n for i in l:\n\n k=fib[i]*k%mod\n\n print((k%mod))\n\nelse:\n\n print((fib[n+1]%mod))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", ")\u010a\u010a\u010a\u010a", "def", "\u0120int", "input", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "sys", ".stdin", ".readline", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "fib", "={", "0", ":", "0", ",", "1", ":", "1", ",", "2", ":", "1", "}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",", "1", "0", "0", "0", "0", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fib", "[i", "]=", "fib", "[i", "-", "1", "]+", "fib", "[i", "-", "2", "]\u010a\u010a", "\u0120", "\u0120#", "\u0120", "\u0120fib", ".append", "(f", "ib", "[i", "-", "1", "]+", "fib", "[i", "-", "2", "])\u010a\u010a", "\u010a\u010a", "n", ",m", "=int", "input", "()\u010a\u010a", "mod", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "a", "=[", "int", "(sys", ".stdin", ".readline", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(m", ")]\u010a\u010a", "if", "\u0120m", "!=", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "=[", "a", "[", "0", "]]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(a", ")-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", ".append", "(a", "[i", "+", "1", "]-", "a", "[i", "]-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ".append", "(n", "-a", "[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "=f", "ib", "[i", "]*", "k", "%", "mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "k", "%", "mod", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "fib", "[n", "+", "1", "]%", "mod", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p02767", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nanswer = 10 ** 9\n\nfor i in range(1,101):\n\n tmp = 0\n\n for a in A:\n\n tmp += abs(a-i) ** 2\n\n answer = min(answer,tmp)\n\nprint(answer)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "answer", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "1", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120abs", "(a", "-i", ")", "\u0120**", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120answer", "\u0120=", "\u0120min", "(answer", ",tmp", ")\u010a\u010a", "print", "(answer", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02850", "input": "\"\"\"\n\nchallenge case\n\n\n\nin:\n\n3\n\n1 3\n\n2 3\n\n\n\nout:\n\n1\n\n1\n\n1\n\n\"\"\"\n\n\n\nfrom collections import deque\n\n\n\ndef main():\n\n\tN, *AB = list(map(int, open(0).read().split()))\n\n\tB = AB[1::2]\n\n\n\n\tE = [[] for _ in range(N + 1)]\n\n\tfor a, b in zip(*[iter(AB)] * 2):\n\n\t\tE[a] += b,\n\n\n\n\tQ = deque([1])\n\n\tC = [0] * (N + 1)\n\n\twhile Q:\n\n\t\tv = Q.popleft()\n\n\t\tc = 0\n\n\t\tfor u in E[v]:\n\n\t\t\tc += 1 + (c + 1 == C[v])\n\n\t\t\tC[u] = c\n\n\t\t\tQ += u,\n\n\n\n\tprint((max(C)))\n\n\tfor b in B:\n\n\t\tprint((C[b]))\n\n\n\nmain()", "input_tokens": ["\"\"\"\u010a\u010a", "challenge", "\u0120case", "\u010a\u010a\u010a\u010a", "in", ":\u010a\u010a", "3", "\u010a\u010a", "1", "\u0120", "3", "\u010a\u010a", "2", "\u0120", "3", "\u010a\u010a\u010a\u010a", "out", ":\u010a\u010a", "1", "\u010a\u010a", "1", "\u010a\u010a", "1", "\u010a\u010a", "\"\"\"", "\u010a\u010a\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0109N", ",", "\u0120*", "AB", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))\u010a\u010a", "\u0109B", "\u0120=", "\u0120AB", "[", "1", "::", "2", "]\u010a\u010a\u010a\u010a", "\u0109E", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "\u0120+", "\u0120", "1", ")]\u010a\u010a", "\u0109for", "\u0120a", ",", "\u0120b", "\u0120in", "\u0120zip", "(*", "[", "iter", "(", "AB", ")]", "\u0120*", "\u0120", "2", "):\u010a\u010a", "\u0109", "\u0109E", "[a", "]", "\u0120+=", "\u0120b", ",\u010a\u010a\u010a\u010a", "\u0109Q", "\u0120=", "\u0120deque", "([", "1", "])\u010a\u010a", "\u0109C", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0109while", "\u0120Q", ":\u010a\u010a", "\u0109", "\u0109v", "\u0120=", "\u0120Q", ".p", "opleft", "()\u010a\u010a", "\u0109", "\u0109c", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0109", "\u0109for", "\u0120u", "\u0120in", "\u0120E", "[v", "]:\u010a\u010a", "\u0109\u0109", "\u0109c", "\u0120+=", "\u0120", "1", "\u0120+", "\u0120(", "c", "\u0120+", "\u0120", "1", "\u0120==", "\u0120C", "[v", "])\u010a\u010a", "\u0109\u0109", "\u0109C", "[u", "]", "\u0120=", "\u0120c", "\u010a\u010a", "\u0109\u0109", "\u0109Q", "\u0120+=", "\u0120u", ",\u010a\u010a\u010a\u010a", "\u0109print", "((", "max", "(C", ")))\u010a\u010a", "\u0109for", "\u0120b", "\u0120in", "\u0120B", ":\u010a\u010a", "\u0109", "\u0109print", "((", "C", "[b", "]))", "\u010a\u010a\u010a\u010a", "main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03253", "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\nfrom collections import defaultdict\n\nimport copy\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n d = defaultdict(int)\n\n MOD = 10**9+7\n\n R = 10**5+100\n\n fac = [0 for _ in range(R+1)]\n\n fac[0],fac[1] = 1,1\n\n inv = copy.deepcopy(fac)\n\n invfac = copy.deepcopy(fac)\n\n \n\n for i in range(2,R+1):\n\n fac[i] = (fac[i-1]*i)%MOD\n\n inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD\n\n invfac[i] = (invfac[i-1]*inv[i])%MOD\n\n \n\n def coef(x,y):\n\n num = (((fac[x+y]*invfac[y])%MOD)*invfac[x]%MOD)\n\n return num\n\n\n\n while M%2 == 0:\n\n d[2] += 1\n\n M //= 2\n\n f = 3\n\n while f ** 2 <= M:\n\n if M % f == 0:\n\n d[f] += 1\n\n M //= f\n\n else:\n\n f += 2\n\n if M != 1:\n\n d[M] += 1\n\n \n\n l = list(d.values())\n\n ans = 1\n\n for num in l:\n\n ans *= coef(num,N-1)\n\n ans %= MOD\n\n \n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "import", "\u0120copy", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120MOD", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", "\u0120=", "\u0120", "1", "0", "**", "5", "+", "1", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120fac", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(R", "+", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120fac", "[", "0", "],", "fac", "[", "1", "]", "\u0120=", "\u0120", "1", ",", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "\u0120=", "\u0120copy", ".deepcopy", "(f", "ac", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "fac", "\u0120=", "\u0120copy", ".deepcopy", "(f", "ac", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",R", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fac", "[i", "]", "\u0120=", "\u0120(", "fac", "[i", "-", "1", "]*", "i", ")%", "MOD", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inv", "[i", "]", "\u0120=", "\u0120MOD", "-(", "MOD", "//", "i", ")*", "inv", "[", "MOD", "%i", "]%", "MOD", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inv", "fac", "[i", "]", "\u0120=", "\u0120(", "inv", "fac", "[i", "-", "1", "]*", "inv", "[i", "])", "%", "MOD", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120coef", "(x", ",y", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120(((", "fac", "[x", "+y", "]*", "inv", "fac", "[y", "])", "%", "MOD", ")*", "inv", "fac", "[x", "]%", "MOD", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120num", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120M", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[", "2", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120M", "\u0120//=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120f", "\u0120**", "\u0120", "2", "\u0120<=", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120M", "\u0120%", "\u0120f", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[f", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120M", "\u0120//=", "\u0120f", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120+=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120M", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[M", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120list", "(d", ".values", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120num", "\u0120in", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120*=", "\u0120coef", "(num", ",N", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120%=", "\u0120MOD", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03107", "input": "from collections import Counter\n\nd={chr(i):0 for i in range(2)}\n\ns=Counter(input())\n\nd=d.update(s)\n\nprint((min(s[\"0\"],s[\"1\"])*2))", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "d", "={", "chr", "(i", "):", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ")}\u010a\u010a", "s", "=", "Counter", "(input", "())\u010a\u010a", "d", "=d", ".update", "(s", ")\u010a\u010a", "print", "((", "min", "(s", "[\"", "0", "\"],", "s", "[\"", "1", "\"]", ")*", "2", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p00145", "input": "from functools import reduce\ndef f(a,b): return [Card[a][0], Card[b][1]]\n\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, f(j, k) + f(k+1, a)) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])", "input_tokens": ["from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a", "def", "\u0120f", "(a", ",b", "):", "\u0120return", "\u0120[", "Card", "[a", "][", "0", "],", "\u0120Card", "[b", "][", "1", "]]\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "Card", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120[", "0", "]*", "n", "]\u010a\u010a", "Cost", "\u0120=", "\u0120{}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120Card", "[i", "]", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120Cost", "[(", "i", ",", "\u0120i", ")]", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "0", ",", "\u0120n", "-i", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120j", "+i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120Cost", "[(", "j", ",", "\u0120a", ")]", "\u0120=", "\u0120min", "([", "reduce", "(lambda", "\u0120a", ",b", ":", "\u0120a", "*b", ",", "\u0120f", "(j", ",", "\u0120k", ")", "\u0120+", "\u0120f", "(k", "+", "1", ",", "\u0120a", "))", "\u0120+", "\u0120Cost", "[(", "j", ",", "\u0120k", ")]", "\u0120+", "\u0120Cost", "[(", "k", "+", "1", ",", "\u0120a", ")]", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(j", ",", "\u0120j", "+i", ")])\u010a\u010a", "print", "(C", "ost", "[", "0", ",", "\u0120n", "-", "1", "])"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03039", "input": "def cmb(n, r, mod):\n\n if ( r<0 or r>n ):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\nA=2*10**5\n\nmod = 10**9+7\n\ng1 = [1, 1]\n\ng2 = [1, 1]\n\ninverse = [0, 1]\n\n\n\nfor i in range( 2, A + 1 ):\n\n g1.append( ( g1[-1] * i ) % mod )\n\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=cmb(N*M-2,K-2,mod)\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nprint(((keisuu * (sum_//2))%mod))", "input_tokens": ["def", "\u0120cmb", "(n", ",", "\u0120r", ",", "\u0120mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "\u0120r", "<", "0", "\u0120or", "\u0120r", ">n", "\u0120):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120min", "(r", ",", "\u0120n", "-r", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120g", "1", "[n", "]", "\u0120*", "\u0120g", "2", "[r", "]", "\u0120*", "\u0120g", "2", "[n", "-r", "]", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "A", "=", "2", "*", "1", "0", "**", "5", "\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "g", "1", "\u0120=", "\u0120[", "1", ",", "\u0120", "1", "]\u010a\u010a", "g", "2", "\u0120=", "\u0120[", "1", ",", "\u0120", "1", "]\u010a\u010a", "inverse", "\u0120=", "\u0120[", "0", ",", "\u0120", "1", "]\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "\u0120", "2", ",", "\u0120A", "\u0120+", "\u0120", "1", "\u0120):\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "1", ".append", "(", "\u0120(", "\u0120g", "1", "[-", "1", "]", "\u0120*", "\u0120i", "\u0120)", "\u0120%", "\u0120mod", "\u0120)\u010a\u010a", "\u0120\u0120\u0120", "\u0120inverse", ".append", "(", "\u0120(", "\u0120-", "inverse", "[", "mod", "\u0120%", "\u0120i", "]", "\u0120*", "\u0120(", "mod", "//", "i", ")", "\u0120)", "\u0120%", "\u0120mod", "\u0120)\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "2", ".append", "(", "\u0120(", "g", "2", "[-", "1", "]", "\u0120*", "\u0120inverse", "[-", "1", "])", "\u0120%", "\u0120mod", "\u0120)\u010a\u010a", "\u010a\u010a", "N", ",M", ",K", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ke", "is", "uu", "=c", "mb", "(N", "*M", "-", "2", ",K", "-", "2", ",", "mod", ")\u010a\u010a\u010a\u010a", "sum", "_=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=min", "(abs", "(i", "),", "abs", "(N", "-i", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=max", "(abs", "(i", "),", "abs", "(N", "-i", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "_", "+=(", "M", "**", "2", ")*", "((", "a", "*(", "a", "+", "1", ")//", "2", ")+(", "b", "*(", "b", "+", "1", ")//", "2", "))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=min", "(abs", "(i", "),", "abs", "(M", "-i", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=max", "(abs", "(i", "),", "abs", "(M", "-i", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "_", "+=(", "N", "**", "2", ")*", "((", "a", "*(", "a", "+", "1", ")//", "2", ")+(", "b", "*(", "b", "+", "1", ")//", "2", "))\u010a\u010a", "print", "(((", "ke", "is", "uu", "\u0120*", "\u0120(", "sum", "_", "//", "2", "))", "%", "mod", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.6211886504852411, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6211886504852411, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.6211886504852411, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742]} +{"problem_id": "p02725", "input": "k,n = list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\nlongd=0\n\nfor i in range(n):\n\n tmp=abs(a[i+1]-a[i])\n\n longd=max(longd,tmp)\n\nprint((k-longd))", "input_tokens": ["k", ",n", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", ".append", "(a", "[", "0", "]+", "k", ")\u010a\u010a", "long", "d", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "=", "abs", "(a", "[i", "+", "1", "]-", "a", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120long", "d", "=max", "(long", "d", ",tmp", ")\u010a\u010a", "print", "((", "k", "-long", "d", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02886", "input": "def ii():return int(input())\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nans = 0\n\nfor i in range(n):\n\n for j in range(i+1,n):\n\n# print(i,j)\n\n ans += D[i]*D[j] \n\nprint(ans)", "input_tokens": ["def", "\u0120ii", "():", "return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120i", "im", "():", "return", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "def", "\u0120i", "il", "():", "return", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "def", "\u0120is", "m", "():", "return", "\u0120list", "(map", "(str", ",input", "().", "split", "()))\u010a\u010a", "def", "\u0120isl", "():", "return", "\u0120list", "(map", "(str", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120ii", "()\u010a\u010a", "D", "\u0120=", "\u0120i", "il", "()\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",n", "):\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(i", ",j", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120D", "[i", "]*", "D", "[j", "]", "\u0120\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p03353", "input": "S = input()\n\nK = int(input())\n\na = list(set(S))\n\na.sort()\n\n\n\nk = []\n\nl = 0\n\nwhile l < len(a):\n\n for i in range(len(S)):\n\n if S[i] == a[l]:\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n k.append(S[i:i+j])\n\n else:\n\n break\n\n l += 1\n\n\n\nk = list(set(k))\n\nk.sort()\n\nprint((k[K-1]))", "input_tokens": ["S", "\u0120=", "\u0120input", "()\u010a\u010a", "K", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(set", "(S", "))\u010a\u010a", "a", ".sort", "()\u010a\u010a\u010a\u010a", "k", "\u0120=", "\u0120[]\u010a\u010a", "l", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120l", "\u0120<", "\u0120len", "(a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", "]", "\u0120==", "\u0120a", "[l", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "6", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "+j", "\u0120<=", "\u0120len", "(S", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", ".append", "(S", "[i", ":i", "+j", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "k", "\u0120=", "\u0120list", "(set", "(k", "))\u010a\u010a", "k", ".sort", "()\u010a\u010a", "print", "((", "k", "[K", "-", "1", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293]} +{"problem_id": "p02702", "input": "s = input()[::-1]\n\nl = len(s)\n\nc = [0] * 2019\n\nc[0] = 1\n\nten = 1\n\nmod = 0\n\nans = 0\n\n\n\nfor i in range(l):\n\n mod = (mod + int(s[i]) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) // 2\n\n\n\nprint(ans)", "input_tokens": ["s", "\u0120=", "\u0120input", "()[", "::-", "1", "]\u010a\u010a", "l", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "c", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "c", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "ten", "\u0120=", "\u0120", "1", "\u010a\u010a", "mod", "\u0120=", "\u0120", "0", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(l", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120(", "mod", "\u0120+", "\u0120int", "(s", "[i", "])", "\u0120*", "\u0120ten", ")", "\u0120%", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ten", "\u0120=", "\u0120ten", "\u0120*", "\u0120", "1", "0", "\u0120%", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "[", "mod", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120i", "\u0120*", "\u0120(", "i", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229]} +{"problem_id": "p03814", "input": "S=input()\n\nprint((S.rfind('Z')-S.find('A')+1))", "input_tokens": ["S", "=input", "()\u010a\u010a", "print", "((", "S", ".r", "find", "('", "Z", "')", "-", "S", ".find", "('", "A", "')+", "1", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03371", "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LS()\n\n return l\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n return\n\n\n\n#B\n\ndef B():\n\n return\n\n\n\n#C\n\ndef C():\n\n return\n\n\n\n#D\n\ndef D():\n\n return\n\n\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n a,b,c,X,Y = LI()\n\n ans = float(\"inf\")\n\n for z in range(300001):\n\n if z%2 == 0:\n\n m = c*z\n\n x = z//2\n\n y = z//2\n\n m += a*max(0,X-x)\n\n m += b*max(0,Y-y)\n\n if m < ans:\n\n ans = m\n\n print(ans)\n\n return\n\n\n\n#G\n\ndef G():\n\n n = I()\n\n x = LI()\n\n f = [(i,x[i]) for i in range(n)]\n\n f.sort(key = lambda x:x[1])\n\n g = [(f[i][0],i) for i in range(n)]\n\n g.sort(key = lambda x:x[0])\n\n for i in range(n):\n\n if g[i][1] < n//2:\n\n print((f[n//2][1]))\n\n else:\n\n print((f[n//2-1][1]))\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#I\n\ndef I_():\n\n return\n\n\n\n#J\n\ndef J():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n F()\n", "input_tokens": ["#!", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "import", "\u0120bis", "ect", "\u010a\u010a", "import", "\u0120random", "\u010a\u010a", "def", "\u0120LI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120I", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120LS", "():", "return", "\u0120list", "(map", "(list", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120S", "():", "\u0120return", "\u0120list", "(sys", ".stdin", ".readline", "())", "[:-", "1", "]\u010a\u010a", "def", "\u0120IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120S", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120LS", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", "0", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a\u010a\u010a", "#", "A", "\u010a\u010a", "def", "\u0120A", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "B", "\u010a\u010a", "def", "\u0120B", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "C", "\u010a\u010a", "def", "\u0120C", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "D", "\u010a\u010a", "def", "\u0120D", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "E", "\u010a\u010a", "def", "\u0120E", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "F", "\u010a\u010a", "def", "\u0120F", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", ",X", ",Y", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120z", "\u0120in", "\u0120range", "(", "3", "0", "0", "0", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120z", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120c", "*z", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120z", "//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120=", "\u0120z", "//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", "\u0120+=", "\u0120a", "*", "max", "(", "0", ",X", "-x", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", "\u0120+=", "\u0120b", "*", "max", "(", "0", ",Y", "-y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120m", "\u0120<", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "G", "\u010a\u010a", "def", "\u0120G", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120[(", "i", ",x", "[i", "])", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", ".sort", "(key", "\u0120=", "\u0120lambda", "\u0120x", ":x", "[", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "\u0120=", "\u0120[(", "f", "[i", "][", "0", "],", "i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", ".sort", "(key", "\u0120=", "\u0120lambda", "\u0120x", ":x", "[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120g", "[i", "][", "1", "]", "\u0120<", "\u0120n", "//", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "f", "[n", "//", "2", "][", "1", "]))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "f", "[n", "//", "2", "-", "1", "][", "1", "]))\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "H", "\u010a\u010a", "def", "\u0120H", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "I", "\u010a\u010a", "def", "\u0120I", "_", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "J", "\u010a\u010a", "def", "\u0120J", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "S", "olve", "\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120F", "()\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02612", "input": "n = int(input()) % 1000\n\nif n == 0:\n\n print((0))\n\nelse:\n\n print((1000 - n))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())", "\u0120%", "\u0120", "1", "0", "0", "0", "\u010a\u010a", "if", "\u0120n", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "1", "0", "0", "0", "\u0120-", "\u0120n", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02983", "input": "L ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nif R - L <= 2019:\n\n for i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n\n\nelse:\n\n for i in range(R-L-1010,R-L+1010):\n\n for j in range(i,R-L+1010):\n\n ans.append(i*j%2019)\n\n\n\nprint((min(ans)))\n", "input_tokens": ["L", "\u0120,", "R", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "[]", "\u010a\u010a", "if", "\u0120R", "\u0120-", "\u0120L", "\u0120<=", "\u0120", "2", "0", "1", "9", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(L", ",R", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",R", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", ".append", "(i", "*j", "%", "2", "0", "1", "9", ")\u010a\u010a\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(R", "-L", "-", "1", "0", "1", "0", ",R", "-L", "+", "1", "0", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", ",R", "-L", "+", "1", "0", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", ".append", "(i", "*j", "%", "2", "0", "1", "9", ")\u010a\u010a\u010a\u010a", "print", "((", "min", "(ans", ")))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02773", "input": "from collections import Counter\n\nimport heapq\n\n\n\nn = int(input())\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\nheap = [(-v, k) for k, v in list(ctr.items())]\n\nheapq.heapify(heap)\n\nmaxv = heap[0][0]\n\nwhile heap:\n\n c = heapq.heappop(heap)\n\n if c[0] != maxv:\n\n break\n\n print((c[1]))\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "import", "\u0120heapq", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ss", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ss", ".append", "(input", "().", "rstrip", "())\u010a\u010a", "ctr", "\u0120=", "\u0120Counter", "(ss", ")\u010a\u010a", "heap", "\u0120=", "\u0120[", "(-", "v", ",", "\u0120k", ")", "\u0120for", "\u0120k", ",", "\u0120v", "\u0120in", "\u0120list", "(", "ctr", ".items", "())", "]\u010a\u010a", "heap", "q", ".heap", "ify", "(heap", ")\u010a\u010a", "max", "v", "\u0120=", "\u0120heap", "[", "0", "][", "0", "]\u010a\u010a", "while", "\u0120heap", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120heapq", ".he", "app", "op", "(heap", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120c", "[", "0", "]", "\u0120!=", "\u0120max", "v", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "c", "[", "1", "]))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378]} +{"problem_id": "p03037", "input": "# -*- coding: utf-8 -*-\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nl = max(L)\n\nr = min(R)\n\n\n\nans = max(r - l + 1, 0)\n\n\n\nprint(ans)\n", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", ",", "\u0120R", "\u0120=", "\u0120[", "None", "]", "\u0120*", "\u0120M", ",", "\u0120[", "None", "]", "\u0120*", "\u0120M", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", "[i", "],", "\u0120R", "[i", "]", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120max", "(L", ")\u010a\u010a", "r", "\u0120=", "\u0120min", "(R", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120max", "(r", "\u0120-", "\u0120l", "\u0120+", "\u0120", "1", ",", "\u0120", "0", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02881", "input": "import math\n\ninput_num = int(input())\n\nnum_sqrt = int(math.sqrt(input_num))\n\n\n\nminimam = input_num\n\nfor i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n distance = q + i -2\n\n if mod == 0 and minimam > distance:\n\n minimam = distance\n\nprint(minimam)", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "input", "_num", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "num", "_sqrt", "\u0120=", "\u0120int", "(math", ".sqrt", "(input", "_num", "))", "\u010a\u010a\u010a\u010a", "min", "im", "am", "\u0120=", "\u0120input", "_num", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(num", "_sqrt", "+", "1", ",", "0", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", ",", "\u0120mod", "\u0120=", "\u0120div", "mod", "(input", "_num", ",", "\u0120i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120distance", "\u0120=", "\u0120q", "\u0120+", "\u0120i", "\u0120-", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120mod", "\u0120==", "\u0120", "0", "\u0120and", "\u0120minim", "am", "\u0120>", "\u0120distance", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120minim", "am", "\u0120=", "\u0120distance", "\u010a\u010a", "print", "(min", "im", "am", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6339004969859428, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02881", "input": "# C - Walk on Multiplication Table\n\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\n\n\n\nn = int(input())\n\n\n\nans = 10 ** 12\n\nfor i in range(1, 10 ** 6 + 1):\n\n if n % i == 0:\n\n ans = min(ans, n // i + i)\n\n\n\nprint((ans - 2))", "input_tokens": ["#", "\u0120C", "\u0120-", "\u0120Walk", "\u0120on", "\u0120Multip", "lication", "\u0120Table", "\u010a\u010a", "#", "\u0120https", "://", "at", "coder", ".jp", "/", "cont", "ests", "/", "abc", "1", "4", "4", "/tasks", "/", "abc", "1", "4", "4", "_c", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "1", "2", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "\u0120**", "\u0120", "6", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120n", "\u0120//", "\u0120i", "\u0120+", "\u0120i", ")\u010a\u010a\u010a\u010a", "print", "((", "ans", "\u0120-", "\u0120", "2", "))"], "input_token_weights": [0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497]} +{"problem_id": "p04020", "input": "# AGC003B - Simplified mahjong\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur // 2\n\n N = int(input())\n\n A = list(map(int, [input() for _ in range(N)])) + [0]\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur // 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["#", "\u0120AG", "C", "0", "0", "3", "B", "\u0120-", "\u0120Simpl", "ified", "\u0120mah", "jong", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120split", "\u0120in", "\u0120subsequ", "ences", "\u0120when", "\u0120", "0", "\u0120appears", "\u0120->", "\u0120sum", "\u0120up", "\u0120cur", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120[", "input", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "))", "\u0120+", "\u0120[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", ",", "\u0120cur", "\u0120=", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120+=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cur", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02412", "input": "while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for a in range(1, n + 1):\n\n for b in range(a + 1, n + 1):\n\n for c in range(b + 1, n + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)", "input_tokens": ["while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120(", "n", ",", "\u0120x", ")", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120x", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120b", "\u0120in", "\u0120range", "(a", "\u0120+", "\u0120", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120range", "(b", "\u0120+", "\u0120", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120sum", "([", "a", ",b", ",c", "])", "\u0120==", "\u0120x", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(count", ")"], "input_token_weights": [0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891]} +{"problem_id": "p02245", "input": "from collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n if MAP == goal:\n\n return 0\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n return cnt\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "N", "\u0120=", "\u0120", "3", "\u010a\u010a", "m", "\u0120=", "\u0120{", "8", ":", "\u0120{", "7", ",", "\u0120", "5", "},", "\u0120", "7", ":", "\u0120{", "8", ",", "\u0120", "6", ",", "\u0120", "4", "},", "\u0120", "6", ":", "\u0120{", "7", ",", "\u0120", "3", "},", "\u0120", "5", ":", "\u0120{", "8", ",", "\u0120", "4", ",", "\u0120", "2", "},", "\u0120", "4", ":", "\u0120{", "7", ",", "\u0120", "5", ",", "\u0120", "3", ",", "\u0120", "1", "},", "\u0120", "3", ":", "\u0120{", "6", ",", "\u0120", "4", ",", "\u0120", "0", "},", "\u0120", "2", ":", "\u0120{", "5", ",", "\u0120", "1", "},", "\u0120", "1", ":", "\u0120{", "4", ",", "\u0120", "2", ",", "\u0120", "0", "},\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120", "0", ":", "\u0120{", "3", ",", "\u0120", "1", "}}\u010a\u010a", "goal", "\u0120=", "\u0120", "1", "2", "3", "4", "5", "6", "7", "8", "0", "\u010a\u010a", "def", "\u0120g", "(i", ",", "\u0120j", ",", "\u0120a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120a", "\u0120//", "\u0120(", "1", "0", "\u0120**", "\u0120j", ")", "\u0120%", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120a", "\u0120-", "\u0120t", "\u0120*", "\u0120(", "1", "0", "\u0120**", "\u0120j", ")", "\u0120+", "\u0120t", "\u0120*", "\u0120(", "1", "0", "\u0120**", "\u0120i", ")\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120MAP", "\u0120=", "\u0120\"\".", "join", "(input", "().", "replace", "(\"", "\u0120\",", "\u0120\"\")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120", "8", "\u0120-", "\u0120MAP", ".find", "(\"", "0", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120MAP", "\u0120=", "\u0120int", "(M", "AP", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120MAP", "\u0120==", "\u0120goal", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120deque", "([(", "0", ",", "\u0120start", ",", "\u0120MAP", ")])\u010a\u010a", "\u0120\u0120\u0120", "\u0120LOG", "\u0120=", "\u0120{", "MAP", "}\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120dp", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", ",", "\u0120y", "x", ",", "\u0120M", "\u0120=", "\u0120dp", ".p", "opleft", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120M", "\u0120==", "\u0120goal", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120cnt", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120ny", "x", "\u0120in", "\u0120m", "[y", "x", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120CM", "\u0120=", "\u0120g", "(y", "x", ",", "\u0120ny", "x", ",", "\u0120M", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120CM", "\u0120in", "\u0120LOG", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", ".append", "((", "cnt", ",", "\u0120ny", "x", ",", "\u0120CM", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120LOG", ".add", "(C", "M", ")\u010a\u010a", "def", "\u0120MAIN", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "solve", "()))\u010a\u010a", "MAIN", "()\u010a\u010a\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03371", "input": "inf = (5000 * 10 ** 5) * 3\n\n\n\na, b, c, x, y = list(map(int, input().split()))\n\n\n\nret = inf\n\nfor cnt_ab in range(max(x, y) * 2 + 1):\n\n d = cnt_ab // 2\n\n\n\n cnt_a = max(0, x - d)\n\n cnt_b = max(0, y - d)\n\n\n\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n\n ret = min(ret, t)\n\nprint(ret)\n", "input_tokens": ["inf", "\u0120=", "\u0120(", "5", "0", "0", "0", "\u0120*", "\u0120", "1", "0", "\u0120**", "\u0120", "5", ")", "\u0120*", "\u0120", "3", "\u010a\u010a\u010a\u010a", "a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ret", "\u0120=", "\u0120inf", "\u010a\u010a", "for", "\u0120cnt", "_ab", "\u0120in", "\u0120range", "(max", "(x", ",", "\u0120y", ")", "\u0120*", "\u0120", "2", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120cnt", "_ab", "\u0120//", "\u0120", "2", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "_a", "\u0120=", "\u0120max", "(", "0", ",", "\u0120x", "\u0120-", "\u0120d", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "_b", "\u0120=", "\u0120max", "(", "0", ",", "\u0120y", "\u0120-", "\u0120d", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120cnt", "_ab", "\u0120*", "\u0120c", "\u0120+", "\u0120cnt", "_a", "\u0120*", "\u0120a", "\u0120+", "\u0120cnt", "_b", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120min", "(ret", ",", "\u0120t", ")\u010a\u010a", "print", "(ret", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02555", "input": "S = int(input())\n\nf = [0]*(S+1)\n\nf[0] = 1\n\nif S >= 3: f[3] = 1\n\nif S >= 4: f[4] = 1\n\nif S >= 5: f[5] = 1\n\nfor i in range(6, S+1):\n\n f[i] = sum(f[i-j] for j in range(3, i+1))%(10**9+7)\n\nprint((f[S]))\n", "input_tokens": ["S", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "f", "\u0120=", "\u0120[", "0", "]*(", "S", "+", "1", ")\u010a\u010a", "f", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120S", "\u0120>=", "\u0120", "3", ":", "\u0120f", "[", "3", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120S", "\u0120>=", "\u0120", "4", ":", "\u0120f", "[", "4", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120S", "\u0120>=", "\u0120", "5", ":", "\u0120f", "[", "5", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "6", ",", "\u0120S", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "[i", "]", "\u0120=", "\u0120sum", "(f", "[i", "-j", "]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", ",", "\u0120i", "+", "1", "))", "%(", "1", "0", "**", "9", "+", "7", ")\u010a\u010a", "print", "((", "f", "[S", "]))\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268]} +{"problem_id": "p03806", "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(400, -1, -1):\n\n for j in range(400, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, 401):\n\n for j in range(1, 401):\n\n if dp[i][j] != INF and i / j == Ma / Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120Ma", ",", "\u0120Mb", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ABC", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "1", "5", "\u010a\u010a", "dp", "\u0120=", "\u0120[[", "INF", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "4", "0", "1", ")]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "0", "1", ")]\u010a\u010a", "dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120ABC", ":\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "0", "0", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "4", "0", "0", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "][", "j", "]", "\u0120!=", "\u0120INF", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "\u0120+", "\u0120a", "][", "j", "\u0120+", "\u0120b", "]", "\u0120=", "\u0120min", "(dp", "[i", "\u0120+", "\u0120a", "][", "j", "\u0120+", "\u0120b", "],", "\u0120dp", "[i", "][", "j", "]", "\u0120+", "\u0120c", ")\u010a\u010a\u010a\u010a", "answer", "\u0120=", "\u0120INF", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "4", "0", "1", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "4", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "][", "j", "]", "\u0120!=", "\u0120INF", "\u0120and", "\u0120i", "\u0120/", "\u0120j", "\u0120==", "\u0120Ma", "\u0120/", "\u0120Mb", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120answer", "\u0120=", "\u0120min", "(answer", ",", "\u0120dp", "[i", "][", "j", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "((", "answer", "\u0120if", "\u0120answer", "\u0120!=", "\u0120INF", "\u0120else", "\u0120-", "1", "))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02555", "input": "from sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\nsetrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\t@lru_cache(None)\n\n\tdef dp(currsum):\n\n\t\tif currsum == s: return 1\n\n\t\tcnt = 0\n\n\t\tfor d in range(3, 2001):\n\n\t\t\tif currsum + d <= s:\n\n\t\t\t\tcnt += dp(currsum + d)\n\n\t\t\t\tcnt %= MOD \n\n\t\treturn cnt\n\n\tprint((dp(0)))\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "input_tokens": ["from", "\u0120sys", "\u0120import", "\u0120stdin", ",", "\u0120stdout", ",", "\u0120set", "rec", "ursion", "limit", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", ",", "\u0120defaultdict", ",", "\u0120Counter", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120l", "ru", "_cache", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a\u010a\u010a", "set", "rec", "ursion", "limit", "(", "1", "0", "**", "6", ")\u010a\u010a", "rl", "\u0120=", "\u0120lambda", ":", "\u0120stdin", ".readline", "()\u010a\u010a", "r", "ll", "\u0120=", "\u0120lambda", ":", "\u0120stdin", ".readline", "().", "split", "()\u010a\u010a", "r", "li", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(int", ",", "\u0120stdin", ".readline", "().", "split", "()))\u010a\u010a", "rl", "f", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(float", ",", "\u0120stdin", ".readline", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "INF", ",", "\u0120N", "INF", "\u0120=", "\u0120float", "('", "inf", "'),", "\u0120float", "('-", "inf", "')\u010a\u010a", "MOD", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0109s", "\u0120=", "\u0120int", "(", "rl", "())\u010a\u010a", "\u010a\u010a", "\u0109", "@", "l", "ru", "_cache", "(None", ")\u010a\u010a", "\u0109def", "\u0120dp", "(curr", "sum", "):\u010a\u010a", "\u0109", "\u0109if", "\u0120curr", "sum", "\u0120==", "\u0120s", ":", "\u0120return", "\u0120", "1", "\u010a\u010a", "\u0109", "\u0109cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0109", "\u0109for", "\u0120d", "\u0120in", "\u0120range", "(", "3", ",", "\u0120", "2", "0", "0", "1", "):\u010a\u010a", "\u0109\u0109", "\u0109if", "\u0120curr", "sum", "\u0120+", "\u0120d", "\u0120<=", "\u0120s", ":\u010a\u010a", "\u0109\u0109\u0109", "\u0109cnt", "\u0120+=", "\u0120dp", "(curr", "sum", "\u0120+", "\u0120d", ")\u010a\u010a", "\u0109\u0109\u0109", "\u0109cnt", "\u0120%=", "\u0120MOD", "\u0120\u010a\u010a", "\u0109", "\u0109return", "\u0120cnt", "\u010a\u010a", "\u0109print", "((", "dp", "(", "0", ")))\u010a\u010a", "\u0109std", "out", ".close", "()\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0109main", "()"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046]} +{"problem_id": "p03307", "input": "import math\n\nn=int(input())\n\nprint(((2*n)//math.gcd(2,n)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "print", "(((", "2", "*n", ")//", "math", ".g", "cd", "(", "2", ",n", ")))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.7967329450848046, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999]} +{"problem_id": "p03854", "input": "import sys\n\ns = input()\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n if s == t + w:\n\n print('YES')\n\n sys.exit()\n\n if s.startswith(t + w):\n\n nts.append(t + w)\n\n if len(nts) == 0:\n\n print('NO')\n\n sys.exit()\n\n ts = nts\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "s", "\u0120=", "\u0120input", "()\u010a\u010a", "ts", "\u0120=", "\u0120['", "']\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120", "\u0120n", "ts", "=", "\u0120[]\u010a\u010a", "\u0120", "\u0120for", "\u0120t", "\u0120in", "\u0120ts", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120w", "\u0120in", "\u0120['", "dream", "er", "',", "\u0120'", "eras", "er", "',", "\u0120'", "dream", "',", "\u0120'", "erase", "']", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120==", "\u0120t", "\u0120+", "\u0120w", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "YES", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", ".startswith", "(t", "\u0120+", "\u0120w", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "ts", ".append", "(t", "\u0120+", "\u0120w", ")\u010a\u010a", "\u0120", "\u0120if", "\u0120len", "(", "nts", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "NO", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a", "\u0120", "\u0120ts", "\u0120=", "\u0120n", "ts", "\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5978920048953399, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5978920048953399, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399]} +{"problem_id": "p02688", "input": "N,K=list(map(int,input().split()))\n\na = [[0]*N]*K\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(input())\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)", "input_tokens": ["N", ",K", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120[[", "0", "]*", "N", "]*", "K", "\u010a\u010a", "a", "\u0120=", "\u0120[[", "0", "\u0120for", "\u0120n", "\u0120in", "\u0120range", "(N", ")]", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(K", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "=int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120have", "_k", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120h", "\u0120in", "\u0120have", "_k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[k", "][", "h", "-", "1", "]=", "1", "\u010a\u010a\u010a\u010a", "an", "=[", "0", "]*", "N", "\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120n", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120an", "[n", "]", "\u0120=", "\u0120an", "[n", "]+", "a", "[k", "][", "n", "]\u010a\u010a\u010a\u010a", "result", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120an", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120result", "+=", "1", "\u010a\u010a\u010a\u010a", "print", "(result", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679]} +{"problem_id": "p03854", "input": "import sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = input()\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isDream #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n #print('d:', d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #; print(d, pout)\n\n if pout == len(S): \n\n isDream = True #; print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisDream = False\n\ndayDream(0)\n\nif isDream:\n\n print('YES')\n\nelse:\n\n print('NO')", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", "0", ")\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "T", "\u0120=", "\u0120['", "dream", "',", "\u0120'", "dream", "er", "',", "\u0120'", "erase", "',", "\u0120'", "eras", "er", "']\u010a\u010a", "len", "T", "\u0120=", "\u0120[", "len", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120T", "]\u010a\u010a\u010a\u010a", "def", "\u0120day", "Dream", "(pin", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120global", "\u0120is", "Dream", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", ";", "print", "('", "day", "Dream", ":", "\u0120',", "\u0120pin", ",", "\u0120S", "[p", "in", ":", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120d", "\u0120in", "\u0120enumerate", "(T", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "print", "('", "d", ":',", "\u0120d", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[p", "in", ":", "pin", "+len", "T", "[i", "]]", "\u0120==", "\u0120d", ":", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "out", "\u0120=", "\u0120pin", "\u0120+", "\u0120len", "T", "[i", "]", "\u0120#", ";", "\u0120print", "(d", ",", "\u0120p", "out", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120p", "out", "\u0120==", "\u0120len", "(S", "):", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120is", "Dream", "\u0120=", "\u0120True", "\u0120\u0120", "\u0120#", ";", "\u0120print", "('", "YES", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120day", "Dream", "(p", "out", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "print", "('", "day", "Dream", "\u0120return", "',", "\u0120pin", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "is", "Dream", "\u0120=", "\u0120False", "\u010a\u010a", "day", "Dream", "(", "0", ")\u010a\u010a", "if", "\u0120is", "Dream", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "YES", "')\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "NO", "')"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.6771609938949378, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6771609938949378, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03037", "input": "n,m=list(map(int,input().split()))\n\nc=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n c[l-1]+=1\n\n c[r]-=1\n\nfor i in range(1,n+2):\n\n c[i]=c[i]+c[i-1]\n\nans=0\n\nfor i in range(n+2):\n\n if c[i]==m:\n\n ans+=1\n\nprint(ans)", "input_tokens": ["n", ",m", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "c", "=[", "0", "]*(", "n", "+", "2", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120", "\u0120l", ",r", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120c", "[l", "-", "1", "]+=", "1", "\u010a\u010a", "\u0120", "\u0120c", "[r", "]-", "=", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "2", "):\u010a\u010a", "\u0120", "\u0120c", "[i", "]=", "c", "[i", "]+", "c", "[i", "-", "1", "]\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "2", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120c", "[i", "]==", "m", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986]} +{"problem_id": "p03287", "input": "n,m=list(map(int,input().split()))\n\na=[int(x) for x in input().split()]\n\nb=[0 for x in range(n+1)]\n\nl=list([0])\n\n\n\nfor i in range(1,n+1):\n\n b[i]=b[i-1]+a[i-1]\n\n\n\nfor i in range(1,n+1):\n\n l.append(b[i]%m)\n\n\n\nd=list()\n\nl.sort()\n\nt,c=0,1\n\nfor i in range(1,n+1):\n\n if l[i]==l[i-1]:\n\n c+=1\n\n else:\n\n if c!=1:\n\n t += c*(c-1)//2\n\n c=1\n\n\n\nif c!=1:\n\n t += c*(c-1)//2 \n\n\n\nprint(t)\n", "input_tokens": ["n", ",m", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "b", "=[", "0", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(n", "+", "1", ")]\u010a\u010a", "l", "=list", "([", "0", "])\u010a\u010a", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120b", "[i", "]=", "b", "[i", "-", "1", "]+", "a", "[i", "-", "1", "]\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120l", ".append", "(b", "[i", "]%", "m", ")\u010a\u010a\u010a\u010a", "d", "=list", "()\u010a\u010a", "l", ".sort", "()\u010a\u010a", "t", ",c", "=", "0", ",", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120l", "[i", "]==", "l", "[i", "-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "+=", "1", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120c", "!=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120c", "*(", "c", "-", "1", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120c", "=", "1", "\u010a\u010a\u010a\u010a", "if", "\u0120c", "!=", "1", ":\u010a\u010a", "\u0120", "\u0120t", "\u0120+=", "\u0120c", "*(", "c", "-", "1", ")//", "2", "\u0120\u0120", "\u010a\u010a\u010a\u010a", "print", "(t", ")\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.60398418480891, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.60398418480891, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.60398418480891, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.60398418480891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.60398418480891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795]} +{"problem_id": "p02850", "input": "import copy\n\n\n\nn=int(input())\n\norg_set=set([i for i in range(1,10**5)])\n\nedges=[]\n\nrelations={}\n\nnodes=[]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split(\" \")))\n\n edges.append([a,b])\n\n relations.setdefault(a,[]).append(b)\n\n nodes.append([])\n\nnodes.append([])\n\nnodes.append([])\n\n\n\nmax_color=0\n\nfor start in range(1,n+1):\n\n targets=relations.get(start,[])\n\n color=1\n\n for target in targets:\n\n if color in nodes[start]:\n\n color+=1\n\n else:\n\n pass\n\n nodes[target].append(color)\n\n if color>=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]][0]))", "input_tokens": ["import", "\u0120copy", "\u010a\u010a\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "org", "_set", "=set", "([", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "1", "0", "**", "5", ")])\u010a\u010a", "edges", "=[]", "\u010a\u010a", "relations", "={", "}\u010a\u010a", "nodes", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "=list", "(map", "(int", ",input", "().", "split", "(\"", "\u0120\"", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120edges", ".append", "([", "a", ",b", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120relations", ".setdefault", "(a", ",", "[]", ").", "append", "(b", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120nodes", ".append", "([]", ")\u010a\u010a", "nodes", ".append", "([]", ")\u010a\u010a", "nodes", ".append", "([]", ")\u010a\u010a\u010a\u010a", "max", "_color", "=", "0", "\u010a\u010a", "for", "\u0120start", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120targets", "=", "relations", ".get", "(start", ",", "[]", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120color", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120target", "\u0120in", "\u0120targets", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120color", "\u0120in", "\u0120nodes", "[start", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120color", "+=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pass", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nodes", "[target", "].", "append", "(color", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120color", ">=", "max", "_color", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_color", "=color", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120color", "+=", "1", "\u010a\u010a\u010a\u010a", "print", "(max", "_color", ")\u010a\u010a", "for", "\u0120edge", "\u0120in", "\u0120edges", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "nodes", "[edge", "[", "1", "]][", "0", "]))"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.5851191688414608, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.9712934633687245, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.5851191688414608, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643]} +{"problem_id": "p02691", "input": "n=int(input())\n\na=list(map(int,input().split()))\n\nk=[]\n\nans=0\n\nfor i in range(400005):\n\n k.append(0)\n\nfor i in range(n):\n\n if i-a[i]>=0:\n\n ans+=k[i-a[i]]\n\n if a[i]+i<400005:\n\n k[a[i]+i]+=1\n\nprint(ans)", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "a", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "k", "=[]", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "0", "0", "0", "0", "5", "):\u010a\u010a", "\u0120", "\u0120k", ".append", "(", "0", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "-a", "[i", "]>=", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "k", "[i", "-a", "[i", "]]\u010a\u010a", "\u0120", "\u0120if", "\u0120a", "[i", "]+", "i", "<", "4", "0", "0", "0", "0", "5", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "[a", "[i", "]+", "i", "]+=", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6115475853143139, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.6115475853143139, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.6115475853143139, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506]} +{"problem_id": "p02881", "input": "import sys\n\nimport os\n\nimport math\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n ret = float('inf')\n\n I = int(math.sqrt(N)) * 10\n\n for i in range(1, I):\n\n if N%i == 0:\n\n j = N//i\n\n ret = min(ret, j + i - 2)\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "import", "\u0120os", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a\u010a\u010a", "ii", "\u0120=", "\u0120lambda", ":", "\u0120int", "(sys", ".stdin", ".buffer", ".readline", "().", "rstrip", "())\u010a\u010a", "il", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".buffer", ".readline", "().", "split", "()))\u010a\u010a", "il", "n", "\u0120=", "\u0120lambda", "\u0120n", ":", "\u0120[", "int", "(sys", ".stdin", ".buffer", ".readline", "().", "rstrip", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "iss", "\u0120=", "\u0120lambda", ":", "\u0120sys", ".stdin", ".buffer", ".readline", "().", "decode", "().", "rstrip", "()\u010a\u010a", "is", "n", "\u0120=", "\u0120lambda", "\u0120n", ":", "\u0120[", "sys", ".stdin", ".buffer", ".readline", "().", "decode", "().", "rstrip", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120os", ".getenv", "(\"", "LOCAL", "\")", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".stdin", "\u0120=", "\u0120open", "(\"", "input", ".txt", "\",", "\u0120\"", "r", "\")\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120ii", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120I", "\u0120=", "\u0120int", "(math", ".sqrt", "(N", "))", "\u0120*", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120I", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120N", "%i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120N", "//", "i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120min", "(ret", ",", "\u0120j", "\u0120+", "\u0120i", "\u0120-", "\u0120", "2", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ret", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.6514299043837268, 0.9999999999999999, 0.9999999999999999, 0.9999999999999999, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497]} diff --git a/python_splits/test_input_verified_baseline_with_weights.jsonl b/python_splits/test_input_verified_baseline_with_weights.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..5979d5080fbb2295e2b90ab8bdb3664805961d0b --- /dev/null +++ b/python_splits/test_input_verified_baseline_with_weights.jsonl @@ -0,0 +1,569 @@ +{"problem_id": "p03371", "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 5000 * 2 * 10 ** 5\n\nfor i in range(10 ** 5 + 1):\n\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n\n ans = min(ans, s)\n\n\n\nprint(ans)", "input_tokens": ["A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "5", "0", "0", "0", "\u0120*", "\u0120", "2", "\u0120*", "\u0120", "1", "0", "\u0120**", "\u0120", "5", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "\u0120**", "\u0120", "5", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120i", "\u0120*", "\u0120", "2", "\u0120*", "\u0120C", "\u0120+", "\u0120max", "(", "0", ",", "\u0120X", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120A", "\u0120+", "\u0120max", "(", "0", ",", "\u0120Y", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120B", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120s", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02612", "input": "import sys\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(read())\n\nx = N + (-N) % 1000\n\nprint((x - N))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readlines", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(read", "())\u010a\u010a", "x", "\u0120=", "\u0120N", "\u0120+", "\u0120(-", "N", ")", "\u0120%", "\u0120", "1", "0", "0", "0", "\u010a\u010a", "print", "((", "x", "\u0120-", "\u0120N", "))"], "input_token_weights": [0.883057299767519, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.7967329450848046, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.7967329450848046, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.7967329450848046, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7022465694939416, 0.6514299043837268, 0.7022465694939416, 0.7506053018110229, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.8408263201236497, 0.7967329450848046, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046]} +{"problem_id": "p03078", "input": "# -*- coding: utf-8 -*-\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nabc = []\n\n\n\nfor i, _a in enumerate(a):\n\n for j, _b in enumerate(b):\n\n if (i+1) * (j+1) > k:\n\n break\n\n for l, _c in enumerate(c):\n\n if (i+1) * (j+1) * (l+1) > k:\n\n break\n\n abc.append(_a + _b + _c)\n\n\n\nabc.sort(reverse=True)\n\nfor x in abc[:k]:\n\n print(x)\n", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-\u010a\u010a", "x", ",", "\u0120y", ",", "\u0120z", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "a", ".sort", "(reverse", "=True", ")\u010a\u010a", "b", ".sort", "(reverse", "=True", ")\u010a\u010a", "c", ".sort", "(reverse", "=True", ")\u010a\u010a\u010a\u010a", "abc", "\u0120=", "\u0120[]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", ",", "\u0120_", "a", "\u0120in", "\u0120enumerate", "(a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", ",", "\u0120_", "b", "\u0120in", "\u0120enumerate", "(b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "+", "1", ")", "\u0120*", "\u0120(", "j", "+", "1", ")", "\u0120>", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120l", ",", "\u0120_", "c", "\u0120in", "\u0120enumerate", "(c", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "+", "1", ")", "\u0120*", "\u0120(", "j", "+", "1", ")", "\u0120*", "\u0120(", "l", "+", "1", ")", "\u0120>", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120abc", ".append", "(_", "a", "\u0120+", "\u0120_", "b", "\u0120+", "\u0120_", "c", ")\u010a\u010a\u010a\u010a", "abc", ".sort", "(reverse", "=True", ")\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120abc", "[:", "k", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(x", ")\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852]} +{"problem_id": "p03559", "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nans = 0\n\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n\n i = bisect_left(A, b)\n\n j = bisect(C, b)\n\n ans += i * (N-j)\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "B", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "C", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "A", ".sort", "()\u010a\u010a", "C", ".sort", "()\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", ",", "\u0120bis", "ect", "_left", "\u010a\u010a", "for", "\u0120b", "\u0120in", "\u0120B", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120bis", "ect", "_left", "(A", ",", "\u0120b", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120bis", "ect", "(C", ",", "\u0120b", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120i", "\u0120*", "\u0120(", "N", "-j", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03674", "input": "n = int(input())\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp //= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp //= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n]*invf[i-1]*invf[n-i+1]%mod\n\n if i <= n-1:\n\n S += fact[n-1]*invf[i]*invf[n-1-i]%mod\n\n S %= mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n if i <= n:\n\n S += fact[n-1]*invf[i-1]*invf[n-i]%mod\n\n S %= mod\n\n print(S)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "D", "\u0120=", "\u0120{", "i", ":", "\u0120[", "0", "]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", ")}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120D", "[a", "[i", "]][", "0", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120D", "[a", "[i", "]].", "append", "(i", ")\u010a\u010a", "pl", ",", "\u0120pr", "\u0120=", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120D", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120D", "[i", "][", "0", "]", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120pl", "\u0120=", "\u0120D", "[i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120pr", "\u0120=", "\u0120D", "[i", "][", "2", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "L", "\u0120=", "\u0120pl", "\u010a\u010a", "M", "\u0120=", "\u0120pr", "\u0120-", "\u0120pl", "\u0120-", "\u0120", "1", "\u010a\u010a", "N", "\u0120=", "\u0120n", "\u0120-", "\u0120pr", "\u010a\u010a", "mod", "\u0120=", "\u0120int", "(", "1", "e", "9", ")", "\u0120+", "\u0120", "7", "\u0120#", "\u0120<--", "\u0120input", "\u0120modulo", "\u010a\u010a", "max", "f", "\u0120=", "\u0120n", "+", "1", "1", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120<--", "\u0120input", "\u0120faction", "al", "\u0120limitation", "\u010a\u010a\u010a\u010a", "def", "\u0120make", "_fact", "(n", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120perm", "\u0120=", "\u0120[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[i", "]", "\u0120=", "\u0120tmp", "\u0120%", "\u0120(", "i", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120//=", "\u0120i", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120LL", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120LL", "[i", "]", "\u0120=", "\u0120perm", "[L", "[-", "i", "-", "1", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(L", "[-", "i", "-", "1", "]+", "1", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120perm", "[j", "-", "1", "]", "\u0120=", "\u0120perm", "[j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120LL", "\u010a\u010a\u010a\u010a", "def", "\u0120doubling", "(n", ",", "\u0120m", ",", "\u0120modulo", "=", "mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120base", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120tmp", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120*=", "\u0120base", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120modulo", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120%=", "\u0120modulo", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120base", "\u0120*=", "\u0120base", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120modulo", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120base", "\u0120%=", "\u0120modulo", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120//=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120y", "\u010a\u010a\u010a\u010a", "def", "\u0120inv", "ed", "(a", ",", "\u0120modulo", "=", "mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", ",", "\u0120u", ",", "\u0120v", ",", "\u0120k", ",", "\u0120l", "\u0120=", "\u0120", "1", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "1", ",", "\u0120a", ",", "\u0120modulo", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120l", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", ",", "\u0120u", ",", "\u0120v", "\u0120=", "\u0120u", ",", "\u0120v", ",", "\u0120x", "\u0120-", "\u0120u", "\u0120*", "\u0120(", "k", "\u0120//", "\u0120l", "),", "\u0120y", "\u0120-", "\u0120v", "\u0120*", "\u0120(", "k", "\u0120//", "\u0120l", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", ",", "\u0120l", "\u0120=", "\u0120l", ",", "\u0120k", "\u0120%", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120x", "\u0120%", "\u0120modulo", "\u010a\u010a\u010a\u010a", "fact", "\u0120=", "\u0120[", "1", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(max", "f", "+", "1", ")]\u010a\u010a", "inv", "f", "\u0120=", "\u0120[", "1", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(max", "f", "+", "1", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(max", "f", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fact", "[i", "+", "1", "]", "\u0120=", "\u0120(", "fact", "[i", "]", "\u0120*", "\u0120(", "i", "+", "1", "))", "\u0120%", "\u0120mod", "\u010a\u010a", "inv", "f", "[-", "1", "]", "\u0120=", "\u0120inv", "ed", "(f", "act", "[-", "1", "])\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(max", "f", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "f", "[i", "-", "1", "]", "\u0120=", "\u0120(", "inv", "f", "[i", "]", "\u0120*", "\u0120i", ")", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "2", "):\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120fact", "[n", "]*", "inv", "f", "[i", "-", "1", "]*", "inv", "f", "[n", "-i", "+", "1", "]%", "mod", "\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "\u0120<=", "\u0120n", "-", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120+=", "\u0120fact", "[n", "-", "1", "]*", "inv", "f", "[i", "]*", "inv", "f", "[n", "-", "1", "-i", "]%", "mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "\u0120<=", "\u0120n", "-M", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120-=", "\u0120fact", "[n", "-", "1", "-M", "]*", "inv", "f", "[i", "-", "1", "]*", "inv", "f", "[n", "-M", "-i", "]%", "mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "\u0120<=", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120+=", "\u0120fact", "[n", "-", "1", "]*", "inv", "f", "[i", "-", "1", "]*", "inv", "f", "[n", "-i", "]%", "mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120print", "(S", ")"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7084208560793558, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6448923330239924, 0.6771609938949378, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852]} +{"problem_id": "p02952", "input": "n = int(input())\n\n\n\n\n\ndef countKeta(num):\n\n count = 1\n\n while num / 10 >= 1:\n\n count += 1\n\n num = num // 10\n\n return count\n\n\n\n\n\ncount = 0\n\n\n\nfor i in range(1, n+1):\n\n if(countKeta(i) % 2 == 1):\n\n count += 1\n\n\n\nprint(count)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a\u010a\u010a", "def", "\u0120count", "K", "eta", "(num", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120num", "\u0120/", "\u0120", "1", "0", "\u0120>=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120num", "\u0120//", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120count", "\u010a\u010a\u010a\u010a\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(count", "K", "eta", "(i", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.7584425223266994, 0.5886835746651548, 0.7584425223266994, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.5886835746651548, 0.8691775287719905, 0.833611120734537, 0.833611120734537]} +{"problem_id": "p02996", "input": "\n\n\n\nn = int(input())\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\nabn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))", "input_tokens": ["\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "ab", "n", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a\u010a\u010a", "ab", "n", ".sort", "()\u010a\u010a", "ab", "n", ".sort", "(key", "\u0120=", "\u0120lambda", "\u0120x", ":x", "[", "1", "])\u010a\u010a", "\u010a\u010a\u010a\u010a", "#print", "(ab", "n", ")\u010a\u010a\u010a\u010a", "ts", "\u0120=", "\u0120", "0", "\u0120#", "\u0120time", "_stamp", "\u010a\u010a", "enable", "\u0120=", "\u0120True", "\u010a\u010a", "for", "\u0120abi", "\u0120in", "\u0120ab", "n", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120abi", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120ts", "\u0120+", "\u0120a", "\u0120<=", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120enable", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ts", "\u0120+=", "\u0120a", "\u010a\u010a\u010a\u010a", "print", "(('", "Yes", "'", "\u0120if", "\u0120enable", "\u0120else", "\u0120'", "No", "'))"], "input_token_weights": [0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905]} +{"problem_id": "p00053", "input": "def isPrime(x):\n\n if x == 2:\n\n return True\n\n if x < 2 or x % 2 == 0:\n\n return False\n\n i, root_x = 3, int(pow(x, 0.5))\n\n while i <= root_x:\n\n if x % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nprimes = [2]\n\nfor i in range(3, 104730):\n\n if isPrime(i):\n\n primes.append(primes[-1]+i)\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n print((primes[n-1]))", "input_tokens": ["def", "\u0120is", "Prime", "(x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120<", "\u0120", "2", "\u0120or", "\u0120x", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", ",", "\u0120root", "_x", "\u0120=", "\u0120", "3", ",", "\u0120int", "(pow", "(x", ",", "\u0120", "0", ".", "5", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120<=", "\u0120root", "_x", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a\u010a\u010a", "pr", "imes", "\u0120=", "\u0120[", "2", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",", "\u0120", "1", "0", "4", "7", "3", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120is", "Prime", "(i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120primes", ".append", "(pr", "imes", "[-", "1", "]+", "i", ")\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "pr", "imes", "[n", "-", "1", "]))"], "input_token_weights": [0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046]} +{"problem_id": "p03162", "input": "# https://atcoder.jp/contests/dp/tasks/dp_c\n\nimport numpy as np\n\nN = int(input())\n\nMax_List=[]\n\nN_List=[i for i in range(3)]\n\nfor i in range(N):\n\n Current_List=list(map(int,input().split())) \n\n if i == 0:\n\n Max_List.append(Current_List)\n\n else:\n\n Current_Max_List = []\n\n for j in range(3):\n\n Index_List=np.array(Max_List[i-1])\n\n ind = np.ones(3, dtype=bool)\n\n ind[j] = False\n\n Current_Max_List.append(max(Index_List[ind])+Current_List[j])\n\n \n\n Max_List.append(Current_Max_List)\n\n \n\n \n\nprint((max(Max_List[-1])))", "input_tokens": ["#", "\u0120https", "://", "at", "coder", ".jp", "/", "cont", "ests", "/d", "p", "/tasks", "/d", "p", "_c", "\u010a\u010a", "import", "\u0120numpy", "\u0120as", "\u0120np", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "Max", "_List", "=[]", "\u010a\u010a", "N", "_List", "=[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120Current", "_List", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Max", "_List", ".append", "(Current", "_List", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Current", "_Max", "_List", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Index", "_List", "=np", ".array", "(Max", "_List", "[i", "-", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ind", "\u0120=", "\u0120np", ".ones", "(", "3", ",", "\u0120dtype", "=bool", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ind", "[j", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Current", "_Max", "_List", ".append", "(max", "(Index", "_List", "[ind", "])+", "Current", "_List", "[j", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Max", "_List", ".append", "(Current", "_Max", "_List", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "((", "max", "(Max", "_List", "[-", "1", "])))"], "input_token_weights": [0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.9367265554405826, 0.8922045961188434, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.8214688817838891, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.6911750402874859, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.5731452134031394, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.914713330925897, 0.8922045961188434, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.8922045961188434]} +{"problem_id": "p03835", "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if x >= 0 and x <= K:\n\n ans += 1\n\nprint(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "7", ")\u010a\u010a\u010a\u010a", "K", ",", "\u0120S", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120z", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120S", "\u0120-", "\u0120(", "z", "\u0120+", "\u0120y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120>=", "\u0120", "0", "\u0120and", "\u0120x", "\u0120<=", "\u0120K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.582053818991329, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02996", "input": "n=int(input())\n\ntask=[] \n\nfor _ in range(n):\n\n a,b=list(map(int,input().split()))\n\n task.append((b, -a))\n\n\n\ntask.sort()\n\n\n\ntime=0\n\nflag=True\n\nfor i in task:\n\n time-=i[1]\n\n if time>i[0]:\n\n flag=False\n\n break\n\n\n\nif flag:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n\n", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "task", "=[]", "\u0120\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120task", ".append", "((", "b", ",", "\u0120-", "a", "))", "\u010a\u010a\u010a\u010a", "task", ".sort", "()\u010a\u010a\u010a\u010a", "time", "=", "0", "\u010a\u010a", "flag", "=True", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120task", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120time", "-=", "i", "[", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120time", ">i", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120flag", "=False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "if", "\u0120flag", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Yes", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "No", "\")\u010a\u010a\u010a"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046]} +{"problem_id": "p03038", "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heapify,heappop,heappush\n\nfrom bisect import bisect_left,bisect_right\n\nimport sys,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn,m = inpl()\n\na = inpl()\n\nb = [0] * m\n\nfor i in range(m):\n\n x,y = inpl()\n\n b[i] = [x,y]\n\na.sort()\n\nb.sort(key=lambda x:x[1], reverse = True)\n\nres = sum(a)\n\ni = 0\n\nj = 0\n\nwhile True:\n\n # print(i,j)\n\n if a[i] < b[j][1]:\n\n res += b[j][1] - a[i]\n\n i += 1\n\n else:\n\n break\n\n b[j][0] -= 1\n\n if b[j][0] == 0:\n\n j += 1\n\n if i >= n or j >= m:\n\n break\n\nprint(res)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", ",default", "dict", ",", "deque", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120heap", "ify", ",", "he", "app", "op", ",", "he", "app", "ush", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", ",b", "is", "ect", "_right", "\u010a\u010a", "import", "\u0120sys", ",", "math", ",it", "ertools", ",string", ",", "queue", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "8", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "def", "\u0120inp", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120in", "pl", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120in", "pl", "_str", "():", "\u0120return", "\u0120list", "(sys", ".stdin", ".readline", "().", "split", "())\u010a\u010a", "def", "\u0120in", "pl", "n", "(n", "):", "\u0120return", "\u0120list", "(int", "(sys", ".stdin", ".readline", "())", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "))", "\u010a\u010a\u010a\u010a", "n", ",m", "\u0120=", "\u0120in", "pl", "()\u010a\u010a", "a", "\u0120=", "\u0120in", "pl", "()\u010a\u010a", "b", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120m", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",y", "\u0120=", "\u0120in", "pl", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "[i", "]", "\u0120=", "\u0120[", "x", ",y", "]\u010a\u010a", "a", ".sort", "()\u010a\u010a", "b", ".sort", "(key", "=lambda", "\u0120x", ":x", "[", "1", "],", "\u0120reverse", "\u0120=", "\u0120True", ")\u010a\u010a", "res", "\u0120=", "\u0120sum", "(a", ")\u010a\u010a", "i", "\u0120=", "\u0120", "0", "\u010a\u010a", "j", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(i", ",j", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[i", "]", "\u0120<", "\u0120b", "[j", "][", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120+=", "\u0120b", "[j", "][", "1", "]", "\u0120-", "\u0120a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "[j", "][", "0", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120b", "[j", "][", "0", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120>=", "\u0120n", "\u0120or", "\u0120j", "\u0120>=", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "print", "(res", ")\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.6771609938949378, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02891", "input": "s = input()\n\nk = int(input())\n\n\n\nif len(set(s)) == 1:\n\n print(((len(s)*k)//2))\n\n exit()\n\n\n\nss = s + s\n\n\n\nshoko = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(s)):\n\n if s[i] == prev:\n\n cnt += 1\n\n else:\n\n shoko += cnt // 2\n\n cnt = 1\n\n prev = s[i]\n\nshoko += cnt // 2\n\n\n\nkosa = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(ss)):\n\n if ss[i] == prev:\n\n cnt += 1\n\n else:\n\n kosa += cnt // 2\n\n cnt = 1\n\n prev = ss[i]\n\nkosa += cnt // 2\n\nkosa -= shoko\n\n\n\nprint((shoko + (k-1)*kosa))", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a", "k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "if", "\u0120len", "(set", "(s", "))", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "len", "(s", ")*", "k", ")//", "2", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "ss", "\u0120=", "\u0120s", "\u0120+", "\u0120s", "\u010a\u010a\u010a\u010a", "sh", "oko", "\u0120=", "\u0120", "0", "\u010a\u010a", "prev", "\u0120=", "\u0120''\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120==", "\u0120prev", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sh", "oko", "\u0120+=", "\u0120cnt", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120s", "[i", "]\u010a\u010a", "sh", "oko", "\u0120+=", "\u0120cnt", "\u0120//", "\u0120", "2", "\u010a\u010a\u010a\u010a", "k", "osa", "\u0120=", "\u0120", "0", "\u010a\u010a", "prev", "\u0120=", "\u0120''\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(ss", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ss", "[i", "]", "\u0120==", "\u0120prev", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "osa", "\u0120+=", "\u0120cnt", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120ss", "[i", "]\u010a\u010a", "k", "osa", "\u0120+=", "\u0120cnt", "\u0120//", "\u0120", "2", "\u010a\u010a", "k", "osa", "\u0120-=", "\u0120sh", "oko", "\u010a\u010a\u010a\u010a", "print", "((", "sh", "oko", "\u0120+", "\u0120(", "k", "-", "1", ")*", "k", "osa", "))"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.8408263201236497, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.6514299043837268, 0.6160583186229708, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8691775287719905]} +{"problem_id": "p03081", "input": "n,q=list(map(int,input().split()));s=\"_\"+input()+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:L=h==\"L\";R=h==\"R\";l,r=[l,l-1,l+1][(m==s[l]and R)-(m==s[l+1]and L)],[r,r-1,r+1][(m==s[r-1]and R)-(m==s[r]and L)]\n\nprint((max(0,r-l-1)))", "input_tokens": ["n", ",q", "=list", "(map", "(int", ",input", "().", "split", "()));", "s", "=\"_", "\"+", "input", "()+\"", "_", "\";", "l", ",r", "=", "0", ",n", "+", "1", "\u010a\u010a", "for", "(m", ",h", ")", "in", "[input", "().", "split", "()", "for", "\u0120i", "\u0120in", "\u0120range", "(q", ")][", "::-", "1", "]:", "L", "=h", "==\"", "L", "\";", "R", "=h", "==\"", "R", "\";", "l", ",r", "=[", "l", ",l", "-", "1", ",l", "+", "1", "][(", "m", "==", "s", "[l", "]", "and", "\u0120R", ")-(", "m", "==", "s", "[l", "+", "1", "]", "and", "\u0120L", ")", "],[", "r", ",r", "-", "1", ",r", "+", "1", "][(", "m", "==", "s", "[r", "-", "1", "]", "and", "\u0120R", ")-(", "m", "==", "s", "[r", "]", "and", "\u0120L", ")]\u010a\u010a", "print", "((", "max", "(", "0", ",r", "-l", "-", "1", ")))"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.9529241888335975, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.9529241888335975, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9285282781079651, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308]} +{"problem_id": "p03796", "input": "import math\n\n\n\nn = int(input())\n\nprint((math.factorial(n) % (10 ** 9 + 7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "\u0120%", "\u0120(", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p03035", "input": "a,b=list(map(int,input().split()))\n\nprint((b if 13<=a else b//2 if 6<=a else 0))", "input_tokens": ["a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "print", "((", "b", "\u0120if", "\u0120", "1", "3", "<=", "a", "\u0120else", "\u0120b", "//", "2", "\u0120if", "\u0120", "6", "<=", "a", "\u0120else", "\u0120", "0", "))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p02688", "input": "N,K=list(map(int,input().split()))\n\n\n\ncon = 0\n\nans = list(int() for _ in range(100000))\n\npre = 0\n\n\n\n\n\nfor _ in range(K):\n\n\n\n D = int(input())\n\n arr = list(map(int,input().split()))\n\n\n\n for j in range(D):\n\n\n\n ans[pre+j]=arr[j]\n\n\n\n pre += D\n\n\n\n \n\nfin = (N+1) - len(set(ans))\n\n\n\nprint(fin)", "input_tokens": ["N", ",K", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "con", "\u0120=", "\u0120", "0", "\u010a\u010a", "ans", "\u0120=", "\u0120list", "(int", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "1", "0", "0", "0", "0", "0", "))\u010a\u010a", "pre", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(K", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120D", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120arr", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(D", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "[", "pre", "+j", "]=", "arr", "[j", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120pre", "\u0120+=", "\u0120D", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "fin", "\u0120=", "\u0120(", "N", "+", "1", ")", "\u0120-", "\u0120len", "(set", "(ans", "))", "\u010a\u010a\u010a\u010a", "print", "(fin", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03162", "input": "def main():\n\n n = int(input())\n\n a = [0]\n\n b = [0]\n\n c = [0]\n\n\n\n for i in range(n):\n\n aa,bb,cc = list(map(int,input().split()))\n\n a.append(max(b[i] + aa, c[i] + aa))\n\n b.append(max(a[i] + bb, c[i] + bb))\n\n c.append(max(a[i] + cc, b[i] + cc))\n\n\n\n print((max(a[-1], b[-1], c[-1])))\n\n\n\nmain()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120", "\u0120a", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "\u0120", "\u0120b", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "\u0120", "\u0120c", "\u0120=", "\u0120[", "0", "]\u010a\u010a\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120aa", ",", "bb", ",", "cc", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120a", ".append", "(max", "(b", "[i", "]", "\u0120+", "\u0120aa", ",", "\u0120c", "[i", "]", "\u0120+", "\u0120aa", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120b", ".append", "(max", "(a", "[i", "]", "\u0120+", "\u0120bb", ",", "\u0120c", "[i", "]", "\u0120+", "\u0120bb", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120c", ".append", "(max", "(a", "[i", "]", "\u0120+", "\u0120cc", ",", "\u0120b", "[i", "]", "\u0120+", "\u0120cc", "))", "\u010a\u010a\u010a\u010a", "\u0120", "\u0120print", "((", "max", "(a", "[-", "1", "],", "\u0120b", "[-", "1", "],", "\u0120c", "[-", "1", "]))", ")\u010a\u010a\u010a\u010a", "main", "()"], "input_token_weights": [0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.8214688817838891, 0.8456076926739031, 0.914713330925897, 0.8922045961188434]} +{"problem_id": "p02414", "input": "import sys\n\ne=[list(map(int,e.split()))for e in sys.stdin]\n\nn=e[0][0]+1\n\nfor c in e[1:n]:\n\n t=''\n\n for l in zip(*e[n:]):t+=f'{sum(s*t for s,t in zip(c,l))} '\n\n print((t[:-1]))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "e", "=[", "list", "(map", "(int", ",e", ".split", "()))", "for", "\u0120e", "\u0120in", "\u0120sys", ".stdin", "]\u010a\u010a", "n", "=e", "[", "0", "][", "0", "]+", "1", "\u010a\u010a", "for", "\u0120c", "\u0120in", "\u0120e", "[", "1", ":n", "]:\u010a\u010a", "\u0120t", "='", "'\u010a\u010a", "\u0120for", "\u0120l", "\u0120in", "\u0120zip", "(*", "e", "[n", ":", "]):", "t", "+=", "f", "'{", "sum", "(s", "*t", "\u0120for", "\u0120s", ",t", "\u0120in", "\u0120zip", "(c", ",l", "))", "}", "\u0120'\u010a\u010a", "\u0120print", "((", "t", "[:-", "1", "]))\u010a"], "input_token_weights": [0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7281392564472128, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.8854867975141383, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6993277790098028, 0.7561438265913266, 0.7833854580549265, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7281392564472128, 0.8357386476069529]} +{"problem_id": "p02814", "input": "from functools import reduce\n\nfrom math import gcd\n\n\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\ndef sub_by_2(n):\n\n cnt = 0\n\n while n % 2 == 0:\n\n n //= 2\n\n cnt += 1\n\n return cnt\n\n\n\nlcm_2 = [sub_by_2(n // 2) for n in A]\n\nif all(lcm_2[0] == v for v in lcm_2):\n\n num = reduce(lcm, [v // 2 for v in A])\n\n res = M // num\n\n print((res // 2 + res % 2))\n\nelse:\n\n print((0))\n", "input_tokens": ["from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120M", ",", "\u0120*", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120lcm", "(x", ",", "\u0120y", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120x", "\u0120*", "\u0120y", "\u0120//", "\u0120gcd", "(x", ",", "\u0120y", ")\u010a\u010a\u010a\u010a", "def", "\u0120sub", "_by", "_", "2", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120n", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120//=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120cnt", "\u010a\u010a\u010a\u010a", "l", "cm", "_", "2", "\u0120=", "\u0120[", "sub", "_by", "_", "2", "(n", "\u0120//", "\u0120", "2", ")", "\u0120for", "\u0120n", "\u0120in", "\u0120A", "]\u010a\u010a", "if", "\u0120all", "(l", "cm", "_", "2", "[", "0", "]", "\u0120==", "\u0120v", "\u0120for", "\u0120v", "\u0120in", "\u0120lcm", "_", "2", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120reduce", "(l", "cm", ",", "\u0120[", "v", "\u0120//", "\u0120", "2", "\u0120for", "\u0120v", "\u0120in", "\u0120A", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120M", "\u0120//", "\u0120num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "res", "\u0120//", "\u0120", "2", "\u0120+", "\u0120res", "\u0120%", "\u0120", "2", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046]} +{"problem_id": "p02552", "input": "x = int(input())\n\nif x == 0:\n\n print((1))\n\nelse:\n\n print((0))", "input_tokens": ["x", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "if", "\u0120x", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120", "\u0120print", "((", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.89427190936908, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.89427190936908, 0.5928797394668679, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.7332896764791028, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6886415962350058]} +{"problem_id": "p02959", "input": "from sys import stdin,stdout\n\n\n\nif __name__==\"__main__\":\n\n n=int(stdin.readline())\n\n\n\n a=[int(x) for x in stdin.readline().split()]\n\n b=[int(x) for x in stdin.readline().split()]\n\n\n\n cnt=0\n\n\n\n for i in range(n):\n\n if(a[i]>=b[i]):\n\n cnt+=b[i]\n\n else:\n\n cnt+=a[i]\n\n d=b[i]-a[i]\n\n cnt+=min(a[i+1],d)\n\n if(d>a[i+1]):\n\n a[i+1]=0\n\n else: a[i+1]-=d\n\n \n\n stdout.write(str(cnt)+\"\\n\")\n", "input_tokens": ["from", "\u0120sys", "\u0120import", "\u0120stdin", ",", "stdout", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "==\"", "__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=int", "(stdin", ".readline", "())\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120stdin", ".readline", "().", "split", "()]\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120stdin", ".readline", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "=", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(a", "[i", "]>=", "b", "[i", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "+=", "b", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "+=", "a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "=b", "[i", "]-", "a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "+=", "min", "(a", "[i", "+", "1", "],", "d", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(d", ">a", "[i", "+", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[i", "+", "1", "]=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120a", "[i", "+", "1", "]-", "=", "d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120stdout", ".write", "(str", "(cnt", ")+\"", "\\", "n", "\")\u010a"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.7713695892187169, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7186273667339679, 0.7186273667339679, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7186273667339679, 0.7186273667339679, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.6911750402874859, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.6911750402874859, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.6629477592666795, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.6339004969859428, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.7713695892187169, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031]} +{"problem_id": "p03608", "input": "def main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = float(\"Inf\")\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120from", "\u0120itertools", "\u0120import", "\u0120permutations", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120m", ",", "\u0120r", ",", "\u0120*", "x", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120to", "\u0120=", "\u0120x", "[:", "r", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120dis", "\u0120=", "\u0120[[", "float", "(\"", "Inf", "\")]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", "\u0120+", "\u0120", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dis", "[i", "][", "i", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120zip", "(*", "[", "iter", "(x", "[r", ":", "])]", "\u0120*", "\u0120", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dis", "[a", "][", "b", "]", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dis", "[b", "][", "a", "]", "\u0120=", "\u0120c", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dis", "[i", "][", "j", "]", "\u0120=", "\u0120min", "(dis", "[i", "][", "j", "],", "\u0120dis", "[i", "][", "k", "]", "\u0120+", "\u0120dis", "[k", "][", "j", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120float", "(\"", "Inf", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120p", "\u0120in", "\u0120permutations", "(to", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nw", "\u0120=", "\u0120p", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120nx", "\u0120in", "\u0120p", "[", "1", ":]", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120dis", "[n", "w", "][", "nx", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nw", "\u0120=", "\u0120nx", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120tmp", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8765066796615488, 0.8981772421402056, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.6838237134005932, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8981772421402056, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.808526270355906, 0.8981772421402056, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.7355852514485495, 0.808526270355906, 0.5714954628602014, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p03416", "input": "counter = 0\n\nc = list(map(int, input().split(' ')))\n\nfor i in range(c[0], c[1] + 1):\n\n if str(i)[0] != str(i)[4]:\n\n continue\n\n if str(i)[1] != str(i)[3]:\n\n continue\n\n counter += 1\n\n\n\nprint(counter)", "input_tokens": ["counter", "\u0120=", "\u0120", "0", "\u010a\u010a", "c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "('", "\u0120'", ")))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(c", "[", "0", "],", "\u0120c", "[", "1", "]", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120str", "(i", ")[", "0", "]", "\u0120!=", "\u0120str", "(i", ")[", "4", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120", "\u0120if", "\u0120str", "(i", ")[", "1", "]", "\u0120!=", "\u0120str", "(i", ")[", "3", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120", "\u0120counter", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(counter", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7640031686476719, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.7640031686476719, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03038", "input": "I=lambda:list(map(int,input().split()))\n\nn,m=I()\n\na=I()\n\na.sort(reverse=True)\n\nqq=[I() for i in range(m)]\n\nqq.sort(key=lambda x:x[1],reverse=True)\n\nans=0\n\nfor x,y in qq:\n\n for j in range(x):\n\n if not a:\n\n break\n\n aa=a.pop()\n\n ans+=max(aa,y)\n\nans+=sum(a)\n\nprint(ans)\n\n ", "input_tokens": ["I", "=lambda", ":list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "n", ",m", "=", "I", "()\u010a\u010a", "a", "=", "I", "()\u010a\u010a", "a", ".sort", "(reverse", "=True", ")\u010a\u010a", "qq", "=[", "I", "()", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(m", ")]\u010a\u010a", "qq", ".sort", "(key", "=lambda", "\u0120x", ":x", "[", "1", "],", "reverse", "=True", ")\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120x", ",y", "\u0120in", "\u0120qq", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(x", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120aa", "=a", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "max", "(aa", ",y", ")\u010a\u010a", "ans", "+=", "sum", "(a", ")\u010a\u010a", "print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.579389560544]} +{"problem_id": "p03723", "input": "a,b,c=list(map(int,input().split()))\n\ne=(a-b)|(b-c)\n\nprint((bool(e|(a|b|c)%2)*(e^~-e).bit_length()-1))", "input_tokens": ["a", ",b", ",c", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "e", "=(", "a", "-b", ")|(", "b", "-c", ")\u010a\u010a", "print", "((", "bool", "(e", "|(", "a", "|", "b", "|", "c", ")%", "2", ")*(", "e", "^", "~-", "e", ").", "bit", "_length", "()-", "1", "))"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.8778749353275308, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308]} +{"problem_id": "p03037", "input": "N, M =list(map(int, input().split()))\n\nL = [0 for i in range(N+1)]\n\nR = [0 for i in range(N+1)]\n\nfor i in range(M):\n\n l,r = list(map(int, input().split()))\n\n L[l] += 1\n\n R[r] += 1\n\ncnt = 0\n\ntmp = 0\n\nfor i in range(N+1):\n\n tmp += L[i]\n\n if tmp == M:\n\n cnt += 1\n\n tmp -= R[i]\n\nprint(cnt)\n", "input_tokens": ["N", ",", "\u0120M", "\u0120=", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", ")]\u010a\u010a", "R", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ",r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", "[l", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", "[r", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "tmp", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120L", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "\u0120==", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120-=", "\u0120R", "[i", "]\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03558", "input": "from collections import deque\n\nK = int(input())\n\nG = [[] for i in range(K)]\n\n\n\nfor n in range(K):\n\n G[n].append([(n + 1) % K, 1])\n\n G[n].append([(10 * n) % K, 0])\n\n\n\nque = deque([[1, 1]])\n\ndist = [float('inf')] * K\n\n\n\nwhile que:\n\n node, cost = que.pop()\n\n dist[node] = min(cost, dist[node])\n\n for e, e_cost in G[node]:\n\n if dist[e] != float('inf'):\n\n continue\n\n\n\n if e_cost == 0:\n\n que.append([e, cost + 0])\n\n\n\n if e_cost == 1:\n\n que.appendleft([e, cost + 1])\n\n\n\nprint((dist[0]))\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "K", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "G", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(K", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120n", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120G", "[n", "].", "append", "([(", "n", "\u0120+", "\u0120", "1", ")", "\u0120%", "\u0120K", ",", "\u0120", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120G", "[n", "].", "append", "([(", "1", "0", "\u0120*", "\u0120n", ")", "\u0120%", "\u0120K", ",", "\u0120", "0", "])\u010a\u010a", "\u010a\u010a", "que", "\u0120=", "\u0120deque", "([[", "1", ",", "\u0120", "1", "]])\u010a\u010a", "dist", "\u0120=", "\u0120[", "float", "('", "inf", "')]", "\u0120*", "\u0120K", "\u010a\u010a\u010a\u010a", "while", "\u0120que", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120node", ",", "\u0120cost", "\u0120=", "\u0120que", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120dist", "[node", "]", "\u0120=", "\u0120min", "(cost", ",", "\u0120dist", "[node", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120e", ",", "\u0120e", "_cost", "\u0120in", "\u0120G", "[node", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dist", "[e", "]", "\u0120!=", "\u0120float", "('", "inf", "')", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120e", "_cost", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".append", "([", "e", ",", "\u0120cost", "\u0120+", "\u0120", "0", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120e", "_cost", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".append", "left", "([", "e", ",", "\u0120cost", "\u0120+", "\u0120", "1", "])\u010a\u010a", "\u010a\u010a", "print", "((", "dist", "[", "0", "]))\u010a"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.7186273667339679, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.6855929667625797, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.6855929667625797, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905]} +{"problem_id": "p03307", "input": "import math\n\n\n\n\n\ndef lcm(x, y):\n\n return (x * y) // math.gcd(x, y)\n\n\n\n\n\nN = int(input())\n\nprint((lcm(N, 2)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120lcm", "(x", ",", "\u0120y", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "x", "\u0120*", "\u0120y", ")", "\u0120//", "\u0120math", ".g", "cd", "(x", ",", "\u0120y", ")\u010a\u010a\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "l", "cm", "(N", ",", "\u0120", "2", ")))"], "input_token_weights": [0.883057299767519, 0.8408263201236497, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.883057299767519, 0.5978920048953399, 0.7967329450848046, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.7967329450848046, 0.7022465694939416, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.7967329450848046]} +{"problem_id": "p02555", "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n for i in range(x-2):\n\n ret += rec(i)\n\n ret %= mod\n\n return ret\n\n\n\nprint((rec(S)))\n", "input_tokens": ["import", "\u0120sys", ",", "\u0120re", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", ",", "\u0120defaultdict", ",", "\u0120Counter", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120ceil", ",", "\u0120sqrt", ",", "\u0120hyp", "ot", ",", "\u0120factorial", ",", "\u0120pi", ",", "\u0120sin", ",", "\u0120cos", ",", "\u0120radians", ",", "\u0120gcd", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120accumulate", ",", "\u0120permutations", ",", "\u0120combinations", ",", "\u0120product", ",", "\u0120group", "by", ",", "\u0120combinations", "_with", "_re", "placement", "\u010a\u010a", "from", "\u0120operator", "\u0120import", "\u0120item", "getter", ",", "\u0120mul", "\u010a\u010a", "from", "\u0120copy", "\u0120import", "\u0120deepcopy", "\u010a\u010a", "from", "\u0120string", "\u0120import", "\u0120ascii", "_lowercase", ",", "\u0120ascii", "_upper", "case", ",", "\u0120digits", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", ",", "\u0120bis", "ect", "_left", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120reduce", ",", "\u0120l", "ru", "_cache", "\u010a\u010a", "def", "\u0120input", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a", "def", "\u0120INT", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120MAP", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120LIST", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120ZIP", "(n", "):", "\u0120return", "\u0120list", "(zip", "(*(", "MAP", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", "))))\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120INT", "()\u010a\u010a\u010a\u010a", "@", "l", "ru", "_cache", "(max", "size", "=None", ")\u010a\u010a", "def", "\u0120rec", "(x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120", "0", ":", "\u0120return", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(x", "-", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120rec", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "print", "((", "rec", "(S", ")))\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.6771609938949378, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308]} +{"problem_id": "p03037", "input": "import sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nlr = list(zip(*[iter(lr)] * 2))\n\n\n\ndef main():\n\n cnt = [0] * (n + 1)\n\n for l, r in lr:\n\n cnt[l-1] += 1\n\n cnt[r] -= 1\n\n \n\n for i in range(n):\n\n cnt[i+1] += cnt[i]\n\n \n\n res = 0\n\n for i in range(n):\n\n res += (cnt[i] == m) & 1\n\n \n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", ",", "\u0120*", "lr", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".read", "().", "split", "()))\u010a\u010a", "lr", "\u0120=", "\u0120list", "(zip", "(*", "[", "iter", "(lr", ")]", "\u0120*", "\u0120", "2", "))", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120l", ",", "\u0120r", "\u0120in", "\u0120lr", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "[l", "-", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "[r", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "[i", "+", "1", "]", "\u0120+=", "\u0120cnt", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120+=", "\u0120(", "cnt", "[i", "]", "\u0120==", "\u0120m", ")", "\u0120&", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120res", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120main", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.6855929667625797, 0.6514299043837268, 0.6160583186229708, 0.6855929667625797, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.8408263201236497, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.579389560544, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829]} +{"problem_id": "p01438", "input": "from collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n D = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n for s in range(s-6,e-6):\n\n t |= 1 << s\n\n D[man] = t\n\n\n\n dp = [defaultdict(int) for i in range(n)]\n\n dp[0][D[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp[i-1].keys()):\n\n if bit&D[i] == 0:\n\n dp[i][bit|D[i]] = max(dp[i][bit|D[i]], dp[i-1][bit]+L[i])\n\n dp[i][bit] = max(dp[i][bit],dp[i-1][bit])\n\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n\n \n\n ans = max(max(dp[i].values()) for i in range(n))\n\n print(ans)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "while", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120D", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120man", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", ",l", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[", "man", "]", "\u0120=", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120date", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", ",e", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120s", "\u0120in", "\u0120range", "(s", "-", "6", ",e", "-", "6", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120|=", "\u0120", "1", "\u0120<<", "\u0120s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120D", "[", "man", "]", "\u0120=", "\u0120t", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[", "default", "dict", "(int", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "][", "D", "[", "0", "]]", "\u0120=", "\u0120L", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120bit", "\u0120in", "\u0120list", "(dp", "[i", "-", "1", "].", "keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120bit", "&D", "[i", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "bit", "|", "D", "[i", "]]", "\u0120=", "\u0120max", "(dp", "[i", "][", "bit", "|", "D", "[i", "]],", "\u0120dp", "[i", "-", "1", "][", "bit", "]+", "L", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "bit", "]", "\u0120=", "\u0120max", "(dp", "[i", "][", "bit", "],", "dp", "[i", "-", "1", "][", "bit", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "D", "[i", "]]", "\u0120=", "\u0120max", "(dp", "[i", "][", "D", "[i", "]],", "\u0120L", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(max", "(dp", "[i", "].", "values", "())", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.9235768548788368, 0.5700083567488032, 0.9432371260907066, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.9035222925783293, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.9035222925783293, 0.862164725336545, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.819022641134497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.5700083567488032, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.862164725336545, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7967329450848046, 0.7739350698055053, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.7967329450848046, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.819022641134497, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.819022641134497, 0.7967329450848046, 0.862164725336545, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.7506053018110229, 0.7267182280470056, 0.7267182280470056, 0.7739350698055053, 0.7739350698055053, 0.819022641134497, 0.862164725336545, 0.5700083567488032, 0.819022641134497, 0.7739350698055053, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.7967329450848046, 0.5700083567488032, 0.7967329450848046, 0.819022641134497, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.6771609938949378, 0.6771609938949378, 0.7267182280470056, 0.7506053018110229, 0.7267182280470056, 0.7022465694939416, 0.6514299043837268, 0.6771609938949378, 0.6514299043837268, 0.6514299043837268, 0.6250192001927346, 0.6250192001927346, 0.7022465694939416, 0.6250192001927346, 0.6250192001927346, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7967329450848046, 0.7739350698055053, 0.7506053018110229, 0.7022465694939416, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.6771609938949378, 0.6771609938949378, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.8408263201236497, 0.819022641134497, 0.7967329450848046, 0.7506053018110229, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.7967329450848046, 0.7739350698055053, 0.7739350698055053, 0.7967329450848046, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.7967329450848046, 0.7267182280470056, 0.7506053018110229, 0.7506053018110229, 0.7967329450848046, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.7967329450848046, 0.7739350698055053, 0.8408263201236497, 0.5700083567488032, 0.883057299767519, 0.862164725336545, 0.862164725336545]} +{"problem_id": "p03208", "input": "N, K = list(map(int, input().split()))\n\n\n\nheight = []\n\nfor _ in range(N) :\n\n height.append(int(input()))\n\n\n\nheight.sort()\n\nans = float('inf')\n\n\n\nfor i in range(N-K+1) :\n\n diff = height[i + K - 1] - height[i]\n\n ans = min(ans, diff)\n\n\n\nprint(ans)", "input_tokens": ["N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "height", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", ")", "\u0120:\u010a\u010a", "\u0120\u0120\u0120", "\u0120height", ".append", "(int", "(input", "()))", "\u010a\u010a\u010a\u010a", "height", ".sort", "()\u010a\u010a", "ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-K", "+", "1", ")", "\u0120:\u010a\u010a", "\u0120\u0120\u0120", "\u0120diff", "\u0120=", "\u0120height", "[i", "\u0120+", "\u0120K", "\u0120-", "\u0120", "1", "]", "\u0120-", "\u0120height", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120diff", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03032", "input": "from collections import deque\n\n\n\nn, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor t in range(k//2 + 1):\n\n hand = deque(V[:k-t])\n\n rest = deque(V[k-t:])\n\n cur_sum = sum(hand)\n\n\n\n for j in range(k-t+1):\n\n put_back = 0\n\n rev_hand = sorted(hand)\n\n\n\n for i in range(t):\n\n jewel = rev_hand[i]\n\n if jewel < 0:\n\n put_back -= jewel\n\n else:\n\n break\n\n\n\n candidate = cur_sum + put_back\n\n ans = max(candidate, ans)\n\n\n\n to_rest = hand.pop()\n\n rest.appendleft(to_rest)\n\n to_hand = rest.pop()\n\n hand.appendleft(to_hand)\n\n\n\n cur_sum += to_hand - to_rest\n\n\n\nprint(ans)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "V", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120t", "\u0120in", "\u0120range", "(k", "//", "2", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120hand", "\u0120=", "\u0120deque", "(V", "[:", "k", "-t", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120rest", "\u0120=", "\u0120deque", "(V", "[k", "-t", ":", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120cur", "_sum", "\u0120=", "\u0120sum", "(hand", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "-t", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120put", "_back", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120rev", "_hand", "\u0120=", "\u0120sorted", "(hand", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(t", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120jewel", "\u0120=", "\u0120rev", "_hand", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120jewel", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120put", "_back", "\u0120-=", "\u0120jewel", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120candidate", "\u0120=", "\u0120cur", "_sum", "\u0120+", "\u0120put", "_back", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(candidate", ",", "\u0120ans", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120to", "_rest", "\u0120=", "\u0120hand", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120rest", ".append", "left", "(to", "_rest", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120to", "_hand", "\u0120=", "\u0120rest", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120hand", ".append", "left", "(to", "_hand", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "_sum", "\u0120+=", "\u0120to", "_hand", "\u0120-", "\u0120to", "_rest", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.6588494518362031, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6211886504852411, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02863", "input": "n,t=list(map(int,input().split()))\n\nab=[list(map(int,input().split()))for _ in range(n)]\n\nab.sort()\n\ndp=[(6007)*[0]for _ in range(n+1)]\n\ndp[0][0]=0\n\nans=0\n\nfor i in range(n):\n\n for j in range(6007):\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\n if j>= 1\n\n return r\n\n\n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\n\n\nm = 0\n\nl = (1 << n) - 1\n\nfor x in range(1, l + 1):\n\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n\n m = max(m, popcount(x))\n\nprint(m)\n", "input_tokens": ["def", "\u0120pop", "count", "(x", "):\u010a\u010a", "\u0120", "\u0120r", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120while", "\u0120x", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120&", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120>>=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120return", "\u0120r", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "r", "\u0120=", "\u0120list", "(range", "(n", "))\u010a\u010a", "a", "\u0120=", "\u0120[[", "0", ",", "\u0120", "0", "]", "\u0120for", "\u0120_", "\u0120in", "\u0120r", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120r", ":\u010a\u010a", "\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(int", "(input", "()))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "[i", "][", "y", "]", "\u0120|=", "\u0120", "1", "\u0120<<", "\u0120(", "x", "\u0120-", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "m", "\u0120=", "\u0120", "0", "\u010a\u010a", "l", "\u0120=", "\u0120(", "1", "\u0120<<", "\u0120n", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "1", ",", "\u0120l", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120all", "(a", "[i", "][", "0", "]", "\u0120&", "\u0120x", "\u0120==", "\u0120a", "[i", "][", "1", "]", "\u0120&", "\u0120l", "\u0120-", "\u0120x", "\u0120==", "\u0120", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120r", "\u0120if", "\u0120x", "\u0120>>", "\u0120i", "\u0120&", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120max", "(m", ",", "\u0120pop", "count", "(x", "))\u010a\u010a", "print", "(m", ")\u010a"], "input_token_weights": [0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8214688817838891, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7713695892187169, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7713695892187169, 0.914713330925897, 0.8922045961188434, 0.8922045961188434]} +{"problem_id": "p03039", "input": "n, m, k = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\nMAX = n * m\n\n\n\n\n\nclass ModInt:\n\n def __init__(self, num):\n\n self.num = num\n\n\n\n def __str__(self):\n\n return str(self.num)\n\n\n\n def __repr__(self):\n\n return \"ModInt(num: {}, mod: {}\".format(self.num, mod)\n\n\n\n def __add__(self, other):\n\n ret = self.num + other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __sub__(self, other):\n\n ret = self.num - other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __mul__(self, other):\n\n ret = self.num * other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def pow(self, times):\n\n pw = pow(self.num, times, mod)\n\n return ModInt(pw)\n\n\n\n def inverse(self):\n\n return ModInt(inv[self.num])\n\n\n\n def __truediv__(self, other):\n\n num = self * other.inverse()\n\n return ModInt(num)\n\n\n\n\n\ndef comb(n, k):\n\n return fact[n] * inv[n-k] * inv[k]\n\n\n\n\n\nfact = [None] * (MAX + 1)\n\nfact[0] = ModInt(1)\n\nfor i in range(1, MAX + 1):\n\n fact[i] = fact[i-1] * ModInt(i)\n\n\n\ninv = [None] * (MAX + 1)\n\ninv[MAX] = fact[MAX].pow(mod - 2)\n\nfor i in range(MAX, 0, -1):\n\n inv[i-1] = inv[i] * ModInt(i)\n\n\n\nans = ModInt(0)\n\nfor i in range(n):\n\n for j in range(m):\n\n add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)\n\n if i != 0 and j != 0:\n\n add *= ModInt(2)\n\n\n\n ans += add\n\n\n\nans *= comb(n * m - 2, k - 2)\n\nprint(ans)\n", "input_tokens": ["n", ",", "\u0120m", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "MAX", "\u0120=", "\u0120n", "\u0120*", "\u0120m", "\u010a\u010a\u010a\u010a\u010a\u010a", "class", "\u0120Mod", "Int", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120num", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".num", "\u0120=", "\u0120num", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "str", "__(", "self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120str", "(self", ".num", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "repr", "__(", "self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120\"", "Mod", "Int", "(num", ":", "\u0120{},", "\u0120mod", ":", "\u0120{}\".", "format", "(self", ".num", ",", "\u0120mod", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "add", "__(", "self", ",", "\u0120other", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120self", ".num", "\u0120+", "\u0120other", ".num", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(ret", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "sub", "__(", "self", ",", "\u0120other", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120self", ".num", "\u0120-", "\u0120other", ".num", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(ret", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "mul", "__(", "self", ",", "\u0120other", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120self", ".num", "\u0120*", "\u0120other", ".num", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(ret", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120pow", "(self", ",", "\u0120times", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pw", "\u0120=", "\u0120pow", "(self", ".num", ",", "\u0120times", ",", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(p", "w", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120inverse", "(self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(inv", "[self", ".num", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "tr", "ued", "iv", "__(", "self", ",", "\u0120other", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120self", "\u0120*", "\u0120other", ".inverse", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120Mod", "Int", "(num", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120comb", "(n", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120fact", "[n", "]", "\u0120*", "\u0120inv", "[n", "-k", "]", "\u0120*", "\u0120inv", "[k", "]", "\u010a\u010a\u010a\u010a\u010a\u010a", "fact", "\u0120=", "\u0120[", "None", "]", "\u0120*", "\u0120(", "MAX", "\u0120+", "\u0120", "1", ")\u010a\u010a", "fact", "[", "0", "]", "\u0120=", "\u0120Mod", "Int", "(", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120MAX", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fact", "[i", "]", "\u0120=", "\u0120fact", "[i", "-", "1", "]", "\u0120*", "\u0120Mod", "Int", "(i", ")\u010a\u010a\u010a\u010a", "inv", "\u0120=", "\u0120[", "None", "]", "\u0120*", "\u0120(", "MAX", "\u0120+", "\u0120", "1", ")\u010a\u010a", "inv", "[MAX", "]", "\u0120=", "\u0120fact", "[MAX", "].", "pow", "(mod", "\u0120-", "\u0120", "2", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(MAX", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "[i", "-", "1", "]", "\u0120=", "\u0120inv", "[i", "]", "\u0120*", "\u0120Mod", "Int", "(i", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120Mod", "Int", "(", "0", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120add", "\u0120=", "\u0120Mod", "Int", "(n", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120Mod", "Int", "(m", "\u0120-", "\u0120j", ")", "\u0120*", "\u0120Mod", "Int", "(i", "\u0120+", "\u0120j", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120j", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120add", "\u0120*=", "\u0120Mod", "Int", "(", "2", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120add", "\u010a\u010a\u010a\u010a", "ans", "\u0120*=", "\u0120comb", "(n", "\u0120*", "\u0120m", "\u0120-", "\u0120", "2", ",", "\u0120k", "\u0120-", "\u0120", "2", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.781592256244883, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.579389560544, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8408263201236497, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03241", "input": "N,M = list(map(int,input().split()))\n\nif N==1:\n\n nmax=M\n\nelse:\n\n nmax = 1\n\n for i in range(2,int(M**0.5)+1):\n\n if M%i==0 and M//i>=N:\n\n nmax = max(nmax,i)\n\n if M%i==0 and i>=N:\n\n nmax = max(nmax,M//i)\n\nprint(nmax)", "input_tokens": ["N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "if", "\u0120N", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "max", "=M", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "max", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",int", "(M", "**", "0", ".", "5", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120M", "%i", "==", "0", "\u0120and", "\u0120M", "//", "i", ">=", "N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "max", "\u0120=", "\u0120max", "(n", "max", ",i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120M", "%i", "==", "0", "\u0120and", "\u0120i", ">=", "N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "max", "\u0120=", "\u0120max", "(n", "max", ",M", "//", "i", ")\u010a\u010a", "print", "(n", "max", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.5770524973423397, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02596", "input": "import sys\n\n\n\nreadline = sys.stdin.readline\n\nreadall = sys.stdin.read\n\nns = lambda: readline().rstrip()\n\nni = lambda: int(readline().rstrip())\n\nnm = lambda: map(int, readline().split())\n\nnl = lambda: list(map(int, readline().split()))\n\nprn = lambda x: print(*x, sep='\\n')\n\n\n\ndef solve():\n\n d = dict()\n\n k = ni()\n\n c = 7 % k\n\n x = d[c] = 1\n\n while True:\n\n c = (c * 10 + 7) % k\n\n if c in d:\n\n break\n\n x += 1\n\n d[c] = x\n\n print(d.get(0, -1))\n\n return\n\n\n\nsolve()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "read", "all", "\u0120=", "\u0120sys", ".stdin", ".read", "\u010a\u010a", "ns", "\u0120=", "\u0120lambda", ":", "\u0120readline", "().", "rstrip", "()\u010a\u010a", "ni", "\u0120=", "\u0120lambda", ":", "\u0120int", "(read", "line", "().", "rstrip", "())\u010a\u010a", "nm", "\u0120=", "\u0120lambda", ":", "\u0120map", "(int", ",", "\u0120readline", "().", "split", "())\u010a\u010a", "nl", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(int", ",", "\u0120readline", "().", "split", "()))\u010a\u010a", "pr", "n", "\u0120=", "\u0120lambda", "\u0120x", ":", "\u0120print", "(*", "x", ",", "\u0120sep", "='\\", "n", "')\u010a\u010a\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120dict", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120ni", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120", "7", "\u0120%", "\u0120k", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120d", "[c", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120(", "c", "\u0120*", "\u0120", "1", "0", "\u0120+", "\u0120", "7", ")", "\u0120%", "\u0120k", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120c", "\u0120in", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[c", "]", "\u0120=", "\u0120x", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(d", ".get", "(", "0", ",", "\u0120-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "solve", "()\u010a"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.8116478083709829, 0.579389560544, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8691775287719905]} +{"problem_id": "p02959", "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nN = int(input())\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\nbefore = sum(A)\n\n\n\nfor i in range(N):\n\n nokori = B[i]\n\n for j in range(i,i+2):\n\n if nokori >= A[j]:\n\n nokori -= A[j]\n\n A[j] = 0\n\n else:\n\n A[j] -= nokori\n\n nokori = 0\n\nafter = sum(A)\n\n\n\nprint((before - after))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "7", ")\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "B", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "before", "\u0120=", "\u0120sum", "(A", ")\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120nok", "ori", "\u0120=", "\u0120B", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", ",i", "+", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120nok", "ori", "\u0120>=", "\u0120A", "[j", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nok", "ori", "\u0120-=", "\u0120A", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "[j", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "[j", "]", "\u0120-=", "\u0120nok", "ori", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nok", "ori", "\u0120=", "\u0120", "0", "\u010a\u010a", "after", "\u0120=", "\u0120sum", "(A", ")\u010a\u010a\u010a\u010a", "print", "((", "before", "\u0120-", "\u0120after", "))"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.6588494518362031, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p03457", "input": "N = int(input())\n\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\n\nfor i in range(N):\n\n t1, x1, y1 = txy[i]\n\n t2, x2, y2 = txy[i+1]\n\n if abs(x2-x1) + abs(y2-y1) <= t2 - t1 and (x1+y1+x2+y2) % 2 == (t2-t1) % 2:\n\n continue\n\n else:\n\n print('No')\n\n exit()\n\nprint('Yes')", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "tx", "y", "\u0120=", "\u0120[(", "0", ",", "\u0120", "0", ",", "\u0120", "0", ")]", "\u0120+", "\u0120[", "tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "1", ",", "\u0120x", "1", ",", "\u0120y", "1", "\u0120=", "\u0120t", "xy", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "2", ",", "\u0120x", "2", ",", "\u0120y", "2", "\u0120=", "\u0120t", "xy", "[i", "+", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120abs", "(x", "2", "-x", "1", ")", "\u0120+", "\u0120abs", "(y", "2", "-y", "1", ")", "\u0120<=", "\u0120t", "2", "\u0120-", "\u0120t", "1", "\u0120and", "\u0120(", "x", "1", "+y", "1", "+x", "2", "+y", "2", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120(", "t", "2", "-t", "1", ")", "\u0120%", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "print", "('", "Yes", "')"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308]} +{"problem_id": "p02834", "input": "n,u,v=list(map(int,input().split()))\n\nanss=0\n\nu-=1\n\nv-=1\n\nd=[[]for _ in range(n)]\n\ninf=float('inf')\n\naoki=[inf]*n\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n d[a].append(b)\n\n d[b].append(a)\n\nQ=d[v]\n\naoki[v]=0\n\ndis=1\n\nvisited={v}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n aoki[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[u]\n\nchokudai=[-1]*n\n\nchokudai[u]=0\n\ndis=1\n\nvisited={u}\n\npoint=-1\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if aoki[j]<=dis+1:\n\n if aoki[j]==dis+1:anss=1\n\n if point<0:point=i\n\n continue\n\n if j not in visited:P.append(j)\n\n chokudai[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[point]\n\ndis=chokudai[point]+1\n\nvisited={point}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n if chokudai[i]==-1:continue\n\n chokudai[i]=max(dis,chokudai[i])\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n dis+=1\n\n Q=P\n\nans=0\n\nfor i in range(n):\n\n if aoki[i]>chokudai[i]:ans=max(ans,chokudai[i])\n\nprint((ans+anss))\n\n#print(aoki)\n\n#print(chokudai)", "input_tokens": ["n", ",u", ",v", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "s", "=", "0", "\u010a\u010a", "u", "-=", "1", "\u010a\u010a", "v", "-=", "1", "\u010a\u010a", "d", "=[", "[]", "for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "inf", "=float", "('", "inf", "')\u010a\u010a", "a", "oki", "=[", "inf", "]*", "n", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120", "\u0120a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120a", "-=", "1", "\u010a\u010a", "\u0120", "\u0120b", "-=", "1", "\u010a\u010a", "\u0120", "\u0120d", "[a", "].", "append", "(b", ")\u010a\u010a", "\u0120", "\u0120d", "[b", "].", "append", "(a", ")\u010a\u010a", "Q", "=d", "[v", "]\u010a\u010a", "a", "oki", "[v", "]=", "0", "\u010a\u010a", "dis", "=", "1", "\u010a\u010a", "visited", "={", "v", "}\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120", "\u0120P", "=[]", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120visited", ".add", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120d", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120not", "\u0120in", "\u0120visited", ":P", ".append", "(j", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "oki", "[i", "]=", "dis", "\u010a\u010a", "\u0120", "\u0120dis", "+=", "1", "\u010a\u010a", "\u0120", "\u0120Q", "=P", "\u010a\u010a", "Q", "=d", "[u", "]\u010a\u010a", "ch", "ok", "ud", "ai", "=[", "-", "1", "]*", "n", "\u010a\u010a", "ch", "ok", "ud", "ai", "[u", "]=", "0", "\u010a\u010a", "dis", "=", "1", "\u010a\u010a", "visited", "={", "u", "}\u010a\u010a", "point", "=-", "1", "\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120", "\u0120P", "=[]", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120visited", ".add", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120d", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "oki", "[j", "]<=", "dis", "+", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "oki", "[j", "]==", "dis", "+", "1", ":", "ans", "s", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120point", "<", "0", ":", "point", "=i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120not", "\u0120in", "\u0120visited", ":P", ".append", "(j", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ch", "ok", "ud", "ai", "[i", "]=", "dis", "\u010a\u010a", "\u0120", "\u0120dis", "+=", "1", "\u010a\u010a", "\u0120", "\u0120Q", "=P", "\u010a\u010a", "Q", "=d", "[", "point", "]\u010a\u010a", "dis", "=", "ch", "ok", "ud", "ai", "[", "point", "]+", "1", "\u010a\u010a", "visited", "={", "point", "}\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120", "\u0120P", "=[]", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120visited", ".add", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ch", "ok", "ud", "ai", "[i", "]==", "-", "1", ":", "continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ch", "ok", "ud", "ai", "[i", "]=", "max", "(dis", ",ch", "ok", "ud", "ai", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120d", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120not", "\u0120in", "\u0120visited", ":P", ".append", "(j", ")\u010a\u010a", "\u0120", "\u0120dis", "+=", "1", "\u010a\u010a", "\u0120", "\u0120Q", "=P", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120a", "oki", "[i", "]>", "ch", "ok", "ud", "ai", "[i", "]:", "ans", "=max", "(ans", ",ch", "ok", "ud", "ai", "[i", "])\u010a\u010a", "print", "((", "ans", "+", "ans", "s", "))\u010a\u010a", "#print", "(a", "oki", ")\u010a\u010a", "#print", "(ch", "ok", "ud", "ai", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975]} +{"problem_id": "p02537", "input": "d=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()+d))\n\nfor i in range(n):d[i]=max(d[j]for j in range(i-99,i+1)if abs(a[i]-a[j])<=k)+1\n\nprint((max(d)))", "input_tokens": ["d", "=[", "0", "]*", "6", "**", "8", "\u010a\u010a", "n", ",k", ",*", "a", "=list", "(map", "(int", ",", "open", "(", "0", ").", "read", "().", "split", "()+", "d", "))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "d", "[i", "]=", "max", "(d", "[j", "]", "for", "\u0120j", "\u0120in", "\u0120range", "(i", "-", "9", "9", ",i", "+", "1", ")", "if", "\u0120abs", "(a", "[i", "]-", "a", "[j", "])", "<=", "k", ")+", "1", "\u010a\u010a", "print", "((", "max", "(d", ")))"], "input_token_weights": [0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.9094625571831276, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.7281392564472128, 0.7833854580549265, 0.7833854580549265, 0.860922050467044, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.7561438265913266, 0.6993277790098028, 0.6696615116992518, 0.6075505590312809, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6696615116992518, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8099046207685895, 0.8854867975141383]} +{"problem_id": "p02873", "input": "S = input()\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in range(len(lst)):\n\n if lst[i] > 0:\n\n ans += list(range(1,lst[i]+1))\n\n else:\n\n ans[-1] = max(ans[-1], -lst[i])\n\n ans += list(range(-lst[i]-1,-1, -1))\n\n\n\nprint((sum(ans)))\n", "input_tokens": ["S", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "lst", "\u0120=", "\u0120[", "1", "\u0120if", "\u0120S", "[", "0", "]=='", "<'", "\u0120else", "\u0120-", "1", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120len", "(S", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", "]", "\u0120==", "\u0120S", "[i", "\u0120-", "\u0120", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120lst", "[-", "1", "]", "\u0120+=", "\u0120", "1", "\u0120if", "\u0120S", "[i", "]=='", "<'", "\u0120else", "\u0120-", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120lst", ".append", "(-", "1", "\u0120if", "\u0120S", "[i", "]=='", ">'", "\u0120else", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "ans", "\u0120=", "\u0120[", "0", "]\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(lst", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120lst", "[i", "]", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120list", "(range", "(", "1", ",l", "st", "[i", "]+", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "[-", "1", "]", "\u0120=", "\u0120max", "(ans", "[-", "1", "],", "\u0120-", "lst", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120list", "(range", "(-", "lst", "[i", "]-", "1", ",-", "1", ",", "\u0120-", "1", "))", "\u010a\u010a\u010a\u010a", "print", "((", "sum", "(ans", ")))\u010a"], "input_token_weights": [0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8922045961188434, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.6911750402874859, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.8456076926739031, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7713695892187169, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.6911750402874859, 0.7453461554353482, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.7453461554353482, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.6911750402874859, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6629477592666795, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7453461554353482, 0.5731452134031394, 0.914713330925897, 0.8922045961188434, 0.8456076926739031, 0.8214688817838891, 0.8922045961188434]} +{"problem_id": "p03253", "input": "from math import floor, sqrt\n\nfrom collections import defaultdict\n\ndef factors(n):\n\n d = defaultdict(int)\n\n for i in range(2,floor(sqrt(n))+1):\n\n while n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n if n == 1:\n\n break\n\n if n != 1:\n\n d[n] += 1\n\n return d\n\ndef inv(x, mod):\n\n k = mod - 2\n\n ret = 1\n\n while k > 0:\n\n if k&1:\n\n ret = (ret*x) % mod\n\n x = (x*x) % mod\n\n k >>= 1\n\n return ret\n\nN, M = list(map(int,input().split()))\n\nmod = 10**9+7\n\ndic = factors(M)\n\nK = len(dic)\n\nSIZE = N+max(dic.values()) if list(dic.values()) else N\n\nfact = [None]*(SIZE+1)\n\nfinv = [None]*(SIZE+1)\n\nfact[0] = 1\n\nfor i in range(1,SIZE+1):\n\n fact[i] = (fact[i-1]*i) % mod\n\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\n\nfor i in range(SIZE, 0, -1):\n\n finv[i-1] = (finv[i]*i) % mod\n\ndef comb(n,k):\n\n tmp = (finv[k]*finv[n-k]) % mod\n\n return (fact[n]*tmp) % mod\n\nans = 1\n\nfor p in dic:\n\n ans = (ans*comb(dic[p]+N-1, dic[p])) % mod\n\nprint(ans)", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120floor", ",", "\u0120sqrt", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "def", "\u0120factors", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",f", "loor", "(sqrt", "(n", "))+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120n", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120//=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[i", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[n", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120d", "\u010a\u010a", "def", "\u0120inv", "(x", ",", "\u0120mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120mod", "\u0120-", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120k", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", "&", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120(", "ret", "*x", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "*x", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "\u0120>>=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "dic", "\u0120=", "\u0120factors", "(M", ")\u010a\u010a", "K", "\u0120=", "\u0120len", "(dic", ")\u010a\u010a", "SIZE", "\u0120=", "\u0120N", "+", "max", "(dic", ".values", "())", "\u0120if", "\u0120list", "(dic", ".values", "())", "\u0120else", "\u0120N", "\u010a\u010a", "fact", "\u0120=", "\u0120[", "None", "]*(", "SIZE", "+", "1", ")\u010a\u010a", "fin", "v", "\u0120=", "\u0120[", "None", "]*(", "SIZE", "+", "1", ")\u010a\u010a", "fact", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "SIZE", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fact", "[i", "]", "\u0120=", "\u0120(", "fact", "[i", "-", "1", "]*", "i", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "fin", "v", "[", "SIZE", "]", "\u0120=", "\u0120inv", "(f", "act", "[", "SIZE", "],", "\u0120mod", "=", "mod", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(S", "IZE", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fin", "v", "[i", "-", "1", "]", "\u0120=", "\u0120(", "fin", "v", "[i", "]*", "i", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "def", "\u0120comb", "(n", ",k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120(", "fin", "v", "[k", "]*", "fin", "v", "[n", "-k", "])", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "fact", "[n", "]*", "tmp", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120dic", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120(", "ans", "*", "comb", "(dic", "[p", "]+", "N", "-", "1", ",", "\u0120dic", "[p", "]))", "\u0120%", "\u0120mod", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7967329450848046, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03416", "input": "a , b = input().split()\n\na = int(a)\n\nb = int(b)\n\ncount=0\n\nfor i in range(a,b+1):\n\n test = list(str(i))\n\n if (test[0] == test[4]) and (test[1]==test[3]):\n\n count=count+1\n\nprint(count)", "input_tokens": ["a", "\u0120,", "\u0120b", "\u0120=", "\u0120input", "().", "split", "()\u010a\u010a", "a", "\u0120=", "\u0120int", "(a", ")\u010a\u010a", "b", "\u0120=", "\u0120int", "(b", ")\u010a\u010a", "count", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120test", "\u0120=", "\u0120list", "(str", "(i", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "test", "[", "0", "]", "\u0120==", "\u0120test", "[", "4", "])", "\u0120and", "\u0120(", "test", "[", "1", "]==", "test", "[", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "=count", "+", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.833611120734537, 0.833611120734537, 0.833611120734537, 0.8691775287719905, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.7186273667339679, 0.5886835746651548, 0.833611120734537, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.7967329450848046, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.8691775287719905, 0.833611120734537, 0.833611120734537]} +{"problem_id": "p03835", "input": "K,S=list(map(int,input().split()))\n\nO=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n O+=1\n\nprint(O)\n", "input_tokens": ["K", ",S", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "O", "=", "0", "\u010a\u010a", "for", "\u0120X", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120Y", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120Z", "=S", "-X", "-Y", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "<=", "Z", "<=", "K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120O", "+=", "1", "\u010a\u010a", "print", "(O", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p04020", "input": "import sys\n\nstdin = sys.stdin\n\n \n\nsys.setrecursionlimit(10**8) \n\n \n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x)-1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\n\n\nn = ni()\n\na = [ni() for _ in range(n)]\n\n\n\ncnt = {i+1: ai for i, ai in enumerate(a)}\n\n\n\nprev = -100\n\ncur = 0\n\nans = 0\n\nfor key in sorted(cnt.keys()):\n\n if cnt[key] == 0:\n\n continue\n\n \n\n if prev == -100:\n\n prev = key\n\n \n\n if (key-prev) < 2:\n\n cur += cnt[key]\n\n else:\n\n cur = cnt[key]\n\n \n\n ans += cur // 2\n\n cur -= 2 * (cur//2)\n\n \n\n prev = key\n\n \n\nprint(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "stdin", "\u0120=", "\u0120sys", ".stdin", "\u010a\u010a", "\u0120\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "8", ")", "\u0120\u010a\u010a", "\u0120\u010a\u010a", "def", "\u0120li", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120li", "_", "():", "\u0120return", "\u0120[", "int", "(x", ")-", "1", "\u0120for", "\u0120x", "\u0120in", "\u0120stdin", ".readline", "().", "split", "()]\u010a\u010a", "def", "\u0120lf", "():", "\u0120return", "\u0120list", "(map", "(float", ",", "\u0120stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120ls", "():", "\u0120return", "\u0120stdin", ".readline", "().", "split", "()\u010a\u010a", "def", "\u0120ns", "():", "\u0120return", "\u0120stdin", ".readline", "().", "rstrip", "()\u010a\u010a", "def", "\u0120lc", "():", "\u0120return", "\u0120list", "(ns", "())\u010a\u010a", "def", "\u0120ni", "():", "\u0120return", "\u0120int", "(stdin", ".readline", "())\u010a\u010a", "def", "\u0120nf", "():", "\u0120return", "\u0120float", "(stdin", ".readline", "())\u010a\u010a", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120ni", "()\u010a\u010a", "a", "\u0120=", "\u0120[", "ni", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120{", "i", "+", "1", ":", "\u0120ai", "\u0120for", "\u0120i", ",", "\u0120ai", "\u0120in", "\u0120enumerate", "(a", ")", "}\u010a\u010a\u010a\u010a", "prev", "\u0120=", "\u0120-", "1", "0", "0", "\u010a\u010a", "cur", "\u0120=", "\u0120", "0", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120key", "\u0120in", "\u0120sorted", "(cnt", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "[key", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120prev", "\u0120==", "\u0120-", "1", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120key", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "key", "-prev", ")", "\u0120<", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120+=", "\u0120cnt", "[key", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120=", "\u0120cnt", "[key", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cur", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cur", "\u0120-=", "\u0120", "2", "\u0120*", "\u0120(", "cur", "//", "2", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120key", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03164", "input": "def main():\n\n N, W = list(map(int, input().split()))\n\n w = [0] * N\n\n v = [0] * N\n\n for i in range(N):\n\n w[i], v[i] = list(map(int, input().split()))\n\n\n\n max_v = max(v)\n\n dp = [[float('inf')] * (max_v * N + 5) for _ in range(N + 5)]\n\n\n\n dp[0][0] = 0\n\n\n\n for i in range(N):\n\n for j in range(max_v * N):\n\n if j + v[i] <= max_v * N:\n\n dp[i+1][j + v[i]] = min(dp[i+1][j + v[i]], dp[i][j] + w[i])\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j]) \n\n\n\n ans = 0\n\n for j in range(max_v * N + 1):\n\n if dp[N][j] <= W:\n\n ans = j\n\n\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120W", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120N", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120N", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120w", "[i", "],", "\u0120v", "[i", "]", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "_v", "\u0120=", "\u0120max", "(v", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[[", "float", "('", "inf", "')]", "\u0120*", "\u0120(", "max", "_v", "\u0120*", "\u0120N", "\u0120+", "\u0120", "5", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "\u0120+", "\u0120", "5", ")]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(max", "_v", "\u0120*", "\u0120N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120+", "\u0120v", "[i", "]", "\u0120<=", "\u0120max", "_v", "\u0120*", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "\u0120+", "\u0120v", "[i", "]]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "j", "\u0120+", "\u0120v", "[i", "]],", "\u0120dp", "[i", "][", "j", "]", "\u0120+", "\u0120w", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "j", "],", "\u0120dp", "[i", "][", "j", "])", "\u0120\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(max", "_v", "\u0120*", "\u0120N", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[N", "][", "j", "]", "\u0120<=", "\u0120W", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120j", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.7847988758021361, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.808526270355906, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6838237134005932, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p03309", "input": "n = int(input())\n\na = list(map(int,input().split()))\n\naa = []\n\nfor i in range(n):\n\n aa.append(a[i]-(i+1))\n\nb = (sorted(aa)[n//2])\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans += abs(a[i]-(b+i+1))\n\nprint(ans)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "aa", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120aa", ".append", "(a", "[i", "]", "-(", "i", "+", "1", "))\u010a\u010a", "b", "\u0120=", "\u0120(", "sorted", "(aa", ")[", "n", "//", "2", "])\u010a\u010a", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120abs", "(a", "[i", "]", "-(", "b", "+i", "+", "1", "))\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02794", "input": "N = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(input())\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\nD = {1<>= 17\n\n bc += BC[aa % (1<<17)]\n\n aa >>= 17\n\n bc += BC[aa]\n\n CC[N - 1 - bc] += (1 if BC[m%1024] + BC[m>>10] & 1 == 0 else -1)\n\n\n\nprint((sum([2 ** i * CC[i] for i in range(N)])))", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "X", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "[x", "-", "1", "].", "append", "(y", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "[y", "-", "1", "].", "append", "(x", "-", "1", ")\u010a\u010a\u010a\u010a", "P", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120N", "\u010a\u010a", "DE", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120N", "\u010a\u010a", "Q", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120Q", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120X", "[i", "][", "::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120!=", "\u0120P", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120P", "[a", "]", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120DE", "[a", "]", "\u0120=", "\u0120DE", "[i", "]", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120X", "[a", "].", "remove", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Q", ".append", "(a", ")\u010a\u010a\u010a\u010a", "def", "\u0120lp", "(u", ",", "\u0120v", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120u", "\u0120!=", "\u0120v", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120DE", "[u", "]", "\u0120>", "\u0120DE", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120", "1", "\u0120<<", "\u0120u", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120u", "\u0120=", "\u0120P", "[u", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120DE", "[u", "]", "\u0120<", "\u0120DE", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120", "1", "\u0120<<", "\u0120v", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120P", "[v", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120", "1", "\u0120<<", "\u0120u", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120", "1", "\u0120<<", "\u0120v", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120u", "\u0120=", "\u0120P", "[u", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120P", "[v", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120t", "\u010a\u010a\u010a\u010a", "Y", "\u0120=", "\u0120[]\u010a\u010a", "M", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120a", "-", "1", ",", "\u0120b", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120Y", ".append", "(lp", "(a", ",", "\u0120b", "))", "\u010a\u010a\u010a\u010a", "D", "\u0120=", "\u0120{", "1", "<<", "i", ":", "\u0120i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "5", "0", ")}\u010a\u010a", "Z", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "1", "<<", "M", ")\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "CC", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120N", "\u010a\u010a", "BC", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "1", "<<", "1", "7", ")\u010a\u010a", "for", "\u0120m", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "<<", "1", "7", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120m", "\u0120&", "\u0120(-", "m", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120BC", "[m", "]", "\u0120=", "\u0120BC", "[m", "^", "a", "]", "\u0120+", "\u0120", "1", "\u010a\u010a", "for", "\u0120m", "\u0120in", "\u0120range", "(", "1", "<<", "M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120m", "\u0120&", "\u0120(-", "m", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120==", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Z", "[m", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Z", "[m", "]", "\u0120=", "\u0120Y", "[D", "[a", "]]\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Z", "[m", "]", "\u0120=", "\u0120Z", "[m", "^", "a", "]", "\u0120|", "\u0120Y", "[D", "[a", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120aa", "\u0120=", "\u0120Z", "[m", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120bc", "\u0120=", "\u0120BC", "[", "aa", "\u0120%", "\u0120(", "1", "<<", "1", "7", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120aa", "\u0120>>=", "\u0120", "1", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120bc", "\u0120+=", "\u0120BC", "[", "aa", "\u0120%", "\u0120(", "1", "<<", "1", "7", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120aa", "\u0120>>=", "\u0120", "1", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120bc", "\u0120+=", "\u0120BC", "[", "aa", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120CC", "[N", "\u0120-", "\u0120", "1", "\u0120-", "\u0120bc", "]", "\u0120+=", "\u0120(", "1", "\u0120if", "\u0120BC", "[m", "%", "1", "0", "2", "4", "]", "\u0120+", "\u0120BC", "[m", ">>", "1", "0", "]", "\u0120&", "\u0120", "1", "\u0120==", "\u0120", "0", "\u0120else", "\u0120-", "1", ")\u010a\u010a\u010a\u010a", "print", "((", "sum", "([", "2", "\u0120**", "\u0120i", "\u0120*", "\u0120CC", "[i", "]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]", ")))"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.7681534551894282, 0.8778749353275308]} +{"problem_id": "p03078", "input": "\n\nfrom heapq import heappop, heappush\n\n\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\npq = []\n\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\n\nappeared = set((0, 0, 0))\n\n\n\nfor _ in range(K):\n\n # Pop maximum value\n\n val, i, j, k = heappop(pq)\n\n print((-val))\n\n\n\n # Add next value\n\n if i + 1 < X and (i + 1, j, k) not in appeared:\n\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n\n appeared.add((i + 1, j, k))\n\n\n\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n\n appeared.add((i, j + 1, k))\n\n\n\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n\n appeared.add((i, j, k + 1))\n", "input_tokens": ["\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "op", ",", "\u0120he", "app", "ush", "\u010a\u010a\u010a\u010a", "X", ",", "\u0120Y", ",", "\u0120Z", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "C", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "A", ".sort", "(reverse", "=True", ")\u010a\u010a", "B", ".sort", "(reverse", "=True", ")\u010a\u010a", "C", ".sort", "(reverse", "=True", ")\u010a\u010a\u010a\u010a", "pq", "\u0120=", "\u0120[]\u010a\u010a", "he", "app", "ush", "(p", "q", ",", "\u0120(-", "A", "[", "0", "]", "\u0120-", "\u0120B", "[", "0", "]", "\u0120-", "\u0120C", "[", "0", "],", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "))\u010a\u010a", "appeared", "\u0120=", "\u0120set", "((", "0", ",", "\u0120", "0", ",", "\u0120", "0", "))", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120Pop", "\u0120maximum", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120val", ",", "\u0120i", ",", "\u0120j", ",", "\u0120k", "\u0120=", "\u0120he", "app", "op", "(p", "q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "val", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120Add", "\u0120next", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120+", "\u0120", "1", "\u0120<", "\u0120X", "\u0120and", "\u0120(", "i", "\u0120+", "\u0120", "1", ",", "\u0120j", ",", "\u0120k", ")", "\u0120not", "\u0120in", "\u0120appeared", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120he", "app", "ush", "(p", "q", ",", "\u0120(-", "A", "[i", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120B", "[j", "]", "\u0120-", "\u0120C", "[k", "],", "\u0120i", "\u0120+", "\u0120", "1", ",", "\u0120j", ",", "\u0120k", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120appeared", ".add", "((", "i", "\u0120+", "\u0120", "1", ",", "\u0120j", ",", "\u0120k", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Y", "\u0120and", "\u0120(", "i", ",", "\u0120j", "\u0120+", "\u0120", "1", ",", "\u0120k", ")", "\u0120not", "\u0120in", "\u0120appeared", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120he", "app", "ush", "(p", "q", ",", "\u0120(-", "A", "[i", "]", "\u0120-", "\u0120B", "[j", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120C", "[k", "],", "\u0120i", ",", "\u0120j", "\u0120+", "\u0120", "1", ",", "\u0120k", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120appeared", ".add", "((", "i", ",", "\u0120j", "\u0120+", "\u0120", "1", ",", "\u0120k", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120k", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Z", "\u0120and", "\u0120(", "i", ",", "\u0120j", ",", "\u0120k", "\u0120+", "\u0120", "1", ")", "\u0120not", "\u0120in", "\u0120appeared", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120he", "app", "ush", "(p", "q", ",", "\u0120(-", "A", "[i", "]", "\u0120-", "\u0120B", "[j", "]", "\u0120-", "\u0120C", "[k", "\u0120+", "\u0120", "1", "],", "\u0120i", ",", "\u0120j", ",", "\u0120k", "\u0120+", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120appeared", ".add", "((", "i", ",", "\u0120j", ",", "\u0120k", "\u0120+", "\u0120", "1", "))\u010a"], "input_token_weights": [0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.860922050467044, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.6390881791778984, 0.6390881791778984, 0.6075505590312809, 0.5749858371565393, 0.6075505590312809, 0.6390881791778984, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.6696615116992518, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6696615116992518, 0.5749858371565393, 0.6696615116992518, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7833854580549265]} +{"problem_id": "p02773", "input": "import collections\n\nn = int(input())\n\na=[input() for _ in range(n)]\n\nanslist=[]\n\nb=collections.Counter(a)\n\nc=max(list(b.values()))\n\nfor i in b:\n\n if b[i]==c:\n\n anslist.append(i)\n\nd=sorted(anslist)\n\nfor i in tuple(d):\n\n print(i)", "input_tokens": ["import", "\u0120collections", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "=[", "input", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "ans", "list", "=[]", "\u010a\u010a", "b", "=c", "ollections", ".Counter", "(a", ")\u010a\u010a", "c", "=max", "(list", "(b", ".values", "()))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120b", "[i", "]==", "c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "list", ".append", "(i", ")\u010a\u010a", "d", "=", "sorted", "(ans", "list", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120tuple", "(d", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(i", ")"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7186273667339679, 0.6339004969859428, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994]} +{"problem_id": "p03371", "input": "a,b,c,x,y = list(map(int,input().split()))\n\nxy = max(x,y)*2+1\n\nprint((min([c*i + max(0,a*(x-i//2)) +max(0,b*(y-i//2)) for i in range(0,xy,2)])))", "input_tokens": ["a", ",b", ",c", ",x", ",y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "xy", "\u0120=", "\u0120max", "(x", ",y", ")*", "2", "+", "1", "\u010a\u010a", "print", "((", "min", "([", "c", "*i", "\u0120+", "\u0120max", "(", "0", ",a", "*(", "x", "-i", "//", "2", "))", "\u0120+", "max", "(", "0", ",b", "*(", "y", "-i", "//", "2", "))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "xy", ",", "2", ")]", ")))"], "input_token_weights": [0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.8765066796615488, 0.9193881350322848, 0.9193881350322848, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9193881350322848, 0.8981772421402056, 0.8543560820723151, 0.8317036996956922, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.6838237134005932, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.7100393521462953, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.6569022703191485, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.7355852514485495, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.808526270355906, 0.8981772421402056]} +{"problem_id": "p02412", "input": "while True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == sum([s, m, e]):\n\n count += 1\n\n\n\n print(count)", "input_tokens": ["while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120x", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120x", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120s", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120-", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120m", "\u0120in", "\u0120range", "(s", "\u0120+", "\u0120", "1", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120e", "\u0120in", "\u0120range", "(m", "\u0120+", "\u0120", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120sum", "([", "s", ",", "\u0120m", ",", "\u0120e", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(count", ")"], "input_token_weights": [0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.7833854580549265, 0.5749858371565393, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6696615116992518, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.7281392564472128, 0.5749858371565393, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8357386476069529]} +{"problem_id": "p02837", "input": "n = int(input())\n\nv = [[tuple(map(int, input().split()))for i in range(int(input()))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [False] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = True\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n if f[x - 1] is not bool(y):\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "v", "\u0120=", "\u0120[[", "tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "for", "\u0120i", "\u0120in", "\u0120range", "(int", "(input", "()))", "]\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "**", "n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120[", "False", "]", "\u0120*", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120xy", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "\u0120>>", "\u0120j", ")", "\u0120&", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "[j", "]", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120xy", ".append", "(v", "[j", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120flag", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120xy", "i", "\u0120in", "\u0120xy", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", ",", "\u0120y", "\u0120in", "\u0120xy", "i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120f", "[x", "\u0120-", "\u0120", "1", "]", "\u0120is", "\u0120not", "\u0120bool", "(y", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120flag", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120flag", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120len", "(xy", "))\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7084208560793558, 0.7681534551894282, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7681534551894282, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.7387330872699986, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03000", "input": "N,X = list(map(int,input().split()))\n\nL = [0] + [int(x) for x in input().split()]\n\n\n\nD = [0] * (N+2)\n\nanswer = 1\n\nfor n in range(2,N+2):\n\n D[n] = D[n-1] + L[n-1]\n\n if D[n] <= X:\n\n answer += 1\n\n \n\nprint(answer)", "input_tokens": ["N", ",X", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120[", "0", "]", "\u0120+", "\u0120[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "D", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "+", "2", ")\u010a\u010a", "answer", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120n", "\u0120in", "\u0120range", "(", "2", ",N", "+", "2", "):\u010a\u010a", "\u0120", "\u0120D", "[n", "]", "\u0120=", "\u0120D", "[n", "-", "1", "]", "\u0120+", "\u0120L", "[n", "-", "1", "]\u010a\u010a", "\u0120", "\u0120if", "\u0120D", "[n", "]", "\u0120<=", "\u0120X", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120answer", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(answer", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02983", "input": "mod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r//mod - l//mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l+1, r+1):\n\n for j in range(l, i):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)", "input_tokens": ["mod", "\u0120=", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "l", ",", "\u0120r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "if", "\u0120r", "//", "mod", "\u0120-", "\u0120l", "//", "mod", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120l", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120r", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120ans", "\u0120=", "\u0120mod", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(l", "+", "1", ",", "\u0120r", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(l", ",", "\u0120i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(i", "*j", "%", "mod", ",", "\u0120ans", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ans", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.5749858371565393, 0.9328769136071888, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.860922050467044, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.5749858371565393, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895]} +{"problem_id": "p03425", "input": "#!/usr/bin/env python3\n\n\n\nn = int(input())\n\ns = [input() for _ in range(n)]\n\n\n\nc = [0 for _ in range(5)]\n\nt = 'MARCH'\n\n\n\nfor i in range(n):\n\n for j in range(5):\n\n if s[i][0] == t[j]:\n\n c[j] += 1\n\nans = 0 \n\nfor i in range(5):\n\n for j in range(i+1, 5): \n\n for k in range(j+1, 5): \n\n ans += c[i]*c[k]*c[j]\n\nprint(ans)\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "s", "\u0120=", "\u0120[", "input", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "c", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "5", ")]\u010a\u010a", "t", "\u0120=", "\u0120'", "M", "ARCH", "'\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "5", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "][", "0", "]", "\u0120==", "\u0120t", "[j", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "[j", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u0120\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "5", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",", "\u0120", "5", "):", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(j", "+", "1", ",", "\u0120", "5", "):", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120c", "[i", "]*", "c", "[k", "]*", "c", "[j", "]\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p00053", "input": "prim=[True]*1000000\n\nprim[0],prim[1]=False,False\n\nfor i in range(2,1000):\n\n if prim[i]:\n\n for j in range(i*2,1000000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(input())\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))", "input_tokens": ["prim", "=[", "True", "]*", "1", "0", "0", "0", "0", "0", "0", "\u010a\u010a", "prim", "[", "0", "],", "prim", "[", "1", "]=", "False", ",False", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",", "1", "0", "0", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120prim", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "*", "2", ",", "1", "0", "0", "0", "0", "0", "0", ",i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prim", "[j", "]=", "False", "\u010a\u010a", "prime", "=[", "i", "\u0120for", "\u0120i", ",j", "\u0120in", "\u0120enumerate", "(", "prim", ")", "\u0120if", "\u0120j", "==", "True", "]\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "sum", "(pr", "ime", "[:", "n", "])))"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.7967329450848046]} +{"problem_id": "p03037", "input": "n, m = list(map(int, input().split()))\n\ngate = []\n\nl, r = list(map(int, input().split()))\n\nfor i in range(1, m):\n\n m, s = list(map(int, input().split()))\n\n if l < m:\n\n l = m\n\n if s < r:\n\n r = s\n\nprint((len([i for i in range(l, r + 1)])))", "input_tokens": ["n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "gate", "\u0120=", "\u0120[]\u010a\u010a", "l", ",", "\u0120r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", ",", "\u0120s", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120<", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120<", "\u0120r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120s", "\u010a\u010a", "print", "((", "len", "([", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(l", ",", "\u0120r", "\u0120+", "\u0120", "1", ")]", ")))"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.7681534551894282, 0.8778749353275308]} +{"problem_id": "p02596", "input": "K=int(input())\n\n\n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n \n\nans=[0]*(pow(10,6)+1)\n\nans[0]=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n ans[i]=(ans[i-1]*10+7)%K\n\n if ans[i]==0:\n\n print(i)\n\n exit(0)\n\n\n\nprint((-1))", "input_tokens": ["K", "=int", "(input", "())\u010a\u010a", "\u010a\u010a", "if", "\u0120K", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "ans", "=[", "0", "]*(", "pow", "(", "1", "0", ",", "6", ")+", "1", ")\u010a\u010a", "ans", "[", "0", "]=", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",p", "ow", "(", "1", "0", ",", "6", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "[i", "]=(", "ans", "[i", "-", "1", "]*", "1", "0", "+", "7", ")%", "K", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ans", "[i", "]==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a\u010a\u010a", "print", "((-", "1", "))"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8591441175808593, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p02537", "input": "def segfunc(x, y): return max(x, y)\n\n\n\nclass SegmentTree:\n\n def __init__(self, arr):\n\n size = len(arr)\n\n n = 2 ** (size - 1).bit_length()\n\n self.n = n\n\n self.node = [0] * (2*n)\n\n for i in range(size):\n\n self.node[i+n-1] = arr[i]\n\n for i in reversed(list(range(n-2))):\n\n self.node[i] = segfunc(self.node[2*i+1], self.node[2*i+2])\n\n\n\n def update(self, i, x):\n\n i += self.n - 1\n\n self.node[i] = x\n\n while i > 0:\n\n i = (i - 1) // 2\n\n self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])\n\n\n\n def update(self, x, val):\n\n x += (self.n - 1)\n\n self.node[x] = val\n\n while x > 0:\n\n x = (x - 1) // 2\n\n self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])\n\n\n\n def query(self, a, b):\n\n res = 0\n\n l = self.n - 1 + a\n\n r = self.n - 1 + (b - 1)\n\n\n\n while l <= r:\n\n if l == r:\n\n res = segfunc(res, self.node[l])\n\n break\n\n\n\n if l % 2 == 0:\n\n res = segfunc(res, self.node[l])\n\n if r % 2 == 1:\n\n res = segfunc(res, self.node[r])\n\n l = l // 2\n\n r = r // 2 - 1\n\n\n\n return res\n\n\n\nN, K = list(map(int, input().split()))\n\nINF = 0\n\nseg = SegmentTree([0] * 300000)\n\nfor i in range(N):\n\n a = int(input())\n\n tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1\n\n seg.update(a, tmp)\n\nprint((seg.query(0, 300000)))\n", "input_tokens": ["def", "\u0120seg", "func", "(x", ",", "\u0120y", "):", "\u0120return", "\u0120max", "(x", ",", "\u0120y", ")\u010a\u010a\u010a\u010a", "class", "\u0120Segment", "Tree", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120arr", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120size", "\u0120=", "\u0120len", "(arr", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120", "2", "\u0120**", "\u0120(", "size", "\u0120-", "\u0120", "1", ").", "bit", "_length", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".n", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".node", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "2", "*n", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(size", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".node", "[i", "+n", "-", "1", "]", "\u0120=", "\u0120arr", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120reversed", "(list", "(range", "(n", "-", "2", ")))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".node", "[i", "]", "\u0120=", "\u0120seg", "func", "(self", ".node", "[", "2", "*i", "+", "1", "],", "\u0120self", ".node", "[", "2", "*i", "+", "2", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120update", "(self", ",", "\u0120i", ",", "\u0120x", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120self", ".n", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".node", "[i", "]", "\u0120=", "\u0120x", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120(", "i", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".node", "[i", "]", "\u0120=", "\u0120seg", "func", "(self", ".node", "[i", "\u0120*", "\u0120", "2", "\u0120+", "\u0120", "1", "],", "\u0120self", ".node", "[i", "\u0120*", "\u0120", "2", "\u0120+", "\u0120", "2", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120update", "(self", ",", "\u0120x", ",", "\u0120val", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120+=", "\u0120(", "self", ".n", "\u0120-", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".node", "[x", "]", "\u0120=", "\u0120val", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".node", "[x", "]", "\u0120=", "\u0120seg", "func", "(self", ".node", "[", "2", "\u0120*", "\u0120x", "\u0120+", "\u0120", "1", "],", "\u0120self", ".node", "[", "2", "\u0120*", "\u0120x", "\u0120+", "\u0120", "2", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120query", "(self", ",", "\u0120a", ",", "\u0120b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120self", ".n", "\u0120-", "\u0120", "1", "\u0120+", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120self", ".n", "\u0120-", "\u0120", "1", "\u0120+", "\u0120(", "b", "\u0120-", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120l", "\u0120<=", "\u0120r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120==", "\u0120r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120seg", "func", "(res", ",", "\u0120self", ".node", "[l", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120seg", "func", "(res", ",", "\u0120self", ".node", "[l", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120seg", "func", "(res", ",", "\u0120self", ".node", "[r", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120l", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120r", "\u0120//", "\u0120", "2", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120res", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "INF", "\u0120=", "\u0120", "0", "\u010a\u010a", "seg", "\u0120=", "\u0120Segment", "Tree", "([", "0", "]", "\u0120*", "\u0120", "3", "0", "0", "0", "0", "0", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120seg", ".query", "(max", "(a", "\u0120-", "\u0120K", ",", "\u0120", "0", "),", "\u0120min", "(a", "\u0120+", "\u0120K", ",", "\u0120", "3", "0", "0", "0", "0", "0", ")", "\u0120+", "\u0120", "1", ")", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120seg", ".update", "(a", ",", "\u0120tmp", ")\u010a\u010a", "print", "((", "seg", ".query", "(", "0", ",", "\u0120", "3", "0", "0", "0", "0", "0", ")))\u010a"], "input_token_weights": [0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.6911750402874859, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7453461554353482, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.6629477592666795, 0.6911750402874859, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.6911750402874859, 0.7186273667339679, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.5731452134031394, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.6629477592666795, 0.6911750402874859, 0.6339004969859428, 0.5731452134031394, 0.6339004969859428, 0.6629477592666795, 0.5731452134031394, 0.6629477592666795, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6339004969859428, 0.5731452134031394, 0.6339004969859428, 0.6629477592666795, 0.5731452134031394, 0.6629477592666795, 0.7186273667339679, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.6911750402874859, 0.7186273667339679, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.5731452134031394, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.6629477592666795, 0.6911750402874859, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.5731452134031394, 0.6629477592666795, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.5731452134031394, 0.6629477592666795, 0.7186273667339679, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6629477592666795, 0.5731452134031394, 0.7453461554353482, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6629477592666795, 0.5731452134031394, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6629477592666795, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.5731452134031394, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.7186273667339679, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7967329450848046, 0.7453461554353482, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.914713330925897, 0.8922045961188434, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434]} +{"problem_id": "p03037", "input": "N,M = list(map(int, input().split()))\n\nL = []\n\nR = []\n\nfor _ in range(M):\n\n l,r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n\n\nans = min(R)-max(L)+1\n\nif ans < 0:\n\n print((0))\n\nelse:\n\n print(ans)\n\n ", "input_tokens": ["N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120[]\u010a\u010a", "R", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120", "\u0120l", ",r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120L", ".append", "(l", ")\u010a\u010a", "\u0120", "\u0120R", ".append", "(r", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120min", "(R", ")-", "max", "(L", ")+", "1", "\u010a\u010a", "if", "\u0120ans", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.7967329450848046, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397]} +{"problem_id": "p03325", "input": "N = int(input())\n\n\n\nseq = list(map(int, input().split()))\n\n\n\ncnt = 0\n\n\n\nfor num in seq:\n\n while num % 2 == 0:\n\n cnt += 1\n\n num /= 2\n\n\n\nprint(cnt)\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "seq", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120num", "\u0120in", "\u0120seq", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120num", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120/=", "\u0120", "2", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03371", "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(input())\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = INF\n\n for k in range(100001):\n\n yen = 2 * c * k + max(0, x-k) * a + max(0, y-k) * b\n\n ans = min(ans, yen)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "6", ")\u010a\u010a", "#", "\u0120input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u0120\u0120\u0120", "\u0120####", "\u010a\u010a", "int", "1", "\u0120=", "\u0120lambda", "\u0120x", ":", "\u0120int", "(x", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "def", "\u0120II", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "def", "\u0120MI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120MI", "1", "():", "\u0120return", "\u0120list", "(map", "(int", "1", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120LI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120LI", "1", "():", "\u0120return", "\u0120list", "(map", "(int", "1", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120L", "LI", "(rows", "_number", "):", "\u0120return", "\u0120[", "LI", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(rows", "_number", ")]", "\u010a\u010a\u010a\u010a", "def", "\u0120print", "list", "(lst", ",", "\u0120k", "='\\", "n", "'):", "\u0120print", "((", "k", ".join", "(list", "(map", "(str", ",", "\u0120lst", "))", ")))\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120MI", "()\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120INF", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "1", "0", "0", "0", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120yen", "\u0120=", "\u0120", "2", "\u0120*", "\u0120c", "\u0120*", "\u0120k", "\u0120+", "\u0120max", "(", "0", ",", "\u0120x", "-k", ")", "\u0120*", "\u0120a", "\u0120+", "\u0120max", "(", "0", ",", "\u0120y", "-k", ")", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120yen", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120solve", "()\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8245182914059852, 0.9285282781079651, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p03845", "input": "n,t=int(input()),list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n", "input_tokens": ["n", ",t", "=int", "(input", "()),", "list", "(map", "(int", ",input", "().", "split", "()));", "T", "=sum", "(t", ")\u010a\u010a", "print", "(*", "[", "T", "-t", "[i", "-", "1", "]+", "j", "\u0120for", "\u0120i", ",j", "\u0120in", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(int", "(input", "()))", "]],", "sep", "='\\", "n", "')\u010a"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.9529241888335975, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.8778749353275308]} +{"problem_id": "p03363", "input": "n = int(input())\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum={}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n if str(i) in list(num.keys()):\n\n num[str(i)] += 1\n\n else:\n\n num[str(i)] = 1\n\nout = [i*(i-1)//2 for i in list(num.values()) if i>1]\n\nprint((sum(out)))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "S", "\u0120=", "\u0120[", "0", "]*(", "n", "+", "1", ")\u010a\u010a", "num", "={", "}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "[i", "+", "1", "]", "\u0120=", "\u0120S", "[i", "]", "\u0120+", "\u0120A", "[i", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120S", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120str", "(i", ")", "\u0120in", "\u0120list", "(num", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "[str", "(i", ")]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "[str", "(i", ")]", "\u0120=", "\u0120", "1", "\u010a\u010a", "out", "\u0120=", "\u0120[", "i", "*(", "i", "-", "1", ")//", "2", "\u0120for", "\u0120i", "\u0120in", "\u0120list", "(num", ".values", "())", "\u0120if", "\u0120i", ">", "1", "]\u010a\u010a", "print", "((", "sum", "(out", ")))"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.6588494518362031, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p02555", "input": "def resolve():\n\n base = 10**9+7\n\n S = int(input())\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(1, S+1):\n\n for u in range(i-2):\n\n dp[i] += dp[u]\n\n dp[i] %= base\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n", "input_tokens": ["def", "\u0120resolve", "():\u010a\u010a", "\u0120", "\u0120base", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120", "\u0120dp", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "S", "+", "1", ")\u010a\u010a", "\u0120", "\u0120dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120S", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120u", "\u0120in", "\u0120range", "(i", "-", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[u", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120%=", "\u0120base", "\u010a\u010a", "\u0120", "\u0120#", "\u0120print", "(dp", ")\u010a\u010a", "\u0120", "\u0120print", "((", "dp", "[S", "]%", "base", "))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120", "\u0120resolve", "()\u010a"], "input_token_weights": [0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.7792424376220217, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217, 0.6673426178365944, 0.6673426178365944, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217]} +{"problem_id": "p02792", "input": "N = int(input())\n\n\n\ntable = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n id1 = int(s[0])\n\n id2 = int(s[-1])\n\n table[id1][id2] += 1\n\n\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += table[i][j]*table[j][i]\n\n\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "table", "\u0120=", "\u0120[[", "0", "]*", "1", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120", "\u0120s", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120", "\u0120id", "1", "\u0120=", "\u0120int", "(s", "[", "0", "])\u010a\u010a", "\u0120", "\u0120id", "2", "\u0120=", "\u0120int", "(s", "[-", "1", "])\u010a\u010a", "\u0120", "\u0120table", "[id", "1", "][", "id", "2", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120table", "[i", "][", "j", "]*", "table", "[j", "][", "i", "]\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.6673426178365944, 0.7060506397782503, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p03796", "input": "n = int(input())\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (pow(10,9) + 7)\n\nprint(res)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "res", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120num", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120res", "\u0120=", "\u0120res", "\u0120*", "\u0120num", "\u010a\u010a", "\u0120", "\u0120res", "\u0120=", "\u0120res", "\u0120%", "\u0120(", "pow", "(", "1", "0", ",", "9", ")", "\u0120+", "\u0120", "7", ")\u010a\u010a", "print", "(res", ")"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.7060506397782503, 0.5851191688414608, 0.7060506397782503, 0.7433160191943734, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p03371", "input": "#!/usr/bin/env python3\n\nimport sys, math, math, itertools\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n mn = 1e9\n\n for i in range(0, 2*(max(X, Y)+1), 2):\n\n mn = min(mn, C*i+A*max(X-i//2, 0)+B*max(Y-i//2, 0))\n\n print((int(mn)))\n\n return\n\n\n\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "import", "\u0120sys", ",", "\u0120math", ",", "\u0120math", ",", "\u0120itertools", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "(A", ":", "\u0120int", ",", "\u0120B", ":", "\u0120int", ",", "\u0120C", ":", "\u0120int", ",", "\u0120X", ":", "\u0120int", ",", "\u0120Y", ":", "\u0120int", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120mn", "\u0120=", "\u0120", "1", "e", "9", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120", "2", "*(", "max", "(X", ",", "\u0120Y", ")+", "1", "),", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mn", "\u0120=", "\u0120min", "(m", "n", ",", "\u0120C", "*i", "+A", "*", "max", "(X", "-i", "//", "2", ",", "\u0120", "0", ")+", "B", "*", "max", "(Y", "-i", "//", "2", ",", "\u0120", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "int", "(m", "n", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120Generated", "\u0120by", "\u0120", "1", ".", "1", ".", "4", "\u0120https", "://", "github", ".com", "/", "ky", "ur", "iden", "am", "ida", "/at", "coder", "-tools", "\u0120", "\u0120(", "tips", ":", "\u0120You", "\u0120use", "\u0120the", "\u0120default", "\u0120template", "\u0120now", ".", "\u0120You", "\u0120can", "\u0120remove", "\u0120this", "\u0120line", "\u0120by", "\u0120using", "\u0120your", "\u0120custom", "\u0120template", ")\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120iterate", "_tokens", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120line", "\u0120in", "\u0120sys", ".stdin", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120word", "\u0120in", "\u0120line", ".split", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120yield", "\u0120word", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tokens", "\u0120=", "\u0120iterate", "_tokens", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120B", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120Y", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120solve", "(A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6569022703191485, 0.5714954628602014, 0.6569022703191485, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.5714954628602014, 0.6838237134005932, 0.7847988758021361, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.76049478068099, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.8317036996956922, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.8317036996956922, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.8317036996956922, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.8317036996956922, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.8317036996956922, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p03038", "input": "import sys\n\nfrom operator import itemgetter\n\n\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, sys.stdin.readline().split()))\n\nbc = [ tuple(map(int, x.split())) for x in sys.stdin.readlines()]\n\nbc.sort(key = itemgetter(1), reverse=True)\n\nbc.append((n,0))\n\ndiff = []\n\nfor b, c in bc:\n\n diff += [c] * b\n\n if len(diff) > n:\n\n break\n\n\n\na += diff\n\na.sort()\n\nprint((sum(a[-n:])))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "from", "\u0120operator", "\u0120import", "\u0120item", "getter", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "bc", "\u0120=", "\u0120[", "\u0120tuple", "(map", "(int", ",", "\u0120x", ".split", "()))", "\u0120for", "\u0120x", "\u0120in", "\u0120sys", ".stdin", ".readlines", "()]\u010a\u010a", "bc", ".sort", "(key", "\u0120=", "\u0120item", "getter", "(", "1", "),", "\u0120reverse", "=True", ")\u010a\u010a", "bc", ".append", "((", "n", ",", "0", "))\u010a\u010a", "diff", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120bc", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120diff", "\u0120+=", "\u0120[", "c", "]", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(diff", ")", "\u0120>", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "a", "\u0120+=", "\u0120diff", "\u010a\u010a", "a", ".sort", "()\u010a\u010a", "print", "((", "sum", "(a", "[-", "n", ":]", ")))\u010a"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.8691775287719905]} +{"problem_id": "p02917", "input": "N = int(input())\n\nB =list(map(int,input().split()))\n\nA=[0]*N\n\n\n\nA[0]=B[0]\n\nfor i in range(1,N-1):\n\n A[i]=min(B[i],B[i-1])\n\nA[-1]=B[-1]\n\nprint((sum(A)))", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "B", "\u0120=", "list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "A", "=[", "0", "]*", "N", "\u010a\u010a\u010a\u010a", "A", "[", "0", "]=", "B", "[", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "[i", "]=", "min", "(B", "[i", "],", "B", "[i", "-", "1", "])\u010a\u010a", "A", "[-", "1", "]=", "B", "[-", "1", "]\u010a\u010a", "print", "((", "sum", "(A", ")))"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p02700", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nA, B, C, D = list(map(int, input().split()))\n\n\n\nwhile True:\n\n C -= B\n\n \n\n if C<=0:\n\n print('Yes')\n\n exit()\n\n \n\n A -= D\n\n \n\n if A<=0:\n\n print('No')\n\n exit()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120*", "\u010a\u010a\u010a\u010a", "A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120D", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "\u0120-=", "\u0120B", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120C", "<=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120-=", "\u0120D", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120A", "<=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7301658005010259]} +{"problem_id": "p03575", "input": "icase=0\n\nif icase==0:\n\n n,m=list(map(int, input().split()))\n\n a=[]\n\n b=[]\n\n for i in range(m):\n\n ai,bi=list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\nelif icase==1:\n\n n=6\n\n m=5\n\n# a=[[1],[2],[3],[4],[5]]\n\n# b=[[2],[3],[4],[5],[6]]\n\n a=[1,2,3,4,5]\n\n b=[2,3,4,5,6]\n\nelif icase==2:\n\n n=7\n\n m=7\n\n a=[1,2,3,4,4,5,6]\n\n b=[3,7,4,5,6,6,7]\n\n\n\n \n\nvtx=[]\n\nfor i in range(n):\n\n vtx.append([i+1])\n\nicnt=0\n\n\n\nfor j in range(m): \n\n vtx1=vtx.copy()\n\n a1=a.copy()\n\n b1=b.copy()\n\n del a1[j]\n\n del b1[j]\n\n \n\n for i in range(m-1):\n\n for v1 in vtx1:\n\n if a1[i] in v1:\n\n if not b1[i] in v1:\n\n for v2 in vtx1:\n\n if v1!=v2:\n\n if b1[i] in v2:\n\n break\n\n vtx1.remove(v1)\n\n vtx1.remove(v2)\n\n v3=v1+v2\n\n vtx1.append(v3)\n\n# print(a[i],b[i],len(vtx1),vtx1)\n\n# print(len(vtx1),vtx1)\n\n if len(vtx1)!=1:\n\n icnt=icnt+1\n\nprint(icnt) ", "input_tokens": ["ic", "ase", "=", "0", "\u010a\u010a", "if", "\u0120ic", "ase", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",m", "=list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=[]", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=[]", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ai", ",", "bi", "=list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ".append", "(ai", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", ".append", "(b", "i", ")\u010a\u010a", "elif", "\u0120ic", "ase", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=", "6", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "=", "5", "\u010a\u010a", "#", "\u0120\u0120\u0120", "\u0120a", "=[[", "1", "],[", "2", "],[", "3", "],[", "4", "],[", "5", "]]\u010a\u010a", "#", "\u0120\u0120\u0120", "\u0120b", "=[[", "2", "],[", "3", "],[", "4", "],[", "5", "],[", "6", "]]\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=[", "1", ",", "2", ",", "3", ",", "4", ",", "5", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=[", "2", ",", "3", ",", "4", ",", "5", ",", "6", "]\u010a\u010a", "elif", "\u0120ic", "ase", "==", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "=", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=[", "1", ",", "2", ",", "3", ",", "4", ",", "4", ",", "5", ",", "6", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=[", "3", ",", "7", ",", "4", ",", "5", ",", "6", ",", "6", ",", "7", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "v", "tx", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120vtx", ".append", "([", "i", "+", "1", "])\u010a\u010a", "ic", "nt", "=", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(m", "):", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120vtx", "1", "=v", "tx", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "1", "=a", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "1", "=b", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120del", "\u0120a", "1", "[j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120del", "\u0120b", "1", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(m", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", "1", "\u0120in", "\u0120vtx", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "1", "[i", "]", "\u0120in", "\u0120v", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120b", "1", "[i", "]", "\u0120in", "\u0120v", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", "2", "\u0120in", "\u0120vtx", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120v", "1", "!=", "v", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120b", "1", "[i", "]", "\u0120in", "\u0120v", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120vtx", "1", ".remove", "(v", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120vtx", "1", ".remove", "(v", "2", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "3", "=v", "1", "+v", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120vtx", "1", ".append", "(v", "3", ")\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(a", "[i", "],", "b", "[i", "],", "len", "(v", "tx", "1", "),", "v", "tx", "1", ")\u010a\u010a", "#", "\u0120\u0120\u0120", "\u0120print", "(len", "(v", "tx", "1", "),", "v", "tx", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(v", "tx", "1", ")!=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ic", "nt", "=", "ic", "nt", "+", "1", "\u010a\u010a", "print", "(ic", "nt", ")", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120"], "input_token_weights": [0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.9460144469641688, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9460144469641688, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8889473014940781, 0.8490090158852169, 0.8074090697023789, 0.8074090697023789, 0.741572616038919, 0.7640031686476719, 0.7640031686476719, 0.8490090158852169, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.5686609715453708, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.5686609715453708, 0.5686609715453708, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.8889473014940781, 0.8691775287719905, 0.9083337953965728, 0.5686609715453708, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8490090158852169, 0.8074090697023789, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.7186273667339679, 0.7186273667339679, 0.8074090697023789, 0.5686609715453708, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.5686609715453708, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9273515896195933, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9273515896195933, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5686609715453708, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5686609715453708, 0.9083337953965728, 0.5686609715453708, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.5686609715453708, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.9273515896195933, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9273515896195933, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5686609715453708, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5686609715453708, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9273515896195933, 0.9083337953965728, 0.9460144469641688, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8691775287719905, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9273515896195933, 0.9083337953965728, 0.9460144469641688, 0.5686609715453708, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.9083337953965728, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.5686609715453708, 0.9083337953965728, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.5686609715453708, 0.5686609715453708, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.8889473014940781, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.9083337953965728, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5686609715453708, 0.8284253466378658, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8284253466378658, 0.5686609715453708, 0.785941609719976, 0.7640031686476719, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.785941609719976, 0.5686609715453708, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.5686609715453708, 0.6951432441854742, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.6951432441854742, 0.5686609715453708, 0.6464527786867319, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6464527786867319, 0.5686609715453708, 0.5952696660036803, 0.5686609715453708, 0.5686609715453708, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.5686609715453708, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.5686609715453708, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.5686609715453708, 0.5686609715453708, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.9273515896195933, 0.5686609715453708, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.9083337953965728, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8889473014940781, 0.8889473014940781, 0.9083337953965728, 0.5686609715453708, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.5686609715453708, 0.9273515896195933, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.5686609715453708]} +{"problem_id": "p02814", "input": "#!/usr/bin/env python3\n\nimport sys\n\nfrom math import gcd\n\nimport math\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n tmp = 1\n\n count = None\n\n for i in range(N):\n\n tmp = (tmp * a[i]//2) // gcd(tmp,a[i]//2)\n\n c = 0\n\n n = a[i]//2\n\n while n % 2 == 0:\n\n c += 1\n\n n //= 2\n\n if i == 0:\n\n count = c\n\n elif count != c:\n\n print((0))\n\n exit()\n\n print(((M//tmp +1)//2))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120None", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120(", "tmp", "\u0120*", "\u0120a", "[i", "]", "//", "2", ")", "\u0120//", "\u0120gcd", "(tmp", ",a", "[i", "]", "//", "2", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120a", "[i", "]", "//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120n", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120//=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120count", "\u0120!=", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "M", "//", "tmp", "\u0120+", "1", ")//", "2", "))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.7084208560793558, 0.6771609938949378, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p02394", "input": "a=input().split()\n\nb=list(map(int,a))\n\nW=b[0]\n\nH=b[1]\n\nx=b[2]\n\ny=b[3]\n\nr=b[4]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')", "input_tokens": ["a", "=input", "().", "split", "()\u010a\u010a", "b", "=list", "(map", "(int", ",a", "))\u010a\u010a", "W", "=b", "[", "0", "]\u010a\u010a", "H", "=b", "[", "1", "]\u010a\u010a", "x", "=b", "[", "2", "]\u010a\u010a", "y", "=b", "[", "3", "]\u010a\u010a", "r", "=b", "[", "4", "]\u010a\u010a", "if", "\u0120(", "r", "\u0120<=", "\u0120x", "\u0120<=", "\u0120(", "W", "\u0120-", "\u0120r", "))", "\u0120and", "\u0120(", "r", "\u0120<=", "\u0120y", "\u0120<=", "\u0120(", "H", "\u0120-", "\u0120r", "))", ":\u010a\u010a", "\u0120", "\u0120print", "('", "Yes", "')\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "('", "No", "')"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.7760292149144611, 0.6886415962350058, 0.6886415962350058, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.89427190936908, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.8170167109432965, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.7332896764791028, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6886415962350058]} +{"problem_id": "p02394", "input": "ia = [int(i) for i in input().split(\" \")]\n\nW=ia[0]\n\nH=ia[1]\n\nx=ia[2]\n\ny=ia[3]\n\nr=ia[4]\n\nprint((\"Yes\" if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H else \"No\"))", "input_tokens": ["ia", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "(\"", "\u0120\")", "]\u010a\u010a", "W", "=", "ia", "[", "0", "]\u010a\u010a", "H", "=", "ia", "[", "1", "]\u010a\u010a", "x", "=", "ia", "[", "2", "]\u010a\u010a", "y", "=", "ia", "[", "3", "]\u010a\u010a", "r", "=", "ia", "[", "4", "]\u010a\u010a", "print", "((\"", "Yes", "\"", "\u0120if", "\u0120", "0", "<=", "x", "-r", "\u0120and", "\u0120x", "+r", "<=", "W", "\u0120and", "\u0120", "0", "<=", "y", "-r", "\u0120and", "\u0120y", "+r", "<=", "H", "\u0120else", "\u0120\"", "No", "\"))"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p03457", "input": "N=input()\n\na=[]\n\nt=True\n\nfor _ in range(int(N)):\n\n a+=[list(map(int,input().split()))]\n\nfor i in range(int(N)):\n\n if a[i][0]%2==0:\n\n if abs(a[i][1]+a[i][2])<=a[i][0] and (a[i][1]+a[i][2])%2==0:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\n else:\n\n if abs(a[i][1]+a[i][2]<=a[i][0]) and (a[i][1]+a[i][2])%2==1:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\nif t:\n\n print('Yes')", "input_tokens": ["N", "=input", "()\u010a\u010a", "a", "=[]", "\u010a\u010a", "t", "=True", "\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(int", "(N", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "+", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(int", "(N", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[i", "][", "0", "]%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120abs", "(a", "[i", "][", "1", "]+", "a", "[i", "][", "2", "])", "<=", "a", "[i", "][", "0", "]", "\u0120and", "\u0120(", "a", "[i", "][", "1", "]+", "a", "[i", "][", "2", "])", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "=False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120abs", "(a", "[i", "][", "1", "]+", "a", "[i", "][", "2", "]<=", "a", "[i", "][", "0", "])", "\u0120and", "\u0120(", "a", "[i", "][", "1", "]+", "a", "[i", "][", "2", "])", "%", "2", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "=False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "if", "\u0120t", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')"], "input_token_weights": [0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8099046207685895, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.7833854580549265, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.7561438265913266, 0.7281392564472128, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.7281392564472128, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6993277790098028, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.8099046207685895, 0.7561438265913266, 0.7281392564472128, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.7833854580549265, 0.6993277790098028, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.5749858371565393, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.6993277790098028, 0.6696615116992518, 0.6390881791778984, 0.6696615116992518, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.5749858371565393, 0.7281392564472128, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8357386476069529]} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nyenmin=a*x+b*y\n\nfor zz in range(2*10**5+1):\n\n xx=max(x-zz//2,0)\n\n yy=max(y-zz//2,0)\n\n yen=a*xx+b*yy+c*zz\n\n if yen d[v]+cost:\n\n d[to] = d[v]+cost\n\n par[to] = v\n\n que.put((d[to],to))\n\n\n\n for j in range(n):\n\n if i != j:\n\n a,b = j,par[j]\n\n if a>b:\n\n a,b = b,a\n\n used.add((a,b))\n\n\n\n print((m - len(used)))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120queue", "\u010a\u010a\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",m", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120G", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",b", ",c", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120G", "[a", "].", "append", "((", "b", ",c", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120G", "[b", "].", "append", "((", "a", ",c", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120used", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120[", "INF", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120par", "\u0120=", "\u0120[-", "1", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120di", "jk", "stra", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", "\u0120=", "\u0120queue", ".Priority", "Queue", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[i", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".put", "((", "0", ",i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120not", "\u0120que", ".empty", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120que", ".get", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120p", "[", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[v", "]", "\u0120<", "\u0120p", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120(", "to", ",c", "ost", ")", "\u0120in", "\u0120G", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[to", "]", "\u0120>", "\u0120d", "[v", "]+", "cost", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[to", "]", "\u0120=", "\u0120d", "[v", "]+", "cost", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120par", "[to", "]", "\u0120=", "\u0120v", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".put", "((", "d", "[to", "],", "to", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120!=", "\u0120j", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120j", ",", "par", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", ">b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120b", ",a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120used", ".add", "((", "a", ",b", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "m", "\u0120-", "\u0120len", "(", "used", "))", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.7847988758021361, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.808526270355906, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.76049478068099, 0.5714954628602014, 0.5714954628602014, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.76049478068099, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.5714954628602014, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.5714954628602014, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.8543560820723151, 0.5714954628602014, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.8317036996956922, 0.8543560820723151, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p03416", "input": "a,b = list(map(int,input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n s = str(i)\n\n l = len(s)\n\n if all(s[j] == s[l-j-1] for j in range(l)):\n\n count += 1\n\nprint(count)", "input_tokens": ["a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120all", "(s", "[j", "]", "\u0120==", "\u0120s", "[l", "-j", "-", "1", "]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(l", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02921", "input": "import itertools\n\nimport math\n\ndef main():\n\n s = input()\n\n t = input()\n\n cnt = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n cnt += 1\n\n print(cnt)\n\nif __name__ == '__main__':\n\n main()", "input_tokens": ["import", "\u0120itertools", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120", "\u0120s", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120", "\u0120t", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120==", "\u0120t", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120print", "(cnt", ")\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120", "\u0120main", "()"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.833611120734537, 0.5886835746651548, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.6339004969859428, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994]} +{"problem_id": "p03579", "input": "import sys\n\nsys.setrecursionlimit(100000)\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(v, c):\n\n # c: color = 1 or -1\n\n node[v] = c\n\n for i in graph[v]:\n\n if node[i] == c:\n\n return False\n\n \n\n if node[i] == 0 and not dfs(i, -c):\n\n return False\n\n \n\n return True\n\n\n\nnode = [0] * N\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in node) // 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) // 2 - M))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", ")\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "edges", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", ")]", "\u010a\u010a\u010a\u010a", "graph", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120x", ",", "\u0120y", "\u0120in", "\u0120edges", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120graph", "[x", "\u0120-", "\u0120", "1", "].", "append", "(y", "\u0120-", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120graph", "[y", "\u0120-", "\u0120", "1", "].", "append", "(x", "\u0120-", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "def", "\u0120dfs", "(v", ",", "\u0120c", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120c", ":", "\u0120color", "\u0120=", "\u0120", "1", "\u0120or", "\u0120-", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120node", "[v", "]", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120graph", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120node", "[i", "]", "\u0120==", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120node", "[i", "]", "\u0120==", "\u0120", "0", "\u0120and", "\u0120not", "\u0120dfs", "(i", ",", "\u0120-", "c", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a\u010a\u010a", "node", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120N", "\u010a\u010a", "if", "\u0120dfs", "(", "0", ",", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120sum", "(v", "\u0120+", "\u0120", "1", "\u0120for", "\u0120v", "\u0120in", "\u0120node", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "x", "\u0120*", "\u0120(", "N", "\u0120-", "\u0120x", ")", "\u0120-", "\u0120M", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "N", "\u0120*", "\u0120(", "N", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u0120-", "\u0120M", "))\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046]} +{"problem_id": "p02248", "input": "def kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return nx\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = input()\n\nP = input()\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n", "input_tokens": ["def", "\u0120k", "mp", "Table", "(w", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120lw", "\u0120=", "\u0120len", "(w", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120nx", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120(", "lw", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120-", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(l", "w", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120j", "\u0120>=", "\u0120", "0", "\u0120and", "\u0120w", "[i", "]", "\u0120!=", "\u0120w", "[j", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120nx", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nx", "[i", "\u0120+", "\u0120", "1", "]", "\u0120=", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120nx", "\u010a\u010a", "def", "\u0120k", "mp", "Search", "(s", ",", "\u0120w", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ls", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "_idx", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120nx", "\u0120=", "\u0120k", "mp", "Table", "(w", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120start", "\u0120+", "\u0120w", "_idx", "\u0120<", "\u0120ls", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[start", "\u0120+", "\u0120w", "_idx", "]", "\u0120==", "\u0120w", "[w", "_idx", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120w", "_idx", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120w", "_idx", "\u0120==", "\u0120len", "(w", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", ".append", "(start", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120start", "\u0120+", "\u0120w", "_idx", "\u0120-", "\u0120nx", "[w", "_idx", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120w", "_idx", "\u0120=", "\u0120nx", "[w", "_idx", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120w", "_idx", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120start", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120start", "\u0120+", "\u0120w", "_idx", "\u0120-", "\u0120nx", "[w", "_idx", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120w", "_idx", "\u0120=", "\u0120nx", "[w", "_idx", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a", "T", "\u0120=", "\u0120input", "()\u010a\u010a", "P", "\u0120=", "\u0120input", "()\u010a\u010a", "ans", "\u0120=", "\u0120k", "mp", "Search", "(T", ",", "\u0120P", ")\u010a\u010a", "if", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(", "(\"\\", "n", "\".", "join", "(map", "(str", ",", "\u0120ans", "))))", "\u0109\u010a\u010a\u010a"], "input_token_weights": [0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.7967329450848046, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8922045961188434, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7967329450848046, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.6911750402874859, 0.5731452134031394, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.5731452134031394, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7186273667339679, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8456076926739031, 0.5731452134031394]} +{"problem_id": "p03457", "input": "def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time, px, py = 0, 0, 0\n\n for t, x, y in TXY:\n\n move = abs(x-px) + abs(y-py)\n\n # print(move, t-time)\n\n if (t - time) % 2 != move % 2 or t - time < move:\n\n return print(\"No\")\n\n time, px, py = t, x, y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120sys", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "XY", "\u0120=", "\u0120[[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120time", ",", "\u0120px", ",", "\u0120py", "\u0120=", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120t", ",", "\u0120x", ",", "\u0120y", "\u0120in", "\u0120T", "XY", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120move", "\u0120=", "\u0120abs", "(x", "-", "px", ")", "\u0120+", "\u0120abs", "(y", "-p", "y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120print", "(move", ",", "\u0120t", "-time", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "t", "\u0120-", "\u0120time", ")", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120move", "\u0120%", "\u0120", "2", "\u0120or", "\u0120t", "\u0120-", "\u0120time", "\u0120<", "\u0120move", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120print", "(\"", "No", "\")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120time", ",", "\u0120px", ",", "\u0120py", "\u0120=", "\u0120t", ",", "\u0120x", ",", "\u0120y", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Yes", "\")\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.6514299043837268, 0.6855929667625797, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8116478083709829]} +{"problem_id": "p03553", "input": "import math,string,itertools,math,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf = 10**20\n\neps = 1.0 / 10**15\n\nmod = 10**9+7\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef F(): return float(sys.stdin.readline())\n\ndef S(): return input()\n\ndef pf(s): return print(s, flush=True)\n\ndef divisions(n):\n\n sq = int(math.sqrt(n)+1)\n\n d = collections.defaultdict(int)\n\n while n % 2 == 0:\n\n n //= 2\n\n d[2] += 1\n\n i = 3\n\n while n > 1 and sq >= i:\n\n if n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n else:\n\n i += 2\n\n\n\n if n > 1:\n\n d[n] += 1\n\n\n\n r = [1]\n\n for k, v in d.items():\n\n for c in r[:]:\n\n for i in range(1,v+1):\n\n r.append(c*(k**i))\n\n\n\n return sorted(r)\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n s = set()\n\n for i in range(n,0,-1):\n\n d = divisions(i)\n\n ld = len(d)\n\n for j in range(1,2**ld):\n\n c = []\n\n ff = True\n\n for k in range(ld):\n\n if j & (1<", "\u0120", "1", "\u0120and", "\u0120sq", "\u0120>=", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120//=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[i", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "2", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[n", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120[", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", ",", "\u0120v", "\u0120in", "\u0120d", ".items", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120r", "[:", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",v", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", ".append", "(c", "*(", "k", "**", "i", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120sorted", "(r", ")\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ",", "0", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120divisions", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ld", "\u0120=", "\u0120len", "(d", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "2", "**", "ld", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ff", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(ld", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120&", "\u0120(", "1", "<<", "k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120e", "\u0120in", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[k", "]", "\u0120%", "\u0120e", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ff", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120f", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", ".append", "(d", "[k", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120ff", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120ff", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", ".add", "(tuple", "(c", "\u0120+", "\u0120[", "n", "+", "1", "]))\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120sorted", "(list", "(s", "),", "\u0120reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120e", "\u0120in", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "%", "e", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120f", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120a", "[j", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120e", "\u0120in", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "%", "e", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120f", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[j", "-", "1", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120sum", "(a", ")\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "print", "(main", "())\u010a\u010a", "\u010a\u010a\u010a"], "input_token_weights": [0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.9235768548788368, 0.9235768548788368, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.9235768548788368, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.9035222925783293, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.7506053018110229, 0.7506053018110229, 0.7739350698055053, 0.819022641134497, 0.819022641134497, 0.883057299767519, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9035222925783293, 0.883057299767519, 0.8408263201236497, 0.819022641134497, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.7506053018110229, 0.7506053018110229, 0.7739350698055053, 0.819022641134497, 0.819022641134497, 0.883057299767519, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.7506053018110229, 0.7506053018110229, 0.7739350698055053, 0.819022641134497, 0.819022641134497, 0.883057299767519, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9035222925783293, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.7967329450848046, 0.819022641134497, 0.862164725336545, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.7967329450848046, 0.819022641134497, 0.862164725336545, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.7739350698055053, 0.7739350698055053, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.9035222925783293, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.862164725336545, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.9035222925783293, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.5700083567488032, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.5700083567488032, 0.5700083567488032, 0.9035222925783293, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.862164725336545, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.862164725336545, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7967329450848046, 0.5700083567488032, 0.7967329450848046, 0.5700083567488032, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7739350698055053, 0.5700083567488032, 0.5700083567488032, 0.9035222925783293, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.9035222925783293, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.9035222925783293, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.9035222925783293, 0.862164725336545, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.7967329450848046, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.819022641134497, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7267182280470056, 0.5700083567488032, 0.5700083567488032, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.9035222925783293, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.819022641134497, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.819022641134497, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.862164725336545, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7739350698055053, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.7967329450848046, 0.7739350698055053, 0.819022641134497, 0.5700083567488032, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7739350698055053, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.6771609938949378, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.6250192001927346, 0.6250192001927346, 0.6514299043837268, 0.5700083567488032, 0.6514299043837268, 0.6771609938949378, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.5700083567488032, 0.6250192001927346, 0.5700083567488032, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6250192001927346, 0.5978920048953399, 0.6250192001927346, 0.5700083567488032, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.7739350698055053, 0.5700083567488032, 0.7267182280470056, 0.5700083567488032, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.6771609938949378, 0.6514299043837268, 0.6250192001927346, 0.5978920048953399, 0.5978920048953399, 0.5978920048953399, 0.7267182280470056, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.7967329450848046, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.5700083567488032, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.7967329450848046, 0.7967329450848046, 0.862164725336545, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.7739350698055053, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.5700083567488032, 0.7506053018110229, 0.7739350698055053, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.5700083567488032, 0.7267182280470056, 0.5700083567488032, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7267182280470056, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.5700083567488032, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.862164725336545, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.7967329450848046, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.819022641134497, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7267182280470056, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.5700083567488032, 0.7022465694939416, 0.7267182280470056, 0.5700083567488032, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.5700083567488032, 0.6771609938949378, 0.5700083567488032, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.6771609938949378, 0.6771609938949378, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.7022465694939416, 0.5700083567488032, 0.7022465694939416, 0.5700083567488032, 0.5700083567488032, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.9235768548788368, 0.9035222925783293, 0.9035222925783293, 0.5700083567488032]} +{"problem_id": "p02881", "input": "N = int(input())\n\nans = N - 1\n\np = 1\n\nfor i in range(2, int((N ** 0.5) + 1)):\n\n if p % 2 == 1 and i > (N ** 0.5):\n\n break\n\n if N % i == 0:\n\n p = i\n\n j = N // i\n\n m = i + j - 2\n\n if m < ans:\n\n ans = m\n\n else:\n\n continue\n\n else:\n\n continue\n\nprint(ans)\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120N", "\u0120-", "\u0120", "1", "\u010a\u010a", "p", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",", "\u0120int", "((", "N", "\u0120**", "\u0120", "0", ".", "5", ")", "\u0120+", "\u0120", "1", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120p", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", "\u0120and", "\u0120i", "\u0120>", "\u0120(", "N", "\u0120**", "\u0120", "0", ".", "5", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120N", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120N", "\u0120//", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120i", "\u0120+", "\u0120j", "\u0120-", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120m", "\u0120<", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.833611120734537, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.7584425223266994, 0.5886835746651548, 0.7584425223266994, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.833611120734537, 0.5886835746651548, 0.7584425223266994, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.5886835746651548, 0.5886835746651548, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.6339004969859428, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7186273667339679, 0.5886835746651548, 0.8691775287719905, 0.833611120734537, 0.833611120734537]} +{"problem_id": "p03078", "input": "import sys\n\nimport heapq\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n Q = []\n\n S = set()\n\n heapq.heapify(Q)\n\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n\n for i in range(K):\n\n m, a, b, c = heapq.heappop(Q)\n\n print((-m))\n\n if (a + 1, b, c) not in S and a + 1 < X:\n\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n\n S.add((a + 1, b, c))\n\n if (a, b + 1, c) not in S and b + 1 < Y:\n\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n\n S.add((a, b + 1, c))\n\n if (a, b, c + 1) not in S and c + 1 < Z:\n\n heapq.heappush(Q, (-A[a ] - B[b] - C[c+1], a, b, c + 1))\n\n S.add((a, b, c + 1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "import", "\u0120heapq", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120\\", "n", "\u010a\u010a", "def", "\u0120input", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "rstrip", "()", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", ",", "\u0120Y", ",", "\u0120Z", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120B", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", ".sort", "(reverse", "=True", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120Q", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120heapq", ".heap", "ify", "(Q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(Q", ",", "\u0120(-", "A", "[", "0", "]", "\u0120-", "\u0120B", "[", "0", "]", "\u0120-", "\u0120C", "[", "0", "],", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", ",", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120heapq", ".he", "app", "op", "(Q", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "m", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "a", "\u0120+", "\u0120", "1", ",", "\u0120b", ",", "\u0120c", ")", "\u0120not", "\u0120in", "\u0120S", "\u0120and", "\u0120a", "\u0120+", "\u0120", "1", "\u0120<", "\u0120X", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(Q", ",", "\u0120(-", "A", "[a", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120B", "[b", "]", "\u0120-", "\u0120C", "[c", "],", "\u0120a", "\u0120+", "\u0120", "1", ",", "\u0120b", ",", "\u0120c", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120S", ".add", "((", "a", "\u0120+", "\u0120", "1", ",", "\u0120b", ",", "\u0120c", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "a", ",", "\u0120b", "\u0120+", "\u0120", "1", ",", "\u0120c", ")", "\u0120not", "\u0120in", "\u0120S", "\u0120and", "\u0120b", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(Q", ",", "\u0120(-", "A", "[a", "]", "\u0120-", "\u0120B", "[b", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120C", "[c", "],", "\u0120a", ",", "\u0120b", "\u0120+", "\u0120", "1", ",", "\u0120c", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120S", ".add", "((", "a", ",", "\u0120b", "\u0120+", "\u0120", "1", ",", "\u0120c", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "a", ",", "\u0120b", ",", "\u0120c", "\u0120+", "\u0120", "1", ")", "\u0120not", "\u0120in", "\u0120S", "\u0120and", "\u0120c", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Z", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(Q", ",", "\u0120(-", "A", "[a", "\u0120]", "\u0120-", "\u0120B", "[b", "]", "\u0120-", "\u0120C", "[c", "+", "1", "],", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120+", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120S", ".add", "((", "a", ",", "\u0120b", ",", "\u0120c", "\u0120+", "\u0120", "1", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.8317036996956922, 0.808526270355906, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.8543560820723151, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.8543560820723151, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.5714954628602014, 0.6007824012961436, 0.629235964119581, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.5714954628602014, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7100393521462953, 0.7100393521462953, 0.5714954628602014, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.8543560820723151, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.8543560820723151, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.629235964119581, 0.5714954628602014, 0.629235964119581, 0.6569022703191485, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.5714954628602014, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.5714954628602014, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.8543560820723151, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.8543560820723151, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.5714954628602014, 0.7100393521462953, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.5714954628602014, 0.7100393521462953, 0.76049478068099, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p03494", "input": "def two_count(x):\n\n\tif int(str(x)[-1]) % 2 == 0:\n\n\t\treturn 1 + two_count(x//2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(input())\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))", "input_tokens": ["def", "\u0120two", "_count", "(x", "):\u010a\u010a", "\u0109if", "\u0120int", "(str", "(x", ")[-", "1", "])", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0109", "\u0109return", "\u0120", "1", "\u0120+", "\u0120two", "_count", "(x", "//", "2", ")\u010a\u010a", "\u0109else", ":\u010a\u010a", "\u0109", "\u0109return", "\u0120", "0", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "n", "_list", "\u0120=", "\u0120[", "int", "(n", ")", "\u0120for", "\u0120n", "\u0120in", "\u0120input", "().", "split", "(\"", "\u0120\"", ")]", "\u010a\u010a\u010a\u010a", "n", "_two", "_count", "_list", "\u0120=", "\u0120[", "two", "_count", "(n", ")", "\u0120for", "\u0120n", "\u0120in", "\u0120n", "_list", "]\u010a\u010a\u010a\u010a", "print", "((", "min", "(n", "_two", "_count", "_list", ")))"], "input_token_weights": [0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.6211886504852411, 0.6951432441854742, 0.6588494518362031, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p02386", "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if(g[k:k+4]==e[1:5])*(f[0]==e[0])*(f[5]==e[5]):return 'No'\n\n return 'Yes'\n\nprint((f()))\n", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "a", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "def", "\u0120f", "():\u010a\u010a", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120", "\u0120d", "=a", "[i", "][:", "];", "d", "[", "3", "],", "d", "[", "4", "]=", "d", "[", "4", "],", "d", "[", "3", "]\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",n", "):\u010a\u010a", "\u0120\u0120", "\u0120e", "=a", "[j", "][:", "];", "e", "[", "3", "],", "e", "[", "4", "]=", "e", "[", "4", "],", "e", "[", "3", "]\u010a\u010a", "\u0120\u0120", "\u0120for", "\u0120p", "\u0120in", "('", "0", "1", "2", "3", "4", "5", "','", "1", "5", "2", "0", "4", "3", "','", "2", "1", "5", "3", "0", "4", "','", "3", "0", "2", "5", "4", "1", "','", "4", "1", "0", "3", "5", "2", "','", "5", "1", "4", "3", "2", "0", "')", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "=[", "d", "[int", "(k", ")]", "for", "\u0120k", "\u0120in", "\u0120p", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "=f", "[", "1", ":", "5", "]*", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "4", "):\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120if", "(g", "[k", ":k", "+", "4", "]==", "e", "[", "1", ":", "5", "])", "*(", "f", "[", "0", "]==", "e", "[", "0", "])", "*(", "f", "[", "5", "]==", "e", "[", "5", "]):", "return", "\u0120'", "No", "'\u010a\u010a", "\u0120return", "\u0120'", "Yes", "'\u010a\u010a", "print", "((", "f", "()))\u010a"], "input_token_weights": [0.9307708458268354, 0.9307708458268354, 0.89427190936908, 0.89427190936908, 0.9307708458268354, 0.9307708458268354, 0.89427190936908, 0.8755104074345346, 0.8368972118255844, 0.8368972118255844, 0.7967329450848046, 0.7967329450848046, 0.8755104074345346, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8755104074345346, 0.8563901704123833, 0.9126878899009554, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.89427190936908, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.9126878899009554, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8368972118255844, 0.89427190936908, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8563901704123833, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.8755104074345346, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7967329450848046, 0.8563901704123833, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8170167109432965, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.8368972118255844, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.6886415962350058, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7548877618383746, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7548877618383746, 0.7548877618383746, 0.5674344985213602, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7760292149144611, 0.7548877618383746, 0.7548877618383746, 0.7967329450848046, 0.5674344985213602, 0.7548877618383746, 0.6886415962350058, 0.6419065217751312, 0.6176935537080551, 0.5928797394668679, 0.5928797394668679, 0.6655470550599784, 0.6419065217751312, 0.6419065217751312, 0.6176935537080551, 0.6176935537080551, 0.6176935537080551, 0.6886415962350058, 0.7112147970463693, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6655470550599784, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.7332896764791028, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.6886415962350058, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.7548877618383746, 0.7112147970463693, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.9126878899009554, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.9307708458268354, 0.9126878899009554, 0.8755104074345346, 0.9126878899009554]} +{"problem_id": "p02814", "input": "from math import gcd\n\nn, m = list(map(int, input().split()))\n\na = [int(i) // 2 for i in input().split()]\n\nx = 1\n\nfor i in range(n):\n\n x *= a[i] // gcd(x, a[i])\n\nfor i in a:\n\n if x // i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((m // x + 1) // 2))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120//", "\u0120", "2", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "x", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120*=", "\u0120a", "[i", "]", "\u0120//", "\u0120gcd", "(x", ",", "\u0120a", "[i", "])\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120//", "\u0120i", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "print", "(((", "m", "\u0120//", "\u0120x", "\u0120+", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "))"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.8889473014940781, 0.8591441175808593, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p03038", "input": "import sys\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nn,m=list(map(int,input().split()))\n\na0=list(map(int,input().split()))\n\ndata=[list(map(int,input().split())) for i in range(m)]\n\nfor i in a0:\n\n\tdata.append([1,i])\n\ndata.sort(key=lambda tup:-tup[1])\n\nans=0\n\nfor num,val in data:\n\n\tif n>=num:\n\n\t\tn-=num\n\n\t\tans+=val*num\n\n\telse:\n\n\t\tans+=val*n\n\n\t\tbreak\n\nprint(ans)\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120lambda", ":", "\u0120sys", ".stdin", ".readline", "()", "[:-", "1", "]\u010a\u010a", "n", ",m", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "0", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "data", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(m", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120a", "0", ":\u010a\u010a", "\u0109data", ".append", "([", "1", ",i", "])\u010a\u010a", "data", ".sort", "(key", "=lambda", "\u0120tup", ":-", "t", "up", "[", "1", "])\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120num", ",val", "\u0120in", "\u0120data", ":\u010a\u010a", "\u0109if", "\u0120n", ">=", "num", ":\u010a\u010a", "\u0109", "\u0109n", "-=", "num", "\u010a\u010a", "\u0109", "\u0109ans", "+=", "val", "*num", "\u010a\u010a", "\u0109else", ":\u010a\u010a", "\u0109", "\u0109ans", "+=", "val", "*n", "\u010a\u010a", "\u0109", "\u0109break", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.8408263201236497, 0.781592256244883, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.579389560544, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03200", "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(input())\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tA = []\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': A.append(bcnt)\n\n\t\n\n\tprint((sum(A)))\n\n\n\nif __name__ == '__main__':\n\n\tmain()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "6", ")\u010a\u010a", "if", "\u0120sys", ".platform", "\u0120in", "\u0120(", "['", "ios", "','", "darwin", "','", "win", "3", "2", "'])", ":\u010a\u010a", "\u0109sys", ".stdin", "=open", "('", "Untitled", ".txt", "')\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "def", "\u0120INT", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120MAP", "():", "\u0120return", "\u0120[", "int", "(s", ")", "\u0120for", "\u0120s", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0109S", "\u0120=", "\u0120input", "().", "rstrip", "()\u010a\u010a", "\u0109b", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0109A", "\u0120=", "\u0120[]\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0109", "\u0109if", "\u0120S", "[i", "]", "\u0120==", "\u0120'", "B", "':", "\u0120b", "cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0109", "\u0109if", "\u0120S", "[i", "]", "\u0120==", "\u0120'", "W", "':", "\u0120A", ".append", "(b", "cnt", ")\u010a\u010a", "\u0109\u010a\u010a", "\u0109print", "((", "sum", "(A", "))", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0109main", "()"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.911283254435702, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.8139227859741643, 0.7792424376220217, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.7792424376220217, 0.8139227859741643, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.6673426178365944, 0.7060506397782503, 0.7060506397782503, 0.8139227859741643, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.7060506397782503, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7060506397782503, 0.7792424376220217, 0.8474406118450124, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.5851191688414608, 0.7792424376220217, 0.7060506397782503, 0.6673426178365944, 0.7433160191943734, 0.7792424376220217, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.7792424376220217]} +{"problem_id": "p03416", "input": "a,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(a, b + 1):\n\n f = True\n\n s = str(i)\n\n l = len(s)\n\n for j in range(l//2 + 1):\n\n if s[j] != s[- j - 1]:\n\n f = False\n\n break\n\n if f:\n\n n += 1\n\nprint(n)", "input_tokens": ["a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "n", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(l", "//", "2", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[j", "]", "\u0120!=", "\u0120s", "[-", "\u0120j", "\u0120-", "\u0120", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120f", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(n", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6588494518362031, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03752", "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for bit in range(1 << N):\n\n if (not (bit & 1)) or bin(bit).count('1') != K:\n\n continue\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if bit & (1 << i):\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".readlines", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "\u0120<<", "\u0120", "6", "0", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120K", ",", "\u0120*", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120read", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120INF", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120bit", "\u0120in", "\u0120range", "(", "1", "\u0120<<", "\u0120N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "not", "\u0120(", "bit", "\u0120&", "\u0120", "1", "))", "\u0120or", "\u0120bin", "(bit", ").", "count", "('", "1", "')", "\u0120!=", "\u0120K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120total", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_height", "\u0120=", "\u0120A", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120a", "\u0120in", "\u0120enumerate", "(A", "[", "1", ":],", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120<=", "\u0120max", "_height", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120bit", "\u0120&", "\u0120(", "1", "\u0120<<", "\u0120i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120total", "\u0120+=", "\u0120max", "_height", "\u0120-", "\u0120a", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_height", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_height", "\u0120=", "\u0120a", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120ans", "\u0120>", "\u0120total", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120total", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.8922045961188434, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.7186273667339679, 0.7967329450848046, 0.8214688817838891, 0.7186273667339679, 0.6911750402874859, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7453461554353482, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.7453461554353482, 0.5731452134031394, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.5731452134031394, 0.6339004969859428, 0.5731452134031394, 0.5731452134031394, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.5731452134031394, 0.6629477592666795, 0.5731452134031394, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031]} +{"problem_id": "p02952", "input": "import math\n\nn = int(input())\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if math.floor(math.log10(i) + 1) % 2:\n\n cnt += 1\n\nprint(cnt)", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120math", ".floor", "(math", ".log", "1", "0", "(i", ")", "\u0120+", "\u0120", "1", ")", "\u0120%", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8474406118450124, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.7060506397782503, 0.5851191688414608, 0.7060506397782503, 0.7433160191943734, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p02773", "input": "from collections import defaultdict\n\nn = int(input())\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = input()\n\n d[key] += 1\n\n\n\ndict = sorted(list(d.items()), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nfor s in dict_li:\n\n print(s)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120key", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[key", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "dict", "\u0120=", "\u0120sorted", "(list", "(d", ".items", "()),", "\u0120key", "=lambda", "\u0120x", ":x", "[", "1", "],", "\u0120reverse", "=True", ")\u010a\u010a", "max", "_v", "\u0120=", "\u0120max", "(d", ".values", "())\u010a\u010a", "\u010a\u010a", "dict", "_li", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120dict", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[", "1", "]==", "max", "_v", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dict", "_li", ".append", "(a", "[", "0", "])\u010a\u010a", "\u010a\u010a", "dict", "_li", ".sort", "()\u010a\u010a", "for", "\u0120s", "\u0120in", "\u0120dict", "_li", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(s", ")\u010a"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7186273667339679, 0.6339004969859428, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.6771609938949378, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7186273667339679, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994]} +{"problem_id": "p03721", "input": "n,k = list(map(int,input().split()))\n\nl = [0]*(10**5+1)\n\nfor i in range(n):\n\n ai,bi = list(map(int,input().split()))\n\n l[ai]+=bi\n\nfor index,i in enumerate(l):\n\n if i:\n\n k-=i\n\n if k<=0:\n\n break\n\nprint(index)", "input_tokens": ["n", ",k", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "l", "\u0120=", "\u0120[", "0", "]*(", "1", "0", "**", "5", "+", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ai", ",", "bi", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "[", "ai", "]+=", "bi", "\u010a\u010a", "for", "\u0120index", ",i", "\u0120in", "\u0120enumerate", "(l", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "-=", "i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", "<=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "print", "(index", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03416", "input": "A, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = list(str(i))\n\n\n\n if l == list(reversed(l)):\n\n cnt += 1\n\n\n\nprint(cnt)\n", "input_tokens": ["A", ",", "\u0120B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(A", ",", "\u0120B", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120list", "(str", "(i", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120==", "\u0120list", "(re", "versed", "(l", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03363", "input": "n = int(input())\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nfrom math import factorial\n\ndef combinations_count(n, r):\n\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += combinations_count(j,2)\n\n\n\nprint(ans)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ary", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "#print", "(n", ",", "ary", ")\u010a\u010a\u010a\u010a", "ary", "_", "2", "\u0120=", "\u0120[", "ary", "[", "0", "]]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ary", "_", "2", ".append", "(", "ary", "[i", "]", "\u0120+", "\u0120ary", "_", "2", "[i", "-", "1", "])\u010a\u010a", "ary", "_", "2", "\u0120=", "\u0120[", "0", "]", "\u0120+", "\u0120ary", "_", "2", "\u010a\u010a", "#print", "(", "ary", "_", "2", ")\u010a\u010a\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "c", "\u0120=", "\u0120Counter", "(", "ary", "_", "2", ")\u010a\u010a", "v", "\u0120=", "\u0120(", "list", "(c", ".values", "()))\u010a\u010a", "#print", "(v", ")\u010a\u010a\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a", "def", "\u0120combinations", "_count", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120factorial", "(n", ")", "\u0120//", "\u0120(", "factor", "ial", "(n", "\u0120-", "\u0120r", ")", "\u0120*", "\u0120factorial", "(r", "))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120v", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120>", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120combinations", "_count", "(j", ",", "2", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.8591441175808593, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02792", "input": "N = int(input())\n\nmem = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "mem", "\u0120=", "\u0120[[", "0", "]*", "1", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(str", "(i", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120int", "(str", "(i", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120mem", "[a", "][", "b", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(str", "(i", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120int", "(str", "(i", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120mem", "[b", "][", "a", "]\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.6673426178365944, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.6673426178365944, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p03796", "input": "N = int(input())\n\np = 1\n\nfor i in range(N):\n\n p *= (i + 1)\n\n p %= (1e9 + 7)\n\nprint((int(p)))", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "p", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120*=", "\u0120(", "i", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120%=", "\u0120(", "1", "e", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a", "print", "((", "int", "(p", ")))"], "input_token_weights": [0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.8408263201236497, 0.7967329450848046, 0.883057299767519, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.7022465694939416, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.7022465694939416, 0.8408263201236497, 0.7967329450848046, 0.7022465694939416, 0.6514299043837268, 0.7967329450848046]} +{"problem_id": "p02725", "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\ndiff = []\n\n\n\nfor i in range(n - 1):\n\n diff.append(a[i + 1] - a[i])\n\ndiff.append(k - a[-1] + a[0])\n\n\n\nprint((k - max(diff)))\n", "input_tokens": ["k", ",", "\u0120n", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "diff", "\u0120=", "\u0120[]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "\u0120-", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120diff", ".append", "(a", "[i", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120a", "[i", "])\u010a\u010a", "diff", ".append", "(k", "\u0120-", "\u0120a", "[-", "1", "]", "\u0120+", "\u0120a", "[", "0", "])\u010a\u010a", "\u010a\u010a", "print", "((", "k", "\u0120-", "\u0120max", "(diff", ")))\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.8591441175808593]} +{"problem_id": "p03253", "input": "class Calc:\n\n def __init__(self, max_value, mod):\n\n \"\"\"combination(max_value, all)\"\"\"\n\n fact = [-1] * (max_value + 1)\n\n fact[0] = 1\n\n fact[1] = 1\n\n for x in range(2, max_value + 1):\n\n fact[x] = x * fact[x - 1] % mod\n\n\n\n invs = [1] * (max_value + 1)\n\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n\n for x in range(max_value - 1, 0, -1):\n\n invs[x] = invs[x + 1] * (x + 1) % mod\n\n\n\n self.fact = fact\n\n self.invs = invs\n\n self.mod = mod\n\n\n\n def combination(self, n, r):\n\n if n - r < r:\n\n return self.combination(n, n - r)\n\n if r < 0:\n\n return 0\n\n if r == 0:\n\n return 1\n\n if r == 1:\n\n return n\n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\n\n\n\ndef gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n ma = d * d\n\n while ma <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n ma += d * 4 + 4\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n cal = Calc(max_value=N + 30, mod=MOD)\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["class", "\u0120Calc", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120max", "_value", ",", "\u0120mod", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"", "combination", "(max", "_value", ",", "\u0120all", ")", "\"\"\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fact", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120(", "max", "_value", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fact", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fact", "[", "1", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(", "2", ",", "\u0120max", "_value", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fact", "[x", "]", "\u0120=", "\u0120x", "\u0120*", "\u0120fact", "[x", "\u0120-", "\u0120", "1", "]", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inv", "s", "\u0120=", "\u0120[", "1", "]", "\u0120*", "\u0120(", "max", "_value", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inv", "s", "[max", "_value", "]", "\u0120=", "\u0120pow", "(f", "act", "[max", "_value", "],", "\u0120mod", "\u0120-", "\u0120", "2", ",", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(max", "_value", "\u0120-", "\u0120", "1", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inv", "s", "[x", "]", "\u0120=", "\u0120inv", "s", "[x", "\u0120+", "\u0120", "1", "]", "\u0120*", "\u0120(", "x", "\u0120+", "\u0120", "1", ")", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".f", "act", "\u0120=", "\u0120fact", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".in", "vs", "\u0120=", "\u0120inv", "s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".mod", "\u0120=", "\u0120mod", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120combination", "(self", ",", "\u0120n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120-", "\u0120r", "\u0120<", "\u0120r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120self", ".com", "b", "ination", "(n", ",", "\u0120n", "\u0120-", "\u0120r", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120self", ".f", "act", "[n", "]", "\u0120*", "\u0120self", ".in", "vs", "[r", "]", "\u0120*", "\u0120self", ".in", "vs", "[n", "\u0120-", "\u0120r", "]", "\u0120%", "\u0120self", ".mod", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120gen", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120%", "\u0120d", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120//=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120yield", "\u0120cnt", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ma", "\u0120=", "\u0120d", "\u0120*", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120ma", "\u0120<=", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120%", "\u0120d", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120//=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120yield", "\u0120cnt", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ma", "\u0120+=", "\u0120d", "\u0120*", "\u0120", "4", "\u0120+", "\u0120", "4", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120+=", "\u0120", "2", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120yield", "\u0120", "1", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120MOD", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120cal", "\u0120=", "\u0120Calc", "(max", "_value", "=N", "\u0120+", "\u0120", "3", "0", ",", "\u0120mod", "=", "MOD", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120cnt", "\u0120in", "\u0120gen", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120(", "ans", "\u0120*", "\u0120cal", ".com", "b", "ination", "(N", "\u0120+", "\u0120cnt", "\u0120-", "\u0120", "1", ",", "\u0120cnt", "))", "\u0120%", "\u0120MOD", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7281392564472128, 0.7561438265913266, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7561438265913266, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.8357386476069529, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.6993277790098028, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.6696615116992518, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7561438265913266, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.8357386476069529, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.6696615116992518, 0.6993277790098028, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.6696615116992518, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.7281392564472128, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.6696615116992518, 0.6993277790098028, 0.6993277790098028, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529]} +{"problem_id": "p02983", "input": "def c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))", "input_tokens": ["def", "\u0120c", "_remain", "der", "_min", "imization", "_", "2", "0", "1", "9", "(L", ",", "\u0120R", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(L", ",", "\u0120min", "(R", ",", "\u0120L", "\u0120+", "\u0120", "2", "0", "1", "9", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "\u0120+", "\u0120", "1", ",", "\u0120min", "(R", "\u0120+", "\u0120", "1", ",", "\u0120L", "\u0120+", "\u0120", "2", "0", "2", "0", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120(", "i", "\u0120*", "\u0120j", ")", "\u0120%", "\u0120", "2", "0", "1", "9", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ans", "\u010a\u010a\u010a\u010a", "L", ",", "\u0120R", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "print", "((", "c", "_remain", "der", "_min", "imization", "_", "2", "0", "1", "9", "(L", ",", "\u0120R", ")))"], "input_token_weights": [0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7833854580549265, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6696615116992518, 0.5749858371565393, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nval = float('inf')\n\nfor k in range(10 ** 5 + 1):\n\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\n\nprint(val)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "val", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(", "1", "0", "\u0120**", "\u0120", "5", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120val", "\u0120=", "\u0120min", "(val", ",", "\u0120", "2", "\u0120*", "\u0120c", "\u0120*", "\u0120k", "\u0120+", "\u0120max", "(x", "\u0120-", "\u0120k", ",", "\u0120", "0", ")", "\u0120*", "\u0120a", "\u0120+", "\u0120max", "(y", "\u0120-", "\u0120k", ",", "\u0120", "0", ")", "\u0120*", "\u0120b", ")\u010a\u010a", "print", "(val", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03796", "input": "from math import factorial as f\n\nn = int(input())\n\nprint((f(n) % (10 ** 9 + 7)))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u0120as", "\u0120f", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "f", "(n", ")", "\u0120%", "\u0120(", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p03039", "input": "n,m,k=list(map(int,input().split()))\n\nmod=10**9+7\n\nf=[1]\n\nfor i in range(2*10**5+7):f+=[f[-1]*(i+1)%mod]\n\ndef comb(a,b):return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod\n\nans=0\n\nfor i in range(1,n):\n\n ans+=(i*(n-i)*m**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nfor i in range(1,m):\n\n ans+=(i*(m-i)*n**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nprint(ans)", "input_tokens": ["n", ",m", ",k", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "mod", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "f", "=[", "1", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "*", "1", "0", "**", "5", "+", "7", "):", "f", "+", "=[", "f", "[-", "1", "]*(", "i", "+", "1", ")%", "mod", "]\u010a\u010a", "def", "\u0120comb", "(a", ",b", "):", "return", "\u0120f", "[a", "]*", "pow", "(f", "[b", "],", "mod", "-", "2", ",", "mod", ")*", "pow", "(f", "[a", "-b", "],", "mod", "-", "2", ",", "mod", ")%", "mod", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "):\u010a\u010a", "\u0120", "\u0120ans", "+=(", "i", "*(", "n", "-i", ")*", "m", "**", "2", ")*(", "comb", "(n", "*m", "-", "2", ",k", "-", "2", "))\u010a\u010a", "\u0120", "\u0120ans", "%=", "mod", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",m", "):\u010a\u010a", "\u0120", "\u0120ans", "+=(", "i", "*(", "m", "-i", ")*", "n", "**", "2", ")*(", "comb", "(n", "*m", "-", "2", ",k", "-", "2", "))\u010a\u010a", "\u0120", "\u0120ans", "%=", "mod", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.8591441175808593, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(int", "(input", "()))", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8691775287719905]} +{"problem_id": "p03371", "input": "A, B, C, X, Y = [int(_) for _ in input().split()]\n\nans = A * X + B * Y\n\nfor i in range(max(X, Y) + 1):\n\n cost = 2 * C * i\n\n if X > i:\n\n cost += A * (X - i)\n\n if Y > i:\n\n cost += B * (Y - i)\n\n ans = min(ans, cost)\n\nprint(ans)", "input_tokens": ["A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120[", "int", "(_)", "\u0120for", "\u0120_", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "ans", "\u0120=", "\u0120A", "\u0120*", "\u0120X", "\u0120+", "\u0120B", "\u0120*", "\u0120Y", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(max", "(X", ",", "\u0120Y", ")", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cost", "\u0120=", "\u0120", "2", "\u0120*", "\u0120C", "\u0120*", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120X", "\u0120>", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cost", "\u0120+=", "\u0120A", "\u0120*", "\u0120(", "X", "\u0120-", "\u0120i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120Y", "\u0120>", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cost", "\u0120+=", "\u0120B", "\u0120*", "\u0120(", "Y", "\u0120-", "\u0120i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120cost", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7060506397782503, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.5851191688414608, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p03945", "input": "s = input()\n\nlen_s = len(s)\n\ncnt = [0, 0]\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n memo_1 = s[len_s - i]\n\n if s[i] != memo_0:\n\n cnt[0] += 1\n\n if s[len_s - i - 1] != memo_1:\n\n cnt[1] += 1\n\nprint((min(cnt)))\n", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a", "len", "_s", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "cnt", "\u0120=", "\u0120[", "0", ",", "\u0120", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120memo", "_", "0", "\u0120=", "\u0120s", "[i", "\u0120-", "\u0120", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120memo", "_", "1", "\u0120=", "\u0120s", "[len", "_s", "\u0120-", "\u0120i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120!=", "\u0120memo", "_", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "[", "0", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[len", "_s", "\u0120-", "\u0120i", "\u0120-", "\u0120", "1", "]", "\u0120!=", "\u0120memo", "_", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "[", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "((", "min", "(cnt", ")))\u010a"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7332896764791028, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.6886415962350058, 0.5928797394668679, 0.6886415962350058, 0.7332896764791028, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7332896764791028, 0.5928797394668679, 0.8170167109432965, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.5928797394668679, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.8170167109432965, 0.7332896764791028, 0.7332896764791028, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.5928797394668679, 0.6886415962350058, 0.7332896764791028, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.5928797394668679, 0.6886415962350058, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.6886415962350058, 0.8170167109432965]} +{"problem_id": "p03558", "input": "import heapq\n\nK=int(input())\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=[]\n\nheapq.heappush(q,(0,1))\n\nwhile (len(q)!=0):\n\n prc,src=heapq.heappop(q)\n\n if dist[src]dist[src]+1:\n\n dist[(src+1)%K]=dist[src]+1\n\n heapq.heappush(q,(dist[(src+1)%K],(src+1)%K))\n\n if dist[(10*src)%K]>dist[src]:\n\n dist[(10*src)%K]=dist[src]\n\n heapq.heappush(q,(dist[(src*10)%K],(src*10)%K))\n\nprint((dist[0]))\n", "input_tokens": ["import", "\u0120heapq", "\u010a\u010a", "K", "=int", "(input", "())\u010a\u010a", "dist", "=[", "1", "0", "**", "1", "5", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(K", ")]\u010a\u010a", "dist", "[", "1", "]=", "1", "\u010a\u010a", "q", "=[]", "\u010a\u010a", "heap", "q", ".he", "app", "ush", "(q", ",(", "0", ",", "1", "))\u010a\u010a", "while", "\u0120(", "len", "(q", ")!=", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120pr", "c", ",", "src", "=", "heap", "q", ".he", "app", "op", "(q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dist", "[src", "]<", "pr", "c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dist", "[(", "src", "+", "1", ")%", "K", "]>", "dist", "[src", "]+", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dist", "[(", "src", "+", "1", ")%", "K", "]=", "dist", "[src", "]+", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",(", "dist", "[(", "src", "+", "1", ")%", "K", "],", "(", "src", "+", "1", ")%", "K", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dist", "[(", "1", "0", "*", "src", ")%", "K", "]>", "dist", "[src", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dist", "[(", "1", "0", "*", "src", ")%", "K", "]=", "dist", "[src", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",(", "dist", "[(", "src", "*", "1", "0", ")%", "K", "],", "(", "src", "*", "1", "0", ")%", "K", "))\u010a\u010a", "print", "((", "dist", "[", "0", "]))\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308]} +{"problem_id": "p02792", "input": "n = int(input())\n\n\n\ncnt = 0\n\nfor i in range(1, n+1):\n\n i_str = str(i)\n\n if len(i_str) == 1:\n\n cnt += 1\n\n continue\n\n if len(i_str) == 2:\n\n if int(i_str[0]) == int(i_str[1]):\n\n cnt += 3\n\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 3:\n\n if int(i_str[0]) == int(i_str[2]):\n\n cnt += 4 + (2 * (int(i_str[1])+1) - 1)\n\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n\n cnt += 22\n\n elif int(i_str[0]) < int(i_str[2]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 4:\n\n if int(i_str[0]) == int(i_str[3]):\n\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2])+1) - 1\n\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n\n cnt += 222\n\n elif int(i_str[0]) < int(i_str[3]):\n\n cnt += 22\n\n continue\n\n if len(i_str) == 5:\n\n if int(i_str[0]) == int(i_str[4]):\n\n cnt += 224 + 200 * int(i_str[1]) + 20 * int(i_str[2]) + 2 * (int(i_str[3])+1) - 1\n\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n\n cnt += 2222\n\n elif int(i_str[0]) < int(i_str[4]):\n\n cnt += 222\n\n continue\n\n if len(i_str) == 6:\n\n if int(i_str[0]) == int(i_str[5]):\n\n cnt += 2224 + 2000 * int(i_str[1]) + 200 * int(i_str[2]) + 20 * int(i_str[3]) + 2 * (int(i_str[4])+1) - 1\n\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n\n cnt += 22222\n\n elif int(i_str[0]) < int(i_str[5]):\n\n cnt += 2222\n\n continue\n\n\n\nprint(cnt)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "_str", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120==", "\u0120int", "(i", "_str", "[", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "1", "])", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120>", "\u0120int", "(i", "_str", "[", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "3", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120==", "\u0120int", "(i", "_str", "[", "2", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "4", "\u0120+", "\u0120(", "2", "\u0120*", "\u0120(", "int", "(i", "_str", "[", "1", "])+", "1", ")", "\u0120-", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "2", "])", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120>", "\u0120int", "(i", "_str", "[", "2", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120<", "\u0120int", "(i", "_str", "[", "2", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "4", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120==", "\u0120int", "(i", "_str", "[", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "4", "\u0120+", "\u0120", "2", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "1", "])", "\u0120+", "\u0120", "2", "\u0120*", "\u0120(", "int", "(i", "_str", "[", "2", "])+", "1", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "3", "])", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120>", "\u0120int", "(i", "_str", "[", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120<", "\u0120int", "(i", "_str", "[", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120==", "\u0120int", "(i", "_str", "[", "4", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "4", "\u0120+", "\u0120", "2", "0", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "1", "])", "\u0120+", "\u0120", "2", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "2", "])", "\u0120+", "\u0120", "2", "\u0120*", "\u0120(", "int", "(i", "_str", "[", "3", "])+", "1", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "4", "])", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120>", "\u0120int", "(i", "_str", "[", "4", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120<", "\u0120int", "(i", "_str", "[", "4", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(i", "_str", ")", "\u0120==", "\u0120", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120==", "\u0120int", "(i", "_str", "[", "5", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "4", "\u0120+", "\u0120", "2", "0", "0", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "1", "])", "\u0120+", "\u0120", "2", "0", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "2", "])", "\u0120+", "\u0120", "2", "0", "\u0120*", "\u0120int", "(i", "_str", "[", "3", "])", "\u0120+", "\u0120", "2", "\u0120*", "\u0120(", "int", "(i", "_str", "[", "4", "])+", "1", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "5", "])", "\u0120!=", "\u0120", "0", "\u0120and", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120>", "\u0120int", "(i", "_str", "[", "5", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120int", "(i", "_str", "[", "0", "])", "\u0120<", "\u0120int", "(i", "_str", "[", "5", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "2", "2", "2", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.9273515896195933, 0.9273515896195933, 0.9083337953965728, 0.8889473014940781, 0.8889473014940781, 0.5686609715453708, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.9273515896195933, 0.5686609715453708, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9273515896195933, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9460144469641688, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.9083337953965728, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8889473014940781, 0.5686609715453708, 0.8889473014940781, 0.9083337953965728, 0.5686609715453708, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.8490090158852169, 0.5686609715453708, 0.5686609715453708, 0.8691775287719905, 0.5686609715453708, 0.5686609715453708, 0.9083337953965728, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8889473014940781, 0.5686609715453708, 0.8889473014940781, 0.9083337953965728, 0.5686609715453708, 0.8691775287719905, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8490090158852169, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8691775287719905, 0.5686609715453708, 0.8074090697023789, 0.8074090697023789, 0.5686609715453708, 0.8074090697023789, 0.5686609715453708, 0.5686609715453708, 0.8490090158852169, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8074090697023789, 0.5686609715453708, 0.8074090697023789, 0.8284253466378658, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8691775287719905, 0.5686609715453708, 0.5686609715453708, 0.9083337953965728, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8889473014940781, 0.5686609715453708, 0.8889473014940781, 0.9083337953965728, 0.5686609715453708, 0.8691775287719905, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8490090158852169, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8691775287719905, 0.5686609715453708, 0.8074090697023789, 0.8074090697023789, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.7640031686476719, 0.7186273667339679, 0.7186273667339679, 0.6951432441854742, 0.6464527786867319, 0.6211886504852411, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.6710943273460512, 0.6710943273460512, 0.6951432441854742, 0.741572616038919, 0.5686609715453708, 0.741572616038919, 0.7640031686476719, 0.5686609715453708, 0.8490090158852169, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8074090697023789, 0.5686609715453708, 0.8074090697023789, 0.8284253466378658, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8490090158852169, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.785941609719976, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.785941609719976, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8691775287719905, 0.5686609715453708, 0.5686609715453708, 0.9083337953965728, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8889473014940781, 0.5686609715453708, 0.8889473014940781, 0.9083337953965728, 0.5686609715453708, 0.8691775287719905, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8490090158852169, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8691775287719905, 0.5686609715453708, 0.8074090697023789, 0.8074090697023789, 0.5686609715453708, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.5686609715453708, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6951432441854742, 0.6710943273460512, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6710943273460512, 0.7640031686476719, 0.5686609715453708, 0.741572616038919, 0.741572616038919, 0.7186273667339679, 0.6710943273460512, 0.6464527786867319, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.7186273667339679, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8490090158852169, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8074090697023789, 0.5686609715453708, 0.8074090697023789, 0.8284253466378658, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8490090158852169, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.785941609719976, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.785941609719976, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8691775287719905, 0.5686609715453708, 0.5686609715453708, 0.9083337953965728, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8889473014940781, 0.5686609715453708, 0.8889473014940781, 0.9083337953965728, 0.5686609715453708, 0.8691775287719905, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8490090158852169, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8691775287719905, 0.5686609715453708, 0.8074090697023789, 0.8074090697023789, 0.5686609715453708, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5686609715453708, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6710943273460512, 0.6464527786867319, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6464527786867319, 0.741572616038919, 0.5686609715453708, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6951432441854742, 0.6710943273460512, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6710943273460512, 0.7640031686476719, 0.5686609715453708, 0.741572616038919, 0.741572616038919, 0.7186273667339679, 0.6710943273460512, 0.6464527786867319, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.7186273667339679, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8490090158852169, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8074090697023789, 0.5686609715453708, 0.8074090697023789, 0.8284253466378658, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8490090158852169, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.785941609719976, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.785941609719976, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8691775287719905, 0.5686609715453708, 0.5686609715453708, 0.9083337953965728, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8889473014940781, 0.5686609715453708, 0.8889473014940781, 0.9083337953965728, 0.5686609715453708, 0.8691775287719905, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8490090158852169, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8691775287719905, 0.5686609715453708, 0.8074090697023789, 0.8074090697023789, 0.5686609715453708, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.5686609715453708, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.6464527786867319, 0.6211886504852411, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.6211886504852411, 0.7186273667339679, 0.5686609715453708, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6710943273460512, 0.6464527786867319, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6464527786867319, 0.741572616038919, 0.5686609715453708, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6951432441854742, 0.6710943273460512, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6710943273460512, 0.7640031686476719, 0.5686609715453708, 0.741572616038919, 0.741572616038919, 0.7186273667339679, 0.6710943273460512, 0.6464527786867319, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.7186273667339679, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8490090158852169, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8074090697023789, 0.5686609715453708, 0.8074090697023789, 0.8284253466378658, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7640031686476719, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8490090158852169, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.785941609719976, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.785941609719976, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.8691775287719905, 0.5686609715453708, 0.9273515896195933, 0.9083337953965728, 0.9083337953965728]} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\nans = math.factorial(N) % (10**9 + 7)\n\nprint(ans)", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120math", ".factor", "ial", "(N", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.883057299767519, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7506053018110229, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03038", "input": "from heapq import heappop, heappush\n\n\n\nn, m = list(map(int, input().split()))\n\na = tuple(map(int, input().split()))\n\n\n\nhq = []\n\nfor aa in a:\n\n heappush(hq, (-aa, 1))\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(hq, (-c, b))\n\n\n\nrest = n\n\nans = 0\n\nwhile rest > 0:\n\n num, cnt = heappop(hq)\n\n\n\n num *= (-1)\n\n use = min(rest, cnt)\n\n ans += use * num\n\n rest -= use\n\n\n\nprint(ans)\n", "input_tokens": ["from", "\u0120heapq", "\u0120import", "\u0120he", "app", "op", ",", "\u0120he", "app", "ush", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "hq", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120aa", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120he", "app", "ush", "(h", "q", ",", "\u0120(-", "aa", ",", "\u0120", "1", "))", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120he", "app", "ush", "(h", "q", ",", "\u0120(-", "c", ",", "\u0120b", "))", "\u010a\u010a\u010a\u010a", "rest", "\u0120=", "\u0120n", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120rest", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", ",", "\u0120cnt", "\u0120=", "\u0120he", "app", "op", "(h", "q", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120*=", "\u0120(-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120use", "\u0120=", "\u0120min", "(rest", ",", "\u0120cnt", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120use", "\u0120*", "\u0120num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120rest", "\u0120-=", "\u0120use", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03371", "input": "A,B,C,X,Y = list(map(int,input().split()))\n\nl = []\n\nfor i in range(max(X,Y)+1):\n\n T = i * C * 2\n\n if i < X: \n\n T += (X-i)*A\n\n if i < Y:\n\n T += (Y-i)*B\n\n l.append(T)\n\nl.sort()\n\nprint((l[0]))", "input_tokens": ["A", ",B", ",C", ",X", ",Y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "l", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(max", "(X", ",Y", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120i", "\u0120*", "\u0120C", "\u0120*", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120<", "\u0120X", ":", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120T", "\u0120+=", "\u0120(", "X", "-i", ")*", "A", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120<", "\u0120Y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120T", "\u0120+=", "\u0120(", "Y", "-i", ")*", "B", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ".append", "(T", ")\u010a\u010a", "l", ".sort", "()\u010a\u010a", "print", "((", "l", "[", "0", "]))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p04012", "input": "import collections\n\nimport sys\n\na=input()\n\nb=[]\n\n\n\nfor i in a:\n\n b.append(i)\n\n \n\nb.sort()\n\nc=collections.Counter(b)\n\nc=list(c.values())\n\n\n\nfor i in range(len(c)):\n\n if int(c[i])%2==0:\n\n q=0\n\n else:\n\n q=1\n\n print('No')\n\n sys.exit()\n\n \n\nprint('Yes')\n", "input_tokens": ["import", "\u0120collections", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "a", "=input", "()\u010a\u010a", "b", "=[]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120", "\u0120b", ".append", "(i", ")\u010a\u010a", "\u0120\u0120\u010a\u010a", "b", ".sort", "()\u010a\u010a", "c", "=c", "ollections", ".Counter", "(b", ")\u010a\u010a", "c", "=list", "(c", ".values", "())\u010a\u010a", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(c", "))", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120int", "(c", "[i", "])", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "=", "0", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "('", "Yes", "')\u010a"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.7433160191943734, 0.8139227859741643, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8474406118450124, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.7060506397782503, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.6673426178365944, 0.6270757423345348, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8474406118450124]} +{"problem_id": "p03835", "input": "#ABC951B/Sum_of_Three_Integers\n\n\n\nK, S = list(map(int, input().split()))\n\nans = 0\n\nfor x in range(0, K+1):\n\n for y in range(0, K+1):\n\n z = S - x - y\n\n if 0 <= z and z <= K:\n\n ans += 1\n\nprint(ans)", "input_tokens": ["#", "ABC", "9", "5", "1", "B", "/", "Sum", "_of", "_", "Three", "_Int", "egers", "\u010a\u010a\u010a\u010a", "K", ",", "\u0120S", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "0", ",", "\u0120K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(", "0", ",", "\u0120K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120z", "\u0120=", "\u0120S", "\u0120-", "\u0120x", "\u0120-", "\u0120y", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "\u0120<=", "\u0120z", "\u0120and", "\u0120z", "\u0120<=", "\u0120K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02276", "input": "n=int(input())-1\n\nA=list(map(int,input().split()))\n\ni=0\n\nfor j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\nA[i],A[n]=A[n],A[i]\n\nprint((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n", "input_tokens": ["n", "=int", "(input", "())", "-", "1", "\u010a\u010a", "A", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "i", "=", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120if", "\u0120A", "[j", "]<=", "A", "[-", "1", "]:", "A", "[i", "],", "A", "[j", "]=", "A", "[j", "],", "A", "[i", "];", "i", "+=", "1", "\u010a\u010a", "A", "[i", "],", "A", "[n", "]=", "A", "[n", "],", "A", "[i", "]\u010a\u010a", "print", "((\"", "\u0120\".", "join", "(map", "(str", ",A", "[:", "i", "]))", "+\"", "\u0120[\"", "+", "str", "(A", "[i", "])+", "\"]", "\u0120\"+\"", "\u0120\".", "join", "(map", "(str", ",A", "[i", "+", "1", ":", "]))", "))\u010a"], "input_token_weights": [0.914713330925897, 0.914713330925897, 0.8456076926739031, 0.8456076926739031, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.9367265554405826, 0.8922045961188434, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8922045961188434, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.8922045961188434, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6339004969859428, 0.60398418480891, 0.7186273667339679, 0.7713695892187169, 0.7453461554353482, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.8214688817838891, 0.7967329450848046, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.7967329450848046, 0.8922045961188434]} +{"problem_id": "p02792", "input": "N = int(input())\n\nmem = [[0]*10 for _ in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "mem", "\u0120=", "\u0120[[", "0", "]*", "1", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "1", "0", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(str", "(i", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120int", "(str", "(i", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120mem", "[a", "][", "b", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(str", "(i", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120int", "(str", "(i", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120mem", "[b", "][", "a", "]\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.6673426178365944, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.6673426178365944, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p04012", "input": "w = input()\n\nfor l in w:\n\n\tif w.count(l) % 2 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")", "input_tokens": ["w", "\u0120=", "\u0120input", "()\u010a\u010a", "for", "\u0120l", "\u0120in", "\u0120w", ":\u010a\u010a", "\u0109if", "\u0120w", ".count", "(l", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0109", "\u0109print", "(\"", "No", "\")\u010a\u010a", "\u0109", "\u0109break", "\u010a\u010a", "else", ":\u010a\u010a", "\u0109print", "(\"", "Yes", "\")"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.5886835746651548, 0.7584425223266994, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.5886835746651548, 0.6771609938949378, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.7186273667339679, 0.6771609938949378, 0.7186273667339679]} +{"problem_id": "p03416", "input": "a, b = list(map(int, input().split()))\n\ntmp=str(a)\n\nc=0\n\nfor i in range(a,b+1):\n\n tmp=str(i)\n\n tmp2=\"\"\n\n for s in range(len(tmp)):\n\n tmp2=tmp2+tmp[len(tmp)-1-s]\n\n if tmp==tmp2:\n\n c=c+1\n\nprint(c)", "input_tokens": ["a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "tmp", "=str", "(a", ")\u010a\u010a", "c", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "=str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "2", "=\"", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120s", "\u0120in", "\u0120range", "(len", "(tmp", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "2", "=tmp", "2", "+", "tmp", "[len", "(tmp", ")-", "1", "-s", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "==", "tmp", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "=c", "+", "1", "\u010a\u010a", "print", "(c", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03835", "input": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n z=s-i-j\n\n if 0<=z<=k:\n\n ans+=1\n\nprint(ans)\n", "input_tokens": ["k", ",s", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120z", "=s", "-i", "-j", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "<=", "z", "<=", "k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03078", "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return map(int, input().split())\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nAB = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tAB.append(A[i]+B[j])\n\n\n\nAB.sort(reverse = True)\n\nAB = AB[:3000]\n\nABC = sorted([C[0]+AB[i] for i in range(min(3000, X*Y))], reverse = True)\n\n\n\nfor j in range(1, Z):\n\n\tABC_tmp = sorted([C[j]+AB[i] for i in range(min(3000, X*Y))])\n\n\tABC += ABC_tmp\n\n\tABC.sort(reverse = True)\n\n\tABC = ABC[:3000]\n\n\n\nprint(*ABC[:K], sep= \"\\n\")\n\n\n", "input_tokens": ["import", "\u0120sys", ",", "\u0120re", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", ",", "\u0120defaultdict", ",", "\u0120Counter", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120ceil", ",", "\u0120sqrt", ",", "\u0120hyp", "ot", ",", "\u0120factorial", ",", "\u0120pi", ",", "\u0120sin", ",", "\u0120cos", ",", "\u0120tan", ",", "\u0120as", "in", ",", "\u0120acos", ",", "\u0120atan", ",", "\u0120radians", ",", "\u0120degrees", ",", "\u0120log", "2", ",", "\u0120gcd", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120accumulate", ",", "\u0120permutations", ",", "\u0120combinations", ",", "\u0120combinations", "_with", "_re", "placement", ",", "\u0120product", ",", "\u0120group", "by", "\u010a\u010a", "from", "\u0120operator", "\u0120import", "\u0120item", "getter", ",", "\u0120mul", "\u010a\u010a", "from", "\u0120copy", "\u0120import", "\u0120deepcopy", "\u010a\u010a", "from", "\u0120string", "\u0120import", "\u0120ascii", "_lowercase", ",", "\u0120ascii", "_upper", "case", ",", "\u0120digits", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", ",", "\u0120bis", "ect", "_left", ",", "\u0120ins", "ort", ",", "\u0120ins", "ort", "_left", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120reduce", ",", "\u0120l", "ru", "_cache", "\u010a\u010a", "def", "\u0120input", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a", "def", "\u0120INT", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120MAP", "():", "\u0120return", "\u0120map", "(int", ",", "\u0120input", "().", "split", "())\u010a\u010a", "def", "\u0120LIST", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120T", "UPLE", "():", "\u0120return", "\u0120tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120ZIP", "(n", "):", "\u0120return", "\u0120zip", "(*(", "MAP", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")))\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u0120\u010a\u010a", "#", "mod", "\u0120=", "\u0120", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "from", "\u0120decimal", "\u0120import", "\u0120*\u010a\u010a", "#import", "\u0120numpy", "\u0120as", "\u0120np", "\u010a\u010a", "#", "decimal", ".get", "context", "().", "prec", "\u0120=", "\u0120", "1", "0", "\u010a\u010a\u010a\u010a", "X", ",", "\u0120Y", ",", "\u0120Z", ",", "\u0120K", "\u0120=", "\u0120MAP", "()\u010a\u010a", "A", "\u0120=", "\u0120sorted", "(L", "IST", "(),", "\u0120reverse", "\u0120=", "\u0120True", ")\u010a\u010a", "B", "\u0120=", "\u0120sorted", "(L", "IST", "(),", "\u0120reverse", "\u0120=", "\u0120True", ")\u010a\u010a", "C", "\u0120=", "\u0120sorted", "(L", "IST", "(),", "\u0120reverse", "\u0120=", "\u0120True", ")\u010a\u010a\u010a\u010a", "AB", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(X", "):\u010a\u010a", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(Y", "):\u010a\u010a", "\u0109", "\u0109", "AB", ".append", "(A", "[i", "]+", "B", "[j", "])\u010a\u010a", "\u010a\u010a", "AB", ".sort", "(reverse", "\u0120=", "\u0120True", ")\u010a\u010a", "AB", "\u0120=", "\u0120AB", "[:", "3", "0", "0", "0", "]\u010a\u010a", "ABC", "\u0120=", "\u0120sorted", "([", "C", "[", "0", "]+", "AB", "[i", "]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(min", "(", "3", "0", "0", "0", ",", "\u0120X", "*", "Y", "))", "],", "\u0120reverse", "\u0120=", "\u0120True", ")\u010a\u010a\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "\u0120Z", "):\u010a\u010a", "\u0109", "ABC", "_tmp", "\u0120=", "\u0120sorted", "([", "C", "[j", "]+", "AB", "[i", "]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(min", "(", "3", "0", "0", "0", ",", "\u0120X", "*", "Y", "))", "])\u010a\u010a", "\u0109", "ABC", "\u0120+=", "\u0120ABC", "_tmp", "\u010a\u010a", "\u0109", "ABC", ".sort", "(reverse", "\u0120=", "\u0120True", ")\u010a\u010a", "\u0109", "ABC", "\u0120=", "\u0120ABC", "[:", "3", "0", "0", "0", "]\u010a\u010a\u010a\u010a", "print", "(*", "ABC", "[:", "K", "],", "\u0120sep", "=", "\u0120\"\\", "n", "\")\u010a\u010a\u010a"], "input_token_weights": [0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.8854867975141383, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.6993277790098028, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.6993277790098028, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7561438265913266, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.8357386476069529, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8854867975141383, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7281392564472128, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7833854580549265, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.7561438265913266, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6993277790098028, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8854867975141383]} +{"problem_id": "p00744", "input": "import collections\n\nimport math\n\n\n\n\n\nclass Dinic:\n\n \"\"\"Dinic Algorithm: find max-flow\n\n complexity: O(EV^2)\n\n used in GRL6A(AOJ)\n\n \"\"\"\n\n class edge:\n\n def __init__(self, to, cap, rev):\n\n self.to, self.cap, self.rev = to, cap, rev\n\n\n\n def __init__(self, V, E, source, sink):\n\n \"\"\" V: the number of vertexes\n\n E: adjacency list\n\n source: start point\n\n sink: goal point\n\n \"\"\"\n\n self.V = V\n\n self.E = [[] for _ in range(V)]\n\n for fr in range(V):\n\n for to, cap in E[fr]:\n\n self.E[fr].append(self.edge(to, cap, len(self.E[to])))\n\n self.E[to].append(self.edge(fr, 0, len(self.E[fr])-1))\n\n self.maxflow = self.dinic(source, sink)\n\n\n\n def dinic(self, source, sink):\n\n \"\"\"find max-flow\"\"\"\n\n INF = float('inf')\n\n maxflow = 0\n\n while True:\n\n self.bfs(source)\n\n if self.level[sink] < 0:\n\n return maxflow\n\n self.itr = [0] * self.V\n\n while True:\n\n flow = self.dfs(source, sink, INF)\n\n if flow > 0:\n\n maxflow += flow\n\n else:\n\n break\n\n\n\n def dfs(self, vertex, sink, flow):\n\n \"\"\"find augmenting path\"\"\"\n\n if vertex == sink:\n\n return flow\n\n for i in range(self.itr[vertex], len(self.E[vertex])):\n\n self.itr[vertex] = i\n\n e = self.E[vertex][i]\n\n if e.cap > 0 and self.level[vertex] < self.level[e.to]:\n\n d = self.dfs(e.to, sink, min(flow, e.cap))\n\n if d > 0:\n\n e.cap -= d\n\n self.E[e.to][e.rev].cap += d\n\n return d\n\n return 0\n\n\n\n def bfs(self, start):\n\n \"\"\"find shortest path from start\"\"\"\n\n que = collections.deque()\n\n self.level = [-1] * self.V\n\n que.append(start)\n\n self.level[start] = 0\n\n\n\n while que:\n\n fr = que.popleft()\n\n for e in self.E[fr]:\n\n if e.cap > 0 and self.level[e.to] < 0:\n\n self.level[e.to] = self.level[fr] + 1\n\n que.append(e.to)\n\n\n\nwhile True:\n\n M, N = list(map(int, input().split()))\n\n if M == 0 and N == 0:\n\n break\n\n blue, red = [], []\n\n while True:\n\n for x in input().split():\n\n blue.append(int(x))\n\n if len(blue) == M:\n\n break\n\n while True:\n\n for x in input().split():\n\n red.append(int(x))\n\n if len(red) == N:\n\n break\n\n V = M + N + 2\n\n edge = [set() for _ in range(V)]\n\n for i, b in enumerate(blue):\n\n if b != 1:\n\n for j, r in enumerate(red):\n\n if r % b == 0:\n\n edge[i].add((M+j, 1))\n\n for j in range(2, int(math.sqrt(b)) + 1):\n\n if b % j == 0:\n\n for k, r in enumerate(red):\n\n if r % j == 0 or r % (b // j) == 0:\n\n edge[i].add((M+k, 1))\n\n for i in range(M):\n\n edge[M+N].add((i, 1))\n\n for j in range(N):\n\n edge[M+j].add((M+N+1, 1))\n\n d = Dinic(V, edge, M+N, M+N+1)\n\n print((d.maxflow))", "input_tokens": ["import", "\u0120collections", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a\u010a\u010a\u010a\u010a", "class", "\u0120Din", "ic", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"", "D", "inic", "\u0120Algorithm", ":", "\u0120find", "\u0120max", "-flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120complexity", ":", "\u0120O", "(E", "V", "^", "2", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120used", "\u0120in", "\u0120G", "RL", "6", "A", "(A", "O", "J", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120class", "\u0120edge", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120to", ",", "\u0120cap", ",", "\u0120rev", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".to", ",", "\u0120self", ".cap", ",", "\u0120self", ".rev", "\u0120=", "\u0120to", ",", "\u0120cap", ",", "\u0120rev", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120V", ",", "\u0120E", ",", "\u0120source", ",", "\u0120sink", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"", "\u0120V", ":", "\u0120the", "\u0120number", "\u0120of", "\u0120vertex", "es", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120E", ":", "\u0120adjacency", "\u0120list", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120source", ":", "\u0120start", "\u0120point", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sink", ":", "\u0120goal", "\u0120point", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".V", "\u0120=", "\u0120V", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".E", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(V", ")]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120fr", "\u0120in", "\u0120range", "(V", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120to", ",", "\u0120cap", "\u0120in", "\u0120E", "[", "fr", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".E", "[", "fr", "].", "append", "(self", ".edge", "(to", ",", "\u0120cap", ",", "\u0120len", "(self", ".E", "[to", "]))", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".E", "[to", "].", "append", "(self", ".edge", "(fr", ",", "\u0120", "0", ",", "\u0120len", "(self", ".E", "[", "fr", "])-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".max", "flow", "\u0120=", "\u0120self", ".d", "inic", "(source", ",", "\u0120sink", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120din", "ic", "(self", ",", "\u0120source", ",", "\u0120sink", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"", "find", "\u0120max", "-flow", "\"\"\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "flow", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".b", "fs", "(source", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120self", ".level", "[s", "ink", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120max", "flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".it", "r", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120self", ".V", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120flow", "\u0120=", "\u0120self", ".d", "fs", "(source", ",", "\u0120sink", ",", "\u0120INF", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120flow", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "flow", "\u0120+=", "\u0120flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120dfs", "(self", ",", "\u0120vertex", ",", "\u0120sink", ",", "\u0120flow", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"", "find", "\u0120augment", "ing", "\u0120path", "\"\"\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120vertex", "\u0120==", "\u0120sink", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(self", ".it", "r", "[vertex", "],", "\u0120len", "(self", ".E", "[vertex", "]))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".it", "r", "[vertex", "]", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120e", "\u0120=", "\u0120self", ".E", "[vertex", "][", "i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120e", ".cap", "\u0120>", "\u0120", "0", "\u0120and", "\u0120self", ".level", "[vertex", "]", "\u0120<", "\u0120self", ".level", "[e", ".to", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120self", ".d", "fs", "(e", ".to", ",", "\u0120sink", ",", "\u0120min", "(flow", ",", "\u0120e", ".cap", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120e", ".cap", "\u0120-=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".E", "[e", ".to", "][", "e", ".rev", "].", "cap", "\u0120+=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120bfs", "(self", ",", "\u0120start", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120\"\"\"", "find", "\u0120shortest", "\u0120path", "\u0120from", "\u0120start", "\"\"\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", "\u0120=", "\u0120collections", ".de", "que", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".level", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120self", ".V", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".append", "(start", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".level", "[start", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120que", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fr", "\u0120=", "\u0120que", ".p", "opleft", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120e", "\u0120in", "\u0120self", ".E", "[", "fr", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120e", ".cap", "\u0120>", "\u0120", "0", "\u0120and", "\u0120self", ".level", "[e", ".to", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".level", "[e", ".to", "]", "\u0120=", "\u0120self", ".level", "[", "fr", "]", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120que", ".append", "(e", ".to", ")\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120M", ",", "\u0120N", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120M", "\u0120==", "\u0120", "0", "\u0120and", "\u0120N", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120blue", ",", "\u0120red", "\u0120=", "\u0120[],", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120blue", ".append", "(int", "(x", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(bl", "ue", ")", "\u0120==", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120red", ".append", "(int", "(x", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(red", ")", "\u0120==", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120V", "\u0120=", "\u0120M", "\u0120+", "\u0120N", "\u0120+", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120edge", "\u0120=", "\u0120[", "set", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(V", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120b", "\u0120in", "\u0120enumerate", "(bl", "ue", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120b", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", ",", "\u0120r", "\u0120in", "\u0120enumerate", "(red", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120%", "\u0120b", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120edge", "[i", "].", "add", "((", "M", "+j", ",", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "2", ",", "\u0120int", "(math", ".sqrt", "(b", "))", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120b", "\u0120%", "\u0120j", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", ",", "\u0120r", "\u0120in", "\u0120enumerate", "(red", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120%", "\u0120j", "\u0120==", "\u0120", "0", "\u0120or", "\u0120r", "\u0120%", "\u0120(", "b", "\u0120//", "\u0120j", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120edge", "[i", "].", "add", "((", "M", "+k", ",", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120edge", "[M", "+N", "].", "add", "((", "i", ",", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120edge", "[M", "+j", "].", "add", "((", "M", "+N", "+", "1", ",", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120Din", "ic", "(V", ",", "\u0120edge", ",", "\u0120M", "+N", ",", "\u0120M", "+N", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "d", ".max", "flow", "))"], "input_token_weights": [0.9485326079935381, 0.9307708458268354, 0.5674344985213602, 0.9485326079935381, 0.9307708458268354, 0.5674344985213602, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5674344985213602, 0.89427190936908, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8755104074345346, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.9126878899009554, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8563901704123833, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.7967329450848046, 0.7760292149144611, 0.8368972118255844, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8563901704123833, 0.8368972118255844, 0.8755104074345346, 0.5674344985213602, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.5674344985213602, 0.7112147970463693, 0.7112147970463693, 0.7332896764791028, 0.7332896764791028, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.6886415962350058, 0.6655470550599784, 0.6176935537080551, 0.6419065217751312, 0.7112147970463693, 0.7548877618383746, 0.5674344985213602, 0.7112147970463693, 0.7112147970463693, 0.7332896764791028, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.5674344985213602, 0.7112147970463693, 0.7112147970463693, 0.6655470550599784, 0.6419065217751312, 0.5928797394668679, 0.6176935537080551, 0.6176935537080551, 0.6886415962350058, 0.6886415962350058, 0.7548877618383746, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.9126878899009554, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8368972118255844, 0.8170167109432965, 0.7967329450848046, 0.8170167109432965, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.8368972118255844, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.5674344985213602, 0.8170167109432965, 0.8368972118255844, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.5674344985213602, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5674344985213602, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.5674344985213602, 0.7760292149144611, 0.7967329450848046, 0.5674344985213602, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.5674344985213602, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.5674344985213602, 0.7332896764791028, 0.5674344985213602, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.9126878899009554, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8755104074345346, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8563901704123833, 0.8368972118255844, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.8368972118255844, 0.8170167109432965, 0.7967329450848046, 0.7548877618383746, 0.7760292149144611, 0.8368972118255844, 0.8755104074345346, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.7548877618383746, 0.7548877618383746, 0.7760292149144611, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.8368972118255844, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.5674344985213602, 0.7967329450848046, 0.8170167109432965, 0.7548877618383746, 0.7548877618383746, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7548877618383746, 0.7548877618383746, 0.7760292149144611, 0.7548877618383746, 0.8368972118255844, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7112147970463693, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7112147970463693, 0.6886415962350058, 0.6886415962350058, 0.6655470550599784, 0.6655470550599784, 0.7332896764791028, 0.5674344985213602, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.5674344985213602, 0.7760292149144611, 0.7967329450848046, 0.5674344985213602, 0.7112147970463693, 0.7112147970463693, 0.7332896764791028, 0.7332896764791028, 0.5674344985213602, 0.5674344985213602, 0.6419065217751312, 0.6419065217751312, 0.6655470550599784, 0.6419065217751312, 0.6886415962350058, 0.6655470550599784, 0.6655470550599784, 0.7112147970463693, 0.7112147970463693, 0.7332896764791028, 0.7332896764791028, 0.5674344985213602, 0.5674344985213602, 0.7548877618383746, 0.7548877618383746, 0.5674344985213602, 0.5674344985213602, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.9126878899009554, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.8170167109432965, 0.7967329450848046, 0.8170167109432965, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.5674344985213602, 0.7967329450848046, 0.7332896764791028, 0.7332896764791028, 0.7548877618383746, 0.5674344985213602, 0.7548877618383746, 0.7760292149144611, 0.7112147970463693, 0.7112147970463693, 0.7332896764791028, 0.7112147970463693, 0.7332896764791028, 0.7548877618383746, 0.5674344985213602, 0.7548877618383746, 0.7967329450848046, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.7112147970463693, 0.6886415962350058, 0.7112147970463693, 0.7332896764791028, 0.6655470550599784, 0.6655470550599784, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7112147970463693, 0.5674344985213602, 0.7112147970463693, 0.5674344985213602, 0.5674344985213602, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.6886415962350058, 0.7112147970463693, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.89427190936908, 0.8755104074345346, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.7548877618383746, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.5674344985213602, 0.9126878899009554, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.89427190936908, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.9126878899009554, 0.5674344985213602, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.89427190936908, 0.8755104074345346, 0.8563901704123833, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8170167109432965, 0.8368972118255844, 0.8368972118255844, 0.8755104074345346, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7548877618383746, 0.7967329450848046, 0.5674344985213602, 0.8755104074345346, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.8755104074345346, 0.5674344985213602, 0.8368972118255844, 0.5674344985213602, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8170167109432965, 0.8368972118255844, 0.8368972118255844, 0.8755104074345346, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7548877618383746, 0.7967329450848046, 0.5674344985213602, 0.8755104074345346, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.8755104074345346, 0.5674344985213602, 0.8368972118255844, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8755104074345346, 0.8563901704123833, 0.8368972118255844, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8368972118255844, 0.8170167109432965, 0.8755104074345346, 0.5674344985213602, 0.9126878899009554, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.9126878899009554, 0.89427190936908, 0.8755104074345346, 0.8755104074345346, 0.9126878899009554, 0.5674344985213602, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.8755104074345346, 0.5674344985213602, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.8170167109432965, 0.7967329450848046, 0.8368972118255844, 0.5674344985213602, 0.7967329450848046, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7760292149144611, 0.5674344985213602, 0.7760292149144611, 0.7967329450848046, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.6655470550599784, 0.6655470550599784, 0.6886415962350058, 0.5674344985213602, 0.6886415962350058, 0.7112147970463693, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.7967329450848046, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.8170167109432965, 0.5674344985213602, 0.8170167109432965, 0.8755104074345346, 0.5674344985213602, 0.8368972118255844, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.5674344985213602, 0.8170167109432965, 0.8368972118255844, 0.5674344985213602, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7760292149144611, 0.7548877618383746, 0.7967329450848046, 0.5674344985213602, 0.7548877618383746, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7112147970463693, 0.5674344985213602, 0.7112147970463693, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.6655470550599784, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6655470550599784, 0.7112147970463693, 0.5674344985213602, 0.7112147970463693, 0.7548877618383746, 0.5674344985213602, 0.6419065217751312, 0.6419065217751312, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.6176935537080551, 0.6176935537080551, 0.6419065217751312, 0.5674344985213602, 0.6419065217751312, 0.6655470550599784, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.89427190936908, 0.8755104074345346, 0.9126878899009554, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.7967329450848046, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.8170167109432965, 0.8368972118255844, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.89427190936908, 0.8755104074345346, 0.9126878899009554, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.7967329450848046, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.5674344985213602, 0.8170167109432965, 0.8368972118255844, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8755104074345346, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.5674344985213602, 0.89427190936908, 0.8755104074345346, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8755104074345346]} +{"problem_id": "p00174", "input": "while True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n a = b = 0\n\n for i, s in enumerate(line):\n\n if i != 0:\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break", "input_tokens": ["while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120try", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120line", "\u0120=", "\u0120input", "().", "strip", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120line", "\u0120==", "\u0120'", "0", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120raise", "\u0120Exception", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120b", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120s", "\u0120in", "\u0120enumerate", "(line", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120==", "\u0120'", "A", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120>", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(a", ",", "\u0120b", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120except", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break"], "input_token_weights": [0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.5714954628602014, 0.5714954628602014, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.5714954628602014, 0.629235964119581, 0.5714954628602014, 0.5714954628602014, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.6007824012961436, 0.6007824012961436, 0.5714954628602014, 0.6007824012961436, 0.5714954628602014, 0.5714954628602014, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.7355852514485495, 0.5714954628602014, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.7100393521462953, 0.7100393521462953, 0.5714954628602014, 0.7100393521462953, 0.5714954628602014, 0.5714954628602014, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8317036996956922]} +{"problem_id": "p03559", "input": "from bisect import *\n\nn = int(input())\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na = sorted(a)\n\nc = sorted(c)\n\n\n\nrec = 0\n\nfor i in range(n):\n\n temp = b[i]\n\n l = bisect_left(a, temp)\n\n r = bisect_right(c, temp)\n\n rec += l * (n - r)\n\nprint(rec)", "input_tokens": ["from", "\u0120bis", "ect", "\u0120import", "\u0120*\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "a", "\u0120=", "\u0120sorted", "(a", ")\u010a\u010a", "c", "\u0120=", "\u0120sorted", "(c", ")\u010a\u010a\u010a\u010a", "rec", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120temp", "\u0120=", "\u0120b", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120bis", "ect", "_left", "(a", ",", "\u0120temp", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120bis", "ect", "_right", "(c", ",", "\u0120temp", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120rec", "\u0120+=", "\u0120l", "\u0120*", "\u0120(", "n", "\u0120-", "\u0120r", ")\u010a\u010a", "print", "(rec", ")"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03592", "input": "N,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n t = i*M + j*N - i*j*2\n\n if t==K:\n\n print('Yes')\n\n exit()\n\nprint('No')", "input_tokens": ["N", ",M", ",K", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(M", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120i", "*M", "\u0120+", "\u0120j", "*N", "\u0120-", "\u0120i", "*j", "*", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "==", "K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "print", "('", "No", "')"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6588494518362031, 0.6211886504852411, 0.6588494518362031, 0.582053818991329, 0.6951432441854742, 0.6588494518362031, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8591441175808593]} +{"problem_id": "p00542", "input": "a,b,c,d,e,f=[int(input()) for _ in range(6)]\n\nprint((sum([a,b,c,d,max(e,f)])-min([a,b,c,d])))", "input_tokens": ["a", ",b", ",c", ",d", ",e", ",f", "=[", "int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "6", ")]\u010a\u010a", "print", "((", "sum", "([", "a", ",b", ",c", ",d", ",max", "(e", ",f", ")])", "-", "min", "([", "a", ",b", ",c", ",d", "])))"], "input_token_weights": [0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.8798713320153649, 0.8474406118450124, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.8474406118450124]} +{"problem_id": "p03371", "input": "# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z / 2), 0)\n\n y = max(Y - int(z / 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n", "input_tokens": ["#", "\u0120At", "Coder", "\u0120Beginner", "\u0120Contest", "\u0120", "0", "9", "5", "\u0120C", "\u0120-", "\u0120Half", "\u0120and", "\u0120Half", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a\u010a\u010a", "A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "strip", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120A", "\u0120*", "\u0120X", "\u0120+", "\u0120B", "\u0120*", "\u0120Y", "\u010a\u010a", "for", "\u0120z", "\u0120in", "\u0120range", "(", "2", ",", "\u0120", "2", "\u0120*", "\u0120", "1", "0", "\u0120**", "\u0120", "5", "\u0120+", "\u0120", "1", ",", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120max", "(X", "\u0120-", "\u0120int", "(z", "\u0120/", "\u0120", "2", "),", "\u0120", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "\u0120=", "\u0120max", "(Y", "\u0120-", "\u0120int", "(z", "\u0120/", "\u0120", "2", "),", "\u0120", "0", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120price", "\u0120=", "\u0120A", "\u0120*", "\u0120x", "\u0120+", "\u0120B", "\u0120*", "\u0120y", "\u0120+", "\u0120C", "\u0120*", "\u0120z", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(price", ",", "\u0120ans", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6993277790098028, 0.6993277790098028, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383]} +{"problem_id": "p02773", "input": "from collections import defaultdict\n\nN = int(input())\n\nd = defaultdict(int)\n\n\n\nfor i in range(N):\n\n S = input()\n\n d[S] += 1\n\n\n\nm = 0\n\nfor k in list(d.keys()):\n\n m = max(d[k],m)\n\n\n\nli = []\n\nfor k in list(d.keys()):\n\n if d[k] == m:\n\n li.append(k)\n\n\n\nli.sort()\n\nfor l in li:\n\n print(l)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[S", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "m", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120list", "(d", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120max", "(d", "[k", "],", "m", ")\u010a\u010a\u010a\u010a", "li", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120list", "(d", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120d", "[k", "]", "\u0120==", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120li", ".append", "(k", ")\u010a\u010a\u010a\u010a", "li", ".sort", "()\u010a\u010a", "for", "\u0120l", "\u0120in", "\u0120li", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(l", ")"], "input_token_weights": [0.89427190936908, 0.8563901704123833, 0.89427190936908, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.5928797394668679, 0.7760292149144611, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.8170167109432965, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028]} +{"problem_id": "p03037", "input": "N,M = list(map(int,input().split()))\n\nL,R = [],[]\n\nfor i in range(M):\n\n l,r = list(map(int,input().split()))\n\n L.append(l)\n\n R.append(r)\n\nans = min(R)-max(L)+1\n\nprint((ans if ans >= 0 else 0))", "input_tokens": ["N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "L", ",R", "\u0120=", "\u0120[],", "[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ",r", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", ".append", "(l", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", ".append", "(r", ")\u010a\u010a", "ans", "\u0120=", "\u0120min", "(R", ")-", "max", "(L", ")+", "1", "\u010a\u010a", "print", "((", "ans", "\u0120if", "\u0120ans", "\u0120>=", "\u0120", "0", "\u0120else", "\u0120", "0", "))"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.7967329450848046, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308]} +{"problem_id": "p02881", "input": "n = int(input())\n\nl = []\n\nfor i in range(1,1000001):\n\n a = n / i\n\n if a.is_integer():\n\n l.append(i+n/i)\n\nprint((int(min(l)-2)))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "l", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "1", "0", "0", "0", "0", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120n", "\u0120/", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", ".is", "_integer", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", ".append", "(i", "+n", "/i", ")\u010a\u010a", "print", "((", "int", "(min", "(l", ")-", "2", ")))"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8474406118450124, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.6270757423345348, 0.7060506397782503, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.7060506397782503, 0.8474406118450124]} +{"problem_id": "p02881", "input": "n = int(input())\n\nimport math\n\nm = int(math.sqrt(n))+1\n\nanss = []\n\nfor x in range(1, m+1):\n\n y = n//x\n\n z = n%x\n\n if z == 0:\n\n anss.append(abs(x-1)+abs(y-1))\n\nprint((min(anss)))\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "m", "\u0120=", "\u0120int", "(math", ".sqrt", "(n", "))+", "1", "\u010a\u010a", "ans", "s", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "1", ",", "\u0120m", "+", "1", "):\u010a\u010a", "\u0120", "\u0120y", "\u0120=", "\u0120n", "//", "x", "\u010a\u010a", "\u0120", "\u0120z", "\u0120=", "\u0120n", "%x", "\u010a\u010a", "\u0120", "\u0120if", "\u0120z", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120an", "ss", ".append", "(abs", "(x", "-", "1", ")+", "abs", "(y", "-", "1", "))\u010a\u010a", "print", "((", "min", "(ans", "s", ")))\u010a"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.7186273667339679, 0.6855929667625797, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.7506053018110229, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905]} +{"problem_id": "p03455", "input": "a, b = list(map(int, input().split()))\n\nif a*b%2 == 1:\n\n print(\"Odd\")\n\nelse:\n\n print(\"Even\")", "input_tokens": ["a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "if", "\u0120a", "*b", "%", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Odd", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Even", "\")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.9178879013889365, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7640031686476719]} +{"problem_id": "p02555", "input": "n = int(input())\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n for j in range(i - 2):\n\n ans[i] += ans[j]\n\n ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "m", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "#", "\u0120ans", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "ans", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120", "2", "2", "0", "0", "\u010a\u010a", "ans", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "#", "\u0120ans", "[", "3", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "#", "\u0120ans", "[", "4", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "#", "\u0120ans", "[", "5", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "\u0120-", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "[i", "]", "\u0120+=", "\u0120ans", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "[i", "]", "\u0120%=", "\u0120m", "\u010a\u010a", "print", "((", "ans", "[n", "]))\u010a\u010a", "#", "\u0120print", "(ans", "[:", "1", "0", "])\u010a"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5928797394668679, 0.8170167109432965, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.8563901704123833, 0.8563901704123833, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7760292149144611, 0.89427190936908, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.5928797394668679, 0.6886415962350058, 0.8170167109432965, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.7332896764791028, 0.8170167109432965, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354]} +{"problem_id": "p04021", "input": "import sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(input())\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n if (L[i][1]-i)%2:\n\n count += 1\n\nans = (count+1) // 2\n\nprint(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".read", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120read", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120sorted", "([(", "j", ",", "\u0120i", ")", "\u0120for", "\u0120i", ",", "\u0120j", "\u0120in", "\u0120enumerate", "(A", ")])\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120(", "L", "[i", "][", "1", "]-", "i", ")%", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120(", "count", "+", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02378", "input": "# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if unvisited[v] and (r_capacity > 0):\n\n parent[v].append(u)\n\n queue.append(v)\n\n unvisited[v] = False\n\n return unvisited[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while not bfs(source, sink, parent):\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))", "input_tokens": ["#", "\u0120Accept", "ance", "\u0120of", "\u0120input", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", "\u010a\u010a\u010a\u010a", "file", "_input", "\u0120=", "\u0120sys", ".stdin", "\u010a\u010a\u010a\u010a", "X", ",", "\u0120Y", ",", "\u0120E", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120file", "_input", ".readline", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "v", "_num", "\u0120=", "\u0120X", "\u0120+", "\u0120Y", "\u0120+", "\u0120", "2", "\u010a\u010a\u010a\u010a", "adj", "_mat", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120(", "v", "_num", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(v", "_num", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120line", "\u0120in", "\u0120file", "_input", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120line", ".split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120adj", "_mat", "[x", "][", "X", "\u0120+", "\u0120y", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120X", "\u0120+", "\u0120Y", "\u010a\u010a", "t", "\u0120=", "\u0120s", "\u0120+", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(X", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120adj", "_mat", "[s", "][", "i", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(X", ",", "\u0120s", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120adj", "_mat", "[i", "][", "t", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "#", "\u0120Din", "ic", "'s", "\u0120algorithm", "\u010a\u010a\u010a\u010a", "import", "\u0120collections", "\u010a\u010a\u010a\u010a", "#", "\u0120BFS", "\u0120for", "\u0120residual", "\u0120capacity", "\u0120network", "\u0120to", "\u0120construct", "\u0120level", "\u0120graph", "\u010a\u010a", "def", "\u0120bfs", "(start", ",", "\u0120goal", ",", "\u0120parent", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120un", "visited", "\u0120=", "\u0120[", "True", "]", "\u0120*", "\u0120v", "_num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120queue", "\u0120=", "\u0120collections", ".de", "que", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120queue", ".append", "(start", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120un", "visited", "[start", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120queue", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120u", "\u0120=", "\u0120queue", ".p", "opleft", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", ",", "\u0120r", "_capacity", "\u0120in", "\u0120enumerate", "(adj", "_mat", "[u", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120un", "visited", "[v", "]", "\u0120and", "\u0120(", "r", "_capacity", "\u0120>", "\u0120", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120parent", "[v", "].", "append", "(u", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120queue", ".append", "(v", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120un", "visited", "[v", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120un", "visited", "[", "goal", "]\u010a\u010a\u010a\u010a", "#", "\u0120DFS", "\u0120for", "\u0120level", "\u0120graph", "\u0120and", "\u0120construct", "\u0120blocking", "\u0120flow", "\u010a\u010a", "def", "\u0120dfs", "(goal", ",", "\u0120path", ",", "\u0120parent", ",", "\u0120blocking", "_flow", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120path", "[-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120v", "\u0120==", "\u0120goal", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120aug", "_path", "_flow", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", ",", "\u0120y", "\u0120in", "\u0120zip", "(path", "[", "1", ":],", "\u0120path", "[:-", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120aug", "_path", "_flow", "\u0120=", "\u0120min", "(a", "ug", "_path", "_flow", ",", "\u0120adj", "_mat", "[x", "][", "y", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", ",", "\u0120y", "\u0120in", "\u0120zip", "(path", "[", "1", ":],", "\u0120path", "[:-", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120adj", "_mat", "[x", "][", "y", "]", "\u0120-=", "\u0120aug", "_path", "_flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120adj", "_mat", "[y", "][", "x", "]", "\u0120+=", "\u0120aug", "_path", "_flow", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120blocking", "_flow", "[", "0", "]", "\u0120+=", "\u0120aug", "_path", "_flow", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120u", "\u0120in", "\u0120parent", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120path", ".append", "(u", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dfs", "(goal", ",", "\u0120path", ",", "\u0120parent", ",", "\u0120blocking", "_flow", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120path", ".pop", "()\u010a\u010a\u010a\u010a", "def", "\u0120din", "ic", "(source", ",", "\u0120sink", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "_flow", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120parent", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(v", "_num", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120not", "\u0120bfs", "(source", ",", "\u0120sink", ",", "\u0120parent", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120blocking", "_flow", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120path", "\u0120=", "\u0120[", "sink", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120search", "\u0120in", "\u0120reverse", "\u0120direction", "\u0120from", "\u0120sink", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dfs", "(source", ",", "\u0120path", ",", "\u0120parent", ",", "\u0120blocking", "_flow", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_flow", "\u0120+=", "\u0120blocking", "_flow", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120parent", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(v", "_num", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120max", "_flow", "\u010a\u010a\u010a\u010a", "#", "\u0120output", "\u010a\u010a", "print", "((", "din", "ic", "(s", ",", "\u0120t", ")))"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7681534551894282, 0.5770524973423397, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7681534551894282, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308]} +{"problem_id": "p02837", "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom math import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\nfrom decimal import Decimal\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\nfrom decimal import *\n\n\n\nN = INT()\n\nxy = []\n\n\n\nfor i in range(N):\n\n\tA = INT()\n\n\txy.append([LIST() for _ in range(A)])\n\n\n\nans = 0\n\nfor i in range(1<= K - 1:\n\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\n\n \n\nprint(ans)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120K", ",", "\u0120*", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "\u0120+", "\u0120", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "[i", "\u0120+", "\u0120", "1", "]", "\u0120=", "\u0120S", "[i", "]", "\u0120+", "\u0120A", "[i", "]\u010a\u010a\u010a\u010a", "d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(N", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120(", "S", "[j", "]", "\u0120-", "\u0120j", ")", "\u0120%", "\u0120K", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120d", "[v", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[v", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120>=", "\u0120K", "\u0120-", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[(", "S", "[j", "\u0120-", "\u0120K", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120(", "j", "\u0120-", "\u0120K", "\u0120+", "\u0120", "1", "))", "\u0120%", "\u0120K", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.6993277790098028, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.860922050467044, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.6696615116992518, 0.6696615116992518, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.6696615116992518, 0.6993277790098028, 0.6696615116992518, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383]} +{"problem_id": "p02767", "input": "n=int(input())\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\nfor p in range(x[0],x[len(x)-1]+1):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\n pmin=psum \n\n for j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) ", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "x", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "x", ".sort", "()\u010a\u010a\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120range", "(x", "[", "0", "],", "x", "[len", "(x", ")-", "1", "]+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "sum", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(x", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "sum", "=p", "sum", "+(", "x", "[", "0", "]-", "x", "[i", "])**", "2", "\u010a\u010a", "#", "\u0120\u0120\u0120", "\u0120print", "(p", "sum", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "min", "=p", "sum", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(x", "[", "0", "]+", "1", ",x", "[len", "(x", ")-", "1", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "sum", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(x", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "sum", "=p", "sum", "+(", "j", "-x", "[i", "])**", "2", "\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(p", "sum", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120p", "min", ">p", "sum", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "min", "=p", "sum", "\u010a\u010a", "print", "(p", "min", ")", "\u0120\u0120\u0120\u0120"], "input_token_weights": [0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.7561438265913266, 0.8099046207685895, 0.8099046207685895, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8099046207685895, 0.7281392564472128, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7281392564472128, 0.7833854580549265, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.6390881791778984, 0.6390881791778984, 0.6075505590312809, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393]} +{"problem_id": "p03086", "input": "import re\n\n\n\nS = input()\n\nmax = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i + 1, len(S) + 1) :\n\n pattern = re.compile(r'[A|T|C|G]{%d}' % int(j - i))\n\n subStr = S[i:j]\n\n\n\n if pattern.match(subStr) and j - i > max :\n\n max = j - i\n\n\n\nprint(max)\n", "input_tokens": ["import", "\u0120re", "\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a", "max", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", "\u0120:\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "\u0120+", "\u0120", "1", ",", "\u0120len", "(S", ")", "\u0120+", "\u0120", "1", ")", "\u0120:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pattern", "\u0120=", "\u0120re", ".compile", "(r", "'[", "A", "|", "T", "|", "C", "|", "G", "]{", "%", "d", "}'", "\u0120%", "\u0120int", "(j", "\u0120-", "\u0120i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sub", "Str", "\u0120=", "\u0120S", "[i", ":j", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120pattern", ".match", "(sub", "Str", ")", "\u0120and", "\u0120j", "\u0120-", "\u0120i", "\u0120>", "\u0120max", "\u0120:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "\u0120=", "\u0120j", "\u0120-", "\u0120i", "\u010a\u010a\u010a\u010a", "print", "(max", ")\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02792", "input": "import itertools\n\nN = int(input())\n\nNketa = len(str(N))\n\n\n\nrange_count = [[0 for j in range(10)]for i in range(10)]\n\n\n\n\n\nfor p in range(1,N+1):\n\n mae = int(str(p)[0])\n\n ato = int(str(p)[-1])\n\n range_count[mae][ato] += 1\n\n\n\n \n\n\n\ncount = 0\n\nfor j in range(1,N+1):\n\n a_mae = int(str(j)[0])\n\n a_ato = int(str(j)[-1])\n\n \n\n b_mae = a_ato\n\n b_ato = a_mae\n\n \n\n if b_mae == 0:\n\n continue\n\n else:\n\n count += range_count[b_mae][b_ato]\n\nprint(count)\n\n ", "input_tokens": ["import", "\u0120itertools", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "N", "k", "eta", "\u0120=", "\u0120len", "(str", "(N", "))", "\u010a\u010a\u010a\u010a", "range", "_count", "\u0120=", "\u0120[[", "0", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "0", ")]", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", ")]", "\u010a\u010a\u010a\u010a\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "ae", "\u0120=", "\u0120int", "(str", "(p", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120at", "o", "\u0120=", "\u0120int", "(str", "(p", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120range", "_count", "[", "ma", "e", "][", "ato", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_m", "ae", "\u0120=", "\u0120int", "(str", "(j", ")[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_at", "o", "\u0120=", "\u0120int", "(str", "(j", ")[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_m", "ae", "\u0120=", "\u0120a", "_at", "o", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_at", "o", "\u0120=", "\u0120a", "_m", "ae", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120b", "_m", "ae", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120range", "_count", "[b", "_m", "ae", "][", "b", "_at", "o", "]\u010a\u010a", "print", "(count", ")\u010a\u010a", "\u0120\u0120"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7433160191943734, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.6673426178365944, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.7060506397782503, 0.6673426178365944, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608]} +{"problem_id": "p02921", "input": "s=input()\n\nt=input()\n\nans=0\n\nif s[0]==t[0]:\n\n ans+=1\n\nif s[1]==t[1]:\n\n ans+=1\n\nif s[2]==t[2]:\n\n ans+=1\n\nprint(ans)\n", "input_tokens": ["s", "=input", "()\u010a\u010a", "t", "=input", "()\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "if", "\u0120s", "[", "0", "]==", "t", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "if", "\u0120s", "[", "1", "]==", "t", "[", "1", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "if", "\u0120s", "[", "2", "]==", "t", "[", "2", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.8515524375924506, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.8515524375924506, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.8515524375924506, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986]} +{"problem_id": "p03835", "input": "k,s=list(map(int,input().split()))\n\ncnt=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0 <= s-i-j <= k:\n\n cnt+=1\n\nprint(cnt)", "input_tokens": ["k", ",s", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "cnt", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "\u0120<=", "\u0120s", "-i", "-j", "\u0120<=", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "+=", "1", "\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03806", "input": "N,Ma,Mb = list(map(int, input().split()))\n\narr=[list(map(int,input().split())) for _ in range(N)]\n\ndp=[[[5000]*401 for _ in range(401)] for _ in range(41)]\n\ndp[0][0][0] = 0\n\nfor i in range(N):\n\n a,b,c=arr[i]\n\n for j in range(10*N+1):\n\n for k in range(10*N+1):\n\n if dp[i][j][k] == 5000:\n\n continue\n\n dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k])\n\n dp[i+1][j+a][k+b]=min(dp[i+1][j+a][k+b],dp[i][j][k]+c)\n\n\n\nans=5000\n\nfor i in range(1,401):\n\n if i*Ma>400 or i*Mb>400:\n\n break\n\n ans = min(ans, dp[N][i*Ma][i*Mb])\n\nif ans == 5000:\n\n print((-1))\n\nelse:\n\n print(ans)", "input_tokens": ["N", ",M", "a", ",M", "b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "arr", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "dp", "=[", "[[", "5", "0", "0", "0", "]*", "4", "0", "1", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "4", "0", "1", ")]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "4", "1", ")]\u010a\u010a", "dp", "[", "0", "][", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "=", "arr", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "0", "*N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "1", "0", "*N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "][", "j", "][", "k", "]", "\u0120==", "\u0120", "5", "0", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "][", "k", "]=", "min", "(dp", "[i", "+", "1", "][", "j", "][", "k", "],", "dp", "[i", "][", "j", "][", "k", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "+a", "][", "k", "+b", "]=", "min", "(dp", "[i", "+", "1", "][", "j", "+a", "][", "k", "+b", "],", "dp", "[i", "][", "j", "][", "k", "]+", "c", ")\u010a\u010a\u010a\u010a", "ans", "=", "5", "0", "0", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "4", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "*", "Ma", ">", "4", "0", "0", "\u0120or", "\u0120i", "*M", "b", ">", "4", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120dp", "[N", "][", "i", "*", "Ma", "][", "i", "*M", "b", "])\u010a\u010a", "if", "\u0120ans", "\u0120==", "\u0120", "5", "0", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.8456076926739031, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8922045961188434, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.7967329450848046, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7453461554353482, 0.5731452134031394, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8214688817838891, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.8456076926739031, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891]} +{"problem_id": "p02814", "input": "from math import gcd\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a // 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x // pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b//gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M // x + 1) // 2))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "([", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()", "])\u010a\u010a", "\u010a\u010a", "cnt", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120a", "\u0120=", "\u0120A", "[i", "]\u010a\u010a", "\u0120", "\u0120while", "\u0120a", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120a", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "[i", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "if", "\u0120max", "(cnt", ")", "\u0120>", "\u0120min", "(cnt", "):\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "C", "\u0120=", "\u0120max", "(cnt", ")\u010a\u010a\u010a\u010a", "A", "\u0120=", "\u0120list", "([", "x", "\u0120//", "\u0120pow", "(", "2", ",C", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120A", "])\u010a\u010a", "def", "\u0120gcd", "(a", ",b", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120a", "", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120b", ",a", "%", "b", "\u010a\u010a", "\u0120", "\u0120return", "\u0120b", "\u010a\u010a\u010a\u010a", "def", "\u0120lcm", "(a", ",b", "):\u010a\u010a", "\u0120", "\u0120return", "\u0120a", "*b", "//", "gcd", "(a", ",b", ")\u010a\u010a\u010a\u010a", "x", "\u0120=", "\u0120A", "[", "0", "]\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120A", "[", "1", ":]", ":\u010a\u010a", "\u0120", "\u0120x", "\u0120=", "\u0120lcm", "(x", ",a", ")\u010a\u010a", "x", "\u0120=", "\u0120x", "\u0120*", "\u0120pow", "(", "2", ",C", "-", "1", ")\u010a\u010a\u010a\u010a", "print", "(((", "M", "\u0120//", "\u0120x", "\u0120+", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "))"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.9178879013889365, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.8889473014940781, 0.8591441175808593, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p03038", "input": "from heapq import *\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nPAIRS = [[-a, -1] for a in map(int, input().split())]\n\nheapify(PAIRS)\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(PAIRS, [-c, -b])\n\n\n\nanswer = 0\n\nfor _ in range(n):\n\n pair = heappop(PAIRS)\n\n answer += -pair[0]\n\n pair[1] += 1\n\n if pair[1] != 0:\n\n heappush(PAIRS, pair)\n\n\n\nprint(answer)\n", "input_tokens": ["from", "\u0120heapq", "\u0120import", "\u0120*", "\u010a\u010a\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "PAIR", "S", "\u0120=", "\u0120[[", "-", "a", ",", "\u0120-", "1", "]", "\u0120for", "\u0120a", "\u0120in", "\u0120map", "(int", ",", "\u0120input", "().", "split", "())", "]\u010a\u010a", "heap", "ify", "(P", "AIR", "S", ")\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120he", "app", "ush", "(P", "AIR", "S", ",", "\u0120[-", "c", ",", "\u0120-", "b", "])\u010a\u010a", "\u010a\u010a", "answer", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120pair", "\u0120=", "\u0120he", "app", "op", "(P", "AIR", "S", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120answer", "\u0120+=", "\u0120-", "pair", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120pair", "[", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120pair", "[", "1", "]", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120he", "app", "ush", "(P", "AIR", "S", ",", "\u0120pair", ")\u010a\u010a\u010a\u010a", "print", "(answer", ")\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03796", "input": "import math\n\n\n\nn = int(input())\n\nans = math.factorial(n) % (pow(10, 9) + 7)\n\nprint(ans)", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120math", ".factor", "ial", "(n", ")", "\u0120%", "\u0120(", "pow", "(", "1", "0", ",", "\u0120", "9", ")", "\u0120+", "\u0120", "7", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.89427190936908, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.8170167109432965, 0.7760292149144611, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.7332896764791028, 0.5928797394668679, 0.7332896764791028, 0.7760292149144611, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965]} +{"problem_id": "p02596", "input": "k = int(input())\n\nx = 1\n\n\n\nif k%7 != 0:\n\n mod = 9*k\n\nelse:\n\n mod = 9*k//7\n\n\n\nfor i in range(10**6):\n\n x = x*10%mod\n\n if x == 1:\n\n print((i + 1))\n\n exit()\n\n\n\nprint((-1))", "input_tokens": ["k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "x", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "if", "\u0120k", "%", "7", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "9", "*k", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "9", "*k", "//", "7", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "**", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120x", "*", "1", "0", "%", "mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "i", "\u0120+", "\u0120", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "print", "((-", "1", "))"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7060506397782503, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.6270757423345348, 0.7060506397782503, 0.5851191688414608, 0.7433160191943734, 0.7060506397782503, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.8474406118450124]} +{"problem_id": "p03200", "input": "s = input()\n\n\n\ncnt = 0\n\nans = 0\n\nfor c in s:\n\n if c == 'B':\n\n cnt += 1\n\n elif c == 'W':\n\n ans += cnt\n\nprint(ans)\n", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120c", "\u0120in", "\u0120s", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120c", "\u0120==", "\u0120'", "B", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120c", "\u0120==", "\u0120'", "W", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cnt", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.8170167109432965, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.7760292149144611, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965]} +{"problem_id": "p00053", "input": "import math\n\ndef pri(n):\n\n if n < 2:\n\n return False\n\n elif n == 2:\n\n return True\n\n elif n % 2 == 0:\n\n return False\n\n\n\n i = 3\n\n while i <= math.sqrt(n):\n\n if n % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nl=[i for i in range(110000)if pri(i) ]\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0: break\n\n print((sum(l[:n])))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "def", "\u0120pri", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120<", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120n", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120n", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120<=", "\u0120math", ".sqrt", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a\u010a\u010a", "l", "=[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "1", "0", "0", "0", "0", ")", "if", "\u0120pri", "(i", ")", "\u0120]", "\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "sum", "(l", "[:", "n", "])))"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6211886504852411, 0.7967329450848046]} +{"problem_id": "p02988", "input": "n = int(input())\n\nl = list(map(int, input().split()))\n\nprint((sum(l[i]l[i+1]>l[i+2] for i in range(n-2))))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "l", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "print", "((", "sum", "(l", "[i", "]<", "l", "[i", "+", "1", "]<", "l", "[i", "+", "2", "]", "\u0120or", "\u0120l", "[i", "]>", "l", "[i", "+", "1", "]>", "l", "[i", "+", "2", "]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "2", "))))"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.6270757423345348, 0.6673426178365944, 0.6673426178365944, 0.8139227859741643, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.5851191688414608, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.5851191688414608, 0.6270757423345348, 0.7060506397782503, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.5851191688414608, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.5851191688414608, 0.6270757423345348, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.6270757423345348, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124]} +{"problem_id": "p03363", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\n\n\nans, s = 0, 0\n\nd = {0:1}\n\n\n\nfor i in A:\n\n s += i\n\n ans += d.get(s, 0)\n\n d[s] = d.get(s, 0) + 1\n\n\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", ",", "\u0120s", "\u0120=", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "d", "\u0120=", "\u0120{", "0", ":", "1", "}\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120+=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120d", ".get", "(s", ",", "\u0120", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[s", "]", "\u0120=", "\u0120d", ".get", "(s", ",", "\u0120", "0", ")", "\u0120+", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03162", "input": "import numpy as np\n\nn=int(input())\n\nABC=[list(map(int,input().split())) for _ in range(n)]\n\n\n\ndp=np.zeros((n,3),int)\n\nfor i in range(3):\n\n dp[0][i]=ABC[0][i]\n\nfor i in range(n-1):\n\n for j in range(3):\n\n dp[i+1][j]=max(dp[i][(j+1)%3]+ABC[i+1][j], dp[i][(j+2)%3]+ABC[i+1][j])\n\nprint((max(dp[-1])))", "input_tokens": ["import", "\u0120numpy", "\u0120as", "\u0120np", "\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "ABC", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "dp", "=np", ".zeros", "((", "n", ",", "3", "),", "int", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120", "\u0120dp", "[", "0", "][", "i", "]=", "ABC", "[", "0", "][", "i", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "]=", "max", "(dp", "[i", "][(", "j", "+", "1", ")%", "3", "]+", "ABC", "[i", "+", "1", "][", "j", "],", "\u0120dp", "[i", "][(", "j", "+", "2", ")%", "3", "]+", "ABC", "[i", "+", "1", "][", "j", "])\u010a\u010a", "print", "((", "max", "(dp", "[-", "1", "])))"], "input_token_weights": [0.9328769136071888, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.6696615116992518, 0.6993277790098028, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.6993277790098028, 0.7561438265913266, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.6993277790098028, 0.7561438265913266, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.8854867975141383]} +{"problem_id": "p03162", "input": "N = int(input())\n\nl = [list(map(int, input().split())) for _ in range(N)]\n\n\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\n\n\nfor i in range(1, N+1):\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k]+l[i-1][k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n\n\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "l", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ")]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(N", "+", "1", ")]", "\u010a\u010a\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120!=", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "j", "]", "\u0120=", "\u0120max", "(dp", "[i", "][", "j", "],", "\u0120dp", "[i", "-", "1", "][", "k", "]+", "l", "[i", "-", "1", "][", "k", "])\u010a\u010a", "\u010a\u010a", "print", "((", "max", "(dp", "[N", "][", "0", "],", "\u0120dp", "[N", "][", "1", "],", "\u0120dp", "[N", "][", "2", "]))", ")\u010a\u010a\u010a"], "input_token_weights": [0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.883057299767519, 0.883057299767519, 0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.819022641134497, 0.819022641134497, 0.7506053018110229, 0.7739350698055053, 0.7739350698055053, 0.862164725336545, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.9035222925783293, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.9035222925783293, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.9432371260907066, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.862164725336545, 0.5700083567488032, 0.819022641134497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7267182280470056, 0.7022465694939416, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.6250192001927346, 0.6250192001927346, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6250192001927346, 0.6250192001927346, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.5700083567488032, 0.9235768548788368, 0.9035222925783293, 0.862164725336545, 0.8408263201236497, 0.7967329450848046, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.819022641134497, 0.883057299767519, 0.9035222925783293]} +{"problem_id": "p02899", "input": "import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(input())\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n for i in range(len(l)):\n\n if i != len(l)-1:\n\n print(\"{} \".format(l[i]), end='')\n\n else:\n\n print(l[i])\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120o", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[o", "[i", "]-", "1", "]", "\u0120=", "\u0120i", "+", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(l", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "\u0120i", "\u0120!=", "\u0120len", "(l", ")-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"{}", "\u0120\".", "format", "(l", "[i", "]),", "\u0120end", "='", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(l", "[i", "])\u010a\u010a", "\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p02994", "input": "N,L = list(map(int, input().split()))\n\ntaste = [L+i-1 for i in range(1,N+1)]\n\nif taste[-1] < 0:\n\n print((sum(taste) + min([abs(x) for x in taste])))\n\nelse:\n\n print((sum(taste) - min([abs(x) for x in taste])))", "input_tokens": ["N", ",L", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "t", "aste", "\u0120=", "\u0120[", "L", "+i", "-", "1", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", ")]\u010a\u010a", "if", "\u0120taste", "[-", "1", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120", "\u0120print", "((", "sum", "(t", "aste", ")", "\u0120+", "\u0120min", "([", "abs", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120taste", "]))", ")\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "((", "sum", "(t", "aste", ")", "\u0120-", "\u0120min", "([", "abs", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120taste", "])))"], "input_token_weights": [0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8854867975141383, 0.9328769136071888, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8854867975141383, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.8099046207685895, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.8099046207685895]} +{"problem_id": "p03416", "input": "# ABC090B - Palindromic Numbers\n\na, b = list(map(int, input().rstrip().split()))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n lst = list(map(int, list(str(i))))\n\n if lst[0] == lst[4] and lst[1] == lst[3]:\n\n count += 1\n\nprint(count)", "input_tokens": ["#", "\u0120ABC", "0", "9", "0", "B", "\u0120-", "\u0120Pal", "ind", "rom", "ic", "\u0120Numbers", "\u010a\u010a", "a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "().", "split", "()))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120lst", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120list", "(str", "(i", "))))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120lst", "[", "0", "]", "\u0120==", "\u0120lst", "[", "4", "]", "\u0120and", "\u0120lst", "[", "1", "]", "\u0120==", "\u0120lst", "[", "3", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6115475853143139, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03720", "input": "n, m = list(map(int, input().split()))\n\ndp = [0] * n\n\nfor i in range(m):\n\n x, y = list(map(int, input().split()))\n\n dp[x - 1] += 1\n\n dp[y - 1] += 1\n\nfor i in range(n):\n\n print((dp[i]))", "input_tokens": ["n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120n", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[x", "\u0120-", "\u0120", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[y", "\u0120-", "\u0120", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dp", "[i", "]))"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852]} +{"problem_id": "p03558", "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\n\n\nfrom collections import deque\n\ndef resolve():\n\n k=int(input())\n\n E=[[] for _ in range(k)]\n\n for i in range(k):\n\n E[i].append(((i+1)%k,1))\n\n E[i].append(((10*i)%k,0))\n\n\n\n # 0-1 BFS\n\n dist=[INF]*k\n\n dist[1]=0\n\n Q=deque([1])\n\n while(Q):\n\n v=Q.popleft()\n\n for nv,w in E[v]:\n\n if(dist[nv]<=dist[v]+w): continue\n\n dist[nv]=dist[v]+w\n\n if(w==0): Q.appendleft(nv)\n\n else: Q.append(nv)\n\n print((dist[0]+1))\n\nresolve()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "2", "1", "4", "7", "4", "8", "3", "6", "4", "7", ")\u010a\u010a", "INF", "=float", "(\"", "inf", "\")\u010a\u010a", "MOD", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "input", "=lambda", "\u0120:", "sys", ".stdin", ".readline", "().", "rstrip", "()\u010a\u010a\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "def", "\u0120resolve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "=int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120E", "=[", "[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120E", "[i", "].", "append", "(((", "i", "+", "1", ")%", "k", ",", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120E", "[i", "].", "append", "(((", "1", "0", "*i", ")%", "k", ",", "0", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120", "0", "-", "1", "\u0120BFS", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dist", "=[", "INF", "]*", "k", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dist", "[", "1", "]=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120Q", "=", "deque", "([", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "(Q", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "=", "Q", ".p", "opleft", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120nv", ",w", "\u0120in", "\u0120E", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(dist", "[n", "v", "]<=", "dist", "[v", "]+", "w", "):", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dist", "[n", "v", "]=", "dist", "[v", "]+", "w", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(w", "==", "0", "):", "\u0120Q", ".append", "left", "(n", "v", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120Q", ".append", "(n", "v", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dist", "[", "0", "]+", "1", "))\u010a\u010a", "resolve", "()"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7681534551894282, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.9035222925783293, 0.8778749353275308]} +{"problem_id": "p03796", "input": "import math\n\n\n\nn = int(input())\n\n\n\nprint((math.factorial(n) % (10**9 + 7)))\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))\u010a"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p03839", "input": "N,K = list(map(int,input().split()))\n\nsrc = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncump = [0]\n\nfor a in src:\n\n cums.append(cums[-1] + a)\n\n cump.append(cump[-1] + max(0,a))\n\n\n\nans = 0\n\nfor i in range(N-K+1):\n\n tmp = cump[i]\n\n tmp += max(0, cums[i+K] - cums[i])\n\n tmp += cump[N] - cump[i+K]\n\n ans = max(tmp, ans)\n\nprint(ans)\n", "input_tokens": ["N", ",K", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "src", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "c", "ums", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "c", "ump", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120src", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "ums", ".append", "(c", "ums", "[-", "1", "]", "\u0120+", "\u0120a", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "ump", ".append", "(c", "ump", "[-", "1", "]", "\u0120+", "\u0120max", "(", "0", ",a", "))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-K", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120c", "ump", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120max", "(", "0", ",", "\u0120c", "ums", "[i", "+", "K", "]", "\u0120-", "\u0120c", "ums", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120c", "ump", "[N", "]", "\u0120-", "\u0120c", "ump", "[i", "+", "K", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(tmp", ",", "\u0120ans", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03796", "input": "def factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r *= n\n\n power_r %= 10**9+7\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "input_tokens": ["def", "\u0120factorial", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120power", "_r", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120n", "\u0120in", "\u0120range", "(", "2", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120power", "_r", "\u0120*=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120power", "_r", "\u0120%=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120power", "_r", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "factor", "ial", "(N", ")))"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6339004969859428, 0.7584425223266994]} +{"problem_id": "p02596", "input": "import sys\n\nK = int(input())\n\n\n\npower = 7\n\nSUM = 0\n\n\n\nfor i in range(1, 10 ** 6):\n\n SUM += power\n\n if SUM % K == 0:\n\n print(i)\n\n sys.exit()\n\n power *= 10\n\n power %= K\n\n\n\nprint((-1))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "K", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "power", "\u0120=", "\u0120", "7", "\u010a\u010a", "SUM", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "\u0120**", "\u0120", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120SUM", "\u0120+=", "\u0120power", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120SUM", "\u0120%", "\u0120K", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120power", "\u0120*=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120power", "\u0120%=", "\u0120K", "\u010a\u010a\u010a\u010a", "print", "((-", "1", "))"], "input_token_weights": [0.89427190936908, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7760292149144611, 0.89427190936908, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.8170167109432965, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.5928797394668679, 0.7760292149144611, 0.8170167109432965, 0.5928797394668679, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.8170167109432965]} +{"problem_id": "p02821", "input": "#E\n\nfrom itertools import accumulate\n\nfrom bisect import bisect_left\n\ndef main():\n\n n,m=list(map(int,input().split()))\n\n A=list(map(int,input().split()))\n\n A.sort()\n\n \n\n def count(k):\n\n cnt=0\n\n for a in A:\n\n cnt+=bisect_left(A,k-a)\n\n return cnt\n\n \n\n ok=0\n\n ng=10**10+1\n\n while ng-ok>1:\n\n mid=(ok+ng)//2\n\n if count(mid)", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mid", "=(", "ok", "+", "ng", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120count", "(mid", ")<", "n", "**", "2", "-m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ok", "=", "mid", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ng", "=", "mid", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120border", "=", "ok", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "=n", "**", "2", "-count", "(border", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120Acc", "=[", "0", "]+", "list", "(", "accumulate", "(A", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=", "Acc", "[-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120idx", "=b", "is", "ect", "_left", "(A", ",b", "order", "-a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "a", "*(", "n", "-", "idx", ")+(", "s", "-A", "cc", "[idx", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "-=", "border", "*(", "k", "-m", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "if", "\u0120__", "name", "__", "=='", "__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p03634", "input": "import sys\n\ninput = sys.stdin.readline\n\nn = int(input())\n\nv = [[0]+[]*(n+1) for i in range(n+1)]\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\n\n\nq,k = list(map(int,input().split()))\n\nl = [k]\n\nwhile l:\n\n now = l.pop()\n\n for i in v[now][1:]:\n\n if v[i[0]][0] == 0:\n\n v[i[0]][0] = i[1]+v[now][0]\n\n l.append(i[0])\n\n\n\nfor i in range(q):\n\n x,y = list(map(int,input().split()))\n\n print((v[x][0]+v[y][0]))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "v", "\u0120=", "\u0120[[", "0", "]+", "[]", "*(", "n", "+", "1", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "1", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "[a", "].", "append", "([", "b", ",c", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "[b", "].", "append", "([", "a", ",c", "])\u010a\u010a", "\u010a\u010a", "q", ",k", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "l", "\u0120=", "\u0120[", "k", "]\u010a\u010a", "while", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120now", "\u0120=", "\u0120l", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120v", "[now", "][", "1", ":]", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120v", "[i", "[", "0", "]][", "0", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[i", "[", "0", "]][", "0", "]", "\u0120=", "\u0120i", "[", "1", "]+", "v", "[now", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", ".append", "(i", "[", "0", "])\u010a\u010a", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(q", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "v", "[x", "][", "0", "]+", "v", "[y", "][", "0", "]))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852]} +{"problem_id": "p03568", "input": "from functools import reduce\n\nfrom itertools import product\n\n\n\nN = int(input())\n\n*A, = list(map(int, input().split()))\n\nans = 0\n\nfor t in product([-1, 0, 1], repeat=N):\n\n prod = reduce(lambda x, y: x*y, [a + t[i] for i, a in enumerate(A)])\n\n if prod % 2 == 0: ans += 1\n\nprint(ans)", "input_tokens": ["from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120product", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "*A", ",", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120t", "\u0120in", "\u0120product", "([-", "1", ",", "\u0120", "0", ",", "\u0120", "1", "],", "\u0120repeat", "=N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120prod", "\u0120=", "\u0120reduce", "(lambda", "\u0120x", ",", "\u0120y", ":", "\u0120x", "*y", ",", "\u0120[", "a", "\u0120+", "\u0120t", "[i", "]", "\u0120for", "\u0120i", ",", "\u0120a", "\u0120in", "\u0120enumerate", "(A", ")])\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120prod", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6211886504852411, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02748", "input": "a, b, m = list(map(int,input().split()))\n\ndr = list(map(int,input().split()))\n\nwa = list(map(int,input().split()))\n\nxyc = [list(map(int,input().split())) for i in range(m)]\n\nlow = 200001\n\n\n\nfor i in range(m):\n\n f = xyc[i][0] - 1\n\n d = xyc[i][1] - 1\n\n if low >= dr[f]+wa[d]-xyc[i][2]:\n\n low = dr[f]+wa[d]-xyc[i][2]\n\n\n\ndr.sort()\n\nwa.sort()\n\n\n\nif low >= (dr[0] + wa[0]):\n\n print((dr[0] + wa[0]))\n\nelse:\n\n print(low)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "dr", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "wa", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "x", "yc", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(m", ")]\u010a\u010a", "low", "\u0120=", "\u0120", "2", "0", "0", "0", "0", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120x", "yc", "[i", "][", "0", "]", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120x", "yc", "[i", "][", "1", "]", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120low", "\u0120>=", "\u0120dr", "[f", "]+", "wa", "[d", "]-", "x", "yc", "[i", "][", "2", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120low", "\u0120=", "\u0120dr", "[f", "]+", "wa", "[d", "]-", "x", "yc", "[i", "][", "2", "]\u010a\u010a\u010a\u010a", "dr", ".sort", "()\u010a\u010a", "wa", ".sort", "()\u010a\u010a\u010a\u010a", "if", "\u0120low", "\u0120>=", "\u0120(", "dr", "[", "0", "]", "\u0120+", "\u0120wa", "[", "0", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dr", "[", "0", "]", "\u0120+", "\u0120wa", "[", "0", "]))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(low", ")"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883]} +{"problem_id": "p02983", "input": "l, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (((i%2019)*(j%2019))%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)", "input_tokens": ["l", ",", "\u0120r", "=list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "if", "\u0120r", "-l", ">", "6", "7", "2", ":\u010a\u010a", "\u0109p", "=", "0", "\u010a\u010a", "else", ":\u010a\u010a", "\u0109p", "=", "2", "0", "1", "9", "\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(l", ",", "\u0120r", "):\u010a\u010a", "\u0109", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",", "\u0120r", "+", "1", "):\u010a\u010a", "\u0109\u0109", "\u0109p", "=min", "(p", ",", "\u0120(((", "i", "%", "2", "0", "1", "9", ")*(", "j", "%", "2", "0", "1", "9", "))", "%", "2", "0", "1", "9", "))\u010a\u010a", "\u0109\u0109", "\u0109if", "\u0120not", "\u0120p", ":\u010a\u010a", "\u0109\u0109\u0109", "\u0109break", "\u010a\u010a", "\u0109", "\u0109if", "\u0120not", "\u0120p", ":\u010a\u010a", "\u0109\u0109", "\u0109break", "\u010a\u010a", "print", "(p", ")"], "input_token_weights": [0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9273515896195933, 0.8889473014940781, 0.8490090158852169, 0.8490090158852169, 0.785941609719976, 0.8074090697023789, 0.8074090697023789, 0.8889473014940781, 0.9460144469641688, 0.9083337953965728, 0.9083337953965728, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9273515896195933, 0.9460144469641688, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.5686609715453708, 0.9273515896195933, 0.9273515896195933, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5686609715453708, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8889473014940781, 0.5686609715453708, 0.5686609715453708, 0.8490090158852169, 0.8490090158852169, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8490090158852169, 0.5686609715453708, 0.5686609715453708, 0.785941609719976, 0.741572616038919, 0.741572616038919, 0.7186273667339679, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.6464527786867319, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.5952696660036803, 0.6710943273460512, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.741572616038919, 0.5686609715453708, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.5686609715453708, 0.5686609715453708, 0.5686609715453708, 0.5686609715453708, 0.5686609715453708, 0.8284253466378658, 0.8284253466378658, 0.8490090158852169, 0.5686609715453708, 0.5686609715453708, 0.5686609715453708, 0.9273515896195933, 0.9083337953965728, 0.9083337953965728]} +{"problem_id": "p03371", "input": "a,b,c,x,y = list(map(int,input().split()))\n\nprice = 10**10\n\nfor k in range(10**5+1):\n\n re = 2*c*k + max(0,x-k)*a + max(0,y-k)*b\n\n price = min(re,price)\n\nprint(price)", "input_tokens": ["a", ",b", ",c", ",x", ",y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "price", "\u0120=", "\u0120", "1", "0", "**", "1", "0", "\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(", "1", "0", "**", "5", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120re", "\u0120=", "\u0120", "2", "*c", "*k", "\u0120+", "\u0120max", "(", "0", ",x", "-k", ")*", "a", "\u0120+", "\u0120max", "(", "0", ",y", "-k", ")*", "b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120price", "\u0120=", "\u0120min", "(re", ",", "price", ")\u010a\u010a", "print", "(price", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(int", "(input", "()))", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8691775287719905]} +{"problem_id": "p02996", "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(input())\n\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\n\n\n\ncnt = 0\n\nfor b, a in ab:\n\n cnt += a\n\n if cnt > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ab", "\u0120=", "\u0120sorted", "([", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "[::-", "1", "]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", ")\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120b", ",", "\u0120a", "\u0120in", "\u0120ab", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "\u0120>", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')\u010a"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.8214688817838891, 0.7713695892187169, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.8456076926739031, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.8456076926739031, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.8214688817838891]} +{"problem_id": "p03828", "input": "from collections import Counter\n\nN = int(input())\n\ndiv = []\n\nfor i in range(2,N+1):\n\n while i != 1:\n\n for d in range(2,i+1):\n\n while i%d==0:\n\n i = i//d\n\n div.append(d)\n\nC = Counter(div).most_common()\n\nAns = 1\n\nfor k,v in C:\n\n Ans = Ans*(v+1) % (10**9+7)\n\n\n\nprint(Ans)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "div", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120d", "\u0120in", "\u0120range", "(", "2", ",i", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120i", "%d", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120i", "//", "d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120div", ".append", "(d", ")\u010a\u010a", "C", "\u0120=", "\u0120Counter", "(div", ").", "most", "_common", "()\u010a\u010a", "Ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120k", ",v", "\u0120in", "\u0120C", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120Ans", "\u0120=", "\u0120Ans", "*(", "v", "+", "1", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "+", "7", ")\u010a\u010a\u010a\u010a", "print", "(", "Ans", ")\u010a"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.8967470570581779, 0.8967470570581779, 0.8116478083709829, 0.781592256244883, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.8116478083709829, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02245", "input": "from collections import deque\n\nfrom copy import deepcopy, copy\n\ndy = [-1, 0, 0, 1]\n\ndx = [0, -1, 1, 0]\n\nN = 3\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef MAIN():\n\n m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n goal = ('1', '2', '3', '4', '5', '6', '7', '8', '0')\n\n goal = 123456780\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n print(cnt)\n\n break\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\nMAIN()\n\n\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "from", "\u0120copy", "\u0120import", "\u0120deepcopy", ",", "\u0120copy", "\u010a\u010a", "dy", "\u0120=", "\u0120[-", "1", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "1", "]\u010a\u010a", "dx", "\u0120=", "\u0120[", "0", ",", "\u0120-", "1", ",", "\u0120", "1", ",", "\u0120", "0", "]\u010a\u010a", "N", "\u0120=", "\u0120", "3", "\u010a\u010a", "def", "\u0120g", "(i", ",", "\u0120j", ",", "\u0120a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120a", "\u0120//", "\u0120(", "1", "0", "\u0120**", "\u0120j", ")", "\u0120%", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120a", "\u0120-", "\u0120t", "\u0120*", "\u0120(", "1", "0", "\u0120**", "\u0120j", ")", "\u0120+", "\u0120t", "\u0120*", "\u0120(", "1", "0", "\u0120**", "\u0120i", ")\u010a\u010a", "def", "\u0120MAIN", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120{", "8", ":{", "7", ",", "\u0120", "5", "},", "\u0120", "7", ":{", "8", ",", "\u0120", "6", ",", "\u0120", "4", "},", "\u0120", "6", ":{", "7", ",", "\u0120", "3", "},", "\u0120", "5", ":{", "8", ",", "\u0120", "4", ",", "\u0120", "2", "},", "\u0120", "4", ":{", "7", ",", "\u0120", "5", ",", "\u0120", "3", ",", "\u0120", "1", "},", "\u0120", "3", ":{", "6", ",", "\u0120", "4", ",", "\u0120", "0", "},", "\u0120", "2", ":{", "5", ",", "\u0120", "1", "},", "\u0120", "1", ":{", "4", ",", "\u0120", "2", ",", "\u0120", "0", "},", "\u0120", "0", ":{", "3", ",", "\u0120", "1", "}}\u010a\u010a", "\u0120\u0120\u0120", "\u0120MAP", "\u0120=", "\u0120\"\".", "join", "(input", "().", "replace", "(\"", "\u0120\",", "\u0120\"\")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120", "8", "\u0120-", "\u0120MAP", ".find", "(\"", "0", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120MAP", "\u0120=", "\u0120int", "(M", "AP", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120goal", "\u0120=", "\u0120('", "1", "',", "\u0120'", "2", "',", "\u0120'", "3", "',", "\u0120'", "4", "',", "\u0120'", "5", "',", "\u0120'", "6", "',", "\u0120'", "7", "',", "\u0120'", "8", "',", "\u0120'", "0", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120goal", "\u0120=", "\u0120", "1", "2", "3", "4", "5", "6", "7", "8", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120deque", "([(", "0", ",", "\u0120start", ",", "\u0120MAP", ")])\u010a\u010a", "\u0120\u0120\u0120", "\u0120LOG", "\u0120=", "\u0120{", "MAP", "}\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120dp", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", ",", "\u0120y", "x", ",", "\u0120M", "\u0120=", "\u0120dp", ".p", "opleft", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120M", "\u0120==", "\u0120goal", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(cnt", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120ny", "x", "\u0120in", "\u0120m", "[y", "x", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120CM", "\u0120=", "\u0120g", "(y", "x", ",", "\u0120ny", "x", ",", "\u0120M", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120CM", "\u0120in", "\u0120LOG", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", ".append", "((", "cnt", ",", "\u0120ny", "x", ",", "\u0120CM", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120LOG", ".add", "(C", "M", ")\u010a\u010a", "MAIN", "()\u010a\u010a\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.9035222925783293, 0.8778749353275308]} +{"problem_id": "p03416", "input": "# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n r = \"\".join(reversed(list(s)))\n\n if s == r:\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["#", "\u0120vim", ":", "\u0120file", "encoding", "=utf", "-", "8", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120\"\".", "join", "(re", "versed", "(list", "(s", ")))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120==", "\u0120r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(c", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6115475853143139, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p03371", "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float('inf')\n\n\n\nfor i in range(10 ** 5 + 1):\n\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\nprint(ans)", "input_tokens": ["A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "\u0120**", "\u0120", "5", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120A", "\u0120*", "\u0120max", "(X", "\u0120-", "\u0120i", ",", "\u0120", "0", ")", "\u0120+", "\u0120B", "\u0120*", "\u0120max", "(Y", "\u0120-", "\u0120i", ",", "\u0120", "0", ")", "\u0120+", "\u0120", "2", "\u0120*", "\u0120C", "\u0120*", "\u0120i", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.7681534551894282, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03037", "input": "k,m=list(map(int,input().split()))\n\nl=[0 for i in range(k+1)]\n\nfor i in range(m):\n\n a,s=list(map(int,input().split()))\n\n l[a-1]+=1;l[s]-=1\n\nans=0\n\nf=0\n\nfor j in range(k):\n\n l[j]+=f\n\n f=l[j]\n\nprint((len([1 for i in l if i==m])))", "input_tokens": ["k", ",m", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "l", "=[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", "+", "1", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120", "\u0120a", ",s", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120l", "[a", "-", "1", "]+=", "1", ";l", "[s", "]-", "=", "1", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "f", "=", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120", "\u0120l", "[j", "]+=", "f", "\u010a\u010a", "\u0120", "\u0120f", "=l", "[j", "]\u010a\u010a", "print", "((", "len", "([", "1", "\u0120for", "\u0120i", "\u0120in", "\u0120l", "\u0120if", "\u0120i", "==", "m", "])))"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.8778749353275308]} +{"problem_id": "p02792", "input": "N = int(input())\n\ncount = [[0 for _ in range(9)] for _ in range(9)]\n\nfor i in range(1, N + 1):\n\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\n\nans = 0\n\nfor i in range(0, 9):\n\n for k in range(0, 9):\n\n ans += count[i][k] * count[k][i]\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "count", "\u0120=", "\u0120[[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "9", ")]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "9", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120str", "(i", ")[", "0", "]", "\u0120!=", "\u0120\"", "0", "\"", "\u0120and", "\u0120str", "(i", ")[-", "1", "]", "\u0120!=", "\u0120\"", "0", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "[int", "(str", "(i", ")[", "0", "])", "\u0120-", "\u0120", "1", "][", "int", "(str", "(i", ")[-", "1", "])", "\u0120-", "\u0120", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120", "9", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "0", ",", "\u0120", "9", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120count", "[i", "][", "k", "]", "\u0120*", "\u0120count", "[k", "][", "i", "]\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.7967329450848046, 0.7713695892187169, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8691775287719905, 0.7967329450848046, 0.7713695892187169, 0.8214688817838891, 0.7967329450848046, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.6911750402874859, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7967329450848046, 0.7453461554353482, 0.7186273667339679, 0.6339004969859428, 0.6911750402874859, 0.6629477592666795, 0.7186273667339679, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.914713330925897, 0.8922045961188434, 0.8922045961188434]} +{"problem_id": "p03078", "input": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x // y))\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\nABC=[]\n\nfor i in range(X):\n\n for j in range(Y):\n\n if (i+1)*(j+1)>K:\n\n break\n\n for k in range(Z):\n\n if (i+1)*(j+1)*(k+1)>K:\n\n break\n\n ABC.append(A[i]+B[j]+C[k])\n\nABC.sort(reverse=True)\n\nfor i in range(K):\n\n print((ABC[i]))\n\n\n", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", "\u010a\u010a\u010a\u010a", "def", "\u0120input", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a", "def", "\u0120list", "2", "d", "(a", ",", "\u0120b", ",", "\u0120c", "):", "\u0120return", "\u0120[[", "c", "]", "\u0120*", "\u0120b", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(a", ")]\u010a\u010a", "def", "\u0120list", "3", "d", "(a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120d", "):", "\u0120return", "\u0120[[[", "d", "]", "\u0120*", "\u0120c", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(b", ")]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(a", ")]\u010a\u010a", "def", "\u0120ceil", "(x", ",", "\u0120y", "=", "1", "):", "\u0120return", "\u0120int", "(-", "(-", "x", "\u0120//", "\u0120y", "))\u010a\u010a", "def", "\u0120INT", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120MAP", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120LIST", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120Yes", "():", "\u0120print", "('", "Yes", "')\u010a\u010a", "def", "\u0120No", "():", "\u0120print", "('", "No", "')\u010a\u010a", "def", "\u0120YES", "():", "\u0120print", "('", "YES", "')\u010a\u010a", "def", "\u0120NO", "():", "\u0120print", "('", "NO", "')\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "MOD", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "X", ",Y", ",Z", ",K", "=", "MAP", "()\u010a\u010a", "A", "=", "sorted", "(L", "IST", "(),", "\u0120reverse", "=True", ")\u010a\u010a", "B", "=", "sorted", "(L", "IST", "(),", "\u0120reverse", "=True", ")\u010a\u010a", "C", "=", "sorted", "(L", "IST", "(),", "\u0120reverse", "=True", ")\u010a\u010a\u010a\u010a", "ABC", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(X", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(Y", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "+", "1", ")*(", "j", "+", "1", ")>", "K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(Z", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "+", "1", ")*(", "j", "+", "1", ")*(", "k", "+", "1", ")>", "K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ABC", ".append", "(A", "[i", "]+", "B", "[j", "]+", "C", "[k", "])\u010a\u010a", "ABC", ".sort", "(reverse", "=True", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "ABC", "[i", "]))", "\u010a\u010a\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6115475853143139, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397]} +{"problem_id": "p02560", "input": "#!/usr/bin/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "6", ")\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "1", "\u0120", "\u0120#", "\u0120sys", ".max", "size", "\u0120#", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "MOD", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120floor", "_sum", "(n", ",", "\u0120m", ",", "\u0120a", ",", "\u0120b", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120>=", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120(", "n", "\u0120-", "\u0120", "1", ")", "\u0120*", "\u0120n", "\u0120*", "\u0120(", "a", "\u0120//", "\u0120m", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120%=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120b", "\u0120>=", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120n", "\u0120*", "\u0120(", "b", "\u0120//", "\u0120m", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120%=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "_max", "\u0120=", "\u0120(", "a", "\u0120*", "\u0120n", "\u0120+", "\u0120b", ")", "\u0120//", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "_max", "\u0120=", "\u0120y", "_max", "\u0120*", "\u0120m", "\u0120-", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120y", "_max", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120(", "n", "\u0120-", "\u0120(", "x", "_max", "\u0120+", "\u0120a", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120a", ")", "\u0120*", "\u0120y", "_max", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120floor", "_sum", "(y", "_max", ",", "\u0120a", ",", "\u0120m", ",", "\u0120(", "a", "\u0120-", "\u0120x", "_max", "\u0120%", "\u0120a", ")", "\u0120%", "\u0120a", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120debug", "(*", "x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(*", "x", ",", "\u0120file", "=sys", ".stderr", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "(S", "OLVE", "_PARAMS", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120pass", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120parse", "\u0120input", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "t", "\u0120in", "\u0120range", "(T", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120N", ",", "\u0120M", ",", "\u0120A", ",", "\u0120B", "\u0120=", "\u0120map", "(int", ",", "\u0120input", "().", "split", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(floor", "_sum", "(N", ",", "\u0120M", ",", "\u0120A", ",", "\u0120B", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120tests", "\u010a\u010a", "T", "1", "\u0120=", "\u0120\"\"\"\u010a\u010a", "5", "\u010a\u010a", "4", "\u0120", "1", "0", "\u0120", "6", "\u0120", "3", "\u010a\u010a", "6", "\u0120", "5", "\u0120", "4", "\u0120", "3", "\u010a\u010a", "1", "\u0120", "1", "\u0120", "0", "\u0120", "0", "\u010a\u010a", "3", "1", "4", "1", "5", "\u0120", "9", "2", "6", "5", "3", "\u0120", "5", "8", "9", "7", "9", "\u0120", "3", "2", "3", "8", "4", "\u010a\u010a", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "\u0120", "9", "9", "9", "9", "9", "9", "9", "9", "9", "\u0120", "9", "9", "9", "9", "9", "9", "9", "9", "9", "\u010a\u010a", "\"\"\"\u010a\u010a", "TEST", "_T", "1", "\u0120=", "\u0120\"\"\"\u010a\u010a", ">>>", "\u0120as", "_input", "(T", "1", ")\u010a\u010a", ">>>", "\u0120main", "()\u010a\u010a", "3", "\u010a\u010a", "1", "3", "\u010a\u010a", "0", "\u010a\u010a", "3", "1", "4", "0", "9", "5", "4", "8", "0", "\u010a\u010a", "4", "9", "9", "9", "9", "9", "9", "9", "9", "5", "0", "0", "0", "0", "0", "0", "0", "0", "\u010a\u010a", "\"\"\"", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120_", "test", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120do", "ctest", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120do", "ctest", ".test", "mod", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "\u0120=", "\u0120globals", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120sorted", "(g", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", ".startswith", "(\"", "TEST", "_", "\")", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120do", "ctest", ".run", "_doc", "string", "_examples", "(g", "[k", "],", "\u0120g", ",", "\u0120name", "=k", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120as", "_input", "(s", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"", "use", "\u0120in", "\u0120test", ",", "\u0120use", "\u0120given", "\u0120string", "\u0120as", "\u0120input", "\u0120file", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120io", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120io", ".String", "IO", "(s", ".strip", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "\u0120=", "\u0120globals", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "[\"", "input", "\"]", "\u0120=", "\u0120lambda", ":", "\u0120bytes", "(f", ".readline", "(),", "\u0120\"", "ascii", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "[\"", "read", "\"]", "\u0120=", "\u0120lambda", ":", "\u0120bytes", "(f", ".read", "(),", "\u0120\"", "ascii", "\")\u010a\u010a", "\u010a\u010a\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".read", "\u010a\u010a\u010a\u010a", "if", "\u0120sys", ".argv", "[-", "1", "]", "\u0120==", "\u0120\"-", "t", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "testing", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120_", "test", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a\u010a\u010a", "main", "()\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7084208560793558, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7084208560793558, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.8778749353275308]} +{"problem_id": "p02881", "input": "import math\n\nN = int(input())\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = math.ceil(N/(i+1))\n\n if (1+i)*j == N:\n\n ans = min(i+j-1,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "0", "**", "1", "2", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "1", "0", "**", "6", "+", "1", "):\u010a\u010a", "\u0120", "\u0120j", "\u0120=", "\u0120math", ".ceil", "(N", "/(", "i", "+", "1", "))\u010a\u010a", "\u0120", "\u0120if", "\u0120(", "1", "+i", ")*", "j", "\u0120==", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(i", "+j", "-", "1", ",", "ans", ")\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "1", "0", "**", "6", "\u0120and", "\u0120ans", "\u0120==", "\u0120", "1", "0", "**", "1", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120N", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02758", "input": "mod = 998244353\n\nN = int(input())\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))", "input_tokens": ["mod", "\u0120=", "\u0120", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "X", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120d", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", ".append", "((", "x", ",", "\u0120x", "\u0120+", "\u0120d", "))", "\u010a\u010a\u010a\u010a", "X", "\u0120=", "\u0120sorted", "(X", ",", "\u0120key", "\u0120=", "\u0120lambda", "\u0120x", ":", "\u0120x", "[", "0", "])\u010a\u010a", "L", "\u0120=", "\u0120[(", "0", ",", "\u0120-(", "1", "0", "**", "9", "+", "1", "),", "\u0120", "1", "0", "**", "9", "+", "1", ")]\u010a\u010a", "P", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120(", "N", "+", "1", ")\u010a\u010a", "for", "\u0120i", ",", "\u0120(", "x", ",", "\u0120y", ")", "\u0120in", "\u0120enumerate", "(X", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120L", "[-", "1", "][", "2", "]", "\u0120<=", "\u0120y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120L", "[-", "1", "][", "2", "]", "\u0120>", "\u0120x", "\u0120and", "\u0120P", "[i", "+", "1", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120P", "[i", "+", "1", "]", "\u0120=", "\u0120L", "[-", "1", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120P", "[i", "+", "1", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120P", "[i", "+", "1", "]", "\u0120=", "\u0120L", "[-", "1", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", ".append", "((", "i", "+", "1", ",", "\u0120x", ",", "\u0120y", "))", "\u010a\u010a\u010a\u010a", "C", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "+", "1", ")]\u010a\u010a", "for", "\u0120i", ",", "\u0120p", "\u0120in", "\u0120enumerate", "(P", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120p", "\u0120>=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120C", "[p", "].", "append", "(i", ")\u010a\u010a\u010a\u010a", "Y", "\u0120=", "\u0120[", "1", "]", "\u0120*", "\u0120(", "N", "+", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", ")[", "::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120C", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120s", "\u0120*", "\u0120(", "Y", "[j", "]", "\u0120+", "\u0120", "1", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120Y", "[i", "]", "\u0120=", "\u0120s", "\u010a\u010a\u010a\u010a", "print", "((", "Y", "[", "0", "]))"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308]} +{"problem_id": "p02622", "input": "print((sum(si != ti for si, ti in zip(input(), input()))))\n", "input_tokens": ["print", "((", "sum", "(si", "\u0120!=", "\u0120ti", "\u0120for", "\u0120si", ",", "\u0120ti", "\u0120in", "\u0120zip", "(input", "(),", "\u0120input", "()))", "))\u010a"], "input_token_weights": [0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.7060506397782503, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.7433160191943734, 0.8474406118450124]} +{"problem_id": "p02767", "input": "n = int(input())\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n # else:\n\n # break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "x", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "p", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120pi", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pi", "\u0120+=", "\u0120(", "x", "[j", "]", "\u0120-", "\u0120(", "i", "\u0120+", "\u0120", "1", "))", "**", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120pi", "\u0120<", "\u0120p", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120pi", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120p", "[i", "]", "\u0120+=", "\u0120(", "x", "[j", "]", "-(", "i", "+", "1", "))", "**", "2", "\u010a\u010a", "print", "(p", ")"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02792", "input": "def solve():\n\n N = int(input())\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, 5):\n\n for i in range(10**d):\n\n j = x*10**(d+1) + i*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n else:\n\n break\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for A in range(1, N+1):\n\n ss = str(A)\n\n ans += numss[int(ss[-1])][int(ss[0])]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n", "input_tokens": ["def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "ss", "\u0120=", "\u0120[[", "0", "]*(", "1", "0", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "1", "0", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120d", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "5", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "**", "d", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120x", "*", "1", "0", "**(", "d", "+", "1", ")", "\u0120+", "\u0120i", "*", "1", "0", "\u0120+", "\u0120y", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "1", "\u0120<=", "\u0120j", "\u0120<=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120x", "*", "1", "0", "\u0120+", "\u0120y", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "1", "\u0120<=", "\u0120j", "\u0120<=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120x", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "1", "\u0120<=", "\u0120j", "\u0120<=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "ss", "[x", "][", "y", "]", "\u0120=", "\u0120num", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120A", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ss", "\u0120=", "\u0120str", "(A", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120num", "ss", "[int", "(ss", "[-", "1", "])", "][", "int", "(ss", "[", "0", "])", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "solve", "()\u010a"], "input_token_weights": [0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8755104074345346, 0.8368972118255844, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8755104074345346, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.89427190936908, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.9126878899009554, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8755104074345346, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.8170167109432965, 0.5674344985213602, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8170167109432965, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.7967329450848046, 0.8368972118255844, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7760292149144611, 0.7548877618383746, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7967329450848046, 0.5674344985213602, 0.7332896764791028, 0.7332896764791028, 0.6655470550599784, 0.6655470550599784, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.6176935537080551, 0.6886415962350058, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.7112147970463693, 0.7112147970463693, 0.5674344985213602, 0.5674344985213602, 0.7548877618383746, 0.5674344985213602, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7548877618383746, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.5674344985213602, 0.6886415962350058, 0.5674344985213602, 0.5674344985213602, 0.7332896764791028, 0.7332896764791028, 0.5674344985213602, 0.6886415962350058, 0.5674344985213602, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.5674344985213602, 0.8368972118255844, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.5674344985213602, 0.7760292149144611, 0.5674344985213602, 0.5674344985213602, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5674344985213602, 0.5674344985213602, 0.7967329450848046, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.5674344985213602, 0.7332896764791028, 0.7332896764791028, 0.5674344985213602, 0.7332896764791028, 0.5674344985213602, 0.5674344985213602, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.5674344985213602, 0.89427190936908, 0.5674344985213602, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.89427190936908, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.9126878899009554, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7548877618383746, 0.7332896764791028, 0.7760292149144611, 0.8368972118255844, 0.8170167109432965, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.8368972118255844, 0.5674344985213602, 0.89427190936908, 0.8755104074345346, 0.8755104074345346, 0.9307708458268354, 0.9126878899009554]} +{"problem_id": "p03086", "input": "# -*- coding: utf-8 -*-\n\nfrom collections import deque\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nS = input()\n\nA = set(\"ATCG\")\n\nans = 0\n\nmode = 0\n\nfor i, s in enumerate(S):\n\n if s in A:\n\n if mode == 0:\n\n mode = 1\n\n start = i\n\n else:\n\n if mode == 1:\n\n ans = max(i - start, ans)\n\n mode = 0\n\nif mode == 1:\n\n ans = max(len(S) - start, ans)\n\nprint(ans)", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "def", "\u0120in", "pl", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a", "A", "\u0120=", "\u0120set", "(\"", "AT", "CG", "\")\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "mode", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", ",", "\u0120s", "\u0120in", "\u0120enumerate", "(S", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120mode", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mode", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120mode", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(i", "\u0120-", "\u0120start", ",", "\u0120ans", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mode", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120mode", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(len", "(S", ")", "\u0120-", "\u0120start", ",", "\u0120ans", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02952", "input": "N = int(input())\n\nans = 0\n\nfor i in range(1, N + 1):\n\n if len(str(i)) % 2 == 1:\n\n ans += 1\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(str", "(i", "))", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8474406118450124, 0.7433160191943734, 0.7060506397782503, 0.6270757423345348, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p03353", "input": "S = input()\n\nk = int(input())\n\nA = set()\n\nfor l in range(k+1):\n\n\tfor i in range(len(S)-l):\n\n\t\t\tA.add(S[i:i+l+1])\n\nA = sorted(list(A))\n\nprint((A[k-1]))", "input_tokens": ["S", "\u0120=", "\u0120input", "()\u010a\u010a", "k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120set", "()\u010a\u010a", "for", "\u0120l", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", ")-", "l", "):\u010a\u010a", "\u0109\u0109", "\u0109A", ".add", "(S", "[i", ":i", "+l", "+", "1", "])\u010a\u010a", "A", "\u0120=", "\u0120sorted", "(list", "(A", "))\u010a\u010a", "print", "((", "A", "[k", "-", "1", "]))"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7186273667339679, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.6160583186229708, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.8408263201236497, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905]} +{"problem_id": "p02693", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nK = int(input())\n\nA, B = list(map(int, input().split()))\n\n\n\nfor i in range(A, B+1):\n\n if i%K==0:\n\n print('OK')\n\n exit()\n\n \n\nprint('NG')", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120*", "\u010a\u010a\u010a\u010a", "K", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", ",", "\u0120B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(A", ",", "\u0120B", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "%", "K", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "OK", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "('", "NG", "')"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8591441175808593]} +{"problem_id": "p03806", "input": "n, ma, mb = list(map(int, input().split()))\n\nU = 400\n\ndp = [[[float(\"inf\")]*(U+1) for _ in range(U+1)] for i in range(n+1)]\n\ndp[0][0][0] = 0\n\nfor i in range(n):\n\n a, b, c = list(map(int, input().split()))\n\n for j in range(U+1):\n\n for k in range(U+1):\n\n if j b:\n\n a, b = b, a\n\n ai = y_dict[a]\n\n bi = y_dict[b]\n\n j = x_dict[c]\n\n banned_left_ij[j][ai] += 1\n\n banned_left_ij[j][bi] -= 1\n\n banned_right_ij[j - 1][ai] += 1\n\n banned_right_ij[j - 1][bi] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n i = y_dict[d]\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up_ij[i][ej] += 1\n\n banned_up_ij[i][fj] -= 1\n\n banned_down_ij[i - 1][ej] += 1\n\n banned_down_ij[i - 1][fj] -= 1\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor i in range(col):\n\n ru = banned_up_ij[i]\n\n rd = banned_down_ij[i]\n\n ri = row * i\n\n banned_up[ri] = ru[0]\n\n banned_down[ri] = rd[0]\n\n for j in range(1, row):\n\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\n\nfor j in range(row):\n\n rl = banned_left_ij[j]\n\n rr = banned_right_ij[j]\n\n banned_left[j] = rl[0]\n\n banned_right[j] = rr[0]\n\n for i in range(1, col):\n\n ri0 = (i - 1) * row\n\n ri1 = i * row\n\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "#", "\u0120from", "\u0120itertools", "\u0120import", "\u0120chain", ",", "\u0120accumulate", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", ",", "\u0120*", "abcdef", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".buffer", ".read", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ver", "_lines", "\u0120=", "\u0120[]\u010a\u010a", "hor", "_lines", "\u0120=", "\u0120[]\u010a\u010a", "x", "_list", "\u0120=", "\u0120set", "()\u010a\u010a", "y", "_list", "\u0120=", "\u0120set", "()\u010a\u010a", "n", "3", "\u0120=", "\u0120n", "\u0120*", "\u0120", "3", "\u010a\u010a", "for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120zip", "(", "abcdef", "[", "0", ":n", "3", ":", "3", "],", "\u0120abc", "def", "[", "1", ":n", "3", ":", "3", "],", "\u0120abc", "def", "[", "2", ":n", "3", ":", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "_list", ".add", "(a", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "_list", ".add", "(b", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "_list", ".add", "(c", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ver", "_lines", ".append", "((", "a", ",", "\u0120b", ",", "\u0120c", "))", "\u010a\u010a\u010a\u010a", "for", "\u0120d", ",", "\u0120e", ",", "\u0120f", "\u0120in", "\u0120zip", "(", "abcdef", "[n", "3", "\u0120+", "\u0120", "0", "::", "3", "],", "\u0120abc", "def", "[n", "3", "\u0120+", "\u0120", "1", "::", "3", "],", "\u0120abc", "def", "[n", "3", "\u0120+", "\u0120", "2", "::", "3", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "_list", ".add", "(d", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "_list", ".add", "(e", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "_list", ".add", "(f", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120hor", "_lines", ".append", "((", "d", ",", "\u0120e", ",", "\u0120f", "))\u010a\u010a", "x", "_list", ".add", "(", "0", ")\u010a\u010a", "y", "_list", ".add", "(", "0", ")\u010a\u010a\u010a\u010a", "x", "_list", "\u0120=", "\u0120sorted", "(x", "_list", ")\u010a\u010a", "y", "_list", "\u0120=", "\u0120sorted", "(y", "_list", ")\u010a\u010a", "x", "_dict", "\u0120=", "\u0120{", "x", ":", "\u0120i", "\u0120for", "\u0120i", ",", "\u0120x", "\u0120in", "\u0120enumerate", "(x", "_list", ",", "\u0120start", "=", "1", ")}\u010a\u010a", "y", "_dict", "\u0120=", "\u0120{", "y", ":", "\u0120i", "\u0120for", "\u0120i", ",", "\u0120y", "\u0120in", "\u0120enumerate", "(y", "_list", ",", "\u0120start", "=", "1", ")}\u010a\u010a", "row", "_real", "\u0120=", "\u0120len", "(x", "_list", ")\u010a\u010a", "col", "_real", "\u0120=", "\u0120len", "(y", "_list", ")\u010a\u010a", "row", "\u0120=", "\u0120row", "_real", "\u0120+", "\u0120", "2", "\u010a\u010a", "col", "\u0120=", "\u0120col", "_real", "\u0120+", "\u0120", "2", "\u010a\u010a", "b", "anned", "_up", "_ij", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120row", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(col", ")]\u010a\u010a", "b", "anned", "_down", "_ij", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120row", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(col", ")]\u010a\u010a", "b", "anned", "_left", "_ij", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120col", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(row", ")]\u010a\u010a", "b", "anned", "_right", "_ij", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120col", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(row", ")]\u010a\u010a", "for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120ver", "_lines", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120>", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120b", ",", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ai", "\u0120=", "\u0120y", "_dict", "[a", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120bi", "\u0120=", "\u0120y", "_dict", "[b", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120x", "_dict", "[c", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_left", "_ij", "[j", "][", "ai", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_left", "_ij", "[j", "][", "bi", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_right", "_ij", "[j", "\u0120-", "\u0120", "1", "][", "ai", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_right", "_ij", "[j", "\u0120-", "\u0120", "1", "][", "bi", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "for", "\u0120d", ",", "\u0120e", ",", "\u0120f", "\u0120in", "\u0120hor", "_lines", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120e", "\u0120>", "\u0120f", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120e", ",", "\u0120f", "\u0120=", "\u0120f", ",", "\u0120e", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120y", "_dict", "[d", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ej", "\u0120=", "\u0120x", "_dict", "[e", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120fj", "\u0120=", "\u0120x", "_dict", "[f", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_up", "_ij", "[i", "][", "ej", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_up", "_ij", "[i", "][", "f", "j", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_down", "_ij", "[i", "\u0120-", "\u0120", "1", "][", "ej", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_down", "_ij", "[i", "\u0120-", "\u0120", "1", "][", "f", "j", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "b", "anned", "_up", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "row", "\u0120*", "\u0120col", ")\u010a\u010a", "b", "anned", "_down", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "row", "\u0120*", "\u0120col", ")\u010a\u010a", "b", "anned", "_left", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "row", "\u0120*", "\u0120col", ")\u010a\u010a", "b", "anned", "_right", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "row", "\u0120*", "\u0120col", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(col", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ru", "\u0120=", "\u0120banned", "_up", "_ij", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120rd", "\u0120=", "\u0120banned", "_down", "_ij", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ri", "\u0120=", "\u0120row", "\u0120*", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_up", "[", "ri", "]", "\u0120=", "\u0120ru", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_down", "[", "ri", "]", "\u0120=", "\u0120rd", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "\u0120row", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120banned", "_up", "[", "ri", "\u0120+", "\u0120j", "]", "\u0120=", "\u0120banned", "_up", "[", "ri", "\u0120+", "\u0120j", "\u0120-", "\u0120", "1", "]", "\u0120+", "\u0120ru", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120banned", "_down", "[", "ri", "\u0120+", "\u0120j", "]", "\u0120=", "\u0120banned", "_down", "[", "ri", "\u0120+", "\u0120j", "\u0120-", "\u0120", "1", "]", "\u0120+", "\u0120rd", "[j", "]\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(row", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120rl", "\u0120=", "\u0120banned", "_left", "_ij", "[j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120rr", "\u0120=", "\u0120banned", "_right", "_ij", "[j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_left", "[j", "]", "\u0120=", "\u0120rl", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120banned", "_right", "[j", "]", "\u0120=", "\u0120rr", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120col", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ri", "0", "\u0120=", "\u0120(", "i", "\u0120-", "\u0120", "1", ")", "\u0120*", "\u0120row", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ri", "1", "\u0120=", "\u0120i", "\u0120*", "\u0120row", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120banned", "_left", "[", "ri", "1", "\u0120+", "\u0120j", "]", "\u0120=", "\u0120banned", "_left", "[", "ri", "0", "\u0120+", "\u0120j", "]", "\u0120+", "\u0120rl", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120banned", "_right", "[", "ri", "1", "\u0120+", "\u0120j", "]", "\u0120=", "\u0120banned", "_right", "[", "ri", "0", "\u0120+", "\u0120j", "]", "\u0120+", "\u0120rr", "[i", "]\u010a\u010a\u010a\u010a", "#", "\u0120banned", "_up", "\u0120=", "\u0120list", "(chain", ".from", "_iter", "able", "(map", "(", "accumulate", ",", "\u0120banned", "_up", "_ij", ")))\u010a\u010a", "#", "\u0120banned", "_down", "\u0120=", "\u0120list", "(chain", ".from", "_iter", "able", "(map", "(", "accumulate", ",", "\u0120banned", "_down", "_ij", ")))\u010a\u010a", "#", "\u0120banned", "_left", "\u0120=", "\u0120list", "(chain", ".from", "_iter", "able", "(zip", "(*", "map", "(", "accumulate", ",", "\u0120banned", "_left", "_ij", "))))\u010a\u010a", "#", "\u0120banned", "_right", "\u0120=", "\u0120list", "(chain", ".from", "_iter", "able", "(zip", "(*", "map", "(", "accumulate", ",", "\u0120banned", "_right", "_ij", "))))", "\u010a\u010a\u010a\u010a", "#", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(col", "):\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120print", "(w", "alls", "[i", "\u0120*", "\u0120row", ":(", "i", "\u0120+", "\u0120", "1", ")", "\u0120*", "\u0120row", "])\u010a\u010a", "\u010a\u010a", "s", "\u0120=", "\u0120row", "\u0120*", "\u0120y", "_dict", "[", "0", "]", "\u0120+", "\u0120x", "_dict", "[", "0", "]\u010a\u010a", "enable", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120row", "\u0120+", "\u0120(", "[-", "1", "]", "\u0120+", "\u0120[", "0", "]", "\u0120*", "\u0120(", "row", "\u0120-", "\u0120", "2", ")", "\u0120+", "\u0120[-", "1", "])", "\u0120*", "\u0120(", "col", "\u0120-", "\u0120", "2", ")", "\u0120+", "\u0120[-", "1", "]", "\u0120*", "\u0120row", "\u010a\u010a\u010a\u010a", "#", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(col", "):\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120print", "(enable", "[i", "\u0120*", "\u0120row", ":(", "i", "\u0120+", "\u0120", "1", ")", "\u0120*", "\u0120row", "])\u010a\u010a", "\u010a\u010a", "q", "\u0120=", "\u0120[", "s", "]\u010a\u010a", "moves", "\u0120=", "\u0120[", "(-", "row", ",", "\u0120banned", "_up", "),", "\u0120(-", "1", ",", "\u0120banned", "_left", "),", "\u0120(", "1", ",", "\u0120banned", "_right", "),", "\u0120(", "row", ",", "\u0120banned", "_down", ")]\u010a\u010a", "while", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120q", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120enable", "[c", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120enable", "[c", "]", "\u0120==", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "INF", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120enable", "[c", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120dc", ",", "\u0120banned", "\u0120in", "\u0120moves", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120banned", "[c", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nc", "\u0120=", "\u0120c", "\u0120+", "\u0120dc", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120enable", "[", "nc", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", ".append", "(nc", ")\u010a\u010a", "#", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(col", "):\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120print", "(enable", "[i", "\u0120*", "\u0120row", ":(", "i", "\u0120+", "\u0120", "1", ")", "\u0120*", "\u0120row", "])\u010a\u010a", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(col", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ri", "\u0120=", "\u0120i", "\u0120*", "\u0120row", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(row", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120enable", "[", "ri", "\u0120+", "\u0120j", "]", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120y", "_list", "[i", "\u0120-", "\u0120", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120y", "_list", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120x", "_list", "[j", "\u0120-", "\u0120", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120x", "_list", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120(", "b", "\u0120-", "\u0120t", ")", "\u0120*", "\u0120(", "r", "\u0120-", "\u0120l", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6771609938949378, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02555", "input": "def main():\n\n s = int(input())\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n for i in range(1, s+1):\n\n for j in range(0, (i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "s", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120s", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "0", ",", "\u0120(", "i", "-", "3", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dp", "[-", "1", "]))", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046]} +{"problem_id": "p03078", "input": "def slove():\n\n import sys\n\n import heapq\n\n import collections\n\n input = sys.stdin.readline\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n b.sort(reverse=True)\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n c.sort(reverse=True)\n\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(q)\n\n fq = collections.defaultdict(list)\n\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n\n t = 0\n\n for _ in range(k):\n\n if len(q) != 0:\n\n p = heapq.heappop(q)\n\n t = p[0]\n\n aq = p[1]\n\n bq = p[2]\n\n cq = p[3]\n\n if aq + 1 < len(a):\n\n if (-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq])\n\n fq[(-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq)] = 1\n\n if bq + 1 < len(b):\n\n if (-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq])\n\n fq[(-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq)] = 1\n\n if cq + 1 < len(c):\n\n if (-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1])\n\n fq[(-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1)] = 1\n\n print((-t))\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n", "input_tokens": ["def", "\u0120slo", "ve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120sys", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120heapq", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120collections", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", ",", "\u0120z", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "('\\", "n", "').", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "('\\", "n", "').", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "('\\", "n", "').", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "('\\", "n", "').", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120[[", "-(", "a", "[", "0", "]", "\u0120+", "\u0120b", "[", "0", "]", "\u0120+", "\u0120c", "[", "0", "]),", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "]]\u010a\u010a", "\u0120\u0120\u0120", "\u0120heapq", ".heap", "ify", "(q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120fq", "\u0120=", "\u0120collections", ".default", "dict", "(list", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120fq", "[", "(-(", "a", "[", "0", "]", "\u0120+", "\u0120b", "[", "0", "]", "\u0120+", "\u0120c", "[", "0", "]),", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "),", "\u0120", "1", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(q", ")", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120heapq", ".he", "app", "op", "(q", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120p", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "q", "\u0120=", "\u0120p", "[", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bq", "\u0120=", "\u0120p", "[", "2", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cq", "\u0120=", "\u0120p", "[", "3", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "q", "\u0120+", "\u0120", "1", "\u0120<", "\u0120len", "(a", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "-(", "a", "[a", "q", "+", "1", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", "+", "1", ",", "\u0120bq", ",", "\u0120cq", ")", "\u0120not", "\u0120in", "\u0120fq", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120[", "-(", "a", "[a", "q", "+", "1", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", "+", "1", ",", "\u0120bq", ",", "\u0120cq", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fq", "[", "(-(", "a", "[a", "q", "+", "1", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", "+", "1", ",", "\u0120bq", ",", "\u0120cq", ")]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120bq", "\u0120+", "\u0120", "1", "\u0120<", "\u0120len", "(b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "+", "1", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", ",", "\u0120bq", "+", "1", ",", "\u0120cq", ")", "\u0120not", "\u0120in", "\u0120fq", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120[", "-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "+", "1", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", ",", "\u0120bq", "+", "1", ",", "\u0120cq", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fq", "[", "(-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "+", "1", "]", "\u0120+", "\u0120c", "[c", "q", "]),", "\u0120a", "q", ",", "\u0120bq", "+", "1", ",", "\u0120cq", ")]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cq", "\u0120+", "\u0120", "1", "\u0120<", "\u0120len", "(c", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "+", "1", "]),", "\u0120a", "q", ",", "\u0120bq", ",", "\u0120cq", "+", "1", ")", "\u0120not", "\u0120in", "\u0120fq", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120[", "-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "+", "1", "]),", "\u0120a", "q", ",", "\u0120bq", ",", "\u0120cq", "+", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fq", "[", "(-(", "a", "[a", "q", "]", "\u0120+", "\u0120b", "[b", "q", "]", "\u0120+", "\u0120c", "[c", "q", "+", "1", "]),", "\u0120a", "q", ",", "\u0120bq", ",", "\u0120cq", "+", "1", ")]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "t", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120slo", "ve", "()\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5652845444887389, 0.9202622330629227, 0.9035222925783293, 0.5652845444887389, 0.5652845444887389, 0.9202622330629227, 0.9035222925783293, 0.5652845444887389, 0.5652845444887389, 0.9202622330629227, 0.9035222925783293, 0.5652845444887389, 0.5652845444887389, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.8864973487791334, 0.5652845444887389, 0.5652845444887389, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.9035222925783293, 0.8864973487791334, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.7387330872699986, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.5652845444887389, 0.9035222925783293, 0.9035222925783293, 0.8864973487791334, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.7387330872699986, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.5652845444887389, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8691775287719905, 0.8864973487791334, 0.5652845444887389, 0.9035222925783293, 0.9035222925783293, 0.8864973487791334, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.7387330872699986, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.5652845444887389, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8691775287719905, 0.8864973487791334, 0.5652845444887389, 0.9035222925783293, 0.9035222925783293, 0.8864973487791334, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.7387330872699986, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.5652845444887389, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8691775287719905, 0.8864973487791334, 0.5652845444887389, 0.9035222925783293, 0.9035222925783293, 0.8864973487791334, 0.8515524375924506, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7967329450848046, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.8153420232571196, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.5652845444887389, 0.8691775287719905, 0.8691775287719905, 0.5652845444887389, 0.8691775287719905, 0.8691775287719905, 0.5652845444887389, 0.8691775287719905, 0.8864973487791334, 0.5652845444887389, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.8864973487791334, 0.5652845444887389, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5652845444887389, 0.8864973487791334, 0.8864973487791334, 0.8691775287719905, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7967329450848046, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.8153420232571196, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.5652845444887389, 0.8691775287719905, 0.8691775287719905, 0.5652845444887389, 0.8691775287719905, 0.8691775287719905, 0.5652845444887389, 0.8691775287719905, 0.8864973487791334, 0.5652845444887389, 0.8864973487791334, 0.8864973487791334, 0.9035222925783293, 0.5652845444887389, 0.9035222925783293, 0.5652845444887389, 0.5652845444887389, 0.9035222925783293, 0.9035222925783293, 0.5652845444887389, 0.9035222925783293, 0.5652845444887389, 0.5652845444887389, 0.9202622330629227, 0.9202622330629227, 0.9202622330629227, 0.9035222925783293, 0.8864973487791334, 0.9202622330629227, 0.5652845444887389, 0.8864973487791334, 0.8515524375924506, 0.833611120734537, 0.833611120734537, 0.8691775287719905, 0.5652845444887389, 0.8691775287719905, 0.8864973487791334, 0.5652845444887389, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5652845444887389, 0.833611120734537, 0.833611120734537, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.5652845444887389, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.5652845444887389, 0.833611120734537, 0.833611120734537, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.5652845444887389, 0.833611120734537, 0.833611120734537, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.5652845444887389, 0.8515524375924506, 0.8153420232571196, 0.8153420232571196, 0.8153420232571196, 0.5652845444887389, 0.8153420232571196, 0.833611120734537, 0.8153420232571196, 0.7967329450848046, 0.8515524375924506, 0.5652845444887389, 0.8153420232571196, 0.7777709920703102, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6771609938949378, 0.6981090974271096, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.7777709920703102, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7967329450848046, 0.8153420232571196, 0.5652845444887389, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7186273667339679, 0.6981090974271096, 0.6115475853143139, 0.6115475853143139, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.6115475853143139, 0.6339004969859428, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6557646610251396, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7387330872699986, 0.5652845444887389, 0.7387330872699986, 0.7387330872699986, 0.7186273667339679, 0.6115475853143139, 0.6115475853143139, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.6115475853143139, 0.6339004969859428, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6557646610251396, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7387330872699986, 0.7584425223266994, 0.5652845444887389, 0.7584425223266994, 0.5652845444887389, 0.5652845444887389, 0.8515524375924506, 0.8153420232571196, 0.8153420232571196, 0.5652845444887389, 0.8153420232571196, 0.833611120734537, 0.8153420232571196, 0.7967329450848046, 0.8515524375924506, 0.5652845444887389, 0.8153420232571196, 0.7777709920703102, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6981090974271096, 0.6771609938949378, 0.6771609938949378, 0.6557646610251396, 0.6557646610251396, 0.6557646610251396, 0.6771609938949378, 0.7186273667339679, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7967329450848046, 0.8153420232571196, 0.5652845444887389, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7186273667339679, 0.6981090974271096, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6339004969859428, 0.6115475853143139, 0.6115475853143139, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.6115475853143139, 0.6557646610251396, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.7186273667339679, 0.7186273667339679, 0.7387330872699986, 0.5652845444887389, 0.7387330872699986, 0.7387330872699986, 0.7186273667339679, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6339004969859428, 0.6115475853143139, 0.6115475853143139, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.6115475853143139, 0.6557646610251396, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.7186273667339679, 0.7186273667339679, 0.7387330872699986, 0.7584425223266994, 0.5652845444887389, 0.7584425223266994, 0.5652845444887389, 0.5652845444887389, 0.8515524375924506, 0.8153420232571196, 0.8153420232571196, 0.5652845444887389, 0.8153420232571196, 0.833611120734537, 0.8153420232571196, 0.7967329450848046, 0.8515524375924506, 0.5652845444887389, 0.8153420232571196, 0.7777709920703102, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6981090974271096, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.6981090974271096, 0.6981090974271096, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.7967329450848046, 0.8153420232571196, 0.5652845444887389, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7186273667339679, 0.6981090974271096, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6339004969859428, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6557646610251396, 0.6339004969859428, 0.6339004969859428, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.7387330872699986, 0.5652845444887389, 0.7387330872699986, 0.7387330872699986, 0.7186273667339679, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6339004969859428, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6557646610251396, 0.6339004969859428, 0.6339004969859428, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6981090974271096, 0.6981090974271096, 0.6981090974271096, 0.7387330872699986, 0.7584425223266994, 0.5652845444887389, 0.7584425223266994, 0.5652845444887389, 0.5652845444887389, 0.8691775287719905, 0.8515524375924506, 0.8153420232571196, 0.8515524375924506, 0.5652845444887389, 0.9529241888335975, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9202622330629227, 0.9202622330629227, 0.9202622330629227, 0.9529241888335975, 0.5652845444887389, 0.9035222925783293, 0.9035222925783293, 0.8864973487791334]} +{"problem_id": "p00500", "input": "N = int(input())\n\nscore = [list(map(int, input().split())) for _ in range(N)]\n\nplayers = [0 for _ in range(N)]\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += p\n\nprint(*players, sep='\\n')\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "score", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "players", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120play", "\u0120in", "\u0120list", "(zip", "(*", "score", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120p", "\u0120in", "\u0120enumerate", "(play", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120play", ".count", "(p", ")", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120players", "[i", "]", "\u0120+=", "\u0120p", "\u010a\u010a", "print", "(*", "players", ",", "\u0120sep", "='\\", "n", "')\u010a"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.8691775287719905]} +{"problem_id": "p03170", "input": "n,k = list(map(int,input().split()))\n\narr = list(map(int,input().split()))\n\n\n\ndp = [False]*(k+1)\n\n\n\nfor stones in range(k+1):\n\n for x in arr:\n\n if stones >= x and dp[stones-x] == False:\n\n dp[stones] = True\n\n\n\nif dp[k]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")\n", "input_tokens": ["n", ",k", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "arr", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[", "False", "]*(", "k", "+", "1", ")\u010a\u010a\u010a\u010a", "for", "\u0120stones", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120arr", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120stones", "\u0120>=", "\u0120x", "\u0120and", "\u0120dp", "[", "stones", "-x", "]", "\u0120==", "\u0120False", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[", "stones", "]", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "if", "\u0120dp", "[k", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "First", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Second", "\")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7640031686476719]} +{"problem_id": "p02419", "input": "W = input().lower()\n\ns = []\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n s.append(T[i].lower())\n\nans = 0\n\nfor i in range(len(s)):\n\n if(s[i] == W):\n\n ans += 1\n\nprint(ans)", "input_tokens": ["W", "\u0120=", "\u0120input", "().", "lower", "()\u010a\u010a", "s", "\u0120=", "\u0120[]\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120list", "(map", "(str", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(T", "[", "0", "]", "\u0120==", "\u0120\"", "END", "_OF", "_TEXT", "\")", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(T", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", ".append", "(T", "[i", "].", "lower", "())\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(s", "[i", "]", "\u0120==", "\u0120W", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9094625571831276, 0.9094625571831276, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.6696615116992518, 0.6993277790098028, 0.6993277790098028, 0.8099046207685895, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.6993277790098028, 0.7561438265913266, 0.8099046207685895, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383]} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(int", "(input", "()))", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8691775287719905]} +{"problem_id": "p02773", "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nS = sorted(S)\n\nls = [[] for i in range(N + 1)]\n\nmax_num = 0\n\nleft = 0\n\nright = 0\n\nwhile right < N:\n\n while right < N and S[left] == S[right]:\n\n right += 1\n\n if (right - left) >= max_num:\n\n ls[right - left].append(S[left].decode())\n\n max_num = right - left\n\n left = right\n\n \n\nprint(('\\n'.join(ls[max_num])))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readlines", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(read", "line", "())\u010a\u010a", "S", "\u0120=", "\u0120read", "().", "split", "()\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120sorted", "(S", ")\u010a\u010a", "ls", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "\u0120+", "\u0120", "1", ")]\u010a\u010a", "max", "_num", "\u0120=", "\u0120", "0", "\u010a\u010a", "left", "\u0120=", "\u0120", "0", "\u010a\u010a", "right", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120right", "\u0120<", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120right", "\u0120<", "\u0120N", "\u0120and", "\u0120S", "[left", "]", "\u0120==", "\u0120S", "[right", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120right", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "right", "\u0120", "\u0120-", "\u0120left", ")", "\u0120>=", "\u0120max", "_num", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ls", "[right", "\u0120-", "\u0120left", "].", "append", "(S", "[left", "].", "decode", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_num", "\u0120=", "\u0120right", "\u0120-", "\u0120left", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120left", "\u0120=", "\u0120right", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(", "('\\", "n", "'.", "join", "(ls", "[max", "_num", "])))\u010a"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.8591441175808593]} +{"problem_id": "p03164", "input": "# temp\n\nn,w = list(map(int,input().split()))\n\nwv = [tuple(map(int,input().split())) for i in range(n)]\n\n\n\ndp = [0] + [float(\"inf\")]*(10**5)\n\nfor i in range(n):\n\n for j in range(10**5,wv[i][1]-1,-1):\n\n dp[j] = min(dp[j],dp[j-wv[i][1]]+wv[i][0])\n\n\n\nres = 0\n\nfor v,e in enumerate(dp):\n\n if e <= w:\n\n res = v\n\nprint(res)", "input_tokens": ["#", "\u0120temp", "\u010a\u010a", "n", ",w", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "w", "v", "\u0120=", "\u0120[", "tuple", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]", "\u0120+", "\u0120[", "float", "(\"", "inf", "\")]", "*(", "1", "0", "**", "5", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "0", "**", "5", ",w", "v", "[i", "][", "1", "]-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[j", "]", "\u0120=", "\u0120min", "(dp", "[j", "],", "dp", "[j", "-w", "v", "[i", "][", "1", "]]", "+", "w", "v", "[i", "][", "0", "])\u010a\u010a", "\u010a\u010a", "res", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120v", ",e", "\u0120in", "\u0120enumerate", "(dp", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120e", "\u0120<=", "\u0120w", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120v", "\u010a\u010a", "print", "(res", ")"], "input_token_weights": [0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.8357386476069529, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.7561438265913266, 0.6993277790098028, 0.6993277790098028, 0.6696615116992518, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.6993277790098028, 0.7561438265913266, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383]} +{"problem_id": "p02555", "input": "def main():\n\n n = int(input())\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(n+1):\n\n for j in range(i-2):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u010a\u010a", "\u0120", "\u0120dp", "\u0120=", "\u0120[", "0", "]*(", "n", "+", "1", ")\u010a\u010a", "\u0120", "\u0120dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120mod", "\u0120=", "\u0120pow", "(", "1", "0", ",", "\u0120", "9", ")", "\u0120+", "\u0120", "7", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "-", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u010a\u010a", "\u0120", "\u0120print", "((", "dp", "[n", "]))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120", "\u0120main", "()"], "input_token_weights": [0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.7792424376220217, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217]} +{"problem_id": "p02264", "input": "class Queue:\n\n def __init__(self,values):\n\n self.values = values\n\n\n\n def empty(self):\n\n if len(self.values) == 0:\n\n return True\n\n else:\n\n return False\n\n\n\n def enqueue(self,v):\n\n self.values.append(v)\n\n\n\n def dequeue(self):\n\n if len(self.values) <= 0:\n\n raise\n\n else:\n\n v = self.values[0]\n\n del self.values[0]\n\n return v\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nprocesses = []\n\nfor i in range(n):\n\n n,t = input().split(' ')\n\n processes.append((n,int(t)))\n\n\n\nqueue = Queue(processes)\n\n\n\nclock = 0\n\ndone = []\n\nwhile not queue.empty():\n\n p = queue.dequeue()\n\n n = p[0]\n\n t = p[1]\n\n if t <= q:\n\n clock+=t\n\n done.append((n,clock))\n\n else:\n\n queue.enqueue((n,t-q))\n\n clock+=q\n\n\n\nfor p in done:\n\n print(p[0],p[1])", "input_tokens": ["class", "\u0120Queue", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "values", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".values", "\u0120=", "\u0120values", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120empty", "(self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(self", ".values", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120enqueue", "(self", ",v", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".values", ".append", "(v", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120dequeue", "(self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(self", ".values", ")", "\u0120<=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120raise", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120self", ".values", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120del", "\u0120self", ".values", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120v", "\u010a\u010a\u010a\u010a", "n", ",q", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "('", "\u0120'", ")))\u010a\u010a", "process", "es", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",t", "\u0120=", "\u0120input", "().", "split", "('", "\u0120')\u010a\u010a", "\u0120\u0120\u0120", "\u0120processes", ".append", "((", "n", ",int", "(t", "))", ")\u010a\u010a\u010a\u010a", "queue", "\u0120=", "\u0120Queue", "(process", "es", ")\u010a\u010a\u010a\u010a", "clock", "\u0120=", "\u0120", "0", "\u010a\u010a", "done", "\u0120=", "\u0120[]\u010a\u010a", "while", "\u0120not", "\u0120queue", ".empty", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120queue", ".dequeue", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120p", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120p", "[", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120t", "\u0120<=", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120clock", "+=", "t", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120done", ".append", "((", "n", ",c", "lock", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120queue", ".enqueue", "((", "n", ",t", "-q", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120clock", "+=", "q", "\u010a\u010a\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120done", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(p", "[", "0", "],", "p", "[", "1", "])"], "input_token_weights": [0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.7186273667339679, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.7186273667339679, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.7186273667339679, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.781592256244883, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.7186273667339679, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829]} +{"problem_id": "p02983", "input": "l,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n print(tres)\n", "input_tokens": ["l", ",r", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "if", "\u0120r", "\u0120-", "\u0120l", "\u0120>", "\u0120", "2", "0", "1", "9", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120tres", "\u0120=", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(l", ",r", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",r", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120(", "i", "\u0120%", "\u0120", "2", "0", "1", "9", ")", "\u0120*", "\u0120(", "j", "\u0120%", "\u0120", "2", "0", "1", "9", ")", "\u0120%", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tres", "\u0120=", "\u0120min", "(t", "res", ",", "mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(t", "res", ")\u010a"], "input_token_weights": [0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.5749858371565393, 0.9328769136071888, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.860922050467044, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.8099046207685895, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6696615116992518, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895]} +{"problem_id": "p03086", "input": "# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\nimport itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n all_words = []\n\n for i in range(1, len(s) + 1):\n\n for letters in itertools.product('ATCG', repeat=i):\n\n word = ''.join(letters)\n\n all_words.append(word)\n\n \n\n for i in range(len(all_words)-1, 0-1, -1):\n\n if all_words[i] in s:\n\n print((len(all_words[i])))\n\n sys.exit()\n\n print((0))\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["#", "\u0120", "2", "0", "1", "9", "-", "1", "1", "-", "1", "2", "\u0120", "2", "2", ":", "2", "1", ":", "0", "8", "(J", "ST", ")\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "#", "\u0120import", "\u0120collections", "\u010a\u010a", "#", "\u0120import", "\u0120math", "\u010a\u010a", "#", "\u0120from", "\u0120string", "\u0120import", "\u0120ascii", "_lowercase", ",", "\u0120ascii", "_upper", "case", ",", "\u0120digits", "\u010a\u010a", "#", "\u0120from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u0120as", "\u0120bi", "_l", ",", "\u0120bis", "ect", "_right", "\u0120as", "\u0120bi", "_r", "\u010a\u010a", "import", "\u0120itertools", "\u010a\u010a", "#", "\u0120from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "#", "\u0120import", "\u0120operator", "\u0120as", "\u0120op", "\u010a\u010a", "#", "\u0120from", "\u0120scipy", ".misc", "\u0120import", "\u0120comb", "\u0120#", "\u0120float", "\u010a\u010a", "#", "\u0120import", "\u0120numpy", "\u0120as", "\u0120np", "\u0120\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120sys", ".stdin", ".readline", "().", "rstrip", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120all", "_words", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120len", "(s", ")", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120letters", "\u0120in", "\u0120itertools", ".product", "('", "AT", "CG", "',", "\u0120repeat", "=i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120word", "\u0120=", "\u0120''.", "join", "(", "letters", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120all", "_words", ".append", "(word", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(all", "_words", ")-", "1", ",", "\u0120", "0", "-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120all", "_words", "[i", "]", "\u0120in", "\u0120s", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "len", "(all", "_words", "[i", "]))", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7281392564472128, 0.6696615116992518, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6993277790098028, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529]} +{"problem_id": "p03309", "input": "# author: kagemeka \n\n# created: 2019-11-08 14:51:29(JST)\n\n## internal modules\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\nimport statistics\n\n# import functools\n\n# import operator\n\n## external modules\n\n# import scipy.special # if use comb function on AtCoder, \n\n# import scipy.misc # select scipy.misc.comb (old version) \n\n\n\ndef main():\n\n n, *a = (int(x) for x in sys.stdin.read().split())\n\n \n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n\n\n if n % 2 != 0:\n\n b = statistics.median(a)\n\n else:\n\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n\n b = statistics.median_high(a)\n\n else:\n\n b = statistics.median_low(a)\n\n \n\n ans = sum([abs(a[i] - b) for i in range(n)])\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n\n\n\n\n", "input_tokens": ["#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120author", ":", "\u0120", "\u0120k", "agem", "eka", "\u0120\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120created", ":", "\u0120", "2", "0", "1", "9", "-", "1", "1", "-", "0", "8", "\u0120", "1", "4", ":", "5", "1", ":", "2", "9", "(J", "ST", ")\u010a\u010a", "##", "\u0120internal", "\u0120modules", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "#", "\u0120import", "\u0120collections", "\u010a\u010a", "#", "\u0120import", "\u0120math", "\u010a\u010a", "#", "\u0120import", "\u0120string", "\u010a\u010a", "#", "\u0120import", "\u0120bis", "ect", "\u010a\u010a", "#", "\u0120import", "\u0120re", "\u010a\u010a", "#", "\u0120import", "\u0120itertools", "\u010a\u010a", "import", "\u0120statistics", "\u010a\u010a", "#", "\u0120import", "\u0120functools", "\u010a\u010a", "#", "\u0120import", "\u0120operator", "\u010a\u010a", "##", "\u0120external", "\u0120modules", "\u010a\u010a", "#", "\u0120import", "\u0120scipy", ".special", "\u0120\u0120", "\u0120#", "\u0120if", "\u0120use", "\u0120comb", "\u0120function", "\u0120on", "\u0120At", "Coder", ",", "\u0120\u010a\u010a", "#", "\u0120import", "\u0120scipy", ".misc", "\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120select", "\u0120scipy", ".misc", ".com", "b", "\u0120(", "old", "\u0120version", ")", "\u0120\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120*", "a", "\u0120=", "\u0120(", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120sys", ".stdin", ".read", "().", "split", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[i", "]", "\u0120-=", "\u0120(", "i", "\u0120+", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120statistics", ".median", "(a", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", ".count", "(stat", "istics", ".median", "_high", "(a", "))", "\u0120>=", "\u0120a", ".count", "(stat", "istics", ".median", "_low", "(a", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120statistics", ".median", "_high", "(a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120statistics", ".median", "_low", "(a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120sum", "([", "abs", "(a", "[i", "]", "\u0120-", "\u0120b", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")])\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120execute", "\u0120only", "\u0120if", "\u0120run", "\u0120as", "\u0120a", "\u0120script", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()", "\u010a\u010a\u010a\u010a\u010a"], "input_token_weights": [0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.5770524973423397]} +{"problem_id": "p03416", "input": "def findSumDigit(num):\n\n global total\n\n total = \"\"\n\n while num > 0:\n\n total += str(num % 10)\n\n num //= 10\n\n return total\n\n\n\ndef main():\n\n a,b = list(map(int, input().split()))\n\n ans = 0\n\n for i in range(a,b+1):\n\n tmp = str(findSumDigit(i))\n\n if tmp == str(i):\n\n ans += 1\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()", "input_tokens": ["def", "\u0120find", "Sum", "Digit", "(num", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120global", "\u0120total", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120total", "\u0120=", "\u0120\"\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120num", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120total", "\u0120+=", "\u0120str", "(num", "\u0120%", "\u0120", "1", "0", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120//=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120total", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120str", "(find", "Sum", "Digit", "(i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "\u0120==", "\u0120str", "(i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p03680", "input": "N = int(input())\n\na = [int(input()) for i in range(N)]\n\nnow = a[0]\n\ncount = 1\n\nc = 0\n\nfor i in range(10**6):\n\n if now != 2:\n\n count += 1\n\n now = a[now - 1]\n\n else:\n\n print(count)\n\n c = 1\n\n break\n\nif c == 0:\n\n print((-1))\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "now", "\u0120=", "\u0120a", "[", "0", "]\u010a\u010a", "count", "\u0120=", "\u0120", "1", "\u010a\u010a", "c", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "**", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120now", "\u0120!=", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120now", "\u0120=", "\u0120a", "[now", "\u0120-", "\u0120", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(count", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "if", "\u0120c", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6339004969859428, 0.5886835746651548, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.5886835746651548, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.6771609938949378, 0.7584425223266994]} +{"problem_id": "p02386", "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "a", "=[", "list", "(map", "(int", ",input", "().", "split", "()))", "for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "def", "\u0120f", "():\u010a\u010a", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120", "\u0120d", "=a", "[i", "][:", "];", "d", "[", "3", "],", "d", "[", "4", "]=", "d", "[", "4", "],", "d", "[", "3", "]\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",n", "):\u010a\u010a", "\u0120\u0120", "\u0120e", "=a", "[j", "][:", "];", "e", "[", "3", "],", "e", "[", "4", "]=", "e", "[", "4", "],", "e", "[", "3", "]\u010a\u010a", "\u0120\u0120", "\u0120for", "\u0120p", "\u0120in", "([", "0", ",", "1", ",", "2", ",", "3", ",", "4", ",", "5", "],[", "1", ",", "5", ",", "2", ",", "0", ",", "4", ",", "3", "],[", "2", ",", "1", ",", "5", ",", "3", ",", "0", ",", "4", "],[", "3", ",", "0", ",", "2", ",", "5", ",", "4", ",", "1", "],[", "4", ",", "1", ",", "0", ",", "3", ",", "5", ",", "2", "],[", "5", ",", "1", ",", "4", ",", "3", ",", "2", ",", "0", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "=[", "d", "[k", "]", "for", "\u0120k", "\u0120in", "\u0120p", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120f", "[", "0", "]==", "e", "[", "0", "]", "and", "\u0120f", "[", "5", "]==", "e", "[", "5", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120f", "=f", "[", "1", ":", "5", "]*", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "4", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120f", "[k", ":k", "+", "4", "]==", "e", "[", "1", ":", "5", "]:", "return", "'", "No", "'\u010a\u010a", "\u0120return", "'", "Yes", "'\u010a\u010a", "print", "((", "f", "()))\u010a"], "input_token_weights": [0.9273515896195933, 0.9273515896195933, 0.8889473014940781, 0.8889473014940781, 0.9273515896195933, 0.9273515896195933, 0.8889473014940781, 0.8691775287719905, 0.8284253466378658, 0.8284253466378658, 0.785941609719976, 0.785941609719976, 0.8691775287719905, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8691775287719905, 0.8490090158852169, 0.9083337953965728, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.8889473014940781, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.9083337953965728, 0.5686609715453708, 0.8490090158852169, 0.8490090158852169, 0.8074090697023789, 0.8284253466378658, 0.8889473014940781, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8284253466378658, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8490090158852169, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8284253466378658, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8490090158852169, 0.8284253466378658, 0.8074090697023789, 0.8074090697023789, 0.8284253466378658, 0.8691775287719905, 0.5686609715453708, 0.8074090697023789, 0.8074090697023789, 0.7640031686476719, 0.785941609719976, 0.8490090158852169, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8074090697023789, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.5686609715453708, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.8074090697023789, 0.8284253466378658, 0.5686609715453708, 0.7640031686476719, 0.7640031686476719, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.741572616038919, 0.5686609715453708, 0.785941609719976, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.741572616038919, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7640031686476719, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.741572616038919, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.785941609719976, 0.5686609715453708, 0.7186273667339679, 0.7186273667339679, 0.6710943273460512, 0.6464527786867319, 0.6464527786867319, 0.6464527786867319, 0.6951432441854742, 0.6951432441854742, 0.5686609715453708, 0.5686609715453708, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.7186273667339679, 0.6951432441854742, 0.6951432441854742, 0.741572616038919, 0.5686609715453708, 0.6951432441854742, 0.6464527786867319, 0.6464527786867319, 0.6211886504852411, 0.5952696660036803, 0.5952696660036803, 0.6710943273460512, 0.6464527786867319, 0.6464527786867319, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6464527786867319, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.9083337953965728, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9273515896195933, 0.9083337953965728, 0.8691775287719905, 0.9083337953965728]} +{"problem_id": "p02952", "input": "N = int(input())\n\n\n\nans = 0\n\n\n\nfor i in range(1, N+1):\n\n if len(str(i))%2==1:\n\n ans += 1\n\n\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(str", "(i", "))", "%", "2", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8474406118450124, 0.7433160191943734, 0.7060506397782503, 0.6270757423345348, 0.7060506397782503, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p03425", "input": "import itertools\n\nfrom collections import Counter\n\nN = int(input())\n\nsrc = [input() for i in range(N)]\n\nctr = Counter()\n\nfor s in src:\n\n ctr[s[0]] += 1\n\n\n\nans = 0\n\nfor ptn in itertools.combinations('MARCH',3):\n\n a,b,c = ptn\n\n ans += ctr[a]*ctr[b]*ctr[c]\n\nprint(ans)", "input_tokens": ["import", "\u0120itertools", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "src", "\u0120=", "\u0120[", "input", "()", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "ctr", "\u0120=", "\u0120Counter", "()\u010a\u010a", "for", "\u0120s", "\u0120in", "\u0120src", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ctr", "[s", "[", "0", "]]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120p", "tn", "\u0120in", "\u0120itertools", ".com", "binations", "('", "M", "ARCH", "',", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "\u0120=", "\u0120p", "tn", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120ctr", "[a", "]*", "ctr", "[b", "]*", "ctr", "[c", "]\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.89427190936908, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.8563901704123833, 0.89427190936908, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7332896764791028, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.7332896764791028, 0.7760292149144611, 0.5928797394668679, 0.7760292149144611, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965]} +{"problem_id": "p02952", "input": "N = int(input())\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n num_dig = 0\n\n ii = i\n\n while ii > 0:\n\n ii = int(ii / 10)\n\n num_dig += 1\n\n if num_dig % 2 != 0:\n\n count += 1\n\n\n\nprint(count)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "_d", "ig", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ii", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120ii", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ii", "\u0120=", "\u0120int", "(ii", "\u0120/", "\u0120", "1", "0", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "_d", "ig", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120num", "_d", "ig", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.6270757423345348, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p02801", "input": "from string import ascii_lowercase as lower\n\nprint((lower[lower.find(input())+1]))", "input_tokens": ["from", "\u0120string", "\u0120import", "\u0120ascii", "_lowercase", "\u0120as", "\u0120lower", "\u010a\u010a", "print", "((", "lower", "[", "lower", ".find", "(input", "())", "+", "1", "]))"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p03634", "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]//g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.pop()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n", "input_tokens": ["#!", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "import", "\u0120bis", "ect", "\u010a\u010a", "import", "\u0120random", "\u010a\u010a", "def", "\u0120LI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120I", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120LS", "():", "return", "\u0120list", "(map", "(list", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120S", "():", "\u0120return", "\u0120list", "(sys", ".stdin", ".readline", "())", "[:-", "1", "]\u010a\u010a", "def", "\u0120IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120S", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120SR", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a\u010a\u010a", "#", "A", "\u010a\u010a", "\"\"\"\u010a\u010a", "def", "\u0120gcd", "(a", ",b", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120gcd", "(b", "%", "a", ",a", ")\u010a\u010a", "n", "\u0120=", "\u0120I", "()\u010a\u010a", "a", "\u0120=", "\u0120IR", "(n", ")\u010a\u010a", "l", "\u0120=", "\u0120a", "[", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "\u0120=", "\u0120gcd", "(l", ",a", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120*=", "\u0120a", "[i", "]", "//", "g", "\u010a\u010a", "print", "(l", ")\u010a\u010a", "\"\"\"", "\u010a\u010a\u010a\u010a", "#", "B", "\u010a\u010a", "n", "\u0120=", "\u0120I", "()\u010a\u010a", "v", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "[a", "].", "append", "([", "b", ",c", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "[b", "].", "append", "([", "a", ",c", "])\u010a\u010a", "Q", ",k", "\u0120=", "\u0120LI", "()\u010a\u010a", "d", "\u0120=", "\u0120[-", "1", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "d", "[k", "-", "1", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "q", "\u0120=", "\u0120deque", "()\u010a\u010a", "q", ".append", "(k", "-", "1", ")\u010a\u010a", "while", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120q", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120y", ",c", "\u0120in", "\u0120v", "[x", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[y", "]", "\u0120==", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[y", "]", "\u0120=", "\u0120d", "[x", "]+", "c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", ".append", "(y", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(Q", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",y", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "d", "[x", "]+", "d", "[y", "]))\u010a\u010a", "#", "C", "\u010a\u010a\u010a\u010a", "#", "D", "\u010a\u010a\u010a\u010a", "#", "E", "\u010a\u010a\u010a\u010a", "#", "F", "\u010a\u010a\u010a\u010a", "#", "G", "\u010a\u010a\u010a\u010a", "#", "H", "\u010a\u010a\u010a\u010a", "#", "I", "\u010a\u010a\u010a\u010a", "#", "J", "\u010a\u010a\u010a\u010a", "#", "K", "\u010a\u010a\u010a\u010a", "#", "L", "\u010a\u010a\u010a\u010a", "#", "M", "\u010a\u010a\u010a\u010a", "#", "N", "\u010a\u010a\u010a\u010a", "#", "O", "\u010a\u010a\u010a\u010a", "#", "P", "\u010a\u010a\u010a\u010a", "#", "Q", "\u010a\u010a\u010a\u010a", "#", "R", "\u010a\u010a\u010a\u010a", "#", "S", "\u010a\u010a\u010a\u010a", "#", "T", "\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.8515524375924506, 0.7967329450848046, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397]} +{"problem_id": "p04012", "input": "import string\n\nw = input()\n\nfor a in string.ascii_lowercase:\n\n cnt = 0\n\n for t in w:\n\n if t == a:\n\n cnt = cnt + 1\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")", "input_tokens": ["import", "\u0120string", "\u010a\u010a", "w", "\u0120=", "\u0120input", "()\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120string", ".ascii", "_lowercase", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120t", "\u0120in", "\u0120w", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "\u0120==", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120cnt", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "No", "\")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "print", "(\"", "Yes", "\")"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.6270757423345348, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.7060506397782503, 0.5851191688414608, 0.7433160191943734, 0.7060506397782503, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8474406118450124]} +{"problem_id": "p03013", "input": "mod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(input())-1] = 1\n\n\n\ns = 0\n\nt = 1\n\n\n\nfor i in range(n):\n\n if l[i] > 0:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)", "input_tokens": ["mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "l", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120", "\u0120l", "[int", "(input", "())", "-", "1", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120", "0", "\u010a\u010a", "t", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120l", "[i", "]", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", ",", "\u0120s", "\u0120=", "\u0120", "0", ",", "\u0120t", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", ",", "\u0120s", "\u0120=", "\u0120(", "s", "+t", ")%", "mod", ",", "\u0120t", "\u010a\u010a\u010a\u010a", "print", "(t", ")"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03774", "input": "N,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 2*10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n", "input_tokens": ["N", ",M", "\u0120=", "\u0120[", "int", "(c", ")", "\u0120for", "\u0120c", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "ab", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120c", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "cd", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120c", "\u0120in", "\u0120range", "(M", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120mi", "\u0120=", "\u0120", "2", "*", "1", "0", "**", "9", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120abs", "(ab", "[i", "][", "0", "]-", "cd", "[j", "][", "0", "])+", "abs", "(ab", "[i", "][", "1", "]-", "cd", "[j", "][", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120mi", "\u0120>", "\u0120tmp", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mi", "\u0120=", "\u0120tmp", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120j", "+", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852]} +{"problem_id": "p03416", "input": "def test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n j = list(map(int,list(str(i))))\n\n if j[0] == j[4] and j[1] == j[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n", "input_tokens": ["def", "\u0120test", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120list", "(map", "(int", ",list", "(str", "(i", "))))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "[", "0", "]", "\u0120==", "\u0120j", "[", "4", "]", "\u0120and", "\u0120j", "[", "1", "]", "\u0120==", "\u0120j", "[", "3", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(count", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120test", "()\u010a"], "input_token_weights": [0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.60398418480891, 0.7713695892187169, 0.5731452134031394, 0.8456076926739031, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031]} +{"problem_id": "p02821", "input": "from bisect import bisect_left\n\nfrom bisect import bisect_right\n\n\n\nn,m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = sorted(a)\n\n\n\na_count = [0]*100010\n\na_sum = [0]*100010\n\n\n\nfor i in range(n):\n\n a_count[a[i]] += 1\n\n a_sum[a[i]] += a[i]\n\n\n\nfor i in range(100005,-1,-1):\n\n a_count[i] += a_count[i+1]\n\n a_sum[i] += a_sum[i+1]\n\n\n\ndef chk(x):\n\n case = 0\n\n for i in range(n):\n\n if 0<= x-a[i]<= 10**5+5:\n\n case += a_count[x-a[i]]\n\n elif x-a[i] < 0:\n\n case += n\n\n if case >= m:\n\n ch = True\n\n else:\n\n ch = False\n\n return ch\n\n\n\nl = 2*a[-1]+1 #NG\n\nr = 1 #OK\n\n\n\nwhile abs(r-l) > 1:\n\n kk = (r+l)//2\n\n if chk(kk):\n\n r = kk\n\n else:\n\n l = kk\n\n\n\nans = 0\n\nsm = sum(a)\n\n\n\nl = r\n\n\n\ncase = 0\n\nfor i in range(n):\n\n num = n-bisect_right(a,l-a[i]-1)\n\n case += num\n\n ans += num*a[i]*2\n\n\n\nans -= (case-m)*l\n\n\n\nprint(ans)", "input_tokens": ["from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_right", "\u010a\u010a\u010a\u010a", "n", ",m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120sorted", "(a", ")\u010a\u010a\u010a\u010a", "a", "_count", "\u0120=", "\u0120[", "0", "]*", "1", "0", "0", "0", "1", "0", "\u010a\u010a", "a", "_sum", "\u0120=", "\u0120[", "0", "]*", "1", "0", "0", "0", "1", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_count", "[a", "[i", "]]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_sum", "[a", "[i", "]]", "\u0120+=", "\u0120a", "[i", "]\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "0", "0", "0", "5", ",-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_count", "[i", "]", "\u0120+=", "\u0120a", "_count", "[i", "+", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_sum", "[i", "]", "\u0120+=", "\u0120a", "_sum", "[i", "+", "1", "]\u010a\u010a\u010a\u010a", "def", "\u0120chk", "(x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120case", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "<=", "\u0120x", "-a", "[i", "]<=", "\u0120", "1", "0", "**", "5", "+", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120case", "\u0120+=", "\u0120a", "_count", "[x", "-a", "[i", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120x", "-a", "[i", "]", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120case", "\u0120+=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120case", "\u0120>=", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ch", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ch", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ch", "\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120", "2", "*a", "[-", "1", "]+", "1", "\u0120\u0120\u0120", "\u0120#", "NG", "\u010a\u010a", "r", "\u0120=", "\u0120", "1", "\u0120#", "OK", "\u010a\u010a\u010a\u010a", "while", "\u0120abs", "(r", "-l", ")", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120kk", "\u0120=", "\u0120(", "r", "+l", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120chk", "(k", "k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120kk", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120kk", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "sm", "\u0120=", "\u0120sum", "(a", ")\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120r", "\u010a\u010a\u010a\u010a", "case", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120n", "-b", "is", "ect", "_right", "(a", ",l", "-a", "[i", "]-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120case", "\u0120+=", "\u0120num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120num", "*a", "[i", "]*", "2", "\u010a\u010a\u010a\u010a", "ans", "\u0120-=", "\u0120(", "case", "-m", ")*", "l", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.781592256244883, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6160583186229708, 0.6855929667625797, 0.579389560544, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8408263201236497, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6514299043837268, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03548", "input": "X, Y, Z = list(map(int, input().split()))\n\nfor n in range(10 ** 5, 0, -1):\n\n if X >= n * (Y + Z) + Z:\n\n break\n\nprint(n)", "input_tokens": ["X", ",", "\u0120Y", ",", "\u0120Z", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "for", "\u0120n", "\u0120in", "\u0120range", "(", "1", "0", "\u0120**", "\u0120", "5", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120X", "\u0120>=", "\u0120n", "\u0120*", "\u0120(", "Y", "\u0120+", "\u0120Z", ")", "\u0120+", "\u0120Z", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "print", "(n", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02576", "input": "array = list(map(int, input().split()))\n\nif array[0] % array[1] > 0:\n\n print(((array[0] // array[1] + 1) * array[2]))\n\nelse:\n\n print(((array[0] // array[1]) * array[2]))", "input_tokens": ["array", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "if", "\u0120array", "[", "0", "]", "\u0120%", "\u0120array", "[", "1", "]", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "array", "[", "0", "]", "\u0120//", "\u0120array", "[", "1", "]", "\u0120+", "\u0120", "1", ")", "\u0120*", "\u0120array", "[", "2", "]))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "array", "[", "0", "]", "\u0120//", "\u0120array", "[", "1", "])", "\u0120*", "\u0120array", "[", "2", "]))"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.9235768548788368, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7186273667339679, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.781592256244883]} +{"problem_id": "p02268", "input": "N = int(input())\n\nS = list(map(int, input().split()))\n\nQ = int(input())\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n idx = int((head+tail)/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n if head == idx:\n\n return False\n\n return binary_search(target_num, head, idx-1)\n\n else:\n\n if tail == idx:\n\n return False\n\n return binary_search(target_num, idx+1, tail)\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "S", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "Q", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "T", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120binary", "_search", "(target", "_num", ",", "\u0120head", ",", "\u0120tail", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120idx", "\u0120=", "\u0120int", "((", "head", "+", "tail", ")/", "2", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120target", "_num", "\u0120==", "\u0120S", "[idx", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120target", "_num", "\u0120<", "\u0120S", "[idx", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120head", "\u0120==", "\u0120idx", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120binary", "_search", "(target", "_num", ",", "\u0120head", ",", "\u0120idx", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tail", "\u0120==", "\u0120idx", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120binary", "_search", "(target", "_num", ",", "\u0120idx", "+", "1", ",", "\u0120tail", ")\u010a\u010a\u010a\u010a\u010a\u010a", "match", "_count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120target", "_num", "\u0120in", "\u0120T", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120binary", "_search", "(target", "_num", ",", "\u0120", "0", ",", "\u0120len", "(S", ")-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120match", "_count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "((", "str", "(match", "_count", ")))\u010a"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p03796", "input": "n=input()\n\nn=int(n)\n\na=1\n\nfor i in range(n):\n\n a=a*(i+1)\n\n if a>=pow(10,9)+7:\n\n a=a%(pow(10,9)+7)\n\nprint(a)", "input_tokens": ["n", "=input", "()\u010a\u010a", "n", "=int", "(n", ")\u010a\u010a", "a", "=", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=a", "*(", "i", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", ">=", "pow", "(", "1", "0", ",", "9", ")+", "7", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "=a", "%(", "pow", "(", "1", "0", ",", "9", ")+", "7", ")\u010a\u010a", "print", "(a", ")"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p00003", "input": "import sys\n\nr = []\n\nn = int(input())\n\nl = sys.stdin.readlines()\n\nfor i in l:\n\n x, y, z = sorted([x*x for x in list(map(int, i.split()))])\n\n if x + y == z:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "r", "\u0120=", "\u0120[]\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "l", "\u0120=", "\u0120sys", ".stdin", ".readlines", "()\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120l", ":\u010a\u010a", "\u0120", "\u0120x", ",", "\u0120y", ",", "\u0120z", "\u0120=", "\u0120sorted", "([", "x", "*x", "\u0120for", "\u0120x", "\u0120in", "\u0120list", "(map", "(int", ",", "\u0120i", ".split", "()))", "])\u010a\u010a", "\u0120", "\u0120if", "\u0120x", "\u0120+", "\u0120y", "\u0120==", "\u0120z", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "YES", "\")\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8691775287719905, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8922045961188434, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7713695892187169]} +{"problem_id": "p03086", "input": "import re\n\nptn = re.compile(r\"(A|C|G|T)*\")\n\n\n\nS = input()\n\n\n\nans = 0\n\nfor i in range(len(S)):\n\n for j in range(len(S)):\n\n x = ptn.match(S[i:i+j+1]).group(0)\n\n if(x):\n\n ans = max(ans, len(x))\n\nprint(ans)", "input_tokens": ["import", "\u0120re", "\u010a\u010a", "pt", "n", "\u0120=", "\u0120re", ".compile", "(r", "\"(", "A", "|", "C", "|", "G", "|", "T", ")*", "\")\u010a\u010a", "\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120p", "tn", ".match", "(S", "[i", ":i", "+j", "+", "1", "]).", "group", "(", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(x", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120len", "(x", "))\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.8456076926739031, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6629477592666795, 0.60398418480891, 0.6339004969859428, 0.6339004969859428, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6629477592666795, 0.7186273667339679, 0.914713330925897, 0.8922045961188434, 0.8922045961188434]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nab = c * 2\n\n\n\nres = float(\"inf\")\n\nif a + b <= ab:\n\n res = x * a + y * b\n\nelse:\n\n if x == y:\n\n res = x * ab\n\n elif x > y:\n\n for i in range(y, x + 1):\n\n cost = i * ab + (x - i) * a\n\n res = min(res, cost)\n\n else:\n\n for i in range(x, y + 1):\n\n cost = i * ab + (y - i) * b\n\n res = min(res, cost)\n\nprint(res)\n", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ab", "\u0120=", "\u0120c", "\u0120*", "\u0120", "2", "\u010a\u010a\u010a\u010a", "res", "\u0120=", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "if", "\u0120a", "\u0120+", "\u0120b", "\u0120<=", "\u0120ab", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120x", "\u0120*", "\u0120a", "\u0120+", "\u0120y", "\u0120*", "\u0120b", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120x", "\u0120*", "\u0120ab", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120x", "\u0120>", "\u0120y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(y", ",", "\u0120x", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cost", "\u0120=", "\u0120i", "\u0120*", "\u0120ab", "\u0120+", "\u0120(", "x", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120min", "(res", ",", "\u0120cost", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(x", ",", "\u0120y", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cost", "\u0120=", "\u0120i", "\u0120*", "\u0120ab", "\u0120+", "\u0120(", "y", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120min", "(res", ",", "\u0120cost", ")\u010a\u010a", "print", "(res", ")\u010a"], "input_token_weights": [0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8691775287719905, 0.9367265554405826, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.7186273667339679, 0.7967329450848046, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.5731452134031394, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.7186273667339679, 0.7967329450848046, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.5731452134031394, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.914713330925897, 0.8922045961188434, 0.8922045961188434]} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nans=a*x+b*y\n\nfor ci in range(max(x,y)+1):\n\n sumc = 2*ci*c\n\n sumc += (x-ci)*a if (x-ci)>0 else 0\n\n sumc += (y-ci)*b if (y-ci)>0 else 0\n\n ans=min(ans,sumc)\n\n\n\nprint(ans)", "input_tokens": ["a", ",b", ",c", ",x", ",y", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "=a", "*x", "+b", "*y", "\u010a\u010a", "for", "\u0120ci", "\u0120in", "\u0120range", "(max", "(x", ",y", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "c", "\u0120=", "\u0120", "2", "*", "ci", "*c", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "c", "\u0120+=", "\u0120(", "x", "-ci", ")*", "a", "\u0120if", "\u0120(", "x", "-ci", ")>", "0", "\u0120else", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "c", "\u0120+=", "\u0120(", "y", "-ci", ")*", "b", "\u0120if", "\u0120(", "y", "-ci", ")>", "0", "\u0120else", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=min", "(ans", ",sum", "c", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p01105", "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p ^ e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&%s\"%\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n", "input_tokens": ["a", "=", "6", "5", "2", "8", "0", ";", "\u0120b", "=", "6", "1", "6", "8", "0", ";", "\u0120c", "=", "5", "2", "4", "2", "8", ";", "\u0120d", "=", "4", "3", "6", "9", "0", ";", "\u0120e", "=", "6", "5", "5", "3", "5", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "base", "\u0120=", "\u0120[", "a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120d", ",", "\u0120e", ",", "\u0120", "0", "]\u010a\u010a", "Q", "\u0120=", "\u0120[(", "1", ",", "\u0120el", ")", "\u0120for", "\u0120el", "\u0120in", "\u0120base", "]\u010a\u010a", "L", "\u0120=", "\u0120{", "el", ":", "\u0120", "1", "\u0120for", "\u0120el", "\u0120in", "\u0120base", "}\u010a\u010a", "H", "\u0120=", "\u0120[]\u010a\u010a", "get", "\u0120=", "\u0120L", ".get", "\u010a\u010a", "push", "\u0120=", "\u0120H", ".append", "\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ",", "\u0120p", "\u0120=", "\u0120he", "app", "op", "(Q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120L", "[p", "]", "\u0120<", "\u0120l", ":", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "+", "1", "\u0120<", "\u0120get", "(p", "\u0120^", "\u0120e", ",", "\u0120", "1", "7", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120^", "\u0120e", "]", "\u0120=", "\u0120l", "+", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+", "1", "\u0120<", "\u0120", "1", "6", ":", "\u0120he", "app", "ush", "(Q", ",", "\u0120(", "l", "+", "1", ",", "\u0120p", "\u0120^", "\u0120e", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "+", "3", "\u0120<", "\u0120", "1", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120q", ",", "\u0120r", "\u0120in", "\u0120H", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<=", "\u0120", "1", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<", "\u0120get", "(p", "\u0120&", "\u0120q", ",", "\u0120", "1", "7", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120&", "\u0120q", "]", "\u0120=", "\u0120l", "+r", "+", "3", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<", "\u0120", "1", "6", ":", "\u0120he", "app", "ush", "(Q", ",", "\u0120(", "l", "+r", "+", "3", ",", "\u0120p", "\u0120&", "\u0120q", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<", "\u0120get", "(p", "\u0120^", "\u0120q", ",", "\u0120", "1", "7", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120^", "\u0120q", "]", "\u0120=", "\u0120l", "+r", "+", "3", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<", "\u0120", "1", "6", ":", "\u0120he", "app", "ush", "(Q", ",", "\u0120(", "l", "+r", "+", "3", ",", "\u0120p", "\u0120^", "\u0120q", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120<", "\u0120", "7", ":", "\u0120push", "((", "p", ",", "\u0120l", "))\u010a\u010a", "print", "(*", "map", "(L", ".__", "getitem", "__,", "\u0120eval", "(\"", "e", "&", "%", "s", "\"%", "\",", "e", "&", "\".", "join", "(open", "(", "0", ").", "read", "().", "replace", "(*", "\"-", "~", "\").", "replace", "(*", "\"*", "&", "\").", "replace", "(*", "\"", "1", "e", "\").", "split", "()", "[:-", "1", "]))", "),", "sep", "='\\", "n", "')\u010a"], "input_token_weights": [0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9733714842433752, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9733714842433752, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9733714842433752, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9733714842433752, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.5618966785389459, 0.9597865136227453, 0.9460144469641688, 0.9597865136227453, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9597865136227453, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.5618966785389459, 0.9460144469641688, 0.9460144469641688, 0.9320500587378737, 0.9320500587378737, 0.9320500587378737, 0.9320500587378737, 0.9320500587378737, 0.9320500587378737, 0.9320500587378737, 0.9320500587378737, 0.9320500587378737, 0.9320500587378737, 0.9320500587378737, 0.5618966785389459, 0.9320500587378737, 0.9320500587378737, 0.9460144469641688, 0.9460144469641688, 0.9320500587378737, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9320500587378737, 0.9460144469641688, 0.9460144469641688, 0.9320500587378737, 0.9178879013889365, 0.9178879013889365, 0.5618966785389459, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9320500587378737, 0.9460144469641688, 0.9460144469641688, 0.9320500587378737, 0.9460144469641688, 0.9460144469641688, 0.9320500587378737, 0.9320500587378737, 0.5618966785389459, 0.9460144469641688, 0.9460144469641688, 0.9320500587378737, 0.9320500587378737, 0.5618966785389459, 0.9597865136227453, 0.9597865136227453, 0.9597865136227453, 0.5618966785389459, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9178879013889365, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8889473014940781, 0.8889473014940781, 0.5618966785389459, 0.9320500587378737, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9178879013889365, 0.9178879013889365, 0.9320500587378737, 0.9035222925783293, 0.5618966785389459, 0.5618966785389459, 0.9320500587378737, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9178879013889365, 0.9035222925783293, 0.8889473014940781, 0.8741567341500069, 0.8741567341500069, 0.8889473014940781, 0.5618966785389459, 0.8889473014940781, 0.8889473014940781, 0.9320500587378737, 0.5618966785389459, 0.8741567341500069, 0.8741567341500069, 0.8591441175808593, 0.8591441175808593, 0.8741567341500069, 0.8889473014940781, 0.8741567341500069, 0.8741567341500069, 0.8741567341500069, 0.5618966785389459, 0.5618966785389459, 0.9035222925783293, 0.8741567341500069, 0.8741567341500069, 0.8741567341500069, 0.8889473014940781, 0.5618966785389459, 0.8889473014940781, 0.8889473014940781, 0.9035222925783293, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8439026828328628, 0.8439026828328628, 0.8284253466378658, 0.8127046916468574, 0.8127046916468574, 0.8127046916468574, 0.8284253466378658, 0.8127046916468574, 0.8127046916468574, 0.8127046916468574, 0.8439026828328628, 0.5618966785389459, 0.9320500587378737, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9178879013889365, 0.5618966785389459, 0.9178879013889365, 0.9178879013889365, 0.9320500587378737, 0.5618966785389459, 0.9035222925783293, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5618966785389459, 0.8741567341500069, 0.8284253466378658, 0.8284253466378658, 0.8439026828328628, 0.8439026828328628, 0.8591441175808593, 0.5618966785389459, 0.8591441175808593, 0.8591441175808593, 0.8741567341500069, 0.5618966785389459, 0.8439026828328628, 0.7967329450848046, 0.7967329450848046, 0.8127046916468574, 0.8127046916468574, 0.8284253466378658, 0.8127046916468574, 0.7967329450848046, 0.7805019556730379, 0.7805019556730379, 0.7967329450848046, 0.5618966785389459, 0.7967329450848046, 0.7967329450848046, 0.8439026828328628, 0.5618966785389459, 0.7805019556730379, 0.7805019556730379, 0.7640031686476719, 0.7640031686476719, 0.7805019556730379, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7805019556730379, 0.7805019556730379, 0.5618966785389459, 0.5618966785389459, 0.8127046916468574, 0.7640031686476719, 0.7640031686476719, 0.7805019556730379, 0.7805019556730379, 0.7967329450848046, 0.5618966785389459, 0.7967329450848046, 0.7967329450848046, 0.8127046916468574, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7472275986823891, 0.7472275986823891, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7128078369393277, 0.7128078369393277, 0.7301658005010259, 0.7128078369393277, 0.7128078369393277, 0.7128078369393277, 0.7472275986823891, 0.5618966785389459, 0.8439026828328628, 0.7967329450848046, 0.7967329450848046, 0.8127046916468574, 0.8127046916468574, 0.8284253466378658, 0.8127046916468574, 0.7967329450848046, 0.7805019556730379, 0.7805019556730379, 0.7967329450848046, 0.5618966785389459, 0.7967329450848046, 0.7967329450848046, 0.8439026828328628, 0.5618966785389459, 0.7805019556730379, 0.7805019556730379, 0.7640031686476719, 0.7640031686476719, 0.7805019556730379, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7805019556730379, 0.7805019556730379, 0.5618966785389459, 0.5618966785389459, 0.8127046916468574, 0.7640031686476719, 0.7640031686476719, 0.7805019556730379, 0.7805019556730379, 0.7967329450848046, 0.5618966785389459, 0.7967329450848046, 0.7967329450848046, 0.8127046916468574, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7472275986823891, 0.7472275986823891, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7128078369393277, 0.7128078369393277, 0.7301658005010259, 0.7128078369393277, 0.7128078369393277, 0.7128078369393277, 0.7472275986823891, 0.5618966785389459, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.5618966785389459, 0.5618966785389459, 0.9320500587378737, 0.9178879013889365, 0.9178879013889365, 0.5618966785389459, 0.9178879013889365, 0.9320500587378737, 0.8889473014940781, 0.8741567341500069, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8741567341500069, 0.9460144469641688, 0.9320500587378737, 0.9035222925783293, 0.8889473014940781, 0.8741567341500069, 0.8741567341500069, 0.8889473014940781, 0.8741567341500069, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8439026828328628, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8127046916468574, 0.8127046916468574, 0.8127046916468574, 0.582053818991329, 0.582053818991329, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593, 0.9320500587378737, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.9320500587378737]} +{"problem_id": "p04020", "input": "def examB():\n\n N = I(); A = [I() for _ in range(N)]\n\n ans = 0; cur= 0\n\n for i in A:\n\n if i==0:\n\n ans += cur//2\n\n cur = 0\n\n else:\n\n cur += i\n\n ans += cur // 2\n\n print(ans)\n\n return\n\n\n\nimport sys,copy,bisect,itertools,heapq,math\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\n\n\nif __name__ == '__main__':\n\n examB()\n", "input_tokens": ["def", "\u0120exam", "B", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120I", "();", "\u0120A", "\u0120=", "\u0120[", "I", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", ";", "\u0120cur", "=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cur", "//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120+=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cur", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", ",copy", ",b", "is", "ect", ",it", "ertools", ",", "heap", "q", ",", "math", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "op", ",", "he", "app", "ush", ",", "heap", "ify", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", ",default", "dict", ",", "deque", "\u010a\u010a", "def", "\u0120I", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120LI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120L", "SI", "():", "\u0120return", "\u0120list", "(map", "(str", ",", "sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120LS", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "split", "()\u010a\u010a", "def", "\u0120SI", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "inf", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120exam", "B", "()\u010a"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p03544", "input": "N = int(input())\n\nL = [ 0 ] * 1000000\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "L", "\u0120=", "\u0120[", "\u0120", "0", "\u0120]", "\u0120*", "\u0120", "1", "0", "0", "0", "0", "0", "0", "\u010a\u010a\u010a\u010a", "L", "[", "0", "]", "\u0120=", "\u0120", "2", "\u010a\u010a", "L", "[", "1", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120", "\u0120L", "[i", "]", "\u0120=", "\u0120L", "[i", "-", "2", "]", "\u0120+", "\u0120L", "[i", "-", "1", "]\u010a\u010a\u010a\u010a", "print", "((", "L", "[N", "]))\u010a"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.7760292149144611, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.89427190936908, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.6886415962350058, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.7332896764791028, 0.8170167109432965]} +{"problem_id": "p03013", "input": "import sys\n\nN,M=list(map(int,input().split()))\n\nS=set(map(int,sys.stdin))\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in S:\n\n a,b=b,0\n\n else:\n\n a,b=b,a+b\n\n\n\nprint((b%(10**9+7)))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "N", ",M", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "S", "=set", "(map", "(int", ",", "sys", ".stdin", "))", "\u010a\u010a\u010a\u010a", "a", ",b", "=", "0", ",", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120in", "\u0120S", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",b", "=b", ",", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",b", "=b", ",a", "+b", "\u010a\u010a\u010a\u010a", "print", "((", "b", "%(", "1", "0", "**", "9", "+", "7", ")))\u010a"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.8284253466378658, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.8591441175808593]} +{"problem_id": "p01138", "input": "import re\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = [0] * (24*60*60+1)\n\n for _ in range(n):\n\n h1,m1,s1,h2,m2,s2 = list(map(int, re.split(':| ', input())))\n\n l[h1*60*60 + m1*60 + s1] += 1\n\n l[h2*60*60 + m2*60 + s2] -= 1\n\n r = 0\n\n for i in range(24*60*60):\n\n l[i+1] += l[i]\n\n r = max(r, l[i+1])\n\n print(r)", "input_tokens": ["import", "\u0120re", "\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "2", "4", "*", "6", "0", "*", "6", "0", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120h", "1", ",m", "1", ",s", "1", ",h", "2", ",m", "2", ",s", "2", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120re", ".split", "(':", "|", "\u0120',", "\u0120input", "()))", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[h", "1", "*", "6", "0", "*", "6", "0", "\u0120+", "\u0120m", "1", "*", "6", "0", "\u0120+", "\u0120s", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[h", "2", "*", "6", "0", "*", "6", "0", "\u0120+", "\u0120m", "2", "*", "6", "0", "\u0120+", "\u0120s", "2", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "4", "*", "6", "0", "*", "6", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[i", "+", "1", "]", "\u0120+=", "\u0120l", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120max", "(r", ",", "\u0120l", "[i", "+", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(r", ")"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6339004969859428, 0.6629477592666795, 0.6339004969859428, 0.7186273667339679, 0.7713695892187169, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7713695892187169, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031]} +{"problem_id": "p03074", "input": "N, K = list(map(int, input().split()))\n\nS = input()\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\nleft = 0\n\nright = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n\n\n next_left = i\n\n next_right = min(i + add, len(nums))\n\n\n\n while next_left > left:\n\n tmp -= nums[left]\n\n left += 1\n\n\n\n while next_right > right:\n\n tmp += nums[right]\n\n right += 1\n\n\n\n ans = max(ans, tmp)\n\nprint(ans)", "input_tokens": ["N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a", "nums", "\u0120=", "\u0120[]\u010a\u010a", "now", "\u0120=", "\u0120", "1", "\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", "]", "\u0120==", "\u0120str", "(now", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nums", ".append", "(cnt", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120now", "\u0120=", "\u0120", "1", "\u0120-", "\u0120now", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120cnt", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120nums", ".append", "(cnt", ")\u010a\u010a", "if", "\u0120len", "(nums", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120nums", ".append", "(", "0", ")\u010a\u010a\u010a\u010a", "add", "\u0120=", "\u0120", "2", "\u0120*", "\u0120K", "\u0120+", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "left", "\u0120=", "\u0120", "0", "\u010a\u010a", "right", "\u0120=", "\u0120", "0", "\u010a\u010a", "tmp", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120len", "(nums", "),", "\u0120", "2", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120next", "_left", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120next", "_right", "\u0120=", "\u0120min", "(i", "\u0120+", "\u0120add", ",", "\u0120len", "(nums", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120next", "_left", "\u0120>", "\u0120left", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120-=", "\u0120nums", "[left", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120left", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120next", "_right", "\u0120>", "\u0120right", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120nums", "[right", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120right", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120tmp", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9178879013889365, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03424", "input": "n=int(input())\n\ns=list(map(str,input().split()))\n\ntotal=[]\n\nfor i in range(n):\n\n if s[i] not in total:\n\n total.append(s[i])\n\nprint(('Three' if len(total)==3 else 'Four'))", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "s", "=list", "(map", "(str", ",input", "().", "split", "()))\u010a\u010a", "total", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120not", "\u0120in", "\u0120total", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120total", ".append", "(s", "[i", "])\u010a\u010a", "print", "(('", "Three", "'", "\u0120if", "\u0120len", "(total", ")==", "3", "\u0120else", "\u0120'", "Four", "'))"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.8889473014940781, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p03164", "input": "import sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = [float('inf')] * 1000 * 100*10\n\nvs = set()\n\nvs.add(0)\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n tmpDP = dp.copy()\n\n for vv in list(vs):\n\n if dp[vv + v] > dp[vv] + w:\n\n tmpDP[vv + v] = dp[vv] + w\n\n vs.add(vv + v)\n\n dp = tmpDP\n\n\n\n\n\nans = 0\n\nfor v in list(vs):\n\n if dp[v] <= W:\n\n ans = max(ans, v)\n\nprint(ans)\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", ",", "\u0120deque", ",", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120accumulate", ",", "\u0120permutations", ",", "\u0120combinations", ",", "\u0120tak", "ew", "h", "ile", ",", "\u0120compress", ",", "\u0120cycle", "\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120ceil", ",", "\u0120floor", ",", "\u0120log", "1", "0", ",", "\u0120log", "2", ",", "\u0120factorial", "\u010a\u010a", "from", "\u0120pprint", "\u0120import", "\u0120pprint", "\u010a\u010a\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", "0", ")\u010a\u010a", "#", "\u0120MOD", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "#", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "#", "\u0120A", "\u0120=", "\u0120[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "#", "\u0120V", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120", "1", "0", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "1", "0", "0", ")]\u010a\u010a", "#", "\u0120A", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120W", "\u0120=", "\u0120[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[", "float", "('", "inf", "')]", "\u0120*", "\u0120", "1", "0", "0", "0", "\u0120*", "\u0120", "1", "0", "0", "*", "1", "0", "\u010a\u010a", "vs", "\u0120=", "\u0120set", "()\u010a\u010a", "vs", ".add", "(", "0", ")\u010a\u010a", "dp", "[", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", ",", "\u0120v", "\u0120=", "\u0120[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "DP", "\u0120=", "\u0120dp", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120vv", "\u0120in", "\u0120list", "(vs", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[v", "v", "\u0120+", "\u0120v", "]", "\u0120>", "\u0120dp", "[v", "v", "]", "\u0120+", "\u0120w", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "DP", "[v", "v", "\u0120+", "\u0120v", "]", "\u0120=", "\u0120dp", "[v", "v", "]", "\u0120+", "\u0120w", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120vs", ".add", "(v", "v", "\u0120+", "\u0120v", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120tmp", "DP", "\u010a\u010a\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120v", "\u0120in", "\u0120list", "(vs", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[v", "]", "\u0120<=", "\u0120W", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120v", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.582053818991329, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03796", "input": "from math import factorial\n\nN = int(input())\n\nprint((factorial(N) % (10**9 + 7)))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "factor", "ial", "(N", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p00005", "input": "import math\n\nwhile True:\n\n\ttry:\n\n\t\tx,y = list(map(int,input().split()))\n\n\t\tprint('%d %d' % (math.gcd(x,y),x/math.gcd(x,y)*y))\n\n\texcept EOFError:\n\n\t\tbreak", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0109try", ":\u010a\u010a", "\u0109", "\u0109x", ",y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0109", "\u0109print", "('%", "d", "\u0120%", "d", "'", "\u0120%", "\u0120(", "math", ".g", "cd", "(x", ",y", "),", "x", "/math", ".g", "cd", "(x", ",y", ")*", "y", "))\u010a\u010a", "\u0109except", "\u0120EOF", "Error", ":\u010a\u010a", "\u0109", "\u0109break"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394]} +{"problem_id": "p02881", "input": "n = int(input())\n\nr = int(n**.5)\n\nfor i in range(r):\n\n if n % (r-i) == 0:\n\n print(( (r-i) + n//(r-i) - 2 ))\n\n break", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "r", "\u0120=", "\u0120int", "(n", "**", ".", "5", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(r", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120(", "r", "-i", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "\u0120(", "r", "-i", ")", "\u0120+", "\u0120n", "//(", "r", "-i", ")", "\u0120-", "\u0120", "2", "\u0120))\u010a\u010a", "\u0120\u0120\u0120", "\u0120break"], "input_token_weights": [0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.7833854580549265, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7833854580549265, 0.5749858371565393, 0.8357386476069529]} +{"problem_id": "p03253", "input": "from collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:\n\n\t\treturn [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn //= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:\n\n\t\tret.append(n)\n\n\treturn ret\n\n\n\nn,m = list(map(int,input().split()))\n\nmod = 10**9+7\n\nif m==1:\n\n\tprint((1));exit()\n\n\n\nfactors = Counter(factorization(m))\n\nmx = n+max(factors.values())\n\n\n\nfac = [1]*(mx+1)\n\ninv = [1]*(mx+1)\n\nfor i in range(1,mx+1):\n\n\tfac[i] = fac[i-1] * i % mod\n\ninv[-1] = pow(fac[-1], mod - 2, mod)\n\nfor i in range(mx-1, -1, -1):\n\n\tinv[i] = inv[i+1] * (i+1) % mod\n\ndef cmb(n,r):\n\n\tassert n >= r >= 0\n\n\treturn fac[n] * inv[n-r] * inv[r] % mod\n\n\t\n\nans=1\n\nfor v in list(factors.values()):\n\n\tans*=cmb(n+v-1,v)\n\n\tans%=mod\n\n\n\nprint(ans)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "def", "\u0120factor", "ization", "(n", ")", "\u0120->", "\u0120list", ":\u010a\u010a", "\u0109if", "\u0120n", "==", "1", ":\u010a\u010a", "\u0109", "\u0109return", "\u0120[", "1", "]\u010a\u010a", "\u0109ret", "\u0120=", "\u0120[]\u010a\u010a", "\u0109i", "\u0120=", "\u0120", "2", "\u010a\u010a", "\u0109while", "\u0120i", "*i", "<=", "n", ":\u010a\u010a", "\u0109", "\u0109while", "\u0120n", "%i", "==", "0", ":\u010a\u010a", "\u0109\u0109", "\u0109n", "\u0120//=", "\u0120i", "\u010a\u010a", "\u0109\u0109", "\u0109ret", ".append", "(i", ")\u010a\u010a", "\u0109", "\u0109i", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0109if", "\u0120n", "!=", "1", ":\u010a\u010a", "\u0109", "\u0109ret", ".append", "(n", ")\u010a\u010a", "\u0109return", "\u0120ret", "\u010a\u010a\u010a\u010a", "n", ",m", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "if", "\u0120m", "==", "1", ":\u010a\u010a", "\u0109print", "((", "1", "));", "exit", "()\u010a\u010a\u010a\u010a", "f", "actors", "\u0120=", "\u0120Counter", "(factor", "ization", "(m", "))\u010a\u010a", "mx", "\u0120=", "\u0120n", "+", "max", "(f", "actors", ".values", "())\u010a\u010a", "\u010a\u010a", "fac", "\u0120=", "\u0120[", "1", "]*(", "mx", "+", "1", ")\u010a\u010a", "inv", "\u0120=", "\u0120[", "1", "]*(", "mx", "+", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",m", "x", "+", "1", "):\u010a\u010a", "\u0109f", "ac", "[i", "]", "\u0120=", "\u0120fac", "[i", "-", "1", "]", "\u0120*", "\u0120i", "\u0120%", "\u0120mod", "\u010a\u010a", "inv", "[-", "1", "]", "\u0120=", "\u0120pow", "(f", "ac", "[-", "1", "],", "\u0120mod", "\u0120-", "\u0120", "2", ",", "\u0120mod", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(mx", "-", "1", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0109", "inv", "[i", "]", "\u0120=", "\u0120inv", "[i", "+", "1", "]", "\u0120*", "\u0120(", "i", "+", "1", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "def", "\u0120cmb", "(n", ",r", "):\u010a\u010a", "\u0109assert", "\u0120n", "\u0120>=", "\u0120r", "\u0120>=", "\u0120", "0", "\u010a\u010a", "\u0109return", "\u0120fac", "[n", "]", "\u0120*", "\u0120inv", "[n", "-r", "]", "\u0120*", "\u0120inv", "[r", "]", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0109\u010a\u010a", "ans", "=", "1", "\u010a\u010a", "for", "\u0120v", "\u0120in", "\u0120list", "(f", "actors", ".values", "())", ":\u010a\u010a", "\u0109ans", "*=", "cmb", "(n", "+v", "-", "1", ",v", ")\u010a\u010a", "\u0109ans", "%=", "mod", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7640031686476719, 0.8889473014940781, 0.8284253466378658, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02725", "input": "K, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\ndiff = A[0] + K - A[-1]\n\nans = A[-1] - A[0]\n\nfor i in range(1, N):\n\n dist = K - A[i] + A[i - 1]\n\n if dist < ans:\n\n ans = dist\n\n\n\nprint(ans)\n", "input_tokens": ["K", ",", "\u0120N", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "diff", "\u0120=", "\u0120A", "[", "0", "]", "\u0120+", "\u0120K", "\u0120-", "\u0120A", "[-", "1", "]\u010a\u010a", "ans", "\u0120=", "\u0120A", "[-", "1", "]", "\u0120-", "\u0120A", "[", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120dist", "\u0120=", "\u0120K", "\u0120-", "\u0120A", "[i", "]", "\u0120+", "\u0120A", "[i", "\u0120-", "\u0120", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dist", "\u0120<", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120dist", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03371", "input": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = float('inf')\n\n for i in range(0, max(X, Y)*2+1, 2):\n\n ans = min(A*max(X-i//2, 0)+B*max(Y-i//2, 0)+C*i, ans)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120lambda", ":", "\u0120sys", ".stdin", ".readline", "().", "rstrip", "()", "\u0120\u010a\u010a\u010a\u010a", "def", "\u0120resolve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120max", "(X", ",", "\u0120Y", ")*", "2", "+", "1", ",", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(A", "*", "max", "(X", "-i", "//", "2", ",", "\u0120", "0", ")+", "B", "*", "max", "(Y", "-i", "//", "2", ",", "\u0120", "0", ")+", "C", "*i", ",", "\u0120ans", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120resolve", "()\u010a"], "input_token_weights": [0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7100393521462953, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6569022703191485, 0.5714954628602014, 0.6569022703191485, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6569022703191485, 0.5714954628602014, 0.6569022703191485, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p03416", "input": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n i = str(i)\n\n if i[0] == i[4]:\n\n if i[1] == i[3]:\n\n ans += 1\n\n else:\n\n ans += 0\n\n else:\n\n ans += 0\n\nprint(ans)", "input_tokens": ["A", ",B", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(A", ",B", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "[", "0", "]", "\u0120==", "\u0120i", "[", "4", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "[", "1", "]", "\u0120==", "\u0120i", "[", "3", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "0", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03568", "input": "def main():\n\n N = int(input())\n\n A = [int(i) for i in input().split()]\n\n if N == 1:\n\n return print(1 if A[0] % 2 == 0 else 2)\n\n ans = 0\n\n d = (-1, 0, 1)\n\n from itertools import product\n\n for i in product(range(3), repeat=N):\n\n cur = 1\n\n for j in range(N):\n\n cur *= (A[j] + d[i[j]])\n\n if cur % 2 == 0:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120N", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120print", "(", "1", "\u0120if", "\u0120A", "[", "0", "]", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", "\u0120else", "\u0120", "2", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120(-", "1", ",", "\u0120", "0", ",", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120from", "\u0120itertools", "\u0120import", "\u0120product", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120product", "(range", "(", "3", "),", "\u0120repeat", "=N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120*=", "\u0120(", "A", "[j", "]", "\u0120+", "\u0120d", "[i", "[j", "]])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cur", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.7084208560793558, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p03425", "input": "# -*- coding: utf-8 -*-\n\nfrom collections import defaultdict\n\nfrom itertools import combinations\n\nN = int(input())\n\nC = [0, 0, 0, 0, 0, 0]\n\nD = defaultdict(int)\n\nfor i, m in enumerate(\"MARCH\", start=1):\n\n D[m] = i\n\n\n\nfor _ in range(N):\n\n C[D[input()[0]]] += 1\n\n\n\nans = 0\n\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n\n ans += C[a]*C[b]*C[c]\n\nprint(ans)", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120combinations", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "C", "\u0120=", "\u0120[", "0", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "]\u010a\u010a", "D", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "for", "\u0120i", ",", "\u0120m", "\u0120in", "\u0120enumerate", "(\"", "M", "ARCH", "\",", "\u0120start", "=", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120D", "[m", "]", "\u0120=", "\u0120i", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "[D", "[input", "()[", "0", "]]", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120combinations", "(list", "(range", "(", "1", ",", "\u0120", "6", ")),", "\u0120r", "=", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120C", "[a", "]*", "C", "[b", "]*", "C", "[c", "]\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.911283254435702, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.7060506397782503, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\n\n\nprint((math.factorial(N) % (1000000000 + 7)))\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(N", ")", "\u0120%", "\u0120(", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "\u0120+", "\u0120", "7", ")))\u010a"], "input_token_weights": [0.89427190936908, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.8170167109432965]} +{"problem_id": "p03309", "input": "def main():\n\n from statistics import median\n\n\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n m = int(median(a))\n\n\n\n ans = sum([abs(x - m) for x in a])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120from", "\u0120statistics", "\u0120import", "\u0120median", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120*", "a", ",", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120[", "x", "\u0120-", "\u0120i", "\u0120for", "\u0120i", ",", "\u0120x", "\u0120in", "\u0120enumerate", "(a", ",", "\u0120", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120int", "(m", "edian", "(a", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120sum", "([", "abs", "(x", "\u0120-", "\u0120m", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120a", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8922045961188434, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031]} +{"problem_id": "p03037", "input": "N, M = list(map(int, input().split()))\n\nL, R = [], []\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n", "input_tokens": ["N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", ",", "\u0120R", "\u0120=", "\u0120[],", "\u0120[]\u010a\u010a", "low", "\u0120=", "\u0120-", "float", "('", "INF", "')\u010a\u010a", "high", "\u0120=", "\u0120float", "('", "INF", "')\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ",", "\u0120r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", ".append", "(l", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", ".append", "(r", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120>", "\u0120low", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120low", "\u0120=", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120<", "\u0120high", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120high", "\u0120=", "\u0120r", "\u010a\u010a", "print", "((", "max", "(", "0", ",", "\u0120high", "\u0120-", "\u0120low", "\u0120+", "\u0120", "1", ")))\u010a"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8778749353275308]} +{"problem_id": "p02555", "input": "a,b,c=1,0,0\n\nexec('a,b,c=b,c,(a+c)%(10**9+7);'*(int(input())-2))\n\nprint(c)", "input_tokens": ["a", ",b", ",c", "=", "1", ",", "0", ",", "0", "\u010a\u010a", "exec", "('", "a", ",b", ",c", "=b", ",c", ",(", "a", "+c", ")", "%(", "1", "0", "**", "9", "+", "7", ");", "'", "*(", "int", "(input", "())", "-", "2", "))\u010a\u010a", "print", "(c", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\n\n\nz = max(x,y) * 2\n\nmin_sum = c * z\n\n\n\nfor i in range(z):\n\n r = max(0, y - i) * b\n\n t = max(0, x - i) * a\n\n sum = c * i * 2 + r + t\n\n if sum < min_sum:\n\n min_sum = sum\n\n\n\nprint(min_sum)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "z", "\u0120=", "\u0120max", "(x", ",y", ")", "\u0120*", "\u0120", "2", "\u010a\u010a", "min", "_sum", "\u0120=", "\u0120c", "\u0120*", "\u0120z", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(z", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120max", "(", "0", ",", "\u0120y", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120max", "(", "0", ",", "\u0120x", "\u0120-", "\u0120i", ")", "\u0120*", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "\u0120=", "\u0120c", "\u0120*", "\u0120i", "\u0120*", "\u0120", "2", "\u0120+", "\u0120r", "\u0120+", "\u0120t", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120sum", "\u0120<", "\u0120min", "_sum", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120min", "_sum", "\u0120=", "\u0120sum", "\u010a\u010a\u010a\u010a", "print", "(min", "_sum", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03796", "input": "N = int(input())\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120n", "\u0120in", "\u0120range", "(", "2", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120a", "*n", "\u0120%", "\u0120(", "1", "0", "**", "9", "+", "7", ")\u010a\u010a", "print", "(a", ")"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.8691775287719905, 0.833611120734537, 0.833611120734537]} +{"problem_id": "p03170", "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom operator import xor\n\nfrom functools import reduce\n\n\n\nN,K,*A = list(map(int,read().split()))\n\n\n\na = reduce(xor,(1<= 3600:\n\n h=S//3600\n\n m=S%3600//60\n\n s=S%60\n\nelif 3600 > S >= 60:\n\n h=0\n\n m=S//60\n\n s=S%60\n\nelse:\n\n h=m=0\n\n s=S\n\nprint(h, m, s, sep=\":\")\n", "input_tokens": ["S", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "if", "\u0120S", "\u0120>=", "\u0120", "3", "6", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", "=S", "//", "3", "6", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "=S", "%", "3", "6", "0", "0", "//", "6", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=S", "%", "6", "0", "\u010a\u010a", "elif", "\u0120", "3", "6", "0", "0", "\u0120>", "\u0120S", "\u0120>=", "\u0120", "6", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "=S", "//", "6", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=S", "%", "6", "0", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", "=m", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=S", "\u010a\u010a", "print", "(h", ",", "\u0120m", ",", "\u0120s", ",", "\u0120sep", "=\"", ":\")\u010a"], "input_token_weights": [0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.883057299767519, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.883057299767519, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.8408263201236497, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.7967329450848046, 0.7967329450848046, 0.8408263201236497, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.7967329450848046]} +{"problem_id": "p03806", "input": "def main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1<<30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(400, -1, -1):\n\n\t\t\tfor j in range(400, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\nif __name__==\"__main__\":\n\n\tmain()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0109n", ",", "\u0120ma", ",", "\u0120mb", ",", "\u0120*", "L", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))\u010a\u010a", "\u0109M", "\u0120=", "\u0120", "1", "<<", "3", "0", "\u010a\u010a", "\u0109dp", "\u0120=", "\u0120[[", "M", "]", "\u0120*", "\u0120", "4", "2", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "4", "2", "0", ")]\u010a\u010a", "\u0109dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0109for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120zip", "(*", "[", "iter", "(L", ")]", "\u0120*", "\u0120", "3", "):\u010a\u010a", "\u0109", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "0", "0", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0109\u0109", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(", "4", "0", "0", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0109\u0109\u0109", "\u0109t", "\u0120=", "\u0120dp", "[i", "][", "j", "]", "\u0120+", "\u0120c", "\u010a\u010a", "\u0109\u0109\u0109", "\u0109if", "\u0120dp", "[i", "\u0120+", "\u0120a", "][", "j", "\u0120+", "\u0120b", "]", "\u0120>", "\u0120t", ":\u010a\u010a", "\u0109\u0109\u0109\u0109", "\u0109dp", "[i", "\u0120+", "\u0120a", "][", "j", "\u0120+", "\u0120b", "]", "\u0120=", "\u0120t", "\u010a\u010a", "\u0109ans", "\u0120=", "\u0120M", "\u010a\u010a", "\u0109", "_ma", ",", "\u0120_", "mb", "\u0120=", "\u0120ma", ",", "\u0120mb", "\u010a\u010a", "\u0109while", "\u0120_", "ma", "\u0120<", "\u0120", "4", "1", "0", "\u0120>", "\u0120_", "mb", ":\u010a\u010a", "\u0109", "\u0109ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120dp", "[_", "ma", "][_", "mb", "])\u010a\u010a", "\u0109", "\u0109", "_ma", "\u0120+=", "\u0120ma", "\u010a\u010a", "\u0109", "\u0109", "_mb", "\u0120+=", "\u0120mb", "\u010a\u010a", "\u0109print", "((", "ans", "\u0120if", "\u0120ans", "\u0120<", "\u0120M", "\u0120else", "\u0120-", "1", "))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "==\"", "__", "main", "__", "\":\u010a\u010a", "\u0109main", "()"], "input_token_weights": [0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.6838237134005932, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.808526270355906, 0.8981772421402056, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.808526270355906, 0.5714954628602014, 0.5714954628602014, 0.7355852514485495, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.7100393521462953, 0.5714954628602014, 0.5714954628602014, 0.5714954628602014, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.5714954628602014, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8543560820723151]} +{"problem_id": "p03434", "input": "_,s=open(c:=0)\n\nfor a in sorted(map(int,s.split())):c=a-c\n\nprint(c)", "input_tokens": ["_,", "s", "=open", "(c", ":=", "0", ")\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120sorted", "(map", "(int", ",s", ".split", "()))", ":", "c", "=a", "-c", "\u010a\u010a", "print", "(c", ")"], "input_token_weights": [0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.7332896764791028, 0.6419065217751312, 0.8170167109432965, 0.89427190936908, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965]} +{"problem_id": "p03854", "input": "s = input()\n\nt = \"\"\n\nwhile len(t) < len(s):\n\n target_len = len(s) - len(t)\n\n\n\n if s[len(t)] == 'd':\n\n if target_len == 5:\n\n t += \"dream\"\n\n elif target_len == 7:\n\n t += \"dreamer\"\n\n elif target_len > 7:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 7 + 1] != \"era\":\n\n t += \"dreamer\"\n\n else:\n\n t += \"dream\"\n\n else:\n\n break\n\n else:\n\n if target_len == 5:\n\n t += \"erase\"\n\n elif target_len == 6:\n\n t += \"eraser\"\n\n elif target_len > 6:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 6 + 2] != \"era\":\n\n t += \"eraser\"\n\n else:\n\n t += \"erase\"\n\n else:\n\n break\n\n\n\n if s[0:len(t)] != t:\n\n break\n\n\n\nprint((\"YES\" if s == t else \"NO\"))\n", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a", "t", "\u0120=", "\u0120\"\"\u010a\u010a", "while", "\u0120len", "(t", ")", "\u0120<", "\u0120len", "(s", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120target", "_len", "\u0120=", "\u0120len", "(s", ")", "\u0120-", "\u0120len", "(t", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[len", "(t", ")]", "\u0120==", "\u0120'", "d", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120target", "_len", "\u0120==", "\u0120", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "dream", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120target", "_len", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "dream", "er", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120target", "_len", "\u0120>", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[len", "(t", ")", "\u0120+", "\u0120", "5", "]", "\u0120!=", "\u0120'", "d", "'", "\u0120and", "\u0120s", "[len", "(t", ")", "\u0120+", "\u0120", "5", ":len", "(t", ")", "\u0120+", "\u0120", "7", "\u0120+", "\u0120", "1", "]", "\u0120!=", "\u0120\"", "era", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "dream", "er", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "dream", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120target", "_len", "\u0120==", "\u0120", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "erase", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120target", "_len", "\u0120==", "\u0120", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "eras", "er", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120target", "_len", "\u0120>", "\u0120", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[len", "(t", ")", "\u0120+", "\u0120", "5", "]", "\u0120!=", "\u0120'", "d", "'", "\u0120and", "\u0120s", "[len", "(t", ")", "\u0120+", "\u0120", "5", ":len", "(t", ")", "\u0120+", "\u0120", "6", "\u0120+", "\u0120", "2", "]", "\u0120!=", "\u0120\"", "era", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "eras", "er", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120\"", "erase", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[", "0", ":len", "(t", ")]", "\u0120!=", "\u0120t", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "print", "((\"", "YES", "\"", "\u0120if", "\u0120s", "\u0120==", "\u0120t", "\u0120else", "\u0120\"", "NO", "\"))\u010a"], "input_token_weights": [0.9273515896195933, 0.9273515896195933, 0.9083337953965728, 0.8889473014940781, 0.9273515896195933, 0.9273515896195933, 0.9083337953965728, 0.9460144469641688, 0.9083337953965728, 0.8889473014940781, 0.8889473014940781, 0.9273515896195933, 0.9083337953965728, 0.8889473014940781, 0.9460144469641688, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8490090158852169, 0.8284253466378658, 0.8284253466378658, 0.8691775287719905, 0.8490090158852169, 0.8284253466378658, 0.8284253466378658, 0.5686609715453708, 0.9083337953965728, 0.8691775287719905, 0.8691775287719905, 0.8284253466378658, 0.8691775287719905, 0.8889473014940781, 0.8691775287719905, 0.8691775287719905, 0.9083337953965728, 0.5686609715453708, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.8490090158852169, 0.8691775287719905, 0.5686609715453708, 0.8074090697023789, 0.8074090697023789, 0.785941609719976, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.8490090158852169, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.5686609715453708, 0.8284253466378658, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.5686609715453708, 0.8490090158852169, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.5686609715453708, 0.8284253466378658, 0.8490090158852169, 0.5686609715453708, 0.8074090697023789, 0.741572616038919, 0.741572616038919, 0.6710943273460512, 0.6710943273460512, 0.7186273667339679, 0.5686609715453708, 0.7186273667339679, 0.741572616038919, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.785941609719976, 0.741572616038919, 0.741572616038919, 0.6464527786867319, 0.6464527786867319, 0.6951432441854742, 0.5686609715453708, 0.6951432441854742, 0.7186273667339679, 0.6211886504852411, 0.6211886504852411, 0.6710943273460512, 0.5686609715453708, 0.6710943273460512, 0.6951432441854742, 0.5686609715453708, 0.6951432441854742, 0.741572616038919, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.8074090697023789, 0.5686609715453708, 0.741572616038919, 0.741572616038919, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.5686609715453708, 0.7186273667339679, 0.7186273667339679, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.5686609715453708, 0.8490090158852169, 0.8490090158852169, 0.5686609715453708, 0.8074090697023789, 0.5686609715453708, 0.5686609715453708, 0.8889473014940781, 0.8889473014940781, 0.5686609715453708, 0.8490090158852169, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.5686609715453708, 0.8284253466378658, 0.8490090158852169, 0.5686609715453708, 0.785941609719976, 0.785941609719976, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.5686609715453708, 0.8284253466378658, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.5686609715453708, 0.8074090697023789, 0.8284253466378658, 0.5686609715453708, 0.7640031686476719, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.741572616038919, 0.5686609715453708, 0.8284253466378658, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.5686609715453708, 0.8074090697023789, 0.8284253466378658, 0.5686609715453708, 0.785941609719976, 0.7186273667339679, 0.7186273667339679, 0.6464527786867319, 0.6464527786867319, 0.6951432441854742, 0.5686609715453708, 0.6951432441854742, 0.7186273667339679, 0.741572616038919, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7640031686476719, 0.7186273667339679, 0.7186273667339679, 0.6211886504852411, 0.6211886504852411, 0.6710943273460512, 0.5686609715453708, 0.6710943273460512, 0.6951432441854742, 0.5952696660036803, 0.5952696660036803, 0.6464527786867319, 0.5686609715453708, 0.6464527786867319, 0.6710943273460512, 0.5686609715453708, 0.6710943273460512, 0.7186273667339679, 0.741572616038919, 0.7186273667339679, 0.7186273667339679, 0.785941609719976, 0.5686609715453708, 0.7186273667339679, 0.7186273667339679, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.5686609715453708, 0.7640031686476719, 0.7640031686476719, 0.5686609715453708, 0.6951432441854742, 0.6951432441854742, 0.6710943273460512, 0.6710943273460512, 0.6710943273460512, 0.5686609715453708, 0.8284253466378658, 0.8284253466378658, 0.5686609715453708, 0.785941609719976, 0.5686609715453708, 0.5686609715453708, 0.9083337953965728, 0.8691775287719905, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8074090697023789, 0.8691775287719905, 0.8889473014940781, 0.8889473014940781, 0.9083337953965728, 0.5686609715453708, 0.8691775287719905, 0.5686609715453708, 0.9273515896195933, 0.9083337953965728, 0.8490090158852169, 0.8490090158852169, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.9083337953965728]} +{"problem_id": "p00134", "input": "from statistics import mean\n\n\n\ninputCount = int(input())\n\nprices = [int(input()) for lp in range(inputCount)]\n\naverage = mean(prices)\n\nprint((int(average)))\n\n\n", "input_tokens": ["from", "\u0120statistics", "\u0120import", "\u0120mean", "\u010a\u010a\u010a\u010a", "input", "Count", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "prices", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120lp", "\u0120in", "\u0120range", "(input", "Count", ")]\u010a\u010a", "average", "\u0120=", "\u0120mean", "(pr", "ices", ")\u010a\u010a", "print", "((", "int", "(", "average", ")))\u010a\u010a\u010a"], "input_token_weights": [0.89427190936908, 0.8563901704123833, 0.89427190936908, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.8170167109432965]} +{"problem_id": "p03559", "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\nA = sorted(inpl())\n\nB = sorted(inpl())\n\nC = sorted(inpl())\n\ncnt = [0] * n\n\nres = 0\n\nfor i,b in enumerate(B):\n\n c = bisect.bisect_left(C,b+1)\n\n cnt[i] = n-c\n\n\n\nacc = [0]\n\nfor x in cnt:\n\n acc += [acc[-1] + x]\n\nsu = sum(cnt) \n\nfor i,a in enumerate(A):\n\n c = bisect.bisect_left(B,a+1)\n\n res += su - acc[c]\n\nprint(res)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", ",default", "dict", ",", "deque", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "op", ",", "he", "app", "ush", ",", "heap", "ify", "\u010a\u010a", "import", "\u0120sys", ",b", "is", "ect", ",", "math", ",it", "ertools", ",", "math", ",", "pp", "rint", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "8", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "def", "\u0120inp", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120in", "pl", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120inp", "()\u010a\u010a", "A", "\u0120=", "\u0120sorted", "(in", "pl", "())\u010a\u010a", "B", "\u0120=", "\u0120sorted", "(in", "pl", "())\u010a\u010a", "C", "\u0120=", "\u0120sorted", "(in", "pl", "())\u010a\u010a", "cnt", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120n", "\u010a\u010a", "res", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", ",b", "\u0120in", "\u0120enumerate", "(B", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_left", "(C", ",b", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "[i", "]", "\u0120=", "\u0120n", "-c", "\u010a\u010a\u010a\u010a", "acc", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120cnt", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120acc", "\u0120+=", "\u0120[", "acc", "[-", "1", "]", "\u0120+", "\u0120x", "]\u010a\u010a", "su", "\u0120=", "\u0120sum", "(cnt", ")", "\u0120\u010a\u010a", "for", "\u0120i", ",a", "\u0120in", "\u0120enumerate", "(A", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_left", "(B", ",a", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120+=", "\u0120su", "\u0120-", "\u0120acc", "[c", "]\u010a\u010a", "print", "(res", ")"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02552", "input": "x = int(input())\n\nprint((0 if x==1 else 1))", "input_tokens": ["x", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "0", "\u0120if", "\u0120x", "==", "1", "\u0120else", "\u0120", "1", "))"], "input_token_weights": [0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.7967329450848046, 0.7022465694939416, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7967329450848046]} +{"problem_id": "p02268", "input": "def binarySearch():\n\n n = int(input())\n\n S = set(map(int, input().split()))\n\n q = int(input())\n\n T = set(map(int, input().split()))\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()", "input_tokens": ["def", "\u0120binary", "Search", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120set", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120set", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "len", "(S", ".intersection", "(T", "))))\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a", "binary", "Search", "()"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308]} +{"problem_id": "p03416", "input": "a,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])\n\n str1=buf[0:int(len(buf)/2)]\n\n str2=buf[int(len(buf)/2+1):]\n\n if str1[0]==str2[1] and str1[1]==str2[0]:\n\n ans+=1\n\n\n\nprint(ans)\n", "input_tokens": ["a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "=", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120buf", "=str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "print", "(buf", "[", "0", ":int", "(len", "(buf", ")/", "2", ")],", "buf", "[int", "(len", "(buf", ")/", "2", "+", "1", "):", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120str", "1", "=", "buf", "[", "0", ":int", "(len", "(buf", ")/", "2", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120str", "2", "=", "buf", "[int", "(len", "(buf", ")/", "2", "+", "1", "):", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120str", "1", "[", "0", "]==", "str", "2", "[", "1", "]", "\u0120and", "\u0120str", "1", "[", "1", "]==", "str", "2", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7387330872699986, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03720", "input": "n, m = list(map(int, input().split()))\n\nRD = list(list(map(int, input().split())) for _ in range(m))\n\nfor i in range(1, n + 1):\n\n ans = 0\n\n for j in RD:\n\n ans += j.count(i)\n\n print(ans)", "input_tokens": ["n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "RD", "\u0120=", "\u0120list", "(list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(m", "))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120RD", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120j", ".count", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852]} +{"problem_id": "p03325", "input": "N = int(input())\n\nx = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in x:\n\n while i % 2 == 0:\n\n cnt += 1\n\n i /= 2\n\nprint(cnt)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "x", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120x", ":\u010a\u010a", "\u0120", "\u0120while", "\u0120i", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120/=", "\u0120", "2", "\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02649", "input": "def popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50 and j!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\nfor i in range(2**n):\n\n t=set([])\n\n for a in A:\n\n data[a&i]+=1\n\n t.add(a&i)\n\n temp=0\n\n for val in t:\n\n temp+=cmb[data[val]][min(K,data[val])]\n\n ans+=temp*(-1)**popcount(i)\n\n for val in t:\n\n data[val]=0\n\n\n\nprint(ans)\n", "input_tokens": ["def", "\u0120pop", "count", "(x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120x", "\u0120-", "\u0120((", "x", "\u0120>>", "\u0120", "1", ")", "\u0120&", "\u0120", "0", "x", "5", "5", "5", "5", "5", "5", "5", "5", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "\u0120&", "\u0120", "0", "x", "3", "3", "3", "3", "3", "3", "3", "3", ")", "\u0120+", "\u0120((", "x", "\u0120>>", "\u0120", "2", ")", "\u0120&", "\u0120", "0", "x", "3", "3", "3", "3", "3", "3", "3", "3", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "\u0120+", "\u0120(", "x", "\u0120>>", "\u0120", "4", "))", "\u0120&", "\u0120", "0", "x", "0", "f", "0", "f", "0", "f", "0", "f", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120x", "\u0120+", "\u0120(", "x", "\u0120>>", "\u0120", "8", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120x", "\u0120+", "\u0120(", "x", "\u0120>>", "\u0120", "1", "6", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120x", "\u0120&", "\u0120", "0", "x", "0", "0", "0", "0", "0", "0", "7", "f", "\u010a\u010a\u010a\u010a", "cmb", "=[[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "5", "1", ")]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "5", "1", ")]\u010a\u010a", "cmb", "[", "0", "][", "0", "]=", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "5", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "5", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "!=", "5", "0", "\u0120and", "\u0120j", "!=", "5", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cmb", "[i", "+", "1", "][", "j", "+", "1", "]+=", "cmb", "[i", "][", "j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "!=", "5", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cmb", "[i", "+", "1", "][", "j", "]+=", "cmb", "[i", "][", "j", "]\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "5", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "2", ",", "5", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cmb", "[i", "][", "j", "]+=", "cmb", "[i", "][", "j", "-", "1", "]\u010a\u010a\u010a\u010a", "N", ",K", ",T", ",S", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "must", "0", "=[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "8", ")", "\u0120if", "\u0120S", ">>", "i", "\u0120&", "1", "==", "0", "]\u010a\u010a", "must", "1", "=[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "8", ")", "\u0120if", "\u0120T", ">>", "i", "\u0120&", "1", "==", "1", "]\u010a\u010a\u010a\u010a", "A", "=[]", "\u010a\u010a", "for", "\u0120val", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120check", "=True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120must", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120check", "=", "check", "&(", "val", ">>", "j", "\u0120&", "1", "==", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120must", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120check", "=", "check", "&(", "val", ">>", "j", "\u0120&", "1", "==", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120check", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", ".append", "(val", ")\u010a\u010a\u010a\u010a", "if", "\u0120not", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "bit", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "8", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120not", "\u0120in", "\u0120must", "0", "\u0120and", "\u0120i", "\u0120not", "\u0120in", "\u0120must", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bit", ".append", "(i", ")\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(A", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120temp", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(bit", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", "+=(", "A", "[i", "]", ">>", "bit", "[j", "]", "\u0120&", "1", "==", "1", ")*", "2", "**", "j", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "[i", "]=", "temp", "\u010a\u010a\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "n", "=len", "(bit", ")\u010a\u010a", "data", "=[", "0", "]*(", "2", "**", "n", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "**", "n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "=set", "([]", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120data", "[a", "&", "i", "]+=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", ".add", "(a", "&", "i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120temp", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120val", "\u0120in", "\u0120t", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", "+=", "cmb", "[data", "[val", "]][", "min", "(K", ",data", "[val", "])", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "temp", "*(-", "1", ")**", "pop", "count", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120val", "\u0120in", "\u0120t", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120data", "[val", "]=", "0", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7387330872699986, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02814", "input": "import sys\n\nfrom math import gcd\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n A = list(set(map(int, input().split(\" \"))))\n\n A = [a // 2 for a in A]\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a)\n\n if semi_lcm > M:\n\n print((0))\n\n return\n\n\n\n for a in A:\n\n if semi_lcm // a % 2 == 0:\n\n print((0))\n\n return\n\n\n\n print(((M // semi_lcm + 1) // 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".readlines", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "\u0120<<", "\u0120", "6", "0", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120lcm", "(x", ",", "\u0120y", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120x", "\u0120*", "\u0120y", "\u0120//", "\u0120gcd", "(x", ",", "\u0120y", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120list", "(set", "(map", "(int", ",", "\u0120input", "().", "split", "(\"", "\u0120\"", "))))\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120[", "a", "\u0120//", "\u0120", "2", "\u0120for", "\u0120a", "\u0120in", "\u0120A", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120semi", "_l", "cm", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120semi", "_l", "cm", "\u0120=", "\u0120lcm", "(sem", "i", "_l", "cm", ",", "\u0120a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120semi", "_l", "cm", "\u0120>", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120semi", "_l", "cm", "\u0120//", "\u0120a", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "M", "\u0120//", "\u0120semi", "_l", "cm", "\u0120+", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.8922045961188434, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6339004969859428, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7453461554353482, 0.5731452134031394, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7453461554353482, 0.5731452134031394, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031]} +{"problem_id": "p03634", "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\ndef dfs(v,p,d):\n\n for i, j in tree[v]:\n\n if i != p:\n\n depth[i] = d + j\n\n dfs(i,v,d+j)\n\n\n\nN = int(input())\n\n\n\ntree = [[] for _ in range(N)]\n\n\n\nfor i in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n tree[a].append((b,c))\n\n tree[b].append((a,c))\n\n\n\nQ, K = list(map(int, input().split()))\n\n\n\ndepth = [0 for i in range(N)]\n\ndepth[K-1] = 0\n\n\n\ndfs(K-1,-1,0)\n\n\n\nfor _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n print((depth[x-1] + depth[y-1]))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "6", ")\u010a\u010a", "def", "\u0120dfs", "(v", ",p", ",d", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120j", "\u0120in", "\u0120tree", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120!=", "\u0120p", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120depth", "[i", "]", "\u0120=", "\u0120d", "\u0120+", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dfs", "(i", ",v", ",d", "+j", ")\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "tree", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tree", "[a", "].", "append", "((", "b", ",c", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120tree", "[b", "].", "append", "((", "a", ",c", "))", "\u010a\u010a\u010a\u010a", "Q", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "depth", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "depth", "[K", "-", "1", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "dfs", "(K", "-", "1", ",-", "1", ",", "0", ")\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(Q", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "depth", "[x", "-", "1", "]", "\u0120+", "\u0120depth", "[y", "-", "1", "]))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852]} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\n\n\npower = math.factorial(n)\n\n\n\nprint((power % (10**9 + 7)))\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "power", "\u0120=", "\u0120math", ".factor", "ial", "(n", ")\u010a\u010a\u010a\u010a", "print", "((", "power", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))\u010a"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p02883", "input": "#!/usr/bin/env python3\n\nimport sys\n\nINF = float(\"inf\")\n\nfrom bisect import bisect_left\n\n\n\n\n\ndef solve(N: int, K: int, A: \"List[int]\", F: \"List[int]\"):\n\n A.sort()\n\n F.sort(reverse=True)\n\n h = []\n\n for a, f in zip(A, F):\n\n h.append((a*f, a, f))\n\n h.sort()\n\n maxtime = h[-1][0]\n\n\n\n def isOK(y):\n\n i = bisect_left(h, (y+1, -1, -1))\n\n counter = 0\n\n # print(h[i:])\n\n for p, a, f in h[i:]:\n\n counter += a-y//f\n\n return counter <= K\n\n\n\n def binary_search(x):\n\n ng = -1\n\n ok = len(x)\n\n while abs(ok - ng) > 1:\n\n mid = (ok + ng)//2\n\n # print(\"mid: {}, in ({}, {})\".format(mid, ng, ok))\n\n if isOK(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n return ng, ok\n\n\n\n ng, ok = binary_search(list(range(maxtime)))\n\n print(ok)\n\n\n\n # while k > 0:\n\n # p1, a1, f1 = heapq.heappop(h)\n\n # p2, a2, f2 = heapq.heappop(h)\n\n # p1, p2 = -p1, -p2\n\n # sub = min(a1 - math.ceil((p2/f1)-1), k)\n\n # a1 -= sub\n\n # k -= sub\n\n # heapq.heappush(h, (-a1*f1, a1, f1))\n\n # heapq.heappush(h, (-a2*f2, a2, f2))\n\n # # print(h)\n\n # p, a, f = heapq.heappop(h)\n\n # print(-p)\n\n\n\n return\n\n\n\n\n\ndef main():\n\n\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n K = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n F = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, K, A, F)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "INF", "\u0120=", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "(N", ":", "\u0120int", ",", "\u0120K", ":", "\u0120int", ",", "\u0120A", ":", "\u0120\"", "List", "[int", "]\",", "\u0120F", ":", "\u0120\"", "List", "[int", "]\")", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120F", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", ",", "\u0120f", "\u0120in", "\u0120zip", "(A", ",", "\u0120F", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120h", ".append", "((", "a", "*f", ",", "\u0120a", ",", "\u0120f", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "time", "\u0120=", "\u0120h", "[-", "1", "][", "0", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120is", "OK", "(y", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120bis", "ect", "_left", "(h", ",", "\u0120(", "y", "+", "1", ",", "\u0120-", "1", ",", "\u0120-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120counter", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120print", "(h", "[i", ":", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120p", ",", "\u0120a", ",", "\u0120f", "\u0120in", "\u0120h", "[i", ":]", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120counter", "\u0120+=", "\u0120a", "-y", "//", "f", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120counter", "\u0120<=", "\u0120K", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120binary", "_search", "(x", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ng", "\u0120=", "\u0120-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ok", "\u0120=", "\u0120len", "(x", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120abs", "(ok", "\u0120-", "\u0120ng", ")", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mid", "\u0120=", "\u0120(", "ok", "\u0120+", "\u0120ng", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120print", "(\"", "mid", ":", "\u0120{},", "\u0120in", "\u0120({", "},", "\u0120{})", "\".", "format", "(mid", ",", "\u0120ng", ",", "\u0120ok", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120is", "OK", "(mid", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ok", "\u0120=", "\u0120mid", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ng", "\u0120=", "\u0120mid", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120ng", ",", "\u0120ok", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ng", ",", "\u0120ok", "\u0120=", "\u0120binary", "_search", "(list", "(range", "(max", "time", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ok", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120while", "\u0120k", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120p", "1", ",", "\u0120a", "1", ",", "\u0120f", "1", "\u0120=", "\u0120heapq", ".he", "app", "op", "(h", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120p", "2", ",", "\u0120a", "2", ",", "\u0120f", "2", "\u0120=", "\u0120heapq", ".he", "app", "op", "(h", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120p", "1", ",", "\u0120p", "2", "\u0120=", "\u0120-", "p", "1", ",", "\u0120-", "p", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120sub", "\u0120=", "\u0120min", "(a", "1", "\u0120-", "\u0120math", ".ceil", "((", "p", "2", "/f", "1", ")-", "1", "),", "\u0120k", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120a", "1", "\u0120-=", "\u0120sub", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120k", "\u0120-=", "\u0120sub", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(h", ",", "\u0120(-", "a", "1", "*f", "1", ",", "\u0120a", "1", ",", "\u0120f", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(h", ",", "\u0120(-", "a", "2", "*f", "2", ",", "\u0120a", "2", ",", "\u0120f", "2", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120#", "\u0120print", "(h", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120p", ",", "\u0120a", ",", "\u0120f", "\u0120=", "\u0120heapq", ".he", "app", "op", "(h", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(-", "p", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120iterate", "_tokens", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120line", "\u0120in", "\u0120sys", ".stdin", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120word", "\u0120in", "\u0120line", ".split", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120yield", "\u0120word", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tokens", "\u0120=", "\u0120iterate", "_tokens", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120K", "\u0120=", "\u0120int", "(next", "(tokens", "))", "\u0120", "\u0120#", "\u0120type", ":", "\u0120int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120[", "int", "(next", "(tokens", "))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u0120", "\u0120#", "\u0120type", ":", "\u0120\"", "List", "[int", "]", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120F", "\u0120=", "\u0120[", "int", "(next", "(tokens", "))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u0120", "\u0120#", "\u0120type", ":", "\u0120\"", "List", "[int", "]", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120solve", "(N", ",", "\u0120K", ",", "\u0120A", ",", "\u0120F", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8408263201236497, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.7186273667339679, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.8116478083709829, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.7186273667339679, 0.6514299043837268, 0.6514299043837268, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.7186273667339679, 0.781592256244883, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.7186273667339679, 0.781592256244883, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8116478083709829]} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "%(", "1", "0", "**", "9", "+", "7", ")))\u010a"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p03634", "input": "import heapq\n\n\n\nN = int(input())\n\nabc = [list(map(int,input().split())) for _ in range(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nxy = [list(map(int,input().split())) for _ in range(Q)]\n\n\n\nconnect = [[] for _ in range(N)]\n\nINFTY = 10**15\n\nfor a,b,c in abc:\n\n connect[a-1].append([b-1,c])\n\n connect[b-1].append([a-1,c])\n\n\n\ncost = [[INFTY,False] for _ in range(N)]\n\ncost[K-1][0] = 0\n\nq = [(0,K-1)]\n\nwhile q:\n\n _,i = heapq.heappop(q)\n\n if cost[i][1]:\n\n continue\n\n cost[i][1] = True\n\n ci0 = cost[i][0]\n\n for j,c in connect[i]:\n\n if cost[j][1]:\n\n continue\n\n tmp_cost = ci0+c\n\n if tmp_cost < cost[j][0]:\n\n cost[j][0] = tmp_cost\n\n heapq.heappush(q,(tmp_cost,j))\n\n\n\nfor x,y in xy:\n\n print((cost[x-1][0] + cost[y-1][0]))", "input_tokens": ["import", "\u0120heapq", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "abc", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "-", "1", ")]\u010a\u010a", "Q", ",K", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "xy", "\u0120=", "\u0120[", "list", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(Q", ")]", "\u010a\u010a\u010a\u010a", "connect", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "IN", "FT", "Y", "\u0120=", "\u0120", "1", "0", "**", "1", "5", "\u010a\u010a", "for", "\u0120a", ",b", ",c", "\u0120in", "\u0120abc", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120connect", "[a", "-", "1", "].", "append", "([", "b", "-", "1", ",c", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120connect", "[b", "-", "1", "].", "append", "([", "a", "-", "1", ",c", "])\u010a\u010a", "\u010a\u010a", "cost", "\u0120=", "\u0120[[", "IN", "FT", "Y", ",False", "]", "\u0120for", "\u0120_", "\u0120", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "cost", "[K", "-", "1", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "q", "\u0120=", "\u0120[(", "0", ",K", "-", "1", ")]\u010a\u010a", "while", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120_,", "i", "\u0120=", "\u0120heapq", ".he", "app", "op", "(q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cost", "[i", "][", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cost", "[i", "][", "1", "]", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ci", "0", "\u0120=", "\u0120cost", "[i", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", ",c", "\u0120in", "\u0120connect", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cost", "[j", "][", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "_cost", "\u0120=", "\u0120ci", "0", "+c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "_cost", "\u0120<", "\u0120cost", "[j", "][", "0", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cost", "[j", "][", "0", "]", "\u0120=", "\u0120tmp", "_cost", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",(", "tmp", "_cost", ",j", "))", "\u010a\u010a\u010a\u010a", "for", "\u0120x", ",y", "\u0120in", "\u0120xy", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "cost", "[x", "-", "1", "][", "0", "]", "\u0120+", "\u0120cost", "[y", "-", "1", "][", "0", "]))"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.7186273667339679, 0.7186273667339679, 0.8116478083709829]} +{"problem_id": "p03416", "input": "A,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(n):\n\n\tkey = 0\n\n\tfor i in range(1,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(B)-kaibun(A-1)))", "input_tokens": ["A", ",B", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120ka", "ib", "un", "(n", "):\u010a\u010a", "\u0109key", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0109", "\u0109if", "\u0120str", "(i", ")", "\u0120==", "\u0120str", "(i", ")[", "::-", "1", "]:\u010a\u010a", "\u0109\u0109", "\u0109key", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0109return", "\u0120key", "\u010a\u010a\u010a\u010a", "print", "((", "ka", "ib", "un", "(B", ")-", "ka", "ib", "un", "(A", "-", "1", ")))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.6951432441854742, 0.6588494518362031, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.8591441175808593]} +{"problem_id": "p02555", "input": "from sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n for x in range(3,i+1):\n\n if x in [i-1,i-2]:\n\n continue\n\n dp[i] += dp[i-x]\n\n return dp[s]%mod\n\nprint((solve()))", "input_tokens": ["from", "\u0120sys", "\u0120import", "\u0120stdin", "\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120int", "(stdin", ".readline", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120<", "\u0120", "3", ":", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[", "0", "]*(", "s", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",s", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(", "3", ",i", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120in", "\u0120[", "i", "-", "1", ",i", "-", "2", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[i", "-x", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120dp", "[s", "]%", "mod", "\u010a\u010a", "print", "((", "solve", "()))"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.7301658005010259, 0.582053818991329, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6588494518362031, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p02773", "input": "N = int(input())\n\ns_list = {}\n\nfor i in range(N):\n\n S = input()\n\n if S in list(s_list.keys()):\n\n s_list[S] += 1\n\n else:\n\n s_list[S] = 0\n\nmax = 0\n\nmaxs = []\n\nfor s,c in list(s_list.items()):\n\n if c > max:\n\n maxs = [s]\n\n max = c\n\n elif c == max:\n\n maxs.append(s)\n\nmaxs.sort()\n\nfor m in maxs:\n\n print(m)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "s", "_list", "\u0120=", "\u0120{}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120", "\u0120if", "\u0120S", "\u0120in", "\u0120list", "(s", "_list", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "_list", "[S", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "_list", "[S", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "max", "\u0120=", "\u0120", "0", "\u010a\u010a", "max", "s", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120s", ",c", "\u0120in", "\u0120list", "(s", "_list", ".items", "())", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120c", "\u0120>", "\u0120max", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "s", "\u0120=", "\u0120[", "s", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120", "\u0120elif", "\u0120c", "\u0120==", "\u0120max", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "s", ".append", "(s", ")\u010a\u010a", "max", "s", ".sort", "()\u010a\u010a", "for", "\u0120m", "\u0120in", "\u0120max", "s", ":\u010a\u010a", "\u0120", "\u0120print", "(m", ")"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.833611120734537, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994]} +{"problem_id": "p03796", "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "x", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(x", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p02730", "input": "S = input()\n\nN = len(S)\n\nleft = S[:int(N/2)]\n\nright = S[int((N+2)/2):]\n\nS_reversed = \"\".join(reversed(list(S)))\n\nleft_reversed = \"\".join(reversed(list(left)))\n\nright_reversed = \"\".join(reversed(list(right)))\n\n\n\nif S == S_reversed and left == left_reversed and right == right_reversed:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "input_tokens": ["S", "\u0120=", "\u0120input", "()\u010a\u010a", "N", "\u0120=", "\u0120len", "(S", ")\u010a\u010a", "left", "\u0120=", "\u0120S", "[:", "int", "(N", "/", "2", ")]\u010a\u010a", "right", "\u0120=", "\u0120S", "[int", "((", "N", "+", "2", ")/", "2", "):", "]\u010a\u010a", "S", "_re", "versed", "\u0120=", "\u0120\"\".", "join", "(re", "versed", "(list", "(S", ")))\u010a\u010a", "left", "_re", "versed", "\u0120=", "\u0120\"\".", "join", "(re", "versed", "(list", "(left", ")))\u010a\u010a", "right", "_re", "versed", "\u0120=", "\u0120\"\".", "join", "(re", "versed", "(list", "(right", "))", ")\u010a\u010a\u010a\u010a", "if", "\u0120S", "\u0120==", "\u0120S", "_re", "versed", "\u0120and", "\u0120left", "\u0120==", "\u0120left", "_re", "versed", "\u0120and", "\u0120right", "\u0120==", "\u0120right", "_re", "versed", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Yes", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "No", "\")"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.7433160191943734, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.7060506397782503, 0.7060506397782503, 0.8139227859741643, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6673426178365944, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6673426178365944, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6673426178365944, 0.7433160191943734, 0.8139227859741643, 0.911283254435702, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7792424376220217, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.7433160191943734]} +{"problem_id": "p03416", "input": "a,b=list(map(int,input().split()))\n\nans=0\n\nfor i in range(b+1)[a:]:\n\n if len(str(i))%2==0:\n\n p=list(str(i))[:len(str(i))//2]\n\n q=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if p==q:\n\n ans+=1\n\n else:\n\n s=list(str(i))[:len(str(i))//2+1]\n\n d=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if s==d:\n\n ans += 1\n\nprint(ans)", "input_tokens": ["a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(b", "+", "1", ")[", "a", ":]", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120len", "(str", "(i", "))", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "=list", "(str", "(i", "))", "[:", "len", "(str", "(i", "))", "//", "2", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "=list", "(re", "versed", "(list", "(str", "(i", "))[", "len", "(str", "(i", "))", "//", "2", ":]", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120p", "==", "q", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=list", "(str", "(i", "))", "[:", "len", "(str", "(i", "))", "//", "2", "+", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "=list", "(re", "versed", "(list", "(str", "(i", "))[", "len", "(str", "(i", "))", "//", "2", ":]", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "==", "d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9126878899009554, 0.9126878899009554, 0.9307708458268354, 0.89427190936908, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.89427190936908, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5674344985213602, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9126878899009554, 0.89427190936908, 0.8755104074345346, 0.8755104074345346, 0.9307708458268354, 0.9126878899009554, 0.9307708458268354, 0.9485326079935381, 0.5674344985213602, 0.9126878899009554, 0.8563901704123833, 0.8368972118255844, 0.7967329450848046, 0.8368972118255844, 0.8755104074345346, 0.8755104074345346, 0.89427190936908, 0.89427190936908, 0.9126878899009554, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.7967329450848046, 0.7548877618383746, 0.7967329450848046, 0.8368972118255844, 0.7760292149144611, 0.7548877618383746, 0.7112147970463693, 0.7548877618383746, 0.7967329450848046, 0.7967329450848046, 0.8368972118255844, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7967329450848046, 0.7760292149144611, 0.7112147970463693, 0.6655470550599784, 0.7548877618383746, 0.6886415962350058, 0.6655470550599784, 0.6176935537080551, 0.6655470550599784, 0.7112147970463693, 0.7112147970463693, 0.7548877618383746, 0.8170167109432965, 0.5674344985213602, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8755104074345346, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.7760292149144611, 0.7332896764791028, 0.7760292149144611, 0.8170167109432965, 0.7332896764791028, 0.7112147970463693, 0.6655470550599784, 0.7112147970463693, 0.7548877618383746, 0.7548877618383746, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.7967329450848046, 0.7760292149144611, 0.7548877618383746, 0.6886415962350058, 0.6419065217751312, 0.7332896764791028, 0.6655470550599784, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.6886415962350058, 0.6886415962350058, 0.7332896764791028, 0.7967329450848046, 0.5674344985213602, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.7967329450848046, 0.5674344985213602, 0.9307708458268354, 0.9126878899009554, 0.9126878899009554]} +{"problem_id": "p02814", "input": "import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\n \n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nfrom collections import defaultdict\n\n \n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n \n\n \n\nfrom functools import reduce\n\n# from math import *\n\nfrom math import *\n\nN, M = list(map(int, readline().split()))\n\nA = list(sorted([int(x) // 2 for x in readline().split()]))\n\nmin_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)\n\n \n\n# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))\n\nif not all([(min_cm // x) % 2 == 1 for x in A]):\n\n print((0))\n\n exit(0)\n\nif min_cm > M:\n\n print((0))\n\n exit(0)\n\nans = (M // min_cm + 1) // 2\n\nprint(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "import", "\u0120itertools", "\u010a\u010a", "#", "\u0120import", "\u0120numpy", "\u0120as", "\u0120np", "\u010a\u010a", "import", "\u0120time", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "\u0120\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "7", ")\u010a\u010a", "\u0120\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "\u0120\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readlines", "\u010a\u010a", "\u0120\u010a\u010a", "\u0120\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "#", "\u0120from", "\u0120math", "\u0120import", "\u0120*\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120*\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120readline", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "(sorted", "([", "int", "(x", ")", "\u0120//", "\u0120", "2", "\u0120for", "\u0120x", "\u0120in", "\u0120readline", "().", "split", "()]", "))\u010a\u010a", "min", "_cm", "\u0120=", "\u0120reduce", "(lambda", "\u0120a", ",", "\u0120b", ":", "\u0120(", "a", "\u0120*", "\u0120b", ")", "\u0120//", "\u0120gcd", "(a", ",", "\u0120b", "),", "\u0120A", ")\u010a\u010a", "\u0120\u010a\u010a", "#", "\u0120print", "(all", "(map", "(lambda", "\u0120x", ":", "\u0120(", "min", "_cm", "\u0120//", "\u0120x", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ",", "\u0120A", ")))\u010a\u010a", "if", "\u0120not", "\u0120all", "([(", "min", "_cm", "\u0120//", "\u0120x", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", "\u0120for", "\u0120x", "\u0120in", "\u0120A", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "if", "\u0120min", "_cm", "\u0120>", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "ans", "\u0120=", "\u0120(", "M", "\u0120//", "\u0120min", "_cm", "\u0120+", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7681534551894282, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p01093", "input": "while int(input()) > 0:\n\n s = sorted(map(int, input().split()))\n\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))", "input_tokens": ["while", "\u0120int", "(input", "())", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120sorted", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "min", "(abs", "(a", "\u0120-", "\u0120b", ")", "\u0120for", "\u0120(", "a", ",", "\u0120b", ")", "\u0120in", "\u0120zip", "(s", ",", "\u0120s", "[", "1", ":", "]))", "))"], "input_token_weights": [0.9328769136071888, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.6696615116992518, 0.6993277790098028, 0.6993277790098028, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7561438265913266, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.7561438265913266, 0.8357386476069529]} +{"problem_id": "p02814", "input": "# ABC150 D\n\nsi = lambda: input()\n\nni = lambda: int(input())\n\nnm = lambda: list(map(int, input().split()))\n\nnl = lambda: list(map(int, input().split()))\n\nfrom math import gcd\n\nfrom math import ceil\n\ndef lcm(x, y):\n\n return (x * y) // gcd(x, y)\n\nn,m=nm()\n\na=nl()\n\nans=0\n\na=[x//2 for x in a] \n\n\n\nlcm_v=a[0]\n\nfor i in range(n):\n\n lcm_v=lcm(lcm_v,a[i])\n\nok_flg=[(lcm_v//i)%2==1 for i in a]\n\nif all(ok_flg):\n\n ans=((m//lcm_v)+1)//2\n\nprint(ans)\n\n\n", "input_tokens": ["#", "\u0120ABC", "1", "5", "0", "\u0120D", "\u010a\u010a", "si", "\u0120=", "\u0120lambda", ":", "\u0120input", "()\u010a\u010a", "ni", "\u0120=", "\u0120lambda", ":", "\u0120int", "(input", "())\u010a\u010a", "nm", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "nl", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120ceil", "\u010a\u010a", "def", "\u0120lcm", "(x", ",", "\u0120y", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "x", "\u0120*", "\u0120y", ")", "\u0120//", "\u0120gcd", "(x", ",", "\u0120y", ")\u010a\u010a", "n", ",m", "=", "nm", "()\u010a\u010a", "a", "=", "nl", "()\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "a", "=[", "x", "//", "2", "\u0120for", "\u0120x", "\u0120in", "\u0120a", "]", "\u0120\u010a\u010a\u010a\u010a", "l", "cm", "_v", "=a", "[", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120lcm", "_v", "=l", "cm", "(l", "cm", "_v", ",a", "[i", "])\u010a\u010a", "ok", "_flg", "=[", "(", "l", "cm", "_v", "//", "i", ")%", "2", "==", "1", "\u0120for", "\u0120i", "\u0120in", "\u0120a", "]\u010a\u010a", "if", "\u0120all", "(ok", "_flg", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=((", "m", "//", "l", "cm", "_v", ")+", "1", ")//", "2", "\u010a\u010a", "print", "(ans", ")\u010a\u010a\u010a"], "input_token_weights": [0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.781592256244883, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02412", "input": "def main():\n\n\n\n while True:\n\n n, x = tuple(map(int, input().split()))\n\n pattern = 0\n\n\n\n if n == x == 0:\n\n break\n\n else:\n\n for a in range(1, n+1):\n\n for b in range(1, a):\n\n for c in range(1, b):\n\n pattern += 1 if a + b + c == x and a > b > c else 0\n\n print(pattern)\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", ",", "\u0120x", "\u0120=", "\u0120tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pattern", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120x", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120b", "\u0120in", "\u0120range", "(", "1", ",", "\u0120a", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120range", "(", "1", ",", "\u0120b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pattern", "\u0120+=", "\u0120", "1", "\u0120if", "\u0120a", "\u0120+", "\u0120b", "\u0120+", "\u0120c", "\u0120==", "\u0120x", "\u0120and", "\u0120a", "\u0120>", "\u0120b", "\u0120>", "\u0120c", "\u0120else", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(pattern", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5652845444887389, 0.5652845444887389, 0.9202622330629227, 0.9202622330629227, 0.9202622330629227, 0.5652845444887389, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8691775287719905, 0.8515524375924506, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7584425223266994, 0.7584425223266994, 0.833611120734537, 0.5652845444887389, 0.8691775287719905, 0.8691775287719905, 0.5652845444887389, 0.8691775287719905, 0.5652845444887389, 0.5652845444887389, 0.8864973487791334, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5652845444887389, 0.8691775287719905, 0.8864973487791334, 0.5652845444887389, 0.8515524375924506, 0.5652845444887389, 0.5652845444887389, 0.8691775287719905, 0.8691775287719905, 0.5652845444887389, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.8153420232571196, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7777709920703102, 0.7777709920703102, 0.7777709920703102, 0.833611120734537, 0.5652845444887389, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7777709920703102, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.5652845444887389, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7387330872699986, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.5652845444887389, 0.6981090974271096, 0.6981090974271096, 0.5652845444887389, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.5886835746651548, 0.5886835746651548, 0.6115475853143139, 0.6115475853143139, 0.6339004969859428, 0.6339004969859428, 0.6557646610251396, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.5652845444887389, 0.6771609938949378, 0.5652845444887389, 0.5652845444887389, 0.8153420232571196, 0.7967329450848046, 0.7967329450848046, 0.5652845444887389, 0.5652845444887389, 0.9529241888335975, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9202622330629227, 0.9202622330629227, 0.9202622330629227, 0.9529241888335975, 0.5652845444887389, 0.9035222925783293, 0.8864973487791334]} +{"problem_id": "p03416", "input": "A, B = list(map(int, input().split()))\n\nnumbers = list(range(A, B+1))\n\ncount = 0\n\nfor i in numbers:\n\n m = str(i)\n\n rm = ''.join(list(reversed(m)))\n\n if m == rm:\n\n count += 1\n\nprint(count)", "input_tokens": ["A", ",", "\u0120B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "numbers", "\u0120=", "\u0120list", "(range", "(A", ",", "\u0120B", "+", "1", "))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120numbers", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120rm", "\u0120=", "\u0120''.", "join", "(list", "(re", "versed", "(m", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120m", "\u0120==", "\u0120rm", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6588494518362031, 0.6211886504852411, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02863", "input": "import sys\n\nfrom operator import itemgetter\n\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return input()\n\n\n\nN, T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort(key=itemgetter(0))\n\n#print(ab)\n\n\n\ndp = [[0]*(T+1+3000+1) for _ in range(N+1)]\n\nans = 0\n\nfor i in range(N):\n\n for j in range(T+1+3000+1):\n\n time, deli = ab[i]\n\n if 0 <= j-time < T:\n\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n\n else:\n\n dp[i + 1][j] = dp[i][j]\n\n ans = max(ans, dp[i + 1][j])\n\nprint(ans)\n\n\n\n#print(dp)\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "from", "\u0120operator", "\u0120import", "\u0120item", "getter", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120heap", "ify", ",", "\u0120he", "app", "op", ",", "\u0120he", "app", "ush", "\u010a\u010a", "MAX", "_INT", "\u0120=", "\u0120int", "(", "1", "0", "e", "1", "5", ")\u010a\u010a", "MIN", "_INT", "\u0120=", "\u0120-", "MAX", "_INT", "\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", "0", ")\u010a\u010a", "def", "\u0120IL", "():", "\u0120return", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "def", "\u0120SL", "():", "\u0120return", "\u0120input", "().", "split", "()\u010a\u010a", "def", "\u0120I", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120S", "():", "\u0120return", "\u0120input", "()\u010a\u010a\u010a\u010a", "N", ",", "\u0120T", "\u0120=", "\u0120IL", "()\u010a\u010a", "ab", "\u0120=", "\u0120[", "IL", "()", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "ab", ".sort", "(key", "=item", "getter", "(", "0", "))\u010a\u010a", "#print", "(ab", ")\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[[", "0", "]*(", "T", "+", "1", "+", "3", "0", "0", "0", "+", "1", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "+", "1", ")]\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(T", "+", "1", "+", "3", "0", "0", "0", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120time", ",", "\u0120del", "i", "\u0120=", "\u0120ab", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "\u0120<=", "\u0120j", "-time", "\u0120<", "\u0120T", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "\u0120+", "\u0120", "1", "][", "j", "]", "\u0120=", "\u0120max", "(dp", "[i", "][", "j", "],", "\u0120dp", "[i", "][", "j", "\u0120-", "\u0120time", "]", "\u0120+", "\u0120del", "i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "\u0120+", "\u0120", "1", "][", "j", "]", "\u0120=", "\u0120dp", "[i", "][", "j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120dp", "[i", "\u0120+", "\u0120", "1", "][", "j", "])\u010a\u010a", "print", "(ans", ")\u010a\u010a\u010a\u010a", "#print", "(dp", ")\u010a"], "input_token_weights": [0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.8854867975141383, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7561438265913266, 0.7833854580549265, 0.8357386476069529, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.860922050467044, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.8357386476069529, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6696615116992518, 0.5749858371565393, 0.6696615116992518, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.6993277790098028, 0.6993277790098028, 0.6696615116992518, 0.5749858371565393, 0.6696615116992518, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933]} +{"problem_id": "p02599", "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/\n\n# Python3 code to find number of\n\n# distinct numbers in a subarray\n\nMAX = 1000001\n\n\n\n# structure to store queries\n\nclass Query:\n\n def __init__(self, l, r, idx):\n\n self.l = l\n\n self.r = r\n\n self.idx = idx\n\n\n\n\n\n# updating the bit array\n\ndef update(idx, val, bit, n):\n\n while idx <= n:\n\n bit[idx] += val\n\n idx += idx & -idx\n\n\n\n\n\n# querying the bit array\n\ndef query(idx, bit, n):\n\n summ = 0\n\n while idx:\n\n summ += bit[idx]\n\n idx -= idx & -idx\n\n return summ\n\n\n\n\n\ndef answeringQueries(arr, n, queries, q):\n\n\n\n # initialising bit array\n\n bit = [0] * (n + 1)\n\n\n\n # holds the rightmost index of\n\n # any number as numbers of a[i]\n\n # are less than or equal to 10^6\n\n last_visit = [-1] * MAX\n\n\n\n # answer for each query\n\n ans = [0] * q\n\n\n\n query_counter = 0\n\n for i in range(n):\n\n\n\n # If last visit is not -1 update -1 at the\n\n # idx equal to last_visit[arr[i]]\n\n if last_visit[arr[i]] != -1:\n\n update(last_visit[arr[i]] + 1, -1, bit, n)\n\n\n\n # Setting last_visit[arr[i]] as i and\n\n # updating the bit array accordingly\n\n last_visit[arr[i]] = i\n\n update(i + 1, 1, bit, n)\n\n\n\n # If i is equal to r of any query store answer\n\n # for that query in ans[]\n\n while query_counter < q and queries[query_counter].r == i:\n\n ans[queries[query_counter].idx] = query(queries[query_counter].r + 1, bit, n) - query(\n\n queries[query_counter].l, bit, n\n\n )\n\n query_counter += 1\n\n\n\n # print answer for each query\n\n for i in range(q):\n\n print((ans[i]))\n\n\n\n\n\n# This code is contributed by\n\n# sanjeev2552\n\n\n\n\n\ndef main():\n\n N, Q = list(map(int, readline().split()))\n\n C = list(map(int, readline().split()))\n\n (*LR,) = list(map(int, read().split()))\n\n\n\n queries = [0] * Q\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n queries[i] = Query(l - 1, r - 1, i)\n\n\n\n queries.sort(key=lambda x: x.r)\n\n answeringQueries(C, N, queries, Q)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".readlines", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "9", ")\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "\u0120<<", "\u0120", "6", "0", "\u010a\u010a", "MOD", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a\u010a\u010a", "#", "\u0120Reference", ":", "\u0120https", "://", "www", ".ge", "eks", "forge", "eks", ".org", "/", "queries", "-number", "-dist", "inct", "-elements", "-sub", "array", "/\u010a\u010a", "#", "\u0120Python", "3", "\u0120code", "\u0120to", "\u0120find", "\u0120number", "\u0120of", "\u010a\u010a", "#", "\u0120distinct", "\u0120numbers", "\u0120in", "\u0120a", "\u0120sub", "array", "\u010a\u010a", "MAX", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "1", "\u010a\u010a\u010a\u010a", "#", "\u0120structure", "\u0120to", "\u0120store", "\u0120queries", "\u010a\u010a", "class", "\u0120Query", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120l", ",", "\u0120r", ",", "\u0120idx", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".l", "\u0120=", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".r", "\u0120=", "\u0120r", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".idx", "\u0120=", "\u0120idx", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120updating", "\u0120the", "\u0120bit", "\u0120array", "\u010a\u010a", "def", "\u0120update", "(idx", ",", "\u0120val", ",", "\u0120bit", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120idx", "\u0120<=", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bit", "[idx", "]", "\u0120+=", "\u0120val", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120idx", "\u0120+=", "\u0120idx", "\u0120&", "\u0120-", "idx", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120querying", "\u0120the", "\u0120bit", "\u0120array", "\u010a\u010a", "def", "\u0120query", "(idx", ",", "\u0120bit", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120summ", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120idx", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120summ", "\u0120+=", "\u0120bit", "[idx", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120idx", "\u0120-=", "\u0120idx", "\u0120&", "\u0120-", "idx", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120summ", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120answering", "Queries", "(arr", ",", "\u0120n", ",", "\u0120queries", ",", "\u0120q", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120initial", "ising", "\u0120bit", "\u0120array", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120bit", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120holds", "\u0120the", "\u0120right", "most", "\u0120index", "\u0120of", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120any", "\u0120number", "\u0120as", "\u0120numbers", "\u0120of", "\u0120a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120are", "\u0120less", "\u0120than", "\u0120or", "\u0120equal", "\u0120to", "\u0120", "1", "0", "^", "6", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120last", "_visit", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120MAX", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120answer", "\u0120for", "\u0120each", "\u0120query", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120q", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120query", "_counter", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120If", "\u0120last", "\u0120visit", "\u0120is", "\u0120not", "\u0120-", "1", "\u0120update", "\u0120-", "1", "\u0120at", "\u0120the", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120idx", "\u0120equal", "\u0120to", "\u0120last", "_visit", "[arr", "[i", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120last", "_visit", "[arr", "[i", "]]", "\u0120!=", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120update", "(last", "_visit", "[arr", "[i", "]]", "\u0120+", "\u0120", "1", ",", "\u0120-", "1", ",", "\u0120bit", ",", "\u0120n", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120Setting", "\u0120last", "_visit", "[arr", "[i", "]]", "\u0120as", "\u0120i", "\u0120and", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120updating", "\u0120the", "\u0120bit", "\u0120array", "\u0120accordingly", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120last", "_visit", "[arr", "[i", "]]", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120update", "(i", "\u0120+", "\u0120", "1", ",", "\u0120", "1", ",", "\u0120bit", ",", "\u0120n", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120If", "\u0120i", "\u0120is", "\u0120equal", "\u0120to", "\u0120r", "\u0120of", "\u0120any", "\u0120query", "\u0120store", "\u0120answer", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120for", "\u0120that", "\u0120query", "\u0120in", "\u0120ans", "[]", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120query", "_counter", "\u0120<", "\u0120q", "\u0120and", "\u0120queries", "[", "query", "_counter", "].", "r", "\u0120==", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "[", "queries", "[", "query", "_counter", "].", "idx", "]", "\u0120=", "\u0120query", "(", "queries", "[", "query", "_counter", "].", "r", "\u0120+", "\u0120", "1", ",", "\u0120bit", ",", "\u0120n", ")", "\u0120-", "\u0120query", "(\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120queries", "[", "query", "_counter", "].", "l", ",", "\u0120bit", ",", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120)\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120query", "_counter", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "\u0120answer", "\u0120for", "\u0120each", "\u0120query", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(q", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "ans", "[i", "]))", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120This", "\u0120code", "\u0120is", "\u0120contributed", "\u0120by", "\u010a\u010a", "#", "\u0120san", "jee", "v", "2", "5", "5", "2", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120Q", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120readline", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120readline", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120(*", "LR", ",)", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120read", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120queries", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120Q", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120(", "l", ",", "\u0120r", ")", "\u0120in", "\u0120enumerate", "(zip", "(*", "[", "iter", "(L", "R", ")]", "\u0120*", "\u0120", "2", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120queries", "[i", "]", "\u0120=", "\u0120Query", "(l", "\u0120-", "\u0120", "1", ",", "\u0120r", "\u0120-", "\u0120", "1", ",", "\u0120i", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120queries", ".sort", "(key", "=lambda", "\u0120x", ":", "\u0120x", ".r", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120answering", "Queries", "(C", ",", "\u0120N", ",", "\u0120queries", ",", "\u0120Q", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a\u010a\u010a"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.8922045961188434, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.7967329450848046, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6911750402874859, 0.7186273667339679, 0.5731452134031394, 0.7186273667339679, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7713695892187169, 0.7186273667339679, 0.6911750402874859, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.5731452134031394, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7453461554353482, 0.7186273667339679, 0.6911750402874859, 0.5731452134031394, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.5731452134031394, 0.6911750402874859, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.7967329450848046, 0.5731452134031394, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7186273667339679, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031]} +{"problem_id": "p02596", "input": "k = int(input())\n\nnum = 0\n\nif not k%2:\n\n print((-1))\n\nelse:\n\n for i in range(k):\n\n num = (num*10+7)%k\n\n if num == 0:\n\n print((i+1))\n\n break\n\n else:\n\n print((-1))", "input_tokens": ["k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "num", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120not", "\u0120k", "%", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120(", "num", "*", "1", "0", "+", "7", ")%", "k", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120num", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "i", "+", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "1", "))"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7084208560793558, 0.6448923330239924, 0.7084208560793558]} +{"problem_id": "p02596", "input": "k = int(input())\n\ncount = 1\n\nn = 0\n\nif k % 2 == 0 or k % 5 == 0:\n\n print((-1))\n\nelse:\n\n while 1:\n\n n = (n * 10 + 7) % k \n\n if n == 0:\n\n break \n\n count += 1\n\n print(count)", "input_tokens": ["k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "count", "\u0120=", "\u0120", "1", "\u010a\u010a", "n", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120k", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", "\u0120or", "\u0120k", "\u0120%", "\u0120", "5", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120while", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120(", "n", "\u0120*", "\u0120", "1", "0", "\u0120+", "\u0120", "7", ")", "\u0120%", "\u0120k", "\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120print", "(count", ")"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.579389560544, 0.6514299043837268, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883]} +{"problem_id": "p03250", "input": "a, b, c = sorted(map(int, input().split()))\n\n\n\nprint((c*10 + b + a))", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120sorted", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "print", "((", "c", "*", "1", "0", "\u0120+", "\u0120b", "\u0120+", "\u0120a", "))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(200005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "0", "0", "0", "0", "5", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120i", "\u0120*", "\u0120", "2", "\u0120*", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120max", "(", "0", ",", "\u0120x", "-i", ")", "\u0120*", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120max", "(", "0", ",", "\u0120y", "-i", ")", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120tmp", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03568", "input": "N = int(input())\n\nAs = list(map(int,input().split()))\n\n\n\n\n\ndef dfs(A_s, index,Bss):\n\n if index == N:\n\n tmp = 1\n\n for b in Bss:\n\n tmp *= b\n\n return 1 if tmp % 2 == 0 else 0\n\n b_mi = Bss.copy()\n\n b_mi.append(A_s[index] - 1)\n\n\n\n b = Bss.copy()\n\n b.append(A_s[index])\n\n\n\n b_pl = Bss.copy()\n\n b_pl.append(A_s[index] + 1)\n\n return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)\n\n\n\n\n\nprint((dfs(As,0,[])))\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "As", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120dfs", "(A", "_s", ",", "\u0120index", ",B", "ss", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120index", "\u0120==", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120b", "\u0120in", "\u0120B", "ss", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120*=", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "1", "\u0120if", "\u0120tmp", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", "\u0120else", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_mi", "\u0120=", "\u0120B", "ss", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_mi", ".append", "(A", "_s", "[index", "]", "\u0120-", "\u0120", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120B", "ss", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ".append", "(A", "_s", "[index", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_pl", "\u0120=", "\u0120B", "ss", ".copy", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_pl", ".append", "(A", "_s", "[index", "]", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120dfs", "(A", "_s", ",index", "\u0120+", "\u0120", "1", ",", "\u0120b", "_mi", ")", "\u0120+", "\u0120dfs", "(A", "_s", ",index", "\u0120+", "\u0120", "1", ",b", ")", "\u0120+", "\u0120dfs", "(A", "_s", ",index", "\u0120+", "\u0120", "1", ",b", "_pl", ")\u010a\u010a\u010a\u010a\u010a\u010a", "print", "((", "dfs", "(", "As", ",", "0", ",", "[]", ")))\u010a"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.8591441175808593, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.8591441175808593]} +{"problem_id": "p03796", "input": "import math\n\nn=int(input())\n\nprint((math.factorial(n)%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p02555", "input": "from sys import stdin\n\nfrom math import factorial\n\n\n\n\n\ndef combinations_count(n, r):\n\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n _in = [_.rstrip() for _ in stdin.readlines()]\n\n S = int(_in[0]) # type:int\n\n # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n\n min_ = 1\n\n max_ = S // 3\n\n ans = 0\n\n for i in range(min_, max_ + 1):\n\n mod = S - i * 3\n\n ans += combinations_with_replacement_count(mod + 1, i - 1) % (10**9 + 7)\n\n ans %= (10**9 + 7)\n\n # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["from", "\u0120sys", "\u0120import", "\u0120stdin", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120combinations", "_count", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120factorial", "(n", ")", "\u0120//", "\u0120(", "factor", "ial", "(n", "\u0120-", "\u0120r", ")", "\u0120*", "\u0120factorial", "(r", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120combinations", "_with", "_re", "placement", "_count", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120combinations", "_count", "(n", "\u0120+", "\u0120r", "\u0120-", "\u0120", "1", ",", "\u0120r", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120_", "in", "\u0120=", "\u0120[", "_.", "rstrip", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120stdin", ".readlines", "()]\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120int", "(_", "in", "[", "0", "])", "\u0120", "\u0120#", "\u0120type", ":int", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120v", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "vv", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120min", "_", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "_", "\u0120=", "\u0120S", "\u0120//", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(min", "_,", "\u0120max", "_", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120S", "\u0120-", "\u0120i", "\u0120*", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120combinations", "_with", "_re", "placement", "_count", "(mod", "\u0120+", "\u0120", "1", ",", "\u0120i", "\u0120-", "\u0120", "1", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120%=", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^^^", "^^", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6211886504852411, 0.582053818991329, 0.6211886504852411, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.582053818991329, 0.6211886504852411, 0.6588494518362031, 0.7301658005010259, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.582053818991329, 0.6588494518362031, 0.6951432441854742, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046]} +{"problem_id": "p03801", "input": "n = int(input())\n\na = list(map(int, input().split()))\n\n\n\ntmp = [[e, n - i] for i, e in enumerate(a)]\n\ntmp.sort(reverse=True)\n\n\n\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\n\n\n\nv_prev, i_prev = aa[0]\n\ni = 0\n\nans = [0] * n\n\nsm = 0\n\nwhile i < n:\n\n while aa[i][1] >= i_prev:\n\n sm += aa[i][0]\n\n i += 1\n\n\n\n ans[i_prev] += sm - aa[i][0] * i\n\n sm = aa[i][0] * i\n\n v_prev, i_prev = aa[i]\n\n\n\nprint(*ans, sep=\"\\n\")\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "tmp", "\u0120=", "\u0120[[", "e", ",", "\u0120n", "\u0120-", "\u0120i", "]", "\u0120for", "\u0120i", ",", "\u0120e", "\u0120in", "\u0120enumerate", "(a", ")]\u010a\u010a", "tmp", ".sort", "(reverse", "=True", ")\u010a\u010a\u010a\u010a", "aa", "\u0120=", "\u0120[[", "e", ",", "\u0120n", "\u0120-", "\u0120i", "]", "\u0120for", "\u0120e", ",", "\u0120i", "\u0120in", "\u0120tmp", "]", "\u0120+", "\u0120[[", "0", ",", "\u0120-", "1", "]]", "\u010a\u010a\u010a\u010a", "v", "_prev", ",", "\u0120i", "_prev", "\u0120=", "\u0120aa", "[", "0", "]\u010a\u010a", "i", "\u0120=", "\u0120", "0", "\u010a\u010a", "ans", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120n", "\u010a\u010a", "sm", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120i", "\u0120<", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120aa", "[i", "][", "1", "]", "\u0120>=", "\u0120i", "_prev", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sm", "\u0120+=", "\u0120aa", "[i", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "[i", "_prev", "]", "\u0120+=", "\u0120sm", "\u0120-", "\u0120aa", "[i", "][", "0", "]", "\u0120*", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120sm", "\u0120=", "\u0120aa", "[i", "][", "0", "]", "\u0120*", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "_prev", ",", "\u0120i", "_prev", "\u0120=", "\u0120aa", "[i", "]\u010a\u010a\u010a\u010a", "print", "(*", "ans", ",", "\u0120sep", "=\"\\", "n", "\")\u010a"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p03013", "input": "N, M = list(map(int, input().split()))\n\nA_ = [int(input()) for _ in range(M)]\n\nA = [0] * (N+3)\n\nfor a in A_:\n\n A[a] = 1\n\ndp = [0] * (N+3)\n\ndp[0] = 1\n\n\n\nmod = 10**9+7\n\n\n\nfor i in range(1, N+1):\n\n if A[i-1] == 0:\n\n dp[i] += dp[i-1]\n\n if A[i-2] == 0:\n\n dp[i] += dp[i-2]\n\n dp[i] %= mod\n\nprint((dp[N]))", "input_tokens": ["N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "A", "_", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", ")]\u010a\u010a", "A", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "+", "3", ")\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120A", "_", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "[a", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "+", "3", ")\u010a\u010a", "dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120A", "[i", "-", "1", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[i", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120A", "[i", "-", "2", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[i", "-", "2", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120%=", "\u0120mod", "\u010a\u010a", "print", "((", "dp", "[N", "]))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p02792", "input": "n=int(input())\n\nD={}\n\nDD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n t=(str(i)[-1],str(i)[0])\n\n if s not in D:\n\n D[s]=1\n\n else:\n\n D[s]+=1\n\n if t not in DD:\n\n DD[t]=1\n\n else:\n\n DD[t]+=1\n\nans=0\n\nfor i in D:\n\n if i in DD:\n\n ans+=D[i]*DD[i]\n\nprint(ans)\n\n ", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "D", "={", "}\u010a\u010a", "DD", "={", "}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120", "\u0120s", "=(", "str", "(i", ")[", "0", "],", "str", "(i", ")[-", "1", "])\u010a\u010a", "\u0120\u0120", "\u0120t", "=(", "str", "(i", ")[-", "1", "],", "str", "(i", ")[", "0", "])\u010a\u010a", "\u0120\u0120", "\u0120if", "\u0120s", "\u0120not", "\u0120in", "\u0120D", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120D", "[s", "]=", "1", "\u010a\u010a", "\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120D", "[s", "]+=", "1", "\u010a\u010a", "\u0120\u0120", "\u0120if", "\u0120t", "\u0120not", "\u0120in", "\u0120DD", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120DD", "[t", "]=", "1", "\u010a\u010a", "\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120DD", "[t", "]+=", "1", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120D", ":\u010a\u010a", "\u0120\u0120", "\u0120if", "\u0120i", "\u0120in", "\u0120DD", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "+=", "D", "[i", "]*", "DD", "[i", "]\u010a\u010a", "print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.6771609938949378, 0.6339004969859428, 0.7186273667339679, 0.6771609938949378, 0.7584425223266994, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6339004969859428, 0.7186273667339679, 0.6771609938949378, 0.7584425223266994, 0.6771609938949378, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.5886835746651548]} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\nans = 0\n\n\n\nans =math.factorial(N) % (10**9 +7)\n\n\n\nprint(ans)", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "math", ".factor", "ial", "(N", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "7", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.883057299767519, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03078", "input": "X,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nalready = [[0,0,0]]\n\nx,y,z = 0,0,0\n\nplace_sum = []\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n place_sum.append([x + 1,y,z])\n\n check.append(asort[x + 1] + bsort[y] + csort[z])\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n place_sum.append([x,y + 1,z])\n\n check.append(asort[x] + bsort[y + 1] + csort[z])\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n place_sum.append([x,y,z + 1])\n\n check.append(asort[x] + bsort[y] + csort[z + 1])\n\n print((max(check)))\n\n x,y,z = place_sum[check.index(max(check))][0],place_sum[check.index(max(check))][1],place_sum[check.index(max(check))][2]\n\n place_sum.pop(check.index(max(check)))\n\n check.remove(max(check))", "input_tokens": ["X", ",Y", ",Z", ",K", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "B", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "C", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "as", "ort", ",", "bs", "ort", ",", "cs", "ort", "\u0120=", "\u0120sorted", "(A", ",", "reverse", "=True", "),", "sorted", "(B", ",", "reverse", "=True", "),", "sorted", "(C", ",", "reverse", "=True", ")\u010a\u010a", "print", "((", "as", "ort", "[", "0", "]", "\u0120+", "\u0120b", "sort", "[", "0", "]", "\u0120+", "\u0120c", "sort", "[", "0", "]))\u010a\u010a", "already", "\u0120=", "\u0120[[", "0", ",", "0", ",", "0", "]]\u010a\u010a", "x", ",y", ",z", "\u0120=", "\u0120", "0", ",", "0", ",", "0", "\u010a\u010a", "place", "_sum", "\u0120=", "\u0120[]\u010a\u010a", "check", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(K", "\u0120-", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120[", "x", "\u0120+", "\u0120", "1", ",y", ",z", "]", "\u0120not", "\u0120in", "\u0120already", "\u0120and", "\u0120x", "\u0120+", "\u0120", "1", "\u0120<", "\u0120X", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120already", ".append", "([", "x", "\u0120+", "\u0120", "1", ",y", ",z", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120place", "_sum", ".append", "([", "x", "\u0120+", "\u0120", "1", ",y", ",z", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120check", ".append", "(as", "ort", "[x", "\u0120+", "\u0120", "1", "]", "\u0120+", "\u0120b", "sort", "[y", "]", "\u0120+", "\u0120c", "sort", "[z", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120[", "x", ",y", "\u0120+", "\u0120", "1", ",z", "]", "\u0120not", "\u0120in", "\u0120already", "\u0120and", "\u0120y", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Y", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120already", ".append", "([", "x", ",y", "\u0120+", "\u0120", "1", ",z", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120place", "_sum", ".append", "([", "x", ",y", "\u0120+", "\u0120", "1", ",z", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120check", ".append", "(as", "ort", "[x", "]", "\u0120+", "\u0120b", "sort", "[y", "\u0120+", "\u0120", "1", "]", "\u0120+", "\u0120c", "sort", "[z", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120[", "x", ",y", ",z", "\u0120+", "\u0120", "1", "]", "\u0120not", "\u0120in", "\u0120already", "\u0120and", "\u0120z", "\u0120+", "\u0120", "1", "\u0120<", "\u0120Z", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120already", ".append", "([", "x", ",y", ",z", "\u0120+", "\u0120", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120place", "_sum", ".append", "([", "x", ",y", ",z", "\u0120+", "\u0120", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120check", ".append", "(as", "ort", "[x", "]", "\u0120+", "\u0120b", "sort", "[y", "]", "\u0120+", "\u0120c", "sort", "[z", "\u0120+", "\u0120", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "max", "(check", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",y", ",z", "\u0120=", "\u0120place", "_sum", "[", "check", ".index", "(max", "(check", "))", "][", "0", "],", "place", "_sum", "[", "check", ".index", "(max", "(check", "))", "][", "1", "],", "place", "_sum", "[", "check", ".index", "(max", "(check", "))", "][", "2", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120place", "_sum", ".pop", "(check", ".index", "(max", "(check", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120check", ".remove", "(max", "(check", "))"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8967470570581779, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.6514299043837268, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.8691775287719905, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.6514299043837268, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.8691775287719905, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.579389560544, 0.6514299043837268, 0.7506053018110229, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7186273667339679, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6160583186229708, 0.6855929667625797, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6160583186229708, 0.6855929667625797, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6160583186229708, 0.6855929667625797, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.7506053018110229, 0.8116478083709829]} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nn=max(x,y)\n\nfor i in range(1,n+1):\n\n ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))\n\nprint(ans)\n\n\n\n\n", "input_tokens": ["a", ",b", ",c", ",x", ",y", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "=a", "*x", "+b", "*y", "\u010a\u010a", "n", "=max", "(x", ",y", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120ans", "=min", "(ans", ",", "2", "*i", "*c", "+a", "*", "max", "(", "0", ",x", "-i", ")+", "b", "*", "max", "(", "0", ",y", "-i", "))\u010a\u010a", "print", "(ans", ")\u010a\u010a\u010a\u010a\u010a"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.7967329450848046, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03325", "input": "answer = 0\n\nN = int(input())\n\nA = list(map(int,input().split()))\n\nfor i in range(N) :\n\n while A[i] % 2 == 0 :\n\n A[i] = A[i] / 2\n\n answer += 1\n\nprint(answer)\n\n\n", "input_tokens": ["answer", "\u0120=", "\u0120", "0", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", ")", "\u0120:\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120A", "[i", "]", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", "\u0120:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "[i", "]", "\u0120=", "\u0120A", "[i", "]", "\u0120/", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120answer", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(answer", ")\u010a\u010a\u010a"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03034", "input": "import sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n for C in range(1, N//2):\n\n n = N // C\n\n point = 0\n\n used = set([0])\n\n for k in range(1, n):\n\n A = N - 1 - k*C\n\n\n\n if A in used or k*C in used or A == k*C:\n\n break\n\n used.add(A)\n\n used.add(k*C)\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120C", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "//", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120N", "\u0120//", "\u0120C", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120point", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120used", "\u0120=", "\u0120set", "([", "0", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120N", "\u0120-", "\u0120", "1", "\u0120-", "\u0120k", "*C", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120A", "\u0120in", "\u0120used", "\u0120or", "\u0120k", "*C", "\u0120in", "\u0120used", "\u0120or", "\u0120A", "\u0120==", "\u0120k", "*C", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120used", ".add", "(A", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120used", ".add", "(k", "*C", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120point", "\u0120+=", "\u0120S", "[A", "]", "\u0120+", "\u0120S", "[k", "*C", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120point", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ans", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "main", "()))\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7681534551894282, 0.5770524973423397, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852]} +{"problem_id": "p03038", "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(input())\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N,M=MI()\n\n A=LI()\n\n CB=[[0,0]for _ in range(M)]\n\n A.sort()\n\n for i in range(M):\n\n CB[i][1],CB[i][0]=MI()\n\n \n\n CB.sort(reverse=True)\n\n now=0\n\n \n\n for i in range(N):\n\n if CB[now][1]<=0:\n\n now+=1\n\n \n\n if now>=M:\n\n break \n\n \n\n ch=CB[now][0]\n\n if A[i]=", "M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ch", "=", "CB", "[now", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120A", "[i", "]<", "ch", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "[i", "]=", "ch", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120CB", "[now", "][", "1", "]-", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "sum", "(A", ")))\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a", "main", "()\u010a"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7186273667339679, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.8691775287719905]} +{"problem_id": "p03828", "input": "from math import factorial\n\n\n\nn = int(input())\n\nf = factorial(n)\n\n\n\nmod = 10 ** 9 + 7\n\n\n\ndef primes(n):\n\n is_prime = [True] * (n + 1)\n\n is_prime[0] = False\n\n is_prime[1] = False\n\n for i in range(2, int(n ** 0.5) + 1):\n\n if not is_prime[i]:\n\n continue\n\n for j in range(i * 2, n + 1, i):\n\n is_prime[j] = False\n\n return [i for i in range(n + 1) if is_prime[i]]\n\n\n\nans = 1\n\nfor p in primes(n):\n\n temp = 1\n\n while f % p == 0:\n\n temp += 1\n\n f //= p\n\n ans = (ans * temp) % mod\n\nprint(ans)\n", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "f", "\u0120=", "\u0120factorial", "(n", ")\u010a\u010a\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "def", "\u0120primes", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120is", "_prime", "\u0120=", "\u0120[", "True", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120is", "_prime", "[", "0", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120is", "_prime", "[", "1", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",", "\u0120int", "(n", "\u0120**", "\u0120", "0", ".", "5", ")", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120is", "_prime", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "\u0120*", "\u0120", "2", ",", "\u0120n", "\u0120+", "\u0120", "1", ",", "\u0120i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120is", "_prime", "[j", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "\u0120+", "\u0120", "1", ")", "\u0120if", "\u0120is", "_prime", "[i", "]]", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120primes", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120temp", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120f", "\u0120%", "\u0120p", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120//=", "\u0120p", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120(", "ans", "\u0120*", "\u0120temp", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7060506397782503, 0.6673426178365944, 0.6270757423345348, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.8474406118450124, 0.5851191688414608, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.7060506397782503, 0.5851191688414608, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.7060506397782503, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p02937", "input": "from collections import defaultdict\n\nfrom bisect import bisect_left\n\n\n\ns = input()\n\nn = len(s)\n\ns = s + s\n\nt = input()\n\nif set(t) - set(s):\n\n\tprint((-1))\n\n\texit()\n\nd = defaultdict(list)\n\nfor i in range(2 * n):\n\n\td[s[i]] += [i]\n\ncur = tot = 0\n\nfor c in t:\n\n\tx = d[c][bisect_left(d[c], cur)]\n\n\tif x < n:\n\n\t\tcur = x + 1\n\n\telse:\n\n\t\tcur = x - n + 1\n\n\t\ttot += n\n\ntot += cur\n\nprint(tot)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120input", "()\u010a\u010a", "n", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "s", "\u0120=", "\u0120s", "\u0120+", "\u0120s", "\u010a\u010a", "t", "\u0120=", "\u0120input", "()\u010a\u010a", "if", "\u0120set", "(t", ")", "\u0120-", "\u0120set", "(s", "):\u010a\u010a", "\u0109print", "((-", "1", "))\u010a\u010a", "\u0109exit", "()\u010a\u010a", "d", "\u0120=", "\u0120defaultdict", "(list", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "\u0120*", "\u0120n", "):\u010a\u010a", "\u0109d", "[s", "[i", "]]", "\u0120+=", "\u0120[", "i", "]\u010a\u010a", "cur", "\u0120=", "\u0120tot", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120c", "\u0120in", "\u0120t", ":\u010a\u010a", "\u0109x", "\u0120=", "\u0120d", "[c", "][", "bis", "ect", "_left", "(d", "[c", "],", "\u0120cur", ")]\u010a\u010a", "\u0109if", "\u0120x", "\u0120<", "\u0120n", ":\u010a\u010a", "\u0109", "\u0109cur", "\u0120=", "\u0120x", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0109else", ":\u010a\u010a", "\u0109", "\u0109cur", "\u0120=", "\u0120x", "\u0120-", "\u0120n", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0109", "\u0109t", "ot", "\u0120+=", "\u0120n", "\u010a\u010a", "tot", "\u0120+=", "\u0120cur", "\u010a\u010a", "print", "(t", "ot", ")\u010a"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.911283254435702, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.7792424376220217, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.7792424376220217, 0.7433160191943734, 0.7792424376220217, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.5851191688414608, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.7060506397782503, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p02996", "input": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\nab = [list(li()) for _ in range(n)]\n\n\n\nab.sort(key=lambda x: x[1])\n\n\n\ncur = 0\n\n\n\nans = True\n\n\n\nfor ai, bi in ab:\n\n cur += ai\n\n if cur > bi:\n\n ans = False\n\n\n\nprint((\"Yes\" if ans else \"No\"))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "stdin", "\u0120=", "\u0120sys", ".stdin", "\u010a\u010a\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "7", ")\u010a\u010a\u010a\u010a", "def", "\u0120li", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120li", "_", "():", "\u0120return", "\u0120[", "int", "(x", ")", "\u0120-", "\u0120", "1", "\u0120for", "\u0120x", "\u0120in", "\u0120stdin", ".readline", "().", "split", "()]\u010a\u010a", "def", "\u0120lf", "():", "\u0120return", "\u0120list", "(map", "(float", ",", "\u0120stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120ls", "():", "\u0120return", "\u0120stdin", ".readline", "().", "split", "()\u010a\u010a", "def", "\u0120ns", "():", "\u0120return", "\u0120stdin", ".readline", "().", "rstrip", "()\u010a\u010a", "def", "\u0120lc", "():", "\u0120return", "\u0120list", "(ns", "())\u010a\u010a", "def", "\u0120ni", "():", "\u0120return", "\u0120int", "(stdin", ".readline", "())\u010a\u010a", "def", "\u0120nf", "():", "\u0120return", "\u0120float", "(stdin", ".readline", "())\u010a\u010a", "\u010a\u010a", "n", "\u0120=", "\u0120ni", "()\u010a\u010a", "ab", "\u0120=", "\u0120[", "list", "(li", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "ab", ".sort", "(key", "=lambda", "\u0120x", ":", "\u0120x", "[", "1", "])\u010a\u010a", "\u010a\u010a", "cur", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "for", "\u0120ai", ",", "\u0120bi", "\u0120in", "\u0120ab", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120cur", "\u0120+=", "\u0120ai", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cur", "\u0120>", "\u0120bi", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120False", "\u010a\u010a\u010a\u010a", "print", "((\"", "Yes", "\"", "\u0120if", "\u0120ans", "\u0120else", "\u0120\"", "No", "\"))"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905]} +{"problem_id": "p03416", "input": "n, m = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n, m+1):\n\n if str(i)[0]+str(i)[1] == str(i)[-1]+str(i)[-2]: ans += 1\n\nprint(ans)", "input_tokens": ["n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", ",", "\u0120m", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120str", "(i", ")[", "0", "]+", "str", "(i", ")[", "1", "]", "\u0120==", "\u0120str", "(i", ")[-", "1", "]+", "str", "(i", ")[-", "2", "]:", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.7301658005010259, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.7301658005010259, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p00001", "input": "ans=[]\n\nfor i in range (0,10):\n\n ans.append(int(input()))\n\nans.sort(reverse=True)\n\nfor i in range (0,3):\n\n print((ans[i]))", "input_tokens": ["ans", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "\u0120(", "0", ",", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", ".append", "(int", "(input", "()))\u010a\u010a", "ans", ".sort", "(reverse", "=True", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "\u0120(", "0", ",", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "ans", "[i", "]))"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7060506397782503, 0.7792424376220217, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8474406118450124, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217]} +{"problem_id": "p02555", "input": "# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n cnt = 0\n\n\n\n for j in range(3, i+1):\n\n cnt += dp[i-j]\n\n cnt %= mod\n\n \n\n dp[i] = cnt\n\n\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-\u010a\u010a", "import", "\u0120sys", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120int", "(", "\u0120sys", ".stdin", ".readline", "()", "\u0120)\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[", "0", "]*(", "S", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",", "\u0120S", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", ",", "\u0120i", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120dp", "[i", "-j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120%=", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120=", "\u0120cnt", "\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dp", "[-", "1", "]))", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6588494518362031, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046]} +{"problem_id": "p02785", "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n if K>=N:\n\n return 0\n\n H.sort()\n\n ans = sum(H[:N-K])\n\n return ans\n\nprint((solve()))", "input_tokens": ["def", "\u0120solve", "():\u010a\u010a", "\u0120", "\u0120N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120H", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120if", "\u0120K", ">=", "N", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120H", ".sort", "()\u010a\u010a", "\u0120", "\u0120ans", "\u0120=", "\u0120sum", "(H", "[:", "N", "-K", "])\u010a\u010a", "\u0120", "\u0120return", "\u0120ans", "\u010a\u010a", "print", "((", "solve", "()))"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8778749353275308]} +{"problem_id": "p03835", "input": "k, s = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n if 0<=s-x-y<=k:\n\n ans += 1\n\n \n\nprint(ans)", "input_tokens": ["k", ",", "\u0120s", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "<=", "s", "-x", "-y", "<=", "k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03680", "input": "import sys\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(1e6):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120", "1", "\u010a\u010a", "p", "\u0120=", "\u0120a", "[", "0", "]", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "if", "\u0120a", "[", "0", "]", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(l", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a\u010a\u010a", "while", "\u0120l", "\u0120<", "\u0120int", "(", "1", "e", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[p", "]", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(l", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120a", "[p", "]", "\u0120-", "\u0120", "1", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.8474406118450124, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.5851191688414608, 0.911283254435702, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.7792424376220217, 0.7433160191943734, 0.6673426178365944, 0.7433160191943734]} +{"problem_id": "p03796", "input": "import math\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n power = math.factorial(N)\n\n print((power % (10 ** 9 + 7)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120power", "\u0120=", "\u0120math", ".factor", "ial", "(N", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "power", "\u0120%", "\u0120(", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", ")))\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.582053818991329, 0.6211886504852411, 0.6588494518362031, 0.582053818991329, 0.6588494518362031, 0.7967329450848046, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046]} +{"problem_id": "p02282", "input": "def post_from_pre_in(preorder_elements, inorder_elements):\n\n if preorder_elements:\n\n global cnt\n\n root = preorder_elements[0]\n\n root_index = inorder_elements.index(root)\n\n preorder_left = preorder_elements[1:root_index+1]\n\n inorder_left = inorder_elements[:root_index]\n\n preorder_right = preorder_elements[root_index+1:]\n\n inorder_right = inorder_elements[root_index+1:]\n\n post_from_pre_in(preorder_left, inorder_left)\n\n post_from_pre_in(preorder_right, inorder_right)\n\n if cnt:\n\n print(root, end = ' ')\n\n cnt -= 1\n\n else:\n\n print(root)\n\n\n\n\n\ncnt = int(input()) - 1\n\n\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\n\n\npost_from_pre_in(a, b)\n", "input_tokens": ["def", "\u0120post", "_from", "_pre", "_in", "(pre", "order", "_elements", ",", "\u0120inorder", "_elements", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120preorder", "_elements", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120global", "\u0120cnt", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120root", "\u0120=", "\u0120preorder", "_elements", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120root", "_index", "\u0120=", "\u0120inorder", "_elements", ".index", "(root", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120preorder", "_left", "\u0120=", "\u0120preorder", "_elements", "[", "1", ":", "root", "_index", "+", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inorder", "_left", "\u0120=", "\u0120inorder", "_elements", "[:", "root", "_index", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120preorder", "_right", "\u0120=", "\u0120preorder", "_elements", "[root", "_index", "+", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inorder", "_right", "\u0120=", "\u0120inorder", "_elements", "[root", "_index", "+", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120post", "_from", "_pre", "_in", "(pre", "order", "_left", ",", "\u0120inorder", "_left", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120post", "_from", "_pre", "_in", "(pre", "order", "_right", ",", "\u0120inorder", "_right", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cnt", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(root", ",", "\u0120end", "\u0120=", "\u0120'", "\u0120')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(root", ")\u010a\u010a\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120int", "(input", "())", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "post", "_from", "_pre", "_in", "(a", ",", "\u0120b", ")\u010a"], "input_token_weights": [0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7506053018110229, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.6855929667625797, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03078", "input": "def main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\td = [0]*x*y\n\n\tfor i in range(x):\n\n\t\tfor j in range(y):\n\n\t\t\td[i*y+j] = a[i]+b[j]\n\n\td.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\n\n\tc_len = min(k, z)\n\n\td_len = min(k, x*y)\n\n\te = [0]*d_len*c_len\n\n\tfor i in range(d_len):\n\n\t\tfor j in range(c_len):\n\n\t\t\te[i*c_len+j] = d[i] + c[j]\n\n\te.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((e[i]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0109x", ",", "\u0120y", ",", "\u0120z", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0109a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0109b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0109c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0109d", "\u0120=", "\u0120[", "0", "]*", "x", "*y", "\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(x", "):\u010a\u010a", "\u0109", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(y", "):\u010a\u010a", "\u0109\u0109", "\u0109d", "[i", "*y", "+j", "]", "\u0120=", "\u0120a", "[i", "]+", "b", "[j", "]\u010a\u010a", "\u0109d", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0109c", ".sort", "(reverse", "=True", ")\u010a\u010a\u010a\u010a", "\u0109c", "_len", "\u0120=", "\u0120min", "(k", ",", "\u0120z", ")\u010a\u010a", "\u0109d", "_len", "\u0120=", "\u0120min", "(k", ",", "\u0120x", "*y", ")\u010a\u010a", "\u0109e", "\u0120=", "\u0120[", "0", "]*", "d", "_len", "*c", "_len", "\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(d", "_len", "):\u010a\u010a", "\u0109", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(c", "_len", "):\u010a\u010a", "\u0109\u0109", "\u0109e", "[i", "*c", "_len", "+j", "]", "\u0120=", "\u0120d", "[i", "]", "\u0120+", "\u0120c", "[j", "]\u010a\u010a", "\u0109e", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0109for", "\u0120i", "\u0120in", "\u0120range", "(k", "):\u010a\u010a", "\u0109", "\u0109print", "((", "e", "[i", "]))", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.6448923330239924, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p00713", "input": "from math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) / d) / 2.0\n\n xc = (x1 + x2) / 2.0\n\n yc = (y1 + y2) / 2.0\n\n return [[xc - k*yd, yc + k*xd], [xc + k*yd, yc - k*xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = [list(map(float, input().split())) for i in range(n)]\n\n p.sort()\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - bx >= 2.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120sqrt", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u010a\u010a", "def", "\u0120circle", "_center", "(x", "1", ",", "\u0120y", "1", ",", "\u0120x", "2", ",", "\u0120y", "2", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120xd", "\u0120=", "\u0120x", "2", "\u0120-", "\u0120x", "1", ";", "\u0120y", "d", "\u0120=", "\u0120y", "2", "\u0120-", "\u0120y", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120xd", "**", "2", "\u0120+", "\u0120y", "d", "**", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120sqrt", "((", "4", ".", "0", "\u0120-", "\u0120d", ")", "\u0120/", "\u0120d", ")", "\u0120/", "\u0120", "2", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120xc", "\u0120=", "\u0120(", "x", "1", "\u0120+", "\u0120x", "2", ")", "\u0120/", "\u0120", "2", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120yc", "\u0120=", "\u0120(", "y", "1", "\u0120+", "\u0120y", "2", ")", "\u0120/", "\u0120", "2", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120[[", "xc", "\u0120-", "\u0120k", "*y", "d", ",", "\u0120yc", "\u0120+", "\u0120k", "*", "xd", "],", "\u0120[", "xc", "\u0120+", "\u0120k", "*y", "d", ",", "\u0120yc", "\u0120-", "\u0120k", "*", "xd", "]]\u010a\u010a", "while", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "==", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120[", "list", "(map", "(float", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bx", ",", "\u0120by", "\u0120=", "\u0120p", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120bx", "\u0120-", "\u0120p", "[", "prev", "][", "0", "]", "\u0120>=", "\u0120", "2", ".", "0", ":", "\u0120prev", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cx", ",", "\u0120cy", "\u0120=", "\u0120p", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cx", "\u0120-", "\u0120bx", "\u0120>=", "\u0120", "2", ".", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "bx", "\u0120-", "\u0120cx", ")**", "2", "\u0120+", "\u0120(", "by", "\u0120-", "\u0120cy", ")**", "2", "\u0120<=", "\u0120", "4", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120ex", ",", "\u0120ey", "\u0120in", "\u0120circle", "_center", "(b", "x", ",", "\u0120by", ",", "\u0120cx", ",", "\u0120cy", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(prev", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", "==", "i", "\u0120or", "\u0120k", "==", "j", ":", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dx", ",", "\u0120dy", "\u0120=", "\u0120p", "[k", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dx", "\u0120-", "\u0120bx", "\u0120>=", "\u0120", "2", ".", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "ex", "\u0120-", "\u0120dx", ")**", "2", "\u0120+", "\u0120(", "ey", "\u0120-", "\u0120dy", ")**", "2", "\u0120<=", "\u0120", "1", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120count", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9485326079935381, 0.9307708458268354, 0.9485326079935381, 0.9307708458268354, 0.5674344985213602, 0.9485326079935381, 0.9307708458268354, 0.9307708458268354, 0.9485326079935381, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5674344985213602, 0.9485326079935381, 0.9485326079935381, 0.9485326079935381, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9485326079935381, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.9307708458268354, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8368972118255844, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.9126878899009554, 0.89427190936908, 0.8563901704123833, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.89427190936908, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.89427190936908, 0.9485326079935381, 0.5674344985213602, 0.9485326079935381, 0.9485326079935381, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8755104074345346, 0.8563901704123833, 0.8563901704123833, 0.5674344985213602, 0.9126878899009554, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.9126878899009554, 0.8755104074345346, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.8755104074345346, 0.8563901704123833, 0.8368972118255844, 0.7967329450848046, 0.7967329450848046, 0.7332896764791028, 0.7548877618383746, 0.7548877618383746, 0.8368972118255844, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8368972118255844, 0.8170167109432965, 0.8755104074345346, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.5674344985213602, 0.89427190936908, 0.5674344985213602, 0.5674344985213602, 0.89427190936908, 0.89427190936908, 0.5674344985213602, 0.89427190936908, 0.5674344985213602, 0.5674344985213602, 0.9126878899009554, 0.9126878899009554, 0.9126878899009554, 0.89427190936908, 0.8755104074345346, 0.9126878899009554, 0.5674344985213602, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.8563901704123833, 0.8368972118255844, 0.8368972118255844, 0.8368972118255844, 0.5674344985213602, 0.8755104074345346, 0.8368972118255844, 0.8368972118255844, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.5674344985213602, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.8755104074345346, 0.8170167109432965, 0.8170167109432965, 0.5674344985213602, 0.8170167109432965, 0.5674344985213602, 0.5674344985213602, 0.8755104074345346, 0.8755104074345346, 0.8755104074345346, 0.8563901704123833, 0.8368972118255844, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.8368972118255844, 0.8755104074345346, 0.5674344985213602, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5674344985213602, 0.8368972118255844, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8170167109432965, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.7967329450848046, 0.5674344985213602, 0.5674344985213602, 0.8368972118255844, 0.7548877618383746, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7548877618383746, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5674344985213602, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8368972118255844, 0.5674344985213602, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7967329450848046, 0.5674344985213602, 0.7332896764791028, 0.7332896764791028, 0.5674344985213602, 0.7332896764791028, 0.5674344985213602, 0.5674344985213602, 0.7548877618383746, 0.7548877618383746, 0.7548877618383746, 0.7332896764791028, 0.7112147970463693, 0.7112147970463693, 0.7112147970463693, 0.7548877618383746, 0.5674344985213602, 0.7112147970463693, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.6886415962350058, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.7112147970463693, 0.6655470550599784, 0.5674344985213602, 0.5674344985213602, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.6886415962350058, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.5674344985213602, 0.7112147970463693, 0.6655470550599784, 0.6655470550599784, 0.6655470550599784, 0.6886415962350058, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7112147970463693, 0.6655470550599784, 0.5674344985213602, 0.5674344985213602, 0.7112147970463693, 0.6176935537080551, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6655470550599784, 0.6176935537080551, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.5674344985213602, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7112147970463693, 0.5674344985213602, 0.6419065217751312, 0.6419065217751312, 0.5674344985213602, 0.6419065217751312, 0.5674344985213602, 0.5674344985213602, 0.7332896764791028, 0.7332896764791028, 0.7112147970463693, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5674344985213602, 0.89427190936908, 0.8755104074345346, 0.8755104074345346]} +{"problem_id": "p03074", "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n _S = input()\n\n S = []\n\n b = _S[0]\n\n s = 0\n\n if b == '0': S.append(0)\n\n for _s in _S:\n\n if b == _s:\n\n s = s + 1\n\n else:\n\n b = _s\n\n S.append(s)\n\n s = 1\n\n S.append(s)\n\n if b == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n\n n = sum(S[0:num])\n\n m = n\n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n\n for i in range(0, len(S) - num, 2):\n\n n = n - sum(S[i:i+2])\n\n n = n + sum(S[i + num:i + num + 2])\n\n m = max(m, n)\n\n\n\n return m\n\n\n\nprint((solve()))", "input_tokens": ["def", "\u0120solve", "():\u010a\u010a", "\u0120", "\u0120N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120_", "S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120[]\u010a\u010a", "\u0120", "\u0120b", "\u0120=", "\u0120_", "S", "[", "0", "]\u010a\u010a", "\u0120", "\u0120s", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120if", "\u0120b", "\u0120==", "\u0120'", "0", "':", "\u0120S", ".append", "(", "0", ")\u010a\u010a", "\u0120", "\u0120for", "\u0120_", "s", "\u0120in", "\u0120_", "S", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120b", "\u0120==", "\u0120_", "s", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120s", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120_", "s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120S", ".append", "(s", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120S", ".append", "(s", ")\u010a\u010a", "\u0120", "\u0120if", "\u0120b", "\u0120==", "\u0120'", "0", "':", "\u0120S", ".append", "(", "0", ")\u010a\u010a\u010a\u010a", "\u0120", "\u0120num", "\u0120=", "\u0120min", "(len", "(S", "),", "\u0120", "2", "\u0120*", "\u0120K", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120", "\u0120#", "\u0120n", "\u0120=", "\u0120sum", "(S", "[", "0", ":num", "\u0120if", "\u0120_", "S", "[", "0", "]", "\u0120==", "\u0120'", "1", "'", "\u0120else", "\u0120(", "num", "\u0120-", "\u0120", "1", ")])\u010a\u010a", "\u0120", "\u0120n", "\u0120=", "\u0120sum", "(S", "[", "0", ":num", "])\u010a\u010a", "\u0120", "\u0120m", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120", "\u0120#", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", "\u0120if", "\u0120_", "S", "[", "0", "]", "\u0120==", "\u0120'", "1", "'", "\u0120else", "\u0120-", "1", ",", "\u0120len", "(S", ")", "\u0120-", "\u0120num", ",", "\u0120", "2", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120len", "(S", ")", "\u0120-", "\u0120num", ",", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120n", "\u0120-", "\u0120sum", "(S", "[i", ":i", "+", "2", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120n", "\u0120+", "\u0120sum", "(S", "[i", "\u0120+", "\u0120num", ":i", "\u0120+", "\u0120num", "\u0120+", "\u0120", "2", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120max", "(m", ",", "\u0120n", ")\u010a\u010a\u010a\u010a", "\u0120", "\u0120return", "\u0120m", "\u010a\u010a\u010a\u010a", "print", "((", "solve", "()))"], "input_token_weights": [0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.6696615116992518, 0.6993277790098028, 0.6993277790098028, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7561438265913266, 0.8099046207685895, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.7281392564472128, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.7281392564472128, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8854867975141383]} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\nans = math.factorial(N) % (10 ** 9 + 7)\n\nprint(ans)", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ans", "\u0120=", "\u0120math", ".factor", "ial", "(N", ")", "\u0120%", "\u0120(", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.883057299767519, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7506053018110229, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03371", "input": "#python3\n\nINF = int(1e9)\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF\n\n for i in range(2*10**5+100):\n\n t = 2*c*i + max(x-i, 0) * a + max(y-i, 0) * b\n\n ans = min(ans, t)\n\n print(ans)\n\nmain()", "input_tokens": ["#", "python", "3", "\u010a\u010a", "INF", "\u0120=", "\u0120int", "(", "1", "e", "9", ")\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120INF", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", "*", "1", "0", "**", "5", "+", "1", "0", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "2", "*c", "*i", "\u0120+", "\u0120max", "(x", "-i", ",", "\u0120", "0", ")", "\u0120*", "\u0120a", "\u0120+", "\u0120max", "(y", "-i", ",", "\u0120", "0", ")", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120t", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "main", "()"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.8778749353275308]} +{"problem_id": "p03828", "input": "from functools import reduce\n\nN = int(input())\n\n\n\nprime_table = [1] * (N+1)\n\n\n\nfor x in range(2, N+1):\n\n for t in range(2, x+1):\n\n while x % t == 0:\n\n prime_table[t] += 1\n\n x //= t\n\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))", "input_tokens": ["from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "prime", "_table", "\u0120=", "\u0120[", "1", "]", "\u0120*", "\u0120(", "N", "+", "1", ")\u010a\u010a\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "2", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120t", "\u0120in", "\u0120range", "(", "2", ",", "\u0120x", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120%", "\u0120t", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prime", "_table", "[t", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120//=", "\u0120t", "\u010a\u010a", "print", "((", "reduce", "(lambda", "\u0120x", ",", "\u0120y", ":", "\u0120x", "\u0120*", "\u0120y", "\u0120%", "\u0120(", "int", "(", "1", "e", "9", ")", "\u0120+", "\u0120", "7", "),", "\u0120prime", "_table", ")))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308]} +{"problem_id": "p03835", "input": "K,S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor i in range(K+1):\n\n\tfor j in range(K+1):\n\n\t\tif (S - i - j) <= K and (S-i-j) >= 0:\n\n\t\t\tans += 1\n\n\n\nprint(ans)\n", "input_tokens": ["K", ",S", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "(\"", "\u0120\"", ")))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0109for", "\u0120j", "\u0120in", "\u0120range", "(K", "+", "1", "):\u010a\u010a", "\u0109", "\u0109if", "\u0120(", "S", "\u0120-", "\u0120i", "\u0120-", "\u0120j", ")", "\u0120<=", "\u0120K", "\u0120and", "\u0120(", "S", "-i", "-j", ")", "\u0120>=", "\u0120", "0", ":\u010a\u010a", "\u0109\u0109", "\u0109ans", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02412", "input": "while 1:\n\n ans=0\n\n n,x=list(map(int,input().split()))\n\n if n:\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n for k in range(j+1,n+1):\n\n if i+j+k==x:ans+=1\n\n else:break\n\n print(ans)", "input_tokens": ["while", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",x", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(j", "+", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "+j", "+k", "==", "x", ":", "ans", "+=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":", "break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")"], "input_token_weights": [0.9367265554405826, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7967329450848046, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7453461554353482, 0.5731452134031394, 0.6911750402874859, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031]} +{"problem_id": "p02767", "input": "def main():\n\n from statistics import mean\n\n from math import floor,ceil\n\n\n\n n = int(input())\n\n x = list(map(int, input().split()))\n\n x_mean = mean(x) \n\n if x_mean == 0.5:\n\n greater_than_x = len([i for i in x if i > x_mean])\n\n if greater_than_x * 2 >= n:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n elif x_mean % 1 > 0.5:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n x2 = [(num - x_mean)**2 for num in x]\n\n print((sum(x2)))\n\n\n\nmain()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120", "\u0120from", "\u0120statistics", "\u0120import", "\u0120mean", "\u010a\u010a", "\u0120", "\u0120from", "\u0120math", "\u0120import", "\u0120floor", ",", "ceil", "\u010a\u010a\u010a\u010a", "\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120", "\u0120x", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120x", "_mean", "\u0120=", "\u0120mean", "(x", ")", "\u0120\u010a\u010a", "\u0120", "\u0120if", "\u0120x", "_mean", "\u0120==", "\u0120", "0", ".", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120greater", "_than", "_x", "\u0120=", "\u0120len", "([", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120x", "\u0120if", "\u0120i", "\u0120>", "\u0120x", "_mean", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120greater", "_than", "_x", "\u0120*", "\u0120", "2", "\u0120>=", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "_mean", "\u0120=", "\u0120ceil", "(x", "_mean", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "_mean", "\u0120=", "\u0120floor", "(x", "_mean", ")\u010a\u010a", "\u0120", "\u0120elif", "\u0120x", "_mean", "\u0120%", "\u0120", "1", "\u0120>", "\u0120", "0", ".", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120x", "_mean", "\u0120=", "\u0120ceil", "(x", "_mean", ")\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120x", "_mean", "\u0120=", "\u0120floor", "(x", "_mean", ")\u010a\u010a", "\u0120", "\u0120x", "2", "\u0120=", "\u0120[(", "num", "\u0120-", "\u0120x", "_mean", ")**", "2", "\u0120for", "\u0120num", "\u0120in", "\u0120x", "]\u010a\u010a", "\u0120", "\u0120print", "((", "sum", "(x", "2", "))", ")\u010a\u010a\u010a\u010a", "main", "()"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.8245182914059852, 0.9035222925783293, 0.8778749353275308]} +{"problem_id": "p03854", "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef solve():\n\n S = input()\n\n # print(S, len(S))\n\n\n\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n\n\n\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n\n\n def recur(i, w):\n\n if not TABLE[w][i] == -1:\n\n return TABLE[w][i]\n\n\n\n if i >= len(S):\n\n # print(\"jey\", log)\n\n return True\n\n\n\n r1, r2, r3, r4 = False, False, False, False\n\n if S[i:i + 5] == words[0]:\n\n r1 = recur(i + 5, 0)\n\n if S[i:i + 7] == words[1]:\n\n r2 = recur(i + 7, 1)\n\n if S[i:i + 5] == words[2]:\n\n r3 = recur(i + 5, 2)\n\n if S[i:i + 6] == words[3]:\n\n r4 = recur(i + 6, 3)\n\n\n\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n\n\n\n return TABLE[w][i]\n\n\n\n ans = recur(0, 0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "\u0120**", "\u0120", "6", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(S", ",", "\u0120len", "(S", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120words", "\u0120=", "\u0120{", "0", ":", "\u0120\"", "dream", "\",", "\u0120", "1", ":", "\u0120\"", "dream", "er", "\",", "\u0120", "2", ":", "\u0120\"", "erase", "\",", "\u0120", "3", ":", "\u0120\"", "eras", "er", "\"", "}\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120TABLE", "\u0120=", "\u0120[[", "-", "1", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(len", "(S", ")", "\u0120+", "\u0120", "1", ")]", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(len", "(words", ")", "\u0120+", "\u0120", "1", ")]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120recur", "(i", ",", "\u0120w", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120TABLE", "[w", "][", "i", "]", "\u0120==", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120TABLE", "[w", "][", "i", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120>=", "\u0120len", "(S", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120print", "(\"", "j", "ey", "\",", "\u0120log", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120True", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "1", ",", "\u0120r", "2", ",", "\u0120r", "3", ",", "\u0120r", "4", "\u0120=", "\u0120False", ",", "\u0120False", ",", "\u0120False", ",", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", ":i", "\u0120+", "\u0120", "5", "]", "\u0120==", "\u0120words", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "1", "\u0120=", "\u0120recur", "(i", "\u0120+", "\u0120", "5", ",", "\u0120", "0", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", ":i", "\u0120+", "\u0120", "7", "]", "\u0120==", "\u0120words", "[", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "2", "\u0120=", "\u0120recur", "(i", "\u0120+", "\u0120", "7", ",", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", ":i", "\u0120+", "\u0120", "5", "]", "\u0120==", "\u0120words", "[", "2", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "3", "\u0120=", "\u0120recur", "(i", "\u0120+", "\u0120", "5", ",", "\u0120", "2", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", ":i", "\u0120+", "\u0120", "6", "]", "\u0120==", "\u0120words", "[", "3", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "4", "\u0120=", "\u0120recur", "(i", "\u0120+", "\u0120", "6", ",", "\u0120", "3", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120TABLE", "[w", "][", "i", "]", "\u0120=", "\u0120r", "1", "\u0120or", "\u0120r", "2", "\u0120or", "\u0120r", "3", "\u0120or", "\u0120r", "4", "\u0120or", "\u0120False", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120TABLE", "[w", "][", "i", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120recur", "(", "0", ",", "\u0120", "0", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ans", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120solve", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120res", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "YES", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7387330872699986]} +{"problem_id": "p02773", "input": "from collections import defaultdict\n\n\n\nN = int(input())\n\nA = [input() for _ in range(N)]\n\nA.sort()\n\nd = defaultdict(int)\n\nfor a in A:\n\n d[a] += 1\n\n\n\nl = sorted(d.items())\n\nmax_v = 0\n\n\n\nfor _, v in l:\n\n if v > max_v:\n\n max_v = v\n\n \n\nfor k, v in l:\n\n if v == max_v:\n\n print(k)\n\n else:\n\n continue\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "input", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "A", ".sort", "()\u010a\u010a", "d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[a", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120sorted", "(d", ".items", "())\u010a\u010a", "max", "_v", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120_,", "\u0120v", "\u0120in", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120v", "\u0120>", "\u0120max", "_v", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_v", "\u0120=", "\u0120v", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "for", "\u0120k", ",", "\u0120v", "\u0120in", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120v", "\u0120==", "\u0120max", "_v", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(k", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a"], "input_token_weights": [0.89427190936908, 0.8563901704123833, 0.89427190936908, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7332896764791028, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.5928797394668679, 0.7760292149144611, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.6886415962350058, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.8563901704123833, 0.8563901704123833, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.89427190936908, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.5928797394668679, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5928797394668679, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.6886415962350058, 0.5928797394668679]} +{"problem_id": "p02691", "input": "n = int(input())\n\na = list(map(int, input().split()))\n\na_index = []\n\nfor i in range(n):\n\n a_index.append((i, a[i]))\n\ndic1 = {}\n\ndic2 = {}\n\nfor i in range(n):\n\n one = a_index[i][0] + a_index[i][1]\n\n two = a_index[i][0] - a_index[i][1]\n\n if one not in dic1:\n\n dic1[one] = 1\n\n else:\n\n dic1[one] += 1\n\n if two not in dic2:\n\n dic2[two] = 1\n\n else:\n\n dic2[two] += 1\n\nans = 0\n\nfor i in list(dic1.keys()):\n\n if i in dic2:\n\n ans += dic2[i] * dic1[i]\n\nfor i in list(dic2.keys()):\n\n if i in dic1:\n\n ans += dic1[i] * dic2[i]\n\n #print(i)\n\nprint((ans // 2))\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "_index", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_index", ".append", "((", "i", ",", "\u0120a", "[i", "]))\u010a\u010a", "dic", "1", "\u0120=", "\u0120{}\u010a\u010a", "dic", "2", "\u0120=", "\u0120{}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120one", "\u0120=", "\u0120a", "_index", "[i", "][", "0", "]", "\u0120+", "\u0120a", "_index", "[i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120two", "\u0120=", "\u0120a", "_index", "[i", "][", "0", "]", "\u0120-", "\u0120a", "_index", "[i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120one", "\u0120not", "\u0120in", "\u0120dic", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dic", "1", "[", "one", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dic", "1", "[", "one", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120two", "\u0120not", "\u0120in", "\u0120dic", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dic", "2", "[t", "wo", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dic", "2", "[t", "wo", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120list", "(dic", "1", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120in", "\u0120dic", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120dic", "2", "[i", "]", "\u0120*", "\u0120dic", "1", "[i", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120list", "(dic", "2", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120in", "\u0120dic", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120dic", "1", "[i", "]", "\u0120*", "\u0120dic", "2", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "print", "(i", ")\u010a\u010a", "print", "((", "ans", "\u0120//", "\u0120", "2", "))\u010a"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p03835", "input": "k,s=list(map(int,input().split()))\n\nans=chk=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if (0<=s-i-j<=k): ans+=1\n\nprint(ans)", "input_tokens": ["k", ",s", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "=", "chk", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "0", "<=", "s", "-i", "-j", "<=", "k", "):", "\u0120ans", "+=", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03564", "input": "N,K = int(input()), int(input())\n\nnow = 1\n\nfor i in range(N):\n\n if now*2 < now + K:\n\n now *= 2\n\n else:\n\n now += K\n\nprint(now)\n", "input_tokens": ["N", ",K", "\u0120=", "\u0120int", "(input", "()),", "\u0120int", "(input", "())\u010a\u010a", "now", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120now", "*", "2", "\u0120<", "\u0120now", "\u0120+", "\u0120K", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120now", "\u0120*=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120now", "\u0120+=", "\u0120K", "\u010a\u010a", "print", "(now", ")\u010a"], "input_token_weights": [0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.7760292149144611, 0.7332896764791028, 0.8170167109432965, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.8170167109432965, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.8170167109432965, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965]} +{"problem_id": "p02881", "input": "import math\n\nn=int(input())\n\nans=n\n\ni=1\n\nwhile(i<=math.sqrt(n)):\n\n if n%i==0:\n\n d=i+n/i-2\n\n ans=min(ans,d)\n\n i+=1\n\nprint((int(ans)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "ans", "=n", "\u010a\u010a", "i", "=", "1", "\u010a\u010a", "while", "(i", "<=", "math", ".sqrt", "(n", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "%i", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "=i", "+n", "/i", "-", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "=min", "(ans", ",d", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "+=", "1", "\u010a\u010a", "print", "((", "int", "(ans", ")))"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8798713320153649, 0.911283254435702, 0.5851191688414608, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.6673426178365944, 0.6270757423345348, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.7433160191943734, 0.8474406118450124]} +{"problem_id": "p03796", "input": "import math\n\n\n\nN = int(input())\n\n\n\npower = math.factorial(N)\n\n\n\nprint((power % 1000000007))\n\n\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "power", "\u0120=", "\u0120math", ".factor", "ial", "(N", ")\u010a\u010a\u010a\u010a", "print", "((", "power", "\u0120%", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))\u010a\u010a\u010a"], "input_token_weights": [0.883057299767519, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.7967329450848046, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046]} +{"problem_id": "p03170", "input": "n, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii <= k:\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n", "input_tokens": ["n", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "_s", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "dp", "\u0120=", "\u0120[\"", "Second", "\"]", "\u0120*", "\u0120(", "k", "\u0120+", "\u0120", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "]", "\u0120==", "\u0120\"", "Second", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120a", "_s", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ii", "\u0120=", "\u0120i", "\u0120+", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120ii", "\u0120<=", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[ii", "]", "\u0120=", "\u0120\"", "First", "\"\u010a\u010a", "print", "((", "dp", "[-", "1", "]))\u010a"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.579389560544, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.8691775287719905]} +{"problem_id": "p02622", "input": "S, T = [list(input()) for _ in range(2)]\n\ncnt = 0\n\nfor i in range(len(S)):\n\n if S[i] != T[i]:\n\n cnt += 1\n\nprint(cnt)\n", "input_tokens": ["S", ",", "\u0120T", "\u0120=", "\u0120[", "list", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "2", ")]\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", "]", "\u0120!=", "\u0120T", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.8170167109432965, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.8170167109432965, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.8170167109432965, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6886415962350058, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965]} +{"problem_id": "p02886", "input": "N = int(input())\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N-1):\n\n for j in range(i+1,N):\n\n cnt += D[i]*D[j]\n\nprint(cnt)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "D", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120D", "[i", "]*", "D", "[j", "]\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03370", "input": "N, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(input())\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x // min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n if x >= min(mn):\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)", "input_tokens": ["N", ",", "\u0120X", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "mn", "\u0120=", "\u0120[", "0", "]*", "N", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120mn", "[i", "]", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u010a\u010a", "ans", "\u0120=", "\u0120N", "\u010a\u010a", "x", "\u0120=", "\u0120X", "\u0120-", "\u0120sum", "(m", "n", ")\u010a\u010a\u010a\u010a", "while", "(x", "\u0120>=", "\u0120min", "(m", "n", "))", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120x", "\u0120//", "\u0120min", "(m", "n", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120mn", "[m", "n", ".index", "(min", "(m", "n", "))]", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120>=", "\u0120min", "(m", "n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120-=", "\u0120min", "(m", "n", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6160583186229708, 0.6160583186229708, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.781592256244883, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p02596", "input": "#! /usr/bin/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\n\n\ndef isMultiple(s, m):\n\n tmp = 0\n\n for i in range(len(s)):\n\n tmp = (tmp * 10 + int(s[i])) % m\n\n if tmp == 0:\n\n return i\n\n return -1\n\n\n\n\n\nk = int(readline())\n\nacc = \"7\" * 50000000\n\nif k % 2 == 0:\n\n ans = -1\n\nelse:\n\n\n\n ans = isMultiple(acc, k)\n\n if ans != -1:\n\n ans += 1\n\n\n\nprint(ans)\n", "input_tokens": ["#!", "\u0120/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "int", "1", "\u0120=", "\u0120lambda", "\u0120x", ":", "\u0120int", "(x", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "read", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".read", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "read", "lines", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readlines", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "5", "0", "0", "0", "0", "0", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120is", "Multiple", "(s", ",", "\u0120m", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120(", "tmp", "\u0120*", "\u0120", "1", "0", "\u0120+", "\u0120int", "(s", "[i", "]))", "\u0120%", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120-", "1", "\u010a\u010a\u010a\u010a\u010a\u010a", "k", "\u0120=", "\u0120int", "(read", "line", "())\u010a\u010a", "acc", "\u0120=", "\u0120\"", "7", "\"", "\u0120*", "\u0120", "5", "0", "0", "0", "0", "0", "0", "0", "\u010a\u010a", "if", "\u0120k", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120-", "1", "\u010a\u010a", "else", ":\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120is", "Multiple", "(acc", ",", "\u0120k", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ans", "\u0120!=", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02615", "input": "n,*l=list(map(int,open(0).read().split()));print((sum(sorted(l*2)[-2:~n:-1])))", "input_tokens": ["n", ",*", "l", "=list", "(map", "(int", ",", "open", "(", "0", ").", "read", "().", "split", "()));", "print", "((", "sum", "(sorted", "(l", "*", "2", ")[-", "2", ":", "~", "n", ":-", "1", "])))"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6160583186229708, 0.579389560544, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.7186273667339679, 0.7186273667339679, 0.949705583245731, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.781592256244883, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.6855929667625797, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.6855929667625797, 0.8691775287719905]} +{"problem_id": "p02881", "input": "import math\n\nN = int(input())\n\nfor i in range(int(math.sqrt(N))):\n\n if N % (int(math.sqrt(N))-i) == 0:\n\n print((int(N/(int(math.sqrt(N))-i)+int(math.sqrt(N))-i-2)))\n\n break", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(int", "(math", ".sqrt", "(N", ")))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120N", "\u0120%", "\u0120(", "int", "(math", ".sqrt", "(N", "))-", "i", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "int", "(N", "/(", "int", "(math", ".sqrt", "(N", "))-", "i", ")+", "int", "(math", ".sqrt", "(N", "))-", "i", "-", "2", ")))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break"], "input_token_weights": [0.9529241888335975, 0.9367265554405826, 0.5652845444887389, 0.9367265554405826, 0.9367265554405826, 0.9202622330629227, 0.9035222925783293, 0.9035222925783293, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9367265554405826, 0.9202622330629227, 0.8864973487791334, 0.8515524375924506, 0.8515524375924506, 0.9202622330629227, 0.9529241888335975, 0.5652845444887389, 0.9202622330629227, 0.8864973487791334, 0.8864973487791334, 0.8691775287719905, 0.833611120734537, 0.8153420232571196, 0.7777709920703102, 0.7777709920703102, 0.8515524375924506, 0.8515524375924506, 0.8691775287719905, 0.9035222925783293, 0.5652845444887389, 0.9035222925783293, 0.9202622330629227, 0.5652845444887389, 0.8691775287719905, 0.8515524375924506, 0.8153420232571196, 0.7967329450848046, 0.7186273667339679, 0.6557646610251396, 0.6339004969859428, 0.5886835746651548, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7186273667339679, 0.6981090974271096, 0.6557646610251396, 0.6557646610251396, 0.7584425223266994, 0.7584425223266994, 0.7777709920703102, 0.7777709920703102, 0.8515524375924506, 0.5652845444887389, 0.8864973487791334]} +{"problem_id": "p02994", "input": "N, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple():\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)//2 - eat_apple()))", "input_tokens": ["N", ",", "\u0120L", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "min", "_", "\u0120=", "\u0120L", "\u010a\u010a", "max", "_", "\u0120=", "\u0120L", "\u0120+", "\u0120N", "\u0120-", "1", "\u010a\u010a\u010a\u010a", "def", "\u0120eat", "_app", "le", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120max", "_<", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120max", "_", "\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120L", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120L", "\u010a\u010a\u010a\u010a", "print", "(((", "min", "_", "+", "max", "_", ")*(", "max", "_-", "min", "_", "+", "1", ")//", "2", "\u0120-", "\u0120eat", "_app", "le", "()))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p03363", "input": "from collections import Counter\n\n\n\nN = int(input())\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\nruisekiwa = [0] * (N+1)\n\n\n\nfor i in range(N):\n\n ruisekiwa[i+1] = ruisekiwa[i] + inputs[i]\n\n\n\nruisekiwa = ruisekiwa[1:]\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "inputs", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "ruise", "ki", "wa", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "+", "1", ")\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ru", "ise", "ki", "wa", "[i", "+", "1", "]", "\u0120=", "\u0120ru", "ise", "ki", "wa", "[i", "]", "\u0120+", "\u0120inputs", "[i", "]\u010a\u010a\u010a\u010a", "ruise", "ki", "wa", "\u0120=", "\u0120ru", "ise", "ki", "wa", "[", "1", ":]\u010a\u010a", "ruise", "ki", "wa", ".sort", "()\u010a\u010a", "counter", "_ru", "ise", "ki", "\u0120=", "\u0120Counter", "(r", "u", "ise", "ki", "wa", ")\u010a\u010a\u010a\u010a", "for", "\u0120key", ",", "\u0120value", "\u0120in", "\u0120list", "(counter", "_ru", "ise", "ki", ".items", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120key", "\u0120==", "\u0120", "0", "\u0120and", "\u0120value", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120key", "\u0120==", "\u0120", "0", "\u0120and", "\u0120value", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120value", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120sum", "(list", "(range", "(value", "))", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.7387330872699986, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03457", "input": "import sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n T = [list(map(int, _input().split())) for _ in range(N)]\n\n t, x, y = 0, 0, 0\n\n for next_t, next_x, next_y in T:\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "_input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120resolve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(_", "input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120_", "input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120next", "_t", ",", "\u0120next", "_x", ",", "\u0120next", "_y", "\u0120in", "\u0120T", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120diff", "_xy", "\u0120=", "\u0120abs", "(x", "\u0120-", "\u0120next", "_x", ")", "\u0120+", "\u0120abs", "(y", "\u0120-", "\u0120next", "_y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120diff", "_t", "\u0120=", "\u0120next", "_t", "\u0120-", "\u0120t", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120diff", "_xy", "\u0120>", "\u0120diff", "_t", "\u0120or", "\u0120(", "diff", "_xy", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120diff", "_t", "\u0120%", "\u0120", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "No", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120resolve", "()"], "input_token_weights": [0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.7281392564472128, 0.5749858371565393, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529]} +{"problem_id": "p03107", "input": "S = [int(_) for _ in input()]\n\nlength = len(S)\n\ntemp = [S[0]]\n\nfor x in S[1:]:\n\n if(len(temp) == 0):\n\n temp.append(x)\n\n elif( temp[-1] == x):\n\n temp.append(x)\n\n else:\n\n temp.pop(-1)\n\nprint((length-len(temp)))\n\n ", "input_tokens": ["S", "\u0120=", "\u0120[", "int", "(_)", "\u0120for", "\u0120_", "\u0120in", "\u0120input", "()]\u010a\u010a", "length", "\u0120=", "\u0120len", "(S", ")\u010a\u010a", "temp", "\u0120=", "\u0120[", "S", "[", "0", "]]\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120S", "[", "1", ":]", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(len", "(temp", ")", "\u0120==", "\u0120", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", ".append", "(x", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "(", "\u0120temp", "[-", "1", "]", "\u0120==", "\u0120x", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", ".append", "(x", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120temp", ".pop", "(-", "1", ")\u010a\u010a", "print", "((", "length", "-len", "(temp", ")))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8798713320153649, 0.911283254435702, 0.5851191688414608, 0.8474406118450124, 0.8139227859741643, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.8474406118450124, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.7060506397782503, 0.7433160191943734, 0.7433160191943734, 0.8139227859741643, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6270757423345348, 0.6673426178365944, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.7060506397782503, 0.8474406118450124, 0.5851191688414608]} +{"problem_id": "p02596", "input": "K = int(input())\n\n\n\nflg = [False]*K\n\n\n\ntmp = 7 % K\n\ncnt = 1\n\nif tmp == 0:\n\n print(cnt)\n\n exit()\n\nwhile True:\n\n tmp = (tmp*10+7)%K\n\n if flg[tmp]:\n\n print((-1))\n\n break\n\n else:\n\n cnt += 1\n\n if tmp == 0:\n\n print(cnt)\n\n break\n\n flg[tmp] = True\n", "input_tokens": ["K", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "fl", "g", "\u0120=", "\u0120[", "False", "]*", "K", "\u010a\u010a\u010a\u010a", "tmp", "\u0120=", "\u0120", "7", "\u0120%", "\u0120K", "\u010a\u010a", "cnt", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120tmp", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(cnt", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120(", "tmp", "*", "1", "0", "+", "7", ")%", "K", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120fl", "g", "[tmp", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tmp", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(cnt", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fl", "g", "[tmp", "]", "\u0120=", "\u0120True", "\u010a"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.6588494518362031, 0.7301658005010259, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.582053818991329]} +{"problem_id": "p03796", "input": "from math import factorial\n\nprint((factorial(int(input())) % (10**9+7)))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a", "print", "((", "factor", "ial", "(int", "(input", "()))", "\u0120%", "\u0120(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.8116478083709829, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8691775287719905]} +{"problem_id": "p03822", "input": "import sys\n\nsys.setrecursionlimit(202020)\n\n\n\nN = int(input())\n\nwon = [[] for i in range(N)]\n\nfor i in range(1,N):\n\n a = int(input()) - 1\n\n won[a].append(i)\n\n\n\ndef height(v):\n\n if not won[v]: return 0\n\n hs = [height(op) for op in won[v]]\n\n ret = 0\n\n for i,h in enumerate(sorted(hs)):\n\n ret = max(ret, h + len(hs) - i)\n\n return ret\n\n\n\nprint((height(0)))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "2", "0", "2", "0", "2", "0", ")\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "won", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(input", "())", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120won", "[a", "].", "append", "(i", ")\u010a\u010a\u010a\u010a", "def", "\u0120height", "(v", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120won", "[v", "]:", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120hs", "\u0120=", "\u0120[", "height", "(op", ")", "\u0120for", "\u0120op", "\u0120in", "\u0120won", "[v", "]]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",h", "\u0120in", "\u0120enumerate", "(sorted", "(h", "s", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120max", "(ret", ",", "\u0120h", "\u0120+", "\u0120len", "(h", "s", ")", "\u0120-", "\u0120i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "print", "((", "height", "(", "0", ")))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308]} +{"problem_id": "p02595", "input": "N, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a**2 + b**2) <= D**2:\n\n count += 1\n\nprint(count)\n", "input_tokens": ["N", ",", "\u0120D", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "a", "**", "2", "\u0120+", "\u0120b", "**", "2", ")", "\u0120<=", "\u0120D", "**", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")\u010a"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03309", "input": "# ABC102C - Linear Approximation (ARC100C)\n\nfrom statistics import median\n\n\n\n\n\ndef main():\n\n n = int(input())\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = tuple(j - i for i, j in enumerate(A, start=1))\n\n b = median(A)\n\n ans = sum(abs(a - b) for a in A)\n\n print((int(ans)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["#", "\u0120ABC", "1", "0", "2", "C", "\u0120-", "\u0120Linear", "\u0120Approx", "imation", "\u0120(", "ARC", "1", "0", "0", "C", ")\u010a\u010a", "from", "\u0120statistics", "\u0120import", "\u0120median", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120tuple", "(map", "(int", ",", "\u0120input", "().", "rstrip", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120tuple", "(j", "\u0120-", "\u0120i", "\u0120for", "\u0120i", ",", "\u0120j", "\u0120in", "\u0120enumerate", "(A", ",", "\u0120start", "=", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120median", "(A", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120sum", "(abs", "(a", "\u0120-", "\u0120b", ")", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "int", "(ans", ")))\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031]} +{"problem_id": "p01105", "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nL = {el: 1 for el in [a, b, c, d, e, 0]}\n\nfor i in range(6):\n\n R = sorted(L.items(), key=lambda x: x[1])\n\n for p, l in R:\n\n if l < 16:\n\n L[p ^ e] = min(L.get(p ^ e, 16), l+1)\n\n if l+3 < 16:\n\n for q, r in R:\n\n if l+r+3 <= 16:\n\n L[p & q] = min(L.get(p & q, 16), l+r+3)\n\n L[p ^ q] = min(L.get(p ^ q, 16), l+r+3)\n\n else: break\n\n else: break\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n", "input_tokens": ["a", "=", "6", "5", "2", "8", "0", ";", "\u0120b", "=", "6", "1", "6", "8", "0", ";", "\u0120c", "=", "5", "2", "4", "2", "8", ";", "\u0120d", "=", "4", "3", "6", "9", "0", ";", "\u0120e", "=", "6", "5", "5", "3", "5", "\u010a\u010a", "L", "\u0120=", "\u0120{", "el", ":", "\u0120", "1", "\u0120for", "\u0120el", "\u0120in", "\u0120[", "a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120d", ",", "\u0120e", ",", "\u0120", "0", "]", "}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", "\u0120=", "\u0120sorted", "(L", ".items", "(),", "\u0120key", "=lambda", "\u0120x", ":", "\u0120x", "[", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120p", ",", "\u0120l", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120<", "\u0120", "1", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120^", "\u0120e", "]", "\u0120=", "\u0120min", "(L", ".get", "(p", "\u0120^", "\u0120e", ",", "\u0120", "1", "6", "),", "\u0120l", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+", "3", "\u0120<", "\u0120", "1", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120q", ",", "\u0120r", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120l", "+r", "+", "3", "\u0120<=", "\u0120", "1", "6", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120&", "\u0120q", "]", "\u0120=", "\u0120min", "(L", ".get", "(p", "\u0120&", "\u0120q", ",", "\u0120", "1", "6", "),", "\u0120l", "+r", "+", "3", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[p", "\u0120^", "\u0120q", "]", "\u0120=", "\u0120min", "(L", ".get", "(p", "\u0120^", "\u0120q", ",", "\u0120", "1", "6", "),", "\u0120l", "+r", "+", "3", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120break", "\u010a\u010a", "print", "(*(", "L", "[e", "\u0120&", "\u0120eval", "(s", ")]", "\u0120for", "\u0120s", "\u0120in", "\u0120open", "(", "0", ").", "read", "().", "replace", "(*", "\"-", "~", "\").", "replace", "(*", "\"*", "&", "\").", "replace", "(*", "\"", "1", "e", "\").", "split", "()", "[:-", "1", "]),", "sep", "='\\", "n", "')\u010a"], "input_token_weights": [0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9674876381700903, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9674876381700903, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9674876381700903, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9674876381700903, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.9338825976214855, 0.5663133600873308, 0.9338825976214855, 0.9338825976214855, 0.916646878091049, 0.8991088707707996, 0.8991088707707996, 0.5663133600873308, 0.8991088707707996, 0.8991088707707996, 0.8991088707707996, 0.8991088707707996, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.8812577827705759, 0.5663133600873308, 0.8812577827705759, 0.8812577827705759, 0.916646878091049, 0.9508262735978029, 0.9508262735978029, 0.9508262735978029, 0.9338825976214855, 0.916646878091049, 0.916646878091049, 0.9508262735978029, 0.5663133600873308, 0.8991088707707996, 0.8991088707707996, 0.8812577827705759, 0.8630822326531611, 0.8257090119583357, 0.8630822326531611, 0.8445702068487291, 0.8445702068487291, 0.8064852224722056, 0.8257090119583357, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.8630822326531611, 0.5663133600873308, 0.916646878091049, 0.8991088707707996, 0.8991088707707996, 0.8991088707707996, 0.916646878091049, 0.916646878091049, 0.916646878091049, 0.5663133600873308, 0.8812577827705759, 0.8630822326531611, 0.8630822326531611, 0.5663133600873308, 0.8630822326531611, 0.8630822326531611, 0.8812577827705759, 0.5663133600873308, 0.8064852224722056, 0.8064852224722056, 0.7868846233634772, 0.7868846233634772, 0.8064852224722056, 0.8257090119583357, 0.8064852224722056, 0.7868846233634772, 0.7464918032696057, 0.7464918032696057, 0.7256666033195373, 0.7256666033195373, 0.7464918032696057, 0.5663133600873308, 0.7464918032696057, 0.7464918032696057, 0.7868846233634772, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.7868846233634772, 0.5663133600873308, 0.8445702068487291, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.8257090119583357, 0.5663133600873308, 0.8257090119583357, 0.8257090119583357, 0.8445702068487291, 0.5663133600873308, 0.8064852224722056, 0.7868846233634772, 0.7868846233634772, 0.7868846233634772, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.5663133600873308, 0.766892146942582, 0.704398473975408, 0.704398473975408, 0.7256666033195373, 0.7256666033195373, 0.7464918032696057, 0.5663133600873308, 0.7464918032696057, 0.7464918032696057, 0.766892146942582, 0.5663133600873308, 0.6826681637836003, 0.6826681637836003, 0.6604551382398354, 0.6604551382398354, 0.6826681637836003, 0.704398473975408, 0.6826681637836003, 0.6604551382398354, 0.6144916746054042, 0.6144916746054042, 0.5906926330383026, 0.5906926330383026, 0.6144916746054042, 0.5663133600873308, 0.6144916746054042, 0.6144916746054042, 0.6604551382398354, 0.6144916746054042, 0.6144916746054042, 0.6377374631784705, 0.6377374631784705, 0.6604551382398354, 0.5663133600873308, 0.6826681637836003, 0.6826681637836003, 0.6604551382398354, 0.6604551382398354, 0.6826681637836003, 0.704398473975408, 0.6826681637836003, 0.6604551382398354, 0.6144916746054042, 0.6144916746054042, 0.5906926330383026, 0.5906926330383026, 0.6144916746054042, 0.5663133600873308, 0.6144916746054042, 0.6144916746054042, 0.6604551382398354, 0.6144916746054042, 0.6144916746054042, 0.6377374631784705, 0.6377374631784705, 0.6604551382398354, 0.5663133600873308, 0.7464918032696057, 0.7464918032696057, 0.704398473975408, 0.5663133600873308, 0.5663133600873308, 0.8630822326531611, 0.8630822326531611, 0.8257090119583357, 0.5663133600873308, 0.9338825976214855, 0.916646878091049, 0.8630822326531611, 0.8630822326531611, 0.8445702068487291, 0.8257090119583357, 0.8064852224722056, 0.8630822326531611, 0.8630822326531611, 0.8630822326531611, 0.8630822326531611, 0.6144916746054042, 0.5906926330383026, 0.5906926330383026, 0.6377374631784705, 0.6377374631784705, 0.6826681637836003, 0.6826681637836003, 0.6826681637836003, 0.6377374631784705, 0.6377374631784705, 0.7256666033195373, 0.7256666033195373, 0.7256666033195373, 0.6826681637836003, 0.6826681637836003, 0.766892146942582, 0.766892146942582, 0.766892146942582, 0.7256666033195373, 0.7256666033195373, 0.7256666033195373, 0.8064852224722056, 0.8064852224722056, 0.8064852224722056, 0.8445702068487291, 0.8064852224722056, 0.916646878091049, 0.8991088707707996, 0.8991088707707996, 0.8630822326531611, 0.916646878091049]} +{"problem_id": "p02792", "input": "#python3\n\nfrom collections import defaultdict\n\nfrom collections import namedtuple\n\n\n\nP = namedtuple('P', ['front', 'end'])\n\n\n\ndef f(x):\n\n return P(str(x)[0], str(x)[-1]) \n\n\n\ndef main():\n\n\n\n n = int(input())\n\n freq = defaultdict(int)\n\n\n\n for i in range(1, n+1):\n\n p = f(i)\n\n freq[p]+=1\n\n\n\n\n\n ans = 0\n\n for i in range(1, n + 1):\n\n p = f(i)\n\n q = (p.end, p.front)\n\n ans += freq[q]\n\n\n\n print(ans)\n\n\n\nmain()", "input_tokens": ["#", "python", "3", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120namedtuple", "\u010a\u010a\u010a\u010a", "P", "\u0120=", "\u0120namedtuple", "('", "P", "',", "\u0120['", "front", "',", "\u0120'", "end", "']", ")\u010a\u010a\u010a\u010a", "def", "\u0120f", "(x", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120P", "(str", "(x", ")[", "0", "],", "\u0120str", "(x", ")[-", "1", "])", "\u0120\u010a\u010a\u010a\u010a", "def", "\u0120main", "():", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120freq", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120f", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120freq", "[p", "]+=", "1", "\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120f", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120(", "p", ".end", ",", "\u0120p", ".front", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120freq", "[q", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a", "main", "()"], "input_token_weights": [0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5886835746651548, 0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.6771609938949378, 0.6339004969859428, 0.7186273667339679, 0.6771609938949378, 0.7584425223266994, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.8691775287719905, 0.833611120734537]} +{"problem_id": "p03038", "input": "n, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(key=lambda x: x[1], reverse=True)\n\na.sort()\n\n\n\ni = 0\n\nfor b, c in bc:\n\n for _ in range(b):\n\n if i < n and a[i] < c:\n\n a[i] = c\n\n i += 1\n\n else:\n\n break\n\n\n\nans = sum(a)\n\nprint(ans)\n", "input_tokens": ["n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "bc", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(m", ")]", "\u010a\u010a\u010a\u010a", "bc", ".sort", "(key", "=lambda", "\u0120x", ":", "\u0120x", "[", "1", "],", "\u0120reverse", "=True", ")\u010a\u010a", "a", ".sort", "()\u010a\u010a\u010a\u010a", "i", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120bc", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120<", "\u0120n", "\u0120and", "\u0120a", "[i", "]", "\u0120<", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[i", "]", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120sum", "(a", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p01138", "input": "def f(s):\n\n s=list(map(int,s.split(':')))\n\n return (s[0]*60+s[1])*60+s[2]\n\na=86401\n\nwhile 1:\n\n t=[0]*a\n\n n=int(input())\n\n if n==0:break\n\n for _ in range(n):\n\n b,c=input().split()\n\n t[f(b)]+=1;t[f(c)]-=1\n\n d=0\n\n for i in range(1,a):\n\n t[i]+=t[i-1]\n\n d=max(d,t[i])\n\n print(d)", "input_tokens": ["def", "\u0120f", "(s", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "=list", "(map", "(int", ",s", ".split", "(':", "'))", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "s", "[", "0", "]*", "6", "0", "+s", "[", "1", "])*", "6", "0", "+s", "[", "2", "]\u010a\u010a", "a", "=", "8", "6", "4", "0", "1", "\u010a\u010a", "while", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "=[", "0", "]*", "a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "==", "0", ":", "break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", ",c", "=input", "().", "split", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[f", "(b", ")]", "+=", "1", ";t", "[f", "(c", ")]", "-=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",a", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[i", "]+=", "t", "[i", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "=max", "(d", ",t", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(d", ")"], "input_token_weights": [0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.6514299043837268, 0.6514299043837268, 0.7186273667339679, 0.781592256244883, 0.579389560544, 0.8691775287719905, 0.781592256244883, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.8408263201236497, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.7186273667339679, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829]} +{"problem_id": "p03796", "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(n", ")", "%(", "1", "0", "**", "9", "+", "7", ")))\u010a"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p03107", "input": "S = list(input())\n\nnum_one = S.count(\"1\")\n\nnum_zero = S.count(\"0\")\n\nans = min(num_one, num_zero) *2\n\nprint(ans)\n", "input_tokens": ["S", "\u0120=", "\u0120list", "(input", "())\u010a\u010a", "num", "_one", "\u0120=", "\u0120S", ".count", "(\"", "1", "\")\u010a\u010a", "num", "_zero", "\u0120=", "\u0120S", ".count", "(\"", "0", "\")\u010a\u010a", "ans", "\u0120=", "\u0120min", "(num", "_one", ",", "\u0120num", "_zero", ")", "\u0120*", "2", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7022465694939416, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7022465694939416, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03457", "input": "import sys\n\ncan = True; input()\n\ne = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]\n\nfor a, b in zip(e[1:], e):\n\n t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])\n\n if t < 0 or t % 2 == 1: can = False; break\n\nprint((['No', 'Yes'][can]))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "can", "\u0120=", "\u0120True", ";", "\u0120input", "()\u010a\u010a", "e", "\u0120=", "\u0120[[", "0", ",", "\u0120", "0", ",", "\u0120", "0", "]]", "\u0120+", "\u0120[", "list", "(map", "(int", ",", "\u0120e", ".split", "()))", "\u0120for", "\u0120e", "\u0120in", "\u0120sys", ".stdin", "]\u010a\u010a", "for", "\u0120a", ",", "\u0120b", "\u0120in", "\u0120zip", "(e", "[", "1", ":],", "\u0120e", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120a", "[", "0", "]", "\u0120-", "\u0120b", "[", "0", "]", "\u0120-", "\u0120abs", "(a", "[", "1", "]", "\u0120-", "\u0120b", "[", "1", "])", "\u0120-", "\u0120abs", "(a", "[", "2", "]", "\u0120-", "\u0120b", "[", "2", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120t", "\u0120<", "\u0120", "0", "\u0120or", "\u0120t", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":", "\u0120can", "\u0120=", "\u0120False", ";", "\u0120break", "\u010a\u010a", "print", "((", "['", "No", "',", "\u0120'", "Yes", "'][", "can", "]))"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9460144469641688, 0.8889473014940781, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7640031686476719, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p02901", "input": "import sys\n\nreadline = sys.stdin.readline\n\n\n\nN,M = list(map(int,readline().split()))\n\nINF = 10 ** 10\n\ndp = [INF] * (2 ** N)\n\ndp[0] = 0\n\n\n\nfor i in range(M):\n\n a,b = list(map(int,readline().split()))\n\n c = list(map(int,readline().split()))\n\n key = 0\n\n for j in range(len(c)):\n\n key += (1 << (c[j] - 1))\n\n for j in range(len(dp)):\n\n if dp[j] == INF:\n\n continue\n\n if j | key == j:\n\n continue\n\n dp[j | key] = min(dp[j | key], dp[j] + a)\n\n\n\nif dp[-1] == INF:\n\n print((-1))\n\nelse:\n\n print((dp[-1]))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",", "read", "line", "().", "split", "()))\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "1", "0", "\u010a\u010a", "dp", "\u0120=", "\u0120[", "INF", "]", "\u0120*", "\u0120(", "2", "\u0120**", "\u0120N", ")\u010a\u010a", "dp", "[", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120", "\u0120a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",", "read", "line", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "read", "line", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120key", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(c", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120key", "\u0120+=", "\u0120(", "1", "\u0120<<", "\u0120(", "c", "[j", "]", "\u0120-", "\u0120", "1", "))\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(dp", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[j", "]", "\u0120==", "\u0120INF", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120|", "\u0120key", "\u0120==", "\u0120j", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[j", "\u0120|", "\u0120key", "]", "\u0120=", "\u0120min", "(dp", "[j", "\u0120|", "\u0120key", "],", "\u0120dp", "[j", "]", "\u0120+", "\u0120a", ")\u010a\u010a\u010a\u010a", "if", "\u0120dp", "[-", "1", "]", "\u0120==", "\u0120INF", ":\u010a\u010a", "\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "((", "dp", "[-", "1", "]))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7681534551894282, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.9285282781079651, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7967329450848046]} +{"problem_id": "p02721", "input": "N, K, C = list(map(int, input().split()))\n\nS = input()\n\n\n\nlatest = [None]*K\n\ni = len(S)+C\n\nfor j in range(K-1, -1, -1):\n\n i = S.rindex(\"o\", 0, i-C)\n\n latest[j] = i\n\n\n\nif i<=C or \"o\" not in S[:i-C]:\n\n i = -C-1\n\n for j in latest:\n\n i = S.index(\"o\", i+C+1)\n\n if i == j:\n\n print((i+1))\n", "input_tokens": ["N", ",", "\u0120K", ",", "\u0120C", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "latest", "\u0120=", "\u0120[", "None", "]*", "K", "\u010a\u010a", "i", "\u0120=", "\u0120len", "(S", ")+", "C", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(K", "-", "1", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120", "\u0120i", "\u0120=", "\u0120S", ".r", "index", "(\"", "o", "\",", "\u0120", "0", ",", "\u0120i", "-C", ")\u010a\u010a", "\u0120", "\u0120latest", "[j", "]", "\u0120=", "\u0120i", "\u010a\u010a\u010a\u010a", "if", "\u0120i", "<=", "C", "\u0120or", "\u0120\"", "o", "\"", "\u0120not", "\u0120in", "\u0120S", "[:", "i", "-C", "]:\u010a\u010a", "\u0120", "\u0120i", "\u0120=", "\u0120-", "C", "-", "1", "\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120latest", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120S", ".index", "(\"", "o", "\",", "\u0120i", "+C", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120j", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "i", "+", "1", "))\u010a"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.9235768548788368, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.7186273667339679, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7186273667339679, 0.6855929667625797, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797]} +{"problem_id": "p02688", "input": "N, K = list(map(int, input().split()))\n\nsunuke = [True]*N\n\nfor i in range(K):\n\n d = int(input())\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n sunuke[a-1] = False\n\n\n\nans = 0\n\nfor i in range(N):\n\n if sunuke[i]:\n\n ans += 1\n\nprint(ans)", "input_tokens": ["N", ",", "\u0120K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "sun", "uke", "\u0120=", "\u0120[", "True", "]*", "N", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sun", "uke", "[a", "-", "1", "]", "\u0120=", "\u0120False", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120sun", "uke", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03796", "input": "import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n import math\n\n n=int(input())\n\n print((math.factorial(n)%(10**9+7)))\n\nresolve()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "def", "\u0120input", "():", "\u0120return", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a\u010a\u010a", "def", "\u0120resolve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120math", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "math", ".factor", "ial", "(n", ")", "%(", "1", "0", "**", "9", "+", "7", ")))\u010a\u010a", "resolve", "()"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8591441175808593, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.7967329450848046, 0.8889473014940781, 0.8591441175808593]} +{"problem_id": "p03416", "input": "A,B = list(map(int,input().split()))\n\nj = 0\n\nfor i in range(A,B+1):\n\n l = list(str(i))\n\n l_reverse = list(reversed(l))\n\n if l == l_reverse:\n\n j += 1\n\nprint(j)", "input_tokens": ["A", ",B", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "j", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(A", ",B", "+", "1", "):\u010a\u010a", "\u0120", "\u0120l", "\u0120=", "\u0120list", "(str", "(i", "))\u010a\u010a", "\u0120", "\u0120l", "_reverse", "\u0120=", "\u0120list", "(re", "versed", "(l", "))\u010a\u010a", "\u0120", "\u0120if", "\u0120l", "\u0120==", "\u0120l", "_reverse", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(j", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02390", "input": "s = int(input())\n\nm, s = s // 60, s % 60\n\nh, m = m // 60, m % 60\n\nprint((':'.join(map(str, [h,m,s]))))", "input_tokens": ["s", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "m", ",", "\u0120s", "\u0120=", "\u0120s", "\u0120//", "\u0120", "6", "0", ",", "\u0120s", "\u0120%", "\u0120", "6", "0", "\u010a\u010a", "h", ",", "\u0120m", "\u0120=", "\u0120m", "\u0120//", "\u0120", "6", "0", ",", "\u0120m", "\u0120%", "\u0120", "6", "0", "\u010a\u010a", "print", "(", "(':", "'.", "join", "(map", "(str", ",", "\u0120[", "h", ",m", ",s", "]))", "))"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.6673426178365944, 0.6673426178365944, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.7433160191943734, 0.8474406118450124]} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(N", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p03819", "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = map(int, input().split())\n\n LR = [list(map(int, input().split())) for _ in range(n)]\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n \n\n S = sorted([(r-l+1, l, r) for l, r in LR], reverse=True)\n\n cnt = n\n\n L = []\n\n for i in range(1, m+1):\n\n while S and S[-1][0] == i:\n\n c, l, r = S.pop()\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n L.append(res)\n\n print(*L, sep=\"\\n\")\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120", "\u0120n", ",", "\u0120m", "\u0120=", "\u0120map", "(int", ",", "\u0120input", "().", "split", "())\u010a\u010a", "\u0120", "\u0120LR", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u010a\u010a", "\u0120", "\u0120BIT", "\u0120=", "\u0120[", "0", "]*(", "m", "+", "2", ")\u010a\u010a", "\u0120", "\u0120def", "\u0120add", "(i", ",", "\u0120a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120<=", "\u0120m", "+", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120BIT", "[i", "]", "\u0120+=", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120i", "&", "(-", "i", ")\u010a\u010a", "\u0120", "\u0120def", "\u0120bit", "_sum", "(i", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120+=", "\u0120BIT", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120-=", "\u0120i", "&", "(-", "i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120res", "\u010a\u010a", "\u0120\u0120\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120sorted", "([(", "r", "-l", "+", "1", ",", "\u0120l", ",", "\u0120r", ")", "\u0120for", "\u0120l", ",", "\u0120r", "\u0120in", "\u0120LR", "],", "\u0120reverse", "=True", ")\u010a\u010a", "\u0120", "\u0120cnt", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120", "\u0120L", "\u0120=", "\u0120[]\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120m", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120S", "\u0120and", "\u0120S", "[-", "1", "][", "0", "]", "\u0120==", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120c", ",", "\u0120l", ",", "\u0120r", "\u0120=", "\u0120S", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120add", "(l", ",", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120add", "(r", "+", "1", ",", "\u0120-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", "\u0120=", "\u0120cnt", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "0", ",", "\u0120m", "+", "1", ",", "\u0120i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120res", "\u0120+=", "\u0120bit", "_sum", "(j", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", ".append", "(res", ")\u010a\u010a", "\u0120", "\u0120print", "(*", "L", ",", "\u0120sep", "=\"\\", "n", "\")\u010a\u010a", "\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6993277790098028, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6993277790098028, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.8357386476069529, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529]} +{"problem_id": "p03126", "input": "import functools\n\nprint((len(functools.reduce(lambda x, y: x&y,[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))", "input_tokens": ["import", "\u0120functools", "\u010a\u010a", "print", "((", "len", "(f", "unct", "ools", ".reduce", "(lambda", "\u0120x", ",", "\u0120y", ":", "\u0120x", "&", "y", ",[", "set", "(input", "().", "split", "()[", "1", ":])", "\u0120for", "\u0120_", "\u0120in", "\u0120[", "0", "]*", "int", "(input", "().", "split", "()[", "0", "])", "]))", "))"], "input_token_weights": [0.9485326079935381, 0.9307708458268354, 0.5674344985213602, 0.9307708458268354, 0.9126878899009554, 0.8755104074345346, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7967329450848046, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.7760292149144611, 0.7548877618383746, 0.6886415962350058, 0.6886415962350058, 0.7332896764791028, 0.7112147970463693, 0.7548877618383746, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.7548877618383746, 0.7332896764791028, 0.7112147970463693, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.6886415962350058, 0.7112147970463693, 0.8563901704123833, 0.9126878899009554]} +{"problem_id": "p03480", "input": "#!/usr/bin/env python3\n\n# coding=utf-8\n\n\n\nimport sys\n\n\n\ns = sys.stdin.readline().strip()\n\nl = [_s is \"1\" for _s in list(s)]\n\nl_r = l[::-1]\n\nindex = 0\n\nfor i, (c, n, c_r, n_r) in enumerate(\n\n zip(l[:len(s) // 2], l[1:len(s) // 2 + 1], l_r[:len(s) // 2], l_r[1:len(s) // 2 + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\nprint((len(s) - index))", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "#", "\u0120coding", "=utf", "-", "8", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120sys", ".stdin", ".readline", "().", "strip", "()\u010a\u010a", "l", "\u0120=", "\u0120[_", "s", "\u0120is", "\u0120\"", "1", "\"", "\u0120for", "\u0120_", "s", "\u0120in", "\u0120list", "(s", ")]\u010a\u010a", "l", "_r", "\u0120=", "\u0120l", "[::-", "1", "]\u010a\u010a", "index", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", ",", "\u0120(", "c", ",", "\u0120n", ",", "\u0120c", "_r", ",", "\u0120n", "_r", ")", "\u0120in", "\u0120enumerate", "(\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120zip", "(l", "[:", "len", "(s", ")", "\u0120//", "\u0120", "2", "],", "\u0120l", "[", "1", ":len", "(s", ")", "\u0120//", "\u0120", "2", "\u0120+", "\u0120", "1", "],", "\u0120l", "_r", "[:", "len", "(s", ")", "\u0120//", "\u0120", "2", "],", "\u0120l", "_r", "[", "1", ":len", "(s", ")", "\u0120//", "\u0120", "2", "\u0120+", "\u0120", "1", "]))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120c", "\u0120^", "\u0120n", "\u0120or", "\u0120c", "_r", "\u0120^", "\u0120n", "_r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120index", "\u0120=", "\u0120i", "\u0120+", "\u0120", "1", "\u010a\u010a", "print", "((", "len", "(s", ")", "\u0120-", "\u0120index", "))"], "input_token_weights": [0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8116478083709829, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.579389560544, 0.6855929667625797, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905]} +{"problem_id": "p03325", "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\n\n\nSUM = 0\n\nfor i in A:\n\n count = 0\n\n while i%2 == 0:\n\n i//=2\n\n count += 1\n\n SUM+=count\n\nprint(SUM)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "SUM", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "//=", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120SUM", "+=", "count", "\u010a\u010a", "print", "(S", "UM", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03796", "input": "n = int(input())\n\n\n\nINF = 10**9 + 7\n\n\n\nans = [0] * (10**5 + 1)\n\nans[0] = 1\n\n\n\nfor i in range(1,10**5 + 1):\n\n ans[i] = ans[i-1] * i % INF\n\n\n\nprint((ans[n]))\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "1", "0", "**", "5", "\u0120+", "\u0120", "1", ")\u010a\u010a", "ans", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "1", "0", "**", "5", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "[i", "]", "\u0120=", "\u0120ans", "[i", "-", "1", "]", "\u0120*", "\u0120i", "\u0120%", "\u0120INF", "\u010a\u010a\u010a\u010a", "print", "((", "ans", "[n", "]))\u010a"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.833611120734537, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.5886835746651548, 0.7584425223266994, 0.7967329450848046, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.9035222925783293, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.8691775287719905, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.833611120734537]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nm = max(x, y)\n\nfor i in range(1, m+1):\n\n x -= 1\n\n y -= 1\n\n if x < 0:\n\n x = 0\n\n if y < 0:\n\n y = 0\n\n temp = c*(i*2) + x*a + y*b\n\n if temp < ans:\n\n ans = temp\n\n\n\nprint(ans)\n", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120a", "\u0120*", "\u0120x", "\u0120+", "\u0120b", "\u0120*", "\u0120y", "\u010a\u010a", "m", "\u0120=", "\u0120max", "(x", ",", "\u0120y", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120m", "+", "1", "):\u010a\u010a", "\u0120", "\u0120x", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120y", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120if", "\u0120x", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120if", "\u0120y", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120temp", "\u0120=", "\u0120c", "*(", "i", "*", "2", ")", "\u0120+", "\u0120x", "*a", "\u0120+", "\u0120y", "*b", "\u010a\u010a", "\u0120", "\u0120if", "\u0120temp", "\u0120<", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120temp", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03798", "input": "n=int(input())\n\ns=input()\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\n\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n #print(x[i])\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "s", "=input", "()\u010a\u010a", "x", "=[\"", "SS", "\",\"", "SW", "\",\"", "WS", "\",\"", "WW", "\"]", "\u010a\u010a\u010a\u010a", "def", "\u0120check", "0", "(i", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "0", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[", "0", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][-", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][-", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[", "0", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][-", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][-", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "1", "]==\"", "W", "\"\u010a\u010a", "def", "\u0120check", "1", "(i", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "n", "-", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[n", "-", "1", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "n", "-", "2", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "n", "-", "2", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[n", "-", "1", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "n", "-", "2", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "n", "-", "2", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120x", "[i", "][", "0", "]==\"", "W", "\"", "\u010a\u010a\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(n", "-", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "j", "+", "1", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[j", "+", "1", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "j", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "j", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[j", "+", "1", "]==\"", "o", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "j", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "[i", "][", "j", "]==\"", "S", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "S", "\"\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "[i", "]+", "=\"", "W", "\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "print", "(x", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120check", "0", "(i", ")", "\u0120and", "\u0120check", "1", "(i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "x", "[i", "]))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a"], "input_token_weights": [0.9235768548788368, 0.9235768548788368, 0.883057299767519, 0.883057299767519, 0.9235768548788368, 0.9235768548788368, 0.883057299767519, 0.9235768548788368, 0.9235768548788368, 0.883057299767519, 0.9035222925783293, 0.883057299767519, 0.9035222925783293, 0.883057299767519, 0.9035222925783293, 0.883057299767519, 0.9035222925783293, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.5700083567488032, 0.9035222925783293, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.862164725336545, 0.883057299767519, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.819022641134497, 0.862164725336545, 0.5700083567488032, 0.819022641134497, 0.7506053018110229, 0.7506053018110229, 0.7739350698055053, 0.7506053018110229, 0.7967329450848046, 0.7739350698055053, 0.819022641134497, 0.5700083567488032, 0.7739350698055053, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.7506053018110229, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.7967329450848046, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7267182280470056, 0.7739350698055053, 0.7506053018110229, 0.7967329450848046, 0.5700083567488032, 0.7506053018110229, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7267182280470056, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.7967329450848046, 0.8408263201236497, 0.5700083567488032, 0.7967329450848046, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7267182280470056, 0.7739350698055053, 0.7506053018110229, 0.7967329450848046, 0.5700083567488032, 0.7506053018110229, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7267182280470056, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.7739350698055053, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7506053018110229, 0.7267182280470056, 0.7739350698055053, 0.5700083567488032, 0.7267182280470056, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.7022465694939416, 0.6250192001927346, 0.6250192001927346, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6514299043837268, 0.6514299043837268, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.5700083567488032, 0.9035222925783293, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.883057299767519, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.819022641134497, 0.819022641134497, 0.7967329450848046, 0.7967329450848046, 0.8408263201236497, 0.819022641134497, 0.862164725336545, 0.5700083567488032, 0.819022641134497, 0.7506053018110229, 0.7506053018110229, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7967329450848046, 0.7739350698055053, 0.819022641134497, 0.5700083567488032, 0.7739350698055053, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.7506053018110229, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.7967329450848046, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7739350698055053, 0.7506053018110229, 0.7967329450848046, 0.5700083567488032, 0.7506053018110229, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7267182280470056, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7739350698055053, 0.7739350698055053, 0.819022641134497, 0.7967329450848046, 0.8408263201236497, 0.5700083567488032, 0.7967329450848046, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7739350698055053, 0.7506053018110229, 0.7967329450848046, 0.5700083567488032, 0.7506053018110229, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7267182280470056, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.7739350698055053, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.7267182280470056, 0.7739350698055053, 0.5700083567488032, 0.7267182280470056, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.7022465694939416, 0.6250192001927346, 0.6250192001927346, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.9035222925783293, 0.9035222925783293, 0.9432371260907066, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8408263201236497, 0.819022641134497, 0.862164725336545, 0.5700083567488032, 0.819022641134497, 0.7739350698055053, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.7967329450848046, 0.7739350698055053, 0.819022641134497, 0.5700083567488032, 0.7739350698055053, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7267182280470056, 0.7739350698055053, 0.5700083567488032, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.7022465694939416, 0.6771609938949378, 0.6771609938949378, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.5700083567488032, 0.7506053018110229, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7506053018110229, 0.5700083567488032, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6514299043837268, 0.6514299043837268, 0.6250192001927346, 0.6250192001927346, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.7267182280470056, 0.7267182280470056, 0.7739350698055053, 0.7506053018110229, 0.7967329450848046, 0.5700083567488032, 0.7506053018110229, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7022465694939416, 0.7506053018110229, 0.5700083567488032, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.6514299043837268, 0.6514299043837268, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6514299043837268, 0.6514299043837268, 0.6250192001927346, 0.6250192001927346, 0.5700083567488032, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7267182280470056, 0.6514299043837268, 0.6514299043837268, 0.6771609938949378, 0.6771609938949378, 0.7022465694939416, 0.6771609938949378, 0.7267182280470056, 0.5700083567488032, 0.6250192001927346, 0.6250192001927346, 0.6514299043837268, 0.6514299043837268, 0.6250192001927346, 0.6250192001927346, 0.5700083567488032, 0.7022465694939416, 0.7022465694939416, 0.5700083567488032, 0.5978920048953399, 0.5978920048953399, 0.6250192001927346, 0.6250192001927346, 0.5978920048953399, 0.5978920048953399, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9035222925783293, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.9035222925783293, 0.5700083567488032, 0.8408263201236497, 0.819022641134497, 0.7739350698055053, 0.7739350698055053, 0.819022641134497, 0.5700083567488032, 0.862164725336545, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.862164725336545, 0.8408263201236497, 0.7967329450848046, 0.8408263201236497]} +{"problem_id": "p03162", "input": "# coding: utf-8\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [[0] * 3 for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n for j in range(3):\n\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] \\\n\n for k in range(3) if k != j)\n\n return(max(dp[n]))\n\n\n\nn = int(input()) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n", "input_tokens": ["#", "\u0120coding", ":", "\u0120utf", "-", "8", "\u010a\u010a\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "def", "\u0120f", "(n", ",", "\u0120abc", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120", "3", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", "\u0120+", "\u0120", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "j", "]", "\u0120=", "\u0120max", "(dp", "[i", "\u0120-", "\u0120", "1", "][", "k", "]", "\u0120+", "\u0120abc", "[i", "\u0120-", "\u0120", "1", "][", "j", "]", "\u0120\\\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(", "3", ")", "\u0120if", "\u0120k", "\u0120!=", "\u0120j", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "(max", "(dp", "[n", "]))", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())", "\u0120\u0120\u0120", "\u0120#", "\u0120", "1", "\u0120<=", "\u0120n", "\u0120<=", "\u0120", "1", "0", "^", "5", "\u010a\u010a", "abc", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "rstrip", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "print", "((", "f", "(n", ",", "\u0120abc", ")))\u010a"], "input_token_weights": [0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.8456076926739031, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.6339004969859428, 0.60398418480891, 0.5731452134031394, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6339004969859428, 0.6339004969859428, 0.60398418480891, 0.5731452134031394, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8214688817838891, 0.7967329450848046, 0.8691775287719905, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.958265617022148, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7453461554353482, 0.7453461554353482, 0.8456076926739031, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.8922045961188434, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434]} +{"problem_id": "p02595", "input": "N, D = list(map(int, input().split()))\n\npoint = []\n\nfor i in range(N):\n\n point.append(list(map(int, input().split())))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in point:\n\n if (i[0]**2 + i[1]**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)", "input_tokens": ["N", ",", "\u0120D", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "point", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120point", ".append", "(list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", ")\u010a\u010a\u010a\u010a", "ct", "\u0120=", "\u0120", "0", "\u010a\u010a", "D", "2", "\u0120=", "\u0120D", "\u0120*", "\u0120D", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120point", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "i", "[", "0", "]**", "2", "\u0120+", "\u0120i", "[", "1", "]**", "2", ")", "\u0120<=", "\u0120D", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ct", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ct", ")"], "input_token_weights": [0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.7833854580549265, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8357386476069529, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383]} +{"problem_id": "p03796", "input": "from math import factorial\n\n\n\nmod = 10**9 + 7\n\nn = int(input())\n\n\n\nans = factorial(n) % mod\n\nprint(ans)", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "ans", "\u0120=", "\u0120factorial", "(n", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.883057299767519, 0.8408263201236497, 0.883057299767519, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7967329450848046, 0.5978920048953399, 0.7967329450848046, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03078", "input": "import heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\ndef diff(l):\n\n m = max(l)\n\n return sorted(m - v for v in l)[1:]\n\n\n\ns = sum(map(max, [a, b, c]))\n\nsa, sb, sc = list(map(diff, [a, b, c]))\n\nda, db, dc = [0], [0], [0]\n\nq = [0]\n\nwhile k > 0:\n\n while True:\n\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n\n heapq.heappush(q, v)\n\n da.append(sa[0])\n\n sa = sa[1:]\n\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n\n heapq.heappush(q, v)\n\n db.append(sb[0])\n\n sb = sb[1:]\n\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n\n heapq.heappush(q, v)\n\n dc.append(sc[0])\n\n sc = sc[1:]\n\n else:\n\n break\n\n v = heapq.heappop(q)\n\n print(s - v)\n\n k -= 1\n", "input_tokens": ["import", "\u0120heapq", "\u010a\u010a\u010a\u010a", "x", ",", "\u0120y", ",", "\u0120z", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120diff", "(l", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120max", "(l", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120sorted", "(m", "\u0120-", "\u0120v", "\u0120for", "\u0120v", "\u0120in", "\u0120l", ")[", "1", ":]", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120sum", "(map", "(max", ",", "\u0120[", "a", ",", "\u0120b", ",", "\u0120c", "]))\u010a\u010a", "sa", ",", "\u0120sb", ",", "\u0120sc", "\u0120=", "\u0120list", "(map", "(diff", ",", "\u0120[", "a", ",", "\u0120b", ",", "\u0120c", "]))\u010a\u010a", "da", ",", "\u0120db", ",", "\u0120dc", "\u0120=", "\u0120[", "0", "],", "\u0120[", "0", "],", "\u0120[", "0", "]\u010a\u010a", "q", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "while", "\u0120k", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120len", "(sa", ")", "\u0120>", "\u0120", "0", "\u0120and", "\u0120(", "len", "(q", ")", "\u0120==", "\u0120", "0", "\u0120or", "\u0120q", "[", "0", "]", "\u0120>", "\u0120sa", "[", "0", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", "\u0120in", "\u0120[", "sa", "[", "0", "]", "\u0120+", "\u0120bb", "\u0120+", "\u0120cc", "\u0120for", "\u0120bb", "\u0120in", "\u0120db", "\u0120for", "\u0120cc", "\u0120in", "\u0120dc", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120v", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120da", ".append", "(sa", "[", "0", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sa", "\u0120=", "\u0120sa", "[", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120len", "(sb", ")", "\u0120>", "\u0120", "0", "\u0120and", "\u0120(", "len", "(q", ")", "\u0120==", "\u0120", "0", "\u0120or", "\u0120q", "[", "0", "]", "\u0120>", "\u0120sb", "[", "0", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", "\u0120in", "\u0120[", "sb", "[", "0", "]", "\u0120+", "\u0120aa", "\u0120+", "\u0120cc", "\u0120for", "\u0120aa", "\u0120in", "\u0120da", "\u0120for", "\u0120cc", "\u0120in", "\u0120dc", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120v", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120db", ".append", "(sb", "[", "0", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sb", "\u0120=", "\u0120sb", "[", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120len", "(sc", ")", "\u0120>", "\u0120", "0", "\u0120and", "\u0120(", "len", "(q", ")", "\u0120==", "\u0120", "0", "\u0120or", "\u0120q", "[", "0", "]", "\u0120>", "\u0120sc", "[", "0", "])", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120v", "\u0120in", "\u0120[", "sc", "[", "0", "]", "\u0120+", "\u0120aa", "\u0120+", "\u0120bb", "\u0120for", "\u0120aa", "\u0120in", "\u0120da", "\u0120for", "\u0120bb", "\u0120in", "\u0120db", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120heapq", ".he", "app", "ush", "(q", ",", "\u0120v", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dc", ".append", "(sc", "[", "0", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sc", "\u0120=", "\u0120sc", "[", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120heapq", ".he", "app", "op", "(q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(s", "\u0120-", "\u0120v", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120-=", "\u0120", "1", "\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7967329450848046, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.7967329450848046, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397]} +{"problem_id": "p02837", "input": "N = int(input())\n\nA = [0]*N\n\nX = []\n\nY = []\n\nfor i in range(N):\n\n A[i] = int(input())\n\n X.append([])\n\n Y.append([])\n\n for j in range(A[i]):\n\n x, y = list(map(int, input().split()))\n\n X[i].append(x-1)\n\n Y[i].append(y)\n\nans = 0\n\nfor bit in range(1<= k:\n\n print(a)\n\n exit()\n\n\n", "input_tokens": ["n", ",k", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "num", "\u0120=", "\u0120", "0", "\u010a\u010a", "q", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", ".append", "((", "a", ",b", "))\u010a\u010a", "q", ".sort", "()\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120q", "[i", "][", "0", "],", "\u0120q", "[i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120num", "\u0120>=", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282]} +{"problem_id": "p03197", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\ndef dfs(x, y):\n\n if x==0 and y==0:\n\n t[x][y] = False\n\n return False\n\n \n\n if x>=1:\n\n t[x][y] |= not dfs(x-1, y)\n\n \n\n if y>=1:\n\n t[x][y] |= not dfs(x, y-1)\n\n \n\n if min(x, y)>=1:\n\n t[x][y] |= not dfs(x-1, y-1)\n\n \n\n return t[x][y]\n\n \n\nt = [[False]*7 for _ in range(7)]\n\n\n\nfor i in range(7):\n\n for j in range(7):\n\n dfs(i, j)\n\n\n\n\"\"\"\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(input())\n\nflag = True\n\n\n\nfor _ in range(N):\n\n a = int(input())\n\n \n\n if a%2==1:\n\n flag = False\n\n \n\nif flag:\n\n print('second')\n\nelse:\n\n print('first')", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120*", "\u010a\u010a\u010a\u010a", "def", "\u0120dfs", "(x", ",", "\u0120y", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "==", "0", "\u0120and", "\u0120y", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[x", "][", "y", "]", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", ">=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[x", "][", "y", "]", "\u0120|=", "\u0120not", "\u0120dfs", "(x", "-", "1", ",", "\u0120y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120y", ">=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[x", "][", "y", "]", "\u0120|=", "\u0120not", "\u0120dfs", "(x", ",", "\u0120y", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120min", "(x", ",", "\u0120y", ")>=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "[x", "][", "y", "]", "\u0120|=", "\u0120not", "\u0120dfs", "(x", "-", "1", ",", "\u0120y", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120t", "[x", "][", "y", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "t", "\u0120=", "\u0120[[", "False", "]*", "7", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(", "7", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "7", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "7", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dfs", "(i", ",", "\u0120j", ")\u010a\u010a\u010a\u010a", "\"\"\"\u010a\u010a", "for", "\u0120ti", "\u0120in", "\u0120t", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(*", "ti", ")\u010a\u010a", "\"\"\"", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "flag", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "%", "2", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120flag", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "if", "\u0120flag", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "second", "')\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "first", "')"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7640031686476719]} +{"problem_id": "p03416", "input": "a,b=list(map(int, input().split()))\n\ncnt=0\n\nfor i in range(a,b+1):\n\n n=list(str(i))\n\n if n==list(reversed(n)):\n\n cnt+=1\n\nprint(cnt)", "input_tokens": ["a", ",b", "=list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=list", "(str", "(i", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "==", "list", "(re", "versed", "(n", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "+=", "1", "\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03416", "input": "a, b = list(map(int, input().strip().split(\" \")))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\nprint(count)\n", "input_tokens": ["a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "strip", "().", "split", "(\"", "\u0120\"", ")))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120str", "(i", ")", "\u0120==", "\u0120str", "(i", ")[", "::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")\u010a"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.7967329450848046, 0.7681534551894282, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\np = math.factorial(N)\n\nprint((p % 1000000007))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "p", "\u0120=", "\u0120math", ".factor", "ial", "(N", ")\u010a\u010a", "print", "((", "p", "\u0120%", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))"], "input_token_weights": [0.883057299767519, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.7967329450848046, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046]} +{"problem_id": "p02891", "input": "import sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(input())\n\n \n\ndef check_count(s):\n\n cnt_list = [1]\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt_list[-1] += 1\n\n else:\n\n cnt_list.append(1)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c//2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k//2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)//2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "\u0120\u010a\u010a", "s", "\u0120=", "\u0120input", "().", "rstrip", "()\u010a\u010a", "k", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "def", "\u0120check", "_count", "(s", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "_list", "\u0120=", "\u0120[", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "-", "1", "]", "\u0120==", "\u0120s", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "_list", "[-", "1", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "_list", ".append", "(", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120cnt", "_list", "\u010a\u010a\u010a\u010a", "def", "\u0120calc", "_ans", "(cnt", "_list", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120_", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120cnt", "_list", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120_", "ans", "\u0120+=", "\u0120c", "//", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "(_", "ans", "\u0120*", "\u0120k", ")\u010a\u010a\u010a\u010a", "if", "\u0120len", "(s", ")==", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120k", "//", "2", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "_list", "\u0120=", "\u0120check", "_count", "(s", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(cnt", "_list", ")==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120(", "len", "(s", ")*", "k", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120calc", "_ans", "(cnt", "_list", ",", "\u0120k", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[", "0", "]==", "s", "[-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "_list", "[", "0", "]%", "2", "==", "1", "\u0120and", "\u0120cnt", "_list", "[-", "1", "]%", "2", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120k", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8456076926739031, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.9367265554405826, 0.8922045961188434, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.8691775287719905, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7453461554353482, 0.6911750402874859, 0.6629477592666795, 0.7186273667339679, 0.7186273667339679, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7967329450848046, 0.5731452134031394, 0.7453461554353482, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7453461554353482, 0.5731452134031394, 0.6629477592666795, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.5731452134031394, 0.6339004969859428, 0.5731452134031394, 0.914713330925897, 0.8922045961188434, 0.8922045961188434]} +{"problem_id": "p02881", "input": "N = int(input())\n\n\n\n\n\ndef dist(i, j):\n\n return i + j - 2\n\n\n\n\n\nmin = 10 ** 24\n\ni = 1\n\nwhile (i ** 2) <= N:\n\n if 0 == N % i:\n\n j = N // i\n\n d = dist(i, j)\n\n if min > d:\n\n min = d\n\n i += 1\n\nprint(d)\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a\u010a\u010a", "def", "\u0120dist", "(i", ",", "\u0120j", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120i", "\u0120+", "\u0120j", "\u0120-", "\u0120", "2", "\u010a\u010a\u010a\u010a\u010a\u010a", "min", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "2", "4", "\u010a\u010a", "i", "\u0120=", "\u0120", "1", "\u010a\u010a", "while", "\u0120(", "i", "\u0120**", "\u0120", "2", ")", "\u0120<=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "\u0120==", "\u0120N", "\u0120%", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120N", "\u0120//", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120dist", "(i", ",", "\u0120j", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120min", "\u0120>", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120min", "\u0120=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(d", ")\u010a"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.833611120734537, 0.833611120734537]} +{"problem_id": "p02552", "input": "n = int(input())\n\nprint((1 if n == 0 else 0))\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "1", "\u0120if", "\u0120n", "\u0120==", "\u0120", "0", "\u0120else", "\u0120", "0", "))\u010a"], "input_token_weights": [0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.7967329450848046, 0.7022465694939416, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.6514299043837268, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7967329450848046]} +{"problem_id": "p03039", "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n ans += f1(x,y,n,m)+f1(1,1,x,y)+f1(1,y,x,m)+f1(x,1,n,y)\n\n ans -= f2(x,n) + f2(1,x) + f2(1,y) + f2(y,m)\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "8", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "#", "mod", "\u0120=", "\u0120", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "**", "1", "8", "\u010a\u010a", "eps", "\u0120=", "\u0120", "1", "0", "**", "-", "7", "\u010a\u010a\u010a\u010a", "m", ",n", ",k", "\u0120=", "\u0120list", "(map", "(int", ",", "read", "line", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120comb", "(n", ",", "\u0120r", ",", "\u0120mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120min", "(r", ",", "\u0120n", "-r", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120mol", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120den", "o", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120r", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mol", "\u0120=", "\u0120mol", "\u0120*", "\u0120(", "n", "-r", "+i", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120den", "o", "\u0120=", "\u0120den", "o", "\u0120*", "\u0120i", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120mol", "\u0120*", "\u0120pow", "(d", "eno", ",", "\u0120mod", "-", "2", ",", "\u0120mod", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "def", "\u0120f", "1", "(x", ",y", ",a", ",b", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "a", "+b", "-x", "-y", ")*(", "a", "-x", "+", "1", ")*(", "b", "-y", "+", "1", ")//", "2", "\u010a\u010a\u010a\u010a", "def", "\u0120f", "2", "(x", ",a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "a", "-x", ")*(", "a", "-x", "+", "1", ")//", "2", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(", "1", ",m", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120f", "1", "(x", ",y", ",n", ",m", ")+", "f", "1", "(", "1", ",", "1", ",x", ",y", ")+", "f", "1", "(", "1", ",y", ",x", ",m", ")+", "f", "1", "(x", ",", "1", ",n", ",y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120-=", "\u0120f", "2", "(x", ",n", ")", "\u0120+", "\u0120f", "2", "(", "1", ",x", ")", "\u0120+", "\u0120f", "2", "(", "1", ",y", ")", "\u0120+", "\u0120f", "2", "(y", ",m", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120%=", "\u0120mod", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120(", "ans", "\u0120*", "\u0120comb", "(m", "*n", "-", "2", ",k", "-", "2", ",", "mod", "))", "%", "mod", "\u010a\u010a", "ans", "\u0120=", "\u0120ans", "*pow", "(", "2", ",", "mod", "-", "2", ",", "mod", ")%", "mod", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.6855929667625797, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6855929667625797, 0.7186273667339679, 0.781592256244883, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03013", "input": "import sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\n\n\nl = [0] * (n+1)\n\nl[0] = 1\n\n\n\na = 0\n\nif m != 0:\n\n a = int(input())\n\nk = 1\n\nfor i in range(n+1):\n\n\n\n if i != a:\n\n if i == 1:\n\n l[i] = 1\n\n elif i >= 2:\n\n l[i] = l[i-1] + l[i-2]\n\n l[i] %= 1000000007\n\n else:\n\n k += 1\n\n if k <= m:\n\n a = int(input())\n\n\n\n\n\n\n\n#print(l)\n\nprint((l[n] % 1000000007))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "7", ")\u010a\u010a", "def", "\u0120l", "mi", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120l", "mi", "()\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "+", "1", ")\u010a\u010a", "l", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "a", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120m", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "k", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "1", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120!=", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[i", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120i", "\u0120>=", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[i", "]", "\u0120=", "\u0120l", "[i", "-", "1", "]", "\u0120+", "\u0120l", "[i", "-", "2", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[i", "]", "\u0120%=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", "\u0120<=", "\u0120m", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a\u010a\u010a\u010a\u010a", "#print", "(l", ")\u010a\u010a", "print", "((", "l", "[n", "]", "\u0120%", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))\u010a"], "input_token_weights": [0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.6993277790098028, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9094625571831276, 0.8854867975141383, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383]} +{"problem_id": "p03013", "input": "N,M = list(map(int,input().split()))\n\nMOD = 10**9+7\n\ndp = [0]*(N+1)\n\ndp[0]=1\n\nA = [int(input()) for i in range(M)]\n\nban = [1]*(N+1)\n\nfor a in A:\n\n ban[a]=0\n\nfor i in range(N):\n\n if i-1>=0:\n\n dp[i+1]=dp[i]*ban[i]+dp[i-1]*ban[i-1]\n\n else:\n\n dp[i+1]=dp[i]*ban[i]\n\n dp[i+1] %= MOD \n\nprint((dp[N]))", "input_tokens": ["N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "MOD", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]*(", "N", "+", "1", ")\u010a\u010a", "dp", "[", "0", "]=", "1", "\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", ")]\u010a\u010a", "ban", "\u0120=", "\u0120[", "1", "]*(", "N", "+", "1", ")\u010a\u010a", "for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ban", "[a", "]=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "-", "1", ">=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "]=", "dp", "[i", "]*", "ban", "[i", "]+", "dp", "[i", "-", "1", "]*", "ban", "[i", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "]=", "dp", "[i", "]*", "ban", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "]", "\u0120%=", "\u0120MOD", "\u0120\u010a\u010a", "print", "((", "dp", "[N", "]))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p03371", "input": "def main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", ",", "\u0120B", ",", "\u0120AB", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120M", "\u0120=", "\u0120max", "(X", ",", "\u0120Y", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120A", "\u0120*", "\u0120X", "\u0120+", "\u0120B", "\u0120*", "\u0120Y", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", ",\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120AB", "\u0120*", "\u0120k", "\u0120*", "\u0120", "2", "\u0120+", "\u0120max", "(", "0", ",", "\u0120X", "\u0120-", "\u0120k", ")", "\u0120*", "\u0120A", "\u0120+", "\u0120max", "(", "0", ",", "\u0120Y", "\u0120-", "\u0120k", ")", "\u0120*", "\u0120B", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120)\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120k", "\u0120>=", "\u0120M", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.5731452134031394, 0.6911750402874859, 0.7186273667339679, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6911750402874859, 0.6911750402874859, 0.7453461554353482, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.5731452134031394, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031]} +{"problem_id": "p02245", "input": "import sys\n\n\n\ninit = ''.join(sys.stdin.read().split())\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start, goal):\n\n if start == goal:\n\n return 0\n\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n\n step = {start: 0, goal: 0}\n\n s = 0\n\n c_d = [(start, 0), (goal, 1)] # configure and direction\n\n while True:\n\n q = iter(c_d)\n\n c_d = []\n\n s += 1\n\n for c, d in q:\n\n i = c.find('0')\n\n if 0 <= i <= 5:\n\n t = str.maketrans('0' + c[i+3], c[i+3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i >= 3:\n\n t = str.maketrans('0' + c[i-3], c[i-3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n\n t = str.maketrans('0' + c[i+1], c[i+1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n\n t = str.maketrans('0' + c[i-1], c[i-1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n\n\nprint((solve(init, '123456780')))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "init", "\u0120=", "\u0120''.", "join", "(sys", ".stdin", ".read", "().", "split", "())\u010a\u010a", "\u010a\u010a", "#", "\u0120Bid", "irectional", "\u0120search", "\u0120using", "\u0120breadth", "-first", "\u0120search", "\u010a\u010a", "def", "\u0120solve", "(start", ",", "\u0120goal", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120start", "\u0120==", "\u0120goal", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120generated", "_state", "\u0120=", "\u0120{", "start", ":", "\u0120", "0", ",", "\u0120goal", ":", "\u0120", "1", "}", "\u0120\u0120", "\u0120#", "\u0120", "0", ":", "\u0120fore", "ward", ",", "\u0120", "1", ":", "\u0120backward", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120step", "\u0120=", "\u0120{", "start", ":", "\u0120", "0", ",", "\u0120goal", ":", "\u0120", "0", "}\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "_d", "\u0120=", "\u0120[(", "start", ",", "\u0120", "0", "),", "\u0120(", "goal", ",", "\u0120", "1", ")]", "\u0120#", "\u0120configure", "\u0120and", "\u0120direction", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120iter", "(c", "_d", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "_d", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120c", ",", "\u0120d", "\u0120in", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120c", ".find", "('", "0", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120", "0", "\u0120<=", "\u0120i", "\u0120<=", "\u0120", "5", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120str", ".m", "ak", "etr", "ans", "('", "0", "'", "\u0120+", "\u0120c", "[i", "+", "3", "],", "\u0120c", "[i", "+", "3", "]", "\u0120+", "\u0120'", "0", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "_c", "\u0120=", "\u0120c", ".translate", "(t", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "_c", "\u0120in", "\u0120generated", "_state", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120generated", "_state", "[t", "_c", "]", "\u0120!=", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120s", "\u0120+", "\u0120step", "[t", "_c", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120generated", "_state", "[t", "_c", "]", "\u0120=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120step", "[t", "_c", "]", "\u0120=", "\u0120s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "_d", ".append", "((", "t", "_c", ",", "\u0120d", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120>=", "\u0120", "3", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120str", ".m", "ak", "etr", "ans", "('", "0", "'", "\u0120+", "\u0120c", "[i", "-", "3", "],", "\u0120c", "[i", "-", "3", "]", "\u0120+", "\u0120'", "0", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "_c", "\u0120=", "\u0120c", ".translate", "(t", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "_c", "\u0120in", "\u0120generated", "_state", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120generated", "_state", "[t", "_c", "]", "\u0120!=", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120s", "\u0120+", "\u0120step", "[t", "_c", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120generated", "_state", "[t", "_c", "]", "\u0120=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120step", "[t", "_c", "]", "\u0120=", "\u0120s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "_d", ".append", "((", "t", "_c", ",", "\u0120d", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "0", "\u0120or", "\u0120i", "\u0120==", "\u0120", "1", "\u0120or", "\u0120i", "\u0120==", "\u0120", "3", "\u0120or", "\u0120i", "\u0120==", "\u0120", "4", "\u0120or", "\u0120i", "\u0120==", "\u0120", "6", "\u0120or", "\u0120i", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120str", ".m", "ak", "etr", "ans", "('", "0", "'", "\u0120+", "\u0120c", "[i", "+", "1", "],", "\u0120c", "[i", "+", "1", "]", "\u0120+", "\u0120'", "0", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "_c", "\u0120=", "\u0120c", ".translate", "(t", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "_c", "\u0120in", "\u0120generated", "_state", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120generated", "_state", "[t", "_c", "]", "\u0120!=", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120s", "\u0120+", "\u0120step", "[t", "_c", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120generated", "_state", "[t", "_c", "]", "\u0120=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120step", "[t", "_c", "]", "\u0120=", "\u0120s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "_d", ".append", "((", "t", "_c", ",", "\u0120d", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "1", "\u0120or", "\u0120i", "\u0120==", "\u0120", "2", "\u0120or", "\u0120i", "\u0120==", "\u0120", "4", "\u0120or", "\u0120i", "\u0120==", "\u0120", "5", "\u0120or", "\u0120i", "\u0120==", "\u0120", "7", "\u0120or", "\u0120i", "\u0120==", "\u0120", "8", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120str", ".m", "ak", "etr", "ans", "('", "0", "'", "\u0120+", "\u0120c", "[i", "-", "1", "],", "\u0120c", "[i", "-", "1", "]", "\u0120+", "\u0120'", "0", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "_c", "\u0120=", "\u0120c", ".translate", "(t", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120t", "_c", "\u0120in", "\u0120generated", "_state", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120generated", "_state", "[t", "_c", "]", "\u0120!=", "\u0120d", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120s", "\u0120+", "\u0120step", "[t", "_c", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120generated", "_state", "[t", "_c", "]", "\u0120=", "\u0120d", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120step", "[t", "_c", "]", "\u0120=", "\u0120s", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "_d", ".append", "((", "t", "_c", ",", "\u0120d", "))", "\u010a\u010a\u010a\u010a", "print", "((", "solve", "(init", ",", "\u0120'", "1", "2", "3", "4", "5", "6", "7", "8", "0", "')))"], "input_token_weights": [0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.76049478068099, 0.7847988758021361, 0.8317036996956922, 0.8317036996956922, 0.8765066796615488, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7355852514485495, 0.5714954628602014, 0.808526270355906, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6838237134005932, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.7100393521462953, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.5714954628602014, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.5714954628602014, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6838237134005932, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.7100393521462953, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.5714954628602014, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.5714954628602014, 0.808526270355906, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.6569022703191485, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.6838237134005932, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.5714954628602014, 0.7100393521462953, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.7355852514485495, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6838237134005932, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.7100393521462953, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.5714954628602014, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.5714954628602014, 0.808526270355906, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.6569022703191485, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.6838237134005932, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.5714954628602014, 0.7100393521462953, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.7355852514485495, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6838237134005932, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.5714954628602014, 0.7100393521462953, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.5714954628602014, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.5714954628602014, 0.9193881350322848, 0.8981772421402056, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8981772421402056]} +{"problem_id": "p02837", "input": "def popcount(x):\n\n r, q = 0, x\n\n while x:\n\n r += 1\n\n x &= x - 1\n\n return r, q\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\nl = (1 << n) - 1 \n\nb = sorted(map(popcount, list(range(1, l + 1))))\n\nans = next((i for i, x in reversed(b)\n\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)), 0)\n\nprint(ans)\n", "input_tokens": ["def", "\u0120pop", "count", "(x", "):\u010a\u010a", "\u0120", "\u0120r", ",", "\u0120q", "\u0120=", "\u0120", "0", ",", "\u0120x", "\u010a\u010a", "\u0120", "\u0120while", "\u0120x", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120&=", "\u0120x", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120return", "\u0120r", ",", "\u0120q", "\u010a\u010a", "\u0120\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "r", "\u0120=", "\u0120list", "(range", "(n", "))\u010a\u010a", "a", "\u0120=", "\u0120[[", "0", ",", "\u0120", "0", "]", "\u0120for", "\u0120_", "\u0120in", "\u0120r", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120r", ":\u010a\u010a", "\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(int", "(input", "()))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "[i", "][", "y", "]", "\u0120|=", "\u0120", "1", "\u0120<<", "\u0120(", "x", "\u0120-", "\u0120", "1", ")\u010a\u010a", "l", "\u0120=", "\u0120(", "1", "\u0120<<", "\u0120n", ")", "\u0120-", "\u0120", "1", "\u0120\u010a\u010a", "b", "\u0120=", "\u0120sorted", "(map", "(pop", "count", ",", "\u0120list", "(range", "(", "1", ",", "\u0120l", "\u0120+", "\u0120", "1", "))))\u010a\u010a", "ans", "\u0120=", "\u0120next", "((", "i", "\u0120for", "\u0120i", ",", "\u0120x", "\u0120in", "\u0120reversed", "(b", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120all", "(a", "[j", "][", "0", "]", "\u0120&", "\u0120x", "\u0120==", "\u0120a", "[j", "][", "1", "]", "\u0120&", "\u0120l", "\u0120-", "\u0120x", "\u0120==", "\u0120", "0", "\u0120for", "\u0120j", "\u0120in", "\u0120r", "\u0120if", "\u0120x", "\u0120>>", "\u0120j", "\u0120&", "\u0120", "1", ")),", "\u0120", "0", ")\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8214688817838891, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7713695892187169, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.6911750402874859, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.5731452134031394, 0.7186273667339679, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.8922045961188434, 0.8922045961188434]} +{"problem_id": "p03634", "input": "import queue\n\nn = int(input())\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\nwhile not q.empty():\n\n tmp = q.get()\n\n for i in range(len(abc[tmp])):\n\n #print(abc[tmp])\n\n #exit()\n\n num = abc[tmp][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[tmp] + abc[tmp][i][1]\n\n q.put(num)\n\n \n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))", "input_tokens": ["import", "\u0120queue", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "abc", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "1", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120abc", "[a", "].", "append", "([", "b", ",c", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120abc", "[b", "].", "append", "([", "a", ",c", "])\u010a\u010a", "\u010a\u010a", "Q", ",k", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "xy", "\u0120=", "\u0120[[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(Q", ")]", "\u010a\u010a\u010a\u010a", "q", "\u0120=", "\u0120queue", ".Queue", "()\u010a\u010a\u010a\u010a", "q", ".put", "(k", ")\u010a\u010a\u010a\u010a", "path", "\u0120=", "\u0120[-", "1", "]*(", "n", "+", "1", ")\u010a\u010a", "path", "[k", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "while", "\u0120not", "\u0120q", ".empty", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120q", ".get", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(", "abc", "[tmp", "]))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "print", "(", "abc", "[tmp", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "exit", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120abc", "[tmp", "][", "i", "][", "0", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120path", "[num", "]", "\u0120!=", "\u0120-", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120path", "[num", "]", "\u0120=", "\u0120path", "[tmp", "]", "\u0120+", "\u0120abc", "[tmp", "][", "i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", ".put", "(num", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(Q", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "path", "[", "xy", "[i", "][", "0", "]]", "+", "path", "[", "xy", "[i", "][", "1", "]]", "))"], "input_token_weights": [0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8854867975141383, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.6993277790098028, 0.6993277790098028, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.8357386476069529, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.7561438265913266, 0.7561438265913266, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.8357386476069529]} +{"problem_id": "p02394", "input": "W,H,x,y,r = [int(i) for i in input().split()]\n\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "input_tokens": ["W", ",H", ",x", ",y", ",r", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "if", "\u0120x", "\u0120-", "\u0120r", "\u0120>=", "\u0120", "0", "\u0120and", "\u0120x", "\u0120+", "\u0120r", "\u0120<=", "\u0120W", "\u0120and", "\u0120y", "\u0120-", "\u0120r", "\u0120>=", "\u0120", "0", "\u0120and", "\u0120y", "\u0120+", "\u0120r", "\u0120<=", "\u0120H", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Yes", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "No", "\")"], "input_token_weights": [0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.833611120734537, 0.9035222925783293, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.5886835746651548, 0.7584425223266994, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.7584425223266994, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7584425223266994, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.7584425223266994, 0.7186273667339679, 0.6771609938949378, 0.7186273667339679]} +{"problem_id": "p03325", "input": "from math import log2\n\nn = int(input())\n\na = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor _a in a:\n\n if _a%2 == 0:\n\n cnt =0\n\n while _a%2 == 0:\n\n _a //= 2\n\n cnt += 1\n\n ans += cnt\n\n\n\nprint((int(ans)))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120log", "2", "\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "a", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120_", "a", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120_", "a", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120_", "a", "\u0120//=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cnt", "\u010a\u010a\u010a\u010a", "print", "((", "int", "(ans", ")))"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p02685", "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n ret = p\n\n inv = pow(m-1, mod-2, mod)\n\n for i in range(1, k+1):\n\n ncr = (ncr * (n-i)*pow(i, mod-2, mod)) % mod\n\n p = (p*inv) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "input_tokens": ["#", "\u0120coding", ":", "\u0120utf", "-", "8", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "(*", "args", ":", "\u0120str", ")", "\u0120->", "\u0120str", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120m", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120args", "[", "0", "].", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120m", "\u0120==", "\u0120", "1", "\u0120and", "\u0120n", "-", "1", "\u0120==", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120str", "(", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "cr", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120m", "*pow", "(m", "-", "1", ",", "\u0120n", "-", "1", ",", "\u0120mod", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120p", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "\u0120=", "\u0120pow", "(m", "-", "1", ",", "\u0120mod", "-", "2", ",", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "cr", "\u0120=", "\u0120(", "nc", "r", "\u0120*", "\u0120(", "n", "-i", ")*", "pow", "(i", ",", "\u0120mod", "-", "2", ",", "\u0120mod", "))", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120=", "\u0120(", "p", "*", "inv", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120p", "*", "nc", "r", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120str", "(ret", "\u0120%", "\u0120mod", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "solve", "(*(", "open", "(", "0", ").", "read", "().", "split", "lines", "()))", "))\u010a"], "input_token_weights": [0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.883057299767519, 0.9035222925783293, 0.883057299767519, 0.9235768548788368, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.5700083567488032, 0.9035222925783293, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.862164725336545, 0.883057299767519, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7739350698055053, 0.7739350698055053, 0.7967329450848046, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.9035222925783293, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.7739350698055053, 0.7506053018110229, 0.7267182280470056, 0.7267182280470056, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7267182280470056, 0.7267182280470056, 0.7967329450848046, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7967329450848046, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.5700083567488032, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.9432371260907066, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9432371260907066, 0.5700083567488032, 0.883057299767519, 0.862164725336545, 0.819022641134497, 0.7967329450848046, 0.6250192001927346, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046, 0.862164725336545]} +{"problem_id": "p03828", "input": "import collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,n+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num //= i ; ans.append(i)\n\n return ans\n\n\n\nn = int(input())\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n", "input_tokens": ["import", "\u0120collections", "\u0120as", "\u0120col", "\u010a\u010a\u010a\u010a", "def", "\u0120prime", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "%", "2", "==", "0", "\u0120and", "\u0120i", "!=", "2", ":", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120num", "%i", "\u0120==", "\u0120", "0", ":", "\u0120num", "\u0120//=", "\u0120i", "\u0120;", "\u0120ans", ".append", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ans", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "pr", "imes", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",n", "+", "1", "):", "\u0120primes", "\u0120+=", "\u0120prime", "(i", ")\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120col", ".Counter", "(pr", "imes", ")\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120key", ",val", "\u0120in", "\u0120list", "(cnt", ".items", "()):", "\u0120ans", "\u0120*=", "\u0120(", "val", "\u0120+", "\u0120", "1", ")", "\u0120;", "\u0120ans", "\u0120%=", "\u0120mod", "\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.911283254435702, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.5851191688414608, 0.7792424376220217, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.7060506397782503, 0.5851191688414608, 0.5851191688414608, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.7792424376220217, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.7433160191943734, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.911283254435702, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.911283254435702, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.7433160191943734, 0.7792424376220217, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p02794", "input": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(input())\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120E", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120a", "-", "1", ",", "\u0120b", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120E", "[a", "].", "append", "((", "b", ",i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120E", "[b", "].", "append", "((", "a", ",i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120dfs", "(s", ",", "\u0120g", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120par", "\u0120=", "\u0120[", "(-", "1", ",-", "1", ")]", "\u0120*", "\u0120N", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120par", "[s", "]", "\u0120=", "\u0120(", "s", ",-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120stack", "\u0120=", "\u0120[", "s", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120stack", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120stack", ".pop", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120to", ",", "\u0120i", "\u0120in", "\u0120E", "[v", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120par", "[to", "][", "0", "]", "\u0120>=", "\u0120", "0", ":", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120par", "[to", "]", "\u0120=", "\u0120(", "v", ",", "\u0120i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120to", "\u0120==", "\u0120g", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120stack", ".append", "(to", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120g", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120v", "\u0120!=", "\u0120s", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", ",", "\u0120i", "\u0120=", "\u0120par", "[v", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", ".add", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120r", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120M", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120path", "\u0120=", "\u0120[", "None", "]", "\u0120*", "\u0120M", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120u", ",", "\u0120v", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120u", ",", "\u0120v", "\u0120=", "\u0120u", "-", "1", ",", "\u0120v", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120path", "[i", "]", "\u0120=", "\u0120dfs", "(u", ",", "\u0120v", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120calc", "(s", "):", "\u0120return", "\u0120", "1", "<<(", "N", "-", "1", "-len", "(s", "))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "_ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120p", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "<<", "M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120is", "_odd", "\u0120=", "\u0120bin", "(p", ").", "count", "('", "1", "')", "\u0120&", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120p", "&", "1", ":", "\u0120s", "\u0120|=", "\u0120path", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "\u0120>>=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120is", "_odd", ":", "\u0120i", "_ans", "\u0120+=", "\u0120calc", "(s", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":", "\u0120i", "_ans", "\u0120-=", "\u0120calc", "(s", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(((", "1", "<<(", "N", "-", "1", "))", "\u0120-", "\u0120i", "_ans", "))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7453461554353482, 0.7186273667339679, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7453461554353482, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.5731452134031394, 0.7186273667339679, 0.7453461554353482, 0.6911750402874859, 0.5731452134031394, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.6911750402874859, 0.5731452134031394, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8922045961188434, 0.8456076926739031, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7186273667339679, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7186273667339679, 0.6911750402874859, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.7453461554353482, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.7453461554353482, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031]} +{"problem_id": "p02612", "input": "'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(input())\n\ndef si():return input()\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n#mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile = 0\n\n\n\ndef solve():\n\n \n\n\n\n\n\n\n\n # for _ in range(ii()):\n\n\n\n n=ii()\n\n n%=1000\n\n if n!=0:\n\n n=1000-n\n\n print(n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()", "input_tokens": ["'''\u010a\u010a", "\u0120\u0120\u0120", "\u0120Auth", "er", ":", "\u0120gh", "os", "hash", "is", "5", "4", "5", "\u0120Ash", "is", "\u0120Gh", "osh", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120College", ":", "\u0120jal", "pa", "ig", "uri", "\u0120Gov", "t", "\u0120Eng", "g", "ine", "ering", "\u0120College", "\u010a\u010a\u010a\u010a", "'''\u010a\u010a", "from", "\u0120os", "\u0120import", "\u0120path", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120cmp", "_to", "_key", "\u0120as", "\u0120c", "tk", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", ",default", "dict", "\u0120as", "\u0120dd", "\u0120\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", ",b", "is", "ect", "_left", ",b", "is", "ect", "_right", ",", "ins", "ort", ",", "ins", "ort", "_left", ",", "ins", "ort", "_right", "\u010a\u010a", "from", "\u0120itertools", "\u0120import", "\u0120permutations", "\u010a\u010a", "from", "\u0120datetime", "\u0120import", "\u0120datetime", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120ceil", ",s", "qrt", ",", "log", ",g", "cd", "\u010a\u010a", "def", "\u0120ii", "():", "return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120si", "():", "return", "\u0120input", "()\u010a\u010a", "def", "\u0120mi", "():", "return", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "def", "\u0120li", "():", "return", "\u0120list", "(mi", "())\u010a\u010a", "abc", "='", "abcdefghijklmnopqrstuvwxyz", "'\u010a\u010a", "mod", "=", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "#", "mod", "=", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "inf", "\u0120=", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "v", "ow", "=['", "a", "','", "e", "','", "i", "','", "o", "','", "u", "']\u010a\u010a", "dx", ",", "dy", "=[", "-", "1", ",", "1", ",", "0", ",", "0", "],[", "0", ",", "0", ",", "1", ",-", "1", "]\u010a\u010a\u010a\u010a", "def", "\u0120bo", "(i", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ord", "(i", ")-", "ord", "('", "a", "')\u010a\u010a\u010a\u010a", "file", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(ii", "()):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "=", "ii", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "%=", "1", "0", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "!=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "=", "1", "0", "0", "0", "-n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(n", ")\u010a\u010a", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==\"", "__", "main", "__", "\":", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(file", "):", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120path", ".exists", "('", "input", "1", ".txt", "')", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".stdin", "=open", "('", "input", "1", ".txt", "',", "\u0120'", "r", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".stdout", "=open", "('", "output", "1", ".txt", "','", "w", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120input", "=sys", ".stdin", ".readline", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120solve", "()"], "input_token_weights": [0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.781592256244883, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.781592256244883, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.579389560544, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.579389560544, 0.579389560544, 0.579389560544, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.6160583186229708, 0.6514299043837268, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.6855929667625797, 0.6855929667625797, 0.6160583186229708, 0.6514299043837268, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8116478083709829]} +{"problem_id": "p02685", "input": "M=998244353\n\nn,m,k=list(map(int,input().split()))\n\na=0\n\nc=1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n-i-1,M)\n\n c=c*(n-i-1)*pow(i+1,M-2,M)%M\n\nprint((a%M))", "input_tokens": ["M", "=", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "n", ",m", ",k", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=", "0", "\u010a\u010a", "c", "=", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "+", "1", "):\u010a\u010a", "\u0120", "\u0120a", "+=", "c", "*m", "*pow", "(m", "-", "1", ",n", "-i", "-", "1", ",M", ")\u010a\u010a", "\u0120", "\u0120c", "=c", "*(", "n", "-i", "-", "1", ")*", "pow", "(i", "+", "1", ",M", "-", "2", ",M", ")%", "M", "\u010a\u010a", "print", "((", "a", "%M", "))"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p03680", "input": "N = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(10 ** 6):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120[", "int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "cnt", ",", "\u0120i", "\u0120=", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "0", "\u0120**", "\u0120", "6", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[i", "]", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(cnt", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120quit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120a", "[i", "]", "\u0120-", "\u0120", "1", "\u010a\u010a", "print", "((-", "1", "))"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.5851191688414608, 0.8474406118450124, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.7433160191943734, 0.7060506397782503, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.6270757423345348, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.5851191688414608, 0.8798713320153649, 0.8474406118450124, 0.7792424376220217, 0.8474406118450124]} +{"problem_id": "p02555", "input": "import math\n\n\n\n\n\ndef combinations_count(n, r):\n\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n s = int(input())\n\n ans = 0\n\n n = s // 3\n\n\n\n for i in range(1, n + 1):\n\n ans += combinations_with_replacement_count(i, 3*(n-i)+s % 3)\n\n\n\n print((ans % (10**9 + 7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120combinations", "_count", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120math", ".factor", "ial", "(n", ")", "\u0120//", "\u0120(", "math", ".factor", "ial", "(n", "\u0120-", "\u0120r", ")", "\u0120*", "\u0120math", ".factor", "ial", "(r", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120combinations", "_with", "_re", "placement", "_count", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120combinations", "_count", "(n", "\u0120+", "\u0120r", "\u0120-", "\u0120", "1", ",", "\u0120r", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120s", "\u0120//", "\u0120", "3", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120combinations", "_with", "_re", "placement", "_count", "(i", ",", "\u0120", "3", "*(", "n", "-i", ")+", "s", "\u0120%", "\u0120", "3", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "ans", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p03806", "input": "G_MAX = 40*10\n\nN_MAX = 40\n\nINF = float('inf')\n\n\n\ndp = [[[INF]*(G_MAX+1) for _ in range(G_MAX+1)] \n\n for _ in range(N_MAX+1)]\n\nN,Ma,Mb = list(map(int, input().split()))\n\na,b,c = [],[],[]\n\nfor _ in range(N):\n\n ai,bi,ci = list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\n c.append(ci)\n\n\n\ndp[0][0][0] = 0\n\nfrom math import isinf\n\nfor i in range(N):\n\n for ca in range(G_MAX+1):\n\n for cb in range(G_MAX+1):\n\n if isinf(dp[i][ca][cb]): continue\n\n dp[i+1][ca][cb] = min(dp[i+1][ca][cb],\n\n dp[i][ca][cb])\n\n dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]],\n\n dp[i][ca][cb]+c[i])\n\n \n\n \n\nans = INF\n\nfor ca in range(1,G_MAX+1):\n\n for cb in range(1,G_MAX+1):\n\n if ca*Mb==cb*Ma:\n\n ans = min(ans, dp[N][ca][cb])\n\n \n\nif isinf(ans): ans = -1\n\nprint(ans)", "input_tokens": ["G", "_MAX", "\u0120=", "\u0120", "4", "0", "*", "1", "0", "\u010a\u010a", "N", "_MAX", "\u0120=", "\u0120", "4", "0", "\u010a\u010a", "INF", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[[[", "INF", "]*(", "G", "_MAX", "+", "1", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(G", "_MAX", "+", "1", ")]", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "_MAX", "+", "1", ")]\u010a\u010a", "N", ",M", "a", ",M", "b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", ",b", ",c", "\u0120=", "\u0120[],", "[],", "[]", "\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ai", ",", "bi", ",", "ci", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ".append", "(ai", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ".append", "(b", "i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", ".append", "(ci", ")\u010a\u010a\u010a\u010a", "dp", "[", "0", "][", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120is", "inf", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120ca", "\u0120in", "\u0120range", "(G", "_MAX", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120cb", "\u0120in", "\u0120range", "(G", "_MAX", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120is", "inf", "(dp", "[i", "][", "ca", "][", "cb", "]):", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "ca", "][", "cb", "]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "ca", "][", "cb", "],\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "ca", "][", "cb", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "ca", "+a", "[i", "]][", "cb", "+b", "[i", "]]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "ca", "+a", "[i", "]][", "cb", "+b", "[i", "]],", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "][", "ca", "][", "cb", "]+", "c", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "ans", "\u0120=", "\u0120INF", "\u010a\u010a", "for", "\u0120ca", "\u0120in", "\u0120range", "(", "1", ",G", "_MAX", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120cb", "\u0120in", "\u0120range", "(", "1", ",G", "_MAX", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120ca", "*M", "b", "==", "cb", "*", "Ma", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120dp", "[N", "][", "ca", "][", "cb", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "if", "\u0120is", "inf", "(ans", "):", "\u0120ans", "\u0120=", "\u0120-", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8214688817838891, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.8691775287719905, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7967329450848046, 0.7453461554353482, 0.5731452134031394, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.5731452134031394, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.7453461554353482, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6339004969859428, 0.6339004969859428, 0.60398418480891, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6339004969859428, 0.7186273667339679, 0.5731452134031394, 0.5731452134031394, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.5731452134031394, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.9367265554405826, 0.8691775287719905, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.914713330925897, 0.8922045961188434, 0.8922045961188434]} +{"problem_id": "p03568", "input": "from itertools import product\n\n\n\nn = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ncount = 0\n\nfor C in product((-1, 0, 1), repeat=n):\n\n total = 1\n\n for a, c in zip(A, C):\n\n total *= (a + c)\n\n if total % 2 == 0:\n\n count += 1\n\nprint(count)", "input_tokens": ["from", "\u0120itertools", "\u0120import", "\u0120product", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120C", "\u0120in", "\u0120product", "((-", "1", ",", "\u0120", "0", ",", "\u0120", "1", "),", "\u0120repeat", "=n", "):\u010a\u010a", "\u0120", "\u0120total", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120for", "\u0120a", ",", "\u0120c", "\u0120in", "\u0120zip", "(A", ",", "\u0120C", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120total", "\u0120*=", "\u0120(", "a", "\u0120+", "\u0120c", ")\u010a\u010a", "\u0120", "\u0120if", "\u0120total", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03164", "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n,W=list(map(int,input().split()))\n\n WV=[tuple(map(int,input().split())) for _ in range(n)]\n\n\n\n V=100000\n\n dp=[INF]*(V+1)\n\n dp[0]=0\n\n\n\n for w,v in WV:\n\n for x in range(V,-1,-1):\n\n if(x+v<=V):\n\n dp[x+v]=min(dp[x+v],dp[x]+w)\n\n\n\n for x in range(V,-1,-1):\n\n if(dp[x]<=W):\n\n print(x)\n\n return\n\nresolve()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "2", "1", "4", "7", "4", "8", "3", "6", "4", "7", ")\u010a\u010a", "INF", "=float", "(\"", "inf", "\")\u010a\u010a", "MOD", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "input", "=lambda", "\u0120:", "sys", ".stdin", ".readline", "().", "rstrip", "()\u010a\u010a", "def", "\u0120resolve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",W", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120WV", "=[", "tuple", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120V", "=", "1", "0", "0", "0", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "=[", "INF", "]*(", "V", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "]=", "0", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120w", ",v", "\u0120in", "\u0120WV", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(V", ",-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(x", "+v", "<=", "V", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[x", "+v", "]=", "min", "(dp", "[x", "+v", "],", "dp", "[x", "]+", "w", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(V", ",-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "(dp", "[x", "]<=", "W", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(x", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u010a\u010a", "resolve", "()"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8456076926739031, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7967329450848046, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7967329450848046, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.7186273667339679, 0.6911750402874859, 0.6629477592666795, 0.6339004969859428, 0.60398418480891, 0.6629477592666795, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.6339004969859428, 0.6629477592666795, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.7967329450848046, 0.5731452134031394, 0.914713330925897, 0.8922045961188434]} +{"problem_id": "p02691", "input": "from collections import defaultdict\n\n\n\n\n\ndef main():\n\n _ = int(input())\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n L[i + height] += 1\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120_", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120heights", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", ">i", ",", "\u0120j", "-i", "\u0120=", "\u0120Ai", "\u0120+", "\u0120Aj", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120+", "\u0120Ai", "\u0120=", "\u0120j", "\u0120-", "Aj", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120height", "\u0120in", "\u0120enumerate", "(height", "s", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120L", "[i", "\u0120+", "\u0120height", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120R", "[i", "\u0120-", "\u0120height", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120total", "_count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120x", ",", "\u0120count", "_l", "\u0120in", "\u0120list", "(L", ".items", "())", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "_r", "\u0120=", "\u0120R", "[x", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120total", "_count", "\u0120+=", "\u0120count", "_l", "\u0120*", "\u0120count", "_r", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(total", "_count", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p03039", "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)//2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "read", "line", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "**", "8", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "#", "mod", "\u0120=", "\u0120", "9", "9", "8", "2", "4", "4", "3", "5", "3", "\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "**", "1", "8", "\u010a\u010a", "eps", "\u0120=", "\u0120", "1", "0", "**", "-", "7", "\u010a\u010a\u010a\u010a", "m", ",n", ",k", "\u0120=", "\u0120list", "(map", "(int", ",", "read", "line", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120comb", "(n", ",", "\u0120r", ",", "\u0120mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120min", "(r", ",", "\u0120n", "-r", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120mol", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120den", "o", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120r", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120mol", "\u0120=", "\u0120mol", "\u0120*", "\u0120(", "n", "-r", "+i", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120den", "o", "\u0120=", "\u0120den", "o", "\u0120*", "\u0120i", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120mol", "\u0120*", "\u0120pow", "(d", "eno", ",", "\u0120mod", "-", "2", ",", "\u0120mod", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "def", "\u0120f", "1", "(x", ",y", ",a", ",b", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "a", "+b", "-x", "-y", ")*(", "a", "-x", "+", "1", ")*(", "b", "-y", "+", "1", ")//", "2", "\u010a\u010a\u010a\u010a", "def", "\u0120f", "2", "(x", ",a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "a", "-x", ")*(", "a", "-x", "+", "1", ")//", "2", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120x", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120y", "\u0120in", "\u0120range", "(", "1", ",m", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120n", "-x", "+", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120m", "-y", "+", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120m", "*(", "a", "*(", "a", "-", "1", ")+", "x", "*(", "x", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120n", "*(", "b", "*(", "b", "-", "1", ")+", "y", "*(", "y", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120(", "c", "+d", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120%=", "\u0120mod", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120(", "ans", "\u0120*", "\u0120comb", "(m", "*n", "-", "2", ",k", "-", "2", ",", "mod", "))", "%", "mod", "\u010a\u010a", "ans", "\u0120=", "\u0120ans", "*pow", "(", "2", ",", "mod", "-", "2", ",", "mod", ")%", "mod", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a\u010a\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03253", "input": "N,M = list(map(int,input().split()))\n\ndiv =[]\n\nfor i in range(2,int(M**(1/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M = M//i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1: div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum = len(frac)\n\nfor i in range(len(frac)-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1] * (N+50)\n\nfinv[-1] = pow(frac[-1], mod-2, mod)\n\nfor i in range(1, num):\n\n finv[num-1-i] = finv[num-i] * (num-i) % mod\n\nans = 1\n\nfor i in div:\n\n ans = ans * frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)", "input_tokens": ["N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "div", "\u0120=", "[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",int", "(M", "**(", "1", "/", "2", "))+", "2", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cur", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120M", "%i", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120M", "\u0120=", "\u0120M", "//", "i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cur", "\u0120>=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120div", ".append", "(cur", ")\u010a\u010a", "if", "\u0120M", ">", "1", ":", "\u0120div", ".append", "(", "1", ")\u010a\u010a", "div", ".sort", "()\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "frac", "\u0120=", "\u0120[", "1", "]*(", "N", "+", "5", "0", ")\u010a\u010a", "num", "\u0120=", "\u0120len", "(f", "rac", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(f", "rac", ")-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120frac", "[i", "+", "1", "]", "\u0120=", "\u0120frac", "[i", "]*(", "i", "+", "1", ")%", "mod", "\u010a\u010a", "fin", "v", "\u0120=", "\u0120[", "1", "]", "\u0120*", "\u0120(", "N", "+", "5", "0", ")\u010a\u010a", "fin", "v", "[-", "1", "]", "\u0120=", "\u0120pow", "(f", "rac", "[-", "1", "],", "\u0120mod", "-", "2", ",", "\u0120mod", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120num", "):\u010a\u010a", "\u0120", "\u0120fin", "v", "[num", "-", "1", "-i", "]", "\u0120=", "\u0120fin", "v", "[num", "-i", "]", "\u0120*", "\u0120(", "num", "-i", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120div", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120ans", "\u0120*", "\u0120frac", "[N", "+i", "-", "1", "]*", "fin", "v", "[N", "-", "1", "]*", "fin", "v", "[i", "]%", "mod", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.781592256244883, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6855929667625797, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.781592256244883, 0.781592256244883, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.7506053018110229, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.6160583186229708, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6855929667625797, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(c_max+1):\n\n ac = x - (cc // 2)\n\n bc = y - (cc // 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "#", "\u0120print", "(a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "\u0120*", "\u0120(", "1", "0", "\u0120**", "5", ")", "\u0120+", "\u0120", "7", "\u010a\u010a", "c", "_max", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120x", "\u0120>", "\u0120y", ":\u010a\u010a", "\u0120", "\u0120c", "_max", "\u0120=", "\u0120x", "\u0120*", "\u0120", "2", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120c", "_max", "\u0120=", "\u0120y", "\u0120*", "\u0120", "2", "\u010a\u010a\u010a\u010a", "for", "\u0120cc", "\u0120in", "\u0120range", "(c", "_max", "+", "1", "):\u010a\u010a", "\u0120", "\u0120ac", "\u0120=", "\u0120x", "\u0120-", "\u0120(", "cc", "\u0120//", "\u0120", "2", ")\u010a\u010a", "\u0120", "\u0120bc", "\u0120=", "\u0120y", "\u0120-", "\u0120(", "cc", "\u0120//", "\u0120", "2", ")\u010a\u010a", "\u0120\u0120\u010a\u010a", "\u0120", "\u0120if", "\u0120ac", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ac", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120if", "\u0120bc", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120bc", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120price", "\u0120=", "\u0120ac", "\u0120*", "\u0120a", "\u0120+", "\u0120bc", "\u0120*", "\u0120b", "\u0120+", "\u0120cc", "\u0120*", "\u0120c", "\u010a\u010a", "\u0120", "\u0120#", "\u0120print", "('", "price", ":", "\u0120{},", "\u0120ac", ":", "\u0120{},", "\u0120bc", ":", "\u0120{},", "\u0120cc", ":", "\u0120{}'.", "format", "(price", ",", "\u0120ac", ",", "\u0120bc", ",", "\u0120cc", "))\u010a\u010a", "\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120price", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03425", "input": "N = int(input())\n\nname = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor _ in range(N):\n\n S = input()\n\n if(S[0] in name):\n\n name[S[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += name[march[i]] * name[march[j]] * name[march[k]]\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "name", "\u0120=", "\u0120{'", "M", "':", "0", ",", "\u0120'", "A", "':", "0", ",", "\u0120'", "R", "':", "0", ",", "\u0120'", "C", "':", "0", ",", "\u0120'", "H", "':", "0", "}\u010a\u010a", "m", "arch", "\u0120=", "\u0120\"", "M", "ARCH", "\"\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120", "\u0120if", "(S", "[", "0", "]", "\u0120in", "\u0120name", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120name", "[S", "[", "0", "]]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",", "4", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(j", "+", "1", ",", "5", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120name", "[m", "arch", "[i", "]]", "\u0120*", "\u0120name", "[m", "arch", "[j", "]]", "\u0120*", "\u0120name", "[m", "arch", "[k", "]]\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02899", "input": "n = int(input())\n\na = list(map(int,input().split()))\n\nans = [i for i in range(n)]\n\na1 = sorted(a)\n\nfor i in range(n):\n\n num = a[i]\n\n ans[num - 1] = str(i + 1)\n\n \n\nprint((' '.join(ans)))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "a", "1", "\u0120=", "\u0120sorted", "(a", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "[num", "\u0120-", "\u0120", "1", "]", "\u0120=", "\u0120str", "(i", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(('", "\u0120'.", "join", "(ans", ")))"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p02901", "input": "INF = 2*10**7\n\n\n\n\n\ndef main():\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["INF", "\u0120=", "\u0120", "2", "*", "1", "0", "**", "7", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",", "\u0120M", "\u0120=", "\u0120(", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120B", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120C", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120(", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "())\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", ".append", "(a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120B", ".append", "(b", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bit", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120bit", "\u0120|=", "\u0120(", "1", "\u0120<<", "\u0120(", "int", "(i", ")-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120C", ".append", "(bit", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120[[", "INF", "]*(", "1", "\u0120<<", "\u0120N", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", "+", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", "\u0120<<", "\u0120N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "j", "],", "\u0120dp", "[i", "][", "j", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "][", "j", "]", "\u0120!=", "\u0120INF", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120next", "_bit", "\u0120=", "\u0120j", "\u0120|", "\u0120C", "[i", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "next", "_bit", "]", "\u0120=", "\u0120min", "(dp", "[i", "+", "1", "][", "next", "_bit", "],", "\u0120dp", "[i", "][", "j", "]", "\u0120+", "\u0120A", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120dp", "[-", "1", "][-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120ans", "\u0120==", "\u0120INF", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(*", "dp", ",", "\u0120sep", "=\"\\", "n", "\")\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.808526270355906, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.6569022703191485, 0.629235964119581, 0.6838237134005932, 0.6838237134005932, 0.76049478068099, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.8543560820723151, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.5714954628602014, 0.808526270355906, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.5714954628602014, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.8543560820723151, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.808526270355906, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p03253", "input": "def prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num //= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\nfrom math import factorial\n\n\n\n\n\ndef comb(n, r, R):\n\n if n not in R:\n\n a = factorial(n)\n\n R[n] = a\n\n else:\n\n a = R[n]\n\n\n\n if n - r not in R:\n\n b = factorial(n - r)\n\n R[n - r] = b\n\n else:\n\n b = R[n - r]\n\n\n\n if r not in R:\n\n c = factorial(r)\n\n R[r] = c\n\n else:\n\n c = R[r]\n\n return a // (b * c)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nR = dict()\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= comb(v + n - 1, v, R)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n", "input_tokens": ["def", "\u0120prime", "_factor", "ize", "(num", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120This", "\u0120function", "\u0120performs", "\u0120prime", "\u0120factor", "ization", "\u0120on", "\u0120the", "\u0120input", "\u0120natural", "\u0120number", ".\u010a\u010a", "\u0120\u0120\u0120", "\u0120The", "\u0120result", "\u0120is", "\u0120returned", "\u0120in", "\u0120the", "\u0120form", "\u0120of", "\u0120a", "\u0120dictionary", "\u0120with", "\u0120the", "\u0120prime", "\u0120number", "\u0120as", "\u0120the", "\u0120key", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120and", "\u0120its", "\u0120number", "\u0120as", "\u0120the", "\u0120value", ".\u010a\u010a", "\u0120\u0120\u0120", "\u0120:", "param", "\u0120num", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120:", "return", "\u0120prime", "_factor", ":", "\u0120Dictionary", "\u0120with", "\u0120the", "\u0120prime", "\u0120number", "\u0120as", "\u0120the", "\u0120key", "\u0120and", "\u0120its", "\u0120number", "\u0120as", "\u0120the", "\u0120value", ".\u010a\u010a", "\u0120\u0120\u0120", "\u0120\"\"\"\u010a\u010a", "\u0120\u0120\u0120", "\u0120prime", "_factor", "\u0120=", "\u0120{}\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120i", "\u0120**", "\u0120", "2", "\u0120<=", "\u0120num", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120num", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120//=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120in", "\u0120list", "(pr", "ime", "_factor", ".keys", "())", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prime", "_factor", "[i", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prime", "_factor", "[i", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120num", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120prime", "_factor", "[num", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120prime", "_factor", "\u010a\u010a\u010a\u010a\u010a\u010a", "from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120comb", "(n", ",", "\u0120r", ",", "\u0120R", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120not", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120factorial", "(n", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120R", "[n", "]", "\u0120=", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120R", "[n", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120-", "\u0120r", "\u0120not", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120factorial", "(n", "\u0120-", "\u0120r", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120R", "[n", "\u0120-", "\u0120r", "]", "\u0120=", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120R", "[n", "\u0120-", "\u0120r", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120not", "\u0120in", "\u0120R", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120factorial", "(r", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120R", "[r", "]", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120R", "[r", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120a", "\u0120//", "\u0120(", "b", "\u0120*", "\u0120c", ")\u010a\u010a\u010a\u010a\u010a\u010a", "n", ",", "\u0120m", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "r", "\u0120=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "R", "\u0120=", "\u0120dict", "()\u010a\u010a", "prime", "_fac", "\u0120=", "\u0120prime", "_factor", "ize", "(m", ")\u010a\u010a", "for", "\u0120v", "\u0120in", "\u0120list", "(pr", "ime", "_fac", ".values", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120*=", "\u0120comb", "(v", "\u0120+", "\u0120n", "\u0120-", "\u0120", "1", ",", "\u0120v", ",", "\u0120R", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "\u0120+", "\u0120", "7", "\u010a\u010a", "print", "((", "r", "\u0120%", "\u0120mod", "))\u010a"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.7681534551894282, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308]} +{"problem_id": "p02951", "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif a < b + c:\n\n print((b+c-a))\n\nelse:\n\n print((0))", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "if", "\u0120a", "\u0120<", "\u0120b", "\u0120+", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "b", "+c", "-a", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7640031686476719]} +{"problem_id": "p03038", "input": "from collections import Counter\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\nX = Counter(A)\n\nfor i in range(M):\n\n B, C = list(map(int, input().split()))\n\n X[C] += B\n\n\n\nZ = []\n\nfor key, value in list(X.items()):\n\n Z.append((key, value))\n\n\n\nZ.sort(key=lambda x: x[0], reverse=True)\n\n\n\nans = 0\n\ncnt = 0\n\n\n\nfor value, key in Z:\n\n if cnt + key <= N:\n\n ans += key * value\n\n cnt += key\n\n else:\n\n ans += (N - cnt) * value\n\n break\n\n\n\nprint(ans)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "X", "\u0120=", "\u0120Counter", "(A", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120B", ",", "\u0120C", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "[C", "]", "\u0120+=", "\u0120B", "\u010a\u010a\u010a\u010a", "Z", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120key", ",", "\u0120value", "\u0120in", "\u0120list", "(X", ".items", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120Z", ".append", "((", "key", ",", "\u0120value", "))", "\u010a\u010a\u010a\u010a", "Z", ".sort", "(key", "=lambda", "\u0120x", ":", "\u0120x", "[", "0", "],", "\u0120reverse", "=True", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120value", ",", "\u0120key", "\u0120in", "\u0120Z", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "\u0120+", "\u0120key", "\u0120<=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120key", "\u0120*", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120key", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120(", "N", "\u0120-", "\u0120cnt", ")", "\u0120*", "\u0120value", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03723", "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif any(i % 2 != 0 for i in [a, b, c]):\n\n print((0))\n\n exit()\n\n\n\nif a == b and b == c:\n\n print((-1))\n\n exit()\n\n\n\ncnt = 0\n\na_list = [0]*(1001001)\n\nb_list = [0]*(1001001)\n\nc_list = [0]*(1001001)\n\na_list[0] = a\n\nb_list[0] = b\n\nc_list[0] = c\n\n\n\nfor i in range(1, 1001001):\n\n a_list[i] = (b_list[i-1] + c_list[i-1]) // 2\n\n b_list[i] = (c_list[i-1] + a_list[i-1]) // 2\n\n c_list[i] = (a_list[i-1] + b_list[i-1]) // 2\n\n cnt += 1\n\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n\n break\n\n\n\nprint(cnt)\n", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "if", "\u0120any", "(i", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120[", "a", ",", "\u0120b", ",", "\u0120c", "])", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "if", "\u0120a", "\u0120==", "\u0120b", "\u0120and", "\u0120b", "\u0120==", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "a", "_list", "\u0120=", "\u0120[", "0", "]*(", "1", "0", "0", "1", "0", "0", "1", ")\u010a\u010a", "b", "_list", "\u0120=", "\u0120[", "0", "]*(", "1", "0", "0", "1", "0", "0", "1", ")\u010a\u010a", "c", "_list", "\u0120=", "\u0120[", "0", "]*(", "1", "0", "0", "1", "0", "0", "1", ")\u010a\u010a", "a", "_list", "[", "0", "]", "\u0120=", "\u0120a", "\u010a\u010a", "b", "_list", "[", "0", "]", "\u0120=", "\u0120b", "\u010a\u010a", "c", "_list", "[", "0", "]", "\u0120=", "\u0120c", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "0", "1", "0", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "_list", "[i", "]", "\u0120=", "\u0120(", "b", "_list", "[i", "-", "1", "]", "\u0120+", "\u0120c", "_list", "[i", "-", "1", "])", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "_list", "[i", "]", "\u0120=", "\u0120(", "c", "_list", "[i", "-", "1", "]", "\u0120+", "\u0120a", "_list", "[i", "-", "1", "])", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "_list", "[i", "]", "\u0120=", "\u0120(", "a", "_list", "[i", "-", "1", "]", "\u0120+", "\u0120b", "_list", "[i", "-", "1", "])", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "_list", "[i", "]", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", "\u0120or", "\u0120b", "_list", "[i", "]", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", "\u0120or", "\u0120c", "_list", "[i", "]", "\u0120%", "\u0120", "2", "\u0120!=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.9178879013889365, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03013", "input": "from functools import lru_cache\n\nimport sys\n\nsys.setrecursionlimit(30000)\n\n\n\nN, M = list(map(int, input().split()))\n\na = list(int(input()) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nisOk = True\n\nfor i in range(M-1):\n\n if a[i] + 1 == a[i+1]:\n\n isOk = False\n\n \n\nfuncb = [-1] * 100001\n\ndef func(n):\n\n if n <= 0:\n\n return 1\n\n cnt = funcb[n]\n\n if cnt > 0:\n\n return cnt\n\n cnt = 0\n\n if n >= 2:\n\n cnt += func(n-2)\n\n if n >= 1:\n\n cnt += func(n-1)\n\n funcb[n] = cnt % MOD\n\n return funcb[n]\n\n\n\nfunc(30000)\n\nfunc(50000)\n\nfunc(80000)\n\nfunc(100000)\n\n\n\nif not isOk:\n\n print((0))\n\nelse:\n\n ans = 1\n\n s = 0\n\n for i in range(M+1):\n\n if i >= M:\n\n e = N\n\n else:\n\n e = a[i] - 1\n\n\n\n ans = ans * func(e-s) % MOD\n\n\n\n if i >= M:\n\n break\n\n\n\n s = a[i] + 1\n\n\n\n print(ans)\n", "input_tokens": ["from", "\u0120functools", "\u0120import", "\u0120l", "ru", "_cache", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "3", "0", "0", "0", "0", ")\u010a\u010a\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(int", "(input", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", "))", "\u010a\u010a\u010a\u010a", "MOD", "\u0120=", "\u0120pow", "(", "1", "0", ",", "\u0120", "9", ")", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "isOk", "\u0120=", "\u0120True", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[i", "]", "\u0120+", "\u0120", "1", "\u0120==", "\u0120a", "[i", "+", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120is", "Ok", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "func", "b", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120", "1", "0", "0", "0", "0", "1", "\u010a\u010a", "def", "\u0120func", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120<=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120func", "b", "[n", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120cnt", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120>=", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120func", "(n", "-", "2", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120>=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120func", "(n", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120func", "b", "[n", "]", "\u0120=", "\u0120cnt", "\u0120%", "\u0120MOD", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120func", "b", "[n", "]\u010a\u010a\u010a\u010a", "func", "(", "3", "0", "0", "0", "0", ")\u010a\u010a", "func", "(", "5", "0", "0", "0", "0", ")\u010a\u010a", "func", "(", "8", "0", "0", "0", "0", ")\u010a\u010a", "func", "(", "1", "0", "0", "0", "0", "0", ")\u010a\u010a\u010a\u010a", "if", "\u0120not", "\u0120is", "Ok", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120>=", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120e", "\u0120=", "\u0120N", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120e", "\u0120=", "\u0120a", "[i", "]", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120ans", "\u0120*", "\u0120func", "(e", "-s", ")", "\u0120%", "\u0120MOD", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120>=", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120a", "[i", "]", "\u0120+", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6448923330239924, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02921", "input": "# 2019-11-17 20:44:23(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# import re\n\n# import heapq\n\n# import array\n\n# from scipy.misc import comb # (default: exact=False)\n\n# import numpy as np \n\n\n\n\n\ndef main():\n\n s, t = sys.stdin.read().split()\n\n\n\n count = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "input_tokens": ["#", "\u0120", "2", "0", "1", "9", "-", "1", "1", "-", "1", "7", "\u0120", "2", "0", ":", "4", "4", ":", "2", "3", "(J", "ST", ")\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "#", "\u0120import", "\u0120collections", "\u010a\u010a", "#", "\u0120import", "\u0120math", "\u010a\u010a", "#", "\u0120from", "\u0120string", "\u0120import", "\u0120ascii", "_lowercase", ",", "\u0120ascii", "_upper", "case", ",", "\u0120digits", "\u010a\u010a", "#", "\u0120from", "\u0120bis", "ect", "\u0120import", "\u0120bis", "ect", "_left", "\u0120as", "\u0120bi", "_l", ",", "\u0120bis", "ect", "_right", "\u0120as", "\u0120bi", "_r", "\u010a\u010a", "#", "\u0120import", "\u0120itertools", "\u010a\u010a", "#", "\u0120from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a\u010a", "#", "\u0120import", "\u0120operator", "\u0120as", "\u0120op", "\u010a\u010a", "#", "\u0120import", "\u0120re", "\u010a\u010a", "#", "\u0120import", "\u0120heapq", "\u010a\u010a", "#", "\u0120import", "\u0120array", "\u010a\u010a", "#", "\u0120from", "\u0120scipy", ".misc", "\u0120import", "\u0120comb", "\u0120#", "\u0120(", "default", ":", "\u0120exact", "=False", ")\u010a\u010a", "#", "\u0120import", "\u0120numpy", "\u0120as", "\u0120np", "\u0120", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", ",", "\u0120t", "\u0120=", "\u0120sys", ".stdin", ".read", "().", "split", "()\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "3", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120==", "\u0120t", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(count", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.9417384445194967, 0.5851191688414608, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.6270757423345348, 0.6270757423345348, 0.6673426178365944, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.8474406118450124, 0.5851191688414608, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217]} +{"problem_id": "p03416", "input": "# author: kagemeka \n\n# created: 2019-11-06 21:30:22(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\n# import statistics\n\n# import functools\n\n# import operator\n\n\n\ndef main():\n\n a, b = (int(x) for x in sys.stdin.read().split())\n\n\n\n count = 0\n\n for n in range(a, b+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n count += 1\n\n\n\n print(count) \n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n", "input_tokens": ["#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120author", ":", "\u0120", "\u0120k", "agem", "eka", "\u0120\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120created", ":", "\u0120", "2", "0", "1", "9", "-", "1", "1", "-", "0", "6", "\u0120", "2", "1", ":", "3", "0", ":", "2", "2", "(J", "ST", ")\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "#", "\u0120import", "\u0120collections", "\u010a\u010a", "#", "\u0120import", "\u0120math", "\u010a\u010a", "#", "\u0120import", "\u0120string", "\u010a\u010a", "#", "\u0120import", "\u0120bis", "ect", "\u010a\u010a", "#", "\u0120import", "\u0120re", "\u010a\u010a", "#", "\u0120import", "\u0120itertools", "\u010a\u010a", "#", "\u0120import", "\u0120statistics", "\u010a\u010a", "#", "\u0120import", "\u0120functools", "\u010a\u010a", "#", "\u0120import", "\u0120operator", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120(", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120sys", ".stdin", ".read", "().", "split", "())\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120n", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120str", "(n", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120n", "[::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(count", ")", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120execute", "\u0120only", "\u0120if", "\u0120run", "\u0120as", "\u0120a", "\u0120script", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.6160583186229708, 0.6160583186229708, 0.6514299043837268, 0.7186273667339679, 0.7186273667339679, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.8116478083709829, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8116478083709829]} +{"problem_id": "p02767", "input": "N = int(input())\n\nX = list(map(int, input().split()))\n\nX = list(sorted(X))\n\nif N == 1:\n\n print((0))\n\n exit()\n\nans = float('inf')\n\nfor p in range(X[0], X[N - 1] + 1):\n\n sum = 0\n\n for x in X:\n\n sum += (x - p) ** 2\n\n ans = min(sum, ans)\n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "X", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "X", "\u0120=", "\u0120list", "(sorted", "(X", "))\u010a\u010a", "if", "\u0120N", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120", "\u0120exit", "()\u010a\u010a", "ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "for", "\u0120p", "\u0120in", "\u0120range", "(X", "[", "0", "],", "\u0120X", "[N", "\u0120-", "\u0120", "1", "]", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120", "\u0120sum", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120for", "\u0120x", "\u0120in", "\u0120X", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "\u0120+=", "\u0120(", "x", "\u0120-", "\u0120p", ")", "\u0120**", "\u0120", "2", "\u010a\u010a", "\u0120", "\u0120ans", "\u0120=", "\u0120min", "(sum", ",", "\u0120ans", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.8284253466378658, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02725", "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd = [0] * n\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d[i] = a[i + 1] - a[i]\n\n d_max = max(d_max, d[i])\n\n\n\nd[-1] = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d[-1])\n\n\n\nprint((k - d_max))\n", "input_tokens": ["k", ",", "\u0120n", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "d", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120n", "\u010a\u010a", "d", "_max", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "\u0120-", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "[i", "]", "\u0120=", "\u0120a", "[i", "\u0120+", "\u0120", "1", "]", "\u0120-", "\u0120a", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "_max", "\u0120=", "\u0120max", "(d", "_max", ",", "\u0120d", "[i", "])\u010a\u010a", "\u010a\u010a", "d", "[-", "1", "]", "\u0120=", "\u0120(", "k", "\u0120-", "\u0120a", "[-", "1", "])", "\u0120+", "\u0120a", "[", "0", "]\u010a\u010a", "d", "_max", "\u0120=", "\u0120max", "(d", "_max", ",", "\u0120d", "[-", "1", "])\u010a\u010a", "\u010a\u010a", "print", "((", "k", "\u0120-", "\u0120d", "_max", "))\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p02822", "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\ninv2 = (mod + 1) // 2\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n\n for j in X[i]:\n\n s = (s * pow(inv2, A[j], mod)) % mod\n\n t = (t + (1-pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "X", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "[x", "-", "1", "].", "append", "(y", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120X", "[y", "-", "1", "].", "append", "(x", "-", "1", ")\u010a\u010a", "i", "0", "\u0120=", "\u0120min", "([", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")", "\u0120if", "\u0120len", "(X", "[i", "])", "\u0120==", "\u0120", "1", "])\u010a\u010a", "\u010a\u010a", "P", "\u0120=", "\u0120[-", "1", "]", "\u0120*", "\u0120N", "\u010a\u010a", "Q", "\u0120=", "\u0120deque", "([", "i", "0", "])\u010a\u010a", "R", "\u0120=", "\u0120[]\u010a\u010a", "while", "\u0120Q", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120deque", ".p", "opleft", "(Q", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", ".append", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120X", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120!=", "\u0120P", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120P", "[a", "]", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120X", "[a", "].", "remove", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120deque", ".append", "(Q", ",", "\u0120a", ")\u010a\u010a\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u0120+", "\u0120", "7", "\u010a\u010a", "inv", "2", "\u0120=", "\u0120(", "mod", "\u0120+", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "A", "\u0120=", "\u0120[", "1", "]", "\u0120*", "\u0120N", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120R", "[::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120X", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120A", "[i", "]", "\u0120+=", "\u0120A", "[j", "]\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120pow", "(inv", "2", ",", "\u0120N", "\u0120-", "\u0120A", "[i", "],", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120", "1", "\u0120+", "\u0120(", "1", "-p", "ow", "(inv", "2", ",", "\u0120N", "\u0120-", "\u0120A", "[i", "],", "\u0120mod", "))", "\u0120*", "\u0120pow", "(", "2", ",", "\u0120N", "\u0120-", "\u0120A", "[i", "],", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120X", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120(", "s", "\u0120*", "\u0120pow", "(inv", "2", ",", "\u0120A", "[j", "],", "\u0120mod", "))", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120(", "t", "\u0120+", "\u0120(", "1", "-p", "ow", "(inv", "2", ",", "\u0120A", "[j", "],", "\u0120mod", "))", "\u0120*", "\u0120pow", "(", "2", ",", "\u0120A", "[j", "],", "\u0120mod", "))", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120(", "ans", "\u0120+", "\u0120", "1", "\u0120-", "\u0120s", "\u0120*", "\u0120t", ")", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "print", "((", "ans", "\u0120*", "\u0120inv", "2", "\u0120%", "\u0120mod", "))"], "input_token_weights": [0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8981772421402056, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.9401584547236118, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8317036996956922, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.808526270355906, 0.8765066796615488, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8765066796615488, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.8543560820723151, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.8765066796615488, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.7355852514485495, 0.7355852514485495, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.7100393521462953, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.9193881350322848, 0.8981772421402056, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.8981772421402056]} +{"problem_id": "p03796", "input": "from math import factorial\n\ndef myAnswer(N:int) ->int:\n\n ans =factorial(N)\n\n return ans % (10**9 + 7)\n\n\n\ndef modelAnswer():\n\n tmp=1\n\ndef main():\n\n N = int(input())\n\n print((myAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u010a\u010a", "def", "\u0120my", "Answer", "(N", ":int", ")", "\u0120->", "int", ":\u010a\u010a", "\u0120\u0120", "\u0120ans", "\u0120=", "factor", "ial", "(N", ")\u010a\u010a", "\u0120\u0120", "\u0120return", "\u0120ans", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")\u010a\u010a\u010a\u010a", "def", "\u0120model", "Answer", "():\u010a\u010a", "\u0120\u0120", "\u0120tmp", "=", "1", "\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120", "\u0120print", "((", "my", "Answer", "(N", ")))\u010a\u010a", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.8691775287719905, 0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.7584425223266994, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6339004969859428, 0.7584425223266994, 0.5886835746651548, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994]} +{"problem_id": "p03854", "input": "s = input()[::-1]\n\n\n\nwhile True:\n\n if len(s) == 0:\n\n break\n\n if s[:7] == \"remaerd\":\n\n s = s[7:]\n\n elif s[:6] == \"resare\":\n\n s = s[6:]\n\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n\n s = s[5:]\n\n else:\n\n print(\"NO\")\n\n exit()\n\n\n\nprint(\"YES\")", "input_tokens": ["s", "\u0120=", "\u0120input", "()[", "::-", "1", "]\u010a\u010a\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120len", "(s", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[:", "7", "]", "\u0120==", "\u0120\"", "rema", "erd", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120s", "[", "7", ":]\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120s", "[:", "6", "]", "\u0120==", "\u0120\"", "res", "are", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120s", "[", "6", ":]\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120s", "[:", "5", "]", "\u0120==", "\u0120\"", "ma", "erd", "\"", "\u0120or", "\u0120s", "[:", "5", "]", "\u0120==", "\u0120\"", "es", "are", "\":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120s", "[", "5", ":]\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "print", "(\"", "YES", "\")"], "input_token_weights": [0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.8474406118450124, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8474406118450124, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7792424376220217, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.7060506397782503, 0.5851191688414608, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7060506397782503, 0.7433160191943734, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.8139227859741643, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.6270757423345348, 0.6673426178365944, 0.5851191688414608, 0.8139227859741643, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.7060506397782503, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.7060506397782503, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.8139227859741643, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.6270757423345348, 0.6673426178365944, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.7060506397782503, 0.6673426178365944, 0.6270757423345348, 0.6673426178365944, 0.5851191688414608, 0.7060506397782503, 0.6673426178365944, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8474406118450124]} +{"problem_id": "p03074", "input": "import sys\n\nstdin = sys.stdin \n\nni = lambda: int(ns())\n\nna = lambda: list(map(int, stdin.readline().split()))\n\nns = lambda: stdin.readline()\n\n\n\ndef Solve():\n\n N,K=na()\n\n S=[int(d) for d in input()]\n\n l=[]\n\n N=len(S)\n\n if(S[0]==0):\n\n l.append(0)\n\n b=S[0]\n\n ct=1\n\n for i in S[1:]:\n\n if(b!=i):\n\n l.append(ct)\n\n ct=1\n\n b=i\n\n else:\n\n ct+=1\n\n l.append(ct)\n\n len_l=len(l)\n\n if(len_l//2 <= K):\n\n return sum(l)\n\n ans = res = sum(l[:2*K+1])\n\n \n\n if(len_l%2==0):\n\n l.append(0)\n\n len_l+=1\n\n g = K * 2 + 1\n\n for i in range(K*2+1,len_l-1,2):\n\n ans -= l[i-g] + l[i-g+1]\n\n ans += l[i] + l[1+i]\n\n if(resb>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile a>b>c:\n\n\t\t\tif a>b>c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1\n\n\t\t\t", "input_tokens": ["while", "\u0120True", ":\u010a\u010a", "\u0109k", "=list", "(map", "(int", ",input", "().", "split", "(\"", "\u0120\"", ")))\u010a\u010a", "\u0109if", "\u0120k", "[", "0", "]==", "k", "[", "1", "]==", "0", ":\u010a\u010a", "\u0109", "\u0109break", "\u010a\u010a", "\u0109ct", "=", "0", "\u010a\u010a", "\u0109a", "=", "0", "\u010a\u010a", "\u0109b", "=", "0", "\u010a\u010a", "\u0109c", "=", "0", "\u0109\u010a\u010a", "\u0109max", "=k", "[", "0", "]\u010a\u010a", "\u0109sum", "=k", "[", "1", "]\u010a\u010a", "\u0109a", "=max", "+", "1", "\u010a\u010a", "\u0109\u010a\u010a", "\u0109while", "\u0120True", ":\u010a\u010a", "\u0109", "\u0109a", "-=", "1", "\u010a\u010a", "\u0109", "\u0109b", "=a", "-", "1", "\u010a\u010a", "\u0109", "\u0109c", "=sum", "-a", "-b", "\u010a\u010a", "\u0109", "\u0109if", "\u0120not", "\u0120a", ">b", ">c", ":\u010a\u010a", "\u0109\u0109", "\u0109print", "(ct", ")\u010a\u010a", "\u0109\u0109", "\u0109break", "\u010a\u010a", "\u0109", "\u0109while", "\u0120a", ">b", ">c", ":\u010a\u010a", "\u0109\u0109", "\u0109if", "\u0120a", ">b", ">c", ">", "0", ":\u010a\u010a", "\u0109\u0109\u0109", "\u0109ct", "+=", "1", "\u010a\u010a", "\u0109\u0109", "\u0109b", "-=", "1", "\u010a\u010a", "\u0109\u0109", "\u0109c", "+=", "1", "\u010a\u010a", "\u0109\u0109\u0109"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397]} +{"problem_id": "p04044", "input": "n, l = list(map(int, input().split()))\n\nS = [input() for i in range(n)]\n\nS.sort()\n\nprint((\"\".join(S)))", "input_tokens": ["n", ",", "\u0120l", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "S", "\u0120=", "\u0120[", "input", "()", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "S", ".sort", "()\u010a\u010a", "print", "((\"", "\".", "join", "(S", ")))"], "input_token_weights": [0.833611120734537, 0.833611120734537, 0.833611120734537, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.6339004969859428, 0.6339004969859428, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.8691775287719905, 0.833611120734537, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.833611120734537]} +{"problem_id": "p03644", "input": "N = int(input())\n\nif N < 2:\n\n print(N)\n\nelif 2<=N<4:\n\n print((2))\n\nelif 4<=N<8:\n\n print((4))\n\nelif 8<=N<16:\n\n print((8))\n\nelif 16<=N<32:\n\n print((16))\n\nelif 32<=N<64:\n\n print((32))\n\nelif 64<=N:\n\n print((64))", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "if", "\u0120N", "\u0120<", "\u0120", "2", ":\u010a\u010a", "\u0120", "\u0120print", "(N", ")\u010a\u010a", "elif", "\u0120", "2", "<=", "N", "<", "4", ":\u010a\u010a", "\u0120", "\u0120print", "((", "2", "))\u010a\u010a", "elif", "\u0120", "4", "<=", "N", "<", "8", ":\u010a\u010a", "\u0120", "\u0120print", "((", "4", "))\u010a\u010a", "elif", "\u0120", "8", "<=", "N", "<", "1", "6", ":\u010a\u010a", "\u0120", "\u0120print", "((", "8", "))\u010a\u010a", "elif", "\u0120", "1", "6", "<=", "N", "<", "3", "2", ":\u010a\u010a", "\u0120", "\u0120print", "((", "1", "6", "))\u010a\u010a", "elif", "\u0120", "3", "2", "<=", "N", "<", "6", "4", ":\u010a\u010a", "\u0120", "\u0120print", "((", "3", "2", "))\u010a\u010a", "elif", "\u0120", "6", "4", "<=", "N", ":\u010a\u010a", "\u0120", "\u0120print", "((", "6", "4", "))"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.89427190936908, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.89427190936908, 0.5928797394668679, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.5928797394668679, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6886415962350058, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.5928797394668679, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6886415962350058, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.5928797394668679, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6886415962350058, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.5928797394668679, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.5928797394668679, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.8563901704123833, 0.5928797394668679, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.8563901704123833, 0.5928797394668679, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058]} +{"problem_id": "p03037", "input": "N, M = list(map(int, input().split()))\n\nLR = [list(map(int, input().split())) for _ in range(M)]\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor l, r in LR:\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n", "input_tokens": ["N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "LR", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(M", ")]", "\u010a\u010a\u010a\u010a", "left", "\u0120=", "\u0120", "1", "\u010a\u010a", "right", "\u0120=", "\u0120N", "\u010a\u010a\u010a\u010a", "for", "\u0120l", ",", "\u0120r", "\u0120in", "\u0120LR", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120left", "\u0120<", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120left", "\u0120=", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120right", "\u0120>", "\u0120r", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120right", "\u0120=", "\u0120r", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120right", "\u0120-", "\u0120left", "\u010a\u010a\u010a\u010a", "print", "((", "ans", "\u0120+", "\u0120", "1", "\u0120if", "\u0120ans", "\u0120>=", "\u0120", "0", "\u0120else", "\u0120", "0", "))\u010a"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8691775287719905]} +{"problem_id": "p03293", "input": "s = input()\n\nt = input()\n\nfor i in range(len(s)):\n\n if s[i:]+s[:i]==t:\n\n print('Yes')\n\n exit()\n\nprint('No')", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a", "t", "\u0120=", "\u0120input", "()\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", ":", "]+", "s", "[:", "i", "]==", "t", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "Yes", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "print", "('", "No", "')"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.7584425223266994, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.6771609938949378, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.7186273667339679, 0.6771609938949378, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.833611120734537]} +{"problem_id": "p03060", "input": "n = int(input())\n\nv = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\nresult = 0\n\nfor i in range(n):\n\n if v[i] > c[i]:\n\n result += v[i] - c[i]\n\nprint(result)", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "v", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "result", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120v", "[i", "]", "\u0120>", "\u0120c", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120result", "\u0120+=", "\u0120v", "[i", "]", "\u0120-", "\u0120c", "[i", "]\u010a\u010a", "print", "(result", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03416", "input": "a,b = list(map(int,input().split()))\n\nanswer = 0\n\nfor i in range(a,b+1) :\n\n j = str(i)\n\n p1 = j[4]\n\n p2 = j[3]\n\n p3 = j[2]\n\n p4 = j[1]\n\n p5 = j[0]\n\n k = int(p1+p2+p3+p4+p5)\n\n if i == k :\n\n answer += 1\n\nprint(answer)\n\n\n", "input_tokens": ["a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "answer", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", ")", "\u0120:\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "1", "\u0120=", "\u0120j", "[", "4", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "2", "\u0120=", "\u0120j", "[", "3", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "3", "\u0120=", "\u0120j", "[", "2", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "4", "\u0120=", "\u0120j", "[", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "5", "\u0120=", "\u0120j", "[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120int", "(p", "1", "+p", "2", "+p", "3", "+p", "4", "+p", "5", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120k", "\u0120:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120answer", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(answer", ")\u010a\u010a\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03721", "input": "N,K=list(map(int,input().split()))\n\ndic={}\n\nfor i in range(N):\n\n a,b=list(map(int,input().split()))\n\n if a in dic:\n\n dic[a]+=b\n\n else:\n\n dic[a]=b\n\n \n\ndic=sorted(list(dic.items()),key=lambda x:x[0])\n\nfor d in range(len(dic)):\n\n amount=dic[d][1]\n\n if amount>=K:\n\n print((dic[d][0]))\n\n exit(0)\n\n else:\n\n K-=amount\n\n ", "input_tokens": ["N", ",K", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "dic", "={", "}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120a", ",b", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120if", "\u0120a", "\u0120in", "\u0120dic", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120dic", "[a", "]+=", "b", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120dic", "[a", "]=", "b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "dic", "=", "sorted", "(list", "(dic", ".items", "()),", "key", "=lambda", "\u0120x", ":x", "[", "0", "])\u010a\u010a", "for", "\u0120d", "\u0120in", "\u0120range", "(len", "(dic", "))", ":\u010a\u010a", "\u0120", "\u0120amount", "=d", "ic", "[d", "][", "1", "]\u010a\u010a", "\u0120", "\u0120if", "\u0120amount", ">=", "K", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "dic", "[d", "][", "0", "]))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120K", "-=", "amount", "\u010a\u010a", "\u0120\u0120"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397]} +{"problem_id": "p03814", "input": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n\n# Python 1st Try\n\nimport copy\n\n\n\n\n\nclass Problem:\n\n def __init__(self, stringdata):\n\n self.stringdata = stringdata\n\n\n\n def solver(self):\n\n strcont = copy.copy(self.stringdata)\n\n result = 0\n\n rightposition = 0\n\n leftposition = len(strcont)\n\n j = 0\n\n while True:\n\n if strcont[j] == 'A':\n\n rightposition = j\n\n break\n\n else:\n\n j = j + 1\n\n j = leftposition - 1\n\n while True:\n\n if strcont[j] == 'Z':\n\n leftposition = j\n\n break\n\n else:\n\n j = j - 1\n\n\n\n result = leftposition - rightposition + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = input()\n\n print((\"{}\".format(Problem(s).solver())))\n", "input_tokens": ["#", "\u0120Problem", "\u0120https", "://", "at", "coder", ".jp", "/", "cont", "ests", "/", "abc", "0", "5", "3", "/tasks", "/", "abc", "0", "5", "3", "_b", "\u010a\u010a", "#", "\u0120Python", "\u0120", "1", "st", "\u0120Try", "\u010a\u010a", "import", "\u0120copy", "\u010a\u010a\u010a\u010a\u010a\u010a", "class", "\u0120Problem", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120__", "init", "__(", "self", ",", "\u0120string", "data", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120self", ".string", "data", "\u0120=", "\u0120string", "data", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120solver", "(self", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120str", "cont", "\u0120=", "\u0120copy", ".copy", "(self", ".string", "data", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120result", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120right", "position", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120left", "position", "\u0120=", "\u0120len", "(str", "cont", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120str", "cont", "[j", "]", "\u0120==", "\u0120'", "A", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120right", "position", "\u0120=", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120j", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120left", "position", "\u0120-", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120str", "cont", "[j", "]", "\u0120==", "\u0120'", "Z", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120left", "position", "\u0120=", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120j", "\u0120-", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120result", "\u0120=", "\u0120left", "position", "\u0120-", "\u0120right", "position", "\u0120+", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120result", "\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((\"", "{}\".", "format", "(", "Problem", "(s", ").", "solver", "())))\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.6115475853143139, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.6115475853143139, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.8245182914059852]} +{"problem_id": "p03000", "input": "from itertools import accumulate\n\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\n\nL = list(tuple(map(int, input().split())))\n\n\n\nacc = sorted(list(accumulate(L)) + [0])\n\n\n\nn = bisect_right(acc,X)\n\nprint(n)\n\n\n", "input_tokens": ["from", "\u0120itertools", "\u0120import", "\u0120accumulate", "\u010a\u010a", "from", "\u0120bis", "ect", "\u0120import", "\u0120*\u010a\u010a", "N", ",", "\u0120X", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120list", "(tuple", "(map", "(int", ",", "\u0120input", "().", "split", "()))", ")\u010a\u010a\u010a\u010a", "acc", "\u0120=", "\u0120sorted", "(list", "(", "accumulate", "(L", "))", "\u0120+", "\u0120[", "0", "])\u010a\u010a", "\u010a\u010a", "n", "\u0120=", "\u0120bis", "ect", "_right", "(acc", ",X", ")\u010a\u010a", "print", "(n", ")\u010a\u010a\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7681534551894282, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03416", "input": "A, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n n_s = str(n)\n\n n_s_rvs = n_s[::-1]\n\n if n_s == n_s_rvs:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "input_tokens": ["A", ",", "\u0120B", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120n", "\u0120in", "\u0120range", "(A", ",", "\u0120B", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "_s", "\u0120=", "\u0120str", "(n", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "_s", "_r", "vs", "\u0120=", "\u0120n", "_s", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "_s", "\u0120==", "\u0120n", "_s", "_r", "vs", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03796", "input": "import math\n\nN=int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "=int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(N", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p03371", "input": "# ABC95 C -Half and Half\n\na,b,c,x,y = list(map(float,input().split()))\n\nans = 0\n\nif a+b > 2*c:\n\n while x != 0.0 and y != 0.0:\n\n ans += 2*c\n\n x -= 1.0\n\n y -= 1.0\n\n if y == 0.0:\n\n while x != 0.0:\n\n if a > 2*c:\n\n ans += 2*c\n\n x -= 1.0\n\n else:\n\n ans += a\n\n x -= 1.0\n\n if x == 0.0:\n\n while y != 0.0:\n\n if b > 2*c:\n\n ans += 2*c\n\n y -= 1.0\n\n else:\n\n ans += b\n\n y -= 1.0\n\nelse:\n\n ans += a*x + b*y\n\nprint((int(ans)))\n\n\n\n ", "input_tokens": ["#", "\u0120ABC", "9", "5", "\u0120C", "\u0120-", "Half", "\u0120and", "\u0120Half", "\u010a\u010a", "a", ",b", ",c", ",x", ",y", "\u0120=", "\u0120list", "(map", "(float", ",input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "if", "\u0120a", "+b", "\u0120>", "\u0120", "2", "*c", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120!=", "\u0120", "0", ".", "0", "\u0120and", "\u0120y", "\u0120!=", "\u0120", "0", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "2", "*c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120y", "\u0120==", "\u0120", "0", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120x", "\u0120!=", "\u0120", "0", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120>", "\u0120", "2", "*c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "2", "*c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120==", "\u0120", "0", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120y", "\u0120!=", "\u0120", "0", ".", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120b", "\u0120>", "\u0120", "2", "*c", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120", "2", "*c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120-=", "\u0120", "1", ".", "0", "\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120a", "*x", "\u0120+", "\u0120b", "*y", "\u010a\u010a", "print", "((", "int", "(ans", "))", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120"], "input_token_weights": [0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.5749858371565393, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.5749858371565393, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.5749858371565393, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.5749858371565393, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8099046207685895, 0.860922050467044, 0.8854867975141383, 0.5749858371565393]} +{"problem_id": "p02595", "input": "N, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x ** 2 + y ** 2 <= D ** 2:\n\n cnt += 1\n\n \n\nprint(cnt)", "input_tokens": ["N", ",", "\u0120D", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120**", "\u0120", "2", "\u0120+", "\u0120y", "\u0120**", "\u0120", "2", "\u0120<=", "\u0120D", "\u0120**", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(cnt", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02814", "input": "from math import gcd\n\n\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\n\n\na=list([x//2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) // gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\n\n\nif (lcma//a[0])%2==0:\n\n print((0))\n\nelse:\n\n flg=0\n\n for i in range(1,len(a)):\n\n if (lcma//a[i])%2==0:\n\n print((0))\n\n flg=1\n\n break\n\n if flg==0:\n\n temp=m//lcma\n\n print((temp//2 if temp%2==0 else temp//2+1))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a\u010a\u010a", "n", ",m", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=list", "(set", "(a", "))", "\u010a\u010a\u010a\u010a", "a", "=list", "([", "x", "//", "2", "\u0120for", "\u0120x", "\u0120in", "\u0120a", "])\u010a\u010a", "\u010a\u010a", "def", "\u0120lcm", "(q", "):\u010a\u010a", "\u0120", "\u0120x", "\u0120=", "\u0120q", "[", "0", "]\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120len", "(q", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "\u0120*", "\u0120q", "[i", "])", "\u0120//", "\u0120gcd", "(x", ",", "\u0120q", "[i", "])\u010a\u010a", "\u0120", "\u0120return", "\u0120x", "\u010a\u010a\u010a\u010a", "lc", "ma", "=l", "cm", "(a", ")\u010a\u010a\u010a\u010a", "if", "\u0120(", "lc", "ma", "//", "a", "[", "0", "])", "%", "2", "==", "0", ":\u010a\u010a", "\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120fl", "g", "=", "0", "\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",len", "(a", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "lc", "ma", "//", "a", "[i", "])", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120fl", "g", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120", "\u0120if", "\u0120fl", "g", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120temp", "=m", "//", "lc", "ma", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "temp", "//", "2", "\u0120if", "\u0120temp", "%", "2", "==", "0", "\u0120else", "\u0120temp", "//", "2", "+", "1", "))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.7967329450848046, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6771609938949378, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.7387330872699986]} +{"problem_id": "p02693", "input": "S = int(input())\n\na = 0\n\ncount = 0\n\nn,m = list(map(int,input().split()))\n\nwhile count == 0:\n\n a += S\n\n if n <= a and m >= a:\n\n count = 1\n\n if a >= 1000:\n\n break\n\nif count == 0:\n\n print(\"NG\")\n\nelse:\n\n print(\"OK\")", "input_tokens": ["S", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120", "0", "\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "n", ",m", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "while", "\u0120count", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120+=", "\u0120S", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120<=", "\u0120a", "\u0120and", "\u0120m", "\u0120>=", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "\u0120>=", "\u0120", "1", "0", "0", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "if", "\u0120count", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "NG", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "OK", "\")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7640031686476719]} +{"problem_id": "p03171", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nn = N % 2\n\n\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor w in range(1, N+1):\n\n for i in range(N):\n\n j = i + w\n\n if j > N:\n\n continue\n\n if (w+n) % 2 == 1:\n\n DP[i][j] = min(DP[i+1][j] - A[i], DP[i][j-1] - A[j-1])\n\n else:\n\n DP[i][j] = max(DP[i+1][j] + A[i], DP[i][j-1] + A[j-1])\n\n\n\nprint((DP[0][N]))\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "n", "\u0120=", "\u0120N", "\u0120%", "\u0120", "2", "\u010a\u010a\u010a\u010a", "DP", "\u0120=", "\u0120[[", "0", "]", "\u0120*", "\u0120(", "N", "+", "1", ")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "+", "1", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120w", "\u0120in", "\u0120range", "(", "1", ",", "\u0120N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120i", "\u0120+", "\u0120w", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120>", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "w", "+n", ")", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120DP", "[i", "][", "j", "]", "\u0120=", "\u0120min", "(D", "P", "[i", "+", "1", "][", "j", "]", "\u0120-", "\u0120A", "[i", "],", "\u0120DP", "[i", "][", "j", "-", "1", "]", "\u0120-", "\u0120A", "[j", "-", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120DP", "[i", "][", "j", "]", "\u0120=", "\u0120max", "(D", "P", "[i", "+", "1", "][", "j", "]", "\u0120+", "\u0120A", "[i", "],", "\u0120DP", "[i", "][", "j", "-", "1", "]", "\u0120+", "\u0120A", "[j", "-", "1", "])\u010a\u010a", "\u010a\u010a", "print", "((", "DP", "[", "0", "][", "N", "]))\u010a"], "input_token_weights": [0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.8765066796615488, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.8981772421402056, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.808526270355906, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.6569022703191485, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.7355852514485495, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7355852514485495, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.7355852514485495, 0.7100393521462953, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.7100393521462953, 0.5714954628602014, 0.9193881350322848, 0.8981772421402056, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.8981772421402056]} +{"problem_id": "p03796", "input": "from math import factorial as fc\n\na = int(input())\n\nprint((fc(a)%(10**9+7)))", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120factorial", "\u0120as", "\u0120fc", "\u010a\u010a", "a", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "fc", "(a", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p02574", "input": "from math import gcd\n\n\n\nN = int(input())\n\nnum_lis = list(map(int, input().split()))\n\nc = True\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(10**6+10)\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num //= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n c = False\n\n break\n\n else:\n\n tmp.add(j)\n\n else:\n\n continue\n\n break\n\n\n\nif c:\n\n print(\"pairwise coprime\")\n\nelse:\n\n print(\"setwise coprime\")", "input_tokens": ["from", "\u0120math", "\u0120import", "\u0120gcd", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "num", "_l", "is", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "def", "\u0120os", "a", "_k", "(max", "_num", "):\u010a\u010a", "\u0120", "\u0120lis", "\u0120=", "\u0120[", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(max", "_num", "+", "1", ")]\u010a\u010a", "\u0120", "\u0120p", "\u0120=", "\u0120", "2", "\u010a\u010a", "\u0120", "\u0120while", "\u0120p", "**", "2", "\u0120<=", "\u0120max", "_num", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120lis", "[p", "]", "\u0120==", "\u0120p", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120q", "\u0120in", "\u0120range", "(", "2", "*p", ",", "\u0120max", "_num", "+", "1", ",", "\u0120p", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120lis", "[q", "]", "\u0120==", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120lis", "[q", "]", "\u0120=", "\u0120p", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120return", "\u0120lis", "\u010a\u010a\u010a\u010a", "h", "oge", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120num", "_l", "is", ":\u010a\u010a", "\u0120", "\u0120h", "oge", "\u0120=", "\u0120gcd", "(h", "oge", ",", "\u0120i", ")\u010a\u010a", "if", "\u0120h", "oge", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120", "\u0120print", "(\"", "not", "\u0120cop", "r", "ime", "\")\u010a\u010a", "\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "d", "_l", "is", "\u0120=", "\u0120os", "a", "_k", "(", "1", "0", "**", "6", "+", "1", "0", ")\u010a\u010a", "tmp", "\u0120=", "\u0120set", "()\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120num", "_l", "is", ":\u010a\u010a", "\u0120", "\u0120num", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120", "\u0120new", "_tmp", "\u0120=", "\u0120set", "()\u010a\u010a", "\u0120", "\u0120while", "\u0120num", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120d", "_l", "is", "[num", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120new", "_tmp", ".add", "(d", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120//=", "\u0120d", "\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120new", "_tmp", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120in", "\u0120tmp", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", ".add", "(j", ")\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "if", "\u0120c", ":\u010a\u010a", "\u0120", "\u0120print", "(\"", "pair", "wise", "\u0120cop", "r", "ime", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "(\"", "set", "wise", "\u0120cop", "r", "ime", "\")"], "input_token_weights": [0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.7281392564472128, 0.7833854580549265, 0.5749858371565393, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.7833854580549265, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895]} +{"problem_id": "p02850", "input": "n = int(input())\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "edges", "\u0120=", "\u0120[]", "\u010a\u010a\u010a\u010a", "for", "\u0120id", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120edges", ".append", "([", "a", "-", "1", ",", "\u0120b", "-", "1", ",", "\u0120id", "])\u010a\u010a", "\u010a\u010a", "edges", ".sort", "()\u010a\u010a\u010a\u010a", "used", "\u0120=", "\u0120[", "0", "]*(", "n", ")\u010a\u010a", "ans", "\u0120=", "\u0120[", "0", "]*(", "n", "-", "1", ")\u010a\u010a", "num", "\u0120=", "\u0120", "1", "\u010a\u010a", "prev", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120edge", "\u0120in", "\u0120edges", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120_", "from", ",", "\u0120to", ",", "\u0120id", "\u0120=", "\u0120edge", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120_", "from", "\u0120!=", "\u0120prev", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120used", "[_", "from", "]", "\u0120==", "\u0120num", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "[id", "]", "\u0120=", "\u0120num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120used", "[to", "]", "\u0120=", "\u0120num", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120prev", "\u0120=", "\u0120_", "from", "\u010a\u010a\u010a\u010a", "print", "((", "max", "(ans", ")))\u010a\u010a", "for", "\u0120color", "\u0120in", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(color", ")\u010a"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852]} +{"problem_id": "p00003", "input": "for i in range(0, int(input())):\n\n sidelen = [int(j) for j in input().split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")", "input_tokens": ["for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",", "\u0120int", "(input", "()))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120sid", "elen", "\u0120=", "\u0120[", "int", "(j", ")", "\u0120for", "\u0120j", "\u0120in", "\u0120input", "().", "split", "(\"", "\u0120\")", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120sid", "elen", ".sort", "(reverse", "=True", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "(sid", "elen", "[", "0", "]**", "2", "\u0120==", "\u0120sid", "elen", "[", "1", "]**", "2", "\u0120+", "\u0120sid", "elen", "[", "2", "]**", "2", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "YES", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")"], "input_token_weights": [0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.6951432441854742]} +{"problem_id": "p03424", "input": "n = int(input())\n\ns = input().split()\n\ns = set(s)\n\nprint(('Four' if len(s) == 4 else 'Three'))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "s", "\u0120=", "\u0120input", "().", "split", "()\u010a\u010a", "s", "\u0120=", "\u0120set", "(s", ")\u010a\u010a", "print", "(('", "Four", "'", "\u0120if", "\u0120len", "(s", ")", "\u0120==", "\u0120", "4", "\u0120else", "\u0120'", "Three", "'))"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.833611120734537]} +{"problem_id": "p00122", "input": "dX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return \"OK\"\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = input()\n\n\txy = list(map(int,input().split()))\n\n\tans = solve(x,y,xy)\n\n\tprint(ans if ans else \"NA\")", "input_tokens": ["d", "X", "\u0120=", "\u0120[", "2", ",", "2", ",", "2", ",", "1", ",", "0", ",-", "1", ",-", "2", ",-", "2", ",-", "2", ",-", "1", ",", "0", ",", "1", "]\u010a\u010a", "d", "Y", "\u0120=", "\u0120[-", "1", ",", "0", ",", "1", ",", "2", ",", "2", ",", "2", ",", "1", ",", "0", ",-", "1", ",-", "2", ",-", "2", ",-", "2", "]\u010a\u010a", "def", "\u0120solve", "(x", ",y", ",", "XY", "):\u010a\u010a", "\u0109", "xy", "\u0120=", "\u0120XY", "[:", "]\u010a\u010a", "\u0109if", "\u0120len", "(xy", ")", "\u0120==", "\u0120", "0", ":", "\u0120return", "\u0120\"", "OK", "\"\u010a\u010a", "\u0109s", "x", ",s", "y", "\u0120=", "\u0120xy", ".pop", "(", "0", "),", "xy", ".pop", "(", "0", ")\u010a\u010a", "\u0109for", "\u0120dx", ",", "dy", "\u0120in", "\u0120zip", "(d", "X", ",d", "Y", "):\u010a\u010a", "\u0109", "\u0109if", "\u0120do", "a", "(x", "+", "dx", ",y", "+", "dy", ",s", "x", ",s", "y", "):", "\u0120\u010a\u010a", "\u0109\u0109", "\u0109r", "\u0120=", "\u0120solve", "(x", "+", "dx", ",y", "+", "dy", ",", "xy", ")\u010a\u010a", "\u0109\u0109", "\u0109if", "\u0120r", ":", "\u0120return", "\u0120r", "\u010a\u010a\u010a\u010a", "def", "\u0120do", "a", "(x", ",y", ",s", "x", ",s", "y", "):\u010a\u010a", "\u0109if", "\u0120not", "\u0120(", "0", "\u0120<=", "\u0120x", "\u0120<=", "\u0120", "9", "\u0120and", "\u0120", "0", "\u0120<=", "\u0120y", "\u0120<=", "\u0120", "9", "):", "\u0120return", "\u0120False", "\u010a\u010a", "\u0109return", "\u0120True", "\u0120if", "\u0120abs", "(x", "-s", "x", ")", "\u0120<", "\u0120", "2", "\u0120and", "\u0120abs", "(y", "-s", "y", ")", "\u0120<", "\u0120", "2", "\u0120else", "\u0120False", "\u010a\u010a\u010a\u010a", "while", "\u0120", "1", ":\u010a\u010a", "\u0109x", ",y", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0109if", "\u0120x", "\u0120==", "\u0120y", "\u0120==", "\u0120", "0", ":", "\u0120break", "\u010a\u010a", "\u0109n", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0109", "xy", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0109ans", "\u0120=", "\u0120solve", "(x", ",y", ",", "xy", ")\u010a\u010a", "\u0109print", "(ans", "\u0120if", "\u0120ans", "\u0120else", "\u0120\"", "NA", "\")"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852]} +{"problem_id": "p03988", "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(1000000)\n\nfrom collections import deque\n\ndef getN():\n\n return int(input())\n\ndef getList():\n\n return list(map(int, input().split()))\n\nimport math\n\n\n\nn = getN()\n\nnums = getList()\n\n\n\n# nums.sort(reverse=True)\n\nmx = max(nums)\n\nmn = (mx+1) // 2\n\nmndx = (mx % 2) + 1\n\n\n\nfrom collections import Counter\n\n\n\ncnt = Counter(nums)\n\n\n\nfor i in range(mn+1, mx+1):\n\n if cnt[i] < 2:\n\n print(\"Impossible\")\n\n sys.exit()\n\n\n\nif cnt[mn] != mndx:\n\n print(\"Impossible\")\n\nelse:\n\n print(\"Possible\")", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", "0", ")\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "def", "\u0120get", "N", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120getList", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "import", "\u0120math", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120get", "N", "()\u010a\u010a", "nums", "\u0120=", "\u0120getList", "()\u010a\u010a\u010a\u010a", "#", "\u0120nums", ".sort", "(reverse", "=True", ")\u010a\u010a", "mx", "\u0120=", "\u0120max", "(nums", ")\u010a\u010a", "mn", "\u0120=", "\u0120(", "mx", "+", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "m", "ndx", "\u0120=", "\u0120(", "mx", "\u0120%", "\u0120", "2", ")", "\u0120+", "\u0120", "1", "\u010a\u010a\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a\u010a\u010a", "cnt", "\u0120=", "\u0120Counter", "(nums", ")\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "n", "+", "1", ",", "\u0120mx", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120cnt", "[i", "]", "\u0120<", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "Impossible", "\")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a\u010a\u010a", "if", "\u0120cnt", "[m", "n", "]", "\u0120!=", "\u0120m", "ndx", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Impossible", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "Possible", "\")"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.9235768548788368, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.8116478083709829, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8116478083709829, 0.781592256244883, 0.7506053018110229, 0.781592256244883]} +{"problem_id": "p02390", "input": "import sys\n\n\n\nif __name__ == '__main__':\n\n import doctest\n\n doctest.testmod()\n\n S = int(sys.stdin.read())\n\n h = S / 3600\n\n m = (S % 3600) / 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120do", "ctest", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120do", "ctest", ".test", "mod", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120int", "(sys", ".stdin", ".read", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120h", "\u0120=", "\u0120S", "\u0120/", "\u0120", "3", "6", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120(", "S", "\u0120%", "\u0120", "3", "6", "0", "0", ")", "\u0120/", "\u0120", "6", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120S", "\u0120%", "\u0120", "6", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"%", "d", ":%", "d", ":%", "d", "\"", "\u0120%", "\u0120(", "h", ",", "\u0120m", ",", "\u0120s", "))\u010a"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6270757423345348, 0.6673426178365944, 0.7433160191943734, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217]} +{"problem_id": "p02880", "input": "n = int(input())\n\ns = []\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n s.append(i*j)\n\nif n in s:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "s", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", ".append", "(i", "*j", ")\u010a\u010a", "if", "\u0120n", "\u0120in", "\u0120s", ":\u010a\u010a", "\u0120", "\u0120print", "(\"", "Yes", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120", "\u0120print", "(\"", "No", "\")"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.833611120734537, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6339004969859428, 0.6771609938949378, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7584425223266994, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.7584425223266994, 0.7186273667339679, 0.6771609938949378, 0.7186273667339679]} +{"problem_id": "p03796", "input": "import math\n\nN=int(input())\n\nans=math.factorial(N)\n\nprint((ans%(10**9 +7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "=int", "(input", "())\u010a\u010a", "ans", "=", "math", ".factor", "ial", "(N", ")\u010a\u010a", "print", "((", "ans", "%(", "1", "0", "**", "9", "\u0120+", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p03634", "input": "from collections import deque\n\nn,*t=list(map(int,open(0).read().split()))\n\ncon=[[] for _ in range(n)]\n\ndist_f_k=[0]*n\n\n\n\nfor a,b,c in zip(t[:3*n-3:3],t[1::3],t[2::3]):\n\n\tcon[a-1].append((b-1,c))\n\n\tcon[b-1].append((a-1,c))\n\n\n\nk=t[3*n-2]\n\nque=deque([k-1])\n\nwhile que:\n\n\tcur=que.popleft()\n\n\tfor nxt,dd in con[cur]:\n\n\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\tque.append(nxt)\n\n\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\nfor x,y in zip(t[3*n-1::2],t[3*n::2]):\n\n\tprint((dist_f_k[x-1]+dist_f_k[y-1]))", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "n", ",*", "t", "=list", "(map", "(int", ",", "open", "(", "0", ").", "read", "().", "split", "()))\u010a\u010a", "con", "=[", "[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "dist", "_f", "_k", "=[", "0", "]*", "n", "\u010a\u010a\u010a\u010a", "for", "\u0120a", ",b", ",c", "\u0120in", "\u0120zip", "(t", "[:", "3", "*n", "-", "3", ":", "3", "],", "t", "[", "1", "::", "3", "],", "t", "[", "2", "::", "3", "])", ":\u010a\u010a", "\u0109con", "[a", "-", "1", "].", "append", "((", "b", "-", "1", ",c", "))\u010a\u010a", "\u0109con", "[b", "-", "1", "].", "append", "((", "a", "-", "1", ",c", "))", "\u010a\u010a\u010a\u010a", "k", "=t", "[", "3", "*n", "-", "2", "]\u010a\u010a", "que", "=", "deque", "([", "k", "-", "1", "])\u010a\u010a", "while", "\u0120que", ":\u010a\u010a", "\u0109cur", "=", "que", ".p", "opleft", "()\u010a\u010a", "\u0109for", "\u0120nxt", ",", "dd", "\u0120in", "\u0120con", "[cur", "]:\u010a\u010a", "\u0109", "\u0109if", "\u0120dist", "_f", "_k", "[n", "xt", "]==", "0", "\u0120and", "\u0120nxt", "!=", "k", "-", "1", ":\u010a\u010a", "\u0109\u0109", "\u0109", "que", ".append", "(n", "xt", ")\u010a\u010a", "\u0109\u0109", "\u0109dist", "_f", "_k", "[n", "xt", "]=", "dist", "_f", "_k", "[cur", "]+", "dd", "\u010a\u010a\u010a\u010a", "for", "\u0120x", ",y", "\u0120in", "\u0120zip", "(t", "[", "3", "*n", "-", "1", "::", "2", "],", "t", "[", "3", "*n", "::", "2", "])", ":\u010a\u010a", "\u0109print", "((", "dist", "_f", "_k", "[x", "-", "1", "]+", "dist", "_f", "_k", "[y", "-", "1", "]))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852]} +{"problem_id": "p02622", "input": "S = input()\n\nT = input()\n\nN = len(S)\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)\n", "input_tokens": ["S", "\u0120=", "\u0120input", "()\u010a\u010a", "T", "\u0120=", "\u0120input", "()\u010a\u010a", "N", "\u0120=", "\u0120len", "(S", ")\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120(", "S", "[i", "]", "\u0120!=", "\u0120T", "[i", "])\u010a\u010a", "\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.7332896764791028, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965]} +{"problem_id": "p02264", "input": "n, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n\tps[i], t[i] = input( ).split( \" \" )\n\n\n\n\n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n\tpsi = ps.pop( 0 )\n\n\tti = int( t.pop( 0 ) )\n\n\tif ti <= q:\n\n\t\tqsum += ti\t\n\n\t\toutput.append( psi+\" \"+str( qsum ) )\n\n\telse:\n\n\t\tt.append( ti - q )\n\n\t\tps.append( psi )\n\n\t\tqsum += q\n\n\n\nprint(( \"\\n\".join( output ) ))", "input_tokens": ["n", ",", "\u0120q", "\u0120=", "\u0120[", "\u0120int", "(", "\u0120val", "\u0120)", "\u0120for", "\u0120val", "\u0120in", "\u0120input", "(", "\u0120).", "split", "(", "\u0120\"", "\u0120\"", "\u0120)", "\u0120]\u010a\u010a", "ps", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "t", "\u0120=", "\u0120[", "0", "]*", "n", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "\u0120n", "\u0120):\u010a\u010a", "\u0109ps", "[i", "],", "\u0120t", "[i", "]", "\u0120=", "\u0120input", "(", "\u0120).", "split", "(", "\u0120\"", "\u0120\"", "\u0120)\u010a\u010a", "\u010a\u010a\u010a\u010a", "output", "\u0120=", "\u0120[]\u010a\u010a", "q", "sum", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120t", ":\u010a\u010a", "\u0109", "psi", "\u0120=", "\u0120ps", ".pop", "(", "\u0120", "0", "\u0120)\u010a\u010a", "\u0109ti", "\u0120=", "\u0120int", "(", "\u0120t", ".pop", "(", "\u0120", "0", "\u0120)", "\u0120)\u010a\u010a", "\u0109if", "\u0120ti", "\u0120<=", "\u0120q", ":\u010a\u010a", "\u0109", "\u0109q", "sum", "\u0120+=", "\u0120ti", "\u0109\u010a\u010a", "\u0109", "\u0109output", ".append", "(", "\u0120psi", "+\"", "\u0120\"+", "str", "(", "\u0120q", "sum", "\u0120)", "\u0120)\u010a\u010a", "\u0109else", ":\u010a\u010a", "\u0109", "\u0109t", ".append", "(", "\u0120ti", "\u0120-", "\u0120q", "\u0120)\u010a\u010a", "\u0109", "\u0109ps", ".append", "(", "\u0120psi", "\u0120)\u010a\u010a", "\u0109", "\u0109q", "sum", "\u0120+=", "\u0120q", "\u010a\u010a\u010a\u010a", "print", "((", "\u0120\"\\", "n", "\".", "join", "(", "\u0120output", "\u0120)", "\u0120))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.7301658005010259, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p02688", "input": "N,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(input())\n\n b=input().split(' ')\n\n for j in range(count):\n\n if int(b[j]) in a:\n\n a.remove(int(b[j]))\n\nprint((len(a)))", "input_tokens": ["N", ",K", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "('", "\u0120'", ")))\u010a\u010a", "a", "=list", "(range", "(", "1", ",N", "+", "1", "))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120", "\u0120count", "=int", "(input", "())\u010a\u010a", "\u0120", "\u0120b", "=input", "().", "split", "('", "\u0120')\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(count", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120int", "(b", "[j", "])", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120a", ".remove", "(int", "(b", "[j", "]))\u010a\u010a", "print", "((", "len", "(a", ")))"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6448923330239924, 0.6115475853143139, 0.7084208560793558, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308]} +{"problem_id": "p02416", "input": "res = []\n\nwhile True:\n\n s = input()\n\n if s == '0':\n\n break\n\n\n\n res.append(sum([int(x) for x in s]))\n\n\n\nfor e in res:\n\n print(e)", "input_tokens": ["res", "\u0120=", "\u0120[]\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120==", "\u0120'", "0", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120res", ".append", "(sum", "([", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120s", "]))", "\u010a\u010a\u010a\u010a", "for", "\u0120e", "\u0120in", "\u0120res", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(e", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.6588494518362031, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.7967329450848046, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03086", "input": "import re;print((max(list(map(len,re.split('[^ACGT]',input()))))))", "input_tokens": ["import", "\u0120re", ";", "print", "((", "max", "(list", "(map", "(len", ",re", ".split", "('[", "^", "AC", "GT", "]',", "input", "()))", "))))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9529241888335975, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.6115475853143139, 0.5770524973423397, 0.6771609938949378, 0.8778749353275308]} +{"problem_id": "p03828", "input": "import math\n\nn=int(input())\n\nwaru=10**9+7\n\n\n\nli=[]\n\nli2=[]\n\n\n\nfor i in range(2,n+1):\n\n tmp=math.factorial(n)\n\n flag=1\n\n for j in range(len(li)):\n\n if i%li[j]==0:\n\n flag=0\n\n break\n\n if flag==1:\n\n li.append(i)\n\n li2.append(0)\n\n while tmp%i==0:\n\n li2[len(li)-1]+=1\n\n tmp=tmp//i\n\nans=1\n\n# print(li)\n\n# print(li2)\n\nfor i in range(len(li2)):\n\n ans*=li2[i]+1\n\nprint((ans%waru))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "war", "u", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a\u010a\u010a", "li", "=[]", "\u010a\u010a", "li", "2", "=[]", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "=", "math", ".factor", "ial", "(n", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120flag", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(li", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "%", "li", "[j", "]==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120flag", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120flag", "==", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120li", ".append", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120li", "2", ".append", "(", "0", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120tmp", "%i", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120li", "2", "[len", "(li", ")-", "1", "]+=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "=tmp", "//", "i", "\u010a\u010a", "ans", "=", "1", "\u010a\u010a", "#", "\u0120print", "(li", ")\u010a\u010a", "#", "\u0120print", "(li", "2", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(li", "2", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "*=", "li", "2", "[i", "]+", "1", "\u010a\u010a", "print", "((", "ans", "%", "war", "u", "))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6115475853143139, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308]} +{"problem_id": "p03325", "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nans = 0\n\ncheck = [0]*30\n\nfor i in range(1, 31):\n\n check[i-1] = 2**i\n\n\n\nfor i in A:\n\n if i % 2 == 0:\n\n j = 0\n\n while check[j] <= i:\n\n if i % check[j] == 0:\n\n add = check[j]\n\n else:\n\n break\n\n \n\n j += 1\n\n ans += j\n\n \n\nprint(ans)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "check", "\u0120=", "\u0120[", "0", "]*", "3", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "3", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120check", "[i", "-", "1", "]", "\u0120=", "\u0120", "2", "**", "i", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120check", "[j", "]", "\u0120<=", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120%", "\u0120check", "[j", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120add", "\u0120=", "\u0120check", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.7506053018110229, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.6514299043837268, 0.579389560544, 0.579389560544, 0.579389560544, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.579389560544, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03845", "input": "N = int(input())\n\nT = list(map(int, input().split()))\n\nM = int(input())\n\np = []\n\nx = []\n\nans = []\n\nfor i in range(M):\n\n p, x = list(map(int, input().split()))\n\n ans.append(sum(T[:p-1])+x+sum(T[p:]))\n\n\n\nfor _ in ans:\n\n print(_)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "T", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "M", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "p", "\u0120=", "\u0120[]\u010a\u010a", "x", "\u0120=", "\u0120[]\u010a\u010a", "ans", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120p", ",", "\u0120x", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", ".append", "(sum", "(T", "[:", "p", "-", "1", "])+", "x", "+", "sum", "(T", "[p", ":", "]))", "\u010a\u010a\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(_)"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7084208560793558, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p03796", "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(N", ")", "%(", "1", "0", "**", "9", "+", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p02901", "input": "def main():\n\n import math\n\n N,M=list(map(int,input().split()))\n\n a=[]\n\n for i in range(M):\n\n tmp=list(map(int,input().split()))\n\n tmpc=list(map(int,input().split()))\n\n c=0\n\n for j in range(len(tmpc)):\n\n c+=2**(tmpc[j]-1)\n\n tmp[1]=c\n\n a+=[tmp]\n\n\n\n\n\n dp=[[10**10 for j in range(2**N)] for i in range(M)]\n\n dp[0][0]=0\n\n dp[0][a[0][1]]=a[0][0]\n\n\n\n\n\n for i in range(1,M):\n\n dp[i]=dp[i-1]\n\n for j in range(2**N):\n\n z,p=a[i][0],a[i][1]\n\n q=j|p\n\n x=dp[i-1][j]+z\n\n if dp[i][q]>x: dp[i][q]=x\n\n\n\n ans=dp[M-1][2**N-1]\n\n print((ans if ans<10**10 else -1))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120import", "\u0120math", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",M", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=[]", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "c", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(len", "(tmp", "c", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120c", "+=", "2", "**(", "tmp", "c", "[j", "]-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "[", "1", "]=", "c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "+", "=[", "tmp", "]", "\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "=[[", "1", "0", "**", "1", "0", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "2", "**", "N", ")]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(M", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "][", "0", "]=", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[", "0", "][", "a", "[", "0", "][", "1", "]]=", "a", "[", "0", "][", "0", "]", "\u010a\u010a\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",M", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]=", "dp", "[i", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "2", "**", "N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120z", ",p", "=a", "[i", "][", "0", "],", "a", "[i", "][", "1", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "=j", "|", "p", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "=", "dp", "[i", "-", "1", "][", "j", "]+", "z", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "][", "q", "]>", "x", ":", "\u0120dp", "[i", "][", "q", "]=", "x", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=", "dp", "[M", "-", "1", "][", "2", "**", "N", "-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "ans", "\u0120if", "\u0120ans", "<", "1", "0", "**", "1", "0", "\u0120else", "\u0120-", "1", "))", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.7713695892187169, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.7967329450848046, 0.8456076926739031, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.6629477592666795, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8922045961188434, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.7967329450848046, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.7186273667339679, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7453461554353482, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031]} +{"problem_id": "p02574", "input": "#!/usr/bin/env pypy3\n\n# N,M = map(int,sys.stdin.readline().split())\n\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n\n# s = sys.stdin.readline().rstrip()\n\n# N = int(sys.stdin.readline())\n\n# INF = float(\"inf\")\n\nimport math,sys\n\n\n\nn = int(sys.stdin.readline())\n\na = tuple(map(int,sys.stdin.readline().split()))\n\n#n = int(input())\n\n#a = list(map(int,input().split()))\n\ng = math.gcd(a[0],a[1])\n\nfor i in range(2,n):\n\n g = math.gcd(g,a[i])\n\nM = max(a)\n\nacc = a[0]\n\nfor i in range(n):\n\n acc = math.gcd(acc,a[i])\n\nif acc != 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nLIMIT=max(a)\n\nminPrime = [0]*(LIMIT+1)\n\nminPrime[1] = 1\n\ndef make():\n\n for i in range(2,LIMIT+1):\n\n if minPrime[i] == 0:\n\n minPrime[i] = i\n\n #print(i)\n\n for j in range(i+i,LIMIT+1,i):\n\n #print(i,j)\n\n if minPrime[j] == 0:\n\n minPrime[j] = i\n\nmake()\n\ndef factrial(N):\n\n ret = []\n\n while minPrime[N] != N:\n\n ret.append(minPrime[N])\n\n N = N//minPrime[N]\n\n if N != 1:\n\n ret.append(N)\n\n return ret\n\n\n\njudge = set([])\n\npc = True\n\n\n\npairwise = True\n\np = set() #all prime\n\n\n\nfor e in a:\n\n if not pairwise:\n\n break\n\n asf = set(factrial(e))\n\n if judge & asf != set():\n\n pc = False\n\n # #pairwise = False\n\n # print(\"setwise coprime\")\n\n # exit(0)\n\n judge |= asf\n\n# for i in a:\n\n# if not pc:\n\n# break\n\n# asf = set(factrial(i))\n\n\n\n# if judge & asf != set():\n\n# pc = False\n\n# judge |= asf\n\nif pc:\n\n print(\"pairwise coprime\")\n\nelif g == 1:\n\n print(\"setwise coprime\")\n\nelse:\n\n print(\"not coprime\")\n", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120p", "ypy", "3", "\u010a\u010a", "#", "\u0120N", ",M", "\u0120=", "\u0120map", "(int", ",", "sys", ".stdin", ".readline", "().", "split", "())\u010a\u010a", "#", "\u0120a", "\u0120=", "\u0120tuple", "(map", "(int", ",", "sys", ".stdin", ".readline", "().", "split", "()))", "\u0120#", "\u0120single", "\u0120line", "\u0120with", "\u0120multi", "\u0120param", "\u010a\u010a", "#", "\u0120a", "\u0120=", "\u0120tuple", "(int", "(sys", ".stdin", ".readline", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "))", "\u0120#", "\u0120multi", "\u0120line", "\u0120with", "\u0120single", "\u0120param", "\u010a\u010a", "#", "\u0120a", "\u0120=", "\u0120tuple", "(tuple", "(map", "(int", ",", "sys", ".stdin", ".readline", "().", "rstrip", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "))", "\u0120#", "\u0120multi", "\u0120line", "\u0120with", "\u0120multi", "\u0120param", "\u010a\u010a", "#", "\u0120s", "\u0120=", "\u0120sys", ".stdin", ".readline", "().", "rstrip", "()\u010a\u010a", "#", "\u0120N", "\u0120=", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "#", "\u0120INF", "\u0120=", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "import", "\u0120math", ",", "sys", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "a", "\u0120=", "\u0120tuple", "(map", "(int", ",", "sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "#", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "#a", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "g", "\u0120=", "\u0120math", ".g", "cd", "(a", "[", "0", "],", "a", "[", "1", "])\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "\u0120=", "\u0120math", ".g", "cd", "(g", ",a", "[i", "])\u010a\u010a", "M", "\u0120=", "\u0120max", "(a", ")\u010a\u010a", "acc", "\u0120=", "\u0120a", "[", "0", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120acc", "\u0120=", "\u0120math", ".g", "cd", "(acc", ",a", "[i", "])\u010a\u010a", "if", "\u0120acc", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "not", "\u0120cop", "r", "ime", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "LIMIT", "=max", "(a", ")\u010a\u010a", "min", "Prime", "\u0120=", "\u0120[", "0", "]*(", "LIMIT", "+", "1", ")\u010a\u010a", "min", "Prime", "[", "1", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "def", "\u0120make", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",L", "IMIT", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120min", "Prime", "[i", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120min", "Prime", "[i", "]", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "print", "(i", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+i", ",L", "IMIT", "+", "1", ",i", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "print", "(i", ",j", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120min", "Prime", "[j", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120min", "Prime", "[j", "]", "\u0120=", "\u0120i", "\u010a\u010a", "make", "()\u010a\u010a", "def", "\u0120fact", "rial", "(N", "):\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120while", "\u0120min", "Prime", "[N", "]", "\u0120!=", "\u0120N", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", ".append", "(min", "Prime", "[N", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120N", "//", "min", "Prime", "[N", "]\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120if", "\u0120N", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", ".append", "(N", ")\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "judge", "\u0120=", "\u0120set", "([]", ")\u010a\u010a", "pc", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "pair", "wise", "\u0120=", "\u0120True", "\u010a\u010a", "p", "\u0120=", "\u0120set", "()", "\u0120#", "all", "\u0120prime", "\u010a\u010a\u010a\u010a", "for", "\u0120e", "\u0120in", "\u0120a", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120pairwise", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120as", "f", "\u0120=", "\u0120set", "(f", "act", "rial", "(e", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120judge", "\u0120&", "\u0120as", "f", "\u0120!=", "\u0120set", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pc", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120#", "pair", "wise", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "set", "wise", "\u0120cop", "r", "ime", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120\u0120\u0120\u0120", "\u0120exit", "(", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120judge", "\u0120|=", "\u0120as", "f", "\u010a\u010a", "#", "\u0120for", "\u0120i", "\u0120in", "\u0120a", ":\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120pc", ":\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120as", "f", "\u0120=", "\u0120set", "(f", "act", "rial", "(i", "))", "\u010a\u010a\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120if", "\u0120judge", "\u0120&", "\u0120as", "f", "\u0120!=", "\u0120set", "():\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pc", "\u0120=", "\u0120False", "\u010a\u010a", "#", "\u0120\u0120\u0120\u0120", "\u0120judge", "\u0120|=", "\u0120as", "f", "\u010a\u010a", "if", "\u0120pc", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "pair", "wise", "\u0120cop", "r", "ime", "\")\u010a\u010a", "elif", "\u0120g", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "set", "wise", "\u0120cop", "r", "ime", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "not", "\u0120cop", "r", "ime", "\")\u010a"], "input_token_weights": [0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.7833854580549265, 0.8099046207685895, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.8099046207685895, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.8099046207685895, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.7833854580549265, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.7281392564472128, 0.5749858371565393, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.9094625571831276, 0.8854867975141383, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.5749858371565393, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.8099046207685895, 0.5749858371565393, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.8854867975141383, 0.9094625571831276, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895]} +{"problem_id": "p02627", "input": "alph = input()\n\nif alph.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")\n", "input_tokens": ["alph", "\u0120=", "\u0120input", "()\u010a\u010a", "if", "\u0120alph", ".is", "upper", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "A", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "a", "\")\u010a"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.89427190936908, 0.8170167109432965, 0.8170167109432965, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.7760292149144611, 0.7332896764791028, 0.6886415962350058, 0.7332896764791028, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.7332896764791028, 0.6886415962350058, 0.6419065217751312, 0.6886415962350058]} +{"problem_id": "p03039", "input": "n, m, k = list(map(int, input().split()))\n\n\n\nmod = 1000000007\n\ndef pow(x, n):\n\n ret = 1\n\n while n > 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\nfac = [1]\n\ninv = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n inv.append(pow(fac[i], mod - 2))\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\n\ndef doit(n, m, k):\n\n ret = 0\n\n for d in range(m):\n\n ret = (ret + d * (m - d)) % mod\n\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))", "input_tokens": ["n", ",", "\u0120m", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "def", "\u0120pow", "(x", ",", "\u0120n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120n", "\u0120>", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120(", "n", "\u0120&", "\u0120", "1", ")", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120(", "ret", "\u0120*", "\u0120x", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120(", "x", "\u0120*", "\u0120x", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "\u0120>>=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120ret", "\u010a\u010a\u010a\u010a", "fac", "\u0120=", "\u0120[", "1", "]\u010a\u010a", "inv", "\u0120=", "\u0120[", "1", "]\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120*", "\u0120m", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fac", ".append", "((", "fac", "[-", "1", "]", "\u0120*", "\u0120i", ")", "\u0120%", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", ".append", "(pow", "(f", "ac", "[i", "],", "\u0120mod", "\u0120-", "\u0120", "2", "))", "\u010a\u010a\u010a\u010a", "def", "\u0120cmb", "(n", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "fac", "[n", "]", "\u0120*", "\u0120inv", "[k", "]", "\u0120*", "\u0120inv", "[n", "\u0120-", "\u0120k", "])", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "def", "\u0120doit", "(n", ",", "\u0120m", ",", "\u0120k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120d", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120(", "ret", "\u0120+", "\u0120d", "\u0120*", "\u0120(", "m", "\u0120-", "\u0120d", "))", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120(", "ret", "\u0120*", "\u0120n", "\u0120*", "\u0120n", "\u0120*", "\u0120cmb", "(n", "\u0120*", "\u0120m", "\u0120-", "\u0120", "2", ",", "\u0120k", "\u0120-", "\u0120", "2", "))", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "print", "(((", "do", "it", "(n", ",", "\u0120m", ",", "\u0120k", ")", "\u0120+", "\u0120doit", "(m", ",", "\u0120n", ",", "\u0120k", "))", "\u0120%", "\u0120mod", "))"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308]} +{"problem_id": "p02555", "input": "s=int(input())\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s//3\n\nans=0\n\ndef f(n,k,p):\n\n if k==0:\n\n return 1\n\n elif k%2==0:\n\n return (f(n,k//2,p)**2)%p\n\n else:\n\n return (n*f(n,k-1,p))%p\n\n\n\nfor k in range(1,n+1):\n\n a=1\n\n b=1\n\n for j in range(k-1):\n\n a=(a*(s-3*k+1+j))%p\n\n b=(b*(j+1))%p\n\n ans=(ans+a*f(b,p-2,p))%p\n\n\n\nprint((ans%p))\n\n\n", "input_tokens": ["s", "=int", "(input", "())\u010a\u010a", "p", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "if", "\u0120s", "<=", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "n", "=s", "//", "3", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "def", "\u0120f", "(n", ",k", ",p", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120k", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120k", "%", "2", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120(", "f", "(n", ",k", "//", "2", ",p", ")**", "2", ")%", "p", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120(", "n", "*f", "(n", ",k", "-", "1", ",p", "))", "%", "p", "\u010a\u010a\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "=(", "a", "*(", "s", "-", "3", "*k", "+", "1", "+j", "))", "%", "p", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120b", "=(", "b", "*(", "j", "+", "1", "))", "%", "p", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "=(", "ans", "+a", "*f", "(b", ",p", "-", "2", ",p", "))", "%", "p", "\u010a\u010a\u010a\u010a", "print", "((", "ans", "%p", "))\u010a\u010a\u010a"], "input_token_weights": [0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.914713330925897, 0.914713330925897, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.5731452134031394, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8456076926739031, 0.5731452134031394, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.5731452134031394, 0.8214688817838891, 0.7713695892187169, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.7453461554353482, 0.7453461554353482, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.8214688817838891, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8922045961188434, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.6339004969859428, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.6911750402874859, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7453461554353482, 0.7453461554353482, 0.6911750402874859, 0.6911750402874859, 0.6911750402874859, 0.7713695892187169, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7713695892187169, 0.7186273667339679, 0.7186273667339679, 0.6911750402874859, 0.6911750402874859, 0.7186273667339679, 0.8214688817838891, 0.8456076926739031, 0.8456076926739031, 0.5731452134031394, 0.914713330925897, 0.8922045961188434, 0.8456076926739031, 0.8456076926739031, 0.8922045961188434]} +{"problem_id": "p03371", "input": "a,b,c,x,y=list(map(int,input().split()));print((min(k*c*2+a*max(x-k,0)+b*max(y-k,0)for k in range(max(x,y)*3))))", "input_tokens": ["a", ",b", ",c", ",x", ",y", "=list", "(map", "(int", ",input", "().", "split", "()));", "print", "((", "min", "(k", "*c", "*", "2", "+a", "*", "max", "(x", "-k", ",", "0", ")+", "b", "*", "max", "(y", "-k", ",", "0", ")", "for", "\u0120k", "\u0120in", "\u0120range", "(max", "(x", ",y", ")*", "3", "))))"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.949705583245731, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.781592256244883, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.7186273667339679, 0.6855929667625797, 0.6514299043837268, 0.6160583186229708, 0.579389560544, 0.6160583186229708, 0.6160583186229708, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6514299043837268, 0.6160583186229708, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.579389560544, 0.579389560544, 0.6514299043837268, 0.6514299043837268, 0.8691775287719905]} +{"problem_id": "p03545", "input": "import math\n\nimport string\n\nimport collections\n\nfrom collections import Counter\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\na, b, c, d = list(map(int, input()))\n\n#print(a, b, c, d)\n\nif a+b+c+d == 7:\n\n print((str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a+b-c+d == 7:\n\n print((str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a+b+c-d == 7:\n\n print((str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a+b-c-d == 7:\n\n print((str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a-b+c+d == 7:\n\n print((str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a-b-c+d == 7:\n\n print((str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))\n\n exit()\n\nif a-b+c-d == 7:\n\n print((str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n\nif a-b-c-d == 7:\n\n print((str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7'))\n\n exit()\n", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "import", "\u0120string", "\u010a\u010a", "import", "\u0120collections", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120read", "ints", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120n", "Cr", "(n", ",", "\u0120r", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120math", ".factor", "ial", "(n", ")//", "(", "math", ".factor", "ial", "(n", "-r", ")*", "math", ".factor", "ial", "(r", "))", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120has", "_duplicates", "2", "(seq", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120seen", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120item", "\u0120in", "\u0120seq", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "(item", "\u0120in", "\u0120seen", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120seen", ".append", "(item", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120len", "(seq", ")", "\u0120!=", "\u0120len", "(se", "en", ")\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120divisor", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120divisor", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120divisor", ".append", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120divisor", "\u010a\u010a\u010a\u010a\u010a\u010a", "#", "\u0120coordinates", "\u010a\u010a", "dx", "\u0120=", "\u0120[-", "1", ",", "\u0120-", "1", ",", "\u0120-", "1", ",", "\u0120", "0", ",", "\u0120", "0", ",", "\u0120", "1", ",", "\u0120", "1", ",", "\u0120", "1", "]\u010a\u010a", "dy", "\u0120=", "\u0120[-", "1", ",", "\u0120", "0", ",", "\u0120", "1", ",", "\u0120-", "1", ",", "\u0120", "1", ",", "\u0120-", "1", ",", "\u0120", "0", ",", "\u0120", "1", "]\u010a\u010a", "a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120d", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "()))\u010a\u010a", "#print", "(a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120d", ")\u010a\u010a", "if", "\u0120a", "+b", "+c", "+d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "+'", "+", "str", "(b", ")+'", "+'", "+", "str", "(c", ")+'", "+'", "+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "+b", "-c", "+d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "+'", "+", "str", "(b", ")+'", "-'+", "str", "(c", ")+'", "+'", "+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "+b", "+c", "-d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "+'", "+", "str", "(b", ")+'", "+'", "+", "str", "(c", ")+'", "-'+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "+b", "-c", "-d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "+'", "+", "str", "(b", ")+'", "-'+", "str", "(c", ")+'", "-'+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "-b", "+c", "+d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "-'+", "str", "(b", ")+'", "+'", "+", "str", "(c", ")+'", "+'", "+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "-b", "-c", "+d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "-'+", "str", "(b", ")+'", "-'+", "str", "(c", ")+'", "+'", "+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "-b", "+c", "-d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "-'+", "str", "(b", ")+'", "+'", "+", "str", "(c", ")+'", "-'+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120a", "-b", "-c", "-d", "\u0120==", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "str", "(a", ")+'", "-'+", "str", "(b", ")+'", "-'+", "str", "(c", ")+'", "-'+", "str", "(d", ")+'", "=", "7", "'))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a"], "input_token_weights": [0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.8543560820723151, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8765066796615488, 0.8543560820723151, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.8981772421402056, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.8765066796615488, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9401584547236118, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.629235964119581, 0.6007824012961436, 0.6569022703191485, 0.629235964119581, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.7100393521462953, 0.6838237134005932, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.76049478068099, 0.7355852514485495, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.9401584547236118, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.629235964119581, 0.6007824012961436, 0.6569022703191485, 0.629235964119581, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.76049478068099, 0.7355852514485495, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.9401584547236118, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.629235964119581, 0.6007824012961436, 0.6569022703191485, 0.629235964119581, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.7100393521462953, 0.6838237134005932, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.76049478068099, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.9401584547236118, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.629235964119581, 0.6007824012961436, 0.6569022703191485, 0.629235964119581, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.76049478068099, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.9401584547236118, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.629235964119581, 0.6007824012961436, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.7100393521462953, 0.6838237134005932, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.76049478068099, 0.7355852514485495, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.9401584547236118, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.629235964119581, 0.6007824012961436, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.76049478068099, 0.7355852514485495, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.9401584547236118, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.629235964119581, 0.6007824012961436, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.7100393521462953, 0.6838237134005932, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.76049478068099, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.9401584547236118, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.629235964119581, 0.6007824012961436, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.629235964119581, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.76049478068099, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p03723", "input": "a,b,c=list(map(int, input().split()))\n\nd=0\n\nwhile d<10**5:\n\n if a%2==1 or b%2==1 or c%2==1:break\n\n a,b,c=b/2+c/2,a/2+c/2,a/2+b/2\n\n d+=1\n\nelse:d=-1\n\nprint(d)", "input_tokens": ["a", ",b", ",c", "=list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "d", "=", "0", "\u010a\u010a", "while", "\u0120d", "<", "1", "0", "**", "5", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "%", "2", "==", "1", "\u0120or", "\u0120b", "%", "2", "==", "1", "\u0120or", "\u0120c", "%", "2", "==", "1", ":", "break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", "=b", "/", "2", "+c", "/", "2", ",a", "/", "2", "+c", "/", "2", ",a", "/", "2", "+b", "/", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "+=", "1", "\u010a\u010a", "else", ":d", "=-", "1", "\u010a\u010a", "print", "(d", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.7967329450848046, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03309", "input": "import statistics\n\nN = int(input())\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in range(1,N+1):\n\n a[i-1] -= i\n\n\n\nb = statistics.median(a)\n\nfor i in range(N):\n\n ans += abs(a[i]-b)\n\nprint((int(ans)))", "input_tokens": ["import", "\u0120statistics", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120", "\u0120a", "[i", "-", "1", "]", "\u0120-=", "\u0120i", "\u010a\u010a\u010a\u010a", "b", "\u0120=", "\u0120statistics", ".median", "(a", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120ans", "\u0120+=", "\u0120abs", "(a", "[i", "]-", "b", ")\u010a\u010a", "print", "((", "int", "(ans", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.8691775287719905, 0.833611120734537, 0.7584425223266994, 0.7186273667339679, 0.833611120734537]} +{"problem_id": "p02665", "input": "n = int(input())\n\nleaves = list(map(int, input().split()))\n\n\n\nans = 0\n\nnodes_min = [0] * (n + 1)\n\nnodes_max = [0] * (n + 1)\n\nnodes_min[n] = leaves[n]\n\nnodes_max[n] = leaves[n]\n\n\n\nfor depth in range(n, 0, -1):\n\n root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2\n\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n\n root_max = nodes_max[depth]\n\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\n\nnodes = [0] * (n + 1)\n\nnodes[0] = 1\n\nif nodes[0] < nodes_min[0]:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n roots = nodes[depth]-leaves[depth]\n\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n\n if nodes[depth+1] < nodes_min[depth+1]:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(nodes)))\n", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "le", "aves", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "nodes", "_min", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "nodes", "_max", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "nodes", "_min", "[n", "]", "\u0120=", "\u0120leaves", "[n", "]\u010a\u010a", "nodes", "_max", "[n", "]", "\u0120=", "\u0120leaves", "[n", "]\u010a\u010a\u010a\u010a", "for", "\u0120depth", "\u0120in", "\u0120range", "(n", ",", "\u0120", "0", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120root", "_min", "\u0120=", "\u0120nodes", "_min", "[", "depth", "]", "\u0120//", "\u0120", "2", "\u0120+", "\u0120nodes", "_min", "[", "depth", "]", "\u0120%", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120nodes", "_min", "[", "depth", "\u0120-", "\u0120", "1", "]", "\u0120=", "\u0120leaves", "[", "depth", "\u0120-", "\u0120", "1", "]", "\u0120+", "\u0120root", "_min", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120root", "_max", "\u0120=", "\u0120nodes", "_max", "[", "depth", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120nodes", "_max", "[", "depth", "\u0120-", "\u0120", "1", "]", "\u0120=", "\u0120leaves", "[", "depth", "\u0120-", "\u0120", "1", "]", "\u0120+", "\u0120root", "_max", "\u010a\u010a", "nodes", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "n", "\u0120+", "\u0120", "1", ")\u010a\u010a", "nodes", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120nodes", "[", "0", "]", "\u0120<", "\u0120nodes", "_min", "[", "0", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120depth", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120roots", "\u0120=", "\u0120nodes", "[", "depth", "]-", "le", "aves", "[", "depth", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nodes", "[", "depth", "\u0120+", "\u0120", "1", "]", "\u0120=", "\u0120min", "(", "roots", "\u0120*", "\u0120", "2", ",", "\u0120nodes", "_max", "[", "depth", "\u0120+", "\u0120", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120nodes", "[", "depth", "+", "1", "]", "\u0120<", "\u0120nodes", "_min", "[", "depth", "+", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((-", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "sum", "(nodes", ")))\u010a"], "input_token_weights": [0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.6771609938949378, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.7084208560793558, 0.5770524973423397, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.6771609938949378, 0.6115475853143139, 0.6771609938949378, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7084208560793558, 0.6448923330239924, 0.6115475853143139, 0.7084208560793558]} +{"problem_id": "p02691", "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\ndp = [0] * 10 ** 7\n\nans = 0\n\nfor i in range(N):\n\n x = i + 1 - A[i]\n\n if x >= 0:\n\n ans += dp[x]\n\n y = i + 1 + A[i]\n\n if y < 10 ** 7:\n\n dp[y] += 1\n\n\n\nprint(ans)\n", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120", "1", "0", "\u0120**", "\u0120", "7", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120i", "\u0120+", "\u0120", "1", "\u0120-", "\u0120A", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120>=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120dp", "[x", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120y", "\u0120=", "\u0120i", "\u0120+", "\u0120", "1", "\u0120+", "\u0120A", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120y", "\u0120<", "\u0120", "1", "0", "\u0120**", "\u0120", "7", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[y", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.833611120734537, 0.5886835746651548, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.5886835746651548, 0.7584425223266994, 0.833611120734537, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.5886835746651548, 0.7186273667339679, 0.5886835746651548, 0.8691775287719905, 0.833611120734537, 0.833611120734537]} +{"problem_id": "p03544", "input": "a,b=2,1\n\nfor i in[0]*int(input()):a,b=b,a+b\n\nprint(a)", "input_tokens": ["a", ",b", "=", "2", ",", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "[", "0", "]*", "int", "(input", "()):", "a", ",b", "=b", ",a", "+b", "\u010a\u010a", "print", "(a", ")"], "input_token_weights": [0.7967329450848046, 0.7967329450848046, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.7967329450848046, 0.7967329450848046, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.883057299767519, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.7022465694939416, 0.6514299043837268, 0.5978920048953399, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02555", "input": "S = int(input())\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))", "input_tokens": ["S", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[", "0", "]*(", "S", "+", "1", ")\u010a\u010a", "dp", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",S", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "0", ",(", "i", "-", "3", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120+=", "\u0120dp", "[j", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "]", "\u0120%=", "\u0120mod", "\u010a\u010a", "print", "((", "dp", "[S", "]))"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7967329450848046, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.9035222925783293, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679, 0.7186273667339679, 0.833611120734537, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.8691775287719905, 0.833611120734537, 0.7584425223266994, 0.7584425223266994, 0.833611120734537]} +{"problem_id": "p03107", "input": "# ABC 120 C\n\n\n\nimport re\n\n\n\nS = input()\n\n\n\nl0 = 0\n\nl1 = 0\n\n\n\nfor i in range(len(S)):\n\n if S[i] == '0':\n\n l0 += 1\n\n elif S[i] == '1':\n\n l1 += 1\n\n\n\nprint((min(l0, l1) * 2))\n", "input_tokens": ["#", "\u0120ABC", "\u0120", "1", "2", "0", "\u0120C", "\u010a\u010a\u010a\u010a", "import", "\u0120re", "\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "l", "0", "\u0120=", "\u0120", "0", "\u010a\u010a", "l", "1", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", "]", "\u0120==", "\u0120'", "0", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "0", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120S", "[i", "]", "\u0120==", "\u0120'", "1", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "1", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "((", "min", "(l", "0", ",", "\u0120l", "1", ")", "\u0120*", "\u0120", "2", "))\u010a"], "input_token_weights": [0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.5928797394668679, 0.89427190936908, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.8170167109432965, 0.7332896764791028, 0.7332896764791028, 0.7332896764791028, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.8170167109432965, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.7760292149144611, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.6419065217751312, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.6886415962350058, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.7332896764791028, 0.5928797394668679, 0.7332896764791028, 0.8170167109432965]} +{"problem_id": "p02657", "input": "def iput(): return int(input())\n\ndef mput(): return list(map(int, input().split()))\n\ndef lput(): return list(map(int, input().split()))\n\n\n\ndef solve():\n\n a, b = mput()\n\n print((a*b))\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()", "input_tokens": ["def", "\u0120ip", "ut", "():", "\u0120return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120m", "put", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "def", "\u0120l", "put", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120m", "put", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "a", "*b", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120solve", "()"], "input_token_weights": [0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.781592256244883, 0.579389560544, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8116478083709829]} +{"problem_id": "p03759", "input": "a, b, c = list(map(int, input().split()))\n\nif (b - a) == (c - b):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "if", "\u0120(", "b", "\u0120-", "\u0120a", ")", "\u0120==", "\u0120(", "c", "\u0120-", "\u0120b", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "YES", "\")\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.9178879013889365, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.7640031686476719]} +{"problem_id": "p03796", "input": "import math\n\nprint((math.factorial(int(input()))%1000000007))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(int", "(input", "()))", "%", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))"], "input_token_weights": [0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905]} +{"problem_id": "p03416", "input": "a,b = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n j = str(i)\n\n if j==''.join(reversed(j)):\n\n count += 1\n\nprint(count)", "input_tokens": ["a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "count", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120j", "=='", "'.", "join", "(re", "versed", "(j", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(count", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03796", "input": "#!/usr/bin/env pypy3\n\n\n\nimport math\n\nprint((math.factorial(int(input())) % 1000000007))", "input_tokens": ["#!/", "usr", "/bin", "/env", "\u0120p", "ypy", "3", "\u010a\u010a\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "print", "((", "math", ".factor", "ial", "(int", "(input", "()))", "\u0120%", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))"], "input_token_weights": [0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.949705583245731, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905]} +{"problem_id": "p03721", "input": "(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\n\nfor a, b in sorted(AB):\n\n K -= b\n\n if K <= 0:\n\n print(a)\n\n break\n", "input_tokens": ["(N", ",", "\u0120K", "),", "\u0120*", "AB", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120s", ".split", "()))", "\u0120for", "\u0120s", "\u0120in", "\u0120open", "(", "0", ")]\u010a\u010a", "for", "\u0120a", ",", "\u0120b", "\u0120in", "\u0120sorted", "(", "AB", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120K", "\u0120-=", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120K", "\u0120<=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(a", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a"], "input_token_weights": [0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.6270757423345348, 0.6270757423345348, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.911283254435702, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.5851191688414608, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7433160191943734, 0.7060506397782503, 0.7060506397782503, 0.5851191688414608, 0.7792424376220217, 0.5851191688414608]} +{"problem_id": "p03796", "input": "mod = int(1e9+7)\n\nn = int(input())\n\n\n\npower = 1\n\nfor i in range(1, n+1):\n\n power = power * i % mod\n\nprint(power)", "input_tokens": ["mod", "\u0120=", "\u0120int", "(", "1", "e", "9", "+", "7", ")\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "power", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120power", "\u0120=", "\u0120power", "\u0120*", "\u0120i", "\u0120%", "\u0120mod", "\u010a\u010a", "print", "(power", ")"], "input_token_weights": [0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.883057299767519, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p03164", "input": "N, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [[10**9+1] * (V + 1) for i in range(N+1)]\n\ndp[0][0] = 0\n\nfor i in range(N):\n\n for j in range(V+1):\n\n if j - L[i][1] >= 0:\n\n dp[i+1][j] = min(dp[i][j], dp[i][j-L[i][1]] + L[i][0])\n\n else:\n\n dp[i+1][j] = dp[i][j]\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[-1][j]:\n\n ans = max(ans, j)\n\nprint(ans)", "input_tokens": ["N", ",", "\u0120W", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]\u010a\u010a", "V", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120V", "\u0120+=", "\u0120L", "[i", "][", "1", "]\u010a\u010a\u010a\u010a", "dp", "\u0120=", "\u0120[[", "1", "0", "**", "9", "+", "1", "]", "\u0120*", "\u0120(", "V", "\u0120+", "\u0120", "1", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", "+", "1", ")]\u010a\u010a", "dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(V", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120j", "\u0120-", "\u0120L", "[i", "][", "1", "]", "\u0120>=", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "]", "\u0120=", "\u0120min", "(dp", "[i", "][", "j", "],", "\u0120dp", "[i", "][", "j", "-L", "[i", "][", "1", "]]", "\u0120+", "\u0120L", "[i", "][", "0", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "+", "1", "][", "j", "]", "\u0120=", "\u0120dp", "[i", "][", "j", "]\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120j", "\u0120in", "\u0120range", "(V", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120", "\u0120W", "\u0120>=", "\u0120dp", "[-", "1", "][", "j", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120max", "(ans", ",", "\u0120j", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.8765066796615488, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.8543560820723151, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8981772421402056, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.6838237134005932, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.7100393521462953, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.7355852514485495, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.7100393521462953, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.8543560820723151, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056]} +{"problem_id": "p03814", "input": "s = input()\n\n\n\nstart = -1\n\nend = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A' and start < 0:\n\n start = i\n\n elif s[i] == 'Z':\n\n end = i\n\nprint((end - start + 1))\n", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "start", "\u0120=", "\u0120-", "1", "\u010a\u010a", "end", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(len", "(s", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "[i", "]", "\u0120==", "\u0120'", "A", "'", "\u0120and", "\u0120start", "\u0120<", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120elif", "\u0120s", "[i", "]", "\u0120==", "\u0120'", "Z", "':\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120end", "\u0120=", "\u0120i", "\u010a\u010a", "print", "((", "end", "\u0120-", "\u0120start", "\u0120+", "\u0120", "1", "))\u010a"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.5928797394668679, 0.89427190936908, 0.89427190936908, 0.89427190936908, 0.8563901704123833, 0.8170167109432965, 0.7332896764791028, 0.8170167109432965, 0.89427190936908, 0.5928797394668679, 0.8170167109432965, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7760292149144611, 0.7332896764791028, 0.7332896764791028, 0.5928797394668679, 0.7332896764791028, 0.8170167109432965, 0.5928797394668679, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.7760292149144611, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.7760292149144611, 0.5928797394668679, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.6886415962350058, 0.6886415962350058, 0.6886415962350058, 0.7332896764791028, 0.5928797394668679, 0.7332896764791028, 0.8170167109432965]} +{"problem_id": "p02412", "input": "while 1:\n\n n,x=list(map(int,input().split()))\n\n if n+x==0:break\n\n print((len([1 for i in range(3,n+1)for j in range(2,x-i)if x-i-j d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120from", "\u0120sys", "\u0120import", "\u0120stdin", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "\u0120=", "\u0120stdin", ".readline", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", ",", "\u0120m", ",", "\u0120r", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(r", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", "[i", "]", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120[[", "1", "0", "**", "8", "]", "\u0120*", "\u0120n", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120i", ",", "\u0120j", ",", "\u0120k", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[i", "-", "1", "][", "j", "-", "1", "]", "\u0120=", "\u0120k", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[j", "-", "1", "][", "i", "-", "1", "]", "\u0120=", "\u0120k", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120War", "shall", "-F", "loyd", "\u0120algorithm", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[i", "][", "j", "]", "\u0120>", "\u0120d", "[i", "][", "k", "]", "\u0120+", "\u0120d", "[k", "][", "j", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[i", "][", "j", "]", "\u0120=", "\u0120d", "[i", "][", "k", "]", "\u0120+", "\u0120d", "[k", "][", "j", "]\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120full", "\u0120search", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120", "8", "!", "\u0120=", "\u0120", "4", "0", "3", "2", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120from", "\u0120itertools", "\u0120import", "\u0120permutations", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120answer", "\u0120=", "\u0120", "1", "0", "**", "8", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120permutations", "(l", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(r", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120d", "[i", "[j", "]][", "i", "[j", "+", "1", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120ans", "\u0120<", "\u0120answer", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120answer", "\u0120=", "\u0120ans", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(answer", ")\u010a\u010a\u010a\u010a", "main", "()\u010a"], "input_token_weights": [0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8765066796615488, 0.8981772421402056, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7100393521462953, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.8543560820723151, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.76049478068099, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6838237134005932, 0.76049478068099, 0.5714954628602014, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8765066796615488, 0.8981772421402056, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.5714954628602014, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.9193881350322848, 0.8981772421402056]} +{"problem_id": "p02702", "input": "from collections import Counter\n\nS = input()[::-1]\n\n\n\nmemo = [0]\n\nd = 0\n\nmod = 2019\n\n\n\nfor s in S:\n\n tmp = int(s) * pow(10, d, mod) % mod\n\n tmp = memo[-1] + tmp\n\n memo.append(tmp % mod)\n\n d += 1\n\n\n\nc = Counter(memo)\n\nans = sum(v * (v - 1) // 2 for v in list(c.values()))\n\nprint(ans)", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "S", "\u0120=", "\u0120input", "()[", "::-", "1", "]\u010a\u010a\u010a\u010a", "memo", "\u0120=", "\u0120[", "0", "]\u010a\u010a", "d", "\u0120=", "\u0120", "0", "\u010a\u010a", "mod", "\u0120=", "\u0120", "2", "0", "1", "9", "\u010a\u010a\u010a\u010a", "for", "\u0120s", "\u0120in", "\u0120S", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120int", "(s", ")", "\u0120*", "\u0120pow", "(", "1", "0", ",", "\u0120d", ",", "\u0120mod", ")", "\u0120%", "\u0120mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120memo", "[-", "1", "]", "\u0120+", "\u0120tmp", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120memo", ".append", "(tmp", "\u0120%", "\u0120mod", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "c", "\u0120=", "\u0120Counter", "(m", "emo", ")\u010a\u010a", "ans", "\u0120=", "\u0120sum", "(v", "\u0120*", "\u0120(", "v", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u0120for", "\u0120v", "\u0120in", "\u0120list", "(c", ".values", "()))\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.6673426178365944, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7060506397782503, 0.7433160191943734, 0.7792424376220217, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.7792424376220217, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.5851191688414608, 0.8139227859741643, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.5851191688414608, 0.6673426178365944, 0.7060506397782503, 0.7792424376220217, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7433160191943734, 0.7060506397782503, 0.6270757423345348, 0.8139227859741643, 0.8798713320153649, 0.8474406118450124, 0.8474406118450124]} +{"problem_id": "p02627", "input": "a = input()\n\nprint(('A' if not a.islower() else 'a'))\n", "input_tokens": ["a", "\u0120=", "\u0120input", "()\u010a\u010a", "print", "(('", "A", "'", "\u0120if", "\u0120not", "\u0120a", ".is", "lower", "()", "\u0120else", "\u0120'", "a", "'))\u010a"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.8563901704123833, 0.8170167109432965, 0.6886415962350058, 0.6886415962350058, 0.7332896764791028, 0.6886415962350058, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.5928797394668679, 0.7332896764791028, 0.6886415962350058, 0.6886415962350058, 0.8170167109432965]} +{"problem_id": "p03325", "input": "N=int(input())\n\na=list(map(int,input().split()))\n\nfor i in range(N):\n\n for j in range(1,31):\n\n if a[i]%(2**j)!=0:\n\n a[i]=j-1\n\n break\n\nprint((sum(a)))", "input_tokens": ["N", "=int", "(input", "())\u010a\u010a", "a", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "3", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120a", "[i", "]", "%(", "2", "**", "j", ")!=", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[i", "]=", "j", "-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "print", "((", "sum", "(a", ")))"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p03416", "input": "a, b = list(map(int, input().split()))\n\ncnt = 0\n\n\n\nfor i in range(a, b+1):\n\n i = str(i)\n\n if i[0] == i[-1] and i[1] == i[-2]:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "input_tokens": ["a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",", "\u0120b", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120i", "\u0120=", "\u0120str", "(i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120i", "[", "0", "]", "\u0120==", "\u0120i", "[-", "1", "]", "\u0120and", "\u0120i", "[", "1", "]", "\u0120==", "\u0120i", "[-", "2", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7640031686476719, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03835", "input": "k, s = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if i + j > s:\n\n break\n\n elif s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n", "input_tokens": ["k", ",", "\u0120s", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(k", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(k", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "\u0120+", "\u0120j", "\u0120>", "\u0120s", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120elif", "\u0120s", "\u0120-", "\u0120i", "\u0120-", "\u0120j", "\u0120<=", "\u0120k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "print", "(cnt", ")\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.6588494518362031, 0.6588494518362031, 0.582053818991329, 0.6588494518362031, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02702", "input": "from collections import Counter\n\n\n\ns = input()\n\nmod1 = 673\n\nmod2 = 3\n\n\n\nnum1 = 0\n\nnum2 = 0\n\nli1 = []\n\nli2 = []\n\npw1 = 10\n\npw2 = 10\n\nfor i, e in enumerate(s, 1):\n\n num1 *= 10\n\n num1 += int(e)\n\n num1 %= mod1\n\n inv = pow(pw1, mod1 - 2, mod1)\n\n li1.append(num1 * inv % mod1)\n\n\n\n num2 *= 10\n\n num2 += int(e)\n\n num2 %= mod2\n\n inv = pow(pw2, mod2 - 2, mod2)\n\n li2.append(num2 * inv % mod2)\n\n\n\n pw1 *= 10\n\n pw1 %= mod1\n\n pw2 *= 10\n\n pw2 %= mod2\n\n\n\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\n\nc = Counter(li)\n\n\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) // 2\n\n\n\nprint(ans)\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a\u010a\u010a", "s", "\u0120=", "\u0120input", "()\u010a\u010a", "mod", "1", "\u0120=", "\u0120", "6", "7", "3", "\u010a\u010a", "mod", "2", "\u0120=", "\u0120", "3", "\u010a\u010a\u010a\u010a", "num", "1", "\u0120=", "\u0120", "0", "\u010a\u010a", "num", "2", "\u0120=", "\u0120", "0", "\u010a\u010a", "li", "1", "\u0120=", "\u0120[]\u010a\u010a", "li", "2", "\u0120=", "\u0120[]\u010a\u010a", "pw", "1", "\u0120=", "\u0120", "1", "0", "\u010a\u010a", "pw", "2", "\u0120=", "\u0120", "1", "0", "\u010a\u010a", "for", "\u0120i", ",", "\u0120e", "\u0120in", "\u0120enumerate", "(s", ",", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "1", "\u0120*=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "1", "\u0120+=", "\u0120int", "(e", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "1", "\u0120%=", "\u0120mod", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "\u0120=", "\u0120pow", "(p", "w", "1", ",", "\u0120mod", "1", "\u0120-", "\u0120", "2", ",", "\u0120mod", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120li", "1", ".append", "(num", "1", "\u0120*", "\u0120inv", "\u0120%", "\u0120mod", "1", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "2", "\u0120*=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "2", "\u0120+=", "\u0120int", "(e", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120num", "2", "\u0120%=", "\u0120mod", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "\u0120=", "\u0120pow", "(p", "w", "2", ",", "\u0120mod", "2", "\u0120-", "\u0120", "2", ",", "\u0120mod", "2", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120li", "2", ".append", "(num", "2", "\u0120*", "\u0120inv", "\u0120%", "\u0120mod", "2", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120pw", "1", "\u0120*=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120pw", "1", "\u0120%=", "\u0120mod", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120pw", "2", "\u0120*=", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120pw", "2", "\u0120%=", "\u0120mod", "2", "\u010a\u010a\u010a\u010a", "li", "\u0120=", "\u0120[", "0", "]", "\u0120+", "\u0120[", "1", "0", "\u0120*", "\u0120e", "1", "\u0120+", "\u0120e", "2", "\u0120for", "\u0120e", "1", ",", "\u0120e", "2", "\u0120in", "\u0120zip", "(li", "1", ",", "\u0120li", "2", ")]\u010a\u010a", "c", "\u0120=", "\u0120Counter", "(li", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120v", "\u0120in", "\u0120list", "(c", ".values", "())", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120v", "\u0120*", "\u0120(", "v", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.833611120734537, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7584425223266994, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7584425223266994, 0.7186273667339679, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.5886835746651548, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8691775287719905, 0.833611120734537, 0.7584425223266994, 0.833611120734537, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7967329450848046, 0.7186273667339679, 0.7186273667339679, 0.6771609938949378, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.6339004969859428, 0.6771609938949378, 0.7584425223266994, 0.5886835746651548, 0.7584425223266994, 0.5886835746651548, 0.8691775287719905, 0.833611120734537, 0.833611120734537]} +{"problem_id": "p03371", "input": "a, b, c, x, y = list(map(int, input().split(' ')))\n\n\n\nc = int(c*2)\n\nm = float('inf')\n\nfor i in range(10**5+1):\n\n m = min(m, a*max(0, x-i)+b*max(0,y-i)+c*i)\n\nprint(m)", "input_tokens": ["a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "('", "\u0120'", "))", ")\u010a\u010a\u010a\u010a", "c", "\u0120=", "\u0120int", "(c", "*", "2", ")\u010a\u010a", "m", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", "0", "**", "5", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120min", "(m", ",", "\u0120a", "*", "max", "(", "0", ",", "\u0120x", "-i", ")+", "b", "*", "max", "(", "0", ",y", "-i", ")+", "c", "*i", ")\u010a\u010a", "print", "(m", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7967329450848046, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02983", "input": "l,r=list(map(int,input().split()))\n\ns=list(range(l,r+1))[:2019]\n\nprint((min(i*j%2019for i in s for j in s if i> i & 1:\n\n a = dp[i][a]\n\n return a >= b\n\ndef solve(a, b):\n\n if a > b:\n\n a, b = b, a\n\n ng = 0\n\n ok = n-1\n\n while ok - ng > 1:\n\n mid = (ng + ok) // 2\n\n if test(mid, a, b):\n\n ok = mid\n\n else:\n\n ng = mid\n\n print(ok)\n\nq = int(input())\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n solve(a, b)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "import", "\u0120bis", "ect", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "X", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "l", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "U", "\u0120=", "\u0120", "1", "7", "\u010a\u010a", "dp", "\u0120=", "\u0120[[", "0", "]*", "n", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(U", "+", "1", ")]\u010a\u010a", "for", "\u0120i", ",", "\u0120x", "\u0120in", "\u0120enumerate", "(X", "):\u010a\u010a", "\u0120", "\u0120t", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_left", "(X", ",", "\u0120x", "+l", ")\u010a\u010a", "\u0120", "\u0120dp", "[", "0", "][", "i", "]", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_right", "(X", ",", "\u0120x", "+l", ")", "\u0120-", "\u0120", "1", "\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(U", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "[k", "+", "1", "][", "i", "]", "\u0120=", "\u0120dp", "[k", "][", "dp", "[k", "][", "i", "]]\u010a\u010a", "def", "\u0120test", "(x", ",", "\u0120a", ",", "\u0120b", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(U", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120x", "\u0120>>", "\u0120i", "\u0120&", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120dp", "[i", "][", "a", "]\u010a\u010a", "\u0120", "\u0120return", "\u0120a", "\u0120>=", "\u0120b", "\u010a\u010a", "def", "\u0120solve", "(a", ",", "\u0120b", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120a", "\u0120>", "\u0120b", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120b", ",", "\u0120a", "\u010a\u010a", "\u0120", "\u0120ng", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120", "\u0120ok", "\u0120=", "\u0120n", "-", "1", "\u010a\u010a", "\u0120", "\u0120while", "\u0120ok", "\u0120-", "\u0120ng", "\u0120>", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120mid", "\u0120=", "\u0120(", "ng", "\u0120+", "\u0120ok", ")", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120test", "(mid", ",", "\u0120a", ",", "\u0120b", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ok", "\u0120=", "\u0120mid", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120ng", "\u0120=", "\u0120mid", "\u010a\u010a", "\u0120", "\u0120print", "(ok", ")\u010a\u010a", "q", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(q", "):\u010a\u010a", "\u0120", "\u0120a", ",", "\u0120b", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120a", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120b", "\u0120-=", "\u0120", "1", "\u010a\u010a", "\u0120", "\u0120solve", "(a", ",", "\u0120b", ")"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852]} +{"problem_id": "p02994", "input": "n, like = list(map(int, input().split()))\n\n\n\narr = [like + i for i in range(n)]\n\n\n\narr.sort(key=lambda x:abs(x))\n\n\n\nprint((sum(arr[1:])))\n", "input_tokens": ["n", ",", "\u0120like", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "arr", "\u0120=", "\u0120[", "like", "\u0120+", "\u0120i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "arr", ".sort", "(key", "=lambda", "\u0120x", ":", "abs", "(x", "))", "\u010a\u010a\u010a\u010a", "print", "((", "sum", "(arr", "[", "1", ":]", ")))\u010a"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.8591441175808593]} +{"problem_id": "p03371", "input": "A, B, C, X, Y = list(map(int, input().split()))\n\nans = float('inf')\n\nfor i in range(max(X,Y)+1):\n\n cost = 2 * C * i + max(0,X-i)*A +max(0,Y-i)*B\n\n ans = min(ans,cost)\n\nprint(ans)", "input_tokens": ["A", ",", "\u0120B", ",", "\u0120C", ",", "\u0120X", ",", "\u0120Y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ans", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(max", "(X", ",Y", ")+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120cost", "\u0120=", "\u0120", "2", "\u0120*", "\u0120C", "\u0120*", "\u0120i", "\u0120+", "\u0120max", "(", "0", ",X", "-i", ")*", "A", "\u0120+", "max", "(", "0", ",Y", "-i", ")*", "B", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",c", "ost", ")\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.6588494518362031, 0.6211886504852411, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.6588494518362031, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03828", "input": "#coding: UTF-8\n\nimport math\n\nN=int(input())\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N):\n\n plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k/(i+1)\n\n lis[i]=n\n\n return lis\n\nout_lis=[0]*N\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\nprint((out%1000000007))", "input_tokens": ["#", "coding", ":", "\u0120UTF", "-", "8", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "N", "=int", "(input", "())\u010a\u010a", "def", "\u0120prime", "_list", "(k", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120lis", "=[", "True", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",k", "+", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120lis", "[", "0", "]=", "False", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",k", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "=", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120j", "*j", "<=", "i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "%", "j", "==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120lis", "[i", "-", "1", "]=", "False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "+=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120lis", "\u010a\u010a", "#", "\u0120\u0120\u0120", "\u0120print", "(l", "is", ")\u010a\u010a", "def", "\u0120p", "_fact", "(k", ",N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120plist", "=", "prime", "_list", "(k", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120lis", "=[", "0", "]*", "N", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "=", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120plist", "[i", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120k", "%(", "i", "+", "1", ")==", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "+=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "=k", "/(", "i", "+", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120lis", "[i", "]=", "n", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120lis", "\u010a\u010a", "out", "_l", "is", "=[", "0", "]*", "N", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",N", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120input", "_l", "is", "=p", "_fact", "(i", ",N", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120out", "_l", "is", "=[", "out", "_l", "is", "[j", "]+", "input", "_l", "is", "[j", "]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "0", ",N", ")]\u010a\u010a", "#print", "(out", "_l", "is", ")\u010a\u010a", "out", "=", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "0", ",N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120out", "=out", "*(", "out", "_l", "is", "[i", "]+", "1", ")\u010a\u010a", "print", "((", "out", "%", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "))"], "input_token_weights": [0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.5749858371565393, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9557555573970933, 0.5749858371565393, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6696615116992518, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.8357386476069529, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.9094625571831276, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383]} +{"problem_id": "p02245", "input": "import sys\n\nimport queue\n\n\n\nN = 3\n\nf= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = queue.Queue()\n\nV = dict()\n\n\n\nQ.put([f,f.index('0'),0])\n\nV[f] = True\n\n\n\nwhile not Q.empty():\n\n u = Q.get()\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]//N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 \n\n Q.put(v)\n\n\n\nprint((u[2]))\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "import", "\u0120queue", "\u010a\u010a\u010a\u010a", "N", "\u0120=", "\u0120", "3", "\u010a\u010a", "f", "=", "\u0120''.", "join", "(sys", ".stdin", ".readline", "().", "split", "())\u010a\u010a", "f", "+=", "\u0120''.", "join", "(sys", ".stdin", ".readline", "().", "split", "())\u010a\u010a", "f", "+=", "\u0120''.", "join", "(sys", ".stdin", ".readline", "().", "split", "())\u010a\u010a", "\u010a\u010a", "dd", "\u0120=", "\u0120[[", "-", "1", ",", "\u0120", "0", "],", "\u0120[", "0", ",", "\u0120-", "1", "],", "\u0120[", "1", ",", "\u0120", "0", "],", "\u0120[", "0", ",", "\u0120", "1", "]]", "\u010a\u010a\u010a\u010a", "Q", "\u0120=", "\u0120queue", ".Queue", "()\u010a\u010a", "V", "\u0120=", "\u0120dict", "()\u010a\u010a\u010a\u010a", "Q", ".put", "([", "f", ",f", ".index", "('", "0", "'),", "0", "])\u010a\u010a", "V", "[f", "]", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "while", "\u0120not", "\u0120Q", ".empty", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120u", "\u0120=", "\u0120Q", ".get", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120u", "[", "0", "]", "\u0120==", "\u0120'", "1", "2", "3", "4", "5", "6", "7", "8", "0", "':", "\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120sx", ",", "\u0120sy", "\u0120=", "\u0120u", "[", "1", "]", "//", "N", ",", "\u0120u", "[", "1", "]%", "N", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120dx", ",", "\u0120dy", "\u0120in", "\u0120dd", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tx", ",", "\u0120ty", "\u0120=", "\u0120sx", "+", "dx", ",", "\u0120sy", "+", "dy", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120tx", "<", "0", "\u0120or", "\u0120ty", "<", "0", "\u0120or", "\u0120tx", ">=", "N", "\u0120or", "\u0120ty", ">=", "N", ":", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120u", "[:", "]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "1", ",", "\u0120n", "2", "\u0120=", "\u0120u", "[", "1", "],", "\u0120tx", "*N", "+", "ty", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[", "1", "]", "\u0120=", "\u0120n", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120n", "1", ">n", "2", ":", "\u0120n", "1", ",", "\u0120n", "2", "\u0120=", "\u0120n", "2", ",", "\u0120n", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[", "0", "]", "\u0120=", "\u0120v", "[", "0", "][", "0", ":n", "1", "]+", "v", "[", "0", "][", "n", "2", "]+", "v", "[", "0", "][", "n", "1", "+", "1", ":n", "2", "]+", "v", "[", "0", "][", "n", "1", "]+", "v", "[", "0", "][", "n", "2", "+", "1", ":]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120V", ".get", "(v", "[", "0", "],", "\u0120False", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120V", "[v", "[", "0", "]]", "\u0120=", "\u0120True", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[", "2", "]", "\u0120+=", "\u0120", "1", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120Q", ".put", "(v", ")\u010a\u010a\u010a\u010a", "print", "((", "u", "[", "2", "]))\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7084208560793558, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308]} +{"problem_id": "p03854", "input": "def main():\n\n S = input()\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n # print(w1,w2,w3,w4)\n\n S = S[::-1]\n\n # print(S)\n\n\n\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n\n words = [w1, w2, w3, w4]\n\n T = ''\n\n while S != T:\n\n cand = []\n\n for w in words:\n\n new_t = T + w\n\n cand.append(new_t) \n\n # print('cand', cand)\n\n ans = False\n\n for c in cand:\n\n if c == S[:len(c)]:\n\n T = c\n\n ans = True\n\n\n\n if not ans:\n\n break\n\n\n\n if S == T:\n\n print('YES')\n\n else:\n\n print(\"NO\")\n\n\n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120input", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "1", "\u0120=", "\u0120'", "dream", "'", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "2", "\u0120=", "\u0120'", "dream", "er", "'", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "3", "\u0120=", "\u0120'", "erase", "'", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120w", "4", "\u0120=", "\u0120'", "eras", "er", "'", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(w", "1", ",w", "2", ",w", "3", ",w", "4", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120S", "\u0120=", "\u0120S", "[::-", "1", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120print", "(S", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120words", "\u0120=", "\u0120['", "dream", "',", "\u0120'", "dream", "er", "',", "\u0120'", "erase", "',", "\u0120'", "eras", "er", "']\u010a\u010a", "\u0120\u0120\u0120", "\u0120words", "\u0120=", "\u0120[", "w", "1", ",", "\u0120w", "2", ",", "\u0120w", "3", ",", "\u0120w", "4", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120''\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120S", "\u0120!=", "\u0120T", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cand", "\u0120=", "\u0120[]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120w", "\u0120in", "\u0120words", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120new", "_t", "\u0120=", "\u0120T", "\u0120+", "\u0120w", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cand", ".append", "(new", "_t", ")", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "\u0120print", "('", "c", "and", "',", "\u0120cand", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120False", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120cand", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120c", "\u0120==", "\u0120S", "[:", "len", "(c", ")]", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120T", "\u0120=", "\u0120c", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120True", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120S", "\u0120==", "\u0120T", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "YES", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")\u010a\u010a", "\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6448923330239924, 0.6115475853143139, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7387330872699986, 0.5770524973423397, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852]} +{"problem_id": "p03806", "input": "N,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\nmaxa = maxb = 0\n\nfor a,b,c in src:\n\n for ai in range(maxa,-1,-1):\n\n for bi in range(maxb,-1,-1):\n\n dp[ai+a][bi+b] = min(dp[ai+a][bi+b], dp[ai][bi] + c)\n\n maxa += a\n\n maxb += b\n\n\n\nans = INF\n\nfor i in range(1,401):\n\n if MA*i > 400 or MB*i > 400: break\n\n ans = min(ans, dp[MA*i][MB*i])\n\nprint((-1 if ans == INF else ans))", "input_tokens": ["N", ",", "MA", ",", "MB", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "src", "\u0120=", "\u0120[", "tuple", "(map", "(int", ",input", "().", "split", "()))", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "**", "9", "\u010a\u010a", "dp", "\u0120=", "\u0120[[", "INF", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "4", "0", "1", ")]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "0", "1", ")]\u010a\u010a", "dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "max", "a", "\u0120=", "\u0120max", "b", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120a", ",b", ",c", "\u0120in", "\u0120src", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120ai", "\u0120in", "\u0120range", "(max", "a", ",-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120bi", "\u0120in", "\u0120range", "(max", "b", ",-", "1", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[", "ai", "+a", "][", "bi", "+b", "]", "\u0120=", "\u0120min", "(dp", "[", "ai", "+a", "][", "bi", "+b", "],", "\u0120dp", "[", "ai", "][", "bi", "]", "\u0120+", "\u0120c", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "a", "\u0120+=", "\u0120a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120max", "b", "\u0120+=", "\u0120b", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120INF", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "4", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120MA", "*i", "\u0120>", "\u0120", "4", "0", "0", "\u0120or", "\u0120MB", "*i", "\u0120>", "\u0120", "4", "0", "0", ":", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120dp", "[", "MA", "*i", "][", "MB", "*i", "])\u010a\u010a", "print", "((-", "1", "\u0120if", "\u0120ans", "\u0120==", "\u0120INF", "\u0120else", "\u0120ans", "))"], "input_token_weights": [0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.8854867975141383, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8357386476069529, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7833854580549265, 0.7561438265913266, 0.8357386476069529, 0.5749858371565393, 0.6993277790098028, 0.6993277790098028, 0.6696615116992518, 0.6696615116992518, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6696615116992518, 0.6390881791778984, 0.6390881791778984, 0.6993277790098028, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.9094625571831276, 0.8854867975141383, 0.8099046207685895, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383]} +{"problem_id": "p03814", "input": "s = input()\n\na = s.find('A')\n\nz = s[::-1].find('Z')\n\nans = len(s)-a-z\n\n\n\nprint(ans)\n\n\n\n#print(*ans, sep='\\n')", "input_tokens": ["s", "\u0120=", "\u0120input", "()\u010a\u010a", "a", "\u0120=", "\u0120s", ".find", "('", "A", "')\u010a\u010a", "z", "\u0120=", "\u0120s", "[::-", "1", "].", "find", "('", "Z", "')\u010a\u010a", "ans", "\u0120=", "\u0120len", "(s", ")-", "a", "-z", "\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a\u010a\u010a\u010a", "#print", "(*", "ans", ",", "\u0120sep", "='\\", "n", "')"], "input_token_weights": [0.8563901704123833, 0.8563901704123833, 0.8170167109432965, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.7332896764791028, 0.7332896764791028, 0.6419065217751312, 0.7760292149144611, 0.7760292149144611, 0.7760292149144611, 0.7332896764791028, 0.7760292149144611, 0.8563901704123833, 0.8563901704123833, 0.7332896764791028, 0.6886415962350058, 0.7760292149144611, 0.7760292149144611, 0.8170167109432965, 0.5928797394668679, 0.8563901704123833, 0.8170167109432965, 0.8170167109432965, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354, 0.9307708458268354]} +{"problem_id": "p03494", "input": "_,t=open(0);n=eval(t.replace(' ','|'));print((len(bin(n&-n))-3))", "input_tokens": ["_,", "t", "=open", "(", "0", ");", "n", "=", "eval", "(t", ".replace", "('", "\u0120','", "|", "'));", "print", "((", "len", "(bin", "(n", "&", "-", "n", "))-", "3", "))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.9460144469641688, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.9460144469641688, 0.8889473014940781, 0.8591441175808593, 0.7640031686476719, 0.7301658005010259, 0.6588494518362031, 0.6211886504852411, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p03309", "input": "import statistics\n\nN = int(input())\n\nA = [int(a)-i-1 for i,a in enumerate(input().split(),1)]\n\nb = statistics.median_low(A)\n\nc = statistics.median_high(A)\n\nd = sum([abs(x-b) for x in A])\n\ne = sum([abs(x-c) for x in A])\n\nprint((min(d,e)))", "input_tokens": ["import", "\u0120statistics", "\u010a\u010a", "N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120[", "int", "(a", ")-", "i", "-", "1", "\u0120for", "\u0120i", ",a", "\u0120in", "\u0120enumerate", "(input", "().", "split", "(),", "1", ")]\u010a\u010a", "b", "\u0120=", "\u0120statistics", ".median", "_low", "(A", ")\u010a\u010a", "c", "\u0120=", "\u0120statistics", ".median", "_high", "(A", ")\u010a\u010a", "d", "\u0120=", "\u0120sum", "([", "abs", "(x", "-b", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120A", "])\u010a\u010a", "e", "\u0120=", "\u0120sum", "([", "abs", "(x", "-c", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120A", "])\u010a\u010a", "print", "((", "min", "(d", ",e", ")))"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.7640031686476719, 0.7301658005010259, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8284253466378658, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.8591441175808593]} +{"problem_id": "p03416", "input": "a,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n new = list(reversed(list(str(i))))\n\n if new == list(str(i)):\n\n c += 1\n\n \n\n \n\nprint(c)", "input_tokens": ["a", ",b", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "c", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(a", ",b", "+", "1", "):\u010a\u010a", "\u0120", "\u0120new", "\u0120=", "\u0120list", "(re", "versed", "(list", "(str", "(i", "))))\u010a\u010a", "\u0120", "\u0120if", "\u0120new", "\u0120==", "\u0120list", "(str", "(i", "))", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "print", "(c", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.6115475853143139, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03013", "input": "import sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int,input().split()))\n\nhole = [0] * (N+1)\n\nfor i in range(M):\n\n hole[int(input())] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nif N == 2:\n\n if hole[1] == 1:\n\n print((1))\n\n exit()\n\n if hole[1] == 0:\n\n print((2))\n\n exit()\n\nflg_one = False\n\nflg_two = False\n\nfirst = 1\n\nsecond = 2\n\nif hole[1] == 1:\n\n first = 0\n\n second = 1\n\n flg_one = True\n\nif hole[2] == 1:\n\n first = 1\n\n second = 0\n\n flg_two = True\n\nif flg_one and flg_two:\n\n print((0))\n\n exit()\n\n\n\nfor i in range(3,N):\n\n if hole[i] == 1:\n\n first = second\n\n second = 0\n\n continue\n\n tmp = first + second\n\n tmp %= 1000000007\n\n first = second\n\n second = tmp\n\ntmp = first + second\n\ntmp %= 1000000007\n\nprint(tmp)", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "hole", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "+", "1", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120hole", "[int", "(input", "())", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120N", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "if", "\u0120N", "\u0120==", "\u0120", "2", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120hole", "[", "1", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120hole", "[", "1", "]", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "2", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a", "fl", "g", "_one", "\u0120=", "\u0120False", "\u010a\u010a", "fl", "g", "_two", "\u0120=", "\u0120False", "\u010a\u010a", "first", "\u0120=", "\u0120", "1", "\u010a\u010a", "second", "\u0120=", "\u0120", "2", "\u010a\u010a", "if", "\u0120hole", "[", "1", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120first", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120second", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120fl", "g", "_one", "\u0120=", "\u0120True", "\u010a\u010a", "if", "\u0120hole", "[", "2", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120first", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120second", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120fl", "g", "_two", "\u0120=", "\u0120True", "\u010a\u010a", "if", "\u0120fl", "g", "_one", "\u0120and", "\u0120fl", "g", "_two", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120exit", "()\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120hole", "[i", "]", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120first", "\u0120=", "\u0120second", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120second", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120continue", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120first", "\u0120+", "\u0120second", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120%=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120first", "\u0120=", "\u0120second", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120second", "\u0120=", "\u0120tmp", "\u010a\u010a", "tmp", "\u0120=", "\u0120first", "\u0120+", "\u0120second", "\u010a\u010a", "tmp", "\u0120%=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a", "print", "(tmp", ")"], "input_token_weights": [0.9178879013889365, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.7301658005010259, 0.582053818991329, 0.7640031686476719, 0.7301658005010259, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.9178879013889365, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7967329450848046, 0.582053818991329, 0.8284253466378658, 0.7967329450848046, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p03558", "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n s = S()\n\n t = S()\n\n if s+t == t[::-1]+s[::-1]:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n\n\n#B\n\ndef B():\n\n n = I()\n\n for i in range(int(n**0.5)+2)[::-1]:\n\n if i*i <= n:\n\n print((i*i))\n\n quit()\n\n#C\n\ndef C():\n\n n = I()\n\n a = LI()\n\n b = LI()\n\n c = LI()\n\n q = [0 for i in range(n)]\n\n ans = 0\n\n a.sort()\n\n b.sort()\n\n c.sort()\n\n for i in range(n):\n\n j = bisect.bisect_left(a,b[i])\n\n q[i] = j\n\n for i in range(n-1):\n\n q[i+1] += q[i]\n\n q.insert(0,0)\n\n for i in range(n):\n\n j = bisect.bisect_left(b,c[i])\n\n ans += q[j]\n\n print(ans)\n\n#D\n\ndef D():\n\n def dijkstra():\n\n d = [float(\"inf\") for i in range(k)]\n\n q = [[0,1]]\n\n d[1] = 0\n\n while q:\n\n dx,x = heappop(q)\n\n for y,dy in v[x]:\n\n if d[y] > dx+dy:\n\n d[y] = dx+dy\n\n heappush(q,[d[y],y])\n\n print((d[0]+1))\n\n k = I()\n\n if k == 1:\n\n print((1))\n\n quit()\n\n v = [[] for i in range(k)]\n\n for i in range(1,k):\n\n v[i].append([(i+1)%k,1])\n\n v[i].append([i*10%k,0])\n\n dijkstra()\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n return\n\n\n\n#G\n\ndef G():\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n D()\n", "input_tokens": ["#!", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "import", "\u0120bis", "ect", "\u010a\u010a", "import", "\u0120random", "\u010a\u010a", "def", "\u0120LI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120I", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120LS", "():", "return", "\u0120list", "(map", "(list", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120S", "():", "\u0120return", "\u0120list", "(sys", ".stdin", ".readline", "())", "[:-", "1", "]\u010a\u010a", "def", "\u0120IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120S", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120SR", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a\u010a\u010a", "#", "A", "\u010a\u010a", "def", "\u0120A", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120s", "\u0120=", "\u0120S", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120S", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120s", "+t", "\u0120==", "\u0120t", "[::-", "1", "]+", "s", "[::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "YES", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(\"", "NO", "\")\u010a\u010a", "\u010a\u010a", "#", "B", "\u010a\u010a", "def", "\u0120B", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(int", "(n", "**", "0", ".", "5", ")+", "2", ")[", "::-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "*i", "\u0120<=", "\u0120n", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "i", "*i", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120quit", "()\u010a\u010a", "#", "C", "\u010a\u010a", "def", "\u0120C", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", ".sort", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_left", "(a", ",b", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "[i", "]", "\u0120=", "\u0120j", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "[i", "+", "1", "]", "\u0120+=", "\u0120q", "[i", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", ".insert", "(", "0", ",", "0", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120bis", "ect", ".b", "is", "ect", "_left", "(b", ",c", "[i", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120q", "[j", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "#", "D", "\u010a\u010a", "def", "\u0120D", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120di", "jk", "stra", "():\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120[", "float", "(\"", "inf", "\")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120q", "\u0120=", "\u0120[[", "0", ",", "1", "]]\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[", "1", "]", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120q", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dx", ",x", "\u0120=", "\u0120he", "app", "op", "(q", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120y", ",", "dy", "\u0120in", "\u0120v", "[x", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120d", "[y", "]", "\u0120>", "\u0120dx", "+", "dy", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[y", "]", "\u0120=", "\u0120dx", "+", "dy", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120he", "app", "ush", "(q", ",[", "d", "[y", "],", "y", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "d", "[", "0", "]+", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120k", "\u0120==", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "1", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120quit", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120v", "\u0120=", "\u0120[[]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(k", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",k", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[i", "].", "append", "([(", "i", "+", "1", ")%", "k", ",", "1", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120v", "[i", "].", "append", "([", "i", "*", "1", "0", "%", "k", ",", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120di", "jk", "stra", "()\u010a\u010a", "#", "E", "\u010a\u010a", "def", "\u0120E", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "F", "\u010a\u010a", "def", "\u0120F", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "G", "\u010a\u010a", "def", "\u0120G", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "H", "\u010a\u010a", "def", "\u0120H", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "S", "olve", "\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120D", "()\u010a"], "input_token_weights": [0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.76049478068099, 0.76049478068099, 0.8543560820723151, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.7847988758021361, 0.808526270355906, 0.8543560820723151, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.76049478068099, 0.76049478068099, 0.8543560820723151, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.8981772421402056, 0.8543560820723151, 0.8317036996956922, 0.76049478068099, 0.7847988758021361, 0.8317036996956922, 0.8765066796615488, 0.8317036996956922, 0.8765066796615488, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8981772421402056, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.7847988758021361, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.7847988758021361, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.7847988758021361, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8543560820723151, 0.8317036996956922, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.808526270355906, 0.808526270355906, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.76049478068099, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.5714954628602014, 0.7847988758021361, 0.76049478068099, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.7847988758021361, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8981772421402056, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.7847988758021361, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.808526270355906, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.76049478068099, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.5714954628602014, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.6569022703191485, 0.5714954628602014, 0.5714954628602014, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.5714954628602014, 0.8317036996956922, 0.808526270355906, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.808526270355906, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.8317036996956922, 0.808526270355906, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p03796", "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "x", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "print", "((", "math", ".factor", "ial", "(x", ")", "\u0120%", "\u0120(", "1", "0", "**", "9", "\u0120+", "\u0120", "7", ")))"], "input_token_weights": [0.9035222925783293, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.8691775287719905, 0.833611120734537, 0.7967329450848046, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6771609938949378, 0.5886835746651548, 0.6771609938949378, 0.833611120734537]} +{"problem_id": "p02596", "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k//7 if k % 7 == 0 else k)\n\n if l % 2 == 0 or l % 5 == 0:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(-pow(l, 1/2))):\n\n if r % i == 0:\n\n phi = phi//i*(i-1)\n\n while r % i:\n\n r //= i\n\n\n\n a = 10 % l\n\n ret = 1\n\n while(a != 1):\n\n a = a*10 % l\n\n ret += 1\n\n if phi < ret:\n\n ret = -1\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "input_tokens": ["#", "\u0120coding", ":", "\u0120utf", "-", "8", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120solve", "(*", "args", ":", "\u0120str", ")", "\u0120->", "\u0120str", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "\u0120=", "\u0120int", "(args", "[", "0", "])\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120", "9", "*(", "k", "//", "7", "\u0120if", "\u0120k", "\u0120%", "\u0120", "7", "\u0120==", "\u0120", "0", "\u0120else", "\u0120k", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120l", "\u0120%", "\u0120", "2", "\u0120==", "\u0120", "0", "\u0120or", "\u0120l", "\u0120%", "\u0120", "5", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120'-", "1", "'\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120phi", "\u0120=", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",", "\u0120int", "(-", "pow", "(l", ",", "\u0120", "1", "/", "2", ")))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120r", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120phi", "\u0120=", "\u0120phi", "//", "i", "*(", "i", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120while", "\u0120r", "\u0120%", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120r", "\u0120//=", "\u0120i", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120", "1", "0", "\u0120%", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "(a", "\u0120!=", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120a", "*", "1", "0", "\u0120%", "\u0120l", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120phi", "\u0120<", "\u0120ret", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120-", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120str", "(ret", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "solve", "(*(", "open", "(", "0", ").", "read", "().", "split", "lines", "()))", "))\u010a"], "input_token_weights": [0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.9625183119837646, 0.5700083567488032, 0.9432371260907066, 0.9432371260907066, 0.9235768548788368, 0.883057299767519, 0.9035222925783293, 0.883057299767519, 0.9235768548788368, 0.9432371260907066, 0.9235768548788368, 0.9432371260907066, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.7739350698055053, 0.7967329450848046, 0.5700083567488032, 0.7967329450848046, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.5700083567488032, 0.9035222925783293, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.862164725336545, 0.5700083567488032, 0.862164725336545, 0.883057299767519, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.862164725336545, 0.5700083567488032, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.819022641134497, 0.7739350698055053, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.862164725336545, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7739350698055053, 0.7267182280470056, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.5700083567488032, 0.819022641134497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.862164725336545, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.5700083567488032, 0.5700083567488032, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.5700083567488032, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.819022641134497, 0.819022641134497, 0.5700083567488032, 0.5700083567488032, 0.8408263201236497, 0.8408263201236497, 0.5700083567488032, 0.8408263201236497, 0.5700083567488032, 0.5700083567488032, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.862164725336545, 0.5700083567488032, 0.7967329450848046, 0.7967329450848046, 0.7739350698055053, 0.7739350698055053, 0.5700083567488032, 0.5700083567488032, 0.819022641134497, 0.5700083567488032, 0.5700083567488032, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.862164725336545, 0.9432371260907066, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9432371260907066, 0.5700083567488032, 0.883057299767519, 0.862164725336545, 0.819022641134497, 0.7967329450848046, 0.6250192001927346, 0.5978920048953399, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046, 0.862164725336545]} +{"problem_id": "p03013", "input": "import sys\n\nsys.setrecursionlimit(100000)\n\n\n\ndef intinput(): return list(map(int,sys.stdin.readline().split()))\n\n\n\nfib={0:0,1:1,2:1}\n\nfor i in range(3,100003):\n\n fib[i]=fib[i-1]+fib[i-2]\n\n # fib.append(fib[i-1]+fib[i-2])\n\n\n\nn,m=intinput()\n\nmod=10**9+7\n\na=[int(sys.stdin.readline()) for _ in range(m)]\n\nif m!=0:\n\n l=[a[0]]\n\n for i in range(len(a)-1):\n\n l.append(a[i+1]-a[i]-1)\n\n l.append(n-a[-1])\n\n k=1\n\n for i in l:\n\n k=fib[i]*k%mod\n\n print((k%mod))\n\nelse:\n\n print((fib[n+1]%mod))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", ")\u010a\u010a\u010a\u010a", "def", "\u0120int", "input", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "sys", ".stdin", ".readline", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "fib", "={", "0", ":", "0", ",", "1", ":", "1", ",", "2", ":", "1", "}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "3", ",", "1", "0", "0", "0", "0", "3", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120fib", "[i", "]=", "fib", "[i", "-", "1", "]+", "fib", "[i", "-", "2", "]\u010a\u010a", "\u0120", "\u0120#", "\u0120", "\u0120fib", ".append", "(f", "ib", "[i", "-", "1", "]+", "fib", "[i", "-", "2", "])\u010a\u010a", "\u010a\u010a", "n", ",m", "=int", "input", "()\u010a\u010a", "mod", "=", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "a", "=[", "int", "(sys", ".stdin", ".readline", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(m", ")]\u010a\u010a", "if", "\u0120m", "!=", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "=[", "a", "[", "0", "]]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(a", ")-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120l", ".append", "(a", "[i", "+", "1", "]-", "a", "[i", "]-", "1", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", ".append", "(n", "-a", "[-", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", "=f", "ib", "[i", "]*", "k", "%", "mod", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "k", "%", "mod", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "fib", "[n", "+", "1", "]%", "mod", "))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.7084208560793558, 0.7084208560793558, 0.8245182914059852, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046]} +{"problem_id": "p02767", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nanswer = 10 ** 9\n\nfor i in range(1,101):\n\n tmp = 0\n\n for a in A:\n\n tmp += abs(a-i) ** 2\n\n answer = min(answer,tmp)\n\nprint(answer)", "input_tokens": ["N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "answer", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "9", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "1", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120tmp", "\u0120+=", "\u0120abs", "(a", "-i", ")", "\u0120**", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120answer", "\u0120=", "\u0120min", "(answer", ",tmp", ")\u010a\u010a", "print", "(answer", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.582053818991329, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6588494518362031, 0.6211886504852411, 0.6588494518362031, 0.7301658005010259, 0.582053818991329, 0.7301658005010259, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02850", "input": "\"\"\"\n\nchallenge case\n\n\n\nin:\n\n3\n\n1 3\n\n2 3\n\n\n\nout:\n\n1\n\n1\n\n1\n\n\"\"\"\n\n\n\nfrom collections import deque\n\n\n\ndef main():\n\n\tN, *AB = list(map(int, open(0).read().split()))\n\n\tB = AB[1::2]\n\n\n\n\tE = [[] for _ in range(N + 1)]\n\n\tfor a, b in zip(*[iter(AB)] * 2):\n\n\t\tE[a] += b,\n\n\n\n\tQ = deque([1])\n\n\tC = [0] * (N + 1)\n\n\twhile Q:\n\n\t\tv = Q.popleft()\n\n\t\tc = 0\n\n\t\tfor u in E[v]:\n\n\t\t\tc += 1 + (c + 1 == C[v])\n\n\t\t\tC[u] = c\n\n\t\t\tQ += u,\n\n\n\n\tprint((max(C)))\n\n\tfor b in B:\n\n\t\tprint((C[b]))\n\n\n\nmain()", "input_tokens": ["\"\"\"\u010a\u010a", "challenge", "\u0120case", "\u010a\u010a\u010a\u010a", "in", ":\u010a\u010a", "3", "\u010a\u010a", "1", "\u0120", "3", "\u010a\u010a", "2", "\u0120", "3", "\u010a\u010a\u010a\u010a", "out", ":\u010a\u010a", "1", "\u010a\u010a", "1", "\u010a\u010a", "1", "\u010a\u010a", "\"\"\"", "\u010a\u010a\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0109N", ",", "\u0120*", "AB", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120open", "(", "0", ").", "read", "().", "split", "()))\u010a\u010a", "\u0109B", "\u0120=", "\u0120AB", "[", "1", "::", "2", "]\u010a\u010a\u010a\u010a", "\u0109E", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "\u0120+", "\u0120", "1", ")]\u010a\u010a", "\u0109for", "\u0120a", ",", "\u0120b", "\u0120in", "\u0120zip", "(*", "[", "iter", "(", "AB", ")]", "\u0120*", "\u0120", "2", "):\u010a\u010a", "\u0109", "\u0109E", "[a", "]", "\u0120+=", "\u0120b", ",\u010a\u010a\u010a\u010a", "\u0109Q", "\u0120=", "\u0120deque", "([", "1", "])\u010a\u010a", "\u0109C", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120(", "N", "\u0120+", "\u0120", "1", ")\u010a\u010a", "\u0109while", "\u0120Q", ":\u010a\u010a", "\u0109", "\u0109v", "\u0120=", "\u0120Q", ".p", "opleft", "()\u010a\u010a", "\u0109", "\u0109c", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0109", "\u0109for", "\u0120u", "\u0120in", "\u0120E", "[v", "]:\u010a\u010a", "\u0109\u0109", "\u0109c", "\u0120+=", "\u0120", "1", "\u0120+", "\u0120(", "c", "\u0120+", "\u0120", "1", "\u0120==", "\u0120C", "[v", "])\u010a\u010a", "\u0109\u0109", "\u0109C", "[u", "]", "\u0120=", "\u0120c", "\u010a\u010a", "\u0109\u0109", "\u0109Q", "\u0120+=", "\u0120u", ",\u010a\u010a\u010a\u010a", "\u0109print", "((", "max", "(C", ")))\u010a\u010a", "\u0109for", "\u0120b", "\u0120in", "\u0120B", ":\u010a\u010a", "\u0109", "\u0109print", "((", "C", "[b", "]))", "\u010a\u010a\u010a\u010a", "main", "()"], "input_token_weights": [0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.7186273667339679, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7453461554353482, 0.5731452134031394, 0.7453461554353482, 0.8456076926739031, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7713695892187169, 0.7453461554353482, 0.7186273667339679, 0.7186273667339679, 0.7713695892187169, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.8922045961188434, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8214688817838891, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.8456076926739031, 0.5731452134031394, 0.5731452134031394, 0.7713695892187169, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7186273667339679, 0.6629477592666795, 0.6629477592666795, 0.5731452134031394, 0.6629477592666795, 0.6911750402874859, 0.6629477592666795, 0.6629477592666795, 0.7186273667339679, 0.5731452134031394, 0.5731452134031394, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.7713695892187169, 0.7453461554353482, 0.7453461554353482, 0.5731452134031394, 0.8456076926739031, 0.7967329450848046, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7453461554353482, 0.7453461554353482, 0.7967329450848046, 0.5731452134031394, 0.914713330925897, 0.8922045961188434]} +{"problem_id": "p03253", "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\nfrom collections import defaultdict\n\nimport copy\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n d = defaultdict(int)\n\n MOD = 10**9+7\n\n R = 10**5+100\n\n fac = [0 for _ in range(R+1)]\n\n fac[0],fac[1] = 1,1\n\n inv = copy.deepcopy(fac)\n\n invfac = copy.deepcopy(fac)\n\n \n\n for i in range(2,R+1):\n\n fac[i] = (fac[i-1]*i)%MOD\n\n inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD\n\n invfac[i] = (invfac[i-1]*inv[i])%MOD\n\n \n\n def coef(x,y):\n\n num = (((fac[x+y]*invfac[y])%MOD)*invfac[x]%MOD)\n\n return num\n\n\n\n while M%2 == 0:\n\n d[2] += 1\n\n M //= 2\n\n f = 3\n\n while f ** 2 <= M:\n\n if M % f == 0:\n\n d[f] += 1\n\n M //= f\n\n else:\n\n f += 2\n\n if M != 1:\n\n d[M] += 1\n\n \n\n l = list(d.values())\n\n ans = 1\n\n for num in l:\n\n ans *= coef(num,N-1)\n\n ans %= MOD\n\n \n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "import", "\u0120copy", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", ",M", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120defaultdict", "(int", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120MOD", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120R", "\u0120=", "\u0120", "1", "0", "**", "5", "+", "1", "0", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120fac", "\u0120=", "\u0120[", "0", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(R", "+", "1", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120fac", "[", "0", "],", "fac", "[", "1", "]", "\u0120=", "\u0120", "1", ",", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "\u0120=", "\u0120copy", ".deepcopy", "(f", "ac", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120inv", "fac", "\u0120=", "\u0120copy", ".deepcopy", "(f", "ac", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ",R", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120fac", "[i", "]", "\u0120=", "\u0120(", "fac", "[i", "-", "1", "]*", "i", ")%", "MOD", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inv", "[i", "]", "\u0120=", "\u0120MOD", "-(", "MOD", "//", "i", ")*", "inv", "[", "MOD", "%i", "]%", "MOD", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120inv", "fac", "[i", "]", "\u0120=", "\u0120(", "inv", "fac", "[i", "-", "1", "]*", "inv", "[i", "])", "%", "MOD", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120def", "\u0120coef", "(x", ",y", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120num", "\u0120=", "\u0120(((", "fac", "[x", "+y", "]*", "inv", "fac", "[y", "])", "%", "MOD", ")*", "inv", "fac", "[x", "]%", "MOD", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120num", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120M", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[", "2", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120M", "\u0120//=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120", "3", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120f", "\u0120**", "\u0120", "2", "\u0120<=", "\u0120M", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120M", "\u0120%", "\u0120f", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[f", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120M", "\u0120//=", "\u0120f", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120f", "\u0120+=", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120M", "\u0120!=", "\u0120", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120d", "[M", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120list", "(d", ".values", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120num", "\u0120in", "\u0120l", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120*=", "\u0120coef", "(num", ",N", "-", "1", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120%=", "\u0120MOD", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.8543560820723151, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8765066796615488, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8981772421402056, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.76049478068099, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.7847988758021361, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.5714954628602014, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.629235964119581, 0.629235964119581, 0.6007824012961436, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.5714954628602014, 0.7847988758021361, 0.5714954628602014, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.5714954628602014, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.76049478068099, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.7847988758021361, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.5714954628602014, 0.8765066796615488, 0.5714954628602014, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p03107", "input": "from collections import Counter\n\nd={chr(i):0 for i in range(2)}\n\ns=Counter(input())\n\nd=d.update(s)\n\nprint((min(s[\"0\"],s[\"1\"])*2))", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "d", "={", "chr", "(i", "):", "0", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "2", ")}\u010a\u010a", "s", "=", "Counter", "(input", "())\u010a\u010a", "d", "=d", ".update", "(s", ")\u010a\u010a", "print", "((", "min", "(s", "[\"", "0", "\"],", "s", "[\"", "1", "\"]", ")*", "2", "))"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.7792424376220217, 0.7433160191943734, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.7433160191943734, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8474406118450124, 0.7433160191943734, 0.7060506397782503, 0.6673426178365944, 0.6270757423345348, 0.7060506397782503, 0.6673426178365944, 0.6673426178365944, 0.6270757423345348, 0.6673426178365944, 0.7792424376220217, 0.7792424376220217, 0.8474406118450124]} +{"problem_id": "p00145", "input": "from functools import reduce\ndef f(a,b): return [Card[a][0], Card[b][1]]\n\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, f(j, k) + f(k+1, a)) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])", "input_tokens": ["from", "\u0120functools", "\u0120import", "\u0120reduce", "\u010a", "def", "\u0120f", "(a", ",b", "):", "\u0120return", "\u0120[", "Card", "[a", "][", "0", "],", "\u0120Card", "[b", "][", "1", "]]\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "Card", "\u0120=", "\u0120[[]", "\u0120for", "\u0120_", "\u0120in", "\u0120[", "0", "]*", "n", "]\u010a\u010a", "Cost", "\u0120=", "\u0120{}\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120Card", "[i", "]", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120Cost", "[(", "i", ",", "\u0120i", ")]", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "0", ",", "\u0120n", "-i", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "\u0120=", "\u0120j", "+i", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120Cost", "[(", "j", ",", "\u0120a", ")]", "\u0120=", "\u0120min", "([", "reduce", "(lambda", "\u0120a", ",b", ":", "\u0120a", "*b", ",", "\u0120f", "(j", ",", "\u0120k", ")", "\u0120+", "\u0120f", "(k", "+", "1", ",", "\u0120a", "))", "\u0120+", "\u0120Cost", "[(", "j", ",", "\u0120k", ")]", "\u0120+", "\u0120Cost", "[(", "k", "+", "1", ",", "\u0120a", ")]", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(j", ",", "\u0120j", "+i", ")])\u010a\u010a", "print", "(C", "ost", "[", "0", ",", "\u0120n", "-", "1", "])"], "input_token_weights": [0.9460144469641688, 0.9273515896195933, 0.9460144469641688, 0.9273515896195933, 0.5686609715453708, 0.9460144469641688, 0.9460144469641688, 0.9273515896195933, 0.9273515896195933, 0.9460144469641688, 0.9083337953965728, 0.8889473014940781, 0.8490090158852169, 0.8490090158852169, 0.8691775287719905, 0.8691775287719905, 0.8889473014940781, 0.8490090158852169, 0.8490090158852169, 0.8691775287719905, 0.8691775287719905, 0.8889473014940781, 0.9273515896195933, 0.9273515896195933, 0.9083337953965728, 0.8889473014940781, 0.8889473014940781, 0.9273515896195933, 0.9273515896195933, 0.9083337953965728, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8490090158852169, 0.8490090158852169, 0.8691775287719905, 0.8691775287719905, 0.9083337953965728, 0.9273515896195933, 0.9273515896195933, 0.9083337953965728, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9273515896195933, 0.9083337953965728, 0.9460144469641688, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8889473014940781, 0.8691775287719905, 0.8490090158852169, 0.8074090697023789, 0.8074090697023789, 0.741572616038919, 0.7640031686476719, 0.7640031686476719, 0.8490090158852169, 0.5686609715453708, 0.8691775287719905, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.8490090158852169, 0.8691775287719905, 0.8889473014940781, 0.5686609715453708, 0.8889473014940781, 0.5686609715453708, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9273515896195933, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.9460144469641688, 0.5686609715453708, 0.9083337953965728, 0.9083337953965728, 0.9083337953965728, 0.8889473014940781, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8490090158852169, 0.8490090158852169, 0.9083337953965728, 0.5686609715453708, 0.8490090158852169, 0.8490090158852169, 0.8284253466378658, 0.8284253466378658, 0.5686609715453708, 0.5686609715453708, 0.8284253466378658, 0.8284253466378658, 0.8074090697023789, 0.8074090697023789, 0.8074090697023789, 0.8284253466378658, 0.8490090158852169, 0.8284253466378658, 0.8074090697023789, 0.7186273667339679, 0.6951432441854742, 0.6464527786867319, 0.6464527786867319, 0.6710943273460512, 0.6464527786867319, 0.6464527786867319, 0.6951432441854742, 0.6464527786867319, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6710943273460512, 0.6464527786867319, 0.6211886504852411, 0.5952696660036803, 0.5952696660036803, 0.6211886504852411, 0.6211886504852411, 0.6951432441854742, 0.741572616038919, 0.7186273667339679, 0.7186273667339679, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7186273667339679, 0.7640031686476719, 0.741572616038919, 0.741572616038919, 0.6951432441854742, 0.6951432441854742, 0.6951432441854742, 0.7186273667339679, 0.7186273667339679, 0.741572616038919, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.741572616038919, 0.7186273667339679, 0.7186273667339679, 0.6951432441854742, 0.6951432441854742, 0.8074090697023789, 0.9273515896195933, 0.9083337953965728, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.9083337953965728]} +{"problem_id": "p03039", "input": "def cmb(n, r, mod):\n\n if ( r<0 or r>n ):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\nA=2*10**5\n\nmod = 10**9+7\n\ng1 = [1, 1]\n\ng2 = [1, 1]\n\ninverse = [0, 1]\n\n\n\nfor i in range( 2, A + 1 ):\n\n g1.append( ( g1[-1] * i ) % mod )\n\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=cmb(N*M-2,K-2,mod)\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nprint(((keisuu * (sum_//2))%mod))", "input_tokens": ["def", "\u0120cmb", "(n", ",", "\u0120r", ",", "\u0120mod", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120(", "\u0120r", "<", "0", "\u0120or", "\u0120r", ">n", "\u0120):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120r", "\u0120=", "\u0120min", "(r", ",", "\u0120n", "-r", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120g", "1", "[n", "]", "\u0120*", "\u0120g", "2", "[r", "]", "\u0120*", "\u0120g", "2", "[n", "-r", "]", "\u0120%", "\u0120mod", "\u010a\u010a\u010a\u010a", "A", "=", "2", "*", "1", "0", "**", "5", "\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "**", "9", "+", "7", "\u010a\u010a", "g", "1", "\u0120=", "\u0120[", "1", ",", "\u0120", "1", "]\u010a\u010a", "g", "2", "\u0120=", "\u0120[", "1", ",", "\u0120", "1", "]\u010a\u010a", "inverse", "\u0120=", "\u0120[", "0", ",", "\u0120", "1", "]\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "\u0120", "2", ",", "\u0120A", "\u0120+", "\u0120", "1", "\u0120):\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "1", ".append", "(", "\u0120(", "\u0120g", "1", "[-", "1", "]", "\u0120*", "\u0120i", "\u0120)", "\u0120%", "\u0120mod", "\u0120)\u010a\u010a", "\u0120\u0120\u0120", "\u0120inverse", ".append", "(", "\u0120(", "\u0120-", "inverse", "[", "mod", "\u0120%", "\u0120i", "]", "\u0120*", "\u0120(", "mod", "//", "i", ")", "\u0120)", "\u0120%", "\u0120mod", "\u0120)\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "2", ".append", "(", "\u0120(", "g", "2", "[-", "1", "]", "\u0120*", "\u0120inverse", "[-", "1", "])", "\u0120%", "\u0120mod", "\u0120)\u010a\u010a", "\u010a\u010a", "N", ",M", ",K", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "ke", "is", "uu", "=c", "mb", "(N", "*M", "-", "2", ",K", "-", "2", ",", "mod", ")\u010a\u010a\u010a\u010a", "sum", "_=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=min", "(abs", "(i", "),", "abs", "(N", "-i", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=max", "(abs", "(i", "),", "abs", "(N", "-i", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "_", "+=(", "M", "**", "2", ")*", "((", "a", "*(", "a", "+", "1", ")//", "2", ")+(", "b", "*(", "b", "+", "1", ")//", "2", "))\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", "=min", "(abs", "(i", "),", "abs", "(M", "-i", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120b", "=max", "(abs", "(i", "),", "abs", "(M", "-i", "-", "1", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120sum", "_", "+=(", "N", "**", "2", ")*", "((", "a", "*(", "a", "+", "1", ")//", "2", ")+(", "b", "*(", "b", "+", "1", ")//", "2", "))\u010a\u010a", "print", "(((", "ke", "is", "uu", "\u0120*", "\u0120(", "sum", "_", "//", "2", "))", "%", "mod", "))"], "input_token_weights": [0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7084208560793558, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.7967329450848046, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.9035222925783293, 0.8778749353275308, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308]} +{"problem_id": "p02725", "input": "k,n = list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\nlongd=0\n\nfor i in range(n):\n\n tmp=abs(a[i+1]-a[i])\n\n longd=max(longd,tmp)\n\nprint((k-longd))", "input_tokens": ["k", ",n", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", ".append", "(a", "[", "0", "]+", "k", ")\u010a\u010a", "long", "d", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120tmp", "=", "abs", "(a", "[i", "+", "1", "]-", "a", "[i", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120long", "d", "=max", "(long", "d", ",tmp", ")\u010a\u010a", "print", "((", "k", "-long", "d", "))"], "input_token_weights": [0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.6951432441854742, 0.6588494518362031, 0.6588494518362031, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p02886", "input": "def ii():return int(input())\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nans = 0\n\nfor i in range(n):\n\n for j in range(i+1,n):\n\n# print(i,j)\n\n ans += D[i]*D[j] \n\nprint(ans)", "input_tokens": ["def", "\u0120ii", "():", "return", "\u0120int", "(input", "())\u010a\u010a", "def", "\u0120i", "im", "():", "return", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "def", "\u0120i", "il", "():", "return", "\u0120list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "def", "\u0120is", "m", "():", "return", "\u0120list", "(map", "(str", ",input", "().", "split", "()))\u010a\u010a", "def", "\u0120isl", "():", "return", "\u0120list", "(map", "(str", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120ii", "()\u010a\u010a", "D", "\u0120=", "\u0120i", "il", "()\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",n", "):\u010a\u010a", "#", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "(i", ",j", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120D", "[i", "]*", "D", "[j", "]", "\u0120\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6855929667625797, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03353", "input": "S = input()\n\nK = int(input())\n\na = list(set(S))\n\na.sort()\n\n\n\nk = []\n\nl = 0\n\nwhile l < len(a):\n\n for i in range(len(S)):\n\n if S[i] == a[l]:\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n k.append(S[i:i+j])\n\n else:\n\n break\n\n l += 1\n\n\n\nk = list(set(k))\n\nk.sort()\n\nprint((k[K-1]))", "input_tokens": ["S", "\u0120=", "\u0120input", "()\u010a\u010a", "K", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "a", "\u0120=", "\u0120list", "(set", "(S", "))\u010a\u010a", "a", ".sort", "()\u010a\u010a\u010a\u010a", "k", "\u0120=", "\u0120[]\u010a\u010a", "l", "\u0120=", "\u0120", "0", "\u010a\u010a", "while", "\u0120l", "\u0120<", "\u0120len", "(a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(len", "(S", "))", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[i", "]", "\u0120==", "\u0120a", "[l", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "6", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", "+j", "\u0120<=", "\u0120len", "(S", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120k", ".append", "(S", "[i", ":i", "+j", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "k", "\u0120=", "\u0120list", "(set", "(k", "))\u010a\u010a", "k", ".sort", "()\u010a\u010a", "print", "((", "k", "[K", "-", "1", "]))"], "input_token_weights": [0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.883057299767519, 0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.883057299767519, 0.883057299767519, 0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.883057299767519, 0.8408263201236497, 0.883057299767519, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.9235768548788368, 0.9235768548788368, 0.5700083567488032, 0.9235768548788368, 0.5700083567488032, 0.9432371260907066, 0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.883057299767519, 0.9432371260907066, 0.5700083567488032, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.883057299767519, 0.862164725336545, 0.819022641134497, 0.862164725336545, 0.9035222925783293, 0.5700083567488032, 0.862164725336545, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.8408263201236497, 0.819022641134497, 0.819022641134497, 0.862164725336545, 0.5700083567488032, 0.819022641134497, 0.819022641134497, 0.819022641134497, 0.7967329450848046, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.7739350698055053, 0.819022641134497, 0.5700083567488032, 0.7739350698055053, 0.7267182280470056, 0.7267182280470056, 0.7506053018110229, 0.7267182280470056, 0.7022465694939416, 0.7739350698055053, 0.5700083567488032, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6514299043837268, 0.6250192001927346, 0.5978920048953399, 0.6771609938949378, 0.5700083567488032, 0.7506053018110229, 0.7506053018110229, 0.5700083567488032, 0.7022465694939416, 0.5700083567488032, 0.5700083567488032, 0.883057299767519, 0.883057299767519, 0.5700083567488032, 0.883057299767519, 0.5700083567488032, 0.9235768548788368, 0.9235768548788368, 0.9035222925783293, 0.883057299767519, 0.8408263201236497, 0.883057299767519, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9235768548788368, 0.9035222925783293, 0.862164725336545, 0.862164725336545, 0.8408263201236497, 0.8408263201236497, 0.9035222925783293]} +{"problem_id": "p02702", "input": "s = input()[::-1]\n\nl = len(s)\n\nc = [0] * 2019\n\nc[0] = 1\n\nten = 1\n\nmod = 0\n\nans = 0\n\n\n\nfor i in range(l):\n\n mod = (mod + int(s[i]) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) // 2\n\n\n\nprint(ans)", "input_tokens": ["s", "\u0120=", "\u0120input", "()[", "::-", "1", "]\u010a\u010a", "l", "\u0120=", "\u0120len", "(s", ")\u010a\u010a", "c", "\u0120=", "\u0120[", "0", "]", "\u0120*", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "c", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "ten", "\u0120=", "\u0120", "1", "\u010a\u010a", "mod", "\u0120=", "\u0120", "0", "\u010a\u010a", "ans", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(l", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120mod", "\u0120=", "\u0120(", "mod", "\u0120+", "\u0120int", "(s", "[i", "])", "\u0120*", "\u0120ten", ")", "\u0120%", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ten", "\u0120=", "\u0120ten", "\u0120*", "\u0120", "1", "0", "\u0120%", "\u0120", "2", "0", "1", "9", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "[", "mod", "]", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120c", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120i", "\u0120*", "\u0120(", "i", "\u0120-", "\u0120", "1", ")", "\u0120//", "\u0120", "2", "\u010a\u010a\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8691775287719905, 0.8408263201236497, 0.8116478083709829, 0.8691775287719905, 0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.579389560544, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.7506053018110229, 0.7506053018110229, 0.6855929667625797, 0.6514299043837268, 0.6160583186229708, 0.6514299043837268, 0.7186273667339679, 0.7186273667339679, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.579389560544, 0.781592256244883, 0.781592256244883, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.579389560544, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.579389560544, 0.8408263201236497, 0.8408263201236497, 0.781592256244883, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.7186273667339679, 0.579389560544, 0.7186273667339679, 0.7506053018110229, 0.8116478083709829, 0.579389560544, 0.8116478083709829, 0.579389560544, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905]} +{"problem_id": "p03814", "input": "S=input()\n\nprint((S.rfind('Z')-S.find('A')+1))", "input_tokens": ["S", "=input", "()\u010a\u010a", "print", "((", "S", ".r", "find", "('", "Z", "')", "-", "S", ".find", "('", "A", "')+", "1", "))"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.8691775287719905, 0.833611120734537, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.6339004969859428, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.5886835746651548, 0.7584425223266994, 0.7584425223266994, 0.833611120734537]} +{"problem_id": "p03371", "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LS()\n\n return l\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n return\n\n\n\n#B\n\ndef B():\n\n return\n\n\n\n#C\n\ndef C():\n\n return\n\n\n\n#D\n\ndef D():\n\n return\n\n\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n a,b,c,X,Y = LI()\n\n ans = float(\"inf\")\n\n for z in range(300001):\n\n if z%2 == 0:\n\n m = c*z\n\n x = z//2\n\n y = z//2\n\n m += a*max(0,X-x)\n\n m += b*max(0,Y-y)\n\n if m < ans:\n\n ans = m\n\n print(ans)\n\n return\n\n\n\n#G\n\ndef G():\n\n n = I()\n\n x = LI()\n\n f = [(i,x[i]) for i in range(n)]\n\n f.sort(key = lambda x:x[1])\n\n g = [(f[i][0],i) for i in range(n)]\n\n g.sort(key = lambda x:x[0])\n\n for i in range(n):\n\n if g[i][1] < n//2:\n\n print((f[n//2][1]))\n\n else:\n\n print((f[n//2-1][1]))\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#I\n\ndef I_():\n\n return\n\n\n\n#J\n\ndef J():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n F()\n", "input_tokens": ["#!", "usr", "/bin", "/env", "\u0120python", "3", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120defaultdict", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a", "import", "\u0120bis", "ect", "\u010a\u010a", "import", "\u0120random", "\u010a\u010a", "def", "\u0120LI", "():", "\u0120return", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120I", "():", "\u0120return", "\u0120int", "(sys", ".stdin", ".readline", "())\u010a\u010a", "def", "\u0120LS", "():", "return", "\u0120list", "(map", "(list", ",", "\u0120sys", ".stdin", ".readline", "().", "split", "()))\u010a\u010a", "def", "\u0120S", "():", "\u0120return", "\u0120list", "(sys", ".stdin", ".readline", "())", "[:-", "1", "]\u010a\u010a", "def", "\u0120IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "IR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120S", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "def", "\u0120L", "SR", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120l", "\u0120=", "\u0120[", "None", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):", "l", "[i", "]", "\u0120=", "\u0120LS", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120l", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", "0", ")\u010a\u010a", "mod", "\u0120=", "\u0120", "1", "0", "0", "0", "0", "0", "0", "0", "0", "7", "\u010a\u010a\u010a\u010a", "#", "A", "\u010a\u010a", "def", "\u0120A", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "B", "\u010a\u010a", "def", "\u0120B", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "C", "\u010a\u010a", "def", "\u0120C", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "D", "\u010a\u010a", "def", "\u0120D", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "E", "\u010a\u010a", "def", "\u0120E", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "F", "\u010a\u010a", "def", "\u0120F", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", ",c", ",X", ",Y", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120float", "(\"", "inf", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120z", "\u0120in", "\u0120range", "(", "3", "0", "0", "0", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120z", "%", "2", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", "\u0120=", "\u0120c", "*z", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120z", "//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120y", "\u0120=", "\u0120z", "//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", "\u0120+=", "\u0120a", "*", "max", "(", "0", ",X", "-x", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120m", "\u0120+=", "\u0120b", "*", "max", "(", "0", ",Y", "-y", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120m", "\u0120<", "\u0120ans", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120m", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "G", "\u010a\u010a", "def", "\u0120G", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120n", "\u0120=", "\u0120I", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120x", "\u0120=", "\u0120LI", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "\u0120=", "\u0120[(", "i", ",x", "[i", "])", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", ".sort", "(key", "\u0120=", "\u0120lambda", "\u0120x", ":x", "[", "1", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", "\u0120=", "\u0120[(", "f", "[i", "][", "0", "],", "i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", ")]\u010a\u010a", "\u0120\u0120\u0120", "\u0120g", ".sort", "(key", "\u0120=", "\u0120lambda", "\u0120x", ":x", "[", "0", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120g", "[i", "][", "1", "]", "\u0120<", "\u0120n", "//", "2", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "f", "[n", "//", "2", "][", "1", "]))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "((", "f", "[n", "//", "2", "-", "1", "][", "1", "]))\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "H", "\u010a\u010a", "def", "\u0120H", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "I", "\u010a\u010a", "def", "\u0120I", "_", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "J", "\u010a\u010a", "def", "\u0120J", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a\u010a\u010a", "#", "S", "olve", "\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120F", "()\u010a"], "input_token_weights": [0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.76049478068099, 0.76049478068099, 0.8543560820723151, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.7847988758021361, 0.808526270355906, 0.8543560820723151, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.76049478068099, 0.76049478068099, 0.8543560820723151, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.8981772421402056, 0.8543560820723151, 0.8317036996956922, 0.76049478068099, 0.7847988758021361, 0.8317036996956922, 0.8765066796615488, 0.8317036996956922, 0.8765066796615488, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.5714954628602014, 0.8317036996956922, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.5714954628602014, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.6838237134005932, 0.7100393521462953, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.76049478068099, 0.7355852514485495, 0.7100393521462953, 0.7100393521462953, 0.7100393521462953, 0.6838237134005932, 0.7100393521462953, 0.5714954628602014, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.7355852514485495, 0.7355852514485495, 0.7355852514485495, 0.5714954628602014, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.76049478068099, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.7100393521462953, 0.76049478068099, 0.5714954628602014, 0.8317036996956922, 0.8317036996956922, 0.5714954628602014, 0.76049478068099, 0.7355852514485495, 0.6569022703191485, 0.6569022703191485, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.6838237134005932, 0.7355852514485495, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.5714954628602014, 0.9605061317729207, 0.9605061317729207, 0.9605061317729207, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8765066796615488, 0.8543560820723151]} +{"problem_id": "p02612", "input": "n = int(input()) % 1000\n\nif n == 0:\n\n print((0))\n\nelse:\n\n print((1000 - n))", "input_tokens": ["n", "\u0120=", "\u0120int", "(input", "())", "\u0120%", "\u0120", "1", "0", "0", "0", "\u010a\u010a", "if", "\u0120n", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "0", "))\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "1", "0", "0", "0", "\u0120-", "\u0120n", "))"], "input_token_weights": [0.8691775287719905, 0.8691775287719905, 0.7967329450848046, 0.7584425223266994, 0.7584425223266994, 0.833611120734537, 0.5886835746651548, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.833611120734537, 0.5886835746651548, 0.9035222925783293, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.8691775287719905, 0.9035222925783293, 0.5886835746651548, 0.7967329450848046, 0.7584425223266994, 0.7186273667339679, 0.7584425223266994, 0.8691775287719905, 0.8691775287719905, 0.5886835746651548, 0.7584425223266994, 0.7186273667339679, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.6339004969859428, 0.7186273667339679]} +{"problem_id": "p02983", "input": "L ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nif R - L <= 2019:\n\n for i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n\n\nelse:\n\n for i in range(R-L-1010,R-L+1010):\n\n for j in range(i,R-L+1010):\n\n ans.append(i*j%2019)\n\n\n\nprint((min(ans)))\n", "input_tokens": ["L", "\u0120,", "R", "\u0120=", "\u0120list", "(map", "(int", ",input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ans", "\u0120=", "[]", "\u010a\u010a", "if", "\u0120R", "\u0120-", "\u0120L", "\u0120<=", "\u0120", "2", "0", "1", "9", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(L", ",R", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", "+", "1", ",R", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", ".append", "(i", "*j", "%", "2", "0", "1", "9", ")\u010a\u010a\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(R", "-L", "-", "1", "0", "1", "0", ",R", "-L", "+", "1", "0", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(i", ",R", "-L", "+", "1", "0", "1", "0", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", ".append", "(i", "*j", "%", "2", "0", "1", "9", ")\u010a\u010a\u010a\u010a", "print", "((", "min", "(ans", ")))\u010a"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.8245182914059852, 0.5770524973423397, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7084208560793558, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.8515524375924506, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7967329450848046, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6115475853143139, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6771609938949378, 0.9035222925783293, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308]} +{"problem_id": "p02773", "input": "from collections import Counter\n\nimport heapq\n\n\n\nn = int(input())\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\nheap = [(-v, k) for k, v in list(ctr.items())]\n\nheapq.heapify(heap)\n\nmaxv = heap[0][0]\n\nwhile heap:\n\n c = heapq.heappop(heap)\n\n if c[0] != maxv:\n\n break\n\n print((c[1]))\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120Counter", "\u010a\u010a", "import", "\u0120heapq", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "ss", "\u0120=", "\u0120[]\u010a\u010a", "for", "\u0120_", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120ss", ".append", "(input", "().", "rstrip", "())\u010a\u010a", "ctr", "\u0120=", "\u0120Counter", "(ss", ")\u010a\u010a", "heap", "\u0120=", "\u0120[", "(-", "v", ",", "\u0120k", ")", "\u0120for", "\u0120k", ",", "\u0120v", "\u0120in", "\u0120list", "(", "ctr", ".items", "())", "]\u010a\u010a", "heap", "q", ".heap", "ify", "(heap", ")\u010a\u010a", "max", "v", "\u0120=", "\u0120heap", "[", "0", "][", "0", "]\u010a\u010a", "while", "\u0120heap", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "\u0120=", "\u0120heapq", ".he", "app", "op", "(heap", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120c", "[", "0", "]", "\u0120!=", "\u0120max", "v", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "c", "[", "1", "]))\u010a"], "input_token_weights": [0.911283254435702, 0.8798713320153649, 0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.911283254435702, 0.8798713320153649, 0.5851191688414608, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.8798713320153649, 0.8474406118450124, 0.911283254435702, 0.5851191688414608, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.8139227859741643, 0.8798713320153649, 0.8798713320153649, 0.8474406118450124, 0.8139227859741643, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.7792424376220217, 0.7433160191943734, 0.6673426178365944, 0.6673426178365944, 0.7433160191943734, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.8798713320153649, 0.8798713320153649, 0.8798713320153649, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.8474406118450124, 0.8474406118450124, 0.911283254435702, 0.911283254435702, 0.911283254435702, 0.5851191688414608, 0.8139227859741643, 0.8139227859741643, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.7433160191943734, 0.5851191688414608, 0.8474406118450124, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.7792424376220217, 0.8139227859741643, 0.8139227859741643, 0.8139227859741643, 0.8474406118450124, 0.5851191688414608, 0.7792424376220217, 0.5851191688414608, 0.5851191688414608, 0.8139227859741643, 0.7792424376220217, 0.7060506397782503, 0.7060506397782503, 0.7060506397782503, 0.7792424376220217]} +{"problem_id": "p03037", "input": "# -*- coding: utf-8 -*-\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nl = max(L)\n\nr = min(R)\n\n\n\nans = max(r - l + 1, 0)\n\n\n\nprint(ans)\n", "input_tokens": ["#", "\u0120-*-", "\u0120coding", ":", "\u0120utf", "-", "8", "\u0120-*-", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120M", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "L", ",", "\u0120R", "\u0120=", "\u0120[", "None", "]", "\u0120*", "\u0120M", ",", "\u0120[", "None", "]", "\u0120*", "\u0120M", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(M", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120L", "[i", "],", "\u0120R", "[i", "]", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "l", "\u0120=", "\u0120max", "(L", ")\u010a\u010a", "r", "\u0120=", "\u0120min", "(R", ")\u010a\u010a\u010a\u010a", "ans", "\u0120=", "\u0120max", "(r", "\u0120-", "\u0120l", "\u0120+", "\u0120", "1", ",", "\u0120", "0", ")\u010a\u010a\u010a\u010a", "print", "(ans", ")\u010a"], "input_token_weights": [0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.9529241888335975, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6448923330239924, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p02881", "input": "import math\n\ninput_num = int(input())\n\nnum_sqrt = int(math.sqrt(input_num))\n\n\n\nminimam = input_num\n\nfor i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n distance = q + i -2\n\n if mod == 0 and minimam > distance:\n\n minimam = distance\n\nprint(minimam)", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "input", "_num", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "num", "_sqrt", "\u0120=", "\u0120int", "(math", ".sqrt", "(input", "_num", "))", "\u010a\u010a\u010a\u010a", "min", "im", "am", "\u0120=", "\u0120input", "_num", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(num", "_sqrt", "+", "1", ",", "0", ",-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120q", ",", "\u0120mod", "\u0120=", "\u0120div", "mod", "(input", "_num", ",", "\u0120i", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120distance", "\u0120=", "\u0120q", "\u0120+", "\u0120i", "\u0120-", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120mod", "\u0120==", "\u0120", "0", "\u0120and", "\u0120minim", "am", "\u0120>", "\u0120distance", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120minim", "am", "\u0120=", "\u0120distance", "\u010a\u010a", "print", "(min", "im", "am", ")"], "input_token_weights": [0.883057299767519, 0.8408263201236497, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7506053018110229, 0.5978920048953399, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.5978920048953399, 0.883057299767519, 0.883057299767519, 0.883057299767519, 0.8408263201236497, 0.7967329450848046, 0.7506053018110229, 0.7506053018110229, 0.7506053018110229, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7506053018110229, 0.883057299767519, 0.5978920048953399, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.7506053018110229, 0.7506053018110229, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.5978920048953399, 0.7967329450848046, 0.7022465694939416, 0.7022465694939416, 0.5978920048953399, 0.7022465694939416, 0.7506053018110229, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7022465694939416, 0.7967329450848046, 0.5978920048953399, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.5978920048953399, 0.8408263201236497, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046]} +{"problem_id": "p02881", "input": "# C - Walk on Multiplication Table\n\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\n\n\n\nn = int(input())\n\n\n\nans = 10 ** 12\n\nfor i in range(1, 10 ** 6 + 1):\n\n if n % i == 0:\n\n ans = min(ans, n // i + i)\n\n\n\nprint((ans - 2))", "input_tokens": ["#", "\u0120C", "\u0120-", "\u0120Walk", "\u0120on", "\u0120Multip", "lication", "\u0120Table", "\u010a\u010a", "#", "\u0120https", "://", "at", "coder", ".jp", "/", "cont", "ests", "/", "abc", "1", "4", "4", "/tasks", "/", "abc", "1", "4", "4", "_c", "\u010a\u010a\u010a\u010a", "n", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u010a\u010a", "ans", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "1", "2", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "1", "0", "\u0120**", "\u0120", "6", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120n", "\u0120%", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "\u0120=", "\u0120min", "(ans", ",", "\u0120n", "\u0120//", "\u0120i", "\u0120+", "\u0120i", ")\u010a\u010a\u010a\u010a", "print", "((", "ans", "\u0120-", "\u0120", "2", "))"], "input_token_weights": [0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.582053818991329, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.9460144469641688, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.6951432441854742, 0.6951432441854742, 0.6211886504852411, 0.6211886504852411, 0.6211886504852411, 0.6588494518362031, 0.6588494518362031, 0.6951432441854742, 0.8889473014940781, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8591441175808593]} +{"problem_id": "p04020", "input": "# AGC003B - Simplified mahjong\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur // 2\n\n N = int(input())\n\n A = list(map(int, [input() for _ in range(N)])) + [0]\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur // 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "input_tokens": ["#", "\u0120AG", "C", "0", "0", "3", "B", "\u0120-", "\u0120Simpl", "ified", "\u0120mah", "jong", "\u010a\u010a", "import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".readline", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "\u0120split", "\u0120in", "\u0120subsequ", "ences", "\u0120when", "\u0120", "0", "\u0120appears", "\u0120->", "\u0120sum", "\u0120up", "\u0120cur", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120A", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120[", "input", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "))", "\u0120+", "\u0120[", "0", "]\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", ",", "\u0120cur", "\u0120=", "\u0120", "0", ",", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120A", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120i", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120+=", "\u0120i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ans", "\u0120+=", "\u0120cur", "\u0120//", "\u0120", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cur", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ans", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()"], "input_token_weights": [0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.9557555573970933, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8099046207685895, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6696615116992518, 0.6390881791778984, 0.6696615116992518, 0.6696615116992518, 0.6696615116992518, 0.6390881791778984, 0.6075505590312809, 0.6993277790098028, 0.7833854580549265, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.5749858371565393, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529]} +{"problem_id": "p02412", "input": "while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for a in range(1, n + 1):\n\n for b in range(a + 1, n + 1):\n\n for c in range(b + 1, n + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)", "input_tokens": ["while", "\u0120True", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120(", "n", ",", "\u0120x", ")", "\u0120=", "\u0120[", "int", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120n", "\u0120==", "\u0120x", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120break", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120count", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120a", "\u0120in", "\u0120range", "(", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120b", "\u0120in", "\u0120range", "(a", "\u0120+", "\u0120", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120c", "\u0120in", "\u0120range", "(b", "\u0120+", "\u0120", "1", ",", "\u0120n", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120sum", "([", "a", ",b", ",c", "])", "\u0120==", "\u0120x", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120count", "\u0120+=", "\u0120", "1", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(count", ")"], "input_token_weights": [0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.7281392564472128, 0.7561438265913266, 0.7561438265913266, 0.8357386476069529, 0.5749858371565393, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.860922050467044, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.7833854580549265, 0.7561438265913266, 0.7561438265913266, 0.5749858371565393, 0.7561438265913266, 0.8357386476069529, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.6993277790098028, 0.7833854580549265, 0.5749858371565393, 0.7281392564472128, 0.6696615116992518, 0.6390881791778984, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6993277790098028, 0.6993277790098028, 0.7281392564472128, 0.5749858371565393, 0.6390881791778984, 0.6390881791778984, 0.5749858371565393, 0.6390881791778984, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8357386476069529]} +{"problem_id": "p02245", "input": "from collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n if MAP == goal:\n\n return 0\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n return cnt\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n", "input_tokens": ["from", "\u0120collections", "\u0120import", "\u0120deque", "\u010a\u010a", "N", "\u0120=", "\u0120", "3", "\u010a\u010a", "m", "\u0120=", "\u0120{", "8", ":", "\u0120{", "7", ",", "\u0120", "5", "},", "\u0120", "7", ":", "\u0120{", "8", ",", "\u0120", "6", ",", "\u0120", "4", "},", "\u0120", "6", ":", "\u0120{", "7", ",", "\u0120", "3", "},", "\u0120", "5", ":", "\u0120{", "8", ",", "\u0120", "4", ",", "\u0120", "2", "},", "\u0120", "4", ":", "\u0120{", "7", ",", "\u0120", "5", ",", "\u0120", "3", ",", "\u0120", "1", "},", "\u0120", "3", ":", "\u0120{", "6", ",", "\u0120", "4", ",", "\u0120", "0", "},", "\u0120", "2", ":", "\u0120{", "5", ",", "\u0120", "1", "},", "\u0120", "1", ":", "\u0120{", "4", ",", "\u0120", "2", ",", "\u0120", "0", "},\u010a\u010a", "\u0120\u0120\u0120\u0120", "\u0120", "0", ":", "\u0120{", "3", ",", "\u0120", "1", "}}\u010a\u010a", "goal", "\u0120=", "\u0120", "1", "2", "3", "4", "5", "6", "7", "8", "0", "\u010a\u010a", "def", "\u0120g", "(i", ",", "\u0120j", ",", "\u0120a", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120a", "\u0120//", "\u0120(", "1", "0", "\u0120**", "\u0120j", ")", "\u0120%", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u0120a", "\u0120-", "\u0120t", "\u0120*", "\u0120(", "1", "0", "\u0120**", "\u0120j", ")", "\u0120+", "\u0120t", "\u0120*", "\u0120(", "1", "0", "\u0120**", "\u0120i", ")\u010a\u010a", "def", "\u0120solve", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120MAP", "\u0120=", "\u0120\"\".", "join", "(input", "().", "replace", "(\"", "\u0120\",", "\u0120\"\")", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", "))\u010a\u010a", "\u0120\u0120\u0120", "\u0120start", "\u0120=", "\u0120", "8", "\u0120-", "\u0120MAP", ".find", "(\"", "0", "\")\u010a\u010a", "\u0120\u0120\u0120", "\u0120MAP", "\u0120=", "\u0120int", "(M", "AP", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120MAP", "\u0120==", "\u0120goal", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120dp", "\u0120=", "\u0120deque", "([(", "0", ",", "\u0120start", ",", "\u0120MAP", ")])\u010a\u010a", "\u0120\u0120\u0120", "\u0120LOG", "\u0120=", "\u0120{", "MAP", "}\u010a\u010a", "\u0120\u0120\u0120", "\u0120while", "\u0120dp", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", ",", "\u0120y", "x", ",", "\u0120M", "\u0120=", "\u0120dp", ".p", "opleft", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120M", "\u0120==", "\u0120goal", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120cnt", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120cnt", "\u0120+=", "\u0120", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120for", "\u0120ny", "x", "\u0120in", "\u0120m", "[y", "x", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120CM", "\u0120=", "\u0120g", "(y", "x", ",", "\u0120ny", "x", ",", "\u0120M", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120not", "\u0120CM", "\u0120in", "\u0120LOG", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", ".append", "((", "cnt", ",", "\u0120ny", "x", ",", "\u0120CM", "))\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120LOG", ".add", "(C", "M", ")\u010a\u010a", "def", "\u0120MAIN", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "solve", "()))\u010a\u010a", "MAIN", "()\u010a\u010a\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7967329450848046, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7681534551894282, 0.8245182914059852, 0.9035222925783293, 0.8778749353275308]} +{"problem_id": "p03371", "input": "inf = (5000 * 10 ** 5) * 3\n\n\n\na, b, c, x, y = list(map(int, input().split()))\n\n\n\nret = inf\n\nfor cnt_ab in range(max(x, y) * 2 + 1):\n\n d = cnt_ab // 2\n\n\n\n cnt_a = max(0, x - d)\n\n cnt_b = max(0, y - d)\n\n\n\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n\n ret = min(ret, t)\n\nprint(ret)\n", "input_tokens": ["inf", "\u0120=", "\u0120(", "5", "0", "0", "0", "\u0120*", "\u0120", "1", "0", "\u0120**", "\u0120", "5", ")", "\u0120*", "\u0120", "3", "\u010a\u010a\u010a\u010a", "a", ",", "\u0120b", ",", "\u0120c", ",", "\u0120x", ",", "\u0120y", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "ret", "\u0120=", "\u0120inf", "\u010a\u010a", "for", "\u0120cnt", "_ab", "\u0120in", "\u0120range", "(max", "(x", ",", "\u0120y", ")", "\u0120*", "\u0120", "2", "\u0120+", "\u0120", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "\u0120=", "\u0120cnt", "_ab", "\u0120//", "\u0120", "2", "\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "_a", "\u0120=", "\u0120max", "(", "0", ",", "\u0120x", "\u0120-", "\u0120d", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120cnt", "_b", "\u0120=", "\u0120max", "(", "0", ",", "\u0120y", "\u0120-", "\u0120d", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120t", "\u0120=", "\u0120cnt", "_ab", "\u0120*", "\u0120c", "\u0120+", "\u0120cnt", "_a", "\u0120*", "\u0120a", "\u0120+", "\u0120cnt", "_b", "\u0120*", "\u0120b", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120min", "(ret", ",", "\u0120t", ")\u010a\u010a", "print", "(ret", ")\u010a"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.7640031686476719, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.582053818991329, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8889473014940781, 0.8591441175808593, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.8284253466378658, 0.582053818991329, 0.8284253466378658, 0.9178879013889365, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.582053818991329, 0.7967329450848046, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7301658005010259, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.582053818991329, 0.8284253466378658, 0.8284253466378658, 0.7967329450848046, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.7640031686476719, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02555", "input": "S = int(input())\n\nf = [0]*(S+1)\n\nf[0] = 1\n\nif S >= 3: f[3] = 1\n\nif S >= 4: f[4] = 1\n\nif S >= 5: f[5] = 1\n\nfor i in range(6, S+1):\n\n f[i] = sum(f[i-j] for j in range(3, i+1))%(10**9+7)\n\nprint((f[S]))\n", "input_tokens": ["S", "\u0120=", "\u0120int", "(input", "())\u010a\u010a", "f", "\u0120=", "\u0120[", "0", "]*(", "S", "+", "1", ")\u010a\u010a", "f", "[", "0", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120S", "\u0120>=", "\u0120", "3", ":", "\u0120f", "[", "3", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120S", "\u0120>=", "\u0120", "4", ":", "\u0120f", "[", "4", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "if", "\u0120S", "\u0120>=", "\u0120", "5", ":", "\u0120f", "[", "5", "]", "\u0120=", "\u0120", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "6", ",", "\u0120S", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120f", "[i", "]", "\u0120=", "\u0120sum", "(f", "[i", "-j", "]", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "3", ",", "\u0120i", "+", "1", "))", "%(", "1", "0", "**", "9", "+", "7", ")\u010a\u010a", "print", "((", "f", "[S", "]))\u010a"], "input_token_weights": [0.8967470570581779, 0.8967470570581779, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8967470570581779, 0.8967470570581779, 0.8408263201236497, 0.8408263201236497, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.9235768548788368, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.9235768548788368, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.9235768548788368, 0.8967470570581779, 0.8967470570581779, 0.579389560544, 0.8967470570581779, 0.9235768548788368, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.579389560544, 0.8408263201236497, 0.579389560544, 0.9235768548788368, 0.9235768548788368, 0.9235768548788368, 0.8967470570581779, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8408263201236497, 0.8408263201236497, 0.8408263201236497, 0.9235768548788368, 0.579389560544, 0.8116478083709829, 0.8116478083709829, 0.8116478083709829, 0.8408263201236497, 0.781592256244883, 0.7506053018110229, 0.7186273667339679, 0.6855929667625797, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.6855929667625797, 0.6514299043837268, 0.6514299043837268, 0.6514299043837268, 0.6160583186229708, 0.6160583186229708, 0.6160583186229708, 0.7506053018110229, 0.8116478083709829, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7506053018110229, 0.7506053018110229, 0.781592256244883, 0.8967470570581779, 0.8691775287719905, 0.8116478083709829, 0.8116478083709829, 0.8691775287719905]} +{"problem_id": "p03806", "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(400, -1, -1):\n\n for j in range(400, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, 401):\n\n for j in range(1, 401):\n\n if dp[i][j] != INF and i / j == Ma / Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "input", "\u0120=", "\u0120sys", ".stdin", ".buffer", ".readline", "\u010a\u010a\u010a\u010a", "N", ",", "\u0120Ma", ",", "\u0120Mb", "\u0120=", "\u0120list", "(map", "(int", ",", "\u0120input", "().", "split", "()))\u010a\u010a", "ABC", "\u0120=", "\u0120[", "list", "(map", "(int", ",", "\u0120input", "().", "split", "()))", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(N", ")]", "\u010a\u010a\u010a\u010a", "INF", "\u0120=", "\u0120", "1", "0", "\u0120**", "\u0120", "1", "5", "\u010a\u010a", "dp", "\u0120=", "\u0120[[", "INF", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "4", "0", "1", ")]", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "0", "1", ")]\u010a\u010a", "dp", "[", "0", "][", "0", "]", "\u0120=", "\u0120", "0", "\u010a\u010a\u010a\u010a", "for", "\u0120a", ",", "\u0120b", ",", "\u0120c", "\u0120in", "\u0120ABC", ":\u010a\u010a", "\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "0", "0", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "4", "0", "0", ",", "\u0120-", "1", ",", "\u0120-", "1", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "][", "j", "]", "\u0120!=", "\u0120INF", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120dp", "[i", "\u0120+", "\u0120a", "][", "j", "\u0120+", "\u0120b", "]", "\u0120=", "\u0120min", "(dp", "[i", "\u0120+", "\u0120a", "][", "j", "\u0120+", "\u0120b", "],", "\u0120dp", "[i", "][", "j", "]", "\u0120+", "\u0120c", ")\u010a\u010a\u010a\u010a", "answer", "\u0120=", "\u0120INF", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "4", "0", "1", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120j", "\u0120in", "\u0120range", "(", "1", ",", "\u0120", "4", "0", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120dp", "[i", "][", "j", "]", "\u0120!=", "\u0120INF", "\u0120and", "\u0120i", "\u0120/", "\u0120j", "\u0120==", "\u0120Ma", "\u0120/", "\u0120Mb", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120answer", "\u0120=", "\u0120min", "(answer", ",", "\u0120dp", "[i", "][", "j", "])\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "print", "((", "answer", "\u0120if", "\u0120answer", "\u0120!=", "\u0120INF", "\u0120else", "\u0120-", "1", "))"], "input_token_weights": [0.9401584547236118, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8543560820723151, 0.8543560820723151, 0.8765066796615488, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8317036996956922, 0.8317036996956922, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.8765066796615488, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.808526270355906, 0.808526270355906, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.8543560820723151, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8981772421402056, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.9193881350322848, 0.9193881350322848, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8981772421402056, 0.8765066796615488, 0.8765066796615488, 0.8765066796615488, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9193881350322848, 0.5714954628602014, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.808526270355906, 0.7355852514485495, 0.7355852514485495, 0.76049478068099, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.5714954628602014, 0.6838237134005932, 0.6838237134005932, 0.6569022703191485, 0.6569022703191485, 0.7100393521462953, 0.6838237134005932, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.7355852514485495, 0.7100393521462953, 0.6838237134005932, 0.629235964119581, 0.6007824012961436, 0.6007824012961436, 0.6569022703191485, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6838237134005932, 0.6007824012961436, 0.6007824012961436, 0.629235964119581, 0.629235964119581, 0.629235964119581, 0.6569022703191485, 0.6569022703191485, 0.6838237134005932, 0.9193881350322848, 0.9193881350322848, 0.9193881350322848, 0.5714954628602014, 0.9401584547236118, 0.9401584547236118, 0.9401584547236118, 0.9193881350322848, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.9401584547236118, 0.5714954628602014, 0.8981772421402056, 0.8981772421402056, 0.8981772421402056, 0.8765066796615488, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.5714954628602014, 0.8543560820723151, 0.8543560820723151, 0.8543560820723151, 0.8981772421402056, 0.5714954628602014, 0.8543560820723151, 0.76049478068099, 0.76049478068099, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.808526270355906, 0.8317036996956922, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.808526270355906, 0.7847988758021361, 0.7847988758021361, 0.7847988758021361, 0.8543560820723151, 0.5714954628602014, 0.7847988758021361, 0.7847988758021361, 0.76049478068099, 0.7355852514485495, 0.7355852514485495, 0.6838237134005932, 0.6838237134005932, 0.7100393521462953, 0.7100393521462953, 0.7355852514485495, 0.5714954628602014, 0.9193881350322848, 0.8981772421402056, 0.8543560820723151, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8317036996956922, 0.8543560820723151, 0.8317036996956922, 0.8317036996956922, 0.8981772421402056]} +{"problem_id": "p02555", "input": "from sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\nsetrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\t@lru_cache(None)\n\n\tdef dp(currsum):\n\n\t\tif currsum == s: return 1\n\n\t\tcnt = 0\n\n\t\tfor d in range(3, 2001):\n\n\t\t\tif currsum + d <= s:\n\n\t\t\t\tcnt += dp(currsum + d)\n\n\t\t\t\tcnt %= MOD \n\n\t\treturn cnt\n\n\tprint((dp(0)))\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "input_tokens": ["from", "\u0120sys", "\u0120import", "\u0120stdin", ",", "\u0120stdout", ",", "\u0120set", "rec", "ursion", "limit", "\u010a\u010a", "from", "\u0120collections", "\u0120import", "\u0120deque", ",", "\u0120defaultdict", ",", "\u0120Counter", "\u010a\u010a", "from", "\u0120heapq", "\u0120import", "\u0120he", "app", "ush", ",", "\u0120he", "app", "op", "\u010a\u010a", "from", "\u0120functools", "\u0120import", "\u0120l", "ru", "_cache", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a\u010a\u010a", "set", "rec", "ursion", "limit", "(", "1", "0", "**", "6", ")\u010a\u010a", "rl", "\u0120=", "\u0120lambda", ":", "\u0120stdin", ".readline", "()\u010a\u010a", "r", "ll", "\u0120=", "\u0120lambda", ":", "\u0120stdin", ".readline", "().", "split", "()\u010a\u010a", "r", "li", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(int", ",", "\u0120stdin", ".readline", "().", "split", "()))\u010a\u010a", "rl", "f", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(float", ",", "\u0120stdin", ".readline", "().", "split", "()))", "\u010a\u010a\u010a\u010a", "INF", ",", "\u0120N", "INF", "\u0120=", "\u0120float", "('", "inf", "'),", "\u0120float", "('-", "inf", "')\u010a\u010a", "MOD", "\u0120=", "\u0120", "1", "0", "**", "9", "\u0120+", "\u0120", "7", "\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0109s", "\u0120=", "\u0120int", "(", "rl", "())\u010a\u010a", "\u010a\u010a", "\u0109", "@", "l", "ru", "_cache", "(None", ")\u010a\u010a", "\u0109def", "\u0120dp", "(curr", "sum", "):\u010a\u010a", "\u0109", "\u0109if", "\u0120curr", "sum", "\u0120==", "\u0120s", ":", "\u0120return", "\u0120", "1", "\u010a\u010a", "\u0109", "\u0109cnt", "\u0120=", "\u0120", "0", "\u010a\u010a", "\u0109", "\u0109for", "\u0120d", "\u0120in", "\u0120range", "(", "3", ",", "\u0120", "2", "0", "0", "1", "):\u010a\u010a", "\u0109\u0109", "\u0109if", "\u0120curr", "sum", "\u0120+", "\u0120d", "\u0120<=", "\u0120s", ":\u010a\u010a", "\u0109\u0109\u0109", "\u0109cnt", "\u0120+=", "\u0120dp", "(curr", "sum", "\u0120+", "\u0120d", ")\u010a\u010a", "\u0109\u0109\u0109", "\u0109cnt", "\u0120%=", "\u0120MOD", "\u0120\u010a\u010a", "\u0109", "\u0109return", "\u0120cnt", "\u010a\u010a", "\u0109print", "((", "dp", "(", "0", ")))\u010a\u010a", "\u0109std", "out", ".close", "()\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120\"__", "main", "__", "\":\u010a\u010a", "\u0109main", "()"], "input_token_weights": [0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.9367265554405826, 0.914713330925897, 0.5731452134031394, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.7967329450848046, 0.7967329450848046, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.6911750402874859, 0.6911750402874859, 0.7453461554353482, 0.7453461554353482, 0.8456076926739031, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.7967329450848046, 0.7967329450848046, 0.6911750402874859, 0.6911750402874859, 0.7453461554353482, 0.7453461554353482, 0.8456076926739031, 0.5731452134031394, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.914713330925897, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8922045961188434, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.8456076926739031, 0.914713330925897, 0.914713330925897, 0.5731452134031394, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8691775287719905, 0.8922045961188434, 0.5731452134031394, 0.8922045961188434, 0.5731452134031394, 0.9367265554405826, 0.9367265554405826, 0.9367265554405826, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8214688817838891, 0.7967329450848046, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.8214688817838891, 0.8214688817838891, 0.5731452134031394, 0.8691775287719905, 0.8456076926739031, 0.8456076926739031, 0.8691775287719905, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8214688817838891, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.7967329450848046, 0.5731452134031394, 0.7967329450848046, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.8214688817838891, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.5731452134031394, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.7713695892187169, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7186273667339679, 0.7453461554353482, 0.7453461554353482, 0.7713695892187169, 0.5731452134031394, 0.5731452134031394, 0.6911750402874859, 0.6629477592666795, 0.6339004969859428, 0.60398418480891, 0.60398418480891, 0.60398418480891, 0.6339004969859428, 0.5731452134031394, 0.5731452134031394, 0.6911750402874859, 0.6911750402874859, 0.5731452134031394, 0.5731452134031394, 0.5731452134031394, 0.8214688817838891, 0.5731452134031394, 0.5731452134031394, 0.8456076926739031, 0.7967329450848046, 0.7713695892187169, 0.7713695892187169, 0.8456076926739031, 0.5731452134031394, 0.8456076926739031, 0.8456076926739031, 0.8456076926739031, 0.9367265554405826, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.914713330925897, 0.8922045961188434, 0.8922045961188434, 0.8922045961188434, 0.9367265554405826, 0.5731452134031394, 0.8456076926739031]} +{"problem_id": "p03307", "input": "import math\n\nn=int(input())\n\nprint(((2*n)//math.gcd(2,n)))", "input_tokens": ["import", "\u0120math", "\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "print", "(((", "2", "*n", ")//", "math", ".g", "cd", "(", "2", ",n", ")))"], "input_token_weights": [0.89427190936908, 0.8563901704123833, 0.5928797394668679, 0.8563901704123833, 0.8563901704123833, 0.7760292149144611, 0.7760292149144611, 0.8563901704123833, 0.8170167109432965, 0.6419065217751312, 0.6419065217751312, 0.7332896764791028, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.6419065217751312, 0.8170167109432965]} +{"problem_id": "p03854", "input": "import sys\n\ns = input()\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n if s == t + w:\n\n print('YES')\n\n sys.exit()\n\n if s.startswith(t + w):\n\n nts.append(t + w)\n\n if len(nts) == 0:\n\n print('NO')\n\n sys.exit()\n\n ts = nts\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "s", "\u0120=", "\u0120input", "()\u010a\u010a", "ts", "\u0120=", "\u0120['", "']\u010a\u010a", "while", "\u0120True", ":\u010a\u010a", "\u0120", "\u0120n", "ts", "=", "\u0120[]\u010a\u010a", "\u0120", "\u0120for", "\u0120t", "\u0120in", "\u0120ts", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120w", "\u0120in", "\u0120['", "dream", "er", "',", "\u0120'", "eras", "er", "',", "\u0120'", "dream", "',", "\u0120'", "erase", "']", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", "\u0120==", "\u0120t", "\u0120+", "\u0120w", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120print", "('", "YES", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120s", ".startswith", "(t", "\u0120+", "\u0120w", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120n", "ts", ".append", "(t", "\u0120+", "\u0120w", ")\u010a\u010a", "\u0120", "\u0120if", "\u0120len", "(", "nts", ")", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "NO", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120sys", ".exit", "()\u010a\u010a", "\u0120", "\u0120ts", "\u0120=", "\u0120n", "ts", "\u010a"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.5770524973423397, 0.6771609938949378, 0.6448923330239924, 0.6115475853143139, 0.6448923330239924, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.5770524973423397, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7681534551894282, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6448923330239924, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7681534551894282, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397]} +{"problem_id": "p02688", "input": "N,K=list(map(int,input().split()))\n\na = [[0]*N]*K\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(input())\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)", "input_tokens": ["N", ",K", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "\u0120=", "\u0120[[", "0", "]*", "N", "]*", "K", "\u010a\u010a", "a", "\u0120=", "\u0120[[", "0", "\u0120for", "\u0120n", "\u0120in", "\u0120range", "(N", ")]", "\u0120for", "\u0120k", "\u0120in", "\u0120range", "(K", ")]", "\u010a\u010a\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120d", "=int", "(input", "())\u010a\u010a", "\u0120\u0120\u0120", "\u0120have", "_k", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120h", "\u0120in", "\u0120have", "_k", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120a", "[k", "][", "h", "-", "1", "]=", "1", "\u010a\u010a\u010a\u010a", "an", "=[", "0", "]*", "N", "\u010a\u010a", "for", "\u0120k", "\u0120in", "\u0120range", "(K", "):\u010a\u010a", "\u0120", "\u0120for", "\u0120n", "\u0120in", "\u0120range", "(N", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120an", "[n", "]", "\u0120=", "\u0120an", "[n", "]+", "a", "[k", "][", "n", "]\u010a\u010a\u010a\u010a", "result", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120an", ":\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120result", "+=", "1", "\u010a\u010a\u010a\u010a", "print", "(result", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7084208560793558, 0.7084208560793558, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03854", "input": "import sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = input()\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isDream #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n #print('d:', d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #; print(d, pout)\n\n if pout == len(S): \n\n isDream = True #; print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisDream = False\n\ndayDream(0)\n\nif isDream:\n\n print('YES')\n\nelse:\n\n print('NO')", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "sys", ".set", "rec", "ursion", "limit", "(", "1", "0", "0", "0", "0", "0", "0", ")\u010a\u010a\u010a\u010a", "S", "\u0120=", "\u0120input", "()\u010a\u010a\u010a\u010a", "T", "\u0120=", "\u0120['", "dream", "',", "\u0120'", "dream", "er", "',", "\u0120'", "erase", "',", "\u0120'", "eras", "er", "']\u010a\u010a", "len", "T", "\u0120=", "\u0120[", "len", "(i", ")", "\u0120for", "\u0120i", "\u0120in", "\u0120T", "]\u010a\u010a\u010a\u010a", "def", "\u0120day", "Dream", "(pin", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120global", "\u0120is", "Dream", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", ";", "print", "('", "day", "Dream", ":", "\u0120',", "\u0120pin", ",", "\u0120S", "[p", "in", ":", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", ",", "\u0120d", "\u0120in", "\u0120enumerate", "(T", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120#", "print", "('", "d", ":',", "\u0120d", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120S", "[p", "in", ":", "pin", "+len", "T", "[i", "]]", "\u0120==", "\u0120d", ":", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120p", "out", "\u0120=", "\u0120pin", "\u0120+", "\u0120len", "T", "[i", "]", "\u0120#", ";", "\u0120print", "(d", ",", "\u0120p", "out", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120p", "out", "\u0120==", "\u0120len", "(S", "):", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120is", "Dream", "\u0120=", "\u0120True", "\u0120\u0120", "\u0120#", ";", "\u0120print", "('", "YES", "')\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120return", "\u0120\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120day", "Dream", "(p", "out", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120#", "print", "('", "day", "Dream", "\u0120return", "',", "\u0120pin", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120return", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u010a\u010a", "is", "Dream", "\u0120=", "\u0120False", "\u010a\u010a", "day", "Dream", "(", "0", ")\u010a\u010a", "if", "\u0120is", "Dream", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "YES", "')\u010a\u010a", "else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "('", "NO", "')"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.8515524375924506, 0.8245182914059852, 0.8778749353275308, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.7681534551894282, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.6771609938949378, 0.7681534551894282, 0.5770524973423397, 0.5770524973423397, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.7084208560793558, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.6448923330239924, 0.6448923330239924, 0.6115475853143139, 0.6115475853143139, 0.6115475853143139, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8778749353275308, 0.5770524973423397, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.8245182914059852, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046]} +{"problem_id": "p03037", "input": "n,m=list(map(int,input().split()))\n\nc=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n c[l-1]+=1\n\n c[r]-=1\n\nfor i in range(1,n+2):\n\n c[i]=c[i]+c[i-1]\n\nans=0\n\nfor i in range(n+2):\n\n if c[i]==m:\n\n ans+=1\n\nprint(ans)", "input_tokens": ["n", ",m", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "c", "=[", "0", "]*(", "n", "+", "2", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(m", "):\u010a\u010a", "\u0120", "\u0120l", ",r", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "\u0120", "\u0120c", "[l", "-", "1", "]+=", "1", "\u010a\u010a", "\u0120", "\u0120c", "[r", "]-", "=", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "2", "):\u010a\u010a", "\u0120", "\u0120c", "[i", "]=", "c", "[i", "]+", "c", "[i", "-", "1", "]\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "+", "2", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120c", "[i", "]==", "m", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.7967329450848046, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8778749353275308, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.8515524375924506, 0.8778749353275308, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308]} +{"problem_id": "p03287", "input": "n,m=list(map(int,input().split()))\n\na=[int(x) for x in input().split()]\n\nb=[0 for x in range(n+1)]\n\nl=list([0])\n\n\n\nfor i in range(1,n+1):\n\n b[i]=b[i-1]+a[i-1]\n\n\n\nfor i in range(1,n+1):\n\n l.append(b[i]%m)\n\n\n\nd=list()\n\nl.sort()\n\nt,c=0,1\n\nfor i in range(1,n+1):\n\n if l[i]==l[i-1]:\n\n c+=1\n\n else:\n\n if c!=1:\n\n t += c*(c-1)//2\n\n c=1\n\n\n\nif c!=1:\n\n t += c*(c-1)//2 \n\n\n\nprint(t)\n", "input_tokens": ["n", ",m", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "a", "=[", "int", "(x", ")", "\u0120for", "\u0120x", "\u0120in", "\u0120input", "().", "split", "()]\u010a\u010a", "b", "=[", "0", "\u0120for", "\u0120x", "\u0120in", "\u0120range", "(n", "+", "1", ")]\u010a\u010a", "l", "=list", "([", "0", "])\u010a\u010a", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120b", "[i", "]=", "b", "[i", "-", "1", "]+", "a", "[i", "-", "1", "]\u010a\u010a\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120l", ".append", "(b", "[i", "]%", "m", ")\u010a\u010a\u010a\u010a", "d", "=list", "()\u010a\u010a", "l", ".sort", "()\u010a\u010a", "t", ",c", "=", "0", ",", "1", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120l", "[i", "]==", "l", "[i", "-", "1", "]:\u010a\u010a", "\u0120\u0120\u0120", "\u0120c", "+=", "1", "\u010a\u010a", "\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120c", "!=", "1", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120t", "\u0120+=", "\u0120c", "*(", "c", "-", "1", ")//", "2", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120", "\u0120c", "=", "1", "\u010a\u010a\u010a\u010a", "if", "\u0120c", "!=", "1", ":\u010a\u010a", "\u0120", "\u0120t", "\u0120+=", "\u0120c", "*(", "c", "-", "1", ")//", "2", "\u0120\u0120", "\u010a\u010a\u010a\u010a", "print", "(t", ")\u010a"], "input_token_weights": [0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.860922050467044, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8854867975141383, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.8357386476069529, 0.860922050467044, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.7833854580549265, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.860922050467044, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.860922050467044, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8099046207685895, 0.8854867975141383, 0.5749858371565393, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.5749858371565393, 0.8099046207685895, 0.7833854580549265, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.6696615116992518, 0.6696615116992518, 0.6075505590312809, 0.6075505590312809, 0.6075505590312809, 0.6993277790098028, 0.6993277790098028, 0.5749858371565393, 0.5749858371565393, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8099046207685895, 0.8099046207685895, 0.7561438265913266, 0.7561438265913266, 0.7561438265913266, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383]} +{"problem_id": "p02850", "input": "import copy\n\n\n\nn=int(input())\n\norg_set=set([i for i in range(1,10**5)])\n\nedges=[]\n\nrelations={}\n\nnodes=[]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split(\" \")))\n\n edges.append([a,b])\n\n relations.setdefault(a,[]).append(b)\n\n nodes.append([])\n\nnodes.append([])\n\nnodes.append([])\n\n\n\nmax_color=0\n\nfor start in range(1,n+1):\n\n targets=relations.get(start,[])\n\n color=1\n\n for target in targets:\n\n if color in nodes[start]:\n\n color+=1\n\n else:\n\n pass\n\n nodes[target].append(color)\n\n if color>=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]][0]))", "input_tokens": ["import", "\u0120copy", "\u010a\u010a\u010a\u010a", "n", "=int", "(input", "())\u010a\u010a", "org", "_set", "=set", "([", "i", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "1", "0", "**", "5", ")])\u010a\u010a", "edges", "=[]", "\u010a\u010a", "relations", "={", "}\u010a\u010a", "nodes", "=[]", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "-", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120a", ",b", "=list", "(map", "(int", ",input", "().", "split", "(\"", "\u0120\"", ")))\u010a\u010a", "\u0120\u0120\u0120", "\u0120edges", ".append", "([", "a", ",b", "])\u010a\u010a", "\u0120\u0120\u0120", "\u0120relations", ".setdefault", "(a", ",", "[]", ").", "append", "(b", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120nodes", ".append", "([]", ")\u010a\u010a", "nodes", ".append", "([]", ")\u010a\u010a", "nodes", ".append", "([]", ")\u010a\u010a\u010a\u010a", "max", "_color", "=", "0", "\u010a\u010a", "for", "\u0120start", "\u0120in", "\u0120range", "(", "1", ",n", "+", "1", "):\u010a\u010a", "\u0120\u0120\u0120", "\u0120targets", "=", "relations", ".get", "(start", ",", "[]", ")\u010a\u010a", "\u0120\u0120\u0120", "\u0120color", "=", "1", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120target", "\u0120in", "\u0120targets", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120color", "\u0120in", "\u0120nodes", "[start", "]:\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120color", "+=", "1", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120else", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120pass", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120nodes", "[target", "].", "append", "(color", ")\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120color", ">=", "max", "_color", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120max", "_color", "=color", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120color", "+=", "1", "\u010a\u010a\u010a\u010a", "print", "(max", "_color", ")\u010a\u010a", "for", "\u0120edge", "\u0120in", "\u0120edges", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "((", "nodes", "[edge", "[", "1", "]][", "0", "]))"], "input_token_weights": [0.9285282781079651, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.8515524375924506, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.7084208560793558, 0.8515524375924506, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9035222925783293, 0.9035222925783293, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8515524375924506, 0.7967329450848046, 0.7387330872699986, 0.7387330872699986, 0.6771609938949378, 0.6771609938949378, 0.6771609938949378, 0.6448923330239924, 0.7967329450848046, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7387330872699986, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.5770524973423397, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8245182914059852, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.9035222925783293, 0.5770524973423397, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8515524375924506, 0.8515524375924506, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7967329450848046, 0.5770524973423397, 0.8515524375924506, 0.8515524375924506, 0.8515524375924506, 0.5770524973423397, 0.5770524973423397, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.7681534551894282, 0.5770524973423397, 0.8245182914059852, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.8245182914059852, 0.5770524973423397, 0.7387330872699986, 0.7387330872699986, 0.7387330872699986, 0.5770524973423397, 0.5770524973423397, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.5770524973423397, 0.9035222925783293, 0.8778749353275308, 0.8778749353275308, 0.8778749353275308, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.9285282781079651, 0.5770524973423397, 0.8515524375924506, 0.8245182914059852, 0.7387330872699986, 0.7387330872699986, 0.7084208560793558, 0.7084208560793558, 0.7681534551894282, 0.7681534551894282, 0.8245182914059852]} +{"problem_id": "p02691", "input": "n=int(input())\n\na=list(map(int,input().split()))\n\nk=[]\n\nans=0\n\nfor i in range(400005):\n\n k.append(0)\n\nfor i in range(n):\n\n if i-a[i]>=0:\n\n ans+=k[i-a[i]]\n\n if a[i]+i<400005:\n\n k[a[i]+i]+=1\n\nprint(ans)", "input_tokens": ["n", "=int", "(input", "())\u010a\u010a", "a", "=list", "(map", "(int", ",input", "().", "split", "()))\u010a\u010a", "k", "=[]", "\u010a\u010a", "ans", "=", "0", "\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(", "4", "0", "0", "0", "0", "5", "):\u010a\u010a", "\u0120", "\u0120k", ".append", "(", "0", ")\u010a\u010a", "for", "\u0120i", "\u0120in", "\u0120range", "(n", "):\u010a\u010a", "\u0120", "\u0120if", "\u0120i", "-a", "[i", "]>=", "0", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120ans", "+=", "k", "[i", "-a", "[i", "]]\u010a\u010a", "\u0120", "\u0120if", "\u0120a", "[i", "]+", "i", "<", "4", "0", "0", "0", "0", "5", ":\u010a\u010a", "\u0120\u0120\u0120", "\u0120k", "[a", "[i", "]+", "i", "]+=", "1", "\u010a\u010a", "print", "(ans", ")"], "input_token_weights": [0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.8284253466378658, 0.7640031686476719, 0.7640031686476719, 0.6951432441854742, 0.6951432441854742, 0.8284253466378658, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.8889473014940781, 0.8889473014940781, 0.8889473014940781, 0.582053818991329, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.7967329450848046, 0.9178879013889365, 0.9178879013889365, 0.9178879013889365, 0.8889473014940781, 0.8591441175808593, 0.9178879013889365, 0.582053818991329, 0.8591441175808593, 0.7967329450848046, 0.7967329450848046, 0.7640031686476719, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7640031686476719, 0.7640031686476719, 0.7301658005010259, 0.7301658005010259, 0.6951432441854742, 0.6588494518362031, 0.7301658005010259, 0.582053818991329, 0.8591441175808593, 0.7640031686476719, 0.7640031686476719, 0.7967329450848046, 0.7967329450848046, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8284253466378658, 0.8591441175808593, 0.582053818991329, 0.7301658005010259, 0.7301658005010259, 0.6588494518362031, 0.6951432441854742, 0.6951432441854742, 0.7640031686476719, 0.7640031686476719, 0.582053818991329, 0.8889473014940781, 0.8591441175808593, 0.8591441175808593]} +{"problem_id": "p02881", "input": "import sys\n\nimport os\n\nimport math\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n ret = float('inf')\n\n I = int(math.sqrt(N)) * 10\n\n for i in range(1, I):\n\n if N%i == 0:\n\n j = N//i\n\n ret = min(ret, j + i - 2)\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "input_tokens": ["import", "\u0120sys", "\u010a\u010a", "import", "\u0120os", "\u010a\u010a", "import", "\u0120math", "\u010a\u010a\u010a\u010a", "ii", "\u0120=", "\u0120lambda", ":", "\u0120int", "(sys", ".stdin", ".buffer", ".readline", "().", "rstrip", "())\u010a\u010a", "il", "\u0120=", "\u0120lambda", ":", "\u0120list", "(map", "(int", ",", "\u0120sys", ".stdin", ".buffer", ".readline", "().", "split", "()))\u010a\u010a", "il", "n", "\u0120=", "\u0120lambda", "\u0120n", ":", "\u0120[", "int", "(sys", ".stdin", ".buffer", ".readline", "().", "rstrip", "())", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a", "iss", "\u0120=", "\u0120lambda", ":", "\u0120sys", ".stdin", ".buffer", ".readline", "().", "decode", "().", "rstrip", "()\u010a\u010a", "is", "n", "\u0120=", "\u0120lambda", "\u0120n", ":", "\u0120[", "sys", ".stdin", ".buffer", ".readline", "().", "decode", "().", "rstrip", "()", "\u0120for", "\u0120_", "\u0120in", "\u0120range", "(n", ")]", "\u010a\u010a\u010a\u010a\u010a\u010a", "def", "\u0120main", "():\u010a\u010a", "\u0120\u0120\u0120", "\u0120if", "\u0120os", ".getenv", "(\"", "LOCAL", "\")", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120sys", ".stdin", "\u0120=", "\u0120open", "(\"", "input", ".txt", "\",", "\u0120\"", "r", "\")\u010a\u010a", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120N", "\u0120=", "\u0120ii", "()\u010a\u010a", "\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120float", "('", "inf", "')\u010a\u010a", "\u0120\u0120\u0120", "\u0120I", "\u0120=", "\u0120int", "(math", ".sqrt", "(N", "))", "\u0120*", "\u0120", "1", "0", "\u010a\u010a", "\u0120\u0120\u0120", "\u0120for", "\u0120i", "\u0120in", "\u0120range", "(", "1", ",", "\u0120I", "):\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120if", "\u0120N", "%i", "\u0120==", "\u0120", "0", ":\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120j", "\u0120=", "\u0120N", "//", "i", "\u010a\u010a", "\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120\u0120", "\u0120ret", "\u0120=", "\u0120min", "(ret", ",", "\u0120j", "\u0120+", "\u0120i", "\u0120-", "\u0120", "2", ")\u010a\u010a\u010a\u010a", "\u0120\u0120\u0120", "\u0120print", "(ret", ")\u010a\u010a\u010a\u010a\u010a\u010a", "if", "\u0120__", "name", "__", "\u0120==", "\u0120'__", "main", "__", "':\u010a\u010a", "\u0120\u0120\u0120", "\u0120main", "()\u010a"], "input_token_weights": [0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9328769136071888, 0.9094625571831276, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.6696615116992518, 0.6993277790098028, 0.7281392564472128, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.6075505590312809, 0.6075505590312809, 0.6390881791778984, 0.6696615116992518, 0.7281392564472128, 0.7281392564472128, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.6390881791778984, 0.6696615116992518, 0.6993277790098028, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.860922050467044, 0.5749858371565393, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.6696615116992518, 0.6696615116992518, 0.6993277790098028, 0.7281392564472128, 0.7833854580549265, 0.7833854580549265, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.860922050467044, 0.8854867975141383, 0.860922050467044, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.6993277790098028, 0.7561438265913266, 0.7561438265913266, 0.8099046207685895, 0.8099046207685895, 0.8099046207685895, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.860922050467044, 0.5749858371565393, 0.9328769136071888, 0.9328769136071888, 0.9328769136071888, 0.5749858371565393, 0.8854867975141383, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8099046207685895, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.7833854580549265, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7561438265913266, 0.5749858371565393, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8357386476069529, 0.8099046207685895, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.860922050467044, 0.860922050467044, 0.8099046207685895, 0.7833854580549265, 0.7281392564472128, 0.7281392564472128, 0.7833854580549265, 0.8357386476069529, 0.5749858371565393, 0.8357386476069529, 0.8357386476069529, 0.5749858371565393, 0.5749858371565393, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8357386476069529, 0.8854867975141383, 0.5749858371565393, 0.8357386476069529, 0.7833854580549265, 0.7833854580549265, 0.8099046207685895, 0.5749858371565393, 0.8099046207685895, 0.8357386476069529, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.7281392564472128, 0.7281392564472128, 0.5749858371565393, 0.5749858371565393, 0.7561438265913266, 0.7561438265913266, 0.7281392564472128, 0.6993277790098028, 0.6993277790098028, 0.6390881791778984, 0.6390881791778984, 0.6390881791778984, 0.6696615116992518, 0.5749858371565393, 0.6696615116992518, 0.6993277790098028, 0.5749858371565393, 0.860922050467044, 0.8357386476069529, 0.8357386476069529, 0.9328769136071888, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.9094625571831276, 0.8854867975141383, 0.8854867975141383, 0.8854867975141383, 0.9328769136071888, 0.5749858371565393, 0.860922050467044, 0.8357386476069529]} diff --git a/python_splits/test_verified.jsonl b/python_splits/test_verified.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..873d4e30014adb1559a186d102fb168071f41575 --- /dev/null +++ b/python_splits/test_verified.jsonl @@ -0,0 +1,557 @@ +{"user_id": "u732870425", "problem_id": "p03371", "language": "python", "submission_id_v0": "s504204235", "submission_id_v1": "s825991485", "cpu_time_v0": 104, "cpu_time_v1": 26, "memory_v0": 9176, "memory_v1": 9180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.0, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 5000 * 2 * 10 ** 5\n\nfor i in range(10 ** 5 + 1):\n\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n\n ans = min(ans, s)\n\n\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nif X > Y:\n\n v = A\n\nelse:\n\n v = B\n\n\n\nans = min(A*X+B*Y, C*max(X, Y)*2, C*min(X,Y)*2+(max(X,Y)-min(X,Y))*v)\n\n\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 10, "code_v0_num_chars": 195, "code_v1_num_chars": 170, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = 5000 * 2 * 10**5\nfor i in range(10**5 + 1):\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n ans = min(ans, s)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nif X > Y:\n v = A\nelse:\n v = B\nans = min(\n A * X + B * Y, C * max(X, Y) * 2, C * min(X, Y) * 2 + (max(X, Y) - min(X, Y)) * v\n)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-ans = 5000 * 2 * 10**5", "-for i in range(10**5 + 1):", "- s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B", "- ans = min(ans, s)", "+if X > Y:", "+ v = A", "+else:", "+ v = B", "+ans = min(", "+ A * X + B * Y, C * max(X, Y) * 2, C * min(X, Y) * 2 + (max(X, Y) - min(X, Y)) * v", "+)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.5409223008, "measured_runtime_v1": 0.2907806964, "runtime_lift": 5.2992592696, "key": ["s504204235", "s825991485"]} +{"user_id": "u102461423", "problem_id": "p02612", "language": "python", "submission_id_v0": "s840955881", "submission_id_v1": "s608348800", "cpu_time_v0": 35, "cpu_time_v1": 29, "memory_v0": 9152, "memory_v1": 9160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.14, "input": "import sys\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(read())\n\nx = N + (-N) % 1000\n\nprint((x - N))", "target": "import math\n\nN = int(input())\n\nx = math.ceil(N/1000) * 1000\n\nprint((x-N))", "code_v0_loc": 9, "code_v1_loc": 4, "code_v0_num_chars": 174, "code_v1_num_chars": 71, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(read())\nx = N + (-N) % 1000\nprint((x - N))\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\nx = math.ceil(N / 1000) * 1000\nprint((x - N))\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-import sys", "+import math", "-read = sys.stdin.buffer.read", "-readline = sys.stdin.buffer.readline", "-readlines = sys.stdin.buffer.readlines", "-N = int(read())", "-x = N + (-N) % 1000", "+N = int(input())", "+x = math.ceil(N / 1000) * 1000"], "diff_only_import_comment": false, "measured_runtime_v0": 0.260022393, "measured_runtime_v1": 0.1385840868, "runtime_lift": 1.8762788639, "key": ["s840955881", "s608348800"]} +{"user_id": "u056277698", "problem_id": "p03078", "language": "python", "submission_id_v0": "s581139547", "submission_id_v1": "s213757381", "cpu_time_v0": 104, "cpu_time_v1": 36, "memory_v0": 8708, "memory_v1": 4976, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.38, "input": "# -*- coding: utf-8 -*-\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nabc = []\n\n\n\nfor i, _a in enumerate(a):\n\n for j, _b in enumerate(b):\n\n if (i+1) * (j+1) > k:\n\n break\n\n for l, _c in enumerate(c):\n\n if (i+1) * (j+1) * (l+1) > k:\n\n break\n\n abc.append(_a + _b + _c)\n\n\n\nabc.sort(reverse=True)\n\nfor x in abc[:k]:\n\n print(x)\n", "target": "# -*- coding: utf-8 -*-\n\nimport heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\nla, lb, lc = len(a), len(b), len(c)\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nfix = set()\n\n\n\nq = [(-(a[0]+b[0]+c[0]), 0, 0, 0)]\n\n\n\nfor _ in range(k):\n\n abc, i, j, l = heapq.heappop(q)\n\n print((-abc))\n\n\n\n if i+1 < la and (i+1, j, l) not in fix:\n\n heapq.heappush(q, (-(a[i+1]+b[j]+c[l]), i+1, j, l))\n\n fix.add((i+1, j, l))\n\n\n\n if j+1 < lb and (i, j+1, l) not in fix:\n\n heapq.heappush(q, (-(a[i]+b[j+1]+c[l]), i, j+1, l))\n\n fix.add((i, j+1, l))\n\n\n\n if l+1 < lc and (i, j, l+1) not in fix:\n\n heapq.heappush(q, (-(a[i]+b[j]+c[l+1]), i, j, l+1))\n\n fix.add((i, j, l+1))\n", "code_v0_loc": 24, "code_v1_loc": 33, "code_v0_num_chars": 566, "code_v1_num_chars": 841, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nabc = []\nfor i, _a in enumerate(a):\n for j, _b in enumerate(b):\n if (i + 1) * (j + 1) > k:\n break\n for l, _c in enumerate(c):\n if (i + 1) * (j + 1) * (l + 1) > k:\n break\n abc.append(_a + _b + _c)\nabc.sort(reverse=True)\nfor x in abc[:k]:\n print(x)\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport heapq\n\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\nla, lb, lc = len(a), len(b), len(c)\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nfix = set()\nq = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]\nfor _ in range(k):\n abc, i, j, l = heapq.heappop(q)\n print((-abc))\n if i + 1 < la and (i + 1, j, l) not in fix:\n heapq.heappush(q, (-(a[i + 1] + b[j] + c[l]), i + 1, j, l))\n fix.add((i + 1, j, l))\n if j + 1 < lb and (i, j + 1, l) not in fix:\n heapq.heappush(q, (-(a[i] + b[j + 1] + c[l]), i, j + 1, l))\n fix.add((i, j + 1, l))\n if l + 1 < lc and (i, j, l + 1) not in fix:\n heapq.heappush(q, (-(a[i] + b[j] + c[l + 1]), i, j, l + 1))\n fix.add((i, j, l + 1))\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["+import heapq", "+", "+la, lb, lc = len(a), len(b), len(c)", "-abc = []", "-for i, _a in enumerate(a):", "- for j, _b in enumerate(b):", "- if (i + 1) * (j + 1) > k:", "- break", "- for l, _c in enumerate(c):", "- if (i + 1) * (j + 1) * (l + 1) > k:", "- break", "- abc.append(_a + _b + _c)", "-abc.sort(reverse=True)", "-for x in abc[:k]:", "- print(x)", "+fix = set()", "+q = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]", "+for _ in range(k):", "+ abc, i, j, l = heapq.heappop(q)", "+ print((-abc))", "+ if i + 1 < la and (i + 1, j, l) not in fix:", "+ heapq.heappush(q, (-(a[i + 1] + b[j] + c[l]), i + 1, j, l))", "+ fix.add((i + 1, j, l))", "+ if j + 1 < lb and (i, j + 1, l) not in fix:", "+ heapq.heappush(q, (-(a[i] + b[j + 1] + c[l]), i, j + 1, l))", "+ fix.add((i, j + 1, l))", "+ if l + 1 < lc and (i, j, l + 1) not in fix:", "+ heapq.heappush(q, (-(a[i] + b[j] + c[l + 1]), i, j, l + 1))", "+ fix.add((i, j, l + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4343315315, "measured_runtime_v1": 0.2096420834, "runtime_lift": 2.0717764508, "key": ["s581139547", "s213757381"]} +{"user_id": "u761320129", "problem_id": "p03559", "language": "python", "submission_id_v0": "s241549796", "submission_id_v1": "s763191935", "cpu_time_v0": 368, "cpu_time_v1": 263, "memory_v0": 23328, "memory_v1": 29344, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.53, "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nans = 0\n\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n\n i = bisect_left(A, b)\n\n j = bisect(C, b)\n\n ans += i * (N-j)\n\nprint(ans)", "target": "N = int(input())\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nfrom bisect import bisect_left, bisect\n\nans = 0\n\nfor b in B:\n\n i = bisect_left(A,b)\n\n j = bisect(C,b)\n\n ans += i * (N-j)\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 14, "code_v0_num_chars": 291, "code_v1_num_chars": 289, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort()\nC.sort()\nans = 0\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n i = bisect_left(A, b)\n j = bisect(C, b)\n ans += i * (N - j)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort()\nC.sort()\nfrom bisect import bisect_left, bisect\n\nans = 0\nfor b in B:\n i = bisect_left(A, b)\n j = bisect(C, b)\n ans += i * (N - j)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+from bisect import bisect_left, bisect", "+", "-from bisect import bisect, bisect_left", "-"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2898341594, "measured_runtime_v1": 0.1261365476, "runtime_lift": 2.2977809758, "key": ["s241549796", "s763191935"]} +{"user_id": "u984276646", "problem_id": "p03674", "language": "python", "submission_id_v0": "s545310428", "submission_id_v1": "s792744532", "cpu_time_v0": 433, "cpu_time_v1": 334, "memory_v0": 43480, "memory_v1": 43988, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.86, "input": "n = int(input())\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp //= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp //= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n]*invf[i-1]*invf[n-i+1]%mod\n\n if i <= n-1:\n\n S += fact[n-1]*invf[i]*invf[n-1-i]%mod\n\n S %= mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n if i <= n:\n\n S += fact[n-1]*invf[i-1]*invf[n-i]%mod\n\n S %= mod\n\n print(S)", "target": "n = int(input())\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp //= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp //= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n+1]*invf[i]*invf[n-i+1]%mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n print(S)\n", "code_v0_loc": 75, "code_v1_loc": 69, "code_v0_num_chars": 1780, "code_v1_num_chars": 1635, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nD = {i: [0] for i in range(1, n + 1)}\nfor i in range(n + 1):\n D[a[i]][0] += 1\n D[a[i]].append(i)\npl, pr = 0, 0\nfor i in D:\n if D[i][0] == 2:\n pl = D[i][1]\n pr = D[i][2]\n break\nL = pl\nM = pr - pl - 1\nN = n - pr\nmod = int(1e9) + 7 # <-- input modulo\nmaxf = n + 11 # <-- input factional limitation\n\n\ndef make_fact(n, k):\n tmp = n\n perm = [i for i in range(k)]\n L = [0 for _ in range(k)]\n for i in range(k):\n L[i] = tmp % (i + 1)\n tmp //= i + 1\n LL = [0 for _ in range(k)]\n for i in range(k):\n LL[i] = perm[L[-i - 1]]\n for j in range(L[-i - 1] + 1, k):\n perm[j - 1] = perm[j]\n return LL\n\n\ndef doubling(n, m, modulo=mod):\n y = 1\n base = n\n tmp = m\n while tmp != 0:\n if tmp % 2 == 1:\n y *= base\n if modulo > 0:\n y %= modulo\n base *= base\n if modulo > 0:\n base %= modulo\n tmp //= 2\n return y\n\n\ndef inved(a, modulo=mod):\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n while l != 0:\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n k, l = l, k % l\n return x % modulo\n\n\nfact = [1 for _ in range(maxf + 1)]\ninvf = [1 for _ in range(maxf + 1)]\nfor i in range(maxf):\n fact[i + 1] = (fact[i] * (i + 1)) % mod\ninvf[-1] = inved(fact[-1])\nfor i in range(maxf, 0, -1):\n invf[i - 1] = (invf[i] * i) % mod\nfor i in range(1, n + 2):\n S = fact[n] * invf[i - 1] * invf[n - i + 1] % mod\n if i <= n - 1:\n S += fact[n - 1] * invf[i] * invf[n - 1 - i] % mod\n S %= mod\n if i <= n - M:\n S -= fact[n - 1 - M] * invf[i - 1] * invf[n - M - i] % mod\n S %= mod\n if i <= n:\n S += fact[n - 1] * invf[i - 1] * invf[n - i] % mod\n S %= mod\n print(S)\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nD = {i: [0] for i in range(1, n + 1)}\nfor i in range(n + 1):\n D[a[i]][0] += 1\n D[a[i]].append(i)\npl, pr = 0, 0\nfor i in D:\n if D[i][0] == 2:\n pl = D[i][1]\n pr = D[i][2]\n break\nL = pl\nM = pr - pl - 1\nN = n - pr\nmod = int(1e9) + 7 # <-- input modulo\nmaxf = n + 11 # <-- input factional limitation\n\n\ndef make_fact(n, k):\n tmp = n\n perm = [i for i in range(k)]\n L = [0 for _ in range(k)]\n for i in range(k):\n L[i] = tmp % (i + 1)\n tmp //= i + 1\n LL = [0 for _ in range(k)]\n for i in range(k):\n LL[i] = perm[L[-i - 1]]\n for j in range(L[-i - 1] + 1, k):\n perm[j - 1] = perm[j]\n return LL\n\n\ndef doubling(n, m, modulo=mod):\n y = 1\n base = n\n tmp = m\n while tmp != 0:\n if tmp % 2 == 1:\n y *= base\n if modulo > 0:\n y %= modulo\n base *= base\n if modulo > 0:\n base %= modulo\n tmp //= 2\n return y\n\n\ndef inved(a, modulo=mod):\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n while l != 0:\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n k, l = l, k % l\n return x % modulo\n\n\nfact = [1 for _ in range(maxf + 1)]\ninvf = [1 for _ in range(maxf + 1)]\nfor i in range(maxf):\n fact[i + 1] = (fact[i] * (i + 1)) % mod\ninvf[-1] = inved(fact[-1])\nfor i in range(maxf, 0, -1):\n invf[i - 1] = (invf[i] * i) % mod\nfor i in range(1, n + 2):\n S = fact[n + 1] * invf[i] * invf[n - i + 1] % mod\n if i <= n - M:\n S -= fact[n - 1 - M] * invf[i - 1] * invf[n - M - i] % mod\n S %= mod\n print(S)\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- S = fact[n] * invf[i - 1] * invf[n - i + 1] % mod", "- if i <= n - 1:", "- S += fact[n - 1] * invf[i] * invf[n - 1 - i] % mod", "- S %= mod", "+ S = fact[n + 1] * invf[i] * invf[n - i + 1] % mod", "- if i <= n:", "- S += fact[n - 1] * invf[i - 1] * invf[n - i] % mod", "- S %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3162681131, "measured_runtime_v1": 0.0655883436, "runtime_lift": 4.8220170785, "key": ["s545310428", "s792744532"]} +{"user_id": "u671060652", "problem_id": "p02952", "language": "python", "submission_id_v0": "s923935687", "submission_id_v1": "s007434774", "cpu_time_v0": 222, "cpu_time_v1": 60, "memory_v0": 40940, "memory_v1": 61860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.97, "input": "n = int(input())\n\n\n\n\n\ndef countKeta(num):\n\n count = 1\n\n while num / 10 >= 1:\n\n count += 1\n\n num = num // 10\n\n return count\n\n\n\n\n\ncount = 0\n\n\n\nfor i in range(1, n+1):\n\n if(countKeta(i) % 2 == 1):\n\n count += 1\n\n\n\nprint(count)", "target": "n = int(input())\n\n\n\nif n < 10:\n\n print(n)\n\nelif n < 100:\n\n print((9))\n\nelif n < 1000:\n\n print((n-90))\n\nelif n < 10000:\n\n print((909))\n\nelif n < 100000:\n\n print((n-9090))\n\nelif n < 1000000:\n\n print((90909))", "code_v0_loc": 18, "code_v1_loc": 14, "code_v0_num_chars": 255, "code_v1_num_chars": 213, "code_v0_no_empty_lines": "n = int(input())\n\n\ndef countKeta(num):\n count = 1\n while num / 10 >= 1:\n count += 1\n num = num // 10\n return count\n\n\ncount = 0\nfor i in range(1, n + 1):\n if countKeta(i) % 2 == 1:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "n = int(input())\nif n < 10:\n print(n)\nelif n < 100:\n print((9))\nelif n < 1000:\n print((n - 90))\nelif n < 10000:\n print((909))\nelif n < 100000:\n print((n - 9090))\nelif n < 1000000:\n print((90909))\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-", "-", "-def countKeta(num):", "- count = 1", "- while num / 10 >= 1:", "- count += 1", "- num = num // 10", "- return count", "-", "-", "-count = 0", "-for i in range(1, n + 1):", "- if countKeta(i) % 2 == 1:", "- count += 1", "-print(count)", "+if n < 10:", "+ print(n)", "+elif n < 100:", "+ print((9))", "+elif n < 1000:", "+ print((n - 90))", "+elif n < 10000:", "+ print((909))", "+elif n < 100000:", "+ print((n - 9090))", "+elif n < 1000000:", "+ print((90909))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2693535981, "measured_runtime_v1": 0.1929554205, "runtime_lift": 1.3959369341, "key": ["s923935687", "s007434774"]} +{"user_id": "u837286475", "problem_id": "p02996", "language": "python", "submission_id_v0": "s244057022", "submission_id_v1": "s796254109", "cpu_time_v0": 1201, "cpu_time_v1": 941, "memory_v0": 53532, "memory_v1": 53600, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.65, "input": "\n\n\n\nn = int(input())\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\nabn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))", "target": "\n\nn = int(input())\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\n#abn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))", "code_v0_loc": 25, "code_v1_loc": 24, "code_v0_num_chars": 345, "code_v1_num_chars": 344, "code_v0_no_empty_lines": "n = int(input())\nabn = [list(map(int, input().split())) for _ in range(n)]\nabn.sort()\nabn.sort(key=lambda x: x[1])\n# print(abn)\nts = 0 # time_stamp\nenable = True\nfor abi in abn:\n a, b = abi\n if not ts + a <= b:\n enable = False\n break\n else:\n ts += a\nprint((\"Yes\" if enable else \"No\"))\n", "code_v1_no_empty_lines": "n = int(input())\nabn = [list(map(int, input().split())) for _ in range(n)]\n# abn.sort()\nabn.sort(key=lambda x: x[1])\n# print(abn)\nts = 0 # time_stamp\nenable = True\nfor abi in abn:\n a, b = abi\n if not ts + a <= b:\n enable = False\n break\n else:\n ts += a\nprint((\"Yes\" if enable else \"No\"))\n", "code_same": false, "relative_loc_diff_percent": 4.0, "diff": ["-abn.sort()", "+# abn.sort()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.205832685, "measured_runtime_v1": 0.0061624551, "runtime_lift": 33.4010847824, "key": ["s244057022", "s796254109"]} +{"user_id": "u546285759", "problem_id": "p00053", "language": "python", "submission_id_v0": "s431311473", "submission_id_v1": "s975765781", "cpu_time_v0": 360, "cpu_time_v1": 100, "memory_v0": 8104, "memory_v1": 9480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.22, "input": "def isPrime(x):\n\n if x == 2:\n\n return True\n\n if x < 2 or x % 2 == 0:\n\n return False\n\n i, root_x = 3, int(pow(x, 0.5))\n\n while i <= root_x:\n\n if x % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nprimes = [2]\n\nfor i in range(3, 104730):\n\n if isPrime(i):\n\n primes.append(primes[-1]+i)\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n print((primes[n-1]))", "target": "primes = [0, 0] + [1] * 150000\n\nfor i in range(2, 388):\n\n if primes[i]:\n\n for j in range(i*i, 150001, i):\n\n primes[j] = 0\n\n\n\nvalues = [i for i, v in enumerate(primes) if v]\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n print((sum(values[:n])))", "code_v0_loc": 21, "code_v1_loc": 12, "code_v0_num_chars": 438, "code_v1_num_chars": 287, "code_v0_no_empty_lines": "def isPrime(x):\n if x == 2:\n return True\n if x < 2 or x % 2 == 0:\n return False\n i, root_x = 3, int(pow(x, 0.5))\n while i <= root_x:\n if x % i == 0:\n return False\n i += 2\n return True\n\n\nprimes = [2]\nfor i in range(3, 104730):\n if isPrime(i):\n primes.append(primes[-1] + i)\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((primes[n - 1]))\n", "code_v1_no_empty_lines": "primes = [0, 0] + [1] * 150000\nfor i in range(2, 388):\n if primes[i]:\n for j in range(i * i, 150001, i):\n primes[j] = 0\nvalues = [i for i, v in enumerate(primes) if v]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(values[:n])))\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-def isPrime(x):", "- if x == 2:", "- return True", "- if x < 2 or x % 2 == 0:", "- return False", "- i, root_x = 3, int(pow(x, 0.5))", "- while i <= root_x:", "- if x % i == 0:", "- return False", "- i += 2", "- return True", "-", "-", "-primes = [2]", "-for i in range(3, 104730):", "- if isPrime(i):", "- primes.append(primes[-1] + i)", "+primes = [0, 0] + [1] * 150000", "+for i in range(2, 388):", "+ if primes[i]:", "+ for j in range(i * i, 150001, i):", "+ primes[j] = 0", "+values = [i for i, v in enumerate(primes) if v]", "- print((primes[n - 1]))", "+ print((sum(values[:n])))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.4180367088, "measured_runtime_v1": 0.5017841969, "runtime_lift": 2.8259891756, "key": ["s431311473", "s975765781"]} +{"user_id": "u714300041", "problem_id": "p03835", "language": "python", "submission_id_v0": "s859897716", "submission_id_v1": "s908338086", "cpu_time_v0": 324, "cpu_time_v1": 265, "memory_v0": 40684, "memory_v1": 40684, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.21, "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if x >= 0 and x <= K:\n\n ans += 1\n\nprint(ans)", "target": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if 0 <= x <= K:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 255, "code_v1_num_chars": 249, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nK, S = list(map(int, input().split()))\nans = 0\nfor z in range(K + 1):\n for y in range(K + 1):\n x = S - (z + y)\n if x >= 0 and x <= K:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nK, S = list(map(int, input().split()))\nans = 0\nfor z in range(K + 1):\n for y in range(K + 1):\n x = S - (z + y)\n if 0 <= x <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if x >= 0 and x <= K:", "+ if 0 <= x <= K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.450106571, "measured_runtime_v1": 0.2041984936, "runtime_lift": 2.2042599977, "key": ["s859897716", "s908338086"]} +{"user_id": "u994988729", "problem_id": "p02996", "language": "python", "submission_id_v0": "s348750359", "submission_id_v1": "s832149929", "cpu_time_v0": 885, "cpu_time_v1": 774, "memory_v0": 30828, "memory_v1": 41916, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.54, "input": "n=int(input())\n\ntask=[] \n\nfor _ in range(n):\n\n a,b=list(map(int,input().split()))\n\n task.append((b, -a))\n\n\n\ntask.sort()\n\n\n\ntime=0\n\nflag=True\n\nfor i in task:\n\n time-=i[1]\n\n if time>i[0]:\n\n flag=False\n\n break\n\n\n\nif flag:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n\n", "target": "import sys\n\nfrom collections import defaultdict\n\nfrom operator import itemgetter\n\ninput = sys.stdin.readline\n\n\n\nN = int(input())\n\nd = defaultdict(int)\n\nfor _ in range(N):\n\n a, b = list(map(int, input().split()))\n\n d[b] += a\n\ntask = list(d.items())\n\ntask.sort()\n\n\n\nnow = 0\n\nans = \"Yes\"\n\nfor limit, time in task:\n\n now += time\n\n if now > limit:\n\n ans = \"No\"\n\n break\n\n\n\nprint(ans)\n", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 283, "code_v1_num_chars": 398, "code_v0_no_empty_lines": "n = int(input())\ntask = []\nfor _ in range(n):\n a, b = list(map(int, input().split()))\n task.append((b, -a))\ntask.sort()\ntime = 0\nflag = True\nfor i in task:\n time -= i[1]\n if time > i[0]:\n flag = False\n break\nif flag:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "import sys\nfrom collections import defaultdict\nfrom operator import itemgetter\n\ninput = sys.stdin.readline\nN = int(input())\nd = defaultdict(int)\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n d[b] += a\ntask = list(d.items())\ntask.sort()\nnow = 0\nans = \"Yes\"\nfor limit, time in task:\n now += time\n if now > limit:\n ans = \"No\"\n break\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-n = int(input())", "-task = []", "-for _ in range(n):", "+import sys", "+from collections import defaultdict", "+from operator import itemgetter", "+", "+input = sys.stdin.readline", "+N = int(input())", "+d = defaultdict(int)", "+for _ in range(N):", "- task.append((b, -a))", "+ d[b] += a", "+task = list(d.items())", "-time = 0", "-flag = True", "-for i in task:", "- time -= i[1]", "- if time > i[0]:", "- flag = False", "+now = 0", "+ans = \"Yes\"", "+for limit, time in task:", "+ now += time", "+ if now > limit:", "+ ans = \"No\"", "-if flag:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3182171457, "measured_runtime_v1": 0.1977030051, "runtime_lift": 1.6095716175, "key": ["s348750359", "s832149929"]} +{"user_id": "u645250356", "problem_id": "p03038", "language": "python", "submission_id_v0": "s890208193", "submission_id_v1": "s797826633", "cpu_time_v0": 490, "cpu_time_v1": 431, "memory_v0": 71452, "memory_v1": 34916, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.04, "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heapify,heappop,heappush\n\nfrom bisect import bisect_left,bisect_right\n\nimport sys,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn,m = inpl()\n\na = inpl()\n\nb = [0] * m\n\nfor i in range(m):\n\n x,y = inpl()\n\n b[i] = [x,y]\n\na.sort()\n\nb.sort(key=lambda x:x[1], reverse = True)\n\nres = sum(a)\n\ni = 0\n\nj = 0\n\nwhile True:\n\n # print(i,j)\n\n if a[i] < b[j][1]:\n\n res += b[j][1] - a[i]\n\n i += 1\n\n else:\n\n break\n\n b[j][0] -= 1\n\n if b[j][0] == 0:\n\n j += 1\n\n if i >= n or j >= m:\n\n break\n\nprint(res)\n", "target": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nfrom bisect import bisect_left,bisect_right \n\nimport sys,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn,m = inpl()\n\na = inpl()\n\na.sort()\n\nbc = [inpl() for _ in range(m)]\n\nbc.sort(key = lambda x:x[1], reverse = True)\n\nlm = sum(x[1] for x in bc)\n\nnow = 0\n\nalt = 0\n\nwhile now < n and alt < m:\n\n c,b = bc[alt]\n\n if a[now] > b:\n\n break\n\n else:\n\n a[now] = b\n\n bc[alt][0] -= 1\n\n if bc[alt][0] == 0:\n\n alt += 1\n\n now += 1\n\nprint((sum(a)))\n", "code_v0_loc": 35, "code_v1_loc": 29, "code_v0_num_chars": 880, "code_v1_num_chars": 728, "code_v0_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heapify, heappop, heappush\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, string, queue\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef inpl_str():\n return list(sys.stdin.readline().split())\n\n\ndef inpln(n):\n return list(int(sys.stdin.readline()) for i in range(n))\n\n\nn, m = inpl()\na = inpl()\nb = [0] * m\nfor i in range(m):\n x, y = inpl()\n b[i] = [x, y]\na.sort()\nb.sort(key=lambda x: x[1], reverse=True)\nres = sum(a)\ni = 0\nj = 0\nwhile True:\n # print(i,j)\n if a[i] < b[j][1]:\n res += b[j][1] - a[i]\n i += 1\n else:\n break\n b[j][0] -= 1\n if b[j][0] == 0:\n j += 1\n if i >= n or j >= m:\n break\nprint(res)\n", "code_v1_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, math, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn, m = inpl()\na = inpl()\na.sort()\nbc = [inpl() for _ in range(m)]\nbc.sort(key=lambda x: x[1], reverse=True)\nlm = sum(x[1] for x in bc)\nnow = 0\nalt = 0\nwhile now < n and alt < m:\n c, b = bc[alt]\n if a[now] > b:\n break\n else:\n a[now] = b\n bc[alt][0] -= 1\n if bc[alt][0] == 0:\n alt += 1\n now += 1\nprint((sum(a)))\n", "code_same": false, "relative_loc_diff_percent": 17.1428571429, "diff": ["-from heapq import heapify, heappop, heappush", "+from heapq import heappop, heappush, heapify", "-import sys, math, itertools, string, queue", "+import sys, math, itertools, math, pprint", "+INF = float(\"inf\")", "-def inpl_str():", "- return list(sys.stdin.readline().split())", "-", "-", "-def inpln(n):", "- return list(int(sys.stdin.readline()) for i in range(n))", "-", "-", "-b = [0] * m", "-for i in range(m):", "- x, y = inpl()", "- b[i] = [x, y]", "-b.sort(key=lambda x: x[1], reverse=True)", "-res = sum(a)", "-i = 0", "-j = 0", "-while True:", "- # print(i,j)", "- if a[i] < b[j][1]:", "- res += b[j][1] - a[i]", "- i += 1", "+bc = [inpl() for _ in range(m)]", "+bc.sort(key=lambda x: x[1], reverse=True)", "+lm = sum(x[1] for x in bc)", "+now = 0", "+alt = 0", "+while now < n and alt < m:", "+ c, b = bc[alt]", "+ if a[now] > b:", "+ break", "- break", "- b[j][0] -= 1", "- if b[j][0] == 0:", "- j += 1", "- if i >= n or j >= m:", "- break", "-print(res)", "+ a[now] = b", "+ bc[alt][0] -= 1", "+ if bc[alt][0] == 0:", "+ alt += 1", "+ now += 1", "+print((sum(a)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.310756367, "measured_runtime_v1": 0.2053928638, "runtime_lift": 1.5129852191, "key": ["s890208193", "s797826633"]} +{"user_id": "u287132915", "problem_id": "p02891", "language": "python", "submission_id_v0": "s480399361", "submission_id_v1": "s640908939", "cpu_time_v0": 182, "cpu_time_v1": 72, "memory_v0": 38256, "memory_v1": 61768, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.44, "input": "s = input()\n\nk = int(input())\n\n\n\nif len(set(s)) == 1:\n\n print(((len(s)*k)//2))\n\n exit()\n\n\n\nss = s + s\n\n\n\nshoko = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(s)):\n\n if s[i] == prev:\n\n cnt += 1\n\n else:\n\n shoko += cnt // 2\n\n cnt = 1\n\n prev = s[i]\n\nshoko += cnt // 2\n\n\n\nkosa = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(ss)):\n\n if ss[i] == prev:\n\n cnt += 1\n\n else:\n\n kosa += cnt // 2\n\n cnt = 1\n\n prev = ss[i]\n\nkosa += cnt // 2\n\nkosa -= shoko\n\n\n\nprint((shoko + (k-1)*kosa))", "target": "s = input()\n\nk = int(input())\n\nn = len(s)\n\n\n\nif len(set(s)) == 1:\n\n print((n*k//2))\n\n exit()\n\n\n\nss = s + s\n\ncnts = 0\n\nnow = s[0]\n\ntemp = 1\n\nfor i in range(1, n):\n\n if s[i] == now:\n\n temp += 1\n\n else:\n\n cnts += temp // 2\n\n temp = 1\n\n now = s[i]\n\ncnts += temp // 2\n\n\n\ncntss = 0\n\nnow = ss[0]\n\ntemp = 1\n\nfor i in range(1, 2*n):\n\n if ss[i] == now:\n\n temp += 1\n\n else:\n\n cntss += temp // 2\n\n temp = 1\n\n now = ss[i]\n\ncntss += temp // 2\n\n\n\nkousa = cntss - cnts\n\nprint((cnts + kousa*(k-1)))", "code_v0_loc": 35, "code_v1_loc": 35, "code_v0_num_chars": 527, "code_v1_num_chars": 551, "code_v0_no_empty_lines": "s = input()\nk = int(input())\nif len(set(s)) == 1:\n print(((len(s) * k) // 2))\n exit()\nss = s + s\nshoko = 0\nprev = \"\"\ncnt = 0\nfor i in range(len(s)):\n if s[i] == prev:\n cnt += 1\n else:\n shoko += cnt // 2\n cnt = 1\n prev = s[i]\nshoko += cnt // 2\nkosa = 0\nprev = \"\"\ncnt = 0\nfor i in range(len(ss)):\n if ss[i] == prev:\n cnt += 1\n else:\n kosa += cnt // 2\n cnt = 1\n prev = ss[i]\nkosa += cnt // 2\nkosa -= shoko\nprint((shoko + (k - 1) * kosa))\n", "code_v1_no_empty_lines": "s = input()\nk = int(input())\nn = len(s)\nif len(set(s)) == 1:\n print((n * k // 2))\n exit()\nss = s + s\ncnts = 0\nnow = s[0]\ntemp = 1\nfor i in range(1, n):\n if s[i] == now:\n temp += 1\n else:\n cnts += temp // 2\n temp = 1\n now = s[i]\ncnts += temp // 2\ncntss = 0\nnow = ss[0]\ntemp = 1\nfor i in range(1, 2 * n):\n if ss[i] == now:\n temp += 1\n else:\n cntss += temp // 2\n temp = 1\n now = ss[i]\ncntss += temp // 2\nkousa = cntss - cnts\nprint((cnts + kousa * (k - 1)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+n = len(s)", "- print(((len(s) * k) // 2))", "+ print((n * k // 2))", "-shoko = 0", "-prev = \"\"", "-cnt = 0", "-for i in range(len(s)):", "- if s[i] == prev:", "- cnt += 1", "+cnts = 0", "+now = s[0]", "+temp = 1", "+for i in range(1, n):", "+ if s[i] == now:", "+ temp += 1", "- shoko += cnt // 2", "- cnt = 1", "- prev = s[i]", "-shoko += cnt // 2", "-kosa = 0", "-prev = \"\"", "-cnt = 0", "-for i in range(len(ss)):", "- if ss[i] == prev:", "- cnt += 1", "+ cnts += temp // 2", "+ temp = 1", "+ now = s[i]", "+cnts += temp // 2", "+cntss = 0", "+now = ss[0]", "+temp = 1", "+for i in range(1, 2 * n):", "+ if ss[i] == now:", "+ temp += 1", "- kosa += cnt // 2", "- cnt = 1", "- prev = ss[i]", "-kosa += cnt // 2", "-kosa -= shoko", "-print((shoko + (k - 1) * kosa))", "+ cntss += temp // 2", "+ temp = 1", "+ now = ss[i]", "+cntss += temp // 2", "+kousa = cntss - cnts", "+print((cnts + kousa * (k - 1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2980948234, "measured_runtime_v1": 0.2282131991, "runtime_lift": 1.3062120179, "key": ["s480399361", "s640908939"]} +{"user_id": "u367130284", "problem_id": "p03081", "language": "python", "submission_id_v0": "s141729674", "submission_id_v1": "s328617225", "cpu_time_v0": 599, "cpu_time_v1": 524, "memory_v0": 40892, "memory_v1": 40892, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.52, "input": "n,q=list(map(int,input().split()));s=\"_\"+input()+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:L=h==\"L\";R=h==\"R\";l,r=[l,l-1,l+1][(m==s[l]and R)-(m==s[l+1]and L)],[r,r-1,r+1][(m==s[r-1]and R)-(m==s[r]and L)]\n\nprint((max(0,r-l-1)))", "target": "n,q=list(map(int,input().split()));s=\"_\"+input()+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:\n\n L=h==\"L\";R=h==\"R\";\n\n l+=(m==s[l+1]and L)-(m==s[l]and R)\n\n r+=(m==s[r]and L)-(m==s[r-1]and R)\n\nprint((max(0,r-l-1)))", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 241, "code_v1_num_chars": 234, "code_v0_no_empty_lines": "n, q = list(map(int, input().split()))\ns = \"_\" + input() + \"_\"\nl, r = 0, n + 1\nfor (m, h) in [input().split() for i in range(q)][::-1]:\n L = h == \"L\"\n R = h == \"R\"\n l, r = [l, l - 1, l + 1][(m == s[l] and R) - (m == s[l + 1] and L)], [\n r,\n r - 1,\n r + 1,\n ][(m == s[r - 1] and R) - (m == s[r] and L)]\nprint((max(0, r - l - 1)))\n", "code_v1_no_empty_lines": "n, q = list(map(int, input().split()))\ns = \"_\" + input() + \"_\"\nl, r = 0, n + 1\nfor (m, h) in [input().split() for i in range(q)][::-1]:\n L = h == \"L\"\n R = h == \"R\"\n l += (m == s[l + 1] and L) - (m == s[l] and R)\n r += (m == s[r] and L) - (m == s[r - 1] and R)\nprint((max(0, r - l - 1)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["- l, r = [l, l - 1, l + 1][(m == s[l] and R) - (m == s[l + 1] and L)], [", "- r,", "- r - 1,", "- r + 1,", "- ][(m == s[r - 1] and R) - (m == s[r] and L)]", "+ l += (m == s[l + 1] and L) - (m == s[l] and R)", "+ r += (m == s[r] and L) - (m == s[r - 1] and R)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2496840062, "measured_runtime_v1": 0.1505171778, "runtime_lift": 1.6588406042, "key": ["s141729674", "s328617225"]} +{"user_id": "u134019875", "problem_id": "p03796", "language": "python", "submission_id_v0": "s983655328", "submission_id_v1": "s754374761", "cpu_time_v0": 231, "cpu_time_v1": 36, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.42, "input": "import math\n\n\n\nn = int(input())\n\nprint((math.factorial(n) % (10 ** 9 + 7)))", "target": "n = int(input())\n\np = 1\n\nfor i in range(1, n + 1):\n\n p = p * i % (10 ** 9 + 7)\n\nprint(p)", "code_v0_loc": 4, "code_v1_loc": 5, "code_v0_num_chars": 73, "code_v1_num_chars": 89, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\np = 1\nfor i in range(1, n + 1):\n p = p * i % (10**9 + 7)\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+p = 1", "+for i in range(1, n + 1):", "+ p = p * i % (10**9 + 7)", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1349290106, "measured_runtime_v1": 0.0997186968, "runtime_lift": 1.3530964092, "key": ["s983655328", "s754374761"]} +{"user_id": "u597374218", "problem_id": "p03035", "language": "python", "submission_id_v0": "s085289040", "submission_id_v1": "s328762084", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "a,b=list(map(int,input().split()))\n\nprint((b if 13<=a else b//2 if 6<=a else 0))", "target": "a,b=list(map(int,input().split()))\n\nprint((b if 12=b[i]):\n\n cnt+=b[i]\n\n else:\n\n cnt+=a[i]\n\n d=b[i]-a[i]\n\n cnt+=min(a[i+1],d)\n\n if(d>a[i+1]):\n\n a[i+1]=0\n\n else: a[i+1]-=d\n\n \n\n stdout.write(str(cnt)+\"\\n\")\n", "target": "n = int(input())\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\na1 = sum(A)\n\nfor i in range(n):\n\n b = B[i]\n\n if A[i] >= b:A[i] -= b\n\n else:\n\n if A[i+1]+A[i] >= b:\n\n A[i+1] = A[i+1]+A[i]-b\n\n A[i] = 0\n\n else:A[i], A[i+1] = 0, 0\n\na2 = sum(A)\n\nprint((a1-a2))", "code_v0_loc": 22, "code_v1_loc": 14, "code_v0_num_chars": 499, "code_v1_num_chars": 299, "code_v0_no_empty_lines": "from sys import stdin, stdout\n\nif __name__ == \"__main__\":\n n = int(stdin.readline())\n a = [int(x) for x in stdin.readline().split()]\n b = [int(x) for x in stdin.readline().split()]\n cnt = 0\n for i in range(n):\n if a[i] >= b[i]:\n cnt += b[i]\n else:\n cnt += a[i]\n d = b[i] - a[i]\n cnt += min(a[i + 1], d)\n if d > a[i + 1]:\n a[i + 1] = 0\n else:\n a[i + 1] -= d\n stdout.write(str(cnt) + \"\\n\")\n", "code_v1_no_empty_lines": "n = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\na1 = sum(A)\nfor i in range(n):\n b = B[i]\n if A[i] >= b:\n A[i] -= b\n else:\n if A[i + 1] + A[i] >= b:\n A[i + 1] = A[i + 1] + A[i] - b\n A[i] = 0\n else:\n A[i], A[i + 1] = 0, 0\na2 = sum(A)\nprint((a1 - a2))\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-from sys import stdin, stdout", "-", "-if __name__ == \"__main__\":", "- n = int(stdin.readline())", "- a = [int(x) for x in stdin.readline().split()]", "- b = [int(x) for x in stdin.readline().split()]", "- cnt = 0", "- for i in range(n):", "- if a[i] >= b[i]:", "- cnt += b[i]", "+n = int(input())", "+A = list(map(int, input().split()))", "+B = list(map(int, input().split()))", "+a1 = sum(A)", "+for i in range(n):", "+ b = B[i]", "+ if A[i] >= b:", "+ A[i] -= b", "+ else:", "+ if A[i + 1] + A[i] >= b:", "+ A[i + 1] = A[i + 1] + A[i] - b", "+ A[i] = 0", "- cnt += a[i]", "- d = b[i] - a[i]", "- cnt += min(a[i + 1], d)", "- if d > a[i + 1]:", "- a[i + 1] = 0", "- else:", "- a[i + 1] -= d", "- stdout.write(str(cnt) + \"\\n\")", "+ A[i], A[i + 1] = 0, 0", "+a2 = sum(A)", "+print((a1 - a2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2530250838, "measured_runtime_v1": 0.0949857178, "runtime_lift": 2.6638224113, "key": ["s078643579", "s464947070"]} +{"user_id": "u127499732", "problem_id": "p03608", "language": "python", "submission_id_v0": "s266235653", "submission_id_v1": "s503227515", "cpu_time_v0": 246, "cpu_time_v1": 190, "memory_v0": 83588, "memory_v1": 83656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.76, "input": "def main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = float(\"Inf\")\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[10 ** 8] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = 10 ** 8\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 34, "code_v1_loc": 34, "code_v0_num_chars": 771, "code_v1_num_chars": 761, "code_v0_no_empty_lines": "def main():\n from itertools import permutations\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n to = x[:r]\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n for i in range(1, n + 1):\n dis[i][i] = 0\n for a, b, c in zip(*[iter(x[r:])] * 3):\n dis[a][b] = c\n dis[b][a] = c\n for k in range(1, n + 1):\n for i in range(1, n + 1):\n for j in range(1, n + 1):\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n ans = float(\"Inf\")\n for p in permutations(to):\n tmp = 0\n nw = p[0]\n for nx in p[1:]:\n tmp += dis[nw][nx]\n nw = nx\n ans = min(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n from itertools import permutations\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n to = x[:r]\n dis = [[10**8] * (n + 1) for _ in range(n + 1)]\n for i in range(1, n + 1):\n dis[i][i] = 0\n for a, b, c in zip(*[iter(x[r:])] * 3):\n dis[a][b] = c\n dis[b][a] = c\n for k in range(1, n + 1):\n for i in range(1, n + 1):\n for j in range(1, n + 1):\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n ans = 10**8\n for p in permutations(to):\n tmp = 0\n nw = p[0]\n for nx in p[1:]:\n tmp += dis[nw][nx]\n nw = nx\n ans = min(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]", "+ dis = [[10**8] * (n + 1) for _ in range(n + 1)]", "- ans = float(\"Inf\")", "+ ans = 10**8"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3828251469, "measured_runtime_v1": 0.1865792952, "runtime_lift": 2.0518093745, "key": ["s266235653", "s503227515"]} +{"user_id": "u732159958", "problem_id": "p03416", "language": "python", "submission_id_v0": "s130057185", "submission_id_v1": "s637640023", "cpu_time_v0": 68, "cpu_time_v1": 50, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.47, "input": "counter = 0\n\nc = list(map(int, input().split(' ')))\n\nfor i in range(c[0], c[1] + 1):\n\n if str(i)[0] != str(i)[4]:\n\n continue\n\n if str(i)[1] != str(i)[3]:\n\n continue\n\n counter += 1\n\n\n\nprint(counter)", "target": "a = list(map(int, input().split()))\n\ncounter = 0\n\nfor i in range(a[0], a[1] + 1):\n\n stri = str(i)\n\n if (stri[0] == stri[4] and stri[1] == stri[3]):\n\n counter += 1\n\n \n\nprint(counter)", "code_v0_loc": 10, "code_v1_loc": 8, "code_v0_num_chars": 206, "code_v1_num_chars": 189, "code_v0_no_empty_lines": "counter = 0\nc = list(map(int, input().split(\" \")))\nfor i in range(c[0], c[1] + 1):\n if str(i)[0] != str(i)[4]:\n continue\n if str(i)[1] != str(i)[3]:\n continue\n counter += 1\nprint(counter)\n", "code_v1_no_empty_lines": "a = list(map(int, input().split()))\ncounter = 0\nfor i in range(a[0], a[1] + 1):\n stri = str(i)\n if stri[0] == stri[4] and stri[1] == stri[3]:\n counter += 1\nprint(counter)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["+a = list(map(int, input().split()))", "-c = list(map(int, input().split(\" \")))", "-for i in range(c[0], c[1] + 1):", "- if str(i)[0] != str(i)[4]:", "- continue", "- if str(i)[1] != str(i)[3]:", "- continue", "- counter += 1", "+for i in range(a[0], a[1] + 1):", "+ stri = str(i)", "+ if stri[0] == stri[4] and stri[1] == stri[3]:", "+ counter += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.442622024, "measured_runtime_v1": 0.3161446974, "runtime_lift": 1.4000615148, "key": ["s130057185", "s637640023"]} +{"user_id": "u089230684", "problem_id": "p03038", "language": "python", "submission_id_v0": "s817533229", "submission_id_v1": "s906455398", "cpu_time_v0": 826, "cpu_time_v1": 662, "memory_v0": 82456, "memory_v1": 25196, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.85, "input": "I=lambda:list(map(int,input().split()))\n\nn,m=I()\n\na=I()\n\na.sort(reverse=True)\n\nqq=[I() for i in range(m)]\n\nqq.sort(key=lambda x:x[1],reverse=True)\n\nans=0\n\nfor x,y in qq:\n\n for j in range(x):\n\n if not a:\n\n break\n\n aa=a.pop()\n\n ans+=max(aa,y)\n\nans+=sum(a)\n\nprint(ans)\n\n ", "target": "I=lambda : list(map(int,input().split()))\n\nn,m = I()\n\nl=I();s=sum(l);l.sort();d=[]\n\nfor _ in range(m):\n\n b,c=I()\n\n d.append([c,b])\n\np=s=0 \n\nfor i in sorted(d,reverse=True):\n\n while i[1]:\n\n if p>=n or l[p]>=i[0]:\n\n break\n\n i[1]-=1\n\n s+=i[0]\n\n p+=1\n\n if p>=n:\n\n break\n\ns+=sum(l[p:])\n\nprint(s)", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 310, "code_v1_num_chars": 351, "code_v0_no_empty_lines": "I = lambda: list(map(int, input().split()))\nn, m = I()\na = I()\na.sort(reverse=True)\nqq = [I() for i in range(m)]\nqq.sort(key=lambda x: x[1], reverse=True)\nans = 0\nfor x, y in qq:\n for j in range(x):\n if not a:\n break\n aa = a.pop()\n ans += max(aa, y)\nans += sum(a)\nprint(ans)\n", "code_v1_no_empty_lines": "I = lambda: list(map(int, input().split()))\nn, m = I()\nl = I()\ns = sum(l)\nl.sort()\nd = []\nfor _ in range(m):\n b, c = I()\n d.append([c, b])\np = s = 0\nfor i in sorted(d, reverse=True):\n while i[1]:\n if p >= n or l[p] >= i[0]:\n break\n i[1] -= 1\n s += i[0]\n p += 1\n if p >= n:\n break\ns += sum(l[p:])\nprint(s)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-a = I()", "-a.sort(reverse=True)", "-qq = [I() for i in range(m)]", "-qq.sort(key=lambda x: x[1], reverse=True)", "-ans = 0", "-for x, y in qq:", "- for j in range(x):", "- if not a:", "+l = I()", "+s = sum(l)", "+l.sort()", "+d = []", "+for _ in range(m):", "+ b, c = I()", "+ d.append([c, b])", "+p = s = 0", "+for i in sorted(d, reverse=True):", "+ while i[1]:", "+ if p >= n or l[p] >= i[0]:", "- aa = a.pop()", "- ans += max(aa, y)", "-ans += sum(a)", "-print(ans)", "+ i[1] -= 1", "+ s += i[0]", "+ p += 1", "+ if p >= n:", "+ break", "+s += sum(l[p:])", "+print(s)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3493785617, "measured_runtime_v1": 0.2761461248, "runtime_lift": 1.2651945122, "key": ["s817533229", "s906455398"]} +{"user_id": "u062691227", "problem_id": "p03723", "language": "python", "submission_id_v0": "s522426109", "submission_id_v1": "s794063832", "cpu_time_v0": 61, "cpu_time_v1": 29, "memory_v0": 61360, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.46, "input": "a,b,c=list(map(int,input().split()))\n\ne=(a-b)|(b-c)\n\nprint((bool(e|(a|b|c)%2)*(e^~-e).bit_length()-1))", "target": "a,b,c=list(map(int,input().split()))\n\ne=(a-b)|(b-c)\n\nprint((bool(e|b%2)*(e^~-e).bit_length()-1))", "code_v0_loc": 3, "code_v1_loc": 3, "code_v0_num_chars": 94, "code_v1_num_chars": 88, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\ne = (a - b) | (b - c)\nprint((bool(e | (a | b | c) % 2) * (e ^ ~-e).bit_length() - 1))\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\ne = (a - b) | (b - c)\nprint((bool(e | b % 2) * (e ^ ~-e).bit_length() - 1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-print((bool(e | (a | b | c) % 2) * (e ^ ~-e).bit_length() - 1))", "+print((bool(e | b % 2) * (e ^ ~-e).bit_length() - 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2914967289, "measured_runtime_v1": 0.0905496902, "runtime_lift": 3.2191907898, "key": ["s522426109", "s794063832"]} +{"user_id": "u298297089", "problem_id": "p03037", "language": "python", "submission_id_v0": "s092044899", "submission_id_v1": "s679810914", "cpu_time_v0": 352, "cpu_time_v1": 284, "memory_v0": 4760, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.32, "input": "N, M =list(map(int, input().split()))\n\nL = [0 for i in range(N+1)]\n\nR = [0 for i in range(N+1)]\n\nfor i in range(M):\n\n l,r = list(map(int, input().split()))\n\n L[l] += 1\n\n R[r] += 1\n\ncnt = 0\n\ntmp = 0\n\nfor i in range(N+1):\n\n tmp += L[i]\n\n if tmp == M:\n\n cnt += 1\n\n tmp -= R[i]\n\nprint(cnt)\n", "target": "n,m = list(map(int, input().split()))\n\nll = 1\n\nrr = n\n\nfor i in range(m):\n\n l,r = list(map(int,input().split()))\n\n if l > ll:\n\n ll = l\n\n if r < rr:\n\n rr = r\n\nprint((max(rr - ll + 1, 0)))\n", "code_v0_loc": 15, "code_v1_loc": 10, "code_v0_num_chars": 299, "code_v1_num_chars": 196, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL = [0 for i in range(N + 1)]\nR = [0 for i in range(N + 1)]\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L[l] += 1\n R[r] += 1\ncnt = 0\ntmp = 0\nfor i in range(N + 1):\n tmp += L[i]\n if tmp == M:\n cnt += 1\n tmp -= R[i]\nprint(cnt)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nll = 1\nrr = n\nfor i in range(m):\n l, r = list(map(int, input().split()))\n if l > ll:\n ll = l\n if r < rr:\n rr = r\nprint((max(rr - ll + 1, 0)))\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-N, M = list(map(int, input().split()))", "-L = [0 for i in range(N + 1)]", "-R = [0 for i in range(N + 1)]", "-for i in range(M):", "+n, m = list(map(int, input().split()))", "+ll = 1", "+rr = n", "+for i in range(m):", "- L[l] += 1", "- R[r] += 1", "-cnt = 0", "-tmp = 0", "-for i in range(N + 1):", "- tmp += L[i]", "- if tmp == M:", "- cnt += 1", "- tmp -= R[i]", "-print(cnt)", "+ if l > ll:", "+ ll = l", "+ if r < rr:", "+ rr = r", "+print((max(rr - ll + 1, 0)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2886495962, "measured_runtime_v1": 0.2151292083, "runtime_lift": 1.3417499114, "key": ["s092044899", "s679810914"]} +{"user_id": "u075012704", "problem_id": "p03558", "language": "python", "submission_id_v0": "s239051528", "submission_id_v1": "s690298448", "cpu_time_v0": 622, "cpu_time_v1": 294, "memory_v0": 102192, "memory_v1": 35324, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.73, "input": "from collections import deque\n\nK = int(input())\n\nG = [[] for i in range(K)]\n\n\n\nfor n in range(K):\n\n G[n].append([(n + 1) % K, 1])\n\n G[n].append([(10 * n) % K, 0])\n\n\n\nque = deque([[1, 1]])\n\ndist = [float('inf')] * K\n\n\n\nwhile que:\n\n node, cost = que.pop()\n\n dist[node] = min(cost, dist[node])\n\n for e, e_cost in G[node]:\n\n if dist[e] != float('inf'):\n\n continue\n\n\n\n if e_cost == 0:\n\n que.append([e, cost + 0])\n\n\n\n if e_cost == 1:\n\n que.appendleft([e, cost + 1])\n\n\n\nprint((dist[0]))\n", "target": "from collections import deque\n\nK = int(input())\n\nG = [[] for i in range(K)]\n\nfor i in range(K):\n\n G[i].append(((10 * i) % K, 0))\n\n G[i].append(((i + 1) % K, 1))\n\n\n\ndist = [float('inf')] * K\n\ndist[1] = 1\n\nque = deque()\n\nque.append(1)\n\n\n\nwhile que:\n\n n = que.pop()\n\n for v, c in G[n]:\n\n if dist[v] > dist[n] + c:\n\n dist[v] = dist[n] + c\n\n if c == 0:\n\n que.append(v)\n\n else:\n\n que.appendleft(v)\n\n\n\nprint((dist[0]))\n", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 547, "code_v1_num_chars": 492, "code_v0_no_empty_lines": "from collections import deque\n\nK = int(input())\nG = [[] for i in range(K)]\nfor n in range(K):\n G[n].append([(n + 1) % K, 1])\n G[n].append([(10 * n) % K, 0])\nque = deque([[1, 1]])\ndist = [float(\"inf\")] * K\nwhile que:\n node, cost = que.pop()\n dist[node] = min(cost, dist[node])\n for e, e_cost in G[node]:\n if dist[e] != float(\"inf\"):\n continue\n if e_cost == 0:\n que.append([e, cost + 0])\n if e_cost == 1:\n que.appendleft([e, cost + 1])\nprint((dist[0]))\n", "code_v1_no_empty_lines": "from collections import deque\n\nK = int(input())\nG = [[] for i in range(K)]\nfor i in range(K):\n G[i].append(((10 * i) % K, 0))\n G[i].append(((i + 1) % K, 1))\ndist = [float(\"inf\")] * K\ndist[1] = 1\nque = deque()\nque.append(1)\nwhile que:\n n = que.pop()\n for v, c in G[n]:\n if dist[v] > dist[n] + c:\n dist[v] = dist[n] + c\n if c == 0:\n que.append(v)\n else:\n que.appendleft(v)\nprint((dist[0]))\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["-for n in range(K):", "- G[n].append([(n + 1) % K, 1])", "- G[n].append([(10 * n) % K, 0])", "-que = deque([[1, 1]])", "+for i in range(K):", "+ G[i].append(((10 * i) % K, 0))", "+ G[i].append(((i + 1) % K, 1))", "+dist[1] = 1", "+que = deque()", "+que.append(1)", "- node, cost = que.pop()", "- dist[node] = min(cost, dist[node])", "- for e, e_cost in G[node]:", "- if dist[e] != float(\"inf\"):", "- continue", "- if e_cost == 0:", "- que.append([e, cost + 0])", "- if e_cost == 1:", "- que.appendleft([e, cost + 1])", "+ n = que.pop()", "+ for v, c in G[n]:", "+ if dist[v] > dist[n] + c:", "+ dist[v] = dist[n] + c", "+ if c == 0:", "+ que.append(v)", "+ else:", "+ que.appendleft(v)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7363213913, "measured_runtime_v1": 0.4714232118, "runtime_lift": 1.5619116176, "key": ["s239051528", "s690298448"]} +{"user_id": "u305366205", "problem_id": "p03307", "language": "python", "submission_id_v0": "s023207655", "submission_id_v1": "s158622460", "cpu_time_v0": 36, "cpu_time_v1": 17, "memory_v0": 5176, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.78, "input": "import math\n\n\n\n\n\ndef lcm(x, y):\n\n return (x * y) // math.gcd(x, y)\n\n\n\n\n\nN = int(input())\n\nprint((lcm(N, 2)))", "target": "N = int(input())\n\nif N % 2 == 0:\n\n print(N)\n\nelse:\n\n print((2 * N))", "code_v0_loc": 9, "code_v1_loc": 5, "code_v0_num_chars": 119, "code_v1_num_chars": 71, "code_v0_no_empty_lines": "import math\n\n\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\n\nN = int(input())\nprint((lcm(N, 2)))\n", "code_v1_no_empty_lines": "N = int(input())\nif N % 2 == 0:\n print(N)\nelse:\n print((2 * N))\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-import math", "-", "-", "-def lcm(x, y):", "- return (x * y) // math.gcd(x, y)", "-", "-", "-print((lcm(N, 2)))", "+if N % 2 == 0:", "+ print(N)", "+else:", "+ print((2 * N))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2764545197, "measured_runtime_v1": 0.1953277736, "runtime_lift": 1.4153364608, "key": ["s023207655", "s158622460"]} +{"user_id": "u279493135", "problem_id": "p02555", "language": "python", "submission_id_v0": "s706729835", "submission_id_v1": "s005580579", "cpu_time_v0": 319, "cpu_time_v1": 39, "memory_v0": 10348, "memory_v1": 11860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.77, "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n for i in range(x-2):\n\n ret += rec(i)\n\n ret %= mod\n\n return ret\n\n\n\nprint((rec(S)))\n", "target": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n if x >= 3:\n\n return (rec(x-1)+rec(x-3))%mod\n\n else:\n\n return 0\n\n\n\nprint((rec(S)))\n", "code_v0_loc": 32, "code_v1_loc": 32, "code_v0_num_chars": 996, "code_v1_num_chars": 996, "code_v0_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n product,\n groupby,\n combinations_with_replacement,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nS = INT()\n\n\n@lru_cache(maxsize=None)\ndef rec(x):\n if x == 0:\n return 1\n ret = 0\n for i in range(x - 2):\n ret += rec(i)\n ret %= mod\n return ret\n\n\nprint((rec(S)))\n", "code_v1_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n product,\n groupby,\n combinations_with_replacement,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nS = INT()\n\n\n@lru_cache(maxsize=None)\ndef rec(x):\n if x == 0:\n return 1\n ret = 0\n if x >= 3:\n return (rec(x - 1) + rec(x - 3)) % mod\n else:\n return 0\n\n\nprint((rec(S)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- for i in range(x - 2):", "- ret += rec(i)", "- ret %= mod", "- return ret", "+ if x >= 3:", "+ return (rec(x - 1) + rec(x - 3)) % mod", "+ else:", "+ return 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4423550682, "measured_runtime_v1": 0.2103828435, "runtime_lift": 2.1026194952, "key": ["s706729835", "s005580579"]} +{"user_id": "u254871849", "problem_id": "p03037", "language": "python", "submission_id_v0": "s133611442", "submission_id_v1": "s023877292", "cpu_time_v0": 105, "cpu_time_v1": 71, "memory_v0": 25076, "memory_v1": 25076, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.38, "input": "import sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nlr = list(zip(*[iter(lr)] * 2))\n\n\n\ndef main():\n\n cnt = [0] * (n + 1)\n\n for l, r in lr:\n\n cnt[l-1] += 1\n\n cnt[r] -= 1\n\n \n\n for i in range(n):\n\n cnt[i+1] += cnt[i]\n\n \n\n res = 0\n\n for i in range(n):\n\n res += (cnt[i] == m) & 1\n\n \n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "target": "import sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nl, r = lr[::2], lr[1::2]\n\n\n\ndef main():\n\n ans = max(min(r) - max(l) + 1, 0)\n\n return ans\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 23, "code_v1_loc": 12, "code_v0_num_chars": 413, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "import sys\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\nlr = list(zip(*[iter(lr)] * 2))\n\n\ndef main():\n cnt = [0] * (n + 1)\n for l, r in lr:\n cnt[l - 1] += 1\n cnt[r] -= 1\n for i in range(n):\n cnt[i + 1] += cnt[i]\n res = 0\n for i in range(n):\n res += (cnt[i] == m) & 1\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_v1_no_empty_lines": "import sys\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\nl, r = lr[::2], lr[1::2]\n\n\ndef main():\n ans = max(min(r) - max(l) + 1, 0)\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 47.8260869565, "diff": ["-lr = list(zip(*[iter(lr)] * 2))", "+l, r = lr[::2], lr[1::2]", "- cnt = [0] * (n + 1)", "- for l, r in lr:", "- cnt[l - 1] += 1", "- cnt[r] -= 1", "- for i in range(n):", "- cnt[i + 1] += cnt[i]", "- res = 0", "- for i in range(n):", "- res += (cnt[i] == m) & 1", "- return res", "+ ans = max(min(r) - max(l) + 1, 0)", "+ return ans"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3223134096, "measured_runtime_v1": 0.2034767451, "runtime_lift": 1.5840306928, "key": ["s133611442", "s023877292"]} +{"user_id": "u633068244", "problem_id": "p01438", "language": "python", "submission_id_v0": "s057521298", "submission_id_v1": "s672157071", "cpu_time_v0": 350, "cpu_time_v1": 160, "memory_v0": 16636, "memory_v1": 11468, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.29, "input": "from collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n D = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n for s in range(s-6,e-6):\n\n t |= 1 << s\n\n D[man] = t\n\n\n\n dp = [defaultdict(int) for i in range(n)]\n\n dp[0][D[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp[i-1].keys()):\n\n if bit&D[i] == 0:\n\n dp[i][bit|D[i]] = max(dp[i][bit|D[i]], dp[i-1][bit]+L[i])\n\n dp[i][bit] = max(dp[i][bit],dp[i-1][bit])\n\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n\n \n\n ans = max(max(dp[i].values()) for i in range(n))\n\n print(ans)", "target": "from collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n T = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n t |= 2**(e-6)-2**(s-6)\n\n T[man] = t\n\n\n\n dp = defaultdict(int)\n\n dp[T[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp.keys()):\n\n if bit&T[i] == 0:\n\n dp[bit|T[i]] = max(dp[bit|T[i]], dp[bit]+L[i])\n\n dp[T[i]] = max(dp[T[i]], L[i])\n\n \n\n print(max(dp.values()))", "code_v0_loc": 27, "code_v1_loc": 24, "code_v0_num_chars": 821, "code_v1_num_chars": 646, "code_v0_no_empty_lines": "from collections import defaultdict\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n L = [0] * n\n D = [0] * n\n for man in range(n):\n m, l = list(map(int, input().split()))\n L[man] = l\n t = 0\n for date in range(m):\n s, e = list(map(int, input().split()))\n for s in range(s - 6, e - 6):\n t |= 1 << s\n D[man] = t\n dp = [defaultdict(int) for i in range(n)]\n dp[0][D[0]] = L[0]\n for i in range(1, n):\n for bit in list(dp[i - 1].keys()):\n if bit & D[i] == 0:\n dp[i][bit | D[i]] = max(dp[i][bit | D[i]], dp[i - 1][bit] + L[i])\n dp[i][bit] = max(dp[i][bit], dp[i - 1][bit])\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n ans = max(max(dp[i].values()) for i in range(n))\n print(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n L = [0] * n\n T = [0] * n\n for man in range(n):\n m, l = list(map(int, input().split()))\n L[man] = l\n t = 0\n for date in range(m):\n s, e = list(map(int, input().split()))\n t |= 2 ** (e - 6) - 2 ** (s - 6)\n T[man] = t\n dp = defaultdict(int)\n dp[T[0]] = L[0]\n for i in range(1, n):\n for bit in list(dp.keys()):\n if bit & T[i] == 0:\n dp[bit | T[i]] = max(dp[bit | T[i]], dp[bit] + L[i])\n dp[T[i]] = max(dp[T[i]], L[i])\n print(max(dp.values()))\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- D = [0] * n", "+ T = [0] * n", "- for s in range(s - 6, e - 6):", "- t |= 1 << s", "- D[man] = t", "- dp = [defaultdict(int) for i in range(n)]", "- dp[0][D[0]] = L[0]", "+ t |= 2 ** (e - 6) - 2 ** (s - 6)", "+ T[man] = t", "+ dp = defaultdict(int)", "+ dp[T[0]] = L[0]", "- for bit in list(dp[i - 1].keys()):", "- if bit & D[i] == 0:", "- dp[i][bit | D[i]] = max(dp[i][bit | D[i]], dp[i - 1][bit] + L[i])", "- dp[i][bit] = max(dp[i][bit], dp[i - 1][bit])", "- dp[i][D[i]] = max(dp[i][D[i]], L[i])", "- ans = max(max(dp[i].values()) for i in range(n))", "- print(ans)", "+ for bit in list(dp.keys()):", "+ if bit & T[i] == 0:", "+ dp[bit | T[i]] = max(dp[bit | T[i]], dp[bit] + L[i])", "+ dp[T[i]] = max(dp[T[i]], L[i])", "+ print(max(dp.values()))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0352676418, "measured_runtime_v1": 0.6319530358, "runtime_lift": 1.6382034472, "key": ["s057521298", "s672157071"]} +{"user_id": "u392319141", "problem_id": "p03208", "language": "python", "submission_id_v0": "s260498412", "submission_id_v1": "s755290756", "cpu_time_v0": 275, "cpu_time_v1": 243, "memory_v0": 7384, "memory_v1": 7484, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.64, "input": "N, K = list(map(int, input().split()))\n\n\n\nheight = []\n\nfor _ in range(N) :\n\n height.append(int(input()))\n\n\n\nheight.sort()\n\nans = float('inf')\n\n\n\nfor i in range(N-K+1) :\n\n diff = height[i + K - 1] - height[i]\n\n ans = min(ans, diff)\n\n\n\nprint(ans)", "target": "N, K = list(map(int, input().split()))\n\nH = [int(input()) for _ in range(N)]\n\nH.sort()\n\n\n\nans = 10**18\n\nfor i in range(N - K + 1):\n\n ans = min(ans, H[i + K - 1] - H[i])\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 8, "code_v0_num_chars": 247, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nheight = []\nfor _ in range(N):\n height.append(int(input()))\nheight.sort()\nans = float(\"inf\")\nfor i in range(N - K + 1):\n diff = height[i + K - 1] - height[i]\n ans = min(ans, diff)\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nH = [int(input()) for _ in range(N)]\nH.sort()\nans = 10**18\nfor i in range(N - K + 1):\n ans = min(ans, H[i + K - 1] - H[i])\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-height = []", "-for _ in range(N):", "- height.append(int(input()))", "-height.sort()", "-ans = float(\"inf\")", "+H = [int(input()) for _ in range(N)]", "+H.sort()", "+ans = 10**18", "- diff = height[i + K - 1] - height[i]", "- ans = min(ans, diff)", "+ ans = min(ans, H[i + K - 1] - H[i])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2545773742, "measured_runtime_v1": 0.0892174052, "runtime_lift": 2.8534496549, "key": ["s260498412", "s755290756"]} +{"user_id": "u380524497", "problem_id": "p03032", "language": "python", "submission_id_v0": "s669893633", "submission_id_v1": "s465849215", "cpu_time_v0": 57, "cpu_time_v1": 34, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.35, "input": "from collections import deque\n\n\n\nn, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor t in range(k//2 + 1):\n\n hand = deque(V[:k-t])\n\n rest = deque(V[k-t:])\n\n cur_sum = sum(hand)\n\n\n\n for j in range(k-t+1):\n\n put_back = 0\n\n rev_hand = sorted(hand)\n\n\n\n for i in range(t):\n\n jewel = rev_hand[i]\n\n if jewel < 0:\n\n put_back -= jewel\n\n else:\n\n break\n\n\n\n candidate = cur_sum + put_back\n\n ans = max(candidate, ans)\n\n\n\n to_rest = hand.pop()\n\n rest.appendleft(to_rest)\n\n to_hand = rest.pop()\n\n hand.appendleft(to_hand)\n\n\n\n cur_sum += to_hand - to_rest\n\n\n\nprint(ans)", "target": "n, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\n\n\ndef get_jewelries(box, left_pop, right_pop):\n\n if left_pop + right_pop >= len(box):\n\n return box[:]\n\n\n\n left = box[:left_pop]\n\n right = box[-right_pop:] if right_pop else []\n\n\n\n return left + right\n\n\n\n\n\ncandidates = []\n\npop_max = min(k, n)\n\nfor pop_count in range(pop_max+1):\n\n residue = k - pop_count\n\n\n\n for left_pop in range(pop_count+1):\n\n right_pop = pop_count - left_pop\n\n jewelries = get_jewelries(V, left_pop, right_pop)\n\n jewelries.sort(reverse=True)\n\n\n\n for _ in range(residue):\n\n if not jewelries:\n\n break\n\n if jewelries[-1] < 0:\n\n jewelries.pop()\n\n\n\n value = sum(jewelries)\n\n candidates.append(value)\n\n\n\nprint((max(candidates)))\n", "code_v0_loc": 33, "code_v1_loc": 34, "code_v0_num_chars": 732, "code_v1_num_chars": 833, "code_v0_no_empty_lines": "from collections import deque\n\nn, k = list(map(int, input().split()))\nV = list(map(int, input().split()))\nans = 0\nfor t in range(k // 2 + 1):\n hand = deque(V[: k - t])\n rest = deque(V[k - t :])\n cur_sum = sum(hand)\n for j in range(k - t + 1):\n put_back = 0\n rev_hand = sorted(hand)\n for i in range(t):\n jewel = rev_hand[i]\n if jewel < 0:\n put_back -= jewel\n else:\n break\n candidate = cur_sum + put_back\n ans = max(candidate, ans)\n to_rest = hand.pop()\n rest.appendleft(to_rest)\n to_hand = rest.pop()\n hand.appendleft(to_hand)\n cur_sum += to_hand - to_rest\nprint(ans)\n", "code_v1_no_empty_lines": "n, k = list(map(int, input().split()))\nV = list(map(int, input().split()))\n\n\ndef get_jewelries(box, left_pop, right_pop):\n if left_pop + right_pop >= len(box):\n return box[:]\n left = box[:left_pop]\n right = box[-right_pop:] if right_pop else []\n return left + right\n\n\ncandidates = []\npop_max = min(k, n)\nfor pop_count in range(pop_max + 1):\n residue = k - pop_count\n for left_pop in range(pop_count + 1):\n right_pop = pop_count - left_pop\n jewelries = get_jewelries(V, left_pop, right_pop)\n jewelries.sort(reverse=True)\n for _ in range(residue):\n if not jewelries:\n break\n if jewelries[-1] < 0:\n jewelries.pop()\n value = sum(jewelries)\n candidates.append(value)\nprint((max(candidates)))\n", "code_same": false, "relative_loc_diff_percent": 2.9411764706, "diff": ["-from collections import deque", "-", "-ans = 0", "-for t in range(k // 2 + 1):", "- hand = deque(V[: k - t])", "- rest = deque(V[k - t :])", "- cur_sum = sum(hand)", "- for j in range(k - t + 1):", "- put_back = 0", "- rev_hand = sorted(hand)", "- for i in range(t):", "- jewel = rev_hand[i]", "- if jewel < 0:", "- put_back -= jewel", "- else:", "+", "+", "+def get_jewelries(box, left_pop, right_pop):", "+ if left_pop + right_pop >= len(box):", "+ return box[:]", "+ left = box[:left_pop]", "+ right = box[-right_pop:] if right_pop else []", "+ return left + right", "+", "+", "+candidates = []", "+pop_max = min(k, n)", "+for pop_count in range(pop_max + 1):", "+ residue = k - pop_count", "+ for left_pop in range(pop_count + 1):", "+ right_pop = pop_count - left_pop", "+ jewelries = get_jewelries(V, left_pop, right_pop)", "+ jewelries.sort(reverse=True)", "+ for _ in range(residue):", "+ if not jewelries:", "- candidate = cur_sum + put_back", "- ans = max(candidate, ans)", "- to_rest = hand.pop()", "- rest.appendleft(to_rest)", "- to_hand = rest.pop()", "- hand.appendleft(to_hand)", "- cur_sum += to_hand - to_rest", "-print(ans)", "+ if jewelries[-1] < 0:", "+ jewelries.pop()", "+ value = sum(jewelries)", "+ candidates.append(value)", "+print((max(candidates)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2830656636, "measured_runtime_v1": 0.1950679789, "runtime_lift": 1.4511129157, "key": ["s669893633", "s465849215"]} +{"user_id": "u227082700", "problem_id": "p02863", "language": "python", "submission_id_v0": "s340691380", "submission_id_v1": "s390961057", "cpu_time_v0": 541, "cpu_time_v1": 362, "memory_v0": 216520, "memory_v1": 217248, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.09, "input": "n,t=list(map(int,input().split()))\n\nab=[list(map(int,input().split()))for _ in range(n)]\n\nab.sort()\n\ndp=[(6007)*[0]for _ in range(n+1)]\n\ndp[0][0]=0\n\nans=0\n\nfor i in range(n):\n\n for j in range(6007):\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\n if j>= 1\n\n return r\n\n\n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\n\n\nm = 0\n\nl = (1 << n) - 1\n\nfor x in range(1, l + 1):\n\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n\n m = max(m, popcount(x))\n\nprint(m)\n", "target": "from itertools import combinations\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [(set(), set()) for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y].add(x - 1)\n\n \n\nfail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)\n\n \n\nwhile all(map(fail, list(map(set, combinations(r, n))))):\n\n n -= 1\n\nprint(n)", "code_v0_loc": 22, "code_v1_loc": 15, "code_v0_num_chars": 430, "code_v1_num_chars": 365, "code_v0_no_empty_lines": "def popcount(x):\n r = 0\n while x:\n if x & 1:\n r += 1\n x >>= 1\n return r\n\n\nn = int(input())\nr = list(range(n))\na = [[0, 0] for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y] |= 1 << (x - 1)\nm = 0\nl = (1 << n) - 1\nfor x in range(1, l + 1):\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n m = max(m, popcount(x))\nprint(m)\n", "code_v1_no_empty_lines": "from itertools import combinations\n\nn = int(input())\nr = list(range(n))\na = [(set(), set()) for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y].add(x - 1)\nfail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)\nwhile all(map(fail, list(map(set, combinations(r, n))))):\n n -= 1\nprint(n)\n", "code_same": false, "relative_loc_diff_percent": 31.8181818182, "diff": ["-def popcount(x):", "- r = 0", "- while x:", "- if x & 1:", "- r += 1", "- x >>= 1", "- return r", "-", "+from itertools import combinations", "-a = [[0, 0] for _ in r]", "+a = [(set(), set()) for _ in r]", "- a[i][y] |= 1 << (x - 1)", "-m = 0", "-l = (1 << n) - 1", "-for x in range(1, l + 1):", "- if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):", "- m = max(m, popcount(x))", "-print(m)", "+ a[i][y].add(x - 1)", "+fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)", "+while all(map(fail, list(map(set, combinations(r, n))))):", "+ n -= 1", "+print(n)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2279194756, "measured_runtime_v1": 0.0067682672, "runtime_lift": 33.6747161436, "key": ["s475579950", "s165212154"]} +{"user_id": "u893063840", "problem_id": "p03039", "language": "python", "submission_id_v0": "s835548762", "submission_id_v1": "s860519661", "cpu_time_v0": 1667, "cpu_time_v1": 328, "memory_v0": 85236, "memory_v1": 18804, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.32, "input": "n, m, k = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\nMAX = n * m\n\n\n\n\n\nclass ModInt:\n\n def __init__(self, num):\n\n self.num = num\n\n\n\n def __str__(self):\n\n return str(self.num)\n\n\n\n def __repr__(self):\n\n return \"ModInt(num: {}, mod: {}\".format(self.num, mod)\n\n\n\n def __add__(self, other):\n\n ret = self.num + other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __sub__(self, other):\n\n ret = self.num - other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __mul__(self, other):\n\n ret = self.num * other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def pow(self, times):\n\n pw = pow(self.num, times, mod)\n\n return ModInt(pw)\n\n\n\n def inverse(self):\n\n return ModInt(inv[self.num])\n\n\n\n def __truediv__(self, other):\n\n num = self * other.inverse()\n\n return ModInt(num)\n\n\n\n\n\ndef comb(n, k):\n\n return fact[n] * inv[n-k] * inv[k]\n\n\n\n\n\nfact = [None] * (MAX + 1)\n\nfact[0] = ModInt(1)\n\nfor i in range(1, MAX + 1):\n\n fact[i] = fact[i-1] * ModInt(i)\n\n\n\ninv = [None] * (MAX + 1)\n\ninv[MAX] = fact[MAX].pow(mod - 2)\n\nfor i in range(MAX, 0, -1):\n\n inv[i-1] = inv[i] * ModInt(i)\n\n\n\nans = ModInt(0)\n\nfor i in range(n):\n\n for j in range(m):\n\n add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)\n\n if i != 0 and j != 0:\n\n add *= ModInt(2)\n\n\n\n ans += add\n\n\n\nans *= comb(n * m - 2, k - 2)\n\nprint(ans)\n", "target": "n, m, k = list(map(int, input().split()))\n\n\n\nmod = 10 ** 9 + 7\n\nMAX = n * m\n\n\n\nfact = [1] * (MAX + 1)\n\nfor i in range(1, MAX + 1):\n\n fact[i] = (fact[i-1] * i) % mod\n\n\n\ninv = [1] * (MAX + 1)\n\ninv[MAX] = pow(fact[MAX], mod - 2, mod)\n\nfor i in range(MAX, 0, -1):\n\n inv[i-1] = (inv[i] * i) % mod\n\n\n\n\n\ndef comb(n, k):\n\n return fact[n] * inv[n-k] * inv[k] % mod\n\n\n\n\n\nans = 0\n\nfor i in range(n):\n\n for j in range(m):\n\n add = (n - i) * (m - j) * (i + j) % mod\n\n if i != 0 and j != 0:\n\n add *= 2\n\n add %= mod\n\n\n\n ans += add\n\n ans %= mod\n\n\n\nans *= comb(MAX - 2, k - 2)\n\nans %= mod\n\nprint(ans)\n", "code_v0_loc": 67, "code_v1_loc": 33, "code_v0_num_chars": 1460, "code_v1_num_chars": 639, "code_v0_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nMAX = n * m\n\n\nclass ModInt:\n def __init__(self, num):\n self.num = num\n\n def __str__(self):\n return str(self.num)\n\n def __repr__(self):\n return \"ModInt(num: {}, mod: {}\".format(self.num, mod)\n\n def __add__(self, other):\n ret = self.num + other.num\n ret %= mod\n return ModInt(ret)\n\n def __sub__(self, other):\n ret = self.num - other.num\n ret %= mod\n return ModInt(ret)\n\n def __mul__(self, other):\n ret = self.num * other.num\n ret %= mod\n return ModInt(ret)\n\n def pow(self, times):\n pw = pow(self.num, times, mod)\n return ModInt(pw)\n\n def inverse(self):\n return ModInt(inv[self.num])\n\n def __truediv__(self, other):\n num = self * other.inverse()\n return ModInt(num)\n\n\ndef comb(n, k):\n return fact[n] * inv[n - k] * inv[k]\n\n\nfact = [None] * (MAX + 1)\nfact[0] = ModInt(1)\nfor i in range(1, MAX + 1):\n fact[i] = fact[i - 1] * ModInt(i)\ninv = [None] * (MAX + 1)\ninv[MAX] = fact[MAX].pow(mod - 2)\nfor i in range(MAX, 0, -1):\n inv[i - 1] = inv[i] * ModInt(i)\nans = ModInt(0)\nfor i in range(n):\n for j in range(m):\n add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)\n if i != 0 and j != 0:\n add *= ModInt(2)\n ans += add\nans *= comb(n * m - 2, k - 2)\nprint(ans)\n", "code_v1_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nMAX = n * m\nfact = [1] * (MAX + 1)\nfor i in range(1, MAX + 1):\n fact[i] = (fact[i - 1] * i) % mod\ninv = [1] * (MAX + 1)\ninv[MAX] = pow(fact[MAX], mod - 2, mod)\nfor i in range(MAX, 0, -1):\n inv[i - 1] = (inv[i] * i) % mod\n\n\ndef comb(n, k):\n return fact[n] * inv[n - k] * inv[k] % mod\n\n\nans = 0\nfor i in range(n):\n for j in range(m):\n add = (n - i) * (m - j) * (i + j) % mod\n if i != 0 and j != 0:\n add *= 2\n add %= mod\n ans += add\n ans %= mod\nans *= comb(MAX - 2, k - 2)\nans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.7462686567, "diff": ["-", "-", "-class ModInt:", "- def __init__(self, num):", "- self.num = num", "-", "- def __str__(self):", "- return str(self.num)", "-", "- def __repr__(self):", "- return \"ModInt(num: {}, mod: {}\".format(self.num, mod)", "-", "- def __add__(self, other):", "- ret = self.num + other.num", "- ret %= mod", "- return ModInt(ret)", "-", "- def __sub__(self, other):", "- ret = self.num - other.num", "- ret %= mod", "- return ModInt(ret)", "-", "- def __mul__(self, other):", "- ret = self.num * other.num", "- ret %= mod", "- return ModInt(ret)", "-", "- def pow(self, times):", "- pw = pow(self.num, times, mod)", "- return ModInt(pw)", "-", "- def inverse(self):", "- return ModInt(inv[self.num])", "-", "- def __truediv__(self, other):", "- num = self * other.inverse()", "- return ModInt(num)", "+fact = [1] * (MAX + 1)", "+for i in range(1, MAX + 1):", "+ fact[i] = (fact[i - 1] * i) % mod", "+inv = [1] * (MAX + 1)", "+inv[MAX] = pow(fact[MAX], mod - 2, mod)", "+for i in range(MAX, 0, -1):", "+ inv[i - 1] = (inv[i] * i) % mod", "- return fact[n] * inv[n - k] * inv[k]", "+ return fact[n] * inv[n - k] * inv[k] % mod", "-fact = [None] * (MAX + 1)", "-fact[0] = ModInt(1)", "-for i in range(1, MAX + 1):", "- fact[i] = fact[i - 1] * ModInt(i)", "-inv = [None] * (MAX + 1)", "-inv[MAX] = fact[MAX].pow(mod - 2)", "-for i in range(MAX, 0, -1):", "- inv[i - 1] = inv[i] * ModInt(i)", "-ans = ModInt(0)", "+ans = 0", "- add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)", "+ add = (n - i) * (m - j) * (i + j) % mod", "- add *= ModInt(2)", "+ add *= 2", "+ add %= mod", "-ans *= comb(n * m - 2, k - 2)", "+ ans %= mod", "+ans *= comb(MAX - 2, k - 2)", "+ans %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0146762717, "measured_runtime_v1": 0.4959636457, "runtime_lift": 2.0458682415, "key": ["s835548762", "s860519661"]} +{"user_id": "u644907318", "problem_id": "p03241", "language": "python", "submission_id_v0": "s205255104", "submission_id_v1": "s496579949", "cpu_time_v0": 180, "cpu_time_v1": 73, "memory_v0": 38640, "memory_v1": 63824, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.44, "input": "N,M = list(map(int,input().split()))\n\nif N==1:\n\n nmax=M\n\nelse:\n\n nmax = 1\n\n for i in range(2,int(M**0.5)+1):\n\n if M%i==0 and M//i>=N:\n\n nmax = max(nmax,i)\n\n if M%i==0 and i>=N:\n\n nmax = max(nmax,M//i)\n\nprint(nmax)", "target": "N,M = list(map(int,input().split()))\n\namax = 1\n\nfor i in range(1,int(M**0.5)+1):\n\n if M%i==0:\n\n a = i\n\n b = M//i\n\n if b>=N:\n\n amax = max(amax,a)\n\n a,b = b,a\n\n if b>=N:\n\n amax = max(amax,a)\n\nprint(amax)", "code_v0_loc": 11, "code_v1_loc": 12, "code_v0_num_chars": 252, "code_v1_num_chars": 255, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nif N == 1:\n nmax = M\nelse:\n nmax = 1\n for i in range(2, int(M**0.5) + 1):\n if M % i == 0 and M // i >= N:\n nmax = max(nmax, i)\n if M % i == 0 and i >= N:\n nmax = max(nmax, M // i)\nprint(nmax)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\namax = 1\nfor i in range(1, int(M**0.5) + 1):\n if M % i == 0:\n a = i\n b = M // i\n if b >= N:\n amax = max(amax, a)\n a, b = b, a\n if b >= N:\n amax = max(amax, a)\nprint(amax)\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-if N == 1:", "- nmax = M", "-else:", "- nmax = 1", "- for i in range(2, int(M**0.5) + 1):", "- if M % i == 0 and M // i >= N:", "- nmax = max(nmax, i)", "- if M % i == 0 and i >= N:", "- nmax = max(nmax, M // i)", "-print(nmax)", "+amax = 1", "+for i in range(1, int(M**0.5) + 1):", "+ if M % i == 0:", "+ a = i", "+ b = M // i", "+ if b >= N:", "+ amax = max(amax, a)", "+ a, b = b, a", "+ if b >= N:", "+ amax = max(amax, a)", "+print(amax)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3445633175, "measured_runtime_v1": 0.2717220852, "runtime_lift": 1.26807255, "key": ["s205255104", "s496579949"]} +{"user_id": "u543954314", "problem_id": "p02596", "language": "python", "submission_id_v0": "s410919516", "submission_id_v1": "s753895766", "cpu_time_v0": 302, "cpu_time_v1": 127, "memory_v0": 114648, "memory_v1": 9196, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.95, "input": "import sys\n\n\n\nreadline = sys.stdin.readline\n\nreadall = sys.stdin.read\n\nns = lambda: readline().rstrip()\n\nni = lambda: int(readline().rstrip())\n\nnm = lambda: map(int, readline().split())\n\nnl = lambda: list(map(int, readline().split()))\n\nprn = lambda x: print(*x, sep='\\n')\n\n\n\ndef solve():\n\n d = dict()\n\n k = ni()\n\n c = 7 % k\n\n x = d[c] = 1\n\n while True:\n\n c = (c * 10 + 7) % k\n\n if c in d:\n\n break\n\n x += 1\n\n d[c] = x\n\n print(d.get(0, -1))\n\n return\n\n\n\nsolve()\n", "target": "import sys\n\n\n\nreadline = sys.stdin.readline\n\nreadall = sys.stdin.read\n\nns = lambda: readline().rstrip()\n\nni = lambda: int(readline().rstrip())\n\nnm = lambda: map(int, readline().split())\n\nnl = lambda: list(map(int, readline().split()))\n\nprn = lambda x: print(*x, sep='\\n')\n\n\n\ndef solve():\n\n k = ni()\n\n c = 0\n\n for i in range(k):\n\n c = (c * 10 + 7) % k\n\n if c == 0:\n\n print(i+1)\n\n break\n\n else:\n\n print(-1)\n\n return\n\n\n\nsolve()\n", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 519, "code_v1_num_chars": 483, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nreadall = sys.stdin.read\nns = lambda: readline().rstrip()\nni = lambda: int(readline().rstrip())\nnm = lambda: map(int, readline().split())\nnl = lambda: list(map(int, readline().split()))\nprn = lambda x: print(*x, sep=\"\\n\")\n\n\ndef solve():\n d = dict()\n k = ni()\n c = 7 % k\n x = d[c] = 1\n while True:\n c = (c * 10 + 7) % k\n if c in d:\n break\n x += 1\n d[c] = x\n print(d.get(0, -1))\n return\n\n\nsolve()\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nreadall = sys.stdin.read\nns = lambda: readline().rstrip()\nni = lambda: int(readline().rstrip())\nnm = lambda: map(int, readline().split())\nnl = lambda: list(map(int, readline().split()))\nprn = lambda x: print(*x, sep=\"\\n\")\n\n\ndef solve():\n k = ni()\n c = 0\n for i in range(k):\n c = (c * 10 + 7) % k\n if c == 0:\n print(i + 1)\n break\n else:\n print(-1)\n return\n\n\nsolve()\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- d = dict()", "- c = 7 % k", "- x = d[c] = 1", "- while True:", "+ c = 0", "+ for i in range(k):", "- if c in d:", "+ if c == 0:", "+ print(i + 1)", "- x += 1", "- d[c] = x", "- print(d.get(0, -1))", "+ else:", "+ print(-1)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7691566973, "measured_runtime_v1": 0.3673865876, "runtime_lift": 2.0935894863, "key": ["s410919516", "s753895766"]} +{"user_id": "u561083515", "problem_id": "p02959", "language": "python", "submission_id_v0": "s872669573", "submission_id_v1": "s116182226", "cpu_time_v0": 274, "cpu_time_v1": 160, "memory_v0": 73316, "memory_v1": 19648, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 41.61, "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nN = int(input())\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\nbefore = sum(A)\n\n\n\nfor i in range(N):\n\n nokori = B[i]\n\n for j in range(i,i+2):\n\n if nokori >= A[j]:\n\n nokori -= A[j]\n\n A[j] = 0\n\n else:\n\n A[j] -= nokori\n\n nokori = 0\n\nafter = sum(A)\n\n\n\nprint((before - after))", "target": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\n\n\ncnt = 0\n\nfor i in range(N):\n\n if B[i] >= A[i]:\n\n cnt += A[i]\n\n B[i] -= A[i]\n\n else:\n\n cnt += B[i]\n\n B[i] = 0\n\n if B[i] == 0:\n\n continue\n\n if B[i] >= A[i+1]:\n\n cnt += A[i+1]\n\n A[i+1] = 0\n\n else:\n\n cnt += B[i]\n\n A[i+1] -= B[i]\n\n\n\nprint(cnt)", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 440, "code_v1_num_chars": 414, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nN = int(input())\nA = [int(i) for i in input().split()]\nB = [int(i) for i in input().split()]\nbefore = sum(A)\nfor i in range(N):\n nokori = B[i]\n for j in range(i, i + 2):\n if nokori >= A[j]:\n nokori -= A[j]\n A[j] = 0\n else:\n A[j] -= nokori\n nokori = 0\nafter = sum(A)\nprint((before - after))\n", "code_v1_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nB = [int(i) for i in input().split()]\ncnt = 0\nfor i in range(N):\n if B[i] >= A[i]:\n cnt += A[i]\n B[i] -= A[i]\n else:\n cnt += B[i]\n B[i] = 0\n if B[i] == 0:\n continue\n if B[i] >= A[i + 1]:\n cnt += A[i + 1]\n A[i + 1] = 0\n else:\n cnt += B[i]\n A[i + 1] -= B[i]\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-sys.setrecursionlimit(10**7)", "-before = sum(A)", "+cnt = 0", "- nokori = B[i]", "- for j in range(i, i + 2):", "- if nokori >= A[j]:", "- nokori -= A[j]", "- A[j] = 0", "- else:", "- A[j] -= nokori", "- nokori = 0", "-after = sum(A)", "-print((before - after))", "+ if B[i] >= A[i]:", "+ cnt += A[i]", "+ B[i] -= A[i]", "+ else:", "+ cnt += B[i]", "+ B[i] = 0", "+ if B[i] == 0:", "+ continue", "+ if B[i] >= A[i + 1]:", "+ cnt += A[i + 1]", "+ A[i + 1] = 0", "+ else:", "+ cnt += B[i]", "+ A[i + 1] -= B[i]", "+print(cnt)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3369382279, "measured_runtime_v1": 0.0062937415, "runtime_lift": 53.5354413986, "key": ["s872669573", "s116182226"]} +{"user_id": "u144913062", "problem_id": "p03457", "language": "python", "submission_id_v0": "s956976175", "submission_id_v1": "s285518014", "cpu_time_v0": 628, "cpu_time_v1": 555, "memory_v0": 62040, "memory_v1": 46056, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.62, "input": "N = int(input())\n\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\n\nfor i in range(N):\n\n t1, x1, y1 = txy[i]\n\n t2, x2, y2 = txy[i+1]\n\n if abs(x2-x1) + abs(y2-y1) <= t2 - t1 and (x1+y1+x2+y2) % 2 == (t2-t1) % 2:\n\n continue\n\n else:\n\n print('No')\n\n exit()\n\nprint('Yes')", "target": "N = int(input())\n\nt0 = x0 = y0 = 0\n\nfor _ in range(N):\n\n t1, x1, y1 = list(map(int, input().split()))\n\n d = abs(x1 - x0) + abs(y1 - y0)\n\n if d > t1 - t0 or d % 2 != (t1 - t0) % 2:\n\n print('No')\n\n exit()\n\n t0, x0, y0 = t1, x1, y1\n\nprint('Yes')\n", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 323, "code_v1_num_chars": 263, "code_v0_no_empty_lines": "N = int(input())\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\nfor i in range(N):\n t1, x1, y1 = txy[i]\n t2, x2, y2 = txy[i + 1]\n if (\n abs(x2 - x1) + abs(y2 - y1) <= t2 - t1\n and (x1 + y1 + x2 + y2) % 2 == (t2 - t1) % 2\n ):\n continue\n else:\n print(\"No\")\n exit()\nprint(\"Yes\")\n", "code_v1_no_empty_lines": "N = int(input())\nt0 = x0 = y0 = 0\nfor _ in range(N):\n t1, x1, y1 = list(map(int, input().split()))\n d = abs(x1 - x0) + abs(y1 - y0)\n if d > t1 - t0 or d % 2 != (t1 - t0) % 2:\n print(\"No\")\n exit()\n t0, x0, y0 = t1, x1, y1\nprint(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-txy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]", "-for i in range(N):", "- t1, x1, y1 = txy[i]", "- t2, x2, y2 = txy[i + 1]", "- if (", "- abs(x2 - x1) + abs(y2 - y1) <= t2 - t1", "- and (x1 + y1 + x2 + y2) % 2 == (t2 - t1) % 2", "- ):", "- continue", "- else:", "+t0 = x0 = y0 = 0", "+for _ in range(N):", "+ t1, x1, y1 = list(map(int, input().split()))", "+ d = abs(x1 - x0) + abs(y1 - y0)", "+ if d > t1 - t0 or d % 2 != (t1 - t0) % 2:", "+ t0, x0, y0 = t1, x1, y1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3724059272, "measured_runtime_v1": 0.2797260373, "runtime_lift": 1.3313237867, "key": ["s956976175", "s285518014"]} +{"user_id": "u227082700", "problem_id": "p02834", "language": "python", "submission_id_v0": "s854767798", "submission_id_v1": "s662268715", "cpu_time_v0": 780, "cpu_time_v1": 670, "memory_v0": 84508, "memory_v1": 38312, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.1, "input": "n,u,v=list(map(int,input().split()))\n\nanss=0\n\nu-=1\n\nv-=1\n\nd=[[]for _ in range(n)]\n\ninf=float('inf')\n\naoki=[inf]*n\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n d[a].append(b)\n\n d[b].append(a)\n\nQ=d[v]\n\naoki[v]=0\n\ndis=1\n\nvisited={v}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n aoki[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[u]\n\nchokudai=[-1]*n\n\nchokudai[u]=0\n\ndis=1\n\nvisited={u}\n\npoint=-1\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if aoki[j]<=dis+1:\n\n if aoki[j]==dis+1:anss=1\n\n if point<0:point=i\n\n continue\n\n if j not in visited:P.append(j)\n\n chokudai[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[point]\n\ndis=chokudai[point]+1\n\nvisited={point}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n if chokudai[i]==-1:continue\n\n chokudai[i]=max(dis,chokudai[i])\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n dis+=1\n\n Q=P\n\nans=0\n\nfor i in range(n):\n\n if aoki[i]>chokudai[i]:ans=max(ans,chokudai[i])\n\nprint((ans+anss))\n\n#print(aoki)\n\n#print(chokudai)", "target": "n,u,v=list(map(int,input().split()))\n\nu-=1\n\nv-=1\n\ne=[[]for _ in range(n)]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n e[a].append(b)\n\n e[b].append(a)\n\ncho=[u]\n\ncho_dis=[10**7]*n\n\ncho_dis[u]=0\n\ncho_visited={u}\n\ncountt=1\n\nwhile cho:\n\n CHO=[]\n\n for i in cho:\n\n for j in e[i]:\n\n if j in cho_visited:continue\n\n cho_visited.add(j)\n\n CHO.append(j)\n\n cho_dis[j]=countt\n\n countt+=1\n\n cho=CHO\n\naok=[v]\n\naok_dis=[10**7]*n\n\naok_dis[v]=0\n\naok_visited={v}\n\ncountt=1\n\nwhile aok:\n\n AOK=[]\n\n for i in aok:\n\n for j in e[i]:\n\n if j in aok_visited:continue\n\n aok_visited.add(j)\n\n AOK.append(j)\n\n aok_dis[j]=countt\n\n countt+=1\n\n aok=AOK\n\nans=0\n\nfor i in range(n):\n\n if cho_dis[i] chokudai[i]:\n ans = max(ans, chokudai[i])\nprint((ans + anss))\n# print(aoki)\n# print(chokudai)\n", "code_v1_no_empty_lines": "n, u, v = list(map(int, input().split()))\nu -= 1\nv -= 1\ne = [[] for _ in range(n)]\nfor i in range(n - 1):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n e[a].append(b)\n e[b].append(a)\ncho = [u]\ncho_dis = [10**7] * n\ncho_dis[u] = 0\ncho_visited = {u}\ncountt = 1\nwhile cho:\n CHO = []\n for i in cho:\n for j in e[i]:\n if j in cho_visited:\n continue\n cho_visited.add(j)\n CHO.append(j)\n cho_dis[j] = countt\n countt += 1\n cho = CHO\naok = [v]\naok_dis = [10**7] * n\naok_dis[v] = 0\naok_visited = {v}\ncountt = 1\nwhile aok:\n AOK = []\n for i in aok:\n for j in e[i]:\n if j in aok_visited:\n continue\n aok_visited.add(j)\n AOK.append(j)\n aok_dis[j] = countt\n countt += 1\n aok = AOK\nans = 0\nfor i in range(n):\n if cho_dis[i] < aok_dis[i]:\n ans = max(ans, aok_dis[i] - 1)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 31.25, "diff": ["-anss = 0", "-d = [[] for _ in range(n)]", "-inf = float(\"inf\")", "-aoki = [inf] * n", "+e = [[] for _ in range(n)]", "- d[a].append(b)", "- d[b].append(a)", "-Q = d[v]", "-aoki[v] = 0", "-dis = 1", "-visited = {v}", "-while Q:", "- P = []", "- for i in Q:", "- visited.add(i)", "- for j in d[i]:", "- if j not in visited:", "- P.append(j)", "- aoki[i] = dis", "- dis += 1", "- Q = P", "-Q = d[u]", "-chokudai = [-1] * n", "-chokudai[u] = 0", "-dis = 1", "-visited = {u}", "-point = -1", "-while Q:", "- P = []", "- for i in Q:", "- visited.add(i)", "- for j in d[i]:", "- if aoki[j] <= dis + 1:", "- if aoki[j] == dis + 1:", "- anss = 1", "- if point < 0:", "- point = i", "+ e[a].append(b)", "+ e[b].append(a)", "+cho = [u]", "+cho_dis = [10**7] * n", "+cho_dis[u] = 0", "+cho_visited = {u}", "+countt = 1", "+while cho:", "+ CHO = []", "+ for i in cho:", "+ for j in e[i]:", "+ if j in cho_visited:", "- if j not in visited:", "- P.append(j)", "- chokudai[i] = dis", "- dis += 1", "- Q = P", "-Q = d[point]", "-dis = chokudai[point] + 1", "-visited = {point}", "-while Q:", "- P = []", "- for i in Q:", "- visited.add(i)", "- if chokudai[i] == -1:", "- continue", "- chokudai[i] = max(dis, chokudai[i])", "- for j in d[i]:", "- if j not in visited:", "- P.append(j)", "- dis += 1", "- Q = P", "+ cho_visited.add(j)", "+ CHO.append(j)", "+ cho_dis[j] = countt", "+ countt += 1", "+ cho = CHO", "+aok = [v]", "+aok_dis = [10**7] * n", "+aok_dis[v] = 0", "+aok_visited = {v}", "+countt = 1", "+while aok:", "+ AOK = []", "+ for i in aok:", "+ for j in e[i]:", "+ if j in aok_visited:", "+ continue", "+ aok_visited.add(j)", "+ AOK.append(j)", "+ aok_dis[j] = countt", "+ countt += 1", "+ aok = AOK", "- if aoki[i] > chokudai[i]:", "- ans = max(ans, chokudai[i])", "-print((ans + anss))", "-# print(aoki)", "-# print(chokudai)", "+ if cho_dis[i] < aok_dis[i]:", "+ ans = max(ans, aok_dis[i] - 1)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2686464586, "measured_runtime_v1": 0.0699197628, "runtime_lift": 3.842210666, "key": ["s854767798", "s662268715"]} +{"user_id": "u729133443", "problem_id": "p02537", "language": "python", "submission_id_v0": "s897150427", "submission_id_v1": "s003067542", "cpu_time_v0": 1389, "cpu_time_v1": 1137, "memory_v0": 275544, "memory_v1": 157144, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.14, "input": "d=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()+d))\n\nfor i in range(n):d[i]=max(d[j]for j in range(i-99,i+1)if abs(a[i]-a[j])<=k)+1\n\nprint((max(d)))", "target": "d=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()))\n\na=d+a\n\nwhile n:d[n]=max(d[j]for j in range(n,n+99)if abs(a[-n]-a[-j])<=k)+1;n-=1\n\nprint((max(d)))", "code_v0_loc": 4, "code_v1_loc": 5, "code_v0_num_chars": 147, "code_v1_num_chars": 147, "code_v0_no_empty_lines": "d = [0] * 6**8\nn, k, *a = list(map(int, open(0).read().split() + d))\nfor i in range(n):\n d[i] = max(d[j] for j in range(i - 99, i + 1) if abs(a[i] - a[j]) <= k) + 1\nprint((max(d)))\n", "code_v1_no_empty_lines": "d = [0] * 6**8\nn, k, *a = list(map(int, open(0).read().split()))\na = d + a\nwhile n:\n d[n] = max(d[j] for j in range(n, n + 99) if abs(a[-n] - a[-j]) <= k) + 1\n n -= 1\nprint((max(d)))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-n, k, *a = list(map(int, open(0).read().split() + d))", "-for i in range(n):", "- d[i] = max(d[j] for j in range(i - 99, i + 1) if abs(a[i] - a[j]) <= k) + 1", "+n, k, *a = list(map(int, open(0).read().split()))", "+a = d + a", "+while n:", "+ d[n] = max(d[j] for j in range(n, n + 99) if abs(a[-n] - a[-j]) <= k) + 1", "+ n -= 1"], "diff_only_import_comment": false, "measured_runtime_v0": 1.750332129, "measured_runtime_v1": 0.822091434, "runtime_lift": 2.1291209914, "key": ["s897150427", "s003067542"]} +{"user_id": "u185948224", "problem_id": "p02873", "language": "python", "submission_id_v0": "s874712614", "submission_id_v1": "s975354355", "cpu_time_v0": 481, "cpu_time_v1": 429, "memory_v0": 27676, "memory_v1": 27548, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.81, "input": "S = input()\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in range(len(lst)):\n\n if lst[i] > 0:\n\n ans += list(range(1,lst[i]+1))\n\n else:\n\n ans[-1] = max(ans[-1], -lst[i])\n\n ans += list(range(-lst[i]-1,-1, -1))\n\n\n\nprint((sum(ans)))\n", "target": "S = input()\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in lst:\n\n if i > 0:\n\n ans += list(range(1,i+1))\n\n else:\n\n ans[-1] = max(ans[-1], -i)\n\n ans += list(range(-i-1,-1, -1))\n\n\n\n\n\nprint((sum(ans)))", "code_v0_loc": 19, "code_v1_loc": 20, "code_v0_num_chars": 425, "code_v1_num_chars": 394, "code_v0_no_empty_lines": "S = input()\nlst = [1 if S[0] == \"<\" else -1]\nfor i in range(1, len(S)):\n if S[i] == S[i - 1]:\n lst[-1] += 1 if S[i] == \"<\" else -1\n else:\n lst.append(-1 if S[i] == \">\" else 1)\nans = [0]\nfor i in range(len(lst)):\n if lst[i] > 0:\n ans += list(range(1, lst[i] + 1))\n else:\n ans[-1] = max(ans[-1], -lst[i])\n ans += list(range(-lst[i] - 1, -1, -1))\nprint((sum(ans)))\n", "code_v1_no_empty_lines": "S = input()\nlst = [1 if S[0] == \"<\" else -1]\nfor i in range(1, len(S)):\n if S[i] == S[i - 1]:\n lst[-1] += 1 if S[i] == \"<\" else -1\n else:\n lst.append(-1 if S[i] == \">\" else 1)\nans = [0]\nfor i in lst:\n if i > 0:\n ans += list(range(1, i + 1))\n else:\n ans[-1] = max(ans[-1], -i)\n ans += list(range(-i - 1, -1, -1))\nprint((sum(ans)))\n", "code_same": false, "relative_loc_diff_percent": 5.0, "diff": ["-for i in range(len(lst)):", "- if lst[i] > 0:", "- ans += list(range(1, lst[i] + 1))", "+for i in lst:", "+ if i > 0:", "+ ans += list(range(1, i + 1))", "- ans[-1] = max(ans[-1], -lst[i])", "- ans += list(range(-lst[i] - 1, -1, -1))", "+ ans[-1] = max(ans[-1], -i)", "+ ans += list(range(-i - 1, -1, -1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2820563465, "measured_runtime_v1": 0.2050767321, "runtime_lift": 1.3753698122, "key": ["s874712614", "s975354355"]} +{"user_id": "u231095456", "problem_id": "p03253", "language": "python", "submission_id_v0": "s968664754", "submission_id_v1": "s390670273", "cpu_time_v0": 89, "cpu_time_v1": 32, "memory_v0": 11252, "memory_v1": 9336, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 64.04, "input": "from math import floor, sqrt\n\nfrom collections import defaultdict\n\ndef factors(n):\n\n d = defaultdict(int)\n\n for i in range(2,floor(sqrt(n))+1):\n\n while n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n if n == 1:\n\n break\n\n if n != 1:\n\n d[n] += 1\n\n return d\n\ndef inv(x, mod):\n\n k = mod - 2\n\n ret = 1\n\n while k > 0:\n\n if k&1:\n\n ret = (ret*x) % mod\n\n x = (x*x) % mod\n\n k >>= 1\n\n return ret\n\nN, M = list(map(int,input().split()))\n\nmod = 10**9+7\n\ndic = factors(M)\n\nK = len(dic)\n\nSIZE = N+max(dic.values()) if list(dic.values()) else N\n\nfact = [None]*(SIZE+1)\n\nfinv = [None]*(SIZE+1)\n\nfact[0] = 1\n\nfor i in range(1,SIZE+1):\n\n fact[i] = (fact[i-1]*i) % mod\n\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\n\nfor i in range(SIZE, 0, -1):\n\n finv[i-1] = (finv[i]*i) % mod\n\ndef comb(n,k):\n\n tmp = (finv[k]*finv[n-k]) % mod\n\n return (fact[n]*tmp) % mod\n\nans = 1\n\nfor p in dic:\n\n ans = (ans*comb(dic[p]+N-1, dic[p])) % mod\n\nprint(ans)", "target": "from math import floor, sqrt\n\nfrom collections import defaultdict\n\nN,M = list(map(int,input().split()))\n\nd = defaultdict(int)\n\nfor i in range(2, floor(sqrt(M))+1):\n\n while M % i == 0:\n\n d[i] += 1\n\n M //= i\n\nif M != 1:\n\n d[M] += 1\n\ndef comb(n,k):\n\n if k == 0:\n\n return 1\n\n return comb(n-1,k-1) * n // k\n\nans = 1\n\nfor e in list(d.values()):\n\n ans *= comb(N+e-1, e)\n\nprint((ans % (10**9+7)))", "code_v0_loc": 42, "code_v1_loc": 18, "code_v0_num_chars": 1009, "code_v1_num_chars": 410, "code_v0_no_empty_lines": "from math import floor, sqrt\nfrom collections import defaultdict\n\n\ndef factors(n):\n d = defaultdict(int)\n for i in range(2, floor(sqrt(n)) + 1):\n while n % i == 0:\n n //= i\n d[i] += 1\n if n == 1:\n break\n if n != 1:\n d[n] += 1\n return d\n\n\ndef inv(x, mod):\n k = mod - 2\n ret = 1\n while k > 0:\n if k & 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n k >>= 1\n return ret\n\n\nN, M = list(map(int, input().split()))\nmod = 10**9 + 7\ndic = factors(M)\nK = len(dic)\nSIZE = N + max(dic.values()) if list(dic.values()) else N\nfact = [None] * (SIZE + 1)\nfinv = [None] * (SIZE + 1)\nfact[0] = 1\nfor i in range(1, SIZE + 1):\n fact[i] = (fact[i - 1] * i) % mod\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\nfor i in range(SIZE, 0, -1):\n finv[i - 1] = (finv[i] * i) % mod\n\n\ndef comb(n, k):\n tmp = (finv[k] * finv[n - k]) % mod\n return (fact[n] * tmp) % mod\n\n\nans = 1\nfor p in dic:\n ans = (ans * comb(dic[p] + N - 1, dic[p])) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "from math import floor, sqrt\nfrom collections import defaultdict\n\nN, M = list(map(int, input().split()))\nd = defaultdict(int)\nfor i in range(2, floor(sqrt(M)) + 1):\n while M % i == 0:\n d[i] += 1\n M //= i\nif M != 1:\n d[M] += 1\n\n\ndef comb(n, k):\n if k == 0:\n return 1\n return comb(n - 1, k - 1) * n // k\n\n\nans = 1\nfor e in list(d.values()):\n ans *= comb(N + e - 1, e)\nprint((ans % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-", "-def factors(n):", "- d = defaultdict(int)", "- for i in range(2, floor(sqrt(n)) + 1):", "- while n % i == 0:", "- n //= i", "- d[i] += 1", "- if n == 1:", "- break", "- if n != 1:", "- d[n] += 1", "- return d", "-", "-", "-def inv(x, mod):", "- k = mod - 2", "- ret = 1", "- while k > 0:", "- if k & 1:", "- ret = (ret * x) % mod", "- x = (x * x) % mod", "- k >>= 1", "- return ret", "-", "-", "-mod = 10**9 + 7", "-dic = factors(M)", "-K = len(dic)", "-SIZE = N + max(dic.values()) if list(dic.values()) else N", "-fact = [None] * (SIZE + 1)", "-finv = [None] * (SIZE + 1)", "-fact[0] = 1", "-for i in range(1, SIZE + 1):", "- fact[i] = (fact[i - 1] * i) % mod", "-finv[SIZE] = inv(fact[SIZE], mod=mod)", "-for i in range(SIZE, 0, -1):", "- finv[i - 1] = (finv[i] * i) % mod", "+d = defaultdict(int)", "+for i in range(2, floor(sqrt(M)) + 1):", "+ while M % i == 0:", "+ d[i] += 1", "+ M //= i", "+if M != 1:", "+ d[M] += 1", "- tmp = (finv[k] * finv[n - k]) % mod", "- return (fact[n] * tmp) % mod", "+ if k == 0:", "+ return 1", "+ return comb(n - 1, k - 1) * n // k", "-for p in dic:", "- ans = (ans * comb(dic[p] + N - 1, dic[p])) % mod", "-print(ans)", "+for e in list(d.values()):", "+ ans *= comb(N + e - 1, e)", "+print((ans % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3098533685, "measured_runtime_v1": 0.2185445104, "runtime_lift": 1.4178044005, "key": ["s968664754", "s390670273"]} +{"user_id": "u118019047", "problem_id": "p03416", "language": "python", "submission_id_v0": "s640144582", "submission_id_v1": "s252292470", "cpu_time_v0": 78, "cpu_time_v1": 54, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.77, "input": "a , b = input().split()\n\na = int(a)\n\nb = int(b)\n\ncount=0\n\nfor i in range(a,b+1):\n\n test = list(str(i))\n\n if (test[0] == test[4]) and (test[1]==test[3]):\n\n count=count+1\n\nprint(count)", "target": "A,B=list(map(int,input().split()))\n\nct=0\n\nfor i in range(A,B+1):\n\n s=str(i)\n\n if s==s[::-1]:\n\n ct+=1\n\nprint(ct)", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 195, "code_v1_num_chars": 118, "code_v0_no_empty_lines": "a, b = input().split()\na = int(a)\nb = int(b)\ncount = 0\nfor i in range(a, b + 1):\n test = list(str(i))\n if (test[0] == test[4]) and (test[1] == test[3]):\n count = count + 1\nprint(count)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nct = 0\nfor i in range(A, B + 1):\n s = str(i)\n if s == s[::-1]:\n ct += 1\nprint(ct)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-a, b = input().split()", "-a = int(a)", "-b = int(b)", "-count = 0", "-for i in range(a, b + 1):", "- test = list(str(i))", "- if (test[0] == test[4]) and (test[1] == test[3]):", "- count = count + 1", "-print(count)", "+A, B = list(map(int, input().split()))", "+ct = 0", "+for i in range(A, B + 1):", "+ s = str(i)", "+ if s == s[::-1]:", "+ ct += 1", "+print(ct)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4764800201, "measured_runtime_v1": 0.3351052109, "runtime_lift": 1.4218818588, "key": ["s640144582", "s252292470"]} +{"user_id": "u562016607", "problem_id": "p03835", "language": "python", "submission_id_v0": "s390314187", "submission_id_v1": "s016239384", "cpu_time_v0": 1476, "cpu_time_v1": 282, "memory_v0": 2940, "memory_v1": 41180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.89, "input": "K,S=list(map(int,input().split()))\n\nO=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n O+=1\n\nprint(O)\n", "target": "K,S=list(map(int,input().split()))\n\nans=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n ans+=1\n\nprint(ans)\n", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 132, "code_v1_num_chars": 154, "code_v0_no_empty_lines": "K, S = list(map(int, input().split()))\nO = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if 0 <= Z <= K:\n O += 1\nprint(O)\n", "code_v1_no_empty_lines": "K, S = list(map(int, input().split()))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if 0 <= Z <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-O = 0", "+ans = 0", "- O += 1", "-print(O)", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2257852338, "measured_runtime_v1": 0.0060590109, "runtime_lift": 37.2643715379, "key": ["s390314187", "s016239384"]} +{"user_id": "u631277801", "problem_id": "p04020", "language": "python", "submission_id_v0": "s879592559", "submission_id_v1": "s107006666", "cpu_time_v0": 164, "cpu_time_v1": 99, "memory_v0": 19100, "memory_v1": 7072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.63, "input": "import sys\n\nstdin = sys.stdin\n\n \n\nsys.setrecursionlimit(10**8) \n\n \n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x)-1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\n\n\nn = ni()\n\na = [ni() for _ in range(n)]\n\n\n\ncnt = {i+1: ai for i, ai in enumerate(a)}\n\n\n\nprev = -100\n\ncur = 0\n\nans = 0\n\nfor key in sorted(cnt.keys()):\n\n if cnt[key] == 0:\n\n continue\n\n \n\n if prev == -100:\n\n prev = key\n\n \n\n if (key-prev) < 2:\n\n cur += cnt[key]\n\n else:\n\n cur = cnt[key]\n\n \n\n ans += cur // 2\n\n cur -= 2 * (cur//2)\n\n \n\n prev = key\n\n \n\nprint(ans)", "target": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\n\n\nans = 0\n\nplus = 0\n\na = [ni() for _ in range(n)]\n\n\n\nfor ai in a:\n\n ans += ((ai+plus) // 2)\n\n plus = (ai+plus) % 2 if ai > 0 else 0\n\n\n\nprint(ans)", "code_v0_loc": 41, "code_v1_loc": 25, "code_v0_num_chars": 874, "code_v1_num_chars": 607, "code_v0_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**8)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\na = [ni() for _ in range(n)]\ncnt = {i + 1: ai for i, ai in enumerate(a)}\nprev = -100\ncur = 0\nans = 0\nfor key in sorted(cnt.keys()):\n if cnt[key] == 0:\n continue\n if prev == -100:\n prev = key\n if (key - prev) < 2:\n cur += cnt[key]\n else:\n cur = cnt[key]\n ans += cur // 2\n cur -= 2 * (cur // 2)\n prev = key\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nans = 0\nplus = 0\na = [ni() for _ in range(n)]\nfor ai in a:\n ans += (ai + plus) // 2\n plus = (ai + plus) % 2 if ai > 0 else 0\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 39.0243902439, "diff": ["-sys.setrecursionlimit(10**8)", "+sys.setrecursionlimit(10**7)", "+ans = 0", "+plus = 0", "-cnt = {i + 1: ai for i, ai in enumerate(a)}", "-prev = -100", "-cur = 0", "-ans = 0", "-for key in sorted(cnt.keys()):", "- if cnt[key] == 0:", "- continue", "- if prev == -100:", "- prev = key", "- if (key - prev) < 2:", "- cur += cnt[key]", "- else:", "- cur = cnt[key]", "- ans += cur // 2", "- cur -= 2 * (cur // 2)", "- prev = key", "+for ai in a:", "+ ans += (ai + plus) // 2", "+ plus = (ai + plus) % 2 if ai > 0 else 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2743015865, "measured_runtime_v1": 0.1203746786, "runtime_lift": 2.278731621, "key": ["s879592559", "s107006666"]} +{"user_id": "u761529120", "problem_id": "p03164", "language": "python", "submission_id_v0": "s478711084", "submission_id_v1": "s154638745", "cpu_time_v0": 1151, "cpu_time_v1": 682, "memory_v0": 312192, "memory_v1": 334552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.75, "input": "def main():\n\n N, W = list(map(int, input().split()))\n\n w = [0] * N\n\n v = [0] * N\n\n for i in range(N):\n\n w[i], v[i] = list(map(int, input().split()))\n\n\n\n max_v = max(v)\n\n dp = [[float('inf')] * (max_v * N + 5) for _ in range(N + 5)]\n\n\n\n dp[0][0] = 0\n\n\n\n for i in range(N):\n\n for j in range(max_v * N):\n\n if j + v[i] <= max_v * N:\n\n dp[i+1][j + v[i]] = min(dp[i+1][j + v[i]], dp[i][j] + w[i])\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j]) \n\n\n\n ans = 0\n\n for j in range(max_v * N + 1):\n\n if dp[N][j] <= W:\n\n ans = j\n\n\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "def main():\n\n N, W = list(map(int, input().split()))\n\n weight = [0] * N\n\n value = [0] * N\n\n for i in range(N):\n\n weight[i], value[i] = list(map(int, input().split()))\n\n V = sum(value)\n\n dp = [[float('inf')] * (V + 5) for _ in range(N + 5)]\n\n dp[0][0] = 0\n\n for i in range(N):\n\n for v in range(V+1):\n\n if v - value[i] >= 0:\n\n dp[i+1][v] = min(dp[i][v-value[i]] + weight[i], dp[i][v])\n\n else:\n\n dp[i+1][v] = dp[i][v]\n\n ans = 0\n\n for v in range(V+1):\n\n if dp[N][v] <= W:\n\n ans = v\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 27, "code_v1_loc": 23, "code_v0_num_chars": 654, "code_v1_num_chars": 637, "code_v0_no_empty_lines": "def main():\n N, W = list(map(int, input().split()))\n w = [0] * N\n v = [0] * N\n for i in range(N):\n w[i], v[i] = list(map(int, input().split()))\n max_v = max(v)\n dp = [[float(\"inf\")] * (max_v * N + 5) for _ in range(N + 5)]\n dp[0][0] = 0\n for i in range(N):\n for j in range(max_v * N):\n if j + v[i] <= max_v * N:\n dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i])\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n ans = 0\n for j in range(max_v * N + 1):\n if dp[N][j] <= W:\n ans = j\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n N, W = list(map(int, input().split()))\n weight = [0] * N\n value = [0] * N\n for i in range(N):\n weight[i], value[i] = list(map(int, input().split()))\n V = sum(value)\n dp = [[float(\"inf\")] * (V + 5) for _ in range(N + 5)]\n dp[0][0] = 0\n for i in range(N):\n for v in range(V + 1):\n if v - value[i] >= 0:\n dp[i + 1][v] = min(dp[i][v - value[i]] + weight[i], dp[i][v])\n else:\n dp[i + 1][v] = dp[i][v]\n ans = 0\n for v in range(V + 1):\n if dp[N][v] <= W:\n ans = v\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 14.8148148148, "diff": ["- w = [0] * N", "- v = [0] * N", "+ weight = [0] * N", "+ value = [0] * N", "- w[i], v[i] = list(map(int, input().split()))", "- max_v = max(v)", "- dp = [[float(\"inf\")] * (max_v * N + 5) for _ in range(N + 5)]", "+ weight[i], value[i] = list(map(int, input().split()))", "+ V = sum(value)", "+ dp = [[float(\"inf\")] * (V + 5) for _ in range(N + 5)]", "- for j in range(max_v * N):", "- if j + v[i] <= max_v * N:", "- dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i])", "- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])", "+ for v in range(V + 1):", "+ if v - value[i] >= 0:", "+ dp[i + 1][v] = min(dp[i][v - value[i]] + weight[i], dp[i][v])", "+ else:", "+ dp[i + 1][v] = dp[i][v]", "- for j in range(max_v * N + 1):", "- if dp[N][j] <= W:", "- ans = j", "+ for v in range(V + 1):", "+ if dp[N][v] <= W:", "+ ans = v"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2676751952, "measured_runtime_v1": 0.1215952404, "runtime_lift": 2.2013624416, "key": ["s478711084", "s154638745"]} +{"user_id": "u812576525", "problem_id": "p03309", "language": "python", "submission_id_v0": "s649374585", "submission_id_v1": "s527849910", "cpu_time_v0": 249, "cpu_time_v1": 171, "memory_v0": 26180, "memory_v1": 30980, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 31.33, "input": "n = int(input())\n\na = list(map(int,input().split()))\n\naa = []\n\nfor i in range(n):\n\n aa.append(a[i]-(i+1))\n\nb = (sorted(aa)[n//2])\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans += abs(a[i]-(b+i+1))\n\nprint(ans)", "target": "N= int(input())\n\nA = list(map(int,input().split()))\n\n\n\nB = []\n\nfor i in range(N):\n\n B.append(A[i]-(i+1))\n\n#print(B)\n\nb= (sorted(B)[N//2])\n\n#print(b)\n\nans = 0\n\nfor i in range(N):\n\n ans += abs(B[i]-b)\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 13, "code_v0_num_chars": 205, "code_v1_num_chars": 216, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\naa = []\nfor i in range(n):\n aa.append(a[i] - (i + 1))\nb = sorted(aa)[n // 2]\nans = 0\nfor i in range(n):\n ans += abs(a[i] - (b + i + 1))\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nB = []\nfor i in range(N):\n B.append(A[i] - (i + 1))\n# print(B)\nb = sorted(B)[N // 2]\n# print(b)\nans = 0\nfor i in range(N):\n ans += abs(B[i] - b)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["-n = int(input())", "-a = list(map(int, input().split()))", "-aa = []", "-for i in range(n):", "- aa.append(a[i] - (i + 1))", "-b = sorted(aa)[n // 2]", "+N = int(input())", "+A = list(map(int, input().split()))", "+B = []", "+for i in range(N):", "+ B.append(A[i] - (i + 1))", "+# print(B)", "+b = sorted(B)[N // 2]", "+# print(b)", "-for i in range(n):", "- ans += abs(a[i] - (b + i + 1))", "+for i in range(N):", "+ ans += abs(B[i] - b)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.277994447, "measured_runtime_v1": 0.0063325391, "runtime_lift": 43.8993653214, "key": ["s649374585", "s527849910"]} +{"user_id": "u864197622", "problem_id": "p02794", "language": "python", "submission_id_v0": "s167224132", "submission_id_v1": "s245735210", "cpu_time_v0": 294, "cpu_time_v1": 228, "memory_v0": 50156, "memory_v1": 49128, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.45, "input": "N = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(input())\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\nD = {1<>= 17\n\n bc += BC[aa % (1<<17)]\n\n aa >>= 17\n\n bc += BC[aa]\n\n CC[N - 1 - bc] += (1 if BC[m%1024] + BC[m>>10] & 1 == 0 else -1)\n\n\n\nprint((sum([2 ** i * CC[i] for i in range(N)])))", "target": "N = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(input())\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\ndef popcnt(n):\n\n c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)\n\n c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)\n\n c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)\n\n c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)\n\n c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)\n\n c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)\n\n return c\n\n\n\nD = {1< DE[v]:\n t += 1 << u - 1\n u = P[u]\n elif DE[u] < DE[v]:\n t += 1 << v - 1\n v = P[v]\n else:\n t += 1 << u - 1\n t += 1 << v - 1\n u = P[u]\n v = P[v]\n return t\n\n\nY = []\nM = int(input())\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n Y.append(lp(a, b))\nD = {1 << i: i for i in range(50)}\nZ = [0] * (1 << M)\nans = 0\nCC = [0] * N\nBC = [0] * (1 << 17)\nfor m in range(1, 1 << 17):\n a = m & (-m)\n BC[m] = BC[m ^ a] + 1\nfor m in range(1 << M):\n a = m & (-m)\n if a == m:\n if a == 0:\n Z[m] = 0\n else:\n Z[m] = Y[D[a]]\n else:\n Z[m] = Z[m ^ a] | Y[D[a]]\n aa = Z[m]\n bc = BC[aa % (1 << 17)]\n aa >>= 17\n bc += BC[aa % (1 << 17)]\n aa >>= 17\n bc += BC[aa]\n CC[N - 1 - bc] += 1 if BC[m % 1024] + BC[m >> 10] & 1 == 0 else -1\nprint((sum([2**i * CC[i] for i in range(N)])))\n", "code_v1_no_empty_lines": "N = int(input())\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\nP = [-1] * N\nDE = [0] * N\nQ = [0]\nwhile Q:\n i = Q.pop()\n for a in X[i][::-1]:\n if a != P[i]:\n P[a] = i\n DE[a] = DE[i] + 1\n X[a].remove(i)\n Q.append(a)\n\n\ndef lp(u, v):\n t = 0\n while u != v:\n if DE[u] > DE[v]:\n t += 1 << u - 1\n u = P[u]\n elif DE[u] < DE[v]:\n t += 1 << v - 1\n v = P[v]\n else:\n t += 1 << u - 1\n t += 1 << v - 1\n u = P[u]\n v = P[v]\n return t\n\n\nY = []\nM = int(input())\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n Y.append(lp(a, b))\n\n\ndef popcnt(n):\n c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)\n c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)\n c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)\n c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)\n c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)\n c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)\n return c\n\n\nD = {1 << i: i for i in range(50)}\nZ = [0] * (1 << M)\nans = 0\nCC = [0] * N\nfor m in range(1 << M):\n a = m & (-m)\n if a == m:\n if a == 0:\n Z[m] = 0\n else:\n Z[m] = Y[D[a]]\n else:\n Z[m] = Z[m ^ a] | Y[D[a]]\n CC[N - 1 - popcnt(Z[m])] += 1 if popcnt(m) & 1 == 0 else -1\nprint((sum([2**i * CC[i] for i in range(N)])))\n", "code_same": false, "relative_loc_diff_percent": 1.4285714286, "diff": ["+", "+", "+def popcnt(n):", "+ c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)", "+ c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)", "+ c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)", "+ c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)", "+ c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)", "+ c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)", "+ return c", "+", "+", "-BC = [0] * (1 << 17)", "-for m in range(1, 1 << 17):", "- a = m & (-m)", "- BC[m] = BC[m ^ a] + 1", "- aa = Z[m]", "- bc = BC[aa % (1 << 17)]", "- aa >>= 17", "- bc += BC[aa % (1 << 17)]", "- aa >>= 17", "- bc += BC[aa]", "- CC[N - 1 - bc] += 1 if BC[m % 1024] + BC[m >> 10] & 1 == 0 else -1", "+ CC[N - 1 - popcnt(Z[m])] += 1 if popcnt(m) & 1 == 0 else -1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4825011034, "measured_runtime_v1": 0.2223737774, "runtime_lift": 2.1697751823, "key": ["s167224132", "s245735210"]} +{"user_id": "u057109575", "problem_id": "p03078", "language": "python", "submission_id_v0": "s065985582", "submission_id_v1": "s294135268", "cpu_time_v0": 153, "cpu_time_v1": 124, "memory_v0": 79232, "memory_v1": 73392, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.95, "input": "\n\nfrom heapq import heappop, heappush\n\n\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\npq = []\n\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\n\nappeared = set((0, 0, 0))\n\n\n\nfor _ in range(K):\n\n # Pop maximum value\n\n val, i, j, k = heappop(pq)\n\n print((-val))\n\n\n\n # Add next value\n\n if i + 1 < X and (i + 1, j, k) not in appeared:\n\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n\n appeared.add((i + 1, j, k))\n\n\n\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n\n appeared.add((i, j + 1, k))\n\n\n\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n\n appeared.add((i, j, k + 1))\n", "target": "\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\nres = []\n\nfor i in range(X):\n\n for j in range(Y):\n\n for k in range(Z):\n\n if (i + 1) * (j + 1) * (k + 1) <= K:\n\n res.append(A[i] + B[j] + C[k])\n\n else:\n\n break\n\n\n\nres.sort(reverse=True)\n\nfor i in range(K):\n\n print((res[i]))\n", "code_v0_loc": 33, "code_v1_loc": 22, "code_v0_num_chars": 923, "code_v1_num_chars": 509, "code_v0_no_empty_lines": "from heapq import heappop, heappush\n\nX, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort(reverse=True)\nB.sort(reverse=True)\nC.sort(reverse=True)\npq = []\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\nappeared = set((0, 0, 0))\nfor _ in range(K):\n # Pop maximum value\n val, i, j, k = heappop(pq)\n print((-val))\n # Add next value\n if i + 1 < X and (i + 1, j, k) not in appeared:\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n appeared.add((i + 1, j, k))\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n appeared.add((i, j + 1, k))\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n appeared.add((i, j, k + 1))\n", "code_v1_no_empty_lines": "X, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort(reverse=True)\nB.sort(reverse=True)\nC.sort(reverse=True)\nres = []\nfor i in range(X):\n for j in range(Y):\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) <= K:\n res.append(A[i] + B[j] + C[k])\n else:\n break\nres.sort(reverse=True)\nfor i in range(K):\n print((res[i]))\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-from heapq import heappop, heappush", "-", "-pq = []", "-heappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))", "-appeared = set((0, 0, 0))", "-for _ in range(K):", "- # Pop maximum value", "- val, i, j, k = heappop(pq)", "- print((-val))", "- # Add next value", "- if i + 1 < X and (i + 1, j, k) not in appeared:", "- heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))", "- appeared.add((i + 1, j, k))", "- if j + 1 < Y and (i, j + 1, k) not in appeared:", "- heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))", "- appeared.add((i, j + 1, k))", "- if k + 1 < Z and (i, j, k + 1) not in appeared:", "- heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))", "- appeared.add((i, j, k + 1))", "+res = []", "+for i in range(X):", "+ for j in range(Y):", "+ for k in range(Z):", "+ if (i + 1) * (j + 1) * (k + 1) <= K:", "+ res.append(A[i] + B[j] + C[k])", "+ else:", "+ break", "+res.sort(reverse=True)", "+for i in range(K):", "+ print((res[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3859105117, "measured_runtime_v1": 0.2075348065, "runtime_lift": 1.8594977789, "key": ["s065985582", "s294135268"]} +{"user_id": "u944325914", "problem_id": "p02773", "language": "python", "submission_id_v0": "s220148525", "submission_id_v1": "s009987907", "cpu_time_v0": 1010, "cpu_time_v1": 521, "memory_v0": 104656, "memory_v1": 50176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.42, "input": "import collections\n\nn = int(input())\n\na=[input() for _ in range(n)]\n\nanslist=[]\n\nb=collections.Counter(a)\n\nc=max(list(b.values()))\n\nfor i in b:\n\n if b[i]==c:\n\n anslist.append(i)\n\nd=sorted(anslist)\n\nfor i in tuple(d):\n\n print(i)", "target": "from collections import Counter\n\nn=int(input())\n\na=[]\n\nfor i in range(n):\n\n a.append(input())\n\nac=Counter(a)\n\nacs=sorted(list(ac.items()),key=lambda x:x[1],reverse=1)\n\nz=len(acs)\n\ni=0\n\ntemp=[]\n\n\n\nwhile i<=z-1 and acs[i][1]==acs[0][1] :\n\n temp.append(acs[i][0])\n\n i+=1\n\ntemp.sort()\n\nfor i in temp:\n\n print(i)", "code_v0_loc": 12, "code_v1_loc": 17, "code_v0_num_chars": 240, "code_v1_num_chars": 305, "code_v0_no_empty_lines": "import collections\n\nn = int(input())\na = [input() for _ in range(n)]\nanslist = []\nb = collections.Counter(a)\nc = max(list(b.values()))\nfor i in b:\n if b[i] == c:\n anslist.append(i)\nd = sorted(anslist)\nfor i in tuple(d):\n print(i)\n", "code_v1_no_empty_lines": "from collections import Counter\n\nn = int(input())\na = []\nfor i in range(n):\n a.append(input())\nac = Counter(a)\nacs = sorted(list(ac.items()), key=lambda x: x[1], reverse=1)\nz = len(acs)\ni = 0\ntemp = []\nwhile i <= z - 1 and acs[i][1] == acs[0][1]:\n temp.append(acs[i][0])\n i += 1\ntemp.sort()\nfor i in temp:\n print(i)\n", "code_same": false, "relative_loc_diff_percent": 29.4117647059, "diff": ["-import collections", "+from collections import Counter", "-a = [input() for _ in range(n)]", "-anslist = []", "-b = collections.Counter(a)", "-c = max(list(b.values()))", "-for i in b:", "- if b[i] == c:", "- anslist.append(i)", "-d = sorted(anslist)", "-for i in tuple(d):", "+a = []", "+for i in range(n):", "+ a.append(input())", "+ac = Counter(a)", "+acs = sorted(list(ac.items()), key=lambda x: x[1], reverse=1)", "+z = len(acs)", "+i = 0", "+temp = []", "+while i <= z - 1 and acs[i][1] == acs[0][1]:", "+ temp.append(acs[i][0])", "+ i += 1", "+temp.sort()", "+for i in temp:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3929853504, "measured_runtime_v1": 0.3037585902, "runtime_lift": 1.2937423435, "key": ["s220148525", "s009987907"]} +{"user_id": "u857759499", "problem_id": "p03371", "language": "python", "submission_id_v0": "s203363465", "submission_id_v1": "s893730989", "cpu_time_v0": 85, "cpu_time_v1": 17, "memory_v0": 7096, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.0, "input": "a,b,c,x,y = list(map(int,input().split()))\n\nxy = max(x,y)*2+1\n\nprint((min([c*i + max(0,a*(x-i//2)) +max(0,b*(y-i//2)) for i in range(0,xy,2)])))", "target": "a,b,c,x,y = list(map(int,input().split()))\n\nif x < y:\n\n a, b, x, y = b, a, y, x\n\nprint((min(a*x+b*y,2*c*y + a*(x-y),2*c*x)))", "code_v0_loc": 3, "code_v1_loc": 4, "code_v0_num_chars": 136, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nxy = max(x, y) * 2 + 1\nprint(\n (\n min(\n [\n c * i + max(0, a * (x - i // 2)) + max(0, b * (y - i // 2))\n for i in range(0, xy, 2)\n ]\n )\n )\n)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nif x < y:\n a, b, x, y = b, a, y, x\nprint((min(a * x + b * y, 2 * c * y + a * (x - y), 2 * c * x)))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-xy = max(x, y) * 2 + 1", "-print(", "- (", "- min(", "- [", "- c * i + max(0, a * (x - i // 2)) + max(0, b * (y - i // 2))", "- for i in range(0, xy, 2)", "- ]", "- )", "- )", "-)", "+if x < y:", "+ a, b, x, y = b, a, y, x", "+print((min(a * x + b * y, 2 * c * y + a * (x - y), 2 * c * x)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2887920134, "measured_runtime_v1": 0.2046661584, "runtime_lift": 1.4110394, "key": ["s203363465", "s893730989"]} +{"user_id": "u628732336", "problem_id": "p02412", "language": "python", "submission_id_v0": "s343999289", "submission_id_v1": "s206971885", "cpu_time_v0": 1010, "cpu_time_v1": 530, "memory_v0": 7716, "memory_v1": 7724, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.52, "input": "while True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == sum([s, m, e]):\n\n count += 1\n\n\n\n print(count)", "target": "while True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == s+m+e:\n\n count += 1\n\n\n\n print(count)", "code_v0_loc": 14, "code_v1_loc": 14, "code_v0_num_chars": 314, "code_v1_num_chars": 305, "code_v0_no_empty_lines": "while True:\n n, x = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for s in range(1, n - 1):\n for m in range(s + 1, n):\n for e in range(m + 1, n + 1):\n if x == sum([s, m, e]):\n count += 1\n print(count)\n", "code_v1_no_empty_lines": "while True:\n n, x = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for s in range(1, n - 1):\n for m in range(s + 1, n):\n for e in range(m + 1, n + 1):\n if x == s + m + e:\n count += 1\n print(count)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if x == sum([s, m, e]):", "+ if x == s + m + e:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3385973902, "measured_runtime_v1": 0.2597145021, "runtime_lift": 1.3037292389, "key": ["s343999289", "s206971885"]} +{"user_id": "u867826040", "problem_id": "p02837", "language": "python", "submission_id_v0": "s705992872", "submission_id_v1": "s870269222", "cpu_time_v0": 258, "cpu_time_v1": 223, "memory_v0": 9120, "memory_v1": 9160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.57, "input": "n = int(input())\n\nv = [[tuple(map(int, input().split()))for i in range(int(input()))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [False] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = True\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n if f[x - 1] is not bool(y):\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n", "target": "n = int(input())\n\nv = [[tuple(map(int, input().split()))for i in range(int(input()))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [0] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = 1\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n #print(f,x,y,bin(i))\n\n if (i>>(x-1))&1 != y:\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 499, "code_v1_num_chars": 520, "code_v0_no_empty_lines": "n = int(input())\nv = [\n [tuple(map(int, input().split())) for i in range(int(input()))]\n for i in range(n)\n]\nans = 0\nfor i in range(2**n):\n f = [False] * n\n xy = []\n for j in range(n):\n if (i >> j) & 1:\n f[j] = True\n xy.append(v[j])\n flag = True\n for xyi in xy:\n for x, y in xyi:\n if f[x - 1] is not bool(y):\n flag = False\n break\n if flag:\n ans = max(ans, len(xy))\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nv = [\n [tuple(map(int, input().split())) for i in range(int(input()))]\n for i in range(n)\n]\nans = 0\nfor i in range(2**n):\n f = [0] * n\n xy = []\n for j in range(n):\n if (i >> j) & 1:\n f[j] = 1\n xy.append(v[j])\n flag = True\n for xyi in xy:\n for x, y in xyi:\n # print(f,x,y,bin(i))\n if (i >> (x - 1)) & 1 != y:\n flag = False\n break\n if flag:\n ans = max(ans, len(xy))\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["- f = [False] * n", "+ f = [0] * n", "- f[j] = True", "+ f[j] = 1", "- if f[x - 1] is not bool(y):", "+ # print(f,x,y,bin(i))", "+ if (i >> (x - 1)) & 1 != y:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.289290843, "measured_runtime_v1": 0.2134317408, "runtime_lift": 1.3554255893, "key": ["s705992872", "s870269222"]} +{"user_id": "u102461423", "problem_id": "p03000", "language": "python", "submission_id_v0": "s091839409", "submission_id_v1": "s096312338", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N,X = list(map(int,input().split()))\n\nL = [0] + [int(x) for x in input().split()]\n\n\n\nD = [0] * (N+2)\n\nanswer = 1\n\nfor n in range(2,N+2):\n\n D[n] = D[n-1] + L[n-1]\n\n if D[n] <= X:\n\n answer += 1\n\n \n\nprint(answer)", "target": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nimport itertools\n\n\n\nN,X,*L = list(map(int,read().split()))\n\n\n\nanswer = sum(x <= X for x in itertools.accumulate([0]+L))\n\nprint(answer)", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 211, "code_v1_num_chars": 250, "code_v0_no_empty_lines": "N, X = list(map(int, input().split()))\nL = [0] + [int(x) for x in input().split()]\nD = [0] * (N + 2)\nanswer = 1\nfor n in range(2, N + 2):\n D[n] = D[n - 1] + L[n - 1]\n if D[n] <= X:\n answer += 1\nprint(answer)\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport itertools\n\nN, X, *L = list(map(int, read().split()))\nanswer = sum(x <= X for x in itertools.accumulate([0] + L))\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-N, X = list(map(int, input().split()))", "-L = [0] + [int(x) for x in input().split()]", "-D = [0] * (N + 2)", "-answer = 1", "-for n in range(2, N + 2):", "- D[n] = D[n - 1] + L[n - 1]", "- if D[n] <= X:", "- answer += 1", "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "+import itertools", "+", "+N, X, *L = list(map(int, read().split()))", "+answer = sum(x <= X for x in itertools.accumulate([0] + L))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4454345685, "measured_runtime_v1": 0.3287086122, "runtime_lift": 1.3551046487, "key": ["s091839409", "s096312338"]} +{"user_id": "u133936772", "problem_id": "p02983", "language": "python", "submission_id_v0": "s915950177", "submission_id_v1": "s423283368", "cpu_time_v0": 97, "cpu_time_v1": 51, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.42, "input": "mod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r//mod - l//mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l+1, r+1):\n\n for j in range(l, i):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)", "target": "mod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r//mod - l//mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l, r):\n\n for j in range(i+1, r+1):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)", "code_v0_loc": 15, "code_v1_loc": 15, "code_v0_num_chars": 259, "code_v1_num_chars": 259, "code_v0_no_empty_lines": "mod = 2019\nl, r = list(map(int, input().split()))\nif r // mod - l // mod > 0:\n print((0))\nelse:\n l %= mod\n r %= mod\n ans = mod\n for i in range(l + 1, r + 1):\n for j in range(l, i):\n ans = min(i * j % mod, ans)\n if ans == 0:\n break\n print(ans)\n", "code_v1_no_empty_lines": "mod = 2019\nl, r = list(map(int, input().split()))\nif r // mod - l // mod > 0:\n print((0))\nelse:\n l %= mod\n r %= mod\n ans = mod\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n ans = min(i * j % mod, ans)\n if ans == 0:\n break\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- for i in range(l + 1, r + 1):", "- for j in range(l, i):", "+ for i in range(l, r):", "+ for j in range(i + 1, r + 1):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3490325066, "measured_runtime_v1": 0.2693671175, "runtime_lift": 1.2957502381, "key": ["s915950177", "s423283368"]} +{"user_id": "u998741086", "problem_id": "p03425", "language": "python", "submission_id_v0": "s570150327", "submission_id_v1": "s255248054", "cpu_time_v0": 227, "cpu_time_v1": 144, "memory_v0": 16268, "memory_v1": 16064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 36.56, "input": "#!/usr/bin/env python3\n\n\n\nn = int(input())\n\ns = [input() for _ in range(n)]\n\n\n\nc = [0 for _ in range(5)]\n\nt = 'MARCH'\n\n\n\nfor i in range(n):\n\n for j in range(5):\n\n if s[i][0] == t[j]:\n\n c[j] += 1\n\nans = 0 \n\nfor i in range(5):\n\n for j in range(i+1, 5): \n\n for k in range(j+1, 5): \n\n ans += c[i]*c[k]*c[j]\n\nprint(ans)\n", "target": "#!/usr/bin/env python3\n\n\n\nn = int(input())\n\ns = [input() for _ in range(n)]\n\nd = {}\n\n\n\nfor c in s:\n\n if c[0] not in d:\n\n d[c[0]] = 1 \n\n else:\n\n d[c[0]] += 1\n\n\n\ntmp = d.copy()\n\nt = ['M', 'A', 'R', 'C', 'H']\n\nfor c in tmp:\n\n if c not in t:\n\n d.pop(c)\n\n\n\nans = 0 \n\ndlist = list(d.items())\n\nfor i in range(len(dlist)):\n\n for j in range(i+1, len(dlist)):\n\n for k in range(j+1, len(dlist)):\n\n ans += dlist[i][1]*dlist[j][1]*dlist[k][1]\n\nprint(ans)\n", "code_v0_loc": 18, "code_v1_loc": 25, "code_v0_num_chars": 357, "code_v1_num_chars": 493, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nn = int(input())\ns = [input() for _ in range(n)]\nc = [0 for _ in range(5)]\nt = \"MARCH\"\nfor i in range(n):\n for j in range(5):\n if s[i][0] == t[j]:\n c[j] += 1\nans = 0\nfor i in range(5):\n for j in range(i + 1, 5):\n for k in range(j + 1, 5):\n ans += c[i] * c[k] * c[j]\nprint(ans)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nn = int(input())\ns = [input() for _ in range(n)]\nd = {}\nfor c in s:\n if c[0] not in d:\n d[c[0]] = 1\n else:\n d[c[0]] += 1\ntmp = d.copy()\nt = [\"M\", \"A\", \"R\", \"C\", \"H\"]\nfor c in tmp:\n if c not in t:\n d.pop(c)\nans = 0\ndlist = list(d.items())\nfor i in range(len(dlist)):\n for j in range(i + 1, len(dlist)):\n for k in range(j + 1, len(dlist)):\n ans += dlist[i][1] * dlist[j][1] * dlist[k][1]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 28.0, "diff": ["-c = [0 for _ in range(5)]", "-t = \"MARCH\"", "-for i in range(n):", "- for j in range(5):", "- if s[i][0] == t[j]:", "- c[j] += 1", "+d = {}", "+for c in s:", "+ if c[0] not in d:", "+ d[c[0]] = 1", "+ else:", "+ d[c[0]] += 1", "+tmp = d.copy()", "+t = [\"M\", \"A\", \"R\", \"C\", \"H\"]", "+for c in tmp:", "+ if c not in t:", "+ d.pop(c)", "-for i in range(5):", "- for j in range(i + 1, 5):", "- for k in range(j + 1, 5):", "- ans += c[i] * c[k] * c[j]", "+dlist = list(d.items())", "+for i in range(len(dlist)):", "+ for j in range(i + 1, len(dlist)):", "+ for k in range(j + 1, len(dlist)):", "+ ans += dlist[i][1] * dlist[j][1] * dlist[k][1]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3218575408, "measured_runtime_v1": 0.2488505929, "runtime_lift": 1.2933766287, "key": ["s570150327", "s255248054"]} +{"user_id": "u661290476", "problem_id": "p00053", "language": "python", "submission_id_v0": "s978814614", "submission_id_v1": "s421101567", "cpu_time_v0": 420, "cpu_time_v1": 210, "memory_v0": 18368, "memory_v1": 51028, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "prim=[True]*1000000\n\nprim[0],prim[1]=False,False\n\nfor i in range(2,1000):\n\n if prim[i]:\n\n for j in range(i*2,1000000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(input())\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))", "target": "prim=[True]*1000000\n\nprim[0]=prim[1]=False\n\nfor i in range(2,350):\n\n if prim[i]:\n\n for j in range(i*2,110000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(input())\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 297, "code_v1_num_chars": 289, "code_v0_no_empty_lines": "prim = [True] * 1000000\nprim[0], prim[1] = False, False\nfor i in range(2, 1000):\n if prim[i]:\n for j in range(i * 2, 1000000, i):\n prim[j] = False\nprime = [i for i, j in enumerate(prim) if j == True]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(prime[:n])))\n", "code_v1_no_empty_lines": "prim = [True] * 1000000\nprim[0] = prim[1] = False\nfor i in range(2, 350):\n if prim[i]:\n for j in range(i * 2, 110000, i):\n prim[j] = False\nprime = [i for i, j in enumerate(prim) if j == True]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(prime[:n])))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-prim[0], prim[1] = False, False", "-for i in range(2, 1000):", "+prim[0] = prim[1] = False", "+for i in range(2, 350):", "- for j in range(i * 2, 1000000, i):", "+ for j in range(i * 2, 110000, i):"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0302433112, "measured_runtime_v1": 0.6551637814, "runtime_lift": 1.5724973516, "key": ["s978814614", "s421101567"]} +{"user_id": "u347600233", "problem_id": "p03037", "language": "python", "submission_id_v0": "s661845965", "submission_id_v1": "s817506416", "cpu_time_v0": 279, "cpu_time_v1": 195, "memory_v0": 7088, "memory_v1": 16564, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.11, "input": "n, m = list(map(int, input().split()))\n\ngate = []\n\nl, r = list(map(int, input().split()))\n\nfor i in range(1, m):\n\n m, s = list(map(int, input().split()))\n\n if l < m:\n\n l = m\n\n if s < r:\n\n r = s\n\nprint((len([i for i in range(l, r + 1)])))", "target": "n, m = list(map(int, input().split()))\n\nl, r = [0] * m, [0] * m\n\nfor i in range(m):\n\n l[i], r[i] = list(map(int, input().split()))\n\nprint((max(min(r) - max(l) + 1, 0)))", "code_v0_loc": 10, "code_v1_loc": 5, "code_v0_num_chars": 240, "code_v1_num_chars": 157, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\ngate = []\nl, r = list(map(int, input().split()))\nfor i in range(1, m):\n m, s = list(map(int, input().split()))\n if l < m:\n l = m\n if s < r:\n r = s\nprint((len([i for i in range(l, r + 1)])))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nl, r = [0] * m, [0] * m\nfor i in range(m):\n l[i], r[i] = list(map(int, input().split()))\nprint((max(min(r) - max(l) + 1, 0)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-gate = []", "-l, r = list(map(int, input().split()))", "-for i in range(1, m):", "- m, s = list(map(int, input().split()))", "- if l < m:", "- l = m", "- if s < r:", "- r = s", "-print((len([i for i in range(l, r + 1)])))", "+l, r = [0] * m, [0] * m", "+for i in range(m):", "+ l[i], r[i] = list(map(int, input().split()))", "+print((max(min(r) - max(l) + 1, 0)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.317712152, "measured_runtime_v1": 0.2449507949, "runtime_lift": 1.2970447884, "key": ["s661845965", "s817506416"]} +{"user_id": "u585963734", "problem_id": "p02596", "language": "python", "submission_id_v0": "s961921352", "submission_id_v1": "s631804156", "cpu_time_v0": 290, "cpu_time_v1": 180, "memory_v0": 48468, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.93, "input": "K=int(input())\n\n\n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n \n\nans=[0]*(pow(10,6)+1)\n\nans[0]=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n ans[i]=(ans[i-1]*10+7)%K\n\n if ans[i]==0:\n\n print(i)\n\n exit(0)\n\n\n\nprint((-1))", "target": "import functools\n\n\n\nK=int(input())\n\n \n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n\n\nmod=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n mod=(mod*10+7)%K\n\n if mod==0:\n\n print(i)\n\n exit(0)\n\n \n\nprint((-1))", "code_v0_loc": 16, "code_v1_loc": 17, "code_v0_num_chars": 224, "code_v1_num_chars": 212, "code_v0_no_empty_lines": "K = int(input())\nif K % 2 == 0:\n print((-1))\n exit(0)\nans = [0] * (pow(10, 6) + 1)\nans[0] = 0\nfor i in range(1, pow(10, 6)):\n ans[i] = (ans[i - 1] * 10 + 7) % K\n if ans[i] == 0:\n print(i)\n exit(0)\nprint((-1))\n", "code_v1_no_empty_lines": "import functools\n\nK = int(input())\nif K % 2 == 0:\n print((-1))\n exit(0)\nmod = 0\nfor i in range(1, pow(10, 6)):\n mod = (mod * 10 + 7) % K\n if mod == 0:\n print(i)\n exit(0)\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["+import functools", "+", "-ans = [0] * (pow(10, 6) + 1)", "-ans[0] = 0", "+mod = 0", "- ans[i] = (ans[i - 1] * 10 + 7) % K", "- if ans[i] == 0:", "+ mod = (mod * 10 + 7) % K", "+ if mod == 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7143074386, "measured_runtime_v1": 0.5444337668, "runtime_lift": 1.3120189858, "key": ["s961921352", "s631804156"]} +{"user_id": "u311379832", "problem_id": "p02537", "language": "python", "submission_id_v0": "s277145927", "submission_id_v1": "s770419806", "cpu_time_v0": 790, "cpu_time_v1": 668, "memory_v0": 119112, "memory_v1": 103304, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.44, "input": "def segfunc(x, y): return max(x, y)\n\n\n\nclass SegmentTree:\n\n def __init__(self, arr):\n\n size = len(arr)\n\n n = 2 ** (size - 1).bit_length()\n\n self.n = n\n\n self.node = [0] * (2*n)\n\n for i in range(size):\n\n self.node[i+n-1] = arr[i]\n\n for i in reversed(list(range(n-2))):\n\n self.node[i] = segfunc(self.node[2*i+1], self.node[2*i+2])\n\n\n\n def update(self, i, x):\n\n i += self.n - 1\n\n self.node[i] = x\n\n while i > 0:\n\n i = (i - 1) // 2\n\n self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])\n\n\n\n def update(self, x, val):\n\n x += (self.n - 1)\n\n self.node[x] = val\n\n while x > 0:\n\n x = (x - 1) // 2\n\n self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])\n\n\n\n def query(self, a, b):\n\n res = 0\n\n l = self.n - 1 + a\n\n r = self.n - 1 + (b - 1)\n\n\n\n while l <= r:\n\n if l == r:\n\n res = segfunc(res, self.node[l])\n\n break\n\n\n\n if l % 2 == 0:\n\n res = segfunc(res, self.node[l])\n\n if r % 2 == 1:\n\n res = segfunc(res, self.node[r])\n\n l = l // 2\n\n r = r // 2 - 1\n\n\n\n return res\n\n\n\nN, K = list(map(int, input().split()))\n\nINF = 0\n\nseg = SegmentTree([0] * 300000)\n\nfor i in range(N):\n\n a = int(input())\n\n tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1\n\n seg.update(a, tmp)\n\nprint((seg.query(0, 300000)))\n", "target": "def segfunc(x, y): return max(x, y)\n\ndef update(i, x):\n\n i += MAX_N-1\n\n node[i] = x\n\n while i:\n\n i = (i-1)//2\n\n node[i] = segfunc(node[i*2+1], node[i*2+2])\n\n\n\ndef query(l, r):\n\n L = l + MAX_N\n\n R = r + MAX_N\n\n s = INF\n\n while L < R:\n\n if R & 1:\n\n R -= 1\n\n s = segfunc(s, node[R - 1])\n\n if L & 1:\n\n s = segfunc(s, node[L - 1])\n\n L += 1\n\n L >>= 1\n\n R >>= 1\n\n return s\n\n\n\nN, K = list(map(int, input().split()))\n\nMAX_N = 2**(300005).bit_length()\n\na = [int(input()) for _ in range(N)]\n\nnode = [0] * (2 * MAX_N)\n\nINF = 0\n\nans = 0\n\n\n\n#for i in range(N):\n\n# update(i, a[i])\n\n\n\nfor i in a:\n\n tmp = query(max(i - K, 0), min(300005, i + K) + 1)\n\n update(i, tmp + 1)\n\n ans = max(ans, tmp + 1)\n\nprint(ans)\n", "code_v0_loc": 54, "code_v1_loc": 38, "code_v0_num_chars": 1524, "code_v1_num_chars": 809, "code_v0_no_empty_lines": "def segfunc(x, y):\n return max(x, y)\n\n\nclass SegmentTree:\n def __init__(self, arr):\n size = len(arr)\n n = 2 ** (size - 1).bit_length()\n self.n = n\n self.node = [0] * (2 * n)\n for i in range(size):\n self.node[i + n - 1] = arr[i]\n for i in reversed(list(range(n - 2))):\n self.node[i] = segfunc(self.node[2 * i + 1], self.node[2 * i + 2])\n\n def update(self, i, x):\n i += self.n - 1\n self.node[i] = x\n while i > 0:\n i = (i - 1) // 2\n self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])\n\n def update(self, x, val):\n x += self.n - 1\n self.node[x] = val\n while x > 0:\n x = (x - 1) // 2\n self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])\n\n def query(self, a, b):\n res = 0\n l = self.n - 1 + a\n r = self.n - 1 + (b - 1)\n while l <= r:\n if l == r:\n res = segfunc(res, self.node[l])\n break\n if l % 2 == 0:\n res = segfunc(res, self.node[l])\n if r % 2 == 1:\n res = segfunc(res, self.node[r])\n l = l // 2\n r = r // 2 - 1\n return res\n\n\nN, K = list(map(int, input().split()))\nINF = 0\nseg = SegmentTree([0] * 300000)\nfor i in range(N):\n a = int(input())\n tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1\n seg.update(a, tmp)\nprint((seg.query(0, 300000)))\n", "code_v1_no_empty_lines": "def segfunc(x, y):\n return max(x, y)\n\n\ndef update(i, x):\n i += MAX_N - 1\n node[i] = x\n while i:\n i = (i - 1) // 2\n node[i] = segfunc(node[i * 2 + 1], node[i * 2 + 2])\n\n\ndef query(l, r):\n L = l + MAX_N\n R = r + MAX_N\n s = INF\n while L < R:\n if R & 1:\n R -= 1\n s = segfunc(s, node[R - 1])\n if L & 1:\n s = segfunc(s, node[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\nN, K = list(map(int, input().split()))\nMAX_N = 2 ** (300005).bit_length()\na = [int(input()) for _ in range(N)]\nnode = [0] * (2 * MAX_N)\nINF = 0\nans = 0\n# for i in range(N):\n# update(i, a[i])\nfor i in a:\n tmp = query(max(i - K, 0), min(300005, i + K) + 1)\n update(i, tmp + 1)\n ans = max(ans, tmp + 1)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 29.6296296296, "diff": ["-class SegmentTree:", "- def __init__(self, arr):", "- size = len(arr)", "- n = 2 ** (size - 1).bit_length()", "- self.n = n", "- self.node = [0] * (2 * n)", "- for i in range(size):", "- self.node[i + n - 1] = arr[i]", "- for i in reversed(list(range(n - 2))):", "- self.node[i] = segfunc(self.node[2 * i + 1], self.node[2 * i + 2])", "+def update(i, x):", "+ i += MAX_N - 1", "+ node[i] = x", "+ while i:", "+ i = (i - 1) // 2", "+ node[i] = segfunc(node[i * 2 + 1], node[i * 2 + 2])", "- def update(self, i, x):", "- i += self.n - 1", "- self.node[i] = x", "- while i > 0:", "- i = (i - 1) // 2", "- self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])", "- def update(self, x, val):", "- x += self.n - 1", "- self.node[x] = val", "- while x > 0:", "- x = (x - 1) // 2", "- self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])", "-", "- def query(self, a, b):", "- res = 0", "- l = self.n - 1 + a", "- r = self.n - 1 + (b - 1)", "- while l <= r:", "- if l == r:", "- res = segfunc(res, self.node[l])", "- break", "- if l % 2 == 0:", "- res = segfunc(res, self.node[l])", "- if r % 2 == 1:", "- res = segfunc(res, self.node[r])", "- l = l // 2", "- r = r // 2 - 1", "- return res", "+def query(l, r):", "+ L = l + MAX_N", "+ R = r + MAX_N", "+ s = INF", "+ while L < R:", "+ if R & 1:", "+ R -= 1", "+ s = segfunc(s, node[R - 1])", "+ if L & 1:", "+ s = segfunc(s, node[L - 1])", "+ L += 1", "+ L >>= 1", "+ R >>= 1", "+ return s", "+MAX_N = 2 ** (300005).bit_length()", "+a = [int(input()) for _ in range(N)]", "+node = [0] * (2 * MAX_N)", "-seg = SegmentTree([0] * 300000)", "-for i in range(N):", "- a = int(input())", "- tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1", "- seg.update(a, tmp)", "-print((seg.query(0, 300000)))", "+ans = 0", "+# for i in range(N):", "+# update(i, a[i])", "+for i in a:", "+ tmp = query(max(i - K, 0), min(300005, i + K) + 1)", "+ update(i, tmp + 1)", "+ ans = max(ans, tmp + 1)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 2.9777374048, "measured_runtime_v1": 0.391063194, "runtime_lift": 7.6144660253, "key": ["s277145927", "s770419806"]} +{"user_id": "u188827677", "problem_id": "p03037", "language": "python", "submission_id_v0": "s698380012", "submission_id_v1": "s714478978", "cpu_time_v0": 302, "cpu_time_v1": 221, "memory_v0": 11020, "memory_v1": 9144, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.82, "input": "N,M = list(map(int, input().split()))\n\nL = []\n\nR = []\n\nfor _ in range(M):\n\n l,r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n\n\nans = min(R)-max(L)+1\n\nif ans < 0:\n\n print((0))\n\nelse:\n\n print(ans)\n\n ", "target": "n,m = list(map(int, input().split()))\n\nmax_l = float(\"-inf\")\n\nmin_r = float(\"inf\")\n\nfor _ in range(m):\n\n l,r = list(map(int, input().split()))\n\n max_l = max(max_l, l)\n\n min_r = min(min_r, r)\n\nans = min_r - max_l + 1\n\nif ans > 0:\n\n print(ans)\n\nelse:\n\n print((0))", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 207, "code_v1_num_chars": 252, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL = []\nR = []\nfor _ in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\nans = min(R) - max(L) + 1\nif ans < 0:\n print((0))\nelse:\n print(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nmax_l = float(\"-inf\")\nmin_r = float(\"inf\")\nfor _ in range(m):\n l, r = list(map(int, input().split()))\n max_l = max(max_l, l)\n min_r = min(min_r, r)\nans = min_r - max_l + 1\nif ans > 0:\n print(ans)\nelse:\n print((0))\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-N, M = list(map(int, input().split()))", "-L = []", "-R = []", "-for _ in range(M):", "+n, m = list(map(int, input().split()))", "+max_l = float(\"-inf\")", "+min_r = float(\"inf\")", "+for _ in range(m):", "- L.append(l)", "- R.append(r)", "-ans = min(R) - max(L) + 1", "-if ans < 0:", "+ max_l = max(max_l, l)", "+ min_r = min(min_r, r)", "+ans = min_r - max_l + 1", "+if ans > 0:", "+ print(ans)", "+else:", "-else:", "- print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2637555127, "measured_runtime_v1": 0.1756164875, "runtime_lift": 1.5018835444, "key": ["s698380012", "s714478978"]} +{"user_id": "u803617136", "problem_id": "p03325", "language": "python", "submission_id_v0": "s116805601", "submission_id_v1": "s513357045", "cpu_time_v0": 184, "cpu_time_v1": 27, "memory_v0": 40560, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.33, "input": "N = int(input())\n\n\n\nseq = list(map(int, input().split()))\n\n\n\ncnt = 0\n\n\n\nfor num in seq:\n\n while num % 2 == 0:\n\n cnt += 1\n\n num /= 2\n\n\n\nprint(cnt)\n", "target": "n = int(input())\n\na = list(map(int, input().split()))\n\nans = 0\n\nfor num in a:\n\n ans += format(num, 'b')[::-1].find('1')\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 6, "code_v0_num_chars": 163, "code_v1_num_chars": 134, "code_v0_no_empty_lines": "N = int(input())\nseq = list(map(int, input().split()))\ncnt = 0\nfor num in seq:\n while num % 2 == 0:\n cnt += 1\n num /= 2\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nans = 0\nfor num in a:\n ans += format(num, \"b\")[::-1].find(\"1\")\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-N = int(input())", "-seq = list(map(int, input().split()))", "-cnt = 0", "-for num in seq:", "- while num % 2 == 0:", "- cnt += 1", "- num /= 2", "-print(cnt)", "+n = int(input())", "+a = list(map(int, input().split()))", "+ans = 0", "+for num in a:", "+ ans += format(num, \"b\")[::-1].find(\"1\")", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1574799829, "measured_runtime_v1": 0.0061847587, "runtime_lift": 25.4625913758, "key": ["s116805601", "s513357045"]} +{"user_id": "u564589929", "problem_id": "p03371", "language": "python", "submission_id_v0": "s501790970", "submission_id_v1": "s324668886", "cpu_time_v0": 93, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.72, "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(input())\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = INF\n\n for k in range(100001):\n\n yen = 2 * c * k + max(0, x-k) * a + max(0, y-k) * b\n\n ans = min(ans, yen)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "target": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(input())\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = 0\n\n if a + b <= 2 * c:\n\n mn = min(x, y)\n\n ans = a * mn + b * mn + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)\n\n\n\n else:\n\n mn = min(x, y)\n\n ans = mn * 2 * c + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)\n\n\n\n print(ans)\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "code_v0_loc": 28, "code_v1_loc": 34, "code_v0_num_chars": 727, "code_v1_num_chars": 868, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\n\n\ndef II():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MI1():\n return list(map(int1, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI1():\n return list(map(int1, input().split()))\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef printlist(lst, k=\"\\n\"):\n print((k.join(list(map(str, lst)))))\n\n\nINF = float(\"inf\")\n\n\ndef solve():\n a, b, c, x, y = MI()\n ans = INF\n for k in range(100001):\n yen = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b\n ans = min(ans, yen)\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\n\n\ndef II():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MI1():\n return list(map(int1, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI1():\n return list(map(int1, input().split()))\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef printlist(lst, k=\"\\n\"):\n print((k.join(list(map(str, lst)))))\n\n\nINF = float(\"inf\")\n\n\ndef solve():\n a, b, c, x, y = MI()\n ans = 0\n if a + b <= 2 * c:\n mn = min(x, y)\n ans = (\n a * mn\n + b * mn\n + max(0, x - mn) * min(a, 2 * c)\n + max(0, y - mn) * min(b, 2 * c)\n )\n else:\n mn = min(x, y)\n ans = (\n mn * 2 * c + max(0, x - mn) * min(a, 2 * c) + max(0, y - mn) * min(b, 2 * c)\n )\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["- ans = INF", "- for k in range(100001):", "- yen = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b", "- ans = min(ans, yen)", "+ ans = 0", "+ if a + b <= 2 * c:", "+ mn = min(x, y)", "+ ans = (", "+ a * mn", "+ + b * mn", "+ + max(0, x - mn) * min(a, 2 * c)", "+ + max(0, y - mn) * min(b, 2 * c)", "+ )", "+ else:", "+ mn = min(x, y)", "+ ans = (", "+ mn * 2 * c + max(0, x - mn) * min(a, 2 * c) + max(0, y - mn) * min(b, 2 * c)", "+ )"], "diff_only_import_comment": false, "measured_runtime_v0": 1.2337559407, "measured_runtime_v1": 0.3123451986, "runtime_lift": 3.9499756873, "key": ["s501790970", "s324668886"]} +{"user_id": "u186838327", "problem_id": "p03796", "language": "python", "submission_id_v0": "s155084707", "submission_id_v1": "s301395968", "cpu_time_v0": 231, "cpu_time_v1": 177, "memory_v0": 4104, "memory_v1": 38640, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.38, "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))", "target": "n = int(input())\n\nans = 1\n\nmod = 10**9+7\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= mod\n\n\n\nans %= mod\n\nprint(ans)\n", "code_v0_loc": 3, "code_v1_loc": 9, "code_v0_num_chars": 65, "code_v1_num_chars": 122, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nmod = 10**9 + 7\nfor i in range(1, n + 1):\n ans *= i\n ans %= mod\nans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+ans = 1", "+mod = 10**9 + 7", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= mod", "+ans %= mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5786725054, "measured_runtime_v1": 0.2556207638, "runtime_lift": 2.2637930378, "key": ["s155084707", "s301395968"]} +{"user_id": "u014333473", "problem_id": "p03845", "language": "python", "submission_id_v0": "s045706452", "submission_id_v1": "s705375036", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9180, "memory_v1": 9164, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "n,t=int(input()),list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n", "target": "input();t=list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n", "code_v0_loc": 2, "code_v1_loc": 2, "code_v0_num_chars": 160, "code_v1_num_chars": 153, "code_v0_no_empty_lines": "n, t = int(input()), list(map(int, input().split()))\nT = sum(t)\nprint(\n *[\n T - t[i - 1] + j\n for i, j in [list(map(int, input().split())) for _ in range(int(input()))]\n ],\n sep=\"\\n\"\n)\n", "code_v1_no_empty_lines": "input()\nt = list(map(int, input().split()))\nT = sum(t)\nprint(\n *[\n T - t[i - 1] + j\n for i, j in [list(map(int, input().split())) for _ in range(int(input()))]\n ],\n sep=\"\\n\"\n)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-n, t = int(input()), list(map(int, input().split()))", "+input()", "+t = list(map(int, input().split()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.308619008, "measured_runtime_v1": 0.2417461898, "runtime_lift": 1.2766240837, "key": ["s045706452", "s705375036"]} +{"user_id": "u906501980", "problem_id": "p03363", "language": "python", "submission_id_v0": "s203042500", "submission_id_v1": "s990747122", "cpu_time_v0": 316, "cpu_time_v1": 264, "memory_v0": 52496, "memory_v1": 52544, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.46, "input": "n = int(input())\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum={}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n if str(i) in list(num.keys()):\n\n num[str(i)] += 1\n\n else:\n\n num[str(i)] = 1\n\nout = [i*(i-1)//2 for i in list(num.values()) if i>1]\n\nprint((sum(out)))", "target": "n = int(input())\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum = {}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n s = str(i)\n\n num[s] = 1 if s not in list(num.keys()) else num[s]+1\n\nout = [i*(i-1)//2 for i in list(num.values()) if i > 1]\n\nprint((sum(out)))", "code_v0_loc": 13, "code_v1_loc": 11, "code_v0_num_chars": 295, "code_v1_num_chars": 276, "code_v0_no_empty_lines": "n = int(input())\nA = [int(i) for i in input().split()]\nS = [0] * (n + 1)\nnum = {}\nfor i in range(n):\n S[i + 1] = S[i] + A[i]\nfor i in S:\n if str(i) in list(num.keys()):\n num[str(i)] += 1\n else:\n num[str(i)] = 1\nout = [i * (i - 1) // 2 for i in list(num.values()) if i > 1]\nprint((sum(out)))\n", "code_v1_no_empty_lines": "n = int(input())\nA = [int(i) for i in input().split()]\nS = [0] * (n + 1)\nnum = {}\nfor i in range(n):\n S[i + 1] = S[i] + A[i]\nfor i in S:\n s = str(i)\n num[s] = 1 if s not in list(num.keys()) else num[s] + 1\nout = [i * (i - 1) // 2 for i in list(num.values()) if i > 1]\nprint((sum(out)))\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["- if str(i) in list(num.keys()):", "- num[str(i)] += 1", "- else:", "- num[str(i)] = 1", "+ s = str(i)", "+ num[s] = 1 if s not in list(num.keys()) else num[s] + 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4443410683, "measured_runtime_v1": 0.2339228122, "runtime_lift": 1.8995200341, "key": ["s203042500", "s990747122"]} +{"user_id": "u805332733", "problem_id": "p02555", "language": "python", "submission_id_v0": "s317659277", "submission_id_v1": "s521440898", "cpu_time_v0": 89, "cpu_time_v1": 65, "memory_v0": 64652, "memory_v1": 63416, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.97, "input": "def resolve():\n\n base = 10**9+7\n\n S = int(input())\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(1, S+1):\n\n for u in range(i-2):\n\n dp[i] += dp[u]\n\n dp[i] %= base\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n", "target": "def resolve():\n\n base = 10**9+7\n\n S = int(input())\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(3, S+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()", "code_v0_loc": 15, "code_v1_loc": 13, "code_v0_num_chars": 263, "code_v1_num_chars": 224, "code_v0_no_empty_lines": "def resolve():\n base = 10**9 + 7\n S = int(input())\n dp = [0] * (S + 1)\n dp[0] = 1\n for i in range(1, S + 1):\n for u in range(i - 2):\n dp[i] += dp[u]\n dp[i] %= base\n # print(dp)\n print((dp[S] % base))\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_v1_no_empty_lines": "def resolve():\n base = 10**9 + 7\n S = int(input())\n dp = [0] * (S + 1)\n dp[0] = 1\n for i in range(3, S + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n # print(dp)\n print((dp[S] % base))\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 13.3333333333, "diff": ["- for i in range(1, S + 1):", "- for u in range(i - 2):", "- dp[i] += dp[u]", "- dp[i] %= base", "+ for i in range(3, S + 1):", "+ dp[i] = dp[i - 1] + dp[i - 3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5217176821, "measured_runtime_v1": 0.2045270953, "runtime_lift": 2.5508487337, "key": ["s317659277", "s521440898"]} +{"user_id": "u922449550", "problem_id": "p02792", "language": "python", "submission_id_v0": "s475401488", "submission_id_v1": "s941984259", "cpu_time_v0": 197, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.37, "input": "N = int(input())\n\n\n\ntable = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n id1 = int(s[0])\n\n id2 = int(s[-1])\n\n table[id1][id2] += 1\n\n\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += table[i][j]*table[j][i]\n\n\n\nprint(ans)", "target": "N = input()\n\nm = len(N)\n\n\n\na0 = int(N[0])\n\na1 = int(N[-1])\n\n\n\nans = 0\n\nif m == 1:\n\n ans = int(N)\n\nelse:\n\n mid = (int(N[1:]) - a1)//10\n\n t = 10**(m-2)\n\n ans = 9\n\n ans += ((a0-1)*t) * 2\n\n ans += (mid + (a1>=a0)) * 2\n\n ans += ((a0-1)*t)**2\n\n ans += ((mid*(a0-1) + min(a0-1, a1))*t) * 2\n\n ans += (mid + (a1>=a0))**2\n\n if m >= 3:\n\n ans += (t - 1) * 2\n\n ans += ((a0-1)*(t - 1)*t) * 2\n\n ans += (mid * (t - 1)) * 2\n\n ans += (a1 * (t - 1)//9) * 2\n\n ans += (t - 1)**2\n\n\n\nprint(ans)", "code_v0_loc": 16, "code_v1_loc": 26, "code_v0_num_chars": 264, "code_v1_num_chars": 496, "code_v0_no_empty_lines": "N = int(input())\ntable = [[0] * 10 for i in range(10)]\nfor i in range(1, N + 1):\n s = str(i)\n id1 = int(s[0])\n id2 = int(s[-1])\n table[id1][id2] += 1\nans = 0\nfor i in range(10):\n for j in range(10):\n ans += table[i][j] * table[j][i]\nprint(ans)\n", "code_v1_no_empty_lines": "N = input()\nm = len(N)\na0 = int(N[0])\na1 = int(N[-1])\nans = 0\nif m == 1:\n ans = int(N)\nelse:\n mid = (int(N[1:]) - a1) // 10\n t = 10 ** (m - 2)\n ans = 9\n ans += ((a0 - 1) * t) * 2\n ans += (mid + (a1 >= a0)) * 2\n ans += ((a0 - 1) * t) ** 2\n ans += ((mid * (a0 - 1) + min(a0 - 1, a1)) * t) * 2\n ans += (mid + (a1 >= a0)) ** 2\n if m >= 3:\n ans += (t - 1) * 2\n ans += ((a0 - 1) * (t - 1) * t) * 2\n ans += (mid * (t - 1)) * 2\n ans += (a1 * (t - 1) // 9) * 2\n ans += (t - 1) ** 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 38.4615384615, "diff": ["-N = int(input())", "-table = [[0] * 10 for i in range(10)]", "-for i in range(1, N + 1):", "- s = str(i)", "- id1 = int(s[0])", "- id2 = int(s[-1])", "- table[id1][id2] += 1", "+N = input()", "+m = len(N)", "+a0 = int(N[0])", "+a1 = int(N[-1])", "-for i in range(10):", "- for j in range(10):", "- ans += table[i][j] * table[j][i]", "+if m == 1:", "+ ans = int(N)", "+else:", "+ mid = (int(N[1:]) - a1) // 10", "+ t = 10 ** (m - 2)", "+ ans = 9", "+ ans += ((a0 - 1) * t) * 2", "+ ans += (mid + (a1 >= a0)) * 2", "+ ans += ((a0 - 1) * t) ** 2", "+ ans += ((mid * (a0 - 1) + min(a0 - 1, a1)) * t) * 2", "+ ans += (mid + (a1 >= a0)) ** 2", "+ if m >= 3:", "+ ans += (t - 1) * 2", "+ ans += ((a0 - 1) * (t - 1) * t) * 2", "+ ans += (mid * (t - 1)) * 2", "+ ans += (a1 * (t - 1) // 9) * 2", "+ ans += (t - 1) ** 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.589133962, "measured_runtime_v1": 0.3507217311, "runtime_lift": 1.6797760439, "key": ["s475401488", "s941984259"]} +{"user_id": "u450904670", "problem_id": "p03796", "language": "python", "submission_id_v0": "s280545626", "submission_id_v1": "s422534863", "cpu_time_v0": 73, "cpu_time_v1": 40, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.21, "input": "n = int(input())\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (pow(10,9) + 7)\n\nprint(res)", "target": "n = int(input())\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (10**9 + 7)\n\nprint(res)\n", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 114, "code_v1_num_chars": 115, "code_v0_no_empty_lines": "n = int(input())\nres = 1\nfor num in range(1, n + 1):\n res = res * num\n res = res % (pow(10, 9) + 7)\nprint(res)\n", "code_v1_no_empty_lines": "n = int(input())\nres = 1\nfor num in range(1, n + 1):\n res = res * num\n res = res % (10**9 + 7)\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- res = res % (pow(10, 9) + 7)", "+ res = res % (10**9 + 7)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4279417639, "measured_runtime_v1": 0.3313806841, "runtime_lift": 1.2913901876, "key": ["s280545626", "s422534863"]} +{"user_id": "u333190709", "problem_id": "p03371", "language": "python", "submission_id_v0": "s264866690", "submission_id_v1": "s762683898", "cpu_time_v0": 127, "cpu_time_v1": 17, "memory_v0": 5304, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 86.61, "input": "#!/usr/bin/env python3\n\nimport sys, math, math, itertools\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n mn = 1e9\n\n for i in range(0, 2*(max(X, Y)+1), 2):\n\n mn = min(mn, C*i+A*max(X-i//2, 0)+B*max(Y-i//2, 0))\n\n print((int(mn)))\n\n return\n\n\n\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n c = 0\n\n if (A + B < 2 * C):\n\n c += min(X, Y) * (A + B)\n\n else:\n\n c += min(X, Y) * 2 * C\n\n if X > Y:\n\n c += (X - Y) * min(A, 2 * C)\n\n else:\n\n c += (Y - X) * min(B, 2 * C)\n\n print(c)\n\n return\n\n\n\n\n\n# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 28, "code_v1_loc": 34, "code_v0_num_chars": 879, "code_v1_num_chars": 941, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nimport sys, math, math, itertools\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n mn = 1e9\n for i in range(0, 2 * (max(X, Y) + 1), 2):\n mn = min(mn, C * i + A * max(X - i // 2, 0) + B * max(Y - i // 2, 0))\n print((int(mn)))\n return\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n C = int(next(tokens)) # type: int\n X = int(next(tokens)) # type: int\n Y = int(next(tokens)) # type: int\n solve(A, B, C, X, Y)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n c = 0\n if A + B < 2 * C:\n c += min(X, Y) * (A + B)\n else:\n c += min(X, Y) * 2 * C\n if X > Y:\n c += (X - Y) * min(A, 2 * C)\n else:\n c += (Y - X) * min(B, 2 * C)\n print(c)\n return\n\n\n# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n C = int(next(tokens)) # type: int\n X = int(next(tokens)) # type: int\n Y = int(next(tokens)) # type: int\n solve(A, B, C, X, Y)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["-import sys, math, math, itertools", "+import sys", "- mn = 1e9", "- for i in range(0, 2 * (max(X, Y) + 1), 2):", "- mn = min(mn, C * i + A * max(X - i // 2, 0) + B * max(Y - i // 2, 0))", "- print((int(mn)))", "+ c = 0", "+ if A + B < 2 * C:", "+ c += min(X, Y) * (A + B)", "+ else:", "+ c += min(X, Y) * 2 * C", "+ if X > Y:", "+ c += (X - Y) * min(A, 2 * C)", "+ else:", "+ c += (Y - X) * min(B, 2 * C)", "+ print(c)", "-# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)", "+# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4482344875, "measured_runtime_v1": 0.3314408262, "runtime_lift": 1.3523816383, "key": ["s264866690", "s762683898"]} +{"user_id": "u498487134", "problem_id": "p02917", "language": "python", "submission_id_v0": "s303870321", "submission_id_v1": "s766724876", "cpu_time_v0": 162, "cpu_time_v1": 67, "memory_v0": 38256, "memory_v1": 61812, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.64, "input": "N = int(input())\n\nB =list(map(int,input().split()))\n\nA=[0]*N\n\n\n\nA[0]=B[0]\n\nfor i in range(1,N-1):\n\n A[i]=min(B[i],B[i-1])\n\nA[-1]=B[-1]\n\nprint((sum(A)))", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(input())\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N=I()\n\n B=LI()\n\n A=[0]*N\n\n A[0]=B[0]\n\n A[-1]=B[-1]\n\n for i in range(N-2):\n\n A[i+1]=min(B[i],B[i+1])\n\n \n\n print((sum(A)))\n\n\n\nmain()\n", "code_v0_loc": 9, "code_v1_loc": 20, "code_v0_num_chars": 152, "code_v1_num_chars": 363, "code_v0_no_empty_lines": "N = int(input())\nB = list(map(int, input().split()))\nA = [0] * N\nA[0] = B[0]\nfor i in range(1, N - 1):\n A[i] = min(B[i], B[i - 1])\nA[-1] = B[-1]\nprint((sum(A)))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N = I()\n B = LI()\n A = [0] * N\n A[0] = B[0]\n A[-1] = B[-1]\n for i in range(N - 2):\n A[i + 1] = min(B[i], B[i + 1])\n print((sum(A)))\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 55.0, "diff": ["-N = int(input())", "-B = list(map(int, input().split()))", "-A = [0] * N", "-A[0] = B[0]", "-for i in range(1, N - 1):", "- A[i] = min(B[i], B[i - 1])", "-A[-1] = B[-1]", "-print((sum(A)))", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def I():", "+ return int(input())", "+", "+", "+def MI():", "+ return list(map(int, input().split()))", "+", "+", "+def LI():", "+ return list(map(int, input().split()))", "+", "+", "+def main():", "+ mod = 10**9 + 7", "+ N = I()", "+ B = LI()", "+ A = [0] * N", "+ A[0] = B[0]", "+ A[-1] = B[-1]", "+ for i in range(N - 2):", "+ A[i + 1] = min(B[i], B[i + 1])", "+ print((sum(A)))", "+", "+", "+main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.251366816, "measured_runtime_v1": 0.147175539, "runtime_lift": 1.7079388172, "key": ["s303870321", "s766724876"]} +{"user_id": "u047796752", "problem_id": "p02700", "language": "python", "submission_id_v0": "s232689719", "submission_id_v1": "s065315130", "cpu_time_v0": 74, "cpu_time_v1": 57, "memory_v0": 64716, "memory_v1": 61776, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.97, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nA, B, C, D = list(map(int, input().split()))\n\n\n\nwhile True:\n\n C -= B\n\n \n\n if C<=0:\n\n print('Yes')\n\n exit()\n\n \n\n A -= D\n\n \n\n if A<=0:\n\n print('No')\n\n exit()", "target": "A, B, C, D = list(map(int, input().split()))\n\nc1 = (C+B-1)//B\n\nc2 = (A+D-1)//D\n\n\n\nif c1<=c2:\n\n print('Yes')\n\nelse:\n\n print('No')", "code_v0_loc": 18, "code_v1_loc": 8, "code_v0_num_chars": 267, "code_v1_num_chars": 128, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\nA, B, C, D = list(map(int, input().split()))\nwhile True:\n C -= B\n if C <= 0:\n print(\"Yes\")\n exit()\n A -= D\n if A <= 0:\n print(\"No\")\n exit()\n", "code_v1_no_empty_lines": "A, B, C, D = list(map(int, input().split()))\nc1 = (C + B - 1) // B\nc2 = (A + D - 1) // D\nif c1 <= c2:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-from collections import *", "-", "-while True:", "- C -= B", "- if C <= 0:", "- print(\"Yes\")", "- exit()", "- A -= D", "- if A <= 0:", "- print(\"No\")", "- exit()", "+c1 = (C + B - 1) // B", "+c2 = (A + D - 1) // D", "+if c1 <= c2:", "+ print(\"Yes\")", "+else:", "+ print(\"No\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2898896478, "measured_runtime_v1": 0.0638447898, "runtime_lift": 4.5405372711, "key": ["s232689719", "s065315130"]} +{"user_id": "u576432509", "problem_id": "p03575", "language": "python", "submission_id_v0": "s579377069", "submission_id_v1": "s043222526", "cpu_time_v0": 33, "cpu_time_v1": 26, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.21, "input": "icase=0\n\nif icase==0:\n\n n,m=list(map(int, input().split()))\n\n a=[]\n\n b=[]\n\n for i in range(m):\n\n ai,bi=list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\nelif icase==1:\n\n n=6\n\n m=5\n\n# a=[[1],[2],[3],[4],[5]]\n\n# b=[[2],[3],[4],[5],[6]]\n\n a=[1,2,3,4,5]\n\n b=[2,3,4,5,6]\n\nelif icase==2:\n\n n=7\n\n m=7\n\n a=[1,2,3,4,4,5,6]\n\n b=[3,7,4,5,6,6,7]\n\n\n\n \n\nvtx=[]\n\nfor i in range(n):\n\n vtx.append([i+1])\n\nicnt=0\n\n\n\nfor j in range(m): \n\n vtx1=vtx.copy()\n\n a1=a.copy()\n\n b1=b.copy()\n\n del a1[j]\n\n del b1[j]\n\n \n\n for i in range(m-1):\n\n for v1 in vtx1:\n\n if a1[i] in v1:\n\n if not b1[i] in v1:\n\n for v2 in vtx1:\n\n if v1!=v2:\n\n if b1[i] in v2:\n\n break\n\n vtx1.remove(v1)\n\n vtx1.remove(v2)\n\n v3=v1+v2\n\n vtx1.append(v3)\n\n# print(a[i],b[i],len(vtx1),vtx1)\n\n# print(len(vtx1),vtx1)\n\n if len(vtx1)!=1:\n\n icnt=icnt+1\n\nprint(icnt) ", "target": "limit=50\n\ngraph=[[False]*limit for i in range(limit)]\n\nvisited=[]*limit\n\n\n\ndef dfs(v,n,graph,visited):\n\n visited[v]=True\n\n for v2 in range(n):\n\n if graph[v][v2]==False:\n\n continue\n\n if visited[v2]==True:\n\n continue\n\n dfs(v2,n,graph,visited)\n\n\n\nn,m=list(map(int,input().split()))\n\na=[0]*m\n\nb=[0]*m\n\nfor i in range(m):\n\n ai,bi=list(map(int,input().split()))\n\n a[i]=ai-1\n\n b[i]=bi-1\n\n graph[a[i]][b[i]]=True\n\n graph[b[i]][a[i]]=True\n\n \n\nans=0 \n\nfor i in range(m):\n\n graph[a[i]][b[i]]=False\n\n graph[b[i]][a[i]]=False\n\n visited=[False]*n\n\n dfs(0,n,graph,visited)\n\n bridge=False\n\n for j in range(n):\n\n if visited[j]==False:\n\n bridge=True\n\n if bridge:\n\n ans+=1\n\n graph[a[i]][b[i]]=True\n\n graph[b[i]][a[i]]=True\n\n \n\nprint(ans)", "code_v0_loc": 52, "code_v1_loc": 39, "code_v0_num_chars": 1130, "code_v1_num_chars": 828, "code_v0_no_empty_lines": "icase = 0\nif icase == 0:\n n, m = list(map(int, input().split()))\n a = []\n b = []\n for i in range(m):\n ai, bi = list(map(int, input().split()))\n a.append(ai)\n b.append(bi)\nelif icase == 1:\n n = 6\n m = 5\n # a=[[1],[2],[3],[4],[5]]\n # b=[[2],[3],[4],[5],[6]]\n a = [1, 2, 3, 4, 5]\n b = [2, 3, 4, 5, 6]\nelif icase == 2:\n n = 7\n m = 7\n a = [1, 2, 3, 4, 4, 5, 6]\n b = [3, 7, 4, 5, 6, 6, 7]\nvtx = []\nfor i in range(n):\n vtx.append([i + 1])\nicnt = 0\nfor j in range(m):\n vtx1 = vtx.copy()\n a1 = a.copy()\n b1 = b.copy()\n del a1[j]\n del b1[j]\n for i in range(m - 1):\n for v1 in vtx1:\n if a1[i] in v1:\n if not b1[i] in v1:\n for v2 in vtx1:\n if v1 != v2:\n if b1[i] in v2:\n break\n vtx1.remove(v1)\n vtx1.remove(v2)\n v3 = v1 + v2\n vtx1.append(v3)\n # print(a[i],b[i],len(vtx1),vtx1)\n # print(len(vtx1),vtx1)\n if len(vtx1) != 1:\n icnt = icnt + 1\nprint(icnt)\n", "code_v1_no_empty_lines": "limit = 50\ngraph = [[False] * limit for i in range(limit)]\nvisited = [] * limit\n\n\ndef dfs(v, n, graph, visited):\n visited[v] = True\n for v2 in range(n):\n if graph[v][v2] == False:\n continue\n if visited[v2] == True:\n continue\n dfs(v2, n, graph, visited)\n\n\nn, m = list(map(int, input().split()))\na = [0] * m\nb = [0] * m\nfor i in range(m):\n ai, bi = list(map(int, input().split()))\n a[i] = ai - 1\n b[i] = bi - 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\nans = 0\nfor i in range(m):\n graph[a[i]][b[i]] = False\n graph[b[i]][a[i]] = False\n visited = [False] * n\n dfs(0, n, graph, visited)\n bridge = False\n for j in range(n):\n if visited[j] == False:\n bridge = True\n if bridge:\n ans += 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-icase = 0", "-if icase == 0:", "- n, m = list(map(int, input().split()))", "- a = []", "- b = []", "- for i in range(m):", "- ai, bi = list(map(int, input().split()))", "- a.append(ai)", "- b.append(bi)", "-elif icase == 1:", "- n = 6", "- m = 5", "- # a=[[1],[2],[3],[4],[5]]", "- # b=[[2],[3],[4],[5],[6]]", "- a = [1, 2, 3, 4, 5]", "- b = [2, 3, 4, 5, 6]", "-elif icase == 2:", "- n = 7", "- m = 7", "- a = [1, 2, 3, 4, 4, 5, 6]", "- b = [3, 7, 4, 5, 6, 6, 7]", "-vtx = []", "-for i in range(n):", "- vtx.append([i + 1])", "-icnt = 0", "-for j in range(m):", "- vtx1 = vtx.copy()", "- a1 = a.copy()", "- b1 = b.copy()", "- del a1[j]", "- del b1[j]", "- for i in range(m - 1):", "- for v1 in vtx1:", "- if a1[i] in v1:", "- if not b1[i] in v1:", "- for v2 in vtx1:", "- if v1 != v2:", "- if b1[i] in v2:", "- break", "- vtx1.remove(v1)", "- vtx1.remove(v2)", "- v3 = v1 + v2", "- vtx1.append(v3)", "- # print(a[i],b[i],len(vtx1),vtx1)", "- # print(len(vtx1),vtx1)", "- if len(vtx1) != 1:", "- icnt = icnt + 1", "-print(icnt)", "+limit = 50", "+graph = [[False] * limit for i in range(limit)]", "+visited = [] * limit", "+", "+", "+def dfs(v, n, graph, visited):", "+ visited[v] = True", "+ for v2 in range(n):", "+ if graph[v][v2] == False:", "+ continue", "+ if visited[v2] == True:", "+ continue", "+ dfs(v2, n, graph, visited)", "+", "+", "+n, m = list(map(int, input().split()))", "+a = [0] * m", "+b = [0] * m", "+for i in range(m):", "+ ai, bi = list(map(int, input().split()))", "+ a[i] = ai - 1", "+ b[i] = bi - 1", "+ graph[a[i]][b[i]] = True", "+ graph[b[i]][a[i]] = True", "+ans = 0", "+for i in range(m):", "+ graph[a[i]][b[i]] = False", "+ graph[b[i]][a[i]] = False", "+ visited = [False] * n", "+ dfs(0, n, graph, visited)", "+ bridge = False", "+ for j in range(n):", "+ if visited[j] == False:", "+ bridge = True", "+ if bridge:", "+ ans += 1", "+ graph[a[i]][b[i]] = True", "+ graph[b[i]][a[i]] = True", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3351877429, "measured_runtime_v1": 0.2583705549, "runtime_lift": 1.2973140188, "key": ["s579377069", "s043222526"]} +{"user_id": "u086503932", "problem_id": "p02814", "language": "python", "submission_id_v0": "s657535199", "submission_id_v1": "s415753878", "cpu_time_v0": 500, "cpu_time_v1": 202, "memory_v0": 16280, "memory_v1": 91128, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.6, "input": "#!/usr/bin/env python3\n\nimport sys\n\nfrom math import gcd\n\nimport math\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n tmp = 1\n\n count = None\n\n for i in range(N):\n\n tmp = (tmp * a[i]//2) // gcd(tmp,a[i]//2)\n\n c = 0\n\n n = a[i]//2\n\n while n % 2 == 0:\n\n c += 1\n\n n //= 2\n\n if i == 0:\n\n count = c\n\n elif count != c:\n\n print((0))\n\n exit()\n\n print(((M//tmp +1)//2))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "from math import gcd\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = [a//2 for a in A]\n\nLCM = 1\n\nfor i in range(N):\n\n LCM = LCM * B[i] // gcd(LCM, B[i])\n\nfor i in range(N):\n\n if LCM // B[i] % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((M//LCM + 1)//2))", "code_v0_loc": 26, "code_v1_loc": 13, "code_v0_num_chars": 527, "code_v1_num_chars": 293, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nimport sys\nfrom math import gcd\nimport math\n\n\ndef main():\n N, M = list(map(int, input().split()))\n a = list(map(int, input().split()))\n tmp = 1\n count = None\n for i in range(N):\n tmp = (tmp * a[i] // 2) // gcd(tmp, a[i] // 2)\n c = 0\n n = a[i] // 2\n while n % 2 == 0:\n c += 1\n n //= 2\n if i == 0:\n count = c\n elif count != c:\n print((0))\n exit()\n print(((M // tmp + 1) // 2))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from math import gcd\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = [a // 2 for a in A]\nLCM = 1\nfor i in range(N):\n LCM = LCM * B[i] // gcd(LCM, B[i])\nfor i in range(N):\n if LCM // B[i] % 2 == 0:\n print((0))\n exit()\nprint(((M // LCM + 1) // 2))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-#!/usr/bin/env python3", "-import sys", "-from math import gcd", "-import math", "+from math import gcd", "-", "-def main():", "- N, M = list(map(int, input().split()))", "- a = list(map(int, input().split()))", "- tmp = 1", "- count = None", "- for i in range(N):", "- tmp = (tmp * a[i] // 2) // gcd(tmp, a[i] // 2)", "- c = 0", "- n = a[i] // 2", "- while n % 2 == 0:", "- c += 1", "- n //= 2", "- if i == 0:", "- count = c", "- elif count != c:", "- print((0))", "- exit()", "- print(((M // tmp + 1) // 2))", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+N, M = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "+B = [a // 2 for a in A]", "+LCM = 1", "+for i in range(N):", "+ LCM = LCM * B[i] // gcd(LCM, B[i])", "+for i in range(N):", "+ if LCM // B[i] % 2 == 0:", "+ print((0))", "+ exit()", "+print(((M // LCM + 1) // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4621698339, "measured_runtime_v1": 0.3237110667, "runtime_lift": 1.4277233045, "key": ["s657535199", "s415753878"]} +{"user_id": "u433181015", "problem_id": "p02394", "language": "python", "submission_id_v0": "s560769298", "submission_id_v1": "s595626547", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7680, "memory_v1": 7728, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "a=input().split()\n\nb=list(map(int,a))\n\nW=b[0]\n\nH=b[1]\n\nx=b[2]\n\ny=b[3]\n\nr=b[4]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')", "target": "W,H,x,y,r = [int(i) for i in input().split()]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')", "code_v0_loc": 11, "code_v1_loc": 5, "code_v0_num_chars": 164, "code_v1_num_chars": 132, "code_v0_no_empty_lines": "a = input().split()\nb = list(map(int, a))\nW = b[0]\nH = b[1]\nx = b[2]\ny = b[3]\nr = b[4]\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "W, H, x, y, r = [int(i) for i in input().split()]\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 54.5454545455, "diff": ["-a = input().split()", "-b = list(map(int, a))", "-W = b[0]", "-H = b[1]", "-x = b[2]", "-y = b[3]", "-r = b[4]", "+W, H, x, y, r = [int(i) for i in input().split()]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3832537071, "measured_runtime_v1": 0.2996923448, "runtime_lift": 1.2788238128, "key": ["s560769298", "s595626547"]} +{"user_id": "u454022848", "problem_id": "p02394", "language": "python", "submission_id_v0": "s949778573", "submission_id_v1": "s992404688", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 6724, "memory_v1": 6432, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "ia = [int(i) for i in input().split(\" \")]\n\nW=ia[0]\n\nH=ia[1]\n\nx=ia[2]\n\ny=ia[3]\n\nr=ia[4]\n\nprint((\"Yes\" if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H else \"No\"))", "target": "# encoding:utf-8\n\n\n\ninput = list(map(int, input().split()))\n\nW, H, x, y, r = input\n\n\n\nif x - r < 0 or x + r > W:\n\n\tprint(\"No\")\n\nelif y - r < 0 or y + r > H:\n\n\tprint(\"No\")\n\nelse:\n\n\tprint(\"Yes\")", "code_v0_loc": 7, "code_v1_loc": 11, "code_v0_num_chars": 153, "code_v1_num_chars": 190, "code_v0_no_empty_lines": "ia = [int(i) for i in input().split(\" \")]\nW = ia[0]\nH = ia[1]\nx = ia[2]\ny = ia[3]\nr = ia[4]\nprint((\"Yes\" if 0 <= x - r and x + r <= W and 0 <= y - r and y + r <= H else \"No\"))\n", "code_v1_no_empty_lines": "# encoding:utf-8\ninput = list(map(int, input().split()))\nW, H, x, y, r = input\nif x - r < 0 or x + r > W:\n print(\"No\")\nelif y - r < 0 or y + r > H:\n print(\"No\")\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-ia = [int(i) for i in input().split(\" \")]", "-W = ia[0]", "-H = ia[1]", "-x = ia[2]", "-y = ia[3]", "-r = ia[4]", "-print((\"Yes\" if 0 <= x - r and x + r <= W and 0 <= y - r and y + r <= H else \"No\"))", "+# encoding:utf-8", "+input = list(map(int, input().split()))", "+W, H, x, y, r = input", "+if x - r < 0 or x + r > W:", "+ print(\"No\")", "+elif y - r < 0 or y + r > H:", "+ print(\"No\")", "+else:", "+ print(\"Yes\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.354291319, "measured_runtime_v1": 0.2815986323, "runtime_lift": 1.2581428969, "key": ["s949778573", "s992404688"]} +{"user_id": "u310381103", "problem_id": "p03457", "language": "python", "submission_id_v0": "s861400279", "submission_id_v1": "s171825130", "cpu_time_v0": 647, "cpu_time_v1": 294, "memory_v0": 63064, "memory_v1": 27216, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.56, "input": "N=input()\n\na=[]\n\nt=True\n\nfor _ in range(int(N)):\n\n a+=[list(map(int,input().split()))]\n\nfor i in range(int(N)):\n\n if a[i][0]%2==0:\n\n if abs(a[i][1]+a[i][2])<=a[i][0] and (a[i][1]+a[i][2])%2==0:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\n else:\n\n if abs(a[i][1]+a[i][2]<=a[i][0]) and (a[i][1]+a[i][2])%2==1:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\nif t:\n\n print('Yes')", "target": "import sys\n\nn=int(input())\n\nt=[]\n\nfor i in range(n):\n\n t.append(list(map(int,input().split())))\n\nfor i,d in enumerate(t):\n\n if i>0:\n\n b=d[0]-a\n\n c=abs(d[1]+d[2]-aa)\n\n a=d[0]\n\n aa=d[1]+d[2]\n\n if i==0:\n\n if not (a >= aa and a % 2 == aa % 2):\n\n print('No')\n\n sys.exit()\n\n else:\n\n continue\n\n if not (b>=c and b%2==c%2):\n\n print('No')\n\n sys.exit()\n\nprint('Yes')", "code_v0_loc": 22, "code_v1_loc": 21, "code_v0_num_chars": 516, "code_v1_num_chars": 449, "code_v0_no_empty_lines": "N = input()\na = []\nt = True\nfor _ in range(int(N)):\n a += [list(map(int, input().split()))]\nfor i in range(int(N)):\n if a[i][0] % 2 == 0:\n if abs(a[i][1] + a[i][2]) <= a[i][0] and (a[i][1] + a[i][2]) % 2 == 0:\n continue\n else:\n print(\"No\")\n t = False\n break\n else:\n if abs(a[i][1] + a[i][2] <= a[i][0]) and (a[i][1] + a[i][2]) % 2 == 1:\n continue\n else:\n print(\"No\")\n t = False\n break\nif t:\n print(\"Yes\")\n", "code_v1_no_empty_lines": "import sys\n\nn = int(input())\nt = []\nfor i in range(n):\n t.append(list(map(int, input().split())))\nfor i, d in enumerate(t):\n if i > 0:\n b = d[0] - a\n c = abs(d[1] + d[2] - aa)\n a = d[0]\n aa = d[1] + d[2]\n if i == 0:\n if not (a >= aa and a % 2 == aa % 2):\n print(\"No\")\n sys.exit()\n else:\n continue\n if not (b >= c and b % 2 == c % 2):\n print(\"No\")\n sys.exit()\nprint(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-N = input()", "-a = []", "-t = True", "-for _ in range(int(N)):", "- a += [list(map(int, input().split()))]", "-for i in range(int(N)):", "- if a[i][0] % 2 == 0:", "- if abs(a[i][1] + a[i][2]) <= a[i][0] and (a[i][1] + a[i][2]) % 2 == 0:", "+import sys", "+", "+n = int(input())", "+t = []", "+for i in range(n):", "+ t.append(list(map(int, input().split())))", "+for i, d in enumerate(t):", "+ if i > 0:", "+ b = d[0] - a", "+ c = abs(d[1] + d[2] - aa)", "+ a = d[0]", "+ aa = d[1] + d[2]", "+ if i == 0:", "+ if not (a >= aa and a % 2 == aa % 2):", "+ print(\"No\")", "+ sys.exit()", "+ else:", "- else:", "- print(\"No\")", "- t = False", "- break", "- else:", "- if abs(a[i][1] + a[i][2] <= a[i][0]) and (a[i][1] + a[i][2]) % 2 == 1:", "- continue", "- else:", "- print(\"No\")", "- t = False", "- break", "-if t:", "- print(\"Yes\")", "+ if not (b >= c and b % 2 == c % 2):", "+ print(\"No\")", "+ sys.exit()", "+print(\"Yes\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2371032157, "measured_runtime_v1": 0.0063223619, "runtime_lift": 37.5023159605, "key": ["s861400279", "s171825130"]} +{"user_id": "u576432509", "problem_id": "p03371", "language": "python", "submission_id_v0": "s537618501", "submission_id_v1": "s493344814", "cpu_time_v0": 215, "cpu_time_v1": 122, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.26, "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nyenmin=a*x+b*y\n\nfor zz in range(2*10**5+1):\n\n xx=max(x-zz//2,0)\n\n yy=max(y-zz//2,0)\n\n yen=a*xx+b*yy+c*zz\n\n if yen d[v]+cost:\n\n d[to] = d[v]+cost\n\n par[to] = v\n\n que.put((d[to],to))\n\n\n\n for j in range(n):\n\n if i != j:\n\n a,b = j,par[j]\n\n if a>b:\n\n a,b = b,a\n\n used.add((a,b))\n\n\n\n print((m - len(used)))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "INF = 123456789\n\n\n\ndef main():\n\n n,m = list(map(int,input().split()))\n\n\n\n d = [ [INF for i in range(n)] for j in range(n) ]\n\n for i in range(n):\n\n d[i][i] = 0\n\n\n\n a = [0 for _ in range(m)]\n\n b = [0 for _ in range(m)]\n\n c = [0 for _ in range(m)]\n\n for i in range(m):\n\n a[i],b[i],c[i] = list(map(int,input().split()))\n\n a[i] -= 1\n\n b[i] -= 1\n\n d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])\n\n d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])\n\n\n\n # Warshall-Floyd\n\n for k in range(n):\n\n for i in range(n):\n\n for j in range(n):\n\n d[i][j] = min(d[i][j], d[i][k]+d[k][j])\n\n\n\n ans = 0\n\n for i in range(m):\n\n found = 1\n\n for j in range(n):\n\n if d[j][a[i]] + c[i] == d[j][b[i]]:\n\n found = 0\n\n break\n\n ans += found\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 46, "code_v1_loc": 37, "code_v0_num_chars": 1060, "code_v1_num_chars": 907, "code_v0_no_empty_lines": "import queue\n\nINF = 123456789\n\n\ndef main():\n n, m = list(map(int, input().split()))\n G = [[] for _ in range(n)]\n for _ in range(m):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n G[a].append((b, c))\n G[b].append((a, c))\n used = set()\n for i in range(n):\n d = [INF for _ in range(n)]\n par = [-1 for _ in range(n)]\n # dijkstra\n que = queue.PriorityQueue()\n d[i] = 0\n que.put((0, i))\n while not que.empty():\n p = que.get()\n v = p[1]\n if d[v] < p[0]:\n continue\n for (to, cost) in G[v]:\n if d[to] > d[v] + cost:\n d[to] = d[v] + cost\n par[to] = v\n que.put((d[to], to))\n for j in range(n):\n if i != j:\n a, b = j, par[j]\n if a > b:\n a, b = b, a\n used.add((a, b))\n print((m - len(used)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "INF = 123456789\n\n\ndef main():\n n, m = list(map(int, input().split()))\n d = [[INF for i in range(n)] for j in range(n)]\n for i in range(n):\n d[i][i] = 0\n a = [0 for _ in range(m)]\n b = [0 for _ in range(m)]\n c = [0 for _ in range(m)]\n for i in range(m):\n a[i], b[i], c[i] = list(map(int, input().split()))\n a[i] -= 1\n b[i] -= 1\n d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])\n d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])\n # Warshall-Floyd\n for k in range(n):\n for i in range(n):\n for j in range(n):\n d[i][j] = min(d[i][j], d[i][k] + d[k][j])\n ans = 0\n for i in range(m):\n found = 1\n for j in range(n):\n if d[j][a[i]] + c[i] == d[j][b[i]]:\n found = 0\n break\n ans += found\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 19.5652173913, "diff": ["-import queue", "-", "- G = [[] for _ in range(n)]", "- for _ in range(m):", "- a, b, c = list(map(int, input().split()))", "- a -= 1", "- b -= 1", "- G[a].append((b, c))", "- G[b].append((a, c))", "- used = set()", "+ d = [[INF for i in range(n)] for j in range(n)]", "- d = [INF for _ in range(n)]", "- par = [-1 for _ in range(n)]", "- # dijkstra", "- que = queue.PriorityQueue()", "- d[i] = 0", "- que.put((0, i))", "- while not que.empty():", "- p = que.get()", "- v = p[1]", "- if d[v] < p[0]:", "- continue", "- for (to, cost) in G[v]:", "- if d[to] > d[v] + cost:", "- d[to] = d[v] + cost", "- par[to] = v", "- que.put((d[to], to))", "+ d[i][i] = 0", "+ a = [0 for _ in range(m)]", "+ b = [0 for _ in range(m)]", "+ c = [0 for _ in range(m)]", "+ for i in range(m):", "+ a[i], b[i], c[i] = list(map(int, input().split()))", "+ a[i] -= 1", "+ b[i] -= 1", "+ d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])", "+ d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])", "+ # Warshall-Floyd", "+ for k in range(n):", "+ for i in range(n):", "+ for j in range(n):", "+ d[i][j] = min(d[i][j], d[i][k] + d[k][j])", "+ ans = 0", "+ for i in range(m):", "+ found = 1", "- if i != j:", "- a, b = j, par[j]", "- if a > b:", "- a, b = b, a", "- used.add((a, b))", "- print((m - len(used)))", "+ if d[j][a[i]] + c[i] == d[j][b[i]]:", "+ found = 0", "+ break", "+ ans += found", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3167709551, "measured_runtime_v1": 0.2522355395, "runtime_lift": 1.2558537773, "key": ["s032580281", "s724625000"]} +{"user_id": "u282228874", "problem_id": "p03416", "language": "python", "submission_id_v0": "s105404887", "submission_id_v1": "s977655968", "cpu_time_v0": 128, "cpu_time_v1": 48, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 62.5, "input": "a,b = list(map(int,input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n s = str(i)\n\n l = len(s)\n\n if all(s[j] == s[l-j-1] for j in range(l)):\n\n count += 1\n\nprint(count)", "target": "a,b = list(map(int,input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n s = str(i)\n\n if s == s[::-1]:\n\n count += 1\n\nprint(count)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 184, "code_v1_num_chars": 138, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n s = str(i)\n l = len(s)\n if all(s[j] == s[l - j - 1] for j in range(l)):\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- l = len(s)", "- if all(s[j] == s[l - j - 1] for j in range(l)):", "+ if s == s[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5951726662, "measured_runtime_v1": 0.34452695, "runtime_lift": 1.72750685, "key": ["s105404887", "s977655968"]} +{"user_id": "u156815136", "problem_id": "p02921", "language": "python", "submission_id_v0": "s427233353", "submission_id_v1": "s366680967", "cpu_time_v0": 35, "cpu_time_v1": 17, "memory_v0": 5048, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 51.43, "input": "import itertools\n\nimport math\n\ndef main():\n\n s = input()\n\n t = input()\n\n cnt = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n cnt += 1\n\n print(cnt)\n\nif __name__ == '__main__':\n\n main()", "target": "s = input()\n\nt = input()\n\nans = 0\n\nfor i in range(3):\n\n if s[i] == t[i]:\n\n ans += 1\n\nprint(ans)\n", "code_v0_loc": 12, "code_v1_loc": 7, "code_v0_num_chars": 200, "code_v1_num_chars": 106, "code_v0_no_empty_lines": "import itertools\nimport math\n\n\ndef main():\n s = input()\n t = input()\n cnt = 0\n for i in range(3):\n if s[i] == t[i]:\n cnt += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "s = input()\nt = input()\nans = 0\nfor i in range(3):\n if s[i] == t[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.6666666667, "diff": ["-import itertools", "-import math", "-", "-", "-def main():", "- s = input()", "- t = input()", "- cnt = 0", "- for i in range(3):", "- if s[i] == t[i]:", "- cnt += 1", "- print(cnt)", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+s = input()", "+t = input()", "+ans = 0", "+for i in range(3):", "+ if s[i] == t[i]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.370313344, "measured_runtime_v1": 0.278846802, "runtime_lift": 1.3280171813, "key": ["s427233353", "s366680967"]} +{"user_id": "u057109575", "problem_id": "p03579", "language": "python", "submission_id_v0": "s986959512", "submission_id_v1": "s945473888", "cpu_time_v0": 918, "cpu_time_v1": 684, "memory_v0": 108376, "memory_v1": 76248, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.49, "input": "import sys\n\nsys.setrecursionlimit(100000)\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(v, c):\n\n # c: color = 1 or -1\n\n node[v] = c\n\n for i in graph[v]:\n\n if node[i] == c:\n\n return False\n\n \n\n if node[i] == 0 and not dfs(i, -c):\n\n return False\n\n \n\n return True\n\n\n\nnode = [0] * N\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in node) // 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) // 2 - M))\n", "target": "from collections import deque\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(s, c):\n\n q = deque()\n\n q.append(s)\n\n visited[s] = True\n\n color[s] = c\n\n \n\n while len(q) > 0:\n\n v = q.pop()\n\n for i in graph[v]:\n\n if visited[i] and color[i] == color[v]:\n\n return False\n\n \n\n if not visited[i]:\n\n visited[i] = True\n\n color[i] = -color[v]\n\n q.append(i)\n\n \n\n return True\n\n\n\nvisited = [False] * N\n\ncolor = [0] * N\n\n\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in color) // 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) // 2 - M))\n\n \n\n ", "code_v0_loc": 28, "code_v1_loc": 38, "code_v0_num_chars": 640, "code_v1_num_chars": 858, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(100000)\nN, M = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N)]\nfor x, y in edges:\n graph[x - 1].append(y - 1)\n graph[y - 1].append(x - 1)\n\n\ndef dfs(v, c):\n # c: color = 1 or -1\n node[v] = c\n for i in graph[v]:\n if node[i] == c:\n return False\n if node[i] == 0 and not dfs(i, -c):\n return False\n return True\n\n\nnode = [0] * N\nif dfs(0, 1):\n x = sum(v + 1 for v in node) // 2\n print((x * (N - x) - M))\nelse:\n print((N * (N - 1) // 2 - M))\n", "code_v1_no_empty_lines": "from collections import deque\n\nN, M = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N)]\nfor x, y in edges:\n graph[x - 1].append(y - 1)\n graph[y - 1].append(x - 1)\n\n\ndef dfs(s, c):\n q = deque()\n q.append(s)\n visited[s] = True\n color[s] = c\n while len(q) > 0:\n v = q.pop()\n for i in graph[v]:\n if visited[i] and color[i] == color[v]:\n return False\n if not visited[i]:\n visited[i] = True\n color[i] = -color[v]\n q.append(i)\n return True\n\n\nvisited = [False] * N\ncolor = [0] * N\nif dfs(0, 1):\n x = sum(v + 1 for v in color) // 2\n print((x * (N - x) - M))\nelse:\n print((N * (N - 1) // 2 - M))\n", "code_same": false, "relative_loc_diff_percent": 26.3157894737, "diff": ["-import sys", "+from collections import deque", "-sys.setrecursionlimit(100000)", "-def dfs(v, c):", "- # c: color = 1 or -1", "- node[v] = c", "- for i in graph[v]:", "- if node[i] == c:", "- return False", "- if node[i] == 0 and not dfs(i, -c):", "- return False", "+def dfs(s, c):", "+ q = deque()", "+ q.append(s)", "+ visited[s] = True", "+ color[s] = c", "+ while len(q) > 0:", "+ v = q.pop()", "+ for i in graph[v]:", "+ if visited[i] and color[i] == color[v]:", "+ return False", "+ if not visited[i]:", "+ visited[i] = True", "+ color[i] = -color[v]", "+ q.append(i)", "-node = [0] * N", "+visited = [False] * N", "+color = [0] * N", "- x = sum(v + 1 for v in node) // 2", "+ x = sum(v + 1 for v in color) // 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2537954175, "measured_runtime_v1": 0.006062909, "runtime_lift": 41.8603372027, "key": ["s986959512", "s945473888"]} +{"user_id": "u426534722", "problem_id": "p02248", "language": "python", "submission_id_v0": "s909106276", "submission_id_v1": "s961733692", "cpu_time_v0": 910, "cpu_time_v1": 790, "memory_v0": 117852, "memory_v1": 117860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.19, "input": "def kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return nx\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = input()\n\nP = input()\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n", "target": "def kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return tuple(nx)\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = input()\n\nP = input()\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n", "code_v0_loc": 36, "code_v1_loc": 36, "code_v0_num_chars": 860, "code_v1_num_chars": 867, "code_v0_no_empty_lines": "def kmpTable(w):\n lw = len(w)\n nx = [-1] * (lw + 1)\n j = -1\n for i in range(lw):\n while j >= 0 and w[i] != w[j]:\n j = nx[j]\n j += 1\n nx[i + 1] = j\n return nx\n\n\ndef kmpSearch(s, w):\n ls = len(s)\n start = 0\n w_idx = 0\n ret = []\n nx = kmpTable(w)\n while start + w_idx < ls:\n if s[start + w_idx] == w[w_idx]:\n w_idx += 1\n if w_idx == len(w):\n ret.append(start)\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n else:\n if w_idx == 0:\n start += 1\n else:\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n return ret\n\n\nT = input()\nP = input()\nans = kmpSearch(T, P)\nif ans:\n print((\"\\n\".join(map(str, ans))))\n", "code_v1_no_empty_lines": "def kmpTable(w):\n lw = len(w)\n nx = [-1] * (lw + 1)\n j = -1\n for i in range(lw):\n while j >= 0 and w[i] != w[j]:\n j = nx[j]\n j += 1\n nx[i + 1] = j\n return tuple(nx)\n\n\ndef kmpSearch(s, w):\n ls = len(s)\n start = 0\n w_idx = 0\n ret = []\n nx = kmpTable(w)\n while start + w_idx < ls:\n if s[start + w_idx] == w[w_idx]:\n w_idx += 1\n if w_idx == len(w):\n ret.append(start)\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n else:\n if w_idx == 0:\n start += 1\n else:\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n return ret\n\n\nT = input()\nP = input()\nans = kmpSearch(T, P)\nif ans:\n print((\"\\n\".join(map(str, ans))))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- return nx", "+ return tuple(nx)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.215319014, "measured_runtime_v1": 0.1265300495, "runtime_lift": 1.7017223565, "key": ["s909106276", "s961733692"]} +{"user_id": "u312025627", "problem_id": "p03457", "language": "python", "submission_id_v0": "s103328073", "submission_id_v1": "s130173321", "cpu_time_v0": 250, "cpu_time_v1": 183, "memory_v0": 55644, "memory_v1": 21108, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.8, "input": "def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time, px, py = 0, 0, 0\n\n for t, x, y in TXY:\n\n move = abs(x-px) + abs(y-py)\n\n # print(move, t-time)\n\n if (t - time) % 2 != move % 2 or t - time < move:\n\n return print(\"No\")\n\n time, px, py = t, x, y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time = 0\n\n px = 0\n\n py = 0\n\n for t, x, y in TXY:\n\n move = abs(py-y) + abs(px - x)\n\n if (t-time) < move or (t - time) % 2 != move % 2:\n\n return print(\"No\")\n\n time = t\n\n px = x\n\n py = y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 17, "code_v1_loc": 20, "code_v0_num_chars": 461, "code_v1_num_chars": 460, "code_v0_no_empty_lines": "def main():\n import sys\n\n input = sys.stdin.buffer.readline\n N = int(input())\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n time, px, py = 0, 0, 0\n for t, x, y in TXY:\n move = abs(x - px) + abs(y - py)\n # print(move, t-time)\n if (t - time) % 2 != move % 2 or t - time < move:\n return print(\"No\")\n time, px, py = t, x, y\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n import sys\n\n input = sys.stdin.buffer.readline\n N = int(input())\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n time = 0\n px = 0\n py = 0\n for t, x, y in TXY:\n move = abs(py - y) + abs(px - x)\n if (t - time) < move or (t - time) % 2 != move % 2:\n return print(\"No\")\n time = t\n px = x\n py = y\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["- time, px, py = 0, 0, 0", "+ time = 0", "+ px = 0", "+ py = 0", "- move = abs(x - px) + abs(y - py)", "- # print(move, t-time)", "- if (t - time) % 2 != move % 2 or t - time < move:", "+ move = abs(py - y) + abs(px - x)", "+ if (t - time) < move or (t - time) % 2 != move % 2:", "- time, px, py = t, x, y", "+ time = t", "+ px = x", "+ py = y"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3387642326, "measured_runtime_v1": 0.1945750663, "runtime_lift": 1.7410464712, "key": ["s103328073", "s130173321"]} +{"user_id": "u637175065", "problem_id": "p03553", "language": "python", "submission_id_v0": "s305170925", "submission_id_v1": "s833575440", "cpu_time_v0": 88, "cpu_time_v1": 46, "memory_v0": 7240, "memory_v1": 10956, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.73, "input": "import math,string,itertools,math,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf = 10**20\n\neps = 1.0 / 10**15\n\nmod = 10**9+7\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef F(): return float(sys.stdin.readline())\n\ndef S(): return input()\n\ndef pf(s): return print(s, flush=True)\n\ndef divisions(n):\n\n sq = int(math.sqrt(n)+1)\n\n d = collections.defaultdict(int)\n\n while n % 2 == 0:\n\n n //= 2\n\n d[2] += 1\n\n i = 3\n\n while n > 1 and sq >= i:\n\n if n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n else:\n\n i += 2\n\n\n\n if n > 1:\n\n d[n] += 1\n\n\n\n r = [1]\n\n for k, v in d.items():\n\n for c in r[:]:\n\n for i in range(1,v+1):\n\n r.append(c*(k**i))\n\n\n\n return sorted(r)\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n s = set()\n\n for i in range(n,0,-1):\n\n d = divisions(i)\n\n ld = len(d)\n\n for j in range(1,2**ld):\n\n c = []\n\n ff = True\n\n for k in range(ld):\n\n if j & (1< 0:\n\n e[c][i] -= k\n\n e[i][c] += k\n\n return k\n\n return 0\n\n\n\n while True:\n\n self.v = [None] * self.N\n\n fs = f(s, inf)\n\n if fs == 0:\n\n break\n\n r += fs\n\n\n\n return r\n\n\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n\n\n s = n\n\n t = n + 1\n\n e = [[0] * (n+2) for _ in range(n+2)]\n\n for i in range(n):\n\n c = a[i]\n\n if c < 0:\n\n e[s][i] = -c\n\n ii = i + 1\n\n for j in range(ii*2, n+1, ii):\n\n e[i][j-1] = inf\n\n else:\n\n e[i][t] = c\n\n\n\n\n\n fl = Flow(e, n+2)\n\n r = fl.max_flow(s,t)\n\n\n\n return sum(map(lambda x: max(0,x), a)) - r\n\n\n\n# start = time.time()\n\nprint(main())\n\n# pe(time.time() - start)\n\n\n\n\n\n\n", "code_v0_loc": 92, "code_v1_loc": 89, "code_v0_num_chars": 2351, "code_v1_num_chars": 2252, "code_v0_no_empty_lines": "import math, string, itertools, math, heapq, collections, re, array, bisect, sys, random, time, copy, functools\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**15\nmod = 10**9 + 7\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef F():\n return float(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\ndef pf(s):\n return print(s, flush=True)\n\n\ndef divisions(n):\n sq = int(math.sqrt(n) + 1)\n d = collections.defaultdict(int)\n while n % 2 == 0:\n n //= 2\n d[2] += 1\n i = 3\n while n > 1 and sq >= i:\n if n % i == 0:\n n //= i\n d[i] += 1\n else:\n i += 2\n if n > 1:\n d[n] += 1\n r = [1]\n for k, v in d.items():\n for c in r[:]:\n for i in range(1, v + 1):\n r.append(c * (k**i))\n return sorted(r)\n\n\ndef main():\n n = I()\n a = LI()\n s = set()\n for i in range(n, 0, -1):\n d = divisions(i)\n ld = len(d)\n for j in range(1, 2**ld):\n c = []\n ff = True\n for k in range(ld):\n if j & (1 << k):\n f = True\n for e in c:\n if d[k] % e == 0:\n f = False\n ff = False\n break\n if f:\n c.append(d[k])\n if not ff:\n break\n if ff:\n s.add(tuple(c + [n + 1]))\n b = sorted(list(s), reverse=True)\n for c in b:\n t = 0\n for j in range(1, n + 1):\n f = False\n for e in c:\n if j % e == 0:\n f = True\n break\n if f:\n t += a[j - 1]\n if t < 0:\n for j in range(1, n + 1):\n f = False\n for e in c:\n if j % e == 0:\n f = True\n break\n if f:\n a[j - 1] = 0\n return sum(a)\n\n\nprint(main())\n", "code_v1_no_empty_lines": "import math, string, itertools, math, heapq, collections, re, array, bisect, sys, copy, functools\nimport time, random\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**10\nmod = 10**9 + 7\nmod2 = 998244353\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LLI():\n return [list(map(int, l.split())) for l in sys.stdin.readlines()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef F():\n return float(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\ndef pf(s):\n return print(s, flush=True)\n\n\ndef pe(s):\n return print(str(s), file=sys.stderr)\n\n\ndef JA(a, sep):\n return sep.join(map(str, a))\n\n\ndef JAA(a, s, t):\n return s.join(t.join(map(str, b)) for b in a)\n\n\nclass Flow:\n def __init__(self, e, N):\n self.E = e\n self.N = N\n\n def max_flow(self, s, t):\n r = 0\n e = self.E\n\n def f(c, cap):\n v = self.v\n v[c] = 1\n if c == t:\n return cap\n for i in range(self.N):\n if v[i] or e[c][i] <= 0:\n continue\n cp = min(cap, e[c][i])\n k = f(i, cp)\n if k > 0:\n e[c][i] -= k\n e[i][c] += k\n return k\n return 0\n\n while True:\n self.v = [None] * self.N\n fs = f(s, inf)\n if fs == 0:\n break\n r += fs\n return r\n\n\ndef main():\n n = I()\n a = LI()\n s = n\n t = n + 1\n e = [[0] * (n + 2) for _ in range(n + 2)]\n for i in range(n):\n c = a[i]\n if c < 0:\n e[s][i] = -c\n ii = i + 1\n for j in range(ii * 2, n + 1, ii):\n e[i][j - 1] = inf\n else:\n e[i][t] = c\n fl = Flow(e, n + 2)\n r = fl.max_flow(s, t)\n return sum(map(lambda x: max(0, x), a)) - r\n\n\n# start = time.time()\nprint(main())\n# pe(time.time() - start)\n", "code_same": false, "relative_loc_diff_percent": 3.2608695652, "diff": ["-import math, string, itertools, math, heapq, collections, re, array, bisect, sys, random, time, copy, functools", "+import math, string, itertools, math, heapq, collections, re, array, bisect, sys, copy, functools", "+import time, random", "-eps = 1.0 / 10**15", "+eps = 1.0 / 10**10", "+mod2 = 998244353", "+dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]", "+ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]", "- return [int(x) for x in sys.stdin.readline().split()]", "+ return list(map(int, sys.stdin.readline().split()))", "+", "+", "+def LLI():", "+ return [list(map(int, l.split())) for l in sys.stdin.readlines()]", "-def divisions(n):", "- sq = int(math.sqrt(n) + 1)", "- d = collections.defaultdict(int)", "- while n % 2 == 0:", "- n //= 2", "- d[2] += 1", "- i = 3", "- while n > 1 and sq >= i:", "- if n % i == 0:", "- n //= i", "- d[i] += 1", "- else:", "- i += 2", "- if n > 1:", "- d[n] += 1", "- r = [1]", "- for k, v in d.items():", "- for c in r[:]:", "- for i in range(1, v + 1):", "- r.append(c * (k**i))", "- return sorted(r)", "+def pe(s):", "+ return print(str(s), file=sys.stderr)", "+", "+", "+def JA(a, sep):", "+ return sep.join(map(str, a))", "+", "+", "+def JAA(a, s, t):", "+ return s.join(t.join(map(str, b)) for b in a)", "+", "+", "+class Flow:", "+ def __init__(self, e, N):", "+ self.E = e", "+ self.N = N", "+", "+ def max_flow(self, s, t):", "+ r = 0", "+ e = self.E", "+", "+ def f(c, cap):", "+ v = self.v", "+ v[c] = 1", "+ if c == t:", "+ return cap", "+ for i in range(self.N):", "+ if v[i] or e[c][i] <= 0:", "+ continue", "+ cp = min(cap, e[c][i])", "+ k = f(i, cp)", "+ if k > 0:", "+ e[c][i] -= k", "+ e[i][c] += k", "+ return k", "+ return 0", "+", "+ while True:", "+ self.v = [None] * self.N", "+ fs = f(s, inf)", "+ if fs == 0:", "+ break", "+ r += fs", "+ return r", "- s = set()", "- for i in range(n, 0, -1):", "- d = divisions(i)", "- ld = len(d)", "- for j in range(1, 2**ld):", "- c = []", "- ff = True", "- for k in range(ld):", "- if j & (1 << k):", "- f = True", "- for e in c:", "- if d[k] % e == 0:", "- f = False", "- ff = False", "- break", "- if f:", "- c.append(d[k])", "- if not ff:", "- break", "- if ff:", "- s.add(tuple(c + [n + 1]))", "- b = sorted(list(s), reverse=True)", "- for c in b:", "- t = 0", "- for j in range(1, n + 1):", "- f = False", "- for e in c:", "- if j % e == 0:", "- f = True", "- break", "- if f:", "- t += a[j - 1]", "- if t < 0:", "- for j in range(1, n + 1):", "- f = False", "- for e in c:", "- if j % e == 0:", "- f = True", "- break", "- if f:", "- a[j - 1] = 0", "- return sum(a)", "+ s = n", "+ t = n + 1", "+ e = [[0] * (n + 2) for _ in range(n + 2)]", "+ for i in range(n):", "+ c = a[i]", "+ if c < 0:", "+ e[s][i] = -c", "+ ii = i + 1", "+ for j in range(ii * 2, n + 1, ii):", "+ e[i][j - 1] = inf", "+ else:", "+ e[i][t] = c", "+ fl = Flow(e, n + 2)", "+ r = fl.max_flow(s, t)", "+ return sum(map(lambda x: max(0, x), a)) - r", "+# start = time.time()", "+# pe(time.time() - start)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2170818343, "measured_runtime_v1": 0.0062613072, "runtime_lift": 34.670369248, "key": ["s305170925", "s833575440"]} +{"user_id": "u096128910", "problem_id": "p02881", "language": "python", "submission_id_v0": "s987616882", "submission_id_v1": "s695744152", "cpu_time_v0": 126, "cpu_time_v1": 81, "memory_v0": 66508, "memory_v1": 64160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 35.71, "input": "N = int(input())\n\nans = N - 1\n\np = 1\n\nfor i in range(2, int((N ** 0.5) + 1)):\n\n if p % 2 == 1 and i > (N ** 0.5):\n\n break\n\n if N % i == 0:\n\n p = i\n\n j = N // i\n\n m = i + j - 2\n\n if m < ans:\n\n ans = m\n\n else:\n\n continue\n\n else:\n\n continue\n\nprint(ans)\n", "target": "N = int(input())\n\nans = N - 1\n\nfor i in range(2, int((N ** 0.5) + 1)):\n\n if N % i == 0:\n\n j = N // i\n\n m = i + j - 2\n\n ans = min(ans, m)\n\nprint(ans)\n", "code_v0_loc": 17, "code_v1_loc": 8, "code_v0_num_chars": 330, "code_v1_num_chars": 173, "code_v0_no_empty_lines": "N = int(input())\nans = N - 1\np = 1\nfor i in range(2, int((N**0.5) + 1)):\n if p % 2 == 1 and i > (N**0.5):\n break\n if N % i == 0:\n p = i\n j = N // i\n m = i + j - 2\n if m < ans:\n ans = m\n else:\n continue\n else:\n continue\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nans = N - 1\nfor i in range(2, int((N**0.5) + 1)):\n if N % i == 0:\n j = N // i\n m = i + j - 2\n ans = min(ans, m)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 52.9411764706, "diff": ["-p = 1", "- if p % 2 == 1 and i > (N**0.5):", "- break", "- p = i", "- if m < ans:", "- ans = m", "- else:", "- continue", "- else:", "- continue", "+ ans = min(ans, m)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3775834899, "measured_runtime_v1": 0.2214011464, "runtime_lift": 1.7054269863, "key": ["s987616882", "s695744152"]} +{"user_id": "u408071652", "problem_id": "p03078", "language": "python", "submission_id_v0": "s229462844", "submission_id_v1": "s240353408", "cpu_time_v0": 159, "cpu_time_v1": 114, "memory_v0": 72796, "memory_v1": 80804, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.3, "input": "import sys\n\nimport heapq\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n Q = []\n\n S = set()\n\n heapq.heapify(Q)\n\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n\n for i in range(K):\n\n m, a, b, c = heapq.heappop(Q)\n\n print((-m))\n\n if (a + 1, b, c) not in S and a + 1 < X:\n\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n\n S.add((a + 1, b, c))\n\n if (a, b + 1, c) not in S and b + 1 < Y:\n\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n\n S.add((a, b + 1, c))\n\n if (a, b, c + 1) not in S and c + 1 < Z:\n\n heapq.heappush(Q, (-A[a ] - B[b] - C[c+1], a, b, c + 1))\n\n S.add((a, b, c + 1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "import sys\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n L = []\n\n\n\n for i in range(X):\n\n for j in range(min(Y, K // (i + 1) + 1)):\n\n for k in range(min(Z, K // (i + 1) // (j + 1) + 1)):\n\n L.append(A[i] + B[j] + C[k])\n\n\n\n L.sort(reverse=True)\n\n\n\n for i in range(K):\n\n print((L[i]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 39, "code_v1_loc": 33, "code_v0_num_chars": 1051, "code_v1_num_chars": 663, "code_v0_no_empty_lines": "import sys\nimport heapq\n\n# \\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n X, Y, Z, K = list(map(int, input().split()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n C = list(map(int, input().split()))\n A.sort(reverse=True)\n B.sort(reverse=True)\n C.sort(reverse=True)\n Q = []\n S = set()\n heapq.heapify(Q)\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n for i in range(K):\n m, a, b, c = heapq.heappop(Q)\n print((-m))\n if (a + 1, b, c) not in S and a + 1 < X:\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n S.add((a + 1, b, c))\n if (a, b + 1, c) not in S and b + 1 < Y:\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n S.add((a, b + 1, c))\n if (a, b, c + 1) not in S and c + 1 < Z:\n heapq.heappush(Q, (-A[a] - B[b] - C[c + 1], a, b, c + 1))\n S.add((a, b, c + 1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\n# \\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n X, Y, Z, K = list(map(int, input().split()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n C = list(map(int, input().split()))\n A.sort(reverse=True)\n B.sort(reverse=True)\n C.sort(reverse=True)\n L = []\n for i in range(X):\n for j in range(min(Y, K // (i + 1) + 1)):\n for k in range(min(Z, K // (i + 1) // (j + 1) + 1)):\n L.append(A[i] + B[j] + C[k])\n L.sort(reverse=True)\n for i in range(K):\n print((L[i]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["-import heapq", "- Q = []", "- S = set()", "- heapq.heapify(Q)", "- heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))", "+ L = []", "+ for i in range(X):", "+ for j in range(min(Y, K // (i + 1) + 1)):", "+ for k in range(min(Z, K // (i + 1) // (j + 1) + 1)):", "+ L.append(A[i] + B[j] + C[k])", "+ L.sort(reverse=True)", "- m, a, b, c = heapq.heappop(Q)", "- print((-m))", "- if (a + 1, b, c) not in S and a + 1 < X:", "- heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))", "- S.add((a + 1, b, c))", "- if (a, b + 1, c) not in S and b + 1 < Y:", "- heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))", "- S.add((a, b + 1, c))", "- if (a, b, c + 1) not in S and c + 1 < Z:", "- heapq.heappush(Q, (-A[a] - B[b] - C[c + 1], a, b, c + 1))", "- S.add((a, b, c + 1))", "+ print((L[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3053240893, "measured_runtime_v1": 0.1252524042, "runtime_lift": 2.4376704877, "key": ["s229462844", "s240353408"]} +{"user_id": "u599547273", "problem_id": "p03494", "language": "python", "submission_id_v0": "s252753387", "submission_id_v1": "s505612116", "cpu_time_v0": 21, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.29, "input": "def two_count(x):\n\n\tif int(str(x)[-1]) % 2 == 0:\n\n\t\treturn 1 + two_count(x//2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(input())\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))", "target": "def two_count(x):\n\n\tif x % 2 == 0:\n\n\t\treturn 1 + two_count(x//2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(input())\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))", "code_v0_loc": 12, "code_v1_loc": 12, "code_v0_num_chars": 250, "code_v1_num_chars": 236, "code_v0_no_empty_lines": "def two_count(x):\n if int(str(x)[-1]) % 2 == 0:\n return 1 + two_count(x // 2)\n else:\n return 0\n\n\nn = int(input())\nn_list = [int(n) for n in input().split(\" \")]\nn_two_count_list = [two_count(n) for n in n_list]\nprint((min(n_two_count_list)))\n", "code_v1_no_empty_lines": "def two_count(x):\n if x % 2 == 0:\n return 1 + two_count(x // 2)\n else:\n return 0\n\n\nn = int(input())\nn_list = [int(n) for n in input().split(\" \")]\nn_two_count_list = [two_count(n) for n in n_list]\nprint((min(n_two_count_list)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if int(str(x)[-1]) % 2 == 0:", "+ if x % 2 == 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3392717605, "measured_runtime_v1": 0.2706325946, "runtime_lift": 1.2536249042, "key": ["s252753387", "s505612116"]} +{"user_id": "u150984829", "problem_id": "p02386", "language": "python", "submission_id_v0": "s799017760", "submission_id_v1": "s414241098", "cpu_time_v0": 150, "cpu_time_v1": 130, "memory_v0": 5608, "memory_v1": 5608, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.33, "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if(g[k:k+4]==e[1:5])*(f[0]==e[0])*(f[5]==e[5]):return 'No'\n\n return 'Yes'\n\nprint((f()))\n", "target": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if g[k:k+4]==e[1:5]:\n\n if f[0]==e[0]:\n\n if f[5]==e[5]:return 'No'\n\n return 'Yes'\n\nprint((f()))\n", "code_v0_loc": 14, "code_v1_loc": 16, "code_v0_num_chars": 424, "code_v1_num_chars": 442, "code_v0_no_empty_lines": "n = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):\n f = [d[int(k)] for k in p]\n g = f[1:5] * 2\n for k in range(4):\n if (g[k : k + 4] == e[1:5]) * (f[0] == e[0]) * (f[5] == e[5]):\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_v1_no_empty_lines": "n = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):\n f = [d[int(k)] for k in p]\n g = f[1:5] * 2\n for k in range(4):\n if g[k : k + 4] == e[1:5]:\n if f[0] == e[0]:\n if f[5] == e[5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- if (g[k : k + 4] == e[1:5]) * (f[0] == e[0]) * (f[5] == e[5]):", "- return \"No\"", "+ if g[k : k + 4] == e[1:5]:", "+ if f[0] == e[0]:", "+ if f[5] == e[5]:", "+ return \"No\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.3438470016, "measured_runtime_v1": 0.1932190149, "runtime_lift": 1.7795712385, "key": ["s799017760", "s414241098"]} +{"user_id": "u923270446", "problem_id": "p02814", "language": "python", "submission_id_v0": "s885010221", "submission_id_v1": "s420231524", "cpu_time_v0": 220, "cpu_time_v1": 172, "memory_v0": 16320, "memory_v1": 20208, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.82, "input": "from math import gcd\n\nn, m = list(map(int, input().split()))\n\na = [int(i) // 2 for i in input().split()]\n\nx = 1\n\nfor i in range(n):\n\n x *= a[i] // gcd(x, a[i])\n\nfor i in a:\n\n if x // i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((m // x + 1) // 2))", "target": "from math import gcd, ceil\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = [i // 2 for i in a]\n\nl = 1\n\nfor i in a:\n\n l *= i // gcd(l, i)\n\nfor i in a:\n\n if l // i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint((ceil((m // l) / 2)))", "code_v0_loc": 11, "code_v1_loc": 12, "code_v0_num_chars": 259, "code_v1_num_chars": 266, "code_v0_no_empty_lines": "from math import gcd\n\nn, m = list(map(int, input().split()))\na = [int(i) // 2 for i in input().split()]\nx = 1\nfor i in range(n):\n x *= a[i] // gcd(x, a[i])\nfor i in a:\n if x // i % 2 == 0:\n print((0))\n exit()\nprint(((m // x + 1) // 2))\n", "code_v1_no_empty_lines": "from math import gcd, ceil\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = [i // 2 for i in a]\nl = 1\nfor i in a:\n l *= i // gcd(l, i)\nfor i in a:\n if l // i % 2 == 0:\n print((0))\n exit()\nprint((ceil((m // l) / 2)))\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-from math import gcd", "+from math import gcd, ceil", "-a = [int(i) // 2 for i in input().split()]", "-x = 1", "-for i in range(n):", "- x *= a[i] // gcd(x, a[i])", "+a = list(map(int, input().split()))", "+a = [i // 2 for i in a]", "+l = 1", "- if x // i % 2 == 0:", "+ l *= i // gcd(l, i)", "+for i in a:", "+ if l // i % 2 == 0:", "-print(((m // x + 1) // 2))", "+print((ceil((m // l) / 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2764406667, "measured_runtime_v1": 0.214073961, "runtime_lift": 1.2913325159, "key": ["s885010221", "s420231524"]} +{"user_id": "u716530146", "problem_id": "p03038", "language": "python", "submission_id_v0": "s839494003", "submission_id_v1": "s928697183", "cpu_time_v0": 613, "cpu_time_v1": 410, "memory_v0": 89216, "memory_v1": 43704, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.12, "input": "import sys\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nn,m=list(map(int,input().split()))\n\na0=list(map(int,input().split()))\n\ndata=[list(map(int,input().split())) for i in range(m)]\n\nfor i in a0:\n\n\tdata.append([1,i])\n\ndata.sort(key=lambda tup:-tup[1])\n\nans=0\n\nfor num,val in data:\n\n\tif n>=num:\n\n\t\tn-=num\n\n\t\tans+=val*num\n\n\telse:\n\n\t\tans+=val*n\n\n\t\tbreak\n\nprint(ans)\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\nfrom collections import Counter\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nsys.setrecursionlimit(10**8)\n\n\n\nans=0\n\nn,m=list(map(int,input().split()))\n\nA=list(map(int,input().split()))\n\nbc=[]\n\nfor i in range(m):\n\n b,c=list(map(int,input().split()))\n\n bc.append((c,b))\n\nC=Counter(A)\n\nbc+=list(C.items())\n\nbc.sort(key=lambda tup:-tup[0])\n\n# print(bc)\n\nfor c,b in bc:\n\n if n>=b:\n\n n-=b\n\n ans+=c*b\n\n else:\n\n ans+=c*n\n\n break\n\nprint(ans)\n\n\n", "code_v0_loc": 17, "code_v1_loc": 26, "code_v0_num_chars": 357, "code_v1_num_chars": 498, "code_v0_no_empty_lines": "import sys\n\ninput = lambda: sys.stdin.readline()[:-1]\nn, m = list(map(int, input().split()))\na0 = list(map(int, input().split()))\ndata = [list(map(int, input().split())) for i in range(m)]\nfor i in a0:\n data.append([1, i])\ndata.sort(key=lambda tup: -tup[1])\nans = 0\nfor num, val in data:\n if n >= num:\n n -= num\n ans += val * num\n else:\n ans += val * n\n break\nprint(ans)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\nfrom collections import Counter\n\ninput = lambda: sys.stdin.readline()[:-1]\nsys.setrecursionlimit(10**8)\nans = 0\nn, m = list(map(int, input().split()))\nA = list(map(int, input().split()))\nbc = []\nfor i in range(m):\n b, c = list(map(int, input().split()))\n bc.append((c, b))\nC = Counter(A)\nbc += list(C.items())\nbc.sort(key=lambda tup: -tup[0])\n# print(bc)\nfor c, b in bc:\n if n >= b:\n n -= b\n ans += c * b\n else:\n ans += c * n\n break\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 34.6153846154, "diff": ["+#!/usr/bin/env python3", "+from collections import Counter", "+sys.setrecursionlimit(10**8)", "+ans = 0", "-a0 = list(map(int, input().split()))", "-data = [list(map(int, input().split())) for i in range(m)]", "-for i in a0:", "- data.append([1, i])", "-data.sort(key=lambda tup: -tup[1])", "-ans = 0", "-for num, val in data:", "- if n >= num:", "- n -= num", "- ans += val * num", "+A = list(map(int, input().split()))", "+bc = []", "+for i in range(m):", "+ b, c = list(map(int, input().split()))", "+ bc.append((c, b))", "+C = Counter(A)", "+bc += list(C.items())", "+bc.sort(key=lambda tup: -tup[0])", "+# print(bc)", "+for c, b in bc:", "+ if n >= b:", "+ n -= b", "+ ans += c * b", "- ans += val * n", "+ ans += c * n"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2703684399, "measured_runtime_v1": 0.1342513988, "runtime_lift": 2.013896632, "key": ["s839494003", "s928697183"]} +{"user_id": "u846634344", "problem_id": "p03200", "language": "python", "submission_id_v0": "s951894178", "submission_id_v1": "s605042414", "cpu_time_v0": 58, "cpu_time_v1": 51, "memory_v0": 5932, "memory_v1": 3500, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.07, "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(input())\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tA = []\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': A.append(bcnt)\n\n\t\n\n\tprint((sum(A)))\n\n\n\nif __name__ == '__main__':\n\n\tmain()", "target": "import sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(input())\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tans = 0\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': ans += bcnt\n\n\t\n\n\tprint(ans)\n\n\n\nif __name__ == '__main__':\n\n\tmain()", "code_v0_loc": 20, "code_v1_loc": 20, "code_v0_num_chars": 439, "code_v1_num_chars": 434, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\nif sys.platform in ([\"ios\", \"darwin\", \"win32\"]):\n sys.stdin = open(\"Untitled.txt\")\ninput = sys.stdin.readline\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return [int(s) for s in input().split()]\n\n\ndef main():\n S = input().rstrip()\n bcnt = 0\n A = []\n for i in range(len(S)):\n if S[i] == \"B\":\n bcnt += 1\n if S[i] == \"W\":\n A.append(bcnt)\n print((sum(A)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\nif sys.platform in ([\"ios\", \"darwin\", \"win32\"]):\n sys.stdin = open(\"Untitled.txt\")\ninput = sys.stdin.readline\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return [int(s) for s in input().split()]\n\n\ndef main():\n S = input().rstrip()\n bcnt = 0\n ans = 0\n for i in range(len(S)):\n if S[i] == \"B\":\n bcnt += 1\n if S[i] == \"W\":\n ans += bcnt\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- A = []", "+ ans = 0", "- A.append(bcnt)", "- print((sum(A)))", "+ ans += bcnt", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2057990801, "measured_runtime_v1": 0.0065612807, "runtime_lift": 31.365687324, "key": ["s951894178", "s605042414"]} +{"user_id": "u780475861", "problem_id": "p03416", "language": "python", "submission_id_v0": "s789877064", "submission_id_v1": "s762526319", "cpu_time_v0": 111, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.68, "input": "a,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(a, b + 1):\n\n f = True\n\n s = str(i)\n\n l = len(s)\n\n for j in range(l//2 + 1):\n\n if s[j] != s[- j - 1]:\n\n f = False\n\n break\n\n if f:\n\n n += 1\n\nprint(n)", "target": "a,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(1, 10):\n\n for j in range(10):\n\n for k in range(10):\n\n s = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n\n if a <= s <= b:\n\n n += 1\n\nprint(n)", "code_v0_loc": 13, "code_v1_loc": 9, "code_v0_num_chars": 253, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nn = 0\nfor i in range(a, b + 1):\n f = True\n s = str(i)\n l = len(s)\n for j in range(l // 2 + 1):\n if s[j] != s[-j - 1]:\n f = False\n break\n if f:\n n += 1\nprint(n)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nn = 0\nfor i in range(1, 10):\n for j in range(10):\n for k in range(10):\n s = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n if a <= s <= b:\n n += 1\nprint(n)\n", "code_same": false, "relative_loc_diff_percent": 30.7692307692, "diff": ["-for i in range(a, b + 1):", "- f = True", "- s = str(i)", "- l = len(s)", "- for j in range(l // 2 + 1):", "- if s[j] != s[-j - 1]:", "- f = False", "- break", "- if f:", "- n += 1", "+for i in range(1, 10):", "+ for j in range(10):", "+ for k in range(10):", "+ s = 10000 * i + 1000 * j + 100 * k + 10 * j + i", "+ if a <= s <= b:", "+ n += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.319382349, "measured_runtime_v1": 0.1601409102, "runtime_lift": 1.99438325, "key": ["s789877064", "s762526319"]} +{"user_id": "u968166680", "problem_id": "p03752", "language": "python", "submission_id_v0": "s863090450", "submission_id_v1": "s059435285", "cpu_time_v0": 32, "cpu_time_v1": 24, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for bit in range(1 << N):\n\n if (not (bit & 1)) or bin(bit).count('1') != K:\n\n continue\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if bit & (1 << i):\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\nfrom itertools import combinations\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for comb in combinations(list(range(1, N)), K - 1):\n\n included = [False] * N\n\n for i in comb:\n\n included[i] = True\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if included[i]:\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 37, "code_v1_loc": 39, "code_v0_num_chars": 756, "code_v1_num_chars": 818, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef main():\n N, K, *A = list(map(int, read().split()))\n ans = INF\n for bit in range(1 << N):\n if (not (bit & 1)) or bin(bit).count(\"1\") != K:\n continue\n total = 0\n max_height = A[0]\n for i, a in enumerate(A[1:], 1):\n if a <= max_height:\n if bit & (1 << i):\n total += max_height - a + 1\n max_height += 1\n else:\n max_height = a\n if ans > total:\n ans = total\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\nfrom itertools import combinations\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef main():\n N, K, *A = list(map(int, read().split()))\n ans = INF\n for comb in combinations(list(range(1, N)), K - 1):\n included = [False] * N\n for i in comb:\n included[i] = True\n total = 0\n max_height = A[0]\n for i, a in enumerate(A[1:], 1):\n if a <= max_height:\n if included[i]:\n total += max_height - a + 1\n max_height += 1\n else:\n max_height = a\n if ans > total:\n ans = total\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 5.1282051282, "diff": ["+from itertools import combinations", "- for bit in range(1 << N):", "- if (not (bit & 1)) or bin(bit).count(\"1\") != K:", "- continue", "+ for comb in combinations(list(range(1, N)), K - 1):", "+ included = [False] * N", "+ for i in comb:", "+ included[i] = True", "- if bit & (1 << i):", "+ if included[i]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4393207397, "measured_runtime_v1": 0.2213684809, "runtime_lift": 1.9845677122, "key": ["s863090450", "s059435285"]} +{"user_id": "u347600233", "problem_id": "p02952", "language": "python", "submission_id_v0": "s073920837", "submission_id_v1": "s426081507", "cpu_time_v0": 75, "cpu_time_v1": 58, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.67, "input": "import math\n\nn = int(input())\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if math.floor(math.log10(i) + 1) % 2:\n\n cnt += 1\n\nprint(cnt)", "target": "n = int(input())\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if len(str(i)) % 2:\n\n cnt += 1\n\nprint(cnt)", "code_v0_loc": 7, "code_v1_loc": 6, "code_v0_num_chars": 138, "code_v1_num_chars": 107, "code_v0_no_empty_lines": "import math\n\nn = int(input())\ncnt = 0\nfor i in range(1, n + 1):\n if math.floor(math.log10(i) + 1) % 2:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\ncnt = 0\nfor i in range(1, n + 1):\n if len(str(i)) % 2:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-import math", "-", "- if math.floor(math.log10(i) + 1) % 2:", "+ if len(str(i)) % 2:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3655955575, "measured_runtime_v1": 0.2850201683, "runtime_lift": 1.282700658, "key": ["s073920837", "s426081507"]} +{"user_id": "u423966555", "problem_id": "p02773", "language": "python", "submission_id_v0": "s252908207", "submission_id_v1": "s096619437", "cpu_time_v0": 859, "cpu_time_v1": 768, "memory_v0": 46080, "memory_v1": 48888, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.59, "input": "from collections import defaultdict\n\nn = int(input())\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = input()\n\n d[key] += 1\n\n\n\ndict = sorted(list(d.items()), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nfor s in dict_li:\n\n print(s)\n", "target": "from collections import defaultdict\n\nn = int(input())\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = input()\n\n d[key] += 1\n\n\n\ndict = sorted(d.items(), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nprint(*dict_li, sep='\\n')\n", "code_v0_loc": 19, "code_v1_loc": 18, "code_v0_num_chars": 354, "code_v1_num_chars": 348, "code_v0_no_empty_lines": "from collections import defaultdict\n\nn = int(input())\nd = defaultdict(int)\nfor _ in range(n):\n key = input()\n d[key] += 1\ndict = sorted(list(d.items()), key=lambda x: x[1], reverse=True)\nmax_v = max(d.values())\ndict_li = []\nfor a in dict:\n if a[1] == max_v:\n dict_li.append(a[0])\ndict_li.sort()\nfor s in dict_li:\n print(s)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nn = int(input())\nd = defaultdict(int)\nfor _ in range(n):\n key = input()\n d[key] += 1\ndict = sorted(d.items(), key=lambda x: x[1], reverse=True)\nmax_v = max(d.values())\ndict_li = []\nfor a in dict:\n if a[1] == max_v:\n dict_li.append(a[0])\ndict_li.sort()\nprint(*dict_li, sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 5.2631578947, "diff": ["-n = int(input())", "+n = int(input())", "- key = input()", "+ key = input()", "-dict = sorted(list(d.items()), key=lambda x: x[1], reverse=True)", "+dict = sorted(d.items(), key=lambda x: x[1], reverse=True)", "-for s in dict_li:", "- print(s)", "+print(*dict_li, sep=\"\\n\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2625157752, "measured_runtime_v1": 0.2092528682, "runtime_lift": 1.2545384801, "key": ["s252908207", "s096619437"]} +{"user_id": "u867826040", "problem_id": "p03721", "language": "python", "submission_id_v0": "s719602965", "submission_id_v1": "s173376033", "cpu_time_v0": 194, "cpu_time_v1": 151, "memory_v0": 76876, "memory_v1": 16524, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.16, "input": "n,k = list(map(int,input().split()))\n\nl = [0]*(10**5+1)\n\nfor i in range(n):\n\n ai,bi = list(map(int,input().split()))\n\n l[ai]+=bi\n\nfor index,i in enumerate(l):\n\n if i:\n\n k-=i\n\n if k<=0:\n\n break\n\nprint(index)", "target": "from collections import defaultdict\n\nfrom sys import stdin\n\ninput = stdin.readline\n\nd = defaultdict(int)\n\nn,k = list(map(int,input().split()))\n\nfor _ in range(n):\n\n a,b = list(map(int,input().split()))\n\n d[a]+=b\n\nfor key in sorted(d.keys()):\n\n v = d[key]\n\n k-=v\n\n if k <= 0:\n\n break\n\nprint(key)", "code_v0_loc": 11, "code_v1_loc": 14, "code_v0_num_chars": 228, "code_v1_num_chars": 304, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\nl = [0] * (10**5 + 1)\nfor i in range(n):\n ai, bi = list(map(int, input().split()))\n l[ai] += bi\nfor index, i in enumerate(l):\n if i:\n k -= i\n if k <= 0:\n break\nprint(index)\n", "code_v1_no_empty_lines": "from collections import defaultdict\nfrom sys import stdin\n\ninput = stdin.readline\nd = defaultdict(int)\nn, k = list(map(int, input().split()))\nfor _ in range(n):\n a, b = list(map(int, input().split()))\n d[a] += b\nfor key in sorted(d.keys()):\n v = d[key]\n k -= v\n if k <= 0:\n break\nprint(key)\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["+from collections import defaultdict", "+from sys import stdin", "+", "+input = stdin.readline", "+d = defaultdict(int)", "-l = [0] * (10**5 + 1)", "-for i in range(n):", "- ai, bi = list(map(int, input().split()))", "- l[ai] += bi", "-for index, i in enumerate(l):", "- if i:", "- k -= i", "- if k <= 0:", "- break", "-print(index)", "+for _ in range(n):", "+ a, b = list(map(int, input().split()))", "+ d[a] += b", "+for key in sorted(d.keys()):", "+ v = d[key]", "+ k -= v", "+ if k <= 0:", "+ break", "+print(key)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5501943195, "measured_runtime_v1": 0.4111647634, "runtime_lift": 1.3381358727, "key": ["s719602965", "s173376033"]} +{"user_id": "u271934630", "problem_id": "p03416", "language": "python", "submission_id_v0": "s986292698", "submission_id_v1": "s820058882", "cpu_time_v0": 225, "cpu_time_v1": 186, "memory_v0": 40684, "memory_v1": 40300, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.33, "input": "A, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = list(str(i))\n\n\n\n if l == list(reversed(l)):\n\n cnt += 1\n\n\n\nprint(cnt)\n", "target": "A, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = str(i)\n\n if l == l[::-1]:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 155, "code_v1_num_chars": 137, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor i in range(A, B + 1):\n l = list(str(i))\n if l == list(reversed(l)):\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor i in range(A, B + 1):\n l = str(i)\n if l == l[::-1]:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- l = list(str(i))", "- if l == list(reversed(l)):", "+ l = str(i)", "+ if l == l[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3457211592, "measured_runtime_v1": 0.2683477015, "runtime_lift": 1.2883328503, "key": ["s986292698", "s820058882"]} +{"user_id": "u680851063", "problem_id": "p03363", "language": "python", "submission_id_v0": "s954809041", "submission_id_v1": "s284059915", "cpu_time_v0": 905, "cpu_time_v1": 166, "memory_v0": 44692, "memory_v1": 44492, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.66, "input": "n = int(input())\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nfrom math import factorial\n\ndef combinations_count(n, r):\n\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += combinations_count(j,2)\n\n\n\nprint(ans)", "target": "n = int(input())\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += j * (j-1) // 2\n\n\n\nprint(ans)\n", "code_v0_loc": 25, "code_v1_loc": 21, "code_v0_num_chars": 487, "code_v1_num_chars": 356, "code_v0_no_empty_lines": "n = int(input())\nary = list(map(int, input().split()))\n# print(n,ary)\nary_2 = [ary[0]]\nfor i in range(1, n):\n ary_2.append(ary[i] + ary_2[i - 1])\nary_2 = [0] + ary_2\n# print(ary_2)\nfrom collections import Counter\n\nc = Counter(ary_2)\nv = list(c.values())\n# print(v)\nfrom math import factorial\n\n\ndef combinations_count(n, r):\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\nans = 0\nfor j in v:\n if j > 1:\n ans += combinations_count(j, 2)\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nary = list(map(int, input().split()))\n# print(n,ary)\nary_2 = [ary[0]]\nfor i in range(1, n):\n ary_2.append(ary[i] + ary_2[i - 1])\nary_2 = [0] + ary_2\n# print(ary_2)\nfrom collections import Counter\n\nc = Counter(ary_2)\nv = list(c.values())\n# print(v)\nans = 0\nfor j in v:\n if j > 1:\n ans += j * (j - 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 16.0, "diff": ["-from math import factorial", "-", "-", "-def combinations_count(n, r):", "- return factorial(n) // (factorial(n - r) * factorial(r))", "-", "-", "- ans += combinations_count(j, 2)", "+ ans += j * (j - 1) // 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2075043974, "measured_runtime_v1": 0.0060842175, "runtime_lift": 34.1053546165, "key": ["s954809041", "s284059915"]} +{"user_id": "u761320129", "problem_id": "p02792", "language": "python", "submission_id_v0": "s858070624", "submission_id_v1": "s144947075", "cpu_time_v0": 459, "cpu_time_v1": 184, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.91, "input": "N = int(input())\n\nmem = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)", "target": "N = int(input())\n\n\n\nd = [[0]*10 for i in range(10)]\n\nfor n in range(1,N+1):\n\n s = str(n)\n\n d[int(s[0])][int(s[-1])] += 1\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += d[i][j] * d[j][i]\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 264, "code_v1_num_chars": 227, "code_v0_no_empty_lines": "N = int(input())\nmem = [[0] * 10 for i in range(10)]\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n mem[a][b] += 1\nans = 0\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n ans += mem[b][a]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nd = [[0] * 10 for i in range(10)]\nfor n in range(1, N + 1):\n s = str(n)\n d[int(s[0])][int(s[-1])] += 1\nans = 0\nfor i in range(10):\n for j in range(10):\n ans += d[i][j] * d[j][i]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-mem = [[0] * 10 for i in range(10)]", "-for i in range(1, N + 1):", "- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- mem[a][b] += 1", "+d = [[0] * 10 for i in range(10)]", "+for n in range(1, N + 1):", "+ s = str(n)", "+ d[int(s[0])][int(s[-1])] += 1", "-for i in range(1, N + 1):", "- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- ans += mem[b][a]", "+for i in range(10):", "+ for j in range(10):", "+ ans += d[i][j] * d[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4986082915, "measured_runtime_v1": 0.3140420772, "runtime_lift": 1.5877117355, "key": ["s858070624", "s144947075"]} +{"user_id": "u790012205", "problem_id": "p03796", "language": "python", "submission_id_v0": "s234232673", "submission_id_v1": "s468100683", "cpu_time_v0": 175, "cpu_time_v1": 49, "memory_v0": 38512, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.0, "input": "N = int(input())\n\np = 1\n\nfor i in range(N):\n\n p *= (i + 1)\n\n p %= (1e9 + 7)\n\nprint((int(p)))", "target": "N = int(input())\n\np = 1\n\nfor i in range(N):\n\n p = p * (i + 1) % (1e9 + 7)\n\nprint((int(p)))", "code_v0_loc": 6, "code_v1_loc": 5, "code_v0_num_chars": 96, "code_v1_num_chars": 91, "code_v0_no_empty_lines": "N = int(input())\np = 1\nfor i in range(N):\n p *= i + 1\n p %= 1e9 + 7\nprint((int(p)))\n", "code_v1_no_empty_lines": "N = int(input())\np = 1\nfor i in range(N):\n p = p * (i + 1) % (1e9 + 7)\nprint((int(p)))\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["- p *= i + 1", "- p %= 1e9 + 7", "+ p = p * (i + 1) % (1e9 + 7)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4166263335, "measured_runtime_v1": 0.2939343722, "runtime_lift": 1.4174127727, "key": ["s234232673", "s468100683"]} +{"user_id": "u771634798", "problem_id": "p02725", "language": "python", "submission_id_v0": "s591694965", "submission_id_v1": "s705639429", "cpu_time_v0": 110, "cpu_time_v1": 85, "memory_v0": 32148, "memory_v1": 32380, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.73, "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\ndiff = []\n\n\n\nfor i in range(n - 1):\n\n diff.append(a[i + 1] - a[i])\n\ndiff.append(k - a[-1] + a[0])\n\n\n\nprint((k - max(diff)))\n", "target": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\na.append(k + a[0])\n\ndiff = [a1 - a0 for a0, a1 in zip(a, a[1:])]\n\n\n\nprint((k - max(diff)))\n", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 198, "code_v1_num_chars": 162, "code_v0_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\ndiff = []\nfor i in range(n - 1):\n diff.append(a[i + 1] - a[i])\ndiff.append(k - a[-1] + a[0])\nprint((k - max(diff)))\n", "code_v1_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(k + a[0])\ndiff = [a1 - a0 for a0, a1 in zip(a, a[1:])]\nprint((k - max(diff)))\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-diff = []", "-for i in range(n - 1):", "- diff.append(a[i + 1] - a[i])", "-diff.append(k - a[-1] + a[0])", "+a.append(k + a[0])", "+diff = [a1 - a0 for a0, a1 in zip(a, a[1:])]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3387992765, "measured_runtime_v1": 0.2554280306, "runtime_lift": 1.3263981864, "key": ["s591694965", "s705639429"]} +{"user_id": "u562935282", "problem_id": "p03253", "language": "python", "submission_id_v0": "s242343005", "submission_id_v1": "s569938093", "cpu_time_v0": 72, "cpu_time_v1": 23, "memory_v0": 11380, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 68.06, "input": "class Calc:\n\n def __init__(self, max_value, mod):\n\n \"\"\"combination(max_value, all)\"\"\"\n\n fact = [-1] * (max_value + 1)\n\n fact[0] = 1\n\n fact[1] = 1\n\n for x in range(2, max_value + 1):\n\n fact[x] = x * fact[x - 1] % mod\n\n\n\n invs = [1] * (max_value + 1)\n\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n\n for x in range(max_value - 1, 0, -1):\n\n invs[x] = invs[x + 1] * (x + 1) % mod\n\n\n\n self.fact = fact\n\n self.invs = invs\n\n self.mod = mod\n\n\n\n def combination(self, n, r):\n\n if n - r < r:\n\n return self.combination(n, n - r)\n\n if r < 0:\n\n return 0\n\n if r == 0:\n\n return 1\n\n if r == 1:\n\n return n\n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\n\n\n\ndef gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n ma = d * d\n\n while ma <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n ma += d * 4 + 4\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n cal = Calc(max_value=N + 30, mod=MOD)\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n while d * d <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n for d in range(cnt):\n\n ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD\n\n \n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 69, "code_v1_loc": 37, "code_v0_num_chars": 1490, "code_v1_num_chars": 619, "code_v0_no_empty_lines": "class Calc:\n def __init__(self, max_value, mod):\n \"\"\"combination(max_value, all)\"\"\"\n fact = [-1] * (max_value + 1)\n fact[0] = 1\n fact[1] = 1\n for x in range(2, max_value + 1):\n fact[x] = x * fact[x - 1] % mod\n invs = [1] * (max_value + 1)\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n for x in range(max_value - 1, 0, -1):\n invs[x] = invs[x + 1] * (x + 1) % mod\n self.fact = fact\n self.invs = invs\n self.mod = mod\n\n def combination(self, n, r):\n if n - r < r:\n return self.combination(n, n - r)\n if r < 0:\n return 0\n if r == 0:\n return 1\n if r == 1:\n return n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\ndef gen(n):\n x = n\n d = 2\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n d = 3\n ma = d * d\n while ma <= n:\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n ma += d * 4 + 4\n d += 2\n if x > 1:\n yield 1\n\n\ndef main():\n MOD = 10**9 + 7\n N, M = list(map(int, input().split()))\n cal = Calc(max_value=N + 30, mod=MOD)\n ans = 1\n for cnt in gen(M):\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def gen(n):\n x = n\n d = 2\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n d = 3\n while d * d <= n:\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n d += 2\n if x > 1:\n yield 1\n\n\ndef main():\n MOD = 10**9 + 7\n N, M = list(map(int, input().split()))\n ans = 1\n for cnt in gen(M):\n for d in range(cnt):\n ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 46.3768115942, "diff": ["-class Calc:", "- def __init__(self, max_value, mod):", "- \"\"\"combination(max_value, all)\"\"\"", "- fact = [-1] * (max_value + 1)", "- fact[0] = 1", "- fact[1] = 1", "- for x in range(2, max_value + 1):", "- fact[x] = x * fact[x - 1] % mod", "- invs = [1] * (max_value + 1)", "- invs[max_value] = pow(fact[max_value], mod - 2, mod)", "- for x in range(max_value - 1, 0, -1):", "- invs[x] = invs[x + 1] * (x + 1) % mod", "- self.fact = fact", "- self.invs = invs", "- self.mod = mod", "-", "- def combination(self, n, r):", "- if n - r < r:", "- return self.combination(n, n - r)", "- if r < 0:", "- return 0", "- if r == 0:", "- return 1", "- if r == 1:", "- return n", "- return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod", "-", "-", "- ma = d * d", "- while ma <= n:", "+ while d * d <= n:", "- ma += d * 4 + 4", "- cal = Calc(max_value=N + 30, mod=MOD)", "- ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD", "+ for d in range(cnt):", "+ ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5542220466, "measured_runtime_v1": 0.3755235486, "runtime_lift": 1.4758649588, "key": ["s242343005", "s569938093"]} +{"user_id": "u952708174", "problem_id": "p02983", "language": "python", "submission_id_v0": "s271837395", "submission_id_v1": "s778364451", "cpu_time_v0": 612, "cpu_time_v1": 51, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.67, "input": "def c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))", "target": "def c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n if ans == 0:\n\n return 0\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))", "code_v0_loc": 9, "code_v1_loc": 11, "code_v0_num_chars": 308, "code_v1_num_chars": 360, "code_v0_no_empty_lines": "def c_remainder_minimization_2019(L, R):\n ans = float(\"inf\")\n for i in range(L, min(R, L + 2019)):\n for j in range(i + 1, min(R + 1, L + 2020)):\n ans = min(ans, (i * j) % 2019)\n return ans\n\n\nL, R = [int(i) for i in input().split()]\nprint((c_remainder_minimization_2019(L, R)))\n", "code_v1_no_empty_lines": "def c_remainder_minimization_2019(L, R):\n ans = float(\"inf\")\n for i in range(L, min(R, L + 2019)):\n for j in range(i + 1, min(R + 1, L + 2020)):\n ans = min(ans, (i * j) % 2019)\n if ans == 0:\n return 0\n return ans\n\n\nL, R = [int(i) for i in input().split()]\nprint((c_remainder_minimization_2019(L, R)))\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["+ if ans == 0:", "+ return 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3551982943, "measured_runtime_v1": 0.2038855975, "runtime_lift": 1.7421450986, "key": ["s271837395", "s778364451"]} +{"user_id": "u562935282", "problem_id": "p03371", "language": "python", "submission_id_v0": "s950527789", "submission_id_v1": "s848046688", "cpu_time_v0": 119, "cpu_time_v1": 19, "memory_v0": 3060, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.03, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nval = float('inf')\n\nfor k in range(10 ** 5 + 1):\n\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\n\nprint(val)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 0\n\nans += min(A + B, 2 * C) * min(X, Y)\n\nif X > Y:\n\n ans += min(A, 2 * C) * (X - Y)\n\nelif X < Y:\n\n ans += min(B, 2 * C) * (Y - X)\n\nprint(ans)\n", "code_v0_loc": 5, "code_v1_loc": 9, "code_v0_num_chars": 174, "code_v1_num_chars": 199, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nval = float(\"inf\")\nfor k in range(10**5 + 1):\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\nprint(val)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = 0\nans += min(A + B, 2 * C) * min(X, Y)\nif X > Y:\n ans += min(A, 2 * C) * (X - Y)\nelif X < Y:\n ans += min(B, 2 * C) * (Y - X)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-a, b, c, x, y = list(map(int, input().split()))", "-val = float(\"inf\")", "-for k in range(10**5 + 1):", "- val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)", "-print(val)", "+A, B, C, X, Y = list(map(int, input().split()))", "+ans = 0", "+ans += min(A + B, 2 * C) * min(X, Y)", "+if X > Y:", "+ ans += min(A, 2 * C) * (X - Y)", "+elif X < Y:", "+ ans += min(B, 2 * C) * (Y - X)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3470396991, "measured_runtime_v1": 0.2883047278, "runtime_lift": 4.6722775216, "key": ["s950527789", "s848046688"]} +{"user_id": "u869919400", "problem_id": "p03796", "language": "python", "submission_id_v0": "s127994042", "submission_id_v1": "s163960956", "cpu_time_v0": 229, "cpu_time_v1": 37, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.84, "input": "from math import factorial as f\n\nn = int(input())\n\nprint((f(n) % (10 ** 9 + 7)))", "target": "n = int(input())\n\np = 1\n\nfor i in range(n):\n\n p = (p * (i+1)) % (10 ** 9 + 7)\n\nprint(p)", "code_v0_loc": 3, "code_v1_loc": 5, "code_v0_num_chars": 78, "code_v1_num_chars": 90, "code_v0_no_empty_lines": "from math import factorial as f\n\nn = int(input())\nprint((f(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\np = 1\nfor i in range(n):\n p = (p * (i + 1)) % (10**9 + 7)\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-from math import factorial as f", "-", "-print((f(n) % (10**9 + 7)))", "+p = 1", "+for i in range(n):", "+ p = (p * (i + 1)) % (10**9 + 7)", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8111317687, "measured_runtime_v1": 0.3589184887, "runtime_lift": 2.2599330882, "key": ["s127994042", "s163960956"]} +{"user_id": "u227082700", "problem_id": "p03039", "language": "python", "submission_id_v0": "s481435936", "submission_id_v1": "s241948863", "cpu_time_v0": 1746, "cpu_time_v1": 149, "memory_v0": 11052, "memory_v1": 16752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.47, "input": "n,m,k=list(map(int,input().split()))\n\nmod=10**9+7\n\nf=[1]\n\nfor i in range(2*10**5+7):f+=[f[-1]*(i+1)%mod]\n\ndef comb(a,b):return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod\n\nans=0\n\nfor i in range(1,n):\n\n ans+=(i*(n-i)*m**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nfor i in range(1,m):\n\n ans+=(i*(m-i)*n**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nprint(ans)", "target": "n,m,k=list(map(int,input().split()))\n\n\n\nmod = 10**9+7\n\nf = [1]\n\nfor i in range(n*m):\n\n f += [f[-1]*(i+1) % mod]\n\ndef comb(a, b):\n\n return f[a]*pow(f[b], mod-2, mod)*pow(f[a-b], mod-2, mod) % mod\n\n\n\nans=0\n\nfor dist in range(1,n):\n\n c=n-dist\n\n p=(c*m*m)%mod\n\n ans+=p*dist\n\nfor dist in range(1,m):\n\n c=m-dist\n\n p=(c*n*n)%mod\n\n ans+=p*dist\n\nans%=mod\n\nprint((ans*comb(n*m-2,k-2)%mod))", "code_v0_loc": 13, "code_v1_loc": 20, "code_v0_num_chars": 340, "code_v1_num_chars": 379, "code_v0_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nf = [1]\nfor i in range(2 * 10**5 + 7):\n f += [f[-1] * (i + 1) % mod]\n\n\ndef comb(a, b):\n return f[a] * pow(f[b], mod - 2, mod) * pow(f[a - b], mod - 2, mod) % mod\n\n\nans = 0\nfor i in range(1, n):\n ans += (i * (n - i) * m**2) * (comb(n * m - 2, k - 2))\n ans %= mod\nfor i in range(1, m):\n ans += (i * (m - i) * n**2) * (comb(n * m - 2, k - 2))\n ans %= mod\nprint(ans)\n", "code_v1_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nf = [1]\nfor i in range(n * m):\n f += [f[-1] * (i + 1) % mod]\n\n\ndef comb(a, b):\n return f[a] * pow(f[b], mod - 2, mod) * pow(f[a - b], mod - 2, mod) % mod\n\n\nans = 0\nfor dist in range(1, n):\n c = n - dist\n p = (c * m * m) % mod\n ans += p * dist\nfor dist in range(1, m):\n c = m - dist\n p = (c * n * n) % mod\n ans += p * dist\nans %= mod\nprint((ans * comb(n * m - 2, k - 2) % mod))\n", "code_same": false, "relative_loc_diff_percent": 35.0, "diff": ["-for i in range(2 * 10**5 + 7):", "+for i in range(n * m):", "-for i in range(1, n):", "- ans += (i * (n - i) * m**2) * (comb(n * m - 2, k - 2))", "- ans %= mod", "-for i in range(1, m):", "- ans += (i * (m - i) * n**2) * (comb(n * m - 2, k - 2))", "- ans %= mod", "-print(ans)", "+for dist in range(1, n):", "+ c = n - dist", "+ p = (c * m * m) % mod", "+ ans += p * dist", "+for dist in range(1, m):", "+ c = m - dist", "+ p = (c * n * n) % mod", "+ ans += p * dist", "+ans %= mod", "+print((ans * comb(n * m - 2, k - 2) % mod))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.907170742, "measured_runtime_v1": 0.2339973826, "runtime_lift": 3.8768414063, "key": ["s481435936", "s241948863"]} +{"user_id": "u617203831", "problem_id": "p03796", "language": "python", "submission_id_v0": "s015060265", "submission_id_v1": "s192076282", "cpu_time_v0": 230, "cpu_time_v1": 40, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.61, "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "target": "ans=1\n\nn=int(input())\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 6, "code_v0_num_chars": 58, "code_v1_num_chars": 88, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nn = int(input())\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % (10**9 + 7)))", "+ans = 1", "+n = int(input())", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans = ans % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7955839839, "measured_runtime_v1": 0.4261377716, "runtime_lift": 1.866964247, "key": ["s015060265", "s192076282"]} +{"user_id": "u844789719", "problem_id": "p03371", "language": "python", "submission_id_v0": "s272710522", "submission_id_v1": "s867287513", "cpu_time_v0": 94, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.91, "input": "A, B, C, X, Y = [int(_) for _ in input().split()]\n\nans = A * X + B * Y\n\nfor i in range(max(X, Y) + 1):\n\n cost = 2 * C * i\n\n if X > i:\n\n cost += A * (X - i)\n\n if Y > i:\n\n cost += B * (Y - i)\n\n ans = min(ans, cost)\n\nprint(ans)", "target": "A, B, C, X, Y = [int(_) for _ in input().split()]\n\nM = max(X, Y)\n\nprint((min(2 * C * M, 2 * C * (X + Y - M) + A *\n\n (M - Y) + B * (M - X), A * X + B * Y)))\n", "code_v0_loc": 10, "code_v1_loc": 4, "code_v0_num_chars": 250, "code_v1_num_chars": 163, "code_v0_no_empty_lines": "A, B, C, X, Y = [int(_) for _ in input().split()]\nans = A * X + B * Y\nfor i in range(max(X, Y) + 1):\n cost = 2 * C * i\n if X > i:\n cost += A * (X - i)\n if Y > i:\n cost += B * (Y - i)\n ans = min(ans, cost)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = [int(_) for _ in input().split()]\nM = max(X, Y)\nprint((min(2 * C * M, 2 * C * (X + Y - M) + A * (M - Y) + B * (M - X), A * X + B * Y)))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-ans = A * X + B * Y", "-for i in range(max(X, Y) + 1):", "- cost = 2 * C * i", "- if X > i:", "- cost += A * (X - i)", "- if Y > i:", "- cost += B * (Y - i)", "- ans = min(ans, cost)", "-print(ans)", "+M = max(X, Y)", "+print((min(2 * C * M, 2 * C * (X + Y - M) + A * (M - Y) + B * (M - X), A * X + B * Y)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5275072498, "measured_runtime_v1": 0.332789422, "runtime_lift": 1.5851082243, "key": ["s272710522", "s867287513"]} +{"user_id": "u691018832", "problem_id": "p03945", "language": "python", "submission_id_v0": "s808413359", "submission_id_v1": "s766599872", "cpu_time_v0": 84, "cpu_time_v1": 46, "memory_v0": 3188, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.24, "input": "s = input()\n\nlen_s = len(s)\n\ncnt = [0, 0]\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n memo_1 = s[len_s - i]\n\n if s[i] != memo_0:\n\n cnt[0] += 1\n\n if s[len_s - i - 1] != memo_1:\n\n cnt[1] += 1\n\nprint((min(cnt)))\n", "target": "s = input()\n\nlen_s = len(s)\n\ncnt = 0\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n if s[i] != memo_0:\n\n cnt += 1\n\nprint(cnt)\n", "code_v0_loc": 11, "code_v1_loc": 8, "code_v0_num_chars": 239, "code_v1_num_chars": 142, "code_v0_no_empty_lines": "s = input()\nlen_s = len(s)\ncnt = [0, 0]\nfor i in range(1, len(s)):\n memo_0 = s[i - 1]\n memo_1 = s[len_s - i]\n if s[i] != memo_0:\n cnt[0] += 1\n if s[len_s - i - 1] != memo_1:\n cnt[1] += 1\nprint((min(cnt)))\n", "code_v1_no_empty_lines": "s = input()\nlen_s = len(s)\ncnt = 0\nfor i in range(1, len(s)):\n memo_0 = s[i - 1]\n if s[i] != memo_0:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["-cnt = [0, 0]", "+cnt = 0", "- memo_1 = s[len_s - i]", "- cnt[0] += 1", "- if s[len_s - i - 1] != memo_1:", "- cnt[1] += 1", "-print((min(cnt)))", "+ cnt += 1", "+print(cnt)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3379861441, "measured_runtime_v1": 0.264947257, "runtime_lift": 1.2756733088, "key": ["s808413359", "s766599872"]} +{"user_id": "u562016607", "problem_id": "p03558", "language": "python", "submission_id_v0": "s159640382", "submission_id_v1": "s651180421", "cpu_time_v0": 376, "cpu_time_v1": 167, "memory_v0": 8948, "memory_v1": 6060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.59, "input": "import heapq\n\nK=int(input())\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=[]\n\nheapq.heappush(q,(0,1))\n\nwhile (len(q)!=0):\n\n prc,src=heapq.heappop(q)\n\n if dist[src]dist[src]+1:\n\n dist[(src+1)%K]=dist[src]+1\n\n heapq.heappush(q,(dist[(src+1)%K],(src+1)%K))\n\n if dist[(10*src)%K]>dist[src]:\n\n dist[(10*src)%K]=dist[src]\n\n heapq.heappush(q,(dist[(src*10)%K],(src*10)%K))\n\nprint((dist[0]))\n", "target": "from collections import deque\n\nK=int(input())\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=deque([1])\n\nwhile(len(q)>0):\n\n r=q.popleft()\n\n s=(r+1)%K\n\n if dist[r]+1 dist[src] + 1:\n dist[(src + 1) % K] = dist[src] + 1\n heapq.heappush(q, (dist[(src + 1) % K], (src + 1) % K))\n if dist[(10 * src) % K] > dist[src]:\n dist[(10 * src) % K] = dist[src]\n heapq.heappush(q, (dist[(src * 10) % K], (src * 10) % K))\nprint((dist[0]))\n", "code_v1_no_empty_lines": "from collections import deque\n\nK = int(input())\ndist = [10**15 for i in range(K)]\ndist[1] = 1\nq = deque([1])\nwhile len(q) > 0:\n r = q.popleft()\n s = (r + 1) % K\n if dist[r] + 1 < dist[s]:\n dist[s] = dist[r] + 1\n q.append(s)\n t = (r * 10) % K\n if dist[r] < dist[t]:\n dist[t] = dist[r]\n q.appendleft(t)\nprint((dist[0]))\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-import heapq", "+from collections import deque", "-q = []", "-heapq.heappush(q, (0, 1))", "-while len(q) != 0:", "- prc, src = heapq.heappop(q)", "- if dist[src] < prc:", "- continue", "- if dist[(src + 1) % K] > dist[src] + 1:", "- dist[(src + 1) % K] = dist[src] + 1", "- heapq.heappush(q, (dist[(src + 1) % K], (src + 1) % K))", "- if dist[(10 * src) % K] > dist[src]:", "- dist[(10 * src) % K] = dist[src]", "- heapq.heappush(q, (dist[(src * 10) % K], (src * 10) % K))", "+q = deque([1])", "+while len(q) > 0:", "+ r = q.popleft()", "+ s = (r + 1) % K", "+ if dist[r] + 1 < dist[s]:", "+ dist[s] = dist[r] + 1", "+ q.append(s)", "+ t = (r * 10) % K", "+ if dist[r] < dist[t]:", "+ dist[t] = dist[r]", "+ q.appendleft(t)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4453229659, "measured_runtime_v1": 0.2901842129, "runtime_lift": 1.5346216162, "key": ["s159640382", "s651180421"]} +{"user_id": "u287132915", "problem_id": "p02792", "language": "python", "submission_id_v0": "s161079550", "submission_id_v1": "s476355973", "cpu_time_v0": 369, "cpu_time_v1": 198, "memory_v0": 46468, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.34, "input": "n = int(input())\n\n\n\ncnt = 0\n\nfor i in range(1, n+1):\n\n i_str = str(i)\n\n if len(i_str) == 1:\n\n cnt += 1\n\n continue\n\n if len(i_str) == 2:\n\n if int(i_str[0]) == int(i_str[1]):\n\n cnt += 3\n\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 3:\n\n if int(i_str[0]) == int(i_str[2]):\n\n cnt += 4 + (2 * (int(i_str[1])+1) - 1)\n\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n\n cnt += 22\n\n elif int(i_str[0]) < int(i_str[2]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 4:\n\n if int(i_str[0]) == int(i_str[3]):\n\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2])+1) - 1\n\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n\n cnt += 222\n\n elif int(i_str[0]) < int(i_str[3]):\n\n cnt += 22\n\n continue\n\n if len(i_str) == 5:\n\n if int(i_str[0]) == int(i_str[4]):\n\n cnt += 224 + 200 * int(i_str[1]) + 20 * int(i_str[2]) + 2 * (int(i_str[3])+1) - 1\n\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n\n cnt += 2222\n\n elif int(i_str[0]) < int(i_str[4]):\n\n cnt += 222\n\n continue\n\n if len(i_str) == 6:\n\n if int(i_str[0]) == int(i_str[5]):\n\n cnt += 2224 + 2000 * int(i_str[1]) + 200 * int(i_str[2]) + 20 * int(i_str[3]) + 2 * (int(i_str[4])+1) - 1\n\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n\n cnt += 22222\n\n elif int(i_str[0]) < int(i_str[5]):\n\n cnt += 2222\n\n continue\n\n\n\nprint(cnt)", "target": "n = int(input())\n\n\n\nc = [[0 for _ in range(10)] for __ in range(10)]\n\nfor i in range(1, n+1):\n\n str_i = str(i)\n\n head = int(str_i[0])\n\n tail = int(str_i[-1])\n\n c[head][tail] += 1\n\n\n\ncnt = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n cnt += c[i][j] * c[j][i]\n\n\n\nprint(cnt)", "code_v0_loc": 48, "code_v1_loc": 15, "code_v0_num_chars": 1676, "code_v1_num_chars": 295, "code_v0_no_empty_lines": "n = int(input())\ncnt = 0\nfor i in range(1, n + 1):\n i_str = str(i)\n if len(i_str) == 1:\n cnt += 1\n continue\n if len(i_str) == 2:\n if int(i_str[0]) == int(i_str[1]):\n cnt += 3\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n cnt += 2\n continue\n if len(i_str) == 3:\n if int(i_str[0]) == int(i_str[2]):\n cnt += 4 + (2 * (int(i_str[1]) + 1) - 1)\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n cnt += 22\n elif int(i_str[0]) < int(i_str[2]):\n cnt += 2\n continue\n if len(i_str) == 4:\n if int(i_str[0]) == int(i_str[3]):\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2]) + 1) - 1\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n cnt += 222\n elif int(i_str[0]) < int(i_str[3]):\n cnt += 22\n continue\n if len(i_str) == 5:\n if int(i_str[0]) == int(i_str[4]):\n cnt += (\n 224\n + 200 * int(i_str[1])\n + 20 * int(i_str[2])\n + 2 * (int(i_str[3]) + 1)\n - 1\n )\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n cnt += 2222\n elif int(i_str[0]) < int(i_str[4]):\n cnt += 222\n continue\n if len(i_str) == 6:\n if int(i_str[0]) == int(i_str[5]):\n cnt += (\n 2224\n + 2000 * int(i_str[1])\n + 200 * int(i_str[2])\n + 20 * int(i_str[3])\n + 2 * (int(i_str[4]) + 1)\n - 1\n )\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n cnt += 22222\n elif int(i_str[0]) < int(i_str[5]):\n cnt += 2222\n continue\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\nc = [[0 for _ in range(10)] for __ in range(10)]\nfor i in range(1, n + 1):\n str_i = str(i)\n head = int(str_i[0])\n tail = int(str_i[-1])\n c[head][tail] += 1\ncnt = 0\nfor i in range(10):\n for j in range(10):\n cnt += c[i][j] * c[j][i]\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 68.75, "diff": ["+c = [[0 for _ in range(10)] for __ in range(10)]", "+for i in range(1, n + 1):", "+ str_i = str(i)", "+ head = int(str_i[0])", "+ tail = int(str_i[-1])", "+ c[head][tail] += 1", "-for i in range(1, n + 1):", "- i_str = str(i)", "- if len(i_str) == 1:", "- cnt += 1", "- continue", "- if len(i_str) == 2:", "- if int(i_str[0]) == int(i_str[1]):", "- cnt += 3", "- elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):", "- cnt += 2", "- continue", "- if len(i_str) == 3:", "- if int(i_str[0]) == int(i_str[2]):", "- cnt += 4 + (2 * (int(i_str[1]) + 1) - 1)", "- elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):", "- cnt += 22", "- elif int(i_str[0]) < int(i_str[2]):", "- cnt += 2", "- continue", "- if len(i_str) == 4:", "- if int(i_str[0]) == int(i_str[3]):", "- cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2]) + 1) - 1", "- elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):", "- cnt += 222", "- elif int(i_str[0]) < int(i_str[3]):", "- cnt += 22", "- continue", "- if len(i_str) == 5:", "- if int(i_str[0]) == int(i_str[4]):", "- cnt += (", "- 224", "- + 200 * int(i_str[1])", "- + 20 * int(i_str[2])", "- + 2 * (int(i_str[3]) + 1)", "- - 1", "- )", "- elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):", "- cnt += 2222", "- elif int(i_str[0]) < int(i_str[4]):", "- cnt += 222", "- continue", "- if len(i_str) == 6:", "- if int(i_str[0]) == int(i_str[5]):", "- cnt += (", "- 2224", "- + 2000 * int(i_str[1])", "- + 200 * int(i_str[2])", "- + 20 * int(i_str[3])", "- + 2 * (int(i_str[4]) + 1)", "- - 1", "- )", "- elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):", "- cnt += 22222", "- elif int(i_str[0]) < int(i_str[5]):", "- cnt += 2222", "- continue", "+for i in range(10):", "+ for j in range(10):", "+ cnt += c[i][j] * c[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.528624272, "measured_runtime_v1": 0.3498814137, "runtime_lift": 1.5108669718, "key": ["s161079550", "s476355973"]} +{"user_id": "u285681431", "problem_id": "p03796", "language": "python", "submission_id_v0": "s922366861", "submission_id_v1": "s031671477", "cpu_time_v0": 154, "cpu_time_v1": 82, "memory_v0": 9940, "memory_v1": 62860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.75, "input": "import math\n\n\n\nN = int(input())\n\nans = math.factorial(N) % (10**9 + 7)\n\nprint(ans)", "target": "N = int(input())\n\nmod = 10**9 + 7\n\nans = 1\n\nfor i in range(1, N + 1):\n\n ans *= i\n\n ans %= mod\n\nprint(ans)\n", "code_v0_loc": 5, "code_v1_loc": 7, "code_v0_num_chars": 82, "code_v1_num_chars": 112, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nmod = 10**9 + 7\nans = 1\nfor i in range(1, N + 1):\n ans *= i\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-import math", "-", "-ans = math.factorial(N) % (10**9 + 7)", "+mod = 10**9 + 7", "+ans = 1", "+for i in range(1, N + 1):", "+ ans *= i", "+ ans %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.599384095, "measured_runtime_v1": 0.2730524833, "runtime_lift": 2.1951241301, "key": ["s922366861", "s031671477"]} +{"user_id": "u562935282", "problem_id": "p03038", "language": "python", "submission_id_v0": "s653342727", "submission_id_v1": "s579349204", "cpu_time_v0": 535, "cpu_time_v1": 476, "memory_v0": 31964, "memory_v1": 42656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.03, "input": "from heapq import heappop, heappush\n\n\n\nn, m = list(map(int, input().split()))\n\na = tuple(map(int, input().split()))\n\n\n\nhq = []\n\nfor aa in a:\n\n heappush(hq, (-aa, 1))\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(hq, (-c, b))\n\n\n\nrest = n\n\nans = 0\n\nwhile rest > 0:\n\n num, cnt = heappop(hq)\n\n\n\n num *= (-1)\n\n use = min(rest, cnt)\n\n ans += use * num\n\n rest -= use\n\n\n\nprint(ans)\n", "target": "def main():\n\n from collections import Counter\n\n from operator import itemgetter\n\n\n\n import sys\n\n input = sys.stdin.readline\n\n\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n\n\n ctr = Counter(a)\n\n for _ in range(M):\n\n b, c = list(map(int, input().split()))\n\n ctr[c] += b\n\n\n\n ans = 0\n\n rest = N\n\n for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):\n\n take = min(rest, count)\n\n ans += take * integer\n\n rest -= take\n\n if not rest:\n\n break\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n# import sys\n\n# input = sys.stdin.readline\n\n# \n\n# sys.setrecursionlimit(10 ** 7)\n\n# \n\n# (int(x)-1 for x in input().split())\n\n# rstrip()\n", "code_v0_loc": 24, "code_v1_loc": 37, "code_v0_num_chars": 414, "code_v1_num_chars": 760, "code_v0_no_empty_lines": "from heapq import heappop, heappush\n\nn, m = list(map(int, input().split()))\na = tuple(map(int, input().split()))\nhq = []\nfor aa in a:\n heappush(hq, (-aa, 1))\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n heappush(hq, (-c, b))\nrest = n\nans = 0\nwhile rest > 0:\n num, cnt = heappop(hq)\n num *= -1\n use = min(rest, cnt)\n ans += use * num\n rest -= use\nprint(ans)\n", "code_v1_no_empty_lines": "def main():\n from collections import Counter\n from operator import itemgetter\n import sys\n\n input = sys.stdin.readline\n N, M = list(map(int, input().split()))\n a = list(map(int, input().split()))\n ctr = Counter(a)\n for _ in range(M):\n b, c = list(map(int, input().split()))\n ctr[c] += b\n ans = 0\n rest = N\n for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):\n take = min(rest, count)\n ans += take * integer\n rest -= take\n if not rest:\n break\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n# import sys\n# input = sys.stdin.readline\n#\n# sys.setrecursionlimit(10 ** 7)\n#\n# (int(x)-1 for x in input().split())\n# rstrip()\n", "code_same": false, "relative_loc_diff_percent": 35.1351351351, "diff": ["-from heapq import heappop, heappush", "+def main():", "+ from collections import Counter", "+ from operator import itemgetter", "+ import sys", "-n, m = list(map(int, input().split()))", "-a = tuple(map(int, input().split()))", "-hq = []", "-for aa in a:", "- heappush(hq, (-aa, 1))", "-for _ in range(m):", "- b, c = list(map(int, input().split()))", "- heappush(hq, (-c, b))", "-rest = n", "-ans = 0", "-while rest > 0:", "- num, cnt = heappop(hq)", "- num *= -1", "- use = min(rest, cnt)", "- ans += use * num", "- rest -= use", "-print(ans)", "+ input = sys.stdin.readline", "+ N, M = list(map(int, input().split()))", "+ a = list(map(int, input().split()))", "+ ctr = Counter(a)", "+ for _ in range(M):", "+ b, c = list(map(int, input().split()))", "+ ctr[c] += b", "+ ans = 0", "+ rest = N", "+ for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):", "+ take = min(rest, count)", "+ ans += take * integer", "+ rest -= take", "+ if not rest:", "+ break", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()", "+# import sys", "+# input = sys.stdin.readline", "+#", "+# sys.setrecursionlimit(10 ** 7)", "+#", "+# (int(x)-1 for x in input().split())", "+# rstrip()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3003652287, "measured_runtime_v1": 0.218658349, "runtime_lift": 1.3736737242, "key": ["s653342727", "s579349204"]} +{"user_id": "u170201762", "problem_id": "p03371", "language": "python", "submission_id_v0": "s850530798", "submission_id_v1": "s933367975", "cpu_time_v0": 94, "cpu_time_v1": 18, "memory_v0": 7096, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.85, "input": "A,B,C,X,Y = list(map(int,input().split()))\n\nl = []\n\nfor i in range(max(X,Y)+1):\n\n T = i * C * 2\n\n if i < X: \n\n T += (X-i)*A\n\n if i < Y:\n\n T += (Y-i)*B\n\n l.append(T)\n\nl.sort()\n\nprint((l[0]))", "target": "A,B,C,X,Y = list(map(int,input().split()))\n\nans = 0\n\nif 2*C <= A+B:\n\n Z = min(X,Y)\n\n ans = 2*C*Z\n\n X -= Z\n\n Y -= Z\n\nans += min(2*C*X,A*X)\n\nans += min(2*C*Y,B*Y)\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 207, "code_v1_num_chars": 178, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nl = []\nfor i in range(max(X, Y) + 1):\n T = i * C * 2\n if i < X:\n T += (X - i) * A\n if i < Y:\n T += (Y - i) * B\n l.append(T)\nl.sort()\nprint((l[0]))\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = 0\nif 2 * C <= A + B:\n Z = min(X, Y)\n ans = 2 * C * Z\n X -= Z\n Y -= Z\nans += min(2 * C * X, A * X)\nans += min(2 * C * Y, B * Y)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-l = []", "-for i in range(max(X, Y) + 1):", "- T = i * C * 2", "- if i < X:", "- T += (X - i) * A", "- if i < Y:", "- T += (Y - i) * B", "- l.append(T)", "-l.sort()", "-print((l[0]))", "+ans = 0", "+if 2 * C <= A + B:", "+ Z = min(X, Y)", "+ ans = 2 * C * Z", "+ X -= Z", "+ Y -= Z", "+ans += min(2 * C * X, A * X)", "+ans += min(2 * C * Y, B * Y)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.290536653, "measured_runtime_v1": 0.1943999538, "runtime_lift": 1.494530463, "key": ["s850530798", "s933367975"]} +{"user_id": "u708211626", "problem_id": "p04012", "language": "python", "submission_id_v0": "s951351679", "submission_id_v1": "s246688975", "cpu_time_v0": 32, "cpu_time_v1": 26, "memory_v0": 9372, "memory_v1": 9000, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.75, "input": "import collections\n\nimport sys\n\na=input()\n\nb=[]\n\n\n\nfor i in a:\n\n b.append(i)\n\n \n\nb.sort()\n\nc=collections.Counter(b)\n\nc=list(c.values())\n\n\n\nfor i in range(len(c)):\n\n if int(c[i])%2==0:\n\n q=0\n\n else:\n\n q=1\n\n print('No')\n\n sys.exit()\n\n \n\nprint('Yes')\n", "target": "w = list(input())\n\ns = set(w)\n\nfor i in s:\n\n if w.count(i)%2 != 0:\n\n print(\"No\")\n\n break\n\nelse:\n\n print(\"Yes\")\n\n ", "code_v0_loc": 21, "code_v1_loc": 9, "code_v0_num_chars": 267, "code_v1_num_chars": 122, "code_v0_no_empty_lines": "import collections\nimport sys\n\na = input()\nb = []\nfor i in a:\n b.append(i)\nb.sort()\nc = collections.Counter(b)\nc = list(c.values())\nfor i in range(len(c)):\n if int(c[i]) % 2 == 0:\n q = 0\n else:\n q = 1\n print(\"No\")\n sys.exit()\nprint(\"Yes\")\n", "code_v1_no_empty_lines": "w = list(input())\ns = set(w)\nfor i in s:\n if w.count(i) % 2 != 0:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-import collections", "-import sys", "-", "-a = input()", "-b = []", "-for i in a:", "- b.append(i)", "-b.sort()", "-c = collections.Counter(b)", "-c = list(c.values())", "-for i in range(len(c)):", "- if int(c[i]) % 2 == 0:", "- q = 0", "- else:", "- q = 1", "+w = list(input())", "+s = set(w)", "+for i in s:", "+ if w.count(i) % 2 != 0:", "- sys.exit()", "-print(\"Yes\")", "+ break", "+else:", "+ print(\"Yes\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2393270415, "measured_runtime_v1": 0.1892163638, "runtime_lift": 1.2648326847, "key": ["s951351679", "s246688975"]} +{"user_id": "u379959788", "problem_id": "p03835", "language": "python", "submission_id_v0": "s258964318", "submission_id_v1": "s303783261", "cpu_time_v0": 1751, "cpu_time_v1": 1557, "memory_v0": 2940, "memory_v1": 3444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.08, "input": "#ABC951B/Sum_of_Three_Integers\n\n\n\nK, S = list(map(int, input().split()))\n\nans = 0\n\nfor x in range(0, K+1):\n\n for y in range(0, K+1):\n\n z = S - x - y\n\n if 0 <= z and z <= K:\n\n ans += 1\n\nprint(ans)", "target": "K, S = list(map(int, input().split()))\n\nans = 0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z = S - X - Y\n\n if Z >= 0 and Z <= K:\n\n ans += 1\n\nprint(ans) ", "code_v0_loc": 10, "code_v1_loc": 8, "code_v0_num_chars": 217, "code_v1_num_chars": 184, "code_v0_no_empty_lines": "# ABC951B/Sum_of_Three_Integers\nK, S = list(map(int, input().split()))\nans = 0\nfor x in range(0, K + 1):\n for y in range(0, K + 1):\n z = S - x - y\n if 0 <= z and z <= K:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "K, S = list(map(int, input().split()))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if Z >= 0 and Z <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-# ABC951B/Sum_of_Three_Integers", "-for x in range(0, K + 1):", "- for y in range(0, K + 1):", "- z = S - x - y", "- if 0 <= z and z <= K:", "+for X in range(K + 1):", "+ for Y in range(K + 1):", "+ Z = S - X - Y", "+ if Z >= 0 and Z <= K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2646004359, "measured_runtime_v1": 0.0728798735, "runtime_lift": 3.6306379676, "key": ["s258964318", "s303783261"]} +{"user_id": "u150984829", "problem_id": "p02276", "language": "python", "submission_id_v0": "s439916574", "submission_id_v1": "s927428389", "cpu_time_v0": 80, "cpu_time_v1": 60, "memory_v0": 16392, "memory_v1": 16388, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "n=int(input())-1\n\nA=list(map(int,input().split()))\n\ni=0\n\nfor j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\nA[i],A[n]=A[n],A[i]\n\nprint((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n", "target": "def s():\n\n n=int(input())-1\n\n A=list(map(int,input().split()))\n\n i=0\n\n for j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\n A[i],A[n]=A[n],A[i]\n\n print((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n\nif'__main__'==__name__:s()\n", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 219, "code_v1_num_chars": 264, "code_v0_no_empty_lines": "n = int(input()) - 1\nA = list(map(int, input().split()))\ni = 0\nfor j in range(n):\n if A[j] <= A[-1]:\n A[i], A[j] = A[j], A[i]\n i += 1\nA[i], A[n] = A[n], A[i]\nprint(\n (\n \" \".join(map(str, A[:i]))\n + \" [\"\n + str(A[i])\n + \"] \"\n + \" \".join(map(str, A[i + 1 :]))\n )\n)\n", "code_v1_no_empty_lines": "def s():\n n = int(input()) - 1\n A = list(map(int, input().split()))\n i = 0\n for j in range(n):\n if A[j] <= A[-1]:\n A[i], A[j] = A[j], A[i]\n i += 1\n A[i], A[n] = A[n], A[i]\n print(\n (\n \" \".join(map(str, A[:i]))\n + \" [\"\n + str(A[i])\n + \"] \"\n + \" \".join(map(str, A[i + 1 :]))\n )\n )\n\n\nif \"__main__\" == __name__:\n s()\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-n = int(input()) - 1", "-A = list(map(int, input().split()))", "-i = 0", "-for j in range(n):", "- if A[j] <= A[-1]:", "- A[i], A[j] = A[j], A[i]", "- i += 1", "-A[i], A[n] = A[n], A[i]", "-print(", "- (", "- \" \".join(map(str, A[:i]))", "- + \" [\"", "- + str(A[i])", "- + \"] \"", "- + \" \".join(map(str, A[i + 1 :]))", "+def s():", "+ n = int(input()) - 1", "+ A = list(map(int, input().split()))", "+ i = 0", "+ for j in range(n):", "+ if A[j] <= A[-1]:", "+ A[i], A[j] = A[j], A[i]", "+ i += 1", "+ A[i], A[n] = A[n], A[i]", "+ print(", "+ (", "+ \" \".join(map(str, A[:i]))", "+ + \" [\"", "+ + str(A[i])", "+ + \"] \"", "+ + \" \".join(map(str, A[i + 1 :]))", "+ )", "-)", "+", "+", "+if \"__main__\" == __name__:", "+ s()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2844968953, "measured_runtime_v1": 0.0927553341, "runtime_lift": 3.0671755746, "key": ["s439916574", "s927428389"]} +{"user_id": "u580404776", "problem_id": "p02792", "language": "python", "submission_id_v0": "s545080507", "submission_id_v1": "s376438645", "cpu_time_v0": 492, "cpu_time_v1": 192, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.98, "input": "N = int(input())\n\nmem = [[0]*10 for _ in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)\n", "target": "N = int(input())\n\nmem=[[0] * 10 for _ in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n mem[int(s[0])][int(s[-1])] += 1 \n\n \n\nans = 0\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += mem[i][j] * mem[j][i]\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 265, "code_v1_num_chars": 249, "code_v0_no_empty_lines": "N = int(input())\nmem = [[0] * 10 for _ in range(10)]\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n mem[a][b] += 1\nans = 0\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n ans += mem[b][a]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nmem = [[0] * 10 for _ in range(10)]\nfor i in range(1, N + 1):\n s = str(i)\n mem[int(s[0])][int(s[-1])] += 1\nans = 0\nfor i in range(1, 10):\n for j in range(1, 10):\n ans += mem[i][j] * mem[j][i]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- mem[a][b] += 1", "+ s = str(i)", "+ mem[int(s[0])][int(s[-1])] += 1", "-for i in range(1, N + 1):", "- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- ans += mem[b][a]", "+for i in range(1, 10):", "+ for j in range(1, 10):", "+ ans += mem[i][j] * mem[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4534644659, "measured_runtime_v1": 0.3052516449, "runtime_lift": 1.4855430706, "key": ["s545080507", "s376438645"]} +{"user_id": "u107077660", "problem_id": "p04012", "language": "python", "submission_id_v0": "s204906128", "submission_id_v1": "s764910207", "cpu_time_v0": 38, "cpu_time_v1": 29, "memory_v0": 3064, "memory_v1": 3444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.68, "input": "w = input()\n\nfor l in w:\n\n\tif w.count(l) % 2 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")", "target": "from collections import Counter\n\ns = input()\n\nc = list(Counter(s).values())\n\nfor n in c:\n\n\tif n & 1 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")\n\n\n", "code_v0_loc": 7, "code_v1_loc": 10, "code_v0_num_chars": 96, "code_v1_num_chars": 148, "code_v0_no_empty_lines": "w = input()\nfor l in w:\n if w.count(l) % 2 == 1:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_v1_no_empty_lines": "from collections import Counter\n\ns = input()\nc = list(Counter(s).values())\nfor n in c:\n if n & 1 == 1:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-w = input()", "-for l in w:", "- if w.count(l) % 2 == 1:", "+from collections import Counter", "+", "+s = input()", "+c = list(Counter(s).values())", "+for n in c:", "+ if n & 1 == 1:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3070713311, "measured_runtime_v1": 0.212444066, "runtime_lift": 1.44542202, "key": ["s204906128", "s764910207"]} +{"user_id": "u391875425", "problem_id": "p03416", "language": "python", "submission_id_v0": "s339057919", "submission_id_v1": "s254043060", "cpu_time_v0": 204, "cpu_time_v1": 57, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.06, "input": "a, b = list(map(int, input().split()))\n\ntmp=str(a)\n\nc=0\n\nfor i in range(a,b+1):\n\n tmp=str(i)\n\n tmp2=\"\"\n\n for s in range(len(tmp)):\n\n tmp2=tmp2+tmp[len(tmp)-1-s]\n\n if tmp==tmp2:\n\n c=c+1\n\nprint(c)", "target": "def main():\n\n #1. input\n\n a, b = list(map(int, input().split()))\n\n\n\n ans = 0\n\n\n\n #2. from A to B\n\n for i in range(a, b+1):\n\n #2.1. judge if the number is palindromic\n\n if (str(i)[0]==str(i)[4]) and (str(i)[1]==str(i)[3]):\n\n ans = ans+1\n\n\n\n #3. output\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 11, "code_v1_loc": 18, "code_v0_num_chars": 214, "code_v1_num_chars": 347, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ntmp = str(a)\nc = 0\nfor i in range(a, b + 1):\n tmp = str(i)\n tmp2 = \"\"\n for s in range(len(tmp)):\n tmp2 = tmp2 + tmp[len(tmp) - 1 - s]\n if tmp == tmp2:\n c = c + 1\nprint(c)\n", "code_v1_no_empty_lines": "def main():\n # 1. input\n a, b = list(map(int, input().split()))\n ans = 0\n # 2. from A to B\n for i in range(a, b + 1):\n # 2.1. judge if the number is palindromic\n if (str(i)[0] == str(i)[4]) and (str(i)[1] == str(i)[3]):\n ans = ans + 1\n # 3. output\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 38.8888888889, "diff": ["-a, b = list(map(int, input().split()))", "-tmp = str(a)", "-c = 0", "-for i in range(a, b + 1):", "- tmp = str(i)", "- tmp2 = \"\"", "- for s in range(len(tmp)):", "- tmp2 = tmp2 + tmp[len(tmp) - 1 - s]", "- if tmp == tmp2:", "- c = c + 1", "-print(c)", "+def main():", "+ # 1. input", "+ a, b = list(map(int, input().split()))", "+ ans = 0", "+ # 2. from A to B", "+ for i in range(a, b + 1):", "+ # 2.1. judge if the number is palindromic", "+ if (str(i)[0] == str(i)[4]) and (str(i)[1] == str(i)[3]):", "+ ans = ans + 1", "+ # 3. output", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5203332471, "measured_runtime_v1": 0.2634068646, "runtime_lift": 1.9753974444, "key": ["s339057919", "s254043060"]} +{"user_id": "u505420467", "problem_id": "p03835", "language": "python", "submission_id_v0": "s014481361", "submission_id_v1": "s844546698", "cpu_time_v0": 1491, "cpu_time_v1": 1254, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.9, "input": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n z=s-i-j\n\n if 0<=z<=k:\n\n ans+=1\n\nprint(ans)\n", "target": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0<=s-i-j<=k:\n\n ans+=1\n\nprint(ans)\n", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 154, "code_v1_num_chars": 141, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n z = s - i - j\n if 0 <= z <= k:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- z = s - i - j", "- if 0 <= z <= k:", "+ if 0 <= s - i - j <= k:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2451675486, "measured_runtime_v1": 0.0064913454, "runtime_lift": 37.7683720217, "key": ["s014481361", "s844546698"]} +{"user_id": "u285891772", "problem_id": "p03078", "language": "python", "submission_id_v0": "s323914382", "submission_id_v1": "s323368336", "cpu_time_v0": 910, "cpu_time_v1": 524, "memory_v0": 69644, "memory_v1": 18184, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.42, "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return map(int, input().split())\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nAB = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tAB.append(A[i]+B[j])\n\n\n\nAB.sort(reverse = True)\n\nAB = AB[:3000]\n\nABC = sorted([C[0]+AB[i] for i in range(min(3000, X*Y))], reverse = True)\n\n\n\nfor j in range(1, Z):\n\n\tABC_tmp = sorted([C[j]+AB[i] for i in range(min(3000, X*Y))])\n\n\tABC += ABC_tmp\n\n\tABC.sort(reverse = True)\n\n\tABC = ABC[:3000]\n\n\n\nprint(*ABC[:K], sep= \"\\n\")\n\n\n", "target": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nans = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tfor k in range(Z):\n\n\t\t\tif (i+1)*(j+1)*(k+1) <= K:\n\n\t\t\t\tans.append(A[i]+B[j]+C[k])\n\n\t\t\telse:\n\n\t\t\t\tbreak\n\n\n\nfor a in sorted(ans)[::-1][:K]:\n\n\tprint(a)\n", "code_v0_loc": 46, "code_v1_loc": 40, "code_v0_num_chars": 1517, "code_v1_num_chars": 1344, "code_v0_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return map(int, input().split())\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return zip(*(MAP() for _ in range(n)))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nAB = []\nfor i in range(X):\n for j in range(Y):\n AB.append(A[i] + B[j])\nAB.sort(reverse=True)\nAB = AB[:3000]\nABC = sorted([C[0] + AB[i] for i in range(min(3000, X * Y))], reverse=True)\nfor j in range(1, Z):\n ABC_tmp = sorted([C[j] + AB[i] for i in range(min(3000, X * Y))])\n ABC += ABC_tmp\n ABC.sort(reverse=True)\n ABC = ABC[:3000]\nprint(*ABC[:K], sep=\"\\n\")\n", "code_v1_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nans = []\nfor i in range(X):\n for j in range(Y):\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) <= K:\n ans.append(A[i] + B[j] + C[k])\n else:\n break\nfor a in sorted(ans)[::-1][:K]:\n print(a)\n", "code_same": false, "relative_loc_diff_percent": 13.0434782609, "diff": ["- return int(input())", "+ return int(input())", "- return map(int, input().split())", "+ return list(map(int, input().split()))", "- return zip(*(MAP() for _ in range(n)))", "+ return list(zip(*(MAP() for _ in range(n))))", "-AB = []", "+ans = []", "- AB.append(A[i] + B[j])", "-AB.sort(reverse=True)", "-AB = AB[:3000]", "-ABC = sorted([C[0] + AB[i] for i in range(min(3000, X * Y))], reverse=True)", "-for j in range(1, Z):", "- ABC_tmp = sorted([C[j] + AB[i] for i in range(min(3000, X * Y))])", "- ABC += ABC_tmp", "- ABC.sort(reverse=True)", "- ABC = ABC[:3000]", "-print(*ABC[:K], sep=\"\\n\")", "+ for k in range(Z):", "+ if (i + 1) * (j + 1) * (k + 1) <= K:", "+ ans.append(A[i] + B[j] + C[k])", "+ else:", "+ break", "+for a in sorted(ans)[::-1][:K]:", "+ print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3039683881, "measured_runtime_v1": 0.2292593994, "runtime_lift": 1.3258709952, "key": ["s323914382", "s323368336"]} +{"user_id": "u759934006", "problem_id": "p00174", "language": "python", "submission_id_v0": "s437122774", "submission_id_v1": "s723923476", "cpu_time_v0": 20, "cpu_time_v1": 10, "memory_v0": 4228, "memory_v1": 4232, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "while True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n a = b = 0\n\n for i, s in enumerate(line):\n\n if i != 0:\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break", "target": "while True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n if line[0] == 'A':\n\n a = -1\n\n b = 0\n\n else:\n\n a = 0\n\n b = -1\n\n for i, s in enumerate(line):\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break", "code_v0_loc": 22, "code_v1_loc": 26, "code_v0_num_chars": 515, "code_v1_num_chars": 593, "code_v0_no_empty_lines": "while True:\n try:\n for i in range(3):\n line = input().strip()\n if line == \"0\":\n raise Exception\n a = b = 0\n for i, s in enumerate(line):\n if i != 0:\n if s == \"A\":\n a += 1\n else:\n b += 1\n if a > b:\n a += 1\n else:\n b += 1\n print(a, b)\n except:\n break\n", "code_v1_no_empty_lines": "while True:\n try:\n for i in range(3):\n line = input().strip()\n if line == \"0\":\n raise Exception\n if line[0] == \"A\":\n a = -1\n b = 0\n else:\n a = 0\n b = -1\n for i, s in enumerate(line):\n if s == \"A\":\n a += 1\n else:\n b += 1\n if a > b:\n a += 1\n else:\n b += 1\n print(a, b)\n except:\n break\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["- a = b = 0", "+ if line[0] == \"A\":", "+ a = -1", "+ b = 0", "+ else:", "+ a = 0", "+ b = -1", "- if i != 0:", "- if s == \"A\":", "- a += 1", "- else:", "- b += 1", "+ if s == \"A\":", "+ a += 1", "+ else:", "+ b += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1803158569, "measured_runtime_v1": 0.0065688469, "runtime_lift": 27.4501534712, "key": ["s437122774", "s723923476"]} +{"user_id": "u867848444", "problem_id": "p03559", "language": "python", "submission_id_v0": "s912886810", "submission_id_v1": "s338115037", "cpu_time_v0": 472, "cpu_time_v1": 254, "memory_v0": 106340, "memory_v1": 29384, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.19, "input": "from bisect import *\n\nn = int(input())\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na = sorted(a)\n\nc = sorted(c)\n\n\n\nrec = 0\n\nfor i in range(n):\n\n temp = b[i]\n\n l = bisect_left(a, temp)\n\n r = bisect_right(c, temp)\n\n rec += l * (n - r)\n\nprint(rec)", "target": "from bisect import *\n\nn = int(input())\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na.sort()\n\nc.sort()\n\nres = 0\n\nfor i in b:\n\n temp_a = bisect_left(a, i)\n\n temp_c = n - bisect_right(c, i)\n\n res += temp_a*temp_c\n\nprint(res)", "code_v0_loc": 16, "code_v1_loc": 14, "code_v0_num_chars": 323, "code_v1_num_chars": 297, "code_v0_no_empty_lines": "from bisect import *\n\nn = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na = sorted(a)\nc = sorted(c)\nrec = 0\nfor i in range(n):\n temp = b[i]\n l = bisect_left(a, temp)\n r = bisect_right(c, temp)\n rec += l * (n - r)\nprint(rec)\n", "code_v1_no_empty_lines": "from bisect import *\n\nn = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort()\nc.sort()\nres = 0\nfor i in b:\n temp_a = bisect_left(a, i)\n temp_c = n - bisect_right(c, i)\n res += temp_a * temp_c\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-a = sorted(a)", "-c = sorted(c)", "-rec = 0", "-for i in range(n):", "- temp = b[i]", "- l = bisect_left(a, temp)", "- r = bisect_right(c, temp)", "- rec += l * (n - r)", "-print(rec)", "+a.sort()", "+c.sort()", "+res = 0", "+for i in b:", "+ temp_a = bisect_left(a, i)", "+ temp_c = n - bisect_right(c, i)", "+ res += temp_a * temp_c", "+print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2357759671, "measured_runtime_v1": 0.1661899195, "runtime_lift": 1.4187140102, "key": ["s912886810", "s338115037"]} +{"user_id": "u761320129", "problem_id": "p03592", "language": "python", "submission_id_v0": "s651607907", "submission_id_v1": "s022339691", "cpu_time_v0": 277, "cpu_time_v1": 242, "memory_v0": 9168, "memory_v1": 9152, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.64, "input": "N,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n t = i*M + j*N - i*j*2\n\n if t==K:\n\n print('Yes')\n\n exit()\n\nprint('No')", "target": "N,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n if i*(M-j) + j*(N-i) == K:\n\n print('Yes')\n\n exit()\n\nprint('No')", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 190, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "N, M, K = list(map(int, input().split()))\nfor i in range(N + 1):\n for j in range(M + 1):\n t = i * M + j * N - i * j * 2\n if t == K:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_v1_no_empty_lines": "N, M, K = list(map(int, input().split()))\nfor i in range(N + 1):\n for j in range(M + 1):\n if i * (M - j) + j * (N - i) == K:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- t = i * M + j * N - i * j * 2", "- if t == K:", "+ if i * (M - j) + j * (N - i) == K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2590724151, "measured_runtime_v1": 0.2069754691, "runtime_lift": 1.2517058964, "key": ["s651607907", "s022339691"]} +{"user_id": "u078042885", "problem_id": "p00542", "language": "python", "submission_id_v0": "s237799080", "submission_id_v1": "s666902384", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7744, "memory_v1": 7736, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "a,b,c,d,e,f=[int(input()) for _ in range(6)]\n\nprint((sum([a,b,c,d,max(e,f)])-min([a,b,c,d])))", "target": "print((sum(sorted(int(input()) for _ in range(4))[1:])+max([int(input()) for _ in range(2)])))", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 91, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "a, b, c, d, e, f = [int(input()) for _ in range(6)]\nprint((sum([a, b, c, d, max(e, f)]) - min([a, b, c, d])))\n", "code_v1_no_empty_lines": "print(\n (\n sum(sorted(int(input()) for _ in range(4))[1:])\n + max([int(input()) for _ in range(2)])\n )\n)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-a, b, c, d, e, f = [int(input()) for _ in range(6)]", "-print((sum([a, b, c, d, max(e, f)]) - min([a, b, c, d])))", "+print(", "+ (", "+ sum(sorted(int(input()) for _ in range(4))[1:])", "+ + max([int(input()) for _ in range(2)])", "+ )", "+)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1785885925, "measured_runtime_v1": 0.1362432997, "runtime_lift": 1.3108064241, "key": ["s237799080", "s666902384"]} +{"user_id": "u135454978", "problem_id": "p03371", "language": "python", "submission_id_v0": "s681762997", "submission_id_v1": "s948041496", "cpu_time_v0": 154, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 88.96, "input": "# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z / 2), 0)\n\n y = max(Y - int(z / 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n", "target": "# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\n\"\"\"\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z / 2), 0)\n\n y = max(Y - int(z / 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n\n\"\"\"\n\n\n\nprice1 = A * X + B * Y\n\nprice2 = C * 2 * X + B * max(Y - X, 0)\n\nprice3 = A * max(X - Y, 0) + C * 2 * Y\n\nprint((min(price1, price2, price3)))\n\n\n", "code_v0_loc": 14, "code_v1_loc": 22, "code_v0_num_chars": 332, "code_v1_num_chars": 486, "code_v0_no_empty_lines": "# AtCoder Beginner Contest 095 C - Half and Half\nimport sys\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\nans = A * X + B * Y\nfor z in range(2, 2 * 10**5 + 1, 2):\n x = max(X - int(z / 2), 0)\n y = max(Y - int(z / 2), 0)\n price = A * x + B * y + C * z\n ans = min(price, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "# AtCoder Beginner Contest 095 C - Half and Half\nimport sys\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\"\"\"\nans = A * X + B * Y\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n x = max(X - int(z / 2), 0)\n y = max(Y - int(z / 2), 0)\n price = A * x + B * y + C * z\n ans = min(price, ans)\nprint(ans)\n\"\"\"\nprice1 = A * X + B * Y\nprice2 = C * 2 * X + B * max(Y - X, 0)\nprice3 = A * max(X - Y, 0) + C * 2 * Y\nprint((min(price1, price2, price3)))\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["+\"\"\"", "-for z in range(2, 2 * 10**5 + 1, 2):", "+for z in range(2, 2 * 10 ** 5 + 1, 2):", "+\"\"\"", "+price1 = A * X + B * Y", "+price2 = C * 2 * X + B * max(Y - X, 0)", "+price3 = A * max(X - Y, 0) + C * 2 * Y", "+print((min(price1, price2, price3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.7125969741, "measured_runtime_v1": 0.2827094927, "runtime_lift": 6.0577979106, "key": ["s681762997", "s948041496"]} +{"user_id": "u545368057", "problem_id": "p02773", "language": "python", "submission_id_v0": "s347160213", "submission_id_v1": "s313812634", "cpu_time_v0": 801, "cpu_time_v1": 714, "memory_v0": 32480, "memory_v1": 35572, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.86, "input": "from collections import defaultdict\n\nN = int(input())\n\nd = defaultdict(int)\n\n\n\nfor i in range(N):\n\n S = input()\n\n d[S] += 1\n\n\n\nm = 0\n\nfor k in list(d.keys()):\n\n m = max(d[k],m)\n\n\n\nli = []\n\nfor k in list(d.keys()):\n\n if d[k] == m:\n\n li.append(k)\n\n\n\nli.sort()\n\nfor l in li:\n\n print(l)", "target": "from collections import defaultdict\n\nN = int(input())\n\nSs = [input() for i in range(N)]\n\n\n\nd = defaultdict(int)\n\nfor S in Ss:\n\n d[S] += 1\n\n\n\nmx = max([d[k] for k in list(d.keys())])\n\n\n\nans = []\n\nfor k in list(d.keys()):\n\n if d[k] == mx:\n\n ans.append(k)\n\n \n\nfor a in sorted(ans):\n\n print(a)", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 292, "code_v1_num_chars": 298, "code_v0_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nd = defaultdict(int)\nfor i in range(N):\n S = input()\n d[S] += 1\nm = 0\nfor k in list(d.keys()):\n m = max(d[k], m)\nli = []\nfor k in list(d.keys()):\n if d[k] == m:\n li.append(k)\nli.sort()\nfor l in li:\n print(l)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nSs = [input() for i in range(N)]\nd = defaultdict(int)\nfor S in Ss:\n d[S] += 1\nmx = max([d[k] for k in list(d.keys())])\nans = []\nfor k in list(d.keys()):\n if d[k] == mx:\n ans.append(k)\nfor a in sorted(ans):\n print(a)\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["+Ss = [input() for i in range(N)]", "-for i in range(N):", "- S = input()", "+for S in Ss:", "-m = 0", "+mx = max([d[k] for k in list(d.keys())])", "+ans = []", "- m = max(d[k], m)", "-li = []", "-for k in list(d.keys()):", "- if d[k] == m:", "- li.append(k)", "-li.sort()", "-for l in li:", "- print(l)", "+ if d[k] == mx:", "+ ans.append(k)", "+for a in sorted(ans):", "+ print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1866922059, "measured_runtime_v1": 0.0060809708, "runtime_lift": 30.7010529798, "key": ["s347160213", "s313812634"]} +{"user_id": "u600402037", "problem_id": "p03037", "language": "python", "submission_id_v0": "s181457641", "submission_id_v1": "s911516772", "cpu_time_v0": 300, "cpu_time_v1": 197, "memory_v0": 11012, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 34.33, "input": "N,M = list(map(int,input().split()))\n\nL,R = [],[]\n\nfor i in range(M):\n\n l,r = list(map(int,input().split()))\n\n L.append(l)\n\n R.append(r)\n\nans = min(R)-max(L)+1\n\nprint((ans if ans >= 0 else 0))", "target": "# coding: utf-8\n\nimport sys\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN, M = lr()\n\nL = 0; R = 10 ** 6\n\nfor _ in range(M):\n\n l, r = lr()\n\n if l > L:\n\n L = l\n\n if r < R:\n\n R = r\n\n\n\nanswer = max(0, R - L + 1)\n\nprint(answer)\n", "code_v0_loc": 8, "code_v1_loc": 18, "code_v0_num_chars": 187, "code_v1_num_chars": 318, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL, R = [], []\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\nans = min(R) - max(L) + 1\nprint((ans if ans >= 0 else 0))\n", "code_v1_no_empty_lines": "# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN, M = lr()\nL = 0\nR = 10**6\nfor _ in range(M):\n l, r = lr()\n if l > L:\n L = l\n if r < R:\n R = r\nanswer = max(0, R - L + 1)\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-N, M = list(map(int, input().split()))", "-L, R = [], []", "-for i in range(M):", "- l, r = list(map(int, input().split()))", "- L.append(l)", "- R.append(r)", "-ans = min(R) - max(L) + 1", "-print((ans if ans >= 0 else 0))", "+# coding: utf-8", "+import sys", "+", "+sr = lambda: sys.stdin.readline().rstrip()", "+ir = lambda: int(sr())", "+lr = lambda: list(map(int, sr().split()))", "+N, M = lr()", "+L = 0", "+R = 10**6", "+for _ in range(M):", "+ l, r = lr()", "+ if l > L:", "+ L = l", "+ if r < R:", "+ R = r", "+answer = max(0, R - L + 1)", "+print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2034662783, "measured_runtime_v1": 0.0060762894, "runtime_lift": 33.4852842041, "key": ["s181457641", "s911516772"]} +{"user_id": "u175590965", "problem_id": "p02881", "language": "python", "submission_id_v0": "s837964487", "submission_id_v1": "s558772824", "cpu_time_v0": 232, "cpu_time_v1": 167, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.02, "input": "n = int(input())\n\nl = []\n\nfor i in range(1,1000001):\n\n a = n / i\n\n if a.is_integer():\n\n l.append(i+n/i)\n\nprint((int(min(l)-2)))", "target": "n = int(input())\n\na = 10**20\n\nfor i in range(1,int(n**0.5)+1):\n\n if n%i==0:\n\n a = min(a,i+n//i)\n\nprint((a-2))", "code_v0_loc": 7, "code_v1_loc": 6, "code_v0_num_chars": 138, "code_v1_num_chars": 117, "code_v0_no_empty_lines": "n = int(input())\nl = []\nfor i in range(1, 1000001):\n a = n / i\n if a.is_integer():\n l.append(i + n / i)\nprint((int(min(l) - 2)))\n", "code_v1_no_empty_lines": "n = int(input())\na = 10**20\nfor i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n a = min(a, i + n // i)\nprint((a - 2))\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-l = []", "-for i in range(1, 1000001):", "- a = n / i", "- if a.is_integer():", "- l.append(i + n / i)", "-print((int(min(l) - 2)))", "+a = 10**20", "+for i in range(1, int(n**0.5) + 1):", "+ if n % i == 0:", "+ a = min(a, i + n // i)", "+print((a - 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3549120984, "measured_runtime_v1": 0.219868273, "runtime_lift": 6.1623811373, "key": ["s837964487", "s558772824"]} +{"user_id": "u186838327", "problem_id": "p02881", "language": "python", "submission_id_v0": "s806961932", "submission_id_v1": "s386327339", "cpu_time_v0": 218, "cpu_time_v1": 179, "memory_v0": 40428, "memory_v1": 39280, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.89, "input": "n = int(input())\n\nimport math\n\nm = int(math.sqrt(n))+1\n\nanss = []\n\nfor x in range(1, m+1):\n\n y = n//x\n\n z = n%x\n\n if z == 0:\n\n anss.append(abs(x-1)+abs(y-1))\n\nprint((min(anss)))\n", "target": "n = int(input())\n\ndef make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n // i:\n\n divisors.append(n//i)\n\n\n\n #divisors.sort(reverse=True)\n\n return divisors\n\n\n\nl = make_divisors(n)\n\nmin_ = float('inf')\n\nfor i in range(len(l)):\n\n min_ = min(min_, l[i]-1+n//l[i]-1)\n\nprint(min_)\n", "code_v0_loc": 10, "code_v1_loc": 17, "code_v0_num_chars": 182, "code_v1_num_chars": 402, "code_v0_no_empty_lines": "n = int(input())\nimport math\n\nm = int(math.sqrt(n)) + 1\nanss = []\nfor x in range(1, m + 1):\n y = n // x\n z = n % x\n if z == 0:\n anss.append(abs(x - 1) + abs(y - 1))\nprint((min(anss)))\n", "code_v1_no_empty_lines": "n = int(input())\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n // i)\n # divisors.sort(reverse=True)\n return divisors\n\n\nl = make_divisors(n)\nmin_ = float(\"inf\")\nfor i in range(len(l)):\n min_ = min(min_, l[i] - 1 + n // l[i] - 1)\nprint(min_)\n", "code_same": false, "relative_loc_diff_percent": 41.1764705882, "diff": ["-import math", "-m = int(math.sqrt(n)) + 1", "-anss = []", "-for x in range(1, m + 1):", "- y = n // x", "- z = n % x", "- if z == 0:", "- anss.append(abs(x - 1) + abs(y - 1))", "-print((min(anss)))", "+", "+def make_divisors(n):", "+ divisors = []", "+ for i in range(1, int(n**0.5) + 1):", "+ if n % i == 0:", "+ divisors.append(i)", "+ if i != n // i:", "+ divisors.append(n // i)", "+ # divisors.sort(reverse=True)", "+ return divisors", "+", "+", "+l = make_divisors(n)", "+min_ = float(\"inf\")", "+for i in range(len(l)):", "+ min_ = min(min_, l[i] - 1 + n // l[i] - 1)", "+print(min_)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3428507342, "measured_runtime_v1": 0.2632945333, "runtime_lift": 1.302156676, "key": ["s806961932", "s386327339"]} +{"user_id": "u850516963", "problem_id": "p03455", "language": "python", "submission_id_v0": "s887829630", "submission_id_v1": "s071542109", "cpu_time_v0": 67, "cpu_time_v1": 30, "memory_v0": 61732, "memory_v1": 9060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.22, "input": "a, b = list(map(int, input().split()))\n\nif a*b%2 == 1:\n\n print(\"Odd\")\n\nelse:\n\n print(\"Even\")", "target": "a, b = list(map(int, input().split()))\n\nprint(('Odd'if a&b&1 else 'Even'))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 92, "code_v1_num_chars": 66, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nif a * b % 2 == 1:\n print(\"Odd\")\nelse:\n print(\"Even\")\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nprint((\"Odd\" if a & b & 1 else \"Even\"))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-if a * b % 2 == 1:", "- print(\"Odd\")", "-else:", "- print(\"Even\")", "+print((\"Odd\" if a & b & 1 else \"Even\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1895228839, "measured_runtime_v1": 0.0064490705, "runtime_lift": 29.3876276628, "key": ["s887829630", "s071542109"]} +{"user_id": "u503228842", "problem_id": "p02555", "language": "python", "submission_id_v0": "s264986040", "submission_id_v1": "s936814116", "cpu_time_v0": 455, "cpu_time_v1": 29, "memory_v0": 9180, "memory_v1": 9188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 93.63, "input": "n = int(input())\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n for j in range(i - 2):\n\n ans[i] += ans[j]\n\n ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n", "target": "n = int(input())\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n ans[i] = ans[i - 1] + ans[i - 3]\n\n ans[i] %= m\n\n # for j in range(i - 2):\n\n # ans[i] += ans[j]\n\n # ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n", "code_v0_loc": 14, "code_v1_loc": 16, "code_v0_num_chars": 263, "code_v1_num_chars": 324, "code_v0_no_empty_lines": "n = int(input())\nm = 10**9 + 7\n# ans = [0] * (n + 1)\nans = [0] * 2200\nans[0] = 1\n# ans[3] = 1\n# ans[4] = 1\n# ans[5] = 1\nfor i in range(3, n + 1):\n for j in range(i - 2):\n ans[i] += ans[j]\n ans[i] %= m\nprint((ans[n]))\n# print(ans[:10])\n", "code_v1_no_empty_lines": "n = int(input())\nm = 10**9 + 7\n# ans = [0] * (n + 1)\nans = [0] * 2200\nans[0] = 1\n# ans[3] = 1\n# ans[4] = 1\n# ans[5] = 1\nfor i in range(3, n + 1):\n ans[i] = ans[i - 1] + ans[i - 3]\n ans[i] %= m\n # for j in range(i - 2):\n # ans[i] += ans[j]\n # ans[i] %= m\nprint((ans[n]))\n# print(ans[:10])\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- for j in range(i - 2):", "- ans[i] += ans[j]", "- ans[i] %= m", "+ ans[i] = ans[i - 1] + ans[i - 3]", "+ ans[i] %= m", "+ # for j in range(i - 2):", "+ # ans[i] += ans[j]", "+ # ans[i] %= m"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6218082716, "measured_runtime_v1": 0.188438025, "runtime_lift": 3.2998025299, "key": ["s264986040", "s936814116"]} +{"user_id": "u754022296", "problem_id": "p04021", "language": "python", "submission_id_v0": "s724849949", "submission_id_v1": "s422278370", "cpu_time_v0": 219, "cpu_time_v1": 182, "memory_v0": 23552, "memory_v1": 23552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.89, "input": "import sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(input())\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n if (L[i][1]-i)%2:\n\n count += 1\n\nans = (count+1) // 2\n\nprint(ans)", "target": "import sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(input())\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n count += (L[i][1]-i)%2\n\nans = (count+1) // 2\n\nprint(ans)\n", "code_v0_loc": 13, "code_v1_loc": 12, "code_v0_num_chars": 260, "code_v1_num_chars": 250, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nread = sys.stdin.read\nn = int(input())\nA = list(map(int, read().split()))\nL = sorted([(j, i) for i, j in enumerate(A)])\ncount = 0\nfor i in range(n):\n if (L[i][1] - i) % 2:\n count += 1\nans = (count + 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nread = sys.stdin.read\nn = int(input())\nA = list(map(int, read().split()))\nL = sorted([(j, i) for i, j in enumerate(A)])\ncount = 0\nfor i in range(n):\n count += (L[i][1] - i) % 2\nans = (count + 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["- if (L[i][1] - i) % 2:", "- count += 1", "+ count += (L[i][1] - i) % 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2933020202, "measured_runtime_v1": 0.2201511685, "runtime_lift": 1.3322755547, "key": ["s724849949", "s422278370"]} +{"user_id": "u072053884", "problem_id": "p02378", "language": "python", "submission_id_v0": "s432486243", "submission_id_v1": "s242092393", "cpu_time_v0": 350, "cpu_time_v1": 120, "memory_v0": 8348, "memory_v1": 8420, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.71, "input": "# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if unvisited[v] and (r_capacity > 0):\n\n parent[v].append(u)\n\n queue.append(v)\n\n unvisited[v] = False\n\n return unvisited[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while not bfs(source, sink, parent):\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))", "target": "# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n level = [v_num] * v_num\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n level[start] = 0\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n next_level = level[u] + 1\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if (level[v] >= next_level) and (r_capacity > 0):\n\n level[v] = next_level\n\n parent[v].append(u)\n\n if unvisited[v]:\n\n queue.append(v)\n\n unvisited[v] = False\n\n return level[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while bfs(source, sink, parent) != v_num:\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))", "code_v0_loc": 75, "code_v1_loc": 80, "code_v0_num_chars": 1953, "code_v1_num_chars": 2133, "code_v0_no_empty_lines": "# Acceptance of input\nimport sys\n\nfile_input = sys.stdin\nX, Y, E = list(map(int, file_input.readline().split()))\nv_num = X + Y + 2\nadj_mat = [[0] * (v_num) for i in range(v_num)]\nfor line in file_input:\n x, y = list(map(int, line.split()))\n adj_mat[x][X + y] = 1\ns = X + Y\nt = s + 1\nfor i in range(X):\n adj_mat[s][i] = 1\nfor i in range(X, s):\n adj_mat[i][t] = 1\n# Dinic's algorithm\nimport collections\n\n# BFS for residual capacity network to construct level graph\ndef bfs(start, goal, parent):\n unvisited = [True] * v_num\n queue = collections.deque()\n queue.append(start)\n unvisited[start] = False\n while queue:\n u = queue.popleft()\n for v, r_capacity in enumerate(adj_mat[u]):\n if unvisited[v] and (r_capacity > 0):\n parent[v].append(u)\n queue.append(v)\n unvisited[v] = False\n return unvisited[goal]\n\n\n# DFS for level graph and construct blocking flow\ndef dfs(goal, path, parent, blocking_flow):\n v = path[-1]\n if v == goal:\n aug_path_flow = 10000\n for x, y in zip(path[1:], path[:-1]):\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n for x, y in zip(path[1:], path[:-1]):\n adj_mat[x][y] -= aug_path_flow\n adj_mat[y][x] += aug_path_flow\n blocking_flow[0] += aug_path_flow\n else:\n for u in parent[v]:\n path.append(u)\n dfs(goal, path, parent, blocking_flow)\n path.pop()\n\n\ndef dinic(source, sink):\n max_flow = 0\n parent = [[] for i in range(v_num)]\n while not bfs(source, sink, parent):\n blocking_flow = [0]\n path = [sink]\n # search in reverse direction from sink\n dfs(source, path, parent, blocking_flow)\n max_flow += blocking_flow[0]\n parent = [[] for i in range(v_num)]\n return max_flow\n\n\n# output\nprint((dinic(s, t)))\n", "code_v1_no_empty_lines": "# Acceptance of input\nimport sys\n\nfile_input = sys.stdin\nX, Y, E = list(map(int, file_input.readline().split()))\nv_num = X + Y + 2\nadj_mat = [[0] * (v_num) for i in range(v_num)]\nfor line in file_input:\n x, y = list(map(int, line.split()))\n adj_mat[x][X + y] = 1\ns = X + Y\nt = s + 1\nfor i in range(X):\n adj_mat[s][i] = 1\nfor i in range(X, s):\n adj_mat[i][t] = 1\n# Dinic's algorithm\nimport collections\n\n# BFS for residual capacity network to construct level graph\ndef bfs(start, goal, parent):\n level = [v_num] * v_num\n unvisited = [True] * v_num\n queue = collections.deque()\n queue.append(start)\n level[start] = 0\n unvisited[start] = False\n while queue:\n u = queue.popleft()\n next_level = level[u] + 1\n for v, r_capacity in enumerate(adj_mat[u]):\n if (level[v] >= next_level) and (r_capacity > 0):\n level[v] = next_level\n parent[v].append(u)\n if unvisited[v]:\n queue.append(v)\n unvisited[v] = False\n return level[goal]\n\n\n# DFS for level graph and construct blocking flow\ndef dfs(goal, path, parent, blocking_flow):\n v = path[-1]\n if v == goal:\n aug_path_flow = 10000\n for x, y in zip(path[1:], path[:-1]):\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n for x, y in zip(path[1:], path[:-1]):\n adj_mat[x][y] -= aug_path_flow\n adj_mat[y][x] += aug_path_flow\n blocking_flow[0] += aug_path_flow\n else:\n for u in parent[v]:\n path.append(u)\n dfs(goal, path, parent, blocking_flow)\n path.pop()\n\n\ndef dinic(source, sink):\n max_flow = 0\n parent = [[] for i in range(v_num)]\n while bfs(source, sink, parent) != v_num:\n blocking_flow = [0]\n path = [sink]\n # search in reverse direction from sink\n dfs(source, path, parent, blocking_flow)\n max_flow += blocking_flow[0]\n parent = [[] for i in range(v_num)]\n return max_flow\n\n\n# output\nprint((dinic(s, t)))\n", "code_same": false, "relative_loc_diff_percent": 6.25, "diff": ["+ level = [v_num] * v_num", "+ level[start] = 0", "+ next_level = level[u] + 1", "- if unvisited[v] and (r_capacity > 0):", "+ if (level[v] >= next_level) and (r_capacity > 0):", "+ level[v] = next_level", "- queue.append(v)", "- unvisited[v] = False", "- return unvisited[goal]", "+ if unvisited[v]:", "+ queue.append(v)", "+ unvisited[v] = False", "+ return level[goal]", "- while not bfs(source, sink, parent):", "+ while bfs(source, sink, parent) != v_num:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2959556043, "measured_runtime_v1": 0.2352844019, "runtime_lift": 1.2578632579, "key": ["s432486243", "s242092393"]} +{"user_id": "u285891772", "problem_id": "p02837", "language": "python", "submission_id_v0": "s234390283", "submission_id_v1": "s698943579", "cpu_time_v0": 281, "cpu_time_v1": 125, "memory_v0": 5204, "memory_v1": 5964, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.52, "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom math import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\nfrom decimal import Decimal\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\nfrom decimal import *\n\n\n\nN = INT()\n\nxy = []\n\n\n\nfor i in range(N):\n\n\tA = INT()\n\n\txy.append([LIST() for _ in range(A)])\n\n\n\nans = 0\n\nfor i in range(1<= K - 1:\n\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\n\n \n\nprint(ans)\n", "target": "from collections import defaultdict\n\n\n\nN, K, *A = list(map(int, open(0).read().split()))\n\n\n\nx = [0] * (N + 1)\n\nfor i in range(N):\n\n x[i + 1] = x[i] + A[i]\n\n \n\ny = [(x[i] - i) % K for i in range(N + 1)]\n\n\n\nctr = defaultdict(int)\n\nans = 0\n\nfor j in range(N + 1):\n\n ans += ctr[y[j]]\n\n ctr[y[j]] += 1\n\n if j - K + 1 >= 0:\n\n ctr[y[j - K + 1]] -= 1\n\nprint(ans)\n", "code_v0_loc": 18, "code_v1_loc": 18, "code_v0_num_chars": 357, "code_v1_num_chars": 371, "code_v0_no_empty_lines": "from collections import defaultdict\n\nN, K, *A = list(map(int, open(0).read().split()))\nS = [0] * (N + 1)\nfor i in range(N):\n S[i + 1] = S[i] + A[i]\nd = defaultdict(int)\nans = 0\nfor j in range(N + 1):\n v = (S[j] - j) % K\n ans += d[v]\n d[v] += 1\n if j >= K - 1:\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nN, K, *A = list(map(int, open(0).read().split()))\nx = [0] * (N + 1)\nfor i in range(N):\n x[i + 1] = x[i] + A[i]\ny = [(x[i] - i) % K for i in range(N + 1)]\nctr = defaultdict(int)\nans = 0\nfor j in range(N + 1):\n ans += ctr[y[j]]\n ctr[y[j]] += 1\n if j - K + 1 >= 0:\n ctr[y[j - K + 1]] -= 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-S = [0] * (N + 1)", "+x = [0] * (N + 1)", "- S[i + 1] = S[i] + A[i]", "-d = defaultdict(int)", "+ x[i + 1] = x[i] + A[i]", "+y = [(x[i] - i) % K for i in range(N + 1)]", "+ctr = defaultdict(int)", "- v = (S[j] - j) % K", "- ans += d[v]", "- d[v] += 1", "- if j >= K - 1:", "- d[(S[j - K + 1] - (j - K + 1)) % K] -= 1", "+ ans += ctr[y[j]]", "+ ctr[y[j]] += 1", "+ if j - K + 1 >= 0:", "+ ctr[y[j - K + 1]] -= 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2436300242, "measured_runtime_v1": 0.1409657106, "runtime_lift": 1.7282928102, "key": ["s203769987", "s522861811"]} +{"user_id": "u576432509", "problem_id": "p02767", "language": "python", "submission_id_v0": "s320006452", "submission_id_v1": "s025352649", "cpu_time_v0": 403, "cpu_time_v1": 21, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 94.79, "input": "n=int(input())\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\nfor p in range(x[0],x[len(x)-1]+1):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\n pmin=psum \n\n for j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) ", "target": "n=int(input())\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\npsum=0\n\nfor i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\npmin=psum \n\nfor j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) \n", "code_v0_loc": 19, "code_v1_loc": 18, "code_v0_num_chars": 421, "code_v1_num_chars": 353, "code_v0_no_empty_lines": "n = int(input())\nx = list(map(int, input().split()))\nx.sort()\nfor p in range(x[0], x[len(x) - 1] + 1):\n psum = 0\n for i in range(len(x)):\n psum = psum + (x[0] - x[i]) ** 2\n # print(psum)\n pmin = psum\n for j in range(x[0] + 1, x[len(x) - 1]):\n psum = 0\n for i in range(len(x)):\n psum = psum + (j - x[i]) ** 2\n # print(psum)\n if pmin > psum:\n pmin = psum\nprint(pmin)\n", "code_v1_no_empty_lines": "n = int(input())\nx = list(map(int, input().split()))\nx.sort()\npsum = 0\nfor i in range(len(x)):\n psum = psum + (x[0] - x[i]) ** 2\n# print(psum)\npmin = psum\nfor j in range(x[0] + 1, x[len(x) - 1]):\n psum = 0\n for i in range(len(x)):\n psum = psum + (j - x[i]) ** 2\n # print(psum)\n if pmin > psum:\n pmin = psum\nprint(pmin)\n", "code_same": false, "relative_loc_diff_percent": 5.2631578947, "diff": ["-for p in range(x[0], x[len(x) - 1] + 1):", "+psum = 0", "+for i in range(len(x)):", "+ psum = psum + (x[0] - x[i]) ** 2", "+# print(psum)", "+pmin = psum", "+for j in range(x[0] + 1, x[len(x) - 1]):", "- psum = psum + (x[0] - x[i]) ** 2", "- # print(psum)", "- pmin = psum", "- for j in range(x[0] + 1, x[len(x) - 1]):", "- psum = 0", "- for i in range(len(x)):", "- psum = psum + (j - x[i]) ** 2", "- # print(psum)", "- if pmin > psum:", "- pmin = psum", "+ psum = psum + (j - x[i]) ** 2", "+ # print(psum)", "+ if pmin > psum:", "+ pmin = psum"], "diff_only_import_comment": false, "measured_runtime_v0": 0.298344056, "measured_runtime_v1": 0.1876089347, "runtime_lift": 1.59024439, "key": ["s320006452", "s025352649"]} +{"user_id": "u438662618", "problem_id": "p03086", "language": "python", "submission_id_v0": "s956521892", "submission_id_v1": "s325345686", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "import re\n\n\n\nS = input()\n\nmax = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i + 1, len(S) + 1) :\n\n pattern = re.compile(r'[A|T|C|G]{%d}' % int(j - i))\n\n subStr = S[i:j]\n\n\n\n if pattern.match(subStr) and j - i > max :\n\n max = j - i\n\n\n\nprint(max)\n", "target": "S = input()\n\n\n\nans = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i, len(S)) :\n\n if all('ACGT'.count(c) == 1 for c in S[i : j + 1]) :\n\n ans = max(ans, j - i + 1)\n\n\n\n\n\nprint(ans)\n", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 282, "code_v1_num_chars": 201, "code_v0_no_empty_lines": "import re\n\nS = input()\nmax = 0\nfor i in range(len(S)):\n for j in range(i + 1, len(S) + 1):\n pattern = re.compile(r\"[A|T|C|G]{%d}\" % int(j - i))\n subStr = S[i:j]\n if pattern.match(subStr) and j - i > max:\n max = j - i\nprint(max)\n", "code_v1_no_empty_lines": "S = input()\nans = 0\nfor i in range(len(S)):\n for j in range(i, len(S)):\n if all(\"ACGT\".count(c) == 1 for c in S[i : j + 1]):\n ans = max(ans, j - i + 1)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-import re", "-", "-max = 0", "+ans = 0", "- for j in range(i + 1, len(S) + 1):", "- pattern = re.compile(r\"[A|T|C|G]{%d}\" % int(j - i))", "- subStr = S[i:j]", "- if pattern.match(subStr) and j - i > max:", "- max = j - i", "-print(max)", "+ for j in range(i, len(S)):", "+ if all(\"ACGT\".count(c) == 1 for c in S[i : j + 1]):", "+ ans = max(ans, j - i + 1)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3271781678, "measured_runtime_v1": 0.2537176473, "runtime_lift": 1.2895365036, "key": ["s956521892", "s325345686"]} +{"user_id": "u207097826", "problem_id": "p02792", "language": "python", "submission_id_v0": "s736173164", "submission_id_v1": "s628306332", "cpu_time_v0": 499, "cpu_time_v1": 86, "memory_v0": 3064, "memory_v1": 68180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.77, "input": "import itertools\n\nN = int(input())\n\nNketa = len(str(N))\n\n\n\nrange_count = [[0 for j in range(10)]for i in range(10)]\n\n\n\n\n\nfor p in range(1,N+1):\n\n mae = int(str(p)[0])\n\n ato = int(str(p)[-1])\n\n range_count[mae][ato] += 1\n\n\n\n \n\n\n\ncount = 0\n\nfor j in range(1,N+1):\n\n a_mae = int(str(j)[0])\n\n a_ato = int(str(j)[-1])\n\n \n\n b_mae = a_ato\n\n b_ato = a_mae\n\n \n\n if b_mae == 0:\n\n continue\n\n else:\n\n count += range_count[b_mae][b_ato]\n\nprint(count)\n\n ", "target": "n = int(input())\n\n\n\nall_count = 0\n\noptions = [str(i) for i in range(10)]\n\n\n\nmaeato = [[0 for i in range(10)] for j in range(10)]\n\n\n\nfor i in range(n+1):\n\n checking = str(i)\n\n maeato[int(checking[0])][int(checking[-1])]+=1\n\nall_count = 0\n\nfor i in range(1,10):\n\n for j in range(1,10):\n\n for k in range(1,10):\n\n for p in range(1,10):\n\n if i == p and j == k:\n\n all_count+=maeato[i][j]*maeato[k][p]\n\nprint(all_count)", "code_v0_loc": 28, "code_v1_loc": 18, "code_v0_num_chars": 491, "code_v1_num_chars": 473, "code_v0_no_empty_lines": "import itertools\n\nN = int(input())\nNketa = len(str(N))\nrange_count = [[0 for j in range(10)] for i in range(10)]\nfor p in range(1, N + 1):\n mae = int(str(p)[0])\n ato = int(str(p)[-1])\n range_count[mae][ato] += 1\ncount = 0\nfor j in range(1, N + 1):\n a_mae = int(str(j)[0])\n a_ato = int(str(j)[-1])\n b_mae = a_ato\n b_ato = a_mae\n if b_mae == 0:\n continue\n else:\n count += range_count[b_mae][b_ato]\nprint(count)\n", "code_v1_no_empty_lines": "n = int(input())\nall_count = 0\noptions = [str(i) for i in range(10)]\nmaeato = [[0 for i in range(10)] for j in range(10)]\nfor i in range(n + 1):\n checking = str(i)\n maeato[int(checking[0])][int(checking[-1])] += 1\nall_count = 0\nfor i in range(1, 10):\n for j in range(1, 10):\n for k in range(1, 10):\n for p in range(1, 10):\n if i == p and j == k:\n all_count += maeato[i][j] * maeato[k][p]\nprint(all_count)\n", "code_same": false, "relative_loc_diff_percent": 35.7142857143, "diff": ["-import itertools", "-", "-N = int(input())", "-Nketa = len(str(N))", "-range_count = [[0 for j in range(10)] for i in range(10)]", "-for p in range(1, N + 1):", "- mae = int(str(p)[0])", "- ato = int(str(p)[-1])", "- range_count[mae][ato] += 1", "-count = 0", "-for j in range(1, N + 1):", "- a_mae = int(str(j)[0])", "- a_ato = int(str(j)[-1])", "- b_mae = a_ato", "- b_ato = a_mae", "- if b_mae == 0:", "- continue", "- else:", "- count += range_count[b_mae][b_ato]", "-print(count)", "+n = int(input())", "+all_count = 0", "+options = [str(i) for i in range(10)]", "+maeato = [[0 for i in range(10)] for j in range(10)]", "+for i in range(n + 1):", "+ checking = str(i)", "+ maeato[int(checking[0])][int(checking[-1])] += 1", "+all_count = 0", "+for i in range(1, 10):", "+ for j in range(1, 10):", "+ for k in range(1, 10):", "+ for p in range(1, 10):", "+ if i == p and j == k:", "+ all_count += maeato[i][j] * maeato[k][p]", "+print(all_count)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5609512657, "measured_runtime_v1": 0.4347667047, "runtime_lift": 1.2902351069, "key": ["s736173164", "s628306332"]} +{"user_id": "u379136995", "problem_id": "p02921", "language": "python", "submission_id_v0": "s545345968", "submission_id_v1": "s346622706", "cpu_time_v0": 27, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.04, "input": "s=input()\n\nt=input()\n\nans=0\n\nif s[0]==t[0]:\n\n ans+=1\n\nif s[1]==t[1]:\n\n ans+=1\n\nif s[2]==t[2]:\n\n ans+=1\n\nprint(ans)\n", "target": "s=input()\n\nt=input()\n\nans=0\n\nfor i in range(0,3):\n\n if s[i]==t[i]:\n\n ans+=1\n\nprint(ans)\n", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 124, "code_v1_num_chars": 98, "code_v0_no_empty_lines": "s = input()\nt = input()\nans = 0\nif s[0] == t[0]:\n ans += 1\nif s[1] == t[1]:\n ans += 1\nif s[2] == t[2]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "s = input()\nt = input()\nans = 0\nfor i in range(0, 3):\n if s[i] == t[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-if s[0] == t[0]:", "- ans += 1", "-if s[1] == t[1]:", "- ans += 1", "-if s[2] == t[2]:", "- ans += 1", "+for i in range(0, 3):", "+ if s[i] == t[i]:", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3561623907, "measured_runtime_v1": 0.2681128595, "runtime_lift": 1.3284047299, "key": ["s545345968", "s346622706"]} +{"user_id": "u263753244", "problem_id": "p03835", "language": "python", "submission_id_v0": "s871403539", "submission_id_v1": "s899034376", "cpu_time_v0": 1228, "cpu_time_v1": 261, "memory_v0": 2940, "memory_v1": 42092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.75, "input": "k,s=list(map(int,input().split()))\n\ncnt=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0 <= s-i-j <= k:\n\n cnt+=1\n\nprint(cnt)", "target": "k,s=list(map(int,input().split()))\n\na=0\n\nfor i in range(0,k+1):\n\n for j in range(0,k+1):\n\n if 0<=s-i-j<=k:\n\n a+=1\n\nprint(a)", "code_v0_loc": 7, "code_v1_loc": 7, "code_v0_num_chars": 144, "code_v1_num_chars": 138, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\na = 0\nfor i in range(0, k + 1):\n for j in range(0, k + 1):\n if 0 <= s - i - j <= k:\n a += 1\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-cnt = 0", "-for i in range(k + 1):", "- for j in range(k + 1):", "+a = 0", "+for i in range(0, k + 1):", "+ for j in range(0, k + 1):", "- cnt += 1", "-print(cnt)", "+ a += 1", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2440719529, "measured_runtime_v1": 0.12879462, "runtime_lift": 1.8950477354, "key": ["s871403539", "s899034376"]} +{"user_id": "u457901067", "problem_id": "p02814", "language": "python", "submission_id_v0": "s285073705", "submission_id_v1": "s453740847", "cpu_time_v0": 523, "cpu_time_v1": 158, "memory_v0": 21860, "memory_v1": 97668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 69.79, "input": "from math import gcd\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a // 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x // pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b//gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M // x + 1) // 2))", "target": "N, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a // 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x // pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b//gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M // x + 1) // 2))", "code_v0_loc": 33, "code_v1_loc": 32, "code_v0_num_chars": 560, "code_v1_num_chars": 533, "code_v0_no_empty_lines": "from math import gcd\n\nN, M = list(map(int, input().split()))\nA = list([int(x) for x in input().split()])\ncnt = [0 for _ in range(N)]\nfor i in range(N):\n a = A[i]\n while a % 2 == 0:\n a = a // 2\n cnt[i] += 1\nif max(cnt) > min(cnt):\n print((0))\n exit(0)\nC = max(cnt)\nA = list([x // pow(2, C) for x in A])\n\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n while a % b > 0:\n a, b = b, a % b\n return b\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\nx = A[0]\nfor a in A[1:]:\n x = lcm(x, a)\nx = x * pow(2, C - 1)\nprint(((M // x + 1) // 2))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nA = list([int(x) for x in input().split()])\ncnt = [0 for _ in range(N)]\nfor i in range(N):\n a = A[i]\n while a % 2 == 0:\n a = a // 2\n cnt[i] += 1\nif max(cnt) > min(cnt):\n print((0))\n exit(0)\nC = max(cnt)\nA = list([x // pow(2, C) for x in A])\n\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n while a % b > 0:\n a, b = b, a % b\n return b\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\nx = A[0]\nfor a in A[1:]:\n x = lcm(x, a)\nx = x * pow(2, C - 1)\nprint(((M // x + 1) // 2))\n", "code_same": false, "relative_loc_diff_percent": 3.0303030303, "diff": ["-from math import gcd", "-"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2484916873, "measured_runtime_v1": 0.192324806, "runtime_lift": 1.2920417937, "key": ["s285073705", "s453740847"]} +{"user_id": "u027685417", "problem_id": "p03038", "language": "python", "submission_id_v0": "s124992398", "submission_id_v1": "s099446399", "cpu_time_v0": 678, "cpu_time_v1": 544, "memory_v0": 33104, "memory_v1": 28888, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.76, "input": "from heapq import *\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nPAIRS = [[-a, -1] for a in map(int, input().split())]\n\nheapify(PAIRS)\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(PAIRS, [-c, -b])\n\n\n\nanswer = 0\n\nfor _ in range(n):\n\n pair = heappop(PAIRS)\n\n answer += -pair[0]\n\n pair[1] += 1\n\n if pair[1] != 0:\n\n heappush(PAIRS, pair)\n\n\n\nprint(answer)\n", "target": "n, m = list(map(int, input().split()))\n\nPAIRS = [(a, 1) for a in map(int, input().split())]\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n PAIRS.append((c, b))\n\nPAIRS.sort(reverse = True)\n\n\n\nanswer, count = 0, 0\n\nfor pair in PAIRS:\n\n answer += pair[0] * pair[1]\n\n count += pair[1]\n\n if count > n:\n\n answer -= pair[0] * (count - n)\n\n break\n\n\n\nprint(answer)\n", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 393, "code_v1_num_chars": 391, "code_v0_no_empty_lines": "from heapq import *\n\nn, m = list(map(int, input().split()))\nPAIRS = [[-a, -1] for a in map(int, input().split())]\nheapify(PAIRS)\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n heappush(PAIRS, [-c, -b])\nanswer = 0\nfor _ in range(n):\n pair = heappop(PAIRS)\n answer += -pair[0]\n pair[1] += 1\n if pair[1] != 0:\n heappush(PAIRS, pair)\nprint(answer)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nPAIRS = [(a, 1) for a in map(int, input().split())]\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n PAIRS.append((c, b))\nPAIRS.sort(reverse=True)\nanswer, count = 0, 0\nfor pair in PAIRS:\n answer += pair[0] * pair[1]\n count += pair[1]\n if count > n:\n answer -= pair[0] * (count - n)\n break\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["-from heapq import *", "-", "-PAIRS = [[-a, -1] for a in map(int, input().split())]", "-heapify(PAIRS)", "+PAIRS = [(a, 1) for a in map(int, input().split())]", "- heappush(PAIRS, [-c, -b])", "-answer = 0", "-for _ in range(n):", "- pair = heappop(PAIRS)", "- answer += -pair[0]", "- pair[1] += 1", "- if pair[1] != 0:", "- heappush(PAIRS, pair)", "+ PAIRS.append((c, b))", "+PAIRS.sort(reverse=True)", "+answer, count = 0, 0", "+for pair in PAIRS:", "+ answer += pair[0] * pair[1]", "+ count += pair[1]", "+ if count > n:", "+ answer -= pair[0] * (count - n)", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2969929054, "measured_runtime_v1": 0.0828762929, "runtime_lift": 3.5835688928, "key": ["s124992398", "s099446399"]} +{"user_id": "u803617136", "problem_id": "p03796", "language": "python", "submission_id_v0": "s262574211", "submission_id_v1": "s998310124", "cpu_time_v0": 230, "cpu_time_v1": 37, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.91, "input": "import math\n\n\n\nn = int(input())\n\nans = math.factorial(n) % (pow(10, 9) + 7)\n\nprint(ans)", "target": "n = int(input())\n\nans = 1\n\nmod = 10 ** 9 + 7\n\nfor i in range(1, n + 1):\n\n ans = (ans * i % mod) % mod\n\nprint(ans)", "code_v0_loc": 5, "code_v1_loc": 6, "code_v0_num_chars": 87, "code_v1_num_chars": 116, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nans = math.factorial(n) % (pow(10, 9) + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nmod = 10**9 + 7\nfor i in range(1, n + 1):\n ans = (ans * i % mod) % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-import math", "-", "-ans = math.factorial(n) % (pow(10, 9) + 7)", "+ans = 1", "+mod = 10**9 + 7", "+for i in range(1, n + 1):", "+ ans = (ans * i % mod) % mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5572224624, "measured_runtime_v1": 0.2586410534, "runtime_lift": 2.154423882, "key": ["s262574211", "s998310124"]} +{"user_id": "u991567869", "problem_id": "p02596", "language": "python", "submission_id_v0": "s146225899", "submission_id_v1": "s204753661", "cpu_time_v0": 292, "cpu_time_v1": 175, "memory_v0": 9152, "memory_v1": 9164, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.07, "input": "k = int(input())\n\nx = 1\n\n\n\nif k%7 != 0:\n\n mod = 9*k\n\nelse:\n\n mod = 9*k//7\n\n\n\nfor i in range(10**6):\n\n x = x*10%mod\n\n if x == 1:\n\n print((i + 1))\n\n exit()\n\n\n\nprint((-1))", "target": "k = int(input())\n\na = 0\n\n\n\nfor i in range(k + 10):\n\n a = (a*10 + 7)%k\n\n if a == 0:\n\n print((i + 1))\n\n exit()\n\nprint((-1))", "code_v0_loc": 15, "code_v1_loc": 9, "code_v0_num_chars": 190, "code_v1_num_chars": 137, "code_v0_no_empty_lines": "k = int(input())\nx = 1\nif k % 7 != 0:\n mod = 9 * k\nelse:\n mod = 9 * k // 7\nfor i in range(10**6):\n x = x * 10 % mod\n if x == 1:\n print((i + 1))\n exit()\nprint((-1))\n", "code_v1_no_empty_lines": "k = int(input())\na = 0\nfor i in range(k + 10):\n a = (a * 10 + 7) % k\n if a == 0:\n print((i + 1))\n exit()\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-x = 1", "-if k % 7 != 0:", "- mod = 9 * k", "-else:", "- mod = 9 * k // 7", "-for i in range(10**6):", "- x = x * 10 % mod", "- if x == 1:", "+a = 0", "+for i in range(k + 10):", "+ a = (a * 10 + 7) % k", "+ if a == 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5332653046, "measured_runtime_v1": 0.4200988929, "runtime_lift": 1.2693804091, "key": ["s146225899", "s204753661"]} +{"user_id": "u562935282", "problem_id": "p03200", "language": "python", "submission_id_v0": "s639682353", "submission_id_v1": "s546135650", "cpu_time_v0": 48, "cpu_time_v1": 43, "memory_v0": 3500, "memory_v1": 3500, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.42, "input": "s = input()\n\n\n\ncnt = 0\n\nans = 0\n\nfor c in s:\n\n if c == 'B':\n\n cnt += 1\n\n elif c == 'W':\n\n ans += cnt\n\nprint(ans)\n", "target": "s = input()\n\n\n\nans = 0\n\nb = 0\n\nfor ss in s:\n\n if ss == 'W':\n\n ans += b\n\n else:\n\n b += 1\n\nprint(ans)\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 133, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "s = input()\ncnt = 0\nans = 0\nfor c in s:\n if c == \"B\":\n cnt += 1\n elif c == \"W\":\n ans += cnt\nprint(ans)\n", "code_v1_no_empty_lines": "s = input()\nans = 0\nb = 0\nfor ss in s:\n if ss == \"W\":\n ans += b\n else:\n b += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-cnt = 0", "-for c in s:", "- if c == \"B\":", "- cnt += 1", "- elif c == \"W\":", "- ans += cnt", "+b = 0", "+for ss in s:", "+ if ss == \"W\":", "+ ans += b", "+ else:", "+ b += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2094221431, "measured_runtime_v1": 0.1051600281, "runtime_lift": 1.9914614603, "key": ["s639682353", "s546135650"]} +{"user_id": "u744114948", "problem_id": "p00053", "language": "python", "submission_id_v0": "s391855332", "submission_id_v1": "s612183692", "cpu_time_v0": 660, "cpu_time_v1": 70, "memory_v0": 7228, "memory_v1": 8024, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 89.39, "input": "import math\n\ndef pri(n):\n\n if n < 2:\n\n return False\n\n elif n == 2:\n\n return True\n\n elif n % 2 == 0:\n\n return False\n\n\n\n i = 3\n\n while i <= math.sqrt(n):\n\n if n % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nl=[i for i in range(110000)if pri(i) ]\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0: break\n\n print((sum(l[:n])))", "target": "import math\n\ndef pri(n):\n\n l =[True] * n\n\n l[0] = l[1] = False\n\n for i in range(2,n):\n\n if l[i]:\n\n for j in range(i*2, n, i):\n\n l[j] = False\n\n return l\n\nn=105000\n\ns=pri(n)\n\nl=[i for i in range(n) if s[i]]\n\nwhile True:\n\n n = int(input())\n\n if n == 0: break\n\n print((sum(l[:n])))", "code_v0_loc": 22, "code_v1_loc": 16, "code_v0_num_chars": 394, "code_v1_num_chars": 329, "code_v0_no_empty_lines": "import math\n\n\ndef pri(n):\n if n < 2:\n return False\n elif n == 2:\n return True\n elif n % 2 == 0:\n return False\n i = 3\n while i <= math.sqrt(n):\n if n % i == 0:\n return False\n i += 2\n return True\n\n\nl = [i for i in range(110000) if pri(i)]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(l[:n])))\n", "code_v1_no_empty_lines": "import math\n\n\ndef pri(n):\n l = [True] * n\n l[0] = l[1] = False\n for i in range(2, n):\n if l[i]:\n for j in range(i * 2, n, i):\n l[j] = False\n return l\n\n\nn = 105000\ns = pri(n)\nl = [i for i in range(n) if s[i]]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(l[:n])))\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["- if n < 2:", "- return False", "- elif n == 2:", "- return True", "- elif n % 2 == 0:", "- return False", "- i = 3", "- while i <= math.sqrt(n):", "- if n % i == 0:", "- return False", "- i += 2", "- return True", "+ l = [True] * n", "+ l[0] = l[1] = False", "+ for i in range(2, n):", "+ if l[i]:", "+ for j in range(i * 2, n, i):", "+ l[j] = False", "+ return l", "-l = [i for i in range(110000) if pri(i)]", "+n = 105000", "+s = pri(n)", "+l = [i for i in range(n) if s[i]]"], "diff_only_import_comment": false, "measured_runtime_v0": 2.8203961465, "measured_runtime_v1": 0.4705428715, "runtime_lift": 5.9939196138, "key": ["s391855332", "s612183692"]} +{"user_id": "u133936772", "problem_id": "p02988", "language": "python", "submission_id_v0": "s657683547", "submission_id_v1": "s740427744", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "n = int(input())\n\nl = list(map(int, input().split()))\n\nprint((sum(l[i]l[i+1]>l[i+2] for i in range(n-2))))", "target": "n=int(input())\n\nl=list(map(int,input().split()))\n\na=0\n\nfor i in range(n-2):\n\n p,q,r=l[i:i+3]\n\n if p l[i + 1] > l[i + 2]\n for i in range(n - 2)\n )\n )\n)\n", "code_v1_no_empty_lines": "n = int(input())\nl = list(map(int, input().split()))\na = 0\nfor i in range(n - 2):\n p, q, r = l[i : i + 3]\n if p < q < r or r < q < p:\n a += 1\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-print(", "- (", "- sum(", "- l[i] < l[i + 1] < l[i + 2] or l[i] > l[i + 1] > l[i + 2]", "- for i in range(n - 2)", "- )", "- )", "-)", "+a = 0", "+for i in range(n - 2):", "+ p, q, r = l[i : i + 3]", "+ if p < q < r or r < q < p:", "+ a += 1", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1639216754, "measured_runtime_v1": 0.0058678908, "runtime_lift": 27.9353658749, "key": ["s657683547", "s740427744"]} +{"user_id": "u813098295", "problem_id": "p03363", "language": "python", "submission_id_v0": "s373502740", "submission_id_v1": "s912924761", "cpu_time_v0": 217, "cpu_time_v1": 194, "memory_v0": 31620, "memory_v1": 45788, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.6, "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\n\n\nans, s = 0, 0\n\nd = {0:1}\n\n\n\nfor i in A:\n\n s += i\n\n ans += d.get(s, 0)\n\n d[s] = d.get(s, 0) + 1\n\n\n\nprint(ans)", "target": "#!/usr/bin/env python3\n\n\n\nfrom collections import defaultdict\n\n\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\n\n\nd = defaultdict(int)\n\nd[0] = 1\n\n\n\ns, ans = 0, 0\n\n\n\nfor a in A:\n\n s += a\n\n ans += d[s]\n\n d[s] += 1\n\n\n\nprint (ans)", "code_v0_loc": 12, "code_v1_loc": 18, "code_v0_num_chars": 175, "code_v1_num_chars": 237, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nans, s = 0, 0\nd = {0: 1}\nfor i in A:\n s += i\n ans += d.get(s, 0)\n d[s] = d.get(s, 0) + 1\nprint(ans)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nfrom collections import defaultdict\n\nN = int(input())\nA = list(map(int, input().split()))\nd = defaultdict(int)\nd[0] = 1\ns, ans = 0, 0\nfor a in A:\n s += a\n ans += d[s]\n d[s] += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-N = int(input())", "+#!/usr/bin/env python3", "+from collections import defaultdict", "+", "+N = int(input())", "-ans, s = 0, 0", "-d = {0: 1}", "-for i in A:", "- s += i", "- ans += d.get(s, 0)", "- d[s] = d.get(s, 0) + 1", "+d = defaultdict(int)", "+d[0] = 1", "+s, ans = 0, 0", "+for a in A:", "+ s += a", "+ ans += d[s]", "+ d[s] += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2992557037, "measured_runtime_v1": 0.2235582159, "runtime_lift": 1.3386030235, "key": ["s373502740", "s912924761"]} +{"user_id": "u120865944", "problem_id": "p03162", "language": "python", "submission_id_v0": "s595235842", "submission_id_v1": "s886147212", "cpu_time_v0": 1019, "cpu_time_v1": 680, "memory_v0": 47328, "memory_v1": 59484, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.27, "input": "N = int(input())\n\nl = [list(map(int, input().split())) for _ in range(N)]\n\n\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\n\n\nfor i in range(1, N+1):\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k]+l[i-1][k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n\n\n", "target": "N = int(input())\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\nfor i in range(1, N+1):\n\n hapiness = list(map(int, input().split()))\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k] + hapiness[k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 341, "code_v1_num_chars": 329, "code_v0_no_empty_lines": "N = int(input())\nl = [list(map(int, input().split())) for _ in range(N)]\ndp = [[0 for i in range(3)] for j in range(N + 1)]\nfor i in range(1, N + 1):\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[i][j] = max(dp[i][j], dp[i - 1][k] + l[i - 1][k])\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n", "code_v1_no_empty_lines": "N = int(input())\ndp = [[0 for i in range(3)] for j in range(N + 1)]\nfor i in range(1, N + 1):\n hapiness = list(map(int, input().split()))\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[i][j] = max(dp[i][j], dp[i - 1][k] + hapiness[k])\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-l = [list(map(int, input().split())) for _ in range(N)]", "+ hapiness = list(map(int, input().split()))", "- dp[i][j] = max(dp[i][j], dp[i - 1][k] + l[i - 1][k])", "+ dp[i][j] = max(dp[i][j], dp[i - 1][k] + hapiness[k])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.267745409, "measured_runtime_v1": 0.0801038151, "runtime_lift": 3.3424801143, "key": ["s595235842", "s886147212"]} +{"user_id": "u394731058", "problem_id": "p02899", "language": "python", "submission_id_v0": "s948462743", "submission_id_v1": "s673167226", "cpu_time_v0": 210, "cpu_time_v1": 76, "memory_v0": 13304, "memory_v1": 17740, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 63.81, "input": "import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(input())\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n for i in range(len(l)):\n\n if i != len(l)-1:\n\n print(\"{} \".format(l[i]), end='')\n\n else:\n\n print(l[i])\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(input())\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n print((\" \".join(map(str,l))))\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 19, "code_v1_loc": 14, "code_v0_num_chars": 381, "code_v1_num_chars": 268, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n ans = 0\n n = int(input())\n o = list(map(int, input().split()))\n l = [0] * n\n for i in range(n):\n l[o[i] - 1] = i + 1\n for i in range(len(l)):\n if i != len(l) - 1:\n print(\"{} \".format(l[i]), end=\"\")\n else:\n print(l[i])\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n ans = 0\n n = int(input())\n o = list(map(int, input().split()))\n l = [0] * n\n for i in range(n):\n l[o[i] - 1] = i + 1\n print((\" \".join(map(str, l))))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 26.3157894737, "diff": ["- n = int(input())", "+ n = int(input())", "- for i in range(len(l)):", "- if i != len(l) - 1:", "- print(\"{} \".format(l[i]), end=\"\")", "- else:", "- print(l[i])", "+ print((\" \".join(map(str, l))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3305146998, "measured_runtime_v1": 0.2638847903, "runtime_lift": 1.2524962104, "key": ["s948462743", "s673167226"]} +{"user_id": "u531220228", "problem_id": "p02994", "language": "python", "submission_id_v0": "s512634929", "submission_id_v1": "s713379557", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "N,L = list(map(int, input().split()))\n\ntaste = [L+i-1 for i in range(1,N+1)]\n\nif taste[-1] < 0:\n\n print((sum(taste) + min([abs(x) for x in taste])))\n\nelse:\n\n print((sum(taste) - min([abs(x) for x in taste])))", "target": "N, L = list(map(int, input().split()))\n\n\n\ntaste = [L+i-1 for i in range(1, N+1)]\n\n\n\nif 0 in taste:\n\n select = 0\n\nelse:\n\n select_with_ind = min(enumerate(taste), key = lambda x: abs(x[1]))\n\n select = select_with_ind[1]\n\n \n\nprint((sum(taste) - select))", "code_v0_loc": 6, "code_v1_loc": 11, "code_v0_num_chars": 200, "code_v1_num_chars": 254, "code_v0_no_empty_lines": "N, L = list(map(int, input().split()))\ntaste = [L + i - 1 for i in range(1, N + 1)]\nif taste[-1] < 0:\n print((sum(taste) + min([abs(x) for x in taste])))\nelse:\n print((sum(taste) - min([abs(x) for x in taste])))\n", "code_v1_no_empty_lines": "N, L = list(map(int, input().split()))\ntaste = [L + i - 1 for i in range(1, N + 1)]\nif 0 in taste:\n select = 0\nelse:\n select_with_ind = min(enumerate(taste), key=lambda x: abs(x[1]))\n select = select_with_ind[1]\nprint((sum(taste) - select))\n", "code_same": false, "relative_loc_diff_percent": 45.4545454545, "diff": ["-if taste[-1] < 0:", "- print((sum(taste) + min([abs(x) for x in taste])))", "+if 0 in taste:", "+ select = 0", "- print((sum(taste) - min([abs(x) for x in taste])))", "+ select_with_ind = min(enumerate(taste), key=lambda x: abs(x[1]))", "+ select = select_with_ind[1]", "+print((sum(taste) - select))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3334629779, "measured_runtime_v1": 0.1486533701, "runtime_lift": 2.2432251455, "key": ["s512634929", "s713379557"]} +{"user_id": "u077291787", "problem_id": "p03416", "language": "python", "submission_id_v0": "s642708796", "submission_id_v1": "s868202811", "cpu_time_v0": 245, "cpu_time_v1": 42, "memory_v0": 40940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.86, "input": "# ABC090B - Palindromic Numbers\n\na, b = list(map(int, input().rstrip().split()))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n lst = list(map(int, list(str(i))))\n\n if lst[0] == lst[4] and lst[1] == lst[3]:\n\n count += 1\n\nprint(count)", "target": "# ABC090B - Palindromic Numbers\n\ndef main():\n\n a, b = list(map(int, input().rstrip().split()))\n\n cnt = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n if s == s[::-1]:\n\n cnt += 1\n\n print(cnt)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 8, "code_v1_loc": 13, "code_v0_num_chars": 239, "code_v1_num_chars": 269, "code_v0_no_empty_lines": "# ABC090B - Palindromic Numbers\na, b = list(map(int, input().rstrip().split()))\ncount = 0\nfor i in range(a, b + 1):\n lst = list(map(int, list(str(i))))\n if lst[0] == lst[4] and lst[1] == lst[3]:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "# ABC090B - Palindromic Numbers\ndef main():\n a, b = list(map(int, input().rstrip().split()))\n cnt = 0\n for i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n cnt += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 38.4615384615, "diff": ["-a, b = list(map(int, input().rstrip().split()))", "-count = 0", "-for i in range(a, b + 1):", "- lst = list(map(int, list(str(i))))", "- if lst[0] == lst[4] and lst[1] == lst[3]:", "- count += 1", "-print(count)", "+def main():", "+ a, b = list(map(int, input().rstrip().split()))", "+ cnt = 0", "+ for i in range(a, b + 1):", "+ s = str(i)", "+ if s == s[::-1]:", "+ cnt += 1", "+ print(cnt)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3956292481, "measured_runtime_v1": 0.2484657222, "runtime_lift": 1.5922890477, "key": ["s642708796", "s868202811"]} +{"user_id": "u977389981", "problem_id": "p03720", "language": "python", "submission_id_v0": "s310815601", "submission_id_v1": "s089084009", "cpu_time_v0": 25, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.0, "input": "n, m = list(map(int, input().split()))\n\ndp = [0] * n\n\nfor i in range(m):\n\n x, y = list(map(int, input().split()))\n\n dp[x - 1] += 1\n\n dp[y - 1] += 1\n\nfor i in range(n):\n\n print((dp[i]))", "target": "n, m = list(map(int, input().split()))\n\nA = [0] * n\n\nfor i in range(m):\n\n a, b = list(map(int, input().split()))\n\n A[a - 1] += 1\n\n A[b - 1] += 1\n\n \n\nfor i in range(n):\n\n print((A[i]))", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 182, "code_v1_num_chars": 184, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\ndp = [0] * n\nfor i in range(m):\n x, y = list(map(int, input().split()))\n dp[x - 1] += 1\n dp[y - 1] += 1\nfor i in range(n):\n print((dp[i]))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nA = [0] * n\nfor i in range(m):\n a, b = list(map(int, input().split()))\n A[a - 1] += 1\n A[b - 1] += 1\nfor i in range(n):\n print((A[i]))\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-dp = [0] * n", "+A = [0] * n", "- x, y = list(map(int, input().split()))", "- dp[x - 1] += 1", "- dp[y - 1] += 1", "+ a, b = list(map(int, input().split()))", "+ A[a - 1] += 1", "+ A[b - 1] += 1", "- print((dp[i]))", "+ print((A[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2766861832, "measured_runtime_v1": 0.17692909, "runtime_lift": 1.5638252769, "key": ["s310815601", "s089084009"]} +{"user_id": "u440566786", "problem_id": "p03558", "language": "python", "submission_id_v0": "s333680155", "submission_id_v1": "s106353030", "cpu_time_v0": 260, "cpu_time_v1": 131, "memory_v0": 62004, "memory_v1": 79416, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 49.62, "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\n\n\nfrom collections import deque\n\ndef resolve():\n\n k=int(input())\n\n E=[[] for _ in range(k)]\n\n for i in range(k):\n\n E[i].append(((i+1)%k,1))\n\n E[i].append(((10*i)%k,0))\n\n\n\n # 0-1 BFS\n\n dist=[INF]*k\n\n dist[1]=0\n\n Q=deque([1])\n\n while(Q):\n\n v=Q.popleft()\n\n for nv,w in E[v]:\n\n if(dist[nv]<=dist[v]+w): continue\n\n dist[nv]=dist[v]+w\n\n if(w==0): Q.appendleft(nv)\n\n else: Q.append(nv)\n\n print((dist[0]+1))\n\nresolve()", "target": "import sys\n\nINF = 1 << 60\n\nMOD = 10**9 + 7 # 998244353\n\nsys.setrecursionlimit(2147483647)\n\ninput = lambda:sys.stdin.readline().rstrip()\n\nfrom collections import deque\n\ndef resolve():\n\n k = int(input())\n\n dist = [INF] * k\n\n dist[1] = 1\n\n queue = deque([1])\n\n\n\n while queue:\n\n v = queue.pop()\n\n if dist[10 * v % k] > dist[v]:\n\n dist[10 * v % k] = dist[v]\n\n queue.appendleft(10 * v % k)\n\n if dist[(v + 1) % k] > dist[v] + 1:\n\n dist[(v + 1) % k] = dist[v] + 1\n\n queue.append((v + 1) % k)\n\n\n\n print((dist[0]))\n\nresolve()", "code_v0_loc": 27, "code_v1_loc": 23, "code_v0_num_chars": 630, "code_v1_num_chars": 596, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nMOD = 10**9 + 7\ninput = lambda: sys.stdin.readline().rstrip()\nfrom collections import deque\n\n\ndef resolve():\n k = int(input())\n E = [[] for _ in range(k)]\n for i in range(k):\n E[i].append(((i + 1) % k, 1))\n E[i].append(((10 * i) % k, 0))\n # 0-1 BFS\n dist = [INF] * k\n dist[1] = 0\n Q = deque([1])\n while Q:\n v = Q.popleft()\n for nv, w in E[v]:\n if dist[nv] <= dist[v] + w:\n continue\n dist[nv] = dist[v] + w\n if w == 0:\n Q.appendleft(nv)\n else:\n Q.append(nv)\n print((dist[0] + 1))\n\n\nresolve()\n", "code_v1_no_empty_lines": "import sys\n\nINF = 1 << 60\nMOD = 10**9 + 7 # 998244353\nsys.setrecursionlimit(2147483647)\ninput = lambda: sys.stdin.readline().rstrip()\nfrom collections import deque\n\n\ndef resolve():\n k = int(input())\n dist = [INF] * k\n dist[1] = 1\n queue = deque([1])\n while queue:\n v = queue.pop()\n if dist[10 * v % k] > dist[v]:\n dist[10 * v % k] = dist[v]\n queue.appendleft(10 * v % k)\n if dist[(v + 1) % k] > dist[v] + 1:\n dist[(v + 1) % k] = dist[v] + 1\n queue.append((v + 1) % k)\n print((dist[0]))\n\n\nresolve()\n", "code_same": false, "relative_loc_diff_percent": 14.8148148148, "diff": ["+INF = 1 << 60", "+MOD = 10**9 + 7 # 998244353", "-INF = float(\"inf\")", "-MOD = 10**9 + 7", "- E = [[] for _ in range(k)]", "- for i in range(k):", "- E[i].append(((i + 1) % k, 1))", "- E[i].append(((10 * i) % k, 0))", "- # 0-1 BFS", "- dist[1] = 0", "- Q = deque([1])", "- while Q:", "- v = Q.popleft()", "- for nv, w in E[v]:", "- if dist[nv] <= dist[v] + w:", "- continue", "- dist[nv] = dist[v] + w", "- if w == 0:", "- Q.appendleft(nv)", "- else:", "- Q.append(nv)", "- print((dist[0] + 1))", "+ dist[1] = 1", "+ queue = deque([1])", "+ while queue:", "+ v = queue.pop()", "+ if dist[10 * v % k] > dist[v]:", "+ dist[10 * v % k] = dist[v]", "+ queue.appendleft(10 * v % k)", "+ if dist[(v + 1) % k] > dist[v] + 1:", "+ dist[(v + 1) % k] = dist[v] + 1", "+ queue.append((v + 1) % k)", "+ print((dist[0]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.412358222, "measured_runtime_v1": 0.3278088195, "runtime_lift": 1.2579229033, "key": ["s333680155", "s106353030"]} +{"user_id": "u171065106", "problem_id": "p03796", "language": "python", "submission_id_v0": "s258128729", "submission_id_v1": "s727911974", "cpu_time_v0": 230, "cpu_time_v1": 43, "memory_v0": 3976, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.3, "input": "import math\n\n\n\nn = int(input())\n\n\n\nprint((math.factorial(n) % (10**9 + 7)))\n", "target": "n = int(input())\n\n\n\nans = 1\n\n\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= 10**9 + 7\n\n\n\nprint(ans)\n", "code_v0_loc": 5, "code_v1_loc": 9, "code_v0_num_chars": 74, "code_v1_num_chars": 105, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= 10**9 + 7\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+ans = 1", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= 10**9 + 7", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6649877462, "measured_runtime_v1": 0.4034042664, "runtime_lift": 1.6484400431, "key": ["s258128729", "s727911974"]} +{"user_id": "u761320129", "problem_id": "p03839", "language": "python", "submission_id_v0": "s934844992", "submission_id_v1": "s135860240", "cpu_time_v0": 205, "cpu_time_v1": 174, "memory_v0": 17404, "memory_v1": 17532, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.12, "input": "N,K = list(map(int,input().split()))\n\nsrc = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncump = [0]\n\nfor a in src:\n\n cums.append(cums[-1] + a)\n\n cump.append(cump[-1] + max(0,a))\n\n\n\nans = 0\n\nfor i in range(N-K+1):\n\n tmp = cump[i]\n\n tmp += max(0, cums[i+K] - cums[i])\n\n tmp += cump[N] - cump[i+K]\n\n ans = max(tmp, ans)\n\nprint(ans)\n", "target": "N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncums_p = [0]\n\nfor a in A:\n\n cums.append(cums[-1] + a)\n\n cums_p.append(cums_p[-1] + max(0,a))\n\n\n\nans = -float('inf')\n\nfor l in range(N-K+1):\n\n free = cums_p[l] + cums_p[-1] - cums_p[l+K]\n\n cont = cums[l+K] - cums[l]\n\n ans = max(ans, free, free+cont)\n\nprint(ans)", "code_v0_loc": 16, "code_v1_loc": 15, "code_v0_num_chars": 342, "code_v1_num_chars": 357, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nsrc = list(map(int, input().split()))\ncums = [0]\ncump = [0]\nfor a in src:\n cums.append(cums[-1] + a)\n cump.append(cump[-1] + max(0, a))\nans = 0\nfor i in range(N - K + 1):\n tmp = cump[i]\n tmp += max(0, cums[i + K] - cums[i])\n tmp += cump[N] - cump[i + K]\n ans = max(tmp, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\ncums = [0]\ncums_p = [0]\nfor a in A:\n cums.append(cums[-1] + a)\n cums_p.append(cums_p[-1] + max(0, a))\nans = -float(\"inf\")\nfor l in range(N - K + 1):\n free = cums_p[l] + cums_p[-1] - cums_p[l + K]\n cont = cums[l + K] - cums[l]\n ans = max(ans, free, free + cont)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 6.25, "diff": ["-src = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "-cump = [0]", "-for a in src:", "+cums_p = [0]", "+for a in A:", "- cump.append(cump[-1] + max(0, a))", "-ans = 0", "-for i in range(N - K + 1):", "- tmp = cump[i]", "- tmp += max(0, cums[i + K] - cums[i])", "- tmp += cump[N] - cump[i + K]", "- ans = max(tmp, ans)", "+ cums_p.append(cums_p[-1] + max(0, a))", "+ans = -float(\"inf\")", "+for l in range(N - K + 1):", "+ free = cums_p[l] + cums_p[-1] - cums_p[l + K]", "+ cont = cums[l + K] - cums[l]", "+ ans = max(ans, free, free + cont)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3907449563, "measured_runtime_v1": 0.3033102551, "runtime_lift": 1.2882681998, "key": ["s934844992", "s135860240"]} +{"user_id": "u488127128", "problem_id": "p03796", "language": "python", "submission_id_v0": "s637972642", "submission_id_v1": "s581563839", "cpu_time_v0": 32, "cpu_time_v1": 28, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.5, "input": "def factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r *= n\n\n power_r %= 10**9+7\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "target": "def factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r = power_r*n % (10**9+7)\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "code_v0_loc": 10, "code_v1_loc": 9, "code_v0_num_chars": 209, "code_v1_num_chars": 200, "code_v0_no_empty_lines": "def factorial(N):\n power_r = 1\n for n in range(2, N + 1):\n power_r *= n\n power_r %= 10**9 + 7\n return power_r\n\n\nif __name__ == \"__main__\":\n N = int(input())\n print((factorial(N)))\n", "code_v1_no_empty_lines": "def factorial(N):\n power_r = 1\n for n in range(2, N + 1):\n power_r = power_r * n % (10**9 + 7)\n return power_r\n\n\nif __name__ == \"__main__\":\n N = int(input())\n print((factorial(N)))\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["- power_r *= n", "- power_r %= 10**9 + 7", "+ power_r = power_r * n % (10**9 + 7)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3227770622, "measured_runtime_v1": 0.2497183731, "runtime_lift": 1.2925643324, "key": ["s637972642", "s581563839"]} +{"user_id": "u189479417", "problem_id": "p02596", "language": "python", "submission_id_v0": "s892012548", "submission_id_v1": "s295850055", "cpu_time_v0": 350, "cpu_time_v1": 211, "memory_v0": 9176, "memory_v1": 9188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.71, "input": "import sys\n\nK = int(input())\n\n\n\npower = 7\n\nSUM = 0\n\n\n\nfor i in range(1, 10 ** 6):\n\n SUM += power\n\n if SUM % K == 0:\n\n print(i)\n\n sys.exit()\n\n power *= 10\n\n power %= K\n\n\n\nprint((-1))", "target": "import sys\n\nK = int(input())\n\n\n\nL = 9 * K\n\n\n\nif K % 7 == 0:\n\n L //= 7\n\n\n\npower = 1\n\n\n\nfor i in range(1, 10 ** 6):\n\n power *= 10\n\n power %= L\n\n if power == 1:\n\n print(i)\n\n sys.exit()\n\n\n\nprint((-1))", "code_v0_loc": 15, "code_v1_loc": 18, "code_v0_num_chars": 205, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "import sys\n\nK = int(input())\npower = 7\nSUM = 0\nfor i in range(1, 10**6):\n SUM += power\n if SUM % K == 0:\n print(i)\n sys.exit()\n power *= 10\n power %= K\nprint((-1))\n", "code_v1_no_empty_lines": "import sys\n\nK = int(input())\nL = 9 * K\nif K % 7 == 0:\n L //= 7\npower = 1\nfor i in range(1, 10**6):\n power *= 10\n power %= L\n if power == 1:\n print(i)\n sys.exit()\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-power = 7", "-SUM = 0", "+L = 9 * K", "+if K % 7 == 0:", "+ L //= 7", "+power = 1", "- SUM += power", "- if SUM % K == 0:", "+ power *= 10", "+ power %= L", "+ if power == 1:", "- power *= 10", "- power %= K"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9885553987, "measured_runtime_v1": 0.6379526145, "runtime_lift": 1.5495749624, "key": ["s892012548", "s295850055"]} +{"user_id": "u766684188", "problem_id": "p02821", "language": "python", "submission_id_v0": "s756543404", "submission_id_v1": "s283463453", "cpu_time_v0": 1684, "cpu_time_v1": 1054, "memory_v0": 58816, "memory_v1": 60104, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.41, "input": "#E\n\nfrom itertools import accumulate\n\nfrom bisect import bisect_left\n\ndef main():\n\n n,m=list(map(int,input().split()))\n\n A=list(map(int,input().split()))\n\n A.sort()\n\n \n\n def count(k):\n\n cnt=0\n\n for a in A:\n\n cnt+=bisect_left(A,k-a)\n\n return cnt\n\n \n\n ok=0\n\n ng=10**10+1\n\n while ng-ok>1:\n\n mid=(ok+ng)//2\n\n if count(mid)1:\n\n mid=(ok+ng)//2\n\n if count(mid) 1:\n mid = (ok + ng) // 2\n if count(mid) < n**2 - m:\n ok = mid\n else:\n ng = mid\n border = ok\n k = n**2 - count(border)\n Acc = [0] + list(accumulate(A))\n s = Acc[-1]\n ans = 0\n for a in A:\n idx = bisect_left(A, border - a)\n ans += a * (n - idx) + (s - Acc[idx])\n ans -= border * (k - m)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from itertools import accumulate\nfrom bisect import bisect_left\n\n\ndef main():\n n, m = list(map(int, input().split()))\n A = list(map(int, input().split()))\n A.sort()\n\n def count(k):\n cnt = 0\n for a in A:\n cnt += bisect_left(A, k - a)\n return cnt\n\n ok = 0\n ng = 2 * 10**5 + 1\n while ng - ok > 1:\n mid = (ok + ng) // 2\n if count(mid) < n**2 - m:\n ok = mid\n else:\n ng = mid\n border = ok\n k = n**2 - count(border)\n Acc = [0] + list(accumulate(A))\n s = Acc[-1]\n ans = 0\n for a in A:\n idx = bisect_left(A, border - a)\n ans += a * (n - idx) + (s - Acc[idx])\n ans -= border * (k - m)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 2.7777777778, "diff": ["-# E", "- ng = 10**10 + 1", "+ ng = 2 * 10**5 + 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.329581742, "measured_runtime_v1": 0.2004272747, "runtime_lift": 1.6443956668, "key": ["s756543404", "s283463453"]} +{"user_id": "u738898077", "problem_id": "p03634", "language": "python", "submission_id_v0": "s144783413", "submission_id_v1": "s080655040", "cpu_time_v0": 845, "cpu_time_v1": 724, "memory_v0": 48964, "memory_v1": 48916, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.32, "input": "import sys\n\ninput = sys.stdin.readline\n\nn = int(input())\n\nv = [[0]+[]*(n+1) for i in range(n+1)]\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\n\n\nq,k = list(map(int,input().split()))\n\nl = [k]\n\nwhile l:\n\n now = l.pop()\n\n for i in v[now][1:]:\n\n if v[i[0]][0] == 0:\n\n v[i[0]][0] = i[1]+v[now][0]\n\n l.append(i[0])\n\n\n\nfor i in range(q):\n\n x,y = list(map(int,input().split()))\n\n print((v[x][0]+v[y][0]))", "target": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n n = int(input())\n\n v = [[0]+[]*(n+1) for i in range(n+1)]\n\n for i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\n\n\n q,k = list(map(int,input().split()))\n\n l = [k]\n\n while l:\n\n now = l.pop()\n\n for i in v[now][1:]:\n\n if v[i[0]][0] == 0:\n\n v[i[0]][0] = i[1]+v[now][0]\n\n l.append(i[0])\n\n\n\n for i in range(q):\n\n x,y = list(map(int,input().split()))\n\n print((v[x][0]+v[y][0]))\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 21, "code_v1_loc": 25, "code_v0_num_chars": 486, "code_v1_num_chars": 613, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nn = int(input())\nv = [[0] + [] * (n + 1) for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n v[a].append([b, c])\n v[b].append([a, c])\nq, k = list(map(int, input().split()))\nl = [k]\nwhile l:\n now = l.pop()\n for i in v[now][1:]:\n if v[i[0]][0] == 0:\n v[i[0]][0] = i[1] + v[now][0]\n l.append(i[0])\nfor i in range(q):\n x, y = list(map(int, input().split()))\n print((v[x][0] + v[y][0]))\n", "code_v1_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n n = int(input())\n v = [[0] + [] * (n + 1) for i in range(n + 1)]\n for i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n v[a].append([b, c])\n v[b].append([a, c])\n q, k = list(map(int, input().split()))\n l = [k]\n while l:\n now = l.pop()\n for i in v[now][1:]:\n if v[i[0]][0] == 0:\n v[i[0]][0] = i[1] + v[now][0]\n l.append(i[0])\n for i in range(q):\n x, y = list(map(int, input().split()))\n print((v[x][0] + v[y][0]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 16.0, "diff": ["-input = sys.stdin.readline", "-n = int(input())", "-v = [[0] + [] * (n + 1) for i in range(n + 1)]", "-for i in range(n - 1):", "- a, b, c = list(map(int, input().split()))", "- v[a].append([b, c])", "- v[b].append([a, c])", "-q, k = list(map(int, input().split()))", "-l = [k]", "-while l:", "- now = l.pop()", "- for i in v[now][1:]:", "- if v[i[0]][0] == 0:", "- v[i[0]][0] = i[1] + v[now][0]", "- l.append(i[0])", "-for i in range(q):", "- x, y = list(map(int, input().split()))", "- print((v[x][0] + v[y][0]))", "+", "+def main():", "+ input = sys.stdin.readline", "+ n = int(input())", "+ v = [[0] + [] * (n + 1) for i in range(n + 1)]", "+ for i in range(n - 1):", "+ a, b, c = list(map(int, input().split()))", "+ v[a].append([b, c])", "+ v[b].append([a, c])", "+ q, k = list(map(int, input().split()))", "+ l = [k]", "+ while l:", "+ now = l.pop()", "+ for i in v[now][1:]:", "+ if v[i[0]][0] == 0:", "+ v[i[0]][0] = i[1] + v[now][0]", "+ l.append(i[0])", "+ for i in range(q):", "+ x, y = list(map(int, input().split()))", "+ print((v[x][0] + v[y][0]))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3066135428, "measured_runtime_v1": 0.2174853971, "runtime_lift": 1.4098120925, "key": ["s144783413", "s080655040"]} +{"user_id": "u497046426", "problem_id": "p03568", "language": "python", "submission_id_v0": "s711599117", "submission_id_v1": "s424536945", "cpu_time_v0": 181, "cpu_time_v1": 17, "memory_v0": 3572, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 90.61, "input": "from functools import reduce\n\nfrom itertools import product\n\n\n\nN = int(input())\n\n*A, = list(map(int, input().split()))\n\nans = 0\n\nfor t in product([-1, 0, 1], repeat=N):\n\n prod = reduce(lambda x, y: x*y, [a + t[i] for i, a in enumerate(A)])\n\n if prod % 2 == 0: ans += 1\n\nprint(ans)", "target": "N = int(input())\n\n*A, = list(map(int, input().split()))\n\nevens = 0\n\nfor a in A:\n\n if a % 2 == 0: evens += 1\n\nans = 3**N - 2**evens\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 280, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "from functools import reduce\nfrom itertools import product\n\nN = int(input())\n(*A,) = list(map(int, input().split()))\nans = 0\nfor t in product([-1, 0, 1], repeat=N):\n prod = reduce(lambda x, y: x * y, [a + t[i] for i, a in enumerate(A)])\n if prod % 2 == 0:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\n(*A,) = list(map(int, input().split()))\nevens = 0\nfor a in A:\n if a % 2 == 0:\n evens += 1\nans = 3**N - 2**evens\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-from functools import reduce", "-from itertools import product", "-", "-ans = 0", "-for t in product([-1, 0, 1], repeat=N):", "- prod = reduce(lambda x, y: x * y, [a + t[i] for i, a in enumerate(A)])", "- if prod % 2 == 0:", "- ans += 1", "+evens = 0", "+for a in A:", "+ if a % 2 == 0:", "+ evens += 1", "+ans = 3**N - 2**evens"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6547077734, "measured_runtime_v1": 0.2760411811, "runtime_lift": 2.3717757287, "key": ["s711599117", "s424536945"]} +{"user_id": "u628707847", "problem_id": "p02748", "language": "python", "submission_id_v0": "s393648468", "submission_id_v1": "s394235092", "cpu_time_v0": 533, "cpu_time_v1": 471, "memory_v0": 30260, "memory_v1": 21668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.63, "input": "a, b, m = list(map(int,input().split()))\n\ndr = list(map(int,input().split()))\n\nwa = list(map(int,input().split()))\n\nxyc = [list(map(int,input().split())) for i in range(m)]\n\nlow = 200001\n\n\n\nfor i in range(m):\n\n f = xyc[i][0] - 1\n\n d = xyc[i][1] - 1\n\n if low >= dr[f]+wa[d]-xyc[i][2]:\n\n low = dr[f]+wa[d]-xyc[i][2]\n\n\n\ndr.sort()\n\nwa.sort()\n\n\n\nif low >= (dr[0] + wa[0]):\n\n print((dr[0] + wa[0]))\n\nelse:\n\n print(low)", "target": "a, b, m = list(map(int,input().split()))\n\nal = list(map(int,input().split()))\n\nbl = list(map(int,input().split()))\n\nlow = min(al)+min(bl)\n\nx = [0] * m\n\ny = [0] * m\n\nc = [0] * m\n\n\n\nfor i in range(m):\n\n x[i],y[i],c[i] = list(map(int, input().split()))\n\n x[i] -= 1\n\n y[i] -= 1\n\n \n\nfor i in range(m):\n\n low = min(low,al[x[i]]+bl[y[i]]-c[i])\n\n\n\nprint(low)", "code_v0_loc": 19, "code_v1_loc": 17, "code_v0_num_chars": 424, "code_v1_num_chars": 353, "code_v0_no_empty_lines": "a, b, m = list(map(int, input().split()))\ndr = list(map(int, input().split()))\nwa = list(map(int, input().split()))\nxyc = [list(map(int, input().split())) for i in range(m)]\nlow = 200001\nfor i in range(m):\n f = xyc[i][0] - 1\n d = xyc[i][1] - 1\n if low >= dr[f] + wa[d] - xyc[i][2]:\n low = dr[f] + wa[d] - xyc[i][2]\ndr.sort()\nwa.sort()\nif low >= (dr[0] + wa[0]):\n print((dr[0] + wa[0]))\nelse:\n print(low)\n", "code_v1_no_empty_lines": "a, b, m = list(map(int, input().split()))\nal = list(map(int, input().split()))\nbl = list(map(int, input().split()))\nlow = min(al) + min(bl)\nx = [0] * m\ny = [0] * m\nc = [0] * m\nfor i in range(m):\n x[i], y[i], c[i] = list(map(int, input().split()))\n x[i] -= 1\n y[i] -= 1\nfor i in range(m):\n low = min(low, al[x[i]] + bl[y[i]] - c[i])\nprint(low)\n", "code_same": false, "relative_loc_diff_percent": 10.5263157895, "diff": ["-dr = list(map(int, input().split()))", "-wa = list(map(int, input().split()))", "-xyc = [list(map(int, input().split())) for i in range(m)]", "-low = 200001", "+al = list(map(int, input().split()))", "+bl = list(map(int, input().split()))", "+low = min(al) + min(bl)", "+x = [0] * m", "+y = [0] * m", "+c = [0] * m", "- f = xyc[i][0] - 1", "- d = xyc[i][1] - 1", "- if low >= dr[f] + wa[d] - xyc[i][2]:", "- low = dr[f] + wa[d] - xyc[i][2]", "-dr.sort()", "-wa.sort()", "-if low >= (dr[0] + wa[0]):", "- print((dr[0] + wa[0]))", "-else:", "- print(low)", "+ x[i], y[i], c[i] = list(map(int, input().split()))", "+ x[i] -= 1", "+ y[i] -= 1", "+for i in range(m):", "+ low = min(low, al[x[i]] + bl[y[i]] - c[i])", "+print(low)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2055197518, "measured_runtime_v1": 0.0063774352, "runtime_lift": 32.2260822388, "key": ["s393648468", "s394235092"]} +{"user_id": "u306664745", "problem_id": "p02983", "language": "python", "submission_id_v0": "s965697641", "submission_id_v1": "s560038811", "cpu_time_v0": 68, "cpu_time_v1": 56, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.65, "input": "l, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (((i%2019)*(j%2019))%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)", "target": "l, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (i*j%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 217, "code_v1_num_chars": 201, "code_v0_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 672:\n p = 0\nelse:\n p = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n p = min(p, (((i % 2019) * (j % 2019)) % 2019))\n if not p:\n break\n if not p:\n break\nprint(p)\n", "code_v1_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 672:\n p = 0\nelse:\n p = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n p = min(p, (i * j % 2019))\n if not p:\n break\n if not p:\n break\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- p = min(p, (((i % 2019) * (j % 2019)) % 2019))", "+ p = min(p, (i * j % 2019))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3854847456, "measured_runtime_v1": 0.191389215, "runtime_lift": 2.0141403766, "key": ["s965697641", "s560038811"]} +{"user_id": "u046592970", "problem_id": "p03371", "language": "python", "submission_id_v0": "s911937877", "submission_id_v1": "s225349134", "cpu_time_v0": 121, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.95, "input": "a,b,c,x,y = list(map(int,input().split()))\n\nprice = 10**10\n\nfor k in range(10**5+1):\n\n re = 2*c*k + max(0,x-k)*a + max(0,y-k)*b\n\n price = min(re,price)\n\nprint(price)", "target": "a,b,c,x,y = list(map(int,input().split()))\n\na1 = a*x + b*y\n\na2 = max(x,y) * 2*c\n\nif y >= x:\n\n a3 = 2*c*x + (y-x)*b\n\nelse:\n\n a3 = 2*c*y + (x-y)*a\n\nprint((min(a1,a2,a3)))", "code_v0_loc": 6, "code_v1_loc": 8, "code_v0_num_chars": 165, "code_v1_num_chars": 166, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nprice = 10**10\nfor k in range(10**5 + 1):\n re = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b\n price = min(re, price)\nprint(price)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\na1 = a * x + b * y\na2 = max(x, y) * 2 * c\nif y >= x:\n a3 = 2 * c * x + (y - x) * b\nelse:\n a3 = 2 * c * y + (x - y) * a\nprint((min(a1, a2, a3)))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-price = 10**10", "-for k in range(10**5 + 1):", "- re = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b", "- price = min(re, price)", "-print(price)", "+a1 = a * x + b * y", "+a2 = max(x, y) * 2 * c", "+if y >= x:", "+ a3 = 2 * c * x + (y - x) * b", "+else:", "+ a3 = 2 * c * y + (x - y) * a", "+print((min(a1, a2, a3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4459569323, "measured_runtime_v1": 0.1564870899, "runtime_lift": 2.8498001506, "key": ["s911937877", "s225349134"]} +{"user_id": "u597374218", "problem_id": "p03796", "language": "python", "submission_id_v0": "s873197292", "submission_id_v1": "s712740845", "cpu_time_v0": 231, "cpu_time_v1": 40, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.68, "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "target": "ans=1\n\nn=int(input())\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 6, "code_v0_num_chars": 58, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nn = int(input())\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % (10**9 + 7)))", "+ans = 1", "+n = int(input())", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans = ans % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5415332041, "measured_runtime_v1": 0.2632789848, "runtime_lift": 2.0568797183, "key": ["s873197292", "s712740845"]} +{"user_id": "u222668979", "problem_id": "p02996", "language": "python", "submission_id_v0": "s000658921", "submission_id_v1": "s911267857", "cpu_time_v0": 791, "cpu_time_v1": 572, "memory_v0": 38028, "memory_v1": 117796, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.69, "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(input())\n\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\n\n\n\ncnt = 0\n\nfor b, a in ab:\n\n cnt += a\n\n if cnt > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n", "target": "n = int(input())\n\nab = [list(map(int, input().split())) for _ in range(n)]\n\nab = sorted(ab, key=lambda x: x[1])\n\n\n\nt = 0\n\nfor a, b in ab:\n\n t += a\n\n if t > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 251, "code_v1_num_chars": 226, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nn = int(input())\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\ncnt = 0\nfor b, a in ab:\n cnt += a\n if cnt > b:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_v1_no_empty_lines": "n = int(input())\nab = [list(map(int, input().split())) for _ in range(n)]\nab = sorted(ab, key=lambda x: x[1])\nt = 0\nfor a, b in ab:\n t += a\n if t > b:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-ab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])", "-cnt = 0", "-for b, a in ab:", "- cnt += a", "- if cnt > b:", "+ab = [list(map(int, input().split())) for _ in range(n)]", "+ab = sorted(ab, key=lambda x: x[1])", "+t = 0", "+for a, b in ab:", "+ t += a", "+ if t > b:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2345721078, "measured_runtime_v1": 0.0064230425, "runtime_lift": 36.5204038616, "key": ["s000658921", "s911267857"]} +{"user_id": "u281303342", "problem_id": "p03828", "language": "python", "submission_id_v0": "s909168869", "submission_id_v1": "s458659043", "cpu_time_v0": 68, "cpu_time_v1": 27, "memory_v0": 3316, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.29, "input": "from collections import Counter\n\nN = int(input())\n\ndiv = []\n\nfor i in range(2,N+1):\n\n while i != 1:\n\n for d in range(2,i+1):\n\n while i%d==0:\n\n i = i//d\n\n div.append(d)\n\nC = Counter(div).most_common()\n\nAns = 1\n\nfor k,v in C:\n\n Ans = Ans*(v+1) % (10**9+7)\n\n\n\nprint(Ans)\n", "target": "from collections import defaultdict\n\nN = int(input())\n\n\n\nF = [True]*(N+1)\n\nF[0]=F[1]=False\n\nP = []\n\n\n\nfor i in range(2,N+1):\n\n if F[i]==True:\n\n P.append(i)\n\n for j in range(i*2,N+1,i):\n\n F[j]=False\n\n\n\ndic = defaultdict(int)\n\nfor i in range(2,N+1):\n\n for p in P:\n\n while i%p==0:\n\n dic[p] += 1\n\n i = i//p\n\n if i==1:\n\n break\n\n\n\nans = 1\n\nmodulo = 10**9+7\n\nfor v in list(dic.values()):\n\n ans *= (v+1)\n\n ans %= modulo\n\n\n\nprint(ans)", "code_v0_loc": 15, "code_v1_loc": 29, "code_v0_num_chars": 322, "code_v1_num_chars": 503, "code_v0_no_empty_lines": "from collections import Counter\n\nN = int(input())\ndiv = []\nfor i in range(2, N + 1):\n while i != 1:\n for d in range(2, i + 1):\n while i % d == 0:\n i = i // d\n div.append(d)\nC = Counter(div).most_common()\nAns = 1\nfor k, v in C:\n Ans = Ans * (v + 1) % (10**9 + 7)\nprint(Ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nF = [True] * (N + 1)\nF[0] = F[1] = False\nP = []\nfor i in range(2, N + 1):\n if F[i] == True:\n P.append(i)\n for j in range(i * 2, N + 1, i):\n F[j] = False\ndic = defaultdict(int)\nfor i in range(2, N + 1):\n for p in P:\n while i % p == 0:\n dic[p] += 1\n i = i // p\n if i == 1:\n break\nans = 1\nmodulo = 10**9 + 7\nfor v in list(dic.values()):\n ans *= v + 1\n ans %= modulo\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 48.275862069, "diff": ["-from collections import Counter", "+from collections import defaultdict", "-div = []", "+F = [True] * (N + 1)", "+F[0] = F[1] = False", "+P = []", "- while i != 1:", "- for d in range(2, i + 1):", "- while i % d == 0:", "- i = i // d", "- div.append(d)", "-C = Counter(div).most_common()", "-Ans = 1", "-for k, v in C:", "- Ans = Ans * (v + 1) % (10**9 + 7)", "-print(Ans)", "+ if F[i] == True:", "+ P.append(i)", "+ for j in range(i * 2, N + 1, i):", "+ F[j] = False", "+dic = defaultdict(int)", "+for i in range(2, N + 1):", "+ for p in P:", "+ while i % p == 0:", "+ dic[p] += 1", "+ i = i // p", "+ if i == 1:", "+ break", "+ans = 1", "+modulo = 10**9 + 7", "+for v in list(dic.values()):", "+ ans *= v + 1", "+ ans %= modulo", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3373793194, "measured_runtime_v1": 0.2469508071, "runtime_lift": 1.3661802664, "key": ["s909168869", "s458659043"]} +{"user_id": "u426534722", "problem_id": "p02245", "language": "python", "submission_id_v0": "s804728708", "submission_id_v1": "s622088378", "cpu_time_v0": 760, "cpu_time_v1": 650, "memory_v0": 25996, "memory_v1": 31348, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.47, "input": "from collections import deque\n\nfrom copy import deepcopy, copy\n\ndy = [-1, 0, 0, 1]\n\ndx = [0, -1, 1, 0]\n\nN = 3\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef MAIN():\n\n m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n goal = ('1', '2', '3', '4', '5', '6', '7', '8', '0')\n\n goal = 123456780\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n print(cnt)\n\n break\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\nMAIN()\n\n\n", "target": "from collections import deque\n\nfrom copy import deepcopy, copy\n\nN = 3\n\ndef g(i, j, a):\n\n if i > j:\n\n i, j = j, i\n\n return a[:i] + a[j] + a[i + 1:j] + a[i] + a[j + 1:]\n\ndef MAIN():\n\n m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = MAP.find(\"0\")\n\n goal = \"123456780\"\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n print(cnt)\n\n break\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\nMAIN()\n\n\n", "code_v0_loc": 30, "code_v1_loc": 27, "code_v0_num_chars": 885, "code_v1_num_chars": 783, "code_v0_no_empty_lines": "from collections import deque\nfrom copy import deepcopy, copy\n\ndy = [-1, 0, 0, 1]\ndx = [0, -1, 1, 0]\nN = 3\n\n\ndef g(i, j, a):\n t = a // (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef MAIN():\n m = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n }\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = 8 - MAP.find(\"0\")\n MAP = int(MAP)\n goal = (\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"0\")\n goal = 123456780\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n print(cnt)\n break\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\nMAIN()\n", "code_v1_no_empty_lines": "from collections import deque\nfrom copy import deepcopy, copy\n\nN = 3\n\n\ndef g(i, j, a):\n if i > j:\n i, j = j, i\n return a[:i] + a[j] + a[i + 1 : j] + a[i] + a[j + 1 :]\n\n\ndef MAIN():\n m = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n }\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = MAP.find(\"0\")\n goal = \"123456780\"\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n print(cnt)\n break\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\nMAIN()\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-dy = [-1, 0, 0, 1]", "-dx = [0, -1, 1, 0]", "- t = a // (10**j) % 10", "- return a - t * (10**j) + t * (10**i)", "+ if i > j:", "+ i, j = j, i", "+ return a[:i] + a[j] + a[i + 1 : j] + a[i] + a[j + 1 :]", "- start = 8 - MAP.find(\"0\")", "- MAP = int(MAP)", "- goal = (\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"0\")", "- goal = 123456780", "+ start = MAP.find(\"0\")", "+ goal = \"123456780\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.3641724348, "measured_runtime_v1": 0.096000421, "runtime_lift": 3.7934462245, "key": ["s804728708", "s622088378"]} +{"user_id": "u556358547", "problem_id": "p03416", "language": "python", "submission_id_v0": "s971943319", "submission_id_v1": "s985131399", "cpu_time_v0": 94, "cpu_time_v1": 70, "memory_v0": 73744, "memory_v1": 64480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.53, "input": "# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n r = \"\".join(reversed(list(s)))\n\n if s == r:\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n # s = str(i)\n\n # r = \"\".join(reversed(list(s)))\n\n # if s == r:\n\n # c += 1\n\n if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 281, "code_v1_num_chars": 407, "code_v0_no_empty_lines": "# vim: fileencoding=utf-8\ndef main():\n a, b = list(map(int, input().split()))\n c = 0\n for i in range(a, b + 1):\n s = str(i)\n r = \"\".join(reversed(list(s)))\n if s == r:\n c += 1\n print(c)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# vim: fileencoding=utf-8\ndef main():\n a, b = list(map(int, input().split()))\n c = 0\n for i in range(a, b + 1):\n # s = str(i)\n # r = \"\".join(reversed(list(s)))\n # if s == r:\n # c += 1\n if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):\n c += 1\n print(c)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- s = str(i)", "- r = \"\".join(reversed(list(s)))", "- if s == r:", "+ # s = str(i)", "+ # r = \"\".join(reversed(list(s)))", "+ # if s == r:", "+ # c += 1", "+ if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.319033144, "measured_runtime_v1": 0.2127196875, "runtime_lift": 1.4997819327, "key": ["s971943319", "s985131399"]} +{"user_id": "u764401543", "problem_id": "p03371", "language": "python", "submission_id_v0": "s157366337", "submission_id_v1": "s208344914", "cpu_time_v0": 114, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.09, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float('inf')\n\n\n\nfor i in range(10 ** 5 + 1):\n\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n# ans = float('inf')\n\n\n\n# for i in range(10 ** 5 + 1):\n\n# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\n# print(ans)\n\n\n\nmin_xy = min(X, Y)\n\nmax_xy = max(X, Y)\n\nans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)\n\nans2 = A * X + B * Y\n\nans3 = 2 * C * max_xy\n\nprint((min(ans1, ans2, ans3)))", "code_v0_loc": 7, "code_v1_loc": 14, "code_v0_num_chars": 178, "code_v1_num_chars": 364, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(10**5 + 1):\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\n# ans = float('inf')\n# for i in range(10 ** 5 + 1):\n# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n# print(ans)\nmin_xy = min(X, Y)\nmax_xy = max(X, Y)\nans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)\nans2 = A * X + B * Y\nans3 = 2 * C * max_xy\nprint((min(ans1, ans2, ans3)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-ans = float(\"inf\")", "-for i in range(10**5 + 1):", "- ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)", "-print(ans)", "+# ans = float('inf')", "+# for i in range(10 ** 5 + 1):", "+# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)", "+# print(ans)", "+min_xy = min(X, Y)", "+max_xy = max(X, Y)", "+ans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)", "+ans2 = A * X + B * Y", "+ans3 = 2 * C * max_xy", "+print((min(ans1, ans2, ans3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8766576855, "measured_runtime_v1": 0.1948450158, "runtime_lift": 4.4992564066, "key": ["s157366337", "s208344914"]} +{"user_id": "u896741788", "problem_id": "p03037", "language": "python", "submission_id_v0": "s129241236", "submission_id_v1": "s743438543", "cpu_time_v0": 355, "cpu_time_v1": 218, "memory_v0": 7832, "memory_v1": 15472, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 38.59, "input": "k,m=list(map(int,input().split()))\n\nl=[0 for i in range(k+1)]\n\nfor i in range(m):\n\n a,s=list(map(int,input().split()))\n\n l[a-1]+=1;l[s]-=1\n\nans=0\n\nf=0\n\nfor j in range(k):\n\n l[j]+=f\n\n f=l[j]\n\nprint((len([1 for i in l if i==m])))", "target": "n,m=list(map(int,input().split()))\n\ntable=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n table[l]+=1\n\n table[r+1]-=1\n\nfrom itertools import accumulate\n\nfrom collections import Counter as co\n\nvar=co((accumulate(table)))\n\n\n\nif m not in var:print((0))\n\nelse:print((var[m]))\n\n\n\n\n", "code_v0_loc": 11, "code_v1_loc": 14, "code_v0_num_chars": 217, "code_v1_num_chars": 290, "code_v0_no_empty_lines": "k, m = list(map(int, input().split()))\nl = [0 for i in range(k + 1)]\nfor i in range(m):\n a, s = list(map(int, input().split()))\n l[a - 1] += 1\n l[s] -= 1\nans = 0\nf = 0\nfor j in range(k):\n l[j] += f\n f = l[j]\nprint((len([1 for i in l if i == m])))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\ntable = [0] * (n + 2)\nfor i in range(m):\n l, r = list(map(int, input().split()))\n table[l] += 1\n table[r + 1] -= 1\nfrom itertools import accumulate\nfrom collections import Counter as co\n\nvar = co((accumulate(table)))\nif m not in var:\n print((0))\nelse:\n print((var[m]))\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-k, m = list(map(int, input().split()))", "-l = [0 for i in range(k + 1)]", "+n, m = list(map(int, input().split()))", "+table = [0] * (n + 2)", "- a, s = list(map(int, input().split()))", "- l[a - 1] += 1", "- l[s] -= 1", "-ans = 0", "-f = 0", "-for j in range(k):", "- l[j] += f", "- f = l[j]", "-print((len([1 for i in l if i == m])))", "+ l, r = list(map(int, input().split()))", "+ table[l] += 1", "+ table[r + 1] -= 1", "+from itertools import accumulate", "+from collections import Counter as co", "+", "+var = co((accumulate(table)))", "+if m not in var:", "+ print((0))", "+else:", "+ print((var[m]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4122046263, "measured_runtime_v1": 0.3202181025, "runtime_lift": 1.2872620978, "key": ["s129241236", "s743438543"]} +{"user_id": "u025501820", "problem_id": "p02792", "language": "python", "submission_id_v0": "s746150122", "submission_id_v1": "s989284284", "cpu_time_v0": 318, "cpu_time_v1": 169, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.86, "input": "N = int(input())\n\ncount = [[0 for _ in range(9)] for _ in range(9)]\n\nfor i in range(1, N + 1):\n\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\n\nans = 0\n\nfor i in range(0, 9):\n\n for k in range(0, 9):\n\n ans += count[i][k] * count[k][i]\n\nprint(ans)", "target": "N = int(input())\n\nnums = [0 for i in range(100)]\n\nfor i in range(1, N + 1):\n\n i = str(i)\n\n nums[int(i[0] + i[-1])] += 1\n\nans = 0\n\nfor i in range(1, 10):\n\n for j in range(i, 10):\n\n i = str(i)\n\n j = str(j)\n\n if i != j:\n\n ans += nums[int(i + j)] * nums[int(j + i)] * 2\n\n else:\n\n n = nums[int(i + j)]\n\n ans += n * (n - 1)\n\n ans += n\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 17, "code_v0_num_chars": 316, "code_v1_num_chars": 421, "code_v0_no_empty_lines": "N = int(input())\ncount = [[0 for _ in range(9)] for _ in range(9)]\nfor i in range(1, N + 1):\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\nans = 0\nfor i in range(0, 9):\n for k in range(0, 9):\n ans += count[i][k] * count[k][i]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nnums = [0 for i in range(100)]\nfor i in range(1, N + 1):\n i = str(i)\n nums[int(i[0] + i[-1])] += 1\nans = 0\nfor i in range(1, 10):\n for j in range(i, 10):\n i = str(i)\n j = str(j)\n if i != j:\n ans += nums[int(i + j)] * nums[int(j + i)] * 2\n else:\n n = nums[int(i + j)]\n ans += n * (n - 1)\n ans += n\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.1764705882, "diff": ["-count = [[0 for _ in range(9)] for _ in range(9)]", "+nums = [0 for i in range(100)]", "- if str(i)[0] != \"0\" and str(i)[-1] != \"0\":", "- count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1", "+ i = str(i)", "+ nums[int(i[0] + i[-1])] += 1", "-for i in range(0, 9):", "- for k in range(0, 9):", "- ans += count[i][k] * count[k][i]", "+for i in range(1, 10):", "+ for j in range(i, 10):", "+ i = str(i)", "+ j = str(j)", "+ if i != j:", "+ ans += nums[int(i + j)] * nums[int(j + i)] * 2", "+ else:", "+ n = nums[int(i + j)]", "+ ans += n * (n - 1)", "+ ans += n"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4702084679, "measured_runtime_v1": 0.3054097801, "runtime_lift": 1.5395985934, "key": ["s746150122", "s989284284"]} +{"user_id": "u588341295", "problem_id": "p03078", "language": "python", "submission_id_v0": "s622309249", "submission_id_v1": "s171509372", "cpu_time_v0": 118, "cpu_time_v1": 37, "memory_v0": 8728, "memory_v1": 4976, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 68.64, "input": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x // y))\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\nABC=[]\n\nfor i in range(X):\n\n for j in range(Y):\n\n if (i+1)*(j+1)>K:\n\n break\n\n for k in range(Z):\n\n if (i+1)*(j+1)*(k+1)>K:\n\n break\n\n ABC.append(A[i]+B[j]+C[k])\n\nABC.sort(reverse=True)\n\nfor i in range(K):\n\n print((ABC[i]))\n\n\n", "target": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\nfrom heapq import heappush, heappop\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x // y))\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\n\n\nque=[]\n\nheappush(que, (-(A[0]+B[0]+C[0]), 0, 0, 0))\n\nS={(0,0,0)}\n\nfor i in range(K):\n\n ans=heappop(que)\n\n print((-ans[0]))\n\n a,b,c=ans[1:]\n\n if a+1 K:\n break\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) > K:\n break\n ABC.append(A[i] + B[j] + C[k])\nABC.sort(reverse=True)\nfor i in range(K):\n print((ABC[i]))\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\nfrom heapq import heappush, heappop\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x // y))\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nMOD = 10**9 + 7\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nque = []\nheappush(que, (-(A[0] + B[0] + C[0]), 0, 0, 0))\nS = {(0, 0, 0)}\nfor i in range(K):\n ans = heappop(que)\n print((-ans[0]))\n a, b, c = ans[1:]\n if a + 1 < X and (a + 1, b, c) not in S:\n heappush(que, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))\n S.add((a + 1, b, c))\n if b + 1 < Y and (a, b + 1, c) not in S:\n heappush(que, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))\n S.add((a, b + 1, c))\n if c + 1 < Z and (a, b, c + 1) not in S:\n heappush(que, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))\n S.add((a, b, c + 1))\n", "code_same": false, "relative_loc_diff_percent": 11.9047619048, "diff": ["+from heapq import heappush, heappop", "-ABC = []", "-for i in range(X):", "- for j in range(Y):", "- if (i + 1) * (j + 1) > K:", "- break", "- for k in range(Z):", "- if (i + 1) * (j + 1) * (k + 1) > K:", "- break", "- ABC.append(A[i] + B[j] + C[k])", "-ABC.sort(reverse=True)", "+que = []", "+heappush(que, (-(A[0] + B[0] + C[0]), 0, 0, 0))", "+S = {(0, 0, 0)}", "- print((ABC[i]))", "+ ans = heappop(que)", "+ print((-ans[0]))", "+ a, b, c = ans[1:]", "+ if a + 1 < X and (a + 1, b, c) not in S:", "+ heappush(que, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))", "+ S.add((a + 1, b, c))", "+ if b + 1 < Y and (a, b + 1, c) not in S:", "+ heappush(que, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))", "+ S.add((a, b + 1, c))", "+ if c + 1 < Z and (a, b, c + 1) not in S:", "+ heappush(que, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))", "+ S.add((a, b, c + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2840606916, "measured_runtime_v1": 0.2124910862, "runtime_lift": 1.3368122711, "key": ["s622309249", "s171509372"]} +{"user_id": "u216928054", "problem_id": "p02560", "language": "python", "submission_id_v0": "s978863609", "submission_id_v1": "s598945859", "cpu_time_v0": 297, "cpu_time_v1": 234, "memory_v0": 78412, "memory_v1": 70336, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.21, "input": "#!/usr/bin/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum_1(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n while True:\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n n = y_max\n\n m, a, b = a, m, (a - x_max % a) % a\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n", "code_v0_loc": 87, "code_v1_loc": 105, "code_v0_num_chars": 1613, "code_v1_num_chars": 2066, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\nsys.setrecursionlimit(10**6)\nINF = 10**9 + 1 # sys.maxsize # float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef floor_sum(n, m, a, b):\n ret = 0\n if a >= m:\n ret += (n - 1) * n * (a // m) // 2\n a %= m\n if b >= m:\n ret += n * (b // m)\n b %= m\n y_max = (a * n + b) // m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) // a) * y_max\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n return ret\n\n\ndef debug(*x):\n print(*x, file=sys.stderr)\n\n\ndef solve(SOLVE_PARAMS):\n pass\n\n\ndef main():\n # parse input\n T = int(input())\n for _t in range(T):\n N, M, A, B = map(int, input().split())\n print(floor_sum(N, M, A, B))\n\n\n# tests\nT1 = \"\"\"\n5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n\"\"\"\nTEST_T1 = \"\"\"\n>>> as_input(T1)\n>>> main()\n3\n13\n0\n314095480\n499999999500000000\n\"\"\"\n\n\ndef _test():\n import doctest\n\n doctest.testmod()\n g = globals()\n for k in sorted(g):\n if k.startswith(\"TEST_\"):\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\ndef as_input(s):\n \"use in test, use given string as input file\"\n import io\n\n f = io.StringIO(s.strip())\n g = globals()\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\ninput = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nif sys.argv[-1] == \"-t\":\n print(\"testing\")\n _test()\n sys.exit()\nmain()\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\nsys.setrecursionlimit(10**6)\nINF = 10**9 + 1 # sys.maxsize # float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef floor_sum_1(n, m, a, b):\n ret = 0\n if a >= m:\n ret += (n - 1) * n * (a // m) // 2\n a %= m\n if b >= m:\n ret += n * (b // m)\n b %= m\n y_max = (a * n + b) // m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) // a) * y_max\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n return ret\n\n\ndef floor_sum(n, m, a, b):\n ret = 0\n while True:\n if a >= m:\n ret += (n - 1) * n * (a // m) // 2\n a %= m\n if b >= m:\n ret += n * (b // m)\n b %= m\n y_max = (a * n + b) // m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) // a) * y_max\n n = y_max\n m, a, b = a, m, (a - x_max % a) % a\n\n\ndef debug(*x):\n print(*x, file=sys.stderr)\n\n\ndef solve(SOLVE_PARAMS):\n pass\n\n\ndef main():\n # parse input\n T = int(input())\n for _t in range(T):\n N, M, A, B = map(int, input().split())\n print(floor_sum(N, M, A, B))\n\n\n# tests\nT1 = \"\"\"\n5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n\"\"\"\nTEST_T1 = \"\"\"\n>>> as_input(T1)\n>>> main()\n3\n13\n0\n314095480\n499999999500000000\n\"\"\"\n\n\ndef _test():\n import doctest\n\n doctest.testmod()\n g = globals()\n for k in sorted(g):\n if k.startswith(\"TEST_\"):\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\ndef as_input(s):\n \"use in test, use given string as input file\"\n import io\n\n f = io.StringIO(s.strip())\n g = globals()\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\ninput = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nif sys.argv[-1] == \"-t\":\n print(\"testing\")\n _test()\n sys.exit()\nmain()\n", "code_same": false, "relative_loc_diff_percent": 17.1428571429, "diff": ["-def floor_sum(n, m, a, b):", "+def floor_sum_1(n, m, a, b):", "+", "+", "+def floor_sum(n, m, a, b):", "+ ret = 0", "+ while True:", "+ if a >= m:", "+ ret += (n - 1) * n * (a // m) // 2", "+ a %= m", "+ if b >= m:", "+ ret += n * (b // m)", "+ b %= m", "+ y_max = (a * n + b) // m", "+ x_max = y_max * m - b", "+ if y_max == 0:", "+ return ret", "+ ret += (n - (x_max + a - 1) // a) * y_max", "+ n = y_max", "+ m, a, b = a, m, (a - x_max % a) % a"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1788789105, "measured_runtime_v1": 0.0066359096, "runtime_lift": 26.9562007629, "key": ["s978863609", "s598945859"]} +{"user_id": "u442877951", "problem_id": "p02881", "language": "python", "submission_id_v0": "s498895748", "submission_id_v1": "s605488454", "cpu_time_v0": 574, "cpu_time_v1": 295, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.61, "input": "import math\n\nN = int(input())\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = math.ceil(N/(i+1))\n\n if (1+i)*j == N:\n\n ans = min(i+j-1,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)", "target": "N = int(input())\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = N//i\n\n if i*j == N:\n\n ans = min(i+j-2,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 217, "code_v1_num_chars": 186, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = 10**12\nfor i in range(1, 10**6 + 1):\n j = math.ceil(N / (i + 1))\n if (1 + i) * j == N:\n ans = min(i + j - 1, ans)\n if i == 10**6 and ans == 10**12:\n ans = N - 1\n break\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nans = 10**12\nfor i in range(1, 10**6 + 1):\n j = N // i\n if i * j == N:\n ans = min(i + j - 2, ans)\n if i == 10**6 and ans == 10**12:\n ans = N - 1\n break\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-import math", "-", "- j = math.ceil(N / (i + 1))", "- if (1 + i) * j == N:", "- ans = min(i + j - 1, ans)", "+ j = N // i", "+ if i * j == N:", "+ ans = min(i + j - 2, ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 3.3566168053, "measured_runtime_v1": 2.0076369724, "runtime_lift": 1.6719241832, "key": ["s498895748", "s605488454"]} +{"user_id": "u864197622", "problem_id": "p02758", "language": "python", "submission_id_v0": "s598598719", "submission_id_v1": "s066197035", "cpu_time_v0": 1348, "cpu_time_v1": 954, "memory_v0": 102564, "memory_v1": 97192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.23, "input": "mod = 998244353\n\nN = int(input())\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\nmod = 998244353\n\nN = int(input())\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))", "code_v0_loc": 32, "code_v1_loc": 35, "code_v0_num_chars": 675, "code_v1_num_chars": 717, "code_v0_no_empty_lines": "mod = 998244353\nN = int(input())\nX = []\nfor _ in range(N):\n x, d = list(map(int, input().split()))\n X.append((x, x + d))\nX = sorted(X, key=lambda x: x[0])\nL = [(0, -(10**9 + 1), 10**9 + 1)]\nP = [-1] * (N + 1)\nfor i, (x, y) in enumerate(X):\n while L[-1][2] <= y:\n if L[-1][2] > x and P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.pop()\n if P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.append((i + 1, x, y))\nC = [[] for _ in range(N + 1)]\nfor i, p in enumerate(P):\n if p >= 0:\n C[p].append(i)\nY = [1] * (N + 1)\nfor i in range(N + 1)[::-1]:\n s = 1\n for j in C[i]:\n s = s * (Y[j] + 1) % mod\n Y[i] = s\nprint((Y[0]))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nmod = 998244353\nN = int(input())\nX = []\nfor _ in range(N):\n x, d = list(map(int, input().split()))\n X.append((x, x + d))\nX = sorted(X, key=lambda x: x[0])\nL = [(0, -(10**9 + 1), 10**9 + 1)]\nP = [-1] * (N + 1)\nfor i, (x, y) in enumerate(X):\n while L[-1][2] <= y:\n if L[-1][2] > x and P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.pop()\n if P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.append((i + 1, x, y))\nC = [[] for _ in range(N + 1)]\nfor i, p in enumerate(P):\n if p >= 0:\n C[p].append(i)\nY = [1] * (N + 1)\nfor i in range(N + 1)[::-1]:\n s = 1\n for j in C[i]:\n s = s * (Y[j] + 1) % mod\n Y[i] = s\nprint((Y[0]))\n", "code_same": false, "relative_loc_diff_percent": 8.5714285714, "diff": ["+import sys", "+", "+input = sys.stdin.readline"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2547301891, "measured_runtime_v1": 0.0065454967, "runtime_lift": 38.9168615134, "key": ["s598598719", "s066197035"]} +{"user_id": "u539692012", "problem_id": "p02622", "language": "python", "submission_id_v0": "s511745855", "submission_id_v1": "s953276742", "cpu_time_v0": 78, "cpu_time_v1": 44, "memory_v0": 68212, "memory_v1": 9464, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.59, "input": "print((sum(si != ti for si, ti in zip(input(), input()))))\n", "target": "print((sum(a!=b for a,b in zip(*open(0)))))", "code_v0_loc": 1, "code_v1_loc": 1, "code_v0_num_chars": 57, "code_v1_num_chars": 41, "code_v0_no_empty_lines": "print((sum(si != ti for si, ti in zip(input(), input()))))\n", "code_v1_no_empty_lines": "print((sum(a != b for a, b in zip(*open(0)))))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-print((sum(si != ti for si, ti in zip(input(), input()))))", "+print((sum(a != b for a, b in zip(*open(0)))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3334237881, "measured_runtime_v1": 0.1220404458, "runtime_lift": 2.7320761232, "key": ["s511745855", "s953276742"]} +{"user_id": "u540631540", "problem_id": "p02767", "language": "python", "submission_id_v0": "s304816826", "submission_id_v1": "s138180908", "cpu_time_v0": 22, "cpu_time_v1": 19, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.64, "input": "n = int(input())\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n # else:\n\n # break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)", "target": "n = int(input())\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n else:\n\n break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 269, "code_v1_num_chars": 265, "code_v0_no_empty_lines": "n = int(input())\nx = [int(i) for i in input().split()]\np = 10000000\nfor i in range(100):\n pi = 0\n for j in range(n):\n pi += (x[j] - (i + 1)) ** 2\n if pi < p:\n p = pi\n # else:\n # break\n # p[i] += (x[j]-(i+1))**2\nprint(p)\n", "code_v1_no_empty_lines": "n = int(input())\nx = [int(i) for i in input().split()]\np = 10000000\nfor i in range(100):\n pi = 0\n for j in range(n):\n pi += (x[j] - (i + 1)) ** 2\n if pi < p:\n p = pi\n else:\n break\n # p[i] += (x[j]-(i+1))**2\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- # else:", "- # break", "- # p[i] += (x[j]-(i+1))**2", "+ else:", "+ break", "+ # p[i] += (x[j]-(i+1))**2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.18753242, "measured_runtime_v1": 0.0060767163, "runtime_lift": 30.860815536, "key": ["s304816826", "s138180908"]} +{"user_id": "u297574184", "problem_id": "p02792", "language": "python", "submission_id_v0": "s401307257", "submission_id_v1": "s179676165", "cpu_time_v0": 236, "cpu_time_v1": 18, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.37, "input": "def solve():\n\n N = int(input())\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, 5):\n\n for i in range(10**d):\n\n j = x*10**(d+1) + i*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n else:\n\n break\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for A in range(1, N+1):\n\n ss = str(A)\n\n ans += numss[int(ss[-1])][int(ss[0])]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n", "target": "def solve():\n\n strN = input()\n\n N = int(strN)\n\n\n\n maxD = len(strN)\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, maxD-2):\n\n num += 10**d\n\n if maxD-2 > 0:\n\n if x < int(strN[0]):\n\n num += 10**(maxD-2)\n\n elif x == int(strN[0]):\n\n num += int(strN[1:-1]) + 1\n\n if y > int(strN[-1]):\n\n num -= 1\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += numss[i][j]*numss[j][i]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n", "code_v0_loc": 32, "code_v1_loc": 37, "code_v0_num_chars": 778, "code_v1_num_chars": 917, "code_v0_no_empty_lines": "def solve():\n N = int(input())\n numss = [[0] * (10) for _ in range(10)]\n for x in range(1, 10):\n for y in range(1, 10):\n num = 0\n for d in range(1, 5):\n for i in range(10**d):\n j = x * 10 ** (d + 1) + i * 10 + y\n if 1 <= j <= N:\n num += 1\n else:\n break\n j = x * 10 + y\n if 1 <= j <= N:\n num += 1\n if x == y:\n j = x\n if 1 <= j <= N:\n num += 1\n numss[x][y] = num\n ans = 0\n for A in range(1, N + 1):\n ss = str(A)\n ans += numss[int(ss[-1])][int(ss[0])]\n print(ans)\n\n\nsolve()\n", "code_v1_no_empty_lines": "def solve():\n strN = input()\n N = int(strN)\n maxD = len(strN)\n numss = [[0] * (10) for _ in range(10)]\n for x in range(1, 10):\n for y in range(1, 10):\n num = 0\n for d in range(1, maxD - 2):\n num += 10**d\n if maxD - 2 > 0:\n if x < int(strN[0]):\n num += 10 ** (maxD - 2)\n elif x == int(strN[0]):\n num += int(strN[1:-1]) + 1\n if y > int(strN[-1]):\n num -= 1\n j = x * 10 + y\n if 1 <= j <= N:\n num += 1\n if x == y:\n j = x\n if 1 <= j <= N:\n num += 1\n numss[x][y] = num\n ans = 0\n for i in range(1, 10):\n for j in range(1, 10):\n ans += numss[i][j] * numss[j][i]\n print(ans)\n\n\nsolve()\n", "code_same": false, "relative_loc_diff_percent": 13.5135135135, "diff": ["- N = int(input())", "+ strN = input()", "+ N = int(strN)", "+ maxD = len(strN)", "- for d in range(1, 5):", "- for i in range(10**d):", "- j = x * 10 ** (d + 1) + i * 10 + y", "- if 1 <= j <= N:", "- num += 1", "- else:", "- break", "+ for d in range(1, maxD - 2):", "+ num += 10**d", "+ if maxD - 2 > 0:", "+ if x < int(strN[0]):", "+ num += 10 ** (maxD - 2)", "+ elif x == int(strN[0]):", "+ num += int(strN[1:-1]) + 1", "+ if y > int(strN[-1]):", "+ num -= 1", "- for A in range(1, N + 1):", "- ss = str(A)", "- ans += numss[int(ss[-1])][int(ss[0])]", "+ for i in range(1, 10):", "+ for j in range(1, 10):", "+ ans += numss[i][j] * numss[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3220527915, "measured_runtime_v1": 0.2179562147, "runtime_lift": 1.4776031599, "key": ["s401307257", "s179676165"]} +{"user_id": "u777923818", "problem_id": "p03086", "language": "python", "submission_id_v0": "s716593637", "submission_id_v1": "s955967436", "cpu_time_v0": 22, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.73, "input": "# -*- coding: utf-8 -*-\n\nfrom collections import deque\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nS = input()\n\nA = set(\"ATCG\")\n\nans = 0\n\nmode = 0\n\nfor i, s in enumerate(S):\n\n if s in A:\n\n if mode == 0:\n\n mode = 1\n\n start = i\n\n else:\n\n if mode == 1:\n\n ans = max(i - start, ans)\n\n mode = 0\n\nif mode == 1:\n\n ans = max(len(S) - start, ans)\n\nprint(ans)", "target": "def inpl(): return list(map(int, input().split()))\n\nS = input()\n\nC = set(\"ACGT\")\n\n\n\ntmp = 0\n\nans = 0\n\n\n\nfor s in S:\n\n if s in C:\n\n tmp += 1\n\n else:\n\n ans = max(ans, tmp)\n\n tmp = 0\n\nans = max(ans, tmp)\n\nprint(ans)", "code_v0_loc": 20, "code_v1_loc": 15, "code_v0_num_chars": 426, "code_v1_num_chars": 239, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nfrom collections import deque\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\nS = input()\nA = set(\"ATCG\")\nans = 0\nmode = 0\nfor i, s in enumerate(S):\n if s in A:\n if mode == 0:\n mode = 1\n start = i\n else:\n if mode == 1:\n ans = max(i - start, ans)\n mode = 0\nif mode == 1:\n ans = max(len(S) - start, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "def inpl():\n return list(map(int, input().split()))\n\n\nS = input()\nC = set(\"ACGT\")\ntmp = 0\nans = 0\nfor s in S:\n if s in C:\n tmp += 1\n else:\n ans = max(ans, tmp)\n tmp = 0\nans = max(ans, tmp)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-# -*- coding: utf-8 -*-", "-from collections import deque", "-", "-", "-A = set(\"ATCG\")", "+C = set(\"ACGT\")", "+tmp = 0", "-mode = 0", "-for i, s in enumerate(S):", "- if s in A:", "- if mode == 0:", "- mode = 1", "- start = i", "+for s in S:", "+ if s in C:", "+ tmp += 1", "- if mode == 1:", "- ans = max(i - start, ans)", "- mode = 0", "-if mode == 1:", "- ans = max(len(S) - start, ans)", "+ ans = max(ans, tmp)", "+ tmp = 0", "+ans = max(ans, tmp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1640799, "measured_runtime_v1": 0.006362747, "runtime_lift": 25.7875884356, "key": ["s716593637", "s955967436"]} +{"user_id": "u854690176", "problem_id": "p02952", "language": "python", "submission_id_v0": "s720457111", "submission_id_v1": "s185706611", "cpu_time_v0": 60, "cpu_time_v1": 51, "memory_v0": 2940, "memory_v1": 6732, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N = int(input())\n\nans = 0\n\nfor i in range(1, N + 1):\n\n if len(str(i)) % 2 == 1:\n\n ans += 1\n\nprint(ans)", "target": "N = int(input())\n\nprint((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))", "code_v0_loc": 6, "code_v1_loc": 2, "code_v0_num_chars": 112, "code_v1_num_chars": 91, "code_v0_no_empty_lines": "N = int(input())\nans = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 == 1:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nprint((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-ans = 0", "-for i in range(1, N + 1):", "- if len(str(i)) % 2 == 1:", "- ans += 1", "-print(ans)", "+print((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1607959216, "measured_runtime_v1": 0.006350698, "runtime_lift": 25.3194092141, "key": ["s720457111", "s185706611"]} +{"user_id": "u282228874", "problem_id": "p03353", "language": "python", "submission_id_v0": "s703764972", "submission_id_v1": "s575406884", "cpu_time_v0": 39, "cpu_time_v1": 34, "memory_v0": 4976, "memory_v1": 4592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.82, "input": "S = input()\n\nk = int(input())\n\nA = set()\n\nfor l in range(k+1):\n\n\tfor i in range(len(S)-l):\n\n\t\t\tA.add(S[i:i+l+1])\n\nA = sorted(list(A))\n\nprint((A[k-1]))", "target": "S = input()\n\nl = len(S)\n\nd = set()\n\nK = int(input())\n\nfor i in range(5):\n\n for j in range(l-i):\n\n d.add(S[j:j+i+1])\n\nD = sorted(list(d))\n\nprint((D[K-1]))", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 148, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "S = input()\nk = int(input())\nA = set()\nfor l in range(k + 1):\n for i in range(len(S) - l):\n A.add(S[i : i + l + 1])\nA = sorted(list(A))\nprint((A[k - 1]))\n", "code_v1_no_empty_lines": "S = input()\nl = len(S)\nd = set()\nK = int(input())\nfor i in range(5):\n for j in range(l - i):\n d.add(S[j : j + i + 1])\nD = sorted(list(d))\nprint((D[K - 1]))\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-k = int(input())", "-A = set()", "-for l in range(k + 1):", "- for i in range(len(S) - l):", "- A.add(S[i : i + l + 1])", "-A = sorted(list(A))", "-print((A[k - 1]))", "+l = len(S)", "+d = set()", "+K = int(input())", "+for i in range(5):", "+ for j in range(l - i):", "+ d.add(S[j : j + i + 1])", "+D = sorted(list(d))", "+print((D[K - 1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2549800012, "measured_runtime_v1": 0.1151928709, "runtime_lift": 2.2135050485, "key": ["s703764972", "s575406884"]} +{"user_id": "u047796752", "problem_id": "p02693", "language": "python", "submission_id_v0": "s690438210", "submission_id_v1": "s726211396", "cpu_time_v0": 69, "cpu_time_v1": 61, "memory_v0": 64680, "memory_v1": 61880, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.59, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nK = int(input())\n\nA, B = list(map(int, input().split()))\n\n\n\nfor i in range(A, B+1):\n\n if i%K==0:\n\n print('OK')\n\n exit()\n\n \n\nprint('NG')", "target": "K = int(input())\n\nA, B = list(map(int, input().split()))\n\n\n\nif (A-1)//K!=B//K:\n\n print('OK')\n\nelse:\n\n print('NG')", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 218, "code_v1_num_chars": 113, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\nK = int(input())\nA, B = list(map(int, input().split()))\nfor i in range(A, B + 1):\n if i % K == 0:\n print(\"OK\")\n exit()\nprint(\"NG\")\n", "code_v1_no_empty_lines": "K = int(input())\nA, B = list(map(int, input().split()))\nif (A - 1) // K != B // K:\n print(\"OK\")\nelse:\n print(\"NG\")\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-from collections import *", "-", "-for i in range(A, B + 1):", "- if i % K == 0:", "- print(\"OK\")", "- exit()", "-print(\"NG\")", "+if (A - 1) // K != B // K:", "+ print(\"OK\")", "+else:", "+ print(\"NG\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2312573931, "measured_runtime_v1": 0.006134352, "runtime_lift": 37.6987486082, "key": ["s690438210", "s726211396"]} +{"user_id": "u803848678", "problem_id": "p03558", "language": "python", "submission_id_v0": "s650935446", "submission_id_v1": "s013593877", "cpu_time_v0": 647, "cpu_time_v1": 206, "memory_v0": 80204, "memory_v1": 46940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 68.16, "input": "from heapq import heappush, heappop\n\nk = int(input())\n\n\n\nheap = [(1,1)]\n\ndist = [float(\"inf\")]*k\n\nwhile heap:\n\n cost, cur = heappop(heap)\n\n if dist[cur] <= cost:\n\n continue\n\n dist[cur] = cost\n\n # +1\n\n nxt = (cur+1)%k\n\n heappush(heap, (cost+1, nxt))\n\n # *10\n\n nxt = cur*10 % k\n\n heappush(heap, (cost, nxt))\n\n\n\nprint((dist[0]))", "target": "from collections import deque\n\nk = int(input())\n\n\n\nque = deque()\n\nque.append((1,1))\n\ndist = [float(\"inf\")]*k\n\nwhile que:\n\n cost, cur = que.popleft()\n\n if dist[cur] <= cost:\n\n continue\n\n dist[cur] = cost\n\n # +1\n\n nxt = (cur+1)%k\n\n que.append((cost+1,nxt))\n\n # *10\n\n nxt = cur*10 % k\n\n que.appendleft((cost, nxt))\n\nprint((dist[0]))", "code_v0_loc": 18, "code_v1_loc": 18, "code_v0_num_chars": 357, "code_v1_num_chars": 361, "code_v0_no_empty_lines": "from heapq import heappush, heappop\n\nk = int(input())\nheap = [(1, 1)]\ndist = [float(\"inf\")] * k\nwhile heap:\n cost, cur = heappop(heap)\n if dist[cur] <= cost:\n continue\n dist[cur] = cost\n # +1\n nxt = (cur + 1) % k\n heappush(heap, (cost + 1, nxt))\n # *10\n nxt = cur * 10 % k\n heappush(heap, (cost, nxt))\nprint((dist[0]))\n", "code_v1_no_empty_lines": "from collections import deque\n\nk = int(input())\nque = deque()\nque.append((1, 1))\ndist = [float(\"inf\")] * k\nwhile que:\n cost, cur = que.popleft()\n if dist[cur] <= cost:\n continue\n dist[cur] = cost\n # +1\n nxt = (cur + 1) % k\n que.append((cost + 1, nxt))\n # *10\n nxt = cur * 10 % k\n que.appendleft((cost, nxt))\nprint((dist[0]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-from heapq import heappush, heappop", "+from collections import deque", "-heap = [(1, 1)]", "+que = deque()", "+que.append((1, 1))", "-while heap:", "- cost, cur = heappop(heap)", "+while que:", "+ cost, cur = que.popleft()", "- heappush(heap, (cost + 1, nxt))", "+ que.append((cost + 1, nxt))", "- heappush(heap, (cost, nxt))", "+ que.appendleft((cost, nxt))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7778599041, "measured_runtime_v1": 0.4842932501, "runtime_lift": 1.6061753987, "key": ["s650935446", "s013593877"]} +{"user_id": "u853010060", "problem_id": "p02921", "language": "python", "submission_id_v0": "s066833687", "submission_id_v1": "s453964878", "cpu_time_v0": 21, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.05, "input": "S = input()\n\nT = input()\n\n\n\nl = len(S)\n\nres = 0\n\nfor n in range(l):\n\n if S[n] == T[n]:\n\n res += 1\n\nprint(res)", "target": "S = input()\n\nT = input()\n\nl = len(S)\n\nans = 0\n\nfor n in range(l):\n\n if S[n] == T[n]:\n\n ans += 1\n\nprint(ans)\n", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 119, "code_v1_num_chars": 118, "code_v0_no_empty_lines": "S = input()\nT = input()\nl = len(S)\nres = 0\nfor n in range(l):\n if S[n] == T[n]:\n res += 1\nprint(res)\n", "code_v1_no_empty_lines": "S = input()\nT = input()\nl = len(S)\nans = 0\nfor n in range(l):\n if S[n] == T[n]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-res = 0", "+ans = 0", "- res += 1", "-print(res)", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3049550076, "measured_runtime_v1": 0.2412325363, "runtime_lift": 1.2641537174, "key": ["s066833687", "s453964878"]} +{"user_id": "u884323674", "problem_id": "p03371", "language": "python", "submission_id_v0": "s486102959", "submission_id_v1": "s507293588", "cpu_time_v0": 228, "cpu_time_v1": 129, "memory_v0": 3064, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.42, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nmax_iter = max(X, Y) * 2\n\nans = float(\"inf\")\n\nfor i in range(max_iter):\n\n a = max(X - i, 0)\n\n b = max(Y - i, 0)\n\n price = 2*C * i + A * a + B * b\n\n ans = min(ans, price)\n\n\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float(\"inf\")\n\nfor i in range(max(X, Y)+1):\n\n x = max(X - i, 0)\n\n y = max(Y - i, 0)\n\n cost = 2*C * i + A * x + B * y\n\n ans = min(ans, cost)\n\n\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 240, "code_v1_num_chars": 215, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nmax_iter = max(X, Y) * 2\nans = float(\"inf\")\nfor i in range(max_iter):\n a = max(X - i, 0)\n b = max(Y - i, 0)\n price = 2 * C * i + A * a + B * b\n ans = min(ans, price)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(max(X, Y) + 1):\n x = max(X - i, 0)\n y = max(Y - i, 0)\n cost = 2 * C * i + A * x + B * y\n ans = min(ans, cost)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-max_iter = max(X, Y) * 2", "-for i in range(max_iter):", "- a = max(X - i, 0)", "- b = max(Y - i, 0)", "- price = 2 * C * i + A * a + B * b", "- ans = min(ans, price)", "+for i in range(max(X, Y) + 1):", "+ x = max(X - i, 0)", "+ y = max(Y - i, 0)", "+ cost = 2 * C * i + A * x + B * y", "+ ans = min(ans, cost)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4454369638, "measured_runtime_v1": 0.3371012073, "runtime_lift": 1.321374573, "key": ["s486102959", "s507293588"]} +{"user_id": "u020390084", "problem_id": "p03309", "language": "python", "submission_id_v0": "s289814925", "submission_id_v1": "s781437429", "cpu_time_v0": 334, "cpu_time_v1": 258, "memory_v0": 27244, "memory_v1": 36640, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.75, "input": "import math\n\nimport statistics\n\nn = int(input())\n\na = list(map(int,input().split()))\n\na = [aa-i-1 for i, aa in enumerate(a)]\n\nanswer = n*10**20\n\nmedian_low = statistics.median_low(a)\n\nmedian_high = statistics.median_high(a)\n\n\n\nfor m in (median_low,median_high):\n\n ans=0\n\n for aa in a:\n\n ans += abs(aa-m)\n\n answer = min(ans,answer)\n\nprint(answer)\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\n\n\n\n\ndef solve(N: int, A: \"List[int]\"):\n\n difA = [0]*N\n\n\n\n for i in range(N):\n\n difA[i] = A[i]-(i+1)\n\n\n\n difA.sort()\n\n if N%2 == 0:\n\n g1 = difA[N//2]\n\n g2 = difA[N//2-1]\n\n a1 = 0\n\n a2 = 0\n\n for i in range(N):\n\n a1 += abs(difA[i]-g1)\n\n a2 += abs(difA[i]-g2)\n\n print((min(a1,a2)))\n\n \n\n else:\n\n g = difA[N//2]\n\n a = 0\n\n for i in range(N):\n\n a += abs(difA[i]-g)\n\n print(a)\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, A)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 15, "code_v1_loc": 42, "code_v0_num_chars": 352, "code_v1_num_chars": 891, "code_v0_no_empty_lines": "import math\nimport statistics\n\nn = int(input())\na = list(map(int, input().split()))\na = [aa - i - 1 for i, aa in enumerate(a)]\nanswer = n * 10**20\nmedian_low = statistics.median_low(a)\nmedian_high = statistics.median_high(a)\nfor m in (median_low, median_high):\n ans = 0\n for aa in a:\n ans += abs(aa - m)\n answer = min(ans, answer)\nprint(answer)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int, A: \"List[int]\"):\n difA = [0] * N\n for i in range(N):\n difA[i] = A[i] - (i + 1)\n difA.sort()\n if N % 2 == 0:\n g1 = difA[N // 2]\n g2 = difA[N // 2 - 1]\n a1 = 0\n a2 = 0\n for i in range(N):\n a1 += abs(difA[i] - g1)\n a2 += abs(difA[i] - g2)\n print((min(a1, a2)))\n else:\n g = difA[N // 2]\n a = 0\n for i in range(N):\n a += abs(difA[i] - g)\n print(a)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, A)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 64.2857142857, "diff": ["-import math", "-import statistics", "+#!/usr/bin/env python3", "+import sys", "-n = int(input())", "-a = list(map(int, input().split()))", "-a = [aa - i - 1 for i, aa in enumerate(a)]", "-answer = n * 10**20", "-median_low = statistics.median_low(a)", "-median_high = statistics.median_high(a)", "-for m in (median_low, median_high):", "- ans = 0", "- for aa in a:", "- ans += abs(aa - m)", "- answer = min(ans, answer)", "-print(answer)", "+", "+def solve(N: int, A: \"List[int]\"):", "+ difA = [0] * N", "+ for i in range(N):", "+ difA[i] = A[i] - (i + 1)", "+ difA.sort()", "+ if N % 2 == 0:", "+ g1 = difA[N // 2]", "+ g2 = difA[N // 2 - 1]", "+ a1 = 0", "+ a2 = 0", "+ for i in range(N):", "+ a1 += abs(difA[i] - g1)", "+ a2 += abs(difA[i] - g2)", "+ print((min(a1, a2)))", "+ else:", "+ g = difA[N // 2]", "+ a = 0", "+ for i in range(N):", "+ a += abs(difA[i] - g)", "+ print(a)", "+ return", "+", "+", "+def main():", "+ def iterate_tokens():", "+ for line in sys.stdin:", "+ for word in line.split():", "+ yield word", "+", "+ tokens = iterate_tokens()", "+ N = int(next(tokens)) # type: int", "+ A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"", "+ solve(N, A)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2912476273, "measured_runtime_v1": 0.217194303, "runtime_lift": 1.3409542662, "key": ["s289814925", "s781437429"]} +{"user_id": "u982896977", "problem_id": "p03371", "language": "python", "submission_id_v0": "s299972417", "submission_id_v1": "s929413776", "cpu_time_v0": 102, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.33, "input": "a,b,c,x,y = list(map(int,input().split()))\n\nans = a*x + b*y\n\nfor i in range(max(x,y) + 1):\n\n\tmoney = max(0,(x-i)*a) + max(0,(y-i)*b) + 2*i*c\n\n\tif money <= ans:\n\n\t\tans = money\n\nprint(ans)", "target": "a,b,c,x,y = list(map(int,input().split()))\n\nif a + b >= 2*c:\n\n\tif x >= y:\n\n\t\tans = 2*y*c + (x-y)*min(a,2*c)\n\n\telse:\n\n\t\tans = 2*x*c + (y-x)*min(b,2*c)\n\nelse:\n\n\tans = (x*a + y*b)\n\nprint(ans)", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 180, "code_v1_num_chars": 182, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nfor i in range(max(x, y) + 1):\n money = max(0, (x - i) * a) + max(0, (y - i) * b) + 2 * i * c\n if money <= ans:\n ans = money\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nif a + b >= 2 * c:\n if x >= y:\n ans = 2 * y * c + (x - y) * min(a, 2 * c)\n else:\n ans = 2 * x * c + (y - x) * min(b, 2 * c)\nelse:\n ans = x * a + y * b\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-ans = a * x + b * y", "-for i in range(max(x, y) + 1):", "- money = max(0, (x - i) * a) + max(0, (y - i) * b) + 2 * i * c", "- if money <= ans:", "- ans = money", "+if a + b >= 2 * c:", "+ if x >= y:", "+ ans = 2 * y * c + (x - y) * min(a, 2 * c)", "+ else:", "+ ans = 2 * x * c + (y - x) * min(b, 2 * c)", "+else:", "+ ans = x * a + y * b"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3295188012, "measured_runtime_v1": 0.2310098734, "runtime_lift": 1.4264273486, "key": ["s299972417", "s929413776"]} +{"user_id": "u340781749", "problem_id": "p02680", "language": "python", "submission_id_v0": "s341076610", "submission_id_v1": "s034276815", "cpu_time_v0": 2314, "cpu_time_v1": 1930, "memory_v0": 1000052, "memory_v1": 915508, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.59, "input": "import sys\n\n# from itertools import chain, accumulate\n\n\n\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\n\n\n\nver_lines = []\n\nhor_lines = []\n\nx_list = set()\n\ny_list = set()\n\nn3 = n * 3\n\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n\n y_list.add(a)\n\n y_list.add(b)\n\n x_list.add(c)\n\n ver_lines.append((a, b, c))\n\n\n\nfor d, e, f in zip(abcdef[n3 + 0::3], abcdef[n3 + 1::3], abcdef[n3 + 2::3]):\n\n y_list.add(d)\n\n x_list.add(e)\n\n x_list.add(f)\n\n hor_lines.append((d, e, f))\n\nx_list.add(0)\n\ny_list.add(0)\n\n\n\nx_list = sorted(x_list)\n\ny_list = sorted(y_list)\n\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\n\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\n\nrow_real = len(x_list)\n\ncol_real = len(y_list)\n\nrow = row_real + 2\n\ncol = col_real + 2\n\nbanned_up_ij = [[0] * row for _ in range(col)]\n\nbanned_down_ij = [[0] * row for _ in range(col)]\n\nbanned_left_ij = [[0] * col for _ in range(row)]\n\nbanned_right_ij = [[0] * col for _ in range(row)]\n\nfor a, b, c in ver_lines:\n\n if a > b:\n\n a, b = b, a\n\n ai = y_dict[a]\n\n bi = y_dict[b]\n\n j = x_dict[c]\n\n banned_left_ij[j][ai] += 1\n\n banned_left_ij[j][bi] -= 1\n\n banned_right_ij[j - 1][ai] += 1\n\n banned_right_ij[j - 1][bi] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n i = y_dict[d]\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up_ij[i][ej] += 1\n\n banned_up_ij[i][fj] -= 1\n\n banned_down_ij[i - 1][ej] += 1\n\n banned_down_ij[i - 1][fj] -= 1\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor i in range(col):\n\n ru = banned_up_ij[i]\n\n rd = banned_down_ij[i]\n\n ri = row * i\n\n banned_up[ri] = ru[0]\n\n banned_down[ri] = rd[0]\n\n for j in range(1, row):\n\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\n\nfor j in range(row):\n\n rl = banned_left_ij[j]\n\n rr = banned_right_ij[j]\n\n banned_left[j] = rl[0]\n\n banned_right[j] = rr[0]\n\n for i in range(1, col):\n\n ri0 = (i - 1) * row\n\n ri1 = i * row\n\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n", "target": "import sys\n\n\n\n# from itertools import chain, accumulate\n\n\n\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\n\n\n\nver_lines = []\n\nhor_lines = []\n\nx_list = set()\n\ny_list = set()\n\nn3 = n * 3\n\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n\n y_list.add(a)\n\n y_list.add(b)\n\n x_list.add(c)\n\n ver_lines.append((a, b, c))\n\n\n\nfor d, e, f in zip(abcdef[n3 + 0::3], abcdef[n3 + 1::3], abcdef[n3 + 2::3]):\n\n y_list.add(d)\n\n x_list.add(e)\n\n x_list.add(f)\n\n hor_lines.append((d, e, f))\n\nx_list.add(0)\n\ny_list.add(0)\n\n\n\nx_list = sorted(x_list)\n\ny_list = sorted(y_list)\n\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\n\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\n\nrow_real = len(x_list)\n\ncol_real = len(y_list)\n\nrow = row_real + 2\n\ncol = col_real + 2\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor a, b, c in ver_lines:\n\n if a > b:\n\n a, b = b, a\n\n ai = y_dict[a] * row\n\n bi = y_dict[b] * row\n\n j = x_dict[c]\n\n banned_left[ai + j] += 1\n\n banned_left[bi + j] -= 1\n\n banned_right[ai + j - 1] += 1\n\n banned_right[bi + j - 1] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n ri = y_dict[d] * row\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up[ri + ej] += 1\n\n banned_up[ri + fj] -= 1\n\n banned_down[ri - row + ej] += 1\n\n banned_down[ri - row + fj] -= 1\n\n\n\nfor i in range(1, col):\n\n ri0 = row * (i - 1)\n\n ri1 = row * i\n\n for j in range(1, row):\n\n banned_up[ri1 + j] += banned_up[ri1 + j - 1]\n\n banned_down[ri1 + j] += banned_down[ri1 + j - 1]\n\n banned_left[ri1 + j] += banned_left[ri0 + j]\n\n banned_right[ri1 + j] += banned_right[ri0 + j]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n", "code_v0_loc": 128, "code_v1_loc": 115, "code_v0_num_chars": 3630, "code_v1_num_chars": 3124, "code_v0_no_empty_lines": "import sys\n\n# from itertools import chain, accumulate\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\nver_lines = []\nhor_lines = []\nx_list = set()\ny_list = set()\nn3 = n * 3\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n y_list.add(a)\n y_list.add(b)\n x_list.add(c)\n ver_lines.append((a, b, c))\nfor d, e, f in zip(abcdef[n3 + 0 :: 3], abcdef[n3 + 1 :: 3], abcdef[n3 + 2 :: 3]):\n y_list.add(d)\n x_list.add(e)\n x_list.add(f)\n hor_lines.append((d, e, f))\nx_list.add(0)\ny_list.add(0)\nx_list = sorted(x_list)\ny_list = sorted(y_list)\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\nrow_real = len(x_list)\ncol_real = len(y_list)\nrow = row_real + 2\ncol = col_real + 2\nbanned_up_ij = [[0] * row for _ in range(col)]\nbanned_down_ij = [[0] * row for _ in range(col)]\nbanned_left_ij = [[0] * col for _ in range(row)]\nbanned_right_ij = [[0] * col for _ in range(row)]\nfor a, b, c in ver_lines:\n if a > b:\n a, b = b, a\n ai = y_dict[a]\n bi = y_dict[b]\n j = x_dict[c]\n banned_left_ij[j][ai] += 1\n banned_left_ij[j][bi] -= 1\n banned_right_ij[j - 1][ai] += 1\n banned_right_ij[j - 1][bi] -= 1\nfor d, e, f in hor_lines:\n if e > f:\n e, f = f, e\n i = y_dict[d]\n ej = x_dict[e]\n fj = x_dict[f]\n banned_up_ij[i][ej] += 1\n banned_up_ij[i][fj] -= 1\n banned_down_ij[i - 1][ej] += 1\n banned_down_ij[i - 1][fj] -= 1\nbanned_up = [0] * (row * col)\nbanned_down = [0] * (row * col)\nbanned_left = [0] * (row * col)\nbanned_right = [0] * (row * col)\nfor i in range(col):\n ru = banned_up_ij[i]\n rd = banned_down_ij[i]\n ri = row * i\n banned_up[ri] = ru[0]\n banned_down[ri] = rd[0]\n for j in range(1, row):\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\nfor j in range(row):\n rl = banned_left_ij[j]\n rr = banned_right_ij[j]\n banned_left[j] = rl[0]\n banned_right[j] = rr[0]\n for i in range(1, col):\n ri0 = (i - 1) * row\n ri1 = i * row\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n# for i in range(col):\n# print(walls[i * row:(i + 1) * row])\ns = row * y_dict[0] + x_dict[0]\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nq = [s]\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\nwhile q:\n c = q.pop()\n if enable[c] == 1:\n continue\n elif enable[c] == -1:\n print(\"INF\")\n exit()\n enable[c] = 1\n for dc, banned in moves:\n if banned[c]:\n continue\n nc = c + dc\n if enable[nc] == 1:\n continue\n q.append(nc)\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nans = 0\nfor i in range(col):\n ri = i * row\n for j in range(row):\n if enable[ri + j] != 1:\n continue\n t = y_list[i - 1]\n b = y_list[i]\n l = x_list[j - 1]\n r = x_list[j]\n ans += (b - t) * (r - l)\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\n# from itertools import chain, accumulate\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\nver_lines = []\nhor_lines = []\nx_list = set()\ny_list = set()\nn3 = n * 3\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n y_list.add(a)\n y_list.add(b)\n x_list.add(c)\n ver_lines.append((a, b, c))\nfor d, e, f in zip(abcdef[n3 + 0 :: 3], abcdef[n3 + 1 :: 3], abcdef[n3 + 2 :: 3]):\n y_list.add(d)\n x_list.add(e)\n x_list.add(f)\n hor_lines.append((d, e, f))\nx_list.add(0)\ny_list.add(0)\nx_list = sorted(x_list)\ny_list = sorted(y_list)\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\nrow_real = len(x_list)\ncol_real = len(y_list)\nrow = row_real + 2\ncol = col_real + 2\nbanned_up = [0] * (row * col)\nbanned_down = [0] * (row * col)\nbanned_left = [0] * (row * col)\nbanned_right = [0] * (row * col)\nfor a, b, c in ver_lines:\n if a > b:\n a, b = b, a\n ai = y_dict[a] * row\n bi = y_dict[b] * row\n j = x_dict[c]\n banned_left[ai + j] += 1\n banned_left[bi + j] -= 1\n banned_right[ai + j - 1] += 1\n banned_right[bi + j - 1] -= 1\nfor d, e, f in hor_lines:\n if e > f:\n e, f = f, e\n ri = y_dict[d] * row\n ej = x_dict[e]\n fj = x_dict[f]\n banned_up[ri + ej] += 1\n banned_up[ri + fj] -= 1\n banned_down[ri - row + ej] += 1\n banned_down[ri - row + fj] -= 1\nfor i in range(1, col):\n ri0 = row * (i - 1)\n ri1 = row * i\n for j in range(1, row):\n banned_up[ri1 + j] += banned_up[ri1 + j - 1]\n banned_down[ri1 + j] += banned_down[ri1 + j - 1]\n banned_left[ri1 + j] += banned_left[ri0 + j]\n banned_right[ri1 + j] += banned_right[ri0 + j]\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n# for i in range(col):\n# print(walls[i * row:(i + 1) * row])\ns = row * y_dict[0] + x_dict[0]\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nq = [s]\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\nwhile q:\n c = q.pop()\n if enable[c] == 1:\n continue\n elif enable[c] == -1:\n print(\"INF\")\n exit()\n enable[c] = 1\n for dc, banned in moves:\n if banned[c]:\n continue\n nc = c + dc\n if enable[nc] == 1:\n continue\n q.append(nc)\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nans = 0\nfor i in range(col):\n ri = i * row\n for j in range(row):\n if enable[ri + j] != 1:\n continue\n t = y_list[i - 1]\n b = y_list[i]\n l = x_list[j - 1]\n r = x_list[j]\n ans += (b - t) * (r - l)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 10.15625, "diff": ["-banned_up_ij = [[0] * row for _ in range(col)]", "-banned_down_ij = [[0] * row for _ in range(col)]", "-banned_left_ij = [[0] * col for _ in range(row)]", "-banned_right_ij = [[0] * col for _ in range(row)]", "-for a, b, c in ver_lines:", "- if a > b:", "- a, b = b, a", "- ai = y_dict[a]", "- bi = y_dict[b]", "- j = x_dict[c]", "- banned_left_ij[j][ai] += 1", "- banned_left_ij[j][bi] -= 1", "- banned_right_ij[j - 1][ai] += 1", "- banned_right_ij[j - 1][bi] -= 1", "-for d, e, f in hor_lines:", "- if e > f:", "- e, f = f, e", "- i = y_dict[d]", "- ej = x_dict[e]", "- fj = x_dict[f]", "- banned_up_ij[i][ej] += 1", "- banned_up_ij[i][fj] -= 1", "- banned_down_ij[i - 1][ej] += 1", "- banned_down_ij[i - 1][fj] -= 1", "-for i in range(col):", "- ru = banned_up_ij[i]", "- rd = banned_down_ij[i]", "- ri = row * i", "- banned_up[ri] = ru[0]", "- banned_down[ri] = rd[0]", "+for a, b, c in ver_lines:", "+ if a > b:", "+ a, b = b, a", "+ ai = y_dict[a] * row", "+ bi = y_dict[b] * row", "+ j = x_dict[c]", "+ banned_left[ai + j] += 1", "+ banned_left[bi + j] -= 1", "+ banned_right[ai + j - 1] += 1", "+ banned_right[bi + j - 1] -= 1", "+for d, e, f in hor_lines:", "+ if e > f:", "+ e, f = f, e", "+ ri = y_dict[d] * row", "+ ej = x_dict[e]", "+ fj = x_dict[f]", "+ banned_up[ri + ej] += 1", "+ banned_up[ri + fj] -= 1", "+ banned_down[ri - row + ej] += 1", "+ banned_down[ri - row + fj] -= 1", "+for i in range(1, col):", "+ ri0 = row * (i - 1)", "+ ri1 = row * i", "- banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]", "- banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]", "-for j in range(row):", "- rl = banned_left_ij[j]", "- rr = banned_right_ij[j]", "- banned_left[j] = rl[0]", "- banned_right[j] = rr[0]", "- for i in range(1, col):", "- ri0 = (i - 1) * row", "- ri1 = i * row", "- banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]", "- banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]", "+ banned_up[ri1 + j] += banned_up[ri1 + j - 1]", "+ banned_down[ri1 + j] += banned_down[ri1 + j - 1]", "+ banned_left[ri1 + j] += banned_left[ri0 + j]", "+ banned_right[ri1 + j] += banned_right[ri0 + j]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2846495706, "measured_runtime_v1": 0.092071644, "runtime_lift": 3.0916095148, "key": ["s341076610", "s034276815"]} +{"user_id": "u476068053", "problem_id": "p02555", "language": "python", "submission_id_v0": "s269976358", "submission_id_v1": "s000228897", "cpu_time_v0": 91, "cpu_time_v1": 66, "memory_v0": 64552, "memory_v1": 62952, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.47, "input": "def main():\n\n s = int(input())\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n for i in range(1, s+1):\n\n for j in range(0, (i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "def main():\n\n s = int(input())\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n# for i in range(1, s+1):\n\n# for j in range(0, (i-3)+1):\n\n# dp[i] += dp[j]\n\n# dp[i] %= mod\n\n for i in range(1, s+1):\n\n if i < 3:\n\n dp[i] = 0\n\n else:\n\n dp[i] = dp[i-1] + dp[i-3]\n\n dp[i] %= mod\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 15, "code_v1_loc": 22, "code_v0_num_chars": 277, "code_v1_num_chars": 434, "code_v0_no_empty_lines": "def main():\n s = int(input())\n mod = 10**9 + 7\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(1, s + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n s = int(input())\n mod = 10**9 + 7\n dp = [0] * (s + 1)\n dp[0] = 1\n # for i in range(1, s+1):\n # for j in range(0, (i-3)+1):\n # dp[i] += dp[j]\n # dp[i] %= mod\n for i in range(1, s + 1):\n if i < 3:\n dp[i] = 0\n else:\n dp[i] = dp[i - 1] + dp[i - 3]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 31.8181818182, "diff": ["+ # for i in range(1, s+1):", "+ # for j in range(0, (i-3)+1):", "+ # dp[i] += dp[j]", "+ # dp[i] %= mod", "- for j in range(0, (i - 3) + 1):", "- dp[i] += dp[j]", "+ if i < 3:", "+ dp[i] = 0", "+ else:", "+ dp[i] = dp[i - 1] + dp[i - 3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5094247258, "measured_runtime_v1": 0.2087815866, "runtime_lift": 2.4399887649, "key": ["s269976358", "s000228897"]} +{"user_id": "u753803401", "problem_id": "p03078", "language": "python", "submission_id_v0": "s362357786", "submission_id_v1": "s175109634", "cpu_time_v0": 451, "cpu_time_v1": 323, "memory_v0": 62572, "memory_v1": 53208, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.38, "input": "def slove():\n\n import sys\n\n import heapq\n\n import collections\n\n input = sys.stdin.readline\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n b.sort(reverse=True)\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n c.sort(reverse=True)\n\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(q)\n\n fq = collections.defaultdict(list)\n\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n\n t = 0\n\n for _ in range(k):\n\n if len(q) != 0:\n\n p = heapq.heappop(q)\n\n t = p[0]\n\n aq = p[1]\n\n bq = p[2]\n\n cq = p[3]\n\n if aq + 1 < len(a):\n\n if (-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq])\n\n fq[(-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq)] = 1\n\n if bq + 1 < len(b):\n\n if (-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq])\n\n fq[(-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq)] = 1\n\n if cq + 1 < len(c):\n\n if (-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1])\n\n fq[(-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1)] = 1\n\n print((-t))\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n", "target": "import sys\n\nimport collections\n\nimport heapq\n\n\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n mod = 10 ** 9 + 7\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b.sort(reverse=True)\n\n c.sort(reverse=True)\n\n ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(ql)\n\n fq = collections.defaultdict(int)\n\n fq[0, 0, 0]\n\n for i in range(k):\n\n s, ap, bp, cp = heapq.heappop(ql)\n\n for app, bpp, cpp in ([[ap+1, bp, cp], [ap, bp+1, cp], [ap, bp, cp+1]]):\n\n if app < x and bpp < y and cpp < z:\n\n if (app, bpp, cpp) not in fq:\n\n heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])\n\n fq[app, bpp, cpp]\n\n print((-s))\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "code_v0_loc": 41, "code_v1_loc": 31, "code_v0_num_chars": 1596, "code_v1_num_chars": 979, "code_v0_no_empty_lines": "def slove():\n import sys\n import heapq\n import collections\n\n input = sys.stdin.readline\n x, y, z, k = list(map(int, input().rstrip(\"\\n\").split()))\n a = list(map(int, input().rstrip(\"\\n\").split()))\n a.sort(reverse=True)\n b = list(map(int, input().rstrip(\"\\n\").split()))\n b.sort(reverse=True)\n c = list(map(int, input().rstrip(\"\\n\").split()))\n c.sort(reverse=True)\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n heapq.heapify(q)\n fq = collections.defaultdict(list)\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n t = 0\n for _ in range(k):\n if len(q) != 0:\n p = heapq.heappop(q)\n t = p[0]\n aq = p[1]\n bq = p[2]\n cq = p[3]\n if aq + 1 < len(a):\n if (-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq) not in fq:\n heapq.heappush(q, [-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq])\n fq[(-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq)] = 1\n if bq + 1 < len(b):\n if (-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq) not in fq:\n heapq.heappush(q, [-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq])\n fq[(-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq)] = 1\n if cq + 1 < len(c):\n if (-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1) not in fq:\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1])\n fq[(-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1)] = 1\n print((-t))\n\n\nif __name__ == \"__main__\":\n slove()\n", "code_v1_no_empty_lines": "import sys\nimport collections\nimport heapq\n\n\ndef solve():\n input = sys.stdin.readline\n mod = 10**9 + 7\n x, y, z, k = list(map(int, input().rstrip(\"\\n\").split()))\n a = list(map(int, input().rstrip(\"\\n\").split()))\n b = list(map(int, input().rstrip(\"\\n\").split()))\n c = list(map(int, input().rstrip(\"\\n\").split()))\n a.sort(reverse=True)\n b.sort(reverse=True)\n c.sort(reverse=True)\n ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n heapq.heapify(ql)\n fq = collections.defaultdict(int)\n fq[0, 0, 0]\n for i in range(k):\n s, ap, bp, cp = heapq.heappop(ql)\n for app, bpp, cpp in [[ap + 1, bp, cp], [ap, bp + 1, cp], [ap, bp, cp + 1]]:\n if app < x and bpp < y and cpp < z:\n if (app, bpp, cpp) not in fq:\n heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])\n fq[app, bpp, cpp]\n print((-s))\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 24.3902439024, "diff": ["-def slove():", "- import sys", "- import heapq", "- import collections", "+import sys", "+import collections", "+import heapq", "+", "+def solve():", "+ mod = 10**9 + 7", "+ b = list(map(int, input().rstrip(\"\\n\").split()))", "+ c = list(map(int, input().rstrip(\"\\n\").split()))", "- b = list(map(int, input().rstrip(\"\\n\").split()))", "- c = list(map(int, input().rstrip(\"\\n\").split()))", "- q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]", "- heapq.heapify(q)", "- fq = collections.defaultdict(list)", "- fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1", "- t = 0", "- for _ in range(k):", "- if len(q) != 0:", "- p = heapq.heappop(q)", "- t = p[0]", "- aq = p[1]", "- bq = p[2]", "- cq = p[3]", "- if aq + 1 < len(a):", "- if (-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq) not in fq:", "- heapq.heappush(q, [-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq])", "- fq[(-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq)] = 1", "- if bq + 1 < len(b):", "- if (-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq) not in fq:", "- heapq.heappush(q, [-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq])", "- fq[(-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq)] = 1", "- if cq + 1 < len(c):", "- if (-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1) not in fq:", "- heapq.heappush(q, [-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1])", "- fq[(-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1)] = 1", "- print((-t))", "+ ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]", "+ heapq.heapify(ql)", "+ fq = collections.defaultdict(int)", "+ fq[0, 0, 0]", "+ for i in range(k):", "+ s, ap, bp, cp = heapq.heappop(ql)", "+ for app, bpp, cpp in [[ap + 1, bp, cp], [ap, bp + 1, cp], [ap, bp, cp + 1]]:", "+ if app < x and bpp < y and cpp < z:", "+ if (app, bpp, cpp) not in fq:", "+ heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])", "+ fq[app, bpp, cpp]", "+ print((-s))", "- slove()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3093440776, "measured_runtime_v1": 0.1565137908, "runtime_lift": 1.9764653063, "key": ["s362357786", "s175109634"]} +{"user_id": "u546285759", "problem_id": "p00500", "language": "python", "submission_id_v0": "s199562246", "submission_id_v1": "s512442556", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7644, "memory_v1": 7672, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "N = int(input())\n\nscore = [list(map(int, input().split())) for _ in range(N)]\n\nplayers = [0 for _ in range(N)]\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += p\n\nprint(*players, sep='\\n')\n", "target": "N = int(input())\n\nscore = [input().split() for _ in range(N)]\n\nplayers = [0]*N\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += int(p)\n\nprint(*players, sep='\\n')\n", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 264, "code_v1_num_chars": 237, "code_v0_no_empty_lines": "N = int(input())\nscore = [list(map(int, input().split())) for _ in range(N)]\nplayers = [0 for _ in range(N)]\nfor play in list(zip(*score)):\n for i, p in enumerate(play):\n if play.count(p) == 1:\n players[i] += p\nprint(*players, sep=\"\\n\")\n", "code_v1_no_empty_lines": "N = int(input())\nscore = [input().split() for _ in range(N)]\nplayers = [0] * N\nfor play in list(zip(*score)):\n for i, p in enumerate(play):\n if play.count(p) == 1:\n players[i] += int(p)\nprint(*players, sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-score = [list(map(int, input().split())) for _ in range(N)]", "-players = [0 for _ in range(N)]", "+score = [input().split() for _ in range(N)]", "+players = [0] * N", "- players[i] += p", "+ players[i] += int(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3026783457, "measured_runtime_v1": 0.2355215042, "runtime_lift": 1.2851410182, "key": ["s199562246", "s512442556"]} +{"user_id": "u419963262", "problem_id": "p03170", "language": "python", "submission_id_v0": "s690193516", "submission_id_v1": "s176737022", "cpu_time_v0": 1807, "cpu_time_v1": 395, "memory_v0": 3828, "memory_v1": 43416, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.14, "input": "n,k = list(map(int,input().split()))\n\narr = list(map(int,input().split()))\n\n\n\ndp = [False]*(k+1)\n\n\n\nfor stones in range(k+1):\n\n for x in arr:\n\n if stones >= x and dp[stones-x] == False:\n\n dp[stones] = True\n\n\n\nif dp[k]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")\n", "target": "N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\n\n\ndp = [False]*(K+1)\n\n\n\nfor i in range(K+1):\n\n for j in range(N):\n\n if i-A[j]>=0 and dp[i-A[j]] == False:\n\n dp[i] = True\n\n\n\n \n\nif dp[K]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")", "code_v0_loc": 14, "code_v1_loc": 15, "code_v0_num_chars": 282, "code_v1_num_chars": 280, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\narr = list(map(int, input().split()))\ndp = [False] * (k + 1)\nfor stones in range(k + 1):\n for x in arr:\n if stones >= x and dp[stones - x] == False:\n dp[stones] = True\nif dp[k]:\n print(\"First\")\nelse:\n print(\"Second\")\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\ndp = [False] * (K + 1)\nfor i in range(K + 1):\n for j in range(N):\n if i - A[j] >= 0 and dp[i - A[j]] == False:\n dp[i] = True\nif dp[K]:\n print(\"First\")\nelse:\n print(\"Second\")\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["-n, k = list(map(int, input().split()))", "-arr = list(map(int, input().split()))", "-dp = [False] * (k + 1)", "-for stones in range(k + 1):", "- for x in arr:", "- if stones >= x and dp[stones - x] == False:", "- dp[stones] = True", "-if dp[k]:", "+N, K = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "+dp = [False] * (K + 1)", "+for i in range(K + 1):", "+ for j in range(N):", "+ if i - A[j] >= 0 and dp[i - A[j]] == False:", "+ dp[i] = True", "+if dp[K]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2082244466, "measured_runtime_v1": 0.0065503952, "runtime_lift": 31.7880739295, "key": ["s690193516", "s176737022"]} +{"user_id": "u579833671", "problem_id": "p02419", "language": "python", "submission_id_v0": "s913061371", "submission_id_v1": "s394956399", "cpu_time_v0": 20, "cpu_time_v1": 10, "memory_v0": 4220, "memory_v1": 4212, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "W = input().lower()\n\ns = []\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n s.append(T[i].lower())\n\nans = 0\n\nfor i in range(len(s)):\n\n if(s[i] == W):\n\n ans += 1\n\nprint(ans)", "target": "W = input().lower()\n\ns = []\n\nans = 0\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n if(W == T[i].lower()):\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 294, "code_v1_num_chars": 257, "code_v0_no_empty_lines": "W = input().lower()\ns = []\nwhile True:\n T = list(map(str, input().split()))\n if T[0] == \"END_OF_TEXT\":\n break\n else:\n for i in range(len(T)):\n s.append(T[i].lower())\nans = 0\nfor i in range(len(s)):\n if s[i] == W:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "W = input().lower()\ns = []\nans = 0\nwhile True:\n T = list(map(str, input().split()))\n if T[0] == \"END_OF_TEXT\":\n break\n else:\n for i in range(len(T)):\n if W == T[i].lower():\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["+ans = 0", "- s.append(T[i].lower())", "-ans = 0", "-for i in range(len(s)):", "- if s[i] == W:", "- ans += 1", "+ if W == T[i].lower():", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1894613738, "measured_runtime_v1": 0.0060594826, "runtime_lift": 31.2669227389, "key": ["s913061371", "s394956399"]} +{"user_id": "u919633157", "problem_id": "p03796", "language": "python", "submission_id_v0": "s593917202", "submission_id_v1": "s901232961", "cpu_time_v0": 230, "cpu_time_v1": 42, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.74, "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "target": "n=int(input())\n\nans=1\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans%=10**9+7\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 6, "code_v0_num_chars": 58, "code_v1_num_chars": 87, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= 10**9 + 7\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % (10**9 + 7)))", "+n = int(input())", "+ans = 1", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= 10**9 + 7", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9124054093, "measured_runtime_v1": 0.4053284261, "runtime_lift": 2.2510274398, "key": ["s593917202", "s901232961"]} +{"user_id": "u414980766", "problem_id": "p02773", "language": "python", "submission_id_v0": "s498649498", "submission_id_v1": "s794455280", "cpu_time_v0": 480, "cpu_time_v1": 421, "memory_v0": 47872, "memory_v1": 43256, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.29, "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nS = sorted(S)\n\nls = [[] for i in range(N + 1)]\n\nmax_num = 0\n\nleft = 0\n\nright = 0\n\nwhile right < N:\n\n while right < N and S[left] == S[right]:\n\n right += 1\n\n if (right - left) >= max_num:\n\n ls[right - left].append(S[left].decode())\n\n max_num = right - left\n\n left = right\n\n \n\nprint(('\\n'.join(ls[max_num])))\n", "target": "from collections import Counter\n\n\n\nimport sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nres = []\n\nc = Counter(S)\n\nmax_num = c.most_common(1)[0][1]\n\nfor i, j in list(c.items()):\n\n if j == max_num:\n\n res.append(i)\n\n \n\nres.sort()\n\n\n\n \n\nprint(('\\n'.join(list([x.decode() for x in res]))))\n", "code_v0_loc": 21, "code_v1_loc": 20, "code_v0_num_chars": 502, "code_v1_num_chars": 421, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nS = read().split()\nS = sorted(S)\nls = [[] for i in range(N + 1)]\nmax_num = 0\nleft = 0\nright = 0\nwhile right < N:\n while right < N and S[left] == S[right]:\n right += 1\n if (right - left) >= max_num:\n ls[right - left].append(S[left].decode())\n max_num = right - left\n left = right\nprint((\"\\n\".join(ls[max_num])))\n", "code_v1_no_empty_lines": "from collections import Counter\nimport sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nS = read().split()\nres = []\nc = Counter(S)\nmax_num = c.most_common(1)[0][1]\nfor i, j in list(c.items()):\n if j == max_num:\n res.append(i)\nres.sort()\nprint((\"\\n\".join(list([x.decode() for x in res]))))\n", "code_same": false, "relative_loc_diff_percent": 4.7619047619, "diff": ["+from collections import Counter", "-S = sorted(S)", "-ls = [[] for i in range(N + 1)]", "-max_num = 0", "-left = 0", "-right = 0", "-while right < N:", "- while right < N and S[left] == S[right]:", "- right += 1", "- if (right - left) >= max_num:", "- ls[right - left].append(S[left].decode())", "- max_num = right - left", "- left = right", "-print((\"\\n\".join(ls[max_num])))", "+res = []", "+c = Counter(S)", "+max_num = c.most_common(1)[0][1]", "+for i, j in list(c.items()):", "+ if j == max_num:", "+ res.append(i)", "+res.sort()", "+print((\"\\n\".join(list([x.decode() for x in res]))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2394288239, "measured_runtime_v1": 0.0062145643, "runtime_lift": 38.5270488971, "key": ["s498649498", "s794455280"]} +{"user_id": "u077291787", "problem_id": "p03164", "language": "python", "submission_id_v0": "s644346369", "submission_id_v1": "s649660252", "cpu_time_v0": 472, "cpu_time_v1": 351, "memory_v0": 93244, "memory_v1": 70732, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.64, "input": "# temp\n\nn,w = list(map(int,input().split()))\n\nwv = [tuple(map(int,input().split())) for i in range(n)]\n\n\n\ndp = [0] + [float(\"inf\")]*(10**5)\n\nfor i in range(n):\n\n for j in range(10**5,wv[i][1]-1,-1):\n\n dp[j] = min(dp[j],dp[j-wv[i][1]]+wv[i][0])\n\n\n\nres = 0\n\nfor v,e in enumerate(dp):\n\n if e <= w:\n\n res = v\n\nprint(res)", "target": "# dpE - Knapsack 2\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, W = tuple(map(int, input().rstrip().split()))\n\n A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))\n\n _, v = list(zip(*A))\n\n lim = sum(v)\n\n dp = [0] + [float(\"inf\")] * lim\n\n for i in range(n):\n\n for j in range(lim, A[i][1] - 1, -1):\n\n dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])\n\n ans = max(v for v, w in enumerate(dp) if w <= W)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 14, "code_v1_loc": 19, "code_v0_num_chars": 330, "code_v1_num_chars": 522, "code_v0_no_empty_lines": "# temp\nn, w = list(map(int, input().split()))\nwv = [tuple(map(int, input().split())) for i in range(n)]\ndp = [0] + [float(\"inf\")] * (10**5)\nfor i in range(n):\n for j in range(10**5, wv[i][1] - 1, -1):\n dp[j] = min(dp[j], dp[j - wv[i][1]] + wv[i][0])\nres = 0\nfor v, e in enumerate(dp):\n if e <= w:\n res = v\nprint(res)\n", "code_v1_no_empty_lines": "# dpE - Knapsack 2\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, W = tuple(map(int, input().rstrip().split()))\n A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))\n _, v = list(zip(*A))\n lim = sum(v)\n dp = [0] + [float(\"inf\")] * lim\n for i in range(n):\n for j in range(lim, A[i][1] - 1, -1):\n dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])\n ans = max(v for v, w in enumerate(dp) if w <= W)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 26.3157894737, "diff": ["-# temp", "-n, w = list(map(int, input().split()))", "-wv = [tuple(map(int, input().split())) for i in range(n)]", "-dp = [0] + [float(\"inf\")] * (10**5)", "-for i in range(n):", "- for j in range(10**5, wv[i][1] - 1, -1):", "- dp[j] = min(dp[j], dp[j - wv[i][1]] + wv[i][0])", "-res = 0", "-for v, e in enumerate(dp):", "- if e <= w:", "- res = v", "-print(res)", "+# dpE - Knapsack 2", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def main():", "+ n, W = tuple(map(int, input().rstrip().split()))", "+ A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))", "+ _, v = list(zip(*A))", "+ lim = sum(v)", "+ dp = [0] + [float(\"inf\")] * lim", "+ for i in range(n):", "+ for j in range(lim, A[i][1] - 1, -1):", "+ dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])", "+ ans = max(v for v, w in enumerate(dp) if w <= W)", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 1.6859776349, "measured_runtime_v1": 0.2345220137, "runtime_lift": 7.1889952184, "key": ["s644346369", "s649660252"]} +{"user_id": "u021548497", "problem_id": "p02555", "language": "python", "submission_id_v0": "s983449721", "submission_id_v1": "s321084928", "cpu_time_v0": 330, "cpu_time_v1": 30, "memory_v0": 9192, "memory_v1": 9108, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 90.91, "input": "def main():\n\n n = int(input())\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(n+1):\n\n for j in range(i-2):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "def main():\n\n n = int(input())\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(3, n+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 15, "code_v1_loc": 14, "code_v0_num_chars": 242, "code_v1_num_chars": 226, "code_v0_no_empty_lines": "def main():\n n = int(input())\n dp = [0] * (n + 1)\n dp[0] = 1\n mod = pow(10, 9) + 7\n for i in range(n + 1):\n for j in range(i - 2):\n dp[i] += dp[j]\n dp[i] %= mod\n print((dp[n]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n n = int(input())\n dp = [0] * (n + 1)\n dp[0] = 1\n mod = pow(10, 9) + 7\n for i in range(3, n + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n dp[i] %= mod\n print((dp[n]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["- for i in range(n + 1):", "- for j in range(i - 2):", "- dp[i] += dp[j]", "- dp[i] %= mod", "+ for i in range(3, n + 1):", "+ dp[i] = dp[i - 1] + dp[i - 3]", "+ dp[i] %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6721006331, "measured_runtime_v1": 0.344866425, "runtime_lift": 1.9488723295, "key": ["s983449721", "s321084928"]} +{"user_id": "u881590806", "problem_id": "p02264", "language": "python", "submission_id_v0": "s309974156", "submission_id_v1": "s779537604", "cpu_time_v0": 780, "cpu_time_v1": 600, "memory_v0": 14072, "memory_v1": 28548, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.08, "input": "class Queue:\n\n def __init__(self,values):\n\n self.values = values\n\n\n\n def empty(self):\n\n if len(self.values) == 0:\n\n return True\n\n else:\n\n return False\n\n\n\n def enqueue(self,v):\n\n self.values.append(v)\n\n\n\n def dequeue(self):\n\n if len(self.values) <= 0:\n\n raise\n\n else:\n\n v = self.values[0]\n\n del self.values[0]\n\n return v\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nprocesses = []\n\nfor i in range(n):\n\n n,t = input().split(' ')\n\n processes.append((n,int(t)))\n\n\n\nqueue = Queue(processes)\n\n\n\nclock = 0\n\ndone = []\n\nwhile not queue.empty():\n\n p = queue.dequeue()\n\n n = p[0]\n\n t = p[1]\n\n if t <= q:\n\n clock+=t\n\n done.append((n,clock))\n\n else:\n\n queue.enqueue((n,t-q))\n\n clock+=q\n\n\n\nfor p in done:\n\n print(p[0],p[1])", "target": "class Queue:\n\n def __init__(self,l):\n\n self.values = []\n\n self.l = l\n\n for _ in range(l):\n\n self.values.append(None)\n\n self.head = 0\n\n self.tail = 0\n\n def inc(self,n):\n\n if n+1 >= self.l:\n\n return 0\n\n else:\n\n return n+1\n\n def enqueue(self,v):\n\n if self.inc(self.head) == self.tail:\n\n print('overflow')\n\n exit()\n\n self.values[self.head] = v\n\n self.head = self.inc(self.head)\n\n def dequeue(self):\n\n if self.head == self.tail:\n\n print('underflow')\n\n exit()\n\n v = self.values[self.tail]\n\n self.tail = self.inc(self.tail)\n\n return v\n\n def size(self):\n\n if self.head >= self.tail:\n\n return self.head-self.tail\n\n else:\n\n self.head + (self.l-self.tail)\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nqueue = Queue(200000)\n\nfor _ in range(n):\n\n n,t = input().split(' ')\n\n t = int(t)\n\n queue.enqueue((n,t))\n\n\n\nc = 0\n\nwhile queue.size()>0:\n\n n,t = queue.dequeue()\n\n if t <= q:\n\n c += t\n\n print(n,c)\n\n else:\n\n queue.enqueue((n,t-q))\n\n c += q", "code_v0_loc": 44, "code_v1_loc": 48, "code_v0_num_chars": 881, "code_v1_num_chars": 1197, "code_v0_no_empty_lines": "class Queue:\n def __init__(self, values):\n self.values = values\n\n def empty(self):\n if len(self.values) == 0:\n return True\n else:\n return False\n\n def enqueue(self, v):\n self.values.append(v)\n\n def dequeue(self):\n if len(self.values) <= 0:\n raise\n else:\n v = self.values[0]\n del self.values[0]\n return v\n\n\nn, q = list(map(int, input().split(\" \")))\nprocesses = []\nfor i in range(n):\n n, t = input().split(\" \")\n processes.append((n, int(t)))\nqueue = Queue(processes)\nclock = 0\ndone = []\nwhile not queue.empty():\n p = queue.dequeue()\n n = p[0]\n t = p[1]\n if t <= q:\n clock += t\n done.append((n, clock))\n else:\n queue.enqueue((n, t - q))\n clock += q\nfor p in done:\n print(p[0], p[1])\n", "code_v1_no_empty_lines": "class Queue:\n def __init__(self, l):\n self.values = []\n self.l = l\n for _ in range(l):\n self.values.append(None)\n self.head = 0\n self.tail = 0\n\n def inc(self, n):\n if n + 1 >= self.l:\n return 0\n else:\n return n + 1\n\n def enqueue(self, v):\n if self.inc(self.head) == self.tail:\n print(\"overflow\")\n exit()\n self.values[self.head] = v\n self.head = self.inc(self.head)\n\n def dequeue(self):\n if self.head == self.tail:\n print(\"underflow\")\n exit()\n v = self.values[self.tail]\n self.tail = self.inc(self.tail)\n return v\n\n def size(self):\n if self.head >= self.tail:\n return self.head - self.tail\n else:\n self.head + (self.l - self.tail)\n\n\nn, q = list(map(int, input().split(\" \")))\nqueue = Queue(200000)\nfor _ in range(n):\n n, t = input().split(\" \")\n t = int(t)\n queue.enqueue((n, t))\nc = 0\nwhile queue.size() > 0:\n n, t = queue.dequeue()\n if t <= q:\n c += t\n print(n, c)\n else:\n queue.enqueue((n, t - q))\n c += q\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["- def __init__(self, values):", "- self.values = values", "+ def __init__(self, l):", "+ self.values = []", "+ self.l = l", "+ for _ in range(l):", "+ self.values.append(None)", "+ self.head = 0", "+ self.tail = 0", "- def empty(self):", "- if len(self.values) == 0:", "- return True", "+ def inc(self, n):", "+ if n + 1 >= self.l:", "+ return 0", "- return False", "+ return n + 1", "- self.values.append(v)", "+ if self.inc(self.head) == self.tail:", "+ print(\"overflow\")", "+ exit()", "+ self.values[self.head] = v", "+ self.head = self.inc(self.head)", "- if len(self.values) <= 0:", "- raise", "+ if self.head == self.tail:", "+ print(\"underflow\")", "+ exit()", "+ v = self.values[self.tail]", "+ self.tail = self.inc(self.tail)", "+ return v", "+", "+ def size(self):", "+ if self.head >= self.tail:", "+ return self.head - self.tail", "- v = self.values[0]", "- del self.values[0]", "- return v", "+ self.head + (self.l - self.tail)", "-processes = []", "-for i in range(n):", "+queue = Queue(200000)", "+for _ in range(n):", "- processes.append((n, int(t)))", "-queue = Queue(processes)", "-clock = 0", "-done = []", "-while not queue.empty():", "- p = queue.dequeue()", "- n = p[0]", "- t = p[1]", "+ t = int(t)", "+ queue.enqueue((n, t))", "+c = 0", "+while queue.size() > 0:", "+ n, t = queue.dequeue()", "- clock += t", "- done.append((n, clock))", "+ c += t", "+ print(n, c)", "- clock += q", "-for p in done:", "- print(p[0], p[1])", "+ c += q"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3044010155, "measured_runtime_v1": 0.1198908706, "runtime_lift": 2.5389841115, "key": ["s309974156", "s779537604"]} +{"user_id": "u672220554", "problem_id": "p02983", "language": "python", "submission_id_v0": "s554161170", "submission_id_v1": "s606893257", "cpu_time_v0": 990, "cpu_time_v1": 76, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.32, "input": "l,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n print(tres)\n", "target": "l,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n if tres == 0:\n\n break\n\n if tres == 0:\n\n break\n\n print(tres)\n", "code_v0_loc": 11, "code_v1_loc": 15, "code_v0_num_chars": 250, "code_v1_num_chars": 342, "code_v0_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 2019:\n print((0))\nelse:\n tres = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n mod = (i % 2019) * (j % 2019) % 2019\n tres = min(tres, mod)\n print(tres)\n", "code_v1_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 2019:\n print((0))\nelse:\n tres = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n mod = (i % 2019) * (j % 2019) % 2019\n tres = min(tres, mod)\n if tres == 0:\n break\n if tres == 0:\n break\n print(tres)\n", "code_same": false, "relative_loc_diff_percent": 26.6666666667, "diff": ["+ if tres == 0:", "+ break", "+ if tres == 0:", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2616734529, "measured_runtime_v1": 0.2086780975, "runtime_lift": 1.2539574397, "key": ["s554161170", "s606893257"]} +{"user_id": "u254871849", "problem_id": "p03086", "language": "python", "submission_id_v0": "s827296868", "submission_id_v1": "s358574733", "cpu_time_v0": 604, "cpu_time_v1": 18, "memory_v0": 102680, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 97.02, "input": "# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\nimport itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n all_words = []\n\n for i in range(1, len(s) + 1):\n\n for letters in itertools.product('ATCG', repeat=i):\n\n word = ''.join(letters)\n\n all_words.append(word)\n\n \n\n for i in range(len(all_words)-1, 0-1, -1):\n\n if all_words[i] in s:\n\n print((len(all_words[i])))\n\n sys.exit()\n\n print((0))\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n permitted = 'ACGT'\n\n continuous_count = []\n\n count = 0\n\n\n\n for i in range(len(s)):\n\n char = s[i]\n\n if char in permitted:\n\n count += 1\n\n else:\n\n continuous_count.append(count)\n\n count = 0\n\n if i == len(s) - 1:\n\n continuous_count.append(count)\n\n \n\n if not continuous_count:\n\n print((len(s)))\n\n else:\n\n print((max(continuous_count)))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 32, "code_v1_loc": 38, "code_v0_num_chars": 799, "code_v1_num_chars": 884, "code_v0_no_empty_lines": "# 2019-11-12 22:21:08(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\nimport itertools\n\n# from functools import reduce\n# import operator as op\n# from scipy.misc import comb # float\n# import numpy as np\ndef main():\n s = sys.stdin.readline().rstrip()\n all_words = []\n for i in range(1, len(s) + 1):\n for letters in itertools.product(\"ATCG\", repeat=i):\n word = \"\".join(letters)\n all_words.append(word)\n for i in range(len(all_words) - 1, 0 - 1, -1):\n if all_words[i] in s:\n print((len(all_words[i])))\n sys.exit()\n print((0))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# 2019-11-12 22:21:08(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# from scipy.misc import comb # float\n# import numpy as np\ndef main():\n s = sys.stdin.readline().rstrip()\n permitted = \"ACGT\"\n continuous_count = []\n count = 0\n for i in range(len(s)):\n char = s[i]\n if char in permitted:\n count += 1\n else:\n continuous_count.append(count)\n count = 0\n if i == len(s) - 1:\n continuous_count.append(count)\n if not continuous_count:\n print((len(s)))\n else:\n print((max(continuous_count)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.7894736842, "diff": ["-import itertools", "-", "+# import itertools", "- all_words = []", "- for i in range(1, len(s) + 1):", "- for letters in itertools.product(\"ATCG\", repeat=i):", "- word = \"\".join(letters)", "- all_words.append(word)", "- for i in range(len(all_words) - 1, 0 - 1, -1):", "- if all_words[i] in s:", "- print((len(all_words[i])))", "- sys.exit()", "- print((0))", "+ permitted = \"ACGT\"", "+ continuous_count = []", "+ count = 0", "+ for i in range(len(s)):", "+ char = s[i]", "+ if char in permitted:", "+ count += 1", "+ else:", "+ continuous_count.append(count)", "+ count = 0", "+ if i == len(s) - 1:", "+ continuous_count.append(count)", "+ if not continuous_count:", "+ print((len(s)))", "+ else:", "+ print((max(continuous_count)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4624249086, "measured_runtime_v1": 0.2736470122, "runtime_lift": 1.6898591541, "key": ["s827296868", "s358574733"]} +{"user_id": "u254871849", "problem_id": "p03309", "language": "python", "submission_id_v0": "s802702568", "submission_id_v1": "s939867576", "cpu_time_v0": 372, "cpu_time_v1": 200, "memory_v0": 27268, "memory_v1": 25180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.24, "input": "# author: kagemeka \n\n# created: 2019-11-08 14:51:29(JST)\n\n## internal modules\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\nimport statistics\n\n# import functools\n\n# import operator\n\n## external modules\n\n# import scipy.special # if use comb function on AtCoder, \n\n# import scipy.misc # select scipy.misc.comb (old version) \n\n\n\ndef main():\n\n n, *a = (int(x) for x in sys.stdin.read().split())\n\n \n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n\n\n if n % 2 != 0:\n\n b = statistics.median(a)\n\n else:\n\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n\n b = statistics.median_high(a)\n\n else:\n\n b = statistics.median_low(a)\n\n \n\n ans = sum([abs(a[i] - b) for i in range(n)])\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n\n\n\n\n", "target": "import sys\n\n\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\n\n\ndef main():\n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n a.sort()\n\n b = a[n // 2]\n\n res = 0\n\n for i in range(n):\n\n res += abs(a[i] - b)\n\n \n\n return res\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 40, "code_v1_loc": 18, "code_v0_num_chars": 987, "code_v1_num_chars": 310, "code_v0_no_empty_lines": "# author: kagemeka\n# created: 2019-11-08 14:51:29(JST)\n## internal modules\nimport sys\n\n# import collections\n# import math\n# import string\n# import bisect\n# import re\n# import itertools\nimport statistics\n\n# import functools\n# import operator\n## external modules\n# import scipy.special # if use comb function on AtCoder,\n# import scipy.misc # select scipy.misc.comb (old version)\ndef main():\n n, *a = (int(x) for x in sys.stdin.read().split())\n for i in range(n):\n a[i] -= i + 1\n if n % 2 != 0:\n b = statistics.median(a)\n else:\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n b = statistics.median_high(a)\n else:\n b = statistics.median_low(a)\n ans = sum([abs(a[i] - b) for i in range(n)])\n print(ans)\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n", "code_v1_no_empty_lines": "import sys\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\n\ndef main():\n for i in range(n):\n a[i] -= i + 1\n a.sort()\n b = a[n // 2]\n res = 0\n for i in range(n):\n res += abs(a[i] - b)\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 55.0, "diff": ["-# author: kagemeka", "-# created: 2019-11-08 14:51:29(JST)", "-## internal modules", "-# import collections", "-# import math", "-# import string", "-# import bisect", "-# import re", "-# import itertools", "-import statistics", "+n, *a = list(map(int, sys.stdin.read().split()))", "-# import functools", "-# import operator", "-## external modules", "-# import scipy.special # if use comb function on AtCoder,", "-# import scipy.misc # select scipy.misc.comb (old version)", "+", "- n, *a = (int(x) for x in sys.stdin.read().split())", "- if n % 2 != 0:", "- b = statistics.median(a)", "- else:", "- if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):", "- b = statistics.median_high(a)", "- else:", "- b = statistics.median_low(a)", "- ans = sum([abs(a[i] - b) for i in range(n)])", "- print(ans)", "+ a.sort()", "+ b = a[n // 2]", "+ res = 0", "+ for i in range(n):", "+ res += abs(a[i] - b)", "+ return res", "- # execute only if run as a script", "- main()", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2726693273, "measured_runtime_v1": 0.2052652476, "runtime_lift": 1.3283755066, "key": ["s802702568", "s939867576"]} +{"user_id": "u416758623", "problem_id": "p03416", "language": "python", "submission_id_v0": "s698254896", "submission_id_v1": "s209236188", "cpu_time_v0": 210, "cpu_time_v1": 54, "memory_v0": 3060, "memory_v1": 9152, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 74.29, "input": "def findSumDigit(num):\n\n global total\n\n total = \"\"\n\n while num > 0:\n\n total += str(num % 10)\n\n num //= 10\n\n return total\n\n\n\ndef main():\n\n a,b = list(map(int, input().split()))\n\n ans = 0\n\n for i in range(a,b+1):\n\n tmp = str(findSumDigit(i))\n\n if tmp == str(i):\n\n ans += 1\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "a, b = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor i in range(a,b+1):\n\n seki_gyaku = str(i)\n\n if seki_gyaku == seki_gyaku[::-1]:\n\n ans += 1\n\n\n\nprint(ans)\n", "code_v0_loc": 19, "code_v1_loc": 9, "code_v0_num_chars": 382, "code_v1_num_chars": 165, "code_v0_no_empty_lines": "def findSumDigit(num):\n global total\n total = \"\"\n while num > 0:\n total += str(num % 10)\n num //= 10\n return total\n\n\ndef main():\n a, b = list(map(int, input().split()))\n ans = 0\n for i in range(a, b + 1):\n tmp = str(findSumDigit(i))\n if tmp == str(i):\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n seki_gyaku = str(i)\n if seki_gyaku == seki_gyaku[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 52.6315789474, "diff": ["-def findSumDigit(num):", "- global total", "- total = \"\"", "- while num > 0:", "- total += str(num % 10)", "- num //= 10", "- return total", "-", "-", "-def main():", "- a, b = list(map(int, input().split()))", "- ans = 0", "- for i in range(a, b + 1):", "- tmp = str(findSumDigit(i))", "- if tmp == str(i):", "- ans += 1", "- print(ans)", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+a, b = list(map(int, input().split()))", "+ans = 0", "+for i in range(a, b + 1):", "+ seki_gyaku = str(i)", "+ if seki_gyaku == seki_gyaku[::-1]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.908202547, "measured_runtime_v1": 0.4125540495, "runtime_lift": 2.2014146949, "key": ["s698254896", "s209236188"]} +{"user_id": "u759412327", "problem_id": "p03680", "language": "python", "submission_id_v0": "s086989807", "submission_id_v1": "s510724514", "cpu_time_v0": 397, "cpu_time_v1": 201, "memory_v0": 7084, "memory_v1": 13724, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 49.37, "input": "N = int(input())\n\na = [int(input()) for i in range(N)]\n\nnow = a[0]\n\ncount = 1\n\nc = 0\n\nfor i in range(10**6):\n\n if now != 2:\n\n count += 1\n\n now = a[now - 1]\n\n else:\n\n print(count)\n\n c = 1\n\n break\n\nif c == 0:\n\n print((-1))\n", "target": "N = int(input())\n\na = [0] + [int(input()) for _ in range(N)]\n\nx = 1\n\nvisited = set([1])\n\nanswer = 0\n\n\n\nwhile True:\n\n x = a[x]\n\n if x in visited:\n\n answer = -1\n\n break\n\n visited.add(x)\n\n answer += 1\n\n if x == 2:\n\n break\n\n \n\nprint(answer)\n", "code_v0_loc": 15, "code_v1_loc": 17, "code_v0_num_chars": 263, "code_v1_num_chars": 254, "code_v0_no_empty_lines": "N = int(input())\na = [int(input()) for i in range(N)]\nnow = a[0]\ncount = 1\nc = 0\nfor i in range(10**6):\n if now != 2:\n count += 1\n now = a[now - 1]\n else:\n print(count)\n c = 1\n break\nif c == 0:\n print((-1))\n", "code_v1_no_empty_lines": "N = int(input())\na = [0] + [int(input()) for _ in range(N)]\nx = 1\nvisited = set([1])\nanswer = 0\nwhile True:\n x = a[x]\n if x in visited:\n answer = -1\n break\n visited.add(x)\n answer += 1\n if x == 2:\n break\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 11.7647058824, "diff": ["-a = [int(input()) for i in range(N)]", "-now = a[0]", "-count = 1", "-c = 0", "-for i in range(10**6):", "- if now != 2:", "- count += 1", "- now = a[now - 1]", "- else:", "- print(count)", "- c = 1", "+a = [0] + [int(input()) for _ in range(N)]", "+x = 1", "+visited = set([1])", "+answer = 0", "+while True:", "+ x = a[x]", "+ if x in visited:", "+ answer = -1", "-if c == 0:", "- print((-1))", "+ visited.add(x)", "+ answer += 1", "+ if x == 2:", "+ break", "+print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8020722582, "measured_runtime_v1": 0.2096916373, "runtime_lift": 3.8250083246, "key": ["s086989807", "s510724514"]} +{"user_id": "u150984829", "problem_id": "p02386", "language": "python", "submission_id_v0": "s352388599", "submission_id_v1": "s199670495", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 5616, "memory_v1": 5616, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n", "target": "n=int(input())\n\na=[[int(s)for s in input().split()]for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n", "code_v0_loc": 15, "code_v1_loc": 15, "code_v0_num_chars": 457, "code_v1_num_chars": 459, "code_v0_no_empty_lines": "n = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\n [0, 1, 2, 3, 4, 5],\n [1, 5, 2, 0, 4, 3],\n [2, 1, 5, 3, 0, 4],\n [3, 0, 2, 5, 4, 1],\n [4, 1, 0, 3, 5, 2],\n [5, 1, 4, 3, 2, 0],\n ):\n f = [d[k] for k in p]\n if f[0] == e[0] and f[5] == e[5]:\n f = f[1:5] * 2\n for k in range(4):\n if f[k : k + 4] == e[1:5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_v1_no_empty_lines": "n = int(input())\na = [[int(s) for s in input().split()] for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\n [0, 1, 2, 3, 4, 5],\n [1, 5, 2, 0, 4, 3],\n [2, 1, 5, 3, 0, 4],\n [3, 0, 2, 5, 4, 1],\n [4, 1, 0, 3, 5, 2],\n [5, 1, 4, 3, 2, 0],\n ):\n f = [d[k] for k in p]\n if f[0] == e[0] and f[5] == e[5]:\n f = f[1:5] * 2\n for k in range(4):\n if f[k : k + 4] == e[1:5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-a = [list(map(int, input().split())) for _ in range(n)]", "+a = [[int(s) for s in input().split()] for _ in range(n)]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2724710764, "measured_runtime_v1": 0.2146971788, "runtime_lift": 1.2690948152, "key": ["s352388599", "s199670495"]} +{"user_id": "u860002137", "problem_id": "p02952", "language": "python", "submission_id_v0": "s726498671", "submission_id_v1": "s714071292", "cpu_time_v0": 61, "cpu_time_v1": 26, "memory_v0": 2940, "memory_v1": 9004, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.38, "input": "N = int(input())\n\n\n\nans = 0\n\n\n\nfor i in range(1, N+1):\n\n if len(str(i))%2==1:\n\n ans += 1\n\n\n\nprint(ans)", "target": "import sys\n\n\n\n\n\ndef rec(length):\n\n if length == 1:\n\n return 9\n\n else:\n\n return 9 * 10**(length - 1) + rec(length - 2)\n\n\n\n\n\nn = input()\n\nlength = len(n)\n\n\n\nif length == 1:\n\n print(n)\n\n sys.exit()\n\n\n\nif length % 2 == 0:\n\n ans = rec(length - 1)\n\nelse:\n\n ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1\n\n\n\nprint(ans)", "code_v0_loc": 9, "code_v1_loc": 23, "code_v0_num_chars": 112, "code_v1_num_chars": 363, "code_v0_no_empty_lines": "N = int(input())\nans = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 == 1:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\n\ndef rec(length):\n if length == 1:\n return 9\n else:\n return 9 * 10 ** (length - 1) + rec(length - 2)\n\n\nn = input()\nlength = len(n)\nif length == 1:\n print(n)\n sys.exit()\nif length % 2 == 0:\n ans = rec(length - 1)\nelse:\n ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 60.8695652174, "diff": ["-N = int(input())", "-ans = 0", "-for i in range(1, N + 1):", "- if len(str(i)) % 2 == 1:", "- ans += 1", "+import sys", "+", "+", "+def rec(length):", "+ if length == 1:", "+ return 9", "+ else:", "+ return 9 * 10 ** (length - 1) + rec(length - 2)", "+", "+", "+n = input()", "+length = len(n)", "+if length == 1:", "+ print(n)", "+ sys.exit()", "+if length % 2 == 0:", "+ ans = rec(length - 1)", "+else:", "+ ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2155013096, "measured_runtime_v1": 0.1672313638, "runtime_lift": 1.2886417043, "key": ["s726498671", "s714071292"]} +{"user_id": "u761320129", "problem_id": "p03425", "language": "python", "submission_id_v0": "s293375746", "submission_id_v1": "s279901441", "cpu_time_v0": 180, "cpu_time_v1": 149, "memory_v0": 10112, "memory_v1": 10876, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.22, "input": "import itertools\n\nfrom collections import Counter\n\nN = int(input())\n\nsrc = [input() for i in range(N)]\n\nctr = Counter()\n\nfor s in src:\n\n ctr[s[0]] += 1\n\n\n\nans = 0\n\nfor ptn in itertools.combinations('MARCH',3):\n\n a,b,c = ptn\n\n ans += ctr[a]*ctr[b]*ctr[c]\n\nprint(ans)", "target": "N = int(input())\n\nS = [input() for i in range(N)]\n\nfrom collections import Counter\n\nctr = Counter([s[0] for s in S])\n\n\n\nans = 0\n\nimport itertools\n\nfor ptn in itertools.combinations('MARCH', 3):\n\n t = 1\n\n for c in ptn:\n\n t *= ctr[c]\n\n ans += t\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 274, "code_v1_num_chars": 270, "code_v0_no_empty_lines": "import itertools\nfrom collections import Counter\n\nN = int(input())\nsrc = [input() for i in range(N)]\nctr = Counter()\nfor s in src:\n ctr[s[0]] += 1\nans = 0\nfor ptn in itertools.combinations(\"MARCH\", 3):\n a, b, c = ptn\n ans += ctr[a] * ctr[b] * ctr[c]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nS = [input() for i in range(N)]\nfrom collections import Counter\n\nctr = Counter([s[0] for s in S])\nans = 0\nimport itertools\n\nfor ptn in itertools.combinations(\"MARCH\", 3):\n t = 1\n for c in ptn:\n t *= ctr[c]\n ans += t\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-import itertools", "+N = int(input())", "+S = [input() for i in range(N)]", "-N = int(input())", "-src = [input() for i in range(N)]", "-ctr = Counter()", "-for s in src:", "- ctr[s[0]] += 1", "+ctr = Counter([s[0] for s in S])", "+import itertools", "+", "- a, b, c = ptn", "- ans += ctr[a] * ctr[b] * ctr[c]", "+ t = 1", "+ for c in ptn:", "+ t *= ctr[c]", "+ ans += t"], "diff_only_import_comment": false, "measured_runtime_v0": 0.206595207, "measured_runtime_v1": 0.1454657862, "runtime_lift": 1.420232292, "key": ["s293375746", "s279901441"]} +{"user_id": "u047102107", "problem_id": "p02952", "language": "python", "submission_id_v0": "s855248831", "submission_id_v1": "s153783643", "cpu_time_v0": 193, "cpu_time_v1": 64, "memory_v0": 40812, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.84, "input": "N = int(input())\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n num_dig = 0\n\n ii = i\n\n while ii > 0:\n\n ii = int(ii / 10)\n\n num_dig += 1\n\n if num_dig % 2 != 0:\n\n count += 1\n\n\n\nprint(count)", "target": "N = int(input())\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n if len(str(i)) % 2 != 0:\n\n count += 1\n\nprint(count)", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 215, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "N = int(input())\ncount = 0\nfor i in range(1, N + 1):\n num_dig = 0\n ii = i\n while ii > 0:\n ii = int(ii / 10)\n num_dig += 1\n if num_dig % 2 != 0:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "N = int(input())\ncount = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 != 0:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["- num_dig = 0", "- ii = i", "- while ii > 0:", "- ii = int(ii / 10)", "- num_dig += 1", "- if num_dig % 2 != 0:", "+ if len(str(i)) % 2 != 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3673675511, "measured_runtime_v1": 0.2702338476, "runtime_lift": 1.3594431427, "key": ["s855248831", "s153783643"]} +{"user_id": "u372550522", "problem_id": "p02801", "language": "python", "submission_id_v0": "s439687684", "submission_id_v1": "s397132828", "cpu_time_v0": 25, "cpu_time_v1": 17, "memory_v0": 3768, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.0, "input": "from string import ascii_lowercase as lower\n\nprint((lower[lower.find(input())+1]))", "target": "print((chr(ord(input())+1)))", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 80, "code_v1_num_chars": 26, "code_v0_no_empty_lines": "from string import ascii_lowercase as lower\n\nprint((lower[lower.find(input()) + 1]))\n", "code_v1_no_empty_lines": "print((chr(ord(input()) + 1)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-from string import ascii_lowercase as lower", "-", "-print((lower[lower.find(input()) + 1]))", "+print((chr(ord(input()) + 1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3241319713, "measured_runtime_v1": 0.2361063808, "runtime_lift": 1.3728217348, "key": ["s439687684", "s397132828"]} +{"user_id": "u585482323", "problem_id": "p03634", "language": "python", "submission_id_v0": "s798160758", "submission_id_v1": "s876456894", "cpu_time_v0": 777, "cpu_time_v1": 659, "memory_v0": 85552, "memory_v1": 85552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.19, "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]//g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.pop()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n", "target": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]//g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.popleft()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n", "code_v0_loc": 105, "code_v1_loc": 105, "code_v0_num_chars": 1535, "code_v1_num_chars": 1539, "code_v0_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\n\"\"\"\ndef gcd(a,b):\n if a == 0:\n return b\n return gcd(b%a,a)\nn = I()\na = IR(n)\nl = a[0]\nfor i in range(1,n):\n g = gcd(l,a[i])\n l *= a[i]//g\nprint(l)\n\"\"\"\n# B\nn = I()\nv = [[] for i in range(n)]\nfor i in range(n - 1):\n a, b, c = LI()\n a -= 1\n b -= 1\n v[a].append([b, c])\n v[b].append([a, c])\nQ, k = LI()\nd = [-1 for i in range(n)]\nd[k - 1] = 0\nq = deque()\nq.append(k - 1)\nwhile q:\n x = q.pop()\n for y, c in v[x]:\n if d[y] == -1:\n d[y] = d[x] + c\n q.append(y)\nfor i in range(Q):\n x, y = LI()\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n# C\n# D\n# E\n# F\n# G\n# H\n# I\n# J\n# K\n# L\n# M\n# N\n# O\n# P\n# Q\n# R\n# S\n# T\n", "code_v1_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\n\"\"\"\ndef gcd(a,b):\n if a == 0:\n return b\n return gcd(b%a,a)\nn = I()\na = IR(n)\nl = a[0]\nfor i in range(1,n):\n g = gcd(l,a[i])\n l *= a[i]//g\nprint(l)\n\"\"\"\n# B\nn = I()\nv = [[] for i in range(n)]\nfor i in range(n - 1):\n a, b, c = LI()\n a -= 1\n b -= 1\n v[a].append([b, c])\n v[b].append([a, c])\nQ, k = LI()\nd = [-1 for i in range(n)]\nd[k - 1] = 0\nq = deque()\nq.append(k - 1)\nwhile q:\n x = q.popleft()\n for y, c in v[x]:\n if d[y] == -1:\n d[y] = d[x] + c\n q.append(y)\nfor i in range(Q):\n x, y = LI()\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n# C\n# D\n# E\n# F\n# G\n# H\n# I\n# J\n# K\n# L\n# M\n# N\n# O\n# P\n# Q\n# R\n# S\n# T\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- x = q.pop()", "+ x = q.popleft()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3495916958, "measured_runtime_v1": 0.1121557097, "runtime_lift": 3.1170209395, "key": ["s798160758", "s876456894"]} +{"user_id": "u419874471", "problem_id": "p04012", "language": "python", "submission_id_v0": "s872816747", "submission_id_v1": "s223982270", "cpu_time_v0": 32, "cpu_time_v1": 17, "memory_v0": 3956, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.88, "input": "import string\n\nw = input()\n\nfor a in string.ascii_lowercase:\n\n cnt = 0\n\n for t in w:\n\n if t == a:\n\n cnt = cnt + 1\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")", "target": "w = input()\n\nm = [0] * 26\n\nfor t in w:\n\n m[ord(t) - ord('a')] += 1\n\n\n\nfor cnt in m:\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")", "code_v0_loc": 12, "code_v1_loc": 11, "code_v0_num_chars": 212, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "import string\n\nw = input()\nfor a in string.ascii_lowercase:\n cnt = 0\n for t in w:\n if t == a:\n cnt = cnt + 1\n if cnt % 2 == 1:\n print(\"No\")\n exit()\nprint(\"Yes\")\n", "code_v1_no_empty_lines": "w = input()\nm = [0] * 26\nfor t in w:\n m[ord(t) - ord(\"a\")] += 1\nfor cnt in m:\n if cnt % 2 == 1:\n print(\"No\")\n exit()\nprint(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-import string", "-", "-for a in string.ascii_lowercase:", "- cnt = 0", "- for t in w:", "- if t == a:", "- cnt = cnt + 1", "+m = [0] * 26", "+for t in w:", "+ m[ord(t) - ord(\"a\")] += 1", "+for cnt in m:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2442542629, "measured_runtime_v1": 0.193693031, "runtime_lift": 1.2610379509, "key": ["s872816747", "s223982270"]} +{"user_id": "u133936772", "problem_id": "p03013", "language": "python", "submission_id_v0": "s323963688", "submission_id_v1": "s220101257", "cpu_time_v0": 187, "cpu_time_v1": 70, "memory_v0": 3828, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 62.57, "input": "mod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(input())-1] = 1\n\n\n\ns = 0\n\nt = 1\n\n\n\nfor i in range(n):\n\n if l[i] > 0:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\nmod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(input())-1] = 1\n\n\n\nt, s = 1, 0\n\n\n\nfor i in range(n):\n\n if l[i]:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 220, "code_v1_num_chars": 257, "code_v0_no_empty_lines": "mod = 10**9 + 7\nn, m = list(map(int, input().split()))\nl = [0] * n\nfor _ in range(m):\n l[int(input()) - 1] = 1\ns = 0\nt = 1\nfor i in range(n):\n if l[i] > 0:\n t, s = 0, t\n else:\n t, s = (s + t) % mod, t\nprint(t)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nmod = 10**9 + 7\nn, m = list(map(int, input().split()))\nl = [0] * n\nfor _ in range(m):\n l[int(input()) - 1] = 1\nt, s = 1, 0\nfor i in range(n):\n if l[i]:\n t, s = 0, t\n else:\n t, s = (s + t) % mod, t\nprint(t)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["+import sys", "+", "+input = sys.stdin.readline", "-s = 0", "-t = 1", "+t, s = 1, 0", "- if l[i] > 0:", "+ if l[i]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3071881404, "measured_runtime_v1": 0.1884790037, "runtime_lift": 1.6298268475, "key": ["s323963688", "s220101257"]} +{"user_id": "u911856499", "problem_id": "p03774", "language": "python", "submission_id_v0": "s205905114", "submission_id_v1": "s474977819", "cpu_time_v0": 31, "cpu_time_v1": 26, "memory_v0": 9140, "memory_v1": 9144, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.13, "input": "N,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 2*10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n", "target": "N,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 360, "code_v1_num_chars": 358, "code_v0_no_empty_lines": "N, M = [int(c) for c in input().split()]\nab = [list(map(int, input().split())) for c in range(N)]\ncd = [list(map(int, input().split())) for c in range(M)]\nfor i in range(N):\n mi = 2 * 10**9\n for j in range(M):\n tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n if mi > tmp:\n mi = tmp\n ans = j + 1\n print(ans)\n", "code_v1_no_empty_lines": "N, M = [int(c) for c in input().split()]\nab = [list(map(int, input().split())) for c in range(N)]\ncd = [list(map(int, input().split())) for c in range(M)]\nfor i in range(N):\n mi = 10**9\n for j in range(M):\n tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n if mi > tmp:\n mi = tmp\n ans = j + 1\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- mi = 2 * 10**9", "+ mi = 10**9"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2982070241, "measured_runtime_v1": 0.232865705, "runtime_lift": 1.2805965742, "key": ["s205905114", "s474977819"]} +{"user_id": "u187857228", "problem_id": "p03416", "language": "python", "submission_id_v0": "s720217601", "submission_id_v1": "s964731712", "cpu_time_v0": 154, "cpu_time_v1": 57, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 62.99, "input": "def test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n j = list(map(int,list(str(i))))\n\n if j[0] == j[4] and j[1] == j[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n", "target": "def test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n", "code_v0_loc": 12, "code_v1_loc": 11, "code_v0_num_chars": 261, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "def test():\n a, b = list(map(int, input().split()))\n count = 0\n for i in range(a, b + 1):\n j = list(map(int, list(str(i))))\n if j[0] == j[4] and j[1] == j[3]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n test()\n", "code_v1_no_empty_lines": "def test():\n a, b = list(map(int, input().split()))\n count = 0\n for i in range(a, b + 1):\n if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n test()\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["- j = list(map(int, list(str(i))))", "- if j[0] == j[4] and j[1] == j[3]:", "+ if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4881631348, "measured_runtime_v1": 0.3868406759, "runtime_lift": 1.2619229704, "key": ["s720217601", "s964731712"]} +{"user_id": "u906428167", "problem_id": "p02821", "language": "python", "submission_id_v0": "s228028161", "submission_id_v1": "s587768475", "cpu_time_v0": 305, "cpu_time_v1": 262, "memory_v0": 55448, "memory_v1": 54460, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.1, "input": "from bisect import bisect_left\n\nfrom bisect import bisect_right\n\n\n\nn,m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = sorted(a)\n\n\n\na_count = [0]*100010\n\na_sum = [0]*100010\n\n\n\nfor i in range(n):\n\n a_count[a[i]] += 1\n\n a_sum[a[i]] += a[i]\n\n\n\nfor i in range(100005,-1,-1):\n\n a_count[i] += a_count[i+1]\n\n a_sum[i] += a_sum[i+1]\n\n\n\ndef chk(x):\n\n case = 0\n\n for i in range(n):\n\n if 0<= x-a[i]<= 10**5+5:\n\n case += a_count[x-a[i]]\n\n elif x-a[i] < 0:\n\n case += n\n\n if case >= m:\n\n ch = True\n\n else:\n\n ch = False\n\n return ch\n\n\n\nl = 2*a[-1]+1 #NG\n\nr = 1 #OK\n\n\n\nwhile abs(r-l) > 1:\n\n kk = (r+l)//2\n\n if chk(kk):\n\n r = kk\n\n else:\n\n l = kk\n\n\n\nans = 0\n\nsm = sum(a)\n\n\n\nl = r\n\n\n\ncase = 0\n\nfor i in range(n):\n\n num = n-bisect_right(a,l-a[i]-1)\n\n case += num\n\n ans += num*a[i]*2\n\n\n\nans -= (case-m)*l\n\n\n\nprint(ans)", "target": "n, m = list(map(int, input().split()))\n\na = [int(x) for x in input().split()]\n\n\n\naa = [0]*(10**5+1)\n\naa_sum = [0]*(10**5+1)\n\n\n\nfor x in a:\n\n aa[x] += 1\n\n aa_sum[x] += x\n\n\n\nfor i in range(10**5)[::-1]:\n\n aa[i] = aa[i] + aa[i+1]\n\n aa_sum[i] = aa_sum[i] + aa_sum[i+1]\n\n\n\n\n\ndef count(x):\n\n cnt = 0\n\n sm = 0\n\n for i in range(n):\n\n if x-a[i] < 0:\n\n cnt += n\n\n sm += aa_sum[0]+n*a[i]\n\n elif x-a[i] > 10**5:\n\n continue\n\n else:\n\n cnt += aa[x-a[i]]\n\n sm += aa_sum[x-a[i]]+aa[x-a[i]]*a[i]\n\n\n\n return cnt, sm\n\n\n\n\n\nbottom = 0\n\ntop = 10**6\n\n\n\nwhile top - bottom > 1:\n\n mid = (top+bottom) // 2\n\n cnt, sm = count(mid)\n\n if cnt < m:\n\n top = mid\n\n else:\n\n bottom = mid\n\n\n\ncnt, sm = count(bottom)\n\nans = sm - (cnt-m)*bottom\n\n\n\nprint(ans)\n", "code_v0_loc": 55, "code_v1_loc": 46, "code_v0_num_chars": 930, "code_v1_num_chars": 839, "code_v0_no_empty_lines": "from bisect import bisect_left\nfrom bisect import bisect_right\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = sorted(a)\na_count = [0] * 100010\na_sum = [0] * 100010\nfor i in range(n):\n a_count[a[i]] += 1\n a_sum[a[i]] += a[i]\nfor i in range(100005, -1, -1):\n a_count[i] += a_count[i + 1]\n a_sum[i] += a_sum[i + 1]\n\n\ndef chk(x):\n case = 0\n for i in range(n):\n if 0 <= x - a[i] <= 10**5 + 5:\n case += a_count[x - a[i]]\n elif x - a[i] < 0:\n case += n\n if case >= m:\n ch = True\n else:\n ch = False\n return ch\n\n\nl = 2 * a[-1] + 1 # NG\nr = 1 # OK\nwhile abs(r - l) > 1:\n kk = (r + l) // 2\n if chk(kk):\n r = kk\n else:\n l = kk\nans = 0\nsm = sum(a)\nl = r\ncase = 0\nfor i in range(n):\n num = n - bisect_right(a, l - a[i] - 1)\n case += num\n ans += num * a[i] * 2\nans -= (case - m) * l\nprint(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\na = [int(x) for x in input().split()]\naa = [0] * (10**5 + 1)\naa_sum = [0] * (10**5 + 1)\nfor x in a:\n aa[x] += 1\n aa_sum[x] += x\nfor i in range(10**5)[::-1]:\n aa[i] = aa[i] + aa[i + 1]\n aa_sum[i] = aa_sum[i] + aa_sum[i + 1]\n\n\ndef count(x):\n cnt = 0\n sm = 0\n for i in range(n):\n if x - a[i] < 0:\n cnt += n\n sm += aa_sum[0] + n * a[i]\n elif x - a[i] > 10**5:\n continue\n else:\n cnt += aa[x - a[i]]\n sm += aa_sum[x - a[i]] + aa[x - a[i]] * a[i]\n return cnt, sm\n\n\nbottom = 0\ntop = 10**6\nwhile top - bottom > 1:\n mid = (top + bottom) // 2\n cnt, sm = count(mid)\n if cnt < m:\n top = mid\n else:\n bottom = mid\ncnt, sm = count(bottom)\nans = sm - (cnt - m) * bottom\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 16.3636363636, "diff": ["-from bisect import bisect_left", "-from bisect import bisect_right", "-", "-a = list(map(int, input().split()))", "-a = sorted(a)", "-a_count = [0] * 100010", "-a_sum = [0] * 100010", "-for i in range(n):", "- a_count[a[i]] += 1", "- a_sum[a[i]] += a[i]", "-for i in range(100005, -1, -1):", "- a_count[i] += a_count[i + 1]", "- a_sum[i] += a_sum[i + 1]", "+a = [int(x) for x in input().split()]", "+aa = [0] * (10**5 + 1)", "+aa_sum = [0] * (10**5 + 1)", "+for x in a:", "+ aa[x] += 1", "+ aa_sum[x] += x", "+for i in range(10**5)[::-1]:", "+ aa[i] = aa[i] + aa[i + 1]", "+ aa_sum[i] = aa_sum[i] + aa_sum[i + 1]", "-def chk(x):", "- case = 0", "+def count(x):", "+ cnt = 0", "+ sm = 0", "- if 0 <= x - a[i] <= 10**5 + 5:", "- case += a_count[x - a[i]]", "- elif x - a[i] < 0:", "- case += n", "- if case >= m:", "- ch = True", "- else:", "- ch = False", "- return ch", "+ if x - a[i] < 0:", "+ cnt += n", "+ sm += aa_sum[0] + n * a[i]", "+ elif x - a[i] > 10**5:", "+ continue", "+ else:", "+ cnt += aa[x - a[i]]", "+ sm += aa_sum[x - a[i]] + aa[x - a[i]] * a[i]", "+ return cnt, sm", "-l = 2 * a[-1] + 1 # NG", "-r = 1 # OK", "-while abs(r - l) > 1:", "- kk = (r + l) // 2", "- if chk(kk):", "- r = kk", "+bottom = 0", "+top = 10**6", "+while top - bottom > 1:", "+ mid = (top + bottom) // 2", "+ cnt, sm = count(mid)", "+ if cnt < m:", "+ top = mid", "- l = kk", "-ans = 0", "-sm = sum(a)", "-l = r", "-case = 0", "-for i in range(n):", "- num = n - bisect_right(a, l - a[i] - 1)", "- case += num", "- ans += num * a[i] * 2", "-ans -= (case - m) * l", "+ bottom = mid", "+cnt, sm = count(bottom)", "+ans = sm - (cnt - m) * bottom"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6311447213, "measured_runtime_v1": 0.3899716654, "runtime_lift": 1.6184373822, "key": ["s228028161", "s587768475"]} +{"user_id": "u624475441", "problem_id": "p03548", "language": "python", "submission_id_v0": "s161926153", "submission_id_v1": "s067842786", "cpu_time_v0": 36, "cpu_time_v1": 18, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "X, Y, Z = list(map(int, input().split()))\n\nfor n in range(10 ** 5, 0, -1):\n\n if X >= n * (Y + Z) + Z:\n\n break\n\nprint(n)", "target": "X, Y, Z = list(map(int, input().split()))\n\nprint(((X - Z) // (Y + Z)))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 123, "code_v1_num_chars": 62, "code_v0_no_empty_lines": "X, Y, Z = list(map(int, input().split()))\nfor n in range(10**5, 0, -1):\n if X >= n * (Y + Z) + Z:\n break\nprint(n)\n", "code_v1_no_empty_lines": "X, Y, Z = list(map(int, input().split()))\nprint(((X - Z) // (Y + Z)))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-for n in range(10**5, 0, -1):", "- if X >= n * (Y + Z) + Z:", "- break", "-print(n)", "+print(((X - Z) // (Y + Z)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4167550103, "measured_runtime_v1": 0.2488601058, "runtime_lift": 1.6746557624, "key": ["s161926153", "s067842786"]} +{"user_id": "u465961647", "problem_id": "p02576", "language": "python", "submission_id_v0": "s578033438", "submission_id_v1": "s457299018", "cpu_time_v0": 28, "cpu_time_v1": 25, "memory_v0": 9032, "memory_v1": 9096, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.71, "input": "array = list(map(int, input().split()))\n\nif array[0] % array[1] > 0:\n\n print(((array[0] // array[1] + 1) * array[2]))\n\nelse:\n\n print(((array[0] // array[1]) * array[2]))", "target": "n, x, t = list(map(int, input().split()))\n\n\n\nprint((0--n//x*t))", "code_v0_loc": 5, "code_v1_loc": 3, "code_v0_num_chars": 171, "code_v1_num_chars": 55, "code_v0_no_empty_lines": "array = list(map(int, input().split()))\nif array[0] % array[1] > 0:\n print(((array[0] // array[1] + 1) * array[2]))\nelse:\n print(((array[0] // array[1]) * array[2]))\n", "code_v1_no_empty_lines": "n, x, t = list(map(int, input().split()))\nprint((0 - -n // x * t))\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-array = list(map(int, input().split()))", "-if array[0] % array[1] > 0:", "- print(((array[0] // array[1] + 1) * array[2]))", "-else:", "- print(((array[0] // array[1]) * array[2]))", "+n, x, t = list(map(int, input().split()))", "+print((0 - -n // x * t))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1827679622, "measured_runtime_v1": 0.0061908547, "runtime_lift": 29.5222502437, "key": ["s578033438", "s457299018"]} +{"user_id": "u153665391", "problem_id": "p02268", "language": "python", "submission_id_v0": "s156684058", "submission_id_v1": "s820654012", "cpu_time_v0": 520, "cpu_time_v1": 390, "memory_v0": 16712, "memory_v1": 16712, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "N = int(input())\n\nS = list(map(int, input().split()))\n\nQ = int(input())\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n idx = int((head+tail)/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n if head == idx:\n\n return False\n\n return binary_search(target_num, head, idx-1)\n\n else:\n\n if tail == idx:\n\n return False\n\n return binary_search(target_num, idx+1, tail)\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n", "target": "N = int(input())\n\nS = list(map(int, input().split()))\n\nQ = int(input())\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n while head <= tail:\n\n idx = int((head+tail)/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n tail = idx - 1\n\n else:\n\n head = idx + 1\n\n return False\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 634, "code_v1_num_chars": 541, "code_v0_no_empty_lines": "N = int(input())\nS = list(map(int, input().split()))\nQ = int(input())\nT = list(map(int, input().split()))\n\n\ndef binary_search(target_num, head, tail):\n idx = int((head + tail) / 2)\n if target_num == S[idx]:\n return True\n elif target_num < S[idx]:\n if head == idx:\n return False\n return binary_search(target_num, head, idx - 1)\n else:\n if tail == idx:\n return False\n return binary_search(target_num, idx + 1, tail)\n\n\nmatch_count = 0\nfor target_num in T:\n if binary_search(target_num, 0, len(S) - 1):\n match_count += 1\nprint((str(match_count)))\n", "code_v1_no_empty_lines": "N = int(input())\nS = list(map(int, input().split()))\nQ = int(input())\nT = list(map(int, input().split()))\n\n\ndef binary_search(target_num, head, tail):\n while head <= tail:\n idx = int((head + tail) / 2)\n if target_num == S[idx]:\n return True\n elif target_num < S[idx]:\n tail = idx - 1\n else:\n head = idx + 1\n return False\n\n\nmatch_count = 0\nfor target_num in T:\n if binary_search(target_num, 0, len(S) - 1):\n match_count += 1\nprint((str(match_count)))\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- idx = int((head + tail) / 2)", "- if target_num == S[idx]:", "- return True", "- elif target_num < S[idx]:", "- if head == idx:", "- return False", "- return binary_search(target_num, head, idx - 1)", "- else:", "- if tail == idx:", "- return False", "- return binary_search(target_num, idx + 1, tail)", "+ while head <= tail:", "+ idx = int((head + tail) / 2)", "+ if target_num == S[idx]:", "+ return True", "+ elif target_num < S[idx]:", "+ tail = idx - 1", "+ else:", "+ head = idx + 1", "+ return False"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3635195796, "measured_runtime_v1": 0.2206529045, "runtime_lift": 1.6474724429, "key": ["s156684058", "s820654012"]} +{"user_id": "u924353076", "problem_id": "p03796", "language": "python", "submission_id_v0": "s982585501", "submission_id_v1": "s413088188", "cpu_time_v0": 118, "cpu_time_v1": 40, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.1, "input": "n=input()\n\nn=int(n)\n\na=1\n\nfor i in range(n):\n\n a=a*(i+1)\n\n if a>=pow(10,9)+7:\n\n a=a%(pow(10,9)+7)\n\nprint(a)", "target": "n=int(input())\n\na=1\n\nfor i in range(1,n+1):\n\n a*=i\n\n a %= (10**9+7)\n\nprint(a)", "code_v0_loc": 8, "code_v1_loc": 6, "code_v0_num_chars": 120, "code_v1_num_chars": 83, "code_v0_no_empty_lines": "n = input()\nn = int(n)\na = 1\nfor i in range(n):\n a = a * (i + 1)\n if a >= pow(10, 9) + 7:\n a = a % (pow(10, 9) + 7)\nprint(a)\n", "code_v1_no_empty_lines": "n = int(input())\na = 1\nfor i in range(1, n + 1):\n a *= i\n a %= 10**9 + 7\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-n = input()", "-n = int(n)", "+n = int(input())", "-for i in range(n):", "- a = a * (i + 1)", "- if a >= pow(10, 9) + 7:", "- a = a % (pow(10, 9) + 7)", "+for i in range(1, n + 1):", "+ a *= i", "+ a %= 10**9 + 7"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4161043401, "measured_runtime_v1": 0.2489673834, "runtime_lift": 1.6713206943, "key": ["s982585501", "s413088188"]} +{"user_id": "u935184340", "problem_id": "p00003", "language": "python", "submission_id_v0": "s695745765", "submission_id_v1": "s444816349", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 7832, "memory_v1": 7708, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "import sys\n\nr = []\n\nn = int(input())\n\nl = sys.stdin.readlines()\n\nfor i in l:\n\n x, y, z = sorted([x*x for x in list(map(int, i.split()))])\n\n if x + y == z:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")", "target": "import sys\n\n\n\nn = int(input())\n\nl = sys.stdin.readlines()\n\ns = \"\"\n\nfor i in l:\n\n x, y, z = sorted(map(lambda x:x*x,map(int, i.split())))\n\n if x + y == z:\n\n s += \"YES\\n\"\n\n else:\n\n s += \"NO\\n\"\n\n\n\nprint(s,end=\"\")\n", "code_v0_loc": 10, "code_v1_loc": 13, "code_v0_num_chars": 201, "code_v1_num_chars": 222, "code_v0_no_empty_lines": "import sys\n\nr = []\nn = int(input())\nl = sys.stdin.readlines()\nfor i in l:\n x, y, z = sorted([x * x for x in list(map(int, i.split()))])\n if x + y == z:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nn = int(input())\nl = sys.stdin.readlines()\ns = \"\"\nfor i in l:\n x, y, z = sorted(map(lambda x: x * x, map(int, i.split())))\n if x + y == z:\n s += \"YES\\n\"\n else:\n s += \"NO\\n\"\nprint(s, end=\"\")\n", "code_same": false, "relative_loc_diff_percent": 23.0769230769, "diff": ["-r = []", "-n = int(input())", "+n = int(input())", "+s = \"\"", "- x, y, z = sorted([x * x for x in list(map(int, i.split()))])", "+ x, y, z = sorted(map(lambda x: x * x, map(int, i.split())))", "- print(\"YES\")", "+ s += \"YES\\n\"", "- print(\"NO\")", "+ s += \"NO\\n\"", "+print(s, end=\"\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3577006006, "measured_runtime_v1": 0.2704619627, "runtime_lift": 1.3225541848, "key": ["s695745765", "s444816349"]} +{"user_id": "u887207211", "problem_id": "p03086", "language": "python", "submission_id_v0": "s916999030", "submission_id_v1": "s575230730", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "import re\n\nptn = re.compile(r\"(A|C|G|T)*\")\n\n\n\nS = input()\n\n\n\nans = 0\n\nfor i in range(len(S)):\n\n for j in range(len(S)):\n\n x = ptn.match(S[i:i+j+1]).group(0)\n\n if(x):\n\n ans = max(ans, len(x))\n\nprint(ans)", "target": "import sys\n\n\n\nstdin = sys.stdin\n\n\n\nns = lambda : stdin.readline().rstrip()\n\nni = lambda : int(ns())\n\nna = lambda : list(map(int, stdin.readline().split()))\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef check(In):\n\n return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"\n\n\n\ndef main():\n\n s = ns()\n\n\n\n count = 0\n\n ans = 0\n\n for i in range(len(s)):\n\n if check(s[i]):\n\n count = 0\n\n else:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 12, "code_v1_loc": 27, "code_v0_num_chars": 214, "code_v1_num_chars": 537, "code_v0_no_empty_lines": "import re\n\nptn = re.compile(r\"(A|C|G|T)*\")\nS = input()\nans = 0\nfor i in range(len(S)):\n for j in range(len(S)):\n x = ptn.match(S[i : i + j + 1]).group(0)\n if x:\n ans = max(ans, len(x))\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nstdin = sys.stdin\nns = lambda: stdin.readline().rstrip()\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nsys.setrecursionlimit(10**7)\n\n\ndef check(In):\n return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"\n\n\ndef main():\n s = ns()\n count = 0\n ans = 0\n for i in range(len(s)):\n if check(s[i]):\n count = 0\n else:\n count += 1\n ans = max(ans, count)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-import re", "+import sys", "-ptn = re.compile(r\"(A|C|G|T)*\")", "-S = input()", "-ans = 0", "-for i in range(len(S)):", "- for j in range(len(S)):", "- x = ptn.match(S[i : i + j + 1]).group(0)", "- if x:", "- ans = max(ans, len(x))", "-print(ans)", "+stdin = sys.stdin", "+ns = lambda: stdin.readline().rstrip()", "+ni = lambda: int(ns())", "+na = lambda: list(map(int, stdin.readline().split()))", "+sys.setrecursionlimit(10**7)", "+", "+", "+def check(In):", "+ return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"", "+", "+", "+def main():", "+ s = ns()", "+ count = 0", "+ ans = 0", "+ for i in range(len(s)):", "+ if check(s[i]):", "+ count = 0", "+ else:", "+ count += 1", "+ ans = max(ans, count)", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3654596429, "measured_runtime_v1": 0.2052364919, "runtime_lift": 1.7806757436, "key": ["s916999030", "s575230730"]} +{"user_id": "u489959379", "problem_id": "p03371", "language": "python", "submission_id_v0": "s775348159", "submission_id_v1": "s575049266", "cpu_time_v0": 62, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.58, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nab = c * 2\n\n\n\nres = float(\"inf\")\n\nif a + b <= ab:\n\n res = x * a + y * b\n\nelse:\n\n if x == y:\n\n res = x * ab\n\n elif x > y:\n\n for i in range(y, x + 1):\n\n cost = i * ab + (x - i) * a\n\n res = min(res, cost)\n\n else:\n\n for i in range(x, y + 1):\n\n cost = i * ab + (y - i) * b\n\n res = min(res, cost)\n\nprint(res)\n", "target": "import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\ninput = sys.stdin.readline\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n c *= 2\n\n if a + b > c:\n\n cost1 = max(x, y) * c\n\n cost2 = min(x, y) * c\n\n plus = ((y - x) * b) if x < y else (x - y) * a\n\n res = min(cost1, cost2 + plus)\n\n else:\n\n res = x * a + y * b\n\n print(res)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "code_v0_loc": 18, "code_v1_loc": 22, "code_v0_num_chars": 423, "code_v1_num_chars": 471, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nab = c * 2\nres = float(\"inf\")\nif a + b <= ab:\n res = x * a + y * b\nelse:\n if x == y:\n res = x * ab\n elif x > y:\n for i in range(y, x + 1):\n cost = i * ab + (x - i) * a\n res = min(res, cost)\n else:\n for i in range(x, y + 1):\n cost = i * ab + (y - i) * b\n res = min(res, cost)\nprint(res)\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef resolve():\n a, b, c, x, y = list(map(int, input().split()))\n c *= 2\n if a + b > c:\n cost1 = max(x, y) * c\n cost2 = min(x, y) * c\n plus = ((y - x) * b) if x < y else (x - y) * a\n res = min(cost1, cost2 + plus)\n else:\n res = x * a + y * b\n print(res)\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-a, b, c, x, y = list(map(int, input().split()))", "-ab = c * 2", "-res = float(\"inf\")", "-if a + b <= ab:", "- res = x * a + y * b", "-else:", "- if x == y:", "- res = x * ab", "- elif x > y:", "- for i in range(y, x + 1):", "- cost = i * ab + (x - i) * a", "- res = min(res, cost)", "+import sys", "+", "+sys.setrecursionlimit(10**7)", "+input = sys.stdin.readline", "+f_inf = float(\"inf\")", "+mod = 10**9 + 7", "+", "+", "+def resolve():", "+ a, b, c, x, y = list(map(int, input().split()))", "+ c *= 2", "+ if a + b > c:", "+ cost1 = max(x, y) * c", "+ cost2 = min(x, y) * c", "+ plus = ((y - x) * b) if x < y else (x - y) * a", "+ res = min(cost1, cost2 + plus)", "- for i in range(x, y + 1):", "- cost = i * ab + (y - i) * b", "- res = min(res, cost)", "-print(res)", "+ res = x * a + y * b", "+ print(res)", "+", "+", "+if __name__ == \"__main__\":", "+ resolve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3014842281, "measured_runtime_v1": 0.1645996099, "runtime_lift": 1.8316217662, "key": ["s775348159", "s575049266"]} +{"user_id": "u243699903", "problem_id": "p03371", "language": "python", "submission_id_v0": "s088381244", "submission_id_v1": "s357905210", "cpu_time_v0": 104, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.65, "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nans=a*x+b*y\n\nfor ci in range(max(x,y)+1):\n\n sumc = 2*ci*c\n\n sumc += (x-ci)*a if (x-ci)>0 else 0\n\n sumc += (y-ci)*b if (y-ci)>0 else 0\n\n ans=min(ans,sumc)\n\n\n\nprint(ans)", "target": "a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nif x==y:\n\n ans=min(ans,2*x*c)\n\nelif x>y:\n\n ans=min(ans,a*(x-y)+2*y*c)\n\n ans=min(ans,2*x*c)\n\nelse:\n\n ans=min(ans,b*(y-x)+2*x*c)\n\n ans=min(ans,2*y*c)\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 11, "code_v0_num_chars": 217, "code_v1_num_chars": 223, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nfor ci in range(max(x, y) + 1):\n sumc = 2 * ci * c\n sumc += (x - ci) * a if (x - ci) > 0 else 0\n sumc += (y - ci) * b if (y - ci) > 0 else 0\n ans = min(ans, sumc)\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nif x == y:\n ans = min(ans, 2 * x * c)\nelif x > y:\n ans = min(ans, a * (x - y) + 2 * y * c)\n ans = min(ans, 2 * x * c)\nelse:\n ans = min(ans, b * (y - x) + 2 * x * c)\n ans = min(ans, 2 * y * c)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-for ci in range(max(x, y) + 1):", "- sumc = 2 * ci * c", "- sumc += (x - ci) * a if (x - ci) > 0 else 0", "- sumc += (y - ci) * b if (y - ci) > 0 else 0", "- ans = min(ans, sumc)", "+if x == y:", "+ ans = min(ans, 2 * x * c)", "+elif x > y:", "+ ans = min(ans, a * (x - y) + 2 * y * c)", "+ ans = min(ans, 2 * x * c)", "+else:", "+ ans = min(ans, b * (y - x) + 2 * x * c)", "+ ans = min(ans, 2 * y * c)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2025436199, "measured_runtime_v1": 0.1559800074, "runtime_lift": 1.2985229532, "key": ["s088381244", "s357905210"]} +{"user_id": "u260980560", "problem_id": "p01105", "language": "python", "submission_id_v0": "s936098014", "submission_id_v1": "s480075396", "cpu_time_v0": 50, "cpu_time_v1": 40, "memory_v0": 8604, "memory_v1": 8508, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.0, "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p ^ e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&%s\"%\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n", "target": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nQ = [(1, a), (1, b), (1, c), (1, d)]\n\nL = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n l < 15 and heappush(Q, (l+1, p ^ e))\n\n if l < 13:\n\n li = 13-l; l3 = 3+l\n\n for q, r in H:\n\n if r <= li:\n\n k = p & q\n\n if r < get(k, 17)-l3:\n\n L[k] = l3+r\n\n r < li and heappush(Q, (l3+r, k))\n\n k = p ^ q\n\n if r < get(k, 17)-l3:\n\n L[k] = l3+r\n\n r < li and heappush(Q, (l3+r, k))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&\"+\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n", "code_v0_loc": 26, "code_v1_loc": 28, "code_v0_num_chars": 917, "code_v1_num_chars": 953, "code_v0_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\nQ = [(1, el) for el in base]\nL = {el: 1 for el in base}\nH = []\nget = L.get\npush = H.append\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < get(p ^ e, 17):\n L[p ^ e] = l + 1\n if l + 1 < 16:\n heappush(Q, (l + 1, p ^ e))\n if l + 3 < 16:\n for q, r in H:\n if l + r + 3 <= 16:\n if l + r + 3 < get(p & q, 17):\n L[p & q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p & q))\n if l + r + 3 < get(p ^ q, 17):\n L[p ^ q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p ^ q))\n else:\n break\n if l < 7:\n push((p, l))\nprint(\n *map(\n L.__getitem__,\n eval(\n \"e&%s\"\n % \",e&\".join(\n open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]\n )\n ),\n ),\n sep=\"\\n\"\n)\n", "code_v1_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nQ = [(1, a), (1, b), (1, c), (1, d)]\nL = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}\nH = []\nget = L.get\npush = H.append\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < get(p ^ e, 17):\n L[p ^ e] = l + 1\n l < 15 and heappush(Q, (l + 1, p ^ e))\n if l < 13:\n li = 13 - l\n l3 = 3 + l\n for q, r in H:\n if r <= li:\n k = p & q\n if r < get(k, 17) - l3:\n L[k] = l3 + r\n r < li and heappush(Q, (l3 + r, k))\n k = p ^ q\n if r < get(k, 17) - l3:\n L[k] = l3 + r\n r < li and heappush(Q, (l3 + r, k))\n else:\n break\n if l < 7:\n push((p, l))\nprint(\n *map(\n L.__getitem__,\n eval(\n \"e&\"\n + \",e&\".join(\n open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]\n )\n ),\n ),\n sep=\"\\n\"\n)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-base = [a, b, c, d, e, 0]", "-Q = [(1, el) for el in base]", "-L = {el: 1 for el in base}", "+Q = [(1, a), (1, b), (1, c), (1, d)]", "+L = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}", "- if l + 1 < 16:", "- heappush(Q, (l + 1, p ^ e))", "- if l + 3 < 16:", "+ l < 15 and heappush(Q, (l + 1, p ^ e))", "+ if l < 13:", "+ li = 13 - l", "+ l3 = 3 + l", "- if l + r + 3 <= 16:", "- if l + r + 3 < get(p & q, 17):", "- L[p & q] = l + r + 3", "- if l + r + 3 < 16:", "- heappush(Q, (l + r + 3, p & q))", "- if l + r + 3 < get(p ^ q, 17):", "- L[p ^ q] = l + r + 3", "- if l + r + 3 < 16:", "- heappush(Q, (l + r + 3, p ^ q))", "+ if r <= li:", "+ k = p & q", "+ if r < get(k, 17) - l3:", "+ L[k] = l3 + r", "+ r < li and heappush(Q, (l3 + r, k))", "+ k = p ^ q", "+ if r < get(k, 17) - l3:", "+ L[k] = l3 + r", "+ r < li and heappush(Q, (l3 + r, k))", "- \"e&%s\"", "- % \",e&\".join(", "+ \"e&\"", "+ + \",e&\".join("], "diff_only_import_comment": false, "measured_runtime_v0": 0.4434673564, "measured_runtime_v1": 0.3305070457, "runtime_lift": 1.3417788278, "key": ["s936098014", "s480075396"]} +{"user_id": "u638795007", "problem_id": "p04020", "language": "python", "submission_id_v0": "s043977447", "submission_id_v1": "s372001933", "cpu_time_v0": 265, "cpu_time_v1": 111, "memory_v0": 44252, "memory_v1": 8004, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.11, "input": "def examB():\n\n N = I(); A = [I() for _ in range(N)]\n\n ans = 0; cur= 0\n\n for i in A:\n\n if i==0:\n\n ans += cur//2\n\n cur = 0\n\n else:\n\n cur += i\n\n ans += cur // 2\n\n print(ans)\n\n return\n\n\n\nimport sys,copy,bisect,itertools,heapq,math\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\n\n\nif __name__ == '__main__':\n\n examB()\n", "target": "def examA():\n\n S = SI()\n\n if \"W\" in S and not \"E\" in S:\n\n print(\"No\")\n\n elif \"E\" in S and not \"W\" in S:\n\n print(\"No\")\n\n elif \"N\" in S and not \"S\" in S:\n\n print(\"No\")\n\n elif \"S\" in S and not \"N\" in S:\n\n print(\"No\")\n\n else:\n\n print(\"Yes\")\n\n return\n\n\n\ndef examB():\n\n N = I()\n\n A = [I()for _ in range(N)]\n\n ans = 0\n\n for i in range(N-1):\n\n ans += A[i]//2\n\n if A[i]%2 and A[i+1]>=1:\n\n ans += 1\n\n A[i+1] -= 1\n\n ans += A[N-1]//2\n\n print(ans)\n\n return\n\n\n\ndef examC():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examD():\n\n N = I()\n\n S = [I()for _ in range(N)]\n\n\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examE():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examF():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\nimport sys,bisect,itertools,heapq,math,random\n\nfrom copy import deepcopy\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nglobal mod,mod2,inf,alphabet,_ep\n\nmod = 10**9 + 7\n\nmod2 = 998244353\n\ninf = 10**18\n\n_ep = 10**(-12)\n\nalphabet = [chr(ord('a') + i) for i in range(26)]\n\n\n\nsys.setrecursionlimit(10**6)\n\n\n\nif __name__ == '__main__':\n\n examB()\n\n\n\n\"\"\"\n\n\n\n\"\"\"", "code_v0_loc": 26, "code_v1_loc": 74, "code_v0_num_chars": 729, "code_v1_num_chars": 1504, "code_v0_no_empty_lines": "def examB():\n N = I()\n A = [I() for _ in range(N)]\n ans = 0\n cur = 0\n for i in A:\n if i == 0:\n ans += cur // 2\n cur = 0\n else:\n cur += i\n ans += cur // 2\n print(ans)\n return\n\n\nimport sys, copy, bisect, itertools, heapq, math\nfrom heapq import heappop, heappush, heapify\nfrom collections import Counter, defaultdict, deque\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LSI():\n return list(map(str, sys.stdin.readline().split()))\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef SI():\n return sys.stdin.readline().strip()\n\n\nmod = 10**9 + 7\ninf = float(\"inf\")\nif __name__ == \"__main__\":\n examB()\n", "code_v1_no_empty_lines": "def examA():\n S = SI()\n if \"W\" in S and not \"E\" in S:\n print(\"No\")\n elif \"E\" in S and not \"W\" in S:\n print(\"No\")\n elif \"N\" in S and not \"S\" in S:\n print(\"No\")\n elif \"S\" in S and not \"N\" in S:\n print(\"No\")\n else:\n print(\"Yes\")\n return\n\n\ndef examB():\n N = I()\n A = [I() for _ in range(N)]\n ans = 0\n for i in range(N - 1):\n ans += A[i] // 2\n if A[i] % 2 and A[i + 1] >= 1:\n ans += 1\n A[i + 1] -= 1\n ans += A[N - 1] // 2\n print(ans)\n return\n\n\ndef examC():\n ans = 0\n print(ans)\n return\n\n\ndef examD():\n N = I()\n S = [I() for _ in range(N)]\n ans = 0\n print(ans)\n return\n\n\ndef examE():\n ans = 0\n print(ans)\n return\n\n\ndef examF():\n ans = 0\n print(ans)\n return\n\n\nimport sys, bisect, itertools, heapq, math, random\nfrom copy import deepcopy\nfrom heapq import heappop, heappush, heapify\nfrom collections import Counter, defaultdict, deque\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LSI():\n return list(map(str, sys.stdin.readline().split()))\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef SI():\n return sys.stdin.readline().strip()\n\n\nglobal mod, mod2, inf, alphabet, _ep\nmod = 10**9 + 7\nmod2 = 998244353\ninf = 10**18\n_ep = 10 ** (-12)\nalphabet = [chr(ord(\"a\") + i) for i in range(26)]\nsys.setrecursionlimit(10**6)\nif __name__ == \"__main__\":\n examB()\n\"\"\"\n\"\"\"\n", "code_same": false, "relative_loc_diff_percent": 64.8648648649, "diff": ["+def examA():", "+ S = SI()", "+ if \"W\" in S and not \"E\" in S:", "+ print(\"No\")", "+ elif \"E\" in S and not \"W\" in S:", "+ print(\"No\")", "+ elif \"N\" in S and not \"S\" in S:", "+ print(\"No\")", "+ elif \"S\" in S and not \"N\" in S:", "+ print(\"No\")", "+ else:", "+ print(\"Yes\")", "+ return", "+", "+", "- cur = 0", "- for i in A:", "- if i == 0:", "- ans += cur // 2", "- cur = 0", "- else:", "- cur += i", "- ans += cur // 2", "+ for i in range(N - 1):", "+ ans += A[i] // 2", "+ if A[i] % 2 and A[i + 1] >= 1:", "+ ans += 1", "+ A[i + 1] -= 1", "+ ans += A[N - 1] // 2", "-import sys, copy, bisect, itertools, heapq, math", "+def examC():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def examD():", "+ N = I()", "+ S = [I() for _ in range(N)]", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def examE():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def examF():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+import sys, bisect, itertools, heapq, math, random", "+from copy import deepcopy", "+global mod, mod2, inf, alphabet, _ep", "-inf = float(\"inf\")", "+mod2 = 998244353", "+inf = 10**18", "+_ep = 10 ** (-12)", "+alphabet = [chr(ord(\"a\") + i) for i in range(26)]", "+sys.setrecursionlimit(10**6)", "+\"\"\"", "+\"\"\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.1928541586, "measured_runtime_v1": 0.006450581, "runtime_lift": 29.8971764609, "key": ["s043977447", "s372001933"]} +{"user_id": "u193598069", "problem_id": "p03544", "language": "python", "submission_id_v0": "s403516424", "submission_id_v1": "s258691406", "cpu_time_v0": 27, "cpu_time_v1": 17, "memory_v0": 10740, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.04, "input": "N = int(input())\n\nL = [ 0 ] * 1000000\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n", "target": "N = int(input())\n\nL = [ 0 ] * (N+1)\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 129, "code_v1_num_chars": 127, "code_v0_no_empty_lines": "N = int(input())\nL = [0] * 1000000\nL[0] = 2\nL[1] = 1\nfor i in range(2, N + 1):\n L[i] = L[i - 2] + L[i - 1]\nprint((L[N]))\n", "code_v1_no_empty_lines": "N = int(input())\nL = [0] * (N + 1)\nL[0] = 2\nL[1] = 1\nfor i in range(2, N + 1):\n L[i] = L[i - 2] + L[i - 1]\nprint((L[N]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-L = [0] * 1000000", "+L = [0] * (N + 1)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4811118691, "measured_runtime_v1": 0.3226976706, "runtime_lift": 1.4909059249, "key": ["s403516424", "s258691406"]} +{"user_id": "u218834617", "problem_id": "p03013", "language": "python", "submission_id_v0": "s048931274", "submission_id_v1": "s960526895", "cpu_time_v0": 127, "cpu_time_v1": 59, "memory_v0": 17264, "memory_v1": 17228, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 53.54, "input": "import sys\n\nN,M=list(map(int,input().split()))\n\nS=set(map(int,sys.stdin))\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in S:\n\n a,b=b,0\n\n else:\n\n a,b=b,a+b\n\n\n\nprint((b%(10**9+7)))\n", "target": "import sys\n\n\n\nN,M=list(map(int,input().split()))\n\nbad=set(map(int,sys.stdin))\n\nMOD=10**9+7\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in bad:\n\n a,b=b,0\n\n if a==0:\n\n break\n\n else:\n\n a,b=b,(a+b)%MOD\n\n\n\nprint(b)\n", "code_v0_loc": 12, "code_v1_loc": 16, "code_v0_num_chars": 188, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "import sys\n\nN, M = list(map(int, input().split()))\nS = set(map(int, sys.stdin))\na, b = 0, 1\nfor i in range(1, N + 1):\n if i in S:\n a, b = b, 0\n else:\n a, b = b, a + b\nprint((b % (10**9 + 7)))\n", "code_v1_no_empty_lines": "import sys\n\nN, M = list(map(int, input().split()))\nbad = set(map(int, sys.stdin))\nMOD = 10**9 + 7\na, b = 0, 1\nfor i in range(1, N + 1):\n if i in bad:\n a, b = b, 0\n if a == 0:\n break\n else:\n a, b = b, (a + b) % MOD\nprint(b)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-S = set(map(int, sys.stdin))", "+bad = set(map(int, sys.stdin))", "+MOD = 10**9 + 7", "- if i in S:", "+ if i in bad:", "+ if a == 0:", "+ break", "- a, b = b, a + b", "-print((b % (10**9 + 7)))", "+ a, b = b, (a + b) % MOD", "+print(b)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3212681165, "measured_runtime_v1": 0.212405349, "runtime_lift": 1.5125236626, "key": ["s048931274", "s960526895"]} +{"user_id": "u813384600", "problem_id": "p01138", "language": "python", "submission_id_v0": "s409826221", "submission_id_v1": "s148489336", "cpu_time_v0": 6790, "cpu_time_v1": 260, "memory_v0": 9596, "memory_v1": 7608, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 96.17, "input": "import re\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = [0] * (24*60*60+1)\n\n for _ in range(n):\n\n h1,m1,s1,h2,m2,s2 = list(map(int, re.split(':| ', input())))\n\n l[h1*60*60 + m1*60 + s1] += 1\n\n l[h2*60*60 + m2*60 + s2] -= 1\n\n r = 0\n\n for i in range(24*60*60):\n\n l[i+1] += l[i]\n\n r = max(r, l[i+1])\n\n print(r)", "target": "while True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = []\n\n for _ in range(n):\n\n hms1, hms2 = input().split()\n\n l.append((hms1, True))\n\n l.append((hms2, False))\n\n l.sort()\n\n r, t = 0, 0\n\n for i in range(len(l)):\n\n if l[i][1]:\n\n t += 1\n\n else:\n\n t -= 1\n\n r = max(r, t)\n\n print(r)", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 386, "code_v1_num_chars": 383, "code_v0_no_empty_lines": "import re\n\nwhile True:\n n = int(input())\n if n == 0:\n break\n l = [0] * (24 * 60 * 60 + 1)\n for _ in range(n):\n h1, m1, s1, h2, m2, s2 = list(map(int, re.split(\":| \", input())))\n l[h1 * 60 * 60 + m1 * 60 + s1] += 1\n l[h2 * 60 * 60 + m2 * 60 + s2] -= 1\n r = 0\n for i in range(24 * 60 * 60):\n l[i + 1] += l[i]\n r = max(r, l[i + 1])\n print(r)\n", "code_v1_no_empty_lines": "while True:\n n = int(input())\n if n == 0:\n break\n l = []\n for _ in range(n):\n hms1, hms2 = input().split()\n l.append((hms1, True))\n l.append((hms2, False))\n l.sort()\n r, t = 0, 0\n for i in range(len(l)):\n if l[i][1]:\n t += 1\n else:\n t -= 1\n r = max(r, t)\n print(r)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-import re", "-", "- l = [0] * (24 * 60 * 60 + 1)", "+ l = []", "- h1, m1, s1, h2, m2, s2 = list(map(int, re.split(\":| \", input())))", "- l[h1 * 60 * 60 + m1 * 60 + s1] += 1", "- l[h2 * 60 * 60 + m2 * 60 + s2] -= 1", "- r = 0", "- for i in range(24 * 60 * 60):", "- l[i + 1] += l[i]", "- r = max(r, l[i + 1])", "+ hms1, hms2 = input().split()", "+ l.append((hms1, True))", "+ l.append((hms2, False))", "+ l.sort()", "+ r, t = 0, 0", "+ for i in range(len(l)):", "+ if l[i][1]:", "+ t += 1", "+ else:", "+ t -= 1", "+ r = max(r, t)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.2066217821, "measured_runtime_v1": 0.2932185929, "runtime_lift": 4.1150930102, "key": ["s409826221", "s148489336"]} +{"user_id": "u291766461", "problem_id": "p03074", "language": "python", "submission_id_v0": "s221518045", "submission_id_v1": "s305948108", "cpu_time_v0": 149, "cpu_time_v1": 123, "memory_v0": 4212, "memory_v1": 7884, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.45, "input": "N, K = list(map(int, input().split()))\n\nS = input()\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\nleft = 0\n\nright = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n\n\n next_left = i\n\n next_right = min(i + add, len(nums))\n\n\n\n while next_left > left:\n\n tmp -= nums[left]\n\n left += 1\n\n\n\n while next_right > right:\n\n tmp += nums[right]\n\n right += 1\n\n\n\n ans = max(ans, tmp)\n\nprint(ans)", "target": "N, K = list(map(int, input().split()))\n\nS = input()\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\ncsum = [0] * (len(nums) + 1)\n\nfor i in range(len(nums)):\n\n csum[i + 1] = csum[i] + nums[i]\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n left = i\n\n right = min(i + add, len(nums))\n\n tmp = csum[right] - csum[left]\n\n ans = max(ans, tmp)\n\nprint(ans)", "code_v0_loc": 37, "code_v1_loc": 30, "code_v0_num_chars": 647, "code_v1_num_chars": 587, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nS = input()\nnums = []\nnow = 1\ncnt = 0\nfor i in range(N):\n if S[i] == str(now):\n cnt += 1\n else:\n nums.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:\n nums.append(cnt)\nif len(nums) % 2 == 0:\n nums.append(0)\nadd = 2 * K + 1\nans = 0\nleft = 0\nright = 0\ntmp = 0\nfor i in range(0, len(nums), 2):\n next_left = i\n next_right = min(i + add, len(nums))\n while next_left > left:\n tmp -= nums[left]\n left += 1\n while next_right > right:\n tmp += nums[right]\n right += 1\n ans = max(ans, tmp)\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nS = input()\nnums = []\nnow = 1\ncnt = 0\nfor i in range(N):\n if S[i] == str(now):\n cnt += 1\n else:\n nums.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:\n nums.append(cnt)\nif len(nums) % 2 == 0:\n nums.append(0)\ncsum = [0] * (len(nums) + 1)\nfor i in range(len(nums)):\n csum[i + 1] = csum[i] + nums[i]\nadd = 2 * K + 1\nans = 0\ntmp = 0\nfor i in range(0, len(nums), 2):\n left = i\n right = min(i + add, len(nums))\n tmp = csum[right] - csum[left]\n ans = max(ans, tmp)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 18.9189189189, "diff": ["+csum = [0] * (len(nums) + 1)", "+for i in range(len(nums)):", "+ csum[i + 1] = csum[i] + nums[i]", "-left = 0", "-right = 0", "- next_left = i", "- next_right = min(i + add, len(nums))", "- while next_left > left:", "- tmp -= nums[left]", "- left += 1", "- while next_right > right:", "- tmp += nums[right]", "- right += 1", "+ left = i", "+ right = min(i + add, len(nums))", "+ tmp = csum[right] - csum[left]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2166490428, "measured_runtime_v1": 0.0894378448, "runtime_lift": 2.422341945, "key": ["s221518045", "s305948108"]} +{"user_id": "u242518667", "problem_id": "p03424", "language": "python", "submission_id_v0": "s488879497", "submission_id_v1": "s152130126", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "n=int(input())\n\ns=list(map(str,input().split()))\n\ntotal=[]\n\nfor i in range(n):\n\n if s[i] not in total:\n\n total.append(s[i])\n\nprint(('Three' if len(total)==3 else 'Four'))", "target": "input()\n\nl=list(map(str,input().split()))\n\nprint(('Three' if len(set(l))==3 else 'Four'))", "code_v0_loc": 7, "code_v1_loc": 3, "code_v0_num_chars": 178, "code_v1_num_chars": 81, "code_v0_no_empty_lines": "n = int(input())\ns = list(map(str, input().split()))\ntotal = []\nfor i in range(n):\n if s[i] not in total:\n total.append(s[i])\nprint((\"Three\" if len(total) == 3 else \"Four\"))\n", "code_v1_no_empty_lines": "input()\nl = list(map(str, input().split()))\nprint((\"Three\" if len(set(l)) == 3 else \"Four\"))\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-n = int(input())", "-s = list(map(str, input().split()))", "-total = []", "-for i in range(n):", "- if s[i] not in total:", "- total.append(s[i])", "-print((\"Three\" if len(total) == 3 else \"Four\"))", "+input()", "+l = list(map(str, input().split()))", "+print((\"Three\" if len(set(l)) == 3 else \"Four\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3119253957, "measured_runtime_v1": 0.2361336248, "runtime_lift": 1.3209698364, "key": ["s488879497", "s152130126"]} +{"user_id": "u607865971", "problem_id": "p03164", "language": "python", "submission_id_v0": "s900171177", "submission_id_v1": "s494365384", "cpu_time_v0": 1438, "cpu_time_v1": 1016, "memory_v0": 27184, "memory_v1": 19300, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.35, "input": "import sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = [float('inf')] * 1000 * 100*10\n\nvs = set()\n\nvs.add(0)\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n tmpDP = dp.copy()\n\n for vv in list(vs):\n\n if dp[vv + v] > dp[vv] + w:\n\n tmpDP[vv + v] = dp[vv] + w\n\n vs.add(vv + v)\n\n dp = tmpDP\n\n\n\n\n\nans = 0\n\nfor v in list(vs):\n\n if dp[v] <= W:\n\n ans = max(ans, v)\n\nprint(ans)\n", "target": "import sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = defaultdict(lambda: float('inf'))\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n add = defaultdict(lambda: float('inf'))\n\n for vv in list(dp.keys()):\n\n if dp[vv + v] > dp[vv] + w:\n\n add[vv + v] = dp[vv] + w\n\n dp.update(add)\n\n\n\nprint((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x:x[0])[0]))\n", "code_v0_loc": 37, "code_v1_loc": 29, "code_v0_num_chars": 908, "code_v1_num_chars": 876, "code_v0_no_empty_lines": "import sys\nfrom collections import Counter, deque, defaultdict\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\nfrom functools import reduce\nfrom math import ceil, floor, log10, log2, factorial\nfrom pprint import pprint\n\nsys.setrecursionlimit(1000000)\n# MOD = 10 ** 9 + 7\n# N = int(input())\n# A = [int(x) for x in input().split()]\n# V = [[0] * 100 for _ in range(100)]\n# A = [int(input()) for _ in range(N)]\nN, W = [int(x) for x in input().split()]\ndp = [float(\"inf\")] * 1000 * 100 * 10\nvs = set()\nvs.add(0)\ndp[0] = 0\nfor i in range(N):\n w, v = [int(x) for x in input().split()]\n tmpDP = dp.copy()\n for vv in list(vs):\n if dp[vv + v] > dp[vv] + w:\n tmpDP[vv + v] = dp[vv] + w\n vs.add(vv + v)\n dp = tmpDP\nans = 0\nfor v in list(vs):\n if dp[v] <= W:\n ans = max(ans, v)\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\nfrom collections import Counter, deque, defaultdict\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\nfrom functools import reduce\nfrom math import ceil, floor, log10, log2, factorial\nfrom pprint import pprint\n\nsys.setrecursionlimit(1000000)\n# MOD = 10 ** 9 + 7\n# N = int(input())\n# A = [int(x) for x in input().split()]\n# V = [[0] * 100 for _ in range(100)]\n# A = [int(input()) for _ in range(N)]\nN, W = [int(x) for x in input().split()]\ndp = defaultdict(lambda: float(\"inf\"))\ndp[0] = 0\nfor i in range(N):\n w, v = [int(x) for x in input().split()]\n add = defaultdict(lambda: float(\"inf\"))\n for vv in list(dp.keys()):\n if dp[vv + v] > dp[vv] + w:\n add[vv + v] = dp[vv] + w\n dp.update(add)\nprint((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x: x[0])[0]))\n", "code_same": false, "relative_loc_diff_percent": 21.6216216216, "diff": ["-dp = [float(\"inf\")] * 1000 * 100 * 10", "-vs = set()", "-vs.add(0)", "+dp = defaultdict(lambda: float(\"inf\"))", "- tmpDP = dp.copy()", "- for vv in list(vs):", "+ add = defaultdict(lambda: float(\"inf\"))", "+ for vv in list(dp.keys()):", "- tmpDP[vv + v] = dp[vv] + w", "- vs.add(vv + v)", "- dp = tmpDP", "-ans = 0", "-for v in list(vs):", "- if dp[v] <= W:", "- ans = max(ans, v)", "-print(ans)", "+ add[vv + v] = dp[vv] + w", "+ dp.update(add)", "+print((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x: x[0])[0]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5805827644, "measured_runtime_v1": 0.1952783756, "runtime_lift": 2.9731032046, "key": ["s900171177", "s494365384"]} +{"user_id": "u882209234", "problem_id": "p03796", "language": "python", "submission_id_v0": "s179415880", "submission_id_v1": "s895771571", "cpu_time_v0": 230, "cpu_time_v1": 42, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.74, "input": "from math import factorial\n\nN = int(input())\n\nprint((factorial(N) % (10**9 + 7)))", "target": "from math import factorial\n\nN = int(input())\n\nans = 1\n\nfor i in range(1,N+1):\n\n ans *= i % (10**9 + 7)\n\n ans %= 10**9 + 7\n\nprint(ans)", "code_v0_loc": 3, "code_v1_loc": 7, "code_v0_num_chars": 79, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "from math import factorial\n\nN = int(input())\nprint((factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "from math import factorial\n\nN = int(input())\nans = 1\nfor i in range(1, N + 1):\n ans *= i % (10**9 + 7)\n ans %= 10**9 + 7\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-print((factorial(N) % (10**9 + 7)))", "+ans = 1", "+for i in range(1, N + 1):", "+ ans *= i % (10**9 + 7)", "+ ans %= 10**9 + 7", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9434056597, "measured_runtime_v1": 0.3957924933, "runtime_lift": 2.3835865397, "key": ["s179415880", "s895771571"]} +{"user_id": "u146816547", "problem_id": "p00005", "language": "python", "submission_id_v0": "s153581221", "submission_id_v1": "s486237781", "cpu_time_v0": 30, "cpu_time_v1": 10, "memory_v0": 5872, "memory_v1": 6452, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.67, "input": "import math\n\nwhile True:\n\n\ttry:\n\n\t\tx,y = list(map(int,input().split()))\n\n\t\tprint('%d %d' % (math.gcd(x,y),x/math.gcd(x,y)*y))\n\n\texcept EOFError:\n\n\t\tbreak", "target": "def gcd(x, y):\n\n if y == 0:\n\n return x\n\n else:\n\n return gcd(y, x%y)\n\n\n\n\n\ndef lcm(x,y):\n\n return x/gcd(x, y)*y\n\n\n\n\n\nwhile True:\n\n try:\n\n x, y = list(map(int, input().split()))\n\n except EOFError:\n\n break\n\n\n\n print(\"%d %d\" % (gcd(x, y), lcm(x, y)))", "code_v0_loc": 7, "code_v1_loc": 18, "code_v0_num_chars": 165, "code_v1_num_chars": 288, "code_v0_no_empty_lines": "import math\n\nwhile True:\n try:\n x, y = list(map(int, input().split()))\n print(\"%d %d\" % (math.gcd(x, y), x / math.gcd(x, y) * y))\n except EOFError:\n break\n", "code_v1_no_empty_lines": "def gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\n\ndef lcm(x, y):\n return x / gcd(x, y) * y\n\n\nwhile True:\n try:\n x, y = list(map(int, input().split()))\n except EOFError:\n break\n print(\"%d %d\" % (gcd(x, y), lcm(x, y)))\n", "code_same": false, "relative_loc_diff_percent": 61.1111111111, "diff": ["-import math", "+def gcd(x, y):", "+ if y == 0:", "+ return x", "+ else:", "+ return gcd(y, x % y)", "+", "+", "+def lcm(x, y):", "+ return x / gcd(x, y) * y", "+", "- print(\"%d %d\" % (math.gcd(x, y), x / math.gcd(x, y) * y))", "+ print(\"%d %d\" % (gcd(x, y), lcm(x, y)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2843708012, "measured_runtime_v1": 0.2133130357, "runtime_lift": 1.3331149699, "key": ["s153581221", "s486237781"]} +{"user_id": "u111365362", "problem_id": "p02881", "language": "python", "submission_id_v0": "s326793866", "submission_id_v1": "s577051886", "cpu_time_v0": 202, "cpu_time_v1": 174, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.86, "input": "n = int(input())\n\nr = int(n**.5)\n\nfor i in range(r):\n\n if n % (r-i) == 0:\n\n print(( (r-i) + n//(r-i) - 2 ))\n\n break", "target": "n = int(input())\n\ns = int(n**.5)\n\nfor i in range(s):\n\n if n % (s-i) == 0:\n\n print(((s-i) + n // (s-i) - 2))\n\n break", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 120, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "n = int(input())\nr = int(n**0.5)\nfor i in range(r):\n if n % (r - i) == 0:\n print(((r - i) + n // (r - i) - 2))\n break\n", "code_v1_no_empty_lines": "n = int(input())\ns = int(n**0.5)\nfor i in range(s):\n if n % (s - i) == 0:\n print(((s - i) + n // (s - i) - 2))\n break\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-r = int(n**0.5)", "-for i in range(r):", "- if n % (r - i) == 0:", "- print(((r - i) + n // (r - i) - 2))", "+s = int(n**0.5)", "+for i in range(s):", "+ if n % (s - i) == 0:", "+ print(((s - i) + n // (s - i) - 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3217455449, "measured_runtime_v1": 0.1190871449, "runtime_lift": 2.7017655456, "key": ["s326793866", "s577051886"]} +{"user_id": "u670180528", "problem_id": "p03253", "language": "python", "submission_id_v0": "s289323588", "submission_id_v1": "s397757622", "cpu_time_v0": 97, "cpu_time_v1": 24, "memory_v0": 11252, "memory_v1": 3564, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.26, "input": "from collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:\n\n\t\treturn [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn //= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:\n\n\t\tret.append(n)\n\n\treturn ret\n\n\n\nn,m = list(map(int,input().split()))\n\nmod = 10**9+7\n\nif m==1:\n\n\tprint((1));exit()\n\n\n\nfactors = Counter(factorization(m))\n\nmx = n+max(factors.values())\n\n\n\nfac = [1]*(mx+1)\n\ninv = [1]*(mx+1)\n\nfor i in range(1,mx+1):\n\n\tfac[i] = fac[i-1] * i % mod\n\ninv[-1] = pow(fac[-1], mod - 2, mod)\n\nfor i in range(mx-1, -1, -1):\n\n\tinv[i] = inv[i+1] * (i+1) % mod\n\ndef cmb(n,r):\n\n\tassert n >= r >= 0\n\n\treturn fac[n] * inv[n-r] * inv[r] % mod\n\n\t\n\nans=1\n\nfor v in list(factors.values()):\n\n\tans*=cmb(n+v-1,v)\n\n\tans%=mod\n\n\n\nprint(ans)", "target": "from collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:return [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn //= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:ret.append(n)\n\n\treturn ret\n\n\t\n\nfrom operator import mul\n\nfrom functools import reduce\n\ndef cmb(n,r):\n\n\tif n < r:return 0\n\n\tr = min(n-r,r)\n\n\tif r==0:return 1\n\n\tu = reduce(mul, list(range(n, n-r, -1)))\n\n\td = reduce(mul, list(range(1,r+1)))\n\n\treturn u//d\n\n\n\ndef main():\n\n\tn,m = list(map(int,input().split()))\n\n\tmod = 10**9+7\n\n\tif m==1:\n\n\t\tprint((1))\n\n\t\texit()\n\n\tans=1\n\n\tfor v in list(Counter(factorization(m)).values()):\n\n\t\tans*=cmb(n+v-1,v)\n\n\t\tans%=mod\n\n\tprint(ans)\n\n\t\n\nif __name__==\"__main__\":main()", "code_v0_loc": 40, "code_v1_loc": 36, "code_v0_num_chars": 723, "code_v1_num_chars": 658, "code_v0_no_empty_lines": "from collections import Counter\n\n\ndef factorization(n) -> list:\n if n == 1:\n return [1]\n ret = []\n i = 2\n while i * i <= n:\n while n % i == 0:\n n //= i\n ret.append(i)\n i += 1\n if n != 1:\n ret.append(n)\n return ret\n\n\nn, m = list(map(int, input().split()))\nmod = 10**9 + 7\nif m == 1:\n print((1))\n exit()\nfactors = Counter(factorization(m))\nmx = n + max(factors.values())\nfac = [1] * (mx + 1)\ninv = [1] * (mx + 1)\nfor i in range(1, mx + 1):\n fac[i] = fac[i - 1] * i % mod\ninv[-1] = pow(fac[-1], mod - 2, mod)\nfor i in range(mx - 1, -1, -1):\n inv[i] = inv[i + 1] * (i + 1) % mod\n\n\ndef cmb(n, r):\n assert n >= r >= 0\n return fac[n] * inv[n - r] * inv[r] % mod\n\n\nans = 1\nfor v in list(factors.values()):\n ans *= cmb(n + v - 1, v)\n ans %= mod\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import Counter\n\n\ndef factorization(n) -> list:\n if n == 1:\n return [1]\n ret = []\n i = 2\n while i * i <= n:\n while n % i == 0:\n n //= i\n ret.append(i)\n i += 1\n if n != 1:\n ret.append(n)\n return ret\n\n\nfrom operator import mul\nfrom functools import reduce\n\n\ndef cmb(n, r):\n if n < r:\n return 0\n r = min(n - r, r)\n if r == 0:\n return 1\n u = reduce(mul, list(range(n, n - r, -1)))\n d = reduce(mul, list(range(1, r + 1)))\n return u // d\n\n\ndef main():\n n, m = list(map(int, input().split()))\n mod = 10**9 + 7\n if m == 1:\n print((1))\n exit()\n ans = 1\n for v in list(Counter(factorization(m)).values()):\n ans *= cmb(n + v - 1, v)\n ans %= mod\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-n, m = list(map(int, input().split()))", "-mod = 10**9 + 7", "-if m == 1:", "- print((1))", "- exit()", "-factors = Counter(factorization(m))", "-mx = n + max(factors.values())", "-fac = [1] * (mx + 1)", "-inv = [1] * (mx + 1)", "-for i in range(1, mx + 1):", "- fac[i] = fac[i - 1] * i % mod", "-inv[-1] = pow(fac[-1], mod - 2, mod)", "-for i in range(mx - 1, -1, -1):", "- inv[i] = inv[i + 1] * (i + 1) % mod", "+from operator import mul", "+from functools import reduce", "- assert n >= r >= 0", "- return fac[n] * inv[n - r] * inv[r] % mod", "+ if n < r:", "+ return 0", "+ r = min(n - r, r)", "+ if r == 0:", "+ return 1", "+ u = reduce(mul, list(range(n, n - r, -1)))", "+ d = reduce(mul, list(range(1, r + 1)))", "+ return u // d", "-ans = 1", "-for v in list(factors.values()):", "- ans *= cmb(n + v - 1, v)", "- ans %= mod", "-print(ans)", "+def main():", "+ n, m = list(map(int, input().split()))", "+ mod = 10**9 + 7", "+ if m == 1:", "+ print((1))", "+ exit()", "+ ans = 1", "+ for v in list(Counter(factorization(m)).values()):", "+ ans *= cmb(n + v - 1, v)", "+ ans %= mod", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4340592513, "measured_runtime_v1": 0.2881658652, "runtime_lift": 1.5062826786, "key": ["s289323588", "s397757622"]} +{"user_id": "u346812984", "problem_id": "p02725", "language": "python", "submission_id_v0": "s133823600", "submission_id_v1": "s446849062", "cpu_time_v0": 124, "cpu_time_v1": 97, "memory_v0": 26420, "memory_v1": 26444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.77, "input": "K, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\ndiff = A[0] + K - A[-1]\n\nans = A[-1] - A[0]\n\nfor i in range(1, N):\n\n dist = K - A[i] + A[i - 1]\n\n if dist < ans:\n\n ans = dist\n\n\n\nprint(ans)\n", "target": "import sys\n\n\n\n\n\ndef input():\n\n return sys.stdin.readline().strip()\n\n\n\n\n\ndef main():\n\n K, N = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n\n\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n\n print((min(min(ans), A[-1] - A[0])))\n\n\n\n\n\nmain()\n", "code_v0_loc": 11, "code_v1_loc": 16, "code_v0_num_chars": 226, "code_v1_num_chars": 274, "code_v0_no_empty_lines": "K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\ndiff = A[0] + K - A[-1]\nans = A[-1] - A[0]\nfor i in range(1, N):\n dist = K - A[i] + A[i - 1]\n if dist < ans:\n ans = dist\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n K, N = list(map(int, input().split()))\n A = list(map(int, input().split()))\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n print((min(min(ans), A[-1] - A[0])))\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 31.25, "diff": ["-K, N = list(map(int, input().split()))", "-A = list(map(int, input().split()))", "-diff = A[0] + K - A[-1]", "-ans = A[-1] - A[0]", "-for i in range(1, N):", "- dist = K - A[i] + A[i - 1]", "- if dist < ans:", "- ans = dist", "-print(ans)", "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "+def main():", "+ K, N = list(map(int, input().split()))", "+ A = list(map(int, input().split()))", "+ ans = [K - A[i] + A[i - 1] for i in range(1, N)]", "+ print((min(min(ans), A[-1] - A[0])))", "+", "+", "+main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2153115588, "measured_runtime_v1": 0.0063990955, "runtime_lift": 33.6471865365, "key": ["s133823600", "s446849062"]} +{"user_id": "u648881683", "problem_id": "p03371", "language": "python", "submission_id_v0": "s115897723", "submission_id_v1": "s652896869", "cpu_time_v0": 101, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.18, "input": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = float('inf')\n\n for i in range(0, max(X, Y)*2+1, 2):\n\n ans = min(A*max(X-i//2, 0)+B*max(Y-i//2, 0)+C*i, ans)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "target": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = 0\n\n if A+B > 2*C:\n\n ans = 2*C*min(X, Y)+min((A if X>Y else B)*abs(X-Y), 2*C*abs(X-Y))\n\n else:\n\n ans = A*X+B*Y\n\n \n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "code_v0_loc": 13, "code_v1_loc": 16, "code_v0_num_chars": 316, "code_v1_num_chars": 334, "code_v0_no_empty_lines": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = float(\"inf\")\n for i in range(0, max(X, Y) * 2 + 1, 2):\n ans = min(A * max(X - i // 2, 0) + B * max(Y - i // 2, 0) + C * i, ans)\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_v1_no_empty_lines": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = 0\n if A + B > 2 * C:\n ans = 2 * C * min(X, Y) + min(\n (A if X > Y else B) * abs(X - Y), 2 * C * abs(X - Y)\n )\n else:\n ans = A * X + B * Y\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 18.75, "diff": ["- ans = float(\"inf\")", "- for i in range(0, max(X, Y) * 2 + 1, 2):", "- ans = min(A * max(X - i // 2, 0) + B * max(Y - i // 2, 0) + C * i, ans)", "+ ans = 0", "+ if A + B > 2 * C:", "+ ans = 2 * C * min(X, Y) + min(", "+ (A if X > Y else B) * abs(X - Y), 2 * C * abs(X - Y)", "+ )", "+ else:", "+ ans = A * X + B * Y"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4475863097, "measured_runtime_v1": 0.2669118404, "runtime_lift": 1.6769069102, "key": ["s115897723", "s652896869"]} +{"user_id": "u556589653", "problem_id": "p03416", "language": "python", "submission_id_v0": "s253072561", "submission_id_v1": "s839464643", "cpu_time_v0": 58, "cpu_time_v1": 50, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n i = str(i)\n\n if i[0] == i[4]:\n\n if i[1] == i[3]:\n\n ans += 1\n\n else:\n\n ans += 0\n\n else:\n\n ans += 0\n\nprint(ans)", "target": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n k = str(i)\n\n if k[0] == k[4] and k[1] == k[3]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 7, "code_v0_num_chars": 227, "code_v1_num_chars": 148, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n i = str(i)\n if i[0] == i[4]:\n if i[1] == i[3]:\n ans += 1\n else:\n ans += 0\n else:\n ans += 0\nprint(ans)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n k = str(i)\n if k[0] == k[4] and k[1] == k[3]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.6666666667, "diff": ["- i = str(i)", "- if i[0] == i[4]:", "- if i[1] == i[3]:", "- ans += 1", "- else:", "- ans += 0", "- else:", "- ans += 0", "+ k = str(i)", "+ if k[0] == k[4] and k[1] == k[3]:", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1907642818, "measured_runtime_v1": 0.0059664835, "runtime_lift": 31.9726487264, "key": ["s253072561", "s839464643"]} +{"user_id": "u312025627", "problem_id": "p03568", "language": "python", "submission_id_v0": "s088632051", "submission_id_v1": "s935108099", "cpu_time_v0": 196, "cpu_time_v1": 167, "memory_v0": 41068, "memory_v1": 38256, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.8, "input": "def main():\n\n N = int(input())\n\n A = [int(i) for i in input().split()]\n\n if N == 1:\n\n return print(1 if A[0] % 2 == 0 else 2)\n\n ans = 0\n\n d = (-1, 0, 1)\n\n from itertools import product\n\n for i in product(range(3), repeat=N):\n\n cur = 1\n\n for j in range(N):\n\n cur *= (A[j] + d[i[j]])\n\n if cur % 2 == 0:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n N = int(input())\n\n A = [int(i) for i in input().split()]\n\n ans = 3**N\n\n cnt = len([a for a in A if a % 2 == 0])\n\n ans -= 2**cnt\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 19, "code_v1_loc": 11, "code_v0_num_chars": 443, "code_v1_num_chars": 217, "code_v0_no_empty_lines": "def main():\n N = int(input())\n A = [int(i) for i in input().split()]\n if N == 1:\n return print(1 if A[0] % 2 == 0 else 2)\n ans = 0\n d = (-1, 0, 1)\n from itertools import product\n\n for i in product(range(3), repeat=N):\n cur = 1\n for j in range(N):\n cur *= A[j] + d[i[j]]\n if cur % 2 == 0:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n N = int(input())\n A = [int(i) for i in input().split()]\n ans = 3**N\n cnt = len([a for a in A if a % 2 == 0])\n ans -= 2**cnt\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 42.1052631579, "diff": ["- N = int(input())", "+ N = int(input())", "- if N == 1:", "- return print(1 if A[0] % 2 == 0 else 2)", "- ans = 0", "- d = (-1, 0, 1)", "- from itertools import product", "-", "- for i in product(range(3), repeat=N):", "- cur = 1", "- for j in range(N):", "- cur *= A[j] + d[i[j]]", "- if cur % 2 == 0:", "- ans += 1", "+ ans = 3**N", "+ cnt = len([a for a in A if a % 2 == 0])", "+ ans -= 2**cnt"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4432550566, "measured_runtime_v1": 0.2109588499, "runtime_lift": 2.1011446393, "key": ["s088632051", "s935108099"]} +{"user_id": "u777923818", "problem_id": "p03425", "language": "python", "submission_id_v0": "s258539301", "submission_id_v1": "s541501179", "cpu_time_v0": 165, "cpu_time_v1": 142, "memory_v0": 3316, "memory_v1": 9336, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.94, "input": "# -*- coding: utf-8 -*-\n\nfrom collections import defaultdict\n\nfrom itertools import combinations\n\nN = int(input())\n\nC = [0, 0, 0, 0, 0, 0]\n\nD = defaultdict(int)\n\nfor i, m in enumerate(\"MARCH\", start=1):\n\n D[m] = i\n\n\n\nfor _ in range(N):\n\n C[D[input()[0]]] += 1\n\n\n\nans = 0\n\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n\n ans += C[a]*C[b]*C[c]\n\nprint(ans)", "target": "from collections import defaultdict\n\nfrom itertools import combinations\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nC = defaultdict(int)\n\nN = int(input())\n\nfor _ in range(N):\n\n C[input()[0]] += 1\n\n\n\nres = 0\n\nfor H in combinations(\"MARCH\", r=3):\n\n res += C[H[0]] * C[H[1]] * C[H[2]]\n\nprint(res)", "code_v0_loc": 16, "code_v1_loc": 13, "code_v0_num_chars": 363, "code_v1_num_chars": 310, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nfrom collections import defaultdict\nfrom itertools import combinations\n\nN = int(input())\nC = [0, 0, 0, 0, 0, 0]\nD = defaultdict(int)\nfor i, m in enumerate(\"MARCH\", start=1):\n D[m] = i\nfor _ in range(N):\n C[D[input()[0]]] += 1\nans = 0\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n ans += C[a] * C[b] * C[c]\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\nfrom itertools import combinations\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\nC = defaultdict(int)\nN = int(input())\nfor _ in range(N):\n C[input()[0]] += 1\nres = 0\nfor H in combinations(\"MARCH\", r=3):\n res += C[H[0]] * C[H[1]] * C[H[2]]\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 18.75, "diff": ["-# -*- coding: utf-8 -*-", "+", "+def inpl():", "+ return list(map(int, input().split()))", "+", "+", "+C = defaultdict(int)", "-C = [0, 0, 0, 0, 0, 0]", "-D = defaultdict(int)", "-for i, m in enumerate(\"MARCH\", start=1):", "- D[m] = i", "- C[D[input()[0]]] += 1", "-ans = 0", "-for a, b, c in combinations(list(range(1, 6)), r=3):", "- ans += C[a] * C[b] * C[c]", "-print(ans)", "+ C[input()[0]] += 1", "+res = 0", "+for H in combinations(\"MARCH\", r=3):", "+ res += C[H[0]] * C[H[1]] * C[H[2]]", "+print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.388673193, "measured_runtime_v1": 0.2150466468, "runtime_lift": 1.8073901578, "key": ["s258539301", "s541501179"]} +{"user_id": "u964904181", "problem_id": "p03796", "language": "python", "submission_id_v0": "s459904551", "submission_id_v1": "s685671735", "cpu_time_v0": 153, "cpu_time_v1": 46, "memory_v0": 9880, "memory_v1": 9092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 69.93, "input": "import math\n\n\n\nN = int(input())\n\n\n\nprint((math.factorial(N) % (1000000000 + 7)))\n", "target": "import math\n\n\n\nN = int(input())\n\n\n\np = 1\n\nfor i in range(2, N+1):\n\n p *= i\n\n p = p % (1000000000 + 7)\n\n \n\nprint(p)\n", "code_v0_loc": 5, "code_v1_loc": 10, "code_v0_num_chars": 79, "code_v1_num_chars": 118, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (1000000000 + 7)))\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\np = 1\nfor i in range(2, N + 1):\n p *= i\n p = p % (1000000000 + 7)\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-print((math.factorial(N) % (1000000000 + 7)))", "+p = 1", "+for i in range(2, N + 1):", "+ p *= i", "+ p = p % (1000000000 + 7)", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5259809067, "measured_runtime_v1": 0.2554857254, "runtime_lift": 2.0587487065, "key": ["s459904551", "s685671735"]} +{"user_id": "u127499732", "problem_id": "p03309", "language": "python", "submission_id_v0": "s031191514", "submission_id_v1": "s488102802", "cpu_time_v0": 214, "cpu_time_v1": 169, "memory_v0": 27212, "memory_v1": 25180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.03, "input": "def main():\n\n from statistics import median\n\n\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n m = int(median(a))\n\n\n\n ans = sum([abs(x - m) for x in a])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n if n % 2 == 0:\n\n ans = sum(a[n // 2:]) - sum(a[:n // 2])\n\n else:\n\n ans = sum(a[n // 2 + 1:]) - sum(a[:n // 2])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 281, "code_v1_num_chars": 311, "code_v0_no_empty_lines": "def main():\n from statistics import median\n\n (\n n,\n *a,\n ) = list(map(int, open(0).read().split()))\n a = [x - i for i, x in enumerate(a, 1)]\n a.sort()\n m = int(median(a))\n ans = sum([abs(x - m) for x in a])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n (\n n,\n *a,\n ) = list(map(int, open(0).read().split()))\n a = [x - i for i, x in enumerate(a, 1)]\n a.sort()\n if n % 2 == 0:\n ans = sum(a[n // 2 :]) - sum(a[: n // 2])\n else:\n ans = sum(a[n // 2 + 1 :]) - sum(a[: n // 2])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["- from statistics import median", "-", "- m = int(median(a))", "- ans = sum([abs(x - m) for x in a])", "+ if n % 2 == 0:", "+ ans = sum(a[n // 2 :]) - sum(a[: n // 2])", "+ else:", "+ ans = sum(a[n // 2 + 1 :]) - sum(a[: n // 2])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2784859991, "measured_runtime_v1": 0.2092100859, "runtime_lift": 1.3311308484, "key": ["s031191514", "s488102802"]} +{"user_id": "u159994501", "problem_id": "p03037", "language": "python", "submission_id_v0": "s060142514", "submission_id_v1": "s502871070", "cpu_time_v0": 326, "cpu_time_v1": 290, "memory_v0": 10996, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.04, "input": "N, M = list(map(int, input().split()))\n\nL, R = [], []\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n", "target": "N, M = list(map(int, input().split()))\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n", "code_v0_loc": 13, "code_v1_loc": 10, "code_v0_num_chars": 283, "code_v1_num_chars": 234, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL, R = [], []\nlow = -float(\"INF\")\nhigh = float(\"INF\")\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\n if l > low:\n low = l\n if r < high:\n high = r\nprint((max(0, high - low + 1)))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nlow = -float(\"INF\")\nhigh = float(\"INF\")\nfor i in range(M):\n l, r = list(map(int, input().split()))\n if l > low:\n low = l\n if r < high:\n high = r\nprint((max(0, high - low + 1)))\n", "code_same": false, "relative_loc_diff_percent": 23.0769230769, "diff": ["-L, R = [], []", "- L.append(l)", "- R.append(r)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2778050728, "measured_runtime_v1": 0.0913613791, "runtime_lift": 3.0407276614, "key": ["s060142514", "s502871070"]} +{"user_id": "u729133443", "problem_id": "p02555", "language": "python", "submission_id_v0": "s039277419", "submission_id_v1": "s210669705", "cpu_time_v0": 66, "cpu_time_v1": 51, "memory_v0": 29052, "memory_v1": 22328, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.73, "input": "a,b,c=1,0,0\n\nexec('a,b,c=b,c,(a+c)%(10**9+7);'*(int(input())-2))\n\nprint(c)", "target": "a,b,c=1,0,0\n\nexec('a,b,c=b,c,a+c;'*(int(input())-2))\n\nprint((c%(10**9+7)))", "code_v0_loc": 3, "code_v1_loc": 3, "code_v0_num_chars": 74, "code_v1_num_chars": 72, "code_v0_no_empty_lines": "a, b, c = 1, 0, 0\nexec(\"a,b,c=b,c,(a+c)%(10**9+7);\" * (int(input()) - 2))\nprint(c)\n", "code_v1_no_empty_lines": "a, b, c = 1, 0, 0\nexec(\"a,b,c=b,c,a+c;\" * (int(input()) - 2))\nprint((c % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-exec(\"a,b,c=b,c,(a+c)%(10**9+7);\" * (int(input()) - 2))", "-print(c)", "+exec(\"a,b,c=b,c,a+c;\" * (int(input()) - 2))", "+print((c % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4045331192, "measured_runtime_v1": 0.1489405618, "runtime_lift": 2.7160708565, "key": ["s039277419", "s210669705"]} +{"user_id": "u768896740", "problem_id": "p03371", "language": "python", "submission_id_v0": "s303630482", "submission_id_v1": "s785488691", "cpu_time_v0": 197, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.37, "input": "a, b, c, x, y = list(map(int, input().split()))\n\n\n\nz = max(x,y) * 2\n\nmin_sum = c * z\n\n\n\nfor i in range(z):\n\n r = max(0, y - i) * b\n\n t = max(0, x - i) * a\n\n sum = c * i * 2 + r + t\n\n if sum < min_sum:\n\n min_sum = sum\n\n\n\nprint(min_sum)", "target": "a,b,c,x,y = list(map(int, input().split()))\n\n\n\nplan_a = c * (2*x) + max(0, y-x) * b\n\nplan_b = c * (2*y) + max(0, x-y) * a\n\nplan_c = a * x + b * y\n\n\n\nprint((min(plan_a, plan_b, plan_c)))", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 247, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nz = max(x, y) * 2\nmin_sum = c * z\nfor i in range(z):\n r = max(0, y - i) * b\n t = max(0, x - i) * a\n sum = c * i * 2 + r + t\n if sum < min_sum:\n min_sum = sum\nprint(min_sum)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nplan_a = c * (2 * x) + max(0, y - x) * b\nplan_b = c * (2 * y) + max(0, x - y) * a\nplan_c = a * x + b * y\nprint((min(plan_a, plan_b, plan_c)))\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["-z = max(x, y) * 2", "-min_sum = c * z", "-for i in range(z):", "- r = max(0, y - i) * b", "- t = max(0, x - i) * a", "- sum = c * i * 2 + r + t", "- if sum < min_sum:", "- min_sum = sum", "-print(min_sum)", "+plan_a = c * (2 * x) + max(0, y - x) * b", "+plan_b = c * (2 * y) + max(0, x - y) * a", "+plan_c = a * x + b * y", "+print((min(plan_a, plan_b, plan_c)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7115524154, "measured_runtime_v1": 0.3421670091, "runtime_lift": 2.0795471112, "key": ["s303630482", "s785488691"]} +{"user_id": "u488127128", "problem_id": "p03796", "language": "python", "submission_id_v0": "s349010345", "submission_id_v1": "s174569561", "cpu_time_v0": 35, "cpu_time_v1": 29, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.14, "input": "N = int(input())\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)", "target": "def factorial(N):\n\n a = 1\n\n for n in range(2,N+1):\n\n a = a*n % (10**9 + 7)\n\n return a\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "code_v0_loc": 5, "code_v1_loc": 9, "code_v0_num_chars": 82, "code_v1_num_chars": 178, "code_v0_no_empty_lines": "N = int(input())\na = 1\nfor n in range(2, N + 1):\n a = a * n % (10**9 + 7)\nprint(a)\n", "code_v1_no_empty_lines": "def factorial(N):\n a = 1\n for n in range(2, N + 1):\n a = a * n % (10**9 + 7)\n return a\n\n\nif __name__ == \"__main__\":\n N = int(input())\n print((factorial(N)))\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-N = int(input())", "-a = 1", "-for n in range(2, N + 1):", "- a = a * n % (10**9 + 7)", "-print(a)", "+def factorial(N):", "+ a = 1", "+ for n in range(2, N + 1):", "+ a = a * n % (10**9 + 7)", "+ return a", "+", "+", "+if __name__ == \"__main__\":", "+ N = int(input())", "+ print((factorial(N)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3416386657, "measured_runtime_v1": 0.2695478878, "runtime_lift": 1.2674507244, "key": ["s349010345", "s174569561"]} +{"user_id": "u102461423", "problem_id": "p03170", "language": "python", "submission_id_v0": "s503646377", "submission_id_v1": "s803807514", "cpu_time_v0": 1298, "cpu_time_v1": 123, "memory_v0": 3684, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 90.52, "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom operator import xor\n\nfrom functools import reduce\n\n\n\nN,K,*A = list(map(int,read().split()))\n\n\n\na = reduce(xor,(1<K:\n\n break\n\n dp[n+a]=1\n\n\n\nanswer = 'First' if dp[-1] else 'Second'\n\nprint(answer)", "code_v0_loc": 19, "code_v1_loc": 17, "code_v0_num_chars": 396, "code_v1_num_chars": 369, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom operator import xor\nfrom functools import reduce\n\nN, K, *A = list(map(int, read().split()))\na = reduce(xor, (1 << a for a in A))\ndp = 0 # bitset\nfor n in range(K):\n if not (dp & (1 << n)):\n dp |= a << n\nanswer = \"First\" if dp & (1 << K) else \"Second\"\nprint(answer)\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN, K, *A = list(map(int, read().split()))\ndp = [0] * (K + 1) # bitset\nfor n in range(K):\n if not dp[n]:\n for a in A:\n if n + a > K:\n break\n dp[n + a] = 1\nanswer = \"First\" if dp[-1] else \"Second\"\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 10.5263157895, "diff": ["-from operator import xor", "-from functools import reduce", "-", "-a = reduce(xor, (1 << a for a in A))", "-dp = 0 # bitset", "+dp = [0] * (K + 1) # bitset", "- if not (dp & (1 << n)):", "- dp |= a << n", "-answer = \"First\" if dp & (1 << K) else \"Second\"", "+ if not dp[n]:", "+ for a in A:", "+ if n + a > K:", "+ break", "+ dp[n + a] = 1", "+answer = \"First\" if dp[-1] else \"Second\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.510753959, "measured_runtime_v1": 0.2748723721, "runtime_lift": 1.8581494935, "key": ["s503646377", "s803807514"]} +{"user_id": "u102960641", "problem_id": "p02624", "language": "python", "submission_id_v0": "s523843051", "submission_id_v1": "s066295883", "cpu_time_v0": 36, "cpu_time_v1": 31, "memory_v0": 9312, "memory_v1": 9436, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.89, "input": "n = int(input())\n\nans = 0\n\nSQRT = int(n ** 0.5)\n\nfor m in range(1,SQRT + 1):\n\n b = int(n/m)\n\n ans += m * (m + b) * (b + 1 - m)\n\nans -= SQRT * (SQRT+1) * (2*SQRT+1) // 6\n\nprint(ans)", "target": "def main():\n\n n = int(input())\n\n ans = 0\n\n SQRT = int(n ** 0.5)\n\n for m in range(1,SQRT + 1):\n\n b = int(n/m)\n\n ans += m * (m + b) * (b + 1 - m)\n\n ans -= SQRT * (SQRT+1) * (2*SQRT+1) // 6\n\n print(ans)\n\nmain()\n", "code_v0_loc": 8, "code_v1_loc": 10, "code_v0_num_chars": 186, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "n = int(input())\nans = 0\nSQRT = int(n**0.5)\nfor m in range(1, SQRT + 1):\n b = int(n / m)\n ans += m * (m + b) * (b + 1 - m)\nans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6\nprint(ans)\n", "code_v1_no_empty_lines": "def main():\n n = int(input())\n ans = 0\n SQRT = int(n**0.5)\n for m in range(1, SQRT + 1):\n b = int(n / m)\n ans += m * (m + b) * (b + 1 - m)\n ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6\n print(ans)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-n = int(input())", "-ans = 0", "-SQRT = int(n**0.5)", "-for m in range(1, SQRT + 1):", "- b = int(n / m)", "- ans += m * (m + b) * (b + 1 - m)", "-ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6", "-print(ans)", "+def main():", "+ n = int(input())", "+ ans = 0", "+ SQRT = int(n**0.5)", "+ for m in range(1, SQRT + 1):", "+ b = int(n / m)", "+ ans += m * (m + b) * (b + 1 - m)", "+ ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6", "+ print(ans)", "+", "+", "+main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3880330081, "measured_runtime_v1": 0.212660579, "runtime_lift": 1.8246588529, "key": ["s523843051", "s066295883"]} +{"user_id": "u513081876", "problem_id": "p03828", "language": "python", "submission_id_v0": "s988350400", "submission_id_v1": "s443952708", "cpu_time_v0": 39, "cpu_time_v1": 35, "memory_v0": 3316, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.26, "input": "import math\n\nimport collections\n\n\n\nN = int(input())\n\na = math.factorial(N)\n\ncheck = []\n\nans = 1\n\ni = 2\n\n\n\nwhile a != 1:\n\n if a % i == 0:\n\n a //= i\n\n check.append(i)\n\n else:\n\n i += 1\n\n \n\ncheck = list(collections.Counter(check).values())\n\nfor i in check:\n\n ans *= (i+1)\n\n ans %= 10**9+7\n\nprint(ans)", "target": "from math import factorial\n\n\n\nN = factorial(int(input()))\n\n\n\ni = 2\n\ncheck = 1\n\nans = 1\n\nwhile N != 1:\n\n if N % i == 0:\n\n N //= i\n\n check += 1\n\n else:\n\n ans *= check\n\n check = 1\n\n i += 1\n\nprint(((ans*check)%(10**9+7)))", "code_v0_loc": 21, "code_v1_loc": 16, "code_v0_num_chars": 330, "code_v1_num_chars": 256, "code_v0_no_empty_lines": "import math\nimport collections\n\nN = int(input())\na = math.factorial(N)\ncheck = []\nans = 1\ni = 2\nwhile a != 1:\n if a % i == 0:\n a //= i\n check.append(i)\n else:\n i += 1\ncheck = list(collections.Counter(check).values())\nfor i in check:\n ans *= i + 1\n ans %= 10**9 + 7\nprint(ans)\n", "code_v1_no_empty_lines": "from math import factorial\n\nN = factorial(int(input()))\ni = 2\ncheck = 1\nans = 1\nwhile N != 1:\n if N % i == 0:\n N //= i\n check += 1\n else:\n ans *= check\n check = 1\n i += 1\nprint(((ans * check) % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 23.8095238095, "diff": ["-import math", "-import collections", "+from math import factorial", "-N = int(input())", "-a = math.factorial(N)", "-check = []", "+N = factorial(int(input()))", "+i = 2", "+check = 1", "-i = 2", "-while a != 1:", "- if a % i == 0:", "- a //= i", "- check.append(i)", "+while N != 1:", "+ if N % i == 0:", "+ N //= i", "+ check += 1", "+ ans *= check", "+ check = 1", "-check = list(collections.Counter(check).values())", "-for i in check:", "- ans *= i + 1", "- ans %= 10**9 + 7", "-print(ans)", "+print(((ans * check) % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1990540142, "measured_runtime_v1": 0.0063210642, "runtime_lift": 31.4905855295, "key": ["s988350400", "s443952708"]} +{"user_id": "u693694535", "problem_id": "p03371", "language": "python", "submission_id_v0": "s328045307", "submission_id_v1": "s953197610", "cpu_time_v0": 105, "cpu_time_v1": 26, "memory_v0": 9176, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.24, "input": "A,B,C,X,Y=list(map(int,input().split()))\n\n\n\nK=10**9\n\nfor i in range(10**5+1):\n\n S=i*2*C+max(0,X-i)*A+max(0,Y-i)*B\n\n K=min(K,S)\n\nprint(K)", "target": "A,B,C,X,Y=list(map(int,input().split()))\n\n\n\na=min(X,Y)*min(A+B,2*C)\n\n\n\na+=max(0,X-Y)*min(A,2*C)\n\na+=max(0,Y-X)*min(B,2*C)\n\n\n\n\n\nprint(a)", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 136, "code_v1_num_chars": 129, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nK = 10**9\nfor i in range(10**5 + 1):\n S = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n K = min(K, S)\nprint(K)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\na = min(X, Y) * min(A + B, 2 * C)\na += max(0, X - Y) * min(A, 2 * C)\na += max(0, Y - X) * min(B, 2 * C)\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-K = 10**9", "-for i in range(10**5 + 1):", "- S = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B", "- K = min(K, S)", "-print(K)", "+a = min(X, Y) * min(A + B, 2 * C)", "+a += max(0, X - Y) * min(A, 2 * C)", "+a += max(0, Y - X) * min(B, 2 * C)", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3979784026, "measured_runtime_v1": 0.2418090019, "runtime_lift": 5.7813331656, "key": ["s328045307", "s953197610"]} +{"user_id": "u365686736", "problem_id": "p02390", "language": "python", "submission_id_v0": "s143749551", "submission_id_v1": "s514847697", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7676, "memory_v1": 5584, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "S = int(input())\n\n\n\nif S >= 3600:\n\n h=S//3600\n\n m=S%3600//60\n\n s=S%60\n\nelif 3600 > S >= 60:\n\n h=0\n\n m=S//60\n\n s=S%60\n\nelse:\n\n h=m=0\n\n s=S\n\nprint(h, m, s, sep=\":\")\n", "target": "s = int(input())\n\nh = s // 3600\n\nm = (s - h * 3600) // 60\n\ns = s - h * 3600 - m * 60\n\nprint(h, m, s, sep=\":\")\n", "code_v0_loc": 14, "code_v1_loc": 5, "code_v0_num_chars": 186, "code_v1_num_chars": 110, "code_v0_no_empty_lines": "S = int(input())\nif S >= 3600:\n h = S // 3600\n m = S % 3600 // 60\n s = S % 60\nelif 3600 > S >= 60:\n h = 0\n m = S // 60\n s = S % 60\nelse:\n h = m = 0\n s = S\nprint(h, m, s, sep=\":\")\n", "code_v1_no_empty_lines": "s = int(input())\nh = s // 3600\nm = (s - h * 3600) // 60\ns = s - h * 3600 - m * 60\nprint(h, m, s, sep=\":\")\n", "code_same": false, "relative_loc_diff_percent": 64.2857142857, "diff": ["-S = int(input())", "-if S >= 3600:", "- h = S // 3600", "- m = S % 3600 // 60", "- s = S % 60", "-elif 3600 > S >= 60:", "- h = 0", "- m = S // 60", "- s = S % 60", "-else:", "- h = m = 0", "- s = S", "+s = int(input())", "+h = s // 3600", "+m = (s - h * 3600) // 60", "+s = s - h * 3600 - m * 60"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3295819011, "measured_runtime_v1": 0.255378567, "runtime_lift": 1.2905621053, "key": ["s143749551", "s514847697"]} +{"user_id": "u670180528", "problem_id": "p03806", "language": "python", "submission_id_v0": "s355426542", "submission_id_v1": "s468498336", "cpu_time_v0": 1133, "cpu_time_v1": 172, "memory_v0": 4980, "memory_v1": 4980, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.82, "input": "def main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1<<30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(400, -1, -1):\n\n\t\t\tfor j in range(400, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\nif __name__==\"__main__\":\n\n\tmain()", "target": "def main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1 << 30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tua = ub = 15\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(ua, -1, -1):\n\n\t\t\tfor j in range(ub, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\t\t\t\t\tif ua < i + a:\n\n\t\t\t\t\t\tua = i + a\n\n\t\t\t\t\tif ub < j + b:\n\n\t\t\t\t\t\tub = j + b\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()\n", "code_v0_loc": 21, "code_v1_loc": 27, "code_v0_num_chars": 492, "code_v1_num_chars": 590, "code_v0_no_empty_lines": "def main():\n n, ma, mb, *L = list(map(int, open(0).read().split()))\n M = 1 << 30\n dp = [[M] * 420 for _ in range(420)]\n dp[0][0] = 0\n for a, b, c in zip(*[iter(L)] * 3):\n for i in range(400, -1, -1):\n for j in range(400, -1, -1):\n t = dp[i][j] + c\n if dp[i + a][j + b] > t:\n dp[i + a][j + b] = t\n ans = M\n _ma, _mb = ma, mb\n while _ma < 410 > _mb:\n ans = min(ans, dp[_ma][_mb])\n _ma += ma\n _mb += mb\n print((ans if ans < M else -1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n n, ma, mb, *L = list(map(int, open(0).read().split()))\n M = 1 << 30\n dp = [[M] * 420 for _ in range(420)]\n dp[0][0] = 0\n ua = ub = 15\n for a, b, c in zip(*[iter(L)] * 3):\n for i in range(ua, -1, -1):\n for j in range(ub, -1, -1):\n t = dp[i][j] + c\n if dp[i + a][j + b] > t:\n dp[i + a][j + b] = t\n if ua < i + a:\n ua = i + a\n if ub < j + b:\n ub = j + b\n ans = M\n _ma, _mb = ma, mb\n while _ma < 410 > _mb:\n ans = min(ans, dp[_ma][_mb])\n _ma += ma\n _mb += mb\n print((ans if ans < M else -1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["+ ua = ub = 15", "- for i in range(400, -1, -1):", "- for j in range(400, -1, -1):", "+ for i in range(ua, -1, -1):", "+ for j in range(ub, -1, -1):", "+ if ua < i + a:", "+ ua = i + a", "+ if ub < j + b:", "+ ub = j + b"], "diff_only_import_comment": false, "measured_runtime_v0": 1.1710306553, "measured_runtime_v1": 0.275720624, "runtime_lift": 4.2471638081, "key": ["s355426542", "s468498336"]} +{"user_id": "u729133443", "problem_id": "p03434", "language": "python", "submission_id_v0": "s231475572", "submission_id_v1": "s619171000", "cpu_time_v0": 35, "cpu_time_v1": 30, "memory_v0": 9016, "memory_v1": 9012, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.29, "input": "_,s=open(c:=0)\n\nfor a in sorted(map(int,s.split())):c=a-c\n\nprint(c)", "target": "for a in sorted(map(int,[*open(c:=0)][1].split())):c=a-c\n\nprint(c)", "code_v0_loc": 3, "code_v1_loc": 2, "code_v0_num_chars": 67, "code_v1_num_chars": 66, "code_v0_no_empty_lines": "_, s = open(c := 0)\nfor a in sorted(map(int, s.split())):\n c = a - c\nprint(c)\n", "code_v1_no_empty_lines": "for a in sorted(map(int, [*open(c := 0)][1].split())):\n c = a - c\nprint(c)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-_, s = open(c := 0)", "-for a in sorted(map(int, s.split())):", "+for a in sorted(map(int, [*open(c := 0)][1].split())):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.269129122, "measured_runtime_v1": 0.112153646, "runtime_lift": 2.3996466598, "key": ["s231475572", "s619171000"]} +{"user_id": "u738622346", "problem_id": "p03854", "language": "python", "submission_id_v0": "s146499990", "submission_id_v1": "s321967328", "cpu_time_v0": 123, "cpu_time_v1": 50, "memory_v0": 3316, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.35, "input": "s = input()\n\nt = \"\"\n\nwhile len(t) < len(s):\n\n target_len = len(s) - len(t)\n\n\n\n if s[len(t)] == 'd':\n\n if target_len == 5:\n\n t += \"dream\"\n\n elif target_len == 7:\n\n t += \"dreamer\"\n\n elif target_len > 7:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 7 + 1] != \"era\":\n\n t += \"dreamer\"\n\n else:\n\n t += \"dream\"\n\n else:\n\n break\n\n else:\n\n if target_len == 5:\n\n t += \"erase\"\n\n elif target_len == 6:\n\n t += \"eraser\"\n\n elif target_len > 6:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 6 + 2] != \"era\":\n\n t += \"eraser\"\n\n else:\n\n t += \"erase\"\n\n else:\n\n break\n\n\n\n if s[0:len(t)] != t:\n\n break\n\n\n\nprint((\"YES\" if s == t else \"NO\"))\n", "target": "s = input()\n\ndiv = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\n\nrev = []\n\nt = \"\"\n\ns_rev = s[::-1]\n\nfor d in div:\n\n rev.append(d[::-1])\n\n\n\nresult = True\n\ni = 0\n\nwhile i < len(s):\n\n can_divide = False\n\n for d in rev:\n\n if len(s_rev) - i >= len(d) and s_rev[i:i + len(d)] == d:\n\n can_divide = True\n\n i += len(d)\n\n break\n\n if not can_divide:\n\n result = False\n\n break\n\n\n\nprint((\"YES\" if result else \"NO\"))\n", "code_v0_loc": 34, "code_v1_loc": 22, "code_v0_num_chars": 872, "code_v1_num_chars": 461, "code_v0_no_empty_lines": "s = input()\nt = \"\"\nwhile len(t) < len(s):\n target_len = len(s) - len(t)\n if s[len(t)] == \"d\":\n if target_len == 5:\n t += \"dream\"\n elif target_len == 7:\n t += \"dreamer\"\n elif target_len > 7:\n if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 7 + 1] != \"era\":\n t += \"dreamer\"\n else:\n t += \"dream\"\n else:\n break\n else:\n if target_len == 5:\n t += \"erase\"\n elif target_len == 6:\n t += \"eraser\"\n elif target_len > 6:\n if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 6 + 2] != \"era\":\n t += \"eraser\"\n else:\n t += \"erase\"\n else:\n break\n if s[0 : len(t)] != t:\n break\nprint((\"YES\" if s == t else \"NO\"))\n", "code_v1_no_empty_lines": "s = input()\ndiv = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nrev = []\nt = \"\"\ns_rev = s[::-1]\nfor d in div:\n rev.append(d[::-1])\nresult = True\ni = 0\nwhile i < len(s):\n can_divide = False\n for d in rev:\n if len(s_rev) - i >= len(d) and s_rev[i : i + len(d)] == d:\n can_divide = True\n i += len(d)\n break\n if not can_divide:\n result = False\n break\nprint((\"YES\" if result else \"NO\"))\n", "code_same": false, "relative_loc_diff_percent": 35.2941176471, "diff": ["+div = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]", "+rev = []", "-while len(t) < len(s):", "- target_len = len(s) - len(t)", "- if s[len(t)] == \"d\":", "- if target_len == 5:", "- t += \"dream\"", "- elif target_len == 7:", "- t += \"dreamer\"", "- elif target_len > 7:", "- if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 7 + 1] != \"era\":", "- t += \"dreamer\"", "- else:", "- t += \"dream\"", "- else:", "+s_rev = s[::-1]", "+for d in div:", "+ rev.append(d[::-1])", "+result = True", "+i = 0", "+while i < len(s):", "+ can_divide = False", "+ for d in rev:", "+ if len(s_rev) - i >= len(d) and s_rev[i : i + len(d)] == d:", "+ can_divide = True", "+ i += len(d)", "- else:", "- if target_len == 5:", "- t += \"erase\"", "- elif target_len == 6:", "- t += \"eraser\"", "- elif target_len > 6:", "- if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 6 + 2] != \"era\":", "- t += \"eraser\"", "- else:", "- t += \"erase\"", "- else:", "- break", "- if s[0 : len(t)] != t:", "+ if not can_divide:", "+ result = False", "-print((\"YES\" if s == t else \"NO\"))", "+print((\"YES\" if result else \"NO\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3984818382, "measured_runtime_v1": 0.3150180125, "runtime_lift": 1.2649493755, "key": ["s146499990", "s321967328"]} +{"user_id": "u808429775", "problem_id": "p00134", "language": "python", "submission_id_v0": "s571351483", "submission_id_v1": "s722552691", "cpu_time_v0": 100, "cpu_time_v1": 60, "memory_v0": 7404, "memory_v1": 5952, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.0, "input": "from statistics import mean\n\n\n\ninputCount = int(input())\n\nprices = [int(input()) for lp in range(inputCount)]\n\naverage = mean(prices)\n\nprint((int(average)))\n\n\n", "target": "inputCount = int(input())\n\nprices = [int(input()) for lp in range(inputCount)]\n\naverage = sum(prices) // inputCount\n\nprint(average)\n\n\n", "code_v0_loc": 7, "code_v1_loc": 5, "code_v0_num_chars": 157, "code_v1_num_chars": 134, "code_v0_no_empty_lines": "from statistics import mean\n\ninputCount = int(input())\nprices = [int(input()) for lp in range(inputCount)]\naverage = mean(prices)\nprint((int(average)))\n", "code_v1_no_empty_lines": "inputCount = int(input())\nprices = [int(input()) for lp in range(inputCount)]\naverage = sum(prices) // inputCount\nprint(average)\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-from statistics import mean", "-", "-average = mean(prices)", "-print((int(average)))", "+average = sum(prices) // inputCount", "+print(average)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.453101104, "measured_runtime_v1": 0.2992461076, "runtime_lift": 1.514142014, "key": ["s571351483", "s722552691"]} +{"user_id": "u645250356", "problem_id": "p03559", "language": "python", "submission_id_v0": "s643210131", "submission_id_v1": "s973528764", "cpu_time_v0": 585, "cpu_time_v1": 431, "memory_v0": 124300, "memory_v1": 30272, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.32, "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\nA = sorted(inpl())\n\nB = sorted(inpl())\n\nC = sorted(inpl())\n\ncnt = [0] * n\n\nres = 0\n\nfor i,b in enumerate(B):\n\n c = bisect.bisect_left(C,b+1)\n\n cnt[i] = n-c\n\n\n\nacc = [0]\n\nfor x in cnt:\n\n acc += [acc[-1] + x]\n\nsu = sum(cnt) \n\nfor i,a in enumerate(A):\n\n c = bisect.bisect_left(B,a+1)\n\n res += su - acc[c]\n\nprint(res)", "target": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\na = inpl()\n\nb = inpl()\n\nc = inpl()\n\na.sort()\n\nb.sort()\n\nc.sort()\n\nlb = [0] * n\n\nres = 0\n\nfor i in range(n):\n\n tmp = bisect.bisect_right(b,a[i])\n\n if tmp == n: continue\n\n lb[tmp] += 1\n\nllb = list(itertools.accumulate(lb))\n\n# print(lb,llb)\n\nrr = [0] * n\n\nfor i in range(n):\n\n tmp = bisect.bisect_right(c,b[i])\n\n if tmp == n: continue\n\n rr[tmp] += llb[i]\n\nprint((sum(list(itertools.accumulate(rr)))))", "code_v0_loc": 27, "code_v1_loc": 30, "code_v0_num_chars": 662, "code_v1_num_chars": 747, "code_v0_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, math, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = inp()\nA = sorted(inpl())\nB = sorted(inpl())\nC = sorted(inpl())\ncnt = [0] * n\nres = 0\nfor i, b in enumerate(B):\n c = bisect.bisect_left(C, b + 1)\n cnt[i] = n - c\nacc = [0]\nfor x in cnt:\n acc += [acc[-1] + x]\nsu = sum(cnt)\nfor i, a in enumerate(A):\n c = bisect.bisect_left(B, a + 1)\n res += su - acc[c]\nprint(res)\n", "code_v1_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, math, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = inp()\na = inpl()\nb = inpl()\nc = inpl()\na.sort()\nb.sort()\nc.sort()\nlb = [0] * n\nres = 0\nfor i in range(n):\n tmp = bisect.bisect_right(b, a[i])\n if tmp == n:\n continue\n lb[tmp] += 1\nllb = list(itertools.accumulate(lb))\n# print(lb,llb)\nrr = [0] * n\nfor i in range(n):\n tmp = bisect.bisect_right(c, b[i])\n if tmp == n:\n continue\n rr[tmp] += llb[i]\nprint((sum(list(itertools.accumulate(rr)))))\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-A = sorted(inpl())", "-B = sorted(inpl())", "-C = sorted(inpl())", "-cnt = [0] * n", "+a = inpl()", "+b = inpl()", "+c = inpl()", "+a.sort()", "+b.sort()", "+c.sort()", "+lb = [0] * n", "-for i, b in enumerate(B):", "- c = bisect.bisect_left(C, b + 1)", "- cnt[i] = n - c", "-acc = [0]", "-for x in cnt:", "- acc += [acc[-1] + x]", "-su = sum(cnt)", "-for i, a in enumerate(A):", "- c = bisect.bisect_left(B, a + 1)", "- res += su - acc[c]", "-print(res)", "+for i in range(n):", "+ tmp = bisect.bisect_right(b, a[i])", "+ if tmp == n:", "+ continue", "+ lb[tmp] += 1", "+llb = list(itertools.accumulate(lb))", "+# print(lb,llb)", "+rr = [0] * n", "+for i in range(n):", "+ tmp = bisect.bisect_right(c, b[i])", "+ if tmp == n:", "+ continue", "+ rr[tmp] += llb[i]", "+print((sum(list(itertools.accumulate(rr)))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2585086877, "measured_runtime_v1": 0.0062210422, "runtime_lift": 41.5539198783, "key": ["s643210131", "s973528764"]} +{"user_id": "u145950990", "problem_id": "p02552", "language": "python", "submission_id_v0": "s431367942", "submission_id_v1": "s270499104", "cpu_time_v0": 32, "cpu_time_v1": 25, "memory_v0": 9148, "memory_v1": 9028, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.88, "input": "x = int(input())\n\nprint((0 if x==1 else 1))", "target": "s = input()\n\nif s == '0':\n\n print((1))\n\nelse:\n\n print((0))", "code_v0_loc": 2, "code_v1_loc": 5, "code_v0_num_chars": 41, "code_v1_num_chars": 56, "code_v0_no_empty_lines": "x = int(input())\nprint((0 if x == 1 else 1))\n", "code_v1_no_empty_lines": "s = input()\nif s == \"0\":\n print((1))\nelse:\n print((0))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-x = int(input())", "-print((0 if x == 1 else 1))", "+s = input()", "+if s == \"0\":", "+ print((1))", "+else:", "+ print((0))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2680207849, "measured_runtime_v1": 0.0548314691, "runtime_lift": 4.8880832377, "key": ["s431367942", "s270499104"]} +{"user_id": "u600065151", "problem_id": "p02268", "language": "python", "submission_id_v0": "s783851867", "submission_id_v1": "s366216704", "cpu_time_v0": 50, "cpu_time_v1": 40, "memory_v0": 18684, "memory_v1": 20588, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.0, "input": "def binarySearch():\n\n n = int(input())\n\n S = set(map(int, input().split()))\n\n q = int(input())\n\n T = set(map(int, input().split()))\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()", "target": "def binarySearch():\n\n n = int(input())\n\n S = set(input().split())\n\n q = int(input())\n\n T = set(input().split())\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()", "code_v0_loc": 9, "code_v1_loc": 9, "code_v0_num_chars": 202, "code_v1_num_chars": 182, "code_v0_no_empty_lines": "def binarySearch():\n n = int(input())\n S = set(map(int, input().split()))\n q = int(input())\n T = set(map(int, input().split()))\n print((len(S.intersection(T))))\n\n\nbinarySearch()\n", "code_v1_no_empty_lines": "def binarySearch():\n n = int(input())\n S = set(input().split())\n q = int(input())\n T = set(input().split())\n print((len(S.intersection(T))))\n\n\nbinarySearch()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- S = set(map(int, input().split()))", "+ S = set(input().split())", "- T = set(map(int, input().split()))", "+ T = set(input().split())"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3310329242, "measured_runtime_v1": 0.2247743328, "runtime_lift": 1.4727345427, "key": ["s783851867", "s366216704"]} +{"user_id": "u996434204", "problem_id": "p03416", "language": "python", "submission_id_v0": "s285618885", "submission_id_v1": "s172989285", "cpu_time_v0": 114, "cpu_time_v1": 57, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "a,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])\n\n str1=buf[0:int(len(buf)/2)]\n\n str2=buf[int(len(buf)/2+1):]\n\n if str1[0]==str2[1] and str1[1]==str2[0]:\n\n ans+=1\n\n\n\nprint(ans)\n", "target": "a,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n str1=buf[::-1]\n\n if buf==str1:\n\n ans+=1\n\n\n\nprint(ans)\n", "code_v0_loc": 13, "code_v1_loc": 11, "code_v0_num_chars": 284, "code_v1_num_chars": 149, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n buf = str(i)\n # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])\n str1 = buf[0 : int(len(buf) / 2)]\n str2 = buf[int(len(buf) / 2 + 1) :]\n if str1[0] == str2[1] and str1[1] == str2[0]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n buf = str(i)\n str1 = buf[::-1]\n if buf == str1:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["- # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])", "- str1 = buf[0 : int(len(buf) / 2)]", "- str2 = buf[int(len(buf) / 2 + 1) :]", "- if str1[0] == str2[1] and str1[1] == str2[0]:", "+ str1 = buf[::-1]", "+ if buf == str1:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3597218115, "measured_runtime_v1": 0.2724662972, "runtime_lift": 1.3202433295, "key": ["s285618885", "s172989285"]} +{"user_id": "u537976628", "problem_id": "p03720", "language": "python", "submission_id_v0": "s957846271", "submission_id_v1": "s235024999", "cpu_time_v0": 28, "cpu_time_v1": 25, "memory_v0": 9128, "memory_v1": 9136, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.71, "input": "n, m = list(map(int, input().split()))\n\nRD = list(list(map(int, input().split())) for _ in range(m))\n\nfor i in range(1, n + 1):\n\n ans = 0\n\n for j in RD:\n\n ans += j.count(i)\n\n print(ans)", "target": "n, m = list(map(int, input().split()))\n\nNRD = list(0 for i in range(n))\n\nfor i in range(m):\n\n r1, r2 = list(map(int, input().split()))\n\n NRD[r1 - 1] += 1\n\n NRD[r2 - 1] += 1\n\nfor i in range(n):\n\n print((NRD[i]))", "code_v0_loc": 7, "code_v1_loc": 8, "code_v0_num_chars": 195, "code_v1_num_chars": 208, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\nRD = list(list(map(int, input().split())) for _ in range(m))\nfor i in range(1, n + 1):\n ans = 0\n for j in RD:\n ans += j.count(i)\n print(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nNRD = list(0 for i in range(n))\nfor i in range(m):\n r1, r2 = list(map(int, input().split()))\n NRD[r1 - 1] += 1\n NRD[r2 - 1] += 1\nfor i in range(n):\n print((NRD[i]))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-RD = list(list(map(int, input().split())) for _ in range(m))", "-for i in range(1, n + 1):", "- ans = 0", "- for j in RD:", "- ans += j.count(i)", "- print(ans)", "+NRD = list(0 for i in range(n))", "+for i in range(m):", "+ r1, r2 = list(map(int, input().split()))", "+ NRD[r1 - 1] += 1", "+ NRD[r2 - 1] += 1", "+for i in range(n):", "+ print((NRD[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2888841586, "measured_runtime_v1": 0.0609361191, "runtime_lift": 4.7407705467, "key": ["s957846271", "s235024999"]} +{"user_id": "u298297089", "problem_id": "p03325", "language": "python", "submission_id_v0": "s106132375", "submission_id_v1": "s827937559", "cpu_time_v0": 122, "cpu_time_v1": 72, "memory_v0": 4148, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.98, "input": "N = int(input())\n\nx = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in x:\n\n while i % 2 == 0:\n\n cnt += 1\n\n i /= 2\n\nprint(cnt)", "target": "n = int(input())\n\nans = 0\n\nfor i in map(int, input().split()):\n\n cnt = 0\n\n while i % 2 == 0:\n\n i >>= 1\n\n cnt += 1\n\n ans += cnt\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 134, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "N = int(input())\nx = list(map(int, input().split()))\ncnt = 0\nfor i in x:\n while i % 2 == 0:\n cnt += 1\n i /= 2\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\nans = 0\nfor i in map(int, input().split()):\n cnt = 0\n while i % 2 == 0:\n i >>= 1\n cnt += 1\n ans += cnt\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-N = int(input())", "-x = list(map(int, input().split()))", "-cnt = 0", "-for i in x:", "+n = int(input())", "+ans = 0", "+for i in map(int, input().split()):", "+ cnt = 0", "+ i >>= 1", "- i /= 2", "-print(cnt)", "+ ans += cnt", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2336064763, "measured_runtime_v1": 0.0059840708, "runtime_lift": 39.0380536239, "key": ["s106132375", "s827937559"]} +{"user_id": "u488401358", "problem_id": "p02649", "language": "python", "submission_id_v0": "s231020544", "submission_id_v1": "s831601953", "cpu_time_v0": 688, "cpu_time_v1": 413, "memory_v0": 76468, "memory_v1": 102912, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.97, "input": "def popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50 and j!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\nfor i in range(2**n):\n\n t=set([])\n\n for a in A:\n\n data[a&i]+=1\n\n t.add(a&i)\n\n temp=0\n\n for val in t:\n\n temp+=cmb[data[val]][min(K,data[val])]\n\n ans+=temp*(-1)**popcount(i)\n\n for val in t:\n\n data[val]=0\n\n\n\nprint(ans)\n", "target": "def popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n if j!=50 and i!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nimport random\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\npc=[popcount(i) for i in range(2**n)]\n\nfor i in range(2**n):\n\n for a in A:\n\n data[a&i]+=1\n\n for a in A:\n\n if data[a&i]:\n\n ans+=cmb[data[a&i]][min(K,data[a&i])]*(-1)**pc[i]\n\n data[a&i]=0\n\n\n\nprint(ans)", "code_v0_loc": 68, "code_v1_loc": 67, "code_v0_num_chars": 1445, "code_v1_num_chars": 1441, "code_v0_no_empty_lines": "def popcount(x):\n x = x - ((x >> 1) & 0x55555555)\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0F0F0F0F\n x = x + (x >> 8)\n x = x + (x >> 16)\n return x & 0x0000007F\n\n\ncmb = [[0 for i in range(51)] for j in range(51)]\ncmb[0][0] = 1\nfor i in range(51):\n for j in range(51):\n if i != 50 and j != 50:\n cmb[i + 1][j + 1] += cmb[i][j]\n if i != 50:\n cmb[i + 1][j] += cmb[i][j]\nfor i in range(1, 51):\n for j in range(2, 51):\n cmb[i][j] += cmb[i][j - 1]\nN, K, T, S = list(map(int, input().split()))\na = list(map(int, input().split()))\nmust0 = [i for i in range(18) if S >> i & 1 == 0]\nmust1 = [i for i in range(18) if T >> i & 1 == 1]\nA = []\nfor val in a:\n check = True\n for j in must0:\n check = check & (val >> j & 1 == 0)\n for j in must1:\n check = check & (val >> j & 1 == 1)\n if check:\n A.append(val)\nif not A:\n print((0))\n exit()\nbit = []\nfor i in range(18):\n if i not in must0 and i not in must1:\n bit.append(i)\nfor i in range(len(A)):\n temp = 0\n for j in range(len(bit)):\n temp += (A[i] >> bit[j] & 1 == 1) * 2**j\n A[i] = temp\nans = 0\nn = len(bit)\ndata = [0] * (2**n)\nfor i in range(2**n):\n t = set([])\n for a in A:\n data[a & i] += 1\n t.add(a & i)\n temp = 0\n for val in t:\n temp += cmb[data[val]][min(K, data[val])]\n ans += temp * (-1) ** popcount(i)\n for val in t:\n data[val] = 0\nprint(ans)\n", "code_v1_no_empty_lines": "def popcount(x):\n x = x - ((x >> 1) & 0x55555555)\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0F0F0F0F\n x = x + (x >> 8)\n x = x + (x >> 16)\n return x & 0x0000007F\n\n\ncmb = [[0 for i in range(51)] for j in range(51)]\ncmb[0][0] = 1\nfor i in range(51):\n for j in range(51):\n if i != 50:\n cmb[i + 1][j] += cmb[i][j]\n if j != 50 and i != 50:\n cmb[i + 1][j + 1] += cmb[i][j]\nfor i in range(1, 51):\n for j in range(2, 51):\n cmb[i][j] += cmb[i][j - 1]\nimport random\n\nN, K, T, S = list(map(int, input().split()))\na = list(map(int, input().split()))\nmust0 = [i for i in range(18) if S >> i & 1 == 0]\nmust1 = [i for i in range(18) if T >> i & 1 == 1]\nA = []\nfor val in a:\n check = True\n for j in must0:\n check = check & (val >> j & 1 == 0)\n for j in must1:\n check = check & (val >> j & 1 == 1)\n if check:\n A.append(val)\nif not A:\n print((0))\n exit()\nbit = []\nfor i in range(18):\n if i not in must0 and i not in must1:\n bit.append(i)\nfor i in range(len(A)):\n temp = 0\n for j in range(len(bit)):\n temp += (A[i] >> bit[j] & 1 == 1) * 2**j\n A[i] = temp\nans = 0\nn = len(bit)\ndata = [0] * (2**n)\npc = [popcount(i) for i in range(2**n)]\nfor i in range(2**n):\n for a in A:\n data[a & i] += 1\n for a in A:\n if data[a & i]:\n ans += cmb[data[a & i]][min(K, data[a & i])] * (-1) ** pc[i]\n data[a & i] = 0\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 1.4705882353, "diff": ["- if i != 50 and j != 50:", "- cmb[i + 1][j + 1] += cmb[i][j]", "+ if j != 50 and i != 50:", "+ cmb[i + 1][j + 1] += cmb[i][j]", "+import random", "+", "+pc = [popcount(i) for i in range(2**n)]", "- t = set([])", "- t.add(a & i)", "- temp = 0", "- for val in t:", "- temp += cmb[data[val]][min(K, data[val])]", "- ans += temp * (-1) ** popcount(i)", "- for val in t:", "- data[val] = 0", "+ for a in A:", "+ if data[a & i]:", "+ ans += cmb[data[a & i]][min(K, data[a & i])] * (-1) ** pc[i]", "+ data[a & i] = 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3163019059, "measured_runtime_v1": 0.2340069544, "runtime_lift": 1.3516773748, "key": ["s231020544", "s831601953"]} +{"user_id": "u968166680", "problem_id": "p02814", "language": "python", "submission_id_v0": "s703991862", "submission_id_v1": "s702868581", "cpu_time_v0": 61, "cpu_time_v1": 44, "memory_v0": 13352, "memory_v1": 14092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.87, "input": "import sys\n\nfrom math import gcd\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n A = list(set(map(int, input().split(\" \"))))\n\n A = [a // 2 for a in A]\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a)\n\n if semi_lcm > M:\n\n print((0))\n\n return\n\n\n\n for a in A:\n\n if semi_lcm // a % 2 == 0:\n\n print((0))\n\n return\n\n\n\n print(((M // semi_lcm + 1) // 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n\n\n\n\ndef lcm(a, b):\n\n return a * b // gcd(a, b)\n\n\n\n\n\ndef main():\n\n N, M, *A = list(map(int, read().split()))\n\n A = list(set(A))\n\n B = A.copy()\n\n\n\n while not any(b % 2 for b in B):\n\n B = [b // 2 for b in B]\n\n\n\n if not all(b % 2 for b in B):\n\n print((0))\n\n return\n\n\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a // 2)\n\n\n\n print(((M // semi_lcm + 1) // 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 36, "code_v1_loc": 41, "code_v0_num_chars": 690, "code_v1_num_chars": 687, "code_v0_no_empty_lines": "import sys\nfrom math import gcd\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef lcm(x, y):\n return x * y // gcd(x, y)\n\n\ndef main():\n N, M = list(map(int, input().split()))\n A = list(set(map(int, input().split(\" \"))))\n A = [a // 2 for a in A]\n semi_lcm = 1\n for a in A:\n semi_lcm = lcm(semi_lcm, a)\n if semi_lcm > M:\n print((0))\n return\n for a in A:\n if semi_lcm // a % 2 == 0:\n print((0))\n return\n print(((M // semi_lcm + 1) // 2))\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\ndef main():\n N, M, *A = list(map(int, read().split()))\n A = list(set(A))\n B = A.copy()\n while not any(b % 2 for b in B):\n B = [b // 2 for b in B]\n if not all(b % 2 for b in B):\n print((0))\n return\n semi_lcm = 1\n for a in A:\n semi_lcm = lcm(semi_lcm, a // 2)\n print(((M // semi_lcm + 1) // 2))\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 12.1951219512, "diff": ["-from math import gcd", "-def lcm(x, y):", "- return x * y // gcd(x, y)", "+def gcd(a, b):", "+ while b:", "+ a, b = b, a % b", "+ return a", "+", "+", "+def lcm(a, b):", "+ return a * b // gcd(a, b)", "- N, M = list(map(int, input().split()))", "- A = list(set(map(int, input().split(\" \"))))", "- A = [a // 2 for a in A]", "+ N, M, *A = list(map(int, read().split()))", "+ A = list(set(A))", "+ B = A.copy()", "+ while not any(b % 2 for b in B):", "+ B = [b // 2 for b in B]", "+ if not all(b % 2 for b in B):", "+ print((0))", "+ return", "- semi_lcm = lcm(semi_lcm, a)", "- if semi_lcm > M:", "- print((0))", "- return", "- for a in A:", "- if semi_lcm // a % 2 == 0:", "- print((0))", "- return", "+ semi_lcm = lcm(semi_lcm, a // 2)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.284781249, "measured_runtime_v1": 0.212113862, "runtime_lift": 1.3425866952, "key": ["s703991862", "s702868581"]} +{"user_id": "u761529120", "problem_id": "p03634", "language": "python", "submission_id_v0": "s135133436", "submission_id_v1": "s083939253", "cpu_time_v0": 1459, "cpu_time_v1": 754, "memory_v0": 135740, "memory_v1": 94752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.32, "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\ndef dfs(v,p,d):\n\n for i, j in tree[v]:\n\n if i != p:\n\n depth[i] = d + j\n\n dfs(i,v,d+j)\n\n\n\nN = int(input())\n\n\n\ntree = [[] for _ in range(N)]\n\n\n\nfor i in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n tree[a].append((b,c))\n\n tree[b].append((a,c))\n\n\n\nQ, K = list(map(int, input().split()))\n\n\n\ndepth = [0 for i in range(N)]\n\ndepth[K-1] = 0\n\n\n\ndfs(K-1,-1,0)\n\n\n\nfor _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n print((depth[x-1] + depth[y-1]))", "target": "import heapq\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef dijkstra(s, edge, N):\n\n d = [float('inf')] * N\n\n used = [True] * N\n\n d[s] = 0\n\n used[s] = False\n\n edgelist = []\n\n for a, b in edge[s]:\n\n heapq.heappush(edgelist, a * (10 ** 6) + b)\n\n while len(edgelist):\n\n minedge = heapq.heappop(edgelist)\n\n\n\n if not used[minedge%(10 ** 6)]:\n\n continue\n\n v = minedge % (10 ** 6)\n\n d[v] = minedge // (10 ** 6)\n\n used[v] = False\n\n for e in edge[v]:\n\n if used[e[1]]:\n\n heapq.heappush(edgelist, (e[0] + d[v]) * (10 ** 6) + e[1])\n\n return d\n\n\n\ndef main():\n\n N = int(input())\n\n edge = [[] for _ in range(N)]\n\n for _ in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n edge[a].append([c,b])\n\n edge[b].append([c,a])\n\n Q, K = list(map(int, input().split()))\n\n K -= 1\n\n d = dijkstra(K, edge, N)\n\n for _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n x -= 1\n\n y -= 1\n\n print((d[x] + d[y]))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 29, "code_v1_loc": 48, "code_v0_num_chars": 553, "code_v1_num_chars": 1130, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef dfs(v, p, d):\n for i, j in tree[v]:\n if i != p:\n depth[i] = d + j\n dfs(i, v, d + j)\n\n\nN = int(input())\ntree = [[] for _ in range(N)]\nfor i in range(N - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n tree[a].append((b, c))\n tree[b].append((a, c))\nQ, K = list(map(int, input().split()))\ndepth = [0 for i in range(N)]\ndepth[K - 1] = 0\ndfs(K - 1, -1, 0)\nfor _ in range(Q):\n x, y = list(map(int, input().split()))\n print((depth[x - 1] + depth[y - 1]))\n", "code_v1_no_empty_lines": "import heapq\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef dijkstra(s, edge, N):\n d = [float(\"inf\")] * N\n used = [True] * N\n d[s] = 0\n used[s] = False\n edgelist = []\n for a, b in edge[s]:\n heapq.heappush(edgelist, a * (10**6) + b)\n while len(edgelist):\n minedge = heapq.heappop(edgelist)\n if not used[minedge % (10**6)]:\n continue\n v = minedge % (10**6)\n d[v] = minedge // (10**6)\n used[v] = False\n for e in edge[v]:\n if used[e[1]]:\n heapq.heappush(edgelist, (e[0] + d[v]) * (10**6) + e[1])\n return d\n\n\ndef main():\n N = int(input())\n edge = [[] for _ in range(N)]\n for _ in range(N - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n edge[a].append([c, b])\n edge[b].append([c, a])\n Q, K = list(map(int, input().split()))\n K -= 1\n d = dijkstra(K, edge, N)\n for _ in range(Q):\n x, y = list(map(int, input().split()))\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 39.5833333333, "diff": ["+import heapq", "-sys.setrecursionlimit(10**6)", "+input = sys.stdin.readline", "-def dfs(v, p, d):", "- for i, j in tree[v]:", "- if i != p:", "- depth[i] = d + j", "- dfs(i, v, d + j)", "+def dijkstra(s, edge, N):", "+ d = [float(\"inf\")] * N", "+ used = [True] * N", "+ d[s] = 0", "+ used[s] = False", "+ edgelist = []", "+ for a, b in edge[s]:", "+ heapq.heappush(edgelist, a * (10**6) + b)", "+ while len(edgelist):", "+ minedge = heapq.heappop(edgelist)", "+ if not used[minedge % (10**6)]:", "+ continue", "+ v = minedge % (10**6)", "+ d[v] = minedge // (10**6)", "+ used[v] = False", "+ for e in edge[v]:", "+ if used[e[1]]:", "+ heapq.heappush(edgelist, (e[0] + d[v]) * (10**6) + e[1])", "+ return d", "-N = int(input())", "-tree = [[] for _ in range(N)]", "-for i in range(N - 1):", "- a, b, c = list(map(int, input().split()))", "- a -= 1", "- b -= 1", "- tree[a].append((b, c))", "- tree[b].append((a, c))", "-Q, K = list(map(int, input().split()))", "-depth = [0 for i in range(N)]", "-depth[K - 1] = 0", "-dfs(K - 1, -1, 0)", "-for _ in range(Q):", "- x, y = list(map(int, input().split()))", "- print((depth[x - 1] + depth[y - 1]))", "+def main():", "+ N = int(input())", "+ edge = [[] for _ in range(N)]", "+ for _ in range(N - 1):", "+ a, b, c = list(map(int, input().split()))", "+ a -= 1", "+ b -= 1", "+ edge[a].append([c, b])", "+ edge[b].append([c, a])", "+ Q, K = list(map(int, input().split()))", "+ K -= 1", "+ d = dijkstra(K, edge, N)", "+ for _ in range(Q):", "+ x, y = list(map(int, input().split()))", "+ x -= 1", "+ y -= 1", "+ print((d[x] + d[y]))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5217886055, "measured_runtime_v1": 0.3235212803, "runtime_lift": 1.6128416807, "key": ["s135133436", "s083939253"]} +{"user_id": "u230717961", "problem_id": "p03796", "language": "python", "submission_id_v0": "s450924156", "submission_id_v1": "s743009434", "cpu_time_v0": 229, "cpu_time_v1": 35, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.72, "input": "import math\n\nn = int(input())\n\n\n\npower = math.factorial(n)\n\n\n\nprint((power % (10**9 + 7)))\n", "target": "import math\n\nn = int(input())\n\n\n\npower = 1\n\n\n\nfor i in range(1, n+1):\n\n power = i * power % (10**9 + 7)\n\n\n\nprint(power)\n", "code_v0_loc": 6, "code_v1_loc": 9, "code_v0_num_chars": 89, "code_v1_num_chars": 123, "code_v0_no_empty_lines": "import math\n\nn = int(input())\npower = math.factorial(n)\nprint((power % (10**9 + 7)))\n", "code_v1_no_empty_lines": "import math\n\nn = int(input())\npower = 1\nfor i in range(1, n + 1):\n power = i * power % (10**9 + 7)\nprint(power)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-power = math.factorial(n)", "-print((power % (10**9 + 7)))", "+power = 1", "+for i in range(1, n + 1):", "+ power = i * power % (10**9 + 7)", "+print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5500237288, "measured_runtime_v1": 0.2133381867, "runtime_lift": 2.5781775744, "key": ["s450924156", "s743009434"]} +{"user_id": "u077898957", "problem_id": "p03796", "language": "python", "submission_id_v0": "s080864979", "submission_id_v1": "s354066004", "cpu_time_v0": 230, "cpu_time_v1": 42, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.74, "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))\n", "target": "n = int(input())\n\npw = 1\n\nfor i in range(n):\n\n pw *= (i+1)\n\n pw %= 10**9+7\n\nprint(pw)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 66, "code_v1_num_chars": 87, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\npw = 1\nfor i in range(n):\n pw *= i + 1\n pw %= 10**9 + 7\nprint(pw)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+pw = 1", "+for i in range(n):", "+ pw *= i + 1", "+ pw %= 10**9 + 7", "+print(pw)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9190823469, "measured_runtime_v1": 0.4266894727, "runtime_lift": 2.1539841167, "key": ["s080864979", "s354066004"]} +{"user_id": "u391731808", "problem_id": "p03634", "language": "python", "submission_id_v0": "s145761901", "submission_id_v1": "s949294302", "cpu_time_v0": 1740, "cpu_time_v1": 1056, "memory_v0": 98856, "memory_v1": 98636, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.31, "input": "import heapq\n\n\n\nN = int(input())\n\nabc = [list(map(int,input().split())) for _ in range(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nxy = [list(map(int,input().split())) for _ in range(Q)]\n\n\n\nconnect = [[] for _ in range(N)]\n\nINFTY = 10**15\n\nfor a,b,c in abc:\n\n connect[a-1].append([b-1,c])\n\n connect[b-1].append([a-1,c])\n\n\n\ncost = [[INFTY,False] for _ in range(N)]\n\ncost[K-1][0] = 0\n\nq = [(0,K-1)]\n\nwhile q:\n\n _,i = heapq.heappop(q)\n\n if cost[i][1]:\n\n continue\n\n cost[i][1] = True\n\n ci0 = cost[i][0]\n\n for j,c in connect[i]:\n\n if cost[j][1]:\n\n continue\n\n tmp_cost = ci0+c\n\n if tmp_cost < cost[j][0]:\n\n cost[j][0] = tmp_cost\n\n heapq.heappush(q,(tmp_cost,j))\n\n\n\nfor x,y in xy:\n\n print((cost[x-1][0] + cost[y-1][0]))", "target": "N = int(input())\n\nABC = [list(map(int,input().split())) for _ in [0]*(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nXY = [list(map(int,input().split())) for _ in [0]*Q]\n\n\n\nE = [{} for _ in [0]*N]\n\nfor a,b,c in ABC:\n\n E[a-1][b-1] = c\n\n E[b-1][a-1] = c\n\n\n\ndef dist_dfs_tree(N,E,start):\n\n d = [-1]*N\n\n d[start] = 0\n\n q = [start]\n\n while q:\n\n i = q.pop()\n\n ci = d[i]\n\n for j,cj in list(E[i].items()):\n\n if d[j] !=-1:continue\n\n d[j] = ci+cj\n\n q.append(j)\n\n return d\n\n\n\nd = dist_dfs_tree(N,E,K-1)\n\nfor x,y in XY:\n\n print((d[x-1]+d[y-1]))", "code_v0_loc": 32, "code_v1_loc": 26, "code_v0_num_chars": 797, "code_v1_num_chars": 594, "code_v0_no_empty_lines": "import heapq\n\nN = int(input())\nabc = [list(map(int, input().split())) for _ in range(N - 1)]\nQ, K = list(map(int, input().split()))\nxy = [list(map(int, input().split())) for _ in range(Q)]\nconnect = [[] for _ in range(N)]\nINFTY = 10**15\nfor a, b, c in abc:\n connect[a - 1].append([b - 1, c])\n connect[b - 1].append([a - 1, c])\ncost = [[INFTY, False] for _ in range(N)]\ncost[K - 1][0] = 0\nq = [(0, K - 1)]\nwhile q:\n _, i = heapq.heappop(q)\n if cost[i][1]:\n continue\n cost[i][1] = True\n ci0 = cost[i][0]\n for j, c in connect[i]:\n if cost[j][1]:\n continue\n tmp_cost = ci0 + c\n if tmp_cost < cost[j][0]:\n cost[j][0] = tmp_cost\n heapq.heappush(q, (tmp_cost, j))\nfor x, y in xy:\n print((cost[x - 1][0] + cost[y - 1][0]))\n", "code_v1_no_empty_lines": "N = int(input())\nABC = [list(map(int, input().split())) for _ in [0] * (N - 1)]\nQ, K = list(map(int, input().split()))\nXY = [list(map(int, input().split())) for _ in [0] * Q]\nE = [{} for _ in [0] * N]\nfor a, b, c in ABC:\n E[a - 1][b - 1] = c\n E[b - 1][a - 1] = c\n\n\ndef dist_dfs_tree(N, E, start):\n d = [-1] * N\n d[start] = 0\n q = [start]\n while q:\n i = q.pop()\n ci = d[i]\n for j, cj in list(E[i].items()):\n if d[j] != -1:\n continue\n d[j] = ci + cj\n q.append(j)\n return d\n\n\nd = dist_dfs_tree(N, E, K - 1)\nfor x, y in XY:\n print((d[x - 1] + d[y - 1]))\n", "code_same": false, "relative_loc_diff_percent": 18.75, "diff": ["-import heapq", "+N = int(input())", "+ABC = [list(map(int, input().split())) for _ in [0] * (N - 1)]", "+Q, K = list(map(int, input().split()))", "+XY = [list(map(int, input().split())) for _ in [0] * Q]", "+E = [{} for _ in [0] * N]", "+for a, b, c in ABC:", "+ E[a - 1][b - 1] = c", "+ E[b - 1][a - 1] = c", "-N = int(input())", "-abc = [list(map(int, input().split())) for _ in range(N - 1)]", "-Q, K = list(map(int, input().split()))", "-xy = [list(map(int, input().split())) for _ in range(Q)]", "-connect = [[] for _ in range(N)]", "-INFTY = 10**15", "-for a, b, c in abc:", "- connect[a - 1].append([b - 1, c])", "- connect[b - 1].append([a - 1, c])", "-cost = [[INFTY, False] for _ in range(N)]", "-cost[K - 1][0] = 0", "-q = [(0, K - 1)]", "-while q:", "- _, i = heapq.heappop(q)", "- if cost[i][1]:", "- continue", "- cost[i][1] = True", "- ci0 = cost[i][0]", "- for j, c in connect[i]:", "- if cost[j][1]:", "- continue", "- tmp_cost = ci0 + c", "- if tmp_cost < cost[j][0]:", "- cost[j][0] = tmp_cost", "- heapq.heappush(q, (tmp_cost, j))", "-for x, y in xy:", "- print((cost[x - 1][0] + cost[y - 1][0]))", "+", "+def dist_dfs_tree(N, E, start):", "+ d = [-1] * N", "+ d[start] = 0", "+ q = [start]", "+ while q:", "+ i = q.pop()", "+ ci = d[i]", "+ for j, cj in list(E[i].items()):", "+ if d[j] != -1:", "+ continue", "+ d[j] = ci + cj", "+ q.append(j)", "+ return d", "+", "+", "+d = dist_dfs_tree(N, E, K - 1)", "+for x, y in XY:", "+ print((d[x - 1] + d[y - 1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2932223577, "measured_runtime_v1": 0.2194568303, "runtime_lift": 1.3361277359, "key": ["s145761901", "s949294302"]} +{"user_id": "u467041847", "problem_id": "p03416", "language": "python", "submission_id_v0": "s364629573", "submission_id_v1": "s490395080", "cpu_time_v0": 93, "cpu_time_v1": 62, "memory_v0": 3316, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "A,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(n):\n\n\tkey = 0\n\n\tfor i in range(1,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(B)-kaibun(A-1)))", "target": "A,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(m, n):\n\n\tkey = 0\n\n\tfor i in range(m,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(A,B)))", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 173, "code_v1_num_chars": 166, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\n\n\ndef kaibun(n):\n key = 0\n for i in range(1, n + 1):\n if str(i) == str(i)[::-1]:\n key += 1\n return key\n\n\nprint((kaibun(B) - kaibun(A - 1)))\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\n\n\ndef kaibun(m, n):\n key = 0\n for i in range(m, n + 1):\n if str(i) == str(i)[::-1]:\n key += 1\n return key\n\n\nprint((kaibun(A, B)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-def kaibun(n):", "+def kaibun(m, n):", "- for i in range(1, n + 1):", "+ for i in range(m, n + 1):", "-print((kaibun(B) - kaibun(A - 1)))", "+print((kaibun(A, B)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5900465159, "measured_runtime_v1": 0.3264039189, "runtime_lift": 1.8077188467, "key": ["s364629573", "s490395080"]} +{"user_id": "u868628468", "problem_id": "p02555", "language": "python", "submission_id_v0": "s517832809", "submission_id_v1": "s490323912", "cpu_time_v0": 151, "cpu_time_v1": 62, "memory_v0": 73984, "memory_v1": 63380, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.94, "input": "from sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n for x in range(3,i+1):\n\n if x in [i-1,i-2]:\n\n continue\n\n dp[i] += dp[i-x]\n\n return dp[s]%mod\n\nprint((solve()))", "target": "from sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n return dp[s]%mod\n\nprint((solve()))", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 330, "code_v1_num_chars": 245, "code_v0_no_empty_lines": "from sys import stdin\n\n\ndef solve():\n s = int(stdin.readline())\n mod = 10**9 + 7\n if s < 3:\n return 0\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(3, s + 1):\n for x in range(3, i + 1):\n if x in [i - 1, i - 2]:\n continue\n dp[i] += dp[i - x]\n return dp[s] % mod\n\n\nprint((solve()))\n", "code_v1_no_empty_lines": "from sys import stdin\n\n\ndef solve():\n s = int(stdin.readline())\n mod = 10**9 + 7\n if s < 3:\n return 0\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(3, s + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n return dp[s] % mod\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["- for x in range(3, i + 1):", "- if x in [i - 1, i - 2]:", "- continue", "- dp[i] += dp[i - x]", "+ dp[i] = dp[i - 1] + dp[i - 3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6190335753, "measured_runtime_v1": 0.2015811858, "runtime_lift": 3.0708896406, "key": ["s517832809", "s490323912"]} +{"user_id": "u678167152", "problem_id": "p02773", "language": "python", "submission_id_v0": "s779115559", "submission_id_v1": "s953043553", "cpu_time_v0": 682, "cpu_time_v1": 392, "memory_v0": 32096, "memory_v1": 38716, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.52, "input": "N = int(input())\n\ns_list = {}\n\nfor i in range(N):\n\n S = input()\n\n if S in list(s_list.keys()):\n\n s_list[S] += 1\n\n else:\n\n s_list[S] = 0\n\nmax = 0\n\nmaxs = []\n\nfor s,c in list(s_list.items()):\n\n if c > max:\n\n maxs = [s]\n\n max = c\n\n elif c == max:\n\n maxs.append(s)\n\nmaxs.sort()\n\nfor m in maxs:\n\n print(m)", "target": "from collections import Counter\n\ndef solve():\n\n N = int(input())\n\n S = [input() for _ in range(N)]\n\n c = Counter(S)\n\n M = max(c.values())\n\n ans = []\n\n for k,v in c.items():\n\n if v==M:\n\n ans.append(k)\n\n ans.sort()\n\n return ans\n\nprint(*solve(),sep='\\n')\n", "code_v0_loc": 19, "code_v1_loc": 13, "code_v0_num_chars": 309, "code_v1_num_chars": 267, "code_v0_no_empty_lines": "N = int(input())\ns_list = {}\nfor i in range(N):\n S = input()\n if S in list(s_list.keys()):\n s_list[S] += 1\n else:\n s_list[S] = 0\nmax = 0\nmaxs = []\nfor s, c in list(s_list.items()):\n if c > max:\n maxs = [s]\n max = c\n elif c == max:\n maxs.append(s)\nmaxs.sort()\nfor m in maxs:\n print(m)\n", "code_v1_no_empty_lines": "from collections import Counter\n\n\ndef solve():\n N = int(input())\n S = [input() for _ in range(N)]\n c = Counter(S)\n M = max(c.values())\n ans = []\n for k, v in c.items():\n if v == M:\n ans.append(k)\n ans.sort()\n return ans\n\n\nprint(*solve(), sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 31.5789473684, "diff": ["-N = int(input())", "-s_list = {}", "-for i in range(N):", "- S = input()", "- if S in list(s_list.keys()):", "- s_list[S] += 1", "- else:", "- s_list[S] = 0", "-max = 0", "-maxs = []", "-for s, c in list(s_list.items()):", "- if c > max:", "- maxs = [s]", "- max = c", "- elif c == max:", "- maxs.append(s)", "-maxs.sort()", "-for m in maxs:", "- print(m)", "+from collections import Counter", "+", "+", "+def solve():", "+ N = int(input())", "+ S = [input() for _ in range(N)]", "+ c = Counter(S)", "+ M = max(c.values())", "+ ans = []", "+ for k, v in c.items():", "+ if v == M:", "+ ans.append(k)", "+ ans.sort()", "+ return ans", "+", "+", "+print(*solve(), sep=\"\\n\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1935686147, "measured_runtime_v1": 0.0062823365, "runtime_lift": 30.8115643329, "key": ["s779115559", "s953043553"]} +{"user_id": "u018679195", "problem_id": "p03796", "language": "python", "submission_id_v0": "s992615685", "submission_id_v1": "s822858934", "cpu_time_v0": 232, "cpu_time_v1": 36, "memory_v0": 4024, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.48, "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))", "target": "M = 1000000007\n\nn=int(input())\n\nf = 1\n\nfor i in range(1, n + 1): \n\n f = (f * i) % M \n\nprint(f)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 69, "code_v1_num_chars": 98, "code_v0_no_empty_lines": "import math\n\nx = int(input())\nprint((math.factorial(x) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "M = 1000000007\nn = int(input())\nf = 1\nfor i in range(1, n + 1):\n f = (f * i) % M\nprint(f)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-x = int(input())", "-print((math.factorial(x) % (10**9 + 7)))", "+M = 1000000007", "+n = int(input())", "+f = 1", "+for i in range(1, n + 1):", "+ f = (f * i) % M", "+print(f)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5256081567, "measured_runtime_v1": 0.2486211307, "runtime_lift": 2.1140928576, "key": ["s992615685", "s822858934"]} +{"user_id": "u926412290", "problem_id": "p02730", "language": "python", "submission_id_v0": "s449146060", "submission_id_v1": "s811980926", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "S = input()\n\nN = len(S)\n\nleft = S[:int(N/2)]\n\nright = S[int((N+2)/2):]\n\nS_reversed = \"\".join(reversed(list(S)))\n\nleft_reversed = \"\".join(reversed(list(left)))\n\nright_reversed = \"\".join(reversed(list(right)))\n\n\n\nif S == S_reversed and left == left_reversed and right == right_reversed:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "target": "S = input()\n\nN = len(S)\n\nleft = S[:int(N/2)]\n\nright = S[int((N+2)/2):]\n\n\n\nif S == S[::-1] and left == left[::-1] and right == right[::-1]:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "code_v0_loc": 12, "code_v1_loc": 9, "code_v0_num_chars": 326, "code_v1_num_chars": 180, "code_v0_no_empty_lines": "S = input()\nN = len(S)\nleft = S[: int(N / 2)]\nright = S[int((N + 2) / 2) :]\nS_reversed = \"\".join(reversed(list(S)))\nleft_reversed = \"\".join(reversed(list(left)))\nright_reversed = \"\".join(reversed(list(right)))\nif S == S_reversed and left == left_reversed and right == right_reversed:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "S = input()\nN = len(S)\nleft = S[: int(N / 2)]\nright = S[int((N + 2) / 2) :]\nif S == S[::-1] and left == left[::-1] and right == right[::-1]:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-S_reversed = \"\".join(reversed(list(S)))", "-left_reversed = \"\".join(reversed(list(left)))", "-right_reversed = \"\".join(reversed(list(right)))", "-if S == S_reversed and left == left_reversed and right == right_reversed:", "+if S == S[::-1] and left == left[::-1] and right == right[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2928721476, "measured_runtime_v1": 0.0555575957, "runtime_lift": 5.2715050689, "key": ["s449146060", "s811980926"]} +{"user_id": "u896741788", "problem_id": "p03416", "language": "python", "submission_id_v0": "s606562684", "submission_id_v1": "s721402043", "cpu_time_v0": 284, "cpu_time_v1": 62, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.17, "input": "a,b=list(map(int,input().split()))\n\nans=0\n\nfor i in range(b+1)[a:]:\n\n if len(str(i))%2==0:\n\n p=list(str(i))[:len(str(i))//2]\n\n q=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if p==q:\n\n ans+=1\n\n else:\n\n s=list(str(i))[:len(str(i))//2+1]\n\n d=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if s==d:\n\n ans += 1\n\nprint(ans)", "target": "a,s=list(map(int,input().split()))\n\nad=0\n\nfor i in range(a,s+1):\n\n if str(i)==str(i)[::-1]:ad+=1\n\nprint(ad)", "code_v0_loc": 14, "code_v1_loc": 5, "code_v0_num_chars": 346, "code_v1_num_chars": 102, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(b + 1)[a:]:\n if len(str(i)) % 2 == 0:\n p = list(str(i))[: len(str(i)) // 2]\n q = list(reversed(list(str(i))[len(str(i)) // 2 :]))\n if p == q:\n ans += 1\n else:\n s = list(str(i))[: len(str(i)) // 2 + 1]\n d = list(reversed(list(str(i))[len(str(i)) // 2 :]))\n if s == d:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "a, s = list(map(int, input().split()))\nad = 0\nfor i in range(a, s + 1):\n if str(i) == str(i)[::-1]:\n ad += 1\nprint(ad)\n", "code_same": false, "relative_loc_diff_percent": 64.2857142857, "diff": ["-a, b = list(map(int, input().split()))", "-ans = 0", "-for i in range(b + 1)[a:]:", "- if len(str(i)) % 2 == 0:", "- p = list(str(i))[: len(str(i)) // 2]", "- q = list(reversed(list(str(i))[len(str(i)) // 2 :]))", "- if p == q:", "- ans += 1", "- else:", "- s = list(str(i))[: len(str(i)) // 2 + 1]", "- d = list(reversed(list(str(i))[len(str(i)) // 2 :]))", "- if s == d:", "- ans += 1", "-print(ans)", "+a, s = list(map(int, input().split()))", "+ad = 0", "+for i in range(a, s + 1):", "+ if str(i) == str(i)[::-1]:", "+ ad += 1", "+print(ad)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6921946588, "measured_runtime_v1": 0.3831296915, "runtime_lift": 1.8066849794, "key": ["s606562684", "s721402043"]} +{"user_id": "u036104576", "problem_id": "p02814", "language": "python", "submission_id_v0": "s934732087", "submission_id_v1": "s059526149", "cpu_time_v0": 249, "cpu_time_v1": 174, "memory_v0": 14544, "memory_v1": 90620, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.12, "input": "import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\n \n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nfrom collections import defaultdict\n\n \n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n \n\n \n\nfrom functools import reduce\n\n# from math import *\n\nfrom math import *\n\nN, M = list(map(int, readline().split()))\n\nA = list(sorted([int(x) // 2 for x in readline().split()]))\n\nmin_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)\n\n \n\n# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))\n\nif not all([(min_cm // x) % 2 == 1 for x in A]):\n\n print((0))\n\n exit(0)\n\nif min_cm > M:\n\n print((0))\n\n exit(0)\n\nans = (M // min_cm + 1) // 2\n\nprint(ans)", "target": "import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\nimport heapq\n\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nINF = 10 ** 9 + 7\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n# map(int, input().split())\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) // 2 for x in input().split()])\n\n\n\ndef f(n):\n\n res = 0\n\n while n % 2 == 0:\n\n n //= 2\n\n res += 1\n\n return res\n\n\n\ndef gcd(a, b):\n\n if b == 0:\n\n return a\n\n return gcd(b, a % b)\n\n\n\nx = f(A[0])\n\nfor a in A:\n\n y = f(a)\n\n if y != x:\n\n print((0))\n\n exit()\n\n\n\nlcm = A[0]\n\nfor i in range(1, N):\n\n lcm = lcm * A[i] // gcd(lcm, A[i])\n\n\n\nprint(((M // lcm + 1) // 2))", "code_v0_loc": 31, "code_v1_loc": 43, "code_v0_num_chars": 729, "code_v1_num_chars": 789, "code_v0_no_empty_lines": "import sys\nimport itertools\n\n# import numpy as np\nimport time\nimport math\n\nsys.setrecursionlimit(10**7)\nfrom collections import defaultdict\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom functools import reduce\n\n# from math import *\nfrom math import *\n\nN, M = list(map(int, readline().split()))\nA = list(sorted([int(x) // 2 for x in readline().split()]))\nmin_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)\n# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))\nif not all([(min_cm // x) % 2 == 1 for x in A]):\n print((0))\n exit(0)\nif min_cm > M:\n print((0))\n exit(0)\nans = (M // min_cm + 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\nimport itertools\n\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**7)\nINF = 10**9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n# map(int, input().split())\nN, M = list(map(int, input().split()))\nA = list([int(x) // 2 for x in input().split()])\n\n\ndef f(n):\n res = 0\n while n % 2 == 0:\n n //= 2\n res += 1\n return res\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\nx = f(A[0])\nfor a in A:\n y = f(a)\n if y != x:\n print((0))\n exit()\nlcm = A[0]\nfor i in range(1, N):\n lcm = lcm * A[i] // gcd(lcm, A[i])\nprint(((M // lcm + 1) // 2))\n", "code_same": false, "relative_loc_diff_percent": 27.9069767442, "diff": ["+import heapq", "+from collections import defaultdict", "-from collections import defaultdict", "-", "+INF = 10**9 + 7", "-from functools import reduce", "+# map(int, input().split())", "+N, M = list(map(int, input().split()))", "+A = list([int(x) // 2 for x in input().split()])", "-# from math import *", "-from math import *", "-N, M = list(map(int, readline().split()))", "-A = list(sorted([int(x) // 2 for x in readline().split()]))", "-min_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)", "-# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))", "-if not all([(min_cm // x) % 2 == 1 for x in A]):", "- print((0))", "- exit(0)", "-if min_cm > M:", "- print((0))", "- exit(0)", "-ans = (M // min_cm + 1) // 2", "-print(ans)", "+def f(n):", "+ res = 0", "+ while n % 2 == 0:", "+ n //= 2", "+ res += 1", "+ return res", "+", "+", "+def gcd(a, b):", "+ if b == 0:", "+ return a", "+ return gcd(b, a % b)", "+", "+", "+x = f(A[0])", "+for a in A:", "+ y = f(a)", "+ if y != x:", "+ print((0))", "+ exit()", "+lcm = A[0]", "+for i in range(1, N):", "+ lcm = lcm * A[i] // gcd(lcm, A[i])", "+print(((M // lcm + 1) // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.414138025, "measured_runtime_v1": 0.277947119, "runtime_lift": 1.4899885508, "key": ["s934732087", "s059526149"]} +{"user_id": "u590871958", "problem_id": "p01093", "language": "python", "submission_id_v0": "s330226420", "submission_id_v1": "s459093378", "cpu_time_v0": 50, "cpu_time_v1": 40, "memory_v0": 7684, "memory_v1": 7704, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.0, "input": "while int(input()) > 0:\n\n s = sorted(map(int, input().split()))\n\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))", "target": "while True:\n\n if int(input()) == 0:\n\n break\n\n s = sorted(map(int, input().split()))\n\n r = min(abs(x - y) for (x, y) in zip(s, s[1:]))\n\n print(r)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 122, "code_v1_num_chars": 163, "code_v0_no_empty_lines": "while int(input()) > 0:\n s = sorted(map(int, input().split()))\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))\n", "code_v1_no_empty_lines": "while True:\n if int(input()) == 0:\n break\n s = sorted(map(int, input().split()))\n r = min(abs(x - y) for (x, y) in zip(s, s[1:]))\n print(r)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-while int(input()) > 0:", "+while True:", "+ if int(input()) == 0:", "+ break", "- print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))", "+ r = min(abs(x - y) for (x, y) in zip(s, s[1:]))", "+ print(r)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2760278752, "measured_runtime_v1": 0.2140542445, "runtime_lift": 1.2895230169, "key": ["s330226420", "s459093378"]} +{"user_id": "u970197315", "problem_id": "p02814", "language": "python", "submission_id_v0": "s991587805", "submission_id_v1": "s856136819", "cpu_time_v0": 253, "cpu_time_v1": 206, "memory_v0": 16276, "memory_v1": 20232, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.58, "input": "# ABC150 D\n\nsi = lambda: input()\n\nni = lambda: int(input())\n\nnm = lambda: list(map(int, input().split()))\n\nnl = lambda: list(map(int, input().split()))\n\nfrom math import gcd\n\nfrom math import ceil\n\ndef lcm(x, y):\n\n return (x * y) // gcd(x, y)\n\nn,m=nm()\n\na=nl()\n\nans=0\n\na=[x//2 for x in a] \n\n\n\nlcm_v=a[0]\n\nfor i in range(n):\n\n lcm_v=lcm(lcm_v,a[i])\n\nok_flg=[(lcm_v//i)%2==1 for i in a]\n\nif all(ok_flg):\n\n ans=((m//lcm_v)+1)//2\n\nprint(ans)\n\n\n", "target": "from math import gcd, ceil\n\n\n\n\n\ndef lcm(a, b):\n\n return (a*b)//gcd(a, b)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\nfor i in range(n):\n\n a[i] = a[i]//2\n\n\n\nlcm_v = a[0]\n\nfor i in range(1, n):\n\n lcm_v = lcm(lcm_v, a[i])\n\n\n\nok = True\n\nfor aa in a:\n\n if (lcm_v//aa) % 2 != 1:\n\n ok = False\n\n break\n\nans = 0\n\nif ok:\n\n ans = ((m//lcm_v)+1)//2\n\nprint(ans)\n", "code_v0_loc": 22, "code_v1_loc": 26, "code_v0_num_chars": 448, "code_v1_num_chars": 412, "code_v0_no_empty_lines": "# ABC150 D\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: list(map(int, input().split()))\nnl = lambda: list(map(int, input().split()))\nfrom math import gcd\nfrom math import ceil\n\n\ndef lcm(x, y):\n return (x * y) // gcd(x, y)\n\n\nn, m = nm()\na = nl()\nans = 0\na = [x // 2 for x in a]\nlcm_v = a[0]\nfor i in range(n):\n lcm_v = lcm(lcm_v, a[i])\nok_flg = [(lcm_v // i) % 2 == 1 for i in a]\nif all(ok_flg):\n ans = ((m // lcm_v) + 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "from math import gcd, ceil\n\n\ndef lcm(a, b):\n return (a * b) // gcd(a, b)\n\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nfor i in range(n):\n a[i] = a[i] // 2\nlcm_v = a[0]\nfor i in range(1, n):\n lcm_v = lcm(lcm_v, a[i])\nok = True\nfor aa in a:\n if (lcm_v // aa) % 2 != 1:\n ok = False\n break\nans = 0\nif ok:\n ans = ((m // lcm_v) + 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["-# ABC150 D", "-si = lambda: input()", "-ni = lambda: int(input())", "-nm = lambda: list(map(int, input().split()))", "-nl = lambda: list(map(int, input().split()))", "-from math import gcd", "-from math import ceil", "+from math import gcd, ceil", "-def lcm(x, y):", "- return (x * y) // gcd(x, y)", "+def lcm(a, b):", "+ return (a * b) // gcd(a, b)", "-n, m = nm()", "-a = nl()", "+n, m = list(map(int, input().split()))", "+a = list(map(int, input().split()))", "+for i in range(n):", "+ a[i] = a[i] // 2", "+lcm_v = a[0]", "+for i in range(1, n):", "+ lcm_v = lcm(lcm_v, a[i])", "+ok = True", "+for aa in a:", "+ if (lcm_v // aa) % 2 != 1:", "+ ok = False", "+ break", "-a = [x // 2 for x in a]", "-lcm_v = a[0]", "-for i in range(n):", "- lcm_v = lcm(lcm_v, a[i])", "-ok_flg = [(lcm_v // i) % 2 == 1 for i in a]", "-if all(ok_flg):", "+if ok:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4063324592, "measured_runtime_v1": 0.2545481203, "runtime_lift": 1.5962893726, "key": ["s991587805", "s856136819"]} +{"user_id": "u400765446", "problem_id": "p02412", "language": "python", "submission_id_v0": "s921182397", "submission_id_v1": "s148735991", "cpu_time_v0": 320, "cpu_time_v1": 20, "memory_v0": 5600, "memory_v1": 5600, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 93.75, "input": "def main():\n\n\n\n while True:\n\n n, x = tuple(map(int, input().split()))\n\n pattern = 0\n\n\n\n if n == x == 0:\n\n break\n\n else:\n\n for a in range(1, n+1):\n\n for b in range(1, a):\n\n for c in range(1, b):\n\n pattern += 1 if a + b + c == x and a > b > c else 0\n\n print(pattern)\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def divide_two(c, z):\n\n min_b = z // 2 + 1\n\n max_b = min(c-1, z-1)\n\n return max(max_b-min_b+1, 0)\n\n \n\n\n\nnum_set = []\n\ncnt = 0\n\nwhile True:\n\n n, x = list(map(int, input().split()))\n\n if (n, x) == (0, 0):\n\n break\n\n else:\n\n num_set.append((n, x))\n\n cnt += 1\n\n\n\nfor i in range(cnt):\n\n num_count = 0\n\n (n, x) = num_set[i]\n\n for c in range(x//3, n+1):\n\n num_count += divide_two(c, x-c)\n\n print(num_count)\n", "code_v0_loc": 18, "code_v1_loc": 22, "code_v0_num_chars": 458, "code_v1_num_chars": 454, "code_v0_no_empty_lines": "def main():\n while True:\n n, x = tuple(map(int, input().split()))\n pattern = 0\n if n == x == 0:\n break\n else:\n for a in range(1, n + 1):\n for b in range(1, a):\n for c in range(1, b):\n pattern += 1 if a + b + c == x and a > b > c else 0\n print(pattern)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def divide_two(c, z):\n min_b = z // 2 + 1\n max_b = min(c - 1, z - 1)\n return max(max_b - min_b + 1, 0)\n\n\nnum_set = []\ncnt = 0\nwhile True:\n n, x = list(map(int, input().split()))\n if (n, x) == (0, 0):\n break\n else:\n num_set.append((n, x))\n cnt += 1\nfor i in range(cnt):\n num_count = 0\n (n, x) = num_set[i]\n for c in range(x // 3, n + 1):\n num_count += divide_two(c, x - c)\n print(num_count)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-def main():", "- while True:", "- n, x = tuple(map(int, input().split()))", "- pattern = 0", "- if n == x == 0:", "- break", "- else:", "- for a in range(1, n + 1):", "- for b in range(1, a):", "- for c in range(1, b):", "- pattern += 1 if a + b + c == x and a > b > c else 0", "- print(pattern)", "+def divide_two(c, z):", "+ min_b = z // 2 + 1", "+ max_b = min(c - 1, z - 1)", "+ return max(max_b - min_b + 1, 0)", "-if __name__ == \"__main__\":", "- main()", "+num_set = []", "+cnt = 0", "+while True:", "+ n, x = list(map(int, input().split()))", "+ if (n, x) == (0, 0):", "+ break", "+ else:", "+ num_set.append((n, x))", "+ cnt += 1", "+for i in range(cnt):", "+ num_count = 0", "+ (n, x) = num_set[i]", "+ for c in range(x // 3, n + 1):", "+ num_count += divide_two(c, x - c)", "+ print(num_count)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2920441294, "measured_runtime_v1": 0.2327923727, "runtime_lift": 1.2545261942, "key": ["s921182397", "s148735991"]} +{"user_id": "u392029857", "problem_id": "p03416", "language": "python", "submission_id_v0": "s263636434", "submission_id_v1": "s255168613", "cpu_time_v0": 110, "cpu_time_v1": 20, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.82, "input": "A, B = list(map(int, input().split()))\n\nnumbers = list(range(A, B+1))\n\ncount = 0\n\nfor i in numbers:\n\n m = str(i)\n\n rm = ''.join(list(reversed(m)))\n\n if m == rm:\n\n count += 1\n\nprint(count)", "target": "A, B = list(map(int, input().split()))\n\nx = list(range(1,10))\n\ny = list(range(10))\n\ncount = 0\n\nfor p in x:\n\n for q in y:\n\n for r in y:\n\n sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))\n\n if A <= sakasama <= B:\n\n count += 1\n\nprint(count)", "code_v0_loc": 9, "code_v1_loc": 11, "code_v0_num_chars": 191, "code_v1_num_chars": 268, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\nnumbers = list(range(A, B + 1))\ncount = 0\nfor i in numbers:\n m = str(i)\n rm = \"\".join(list(reversed(m)))\n if m == rm:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nx = list(range(1, 10))\ny = list(range(10))\ncount = 0\nfor p in x:\n for q in y:\n for r in y:\n sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))\n if A <= sakasama <= B:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-numbers = list(range(A, B + 1))", "+x = list(range(1, 10))", "+y = list(range(10))", "-for i in numbers:", "- m = str(i)", "- rm = \"\".join(list(reversed(m)))", "- if m == rm:", "- count += 1", "+for p in x:", "+ for q in y:", "+ for r in y:", "+ sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))", "+ if A <= sakasama <= B:", "+ count += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3536295901, "measured_runtime_v1": 0.1996227459, "runtime_lift": 1.7714894587, "key": ["s263636434", "s255168613"]} +{"user_id": "u634461820", "problem_id": "p02863", "language": "python", "submission_id_v0": "s061535189", "submission_id_v1": "s586045080", "cpu_time_v0": 1058, "cpu_time_v1": 461, "memory_v0": 183896, "memory_v1": 117976, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 56.43, "input": "import sys\n\nfrom operator import itemgetter\n\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return input()\n\n\n\nN, T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort(key=itemgetter(0))\n\n#print(ab)\n\n\n\ndp = [[0]*(T+1+3000+1) for _ in range(N+1)]\n\nans = 0\n\nfor i in range(N):\n\n for j in range(T+1+3000+1):\n\n time, deli = ab[i]\n\n if 0 <= j-time < T:\n\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n\n else:\n\n dp[i + 1][j] = dp[i][j]\n\n ans = max(ans, dp[i + 1][j])\n\nprint(ans)\n\n\n\n#print(dp)\n", "target": "import sys\n\nfrom collections import deque\n\nMAX_INT = int(10e10)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return input()\n\n\n\nN,T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort()\n\n\n\nans = 0\n\ndp = [[0]*T for i in range(N+1)]\n\nfor i in range(1,N+1):\n\n a,b = ab[i-1]\n\n for j in range(T):\n\n if 0 <= j-a < T:\n\n dp[i][j] = max(dp[i-1][j], dp[i-1][j-a] + b)\n\n else:\n\n dp[i][j] = dp[i-1][j]\n\n else:\n\n ans = max(ans, dp[i-1][-1] + b)\n\nprint(ans)", "code_v0_loc": 30, "code_v1_loc": 27, "code_v0_num_chars": 737, "code_v1_num_chars": 620, "code_v0_no_empty_lines": "import sys\nfrom operator import itemgetter\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\nMIN_INT = -MAX_INT\nmod = 1000000007\nsys.setrecursionlimit(1000000)\n\n\ndef IL():\n return list(map(int, input().split()))\n\n\ndef SL():\n return input().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\nN, T = IL()\nab = [IL() for i in range(N)]\nab.sort(key=itemgetter(0))\n# print(ab)\ndp = [[0] * (T + 1 + 3000 + 1) for _ in range(N + 1)]\nans = 0\nfor i in range(N):\n for j in range(T + 1 + 3000 + 1):\n time, deli = ab[i]\n if 0 <= j - time < T:\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n else:\n dp[i + 1][j] = dp[i][j]\n ans = max(ans, dp[i + 1][j])\nprint(ans)\n# print(dp)\n", "code_v1_no_empty_lines": "import sys\nfrom collections import deque\n\nMAX_INT = int(10e10)\nMIN_INT = -MAX_INT\nmod = 1000000007\nsys.setrecursionlimit(1000000)\n\n\ndef IL():\n return list(map(int, input().split()))\n\n\ndef SL():\n return input().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\nN, T = IL()\nab = [IL() for i in range(N)]\nab.sort()\nans = 0\ndp = [[0] * T for i in range(N + 1)]\nfor i in range(1, N + 1):\n a, b = ab[i - 1]\n for j in range(T):\n if 0 <= j - a < T:\n dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a] + b)\n else:\n dp[i][j] = dp[i - 1][j]\n else:\n ans = max(ans, dp[i - 1][-1] + b)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-from operator import itemgetter", "-from heapq import heapify, heappop, heappush", "+from collections import deque", "-MAX_INT = int(10e15)", "+MAX_INT = int(10e10)", "-ab.sort(key=itemgetter(0))", "-# print(ab)", "-dp = [[0] * (T + 1 + 3000 + 1) for _ in range(N + 1)]", "+ab.sort()", "-for i in range(N):", "- for j in range(T + 1 + 3000 + 1):", "- time, deli = ab[i]", "- if 0 <= j - time < T:", "- dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)", "+dp = [[0] * T for i in range(N + 1)]", "+for i in range(1, N + 1):", "+ a, b = ab[i - 1]", "+ for j in range(T):", "+ if 0 <= j - a < T:", "+ dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a] + b)", "- dp[i + 1][j] = dp[i][j]", "- ans = max(ans, dp[i + 1][j])", "+ dp[i][j] = dp[i - 1][j]", "+ else:", "+ ans = max(ans, dp[i - 1][-1] + b)", "-# print(dp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4860900669, "measured_runtime_v1": 0.3545958745, "runtime_lift": 1.3708283197, "key": ["s061535189", "s586045080"]} +{"user_id": "u968166680", "problem_id": "p02599", "language": "python", "submission_id_v0": "s648865207", "submission_id_v1": "s892817156", "cpu_time_v0": 1665, "cpu_time_v1": 1042, "memory_v0": 247668, "memory_v1": 267648, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.42, "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/\n\n# Python3 code to find number of\n\n# distinct numbers in a subarray\n\nMAX = 1000001\n\n\n\n# structure to store queries\n\nclass Query:\n\n def __init__(self, l, r, idx):\n\n self.l = l\n\n self.r = r\n\n self.idx = idx\n\n\n\n\n\n# updating the bit array\n\ndef update(idx, val, bit, n):\n\n while idx <= n:\n\n bit[idx] += val\n\n idx += idx & -idx\n\n\n\n\n\n# querying the bit array\n\ndef query(idx, bit, n):\n\n summ = 0\n\n while idx:\n\n summ += bit[idx]\n\n idx -= idx & -idx\n\n return summ\n\n\n\n\n\ndef answeringQueries(arr, n, queries, q):\n\n\n\n # initialising bit array\n\n bit = [0] * (n + 1)\n\n\n\n # holds the rightmost index of\n\n # any number as numbers of a[i]\n\n # are less than or equal to 10^6\n\n last_visit = [-1] * MAX\n\n\n\n # answer for each query\n\n ans = [0] * q\n\n\n\n query_counter = 0\n\n for i in range(n):\n\n\n\n # If last visit is not -1 update -1 at the\n\n # idx equal to last_visit[arr[i]]\n\n if last_visit[arr[i]] != -1:\n\n update(last_visit[arr[i]] + 1, -1, bit, n)\n\n\n\n # Setting last_visit[arr[i]] as i and\n\n # updating the bit array accordingly\n\n last_visit[arr[i]] = i\n\n update(i + 1, 1, bit, n)\n\n\n\n # If i is equal to r of any query store answer\n\n # for that query in ans[]\n\n while query_counter < q and queries[query_counter].r == i:\n\n ans[queries[query_counter].idx] = query(queries[query_counter].r + 1, bit, n) - query(\n\n queries[query_counter].l, bit, n\n\n )\n\n query_counter += 1\n\n\n\n # print answer for each query\n\n for i in range(q):\n\n print((ans[i]))\n\n\n\n\n\n# This code is contributed by\n\n# sanjeev2552\n\n\n\n\n\ndef main():\n\n N, Q = list(map(int, readline().split()))\n\n C = list(map(int, readline().split()))\n\n (*LR,) = list(map(int, read().split()))\n\n\n\n queries = [0] * Q\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n queries[i] = Query(l - 1, r - 1, i)\n\n\n\n queries.sort(key=lambda x: x.r)\n\n answeringQueries(C, N, queries, Q)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n", "target": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n\n\nclass BIT:\n\n def __init__(self, n):\n\n self.n = n\n\n self.data = [0] * (n + 1)\n\n\n\n def add(self, i, x=1):\n\n i += 1\n\n while i <= self.n:\n\n self.data[i] += x\n\n i += i & -i\n\n\n\n def get_sum(self, i):\n\n i += 1\n\n x = 0\n\n while i > 0:\n\n x += self.data[i]\n\n i -= i & -i\n\n return x\n\n\n\n # Return sum for [l, r)\n\n def get_sum_range(self, l, r):\n\n return self.get_sum(r - 1) - self.get_sum(l - 1)\n\n\n\n\n\ndef main():\n\n N, Q = map(int, readline().split())\n\n C = list(map(int, readline().split()))\n\n LR = map(int, read().split())\n\n\n\n prev = [-1] * (N + 1)\n\n ps = [[] for _ in range(N)]\n\n for i, c in enumerate(C):\n\n if prev[c] != -1:\n\n ps[prev[c]].append(i)\n\n prev[c] = i\n\n\n\n qs = [[] for _ in range(N + 1)]\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n l -= 1\n\n r -= 1\n\n qs[l].append((r, i))\n\n\n\n ans = [0] * Q\n\n bit = BIT(N)\n\n\n\n for l in range(N - 1, -1, -1):\n\n for r in ps[l]:\n\n bit.add(r)\n\n for r, i in qs[l]:\n\n ans[i] = (r - l + 1) - bit.get_sum(r)\n\n\n\n print(*ans, sep='\\n')\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 99, "code_v1_loc": 68, "code_v0_num_chars": 2366, "code_v1_num_chars": 1436, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/\n# Python3 code to find number of\n# distinct numbers in a subarray\nMAX = 1000001\n# structure to store queries\nclass Query:\n def __init__(self, l, r, idx):\n self.l = l\n self.r = r\n self.idx = idx\n\n\n# updating the bit array\ndef update(idx, val, bit, n):\n while idx <= n:\n bit[idx] += val\n idx += idx & -idx\n\n\n# querying the bit array\ndef query(idx, bit, n):\n summ = 0\n while idx:\n summ += bit[idx]\n idx -= idx & -idx\n return summ\n\n\ndef answeringQueries(arr, n, queries, q):\n # initialising bit array\n bit = [0] * (n + 1)\n # holds the rightmost index of\n # any number as numbers of a[i]\n # are less than or equal to 10^6\n last_visit = [-1] * MAX\n # answer for each query\n ans = [0] * q\n query_counter = 0\n for i in range(n):\n # If last visit is not -1 update -1 at the\n # idx equal to last_visit[arr[i]]\n if last_visit[arr[i]] != -1:\n update(last_visit[arr[i]] + 1, -1, bit, n)\n # Setting last_visit[arr[i]] as i and\n # updating the bit array accordingly\n last_visit[arr[i]] = i\n update(i + 1, 1, bit, n)\n # If i is equal to r of any query store answer\n # for that query in ans[]\n while query_counter < q and queries[query_counter].r == i:\n ans[queries[query_counter].idx] = query(\n queries[query_counter].r + 1, bit, n\n ) - query(queries[query_counter].l, bit, n)\n query_counter += 1\n # print answer for each query\n for i in range(q):\n print((ans[i]))\n\n\n# This code is contributed by\n# sanjeev2552\ndef main():\n N, Q = list(map(int, readline().split()))\n C = list(map(int, readline().split()))\n (*LR,) = list(map(int, read().split()))\n queries = [0] * Q\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n queries[i] = Query(l - 1, r - 1, i)\n queries.sort(key=lambda x: x.r)\n answeringQueries(C, N, queries, Q)\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n\n\nclass BIT:\n def __init__(self, n):\n self.n = n\n self.data = [0] * (n + 1)\n\n def add(self, i, x=1):\n i += 1\n while i <= self.n:\n self.data[i] += x\n i += i & -i\n\n def get_sum(self, i):\n i += 1\n x = 0\n while i > 0:\n x += self.data[i]\n i -= i & -i\n return x\n\n # Return sum for [l, r)\n def get_sum_range(self, l, r):\n return self.get_sum(r - 1) - self.get_sum(l - 1)\n\n\ndef main():\n N, Q = map(int, readline().split())\n C = list(map(int, readline().split()))\n LR = map(int, read().split())\n prev = [-1] * (N + 1)\n ps = [[] for _ in range(N)]\n for i, c in enumerate(C):\n if prev[c] != -1:\n ps[prev[c]].append(i)\n prev[c] = i\n qs = [[] for _ in range(N + 1)]\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n l -= 1\n r -= 1\n qs[l].append((r, i))\n ans = [0] * Q\n bit = BIT(N)\n for l in range(N - 1, -1, -1):\n for r in ps[l]:\n bit.add(r)\n for r, i in qs[l]:\n ans[i] = (r - l + 1) - bit.get_sum(r)\n print(*ans, sep=\"\\n\")\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 31.3131313131, "diff": ["-# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/", "-# Python3 code to find number of", "-# distinct numbers in a subarray", "-MAX = 1000001", "-# structure to store queries", "-class Query:", "- def __init__(self, l, r, idx):", "- self.l = l", "- self.r = r", "- self.idx = idx", "-# updating the bit array", "-def update(idx, val, bit, n):", "- while idx <= n:", "- bit[idx] += val", "- idx += idx & -idx", "+class BIT:", "+ def __init__(self, n):", "+ self.n = n", "+ self.data = [0] * (n + 1)", "+", "+ def add(self, i, x=1):", "+ i += 1", "+ while i <= self.n:", "+ self.data[i] += x", "+ i += i & -i", "+", "+ def get_sum(self, i):", "+ i += 1", "+ x = 0", "+ while i > 0:", "+ x += self.data[i]", "+ i -= i & -i", "+ return x", "+", "+ # Return sum for [l, r)", "+ def get_sum_range(self, l, r):", "+ return self.get_sum(r - 1) - self.get_sum(l - 1)", "-# querying the bit array", "-def query(idx, bit, n):", "- summ = 0", "- while idx:", "- summ += bit[idx]", "- idx -= idx & -idx", "- return summ", "-", "-", "-def answeringQueries(arr, n, queries, q):", "- # initialising bit array", "- bit = [0] * (n + 1)", "- # holds the rightmost index of", "- # any number as numbers of a[i]", "- # are less than or equal to 10^6", "- last_visit = [-1] * MAX", "- # answer for each query", "- ans = [0] * q", "- query_counter = 0", "- for i in range(n):", "- # If last visit is not -1 update -1 at the", "- # idx equal to last_visit[arr[i]]", "- if last_visit[arr[i]] != -1:", "- update(last_visit[arr[i]] + 1, -1, bit, n)", "- # Setting last_visit[arr[i]] as i and", "- # updating the bit array accordingly", "- last_visit[arr[i]] = i", "- update(i + 1, 1, bit, n)", "- # If i is equal to r of any query store answer", "- # for that query in ans[]", "- while query_counter < q and queries[query_counter].r == i:", "- ans[queries[query_counter].idx] = query(", "- queries[query_counter].r + 1, bit, n", "- ) - query(queries[query_counter].l, bit, n)", "- query_counter += 1", "- # print answer for each query", "- for i in range(q):", "- print((ans[i]))", "-", "-", "-# This code is contributed by", "-# sanjeev2552", "- N, Q = list(map(int, readline().split()))", "+ N, Q = map(int, readline().split())", "- (*LR,) = list(map(int, read().split()))", "- queries = [0] * Q", "+ LR = map(int, read().split())", "+ prev = [-1] * (N + 1)", "+ ps = [[] for _ in range(N)]", "+ for i, c in enumerate(C):", "+ if prev[c] != -1:", "+ ps[prev[c]].append(i)", "+ prev[c] = i", "+ qs = [[] for _ in range(N + 1)]", "- queries[i] = Query(l - 1, r - 1, i)", "- queries.sort(key=lambda x: x.r)", "- answeringQueries(C, N, queries, Q)", "+ l -= 1", "+ r -= 1", "+ qs[l].append((r, i))", "+ ans = [0] * Q", "+ bit = BIT(N)", "+ for l in range(N - 1, -1, -1):", "+ for r in ps[l]:", "+ bit.add(r)", "+ for r, i in qs[l]:", "+ ans[i] = (r - l + 1) - bit.get_sum(r)", "+ print(*ans, sep=\"\\n\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.264044944, "measured_runtime_v1": 0.2106282006, "runtime_lift": 1.2536067971, "key": ["s648865207", "s892817156"]} +{"user_id": "u855831834", "problem_id": "p02596", "language": "python", "submission_id_v0": "s777833838", "submission_id_v1": "s349314776", "cpu_time_v0": 179, "cpu_time_v1": 88, "memory_v0": 9072, "memory_v1": 63520, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.84, "input": "k = int(input())\n\nnum = 0\n\nif not k%2:\n\n print((-1))\n\nelse:\n\n for i in range(k):\n\n num = (num*10+7)%k\n\n if num == 0:\n\n print((i+1))\n\n break\n\n else:\n\n print((-1))", "target": "K = int(input())\n\n\n\nans = 1\n\nnum = 0\n\nseven = 7\n\n\n\nif not K%2:\n\n print((-1))\n\nelse:\n\n for i in range(K):\n\n num = num + seven\n\n seven = seven*10%K\n\n num = num%K\n\n if num == 0:\n\n print(ans)\n\n break\n\n ans += 1\n\n else:\n\n print((-1))", "code_v0_loc": 12, "code_v1_loc": 19, "code_v0_num_chars": 207, "code_v1_num_chars": 297, "code_v0_no_empty_lines": "k = int(input())\nnum = 0\nif not k % 2:\n print((-1))\nelse:\n for i in range(k):\n num = (num * 10 + 7) % k\n if num == 0:\n print((i + 1))\n break\n else:\n print((-1))\n", "code_v1_no_empty_lines": "K = int(input())\nans = 1\nnum = 0\nseven = 7\nif not K % 2:\n print((-1))\nelse:\n for i in range(K):\n num = num + seven\n seven = seven * 10 % K\n num = num % K\n if num == 0:\n print(ans)\n break\n ans += 1\n else:\n print((-1))\n", "code_same": false, "relative_loc_diff_percent": 36.8421052632, "diff": ["-k = int(input())", "+K = int(input())", "+ans = 1", "-if not k % 2:", "+seven = 7", "+if not K % 2:", "- for i in range(k):", "- num = (num * 10 + 7) % k", "+ for i in range(K):", "+ num = num + seven", "+ seven = seven * 10 % K", "+ num = num % K", "- print((i + 1))", "+ print(ans)", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.513984643, "measured_runtime_v1": 0.3340408325, "runtime_lift": 1.5386880672, "key": ["s777833838", "s349314776"]} +{"user_id": "u444560129", "problem_id": "p02596", "language": "python", "submission_id_v0": "s838540391", "submission_id_v1": "s786083962", "cpu_time_v0": 192, "cpu_time_v1": 156, "memory_v0": 9088, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.75, "input": "k = int(input())\n\ncount = 1\n\nn = 0\n\nif k % 2 == 0 or k % 5 == 0:\n\n print((-1))\n\nelse:\n\n while 1:\n\n n = (n * 10 + 7) % k \n\n if n == 0:\n\n break \n\n count += 1\n\n print(count)", "target": "def main(h):\n\n count = 1\n\n n = 0\n\n for i in range (k):\n\n n = (n * 10 + 7) % k \n\n if n == 0: \n\n print(count)\n\n return 0\n\n count += 1\n\n print((-1))\n\n \n\nif __name__ == '__main__':\n\n k = int(input())\n\n main(k)", "code_v0_loc": 12, "code_v1_loc": 14, "code_v0_num_chars": 196, "code_v1_num_chars": 230, "code_v0_no_empty_lines": "k = int(input())\ncount = 1\nn = 0\nif k % 2 == 0 or k % 5 == 0:\n print((-1))\nelse:\n while 1:\n n = (n * 10 + 7) % k\n if n == 0:\n break\n count += 1\n print(count)\n", "code_v1_no_empty_lines": "def main(h):\n count = 1\n n = 0\n for i in range(k):\n n = (n * 10 + 7) % k\n if n == 0:\n print(count)\n return 0\n count += 1\n print((-1))\n\n\nif __name__ == \"__main__\":\n k = int(input())\n main(k)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-k = int(input())", "-count = 1", "-n = 0", "-if k % 2 == 0 or k % 5 == 0:", "- print((-1))", "-else:", "- while 1:", "+def main(h):", "+ count = 1", "+ n = 0", "+ for i in range(k):", "- break", "+ print(count)", "+ return 0", "- print(count)", "+ print((-1))", "+", "+", "+if __name__ == \"__main__\":", "+ k = int(input())", "+ main(k)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.359774395, "measured_runtime_v1": 0.0061541715, "runtime_lift": 58.4602486856, "key": ["s838540391", "s786083962"]} +{"user_id": "u089376182", "problem_id": "p03250", "language": "python", "submission_id_v0": "s131709017", "submission_id_v1": "s244884559", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "a, b, c = sorted(map(int, input().split()))\n\n\n\nprint((c*10 + b + a))", "target": "a, b, c = list(map(int, input().split()))\n\n\n\nprint((max(a, b, c)*9 + (a + b + c)))", "code_v0_loc": 3, "code_v1_loc": 3, "code_v0_num_chars": 66, "code_v1_num_chars": 74, "code_v0_no_empty_lines": "a, b, c = sorted(map(int, input().split()))\nprint((c * 10 + b + a))\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nprint((max(a, b, c) * 9 + (a + b + c)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-a, b, c = sorted(map(int, input().split()))", "-print((c * 10 + b + a))", "+a, b, c = list(map(int, input().split()))", "+print((max(a, b, c) * 9 + (a + b + c)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2633334219, "measured_runtime_v1": 0.0501041813, "runtime_lift": 5.2557174893, "key": ["s131709017", "s244884559"]} +{"user_id": "u813098295", "problem_id": "p03371", "language": "python", "submission_id_v0": "s229566237", "submission_id_v1": "s072536815", "cpu_time_v0": 222, "cpu_time_v1": 129, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 41.89, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(200005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)", "target": "a, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(100005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 204, "code_v1_num_chars": 204, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(200005):\n tmp = i * 2 * c\n tmp += max(0, x - i) * a\n tmp += max(0, y - i) * b\n ans = min(ans, tmp)\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(100005):\n tmp = i * 2 * c\n tmp += max(0, x - i) * a\n tmp += max(0, y - i) * b\n ans = min(ans, tmp)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-for i in range(200005):", "+for i in range(100005):"], "diff_only_import_comment": false, "measured_runtime_v0": 2.0992211397, "measured_runtime_v1": 1.3130319312, "runtime_lift": 1.5987586363, "key": ["s229566237", "s072536815"]} +{"user_id": "u576434377", "problem_id": "p03568", "language": "python", "submission_id_v0": "s245503579", "submission_id_v1": "s305475228", "cpu_time_v0": 101, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.17, "input": "N = int(input())\n\nAs = list(map(int,input().split()))\n\n\n\n\n\ndef dfs(A_s, index,Bss):\n\n if index == N:\n\n tmp = 1\n\n for b in Bss:\n\n tmp *= b\n\n return 1 if tmp % 2 == 0 else 0\n\n b_mi = Bss.copy()\n\n b_mi.append(A_s[index] - 1)\n\n\n\n b = Bss.copy()\n\n b.append(A_s[index])\n\n\n\n b_pl = Bss.copy()\n\n b_pl.append(A_s[index] + 1)\n\n return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)\n\n\n\n\n\nprint((dfs(As,0,[])))\n", "target": "N = int(input())\n\nAs = list(map(int,input().split()))\n\n\n\ntmp = 1\n\nfor i in range(N):\n\n if As[i] % 2 == 0:\n\n tmp *= 2\n\n\n\nprint((3 ** N - tmp))", "code_v0_loc": 22, "code_v1_loc": 9, "code_v0_num_chars": 480, "code_v1_num_chars": 148, "code_v0_no_empty_lines": "N = int(input())\nAs = list(map(int, input().split()))\n\n\ndef dfs(A_s, index, Bss):\n if index == N:\n tmp = 1\n for b in Bss:\n tmp *= b\n return 1 if tmp % 2 == 0 else 0\n b_mi = Bss.copy()\n b_mi.append(A_s[index] - 1)\n b = Bss.copy()\n b.append(A_s[index])\n b_pl = Bss.copy()\n b_pl.append(A_s[index] + 1)\n return (\n dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)\n )\n\n\nprint((dfs(As, 0, [])))\n", "code_v1_no_empty_lines": "N = int(input())\nAs = list(map(int, input().split()))\ntmp = 1\nfor i in range(N):\n if As[i] % 2 == 0:\n tmp *= 2\nprint((3**N - tmp))\n", "code_same": false, "relative_loc_diff_percent": 59.0909090909, "diff": ["-", "-", "-def dfs(A_s, index, Bss):", "- if index == N:", "- tmp = 1", "- for b in Bss:", "- tmp *= b", "- return 1 if tmp % 2 == 0 else 0", "- b_mi = Bss.copy()", "- b_mi.append(A_s[index] - 1)", "- b = Bss.copy()", "- b.append(A_s[index])", "- b_pl = Bss.copy()", "- b_pl.append(A_s[index] + 1)", "- return (", "- dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)", "- )", "-", "-", "-print((dfs(As, 0, [])))", "+tmp = 1", "+for i in range(N):", "+ if As[i] % 2 == 0:", "+ tmp *= 2", "+print((3**N - tmp))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4574659042, "measured_runtime_v1": 0.2742938831, "runtime_lift": 1.6677947721, "key": ["s245503579", "s305475228"]} +{"user_id": "u414877092", "problem_id": "p03796", "language": "python", "submission_id_v0": "s477602976", "submission_id_v1": "s500304823", "cpu_time_v0": 230, "cpu_time_v1": 31, "memory_v0": 4024, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 86.52, "input": "import math\n\nn=int(input())\n\nprint((math.factorial(n)%(10**9+7)))", "target": "N=int(input())\n\ndef fact(n):\n\n val=1\n\n for i in range(2,n+1):\n\n val*=i\n\n val%=1000000007\n\n return val\n\nprint((fact(N)))", "code_v0_loc": 3, "code_v1_loc": 8, "code_v0_num_chars": 63, "code_v1_num_chars": 140, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "N = int(input())\n\n\ndef fact(n):\n val = 1\n for i in range(2, n + 1):\n val *= i\n val %= 1000000007\n return val\n\n\nprint((fact(N)))\n", "code_same": false, "relative_loc_diff_percent": 62.5, "diff": ["-import math", "+N = int(input())", "-n = int(input())", "-print((math.factorial(n) % (10**9 + 7)))", "+", "+def fact(n):", "+ val = 1", "+ for i in range(2, n + 1):", "+ val *= i", "+ val %= 1000000007", "+ return val", "+", "+", "+print((fact(N)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5394072673, "measured_runtime_v1": 0.259771318, "runtime_lift": 2.0764696871, "key": ["s477602976", "s500304823"]} +{"user_id": "u893063840", "problem_id": "p03801", "language": "python", "submission_id_v0": "s790222372", "submission_id_v1": "s964537161", "cpu_time_v0": 316, "cpu_time_v1": 278, "memory_v0": 40396, "memory_v1": 31800, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.03, "input": "n = int(input())\n\na = list(map(int, input().split()))\n\n\n\ntmp = [[e, n - i] for i, e in enumerate(a)]\n\ntmp.sort(reverse=True)\n\n\n\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\n\n\n\nv_prev, i_prev = aa[0]\n\ni = 0\n\nans = [0] * n\n\nsm = 0\n\nwhile i < n:\n\n while aa[i][1] >= i_prev:\n\n sm += aa[i][0]\n\n i += 1\n\n\n\n ans[i_prev] += sm - aa[i][0] * i\n\n sm = aa[i][0] * i\n\n v_prev, i_prev = aa[i]\n\n\n\nprint(*ans, sep=\"\\n\")\n", "target": "from bisect import bisect_right\n\n\n\nn = int(input())\n\na = list(map(int, input().split()))\n\n\n\nli = [[0, -1]]\n\nfor i, e in enumerate(a):\n\n if e > li[-1][0]:\n\n li.append([e, i])\n\n\n\nli = li[::-1]\n\n\n\na.sort()\n\nacc = [0] * (n + 1)\n\nfor i in range(n - 1, -1, -1):\n\n acc[i] = acc[i+1] + a[i]\n\n\n\nans = [0] * n\n\nsub = 0\n\nans_prev = 0\n\nfor (ep, ip), (e, i) in zip(li, li[1:]):\n\n j = bisect_right(a, e)\n\n ans[ip] = acc[j] - e * (n - j)\n\n\n\ni_prev = 0\n\nfor i in range(1, n):\n\n if ans[i]:\n\n ans[i_prev] -= ans[i]\n\n i_prev = i\n\n\n\nprint(*ans, sep=\"\\n\")\n", "code_v0_loc": 22, "code_v1_loc": 31, "code_v0_num_chars": 431, "code_v1_num_chars": 571, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\ntmp = [[e, n - i] for i, e in enumerate(a)]\ntmp.sort(reverse=True)\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\nv_prev, i_prev = aa[0]\ni = 0\nans = [0] * n\nsm = 0\nwhile i < n:\n while aa[i][1] >= i_prev:\n sm += aa[i][0]\n i += 1\n ans[i_prev] += sm - aa[i][0] * i\n sm = aa[i][0] * i\n v_prev, i_prev = aa[i]\nprint(*ans, sep=\"\\n\")\n", "code_v1_no_empty_lines": "from bisect import bisect_right\n\nn = int(input())\na = list(map(int, input().split()))\nli = [[0, -1]]\nfor i, e in enumerate(a):\n if e > li[-1][0]:\n li.append([e, i])\nli = li[::-1]\na.sort()\nacc = [0] * (n + 1)\nfor i in range(n - 1, -1, -1):\n acc[i] = acc[i + 1] + a[i]\nans = [0] * n\nsub = 0\nans_prev = 0\nfor (ep, ip), (e, i) in zip(li, li[1:]):\n j = bisect_right(a, e)\n ans[ip] = acc[j] - e * (n - j)\ni_prev = 0\nfor i in range(1, n):\n if ans[i]:\n ans[i_prev] -= ans[i]\n i_prev = i\nprint(*ans, sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 29.0322580645, "diff": ["+from bisect import bisect_right", "+", "-tmp = [[e, n - i] for i, e in enumerate(a)]", "-tmp.sort(reverse=True)", "-aa = [[e, n - i] for e, i in tmp] + [[0, -1]]", "-v_prev, i_prev = aa[0]", "-i = 0", "+li = [[0, -1]]", "+for i, e in enumerate(a):", "+ if e > li[-1][0]:", "+ li.append([e, i])", "+li = li[::-1]", "+a.sort()", "+acc = [0] * (n + 1)", "+for i in range(n - 1, -1, -1):", "+ acc[i] = acc[i + 1] + a[i]", "-sm = 0", "-while i < n:", "- while aa[i][1] >= i_prev:", "- sm += aa[i][0]", "- i += 1", "- ans[i_prev] += sm - aa[i][0] * i", "- sm = aa[i][0] * i", "- v_prev, i_prev = aa[i]", "+sub = 0", "+ans_prev = 0", "+for (ep, ip), (e, i) in zip(li, li[1:]):", "+ j = bisect_right(a, e)", "+ ans[ip] = acc[j] - e * (n - j)", "+i_prev = 0", "+for i in range(1, n):", "+ if ans[i]:", "+ ans[i_prev] -= ans[i]", "+ i_prev = i"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2510323788, "measured_runtime_v1": 0.1409289612, "runtime_lift": 1.7812689216, "key": ["s790222372", "s964537161"]} +{"user_id": "u970197315", "problem_id": "p03013", "language": "python", "submission_id_v0": "s479618893", "submission_id_v1": "s899240371", "cpu_time_v0": 212, "cpu_time_v1": 187, "memory_v0": 9612, "memory_v1": 7848, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.79, "input": "N, M = list(map(int, input().split()))\n\nA_ = [int(input()) for _ in range(M)]\n\nA = [0] * (N+3)\n\nfor a in A_:\n\n A[a] = 1\n\ndp = [0] * (N+3)\n\ndp[0] = 1\n\n\n\nmod = 10**9+7\n\n\n\nfor i in range(1, N+1):\n\n if A[i-1] == 0:\n\n dp[i] += dp[i-1]\n\n if A[i-2] == 0:\n\n dp[i] += dp[i-2]\n\n dp[i] %= mod\n\nprint((dp[N]))", "target": "n,m=list(map(int,input().split()))\n\ndp=[0]*(n+3)\n\na=[int(input()) for i in range(m)]\n\nmod=10**9+7\n\nfor i in range(m):\n\n dp[a[i]]=-1\n\n\n\ndp[0]=1\n\nif dp[1]!=-1:\n\n dp[1]+=dp[0]\n\n\n\nfor i in range(n+1):\n\n if dp[i+2]==-1:\n\n continue\n\n if dp[i]!=-1:\n\n dp[i+2]+=dp[i]\n\n if dp[i+1]!=-1:\n\n dp[i+2]+=dp[i+1]\n\n dp[i+2]%=mod\n\nprint((dp[n]%mod))", "code_v0_loc": 17, "code_v1_loc": 20, "code_v0_num_chars": 315, "code_v1_num_chars": 361, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nA_ = [int(input()) for _ in range(M)]\nA = [0] * (N + 3)\nfor a in A_:\n A[a] = 1\ndp = [0] * (N + 3)\ndp[0] = 1\nmod = 10**9 + 7\nfor i in range(1, N + 1):\n if A[i - 1] == 0:\n dp[i] += dp[i - 1]\n if A[i - 2] == 0:\n dp[i] += dp[i - 2]\n dp[i] %= mod\nprint((dp[N]))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\ndp = [0] * (n + 3)\na = [int(input()) for i in range(m)]\nmod = 10**9 + 7\nfor i in range(m):\n dp[a[i]] = -1\ndp[0] = 1\nif dp[1] != -1:\n dp[1] += dp[0]\nfor i in range(n + 1):\n if dp[i + 2] == -1:\n continue\n if dp[i] != -1:\n dp[i + 2] += dp[i]\n if dp[i + 1] != -1:\n dp[i + 2] += dp[i + 1]\n dp[i + 2] %= mod\nprint((dp[n] % mod))\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["-N, M = list(map(int, input().split()))", "-A_ = [int(input()) for _ in range(M)]", "-A = [0] * (N + 3)", "-for a in A_:", "- A[a] = 1", "-dp = [0] * (N + 3)", "+n, m = list(map(int, input().split()))", "+dp = [0] * (n + 3)", "+a = [int(input()) for i in range(m)]", "+mod = 10**9 + 7", "+for i in range(m):", "+ dp[a[i]] = -1", "-mod = 10**9 + 7", "-for i in range(1, N + 1):", "- if A[i - 1] == 0:", "- dp[i] += dp[i - 1]", "- if A[i - 2] == 0:", "- dp[i] += dp[i - 2]", "- dp[i] %= mod", "-print((dp[N]))", "+if dp[1] != -1:", "+ dp[1] += dp[0]", "+for i in range(n + 1):", "+ if dp[i + 2] == -1:", "+ continue", "+ if dp[i] != -1:", "+ dp[i + 2] += dp[i]", "+ if dp[i + 1] != -1:", "+ dp[i + 2] += dp[i + 1]", "+ dp[i + 2] %= mod", "+print((dp[n] % mod))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2706730585, "measured_runtime_v1": 0.2065423949, "runtime_lift": 1.3104963688, "key": ["s479618893", "s899240371"]} +{"user_id": "u573754721", "problem_id": "p02792", "language": "python", "submission_id_v0": "s001079757", "submission_id_v1": "s791261959", "cpu_time_v0": 461, "cpu_time_v1": 326, "memory_v0": 40684, "memory_v1": 40428, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.28, "input": "n=int(input())\n\nD={}\n\nDD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n t=(str(i)[-1],str(i)[0])\n\n if s not in D:\n\n D[s]=1\n\n else:\n\n D[s]+=1\n\n if t not in DD:\n\n DD[t]=1\n\n else:\n\n DD[t]+=1\n\nans=0\n\nfor i in D:\n\n if i in DD:\n\n ans+=D[i]*DD[i]\n\nprint(ans)\n\n ", "target": "n=int(input())\n\nD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n if s in D:\n\n D[s]+=1\n\n else:\n\n D[s]=1\n\n\n\nans=0\n\nfor aj,bj in D:\n\n if (bj,aj) in D:\n\n ans+=D[(aj,bj)]*D[(bj,aj)]\n\nprint(ans)", "code_v0_loc": 20, "code_v1_loc": 14, "code_v0_num_chars": 307, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "n = int(input())\nD = {}\nDD = {}\nfor i in range(1, n + 1):\n s = (str(i)[0], str(i)[-1])\n t = (str(i)[-1], str(i)[0])\n if s not in D:\n D[s] = 1\n else:\n D[s] += 1\n if t not in DD:\n DD[t] = 1\n else:\n DD[t] += 1\nans = 0\nfor i in D:\n if i in DD:\n ans += D[i] * DD[i]\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nD = {}\nfor i in range(1, n + 1):\n s = (str(i)[0], str(i)[-1])\n if s in D:\n D[s] += 1\n else:\n D[s] = 1\nans = 0\nfor aj, bj in D:\n if (bj, aj) in D:\n ans += D[(aj, bj)] * D[(bj, aj)]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-DD = {}", "- t = (str(i)[-1], str(i)[0])", "- if s not in D:", "+ if s in D:", "+ D[s] += 1", "+ else:", "- else:", "- D[s] += 1", "- if t not in DD:", "- DD[t] = 1", "- else:", "- DD[t] += 1", "-for i in D:", "- if i in DD:", "- ans += D[i] * DD[i]", "+for aj, bj in D:", "+ if (bj, aj) in D:", "+ ans += D[(aj, bj)] * D[(bj, aj)]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4521915812, "measured_runtime_v1": 0.3498246684, "runtime_lift": 1.2926234825, "key": ["s001079757", "s791261959"]} +{"user_id": "u486297080", "problem_id": "p03796", "language": "python", "submission_id_v0": "s015826115", "submission_id_v1": "s256698183", "cpu_time_v0": 231, "cpu_time_v1": 37, "memory_v0": 4020, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.98, "input": "import math\n\n\n\nN = int(input())\n\nans = 0\n\n\n\nans =math.factorial(N) % (10**9 +7)\n\n\n\nprint(ans)", "target": "N = int(input())\n\npower = 1\n\n\n\nfor i in range(N):\n\n power = ((i+1) * power) % 1000000007\n\n\n\nprint(power)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 93, "code_v1_num_chars": 107, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = 0\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\npower = 1\nfor i in range(N):\n power = ((i + 1) * power) % 1000000007\nprint(power)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-import math", "-", "-ans = 0", "-ans = math.factorial(N) % (10**9 + 7)", "-print(ans)", "+power = 1", "+for i in range(N):", "+ power = ((i + 1) * power) % 1000000007", "+print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5450858786, "measured_runtime_v1": 0.2547745125, "runtime_lift": 2.1394835503, "key": ["s015826115", "s256698183"]} +{"user_id": "u023958502", "problem_id": "p03078", "language": "python", "submission_id_v0": "s928848207", "submission_id_v1": "s406476908", "cpu_time_v0": 1927, "cpu_time_v1": 827, "memory_v0": 4720, "memory_v1": 4592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.08, "input": "X,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nalready = [[0,0,0]]\n\nx,y,z = 0,0,0\n\nplace_sum = []\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n place_sum.append([x + 1,y,z])\n\n check.append(asort[x + 1] + bsort[y] + csort[z])\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n place_sum.append([x,y + 1,z])\n\n check.append(asort[x] + bsort[y + 1] + csort[z])\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n place_sum.append([x,y,z + 1])\n\n check.append(asort[x] + bsort[y] + csort[z + 1])\n\n print((max(check)))\n\n x,y,z = place_sum[check.index(max(check))][0],place_sum[check.index(max(check))][1],place_sum[check.index(max(check))][2]\n\n place_sum.pop(check.index(max(check)))\n\n check.remove(max(check))", "target": "import heapq\n\nX,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nalready = [[0,0,0]]\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nx,y,z = 0,0,0\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n heapq.heappush(check,(-(asort[x + 1] + bsort[y] + csort[z]),x + 1,y,z))\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n heapq.heappush(check,(-(asort[x] + bsort[y + 1] + csort[z]),x,y + 1,z))\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n heapq.heappush(check,(-(asort[x] + bsort[y] + csort[z + 1]),x,y,z + 1))\n\n maxsum = heapq.heappop(check)\n\n print((-maxsum[0]))\n\n x,y,z = maxsum[1],maxsum[2],maxsum[3]", "code_v0_loc": 27, "code_v1_loc": 23, "code_v0_num_chars": 1135, "code_v1_num_chars": 962, "code_v0_no_empty_lines": "X, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nasort, bsort, csort = (\n sorted(A, reverse=True),\n sorted(B, reverse=True),\n sorted(C, reverse=True),\n)\nprint((asort[0] + bsort[0] + csort[0]))\nalready = [[0, 0, 0]]\nx, y, z = 0, 0, 0\nplace_sum = []\ncheck = []\nfor k in range(K - 1):\n if [x + 1, y, z] not in already and x + 1 < X:\n already.append([x + 1, y, z])\n place_sum.append([x + 1, y, z])\n check.append(asort[x + 1] + bsort[y] + csort[z])\n if [x, y + 1, z] not in already and y + 1 < Y:\n already.append([x, y + 1, z])\n place_sum.append([x, y + 1, z])\n check.append(asort[x] + bsort[y + 1] + csort[z])\n if [x, y, z + 1] not in already and z + 1 < Z:\n already.append([x, y, z + 1])\n place_sum.append([x, y, z + 1])\n check.append(asort[x] + bsort[y] + csort[z + 1])\n print((max(check)))\n x, y, z = (\n place_sum[check.index(max(check))][0],\n place_sum[check.index(max(check))][1],\n place_sum[check.index(max(check))][2],\n )\n place_sum.pop(check.index(max(check)))\n check.remove(max(check))\n", "code_v1_no_empty_lines": "import heapq\n\nX, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nasort, bsort, csort = (\n sorted(A, reverse=True),\n sorted(B, reverse=True),\n sorted(C, reverse=True),\n)\nalready = [[0, 0, 0]]\nprint((asort[0] + bsort[0] + csort[0]))\nx, y, z = 0, 0, 0\ncheck = []\nfor k in range(K - 1):\n if [x + 1, y, z] not in already and x + 1 < X:\n already.append([x + 1, y, z])\n heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))\n if [x, y + 1, z] not in already and y + 1 < Y:\n already.append([x, y + 1, z])\n heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))\n if [x, y, z + 1] not in already and z + 1 < Z:\n already.append([x, y, z + 1])\n heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))\n maxsum = heapq.heappop(check)\n print((-maxsum[0]))\n x, y, z = maxsum[1], maxsum[2], maxsum[3]\n", "code_same": false, "relative_loc_diff_percent": 14.8148148148, "diff": ["+import heapq", "+", "+already = [[0, 0, 0]]", "-already = [[0, 0, 0]]", "-place_sum = []", "- place_sum.append([x + 1, y, z])", "- check.append(asort[x + 1] + bsort[y] + csort[z])", "+ heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))", "- place_sum.append([x, y + 1, z])", "- check.append(asort[x] + bsort[y + 1] + csort[z])", "+ heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))", "- place_sum.append([x, y, z + 1])", "- check.append(asort[x] + bsort[y] + csort[z + 1])", "- print((max(check)))", "- x, y, z = (", "- place_sum[check.index(max(check))][0],", "- place_sum[check.index(max(check))][1],", "- place_sum[check.index(max(check))][2],", "- )", "- place_sum.pop(check.index(max(check)))", "- check.remove(max(check))", "+ heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))", "+ maxsum = heapq.heappop(check)", "+ print((-maxsum[0]))", "+ x, y, z = maxsum[1], maxsum[2], maxsum[3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2974797392, "measured_runtime_v1": 0.2210724421, "runtime_lift": 1.3456210843, "key": ["s928848207", "s406476908"]} +{"user_id": "u969190727", "problem_id": "p03371", "language": "python", "submission_id_v0": "s944521020", "submission_id_v1": "s713825460", "cpu_time_v0": 121, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.95, "input": "a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nn=max(x,y)\n\nfor i in range(1,n+1):\n\n ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))\n\nprint(ans)\n\n\n\n\n", "target": "a,b,c,x,y=list(map(int,input().split()))\n\nans1=a*x+b*y\n\nans2=2*c*max(x,y)\n\nans3=2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y))\n\nprint((min(ans1,ans2,ans3)))", "code_v0_loc": 8, "code_v1_loc": 5, "code_v0_num_chars": 148, "code_v1_num_chars": 144, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nn = max(x, y)\nfor i in range(1, n + 1):\n ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans1 = a * x + b * y\nans2 = 2 * c * max(x, y)\nans3 = 2 * c * min(x, y) + a * (x - min(x, y)) + b * (y - min(x, y))\nprint((min(ans1, ans2, ans3)))\n", "code_same": false, "relative_loc_diff_percent": 37.5, "diff": ["-ans = a * x + b * y", "-n = max(x, y)", "-for i in range(1, n + 1):", "- ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))", "-print(ans)", "+ans1 = a * x + b * y", "+ans2 = 2 * c * max(x, y)", "+ans3 = 2 * c * min(x, y) + a * (x - min(x, y)) + b * (y - min(x, y))", "+print((min(ans1, ans2, ans3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.247306282, "measured_runtime_v1": 0.1774894836, "runtime_lift": 1.3933573811, "key": ["s944521020", "s713825460"]} +{"user_id": "u879870653", "problem_id": "p03325", "language": "python", "submission_id_v0": "s933212033", "submission_id_v1": "s130104970", "cpu_time_v0": 143, "cpu_time_v1": 121, "memory_v0": 4148, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.38, "input": "answer = 0\n\nN = int(input())\n\nA = list(map(int,input().split()))\n\nfor i in range(N) :\n\n while A[i] % 2 == 0 :\n\n A[i] = A[i] / 2\n\n answer += 1\n\nprint(answer)\n\n\n", "target": "N = int(input())\n\nL = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor i in range(N) :\n\n flag = 0\n\n while flag == 0 :\n\n if (L[i] % 2) == 0 :\n\n ans += 1\n\n L[i] = L[i]//2\n\n else :\n\n flag = 1\n\nprint(ans)\n", "code_v0_loc": 9, "code_v1_loc": 13, "code_v0_num_chars": 176, "code_v1_num_chars": 252, "code_v0_no_empty_lines": "answer = 0\nN = int(input())\nA = list(map(int, input().split()))\nfor i in range(N):\n while A[i] % 2 == 0:\n A[i] = A[i] / 2\n answer += 1\nprint(answer)\n", "code_v1_no_empty_lines": "N = int(input())\nL = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n flag = 0\n while flag == 0:\n if (L[i] % 2) == 0:\n ans += 1\n L[i] = L[i] // 2\n else:\n flag = 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.7692307692, "diff": ["-answer = 0", "-A = list(map(int, input().split()))", "+L = list(map(int, input().split()))", "+ans = 0", "- while A[i] % 2 == 0:", "- A[i] = A[i] / 2", "- answer += 1", "-print(answer)", "+ flag = 0", "+ while flag == 0:", "+ if (L[i] % 2) == 0:", "+ ans += 1", "+ L[i] = L[i] // 2", "+ else:", "+ flag = 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2890260706, "measured_runtime_v1": 0.1461268132, "runtime_lift": 1.9779126383, "key": ["s933212033", "s130104970"]} +{"user_id": "u619458041", "problem_id": "p03034", "language": "python", "submission_id_v0": "s001695168", "submission_id_v1": "s404140535", "cpu_time_v0": 1002, "cpu_time_v1": 783, "memory_v0": 17360, "memory_v1": 14388, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.86, "input": "import sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n for C in range(1, N//2):\n\n n = N // C\n\n point = 0\n\n used = set([0])\n\n for k in range(1, n):\n\n A = N - 1 - k*C\n\n\n\n if A in used or k*C in used or A == k*C:\n\n break\n\n used.add(A)\n\n used.add(k*C)\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n", "target": "import sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n # C = A - B\n\n for C in range(1, N//2):\n\n n = (N-1) // C\n\n point = 0\n\n for k in range(1, n):\n\n A = N-1 - k*C\n\n\n\n # Check A and B are positive integer, and S_i is not used twice.\n\n #\n\n # B = A - C and B >= 0, so A must be over C (A > C).\n\n #\n\n # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1\n\n # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than\n\n # or equal kC, the A's value is already used by kC.\n\n if A < C or ((N-1) % C == 0 and A <= k*C):\n\n break\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n", "code_v0_loc": 28, "code_v1_loc": 33, "code_v0_num_chars": 563, "code_v1_num_chars": 905, "code_v0_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n S = list(map(int, input().split()))\n ans = 0\n for C in range(1, N // 2):\n n = N // C\n point = 0\n used = set([0])\n for k in range(1, n):\n A = N - 1 - k * C\n if A in used or k * C in used or A == k * C:\n break\n used.add(A)\n used.add(k * C)\n point += S[A] + S[k * C]\n ans = max(ans, point)\n return ans\n\n\nif __name__ == \"__main__\":\n print((main()))\n", "code_v1_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n S = list(map(int, input().split()))\n ans = 0\n # C = A - B\n for C in range(1, N // 2):\n n = (N - 1) // C\n point = 0\n for k in range(1, n):\n A = N - 1 - k * C\n # Check A and B are positive integer, and S_i is not used twice.\n #\n # B = A - C and B >= 0, so A must be over C (A > C).\n #\n # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1\n # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than\n # or equal kC, the A's value is already used by kC.\n if A < C or ((N - 1) % C == 0 and A <= k * C):\n break\n point += S[A] + S[k * C]\n ans = max(ans, point)\n return ans\n\n\nif __name__ == \"__main__\":\n print((main()))\n", "code_same": false, "relative_loc_diff_percent": 15.1515151515, "diff": ["+ # C = A - B", "- n = N // C", "+ n = (N - 1) // C", "- used = set([0])", "- if A in used or k * C in used or A == k * C:", "+ # Check A and B are positive integer, and S_i is not used twice.", "+ #", "+ # B = A - C and B >= 0, so A must be over C (A > C).", "+ #", "+ # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1", "+ # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than", "+ # or equal kC, the A's value is already used by kC.", "+ if A < C or ((N - 1) % C == 0 and A <= k * C):", "- used.add(A)", "- used.add(k * C)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3095349545, "measured_runtime_v1": 0.0814658375, "runtime_lift": 3.7995675745, "key": ["s001695168", "s404140535"]} +{"user_id": "u498487134", "problem_id": "p03038", "language": "python", "submission_id_v0": "s547925628", "submission_id_v1": "s764313725", "cpu_time_v0": 649, "cpu_time_v1": 471, "memory_v0": 68588, "memory_v1": 102672, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.43, "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(input())\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N,M=MI()\n\n A=LI()\n\n CB=[[0,0]for _ in range(M)]\n\n A.sort()\n\n for i in range(M):\n\n CB[i][1],CB[i][0]=MI()\n\n \n\n CB.sort(reverse=True)\n\n now=0\n\n \n\n for i in range(N):\n\n if CB[now][1]<=0:\n\n now+=1\n\n \n\n if now>=M:\n\n break \n\n \n\n ch=CB[now][0]\n\n if A[i]=c:\n\n heapq.heappush(A,a)\n\n break\n\n else:\n\n heapq.heappush(A,c)\n\n \n\n ans=0\n\n for i in range(N):\n\n a=heapq.heappop(A)\n\n ans+=a\n\n \n\n print(ans)\n\n\n\nmain()\n", "code_v0_loc": 37, "code_v1_loc": 42, "code_v0_num_chars": 685, "code_v1_num_chars": 804, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, M = MI()\n A = LI()\n CB = [[0, 0] for _ in range(M)]\n A.sort()\n for i in range(M):\n CB[i][1], CB[i][0] = MI()\n CB.sort(reverse=True)\n now = 0\n for i in range(N):\n if CB[now][1] <= 0:\n now += 1\n if now >= M:\n break\n ch = CB[now][0]\n if A[i] < ch:\n A[i] = ch\n CB[now][1] -= 1\n else:\n break\n print((sum(A)))\n\n\nmain()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, M = MI()\n A = LI()\n B = [0] * M\n C = [0] * M\n for i in range(M):\n B[i], C[i] = MI()\n C, B = list(zip(*sorted(zip(C, B))))\n B = B[::-1]\n C = C[::-1]\n import heapq\n\n heapq.heapify(A)\n for i in range(M):\n b = B[i]\n c = C[i]\n for _ in range(b):\n a = heapq.heappop(A)\n if a >= c:\n heapq.heappush(A, a)\n break\n else:\n heapq.heappush(A, c)\n ans = 0\n for i in range(N):\n a = heapq.heappop(A)\n ans += a\n print(ans)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 11.9047619048, "diff": ["- CB = [[0, 0] for _ in range(M)]", "- A.sort()", "+ B = [0] * M", "+ C = [0] * M", "- CB[i][1], CB[i][0] = MI()", "- CB.sort(reverse=True)", "- now = 0", "+ B[i], C[i] = MI()", "+ C, B = list(zip(*sorted(zip(C, B))))", "+ B = B[::-1]", "+ C = C[::-1]", "+ import heapq", "+", "+ heapq.heapify(A)", "+ for i in range(M):", "+ b = B[i]", "+ c = C[i]", "+ for _ in range(b):", "+ a = heapq.heappop(A)", "+ if a >= c:", "+ heapq.heappush(A, a)", "+ break", "+ else:", "+ heapq.heappush(A, c)", "+ ans = 0", "- if CB[now][1] <= 0:", "- now += 1", "- if now >= M:", "- break", "- ch = CB[now][0]", "- if A[i] < ch:", "- A[i] = ch", "- CB[now][1] -= 1", "- else:", "- break", "- print((sum(A)))", "+ a = heapq.heappop(A)", "+ ans += a", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2322117374, "measured_runtime_v1": 0.1336252203, "runtime_lift": 1.7377837571, "key": ["s547925628", "s764313725"]} +{"user_id": "u396211450", "problem_id": "p03828", "language": "python", "submission_id_v0": "s749493108", "submission_id_v1": "s831049300", "cpu_time_v0": 39, "cpu_time_v1": 31, "memory_v0": 9360, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.51, "input": "from math import factorial\n\n\n\nn = int(input())\n\nf = factorial(n)\n\n\n\nmod = 10 ** 9 + 7\n\n\n\ndef primes(n):\n\n is_prime = [True] * (n + 1)\n\n is_prime[0] = False\n\n is_prime[1] = False\n\n for i in range(2, int(n ** 0.5) + 1):\n\n if not is_prime[i]:\n\n continue\n\n for j in range(i * 2, n + 1, i):\n\n is_prime[j] = False\n\n return [i for i in range(n + 1) if is_prime[i]]\n\n\n\nans = 1\n\nfor p in primes(n):\n\n temp = 1\n\n while f % p == 0:\n\n temp += 1\n\n f //= p\n\n ans = (ans * temp) % mod\n\nprint(ans)\n", "target": "n=int(input())\n\nm=10**9+7\n\np=[1 for i in range(10000)]\n\np[0]=0\n\np[1]=0\n\nfor i in range(2,n+1):\n\n if p[i]==1:\n\n for j in range(i*i,n+1,i):\n\n p[j]=0\n\nans=1\n\nfor i in range(2,n+1):\n\n if p[i]:\n\n c=0\n\n k=i\n\n while n//k>0:\n\n c=c+(n//k)%m\n\n k=k*i\n\n ans=(ans*((c+1)%m))%m\n\nprint((ans%m))\n\n \n\n \n\n \n\n \n", "code_v0_loc": 26, "code_v1_loc": 23, "code_v0_num_chars": 556, "code_v1_num_chars": 340, "code_v0_no_empty_lines": "from math import factorial\n\nn = int(input())\nf = factorial(n)\nmod = 10**9 + 7\n\n\ndef primes(n):\n is_prime = [True] * (n + 1)\n is_prime[0] = False\n is_prime[1] = False\n for i in range(2, int(n**0.5) + 1):\n if not is_prime[i]:\n continue\n for j in range(i * 2, n + 1, i):\n is_prime[j] = False\n return [i for i in range(n + 1) if is_prime[i]]\n\n\nans = 1\nfor p in primes(n):\n temp = 1\n while f % p == 0:\n temp += 1\n f //= p\n ans = (ans * temp) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nm = 10**9 + 7\np = [1 for i in range(10000)]\np[0] = 0\np[1] = 0\nfor i in range(2, n + 1):\n if p[i] == 1:\n for j in range(i * i, n + 1, i):\n p[j] = 0\nans = 1\nfor i in range(2, n + 1):\n if p[i]:\n c = 0\n k = i\n while n // k > 0:\n c = c + (n // k) % m\n k = k * i\n ans = (ans * ((c + 1) % m)) % m\nprint((ans % m))\n", "code_same": false, "relative_loc_diff_percent": 11.5384615385, "diff": ["-from math import factorial", "-", "-f = factorial(n)", "-mod = 10**9 + 7", "-", "-", "-def primes(n):", "- is_prime = [True] * (n + 1)", "- is_prime[0] = False", "- is_prime[1] = False", "- for i in range(2, int(n**0.5) + 1):", "- if not is_prime[i]:", "- continue", "- for j in range(i * 2, n + 1, i):", "- is_prime[j] = False", "- return [i for i in range(n + 1) if is_prime[i]]", "-", "-", "+m = 10**9 + 7", "+p = [1 for i in range(10000)]", "+p[0] = 0", "+p[1] = 0", "+for i in range(2, n + 1):", "+ if p[i] == 1:", "+ for j in range(i * i, n + 1, i):", "+ p[j] = 0", "-for p in primes(n):", "- temp = 1", "- while f % p == 0:", "- temp += 1", "- f //= p", "- ans = (ans * temp) % mod", "-print(ans)", "+for i in range(2, n + 1):", "+ if p[i]:", "+ c = 0", "+ k = i", "+ while n // k > 0:", "+ c = c + (n // k) % m", "+ k = k * i", "+ ans = (ans * ((c + 1) % m)) % m", "+print((ans % m))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2370509479, "measured_runtime_v1": 0.0064624088, "runtime_lift": 36.6815154487, "key": ["s749493108", "s831049300"]} +{"user_id": "u670180528", "problem_id": "p02937", "language": "python", "submission_id_v0": "s126195271", "submission_id_v1": "s641311638", "cpu_time_v0": 161, "cpu_time_v1": 122, "memory_v0": 12200, "memory_v1": 12072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 24.22, "input": "from collections import defaultdict\n\nfrom bisect import bisect_left\n\n\n\ns = input()\n\nn = len(s)\n\ns = s + s\n\nt = input()\n\nif set(t) - set(s):\n\n\tprint((-1))\n\n\texit()\n\nd = defaultdict(list)\n\nfor i in range(2 * n):\n\n\td[s[i]] += [i]\n\ncur = tot = 0\n\nfor c in t:\n\n\tx = d[c][bisect_left(d[c], cur)]\n\n\tif x < n:\n\n\t\tcur = x + 1\n\n\telse:\n\n\t\tcur = x - n + 1\n\n\t\ttot += n\n\ntot += cur\n\nprint(tot)\n", "target": "from collections import defaultdict\n\nfrom bisect import bisect_left\n\n\n\n\n\ndef main():\n\n\ts = input()\n\n\tn = len(s)\n\n\ts = s + s\n\n\tt = input()\n\n\tif set(t) - set(s):\n\n\t\tprint((-1))\n\n\t\texit()\n\n\td = defaultdict(list)\n\n\tfor i in range(2 * n):\n\n\t\td[s[i]] += [i]\n\n\tcur = ncnt = 0\n\n\n\n\tfor c in t:\n\n\t\tx = d[c][bisect_left(d[c], cur)]\n\n\t\tif x < n:\n\n\t\t\tcur = x + 1\n\n\t\telse:\n\n\t\t\tcur = x - n + 1\n\n\t\t\tncnt += 1\n\n\tprint((ncnt*n + cur))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "code_v0_loc": 23, "code_v1_loc": 29, "code_v0_num_chars": 378, "code_v1_num_chars": 453, "code_v0_no_empty_lines": "from collections import defaultdict\nfrom bisect import bisect_left\n\ns = input()\nn = len(s)\ns = s + s\nt = input()\nif set(t) - set(s):\n print((-1))\n exit()\nd = defaultdict(list)\nfor i in range(2 * n):\n d[s[i]] += [i]\ncur = tot = 0\nfor c in t:\n x = d[c][bisect_left(d[c], cur)]\n if x < n:\n cur = x + 1\n else:\n cur = x - n + 1\n tot += n\ntot += cur\nprint(tot)\n", "code_v1_no_empty_lines": "from collections import defaultdict\nfrom bisect import bisect_left\n\n\ndef main():\n s = input()\n n = len(s)\n s = s + s\n t = input()\n if set(t) - set(s):\n print((-1))\n exit()\n d = defaultdict(list)\n for i in range(2 * n):\n d[s[i]] += [i]\n cur = ncnt = 0\n for c in t:\n x = d[c][bisect_left(d[c], cur)]\n if x < n:\n cur = x + 1\n else:\n cur = x - n + 1\n ncnt += 1\n print((ncnt * n + cur))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 20.6896551724, "diff": ["-s = input()", "-n = len(s)", "-s = s + s", "-t = input()", "-if set(t) - set(s):", "- print((-1))", "- exit()", "-d = defaultdict(list)", "-for i in range(2 * n):", "- d[s[i]] += [i]", "-cur = tot = 0", "-for c in t:", "- x = d[c][bisect_left(d[c], cur)]", "- if x < n:", "- cur = x + 1", "- else:", "- cur = x - n + 1", "- tot += n", "-tot += cur", "-print(tot)", "+", "+def main():", "+ s = input()", "+ n = len(s)", "+ s = s + s", "+ t = input()", "+ if set(t) - set(s):", "+ print((-1))", "+ exit()", "+ d = defaultdict(list)", "+ for i in range(2 * n):", "+ d[s[i]] += [i]", "+ cur = ncnt = 0", "+ for c in t:", "+ x = d[c][bisect_left(d[c], cur)]", "+ if x < n:", "+ cur = x + 1", "+ else:", "+ cur = x - n + 1", "+ ncnt += 1", "+ print((ncnt * n + cur))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2683695219, "measured_runtime_v1": 0.0063027716, "runtime_lift": 42.5796046267, "key": ["s126195271", "s641311638"]} +{"user_id": "u631277801", "problem_id": "p02996", "language": "python", "submission_id_v0": "s825135097", "submission_id_v1": "s901008925", "cpu_time_v0": 649, "cpu_time_v1": 495, "memory_v0": 54192, "memory_v1": 31936, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.73, "input": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\nab = [list(li()) for _ in range(n)]\n\n\n\nab.sort(key=lambda x: x[1])\n\n\n\ncur = 0\n\n\n\nans = True\n\n\n\nfor ai, bi in ab:\n\n cur += ai\n\n if cur > bi:\n\n ans = False\n\n\n\nprint((\"Yes\" if ans else \"No\"))", "target": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\nab = [tuple(li()) for _ in range(n)]\n\n\n\nab.sort(key=lambda x: x[1])\n\ncur = 0\n\nok = True\n\n\n\nfor ai, bi in ab:\n\n cur += ai\n\n if cur > bi:\n\n ok = False\n\n break\n\n\n\nprint((\"Yes\" if ok else \"No\"))\n", "code_v0_loc": 29, "code_v1_loc": 28, "code_v0_num_chars": 655, "code_v1_num_chars": 665, "code_v0_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nab = [list(li()) for _ in range(n)]\nab.sort(key=lambda x: x[1])\ncur = 0\nans = True\nfor ai, bi in ab:\n cur += ai\n if cur > bi:\n ans = False\nprint((\"Yes\" if ans else \"No\"))\n", "code_v1_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nab = [tuple(li()) for _ in range(n)]\nab.sort(key=lambda x: x[1])\ncur = 0\nok = True\nfor ai, bi in ab:\n cur += ai\n if cur > bi:\n ok = False\n break\nprint((\"Yes\" if ok else \"No\"))\n", "code_same": false, "relative_loc_diff_percent": 3.4482758621, "diff": ["-ab = [list(li()) for _ in range(n)]", "+ab = [tuple(li()) for _ in range(n)]", "-ans = True", "+ok = True", "- ans = False", "-print((\"Yes\" if ans else \"No\"))", "+ ok = False", "+ break", "+print((\"Yes\" if ok else \"No\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2910801413, "measured_runtime_v1": 0.1842719517, "runtime_lift": 1.5796226102, "key": ["s825135097", "s901008925"]} +{"user_id": "u728498511", "problem_id": "p03416", "language": "python", "submission_id_v0": "s773095214", "submission_id_v1": "s841162290", "cpu_time_v0": 111, "cpu_time_v1": 67, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.64, "input": "n, m = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n, m+1):\n\n if str(i)[0]+str(i)[1] == str(i)[-1]+str(i)[-2]: ans += 1\n\nprint(ans)", "target": "a, b = list(map(int, input().split()))\n\nans = 0\n\nfor n in range(a, b+1):\n\n if str(n) == str(n)[::-1]: ans += 1\n\nprint(ans)", "code_v0_loc": 5, "code_v1_loc": 5, "code_v0_num_chars": 141, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\nans = 0\nfor i in range(n, m + 1):\n if str(i)[0] + str(i)[1] == str(i)[-1] + str(i)[-2]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor n in range(a, b + 1):\n if str(n) == str(n)[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-n, m = list(map(int, input().split()))", "+a, b = list(map(int, input().split()))", "-for i in range(n, m + 1):", "- if str(i)[0] + str(i)[1] == str(i)[-1] + str(i)[-2]:", "+for n in range(a, b + 1):", "+ if str(n) == str(n)[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6137721554, "measured_runtime_v1": 0.3378130706, "runtime_lift": 1.8168987785, "key": ["s773095214", "s841162290"]} +{"user_id": "u498511622", "problem_id": "p00001", "language": "python", "submission_id_v0": "s534000808", "submission_id_v1": "s891056906", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7536, "memory_v1": 7656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "ans=[]\n\nfor i in range (0,10):\n\n ans.append(int(input()))\n\nans.sort(reverse=True)\n\nfor i in range (0,3):\n\n print((ans[i]))", "target": "mountain=[]\n\nfor s in range(0,10):\n\n mountain.append(int(input()))\n\nmountain.sort(reverse=True)\n\nfor s in range(0,3):\n\n print((mountain[s]))", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 126, "code_v1_num_chars": 141, "code_v0_no_empty_lines": "ans = []\nfor i in range(0, 10):\n ans.append(int(input()))\nans.sort(reverse=True)\nfor i in range(0, 3):\n print((ans[i]))\n", "code_v1_no_empty_lines": "mountain = []\nfor s in range(0, 10):\n mountain.append(int(input()))\nmountain.sort(reverse=True)\nfor s in range(0, 3):\n print((mountain[s]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-ans = []", "-for i in range(0, 10):", "- ans.append(int(input()))", "-ans.sort(reverse=True)", "-for i in range(0, 3):", "- print((ans[i]))", "+mountain = []", "+for s in range(0, 10):", "+ mountain.append(int(input()))", "+mountain.sort(reverse=True)", "+for s in range(0, 3):", "+ print((mountain[s]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3030959003, "measured_runtime_v1": 0.0643225815, "runtime_lift": 4.7121227575, "key": ["s534000808", "s891056906"]} +{"user_id": "u530383736", "problem_id": "p02555", "language": "python", "submission_id_v0": "s720124366", "submission_id_v1": "s340965185", "cpu_time_v0": 275, "cpu_time_v1": 33, "memory_v0": 9116, "memory_v1": 9000, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 88.0, "input": "# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n cnt = 0\n\n\n\n for j in range(3, i+1):\n\n cnt += dp[i-j]\n\n cnt %= mod\n\n \n\n dp[i] = cnt\n\n\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n dp[i] = dp[i-3] + dp[i-1]\n\n dp[i] %= mod\n\n \n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 26, "code_v1_loc": 21, "code_v0_num_chars": 381, "code_v1_num_chars": 307, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\n\n\ndef main():\n S = int(sys.stdin.readline())\n dp = [0] * (S + 1)\n dp[0] = 1\n mod = 10**9 + 7\n for i in range(3, S + 1):\n cnt = 0\n for j in range(3, i + 1):\n cnt += dp[i - j]\n cnt %= mod\n dp[i] = cnt\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\n\n\ndef main():\n S = int(sys.stdin.readline())\n dp = [0] * (S + 1)\n dp[0] = 1\n mod = 10**9 + 7\n for i in range(3, S + 1):\n dp[i] = dp[i - 3] + dp[i - 1]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 19.2307692308, "diff": ["- cnt = 0", "- for j in range(3, i + 1):", "- cnt += dp[i - j]", "- cnt %= mod", "- dp[i] = cnt", "+ dp[i] = dp[i - 3] + dp[i - 1]", "+ dp[i] %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4620170944, "measured_runtime_v1": 0.1881556332, "runtime_lift": 2.4555049799, "key": ["s720124366", "s340965185"]} +{"user_id": "u678167152", "problem_id": "p02785", "language": "python", "submission_id_v0": "s271865493", "submission_id_v1": "s007549888", "cpu_time_v0": 145, "cpu_time_v1": 112, "memory_v0": 104796, "memory_v1": 31552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.76, "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n if K>=N:\n\n return 0\n\n H.sort()\n\n ans = sum(H[:N-K])\n\n return ans\n\nprint((solve()))", "target": "def solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n H.sort()\n\n ans = sum(H[:max(N-K,0)])\n\n return ans\n\nprint((solve()))", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 177, "code_v1_num_chars": 158, "code_v0_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n H = list(map(int, input().split()))\n if K >= N:\n return 0\n H.sort()\n ans = sum(H[: N - K])\n return ans\n\n\nprint((solve()))\n", "code_v1_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n H = list(map(int, input().split()))\n H.sort()\n ans = sum(H[: max(N - K, 0)])\n return ans\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["- if K >= N:", "- return 0", "- ans = sum(H[: N - K])", "+ ans = sum(H[: max(N - K, 0)])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1896718335, "measured_runtime_v1": 0.0060620093, "runtime_lift": 31.2886079077, "key": ["s271865493", "s007549888"]} +{"user_id": "u583507988", "problem_id": "p03835", "language": "python", "submission_id_v0": "s254920914", "submission_id_v1": "s788748142", "cpu_time_v0": 1001, "cpu_time_v1": 785, "memory_v0": 9104, "memory_v1": 9072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.58, "input": "k, s = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n if 0<=s-x-y<=k:\n\n ans += 1\n\n \n\nprint(ans)", "target": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n num=s-i\n\n for j in range(min(num+1,k+1)):\n\n if 0<=num-j<=k:\n\n ans+=1\n\nprint(ans)", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 146, "code_v1_num_chars": 150, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor x in range(k + 1):\n for y in range(k + 1):\n if 0 <= s - x - y <= k:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n num = s - i\n for j in range(min(num + 1, k + 1)):\n if 0 <= num - j <= k:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-for x in range(k + 1):", "- for y in range(k + 1):", "- if 0 <= s - x - y <= k:", "+for i in range(k + 1):", "+ num = s - i", "+ for j in range(min(num + 1, k + 1)):", "+ if 0 <= num - j <= k:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2276177601, "measured_runtime_v1": 0.0063076721, "runtime_lift": 36.0858579862, "key": ["s254920914", "s788748142"]} +{"user_id": "u528470578", "problem_id": "p03680", "language": "python", "submission_id_v0": "s142356798", "submission_id_v1": "s532531190", "cpu_time_v0": 547, "cpu_time_v1": 248, "memory_v0": 7084, "memory_v1": 7084, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.66, "input": "import sys\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(1e6):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))", "target": "import sys\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(2e5):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))", "code_v0_loc": 21, "code_v1_loc": 21, "code_v0_num_chars": 280, "code_v1_num_chars": 280, "code_v0_no_empty_lines": "import sys\n\nN = int(input())\na = [int(input()) for _ in range(N)]\nl = 1\np = a[0] - 1\nif a[0] == 2:\n print(l)\n sys.exit()\nwhile l < int(1e6):\n l += 1\n if a[p] == 2:\n print(l)\n break\n else:\n p = a[p] - 1\nelse:\n print((-1))\n", "code_v1_no_empty_lines": "import sys\n\nN = int(input())\na = [int(input()) for _ in range(N)]\nl = 1\np = a[0] - 1\nif a[0] == 2:\n print(l)\n sys.exit()\nwhile l < int(2e5):\n l += 1\n if a[p] == 2:\n print(l)\n break\n else:\n p = a[p] - 1\nelse:\n print((-1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-while l < int(1e6):", "+while l < int(2e5):"], "diff_only_import_comment": false, "measured_runtime_v0": 1.1321929171, "measured_runtime_v1": 0.4105077217, "runtime_lift": 2.7580307442, "key": ["s142356798", "s532531190"]} +{"user_id": "u359358631", "problem_id": "p03796", "language": "python", "submission_id_v0": "s916466489", "submission_id_v1": "s520315696", "cpu_time_v0": 158, "cpu_time_v1": 44, "memory_v0": 10172, "memory_v1": 8932, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.15, "input": "import math\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n power = math.factorial(N)\n\n print((power % (10 ** 9 + 7)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "def main():\n\n N = int(input())\n\n power = 1\n\n for i in range(1, N + 1):\n\n power *= i\n\n power %= 10 ** 9 + 7\n\n print(power)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 160, "code_v1_num_chars": 192, "code_v0_no_empty_lines": "import math\n\n\ndef main():\n N = int(input())\n power = math.factorial(N)\n print((power % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n N = int(input())\n power = 1\n for i in range(1, N + 1):\n power *= i\n power %= 10**9 + 7\n print(power)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-import math", "-", "-", "- power = math.factorial(N)", "- print((power % (10**9 + 7)))", "+ power = 1", "+ for i in range(1, N + 1):", "+ power *= i", "+ power %= 10**9 + 7", "+ print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7842813587, "measured_runtime_v1": 0.3569579227, "runtime_lift": 2.1971255121, "key": ["s916466489", "s520315696"]} +{"user_id": "u167751176", "problem_id": "p03078", "language": "python", "submission_id_v0": "s149883415", "submission_id_v1": "s931960732", "cpu_time_v0": 641, "cpu_time_v1": 91, "memory_v0": 97660, "memory_v1": 8708, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.8, "input": "def main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\td = [0]*x*y\n\n\tfor i in range(x):\n\n\t\tfor j in range(y):\n\n\t\t\td[i*y+j] = a[i]+b[j]\n\n\td.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\n\n\tc_len = min(k, z)\n\n\td_len = min(k, x*y)\n\n\te = [0]*d_len*c_len\n\n\tfor i in range(d_len):\n\n\t\tfor j in range(c_len):\n\n\t\t\te[i*c_len+j] = d[i] + c[j]\n\n\te.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((e[i]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "def main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\n\n\tsolve(a, b, c, x, y, z, k)\n\n\n\ndef solve(a, b, c, x, y, z, k):\n\n\ta.sort(reverse=True)\n\n\tb.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\tstack = list()\n\n\tfor p in range(x):\n\n\t\tfor q in range(y):\n\n\t\t\tif (p+1)*(q+1) > k:\n\n\t\t\t\tbreak\n\n\t\t\tfor r in range(z):\n\n\t\t\t\tif (p+1)*(q+1)*(r+1) > k:\n\n\t\t\t\t\tbreak\n\n\t\t\t\tstack.append(a[p]+b[q]+c[r])\n\n\tstack.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((stack[i]))\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 25, "code_v1_loc": 27, "code_v0_num_chars": 545, "code_v1_num_chars": 605, "code_v0_no_empty_lines": "def main():\n x, y, z, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n d = [0] * x * y\n for i in range(x):\n for j in range(y):\n d[i * y + j] = a[i] + b[j]\n d.sort(reverse=True)\n c.sort(reverse=True)\n c_len = min(k, z)\n d_len = min(k, x * y)\n e = [0] * d_len * c_len\n for i in range(d_len):\n for j in range(c_len):\n e[i * c_len + j] = d[i] + c[j]\n e.sort(reverse=True)\n for i in range(k):\n print((e[i]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n x, y, z, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n solve(a, b, c, x, y, z, k)\n\n\ndef solve(a, b, c, x, y, z, k):\n a.sort(reverse=True)\n b.sort(reverse=True)\n c.sort(reverse=True)\n stack = list()\n for p in range(x):\n for q in range(y):\n if (p + 1) * (q + 1) > k:\n break\n for r in range(z):\n if (p + 1) * (q + 1) * (r + 1) > k:\n break\n stack.append(a[p] + b[q] + c[r])\n stack.sort(reverse=True)\n for i in range(k):\n print((stack[i]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 7.4074074074, "diff": ["- d = [0] * x * y", "- for i in range(x):", "- for j in range(y):", "- d[i * y + j] = a[i] + b[j]", "- d.sort(reverse=True)", "+ solve(a, b, c, x, y, z, k)", "+", "+", "+def solve(a, b, c, x, y, z, k):", "+ a.sort(reverse=True)", "+ b.sort(reverse=True)", "- c_len = min(k, z)", "- d_len = min(k, x * y)", "- e = [0] * d_len * c_len", "- for i in range(d_len):", "- for j in range(c_len):", "- e[i * c_len + j] = d[i] + c[j]", "- e.sort(reverse=True)", "+ stack = list()", "+ for p in range(x):", "+ for q in range(y):", "+ if (p + 1) * (q + 1) > k:", "+ break", "+ for r in range(z):", "+ if (p + 1) * (q + 1) * (r + 1) > k:", "+ break", "+ stack.append(a[p] + b[q] + c[r])", "+ stack.sort(reverse=True)", "- print((e[i]))", "+ print((stack[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3135767848, "measured_runtime_v1": 0.0401056306, "runtime_lift": 7.8187720726, "key": ["s149883415", "s931960732"]} +{"user_id": "u260980560", "problem_id": "p00713", "language": "python", "submission_id_v0": "s376249504", "submission_id_v1": "s496295641", "cpu_time_v0": 32130, "cpu_time_v1": 27750, "memory_v0": 6520, "memory_v1": 6552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.63, "input": "from math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) / d) / 2.0\n\n xc = (x1 + x2) / 2.0\n\n yc = (y1 + y2) / 2.0\n\n return [[xc - k*yd, yc + k*xd], [xc + k*yd, yc - k*xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = [list(map(float, input().split())) for i in range(n)]\n\n p.sort()\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - bx >= 2.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)", "target": "from math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) / d) / 2.0\n\n xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0\n\n xd *= k; yd *= k\n\n return [[xc - yd, yc + xd], [xc + yd, yc - xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = sorted(list(map(float, input().split())) for i in range(n))\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - ex >= 1.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)", "code_v0_loc": 33, "code_v1_loc": 32, "code_v0_num_chars": 1141, "code_v1_num_chars": 1143, "code_v0_no_empty_lines": "from math import sqrt\nfrom bisect import bisect_left\n\n\ndef circle_center(x1, y1, x2, y2):\n xd = x2 - x1\n yd = y2 - y1\n d = xd**2 + yd**2\n k = sqrt((4.0 - d) / d) / 2.0\n xc = (x1 + x2) / 2.0\n yc = (y1 + y2) / 2.0\n return [[xc - k * yd, yc + k * xd], [xc + k * yd, yc - k * xd]]\n\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n p = [list(map(float, input().split())) for i in range(n)]\n p.sort()\n prev = 0\n ans = 1\n for i in range(n):\n bx, by = p[i]\n while bx - p[prev][0] >= 2.0:\n prev += 1\n for j in range(i + 1, n):\n cx, cy = p[j]\n if cx - bx >= 2.0:\n break\n if (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0:\n for ex, ey in circle_center(bx, by, cx, cy):\n count = 2\n for k in range(prev, n):\n if k == i or k == j:\n continue\n dx, dy = p[k]\n if dx - bx >= 2.0:\n break\n if (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0:\n count += 1\n ans = max(ans, count)\n print(ans)\n", "code_v1_no_empty_lines": "from math import sqrt\nfrom bisect import bisect_left\n\n\ndef circle_center(x1, y1, x2, y2):\n xd = x2 - x1\n yd = y2 - y1\n d = xd**2 + yd**2\n k = sqrt((4.0 - d) / d) / 2.0\n xc = (x1 + x2) / 2.0\n yc = (y1 + y2) / 2.0\n xd *= k\n yd *= k\n return [[xc - yd, yc + xd], [xc + yd, yc - xd]]\n\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n p = sorted(list(map(float, input().split())) for i in range(n))\n prev = 0\n ans = 1\n for i in range(n):\n bx, by = p[i]\n while bx - p[prev][0] >= 2.0:\n prev += 1\n for j in range(i + 1, n):\n cx, cy = p[j]\n if cx - bx >= 2.0:\n break\n if (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0:\n for ex, ey in circle_center(bx, by, cx, cy):\n count = 2\n for k in range(prev, n):\n if k == i or k == j:\n continue\n dx, dy = p[k]\n if dx - ex >= 1.0:\n break\n if (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0:\n count += 1\n ans = max(ans, count)\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 3.0303030303, "diff": ["- return [[xc - k * yd, yc + k * xd], [xc + k * yd, yc - k * xd]]", "+ xd *= k", "+ yd *= k", "+ return [[xc - yd, yc + xd], [xc + yd, yc - xd]]", "- p = [list(map(float, input().split())) for i in range(n)]", "- p.sort()", "+ p = sorted(list(map(float, input().split())) for i in range(n))", "- if dx - bx >= 2.0:", "+ if dx - ex >= 1.0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3026192219, "measured_runtime_v1": 0.1054183228, "runtime_lift": 2.8706510771, "key": ["s376249504", "s496295641"]} +{"user_id": "u286955577", "problem_id": "p03074", "language": "python", "submission_id_v0": "s853547546", "submission_id_v1": "s138697044", "cpu_time_v0": 74, "cpu_time_v1": 66, "memory_v0": 4596, "memory_v1": 4596, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.81, "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n _S = input()\n\n S = []\n\n b = _S[0]\n\n s = 0\n\n if b == '0': S.append(0)\n\n for _s in _S:\n\n if b == _s:\n\n s = s + 1\n\n else:\n\n b = _s\n\n S.append(s)\n\n s = 1\n\n S.append(s)\n\n if b == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n\n n = sum(S[0:num])\n\n m = n\n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n\n for i in range(0, len(S) - num, 2):\n\n n = n - sum(S[i:i+2])\n\n n = n + sum(S[i + num:i + num + 2])\n\n m = max(m, n)\n\n\n\n return m\n\n\n\nprint((solve()))", "target": "def solve():\n\n N, K = list(map(int, input().split()))\n\n s = input()\n\n S = []\n\n b = s[0]\n\n cnt = 0\n\n\n\n if s[0] == '0': S.append(0)\n\n for c in s:\n\n if b == c: cnt = cnt + 1\n\n else:\n\n b = c\n\n S.append(cnt)\n\n cnt = 1\n\n S.append(cnt)\n\n if s[-1] == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n part = sum(S[0:num])\n\n ans = part\n\n\n\n for i in range(0, len(S) - num, 2):\n\n part = part - sum(S[i:i+2]) + sum(S[i + num:i + num + 2])\n\n ans = max(ans, part)\n\n\n\n return ans\n\n\n\nprint((solve()))\n", "code_v0_loc": 30, "code_v1_loc": 28, "code_v0_num_chars": 616, "code_v1_num_chars": 520, "code_v0_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n _S = input()\n S = []\n b = _S[0]\n s = 0\n if b == \"0\":\n S.append(0)\n for _s in _S:\n if b == _s:\n s = s + 1\n else:\n b = _s\n S.append(s)\n s = 1\n S.append(s)\n if b == \"0\":\n S.append(0)\n num = min(len(S), 2 * K + 1)\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n n = sum(S[0:num])\n m = n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n for i in range(0, len(S) - num, 2):\n n = n - sum(S[i : i + 2])\n n = n + sum(S[i + num : i + num + 2])\n m = max(m, n)\n return m\n\n\nprint((solve()))\n", "code_v1_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n s = input()\n S = []\n b = s[0]\n cnt = 0\n if s[0] == \"0\":\n S.append(0)\n for c in s:\n if b == c:\n cnt = cnt + 1\n else:\n b = c\n S.append(cnt)\n cnt = 1\n S.append(cnt)\n if s[-1] == \"0\":\n S.append(0)\n num = min(len(S), 2 * K + 1)\n part = sum(S[0:num])\n ans = part\n for i in range(0, len(S) - num, 2):\n part = part - sum(S[i : i + 2]) + sum(S[i + num : i + num + 2])\n ans = max(ans, part)\n return ans\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["- _S = input()", "+ s = input()", "- b = _S[0]", "- s = 0", "- if b == \"0\":", "+ b = s[0]", "+ cnt = 0", "+ if s[0] == \"0\":", "- for _s in _S:", "- if b == _s:", "- s = s + 1", "+ for c in s:", "+ if b == c:", "+ cnt = cnt + 1", "- b = _s", "- S.append(s)", "- s = 1", "- S.append(s)", "- if b == \"0\":", "+ b = c", "+ S.append(cnt)", "+ cnt = 1", "+ S.append(cnt)", "+ if s[-1] == \"0\":", "- # n = sum(S[0:num if _S[0] == '1' else (num - 1)])", "- n = sum(S[0:num])", "- m = n", "- # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):", "+ part = sum(S[0:num])", "+ ans = part", "- n = n - sum(S[i : i + 2])", "- n = n + sum(S[i + num : i + num + 2])", "- m = max(m, n)", "- return m", "+ part = part - sum(S[i : i + 2]) + sum(S[i + num : i + num + 2])", "+ ans = max(ans, part)", "+ return ans"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3473945413, "measured_runtime_v1": 0.2136866565, "runtime_lift": 1.625719392, "key": ["s853547546", "s138697044"]} +{"user_id": "u259738923", "problem_id": "p03796", "language": "python", "submission_id_v0": "s911512169", "submission_id_v1": "s353747803", "cpu_time_v0": 231, "cpu_time_v1": 41, "memory_v0": 3972, "memory_v1": 7396, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.25, "input": "import math\n\nN = int(input())\n\nans = math.factorial(N) % (10 ** 9 + 7)\n\nprint(ans)", "target": "n = int(input())\n\nfrom functools import reduce\n\nprint((reduce(lambda x,y:x*y%1000000007,list(range(1,n+1)))))", "code_v0_loc": 4, "code_v1_loc": 3, "code_v0_num_chars": 82, "code_v1_num_chars": 107, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nfrom functools import reduce\n\nprint((reduce(lambda x, y: x * y % 1000000007, list(range(1, n + 1)))))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-import math", "+n = int(input())", "+from functools import reduce", "-N = int(input())", "-ans = math.factorial(N) % (10**9 + 7)", "-print(ans)", "+print((reduce(lambda x, y: x * y % 1000000007, list(range(1, n + 1)))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5315986769, "measured_runtime_v1": 0.2369310765, "runtime_lift": 2.2436848922, "key": ["s911512169", "s353747803"]} +{"user_id": "u775681539", "problem_id": "p03371", "language": "python", "submission_id_v0": "s986639109", "submission_id_v1": "s095330807", "cpu_time_v0": 186, "cpu_time_v1": 89, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.15, "input": "#python3\n\nINF = int(1e9)\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF\n\n for i in range(2*10**5+100):\n\n t = 2*c*i + max(x-i, 0) * a + max(y-i, 0) * b\n\n ans = min(ans, t)\n\n print(ans)\n\nmain()", "target": "INF = int(1e5)+5\n\n\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF*INF\n\n for i in range(INF):\n\n tmp = 2*i*c + a*max(x-i, 0) + b*max(y-i, 0) \n\n ans = min(tmp, ans)\n\n print(ans)\n\nmain()\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 239, "code_v1_num_chars": 231, "code_v0_no_empty_lines": "# python3\nINF = int(1e9)\n\n\ndef main():\n a, b, c, x, y = list(map(int, input().split()))\n ans = INF\n for i in range(2 * 10**5 + 100):\n t = 2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b\n ans = min(ans, t)\n print(ans)\n\n\nmain()\n", "code_v1_no_empty_lines": "INF = int(1e5) + 5\n\n\ndef main():\n a, b, c, x, y = list(map(int, input().split()))\n ans = INF * INF\n for i in range(INF):\n tmp = 2 * i * c + a * max(x - i, 0) + b * max(y - i, 0)\n ans = min(tmp, ans)\n print(ans)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-# python3", "-INF = int(1e9)", "+INF = int(1e5) + 5", "- ans = INF", "- for i in range(2 * 10**5 + 100):", "- t = 2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b", "- ans = min(ans, t)", "+ ans = INF * INF", "+ for i in range(INF):", "+ tmp = 2 * i * c + a * max(x - i, 0) + b * max(y - i, 0)", "+ ans = min(tmp, ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3276309614, "measured_runtime_v1": 0.7168484554, "runtime_lift": 1.8520385325, "key": ["s986639109", "s095330807"]} +{"user_id": "u575431498", "problem_id": "p03828", "language": "python", "submission_id_v0": "s058426510", "submission_id_v1": "s587454237", "cpu_time_v0": 73, "cpu_time_v1": 18, "memory_v0": 3572, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.34, "input": "from functools import reduce\n\nN = int(input())\n\n\n\nprime_table = [1] * (N+1)\n\n\n\nfor x in range(2, N+1):\n\n for t in range(2, x+1):\n\n while x % t == 0:\n\n prime_table[t] += 1\n\n x //= t\n\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))", "target": "def prime_factorize(n):\n\n while n % 2 == 0:\n\n a[2] += 1\n\n n //= 2\n\n f = 3\n\n while f * f <= n:\n\n if n % f == 0:\n\n a[f] += 1\n\n n //= f\n\n else:\n\n f += 2\n\n if n != 1:\n\n a[n] += 1\n\n\n\nN = int(input())\n\na = [0]*(N+1)\n\nfor i in range(2, N+1):\n\n prime_factorize(i)\n\nans = 1\n\nfor i in a:\n\n if i > 0:\n\n ans *= (i+1)\n\nbig = 10**9 + 7\n\nprint((ans % big))", "code_v0_loc": 11, "code_v1_loc": 24, "code_v0_num_chars": 277, "code_v1_num_chars": 432, "code_v0_no_empty_lines": "from functools import reduce\n\nN = int(input())\nprime_table = [1] * (N + 1)\nfor x in range(2, N + 1):\n for t in range(2, x + 1):\n while x % t == 0:\n prime_table[t] += 1\n x //= t\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))\n", "code_v1_no_empty_lines": "def prime_factorize(n):\n while n % 2 == 0:\n a[2] += 1\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a[f] += 1\n n //= f\n else:\n f += 2\n if n != 1:\n a[n] += 1\n\n\nN = int(input())\na = [0] * (N + 1)\nfor i in range(2, N + 1):\n prime_factorize(i)\nans = 1\nfor i in a:\n if i > 0:\n ans *= i + 1\nbig = 10**9 + 7\nprint((ans % big))\n", "code_same": false, "relative_loc_diff_percent": 54.1666666667, "diff": ["-from functools import reduce", "+def prime_factorize(n):", "+ while n % 2 == 0:", "+ a[2] += 1", "+ n //= 2", "+ f = 3", "+ while f * f <= n:", "+ if n % f == 0:", "+ a[f] += 1", "+ n //= f", "+ else:", "+ f += 2", "+ if n != 1:", "+ a[n] += 1", "+", "-prime_table = [1] * (N + 1)", "-for x in range(2, N + 1):", "- for t in range(2, x + 1):", "- while x % t == 0:", "- prime_table[t] += 1", "- x //= t", "-print((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))", "+a = [0] * (N + 1)", "+for i in range(2, N + 1):", "+ prime_factorize(i)", "+ans = 1", "+for i in a:", "+ if i > 0:", "+ ans *= i + 1", "+big = 10**9 + 7", "+print((ans % big))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2580870204, "measured_runtime_v1": 0.1952191839, "runtime_lift": 1.3220371851, "key": ["s058426510", "s587454237"]} +{"user_id": "u925364229", "problem_id": "p03835", "language": "python", "submission_id_v0": "s889927917", "submission_id_v1": "s987244986", "cpu_time_v0": 1777, "cpu_time_v1": 266, "memory_v0": 2940, "memory_v1": 42092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.03, "input": "K,S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor i in range(K+1):\n\n\tfor j in range(K+1):\n\n\t\tif (S - i - j) <= K and (S-i-j) >= 0:\n\n\t\t\tans += 1\n\n\n\nprint(ans)\n", "target": "K, S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n if 0 <= (S - X - Y) <= K:\n\n ans += 1\n\n\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 156, "code_v1_num_chars": 162, "code_v0_no_empty_lines": "K, S = list(map(int, input().split(\" \")))\nans = 0\nfor i in range(K + 1):\n for j in range(K + 1):\n if (S - i - j) <= K and (S - i - j) >= 0:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "K, S = list(map(int, input().split(\" \")))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n if 0 <= (S - X - Y) <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-for i in range(K + 1):", "- for j in range(K + 1):", "- if (S - i - j) <= K and (S - i - j) >= 0:", "+for X in range(K + 1):", "+ for Y in range(K + 1):", "+ if 0 <= (S - X - Y) <= K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.441297763, "measured_runtime_v1": 0.3279348275, "runtime_lift": 1.3456873926, "key": ["s889927917", "s987244986"]} +{"user_id": "u140201022", "problem_id": "p02412", "language": "python", "submission_id_v0": "s179146540", "submission_id_v1": "s419434066", "cpu_time_v0": 420, "cpu_time_v1": 30, "memory_v0": 4208, "memory_v1": 4204, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.86, "input": "while 1:\n\n ans=0\n\n n,x=list(map(int,input().split()))\n\n if n:\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n for k in range(j+1,n+1):\n\n if i+j+k==x:ans+=1\n\n else:break\n\n print(ans)", "target": "while 1:\n\n a=0\n\n n,x=list(map(int,input().split()))\n\n if n==0:break\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n c=x-i-j\n\n if c>j and c<=n:a+=1\n\n print(a)", "code_v0_loc": 10, "code_v1_loc": 9, "code_v0_num_chars": 249, "code_v1_num_chars": 202, "code_v0_no_empty_lines": "while 1:\n ans = 0\n n, x = list(map(int, input().split()))\n if n:\n for i in range(1, n - 1):\n for j in range(i + 1, n):\n for k in range(j + 1, n + 1):\n if i + j + k == x:\n ans += 1\n else:\n break\n print(ans)\n", "code_v1_no_empty_lines": "while 1:\n a = 0\n n, x = list(map(int, input().split()))\n if n == 0:\n break\n for i in range(1, n - 1):\n for j in range(i + 1, n):\n c = x - i - j\n if c > j and c <= n:\n a += 1\n print(a)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["- ans = 0", "+ a = 0", "- if n:", "- for i in range(1, n - 1):", "- for j in range(i + 1, n):", "- for k in range(j + 1, n + 1):", "- if i + j + k == x:", "- ans += 1", "- else:", "+ if n == 0:", "- print(ans)", "+ for i in range(1, n - 1):", "+ for j in range(i + 1, n):", "+ c = x - i - j", "+ if c > j and c <= n:", "+ a += 1", "+ print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3642889087, "measured_runtime_v1": 0.2896689522, "runtime_lift": 1.2576042614, "key": ["s179146540", "s419434066"]} +{"user_id": "u072717685", "problem_id": "p02767", "language": "python", "submission_id_v0": "s067063811", "submission_id_v1": "s910505357", "cpu_time_v0": 35, "cpu_time_v1": 31, "memory_v0": 5084, "memory_v1": 9036, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.43, "input": "def main():\n\n from statistics import mean\n\n from math import floor,ceil\n\n\n\n n = int(input())\n\n x = list(map(int, input().split()))\n\n x_mean = mean(x) \n\n if x_mean == 0.5:\n\n greater_than_x = len([i for i in x if i > x_mean])\n\n if greater_than_x * 2 >= n:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n elif x_mean % 1 > 0.5:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n x2 = [(num - x_mean)**2 for num in x]\n\n print((sum(x2)))\n\n\n\nmain()", "target": "import sys\n\nread = sys.stdin.read\n\ndef main():\n\n n, *x = list(map(int, read().split()))\n\n r = float('inf')\n\n for i1 in range(1, 101):\n\n rt = 0\n\n for xe in x:\n\n rt += (xe - i1)**2\n\n r = min(r, rt)\n\n print(r)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 21, "code_v1_loc": 14, "code_v0_num_chars": 512, "code_v1_num_chars": 287, "code_v0_no_empty_lines": "def main():\n from statistics import mean\n from math import floor, ceil\n\n n = int(input())\n x = list(map(int, input().split()))\n x_mean = mean(x)\n if x_mean == 0.5:\n greater_than_x = len([i for i in x if i > x_mean])\n if greater_than_x * 2 >= n:\n x_mean = ceil(x_mean)\n else:\n x_mean = floor(x_mean)\n elif x_mean % 1 > 0.5:\n x_mean = ceil(x_mean)\n else:\n x_mean = floor(x_mean)\n x2 = [(num - x_mean) ** 2 for num in x]\n print((sum(x2)))\n\n\nmain()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.read\n\n\ndef main():\n n, *x = list(map(int, read().split()))\n r = float(\"inf\")\n for i1 in range(1, 101):\n rt = 0\n for xe in x:\n rt += (xe - i1) ** 2\n r = min(r, rt)\n print(r)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-def main():", "- from statistics import mean", "- from math import floor, ceil", "+import sys", "- n = int(input())", "- x = list(map(int, input().split()))", "- x_mean = mean(x)", "- if x_mean == 0.5:", "- greater_than_x = len([i for i in x if i > x_mean])", "- if greater_than_x * 2 >= n:", "- x_mean = ceil(x_mean)", "- else:", "- x_mean = floor(x_mean)", "- elif x_mean % 1 > 0.5:", "- x_mean = ceil(x_mean)", "- else:", "- x_mean = floor(x_mean)", "- x2 = [(num - x_mean) ** 2 for num in x]", "- print((sum(x2)))", "+read = sys.stdin.read", "-main()", "+def main():", "+ n, *x = list(map(int, read().split()))", "+ r = float(\"inf\")", "+ for i1 in range(1, 101):", "+ rt = 0", "+ for xe in x:", "+ rt += (xe - i1) ** 2", "+ r = min(r, rt)", "+ print(r)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3305953437, "measured_runtime_v1": 0.2443374534, "runtime_lift": 1.3530277041, "key": ["s067063811", "s910505357"]} +{"user_id": "u190086340", "problem_id": "p03854", "language": "python", "submission_id_v0": "s952373499", "submission_id_v1": "s487524594", "cpu_time_v0": 320, "cpu_time_v1": 262, "memory_v0": 79600, "memory_v1": 58480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.12, "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef solve():\n\n S = input()\n\n # print(S, len(S))\n\n\n\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n\n\n\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n\n\n def recur(i, w):\n\n if not TABLE[w][i] == -1:\n\n return TABLE[w][i]\n\n\n\n if i >= len(S):\n\n # print(\"jey\", log)\n\n return True\n\n\n\n r1, r2, r3, r4 = False, False, False, False\n\n if S[i:i + 5] == words[0]:\n\n r1 = recur(i + 5, 0)\n\n if S[i:i + 7] == words[1]:\n\n r2 = recur(i + 7, 1)\n\n if S[i:i + 5] == words[2]:\n\n r3 = recur(i + 5, 2)\n\n if S[i:i + 6] == words[3]:\n\n r4 = recur(i + 6, 3)\n\n\n\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n\n\n\n return TABLE[w][i]\n\n\n\n ans = recur(0, 0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n", "target": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\ndef solve():\n\n S = input()\n\n # print(S, len(S))\n\n\n\n S = S[::-1]\n\n words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])\n\n\n\n def recur(i):\n\n if i >= len(S):\n\n return True\n\n\n\n for word in words:\n\n if S[i:i + len(word)] == word:\n\n if recur(i + len(word)):\n\n return True\n\n return False\n\n\n\n ans = recur(0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n", "code_v0_loc": 45, "code_v1_loc": 31, "code_v0_num_chars": 1006, "code_v1_num_chars": 596, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef solve():\n S = input()\n # print(S, len(S))\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n def recur(i, w):\n if not TABLE[w][i] == -1:\n return TABLE[w][i]\n if i >= len(S):\n # print(\"jey\", log)\n return True\n r1, r2, r3, r4 = False, False, False, False\n if S[i : i + 5] == words[0]:\n r1 = recur(i + 5, 0)\n if S[i : i + 7] == words[1]:\n r2 = recur(i + 7, 1)\n if S[i : i + 5] == words[2]:\n r3 = recur(i + 5, 2)\n if S[i : i + 6] == words[3]:\n r4 = recur(i + 6, 3)\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n return TABLE[w][i]\n\n ans = recur(0, 0)\n return ans\n\n\nif __name__ == \"__main__\":\n res = solve()\n if res:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef solve():\n S = input()\n # print(S, len(S))\n S = S[::-1]\n words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])\n\n def recur(i):\n if i >= len(S):\n return True\n for word in words:\n if S[i : i + len(word)] == word:\n if recur(i + len(word)):\n return True\n return False\n\n ans = recur(0)\n return ans\n\n\nif __name__ == \"__main__\":\n res = solve()\n if res:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 31.1111111111, "diff": ["- words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}", "- TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]", "+ S = S[::-1]", "+ words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])", "- def recur(i, w):", "- if not TABLE[w][i] == -1:", "- return TABLE[w][i]", "+ def recur(i):", "- # print(\"jey\", log)", "- r1, r2, r3, r4 = False, False, False, False", "- if S[i : i + 5] == words[0]:", "- r1 = recur(i + 5, 0)", "- if S[i : i + 7] == words[1]:", "- r2 = recur(i + 7, 1)", "- if S[i : i + 5] == words[2]:", "- r3 = recur(i + 5, 2)", "- if S[i : i + 6] == words[3]:", "- r4 = recur(i + 6, 3)", "- TABLE[w][i] = r1 or r2 or r3 or r4 or False", "- return TABLE[w][i]", "+ for word in words:", "+ if S[i : i + len(word)] == word:", "+ if recur(i + len(word)):", "+ return True", "+ return False", "- ans = recur(0, 0)", "+ ans = recur(0)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3275957136, "measured_runtime_v1": 0.2137343092, "runtime_lift": 1.5327240387, "key": ["s952373499", "s487524594"]} +{"user_id": "u112317104", "problem_id": "p02773", "language": "python", "submission_id_v0": "s565064219", "submission_id_v1": "s656135042", "cpu_time_v0": 1126, "cpu_time_v1": 742, "memory_v0": 46132, "memory_v1": 32480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 34.1, "input": "from collections import defaultdict\n\n\n\nN = int(input())\n\nA = [input() for _ in range(N)]\n\nA.sort()\n\nd = defaultdict(int)\n\nfor a in A:\n\n d[a] += 1\n\n\n\nl = sorted(d.items())\n\nmax_v = 0\n\n\n\nfor _, v in l:\n\n if v > max_v:\n\n max_v = v\n\n \n\nfor k, v in l:\n\n if v == max_v:\n\n print(k)\n\n else:\n\n continue\n", "target": "from collections import defaultdict\n\n\n\ndef solve():\n\n N = int(input())\n\n d = defaultdict(int)\n\n for _ in range(N):\n\n a = input()\n\n d[a] += 1\n\n\n\n m = 0\n\n for k, v in list(d.items()):\n\n m = max(m, v)\n\n \n\n l = []\n\n for k, v in list(d.items()):\n\n if m == v:\n\n l.append(k)\n\n l.sort()\n\n for ans in l:\n\n print(ans)\n\n \n\nsolve()", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 330, "code_v1_num_chars": 386, "code_v0_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nA = [input() for _ in range(N)]\nA.sort()\nd = defaultdict(int)\nfor a in A:\n d[a] += 1\nl = sorted(d.items())\nmax_v = 0\nfor _, v in l:\n if v > max_v:\n max_v = v\nfor k, v in l:\n if v == max_v:\n print(k)\n else:\n continue\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\n\ndef solve():\n N = int(input())\n d = defaultdict(int)\n for _ in range(N):\n a = input()\n d[a] += 1\n m = 0\n for k, v in list(d.items()):\n m = max(m, v)\n l = []\n for k, v in list(d.items()):\n if m == v:\n l.append(k)\n l.sort()\n for ans in l:\n print(ans)\n\n\nsolve()\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-N = int(input())", "-A = [input() for _ in range(N)]", "-A.sort()", "-d = defaultdict(int)", "-for a in A:", "- d[a] += 1", "-l = sorted(d.items())", "-max_v = 0", "-for _, v in l:", "- if v > max_v:", "- max_v = v", "-for k, v in l:", "- if v == max_v:", "- print(k)", "- else:", "- continue", "+", "+def solve():", "+ N = int(input())", "+ d = defaultdict(int)", "+ for _ in range(N):", "+ a = input()", "+ d[a] += 1", "+ m = 0", "+ for k, v in list(d.items()):", "+ m = max(m, v)", "+ l = []", "+ for k, v in list(d.items()):", "+ if m == v:", "+ l.append(k)", "+ l.sort()", "+ for ans in l:", "+ print(ans)", "+", "+", "+solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2730668259, "measured_runtime_v1": 0.1417047331, "runtime_lift": 1.9270127385, "key": ["s565064219", "s656135042"]} +{"user_id": "u038408819", "problem_id": "p02691", "language": "python", "submission_id_v0": "s116716284", "submission_id_v1": "s825945845", "cpu_time_v0": 328, "cpu_time_v1": 178, "memory_v0": 73948, "memory_v1": 132600, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.73, "input": "n = int(input())\n\na = list(map(int, input().split()))\n\na_index = []\n\nfor i in range(n):\n\n a_index.append((i, a[i]))\n\ndic1 = {}\n\ndic2 = {}\n\nfor i in range(n):\n\n one = a_index[i][0] + a_index[i][1]\n\n two = a_index[i][0] - a_index[i][1]\n\n if one not in dic1:\n\n dic1[one] = 1\n\n else:\n\n dic1[one] += 1\n\n if two not in dic2:\n\n dic2[two] = 1\n\n else:\n\n dic2[two] += 1\n\nans = 0\n\nfor i in list(dic1.keys()):\n\n if i in dic2:\n\n ans += dic2[i] * dic1[i]\n\nfor i in list(dic2.keys()):\n\n if i in dic1:\n\n ans += dic1[i] * dic2[i]\n\n #print(i)\n\nprint((ans // 2))\n", "target": "n = int(input())\n\na = list(map(int, input().split()))\n\nimport collections\n\nans = 0\n\ndic = collections.defaultdict(int)\n\nfor i in range(1, n + 1):\n\n ans += dic[i - a[i - 1]]\n\n dic[i + a[i - 1]] += 1\n\nprint(ans)", "code_v0_loc": 27, "code_v1_loc": 9, "code_v0_num_chars": 606, "code_v1_num_chars": 215, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\na_index = []\nfor i in range(n):\n a_index.append((i, a[i]))\ndic1 = {}\ndic2 = {}\nfor i in range(n):\n one = a_index[i][0] + a_index[i][1]\n two = a_index[i][0] - a_index[i][1]\n if one not in dic1:\n dic1[one] = 1\n else:\n dic1[one] += 1\n if two not in dic2:\n dic2[two] = 1\n else:\n dic2[two] += 1\nans = 0\nfor i in list(dic1.keys()):\n if i in dic2:\n ans += dic2[i] * dic1[i]\nfor i in list(dic2.keys()):\n if i in dic1:\n ans += dic1[i] * dic2[i]\n # print(i)\nprint((ans // 2))\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nimport collections\n\nans = 0\ndic = collections.defaultdict(int)\nfor i in range(1, n + 1):\n ans += dic[i - a[i - 1]]\n dic[i + a[i - 1]] += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-a_index = []", "-for i in range(n):", "- a_index.append((i, a[i]))", "-dic1 = {}", "-dic2 = {}", "-for i in range(n):", "- one = a_index[i][0] + a_index[i][1]", "- two = a_index[i][0] - a_index[i][1]", "- if one not in dic1:", "- dic1[one] = 1", "- else:", "- dic1[one] += 1", "- if two not in dic2:", "- dic2[two] = 1", "- else:", "- dic2[two] += 1", "+import collections", "+", "-for i in list(dic1.keys()):", "- if i in dic2:", "- ans += dic2[i] * dic1[i]", "-for i in list(dic2.keys()):", "- if i in dic1:", "- ans += dic1[i] * dic2[i]", "- # print(i)", "-print((ans // 2))", "+dic = collections.defaultdict(int)", "+for i in range(1, n + 1):", "+ ans += dic[i - a[i - 1]]", "+ dic[i + a[i - 1]] += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3792731187, "measured_runtime_v1": 0.2976846831, "runtime_lift": 1.2740767002, "key": ["s116716284", "s825945845"]} +{"user_id": "u123756661", "problem_id": "p03835", "language": "python", "submission_id_v0": "s113088304", "submission_id_v1": "s025062934", "cpu_time_v0": 1218, "cpu_time_v1": 258, "memory_v0": 2940, "memory_v1": 41580, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.82, "input": "k,s=list(map(int,input().split()))\n\nans=chk=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if (0<=s-i-j<=k): ans+=1\n\nprint(ans)", "target": "k,s=list(map(int,input().split()))\n\nans=0\n\nx=min(k+1,s+1)\n\ny=max(0,s-k-k)\n\nfor i in range(y,x):\n\n for j in range(y,x):\n\n if i+j>s: break\n\n if 0<=s-i-j<=k:\n\n ans+=1\n\nprint(ans)", "code_v0_loc": 6, "code_v1_loc": 10, "code_v0_num_chars": 133, "code_v1_num_chars": 197, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\nans = chk = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nx = min(k + 1, s + 1)\ny = max(0, s - k - k)\nfor i in range(y, x):\n for j in range(y, x):\n if i + j > s:\n break\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-ans = chk = 0", "-for i in range(k + 1):", "- for j in range(k + 1):", "+ans = 0", "+x = min(k + 1, s + 1)", "+y = max(0, s - k - k)", "+for i in range(y, x):", "+ for j in range(y, x):", "+ if i + j > s:", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3946401063, "measured_runtime_v1": 0.3009130723, "runtime_lift": 1.3114754477, "key": ["s113088304", "s025062934"]} +{"user_id": "u761320129", "problem_id": "p03564", "language": "python", "submission_id_v0": "s515134391", "submission_id_v1": "s980600609", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N,K = int(input()), int(input())\n\nnow = 1\n\nfor i in range(N):\n\n if now*2 < now + K:\n\n now *= 2\n\n else:\n\n now += K\n\nprint(now)\n", "target": "N = int(input())\n\nK = int(input())\n\nans = 1\n\nfor i in range(N):\n\n if ans < K:\n\n ans *= 2\n\n else:\n\n ans += K\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 146, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "N, K = int(input()), int(input())\nnow = 1\nfor i in range(N):\n if now * 2 < now + K:\n now *= 2\n else:\n now += K\nprint(now)\n", "code_v1_no_empty_lines": "N = int(input())\nK = int(input())\nans = 1\nfor i in range(N):\n if ans < K:\n ans *= 2\n else:\n ans += K\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-N, K = int(input()), int(input())", "-now = 1", "+N = int(input())", "+K = int(input())", "+ans = 1", "- if now * 2 < now + K:", "- now *= 2", "+ if ans < K:", "+ ans *= 2", "- now += K", "-print(now)", "+ ans += K", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2990638907, "measured_runtime_v1": 0.1086408798, "runtime_lift": 2.7527749338, "key": ["s515134391", "s980600609"]} +{"user_id": "u177388368", "problem_id": "p02881", "language": "python", "submission_id_v0": "s386884404", "submission_id_v1": "s516418112", "cpu_time_v0": 474, "cpu_time_v1": 256, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.99, "input": "import math\n\nn=int(input())\n\nans=n\n\ni=1\n\nwhile(i<=math.sqrt(n)):\n\n if n%i==0:\n\n d=i+n/i-2\n\n ans=min(ans,d)\n\n i+=1\n\nprint((int(ans)))", "target": "from math import floor\n\nfrom math import sqrt\n\nn=int(input())\n\nnn=floor(sqrt(n))\n\nrest=n%nn\n\nwhile rest!=0:\n\n nn-=1\n\n rest=n%nn\n\nnnn=n/nn\n\nprint((int(nn+nnn-2)))", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 150, "code_v1_num_chars": 165, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nans = n\ni = 1\nwhile i <= math.sqrt(n):\n if n % i == 0:\n d = i + n / i - 2\n ans = min(ans, d)\n i += 1\nprint((int(ans)))\n", "code_v1_no_empty_lines": "from math import floor\nfrom math import sqrt\n\nn = int(input())\nnn = floor(sqrt(n))\nrest = n % nn\nwhile rest != 0:\n nn -= 1\n rest = n % nn\nnnn = n / nn\nprint((int(nn + nnn - 2)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-import math", "+from math import floor", "+from math import sqrt", "-ans = n", "-i = 1", "-while i <= math.sqrt(n):", "- if n % i == 0:", "- d = i + n / i - 2", "- ans = min(ans, d)", "- i += 1", "-print((int(ans)))", "+nn = floor(sqrt(n))", "+rest = n % nn", "+while rest != 0:", "+ nn -= 1", "+ rest = n % nn", "+nnn = n / nn", "+print((int(nn + nnn - 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3770523396, "measured_runtime_v1": 0.2395324836, "runtime_lift": 1.5741177727, "key": ["s386884404", "s516418112"]} +{"user_id": "u275934251", "problem_id": "p03796", "language": "python", "submission_id_v0": "s111144925", "submission_id_v1": "s028336395", "cpu_time_v0": 229, "cpu_time_v1": 37, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.84, "input": "import math\n\n\n\nN = int(input())\n\n\n\npower = math.factorial(N)\n\n\n\nprint((power % 1000000007))\n\n\n", "target": "n=int(input())\n\nans=1\n\nfor i in range(n):\n\n ans=(ans*(i+1))%(10**9+7)\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 5, "code_v0_num_chars": 92, "code_v1_num_chars": 84, "code_v0_no_empty_lines": "import math\n\nN = int(input())\npower = math.factorial(N)\nprint((power % 1000000007))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nfor i in range(n):\n ans = (ans * (i + 1)) % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 37.5, "diff": ["-import math", "-", "-N = int(input())", "-power = math.factorial(N)", "-print((power % 1000000007))", "+n = int(input())", "+ans = 1", "+for i in range(n):", "+ ans = (ans * (i + 1)) % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7185150633, "measured_runtime_v1": 0.3322105608, "runtime_lift": 2.1628302891, "key": ["s111144925", "s028336395"]} +{"user_id": "u353797797", "problem_id": "p03170", "language": "python", "submission_id_v0": "s365373544", "submission_id_v1": "s835744397", "cpu_time_v0": 126, "cpu_time_v1": 112, "memory_v0": 3828, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.11, "input": "n, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii <= k:\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n", "target": "n, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii > k:break\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 271, "code_v1_num_chars": 271, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\na_s = list(map(int, input().split()))\ndp = [\"Second\"] * (k + 1)\nfor i in range(k + 1):\n if dp[i] == \"Second\":\n for a in a_s:\n ii = i + a\n if ii <= k:\n dp[ii] = \"First\"\nprint((dp[-1]))\n", "code_v1_no_empty_lines": "n, k = list(map(int, input().split()))\na_s = list(map(int, input().split()))\ndp = [\"Second\"] * (k + 1)\nfor i in range(k + 1):\n if dp[i] == \"Second\":\n for a in a_s:\n ii = i + a\n if ii > k:\n break\n dp[ii] = \"First\"\nprint((dp[-1]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if ii <= k:", "- dp[ii] = \"First\"", "+ if ii > k:", "+ break", "+ dp[ii] = \"First\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.3611531999, "measured_runtime_v1": 0.2298232606, "runtime_lift": 1.5714388476, "key": ["s365373544", "s835744397"]} +{"user_id": "u604839890", "problem_id": "p02622", "language": "python", "submission_id_v0": "s830524393", "submission_id_v1": "s723518358", "cpu_time_v0": 83, "cpu_time_v1": 70, "memory_v0": 85616, "memory_v1": 73748, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.66, "input": "S, T = [list(input()) for _ in range(2)]\n\ncnt = 0\n\nfor i in range(len(S)):\n\n if S[i] != T[i]:\n\n cnt += 1\n\nprint(cnt)\n", "target": "s, t = [input() for i in range(2)]\n\nans = 0\n\nfor i in range(len(s)):\n\n if s[i] != t[i]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 127, "code_v1_num_chars": 114, "code_v0_no_empty_lines": "S, T = [list(input()) for _ in range(2)]\ncnt = 0\nfor i in range(len(S)):\n if S[i] != T[i]:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "s, t = [input() for i in range(2)]\nans = 0\nfor i in range(len(s)):\n if s[i] != t[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-S, T = [list(input()) for _ in range(2)]", "-cnt = 0", "-for i in range(len(S)):", "- if S[i] != T[i]:", "- cnt += 1", "-print(cnt)", "+s, t = [input() for i in range(2)]", "+ans = 0", "+for i in range(len(s)):", "+ if s[i] != t[i]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2683959379, "measured_runtime_v1": 0.2054475396, "runtime_lift": 1.3063964576, "key": ["s830524393", "s723518358"]} +{"user_id": "u644907318", "problem_id": "p02886", "language": "python", "submission_id_v0": "s745140004", "submission_id_v1": "s021490246", "cpu_time_v0": 167, "cpu_time_v1": 89, "memory_v0": 38512, "memory_v1": 61656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.71, "input": "N = int(input())\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N-1):\n\n for j in range(i+1,N):\n\n cnt += D[i]*D[j]\n\nprint(cnt)", "target": "N = int(input())\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += D[i]**2\n\ntot = 0\n\nfor i in range(N):\n\n tot += D[i]\n\ntot = tot**2\n\ntot -= cnt\n\nprint((tot//2))", "code_v0_loc": 7, "code_v1_loc": 11, "code_v0_num_chars": 149, "code_v1_num_chars": 188, "code_v0_no_empty_lines": "N = int(input())\nD = list(map(int, input().split()))\ncnt = 0\nfor i in range(N - 1):\n for j in range(i + 1, N):\n cnt += D[i] * D[j]\nprint(cnt)\n", "code_v1_no_empty_lines": "N = int(input())\nD = list(map(int, input().split()))\ncnt = 0\nfor i in range(N):\n cnt += D[i] ** 2\ntot = 0\nfor i in range(N):\n tot += D[i]\ntot = tot**2\ntot -= cnt\nprint((tot // 2))\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-for i in range(N - 1):", "- for j in range(i + 1, N):", "- cnt += D[i] * D[j]", "-print(cnt)", "+for i in range(N):", "+ cnt += D[i] ** 2", "+tot = 0", "+for i in range(N):", "+ tot += D[i]", "+tot = tot**2", "+tot -= cnt", "+print((tot // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2884610276, "measured_runtime_v1": 0.2260356005, "runtime_lift": 1.2761751997, "key": ["s745140004", "s021490246"]} +{"user_id": "u258073778", "problem_id": "p03370", "language": "python", "submission_id_v0": "s864579791", "submission_id_v1": "s018766024", "cpu_time_v0": 712, "cpu_time_v1": 525, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.26, "input": "N, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(input())\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x // min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n if x >= min(mn):\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)", "target": "N, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(input())\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x // min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)", "code_v0_loc": 18, "code_v1_loc": 17, "code_v0_num_chars": 293, "code_v1_num_chars": 267, "code_v0_no_empty_lines": "N, X = list(map(int, input().split()))\nmn = [0] * N\nfor i in range(N):\n mn[i] = int(input())\nans = N\nx = X - sum(mn)\nwhile x >= min(mn):\n if x // min(mn) == 0:\n mn[mn.index(min(mn))] = 1000000\n else:\n if x >= min(mn):\n x -= min(mn)\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N, X = list(map(int, input().split()))\nmn = [0] * N\nfor i in range(N):\n mn[i] = int(input())\nans = N\nx = X - sum(mn)\nwhile x >= min(mn):\n if x // min(mn) == 0:\n mn[mn.index(min(mn))] = 1000000\n else:\n x -= min(mn)\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 5.5555555556, "diff": ["- if x >= min(mn):", "- x -= min(mn)", "- ans += 1", "+ x -= min(mn)", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2841449485, "measured_runtime_v1": 0.2087575016, "runtime_lift": 1.3611244927, "key": ["s864579791", "s018766024"]} +{"user_id": "u961683878", "problem_id": "p02596", "language": "python", "submission_id_v0": "s650878996", "submission_id_v1": "s172963527", "cpu_time_v0": 1976, "cpu_time_v1": 198, "memory_v0": 165028, "memory_v1": 9244, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 89.98, "input": "#! /usr/bin/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\n\n\ndef isMultiple(s, m):\n\n tmp = 0\n\n for i in range(len(s)):\n\n tmp = (tmp * 10 + int(s[i])) % m\n\n if tmp == 0:\n\n return i\n\n return -1\n\n\n\n\n\nk = int(readline())\n\nacc = \"7\" * 50000000\n\nif k % 2 == 0:\n\n ans = -1\n\nelse:\n\n\n\n ans = isMultiple(acc, k)\n\n if ans != -1:\n\n ans += 1\n\n\n\nprint(ans)\n", "target": "#! /usr/bin/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\nk = int(readline())\n\n\n\nans = -1\n\nacc = 7 % k\n\nfor n in range(1, k + 10):\n\n if acc == 0:\n\n ans = n\n\n break\n\n acc = (10 * acc + 7) % k\n\n\n\nprint(ans)\n", "code_v0_loc": 30, "code_v1_loc": 20, "code_v0_num_chars": 543, "code_v1_num_chars": 376, "code_v0_no_empty_lines": "#! /usr/bin/env python3\nimport sys\n\nint1 = lambda x: int(x) - 1\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(500000)\n\n\ndef isMultiple(s, m):\n tmp = 0\n for i in range(len(s)):\n tmp = (tmp * 10 + int(s[i])) % m\n if tmp == 0:\n return i\n return -1\n\n\nk = int(readline())\nacc = \"7\" * 50000000\nif k % 2 == 0:\n ans = -1\nelse:\n ans = isMultiple(acc, k)\n if ans != -1:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "#! /usr/bin/env python3\nimport sys\n\nint1 = lambda x: int(x) - 1\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(500000)\nk = int(readline())\nans = -1\nacc = 7 % k\nfor n in range(1, k + 10):\n if acc == 0:\n ans = n\n break\n acc = (10 * acc + 7) % k\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-", "-", "-def isMultiple(s, m):", "- tmp = 0", "- for i in range(len(s)):", "- tmp = (tmp * 10 + int(s[i])) % m", "- if tmp == 0:", "- return i", "- return -1", "-", "-", "-acc = \"7\" * 50000000", "-if k % 2 == 0:", "- ans = -1", "-else:", "- ans = isMultiple(acc, k)", "- if ans != -1:", "- ans += 1", "+ans = -1", "+acc = 7 % k", "+for n in range(1, k + 10):", "+ if acc == 0:", "+ ans = n", "+ break", "+ acc = (10 * acc + 7) % k"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8533027549, "measured_runtime_v1": 0.4769769247, "runtime_lift": 1.788981208, "key": ["s650878996", "s172963527"]} +{"user_id": "u133936772", "problem_id": "p02615", "language": "python", "submission_id_v0": "s324254523", "submission_id_v1": "s548223725", "cpu_time_v0": 146, "cpu_time_v1": 118, "memory_v0": 31756, "memory_v1": 31752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.18, "input": "n,*l=list(map(int,open(0).read().split()));print((sum(sorted(l*2)[-2:~n:-1])))", "target": "n,*l=list(map(int,open(0).read().split()))\n\nl.sort(reverse=1)\n\nprint((sum(l[i//2] for i in range(1,n))))", "code_v0_loc": 1, "code_v1_loc": 3, "code_v0_num_chars": 70, "code_v1_num_chars": 96, "code_v0_no_empty_lines": "n, *l = list(map(int, open(0).read().split()))\nprint((sum(sorted(l * 2)[-2:~n:-1])))\n", "code_v1_no_empty_lines": "n, *l = list(map(int, open(0).read().split()))\nl.sort(reverse=1)\nprint((sum(l[i // 2] for i in range(1, n))))\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-print((sum(sorted(l * 2)[-2:~n:-1])))", "+l.sort(reverse=1)", "+print((sum(l[i // 2] for i in range(1, n))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2901719676, "measured_runtime_v1": 0.1990829677, "runtime_lift": 1.4575429076, "key": ["s324254523", "s548223725"]} +{"user_id": "u727072969", "problem_id": "p02881", "language": "python", "submission_id_v0": "s064089444", "submission_id_v1": "s044740610", "cpu_time_v0": 519, "cpu_time_v1": 181, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.13, "input": "import math\n\nN = int(input())\n\nfor i in range(int(math.sqrt(N))):\n\n if N % (int(math.sqrt(N))-i) == 0:\n\n print((int(N/(int(math.sqrt(N))-i)+int(math.sqrt(N))-i-2)))\n\n break", "target": "import math\n\nN = int(input())\n\nM = int(math.sqrt(N))\n\nfor i in range(M):\n\n if N % (M-i) == 0:\n\n print((int(N/(M-i)+M-i-2)))\n\n break\n", "code_v0_loc": 6, "code_v1_loc": 7, "code_v0_num_chars": 187, "code_v1_num_chars": 147, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nfor i in range(int(math.sqrt(N))):\n if N % (int(math.sqrt(N)) - i) == 0:\n print((int(N / (int(math.sqrt(N)) - i) + int(math.sqrt(N)) - i - 2)))\n break\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\nM = int(math.sqrt(N))\nfor i in range(M):\n if N % (M - i) == 0:\n print((int(N / (M - i) + M - i - 2)))\n break\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-for i in range(int(math.sqrt(N))):", "- if N % (int(math.sqrt(N)) - i) == 0:", "- print((int(N / (int(math.sqrt(N)) - i) + int(math.sqrt(N)) - i - 2)))", "+M = int(math.sqrt(N))", "+for i in range(M):", "+ if N % (M - i) == 0:", "+ print((int(N / (M - i) + M - i - 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3627885733, "measured_runtime_v1": 0.269237565, "runtime_lift": 1.3474664028, "key": ["s064089444", "s044740610"]} +{"user_id": "u753589982", "problem_id": "p02994", "language": "python", "submission_id_v0": "s918408995", "submission_id_v1": "s703264591", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "N, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple():\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)//2 - eat_apple()))", "target": "N, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple(N, L, max_):\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)//2 - eat_apple(N, L, max_)))", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 227, "code_v1_num_chars": 247, "code_v0_no_empty_lines": "N, L = [int(i) for i in input().split()]\nmin_ = L\nmax_ = L + N - 1\n\n\ndef eat_apple():\n if max_ < 0:\n return max_\n if L < 0:\n return 0\n return L\n\n\nprint(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple()))\n", "code_v1_no_empty_lines": "N, L = [int(i) for i in input().split()]\nmin_ = L\nmax_ = L + N - 1\n\n\ndef eat_apple(N, L, max_):\n if max_ < 0:\n return max_\n if L < 0:\n return 0\n return L\n\n\nprint(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple(N, L, max_)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-def eat_apple():", "+def eat_apple(N, L, max_):", "-print(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple()))", "+print(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple(N, L, max_)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2025646191, "measured_runtime_v1": 0.0060813091, "runtime_lift": 33.309377317, "key": ["s918408995", "s703264591"]} +{"user_id": "u787562674", "problem_id": "p03363", "language": "python", "submission_id_v0": "s520227607", "submission_id_v1": "s241017574", "cpu_time_v0": 271, "cpu_time_v1": 224, "memory_v0": 41880, "memory_v1": 41472, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.34, "input": "from collections import Counter\n\n\n\nN = int(input())\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\nruisekiwa = [0] * (N+1)\n\n\n\nfor i in range(N):\n\n ruisekiwa[i+1] = ruisekiwa[i] + inputs[i]\n\n\n\nruisekiwa = ruisekiwa[1:]\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n", "target": "from collections import Counter\n\nfrom itertools import accumulate\n\n\n\nN = int(input())\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\n\n\nruisekiwa = list(accumulate(inputs))\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n", "code_v0_loc": 25, "code_v1_loc": 22, "code_v0_num_chars": 534, "code_v1_num_chars": 485, "code_v0_no_empty_lines": "from collections import Counter\n\nN = int(input())\ninputs = [int(i) for i in input().split()]\nans = 0\nruisekiwa = [0] * (N + 1)\nfor i in range(N):\n ruisekiwa[i + 1] = ruisekiwa[i] + inputs[i]\nruisekiwa = ruisekiwa[1:]\nruisekiwa.sort()\ncounter_ruiseki = Counter(ruisekiwa)\nfor key, value in list(counter_ruiseki.items()):\n if key == 0 and value == 1:\n ans += value\n continue\n elif key == 0 and value > 1:\n ans += value\n if value > 1:\n ans += sum(list(range(value)))\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import Counter\nfrom itertools import accumulate\n\nN = int(input())\ninputs = [int(i) for i in input().split()]\nans = 0\nruisekiwa = list(accumulate(inputs))\nruisekiwa.sort()\ncounter_ruiseki = Counter(ruisekiwa)\nfor key, value in list(counter_ruiseki.items()):\n if key == 0 and value == 1:\n ans += value\n continue\n elif key == 0 and value > 1:\n ans += value\n if value > 1:\n ans += sum(list(range(value)))\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 12.0, "diff": ["+from itertools import accumulate", "-ruisekiwa = [0] * (N + 1)", "-for i in range(N):", "- ruisekiwa[i + 1] = ruisekiwa[i] + inputs[i]", "-ruisekiwa = ruisekiwa[1:]", "+ruisekiwa = list(accumulate(inputs))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.19887093, "measured_runtime_v1": 0.1327844608, "runtime_lift": 1.4976973116, "key": ["s520227607", "s241017574"]} +{"user_id": "u868701750", "problem_id": "p03457", "language": "python", "submission_id_v0": "s991338937", "submission_id_v1": "s211926413", "cpu_time_v0": 209, "cpu_time_v1": 173, "memory_v0": 27480, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.22, "input": "import sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n T = [list(map(int, _input().split())) for _ in range(N)]\n\n t, x, y = 0, 0, 0\n\n for next_t, next_x, next_y in T:\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()", "target": "import sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n t, x, y = 0, 0, 0\n\n for _ in range(N):\n\n next_t, next_x, next_y = list(map(int, _input().split()))\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()", "code_v0_loc": 19, "code_v1_loc": 19, "code_v0_num_chars": 459, "code_v1_num_chars": 444, "code_v0_no_empty_lines": "import sys\n\n_input = sys.stdin.readline\n\n\ndef resolve():\n N = int(_input())\n T = [list(map(int, _input().split())) for _ in range(N)]\n t, x, y = 0, 0, 0\n for next_t, next_x, next_y in T:\n diff_xy = abs(x - next_x) + abs(y - next_y)\n diff_t = next_t - t\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n print(\"No\")\n exit(0)\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_v1_no_empty_lines": "import sys\n\n_input = sys.stdin.readline\n\n\ndef resolve():\n N = int(_input())\n t, x, y = 0, 0, 0\n for _ in range(N):\n next_t, next_x, next_y = list(map(int, _input().split()))\n diff_xy = abs(x - next_x) + abs(y - next_y)\n diff_t = next_t - t\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n print(\"No\")\n exit(0)\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- T = [list(map(int, _input().split())) for _ in range(N)]", "- for next_t, next_x, next_y in T:", "+ for _ in range(N):", "+ next_t, next_x, next_y = list(map(int, _input().split()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2834033267, "measured_runtime_v1": 0.1166054926, "runtime_lift": 2.4304457743, "key": ["s991338937", "s211926413"]} +{"user_id": "u280978334", "problem_id": "p03107", "language": "python", "submission_id_v0": "s353947972", "submission_id_v1": "s266533401", "cpu_time_v0": 65, "cpu_time_v1": 18, "memory_v0": 5400, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.31, "input": "S = [int(_) for _ in input()]\n\nlength = len(S)\n\ntemp = [S[0]]\n\nfor x in S[1:]:\n\n if(len(temp) == 0):\n\n temp.append(x)\n\n elif( temp[-1] == x):\n\n temp.append(x)\n\n else:\n\n temp.pop(-1)\n\nprint((length-len(temp)))\n\n ", "target": "def main():\n\n A = input()\n\n print((2*min(A.count(\"0\"),A.count(\"1\"))))\n\n \n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 12, "code_v1_loc": 6, "code_v0_num_chars": 246, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "S = [int(_) for _ in input()]\nlength = len(S)\ntemp = [S[0]]\nfor x in S[1:]:\n if len(temp) == 0:\n temp.append(x)\n elif temp[-1] == x:\n temp.append(x)\n else:\n temp.pop(-1)\nprint((length - len(temp)))\n", "code_v1_no_empty_lines": "def main():\n A = input()\n print((2 * min(A.count(\"0\"), A.count(\"1\"))))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-S = [int(_) for _ in input()]", "-length = len(S)", "-temp = [S[0]]", "-for x in S[1:]:", "- if len(temp) == 0:", "- temp.append(x)", "- elif temp[-1] == x:", "- temp.append(x)", "- else:", "- temp.pop(-1)", "-print((length - len(temp)))", "+def main():", "+ A = input()", "+ print((2 * min(A.count(\"0\"), A.count(\"1\"))))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2279973624, "measured_runtime_v1": 0.00614361, "runtime_lift": 37.1113013328, "key": ["s353947972", "s266533401"]} +{"user_id": "u423966555", "problem_id": "p02596", "language": "python", "submission_id_v0": "s734835984", "submission_id_v1": "s256781932", "cpu_time_v0": 338, "cpu_time_v1": 178, "memory_v0": 16560, "memory_v1": 9056, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.34, "input": "K = int(input())\n\n\n\nflg = [False]*K\n\n\n\ntmp = 7 % K\n\ncnt = 1\n\nif tmp == 0:\n\n print(cnt)\n\n exit()\n\nwhile True:\n\n tmp = (tmp*10+7)%K\n\n if flg[tmp]:\n\n print((-1))\n\n break\n\n else:\n\n cnt += 1\n\n if tmp == 0:\n\n print(cnt)\n\n break\n\n flg[tmp] = True\n", "target": "K = int(input())\n\nt = 7\n\nt %= K\n\n\n\nfor i in range(K+1):\n\n if t == 0:\n\n print((i+1))\n\n exit()\n\n t = (t*10+7)%K\n\nprint((-1))\n", "code_v0_loc": 20, "code_v1_loc": 10, "code_v0_num_chars": 310, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "K = int(input())\nflg = [False] * K\ntmp = 7 % K\ncnt = 1\nif tmp == 0:\n print(cnt)\n exit()\nwhile True:\n tmp = (tmp * 10 + 7) % K\n if flg[tmp]:\n print((-1))\n break\n else:\n cnt += 1\n if tmp == 0:\n print(cnt)\n break\n flg[tmp] = True\n", "code_v1_no_empty_lines": "K = int(input())\nt = 7\nt %= K\nfor i in range(K + 1):\n if t == 0:\n print((i + 1))\n exit()\n t = (t * 10 + 7) % K\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-flg = [False] * K", "-tmp = 7 % K", "-cnt = 1", "-if tmp == 0:", "- print(cnt)", "- exit()", "-while True:", "- tmp = (tmp * 10 + 7) % K", "- if flg[tmp]:", "- print((-1))", "- break", "- else:", "- cnt += 1", "- if tmp == 0:", "- print(cnt)", "- break", "- flg[tmp] = True", "+t = 7", "+t %= K", "+for i in range(K + 1):", "+ if t == 0:", "+ print((i + 1))", "+ exit()", "+ t = (t * 10 + 7) % K", "+print((-1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6767371264, "measured_runtime_v1": 0.4369205115, "runtime_lift": 1.5488792779, "key": ["s734835984", "s256781932"]} +{"user_id": "u239981649", "problem_id": "p03796", "language": "python", "submission_id_v0": "s383796227", "submission_id_v1": "s138334572", "cpu_time_v0": 232, "cpu_time_v1": 34, "memory_v0": 3972, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.34, "input": "from math import factorial\n\nprint((factorial(int(input())) % (10**9+7)))", "target": "ans = 1\n\nfor k in range(1, int(input())+1):\n\n ans = ans*k % (10**9+7)\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 4, "code_v0_num_chars": 70, "code_v1_num_chars": 84, "code_v0_no_empty_lines": "from math import factorial\n\nprint((factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nfor k in range(1, int(input()) + 1):\n ans = ans * k % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-from math import factorial", "-", "-print((factorial(int(input())) % (10**9 + 7)))", "+ans = 1", "+for k in range(1, int(input()) + 1):", "+ ans = ans * k % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3382144179, "measured_runtime_v1": 0.1644267938, "runtime_lift": 2.0569300785, "key": ["s383796227", "s138334572"]} +{"user_id": "u761320129", "problem_id": "p03822", "language": "python", "submission_id_v0": "s508015569", "submission_id_v1": "s203932637", "cpu_time_v0": 763, "cpu_time_v1": 637, "memory_v0": 227992, "memory_v1": 123792, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.51, "input": "import sys\n\nsys.setrecursionlimit(202020)\n\n\n\nN = int(input())\n\nwon = [[] for i in range(N)]\n\nfor i in range(1,N):\n\n a = int(input()) - 1\n\n won[a].append(i)\n\n\n\ndef height(v):\n\n if not won[v]: return 0\n\n hs = [height(op) for op in won[v]]\n\n ret = 0\n\n for i,h in enumerate(sorted(hs)):\n\n ret = max(ret, h + len(hs) - i)\n\n return ret\n\n\n\nprint((height(0)))", "target": "import sys\n\nsys.setrecursionlimit(10**8)\n\nN = int(input())\n\nA = [int(input())-1 for i in range(N-1)]\n\nwins = [[] for _ in range(N)]\n\n\n\nfor i,a in enumerate(A):\n\n wins[a].append(i+1)\n\n\n\ndepth = [-1] * N\n\ndef dep(v):\n\n if len(wins[v])==0: return 0\n\n if depth[v] >= 0:\n\n return depth[v]\n\n ds = []\n\n for w in wins[v]:\n\n ds.append(dep(w))\n\n ds.sort(reverse=True)\n\n ret = 0\n\n for i,d in enumerate(ds):\n\n ret = max(ret, i+d+1)\n\n depth[v] = ret\n\n return ret\n\nprint((dep(0)))", "code_v0_loc": 18, "code_v1_loc": 24, "code_v0_num_chars": 377, "code_v1_num_chars": 515, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(202020)\nN = int(input())\nwon = [[] for i in range(N)]\nfor i in range(1, N):\n a = int(input()) - 1\n won[a].append(i)\n\n\ndef height(v):\n if not won[v]:\n return 0\n hs = [height(op) for op in won[v]]\n ret = 0\n for i, h in enumerate(sorted(hs)):\n ret = max(ret, h + len(hs) - i)\n return ret\n\n\nprint((height(0)))\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**8)\nN = int(input())\nA = [int(input()) - 1 for i in range(N - 1)]\nwins = [[] for _ in range(N)]\nfor i, a in enumerate(A):\n wins[a].append(i + 1)\ndepth = [-1] * N\n\n\ndef dep(v):\n if len(wins[v]) == 0:\n return 0\n if depth[v] >= 0:\n return depth[v]\n ds = []\n for w in wins[v]:\n ds.append(dep(w))\n ds.sort(reverse=True)\n ret = 0\n for i, d in enumerate(ds):\n ret = max(ret, i + d + 1)\n depth[v] = ret\n return ret\n\n\nprint((dep(0)))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-sys.setrecursionlimit(202020)", "+sys.setrecursionlimit(10**8)", "-won = [[] for i in range(N)]", "-for i in range(1, N):", "- a = int(input()) - 1", "- won[a].append(i)", "+A = [int(input()) - 1 for i in range(N - 1)]", "+wins = [[] for _ in range(N)]", "+for i, a in enumerate(A):", "+ wins[a].append(i + 1)", "+depth = [-1] * N", "-def height(v):", "- if not won[v]:", "+def dep(v):", "+ if len(wins[v]) == 0:", "- hs = [height(op) for op in won[v]]", "+ if depth[v] >= 0:", "+ return depth[v]", "+ ds = []", "+ for w in wins[v]:", "+ ds.append(dep(w))", "+ ds.sort(reverse=True)", "- for i, h in enumerate(sorted(hs)):", "- ret = max(ret, h + len(hs) - i)", "+ for i, d in enumerate(ds):", "+ ret = max(ret, i + d + 1)", "+ depth[v] = ret", "-print((height(0)))", "+print((dep(0)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3026691139, "measured_runtime_v1": 0.2050500124, "runtime_lift": 1.4760745946, "key": ["s508015569", "s203932637"]} +{"user_id": "u263737105", "problem_id": "p02595", "language": "python", "submission_id_v0": "s947121829", "submission_id_v1": "s479170385", "cpu_time_v0": 481, "cpu_time_v1": 391, "memory_v0": 9072, "memory_v1": 9124, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.71, "input": "N, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a**2 + b**2) <= D**2:\n\n count += 1\n\nprint(count)\n", "target": "N, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a*a + b*b) <= D*D:\n\n count += 1\n\nprint(count)\n", "code_v0_loc": 7, "code_v1_loc": 7, "code_v0_num_chars": 167, "code_v1_num_chars": 164, "code_v0_no_empty_lines": "N, D = list(map(int, input().split()))\ncount = 0\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if (a**2 + b**2) <= D**2:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "N, D = list(map(int, input().split()))\ncount = 0\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if (a * a + b * b) <= D * D:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if (a**2 + b**2) <= D**2:", "+ if (a * a + b * b) <= D * D:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2832637064, "measured_runtime_v1": 0.1751975398, "runtime_lift": 1.6168246811, "key": ["s947121829", "s479170385"]} +{"user_id": "u077291787", "problem_id": "p03309", "language": "python", "submission_id_v0": "s828043733", "submission_id_v1": "s360156642", "cpu_time_v0": 210, "cpu_time_v1": 183, "memory_v0": 27472, "memory_v1": 25324, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.86, "input": "# ABC102C - Linear Approximation (ARC100C)\n\nfrom statistics import median\n\n\n\n\n\ndef main():\n\n n = int(input())\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = tuple(j - i for i, j in enumerate(A, start=1))\n\n b = median(A)\n\n ans = sum(abs(a - b) for a in A)\n\n print((int(ans)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "# ABC102C - Linear Approximation (ARC100C)\n\ndef main():\n\n n = int(input())\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = sorted(j - i for i, j in enumerate(A, start=1))\n\n b = A[n // 2]\n\n ans = sum(abs(a - b) for a in A)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 15, "code_v1_loc": 12, "code_v0_num_chars": 341, "code_v1_num_chars": 302, "code_v0_no_empty_lines": "# ABC102C - Linear Approximation (ARC100C)\nfrom statistics import median\n\n\ndef main():\n n = int(input())\n A = tuple(map(int, input().rstrip().split()))\n A = tuple(j - i for i, j in enumerate(A, start=1))\n b = median(A)\n ans = sum(abs(a - b) for a in A)\n print((int(ans)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# ABC102C - Linear Approximation (ARC100C)\ndef main():\n n = int(input())\n A = tuple(map(int, input().rstrip().split()))\n A = sorted(j - i for i, j in enumerate(A, start=1))\n b = A[n // 2]\n ans = sum(abs(a - b) for a in A)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-from statistics import median", "-", "-", "- A = tuple(j - i for i, j in enumerate(A, start=1))", "- b = median(A)", "+ A = sorted(j - i for i, j in enumerate(A, start=1))", "+ b = A[n // 2]", "- print((int(ans)))", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2185840318, "measured_runtime_v1": 0.1650515537, "runtime_lift": 1.3243379227, "key": ["s828043733", "s360156642"]} +{"user_id": "u260980560", "problem_id": "p01105", "language": "python", "submission_id_v0": "s457180384", "submission_id_v1": "s699385465", "cpu_time_v0": 130, "cpu_time_v1": 50, "memory_v0": 7848, "memory_v1": 7824, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.54, "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nL = {el: 1 for el in [a, b, c, d, e, 0]}\n\nfor i in range(6):\n\n R = sorted(L.items(), key=lambda x: x[1])\n\n for p, l in R:\n\n if l < 16:\n\n L[p ^ e] = min(L.get(p ^ e, 16), l+1)\n\n if l+3 < 16:\n\n for q, r in R:\n\n if l+r+3 <= 16:\n\n L[p & q] = min(L.get(p & q, 16), l+r+3)\n\n L[p ^ q] = min(L.get(p ^ q, 16), l+r+3)\n\n else: break\n\n else: break\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n", "target": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < L.get(p ^ e, 17):\n\n L[p^e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p^e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < L.get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < L.get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: H.append((p, l))\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n", "code_v0_loc": 15, "code_v1_loc": 24, "code_v0_num_chars": 639, "code_v1_num_chars": 874, "code_v0_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nL = {el: 1 for el in [a, b, c, d, e, 0]}\nfor i in range(6):\n R = sorted(L.items(), key=lambda x: x[1])\n for p, l in R:\n if l < 16:\n L[p ^ e] = min(L.get(p ^ e, 16), l + 1)\n if l + 3 < 16:\n for q, r in R:\n if l + r + 3 <= 16:\n L[p & q] = min(L.get(p & q, 16), l + r + 3)\n L[p ^ q] = min(L.get(p ^ q, 16), l + r + 3)\n else:\n break\n else:\n break\nprint(\n *(\n L[e & eval(s)]\n for s in open(0)\n .read()\n .replace(*\"-~\")\n .replace(*\"*&\")\n .replace(*\"1e\")\n .split()[:-1]\n ),\n sep=\"\\n\"\n)\n", "code_v1_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\nQ = [(1, el) for el in base]\nL = {el: 1 for el in base}\nH = []\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < L.get(p ^ e, 17):\n L[p ^ e] = l + 1\n if l + 1 < 16:\n heappush(Q, (l + 1, p ^ e))\n if l + 3 < 16:\n for q, r in H:\n if l + r + 3 <= 16:\n if l + r + 3 < L.get(p & q, 17):\n L[p & q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p & q))\n if l + r + 3 < L.get(p ^ q, 17):\n L[p ^ q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p ^ q))\n else:\n break\n if l < 7:\n H.append((p, l))\nprint(\n *(\n L[e & eval(s)]\n for s in open(0)\n .read()\n .replace(*\"-~\")\n .replace(*\"*&\")\n .replace(*\"1e\")\n .split()[:-1]\n ),\n sep=\"\\n\"\n)\n", "code_same": false, "relative_loc_diff_percent": 37.5, "diff": ["-L = {el: 1 for el in [a, b, c, d, e, 0]}", "-for i in range(6):", "- R = sorted(L.items(), key=lambda x: x[1])", "- for p, l in R:", "- if l < 16:", "- L[p ^ e] = min(L.get(p ^ e, 16), l + 1)", "- if l + 3 < 16:", "- for q, r in R:", "- if l + r + 3 <= 16:", "- L[p & q] = min(L.get(p & q, 16), l + r + 3)", "- L[p ^ q] = min(L.get(p ^ q, 16), l + r + 3)", "- else:", "- break", "- else:", "- break", "+from heapq import heappush, heappop", "+", "+base = [a, b, c, d, e, 0]", "+Q = [(1, el) for el in base]", "+L = {el: 1 for el in base}", "+H = []", "+while Q:", "+ l, p = heappop(Q)", "+ if L[p] < l:", "+ continue", "+ if l + 1 < L.get(p ^ e, 17):", "+ L[p ^ e] = l + 1", "+ if l + 1 < 16:", "+ heappush(Q, (l + 1, p ^ e))", "+ if l + 3 < 16:", "+ for q, r in H:", "+ if l + r + 3 <= 16:", "+ if l + r + 3 < L.get(p & q, 17):", "+ L[p & q] = l + r + 3", "+ if l + r + 3 < 16:", "+ heappush(Q, (l + r + 3, p & q))", "+ if l + r + 3 < L.get(p ^ q, 17):", "+ L[p ^ q] = l + r + 3", "+ if l + r + 3 < 16:", "+ heappush(Q, (l + r + 3, p ^ q))", "+ else:", "+ break", "+ if l < 7:", "+ H.append((p, l))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.012686343, "measured_runtime_v1": 0.2560091887, "runtime_lift": 3.9556640457, "key": ["s457180384", "s699385465"]} +{"user_id": "u775681539", "problem_id": "p02792", "language": "python", "submission_id_v0": "s313172456", "submission_id_v1": "s731114638", "cpu_time_v0": 533, "cpu_time_v1": 247, "memory_v0": 3444, "memory_v1": 40556, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 53.66, "input": "#python3\n\nfrom collections import defaultdict\n\nfrom collections import namedtuple\n\n\n\nP = namedtuple('P', ['front', 'end'])\n\n\n\ndef f(x):\n\n return P(str(x)[0], str(x)[-1]) \n\n\n\ndef main():\n\n\n\n n = int(input())\n\n freq = defaultdict(int)\n\n\n\n for i in range(1, n+1):\n\n p = f(i)\n\n freq[p]+=1\n\n\n\n\n\n ans = 0\n\n for i in range(1, n + 1):\n\n p = f(i)\n\n q = (p.end, p.front)\n\n ans += freq[q]\n\n\n\n print(ans)\n\n\n\nmain()", "target": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom collections import defaultdict\n\n\n\ndef f(x):\n\n return (int(str(x)[0]), int(str(x)[-1])) \n\ndef main():\n\n N = int(readline())\n\n df = defaultdict(int)\n\n for i in range(1, N+1):\n\n df[f(i)] += 1\n\n ans = 0\n\n for i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += df[(i, j)]*df[(j, i)]\n\n print(ans)\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 28, "code_v1_loc": 21, "code_v0_num_chars": 458, "code_v1_num_chars": 507, "code_v0_no_empty_lines": "# python3\nfrom collections import defaultdict\nfrom collections import namedtuple\n\nP = namedtuple(\"P\", [\"front\", \"end\"])\n\n\ndef f(x):\n return P(str(x)[0], str(x)[-1])\n\n\ndef main():\n n = int(input())\n freq = defaultdict(int)\n for i in range(1, n + 1):\n p = f(i)\n freq[p] += 1\n ans = 0\n for i in range(1, n + 1):\n p = f(i)\n q = (p.end, p.front)\n ans += freq[q]\n print(ans)\n\n\nmain()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom collections import defaultdict\n\n\ndef f(x):\n return (int(str(x)[0]), int(str(x)[-1]))\n\n\ndef main():\n N = int(readline())\n df = defaultdict(int)\n for i in range(1, N + 1):\n df[f(i)] += 1\n ans = 0\n for i in range(1, 10):\n for j in range(1, 10):\n ans += df[(i, j)] * df[(j, i)]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-# python3", "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "-from collections import namedtuple", "-", "-P = namedtuple(\"P\", [\"front\", \"end\"])", "- return P(str(x)[0], str(x)[-1])", "+ return (int(str(x)[0]), int(str(x)[-1]))", "- n = int(input())", "- freq = defaultdict(int)", "- for i in range(1, n + 1):", "- p = f(i)", "- freq[p] += 1", "+ N = int(readline())", "+ df = defaultdict(int)", "+ for i in range(1, N + 1):", "+ df[f(i)] += 1", "- for i in range(1, n + 1):", "- p = f(i)", "- q = (p.end, p.front)", "- ans += freq[q]", "+ for i in range(1, 10):", "+ for j in range(1, 10):", "+ ans += df[(i, j)] * df[(j, i)]", "-main()", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4672443939, "measured_runtime_v1": 0.3355342689, "runtime_lift": 1.3925385189, "key": ["s313172456", "s731114638"]} +{"user_id": "u893063840", "problem_id": "p03038", "language": "python", "submission_id_v0": "s696312664", "submission_id_v1": "s914180377", "cpu_time_v0": 588, "cpu_time_v1": 493, "memory_v0": 32888, "memory_v1": 36036, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.16, "input": "n, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(key=lambda x: x[1], reverse=True)\n\na.sort()\n\n\n\ni = 0\n\nfor b, c in bc:\n\n for _ in range(b):\n\n if i < n and a[i] < c:\n\n a[i] = c\n\n i += 1\n\n else:\n\n break\n\n\n\nans = sum(a)\n\nprint(ans)\n", "target": "n, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(reverse=True, key=lambda x: x[1])\n\n\n\nli = []\n\nl = 0\n\ni = 0\n\nwhile i < m and l < n:\n\n b, c = bc[i]\n\n li += [c] * b\n\n i += 1\n\n l += b\n\n\n\na += li\n\na.sort(reverse=True)\n\nans = sum(a[:n])\n\nprint(ans)\n", "code_v0_loc": 18, "code_v1_loc": 19, "code_v0_num_chars": 369, "code_v1_num_chars": 346, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = [list(map(int, input().split())) for _ in range(m)]\nbc.sort(key=lambda x: x[1], reverse=True)\na.sort()\ni = 0\nfor b, c in bc:\n for _ in range(b):\n if i < n and a[i] < c:\n a[i] = c\n i += 1\n else:\n break\nans = sum(a)\nprint(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = [list(map(int, input().split())) for _ in range(m)]\nbc.sort(reverse=True, key=lambda x: x[1])\nli = []\nl = 0\ni = 0\nwhile i < m and l < n:\n b, c = bc[i]\n li += [c] * b\n i += 1\n l += b\na += li\na.sort(reverse=True)\nans = sum(a[:n])\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 5.2631578947, "diff": ["-bc.sort(key=lambda x: x[1], reverse=True)", "-a.sort()", "+bc.sort(reverse=True, key=lambda x: x[1])", "+li = []", "+l = 0", "-for b, c in bc:", "- for _ in range(b):", "- if i < n and a[i] < c:", "- a[i] = c", "- i += 1", "- else:", "- break", "-ans = sum(a)", "+while i < m and l < n:", "+ b, c = bc[i]", "+ li += [c] * b", "+ i += 1", "+ l += b", "+a += li", "+a.sort(reverse=True)", "+ans = sum(a[:n])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2346956289, "measured_runtime_v1": 0.006594183, "runtime_lift": 35.5913127767, "key": ["s696312664", "s914180377"]} +{"user_id": "u078042885", "problem_id": "p01138", "language": "python", "submission_id_v0": "s367659771", "submission_id_v1": "s546819347", "cpu_time_v0": 8280, "cpu_time_v1": 5620, "memory_v0": 11712, "memory_v1": 11664, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.13, "input": "def f(s):\n\n s=list(map(int,s.split(':')))\n\n return (s[0]*60+s[1])*60+s[2]\n\na=86401\n\nwhile 1:\n\n t=[0]*a\n\n n=int(input())\n\n if n==0:break\n\n for _ in range(n):\n\n b,c=input().split()\n\n t[f(b)]+=1;t[f(c)]-=1\n\n d=0\n\n for i in range(1,a):\n\n t[i]+=t[i-1]\n\n d=max(d,t[i])\n\n print(d)", "target": "def f(s):\n\n return (s[0]*60+s[1])*60+s[2]\n\na=86400\n\nwhile 1:\n\n t=[0]*a\n\n n=int(input())\n\n if n==0:break\n\n for _ in range(n):\n\n b,c = [list(map(int,x.split(':'))) for x in input().split()]\n\n t[f(b)]+=1;t[f(c)]-=1\n\n d=0\n\n for i in range(1,a):\n\n t[i]+=t[i-1]\n\n if d dp[j] + a:\n\n dp[j | key] = dp[j] + a\n\n\n\nif dp[-1] == INF:\n\n print((-1))\n\nelse:\n\n print((dp[-1]))", "code_v0_loc": 25, "code_v1_loc": 26, "code_v0_num_chars": 505, "code_v1_num_chars": 522, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nN, M = list(map(int, readline().split()))\nINF = 10**10\ndp = [INF] * (2**N)\ndp[0] = 0\nfor i in range(M):\n a, b = list(map(int, readline().split()))\n c = list(map(int, readline().split()))\n key = 0\n for j in range(len(c)):\n key += 1 << (c[j] - 1)\n for j in range(len(dp)):\n if dp[j] == INF:\n continue\n if j | key == j:\n continue\n dp[j | key] = min(dp[j | key], dp[j] + a)\nif dp[-1] == INF:\n print((-1))\nelse:\n print((dp[-1]))\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nN, M = list(map(int, readline().split()))\nINF = 10**10\ndp = [INF] * (2**N)\ndp[0] = 0\nfor i in range(M):\n a, b = list(map(int, readline().split()))\n c = list(map(int, readline().split()))\n key = 0\n for j in range(len(c)):\n key += 1 << (c[j] - 1)\n for j in range(len(dp)):\n if dp[j] == INF:\n continue\n if j | key == j:\n continue\n if dp[j | key] > dp[j] + a:\n dp[j | key] = dp[j] + a\nif dp[-1] == INF:\n print((-1))\nelse:\n print((dp[-1]))\n", "code_same": false, "relative_loc_diff_percent": 3.8461538462, "diff": ["- dp[j | key] = min(dp[j | key], dp[j] + a)", "+ if dp[j | key] > dp[j] + a:", "+ dp[j | key] = dp[j] + a"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2747366824, "measured_runtime_v1": 0.0058527424, "runtime_lift": 46.941529559, "key": ["s462370890", "s446448975"]} +{"user_id": "u837673618", "problem_id": "p02721", "language": "python", "submission_id_v0": "s949081681", "submission_id_v1": "s434725940", "cpu_time_v0": 326, "cpu_time_v1": 177, "memory_v0": 12688, "memory_v1": 12576, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.71, "input": "N, K, C = list(map(int, input().split()))\n\nS = input()\n\n\n\nlatest = [None]*K\n\ni = len(S)+C\n\nfor j in range(K-1, -1, -1):\n\n i = S.rindex(\"o\", 0, i-C)\n\n latest[j] = i\n\n\n\nif i<=C or \"o\" not in S[:i-C]:\n\n i = -C-1\n\n for j in latest:\n\n i = S.index(\"o\", i+C+1)\n\n if i == j:\n\n print((i+1))\n", "target": "def solve():\n\n N, K, C = list(map(int, input().split()))\n\n workable = [i for i, s in enumerate(input()) if s==\"o\"]\n\n if len(workable) == K:\n\n return workable\n\n \n\n prev = workable[-1]\n\n latest = {prev}\n\n i = len(workable)-1\n\n while i > 0:\n\n i -= 1\n\n if prev - workable[i] > C:\n\n latest.add(workable[i])\n\n prev = workable[i]\n\n if len(latest) > K:\n\n return []\n\n must = []\n\n i = -1\n\n prev = -C-1\n\n while i < len(workable)-1:\n\n i += 1\n\n if workable[i] - prev > C:\n\n if workable[i] in latest:\n\n must.append(workable[i])\n\n prev = workable[i]\n\n return must\n\n\n\nfor i in solve():\n\n print((i+1))", "code_v0_loc": 15, "code_v1_loc": 29, "code_v0_num_chars": 289, "code_v1_num_chars": 646, "code_v0_no_empty_lines": "N, K, C = list(map(int, input().split()))\nS = input()\nlatest = [None] * K\ni = len(S) + C\nfor j in range(K - 1, -1, -1):\n i = S.rindex(\"o\", 0, i - C)\n latest[j] = i\nif i <= C or \"o\" not in S[: i - C]:\n i = -C - 1\n for j in latest:\n i = S.index(\"o\", i + C + 1)\n if i == j:\n print((i + 1))\n", "code_v1_no_empty_lines": "def solve():\n N, K, C = list(map(int, input().split()))\n workable = [i for i, s in enumerate(input()) if s == \"o\"]\n if len(workable) == K:\n return workable\n prev = workable[-1]\n latest = {prev}\n i = len(workable) - 1\n while i > 0:\n i -= 1\n if prev - workable[i] > C:\n latest.add(workable[i])\n prev = workable[i]\n if len(latest) > K:\n return []\n must = []\n i = -1\n prev = -C - 1\n while i < len(workable) - 1:\n i += 1\n if workable[i] - prev > C:\n if workable[i] in latest:\n must.append(workable[i])\n prev = workable[i]\n return must\n\n\nfor i in solve():\n print((i + 1))\n", "code_same": false, "relative_loc_diff_percent": 48.275862069, "diff": ["-N, K, C = list(map(int, input().split()))", "-S = input()", "-latest = [None] * K", "-i = len(S) + C", "-for j in range(K - 1, -1, -1):", "- i = S.rindex(\"o\", 0, i - C)", "- latest[j] = i", "-if i <= C or \"o\" not in S[: i - C]:", "- i = -C - 1", "- for j in latest:", "- i = S.index(\"o\", i + C + 1)", "- if i == j:", "- print((i + 1))", "+def solve():", "+ N, K, C = list(map(int, input().split()))", "+ workable = [i for i, s in enumerate(input()) if s == \"o\"]", "+ if len(workable) == K:", "+ return workable", "+ prev = workable[-1]", "+ latest = {prev}", "+ i = len(workable) - 1", "+ while i > 0:", "+ i -= 1", "+ if prev - workable[i] > C:", "+ latest.add(workable[i])", "+ prev = workable[i]", "+ if len(latest) > K:", "+ return []", "+ must = []", "+ i = -1", "+ prev = -C - 1", "+ while i < len(workable) - 1:", "+ i += 1", "+ if workable[i] - prev > C:", "+ if workable[i] in latest:", "+ must.append(workable[i])", "+ prev = workable[i]", "+ return must", "+", "+", "+for i in solve():", "+ print((i + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3840038183, "measured_runtime_v1": 0.2943901448, "runtime_lift": 1.3044044613, "key": ["s949081681", "s434725940"]} +{"user_id": "u628794221", "problem_id": "p02688", "language": "python", "submission_id_v0": "s048784054", "submission_id_v1": "s441243732", "cpu_time_v0": 24, "cpu_time_v1": 20, "memory_v0": 9192, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.67, "input": "N, K = list(map(int, input().split()))\n\nsunuke = [True]*N\n\nfor i in range(K):\n\n d = int(input())\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n sunuke[a-1] = False\n\n\n\nans = 0\n\nfor i in range(N):\n\n if sunuke[i]:\n\n ans += 1\n\nprint(ans)", "target": "N, K = list(map(int, input().split()))\n\nflag = [True]*N\n\nfor i in range(K):\n\n d = int(input())\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n flag[a-1] = False\n\nans = 0\n\nfor i in range(N):\n\n if flag[i]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 12, "code_v0_num_chars": 260, "code_v1_num_chars": 252, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nsunuke = [True] * N\nfor i in range(K):\n d = int(input())\n A = list(map(int, input().split()))\n for a in A:\n sunuke[a - 1] = False\nans = 0\nfor i in range(N):\n if sunuke[i]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nflag = [True] * N\nfor i in range(K):\n d = int(input())\n A = list(map(int, input().split()))\n for a in A:\n flag[a - 1] = False\nans = 0\nfor i in range(N):\n if flag[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["-sunuke = [True] * N", "+flag = [True] * N", "- sunuke[a - 1] = False", "+ flag[a - 1] = False", "- if sunuke[i]:", "+ if flag[i]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3757941551, "measured_runtime_v1": 0.2950303654, "runtime_lift": 1.2737473806, "key": ["s048784054", "s441243732"]} +{"user_id": "u057964173", "problem_id": "p03796", "language": "python", "submission_id_v0": "s018166938", "submission_id_v1": "s633160279", "cpu_time_v0": 298, "cpu_time_v1": 42, "memory_v0": 42992, "memory_v1": 28396, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.91, "input": "import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n import math\n\n n=int(input())\n\n print((math.factorial(n)%(10**9+7)))\n\nresolve()", "target": "import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n answer=1\n\n n=int(input())\n\n for i in range(1,n+1):\n\n answer*=i\n\n answer%=10**9+7\n\n print(answer)\n\nresolve()", "code_v0_loc": 8, "code_v1_loc": 11, "code_v0_num_chars": 166, "code_v1_num_chars": 214, "code_v0_no_empty_lines": "import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n import math\n\n n = int(input())\n print((math.factorial(n) % (10**9 + 7)))\n\n\nresolve()\n", "code_v1_no_empty_lines": "import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n answer = 1\n n = int(input())\n for i in range(1, n + 1):\n answer *= i\n answer %= 10**9 + 7\n print(answer)\n\n\nresolve()\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["- import math", "-", "+ answer = 1", "- print((math.factorial(n) % (10**9 + 7)))", "+ for i in range(1, n + 1):", "+ answer *= i", "+ answer %= 10**9 + 7", "+ print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5731575236, "measured_runtime_v1": 0.2333363581, "runtime_lift": 2.4563575447, "key": ["s018166938", "s633160279"]} +{"user_id": "u983918956", "problem_id": "p03416", "language": "python", "submission_id_v0": "s018952102", "submission_id_v1": "s778219351", "cpu_time_v0": 118, "cpu_time_v1": 60, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 49.15, "input": "A,B = list(map(int,input().split()))\n\nj = 0\n\nfor i in range(A,B+1):\n\n l = list(str(i))\n\n l_reverse = list(reversed(l))\n\n if l == l_reverse:\n\n j += 1\n\nprint(j)", "target": "A, B = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor n in range(A, B+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 158, "code_v1_num_chars": 135, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\nj = 0\nfor i in range(A, B + 1):\n l = list(str(i))\n l_reverse = list(reversed(l))\n if l == l_reverse:\n j += 1\nprint(j)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor n in range(A, B + 1):\n n = str(n)\n if n == n[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-j = 0", "-for i in range(A, B + 1):", "- l = list(str(i))", "- l_reverse = list(reversed(l))", "- if l == l_reverse:", "- j += 1", "-print(j)", "+ans = 0", "+for n in range(A, B + 1):", "+ n = str(n)", "+ if n == n[::-1]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4538340874, "measured_runtime_v1": 0.3384370139, "runtime_lift": 1.340970605, "key": ["s018952102", "s778219351"]} +{"user_id": "u811841526", "problem_id": "p02390", "language": "python", "submission_id_v0": "s941329471", "submission_id_v1": "s549187322", "cpu_time_v0": 40, "cpu_time_v1": 20, "memory_v0": 7664, "memory_v1": 5592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "s = int(input())\n\nm, s = s // 60, s % 60\n\nh, m = m // 60, m % 60\n\nprint((':'.join(map(str, [h,m,s]))))", "target": "s = int(input())\n\n\n\nsecond = s % 60\n\ns = s // 60\n\nmin = s % 60\n\nhour = s // 60\n\n\n\nprint(f'{hour}:{min}:{second}')\n", "code_v0_loc": 4, "code_v1_loc": 8, "code_v0_num_chars": 100, "code_v1_num_chars": 114, "code_v0_no_empty_lines": "s = int(input())\nm, s = s // 60, s % 60\nh, m = m // 60, m % 60\nprint((\":\".join(map(str, [h, m, s]))))\n", "code_v1_no_empty_lines": "s = int(input())\nsecond = s % 60\ns = s // 60\nmin = s % 60\nhour = s // 60\nprint(f\"{hour}:{min}:{second}\")\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-m, s = s // 60, s % 60", "-h, m = m // 60, m % 60", "-print((\":\".join(map(str, [h, m, s]))))", "+second = s % 60", "+s = s // 60", "+min = s % 60", "+hour = s // 60", "+print(f\"{hour}:{min}:{second}\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1672595444, "measured_runtime_v1": 0.0066597962, "runtime_lift": 25.1148140492, "key": ["s941329471", "s549187322"]} +{"user_id": "u488127128", "problem_id": "p03796", "language": "python", "submission_id_v0": "s848409194", "submission_id_v1": "s870468874", "cpu_time_v0": 231, "cpu_time_v1": 35, "memory_v0": 4020, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.85, "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "target": "import math\n\nN = int(input())\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 65, "code_v1_num_chars": 95, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\na = 1\nfor n in range(2, N + 1):\n a = a * n % (10**9 + 7)\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-print((math.factorial(N) % (10**9 + 7)))", "+a = 1", "+for n in range(2, N + 1):", "+ a = a * n % (10**9 + 7)", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8454835632, "measured_runtime_v1": 0.3383059211, "runtime_lift": 2.4991686828, "key": ["s848409194", "s870468874"]} +{"user_id": "u754022296", "problem_id": "p03819", "language": "python", "submission_id_v0": "s951638556", "submission_id_v1": "s089571448", "cpu_time_v0": 1762, "cpu_time_v1": 852, "memory_v0": 127784, "memory_v1": 82324, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 51.65, "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = map(int, input().split())\n\n LR = [list(map(int, input().split())) for _ in range(n)]\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n \n\n S = sorted([(r-l+1, l, r) for l, r in LR], reverse=True)\n\n cnt = n\n\n L = []\n\n for i in range(1, m+1):\n\n while S and S[-1][0] == i:\n\n c, l, r = S.pop()\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n L.append(res)\n\n print(*L, sep=\"\\n\")\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = list(map(int, input().split()))\n\n S = [[] for _ in range(m+1)]\n\n for _ in range(n):\n\n l, r = list(map(int, input().split()))\n\n S[r-l+1].append((l, r))\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n cnt = n\n\n for i in range(1, m+1):\n\n for l, r in S[i]:\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n print(res)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 36, "code_v1_loc": 34, "code_v0_num_chars": 731, "code_v1_num_chars": 658, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, m = map(int, input().split())\n LR = [list(map(int, input().split())) for _ in range(n)]\n BIT = [0] * (m + 2)\n\n def add(i, a):\n while i <= m + 1:\n BIT[i] += a\n i += i & (-i)\n\n def bit_sum(i):\n res = 0\n while i > 0:\n res += BIT[i]\n i -= i & (-i)\n return res\n\n S = sorted([(r - l + 1, l, r) for l, r in LR], reverse=True)\n cnt = n\n L = []\n for i in range(1, m + 1):\n while S and S[-1][0] == i:\n c, l, r = S.pop()\n cnt -= 1\n add(l, 1)\n add(r + 1, -1)\n res = cnt\n for j in range(0, m + 1, i):\n res += bit_sum(j)\n L.append(res)\n print(*L, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, m = list(map(int, input().split()))\n S = [[] for _ in range(m + 1)]\n for _ in range(n):\n l, r = list(map(int, input().split()))\n S[r - l + 1].append((l, r))\n BIT = [0] * (m + 2)\n\n def add(i, a):\n while i <= m + 1:\n BIT[i] += a\n i += i & (-i)\n\n def bit_sum(i):\n res = 0\n while i > 0:\n res += BIT[i]\n i -= i & (-i)\n return res\n\n cnt = n\n for i in range(1, m + 1):\n for l, r in S[i]:\n cnt -= 1\n add(l, 1)\n add(r + 1, -1)\n res = cnt\n for j in range(0, m + 1, i):\n res += bit_sum(j)\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 5.5555555556, "diff": ["- n, m = map(int, input().split())", "- LR = [list(map(int, input().split())) for _ in range(n)]", "+ n, m = list(map(int, input().split()))", "+ S = [[] for _ in range(m + 1)]", "+ for _ in range(n):", "+ l, r = list(map(int, input().split()))", "+ S[r - l + 1].append((l, r))", "- S = sorted([(r - l + 1, l, r) for l, r in LR], reverse=True)", "- L = []", "- while S and S[-1][0] == i:", "- c, l, r = S.pop()", "+ for l, r in S[i]:", "- L.append(res)", "- print(*L, sep=\"\\n\")", "+ print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3067650649, "measured_runtime_v1": 0.0989195189, "runtime_lift": 3.1011580763, "key": ["s951638556", "s089571448"]} +{"user_id": "u550574002", "problem_id": "p03126", "language": "python", "submission_id_v0": "s757696098", "submission_id_v1": "s038854174", "cpu_time_v0": 23, "cpu_time_v1": 19, "memory_v0": 3572, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.39, "input": "import functools\n\nprint((len(functools.reduce(lambda x, y: x&y,[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))", "target": "print((len(set.intersection(*[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 128, "code_v1_num_chars": 94, "code_v0_no_empty_lines": "import functools\n\nprint(\n (\n len(\n functools.reduce(\n lambda x, y: x & y,\n [set(input().split()[1:]) for _ in [0] * int(input().split()[0])],\n )\n )\n )\n)\n", "code_v1_no_empty_lines": "print(\n (\n len(\n set.intersection(\n *[set(input().split()[1:]) for _ in [0] * int(input().split()[0])]\n )\n )\n )\n)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import functools", "-", "- functools.reduce(", "- lambda x, y: x & y,", "- [set(input().split()[1:]) for _ in [0] * int(input().split()[0])],", "+ set.intersection(", "+ *[set(input().split()[1:]) for _ in [0] * int(input().split()[0])]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2541026509, "measured_runtime_v1": 0.0938221338, "runtime_lift": 2.7083444025, "key": ["s757696098", "s038854174"]} +{"user_id": "u046187684", "problem_id": "p03480", "language": "python", "submission_id_v0": "s964601714", "submission_id_v1": "s413566853", "cpu_time_v0": 40, "cpu_time_v1": 33, "memory_v0": 6244, "memory_v1": 6388, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.5, "input": "#!/usr/bin/env python3\n\n# coding=utf-8\n\n\n\nimport sys\n\n\n\ns = sys.stdin.readline().strip()\n\nl = [_s is \"1\" for _s in list(s)]\n\nl_r = l[::-1]\n\nindex = 0\n\nfor i, (c, n, c_r, n_r) in enumerate(\n\n zip(l[:len(s) // 2], l[1:len(s) // 2 + 1], l_r[:len(s) // 2], l_r[1:len(s) // 2 + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\nprint((len(s) - index))", "target": "def solve(string):\n\n l = [s == \"1\" for s in string]\n\n l_r = l[::-1]\n\n index = 0\n\n h = len(string) // 2\n\n for i, (c, n, c_r, n_r) in enumerate(zip(l[:h], l[1:h + 1], l_r[:h], l_r[1:h + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\n return str(len(string) - index)\n\n\n\n\n\nif __name__ == '__main__':\n\n print((solve(input())))\n", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 359, "code_v1_num_chars": 360, "code_v0_no_empty_lines": "#!/usr/bin/env python3\n# coding=utf-8\nimport sys\n\ns = sys.stdin.readline().strip()\nl = [_s is \"1\" for _s in list(s)]\nl_r = l[::-1]\nindex = 0\nfor i, (c, n, c_r, n_r) in enumerate(\n zip(\n l[: len(s) // 2],\n l[1 : len(s) // 2 + 1],\n l_r[: len(s) // 2],\n l_r[1 : len(s) // 2 + 1],\n )\n):\n if c ^ n or c_r ^ n_r:\n index = i + 1\nprint((len(s) - index))\n", "code_v1_no_empty_lines": "def solve(string):\n l = [s == \"1\" for s in string]\n l_r = l[::-1]\n index = 0\n h = len(string) // 2\n for i, (c, n, c_r, n_r) in enumerate(\n zip(l[:h], l[1 : h + 1], l_r[:h], l_r[1 : h + 1])\n ):\n if c ^ n or c_r ^ n_r:\n index = i + 1\n return str(len(string) - index)\n\n\nif __name__ == \"__main__\":\n print((solve(input())))\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-#!/usr/bin/env python3", "-# coding=utf-8", "-import sys", "+def solve(string):", "+ l = [s == \"1\" for s in string]", "+ l_r = l[::-1]", "+ index = 0", "+ h = len(string) // 2", "+ for i, (c, n, c_r, n_r) in enumerate(", "+ zip(l[:h], l[1 : h + 1], l_r[:h], l_r[1 : h + 1])", "+ ):", "+ if c ^ n or c_r ^ n_r:", "+ index = i + 1", "+ return str(len(string) - index)", "-s = sys.stdin.readline().strip()", "-l = [_s is \"1\" for _s in list(s)]", "-l_r = l[::-1]", "-index = 0", "-for i, (c, n, c_r, n_r) in enumerate(", "- zip(", "- l[: len(s) // 2],", "- l[1 : len(s) // 2 + 1],", "- l_r[: len(s) // 2],", "- l_r[1 : len(s) // 2 + 1],", "- )", "-):", "- if c ^ n or c_r ^ n_r:", "- index = i + 1", "-print((len(s) - index))", "+", "+if __name__ == \"__main__\":", "+ print((solve(input())))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3417459049, "measured_runtime_v1": 0.2085829885, "runtime_lift": 1.6384169551, "key": ["s964601714", "s413566853"]} +{"user_id": "u801359367", "problem_id": "p03325", "language": "python", "submission_id_v0": "s586527827", "submission_id_v1": "s564078636", "cpu_time_v0": 89, "cpu_time_v1": 80, "memory_v0": 4148, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.11, "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\n\n\nSUM = 0\n\nfor i in A:\n\n count = 0\n\n while i%2 == 0:\n\n i//=2\n\n count += 1\n\n SUM+=count\n\nprint(SUM)", "target": "N = int(input())\n\nA = list(map(int,input().split()))\n\nSUM = 0\n\nfor i in A:\n\n while i%2 == 0:\n\n i//=2\n\n SUM += 1\n\nprint(SUM)", "code_v0_loc": 11, "code_v1_loc": 8, "code_v0_num_chars": 175, "code_v1_num_chars": 140, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nSUM = 0\nfor i in A:\n count = 0\n while i % 2 == 0:\n i //= 2\n count += 1\n SUM += count\nprint(SUM)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nSUM = 0\nfor i in A:\n while i % 2 == 0:\n i //= 2\n SUM += 1\nprint(SUM)\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["- count = 0", "- count += 1", "- SUM += count", "+ SUM += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3107097435, "measured_runtime_v1": 0.2124449382, "runtime_lift": 1.4625424646, "key": ["s586527827", "s564078636"]} +{"user_id": "u253681061", "problem_id": "p03796", "language": "python", "submission_id_v0": "s618901729", "submission_id_v1": "s057938516", "cpu_time_v0": 49, "cpu_time_v1": 34, "memory_v0": 6900, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.61, "input": "n = int(input())\n\n\n\nINF = 10**9 + 7\n\n\n\nans = [0] * (10**5 + 1)\n\nans[0] = 1\n\n\n\nfor i in range(1,10**5 + 1):\n\n ans[i] = ans[i-1] * i % INF\n\n\n\nprint((ans[n]))\n", "target": "n = int(input())\n\nmod = 10**9 + 7\n\n\n\nans = 1\n\n\n\nfor i in range(1,n+1):\n\n ans = ans * i % mod\n\n\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 9, "code_v0_num_chars": 157, "code_v1_num_chars": 109, "code_v0_no_empty_lines": "n = int(input())\nINF = 10**9 + 7\nans = [0] * (10**5 + 1)\nans[0] = 1\nfor i in range(1, 10**5 + 1):\n ans[i] = ans[i - 1] * i % INF\nprint((ans[n]))\n", "code_v1_no_empty_lines": "n = int(input())\nmod = 10**9 + 7\nans = 1\nfor i in range(1, n + 1):\n ans = ans * i % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-INF = 10**9 + 7", "-ans = [0] * (10**5 + 1)", "-ans[0] = 1", "-for i in range(1, 10**5 + 1):", "- ans[i] = ans[i - 1] * i % INF", "-print((ans[n]))", "+mod = 10**9 + 7", "+ans = 1", "+for i in range(1, n + 1):", "+ ans = ans * i % mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8708683834, "measured_runtime_v1": 0.4576160941, "runtime_lift": 1.9030545354, "key": ["s618901729", "s057938516"]} +{"user_id": "u813450984", "problem_id": "p03371", "language": "python", "submission_id_v0": "s722861535", "submission_id_v1": "s015018251", "cpu_time_v0": 77, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 77.92, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nm = max(x, y)\n\nfor i in range(1, m+1):\n\n x -= 1\n\n y -= 1\n\n if x < 0:\n\n x = 0\n\n if y < 0:\n\n y = 0\n\n temp = c*(i*2) + x*a + y*b\n\n if temp < ans:\n\n ans = temp\n\n\n\nprint(ans)\n", "target": "a, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nans = min(c * max(x, y) * 2, ans)\n\nif x < y:\n\n ans = min(c * x * 2 + (y - x) * b, ans)\n\nelse:\n\n ans = min(c * y * 2 + (x - y) * a, ans)\n\n\n\nprint(ans)", "code_v0_loc": 15, "code_v1_loc": 9, "code_v0_num_chars": 249, "code_v1_num_chars": 219, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nm = max(x, y)\nfor i in range(1, m + 1):\n x -= 1\n y -= 1\n if x < 0:\n x = 0\n if y < 0:\n y = 0\n temp = c * (i * 2) + x * a + y * b\n if temp < ans:\n ans = temp\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nans = min(c * max(x, y) * 2, ans)\nif x < y:\n ans = min(c * x * 2 + (y - x) * b, ans)\nelse:\n ans = min(c * y * 2 + (x - y) * a, ans)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-m = max(x, y)", "-for i in range(1, m + 1):", "- x -= 1", "- y -= 1", "- if x < 0:", "- x = 0", "- if y < 0:", "- y = 0", "- temp = c * (i * 2) + x * a + y * b", "- if temp < ans:", "- ans = temp", "+ans = min(c * max(x, y) * 2, ans)", "+if x < y:", "+ ans = min(c * x * 2 + (y - x) * b, ans)", "+else:", "+ ans = min(c * y * 2 + (x - y) * a, ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2966257923, "measured_runtime_v1": 0.2002350025, "runtime_lift": 1.4813883113, "key": ["s722861535", "s015018251"]} +{"user_id": "u989345508", "problem_id": "p03798", "language": "python", "submission_id_v0": "s244589711", "submission_id_v1": "s160001244", "cpu_time_v0": 1408, "cpu_time_v1": 1267, "memory_v0": 3892, "memory_v1": 3880, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.01, "input": "n=int(input())\n\ns=input()\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\n\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n #print(x[i])\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n", "target": "n=int(input())\n\ns=input()\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\na=[\"S\",\"W\"]\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n x[i]+=a[x[i][j]!=\"S\"]\n\n else:\n\n x[i]+=a[x[i][j]==\"S\"]\n\n else:\n\n if s[j+1]==\"o\":\n\n x[i]+=a[x[i][j]==\"S\"]\n\n else:\n\n x[i]+=a[x[i][j]!=\"S\"]\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n", "code_v0_loc": 82, "code_v1_loc": 69, "code_v0_num_chars": 2079, "code_v1_num_chars": 1752, "code_v0_no_empty_lines": "n = int(input())\ns = input()\nx = [\"SS\", \"SW\", \"WS\", \"WW\"]\n\n\ndef check0(i):\n if x[i][0] == \"S\":\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n\n\ndef check1(i):\n if x[i][n - 1] == \"S\":\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n\n\nfor i in range(4):\n for j in range(n - 2):\n if x[i][j + 1] == \"S\":\n if s[j + 1] == \"o\":\n if x[i][j] == \"S\":\n x[i] += \"S\"\n else:\n x[i] += \"W\"\n else:\n if x[i][j] == \"S\":\n x[i] += \"W\"\n else:\n x[i] += \"S\"\n else:\n if s[j + 1] == \"o\":\n if x[i][j] == \"S\":\n x[i] += \"W\"\n else:\n x[i] += \"S\"\n else:\n if x[i][j] == \"S\":\n x[i] += \"S\"\n else:\n x[i] += \"W\"\n # print(x[i])\n if check0(i) and check1(i):\n print((x[i]))\n break\nelse:\n print((-1))\n", "code_v1_no_empty_lines": "n = int(input())\ns = input()\nx = [\"SS\", \"SW\", \"WS\", \"WW\"]\n\n\ndef check0(i):\n if x[i][0] == \"S\":\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n\n\ndef check1(i):\n if x[i][n - 1] == \"S\":\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n\n\na = [\"S\", \"W\"]\nfor i in range(4):\n for j in range(n - 2):\n if x[i][j + 1] == \"S\":\n if s[j + 1] == \"o\":\n x[i] += a[x[i][j] != \"S\"]\n else:\n x[i] += a[x[i][j] == \"S\"]\n else:\n if s[j + 1] == \"o\":\n x[i] += a[x[i][j] == \"S\"]\n else:\n x[i] += a[x[i][j] != \"S\"]\n if check0(i) and check1(i):\n print((x[i]))\n break\nelse:\n print((-1))\n", "code_same": false, "relative_loc_diff_percent": 15.8536585366, "diff": ["+a = [\"S\", \"W\"]", "- if x[i][j] == \"S\":", "- x[i] += \"S\"", "- else:", "- x[i] += \"W\"", "+ x[i] += a[x[i][j] != \"S\"]", "- if x[i][j] == \"S\":", "- x[i] += \"W\"", "- else:", "- x[i] += \"S\"", "+ x[i] += a[x[i][j] == \"S\"]", "- if x[i][j] == \"S\":", "- x[i] += \"W\"", "- else:", "- x[i] += \"S\"", "+ x[i] += a[x[i][j] == \"S\"]", "- if x[i][j] == \"S\":", "- x[i] += \"S\"", "- else:", "- x[i] += \"W\"", "- # print(x[i])", "+ x[i] += a[x[i][j] != \"S\"]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.206637172, "measured_runtime_v1": 0.0056119666, "runtime_lift": 36.8208127342, "key": ["s244589711", "s160001244"]} +{"user_id": "u318414416", "problem_id": "p03162", "language": "python", "submission_id_v0": "s337419843", "submission_id_v1": "s763303888", "cpu_time_v0": 672, "cpu_time_v1": 308, "memory_v0": 47336, "memory_v1": 30580, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.17, "input": "# coding: utf-8\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [[0] * 3 for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n for j in range(3):\n\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] \\\n\n for k in range(3) if k != j)\n\n return(max(dp[n]))\n\n\n\nn = int(input()) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n", "target": "# coding: utf-8\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [0] * 3\n\n for i in range(1, n + 1):\n\n a, b, c = abc[i - 1]\n\n dp = [ max(dp[1] + a, dp[2] + a), \\\n\n max(dp[0] + b, dp[2] + b), \\\n\n max(dp[0] + c, dp[1] + c) ]\n\n return(max(dp))\n\n\n\nn = int(input()) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n", "code_v0_loc": 17, "code_v1_loc": 17, "code_v0_num_chars": 434, "code_v1_num_chars": 436, "code_v0_no_empty_lines": "# coding: utf-8\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef f(n, abc):\n dp = [[0] * 3 for _ in range(n + 1)]\n for i in range(1, n + 1):\n for j in range(3):\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)\n return max(dp[n])\n\n\nn = int(input()) # 1 <= n <= 10^5\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\nprint((f(n, abc)))\n", "code_v1_no_empty_lines": "# coding: utf-8\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef f(n, abc):\n dp = [0] * 3\n for i in range(1, n + 1):\n a, b, c = abc[i - 1]\n dp = [\n max(dp[1] + a, dp[2] + a),\n max(dp[0] + b, dp[2] + b),\n max(dp[0] + c, dp[1] + c),\n ]\n return max(dp)\n\n\nn = int(input()) # 1 <= n <= 10^5\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\nprint((f(n, abc)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- dp = [[0] * 3 for _ in range(n + 1)]", "+ dp = [0] * 3", "- for j in range(3):", "- dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)", "- return max(dp[n])", "+ a, b, c = abc[i - 1]", "+ dp = [", "+ max(dp[1] + a, dp[2] + a),", "+ max(dp[0] + b, dp[2] + b),", "+ max(dp[0] + c, dp[1] + c),", "+ ]", "+ return max(dp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2527067475, "measured_runtime_v1": 0.1473037755, "runtime_lift": 1.7155483393, "key": ["s337419843", "s763303888"]} +{"user_id": "u945199633", "problem_id": "p02595", "language": "python", "submission_id_v0": "s028374925", "submission_id_v1": "s480019615", "cpu_time_v0": 580, "cpu_time_v1": 443, "memory_v0": 45308, "memory_v1": 9156, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.62, "input": "N, D = list(map(int, input().split()))\n\npoint = []\n\nfor i in range(N):\n\n point.append(list(map(int, input().split())))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in point:\n\n if (i[0]**2 + i[1]**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)", "target": "N, D = list(map(int, input().split()))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in range(N):\n\n X, Y = list(map(int, input().split()))\n\n if (X**2 + Y**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)", "code_v0_loc": 12, "code_v1_loc": 10, "code_v0_num_chars": 219, "code_v1_num_chars": 171, "code_v0_no_empty_lines": "N, D = list(map(int, input().split()))\npoint = []\nfor i in range(N):\n point.append(list(map(int, input().split())))\nct = 0\nD2 = D * D\nfor i in point:\n if (i[0] ** 2 + i[1] ** 2) <= D2:\n ct += 1\nprint(ct)\n", "code_v1_no_empty_lines": "N, D = list(map(int, input().split()))\nct = 0\nD2 = D * D\nfor i in range(N):\n X, Y = list(map(int, input().split()))\n if (X**2 + Y**2) <= D2:\n ct += 1\nprint(ct)\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-point = []", "-for i in range(N):", "- point.append(list(map(int, input().split())))", "-for i in point:", "- if (i[0] ** 2 + i[1] ** 2) <= D2:", "+for i in range(N):", "+ X, Y = list(map(int, input().split()))", "+ if (X**2 + Y**2) <= D2:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.399467237, "measured_runtime_v1": 0.2084539161, "runtime_lift": 1.9163335691, "key": ["s028374925", "s480019615"]} +{"user_id": "u624689667", "problem_id": "p03796", "language": "python", "submission_id_v0": "s800016333", "submission_id_v1": "s112879561", "cpu_time_v0": 271, "cpu_time_v1": 164, "memory_v0": 42736, "memory_v1": 38512, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.48, "input": "from math import factorial\n\n\n\nmod = 10**9 + 7\n\nn = int(input())\n\n\n\nans = factorial(n) % mod\n\nprint(ans)", "target": "N = int(input())\n\nMOD = 10**9 + 7\n\nans = 1\n\nfor i in range(2, N+1):\n\n ans *= i\n\n ans %= MOD\n\nprint(ans)\n", "code_v0_loc": 7, "code_v1_loc": 7, "code_v0_num_chars": 103, "code_v1_num_chars": 110, "code_v0_no_empty_lines": "from math import factorial\n\nmod = 10**9 + 7\nn = int(input())\nans = factorial(n) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nMOD = 10**9 + 7\nans = 1\nfor i in range(2, N + 1):\n ans *= i\n ans %= MOD\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-from math import factorial", "-", "-mod = 10**9 + 7", "-n = int(input())", "-ans = factorial(n) % mod", "+N = int(input())", "+MOD = 10**9 + 7", "+ans = 1", "+for i in range(2, N + 1):", "+ ans *= i", "+ ans %= MOD"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5071064572, "measured_runtime_v1": 0.006458343, "runtime_lift": 78.5195915066, "key": ["s800016333", "s112879561"]} +{"user_id": "u816872429", "problem_id": "p03078", "language": "python", "submission_id_v0": "s052587697", "submission_id_v1": "s157699880", "cpu_time_v0": 41, "cpu_time_v1": 28, "memory_v0": 4096, "memory_v1": 4460, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 31.71, "input": "import heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\ndef diff(l):\n\n m = max(l)\n\n return sorted(m - v for v in l)[1:]\n\n\n\ns = sum(map(max, [a, b, c]))\n\nsa, sb, sc = list(map(diff, [a, b, c]))\n\nda, db, dc = [0], [0], [0]\n\nq = [0]\n\nwhile k > 0:\n\n while True:\n\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n\n heapq.heappush(q, v)\n\n da.append(sa[0])\n\n sa = sa[1:]\n\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n\n heapq.heappush(q, v)\n\n db.append(sb[0])\n\n sb = sb[1:]\n\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n\n heapq.heappush(q, v)\n\n dc.append(sc[0])\n\n sc = sc[1:]\n\n else:\n\n break\n\n v = heapq.heappop(q)\n\n print(s - v)\n\n k -= 1\n", "target": "import heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = sorted(map(int, input().split()))\n\nb = sorted(map(int, input().split()))\n\nc = sorted(map(int, input().split()))\n\n\n\nq = []\n\nmemo = set()\n\ndef qpush(q, ai, bi, ci):\n\n t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)\n\n if not t in memo:\n\n memo.add(t)\n\n heapq.heappush(q, t)\n\n\n\nqpush(q, len(a) - 1, len(b) - 1, len(c) - 1)\n\nfor _ in range(k):\n\n s, ai, bi, ci = heapq.heappop(q)\n\n if ai > 0:\n\n qpush(q, ai - 1, bi, ci)\n\n if bi > 0:\n\n qpush(q, ai, bi - 1, ci)\n\n if ci > 0:\n\n qpush(q, ai, bi, ci - 1)\n\n print(-s)\n", "code_v0_loc": 37, "code_v1_loc": 25, "code_v0_num_chars": 1122, "code_v1_num_chars": 631, "code_v0_no_empty_lines": "import heapq\n\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\n\ndef diff(l):\n m = max(l)\n return sorted(m - v for v in l)[1:]\n\n\ns = sum(map(max, [a, b, c]))\nsa, sb, sc = list(map(diff, [a, b, c]))\nda, db, dc = [0], [0], [0]\nq = [0]\nwhile k > 0:\n while True:\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n heapq.heappush(q, v)\n da.append(sa[0])\n sa = sa[1:]\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n heapq.heappush(q, v)\n db.append(sb[0])\n sb = sb[1:]\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n heapq.heappush(q, v)\n dc.append(sc[0])\n sc = sc[1:]\n else:\n break\n v = heapq.heappop(q)\n print(s - v)\n k -= 1\n", "code_v1_no_empty_lines": "import heapq\n\nx, y, z, k = list(map(int, input().split()))\na = sorted(map(int, input().split()))\nb = sorted(map(int, input().split()))\nc = sorted(map(int, input().split()))\nq = []\nmemo = set()\n\n\ndef qpush(q, ai, bi, ci):\n t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)\n if not t in memo:\n memo.add(t)\n heapq.heappush(q, t)\n\n\nqpush(q, len(a) - 1, len(b) - 1, len(c) - 1)\nfor _ in range(k):\n s, ai, bi, ci = heapq.heappop(q)\n if ai > 0:\n qpush(q, ai - 1, bi, ci)\n if bi > 0:\n qpush(q, ai, bi - 1, ci)\n if ci > 0:\n qpush(q, ai, bi, ci - 1)\n print(-s)\n", "code_same": false, "relative_loc_diff_percent": 32.4324324324, "diff": ["-a = list(map(int, input().split()))", "-b = list(map(int, input().split()))", "-c = list(map(int, input().split()))", "+a = sorted(map(int, input().split()))", "+b = sorted(map(int, input().split()))", "+c = sorted(map(int, input().split()))", "+q = []", "+memo = set()", "-def diff(l):", "- m = max(l)", "- return sorted(m - v for v in l)[1:]", "+def qpush(q, ai, bi, ci):", "+ t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)", "+ if not t in memo:", "+ memo.add(t)", "+ heapq.heappush(q, t)", "-s = sum(map(max, [a, b, c]))", "-sa, sb, sc = list(map(diff, [a, b, c]))", "-da, db, dc = [0], [0], [0]", "-q = [0]", "-while k > 0:", "- while True:", "- if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):", "- for v in [sa[0] + bb + cc for bb in db for cc in dc]:", "- heapq.heappush(q, v)", "- da.append(sa[0])", "- sa = sa[1:]", "- elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):", "- for v in [sb[0] + aa + cc for aa in da for cc in dc]:", "- heapq.heappush(q, v)", "- db.append(sb[0])", "- sb = sb[1:]", "- elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):", "- for v in [sc[0] + aa + bb for aa in da for bb in db]:", "- heapq.heappush(q, v)", "- dc.append(sc[0])", "- sc = sc[1:]", "- else:", "- break", "- v = heapq.heappop(q)", "- print(s - v)", "- k -= 1", "+qpush(q, len(a) - 1, len(b) - 1, len(c) - 1)", "+for _ in range(k):", "+ s, ai, bi, ci = heapq.heappop(q)", "+ if ai > 0:", "+ qpush(q, ai - 1, bi, ci)", "+ if bi > 0:", "+ qpush(q, ai, bi - 1, ci)", "+ if ci > 0:", "+ qpush(q, ai, bi, ci - 1)", "+ print(-s)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2304672, "measured_runtime_v1": 0.0062596636, "runtime_lift": 36.8178252168, "key": ["s052587697", "s157699880"]} +{"user_id": "u924691798", "problem_id": "p02837", "language": "python", "submission_id_v0": "s473277676", "submission_id_v1": "s669766257", "cpu_time_v0": 175, "cpu_time_v1": 139, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.57, "input": "N = int(input())\n\nA = [0]*N\n\nX = []\n\nY = []\n\nfor i in range(N):\n\n A[i] = int(input())\n\n X.append([])\n\n Y.append([])\n\n for j in range(A[i]):\n\n x, y = list(map(int, input().split()))\n\n X[i].append(x-1)\n\n Y[i].append(y)\n\nans = 0\n\nfor bit in range(1<= k:\n\n print(a)\n\n exit()\n\n\n", "target": "n,k = list(map(int,input().split()))\n\ncnt = 0\n\nnum = []\n\nfor i in range(n):\n\n a,b = list(map(int,input().split()))\n\n num.append((a,b))\n\nnum.sort()\n\nfor i in range(n):\n\n cnt += num[i][1]\n\n if cnt >= k:\n\n print((num[i][0]))\n\n exit()", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 252, "code_v1_num_chars": 242, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\nnum = 0\nq = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n q.append((a, b))\nq.sort()\nfor i in range(n):\n a, b = q[i][0], q[i][1]\n num += b\n if num >= k:\n print(a)\n exit()\n", "code_v1_no_empty_lines": "n, k = list(map(int, input().split()))\ncnt = 0\nnum = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n num.append((a, b))\nnum.sort()\nfor i in range(n):\n cnt += num[i][1]\n if cnt >= k:\n print((num[i][0]))\n exit()\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-num = 0", "-q = []", "+cnt = 0", "+num = []", "- q.append((a, b))", "-q.sort()", "+ num.append((a, b))", "+num.sort()", "- a, b = q[i][0], q[i][1]", "- num += b", "- if num >= k:", "- print(a)", "+ cnt += num[i][1]", "+ if cnt >= k:", "+ print((num[i][0]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3024329725, "measured_runtime_v1": 0.2289340452, "runtime_lift": 1.3210484801, "key": ["s168629717", "s331365181"]} +{"user_id": "u047796752", "problem_id": "p03197", "language": "python", "submission_id_v0": "s531607176", "submission_id_v1": "s450058032", "cpu_time_v0": 356, "cpu_time_v1": 241, "memory_v0": 49496, "memory_v1": 43868, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.3, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\ndef dfs(x, y):\n\n if x==0 and y==0:\n\n t[x][y] = False\n\n return False\n\n \n\n if x>=1:\n\n t[x][y] |= not dfs(x-1, y)\n\n \n\n if y>=1:\n\n t[x][y] |= not dfs(x, y-1)\n\n \n\n if min(x, y)>=1:\n\n t[x][y] |= not dfs(x-1, y-1)\n\n \n\n return t[x][y]\n\n \n\nt = [[False]*7 for _ in range(7)]\n\n\n\nfor i in range(7):\n\n for j in range(7):\n\n dfs(i, j)\n\n\n\n\"\"\"\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(input())\n\nflag = True\n\n\n\nfor _ in range(N):\n\n a = int(input())\n\n \n\n if a%2==1:\n\n flag = False\n\n \n\nif flag:\n\n print('second')\n\nelse:\n\n print('first')", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\n\"\"\"\n\ndef dfs(x, y):\n\n if x==0 and y==0:\n\n return False\n\n \n\n res = False\n\n \n\n if x>0:\n\n res |= not dfs(x-1, y)\n\n \n\n if y>0:\n\n res |= not dfs(x, y-1)\n\n \n\n if min(x, y)>0:\n\n res |= not dfs(x-1, y-1)\n\n \n\n return res\n\n \n\nt = [[False]*5 for _ in range(5)]\n\n\n\nfor i in range(5):\n\n for j in range(5):\n\n t[i][j] = dfs(i, j)\n\n\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nfor ai in a:\n\n if ai%2==1:\n\n print('first')\n\n exit()\n\n\n\nprint('second')", "code_v0_loc": 44, "code_v1_loc": 40, "code_v0_num_chars": 701, "code_v1_num_chars": 621, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\n\ndef dfs(x, y):\n if x == 0 and y == 0:\n t[x][y] = False\n return False\n if x >= 1:\n t[x][y] |= not dfs(x - 1, y)\n if y >= 1:\n t[x][y] |= not dfs(x, y - 1)\n if min(x, y) >= 1:\n t[x][y] |= not dfs(x - 1, y - 1)\n return t[x][y]\n\n\nt = [[False] * 7 for _ in range(7)]\nfor i in range(7):\n for j in range(7):\n dfs(i, j)\n\"\"\"\nfor ti in t:\n print(*ti)\n\"\"\"\nN = int(input())\nflag = True\nfor _ in range(N):\n a = int(input())\n if a % 2 == 1:\n flag = False\nif flag:\n print(\"second\")\nelse:\n print(\"first\")\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\"\"\"\ndef dfs(x, y):\n if x==0 and y==0:\n return False\n res = False\n if x>0:\n res |= not dfs(x-1, y)\n if y>0:\n res |= not dfs(x, y-1)\n if min(x, y)>0:\n res |= not dfs(x-1, y-1)\n return res\nt = [[False]*5 for _ in range(5)]\nfor i in range(5):\n for j in range(5):\n t[i][j] = dfs(i, j)\nfor ti in t:\n print(*ti)\n\"\"\"\nN = int(input())\na = [int(input()) for _ in range(N)]\nfor ai in a:\n if ai % 2 == 1:\n print(\"first\")\n exit()\nprint(\"second\")\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-from collections import *", "-", "-", "+\"\"\"", "- if x == 0 and y == 0:", "- t[x][y] = False", "+ if x==0 and y==0:", "- if x >= 1:", "- t[x][y] |= not dfs(x - 1, y)", "- if y >= 1:", "- t[x][y] |= not dfs(x, y - 1)", "- if min(x, y) >= 1:", "- t[x][y] |= not dfs(x - 1, y - 1)", "- return t[x][y]", "-", "-", "-t = [[False] * 7 for _ in range(7)]", "-for i in range(7):", "- for j in range(7):", "- dfs(i, j)", "-\"\"\"", "+ res = False", "+ if x>0:", "+ res |= not dfs(x-1, y)", "+ if y>0:", "+ res |= not dfs(x, y-1)", "+ if min(x, y)>0:", "+ res |= not dfs(x-1, y-1)", "+ return res", "+t = [[False]*5 for _ in range(5)]", "+for i in range(5):", "+ for j in range(5):", "+ t[i][j] = dfs(i, j)", "-flag = True", "-for _ in range(N):", "- a = int(input())", "- if a % 2 == 1:", "- flag = False", "-if flag:", "- print(\"second\")", "-else:", "- print(\"first\")", "+a = [int(input()) for _ in range(N)]", "+for ai in a:", "+ if ai % 2 == 1:", "+ print(\"first\")", "+ exit()", "+print(\"second\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4127988609, "measured_runtime_v1": 0.1956315268, "runtime_lift": 2.1100835213, "key": ["s531607176", "s450058032"]} +{"user_id": "u094191970", "problem_id": "p03416", "language": "python", "submission_id_v0": "s196951264", "submission_id_v1": "s755826464", "cpu_time_v0": 127, "cpu_time_v1": 57, "memory_v0": 2940, "memory_v1": 9184, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.12, "input": "a,b=list(map(int, input().split()))\n\ncnt=0\n\nfor i in range(a,b+1):\n\n n=list(str(i))\n\n if n==list(reversed(n)):\n\n cnt+=1\n\nprint(cnt)", "target": "from sys import stdin\n\nnii=lambda:list(map(int,stdin.readline().split()))\n\nlnii=lambda:list(map(int,stdin.readline().split()))\n\n\n\na,b=nii()\n\nans=0\n\nfor i in range(a,b+1):\n\n s=str(i)\n\n if s==s[::-1]:\n\n ans+=1\n\n\n\nprint(ans)", "code_v0_loc": 7, "code_v1_loc": 12, "code_v0_num_chars": 138, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(a, b + 1):\n n = list(str(i))\n if n == list(reversed(n)):\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "from sys import stdin\n\nnii = lambda: list(map(int, stdin.readline().split()))\nlnii = lambda: list(map(int, stdin.readline().split()))\na, b = nii()\nans = 0\nfor i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.6666666667, "diff": ["-a, b = list(map(int, input().split()))", "-cnt = 0", "+from sys import stdin", "+", "+nii = lambda: list(map(int, stdin.readline().split()))", "+lnii = lambda: list(map(int, stdin.readline().split()))", "+a, b = nii()", "+ans = 0", "- n = list(str(i))", "- if n == list(reversed(n)):", "- cnt += 1", "-print(cnt)", "+ s = str(i)", "+ if s == s[::-1]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4537812017, "measured_runtime_v1": 0.1270140123, "runtime_lift": 3.5726861437, "key": ["s196951264", "s755826464"]} +{"user_id": "u046187684", "problem_id": "p03416", "language": "python", "submission_id_v0": "s340270167", "submission_id_v1": "s097893502", "cpu_time_v0": 67, "cpu_time_v1": 60, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.45, "input": "a, b = list(map(int, input().strip().split(\" \")))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\nprint(count)\n", "target": "def solve(string):\n\n a, b = list(map(int, string.split()))\n\n count = 0\n\n for i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\n return str(count)\n\n\n\n\n\nif __name__ == '__main__':\n\n print((solve(input())))\n", "code_v0_loc": 6, "code_v1_loc": 11, "code_v0_num_chars": 148, "code_v1_num_chars": 244, "code_v0_no_empty_lines": "a, b = list(map(int, input().strip().split(\" \")))\ncount = 0\nfor i in range(a, b + 1):\n if str(i) == str(i)[::-1]:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "def solve(string):\n a, b = list(map(int, string.split()))\n count = 0\n for i in range(a, b + 1):\n if str(i) == str(i)[::-1]:\n count += 1\n return str(count)\n\n\nif __name__ == \"__main__\":\n print((solve(input())))\n", "code_same": false, "relative_loc_diff_percent": 45.4545454545, "diff": ["-a, b = list(map(int, input().strip().split(\" \")))", "-count = 0", "-for i in range(a, b + 1):", "- if str(i) == str(i)[::-1]:", "- count += 1", "-print(count)", "+def solve(string):", "+ a, b = list(map(int, string.split()))", "+ count = 0", "+ for i in range(a, b + 1):", "+ if str(i) == str(i)[::-1]:", "+ count += 1", "+ return str(count)", "+", "+", "+if __name__ == \"__main__\":", "+ print((solve(input())))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2889559059, "measured_runtime_v1": 0.2039610577, "runtime_lift": 1.4167209624, "key": ["s340270167", "s097893502"]} +{"user_id": "u257974487", "problem_id": "p03796", "language": "python", "submission_id_v0": "s235320519", "submission_id_v1": "s032021754", "cpu_time_v0": 230, "cpu_time_v1": 40, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.61, "input": "import math\n\nN = int(input())\n\np = math.factorial(N)\n\nprint((p % 1000000007))", "target": "N = int(input())\n\np = 1\n\nfor i in range(1,N+1):\n\n p *= i\n\n p %= 1000000007\n\nprint(p)\n", "code_v0_loc": 4, "code_v1_loc": 6, "code_v0_num_chars": 75, "code_v1_num_chars": 91, "code_v0_no_empty_lines": "import math\n\nN = int(input())\np = math.factorial(N)\nprint((p % 1000000007))\n", "code_v1_no_empty_lines": "N = int(input())\np = 1\nfor i in range(1, N + 1):\n p *= i\n p %= 1000000007\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-import math", "-", "-p = math.factorial(N)", "-print((p % 1000000007))", "+p = 1", "+for i in range(1, N + 1):", "+ p *= i", "+ p %= 1000000007", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.768677109, "measured_runtime_v1": 0.410683428, "runtime_lift": 1.8717022808, "key": ["s235320519", "s032021754"]} +{"user_id": "u381572531", "problem_id": "p02891", "language": "python", "submission_id_v0": "s581989830", "submission_id_v1": "s729822755", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "import sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(input())\n\n \n\ndef check_count(s):\n\n cnt_list = [1]\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt_list[-1] += 1\n\n else:\n\n cnt_list.append(1)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c//2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k//2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)//2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)", "target": "import sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(input())\n\n\n\ndef check_count(s):\n\n cnt_list = []\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt += 1\n\n else:\n\n cnt_list.append(cnt)\n\n cnt = 1\n\n if cnt>1:\n\n cnt_list.append(cnt)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c//2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k//2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)//2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)", "code_v0_loc": 35, "code_v1_loc": 38, "code_v0_num_chars": 711, "code_v1_num_chars": 765, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\ns = input().rstrip()\nk = int(input())\n\n\ndef check_count(s):\n cnt_list = [1]\n cnt = 1\n for i in range(1, len(s)):\n if s[i - 1] == s[i]:\n cnt_list[-1] += 1\n else:\n cnt_list.append(1)\n return cnt_list\n\n\ndef calc_ans(cnt_list, k):\n _ans = 0\n for c in cnt_list:\n _ans += c // 2\n return _ans * k\n\n\nif len(s) == 1:\n ans = k // 2\nelse:\n cnt_list = check_count(s)\n if len(cnt_list) == 1:\n ans = (len(s) * k) // 2\n else:\n ans = calc_ans(cnt_list, k)\n if s[0] == s[-1]:\n if cnt_list[0] % 2 == 1 and cnt_list[-1] % 2 == 1:\n ans += k - 1\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\ns = input().rstrip()\nk = int(input())\n\n\ndef check_count(s):\n cnt_list = []\n cnt = 1\n for i in range(1, len(s)):\n if s[i - 1] == s[i]:\n cnt += 1\n else:\n cnt_list.append(cnt)\n cnt = 1\n if cnt > 1:\n cnt_list.append(cnt)\n return cnt_list\n\n\ndef calc_ans(cnt_list, k):\n _ans = 0\n for c in cnt_list:\n _ans += c // 2\n return _ans * k\n\n\nif len(s) == 1:\n ans = k // 2\nelse:\n cnt_list = check_count(s)\n if len(cnt_list) == 1:\n ans = (len(s) * k) // 2\n else:\n ans = calc_ans(cnt_list, k)\n if s[0] == s[-1]:\n if cnt_list[0] % 2 == 1 and cnt_list[-1] % 2 == 1:\n ans += k - 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.8947368421, "diff": ["- cnt_list = [1]", "+ cnt_list = []", "- cnt_list[-1] += 1", "+ cnt += 1", "- cnt_list.append(1)", "+ cnt_list.append(cnt)", "+ cnt = 1", "+ if cnt > 1:", "+ cnt_list.append(cnt)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3312115214, "measured_runtime_v1": 0.249056649, "runtime_lift": 1.3298642006, "key": ["s581989830", "s729822755"]} +{"user_id": "u706929073", "problem_id": "p02881", "language": "python", "submission_id_v0": "s504662720", "submission_id_v1": "s470778572", "cpu_time_v0": 504, "cpu_time_v1": 137, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.82, "input": "N = int(input())\n\n\n\n\n\ndef dist(i, j):\n\n return i + j - 2\n\n\n\n\n\nmin = 10 ** 24\n\ni = 1\n\nwhile (i ** 2) <= N:\n\n if 0 == N % i:\n\n j = N // i\n\n d = dist(i, j)\n\n if min > d:\n\n min = d\n\n i += 1\n\nprint(d)\n", "target": "import math\n\nn = int(input())\n\n\n\nans = 0\n\nfor i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:\n\n if 0 == n % i:\n\n ans = i\n\n break\n\nans_partner = n // ans\n\nprint((ans + ans_partner - 2))\n", "code_v0_loc": 17, "code_v1_loc": 10, "code_v0_num_chars": 237, "code_v1_num_chars": 200, "code_v0_no_empty_lines": "N = int(input())\n\n\ndef dist(i, j):\n return i + j - 2\n\n\nmin = 10**24\ni = 1\nwhile (i**2) <= N:\n if 0 == N % i:\n j = N // i\n d = dist(i, j)\n if min > d:\n min = d\n i += 1\nprint(d)\n", "code_v1_no_empty_lines": "import math\n\nn = int(input())\nans = 0\nfor i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:\n if 0 == n % i:\n ans = i\n break\nans_partner = n // ans\nprint((ans + ans_partner - 2))\n", "code_same": false, "relative_loc_diff_percent": 41.1764705882, "diff": ["-N = int(input())", "+import math", "-", "-def dist(i, j):", "- return i + j - 2", "-", "-", "-min = 10**24", "-i = 1", "-while (i**2) <= N:", "- if 0 == N % i:", "- j = N // i", "- d = dist(i, j)", "- if min > d:", "- min = d", "- i += 1", "-print(d)", "+n = int(input())", "+ans = 0", "+for i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:", "+ if 0 == n % i:", "+ ans = i", "+ break", "+ans_partner = n // ans", "+print((ans + ans_partner - 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.327980933, "measured_runtime_v1": 0.2062122526, "runtime_lift": 1.5905016738, "key": ["s504662720", "s470778572"]} +{"user_id": "u222668979", "problem_id": "p02552", "language": "python", "submission_id_v0": "s235847366", "submission_id_v1": "s896909207", "cpu_time_v0": 81, "cpu_time_v1": 70, "memory_v0": 61596, "memory_v1": 61788, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.58, "input": "n = int(input())\n\nprint((1 if n == 0 else 0))\n", "target": "n = int(input())\n\nprint((0 if n else 1))\n", "code_v0_loc": 2, "code_v1_loc": 2, "code_v0_num_chars": 44, "code_v1_num_chars": 39, "code_v0_no_empty_lines": "n = int(input())\nprint((1 if n == 0 else 0))\n", "code_v1_no_empty_lines": "n = int(input())\nprint((0 if n else 1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-print((1 if n == 0 else 0))", "+print((0 if n else 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.340472885, "measured_runtime_v1": 0.2658090671, "runtime_lift": 1.2808926674, "key": ["s235847366", "s896909207"]} +{"user_id": "u747602774", "problem_id": "p03039", "language": "python", "submission_id_v0": "s108635717", "submission_id_v1": "s387237372", "cpu_time_v0": 543, "cpu_time_v1": 230, "memory_v0": 9432, "memory_v1": 9412, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.64, "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n ans += f1(x,y,n,m)+f1(1,1,x,y)+f1(1,y,x,m)+f1(x,1,n,y)\n\n ans -= f2(x,n) + f2(1,x) + f2(1,y) + f2(y,m)\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n", "target": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)//2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "code_v0_loc": 38, "code_v1_loc": 42, "code_v0_num_chars": 796, "code_v1_num_chars": 809, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) // 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n ans += f1(x, y, n, m) + f1(1, 1, x, y) + f1(1, y, x, m) + f1(x, 1, n, y)\n ans -= f2(x, n) + f2(1, x) + f2(1, y) + f2(y, m)\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) // 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n a = n - x + 1\n b = m - y + 1\n c = m * (a * (a - 1) + x * (x - 1))\n d = n * (b * (b - 1) + y * (y - 1))\n ans += (c + d) // 2\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.5238095238, "diff": ["- ans += f1(x, y, n, m) + f1(1, 1, x, y) + f1(1, y, x, m) + f1(x, 1, n, y)", "- ans -= f2(x, n) + f2(1, x) + f2(1, y) + f2(y, m)", "+ a = n - x + 1", "+ b = m - y + 1", "+ c = m * (a * (a - 1) + x * (x - 1))", "+ d = n * (b * (b - 1) + y * (y - 1))", "+ ans += (c + d) // 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4582999928, "measured_runtime_v1": 0.3618569455, "runtime_lift": 1.2665225816, "key": ["s108635717", "s387237372"]} +{"user_id": "u827885761", "problem_id": "p03013", "language": "python", "submission_id_v0": "s193052587", "submission_id_v1": "s829443238", "cpu_time_v0": 509, "cpu_time_v1": 195, "memory_v0": 46168, "memory_v1": 7668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.69, "input": "import sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\n\n\nl = [0] * (n+1)\n\nl[0] = 1\n\n\n\na = 0\n\nif m != 0:\n\n a = int(input())\n\nk = 1\n\nfor i in range(n+1):\n\n\n\n if i != a:\n\n if i == 1:\n\n l[i] = 1\n\n elif i >= 2:\n\n l[i] = l[i-1] + l[i-2]\n\n l[i] %= 1000000007\n\n else:\n\n k += 1\n\n if k <= m:\n\n a = int(input())\n\n\n\n\n\n\n\n#print(l)\n\nprint((l[n] % 1000000007))\n", "target": "import sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\na = [1] * (n+1)\n\nfor i in range(m):\n\n a[int(input())] = 0\n\nk = [0] * (n+1)\n\nk[0] = 1\n\nfor i in range(1,n+1):\n\n if i == 1 and a[1]:\n\n k[1] = 1\n\n elif i >= 2 and a[i]:\n\n k[i] = k[i-1] + k[i-2]\n\n k[i] %= 10 ** 9 + 7\n\n\n\nprint((k[n]))\n", "code_v0_loc": 30, "code_v1_loc": 18, "code_v0_num_chars": 479, "code_v1_num_chars": 367, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef lmi():\n return list(map(int, input().split()))\n\n\nn, m = lmi()\nl = [0] * (n + 1)\nl[0] = 1\na = 0\nif m != 0:\n a = int(input())\nk = 1\nfor i in range(n + 1):\n if i != a:\n if i == 1:\n l[i] = 1\n elif i >= 2:\n l[i] = l[i - 1] + l[i - 2]\n l[i] %= 1000000007\n else:\n k += 1\n if k <= m:\n a = int(input())\n# print(l)\nprint((l[n] % 1000000007))\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef lmi():\n return list(map(int, input().split()))\n\n\nn, m = lmi()\na = [1] * (n + 1)\nfor i in range(m):\n a[int(input())] = 0\nk = [0] * (n + 1)\nk[0] = 1\nfor i in range(1, n + 1):\n if i == 1 and a[1]:\n k[1] = 1\n elif i >= 2 and a[i]:\n k[i] = k[i - 1] + k[i - 2]\n k[i] %= 10**9 + 7\nprint((k[n]))\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-l = [0] * (n + 1)", "-l[0] = 1", "-a = 0", "-if m != 0:", "- a = int(input())", "-k = 1", "-for i in range(n + 1):", "- if i != a:", "- if i == 1:", "- l[i] = 1", "- elif i >= 2:", "- l[i] = l[i - 1] + l[i - 2]", "- l[i] %= 1000000007", "- else:", "- k += 1", "- if k <= m:", "- a = int(input())", "-# print(l)", "-print((l[n] % 1000000007))", "+a = [1] * (n + 1)", "+for i in range(m):", "+ a[int(input())] = 0", "+k = [0] * (n + 1)", "+k[0] = 1", "+for i in range(1, n + 1):", "+ if i == 1 and a[1]:", "+ k[1] = 1", "+ elif i >= 2 and a[i]:", "+ k[i] = k[i - 1] + k[i - 2]", "+ k[i] %= 10**9 + 7", "+print((k[n]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3120539634, "measured_runtime_v1": 0.1110639279, "runtime_lift": 2.8096787978, "key": ["s193052587", "s829443238"]} +{"user_id": "u282228874", "problem_id": "p03013", "language": "python", "submission_id_v0": "s600331807", "submission_id_v1": "s809304917", "cpu_time_v0": 241, "cpu_time_v1": 180, "memory_v0": 9592, "memory_v1": 13192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.31, "input": "N,M = list(map(int,input().split()))\n\nMOD = 10**9+7\n\ndp = [0]*(N+1)\n\ndp[0]=1\n\nA = [int(input()) for i in range(M)]\n\nban = [1]*(N+1)\n\nfor a in A:\n\n ban[a]=0\n\nfor i in range(N):\n\n if i-1>=0:\n\n dp[i+1]=dp[i]*ban[i]+dp[i-1]*ban[i-1]\n\n else:\n\n dp[i+1]=dp[i]*ban[i]\n\n dp[i+1] %= MOD \n\nprint((dp[N]))", "target": "N,M = list(map(int,input().split()))\n\nA = [int(input()) for i in range(M)]\n\nMOD = 10**9+7\n\nA = set(A)\n\ndp = [0]*(N+1)\n\ndp[0] = 1\n\nfor i in range(1,N+1):\n\n if i in A:\n\n continue\n\n if i == 1:\n\n dp[1] = dp[0]\n\n else:\n\n dp[i] = (dp[i-1]+dp[i-2])%MOD\n\nprint((dp[N]))", "code_v0_loc": 15, "code_v1_loc": 14, "code_v0_num_chars": 311, "code_v1_num_chars": 283, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nMOD = 10**9 + 7\ndp = [0] * (N + 1)\ndp[0] = 1\nA = [int(input()) for i in range(M)]\nban = [1] * (N + 1)\nfor a in A:\n ban[a] = 0\nfor i in range(N):\n if i - 1 >= 0:\n dp[i + 1] = dp[i] * ban[i] + dp[i - 1] * ban[i - 1]\n else:\n dp[i + 1] = dp[i] * ban[i]\n dp[i + 1] %= MOD\nprint((dp[N]))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nA = [int(input()) for i in range(M)]\nMOD = 10**9 + 7\nA = set(A)\ndp = [0] * (N + 1)\ndp[0] = 1\nfor i in range(1, N + 1):\n if i in A:\n continue\n if i == 1:\n dp[1] = dp[0]\n else:\n dp[i] = (dp[i - 1] + dp[i - 2]) % MOD\nprint((dp[N]))\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["+A = [int(input()) for i in range(M)]", "+A = set(A)", "-A = [int(input()) for i in range(M)]", "-ban = [1] * (N + 1)", "-for a in A:", "- ban[a] = 0", "-for i in range(N):", "- if i - 1 >= 0:", "- dp[i + 1] = dp[i] * ban[i] + dp[i - 1] * ban[i - 1]", "+for i in range(1, N + 1):", "+ if i in A:", "+ continue", "+ if i == 1:", "+ dp[1] = dp[0]", "- dp[i + 1] = dp[i] * ban[i]", "- dp[i + 1] %= MOD", "+ dp[i] = (dp[i - 1] + dp[i - 2]) % MOD"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2076114528, "measured_runtime_v1": 0.0063931749, "runtime_lift": 32.4739204186, "key": ["s600331807", "s809304917"]} +{"user_id": "u562935282", "problem_id": "p03371", "language": "python", "submission_id_v0": "s471284270", "submission_id_v1": "s058926350", "cpu_time_v0": 98, "cpu_time_v1": 81, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.35, "input": "def main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = 1 << 30\n\n c = 0 # even\n\n while True:\n\n j = c // 2\n\n t = A * max(0, X - j) + B * max(0, Y - j) + C * c\n\n if ans <= t: break\n\n ans = t\n\n c += 2\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 353, "code_v1_num_chars": 318, "code_v0_no_empty_lines": "def main():\n A, B, AB, X, Y = list(map(int, input().split()))\n M = max(X, Y)\n k = 0\n ans = A * X + B * Y\n while True:\n ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)\n if k >= M:\n break\n k += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = 1 << 30\n c = 0 # even\n while True:\n j = c // 2\n t = A * max(0, X - j) + B * max(0, Y - j) + C * c\n if ans <= t:\n break\n ans = t\n c += 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["- A, B, AB, X, Y = list(map(int, input().split()))", "- M = max(X, Y)", "- k = 0", "- ans = A * X + B * Y", "+ A, B, C, X, Y = list(map(int, input().split()))", "+ ans = 1 << 30", "+ c = 0 # even", "- ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)", "- if k >= M:", "+ j = c // 2", "+ t = A * max(0, X - j) + B * max(0, Y - j) + C * c", "+ if ans <= t:", "- k += 1", "+ ans = t", "+ c += 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3021148317, "measured_runtime_v1": 0.1545656888, "runtime_lift": 1.9546047633, "key": ["s471284270", "s058926350"]} +{"user_id": "u072053884", "problem_id": "p02245", "language": "python", "submission_id_v0": "s696240934", "submission_id_v1": "s480327836", "cpu_time_v0": 120, "cpu_time_v1": 60, "memory_v0": 10724, "memory_v1": 13476, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "import sys\n\n\n\ninit = ''.join(sys.stdin.read().split())\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start, goal):\n\n if start == goal:\n\n return 0\n\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n\n step = {start: 0, goal: 0}\n\n s = 0\n\n c_d = [(start, 0), (goal, 1)] # configure and direction\n\n while True:\n\n q = iter(c_d)\n\n c_d = []\n\n s += 1\n\n for c, d in q:\n\n i = c.find('0')\n\n if 0 <= i <= 5:\n\n t = str.maketrans('0' + c[i+3], c[i+3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i >= 3:\n\n t = str.maketrans('0' + c[i-3], c[i-3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n\n t = str.maketrans('0' + c[i+1], c[i+1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n\n t = str.maketrans('0' + c[i-1], c[i-1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n\n\nprint((solve(init, '123456780')))", "target": "adjacent = (\n\n (1, 3), # 0\n\n (0, 2, 4), # 1\n\n (1, 5), # 2\n\n (0, 4, 6), # 3\n\n (1, 3, 5, 7), # 4\n\n (2, 4, 8), # 5\n\n (3, 7), # 6\n\n (4, 6, 8), # 7\n\n (5, 7) # 8\n\n)\n\n\n\nimport collections\n\n\n\nGOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start):\n\n if start == GOAL:\n\n return 0\n\n # 0: forward, 1: backward\n\n generated_state = {tuple(start): 0, tuple(GOAL): 1}\n\n step = {tuple(start): 0, tuple(GOAL): 0}\n\n s = 0\n\n state1 = [(start, 0), (GOAL, 1)]\n\n while state1:\n\n state2 = state1[:]\n\n state1 = []\n\n s += 1\n\n for s2, d in state2:\n\n i = s2.index(0)\n\n for p in adjacent[i]:\n\n s1 = s2[:]\n\n s1[i], s1[p] = s1[p], 0\n\n key = tuple(s1)\n\n if key in generated_state:\n\n if generated_state[key] != d:\n\n return s + step[key]\n\n continue\n\n state1.append((s1, d))\n\n generated_state[key] = d\n\n step[key] = s\n\n\n\nimport sys\n\n\n\nstart = list(map(int, sys.stdin.read().split()))\n\n\n\nprint((solve(start)))", "code_v0_loc": 60, "code_v1_loc": 48, "code_v0_num_chars": 2264, "code_v1_num_chars": 1231, "code_v0_no_empty_lines": "import sys\n\ninit = \"\".join(sys.stdin.read().split())\n# Bidirectional search using breadth-first search\ndef solve(start, goal):\n if start == goal:\n return 0\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n step = {start: 0, goal: 0}\n s = 0\n c_d = [(start, 0), (goal, 1)] # configure and direction\n while True:\n q = iter(c_d)\n c_d = []\n s += 1\n for c, d in q:\n i = c.find(\"0\")\n if 0 <= i <= 5:\n t = str.maketrans(\"0\" + c[i + 3], c[i + 3] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i >= 3:\n t = str.maketrans(\"0\" + c[i - 3], c[i - 3] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n t = str.maketrans(\"0\" + c[i + 1], c[i + 1] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n t = str.maketrans(\"0\" + c[i - 1], c[i - 1] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n\n\nprint((solve(init, \"123456780\")))\n", "code_v1_no_empty_lines": "adjacent = (\n (1, 3), # 0\n (0, 2, 4), # 1\n (1, 5), # 2\n (0, 4, 6), # 3\n (1, 3, 5, 7), # 4\n (2, 4, 8), # 5\n (3, 7), # 6\n (4, 6, 8), # 7\n (5, 7), # 8\n)\nimport collections\n\nGOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]\n# Bidirectional search using breadth-first search\ndef solve(start):\n if start == GOAL:\n return 0\n # 0: forward, 1: backward\n generated_state = {tuple(start): 0, tuple(GOAL): 1}\n step = {tuple(start): 0, tuple(GOAL): 0}\n s = 0\n state1 = [(start, 0), (GOAL, 1)]\n while state1:\n state2 = state1[:]\n state1 = []\n s += 1\n for s2, d in state2:\n i = s2.index(0)\n for p in adjacent[i]:\n s1 = s2[:]\n s1[i], s1[p] = s1[p], 0\n key = tuple(s1)\n if key in generated_state:\n if generated_state[key] != d:\n return s + step[key]\n continue\n state1.append((s1, d))\n generated_state[key] = d\n step[key] = s\n\n\nimport sys\n\nstart = list(map(int, sys.stdin.read().split()))\nprint((solve(start)))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["+adjacent = (", "+ (1, 3), # 0", "+ (0, 2, 4), # 1", "+ (1, 5), # 2", "+ (0, 4, 6), # 3", "+ (1, 3, 5, 7), # 4", "+ (2, 4, 8), # 5", "+ (3, 7), # 6", "+ (4, 6, 8), # 7", "+ (5, 7), # 8", "+)", "+import collections", "+", "+GOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]", "+# Bidirectional search using breadth-first search", "+def solve(start):", "+ if start == GOAL:", "+ return 0", "+ # 0: forward, 1: backward", "+ generated_state = {tuple(start): 0, tuple(GOAL): 1}", "+ step = {tuple(start): 0, tuple(GOAL): 0}", "+ s = 0", "+ state1 = [(start, 0), (GOAL, 1)]", "+ while state1:", "+ state2 = state1[:]", "+ state1 = []", "+ s += 1", "+ for s2, d in state2:", "+ i = s2.index(0)", "+ for p in adjacent[i]:", "+ s1 = s2[:]", "+ s1[i], s1[p] = s1[p], 0", "+ key = tuple(s1)", "+ if key in generated_state:", "+ if generated_state[key] != d:", "+ return s + step[key]", "+ continue", "+ state1.append((s1, d))", "+ generated_state[key] = d", "+ step[key] = s", "+", "+", "-init = \"\".join(sys.stdin.read().split())", "-# Bidirectional search using breadth-first search", "-def solve(start, goal):", "- if start == goal:", "- return 0", "- generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward", "- step = {start: 0, goal: 0}", "- s = 0", "- c_d = [(start, 0), (goal, 1)] # configure and direction", "- while True:", "- q = iter(c_d)", "- c_d = []", "- s += 1", "- for c, d in q:", "- i = c.find(\"0\")", "- if 0 <= i <= 5:", "- t = str.maketrans(\"0\" + c[i + 3], c[i + 3] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "- if i >= 3:", "- t = str.maketrans(\"0\" + c[i - 3], c[i - 3] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "- if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:", "- t = str.maketrans(\"0\" + c[i + 1], c[i + 1] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "- if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:", "- t = str.maketrans(\"0\" + c[i - 1], c[i - 1] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "-", "-", "-print((solve(init, \"123456780\")))", "+start = list(map(int, sys.stdin.read().split()))", "+print((solve(start)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3218115091, "measured_runtime_v1": 0.2098443508, "runtime_lift": 1.533572421, "key": ["s696240934", "s480327836"]} +{"user_id": "u021019433", "problem_id": "p02837", "language": "python", "submission_id_v0": "s456284110", "submission_id_v1": "s644980365", "cpu_time_v0": 95, "cpu_time_v1": 55, "memory_v0": 6500, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.11, "input": "def popcount(x):\n\n r, q = 0, x\n\n while x:\n\n r += 1\n\n x &= x - 1\n\n return r, q\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\nl = (1 << n) - 1 \n\nb = sorted(map(popcount, list(range(1, l + 1))))\n\nans = next((i for i, x in reversed(b)\n\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)), 0)\n\nprint(ans)\n", "target": "from itertools import combinations, count\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [(set(), set()) for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y].add(x - 1)\n\nr = next(i for i in count(n, - 1) for x in map(set, combinations(r, i))\n\n if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x))\n\nprint(r)\n", "code_v0_loc": 19, "code_v1_loc": 12, "code_v0_num_chars": 460, "code_v1_num_chars": 369, "code_v0_no_empty_lines": "def popcount(x):\n r, q = 0, x\n while x:\n r += 1\n x &= x - 1\n return r, q\n\n\nn = int(input())\nr = list(range(n))\na = [[0, 0] for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y] |= 1 << (x - 1)\nl = (1 << n) - 1\nb = sorted(map(popcount, list(range(1, l + 1))))\nans = next(\n (\n i\n for i, x in reversed(b)\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)\n ),\n 0,\n)\nprint(ans)\n", "code_v1_no_empty_lines": "from itertools import combinations, count\n\nn = int(input())\nr = list(range(n))\na = [(set(), set()) for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y].add(x - 1)\nr = next(\n i\n for i in count(n, -1)\n for x in map(set, combinations(r, i))\n if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x)\n)\nprint(r)\n", "code_same": false, "relative_loc_diff_percent": 36.8421052632, "diff": ["-def popcount(x):", "- r, q = 0, x", "- while x:", "- r += 1", "- x &= x - 1", "- return r, q", "-", "+from itertools import combinations, count", "-a = [[0, 0] for _ in r]", "+a = [(set(), set()) for _ in r]", "- a[i][y] |= 1 << (x - 1)", "-l = (1 << n) - 1", "-b = sorted(map(popcount, list(range(1, l + 1))))", "-ans = next(", "- (", "- i", "- for i, x in reversed(b)", "- if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)", "- ),", "- 0,", "+ a[i][y].add(x - 1)", "+r = next(", "+ i", "+ for i in count(n, -1)", "+ for x in map(set, combinations(r, i))", "+ if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x)", "-print(ans)", "+print(r)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3135637941, "measured_runtime_v1": 0.2051509681, "runtime_lift": 1.5284538848, "key": ["s456284110", "s644980365"]} +{"user_id": "u228223940", "problem_id": "p03634", "language": "python", "submission_id_v0": "s279386500", "submission_id_v1": "s990337521", "cpu_time_v0": 1565, "cpu_time_v1": 1313, "memory_v0": 113180, "memory_v1": 156176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.1, "input": "import queue\n\nn = int(input())\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\nwhile not q.empty():\n\n tmp = q.get()\n\n for i in range(len(abc[tmp])):\n\n #print(abc[tmp])\n\n #exit()\n\n num = abc[tmp][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[tmp] + abc[tmp][i][1]\n\n q.put(num)\n\n \n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))", "target": "import queue\n\nimport sys\n\nsys.setrecursionlimit(10**7)\n\nn = int(input())\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\ndef dfs(p):\n\n for i in range(len(abc[p])):\n\n num = abc[p][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[p] + abc[p][i][1]\n\n dfs(num)\n\n\n\ndfs(k)\n\n\n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))", "code_v0_loc": 34, "code_v1_loc": 35, "code_v0_num_chars": 709, "code_v1_num_chars": 668, "code_v0_no_empty_lines": "import queue\n\nn = int(input())\nabc = [[] for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n abc[a].append([b, c])\n abc[b].append([a, c])\nQ, k = list(map(int, input().split()))\nxy = [[int(i) for i in input().split()] for j in range(Q)]\nq = queue.Queue()\nq.put(k)\npath = [-1] * (n + 1)\npath[k] = 0\nwhile not q.empty():\n tmp = q.get()\n for i in range(len(abc[tmp])):\n # print(abc[tmp])\n # exit()\n num = abc[tmp][i][0]\n if path[num] != -1:\n continue\n else:\n path[num] = path[tmp] + abc[tmp][i][1]\n q.put(num)\nfor i in range(Q):\n print((path[xy[i][0]] + path[xy[i][1]]))\n", "code_v1_no_empty_lines": "import queue\nimport sys\n\nsys.setrecursionlimit(10**7)\nn = int(input())\nabc = [[] for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n abc[a].append([b, c])\n abc[b].append([a, c])\nQ, k = list(map(int, input().split()))\nxy = [[int(i) for i in input().split()] for j in range(Q)]\nq = queue.Queue()\nq.put(k)\npath = [-1] * (n + 1)\npath[k] = 0\n\n\ndef dfs(p):\n for i in range(len(abc[p])):\n num = abc[p][i][0]\n if path[num] != -1:\n continue\n else:\n path[num] = path[p] + abc[p][i][1]\n dfs(num)\n\n\ndfs(k)\nfor i in range(Q):\n print((path[xy[i][0]] + path[xy[i][1]]))\n", "code_same": false, "relative_loc_diff_percent": 2.8571428571, "diff": ["+import sys", "+sys.setrecursionlimit(10**7)", "-while not q.empty():", "- tmp = q.get()", "- for i in range(len(abc[tmp])):", "- # print(abc[tmp])", "- # exit()", "- num = abc[tmp][i][0]", "+", "+", "+def dfs(p):", "+ for i in range(len(abc[p])):", "+ num = abc[p][i][0]", "- path[num] = path[tmp] + abc[tmp][i][1]", "- q.put(num)", "+ path[num] = path[p] + abc[p][i][1]", "+ dfs(num)", "+", "+", "+dfs(k)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3961623552, "measured_runtime_v1": 0.2607869017, "runtime_lift": 1.5191037302, "key": ["s279386500", "s990337521"]} +{"user_id": "u227438830", "problem_id": "p02394", "language": "python", "submission_id_v0": "s015330345", "submission_id_v1": "s144446421", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7644, "memory_v1": 5592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "W,H,x,y,r = [int(i) for i in input().split()]\n\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "target": "W, H, x, y, r = list(map(int, input().split()))\n\nif r <= x <= W-r and r <= y <= H-r:\n\n print('Yes')\n\nelse:\n\n print('No')\n", "code_v0_loc": 5, "code_v1_loc": 5, "code_v0_num_chars": 148, "code_v1_num_chars": 121, "code_v0_no_empty_lines": "W, H, x, y, r = [int(i) for i in input().split()]\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "W, H, x, y, r = list(map(int, input().split()))\nif r <= x <= W - r and r <= y <= H - r:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-W, H, x, y, r = [int(i) for i in input().split()]", "-if x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:", "+W, H, x, y, r = list(map(int, input().split()))", "+if r <= x <= W - r and r <= y <= H - r:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1765992579, "measured_runtime_v1": 0.0064357525, "runtime_lift": 27.44034336, "key": ["s015330345", "s144446421"]} +{"user_id": "u353895424", "problem_id": "p03325", "language": "python", "submission_id_v0": "s954474488", "submission_id_v1": "s311308759", "cpu_time_v0": 81, "cpu_time_v1": 56, "memory_v0": 4148, "memory_v1": 10088, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.86, "input": "from math import log2\n\nn = int(input())\n\na = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor _a in a:\n\n if _a%2 == 0:\n\n cnt =0\n\n while _a%2 == 0:\n\n _a //= 2\n\n cnt += 1\n\n ans += cnt\n\n\n\nprint((int(ans)))", "target": "def f(k):\n\n cnt = 0\n\n while k%2 == 0:\n\n k //= 2\n\n cnt += 1\n\n # print(k)\n\n # print(\"-----\")\n\n return cnt\n\n\n\nn = int(input())\n\nA = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor a in A:\n\n if a%2 == 0:\n\n ans += f(a)\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 17, "code_v0_num_chars": 245, "code_v1_num_chars": 272, "code_v0_no_empty_lines": "from math import log2\n\nn = int(input())\na = list(map(int, input().split()))\nans = 0\nfor _a in a:\n if _a % 2 == 0:\n cnt = 0\n while _a % 2 == 0:\n _a //= 2\n cnt += 1\n ans += cnt\nprint((int(ans)))\n", "code_v1_no_empty_lines": "def f(k):\n cnt = 0\n while k % 2 == 0:\n k //= 2\n cnt += 1\n # print(k)\n # print(\"-----\")\n return cnt\n\n\nn = int(input())\nA = list(map(int, input().split()))\nans = 0\nfor a in A:\n if a % 2 == 0:\n ans += f(a)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["-from math import log2", "+def f(k):", "+ cnt = 0", "+ while k % 2 == 0:", "+ k //= 2", "+ cnt += 1", "+ # print(k)", "+ return cnt", "+", "-a = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "-for _a in a:", "- if _a % 2 == 0:", "- cnt = 0", "- while _a % 2 == 0:", "- _a //= 2", "- cnt += 1", "- ans += cnt", "-print((int(ans)))", "+for a in A:", "+ if a % 2 == 0:", "+ ans += f(a)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3309142907, "measured_runtime_v1": 0.2479304838, "runtime_lift": 1.3347059448, "key": ["s954474488", "s311308759"]} +{"user_id": "u164727245", "problem_id": "p02685", "language": "python", "submission_id_v0": "s549338354", "submission_id_v1": "s173586541", "cpu_time_v0": 842, "cpu_time_v1": 187, "memory_v0": 9192, "memory_v1": 16648, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 77.79, "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n ret = p\n\n inv = pow(m-1, mod-2, mod)\n\n for i in range(1, k+1):\n\n ncr = (ncr * (n-i)*pow(i, mod-2, mod)) % mod\n\n p = (p*inv) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "target": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n\n\n ret = p\n\n iR = [1]*(k+1)\n\n im = pow(m-1, mod-2, mod)\n\n\n\n for i in range(1, k+1):\n\n iR[i] = max(1, (-(mod//i) * iR[mod % i]) % mod)\n\n ncr = (ncr * (n-i)*iR[i]) % mod\n\n p = (p*im) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "code_v0_loc": 24, "code_v1_loc": 28, "code_v0_num_chars": 512, "code_v1_num_chars": 578, "code_v0_no_empty_lines": "# coding: utf-8\ndef solve(*args: str) -> str:\n n, m, k = list(map(int, args[0].split()))\n mod = 998244353\n if m == 1 and n - 1 == k:\n return str(1)\n ncr = 1\n p = m * pow(m - 1, n - 1, mod) % mod\n ret = p\n inv = pow(m - 1, mod - 2, mod)\n for i in range(1, k + 1):\n ncr = (ncr * (n - i) * pow(i, mod - 2, mod)) % mod\n p = (p * inv) % mod\n ret += p * ncr % mod\n return str(ret % mod)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_v1_no_empty_lines": "# coding: utf-8\ndef solve(*args: str) -> str:\n n, m, k = list(map(int, args[0].split()))\n mod = 998244353\n if m == 1 and n - 1 == k:\n return str(1)\n ncr = 1\n p = m * pow(m - 1, n - 1, mod) % mod\n ret = p\n iR = [1] * (k + 1)\n im = pow(m - 1, mod - 2, mod)\n for i in range(1, k + 1):\n iR[i] = max(1, (-(mod // i) * iR[mod % i]) % mod)\n ncr = (ncr * (n - i) * iR[i]) % mod\n p = (p * im) % mod\n ret += p * ncr % mod\n return str(ret % mod)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["- inv = pow(m - 1, mod - 2, mod)", "+ iR = [1] * (k + 1)", "+ im = pow(m - 1, mod - 2, mod)", "- ncr = (ncr * (n - i) * pow(i, mod - 2, mod)) % mod", "- p = (p * inv) % mod", "+ iR[i] = max(1, (-(mod // i) * iR[mod % i]) % mod)", "+ ncr = (ncr * (n - i) * iR[i]) % mod", "+ p = (p * im) % mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4946005352, "measured_runtime_v1": 0.3604053538, "runtime_lift": 1.3723451385, "key": ["s549338354", "s173586541"]} +{"user_id": "u054556734", "problem_id": "p03828", "language": "python", "submission_id_v0": "s442927172", "submission_id_v1": "s952876179", "cpu_time_v0": 83, "cpu_time_v1": 25, "memory_v0": 3316, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 69.88, "input": "import collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,n+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num //= i ; ans.append(i)\n\n return ans\n\n\n\nn = int(input())\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n", "target": "import collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,int(n**0.5)+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num //= i ; ans.append(i)\n\n if num != 1: ans.append(num)\n\n return ans\n\n\n\nn = int(input())\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n", "code_v0_loc": 20, "code_v1_loc": 21, "code_v0_num_chars": 409, "code_v1_num_chars": 453, "code_v0_no_empty_lines": "import collections as col\n\n\ndef prime(n):\n ans = []\n num = n\n for i in range(2, n + 1):\n if i % 2 == 0 and i != 2:\n continue\n while num % i == 0:\n num //= i\n ans.append(i)\n return ans\n\n\nn = int(input())\nmod = 10**9 + 7\nprimes = []\nfor i in range(2, n + 1):\n primes += prime(i)\ncnt = col.Counter(primes)\nans = 1\nfor key, val in list(cnt.items()):\n ans *= val + 1\n ans %= mod\nprint(ans)\n", "code_v1_no_empty_lines": "import collections as col\n\n\ndef prime(n):\n ans = []\n num = n\n for i in range(2, int(n**0.5) + 1):\n if i % 2 == 0 and i != 2:\n continue\n while num % i == 0:\n num //= i\n ans.append(i)\n if num != 1:\n ans.append(num)\n return ans\n\n\nn = int(input())\nmod = 10**9 + 7\nprimes = []\nfor i in range(2, n + 1):\n primes += prime(i)\ncnt = col.Counter(primes)\nans = 1\nfor key, val in list(cnt.items()):\n ans *= val + 1\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.7619047619, "diff": ["- for i in range(2, n + 1):", "+ for i in range(2, int(n**0.5) + 1):", "+ if num != 1:", "+ ans.append(num)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3365422637, "measured_runtime_v1": 0.2564944384, "runtime_lift": 1.3120840585, "key": ["s442927172", "s952876179"]} +{"user_id": "u852690916", "problem_id": "p02794", "language": "python", "submission_id_v0": "s356881403", "submission_id_v1": "s623982203", "cpu_time_v0": 2735, "cpu_time_v1": 2229, "memory_v0": 44580, "memory_v1": 43936, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.5, "input": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(input())\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(input())\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 52, "code_v1_loc": 54, "code_v0_num_chars": 1262, "code_v1_num_chars": 1288, "code_v0_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n E = [[] for _ in range(N)]\n for i in range(N - 1):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n E[a].append((b, i))\n E[b].append((a, i))\n\n def dfs(s, g):\n par = [(-1, -1)] * N\n par[s] = (s, -1)\n stack = [s]\n while stack:\n v = stack.pop()\n for to, i in E[v]:\n if par[to][0] >= 0:\n continue\n par[to] = (v, i)\n if to == g:\n break\n stack.append(to)\n r = set()\n v = g\n while v != s:\n v, i = par[v]\n r.add(i)\n return r\n\n M = int(input())\n path = [None] * M\n for i in range(M):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n path[i] = dfs(u, v)\n\n def calc(s):\n return 1 << (N - 1 - len(s))\n\n i_ans = 0\n for p in range(1, 1 << M):\n is_odd = bin(p).count(\"1\") & 1\n s = set()\n for i in range(M):\n if p & 1:\n s |= path[i]\n p >>= 1\n if is_odd:\n i_ans += calc(s)\n else:\n i_ans -= calc(s)\n print(((1 << (N - 1)) - i_ans))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n E = [[] for _ in range(N)]\n for i in range(N - 1):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n E[a].append((b, i))\n E[b].append((a, i))\n\n def dfs(s, g):\n par = [(-1, -1)] * N\n par[s] = (s, -1)\n stack = [s]\n while stack:\n v = stack.pop()\n for to, i in E[v]:\n if par[to][0] >= 0:\n continue\n par[to] = (v, i)\n if to == g:\n break\n stack.append(to)\n r = set()\n v = g\n while v != s:\n v, i = par[v]\n r.add(i)\n return r\n\n M = int(input())\n path = [None] * M\n for i in range(M):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n path[i] = dfs(u, v)\n\n def calc(s):\n return 1 << (N - 1 - len(s))\n\n i_ans = 0\n for p in range(1, 1 << M):\n is_odd = 0\n s = set()\n for i in range(M):\n if p & 1:\n s |= path[i]\n is_odd ^= 1\n p >>= 1\n if is_odd:\n i_ans += calc(s)\n else:\n i_ans -= calc(s)\n print(((1 << (N - 1)) - i_ans))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 3.7037037037, "diff": ["- is_odd = bin(p).count(\"1\") & 1", "+ is_odd = 0", "+ is_odd ^= 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3895377469, "measured_runtime_v1": 0.2566085732, "runtime_lift": 1.5180231199, "key": ["s356881403", "s623982203"]} +{"user_id": "u295361373", "problem_id": "p02612", "language": "python", "submission_id_v0": "s197156959", "submission_id_v1": "s836901225", "cpu_time_v0": 226, "cpu_time_v1": 180, "memory_v0": 68124, "memory_v1": 68072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.35, "input": "'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(input())\n\ndef si():return input()\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n#mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile = 0\n\n\n\ndef solve():\n\n \n\n\n\n\n\n\n\n # for _ in range(ii()):\n\n\n\n n=ii()\n\n n%=1000\n\n if n!=0:\n\n n=1000-n\n\n print(n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()", "target": "'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom heapq import heappush,heappop\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(input())\n\ndef si():return input()\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n# mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile=0\n\n\n\n\n\n\n\n\n\n\n\ndef solve():\n\n\n\n\n\n # for _ in range(ii()):\n\n \n\n \n\n\n\n n=ii()\n\n n%=1000\n\n if(n!=0):\n\n n=1000-n\n\n print(n)\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()\n", "code_v0_loc": 77, "code_v1_loc": 66, "code_v0_num_chars": 1162, "code_v1_num_chars": 1190, "code_v0_no_empty_lines": "\"\"\"\n Auther: ghoshashis545 Ashis Ghosh\n College: jalpaiguri Govt Enggineering College\n\"\"\"\nfrom os import path\nimport sys\nfrom functools import cmp_to_key as ctk\nfrom collections import deque, defaultdict as dd\nfrom bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right\nfrom itertools import permutations\nfrom datetime import datetime\nfrom math import ceil, sqrt, log, gcd\n\n\ndef ii():\n return int(input())\n\n\ndef si():\n return input()\n\n\ndef mi():\n return list(map(int, input().split()))\n\n\ndef li():\n return list(mi())\n\n\nabc = \"abcdefghijklmnopqrstuvwxyz\"\nmod = 1000000007\n# mod=998244353\ninf = float(\"inf\")\nvow = [\"a\", \"e\", \"i\", \"o\", \"u\"]\ndx, dy = [-1, 1, 0, 0], [0, 0, 1, -1]\n\n\ndef bo(i):\n return ord(i) - ord(\"a\")\n\n\nfile = 0\n\n\ndef solve():\n # for _ in range(ii()):\n n = ii()\n n %= 1000\n if n != 0:\n n = 1000 - n\n print(n)\n\n\nif __name__ == \"__main__\":\n if file:\n if path.exists(\"input1.txt\"):\n sys.stdin = open(\"input1.txt\", \"r\")\n sys.stdout = open(\"output1.txt\", \"w\")\n else:\n input = sys.stdin.readline\n solve()\n", "code_v1_no_empty_lines": "\"\"\"\n Auther: ghoshashis545 Ashis Ghosh\n College: jalpaiguri Govt Enggineering College\n\"\"\"\nfrom os import path\nimport sys\nfrom heapq import heappush, heappop\nfrom functools import cmp_to_key as ctk\nfrom collections import deque, defaultdict as dd\nfrom bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right\nfrom itertools import permutations\nfrom datetime import datetime\nfrom math import ceil, sqrt, log, gcd\n\n\ndef ii():\n return int(input())\n\n\ndef si():\n return input()\n\n\ndef mi():\n return list(map(int, input().split()))\n\n\ndef li():\n return list(mi())\n\n\nabc = \"abcdefghijklmnopqrstuvwxyz\"\nmod = 1000000007\n# mod=998244353\ninf = float(\"inf\")\nvow = [\"a\", \"e\", \"i\", \"o\", \"u\"]\ndx, dy = [-1, 1, 0, 0], [0, 0, 1, -1]\n\n\ndef bo(i):\n return ord(i) - ord(\"a\")\n\n\nfile = 0\n\n\ndef solve():\n # for _ in range(ii()):\n n = ii()\n n %= 1000\n if n != 0:\n n = 1000 - n\n print(n)\n\n\nif __name__ == \"__main__\":\n if file:\n if path.exists(\"input1.txt\"):\n sys.stdin = open(\"input1.txt\", \"r\")\n sys.stdout = open(\"output1.txt\", \"w\")\n else:\n input = sys.stdin.readline\n solve()\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["+from heapq import heappush, heappop"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3258618799, "measured_runtime_v1": 0.2078528001, "runtime_lift": 1.5677531392, "key": ["s197156959", "s836901225"]} +{"user_id": "u133936772", "problem_id": "p02685", "language": "python", "submission_id_v0": "s693454638", "submission_id_v1": "s088786085", "cpu_time_v0": 1252, "cpu_time_v1": 782, "memory_v0": 9184, "memory_v1": 9192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.54, "input": "M=998244353\n\nn,m,k=list(map(int,input().split()))\n\na=0\n\nc=1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n-i-1,M)\n\n c=c*(n-i-1)*pow(i+1,M-2,M)%M\n\nprint((a%M))", "target": "M=998244353\n\nn,m,k=list(map(int,input().split()))\n\na,c=0,1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n+~i,M)\n\n c=c*(n+~i)*pow(i+1,-1,M)%M\n\nprint((a%M))", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 146, "code_v1_num_chars": 142, "code_v0_no_empty_lines": "M = 998244353\nn, m, k = list(map(int, input().split()))\na = 0\nc = 1\nfor i in range(k + 1):\n a += c * m * pow(m - 1, n - i - 1, M)\n c = c * (n - i - 1) * pow(i + 1, M - 2, M) % M\nprint((a % M))\n", "code_v1_no_empty_lines": "M = 998244353\nn, m, k = list(map(int, input().split()))\na, c = 0, 1\nfor i in range(k + 1):\n a += c * m * pow(m - 1, n + ~i, M)\n c = c * (n + ~i) * pow(i + 1, -1, M) % M\nprint((a % M))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-a = 0", "-c = 1", "+a, c = 0, 1", "- a += c * m * pow(m - 1, n - i - 1, M)", "- c = c * (n - i - 1) * pow(i + 1, M - 2, M) % M", "+ a += c * m * pow(m - 1, n + ~i, M)", "+ c = c * (n + ~i) * pow(i + 1, -1, M) % M"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5053028598, "measured_runtime_v1": 0.3381624324, "runtime_lift": 1.4942607792, "key": ["s693454638", "s088786085"]} +{"user_id": "u038408819", "problem_id": "p03680", "language": "python", "submission_id_v0": "s808331415", "submission_id_v1": "s267927939", "cpu_time_v0": 450, "cpu_time_v1": 202, "memory_v0": 7084, "memory_v1": 7084, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.11, "input": "N = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(10 ** 6):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))", "target": "N = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(len(a)):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 226, "code_v1_num_chars": 225, "code_v0_no_empty_lines": "N = int(input())\na = [int(input()) for _ in range(N)]\ncnt, i = 0, 0\nfor j in range(10**6):\n cnt += 1\n if a[i] == 2:\n print(cnt)\n # break\n quit()\n else:\n i = a[i] - 1\nprint((-1))\n", "code_v1_no_empty_lines": "N = int(input())\na = [int(input()) for _ in range(N)]\ncnt, i = 0, 0\nfor j in range(len(a)):\n cnt += 1\n if a[i] == 2:\n print(cnt)\n # break\n quit()\n else:\n i = a[i] - 1\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-for j in range(10**6):", "+for j in range(len(a)):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6719723573, "measured_runtime_v1": 0.1459480231, "runtime_lift": 4.6041895124, "key": ["s808331415", "s267927939"]} +{"user_id": "u581511366", "problem_id": "p02555", "language": "python", "submission_id_v0": "s399411060", "submission_id_v1": "s856192378", "cpu_time_v0": 183, "cpu_time_v1": 64, "memory_v0": 72444, "memory_v1": 63820, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.03, "input": "import math\n\n\n\n\n\ndef combinations_count(n, r):\n\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n s = int(input())\n\n ans = 0\n\n n = s // 3\n\n\n\n for i in range(1, n + 1):\n\n ans += combinations_with_replacement_count(i, 3*(n-i)+s % 3)\n\n\n\n print((ans % (10**9 + 7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n s = int(input())\n\n dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]\n\n\n\n for i in range(6, s+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n\n\n print((dp[s] % (10**9+7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 24, "code_v1_loc": 12, "code_v0_num_chars": 468, "code_v1_num_chars": 228, "code_v0_no_empty_lines": "import math\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\ndef combinations_with_replacement_count(n, r):\n return combinations_count(n + r - 1, r)\n\n\ndef main():\n s = int(input())\n ans = 0\n n = s // 3\n for i in range(1, n + 1):\n ans += combinations_with_replacement_count(i, 3 * (n - i) + s % 3)\n print((ans % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n s = int(input())\n dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]\n for i in range(6, s + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n print((dp[s] % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-", "-def combinations_count(n, r):", "- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))", "-", "-", "-def combinations_with_replacement_count(n, r):", "- return combinations_count(n + r - 1, r)", "-", "-", "- ans = 0", "- n = s // 3", "- for i in range(1, n + 1):", "- ans += combinations_with_replacement_count(i, 3 * (n - i) + s % 3)", "- print((ans % (10**9 + 7)))", "+ dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]", "+ for i in range(6, s + 1):", "+ dp[i] = dp[i - 1] + dp[i - 3]", "+ print((dp[s] % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2865847409, "measured_runtime_v1": 0.2083418293, "runtime_lift": 1.3755506603, "key": ["s399411060", "s856192378"]} +{"user_id": "u001024152", "problem_id": "p03806", "language": "python", "submission_id_v0": "s636298531", "submission_id_v1": "s857325561", "cpu_time_v0": 1682, "cpu_time_v1": 292, "memory_v0": 59496, "memory_v1": 48860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.64, "input": "G_MAX = 40*10\n\nN_MAX = 40\n\nINF = float('inf')\n\n\n\ndp = [[[INF]*(G_MAX+1) for _ in range(G_MAX+1)] \n\n for _ in range(N_MAX+1)]\n\nN,Ma,Mb = list(map(int, input().split()))\n\na,b,c = [],[],[]\n\nfor _ in range(N):\n\n ai,bi,ci = list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\n c.append(ci)\n\n\n\ndp[0][0][0] = 0\n\nfrom math import isinf\n\nfor i in range(N):\n\n for ca in range(G_MAX+1):\n\n for cb in range(G_MAX+1):\n\n if isinf(dp[i][ca][cb]): continue\n\n dp[i+1][ca][cb] = min(dp[i+1][ca][cb],\n\n dp[i][ca][cb])\n\n dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]],\n\n dp[i][ca][cb]+c[i])\n\n \n\n \n\nans = INF\n\nfor ca in range(1,G_MAX+1):\n\n for cb in range(1,G_MAX+1):\n\n if ca*Mb==cb*Ma:\n\n ans = min(ans, dp[N][ca][cb])\n\n \n\nif isinf(ans): ans = -1\n\nprint(ans)", "target": "from math import isinf\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\na = [0]*N\n\nb = [0]*N\n\nc = [0]*N\n\nfor i in range(N):\n\n a[i],b[i],c[i] = list(map(int, input().split()))\n\n\n\nW_MAX = 40*10\n\ndp = [[float('inf')]*(W_MAX+1) for _ in range(W_MAX+1)]\n\ndp[0][0] = 0\n\n\n\nfor i in range(N):\n\n for wa in reversed(list(range(W_MAX+1))):\n\n for wb in reversed(list(range(W_MAX+1))):\n\n if isinf(dp[wa][wb]): continue\n\n if wa+a[i]<=W_MAX and wb+b[i]<=W_MAX:\n\n dp[wa+a[i]][wb+b[i]] = min(dp[wa+a[i]][wb+b[i]],\n\n dp[wa][wb]+c[i])\n\n\n\nans = float('inf')\n\nfor wa in range(1, W_MAX+1):\n\n for wb in range(1, W_MAX+1):\n\n if wa*Mb == wb*Ma:\n\n ans = min(ans, dp[wa][wb])\n\n\n\nif isinf(ans): ans = -1\n\nprint(ans)", "code_v0_loc": 34, "code_v1_loc": 29, "code_v0_num_chars": 926, "code_v1_num_chars": 775, "code_v0_no_empty_lines": "G_MAX = 40 * 10\nN_MAX = 40\nINF = float(\"inf\")\ndp = [[[INF] * (G_MAX + 1) for _ in range(G_MAX + 1)] for _ in range(N_MAX + 1)]\nN, Ma, Mb = list(map(int, input().split()))\na, b, c = [], [], []\nfor _ in range(N):\n ai, bi, ci = list(map(int, input().split()))\n a.append(ai)\n b.append(bi)\n c.append(ci)\ndp[0][0][0] = 0\nfrom math import isinf\n\nfor i in range(N):\n for ca in range(G_MAX + 1):\n for cb in range(G_MAX + 1):\n if isinf(dp[i][ca][cb]):\n continue\n dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb])\n dp[i + 1][ca + a[i]][cb + b[i]] = min(\n dp[i + 1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]\n )\nans = INF\nfor ca in range(1, G_MAX + 1):\n for cb in range(1, G_MAX + 1):\n if ca * Mb == cb * Ma:\n ans = min(ans, dp[N][ca][cb])\nif isinf(ans):\n ans = -1\nprint(ans)\n", "code_v1_no_empty_lines": "from math import isinf\n\nN, Ma, Mb = list(map(int, input().split()))\na = [0] * N\nb = [0] * N\nc = [0] * N\nfor i in range(N):\n a[i], b[i], c[i] = list(map(int, input().split()))\nW_MAX = 40 * 10\ndp = [[float(\"inf\")] * (W_MAX + 1) for _ in range(W_MAX + 1)]\ndp[0][0] = 0\nfor i in range(N):\n for wa in reversed(list(range(W_MAX + 1))):\n for wb in reversed(list(range(W_MAX + 1))):\n if isinf(dp[wa][wb]):\n continue\n if wa + a[i] <= W_MAX and wb + b[i] <= W_MAX:\n dp[wa + a[i]][wb + b[i]] = min(\n dp[wa + a[i]][wb + b[i]], dp[wa][wb] + c[i]\n )\nans = float(\"inf\")\nfor wa in range(1, W_MAX + 1):\n for wb in range(1, W_MAX + 1):\n if wa * Mb == wb * Ma:\n ans = min(ans, dp[wa][wb])\nif isinf(ans):\n ans = -1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 14.7058823529, "diff": ["-G_MAX = 40 * 10", "-N_MAX = 40", "-INF = float(\"inf\")", "-dp = [[[INF] * (G_MAX + 1) for _ in range(G_MAX + 1)] for _ in range(N_MAX + 1)]", "-N, Ma, Mb = list(map(int, input().split()))", "-a, b, c = [], [], []", "-for _ in range(N):", "- ai, bi, ci = list(map(int, input().split()))", "- a.append(ai)", "- b.append(bi)", "- c.append(ci)", "-dp[0][0][0] = 0", "+N, Ma, Mb = list(map(int, input().split()))", "+a = [0] * N", "+b = [0] * N", "+c = [0] * N", "- for ca in range(G_MAX + 1):", "- for cb in range(G_MAX + 1):", "- if isinf(dp[i][ca][cb]):", "+ a[i], b[i], c[i] = list(map(int, input().split()))", "+W_MAX = 40 * 10", "+dp = [[float(\"inf\")] * (W_MAX + 1) for _ in range(W_MAX + 1)]", "+dp[0][0] = 0", "+for i in range(N):", "+ for wa in reversed(list(range(W_MAX + 1))):", "+ for wb in reversed(list(range(W_MAX + 1))):", "+ if isinf(dp[wa][wb]):", "- dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb])", "- dp[i + 1][ca + a[i]][cb + b[i]] = min(", "- dp[i + 1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]", "- )", "-ans = INF", "-for ca in range(1, G_MAX + 1):", "- for cb in range(1, G_MAX + 1):", "- if ca * Mb == cb * Ma:", "- ans = min(ans, dp[N][ca][cb])", "+ if wa + a[i] <= W_MAX and wb + b[i] <= W_MAX:", "+ dp[wa + a[i]][wb + b[i]] = min(", "+ dp[wa + a[i]][wb + b[i]], dp[wa][wb] + c[i]", "+ )", "+ans = float(\"inf\")", "+for wa in range(1, W_MAX + 1):", "+ for wb in range(1, W_MAX + 1):", "+ if wa * Mb == wb * Ma:", "+ ans = min(ans, dp[wa][wb])"], "diff_only_import_comment": false, "measured_runtime_v0": 2.4082550259, "measured_runtime_v1": 0.8679478877, "runtime_lift": 2.7746539396, "key": ["s636298531", "s857325561"]} +{"user_id": "u170183831", "problem_id": "p03568", "language": "python", "submission_id_v0": "s971455595", "submission_id_v1": "s272804435", "cpu_time_v0": 148, "cpu_time_v1": 29, "memory_v0": 9116, "memory_v1": 9072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.41, "input": "from itertools import product\n\n\n\nn = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ncount = 0\n\nfor C in product((-1, 0, 1), repeat=n):\n\n total = 1\n\n for a, c in zip(A, C):\n\n total *= (a + c)\n\n if total % 2 == 0:\n\n count += 1\n\nprint(count)", "target": "n = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ncount = 1\n\nfor a in A:\n\n count *= 2 if a % 2 == 0 else 1\n\nprint((3 ** n - count))", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 253, "code_v1_num_chars": 137, "code_v0_no_empty_lines": "from itertools import product\n\nn = int(input())\nA = list(map(int, input().split()))\ncount = 0\nfor C in product((-1, 0, 1), repeat=n):\n total = 1\n for a, c in zip(A, C):\n total *= a + c\n if total % 2 == 0:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "n = int(input())\nA = list(map(int, input().split()))\ncount = 1\nfor a in A:\n count *= 2 if a % 2 == 0 else 1\nprint((3**n - count))\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["-from itertools import product", "-", "-count = 0", "-for C in product((-1, 0, 1), repeat=n):", "- total = 1", "- for a, c in zip(A, C):", "- total *= a + c", "- if total % 2 == 0:", "- count += 1", "-print(count)", "+count = 1", "+for a in A:", "+ count *= 2 if a % 2 == 0 else 1", "+print((3**n - count))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2956474931, "measured_runtime_v1": 0.0067464924, "runtime_lift": 43.8224007049, "key": ["s971455595", "s272804435"]} +{"user_id": "u440566786", "problem_id": "p03164", "language": "python", "submission_id_v0": "s415436180", "submission_id_v1": "s201445864", "cpu_time_v0": 345, "cpu_time_v1": 221, "memory_v0": 70988, "memory_v1": 40176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 35.94, "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n,W=list(map(int,input().split()))\n\n WV=[tuple(map(int,input().split())) for _ in range(n)]\n\n\n\n V=100000\n\n dp=[INF]*(V+1)\n\n dp[0]=0\n\n\n\n for w,v in WV:\n\n for x in range(V,-1,-1):\n\n if(x+v<=V):\n\n dp[x+v]=min(dp[x+v],dp[x]+w)\n\n\n\n for x in range(V,-1,-1):\n\n if(dp[x]<=W):\n\n print(x)\n\n return\n\nresolve()", "target": "import sys\n\nINF = 1 << 60\n\nMOD = 10**9 + 7 # 998244353\n\nsys.setrecursionlimit(2147483647)\n\ninput = lambda:sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n, W = list(map(int, input().split()))\n\n dp = [INF] * (n * 1001 + 1)\n\n dp[0] = 0\n\n for _ in range(n):\n\n w, v = list(map(int, input().split()))\n\n for v0 in range(n * 1001, -1, -1):\n\n if dp[v0] == INF:\n\n continue\n\n if v + v0 <= n * 1001:\n\n dp[v + v0] = min(dp[v + v0], dp[v0] + w)\n\n for v in range(n * 1001, -1, -1):\n\n if dp[v] <= W:\n\n print(v)\n\n return\n\nresolve()", "code_v0_loc": 23, "code_v1_loc": 21, "code_v0_num_chars": 515, "code_v1_num_chars": 614, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nMOD = 10**9 + 7\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n n, W = list(map(int, input().split()))\n WV = [tuple(map(int, input().split())) for _ in range(n)]\n V = 100000\n dp = [INF] * (V + 1)\n dp[0] = 0\n for w, v in WV:\n for x in range(V, -1, -1):\n if x + v <= V:\n dp[x + v] = min(dp[x + v], dp[x] + w)\n for x in range(V, -1, -1):\n if dp[x] <= W:\n print(x)\n return\n\n\nresolve()\n", "code_v1_no_empty_lines": "import sys\n\nINF = 1 << 60\nMOD = 10**9 + 7 # 998244353\nsys.setrecursionlimit(2147483647)\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n n, W = list(map(int, input().split()))\n dp = [INF] * (n * 1001 + 1)\n dp[0] = 0\n for _ in range(n):\n w, v = list(map(int, input().split()))\n for v0 in range(n * 1001, -1, -1):\n if dp[v0] == INF:\n continue\n if v + v0 <= n * 1001:\n dp[v + v0] = min(dp[v + v0], dp[v0] + w)\n for v in range(n * 1001, -1, -1):\n if dp[v] <= W:\n print(v)\n return\n\n\nresolve()\n", "code_same": false, "relative_loc_diff_percent": 8.6956521739, "diff": ["+INF = 1 << 60", "+MOD = 10**9 + 7 # 998244353", "-INF = float(\"inf\")", "-MOD = 10**9 + 7", "- WV = [tuple(map(int, input().split())) for _ in range(n)]", "- V = 100000", "- dp = [INF] * (V + 1)", "+ dp = [INF] * (n * 1001 + 1)", "- for w, v in WV:", "- for x in range(V, -1, -1):", "- if x + v <= V:", "- dp[x + v] = min(dp[x + v], dp[x] + w)", "- for x in range(V, -1, -1):", "- if dp[x] <= W:", "- print(x)", "+ for _ in range(n):", "+ w, v = list(map(int, input().split()))", "+ for v0 in range(n * 1001, -1, -1):", "+ if dp[v0] == INF:", "+ continue", "+ if v + v0 <= n * 1001:", "+ dp[v + v0] = min(dp[v + v0], dp[v0] + w)", "+ for v in range(n * 1001, -1, -1):", "+ if dp[v] <= W:", "+ print(v)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.2692114379, "measured_runtime_v1": 0.2021781888, "runtime_lift": 6.2776872491, "key": ["s415436180", "s201445864"]} +{"user_id": "u764956288", "problem_id": "p02691", "language": "python", "submission_id_v0": "s430506044", "submission_id_v1": "s372862352", "cpu_time_v0": 215, "cpu_time_v1": 188, "memory_v0": 57704, "memory_v1": 36612, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.56, "input": "from collections import defaultdict\n\n\n\n\n\ndef main():\n\n _ = int(input())\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n L[i + height] += 1\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "from collections import defaultdict\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n if i + height < N:\n\n L[i + height] += 1\n\n \n\n if i - height > 0:\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 30, "code_v1_loc": 33, "code_v0_num_chars": 565, "code_v1_num_chars": 639, "code_v0_no_empty_lines": "from collections import defaultdict\n\n\ndef main():\n _ = int(input())\n heights = list(map(int, input().split()))\n \"\"\"\n for j>i, j-i = Ai + Aj\n i + Ai = j -Aj\n \"\"\"\n L = defaultdict(int)\n R = defaultdict(int)\n for i, height in enumerate(heights):\n L[i + height] += 1\n R[i - height] += 1\n total_count = 0\n for x, count_l in list(L.items()):\n if x in R:\n count_r = R[x]\n total_count += count_l * count_r\n print(total_count)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\n\ndef main():\n N = int(input())\n heights = list(map(int, input().split()))\n \"\"\"\n for j>i, j-i = Ai + Aj\n i + Ai = j -Aj\n \"\"\"\n L = defaultdict(int)\n R = defaultdict(int)\n for i, height in enumerate(heights):\n if i + height < N:\n L[i + height] += 1\n if i - height > 0:\n R[i - height] += 1\n total_count = 0\n for x, count_l in list(L.items()):\n if x in R:\n count_r = R[x]\n total_count += count_l * count_r\n print(total_count)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["- _ = int(input())", "+ N = int(input())", "- L[i + height] += 1", "- R[i - height] += 1", "+ if i + height < N:", "+ L[i + height] += 1", "+ if i - height > 0:", "+ R[i - height] += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3616042199, "measured_runtime_v1": 0.2114392846, "runtime_lift": 1.7102035728, "key": ["s430506044", "s372862352"]} +{"user_id": "u747602774", "problem_id": "p03039", "language": "python", "submission_id_v0": "s387237372", "submission_id_v1": "s322645394", "cpu_time_v0": 230, "cpu_time_v1": 47, "memory_v0": 9412, "memory_v1": 9476, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 79.57, "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)//2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "target": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\nans = m*n*(m+n)*(m*n-1)//3\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "code_v0_loc": 42, "code_v1_loc": 27, "code_v0_num_chars": 809, "code_v1_num_chars": 519, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) // 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n a = n - x + 1\n b = m - y + 1\n c = m * (a * (a - 1) + x * (x - 1))\n d = n * (b * (b - 1) + y * (y - 1))\n ans += (c + d) // 2\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\nans = m * n * (m + n) * (m * n - 1) // 3\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 35.7142857143, "diff": ["-def f1(x, y, a, b):", "- return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2", "-", "-", "-def f2(x, a):", "- return (a - x) * (a - x + 1) // 2", "-", "-", "-ans = 0", "-for x in range(1, n + 1):", "- for y in range(1, m + 1):", "- a = n - x + 1", "- b = m - y + 1", "- c = m * (a * (a - 1) + x * (x - 1))", "- d = n * (b * (b - 1) + y * (y - 1))", "- ans += (c + d) // 2", "- ans %= mod", "+ans = m * n * (m + n) * (m * n - 1) // 3"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3618569455, "measured_runtime_v1": 0.2781652772, "runtime_lift": 1.3008702923, "key": ["s387237372", "s322645394"]} +{"user_id": "u800396927", "problem_id": "p03253", "language": "python", "submission_id_v0": "s723979708", "submission_id_v1": "s327831897", "cpu_time_v0": 110, "cpu_time_v1": 67, "memory_v0": 10868, "memory_v1": 66752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.09, "input": "N,M = list(map(int,input().split()))\n\ndiv =[]\n\nfor i in range(2,int(M**(1/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M = M//i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1: div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum = len(frac)\n\nfor i in range(len(frac)-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1] * (N+50)\n\nfinv[-1] = pow(frac[-1], mod-2, mod)\n\nfor i in range(1, num):\n\n finv[num-1-i] = finv[num-i] * (num-i) % mod\n\nans = 1\n\nfor i in div:\n\n ans = ans * frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)", "target": "N,M = list(map(int,input().split()))\n\ndiv = []\n\nfor i in range(2,int(M**(1/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M//=i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1:div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum=len(frac)\n\nfor i in range(num-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1]*(N+50)\n\nfinv[-1] = pow(frac[-1],mod-2,mod)\n\nans = 1\n\nfor i in range(1,num):\n\n finv[num-1-i] = finv[num-i]*(num-i)%mod\n\nfor i in div:\n\n ans =ans*frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)", "code_v0_loc": 24, "code_v1_loc": 24, "code_v0_num_chars": 554, "code_v1_num_chars": 534, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\ndiv = []\nfor i in range(2, int(M ** (1 / 2)) + 2):\n cur = 0\n while M % i == 0:\n M = M // i\n cur += 1\n if cur >= 1:\n div.append(cur)\nif M > 1:\n div.append(1)\ndiv.sort()\nmod = 10**9 + 7\nfrac = [1] * (N + 50)\nnum = len(frac)\nfor i in range(len(frac) - 1):\n frac[i + 1] = frac[i] * (i + 1) % mod\nfinv = [1] * (N + 50)\nfinv[-1] = pow(frac[-1], mod - 2, mod)\nfor i in range(1, num):\n finv[num - 1 - i] = finv[num - i] * (num - i) % mod\nans = 1\nfor i in div:\n ans = ans * frac[N + i - 1] * finv[N - 1] * finv[i] % mod\nprint(ans)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\ndiv = []\nfor i in range(2, int(M ** (1 / 2)) + 2):\n cur = 0\n while M % i == 0:\n M //= i\n cur += 1\n if cur >= 1:\n div.append(cur)\nif M > 1:\n div.append(1)\ndiv.sort()\nmod = 10**9 + 7\nfrac = [1] * (N + 50)\nnum = len(frac)\nfor i in range(num - 1):\n frac[i + 1] = frac[i] * (i + 1) % mod\nfinv = [1] * (N + 50)\nfinv[-1] = pow(frac[-1], mod - 2, mod)\nans = 1\nfor i in range(1, num):\n finv[num - 1 - i] = finv[num - i] * (num - i) % mod\nfor i in div:\n ans = ans * frac[N + i - 1] * finv[N - 1] * finv[i] % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- M = M // i", "+ M //= i", "-for i in range(len(frac) - 1):", "+for i in range(num - 1):", "+ans = 1", "-ans = 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.47082161, "measured_runtime_v1": 0.3749034932, "runtime_lift": 1.2558474875, "key": ["s723979708", "s327831897"]} +{"user_id": "u290563917", "problem_id": "p03371", "language": "python", "submission_id_v0": "s511736682", "submission_id_v1": "s377839923", "cpu_time_v0": 188, "cpu_time_v1": 64, "memory_v0": 40940, "memory_v1": 65396, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.96, "input": "a, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(c_max+1):\n\n ac = x - (cc // 2)\n\n bc = y - (cc // 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)", "target": "a, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(0, c_max+1, 2):\n\n ac = x - (cc // 2)\n\n bc = y - (cc // 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)\n\n ", "code_v0_loc": 23, "code_v1_loc": 24, "code_v0_num_chars": 436, "code_v1_num_chars": 446, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\n# print(a, b, c, x, y)\nans = 10000 * (10**5) + 7\nc_max = 0\nif x > y:\n c_max = x * 2\nelse:\n c_max = y * 2\nfor cc in range(c_max + 1):\n ac = x - (cc // 2)\n bc = y - (cc // 2)\n if ac < 0:\n ac = 0\n if bc < 0:\n bc = 0\n price = ac * a + bc * b + cc * c\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n ans = min(ans, price)\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\n# print(a, b, c, x, y)\nans = 10000 * (10**5) + 7\nc_max = 0\nif x > y:\n c_max = x * 2\nelse:\n c_max = y * 2\nfor cc in range(0, c_max + 1, 2):\n ac = x - (cc // 2)\n bc = y - (cc // 2)\n if ac < 0:\n ac = 0\n if bc < 0:\n bc = 0\n price = ac * a + bc * b + cc * c\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n ans = min(ans, price)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.1666666667, "diff": ["-for cc in range(c_max + 1):", "+for cc in range(0, c_max + 1, 2):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4004499781, "measured_runtime_v1": 0.3093135242, "runtime_lift": 1.2946410251, "key": ["s511736682", "s377839923"]} +{"user_id": "u887207211", "problem_id": "p03425", "language": "python", "submission_id_v0": "s819679830", "submission_id_v1": "s546088432", "cpu_time_v0": 172, "cpu_time_v1": 153, "memory_v0": 3064, "memory_v1": 9752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.05, "input": "N = int(input())\n\nname = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor _ in range(N):\n\n S = input()\n\n if(S[0] in name):\n\n name[S[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += name[march[i]] * name[march[j]] * name[march[k]]\n\nprint(ans)", "target": "N = int(input())\n\nS = [input() for _ in range(N)]\n\n\n\nhead = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor s in S:\n\n if(s[0] in head):\n\n head[s[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += head[march[i]] * head[march[j]] * head[march[k]]\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 14, "code_v0_num_chars": 312, "code_v1_num_chars": 325, "code_v0_no_empty_lines": "N = int(input())\nname = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}\nmarch = \"MARCH\"\nfor _ in range(N):\n S = input()\n if S[0] in name:\n name[S[0]] += 1\nans = 0\nfor i in range(3):\n for j in range(i + 1, 4):\n for k in range(j + 1, 5):\n ans += name[march[i]] * name[march[j]] * name[march[k]]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nS = [input() for _ in range(N)]\nhead = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}\nmarch = \"MARCH\"\nfor s in S:\n if s[0] in head:\n head[s[0]] += 1\nans = 0\nfor i in range(3):\n for j in range(i + 1, 4):\n for k in range(j + 1, 5):\n ans += head[march[i]] * head[march[j]] * head[march[k]]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-name = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "+S = [input() for _ in range(N)]", "+head = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "-for _ in range(N):", "- S = input()", "- if S[0] in name:", "- name[S[0]] += 1", "+for s in S:", "+ if s[0] in head:", "+ head[s[0]] += 1", "- ans += name[march[i]] * name[march[j]] * name[march[k]]", "+ ans += head[march[i]] * head[march[j]] * head[march[k]]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4009393435, "measured_runtime_v1": 0.3106073449, "runtime_lift": 1.2908237686, "key": ["s819679830", "s546088432"]} +{"user_id": "u023958502", "problem_id": "p02899", "language": "python", "submission_id_v0": "s601919152", "submission_id_v1": "s937084523", "cpu_time_v0": 140, "cpu_time_v1": 86, "memory_v0": 19300, "memory_v1": 15588, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 38.57, "input": "n = int(input())\n\na = list(map(int,input().split()))\n\nans = [i for i in range(n)]\n\na1 = sorted(a)\n\nfor i in range(n):\n\n num = a[i]\n\n ans[num - 1] = str(i + 1)\n\n \n\nprint((' '.join(ans)))", "target": "n = int(input())\n\n# n,k = map(int,input().split())\n\na = list(map(int,input().split()))\n\nans = [0 for _ in range(n)]\n\nfor i in range(n):\n\n ans[a[i] - 1] = str(i + 1)\n\nprint((\" \".join(ans)))", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 192, "code_v1_num_chars": 187, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nans = [i for i in range(n)]\na1 = sorted(a)\nfor i in range(n):\n num = a[i]\n ans[num - 1] = str(i + 1)\nprint((\" \".join(ans)))\n", "code_v1_no_empty_lines": "n = int(input())\n# n,k = map(int,input().split())\na = list(map(int, input().split()))\nans = [0 for _ in range(n)]\nfor i in range(n):\n ans[a[i] - 1] = str(i + 1)\nprint((\" \".join(ans)))\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["+# n,k = map(int,input().split())", "-ans = [i for i in range(n)]", "-a1 = sorted(a)", "+ans = [0 for _ in range(n)]", "- num = a[i]", "- ans[num - 1] = str(i + 1)", "+ ans[a[i] - 1] = str(i + 1)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2984062884, "measured_runtime_v1": 0.2260574257, "runtime_lift": 1.3200463887, "key": ["s601919152", "s937084523"]} +{"user_id": "u312025627", "problem_id": "p02901", "language": "python", "submission_id_v0": "s827366183", "submission_id_v1": "s086626630", "cpu_time_v0": 364, "cpu_time_v1": 311, "memory_v0": 78552, "memory_v1": 75116, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.56, "input": "INF = 2*10**7\n\n\n\n\n\ndef main():\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "INF = 2*10**7\n\n\n\n\n\ndef main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 34, "code_v1_loc": 36, "code_v0_num_chars": 827, "code_v1_num_chars": 882, "code_v0_no_empty_lines": "INF = 2 * 10**7\n\n\ndef main():\n N, M = (int(i) for i in input().split())\n A = []\n B = []\n C = []\n for _ in range(M):\n a, b = (int(i) for i in input().split())\n A.append(a)\n B.append(b)\n bit = 0\n for i in input().split():\n bit |= 1 << (int(i) - 1)\n C.append(bit)\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n if dp[i][j] != INF:\n next_bit = j | C[i]\n dp[i + 1][next_bit] = min(dp[i + 1][next_bit], dp[i][j] + A[i])\n ans = dp[-1][-1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n # print(*dp, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "INF = 2 * 10**7\n\n\ndef main():\n import sys\n\n input = sys.stdin.buffer.readline\n N, M = (int(i) for i in input().split())\n A = []\n B = []\n C = []\n for _ in range(M):\n a, b = (int(i) for i in input().split())\n A.append(a)\n B.append(b)\n bit = 0\n for i in input().split():\n bit |= 1 << (int(i) - 1)\n C.append(bit)\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n if dp[i][j] != INF:\n next_bit = j | C[i]\n dp[i + 1][next_bit] = min(dp[i + 1][next_bit], dp[i][j] + A[i])\n ans = dp[-1][-1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n # print(*dp, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 5.5555555556, "diff": ["+ import sys", "+", "+ input = sys.stdin.buffer.readline"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4147989278, "measured_runtime_v1": 0.289175185, "runtime_lift": 1.4344208955, "key": ["s827366183", "s086626630"]} +{"user_id": "u427344224", "problem_id": "p03253", "language": "python", "submission_id_v0": "s043094515", "submission_id_v1": "s952701444", "cpu_time_v0": 1290, "cpu_time_v1": 20, "memory_v0": 5164, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 98.45, "input": "def prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num //= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\nfrom math import factorial\n\n\n\n\n\ndef comb(n, r, R):\n\n if n not in R:\n\n a = factorial(n)\n\n R[n] = a\n\n else:\n\n a = R[n]\n\n\n\n if n - r not in R:\n\n b = factorial(n - r)\n\n R[n - r] = b\n\n else:\n\n b = R[n - r]\n\n\n\n if r not in R:\n\n c = factorial(r)\n\n R[r] = c\n\n else:\n\n c = R[r]\n\n return a // (b * c)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nR = dict()\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= comb(v + n - 1, v, R)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n", "target": "def prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num //= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\n\n\ndef combination(n, r):\n\n r = min(n-r, r)\n\n result = 1\n\n for i in range(n, n-r, -1):\n\n result *= i\n\n for i in range(1, r+1):\n\n result //= i\n\n return result\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= combination(v + n - 1, v)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n", "code_v0_loc": 56, "code_v1_loc": 42, "code_v0_num_chars": 1269, "code_v1_num_chars": 1072, "code_v0_no_empty_lines": "def prime_factorize(num):\n \"\"\"\n This function performs prime factorization on the input natural number.\n The result is returned in the form of a dictionary with the prime number as the key\n and its number as the value.\n :param num:\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n \"\"\"\n prime_factor = {}\n i = 2\n while i**2 <= num:\n while num % i == 0:\n num //= i\n if i in list(prime_factor.keys()):\n prime_factor[i] += 1\n else:\n prime_factor[i] = 1\n i += 1\n if num > 1:\n prime_factor[num] = 1\n return prime_factor\n\n\nfrom math import factorial\n\n\ndef comb(n, r, R):\n if n not in R:\n a = factorial(n)\n R[n] = a\n else:\n a = R[n]\n if n - r not in R:\n b = factorial(n - r)\n R[n - r] = b\n else:\n b = R[n - r]\n if r not in R:\n c = factorial(r)\n R[r] = c\n else:\n c = R[r]\n return a // (b * c)\n\n\nn, m = list(map(int, input().split()))\nr = 1\nR = dict()\nprime_fac = prime_factorize(m)\nfor v in list(prime_fac.values()):\n r *= comb(v + n - 1, v, R)\nmod = 1000000000 + 7\nprint((r % mod))\n", "code_v1_no_empty_lines": "def prime_factorize(num):\n \"\"\"\n This function performs prime factorization on the input natural number.\n The result is returned in the form of a dictionary with the prime number as the key\n and its number as the value.\n :param num:\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n \"\"\"\n prime_factor = {}\n i = 2\n while i**2 <= num:\n while num % i == 0:\n num //= i\n if i in list(prime_factor.keys()):\n prime_factor[i] += 1\n else:\n prime_factor[i] = 1\n i += 1\n if num > 1:\n prime_factor[num] = 1\n return prime_factor\n\n\ndef combination(n, r):\n r = min(n - r, r)\n result = 1\n for i in range(n, n - r, -1):\n result *= i\n for i in range(1, r + 1):\n result //= i\n return result\n\n\nn, m = list(map(int, input().split()))\nr = 1\nprime_fac = prime_factorize(m)\nfor v in list(prime_fac.values()):\n r *= combination(v + n - 1, v)\nmod = 1000000000 + 7\nprint((r % mod))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-from math import factorial", "-", "-", "-def comb(n, r, R):", "- if n not in R:", "- a = factorial(n)", "- R[n] = a", "- else:", "- a = R[n]", "- if n - r not in R:", "- b = factorial(n - r)", "- R[n - r] = b", "- else:", "- b = R[n - r]", "- if r not in R:", "- c = factorial(r)", "- R[r] = c", "- else:", "- c = R[r]", "- return a // (b * c)", "+def combination(n, r):", "+ r = min(n - r, r)", "+ result = 1", "+ for i in range(n, n - r, -1):", "+ result *= i", "+ for i in range(1, r + 1):", "+ result //= i", "+ return result", "-R = dict()", "- r *= comb(v + n - 1, v, R)", "+ r *= combination(v + n - 1, v)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4743831277, "measured_runtime_v1": 0.1920195122, "runtime_lift": 2.4704943903, "key": ["s043094515", "s952701444"]} +{"user_id": "u768896740", "problem_id": "p02951", "language": "python", "submission_id_v0": "s688063139", "submission_id_v1": "s870650241", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif a < b + c:\n\n print((b+c-a))\n\nelse:\n\n print((0))", "target": "a,b,c = list(map(int, input().split()))\n\n\n\nprint((max(0, c-(a-b))))", "code_v0_loc": 6, "code_v1_loc": 3, "code_v0_num_chars": 91, "code_v1_num_chars": 59, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif a < b + c:\n print((b + c - a))\nelse:\n print((0))\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nprint((max(0, c - (a - b))))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-if a < b + c:", "- print((b + c - a))", "-else:", "- print((0))", "+print((max(0, c - (a - b))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2555535069, "measured_runtime_v1": 0.0829026203, "runtime_lift": 3.0825745416, "key": ["s688063139", "s870650241"]} +{"user_id": "u075012704", "problem_id": "p03038", "language": "python", "submission_id_v0": "s846597544", "submission_id_v1": "s758849446", "cpu_time_v0": 756, "cpu_time_v1": 520, "memory_v0": 43296, "memory_v1": 25512, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 31.22, "input": "from collections import Counter\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\nX = Counter(A)\n\nfor i in range(M):\n\n B, C = list(map(int, input().split()))\n\n X[C] += B\n\n\n\nZ = []\n\nfor key, value in list(X.items()):\n\n Z.append((key, value))\n\n\n\nZ.sort(key=lambda x: x[0], reverse=True)\n\n\n\nans = 0\n\ncnt = 0\n\n\n\nfor value, key in Z:\n\n if cnt + key <= N:\n\n ans += key * value\n\n cnt += key\n\n else:\n\n ans += (N - cnt) * value\n\n break\n\n\n\nprint(ans)\n", "target": "N, M = list(map(int, input().split()))\n\nA = sorted(list(map(int, input().split())))\n\nquery = []\n\nfor i in range(M):\n\n b, c = list(map(int, input().split()))\n\n query.append([b, c])\n\nquery.sort(key=lambda q: q[1], reverse=True)\n\n\n\n\n\ni = 0\n\nfor b, c in query:\n\n while i < N and b > 0:\n\n if A[i] < c:\n\n A[i] = c\n\n b -= 1\n\n i += 1\n\n\n\nprint((sum(A)))\n", "code_v0_loc": 27, "code_v1_loc": 18, "code_v0_num_chars": 496, "code_v1_num_chars": 376, "code_v0_no_empty_lines": "from collections import Counter\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nX = Counter(A)\nfor i in range(M):\n B, C = list(map(int, input().split()))\n X[C] += B\nZ = []\nfor key, value in list(X.items()):\n Z.append((key, value))\nZ.sort(key=lambda x: x[0], reverse=True)\nans = 0\ncnt = 0\nfor value, key in Z:\n if cnt + key <= N:\n ans += key * value\n cnt += key\n else:\n ans += (N - cnt) * value\n break\nprint(ans)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())))\nquery = []\nfor i in range(M):\n b, c = list(map(int, input().split()))\n query.append([b, c])\nquery.sort(key=lambda q: q[1], reverse=True)\ni = 0\nfor b, c in query:\n while i < N and b > 0:\n if A[i] < c:\n A[i] = c\n b -= 1\n i += 1\nprint((sum(A)))\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-from collections import Counter", "-", "-A = list(map(int, input().split()))", "-X = Counter(A)", "+A = sorted(list(map(int, input().split())))", "+query = []", "- B, C = list(map(int, input().split()))", "- X[C] += B", "-Z = []", "-for key, value in list(X.items()):", "- Z.append((key, value))", "-Z.sort(key=lambda x: x[0], reverse=True)", "-ans = 0", "-cnt = 0", "-for value, key in Z:", "- if cnt + key <= N:", "- ans += key * value", "- cnt += key", "- else:", "- ans += (N - cnt) * value", "- break", "-print(ans)", "+ b, c = list(map(int, input().split()))", "+ query.append([b, c])", "+query.sort(key=lambda q: q[1], reverse=True)", "+i = 0", "+for b, c in query:", "+ while i < N and b > 0:", "+ if A[i] < c:", "+ A[i] = c", "+ b -= 1", "+ i += 1", "+print((sum(A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.254084451, "measured_runtime_v1": 0.0066267376, "runtime_lift": 38.3423135365, "key": ["s846597544", "s758849446"]} +{"user_id": "u576335153", "problem_id": "p03723", "language": "python", "submission_id_v0": "s032726803", "submission_id_v1": "s012708150", "cpu_time_v0": 58, "cpu_time_v1": 26, "memory_v0": 32492, "memory_v1": 9200, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.17, "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif any(i % 2 != 0 for i in [a, b, c]):\n\n print((0))\n\n exit()\n\n\n\nif a == b and b == c:\n\n print((-1))\n\n exit()\n\n\n\ncnt = 0\n\na_list = [0]*(1001001)\n\nb_list = [0]*(1001001)\n\nc_list = [0]*(1001001)\n\na_list[0] = a\n\nb_list[0] = b\n\nc_list[0] = c\n\n\n\nfor i in range(1, 1001001):\n\n a_list[i] = (b_list[i-1] + c_list[i-1]) // 2\n\n b_list[i] = (c_list[i-1] + a_list[i-1]) // 2\n\n c_list[i] = (a_list[i-1] + b_list[i-1]) // 2\n\n cnt += 1\n\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n\n break\n\n\n\nprint(cnt)\n", "target": "def solve(a, b, c):\n\n if any(i % 2 == 1 for i in [a, b, c]):\n\n return 0\n\n if a == b == c:\n\n return -1\n\n a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2\n\n return solve(a, b, c) + 1\n\n\n\na, b, c = list(map(int, input().split()))\n\n\n\nprint((solve(a, b, c)))", "code_v0_loc": 27, "code_v1_loc": 11, "code_v0_num_chars": 580, "code_v1_num_chars": 272, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif any(i % 2 != 0 for i in [a, b, c]):\n print((0))\n exit()\nif a == b and b == c:\n print((-1))\n exit()\ncnt = 0\na_list = [0] * (1001001)\nb_list = [0] * (1001001)\nc_list = [0] * (1001001)\na_list[0] = a\nb_list[0] = b\nc_list[0] = c\nfor i in range(1, 1001001):\n a_list[i] = (b_list[i - 1] + c_list[i - 1]) // 2\n b_list[i] = (c_list[i - 1] + a_list[i - 1]) // 2\n c_list[i] = (a_list[i - 1] + b_list[i - 1]) // 2\n cnt += 1\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n break\nprint(cnt)\n", "code_v1_no_empty_lines": "def solve(a, b, c):\n if any(i % 2 == 1 for i in [a, b, c]):\n return 0\n if a == b == c:\n return -1\n a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2\n return solve(a, b, c) + 1\n\n\na, b, c = list(map(int, input().split()))\nprint((solve(a, b, c)))\n", "code_same": false, "relative_loc_diff_percent": 59.2592592593, "diff": ["+def solve(a, b, c):", "+ if any(i % 2 == 1 for i in [a, b, c]):", "+ return 0", "+ if a == b == c:", "+ return -1", "+ a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2", "+ return solve(a, b, c) + 1", "+", "+", "-if any(i % 2 != 0 for i in [a, b, c]):", "- print((0))", "- exit()", "-if a == b and b == c:", "- print((-1))", "- exit()", "-cnt = 0", "-a_list = [0] * (1001001)", "-b_list = [0] * (1001001)", "-c_list = [0] * (1001001)", "-a_list[0] = a", "-b_list[0] = b", "-c_list[0] = c", "-for i in range(1, 1001001):", "- a_list[i] = (b_list[i - 1] + c_list[i - 1]) // 2", "- b_list[i] = (c_list[i - 1] + a_list[i - 1]) // 2", "- c_list[i] = (a_list[i - 1] + b_list[i - 1]) // 2", "- cnt += 1", "- if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:", "- break", "-print(cnt)", "+print((solve(a, b, c)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6101216149, "measured_runtime_v1": 0.3266951015, "runtime_lift": 1.8675566671, "key": ["s032726803", "s012708150"]} +{"user_id": "u463655976", "problem_id": "p03013", "language": "python", "submission_id_v0": "s227334045", "submission_id_v1": "s524241188", "cpu_time_v0": 285, "cpu_time_v1": 189, "memory_v0": 22940, "memory_v1": 7836, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.68, "input": "from functools import lru_cache\n\nimport sys\n\nsys.setrecursionlimit(30000)\n\n\n\nN, M = list(map(int, input().split()))\n\na = list(int(input()) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nisOk = True\n\nfor i in range(M-1):\n\n if a[i] + 1 == a[i+1]:\n\n isOk = False\n\n \n\nfuncb = [-1] * 100001\n\ndef func(n):\n\n if n <= 0:\n\n return 1\n\n cnt = funcb[n]\n\n if cnt > 0:\n\n return cnt\n\n cnt = 0\n\n if n >= 2:\n\n cnt += func(n-2)\n\n if n >= 1:\n\n cnt += func(n-1)\n\n funcb[n] = cnt % MOD\n\n return funcb[n]\n\n\n\nfunc(30000)\n\nfunc(50000)\n\nfunc(80000)\n\nfunc(100000)\n\n\n\nif not isOk:\n\n print((0))\n\nelse:\n\n ans = 1\n\n s = 0\n\n for i in range(M+1):\n\n if i >= M:\n\n e = N\n\n else:\n\n e = a[i] - 1\n\n\n\n ans = ans * func(e-s) % MOD\n\n\n\n if i >= M:\n\n break\n\n\n\n s = a[i] + 1\n\n\n\n print(ans)\n", "target": "N, M = list(map(int, input().split()))\n\na = list(int(input()) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nMAP = [0] * (N + 1)\n\n\n\nfor x in a:\n\n MAP[x] = -1\n\n\n\nMAP[0] = 1 \n\nfor i in range(N):\n\n if MAP[i] < 0:\n\n continue\n\n\n\n MAP[i] %= MOD\n\n if i + 1 <= N and MAP[i+1] >= 0:\n\n MAP[i+1] += MAP[i]\n\n if i + 2 <= N and MAP[i+2] >= 0:\n\n MAP[i+2] += MAP[i]\n\n\n\nprint((MAP[N] % MOD))\n", "code_v0_loc": 53, "code_v1_loc": 22, "code_v0_num_chars": 885, "code_v1_num_chars": 403, "code_v0_no_empty_lines": "from functools import lru_cache\nimport sys\n\nsys.setrecursionlimit(30000)\nN, M = list(map(int, input().split()))\na = list(int(input()) for _ in range(M))\nMOD = pow(10, 9) + 7\nisOk = True\nfor i in range(M - 1):\n if a[i] + 1 == a[i + 1]:\n isOk = False\nfuncb = [-1] * 100001\n\n\ndef func(n):\n if n <= 0:\n return 1\n cnt = funcb[n]\n if cnt > 0:\n return cnt\n cnt = 0\n if n >= 2:\n cnt += func(n - 2)\n if n >= 1:\n cnt += func(n - 1)\n funcb[n] = cnt % MOD\n return funcb[n]\n\n\nfunc(30000)\nfunc(50000)\nfunc(80000)\nfunc(100000)\nif not isOk:\n print((0))\nelse:\n ans = 1\n s = 0\n for i in range(M + 1):\n if i >= M:\n e = N\n else:\n e = a[i] - 1\n ans = ans * func(e - s) % MOD\n if i >= M:\n break\n s = a[i] + 1\n print(ans)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\na = list(int(input()) for _ in range(M))\nMOD = pow(10, 9) + 7\nMAP = [0] * (N + 1)\nfor x in a:\n MAP[x] = -1\nMAP[0] = 1\nfor i in range(N):\n if MAP[i] < 0:\n continue\n MAP[i] %= MOD\n if i + 1 <= N and MAP[i + 1] >= 0:\n MAP[i + 1] += MAP[i]\n if i + 2 <= N and MAP[i + 2] >= 0:\n MAP[i + 2] += MAP[i]\nprint((MAP[N] % MOD))\n", "code_same": false, "relative_loc_diff_percent": 58.4905660377, "diff": ["-from functools import lru_cache", "-import sys", "-", "-sys.setrecursionlimit(30000)", "-isOk = True", "-for i in range(M - 1):", "- if a[i] + 1 == a[i + 1]:", "- isOk = False", "-funcb = [-1] * 100001", "-", "-", "-def func(n):", "- if n <= 0:", "- return 1", "- cnt = funcb[n]", "- if cnt > 0:", "- return cnt", "- cnt = 0", "- if n >= 2:", "- cnt += func(n - 2)", "- if n >= 1:", "- cnt += func(n - 1)", "- funcb[n] = cnt % MOD", "- return funcb[n]", "-", "-", "-func(30000)", "-func(50000)", "-func(80000)", "-func(100000)", "-if not isOk:", "- print((0))", "-else:", "- ans = 1", "- s = 0", "- for i in range(M + 1):", "- if i >= M:", "- e = N", "- else:", "- e = a[i] - 1", "- ans = ans * func(e - s) % MOD", "- if i >= M:", "- break", "- s = a[i] + 1", "- print(ans)", "+MAP = [0] * (N + 1)", "+for x in a:", "+ MAP[x] = -1", "+MAP[0] = 1", "+for i in range(N):", "+ if MAP[i] < 0:", "+ continue", "+ MAP[i] %= MOD", "+ if i + 1 <= N and MAP[i + 1] >= 0:", "+ MAP[i + 1] += MAP[i]", "+ if i + 2 <= N and MAP[i + 2] >= 0:", "+ MAP[i + 2] += MAP[i]", "+print((MAP[N] % MOD))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0640589638, "measured_runtime_v1": 0.2648930094, "runtime_lift": 4.0169386351, "key": ["s227334045", "s524241188"]} +{"user_id": "u254871849", "problem_id": "p02921", "language": "python", "submission_id_v0": "s533958811", "submission_id_v1": "s140590362", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "# 2019-11-17 20:44:23(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# import re\n\n# import heapq\n\n# import array\n\n# from scipy.misc import comb # (default: exact=False)\n\n# import numpy as np \n\n\n\n\n\ndef main():\n\n s, t = sys.stdin.read().split()\n\n\n\n count = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "import sys\n\n\n\ns, t = sys.stdin.read().split()\n\n\n\ndef main():\n\n cnt = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n cnt += 1\n\n return cnt\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 28, "code_v1_loc": 14, "code_v0_num_chars": 611, "code_v1_num_chars": 229, "code_v0_no_empty_lines": "# 2019-11-17 20:44:23(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# import re\n# import heapq\n# import array\n# from scipy.misc import comb # (default: exact=False)\n# import numpy as np\ndef main():\n s, t = sys.stdin.read().split()\n count = 0\n for i in range(3):\n if s[i] == t[i]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ns, t = sys.stdin.read().split()\n\n\ndef main():\n cnt = 0\n for i in range(3):\n if s[i] == t[i]:\n cnt += 1\n return cnt\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-# 2019-11-17 20:44:23(JST)", "-# import collections", "-# import math", "-# from string import ascii_lowercase, ascii_uppercase, digits", "-# from bisect import bisect_left as bi_l, bisect_right as bi_r", "-# import itertools", "-# from functools import reduce", "-# import operator as op", "-# import re", "-# import heapq", "-# import array", "-# from scipy.misc import comb # (default: exact=False)", "-# import numpy as np", "+s, t = sys.stdin.read().split()", "+", "+", "- s, t = sys.stdin.read().split()", "- count = 0", "+ cnt = 0", "- count += 1", "- print(count)", "+ cnt += 1", "+ return cnt", "- main()", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2871051877, "measured_runtime_v1": 0.085240711, "runtime_lift": 3.3681697905, "key": ["s533958811", "s140590362"]} +{"user_id": "u254871849", "problem_id": "p03416", "language": "python", "submission_id_v0": "s286428945", "submission_id_v1": "s838954646", "cpu_time_v0": 41, "cpu_time_v1": 20, "memory_v0": 2940, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 51.22, "input": "# author: kagemeka \n\n# created: 2019-11-06 21:30:22(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\n# import statistics\n\n# import functools\n\n# import operator\n\n\n\ndef main():\n\n a, b = (int(x) for x in sys.stdin.read().split())\n\n\n\n count = 0\n\n for n in range(a, b+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n count += 1\n\n\n\n print(count) \n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n", "target": "import sys\n\nfrom bisect import bisect_left as bi_l, bisect_right as bi_r\n\n\n\na, b = list(map(int, sys.stdin.readline().split()))\n\n\n\ndef main():\n\n palindromic_nums = []\n\n for i in range(1, 10):\n\n for j in range(10):\n\n for k in range(10):\n\n x = [i, j, k, j, i]\n\n palindromic_nums.append(int(''.join(list(map(str, x)))))\n\n\n\n return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 27, "code_v1_loc": 18, "code_v0_num_chars": 576, "code_v1_num_chars": 512, "code_v0_no_empty_lines": "# author: kagemeka\n# created: 2019-11-06 21:30:22(JST)\nimport sys\n\n# import collections\n# import math\n# import string\n# import bisect\n# import re\n# import itertools\n# import statistics\n# import functools\n# import operator\ndef main():\n a, b = (int(x) for x in sys.stdin.read().split())\n count = 0\n for n in range(a, b + 1):\n n = str(n)\n if n == n[::-1]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n", "code_v1_no_empty_lines": "import sys\nfrom bisect import bisect_left as bi_l, bisect_right as bi_r\n\na, b = list(map(int, sys.stdin.readline().split()))\n\n\ndef main():\n palindromic_nums = []\n for i in range(1, 10):\n for j in range(10):\n for k in range(10):\n x = [i, j, k, j, i]\n palindromic_nums.append(int(\"\".join(list(map(str, x)))))\n return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-# author: kagemeka", "-# created: 2019-11-06 21:30:22(JST)", "+from bisect import bisect_left as bi_l, bisect_right as bi_r", "-# import collections", "-# import math", "-# import string", "-# import bisect", "-# import re", "-# import itertools", "-# import statistics", "-# import functools", "-# import operator", "+a, b = list(map(int, sys.stdin.readline().split()))", "+", "+", "- a, b = (int(x) for x in sys.stdin.read().split())", "- count = 0", "- for n in range(a, b + 1):", "- n = str(n)", "- if n == n[::-1]:", "- count += 1", "- print(count)", "+ palindromic_nums = []", "+ for i in range(1, 10):", "+ for j in range(10):", "+ for k in range(10):", "+ x = [i, j, k, j, i]", "+ palindromic_nums.append(int(\"\".join(list(map(str, x)))))", "+ return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)", "- # execute only if run as a script", "- main()", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2528932301, "measured_runtime_v1": 0.1923888798, "runtime_lift": 1.314489852, "key": ["s286428945", "s838954646"]} +{"user_id": "u729939940", "problem_id": "p02767", "language": "python", "submission_id_v0": "s286517602", "submission_id_v1": "s316820501", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N = int(input())\n\nX = list(map(int, input().split()))\n\nX = list(sorted(X))\n\nif N == 1:\n\n print((0))\n\n exit()\n\nans = float('inf')\n\nfor p in range(X[0], X[N - 1] + 1):\n\n sum = 0\n\n for x in X:\n\n sum += (x - p) ** 2\n\n ans = min(sum, ans)\n\nprint(ans)", "target": "N = int(input())\n\nX = list(map(int, input().split()))\n\navg = round(sum(X) / N)\n\nprint((sum([(x - avg) ** 2 for x in X])))", "code_v0_loc": 13, "code_v1_loc": 4, "code_v0_num_chars": 251, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "N = int(input())\nX = list(map(int, input().split()))\nX = list(sorted(X))\nif N == 1:\n print((0))\n exit()\nans = float(\"inf\")\nfor p in range(X[0], X[N - 1] + 1):\n sum = 0\n for x in X:\n sum += (x - p) ** 2\n ans = min(sum, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nX = list(map(int, input().split()))\navg = round(sum(X) / N)\nprint((sum([(x - avg) ** 2 for x in X])))\n", "code_same": false, "relative_loc_diff_percent": 69.2307692308, "diff": ["-X = list(sorted(X))", "-if N == 1:", "- print((0))", "- exit()", "-ans = float(\"inf\")", "-for p in range(X[0], X[N - 1] + 1):", "- sum = 0", "- for x in X:", "- sum += (x - p) ** 2", "- ans = min(sum, ans)", "-print(ans)", "+avg = round(sum(X) / N)", "+print((sum([(x - avg) ** 2 for x in X])))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2590025333, "measured_runtime_v1": 0.1089487125, "runtime_lift": 2.3772886094, "key": ["s286517602", "s316820501"]} +{"user_id": "u628335443", "problem_id": "p02725", "language": "python", "submission_id_v0": "s320196234", "submission_id_v1": "s733866625", "cpu_time_v0": 189, "cpu_time_v1": 163, "memory_v0": 26444, "memory_v1": 26444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.76, "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd = [0] * n\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d[i] = a[i + 1] - a[i]\n\n d_max = max(d_max, d[i])\n\n\n\nd[-1] = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d[-1])\n\n\n\nprint((k - d_max))\n", "target": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d = a[i + 1] - a[i]\n\n d_max = max(d_max, d)\n\n\n\nd = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d)\n\n\n\nprint((k - d_max))\n", "code_v0_loc": 13, "code_v1_loc": 12, "code_v0_num_chars": 255, "code_v1_num_chars": 228, "code_v0_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nd = [0] * n\nd_max = 0\nfor i in range(n - 1):\n d[i] = a[i + 1] - a[i]\n d_max = max(d_max, d[i])\nd[-1] = (k - a[-1]) + a[0]\nd_max = max(d_max, d[-1])\nprint((k - d_max))\n", "code_v1_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nd_max = 0\nfor i in range(n - 1):\n d = a[i + 1] - a[i]\n d_max = max(d_max, d)\nd = (k - a[-1]) + a[0]\nd_max = max(d_max, d)\nprint((k - d_max))\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["-d = [0] * n", "- d[i] = a[i + 1] - a[i]", "- d_max = max(d_max, d[i])", "-d[-1] = (k - a[-1]) + a[0]", "-d_max = max(d_max, d[-1])", "+ d = a[i + 1] - a[i]", "+ d_max = max(d_max, d)", "+d = (k - a[-1]) + a[0]", "+d_max = max(d_max, d)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3049341288, "measured_runtime_v1": 0.200526454, "runtime_lift": 1.5206678356, "key": ["s320196234", "s733866625"]} +{"user_id": "u864197622", "problem_id": "p02822", "language": "python", "submission_id_v0": "s981663077", "submission_id_v1": "s820806781", "cpu_time_v0": 1240, "cpu_time_v1": 890, "memory_v0": 93784, "memory_v1": 100756, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.23, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\ninv2 = (mod + 1) // 2\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n\n for j in X[i]:\n\n s = (s * pow(inv2, A[j], mod)) % mod\n\n t = (t + (1-pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))", "target": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\npow2 = [1]\n\nfor i in range(N + 10):\n\n pow2.append(pow2[-1] * 2 % mod)\n\ninv2 = (mod + 1) // 2\n\n\n\ninvpow2 = [pow(pow2[-1], mod-2, mod)]\n\nfor i in range(N + 10)[::-1]:\n\n invpow2.append(invpow2[-1] * 2 % mod)\n\ninvpow2 = invpow2[::-1]\n\n\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-invpow2[N-A[i]]) * pow2[N-A[i]]\n\n for j in X[i]:\n\n s = (s * invpow2[A[j]]) % mod\n\n t = (t + (1-invpow2[A[j]]) * pow2[A[j]]) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))", "code_v0_loc": 41, "code_v1_loc": 50, "code_v0_num_chars": 951, "code_v1_num_chars": 1128, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import deque\n\nN = int(input())\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\ni0 = min([i for i in range(N) if len(X[i]) == 1])\nP = [-1] * N\nQ = deque([i0])\nR = []\nwhile Q:\n i = deque.popleft(Q)\n R.append(i)\n for a in X[i]:\n if a != P[i]:\n P[a] = i\n X[a].remove(i)\n deque.append(Q, a)\nmod = 10**9 + 7\ninv2 = (mod + 1) // 2\nA = [1] * N\nfor i in R[::-1]:\n s = 0\n for j in X[i]:\n A[i] += A[j]\nans = 0\nfor i in range(N):\n s = pow(inv2, N - A[i], mod)\n t = 1 + (1 - pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n for j in X[i]:\n s = (s * pow(inv2, A[j], mod)) % mod\n t = (t + (1 - pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n ans = (ans + 1 - s * t) % mod\nprint((ans * inv2 % mod))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import deque\n\nN = int(input())\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\ni0 = min([i for i in range(N) if len(X[i]) == 1])\nP = [-1] * N\nQ = deque([i0])\nR = []\nwhile Q:\n i = deque.popleft(Q)\n R.append(i)\n for a in X[i]:\n if a != P[i]:\n P[a] = i\n X[a].remove(i)\n deque.append(Q, a)\nmod = 10**9 + 7\npow2 = [1]\nfor i in range(N + 10):\n pow2.append(pow2[-1] * 2 % mod)\ninv2 = (mod + 1) // 2\ninvpow2 = [pow(pow2[-1], mod - 2, mod)]\nfor i in range(N + 10)[::-1]:\n invpow2.append(invpow2[-1] * 2 % mod)\ninvpow2 = invpow2[::-1]\nA = [1] * N\nfor i in R[::-1]:\n s = 0\n for j in X[i]:\n A[i] += A[j]\nans = 0\nfor i in range(N):\n s = pow(inv2, N - A[i], mod)\n t = 1 + (1 - invpow2[N - A[i]]) * pow2[N - A[i]]\n for j in X[i]:\n s = (s * invpow2[A[j]]) % mod\n t = (t + (1 - invpow2[A[j]]) * pow2[A[j]]) % mod\n ans = (ans + 1 - s * t) % mod\nprint((ans * inv2 % mod))\n", "code_same": false, "relative_loc_diff_percent": 18.0, "diff": ["+pow2 = [1]", "+for i in range(N + 10):", "+ pow2.append(pow2[-1] * 2 % mod)", "+invpow2 = [pow(pow2[-1], mod - 2, mod)]", "+for i in range(N + 10)[::-1]:", "+ invpow2.append(invpow2[-1] * 2 % mod)", "+invpow2 = invpow2[::-1]", "- t = 1 + (1 - pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)", "+ t = 1 + (1 - invpow2[N - A[i]]) * pow2[N - A[i]]", "- s = (s * pow(inv2, A[j], mod)) % mod", "- t = (t + (1 - pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod", "+ s = (s * invpow2[A[j]]) % mod", "+ t = (t + (1 - invpow2[A[j]]) * pow2[A[j]]) % mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2550587091, "measured_runtime_v1": 0.1362446928, "runtime_lift": 1.8720634461, "key": ["s981663077", "s820806781"]} +{"user_id": "u301624971", "problem_id": "p03796", "language": "python", "submission_id_v0": "s825153134", "submission_id_v1": "s210395809", "cpu_time_v0": 230, "cpu_time_v1": 29, "memory_v0": 3972, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.39, "input": "from math import factorial\n\ndef myAnswer(N:int) ->int:\n\n ans =factorial(N)\n\n return ans % (10**9 + 7)\n\n\n\ndef modelAnswer():\n\n tmp=1\n\ndef main():\n\n N = int(input())\n\n print((myAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "def modelAnswer(N:int) -> int:\n\n ans = 1\n\n for i in range(1,N+1):\n\n ans = (ans*i) % (10**9 + 7)\n\n return ans \n\ndef main():\n\n N = int(input())\n\n print((modelAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 237, "code_v1_num_chars": 224, "code_v0_no_empty_lines": "from math import factorial\n\n\ndef myAnswer(N: int) -> int:\n ans = factorial(N)\n return ans % (10**9 + 7)\n\n\ndef modelAnswer():\n tmp = 1\n\n\ndef main():\n N = int(input())\n print((myAnswer(N)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def modelAnswer(N: int) -> int:\n ans = 1\n for i in range(1, N + 1):\n ans = (ans * i) % (10**9 + 7)\n return ans\n\n\ndef main():\n N = int(input())\n print((modelAnswer(N)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-from math import factorial", "-", "-", "-def myAnswer(N: int) -> int:", "- ans = factorial(N)", "- return ans % (10**9 + 7)", "-", "-", "-def modelAnswer():", "- tmp = 1", "+def modelAnswer(N: int) -> int:", "+ ans = 1", "+ for i in range(1, N + 1):", "+ ans = (ans * i) % (10**9 + 7)", "+ return ans", "- print((myAnswer(N)))", "+ print((modelAnswer(N)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7093277271, "measured_runtime_v1": 0.3704600389, "runtime_lift": 1.9147212994, "key": ["s825153134", "s210395809"]} +{"user_id": "u991567869", "problem_id": "p03854", "language": "python", "submission_id_v0": "s135519212", "submission_id_v1": "s896370774", "cpu_time_v0": 59, "cpu_time_v1": 42, "memory_v0": 9264, "memory_v1": 12828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.81, "input": "s = input()[::-1]\n\n\n\nwhile True:\n\n if len(s) == 0:\n\n break\n\n if s[:7] == \"remaerd\":\n\n s = s[7:]\n\n elif s[:6] == \"resare\":\n\n s = s[6:]\n\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n\n s = s[5:]\n\n else:\n\n print(\"NO\")\n\n exit()\n\n\n\nprint(\"YES\")", "target": "import re\n\n\n\ns = input()\n\n\n\nif re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "code_v0_loc": 16, "code_v1_loc": 8, "code_v0_num_chars": 294, "code_v1_num_chars": 123, "code_v0_no_empty_lines": "s = input()[::-1]\nwhile True:\n if len(s) == 0:\n break\n if s[:7] == \"remaerd\":\n s = s[7:]\n elif s[:6] == \"resare\":\n s = s[6:]\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n s = s[5:]\n else:\n print(\"NO\")\n exit()\nprint(\"YES\")\n", "code_v1_no_empty_lines": "import re\n\ns = input()\nif re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-s = input()[::-1]", "-while True:", "- if len(s) == 0:", "- break", "- if s[:7] == \"remaerd\":", "- s = s[7:]", "- elif s[:6] == \"resare\":", "- s = s[6:]", "- elif s[:5] == \"maerd\" or s[:5] == \"esare\":", "- s = s[5:]", "- else:", "- print(\"NO\")", "- exit()", "-print(\"YES\")", "+import re", "+", "+s = input()", "+if re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):", "+ print(\"YES\")", "+else:", "+ print(\"NO\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1782437842, "measured_runtime_v1": 0.0065195048, "runtime_lift": 27.340080233, "key": ["s135519212", "s896370774"]} +{"user_id": "u687343821", "problem_id": "p03074", "language": "python", "submission_id_v0": "s599311447", "submission_id_v1": "s168736691", "cpu_time_v0": 62, "cpu_time_v1": 44, "memory_v0": 5568, "memory_v1": 4596, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.03, "input": "import sys\n\nstdin = sys.stdin \n\nni = lambda: int(ns())\n\nna = lambda: list(map(int, stdin.readline().split()))\n\nns = lambda: stdin.readline()\n\n\n\ndef Solve():\n\n N,K=na()\n\n S=[int(d) for d in input()]\n\n l=[]\n\n N=len(S)\n\n if(S[0]==0):\n\n l.append(0)\n\n b=S[0]\n\n ct=1\n\n for i in S[1:]:\n\n if(b!=i):\n\n l.append(ct)\n\n ct=1\n\n b=i\n\n else:\n\n ct+=1\n\n l.append(ct)\n\n len_l=len(l)\n\n if(len_l//2 <= K):\n\n return sum(l)\n\n ans = res = sum(l[:2*K+1])\n\n \n\n if(len_l%2==0):\n\n l.append(0)\n\n len_l+=1\n\n g = K * 2 + 1\n\n for i in range(K*2+1,len_l-1,2):\n\n ans -= l[i-g] + l[i-g+1]\n\n ans += l[i] + l[1+i]\n\n if(resb>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile a>b>c:\n\n\t\t\tif a>b>c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1\n\n\t\t\t", "target": "while True:\n\n\tk=list(map(int,input().split(\" \")))\n\n\tif k[0]==k[1]==0:\n\n\t\tbreak\n\n\tct=0\n\n\ta=0\n\n\tb=0\n\n\tc=0\t\n\n\tmax=k[0]\n\n\tsum=k[1]\n\n\ta=max+1\n\n\twhile True:\n\n\t\ta-=1\n\n\t\tb=a-1\n\n\t\tc=sum-a-b\n\n\t\tif not a>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile b>c:\n\n\t\t\tif c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 287, "code_v1_num_chars": 271, "code_v0_no_empty_lines": "while True:\n k = list(map(int, input().split(\" \")))\n if k[0] == k[1] == 0:\n break\n ct = 0\n a = 0\n b = 0\n c = 0\n max = k[0]\n sum = k[1]\n a = max + 1\n while True:\n a -= 1\n b = a - 1\n c = sum - a - b\n if not a > b > c:\n print(ct)\n break\n while a > b > c:\n if a > b > c > 0:\n ct += 1\n b -= 1\n c += 1\n", "code_v1_no_empty_lines": "while True:\n k = list(map(int, input().split(\" \")))\n if k[0] == k[1] == 0:\n break\n ct = 0\n a = 0\n b = 0\n c = 0\n max = k[0]\n sum = k[1]\n a = max + 1\n while True:\n a -= 1\n b = a - 1\n c = sum - a - b\n if not a > c:\n print(ct)\n break\n while b > c:\n if c > 0:\n ct += 1\n b -= 1\n c += 1\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- if not a > b > c:", "+ if not a > c:", "- while a > b > c:", "- if a > b > c > 0:", "+ while b > c:", "+ if c > 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2289849162, "measured_runtime_v1": 0.1798006518, "runtime_lift": 1.273548866, "key": ["s470319892", "s042746843"]} +{"user_id": "u536034761", "problem_id": "p04044", "language": "python", "submission_id_v0": "s161300550", "submission_id_v1": "s718856768", "cpu_time_v0": 29, "cpu_time_v1": 24, "memory_v0": 9032, "memory_v1": 9016, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.24, "input": "n, l = list(map(int, input().split()))\n\nS = [input() for i in range(n)]\n\nS.sort()\n\nprint((\"\".join(S)))", "target": "n, l = list(map(int, input().split()))\n\nA = [input() for _ in range(n)]\n\nA.sort()\n\nprint((\"\".join(A)))\n", "code_v0_loc": 4, "code_v1_loc": 4, "code_v0_num_chars": 94, "code_v1_num_chars": 95, "code_v0_no_empty_lines": "n, l = list(map(int, input().split()))\nS = [input() for i in range(n)]\nS.sort()\nprint((\"\".join(S)))\n", "code_v1_no_empty_lines": "n, l = list(map(int, input().split()))\nA = [input() for _ in range(n)]\nA.sort()\nprint((\"\".join(A)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-S = [input() for i in range(n)]", "-S.sort()", "-print((\"\".join(S)))", "+A = [input() for _ in range(n)]", "+A.sort()", "+print((\"\".join(A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3658422339, "measured_runtime_v1": 0.2564776862, "runtime_lift": 1.4264096006, "key": ["s161300550", "s718856768"]} +{"user_id": "u996564551", "problem_id": "p03644", "language": "python", "submission_id_v0": "s317462383", "submission_id_v1": "s803396146", "cpu_time_v0": 32, "cpu_time_v1": 25, "memory_v0": 9180, "memory_v1": 9176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.88, "input": "N = int(input())\n\nif N < 2:\n\n print(N)\n\nelif 2<=N<4:\n\n print((2))\n\nelif 4<=N<8:\n\n print((4))\n\nelif 8<=N<16:\n\n print((8))\n\nelif 16<=N<32:\n\n print((16))\n\nelif 32<=N<64:\n\n print((32))\n\nelif 64<=N:\n\n print((64))", "target": "N = int(input())\n\nNum = [int(2**i) for i in range(7)]\n\nif N in Num:\n\n print(N)\n\nelse:\n\n Num.append(N)\n\n Num = sorted(Num)\n\n print((2 ** (Num.index(N) - 1)))", "code_v0_loc": 15, "code_v1_loc": 8, "code_v0_num_chars": 202, "code_v1_num_chars": 158, "code_v0_no_empty_lines": "N = int(input())\nif N < 2:\n print(N)\nelif 2 <= N < 4:\n print((2))\nelif 4 <= N < 8:\n print((4))\nelif 8 <= N < 16:\n print((8))\nelif 16 <= N < 32:\n print((16))\nelif 32 <= N < 64:\n print((32))\nelif 64 <= N:\n print((64))\n", "code_v1_no_empty_lines": "N = int(input())\nNum = [int(2**i) for i in range(7)]\nif N in Num:\n print(N)\nelse:\n Num.append(N)\n Num = sorted(Num)\n print((2 ** (Num.index(N) - 1)))\n", "code_same": false, "relative_loc_diff_percent": 46.6666666667, "diff": ["-if N < 2:", "+Num = [int(2**i) for i in range(7)]", "+if N in Num:", "-elif 2 <= N < 4:", "- print((2))", "-elif 4 <= N < 8:", "- print((4))", "-elif 8 <= N < 16:", "- print((8))", "-elif 16 <= N < 32:", "- print((16))", "-elif 32 <= N < 64:", "- print((32))", "-elif 64 <= N:", "- print((64))", "+else:", "+ Num.append(N)", "+ Num = sorted(Num)", "+ print((2 ** (Num.index(N) - 1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3866926632, "measured_runtime_v1": 0.2723876703, "runtime_lift": 1.4196408479, "key": ["s317462383", "s803396146"]} +{"user_id": "u815878613", "problem_id": "p03037", "language": "python", "submission_id_v0": "s043802358", "submission_id_v1": "s120994164", "cpu_time_v0": 220, "cpu_time_v1": 195, "memory_v0": 27220, "memory_v1": 9100, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.36, "input": "N, M = list(map(int, input().split()))\n\nLR = [list(map(int, input().split())) for _ in range(M)]\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor l, r in LR:\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n", "target": "N, M = list(map(int, input().split()))\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor _ in range(M):\n\n l, r = list(map(int, input().split()))\n\n\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n", "code_v0_loc": 15, "code_v1_loc": 16, "code_v0_num_chars": 266, "code_v1_num_chars": 251, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nLR = [list(map(int, input().split())) for _ in range(M)]\nleft = 1\nright = N\nfor l, r in LR:\n if left < l:\n left = l\n if right > r:\n right = r\nans = right - left\nprint((ans + 1 if ans >= 0 else 0))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nleft = 1\nright = N\nfor _ in range(M):\n l, r = list(map(int, input().split()))\n if left < l:\n left = l\n if right > r:\n right = r\nans = right - left\nprint((ans + 1 if ans >= 0 else 0))\n", "code_same": false, "relative_loc_diff_percent": 6.25, "diff": ["-LR = [list(map(int, input().split())) for _ in range(M)]", "-for l, r in LR:", "+for _ in range(M):", "+ l, r = list(map(int, input().split()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2458969798, "measured_runtime_v1": 0.1910107524, "runtime_lift": 1.2873462706, "key": ["s043802358", "s120994164"]} +{"user_id": "u282228874", "problem_id": "p03293", "language": "python", "submission_id_v0": "s664706993", "submission_id_v1": "s616247709", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "s = input()\n\nt = input()\n\nfor i in range(len(s)):\n\n if s[i:]+s[:i]==t:\n\n print('Yes')\n\n exit()\n\nprint('No')", "target": "s = input()\n\nt = input()\n\n\n\nfor i in range(len(s)):\n\n s = s[1:] + s[0]\n\n if s == t:\n\n print(\"Yes\")\n\n exit()\n\nprint(\"No\")", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 144, "code_v1_num_chars": 140, "code_v0_no_empty_lines": "s = input()\nt = input()\nfor i in range(len(s)):\n if s[i:] + s[:i] == t:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_v1_no_empty_lines": "s = input()\nt = input()\nfor i in range(len(s)):\n s = s[1:] + s[0]\n if s == t:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["- if s[i:] + s[:i] == t:", "+ s = s[1:] + s[0]", "+ if s == t:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1894659722, "measured_runtime_v1": 0.0060859642, "runtime_lift": 31.1316277188, "key": ["s664706993", "s616247709"]} +{"user_id": "u285121325", "problem_id": "p03060", "language": "python", "submission_id_v0": "s176163369", "submission_id_v1": "s307096938", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "n = int(input())\n\nv = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\nresult = 0\n\nfor i in range(n):\n\n if v[i] > c[i]:\n\n result += v[i] - c[i]\n\nprint(result)", "target": "N = int(input())\n\nV = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\nprint((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))\n", "code_v0_loc": 8, "code_v1_loc": 4, "code_v0_num_chars": 183, "code_v1_num_chars": 151, "code_v0_no_empty_lines": "n = int(input())\nv = list(map(int, input().split()))\nc = list(map(int, input().split()))\nresult = 0\nfor i in range(n):\n if v[i] > c[i]:\n result += v[i] - c[i]\nprint(result)\n", "code_v1_no_empty_lines": "N = int(input())\nV = list(map(int, input().split()))\nC = list(map(int, input().split()))\nprint((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-n = int(input())", "-v = list(map(int, input().split()))", "-c = list(map(int, input().split()))", "-result = 0", "-for i in range(n):", "- if v[i] > c[i]:", "- result += v[i] - c[i]", "-print(result)", "+N = int(input())", "+V = list(map(int, input().split()))", "+C = list(map(int, input().split()))", "+print((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1697382522, "measured_runtime_v1": 0.0057968805, "runtime_lift": 29.2809645377, "key": ["s176163369", "s307096938"]} +{"user_id": "u879870653", "problem_id": "p03416", "language": "python", "submission_id_v0": "s279175230", "submission_id_v1": "s789865740", "cpu_time_v0": 111, "cpu_time_v1": 45, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.46, "input": "a,b = list(map(int,input().split()))\n\nanswer = 0\n\nfor i in range(a,b+1) :\n\n j = str(i)\n\n p1 = j[4]\n\n p2 = j[3]\n\n p3 = j[2]\n\n p4 = j[1]\n\n p5 = j[0]\n\n k = int(p1+p2+p3+p4+p5)\n\n if i == k :\n\n answer += 1\n\nprint(answer)\n\n\n", "target": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1) :\n\n l = str(i)\n\n if l[0] == l[4] and l[1] == l[3] :\n\n ans += 1\n\nprint(ans)\n", "code_v0_loc": 14, "code_v1_loc": 7, "code_v0_num_chars": 243, "code_v1_num_chars": 151, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nanswer = 0\nfor i in range(a, b + 1):\n j = str(i)\n p1 = j[4]\n p2 = j[3]\n p3 = j[2]\n p4 = j[1]\n p5 = j[0]\n k = int(p1 + p2 + p3 + p4 + p5)\n if i == k:\n answer += 1\nprint(answer)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n l = str(i)\n if l[0] == l[4] and l[1] == l[3]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-a, b = list(map(int, input().split()))", "-answer = 0", "-for i in range(a, b + 1):", "- j = str(i)", "- p1 = j[4]", "- p2 = j[3]", "- p3 = j[2]", "- p4 = j[1]", "- p5 = j[0]", "- k = int(p1 + p2 + p3 + p4 + p5)", "- if i == k:", "- answer += 1", "-print(answer)", "+A, B = list(map(int, input().split()))", "+ans = 0", "+for i in range(A, B + 1):", "+ l = str(i)", "+ if l[0] == l[4] and l[1] == l[3]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5475045266, "measured_runtime_v1": 0.378210106, "runtime_lift": 1.4476200343, "key": ["s279175230", "s789865740"]} +{"user_id": "u936985471", "problem_id": "p03721", "language": "python", "submission_id_v0": "s865752287", "submission_id_v1": "s921873406", "cpu_time_v0": 343, "cpu_time_v1": 288, "memory_v0": 15072, "memory_v1": 29824, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.03, "input": "N,K=list(map(int,input().split()))\n\ndic={}\n\nfor i in range(N):\n\n a,b=list(map(int,input().split()))\n\n if a in dic:\n\n dic[a]+=b\n\n else:\n\n dic[a]=b\n\n \n\ndic=sorted(list(dic.items()),key=lambda x:x[0])\n\nfor d in range(len(dic)):\n\n amount=dic[d][1]\n\n if amount>=K:\n\n print((dic[d][0]))\n\n exit(0)\n\n else:\n\n K-=amount\n\n ", "target": "import sys\n\nreadline = sys.stdin.readline\n\n\n\nN,K = list(map(int,readline().split()))\n\n\n\nAB = [list(map(int,readline().split())) for i in range(N)]\n\n\n\nAB = sorted(AB, key = lambda x:x[0])\n\namount = 0\n\nfor a,b in AB:\n\n amount += b\n\n if amount >= K:\n\n print(a)\n\n break\n", "code_v0_loc": 18, "code_v1_loc": 14, "code_v0_num_chars": 318, "code_v1_num_chars": 268, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\ndic = {}\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if a in dic:\n dic[a] += b\n else:\n dic[a] = b\ndic = sorted(list(dic.items()), key=lambda x: x[0])\nfor d in range(len(dic)):\n amount = dic[d][1]\n if amount >= K:\n print((dic[d][0]))\n exit(0)\n else:\n K -= amount\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nN, K = list(map(int, readline().split()))\nAB = [list(map(int, readline().split())) for i in range(N)]\nAB = sorted(AB, key=lambda x: x[0])\namount = 0\nfor a, b in AB:\n amount += b\n if amount >= K:\n print(a)\n break\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-N, K = list(map(int, input().split()))", "-dic = {}", "-for i in range(N):", "- a, b = list(map(int, input().split()))", "- if a in dic:", "- dic[a] += b", "- else:", "- dic[a] = b", "-dic = sorted(list(dic.items()), key=lambda x: x[0])", "-for d in range(len(dic)):", "- amount = dic[d][1]", "+import sys", "+", "+readline = sys.stdin.readline", "+N, K = list(map(int, readline().split()))", "+AB = [list(map(int, readline().split())) for i in range(N)]", "+AB = sorted(AB, key=lambda x: x[0])", "+amount = 0", "+for a, b in AB:", "+ amount += b", "- print((dic[d][0]))", "- exit(0)", "- else:", "- K -= amount", "+ print(a)", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3684674098, "measured_runtime_v1": 0.2810288085, "runtime_lift": 1.3111375012, "key": ["s865752287", "s921873406"]} +{"user_id": "u197300260", "problem_id": "p03814", "language": "python", "submission_id_v0": "s932284243", "submission_id_v1": "s708109984", "cpu_time_v0": 36, "cpu_time_v1": 29, "memory_v0": 4012, "memory_v1": 3516, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.44, "input": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n\n# Python 1st Try\n\nimport copy\n\n\n\n\n\nclass Problem:\n\n def __init__(self, stringdata):\n\n self.stringdata = stringdata\n\n\n\n def solver(self):\n\n strcont = copy.copy(self.stringdata)\n\n result = 0\n\n rightposition = 0\n\n leftposition = len(strcont)\n\n j = 0\n\n while True:\n\n if strcont[j] == 'A':\n\n rightposition = j\n\n break\n\n else:\n\n j = j + 1\n\n j = leftposition - 1\n\n while True:\n\n if strcont[j] == 'Z':\n\n leftposition = j\n\n break\n\n else:\n\n j = j - 1\n\n\n\n result = leftposition - rightposition + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = input()\n\n print((\"{}\".format(Problem(s).solver())))\n", "target": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n\n# Python 2nd Try\n\n\n\n\n\ndef solver(string):\n\n result = 200000\n\n aposi = 0\n\n zposi = len(string)\n\n for j in range(0, len(string), 1):\n\n if string[j] == 'A':\n\n aposi = j\n\n break\n\n for j in range(len(string)-1, -1, -1):\n\n if string[j] == 'Z':\n\n zposi = j\n\n break\n\n result = zposi - aposi + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = input()\n\n print(('{}'.format(solver(s))))\n", "code_v0_loc": 36, "code_v1_loc": 23, "code_v0_num_chars": 875, "code_v1_num_chars": 527, "code_v0_no_empty_lines": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n# Python 1st Try\nimport copy\n\n\nclass Problem:\n def __init__(self, stringdata):\n self.stringdata = stringdata\n\n def solver(self):\n strcont = copy.copy(self.stringdata)\n result = 0\n rightposition = 0\n leftposition = len(strcont)\n j = 0\n while True:\n if strcont[j] == \"A\":\n rightposition = j\n break\n else:\n j = j + 1\n j = leftposition - 1\n while True:\n if strcont[j] == \"Z\":\n leftposition = j\n break\n else:\n j = j - 1\n result = leftposition - rightposition + 1\n return result\n\n\nif __name__ == \"__main__\":\n s = input()\n print((\"{}\".format(Problem(s).solver())))\n", "code_v1_no_empty_lines": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n# Python 2nd Try\ndef solver(string):\n result = 200000\n aposi = 0\n zposi = len(string)\n for j in range(0, len(string), 1):\n if string[j] == \"A\":\n aposi = j\n break\n for j in range(len(string) - 1, -1, -1):\n if string[j] == \"Z\":\n zposi = j\n break\n result = zposi - aposi + 1\n return result\n\n\nif __name__ == \"__main__\":\n s = input()\n print((\"{}\".format(solver(s))))\n", "code_same": false, "relative_loc_diff_percent": 36.1111111111, "diff": ["-# Python 1st Try", "-import copy", "-", "-", "-class Problem:", "- def __init__(self, stringdata):", "- self.stringdata = stringdata", "-", "- def solver(self):", "- strcont = copy.copy(self.stringdata)", "- result = 0", "- rightposition = 0", "- leftposition = len(strcont)", "- j = 0", "- while True:", "- if strcont[j] == \"A\":", "- rightposition = j", "- break", "- else:", "- j = j + 1", "- j = leftposition - 1", "- while True:", "- if strcont[j] == \"Z\":", "- leftposition = j", "- break", "- else:", "- j = j - 1", "- result = leftposition - rightposition + 1", "- return result", "+# Python 2nd Try", "+def solver(string):", "+ result = 200000", "+ aposi = 0", "+ zposi = len(string)", "+ for j in range(0, len(string), 1):", "+ if string[j] == \"A\":", "+ aposi = j", "+ break", "+ for j in range(len(string) - 1, -1, -1):", "+ if string[j] == \"Z\":", "+ zposi = j", "+ break", "+ result = zposi - aposi + 1", "+ return result", "- print((\"{}\".format(Problem(s).solver())))", "+ print((\"{}\".format(solver(s))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2169195101, "measured_runtime_v1": 0.1208960545, "runtime_lift": 1.7942645936, "key": ["s932284243", "s708109984"]} +{"user_id": "u821588465", "problem_id": "p03000", "language": "python", "submission_id_v0": "s259788442", "submission_id_v1": "s163625054", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9172, "memory_v1": 8984, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "from itertools import accumulate\n\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\n\nL = list(tuple(map(int, input().split())))\n\n\n\nacc = sorted(list(accumulate(L)) + [0])\n\n\n\nn = bisect_right(acc,X)\n\nprint(n)\n\n\n", "target": "N,X = list(map(int,input().split()))\n\nL = list(map(int,input().split()))\n\nList = [0]*(N+1)\n\nfor i in range(1,N+1):\n\n List[i] = List[i-1] + L[i-1]\n\nA = [i for i in List if i <=X]\n\nprint((len(A)))", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 215, "code_v1_num_chars": 189, "code_v0_no_empty_lines": "from itertools import accumulate\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\nL = list(tuple(map(int, input().split())))\nacc = sorted(list(accumulate(L)) + [0])\nn = bisect_right(acc, X)\nprint(n)\n", "code_v1_no_empty_lines": "N, X = list(map(int, input().split()))\nL = list(map(int, input().split()))\nList = [0] * (N + 1)\nfor i in range(1, N + 1):\n List[i] = List[i - 1] + L[i - 1]\nA = [i for i in List if i <= X]\nprint((len(A)))\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-from itertools import accumulate", "-from bisect import *", "-", "-L = list(tuple(map(int, input().split())))", "-acc = sorted(list(accumulate(L)) + [0])", "-n = bisect_right(acc, X)", "-print(n)", "+L = list(map(int, input().split()))", "+List = [0] * (N + 1)", "+for i in range(1, N + 1):", "+ List[i] = List[i - 1] + L[i - 1]", "+A = [i for i in List if i <= X]", "+print((len(A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2199657279, "measured_runtime_v1": 0.1756561113, "runtime_lift": 1.2522520635, "key": ["s259788442", "s163625054"]} +{"user_id": "u460245024", "problem_id": "p03416", "language": "python", "submission_id_v0": "s770002751", "submission_id_v1": "s323286862", "cpu_time_v0": 51, "cpu_time_v1": 32, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.25, "input": "A, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n n_s = str(n)\n\n n_s_rvs = n_s[::-1]\n\n if n_s == n_s_rvs:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "target": "A, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n if n//10000 == n%10 and (n//1000)%10 == (n//10)%10:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "code_v0_loc": 10, "code_v1_loc": 8, "code_v0_num_chars": 168, "code_v1_num_chars": 158, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor n in range(A, B + 1):\n n_s = str(n)\n n_s_rvs = n_s[::-1]\n if n_s == n_s_rvs:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor n in range(A, B + 1):\n if n // 10000 == n % 10 and (n // 1000) % 10 == (n // 10) % 10:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["- n_s = str(n)", "- n_s_rvs = n_s[::-1]", "- if n_s == n_s_rvs:", "+ if n // 10000 == n % 10 and (n // 1000) % 10 == (n // 10) % 10:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3429904201, "measured_runtime_v1": 0.2179555298, "runtime_lift": 1.5736715671, "key": ["s770002751", "s323286862"]} +{"user_id": "u597374218", "problem_id": "p03796", "language": "python", "submission_id_v0": "s636787028", "submission_id_v1": "s575140392", "cpu_time_v0": 154, "cpu_time_v1": 44, "memory_v0": 10168, "memory_v1": 9028, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 71.43, "input": "import math\n\nN=int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "target": "N=int(input())\n\npower=1\n\nfor i in range(1,N+1):\n\n power*=i\n\n power%=10**9+7\n\nprint(power)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 63, "code_v1_num_chars": 95, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "N = int(input())\npower = 1\nfor i in range(1, N + 1):\n power *= i\n power %= 10**9 + 7\nprint(power)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-print((math.factorial(N) % (10**9 + 7)))", "+power = 1", "+for i in range(1, N + 1):", "+ power *= i", "+ power %= 10**9 + 7", "+print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6653705416, "measured_runtime_v1": 0.3042658694, "runtime_lift": 2.1868063707, "key": ["s636787028", "s575140392"]} +{"user_id": "u970197315", "problem_id": "p03371", "language": "python", "submission_id_v0": "s588181559", "submission_id_v1": "s154731902", "cpu_time_v0": 63, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 73.02, "input": "# ABC95 C -Half and Half\n\na,b,c,x,y = list(map(float,input().split()))\n\nans = 0\n\nif a+b > 2*c:\n\n while x != 0.0 and y != 0.0:\n\n ans += 2*c\n\n x -= 1.0\n\n y -= 1.0\n\n if y == 0.0:\n\n while x != 0.0:\n\n if a > 2*c:\n\n ans += 2*c\n\n x -= 1.0\n\n else:\n\n ans += a\n\n x -= 1.0\n\n if x == 0.0:\n\n while y != 0.0:\n\n if b > 2*c:\n\n ans += 2*c\n\n y -= 1.0\n\n else:\n\n ans += b\n\n y -= 1.0\n\nelse:\n\n ans += a*x + b*y\n\nprint((int(ans)))\n\n\n\n ", "target": "a,b,c,x,y=list(map(int,input().split()))\n\nans=0\n\nans1=0\n\n\n\ne=max(x,y)\n\nans1=e*(2*c)\n\nif 2*c 2 * c:\n while x != 0.0 and y != 0.0:\n ans += 2 * c\n x -= 1.0\n y -= 1.0\n if y == 0.0:\n while x != 0.0:\n if a > 2 * c:\n ans += 2 * c\n x -= 1.0\n else:\n ans += a\n x -= 1.0\n if x == 0.0:\n while y != 0.0:\n if b > 2 * c:\n ans += 2 * c\n y -= 1.0\n else:\n ans += b\n y -= 1.0\nelse:\n ans += a * x + b * y\nprint((int(ans)))\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = 0\nans1 = 0\ne = max(x, y)\nans1 = e * (2 * c)\nif 2 * c < a + b:\n d = min(x, y)\n ans += c * (2 * d)\n x -= d\n y -= d\nelse:\n ans = a * x + b * y\n x -= x\n y -= y\nans += x * a\nans += y * b\nprint((min(ans, ans1)))\n", "code_same": false, "relative_loc_diff_percent": 37.9310344828, "diff": ["-# ABC95 C -Half and Half", "-a, b, c, x, y = list(map(float, input().split()))", "+a, b, c, x, y = list(map(int, input().split()))", "-if a + b > 2 * c:", "- while x != 0.0 and y != 0.0:", "- ans += 2 * c", "- x -= 1.0", "- y -= 1.0", "- if y == 0.0:", "- while x != 0.0:", "- if a > 2 * c:", "- ans += 2 * c", "- x -= 1.0", "- else:", "- ans += a", "- x -= 1.0", "- if x == 0.0:", "- while y != 0.0:", "- if b > 2 * c:", "- ans += 2 * c", "- y -= 1.0", "- else:", "- ans += b", "- y -= 1.0", "+ans1 = 0", "+e = max(x, y)", "+ans1 = e * (2 * c)", "+if 2 * c < a + b:", "+ d = min(x, y)", "+ ans += c * (2 * d)", "+ x -= d", "+ y -= d", "- ans += a * x + b * y", "-print((int(ans)))", "+ ans = a * x + b * y", "+ x -= x", "+ y -= y", "+ans += x * a", "+ans += y * b", "+print((min(ans, ans1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3221288462, "measured_runtime_v1": 0.2473681471, "runtime_lift": 1.3022244371, "key": ["s588181559", "s154731902"]} +{"user_id": "u632413369", "problem_id": "p02595", "language": "python", "submission_id_v0": "s512106161", "submission_id_v1": "s251902862", "cpu_time_v0": 491, "cpu_time_v1": 390, "memory_v0": 9080, "memory_v1": 9188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.57, "input": "N, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x ** 2 + y ** 2 <= D ** 2:\n\n cnt += 1\n\n \n\nprint(cnt)", "target": "N, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x * x + y * y <= D * D:\n\n cnt += 1\n\n \n\nprint(cnt)", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 174, "code_v1_num_chars": 171, "code_v0_no_empty_lines": "N, D = list(map(int, input().split()))\ncnt = 0\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if x**2 + y**2 <= D**2:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "N, D = list(map(int, input().split()))\ncnt = 0\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if x * x + y * y <= D * D:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if x**2 + y**2 <= D**2:", "+ if x * x + y * y <= D * D:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1756704731, "measured_runtime_v1": 0.0073727348, "runtime_lift": 23.8270435573, "key": ["s512106161", "s251902862"]} +{"user_id": "u617515020", "problem_id": "p02814", "language": "python", "submission_id_v0": "s956521329", "submission_id_v1": "s164820491", "cpu_time_v0": 67, "cpu_time_v1": 51, "memory_v0": 16316, "memory_v1": 20372, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.88, "input": "from math import gcd\n\n\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\n\n\na=list([x//2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) // gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\n\n\nif (lcma//a[0])%2==0:\n\n print((0))\n\nelse:\n\n flg=0\n\n for i in range(1,len(a)):\n\n if (lcma//a[i])%2==0:\n\n print((0))\n\n flg=1\n\n break\n\n if flg==0:\n\n temp=m//lcma\n\n print((temp//2 if temp%2==0 else temp//2+1))", "target": "from math import gcd\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\na=list([x//2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) // gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\nfor i in range(len(a)):\n\n if (lcma//a[i])%2==0:\n\n print((0))\n\n exit()\n\ntemp=m//lcma\n\nprint((temp//2 if temp%2==0 else temp//2+1))", "code_v0_loc": 28, "code_v1_loc": 19, "code_v0_num_chars": 492, "code_v1_num_chars": 386, "code_v0_no_empty_lines": "from math import gcd\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = list(set(a))\na = list([x // 2 for x in a])\n\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) // gcd(x, q[i])\n return x\n\n\nlcma = lcm(a)\nif (lcma // a[0]) % 2 == 0:\n print((0))\nelse:\n flg = 0\n for i in range(1, len(a)):\n if (lcma // a[i]) % 2 == 0:\n print((0))\n flg = 1\n break\n if flg == 0:\n temp = m // lcma\n print((temp // 2 if temp % 2 == 0 else temp // 2 + 1))\n", "code_v1_no_empty_lines": "from math import gcd\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = list(set(a))\na = list([x // 2 for x in a])\n\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) // gcd(x, q[i])\n return x\n\n\nlcma = lcm(a)\nfor i in range(len(a)):\n if (lcma // a[i]) % 2 == 0:\n print((0))\n exit()\ntemp = m // lcma\nprint((temp // 2 if temp % 2 == 0 else temp // 2 + 1))\n", "code_same": false, "relative_loc_diff_percent": 32.1428571429, "diff": ["-from math import gcd", "+from math import gcd", "-if (lcma // a[0]) % 2 == 0:", "- print((0))", "-else:", "- flg = 0", "- for i in range(1, len(a)):", "- if (lcma // a[i]) % 2 == 0:", "- print((0))", "- flg = 1", "- break", "- if flg == 0:", "- temp = m // lcma", "- print((temp // 2 if temp % 2 == 0 else temp // 2 + 1))", "+for i in range(len(a)):", "+ if (lcma // a[i]) % 2 == 0:", "+ print((0))", "+ exit()", "+temp = m // lcma", "+print((temp // 2 if temp % 2 == 0 else temp // 2 + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2803374403, "measured_runtime_v1": 0.2137892873, "runtime_lift": 1.3112791747, "key": ["s956521329", "s164820491"]} +{"user_id": "u209275335", "problem_id": "p02693", "language": "python", "submission_id_v0": "s337733409", "submission_id_v1": "s217218479", "cpu_time_v0": 61, "cpu_time_v1": 22, "memory_v0": 61660, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 63.93, "input": "S = int(input())\n\na = 0\n\ncount = 0\n\nn,m = list(map(int,input().split()))\n\nwhile count == 0:\n\n a += S\n\n if n <= a and m >= a:\n\n count = 1\n\n if a >= 1000:\n\n break\n\nif count == 0:\n\n print(\"NG\")\n\nelse:\n\n print(\"OK\")", "target": "k = int(input())\n\nn = 0\n\na,b = list(map(int,input().split()))\n\nwhile True:\n\n n += k\n\n if n >= a and n <= b:\n\n print(\"OK\")\n\n break\n\n if n > b:\n\n print(\"NG\")\n\n break", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 234, "code_v1_num_chars": 194, "code_v0_no_empty_lines": "S = int(input())\na = 0\ncount = 0\nn, m = list(map(int, input().split()))\nwhile count == 0:\n a += S\n if n <= a and m >= a:\n count = 1\n if a >= 1000:\n break\nif count == 0:\n print(\"NG\")\nelse:\n print(\"OK\")\n", "code_v1_no_empty_lines": "k = int(input())\nn = 0\na, b = list(map(int, input().split()))\nwhile True:\n n += k\n if n >= a and n <= b:\n print(\"OK\")\n break\n if n > b:\n print(\"NG\")\n break\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-S = int(input())", "-a = 0", "-count = 0", "-n, m = list(map(int, input().split()))", "-while count == 0:", "- a += S", "- if n <= a and m >= a:", "- count = 1", "- if a >= 1000:", "+k = int(input())", "+n = 0", "+a, b = list(map(int, input().split()))", "+while True:", "+ n += k", "+ if n >= a and n <= b:", "+ print(\"OK\")", "-if count == 0:", "- print(\"NG\")", "-else:", "- print(\"OK\")", "+ if n > b:", "+ print(\"NG\")", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2075882792, "measured_runtime_v1": 0.0060749435, "runtime_lift": 34.1712276754, "key": ["s337733409", "s217218479"]} +{"user_id": "u038021590", "problem_id": "p03171", "language": "python", "submission_id_v0": "s330952971", "submission_id_v1": "s165498833", "cpu_time_v0": 615, "cpu_time_v1": 234, "memory_v0": 115036, "memory_v1": 135316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.95, "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nn = N % 2\n\n\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor w in range(1, N+1):\n\n for i in range(N):\n\n j = i + w\n\n if j > N:\n\n continue\n\n if (w+n) % 2 == 1:\n\n DP[i][j] = min(DP[i+1][j] - A[i], DP[i][j-1] - A[j-1])\n\n else:\n\n DP[i][j] = max(DP[i+1][j] + A[i], DP[i][j-1] + A[j-1])\n\n\n\nprint((DP[0][N]))\n", "target": "N = int(input())\n\nA = list(map(int, input().split()))\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor num in range(1, N + 1):\n\n for start in range(N):\n\n end = start + num\n\n if end > N:\n\n break\n\n if num == 1:\n\n DP[start][end] = A[start]\n\n else:\n\n DP[start][end] = max(A[start] - DP[start+1][end], A[end - 1] - DP[start][end - 1])\n\nprint((DP[0][N]))\n", "code_v0_loc": 17, "code_v1_loc": 14, "code_v0_num_chars": 416, "code_v1_num_chars": 409, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nn = N % 2\nDP = [[0] * (N + 1) for _ in range(N + 1)]\nfor w in range(1, N + 1):\n for i in range(N):\n j = i + w\n if j > N:\n continue\n if (w + n) % 2 == 1:\n DP[i][j] = min(DP[i + 1][j] - A[i], DP[i][j - 1] - A[j - 1])\n else:\n DP[i][j] = max(DP[i + 1][j] + A[i], DP[i][j - 1] + A[j - 1])\nprint((DP[0][N]))\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nDP = [[0] * (N + 1) for _ in range(N + 1)]\nfor num in range(1, N + 1):\n for start in range(N):\n end = start + num\n if end > N:\n break\n if num == 1:\n DP[start][end] = A[start]\n else:\n DP[start][end] = max(\n A[start] - DP[start + 1][end], A[end - 1] - DP[start][end - 1]\n )\nprint((DP[0][N]))\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["-n = N % 2", "-for w in range(1, N + 1):", "- for i in range(N):", "- j = i + w", "- if j > N:", "- continue", "- if (w + n) % 2 == 1:", "- DP[i][j] = min(DP[i + 1][j] - A[i], DP[i][j - 1] - A[j - 1])", "+for num in range(1, N + 1):", "+ for start in range(N):", "+ end = start + num", "+ if end > N:", "+ break", "+ if num == 1:", "+ DP[start][end] = A[start]", "- DP[i][j] = max(DP[i + 1][j] + A[i], DP[i][j - 1] + A[j - 1])", "+ DP[start][end] = max(", "+ A[start] - DP[start + 1][end], A[end - 1] - DP[start][end - 1]", "+ )"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1878290408, "measured_runtime_v1": 0.0068282696, "runtime_lift": 27.5075605354, "key": ["s330952971", "s165498833"]} +{"user_id": "u754022296", "problem_id": "p03796", "language": "python", "submission_id_v0": "s893557911", "submission_id_v1": "s686331748", "cpu_time_v0": 230, "cpu_time_v1": 48, "memory_v0": 3984, "memory_v1": 9008, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 79.13, "input": "from math import factorial as fc\n\na = int(input())\n\nprint((fc(a)%(10**9+7)))", "target": "n = int(input())\n\nm = 10**9+7\n\nans = 1\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= m\n\nprint(ans)", "code_v0_loc": 3, "code_v1_loc": 7, "code_v0_num_chars": 74, "code_v1_num_chars": 99, "code_v0_no_empty_lines": "from math import factorial as fc\n\na = int(input())\nprint((fc(a) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nm = 10**9 + 7\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= m\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-from math import factorial as fc", "-", "-a = int(input())", "-print((fc(a) % (10**9 + 7)))", "+n = int(input())", "+m = 10**9 + 7", "+ans = 1", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= m", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4826196883, "measured_runtime_v1": 0.2178869207, "runtime_lift": 2.2150007294, "key": ["s893557911", "s686331748"]} +{"user_id": "u957843607", "problem_id": "p02574", "language": "python", "submission_id_v0": "s835620267", "submission_id_v1": "s021486096", "cpu_time_v0": 703, "cpu_time_v1": 584, "memory_v0": 134500, "memory_v1": 134400, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.93, "input": "from math import gcd\n\n\n\nN = int(input())\n\nnum_lis = list(map(int, input().split()))\n\nc = True\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(10**6+10)\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num //= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n c = False\n\n break\n\n else:\n\n tmp.add(j)\n\n else:\n\n continue\n\n break\n\n\n\nif c:\n\n print(\"pairwise coprime\")\n\nelse:\n\n print(\"setwise coprime\")", "target": "from math import gcd\n\n\n\nN = int(input())\n\nnum_lis = list(map(int, input().split()))\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(max(num_lis))\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num //= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n print(\"setwise coprime\")\n\n exit()\n\n else:\n\n tmp.add(j)\n\nprint(\"pairwise coprime\")", "code_v0_loc": 47, "code_v1_loc": 39, "code_v0_num_chars": 793, "code_v1_num_chars": 725, "code_v0_no_empty_lines": "from math import gcd\n\nN = int(input())\nnum_lis = list(map(int, input().split()))\nc = True\n\n\ndef osa_k(max_num):\n lis = [i for i in range(max_num + 1)]\n p = 2\n while p**2 <= max_num:\n if lis[p] == p:\n for q in range(2 * p, max_num + 1, p):\n if lis[q] == q:\n lis[q] = p\n p += 1\n return lis\n\n\nhoge = 0\nfor i in num_lis:\n hoge = gcd(hoge, i)\nif hoge > 1:\n print(\"not coprime\")\n exit()\nd_lis = osa_k(10**6 + 10)\ntmp = set()\nfor i in num_lis:\n num = i\n new_tmp = set()\n while num > 1:\n d = d_lis[num]\n new_tmp.add(d)\n num //= d\n for j in new_tmp:\n if j in tmp:\n c = False\n break\n else:\n tmp.add(j)\n else:\n continue\n break\nif c:\n print(\"pairwise coprime\")\nelse:\n print(\"setwise coprime\")\n", "code_v1_no_empty_lines": "from math import gcd\n\nN = int(input())\nnum_lis = list(map(int, input().split()))\n\n\ndef osa_k(max_num):\n lis = [i for i in range(max_num + 1)]\n p = 2\n while p**2 <= max_num:\n if lis[p] == p:\n for q in range(2 * p, max_num + 1, p):\n if lis[q] == q:\n lis[q] = p\n p += 1\n return lis\n\n\nhoge = 0\nfor i in num_lis:\n hoge = gcd(hoge, i)\nif hoge > 1:\n print(\"not coprime\")\n exit()\nd_lis = osa_k(max(num_lis))\ntmp = set()\nfor i in num_lis:\n num = i\n new_tmp = set()\n while num > 1:\n d = d_lis[num]\n new_tmp.add(d)\n num //= d\n for j in new_tmp:\n if j in tmp:\n print(\"setwise coprime\")\n exit()\n else:\n tmp.add(j)\nprint(\"pairwise coprime\")\n", "code_same": false, "relative_loc_diff_percent": 17.0212765957, "diff": ["-c = True", "-d_lis = osa_k(10**6 + 10)", "+d_lis = osa_k(max(num_lis))", "- c = False", "- break", "+ print(\"setwise coprime\")", "+ exit()", "- else:", "- continue", "- break", "-if c:", "- print(\"pairwise coprime\")", "-else:", "- print(\"setwise coprime\")", "+print(\"pairwise coprime\")"], "diff_only_import_comment": false, "measured_runtime_v0": 2.272307416, "measured_runtime_v1": 0.2046107306, "runtime_lift": 11.1055144012, "key": ["s835620267", "s021486096"]} +{"user_id": "u380524497", "problem_id": "p02850", "language": "python", "submission_id_v0": "s943818401", "submission_id_v1": "s978957689", "cpu_time_v0": 583, "cpu_time_v1": 446, "memory_v0": 25092, "memory_v1": 25184, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.5, "input": "n = int(input())\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(input())\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n", "code_v0_loc": 27, "code_v1_loc": 30, "code_v0_num_chars": 455, "code_v1_num_chars": 497, "code_v0_no_empty_lines": "n = int(input())\nedges = []\nfor id in range(n - 1):\n a, b = list(map(int, input().split()))\n edges.append([a - 1, b - 1, id])\nedges.sort()\nused = [0] * (n)\nans = [0] * (n - 1)\nnum = 1\nprev = 0\nfor edge in edges:\n _from, to, id = edge\n if _from != prev:\n num = 1\n if used[_from] == num:\n num += 1\n ans[id] = num\n used[to] = num\n num += 1\n prev = _from\nprint((max(ans)))\nfor color in ans:\n print(color)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nn = int(input())\nedges = []\nfor id in range(n - 1):\n a, b = list(map(int, input().split()))\n edges.append([a - 1, b - 1, id])\nedges.sort()\nused = [0] * (n)\nans = [0] * (n - 1)\nnum = 1\nprev = 0\nfor edge in edges:\n _from, to, id = edge\n if _from != prev:\n num = 1\n if used[_from] == num:\n num += 1\n ans[id] = num\n used[to] = num\n num += 1\n prev = _from\nprint((max(ans)))\nfor color in ans:\n print(color)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["+import sys", "+", "+input = sys.stdin.readline"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2558188839, "measured_runtime_v1": 0.0060829046, "runtime_lift": 42.0553832838, "key": ["s943818401", "s978957689"]} +{"user_id": "u234052535", "problem_id": "p00003", "language": "python", "submission_id_v0": "s822995507", "submission_id_v1": "s034189952", "cpu_time_v0": 50, "cpu_time_v1": 30, "memory_v0": 7724, "memory_v1": 7764, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.0, "input": "for i in range(0, int(input())):\n\n sidelen = [int(j) for j in input().split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")", "target": "import sys\n\nfor i in sys.stdin:\n\n try:\n\n sidelen = [int(j) for j in i.split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n except:\n\n continue", "code_v0_loc": 7, "code_v1_loc": 11, "code_v0_num_chars": 227, "code_v1_num_chars": 285, "code_v0_no_empty_lines": "for i in range(0, int(input())):\n sidelen = [int(j) for j in input().split(\" \")]\n sidelen.sort(reverse=True)\n if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nfor i in sys.stdin:\n try:\n sidelen = [int(j) for j in i.split(\" \")]\n sidelen.sort(reverse=True)\n if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:\n print(\"YES\")\n else:\n print(\"NO\")\n except:\n continue\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-for i in range(0, int(input())):", "- sidelen = [int(j) for j in input().split(\" \")]", "- sidelen.sort(reverse=True)", "- if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:", "- print(\"YES\")", "- else:", "- print(\"NO\")", "+import sys", "+", "+for i in sys.stdin:", "+ try:", "+ sidelen = [int(j) for j in i.split(\" \")]", "+ sidelen.sort(reverse=True)", "+ if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:", "+ print(\"YES\")", "+ else:", "+ print(\"NO\")", "+ except:", "+ continue"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3279889946, "measured_runtime_v1": 0.2582271154, "runtime_lift": 1.2701570634, "key": ["s822995507", "s034189952"]} +{"user_id": "u341543478", "problem_id": "p03424", "language": "python", "submission_id_v0": "s841365629", "submission_id_v1": "s932855105", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9156, "memory_v1": 8908, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "n = int(input())\n\ns = input().split()\n\ns = set(s)\n\nprint(('Four' if len(s) == 4 else 'Three'))", "target": "n = int(input())\n\ns = input().split()\n\nprint(('Four' if len(set(s)) == 4 else 'Three'))", "code_v0_loc": 4, "code_v1_loc": 3, "code_v0_num_chars": 92, "code_v1_num_chars": 85, "code_v0_no_empty_lines": "n = int(input())\ns = input().split()\ns = set(s)\nprint((\"Four\" if len(s) == 4 else \"Three\"))\n", "code_v1_no_empty_lines": "n = int(input())\ns = input().split()\nprint((\"Four\" if len(set(s)) == 4 else \"Three\"))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-s = set(s)", "-print((\"Four\" if len(s) == 4 else \"Three\"))", "+print((\"Four\" if len(set(s)) == 4 else \"Three\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2928216946, "measured_runtime_v1": 0.09356422, "runtime_lift": 3.1296332587, "key": ["s841365629", "s932855105"]} +{"user_id": "u633068244", "problem_id": "p00122", "language": "python", "submission_id_v0": "s871701752", "submission_id_v1": "s889694954", "cpu_time_v0": 20, "cpu_time_v1": 10, "memory_v0": 4272, "memory_v1": 4268, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "dX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return \"OK\"\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = input()\n\n\txy = list(map(int,input().split()))\n\n\tans = solve(x,y,xy)\n\n\tprint(ans if ans else \"NA\")", "target": "dX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return True\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = input()\n\n\txy = list(map(int,input().split()))\n\n\tprint(\"OK\" if solve(x,y,xy) else \"NA\")", "code_v0_loc": 22, "code_v1_loc": 21, "code_v0_num_chars": 579, "code_v1_num_chars": 568, "code_v0_no_empty_lines": "dX = [2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1]\ndY = [-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2]\n\n\ndef solve(x, y, XY):\n xy = XY[:]\n if len(xy) == 0:\n return \"OK\"\n sx, sy = xy.pop(0), xy.pop(0)\n for dx, dy in zip(dX, dY):\n if doa(x + dx, y + dy, sx, sy):\n r = solve(x + dx, y + dy, xy)\n if r:\n return r\n\n\ndef doa(x, y, sx, sy):\n if not (0 <= x <= 9 and 0 <= y <= 9):\n return False\n return True if abs(x - sx) < 2 and abs(y - sy) < 2 else False\n\n\nwhile 1:\n x, y = list(map(int, input().split()))\n if x == y == 0:\n break\n n = input()\n xy = list(map(int, input().split()))\n ans = solve(x, y, xy)\n print(ans if ans else \"NA\")\n", "code_v1_no_empty_lines": "dX = [2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1]\ndY = [-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2]\n\n\ndef solve(x, y, XY):\n xy = XY[:]\n if len(xy) == 0:\n return True\n sx, sy = xy.pop(0), xy.pop(0)\n for dx, dy in zip(dX, dY):\n if doa(x + dx, y + dy, sx, sy):\n r = solve(x + dx, y + dy, xy)\n if r:\n return r\n\n\ndef doa(x, y, sx, sy):\n if not (0 <= x <= 9 and 0 <= y <= 9):\n return False\n return True if abs(x - sx) < 2 and abs(y - sy) < 2 else False\n\n\nwhile 1:\n x, y = list(map(int, input().split()))\n if x == y == 0:\n break\n n = input()\n xy = list(map(int, input().split()))\n print(\"OK\" if solve(x, y, xy) else \"NA\")\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["- return \"OK\"", "+ return True", "- ans = solve(x, y, xy)", "- print(ans if ans else \"NA\")", "+ print(\"OK\" if solve(x, y, xy) else \"NA\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2335389843, "measured_runtime_v1": 0.183096947, "runtime_lift": 1.2754936015, "key": ["s871701752", "s889694954"]} +{"user_id": "u827202523", "problem_id": "p03988", "language": "python", "submission_id_v0": "s661300903", "submission_id_v1": "s790648502", "cpu_time_v0": 180, "cpu_time_v1": 75, "memory_v0": 38384, "memory_v1": 69368, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.33, "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(1000000)\n\nfrom collections import deque\n\ndef getN():\n\n return int(input())\n\ndef getList():\n\n return list(map(int, input().split()))\n\nimport math\n\n\n\nn = getN()\n\nnums = getList()\n\n\n\n# nums.sort(reverse=True)\n\nmx = max(nums)\n\nmn = (mx+1) // 2\n\nmndx = (mx % 2) + 1\n\n\n\nfrom collections import Counter\n\n\n\ncnt = Counter(nums)\n\n\n\nfor i in range(mn+1, mx+1):\n\n if cnt[i] < 2:\n\n print(\"Impossible\")\n\n sys.exit()\n\n\n\nif cnt[mn] != mndx:\n\n print(\"Impossible\")\n\nelse:\n\n print(\"Possible\")", "target": "import sys\n\nimport math\n\nimport copy\n\nfrom heapq import heappush, heappop, heapify\n\nfrom functools import cmp_to_key\n\nfrom bisect import bisect_left, bisect_right\n\nfrom collections import defaultdict, deque, Counter\n\n# sys.setrecursionlimit(1000000)\n\n\n\n# input aliases\n\ninput = sys.stdin.readline\n\ngetS = lambda: input().strip()\n\ngetN = lambda: int(input())\n\ngetList = lambda: list(map(int, input().split()))\n\ngetZList = lambda: [int(x) - 1 for x in input().split()]\n\n\n\nINF = float(\"inf\")\n\nMOD = 10**9 + 7\n\ndivide = lambda x: pow(x, MOD-2, MOD)\n\n\n\ndef pim():\n\n print(\"Impossible\")\n\n sys.exit()\n\ndef pp():\n\n print(\"Possible\")\n\n sys.exit()\n\ndef solve():\n\n n = getN()\n\n nums = getList()\n\n cnt = Counter(nums)\n\n mx = max(nums)\n\n mn = min(nums)\n\n\n\n if cnt[mx] < 2:\n\n pim()\n\n if mn < (mx + 1) // 2:\n\n pim()\n\n\n\n if mx % 2 == 0:\n\n if cnt[mx//2] != 1:\n\n pim()\n\n else:\n\n if cnt[(mx+1) // 2] != 2:\n\n pim()\n\n\n\n for i in range((mx + 1) // 2 + 1, mx+1):\n\n if cnt[i] < 2:\n\n pim()\n\n\n\n pp()\n\n\n\n\n\ndef main():\n\n n = getN()\n\n for _ in range(n):\n\n solve()\n\n\n\n return\n\nif __name__ == \"__main__\":\n\n # main()\n\n solve()\n\n\n\n\n\n\n\n\n\n\n", "code_v0_loc": 31, "code_v1_loc": 66, "code_v0_num_chars": 564, "code_v1_num_chars": 1240, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(1000000)\nfrom collections import deque\n\n\ndef getN():\n return int(input())\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\nimport math\n\nn = getN()\nnums = getList()\n# nums.sort(reverse=True)\nmx = max(nums)\nmn = (mx + 1) // 2\nmndx = (mx % 2) + 1\nfrom collections import Counter\n\ncnt = Counter(nums)\nfor i in range(mn + 1, mx + 1):\n if cnt[i] < 2:\n print(\"Impossible\")\n sys.exit()\nif cnt[mn] != mndx:\n print(\"Impossible\")\nelse:\n print(\"Possible\")\n", "code_v1_no_empty_lines": "import sys\nimport math\nimport copy\nfrom heapq import heappush, heappop, heapify\nfrom functools import cmp_to_key\nfrom bisect import bisect_left, bisect_right\nfrom collections import defaultdict, deque, Counter\n\n# sys.setrecursionlimit(1000000)\n# input aliases\ninput = sys.stdin.readline\ngetS = lambda: input().strip()\ngetN = lambda: int(input())\ngetList = lambda: list(map(int, input().split()))\ngetZList = lambda: [int(x) - 1 for x in input().split()]\nINF = float(\"inf\")\nMOD = 10**9 + 7\ndivide = lambda x: pow(x, MOD - 2, MOD)\n\n\ndef pim():\n print(\"Impossible\")\n sys.exit()\n\n\ndef pp():\n print(\"Possible\")\n sys.exit()\n\n\ndef solve():\n n = getN()\n nums = getList()\n cnt = Counter(nums)\n mx = max(nums)\n mn = min(nums)\n if cnt[mx] < 2:\n pim()\n if mn < (mx + 1) // 2:\n pim()\n if mx % 2 == 0:\n if cnt[mx // 2] != 1:\n pim()\n else:\n if cnt[(mx + 1) // 2] != 2:\n pim()\n for i in range((mx + 1) // 2 + 1, mx + 1):\n if cnt[i] < 2:\n pim()\n pp()\n\n\ndef main():\n n = getN()\n for _ in range(n):\n solve()\n return\n\n\nif __name__ == \"__main__\":\n # main()\n solve()\n", "code_same": false, "relative_loc_diff_percent": 53.0303030303, "diff": ["+import math", "+import copy", "+from heapq import heappush, heappop, heapify", "+from functools import cmp_to_key", "+from bisect import bisect_left, bisect_right", "+from collections import defaultdict, deque, Counter", "+# sys.setrecursionlimit(1000000)", "+# input aliases", "-sys.setrecursionlimit(1000000)", "-from collections import deque", "+getS = lambda: input().strip()", "+getN = lambda: int(input())", "+getList = lambda: list(map(int, input().split()))", "+getZList = lambda: [int(x) - 1 for x in input().split()]", "+INF = float(\"inf\")", "+MOD = 10**9 + 7", "+divide = lambda x: pow(x, MOD - 2, MOD)", "-def getN():", "- return int(input())", "+def pim():", "+ print(\"Impossible\")", "+ sys.exit()", "-def getList():", "- return list(map(int, input().split()))", "+def pp():", "+ print(\"Possible\")", "+ sys.exit()", "-import math", "+def solve():", "+ n = getN()", "+ nums = getList()", "+ cnt = Counter(nums)", "+ mx = max(nums)", "+ mn = min(nums)", "+ if cnt[mx] < 2:", "+ pim()", "+ if mn < (mx + 1) // 2:", "+ pim()", "+ if mx % 2 == 0:", "+ if cnt[mx // 2] != 1:", "+ pim()", "+ else:", "+ if cnt[(mx + 1) // 2] != 2:", "+ pim()", "+ for i in range((mx + 1) // 2 + 1, mx + 1):", "+ if cnt[i] < 2:", "+ pim()", "+ pp()", "-n = getN()", "-nums = getList()", "-# nums.sort(reverse=True)", "-mx = max(nums)", "-mn = (mx + 1) // 2", "-mndx = (mx % 2) + 1", "-from collections import Counter", "-cnt = Counter(nums)", "-for i in range(mn + 1, mx + 1):", "- if cnt[i] < 2:", "- print(\"Impossible\")", "- sys.exit()", "-if cnt[mn] != mndx:", "- print(\"Impossible\")", "-else:", "- print(\"Possible\")", "+def main():", "+ n = getN()", "+ for _ in range(n):", "+ solve()", "+ return", "+", "+", "+if __name__ == \"__main__\":", "+ # main()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.200920903, "measured_runtime_v1": 0.0064778831, "runtime_lift": 31.0164448269, "key": ["s661300903", "s790648502"]} +{"user_id": "u990900604", "problem_id": "p02390", "language": "python", "submission_id_v0": "s359089221", "submission_id_v1": "s084524983", "cpu_time_v0": 50, "cpu_time_v1": 10, "memory_v0": 9852, "memory_v1": 4632, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.0, "input": "import sys\n\n\n\nif __name__ == '__main__':\n\n import doctest\n\n doctest.testmod()\n\n S = int(sys.stdin.read())\n\n h = S / 3600\n\n m = (S % 3600) / 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n", "target": "#!/usr/bin/env python\n\n#-*- coding: utf-8 -*-\n\n\n\n# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D\n\n\n\nif __name__ == '__main__':\n\n S = int(input())\n\n h = S / 3600\n\n m = (S % 3600) / 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n", "code_v0_loc": 10, "code_v1_loc": 11, "code_v0_num_chars": 208, "code_v1_num_chars": 266, "code_v0_no_empty_lines": "import sys\n\nif __name__ == \"__main__\":\n import doctest\n\n doctest.testmod()\n S = int(sys.stdin.read())\n h = S / 3600\n m = (S % 3600) / 60\n s = S % 60\n print(\"%d:%d:%d\" % (h, m, s))\n", "code_v1_no_empty_lines": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D\nif __name__ == \"__main__\":\n S = int(input())\n h = S / 3600\n m = (S % 3600) / 60\n s = S % 60\n print(\"%d:%d:%d\" % (h, m, s))\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-import sys", "-", "+#!/usr/bin/env python", "+# -*- coding: utf-8 -*-", "+# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D", "- import doctest", "-", "- doctest.testmod()", "- S = int(sys.stdin.read())", "+ S = int(input())"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7406475422, "measured_runtime_v1": 0.2172099149, "runtime_lift": 3.4098238217, "key": ["s359089221", "s084524983"]} +{"user_id": "u780698286", "problem_id": "p02880", "language": "python", "submission_id_v0": "s530137772", "submission_id_v1": "s289678775", "cpu_time_v0": 31, "cpu_time_v1": 26, "memory_v0": 9160, "memory_v1": 9096, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.13, "input": "n = int(input())\n\ns = []\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n s.append(i*j)\n\nif n in s:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "target": "import sys\n\n\n\nn = int(input())\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n if i*j == n:\n\n print(\"Yes\")\n\n sys.exit()\n\nprint(\"No\")\n", "code_v0_loc": 9, "code_v1_loc": 9, "code_v0_num_chars": 143, "code_v1_num_chars": 150, "code_v0_no_empty_lines": "n = int(input())\ns = []\nfor i in range(1, 10):\n for j in range(1, 10):\n s.append(i * j)\nif n in s:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "import sys\n\nn = int(input())\nfor i in range(1, 10):\n for j in range(1, 10):\n if i * j == n:\n print(\"Yes\")\n sys.exit()\nprint(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+import sys", "+", "-s = []", "- s.append(i * j)", "-if n in s:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+ if i * j == n:", "+ print(\"Yes\")", "+ sys.exit()", "+print(\"No\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2618995297, "measured_runtime_v1": 0.0062340605, "runtime_lift": 42.0110661723, "key": ["s530137772", "s289678775"]} +{"user_id": "u814986259", "problem_id": "p03796", "language": "python", "submission_id_v0": "s294020052", "submission_id_v1": "s579876547", "cpu_time_v0": 229, "cpu_time_v1": 40, "memory_v0": 3968, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.53, "input": "import math\n\nN=int(input())\n\nans=math.factorial(N)\n\nprint((ans%(10**9 +7)))", "target": "mod=10**9+7\n\nN=int(input())\n\nans=1\n\nfor i in range(1,N+1):\n\n ans*=i\n\n ans%=mod\n\nprint(ans)", "code_v0_loc": 4, "code_v1_loc": 7, "code_v0_num_chars": 73, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = math.factorial(N)\nprint((ans % (10**9 + 7)))\n", "code_v1_no_empty_lines": "mod = 10**9 + 7\nN = int(input())\nans = 1\nfor i in range(1, N + 1):\n ans *= i\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-import math", "-", "+mod = 10**9 + 7", "-ans = math.factorial(N)", "-print((ans % (10**9 + 7)))", "+ans = 1", "+for i in range(1, N + 1):", "+ ans *= i", "+ ans %= mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3063099709, "measured_runtime_v1": 0.2071282012, "runtime_lift": 1.4788424222, "key": ["s294020052", "s579876547"]} +{"user_id": "u670180528", "problem_id": "p03634", "language": "python", "submission_id_v0": "s592706363", "submission_id_v1": "s081294326", "cpu_time_v0": 718, "cpu_time_v1": 476, "memory_v0": 63540, "memory_v1": 64180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.7, "input": "from collections import deque\n\nn,*t=list(map(int,open(0).read().split()))\n\ncon=[[] for _ in range(n)]\n\ndist_f_k=[0]*n\n\n\n\nfor a,b,c in zip(t[:3*n-3:3],t[1::3],t[2::3]):\n\n\tcon[a-1].append((b-1,c))\n\n\tcon[b-1].append((a-1,c))\n\n\n\nk=t[3*n-2]\n\nque=deque([k-1])\n\nwhile que:\n\n\tcur=que.popleft()\n\n\tfor nxt,dd in con[cur]:\n\n\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\tque.append(nxt)\n\n\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\nfor x,y in zip(t[3*n-1::2],t[3*n::2]):\n\n\tprint((dist_f_k[x-1]+dist_f_k[y-1]))", "target": "def solve():\n\n\tfrom collections import deque\n\n\tn,*t=list(map(int,open(0).read().split()))\n\n\tcon=[[] for _ in range(n)]\n\n\tdist_f_k=[0]*n\n\n\tl1,l2=t[:3*n-3],t[3*n-1:]\n\n\n\n\tfor a,b,c in zip(*[iter(l1)]*3):\n\n\t\tcon[a-1].append((b-1,c))\n\n\t\tcon[b-1].append((a-1,c))\n\n\n\n\tk=t[3*n-2]\n\n\tque=deque([k-1])\n\n\twhile que:\n\n\t\tcur=que.popleft()\n\n\t\tfor nxt,dd in con[cur]:\n\n\t\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\t\tque.append(nxt)\n\n\t\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\n\tfor x,y in zip(*[iter(l2)]*2):\n\n\t\tprint((dist_f_k[x-1]+dist_f_k[y-1]))\n\n\t\t\n\nif __name__==\"__main__\":\n\n\tsolve()", "code_v0_loc": 20, "code_v1_loc": 25, "code_v0_num_chars": 476, "code_v1_num_chars": 553, "code_v0_no_empty_lines": "from collections import deque\n\nn, *t = list(map(int, open(0).read().split()))\ncon = [[] for _ in range(n)]\ndist_f_k = [0] * n\nfor a, b, c in zip(t[: 3 * n - 3 : 3], t[1::3], t[2::3]):\n con[a - 1].append((b - 1, c))\n con[b - 1].append((a - 1, c))\nk = t[3 * n - 2]\nque = deque([k - 1])\nwhile que:\n cur = que.popleft()\n for nxt, dd in con[cur]:\n if dist_f_k[nxt] == 0 and nxt != k - 1:\n que.append(nxt)\n dist_f_k[nxt] = dist_f_k[cur] + dd\nfor x, y in zip(t[3 * n - 1 :: 2], t[3 * n :: 2]):\n print((dist_f_k[x - 1] + dist_f_k[y - 1]))\n", "code_v1_no_empty_lines": "def solve():\n from collections import deque\n\n n, *t = list(map(int, open(0).read().split()))\n con = [[] for _ in range(n)]\n dist_f_k = [0] * n\n l1, l2 = t[: 3 * n - 3], t[3 * n - 1 :]\n for a, b, c in zip(*[iter(l1)] * 3):\n con[a - 1].append((b - 1, c))\n con[b - 1].append((a - 1, c))\n k = t[3 * n - 2]\n que = deque([k - 1])\n while que:\n cur = que.popleft()\n for nxt, dd in con[cur]:\n if dist_f_k[nxt] == 0 and nxt != k - 1:\n que.append(nxt)\n dist_f_k[nxt] = dist_f_k[cur] + dd\n for x, y in zip(*[iter(l2)] * 2):\n print((dist_f_k[x - 1] + dist_f_k[y - 1]))\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-from collections import deque", "+def solve():", "+ from collections import deque", "-n, *t = list(map(int, open(0).read().split()))", "-con = [[] for _ in range(n)]", "-dist_f_k = [0] * n", "-for a, b, c in zip(t[: 3 * n - 3 : 3], t[1::3], t[2::3]):", "- con[a - 1].append((b - 1, c))", "- con[b - 1].append((a - 1, c))", "-k = t[3 * n - 2]", "-que = deque([k - 1])", "-while que:", "- cur = que.popleft()", "- for nxt, dd in con[cur]:", "- if dist_f_k[nxt] == 0 and nxt != k - 1:", "- que.append(nxt)", "- dist_f_k[nxt] = dist_f_k[cur] + dd", "-for x, y in zip(t[3 * n - 1 :: 2], t[3 * n :: 2]):", "- print((dist_f_k[x - 1] + dist_f_k[y - 1]))", "+ n, *t = list(map(int, open(0).read().split()))", "+ con = [[] for _ in range(n)]", "+ dist_f_k = [0] * n", "+ l1, l2 = t[: 3 * n - 3], t[3 * n - 1 :]", "+ for a, b, c in zip(*[iter(l1)] * 3):", "+ con[a - 1].append((b - 1, c))", "+ con[b - 1].append((a - 1, c))", "+ k = t[3 * n - 2]", "+ que = deque([k - 1])", "+ while que:", "+ cur = que.popleft()", "+ for nxt, dd in con[cur]:", "+ if dist_f_k[nxt] == 0 and nxt != k - 1:", "+ que.append(nxt)", "+ dist_f_k[nxt] = dist_f_k[cur] + dd", "+ for x, y in zip(*[iter(l2)] * 2):", "+ print((dist_f_k[x - 1] + dist_f_k[y - 1]))", "+", "+", "+if __name__ == \"__main__\":", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.331901531, "measured_runtime_v1": 0.2149364519, "runtime_lift": 1.5441844695, "key": ["s592706363", "s081294326"]} +{"user_id": "u724687935", "problem_id": "p02622", "language": "python", "submission_id_v0": "s346270661", "submission_id_v1": "s299240564", "cpu_time_v0": 67, "cpu_time_v1": 60, "memory_v0": 9408, "memory_v1": 9320, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.45, "input": "S = input()\n\nT = input()\n\nN = len(S)\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)\n", "target": "S = input()\n\nT = input()\n\ncnt = 0\n\nfor i in range(len(S)):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 107, "code_v1_num_chars": 99, "code_v0_no_empty_lines": "S = input()\nT = input()\nN = len(S)\ncnt = 0\nfor i in range(N):\n cnt += S[i] != T[i]\nprint(cnt)\n", "code_v1_no_empty_lines": "S = input()\nT = input()\ncnt = 0\nfor i in range(len(S)):\n cnt += S[i] != T[i]\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-N = len(S)", "-for i in range(N):", "+for i in range(len(S)):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3924936354, "measured_runtime_v1": 0.2147260756, "runtime_lift": 1.8278806345, "key": ["s346270661", "s299240564"]} +{"user_id": "u604774382", "problem_id": "p02264", "language": "python", "submission_id_v0": "s685908626", "submission_id_v1": "s418135932", "cpu_time_v0": 1410, "cpu_time_v1": 1260, "memory_v0": 17580, "memory_v1": 11516, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.64, "input": "n, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n\tps[i], t[i] = input( ).split( \" \" )\n\n\n\n\n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n\tpsi = ps.pop( 0 )\n\n\tti = int( t.pop( 0 ) )\n\n\tif ti <= q:\n\n\t\tqsum += ti\t\n\n\t\toutput.append( psi+\" \"+str( qsum ) )\n\n\telse:\n\n\t\tt.append( ti - q )\n\n\t\tps.append( psi )\n\n\t\tqsum += q\n\n\n\nprint(( \"\\n\".join( output ) ))", "target": "n, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n ps[i], t[i] = input( ).split( \" \" )\n\n \n\n \n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n psi = ps.pop( 0 )\n\n ti = int( t.pop( 0 ) )\n\n if ti <= q:\n\n qsum += ti\n\n output.append( \"\".join( ( psi, \" \", str( qsum ) ) ) )\n\n else:\n\n t.append( ti - q )\n\n ps.append( psi )\n\n qsum += q\n\n \n\nprint(( \"\\n\".join( output ) ))", "code_v0_loc": 21, "code_v1_loc": 21, "code_v0_num_chars": 383, "code_v1_num_chars": 455, "code_v0_no_empty_lines": "n, q = [int(val) for val in input().split(\" \")]\nps = [0] * n\nt = [0] * n\nfor i in range(n):\n ps[i], t[i] = input().split(\" \")\noutput = []\nqsum = 0\nwhile t:\n psi = ps.pop(0)\n ti = int(t.pop(0))\n if ti <= q:\n qsum += ti\n output.append(psi + \" \" + str(qsum))\n else:\n t.append(ti - q)\n ps.append(psi)\n qsum += q\nprint((\"\\n\".join(output)))\n", "code_v1_no_empty_lines": "n, q = [int(val) for val in input().split(\" \")]\nps = [0] * n\nt = [0] * n\nfor i in range(n):\n ps[i], t[i] = input().split(\" \")\noutput = []\nqsum = 0\nwhile t:\n psi = ps.pop(0)\n ti = int(t.pop(0))\n if ti <= q:\n qsum += ti\n output.append(\"\".join((psi, \" \", str(qsum))))\n else:\n t.append(ti - q)\n ps.append(psi)\n qsum += q\nprint((\"\\n\".join(output)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- output.append(psi + \" \" + str(qsum))", "+ output.append(\"\".join((psi, \" \", str(qsum))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2516228666, "measured_runtime_v1": 0.0710392208, "runtime_lift": 3.5420274002, "key": ["s685908626", "s418135932"]} +{"user_id": "u629538480", "problem_id": "p02688", "language": "python", "submission_id_v0": "s093466568", "submission_id_v1": "s996398988", "cpu_time_v0": 24, "cpu_time_v1": 21, "memory_v0": 9192, "memory_v1": 8948, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.5, "input": "N,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(input())\n\n b=input().split(' ')\n\n for j in range(count):\n\n if int(b[j]) in a:\n\n a.remove(int(b[j]))\n\nprint((len(a)))", "target": "N,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(input())\n\n b=[int(x.strip()) for x in input().split(' ')]\n\n for j in range(count):\n\n if b[j] in a:\n\n a.remove(b[j])\n\nprint((len(a)))", "code_v0_loc": 9, "code_v1_loc": 9, "code_v0_num_chars": 214, "code_v1_num_chars": 230, "code_v0_no_empty_lines": "N, K = list(map(int, input().split(\" \")))\na = list(range(1, N + 1))\nfor i in range(K):\n count = int(input())\n b = input().split(\" \")\n for j in range(count):\n if int(b[j]) in a:\n a.remove(int(b[j]))\nprint((len(a)))\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split(\" \")))\na = list(range(1, N + 1))\nfor i in range(K):\n count = int(input())\n b = [int(x.strip()) for x in input().split(\" \")]\n for j in range(count):\n if b[j] in a:\n a.remove(b[j])\nprint((len(a)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- b = input().split(\" \")", "+ b = [int(x.strip()) for x in input().split(\" \")]", "- if int(b[j]) in a:", "- a.remove(int(b[j]))", "+ if b[j] in a:", "+ a.remove(b[j])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2616522854, "measured_runtime_v1": 0.1381282375, "runtime_lift": 1.8942707889, "key": ["s093466568", "s996398988"]} +{"user_id": "u780342333", "problem_id": "p02416", "language": "python", "submission_id_v0": "s248122741", "submission_id_v1": "s360997133", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7732, "memory_v1": 5624, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "res = []\n\nwhile True:\n\n s = input()\n\n if s == '0':\n\n break\n\n\n\n res.append(sum([int(x) for x in s]))\n\n\n\nfor e in res:\n\n print(e)", "target": "def sum_of_numbers(n):\n\n '''\n\n (* int -> int *)\n\n '''\n\n res = [int(n) for n in list(str(n))]\n\n \n\n return sum(res)\n\n\n\nif __name__ == \"__main__\":\n\n while True:\n\n n = input()\n\n if n == '0':\n\n break\n\n print((sum_of_numbers(n)))\n", "code_v0_loc": 10, "code_v1_loc": 14, "code_v0_num_chars": 146, "code_v1_num_chars": 275, "code_v0_no_empty_lines": "res = []\nwhile True:\n s = input()\n if s == \"0\":\n break\n res.append(sum([int(x) for x in s]))\nfor e in res:\n print(e)\n", "code_v1_no_empty_lines": "def sum_of_numbers(n):\n \"\"\"\n (* int -> int *)\n \"\"\"\n res = [int(n) for n in list(str(n))]\n return sum(res)\n\n\nif __name__ == \"__main__\":\n while True:\n n = input()\n if n == \"0\":\n break\n print((sum_of_numbers(n)))\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-res = []", "-while True:", "- s = input()", "- if s == \"0\":", "- break", "- res.append(sum([int(x) for x in s]))", "-for e in res:", "- print(e)", "+def sum_of_numbers(n):", "+ \"\"\"", "+ (* int -> int *)", "+ \"\"\"", "+ res = [int(n) for n in list(str(n))]", "+ return sum(res)", "+", "+", "+if __name__ == \"__main__\":", "+ while True:", "+ n = input()", "+ if n == \"0\":", "+ break", "+ print((sum_of_numbers(n)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2668570542, "measured_runtime_v1": 0.0949980106, "runtime_lift": 2.8090804473, "key": ["s248122741", "s360997133"]} +{"user_id": "u729133443", "problem_id": "p03086", "language": "python", "submission_id_v0": "s780520490", "submission_id_v1": "s016683067", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "import re;print((max(list(map(len,re.split('[^ACGT]',input()))))))", "target": "p=m=0\n\nfor c in input():p=-~p*(c in'ATGC');m=max(m,p)\n\nprint(m)", "code_v0_loc": 1, "code_v1_loc": 3, "code_v0_num_chars": 58, "code_v1_num_chars": 63, "code_v0_no_empty_lines": "import re\n\nprint((max(list(map(len, re.split(\"[^ACGT]\", input()))))))\n", "code_v1_no_empty_lines": "p = m = 0\nfor c in input():\n p = -~p * (c in \"ATGC\")\n m = max(m, p)\nprint(m)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import re", "-", "-print((max(list(map(len, re.split(\"[^ACGT]\", input()))))))", "+p = m = 0", "+for c in input():", "+ p = -~p * (c in \"ATGC\")", "+ m = max(m, p)", "+print(m)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2963340635, "measured_runtime_v1": 0.1579363909, "runtime_lift": 1.8762874209, "key": ["s780520490", "s016683067"]} +{"user_id": "u654470292", "problem_id": "p03828", "language": "python", "submission_id_v0": "s594973511", "submission_id_v1": "s914422541", "cpu_time_v0": 386, "cpu_time_v1": 305, "memory_v0": 54360, "memory_v1": 67304, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.98, "input": "import math\n\nn=int(input())\n\nwaru=10**9+7\n\n\n\nli=[]\n\nli2=[]\n\n\n\nfor i in range(2,n+1):\n\n tmp=math.factorial(n)\n\n flag=1\n\n for j in range(len(li)):\n\n if i%li[j]==0:\n\n flag=0\n\n break\n\n if flag==1:\n\n li.append(i)\n\n li2.append(0)\n\n while tmp%i==0:\n\n li2[len(li)-1]+=1\n\n tmp=tmp//i\n\nans=1\n\n# print(li)\n\n# print(li2)\n\nfor i in range(len(li2)):\n\n ans*=li2[i]+1\n\nprint((ans%waru))", "target": "import sys\n\nfrom collections import *\n\nimport heapq\n\nimport math\n\nimport bisect\n\nfrom itertools import permutations,accumulate,combinations,product\n\nfrom math import gcd\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\ndef ruiseki(lst):\n\n return [0]+list(accumulate(lst))\n\nmod=pow(10,9)+7\n\nal=[chr(ord('a') + i) for i in range(26)]\n\n\n\ndef factorization(n):\n\n arr = []\n\n temp = n\n\n for i in range(2, int(-(-n**0.5//1))+1):\n\n if temp%i==0:\n\n cnt=0\n\n while temp%i==0:\n\n cnt+=1\n\n temp //= i\n\n arr.append([i, cnt])\n\n if temp!=1:\n\n arr.append([temp, 1])\n\n if arr==[]:\n\n arr.append([n, 1])\n\n return arr\n\n\n\nn=int(input())\n\nif n==1:\n\n print((1))\n\n exit()\n\nd=defaultdict(int)\n\nfor i in range(2,n+1):\n\n tmp=factorization(i)\n\n for j in tmp:\n\n yaku,ko=j\n\n d[yaku]+=ko\n\n# print(d)\n\nans=1\n\nfor i in list(d.values()):\n\n ans*=i+1\n\n ans%=mod\n\nprint(ans)", "code_v0_loc": 26, "code_v1_loc": 46, "code_v0_num_chars": 455, "code_v1_num_chars": 973, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nwaru = 10**9 + 7\nli = []\nli2 = []\nfor i in range(2, n + 1):\n tmp = math.factorial(n)\n flag = 1\n for j in range(len(li)):\n if i % li[j] == 0:\n flag = 0\n break\n if flag == 1:\n li.append(i)\n li2.append(0)\n while tmp % i == 0:\n li2[len(li) - 1] += 1\n tmp = tmp // i\nans = 1\n# print(li)\n# print(li2)\nfor i in range(len(li2)):\n ans *= li2[i] + 1\nprint((ans % waru))\n", "code_v1_no_empty_lines": "import sys\nfrom collections import *\nimport heapq\nimport math\nimport bisect\nfrom itertools import permutations, accumulate, combinations, product\nfrom math import gcd\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\ndef ruiseki(lst):\n return [0] + list(accumulate(lst))\n\n\nmod = pow(10, 9) + 7\nal = [chr(ord(\"a\") + i) for i in range(26)]\n\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-(n**0.5) // 1)) + 1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append([i, cnt])\n if temp != 1:\n arr.append([temp, 1])\n if arr == []:\n arr.append([n, 1])\n return arr\n\n\nn = int(input())\nif n == 1:\n print((1))\n exit()\nd = defaultdict(int)\nfor i in range(2, n + 1):\n tmp = factorization(i)\n for j in tmp:\n yaku, ko = j\n d[yaku] += ko\n# print(d)\nans = 1\nfor i in list(d.values()):\n ans *= i + 1\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 43.4782608696, "diff": ["+import sys", "+from collections import *", "+import heapq", "+import bisect", "+from itertools import permutations, accumulate, combinations, product", "+from math import gcd", "+", "+", "+def input():", "+ return sys.stdin.readline()[:-1]", "+", "+", "+def ruiseki(lst):", "+ return [0] + list(accumulate(lst))", "+", "+", "+mod = pow(10, 9) + 7", "+al = [chr(ord(\"a\") + i) for i in range(26)]", "+", "+", "+def factorization(n):", "+ arr = []", "+ temp = n", "+ for i in range(2, int(-(-(n**0.5) // 1)) + 1):", "+ if temp % i == 0:", "+ cnt = 0", "+ while temp % i == 0:", "+ cnt += 1", "+ temp //= i", "+ arr.append([i, cnt])", "+ if temp != 1:", "+ arr.append([temp, 1])", "+ if arr == []:", "+ arr.append([n, 1])", "+ return arr", "+", "-waru = 10**9 + 7", "-li = []", "-li2 = []", "+if n == 1:", "+ print((1))", "+ exit()", "+d = defaultdict(int)", "- tmp = math.factorial(n)", "- flag = 1", "- for j in range(len(li)):", "- if i % li[j] == 0:", "- flag = 0", "- break", "- if flag == 1:", "- li.append(i)", "- li2.append(0)", "- while tmp % i == 0:", "- li2[len(li) - 1] += 1", "- tmp = tmp // i", "+ tmp = factorization(i)", "+ for j in tmp:", "+ yaku, ko = j", "+ d[yaku] += ko", "+# print(d)", "-# print(li)", "-# print(li2)", "-for i in range(len(li2)):", "- ans *= li2[i] + 1", "-print((ans % waru))", "+for i in list(d.values()):", "+ ans *= i + 1", "+ ans %= mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4593854201, "measured_runtime_v1": 0.0895126674, "runtime_lift": 5.1320716194, "key": ["s594973511", "s914422541"]} +{"user_id": "u513081876", "problem_id": "p03325", "language": "python", "submission_id_v0": "s352799823", "submission_id_v1": "s651648403", "cpu_time_v0": 118, "cpu_time_v1": 82, "memory_v0": 4148, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.51, "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nans = 0\n\ncheck = [0]*30\n\nfor i in range(1, 31):\n\n check[i-1] = 2**i\n\n\n\nfor i in A:\n\n if i % 2 == 0:\n\n j = 0\n\n while check[j] <= i:\n\n if i % check[j] == 0:\n\n add = check[j]\n\n else:\n\n break\n\n \n\n j += 1\n\n ans += j\n\n \n\nprint(ans)", "target": "N = int(input())\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in a:\n\n while i % 2 == 0:\n\n i //= 2\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 20, "code_v1_loc": 9, "code_v0_num_chars": 394, "code_v1_num_chars": 149, "code_v0_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nans = 0\ncheck = [0] * 30\nfor i in range(1, 31):\n check[i - 1] = 2**i\nfor i in A:\n if i % 2 == 0:\n j = 0\n while check[j] <= i:\n if i % check[j] == 0:\n add = check[j]\n else:\n break\n j += 1\n ans += j\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\na = [int(i) for i in input().split()]\nans = 0\nfor i in a:\n while i % 2 == 0:\n i //= 2\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 55.0, "diff": ["-A = [int(i) for i in input().split()]", "+a = [int(i) for i in input().split()]", "-check = [0] * 30", "-for i in range(1, 31):", "- check[i - 1] = 2**i", "-for i in A:", "- if i % 2 == 0:", "- j = 0", "- while check[j] <= i:", "- if i % check[j] == 0:", "- add = check[j]", "- else:", "- break", "- j += 1", "- ans += j", "+for i in a:", "+ while i % 2 == 0:", "+ i //= 2", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3522037606, "measured_runtime_v1": 0.279608284, "runtime_lift": 1.2596327819, "key": ["s352799823", "s651648403"]} +{"user_id": "u513081876", "problem_id": "p03845", "language": "python", "submission_id_v0": "s710663686", "submission_id_v1": "s021252857", "cpu_time_v0": 28, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.29, "input": "N = int(input())\n\nT = list(map(int, input().split()))\n\nM = int(input())\n\np = []\n\nx = []\n\nans = []\n\nfor i in range(M):\n\n p, x = list(map(int, input().split()))\n\n ans.append(sum(T[:p-1])+x+sum(T[p:]))\n\n\n\nfor _ in ans:\n\n print(_)", "target": "N = int(input())\n\nT = list(map(int, input().split()))\n\nM = int(input())\n\nP, X, ans = [0]*M, [0]*M, []\n\nbase = sum(T)\n\n\n\nfor i in range(M):\n\n P, X = list(map(int, input().split()))\n\n ans.append(base-T[P-1]+X)\n\n\n\nfor i in ans:\n\n print(i)", "code_v0_loc": 12, "code_v1_loc": 12, "code_v0_num_chars": 229, "code_v1_num_chars": 238, "code_v0_no_empty_lines": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\np = []\nx = []\nans = []\nfor i in range(M):\n p, x = list(map(int, input().split()))\n ans.append(sum(T[: p - 1]) + x + sum(T[p:]))\nfor _ in ans:\n print(_)\n", "code_v1_no_empty_lines": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nP, X, ans = [0] * M, [0] * M, []\nbase = sum(T)\nfor i in range(M):\n P, X = list(map(int, input().split()))\n ans.append(base - T[P - 1] + X)\nfor i in ans:\n print(i)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-p = []", "-x = []", "-ans = []", "+P, X, ans = [0] * M, [0] * M, []", "+base = sum(T)", "- p, x = list(map(int, input().split()))", "- ans.append(sum(T[: p - 1]) + x + sum(T[p:]))", "-for _ in ans:", "- print(_)", "+ P, X = list(map(int, input().split()))", "+ ans.append(base - T[P - 1] + X)", "+for i in ans:", "+ print(i)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2214040067, "measured_runtime_v1": 0.1726463588, "runtime_lift": 1.2824134157, "key": ["s710663686", "s021252857"]} +{"user_id": "u581603131", "problem_id": "p03796", "language": "python", "submission_id_v0": "s669812244", "submission_id_v1": "s638032890", "cpu_time_v0": 230, "cpu_time_v1": 41, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.17, "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "target": "ans=1\n\nn=int(input())\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 65, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nn = int(input())\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-N = int(input())", "-print((math.factorial(N) % (10**9 + 7)))", "+ans = 1", "+n = int(input())", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans = ans % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8658925366, "measured_runtime_v1": 0.3537542467, "runtime_lift": 2.4477233692, "key": ["s669812244", "s638032890"]} +{"user_id": "u197300773", "problem_id": "p02901", "language": "python", "submission_id_v0": "s172477662", "submission_id_v1": "s096488733", "cpu_time_v0": 1463, "cpu_time_v1": 1316, "memory_v0": 36468, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.05, "input": "def main():\n\n import math\n\n N,M=list(map(int,input().split()))\n\n a=[]\n\n for i in range(M):\n\n tmp=list(map(int,input().split()))\n\n tmpc=list(map(int,input().split()))\n\n c=0\n\n for j in range(len(tmpc)):\n\n c+=2**(tmpc[j]-1)\n\n tmp[1]=c\n\n a+=[tmp]\n\n\n\n\n\n dp=[[10**10 for j in range(2**N)] for i in range(M)]\n\n dp[0][0]=0\n\n dp[0][a[0][1]]=a[0][0]\n\n\n\n\n\n for i in range(1,M):\n\n dp[i]=dp[i-1]\n\n for j in range(2**N):\n\n z,p=a[i][0],a[i][1]\n\n q=j|p\n\n x=dp[i-1][j]+z\n\n if dp[i][q]>x: dp[i][q]=x\n\n\n\n ans=dp[M-1][2**N-1]\n\n print((ans if ans<10**10 else -1))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "n,m=list(map(int,input().split()))\n\nL=2**n\n\ncost=[0]+[10**8 for i in range(L-1)]\n\n\n\nfor i in range(m):\n\n a,b=list(map(int,input().split()))\n\n c=sum([2**(int(i)-1) for i in input().split()])\n\n for j in range(L):\n\n q=j|c\n\n x=cost[j]+a\n\n if cost[q]>x:\n\n cost[q]=x\n\nprint((cost[L-1] if cost[L-1]<10**8 else -1))", "code_v0_loc": 32, "code_v1_loc": 13, "code_v0_num_chars": 718, "code_v1_num_chars": 334, "code_v0_no_empty_lines": "def main():\n import math\n\n N, M = list(map(int, input().split()))\n a = []\n for i in range(M):\n tmp = list(map(int, input().split()))\n tmpc = list(map(int, input().split()))\n c = 0\n for j in range(len(tmpc)):\n c += 2 ** (tmpc[j] - 1)\n tmp[1] = c\n a += [tmp]\n dp = [[10**10 for j in range(2**N)] for i in range(M)]\n dp[0][0] = 0\n dp[0][a[0][1]] = a[0][0]\n for i in range(1, M):\n dp[i] = dp[i - 1]\n for j in range(2**N):\n z, p = a[i][0], a[i][1]\n q = j | p\n x = dp[i - 1][j] + z\n if dp[i][q] > x:\n dp[i][q] = x\n ans = dp[M - 1][2**N - 1]\n print((ans if ans < 10**10 else -1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nL = 2**n\ncost = [0] + [10**8 for i in range(L - 1)]\nfor i in range(m):\n a, b = list(map(int, input().split()))\n c = sum([2 ** (int(i) - 1) for i in input().split()])\n for j in range(L):\n q = j | c\n x = cost[j] + a\n if cost[q] > x:\n cost[q] = x\nprint((cost[L - 1] if cost[L - 1] < 10**8 else -1))\n", "code_same": false, "relative_loc_diff_percent": 59.375, "diff": ["-def main():", "- import math", "-", "- N, M = list(map(int, input().split()))", "- a = []", "- for i in range(M):", "- tmp = list(map(int, input().split()))", "- tmpc = list(map(int, input().split()))", "- c = 0", "- for j in range(len(tmpc)):", "- c += 2 ** (tmpc[j] - 1)", "- tmp[1] = c", "- a += [tmp]", "- dp = [[10**10 for j in range(2**N)] for i in range(M)]", "- dp[0][0] = 0", "- dp[0][a[0][1]] = a[0][0]", "- for i in range(1, M):", "- dp[i] = dp[i - 1]", "- for j in range(2**N):", "- z, p = a[i][0], a[i][1]", "- q = j | p", "- x = dp[i - 1][j] + z", "- if dp[i][q] > x:", "- dp[i][q] = x", "- ans = dp[M - 1][2**N - 1]", "- print((ans if ans < 10**10 else -1))", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+n, m = list(map(int, input().split()))", "+L = 2**n", "+cost = [0] + [10**8 for i in range(L - 1)]", "+for i in range(m):", "+ a, b = list(map(int, input().split()))", "+ c = sum([2 ** (int(i) - 1) for i in input().split()])", "+ for j in range(L):", "+ q = j | c", "+ x = cost[j] + a", "+ if cost[q] > x:", "+ cost[q] = x", "+print((cost[L - 1] if cost[L - 1] < 10**8 else -1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3366471643, "measured_runtime_v1": 0.2183672116, "runtime_lift": 1.5416561941, "key": ["s172477662", "s096488733"]} +{"user_id": "u829796346", "problem_id": "p02574", "language": "python", "submission_id_v0": "s911286307", "submission_id_v1": "s843819881", "cpu_time_v0": 997, "cpu_time_v1": 462, "memory_v0": 203940, "memory_v1": 203640, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 53.66, "input": "#!/usr/bin/env pypy3\n\n# N,M = map(int,sys.stdin.readline().split())\n\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n\n# s = sys.stdin.readline().rstrip()\n\n# N = int(sys.stdin.readline())\n\n# INF = float(\"inf\")\n\nimport math,sys\n\n\n\nn = int(sys.stdin.readline())\n\na = tuple(map(int,sys.stdin.readline().split()))\n\n#n = int(input())\n\n#a = list(map(int,input().split()))\n\ng = math.gcd(a[0],a[1])\n\nfor i in range(2,n):\n\n g = math.gcd(g,a[i])\n\nM = max(a)\n\nacc = a[0]\n\nfor i in range(n):\n\n acc = math.gcd(acc,a[i])\n\nif acc != 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nLIMIT=max(a)\n\nminPrime = [0]*(LIMIT+1)\n\nminPrime[1] = 1\n\ndef make():\n\n for i in range(2,LIMIT+1):\n\n if minPrime[i] == 0:\n\n minPrime[i] = i\n\n #print(i)\n\n for j in range(i+i,LIMIT+1,i):\n\n #print(i,j)\n\n if minPrime[j] == 0:\n\n minPrime[j] = i\n\nmake()\n\ndef factrial(N):\n\n ret = []\n\n while minPrime[N] != N:\n\n ret.append(minPrime[N])\n\n N = N//minPrime[N]\n\n if N != 1:\n\n ret.append(N)\n\n return ret\n\n\n\njudge = set([])\n\npc = True\n\n\n\npairwise = True\n\np = set() #all prime\n\n\n\nfor e in a:\n\n if not pairwise:\n\n break\n\n asf = set(factrial(e))\n\n if judge & asf != set():\n\n pc = False\n\n # #pairwise = False\n\n # print(\"setwise coprime\")\n\n # exit(0)\n\n judge |= asf\n\n# for i in a:\n\n# if not pc:\n\n# break\n\n# asf = set(factrial(i))\n\n\n\n# if judge & asf != set():\n\n# pc = False\n\n# judge |= asf\n\nif pc:\n\n print(\"pairwise coprime\")\n\nelif g == 1:\n\n print(\"setwise coprime\")\n\nelse:\n\n print(\"not coprime\")\n", "target": "#!/usr/bin/env pypy3\n\n# N,M = map(int,sys.stdin.readline().split())\n\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n\n# s = sys.stdin.readline().rstrip()\n\n# N = int(sys.stdin.readline())\n\n# INF = float(\"inf\")\n\nimport math,sys\n\n\n\nn = int(sys.stdin.readline())\n\na = tuple(map(int,sys.stdin.readline().split()))\n\n#n = int(input())\n\n#a = list(map(int,input().split()))\n\ng = math.gcd(a[0],a[1])\n\nfor i in range(2,n):\n\n g = math.gcd(g,a[i])\n\nM = max(a)\n\nacc = a[0]\n\nfor i in range(n):\n\n acc = math.gcd(acc,a[i])\n\nif acc != 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nLIMIT=max(a)\n\nminPrime = [0]*(LIMIT+1)\n\nminPrime[1] = 1\n\ndef make():\n\n for i in range(2,LIMIT+1):\n\n if minPrime[i] == 0:\n\n minPrime[i] = i\n\n #print(i)\n\n for j in range(i+i,LIMIT+1,i):\n\n #print(i,j)\n\n if minPrime[j] == 0:\n\n minPrime[j] = i\n\nmake()\n\ndef factrial(N):\n\n ret = []\n\n while minPrime[N] != N:\n\n ret.append(minPrime[N])\n\n N = N//minPrime[N]\n\n if N != 1:\n\n ret.append(N)\n\n return ret\n\n\n\njudge = set([])\n\n\n\nfor e in a:\n\n asf = set(factrial(e))\n\n if judge & asf != set():\n\n print(\"setwise coprime\")\n\n exit()\n\n judge |= asf\n\n #judge = judge | asf #too slow\n\nprint(\"pairwise coprime\")\n", "code_v0_loc": 77, "code_v1_loc": 57, "code_v0_num_chars": 1904, "code_v1_num_chars": 1552, "code_v0_no_empty_lines": "#!/usr/bin/env pypy3\n# N,M = map(int,sys.stdin.readline().split())\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n# s = sys.stdin.readline().rstrip()\n# N = int(sys.stdin.readline())\n# INF = float(\"inf\")\nimport math, sys\n\nn = int(sys.stdin.readline())\na = tuple(map(int, sys.stdin.readline().split()))\n# n = int(input())\n# a = list(map(int,input().split()))\ng = math.gcd(a[0], a[1])\nfor i in range(2, n):\n g = math.gcd(g, a[i])\nM = max(a)\nacc = a[0]\nfor i in range(n):\n acc = math.gcd(acc, a[i])\nif acc != 1:\n print(\"not coprime\")\n exit()\nLIMIT = max(a)\nminPrime = [0] * (LIMIT + 1)\nminPrime[1] = 1\n\n\ndef make():\n for i in range(2, LIMIT + 1):\n if minPrime[i] == 0:\n minPrime[i] = i\n # print(i)\n for j in range(i + i, LIMIT + 1, i):\n # print(i,j)\n if minPrime[j] == 0:\n minPrime[j] = i\n\n\nmake()\n\n\ndef factrial(N):\n ret = []\n while minPrime[N] != N:\n ret.append(minPrime[N])\n N = N // minPrime[N]\n if N != 1:\n ret.append(N)\n return ret\n\n\njudge = set([])\npc = True\npairwise = True\np = set() # all prime\nfor e in a:\n if not pairwise:\n break\n asf = set(factrial(e))\n if judge & asf != set():\n pc = False\n # #pairwise = False\n # print(\"setwise coprime\")\n # exit(0)\n judge |= asf\n# for i in a:\n# if not pc:\n# break\n# asf = set(factrial(i))\n# if judge & asf != set():\n# pc = False\n# judge |= asf\nif pc:\n print(\"pairwise coprime\")\nelif g == 1:\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n", "code_v1_no_empty_lines": "#!/usr/bin/env pypy3\n# N,M = map(int,sys.stdin.readline().split())\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n# s = sys.stdin.readline().rstrip()\n# N = int(sys.stdin.readline())\n# INF = float(\"inf\")\nimport math, sys\n\nn = int(sys.stdin.readline())\na = tuple(map(int, sys.stdin.readline().split()))\n# n = int(input())\n# a = list(map(int,input().split()))\ng = math.gcd(a[0], a[1])\nfor i in range(2, n):\n g = math.gcd(g, a[i])\nM = max(a)\nacc = a[0]\nfor i in range(n):\n acc = math.gcd(acc, a[i])\nif acc != 1:\n print(\"not coprime\")\n exit()\nLIMIT = max(a)\nminPrime = [0] * (LIMIT + 1)\nminPrime[1] = 1\n\n\ndef make():\n for i in range(2, LIMIT + 1):\n if minPrime[i] == 0:\n minPrime[i] = i\n # print(i)\n for j in range(i + i, LIMIT + 1, i):\n # print(i,j)\n if minPrime[j] == 0:\n minPrime[j] = i\n\n\nmake()\n\n\ndef factrial(N):\n ret = []\n while minPrime[N] != N:\n ret.append(minPrime[N])\n N = N // minPrime[N]\n if N != 1:\n ret.append(N)\n return ret\n\n\njudge = set([])\nfor e in a:\n asf = set(factrial(e))\n if judge & asf != set():\n print(\"setwise coprime\")\n exit()\n judge |= asf\n # judge = judge | asf #too slow\nprint(\"pairwise coprime\")\n", "code_same": false, "relative_loc_diff_percent": 25.974025974, "diff": ["-pc = True", "-pairwise = True", "-p = set() # all prime", "- if not pairwise:", "- break", "- pc = False", "- # #pairwise = False", "- # print(\"setwise coprime\")", "- # exit(0)", "+ print(\"setwise coprime\")", "+ exit()", "-# for i in a:", "-# if not pc:", "-# break", "-# asf = set(factrial(i))", "-# if judge & asf != set():", "-# pc = False", "-# judge |= asf", "-if pc:", "- print(\"pairwise coprime\")", "-elif g == 1:", "- print(\"setwise coprime\")", "-else:", "- print(\"not coprime\")", "+ # judge = judge | asf #too slow", "+print(\"pairwise coprime\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1574707303, "measured_runtime_v1": 0.0059050472, "runtime_lift": 26.6671417322, "key": ["s911286307", "s843819881"]} +{"user_id": "u987846648", "problem_id": "p02627", "language": "python", "submission_id_v0": "s793826721", "submission_id_v1": "s875451520", "cpu_time_v0": 75, "cpu_time_v1": 67, "memory_v0": 61796, "memory_v1": 61608, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.67, "input": "alph = input()\n\nif alph.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")\n", "target": "a = input()\n\n\n\nif a.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")", "code_v0_loc": 5, "code_v1_loc": 6, "code_v0_num_chars": 74, "code_v1_num_chars": 69, "code_v0_no_empty_lines": "alph = input()\nif alph.isupper():\n print(\"A\")\nelse:\n print(\"a\")\n", "code_v1_no_empty_lines": "a = input()\nif a.isupper():\n print(\"A\")\nelse:\n print(\"a\")\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-alph = input()", "-if alph.isupper():", "+a = input()", "+if a.isupper():"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1834881261, "measured_runtime_v1": 0.0064039894, "runtime_lift": 28.6521595413, "key": ["s793826721", "s875451520"]} +{"user_id": "u816872429", "problem_id": "p03039", "language": "python", "submission_id_v0": "s871362008", "submission_id_v1": "s362897835", "cpu_time_v0": 1991, "cpu_time_v1": 98, "memory_v0": 18912, "memory_v1": 11052, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 95.08, "input": "n, m, k = list(map(int, input().split()))\n\n\n\nmod = 1000000007\n\ndef pow(x, n):\n\n ret = 1\n\n while n > 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\nfac = [1]\n\ninv = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n inv.append(pow(fac[i], mod - 2))\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\n\ndef doit(n, m, k):\n\n ret = 0\n\n for d in range(m):\n\n ret = (ret + d * (m - d)) % mod\n\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))", "target": "n, m, k = list(map(int, input().split()))\n\n\n\nmod = 1000000007\n\nfac = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n\n\ndef pow(x, n):\n\n ret = 1\n\n while n > 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\ndef inv(i):\n\n return pow(fac[i], mod - 2)\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv(k) * inv(n - k)) % mod\n\n\n\nx = sum(d * (m - d) for d in range(m)) % mod\n\ny = sum(d * (n - d) for d in range(n)) % mod\n\n\n\nc = cmb(n * m - 2, k - 2)\n\nx = (x * n * n * c) % mod\n\ny = (y * m * m * c) % mod\n\n\n\nprint(((x + y) % mod))", "code_v0_loc": 28, "code_v1_loc": 30, "code_v0_num_chars": 624, "code_v1_num_chars": 620, "code_v0_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 1000000007\n\n\ndef pow(x, n):\n ret = 1\n while n > 0:\n if (n & 1) == 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n n >>= 1\n return ret\n\n\nfac = [1]\ninv = [1]\nfor i in range(1, n * m + 1):\n fac.append((fac[-1] * i) % mod)\n inv.append(pow(fac[i], mod - 2))\n\n\ndef cmb(n, k):\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\ndef doit(n, m, k):\n ret = 0\n for d in range(m):\n ret = (ret + d * (m - d)) % mod\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))\n", "code_v1_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 1000000007\nfac = [1]\nfor i in range(1, n * m + 1):\n fac.append((fac[-1] * i) % mod)\n\n\ndef pow(x, n):\n ret = 1\n while n > 0:\n if (n & 1) == 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n n >>= 1\n return ret\n\n\ndef inv(i):\n return pow(fac[i], mod - 2)\n\n\ndef cmb(n, k):\n return (fac[n] * inv(k) * inv(n - k)) % mod\n\n\nx = sum(d * (m - d) for d in range(m)) % mod\ny = sum(d * (n - d) for d in range(n)) % mod\nc = cmb(n * m - 2, k - 2)\nx = (x * n * n * c) % mod\ny = (y * m * m * c) % mod\nprint(((x + y) % mod))\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["+fac = [1]", "+for i in range(1, n * m + 1):", "+ fac.append((fac[-1] * i) % mod)", "-fac = [1]", "-inv = [1]", "-for i in range(1, n * m + 1):", "- fac.append((fac[-1] * i) % mod)", "- inv.append(pow(fac[i], mod - 2))", "+def inv(i):", "+ return pow(fac[i], mod - 2)", "- return (fac[n] * inv[k] * inv[n - k]) % mod", "+ return (fac[n] * inv(k) * inv(n - k)) % mod", "-def doit(n, m, k):", "- ret = 0", "- for d in range(m):", "- ret = (ret + d * (m - d)) % mod", "- return (ret * n * n * cmb(n * m - 2, k - 2)) % mod", "-", "-", "-print(((doit(n, m, k) + doit(m, n, k)) % mod))", "+x = sum(d * (m - d) for d in range(m)) % mod", "+y = sum(d * (n - d) for d in range(n)) % mod", "+c = cmb(n * m - 2, k - 2)", "+x = (x * n * n * c) % mod", "+y = (y * m * m * c) % mod", "+print(((x + y) % mod))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7987827396, "measured_runtime_v1": 0.3213389852, "runtime_lift": 2.4857946791, "key": ["s871362008", "s362897835"]} +{"user_id": "u806976856", "problem_id": "p02555", "language": "python", "submission_id_v0": "s550500681", "submission_id_v1": "s439989437", "cpu_time_v0": 123, "cpu_time_v1": 70, "memory_v0": 9160, "memory_v1": 64844, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.09, "input": "s=int(input())\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s//3\n\nans=0\n\ndef f(n,k,p):\n\n if k==0:\n\n return 1\n\n elif k%2==0:\n\n return (f(n,k//2,p)**2)%p\n\n else:\n\n return (n*f(n,k-1,p))%p\n\n\n\nfor k in range(1,n+1):\n\n a=1\n\n b=1\n\n for j in range(k-1):\n\n a=(a*(s-3*k+1+j))%p\n\n b=(b*(j+1))%p\n\n ans=(ans+a*f(b,p-2,p))%p\n\n\n\nprint((ans%p))\n\n\n", "target": "s=int(input())\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s//3\n\nans=0\n\nx=[0]*(s+1)\n\nx[0]=1\n\nx[1]=1\n\ny=[0]*(s+1)\n\n\n\nfor i in range(2,s+1):\n\n x[i]=x[i-1]*i%p\n\n\n\ny[s]=pow(x[s],p-2,p)\n\nfor i in range(s):\n\n y[s-1-i]=y[s-i]*(s-i)%p\n\n\n\nfor k in range(1,n+1):\n\n ans+=x[s-2*k-1]*y[k-1]*y[s-3*k]%p\n\n\n\nprint((ans%p))\n\n\n", "code_v0_loc": 25, "code_v1_loc": 24, "code_v0_num_chars": 391, "code_v1_num_chars": 322, "code_v0_no_empty_lines": "s = int(input())\np = 10**9 + 7\nif s <= 2:\n print((0))\n exit()\nn = s // 3\nans = 0\n\n\ndef f(n, k, p):\n if k == 0:\n return 1\n elif k % 2 == 0:\n return (f(n, k // 2, p) ** 2) % p\n else:\n return (n * f(n, k - 1, p)) % p\n\n\nfor k in range(1, n + 1):\n a = 1\n b = 1\n for j in range(k - 1):\n a = (a * (s - 3 * k + 1 + j)) % p\n b = (b * (j + 1)) % p\n ans = (ans + a * f(b, p - 2, p)) % p\nprint((ans % p))\n", "code_v1_no_empty_lines": "s = int(input())\np = 10**9 + 7\nif s <= 2:\n print((0))\n exit()\nn = s // 3\nans = 0\nx = [0] * (s + 1)\nx[0] = 1\nx[1] = 1\ny = [0] * (s + 1)\nfor i in range(2, s + 1):\n x[i] = x[i - 1] * i % p\ny[s] = pow(x[s], p - 2, p)\nfor i in range(s):\n y[s - 1 - i] = y[s - i] * (s - i) % p\nfor k in range(1, n + 1):\n ans += x[s - 2 * k - 1] * y[k - 1] * y[s - 3 * k] % p\nprint((ans % p))\n", "code_same": false, "relative_loc_diff_percent": 4.0, "diff": ["-", "-", "-def f(n, k, p):", "- if k == 0:", "- return 1", "- elif k % 2 == 0:", "- return (f(n, k // 2, p) ** 2) % p", "- else:", "- return (n * f(n, k - 1, p)) % p", "-", "-", "+x = [0] * (s + 1)", "+x[0] = 1", "+x[1] = 1", "+y = [0] * (s + 1)", "+for i in range(2, s + 1):", "+ x[i] = x[i - 1] * i % p", "+y[s] = pow(x[s], p - 2, p)", "+for i in range(s):", "+ y[s - 1 - i] = y[s - i] * (s - i) % p", "- a = 1", "- b = 1", "- for j in range(k - 1):", "- a = (a * (s - 3 * k + 1 + j)) % p", "- b = (b * (j + 1)) % p", "- ans = (ans + a * f(b, p - 2, p)) % p", "+ ans += x[s - 2 * k - 1] * y[k - 1] * y[s - 3 * k] % p"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3091425891, "measured_runtime_v1": 0.216736346, "runtime_lift": 1.4263532387, "key": ["s550500681", "s439989437"]} +{"user_id": "u729133443", "problem_id": "p03371", "language": "python", "submission_id_v0": "s416055764", "submission_id_v1": "s218640380", "cpu_time_v0": 227, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.51, "input": "a,b,c,x,y=list(map(int,input().split()));print((min(k*c*2+a*max(x-k,0)+b*max(y-k,0)for k in range(max(x,y)*3))))", "target": "a,b,c,x,y=list(map(int,input().split()));print((min(x*a+y*b,2*x*c+b*max(0,y-x),2*y*c+a*max(0,x-y))))", "code_v0_loc": 1, "code_v1_loc": 1, "code_v0_num_chars": 104, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nprint(\n (\n min(\n k * c * 2 + a * max(x - k, 0) + b * max(y - k, 0)\n for k in range(max(x, y) * 3)\n )\n )\n)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nprint(\n (min(x * a + y * b, 2 * x * c + b * max(0, y - x), 2 * y * c + a * max(0, x - y)))\n)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- (", "- min(", "- k * c * 2 + a * max(x - k, 0) + b * max(y - k, 0)", "- for k in range(max(x, y) * 3)", "- )", "- )", "+ (min(x * a + y * b, 2 * x * c + b * max(0, y - x), 2 * y * c + a * max(0, x - y)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4340552337, "measured_runtime_v1": 0.2001633718, "runtime_lift": 2.1685048058, "key": ["s416055764", "s218640380"]} +{"user_id": "u064408584", "problem_id": "p03723", "language": "python", "submission_id_v0": "s414644536", "submission_id_v1": "s610159769", "cpu_time_v0": 146, "cpu_time_v1": 26, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.19, "input": "a,b,c=list(map(int, input().split()))\n\nd=0\n\nwhile d<10**5:\n\n if a%2==1 or b%2==1 or c%2==1:break\n\n a,b,c=b/2+c/2,a/2+c/2,a/2+b/2\n\n d+=1\n\nelse:d=-1\n\nprint(d)", "target": "a,b,c=list(map(int, input().split()))\n\nans=0\n\nwhile a%2==0 and b%2==0 and c%2==0 and ans<10000:\n\n a,b,c=b//2+c//2,a//2+c//2,a//2+b//2\n\n ans+=1\n\nif ans==10000:ans=-1\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 159, "code_v1_num_chars": 176, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nd = 0\nwhile d < 10**5:\n if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:\n break\n a, b, c = b / 2 + c / 2, a / 2 + c / 2, a / 2 + b / 2\n d += 1\nelse:\n d = -1\nprint(d)\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nans = 0\nwhile a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and ans < 10000:\n a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2\n ans += 1\nif ans == 10000:\n ans = -1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-d = 0", "-while d < 10**5:", "- if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:", "- break", "- a, b, c = b / 2 + c / 2, a / 2 + c / 2, a / 2 + b / 2", "- d += 1", "-else:", "- d = -1", "-print(d)", "+ans = 0", "+while a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and ans < 10000:", "+ a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2", "+ ans += 1", "+if ans == 10000:", "+ ans = -1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5153860836, "measured_runtime_v1": 0.3941329796, "runtime_lift": 1.307645161, "key": ["s414644536", "s610159769"]} +{"user_id": "u285443936", "problem_id": "p03309", "language": "python", "submission_id_v0": "s057200482", "submission_id_v1": "s045600813", "cpu_time_v0": 246, "cpu_time_v1": 216, "memory_v0": 27232, "memory_v1": 25200, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.2, "input": "import statistics\n\nN = int(input())\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in range(1,N+1):\n\n a[i-1] -= i\n\n\n\nb = statistics.median(a)\n\nfor i in range(N):\n\n ans += abs(a[i]-b)\n\nprint((int(ans)))", "target": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nC = [A[i]-i for i in range(N)]\n\nC.sort()\n\nans = 0\n\nmed = C[N//2]\n\nfor i in range(N):\n\n ans += abs(C[i]-med)\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 9, "code_v0_num_chars": 211, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "import statistics\n\nN = int(input())\na = [int(i) for i in input().split()]\nans = 0\nfor i in range(1, N + 1):\n a[i - 1] -= i\nb = statistics.median(a)\nfor i in range(N):\n ans += abs(a[i] - b)\nprint((int(ans)))\n", "code_v1_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nC = [A[i] - i for i in range(N)]\nC.sort()\nans = 0\nmed = C[N // 2]\nfor i in range(N):\n ans += abs(C[i] - med)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-import statistics", "-", "-a = [int(i) for i in input().split()]", "+A = [int(i) for i in input().split()]", "+C = [A[i] - i for i in range(N)]", "+C.sort()", "-for i in range(1, N + 1):", "- a[i - 1] -= i", "-b = statistics.median(a)", "+med = C[N // 2]", "- ans += abs(a[i] - b)", "-print((int(ans)))", "+ ans += abs(C[i] - med)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2933883266, "measured_runtime_v1": 0.2086455548, "runtime_lift": 1.406156613, "key": ["s057200482", "s045600813"]} +{"user_id": "u479719434", "problem_id": "p02665", "language": "python", "submission_id_v0": "s890279539", "submission_id_v1": "s923250526", "cpu_time_v0": 175, "cpu_time_v1": 149, "memory_v0": 26380, "memory_v1": 22304, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.86, "input": "n = int(input())\n\nleaves = list(map(int, input().split()))\n\n\n\nans = 0\n\nnodes_min = [0] * (n + 1)\n\nnodes_max = [0] * (n + 1)\n\nnodes_min[n] = leaves[n]\n\nnodes_max[n] = leaves[n]\n\n\n\nfor depth in range(n, 0, -1):\n\n root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2\n\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n\n root_max = nodes_max[depth]\n\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\n\nnodes = [0] * (n + 1)\n\nnodes[0] = 1\n\nif nodes[0] < nodes_min[0]:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n roots = nodes[depth]-leaves[depth]\n\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n\n if nodes[depth+1] < nodes_min[depth+1]:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(nodes)))\n", "target": "n = int(input())\n\nleaves = list(map(int, input().split()))\n\n\n\nsum_leaves = [0]*(n+1)\n\nsum_leaves[0] = leaves[0]\n\nfor depth in range(n):\n\n sum_leaves[depth+1] = sum_leaves[depth] + leaves[depth+1]\n\n\n\nans = 0\n\n\n\nroot = [None] * (n + 1)\n\nif n == 0:\n\n root[0] = 0\n\nelse:\n\n root[0] = 1\n\nif root[0] + leaves[0] != 1:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n root[depth+1] = min(2*root[depth]-leaves[depth+1],\n\n sum_leaves[n]-sum_leaves[depth+1])\n\n if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth+1] < 0:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(root)+sum(leaves)))\n", "code_v0_loc": 27, "code_v1_loc": 26, "code_v0_num_chars": 771, "code_v1_num_chars": 669, "code_v0_no_empty_lines": "n = int(input())\nleaves = list(map(int, input().split()))\nans = 0\nnodes_min = [0] * (n + 1)\nnodes_max = [0] * (n + 1)\nnodes_min[n] = leaves[n]\nnodes_max[n] = leaves[n]\nfor depth in range(n, 0, -1):\n root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n root_max = nodes_max[depth]\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\nnodes = [0] * (n + 1)\nnodes[0] = 1\nif nodes[0] < nodes_min[0]:\n print((-1))\nelse:\n for depth in range(n):\n roots = nodes[depth] - leaves[depth]\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n if nodes[depth + 1] < nodes_min[depth + 1]:\n print((-1))\n break\n else:\n print((sum(nodes)))\n", "code_v1_no_empty_lines": "n = int(input())\nleaves = list(map(int, input().split()))\nsum_leaves = [0] * (n + 1)\nsum_leaves[0] = leaves[0]\nfor depth in range(n):\n sum_leaves[depth + 1] = sum_leaves[depth] + leaves[depth + 1]\nans = 0\nroot = [None] * (n + 1)\nif n == 0:\n root[0] = 0\nelse:\n root[0] = 1\nif root[0] + leaves[0] != 1:\n print((-1))\nelse:\n for depth in range(n):\n root[depth + 1] = min(\n 2 * root[depth] - leaves[depth + 1], sum_leaves[n] - sum_leaves[depth + 1]\n )\n if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth + 1] < 0:\n print((-1))\n break\n else:\n print((sum(root) + sum(leaves)))\n", "code_same": false, "relative_loc_diff_percent": 3.7037037037, "diff": ["+sum_leaves = [0] * (n + 1)", "+sum_leaves[0] = leaves[0]", "+for depth in range(n):", "+ sum_leaves[depth + 1] = sum_leaves[depth] + leaves[depth + 1]", "-nodes_min = [0] * (n + 1)", "-nodes_max = [0] * (n + 1)", "-nodes_min[n] = leaves[n]", "-nodes_max[n] = leaves[n]", "-for depth in range(n, 0, -1):", "- root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2", "- nodes_min[depth - 1] = leaves[depth - 1] + root_min", "- root_max = nodes_max[depth]", "- nodes_max[depth - 1] = leaves[depth - 1] + root_max", "-nodes = [0] * (n + 1)", "-nodes[0] = 1", "-if nodes[0] < nodes_min[0]:", "+root = [None] * (n + 1)", "+if n == 0:", "+ root[0] = 0", "+else:", "+ root[0] = 1", "+if root[0] + leaves[0] != 1:", "- roots = nodes[depth] - leaves[depth]", "- nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])", "- if nodes[depth + 1] < nodes_min[depth + 1]:", "+ root[depth + 1] = min(", "+ 2 * root[depth] - leaves[depth + 1], sum_leaves[n] - sum_leaves[depth + 1]", "+ )", "+ if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth + 1] < 0:", "- print((sum(nodes)))", "+ print((sum(root) + sum(leaves)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.455775662, "measured_runtime_v1": 0.2425963848, "runtime_lift": 1.8787405363, "key": ["s890279539", "s923250526"]} +{"user_id": "u060896757", "problem_id": "p02691", "language": "python", "submission_id_v0": "s720467562", "submission_id_v1": "s807450341", "cpu_time_v0": 266, "cpu_time_v1": 106, "memory_v0": 97968, "memory_v1": 92728, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.15, "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\ndp = [0] * 10 ** 7\n\nans = 0\n\nfor i in range(N):\n\n x = i + 1 - A[i]\n\n if x >= 0:\n\n ans += dp[x]\n\n y = i + 1 + A[i]\n\n if y < 10 ** 7:\n\n dp[y] += 1\n\n\n\nprint(ans)\n", "target": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nINF = 2 * 10 ** 5\n\ndp = [0] * INF\n\nans = 0\n\nfor i in range(N):\n\n i_i_ = i + 1 - A[i]\n\n if 0 < i_i_ < INF:\n\n ans += dp[i_i_]\n\n i_ = i + 1 + A[i]\n\n if 0 < i_ < INF:\n\n dp[i_] += 1\n\n\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 14, "code_v0_num_chars": 242, "code_v1_num_chars": 273, "code_v0_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\ndp = [0] * 10**7\nans = 0\nfor i in range(N):\n x = i + 1 - A[i]\n if x >= 0:\n ans += dp[x]\n y = i + 1 + A[i]\n if y < 10**7:\n dp[y] += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nINF = 2 * 10**5\ndp = [0] * INF\nans = 0\nfor i in range(N):\n i_i_ = i + 1 - A[i]\n if 0 < i_i_ < INF:\n ans += dp[i_i_]\n i_ = i + 1 + A[i]\n if 0 < i_ < INF:\n dp[i_] += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-dp = [0] * 10**7", "+INF = 2 * 10**5", "+dp = [0] * INF", "- x = i + 1 - A[i]", "- if x >= 0:", "- ans += dp[x]", "- y = i + 1 + A[i]", "- if y < 10**7:", "- dp[y] += 1", "+ i_i_ = i + 1 - A[i]", "+ if 0 < i_i_ < INF:", "+ ans += dp[i_i_]", "+ i_ = i + 1 + A[i]", "+ if 0 < i_ < INF:", "+ dp[i_] += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 1.4942608066, "measured_runtime_v1": 0.2557353399, "runtime_lift": 5.8429969327, "key": ["s720467562", "s807450341"]} +{"user_id": "u880730787", "problem_id": "p02555", "language": "python", "submission_id_v0": "s669686668", "submission_id_v1": "s427616795", "cpu_time_v0": 487, "cpu_time_v1": 297, "memory_v0": 9116, "memory_v1": 9128, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.01, "input": "S = int(input())\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))", "target": "S = int(input())\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 176, "code_v1_num_chars": 172, "code_v0_no_empty_lines": "S = int(input())\nmod = 10**9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\nfor i in range(1, S + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\nprint((dp[S]))\n", "code_v1_no_empty_lines": "S = int(input())\nmod = 10**9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\nfor i in range(1, S + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\nprint((dp[S]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- dp[i] %= mod", "+ dp[i] %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6781705019, "measured_runtime_v1": 0.481741133, "runtime_lift": 1.4077488002, "key": ["s669686668", "s427616795"]} +{"user_id": "u733814820", "problem_id": "p03107", "language": "python", "submission_id_v0": "s607050481", "submission_id_v1": "s627055692", "cpu_time_v0": 41, "cpu_time_v1": 35, "memory_v0": 3316, "memory_v1": 3956, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.63, "input": "# ABC 120 C\n\n\n\nimport re\n\n\n\nS = input()\n\n\n\nl0 = 0\n\nl1 = 0\n\n\n\nfor i in range(len(S)):\n\n if S[i] == '0':\n\n l0 += 1\n\n elif S[i] == '1':\n\n l1 += 1\n\n\n\nprint((min(l0, l1) * 2))\n", "target": "def resolve():\n\n S = input()\n\n arr = []\n\n for s in S:\n\n if len(arr) != 0 and arr[-1] != s:\n\n arr.pop()\n\n else:\n\n arr.append(s)\n\n\n\n print((len(S) - len(arr)))\n\n return\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n", "code_v0_loc": 16, "code_v1_loc": 14, "code_v0_num_chars": 189, "code_v1_num_chars": 229, "code_v0_no_empty_lines": "# ABC 120 C\nimport re\n\nS = input()\nl0 = 0\nl1 = 0\nfor i in range(len(S)):\n if S[i] == \"0\":\n l0 += 1\n elif S[i] == \"1\":\n l1 += 1\nprint((min(l0, l1) * 2))\n", "code_v1_no_empty_lines": "def resolve():\n S = input()\n arr = []\n for s in S:\n if len(arr) != 0 and arr[-1] != s:\n arr.pop()\n else:\n arr.append(s)\n print((len(S) - len(arr)))\n return\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-# ABC 120 C", "-import re", "+def resolve():", "+ S = input()", "+ arr = []", "+ for s in S:", "+ if len(arr) != 0 and arr[-1] != s:", "+ arr.pop()", "+ else:", "+ arr.append(s)", "+ print((len(S) - len(arr)))", "+ return", "-S = input()", "-l0 = 0", "-l1 = 0", "-for i in range(len(S)):", "- if S[i] == \"0\":", "- l0 += 1", "- elif S[i] == \"1\":", "- l1 += 1", "-print((min(l0, l1) * 2))", "+", "+if __name__ == \"__main__\":", "+ resolve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4207458491, "measured_runtime_v1": 0.3073607309, "runtime_lift": 1.3688991691, "key": ["s607050481", "s627055692"]} +{"user_id": "u075304271", "problem_id": "p02657", "language": "python", "submission_id_v0": "s027336468", "submission_id_v1": "s218994202", "cpu_time_v0": 65, "cpu_time_v1": 22, "memory_v0": 61680, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.15, "input": "def iput(): return int(input())\n\ndef mput(): return list(map(int, input().split()))\n\ndef lput(): return list(map(int, input().split()))\n\n\n\ndef solve():\n\n a, b = mput()\n\n print((a*b))\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()", "target": "import math\n\ndef solve():\n\n a, b = input().split()\n\n a = int(a)\n\n b = float(b)\n\n print((int(a*b)))\n\n return 0\n\n \n\nif __name__ == \"__main__\":\n\n solve()", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 237, "code_v1_num_chars": 166, "code_v0_no_empty_lines": "def iput():\n return int(input())\n\n\ndef mput():\n return list(map(int, input().split()))\n\n\ndef lput():\n return list(map(int, input().split()))\n\n\ndef solve():\n a, b = mput()\n print((a * b))\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_v1_no_empty_lines": "import math\n\n\ndef solve():\n a, b = input().split()\n a = int(a)\n b = float(b)\n print((int(a * b)))\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-def iput():", "- return int(input())", "-", "-", "-def mput():", "- return list(map(int, input().split()))", "-", "-", "-def lput():", "- return list(map(int, input().split()))", "+import math", "- a, b = mput()", "- print((a * b))", "+ a, b = input().split()", "+ a = int(a)", "+ b = float(b)", "+ print((int(a * b)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2298483524, "measured_runtime_v1": 0.0062991838, "runtime_lift": 36.4885924311, "key": ["s027336468", "s218994202"]} +{"user_id": "u762420987", "problem_id": "p03759", "language": "python", "submission_id_v0": "s246152829", "submission_id_v1": "s501080791", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "a, b, c = list(map(int, input().split()))\n\nif (b - a) == (c - b):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "target": "a, b, c = list(map(int, input().split()))\n\nif b - a == c - b:\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "code_v0_loc": 5, "code_v1_loc": 5, "code_v0_num_chars": 101, "code_v1_num_chars": 97, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif (b - a) == (c - b):\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif b - a == c - b:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-if (b - a) == (c - b):", "+if b - a == c - b:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1914725397, "measured_runtime_v1": 0.0060755644, "runtime_lift": 31.5151856242, "key": ["s246152829", "s501080791"]} +{"user_id": "u033606236", "problem_id": "p03796", "language": "python", "submission_id_v0": "s645296559", "submission_id_v1": "s055332014", "cpu_time_v0": 229, "cpu_time_v1": 39, "memory_v0": 4020, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.97, "input": "import math\n\nprint((math.factorial(int(input()))%1000000007))", "target": "num = int(input())\n\nresult = 1\n\nfor i in range(1,num+1):\n\n result = result *i % 1000000007\n\nprint(result)", "code_v0_loc": 2, "code_v1_loc": 5, "code_v0_num_chars": 59, "code_v1_num_chars": 108, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % 1000000007))\n", "code_v1_no_empty_lines": "num = int(input())\nresult = 1\nfor i in range(1, num + 1):\n result = result * i % 1000000007\nprint(result)\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % 1000000007))", "+num = int(input())", "+result = 1", "+for i in range(1, num + 1):", "+ result = result * i % 1000000007", "+print(result)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7005937328, "measured_runtime_v1": 0.3298725822, "runtime_lift": 2.1238313537, "key": ["s645296559", "s055332014"]} +{"user_id": "u488127128", "problem_id": "p03416", "language": "python", "submission_id_v0": "s570028181", "submission_id_v1": "s434791726", "cpu_time_v0": 103, "cpu_time_v1": 46, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.34, "input": "a,b = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n j = str(i)\n\n if j==''.join(reversed(j)):\n\n count += 1\n\nprint(count)", "target": "a,b = list(map(int, input().split()))\n\nn = [i for i in map(str, list(range(a,b+1))) if i==i[::-1]]\n\nprint((len(n)))", "code_v0_loc": 7, "code_v1_loc": 3, "code_v0_num_chars": 149, "code_v1_num_chars": 101, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n j = str(i)\n if j == \"\".join(reversed(j)):\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nn = [i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]\nprint((len(n)))\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-count = 0", "-for i in range(a, b + 1):", "- j = str(i)", "- if j == \"\".join(reversed(j)):", "- count += 1", "-print(count)", "+n = [i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]", "+print((len(n)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4183517286, "measured_runtime_v1": 0.2983190859, "runtime_lift": 1.4023632692, "key": ["s570028181", "s434791726"]} +{"user_id": "u642883360", "problem_id": "p03796", "language": "python", "submission_id_v0": "s671319819", "submission_id_v1": "s345697128", "cpu_time_v0": 230, "cpu_time_v1": 167, "memory_v0": 3984, "memory_v1": 38512, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.39, "input": "#!/usr/bin/env pypy3\n\n\n\nimport math\n\nprint((math.factorial(int(input())) % 1000000007))", "target": "n = int(input())\n\nfor i in range(n - 1, 1, -1):\n\n\tn *= i\n\n\tn %= 10**9 + 7\n\nprint(n)", "code_v0_loc": 4, "code_v1_loc": 5, "code_v0_num_chars": 85, "code_v1_num_chars": 83, "code_v0_no_empty_lines": "#!/usr/bin/env pypy3\nimport math\n\nprint((math.factorial(int(input())) % 1000000007))\n", "code_v1_no_empty_lines": "n = int(input())\nfor i in range(n - 1, 1, -1):\n n *= i\n n %= 10**9 + 7\nprint(n)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-#!/usr/bin/env pypy3", "-import math", "-", "-print((math.factorial(int(input())) % 1000000007))", "+n = int(input())", "+for i in range(n - 1, 1, -1):", "+ n *= i", "+ n %= 10**9 + 7", "+print(n)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5574923191, "measured_runtime_v1": 0.2242465372, "runtime_lift": 2.4860687974, "key": ["s671319819", "s345697128"]} +{"user_id": "u888092736", "problem_id": "p03721", "language": "python", "submission_id_v0": "s705162733", "submission_id_v1": "s360654843", "cpu_time_v0": 281, "cpu_time_v1": 145, "memory_v0": 28552, "memory_v1": 31636, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.4, "input": "(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\n\nfor a, b in sorted(AB):\n\n K -= b\n\n if K <= 0:\n\n print(a)\n\n break\n", "target": "N, K, *AB = list(map(int, open(0).read().split()))\n\nli = [(a, b) for a, b in zip(*[iter(AB)] * 2)]\n\nli.sort()\n\nfor a, b in li:\n\n if K > b:\n\n K -= b\n\n else:\n\n print(a)\n\n break\n", "code_v0_loc": 6, "code_v1_loc": 9, "code_v0_num_chars": 145, "code_v1_num_chars": 196, "code_v0_no_empty_lines": "(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\nfor a, b in sorted(AB):\n K -= b\n if K <= 0:\n print(a)\n break\n", "code_v1_no_empty_lines": "N, K, *AB = list(map(int, open(0).read().split()))\nli = [(a, b) for a, b in zip(*[iter(AB)] * 2)]\nli.sort()\nfor a, b in li:\n if K > b:\n K -= b\n else:\n print(a)\n break\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-(N, K), *AB = [list(map(int, s.split())) for s in open(0)]", "-for a, b in sorted(AB):", "- K -= b", "- if K <= 0:", "+N, K, *AB = list(map(int, open(0).read().split()))", "+li = [(a, b) for a, b in zip(*[iter(AB)] * 2)]", "+li.sort()", "+for a, b in li:", "+ if K > b:", "+ K -= b", "+ else:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2949739402, "measured_runtime_v1": 0.0817868489, "runtime_lift": 3.6066182276, "key": ["s705162733", "s360654843"]} +{"user_id": "u254871849", "problem_id": "p03796", "language": "python", "submission_id_v0": "s710953077", "submission_id_v1": "s484408635", "cpu_time_v0": 36, "cpu_time_v1": 32, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.11, "input": "mod = int(1e9+7)\n\nn = int(input())\n\n\n\npower = 1\n\nfor i in range(1, n+1):\n\n power = power * i % mod\n\nprint(power)", "target": "import sys\n\n\n\nMOD = 10 ** 9 + 7\n\nn = int(sys.stdin.readline().rstrip())\n\n\n\ndef main():\n\n res = 1\n\n for i in range(1, n+1):\n\n res *= i\n\n res %= MOD\n\n\n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 7, "code_v1_loc": 16, "code_v0_num_chars": 115, "code_v1_num_chars": 248, "code_v0_no_empty_lines": "mod = int(1e9 + 7)\nn = int(input())\npower = 1\nfor i in range(1, n + 1):\n power = power * i % mod\nprint(power)\n", "code_v1_no_empty_lines": "import sys\n\nMOD = 10**9 + 7\nn = int(sys.stdin.readline().rstrip())\n\n\ndef main():\n res = 1\n for i in range(1, n + 1):\n res *= i\n res %= MOD\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 56.25, "diff": ["-mod = int(1e9 + 7)", "-n = int(input())", "-power = 1", "-for i in range(1, n + 1):", "- power = power * i % mod", "-print(power)", "+import sys", "+", "+MOD = 10**9 + 7", "+n = int(sys.stdin.readline().rstrip())", "+", "+", "+def main():", "+ res = 1", "+ for i in range(1, n + 1):", "+ res *= i", "+ res %= MOD", "+ return res", "+", "+", "+if __name__ == \"__main__\":", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3650334806, "measured_runtime_v1": 0.2122802832, "runtime_lift": 1.7195825967, "key": ["s710953077", "s484408635"]} +{"user_id": "u492605584", "problem_id": "p03164", "language": "python", "submission_id_v0": "s292196170", "submission_id_v1": "s917581247", "cpu_time_v0": 446, "cpu_time_v1": 321, "memory_v0": 119916, "memory_v1": 41964, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.03, "input": "N, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [[10**9+1] * (V + 1) for i in range(N+1)]\n\ndp[0][0] = 0\n\nfor i in range(N):\n\n for j in range(V+1):\n\n if j - L[i][1] >= 0:\n\n dp[i+1][j] = min(dp[i][j], dp[i][j-L[i][1]] + L[i][0])\n\n else:\n\n dp[i+1][j] = dp[i][j]\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[-1][j]:\n\n ans = max(ans, j)\n\nprint(ans)", "target": "N, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [10**9+1] * (V + 1)\n\ndp[0] = 0\n\nfor i in range(N):\n\n for j in range(V, -1, -1):\n\n dp[j] = min(dp[j], dp[j-L[i][1]] + L[i][0])\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[j]:\n\n ans = max(ans, j)\n\nprint(ans)", "code_v0_loc": 19, "code_v1_loc": 16, "code_v0_num_chars": 481, "code_v1_num_chars": 367, "code_v0_no_empty_lines": "N, W = list(map(int, input().split()))\nL = [list(map(int, input().split())) for i in range(N)]\nV = 0\nfor i in range(N):\n V += L[i][1]\ndp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]\ndp[0][0] = 0\nfor i in range(N):\n for j in range(V + 1):\n if j - L[i][1] >= 0:\n dp[i + 1][j] = min(dp[i][j], dp[i][j - L[i][1]] + L[i][0])\n else:\n dp[i + 1][j] = dp[i][j]\nans = 0\nfor j in range(V + 1):\n if W >= dp[-1][j]:\n ans = max(ans, j)\nprint(ans)\n", "code_v1_no_empty_lines": "N, W = list(map(int, input().split()))\nL = [list(map(int, input().split())) for i in range(N)]\nV = 0\nfor i in range(N):\n V += L[i][1]\ndp = [10**9 + 1] * (V + 1)\ndp[0] = 0\nfor i in range(N):\n for j in range(V, -1, -1):\n dp[j] = min(dp[j], dp[j - L[i][1]] + L[i][0])\nans = 0\nfor j in range(V + 1):\n if W >= dp[j]:\n ans = max(ans, j)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.7894736842, "diff": ["-dp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]", "-dp[0][0] = 0", "+dp = [10**9 + 1] * (V + 1)", "+dp[0] = 0", "- for j in range(V + 1):", "- if j - L[i][1] >= 0:", "- dp[i + 1][j] = min(dp[i][j], dp[i][j - L[i][1]] + L[i][0])", "- else:", "- dp[i + 1][j] = dp[i][j]", "+ for j in range(V, -1, -1):", "+ dp[j] = min(dp[j], dp[j - L[i][1]] + L[i][0])", "- if W >= dp[-1][j]:", "+ if W >= dp[j]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3010064836, "measured_runtime_v1": 0.1980076838, "runtime_lift": 1.5201757721, "key": ["s292196170", "s917581247"]} +{"user_id": "u494927057", "problem_id": "p03814", "language": "python", "submission_id_v0": "s883482084", "submission_id_v1": "s072538424", "cpu_time_v0": 59, "cpu_time_v1": 35, "memory_v0": 3516, "memory_v1": 3516, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.68, "input": "s = input()\n\n\n\nstart = -1\n\nend = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A' and start < 0:\n\n start = i\n\n elif s[i] == 'Z':\n\n end = i\n\nprint((end - start + 1))\n", "target": "s = input()\n\n\n\nstart = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A':\n\n start = i\n\n break\n\n\n\nend = 0\n\nfor i in reversed(list(range(len(s)))):\n\n if s[i] == 'Z':\n\n end = i\n\n break\n\nprint((end - start + 1))\n", "code_v0_loc": 10, "code_v1_loc": 14, "code_v0_num_chars": 178, "code_v1_num_chars": 228, "code_v0_no_empty_lines": "s = input()\nstart = -1\nend = 0\nfor i in range(len(s)):\n if s[i] == \"A\" and start < 0:\n start = i\n elif s[i] == \"Z\":\n end = i\nprint((end - start + 1))\n", "code_v1_no_empty_lines": "s = input()\nstart = 0\nfor i in range(len(s)):\n if s[i] == \"A\":\n start = i\n break\nend = 0\nfor i in reversed(list(range(len(s)))):\n if s[i] == \"Z\":\n end = i\n break\nprint((end - start + 1))\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-start = -1", "+start = 0", "+for i in range(len(s)):", "+ if s[i] == \"A\":", "+ start = i", "+ break", "-for i in range(len(s)):", "- if s[i] == \"A\" and start < 0:", "- start = i", "- elif s[i] == \"Z\":", "+for i in reversed(list(range(len(s)))):", "+ if s[i] == \"Z\":", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2661928608, "measured_runtime_v1": 0.1145644054, "runtime_lift": 2.3235215143, "key": ["s883482084", "s072538424"]} +{"user_id": "u150984829", "problem_id": "p02412", "language": "python", "submission_id_v0": "s777094380", "submission_id_v1": "s391711407", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 5608, "memory_v1": 5612, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "while 1:\n\n n,x=list(map(int,input().split()))\n\n if n+x==0:break\n\n print((len([1 for i in range(3,n+1)for j in range(2,x-i)if x-i-j d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n", "target": "def main():\n\n from sys import stdin\n\n input = stdin.readline\n\n\n\n n, m, r = list(map(int, input().split()))\n\n l = list(map(int, input().split()))\n\n for i in range(r):\n\n l[i] -= 1\n\n d = [[10**8] * n for _ in range(n)]\n\n for _ in range(m):\n\n i, j, k = list(map(int, input().split()))\n\n d[i-1][j-1] = k\n\n d[j-1][i-1] = k\n\n\n\n # Warshall-Floyd algorithm\n\n for k in range(n):\n\n for i in range(n-1):\n\n for j in range(i+1, n):\n\n if d[i][j] > d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n d[j][i] = d[i][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n", "code_v0_loc": 36, "code_v1_loc": 37, "code_v0_num_chars": 868, "code_v1_num_chars": 914, "code_v0_no_empty_lines": "def main():\n from sys import stdin\n\n input = stdin.readline\n n, m, r = list(map(int, input().split()))\n l = list(map(int, input().split()))\n for i in range(r):\n l[i] -= 1\n d = [[10**8] * n for _ in range(n)]\n for _ in range(m):\n i, j, k = list(map(int, input().split()))\n d[i - 1][j - 1] = k\n d[j - 1][i - 1] = k\n # Warshall-Floyd algorithm\n for k in range(n):\n for i in range(n):\n for j in range(n):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\n # full search\n # 8! = 40320\n from itertools import permutations\n\n answer = 10**8\n for i in permutations(l):\n ans = 0\n for j in range(r - 1):\n ans += d[i[j]][i[j + 1]]\n if ans < answer:\n answer = ans\n print(answer)\n\n\nmain()\n", "code_v1_no_empty_lines": "def main():\n from sys import stdin\n\n input = stdin.readline\n n, m, r = list(map(int, input().split()))\n l = list(map(int, input().split()))\n for i in range(r):\n l[i] -= 1\n d = [[10**8] * n for _ in range(n)]\n for _ in range(m):\n i, j, k = list(map(int, input().split()))\n d[i - 1][j - 1] = k\n d[j - 1][i - 1] = k\n # Warshall-Floyd algorithm\n for k in range(n):\n for i in range(n - 1):\n for j in range(i + 1, n):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\n d[j][i] = d[i][j]\n # full search\n # 8! = 40320\n from itertools import permutations\n\n answer = 10**8\n for i in permutations(l):\n ans = 0\n for j in range(r - 1):\n ans += d[i[j]][i[j + 1]]\n if ans < answer:\n answer = ans\n print(answer)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 2.7027027027, "diff": ["- for i in range(n):", "- for j in range(n):", "+ for i in range(n - 1):", "+ for j in range(i + 1, n):", "+ d[j][i] = d[i][j]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2599997888, "measured_runtime_v1": 0.1532082543, "runtime_lift": 1.697035123, "key": ["s030633020", "s301564470"]} +{"user_id": "u994988729", "problem_id": "p02702", "language": "python", "submission_id_v0": "s376874744", "submission_id_v1": "s887269917", "cpu_time_v0": 337, "cpu_time_v1": 135, "memory_v0": 16640, "memory_v1": 9800, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.94, "input": "from collections import Counter\n\nS = input()[::-1]\n\n\n\nmemo = [0]\n\nd = 0\n\nmod = 2019\n\n\n\nfor s in S:\n\n tmp = int(s) * pow(10, d, mod) % mod\n\n tmp = memo[-1] + tmp\n\n memo.append(tmp % mod)\n\n d += 1\n\n\n\nc = Counter(memo)\n\nans = sum(v * (v - 1) // 2 for v in list(c.values()))\n\nprint(ans)", "target": "from collections import defaultdict\n\nS = input()\n\nN = len(S)\n\n\n\nmemo = defaultdict(int)\n\nmemo[0] += 1\n\n\n\nmod = 2019\n\nd = 1\n\nval = 0\n\n\n\nfor s in S[::-1]:\n\n s = int(s)\n\n val += s * d\n\n val %= mod\n\n memo[val] += 1\n\n d *= 10\n\n d %= mod\n\n\n\nprint((sum(v * (v - 1) // 2 for v in list(memo.values()))))", "code_v0_loc": 16, "code_v1_loc": 20, "code_v0_num_chars": 288, "code_v1_num_chars": 304, "code_v0_no_empty_lines": "from collections import Counter\n\nS = input()[::-1]\nmemo = [0]\nd = 0\nmod = 2019\nfor s in S:\n tmp = int(s) * pow(10, d, mod) % mod\n tmp = memo[-1] + tmp\n memo.append(tmp % mod)\n d += 1\nc = Counter(memo)\nans = sum(v * (v - 1) // 2 for v in list(c.values()))\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nS = input()\nN = len(S)\nmemo = defaultdict(int)\nmemo[0] += 1\nmod = 2019\nd = 1\nval = 0\nfor s in S[::-1]:\n s = int(s)\n val += s * d\n val %= mod\n memo[val] += 1\n d *= 10\n d %= mod\nprint((sum(v * (v - 1) // 2 for v in list(memo.values()))))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-from collections import Counter", "+from collections import defaultdict", "-S = input()[::-1]", "-memo = [0]", "-d = 0", "+S = input()", "+N = len(S)", "+memo = defaultdict(int)", "+memo[0] += 1", "-for s in S:", "- tmp = int(s) * pow(10, d, mod) % mod", "- tmp = memo[-1] + tmp", "- memo.append(tmp % mod)", "- d += 1", "-c = Counter(memo)", "-ans = sum(v * (v - 1) // 2 for v in list(c.values()))", "-print(ans)", "+d = 1", "+val = 0", "+for s in S[::-1]:", "+ s = int(s)", "+ val += s * d", "+ val %= mod", "+ memo[val] += 1", "+ d *= 10", "+ d %= mod", "+print((sum(v * (v - 1) // 2 for v in list(memo.values()))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2615414739, "measured_runtime_v1": 0.0063235409, "runtime_lift": 41.3599716541, "key": ["s376874744", "s887269917"]} +{"user_id": "u790710233", "problem_id": "p02627", "language": "python", "submission_id_v0": "s724454634", "submission_id_v1": "s209300808", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9064, "memory_v1": 9076, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "a = input()\n\nprint(('A' if not a.islower() else 'a'))\n", "target": "print(('A' if input().isupper() else 'a'))\n", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 52, "code_v1_num_chars": 41, "code_v0_no_empty_lines": "a = input()\nprint((\"A\" if not a.islower() else \"a\"))\n", "code_v1_no_empty_lines": "print((\"A\" if input().isupper() else \"a\"))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-a = input()", "-print((\"A\" if not a.islower() else \"a\"))", "+print((\"A\" if input().isupper() else \"a\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3926431958, "measured_runtime_v1": 0.2988653038, "runtime_lift": 1.3137797892, "key": ["s724454634", "s209300808"]} +{"user_id": "u296518383", "problem_id": "p03325", "language": "python", "submission_id_v0": "s558724347", "submission_id_v1": "s377057284", "cpu_time_v0": 137, "cpu_time_v1": 60, "memory_v0": 4148, "memory_v1": 3956, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 56.2, "input": "N=int(input())\n\na=list(map(int,input().split()))\n\nfor i in range(N):\n\n for j in range(1,31):\n\n if a[i]%(2**j)!=0:\n\n a[i]=j-1\n\n break\n\nprint((sum(a)))", "target": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ndef f(n):\n\n res = 0\n\n while n % 2 == 0:\n\n n //= 2\n\n res += 1\n\n return res\n\n\n\nanswer = 0\n\nfor a in A:\n\n answer += f(a)\n\n\n\nprint(answer)", "code_v0_loc": 8, "code_v1_loc": 18, "code_v0_num_chars": 161, "code_v1_num_chars": 250, "code_v0_no_empty_lines": "N = int(input())\na = list(map(int, input().split()))\nfor i in range(N):\n for j in range(1, 31):\n if a[i] % (2**j) != 0:\n a[i] = j - 1\n break\nprint((sum(a)))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nN = int(input())\nA = list(map(int, input().split()))\n\n\ndef f(n):\n res = 0\n while n % 2 == 0:\n n //= 2\n res += 1\n return res\n\n\nanswer = 0\nfor a in A:\n answer += f(a)\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["+import sys", "+", "+input = sys.stdin.buffer.readline", "-a = list(map(int, input().split()))", "-for i in range(N):", "- for j in range(1, 31):", "- if a[i] % (2**j) != 0:", "- a[i] = j - 1", "- break", "-print((sum(a)))", "+A = list(map(int, input().split()))", "+", "+", "+def f(n):", "+ res = 0", "+ while n % 2 == 0:", "+ n //= 2", "+ res += 1", "+ return res", "+", "+", "+answer = 0", "+for a in A:", "+ answer += f(a)", "+print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4158020542, "measured_runtime_v1": 0.3166491349, "runtime_lift": 1.313131818, "key": ["s558724347", "s377057284"]} +{"user_id": "u280552586", "problem_id": "p03416", "language": "python", "submission_id_v0": "s181217545", "submission_id_v1": "s674939126", "cpu_time_v0": 47, "cpu_time_v1": 18, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.7, "input": "a, b = list(map(int, input().split()))\n\ncnt = 0\n\n\n\nfor i in range(a, b+1):\n\n i = str(i)\n\n if i[0] == i[-1] and i[1] == i[-2]:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "target": "a, b = list(map(int, input().split()))\n\ncnt = 0\n\n\n\nfor i in range(10):\n\n for j in range(10):\n\n for k in range(10):\n\n c = 10000*i+1000*j+100*k+10*j+i\n\n if a <= c <= b:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "code_v0_loc": 9, "code_v1_loc": 11, "code_v0_num_chars": 158, "code_v1_num_chars": 233, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(a, b + 1):\n i = str(i)\n if i[0] == i[-1] and i[1] == i[-2]:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(10):\n for j in range(10):\n for k in range(10):\n c = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n if a <= c <= b:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-for i in range(a, b + 1):", "- i = str(i)", "- if i[0] == i[-1] and i[1] == i[-2]:", "- cnt += 1", "+for i in range(10):", "+ for j in range(10):", "+ for k in range(10):", "+ c = 10000 * i + 1000 * j + 100 * k + 10 * j + i", "+ if a <= c <= b:", "+ cnt += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3654750098, "measured_runtime_v1": 0.273478784, "runtime_lift": 1.3363925508, "key": ["s181217545", "s674939126"]} +{"user_id": "u753803401", "problem_id": "p03835", "language": "python", "submission_id_v0": "s742815481", "submission_id_v1": "s376437490", "cpu_time_v0": 1589, "cpu_time_v1": 1250, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.33, "input": "k, s = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if i + j > s:\n\n break\n\n elif s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n", "target": "k, s = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if 0 <= s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 200, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if i + j > s:\n break\n elif s - i - j <= k:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["- if i + j > s:", "- break", "- elif s - i - j <= k:", "+ if 0 <= s - i - j <= k:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3744940901, "measured_runtime_v1": 0.2492418245, "runtime_lift": 1.5025330956, "key": ["s742815481", "s376437490"]} +{"user_id": "u893063840", "problem_id": "p02702", "language": "python", "submission_id_v0": "s375368375", "submission_id_v1": "s846087139", "cpu_time_v0": 644, "cpu_time_v1": 545, "memory_v0": 26036, "memory_v1": 24420, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.37, "input": "from collections import Counter\n\n\n\ns = input()\n\nmod1 = 673\n\nmod2 = 3\n\n\n\nnum1 = 0\n\nnum2 = 0\n\nli1 = []\n\nli2 = []\n\npw1 = 10\n\npw2 = 10\n\nfor i, e in enumerate(s, 1):\n\n num1 *= 10\n\n num1 += int(e)\n\n num1 %= mod1\n\n inv = pow(pw1, mod1 - 2, mod1)\n\n li1.append(num1 * inv % mod1)\n\n\n\n num2 *= 10\n\n num2 += int(e)\n\n num2 %= mod2\n\n inv = pow(pw2, mod2 - 2, mod2)\n\n li2.append(num2 * inv % mod2)\n\n\n\n pw1 *= 10\n\n pw1 %= mod1\n\n pw2 *= 10\n\n pw2 %= mod2\n\n\n\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\n\nc = Counter(li)\n\n\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) // 2\n\n\n\nprint(ans)\n", "target": "from collections import Counter\n\n\n\n\n\ndef f(mod):\n\n ret = [0]\n\n power = 1\n\n num = 0\n\n for i, e in enumerate(s, 1):\n\n num *= 10\n\n num += int(e)\n\n num %= mod\n\n\n\n power *= 10\n\n power %= mod\n\n inv = pow(power, mod - 2, mod)\n\n\n\n ret.append(num * inv % mod)\n\n\n\n return ret\n\n\n\n\n\ns = input()\n\n\n\nmod3 = f(3)\n\nmod673 = f(673)\n\n\n\nli = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]\n\n\n\nc = Counter(li)\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) // 2\n\nprint(ans)\n", "code_v0_loc": 38, "code_v1_loc": 33, "code_v0_num_chars": 629, "code_v1_num_chars": 529, "code_v0_no_empty_lines": "from collections import Counter\n\ns = input()\nmod1 = 673\nmod2 = 3\nnum1 = 0\nnum2 = 0\nli1 = []\nli2 = []\npw1 = 10\npw2 = 10\nfor i, e in enumerate(s, 1):\n num1 *= 10\n num1 += int(e)\n num1 %= mod1\n inv = pow(pw1, mod1 - 2, mod1)\n li1.append(num1 * inv % mod1)\n num2 *= 10\n num2 += int(e)\n num2 %= mod2\n inv = pow(pw2, mod2 - 2, mod2)\n li2.append(num2 * inv % mod2)\n pw1 *= 10\n pw1 %= mod1\n pw2 *= 10\n pw2 %= mod2\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\nc = Counter(li)\nans = 0\nfor v in list(c.values()):\n ans += v * (v - 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import Counter\n\n\ndef f(mod):\n ret = [0]\n power = 1\n num = 0\n for i, e in enumerate(s, 1):\n num *= 10\n num += int(e)\n num %= mod\n power *= 10\n power %= mod\n inv = pow(power, mod - 2, mod)\n ret.append(num * inv % mod)\n return ret\n\n\ns = input()\nmod3 = f(3)\nmod673 = f(673)\nli = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]\nc = Counter(li)\nans = 0\nfor v in list(c.values()):\n ans += v * (v - 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 13.1578947368, "diff": ["+", "+def f(mod):", "+ ret = [0]", "+ power = 1", "+ num = 0", "+ for i, e in enumerate(s, 1):", "+ num *= 10", "+ num += int(e)", "+ num %= mod", "+ power *= 10", "+ power %= mod", "+ inv = pow(power, mod - 2, mod)", "+ ret.append(num * inv % mod)", "+ return ret", "+", "+", "-mod1 = 673", "-mod2 = 3", "-num1 = 0", "-num2 = 0", "-li1 = []", "-li2 = []", "-pw1 = 10", "-pw2 = 10", "-for i, e in enumerate(s, 1):", "- num1 *= 10", "- num1 += int(e)", "- num1 %= mod1", "- inv = pow(pw1, mod1 - 2, mod1)", "- li1.append(num1 * inv % mod1)", "- num2 *= 10", "- num2 += int(e)", "- num2 %= mod2", "- inv = pow(pw2, mod2 - 2, mod2)", "- li2.append(num2 * inv % mod2)", "- pw1 *= 10", "- pw1 %= mod1", "- pw2 *= 10", "- pw2 %= mod2", "-li = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]", "+mod3 = f(3)", "+mod673 = f(673)", "+li = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4600284932, "measured_runtime_v1": 0.2683121743, "runtime_lift": 1.7145270963, "key": ["s375368375", "s846087139"]} +{"user_id": "u882564128", "problem_id": "p03371", "language": "python", "submission_id_v0": "s136733954", "submission_id_v1": "s827725289", "cpu_time_v0": 100, "cpu_time_v1": 70, "memory_v0": 9180, "memory_v1": 9068, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.0, "input": "a, b, c, x, y = list(map(int, input().split(' ')))\n\n\n\nc = int(c*2)\n\nm = float('inf')\n\nfor i in range(10**5+1):\n\n m = min(m, a*max(0, x-i)+b*max(0,y-i)+c*i)\n\nprint(m)", "target": "import math\n\na, b, c, x, y = list(map(int, input().split(' ')))\n\nans = float('inf')\n\nc = c*2\n\nfor i in range(max(x, y)+1):\n\n if i > x:\n\n price = b*(y-i) + c*i\n\n elif i > y:\n\n price = a*(x-i) + c*i\n\n else:\n\n price = a*(x-i) + b*(y-i) + c*i\n\n\n\n if ans > price:\n\n ans = price\n\nprint(ans)", "code_v0_loc": 7, "code_v1_loc": 15, "code_v0_num_chars": 162, "code_v1_num_chars": 318, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split(\" \")))\nc = int(c * 2)\nm = float(\"inf\")\nfor i in range(10**5 + 1):\n m = min(m, a * max(0, x - i) + b * max(0, y - i) + c * i)\nprint(m)\n", "code_v1_no_empty_lines": "import math\n\na, b, c, x, y = list(map(int, input().split(\" \")))\nans = float(\"inf\")\nc = c * 2\nfor i in range(max(x, y) + 1):\n if i > x:\n price = b * (y - i) + c * i\n elif i > y:\n price = a * (x - i) + c * i\n else:\n price = a * (x - i) + b * (y - i) + c * i\n if ans > price:\n ans = price\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 53.3333333333, "diff": ["+import math", "+", "-c = int(c * 2)", "-m = float(\"inf\")", "-for i in range(10**5 + 1):", "- m = min(m, a * max(0, x - i) + b * max(0, y - i) + c * i)", "-print(m)", "+ans = float(\"inf\")", "+c = c * 2", "+for i in range(max(x, y) + 1):", "+ if i > x:", "+ price = b * (y - i) + c * i", "+ elif i > y:", "+ price = a * (x - i) + c * i", "+ else:", "+ price = a * (x - i) + b * (y - i) + c * i", "+ if ans > price:", "+ ans = price", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0457227323, "measured_runtime_v1": 0.348341011, "runtime_lift": 3.0020086614, "key": ["s136733954", "s827725289"]} +{"user_id": "u729133443", "problem_id": "p02983", "language": "python", "submission_id_v0": "s140577970", "submission_id_v1": "s371672772", "cpu_time_v0": 591, "cpu_time_v1": 74, "memory_v0": 40556, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.48, "input": "l,r=list(map(int,input().split()))\n\ns=list(range(l,r+1))[:2019]\n\nprint((min(i*j%2019for i in s for j in s if i> i & 1:\n\n a = dp[i][a]\n\n return a >= b\n\ndef solve(a, b):\n\n if a > b:\n\n a, b = b, a\n\n ng = 0\n\n ok = n-1\n\n while ok - ng > 1:\n\n mid = (ng + ok) // 2\n\n if test(mid, a, b):\n\n ok = mid\n\n else:\n\n ng = mid\n\n print(ok)\n\nq = int(input())\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n solve(a, b)", "target": "import sys\n\ninput = sys.stdin.readline\n\nimport bisect\n\n\n\nn = int(input())\n\nX = list(map(int, input().split()))\n\nl = int(input())\n\nU = 17\n\ndp = [[0]*n for _ in range(U+1)]\n\nfor i, x in enumerate(X):\n\n t = bisect.bisect_left(X, x+l)\n\n dp[0][i] = bisect.bisect_right(X, x+l) - 1\n\nfor k in range(U):\n\n for i in range(n):\n\n dp[k+1][i] = dp[k][dp[k][i]]\n\nq = int(input())\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n if a > b:\n\n a, b = b, a\n\n res = 1\n\n for k in range(U, -1, -1):\n\n if dp[k][a] < b:\n\n a = dp[k][a]\n\n res += (1<> i & 1:\n a = dp[i][a]\n return a >= b\n\n\ndef solve(a, b):\n if a > b:\n a, b = b, a\n ng = 0\n ok = n - 1\n while ok - ng > 1:\n mid = (ng + ok) // 2\n if test(mid, a, b):\n ok = mid\n else:\n ng = mid\n print(ok)\n\n\nq = int(input())\nfor _ in range(q):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n solve(a, b)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nimport bisect\n\nn = int(input())\nX = list(map(int, input().split()))\nl = int(input())\nU = 17\ndp = [[0] * n for _ in range(U + 1)]\nfor i, x in enumerate(X):\n t = bisect.bisect_left(X, x + l)\n dp[0][i] = bisect.bisect_right(X, x + l) - 1\nfor k in range(U):\n for i in range(n):\n dp[k + 1][i] = dp[k][dp[k][i]]\nq = int(input())\nfor _ in range(q):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n if a > b:\n a, b = b, a\n res = 1\n for k in range(U, -1, -1):\n if dp[k][a] < b:\n a = dp[k][a]\n res += 1 << k\n if a == b:\n break\n print(res)\n", "code_same": false, "relative_loc_diff_percent": 21.0526315789, "diff": ["-", "-", "-def test(x, a, b):", "- for i in range(U, -1, -1):", "- if x >> i & 1:", "- a = dp[i][a]", "- return a >= b", "-", "-", "-def solve(a, b):", "- if a > b:", "- a, b = b, a", "- ng = 0", "- ok = n - 1", "- while ok - ng > 1:", "- mid = (ng + ok) // 2", "- if test(mid, a, b):", "- ok = mid", "- else:", "- ng = mid", "- print(ok)", "-", "-", "- solve(a, b)", "+ if a > b:", "+ a, b = b, a", "+ res = 1", "+ for k in range(U, -1, -1):", "+ if dp[k][a] < b:", "+ a = dp[k][a]", "+ res += 1 << k", "+ if a == b:", "+ break", "+ print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.33038889, "measured_runtime_v1": 0.2620919657, "runtime_lift": 1.2605838152, "key": ["s083196734", "s862767700"]} +{"user_id": "u844005364", "problem_id": "p02994", "language": "python", "submission_id_v0": "s135697405", "submission_id_v1": "s243236458", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "n, like = list(map(int, input().split()))\n\n\n\narr = [like + i for i in range(n)]\n\n\n\narr.sort(key=lambda x:abs(x))\n\n\n\nprint((sum(arr[1:])))\n", "target": "n, like = list(map(int, input().split()))\n\narr = [like + i for i in range(n)]\n\narr.sort(key=abs)\n\nprint((sum(arr[1:])))\n", "code_v0_loc": 7, "code_v1_loc": 4, "code_v0_num_chars": 130, "code_v1_num_chars": 112, "code_v0_no_empty_lines": "n, like = list(map(int, input().split()))\narr = [like + i for i in range(n)]\narr.sort(key=lambda x: abs(x))\nprint((sum(arr[1:])))\n", "code_v1_no_empty_lines": "n, like = list(map(int, input().split()))\narr = [like + i for i in range(n)]\narr.sort(key=abs)\nprint((sum(arr[1:])))\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-arr.sort(key=lambda x: abs(x))", "+arr.sort(key=abs)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2677221475, "measured_runtime_v1": 0.0993615375, "runtime_lift": 2.6944243647, "key": ["s135697405", "s243236458"]} +{"user_id": "u325282913", "problem_id": "p03371", "language": "python", "submission_id_v0": "s614340278", "submission_id_v1": "s677161923", "cpu_time_v0": 117, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.62, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\nans = float('inf')\n\nfor i in range(max(X,Y)+1):\n\n cost = 2 * C * i + max(0,X-i)*A +max(0,Y-i)*B\n\n ans = min(ans,cost)\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\ntmp = A*X + B*Y\n\nif X >= Y:\n\n tmp = min(tmp,2*Y*C+(X-Y)*A)\n\nelse:\n\n tmp = min(tmp,2*X*C+(Y-X)*B)\n\ntmp = min(tmp,max(X,Y)*2*C)\n\nprint(tmp)", "code_v0_loc": 6, "code_v1_loc": 8, "code_v0_num_chars": 178, "code_v1_num_chars": 186, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(max(X, Y) + 1):\n cost = 2 * C * i + max(0, X - i) * A + max(0, Y - i) * B\n ans = min(ans, cost)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\ntmp = A * X + B * Y\nif X >= Y:\n tmp = min(tmp, 2 * Y * C + (X - Y) * A)\nelse:\n tmp = min(tmp, 2 * X * C + (Y - X) * B)\ntmp = min(tmp, max(X, Y) * 2 * C)\nprint(tmp)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-ans = float(\"inf\")", "-for i in range(max(X, Y) + 1):", "- cost = 2 * C * i + max(0, X - i) * A + max(0, Y - i) * B", "- ans = min(ans, cost)", "-print(ans)", "+tmp = A * X + B * Y", "+if X >= Y:", "+ tmp = min(tmp, 2 * Y * C + (X - Y) * A)", "+else:", "+ tmp = min(tmp, 2 * X * C + (Y - X) * B)", "+tmp = min(tmp, max(X, Y) * 2 * C)", "+print(tmp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.571060118, "measured_runtime_v1": 0.3373241339, "runtime_lift": 1.6929121299, "key": ["s614340278", "s677161923"]} +{"user_id": "u873917047", "problem_id": "p03828", "language": "python", "submission_id_v0": "s924740576", "submission_id_v1": "s078000611", "cpu_time_v0": 523, "cpu_time_v1": 182, "memory_v0": 3188, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.2, "input": "#coding: UTF-8\n\nimport math\n\nN=int(input())\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N):\n\n plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k/(i+1)\n\n lis[i]=n\n\n return lis\n\nout_lis=[0]*N\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\nprint((out%1000000007))", "target": "#coding: UTF-8\n\nimport math\n\nN=int(input())\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N,plist):\n\n# plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k/(i+1)\n\n lis[i]=n\n\n return lis\n\n# print(lis)\n\nout_lis=[0]*N\n\nplist=prime_list(N)\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N,plist)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\n#print(out%1000000007)\n\nprint((out%(10**9+7)))", "code_v0_loc": 36, "code_v1_loc": 39, "code_v0_num_chars": 791, "code_v1_num_chars": 865, "code_v0_no_empty_lines": "# coding: UTF-8\nimport math\n\nN = int(input())\n\n\ndef prime_list(k):\n lis = [True for i in range(1, k + 1)]\n lis[0] = False\n for i in range(2, k + 1):\n j = 2\n while j * j <= i:\n if i % j == 0:\n lis[i - 1] = False\n break\n else:\n j += 1\n return lis\n\n\n# print(lis)\ndef p_fact(k, N):\n plist = prime_list(k)\n lis = [0] * N\n for i in range(0, k):\n n = 0\n if plist[i]:\n while k % (i + 1) == 0:\n n += 1\n k = k / (i + 1)\n lis[i] = n\n return lis\n\n\nout_lis = [0] * N\nfor i in range(1, N + 1):\n input_lis = p_fact(i, N)\n out_lis = [out_lis[j] + input_lis[j] for j in range(0, N)]\n# print(out_lis)\nout = 1\nfor i in range(0, N):\n out = out * (out_lis[i] + 1)\nprint((out % 1000000007))\n", "code_v1_no_empty_lines": "# coding: UTF-8\nimport math\n\nN = int(input())\n\n\ndef prime_list(k):\n lis = [True for i in range(1, k + 1)]\n lis[0] = False\n for i in range(2, k + 1):\n j = 2\n while j * j <= i:\n if i % j == 0:\n lis[i - 1] = False\n break\n else:\n j += 1\n return lis\n\n\n# print(lis)\ndef p_fact(k, N, plist):\n # plist=prime_list(k)\n lis = [0] * N\n for i in range(0, k):\n n = 0\n if plist[i]:\n while k % (i + 1) == 0:\n n += 1\n k = k / (i + 1)\n lis[i] = n\n return lis\n\n\n# print(lis)\nout_lis = [0] * N\nplist = prime_list(N)\nfor i in range(1, N + 1):\n input_lis = p_fact(i, N, plist)\n out_lis = [out_lis[j] + input_lis[j] for j in range(0, N)]\n# print(out_lis)\nout = 1\nfor i in range(0, N):\n out = out * (out_lis[i] + 1)\n# print(out%1000000007)\nprint((out % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["-def p_fact(k, N):", "- plist = prime_list(k)", "+def p_fact(k, N, plist):", "+ # plist=prime_list(k)", "+# print(lis)", "+plist = prime_list(N)", "- input_lis = p_fact(i, N)", "+ input_lis = p_fact(i, N, plist)", "-print((out % 1000000007))", "+# print(out%1000000007)", "+print((out % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6020502172, "measured_runtime_v1": 0.3540123932, "runtime_lift": 1.7006472899, "key": ["s924740576", "s078000611"]} +{"user_id": "u800534567", "problem_id": "p02245", "language": "python", "submission_id_v0": "s424620538", "submission_id_v1": "s007973982", "cpu_time_v0": 3310, "cpu_time_v1": 2340, "memory_v0": 34416, "memory_v1": 34452, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.31, "input": "import sys\n\nimport queue\n\n\n\nN = 3\n\nf= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = queue.Queue()\n\nV = dict()\n\n\n\nQ.put([f,f.index('0'),0])\n\nV[f] = True\n\n\n\nwhile not Q.empty():\n\n u = Q.get()\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]//N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 \n\n Q.put(v)\n\n\n\nprint((u[2]))\n", "target": "import sys\n\nimport queue\n\n\n\nN = 3\n\n\n\nf = ''.join(sys.stdin.readline().split())\n\nf += ''.join(sys.stdin.readline().split())\n\nf += ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = [[f,f.index('0'),0]]\n\nV = { f: True }\n\n\n\nwhile len(Q)>0:\n\n u = Q.pop(0)\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]//N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 # dir[r] \n\n Q.append(v)\n\n\n\nprint((u[2]))\n", "code_v0_loc": 34, "code_v1_loc": 32, "code_v0_num_chars": 845, "code_v1_num_chars": 831, "code_v0_no_empty_lines": "import sys\nimport queue\n\nN = 3\nf = \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\nQ = queue.Queue()\nV = dict()\nQ.put([f, f.index(\"0\"), 0])\nV[f] = True\nwhile not Q.empty():\n u = Q.get()\n if u[0] == \"123456780\":\n break\n sx, sy = u[1] // N, u[1] % N\n for dx, dy in dd:\n tx, ty = sx + dx, sy + dy\n if tx < 0 or ty < 0 or tx >= N or ty >= N:\n continue\n v = u[:]\n n1, n2 = u[1], tx * N + ty\n v[1] = n2\n if n1 > n2:\n n1, n2 = n2, n1\n v[0] = v[0][0:n1] + v[0][n2] + v[0][n1 + 1 : n2] + v[0][n1] + v[0][n2 + 1 :]\n if not V.get(v[0], False):\n V[v[0]] = True\n v[2] += 1\n Q.put(v)\nprint((u[2]))\n", "code_v1_no_empty_lines": "import sys\nimport queue\n\nN = 3\nf = \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\nQ = [[f, f.index(\"0\"), 0]]\nV = {f: True}\nwhile len(Q) > 0:\n u = Q.pop(0)\n if u[0] == \"123456780\":\n break\n sx, sy = u[1] // N, u[1] % N\n for dx, dy in dd:\n tx, ty = sx + dx, sy + dy\n if tx < 0 or ty < 0 or tx >= N or ty >= N:\n continue\n v = u[:]\n n1, n2 = u[1], tx * N + ty\n v[1] = n2\n if n1 > n2:\n n1, n2 = n2, n1\n v[0] = v[0][0:n1] + v[0][n2] + v[0][n1 + 1 : n2] + v[0][n1] + v[0][n2 + 1 :]\n if not V.get(v[0], False):\n V[v[0]] = True\n v[2] += 1 # dir[r]\n Q.append(v)\nprint((u[2]))\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-Q = queue.Queue()", "-V = dict()", "-Q.put([f, f.index(\"0\"), 0])", "-V[f] = True", "-while not Q.empty():", "- u = Q.get()", "+Q = [[f, f.index(\"0\"), 0]]", "+V = {f: True}", "+while len(Q) > 0:", "+ u = Q.pop(0)", "- v[2] += 1", "- Q.put(v)", "+ v[2] += 1 # dir[r]", "+ Q.append(v)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5507428885, "measured_runtime_v1": 0.3782181978, "runtime_lift": 1.4561512154, "key": ["s424620538", "s007973982"]} +{"user_id": "u002459665", "problem_id": "p03854", "language": "python", "submission_id_v0": "s451133157", "submission_id_v1": "s498631928", "cpu_time_v0": 759, "cpu_time_v1": 146, "memory_v0": 3936, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.76, "input": "def main():\n\n S = input()\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n # print(w1,w2,w3,w4)\n\n S = S[::-1]\n\n # print(S)\n\n\n\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n\n words = [w1, w2, w3, w4]\n\n T = ''\n\n while S != T:\n\n cand = []\n\n for w in words:\n\n new_t = T + w\n\n cand.append(new_t) \n\n # print('cand', cand)\n\n ans = False\n\n for c in cand:\n\n if c == S[:len(c)]:\n\n T = c\n\n ans = True\n\n\n\n if not ans:\n\n break\n\n\n\n if S == T:\n\n print('YES')\n\n else:\n\n print(\"NO\")\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "def main():\n\n S = input()\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n S = S[::-1]\n\n words = [w1, w2, w3, w4]\n\n\n\n flag = False\n\n i = 0\n\n while i < len(S):\n\n for w in words:\n\n if S[i:].startswith(w):\n\n i += len(w)\n\n flag = True\n\n break\n\n\n\n if not flag:\n\n print(\"NO\")\n\n exit()\n\n flag = False\n\n\n\n print(\"YES\")\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 35, "code_v1_loc": 29, "code_v0_num_chars": 724, "code_v1_num_chars": 528, "code_v0_no_empty_lines": "def main():\n S = input()\n w1 = \"dream\"[::-1]\n w2 = \"dreamer\"[::-1]\n w3 = \"erase\"[::-1]\n w4 = \"eraser\"[::-1]\n # print(w1,w2,w3,w4)\n S = S[::-1]\n # print(S)\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n words = [w1, w2, w3, w4]\n T = \"\"\n while S != T:\n cand = []\n for w in words:\n new_t = T + w\n cand.append(new_t)\n # print('cand', cand)\n ans = False\n for c in cand:\n if c == S[: len(c)]:\n T = c\n ans = True\n if not ans:\n break\n if S == T:\n print(\"YES\")\n else:\n print(\"NO\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n S = input()\n w1 = \"dream\"[::-1]\n w2 = \"dreamer\"[::-1]\n w3 = \"erase\"[::-1]\n w4 = \"eraser\"[::-1]\n S = S[::-1]\n words = [w1, w2, w3, w4]\n flag = False\n i = 0\n while i < len(S):\n for w in words:\n if S[i:].startswith(w):\n i += len(w)\n flag = True\n break\n if not flag:\n print(\"NO\")\n exit()\n flag = False\n print(\"YES\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 17.1428571429, "diff": ["- # print(w1,w2,w3,w4)", "- # print(S)", "- # words = ['dream', 'dreamer', 'erase', 'eraser']", "- T = \"\"", "- while S != T:", "- cand = []", "+ flag = False", "+ i = 0", "+ while i < len(S):", "- new_t = T + w", "- cand.append(new_t)", "- # print('cand', cand)", "- ans = False", "- for c in cand:", "- if c == S[: len(c)]:", "- T = c", "- ans = True", "- if not ans:", "- break", "- if S == T:", "- print(\"YES\")", "- else:", "- print(\"NO\")", "+ if S[i:].startswith(w):", "+ i += len(w)", "+ flag = True", "+ break", "+ if not flag:", "+ print(\"NO\")", "+ exit()", "+ flag = False", "+ print(\"YES\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3388795207, "measured_runtime_v1": 0.2570693116, "runtime_lift": 1.3182418333, "key": ["s451133157", "s498631928"]} +{"user_id": "u761320129", "problem_id": "p03806", "language": "python", "submission_id_v0": "s128261336", "submission_id_v1": "s895482909", "cpu_time_v0": 493, "cpu_time_v1": 263, "memory_v0": 4852, "memory_v1": 4852, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.65, "input": "N,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\nmaxa = maxb = 0\n\nfor a,b,c in src:\n\n for ai in range(maxa,-1,-1):\n\n for bi in range(maxb,-1,-1):\n\n dp[ai+a][bi+b] = min(dp[ai+a][bi+b], dp[ai][bi] + c)\n\n maxa += a\n\n maxb += b\n\n\n\nans = INF\n\nfor i in range(1,401):\n\n if MA*i > 400 or MB*i > 400: break\n\n ans = min(ans, dp[MA*i][MB*i])\n\nprint((-1 if ans == INF else ans))", "target": "N,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\nMAX = 401\n\ndp = [[INF] * MAX for i in range(MAX)]\n\ndp[0][0] = 0\n\namax = bmax = 0\n\nfor a,b,n in src:\n\n for i in reversed(list(range(bmax+1))):\n\n for j in range(amax+1):\n\n if dp[i][j] == INF: continue\n\n dp[i+b][j+a] = min(dp[i+b][j+a], dp[i][j] + n)\n\n amax += a\n\n bmax += b\n\n\n\nans = INF\n\nfor i in range(1,MAX):\n\n if i*MA >= MAX or i*MB >= MAX: break\n\n ans = min(ans, dp[i*MB][i*MA])\n\nprint((-1 if ans == INF else ans))", "code_v0_loc": 19, "code_v1_loc": 21, "code_v0_num_chars": 527, "code_v1_num_chars": 562, "code_v0_no_empty_lines": "N, MA, MB = list(map(int, input().split()))\nsrc = [tuple(map(int, input().split())) for i in range(N)]\nINF = 10**9\ndp = [[INF for j in range(401)] for i in range(401)]\ndp[0][0] = 0\nmaxa = maxb = 0\nfor a, b, c in src:\n for ai in range(maxa, -1, -1):\n for bi in range(maxb, -1, -1):\n dp[ai + a][bi + b] = min(dp[ai + a][bi + b], dp[ai][bi] + c)\n maxa += a\n maxb += b\nans = INF\nfor i in range(1, 401):\n if MA * i > 400 or MB * i > 400:\n break\n ans = min(ans, dp[MA * i][MB * i])\nprint((-1 if ans == INF else ans))\n", "code_v1_no_empty_lines": "N, MA, MB = list(map(int, input().split()))\nsrc = [tuple(map(int, input().split())) for i in range(N)]\nINF = 10**9\nMAX = 401\ndp = [[INF] * MAX for i in range(MAX)]\ndp[0][0] = 0\namax = bmax = 0\nfor a, b, n in src:\n for i in reversed(list(range(bmax + 1))):\n for j in range(amax + 1):\n if dp[i][j] == INF:\n continue\n dp[i + b][j + a] = min(dp[i + b][j + a], dp[i][j] + n)\n amax += a\n bmax += b\nans = INF\nfor i in range(1, MAX):\n if i * MA >= MAX or i * MB >= MAX:\n break\n ans = min(ans, dp[i * MB][i * MA])\nprint((-1 if ans == INF else ans))\n", "code_same": false, "relative_loc_diff_percent": 9.5238095238, "diff": ["-dp = [[INF for j in range(401)] for i in range(401)]", "+MAX = 401", "+dp = [[INF] * MAX for i in range(MAX)]", "-maxa = maxb = 0", "-for a, b, c in src:", "- for ai in range(maxa, -1, -1):", "- for bi in range(maxb, -1, -1):", "- dp[ai + a][bi + b] = min(dp[ai + a][bi + b], dp[ai][bi] + c)", "- maxa += a", "- maxb += b", "+amax = bmax = 0", "+for a, b, n in src:", "+ for i in reversed(list(range(bmax + 1))):", "+ for j in range(amax + 1):", "+ if dp[i][j] == INF:", "+ continue", "+ dp[i + b][j + a] = min(dp[i + b][j + a], dp[i][j] + n)", "+ amax += a", "+ bmax += b", "-for i in range(1, 401):", "- if MA * i > 400 or MB * i > 400:", "+for i in range(1, MAX):", "+ if i * MA >= MAX or i * MB >= MAX:", "- ans = min(ans, dp[MA * i][MB * i])", "+ ans = min(ans, dp[i * MB][i * MA])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4613628248, "measured_runtime_v1": 0.3376750898, "runtime_lift": 1.3662921511, "key": ["s128261336", "s895482909"]} +{"user_id": "u678167152", "problem_id": "p03814", "language": "python", "submission_id_v0": "s292011694", "submission_id_v1": "s577750700", "cpu_time_v0": 173, "cpu_time_v1": 33, "memory_v0": 41456, "memory_v1": 9328, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.92, "input": "s = input()\n\na = s.find('A')\n\nz = s[::-1].find('Z')\n\nans = len(s)-a-z\n\n\n\nprint(ans)\n\n\n\n#print(*ans, sep='\\n')", "target": "def solve():\n\n S = input()\n\n a = S.find('A')\n\n z = S[::-1].find('Z')\n\n ans = len(S)-a-z\n\n return ans\n\nprint((solve()))", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 109, "code_v1_num_chars": 121, "code_v0_no_empty_lines": "s = input()\na = s.find(\"A\")\nz = s[::-1].find(\"Z\")\nans = len(s) - a - z\nprint(ans)\n# print(*ans, sep='\\n')\n", "code_v1_no_empty_lines": "def solve():\n S = input()\n a = S.find(\"A\")\n z = S[::-1].find(\"Z\")\n ans = len(S) - a - z\n return ans\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-s = input()", "-a = s.find(\"A\")", "-z = s[::-1].find(\"Z\")", "-ans = len(s) - a - z", "-print(ans)", "-# print(*ans, sep='\\n')", "+def solve():", "+ S = input()", "+ a = S.find(\"A\")", "+ z = S[::-1].find(\"Z\")", "+ ans = len(S) - a - z", "+ return ans", "+", "+", "+print((solve()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3115016568, "measured_runtime_v1": 0.2242342863, "runtime_lift": 1.3891794243, "key": ["s292011694", "s577750700"]} +{"user_id": "u729133443", "problem_id": "p03494", "language": "python", "submission_id_v0": "s130510697", "submission_id_v1": "s993121873", "cpu_time_v0": 166, "cpu_time_v1": 32, "memory_v0": 38256, "memory_v1": 9048, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.72, "input": "_,t=open(0);n=eval(t.replace(' ','|'));print((len(bin(n&-n))-3))", "target": "n=eval([*open(0)][1].replace(*' |'))\n\nprint((len(bin(n&-n))-3))", "code_v0_loc": 1, "code_v1_loc": 2, "code_v0_num_chars": 62, "code_v1_num_chars": 61, "code_v0_no_empty_lines": "_, t = open(0)\nn = eval(t.replace(\" \", \"|\"))\nprint((len(bin(n & -n)) - 3))\n", "code_v1_no_empty_lines": "n = eval([*open(0)][1].replace(*\" |\"))\nprint((len(bin(n & -n)) - 3))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-_, t = open(0)", "-n = eval(t.replace(\" \", \"|\"))", "+n = eval([*open(0)][1].replace(*\" |\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2380404282, "measured_runtime_v1": 0.1070810323, "runtime_lift": 2.2229934012, "key": ["s130510697", "s993121873"]} +{"user_id": "u923662841", "problem_id": "p03309", "language": "python", "submission_id_v0": "s990999147", "submission_id_v1": "s307361938", "cpu_time_v0": 211, "cpu_time_v1": 159, "memory_v0": 34024, "memory_v1": 31160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 24.64, "input": "import statistics\n\nN = int(input())\n\nA = [int(a)-i-1 for i,a in enumerate(input().split(),1)]\n\nb = statistics.median_low(A)\n\nc = statistics.median_high(A)\n\nd = sum([abs(x-b) for x in A])\n\ne = sum([abs(x-c) for x in A])\n\nprint((min(d,e)))", "target": "N=int(input())\n\nA=sorted(a-i-1 for i,a in enumerate(map(int,input().split())))\n\nprint((sum(abs(a-A[N//2]) for a in A)))", "code_v0_loc": 8, "code_v1_loc": 3, "code_v0_num_chars": 241, "code_v1_num_chars": 117, "code_v0_no_empty_lines": "import statistics\n\nN = int(input())\nA = [int(a) - i - 1 for i, a in enumerate(input().split(), 1)]\nb = statistics.median_low(A)\nc = statistics.median_high(A)\nd = sum([abs(x - b) for x in A])\ne = sum([abs(x - c) for x in A])\nprint((min(d, e)))\n", "code_v1_no_empty_lines": "N = int(input())\nA = sorted(a - i - 1 for i, a in enumerate(map(int, input().split())))\nprint((sum(abs(a - A[N // 2]) for a in A)))\n", "code_same": false, "relative_loc_diff_percent": 62.5, "diff": ["-import statistics", "-", "-A = [int(a) - i - 1 for i, a in enumerate(input().split(), 1)]", "-b = statistics.median_low(A)", "-c = statistics.median_high(A)", "-d = sum([abs(x - b) for x in A])", "-e = sum([abs(x - c) for x in A])", "-print((min(d, e)))", "+A = sorted(a - i - 1 for i, a in enumerate(map(int, input().split())))", "+print((sum(abs(a - A[N // 2]) for a in A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3014758439, "measured_runtime_v1": 0.2369829128, "runtime_lift": 1.2721416931, "key": ["s990999147", "s307361938"]} +{"user_id": "u294385082", "problem_id": "p03416", "language": "python", "submission_id_v0": "s823919342", "submission_id_v1": "s499216276", "cpu_time_v0": 175, "cpu_time_v1": 125, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.57, "input": "a,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n new = list(reversed(list(str(i))))\n\n if new == list(str(i)):\n\n c += 1\n\n \n\n \n\nprint(c)", "target": "a,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n if list(str(i)) == list(str(i))[::-1]:\n\n c += 1\n\n \n\n \n\nprint(c)", "code_v0_loc": 10, "code_v1_loc": 9, "code_v0_num_chars": 162, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nc = 0\nfor i in range(a, b + 1):\n new = list(reversed(list(str(i))))\n if new == list(str(i)):\n c += 1\nprint(c)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nc = 0\nfor i in range(a, b + 1):\n if list(str(i)) == list(str(i))[::-1]:\n c += 1\nprint(c)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["- new = list(reversed(list(str(i))))", "- if new == list(str(i)):", "+ if list(str(i)) == list(str(i))[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7237584333, "measured_runtime_v1": 0.3522657444, "runtime_lift": 2.0545807954, "key": ["s823919342", "s499216276"]} +{"user_id": "u325282913", "problem_id": "p03013", "language": "python", "submission_id_v0": "s961535130", "submission_id_v1": "s147927462", "cpu_time_v0": 230, "cpu_time_v1": 192, "memory_v0": 40940, "memory_v1": 7668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.52, "input": "import sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int,input().split()))\n\nhole = [0] * (N+1)\n\nfor i in range(M):\n\n hole[int(input())] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nif N == 2:\n\n if hole[1] == 1:\n\n print((1))\n\n exit()\n\n if hole[1] == 0:\n\n print((2))\n\n exit()\n\nflg_one = False\n\nflg_two = False\n\nfirst = 1\n\nsecond = 2\n\nif hole[1] == 1:\n\n first = 0\n\n second = 1\n\n flg_one = True\n\nif hole[2] == 1:\n\n first = 1\n\n second = 0\n\n flg_two = True\n\nif flg_one and flg_two:\n\n print((0))\n\n exit()\n\n\n\nfor i in range(3,N):\n\n if hole[i] == 1:\n\n first = second\n\n second = 0\n\n continue\n\n tmp = first + second\n\n tmp %= 1000000007\n\n first = second\n\n second = tmp\n\ntmp = first + second\n\ntmp %= 1000000007\n\nprint(tmp)", "target": "MOD = 10**9 + 7\n\nN, M = list(map(int, input().split()))\n\nstairs = [0]*(N+1)\n\nfor _ in range(M):\n\n stairs[int(input())] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nans = [0]*(N+1)\n\nans[1] = 1 if stairs[1] == 0 else 0\n\nans[2] = 1 + ans[1] if stairs[2] == 0 else 0\n\nfor i in range(3,N+1):\n\n if stairs[i] == 1:\n\n ans[i] = 0\n\n continue\n\n ans[i] = (ans[i-1] + ans[i-2]) % MOD\n\nprint((ans[N]))", "code_v0_loc": 44, "code_v1_loc": 17, "code_v0_num_chars": 795, "code_v1_num_chars": 400, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nhole = [0] * (N + 1)\nfor i in range(M):\n hole[int(input())] = 1\nif N == 1:\n print((1))\n exit()\nif N == 2:\n if hole[1] == 1:\n print((1))\n exit()\n if hole[1] == 0:\n print((2))\n exit()\nflg_one = False\nflg_two = False\nfirst = 1\nsecond = 2\nif hole[1] == 1:\n first = 0\n second = 1\n flg_one = True\nif hole[2] == 1:\n first = 1\n second = 0\n flg_two = True\nif flg_one and flg_two:\n print((0))\n exit()\nfor i in range(3, N):\n if hole[i] == 1:\n first = second\n second = 0\n continue\n tmp = first + second\n tmp %= 1000000007\n first = second\n second = tmp\ntmp = first + second\ntmp %= 1000000007\nprint(tmp)\n", "code_v1_no_empty_lines": "MOD = 10**9 + 7\nN, M = list(map(int, input().split()))\nstairs = [0] * (N + 1)\nfor _ in range(M):\n stairs[int(input())] = 1\nif N == 1:\n print((1))\n exit()\nans = [0] * (N + 1)\nans[1] = 1 if stairs[1] == 0 else 0\nans[2] = 1 + ans[1] if stairs[2] == 0 else 0\nfor i in range(3, N + 1):\n if stairs[i] == 1:\n ans[i] = 0\n continue\n ans[i] = (ans[i - 1] + ans[i - 2]) % MOD\nprint((ans[N]))\n", "code_same": false, "relative_loc_diff_percent": 61.3636363636, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "+MOD = 10**9 + 7", "-hole = [0] * (N + 1)", "-for i in range(M):", "- hole[int(input())] = 1", "+stairs = [0] * (N + 1)", "+for _ in range(M):", "+ stairs[int(input())] = 1", "-if N == 2:", "- if hole[1] == 1:", "- print((1))", "- exit()", "- if hole[1] == 0:", "- print((2))", "- exit()", "-flg_one = False", "-flg_two = False", "-first = 1", "-second = 2", "-if hole[1] == 1:", "- first = 0", "- second = 1", "- flg_one = True", "-if hole[2] == 1:", "- first = 1", "- second = 0", "- flg_two = True", "-if flg_one and flg_two:", "- print((0))", "- exit()", "-for i in range(3, N):", "- if hole[i] == 1:", "- first = second", "- second = 0", "+ans = [0] * (N + 1)", "+ans[1] = 1 if stairs[1] == 0 else 0", "+ans[2] = 1 + ans[1] if stairs[2] == 0 else 0", "+for i in range(3, N + 1):", "+ if stairs[i] == 1:", "+ ans[i] = 0", "- tmp = first + second", "- tmp %= 1000000007", "- first = second", "- second = tmp", "-tmp = first + second", "-tmp %= 1000000007", "-print(tmp)", "+ ans[i] = (ans[i - 1] + ans[i - 2]) % MOD", "+print((ans[N]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3368466201, "measured_runtime_v1": 0.2647972648, "runtime_lift": 1.2720925207, "key": ["s961535130", "s147927462"]} +{"user_id": "u585482323", "problem_id": "p03558", "language": "python", "submission_id_v0": "s378178699", "submission_id_v1": "s370816259", "cpu_time_v0": 982, "cpu_time_v1": 230, "memory_v0": 88880, "memory_v1": 47180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 76.58, "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n s = S()\n\n t = S()\n\n if s+t == t[::-1]+s[::-1]:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n\n\n#B\n\ndef B():\n\n n = I()\n\n for i in range(int(n**0.5)+2)[::-1]:\n\n if i*i <= n:\n\n print((i*i))\n\n quit()\n\n#C\n\ndef C():\n\n n = I()\n\n a = LI()\n\n b = LI()\n\n c = LI()\n\n q = [0 for i in range(n)]\n\n ans = 0\n\n a.sort()\n\n b.sort()\n\n c.sort()\n\n for i in range(n):\n\n j = bisect.bisect_left(a,b[i])\n\n q[i] = j\n\n for i in range(n-1):\n\n q[i+1] += q[i]\n\n q.insert(0,0)\n\n for i in range(n):\n\n j = bisect.bisect_left(b,c[i])\n\n ans += q[j]\n\n print(ans)\n\n#D\n\ndef D():\n\n def dijkstra():\n\n d = [float(\"inf\") for i in range(k)]\n\n q = [[0,1]]\n\n d[1] = 0\n\n while q:\n\n dx,x = heappop(q)\n\n for y,dy in v[x]:\n\n if d[y] > dx+dy:\n\n d[y] = dx+dy\n\n heappush(q,[d[y],y])\n\n print((d[0]+1))\n\n k = I()\n\n if k == 1:\n\n print((1))\n\n quit()\n\n v = [[] for i in range(k)]\n\n for i in range(1,k):\n\n v[i].append([(i+1)%k,1])\n\n v[i].append([i*10%k,0])\n\n dijkstra()\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n return\n\n\n\n#G\n\ndef G():\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n D()\n", "target": "#!usr/bin/env python3\n\nfrom collections import defaultdict,deque\n\nfrom heapq import heappush, heappop\n\nfrom itertools import permutations\n\nimport sys\n\nimport math\n\nimport bisect\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\n\ndef S():\n\n res = list(sys.stdin.readline())\n\n if res[-1] == \"\\n\":\n\n return res[:-1]\n\n return res\n\ndef IR(n):\n\n return [I() for i in range(n)]\n\ndef LIR(n):\n\n return [LI() for i in range(n)]\n\ndef SR(n):\n\n return [S() for i in range(n)]\n\ndef LSR(n):\n\n return [LS() for i in range(n)]\n\n\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\ndef solve():\n\n def v(n):\n\n return [n*10%k, (n+1)%k]\n\n k = I()\n\n d = [float(\"inf\")]*k\n\n d[1] = 1\n\n q = deque([1])\n\n while q:\n\n x = q.popleft()\n\n vx = v(x)\n\n dx = d[x]\n\n for c in range(2):\n\n nd = dx+c\n\n y = vx[c]\n\n if nd < d[y]:\n\n d[y] = nd\n\n if c:\n\n q.append(y)\n\n else:\n\n q.appendleft(y)\n\n print((d[0]))\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n solve()\n", "code_v0_loc": 108, "code_v1_loc": 53, "code_v0_num_chars": 2164, "code_v1_num_chars": 1252, "code_v0_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\ndef A():\n s = S()\n t = S()\n if s + t == t[::-1] + s[::-1]:\n print(\"YES\")\n else:\n print(\"NO\")\n\n\n# B\ndef B():\n n = I()\n for i in range(int(n**0.5) + 2)[::-1]:\n if i * i <= n:\n print((i * i))\n quit()\n\n\n# C\ndef C():\n n = I()\n a = LI()\n b = LI()\n c = LI()\n q = [0 for i in range(n)]\n ans = 0\n a.sort()\n b.sort()\n c.sort()\n for i in range(n):\n j = bisect.bisect_left(a, b[i])\n q[i] = j\n for i in range(n - 1):\n q[i + 1] += q[i]\n q.insert(0, 0)\n for i in range(n):\n j = bisect.bisect_left(b, c[i])\n ans += q[j]\n print(ans)\n\n\n# D\ndef D():\n def dijkstra():\n d = [float(\"inf\") for i in range(k)]\n q = [[0, 1]]\n d[1] = 0\n while q:\n dx, x = heappop(q)\n for y, dy in v[x]:\n if d[y] > dx + dy:\n d[y] = dx + dy\n heappush(q, [d[y], y])\n print((d[0] + 1))\n\n k = I()\n if k == 1:\n print((1))\n quit()\n v = [[] for i in range(k)]\n for i in range(1, k):\n v[i].append([(i + 1) % k, 1])\n v[i].append([i * 10 % k, 0])\n dijkstra()\n\n\n# E\ndef E():\n return\n\n\n# F\ndef F():\n return\n\n\n# G\ndef G():\n return\n\n\n# H\ndef H():\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n D()\n", "code_v1_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations\nimport sys\nimport math\nimport bisect\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == \"\\n\":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n\n\ndef solve():\n def v(n):\n return [n * 10 % k, (n + 1) % k]\n\n k = I()\n d = [float(\"inf\")] * k\n d[1] = 1\n q = deque([1])\n while q:\n x = q.popleft()\n vx = v(x)\n dx = d[x]\n for c in range(2):\n nd = dx + c\n y = vx[c]\n if nd < d[y]:\n d[y] = nd\n if c:\n q.append(y)\n else:\n q.appendleft(y)\n print((d[0]))\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 50.9259259259, "diff": ["-from collections import defaultdict", "-from collections import deque", "+from collections import defaultdict, deque", "+from itertools import permutations", "-import random", "- return list(map(int, sys.stdin.readline().split()))", "+ return [int(x) for x in sys.stdin.readline().split()]", "- return list(map(list, sys.stdin.readline().split()))", "+ return [list(x) for x in sys.stdin.readline().split()]", "- return list(sys.stdin.readline())[:-1]", "+ res = list(sys.stdin.readline())", "+ if res[-1] == \"\\n\":", "+ return res[:-1]", "+ return res", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = I()", "- return l", "+ return [I() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = LI()", "- return l", "+ return [LI() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = S()", "- return l", "+ return [S() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = SR()", "- return l", "+ return [LS() for i in range(n)]", "+sys.setrecursionlimit(1000000)", "-# A", "-def A():", "- s = S()", "- t = S()", "- if s + t == t[::-1] + s[::-1]:", "- print(\"YES\")", "- else:", "- print(\"NO\")", "-# B", "-def B():", "- n = I()", "- for i in range(int(n**0.5) + 2)[::-1]:", "- if i * i <= n:", "- print((i * i))", "- quit()", "-", "-", "-# C", "-def C():", "- n = I()", "- a = LI()", "- b = LI()", "- c = LI()", "- q = [0 for i in range(n)]", "- ans = 0", "- a.sort()", "- b.sort()", "- c.sort()", "- for i in range(n):", "- j = bisect.bisect_left(a, b[i])", "- q[i] = j", "- for i in range(n - 1):", "- q[i + 1] += q[i]", "- q.insert(0, 0)", "- for i in range(n):", "- j = bisect.bisect_left(b, c[i])", "- ans += q[j]", "- print(ans)", "-", "-", "-# D", "-def D():", "- def dijkstra():", "- d = [float(\"inf\") for i in range(k)]", "- q = [[0, 1]]", "- d[1] = 0", "- while q:", "- dx, x = heappop(q)", "- for y, dy in v[x]:", "- if d[y] > dx + dy:", "- d[y] = dx + dy", "- heappush(q, [d[y], y])", "- print((d[0] + 1))", "+def solve():", "+ def v(n):", "+ return [n * 10 % k, (n + 1) % k]", "- if k == 1:", "- print((1))", "- quit()", "- v = [[] for i in range(k)]", "- for i in range(1, k):", "- v[i].append([(i + 1) % k, 1])", "- v[i].append([i * 10 % k, 0])", "- dijkstra()", "-", "-", "-# E", "-def E():", "- return", "-", "-", "-# F", "-def F():", "- return", "-", "-", "-# G", "-def G():", "- return", "-", "-", "-# H", "-def H():", "+ d = [float(\"inf\")] * k", "+ d[1] = 1", "+ q = deque([1])", "+ while q:", "+ x = q.popleft()", "+ vx = v(x)", "+ dx = d[x]", "+ for c in range(2):", "+ nd = dx + c", "+ y = vx[c]", "+ if nd < d[y]:", "+ d[y] = nd", "+ if c:", "+ q.append(y)", "+ else:", "+ q.appendleft(y)", "+ print((d[0]))", "- D()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6112481251, "measured_runtime_v1": 0.2866115916, "runtime_lift": 2.1326706352, "key": ["s378178699", "s370816259"]} +{"user_id": "u089230684", "problem_id": "p03796", "language": "python", "submission_id_v0": "s560811979", "submission_id_v1": "s868944422", "cpu_time_v0": 230, "cpu_time_v1": 37, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.91, "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))", "target": "n = int(input())\n\nfact = 1\n\nfor i in range(1,n+1):\n\n fact = fact * i % (10**9 +7)\n\nres = fact % (10**9 + 7)\n\nprint(res)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 69, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "import math\n\nx = int(input())\nprint((math.factorial(x) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nfact = 1\nfor i in range(1, n + 1):\n fact = fact * i % (10**9 + 7)\nres = fact % (10**9 + 7)\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-x = int(input())", "-print((math.factorial(x) % (10**9 + 7)))", "+n = int(input())", "+fact = 1", "+for i in range(1, n + 1):", "+ fact = fact * i % (10**9 + 7)", "+res = fact % (10**9 + 7)", "+print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5532854562, "measured_runtime_v1": 0.2473686228, "runtime_lift": 2.2366840626, "key": ["s560811979", "s868944422"]} +{"user_id": "u164727245", "problem_id": "p02596", "language": "python", "submission_id_v0": "s121951272", "submission_id_v1": "s390007993", "cpu_time_v0": 131, "cpu_time_v1": 33, "memory_v0": 9476, "memory_v1": 9244, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 74.81, "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k//7 if k % 7 == 0 else k)\n\n if l % 2 == 0 or l % 5 == 0:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(-pow(l, 1/2))):\n\n if r % i == 0:\n\n phi = phi//i*(i-1)\n\n while r % i:\n\n r //= i\n\n\n\n a = 10 % l\n\n ret = 1\n\n while(a != 1):\n\n a = a*10 % l\n\n ret += 1\n\n if phi < ret:\n\n ret = -1\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "target": "# coding: utf-8\n\nfrom math import sqrt\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k//7 if 0 == k % 7 else k)\n\n if 0 == l % 2 or 0 == l % 5:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(sqrt(l)+1)):\n\n if 0 == r % i:\n\n phi = phi*(i-1)//i\n\n while 0 == r % i:\n\n r //= i\n\n if 1 < r:\n\n phi = phi*(r-1)//r\n\n\n\n D = set()\n\n for d in range(1, int(sqrt(phi)+1)):\n\n if 0 == phi % d:\n\n D.add(d)\n\n D.add(phi//d)\n\n\n\n ret = -1\n\n for m in sorted(D):\n\n if 1 == pow(10, m, l):\n\n ret = m\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "code_v0_loc": 31, "code_v1_loc": 37, "code_v0_num_chars": 598, "code_v1_num_chars": 758, "code_v0_no_empty_lines": "# coding: utf-8\ndef solve(*args: str) -> str:\n k = int(args[0])\n l = 9 * (k // 7 if k % 7 == 0 else k)\n if l % 2 == 0 or l % 5 == 0:\n return \"-1\"\n r = phi = l\n for i in range(2, int(-pow(l, 1 / 2))):\n if r % i == 0:\n phi = phi // i * (i - 1)\n while r % i:\n r //= i\n a = 10 % l\n ret = 1\n while a != 1:\n a = a * 10 % l\n ret += 1\n if phi < ret:\n ret = -1\n break\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_v1_no_empty_lines": "# coding: utf-8\nfrom math import sqrt\n\n\ndef solve(*args: str) -> str:\n k = int(args[0])\n l = 9 * (k // 7 if 0 == k % 7 else k)\n if 0 == l % 2 or 0 == l % 5:\n return \"-1\"\n r = phi = l\n for i in range(2, int(sqrt(l) + 1)):\n if 0 == r % i:\n phi = phi * (i - 1) // i\n while 0 == r % i:\n r //= i\n if 1 < r:\n phi = phi * (r - 1) // r\n D = set()\n for d in range(1, int(sqrt(phi) + 1)):\n if 0 == phi % d:\n D.add(d)\n D.add(phi // d)\n ret = -1\n for m in sorted(D):\n if 1 == pow(10, m, l):\n ret = m\n break\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_same": false, "relative_loc_diff_percent": 16.2162162162, "diff": ["+from math import sqrt", "+", "+", "- l = 9 * (k // 7 if k % 7 == 0 else k)", "- if l % 2 == 0 or l % 5 == 0:", "+ l = 9 * (k // 7 if 0 == k % 7 else k)", "+ if 0 == l % 2 or 0 == l % 5:", "- for i in range(2, int(-pow(l, 1 / 2))):", "- if r % i == 0:", "- phi = phi // i * (i - 1)", "- while r % i:", "+ for i in range(2, int(sqrt(l) + 1)):", "+ if 0 == r % i:", "+ phi = phi * (i - 1) // i", "+ while 0 == r % i:", "- a = 10 % l", "- ret = 1", "- while a != 1:", "- a = a * 10 % l", "- ret += 1", "- if phi < ret:", "- ret = -1", "+ if 1 < r:", "+ phi = phi * (r - 1) // r", "+ D = set()", "+ for d in range(1, int(sqrt(phi) + 1)):", "+ if 0 == phi % d:", "+ D.add(d)", "+ D.add(phi // d)", "+ ret = -1", "+ for m in sorted(D):", "+ if 1 == pow(10, m, l):", "+ ret = m"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4349818358, "measured_runtime_v1": 0.2757263954, "runtime_lift": 1.5775850377, "key": ["s121951272", "s390007993"]} +{"user_id": "u618107373", "problem_id": "p03013", "language": "python", "submission_id_v0": "s205446737", "submission_id_v1": "s887904874", "cpu_time_v0": 450, "cpu_time_v1": 113, "memory_v0": 473344, "memory_v1": 11884, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 74.89, "input": "import sys\n\nsys.setrecursionlimit(100000)\n\n\n\ndef intinput(): return list(map(int,sys.stdin.readline().split()))\n\n\n\nfib={0:0,1:1,2:1}\n\nfor i in range(3,100003):\n\n fib[i]=fib[i-1]+fib[i-2]\n\n # fib.append(fib[i-1]+fib[i-2])\n\n\n\nn,m=intinput()\n\nmod=10**9+7\n\na=[int(sys.stdin.readline()) for _ in range(m)]\n\nif m!=0:\n\n l=[a[0]]\n\n for i in range(len(a)-1):\n\n l.append(a[i+1]-a[i]-1)\n\n l.append(n-a[-1])\n\n k=1\n\n for i in l:\n\n k=fib[i]*k%mod\n\n print((k%mod))\n\nelse:\n\n print((fib[n+1]%mod))", "target": "import sys\n\nsys.setrecursionlimit(100000)\n\n\n\ndef intinput(): return list(map(int,sys.stdin.readline().split()))\n\n\n\n\n\nn, m = intinput()\n\na = {int(sys.stdin.readline()) for _ in range(m)}\n\nmemo = [0 for x in range(n + 4)]\n\nmemo[0] = 1\n\nmod = 10 ** 9 + 7\n\nfor i in range(n):\n\n if i + 1 not in a:\n\n memo[i + 1] = (memo[i + 1] + memo[i]) % mod\n\n if i + 2 not in a:\n\n memo[i + 2] = (memo[i + 2] + memo[i]) % mod\n\nprint((memo[n]))", "code_v0_loc": 24, "code_v1_loc": 17, "code_v0_num_chars": 510, "code_v1_num_chars": 435, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(100000)\n\n\ndef intinput():\n return list(map(int, sys.stdin.readline().split()))\n\n\nfib = {0: 0, 1: 1, 2: 1}\nfor i in range(3, 100003):\n fib[i] = fib[i - 1] + fib[i - 2]\n# fib.append(fib[i-1]+fib[i-2])\nn, m = intinput()\nmod = 10**9 + 7\na = [int(sys.stdin.readline()) for _ in range(m)]\nif m != 0:\n l = [a[0]]\n for i in range(len(a) - 1):\n l.append(a[i + 1] - a[i] - 1)\n l.append(n - a[-1])\n k = 1\n for i in l:\n k = fib[i] * k % mod\n print((k % mod))\nelse:\n print((fib[n + 1] % mod))\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(100000)\n\n\ndef intinput():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn, m = intinput()\na = {int(sys.stdin.readline()) for _ in range(m)}\nmemo = [0 for x in range(n + 4)]\nmemo[0] = 1\nmod = 10**9 + 7\nfor i in range(n):\n if i + 1 not in a:\n memo[i + 1] = (memo[i + 1] + memo[i]) % mod\n if i + 2 not in a:\n memo[i + 2] = (memo[i + 2] + memo[i]) % mod\nprint((memo[n]))\n", "code_same": false, "relative_loc_diff_percent": 29.1666666667, "diff": ["-fib = {0: 0, 1: 1, 2: 1}", "-for i in range(3, 100003):", "- fib[i] = fib[i - 1] + fib[i - 2]", "-# fib.append(fib[i-1]+fib[i-2])", "+a = {int(sys.stdin.readline()) for _ in range(m)}", "+memo = [0 for x in range(n + 4)]", "+memo[0] = 1", "-a = [int(sys.stdin.readline()) for _ in range(m)]", "-if m != 0:", "- l = [a[0]]", "- for i in range(len(a) - 1):", "- l.append(a[i + 1] - a[i] - 1)", "- l.append(n - a[-1])", "- k = 1", "- for i in l:", "- k = fib[i] * k % mod", "- print((k % mod))", "-else:", "- print((fib[n + 1] % mod))", "+for i in range(n):", "+ if i + 1 not in a:", "+ memo[i + 1] = (memo[i + 1] + memo[i]) % mod", "+ if i + 2 not in a:", "+ memo[i + 2] = (memo[i + 2] + memo[i]) % mod", "+print((memo[n]))"], "diff_only_import_comment": false, "measured_runtime_v0": 3.8133613999, "measured_runtime_v1": 0.2074506006, "runtime_lift": 18.3820214944, "key": ["s205446737", "s887904874"]} +{"user_id": "u732061897", "problem_id": "p02767", "language": "python", "submission_id_v0": "s699773211", "submission_id_v1": "s064206410", "cpu_time_v0": 21, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.29, "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nanswer = 10 ** 9\n\nfor i in range(1,101):\n\n tmp = 0\n\n for a in A:\n\n tmp += abs(a-i) ** 2\n\n answer = min(answer,tmp)\n\nprint(answer)", "target": "N = int(input())\n\nA = list(map(int, input().split()))\n\nchushin = sum(A)//N\n\nchushin_1 = sum(A)//N +1\n\nanswer = 0\n\nanswer_1 = 0\n\nfor a in A:\n\n answer += abs(a-chushin) ** 2\n\n answer_1 += abs(a-chushin_1) ** 2\n\nprint((min(answer,answer_1)))", "code_v0_loc": 9, "code_v1_loc": 10, "code_v0_num_chars": 200, "code_v1_num_chars": 242, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nanswer = 10**9\nfor i in range(1, 101):\n tmp = 0\n for a in A:\n tmp += abs(a - i) ** 2\n answer = min(answer, tmp)\nprint(answer)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nchushin = sum(A) // N\nchushin_1 = sum(A) // N + 1\nanswer = 0\nanswer_1 = 0\nfor a in A:\n answer += abs(a - chushin) ** 2\n answer_1 += abs(a - chushin_1) ** 2\nprint((min(answer, answer_1)))\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-answer = 10**9", "-for i in range(1, 101):", "- tmp = 0", "- for a in A:", "- tmp += abs(a - i) ** 2", "- answer = min(answer, tmp)", "-print(answer)", "+chushin = sum(A) // N", "+chushin_1 = sum(A) // N + 1", "+answer = 0", "+answer_1 = 0", "+for a in A:", "+ answer += abs(a - chushin) ** 2", "+ answer_1 += abs(a - chushin_1) ** 2", "+print((min(answer, answer_1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3756797752, "measured_runtime_v1": 0.2943871524, "runtime_lift": 1.2761418836, "key": ["s699773211", "s064206410"]} +{"user_id": "u606045429", "problem_id": "p02850", "language": "python", "submission_id_v0": "s780367922", "submission_id_v1": "s062691036", "cpu_time_v0": 222, "cpu_time_v1": 198, "memory_v0": 25900, "memory_v1": 25900, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.81, "input": "\"\"\"\n\nchallenge case\n\n\n\nin:\n\n3\n\n1 3\n\n2 3\n\n\n\nout:\n\n1\n\n1\n\n1\n\n\"\"\"\n\n\n\nfrom collections import deque\n\n\n\ndef main():\n\n\tN, *AB = list(map(int, open(0).read().split()))\n\n\tB = AB[1::2]\n\n\n\n\tE = [[] for _ in range(N + 1)]\n\n\tfor a, b in zip(*[iter(AB)] * 2):\n\n\t\tE[a] += b,\n\n\n\n\tQ = deque([1])\n\n\tC = [0] * (N + 1)\n\n\twhile Q:\n\n\t\tv = Q.popleft()\n\n\t\tc = 0\n\n\t\tfor u in E[v]:\n\n\t\t\tc += 1 + (c + 1 == C[v])\n\n\t\t\tC[u] = c\n\n\t\t\tQ += u,\n\n\n\n\tprint((max(C)))\n\n\tfor b in B:\n\n\t\tprint((C[b]))\n\n\n\nmain()", "target": "\"\"\"\n\nchallenge case\n\n\n\nin:\n\n3\n\n1 3\n\n2 3\n\n\n\nout:\n\n1\n\n1\n\n1\n\n\"\"\"\n\n\n\nfrom collections import deque\n\n\n\ndef main():\n\n\tN, *AB = list(map(int, open(0).read().split()))\n\n\tB = AB[1::2]\n\n\n\n\tE = [[] for _ in range(N + 1)]\n\n\tfor a, b in zip(*[iter(AB)] * 2):\n\n\t\tE[a].append(b)\n\n\n\n\tQ = deque([1])\n\n\tC = [0] * (N + 1)\n\n\twhile Q:\n\n\t\tv = Q.popleft()\n\n\t\tc = 0\n\n\t\tfor u in E[v]:\n\n\t\t\tc += 1 + (c + 1 == C[v])\n\n\t\t\tC[u] = c\n\n\t\t\tQ.append(u)\n\n\n\n\tprint((max(C)))\n\n\tfor b in B:\n\n\t\tprint((C[b]))\n\n\n\nmain()", "code_v0_loc": 39, "code_v1_loc": 39, "code_v0_num_chars": 460, "code_v1_num_chars": 468, "code_v0_no_empty_lines": "\"\"\"\nchallenge case\nin:\n3\n1 3\n2 3\nout:\n1\n1\n1\n\"\"\"\nfrom collections import deque\n\n\ndef main():\n N, *AB = list(map(int, open(0).read().split()))\n B = AB[1::2]\n E = [[] for _ in range(N + 1)]\n for a, b in zip(*[iter(AB)] * 2):\n E[a] += (b,)\n Q = deque([1])\n C = [0] * (N + 1)\n while Q:\n v = Q.popleft()\n c = 0\n for u in E[v]:\n c += 1 + (c + 1 == C[v])\n C[u] = c\n Q += (u,)\n print((max(C)))\n for b in B:\n print((C[b]))\n\n\nmain()\n", "code_v1_no_empty_lines": "\"\"\"\nchallenge case\nin:\n3\n1 3\n2 3\nout:\n1\n1\n1\n\"\"\"\nfrom collections import deque\n\n\ndef main():\n N, *AB = list(map(int, open(0).read().split()))\n B = AB[1::2]\n E = [[] for _ in range(N + 1)]\n for a, b in zip(*[iter(AB)] * 2):\n E[a].append(b)\n Q = deque([1])\n C = [0] * (N + 1)\n while Q:\n v = Q.popleft()\n c = 0\n for u in E[v]:\n c += 1 + (c + 1 == C[v])\n C[u] = c\n Q.append(u)\n print((max(C)))\n for b in B:\n print((C[b]))\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- E[a] += (b,)", "+ E[a].append(b)", "- Q += (u,)", "+ Q.append(u)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2432860727, "measured_runtime_v1": 0.1842362597, "runtime_lift": 1.3205113538, "key": ["s780367922", "s062691036"]} +{"user_id": "u648212584", "problem_id": "p03253", "language": "python", "submission_id_v0": "s901379470", "submission_id_v1": "s767594103", "cpu_time_v0": 251, "cpu_time_v1": 204, "memory_v0": 16168, "memory_v1": 45680, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.73, "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\nfrom collections import defaultdict\n\nimport copy\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n d = defaultdict(int)\n\n MOD = 10**9+7\n\n R = 10**5+100\n\n fac = [0 for _ in range(R+1)]\n\n fac[0],fac[1] = 1,1\n\n inv = copy.deepcopy(fac)\n\n invfac = copy.deepcopy(fac)\n\n \n\n for i in range(2,R+1):\n\n fac[i] = (fac[i-1]*i)%MOD\n\n inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD\n\n invfac[i] = (invfac[i-1]*inv[i])%MOD\n\n \n\n def coef(x,y):\n\n num = (((fac[x+y]*invfac[y])%MOD)*invfac[x]%MOD)\n\n return num\n\n\n\n while M%2 == 0:\n\n d[2] += 1\n\n M //= 2\n\n f = 3\n\n while f ** 2 <= M:\n\n if M % f == 0:\n\n d[f] += 1\n\n M //= f\n\n else:\n\n f += 2\n\n if M != 1:\n\n d[M] += 1\n\n \n\n l = list(d.values())\n\n ans = 1\n\n for num in l:\n\n ans *= coef(num,N-1)\n\n ans %= MOD\n\n \n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()", "target": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n MOD = 10**9+7\n\n \n\n def factorization(n):\n\n arr = []\n\n temp = n\n\n for i in range(2, int(-(-n**0.5//1))+1):\n\n if temp%i==0:\n\n cnt=0\n\n while temp%i==0:\n\n cnt+=1\n\n temp //= i\n\n arr.append([i, cnt])\n\n\n\n if temp!=1:\n\n arr.append([temp, 1])\n\n\n\n return arr\n\n \n\n cl = factorization(M)\n\n \n\n def combinations(x,y,N):\n\n fac = [0]*(N+1)\n\n fac[0],fac[1] = 1,1\n\n \n\n for i in range(2,N+1):\n\n fac[i] = (fac[i-1]*i)%MOD\n\n \n\n return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD\n\n \n\n ans = 1\n\n for pr,num in cl:\n\n ans *= combinations(N-1,num,N+num)\n\n ans %= MOD\n\n \n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 47, "code_v1_loc": 43, "code_v0_num_chars": 1020, "code_v1_num_chars": 972, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nfrom collections import defaultdict\nimport copy\n\n\ndef main():\n N, M = list(map(int, input().split()))\n d = defaultdict(int)\n MOD = 10**9 + 7\n R = 10**5 + 100\n fac = [0 for _ in range(R + 1)]\n fac[0], fac[1] = 1, 1\n inv = copy.deepcopy(fac)\n invfac = copy.deepcopy(fac)\n for i in range(2, R + 1):\n fac[i] = (fac[i - 1] * i) % MOD\n inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD\n invfac[i] = (invfac[i - 1] * inv[i]) % MOD\n\n def coef(x, y):\n num = ((fac[x + y] * invfac[y]) % MOD) * invfac[x] % MOD\n return num\n\n while M % 2 == 0:\n d[2] += 1\n M //= 2\n f = 3\n while f**2 <= M:\n if M % f == 0:\n d[f] += 1\n M //= f\n else:\n f += 2\n if M != 1:\n d[M] += 1\n l = list(d.values())\n ans = 1\n for num in l:\n ans *= coef(num, N - 1)\n ans %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\ndef main():\n N, M = list(map(int, input().split()))\n MOD = 10**9 + 7\n\n def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-(n**0.5) // 1)) + 1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append([i, cnt])\n if temp != 1:\n arr.append([temp, 1])\n return arr\n\n cl = factorization(M)\n\n def combinations(x, y, N):\n fac = [0] * (N + 1)\n fac[0], fac[1] = 1, 1\n for i in range(2, N + 1):\n fac[i] = (fac[i - 1] * i) % MOD\n return (\n fac[x + y] * pow(fac[x], MOD - 2, MOD) * pow(fac[y], MOD - 2, MOD)\n ) % MOD\n\n ans = 1\n for pr, num in cl:\n ans *= combinations(N - 1, num, N + num)\n ans %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 8.5106382979, "diff": ["-from collections import defaultdict", "-import copy", "- d = defaultdict(int)", "- R = 10**5 + 100", "- fac = [0 for _ in range(R + 1)]", "- fac[0], fac[1] = 1, 1", "- inv = copy.deepcopy(fac)", "- invfac = copy.deepcopy(fac)", "- for i in range(2, R + 1):", "- fac[i] = (fac[i - 1] * i) % MOD", "- inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD", "- invfac[i] = (invfac[i - 1] * inv[i]) % MOD", "- def coef(x, y):", "- num = ((fac[x + y] * invfac[y]) % MOD) * invfac[x] % MOD", "- return num", "+ def factorization(n):", "+ arr = []", "+ temp = n", "+ for i in range(2, int(-(-(n**0.5) // 1)) + 1):", "+ if temp % i == 0:", "+ cnt = 0", "+ while temp % i == 0:", "+ cnt += 1", "+ temp //= i", "+ arr.append([i, cnt])", "+ if temp != 1:", "+ arr.append([temp, 1])", "+ return arr", "- while M % 2 == 0:", "- d[2] += 1", "- M //= 2", "- f = 3", "- while f**2 <= M:", "- if M % f == 0:", "- d[f] += 1", "- M //= f", "- else:", "- f += 2", "- if M != 1:", "- d[M] += 1", "- l = list(d.values())", "+ cl = factorization(M)", "+", "+ def combinations(x, y, N):", "+ fac = [0] * (N + 1)", "+ fac[0], fac[1] = 1, 1", "+ for i in range(2, N + 1):", "+ fac[i] = (fac[i - 1] * i) % MOD", "+ return (", "+ fac[x + y] * pow(fac[x], MOD - 2, MOD) * pow(fac[y], MOD - 2, MOD)", "+ ) % MOD", "+", "- for num in l:", "- ans *= coef(num, N - 1)", "+ for pr, num in cl:", "+ ans *= combinations(N - 1, num, N + num)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.7565106795, "measured_runtime_v1": 0.2943952236, "runtime_lift": 5.9665053592, "key": ["s901379470", "s767594103"]} +{"user_id": "u440161695", "problem_id": "p03107", "language": "python", "submission_id_v0": "s703980325", "submission_id_v1": "s025529722", "cpu_time_v0": 26, "cpu_time_v1": 18, "memory_v0": 3444, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.77, "input": "from collections import Counter\n\nd={chr(i):0 for i in range(2)}\n\ns=Counter(input())\n\nd=d.update(s)\n\nprint((min(s[\"0\"],s[\"1\"])*2))", "target": "s=input()\n\nprint((min(s.count(\"0\"),s.count(\"1\"))*2))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 127, "code_v1_num_chars": 50, "code_v0_no_empty_lines": "from collections import Counter\n\nd = {chr(i): 0 for i in range(2)}\ns = Counter(input())\nd = d.update(s)\nprint((min(s[\"0\"], s[\"1\"]) * 2))\n", "code_v1_no_empty_lines": "s = input()\nprint((min(s.count(\"0\"), s.count(\"1\")) * 2))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-from collections import Counter", "-", "-d = {chr(i): 0 for i in range(2)}", "-s = Counter(input())", "-d = d.update(s)", "-print((min(s[\"0\"], s[\"1\"]) * 2))", "+s = input()", "+print((min(s.count(\"0\"), s.count(\"1\")) * 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5096813786, "measured_runtime_v1": 0.1983500416, "runtime_lift": 2.5696056043, "key": ["s703980325", "s025529722"]} +{"user_id": "u912237403", "problem_id": "p00145", "language": "python", "submission_id_v0": "s120507501", "submission_id_v1": "s768605614", "cpu_time_v0": 160, "cpu_time_v1": 130, "memory_v0": 4524, "memory_v1": 4520, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.75, "input": "from functools import reduce\ndef f(a,b): return [Card[a][0], Card[b][1]]\n\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, f(j, k) + f(k+1, a)) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])", "target": "from functools import reduce\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, [Card[j][0],Card[k][1],Card[k+1][0],Card[a][1]]) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])", "code_v0_loc": 12, "code_v1_loc": 11, "code_v0_num_chars": 397, "code_v1_num_chars": 380, "code_v0_no_empty_lines": "from functools import reduce\n\n\ndef f(a, b):\n return [Card[a][0], Card[b][1]]\n\n\nn = int(input())\nCard = [[] for _ in [0] * n]\nCost = {}\nfor i in range(n):\n Card[i] = list(map(int, input().split()))\n Cost[(i, i)] = 0\nfor i in range(1, n):\n for j in range(0, n - i):\n a = j + i\n Cost[(j, a)] = min(\n [\n reduce(lambda a, b: a * b, f(j, k) + f(k + 1, a))\n + Cost[(j, k)]\n + Cost[(k + 1, a)]\n for k in range(j, j + i)\n ]\n )\nprint(Cost[0, n - 1])\n", "code_v1_no_empty_lines": "from functools import reduce\n\nn = int(input())\nCard = [[] for _ in [0] * n]\nCost = {}\nfor i in range(n):\n Card[i] = list(map(int, input().split()))\n Cost[(i, i)] = 0\nfor i in range(1, n):\n for j in range(0, n - i):\n a = j + i\n Cost[(j, a)] = min(\n [\n reduce(\n lambda a, b: a * b,\n [Card[j][0], Card[k][1], Card[k + 1][0], Card[a][1]],\n )\n + Cost[(j, k)]\n + Cost[(k + 1, a)]\n for k in range(j, j + i)\n ]\n )\nprint(Cost[0, n - 1])\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-", "-", "-def f(a, b):", "- return [Card[a][0], Card[b][1]]", "-", "- reduce(lambda a, b: a * b, f(j, k) + f(k + 1, a))", "+ reduce(", "+ lambda a, b: a * b,", "+ [Card[j][0], Card[k][1], Card[k + 1][0], Card[a][1]],", "+ )"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2898506114, "measured_runtime_v1": 0.2096236434, "runtime_lift": 1.3827190804, "key": ["s120507501", "s768605614"]} +{"user_id": "u532966492", "problem_id": "p03039", "language": "python", "submission_id_v0": "s814969347", "submission_id_v1": "s884180243", "cpu_time_v0": 555, "cpu_time_v1": 399, "memory_v0": 27096, "memory_v1": 3192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.11, "input": "def cmb(n, r, mod):\n\n if ( r<0 or r>n ):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\nA=2*10**5\n\nmod = 10**9+7\n\ng1 = [1, 1]\n\ng2 = [1, 1]\n\ninverse = [0, 1]\n\n\n\nfor i in range( 2, A + 1 ):\n\n g1.append( ( g1[-1] * i ) % mod )\n\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=cmb(N*M-2,K-2,mod)\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nprint(((keisuu * (sum_//2))%mod))", "target": "def power_mod(a,b,mod=10**9+7):\n\n i,temp,box=0,b,[]\n\n while(2**i<=b):\n\n i+=1\n\n for j in range(i-1,-1,-1):\n\n box=[[j,temp//2**j]]+box\n\n temp-=2**j*(temp//2**j)\n\n box[0].append(a)\n\n ans=box[0][1]*a%mod\n\n for j in range(1,i):\n\n box[j].append(box[j-1][2]**2%mod)\n\n if box[j][1]==1:\n\n ans=(ans*box[j][2])%mod\n\n return ans\n\ndef n_func(n,mod=10**9+7):\n\n ans=1\n\n for i in range(1,n+1):\n\n ans=(ans*i)%mod\n\n return ans\n\ndef nPr(n,r,mod=10**9+7):\n\n ans=n_func(n-r,mod)\n\n ans=power_mod(ans,mod-2,mod)\n\n return ans*n_func(n,mod)%mod\n\ndef nCr(n,r,mod=10**9+7):\n\n ans=n_func(n-r,mod)*n_func(r,mod)%mod\n\n ans=power_mod(ans,mod-2,mod)\n\n return ans*n_func(n,mod)%mod\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=nCr(N*M-2,K-2)\n\nmod=10**9+7\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nprint(((keisuu * (sum_//2))%mod))", "code_v0_loc": 30, "code_v1_loc": 42, "code_v0_num_chars": 731, "code_v1_num_chars": 1114, "code_v0_no_empty_lines": "def cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\nA = 2 * 10**5\nmod = 10**9 + 7\ng1 = [1, 1]\ng2 = [1, 1]\ninverse = [0, 1]\nfor i in range(2, A + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod // i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\nN, M, K = list(map(int, input().split()))\nkeisuu = cmb(N * M - 2, K - 2, mod)\nsum_ = 0\nfor i in range(N):\n a = min(abs(i), abs(N - i - 1))\n b = max(abs(i), abs(N - i - 1))\n sum_ += (M**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nfor i in range(M):\n a = min(abs(i), abs(M - i - 1))\n b = max(abs(i), abs(M - i - 1))\n sum_ += (N**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nprint(((keisuu * (sum_ // 2)) % mod))\n", "code_v1_no_empty_lines": "def power_mod(a, b, mod=10**9 + 7):\n i, temp, box = 0, b, []\n while 2**i <= b:\n i += 1\n for j in range(i - 1, -1, -1):\n box = [[j, temp // 2**j]] + box\n temp -= 2**j * (temp // 2**j)\n box[0].append(a)\n ans = box[0][1] * a % mod\n for j in range(1, i):\n box[j].append(box[j - 1][2] ** 2 % mod)\n if box[j][1] == 1:\n ans = (ans * box[j][2]) % mod\n return ans\n\n\ndef n_func(n, mod=10**9 + 7):\n ans = 1\n for i in range(1, n + 1):\n ans = (ans * i) % mod\n return ans\n\n\ndef nPr(n, r, mod=10**9 + 7):\n ans = n_func(n - r, mod)\n ans = power_mod(ans, mod - 2, mod)\n return ans * n_func(n, mod) % mod\n\n\ndef nCr(n, r, mod=10**9 + 7):\n ans = n_func(n - r, mod) * n_func(r, mod) % mod\n ans = power_mod(ans, mod - 2, mod)\n return ans * n_func(n, mod) % mod\n\n\nN, M, K = list(map(int, input().split()))\nkeisuu = nCr(N * M - 2, K - 2)\nmod = 10**9 + 7\nsum_ = 0\nfor i in range(N):\n a = min(abs(i), abs(N - i - 1))\n b = max(abs(i), abs(N - i - 1))\n sum_ += (M**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nfor i in range(M):\n a = min(abs(i), abs(M - i - 1))\n b = max(abs(i), abs(M - i - 1))\n sum_ += (N**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nprint(((keisuu * (sum_ // 2)) % mod))\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-def cmb(n, r, mod):", "- if r < 0 or r > n:", "- return 0", "- r = min(r, n - r)", "- return g1[n] * g2[r] * g2[n - r] % mod", "+def power_mod(a, b, mod=10**9 + 7):", "+ i, temp, box = 0, b, []", "+ while 2**i <= b:", "+ i += 1", "+ for j in range(i - 1, -1, -1):", "+ box = [[j, temp // 2**j]] + box", "+ temp -= 2**j * (temp // 2**j)", "+ box[0].append(a)", "+ ans = box[0][1] * a % mod", "+ for j in range(1, i):", "+ box[j].append(box[j - 1][2] ** 2 % mod)", "+ if box[j][1] == 1:", "+ ans = (ans * box[j][2]) % mod", "+ return ans", "-A = 2 * 10**5", "+def n_func(n, mod=10**9 + 7):", "+ ans = 1", "+ for i in range(1, n + 1):", "+ ans = (ans * i) % mod", "+ return ans", "+", "+", "+def nPr(n, r, mod=10**9 + 7):", "+ ans = n_func(n - r, mod)", "+ ans = power_mod(ans, mod - 2, mod)", "+ return ans * n_func(n, mod) % mod", "+", "+", "+def nCr(n, r, mod=10**9 + 7):", "+ ans = n_func(n - r, mod) * n_func(r, mod) % mod", "+ ans = power_mod(ans, mod - 2, mod)", "+ return ans * n_func(n, mod) % mod", "+", "+", "+N, M, K = list(map(int, input().split()))", "+keisuu = nCr(N * M - 2, K - 2)", "-g1 = [1, 1]", "-g2 = [1, 1]", "-inverse = [0, 1]", "-for i in range(2, A + 1):", "- g1.append((g1[-1] * i) % mod)", "- inverse.append((-inverse[mod % i] * (mod // i)) % mod)", "- g2.append((g2[-1] * inverse[-1]) % mod)", "-N, M, K = list(map(int, input().split()))", "-keisuu = cmb(N * M - 2, K - 2, mod)"], "diff_only_import_comment": false, "measured_runtime_v0": 2.5172936699, "measured_runtime_v1": 0.2314554, "runtime_lift": 10.8759340674, "key": ["s814969347", "s884180243"]} +{"user_id": "u238940874", "problem_id": "p02725", "language": "python", "submission_id_v0": "s425361145", "submission_id_v1": "s820245641", "cpu_time_v0": 183, "cpu_time_v1": 162, "memory_v0": 25840, "memory_v1": 25840, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.48, "input": "k,n = list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\nlongd=0\n\nfor i in range(n):\n\n tmp=abs(a[i+1]-a[i])\n\n longd=max(longd,tmp)\n\nprint((k-longd))", "target": "k,n=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\n\n\nx=0\n\nfor i in range(len(a)-1):\n\n dis=abs(a[i+1]-a[i])\n\n x=max(x,dis)\n\n\n\nprint((k-x))", "code_v0_loc": 8, "code_v1_loc": 10, "code_v0_num_chars": 179, "code_v1_num_chars": 172, "code_v0_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(a[0] + k)\nlongd = 0\nfor i in range(n):\n tmp = abs(a[i + 1] - a[i])\n longd = max(longd, tmp)\nprint((k - longd))\n", "code_v1_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(a[0] + k)\nx = 0\nfor i in range(len(a) - 1):\n dis = abs(a[i + 1] - a[i])\n x = max(x, dis)\nprint((k - x))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-longd = 0", "-for i in range(n):", "- tmp = abs(a[i + 1] - a[i])", "- longd = max(longd, tmp)", "-print((k - longd))", "+x = 0", "+for i in range(len(a) - 1):", "+ dis = abs(a[i + 1] - a[i])", "+ x = max(x, dis)", "+print((k - x))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2313908032, "measured_runtime_v1": 0.1406400898, "runtime_lift": 1.645269165, "key": ["s425361145", "s820245641"]} +{"user_id": "u021916304", "problem_id": "p02886", "language": "python", "submission_id_v0": "s631255245", "submission_id_v1": "s295881998", "cpu_time_v0": 21, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.05, "input": "def ii():return int(input())\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nans = 0\n\nfor i in range(n):\n\n for j in range(i+1,n):\n\n# print(i,j)\n\n ans += D[i]*D[j] \n\nprint(ans)", "target": "def ii():return int(input())\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nsumD = sum(D)\n\nans = 0\n\nfor i in range(n):\n\n ans += D[i]*(sum(D)-D[i])\n\nprint((ans//2))", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 352, "code_v1_num_chars": 325, "code_v0_no_empty_lines": "def ii():\n return int(input())\n\n\ndef iim():\n return list(map(int, input().split()))\n\n\ndef iil():\n return list(map(int, input().split()))\n\n\ndef ism():\n return list(map(str, input().split()))\n\n\ndef isl():\n return list(map(str, input().split()))\n\n\nn = ii()\nD = iil()\nans = 0\nfor i in range(n):\n for j in range(i + 1, n):\n # print(i,j)\n ans += D[i] * D[j]\nprint(ans)\n", "code_v1_no_empty_lines": "def ii():\n return int(input())\n\n\ndef iim():\n return list(map(int, input().split()))\n\n\ndef iil():\n return list(map(int, input().split()))\n\n\ndef ism():\n return list(map(str, input().split()))\n\n\ndef isl():\n return list(map(str, input().split()))\n\n\nn = ii()\nD = iil()\nsumD = sum(D)\nans = 0\nfor i in range(n):\n ans += D[i] * (sum(D) - D[i])\nprint((ans // 2))\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["+sumD = sum(D)", "- for j in range(i + 1, n):", "- # print(i,j)", "- ans += D[i] * D[j]", "-print(ans)", "+ ans += D[i] * (sum(D) - D[i])", "+print((ans // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2355280421, "measured_runtime_v1": 0.0063002633, "runtime_lift": 37.3838408874, "key": ["s631255245", "s295881998"]} +{"user_id": "u175034939", "problem_id": "p03353", "language": "python", "submission_id_v0": "s387813464", "submission_id_v1": "s460839958", "cpu_time_v0": 62, "cpu_time_v1": 40, "memory_v0": 5068, "memory_v1": 5068, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 35.48, "input": "S = input()\n\nK = int(input())\n\na = list(set(S))\n\na.sort()\n\n\n\nk = []\n\nl = 0\n\nwhile l < len(a):\n\n for i in range(len(S)):\n\n if S[i] == a[l]:\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n k.append(S[i:i+j])\n\n else:\n\n break\n\n l += 1\n\n\n\nk = list(set(k))\n\nk.sort()\n\nprint((k[K-1]))", "target": "S = input()\n\nK = int(input())\n\na = []\n\nfor i in range(len(S)+1):\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n a.append(S[i:i+j])\n\n else:\n\n break\n\n \n\na = list(set(a))\n\na.sort()\n\nprint((a[K-1]))", "code_v0_loc": 20, "code_v1_loc": 13, "code_v0_num_chars": 364, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "S = input()\nK = int(input())\na = list(set(S))\na.sort()\nk = []\nl = 0\nwhile l < len(a):\n for i in range(len(S)):\n if S[i] == a[l]:\n for j in range(1, 6):\n if i + j <= len(S):\n k.append(S[i : i + j])\n else:\n break\n l += 1\nk = list(set(k))\nk.sort()\nprint((k[K - 1]))\n", "code_v1_no_empty_lines": "S = input()\nK = int(input())\na = []\nfor i in range(len(S) + 1):\n for j in range(1, 6):\n if i + j <= len(S):\n a.append(S[i : i + j])\n else:\n break\na = list(set(a))\na.sort()\nprint((a[K - 1]))\n", "code_same": false, "relative_loc_diff_percent": 35.0, "diff": ["-a = list(set(S))", "+a = []", "+for i in range(len(S) + 1):", "+ for j in range(1, 6):", "+ if i + j <= len(S):", "+ a.append(S[i : i + j])", "+ else:", "+ break", "+a = list(set(a))", "-k = []", "-l = 0", "-while l < len(a):", "- for i in range(len(S)):", "- if S[i] == a[l]:", "- for j in range(1, 6):", "- if i + j <= len(S):", "- k.append(S[i : i + j])", "- else:", "- break", "- l += 1", "-k = list(set(k))", "-k.sort()", "-print((k[K - 1]))", "+print((a[K - 1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3274912031, "measured_runtime_v1": 0.2526222069, "runtime_lift": 1.2963674375, "key": ["s387813464", "s460839958"]} +{"user_id": "u653837719", "problem_id": "p02702", "language": "python", "submission_id_v0": "s121665958", "submission_id_v1": "s794197403", "cpu_time_v0": 113, "cpu_time_v1": 101, "memory_v0": 9288, "memory_v1": 9236, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.62, "input": "s = input()[::-1]\n\nl = len(s)\n\nc = [0] * 2019\n\nc[0] = 1\n\nten = 1\n\nmod = 0\n\nans = 0\n\n\n\nfor i in range(l):\n\n mod = (mod + int(s[i]) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) // 2\n\n\n\nprint(ans)", "target": "s = input()[::-1]\n\nc = [0] * 2019\n\nc[0] = 1\n\nmod = 0\n\nten = 1\n\nans = 0\n\n\n\nfor i in s:\n\n mod = (mod + int(i) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) // 2\n\n\n\nprint(ans)", "code_v0_loc": 17, "code_v1_loc": 16, "code_v0_num_chars": 248, "code_v1_num_chars": 226, "code_v0_no_empty_lines": "s = input()[::-1]\nl = len(s)\nc = [0] * 2019\nc[0] = 1\nten = 1\nmod = 0\nans = 0\nfor i in range(l):\n mod = (mod + int(s[i]) * ten) % 2019\n ten = ten * 10 % 2019\n c[mod] += 1\nfor i in c:\n ans += i * (i - 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "s = input()[::-1]\nc = [0] * 2019\nc[0] = 1\nmod = 0\nten = 1\nans = 0\nfor i in s:\n mod = (mod + int(i) * ten) % 2019\n ten = ten * 10 % 2019\n c[mod] += 1\nfor i in c:\n ans += i * (i - 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-l = len(s)", "+mod = 0", "-mod = 0", "-for i in range(l):", "- mod = (mod + int(s[i]) * ten) % 2019", "+for i in s:", "+ mod = (mod + int(i) * ten) % 2019"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2661841769, "measured_runtime_v1": 0.1600983288, "runtime_lift": 1.6626293282, "key": ["s121665958", "s794197403"]} +{"user_id": "u045939752", "problem_id": "p03814", "language": "python", "submission_id_v0": "s574890983", "submission_id_v1": "s839527046", "cpu_time_v0": 23, "cpu_time_v1": 18, "memory_v0": 3516, "memory_v1": 3500, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.74, "input": "S=input()\n\nprint((S.rfind('Z')-S.find('A')+1))", "target": "s=input().strip()\n\na = s.find('A')\n\nz = s.rfind('Z')\n\nprint((z-a+1))\n", "code_v0_loc": 2, "code_v1_loc": 4, "code_v0_num_chars": 44, "code_v1_num_chars": 67, "code_v0_no_empty_lines": "S = input()\nprint((S.rfind(\"Z\") - S.find(\"A\") + 1))\n", "code_v1_no_empty_lines": "s = input().strip()\na = s.find(\"A\")\nz = s.rfind(\"Z\")\nprint((z - a + 1))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-S = input()", "-print((S.rfind(\"Z\") - S.find(\"A\") + 1))", "+s = input().strip()", "+a = s.find(\"A\")", "+z = s.rfind(\"Z\")", "+print((z - a + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.286565238, "measured_runtime_v1": 0.2292430663, "runtime_lift": 1.2500497511, "key": ["s574890983", "s839527046"]} +{"user_id": "u585482323", "problem_id": "p03371", "language": "python", "submission_id_v0": "s026349855", "submission_id_v1": "s676818074", "cpu_time_v0": 206, "cpu_time_v1": 183, "memory_v0": 40944, "memory_v1": 39408, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.17, "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LS()\n\n return l\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n return\n\n\n\n#B\n\ndef B():\n\n return\n\n\n\n#C\n\ndef C():\n\n return\n\n\n\n#D\n\ndef D():\n\n return\n\n\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n a,b,c,X,Y = LI()\n\n ans = float(\"inf\")\n\n for z in range(300001):\n\n if z%2 == 0:\n\n m = c*z\n\n x = z//2\n\n y = z//2\n\n m += a*max(0,X-x)\n\n m += b*max(0,Y-y)\n\n if m < ans:\n\n ans = m\n\n print(ans)\n\n return\n\n\n\n#G\n\ndef G():\n\n n = I()\n\n x = LI()\n\n f = [(i,x[i]) for i in range(n)]\n\n f.sort(key = lambda x:x[1])\n\n g = [(f[i][0],i) for i in range(n)]\n\n g.sort(key = lambda x:x[0])\n\n for i in range(n):\n\n if g[i][1] < n//2:\n\n print((f[n//2][1]))\n\n else:\n\n print((f[n//2-1][1]))\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#I\n\ndef I_():\n\n return\n\n\n\n#J\n\ndef J():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n F()\n", "target": "#!usr/bin/env python3\n\nfrom collections import defaultdict,deque\n\nfrom heapq import heappush, heappop\n\nfrom itertools import permutations\n\nimport sys\n\nimport math\n\nimport bisect\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\n\ndef S():\n\n res = list(sys.stdin.readline())\n\n if res[-1] == \"\\n\":\n\n return res[:-1]\n\n return res\n\ndef IR(n):\n\n return [I() for i in range(n)]\n\ndef LIR(n):\n\n return [LI() for i in range(n)]\n\ndef SR(n):\n\n return [S() for i in range(n)]\n\ndef LSR(n):\n\n return [LS() for i in range(n)]\n\n\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\ndef solve():\n\n A,B,C,x,y = LI()\n\n ans = float(\"inf\")\n\n for c in range(200001)[::2]:\n\n a = b = c >> 1\n\n a = max(0,x-a)\n\n b = max(0,y-b)\n\n s = A*a+B*b+C*c\n\n if s < ans:\n\n ans = s\n\n print(ans)\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n solve()\n", "code_v0_loc": 97, "code_v1_loc": 43, "code_v0_num_chars": 1751, "code_v1_num_chars": 1027, "code_v0_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LS()\n return l\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n# A\ndef A():\n return\n\n\n# B\ndef B():\n return\n\n\n# C\ndef C():\n return\n\n\n# D\ndef D():\n return\n\n\n# E\ndef E():\n return\n\n\n# F\ndef F():\n a, b, c, X, Y = LI()\n ans = float(\"inf\")\n for z in range(300001):\n if z % 2 == 0:\n m = c * z\n x = z // 2\n y = z // 2\n m += a * max(0, X - x)\n m += b * max(0, Y - y)\n if m < ans:\n ans = m\n print(ans)\n return\n\n\n# G\ndef G():\n n = I()\n x = LI()\n f = [(i, x[i]) for i in range(n)]\n f.sort(key=lambda x: x[1])\n g = [(f[i][0], i) for i in range(n)]\n g.sort(key=lambda x: x[0])\n for i in range(n):\n if g[i][1] < n // 2:\n print((f[n // 2][1]))\n else:\n print((f[n // 2 - 1][1]))\n return\n\n\n# H\ndef H():\n return\n\n\n# I\ndef I_():\n return\n\n\n# J\ndef J():\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n F()\n", "code_v1_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations\nimport sys\nimport math\nimport bisect\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == \"\\n\":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n\n\ndef solve():\n A, B, C, x, y = LI()\n ans = float(\"inf\")\n for c in range(200001)[::2]:\n a = b = c >> 1\n a = max(0, x - a)\n b = max(0, y - b)\n s = A * a + B * b + C * c\n if s < ans:\n ans = s\n print(ans)\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 55.6701030928, "diff": ["-from collections import defaultdict", "-from collections import deque", "+from collections import defaultdict, deque", "+from itertools import permutations", "-import random", "- return list(map(int, sys.stdin.readline().split()))", "+ return [int(x) for x in sys.stdin.readline().split()]", "- return list(map(list, sys.stdin.readline().split()))", "+ return [list(x) for x in sys.stdin.readline().split()]", "- return list(sys.stdin.readline())[:-1]", "+ res = list(sys.stdin.readline())", "+ if res[-1] == \"\\n\":", "+ return res[:-1]", "+ return res", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = I()", "- return l", "+ return [I() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = LI()", "- return l", "+ return [LI() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = S()", "- return l", "+ return [S() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = LS()", "- return l", "+ return [LS() for i in range(n)]", "-# A", "-def A():", "- return", "-# B", "-def B():", "- return", "-", "-", "-# C", "-def C():", "- return", "-", "-", "-# D", "-def D():", "- return", "-", "-", "-# E", "-def E():", "- return", "-", "-", "-# F", "-def F():", "- a, b, c, X, Y = LI()", "+def solve():", "+ A, B, C, x, y = LI()", "- for z in range(300001):", "- if z % 2 == 0:", "- m = c * z", "- x = z // 2", "- y = z // 2", "- m += a * max(0, X - x)", "- m += b * max(0, Y - y)", "- if m < ans:", "- ans = m", "+ for c in range(200001)[::2]:", "+ a = b = c >> 1", "+ a = max(0, x - a)", "+ b = max(0, y - b)", "+ s = A * a + B * b + C * c", "+ if s < ans:", "+ ans = s", "- return", "-", "-", "-# G", "-def G():", "- n = I()", "- x = LI()", "- f = [(i, x[i]) for i in range(n)]", "- f.sort(key=lambda x: x[1])", "- g = [(f[i][0], i) for i in range(n)]", "- g.sort(key=lambda x: x[0])", "- for i in range(n):", "- if g[i][1] < n // 2:", "- print((f[n // 2][1]))", "- else:", "- print((f[n // 2 - 1][1]))", "- return", "-", "-", "-# H", "-def H():", "- return", "-", "-", "-# I", "-def I_():", "- return", "-", "-", "-# J", "-def J():", "- F()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3533082061, "measured_runtime_v1": 0.0063346879, "runtime_lift": 213.6345491689, "key": ["s026349855", "s676818074"]} +{"user_id": "u183422236", "problem_id": "p02612", "language": "python", "submission_id_v0": "s828418851", "submission_id_v1": "s809335980", "cpu_time_v0": 81, "cpu_time_v1": 70, "memory_v0": 61540, "memory_v1": 61736, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.58, "input": "n = int(input()) % 1000\n\nif n == 0:\n\n print((0))\n\nelse:\n\n print((1000 - n))", "target": "n = int(input())\n\nprint(((1000 - n % 1000) % 1000))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 77, "code_v1_num_chars": 49, "code_v0_no_empty_lines": "n = int(input()) % 1000\nif n == 0:\n print((0))\nelse:\n print((1000 - n))\n", "code_v1_no_empty_lines": "n = int(input())\nprint(((1000 - n % 1000) % 1000))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-n = int(input()) % 1000", "-if n == 0:", "- print((0))", "-else:", "- print((1000 - n))", "+n = int(input())", "+print(((1000 - n % 1000) % 1000))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2545247498, "measured_runtime_v1": 0.1889497155, "runtime_lift": 1.3470501881, "key": ["s828418851", "s809335980"]} +{"user_id": "u912650255", "problem_id": "p02983", "language": "python", "submission_id_v0": "s074902378", "submission_id_v1": "s358904585", "cpu_time_v0": 618, "cpu_time_v1": 67, "memory_v0": 75568, "memory_v1": 6888, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 89.16, "input": "L ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nif R - L <= 2019:\n\n for i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n\n\nelse:\n\n for i in range(R-L-1010,R-L+1010):\n\n for j in range(i,R-L+1010):\n\n ans.append(i*j%2019)\n\n\n\nprint((min(ans)))\n", "target": "L ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nfor i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n if (i * j % 2019) == 0:\n\n break\n\n else:\n\n continue\n\n break\n\n\n\nprint((min(ans)))", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 297, "code_v1_num_chars": 237, "code_v0_no_empty_lines": "L, R = list(map(int, input().split()))\nans = []\nif R - L <= 2019:\n for i in range(L, R + 1):\n for j in range(i + 1, R + 1):\n ans.append(i * j % 2019)\nelse:\n for i in range(R - L - 1010, R - L + 1010):\n for j in range(i, R - L + 1010):\n ans.append(i * j % 2019)\nprint((min(ans)))\n", "code_v1_no_empty_lines": "L, R = list(map(int, input().split()))\nans = []\nfor i in range(L, R + 1):\n for j in range(i + 1, R + 1):\n ans.append(i * j % 2019)\n if (i * j % 2019) == 0:\n break\n else:\n continue\n break\nprint((min(ans)))\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-if R - L <= 2019:", "- for i in range(L, R + 1):", "- for j in range(i + 1, R + 1):", "- ans.append(i * j % 2019)", "-else:", "- for i in range(R - L - 1010, R - L + 1010):", "- for j in range(i, R - L + 1010):", "- ans.append(i * j % 2019)", "+for i in range(L, R + 1):", "+ for j in range(i + 1, R + 1):", "+ ans.append(i * j % 2019)", "+ if (i * j % 2019) == 0:", "+ break", "+ else:", "+ continue", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3668963638, "measured_runtime_v1": 0.2102679547, "runtime_lift": 1.7448990943, "key": ["s074902378", "s358904585"]} +{"user_id": "u622570247", "problem_id": "p02773", "language": "python", "submission_id_v0": "s074380513", "submission_id_v1": "s228830644", "cpu_time_v0": 1054, "cpu_time_v1": 898, "memory_v0": 45492, "memory_v1": 47732, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.8, "input": "from collections import Counter\n\nimport heapq\n\n\n\nn = int(input())\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\nheap = [(-v, k) for k, v in list(ctr.items())]\n\nheapq.heapify(heap)\n\nmaxv = heap[0][0]\n\nwhile heap:\n\n c = heapq.heappop(heap)\n\n if c[0] != maxv:\n\n break\n\n print((c[1]))\n", "target": "from collections import Counter\n\n\n\nn = int(input())\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\n\n\na = sorted([(-v, k) for k, v in list(ctr.items())])\n\nmaxv = a[0][0]\n\nfor i in range(len(a)):\n\n if a[i][0] != maxv:\n\n break\n\n print((a[i][1]))", "code_v0_loc": 16, "code_v1_loc": 14, "code_v0_num_chars": 325, "code_v1_num_chars": 282, "code_v0_no_empty_lines": "from collections import Counter\nimport heapq\n\nn = int(input())\nss = []\nfor _ in range(n):\n ss.append(input().rstrip())\nctr = Counter(ss)\nheap = [(-v, k) for k, v in list(ctr.items())]\nheapq.heapify(heap)\nmaxv = heap[0][0]\nwhile heap:\n c = heapq.heappop(heap)\n if c[0] != maxv:\n break\n print((c[1]))\n", "code_v1_no_empty_lines": "from collections import Counter\n\nn = int(input())\nss = []\nfor _ in range(n):\n ss.append(input().rstrip())\nctr = Counter(ss)\na = sorted([(-v, k) for k, v in list(ctr.items())])\nmaxv = a[0][0]\nfor i in range(len(a)):\n if a[i][0] != maxv:\n break\n print((a[i][1]))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-import heapq", "-heap = [(-v, k) for k, v in list(ctr.items())]", "-heapq.heapify(heap)", "-maxv = heap[0][0]", "-while heap:", "- c = heapq.heappop(heap)", "- if c[0] != maxv:", "+a = sorted([(-v, k) for k, v in list(ctr.items())])", "+maxv = a[0][0]", "+for i in range(len(a)):", "+ if a[i][0] != maxv:", "- print((c[1]))", "+ print((a[i][1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3121475418, "measured_runtime_v1": 0.0064239368, "runtime_lift": 48.5913153977, "key": ["s074380513", "s228830644"]} +{"user_id": "u428397309", "problem_id": "p03037", "language": "python", "submission_id_v0": "s058389905", "submission_id_v1": "s302443687", "cpu_time_v0": 285, "cpu_time_v1": 131, "memory_v0": 10868, "memory_v1": 10868, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.04, "input": "# -*- coding: utf-8 -*-\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nl = max(L)\n\nr = min(R)\n\n\n\nans = max(r - l + 1, 0)\n\n\n\nprint(ans)\n", "target": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nans = max(min(R) - max(L) + 1, 0)\n\n\n\nprint(ans)\n", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 222, "code_v1_num_chars": 248, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nN, M = list(map(int, input().split()))\nL, R = [None] * M, [None] * M\nfor i in range(M):\n L[i], R[i] = list(map(int, input().split()))\nl = max(L)\nr = min(R)\nans = max(r - l + 1, 0)\nprint(ans)\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nL, R = [None] * M, [None] * M\nfor i in range(M):\n L[i], R[i] = list(map(int, input().split()))\nans = max(min(R) - max(L) + 1, 0)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+import sys", "+", "+input = sys.stdin.readline", "-l = max(L)", "-r = min(R)", "-ans = max(r - l + 1, 0)", "+ans = max(min(R) - max(L) + 1, 0)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2363609416, "measured_runtime_v1": 0.0060358713, "runtime_lift": 39.1593741465, "key": ["s058389905", "s302443687"]} +{"user_id": "u756270013", "problem_id": "p02881", "language": "python", "submission_id_v0": "s868775809", "submission_id_v1": "s345973481", "cpu_time_v0": 439, "cpu_time_v1": 210, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.16, "input": "import math\n\ninput_num = int(input())\n\nnum_sqrt = int(math.sqrt(input_num))\n\n\n\nminimam = input_num\n\nfor i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n distance = q + i -2\n\n if mod == 0 and minimam > distance:\n\n minimam = distance\n\nprint(minimam)", "target": "import math\n\ndef main1():\n\n input_num = int(input())\n\n num_sqrt = int(math.sqrt(input_num))\n\n\n\n minimam = input_num\n\n for i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n if mod == 0:\n\n distance = q + i -2\n\n if minimam > distance:\n\n minimam = distance\n\n print(minimam)\n\nmain1()", "code_v0_loc": 11, "code_v1_loc": 14, "code_v0_num_chars": 277, "code_v1_num_chars": 357, "code_v0_no_empty_lines": "import math\n\ninput_num = int(input())\nnum_sqrt = int(math.sqrt(input_num))\nminimam = input_num\nfor i in range(num_sqrt + 1, 0, -1):\n q, mod = divmod(input_num, i)\n distance = q + i - 2\n if mod == 0 and minimam > distance:\n minimam = distance\nprint(minimam)\n", "code_v1_no_empty_lines": "import math\n\n\ndef main1():\n input_num = int(input())\n num_sqrt = int(math.sqrt(input_num))\n minimam = input_num\n for i in range(num_sqrt + 1, 0, -1):\n q, mod = divmod(input_num, i)\n if mod == 0:\n distance = q + i - 2\n if minimam > distance:\n minimam = distance\n print(minimam)\n\n\nmain1()\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-input_num = int(input())", "-num_sqrt = int(math.sqrt(input_num))", "-minimam = input_num", "-for i in range(num_sqrt + 1, 0, -1):", "- q, mod = divmod(input_num, i)", "- distance = q + i - 2", "- if mod == 0 and minimam > distance:", "- minimam = distance", "-print(minimam)", "+", "+def main1():", "+ input_num = int(input())", "+ num_sqrt = int(math.sqrt(input_num))", "+ minimam = input_num", "+ for i in range(num_sqrt + 1, 0, -1):", "+ q, mod = divmod(input_num, i)", "+ if mod == 0:", "+ distance = q + i - 2", "+ if minimam > distance:", "+ minimam = distance", "+ print(minimam)", "+", "+", "+main1()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.27158184, "measured_runtime_v1": 0.2170004892, "runtime_lift": 1.2515263951, "key": ["s868775809", "s345973481"]} +{"user_id": "u802963389", "problem_id": "p02881", "language": "python", "submission_id_v0": "s879601223", "submission_id_v1": "s706921267", "cpu_time_v0": 178, "cpu_time_v1": 148, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.85, "input": "# C - Walk on Multiplication Table\n\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\n\n\n\nn = int(input())\n\n\n\nans = 10 ** 12\n\nfor i in range(1, 10 ** 6 + 1):\n\n if n % i == 0:\n\n ans = min(ans, n // i + i)\n\n\n\nprint((ans - 2))", "target": "# C - Walk on Multiplication Table\n\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\n\n\n\nn = int(input())\n\n\n\nans = n\n\nfor i in range(1, int(n**.5) + 2):\n\n if n % i == 0:\n\n ans = min(ans, n // i + i - 2)\n\n\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 226, "code_v1_num_chars": 222, "code_v0_no_empty_lines": "# C - Walk on Multiplication Table\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\nn = int(input())\nans = 10**12\nfor i in range(1, 10**6 + 1):\n if n % i == 0:\n ans = min(ans, n // i + i)\nprint((ans - 2))\n", "code_v1_no_empty_lines": "# C - Walk on Multiplication Table\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\nn = int(input())\nans = n\nfor i in range(1, int(n**0.5) + 2):\n if n % i == 0:\n ans = min(ans, n // i + i - 2)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-ans = 10**12", "-for i in range(1, 10**6 + 1):", "+ans = n", "+for i in range(1, int(n**0.5) + 2):", "- ans = min(ans, n // i + i)", "-print((ans - 2))", "+ ans = min(ans, n // i + i - 2)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0824642203, "measured_runtime_v1": 0.2210092547, "runtime_lift": 4.8978230425, "key": ["s879601223", "s706921267"]} +{"user_id": "u077291787", "problem_id": "p04020", "language": "python", "submission_id_v0": "s648607888", "submission_id_v1": "s112859245", "cpu_time_v0": 58, "cpu_time_v1": 46, "memory_v0": 14252, "memory_v1": 14092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.69, "input": "# AGC003B - Simplified mahjong\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur // 2\n\n N = int(input())\n\n A = list(map(int, [input() for _ in range(N)])) + [0]\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur // 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "# AGC003B - Simplified mahjong\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur // 2\n\n N, *A = list(map(int, open(0).read().split()))\n\n A.append(0)\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur // 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 429, "code_v1_num_chars": 369, "code_v0_no_empty_lines": "# AGC003B - Simplified mahjong\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n # split in subsequences when 0 appears -> sum up cur // 2\n N = int(input())\n A = list(map(int, [input() for _ in range(N)])) + [0]\n ans, cur = 0, 0\n for i in A:\n if i:\n cur += i\n else:\n ans += cur // 2\n cur = 0\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# AGC003B - Simplified mahjong\ndef main():\n # split in subsequences when 0 appears -> sum up cur // 2\n N, *A = list(map(int, open(0).read().split()))\n A.append(0)\n ans, cur = 0, 0\n for i in A:\n if i:\n cur += i\n else:\n ans += cur // 2\n cur = 0\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-", "-", "- N = int(input())", "- A = list(map(int, [input() for _ in range(N)])) + [0]", "+ N, *A = list(map(int, open(0).read().split()))", "+ A.append(0)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.282343082, "measured_runtime_v1": 0.1984000847, "runtime_lift": 1.4230996042, "key": ["s648607888", "s112859245"]} +{"user_id": "u131984977", "problem_id": "p02412", "language": "python", "submission_id_v0": "s229334190", "submission_id_v1": "s721700065", "cpu_time_v0": 1150, "cpu_time_v1": 900, "memory_v0": 6724, "memory_v1": 6720, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.74, "input": "while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for a in range(1, n + 1):\n\n for b in range(a + 1, n + 1):\n\n for c in range(b + 1, n + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)", "target": "while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n limit = n if n < x else x\n\n for a in range(1, limit + 1):\n\n for b in range(a + 1, limit + 1):\n\n for c in range(b + 1, limit + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)", "code_v0_loc": 13, "code_v1_loc": 14, "code_v0_num_chars": 316, "code_v1_num_chars": 359, "code_v0_no_empty_lines": "while True:\n (n, x) = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for a in range(1, n + 1):\n for b in range(a + 1, n + 1):\n for c in range(b + 1, n + 1):\n if sum([a, b, c]) == x:\n count += 1\n print(count)\n", "code_v1_no_empty_lines": "while True:\n (n, x) = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n limit = n if n < x else x\n for a in range(1, limit + 1):\n for b in range(a + 1, limit + 1):\n for c in range(b + 1, limit + 1):\n if sum([a, b, c]) == x:\n count += 1\n print(count)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["- for a in range(1, n + 1):", "- for b in range(a + 1, n + 1):", "- for c in range(b + 1, n + 1):", "+ limit = n if n < x else x", "+ for a in range(1, limit + 1):", "+ for b in range(a + 1, limit + 1):", "+ for c in range(b + 1, limit + 1):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2860648324, "measured_runtime_v1": 0.2158536868, "runtime_lift": 1.3252719315, "key": ["s229334190", "s721700065"]} +{"user_id": "u426534722", "problem_id": "p02245", "language": "python", "submission_id_v0": "s237914915", "submission_id_v1": "s694650984", "cpu_time_v0": 730, "cpu_time_v1": 50, "memory_v0": 25688, "memory_v1": 8488, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 93.15, "input": "from collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n if MAP == goal:\n\n return 0\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n return cnt\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n", "target": "from collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n zero = 8 - MAP.find(\"0\")\n\n start = int(MAP)\n\n if start == goal:\n\n return 0\n\n dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])\n\n TABLE = {start: (1, 0), goal: (0, 0)}\n\n while dp:\n\n cnt, M, yx, flg = dp.popleft()\n\n cnt += 1\n\n for nyx in m[yx]:\n\n key = g(yx, nyx, M)\n\n if key in TABLE:\n\n if TABLE[key][0] != flg:\n\n return TABLE[key][1] + cnt\n\n continue\n\n TABLE[key] = (flg, cnt)\n\n dp.append((cnt, key, nyx, flg))\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n", "code_v0_loc": 30, "code_v1_loc": 31, "code_v0_num_chars": 815, "code_v1_num_chars": 949, "code_v0_no_empty_lines": "from collections import deque\n\nN = 3\nm = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n}\ngoal = 123456780\n\n\ndef g(i, j, a):\n t = a // (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef solve():\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = 8 - MAP.find(\"0\")\n MAP = int(MAP)\n if MAP == goal:\n return 0\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n return cnt\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\ndef MAIN():\n print((solve()))\n\n\nMAIN()\n", "code_v1_no_empty_lines": "from collections import deque\n\nN = 3\nm = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n}\ngoal = 123456780\n\n\ndef g(i, j, a):\n t = a // (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef solve():\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n zero = 8 - MAP.find(\"0\")\n start = int(MAP)\n if start == goal:\n return 0\n dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])\n TABLE = {start: (1, 0), goal: (0, 0)}\n while dp:\n cnt, M, yx, flg = dp.popleft()\n cnt += 1\n for nyx in m[yx]:\n key = g(yx, nyx, M)\n if key in TABLE:\n if TABLE[key][0] != flg:\n return TABLE[key][1] + cnt\n continue\n TABLE[key] = (flg, cnt)\n dp.append((cnt, key, nyx, flg))\n\n\ndef MAIN():\n print((solve()))\n\n\nMAIN()\n", "code_same": false, "relative_loc_diff_percent": 3.2258064516, "diff": ["- start = 8 - MAP.find(\"0\")", "- MAP = int(MAP)", "- if MAP == goal:", "+ zero = 8 - MAP.find(\"0\")", "+ start = int(MAP)", "+ if start == goal:", "- dp = deque([(0, start, MAP)])", "- LOG = {MAP}", "+ dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])", "+ TABLE = {start: (1, 0), goal: (0, 0)}", "- cnt, yx, M = dp.popleft()", "- if M == goal:", "- return cnt", "+ cnt, M, yx, flg = dp.popleft()", "- CM = g(yx, nyx, M)", "- if not CM in LOG:", "- dp.append((cnt, nyx, CM))", "- LOG.add(CM)", "+ key = g(yx, nyx, M)", "+ if key in TABLE:", "+ if TABLE[key][0] != flg:", "+ return TABLE[key][1] + cnt", "+ continue", "+ TABLE[key] = (flg, cnt)", "+ dp.append((cnt, key, nyx, flg))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2854871392, "measured_runtime_v1": 0.2155938864, "runtime_lift": 1.3241894008, "key": ["s237914915", "s694650984"]} +{"user_id": "u562935282", "problem_id": "p03371", "language": "python", "submission_id_v0": "s168362535", "submission_id_v1": "s471284270", "cpu_time_v0": 242, "cpu_time_v1": 98, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.5, "input": "inf = (5000 * 10 ** 5) * 3\n\n\n\na, b, c, x, y = list(map(int, input().split()))\n\n\n\nret = inf\n\nfor cnt_ab in range(max(x, y) * 2 + 1):\n\n d = cnt_ab // 2\n\n\n\n cnt_a = max(0, x - d)\n\n cnt_b = max(0, y - d)\n\n\n\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n\n ret = min(ret, t)\n\nprint(ret)\n", "target": "def main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 14, "code_v1_loc": 20, "code_v0_num_chars": 284, "code_v1_num_chars": 353, "code_v0_no_empty_lines": "inf = (5000 * 10**5) * 3\na, b, c, x, y = list(map(int, input().split()))\nret = inf\nfor cnt_ab in range(max(x, y) * 2 + 1):\n d = cnt_ab // 2\n cnt_a = max(0, x - d)\n cnt_b = max(0, y - d)\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n ret = min(ret, t)\nprint(ret)\n", "code_v1_no_empty_lines": "def main():\n A, B, AB, X, Y = list(map(int, input().split()))\n M = max(X, Y)\n k = 0\n ans = A * X + B * Y\n while True:\n ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)\n if k >= M:\n break\n k += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-inf = (5000 * 10**5) * 3", "-a, b, c, x, y = list(map(int, input().split()))", "-ret = inf", "-for cnt_ab in range(max(x, y) * 2 + 1):", "- d = cnt_ab // 2", "- cnt_a = max(0, x - d)", "- cnt_b = max(0, y - d)", "- t = cnt_ab * c + cnt_a * a + cnt_b * b", "- ret = min(ret, t)", "-print(ret)", "+def main():", "+ A, B, AB, X, Y = list(map(int, input().split()))", "+ M = max(X, Y)", "+ k = 0", "+ ans = A * X + B * Y", "+ while True:", "+ ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)", "+ if k >= M:", "+ break", "+ k += 1", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4937371187, "measured_runtime_v1": 0.3021148317, "runtime_lift": 1.6342697111, "key": ["s168362535", "s471284270"]} +{"user_id": "u349449706", "problem_id": "p02555", "language": "python", "submission_id_v0": "s796837031", "submission_id_v1": "s077713004", "cpu_time_v0": 96, "cpu_time_v1": 64, "memory_v0": 68168, "memory_v1": 63448, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "S = int(input())\n\nf = [0]*(S+1)\n\nf[0] = 1\n\nif S >= 3: f[3] = 1\n\nif S >= 4: f[4] = 1\n\nif S >= 5: f[5] = 1\n\nfor i in range(6, S+1):\n\n f[i] = sum(f[i-j] for j in range(3, i+1))%(10**9+7)\n\nprint((f[S]))\n", "target": "S=int(input())\n\nf=[1,0,0]\n\nfor i in range(S-2):f.append(f[i]+f[i+2])\n\nprint((f[S]%(10**9+7)))\n", "code_v0_loc": 9, "code_v1_loc": 4, "code_v0_num_chars": 200, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "S = int(input())\nf = [0] * (S + 1)\nf[0] = 1\nif S >= 3:\n f[3] = 1\nif S >= 4:\n f[4] = 1\nif S >= 5:\n f[5] = 1\nfor i in range(6, S + 1):\n f[i] = sum(f[i - j] for j in range(3, i + 1)) % (10**9 + 7)\nprint((f[S]))\n", "code_v1_no_empty_lines": "S = int(input())\nf = [1, 0, 0]\nfor i in range(S - 2):\n f.append(f[i] + f[i + 2])\nprint((f[S] % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-f = [0] * (S + 1)", "-f[0] = 1", "-if S >= 3:", "- f[3] = 1", "-if S >= 4:", "- f[4] = 1", "-if S >= 5:", "- f[5] = 1", "-for i in range(6, S + 1):", "- f[i] = sum(f[i - j] for j in range(3, i + 1)) % (10**9 + 7)", "-print((f[S]))", "+f = [1, 0, 0]", "+for i in range(S - 2):", "+ f.append(f[i] + f[i + 2])", "+print((f[S] % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5486869376, "measured_runtime_v1": 0.341561399, "runtime_lift": 1.6064079231, "key": ["s796837031", "s077713004"]} +{"user_id": "u296518383", "problem_id": "p03806", "language": "python", "submission_id_v0": "s823150149", "submission_id_v1": "s174409855", "cpu_time_v0": 255, "cpu_time_v1": 220, "memory_v0": 44124, "memory_v1": 43356, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.73, "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(400, -1, -1):\n\n for j in range(400, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, 401):\n\n for j in range(1, 401):\n\n if dp[i][j] != INF and i / j == Ma / Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))", "target": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nsumA = sum([ABC[i][0] for i in range(N)])\n\nsumB = sum([ABC[i][1] for i in range(N)])\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(sumA, -1, -1):\n\n for j in range(sumB, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, sumA + 1):\n\n for j in range(1, sumB + 1):\n\n if dp[i][j] != INF and i / j == Ma / Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))", "code_v0_loc": 23, "code_v1_loc": 26, "code_v0_num_chars": 611, "code_v1_num_chars": 721, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nN, Ma, Mb = list(map(int, input().split()))\nABC = [list(map(int, input().split())) for _ in range(N)]\nINF = 10**15\ndp = [[INF for j in range(401)] for i in range(401)]\ndp[0][0] = 0\nfor a, b, c in ABC:\n for i in range(400, -1, -1):\n for j in range(400, -1, -1):\n if dp[i][j] != INF:\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\nanswer = INF\nfor i in range(1, 401):\n for j in range(1, 401):\n if dp[i][j] != INF and i / j == Ma / Mb:\n answer = min(answer, dp[i][j])\nprint((answer if answer != INF else -1))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nN, Ma, Mb = list(map(int, input().split()))\nABC = [list(map(int, input().split())) for _ in range(N)]\nsumA = sum([ABC[i][0] for i in range(N)])\nsumB = sum([ABC[i][1] for i in range(N)])\nINF = 10**15\ndp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]\ndp[0][0] = 0\nfor a, b, c in ABC:\n for i in range(sumA, -1, -1):\n for j in range(sumB, -1, -1):\n if dp[i][j] != INF:\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\nanswer = INF\nfor i in range(1, sumA + 1):\n for j in range(1, sumB + 1):\n if dp[i][j] != INF and i / j == Ma / Mb:\n answer = min(answer, dp[i][j])\nprint((answer if answer != INF else -1))\n", "code_same": false, "relative_loc_diff_percent": 11.5384615385, "diff": ["+sumA = sum([ABC[i][0] for i in range(N)])", "+sumB = sum([ABC[i][1] for i in range(N)])", "-dp = [[INF for j in range(401)] for i in range(401)]", "+dp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]", "- for i in range(400, -1, -1):", "- for j in range(400, -1, -1):", "+ for i in range(sumA, -1, -1):", "+ for j in range(sumB, -1, -1):", "-for i in range(1, 401):", "- for j in range(1, 401):", "+for i in range(1, sumA + 1):", "+ for j in range(1, sumB + 1):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8101779278, "measured_runtime_v1": 0.2126889092, "runtime_lift": 3.8092156792, "key": ["s823150149", "s174409855"]} +{"user_id": "u064505481", "problem_id": "p02555", "language": "python", "submission_id_v0": "s988049268", "submission_id_v1": "s031685542", "cpu_time_v0": 173, "cpu_time_v1": 74, "memory_v0": 76464, "memory_v1": 70408, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.23, "input": "from sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\nsetrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\t@lru_cache(None)\n\n\tdef dp(currsum):\n\n\t\tif currsum == s: return 1\n\n\t\tcnt = 0\n\n\t\tfor d in range(3, 2001):\n\n\t\t\tif currsum + d <= s:\n\n\t\t\t\tcnt += dp(currsum + d)\n\n\t\t\t\tcnt %= MOD \n\n\t\treturn cnt\n\n\tprint((dp(0)))\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "target": "from sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\n#setrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\tdef binom_tables(n, q):\n\n\t\tfact = [1 for _ in range(n + 1)]\n\n\t\tinv = [1 for _ in range(n + 1)]\n\n\t\tfor i in range(1, n+1):\n\n\t\t\tfact[i] = (fact[i-1] * i) % q\n\n\t\t\tinv[i] = pow(fact[i], q-2, q)\n\n\t\treturn fact, inv\n\n\n\n\tF, I = binom_tables(s + 700, MOD)\n\n\n\n\tdef binom(n, k, q):\n\n\t\treturn (F[n]*((I[k]*I[n-k])%q))%q\n\n\n\n\tans = 0\n\n\tfor r in range(1, 700):\n\n\t\tobjects = s - 3*r\n\n\t\tif objects + r - 1 < objects or objects < 0: \n\n\t\t\tbreak\n\n\t\tx = binom(objects + r - 1, objects, MOD)\n\n\t\tans += x\n\n\t\tans %= MOD \n\n\n\n\tprint(ans)\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "code_v0_loc": 32, "code_v1_loc": 45, "code_v0_num_chars": 739, "code_v1_num_chars": 1050, "code_v0_no_empty_lines": "from sys import stdin, stdout, setrecursionlimit\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\nfrom functools import lru_cache\nimport math\n\nsetrecursionlimit(10**6)\nrl = lambda: stdin.readline()\nrll = lambda: stdin.readline().split()\nrli = lambda: list(map(int, stdin.readline().split()))\nrlf = lambda: list(map(float, stdin.readline().split()))\nINF, NINF = float(\"inf\"), float(\"-inf\")\nMOD = 10**9 + 7\n\n\ndef main():\n s = int(rl())\n\n @lru_cache(None)\n def dp(currsum):\n if currsum == s:\n return 1\n cnt = 0\n for d in range(3, 2001):\n if currsum + d <= s:\n cnt += dp(currsum + d)\n cnt %= MOD\n return cnt\n\n print((dp(0)))\n stdout.close()\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from sys import stdin, stdout, setrecursionlimit\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\nfrom functools import lru_cache\nimport math\n\n# setrecursionlimit(10**6)\nrl = lambda: stdin.readline()\nrll = lambda: stdin.readline().split()\nrli = lambda: list(map(int, stdin.readline().split()))\nrlf = lambda: list(map(float, stdin.readline().split()))\nINF, NINF = float(\"inf\"), float(\"-inf\")\nMOD = 10**9 + 7\n\n\ndef main():\n s = int(rl())\n\n def binom_tables(n, q):\n fact = [1 for _ in range(n + 1)]\n inv = [1 for _ in range(n + 1)]\n for i in range(1, n + 1):\n fact[i] = (fact[i - 1] * i) % q\n inv[i] = pow(fact[i], q - 2, q)\n return fact, inv\n\n F, I = binom_tables(s + 700, MOD)\n\n def binom(n, k, q):\n return (F[n] * ((I[k] * I[n - k]) % q)) % q\n\n ans = 0\n for r in range(1, 700):\n objects = s - 3 * r\n if objects + r - 1 < objects or objects < 0:\n break\n x = binom(objects + r - 1, objects, MOD)\n ans += x\n ans %= MOD\n print(ans)\n stdout.close()\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 28.8888888889, "diff": ["-setrecursionlimit(10**6)", "+# setrecursionlimit(10**6)", "- @lru_cache(None)", "- def dp(currsum):", "- if currsum == s:", "- return 1", "- cnt = 0", "- for d in range(3, 2001):", "- if currsum + d <= s:", "- cnt += dp(currsum + d)", "- cnt %= MOD", "- return cnt", "+ def binom_tables(n, q):", "+ fact = [1 for _ in range(n + 1)]", "+ inv = [1 for _ in range(n + 1)]", "+ for i in range(1, n + 1):", "+ fact[i] = (fact[i - 1] * i) % q", "+ inv[i] = pow(fact[i], q - 2, q)", "+ return fact, inv", "- print((dp(0)))", "+ F, I = binom_tables(s + 700, MOD)", "+", "+ def binom(n, k, q):", "+ return (F[n] * ((I[k] * I[n - k]) % q)) % q", "+", "+ ans = 0", "+ for r in range(1, 700):", "+ objects = s - 3 * r", "+ if objects + r - 1 < objects or objects < 0:", "+ break", "+ x = binom(objects + r - 1, objects, MOD)", "+ ans += x", "+ ans %= MOD", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7214400458, "measured_runtime_v1": 0.2090635548, "runtime_lift": 3.4508168897, "key": ["s988049268", "s031685542"]} +{"user_id": "u752898745", "problem_id": "p03307", "language": "python", "submission_id_v0": "s632972821", "submission_id_v1": "s560495025", "cpu_time_v0": 37, "cpu_time_v1": 17, "memory_v0": 5304, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.05, "input": "import math\n\nn=int(input())\n\nprint(((2*n)//math.gcd(2,n)))", "target": "N=int(input());print((N if N%2==0 else N*2))", "code_v0_loc": 3, "code_v1_loc": 1, "code_v0_num_chars": 66, "code_v1_num_chars": 42, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint(((2 * n) // math.gcd(2, n)))\n", "code_v1_no_empty_lines": "N = int(input())\nprint((N if N % 2 == 0 else N * 2))\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-n = int(input())", "-print(((2 * n) // math.gcd(2, n)))", "+N = int(input())", "+print((N if N % 2 == 0 else N * 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4506682441, "measured_runtime_v1": 0.3598311198, "runtime_lift": 1.2524437697, "key": ["s632972821", "s560495025"]} +{"user_id": "u347640436", "problem_id": "p03854", "language": "python", "submission_id_v0": "s259161069", "submission_id_v1": "s688102427", "cpu_time_v0": 1216, "cpu_time_v1": 697, "memory_v0": 3420, "memory_v1": 3992, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.68, "input": "import sys\n\ns = input()\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n if s == t + w:\n\n print('YES')\n\n sys.exit()\n\n if s.startswith(t + w):\n\n nts.append(t + w)\n\n if len(nts) == 0:\n\n print('NO')\n\n sys.exit()\n\n ts = nts\n", "target": "from sys import exit\n\ns = input()\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n tw = t + w\n\n if s == tw:\n\n print('YES')\n\n exit()\n\n if s.startswith(tw):\n\n nts.append(tw)\n\n if len(nts) == 0:\n\n print('NO')\n\n exit()\n\n ts = nts\n", "code_v0_loc": 16, "code_v1_loc": 17, "code_v0_num_chars": 320, "code_v1_num_chars": 329, "code_v0_no_empty_lines": "import sys\n\ns = input()\nts = [\"\"]\nwhile True:\n nts = []\n for t in ts:\n for w in [\"dreamer\", \"eraser\", \"dream\", \"erase\"]:\n if s == t + w:\n print(\"YES\")\n sys.exit()\n if s.startswith(t + w):\n nts.append(t + w)\n if len(nts) == 0:\n print(\"NO\")\n sys.exit()\n ts = nts\n", "code_v1_no_empty_lines": "from sys import exit\n\ns = input()\nts = [\"\"]\nwhile True:\n nts = []\n for t in ts:\n for w in [\"dreamer\", \"eraser\", \"dream\", \"erase\"]:\n tw = t + w\n if s == tw:\n print(\"YES\")\n exit()\n if s.startswith(tw):\n nts.append(tw)\n if len(nts) == 0:\n print(\"NO\")\n exit()\n ts = nts\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-import sys", "+from sys import exit", "-s = input()", "+s = input()", "- if s == t + w:", "+ tw = t + w", "+ if s == tw:", "- sys.exit()", "- if s.startswith(t + w):", "- nts.append(t + w)", "+ exit()", "+ if s.startswith(tw):", "+ nts.append(tw)", "- sys.exit()", "+ exit()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2929967599, "measured_runtime_v1": 0.1979754126, "runtime_lift": 1.4799653958, "key": ["s259161069", "s688102427"]} +{"user_id": "u584658281", "problem_id": "p02688", "language": "python", "submission_id_v0": "s600438109", "submission_id_v1": "s928531547", "cpu_time_v0": 27, "cpu_time_v1": 24, "memory_v0": 9216, "memory_v1": 9264, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.11, "input": "N,K=list(map(int,input().split()))\n\na = [[0]*N]*K\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(input())\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)", "target": "N,K=list(map(int,input().split()))\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(input())\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)", "code_v0_loc": 21, "code_v1_loc": 20, "code_v0_num_chars": 365, "code_v1_num_chars": 350, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\na = [[0] * N] * K\na = [[0 for n in range(N)] for k in range(K)]\nfor k in range(K):\n d = int(input())\n have_k = list(map(int, input().split()))\n for h in have_k:\n a[k][h - 1] = 1\nan = [0] * N\nfor k in range(K):\n for n in range(N):\n an[n] = an[n] + a[k][n]\nresult = 0\nfor i in an:\n if i == 0:\n result += 1\nprint(result)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\na = [[0 for n in range(N)] for k in range(K)]\nfor k in range(K):\n d = int(input())\n have_k = list(map(int, input().split()))\n for h in have_k:\n a[k][h - 1] = 1\nan = [0] * N\nfor k in range(K):\n for n in range(N):\n an[n] = an[n] + a[k][n]\nresult = 0\nfor i in an:\n if i == 0:\n result += 1\nprint(result)\n", "code_same": false, "relative_loc_diff_percent": 4.7619047619, "diff": ["-a = [[0] * N] * K"], "diff_only_import_comment": false, "measured_runtime_v0": 0.33595281, "measured_runtime_v1": 0.2656919487, "runtime_lift": 1.264444827, "key": ["s600438109", "s928531547"]} +{"user_id": "u156896646", "problem_id": "p03854", "language": "python", "submission_id_v0": "s725954700", "submission_id_v1": "s400985362", "cpu_time_v0": 76, "cpu_time_v1": 64, "memory_v0": 21348, "memory_v1": 21348, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.79, "input": "import sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = input()\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isDream #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n #print('d:', d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #; print(d, pout)\n\n if pout == len(S): \n\n isDream = True #; print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisDream = False\n\ndayDream(0)\n\nif isDream:\n\n print('YES')\n\nelse:\n\n print('NO')", "target": "import sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = input()\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isGoal #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n if isGoal:\n\n return\n\n #print('i, d:', i, d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #;print(d, pout)\n\n if pout == len(S): \n\n isGoal = True #;print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisGoal = False\n\ndayDream(0)\n\nif isGoal:\n\n print('YES')\n\nelse:\n\n print('NO')", "code_v0_loc": 28, "code_v1_loc": 30, "code_v0_num_chars": 694, "code_v1_num_chars": 735, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(1000000)\nS = input()\nT = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nlenT = [len(i) for i in T]\n\n\ndef dayDream(pin):\n global isDream # ;print('dayDream: ', pin, S[pin:])\n for i, d in enumerate(T):\n # print('d:', d)\n if S[pin : pin + lenT[i]] == d:\n pout = pin + lenT[i] # ; print(d, pout)\n if pout == len(S):\n isDream = True # ; print('YES')\n return\n else:\n dayDream(pout)\n # print('dayDream return', pin)\n return\n\n\nisDream = False\ndayDream(0)\nif isDream:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(1000000)\nS = input()\nT = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nlenT = [len(i) for i in T]\n\n\ndef dayDream(pin):\n global isGoal # ;print('dayDream: ', pin, S[pin:])\n for i, d in enumerate(T):\n if isGoal:\n return\n # print('i, d:', i, d)\n if S[pin : pin + lenT[i]] == d:\n pout = pin + lenT[i] # ;print(d, pout)\n if pout == len(S):\n isGoal = True # ;print('YES')\n return\n else:\n dayDream(pout)\n # print('dayDream return', pin)\n return\n\n\nisGoal = False\ndayDream(0)\nif isGoal:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["- global isDream # ;print('dayDream: ', pin, S[pin:])", "+ global isGoal # ;print('dayDream: ', pin, S[pin:])", "- # print('d:', d)", "+ if isGoal:", "+ return", "+ # print('i, d:', i, d)", "- pout = pin + lenT[i] # ; print(d, pout)", "+ pout = pin + lenT[i] # ;print(d, pout)", "- isDream = True # ; print('YES')", "+ isGoal = True # ;print('YES')", "-isDream = False", "+isGoal = False", "-if isDream:", "+if isGoal:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3036904747, "measured_runtime_v1": 0.2140211895, "runtime_lift": 1.4189738666, "key": ["s725954700", "s400985362"]} +{"user_id": "u163320134", "problem_id": "p03037", "language": "python", "submission_id_v0": "s012458960", "submission_id_v1": "s740832114", "cpu_time_v0": 351, "cpu_time_v1": 278, "memory_v0": 6900, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.8, "input": "n,m=list(map(int,input().split()))\n\nc=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n c[l-1]+=1\n\n c[r]-=1\n\nfor i in range(1,n+2):\n\n c[i]=c[i]+c[i-1]\n\nans=0\n\nfor i in range(n+2):\n\n if c[i]==m:\n\n ans+=1\n\nprint(ans)", "target": "n,m=list(map(int,input().split()))\n\nl,r=list(map(int,input().split()))\n\nfor i in range(m-1):\n\n tl,tr=list(map(int,input().split()))\n\n if l=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]][0]))", "target": "n=int(input())\n\nedges=[]\n\nrelations={}\n\nnodes=[0,0]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split(\" \")))\n\n edges.append([a,b])\n\n relations.setdefault(a,[]).append(b)\n\n nodes.append(0)\n\n\n\nmax_color=0\n\nfor start in range(1,n+1):\n\n targets=relations.get(start,[])\n\n color=1\n\n for target in targets:\n\n if color == nodes[start]:\n\n color+=1\n\n else:\n\n pass\n\n nodes[target]=color\n\n if color>=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]]))", "code_v0_loc": 32, "code_v1_loc": 27, "code_v0_num_chars": 684, "code_v1_num_chars": 582, "code_v0_no_empty_lines": "import copy\n\nn = int(input())\norg_set = set([i for i in range(1, 10**5)])\nedges = []\nrelations = {}\nnodes = []\nfor i in range(n - 1):\n a, b = list(map(int, input().split(\" \")))\n edges.append([a, b])\n relations.setdefault(a, []).append(b)\n nodes.append([])\nnodes.append([])\nnodes.append([])\nmax_color = 0\nfor start in range(1, n + 1):\n targets = relations.get(start, [])\n color = 1\n for target in targets:\n if color in nodes[start]:\n color += 1\n else:\n pass\n nodes[target].append(color)\n if color >= max_color:\n max_color = color\n color += 1\nprint(max_color)\nfor edge in edges:\n print((nodes[edge[1]][0]))\n", "code_v1_no_empty_lines": "n = int(input())\nedges = []\nrelations = {}\nnodes = [0, 0]\nfor i in range(n - 1):\n a, b = list(map(int, input().split(\" \")))\n edges.append([a, b])\n relations.setdefault(a, []).append(b)\n nodes.append(0)\nmax_color = 0\nfor start in range(1, n + 1):\n targets = relations.get(start, [])\n color = 1\n for target in targets:\n if color == nodes[start]:\n color += 1\n else:\n pass\n nodes[target] = color\n if color >= max_color:\n max_color = color\n color += 1\nprint(max_color)\nfor edge in edges:\n print((nodes[edge[1]]))\n", "code_same": false, "relative_loc_diff_percent": 15.625, "diff": ["-import copy", "-", "-org_set = set([i for i in range(1, 10**5)])", "-nodes = []", "+nodes = [0, 0]", "- nodes.append([])", "-nodes.append([])", "-nodes.append([])", "+ nodes.append(0)", "- if color in nodes[start]:", "+ if color == nodes[start]:", "- nodes[target].append(color)", "+ nodes[target] = color", "- print((nodes[edge[1]][0]))", "+ print((nodes[edge[1]]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2673016732, "measured_runtime_v1": 0.1941296165, "runtime_lift": 1.3769237172, "key": ["s596506481", "s115492739"]} +{"user_id": "u046158516", "problem_id": "p02691", "language": "python", "submission_id_v0": "s021965299", "submission_id_v1": "s412762136", "cpu_time_v0": 193, "cpu_time_v1": 144, "memory_v0": 32248, "memory_v1": 111628, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.39, "input": "n=int(input())\n\na=list(map(int,input().split()))\n\nk=[]\n\nans=0\n\nfor i in range(400005):\n\n k.append(0)\n\nfor i in range(n):\n\n if i-a[i]>=0:\n\n ans+=k[i-a[i]]\n\n if a[i]+i<400005:\n\n k[a[i]+i]+=1\n\nprint(ans)", "target": "n=int(input())\n\na=list(map(int,input().split()))\n\nthing={}\n\nans=0\n\nfor i in range(n):\n\n if i-a[i] in thing:\n\n ans+=thing[i-a[i]]\n\n if i+a[i] in thing:\n\n thing[i+a[i]]+=1\n\n else:\n\n thing[i+a[i]]=1\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 12, "code_v0_num_chars": 209, "code_v1_num_chars": 219, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nk = []\nans = 0\nfor i in range(400005):\n k.append(0)\nfor i in range(n):\n if i - a[i] >= 0:\n ans += k[i - a[i]]\n if a[i] + i < 400005:\n k[a[i] + i] += 1\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nthing = {}\nans = 0\nfor i in range(n):\n if i - a[i] in thing:\n ans += thing[i - a[i]]\n if i + a[i] in thing:\n thing[i + a[i]] += 1\n else:\n thing[i + a[i]] = 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-k = []", "+thing = {}", "-for i in range(400005):", "- k.append(0)", "- if i - a[i] >= 0:", "- ans += k[i - a[i]]", "- if a[i] + i < 400005:", "- k[a[i] + i] += 1", "+ if i - a[i] in thing:", "+ ans += thing[i - a[i]]", "+ if i + a[i] in thing:", "+ thing[i + a[i]] += 1", "+ else:", "+ thing[i + a[i]] = 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5354380305, "measured_runtime_v1": 0.0057934456, "runtime_lift": 92.4213443454, "key": ["s021965299", "s412762136"]} +{"user_id": "u634079249", "problem_id": "p02881", "language": "python", "submission_id_v0": "s671057519", "submission_id_v1": "s116621872", "cpu_time_v0": 992, "cpu_time_v1": 126, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.3, "input": "import sys\n\nimport os\n\nimport math\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n ret = float('inf')\n\n I = int(math.sqrt(N)) * 10\n\n for i in range(1, I):\n\n if N%i == 0:\n\n j = N//i\n\n ret = min(ret, j + i - 2)\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\nimport os\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n m = int(N ** .5)\n\n while N % m != 0:\n\n m -= 1\n\n else:\n\n print((int(N / m + m - 2)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 29, "code_v1_loc": 25, "code_v0_num_chars": 717, "code_v1_num_chars": 627, "code_v0_no_empty_lines": "import sys\nimport os\nimport math\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = ii()\n ret = float(\"inf\")\n I = int(math.sqrt(N)) * 10\n for i in range(1, I):\n if N % i == 0:\n j = N // i\n ret = min(ret, j + i - 2)\n print(ret)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\nimport os\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = ii()\n m = int(N**0.5)\n while N % m != 0:\n m -= 1\n else:\n print((int(N / m + m - 2)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 13.7931034483, "diff": ["-import math", "- ret = float(\"inf\")", "- I = int(math.sqrt(N)) * 10", "- for i in range(1, I):", "- if N % i == 0:", "- j = N // i", "- ret = min(ret, j + i - 2)", "- print(ret)", "+ m = int(N**0.5)", "+ while N % m != 0:", "+ m -= 1", "+ else:", "+ print((int(N / m + m - 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3067429993, "measured_runtime_v1": 0.2119246759, "runtime_lift": 1.4474152099, "key": ["s671057519", "s116621872"]} diff --git a/python_splits/test_verified.target_bucket_subsets/1024_2048.jsonl b/python_splits/test_verified.target_bucket_subsets/1024_2048.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..c71289d3b24d71cd3a91e9cb02064eae606dbc7e --- /dev/null +++ b/python_splits/test_verified.target_bucket_subsets/1024_2048.jsonl @@ -0,0 +1 @@ +{"user_id": "u340781749", "problem_id": "p02680", "language": "python", "submission_id_v0": "s341076610", "submission_id_v1": "s034276815", "cpu_time_v0": 2314, "cpu_time_v1": 1930, "memory_v0": 1000052, "memory_v1": 915508, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.59, "input": "import sys\n\n# from itertools import chain, accumulate\n\n\n\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\n\n\n\nver_lines = []\n\nhor_lines = []\n\nx_list = set()\n\ny_list = set()\n\nn3 = n * 3\n\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n\n y_list.add(a)\n\n y_list.add(b)\n\n x_list.add(c)\n\n ver_lines.append((a, b, c))\n\n\n\nfor d, e, f in zip(abcdef[n3 + 0::3], abcdef[n3 + 1::3], abcdef[n3 + 2::3]):\n\n y_list.add(d)\n\n x_list.add(e)\n\n x_list.add(f)\n\n hor_lines.append((d, e, f))\n\nx_list.add(0)\n\ny_list.add(0)\n\n\n\nx_list = sorted(x_list)\n\ny_list = sorted(y_list)\n\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\n\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\n\nrow_real = len(x_list)\n\ncol_real = len(y_list)\n\nrow = row_real + 2\n\ncol = col_real + 2\n\nbanned_up_ij = [[0] * row for _ in range(col)]\n\nbanned_down_ij = [[0] * row for _ in range(col)]\n\nbanned_left_ij = [[0] * col for _ in range(row)]\n\nbanned_right_ij = [[0] * col for _ in range(row)]\n\nfor a, b, c in ver_lines:\n\n if a > b:\n\n a, b = b, a\n\n ai = y_dict[a]\n\n bi = y_dict[b]\n\n j = x_dict[c]\n\n banned_left_ij[j][ai] += 1\n\n banned_left_ij[j][bi] -= 1\n\n banned_right_ij[j - 1][ai] += 1\n\n banned_right_ij[j - 1][bi] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n i = y_dict[d]\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up_ij[i][ej] += 1\n\n banned_up_ij[i][fj] -= 1\n\n banned_down_ij[i - 1][ej] += 1\n\n banned_down_ij[i - 1][fj] -= 1\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor i in range(col):\n\n ru = banned_up_ij[i]\n\n rd = banned_down_ij[i]\n\n ri = row * i\n\n banned_up[ri] = ru[0]\n\n banned_down[ri] = rd[0]\n\n for j in range(1, row):\n\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\n\nfor j in range(row):\n\n rl = banned_left_ij[j]\n\n rr = banned_right_ij[j]\n\n banned_left[j] = rl[0]\n\n banned_right[j] = rr[0]\n\n for i in range(1, col):\n\n ri0 = (i - 1) * row\n\n ri1 = i * row\n\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n", "target": "import sys\n\n\n\n# from itertools import chain, accumulate\n\n\n\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\n\n\n\nver_lines = []\n\nhor_lines = []\n\nx_list = set()\n\ny_list = set()\n\nn3 = n * 3\n\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n\n y_list.add(a)\n\n y_list.add(b)\n\n x_list.add(c)\n\n ver_lines.append((a, b, c))\n\n\n\nfor d, e, f in zip(abcdef[n3 + 0::3], abcdef[n3 + 1::3], abcdef[n3 + 2::3]):\n\n y_list.add(d)\n\n x_list.add(e)\n\n x_list.add(f)\n\n hor_lines.append((d, e, f))\n\nx_list.add(0)\n\ny_list.add(0)\n\n\n\nx_list = sorted(x_list)\n\ny_list = sorted(y_list)\n\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\n\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\n\nrow_real = len(x_list)\n\ncol_real = len(y_list)\n\nrow = row_real + 2\n\ncol = col_real + 2\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor a, b, c in ver_lines:\n\n if a > b:\n\n a, b = b, a\n\n ai = y_dict[a] * row\n\n bi = y_dict[b] * row\n\n j = x_dict[c]\n\n banned_left[ai + j] += 1\n\n banned_left[bi + j] -= 1\n\n banned_right[ai + j - 1] += 1\n\n banned_right[bi + j - 1] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n ri = y_dict[d] * row\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up[ri + ej] += 1\n\n banned_up[ri + fj] -= 1\n\n banned_down[ri - row + ej] += 1\n\n banned_down[ri - row + fj] -= 1\n\n\n\nfor i in range(1, col):\n\n ri0 = row * (i - 1)\n\n ri1 = row * i\n\n for j in range(1, row):\n\n banned_up[ri1 + j] += banned_up[ri1 + j - 1]\n\n banned_down[ri1 + j] += banned_down[ri1 + j - 1]\n\n banned_left[ri1 + j] += banned_left[ri0 + j]\n\n banned_right[ri1 + j] += banned_right[ri0 + j]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n", "code_v0_loc": 128, "code_v1_loc": 115, "code_v0_num_chars": 3630, "code_v1_num_chars": 3124, "code_v0_no_empty_lines": "import sys\n\n# from itertools import chain, accumulate\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\nver_lines = []\nhor_lines = []\nx_list = set()\ny_list = set()\nn3 = n * 3\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n y_list.add(a)\n y_list.add(b)\n x_list.add(c)\n ver_lines.append((a, b, c))\nfor d, e, f in zip(abcdef[n3 + 0 :: 3], abcdef[n3 + 1 :: 3], abcdef[n3 + 2 :: 3]):\n y_list.add(d)\n x_list.add(e)\n x_list.add(f)\n hor_lines.append((d, e, f))\nx_list.add(0)\ny_list.add(0)\nx_list = sorted(x_list)\ny_list = sorted(y_list)\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\nrow_real = len(x_list)\ncol_real = len(y_list)\nrow = row_real + 2\ncol = col_real + 2\nbanned_up_ij = [[0] * row for _ in range(col)]\nbanned_down_ij = [[0] * row for _ in range(col)]\nbanned_left_ij = [[0] * col for _ in range(row)]\nbanned_right_ij = [[0] * col for _ in range(row)]\nfor a, b, c in ver_lines:\n if a > b:\n a, b = b, a\n ai = y_dict[a]\n bi = y_dict[b]\n j = x_dict[c]\n banned_left_ij[j][ai] += 1\n banned_left_ij[j][bi] -= 1\n banned_right_ij[j - 1][ai] += 1\n banned_right_ij[j - 1][bi] -= 1\nfor d, e, f in hor_lines:\n if e > f:\n e, f = f, e\n i = y_dict[d]\n ej = x_dict[e]\n fj = x_dict[f]\n banned_up_ij[i][ej] += 1\n banned_up_ij[i][fj] -= 1\n banned_down_ij[i - 1][ej] += 1\n banned_down_ij[i - 1][fj] -= 1\nbanned_up = [0] * (row * col)\nbanned_down = [0] * (row * col)\nbanned_left = [0] * (row * col)\nbanned_right = [0] * (row * col)\nfor i in range(col):\n ru = banned_up_ij[i]\n rd = banned_down_ij[i]\n ri = row * i\n banned_up[ri] = ru[0]\n banned_down[ri] = rd[0]\n for j in range(1, row):\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\nfor j in range(row):\n rl = banned_left_ij[j]\n rr = banned_right_ij[j]\n banned_left[j] = rl[0]\n banned_right[j] = rr[0]\n for i in range(1, col):\n ri0 = (i - 1) * row\n ri1 = i * row\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n# for i in range(col):\n# print(walls[i * row:(i + 1) * row])\ns = row * y_dict[0] + x_dict[0]\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nq = [s]\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\nwhile q:\n c = q.pop()\n if enable[c] == 1:\n continue\n elif enable[c] == -1:\n print(\"INF\")\n exit()\n enable[c] = 1\n for dc, banned in moves:\n if banned[c]:\n continue\n nc = c + dc\n if enable[nc] == 1:\n continue\n q.append(nc)\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nans = 0\nfor i in range(col):\n ri = i * row\n for j in range(row):\n if enable[ri + j] != 1:\n continue\n t = y_list[i - 1]\n b = y_list[i]\n l = x_list[j - 1]\n r = x_list[j]\n ans += (b - t) * (r - l)\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\n# from itertools import chain, accumulate\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\nver_lines = []\nhor_lines = []\nx_list = set()\ny_list = set()\nn3 = n * 3\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n y_list.add(a)\n y_list.add(b)\n x_list.add(c)\n ver_lines.append((a, b, c))\nfor d, e, f in zip(abcdef[n3 + 0 :: 3], abcdef[n3 + 1 :: 3], abcdef[n3 + 2 :: 3]):\n y_list.add(d)\n x_list.add(e)\n x_list.add(f)\n hor_lines.append((d, e, f))\nx_list.add(0)\ny_list.add(0)\nx_list = sorted(x_list)\ny_list = sorted(y_list)\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\nrow_real = len(x_list)\ncol_real = len(y_list)\nrow = row_real + 2\ncol = col_real + 2\nbanned_up = [0] * (row * col)\nbanned_down = [0] * (row * col)\nbanned_left = [0] * (row * col)\nbanned_right = [0] * (row * col)\nfor a, b, c in ver_lines:\n if a > b:\n a, b = b, a\n ai = y_dict[a] * row\n bi = y_dict[b] * row\n j = x_dict[c]\n banned_left[ai + j] += 1\n banned_left[bi + j] -= 1\n banned_right[ai + j - 1] += 1\n banned_right[bi + j - 1] -= 1\nfor d, e, f in hor_lines:\n if e > f:\n e, f = f, e\n ri = y_dict[d] * row\n ej = x_dict[e]\n fj = x_dict[f]\n banned_up[ri + ej] += 1\n banned_up[ri + fj] -= 1\n banned_down[ri - row + ej] += 1\n banned_down[ri - row + fj] -= 1\nfor i in range(1, col):\n ri0 = row * (i - 1)\n ri1 = row * i\n for j in range(1, row):\n banned_up[ri1 + j] += banned_up[ri1 + j - 1]\n banned_down[ri1 + j] += banned_down[ri1 + j - 1]\n banned_left[ri1 + j] += banned_left[ri0 + j]\n banned_right[ri1 + j] += banned_right[ri0 + j]\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n# for i in range(col):\n# print(walls[i * row:(i + 1) * row])\ns = row * y_dict[0] + x_dict[0]\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nq = [s]\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\nwhile q:\n c = q.pop()\n if enable[c] == 1:\n continue\n elif enable[c] == -1:\n print(\"INF\")\n exit()\n enable[c] = 1\n for dc, banned in moves:\n if banned[c]:\n continue\n nc = c + dc\n if enable[nc] == 1:\n continue\n q.append(nc)\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nans = 0\nfor i in range(col):\n ri = i * row\n for j in range(row):\n if enable[ri + j] != 1:\n continue\n t = y_list[i - 1]\n b = y_list[i]\n l = x_list[j - 1]\n r = x_list[j]\n ans += (b - t) * (r - l)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 10.15625, "diff": ["-banned_up_ij = [[0] * row for _ in range(col)]", "-banned_down_ij = [[0] * row for _ in range(col)]", "-banned_left_ij = [[0] * col for _ in range(row)]", "-banned_right_ij = [[0] * col for _ in range(row)]", "-for a, b, c in ver_lines:", "- if a > b:", "- a, b = b, a", "- ai = y_dict[a]", "- bi = y_dict[b]", "- j = x_dict[c]", "- banned_left_ij[j][ai] += 1", "- banned_left_ij[j][bi] -= 1", "- banned_right_ij[j - 1][ai] += 1", "- banned_right_ij[j - 1][bi] -= 1", "-for d, e, f in hor_lines:", "- if e > f:", "- e, f = f, e", "- i = y_dict[d]", "- ej = x_dict[e]", "- fj = x_dict[f]", "- banned_up_ij[i][ej] += 1", "- banned_up_ij[i][fj] -= 1", "- banned_down_ij[i - 1][ej] += 1", "- banned_down_ij[i - 1][fj] -= 1", "-for i in range(col):", "- ru = banned_up_ij[i]", "- rd = banned_down_ij[i]", "- ri = row * i", "- banned_up[ri] = ru[0]", "- banned_down[ri] = rd[0]", "+for a, b, c in ver_lines:", "+ if a > b:", "+ a, b = b, a", "+ ai = y_dict[a] * row", "+ bi = y_dict[b] * row", "+ j = x_dict[c]", "+ banned_left[ai + j] += 1", "+ banned_left[bi + j] -= 1", "+ banned_right[ai + j - 1] += 1", "+ banned_right[bi + j - 1] -= 1", "+for d, e, f in hor_lines:", "+ if e > f:", "+ e, f = f, e", "+ ri = y_dict[d] * row", "+ ej = x_dict[e]", "+ fj = x_dict[f]", "+ banned_up[ri + ej] += 1", "+ banned_up[ri + fj] -= 1", "+ banned_down[ri - row + ej] += 1", "+ banned_down[ri - row + fj] -= 1", "+for i in range(1, col):", "+ ri0 = row * (i - 1)", "+ ri1 = row * i", "- banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]", "- banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]", "-for j in range(row):", "- rl = banned_left_ij[j]", "- rr = banned_right_ij[j]", "- banned_left[j] = rl[0]", "- banned_right[j] = rr[0]", "- for i in range(1, col):", "- ri0 = (i - 1) * row", "- ri1 = i * row", "- banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]", "- banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]", "+ banned_up[ri1 + j] += banned_up[ri1 + j - 1]", "+ banned_down[ri1 + j] += banned_down[ri1 + j - 1]", "+ banned_left[ri1 + j] += banned_left[ri0 + j]", "+ banned_right[ri1 + j] += banned_right[ri0 + j]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2846495706, "measured_runtime_v1": 0.092071644, "runtime_lift": 3.0916095148, "key": ["s341076610", "s034276815"]} diff --git a/python_splits/test_verified.target_bucket_subsets/128_256.jsonl b/python_splits/test_verified.target_bucket_subsets/128_256.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..3f65318d939c27de8a82a00d23e0a0ca3a0d0416 --- /dev/null +++ b/python_splits/test_verified.target_bucket_subsets/128_256.jsonl @@ -0,0 +1,130 @@ +{"user_id": "u645250356", "problem_id": "p03038", "language": "python", "submission_id_v0": "s890208193", "submission_id_v1": "s797826633", "cpu_time_v0": 490, "cpu_time_v1": 431, "memory_v0": 71452, "memory_v1": 34916, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.04, "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heapify,heappop,heappush\n\nfrom bisect import bisect_left,bisect_right\n\nimport sys,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn,m = inpl()\n\na = inpl()\n\nb = [0] * m\n\nfor i in range(m):\n\n x,y = inpl()\n\n b[i] = [x,y]\n\na.sort()\n\nb.sort(key=lambda x:x[1], reverse = True)\n\nres = sum(a)\n\ni = 0\n\nj = 0\n\nwhile True:\n\n # print(i,j)\n\n if a[i] < b[j][1]:\n\n res += b[j][1] - a[i]\n\n i += 1\n\n else:\n\n break\n\n b[j][0] -= 1\n\n if b[j][0] == 0:\n\n j += 1\n\n if i >= n or j >= m:\n\n break\n\nprint(res)\n", "target": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nfrom bisect import bisect_left,bisect_right \n\nimport sys,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn,m = inpl()\n\na = inpl()\n\na.sort()\n\nbc = [inpl() for _ in range(m)]\n\nbc.sort(key = lambda x:x[1], reverse = True)\n\nlm = sum(x[1] for x in bc)\n\nnow = 0\n\nalt = 0\n\nwhile now < n and alt < m:\n\n c,b = bc[alt]\n\n if a[now] > b:\n\n break\n\n else:\n\n a[now] = b\n\n bc[alt][0] -= 1\n\n if bc[alt][0] == 0:\n\n alt += 1\n\n now += 1\n\nprint((sum(a)))\n", "code_v0_loc": 35, "code_v1_loc": 29, "code_v0_num_chars": 880, "code_v1_num_chars": 728, "code_v0_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heapify, heappop, heappush\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, string, queue\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef inpl_str():\n return list(sys.stdin.readline().split())\n\n\ndef inpln(n):\n return list(int(sys.stdin.readline()) for i in range(n))\n\n\nn, m = inpl()\na = inpl()\nb = [0] * m\nfor i in range(m):\n x, y = inpl()\n b[i] = [x, y]\na.sort()\nb.sort(key=lambda x: x[1], reverse=True)\nres = sum(a)\ni = 0\nj = 0\nwhile True:\n # print(i,j)\n if a[i] < b[j][1]:\n res += b[j][1] - a[i]\n i += 1\n else:\n break\n b[j][0] -= 1\n if b[j][0] == 0:\n j += 1\n if i >= n or j >= m:\n break\nprint(res)\n", "code_v1_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, math, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn, m = inpl()\na = inpl()\na.sort()\nbc = [inpl() for _ in range(m)]\nbc.sort(key=lambda x: x[1], reverse=True)\nlm = sum(x[1] for x in bc)\nnow = 0\nalt = 0\nwhile now < n and alt < m:\n c, b = bc[alt]\n if a[now] > b:\n break\n else:\n a[now] = b\n bc[alt][0] -= 1\n if bc[alt][0] == 0:\n alt += 1\n now += 1\nprint((sum(a)))\n", "code_same": false, "relative_loc_diff_percent": 17.1428571429, "diff": ["-from heapq import heapify, heappop, heappush", "+from heapq import heappop, heappush, heapify", "-import sys, math, itertools, string, queue", "+import sys, math, itertools, math, pprint", "+INF = float(\"inf\")", "-def inpl_str():", "- return list(sys.stdin.readline().split())", "-", "-", "-def inpln(n):", "- return list(int(sys.stdin.readline()) for i in range(n))", "-", "-", "-b = [0] * m", "-for i in range(m):", "- x, y = inpl()", "- b[i] = [x, y]", "-b.sort(key=lambda x: x[1], reverse=True)", "-res = sum(a)", "-i = 0", "-j = 0", "-while True:", "- # print(i,j)", "- if a[i] < b[j][1]:", "- res += b[j][1] - a[i]", "- i += 1", "+bc = [inpl() for _ in range(m)]", "+bc.sort(key=lambda x: x[1], reverse=True)", "+lm = sum(x[1] for x in bc)", "+now = 0", "+alt = 0", "+while now < n and alt < m:", "+ c, b = bc[alt]", "+ if a[now] > b:", "+ break", "- break", "- b[j][0] -= 1", "- if b[j][0] == 0:", "- j += 1", "- if i >= n or j >= m:", "- break", "-print(res)", "+ a[now] = b", "+ bc[alt][0] -= 1", "+ if bc[alt][0] == 0:", "+ alt += 1", "+ now += 1", "+print((sum(a)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.310756367, "measured_runtime_v1": 0.2053928638, "runtime_lift": 1.5129852191, "key": ["s890208193", "s797826633"]} +{"user_id": "u287132915", "problem_id": "p02891", "language": "python", "submission_id_v0": "s480399361", "submission_id_v1": "s640908939", "cpu_time_v0": 182, "cpu_time_v1": 72, "memory_v0": 38256, "memory_v1": 61768, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.44, "input": "s = input()\n\nk = int(input())\n\n\n\nif len(set(s)) == 1:\n\n print(((len(s)*k)//2))\n\n exit()\n\n\n\nss = s + s\n\n\n\nshoko = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(s)):\n\n if s[i] == prev:\n\n cnt += 1\n\n else:\n\n shoko += cnt // 2\n\n cnt = 1\n\n prev = s[i]\n\nshoko += cnt // 2\n\n\n\nkosa = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(ss)):\n\n if ss[i] == prev:\n\n cnt += 1\n\n else:\n\n kosa += cnt // 2\n\n cnt = 1\n\n prev = ss[i]\n\nkosa += cnt // 2\n\nkosa -= shoko\n\n\n\nprint((shoko + (k-1)*kosa))", "target": "s = input()\n\nk = int(input())\n\nn = len(s)\n\n\n\nif len(set(s)) == 1:\n\n print((n*k//2))\n\n exit()\n\n\n\nss = s + s\n\ncnts = 0\n\nnow = s[0]\n\ntemp = 1\n\nfor i in range(1, n):\n\n if s[i] == now:\n\n temp += 1\n\n else:\n\n cnts += temp // 2\n\n temp = 1\n\n now = s[i]\n\ncnts += temp // 2\n\n\n\ncntss = 0\n\nnow = ss[0]\n\ntemp = 1\n\nfor i in range(1, 2*n):\n\n if ss[i] == now:\n\n temp += 1\n\n else:\n\n cntss += temp // 2\n\n temp = 1\n\n now = ss[i]\n\ncntss += temp // 2\n\n\n\nkousa = cntss - cnts\n\nprint((cnts + kousa*(k-1)))", "code_v0_loc": 35, "code_v1_loc": 35, "code_v0_num_chars": 527, "code_v1_num_chars": 551, "code_v0_no_empty_lines": "s = input()\nk = int(input())\nif len(set(s)) == 1:\n print(((len(s) * k) // 2))\n exit()\nss = s + s\nshoko = 0\nprev = \"\"\ncnt = 0\nfor i in range(len(s)):\n if s[i] == prev:\n cnt += 1\n else:\n shoko += cnt // 2\n cnt = 1\n prev = s[i]\nshoko += cnt // 2\nkosa = 0\nprev = \"\"\ncnt = 0\nfor i in range(len(ss)):\n if ss[i] == prev:\n cnt += 1\n else:\n kosa += cnt // 2\n cnt = 1\n prev = ss[i]\nkosa += cnt // 2\nkosa -= shoko\nprint((shoko + (k - 1) * kosa))\n", "code_v1_no_empty_lines": "s = input()\nk = int(input())\nn = len(s)\nif len(set(s)) == 1:\n print((n * k // 2))\n exit()\nss = s + s\ncnts = 0\nnow = s[0]\ntemp = 1\nfor i in range(1, n):\n if s[i] == now:\n temp += 1\n else:\n cnts += temp // 2\n temp = 1\n now = s[i]\ncnts += temp // 2\ncntss = 0\nnow = ss[0]\ntemp = 1\nfor i in range(1, 2 * n):\n if ss[i] == now:\n temp += 1\n else:\n cntss += temp // 2\n temp = 1\n now = ss[i]\ncntss += temp // 2\nkousa = cntss - cnts\nprint((cnts + kousa * (k - 1)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+n = len(s)", "- print(((len(s) * k) // 2))", "+ print((n * k // 2))", "-shoko = 0", "-prev = \"\"", "-cnt = 0", "-for i in range(len(s)):", "- if s[i] == prev:", "- cnt += 1", "+cnts = 0", "+now = s[0]", "+temp = 1", "+for i in range(1, n):", "+ if s[i] == now:", "+ temp += 1", "- shoko += cnt // 2", "- cnt = 1", "- prev = s[i]", "-shoko += cnt // 2", "-kosa = 0", "-prev = \"\"", "-cnt = 0", "-for i in range(len(ss)):", "- if ss[i] == prev:", "- cnt += 1", "+ cnts += temp // 2", "+ temp = 1", "+ now = s[i]", "+cnts += temp // 2", "+cntss = 0", "+now = ss[0]", "+temp = 1", "+for i in range(1, 2 * n):", "+ if ss[i] == now:", "+ temp += 1", "- kosa += cnt // 2", "- cnt = 1", "- prev = ss[i]", "-kosa += cnt // 2", "-kosa -= shoko", "-print((shoko + (k - 1) * kosa))", "+ cntss += temp // 2", "+ temp = 1", "+ now = ss[i]", "+cntss += temp // 2", "+kousa = cntss - cnts", "+print((cnts + kousa * (k - 1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2980948234, "measured_runtime_v1": 0.2282131991, "runtime_lift": 1.3062120179, "key": ["s480399361", "s640908939"]} +{"user_id": "u057109575", "problem_id": "p02814", "language": "python", "submission_id_v0": "s505874222", "submission_id_v1": "s539286615", "cpu_time_v0": 444, "cpu_time_v1": 182, "memory_v0": 96824, "memory_v1": 96876, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.01, "input": "from functools import reduce\n\nfrom math import gcd\n\n\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\ndef sub_by_2(n):\n\n cnt = 0\n\n while n % 2 == 0:\n\n n //= 2\n\n cnt += 1\n\n return cnt\n\n\n\nlcm_2 = [sub_by_2(n // 2) for n in A]\n\nif all(lcm_2[0] == v for v in lcm_2):\n\n num = reduce(lcm, [v // 2 for v in A])\n\n res = M // num\n\n print((res // 2 + res % 2))\n\nelse:\n\n print((0))\n", "target": "from math import gcd\n\nfrom functools import reduce\n\n\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\ndef lcm_list(numbers):\n\n return reduce(lcm, numbers, 1)\n\n\n\ndef even_count(n):\n\n res = 0\n\n while n % 2 == 0:\n\n res += 1\n\n n //= 2\n\n return res\n\n\n\n\n\nx = [v // 2 for v in A]\n\nif all(even_count(v) == even_count(x[0]) for v in x):\n\n num = lcm_list(x)\n\n print((-(-(M // num) // 2)))\n\nelse:\n\n print((0))\n\n\n", "code_v0_loc": 22, "code_v1_loc": 26, "code_v0_num_chars": 455, "code_v1_num_chars": 480, "code_v0_no_empty_lines": "from functools import reduce\nfrom math import gcd\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\ndef lcm(x, y):\n return x * y // gcd(x, y)\n\n\ndef sub_by_2(n):\n cnt = 0\n while n % 2 == 0:\n n //= 2\n cnt += 1\n return cnt\n\n\nlcm_2 = [sub_by_2(n // 2) for n in A]\nif all(lcm_2[0] == v for v in lcm_2):\n num = reduce(lcm, [v // 2 for v in A])\n res = M // num\n print((res // 2 + res % 2))\nelse:\n print((0))\n", "code_v1_no_empty_lines": "from math import gcd\nfrom functools import reduce\n\nN, M, *A = list(map(int, open(0).read().split()))\n\n\ndef lcm(x, y):\n return x * y // gcd(x, y)\n\n\ndef lcm_list(numbers):\n return reduce(lcm, numbers, 1)\n\n\ndef even_count(n):\n res = 0\n while n % 2 == 0:\n res += 1\n n //= 2\n return res\n\n\nx = [v // 2 for v in A]\nif all(even_count(v) == even_count(x[0]) for v in x):\n num = lcm_list(x)\n print((-(-(M // num) // 2)))\nelse:\n print((0))\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["+from math import gcd", "-from math import gcd", "-def sub_by_2(n):", "- cnt = 0", "- while n % 2 == 0:", "- n //= 2", "- cnt += 1", "- return cnt", "+def lcm_list(numbers):", "+ return reduce(lcm, numbers, 1)", "-lcm_2 = [sub_by_2(n // 2) for n in A]", "-if all(lcm_2[0] == v for v in lcm_2):", "- num = reduce(lcm, [v // 2 for v in A])", "- res = M // num", "- print((res // 2 + res % 2))", "+def even_count(n):", "+ res = 0", "+ while n % 2 == 0:", "+ res += 1", "+ n //= 2", "+ return res", "+", "+", "+x = [v // 2 for v in A]", "+if all(even_count(v) == even_count(x[0]) for v in x):", "+ num = lcm_list(x)", "+ print((-(-(M // num) // 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4227621694, "measured_runtime_v1": 0.2989870732, "runtime_lift": 1.4139814302, "key": ["s505874222", "s539286615"]} +{"user_id": "u075012704", "problem_id": "p03558", "language": "python", "submission_id_v0": "s239051528", "submission_id_v1": "s690298448", "cpu_time_v0": 622, "cpu_time_v1": 294, "memory_v0": 102192, "memory_v1": 35324, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.73, "input": "from collections import deque\n\nK = int(input())\n\nG = [[] for i in range(K)]\n\n\n\nfor n in range(K):\n\n G[n].append([(n + 1) % K, 1])\n\n G[n].append([(10 * n) % K, 0])\n\n\n\nque = deque([[1, 1]])\n\ndist = [float('inf')] * K\n\n\n\nwhile que:\n\n node, cost = que.pop()\n\n dist[node] = min(cost, dist[node])\n\n for e, e_cost in G[node]:\n\n if dist[e] != float('inf'):\n\n continue\n\n\n\n if e_cost == 0:\n\n que.append([e, cost + 0])\n\n\n\n if e_cost == 1:\n\n que.appendleft([e, cost + 1])\n\n\n\nprint((dist[0]))\n", "target": "from collections import deque\n\nK = int(input())\n\nG = [[] for i in range(K)]\n\nfor i in range(K):\n\n G[i].append(((10 * i) % K, 0))\n\n G[i].append(((i + 1) % K, 1))\n\n\n\ndist = [float('inf')] * K\n\ndist[1] = 1\n\nque = deque()\n\nque.append(1)\n\n\n\nwhile que:\n\n n = que.pop()\n\n for v, c in G[n]:\n\n if dist[v] > dist[n] + c:\n\n dist[v] = dist[n] + c\n\n if c == 0:\n\n que.append(v)\n\n else:\n\n que.appendleft(v)\n\n\n\nprint((dist[0]))\n", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 547, "code_v1_num_chars": 492, "code_v0_no_empty_lines": "from collections import deque\n\nK = int(input())\nG = [[] for i in range(K)]\nfor n in range(K):\n G[n].append([(n + 1) % K, 1])\n G[n].append([(10 * n) % K, 0])\nque = deque([[1, 1]])\ndist = [float(\"inf\")] * K\nwhile que:\n node, cost = que.pop()\n dist[node] = min(cost, dist[node])\n for e, e_cost in G[node]:\n if dist[e] != float(\"inf\"):\n continue\n if e_cost == 0:\n que.append([e, cost + 0])\n if e_cost == 1:\n que.appendleft([e, cost + 1])\nprint((dist[0]))\n", "code_v1_no_empty_lines": "from collections import deque\n\nK = int(input())\nG = [[] for i in range(K)]\nfor i in range(K):\n G[i].append(((10 * i) % K, 0))\n G[i].append(((i + 1) % K, 1))\ndist = [float(\"inf\")] * K\ndist[1] = 1\nque = deque()\nque.append(1)\nwhile que:\n n = que.pop()\n for v, c in G[n]:\n if dist[v] > dist[n] + c:\n dist[v] = dist[n] + c\n if c == 0:\n que.append(v)\n else:\n que.appendleft(v)\nprint((dist[0]))\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["-for n in range(K):", "- G[n].append([(n + 1) % K, 1])", "- G[n].append([(10 * n) % K, 0])", "-que = deque([[1, 1]])", "+for i in range(K):", "+ G[i].append(((10 * i) % K, 0))", "+ G[i].append(((i + 1) % K, 1))", "+dist[1] = 1", "+que = deque()", "+que.append(1)", "- node, cost = que.pop()", "- dist[node] = min(cost, dist[node])", "- for e, e_cost in G[node]:", "- if dist[e] != float(\"inf\"):", "- continue", "- if e_cost == 0:", "- que.append([e, cost + 0])", "- if e_cost == 1:", "- que.appendleft([e, cost + 1])", "+ n = que.pop()", "+ for v, c in G[n]:", "+ if dist[v] > dist[n] + c:", "+ dist[v] = dist[n] + c", "+ if c == 0:", "+ que.append(v)", "+ else:", "+ que.appendleft(v)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7363213913, "measured_runtime_v1": 0.4714232118, "runtime_lift": 1.5619116176, "key": ["s239051528", "s690298448"]} +{"user_id": "u633068244", "problem_id": "p01438", "language": "python", "submission_id_v0": "s057521298", "submission_id_v1": "s672157071", "cpu_time_v0": 350, "cpu_time_v1": 160, "memory_v0": 16636, "memory_v1": 11468, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.29, "input": "from collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n D = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n for s in range(s-6,e-6):\n\n t |= 1 << s\n\n D[man] = t\n\n\n\n dp = [defaultdict(int) for i in range(n)]\n\n dp[0][D[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp[i-1].keys()):\n\n if bit&D[i] == 0:\n\n dp[i][bit|D[i]] = max(dp[i][bit|D[i]], dp[i-1][bit]+L[i])\n\n dp[i][bit] = max(dp[i][bit],dp[i-1][bit])\n\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n\n \n\n ans = max(max(dp[i].values()) for i in range(n))\n\n print(ans)", "target": "from collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n T = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n t |= 2**(e-6)-2**(s-6)\n\n T[man] = t\n\n\n\n dp = defaultdict(int)\n\n dp[T[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp.keys()):\n\n if bit&T[i] == 0:\n\n dp[bit|T[i]] = max(dp[bit|T[i]], dp[bit]+L[i])\n\n dp[T[i]] = max(dp[T[i]], L[i])\n\n \n\n print(max(dp.values()))", "code_v0_loc": 27, "code_v1_loc": 24, "code_v0_num_chars": 821, "code_v1_num_chars": 646, "code_v0_no_empty_lines": "from collections import defaultdict\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n L = [0] * n\n D = [0] * n\n for man in range(n):\n m, l = list(map(int, input().split()))\n L[man] = l\n t = 0\n for date in range(m):\n s, e = list(map(int, input().split()))\n for s in range(s - 6, e - 6):\n t |= 1 << s\n D[man] = t\n dp = [defaultdict(int) for i in range(n)]\n dp[0][D[0]] = L[0]\n for i in range(1, n):\n for bit in list(dp[i - 1].keys()):\n if bit & D[i] == 0:\n dp[i][bit | D[i]] = max(dp[i][bit | D[i]], dp[i - 1][bit] + L[i])\n dp[i][bit] = max(dp[i][bit], dp[i - 1][bit])\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n ans = max(max(dp[i].values()) for i in range(n))\n print(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n L = [0] * n\n T = [0] * n\n for man in range(n):\n m, l = list(map(int, input().split()))\n L[man] = l\n t = 0\n for date in range(m):\n s, e = list(map(int, input().split()))\n t |= 2 ** (e - 6) - 2 ** (s - 6)\n T[man] = t\n dp = defaultdict(int)\n dp[T[0]] = L[0]\n for i in range(1, n):\n for bit in list(dp.keys()):\n if bit & T[i] == 0:\n dp[bit | T[i]] = max(dp[bit | T[i]], dp[bit] + L[i])\n dp[T[i]] = max(dp[T[i]], L[i])\n print(max(dp.values()))\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- D = [0] * n", "+ T = [0] * n", "- for s in range(s - 6, e - 6):", "- t |= 1 << s", "- D[man] = t", "- dp = [defaultdict(int) for i in range(n)]", "- dp[0][D[0]] = L[0]", "+ t |= 2 ** (e - 6) - 2 ** (s - 6)", "+ T[man] = t", "+ dp = defaultdict(int)", "+ dp[T[0]] = L[0]", "- for bit in list(dp[i - 1].keys()):", "- if bit & D[i] == 0:", "- dp[i][bit | D[i]] = max(dp[i][bit | D[i]], dp[i - 1][bit] + L[i])", "- dp[i][bit] = max(dp[i][bit], dp[i - 1][bit])", "- dp[i][D[i]] = max(dp[i][D[i]], L[i])", "- ans = max(max(dp[i].values()) for i in range(n))", "- print(ans)", "+ for bit in list(dp.keys()):", "+ if bit & T[i] == 0:", "+ dp[bit | T[i]] = max(dp[bit | T[i]], dp[bit] + L[i])", "+ dp[T[i]] = max(dp[T[i]], L[i])", "+ print(max(dp.values()))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0352676418, "measured_runtime_v1": 0.6319530358, "runtime_lift": 1.6382034472, "key": ["s057521298", "s672157071"]} +{"user_id": "u380524497", "problem_id": "p03032", "language": "python", "submission_id_v0": "s669893633", "submission_id_v1": "s465849215", "cpu_time_v0": 57, "cpu_time_v1": 34, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.35, "input": "from collections import deque\n\n\n\nn, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor t in range(k//2 + 1):\n\n hand = deque(V[:k-t])\n\n rest = deque(V[k-t:])\n\n cur_sum = sum(hand)\n\n\n\n for j in range(k-t+1):\n\n put_back = 0\n\n rev_hand = sorted(hand)\n\n\n\n for i in range(t):\n\n jewel = rev_hand[i]\n\n if jewel < 0:\n\n put_back -= jewel\n\n else:\n\n break\n\n\n\n candidate = cur_sum + put_back\n\n ans = max(candidate, ans)\n\n\n\n to_rest = hand.pop()\n\n rest.appendleft(to_rest)\n\n to_hand = rest.pop()\n\n hand.appendleft(to_hand)\n\n\n\n cur_sum += to_hand - to_rest\n\n\n\nprint(ans)", "target": "n, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\n\n\ndef get_jewelries(box, left_pop, right_pop):\n\n if left_pop + right_pop >= len(box):\n\n return box[:]\n\n\n\n left = box[:left_pop]\n\n right = box[-right_pop:] if right_pop else []\n\n\n\n return left + right\n\n\n\n\n\ncandidates = []\n\npop_max = min(k, n)\n\nfor pop_count in range(pop_max+1):\n\n residue = k - pop_count\n\n\n\n for left_pop in range(pop_count+1):\n\n right_pop = pop_count - left_pop\n\n jewelries = get_jewelries(V, left_pop, right_pop)\n\n jewelries.sort(reverse=True)\n\n\n\n for _ in range(residue):\n\n if not jewelries:\n\n break\n\n if jewelries[-1] < 0:\n\n jewelries.pop()\n\n\n\n value = sum(jewelries)\n\n candidates.append(value)\n\n\n\nprint((max(candidates)))\n", "code_v0_loc": 33, "code_v1_loc": 34, "code_v0_num_chars": 732, "code_v1_num_chars": 833, "code_v0_no_empty_lines": "from collections import deque\n\nn, k = list(map(int, input().split()))\nV = list(map(int, input().split()))\nans = 0\nfor t in range(k // 2 + 1):\n hand = deque(V[: k - t])\n rest = deque(V[k - t :])\n cur_sum = sum(hand)\n for j in range(k - t + 1):\n put_back = 0\n rev_hand = sorted(hand)\n for i in range(t):\n jewel = rev_hand[i]\n if jewel < 0:\n put_back -= jewel\n else:\n break\n candidate = cur_sum + put_back\n ans = max(candidate, ans)\n to_rest = hand.pop()\n rest.appendleft(to_rest)\n to_hand = rest.pop()\n hand.appendleft(to_hand)\n cur_sum += to_hand - to_rest\nprint(ans)\n", "code_v1_no_empty_lines": "n, k = list(map(int, input().split()))\nV = list(map(int, input().split()))\n\n\ndef get_jewelries(box, left_pop, right_pop):\n if left_pop + right_pop >= len(box):\n return box[:]\n left = box[:left_pop]\n right = box[-right_pop:] if right_pop else []\n return left + right\n\n\ncandidates = []\npop_max = min(k, n)\nfor pop_count in range(pop_max + 1):\n residue = k - pop_count\n for left_pop in range(pop_count + 1):\n right_pop = pop_count - left_pop\n jewelries = get_jewelries(V, left_pop, right_pop)\n jewelries.sort(reverse=True)\n for _ in range(residue):\n if not jewelries:\n break\n if jewelries[-1] < 0:\n jewelries.pop()\n value = sum(jewelries)\n candidates.append(value)\nprint((max(candidates)))\n", "code_same": false, "relative_loc_diff_percent": 2.9411764706, "diff": ["-from collections import deque", "-", "-ans = 0", "-for t in range(k // 2 + 1):", "- hand = deque(V[: k - t])", "- rest = deque(V[k - t :])", "- cur_sum = sum(hand)", "- for j in range(k - t + 1):", "- put_back = 0", "- rev_hand = sorted(hand)", "- for i in range(t):", "- jewel = rev_hand[i]", "- if jewel < 0:", "- put_back -= jewel", "- else:", "+", "+", "+def get_jewelries(box, left_pop, right_pop):", "+ if left_pop + right_pop >= len(box):", "+ return box[:]", "+ left = box[:left_pop]", "+ right = box[-right_pop:] if right_pop else []", "+ return left + right", "+", "+", "+candidates = []", "+pop_max = min(k, n)", "+for pop_count in range(pop_max + 1):", "+ residue = k - pop_count", "+ for left_pop in range(pop_count + 1):", "+ right_pop = pop_count - left_pop", "+ jewelries = get_jewelries(V, left_pop, right_pop)", "+ jewelries.sort(reverse=True)", "+ for _ in range(residue):", "+ if not jewelries:", "- candidate = cur_sum + put_back", "- ans = max(candidate, ans)", "- to_rest = hand.pop()", "- rest.appendleft(to_rest)", "- to_hand = rest.pop()", "- hand.appendleft(to_hand)", "- cur_sum += to_hand - to_rest", "-print(ans)", "+ if jewelries[-1] < 0:", "+ jewelries.pop()", "+ value = sum(jewelries)", "+ candidates.append(value)", "+print((max(candidates)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2830656636, "measured_runtime_v1": 0.1950679789, "runtime_lift": 1.4511129157, "key": ["s669893633", "s465849215"]} +{"user_id": "u227082700", "problem_id": "p02863", "language": "python", "submission_id_v0": "s340691380", "submission_id_v1": "s390961057", "cpu_time_v0": 541, "cpu_time_v1": 362, "memory_v0": 216520, "memory_v1": 217248, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.09, "input": "n,t=list(map(int,input().split()))\n\nab=[list(map(int,input().split()))for _ in range(n)]\n\nab.sort()\n\ndp=[(6007)*[0]for _ in range(n+1)]\n\ndp[0][0]=0\n\nans=0\n\nfor i in range(n):\n\n for j in range(6007):\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\n if j= A[j]:\n\n nokori -= A[j]\n\n A[j] = 0\n\n else:\n\n A[j] -= nokori\n\n nokori = 0\n\nafter = sum(A)\n\n\n\nprint((before - after))", "target": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\n\n\ncnt = 0\n\nfor i in range(N):\n\n if B[i] >= A[i]:\n\n cnt += A[i]\n\n B[i] -= A[i]\n\n else:\n\n cnt += B[i]\n\n B[i] = 0\n\n if B[i] == 0:\n\n continue\n\n if B[i] >= A[i+1]:\n\n cnt += A[i+1]\n\n A[i+1] = 0\n\n else:\n\n cnt += B[i]\n\n A[i+1] -= B[i]\n\n\n\nprint(cnt)", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 440, "code_v1_num_chars": 414, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nN = int(input())\nA = [int(i) for i in input().split()]\nB = [int(i) for i in input().split()]\nbefore = sum(A)\nfor i in range(N):\n nokori = B[i]\n for j in range(i, i + 2):\n if nokori >= A[j]:\n nokori -= A[j]\n A[j] = 0\n else:\n A[j] -= nokori\n nokori = 0\nafter = sum(A)\nprint((before - after))\n", "code_v1_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nB = [int(i) for i in input().split()]\ncnt = 0\nfor i in range(N):\n if B[i] >= A[i]:\n cnt += A[i]\n B[i] -= A[i]\n else:\n cnt += B[i]\n B[i] = 0\n if B[i] == 0:\n continue\n if B[i] >= A[i + 1]:\n cnt += A[i + 1]\n A[i + 1] = 0\n else:\n cnt += B[i]\n A[i + 1] -= B[i]\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-sys.setrecursionlimit(10**7)", "-before = sum(A)", "+cnt = 0", "- nokori = B[i]", "- for j in range(i, i + 2):", "- if nokori >= A[j]:", "- nokori -= A[j]", "- A[j] = 0", "- else:", "- A[j] -= nokori", "- nokori = 0", "-after = sum(A)", "-print((before - after))", "+ if B[i] >= A[i]:", "+ cnt += A[i]", "+ B[i] -= A[i]", "+ else:", "+ cnt += B[i]", "+ B[i] = 0", "+ if B[i] == 0:", "+ continue", "+ if B[i] >= A[i + 1]:", "+ cnt += A[i + 1]", "+ A[i + 1] = 0", "+ else:", "+ cnt += B[i]", "+ A[i + 1] -= B[i]", "+print(cnt)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3369382279, "measured_runtime_v1": 0.0062937415, "runtime_lift": 53.5354413986, "key": ["s872669573", "s116182226"]} +{"user_id": "u185948224", "problem_id": "p02873", "language": "python", "submission_id_v0": "s874712614", "submission_id_v1": "s975354355", "cpu_time_v0": 481, "cpu_time_v1": 429, "memory_v0": 27676, "memory_v1": 27548, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.81, "input": "S = input()\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in range(len(lst)):\n\n if lst[i] > 0:\n\n ans += list(range(1,lst[i]+1))\n\n else:\n\n ans[-1] = max(ans[-1], -lst[i])\n\n ans += list(range(-lst[i]-1,-1, -1))\n\n\n\nprint((sum(ans)))\n", "target": "S = input()\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in lst:\n\n if i > 0:\n\n ans += list(range(1,i+1))\n\n else:\n\n ans[-1] = max(ans[-1], -i)\n\n ans += list(range(-i-1,-1, -1))\n\n\n\n\n\nprint((sum(ans)))", "code_v0_loc": 19, "code_v1_loc": 20, "code_v0_num_chars": 425, "code_v1_num_chars": 394, "code_v0_no_empty_lines": "S = input()\nlst = [1 if S[0] == \"<\" else -1]\nfor i in range(1, len(S)):\n if S[i] == S[i - 1]:\n lst[-1] += 1 if S[i] == \"<\" else -1\n else:\n lst.append(-1 if S[i] == \">\" else 1)\nans = [0]\nfor i in range(len(lst)):\n if lst[i] > 0:\n ans += list(range(1, lst[i] + 1))\n else:\n ans[-1] = max(ans[-1], -lst[i])\n ans += list(range(-lst[i] - 1, -1, -1))\nprint((sum(ans)))\n", "code_v1_no_empty_lines": "S = input()\nlst = [1 if S[0] == \"<\" else -1]\nfor i in range(1, len(S)):\n if S[i] == S[i - 1]:\n lst[-1] += 1 if S[i] == \"<\" else -1\n else:\n lst.append(-1 if S[i] == \">\" else 1)\nans = [0]\nfor i in lst:\n if i > 0:\n ans += list(range(1, i + 1))\n else:\n ans[-1] = max(ans[-1], -i)\n ans += list(range(-i - 1, -1, -1))\nprint((sum(ans)))\n", "code_same": false, "relative_loc_diff_percent": 5.0, "diff": ["-for i in range(len(lst)):", "- if lst[i] > 0:", "- ans += list(range(1, lst[i] + 1))", "+for i in lst:", "+ if i > 0:", "+ ans += list(range(1, i + 1))", "- ans[-1] = max(ans[-1], -lst[i])", "- ans += list(range(-lst[i] - 1, -1, -1))", "+ ans[-1] = max(ans[-1], -i)", "+ ans += list(range(-i - 1, -1, -1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2820563465, "measured_runtime_v1": 0.2050767321, "runtime_lift": 1.3753698122, "key": ["s874712614", "s975354355"]} +{"user_id": "u231095456", "problem_id": "p03253", "language": "python", "submission_id_v0": "s968664754", "submission_id_v1": "s390670273", "cpu_time_v0": 89, "cpu_time_v1": 32, "memory_v0": 11252, "memory_v1": 9336, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 64.04, "input": "from math import floor, sqrt\n\nfrom collections import defaultdict\n\ndef factors(n):\n\n d = defaultdict(int)\n\n for i in range(2,floor(sqrt(n))+1):\n\n while n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n if n == 1:\n\n break\n\n if n != 1:\n\n d[n] += 1\n\n return d\n\ndef inv(x, mod):\n\n k = mod - 2\n\n ret = 1\n\n while k > 0:\n\n if k&1:\n\n ret = (ret*x) % mod\n\n x = (x*x) % mod\n\n k >>= 1\n\n return ret\n\nN, M = list(map(int,input().split()))\n\nmod = 10**9+7\n\ndic = factors(M)\n\nK = len(dic)\n\nSIZE = N+max(dic.values()) if list(dic.values()) else N\n\nfact = [None]*(SIZE+1)\n\nfinv = [None]*(SIZE+1)\n\nfact[0] = 1\n\nfor i in range(1,SIZE+1):\n\n fact[i] = (fact[i-1]*i) % mod\n\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\n\nfor i in range(SIZE, 0, -1):\n\n finv[i-1] = (finv[i]*i) % mod\n\ndef comb(n,k):\n\n tmp = (finv[k]*finv[n-k]) % mod\n\n return (fact[n]*tmp) % mod\n\nans = 1\n\nfor p in dic:\n\n ans = (ans*comb(dic[p]+N-1, dic[p])) % mod\n\nprint(ans)", "target": "from math import floor, sqrt\n\nfrom collections import defaultdict\n\nN,M = list(map(int,input().split()))\n\nd = defaultdict(int)\n\nfor i in range(2, floor(sqrt(M))+1):\n\n while M % i == 0:\n\n d[i] += 1\n\n M //= i\n\nif M != 1:\n\n d[M] += 1\n\ndef comb(n,k):\n\n if k == 0:\n\n return 1\n\n return comb(n-1,k-1) * n // k\n\nans = 1\n\nfor e in list(d.values()):\n\n ans *= comb(N+e-1, e)\n\nprint((ans % (10**9+7)))", "code_v0_loc": 42, "code_v1_loc": 18, "code_v0_num_chars": 1009, "code_v1_num_chars": 410, "code_v0_no_empty_lines": "from math import floor, sqrt\nfrom collections import defaultdict\n\n\ndef factors(n):\n d = defaultdict(int)\n for i in range(2, floor(sqrt(n)) + 1):\n while n % i == 0:\n n //= i\n d[i] += 1\n if n == 1:\n break\n if n != 1:\n d[n] += 1\n return d\n\n\ndef inv(x, mod):\n k = mod - 2\n ret = 1\n while k > 0:\n if k & 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n k >>= 1\n return ret\n\n\nN, M = list(map(int, input().split()))\nmod = 10**9 + 7\ndic = factors(M)\nK = len(dic)\nSIZE = N + max(dic.values()) if list(dic.values()) else N\nfact = [None] * (SIZE + 1)\nfinv = [None] * (SIZE + 1)\nfact[0] = 1\nfor i in range(1, SIZE + 1):\n fact[i] = (fact[i - 1] * i) % mod\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\nfor i in range(SIZE, 0, -1):\n finv[i - 1] = (finv[i] * i) % mod\n\n\ndef comb(n, k):\n tmp = (finv[k] * finv[n - k]) % mod\n return (fact[n] * tmp) % mod\n\n\nans = 1\nfor p in dic:\n ans = (ans * comb(dic[p] + N - 1, dic[p])) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "from math import floor, sqrt\nfrom collections import defaultdict\n\nN, M = list(map(int, input().split()))\nd = defaultdict(int)\nfor i in range(2, floor(sqrt(M)) + 1):\n while M % i == 0:\n d[i] += 1\n M //= i\nif M != 1:\n d[M] += 1\n\n\ndef comb(n, k):\n if k == 0:\n return 1\n return comb(n - 1, k - 1) * n // k\n\n\nans = 1\nfor e in list(d.values()):\n ans *= comb(N + e - 1, e)\nprint((ans % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-", "-def factors(n):", "- d = defaultdict(int)", "- for i in range(2, floor(sqrt(n)) + 1):", "- while n % i == 0:", "- n //= i", "- d[i] += 1", "- if n == 1:", "- break", "- if n != 1:", "- d[n] += 1", "- return d", "-", "-", "-def inv(x, mod):", "- k = mod - 2", "- ret = 1", "- while k > 0:", "- if k & 1:", "- ret = (ret * x) % mod", "- x = (x * x) % mod", "- k >>= 1", "- return ret", "-", "-", "-mod = 10**9 + 7", "-dic = factors(M)", "-K = len(dic)", "-SIZE = N + max(dic.values()) if list(dic.values()) else N", "-fact = [None] * (SIZE + 1)", "-finv = [None] * (SIZE + 1)", "-fact[0] = 1", "-for i in range(1, SIZE + 1):", "- fact[i] = (fact[i - 1] * i) % mod", "-finv[SIZE] = inv(fact[SIZE], mod=mod)", "-for i in range(SIZE, 0, -1):", "- finv[i - 1] = (finv[i] * i) % mod", "+d = defaultdict(int)", "+for i in range(2, floor(sqrt(M)) + 1):", "+ while M % i == 0:", "+ d[i] += 1", "+ M //= i", "+if M != 1:", "+ d[M] += 1", "- tmp = (finv[k] * finv[n - k]) % mod", "- return (fact[n] * tmp) % mod", "+ if k == 0:", "+ return 1", "+ return comb(n - 1, k - 1) * n // k", "-for p in dic:", "- ans = (ans * comb(dic[p] + N - 1, dic[p])) % mod", "-print(ans)", "+for e in list(d.values()):", "+ ans *= comb(N + e - 1, e)", "+print((ans % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3098533685, "measured_runtime_v1": 0.2185445104, "runtime_lift": 1.4178044005, "key": ["s968664754", "s390670273"]} +{"user_id": "u631277801", "problem_id": "p04020", "language": "python", "submission_id_v0": "s879592559", "submission_id_v1": "s107006666", "cpu_time_v0": 164, "cpu_time_v1": 99, "memory_v0": 19100, "memory_v1": 7072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.63, "input": "import sys\n\nstdin = sys.stdin\n\n \n\nsys.setrecursionlimit(10**8) \n\n \n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x)-1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\n\n\nn = ni()\n\na = [ni() for _ in range(n)]\n\n\n\ncnt = {i+1: ai for i, ai in enumerate(a)}\n\n\n\nprev = -100\n\ncur = 0\n\nans = 0\n\nfor key in sorted(cnt.keys()):\n\n if cnt[key] == 0:\n\n continue\n\n \n\n if prev == -100:\n\n prev = key\n\n \n\n if (key-prev) < 2:\n\n cur += cnt[key]\n\n else:\n\n cur = cnt[key]\n\n \n\n ans += cur // 2\n\n cur -= 2 * (cur//2)\n\n \n\n prev = key\n\n \n\nprint(ans)", "target": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\n\n\nans = 0\n\nplus = 0\n\na = [ni() for _ in range(n)]\n\n\n\nfor ai in a:\n\n ans += ((ai+plus) // 2)\n\n plus = (ai+plus) % 2 if ai > 0 else 0\n\n\n\nprint(ans)", "code_v0_loc": 41, "code_v1_loc": 25, "code_v0_num_chars": 874, "code_v1_num_chars": 607, "code_v0_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**8)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\na = [ni() for _ in range(n)]\ncnt = {i + 1: ai for i, ai in enumerate(a)}\nprev = -100\ncur = 0\nans = 0\nfor key in sorted(cnt.keys()):\n if cnt[key] == 0:\n continue\n if prev == -100:\n prev = key\n if (key - prev) < 2:\n cur += cnt[key]\n else:\n cur = cnt[key]\n ans += cur // 2\n cur -= 2 * (cur // 2)\n prev = key\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nans = 0\nplus = 0\na = [ni() for _ in range(n)]\nfor ai in a:\n ans += (ai + plus) // 2\n plus = (ai + plus) % 2 if ai > 0 else 0\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 39.0243902439, "diff": ["-sys.setrecursionlimit(10**8)", "+sys.setrecursionlimit(10**7)", "+ans = 0", "+plus = 0", "-cnt = {i + 1: ai for i, ai in enumerate(a)}", "-prev = -100", "-cur = 0", "-ans = 0", "-for key in sorted(cnt.keys()):", "- if cnt[key] == 0:", "- continue", "- if prev == -100:", "- prev = key", "- if (key - prev) < 2:", "- cur += cnt[key]", "- else:", "- cur = cnt[key]", "- ans += cur // 2", "- cur -= 2 * (cur // 2)", "- prev = key", "+for ai in a:", "+ ans += (ai + plus) // 2", "+ plus = (ai + plus) % 2 if ai > 0 else 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2743015865, "measured_runtime_v1": 0.1203746786, "runtime_lift": 2.278731621, "key": ["s879592559", "s107006666"]} +{"user_id": "u761529120", "problem_id": "p03164", "language": "python", "submission_id_v0": "s478711084", "submission_id_v1": "s154638745", "cpu_time_v0": 1151, "cpu_time_v1": 682, "memory_v0": 312192, "memory_v1": 334552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.75, "input": "def main():\n\n N, W = list(map(int, input().split()))\n\n w = [0] * N\n\n v = [0] * N\n\n for i in range(N):\n\n w[i], v[i] = list(map(int, input().split()))\n\n\n\n max_v = max(v)\n\n dp = [[float('inf')] * (max_v * N + 5) for _ in range(N + 5)]\n\n\n\n dp[0][0] = 0\n\n\n\n for i in range(N):\n\n for j in range(max_v * N):\n\n if j + v[i] <= max_v * N:\n\n dp[i+1][j + v[i]] = min(dp[i+1][j + v[i]], dp[i][j] + w[i])\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j]) \n\n\n\n ans = 0\n\n for j in range(max_v * N + 1):\n\n if dp[N][j] <= W:\n\n ans = j\n\n\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "def main():\n\n N, W = list(map(int, input().split()))\n\n weight = [0] * N\n\n value = [0] * N\n\n for i in range(N):\n\n weight[i], value[i] = list(map(int, input().split()))\n\n V = sum(value)\n\n dp = [[float('inf')] * (V + 5) for _ in range(N + 5)]\n\n dp[0][0] = 0\n\n for i in range(N):\n\n for v in range(V+1):\n\n if v - value[i] >= 0:\n\n dp[i+1][v] = min(dp[i][v-value[i]] + weight[i], dp[i][v])\n\n else:\n\n dp[i+1][v] = dp[i][v]\n\n ans = 0\n\n for v in range(V+1):\n\n if dp[N][v] <= W:\n\n ans = v\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 27, "code_v1_loc": 23, "code_v0_num_chars": 654, "code_v1_num_chars": 637, "code_v0_no_empty_lines": "def main():\n N, W = list(map(int, input().split()))\n w = [0] * N\n v = [0] * N\n for i in range(N):\n w[i], v[i] = list(map(int, input().split()))\n max_v = max(v)\n dp = [[float(\"inf\")] * (max_v * N + 5) for _ in range(N + 5)]\n dp[0][0] = 0\n for i in range(N):\n for j in range(max_v * N):\n if j + v[i] <= max_v * N:\n dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i])\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n ans = 0\n for j in range(max_v * N + 1):\n if dp[N][j] <= W:\n ans = j\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n N, W = list(map(int, input().split()))\n weight = [0] * N\n value = [0] * N\n for i in range(N):\n weight[i], value[i] = list(map(int, input().split()))\n V = sum(value)\n dp = [[float(\"inf\")] * (V + 5) for _ in range(N + 5)]\n dp[0][0] = 0\n for i in range(N):\n for v in range(V + 1):\n if v - value[i] >= 0:\n dp[i + 1][v] = min(dp[i][v - value[i]] + weight[i], dp[i][v])\n else:\n dp[i + 1][v] = dp[i][v]\n ans = 0\n for v in range(V + 1):\n if dp[N][v] <= W:\n ans = v\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 14.8148148148, "diff": ["- w = [0] * N", "- v = [0] * N", "+ weight = [0] * N", "+ value = [0] * N", "- w[i], v[i] = list(map(int, input().split()))", "- max_v = max(v)", "- dp = [[float(\"inf\")] * (max_v * N + 5) for _ in range(N + 5)]", "+ weight[i], value[i] = list(map(int, input().split()))", "+ V = sum(value)", "+ dp = [[float(\"inf\")] * (V + 5) for _ in range(N + 5)]", "- for j in range(max_v * N):", "- if j + v[i] <= max_v * N:", "- dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i])", "- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])", "+ for v in range(V + 1):", "+ if v - value[i] >= 0:", "+ dp[i + 1][v] = min(dp[i][v - value[i]] + weight[i], dp[i][v])", "+ else:", "+ dp[i + 1][v] = dp[i][v]", "- for j in range(max_v * N + 1):", "- if dp[N][j] <= W:", "- ans = j", "+ for v in range(V + 1):", "+ if dp[N][v] <= W:", "+ ans = v"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2676751952, "measured_runtime_v1": 0.1215952404, "runtime_lift": 2.2013624416, "key": ["s478711084", "s154638745"]} +{"user_id": "u057109575", "problem_id": "p03078", "language": "python", "submission_id_v0": "s065985582", "submission_id_v1": "s294135268", "cpu_time_v0": 153, "cpu_time_v1": 124, "memory_v0": 79232, "memory_v1": 73392, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.95, "input": "\n\nfrom heapq import heappop, heappush\n\n\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\npq = []\n\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\n\nappeared = set((0, 0, 0))\n\n\n\nfor _ in range(K):\n\n # Pop maximum value\n\n val, i, j, k = heappop(pq)\n\n print((-val))\n\n\n\n # Add next value\n\n if i + 1 < X and (i + 1, j, k) not in appeared:\n\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n\n appeared.add((i + 1, j, k))\n\n\n\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n\n appeared.add((i, j + 1, k))\n\n\n\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n\n appeared.add((i, j, k + 1))\n", "target": "\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\nres = []\n\nfor i in range(X):\n\n for j in range(Y):\n\n for k in range(Z):\n\n if (i + 1) * (j + 1) * (k + 1) <= K:\n\n res.append(A[i] + B[j] + C[k])\n\n else:\n\n break\n\n\n\nres.sort(reverse=True)\n\nfor i in range(K):\n\n print((res[i]))\n", "code_v0_loc": 33, "code_v1_loc": 22, "code_v0_num_chars": 923, "code_v1_num_chars": 509, "code_v0_no_empty_lines": "from heapq import heappop, heappush\n\nX, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort(reverse=True)\nB.sort(reverse=True)\nC.sort(reverse=True)\npq = []\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\nappeared = set((0, 0, 0))\nfor _ in range(K):\n # Pop maximum value\n val, i, j, k = heappop(pq)\n print((-val))\n # Add next value\n if i + 1 < X and (i + 1, j, k) not in appeared:\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n appeared.add((i + 1, j, k))\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n appeared.add((i, j + 1, k))\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n appeared.add((i, j, k + 1))\n", "code_v1_no_empty_lines": "X, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort(reverse=True)\nB.sort(reverse=True)\nC.sort(reverse=True)\nres = []\nfor i in range(X):\n for j in range(Y):\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) <= K:\n res.append(A[i] + B[j] + C[k])\n else:\n break\nres.sort(reverse=True)\nfor i in range(K):\n print((res[i]))\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-from heapq import heappop, heappush", "-", "-pq = []", "-heappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))", "-appeared = set((0, 0, 0))", "-for _ in range(K):", "- # Pop maximum value", "- val, i, j, k = heappop(pq)", "- print((-val))", "- # Add next value", "- if i + 1 < X and (i + 1, j, k) not in appeared:", "- heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))", "- appeared.add((i + 1, j, k))", "- if j + 1 < Y and (i, j + 1, k) not in appeared:", "- heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))", "- appeared.add((i, j + 1, k))", "- if k + 1 < Z and (i, j, k + 1) not in appeared:", "- heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))", "- appeared.add((i, j, k + 1))", "+res = []", "+for i in range(X):", "+ for j in range(Y):", "+ for k in range(Z):", "+ if (i + 1) * (j + 1) * (k + 1) <= K:", "+ res.append(A[i] + B[j] + C[k])", "+ else:", "+ break", "+res.sort(reverse=True)", "+for i in range(K):", "+ print((res[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3859105117, "measured_runtime_v1": 0.2075348065, "runtime_lift": 1.8594977789, "key": ["s065985582", "s294135268"]} +{"user_id": "u867826040", "problem_id": "p02837", "language": "python", "submission_id_v0": "s705992872", "submission_id_v1": "s870269222", "cpu_time_v0": 258, "cpu_time_v1": 223, "memory_v0": 9120, "memory_v1": 9160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.57, "input": "n = int(input())\n\nv = [[tuple(map(int, input().split()))for i in range(int(input()))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [False] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = True\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n if f[x - 1] is not bool(y):\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n", "target": "n = int(input())\n\nv = [[tuple(map(int, input().split()))for i in range(int(input()))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [0] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = 1\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n #print(f,x,y,bin(i))\n\n if (i>>(x-1))&1 != y:\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 499, "code_v1_num_chars": 520, "code_v0_no_empty_lines": "n = int(input())\nv = [\n [tuple(map(int, input().split())) for i in range(int(input()))]\n for i in range(n)\n]\nans = 0\nfor i in range(2**n):\n f = [False] * n\n xy = []\n for j in range(n):\n if (i >> j) & 1:\n f[j] = True\n xy.append(v[j])\n flag = True\n for xyi in xy:\n for x, y in xyi:\n if f[x - 1] is not bool(y):\n flag = False\n break\n if flag:\n ans = max(ans, len(xy))\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nv = [\n [tuple(map(int, input().split())) for i in range(int(input()))]\n for i in range(n)\n]\nans = 0\nfor i in range(2**n):\n f = [0] * n\n xy = []\n for j in range(n):\n if (i >> j) & 1:\n f[j] = 1\n xy.append(v[j])\n flag = True\n for xyi in xy:\n for x, y in xyi:\n # print(f,x,y,bin(i))\n if (i >> (x - 1)) & 1 != y:\n flag = False\n break\n if flag:\n ans = max(ans, len(xy))\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["- f = [False] * n", "+ f = [0] * n", "- f[j] = True", "+ f[j] = 1", "- if f[x - 1] is not bool(y):", "+ # print(f,x,y,bin(i))", "+ if (i >> (x - 1)) & 1 != y:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.289290843, "measured_runtime_v1": 0.2134317408, "runtime_lift": 1.3554255893, "key": ["s705992872", "s870269222"]} +{"user_id": "u998741086", "problem_id": "p03425", "language": "python", "submission_id_v0": "s570150327", "submission_id_v1": "s255248054", "cpu_time_v0": 227, "cpu_time_v1": 144, "memory_v0": 16268, "memory_v1": 16064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 36.56, "input": "#!/usr/bin/env python3\n\n\n\nn = int(input())\n\ns = [input() for _ in range(n)]\n\n\n\nc = [0 for _ in range(5)]\n\nt = 'MARCH'\n\n\n\nfor i in range(n):\n\n for j in range(5):\n\n if s[i][0] == t[j]:\n\n c[j] += 1\n\nans = 0 \n\nfor i in range(5):\n\n for j in range(i+1, 5): \n\n for k in range(j+1, 5): \n\n ans += c[i]*c[k]*c[j]\n\nprint(ans)\n", "target": "#!/usr/bin/env python3\n\n\n\nn = int(input())\n\ns = [input() for _ in range(n)]\n\nd = {}\n\n\n\nfor c in s:\n\n if c[0] not in d:\n\n d[c[0]] = 1 \n\n else:\n\n d[c[0]] += 1\n\n\n\ntmp = d.copy()\n\nt = ['M', 'A', 'R', 'C', 'H']\n\nfor c in tmp:\n\n if c not in t:\n\n d.pop(c)\n\n\n\nans = 0 \n\ndlist = list(d.items())\n\nfor i in range(len(dlist)):\n\n for j in range(i+1, len(dlist)):\n\n for k in range(j+1, len(dlist)):\n\n ans += dlist[i][1]*dlist[j][1]*dlist[k][1]\n\nprint(ans)\n", "code_v0_loc": 18, "code_v1_loc": 25, "code_v0_num_chars": 357, "code_v1_num_chars": 493, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nn = int(input())\ns = [input() for _ in range(n)]\nc = [0 for _ in range(5)]\nt = \"MARCH\"\nfor i in range(n):\n for j in range(5):\n if s[i][0] == t[j]:\n c[j] += 1\nans = 0\nfor i in range(5):\n for j in range(i + 1, 5):\n for k in range(j + 1, 5):\n ans += c[i] * c[k] * c[j]\nprint(ans)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nn = int(input())\ns = [input() for _ in range(n)]\nd = {}\nfor c in s:\n if c[0] not in d:\n d[c[0]] = 1\n else:\n d[c[0]] += 1\ntmp = d.copy()\nt = [\"M\", \"A\", \"R\", \"C\", \"H\"]\nfor c in tmp:\n if c not in t:\n d.pop(c)\nans = 0\ndlist = list(d.items())\nfor i in range(len(dlist)):\n for j in range(i + 1, len(dlist)):\n for k in range(j + 1, len(dlist)):\n ans += dlist[i][1] * dlist[j][1] * dlist[k][1]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 28.0, "diff": ["-c = [0 for _ in range(5)]", "-t = \"MARCH\"", "-for i in range(n):", "- for j in range(5):", "- if s[i][0] == t[j]:", "- c[j] += 1", "+d = {}", "+for c in s:", "+ if c[0] not in d:", "+ d[c[0]] = 1", "+ else:", "+ d[c[0]] += 1", "+tmp = d.copy()", "+t = [\"M\", \"A\", \"R\", \"C\", \"H\"]", "+for c in tmp:", "+ if c not in t:", "+ d.pop(c)", "-for i in range(5):", "- for j in range(i + 1, 5):", "- for k in range(j + 1, 5):", "- ans += c[i] * c[k] * c[j]", "+dlist = list(d.items())", "+for i in range(len(dlist)):", "+ for j in range(i + 1, len(dlist)):", "+ for k in range(j + 1, len(dlist)):", "+ ans += dlist[i][1] * dlist[j][1] * dlist[k][1]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3218575408, "measured_runtime_v1": 0.2488505929, "runtime_lift": 1.2933766287, "key": ["s570150327", "s255248054"]} +{"user_id": "u922449550", "problem_id": "p02792", "language": "python", "submission_id_v0": "s475401488", "submission_id_v1": "s941984259", "cpu_time_v0": 197, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.37, "input": "N = int(input())\n\n\n\ntable = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n id1 = int(s[0])\n\n id2 = int(s[-1])\n\n table[id1][id2] += 1\n\n\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += table[i][j]*table[j][i]\n\n\n\nprint(ans)", "target": "N = input()\n\nm = len(N)\n\n\n\na0 = int(N[0])\n\na1 = int(N[-1])\n\n\n\nans = 0\n\nif m == 1:\n\n ans = int(N)\n\nelse:\n\n mid = (int(N[1:]) - a1)//10\n\n t = 10**(m-2)\n\n ans = 9\n\n ans += ((a0-1)*t) * 2\n\n ans += (mid + (a1>=a0)) * 2\n\n ans += ((a0-1)*t)**2\n\n ans += ((mid*(a0-1) + min(a0-1, a1))*t) * 2\n\n ans += (mid + (a1>=a0))**2\n\n if m >= 3:\n\n ans += (t - 1) * 2\n\n ans += ((a0-1)*(t - 1)*t) * 2\n\n ans += (mid * (t - 1)) * 2\n\n ans += (a1 * (t - 1)//9) * 2\n\n ans += (t - 1)**2\n\n\n\nprint(ans)", "code_v0_loc": 16, "code_v1_loc": 26, "code_v0_num_chars": 264, "code_v1_num_chars": 496, "code_v0_no_empty_lines": "N = int(input())\ntable = [[0] * 10 for i in range(10)]\nfor i in range(1, N + 1):\n s = str(i)\n id1 = int(s[0])\n id2 = int(s[-1])\n table[id1][id2] += 1\nans = 0\nfor i in range(10):\n for j in range(10):\n ans += table[i][j] * table[j][i]\nprint(ans)\n", "code_v1_no_empty_lines": "N = input()\nm = len(N)\na0 = int(N[0])\na1 = int(N[-1])\nans = 0\nif m == 1:\n ans = int(N)\nelse:\n mid = (int(N[1:]) - a1) // 10\n t = 10 ** (m - 2)\n ans = 9\n ans += ((a0 - 1) * t) * 2\n ans += (mid + (a1 >= a0)) * 2\n ans += ((a0 - 1) * t) ** 2\n ans += ((mid * (a0 - 1) + min(a0 - 1, a1)) * t) * 2\n ans += (mid + (a1 >= a0)) ** 2\n if m >= 3:\n ans += (t - 1) * 2\n ans += ((a0 - 1) * (t - 1) * t) * 2\n ans += (mid * (t - 1)) * 2\n ans += (a1 * (t - 1) // 9) * 2\n ans += (t - 1) ** 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 38.4615384615, "diff": ["-N = int(input())", "-table = [[0] * 10 for i in range(10)]", "-for i in range(1, N + 1):", "- s = str(i)", "- id1 = int(s[0])", "- id2 = int(s[-1])", "- table[id1][id2] += 1", "+N = input()", "+m = len(N)", "+a0 = int(N[0])", "+a1 = int(N[-1])", "-for i in range(10):", "- for j in range(10):", "- ans += table[i][j] * table[j][i]", "+if m == 1:", "+ ans = int(N)", "+else:", "+ mid = (int(N[1:]) - a1) // 10", "+ t = 10 ** (m - 2)", "+ ans = 9", "+ ans += ((a0 - 1) * t) * 2", "+ ans += (mid + (a1 >= a0)) * 2", "+ ans += ((a0 - 1) * t) ** 2", "+ ans += ((mid * (a0 - 1) + min(a0 - 1, a1)) * t) * 2", "+ ans += (mid + (a1 >= a0)) ** 2", "+ if m >= 3:", "+ ans += (t - 1) * 2", "+ ans += ((a0 - 1) * (t - 1) * t) * 2", "+ ans += (mid * (t - 1)) * 2", "+ ans += (a1 * (t - 1) // 9) * 2", "+ ans += (t - 1) ** 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.589133962, "measured_runtime_v1": 0.3507217311, "runtime_lift": 1.6797760439, "key": ["s475401488", "s941984259"]} +{"user_id": "u576432509", "problem_id": "p03575", "language": "python", "submission_id_v0": "s579377069", "submission_id_v1": "s043222526", "cpu_time_v0": 33, "cpu_time_v1": 26, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.21, "input": "icase=0\n\nif icase==0:\n\n n,m=list(map(int, input().split()))\n\n a=[]\n\n b=[]\n\n for i in range(m):\n\n ai,bi=list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\nelif icase==1:\n\n n=6\n\n m=5\n\n# a=[[1],[2],[3],[4],[5]]\n\n# b=[[2],[3],[4],[5],[6]]\n\n a=[1,2,3,4,5]\n\n b=[2,3,4,5,6]\n\nelif icase==2:\n\n n=7\n\n m=7\n\n a=[1,2,3,4,4,5,6]\n\n b=[3,7,4,5,6,6,7]\n\n\n\n \n\nvtx=[]\n\nfor i in range(n):\n\n vtx.append([i+1])\n\nicnt=0\n\n\n\nfor j in range(m): \n\n vtx1=vtx.copy()\n\n a1=a.copy()\n\n b1=b.copy()\n\n del a1[j]\n\n del b1[j]\n\n \n\n for i in range(m-1):\n\n for v1 in vtx1:\n\n if a1[i] in v1:\n\n if not b1[i] in v1:\n\n for v2 in vtx1:\n\n if v1!=v2:\n\n if b1[i] in v2:\n\n break\n\n vtx1.remove(v1)\n\n vtx1.remove(v2)\n\n v3=v1+v2\n\n vtx1.append(v3)\n\n# print(a[i],b[i],len(vtx1),vtx1)\n\n# print(len(vtx1),vtx1)\n\n if len(vtx1)!=1:\n\n icnt=icnt+1\n\nprint(icnt) ", "target": "limit=50\n\ngraph=[[False]*limit for i in range(limit)]\n\nvisited=[]*limit\n\n\n\ndef dfs(v,n,graph,visited):\n\n visited[v]=True\n\n for v2 in range(n):\n\n if graph[v][v2]==False:\n\n continue\n\n if visited[v2]==True:\n\n continue\n\n dfs(v2,n,graph,visited)\n\n\n\nn,m=list(map(int,input().split()))\n\na=[0]*m\n\nb=[0]*m\n\nfor i in range(m):\n\n ai,bi=list(map(int,input().split()))\n\n a[i]=ai-1\n\n b[i]=bi-1\n\n graph[a[i]][b[i]]=True\n\n graph[b[i]][a[i]]=True\n\n \n\nans=0 \n\nfor i in range(m):\n\n graph[a[i]][b[i]]=False\n\n graph[b[i]][a[i]]=False\n\n visited=[False]*n\n\n dfs(0,n,graph,visited)\n\n bridge=False\n\n for j in range(n):\n\n if visited[j]==False:\n\n bridge=True\n\n if bridge:\n\n ans+=1\n\n graph[a[i]][b[i]]=True\n\n graph[b[i]][a[i]]=True\n\n \n\nprint(ans)", "code_v0_loc": 52, "code_v1_loc": 39, "code_v0_num_chars": 1130, "code_v1_num_chars": 828, "code_v0_no_empty_lines": "icase = 0\nif icase == 0:\n n, m = list(map(int, input().split()))\n a = []\n b = []\n for i in range(m):\n ai, bi = list(map(int, input().split()))\n a.append(ai)\n b.append(bi)\nelif icase == 1:\n n = 6\n m = 5\n # a=[[1],[2],[3],[4],[5]]\n # b=[[2],[3],[4],[5],[6]]\n a = [1, 2, 3, 4, 5]\n b = [2, 3, 4, 5, 6]\nelif icase == 2:\n n = 7\n m = 7\n a = [1, 2, 3, 4, 4, 5, 6]\n b = [3, 7, 4, 5, 6, 6, 7]\nvtx = []\nfor i in range(n):\n vtx.append([i + 1])\nicnt = 0\nfor j in range(m):\n vtx1 = vtx.copy()\n a1 = a.copy()\n b1 = b.copy()\n del a1[j]\n del b1[j]\n for i in range(m - 1):\n for v1 in vtx1:\n if a1[i] in v1:\n if not b1[i] in v1:\n for v2 in vtx1:\n if v1 != v2:\n if b1[i] in v2:\n break\n vtx1.remove(v1)\n vtx1.remove(v2)\n v3 = v1 + v2\n vtx1.append(v3)\n # print(a[i],b[i],len(vtx1),vtx1)\n # print(len(vtx1),vtx1)\n if len(vtx1) != 1:\n icnt = icnt + 1\nprint(icnt)\n", "code_v1_no_empty_lines": "limit = 50\ngraph = [[False] * limit for i in range(limit)]\nvisited = [] * limit\n\n\ndef dfs(v, n, graph, visited):\n visited[v] = True\n for v2 in range(n):\n if graph[v][v2] == False:\n continue\n if visited[v2] == True:\n continue\n dfs(v2, n, graph, visited)\n\n\nn, m = list(map(int, input().split()))\na = [0] * m\nb = [0] * m\nfor i in range(m):\n ai, bi = list(map(int, input().split()))\n a[i] = ai - 1\n b[i] = bi - 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\nans = 0\nfor i in range(m):\n graph[a[i]][b[i]] = False\n graph[b[i]][a[i]] = False\n visited = [False] * n\n dfs(0, n, graph, visited)\n bridge = False\n for j in range(n):\n if visited[j] == False:\n bridge = True\n if bridge:\n ans += 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-icase = 0", "-if icase == 0:", "- n, m = list(map(int, input().split()))", "- a = []", "- b = []", "- for i in range(m):", "- ai, bi = list(map(int, input().split()))", "- a.append(ai)", "- b.append(bi)", "-elif icase == 1:", "- n = 6", "- m = 5", "- # a=[[1],[2],[3],[4],[5]]", "- # b=[[2],[3],[4],[5],[6]]", "- a = [1, 2, 3, 4, 5]", "- b = [2, 3, 4, 5, 6]", "-elif icase == 2:", "- n = 7", "- m = 7", "- a = [1, 2, 3, 4, 4, 5, 6]", "- b = [3, 7, 4, 5, 6, 6, 7]", "-vtx = []", "-for i in range(n):", "- vtx.append([i + 1])", "-icnt = 0", "-for j in range(m):", "- vtx1 = vtx.copy()", "- a1 = a.copy()", "- b1 = b.copy()", "- del a1[j]", "- del b1[j]", "- for i in range(m - 1):", "- for v1 in vtx1:", "- if a1[i] in v1:", "- if not b1[i] in v1:", "- for v2 in vtx1:", "- if v1 != v2:", "- if b1[i] in v2:", "- break", "- vtx1.remove(v1)", "- vtx1.remove(v2)", "- v3 = v1 + v2", "- vtx1.append(v3)", "- # print(a[i],b[i],len(vtx1),vtx1)", "- # print(len(vtx1),vtx1)", "- if len(vtx1) != 1:", "- icnt = icnt + 1", "-print(icnt)", "+limit = 50", "+graph = [[False] * limit for i in range(limit)]", "+visited = [] * limit", "+", "+", "+def dfs(v, n, graph, visited):", "+ visited[v] = True", "+ for v2 in range(n):", "+ if graph[v][v2] == False:", "+ continue", "+ if visited[v2] == True:", "+ continue", "+ dfs(v2, n, graph, visited)", "+", "+", "+n, m = list(map(int, input().split()))", "+a = [0] * m", "+b = [0] * m", "+for i in range(m):", "+ ai, bi = list(map(int, input().split()))", "+ a[i] = ai - 1", "+ b[i] = bi - 1", "+ graph[a[i]][b[i]] = True", "+ graph[b[i]][a[i]] = True", "+ans = 0", "+for i in range(m):", "+ graph[a[i]][b[i]] = False", "+ graph[b[i]][a[i]] = False", "+ visited = [False] * n", "+ dfs(0, n, graph, visited)", "+ bridge = False", "+ for j in range(n):", "+ if visited[j] == False:", "+ bridge = True", "+ if bridge:", "+ ans += 1", "+ graph[a[i]][b[i]] = True", "+ graph[b[i]][a[i]] = True", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3351877429, "measured_runtime_v1": 0.2583705549, "runtime_lift": 1.2973140188, "key": ["s579377069", "s043222526"]} +{"user_id": "u310381103", "problem_id": "p03457", "language": "python", "submission_id_v0": "s861400279", "submission_id_v1": "s171825130", "cpu_time_v0": 647, "cpu_time_v1": 294, "memory_v0": 63064, "memory_v1": 27216, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.56, "input": "N=input()\n\na=[]\n\nt=True\n\nfor _ in range(int(N)):\n\n a+=[list(map(int,input().split()))]\n\nfor i in range(int(N)):\n\n if a[i][0]%2==0:\n\n if abs(a[i][1]+a[i][2])<=a[i][0] and (a[i][1]+a[i][2])%2==0:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\n else:\n\n if abs(a[i][1]+a[i][2]<=a[i][0]) and (a[i][1]+a[i][2])%2==1:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\nif t:\n\n print('Yes')", "target": "import sys\n\nn=int(input())\n\nt=[]\n\nfor i in range(n):\n\n t.append(list(map(int,input().split())))\n\nfor i,d in enumerate(t):\n\n if i>0:\n\n b=d[0]-a\n\n c=abs(d[1]+d[2]-aa)\n\n a=d[0]\n\n aa=d[1]+d[2]\n\n if i==0:\n\n if not (a >= aa and a % 2 == aa % 2):\n\n print('No')\n\n sys.exit()\n\n else:\n\n continue\n\n if not (b>=c and b%2==c%2):\n\n print('No')\n\n sys.exit()\n\nprint('Yes')", "code_v0_loc": 22, "code_v1_loc": 21, "code_v0_num_chars": 516, "code_v1_num_chars": 449, "code_v0_no_empty_lines": "N = input()\na = []\nt = True\nfor _ in range(int(N)):\n a += [list(map(int, input().split()))]\nfor i in range(int(N)):\n if a[i][0] % 2 == 0:\n if abs(a[i][1] + a[i][2]) <= a[i][0] and (a[i][1] + a[i][2]) % 2 == 0:\n continue\n else:\n print(\"No\")\n t = False\n break\n else:\n if abs(a[i][1] + a[i][2] <= a[i][0]) and (a[i][1] + a[i][2]) % 2 == 1:\n continue\n else:\n print(\"No\")\n t = False\n break\nif t:\n print(\"Yes\")\n", "code_v1_no_empty_lines": "import sys\n\nn = int(input())\nt = []\nfor i in range(n):\n t.append(list(map(int, input().split())))\nfor i, d in enumerate(t):\n if i > 0:\n b = d[0] - a\n c = abs(d[1] + d[2] - aa)\n a = d[0]\n aa = d[1] + d[2]\n if i == 0:\n if not (a >= aa and a % 2 == aa % 2):\n print(\"No\")\n sys.exit()\n else:\n continue\n if not (b >= c and b % 2 == c % 2):\n print(\"No\")\n sys.exit()\nprint(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-N = input()", "-a = []", "-t = True", "-for _ in range(int(N)):", "- a += [list(map(int, input().split()))]", "-for i in range(int(N)):", "- if a[i][0] % 2 == 0:", "- if abs(a[i][1] + a[i][2]) <= a[i][0] and (a[i][1] + a[i][2]) % 2 == 0:", "+import sys", "+", "+n = int(input())", "+t = []", "+for i in range(n):", "+ t.append(list(map(int, input().split())))", "+for i, d in enumerate(t):", "+ if i > 0:", "+ b = d[0] - a", "+ c = abs(d[1] + d[2] - aa)", "+ a = d[0]", "+ aa = d[1] + d[2]", "+ if i == 0:", "+ if not (a >= aa and a % 2 == aa % 2):", "+ print(\"No\")", "+ sys.exit()", "+ else:", "- else:", "- print(\"No\")", "- t = False", "- break", "- else:", "- if abs(a[i][1] + a[i][2] <= a[i][0]) and (a[i][1] + a[i][2]) % 2 == 1:", "- continue", "- else:", "- print(\"No\")", "- t = False", "- break", "-if t:", "- print(\"Yes\")", "+ if not (b >= c and b % 2 == c % 2):", "+ print(\"No\")", "+ sys.exit()", "+print(\"Yes\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2371032157, "measured_runtime_v1": 0.0063223619, "runtime_lift": 37.5023159605, "key": ["s861400279", "s171825130"]} +{"user_id": "u057109575", "problem_id": "p03579", "language": "python", "submission_id_v0": "s986959512", "submission_id_v1": "s945473888", "cpu_time_v0": 918, "cpu_time_v1": 684, "memory_v0": 108376, "memory_v1": 76248, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.49, "input": "import sys\n\nsys.setrecursionlimit(100000)\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(v, c):\n\n # c: color = 1 or -1\n\n node[v] = c\n\n for i in graph[v]:\n\n if node[i] == c:\n\n return False\n\n \n\n if node[i] == 0 and not dfs(i, -c):\n\n return False\n\n \n\n return True\n\n\n\nnode = [0] * N\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in node) // 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) // 2 - M))\n", "target": "from collections import deque\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(s, c):\n\n q = deque()\n\n q.append(s)\n\n visited[s] = True\n\n color[s] = c\n\n \n\n while len(q) > 0:\n\n v = q.pop()\n\n for i in graph[v]:\n\n if visited[i] and color[i] == color[v]:\n\n return False\n\n \n\n if not visited[i]:\n\n visited[i] = True\n\n color[i] = -color[v]\n\n q.append(i)\n\n \n\n return True\n\n\n\nvisited = [False] * N\n\ncolor = [0] * N\n\n\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in color) // 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) // 2 - M))\n\n \n\n ", "code_v0_loc": 28, "code_v1_loc": 38, "code_v0_num_chars": 640, "code_v1_num_chars": 858, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(100000)\nN, M = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N)]\nfor x, y in edges:\n graph[x - 1].append(y - 1)\n graph[y - 1].append(x - 1)\n\n\ndef dfs(v, c):\n # c: color = 1 or -1\n node[v] = c\n for i in graph[v]:\n if node[i] == c:\n return False\n if node[i] == 0 and not dfs(i, -c):\n return False\n return True\n\n\nnode = [0] * N\nif dfs(0, 1):\n x = sum(v + 1 for v in node) // 2\n print((x * (N - x) - M))\nelse:\n print((N * (N - 1) // 2 - M))\n", "code_v1_no_empty_lines": "from collections import deque\n\nN, M = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N)]\nfor x, y in edges:\n graph[x - 1].append(y - 1)\n graph[y - 1].append(x - 1)\n\n\ndef dfs(s, c):\n q = deque()\n q.append(s)\n visited[s] = True\n color[s] = c\n while len(q) > 0:\n v = q.pop()\n for i in graph[v]:\n if visited[i] and color[i] == color[v]:\n return False\n if not visited[i]:\n visited[i] = True\n color[i] = -color[v]\n q.append(i)\n return True\n\n\nvisited = [False] * N\ncolor = [0] * N\nif dfs(0, 1):\n x = sum(v + 1 for v in color) // 2\n print((x * (N - x) - M))\nelse:\n print((N * (N - 1) // 2 - M))\n", "code_same": false, "relative_loc_diff_percent": 26.3157894737, "diff": ["-import sys", "+from collections import deque", "-sys.setrecursionlimit(100000)", "-def dfs(v, c):", "- # c: color = 1 or -1", "- node[v] = c", "- for i in graph[v]:", "- if node[i] == c:", "- return False", "- if node[i] == 0 and not dfs(i, -c):", "- return False", "+def dfs(s, c):", "+ q = deque()", "+ q.append(s)", "+ visited[s] = True", "+ color[s] = c", "+ while len(q) > 0:", "+ v = q.pop()", "+ for i in graph[v]:", "+ if visited[i] and color[i] == color[v]:", "+ return False", "+ if not visited[i]:", "+ visited[i] = True", "+ color[i] = -color[v]", "+ q.append(i)", "-node = [0] * N", "+visited = [False] * N", "+color = [0] * N", "- x = sum(v + 1 for v in node) // 2", "+ x = sum(v + 1 for v in color) // 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2537954175, "measured_runtime_v1": 0.006062909, "runtime_lift": 41.8603372027, "key": ["s986959512", "s945473888"]} +{"user_id": "u312025627", "problem_id": "p03457", "language": "python", "submission_id_v0": "s103328073", "submission_id_v1": "s130173321", "cpu_time_v0": 250, "cpu_time_v1": 183, "memory_v0": 55644, "memory_v1": 21108, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.8, "input": "def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time, px, py = 0, 0, 0\n\n for t, x, y in TXY:\n\n move = abs(x-px) + abs(y-py)\n\n # print(move, t-time)\n\n if (t - time) % 2 != move % 2 or t - time < move:\n\n return print(\"No\")\n\n time, px, py = t, x, y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time = 0\n\n px = 0\n\n py = 0\n\n for t, x, y in TXY:\n\n move = abs(py-y) + abs(px - x)\n\n if (t-time) < move or (t - time) % 2 != move % 2:\n\n return print(\"No\")\n\n time = t\n\n px = x\n\n py = y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 17, "code_v1_loc": 20, "code_v0_num_chars": 461, "code_v1_num_chars": 460, "code_v0_no_empty_lines": "def main():\n import sys\n\n input = sys.stdin.buffer.readline\n N = int(input())\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n time, px, py = 0, 0, 0\n for t, x, y in TXY:\n move = abs(x - px) + abs(y - py)\n # print(move, t-time)\n if (t - time) % 2 != move % 2 or t - time < move:\n return print(\"No\")\n time, px, py = t, x, y\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n import sys\n\n input = sys.stdin.buffer.readline\n N = int(input())\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n time = 0\n px = 0\n py = 0\n for t, x, y in TXY:\n move = abs(py - y) + abs(px - x)\n if (t - time) < move or (t - time) % 2 != move % 2:\n return print(\"No\")\n time = t\n px = x\n py = y\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["- time, px, py = 0, 0, 0", "+ time = 0", "+ px = 0", "+ py = 0", "- move = abs(x - px) + abs(y - py)", "- # print(move, t-time)", "- if (t - time) % 2 != move % 2 or t - time < move:", "+ move = abs(py - y) + abs(px - x)", "+ if (t - time) < move or (t - time) % 2 != move % 2:", "- time, px, py = t, x, y", "+ time = t", "+ px = x", "+ py = y"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3387642326, "measured_runtime_v1": 0.1945750663, "runtime_lift": 1.7410464712, "key": ["s103328073", "s130173321"]} +{"user_id": "u408071652", "problem_id": "p03078", "language": "python", "submission_id_v0": "s229462844", "submission_id_v1": "s240353408", "cpu_time_v0": 159, "cpu_time_v1": 114, "memory_v0": 72796, "memory_v1": 80804, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.3, "input": "import sys\n\nimport heapq\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n Q = []\n\n S = set()\n\n heapq.heapify(Q)\n\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n\n for i in range(K):\n\n m, a, b, c = heapq.heappop(Q)\n\n print((-m))\n\n if (a + 1, b, c) not in S and a + 1 < X:\n\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n\n S.add((a + 1, b, c))\n\n if (a, b + 1, c) not in S and b + 1 < Y:\n\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n\n S.add((a, b + 1, c))\n\n if (a, b, c + 1) not in S and c + 1 < Z:\n\n heapq.heappush(Q, (-A[a ] - B[b] - C[c+1], a, b, c + 1))\n\n S.add((a, b, c + 1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "import sys\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n L = []\n\n\n\n for i in range(X):\n\n for j in range(min(Y, K // (i + 1) + 1)):\n\n for k in range(min(Z, K // (i + 1) // (j + 1) + 1)):\n\n L.append(A[i] + B[j] + C[k])\n\n\n\n L.sort(reverse=True)\n\n\n\n for i in range(K):\n\n print((L[i]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 39, "code_v1_loc": 33, "code_v0_num_chars": 1051, "code_v1_num_chars": 663, "code_v0_no_empty_lines": "import sys\nimport heapq\n\n# \\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n X, Y, Z, K = list(map(int, input().split()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n C = list(map(int, input().split()))\n A.sort(reverse=True)\n B.sort(reverse=True)\n C.sort(reverse=True)\n Q = []\n S = set()\n heapq.heapify(Q)\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n for i in range(K):\n m, a, b, c = heapq.heappop(Q)\n print((-m))\n if (a + 1, b, c) not in S and a + 1 < X:\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n S.add((a + 1, b, c))\n if (a, b + 1, c) not in S and b + 1 < Y:\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n S.add((a, b + 1, c))\n if (a, b, c + 1) not in S and c + 1 < Z:\n heapq.heappush(Q, (-A[a] - B[b] - C[c + 1], a, b, c + 1))\n S.add((a, b, c + 1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\n# \\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n X, Y, Z, K = list(map(int, input().split()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n C = list(map(int, input().split()))\n A.sort(reverse=True)\n B.sort(reverse=True)\n C.sort(reverse=True)\n L = []\n for i in range(X):\n for j in range(min(Y, K // (i + 1) + 1)):\n for k in range(min(Z, K // (i + 1) // (j + 1) + 1)):\n L.append(A[i] + B[j] + C[k])\n L.sort(reverse=True)\n for i in range(K):\n print((L[i]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["-import heapq", "- Q = []", "- S = set()", "- heapq.heapify(Q)", "- heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))", "+ L = []", "+ for i in range(X):", "+ for j in range(min(Y, K // (i + 1) + 1)):", "+ for k in range(min(Z, K // (i + 1) // (j + 1) + 1)):", "+ L.append(A[i] + B[j] + C[k])", "+ L.sort(reverse=True)", "- m, a, b, c = heapq.heappop(Q)", "- print((-m))", "- if (a + 1, b, c) not in S and a + 1 < X:", "- heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))", "- S.add((a + 1, b, c))", "- if (a, b + 1, c) not in S and b + 1 < Y:", "- heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))", "- S.add((a, b + 1, c))", "- if (a, b, c + 1) not in S and c + 1 < Z:", "- heapq.heappush(Q, (-A[a] - B[b] - C[c + 1], a, b, c + 1))", "- S.add((a, b, c + 1))", "+ print((L[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3053240893, "measured_runtime_v1": 0.1252524042, "runtime_lift": 2.4376704877, "key": ["s229462844", "s240353408"]} +{"user_id": "u150984829", "problem_id": "p02386", "language": "python", "submission_id_v0": "s799017760", "submission_id_v1": "s414241098", "cpu_time_v0": 150, "cpu_time_v1": 130, "memory_v0": 5608, "memory_v1": 5608, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.33, "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if(g[k:k+4]==e[1:5])*(f[0]==e[0])*(f[5]==e[5]):return 'No'\n\n return 'Yes'\n\nprint((f()))\n", "target": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if g[k:k+4]==e[1:5]:\n\n if f[0]==e[0]:\n\n if f[5]==e[5]:return 'No'\n\n return 'Yes'\n\nprint((f()))\n", "code_v0_loc": 14, "code_v1_loc": 16, "code_v0_num_chars": 424, "code_v1_num_chars": 442, "code_v0_no_empty_lines": "n = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):\n f = [d[int(k)] for k in p]\n g = f[1:5] * 2\n for k in range(4):\n if (g[k : k + 4] == e[1:5]) * (f[0] == e[0]) * (f[5] == e[5]):\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_v1_no_empty_lines": "n = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):\n f = [d[int(k)] for k in p]\n g = f[1:5] * 2\n for k in range(4):\n if g[k : k + 4] == e[1:5]:\n if f[0] == e[0]:\n if f[5] == e[5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- if (g[k : k + 4] == e[1:5]) * (f[0] == e[0]) * (f[5] == e[5]):", "- return \"No\"", "+ if g[k : k + 4] == e[1:5]:", "+ if f[0] == e[0]:", "+ if f[5] == e[5]:", "+ return \"No\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.3438470016, "measured_runtime_v1": 0.1932190149, "runtime_lift": 1.7795712385, "key": ["s799017760", "s414241098"]} +{"user_id": "u716530146", "problem_id": "p03038", "language": "python", "submission_id_v0": "s839494003", "submission_id_v1": "s928697183", "cpu_time_v0": 613, "cpu_time_v1": 410, "memory_v0": 89216, "memory_v1": 43704, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.12, "input": "import sys\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nn,m=list(map(int,input().split()))\n\na0=list(map(int,input().split()))\n\ndata=[list(map(int,input().split())) for i in range(m)]\n\nfor i in a0:\n\n\tdata.append([1,i])\n\ndata.sort(key=lambda tup:-tup[1])\n\nans=0\n\nfor num,val in data:\n\n\tif n>=num:\n\n\t\tn-=num\n\n\t\tans+=val*num\n\n\telse:\n\n\t\tans+=val*n\n\n\t\tbreak\n\nprint(ans)\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\nfrom collections import Counter\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nsys.setrecursionlimit(10**8)\n\n\n\nans=0\n\nn,m=list(map(int,input().split()))\n\nA=list(map(int,input().split()))\n\nbc=[]\n\nfor i in range(m):\n\n b,c=list(map(int,input().split()))\n\n bc.append((c,b))\n\nC=Counter(A)\n\nbc+=list(C.items())\n\nbc.sort(key=lambda tup:-tup[0])\n\n# print(bc)\n\nfor c,b in bc:\n\n if n>=b:\n\n n-=b\n\n ans+=c*b\n\n else:\n\n ans+=c*n\n\n break\n\nprint(ans)\n\n\n", "code_v0_loc": 17, "code_v1_loc": 26, "code_v0_num_chars": 357, "code_v1_num_chars": 498, "code_v0_no_empty_lines": "import sys\n\ninput = lambda: sys.stdin.readline()[:-1]\nn, m = list(map(int, input().split()))\na0 = list(map(int, input().split()))\ndata = [list(map(int, input().split())) for i in range(m)]\nfor i in a0:\n data.append([1, i])\ndata.sort(key=lambda tup: -tup[1])\nans = 0\nfor num, val in data:\n if n >= num:\n n -= num\n ans += val * num\n else:\n ans += val * n\n break\nprint(ans)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\nfrom collections import Counter\n\ninput = lambda: sys.stdin.readline()[:-1]\nsys.setrecursionlimit(10**8)\nans = 0\nn, m = list(map(int, input().split()))\nA = list(map(int, input().split()))\nbc = []\nfor i in range(m):\n b, c = list(map(int, input().split()))\n bc.append((c, b))\nC = Counter(A)\nbc += list(C.items())\nbc.sort(key=lambda tup: -tup[0])\n# print(bc)\nfor c, b in bc:\n if n >= b:\n n -= b\n ans += c * b\n else:\n ans += c * n\n break\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 34.6153846154, "diff": ["+#!/usr/bin/env python3", "+from collections import Counter", "+sys.setrecursionlimit(10**8)", "+ans = 0", "-a0 = list(map(int, input().split()))", "-data = [list(map(int, input().split())) for i in range(m)]", "-for i in a0:", "- data.append([1, i])", "-data.sort(key=lambda tup: -tup[1])", "-ans = 0", "-for num, val in data:", "- if n >= num:", "- n -= num", "- ans += val * num", "+A = list(map(int, input().split()))", "+bc = []", "+for i in range(m):", "+ b, c = list(map(int, input().split()))", "+ bc.append((c, b))", "+C = Counter(A)", "+bc += list(C.items())", "+bc.sort(key=lambda tup: -tup[0])", "+# print(bc)", "+for c, b in bc:", "+ if n >= b:", "+ n -= b", "+ ans += c * b", "- ans += val * n", "+ ans += c * n"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2703684399, "measured_runtime_v1": 0.1342513988, "runtime_lift": 2.013896632, "key": ["s839494003", "s928697183"]} +{"user_id": "u846634344", "problem_id": "p03200", "language": "python", "submission_id_v0": "s951894178", "submission_id_v1": "s605042414", "cpu_time_v0": 58, "cpu_time_v1": 51, "memory_v0": 5932, "memory_v1": 3500, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.07, "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(input())\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tA = []\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': A.append(bcnt)\n\n\t\n\n\tprint((sum(A)))\n\n\n\nif __name__ == '__main__':\n\n\tmain()", "target": "import sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(input())\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tans = 0\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': ans += bcnt\n\n\t\n\n\tprint(ans)\n\n\n\nif __name__ == '__main__':\n\n\tmain()", "code_v0_loc": 20, "code_v1_loc": 20, "code_v0_num_chars": 439, "code_v1_num_chars": 434, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\nif sys.platform in ([\"ios\", \"darwin\", \"win32\"]):\n sys.stdin = open(\"Untitled.txt\")\ninput = sys.stdin.readline\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return [int(s) for s in input().split()]\n\n\ndef main():\n S = input().rstrip()\n bcnt = 0\n A = []\n for i in range(len(S)):\n if S[i] == \"B\":\n bcnt += 1\n if S[i] == \"W\":\n A.append(bcnt)\n print((sum(A)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\nif sys.platform in ([\"ios\", \"darwin\", \"win32\"]):\n sys.stdin = open(\"Untitled.txt\")\ninput = sys.stdin.readline\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return [int(s) for s in input().split()]\n\n\ndef main():\n S = input().rstrip()\n bcnt = 0\n ans = 0\n for i in range(len(S)):\n if S[i] == \"B\":\n bcnt += 1\n if S[i] == \"W\":\n ans += bcnt\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- A = []", "+ ans = 0", "- A.append(bcnt)", "- print((sum(A)))", "+ ans += bcnt", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2057990801, "measured_runtime_v1": 0.0065612807, "runtime_lift": 31.365687324, "key": ["s951894178", "s605042414"]} +{"user_id": "u968166680", "problem_id": "p03752", "language": "python", "submission_id_v0": "s863090450", "submission_id_v1": "s059435285", "cpu_time_v0": 32, "cpu_time_v1": 24, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for bit in range(1 << N):\n\n if (not (bit & 1)) or bin(bit).count('1') != K:\n\n continue\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if bit & (1 << i):\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\nfrom itertools import combinations\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for comb in combinations(list(range(1, N)), K - 1):\n\n included = [False] * N\n\n for i in comb:\n\n included[i] = True\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if included[i]:\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 37, "code_v1_loc": 39, "code_v0_num_chars": 756, "code_v1_num_chars": 818, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef main():\n N, K, *A = list(map(int, read().split()))\n ans = INF\n for bit in range(1 << N):\n if (not (bit & 1)) or bin(bit).count(\"1\") != K:\n continue\n total = 0\n max_height = A[0]\n for i, a in enumerate(A[1:], 1):\n if a <= max_height:\n if bit & (1 << i):\n total += max_height - a + 1\n max_height += 1\n else:\n max_height = a\n if ans > total:\n ans = total\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\nfrom itertools import combinations\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef main():\n N, K, *A = list(map(int, read().split()))\n ans = INF\n for comb in combinations(list(range(1, N)), K - 1):\n included = [False] * N\n for i in comb:\n included[i] = True\n total = 0\n max_height = A[0]\n for i, a in enumerate(A[1:], 1):\n if a <= max_height:\n if included[i]:\n total += max_height - a + 1\n max_height += 1\n else:\n max_height = a\n if ans > total:\n ans = total\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 5.1282051282, "diff": ["+from itertools import combinations", "- for bit in range(1 << N):", "- if (not (bit & 1)) or bin(bit).count(\"1\") != K:", "- continue", "+ for comb in combinations(list(range(1, N)), K - 1):", "+ included = [False] * N", "+ for i in comb:", "+ included[i] = True", "- if bit & (1 << i):", "+ if included[i]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4393207397, "measured_runtime_v1": 0.2213684809, "runtime_lift": 1.9845677122, "key": ["s863090450", "s059435285"]} +{"user_id": "u680851063", "problem_id": "p03363", "language": "python", "submission_id_v0": "s954809041", "submission_id_v1": "s284059915", "cpu_time_v0": 905, "cpu_time_v1": 166, "memory_v0": 44692, "memory_v1": 44492, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.66, "input": "n = int(input())\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nfrom math import factorial\n\ndef combinations_count(n, r):\n\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += combinations_count(j,2)\n\n\n\nprint(ans)", "target": "n = int(input())\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += j * (j-1) // 2\n\n\n\nprint(ans)\n", "code_v0_loc": 25, "code_v1_loc": 21, "code_v0_num_chars": 487, "code_v1_num_chars": 356, "code_v0_no_empty_lines": "n = int(input())\nary = list(map(int, input().split()))\n# print(n,ary)\nary_2 = [ary[0]]\nfor i in range(1, n):\n ary_2.append(ary[i] + ary_2[i - 1])\nary_2 = [0] + ary_2\n# print(ary_2)\nfrom collections import Counter\n\nc = Counter(ary_2)\nv = list(c.values())\n# print(v)\nfrom math import factorial\n\n\ndef combinations_count(n, r):\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\nans = 0\nfor j in v:\n if j > 1:\n ans += combinations_count(j, 2)\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nary = list(map(int, input().split()))\n# print(n,ary)\nary_2 = [ary[0]]\nfor i in range(1, n):\n ary_2.append(ary[i] + ary_2[i - 1])\nary_2 = [0] + ary_2\n# print(ary_2)\nfrom collections import Counter\n\nc = Counter(ary_2)\nv = list(c.values())\n# print(v)\nans = 0\nfor j in v:\n if j > 1:\n ans += j * (j - 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 16.0, "diff": ["-from math import factorial", "-", "-", "-def combinations_count(n, r):", "- return factorial(n) // (factorial(n - r) * factorial(r))", "-", "-", "- ans += combinations_count(j, 2)", "+ ans += j * (j - 1) // 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2075043974, "measured_runtime_v1": 0.0060842175, "runtime_lift": 34.1053546165, "key": ["s954809041", "s284059915"]} +{"user_id": "u562935282", "problem_id": "p03253", "language": "python", "submission_id_v0": "s242343005", "submission_id_v1": "s569938093", "cpu_time_v0": 72, "cpu_time_v1": 23, "memory_v0": 11380, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 68.06, "input": "class Calc:\n\n def __init__(self, max_value, mod):\n\n \"\"\"combination(max_value, all)\"\"\"\n\n fact = [-1] * (max_value + 1)\n\n fact[0] = 1\n\n fact[1] = 1\n\n for x in range(2, max_value + 1):\n\n fact[x] = x * fact[x - 1] % mod\n\n\n\n invs = [1] * (max_value + 1)\n\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n\n for x in range(max_value - 1, 0, -1):\n\n invs[x] = invs[x + 1] * (x + 1) % mod\n\n\n\n self.fact = fact\n\n self.invs = invs\n\n self.mod = mod\n\n\n\n def combination(self, n, r):\n\n if n - r < r:\n\n return self.combination(n, n - r)\n\n if r < 0:\n\n return 0\n\n if r == 0:\n\n return 1\n\n if r == 1:\n\n return n\n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\n\n\n\ndef gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n ma = d * d\n\n while ma <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n ma += d * 4 + 4\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n cal = Calc(max_value=N + 30, mod=MOD)\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n while d * d <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n for d in range(cnt):\n\n ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD\n\n \n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 69, "code_v1_loc": 37, "code_v0_num_chars": 1490, "code_v1_num_chars": 619, "code_v0_no_empty_lines": "class Calc:\n def __init__(self, max_value, mod):\n \"\"\"combination(max_value, all)\"\"\"\n fact = [-1] * (max_value + 1)\n fact[0] = 1\n fact[1] = 1\n for x in range(2, max_value + 1):\n fact[x] = x * fact[x - 1] % mod\n invs = [1] * (max_value + 1)\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n for x in range(max_value - 1, 0, -1):\n invs[x] = invs[x + 1] * (x + 1) % mod\n self.fact = fact\n self.invs = invs\n self.mod = mod\n\n def combination(self, n, r):\n if n - r < r:\n return self.combination(n, n - r)\n if r < 0:\n return 0\n if r == 0:\n return 1\n if r == 1:\n return n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\ndef gen(n):\n x = n\n d = 2\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n d = 3\n ma = d * d\n while ma <= n:\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n ma += d * 4 + 4\n d += 2\n if x > 1:\n yield 1\n\n\ndef main():\n MOD = 10**9 + 7\n N, M = list(map(int, input().split()))\n cal = Calc(max_value=N + 30, mod=MOD)\n ans = 1\n for cnt in gen(M):\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def gen(n):\n x = n\n d = 2\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n d = 3\n while d * d <= n:\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n d += 2\n if x > 1:\n yield 1\n\n\ndef main():\n MOD = 10**9 + 7\n N, M = list(map(int, input().split()))\n ans = 1\n for cnt in gen(M):\n for d in range(cnt):\n ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 46.3768115942, "diff": ["-class Calc:", "- def __init__(self, max_value, mod):", "- \"\"\"combination(max_value, all)\"\"\"", "- fact = [-1] * (max_value + 1)", "- fact[0] = 1", "- fact[1] = 1", "- for x in range(2, max_value + 1):", "- fact[x] = x * fact[x - 1] % mod", "- invs = [1] * (max_value + 1)", "- invs[max_value] = pow(fact[max_value], mod - 2, mod)", "- for x in range(max_value - 1, 0, -1):", "- invs[x] = invs[x + 1] * (x + 1) % mod", "- self.fact = fact", "- self.invs = invs", "- self.mod = mod", "-", "- def combination(self, n, r):", "- if n - r < r:", "- return self.combination(n, n - r)", "- if r < 0:", "- return 0", "- if r == 0:", "- return 1", "- if r == 1:", "- return n", "- return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod", "-", "-", "- ma = d * d", "- while ma <= n:", "+ while d * d <= n:", "- ma += d * 4 + 4", "- cal = Calc(max_value=N + 30, mod=MOD)", "- ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD", "+ for d in range(cnt):", "+ ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5542220466, "measured_runtime_v1": 0.3755235486, "runtime_lift": 1.4758649588, "key": ["s242343005", "s569938093"]} +{"user_id": "u952708174", "problem_id": "p02983", "language": "python", "submission_id_v0": "s271837395", "submission_id_v1": "s778364451", "cpu_time_v0": 612, "cpu_time_v1": 51, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.67, "input": "def c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))", "target": "def c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n if ans == 0:\n\n return 0\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))", "code_v0_loc": 9, "code_v1_loc": 11, "code_v0_num_chars": 308, "code_v1_num_chars": 360, "code_v0_no_empty_lines": "def c_remainder_minimization_2019(L, R):\n ans = float(\"inf\")\n for i in range(L, min(R, L + 2019)):\n for j in range(i + 1, min(R + 1, L + 2020)):\n ans = min(ans, (i * j) % 2019)\n return ans\n\n\nL, R = [int(i) for i in input().split()]\nprint((c_remainder_minimization_2019(L, R)))\n", "code_v1_no_empty_lines": "def c_remainder_minimization_2019(L, R):\n ans = float(\"inf\")\n for i in range(L, min(R, L + 2019)):\n for j in range(i + 1, min(R + 1, L + 2020)):\n ans = min(ans, (i * j) % 2019)\n if ans == 0:\n return 0\n return ans\n\n\nL, R = [int(i) for i in input().split()]\nprint((c_remainder_minimization_2019(L, R)))\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["+ if ans == 0:", "+ return 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3551982943, "measured_runtime_v1": 0.2038855975, "runtime_lift": 1.7421450986, "key": ["s271837395", "s778364451"]} +{"user_id": "u227082700", "problem_id": "p03039", "language": "python", "submission_id_v0": "s481435936", "submission_id_v1": "s241948863", "cpu_time_v0": 1746, "cpu_time_v1": 149, "memory_v0": 11052, "memory_v1": 16752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.47, "input": "n,m,k=list(map(int,input().split()))\n\nmod=10**9+7\n\nf=[1]\n\nfor i in range(2*10**5+7):f+=[f[-1]*(i+1)%mod]\n\ndef comb(a,b):return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod\n\nans=0\n\nfor i in range(1,n):\n\n ans+=(i*(n-i)*m**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nfor i in range(1,m):\n\n ans+=(i*(m-i)*n**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nprint(ans)", "target": "n,m,k=list(map(int,input().split()))\n\n\n\nmod = 10**9+7\n\nf = [1]\n\nfor i in range(n*m):\n\n f += [f[-1]*(i+1) % mod]\n\ndef comb(a, b):\n\n return f[a]*pow(f[b], mod-2, mod)*pow(f[a-b], mod-2, mod) % mod\n\n\n\nans=0\n\nfor dist in range(1,n):\n\n c=n-dist\n\n p=(c*m*m)%mod\n\n ans+=p*dist\n\nfor dist in range(1,m):\n\n c=m-dist\n\n p=(c*n*n)%mod\n\n ans+=p*dist\n\nans%=mod\n\nprint((ans*comb(n*m-2,k-2)%mod))", "code_v0_loc": 13, "code_v1_loc": 20, "code_v0_num_chars": 340, "code_v1_num_chars": 379, "code_v0_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nf = [1]\nfor i in range(2 * 10**5 + 7):\n f += [f[-1] * (i + 1) % mod]\n\n\ndef comb(a, b):\n return f[a] * pow(f[b], mod - 2, mod) * pow(f[a - b], mod - 2, mod) % mod\n\n\nans = 0\nfor i in range(1, n):\n ans += (i * (n - i) * m**2) * (comb(n * m - 2, k - 2))\n ans %= mod\nfor i in range(1, m):\n ans += (i * (m - i) * n**2) * (comb(n * m - 2, k - 2))\n ans %= mod\nprint(ans)\n", "code_v1_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nf = [1]\nfor i in range(n * m):\n f += [f[-1] * (i + 1) % mod]\n\n\ndef comb(a, b):\n return f[a] * pow(f[b], mod - 2, mod) * pow(f[a - b], mod - 2, mod) % mod\n\n\nans = 0\nfor dist in range(1, n):\n c = n - dist\n p = (c * m * m) % mod\n ans += p * dist\nfor dist in range(1, m):\n c = m - dist\n p = (c * n * n) % mod\n ans += p * dist\nans %= mod\nprint((ans * comb(n * m - 2, k - 2) % mod))\n", "code_same": false, "relative_loc_diff_percent": 35.0, "diff": ["-for i in range(2 * 10**5 + 7):", "+for i in range(n * m):", "-for i in range(1, n):", "- ans += (i * (n - i) * m**2) * (comb(n * m - 2, k - 2))", "- ans %= mod", "-for i in range(1, m):", "- ans += (i * (m - i) * n**2) * (comb(n * m - 2, k - 2))", "- ans %= mod", "-print(ans)", "+for dist in range(1, n):", "+ c = n - dist", "+ p = (c * m * m) % mod", "+ ans += p * dist", "+for dist in range(1, m):", "+ c = m - dist", "+ p = (c * n * n) % mod", "+ ans += p * dist", "+ans %= mod", "+print((ans * comb(n * m - 2, k - 2) % mod))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.907170742, "measured_runtime_v1": 0.2339973826, "runtime_lift": 3.8768414063, "key": ["s481435936", "s241948863"]} +{"user_id": "u562935282", "problem_id": "p03038", "language": "python", "submission_id_v0": "s653342727", "submission_id_v1": "s579349204", "cpu_time_v0": 535, "cpu_time_v1": 476, "memory_v0": 31964, "memory_v1": 42656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.03, "input": "from heapq import heappop, heappush\n\n\n\nn, m = list(map(int, input().split()))\n\na = tuple(map(int, input().split()))\n\n\n\nhq = []\n\nfor aa in a:\n\n heappush(hq, (-aa, 1))\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(hq, (-c, b))\n\n\n\nrest = n\n\nans = 0\n\nwhile rest > 0:\n\n num, cnt = heappop(hq)\n\n\n\n num *= (-1)\n\n use = min(rest, cnt)\n\n ans += use * num\n\n rest -= use\n\n\n\nprint(ans)\n", "target": "def main():\n\n from collections import Counter\n\n from operator import itemgetter\n\n\n\n import sys\n\n input = sys.stdin.readline\n\n\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n\n\n ctr = Counter(a)\n\n for _ in range(M):\n\n b, c = list(map(int, input().split()))\n\n ctr[c] += b\n\n\n\n ans = 0\n\n rest = N\n\n for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):\n\n take = min(rest, count)\n\n ans += take * integer\n\n rest -= take\n\n if not rest:\n\n break\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n# import sys\n\n# input = sys.stdin.readline\n\n# \n\n# sys.setrecursionlimit(10 ** 7)\n\n# \n\n# (int(x)-1 for x in input().split())\n\n# rstrip()\n", "code_v0_loc": 24, "code_v1_loc": 37, "code_v0_num_chars": 414, "code_v1_num_chars": 760, "code_v0_no_empty_lines": "from heapq import heappop, heappush\n\nn, m = list(map(int, input().split()))\na = tuple(map(int, input().split()))\nhq = []\nfor aa in a:\n heappush(hq, (-aa, 1))\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n heappush(hq, (-c, b))\nrest = n\nans = 0\nwhile rest > 0:\n num, cnt = heappop(hq)\n num *= -1\n use = min(rest, cnt)\n ans += use * num\n rest -= use\nprint(ans)\n", "code_v1_no_empty_lines": "def main():\n from collections import Counter\n from operator import itemgetter\n import sys\n\n input = sys.stdin.readline\n N, M = list(map(int, input().split()))\n a = list(map(int, input().split()))\n ctr = Counter(a)\n for _ in range(M):\n b, c = list(map(int, input().split()))\n ctr[c] += b\n ans = 0\n rest = N\n for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):\n take = min(rest, count)\n ans += take * integer\n rest -= take\n if not rest:\n break\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n# import sys\n# input = sys.stdin.readline\n#\n# sys.setrecursionlimit(10 ** 7)\n#\n# (int(x)-1 for x in input().split())\n# rstrip()\n", "code_same": false, "relative_loc_diff_percent": 35.1351351351, "diff": ["-from heapq import heappop, heappush", "+def main():", "+ from collections import Counter", "+ from operator import itemgetter", "+ import sys", "-n, m = list(map(int, input().split()))", "-a = tuple(map(int, input().split()))", "-hq = []", "-for aa in a:", "- heappush(hq, (-aa, 1))", "-for _ in range(m):", "- b, c = list(map(int, input().split()))", "- heappush(hq, (-c, b))", "-rest = n", "-ans = 0", "-while rest > 0:", "- num, cnt = heappop(hq)", "- num *= -1", "- use = min(rest, cnt)", "- ans += use * num", "- rest -= use", "-print(ans)", "+ input = sys.stdin.readline", "+ N, M = list(map(int, input().split()))", "+ a = list(map(int, input().split()))", "+ ctr = Counter(a)", "+ for _ in range(M):", "+ b, c = list(map(int, input().split()))", "+ ctr[c] += b", "+ ans = 0", "+ rest = N", "+ for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):", "+ take = min(rest, count)", "+ ans += take * integer", "+ rest -= take", "+ if not rest:", "+ break", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()", "+# import sys", "+# input = sys.stdin.readline", "+#", "+# sys.setrecursionlimit(10 ** 7)", "+#", "+# (int(x)-1 for x in input().split())", "+# rstrip()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3003652287, "measured_runtime_v1": 0.218658349, "runtime_lift": 1.3736737242, "key": ["s653342727", "s579349204"]} +{"user_id": "u759934006", "problem_id": "p00174", "language": "python", "submission_id_v0": "s437122774", "submission_id_v1": "s723923476", "cpu_time_v0": 20, "cpu_time_v1": 10, "memory_v0": 4228, "memory_v1": 4232, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "while True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n a = b = 0\n\n for i, s in enumerate(line):\n\n if i != 0:\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break", "target": "while True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n if line[0] == 'A':\n\n a = -1\n\n b = 0\n\n else:\n\n a = 0\n\n b = -1\n\n for i, s in enumerate(line):\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break", "code_v0_loc": 22, "code_v1_loc": 26, "code_v0_num_chars": 515, "code_v1_num_chars": 593, "code_v0_no_empty_lines": "while True:\n try:\n for i in range(3):\n line = input().strip()\n if line == \"0\":\n raise Exception\n a = b = 0\n for i, s in enumerate(line):\n if i != 0:\n if s == \"A\":\n a += 1\n else:\n b += 1\n if a > b:\n a += 1\n else:\n b += 1\n print(a, b)\n except:\n break\n", "code_v1_no_empty_lines": "while True:\n try:\n for i in range(3):\n line = input().strip()\n if line == \"0\":\n raise Exception\n if line[0] == \"A\":\n a = -1\n b = 0\n else:\n a = 0\n b = -1\n for i, s in enumerate(line):\n if s == \"A\":\n a += 1\n else:\n b += 1\n if a > b:\n a += 1\n else:\n b += 1\n print(a, b)\n except:\n break\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["- a = b = 0", "+ if line[0] == \"A\":", "+ a = -1", "+ b = 0", "+ else:", "+ a = 0", "+ b = -1", "- if i != 0:", "- if s == \"A\":", "- a += 1", "- else:", "- b += 1", "+ if s == \"A\":", "+ a += 1", "+ else:", "+ b += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1803158569, "measured_runtime_v1": 0.0065688469, "runtime_lift": 27.4501534712, "key": ["s437122774", "s723923476"]} +{"user_id": "u135454978", "problem_id": "p03371", "language": "python", "submission_id_v0": "s681762997", "submission_id_v1": "s948041496", "cpu_time_v0": 154, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 88.96, "input": "# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z / 2), 0)\n\n y = max(Y - int(z / 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n", "target": "# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\n\"\"\"\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z / 2), 0)\n\n y = max(Y - int(z / 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n\n\"\"\"\n\n\n\nprice1 = A * X + B * Y\n\nprice2 = C * 2 * X + B * max(Y - X, 0)\n\nprice3 = A * max(X - Y, 0) + C * 2 * Y\n\nprint((min(price1, price2, price3)))\n\n\n", "code_v0_loc": 14, "code_v1_loc": 22, "code_v0_num_chars": 332, "code_v1_num_chars": 486, "code_v0_no_empty_lines": "# AtCoder Beginner Contest 095 C - Half and Half\nimport sys\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\nans = A * X + B * Y\nfor z in range(2, 2 * 10**5 + 1, 2):\n x = max(X - int(z / 2), 0)\n y = max(Y - int(z / 2), 0)\n price = A * x + B * y + C * z\n ans = min(price, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "# AtCoder Beginner Contest 095 C - Half and Half\nimport sys\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\"\"\"\nans = A * X + B * Y\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n x = max(X - int(z / 2), 0)\n y = max(Y - int(z / 2), 0)\n price = A * x + B * y + C * z\n ans = min(price, ans)\nprint(ans)\n\"\"\"\nprice1 = A * X + B * Y\nprice2 = C * 2 * X + B * max(Y - X, 0)\nprice3 = A * max(X - Y, 0) + C * 2 * Y\nprint((min(price1, price2, price3)))\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["+\"\"\"", "-for z in range(2, 2 * 10**5 + 1, 2):", "+for z in range(2, 2 * 10 ** 5 + 1, 2):", "+\"\"\"", "+price1 = A * X + B * Y", "+price2 = C * 2 * X + B * max(Y - X, 0)", "+price3 = A * max(X - Y, 0) + C * 2 * Y", "+print((min(price1, price2, price3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.7125969741, "measured_runtime_v1": 0.2827094927, "runtime_lift": 6.0577979106, "key": ["s681762997", "s948041496"]} +{"user_id": "u503228842", "problem_id": "p02555", "language": "python", "submission_id_v0": "s264986040", "submission_id_v1": "s936814116", "cpu_time_v0": 455, "cpu_time_v1": 29, "memory_v0": 9180, "memory_v1": 9188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 93.63, "input": "n = int(input())\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n for j in range(i - 2):\n\n ans[i] += ans[j]\n\n ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n", "target": "n = int(input())\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n ans[i] = ans[i - 1] + ans[i - 3]\n\n ans[i] %= m\n\n # for j in range(i - 2):\n\n # ans[i] += ans[j]\n\n # ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n", "code_v0_loc": 14, "code_v1_loc": 16, "code_v0_num_chars": 263, "code_v1_num_chars": 324, "code_v0_no_empty_lines": "n = int(input())\nm = 10**9 + 7\n# ans = [0] * (n + 1)\nans = [0] * 2200\nans[0] = 1\n# ans[3] = 1\n# ans[4] = 1\n# ans[5] = 1\nfor i in range(3, n + 1):\n for j in range(i - 2):\n ans[i] += ans[j]\n ans[i] %= m\nprint((ans[n]))\n# print(ans[:10])\n", "code_v1_no_empty_lines": "n = int(input())\nm = 10**9 + 7\n# ans = [0] * (n + 1)\nans = [0] * 2200\nans[0] = 1\n# ans[3] = 1\n# ans[4] = 1\n# ans[5] = 1\nfor i in range(3, n + 1):\n ans[i] = ans[i - 1] + ans[i - 3]\n ans[i] %= m\n # for j in range(i - 2):\n # ans[i] += ans[j]\n # ans[i] %= m\nprint((ans[n]))\n# print(ans[:10])\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- for j in range(i - 2):", "- ans[i] += ans[j]", "- ans[i] %= m", "+ ans[i] = ans[i - 1] + ans[i - 3]", "+ ans[i] %= m", "+ # for j in range(i - 2):", "+ # ans[i] += ans[j]", "+ # ans[i] %= m"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6218082716, "measured_runtime_v1": 0.188438025, "runtime_lift": 3.2998025299, "key": ["s264986040", "s936814116"]} +{"user_id": "u057109575", "problem_id": "p02851", "language": "python", "submission_id_v0": "s203769987", "submission_id_v1": "s522861811", "cpu_time_v0": 293, "cpu_time_v1": 166, "memory_v0": 103224, "memory_v1": 144972, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.34, "input": "from collections import defaultdict\n\n\n\nN, K, *A = list(map(int, open(0).read().split()))\n\n\n\nS = [0] * (N + 1)\n\nfor i in range(N):\n\n S[i + 1] = S[i] + A[i]\n\n\n\nd = defaultdict(int)\n\nans = 0\n\nfor j in range(N + 1):\n\n v = (S[j] - j) % K\n\n ans += d[v]\n\n d[v] += 1\n\n if j >= K - 1:\n\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\n\n \n\nprint(ans)\n", "target": "from collections import defaultdict\n\n\n\nN, K, *A = list(map(int, open(0).read().split()))\n\n\n\nx = [0] * (N + 1)\n\nfor i in range(N):\n\n x[i + 1] = x[i] + A[i]\n\n \n\ny = [(x[i] - i) % K for i in range(N + 1)]\n\n\n\nctr = defaultdict(int)\n\nans = 0\n\nfor j in range(N + 1):\n\n ans += ctr[y[j]]\n\n ctr[y[j]] += 1\n\n if j - K + 1 >= 0:\n\n ctr[y[j - K + 1]] -= 1\n\nprint(ans)\n", "code_v0_loc": 18, "code_v1_loc": 18, "code_v0_num_chars": 357, "code_v1_num_chars": 371, "code_v0_no_empty_lines": "from collections import defaultdict\n\nN, K, *A = list(map(int, open(0).read().split()))\nS = [0] * (N + 1)\nfor i in range(N):\n S[i + 1] = S[i] + A[i]\nd = defaultdict(int)\nans = 0\nfor j in range(N + 1):\n v = (S[j] - j) % K\n ans += d[v]\n d[v] += 1\n if j >= K - 1:\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nN, K, *A = list(map(int, open(0).read().split()))\nx = [0] * (N + 1)\nfor i in range(N):\n x[i + 1] = x[i] + A[i]\ny = [(x[i] - i) % K for i in range(N + 1)]\nctr = defaultdict(int)\nans = 0\nfor j in range(N + 1):\n ans += ctr[y[j]]\n ctr[y[j]] += 1\n if j - K + 1 >= 0:\n ctr[y[j - K + 1]] -= 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-S = [0] * (N + 1)", "+x = [0] * (N + 1)", "- S[i + 1] = S[i] + A[i]", "-d = defaultdict(int)", "+ x[i + 1] = x[i] + A[i]", "+y = [(x[i] - i) % K for i in range(N + 1)]", "+ctr = defaultdict(int)", "- v = (S[j] - j) % K", "- ans += d[v]", "- d[v] += 1", "- if j >= K - 1:", "- d[(S[j - K + 1] - (j - K + 1)) % K] -= 1", "+ ans += ctr[y[j]]", "+ ctr[y[j]] += 1", "+ if j - K + 1 >= 0:", "+ ctr[y[j - K + 1]] -= 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2436300242, "measured_runtime_v1": 0.1409657106, "runtime_lift": 1.7282928102, "key": ["s203769987", "s522861811"]} +{"user_id": "u207097826", "problem_id": "p02792", "language": "python", "submission_id_v0": "s736173164", "submission_id_v1": "s628306332", "cpu_time_v0": 499, "cpu_time_v1": 86, "memory_v0": 3064, "memory_v1": 68180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.77, "input": "import itertools\n\nN = int(input())\n\nNketa = len(str(N))\n\n\n\nrange_count = [[0 for j in range(10)]for i in range(10)]\n\n\n\n\n\nfor p in range(1,N+1):\n\n mae = int(str(p)[0])\n\n ato = int(str(p)[-1])\n\n range_count[mae][ato] += 1\n\n\n\n \n\n\n\ncount = 0\n\nfor j in range(1,N+1):\n\n a_mae = int(str(j)[0])\n\n a_ato = int(str(j)[-1])\n\n \n\n b_mae = a_ato\n\n b_ato = a_mae\n\n \n\n if b_mae == 0:\n\n continue\n\n else:\n\n count += range_count[b_mae][b_ato]\n\nprint(count)\n\n ", "target": "n = int(input())\n\n\n\nall_count = 0\n\noptions = [str(i) for i in range(10)]\n\n\n\nmaeato = [[0 for i in range(10)] for j in range(10)]\n\n\n\nfor i in range(n+1):\n\n checking = str(i)\n\n maeato[int(checking[0])][int(checking[-1])]+=1\n\nall_count = 0\n\nfor i in range(1,10):\n\n for j in range(1,10):\n\n for k in range(1,10):\n\n for p in range(1,10):\n\n if i == p and j == k:\n\n all_count+=maeato[i][j]*maeato[k][p]\n\nprint(all_count)", "code_v0_loc": 28, "code_v1_loc": 18, "code_v0_num_chars": 491, "code_v1_num_chars": 473, "code_v0_no_empty_lines": "import itertools\n\nN = int(input())\nNketa = len(str(N))\nrange_count = [[0 for j in range(10)] for i in range(10)]\nfor p in range(1, N + 1):\n mae = int(str(p)[0])\n ato = int(str(p)[-1])\n range_count[mae][ato] += 1\ncount = 0\nfor j in range(1, N + 1):\n a_mae = int(str(j)[0])\n a_ato = int(str(j)[-1])\n b_mae = a_ato\n b_ato = a_mae\n if b_mae == 0:\n continue\n else:\n count += range_count[b_mae][b_ato]\nprint(count)\n", "code_v1_no_empty_lines": "n = int(input())\nall_count = 0\noptions = [str(i) for i in range(10)]\nmaeato = [[0 for i in range(10)] for j in range(10)]\nfor i in range(n + 1):\n checking = str(i)\n maeato[int(checking[0])][int(checking[-1])] += 1\nall_count = 0\nfor i in range(1, 10):\n for j in range(1, 10):\n for k in range(1, 10):\n for p in range(1, 10):\n if i == p and j == k:\n all_count += maeato[i][j] * maeato[k][p]\nprint(all_count)\n", "code_same": false, "relative_loc_diff_percent": 35.7142857143, "diff": ["-import itertools", "-", "-N = int(input())", "-Nketa = len(str(N))", "-range_count = [[0 for j in range(10)] for i in range(10)]", "-for p in range(1, N + 1):", "- mae = int(str(p)[0])", "- ato = int(str(p)[-1])", "- range_count[mae][ato] += 1", "-count = 0", "-for j in range(1, N + 1):", "- a_mae = int(str(j)[0])", "- a_ato = int(str(j)[-1])", "- b_mae = a_ato", "- b_ato = a_mae", "- if b_mae == 0:", "- continue", "- else:", "- count += range_count[b_mae][b_ato]", "-print(count)", "+n = int(input())", "+all_count = 0", "+options = [str(i) for i in range(10)]", "+maeato = [[0 for i in range(10)] for j in range(10)]", "+for i in range(n + 1):", "+ checking = str(i)", "+ maeato[int(checking[0])][int(checking[-1])] += 1", "+all_count = 0", "+for i in range(1, 10):", "+ for j in range(1, 10):", "+ for k in range(1, 10):", "+ for p in range(1, 10):", "+ if i == p and j == k:", "+ all_count += maeato[i][j] * maeato[k][p]", "+print(all_count)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5609512657, "measured_runtime_v1": 0.4347667047, "runtime_lift": 1.2902351069, "key": ["s736173164", "s628306332"]} +{"user_id": "u457901067", "problem_id": "p02814", "language": "python", "submission_id_v0": "s285073705", "submission_id_v1": "s453740847", "cpu_time_v0": 523, "cpu_time_v1": 158, "memory_v0": 21860, "memory_v1": 97668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 69.79, "input": "from math import gcd\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a // 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x // pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b//gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M // x + 1) // 2))", "target": "N, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a // 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x // pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b//gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M // x + 1) // 2))", "code_v0_loc": 33, "code_v1_loc": 32, "code_v0_num_chars": 560, "code_v1_num_chars": 533, "code_v0_no_empty_lines": "from math import gcd\n\nN, M = list(map(int, input().split()))\nA = list([int(x) for x in input().split()])\ncnt = [0 for _ in range(N)]\nfor i in range(N):\n a = A[i]\n while a % 2 == 0:\n a = a // 2\n cnt[i] += 1\nif max(cnt) > min(cnt):\n print((0))\n exit(0)\nC = max(cnt)\nA = list([x // pow(2, C) for x in A])\n\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n while a % b > 0:\n a, b = b, a % b\n return b\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\nx = A[0]\nfor a in A[1:]:\n x = lcm(x, a)\nx = x * pow(2, C - 1)\nprint(((M // x + 1) // 2))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nA = list([int(x) for x in input().split()])\ncnt = [0 for _ in range(N)]\nfor i in range(N):\n a = A[i]\n while a % 2 == 0:\n a = a // 2\n cnt[i] += 1\nif max(cnt) > min(cnt):\n print((0))\n exit(0)\nC = max(cnt)\nA = list([x // pow(2, C) for x in A])\n\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n while a % b > 0:\n a, b = b, a % b\n return b\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\nx = A[0]\nfor a in A[1:]:\n x = lcm(x, a)\nx = x * pow(2, C - 1)\nprint(((M // x + 1) // 2))\n", "code_same": false, "relative_loc_diff_percent": 3.0303030303, "diff": ["-from math import gcd", "-"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2484916873, "measured_runtime_v1": 0.192324806, "runtime_lift": 1.2920417937, "key": ["s285073705", "s453740847"]} +{"user_id": "u440566786", "problem_id": "p03558", "language": "python", "submission_id_v0": "s333680155", "submission_id_v1": "s106353030", "cpu_time_v0": 260, "cpu_time_v1": 131, "memory_v0": 62004, "memory_v1": 79416, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 49.62, "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\n\n\nfrom collections import deque\n\ndef resolve():\n\n k=int(input())\n\n E=[[] for _ in range(k)]\n\n for i in range(k):\n\n E[i].append(((i+1)%k,1))\n\n E[i].append(((10*i)%k,0))\n\n\n\n # 0-1 BFS\n\n dist=[INF]*k\n\n dist[1]=0\n\n Q=deque([1])\n\n while(Q):\n\n v=Q.popleft()\n\n for nv,w in E[v]:\n\n if(dist[nv]<=dist[v]+w): continue\n\n dist[nv]=dist[v]+w\n\n if(w==0): Q.appendleft(nv)\n\n else: Q.append(nv)\n\n print((dist[0]+1))\n\nresolve()", "target": "import sys\n\nINF = 1 << 60\n\nMOD = 10**9 + 7 # 998244353\n\nsys.setrecursionlimit(2147483647)\n\ninput = lambda:sys.stdin.readline().rstrip()\n\nfrom collections import deque\n\ndef resolve():\n\n k = int(input())\n\n dist = [INF] * k\n\n dist[1] = 1\n\n queue = deque([1])\n\n\n\n while queue:\n\n v = queue.pop()\n\n if dist[10 * v % k] > dist[v]:\n\n dist[10 * v % k] = dist[v]\n\n queue.appendleft(10 * v % k)\n\n if dist[(v + 1) % k] > dist[v] + 1:\n\n dist[(v + 1) % k] = dist[v] + 1\n\n queue.append((v + 1) % k)\n\n\n\n print((dist[0]))\n\nresolve()", "code_v0_loc": 27, "code_v1_loc": 23, "code_v0_num_chars": 630, "code_v1_num_chars": 596, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nMOD = 10**9 + 7\ninput = lambda: sys.stdin.readline().rstrip()\nfrom collections import deque\n\n\ndef resolve():\n k = int(input())\n E = [[] for _ in range(k)]\n for i in range(k):\n E[i].append(((i + 1) % k, 1))\n E[i].append(((10 * i) % k, 0))\n # 0-1 BFS\n dist = [INF] * k\n dist[1] = 0\n Q = deque([1])\n while Q:\n v = Q.popleft()\n for nv, w in E[v]:\n if dist[nv] <= dist[v] + w:\n continue\n dist[nv] = dist[v] + w\n if w == 0:\n Q.appendleft(nv)\n else:\n Q.append(nv)\n print((dist[0] + 1))\n\n\nresolve()\n", "code_v1_no_empty_lines": "import sys\n\nINF = 1 << 60\nMOD = 10**9 + 7 # 998244353\nsys.setrecursionlimit(2147483647)\ninput = lambda: sys.stdin.readline().rstrip()\nfrom collections import deque\n\n\ndef resolve():\n k = int(input())\n dist = [INF] * k\n dist[1] = 1\n queue = deque([1])\n while queue:\n v = queue.pop()\n if dist[10 * v % k] > dist[v]:\n dist[10 * v % k] = dist[v]\n queue.appendleft(10 * v % k)\n if dist[(v + 1) % k] > dist[v] + 1:\n dist[(v + 1) % k] = dist[v] + 1\n queue.append((v + 1) % k)\n print((dist[0]))\n\n\nresolve()\n", "code_same": false, "relative_loc_diff_percent": 14.8148148148, "diff": ["+INF = 1 << 60", "+MOD = 10**9 + 7 # 998244353", "-INF = float(\"inf\")", "-MOD = 10**9 + 7", "- E = [[] for _ in range(k)]", "- for i in range(k):", "- E[i].append(((i + 1) % k, 1))", "- E[i].append(((10 * i) % k, 0))", "- # 0-1 BFS", "- dist[1] = 0", "- Q = deque([1])", "- while Q:", "- v = Q.popleft()", "- for nv, w in E[v]:", "- if dist[nv] <= dist[v] + w:", "- continue", "- dist[nv] = dist[v] + w", "- if w == 0:", "- Q.appendleft(nv)", "- else:", "- Q.append(nv)", "- print((dist[0] + 1))", "+ dist[1] = 1", "+ queue = deque([1])", "+ while queue:", "+ v = queue.pop()", "+ if dist[10 * v % k] > dist[v]:", "+ dist[10 * v % k] = dist[v]", "+ queue.appendleft(10 * v % k)", "+ if dist[(v + 1) % k] > dist[v] + 1:", "+ dist[(v + 1) % k] = dist[v] + 1", "+ queue.append((v + 1) % k)", "+ print((dist[0]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.412358222, "measured_runtime_v1": 0.3278088195, "runtime_lift": 1.2579229033, "key": ["s333680155", "s106353030"]} +{"user_id": "u761320129", "problem_id": "p03839", "language": "python", "submission_id_v0": "s934844992", "submission_id_v1": "s135860240", "cpu_time_v0": 205, "cpu_time_v1": 174, "memory_v0": 17404, "memory_v1": 17532, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.12, "input": "N,K = list(map(int,input().split()))\n\nsrc = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncump = [0]\n\nfor a in src:\n\n cums.append(cums[-1] + a)\n\n cump.append(cump[-1] + max(0,a))\n\n\n\nans = 0\n\nfor i in range(N-K+1):\n\n tmp = cump[i]\n\n tmp += max(0, cums[i+K] - cums[i])\n\n tmp += cump[N] - cump[i+K]\n\n ans = max(tmp, ans)\n\nprint(ans)\n", "target": "N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncums_p = [0]\n\nfor a in A:\n\n cums.append(cums[-1] + a)\n\n cums_p.append(cums_p[-1] + max(0,a))\n\n\n\nans = -float('inf')\n\nfor l in range(N-K+1):\n\n free = cums_p[l] + cums_p[-1] - cums_p[l+K]\n\n cont = cums[l+K] - cums[l]\n\n ans = max(ans, free, free+cont)\n\nprint(ans)", "code_v0_loc": 16, "code_v1_loc": 15, "code_v0_num_chars": 342, "code_v1_num_chars": 357, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nsrc = list(map(int, input().split()))\ncums = [0]\ncump = [0]\nfor a in src:\n cums.append(cums[-1] + a)\n cump.append(cump[-1] + max(0, a))\nans = 0\nfor i in range(N - K + 1):\n tmp = cump[i]\n tmp += max(0, cums[i + K] - cums[i])\n tmp += cump[N] - cump[i + K]\n ans = max(tmp, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\ncums = [0]\ncums_p = [0]\nfor a in A:\n cums.append(cums[-1] + a)\n cums_p.append(cums_p[-1] + max(0, a))\nans = -float(\"inf\")\nfor l in range(N - K + 1):\n free = cums_p[l] + cums_p[-1] - cums_p[l + K]\n cont = cums[l + K] - cums[l]\n ans = max(ans, free, free + cont)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 6.25, "diff": ["-src = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "-cump = [0]", "-for a in src:", "+cums_p = [0]", "+for a in A:", "- cump.append(cump[-1] + max(0, a))", "-ans = 0", "-for i in range(N - K + 1):", "- tmp = cump[i]", "- tmp += max(0, cums[i + K] - cums[i])", "- tmp += cump[N] - cump[i + K]", "- ans = max(tmp, ans)", "+ cums_p.append(cums_p[-1] + max(0, a))", "+ans = -float(\"inf\")", "+for l in range(N - K + 1):", "+ free = cums_p[l] + cums_p[-1] - cums_p[l + K]", "+ cont = cums[l + K] - cums[l]", "+ ans = max(ans, free, free + cont)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3907449563, "measured_runtime_v1": 0.3033102551, "runtime_lift": 1.2882681998, "key": ["s934844992", "s135860240"]} +{"user_id": "u766684188", "problem_id": "p02821", "language": "python", "submission_id_v0": "s756543404", "submission_id_v1": "s283463453", "cpu_time_v0": 1684, "cpu_time_v1": 1054, "memory_v0": 58816, "memory_v1": 60104, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.41, "input": "#E\n\nfrom itertools import accumulate\n\nfrom bisect import bisect_left\n\ndef main():\n\n n,m=list(map(int,input().split()))\n\n A=list(map(int,input().split()))\n\n A.sort()\n\n \n\n def count(k):\n\n cnt=0\n\n for a in A:\n\n cnt+=bisect_left(A,k-a)\n\n return cnt\n\n \n\n ok=0\n\n ng=10**10+1\n\n while ng-ok>1:\n\n mid=(ok+ng)//2\n\n if count(mid)1:\n\n mid=(ok+ng)//2\n\n if count(mid) 1:\n mid = (ok + ng) // 2\n if count(mid) < n**2 - m:\n ok = mid\n else:\n ng = mid\n border = ok\n k = n**2 - count(border)\n Acc = [0] + list(accumulate(A))\n s = Acc[-1]\n ans = 0\n for a in A:\n idx = bisect_left(A, border - a)\n ans += a * (n - idx) + (s - Acc[idx])\n ans -= border * (k - m)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from itertools import accumulate\nfrom bisect import bisect_left\n\n\ndef main():\n n, m = list(map(int, input().split()))\n A = list(map(int, input().split()))\n A.sort()\n\n def count(k):\n cnt = 0\n for a in A:\n cnt += bisect_left(A, k - a)\n return cnt\n\n ok = 0\n ng = 2 * 10**5 + 1\n while ng - ok > 1:\n mid = (ok + ng) // 2\n if count(mid) < n**2 - m:\n ok = mid\n else:\n ng = mid\n border = ok\n k = n**2 - count(border)\n Acc = [0] + list(accumulate(A))\n s = Acc[-1]\n ans = 0\n for a in A:\n idx = bisect_left(A, border - a)\n ans += a * (n - idx) + (s - Acc[idx])\n ans -= border * (k - m)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 2.7777777778, "diff": ["-# E", "- ng = 10**10 + 1", "+ ng = 2 * 10**5 + 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.329581742, "measured_runtime_v1": 0.2004272747, "runtime_lift": 1.6443956668, "key": ["s756543404", "s283463453"]} +{"user_id": "u738898077", "problem_id": "p03634", "language": "python", "submission_id_v0": "s144783413", "submission_id_v1": "s080655040", "cpu_time_v0": 845, "cpu_time_v1": 724, "memory_v0": 48964, "memory_v1": 48916, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.32, "input": "import sys\n\ninput = sys.stdin.readline\n\nn = int(input())\n\nv = [[0]+[]*(n+1) for i in range(n+1)]\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\n\n\nq,k = list(map(int,input().split()))\n\nl = [k]\n\nwhile l:\n\n now = l.pop()\n\n for i in v[now][1:]:\n\n if v[i[0]][0] == 0:\n\n v[i[0]][0] = i[1]+v[now][0]\n\n l.append(i[0])\n\n\n\nfor i in range(q):\n\n x,y = list(map(int,input().split()))\n\n print((v[x][0]+v[y][0]))", "target": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n n = int(input())\n\n v = [[0]+[]*(n+1) for i in range(n+1)]\n\n for i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\n\n\n q,k = list(map(int,input().split()))\n\n l = [k]\n\n while l:\n\n now = l.pop()\n\n for i in v[now][1:]:\n\n if v[i[0]][0] == 0:\n\n v[i[0]][0] = i[1]+v[now][0]\n\n l.append(i[0])\n\n\n\n for i in range(q):\n\n x,y = list(map(int,input().split()))\n\n print((v[x][0]+v[y][0]))\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 21, "code_v1_loc": 25, "code_v0_num_chars": 486, "code_v1_num_chars": 613, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nn = int(input())\nv = [[0] + [] * (n + 1) for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n v[a].append([b, c])\n v[b].append([a, c])\nq, k = list(map(int, input().split()))\nl = [k]\nwhile l:\n now = l.pop()\n for i in v[now][1:]:\n if v[i[0]][0] == 0:\n v[i[0]][0] = i[1] + v[now][0]\n l.append(i[0])\nfor i in range(q):\n x, y = list(map(int, input().split()))\n print((v[x][0] + v[y][0]))\n", "code_v1_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n n = int(input())\n v = [[0] + [] * (n + 1) for i in range(n + 1)]\n for i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n v[a].append([b, c])\n v[b].append([a, c])\n q, k = list(map(int, input().split()))\n l = [k]\n while l:\n now = l.pop()\n for i in v[now][1:]:\n if v[i[0]][0] == 0:\n v[i[0]][0] = i[1] + v[now][0]\n l.append(i[0])\n for i in range(q):\n x, y = list(map(int, input().split()))\n print((v[x][0] + v[y][0]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 16.0, "diff": ["-input = sys.stdin.readline", "-n = int(input())", "-v = [[0] + [] * (n + 1) for i in range(n + 1)]", "-for i in range(n - 1):", "- a, b, c = list(map(int, input().split()))", "- v[a].append([b, c])", "- v[b].append([a, c])", "-q, k = list(map(int, input().split()))", "-l = [k]", "-while l:", "- now = l.pop()", "- for i in v[now][1:]:", "- if v[i[0]][0] == 0:", "- v[i[0]][0] = i[1] + v[now][0]", "- l.append(i[0])", "-for i in range(q):", "- x, y = list(map(int, input().split()))", "- print((v[x][0] + v[y][0]))", "+", "+def main():", "+ input = sys.stdin.readline", "+ n = int(input())", "+ v = [[0] + [] * (n + 1) for i in range(n + 1)]", "+ for i in range(n - 1):", "+ a, b, c = list(map(int, input().split()))", "+ v[a].append([b, c])", "+ v[b].append([a, c])", "+ q, k = list(map(int, input().split()))", "+ l = [k]", "+ while l:", "+ now = l.pop()", "+ for i in v[now][1:]:", "+ if v[i[0]][0] == 0:", "+ v[i[0]][0] = i[1] + v[now][0]", "+ l.append(i[0])", "+ for i in range(q):", "+ x, y = list(map(int, input().split()))", "+ print((v[x][0] + v[y][0]))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3066135428, "measured_runtime_v1": 0.2174853971, "runtime_lift": 1.4098120925, "key": ["s144783413", "s080655040"]} +{"user_id": "u628707847", "problem_id": "p02748", "language": "python", "submission_id_v0": "s393648468", "submission_id_v1": "s394235092", "cpu_time_v0": 533, "cpu_time_v1": 471, "memory_v0": 30260, "memory_v1": 21668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.63, "input": "a, b, m = list(map(int,input().split()))\n\ndr = list(map(int,input().split()))\n\nwa = list(map(int,input().split()))\n\nxyc = [list(map(int,input().split())) for i in range(m)]\n\nlow = 200001\n\n\n\nfor i in range(m):\n\n f = xyc[i][0] - 1\n\n d = xyc[i][1] - 1\n\n if low >= dr[f]+wa[d]-xyc[i][2]:\n\n low = dr[f]+wa[d]-xyc[i][2]\n\n\n\ndr.sort()\n\nwa.sort()\n\n\n\nif low >= (dr[0] + wa[0]):\n\n print((dr[0] + wa[0]))\n\nelse:\n\n print(low)", "target": "a, b, m = list(map(int,input().split()))\n\nal = list(map(int,input().split()))\n\nbl = list(map(int,input().split()))\n\nlow = min(al)+min(bl)\n\nx = [0] * m\n\ny = [0] * m\n\nc = [0] * m\n\n\n\nfor i in range(m):\n\n x[i],y[i],c[i] = list(map(int, input().split()))\n\n x[i] -= 1\n\n y[i] -= 1\n\n \n\nfor i in range(m):\n\n low = min(low,al[x[i]]+bl[y[i]]-c[i])\n\n\n\nprint(low)", "code_v0_loc": 19, "code_v1_loc": 17, "code_v0_num_chars": 424, "code_v1_num_chars": 353, "code_v0_no_empty_lines": "a, b, m = list(map(int, input().split()))\ndr = list(map(int, input().split()))\nwa = list(map(int, input().split()))\nxyc = [list(map(int, input().split())) for i in range(m)]\nlow = 200001\nfor i in range(m):\n f = xyc[i][0] - 1\n d = xyc[i][1] - 1\n if low >= dr[f] + wa[d] - xyc[i][2]:\n low = dr[f] + wa[d] - xyc[i][2]\ndr.sort()\nwa.sort()\nif low >= (dr[0] + wa[0]):\n print((dr[0] + wa[0]))\nelse:\n print(low)\n", "code_v1_no_empty_lines": "a, b, m = list(map(int, input().split()))\nal = list(map(int, input().split()))\nbl = list(map(int, input().split()))\nlow = min(al) + min(bl)\nx = [0] * m\ny = [0] * m\nc = [0] * m\nfor i in range(m):\n x[i], y[i], c[i] = list(map(int, input().split()))\n x[i] -= 1\n y[i] -= 1\nfor i in range(m):\n low = min(low, al[x[i]] + bl[y[i]] - c[i])\nprint(low)\n", "code_same": false, "relative_loc_diff_percent": 10.5263157895, "diff": ["-dr = list(map(int, input().split()))", "-wa = list(map(int, input().split()))", "-xyc = [list(map(int, input().split())) for i in range(m)]", "-low = 200001", "+al = list(map(int, input().split()))", "+bl = list(map(int, input().split()))", "+low = min(al) + min(bl)", "+x = [0] * m", "+y = [0] * m", "+c = [0] * m", "- f = xyc[i][0] - 1", "- d = xyc[i][1] - 1", "- if low >= dr[f] + wa[d] - xyc[i][2]:", "- low = dr[f] + wa[d] - xyc[i][2]", "-dr.sort()", "-wa.sort()", "-if low >= (dr[0] + wa[0]):", "- print((dr[0] + wa[0]))", "-else:", "- print(low)", "+ x[i], y[i], c[i] = list(map(int, input().split()))", "+ x[i] -= 1", "+ y[i] -= 1", "+for i in range(m):", "+ low = min(low, al[x[i]] + bl[y[i]] - c[i])", "+print(low)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2055197518, "measured_runtime_v1": 0.0063774352, "runtime_lift": 32.2260822388, "key": ["s393648468", "s394235092"]} +{"user_id": "u281303342", "problem_id": "p03828", "language": "python", "submission_id_v0": "s909168869", "submission_id_v1": "s458659043", "cpu_time_v0": 68, "cpu_time_v1": 27, "memory_v0": 3316, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.29, "input": "from collections import Counter\n\nN = int(input())\n\ndiv = []\n\nfor i in range(2,N+1):\n\n while i != 1:\n\n for d in range(2,i+1):\n\n while i%d==0:\n\n i = i//d\n\n div.append(d)\n\nC = Counter(div).most_common()\n\nAns = 1\n\nfor k,v in C:\n\n Ans = Ans*(v+1) % (10**9+7)\n\n\n\nprint(Ans)\n", "target": "from collections import defaultdict\n\nN = int(input())\n\n\n\nF = [True]*(N+1)\n\nF[0]=F[1]=False\n\nP = []\n\n\n\nfor i in range(2,N+1):\n\n if F[i]==True:\n\n P.append(i)\n\n for j in range(i*2,N+1,i):\n\n F[j]=False\n\n\n\ndic = defaultdict(int)\n\nfor i in range(2,N+1):\n\n for p in P:\n\n while i%p==0:\n\n dic[p] += 1\n\n i = i//p\n\n if i==1:\n\n break\n\n\n\nans = 1\n\nmodulo = 10**9+7\n\nfor v in list(dic.values()):\n\n ans *= (v+1)\n\n ans %= modulo\n\n\n\nprint(ans)", "code_v0_loc": 15, "code_v1_loc": 29, "code_v0_num_chars": 322, "code_v1_num_chars": 503, "code_v0_no_empty_lines": "from collections import Counter\n\nN = int(input())\ndiv = []\nfor i in range(2, N + 1):\n while i != 1:\n for d in range(2, i + 1):\n while i % d == 0:\n i = i // d\n div.append(d)\nC = Counter(div).most_common()\nAns = 1\nfor k, v in C:\n Ans = Ans * (v + 1) % (10**9 + 7)\nprint(Ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nF = [True] * (N + 1)\nF[0] = F[1] = False\nP = []\nfor i in range(2, N + 1):\n if F[i] == True:\n P.append(i)\n for j in range(i * 2, N + 1, i):\n F[j] = False\ndic = defaultdict(int)\nfor i in range(2, N + 1):\n for p in P:\n while i % p == 0:\n dic[p] += 1\n i = i // p\n if i == 1:\n break\nans = 1\nmodulo = 10**9 + 7\nfor v in list(dic.values()):\n ans *= v + 1\n ans %= modulo\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 48.275862069, "diff": ["-from collections import Counter", "+from collections import defaultdict", "-div = []", "+F = [True] * (N + 1)", "+F[0] = F[1] = False", "+P = []", "- while i != 1:", "- for d in range(2, i + 1):", "- while i % d == 0:", "- i = i // d", "- div.append(d)", "-C = Counter(div).most_common()", "-Ans = 1", "-for k, v in C:", "- Ans = Ans * (v + 1) % (10**9 + 7)", "-print(Ans)", "+ if F[i] == True:", "+ P.append(i)", "+ for j in range(i * 2, N + 1, i):", "+ F[j] = False", "+dic = defaultdict(int)", "+for i in range(2, N + 1):", "+ for p in P:", "+ while i % p == 0:", "+ dic[p] += 1", "+ i = i // p", "+ if i == 1:", "+ break", "+ans = 1", "+modulo = 10**9 + 7", "+for v in list(dic.values()):", "+ ans *= v + 1", "+ ans %= modulo", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3373793194, "measured_runtime_v1": 0.2469508071, "runtime_lift": 1.3661802664, "key": ["s909168869", "s458659043"]} +{"user_id": "u556358547", "problem_id": "p03416", "language": "python", "submission_id_v0": "s971943319", "submission_id_v1": "s985131399", "cpu_time_v0": 94, "cpu_time_v1": 70, "memory_v0": 73744, "memory_v1": 64480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.53, "input": "# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n r = \"\".join(reversed(list(s)))\n\n if s == r:\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n # s = str(i)\n\n # r = \"\".join(reversed(list(s)))\n\n # if s == r:\n\n # c += 1\n\n if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 281, "code_v1_num_chars": 407, "code_v0_no_empty_lines": "# vim: fileencoding=utf-8\ndef main():\n a, b = list(map(int, input().split()))\n c = 0\n for i in range(a, b + 1):\n s = str(i)\n r = \"\".join(reversed(list(s)))\n if s == r:\n c += 1\n print(c)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# vim: fileencoding=utf-8\ndef main():\n a, b = list(map(int, input().split()))\n c = 0\n for i in range(a, b + 1):\n # s = str(i)\n # r = \"\".join(reversed(list(s)))\n # if s == r:\n # c += 1\n if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):\n c += 1\n print(c)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- s = str(i)", "- r = \"\".join(reversed(list(s)))", "- if s == r:", "+ # s = str(i)", "+ # r = \"\".join(reversed(list(s)))", "+ # if s == r:", "+ # c += 1", "+ if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.319033144, "measured_runtime_v1": 0.2127196875, "runtime_lift": 1.4997819327, "key": ["s971943319", "s985131399"]} +{"user_id": "u764401543", "problem_id": "p03371", "language": "python", "submission_id_v0": "s157366337", "submission_id_v1": "s208344914", "cpu_time_v0": 114, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.09, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float('inf')\n\n\n\nfor i in range(10 ** 5 + 1):\n\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n# ans = float('inf')\n\n\n\n# for i in range(10 ** 5 + 1):\n\n# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\n# print(ans)\n\n\n\nmin_xy = min(X, Y)\n\nmax_xy = max(X, Y)\n\nans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)\n\nans2 = A * X + B * Y\n\nans3 = 2 * C * max_xy\n\nprint((min(ans1, ans2, ans3)))", "code_v0_loc": 7, "code_v1_loc": 14, "code_v0_num_chars": 178, "code_v1_num_chars": 364, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(10**5 + 1):\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\n# ans = float('inf')\n# for i in range(10 ** 5 + 1):\n# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n# print(ans)\nmin_xy = min(X, Y)\nmax_xy = max(X, Y)\nans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)\nans2 = A * X + B * Y\nans3 = 2 * C * max_xy\nprint((min(ans1, ans2, ans3)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-ans = float(\"inf\")", "-for i in range(10**5 + 1):", "- ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)", "-print(ans)", "+# ans = float('inf')", "+# for i in range(10 ** 5 + 1):", "+# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)", "+# print(ans)", "+min_xy = min(X, Y)", "+max_xy = max(X, Y)", "+ans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)", "+ans2 = A * X + B * Y", "+ans3 = 2 * C * max_xy", "+print((min(ans1, ans2, ans3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8766576855, "measured_runtime_v1": 0.1948450158, "runtime_lift": 4.4992564066, "key": ["s157366337", "s208344914"]} +{"user_id": "u025501820", "problem_id": "p02792", "language": "python", "submission_id_v0": "s746150122", "submission_id_v1": "s989284284", "cpu_time_v0": 318, "cpu_time_v1": 169, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.86, "input": "N = int(input())\n\ncount = [[0 for _ in range(9)] for _ in range(9)]\n\nfor i in range(1, N + 1):\n\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\n\nans = 0\n\nfor i in range(0, 9):\n\n for k in range(0, 9):\n\n ans += count[i][k] * count[k][i]\n\nprint(ans)", "target": "N = int(input())\n\nnums = [0 for i in range(100)]\n\nfor i in range(1, N + 1):\n\n i = str(i)\n\n nums[int(i[0] + i[-1])] += 1\n\nans = 0\n\nfor i in range(1, 10):\n\n for j in range(i, 10):\n\n i = str(i)\n\n j = str(j)\n\n if i != j:\n\n ans += nums[int(i + j)] * nums[int(j + i)] * 2\n\n else:\n\n n = nums[int(i + j)]\n\n ans += n * (n - 1)\n\n ans += n\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 17, "code_v0_num_chars": 316, "code_v1_num_chars": 421, "code_v0_no_empty_lines": "N = int(input())\ncount = [[0 for _ in range(9)] for _ in range(9)]\nfor i in range(1, N + 1):\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\nans = 0\nfor i in range(0, 9):\n for k in range(0, 9):\n ans += count[i][k] * count[k][i]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nnums = [0 for i in range(100)]\nfor i in range(1, N + 1):\n i = str(i)\n nums[int(i[0] + i[-1])] += 1\nans = 0\nfor i in range(1, 10):\n for j in range(i, 10):\n i = str(i)\n j = str(j)\n if i != j:\n ans += nums[int(i + j)] * nums[int(j + i)] * 2\n else:\n n = nums[int(i + j)]\n ans += n * (n - 1)\n ans += n\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.1764705882, "diff": ["-count = [[0 for _ in range(9)] for _ in range(9)]", "+nums = [0 for i in range(100)]", "- if str(i)[0] != \"0\" and str(i)[-1] != \"0\":", "- count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1", "+ i = str(i)", "+ nums[int(i[0] + i[-1])] += 1", "-for i in range(0, 9):", "- for k in range(0, 9):", "- ans += count[i][k] * count[k][i]", "+for i in range(1, 10):", "+ for j in range(i, 10):", "+ i = str(i)", "+ j = str(j)", "+ if i != j:", "+ ans += nums[int(i + j)] * nums[int(j + i)] * 2", "+ else:", "+ n = nums[int(i + j)]", "+ ans += n * (n - 1)", "+ ans += n"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4702084679, "measured_runtime_v1": 0.3054097801, "runtime_lift": 1.5395985934, "key": ["s746150122", "s989284284"]} +{"user_id": "u476068053", "problem_id": "p02555", "language": "python", "submission_id_v0": "s269976358", "submission_id_v1": "s000228897", "cpu_time_v0": 91, "cpu_time_v1": 66, "memory_v0": 64552, "memory_v1": 62952, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.47, "input": "def main():\n\n s = int(input())\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n for i in range(1, s+1):\n\n for j in range(0, (i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "def main():\n\n s = int(input())\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n# for i in range(1, s+1):\n\n# for j in range(0, (i-3)+1):\n\n# dp[i] += dp[j]\n\n# dp[i] %= mod\n\n for i in range(1, s+1):\n\n if i < 3:\n\n dp[i] = 0\n\n else:\n\n dp[i] = dp[i-1] + dp[i-3]\n\n dp[i] %= mod\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 15, "code_v1_loc": 22, "code_v0_num_chars": 277, "code_v1_num_chars": 434, "code_v0_no_empty_lines": "def main():\n s = int(input())\n mod = 10**9 + 7\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(1, s + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n s = int(input())\n mod = 10**9 + 7\n dp = [0] * (s + 1)\n dp[0] = 1\n # for i in range(1, s+1):\n # for j in range(0, (i-3)+1):\n # dp[i] += dp[j]\n # dp[i] %= mod\n for i in range(1, s + 1):\n if i < 3:\n dp[i] = 0\n else:\n dp[i] = dp[i - 1] + dp[i - 3]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 31.8181818182, "diff": ["+ # for i in range(1, s+1):", "+ # for j in range(0, (i-3)+1):", "+ # dp[i] += dp[j]", "+ # dp[i] %= mod", "- for j in range(0, (i - 3) + 1):", "- dp[i] += dp[j]", "+ if i < 3:", "+ dp[i] = 0", "+ else:", "+ dp[i] = dp[i - 1] + dp[i - 3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5094247258, "measured_runtime_v1": 0.2087815866, "runtime_lift": 2.4399887649, "key": ["s269976358", "s000228897"]} +{"user_id": "u077291787", "problem_id": "p03164", "language": "python", "submission_id_v0": "s644346369", "submission_id_v1": "s649660252", "cpu_time_v0": 472, "cpu_time_v1": 351, "memory_v0": 93244, "memory_v1": 70732, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.64, "input": "# temp\n\nn,w = list(map(int,input().split()))\n\nwv = [tuple(map(int,input().split())) for i in range(n)]\n\n\n\ndp = [0] + [float(\"inf\")]*(10**5)\n\nfor i in range(n):\n\n for j in range(10**5,wv[i][1]-1,-1):\n\n dp[j] = min(dp[j],dp[j-wv[i][1]]+wv[i][0])\n\n\n\nres = 0\n\nfor v,e in enumerate(dp):\n\n if e <= w:\n\n res = v\n\nprint(res)", "target": "# dpE - Knapsack 2\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, W = tuple(map(int, input().rstrip().split()))\n\n A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))\n\n _, v = list(zip(*A))\n\n lim = sum(v)\n\n dp = [0] + [float(\"inf\")] * lim\n\n for i in range(n):\n\n for j in range(lim, A[i][1] - 1, -1):\n\n dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])\n\n ans = max(v for v, w in enumerate(dp) if w <= W)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 14, "code_v1_loc": 19, "code_v0_num_chars": 330, "code_v1_num_chars": 522, "code_v0_no_empty_lines": "# temp\nn, w = list(map(int, input().split()))\nwv = [tuple(map(int, input().split())) for i in range(n)]\ndp = [0] + [float(\"inf\")] * (10**5)\nfor i in range(n):\n for j in range(10**5, wv[i][1] - 1, -1):\n dp[j] = min(dp[j], dp[j - wv[i][1]] + wv[i][0])\nres = 0\nfor v, e in enumerate(dp):\n if e <= w:\n res = v\nprint(res)\n", "code_v1_no_empty_lines": "# dpE - Knapsack 2\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, W = tuple(map(int, input().rstrip().split()))\n A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))\n _, v = list(zip(*A))\n lim = sum(v)\n dp = [0] + [float(\"inf\")] * lim\n for i in range(n):\n for j in range(lim, A[i][1] - 1, -1):\n dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])\n ans = max(v for v, w in enumerate(dp) if w <= W)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 26.3157894737, "diff": ["-# temp", "-n, w = list(map(int, input().split()))", "-wv = [tuple(map(int, input().split())) for i in range(n)]", "-dp = [0] + [float(\"inf\")] * (10**5)", "-for i in range(n):", "- for j in range(10**5, wv[i][1] - 1, -1):", "- dp[j] = min(dp[j], dp[j - wv[i][1]] + wv[i][0])", "-res = 0", "-for v, e in enumerate(dp):", "- if e <= w:", "- res = v", "-print(res)", "+# dpE - Knapsack 2", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def main():", "+ n, W = tuple(map(int, input().rstrip().split()))", "+ A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))", "+ _, v = list(zip(*A))", "+ lim = sum(v)", "+ dp = [0] + [float(\"inf\")] * lim", "+ for i in range(n):", "+ for j in range(lim, A[i][1] - 1, -1):", "+ dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])", "+ ans = max(v for v, w in enumerate(dp) if w <= W)", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 1.6859776349, "measured_runtime_v1": 0.2345220137, "runtime_lift": 7.1889952184, "key": ["s644346369", "s649660252"]} +{"user_id": "u254871849", "problem_id": "p03086", "language": "python", "submission_id_v0": "s827296868", "submission_id_v1": "s358574733", "cpu_time_v0": 604, "cpu_time_v1": 18, "memory_v0": 102680, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 97.02, "input": "# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\nimport itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n all_words = []\n\n for i in range(1, len(s) + 1):\n\n for letters in itertools.product('ATCG', repeat=i):\n\n word = ''.join(letters)\n\n all_words.append(word)\n\n \n\n for i in range(len(all_words)-1, 0-1, -1):\n\n if all_words[i] in s:\n\n print((len(all_words[i])))\n\n sys.exit()\n\n print((0))\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n permitted = 'ACGT'\n\n continuous_count = []\n\n count = 0\n\n\n\n for i in range(len(s)):\n\n char = s[i]\n\n if char in permitted:\n\n count += 1\n\n else:\n\n continuous_count.append(count)\n\n count = 0\n\n if i == len(s) - 1:\n\n continuous_count.append(count)\n\n \n\n if not continuous_count:\n\n print((len(s)))\n\n else:\n\n print((max(continuous_count)))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 32, "code_v1_loc": 38, "code_v0_num_chars": 799, "code_v1_num_chars": 884, "code_v0_no_empty_lines": "# 2019-11-12 22:21:08(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\nimport itertools\n\n# from functools import reduce\n# import operator as op\n# from scipy.misc import comb # float\n# import numpy as np\ndef main():\n s = sys.stdin.readline().rstrip()\n all_words = []\n for i in range(1, len(s) + 1):\n for letters in itertools.product(\"ATCG\", repeat=i):\n word = \"\".join(letters)\n all_words.append(word)\n for i in range(len(all_words) - 1, 0 - 1, -1):\n if all_words[i] in s:\n print((len(all_words[i])))\n sys.exit()\n print((0))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# 2019-11-12 22:21:08(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# from scipy.misc import comb # float\n# import numpy as np\ndef main():\n s = sys.stdin.readline().rstrip()\n permitted = \"ACGT\"\n continuous_count = []\n count = 0\n for i in range(len(s)):\n char = s[i]\n if char in permitted:\n count += 1\n else:\n continuous_count.append(count)\n count = 0\n if i == len(s) - 1:\n continuous_count.append(count)\n if not continuous_count:\n print((len(s)))\n else:\n print((max(continuous_count)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.7894736842, "diff": ["-import itertools", "-", "+# import itertools", "- all_words = []", "- for i in range(1, len(s) + 1):", "- for letters in itertools.product(\"ATCG\", repeat=i):", "- word = \"\".join(letters)", "- all_words.append(word)", "- for i in range(len(all_words) - 1, 0 - 1, -1):", "- if all_words[i] in s:", "- print((len(all_words[i])))", "- sys.exit()", "- print((0))", "+ permitted = \"ACGT\"", "+ continuous_count = []", "+ count = 0", "+ for i in range(len(s)):", "+ char = s[i]", "+ if char in permitted:", "+ count += 1", "+ else:", "+ continuous_count.append(count)", "+ count = 0", "+ if i == len(s) - 1:", "+ continuous_count.append(count)", "+ if not continuous_count:", "+ print((len(s)))", "+ else:", "+ print((max(continuous_count)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4624249086, "measured_runtime_v1": 0.2736470122, "runtime_lift": 1.6898591541, "key": ["s827296868", "s358574733"]} +{"user_id": "u150984829", "problem_id": "p02386", "language": "python", "submission_id_v0": "s352388599", "submission_id_v1": "s199670495", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 5616, "memory_v1": 5616, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n", "target": "n=int(input())\n\na=[[int(s)for s in input().split()]for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n", "code_v0_loc": 15, "code_v1_loc": 15, "code_v0_num_chars": 457, "code_v1_num_chars": 459, "code_v0_no_empty_lines": "n = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\n [0, 1, 2, 3, 4, 5],\n [1, 5, 2, 0, 4, 3],\n [2, 1, 5, 3, 0, 4],\n [3, 0, 2, 5, 4, 1],\n [4, 1, 0, 3, 5, 2],\n [5, 1, 4, 3, 2, 0],\n ):\n f = [d[k] for k in p]\n if f[0] == e[0] and f[5] == e[5]:\n f = f[1:5] * 2\n for k in range(4):\n if f[k : k + 4] == e[1:5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_v1_no_empty_lines": "n = int(input())\na = [[int(s) for s in input().split()] for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\n [0, 1, 2, 3, 4, 5],\n [1, 5, 2, 0, 4, 3],\n [2, 1, 5, 3, 0, 4],\n [3, 0, 2, 5, 4, 1],\n [4, 1, 0, 3, 5, 2],\n [5, 1, 4, 3, 2, 0],\n ):\n f = [d[k] for k in p]\n if f[0] == e[0] and f[5] == e[5]:\n f = f[1:5] * 2\n for k in range(4):\n if f[k : k + 4] == e[1:5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-a = [list(map(int, input().split())) for _ in range(n)]", "+a = [[int(s) for s in input().split()] for _ in range(n)]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2724710764, "measured_runtime_v1": 0.2146971788, "runtime_lift": 1.2690948152, "key": ["s352388599", "s199670495"]} +{"user_id": "u153665391", "problem_id": "p02268", "language": "python", "submission_id_v0": "s156684058", "submission_id_v1": "s820654012", "cpu_time_v0": 520, "cpu_time_v1": 390, "memory_v0": 16712, "memory_v1": 16712, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "N = int(input())\n\nS = list(map(int, input().split()))\n\nQ = int(input())\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n idx = int((head+tail)/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n if head == idx:\n\n return False\n\n return binary_search(target_num, head, idx-1)\n\n else:\n\n if tail == idx:\n\n return False\n\n return binary_search(target_num, idx+1, tail)\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n", "target": "N = int(input())\n\nS = list(map(int, input().split()))\n\nQ = int(input())\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n while head <= tail:\n\n idx = int((head+tail)/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n tail = idx - 1\n\n else:\n\n head = idx + 1\n\n return False\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 634, "code_v1_num_chars": 541, "code_v0_no_empty_lines": "N = int(input())\nS = list(map(int, input().split()))\nQ = int(input())\nT = list(map(int, input().split()))\n\n\ndef binary_search(target_num, head, tail):\n idx = int((head + tail) / 2)\n if target_num == S[idx]:\n return True\n elif target_num < S[idx]:\n if head == idx:\n return False\n return binary_search(target_num, head, idx - 1)\n else:\n if tail == idx:\n return False\n return binary_search(target_num, idx + 1, tail)\n\n\nmatch_count = 0\nfor target_num in T:\n if binary_search(target_num, 0, len(S) - 1):\n match_count += 1\nprint((str(match_count)))\n", "code_v1_no_empty_lines": "N = int(input())\nS = list(map(int, input().split()))\nQ = int(input())\nT = list(map(int, input().split()))\n\n\ndef binary_search(target_num, head, tail):\n while head <= tail:\n idx = int((head + tail) / 2)\n if target_num == S[idx]:\n return True\n elif target_num < S[idx]:\n tail = idx - 1\n else:\n head = idx + 1\n return False\n\n\nmatch_count = 0\nfor target_num in T:\n if binary_search(target_num, 0, len(S) - 1):\n match_count += 1\nprint((str(match_count)))\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- idx = int((head + tail) / 2)", "- if target_num == S[idx]:", "- return True", "- elif target_num < S[idx]:", "- if head == idx:", "- return False", "- return binary_search(target_num, head, idx - 1)", "- else:", "- if tail == idx:", "- return False", "- return binary_search(target_num, idx + 1, tail)", "+ while head <= tail:", "+ idx = int((head + tail) / 2)", "+ if target_num == S[idx]:", "+ return True", "+ elif target_num < S[idx]:", "+ tail = idx - 1", "+ else:", "+ head = idx + 1", "+ return False"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3635195796, "measured_runtime_v1": 0.2206529045, "runtime_lift": 1.6474724429, "key": ["s156684058", "s820654012"]} +{"user_id": "u887207211", "problem_id": "p03086", "language": "python", "submission_id_v0": "s916999030", "submission_id_v1": "s575230730", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "import re\n\nptn = re.compile(r\"(A|C|G|T)*\")\n\n\n\nS = input()\n\n\n\nans = 0\n\nfor i in range(len(S)):\n\n for j in range(len(S)):\n\n x = ptn.match(S[i:i+j+1]).group(0)\n\n if(x):\n\n ans = max(ans, len(x))\n\nprint(ans)", "target": "import sys\n\n\n\nstdin = sys.stdin\n\n\n\nns = lambda : stdin.readline().rstrip()\n\nni = lambda : int(ns())\n\nna = lambda : list(map(int, stdin.readline().split()))\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef check(In):\n\n return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"\n\n\n\ndef main():\n\n s = ns()\n\n\n\n count = 0\n\n ans = 0\n\n for i in range(len(s)):\n\n if check(s[i]):\n\n count = 0\n\n else:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 12, "code_v1_loc": 27, "code_v0_num_chars": 214, "code_v1_num_chars": 537, "code_v0_no_empty_lines": "import re\n\nptn = re.compile(r\"(A|C|G|T)*\")\nS = input()\nans = 0\nfor i in range(len(S)):\n for j in range(len(S)):\n x = ptn.match(S[i : i + j + 1]).group(0)\n if x:\n ans = max(ans, len(x))\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nstdin = sys.stdin\nns = lambda: stdin.readline().rstrip()\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nsys.setrecursionlimit(10**7)\n\n\ndef check(In):\n return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"\n\n\ndef main():\n s = ns()\n count = 0\n ans = 0\n for i in range(len(s)):\n if check(s[i]):\n count = 0\n else:\n count += 1\n ans = max(ans, count)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-import re", "+import sys", "-ptn = re.compile(r\"(A|C|G|T)*\")", "-S = input()", "-ans = 0", "-for i in range(len(S)):", "- for j in range(len(S)):", "- x = ptn.match(S[i : i + j + 1]).group(0)", "- if x:", "- ans = max(ans, len(x))", "-print(ans)", "+stdin = sys.stdin", "+ns = lambda: stdin.readline().rstrip()", "+ni = lambda: int(ns())", "+na = lambda: list(map(int, stdin.readline().split()))", "+sys.setrecursionlimit(10**7)", "+", "+", "+def check(In):", "+ return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"", "+", "+", "+def main():", "+ s = ns()", "+ count = 0", "+ ans = 0", "+ for i in range(len(s)):", "+ if check(s[i]):", "+ count = 0", "+ else:", "+ count += 1", "+ ans = max(ans, count)", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3654596429, "measured_runtime_v1": 0.2052364919, "runtime_lift": 1.7806757436, "key": ["s916999030", "s575230730"]} +{"user_id": "u489959379", "problem_id": "p03371", "language": "python", "submission_id_v0": "s775348159", "submission_id_v1": "s575049266", "cpu_time_v0": 62, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.58, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nab = c * 2\n\n\n\nres = float(\"inf\")\n\nif a + b <= ab:\n\n res = x * a + y * b\n\nelse:\n\n if x == y:\n\n res = x * ab\n\n elif x > y:\n\n for i in range(y, x + 1):\n\n cost = i * ab + (x - i) * a\n\n res = min(res, cost)\n\n else:\n\n for i in range(x, y + 1):\n\n cost = i * ab + (y - i) * b\n\n res = min(res, cost)\n\nprint(res)\n", "target": "import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\ninput = sys.stdin.readline\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n c *= 2\n\n if a + b > c:\n\n cost1 = max(x, y) * c\n\n cost2 = min(x, y) * c\n\n plus = ((y - x) * b) if x < y else (x - y) * a\n\n res = min(cost1, cost2 + plus)\n\n else:\n\n res = x * a + y * b\n\n print(res)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "code_v0_loc": 18, "code_v1_loc": 22, "code_v0_num_chars": 423, "code_v1_num_chars": 471, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nab = c * 2\nres = float(\"inf\")\nif a + b <= ab:\n res = x * a + y * b\nelse:\n if x == y:\n res = x * ab\n elif x > y:\n for i in range(y, x + 1):\n cost = i * ab + (x - i) * a\n res = min(res, cost)\n else:\n for i in range(x, y + 1):\n cost = i * ab + (y - i) * b\n res = min(res, cost)\nprint(res)\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef resolve():\n a, b, c, x, y = list(map(int, input().split()))\n c *= 2\n if a + b > c:\n cost1 = max(x, y) * c\n cost2 = min(x, y) * c\n plus = ((y - x) * b) if x < y else (x - y) * a\n res = min(cost1, cost2 + plus)\n else:\n res = x * a + y * b\n print(res)\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-a, b, c, x, y = list(map(int, input().split()))", "-ab = c * 2", "-res = float(\"inf\")", "-if a + b <= ab:", "- res = x * a + y * b", "-else:", "- if x == y:", "- res = x * ab", "- elif x > y:", "- for i in range(y, x + 1):", "- cost = i * ab + (x - i) * a", "- res = min(res, cost)", "+import sys", "+", "+sys.setrecursionlimit(10**7)", "+input = sys.stdin.readline", "+f_inf = float(\"inf\")", "+mod = 10**9 + 7", "+", "+", "+def resolve():", "+ a, b, c, x, y = list(map(int, input().split()))", "+ c *= 2", "+ if a + b > c:", "+ cost1 = max(x, y) * c", "+ cost2 = min(x, y) * c", "+ plus = ((y - x) * b) if x < y else (x - y) * a", "+ res = min(cost1, cost2 + plus)", "- for i in range(x, y + 1):", "- cost = i * ab + (y - i) * b", "- res = min(res, cost)", "-print(res)", "+ res = x * a + y * b", "+ print(res)", "+", "+", "+if __name__ == \"__main__\":", "+ resolve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3014842281, "measured_runtime_v1": 0.1645996099, "runtime_lift": 1.8316217662, "key": ["s775348159", "s575049266"]} +{"user_id": "u291766461", "problem_id": "p03074", "language": "python", "submission_id_v0": "s221518045", "submission_id_v1": "s305948108", "cpu_time_v0": 149, "cpu_time_v1": 123, "memory_v0": 4212, "memory_v1": 7884, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.45, "input": "N, K = list(map(int, input().split()))\n\nS = input()\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\nleft = 0\n\nright = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n\n\n next_left = i\n\n next_right = min(i + add, len(nums))\n\n\n\n while next_left > left:\n\n tmp -= nums[left]\n\n left += 1\n\n\n\n while next_right > right:\n\n tmp += nums[right]\n\n right += 1\n\n\n\n ans = max(ans, tmp)\n\nprint(ans)", "target": "N, K = list(map(int, input().split()))\n\nS = input()\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\ncsum = [0] * (len(nums) + 1)\n\nfor i in range(len(nums)):\n\n csum[i + 1] = csum[i] + nums[i]\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n left = i\n\n right = min(i + add, len(nums))\n\n tmp = csum[right] - csum[left]\n\n ans = max(ans, tmp)\n\nprint(ans)", "code_v0_loc": 37, "code_v1_loc": 30, "code_v0_num_chars": 647, "code_v1_num_chars": 587, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nS = input()\nnums = []\nnow = 1\ncnt = 0\nfor i in range(N):\n if S[i] == str(now):\n cnt += 1\n else:\n nums.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:\n nums.append(cnt)\nif len(nums) % 2 == 0:\n nums.append(0)\nadd = 2 * K + 1\nans = 0\nleft = 0\nright = 0\ntmp = 0\nfor i in range(0, len(nums), 2):\n next_left = i\n next_right = min(i + add, len(nums))\n while next_left > left:\n tmp -= nums[left]\n left += 1\n while next_right > right:\n tmp += nums[right]\n right += 1\n ans = max(ans, tmp)\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nS = input()\nnums = []\nnow = 1\ncnt = 0\nfor i in range(N):\n if S[i] == str(now):\n cnt += 1\n else:\n nums.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:\n nums.append(cnt)\nif len(nums) % 2 == 0:\n nums.append(0)\ncsum = [0] * (len(nums) + 1)\nfor i in range(len(nums)):\n csum[i + 1] = csum[i] + nums[i]\nadd = 2 * K + 1\nans = 0\ntmp = 0\nfor i in range(0, len(nums), 2):\n left = i\n right = min(i + add, len(nums))\n tmp = csum[right] - csum[left]\n ans = max(ans, tmp)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 18.9189189189, "diff": ["+csum = [0] * (len(nums) + 1)", "+for i in range(len(nums)):", "+ csum[i + 1] = csum[i] + nums[i]", "-left = 0", "-right = 0", "- next_left = i", "- next_right = min(i + add, len(nums))", "- while next_left > left:", "- tmp -= nums[left]", "- left += 1", "- while next_right > right:", "- tmp += nums[right]", "- right += 1", "+ left = i", "+ right = min(i + add, len(nums))", "+ tmp = csum[right] - csum[left]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2166490428, "measured_runtime_v1": 0.0894378448, "runtime_lift": 2.422341945, "key": ["s221518045", "s305948108"]} +{"user_id": "u670180528", "problem_id": "p03253", "language": "python", "submission_id_v0": "s289323588", "submission_id_v1": "s397757622", "cpu_time_v0": 97, "cpu_time_v1": 24, "memory_v0": 11252, "memory_v1": 3564, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.26, "input": "from collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:\n\n\t\treturn [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn //= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:\n\n\t\tret.append(n)\n\n\treturn ret\n\n\n\nn,m = list(map(int,input().split()))\n\nmod = 10**9+7\n\nif m==1:\n\n\tprint((1));exit()\n\n\n\nfactors = Counter(factorization(m))\n\nmx = n+max(factors.values())\n\n\n\nfac = [1]*(mx+1)\n\ninv = [1]*(mx+1)\n\nfor i in range(1,mx+1):\n\n\tfac[i] = fac[i-1] * i % mod\n\ninv[-1] = pow(fac[-1], mod - 2, mod)\n\nfor i in range(mx-1, -1, -1):\n\n\tinv[i] = inv[i+1] * (i+1) % mod\n\ndef cmb(n,r):\n\n\tassert n >= r >= 0\n\n\treturn fac[n] * inv[n-r] * inv[r] % mod\n\n\t\n\nans=1\n\nfor v in list(factors.values()):\n\n\tans*=cmb(n+v-1,v)\n\n\tans%=mod\n\n\n\nprint(ans)", "target": "from collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:return [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn //= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:ret.append(n)\n\n\treturn ret\n\n\t\n\nfrom operator import mul\n\nfrom functools import reduce\n\ndef cmb(n,r):\n\n\tif n < r:return 0\n\n\tr = min(n-r,r)\n\n\tif r==0:return 1\n\n\tu = reduce(mul, list(range(n, n-r, -1)))\n\n\td = reduce(mul, list(range(1,r+1)))\n\n\treturn u//d\n\n\n\ndef main():\n\n\tn,m = list(map(int,input().split()))\n\n\tmod = 10**9+7\n\n\tif m==1:\n\n\t\tprint((1))\n\n\t\texit()\n\n\tans=1\n\n\tfor v in list(Counter(factorization(m)).values()):\n\n\t\tans*=cmb(n+v-1,v)\n\n\t\tans%=mod\n\n\tprint(ans)\n\n\t\n\nif __name__==\"__main__\":main()", "code_v0_loc": 40, "code_v1_loc": 36, "code_v0_num_chars": 723, "code_v1_num_chars": 658, "code_v0_no_empty_lines": "from collections import Counter\n\n\ndef factorization(n) -> list:\n if n == 1:\n return [1]\n ret = []\n i = 2\n while i * i <= n:\n while n % i == 0:\n n //= i\n ret.append(i)\n i += 1\n if n != 1:\n ret.append(n)\n return ret\n\n\nn, m = list(map(int, input().split()))\nmod = 10**9 + 7\nif m == 1:\n print((1))\n exit()\nfactors = Counter(factorization(m))\nmx = n + max(factors.values())\nfac = [1] * (mx + 1)\ninv = [1] * (mx + 1)\nfor i in range(1, mx + 1):\n fac[i] = fac[i - 1] * i % mod\ninv[-1] = pow(fac[-1], mod - 2, mod)\nfor i in range(mx - 1, -1, -1):\n inv[i] = inv[i + 1] * (i + 1) % mod\n\n\ndef cmb(n, r):\n assert n >= r >= 0\n return fac[n] * inv[n - r] * inv[r] % mod\n\n\nans = 1\nfor v in list(factors.values()):\n ans *= cmb(n + v - 1, v)\n ans %= mod\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import Counter\n\n\ndef factorization(n) -> list:\n if n == 1:\n return [1]\n ret = []\n i = 2\n while i * i <= n:\n while n % i == 0:\n n //= i\n ret.append(i)\n i += 1\n if n != 1:\n ret.append(n)\n return ret\n\n\nfrom operator import mul\nfrom functools import reduce\n\n\ndef cmb(n, r):\n if n < r:\n return 0\n r = min(n - r, r)\n if r == 0:\n return 1\n u = reduce(mul, list(range(n, n - r, -1)))\n d = reduce(mul, list(range(1, r + 1)))\n return u // d\n\n\ndef main():\n n, m = list(map(int, input().split()))\n mod = 10**9 + 7\n if m == 1:\n print((1))\n exit()\n ans = 1\n for v in list(Counter(factorization(m)).values()):\n ans *= cmb(n + v - 1, v)\n ans %= mod\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-n, m = list(map(int, input().split()))", "-mod = 10**9 + 7", "-if m == 1:", "- print((1))", "- exit()", "-factors = Counter(factorization(m))", "-mx = n + max(factors.values())", "-fac = [1] * (mx + 1)", "-inv = [1] * (mx + 1)", "-for i in range(1, mx + 1):", "- fac[i] = fac[i - 1] * i % mod", "-inv[-1] = pow(fac[-1], mod - 2, mod)", "-for i in range(mx - 1, -1, -1):", "- inv[i] = inv[i + 1] * (i + 1) % mod", "+from operator import mul", "+from functools import reduce", "- assert n >= r >= 0", "- return fac[n] * inv[n - r] * inv[r] % mod", "+ if n < r:", "+ return 0", "+ r = min(n - r, r)", "+ if r == 0:", "+ return 1", "+ u = reduce(mul, list(range(n, n - r, -1)))", "+ d = reduce(mul, list(range(1, r + 1)))", "+ return u // d", "-ans = 1", "-for v in list(factors.values()):", "- ans *= cmb(n + v - 1, v)", "- ans %= mod", "-print(ans)", "+def main():", "+ n, m = list(map(int, input().split()))", "+ mod = 10**9 + 7", "+ if m == 1:", "+ print((1))", "+ exit()", "+ ans = 1", "+ for v in list(Counter(factorization(m)).values()):", "+ ans *= cmb(n + v - 1, v)", "+ ans %= mod", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4340592513, "measured_runtime_v1": 0.2881658652, "runtime_lift": 1.5062826786, "key": ["s289323588", "s397757622"]} +{"user_id": "u738622346", "problem_id": "p03854", "language": "python", "submission_id_v0": "s146499990", "submission_id_v1": "s321967328", "cpu_time_v0": 123, "cpu_time_v1": 50, "memory_v0": 3316, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.35, "input": "s = input()\n\nt = \"\"\n\nwhile len(t) < len(s):\n\n target_len = len(s) - len(t)\n\n\n\n if s[len(t)] == 'd':\n\n if target_len == 5:\n\n t += \"dream\"\n\n elif target_len == 7:\n\n t += \"dreamer\"\n\n elif target_len > 7:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 7 + 1] != \"era\":\n\n t += \"dreamer\"\n\n else:\n\n t += \"dream\"\n\n else:\n\n break\n\n else:\n\n if target_len == 5:\n\n t += \"erase\"\n\n elif target_len == 6:\n\n t += \"eraser\"\n\n elif target_len > 6:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 6 + 2] != \"era\":\n\n t += \"eraser\"\n\n else:\n\n t += \"erase\"\n\n else:\n\n break\n\n\n\n if s[0:len(t)] != t:\n\n break\n\n\n\nprint((\"YES\" if s == t else \"NO\"))\n", "target": "s = input()\n\ndiv = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\n\nrev = []\n\nt = \"\"\n\ns_rev = s[::-1]\n\nfor d in div:\n\n rev.append(d[::-1])\n\n\n\nresult = True\n\ni = 0\n\nwhile i < len(s):\n\n can_divide = False\n\n for d in rev:\n\n if len(s_rev) - i >= len(d) and s_rev[i:i + len(d)] == d:\n\n can_divide = True\n\n i += len(d)\n\n break\n\n if not can_divide:\n\n result = False\n\n break\n\n\n\nprint((\"YES\" if result else \"NO\"))\n", "code_v0_loc": 34, "code_v1_loc": 22, "code_v0_num_chars": 872, "code_v1_num_chars": 461, "code_v0_no_empty_lines": "s = input()\nt = \"\"\nwhile len(t) < len(s):\n target_len = len(s) - len(t)\n if s[len(t)] == \"d\":\n if target_len == 5:\n t += \"dream\"\n elif target_len == 7:\n t += \"dreamer\"\n elif target_len > 7:\n if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 7 + 1] != \"era\":\n t += \"dreamer\"\n else:\n t += \"dream\"\n else:\n break\n else:\n if target_len == 5:\n t += \"erase\"\n elif target_len == 6:\n t += \"eraser\"\n elif target_len > 6:\n if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 6 + 2] != \"era\":\n t += \"eraser\"\n else:\n t += \"erase\"\n else:\n break\n if s[0 : len(t)] != t:\n break\nprint((\"YES\" if s == t else \"NO\"))\n", "code_v1_no_empty_lines": "s = input()\ndiv = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nrev = []\nt = \"\"\ns_rev = s[::-1]\nfor d in div:\n rev.append(d[::-1])\nresult = True\ni = 0\nwhile i < len(s):\n can_divide = False\n for d in rev:\n if len(s_rev) - i >= len(d) and s_rev[i : i + len(d)] == d:\n can_divide = True\n i += len(d)\n break\n if not can_divide:\n result = False\n break\nprint((\"YES\" if result else \"NO\"))\n", "code_same": false, "relative_loc_diff_percent": 35.2941176471, "diff": ["+div = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]", "+rev = []", "-while len(t) < len(s):", "- target_len = len(s) - len(t)", "- if s[len(t)] == \"d\":", "- if target_len == 5:", "- t += \"dream\"", "- elif target_len == 7:", "- t += \"dreamer\"", "- elif target_len > 7:", "- if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 7 + 1] != \"era\":", "- t += \"dreamer\"", "- else:", "- t += \"dream\"", "- else:", "+s_rev = s[::-1]", "+for d in div:", "+ rev.append(d[::-1])", "+result = True", "+i = 0", "+while i < len(s):", "+ can_divide = False", "+ for d in rev:", "+ if len(s_rev) - i >= len(d) and s_rev[i : i + len(d)] == d:", "+ can_divide = True", "+ i += len(d)", "- else:", "- if target_len == 5:", "- t += \"erase\"", "- elif target_len == 6:", "- t += \"eraser\"", "- elif target_len > 6:", "- if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 6 + 2] != \"era\":", "- t += \"eraser\"", "- else:", "- t += \"erase\"", "- else:", "- break", "- if s[0 : len(t)] != t:", "+ if not can_divide:", "+ result = False", "-print((\"YES\" if s == t else \"NO\"))", "+print((\"YES\" if result else \"NO\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3984818382, "measured_runtime_v1": 0.3150180125, "runtime_lift": 1.2649493755, "key": ["s146499990", "s321967328"]} +{"user_id": "u645250356", "problem_id": "p03559", "language": "python", "submission_id_v0": "s643210131", "submission_id_v1": "s973528764", "cpu_time_v0": 585, "cpu_time_v1": 431, "memory_v0": 124300, "memory_v1": 30272, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.32, "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\nA = sorted(inpl())\n\nB = sorted(inpl())\n\nC = sorted(inpl())\n\ncnt = [0] * n\n\nres = 0\n\nfor i,b in enumerate(B):\n\n c = bisect.bisect_left(C,b+1)\n\n cnt[i] = n-c\n\n\n\nacc = [0]\n\nfor x in cnt:\n\n acc += [acc[-1] + x]\n\nsu = sum(cnt) \n\nfor i,a in enumerate(A):\n\n c = bisect.bisect_left(B,a+1)\n\n res += su - acc[c]\n\nprint(res)", "target": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\na = inpl()\n\nb = inpl()\n\nc = inpl()\n\na.sort()\n\nb.sort()\n\nc.sort()\n\nlb = [0] * n\n\nres = 0\n\nfor i in range(n):\n\n tmp = bisect.bisect_right(b,a[i])\n\n if tmp == n: continue\n\n lb[tmp] += 1\n\nllb = list(itertools.accumulate(lb))\n\n# print(lb,llb)\n\nrr = [0] * n\n\nfor i in range(n):\n\n tmp = bisect.bisect_right(c,b[i])\n\n if tmp == n: continue\n\n rr[tmp] += llb[i]\n\nprint((sum(list(itertools.accumulate(rr)))))", "code_v0_loc": 27, "code_v1_loc": 30, "code_v0_num_chars": 662, "code_v1_num_chars": 747, "code_v0_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, math, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = inp()\nA = sorted(inpl())\nB = sorted(inpl())\nC = sorted(inpl())\ncnt = [0] * n\nres = 0\nfor i, b in enumerate(B):\n c = bisect.bisect_left(C, b + 1)\n cnt[i] = n - c\nacc = [0]\nfor x in cnt:\n acc += [acc[-1] + x]\nsu = sum(cnt)\nfor i, a in enumerate(A):\n c = bisect.bisect_left(B, a + 1)\n res += su - acc[c]\nprint(res)\n", "code_v1_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, math, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = inp()\na = inpl()\nb = inpl()\nc = inpl()\na.sort()\nb.sort()\nc.sort()\nlb = [0] * n\nres = 0\nfor i in range(n):\n tmp = bisect.bisect_right(b, a[i])\n if tmp == n:\n continue\n lb[tmp] += 1\nllb = list(itertools.accumulate(lb))\n# print(lb,llb)\nrr = [0] * n\nfor i in range(n):\n tmp = bisect.bisect_right(c, b[i])\n if tmp == n:\n continue\n rr[tmp] += llb[i]\nprint((sum(list(itertools.accumulate(rr)))))\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-A = sorted(inpl())", "-B = sorted(inpl())", "-C = sorted(inpl())", "-cnt = [0] * n", "+a = inpl()", "+b = inpl()", "+c = inpl()", "+a.sort()", "+b.sort()", "+c.sort()", "+lb = [0] * n", "-for i, b in enumerate(B):", "- c = bisect.bisect_left(C, b + 1)", "- cnt[i] = n - c", "-acc = [0]", "-for x in cnt:", "- acc += [acc[-1] + x]", "-su = sum(cnt)", "-for i, a in enumerate(A):", "- c = bisect.bisect_left(B, a + 1)", "- res += su - acc[c]", "-print(res)", "+for i in range(n):", "+ tmp = bisect.bisect_right(b, a[i])", "+ if tmp == n:", "+ continue", "+ lb[tmp] += 1", "+llb = list(itertools.accumulate(lb))", "+# print(lb,llb)", "+rr = [0] * n", "+for i in range(n):", "+ tmp = bisect.bisect_right(c, b[i])", "+ if tmp == n:", "+ continue", "+ rr[tmp] += llb[i]", "+print((sum(list(itertools.accumulate(rr)))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2585086877, "measured_runtime_v1": 0.0062210422, "runtime_lift": 41.5539198783, "key": ["s643210131", "s973528764"]} +{"user_id": "u968166680", "problem_id": "p02814", "language": "python", "submission_id_v0": "s703991862", "submission_id_v1": "s702868581", "cpu_time_v0": 61, "cpu_time_v1": 44, "memory_v0": 13352, "memory_v1": 14092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.87, "input": "import sys\n\nfrom math import gcd\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n A = list(set(map(int, input().split(\" \"))))\n\n A = [a // 2 for a in A]\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a)\n\n if semi_lcm > M:\n\n print((0))\n\n return\n\n\n\n for a in A:\n\n if semi_lcm // a % 2 == 0:\n\n print((0))\n\n return\n\n\n\n print(((M // semi_lcm + 1) // 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n\n\n\n\ndef lcm(a, b):\n\n return a * b // gcd(a, b)\n\n\n\n\n\ndef main():\n\n N, M, *A = list(map(int, read().split()))\n\n A = list(set(A))\n\n B = A.copy()\n\n\n\n while not any(b % 2 for b in B):\n\n B = [b // 2 for b in B]\n\n\n\n if not all(b % 2 for b in B):\n\n print((0))\n\n return\n\n\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a // 2)\n\n\n\n print(((M // semi_lcm + 1) // 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 36, "code_v1_loc": 41, "code_v0_num_chars": 690, "code_v1_num_chars": 687, "code_v0_no_empty_lines": "import sys\nfrom math import gcd\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef lcm(x, y):\n return x * y // gcd(x, y)\n\n\ndef main():\n N, M = list(map(int, input().split()))\n A = list(set(map(int, input().split(\" \"))))\n A = [a // 2 for a in A]\n semi_lcm = 1\n for a in A:\n semi_lcm = lcm(semi_lcm, a)\n if semi_lcm > M:\n print((0))\n return\n for a in A:\n if semi_lcm // a % 2 == 0:\n print((0))\n return\n print(((M // semi_lcm + 1) // 2))\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\ndef main():\n N, M, *A = list(map(int, read().split()))\n A = list(set(A))\n B = A.copy()\n while not any(b % 2 for b in B):\n B = [b // 2 for b in B]\n if not all(b % 2 for b in B):\n print((0))\n return\n semi_lcm = 1\n for a in A:\n semi_lcm = lcm(semi_lcm, a // 2)\n print(((M // semi_lcm + 1) // 2))\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 12.1951219512, "diff": ["-from math import gcd", "-def lcm(x, y):", "- return x * y // gcd(x, y)", "+def gcd(a, b):", "+ while b:", "+ a, b = b, a % b", "+ return a", "+", "+", "+def lcm(a, b):", "+ return a * b // gcd(a, b)", "- N, M = list(map(int, input().split()))", "- A = list(set(map(int, input().split(\" \"))))", "- A = [a // 2 for a in A]", "+ N, M, *A = list(map(int, read().split()))", "+ A = list(set(A))", "+ B = A.copy()", "+ while not any(b % 2 for b in B):", "+ B = [b // 2 for b in B]", "+ if not all(b % 2 for b in B):", "+ print((0))", "+ return", "- semi_lcm = lcm(semi_lcm, a)", "- if semi_lcm > M:", "- print((0))", "- return", "- for a in A:", "- if semi_lcm // a % 2 == 0:", "- print((0))", "- return", "+ semi_lcm = lcm(semi_lcm, a // 2)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.284781249, "measured_runtime_v1": 0.212113862, "runtime_lift": 1.3425866952, "key": ["s703991862", "s702868581"]} +{"user_id": "u391731808", "problem_id": "p03634", "language": "python", "submission_id_v0": "s145761901", "submission_id_v1": "s949294302", "cpu_time_v0": 1740, "cpu_time_v1": 1056, "memory_v0": 98856, "memory_v1": 98636, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.31, "input": "import heapq\n\n\n\nN = int(input())\n\nabc = [list(map(int,input().split())) for _ in range(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nxy = [list(map(int,input().split())) for _ in range(Q)]\n\n\n\nconnect = [[] for _ in range(N)]\n\nINFTY = 10**15\n\nfor a,b,c in abc:\n\n connect[a-1].append([b-1,c])\n\n connect[b-1].append([a-1,c])\n\n\n\ncost = [[INFTY,False] for _ in range(N)]\n\ncost[K-1][0] = 0\n\nq = [(0,K-1)]\n\nwhile q:\n\n _,i = heapq.heappop(q)\n\n if cost[i][1]:\n\n continue\n\n cost[i][1] = True\n\n ci0 = cost[i][0]\n\n for j,c in connect[i]:\n\n if cost[j][1]:\n\n continue\n\n tmp_cost = ci0+c\n\n if tmp_cost < cost[j][0]:\n\n cost[j][0] = tmp_cost\n\n heapq.heappush(q,(tmp_cost,j))\n\n\n\nfor x,y in xy:\n\n print((cost[x-1][0] + cost[y-1][0]))", "target": "N = int(input())\n\nABC = [list(map(int,input().split())) for _ in [0]*(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nXY = [list(map(int,input().split())) for _ in [0]*Q]\n\n\n\nE = [{} for _ in [0]*N]\n\nfor a,b,c in ABC:\n\n E[a-1][b-1] = c\n\n E[b-1][a-1] = c\n\n\n\ndef dist_dfs_tree(N,E,start):\n\n d = [-1]*N\n\n d[start] = 0\n\n q = [start]\n\n while q:\n\n i = q.pop()\n\n ci = d[i]\n\n for j,cj in list(E[i].items()):\n\n if d[j] !=-1:continue\n\n d[j] = ci+cj\n\n q.append(j)\n\n return d\n\n\n\nd = dist_dfs_tree(N,E,K-1)\n\nfor x,y in XY:\n\n print((d[x-1]+d[y-1]))", "code_v0_loc": 32, "code_v1_loc": 26, "code_v0_num_chars": 797, "code_v1_num_chars": 594, "code_v0_no_empty_lines": "import heapq\n\nN = int(input())\nabc = [list(map(int, input().split())) for _ in range(N - 1)]\nQ, K = list(map(int, input().split()))\nxy = [list(map(int, input().split())) for _ in range(Q)]\nconnect = [[] for _ in range(N)]\nINFTY = 10**15\nfor a, b, c in abc:\n connect[a - 1].append([b - 1, c])\n connect[b - 1].append([a - 1, c])\ncost = [[INFTY, False] for _ in range(N)]\ncost[K - 1][0] = 0\nq = [(0, K - 1)]\nwhile q:\n _, i = heapq.heappop(q)\n if cost[i][1]:\n continue\n cost[i][1] = True\n ci0 = cost[i][0]\n for j, c in connect[i]:\n if cost[j][1]:\n continue\n tmp_cost = ci0 + c\n if tmp_cost < cost[j][0]:\n cost[j][0] = tmp_cost\n heapq.heappush(q, (tmp_cost, j))\nfor x, y in xy:\n print((cost[x - 1][0] + cost[y - 1][0]))\n", "code_v1_no_empty_lines": "N = int(input())\nABC = [list(map(int, input().split())) for _ in [0] * (N - 1)]\nQ, K = list(map(int, input().split()))\nXY = [list(map(int, input().split())) for _ in [0] * Q]\nE = [{} for _ in [0] * N]\nfor a, b, c in ABC:\n E[a - 1][b - 1] = c\n E[b - 1][a - 1] = c\n\n\ndef dist_dfs_tree(N, E, start):\n d = [-1] * N\n d[start] = 0\n q = [start]\n while q:\n i = q.pop()\n ci = d[i]\n for j, cj in list(E[i].items()):\n if d[j] != -1:\n continue\n d[j] = ci + cj\n q.append(j)\n return d\n\n\nd = dist_dfs_tree(N, E, K - 1)\nfor x, y in XY:\n print((d[x - 1] + d[y - 1]))\n", "code_same": false, "relative_loc_diff_percent": 18.75, "diff": ["-import heapq", "+N = int(input())", "+ABC = [list(map(int, input().split())) for _ in [0] * (N - 1)]", "+Q, K = list(map(int, input().split()))", "+XY = [list(map(int, input().split())) for _ in [0] * Q]", "+E = [{} for _ in [0] * N]", "+for a, b, c in ABC:", "+ E[a - 1][b - 1] = c", "+ E[b - 1][a - 1] = c", "-N = int(input())", "-abc = [list(map(int, input().split())) for _ in range(N - 1)]", "-Q, K = list(map(int, input().split()))", "-xy = [list(map(int, input().split())) for _ in range(Q)]", "-connect = [[] for _ in range(N)]", "-INFTY = 10**15", "-for a, b, c in abc:", "- connect[a - 1].append([b - 1, c])", "- connect[b - 1].append([a - 1, c])", "-cost = [[INFTY, False] for _ in range(N)]", "-cost[K - 1][0] = 0", "-q = [(0, K - 1)]", "-while q:", "- _, i = heapq.heappop(q)", "- if cost[i][1]:", "- continue", "- cost[i][1] = True", "- ci0 = cost[i][0]", "- for j, c in connect[i]:", "- if cost[j][1]:", "- continue", "- tmp_cost = ci0 + c", "- if tmp_cost < cost[j][0]:", "- cost[j][0] = tmp_cost", "- heapq.heappush(q, (tmp_cost, j))", "-for x, y in xy:", "- print((cost[x - 1][0] + cost[y - 1][0]))", "+", "+def dist_dfs_tree(N, E, start):", "+ d = [-1] * N", "+ d[start] = 0", "+ q = [start]", "+ while q:", "+ i = q.pop()", "+ ci = d[i]", "+ for j, cj in list(E[i].items()):", "+ if d[j] != -1:", "+ continue", "+ d[j] = ci + cj", "+ q.append(j)", "+ return d", "+", "+", "+d = dist_dfs_tree(N, E, K - 1)", "+for x, y in XY:", "+ print((d[x - 1] + d[y - 1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2932223577, "measured_runtime_v1": 0.2194568303, "runtime_lift": 1.3361277359, "key": ["s145761901", "s949294302"]} +{"user_id": "u036104576", "problem_id": "p02814", "language": "python", "submission_id_v0": "s934732087", "submission_id_v1": "s059526149", "cpu_time_v0": 249, "cpu_time_v1": 174, "memory_v0": 14544, "memory_v1": 90620, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.12, "input": "import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\n \n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nfrom collections import defaultdict\n\n \n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n \n\n \n\nfrom functools import reduce\n\n# from math import *\n\nfrom math import *\n\nN, M = list(map(int, readline().split()))\n\nA = list(sorted([int(x) // 2 for x in readline().split()]))\n\nmin_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)\n\n \n\n# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))\n\nif not all([(min_cm // x) % 2 == 1 for x in A]):\n\n print((0))\n\n exit(0)\n\nif min_cm > M:\n\n print((0))\n\n exit(0)\n\nans = (M // min_cm + 1) // 2\n\nprint(ans)", "target": "import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\nimport heapq\n\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nINF = 10 ** 9 + 7\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n# map(int, input().split())\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) // 2 for x in input().split()])\n\n\n\ndef f(n):\n\n res = 0\n\n while n % 2 == 0:\n\n n //= 2\n\n res += 1\n\n return res\n\n\n\ndef gcd(a, b):\n\n if b == 0:\n\n return a\n\n return gcd(b, a % b)\n\n\n\nx = f(A[0])\n\nfor a in A:\n\n y = f(a)\n\n if y != x:\n\n print((0))\n\n exit()\n\n\n\nlcm = A[0]\n\nfor i in range(1, N):\n\n lcm = lcm * A[i] // gcd(lcm, A[i])\n\n\n\nprint(((M // lcm + 1) // 2))", "code_v0_loc": 31, "code_v1_loc": 43, "code_v0_num_chars": 729, "code_v1_num_chars": 789, "code_v0_no_empty_lines": "import sys\nimport itertools\n\n# import numpy as np\nimport time\nimport math\n\nsys.setrecursionlimit(10**7)\nfrom collections import defaultdict\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom functools import reduce\n\n# from math import *\nfrom math import *\n\nN, M = list(map(int, readline().split()))\nA = list(sorted([int(x) // 2 for x in readline().split()]))\nmin_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)\n# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))\nif not all([(min_cm // x) % 2 == 1 for x in A]):\n print((0))\n exit(0)\nif min_cm > M:\n print((0))\n exit(0)\nans = (M // min_cm + 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\nimport itertools\n\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**7)\nINF = 10**9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n# map(int, input().split())\nN, M = list(map(int, input().split()))\nA = list([int(x) // 2 for x in input().split()])\n\n\ndef f(n):\n res = 0\n while n % 2 == 0:\n n //= 2\n res += 1\n return res\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\nx = f(A[0])\nfor a in A:\n y = f(a)\n if y != x:\n print((0))\n exit()\nlcm = A[0]\nfor i in range(1, N):\n lcm = lcm * A[i] // gcd(lcm, A[i])\nprint(((M // lcm + 1) // 2))\n", "code_same": false, "relative_loc_diff_percent": 27.9069767442, "diff": ["+import heapq", "+from collections import defaultdict", "-from collections import defaultdict", "-", "+INF = 10**9 + 7", "-from functools import reduce", "+# map(int, input().split())", "+N, M = list(map(int, input().split()))", "+A = list([int(x) // 2 for x in input().split()])", "-# from math import *", "-from math import *", "-N, M = list(map(int, readline().split()))", "-A = list(sorted([int(x) // 2 for x in readline().split()]))", "-min_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)", "-# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))", "-if not all([(min_cm // x) % 2 == 1 for x in A]):", "- print((0))", "- exit(0)", "-if min_cm > M:", "- print((0))", "- exit(0)", "-ans = (M // min_cm + 1) // 2", "-print(ans)", "+def f(n):", "+ res = 0", "+ while n % 2 == 0:", "+ n //= 2", "+ res += 1", "+ return res", "+", "+", "+def gcd(a, b):", "+ if b == 0:", "+ return a", "+ return gcd(b, a % b)", "+", "+", "+x = f(A[0])", "+for a in A:", "+ y = f(a)", "+ if y != x:", "+ print((0))", "+ exit()", "+lcm = A[0]", "+for i in range(1, N):", "+ lcm = lcm * A[i] // gcd(lcm, A[i])", "+print(((M // lcm + 1) // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.414138025, "measured_runtime_v1": 0.277947119, "runtime_lift": 1.4899885508, "key": ["s934732087", "s059526149"]} +{"user_id": "u970197315", "problem_id": "p02814", "language": "python", "submission_id_v0": "s991587805", "submission_id_v1": "s856136819", "cpu_time_v0": 253, "cpu_time_v1": 206, "memory_v0": 16276, "memory_v1": 20232, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.58, "input": "# ABC150 D\n\nsi = lambda: input()\n\nni = lambda: int(input())\n\nnm = lambda: list(map(int, input().split()))\n\nnl = lambda: list(map(int, input().split()))\n\nfrom math import gcd\n\nfrom math import ceil\n\ndef lcm(x, y):\n\n return (x * y) // gcd(x, y)\n\nn,m=nm()\n\na=nl()\n\nans=0\n\na=[x//2 for x in a] \n\n\n\nlcm_v=a[0]\n\nfor i in range(n):\n\n lcm_v=lcm(lcm_v,a[i])\n\nok_flg=[(lcm_v//i)%2==1 for i in a]\n\nif all(ok_flg):\n\n ans=((m//lcm_v)+1)//2\n\nprint(ans)\n\n\n", "target": "from math import gcd, ceil\n\n\n\n\n\ndef lcm(a, b):\n\n return (a*b)//gcd(a, b)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\nfor i in range(n):\n\n a[i] = a[i]//2\n\n\n\nlcm_v = a[0]\n\nfor i in range(1, n):\n\n lcm_v = lcm(lcm_v, a[i])\n\n\n\nok = True\n\nfor aa in a:\n\n if (lcm_v//aa) % 2 != 1:\n\n ok = False\n\n break\n\nans = 0\n\nif ok:\n\n ans = ((m//lcm_v)+1)//2\n\nprint(ans)\n", "code_v0_loc": 22, "code_v1_loc": 26, "code_v0_num_chars": 448, "code_v1_num_chars": 412, "code_v0_no_empty_lines": "# ABC150 D\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: list(map(int, input().split()))\nnl = lambda: list(map(int, input().split()))\nfrom math import gcd\nfrom math import ceil\n\n\ndef lcm(x, y):\n return (x * y) // gcd(x, y)\n\n\nn, m = nm()\na = nl()\nans = 0\na = [x // 2 for x in a]\nlcm_v = a[0]\nfor i in range(n):\n lcm_v = lcm(lcm_v, a[i])\nok_flg = [(lcm_v // i) % 2 == 1 for i in a]\nif all(ok_flg):\n ans = ((m // lcm_v) + 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "from math import gcd, ceil\n\n\ndef lcm(a, b):\n return (a * b) // gcd(a, b)\n\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nfor i in range(n):\n a[i] = a[i] // 2\nlcm_v = a[0]\nfor i in range(1, n):\n lcm_v = lcm(lcm_v, a[i])\nok = True\nfor aa in a:\n if (lcm_v // aa) % 2 != 1:\n ok = False\n break\nans = 0\nif ok:\n ans = ((m // lcm_v) + 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["-# ABC150 D", "-si = lambda: input()", "-ni = lambda: int(input())", "-nm = lambda: list(map(int, input().split()))", "-nl = lambda: list(map(int, input().split()))", "-from math import gcd", "-from math import ceil", "+from math import gcd, ceil", "-def lcm(x, y):", "- return (x * y) // gcd(x, y)", "+def lcm(a, b):", "+ return (a * b) // gcd(a, b)", "-n, m = nm()", "-a = nl()", "+n, m = list(map(int, input().split()))", "+a = list(map(int, input().split()))", "+for i in range(n):", "+ a[i] = a[i] // 2", "+lcm_v = a[0]", "+for i in range(1, n):", "+ lcm_v = lcm(lcm_v, a[i])", "+ok = True", "+for aa in a:", "+ if (lcm_v // aa) % 2 != 1:", "+ ok = False", "+ break", "-a = [x // 2 for x in a]", "-lcm_v = a[0]", "-for i in range(n):", "- lcm_v = lcm(lcm_v, a[i])", "-ok_flg = [(lcm_v // i) % 2 == 1 for i in a]", "-if all(ok_flg):", "+if ok:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4063324592, "measured_runtime_v1": 0.2545481203, "runtime_lift": 1.5962893726, "key": ["s991587805", "s856136819"]} +{"user_id": "u400765446", "problem_id": "p02412", "language": "python", "submission_id_v0": "s921182397", "submission_id_v1": "s148735991", "cpu_time_v0": 320, "cpu_time_v1": 20, "memory_v0": 5600, "memory_v1": 5600, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 93.75, "input": "def main():\n\n\n\n while True:\n\n n, x = tuple(map(int, input().split()))\n\n pattern = 0\n\n\n\n if n == x == 0:\n\n break\n\n else:\n\n for a in range(1, n+1):\n\n for b in range(1, a):\n\n for c in range(1, b):\n\n pattern += 1 if a + b + c == x and a > b > c else 0\n\n print(pattern)\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def divide_two(c, z):\n\n min_b = z // 2 + 1\n\n max_b = min(c-1, z-1)\n\n return max(max_b-min_b+1, 0)\n\n \n\n\n\nnum_set = []\n\ncnt = 0\n\nwhile True:\n\n n, x = list(map(int, input().split()))\n\n if (n, x) == (0, 0):\n\n break\n\n else:\n\n num_set.append((n, x))\n\n cnt += 1\n\n\n\nfor i in range(cnt):\n\n num_count = 0\n\n (n, x) = num_set[i]\n\n for c in range(x//3, n+1):\n\n num_count += divide_two(c, x-c)\n\n print(num_count)\n", "code_v0_loc": 18, "code_v1_loc": 22, "code_v0_num_chars": 458, "code_v1_num_chars": 454, "code_v0_no_empty_lines": "def main():\n while True:\n n, x = tuple(map(int, input().split()))\n pattern = 0\n if n == x == 0:\n break\n else:\n for a in range(1, n + 1):\n for b in range(1, a):\n for c in range(1, b):\n pattern += 1 if a + b + c == x and a > b > c else 0\n print(pattern)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def divide_two(c, z):\n min_b = z // 2 + 1\n max_b = min(c - 1, z - 1)\n return max(max_b - min_b + 1, 0)\n\n\nnum_set = []\ncnt = 0\nwhile True:\n n, x = list(map(int, input().split()))\n if (n, x) == (0, 0):\n break\n else:\n num_set.append((n, x))\n cnt += 1\nfor i in range(cnt):\n num_count = 0\n (n, x) = num_set[i]\n for c in range(x // 3, n + 1):\n num_count += divide_two(c, x - c)\n print(num_count)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-def main():", "- while True:", "- n, x = tuple(map(int, input().split()))", "- pattern = 0", "- if n == x == 0:", "- break", "- else:", "- for a in range(1, n + 1):", "- for b in range(1, a):", "- for c in range(1, b):", "- pattern += 1 if a + b + c == x and a > b > c else 0", "- print(pattern)", "+def divide_two(c, z):", "+ min_b = z // 2 + 1", "+ max_b = min(c - 1, z - 1)", "+ return max(max_b - min_b + 1, 0)", "-if __name__ == \"__main__\":", "- main()", "+num_set = []", "+cnt = 0", "+while True:", "+ n, x = list(map(int, input().split()))", "+ if (n, x) == (0, 0):", "+ break", "+ else:", "+ num_set.append((n, x))", "+ cnt += 1", "+for i in range(cnt):", "+ num_count = 0", "+ (n, x) = num_set[i]", "+ for c in range(x // 3, n + 1):", "+ num_count += divide_two(c, x - c)", "+ print(num_count)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2920441294, "measured_runtime_v1": 0.2327923727, "runtime_lift": 1.2545261942, "key": ["s921182397", "s148735991"]} +{"user_id": "u634461820", "problem_id": "p02863", "language": "python", "submission_id_v0": "s061535189", "submission_id_v1": "s586045080", "cpu_time_v0": 1058, "cpu_time_v1": 461, "memory_v0": 183896, "memory_v1": 117976, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 56.43, "input": "import sys\n\nfrom operator import itemgetter\n\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return input()\n\n\n\nN, T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort(key=itemgetter(0))\n\n#print(ab)\n\n\n\ndp = [[0]*(T+1+3000+1) for _ in range(N+1)]\n\nans = 0\n\nfor i in range(N):\n\n for j in range(T+1+3000+1):\n\n time, deli = ab[i]\n\n if 0 <= j-time < T:\n\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n\n else:\n\n dp[i + 1][j] = dp[i][j]\n\n ans = max(ans, dp[i + 1][j])\n\nprint(ans)\n\n\n\n#print(dp)\n", "target": "import sys\n\nfrom collections import deque\n\nMAX_INT = int(10e10)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return input()\n\n\n\nN,T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort()\n\n\n\nans = 0\n\ndp = [[0]*T for i in range(N+1)]\n\nfor i in range(1,N+1):\n\n a,b = ab[i-1]\n\n for j in range(T):\n\n if 0 <= j-a < T:\n\n dp[i][j] = max(dp[i-1][j], dp[i-1][j-a] + b)\n\n else:\n\n dp[i][j] = dp[i-1][j]\n\n else:\n\n ans = max(ans, dp[i-1][-1] + b)\n\nprint(ans)", "code_v0_loc": 30, "code_v1_loc": 27, "code_v0_num_chars": 737, "code_v1_num_chars": 620, "code_v0_no_empty_lines": "import sys\nfrom operator import itemgetter\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\nMIN_INT = -MAX_INT\nmod = 1000000007\nsys.setrecursionlimit(1000000)\n\n\ndef IL():\n return list(map(int, input().split()))\n\n\ndef SL():\n return input().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\nN, T = IL()\nab = [IL() for i in range(N)]\nab.sort(key=itemgetter(0))\n# print(ab)\ndp = [[0] * (T + 1 + 3000 + 1) for _ in range(N + 1)]\nans = 0\nfor i in range(N):\n for j in range(T + 1 + 3000 + 1):\n time, deli = ab[i]\n if 0 <= j - time < T:\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n else:\n dp[i + 1][j] = dp[i][j]\n ans = max(ans, dp[i + 1][j])\nprint(ans)\n# print(dp)\n", "code_v1_no_empty_lines": "import sys\nfrom collections import deque\n\nMAX_INT = int(10e10)\nMIN_INT = -MAX_INT\nmod = 1000000007\nsys.setrecursionlimit(1000000)\n\n\ndef IL():\n return list(map(int, input().split()))\n\n\ndef SL():\n return input().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\nN, T = IL()\nab = [IL() for i in range(N)]\nab.sort()\nans = 0\ndp = [[0] * T for i in range(N + 1)]\nfor i in range(1, N + 1):\n a, b = ab[i - 1]\n for j in range(T):\n if 0 <= j - a < T:\n dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a] + b)\n else:\n dp[i][j] = dp[i - 1][j]\n else:\n ans = max(ans, dp[i - 1][-1] + b)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-from operator import itemgetter", "-from heapq import heapify, heappop, heappush", "+from collections import deque", "-MAX_INT = int(10e15)", "+MAX_INT = int(10e10)", "-ab.sort(key=itemgetter(0))", "-# print(ab)", "-dp = [[0] * (T + 1 + 3000 + 1) for _ in range(N + 1)]", "+ab.sort()", "-for i in range(N):", "- for j in range(T + 1 + 3000 + 1):", "- time, deli = ab[i]", "- if 0 <= j - time < T:", "- dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)", "+dp = [[0] * T for i in range(N + 1)]", "+for i in range(1, N + 1):", "+ a, b = ab[i - 1]", "+ for j in range(T):", "+ if 0 <= j - a < T:", "+ dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a] + b)", "- dp[i + 1][j] = dp[i][j]", "- ans = max(ans, dp[i + 1][j])", "+ dp[i][j] = dp[i - 1][j]", "+ else:", "+ ans = max(ans, dp[i - 1][-1] + b)", "-# print(dp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4860900669, "measured_runtime_v1": 0.3545958745, "runtime_lift": 1.3708283197, "key": ["s061535189", "s586045080"]} +{"user_id": "u893063840", "problem_id": "p03801", "language": "python", "submission_id_v0": "s790222372", "submission_id_v1": "s964537161", "cpu_time_v0": 316, "cpu_time_v1": 278, "memory_v0": 40396, "memory_v1": 31800, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.03, "input": "n = int(input())\n\na = list(map(int, input().split()))\n\n\n\ntmp = [[e, n - i] for i, e in enumerate(a)]\n\ntmp.sort(reverse=True)\n\n\n\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\n\n\n\nv_prev, i_prev = aa[0]\n\ni = 0\n\nans = [0] * n\n\nsm = 0\n\nwhile i < n:\n\n while aa[i][1] >= i_prev:\n\n sm += aa[i][0]\n\n i += 1\n\n\n\n ans[i_prev] += sm - aa[i][0] * i\n\n sm = aa[i][0] * i\n\n v_prev, i_prev = aa[i]\n\n\n\nprint(*ans, sep=\"\\n\")\n", "target": "from bisect import bisect_right\n\n\n\nn = int(input())\n\na = list(map(int, input().split()))\n\n\n\nli = [[0, -1]]\n\nfor i, e in enumerate(a):\n\n if e > li[-1][0]:\n\n li.append([e, i])\n\n\n\nli = li[::-1]\n\n\n\na.sort()\n\nacc = [0] * (n + 1)\n\nfor i in range(n - 1, -1, -1):\n\n acc[i] = acc[i+1] + a[i]\n\n\n\nans = [0] * n\n\nsub = 0\n\nans_prev = 0\n\nfor (ep, ip), (e, i) in zip(li, li[1:]):\n\n j = bisect_right(a, e)\n\n ans[ip] = acc[j] - e * (n - j)\n\n\n\ni_prev = 0\n\nfor i in range(1, n):\n\n if ans[i]:\n\n ans[i_prev] -= ans[i]\n\n i_prev = i\n\n\n\nprint(*ans, sep=\"\\n\")\n", "code_v0_loc": 22, "code_v1_loc": 31, "code_v0_num_chars": 431, "code_v1_num_chars": 571, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\ntmp = [[e, n - i] for i, e in enumerate(a)]\ntmp.sort(reverse=True)\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\nv_prev, i_prev = aa[0]\ni = 0\nans = [0] * n\nsm = 0\nwhile i < n:\n while aa[i][1] >= i_prev:\n sm += aa[i][0]\n i += 1\n ans[i_prev] += sm - aa[i][0] * i\n sm = aa[i][0] * i\n v_prev, i_prev = aa[i]\nprint(*ans, sep=\"\\n\")\n", "code_v1_no_empty_lines": "from bisect import bisect_right\n\nn = int(input())\na = list(map(int, input().split()))\nli = [[0, -1]]\nfor i, e in enumerate(a):\n if e > li[-1][0]:\n li.append([e, i])\nli = li[::-1]\na.sort()\nacc = [0] * (n + 1)\nfor i in range(n - 1, -1, -1):\n acc[i] = acc[i + 1] + a[i]\nans = [0] * n\nsub = 0\nans_prev = 0\nfor (ep, ip), (e, i) in zip(li, li[1:]):\n j = bisect_right(a, e)\n ans[ip] = acc[j] - e * (n - j)\ni_prev = 0\nfor i in range(1, n):\n if ans[i]:\n ans[i_prev] -= ans[i]\n i_prev = i\nprint(*ans, sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 29.0322580645, "diff": ["+from bisect import bisect_right", "+", "-tmp = [[e, n - i] for i, e in enumerate(a)]", "-tmp.sort(reverse=True)", "-aa = [[e, n - i] for e, i in tmp] + [[0, -1]]", "-v_prev, i_prev = aa[0]", "-i = 0", "+li = [[0, -1]]", "+for i, e in enumerate(a):", "+ if e > li[-1][0]:", "+ li.append([e, i])", "+li = li[::-1]", "+a.sort()", "+acc = [0] * (n + 1)", "+for i in range(n - 1, -1, -1):", "+ acc[i] = acc[i + 1] + a[i]", "-sm = 0", "-while i < n:", "- while aa[i][1] >= i_prev:", "- sm += aa[i][0]", "- i += 1", "- ans[i_prev] += sm - aa[i][0] * i", "- sm = aa[i][0] * i", "- v_prev, i_prev = aa[i]", "+sub = 0", "+ans_prev = 0", "+for (ep, ip), (e, i) in zip(li, li[1:]):", "+ j = bisect_right(a, e)", "+ ans[ip] = acc[j] - e * (n - j)", "+i_prev = 0", "+for i in range(1, n):", "+ if ans[i]:", "+ ans[i_prev] -= ans[i]", "+ i_prev = i"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2510323788, "measured_runtime_v1": 0.1409289612, "runtime_lift": 1.7812689216, "key": ["s790222372", "s964537161"]} +{"user_id": "u970197315", "problem_id": "p03013", "language": "python", "submission_id_v0": "s479618893", "submission_id_v1": "s899240371", "cpu_time_v0": 212, "cpu_time_v1": 187, "memory_v0": 9612, "memory_v1": 7848, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.79, "input": "N, M = list(map(int, input().split()))\n\nA_ = [int(input()) for _ in range(M)]\n\nA = [0] * (N+3)\n\nfor a in A_:\n\n A[a] = 1\n\ndp = [0] * (N+3)\n\ndp[0] = 1\n\n\n\nmod = 10**9+7\n\n\n\nfor i in range(1, N+1):\n\n if A[i-1] == 0:\n\n dp[i] += dp[i-1]\n\n if A[i-2] == 0:\n\n dp[i] += dp[i-2]\n\n dp[i] %= mod\n\nprint((dp[N]))", "target": "n,m=list(map(int,input().split()))\n\ndp=[0]*(n+3)\n\na=[int(input()) for i in range(m)]\n\nmod=10**9+7\n\nfor i in range(m):\n\n dp[a[i]]=-1\n\n\n\ndp[0]=1\n\nif dp[1]!=-1:\n\n dp[1]+=dp[0]\n\n\n\nfor i in range(n+1):\n\n if dp[i+2]==-1:\n\n continue\n\n if dp[i]!=-1:\n\n dp[i+2]+=dp[i]\n\n if dp[i+1]!=-1:\n\n dp[i+2]+=dp[i+1]\n\n dp[i+2]%=mod\n\nprint((dp[n]%mod))", "code_v0_loc": 17, "code_v1_loc": 20, "code_v0_num_chars": 315, "code_v1_num_chars": 361, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nA_ = [int(input()) for _ in range(M)]\nA = [0] * (N + 3)\nfor a in A_:\n A[a] = 1\ndp = [0] * (N + 3)\ndp[0] = 1\nmod = 10**9 + 7\nfor i in range(1, N + 1):\n if A[i - 1] == 0:\n dp[i] += dp[i - 1]\n if A[i - 2] == 0:\n dp[i] += dp[i - 2]\n dp[i] %= mod\nprint((dp[N]))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\ndp = [0] * (n + 3)\na = [int(input()) for i in range(m)]\nmod = 10**9 + 7\nfor i in range(m):\n dp[a[i]] = -1\ndp[0] = 1\nif dp[1] != -1:\n dp[1] += dp[0]\nfor i in range(n + 1):\n if dp[i + 2] == -1:\n continue\n if dp[i] != -1:\n dp[i + 2] += dp[i]\n if dp[i + 1] != -1:\n dp[i + 2] += dp[i + 1]\n dp[i + 2] %= mod\nprint((dp[n] % mod))\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["-N, M = list(map(int, input().split()))", "-A_ = [int(input()) for _ in range(M)]", "-A = [0] * (N + 3)", "-for a in A_:", "- A[a] = 1", "-dp = [0] * (N + 3)", "+n, m = list(map(int, input().split()))", "+dp = [0] * (n + 3)", "+a = [int(input()) for i in range(m)]", "+mod = 10**9 + 7", "+for i in range(m):", "+ dp[a[i]] = -1", "-mod = 10**9 + 7", "-for i in range(1, N + 1):", "- if A[i - 1] == 0:", "- dp[i] += dp[i - 1]", "- if A[i - 2] == 0:", "- dp[i] += dp[i - 2]", "- dp[i] %= mod", "-print((dp[N]))", "+if dp[1] != -1:", "+ dp[1] += dp[0]", "+for i in range(n + 1):", "+ if dp[i + 2] == -1:", "+ continue", "+ if dp[i] != -1:", "+ dp[i + 2] += dp[i]", "+ if dp[i + 1] != -1:", "+ dp[i + 2] += dp[i + 1]", "+ dp[i + 2] %= mod", "+print((dp[n] % mod))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2706730585, "measured_runtime_v1": 0.2065423949, "runtime_lift": 1.3104963688, "key": ["s479618893", "s899240371"]} +{"user_id": "u498487134", "problem_id": "p03038", "language": "python", "submission_id_v0": "s547925628", "submission_id_v1": "s764313725", "cpu_time_v0": 649, "cpu_time_v1": 471, "memory_v0": 68588, "memory_v1": 102672, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.43, "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(input())\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N,M=MI()\n\n A=LI()\n\n CB=[[0,0]for _ in range(M)]\n\n A.sort()\n\n for i in range(M):\n\n CB[i][1],CB[i][0]=MI()\n\n \n\n CB.sort(reverse=True)\n\n now=0\n\n \n\n for i in range(N):\n\n if CB[now][1]<=0:\n\n now+=1\n\n \n\n if now>=M:\n\n break \n\n \n\n ch=CB[now][0]\n\n if A[i]=c:\n\n heapq.heappush(A,a)\n\n break\n\n else:\n\n heapq.heappush(A,c)\n\n \n\n ans=0\n\n for i in range(N):\n\n a=heapq.heappop(A)\n\n ans+=a\n\n \n\n print(ans)\n\n\n\nmain()\n", "code_v0_loc": 37, "code_v1_loc": 42, "code_v0_num_chars": 685, "code_v1_num_chars": 804, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, M = MI()\n A = LI()\n CB = [[0, 0] for _ in range(M)]\n A.sort()\n for i in range(M):\n CB[i][1], CB[i][0] = MI()\n CB.sort(reverse=True)\n now = 0\n for i in range(N):\n if CB[now][1] <= 0:\n now += 1\n if now >= M:\n break\n ch = CB[now][0]\n if A[i] < ch:\n A[i] = ch\n CB[now][1] -= 1\n else:\n break\n print((sum(A)))\n\n\nmain()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, M = MI()\n A = LI()\n B = [0] * M\n C = [0] * M\n for i in range(M):\n B[i], C[i] = MI()\n C, B = list(zip(*sorted(zip(C, B))))\n B = B[::-1]\n C = C[::-1]\n import heapq\n\n heapq.heapify(A)\n for i in range(M):\n b = B[i]\n c = C[i]\n for _ in range(b):\n a = heapq.heappop(A)\n if a >= c:\n heapq.heappush(A, a)\n break\n else:\n heapq.heappush(A, c)\n ans = 0\n for i in range(N):\n a = heapq.heappop(A)\n ans += a\n print(ans)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 11.9047619048, "diff": ["- CB = [[0, 0] for _ in range(M)]", "- A.sort()", "+ B = [0] * M", "+ C = [0] * M", "- CB[i][1], CB[i][0] = MI()", "- CB.sort(reverse=True)", "- now = 0", "+ B[i], C[i] = MI()", "+ C, B = list(zip(*sorted(zip(C, B))))", "+ B = B[::-1]", "+ C = C[::-1]", "+ import heapq", "+", "+ heapq.heapify(A)", "+ for i in range(M):", "+ b = B[i]", "+ c = C[i]", "+ for _ in range(b):", "+ a = heapq.heappop(A)", "+ if a >= c:", "+ heapq.heappush(A, a)", "+ break", "+ else:", "+ heapq.heappush(A, c)", "+ ans = 0", "- if CB[now][1] <= 0:", "- now += 1", "- if now >= M:", "- break", "- ch = CB[now][0]", "- if A[i] < ch:", "- A[i] = ch", "- CB[now][1] -= 1", "- else:", "- break", "- print((sum(A)))", "+ a = heapq.heappop(A)", "+ ans += a", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2322117374, "measured_runtime_v1": 0.1336252203, "runtime_lift": 1.7377837571, "key": ["s547925628", "s764313725"]} +{"user_id": "u396211450", "problem_id": "p03828", "language": "python", "submission_id_v0": "s749493108", "submission_id_v1": "s831049300", "cpu_time_v0": 39, "cpu_time_v1": 31, "memory_v0": 9360, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.51, "input": "from math import factorial\n\n\n\nn = int(input())\n\nf = factorial(n)\n\n\n\nmod = 10 ** 9 + 7\n\n\n\ndef primes(n):\n\n is_prime = [True] * (n + 1)\n\n is_prime[0] = False\n\n is_prime[1] = False\n\n for i in range(2, int(n ** 0.5) + 1):\n\n if not is_prime[i]:\n\n continue\n\n for j in range(i * 2, n + 1, i):\n\n is_prime[j] = False\n\n return [i for i in range(n + 1) if is_prime[i]]\n\n\n\nans = 1\n\nfor p in primes(n):\n\n temp = 1\n\n while f % p == 0:\n\n temp += 1\n\n f //= p\n\n ans = (ans * temp) % mod\n\nprint(ans)\n", "target": "n=int(input())\n\nm=10**9+7\n\np=[1 for i in range(10000)]\n\np[0]=0\n\np[1]=0\n\nfor i in range(2,n+1):\n\n if p[i]==1:\n\n for j in range(i*i,n+1,i):\n\n p[j]=0\n\nans=1\n\nfor i in range(2,n+1):\n\n if p[i]:\n\n c=0\n\n k=i\n\n while n//k>0:\n\n c=c+(n//k)%m\n\n k=k*i\n\n ans=(ans*((c+1)%m))%m\n\nprint((ans%m))\n\n \n\n \n\n \n\n \n", "code_v0_loc": 26, "code_v1_loc": 23, "code_v0_num_chars": 556, "code_v1_num_chars": 340, "code_v0_no_empty_lines": "from math import factorial\n\nn = int(input())\nf = factorial(n)\nmod = 10**9 + 7\n\n\ndef primes(n):\n is_prime = [True] * (n + 1)\n is_prime[0] = False\n is_prime[1] = False\n for i in range(2, int(n**0.5) + 1):\n if not is_prime[i]:\n continue\n for j in range(i * 2, n + 1, i):\n is_prime[j] = False\n return [i for i in range(n + 1) if is_prime[i]]\n\n\nans = 1\nfor p in primes(n):\n temp = 1\n while f % p == 0:\n temp += 1\n f //= p\n ans = (ans * temp) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nm = 10**9 + 7\np = [1 for i in range(10000)]\np[0] = 0\np[1] = 0\nfor i in range(2, n + 1):\n if p[i] == 1:\n for j in range(i * i, n + 1, i):\n p[j] = 0\nans = 1\nfor i in range(2, n + 1):\n if p[i]:\n c = 0\n k = i\n while n // k > 0:\n c = c + (n // k) % m\n k = k * i\n ans = (ans * ((c + 1) % m)) % m\nprint((ans % m))\n", "code_same": false, "relative_loc_diff_percent": 11.5384615385, "diff": ["-from math import factorial", "-", "-f = factorial(n)", "-mod = 10**9 + 7", "-", "-", "-def primes(n):", "- is_prime = [True] * (n + 1)", "- is_prime[0] = False", "- is_prime[1] = False", "- for i in range(2, int(n**0.5) + 1):", "- if not is_prime[i]:", "- continue", "- for j in range(i * 2, n + 1, i):", "- is_prime[j] = False", "- return [i for i in range(n + 1) if is_prime[i]]", "-", "-", "+m = 10**9 + 7", "+p = [1 for i in range(10000)]", "+p[0] = 0", "+p[1] = 0", "+for i in range(2, n + 1):", "+ if p[i] == 1:", "+ for j in range(i * i, n + 1, i):", "+ p[j] = 0", "-for p in primes(n):", "- temp = 1", "- while f % p == 0:", "- temp += 1", "- f //= p", "- ans = (ans * temp) % mod", "-print(ans)", "+for i in range(2, n + 1):", "+ if p[i]:", "+ c = 0", "+ k = i", "+ while n // k > 0:", "+ c = c + (n // k) % m", "+ k = k * i", "+ ans = (ans * ((c + 1) % m)) % m", "+print((ans % m))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2370509479, "measured_runtime_v1": 0.0064624088, "runtime_lift": 36.6815154487, "key": ["s749493108", "s831049300"]} +{"user_id": "u670180528", "problem_id": "p02937", "language": "python", "submission_id_v0": "s126195271", "submission_id_v1": "s641311638", "cpu_time_v0": 161, "cpu_time_v1": 122, "memory_v0": 12200, "memory_v1": 12072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 24.22, "input": "from collections import defaultdict\n\nfrom bisect import bisect_left\n\n\n\ns = input()\n\nn = len(s)\n\ns = s + s\n\nt = input()\n\nif set(t) - set(s):\n\n\tprint((-1))\n\n\texit()\n\nd = defaultdict(list)\n\nfor i in range(2 * n):\n\n\td[s[i]] += [i]\n\ncur = tot = 0\n\nfor c in t:\n\n\tx = d[c][bisect_left(d[c], cur)]\n\n\tif x < n:\n\n\t\tcur = x + 1\n\n\telse:\n\n\t\tcur = x - n + 1\n\n\t\ttot += n\n\ntot += cur\n\nprint(tot)\n", "target": "from collections import defaultdict\n\nfrom bisect import bisect_left\n\n\n\n\n\ndef main():\n\n\ts = input()\n\n\tn = len(s)\n\n\ts = s + s\n\n\tt = input()\n\n\tif set(t) - set(s):\n\n\t\tprint((-1))\n\n\t\texit()\n\n\td = defaultdict(list)\n\n\tfor i in range(2 * n):\n\n\t\td[s[i]] += [i]\n\n\tcur = ncnt = 0\n\n\n\n\tfor c in t:\n\n\t\tx = d[c][bisect_left(d[c], cur)]\n\n\t\tif x < n:\n\n\t\t\tcur = x + 1\n\n\t\telse:\n\n\t\t\tcur = x - n + 1\n\n\t\t\tncnt += 1\n\n\tprint((ncnt*n + cur))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "code_v0_loc": 23, "code_v1_loc": 29, "code_v0_num_chars": 378, "code_v1_num_chars": 453, "code_v0_no_empty_lines": "from collections import defaultdict\nfrom bisect import bisect_left\n\ns = input()\nn = len(s)\ns = s + s\nt = input()\nif set(t) - set(s):\n print((-1))\n exit()\nd = defaultdict(list)\nfor i in range(2 * n):\n d[s[i]] += [i]\ncur = tot = 0\nfor c in t:\n x = d[c][bisect_left(d[c], cur)]\n if x < n:\n cur = x + 1\n else:\n cur = x - n + 1\n tot += n\ntot += cur\nprint(tot)\n", "code_v1_no_empty_lines": "from collections import defaultdict\nfrom bisect import bisect_left\n\n\ndef main():\n s = input()\n n = len(s)\n s = s + s\n t = input()\n if set(t) - set(s):\n print((-1))\n exit()\n d = defaultdict(list)\n for i in range(2 * n):\n d[s[i]] += [i]\n cur = ncnt = 0\n for c in t:\n x = d[c][bisect_left(d[c], cur)]\n if x < n:\n cur = x + 1\n else:\n cur = x - n + 1\n ncnt += 1\n print((ncnt * n + cur))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 20.6896551724, "diff": ["-s = input()", "-n = len(s)", "-s = s + s", "-t = input()", "-if set(t) - set(s):", "- print((-1))", "- exit()", "-d = defaultdict(list)", "-for i in range(2 * n):", "- d[s[i]] += [i]", "-cur = tot = 0", "-for c in t:", "- x = d[c][bisect_left(d[c], cur)]", "- if x < n:", "- cur = x + 1", "- else:", "- cur = x - n + 1", "- tot += n", "-tot += cur", "-print(tot)", "+", "+def main():", "+ s = input()", "+ n = len(s)", "+ s = s + s", "+ t = input()", "+ if set(t) - set(s):", "+ print((-1))", "+ exit()", "+ d = defaultdict(list)", "+ for i in range(2 * n):", "+ d[s[i]] += [i]", "+ cur = ncnt = 0", "+ for c in t:", "+ x = d[c][bisect_left(d[c], cur)]", "+ if x < n:", "+ cur = x + 1", "+ else:", "+ cur = x - n + 1", "+ ncnt += 1", "+ print((ncnt * n + cur))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2683695219, "measured_runtime_v1": 0.0063027716, "runtime_lift": 42.5796046267, "key": ["s126195271", "s641311638"]} +{"user_id": "u631277801", "problem_id": "p02996", "language": "python", "submission_id_v0": "s825135097", "submission_id_v1": "s901008925", "cpu_time_v0": 649, "cpu_time_v1": 495, "memory_v0": 54192, "memory_v1": 31936, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.73, "input": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\nab = [list(li()) for _ in range(n)]\n\n\n\nab.sort(key=lambda x: x[1])\n\n\n\ncur = 0\n\n\n\nans = True\n\n\n\nfor ai, bi in ab:\n\n cur += ai\n\n if cur > bi:\n\n ans = False\n\n\n\nprint((\"Yes\" if ans else \"No\"))", "target": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\nab = [tuple(li()) for _ in range(n)]\n\n\n\nab.sort(key=lambda x: x[1])\n\ncur = 0\n\nok = True\n\n\n\nfor ai, bi in ab:\n\n cur += ai\n\n if cur > bi:\n\n ok = False\n\n break\n\n\n\nprint((\"Yes\" if ok else \"No\"))\n", "code_v0_loc": 29, "code_v1_loc": 28, "code_v0_num_chars": 655, "code_v1_num_chars": 665, "code_v0_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nab = [list(li()) for _ in range(n)]\nab.sort(key=lambda x: x[1])\ncur = 0\nans = True\nfor ai, bi in ab:\n cur += ai\n if cur > bi:\n ans = False\nprint((\"Yes\" if ans else \"No\"))\n", "code_v1_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nab = [tuple(li()) for _ in range(n)]\nab.sort(key=lambda x: x[1])\ncur = 0\nok = True\nfor ai, bi in ab:\n cur += ai\n if cur > bi:\n ok = False\n break\nprint((\"Yes\" if ok else \"No\"))\n", "code_same": false, "relative_loc_diff_percent": 3.4482758621, "diff": ["-ab = [list(li()) for _ in range(n)]", "+ab = [tuple(li()) for _ in range(n)]", "-ans = True", "+ok = True", "- ans = False", "-print((\"Yes\" if ans else \"No\"))", "+ ok = False", "+ break", "+print((\"Yes\" if ok else \"No\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2910801413, "measured_runtime_v1": 0.1842719517, "runtime_lift": 1.5796226102, "key": ["s825135097", "s901008925"]} +{"user_id": "u167751176", "problem_id": "p03078", "language": "python", "submission_id_v0": "s149883415", "submission_id_v1": "s931960732", "cpu_time_v0": 641, "cpu_time_v1": 91, "memory_v0": 97660, "memory_v1": 8708, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.8, "input": "def main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\td = [0]*x*y\n\n\tfor i in range(x):\n\n\t\tfor j in range(y):\n\n\t\t\td[i*y+j] = a[i]+b[j]\n\n\td.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\n\n\tc_len = min(k, z)\n\n\td_len = min(k, x*y)\n\n\te = [0]*d_len*c_len\n\n\tfor i in range(d_len):\n\n\t\tfor j in range(c_len):\n\n\t\t\te[i*c_len+j] = d[i] + c[j]\n\n\te.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((e[i]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "def main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\n\n\tsolve(a, b, c, x, y, z, k)\n\n\n\ndef solve(a, b, c, x, y, z, k):\n\n\ta.sort(reverse=True)\n\n\tb.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\tstack = list()\n\n\tfor p in range(x):\n\n\t\tfor q in range(y):\n\n\t\t\tif (p+1)*(q+1) > k:\n\n\t\t\t\tbreak\n\n\t\t\tfor r in range(z):\n\n\t\t\t\tif (p+1)*(q+1)*(r+1) > k:\n\n\t\t\t\t\tbreak\n\n\t\t\t\tstack.append(a[p]+b[q]+c[r])\n\n\tstack.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((stack[i]))\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 25, "code_v1_loc": 27, "code_v0_num_chars": 545, "code_v1_num_chars": 605, "code_v0_no_empty_lines": "def main():\n x, y, z, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n d = [0] * x * y\n for i in range(x):\n for j in range(y):\n d[i * y + j] = a[i] + b[j]\n d.sort(reverse=True)\n c.sort(reverse=True)\n c_len = min(k, z)\n d_len = min(k, x * y)\n e = [0] * d_len * c_len\n for i in range(d_len):\n for j in range(c_len):\n e[i * c_len + j] = d[i] + c[j]\n e.sort(reverse=True)\n for i in range(k):\n print((e[i]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n x, y, z, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n solve(a, b, c, x, y, z, k)\n\n\ndef solve(a, b, c, x, y, z, k):\n a.sort(reverse=True)\n b.sort(reverse=True)\n c.sort(reverse=True)\n stack = list()\n for p in range(x):\n for q in range(y):\n if (p + 1) * (q + 1) > k:\n break\n for r in range(z):\n if (p + 1) * (q + 1) * (r + 1) > k:\n break\n stack.append(a[p] + b[q] + c[r])\n stack.sort(reverse=True)\n for i in range(k):\n print((stack[i]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 7.4074074074, "diff": ["- d = [0] * x * y", "- for i in range(x):", "- for j in range(y):", "- d[i * y + j] = a[i] + b[j]", "- d.sort(reverse=True)", "+ solve(a, b, c, x, y, z, k)", "+", "+", "+def solve(a, b, c, x, y, z, k):", "+ a.sort(reverse=True)", "+ b.sort(reverse=True)", "- c_len = min(k, z)", "- d_len = min(k, x * y)", "- e = [0] * d_len * c_len", "- for i in range(d_len):", "- for j in range(c_len):", "- e[i * c_len + j] = d[i] + c[j]", "- e.sort(reverse=True)", "+ stack = list()", "+ for p in range(x):", "+ for q in range(y):", "+ if (p + 1) * (q + 1) > k:", "+ break", "+ for r in range(z):", "+ if (p + 1) * (q + 1) * (r + 1) > k:", "+ break", "+ stack.append(a[p] + b[q] + c[r])", "+ stack.sort(reverse=True)", "- print((e[i]))", "+ print((stack[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3135767848, "measured_runtime_v1": 0.0401056306, "runtime_lift": 7.8187720726, "key": ["s149883415", "s931960732"]} +{"user_id": "u286955577", "problem_id": "p03074", "language": "python", "submission_id_v0": "s853547546", "submission_id_v1": "s138697044", "cpu_time_v0": 74, "cpu_time_v1": 66, "memory_v0": 4596, "memory_v1": 4596, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.81, "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n _S = input()\n\n S = []\n\n b = _S[0]\n\n s = 0\n\n if b == '0': S.append(0)\n\n for _s in _S:\n\n if b == _s:\n\n s = s + 1\n\n else:\n\n b = _s\n\n S.append(s)\n\n s = 1\n\n S.append(s)\n\n if b == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n\n n = sum(S[0:num])\n\n m = n\n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n\n for i in range(0, len(S) - num, 2):\n\n n = n - sum(S[i:i+2])\n\n n = n + sum(S[i + num:i + num + 2])\n\n m = max(m, n)\n\n\n\n return m\n\n\n\nprint((solve()))", "target": "def solve():\n\n N, K = list(map(int, input().split()))\n\n s = input()\n\n S = []\n\n b = s[0]\n\n cnt = 0\n\n\n\n if s[0] == '0': S.append(0)\n\n for c in s:\n\n if b == c: cnt = cnt + 1\n\n else:\n\n b = c\n\n S.append(cnt)\n\n cnt = 1\n\n S.append(cnt)\n\n if s[-1] == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n part = sum(S[0:num])\n\n ans = part\n\n\n\n for i in range(0, len(S) - num, 2):\n\n part = part - sum(S[i:i+2]) + sum(S[i + num:i + num + 2])\n\n ans = max(ans, part)\n\n\n\n return ans\n\n\n\nprint((solve()))\n", "code_v0_loc": 30, "code_v1_loc": 28, "code_v0_num_chars": 616, "code_v1_num_chars": 520, "code_v0_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n _S = input()\n S = []\n b = _S[0]\n s = 0\n if b == \"0\":\n S.append(0)\n for _s in _S:\n if b == _s:\n s = s + 1\n else:\n b = _s\n S.append(s)\n s = 1\n S.append(s)\n if b == \"0\":\n S.append(0)\n num = min(len(S), 2 * K + 1)\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n n = sum(S[0:num])\n m = n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n for i in range(0, len(S) - num, 2):\n n = n - sum(S[i : i + 2])\n n = n + sum(S[i + num : i + num + 2])\n m = max(m, n)\n return m\n\n\nprint((solve()))\n", "code_v1_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n s = input()\n S = []\n b = s[0]\n cnt = 0\n if s[0] == \"0\":\n S.append(0)\n for c in s:\n if b == c:\n cnt = cnt + 1\n else:\n b = c\n S.append(cnt)\n cnt = 1\n S.append(cnt)\n if s[-1] == \"0\":\n S.append(0)\n num = min(len(S), 2 * K + 1)\n part = sum(S[0:num])\n ans = part\n for i in range(0, len(S) - num, 2):\n part = part - sum(S[i : i + 2]) + sum(S[i + num : i + num + 2])\n ans = max(ans, part)\n return ans\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["- _S = input()", "+ s = input()", "- b = _S[0]", "- s = 0", "- if b == \"0\":", "+ b = s[0]", "+ cnt = 0", "+ if s[0] == \"0\":", "- for _s in _S:", "- if b == _s:", "- s = s + 1", "+ for c in s:", "+ if b == c:", "+ cnt = cnt + 1", "- b = _s", "- S.append(s)", "- s = 1", "- S.append(s)", "- if b == \"0\":", "+ b = c", "+ S.append(cnt)", "+ cnt = 1", "+ S.append(cnt)", "+ if s[-1] == \"0\":", "- # n = sum(S[0:num if _S[0] == '1' else (num - 1)])", "- n = sum(S[0:num])", "- m = n", "- # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):", "+ part = sum(S[0:num])", "+ ans = part", "- n = n - sum(S[i : i + 2])", "- n = n + sum(S[i + num : i + num + 2])", "- m = max(m, n)", "- return m", "+ part = part - sum(S[i : i + 2]) + sum(S[i + num : i + num + 2])", "+ ans = max(ans, part)", "+ return ans"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3473945413, "measured_runtime_v1": 0.2136866565, "runtime_lift": 1.625719392, "key": ["s853547546", "s138697044"]} +{"user_id": "u575431498", "problem_id": "p03828", "language": "python", "submission_id_v0": "s058426510", "submission_id_v1": "s587454237", "cpu_time_v0": 73, "cpu_time_v1": 18, "memory_v0": 3572, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.34, "input": "from functools import reduce\n\nN = int(input())\n\n\n\nprime_table = [1] * (N+1)\n\n\n\nfor x in range(2, N+1):\n\n for t in range(2, x+1):\n\n while x % t == 0:\n\n prime_table[t] += 1\n\n x //= t\n\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))", "target": "def prime_factorize(n):\n\n while n % 2 == 0:\n\n a[2] += 1\n\n n //= 2\n\n f = 3\n\n while f * f <= n:\n\n if n % f == 0:\n\n a[f] += 1\n\n n //= f\n\n else:\n\n f += 2\n\n if n != 1:\n\n a[n] += 1\n\n\n\nN = int(input())\n\na = [0]*(N+1)\n\nfor i in range(2, N+1):\n\n prime_factorize(i)\n\nans = 1\n\nfor i in a:\n\n if i > 0:\n\n ans *= (i+1)\n\nbig = 10**9 + 7\n\nprint((ans % big))", "code_v0_loc": 11, "code_v1_loc": 24, "code_v0_num_chars": 277, "code_v1_num_chars": 432, "code_v0_no_empty_lines": "from functools import reduce\n\nN = int(input())\nprime_table = [1] * (N + 1)\nfor x in range(2, N + 1):\n for t in range(2, x + 1):\n while x % t == 0:\n prime_table[t] += 1\n x //= t\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))\n", "code_v1_no_empty_lines": "def prime_factorize(n):\n while n % 2 == 0:\n a[2] += 1\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a[f] += 1\n n //= f\n else:\n f += 2\n if n != 1:\n a[n] += 1\n\n\nN = int(input())\na = [0] * (N + 1)\nfor i in range(2, N + 1):\n prime_factorize(i)\nans = 1\nfor i in a:\n if i > 0:\n ans *= i + 1\nbig = 10**9 + 7\nprint((ans % big))\n", "code_same": false, "relative_loc_diff_percent": 54.1666666667, "diff": ["-from functools import reduce", "+def prime_factorize(n):", "+ while n % 2 == 0:", "+ a[2] += 1", "+ n //= 2", "+ f = 3", "+ while f * f <= n:", "+ if n % f == 0:", "+ a[f] += 1", "+ n //= f", "+ else:", "+ f += 2", "+ if n != 1:", "+ a[n] += 1", "+", "-prime_table = [1] * (N + 1)", "-for x in range(2, N + 1):", "- for t in range(2, x + 1):", "- while x % t == 0:", "- prime_table[t] += 1", "- x //= t", "-print((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))", "+a = [0] * (N + 1)", "+for i in range(2, N + 1):", "+ prime_factorize(i)", "+ans = 1", "+for i in a:", "+ if i > 0:", "+ ans *= i + 1", "+big = 10**9 + 7", "+print((ans % big))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2580870204, "measured_runtime_v1": 0.1952191839, "runtime_lift": 1.3220371851, "key": ["s058426510", "s587454237"]} +{"user_id": "u190086340", "problem_id": "p03854", "language": "python", "submission_id_v0": "s952373499", "submission_id_v1": "s487524594", "cpu_time_v0": 320, "cpu_time_v1": 262, "memory_v0": 79600, "memory_v1": 58480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.12, "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef solve():\n\n S = input()\n\n # print(S, len(S))\n\n\n\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n\n\n\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n\n\n def recur(i, w):\n\n if not TABLE[w][i] == -1:\n\n return TABLE[w][i]\n\n\n\n if i >= len(S):\n\n # print(\"jey\", log)\n\n return True\n\n\n\n r1, r2, r3, r4 = False, False, False, False\n\n if S[i:i + 5] == words[0]:\n\n r1 = recur(i + 5, 0)\n\n if S[i:i + 7] == words[1]:\n\n r2 = recur(i + 7, 1)\n\n if S[i:i + 5] == words[2]:\n\n r3 = recur(i + 5, 2)\n\n if S[i:i + 6] == words[3]:\n\n r4 = recur(i + 6, 3)\n\n\n\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n\n\n\n return TABLE[w][i]\n\n\n\n ans = recur(0, 0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n", "target": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\ndef solve():\n\n S = input()\n\n # print(S, len(S))\n\n\n\n S = S[::-1]\n\n words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])\n\n\n\n def recur(i):\n\n if i >= len(S):\n\n return True\n\n\n\n for word in words:\n\n if S[i:i + len(word)] == word:\n\n if recur(i + len(word)):\n\n return True\n\n return False\n\n\n\n ans = recur(0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n", "code_v0_loc": 45, "code_v1_loc": 31, "code_v0_num_chars": 1006, "code_v1_num_chars": 596, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef solve():\n S = input()\n # print(S, len(S))\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n def recur(i, w):\n if not TABLE[w][i] == -1:\n return TABLE[w][i]\n if i >= len(S):\n # print(\"jey\", log)\n return True\n r1, r2, r3, r4 = False, False, False, False\n if S[i : i + 5] == words[0]:\n r1 = recur(i + 5, 0)\n if S[i : i + 7] == words[1]:\n r2 = recur(i + 7, 1)\n if S[i : i + 5] == words[2]:\n r3 = recur(i + 5, 2)\n if S[i : i + 6] == words[3]:\n r4 = recur(i + 6, 3)\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n return TABLE[w][i]\n\n ans = recur(0, 0)\n return ans\n\n\nif __name__ == \"__main__\":\n res = solve()\n if res:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef solve():\n S = input()\n # print(S, len(S))\n S = S[::-1]\n words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])\n\n def recur(i):\n if i >= len(S):\n return True\n for word in words:\n if S[i : i + len(word)] == word:\n if recur(i + len(word)):\n return True\n return False\n\n ans = recur(0)\n return ans\n\n\nif __name__ == \"__main__\":\n res = solve()\n if res:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 31.1111111111, "diff": ["- words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}", "- TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]", "+ S = S[::-1]", "+ words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])", "- def recur(i, w):", "- if not TABLE[w][i] == -1:", "- return TABLE[w][i]", "+ def recur(i):", "- # print(\"jey\", log)", "- r1, r2, r3, r4 = False, False, False, False", "- if S[i : i + 5] == words[0]:", "- r1 = recur(i + 5, 0)", "- if S[i : i + 7] == words[1]:", "- r2 = recur(i + 7, 1)", "- if S[i : i + 5] == words[2]:", "- r3 = recur(i + 5, 2)", "- if S[i : i + 6] == words[3]:", "- r4 = recur(i + 6, 3)", "- TABLE[w][i] = r1 or r2 or r3 or r4 or False", "- return TABLE[w][i]", "+ for word in words:", "+ if S[i : i + len(word)] == word:", "+ if recur(i + len(word)):", "+ return True", "+ return False", "- ans = recur(0, 0)", "+ ans = recur(0)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3275957136, "measured_runtime_v1": 0.2137343092, "runtime_lift": 1.5327240387, "key": ["s952373499", "s487524594"]} +{"user_id": "u787562674", "problem_id": "p03363", "language": "python", "submission_id_v0": "s520227607", "submission_id_v1": "s241017574", "cpu_time_v0": 271, "cpu_time_v1": 224, "memory_v0": 41880, "memory_v1": 41472, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.34, "input": "from collections import Counter\n\n\n\nN = int(input())\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\nruisekiwa = [0] * (N+1)\n\n\n\nfor i in range(N):\n\n ruisekiwa[i+1] = ruisekiwa[i] + inputs[i]\n\n\n\nruisekiwa = ruisekiwa[1:]\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n", "target": "from collections import Counter\n\nfrom itertools import accumulate\n\n\n\nN = int(input())\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\n\n\nruisekiwa = list(accumulate(inputs))\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n", "code_v0_loc": 25, "code_v1_loc": 22, "code_v0_num_chars": 534, "code_v1_num_chars": 485, "code_v0_no_empty_lines": "from collections import Counter\n\nN = int(input())\ninputs = [int(i) for i in input().split()]\nans = 0\nruisekiwa = [0] * (N + 1)\nfor i in range(N):\n ruisekiwa[i + 1] = ruisekiwa[i] + inputs[i]\nruisekiwa = ruisekiwa[1:]\nruisekiwa.sort()\ncounter_ruiseki = Counter(ruisekiwa)\nfor key, value in list(counter_ruiseki.items()):\n if key == 0 and value == 1:\n ans += value\n continue\n elif key == 0 and value > 1:\n ans += value\n if value > 1:\n ans += sum(list(range(value)))\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import Counter\nfrom itertools import accumulate\n\nN = int(input())\ninputs = [int(i) for i in input().split()]\nans = 0\nruisekiwa = list(accumulate(inputs))\nruisekiwa.sort()\ncounter_ruiseki = Counter(ruisekiwa)\nfor key, value in list(counter_ruiseki.items()):\n if key == 0 and value == 1:\n ans += value\n continue\n elif key == 0 and value > 1:\n ans += value\n if value > 1:\n ans += sum(list(range(value)))\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 12.0, "diff": ["+from itertools import accumulate", "-ruisekiwa = [0] * (N + 1)", "-for i in range(N):", "- ruisekiwa[i + 1] = ruisekiwa[i] + inputs[i]", "-ruisekiwa = ruisekiwa[1:]", "+ruisekiwa = list(accumulate(inputs))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.19887093, "measured_runtime_v1": 0.1327844608, "runtime_lift": 1.4976973116, "key": ["s520227607", "s241017574"]} +{"user_id": "u868701750", "problem_id": "p03457", "language": "python", "submission_id_v0": "s991338937", "submission_id_v1": "s211926413", "cpu_time_v0": 209, "cpu_time_v1": 173, "memory_v0": 27480, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.22, "input": "import sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n T = [list(map(int, _input().split())) for _ in range(N)]\n\n t, x, y = 0, 0, 0\n\n for next_t, next_x, next_y in T:\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()", "target": "import sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n t, x, y = 0, 0, 0\n\n for _ in range(N):\n\n next_t, next_x, next_y = list(map(int, _input().split()))\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()", "code_v0_loc": 19, "code_v1_loc": 19, "code_v0_num_chars": 459, "code_v1_num_chars": 444, "code_v0_no_empty_lines": "import sys\n\n_input = sys.stdin.readline\n\n\ndef resolve():\n N = int(_input())\n T = [list(map(int, _input().split())) for _ in range(N)]\n t, x, y = 0, 0, 0\n for next_t, next_x, next_y in T:\n diff_xy = abs(x - next_x) + abs(y - next_y)\n diff_t = next_t - t\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n print(\"No\")\n exit(0)\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_v1_no_empty_lines": "import sys\n\n_input = sys.stdin.readline\n\n\ndef resolve():\n N = int(_input())\n t, x, y = 0, 0, 0\n for _ in range(N):\n next_t, next_x, next_y = list(map(int, _input().split()))\n diff_xy = abs(x - next_x) + abs(y - next_y)\n diff_t = next_t - t\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n print(\"No\")\n exit(0)\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- T = [list(map(int, _input().split())) for _ in range(N)]", "- for next_t, next_x, next_y in T:", "+ for _ in range(N):", "+ next_t, next_x, next_y = list(map(int, _input().split()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2834033267, "measured_runtime_v1": 0.1166054926, "runtime_lift": 2.4304457743, "key": ["s991338937", "s211926413"]} +{"user_id": "u761320129", "problem_id": "p03822", "language": "python", "submission_id_v0": "s508015569", "submission_id_v1": "s203932637", "cpu_time_v0": 763, "cpu_time_v1": 637, "memory_v0": 227992, "memory_v1": 123792, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.51, "input": "import sys\n\nsys.setrecursionlimit(202020)\n\n\n\nN = int(input())\n\nwon = [[] for i in range(N)]\n\nfor i in range(1,N):\n\n a = int(input()) - 1\n\n won[a].append(i)\n\n\n\ndef height(v):\n\n if not won[v]: return 0\n\n hs = [height(op) for op in won[v]]\n\n ret = 0\n\n for i,h in enumerate(sorted(hs)):\n\n ret = max(ret, h + len(hs) - i)\n\n return ret\n\n\n\nprint((height(0)))", "target": "import sys\n\nsys.setrecursionlimit(10**8)\n\nN = int(input())\n\nA = [int(input())-1 for i in range(N-1)]\n\nwins = [[] for _ in range(N)]\n\n\n\nfor i,a in enumerate(A):\n\n wins[a].append(i+1)\n\n\n\ndepth = [-1] * N\n\ndef dep(v):\n\n if len(wins[v])==0: return 0\n\n if depth[v] >= 0:\n\n return depth[v]\n\n ds = []\n\n for w in wins[v]:\n\n ds.append(dep(w))\n\n ds.sort(reverse=True)\n\n ret = 0\n\n for i,d in enumerate(ds):\n\n ret = max(ret, i+d+1)\n\n depth[v] = ret\n\n return ret\n\nprint((dep(0)))", "code_v0_loc": 18, "code_v1_loc": 24, "code_v0_num_chars": 377, "code_v1_num_chars": 515, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(202020)\nN = int(input())\nwon = [[] for i in range(N)]\nfor i in range(1, N):\n a = int(input()) - 1\n won[a].append(i)\n\n\ndef height(v):\n if not won[v]:\n return 0\n hs = [height(op) for op in won[v]]\n ret = 0\n for i, h in enumerate(sorted(hs)):\n ret = max(ret, h + len(hs) - i)\n return ret\n\n\nprint((height(0)))\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**8)\nN = int(input())\nA = [int(input()) - 1 for i in range(N - 1)]\nwins = [[] for _ in range(N)]\nfor i, a in enumerate(A):\n wins[a].append(i + 1)\ndepth = [-1] * N\n\n\ndef dep(v):\n if len(wins[v]) == 0:\n return 0\n if depth[v] >= 0:\n return depth[v]\n ds = []\n for w in wins[v]:\n ds.append(dep(w))\n ds.sort(reverse=True)\n ret = 0\n for i, d in enumerate(ds):\n ret = max(ret, i + d + 1)\n depth[v] = ret\n return ret\n\n\nprint((dep(0)))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-sys.setrecursionlimit(202020)", "+sys.setrecursionlimit(10**8)", "-won = [[] for i in range(N)]", "-for i in range(1, N):", "- a = int(input()) - 1", "- won[a].append(i)", "+A = [int(input()) - 1 for i in range(N - 1)]", "+wins = [[] for _ in range(N)]", "+for i, a in enumerate(A):", "+ wins[a].append(i + 1)", "+depth = [-1] * N", "-def height(v):", "- if not won[v]:", "+def dep(v):", "+ if len(wins[v]) == 0:", "- hs = [height(op) for op in won[v]]", "+ if depth[v] >= 0:", "+ return depth[v]", "+ ds = []", "+ for w in wins[v]:", "+ ds.append(dep(w))", "+ ds.sort(reverse=True)", "- for i, h in enumerate(sorted(hs)):", "- ret = max(ret, h + len(hs) - i)", "+ for i, d in enumerate(ds):", "+ ret = max(ret, i + d + 1)", "+ depth[v] = ret", "-print((height(0)))", "+print((dep(0)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3026691139, "measured_runtime_v1": 0.2050500124, "runtime_lift": 1.4760745946, "key": ["s508015569", "s203932637"]} +{"user_id": "u775681539", "problem_id": "p02792", "language": "python", "submission_id_v0": "s313172456", "submission_id_v1": "s731114638", "cpu_time_v0": 533, "cpu_time_v1": 247, "memory_v0": 3444, "memory_v1": 40556, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 53.66, "input": "#python3\n\nfrom collections import defaultdict\n\nfrom collections import namedtuple\n\n\n\nP = namedtuple('P', ['front', 'end'])\n\n\n\ndef f(x):\n\n return P(str(x)[0], str(x)[-1]) \n\n\n\ndef main():\n\n\n\n n = int(input())\n\n freq = defaultdict(int)\n\n\n\n for i in range(1, n+1):\n\n p = f(i)\n\n freq[p]+=1\n\n\n\n\n\n ans = 0\n\n for i in range(1, n + 1):\n\n p = f(i)\n\n q = (p.end, p.front)\n\n ans += freq[q]\n\n\n\n print(ans)\n\n\n\nmain()", "target": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom collections import defaultdict\n\n\n\ndef f(x):\n\n return (int(str(x)[0]), int(str(x)[-1])) \n\ndef main():\n\n N = int(readline())\n\n df = defaultdict(int)\n\n for i in range(1, N+1):\n\n df[f(i)] += 1\n\n ans = 0\n\n for i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += df[(i, j)]*df[(j, i)]\n\n print(ans)\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 28, "code_v1_loc": 21, "code_v0_num_chars": 458, "code_v1_num_chars": 507, "code_v0_no_empty_lines": "# python3\nfrom collections import defaultdict\nfrom collections import namedtuple\n\nP = namedtuple(\"P\", [\"front\", \"end\"])\n\n\ndef f(x):\n return P(str(x)[0], str(x)[-1])\n\n\ndef main():\n n = int(input())\n freq = defaultdict(int)\n for i in range(1, n + 1):\n p = f(i)\n freq[p] += 1\n ans = 0\n for i in range(1, n + 1):\n p = f(i)\n q = (p.end, p.front)\n ans += freq[q]\n print(ans)\n\n\nmain()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom collections import defaultdict\n\n\ndef f(x):\n return (int(str(x)[0]), int(str(x)[-1]))\n\n\ndef main():\n N = int(readline())\n df = defaultdict(int)\n for i in range(1, N + 1):\n df[f(i)] += 1\n ans = 0\n for i in range(1, 10):\n for j in range(1, 10):\n ans += df[(i, j)] * df[(j, i)]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-# python3", "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "-from collections import namedtuple", "-", "-P = namedtuple(\"P\", [\"front\", \"end\"])", "- return P(str(x)[0], str(x)[-1])", "+ return (int(str(x)[0]), int(str(x)[-1]))", "- n = int(input())", "- freq = defaultdict(int)", "- for i in range(1, n + 1):", "- p = f(i)", "- freq[p] += 1", "+ N = int(readline())", "+ df = defaultdict(int)", "+ for i in range(1, N + 1):", "+ df[f(i)] += 1", "- for i in range(1, n + 1):", "- p = f(i)", "- q = (p.end, p.front)", "- ans += freq[q]", "+ for i in range(1, 10):", "+ for j in range(1, 10):", "+ ans += df[(i, j)] * df[(j, i)]", "-main()", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4672443939, "measured_runtime_v1": 0.3355342689, "runtime_lift": 1.3925385189, "key": ["s313172456", "s731114638"]} +{"user_id": "u078042885", "problem_id": "p01138", "language": "python", "submission_id_v0": "s367659771", "submission_id_v1": "s546819347", "cpu_time_v0": 8280, "cpu_time_v1": 5620, "memory_v0": 11712, "memory_v1": 11664, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.13, "input": "def f(s):\n\n s=list(map(int,s.split(':')))\n\n return (s[0]*60+s[1])*60+s[2]\n\na=86401\n\nwhile 1:\n\n t=[0]*a\n\n n=int(input())\n\n if n==0:break\n\n for _ in range(n):\n\n b,c=input().split()\n\n t[f(b)]+=1;t[f(c)]-=1\n\n d=0\n\n for i in range(1,a):\n\n t[i]+=t[i-1]\n\n d=max(d,t[i])\n\n print(d)", "target": "def f(s):\n\n return (s[0]*60+s[1])*60+s[2]\n\na=86400\n\nwhile 1:\n\n t=[0]*a\n\n n=int(input())\n\n if n==0:break\n\n for _ in range(n):\n\n b,c = [list(map(int,x.split(':'))) for x in input().split()]\n\n t[f(b)]+=1;t[f(c)]-=1\n\n d=0\n\n for i in range(1,a):\n\n t[i]+=t[i-1]\n\n if d dp[j] + a:\n\n dp[j | key] = dp[j] + a\n\n\n\nif dp[-1] == INF:\n\n print((-1))\n\nelse:\n\n print((dp[-1]))", "code_v0_loc": 25, "code_v1_loc": 26, "code_v0_num_chars": 505, "code_v1_num_chars": 522, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nN, M = list(map(int, readline().split()))\nINF = 10**10\ndp = [INF] * (2**N)\ndp[0] = 0\nfor i in range(M):\n a, b = list(map(int, readline().split()))\n c = list(map(int, readline().split()))\n key = 0\n for j in range(len(c)):\n key += 1 << (c[j] - 1)\n for j in range(len(dp)):\n if dp[j] == INF:\n continue\n if j | key == j:\n continue\n dp[j | key] = min(dp[j | key], dp[j] + a)\nif dp[-1] == INF:\n print((-1))\nelse:\n print((dp[-1]))\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nN, M = list(map(int, readline().split()))\nINF = 10**10\ndp = [INF] * (2**N)\ndp[0] = 0\nfor i in range(M):\n a, b = list(map(int, readline().split()))\n c = list(map(int, readline().split()))\n key = 0\n for j in range(len(c)):\n key += 1 << (c[j] - 1)\n for j in range(len(dp)):\n if dp[j] == INF:\n continue\n if j | key == j:\n continue\n if dp[j | key] > dp[j] + a:\n dp[j | key] = dp[j] + a\nif dp[-1] == INF:\n print((-1))\nelse:\n print((dp[-1]))\n", "code_same": false, "relative_loc_diff_percent": 3.8461538462, "diff": ["- dp[j | key] = min(dp[j | key], dp[j] + a)", "+ if dp[j | key] > dp[j] + a:", "+ dp[j | key] = dp[j] + a"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2747366824, "measured_runtime_v1": 0.0058527424, "runtime_lift": 46.941529559, "key": ["s462370890", "s446448975"]} +{"user_id": "u837673618", "problem_id": "p02721", "language": "python", "submission_id_v0": "s949081681", "submission_id_v1": "s434725940", "cpu_time_v0": 326, "cpu_time_v1": 177, "memory_v0": 12688, "memory_v1": 12576, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.71, "input": "N, K, C = list(map(int, input().split()))\n\nS = input()\n\n\n\nlatest = [None]*K\n\ni = len(S)+C\n\nfor j in range(K-1, -1, -1):\n\n i = S.rindex(\"o\", 0, i-C)\n\n latest[j] = i\n\n\n\nif i<=C or \"o\" not in S[:i-C]:\n\n i = -C-1\n\n for j in latest:\n\n i = S.index(\"o\", i+C+1)\n\n if i == j:\n\n print((i+1))\n", "target": "def solve():\n\n N, K, C = list(map(int, input().split()))\n\n workable = [i for i, s in enumerate(input()) if s==\"o\"]\n\n if len(workable) == K:\n\n return workable\n\n \n\n prev = workable[-1]\n\n latest = {prev}\n\n i = len(workable)-1\n\n while i > 0:\n\n i -= 1\n\n if prev - workable[i] > C:\n\n latest.add(workable[i])\n\n prev = workable[i]\n\n if len(latest) > K:\n\n return []\n\n must = []\n\n i = -1\n\n prev = -C-1\n\n while i < len(workable)-1:\n\n i += 1\n\n if workable[i] - prev > C:\n\n if workable[i] in latest:\n\n must.append(workable[i])\n\n prev = workable[i]\n\n return must\n\n\n\nfor i in solve():\n\n print((i+1))", "code_v0_loc": 15, "code_v1_loc": 29, "code_v0_num_chars": 289, "code_v1_num_chars": 646, "code_v0_no_empty_lines": "N, K, C = list(map(int, input().split()))\nS = input()\nlatest = [None] * K\ni = len(S) + C\nfor j in range(K - 1, -1, -1):\n i = S.rindex(\"o\", 0, i - C)\n latest[j] = i\nif i <= C or \"o\" not in S[: i - C]:\n i = -C - 1\n for j in latest:\n i = S.index(\"o\", i + C + 1)\n if i == j:\n print((i + 1))\n", "code_v1_no_empty_lines": "def solve():\n N, K, C = list(map(int, input().split()))\n workable = [i for i, s in enumerate(input()) if s == \"o\"]\n if len(workable) == K:\n return workable\n prev = workable[-1]\n latest = {prev}\n i = len(workable) - 1\n while i > 0:\n i -= 1\n if prev - workable[i] > C:\n latest.add(workable[i])\n prev = workable[i]\n if len(latest) > K:\n return []\n must = []\n i = -1\n prev = -C - 1\n while i < len(workable) - 1:\n i += 1\n if workable[i] - prev > C:\n if workable[i] in latest:\n must.append(workable[i])\n prev = workable[i]\n return must\n\n\nfor i in solve():\n print((i + 1))\n", "code_same": false, "relative_loc_diff_percent": 48.275862069, "diff": ["-N, K, C = list(map(int, input().split()))", "-S = input()", "-latest = [None] * K", "-i = len(S) + C", "-for j in range(K - 1, -1, -1):", "- i = S.rindex(\"o\", 0, i - C)", "- latest[j] = i", "-if i <= C or \"o\" not in S[: i - C]:", "- i = -C - 1", "- for j in latest:", "- i = S.index(\"o\", i + C + 1)", "- if i == j:", "- print((i + 1))", "+def solve():", "+ N, K, C = list(map(int, input().split()))", "+ workable = [i for i, s in enumerate(input()) if s == \"o\"]", "+ if len(workable) == K:", "+ return workable", "+ prev = workable[-1]", "+ latest = {prev}", "+ i = len(workable) - 1", "+ while i > 0:", "+ i -= 1", "+ if prev - workable[i] > C:", "+ latest.add(workable[i])", "+ prev = workable[i]", "+ if len(latest) > K:", "+ return []", "+ must = []", "+ i = -1", "+ prev = -C - 1", "+ while i < len(workable) - 1:", "+ i += 1", "+ if workable[i] - prev > C:", "+ if workable[i] in latest:", "+ must.append(workable[i])", "+ prev = workable[i]", "+ return must", "+", "+", "+for i in solve():", "+ print((i + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3840038183, "measured_runtime_v1": 0.2943901448, "runtime_lift": 1.3044044613, "key": ["s949081681", "s434725940"]} +{"user_id": "u754022296", "problem_id": "p03819", "language": "python", "submission_id_v0": "s951638556", "submission_id_v1": "s089571448", "cpu_time_v0": 1762, "cpu_time_v1": 852, "memory_v0": 127784, "memory_v1": 82324, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 51.65, "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = map(int, input().split())\n\n LR = [list(map(int, input().split())) for _ in range(n)]\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n \n\n S = sorted([(r-l+1, l, r) for l, r in LR], reverse=True)\n\n cnt = n\n\n L = []\n\n for i in range(1, m+1):\n\n while S and S[-1][0] == i:\n\n c, l, r = S.pop()\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n L.append(res)\n\n print(*L, sep=\"\\n\")\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = list(map(int, input().split()))\n\n S = [[] for _ in range(m+1)]\n\n for _ in range(n):\n\n l, r = list(map(int, input().split()))\n\n S[r-l+1].append((l, r))\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n cnt = n\n\n for i in range(1, m+1):\n\n for l, r in S[i]:\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n print(res)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 36, "code_v1_loc": 34, "code_v0_num_chars": 731, "code_v1_num_chars": 658, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, m = map(int, input().split())\n LR = [list(map(int, input().split())) for _ in range(n)]\n BIT = [0] * (m + 2)\n\n def add(i, a):\n while i <= m + 1:\n BIT[i] += a\n i += i & (-i)\n\n def bit_sum(i):\n res = 0\n while i > 0:\n res += BIT[i]\n i -= i & (-i)\n return res\n\n S = sorted([(r - l + 1, l, r) for l, r in LR], reverse=True)\n cnt = n\n L = []\n for i in range(1, m + 1):\n while S and S[-1][0] == i:\n c, l, r = S.pop()\n cnt -= 1\n add(l, 1)\n add(r + 1, -1)\n res = cnt\n for j in range(0, m + 1, i):\n res += bit_sum(j)\n L.append(res)\n print(*L, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, m = list(map(int, input().split()))\n S = [[] for _ in range(m + 1)]\n for _ in range(n):\n l, r = list(map(int, input().split()))\n S[r - l + 1].append((l, r))\n BIT = [0] * (m + 2)\n\n def add(i, a):\n while i <= m + 1:\n BIT[i] += a\n i += i & (-i)\n\n def bit_sum(i):\n res = 0\n while i > 0:\n res += BIT[i]\n i -= i & (-i)\n return res\n\n cnt = n\n for i in range(1, m + 1):\n for l, r in S[i]:\n cnt -= 1\n add(l, 1)\n add(r + 1, -1)\n res = cnt\n for j in range(0, m + 1, i):\n res += bit_sum(j)\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 5.5555555556, "diff": ["- n, m = map(int, input().split())", "- LR = [list(map(int, input().split())) for _ in range(n)]", "+ n, m = list(map(int, input().split()))", "+ S = [[] for _ in range(m + 1)]", "+ for _ in range(n):", "+ l, r = list(map(int, input().split()))", "+ S[r - l + 1].append((l, r))", "- S = sorted([(r - l + 1, l, r) for l, r in LR], reverse=True)", "- L = []", "- while S and S[-1][0] == i:", "- c, l, r = S.pop()", "+ for l, r in S[i]:", "- L.append(res)", "- print(*L, sep=\"\\n\")", "+ print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3067650649, "measured_runtime_v1": 0.0989195189, "runtime_lift": 3.1011580763, "key": ["s951638556", "s089571448"]} +{"user_id": "u046187684", "problem_id": "p03480", "language": "python", "submission_id_v0": "s964601714", "submission_id_v1": "s413566853", "cpu_time_v0": 40, "cpu_time_v1": 33, "memory_v0": 6244, "memory_v1": 6388, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.5, "input": "#!/usr/bin/env python3\n\n# coding=utf-8\n\n\n\nimport sys\n\n\n\ns = sys.stdin.readline().strip()\n\nl = [_s is \"1\" for _s in list(s)]\n\nl_r = l[::-1]\n\nindex = 0\n\nfor i, (c, n, c_r, n_r) in enumerate(\n\n zip(l[:len(s) // 2], l[1:len(s) // 2 + 1], l_r[:len(s) // 2], l_r[1:len(s) // 2 + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\nprint((len(s) - index))", "target": "def solve(string):\n\n l = [s == \"1\" for s in string]\n\n l_r = l[::-1]\n\n index = 0\n\n h = len(string) // 2\n\n for i, (c, n, c_r, n_r) in enumerate(zip(l[:h], l[1:h + 1], l_r[:h], l_r[1:h + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\n return str(len(string) - index)\n\n\n\n\n\nif __name__ == '__main__':\n\n print((solve(input())))\n", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 359, "code_v1_num_chars": 360, "code_v0_no_empty_lines": "#!/usr/bin/env python3\n# coding=utf-8\nimport sys\n\ns = sys.stdin.readline().strip()\nl = [_s is \"1\" for _s in list(s)]\nl_r = l[::-1]\nindex = 0\nfor i, (c, n, c_r, n_r) in enumerate(\n zip(\n l[: len(s) // 2],\n l[1 : len(s) // 2 + 1],\n l_r[: len(s) // 2],\n l_r[1 : len(s) // 2 + 1],\n )\n):\n if c ^ n or c_r ^ n_r:\n index = i + 1\nprint((len(s) - index))\n", "code_v1_no_empty_lines": "def solve(string):\n l = [s == \"1\" for s in string]\n l_r = l[::-1]\n index = 0\n h = len(string) // 2\n for i, (c, n, c_r, n_r) in enumerate(\n zip(l[:h], l[1 : h + 1], l_r[:h], l_r[1 : h + 1])\n ):\n if c ^ n or c_r ^ n_r:\n index = i + 1\n return str(len(string) - index)\n\n\nif __name__ == \"__main__\":\n print((solve(input())))\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-#!/usr/bin/env python3", "-# coding=utf-8", "-import sys", "+def solve(string):", "+ l = [s == \"1\" for s in string]", "+ l_r = l[::-1]", "+ index = 0", "+ h = len(string) // 2", "+ for i, (c, n, c_r, n_r) in enumerate(", "+ zip(l[:h], l[1 : h + 1], l_r[:h], l_r[1 : h + 1])", "+ ):", "+ if c ^ n or c_r ^ n_r:", "+ index = i + 1", "+ return str(len(string) - index)", "-s = sys.stdin.readline().strip()", "-l = [_s is \"1\" for _s in list(s)]", "-l_r = l[::-1]", "-index = 0", "-for i, (c, n, c_r, n_r) in enumerate(", "- zip(", "- l[: len(s) // 2],", "- l[1 : len(s) // 2 + 1],", "- l_r[: len(s) // 2],", "- l_r[1 : len(s) // 2 + 1],", "- )", "-):", "- if c ^ n or c_r ^ n_r:", "- index = i + 1", "-print((len(s) - index))", "+", "+if __name__ == \"__main__\":", "+ print((solve(input())))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3417459049, "measured_runtime_v1": 0.2085829885, "runtime_lift": 1.6384169551, "key": ["s964601714", "s413566853"]} +{"user_id": "u318414416", "problem_id": "p03162", "language": "python", "submission_id_v0": "s337419843", "submission_id_v1": "s763303888", "cpu_time_v0": 672, "cpu_time_v1": 308, "memory_v0": 47336, "memory_v1": 30580, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.17, "input": "# coding: utf-8\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [[0] * 3 for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n for j in range(3):\n\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] \\\n\n for k in range(3) if k != j)\n\n return(max(dp[n]))\n\n\n\nn = int(input()) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n", "target": "# coding: utf-8\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [0] * 3\n\n for i in range(1, n + 1):\n\n a, b, c = abc[i - 1]\n\n dp = [ max(dp[1] + a, dp[2] + a), \\\n\n max(dp[0] + b, dp[2] + b), \\\n\n max(dp[0] + c, dp[1] + c) ]\n\n return(max(dp))\n\n\n\nn = int(input()) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n", "code_v0_loc": 17, "code_v1_loc": 17, "code_v0_num_chars": 434, "code_v1_num_chars": 436, "code_v0_no_empty_lines": "# coding: utf-8\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef f(n, abc):\n dp = [[0] * 3 for _ in range(n + 1)]\n for i in range(1, n + 1):\n for j in range(3):\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)\n return max(dp[n])\n\n\nn = int(input()) # 1 <= n <= 10^5\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\nprint((f(n, abc)))\n", "code_v1_no_empty_lines": "# coding: utf-8\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef f(n, abc):\n dp = [0] * 3\n for i in range(1, n + 1):\n a, b, c = abc[i - 1]\n dp = [\n max(dp[1] + a, dp[2] + a),\n max(dp[0] + b, dp[2] + b),\n max(dp[0] + c, dp[1] + c),\n ]\n return max(dp)\n\n\nn = int(input()) # 1 <= n <= 10^5\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\nprint((f(n, abc)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- dp = [[0] * 3 for _ in range(n + 1)]", "+ dp = [0] * 3", "- for j in range(3):", "- dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)", "- return max(dp[n])", "+ a, b, c = abc[i - 1]", "+ dp = [", "+ max(dp[1] + a, dp[2] + a),", "+ max(dp[0] + b, dp[2] + b),", "+ max(dp[0] + c, dp[1] + c),", "+ ]", "+ return max(dp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2527067475, "measured_runtime_v1": 0.1473037755, "runtime_lift": 1.7155483393, "key": ["s337419843", "s763303888"]} +{"user_id": "u816872429", "problem_id": "p03078", "language": "python", "submission_id_v0": "s052587697", "submission_id_v1": "s157699880", "cpu_time_v0": 41, "cpu_time_v1": 28, "memory_v0": 4096, "memory_v1": 4460, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 31.71, "input": "import heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\ndef diff(l):\n\n m = max(l)\n\n return sorted(m - v for v in l)[1:]\n\n\n\ns = sum(map(max, [a, b, c]))\n\nsa, sb, sc = list(map(diff, [a, b, c]))\n\nda, db, dc = [0], [0], [0]\n\nq = [0]\n\nwhile k > 0:\n\n while True:\n\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n\n heapq.heappush(q, v)\n\n da.append(sa[0])\n\n sa = sa[1:]\n\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n\n heapq.heappush(q, v)\n\n db.append(sb[0])\n\n sb = sb[1:]\n\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n\n heapq.heappush(q, v)\n\n dc.append(sc[0])\n\n sc = sc[1:]\n\n else:\n\n break\n\n v = heapq.heappop(q)\n\n print(s - v)\n\n k -= 1\n", "target": "import heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = sorted(map(int, input().split()))\n\nb = sorted(map(int, input().split()))\n\nc = sorted(map(int, input().split()))\n\n\n\nq = []\n\nmemo = set()\n\ndef qpush(q, ai, bi, ci):\n\n t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)\n\n if not t in memo:\n\n memo.add(t)\n\n heapq.heappush(q, t)\n\n\n\nqpush(q, len(a) - 1, len(b) - 1, len(c) - 1)\n\nfor _ in range(k):\n\n s, ai, bi, ci = heapq.heappop(q)\n\n if ai > 0:\n\n qpush(q, ai - 1, bi, ci)\n\n if bi > 0:\n\n qpush(q, ai, bi - 1, ci)\n\n if ci > 0:\n\n qpush(q, ai, bi, ci - 1)\n\n print(-s)\n", "code_v0_loc": 37, "code_v1_loc": 25, "code_v0_num_chars": 1122, "code_v1_num_chars": 631, "code_v0_no_empty_lines": "import heapq\n\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\n\ndef diff(l):\n m = max(l)\n return sorted(m - v for v in l)[1:]\n\n\ns = sum(map(max, [a, b, c]))\nsa, sb, sc = list(map(diff, [a, b, c]))\nda, db, dc = [0], [0], [0]\nq = [0]\nwhile k > 0:\n while True:\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n heapq.heappush(q, v)\n da.append(sa[0])\n sa = sa[1:]\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n heapq.heappush(q, v)\n db.append(sb[0])\n sb = sb[1:]\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n heapq.heappush(q, v)\n dc.append(sc[0])\n sc = sc[1:]\n else:\n break\n v = heapq.heappop(q)\n print(s - v)\n k -= 1\n", "code_v1_no_empty_lines": "import heapq\n\nx, y, z, k = list(map(int, input().split()))\na = sorted(map(int, input().split()))\nb = sorted(map(int, input().split()))\nc = sorted(map(int, input().split()))\nq = []\nmemo = set()\n\n\ndef qpush(q, ai, bi, ci):\n t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)\n if not t in memo:\n memo.add(t)\n heapq.heappush(q, t)\n\n\nqpush(q, len(a) - 1, len(b) - 1, len(c) - 1)\nfor _ in range(k):\n s, ai, bi, ci = heapq.heappop(q)\n if ai > 0:\n qpush(q, ai - 1, bi, ci)\n if bi > 0:\n qpush(q, ai, bi - 1, ci)\n if ci > 0:\n qpush(q, ai, bi, ci - 1)\n print(-s)\n", "code_same": false, "relative_loc_diff_percent": 32.4324324324, "diff": ["-a = list(map(int, input().split()))", "-b = list(map(int, input().split()))", "-c = list(map(int, input().split()))", "+a = sorted(map(int, input().split()))", "+b = sorted(map(int, input().split()))", "+c = sorted(map(int, input().split()))", "+q = []", "+memo = set()", "-def diff(l):", "- m = max(l)", "- return sorted(m - v for v in l)[1:]", "+def qpush(q, ai, bi, ci):", "+ t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)", "+ if not t in memo:", "+ memo.add(t)", "+ heapq.heappush(q, t)", "-s = sum(map(max, [a, b, c]))", "-sa, sb, sc = list(map(diff, [a, b, c]))", "-da, db, dc = [0], [0], [0]", "-q = [0]", "-while k > 0:", "- while True:", "- if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):", "- for v in [sa[0] + bb + cc for bb in db for cc in dc]:", "- heapq.heappush(q, v)", "- da.append(sa[0])", "- sa = sa[1:]", "- elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):", "- for v in [sb[0] + aa + cc for aa in da for cc in dc]:", "- heapq.heappush(q, v)", "- db.append(sb[0])", "- sb = sb[1:]", "- elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):", "- for v in [sc[0] + aa + bb for aa in da for bb in db]:", "- heapq.heappush(q, v)", "- dc.append(sc[0])", "- sc = sc[1:]", "- else:", "- break", "- v = heapq.heappop(q)", "- print(s - v)", "- k -= 1", "+qpush(q, len(a) - 1, len(b) - 1, len(c) - 1)", "+for _ in range(k):", "+ s, ai, bi, ci = heapq.heappop(q)", "+ if ai > 0:", "+ qpush(q, ai - 1, bi, ci)", "+ if bi > 0:", "+ qpush(q, ai, bi - 1, ci)", "+ if ci > 0:", "+ qpush(q, ai, bi, ci - 1)", "+ print(-s)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2304672, "measured_runtime_v1": 0.0062596636, "runtime_lift": 36.8178252168, "key": ["s052587697", "s157699880"]} +{"user_id": "u924691798", "problem_id": "p02837", "language": "python", "submission_id_v0": "s473277676", "submission_id_v1": "s669766257", "cpu_time_v0": 175, "cpu_time_v1": 139, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.57, "input": "N = int(input())\n\nA = [0]*N\n\nX = []\n\nY = []\n\nfor i in range(N):\n\n A[i] = int(input())\n\n X.append([])\n\n Y.append([])\n\n for j in range(A[i]):\n\n x, y = list(map(int, input().split()))\n\n X[i].append(x-1)\n\n Y[i].append(y)\n\nans = 0\n\nfor bit in range(1<=1:\n\n t[x][y] |= not dfs(x-1, y)\n\n \n\n if y>=1:\n\n t[x][y] |= not dfs(x, y-1)\n\n \n\n if min(x, y)>=1:\n\n t[x][y] |= not dfs(x-1, y-1)\n\n \n\n return t[x][y]\n\n \n\nt = [[False]*7 for _ in range(7)]\n\n\n\nfor i in range(7):\n\n for j in range(7):\n\n dfs(i, j)\n\n\n\n\"\"\"\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(input())\n\nflag = True\n\n\n\nfor _ in range(N):\n\n a = int(input())\n\n \n\n if a%2==1:\n\n flag = False\n\n \n\nif flag:\n\n print('second')\n\nelse:\n\n print('first')", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\n\"\"\"\n\ndef dfs(x, y):\n\n if x==0 and y==0:\n\n return False\n\n \n\n res = False\n\n \n\n if x>0:\n\n res |= not dfs(x-1, y)\n\n \n\n if y>0:\n\n res |= not dfs(x, y-1)\n\n \n\n if min(x, y)>0:\n\n res |= not dfs(x-1, y-1)\n\n \n\n return res\n\n \n\nt = [[False]*5 for _ in range(5)]\n\n\n\nfor i in range(5):\n\n for j in range(5):\n\n t[i][j] = dfs(i, j)\n\n\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nfor ai in a:\n\n if ai%2==1:\n\n print('first')\n\n exit()\n\n\n\nprint('second')", "code_v0_loc": 44, "code_v1_loc": 40, "code_v0_num_chars": 701, "code_v1_num_chars": 621, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\n\ndef dfs(x, y):\n if x == 0 and y == 0:\n t[x][y] = False\n return False\n if x >= 1:\n t[x][y] |= not dfs(x - 1, y)\n if y >= 1:\n t[x][y] |= not dfs(x, y - 1)\n if min(x, y) >= 1:\n t[x][y] |= not dfs(x - 1, y - 1)\n return t[x][y]\n\n\nt = [[False] * 7 for _ in range(7)]\nfor i in range(7):\n for j in range(7):\n dfs(i, j)\n\"\"\"\nfor ti in t:\n print(*ti)\n\"\"\"\nN = int(input())\nflag = True\nfor _ in range(N):\n a = int(input())\n if a % 2 == 1:\n flag = False\nif flag:\n print(\"second\")\nelse:\n print(\"first\")\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\"\"\"\ndef dfs(x, y):\n if x==0 and y==0:\n return False\n res = False\n if x>0:\n res |= not dfs(x-1, y)\n if y>0:\n res |= not dfs(x, y-1)\n if min(x, y)>0:\n res |= not dfs(x-1, y-1)\n return res\nt = [[False]*5 for _ in range(5)]\nfor i in range(5):\n for j in range(5):\n t[i][j] = dfs(i, j)\nfor ti in t:\n print(*ti)\n\"\"\"\nN = int(input())\na = [int(input()) for _ in range(N)]\nfor ai in a:\n if ai % 2 == 1:\n print(\"first\")\n exit()\nprint(\"second\")\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-from collections import *", "-", "-", "+\"\"\"", "- if x == 0 and y == 0:", "- t[x][y] = False", "+ if x==0 and y==0:", "- if x >= 1:", "- t[x][y] |= not dfs(x - 1, y)", "- if y >= 1:", "- t[x][y] |= not dfs(x, y - 1)", "- if min(x, y) >= 1:", "- t[x][y] |= not dfs(x - 1, y - 1)", "- return t[x][y]", "-", "-", "-t = [[False] * 7 for _ in range(7)]", "-for i in range(7):", "- for j in range(7):", "- dfs(i, j)", "-\"\"\"", "+ res = False", "+ if x>0:", "+ res |= not dfs(x-1, y)", "+ if y>0:", "+ res |= not dfs(x, y-1)", "+ if min(x, y)>0:", "+ res |= not dfs(x-1, y-1)", "+ return res", "+t = [[False]*5 for _ in range(5)]", "+for i in range(5):", "+ for j in range(5):", "+ t[i][j] = dfs(i, j)", "-flag = True", "-for _ in range(N):", "- a = int(input())", "- if a % 2 == 1:", "- flag = False", "-if flag:", "- print(\"second\")", "-else:", "- print(\"first\")", "+a = [int(input()) for _ in range(N)]", "+for ai in a:", "+ if ai % 2 == 1:", "+ print(\"first\")", "+ exit()", "+print(\"second\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4127988609, "measured_runtime_v1": 0.1956315268, "runtime_lift": 2.1100835213, "key": ["s531607176", "s450058032"]} +{"user_id": "u381572531", "problem_id": "p02891", "language": "python", "submission_id_v0": "s581989830", "submission_id_v1": "s729822755", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "import sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(input())\n\n \n\ndef check_count(s):\n\n cnt_list = [1]\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt_list[-1] += 1\n\n else:\n\n cnt_list.append(1)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c//2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k//2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)//2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)", "target": "import sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(input())\n\n\n\ndef check_count(s):\n\n cnt_list = []\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt += 1\n\n else:\n\n cnt_list.append(cnt)\n\n cnt = 1\n\n if cnt>1:\n\n cnt_list.append(cnt)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c//2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k//2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)//2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)", "code_v0_loc": 35, "code_v1_loc": 38, "code_v0_num_chars": 711, "code_v1_num_chars": 765, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\ns = input().rstrip()\nk = int(input())\n\n\ndef check_count(s):\n cnt_list = [1]\n cnt = 1\n for i in range(1, len(s)):\n if s[i - 1] == s[i]:\n cnt_list[-1] += 1\n else:\n cnt_list.append(1)\n return cnt_list\n\n\ndef calc_ans(cnt_list, k):\n _ans = 0\n for c in cnt_list:\n _ans += c // 2\n return _ans * k\n\n\nif len(s) == 1:\n ans = k // 2\nelse:\n cnt_list = check_count(s)\n if len(cnt_list) == 1:\n ans = (len(s) * k) // 2\n else:\n ans = calc_ans(cnt_list, k)\n if s[0] == s[-1]:\n if cnt_list[0] % 2 == 1 and cnt_list[-1] % 2 == 1:\n ans += k - 1\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\ns = input().rstrip()\nk = int(input())\n\n\ndef check_count(s):\n cnt_list = []\n cnt = 1\n for i in range(1, len(s)):\n if s[i - 1] == s[i]:\n cnt += 1\n else:\n cnt_list.append(cnt)\n cnt = 1\n if cnt > 1:\n cnt_list.append(cnt)\n return cnt_list\n\n\ndef calc_ans(cnt_list, k):\n _ans = 0\n for c in cnt_list:\n _ans += c // 2\n return _ans * k\n\n\nif len(s) == 1:\n ans = k // 2\nelse:\n cnt_list = check_count(s)\n if len(cnt_list) == 1:\n ans = (len(s) * k) // 2\n else:\n ans = calc_ans(cnt_list, k)\n if s[0] == s[-1]:\n if cnt_list[0] % 2 == 1 and cnt_list[-1] % 2 == 1:\n ans += k - 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.8947368421, "diff": ["- cnt_list = [1]", "+ cnt_list = []", "- cnt_list[-1] += 1", "+ cnt += 1", "- cnt_list.append(1)", "+ cnt_list.append(cnt)", "+ cnt = 1", "+ if cnt > 1:", "+ cnt_list.append(cnt)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3312115214, "measured_runtime_v1": 0.249056649, "runtime_lift": 1.3298642006, "key": ["s581989830", "s729822755"]} +{"user_id": "u827885761", "problem_id": "p03013", "language": "python", "submission_id_v0": "s193052587", "submission_id_v1": "s829443238", "cpu_time_v0": 509, "cpu_time_v1": 195, "memory_v0": 46168, "memory_v1": 7668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.69, "input": "import sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\n\n\nl = [0] * (n+1)\n\nl[0] = 1\n\n\n\na = 0\n\nif m != 0:\n\n a = int(input())\n\nk = 1\n\nfor i in range(n+1):\n\n\n\n if i != a:\n\n if i == 1:\n\n l[i] = 1\n\n elif i >= 2:\n\n l[i] = l[i-1] + l[i-2]\n\n l[i] %= 1000000007\n\n else:\n\n k += 1\n\n if k <= m:\n\n a = int(input())\n\n\n\n\n\n\n\n#print(l)\n\nprint((l[n] % 1000000007))\n", "target": "import sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\na = [1] * (n+1)\n\nfor i in range(m):\n\n a[int(input())] = 0\n\nk = [0] * (n+1)\n\nk[0] = 1\n\nfor i in range(1,n+1):\n\n if i == 1 and a[1]:\n\n k[1] = 1\n\n elif i >= 2 and a[i]:\n\n k[i] = k[i-1] + k[i-2]\n\n k[i] %= 10 ** 9 + 7\n\n\n\nprint((k[n]))\n", "code_v0_loc": 30, "code_v1_loc": 18, "code_v0_num_chars": 479, "code_v1_num_chars": 367, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef lmi():\n return list(map(int, input().split()))\n\n\nn, m = lmi()\nl = [0] * (n + 1)\nl[0] = 1\na = 0\nif m != 0:\n a = int(input())\nk = 1\nfor i in range(n + 1):\n if i != a:\n if i == 1:\n l[i] = 1\n elif i >= 2:\n l[i] = l[i - 1] + l[i - 2]\n l[i] %= 1000000007\n else:\n k += 1\n if k <= m:\n a = int(input())\n# print(l)\nprint((l[n] % 1000000007))\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef lmi():\n return list(map(int, input().split()))\n\n\nn, m = lmi()\na = [1] * (n + 1)\nfor i in range(m):\n a[int(input())] = 0\nk = [0] * (n + 1)\nk[0] = 1\nfor i in range(1, n + 1):\n if i == 1 and a[1]:\n k[1] = 1\n elif i >= 2 and a[i]:\n k[i] = k[i - 1] + k[i - 2]\n k[i] %= 10**9 + 7\nprint((k[n]))\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-l = [0] * (n + 1)", "-l[0] = 1", "-a = 0", "-if m != 0:", "- a = int(input())", "-k = 1", "-for i in range(n + 1):", "- if i != a:", "- if i == 1:", "- l[i] = 1", "- elif i >= 2:", "- l[i] = l[i - 1] + l[i - 2]", "- l[i] %= 1000000007", "- else:", "- k += 1", "- if k <= m:", "- a = int(input())", "-# print(l)", "-print((l[n] % 1000000007))", "+a = [1] * (n + 1)", "+for i in range(m):", "+ a[int(input())] = 0", "+k = [0] * (n + 1)", "+k[0] = 1", "+for i in range(1, n + 1):", "+ if i == 1 and a[1]:", "+ k[1] = 1", "+ elif i >= 2 and a[i]:", "+ k[i] = k[i - 1] + k[i - 2]", "+ k[i] %= 10**9 + 7", "+print((k[n]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3120539634, "measured_runtime_v1": 0.1110639279, "runtime_lift": 2.8096787978, "key": ["s193052587", "s829443238"]} +{"user_id": "u228223940", "problem_id": "p03634", "language": "python", "submission_id_v0": "s279386500", "submission_id_v1": "s990337521", "cpu_time_v0": 1565, "cpu_time_v1": 1313, "memory_v0": 113180, "memory_v1": 156176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.1, "input": "import queue\n\nn = int(input())\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\nwhile not q.empty():\n\n tmp = q.get()\n\n for i in range(len(abc[tmp])):\n\n #print(abc[tmp])\n\n #exit()\n\n num = abc[tmp][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[tmp] + abc[tmp][i][1]\n\n q.put(num)\n\n \n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))", "target": "import queue\n\nimport sys\n\nsys.setrecursionlimit(10**7)\n\nn = int(input())\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\ndef dfs(p):\n\n for i in range(len(abc[p])):\n\n num = abc[p][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[p] + abc[p][i][1]\n\n dfs(num)\n\n\n\ndfs(k)\n\n\n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))", "code_v0_loc": 34, "code_v1_loc": 35, "code_v0_num_chars": 709, "code_v1_num_chars": 668, "code_v0_no_empty_lines": "import queue\n\nn = int(input())\nabc = [[] for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n abc[a].append([b, c])\n abc[b].append([a, c])\nQ, k = list(map(int, input().split()))\nxy = [[int(i) for i in input().split()] for j in range(Q)]\nq = queue.Queue()\nq.put(k)\npath = [-1] * (n + 1)\npath[k] = 0\nwhile not q.empty():\n tmp = q.get()\n for i in range(len(abc[tmp])):\n # print(abc[tmp])\n # exit()\n num = abc[tmp][i][0]\n if path[num] != -1:\n continue\n else:\n path[num] = path[tmp] + abc[tmp][i][1]\n q.put(num)\nfor i in range(Q):\n print((path[xy[i][0]] + path[xy[i][1]]))\n", "code_v1_no_empty_lines": "import queue\nimport sys\n\nsys.setrecursionlimit(10**7)\nn = int(input())\nabc = [[] for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n abc[a].append([b, c])\n abc[b].append([a, c])\nQ, k = list(map(int, input().split()))\nxy = [[int(i) for i in input().split()] for j in range(Q)]\nq = queue.Queue()\nq.put(k)\npath = [-1] * (n + 1)\npath[k] = 0\n\n\ndef dfs(p):\n for i in range(len(abc[p])):\n num = abc[p][i][0]\n if path[num] != -1:\n continue\n else:\n path[num] = path[p] + abc[p][i][1]\n dfs(num)\n\n\ndfs(k)\nfor i in range(Q):\n print((path[xy[i][0]] + path[xy[i][1]]))\n", "code_same": false, "relative_loc_diff_percent": 2.8571428571, "diff": ["+import sys", "+sys.setrecursionlimit(10**7)", "-while not q.empty():", "- tmp = q.get()", "- for i in range(len(abc[tmp])):", "- # print(abc[tmp])", "- # exit()", "- num = abc[tmp][i][0]", "+", "+", "+def dfs(p):", "+ for i in range(len(abc[p])):", "+ num = abc[p][i][0]", "- path[num] = path[tmp] + abc[tmp][i][1]", "- q.put(num)", "+ path[num] = path[p] + abc[p][i][1]", "+ dfs(num)", "+", "+", "+dfs(k)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3961623552, "measured_runtime_v1": 0.2607869017, "runtime_lift": 1.5191037302, "key": ["s279386500", "s990337521"]} +{"user_id": "u164727245", "problem_id": "p02685", "language": "python", "submission_id_v0": "s549338354", "submission_id_v1": "s173586541", "cpu_time_v0": 842, "cpu_time_v1": 187, "memory_v0": 9192, "memory_v1": 16648, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 77.79, "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n ret = p\n\n inv = pow(m-1, mod-2, mod)\n\n for i in range(1, k+1):\n\n ncr = (ncr * (n-i)*pow(i, mod-2, mod)) % mod\n\n p = (p*inv) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "target": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n\n\n ret = p\n\n iR = [1]*(k+1)\n\n im = pow(m-1, mod-2, mod)\n\n\n\n for i in range(1, k+1):\n\n iR[i] = max(1, (-(mod//i) * iR[mod % i]) % mod)\n\n ncr = (ncr * (n-i)*iR[i]) % mod\n\n p = (p*im) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "code_v0_loc": 24, "code_v1_loc": 28, "code_v0_num_chars": 512, "code_v1_num_chars": 578, "code_v0_no_empty_lines": "# coding: utf-8\ndef solve(*args: str) -> str:\n n, m, k = list(map(int, args[0].split()))\n mod = 998244353\n if m == 1 and n - 1 == k:\n return str(1)\n ncr = 1\n p = m * pow(m - 1, n - 1, mod) % mod\n ret = p\n inv = pow(m - 1, mod - 2, mod)\n for i in range(1, k + 1):\n ncr = (ncr * (n - i) * pow(i, mod - 2, mod)) % mod\n p = (p * inv) % mod\n ret += p * ncr % mod\n return str(ret % mod)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_v1_no_empty_lines": "# coding: utf-8\ndef solve(*args: str) -> str:\n n, m, k = list(map(int, args[0].split()))\n mod = 998244353\n if m == 1 and n - 1 == k:\n return str(1)\n ncr = 1\n p = m * pow(m - 1, n - 1, mod) % mod\n ret = p\n iR = [1] * (k + 1)\n im = pow(m - 1, mod - 2, mod)\n for i in range(1, k + 1):\n iR[i] = max(1, (-(mod // i) * iR[mod % i]) % mod)\n ncr = (ncr * (n - i) * iR[i]) % mod\n p = (p * im) % mod\n ret += p * ncr % mod\n return str(ret % mod)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["- inv = pow(m - 1, mod - 2, mod)", "+ iR = [1] * (k + 1)", "+ im = pow(m - 1, mod - 2, mod)", "- ncr = (ncr * (n - i) * pow(i, mod - 2, mod)) % mod", "- p = (p * inv) % mod", "+ iR[i] = max(1, (-(mod // i) * iR[mod % i]) % mod)", "+ ncr = (ncr * (n - i) * iR[i]) % mod", "+ p = (p * im) % mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4946005352, "measured_runtime_v1": 0.3604053538, "runtime_lift": 1.3723451385, "key": ["s549338354", "s173586541"]} +{"user_id": "u054556734", "problem_id": "p03828", "language": "python", "submission_id_v0": "s442927172", "submission_id_v1": "s952876179", "cpu_time_v0": 83, "cpu_time_v1": 25, "memory_v0": 3316, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 69.88, "input": "import collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,n+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num //= i ; ans.append(i)\n\n return ans\n\n\n\nn = int(input())\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n", "target": "import collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,int(n**0.5)+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num //= i ; ans.append(i)\n\n if num != 1: ans.append(num)\n\n return ans\n\n\n\nn = int(input())\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n", "code_v0_loc": 20, "code_v1_loc": 21, "code_v0_num_chars": 409, "code_v1_num_chars": 453, "code_v0_no_empty_lines": "import collections as col\n\n\ndef prime(n):\n ans = []\n num = n\n for i in range(2, n + 1):\n if i % 2 == 0 and i != 2:\n continue\n while num % i == 0:\n num //= i\n ans.append(i)\n return ans\n\n\nn = int(input())\nmod = 10**9 + 7\nprimes = []\nfor i in range(2, n + 1):\n primes += prime(i)\ncnt = col.Counter(primes)\nans = 1\nfor key, val in list(cnt.items()):\n ans *= val + 1\n ans %= mod\nprint(ans)\n", "code_v1_no_empty_lines": "import collections as col\n\n\ndef prime(n):\n ans = []\n num = n\n for i in range(2, int(n**0.5) + 1):\n if i % 2 == 0 and i != 2:\n continue\n while num % i == 0:\n num //= i\n ans.append(i)\n if num != 1:\n ans.append(num)\n return ans\n\n\nn = int(input())\nmod = 10**9 + 7\nprimes = []\nfor i in range(2, n + 1):\n primes += prime(i)\ncnt = col.Counter(primes)\nans = 1\nfor key, val in list(cnt.items()):\n ans *= val + 1\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.7619047619, "diff": ["- for i in range(2, n + 1):", "+ for i in range(2, int(n**0.5) + 1):", "+ if num != 1:", "+ ans.append(num)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3365422637, "measured_runtime_v1": 0.2564944384, "runtime_lift": 1.3120840585, "key": ["s442927172", "s952876179"]} +{"user_id": "u440566786", "problem_id": "p03164", "language": "python", "submission_id_v0": "s415436180", "submission_id_v1": "s201445864", "cpu_time_v0": 345, "cpu_time_v1": 221, "memory_v0": 70988, "memory_v1": 40176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 35.94, "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n,W=list(map(int,input().split()))\n\n WV=[tuple(map(int,input().split())) for _ in range(n)]\n\n\n\n V=100000\n\n dp=[INF]*(V+1)\n\n dp[0]=0\n\n\n\n for w,v in WV:\n\n for x in range(V,-1,-1):\n\n if(x+v<=V):\n\n dp[x+v]=min(dp[x+v],dp[x]+w)\n\n\n\n for x in range(V,-1,-1):\n\n if(dp[x]<=W):\n\n print(x)\n\n return\n\nresolve()", "target": "import sys\n\nINF = 1 << 60\n\nMOD = 10**9 + 7 # 998244353\n\nsys.setrecursionlimit(2147483647)\n\ninput = lambda:sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n, W = list(map(int, input().split()))\n\n dp = [INF] * (n * 1001 + 1)\n\n dp[0] = 0\n\n for _ in range(n):\n\n w, v = list(map(int, input().split()))\n\n for v0 in range(n * 1001, -1, -1):\n\n if dp[v0] == INF:\n\n continue\n\n if v + v0 <= n * 1001:\n\n dp[v + v0] = min(dp[v + v0], dp[v0] + w)\n\n for v in range(n * 1001, -1, -1):\n\n if dp[v] <= W:\n\n print(v)\n\n return\n\nresolve()", "code_v0_loc": 23, "code_v1_loc": 21, "code_v0_num_chars": 515, "code_v1_num_chars": 614, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nMOD = 10**9 + 7\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n n, W = list(map(int, input().split()))\n WV = [tuple(map(int, input().split())) for _ in range(n)]\n V = 100000\n dp = [INF] * (V + 1)\n dp[0] = 0\n for w, v in WV:\n for x in range(V, -1, -1):\n if x + v <= V:\n dp[x + v] = min(dp[x + v], dp[x] + w)\n for x in range(V, -1, -1):\n if dp[x] <= W:\n print(x)\n return\n\n\nresolve()\n", "code_v1_no_empty_lines": "import sys\n\nINF = 1 << 60\nMOD = 10**9 + 7 # 998244353\nsys.setrecursionlimit(2147483647)\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n n, W = list(map(int, input().split()))\n dp = [INF] * (n * 1001 + 1)\n dp[0] = 0\n for _ in range(n):\n w, v = list(map(int, input().split()))\n for v0 in range(n * 1001, -1, -1):\n if dp[v0] == INF:\n continue\n if v + v0 <= n * 1001:\n dp[v + v0] = min(dp[v + v0], dp[v0] + w)\n for v in range(n * 1001, -1, -1):\n if dp[v] <= W:\n print(v)\n return\n\n\nresolve()\n", "code_same": false, "relative_loc_diff_percent": 8.6956521739, "diff": ["+INF = 1 << 60", "+MOD = 10**9 + 7 # 998244353", "-INF = float(\"inf\")", "-MOD = 10**9 + 7", "- WV = [tuple(map(int, input().split())) for _ in range(n)]", "- V = 100000", "- dp = [INF] * (V + 1)", "+ dp = [INF] * (n * 1001 + 1)", "- for w, v in WV:", "- for x in range(V, -1, -1):", "- if x + v <= V:", "- dp[x + v] = min(dp[x + v], dp[x] + w)", "- for x in range(V, -1, -1):", "- if dp[x] <= W:", "- print(x)", "+ for _ in range(n):", "+ w, v = list(map(int, input().split()))", "+ for v0 in range(n * 1001, -1, -1):", "+ if dp[v0] == INF:", "+ continue", "+ if v + v0 <= n * 1001:", "+ dp[v + v0] = min(dp[v + v0], dp[v0] + w)", "+ for v in range(n * 1001, -1, -1):", "+ if dp[v] <= W:", "+ print(v)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.2692114379, "measured_runtime_v1": 0.2021781888, "runtime_lift": 6.2776872491, "key": ["s415436180", "s201445864"]} +{"user_id": "u764956288", "problem_id": "p02691", "language": "python", "submission_id_v0": "s430506044", "submission_id_v1": "s372862352", "cpu_time_v0": 215, "cpu_time_v1": 188, "memory_v0": 57704, "memory_v1": 36612, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.56, "input": "from collections import defaultdict\n\n\n\n\n\ndef main():\n\n _ = int(input())\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n L[i + height] += 1\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "from collections import defaultdict\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n if i + height < N:\n\n L[i + height] += 1\n\n \n\n if i - height > 0:\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 30, "code_v1_loc": 33, "code_v0_num_chars": 565, "code_v1_num_chars": 639, "code_v0_no_empty_lines": "from collections import defaultdict\n\n\ndef main():\n _ = int(input())\n heights = list(map(int, input().split()))\n \"\"\"\n for j>i, j-i = Ai + Aj\n i + Ai = j -Aj\n \"\"\"\n L = defaultdict(int)\n R = defaultdict(int)\n for i, height in enumerate(heights):\n L[i + height] += 1\n R[i - height] += 1\n total_count = 0\n for x, count_l in list(L.items()):\n if x in R:\n count_r = R[x]\n total_count += count_l * count_r\n print(total_count)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\n\ndef main():\n N = int(input())\n heights = list(map(int, input().split()))\n \"\"\"\n for j>i, j-i = Ai + Aj\n i + Ai = j -Aj\n \"\"\"\n L = defaultdict(int)\n R = defaultdict(int)\n for i, height in enumerate(heights):\n if i + height < N:\n L[i + height] += 1\n if i - height > 0:\n R[i - height] += 1\n total_count = 0\n for x, count_l in list(L.items()):\n if x in R:\n count_r = R[x]\n total_count += count_l * count_r\n print(total_count)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["- _ = int(input())", "+ N = int(input())", "- L[i + height] += 1", "- R[i - height] += 1", "+ if i + height < N:", "+ L[i + height] += 1", "+ if i - height > 0:", "+ R[i - height] += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3616042199, "measured_runtime_v1": 0.2114392846, "runtime_lift": 1.7102035728, "key": ["s430506044", "s372862352"]} +{"user_id": "u747602774", "problem_id": "p03039", "language": "python", "submission_id_v0": "s387237372", "submission_id_v1": "s322645394", "cpu_time_v0": 230, "cpu_time_v1": 47, "memory_v0": 9412, "memory_v1": 9476, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 79.57, "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)//2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "target": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\nans = m*n*(m+n)*(m*n-1)//3\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "code_v0_loc": 42, "code_v1_loc": 27, "code_v0_num_chars": 809, "code_v1_num_chars": 519, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) // 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n a = n - x + 1\n b = m - y + 1\n c = m * (a * (a - 1) + x * (x - 1))\n d = n * (b * (b - 1) + y * (y - 1))\n ans += (c + d) // 2\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\nans = m * n * (m + n) * (m * n - 1) // 3\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 35.7142857143, "diff": ["-def f1(x, y, a, b):", "- return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2", "-", "-", "-def f2(x, a):", "- return (a - x) * (a - x + 1) // 2", "-", "-", "-ans = 0", "-for x in range(1, n + 1):", "- for y in range(1, m + 1):", "- a = n - x + 1", "- b = m - y + 1", "- c = m * (a * (a - 1) + x * (x - 1))", "- d = n * (b * (b - 1) + y * (y - 1))", "- ans += (c + d) // 2", "- ans %= mod", "+ans = m * n * (m + n) * (m * n - 1) // 3"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3618569455, "measured_runtime_v1": 0.2781652772, "runtime_lift": 1.3008702923, "key": ["s387237372", "s322645394"]} +{"user_id": "u800396927", "problem_id": "p03253", "language": "python", "submission_id_v0": "s723979708", "submission_id_v1": "s327831897", "cpu_time_v0": 110, "cpu_time_v1": 67, "memory_v0": 10868, "memory_v1": 66752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.09, "input": "N,M = list(map(int,input().split()))\n\ndiv =[]\n\nfor i in range(2,int(M**(1/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M = M//i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1: div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum = len(frac)\n\nfor i in range(len(frac)-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1] * (N+50)\n\nfinv[-1] = pow(frac[-1], mod-2, mod)\n\nfor i in range(1, num):\n\n finv[num-1-i] = finv[num-i] * (num-i) % mod\n\nans = 1\n\nfor i in div:\n\n ans = ans * frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)", "target": "N,M = list(map(int,input().split()))\n\ndiv = []\n\nfor i in range(2,int(M**(1/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M//=i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1:div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum=len(frac)\n\nfor i in range(num-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1]*(N+50)\n\nfinv[-1] = pow(frac[-1],mod-2,mod)\n\nans = 1\n\nfor i in range(1,num):\n\n finv[num-1-i] = finv[num-i]*(num-i)%mod\n\nfor i in div:\n\n ans =ans*frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)", "code_v0_loc": 24, "code_v1_loc": 24, "code_v0_num_chars": 554, "code_v1_num_chars": 534, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\ndiv = []\nfor i in range(2, int(M ** (1 / 2)) + 2):\n cur = 0\n while M % i == 0:\n M = M // i\n cur += 1\n if cur >= 1:\n div.append(cur)\nif M > 1:\n div.append(1)\ndiv.sort()\nmod = 10**9 + 7\nfrac = [1] * (N + 50)\nnum = len(frac)\nfor i in range(len(frac) - 1):\n frac[i + 1] = frac[i] * (i + 1) % mod\nfinv = [1] * (N + 50)\nfinv[-1] = pow(frac[-1], mod - 2, mod)\nfor i in range(1, num):\n finv[num - 1 - i] = finv[num - i] * (num - i) % mod\nans = 1\nfor i in div:\n ans = ans * frac[N + i - 1] * finv[N - 1] * finv[i] % mod\nprint(ans)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\ndiv = []\nfor i in range(2, int(M ** (1 / 2)) + 2):\n cur = 0\n while M % i == 0:\n M //= i\n cur += 1\n if cur >= 1:\n div.append(cur)\nif M > 1:\n div.append(1)\ndiv.sort()\nmod = 10**9 + 7\nfrac = [1] * (N + 50)\nnum = len(frac)\nfor i in range(num - 1):\n frac[i + 1] = frac[i] * (i + 1) % mod\nfinv = [1] * (N + 50)\nfinv[-1] = pow(frac[-1], mod - 2, mod)\nans = 1\nfor i in range(1, num):\n finv[num - 1 - i] = finv[num - i] * (num - i) % mod\nfor i in div:\n ans = ans * frac[N + i - 1] * finv[N - 1] * finv[i] % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- M = M // i", "+ M //= i", "-for i in range(len(frac) - 1):", "+for i in range(num - 1):", "+ans = 1", "-ans = 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.47082161, "measured_runtime_v1": 0.3749034932, "runtime_lift": 1.2558474875, "key": ["s723979708", "s327831897"]} +{"user_id": "u290563917", "problem_id": "p03371", "language": "python", "submission_id_v0": "s511736682", "submission_id_v1": "s377839923", "cpu_time_v0": 188, "cpu_time_v1": 64, "memory_v0": 40940, "memory_v1": 65396, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.96, "input": "a, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(c_max+1):\n\n ac = x - (cc // 2)\n\n bc = y - (cc // 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)", "target": "a, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(0, c_max+1, 2):\n\n ac = x - (cc // 2)\n\n bc = y - (cc // 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)\n\n ", "code_v0_loc": 23, "code_v1_loc": 24, "code_v0_num_chars": 436, "code_v1_num_chars": 446, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\n# print(a, b, c, x, y)\nans = 10000 * (10**5) + 7\nc_max = 0\nif x > y:\n c_max = x * 2\nelse:\n c_max = y * 2\nfor cc in range(c_max + 1):\n ac = x - (cc // 2)\n bc = y - (cc // 2)\n if ac < 0:\n ac = 0\n if bc < 0:\n bc = 0\n price = ac * a + bc * b + cc * c\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n ans = min(ans, price)\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\n# print(a, b, c, x, y)\nans = 10000 * (10**5) + 7\nc_max = 0\nif x > y:\n c_max = x * 2\nelse:\n c_max = y * 2\nfor cc in range(0, c_max + 1, 2):\n ac = x - (cc // 2)\n bc = y - (cc // 2)\n if ac < 0:\n ac = 0\n if bc < 0:\n bc = 0\n price = ac * a + bc * b + cc * c\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n ans = min(ans, price)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.1666666667, "diff": ["-for cc in range(c_max + 1):", "+for cc in range(0, c_max + 1, 2):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4004499781, "measured_runtime_v1": 0.3093135242, "runtime_lift": 1.2946410251, "key": ["s511736682", "s377839923"]} +{"user_id": "u887207211", "problem_id": "p03425", "language": "python", "submission_id_v0": "s819679830", "submission_id_v1": "s546088432", "cpu_time_v0": 172, "cpu_time_v1": 153, "memory_v0": 3064, "memory_v1": 9752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.05, "input": "N = int(input())\n\nname = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor _ in range(N):\n\n S = input()\n\n if(S[0] in name):\n\n name[S[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += name[march[i]] * name[march[j]] * name[march[k]]\n\nprint(ans)", "target": "N = int(input())\n\nS = [input() for _ in range(N)]\n\n\n\nhead = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor s in S:\n\n if(s[0] in head):\n\n head[s[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += head[march[i]] * head[march[j]] * head[march[k]]\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 14, "code_v0_num_chars": 312, "code_v1_num_chars": 325, "code_v0_no_empty_lines": "N = int(input())\nname = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}\nmarch = \"MARCH\"\nfor _ in range(N):\n S = input()\n if S[0] in name:\n name[S[0]] += 1\nans = 0\nfor i in range(3):\n for j in range(i + 1, 4):\n for k in range(j + 1, 5):\n ans += name[march[i]] * name[march[j]] * name[march[k]]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nS = [input() for _ in range(N)]\nhead = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}\nmarch = \"MARCH\"\nfor s in S:\n if s[0] in head:\n head[s[0]] += 1\nans = 0\nfor i in range(3):\n for j in range(i + 1, 4):\n for k in range(j + 1, 5):\n ans += head[march[i]] * head[march[j]] * head[march[k]]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-name = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "+S = [input() for _ in range(N)]", "+head = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "-for _ in range(N):", "- S = input()", "- if S[0] in name:", "- name[S[0]] += 1", "+for s in S:", "+ if s[0] in head:", "+ head[s[0]] += 1", "- ans += name[march[i]] * name[march[j]] * name[march[k]]", "+ ans += head[march[i]] * head[march[j]] * head[march[k]]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4009393435, "measured_runtime_v1": 0.3106073449, "runtime_lift": 1.2908237686, "key": ["s819679830", "s546088432"]} +{"user_id": "u463655976", "problem_id": "p03013", "language": "python", "submission_id_v0": "s227334045", "submission_id_v1": "s524241188", "cpu_time_v0": 285, "cpu_time_v1": 189, "memory_v0": 22940, "memory_v1": 7836, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.68, "input": "from functools import lru_cache\n\nimport sys\n\nsys.setrecursionlimit(30000)\n\n\n\nN, M = list(map(int, input().split()))\n\na = list(int(input()) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nisOk = True\n\nfor i in range(M-1):\n\n if a[i] + 1 == a[i+1]:\n\n isOk = False\n\n \n\nfuncb = [-1] * 100001\n\ndef func(n):\n\n if n <= 0:\n\n return 1\n\n cnt = funcb[n]\n\n if cnt > 0:\n\n return cnt\n\n cnt = 0\n\n if n >= 2:\n\n cnt += func(n-2)\n\n if n >= 1:\n\n cnt += func(n-1)\n\n funcb[n] = cnt % MOD\n\n return funcb[n]\n\n\n\nfunc(30000)\n\nfunc(50000)\n\nfunc(80000)\n\nfunc(100000)\n\n\n\nif not isOk:\n\n print((0))\n\nelse:\n\n ans = 1\n\n s = 0\n\n for i in range(M+1):\n\n if i >= M:\n\n e = N\n\n else:\n\n e = a[i] - 1\n\n\n\n ans = ans * func(e-s) % MOD\n\n\n\n if i >= M:\n\n break\n\n\n\n s = a[i] + 1\n\n\n\n print(ans)\n", "target": "N, M = list(map(int, input().split()))\n\na = list(int(input()) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nMAP = [0] * (N + 1)\n\n\n\nfor x in a:\n\n MAP[x] = -1\n\n\n\nMAP[0] = 1 \n\nfor i in range(N):\n\n if MAP[i] < 0:\n\n continue\n\n\n\n MAP[i] %= MOD\n\n if i + 1 <= N and MAP[i+1] >= 0:\n\n MAP[i+1] += MAP[i]\n\n if i + 2 <= N and MAP[i+2] >= 0:\n\n MAP[i+2] += MAP[i]\n\n\n\nprint((MAP[N] % MOD))\n", "code_v0_loc": 53, "code_v1_loc": 22, "code_v0_num_chars": 885, "code_v1_num_chars": 403, "code_v0_no_empty_lines": "from functools import lru_cache\nimport sys\n\nsys.setrecursionlimit(30000)\nN, M = list(map(int, input().split()))\na = list(int(input()) for _ in range(M))\nMOD = pow(10, 9) + 7\nisOk = True\nfor i in range(M - 1):\n if a[i] + 1 == a[i + 1]:\n isOk = False\nfuncb = [-1] * 100001\n\n\ndef func(n):\n if n <= 0:\n return 1\n cnt = funcb[n]\n if cnt > 0:\n return cnt\n cnt = 0\n if n >= 2:\n cnt += func(n - 2)\n if n >= 1:\n cnt += func(n - 1)\n funcb[n] = cnt % MOD\n return funcb[n]\n\n\nfunc(30000)\nfunc(50000)\nfunc(80000)\nfunc(100000)\nif not isOk:\n print((0))\nelse:\n ans = 1\n s = 0\n for i in range(M + 1):\n if i >= M:\n e = N\n else:\n e = a[i] - 1\n ans = ans * func(e - s) % MOD\n if i >= M:\n break\n s = a[i] + 1\n print(ans)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\na = list(int(input()) for _ in range(M))\nMOD = pow(10, 9) + 7\nMAP = [0] * (N + 1)\nfor x in a:\n MAP[x] = -1\nMAP[0] = 1\nfor i in range(N):\n if MAP[i] < 0:\n continue\n MAP[i] %= MOD\n if i + 1 <= N and MAP[i + 1] >= 0:\n MAP[i + 1] += MAP[i]\n if i + 2 <= N and MAP[i + 2] >= 0:\n MAP[i + 2] += MAP[i]\nprint((MAP[N] % MOD))\n", "code_same": false, "relative_loc_diff_percent": 58.4905660377, "diff": ["-from functools import lru_cache", "-import sys", "-", "-sys.setrecursionlimit(30000)", "-isOk = True", "-for i in range(M - 1):", "- if a[i] + 1 == a[i + 1]:", "- isOk = False", "-funcb = [-1] * 100001", "-", "-", "-def func(n):", "- if n <= 0:", "- return 1", "- cnt = funcb[n]", "- if cnt > 0:", "- return cnt", "- cnt = 0", "- if n >= 2:", "- cnt += func(n - 2)", "- if n >= 1:", "- cnt += func(n - 1)", "- funcb[n] = cnt % MOD", "- return funcb[n]", "-", "-", "-func(30000)", "-func(50000)", "-func(80000)", "-func(100000)", "-if not isOk:", "- print((0))", "-else:", "- ans = 1", "- s = 0", "- for i in range(M + 1):", "- if i >= M:", "- e = N", "- else:", "- e = a[i] - 1", "- ans = ans * func(e - s) % MOD", "- if i >= M:", "- break", "- s = a[i] + 1", "- print(ans)", "+MAP = [0] * (N + 1)", "+for x in a:", "+ MAP[x] = -1", "+MAP[0] = 1", "+for i in range(N):", "+ if MAP[i] < 0:", "+ continue", "+ MAP[i] %= MOD", "+ if i + 1 <= N and MAP[i + 1] >= 0:", "+ MAP[i + 1] += MAP[i]", "+ if i + 2 <= N and MAP[i + 2] >= 0:", "+ MAP[i + 2] += MAP[i]", "+print((MAP[N] % MOD))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0640589638, "measured_runtime_v1": 0.2648930094, "runtime_lift": 4.0169386351, "key": ["s227334045", "s524241188"]} +{"user_id": "u254871849", "problem_id": "p03416", "language": "python", "submission_id_v0": "s286428945", "submission_id_v1": "s838954646", "cpu_time_v0": 41, "cpu_time_v1": 20, "memory_v0": 2940, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 51.22, "input": "# author: kagemeka \n\n# created: 2019-11-06 21:30:22(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\n# import statistics\n\n# import functools\n\n# import operator\n\n\n\ndef main():\n\n a, b = (int(x) for x in sys.stdin.read().split())\n\n\n\n count = 0\n\n for n in range(a, b+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n count += 1\n\n\n\n print(count) \n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n", "target": "import sys\n\nfrom bisect import bisect_left as bi_l, bisect_right as bi_r\n\n\n\na, b = list(map(int, sys.stdin.readline().split()))\n\n\n\ndef main():\n\n palindromic_nums = []\n\n for i in range(1, 10):\n\n for j in range(10):\n\n for k in range(10):\n\n x = [i, j, k, j, i]\n\n palindromic_nums.append(int(''.join(list(map(str, x)))))\n\n\n\n return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 27, "code_v1_loc": 18, "code_v0_num_chars": 576, "code_v1_num_chars": 512, "code_v0_no_empty_lines": "# author: kagemeka\n# created: 2019-11-06 21:30:22(JST)\nimport sys\n\n# import collections\n# import math\n# import string\n# import bisect\n# import re\n# import itertools\n# import statistics\n# import functools\n# import operator\ndef main():\n a, b = (int(x) for x in sys.stdin.read().split())\n count = 0\n for n in range(a, b + 1):\n n = str(n)\n if n == n[::-1]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n", "code_v1_no_empty_lines": "import sys\nfrom bisect import bisect_left as bi_l, bisect_right as bi_r\n\na, b = list(map(int, sys.stdin.readline().split()))\n\n\ndef main():\n palindromic_nums = []\n for i in range(1, 10):\n for j in range(10):\n for k in range(10):\n x = [i, j, k, j, i]\n palindromic_nums.append(int(\"\".join(list(map(str, x)))))\n return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-# author: kagemeka", "-# created: 2019-11-06 21:30:22(JST)", "+from bisect import bisect_left as bi_l, bisect_right as bi_r", "-# import collections", "-# import math", "-# import string", "-# import bisect", "-# import re", "-# import itertools", "-# import statistics", "-# import functools", "-# import operator", "+a, b = list(map(int, sys.stdin.readline().split()))", "+", "+", "- a, b = (int(x) for x in sys.stdin.read().split())", "- count = 0", "- for n in range(a, b + 1):", "- n = str(n)", "- if n == n[::-1]:", "- count += 1", "- print(count)", "+ palindromic_nums = []", "+ for i in range(1, 10):", "+ for j in range(10):", "+ for k in range(10):", "+ x = [i, j, k, j, i]", "+ palindromic_nums.append(int(\"\".join(list(map(str, x)))))", "+ return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)", "- # execute only if run as a script", "- main()", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2528932301, "measured_runtime_v1": 0.1923888798, "runtime_lift": 1.314489852, "key": ["s286428945", "s838954646"]} +{"user_id": "u157020659", "problem_id": "p02837", "language": "python", "submission_id_v0": "s547554870", "submission_id_v1": "s193607306", "cpu_time_v0": 585, "cpu_time_v1": 283, "memory_v0": 3064, "memory_v1": 18356, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 51.62, "input": "def check(x, y):\n\n for a, b in zip(x, y):\n\n if a != b and b != -1:\n\n return False\n\n else:\n\n return True\n\n\n\n\n\nn = int(input())\n\nremarks = []\n\ncnt_max = 0\n\nfor _ in range(n):\n\n a = int(input())\n\n x = [tuple(map(int, input().split())) for i in range(a)]\n\n r = [-1] * n\n\n for i, j in x:\n\n r[i - 1] = j\n\n remarks.append(r)\n\nfor r in range(2 ** n):\n\n r = list(bin(r)[2:].zfill(n))\n\n r = [int(i) for i in r[:]]\n\n cnt = 0\n\n for i in range(n):\n\n if r[i] == 1:\n\n flag = check(r, remarks[i])\n\n cnt += 1\n\n if not flag:\n\n cnt = 0\n\n break\n\n cnt_max = max(cnt, cnt_max)\n\nprint(cnt_max)", "target": "import numpy as np\n\nimport itertools\n\n\n\nn = int(input())\n\ninfo = []\n\nfor i in range(n):\n\n a = int(input())\n\n for _ in range(a):\n\n x, y = list(map(int, input().split()))\n\n info.append((i, x - 1, y))\n\n\n\na = np.array(list(itertools.product([0, 1], repeat=n)), dtype=np.bool)\n\nfor i, x, y in info:\n\n bl = (~a[:, i]) | (a[:, x] == bool(y))\n\n a = a[bl]\n\n\n\nans = a.sum(axis=1).max()\n\nprint(ans)", "code_v0_loc": 31, "code_v1_loc": 18, "code_v0_num_chars": 708, "code_v1_num_chars": 407, "code_v0_no_empty_lines": "def check(x, y):\n for a, b in zip(x, y):\n if a != b and b != -1:\n return False\n else:\n return True\n\n\nn = int(input())\nremarks = []\ncnt_max = 0\nfor _ in range(n):\n a = int(input())\n x = [tuple(map(int, input().split())) for i in range(a)]\n r = [-1] * n\n for i, j in x:\n r[i - 1] = j\n remarks.append(r)\nfor r in range(2**n):\n r = list(bin(r)[2:].zfill(n))\n r = [int(i) for i in r[:]]\n cnt = 0\n for i in range(n):\n if r[i] == 1:\n flag = check(r, remarks[i])\n cnt += 1\n if not flag:\n cnt = 0\n break\n cnt_max = max(cnt, cnt_max)\nprint(cnt_max)\n", "code_v1_no_empty_lines": "import numpy as np\nimport itertools\n\nn = int(input())\ninfo = []\nfor i in range(n):\n a = int(input())\n for _ in range(a):\n x, y = list(map(int, input().split()))\n info.append((i, x - 1, y))\na = np.array(list(itertools.product([0, 1], repeat=n)), dtype=np.bool)\nfor i, x, y in info:\n bl = (~a[:, i]) | (a[:, x] == bool(y))\n a = a[bl]\nans = a.sum(axis=1).max()\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.935483871, "diff": ["-def check(x, y):", "- for a, b in zip(x, y):", "- if a != b and b != -1:", "- return False", "- else:", "- return True", "-", "+import numpy as np", "+import itertools", "-remarks = []", "-cnt_max = 0", "-for _ in range(n):", "+info = []", "+for i in range(n):", "- x = [tuple(map(int, input().split())) for i in range(a)]", "- r = [-1] * n", "- for i, j in x:", "- r[i - 1] = j", "- remarks.append(r)", "-for r in range(2**n):", "- r = list(bin(r)[2:].zfill(n))", "- r = [int(i) for i in r[:]]", "- cnt = 0", "- for i in range(n):", "- if r[i] == 1:", "- flag = check(r, remarks[i])", "- cnt += 1", "- if not flag:", "- cnt = 0", "- break", "- cnt_max = max(cnt, cnt_max)", "-print(cnt_max)", "+ for _ in range(a):", "+ x, y = list(map(int, input().split()))", "+ info.append((i, x - 1, y))", "+a = np.array(list(itertools.product([0, 1], repeat=n)), dtype=np.bool)", "+for i, x, y in info:", "+ bl = (~a[:, i]) | (a[:, x] == bool(y))", "+ a = a[bl]", "+ans = a.sum(axis=1).max()", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1805458875, "measured_runtime_v1": 0.0064015586, "runtime_lift": 28.2034262917, "key": ["s547554870", "s193607306"]} +{"user_id": "u645250356", "problem_id": "p02881", "language": "python", "submission_id_v0": "s106501170", "submission_id_v1": "s046181145", "cpu_time_v0": 232, "cpu_time_v1": 205, "memory_v0": 43632, "memory_v1": 40808, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.64, "input": "from collections import Counter,defaultdict,deque\n\nimport sys,bisect,math,itertools,string,queue\n\nfrom heapq import heappop, heappush\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn = inp()\n\nres = float('inf')\n\nfor i in range(1,2*10**6):\n\n if (n/i).is_integer():\n\n res = min(res, i + n/i)\n\nprint((int(res-2)))\n", "target": "from collections import Counter,defaultdict,deque\n\nimport sys,bisect,math,itertools,string,queue\n\nfrom heapq import heappop, heappush\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn = inp()\n\nres = float('inf')\n\nfor i in range(1,int(math.sqrt(n))+1):\n\n if n%i == 0:\n\n res = min(res, i + n/i)\n\nprint((int(res-2)))\n", "code_v0_loc": 16, "code_v1_loc": 16, "code_v0_num_chars": 561, "code_v1_num_chars": 563, "code_v0_no_empty_lines": "from collections import Counter, defaultdict, deque\nimport sys, bisect, math, itertools, string, queue\nfrom heapq import heappop, heappush\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef inpl_str():\n return list(sys.stdin.readline().split())\n\n\ndef inpln(n):\n return list(int(sys.stdin.readline()) for i in range(n))\n\n\nn = inp()\nres = float(\"inf\")\nfor i in range(1, 2 * 10**6):\n if (n / i).is_integer():\n res = min(res, i + n / i)\nprint((int(res - 2)))\n", "code_v1_no_empty_lines": "from collections import Counter, defaultdict, deque\nimport sys, bisect, math, itertools, string, queue\nfrom heapq import heappop, heappush\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef inpl_str():\n return list(sys.stdin.readline().split())\n\n\ndef inpln(n):\n return list(int(sys.stdin.readline()) for i in range(n))\n\n\nn = inp()\nres = float(\"inf\")\nfor i in range(1, int(math.sqrt(n)) + 1):\n if n % i == 0:\n res = min(res, i + n / i)\nprint((int(res - 2)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-for i in range(1, 2 * 10**6):", "- if (n / i).is_integer():", "+for i in range(1, int(math.sqrt(n)) + 1):", "+ if n % i == 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 1.4036093347, "measured_runtime_v1": 0.1584749897, "runtime_lift": 8.856976976, "key": ["s106501170", "s046181145"]} +{"user_id": "u325956328", "problem_id": "p02555", "language": "python", "submission_id_v0": "s422627112", "submission_id_v1": "s801844924", "cpu_time_v0": 468, "cpu_time_v1": 62, "memory_v0": 9136, "memory_v1": 9124, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 86.75, "input": "S = int(input())\n\n\n\ndp = [0] * (S + 1)\n\ndp[0] = 1\n\nM = 10 ** 9 + 7\n\n\n\nfor i in range(1, S + 1):\n\n num = 0\n\n for j in range(i - 2):\n\n num += dp[j]\n\n dp[i] = num % M\n\n\n\nprint((dp[S]))\n\n\n", "target": "S = int(input())\n\n\n\n\n\ndef cmb(n, r, p):\n\n r = min(n - r, r)\n\n if r == 0:\n\n return 1\n\n over = 1\n\n for i in range(n, n - r, -1):\n\n over = over * i % p\n\n under = 1\n\n for i in range(1, r + 1):\n\n under = under * i % p\n\n inv = pow(under, p - 2, p)\n\n return over * inv % p\n\n\n\n\n\nM = 10 ** 9 + 7\n\nans = 0\n\nfor i in range(1, S):\n\n if S - 3 * i < 0:\n\n break\n\n ans += cmb(S - 3 * i + i - 1, i - 1, M)\n\n ans %= M\n\nprint(ans)\n", "code_v0_loc": 14, "code_v1_loc": 25, "code_v0_num_chars": 202, "code_v1_num_chars": 473, "code_v0_no_empty_lines": "S = int(input())\ndp = [0] * (S + 1)\ndp[0] = 1\nM = 10**9 + 7\nfor i in range(1, S + 1):\n num = 0\n for j in range(i - 2):\n num += dp[j]\n dp[i] = num % M\nprint((dp[S]))\n", "code_v1_no_empty_lines": "S = int(input())\n\n\ndef cmb(n, r, p):\n r = min(n - r, r)\n if r == 0:\n return 1\n over = 1\n for i in range(n, n - r, -1):\n over = over * i % p\n under = 1\n for i in range(1, r + 1):\n under = under * i % p\n inv = pow(under, p - 2, p)\n return over * inv % p\n\n\nM = 10**9 + 7\nans = 0\nfor i in range(1, S):\n if S - 3 * i < 0:\n break\n ans += cmb(S - 3 * i + i - 1, i - 1, M)\n ans %= M\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 44.0, "diff": ["-dp = [0] * (S + 1)", "-dp[0] = 1", "+", "+", "+def cmb(n, r, p):", "+ r = min(n - r, r)", "+ if r == 0:", "+ return 1", "+ over = 1", "+ for i in range(n, n - r, -1):", "+ over = over * i % p", "+ under = 1", "+ for i in range(1, r + 1):", "+ under = under * i % p", "+ inv = pow(under, p - 2, p)", "+ return over * inv % p", "+", "+", "-for i in range(1, S + 1):", "- num = 0", "- for j in range(i - 2):", "- num += dp[j]", "- dp[i] = num % M", "-print((dp[S]))", "+ans = 0", "+for i in range(1, S):", "+ if S - 3 * i < 0:", "+ break", "+ ans += cmb(S - 3 * i + i - 1, i - 1, M)", "+ ans %= M", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6707954504, "measured_runtime_v1": 0.2514740815, "runtime_lift": 2.6674536254, "key": ["s422627112", "s801844924"]} +{"user_id": "u326609687", "problem_id": "p03074", "language": "python", "submission_id_v0": "s171288721", "submission_id_v1": "s319292568", "cpu_time_v0": 80, "cpu_time_v1": 65, "memory_v0": 3316, "memory_v1": 4460, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.75, "input": "import sys\n\n\n\nN, K = list(map(int, input().split()))\n\nS = input()\n\n\n\n\n\ndef nexti(n):\n\n while S[n] == '1':\n\n n += 1\n\n while S[n] == '0':\n\n n += 1\n\n return n\n\n\n\n\n\ndef nextj(n):\n\n while S[n] == '0':\n\n n += 1\n\n if n == N:\n\n return N\n\n while S[n] == '1':\n\n n += 1\n\n if n == N:\n\n return N\n\n return n\n\n\n\n\n\ni = 0\n\nj = 0\n\nwhile S[j] == '1':\n\n j += 1\n\n if j == N:\n\n print(N)\n\n sys.exit(0)\n\nfor _ in range(K):\n\n j = nextj(j)\n\n if j == N:\n\n print(N)\n\n sys.exit(0)\n\n\n\nans = j - i\n\nwhile True:\n\n i = nexti(i)\n\n j = nextj(j)\n\n ans = max(ans, j - i)\n\n if j == N:\n\n break\n\n\n\nprint(ans)", "target": "from collections import deque\n\n\n\n\n\ndef nextj(n):\n\n while S[n] == '0':\n\n n += 1\n\n if n == N:\n\n return N\n\n q.appendleft(n)\n\n while S[n] == '1':\n\n n += 1\n\n if n == N:\n\n return N\n\n return n\n\n\n\n\n\ndef init(n):\n\n while S[n] == '1':\n\n n += 1\n\n if n == N:\n\n return N\n\n return n\n\n\n\n\n\ndef calc():\n\n q.appendleft(0)\n\n ans = 0\n\n j = init(0)\n\n if j == N:\n\n return N\n\n for _ in range(K - 1):\n\n j = nextj(j)\n\n if j == N:\n\n return N\n\n while True:\n\n j = nextj(j)\n\n ans = max(ans, j - q.pop())\n\n if j == N:\n\n return ans\n\n\n\n\n\nN, K = list(map(int, input().split()))\n\nS = input()\n\nq = deque()\n\nprint((calc()))\n", "code_v0_loc": 48, "code_v1_loc": 45, "code_v0_num_chars": 703, "code_v1_num_chars": 755, "code_v0_no_empty_lines": "import sys\n\nN, K = list(map(int, input().split()))\nS = input()\n\n\ndef nexti(n):\n while S[n] == \"1\":\n n += 1\n while S[n] == \"0\":\n n += 1\n return n\n\n\ndef nextj(n):\n while S[n] == \"0\":\n n += 1\n if n == N:\n return N\n while S[n] == \"1\":\n n += 1\n if n == N:\n return N\n return n\n\n\ni = 0\nj = 0\nwhile S[j] == \"1\":\n j += 1\n if j == N:\n print(N)\n sys.exit(0)\nfor _ in range(K):\n j = nextj(j)\n if j == N:\n print(N)\n sys.exit(0)\nans = j - i\nwhile True:\n i = nexti(i)\n j = nextj(j)\n ans = max(ans, j - i)\n if j == N:\n break\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import deque\n\n\ndef nextj(n):\n while S[n] == \"0\":\n n += 1\n if n == N:\n return N\n q.appendleft(n)\n while S[n] == \"1\":\n n += 1\n if n == N:\n return N\n return n\n\n\ndef init(n):\n while S[n] == \"1\":\n n += 1\n if n == N:\n return N\n return n\n\n\ndef calc():\n q.appendleft(0)\n ans = 0\n j = init(0)\n if j == N:\n return N\n for _ in range(K - 1):\n j = nextj(j)\n if j == N:\n return N\n while True:\n j = nextj(j)\n ans = max(ans, j - q.pop())\n if j == N:\n return ans\n\n\nN, K = list(map(int, input().split()))\nS = input()\nq = deque()\nprint((calc()))\n", "code_same": false, "relative_loc_diff_percent": 6.25, "diff": ["-import sys", "-", "-N, K = list(map(int, input().split()))", "-S = input()", "-", "-", "-def nexti(n):", "- while S[n] == \"1\":", "- n += 1", "- while S[n] == \"0\":", "- n += 1", "- return n", "+from collections import deque", "+ q.appendleft(n)", "-i = 0", "-j = 0", "-while S[j] == \"1\":", "- j += 1", "+def init(n):", "+ while S[n] == \"1\":", "+ n += 1", "+ if n == N:", "+ return N", "+ return n", "+", "+", "+def calc():", "+ q.appendleft(0)", "+ ans = 0", "+ j = init(0)", "- print(N)", "- sys.exit(0)", "-for _ in range(K):", "- j = nextj(j)", "- if j == N:", "- print(N)", "- sys.exit(0)", "-ans = j - i", "-while True:", "- i = nexti(i)", "- j = nextj(j)", "- ans = max(ans, j - i)", "- if j == N:", "- break", "-print(ans)", "+ return N", "+ for _ in range(K - 1):", "+ j = nextj(j)", "+ if j == N:", "+ return N", "+ while True:", "+ j = nextj(j)", "+ ans = max(ans, j - q.pop())", "+ if j == N:", "+ return ans", "+", "+", "+N, K = list(map(int, input().split()))", "+S = input()", "+q = deque()", "+print((calc()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3886394203, "measured_runtime_v1": 0.2086165268, "runtime_lift": 1.8629368734, "key": ["s171288721", "s319292568"]} +{"user_id": "u197300260", "problem_id": "p03814", "language": "python", "submission_id_v0": "s932284243", "submission_id_v1": "s708109984", "cpu_time_v0": 36, "cpu_time_v1": 29, "memory_v0": 4012, "memory_v1": 3516, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.44, "input": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n\n# Python 1st Try\n\nimport copy\n\n\n\n\n\nclass Problem:\n\n def __init__(self, stringdata):\n\n self.stringdata = stringdata\n\n\n\n def solver(self):\n\n strcont = copy.copy(self.stringdata)\n\n result = 0\n\n rightposition = 0\n\n leftposition = len(strcont)\n\n j = 0\n\n while True:\n\n if strcont[j] == 'A':\n\n rightposition = j\n\n break\n\n else:\n\n j = j + 1\n\n j = leftposition - 1\n\n while True:\n\n if strcont[j] == 'Z':\n\n leftposition = j\n\n break\n\n else:\n\n j = j - 1\n\n\n\n result = leftposition - rightposition + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = input()\n\n print((\"{}\".format(Problem(s).solver())))\n", "target": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n\n# Python 2nd Try\n\n\n\n\n\ndef solver(string):\n\n result = 200000\n\n aposi = 0\n\n zposi = len(string)\n\n for j in range(0, len(string), 1):\n\n if string[j] == 'A':\n\n aposi = j\n\n break\n\n for j in range(len(string)-1, -1, -1):\n\n if string[j] == 'Z':\n\n zposi = j\n\n break\n\n result = zposi - aposi + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = input()\n\n print(('{}'.format(solver(s))))\n", "code_v0_loc": 36, "code_v1_loc": 23, "code_v0_num_chars": 875, "code_v1_num_chars": 527, "code_v0_no_empty_lines": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n# Python 1st Try\nimport copy\n\n\nclass Problem:\n def __init__(self, stringdata):\n self.stringdata = stringdata\n\n def solver(self):\n strcont = copy.copy(self.stringdata)\n result = 0\n rightposition = 0\n leftposition = len(strcont)\n j = 0\n while True:\n if strcont[j] == \"A\":\n rightposition = j\n break\n else:\n j = j + 1\n j = leftposition - 1\n while True:\n if strcont[j] == \"Z\":\n leftposition = j\n break\n else:\n j = j - 1\n result = leftposition - rightposition + 1\n return result\n\n\nif __name__ == \"__main__\":\n s = input()\n print((\"{}\".format(Problem(s).solver())))\n", "code_v1_no_empty_lines": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n# Python 2nd Try\ndef solver(string):\n result = 200000\n aposi = 0\n zposi = len(string)\n for j in range(0, len(string), 1):\n if string[j] == \"A\":\n aposi = j\n break\n for j in range(len(string) - 1, -1, -1):\n if string[j] == \"Z\":\n zposi = j\n break\n result = zposi - aposi + 1\n return result\n\n\nif __name__ == \"__main__\":\n s = input()\n print((\"{}\".format(solver(s))))\n", "code_same": false, "relative_loc_diff_percent": 36.1111111111, "diff": ["-# Python 1st Try", "-import copy", "-", "-", "-class Problem:", "- def __init__(self, stringdata):", "- self.stringdata = stringdata", "-", "- def solver(self):", "- strcont = copy.copy(self.stringdata)", "- result = 0", "- rightposition = 0", "- leftposition = len(strcont)", "- j = 0", "- while True:", "- if strcont[j] == \"A\":", "- rightposition = j", "- break", "- else:", "- j = j + 1", "- j = leftposition - 1", "- while True:", "- if strcont[j] == \"Z\":", "- leftposition = j", "- break", "- else:", "- j = j - 1", "- result = leftposition - rightposition + 1", "- return result", "+# Python 2nd Try", "+def solver(string):", "+ result = 200000", "+ aposi = 0", "+ zposi = len(string)", "+ for j in range(0, len(string), 1):", "+ if string[j] == \"A\":", "+ aposi = j", "+ break", "+ for j in range(len(string) - 1, -1, -1):", "+ if string[j] == \"Z\":", "+ zposi = j", "+ break", "+ result = zposi - aposi + 1", "+ return result", "- print((\"{}\".format(Problem(s).solver())))", "+ print((\"{}\".format(solver(s))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2169195101, "measured_runtime_v1": 0.1208960545, "runtime_lift": 1.7942645936, "key": ["s932284243", "s708109984"]} +{"user_id": "u617515020", "problem_id": "p02814", "language": "python", "submission_id_v0": "s956521329", "submission_id_v1": "s164820491", "cpu_time_v0": 67, "cpu_time_v1": 51, "memory_v0": 16316, "memory_v1": 20372, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.88, "input": "from math import gcd\n\n\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\n\n\na=list([x//2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) // gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\n\n\nif (lcma//a[0])%2==0:\n\n print((0))\n\nelse:\n\n flg=0\n\n for i in range(1,len(a)):\n\n if (lcma//a[i])%2==0:\n\n print((0))\n\n flg=1\n\n break\n\n if flg==0:\n\n temp=m//lcma\n\n print((temp//2 if temp%2==0 else temp//2+1))", "target": "from math import gcd\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\na=list([x//2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) // gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\nfor i in range(len(a)):\n\n if (lcma//a[i])%2==0:\n\n print((0))\n\n exit()\n\ntemp=m//lcma\n\nprint((temp//2 if temp%2==0 else temp//2+1))", "code_v0_loc": 28, "code_v1_loc": 19, "code_v0_num_chars": 492, "code_v1_num_chars": 386, "code_v0_no_empty_lines": "from math import gcd\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = list(set(a))\na = list([x // 2 for x in a])\n\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) // gcd(x, q[i])\n return x\n\n\nlcma = lcm(a)\nif (lcma // a[0]) % 2 == 0:\n print((0))\nelse:\n flg = 0\n for i in range(1, len(a)):\n if (lcma // a[i]) % 2 == 0:\n print((0))\n flg = 1\n break\n if flg == 0:\n temp = m // lcma\n print((temp // 2 if temp % 2 == 0 else temp // 2 + 1))\n", "code_v1_no_empty_lines": "from math import gcd\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = list(set(a))\na = list([x // 2 for x in a])\n\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) // gcd(x, q[i])\n return x\n\n\nlcma = lcm(a)\nfor i in range(len(a)):\n if (lcma // a[i]) % 2 == 0:\n print((0))\n exit()\ntemp = m // lcma\nprint((temp // 2 if temp % 2 == 0 else temp // 2 + 1))\n", "code_same": false, "relative_loc_diff_percent": 32.1428571429, "diff": ["-from math import gcd", "+from math import gcd", "-if (lcma // a[0]) % 2 == 0:", "- print((0))", "-else:", "- flg = 0", "- for i in range(1, len(a)):", "- if (lcma // a[i]) % 2 == 0:", "- print((0))", "- flg = 1", "- break", "- if flg == 0:", "- temp = m // lcma", "- print((temp // 2 if temp % 2 == 0 else temp // 2 + 1))", "+for i in range(len(a)):", "+ if (lcma // a[i]) % 2 == 0:", "+ print((0))", "+ exit()", "+temp = m // lcma", "+print((temp // 2 if temp % 2 == 0 else temp // 2 + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2803374403, "measured_runtime_v1": 0.2137892873, "runtime_lift": 1.3112791747, "key": ["s956521329", "s164820491"]} +{"user_id": "u038021590", "problem_id": "p03171", "language": "python", "submission_id_v0": "s330952971", "submission_id_v1": "s165498833", "cpu_time_v0": 615, "cpu_time_v1": 234, "memory_v0": 115036, "memory_v1": 135316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.95, "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nn = N % 2\n\n\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor w in range(1, N+1):\n\n for i in range(N):\n\n j = i + w\n\n if j > N:\n\n continue\n\n if (w+n) % 2 == 1:\n\n DP[i][j] = min(DP[i+1][j] - A[i], DP[i][j-1] - A[j-1])\n\n else:\n\n DP[i][j] = max(DP[i+1][j] + A[i], DP[i][j-1] + A[j-1])\n\n\n\nprint((DP[0][N]))\n", "target": "N = int(input())\n\nA = list(map(int, input().split()))\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor num in range(1, N + 1):\n\n for start in range(N):\n\n end = start + num\n\n if end > N:\n\n break\n\n if num == 1:\n\n DP[start][end] = A[start]\n\n else:\n\n DP[start][end] = max(A[start] - DP[start+1][end], A[end - 1] - DP[start][end - 1])\n\nprint((DP[0][N]))\n", "code_v0_loc": 17, "code_v1_loc": 14, "code_v0_num_chars": 416, "code_v1_num_chars": 409, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nn = N % 2\nDP = [[0] * (N + 1) for _ in range(N + 1)]\nfor w in range(1, N + 1):\n for i in range(N):\n j = i + w\n if j > N:\n continue\n if (w + n) % 2 == 1:\n DP[i][j] = min(DP[i + 1][j] - A[i], DP[i][j - 1] - A[j - 1])\n else:\n DP[i][j] = max(DP[i + 1][j] + A[i], DP[i][j - 1] + A[j - 1])\nprint((DP[0][N]))\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nDP = [[0] * (N + 1) for _ in range(N + 1)]\nfor num in range(1, N + 1):\n for start in range(N):\n end = start + num\n if end > N:\n break\n if num == 1:\n DP[start][end] = A[start]\n else:\n DP[start][end] = max(\n A[start] - DP[start + 1][end], A[end - 1] - DP[start][end - 1]\n )\nprint((DP[0][N]))\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["-n = N % 2", "-for w in range(1, N + 1):", "- for i in range(N):", "- j = i + w", "- if j > N:", "- continue", "- if (w + n) % 2 == 1:", "- DP[i][j] = min(DP[i + 1][j] - A[i], DP[i][j - 1] - A[j - 1])", "+for num in range(1, N + 1):", "+ for start in range(N):", "+ end = start + num", "+ if end > N:", "+ break", "+ if num == 1:", "+ DP[start][end] = A[start]", "- DP[i][j] = max(DP[i + 1][j] + A[i], DP[i][j - 1] + A[j - 1])", "+ DP[start][end] = max(", "+ A[start] - DP[start + 1][end], A[end - 1] - DP[start][end - 1]", "+ )"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1878290408, "measured_runtime_v1": 0.0068282696, "runtime_lift": 27.5075605354, "key": ["s330952971", "s165498833"]} +{"user_id": "u957843607", "problem_id": "p02574", "language": "python", "submission_id_v0": "s835620267", "submission_id_v1": "s021486096", "cpu_time_v0": 703, "cpu_time_v1": 584, "memory_v0": 134500, "memory_v1": 134400, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.93, "input": "from math import gcd\n\n\n\nN = int(input())\n\nnum_lis = list(map(int, input().split()))\n\nc = True\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(10**6+10)\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num //= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n c = False\n\n break\n\n else:\n\n tmp.add(j)\n\n else:\n\n continue\n\n break\n\n\n\nif c:\n\n print(\"pairwise coprime\")\n\nelse:\n\n print(\"setwise coprime\")", "target": "from math import gcd\n\n\n\nN = int(input())\n\nnum_lis = list(map(int, input().split()))\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(max(num_lis))\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num //= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n print(\"setwise coprime\")\n\n exit()\n\n else:\n\n tmp.add(j)\n\nprint(\"pairwise coprime\")", "code_v0_loc": 47, "code_v1_loc": 39, "code_v0_num_chars": 793, "code_v1_num_chars": 725, "code_v0_no_empty_lines": "from math import gcd\n\nN = int(input())\nnum_lis = list(map(int, input().split()))\nc = True\n\n\ndef osa_k(max_num):\n lis = [i for i in range(max_num + 1)]\n p = 2\n while p**2 <= max_num:\n if lis[p] == p:\n for q in range(2 * p, max_num + 1, p):\n if lis[q] == q:\n lis[q] = p\n p += 1\n return lis\n\n\nhoge = 0\nfor i in num_lis:\n hoge = gcd(hoge, i)\nif hoge > 1:\n print(\"not coprime\")\n exit()\nd_lis = osa_k(10**6 + 10)\ntmp = set()\nfor i in num_lis:\n num = i\n new_tmp = set()\n while num > 1:\n d = d_lis[num]\n new_tmp.add(d)\n num //= d\n for j in new_tmp:\n if j in tmp:\n c = False\n break\n else:\n tmp.add(j)\n else:\n continue\n break\nif c:\n print(\"pairwise coprime\")\nelse:\n print(\"setwise coprime\")\n", "code_v1_no_empty_lines": "from math import gcd\n\nN = int(input())\nnum_lis = list(map(int, input().split()))\n\n\ndef osa_k(max_num):\n lis = [i for i in range(max_num + 1)]\n p = 2\n while p**2 <= max_num:\n if lis[p] == p:\n for q in range(2 * p, max_num + 1, p):\n if lis[q] == q:\n lis[q] = p\n p += 1\n return lis\n\n\nhoge = 0\nfor i in num_lis:\n hoge = gcd(hoge, i)\nif hoge > 1:\n print(\"not coprime\")\n exit()\nd_lis = osa_k(max(num_lis))\ntmp = set()\nfor i in num_lis:\n num = i\n new_tmp = set()\n while num > 1:\n d = d_lis[num]\n new_tmp.add(d)\n num //= d\n for j in new_tmp:\n if j in tmp:\n print(\"setwise coprime\")\n exit()\n else:\n tmp.add(j)\nprint(\"pairwise coprime\")\n", "code_same": false, "relative_loc_diff_percent": 17.0212765957, "diff": ["-c = True", "-d_lis = osa_k(10**6 + 10)", "+d_lis = osa_k(max(num_lis))", "- c = False", "- break", "+ print(\"setwise coprime\")", "+ exit()", "- else:", "- continue", "- break", "-if c:", "- print(\"pairwise coprime\")", "-else:", "- print(\"setwise coprime\")", "+print(\"pairwise coprime\")"], "diff_only_import_comment": false, "measured_runtime_v0": 2.272307416, "measured_runtime_v1": 0.2046107306, "runtime_lift": 11.1055144012, "key": ["s835620267", "s021486096"]} +{"user_id": "u380524497", "problem_id": "p02850", "language": "python", "submission_id_v0": "s943818401", "submission_id_v1": "s978957689", "cpu_time_v0": 583, "cpu_time_v1": 446, "memory_v0": 25092, "memory_v1": 25184, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.5, "input": "n = int(input())\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(input())\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n", "code_v0_loc": 27, "code_v1_loc": 30, "code_v0_num_chars": 455, "code_v1_num_chars": 497, "code_v0_no_empty_lines": "n = int(input())\nedges = []\nfor id in range(n - 1):\n a, b = list(map(int, input().split()))\n edges.append([a - 1, b - 1, id])\nedges.sort()\nused = [0] * (n)\nans = [0] * (n - 1)\nnum = 1\nprev = 0\nfor edge in edges:\n _from, to, id = edge\n if _from != prev:\n num = 1\n if used[_from] == num:\n num += 1\n ans[id] = num\n used[to] = num\n num += 1\n prev = _from\nprint((max(ans)))\nfor color in ans:\n print(color)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nn = int(input())\nedges = []\nfor id in range(n - 1):\n a, b = list(map(int, input().split()))\n edges.append([a - 1, b - 1, id])\nedges.sort()\nused = [0] * (n)\nans = [0] * (n - 1)\nnum = 1\nprev = 0\nfor edge in edges:\n _from, to, id = edge\n if _from != prev:\n num = 1\n if used[_from] == num:\n num += 1\n ans[id] = num\n used[to] = num\n num += 1\n prev = _from\nprint((max(ans)))\nfor color in ans:\n print(color)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["+import sys", "+", "+input = sys.stdin.readline"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2558188839, "measured_runtime_v1": 0.0060829046, "runtime_lift": 42.0553832838, "key": ["s943818401", "s978957689"]} +{"user_id": "u633068244", "problem_id": "p00122", "language": "python", "submission_id_v0": "s871701752", "submission_id_v1": "s889694954", "cpu_time_v0": 20, "cpu_time_v1": 10, "memory_v0": 4272, "memory_v1": 4268, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "dX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return \"OK\"\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = input()\n\n\txy = list(map(int,input().split()))\n\n\tans = solve(x,y,xy)\n\n\tprint(ans if ans else \"NA\")", "target": "dX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return True\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = input()\n\n\txy = list(map(int,input().split()))\n\n\tprint(\"OK\" if solve(x,y,xy) else \"NA\")", "code_v0_loc": 22, "code_v1_loc": 21, "code_v0_num_chars": 579, "code_v1_num_chars": 568, "code_v0_no_empty_lines": "dX = [2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1]\ndY = [-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2]\n\n\ndef solve(x, y, XY):\n xy = XY[:]\n if len(xy) == 0:\n return \"OK\"\n sx, sy = xy.pop(0), xy.pop(0)\n for dx, dy in zip(dX, dY):\n if doa(x + dx, y + dy, sx, sy):\n r = solve(x + dx, y + dy, xy)\n if r:\n return r\n\n\ndef doa(x, y, sx, sy):\n if not (0 <= x <= 9 and 0 <= y <= 9):\n return False\n return True if abs(x - sx) < 2 and abs(y - sy) < 2 else False\n\n\nwhile 1:\n x, y = list(map(int, input().split()))\n if x == y == 0:\n break\n n = input()\n xy = list(map(int, input().split()))\n ans = solve(x, y, xy)\n print(ans if ans else \"NA\")\n", "code_v1_no_empty_lines": "dX = [2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1]\ndY = [-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2]\n\n\ndef solve(x, y, XY):\n xy = XY[:]\n if len(xy) == 0:\n return True\n sx, sy = xy.pop(0), xy.pop(0)\n for dx, dy in zip(dX, dY):\n if doa(x + dx, y + dy, sx, sy):\n r = solve(x + dx, y + dy, xy)\n if r:\n return r\n\n\ndef doa(x, y, sx, sy):\n if not (0 <= x <= 9 and 0 <= y <= 9):\n return False\n return True if abs(x - sx) < 2 and abs(y - sy) < 2 else False\n\n\nwhile 1:\n x, y = list(map(int, input().split()))\n if x == y == 0:\n break\n n = input()\n xy = list(map(int, input().split()))\n print(\"OK\" if solve(x, y, xy) else \"NA\")\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["- return \"OK\"", "+ return True", "- ans = solve(x, y, xy)", "- print(ans if ans else \"NA\")", "+ print(\"OK\" if solve(x, y, xy) else \"NA\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2335389843, "measured_runtime_v1": 0.183096947, "runtime_lift": 1.2754936015, "key": ["s871701752", "s889694954"]} +{"user_id": "u670180528", "problem_id": "p03634", "language": "python", "submission_id_v0": "s592706363", "submission_id_v1": "s081294326", "cpu_time_v0": 718, "cpu_time_v1": 476, "memory_v0": 63540, "memory_v1": 64180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.7, "input": "from collections import deque\n\nn,*t=list(map(int,open(0).read().split()))\n\ncon=[[] for _ in range(n)]\n\ndist_f_k=[0]*n\n\n\n\nfor a,b,c in zip(t[:3*n-3:3],t[1::3],t[2::3]):\n\n\tcon[a-1].append((b-1,c))\n\n\tcon[b-1].append((a-1,c))\n\n\n\nk=t[3*n-2]\n\nque=deque([k-1])\n\nwhile que:\n\n\tcur=que.popleft()\n\n\tfor nxt,dd in con[cur]:\n\n\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\tque.append(nxt)\n\n\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\nfor x,y in zip(t[3*n-1::2],t[3*n::2]):\n\n\tprint((dist_f_k[x-1]+dist_f_k[y-1]))", "target": "def solve():\n\n\tfrom collections import deque\n\n\tn,*t=list(map(int,open(0).read().split()))\n\n\tcon=[[] for _ in range(n)]\n\n\tdist_f_k=[0]*n\n\n\tl1,l2=t[:3*n-3],t[3*n-1:]\n\n\n\n\tfor a,b,c in zip(*[iter(l1)]*3):\n\n\t\tcon[a-1].append((b-1,c))\n\n\t\tcon[b-1].append((a-1,c))\n\n\n\n\tk=t[3*n-2]\n\n\tque=deque([k-1])\n\n\twhile que:\n\n\t\tcur=que.popleft()\n\n\t\tfor nxt,dd in con[cur]:\n\n\t\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\t\tque.append(nxt)\n\n\t\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\n\tfor x,y in zip(*[iter(l2)]*2):\n\n\t\tprint((dist_f_k[x-1]+dist_f_k[y-1]))\n\n\t\t\n\nif __name__==\"__main__\":\n\n\tsolve()", "code_v0_loc": 20, "code_v1_loc": 25, "code_v0_num_chars": 476, "code_v1_num_chars": 553, "code_v0_no_empty_lines": "from collections import deque\n\nn, *t = list(map(int, open(0).read().split()))\ncon = [[] for _ in range(n)]\ndist_f_k = [0] * n\nfor a, b, c in zip(t[: 3 * n - 3 : 3], t[1::3], t[2::3]):\n con[a - 1].append((b - 1, c))\n con[b - 1].append((a - 1, c))\nk = t[3 * n - 2]\nque = deque([k - 1])\nwhile que:\n cur = que.popleft()\n for nxt, dd in con[cur]:\n if dist_f_k[nxt] == 0 and nxt != k - 1:\n que.append(nxt)\n dist_f_k[nxt] = dist_f_k[cur] + dd\nfor x, y in zip(t[3 * n - 1 :: 2], t[3 * n :: 2]):\n print((dist_f_k[x - 1] + dist_f_k[y - 1]))\n", "code_v1_no_empty_lines": "def solve():\n from collections import deque\n\n n, *t = list(map(int, open(0).read().split()))\n con = [[] for _ in range(n)]\n dist_f_k = [0] * n\n l1, l2 = t[: 3 * n - 3], t[3 * n - 1 :]\n for a, b, c in zip(*[iter(l1)] * 3):\n con[a - 1].append((b - 1, c))\n con[b - 1].append((a - 1, c))\n k = t[3 * n - 2]\n que = deque([k - 1])\n while que:\n cur = que.popleft()\n for nxt, dd in con[cur]:\n if dist_f_k[nxt] == 0 and nxt != k - 1:\n que.append(nxt)\n dist_f_k[nxt] = dist_f_k[cur] + dd\n for x, y in zip(*[iter(l2)] * 2):\n print((dist_f_k[x - 1] + dist_f_k[y - 1]))\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-from collections import deque", "+def solve():", "+ from collections import deque", "-n, *t = list(map(int, open(0).read().split()))", "-con = [[] for _ in range(n)]", "-dist_f_k = [0] * n", "-for a, b, c in zip(t[: 3 * n - 3 : 3], t[1::3], t[2::3]):", "- con[a - 1].append((b - 1, c))", "- con[b - 1].append((a - 1, c))", "-k = t[3 * n - 2]", "-que = deque([k - 1])", "-while que:", "- cur = que.popleft()", "- for nxt, dd in con[cur]:", "- if dist_f_k[nxt] == 0 and nxt != k - 1:", "- que.append(nxt)", "- dist_f_k[nxt] = dist_f_k[cur] + dd", "-for x, y in zip(t[3 * n - 1 :: 2], t[3 * n :: 2]):", "- print((dist_f_k[x - 1] + dist_f_k[y - 1]))", "+ n, *t = list(map(int, open(0).read().split()))", "+ con = [[] for _ in range(n)]", "+ dist_f_k = [0] * n", "+ l1, l2 = t[: 3 * n - 3], t[3 * n - 1 :]", "+ for a, b, c in zip(*[iter(l1)] * 3):", "+ con[a - 1].append((b - 1, c))", "+ con[b - 1].append((a - 1, c))", "+ k = t[3 * n - 2]", "+ que = deque([k - 1])", "+ while que:", "+ cur = que.popleft()", "+ for nxt, dd in con[cur]:", "+ if dist_f_k[nxt] == 0 and nxt != k - 1:", "+ que.append(nxt)", "+ dist_f_k[nxt] = dist_f_k[cur] + dd", "+ for x, y in zip(*[iter(l2)] * 2):", "+ print((dist_f_k[x - 1] + dist_f_k[y - 1]))", "+", "+", "+if __name__ == \"__main__\":", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.331901531, "measured_runtime_v1": 0.2149364519, "runtime_lift": 1.5441844695, "key": ["s592706363", "s081294326"]} +{"user_id": "u604774382", "problem_id": "p02264", "language": "python", "submission_id_v0": "s685908626", "submission_id_v1": "s418135932", "cpu_time_v0": 1410, "cpu_time_v1": 1260, "memory_v0": 17580, "memory_v1": 11516, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.64, "input": "n, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n\tps[i], t[i] = input( ).split( \" \" )\n\n\n\n\n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n\tpsi = ps.pop( 0 )\n\n\tti = int( t.pop( 0 ) )\n\n\tif ti <= q:\n\n\t\tqsum += ti\t\n\n\t\toutput.append( psi+\" \"+str( qsum ) )\n\n\telse:\n\n\t\tt.append( ti - q )\n\n\t\tps.append( psi )\n\n\t\tqsum += q\n\n\n\nprint(( \"\\n\".join( output ) ))", "target": "n, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n ps[i], t[i] = input( ).split( \" \" )\n\n \n\n \n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n psi = ps.pop( 0 )\n\n ti = int( t.pop( 0 ) )\n\n if ti <= q:\n\n qsum += ti\n\n output.append( \"\".join( ( psi, \" \", str( qsum ) ) ) )\n\n else:\n\n t.append( ti - q )\n\n ps.append( psi )\n\n qsum += q\n\n \n\nprint(( \"\\n\".join( output ) ))", "code_v0_loc": 21, "code_v1_loc": 21, "code_v0_num_chars": 383, "code_v1_num_chars": 455, "code_v0_no_empty_lines": "n, q = [int(val) for val in input().split(\" \")]\nps = [0] * n\nt = [0] * n\nfor i in range(n):\n ps[i], t[i] = input().split(\" \")\noutput = []\nqsum = 0\nwhile t:\n psi = ps.pop(0)\n ti = int(t.pop(0))\n if ti <= q:\n qsum += ti\n output.append(psi + \" \" + str(qsum))\n else:\n t.append(ti - q)\n ps.append(psi)\n qsum += q\nprint((\"\\n\".join(output)))\n", "code_v1_no_empty_lines": "n, q = [int(val) for val in input().split(\" \")]\nps = [0] * n\nt = [0] * n\nfor i in range(n):\n ps[i], t[i] = input().split(\" \")\noutput = []\nqsum = 0\nwhile t:\n psi = ps.pop(0)\n ti = int(t.pop(0))\n if ti <= q:\n qsum += ti\n output.append(\"\".join((psi, \" \", str(qsum))))\n else:\n t.append(ti - q)\n ps.append(psi)\n qsum += q\nprint((\"\\n\".join(output)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- output.append(psi + \" \" + str(qsum))", "+ output.append(\"\".join((psi, \" \", str(qsum))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2516228666, "measured_runtime_v1": 0.0710392208, "runtime_lift": 3.5420274002, "key": ["s685908626", "s418135932"]} +{"user_id": "u806976856", "problem_id": "p02555", "language": "python", "submission_id_v0": "s550500681", "submission_id_v1": "s439989437", "cpu_time_v0": 123, "cpu_time_v1": 70, "memory_v0": 9160, "memory_v1": 64844, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.09, "input": "s=int(input())\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s//3\n\nans=0\n\ndef f(n,k,p):\n\n if k==0:\n\n return 1\n\n elif k%2==0:\n\n return (f(n,k//2,p)**2)%p\n\n else:\n\n return (n*f(n,k-1,p))%p\n\n\n\nfor k in range(1,n+1):\n\n a=1\n\n b=1\n\n for j in range(k-1):\n\n a=(a*(s-3*k+1+j))%p\n\n b=(b*(j+1))%p\n\n ans=(ans+a*f(b,p-2,p))%p\n\n\n\nprint((ans%p))\n\n\n", "target": "s=int(input())\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s//3\n\nans=0\n\nx=[0]*(s+1)\n\nx[0]=1\n\nx[1]=1\n\ny=[0]*(s+1)\n\n\n\nfor i in range(2,s+1):\n\n x[i]=x[i-1]*i%p\n\n\n\ny[s]=pow(x[s],p-2,p)\n\nfor i in range(s):\n\n y[s-1-i]=y[s-i]*(s-i)%p\n\n\n\nfor k in range(1,n+1):\n\n ans+=x[s-2*k-1]*y[k-1]*y[s-3*k]%p\n\n\n\nprint((ans%p))\n\n\n", "code_v0_loc": 25, "code_v1_loc": 24, "code_v0_num_chars": 391, "code_v1_num_chars": 322, "code_v0_no_empty_lines": "s = int(input())\np = 10**9 + 7\nif s <= 2:\n print((0))\n exit()\nn = s // 3\nans = 0\n\n\ndef f(n, k, p):\n if k == 0:\n return 1\n elif k % 2 == 0:\n return (f(n, k // 2, p) ** 2) % p\n else:\n return (n * f(n, k - 1, p)) % p\n\n\nfor k in range(1, n + 1):\n a = 1\n b = 1\n for j in range(k - 1):\n a = (a * (s - 3 * k + 1 + j)) % p\n b = (b * (j + 1)) % p\n ans = (ans + a * f(b, p - 2, p)) % p\nprint((ans % p))\n", "code_v1_no_empty_lines": "s = int(input())\np = 10**9 + 7\nif s <= 2:\n print((0))\n exit()\nn = s // 3\nans = 0\nx = [0] * (s + 1)\nx[0] = 1\nx[1] = 1\ny = [0] * (s + 1)\nfor i in range(2, s + 1):\n x[i] = x[i - 1] * i % p\ny[s] = pow(x[s], p - 2, p)\nfor i in range(s):\n y[s - 1 - i] = y[s - i] * (s - i) % p\nfor k in range(1, n + 1):\n ans += x[s - 2 * k - 1] * y[k - 1] * y[s - 3 * k] % p\nprint((ans % p))\n", "code_same": false, "relative_loc_diff_percent": 4.0, "diff": ["-", "-", "-def f(n, k, p):", "- if k == 0:", "- return 1", "- elif k % 2 == 0:", "- return (f(n, k // 2, p) ** 2) % p", "- else:", "- return (n * f(n, k - 1, p)) % p", "-", "-", "+x = [0] * (s + 1)", "+x[0] = 1", "+x[1] = 1", "+y = [0] * (s + 1)", "+for i in range(2, s + 1):", "+ x[i] = x[i - 1] * i % p", "+y[s] = pow(x[s], p - 2, p)", "+for i in range(s):", "+ y[s - 1 - i] = y[s - i] * (s - i) % p", "- a = 1", "- b = 1", "- for j in range(k - 1):", "- a = (a * (s - 3 * k + 1 + j)) % p", "- b = (b * (j + 1)) % p", "- ans = (ans + a * f(b, p - 2, p)) % p", "+ ans += x[s - 2 * k - 1] * y[k - 1] * y[s - 3 * k] % p"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3091425891, "measured_runtime_v1": 0.216736346, "runtime_lift": 1.4263532387, "key": ["s550500681", "s439989437"]} +{"user_id": "u479719434", "problem_id": "p02665", "language": "python", "submission_id_v0": "s890279539", "submission_id_v1": "s923250526", "cpu_time_v0": 175, "cpu_time_v1": 149, "memory_v0": 26380, "memory_v1": 22304, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.86, "input": "n = int(input())\n\nleaves = list(map(int, input().split()))\n\n\n\nans = 0\n\nnodes_min = [0] * (n + 1)\n\nnodes_max = [0] * (n + 1)\n\nnodes_min[n] = leaves[n]\n\nnodes_max[n] = leaves[n]\n\n\n\nfor depth in range(n, 0, -1):\n\n root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2\n\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n\n root_max = nodes_max[depth]\n\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\n\nnodes = [0] * (n + 1)\n\nnodes[0] = 1\n\nif nodes[0] < nodes_min[0]:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n roots = nodes[depth]-leaves[depth]\n\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n\n if nodes[depth+1] < nodes_min[depth+1]:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(nodes)))\n", "target": "n = int(input())\n\nleaves = list(map(int, input().split()))\n\n\n\nsum_leaves = [0]*(n+1)\n\nsum_leaves[0] = leaves[0]\n\nfor depth in range(n):\n\n sum_leaves[depth+1] = sum_leaves[depth] + leaves[depth+1]\n\n\n\nans = 0\n\n\n\nroot = [None] * (n + 1)\n\nif n == 0:\n\n root[0] = 0\n\nelse:\n\n root[0] = 1\n\nif root[0] + leaves[0] != 1:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n root[depth+1] = min(2*root[depth]-leaves[depth+1],\n\n sum_leaves[n]-sum_leaves[depth+1])\n\n if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth+1] < 0:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(root)+sum(leaves)))\n", "code_v0_loc": 27, "code_v1_loc": 26, "code_v0_num_chars": 771, "code_v1_num_chars": 669, "code_v0_no_empty_lines": "n = int(input())\nleaves = list(map(int, input().split()))\nans = 0\nnodes_min = [0] * (n + 1)\nnodes_max = [0] * (n + 1)\nnodes_min[n] = leaves[n]\nnodes_max[n] = leaves[n]\nfor depth in range(n, 0, -1):\n root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n root_max = nodes_max[depth]\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\nnodes = [0] * (n + 1)\nnodes[0] = 1\nif nodes[0] < nodes_min[0]:\n print((-1))\nelse:\n for depth in range(n):\n roots = nodes[depth] - leaves[depth]\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n if nodes[depth + 1] < nodes_min[depth + 1]:\n print((-1))\n break\n else:\n print((sum(nodes)))\n", "code_v1_no_empty_lines": "n = int(input())\nleaves = list(map(int, input().split()))\nsum_leaves = [0] * (n + 1)\nsum_leaves[0] = leaves[0]\nfor depth in range(n):\n sum_leaves[depth + 1] = sum_leaves[depth] + leaves[depth + 1]\nans = 0\nroot = [None] * (n + 1)\nif n == 0:\n root[0] = 0\nelse:\n root[0] = 1\nif root[0] + leaves[0] != 1:\n print((-1))\nelse:\n for depth in range(n):\n root[depth + 1] = min(\n 2 * root[depth] - leaves[depth + 1], sum_leaves[n] - sum_leaves[depth + 1]\n )\n if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth + 1] < 0:\n print((-1))\n break\n else:\n print((sum(root) + sum(leaves)))\n", "code_same": false, "relative_loc_diff_percent": 3.7037037037, "diff": ["+sum_leaves = [0] * (n + 1)", "+sum_leaves[0] = leaves[0]", "+for depth in range(n):", "+ sum_leaves[depth + 1] = sum_leaves[depth] + leaves[depth + 1]", "-nodes_min = [0] * (n + 1)", "-nodes_max = [0] * (n + 1)", "-nodes_min[n] = leaves[n]", "-nodes_max[n] = leaves[n]", "-for depth in range(n, 0, -1):", "- root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2", "- nodes_min[depth - 1] = leaves[depth - 1] + root_min", "- root_max = nodes_max[depth]", "- nodes_max[depth - 1] = leaves[depth - 1] + root_max", "-nodes = [0] * (n + 1)", "-nodes[0] = 1", "-if nodes[0] < nodes_min[0]:", "+root = [None] * (n + 1)", "+if n == 0:", "+ root[0] = 0", "+else:", "+ root[0] = 1", "+if root[0] + leaves[0] != 1:", "- roots = nodes[depth] - leaves[depth]", "- nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])", "- if nodes[depth + 1] < nodes_min[depth + 1]:", "+ root[depth + 1] = min(", "+ 2 * root[depth] - leaves[depth + 1], sum_leaves[n] - sum_leaves[depth + 1]", "+ )", "+ if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth + 1] < 0:", "- print((sum(nodes)))", "+ print((sum(root) + sum(leaves)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.455775662, "measured_runtime_v1": 0.2425963848, "runtime_lift": 1.8787405363, "key": ["s890279539", "s923250526"]} +{"user_id": "u492605584", "problem_id": "p03164", "language": "python", "submission_id_v0": "s292196170", "submission_id_v1": "s917581247", "cpu_time_v0": 446, "cpu_time_v1": 321, "memory_v0": 119916, "memory_v1": 41964, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.03, "input": "N, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [[10**9+1] * (V + 1) for i in range(N+1)]\n\ndp[0][0] = 0\n\nfor i in range(N):\n\n for j in range(V+1):\n\n if j - L[i][1] >= 0:\n\n dp[i+1][j] = min(dp[i][j], dp[i][j-L[i][1]] + L[i][0])\n\n else:\n\n dp[i+1][j] = dp[i][j]\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[-1][j]:\n\n ans = max(ans, j)\n\nprint(ans)", "target": "N, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [10**9+1] * (V + 1)\n\ndp[0] = 0\n\nfor i in range(N):\n\n for j in range(V, -1, -1):\n\n dp[j] = min(dp[j], dp[j-L[i][1]] + L[i][0])\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[j]:\n\n ans = max(ans, j)\n\nprint(ans)", "code_v0_loc": 19, "code_v1_loc": 16, "code_v0_num_chars": 481, "code_v1_num_chars": 367, "code_v0_no_empty_lines": "N, W = list(map(int, input().split()))\nL = [list(map(int, input().split())) for i in range(N)]\nV = 0\nfor i in range(N):\n V += L[i][1]\ndp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]\ndp[0][0] = 0\nfor i in range(N):\n for j in range(V + 1):\n if j - L[i][1] >= 0:\n dp[i + 1][j] = min(dp[i][j], dp[i][j - L[i][1]] + L[i][0])\n else:\n dp[i + 1][j] = dp[i][j]\nans = 0\nfor j in range(V + 1):\n if W >= dp[-1][j]:\n ans = max(ans, j)\nprint(ans)\n", "code_v1_no_empty_lines": "N, W = list(map(int, input().split()))\nL = [list(map(int, input().split())) for i in range(N)]\nV = 0\nfor i in range(N):\n V += L[i][1]\ndp = [10**9 + 1] * (V + 1)\ndp[0] = 0\nfor i in range(N):\n for j in range(V, -1, -1):\n dp[j] = min(dp[j], dp[j - L[i][1]] + L[i][0])\nans = 0\nfor j in range(V + 1):\n if W >= dp[j]:\n ans = max(ans, j)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.7894736842, "diff": ["-dp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]", "-dp[0][0] = 0", "+dp = [10**9 + 1] * (V + 1)", "+dp[0] = 0", "- for j in range(V + 1):", "- if j - L[i][1] >= 0:", "- dp[i + 1][j] = min(dp[i][j], dp[i][j - L[i][1]] + L[i][0])", "- else:", "- dp[i + 1][j] = dp[i][j]", "+ for j in range(V, -1, -1):", "+ dp[j] = min(dp[j], dp[j - L[i][1]] + L[i][0])", "- if W >= dp[-1][j]:", "+ if W >= dp[j]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3010064836, "measured_runtime_v1": 0.1980076838, "runtime_lift": 1.5201757721, "key": ["s292196170", "s917581247"]} +{"user_id": "u893063840", "problem_id": "p02702", "language": "python", "submission_id_v0": "s375368375", "submission_id_v1": "s846087139", "cpu_time_v0": 644, "cpu_time_v1": 545, "memory_v0": 26036, "memory_v1": 24420, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.37, "input": "from collections import Counter\n\n\n\ns = input()\n\nmod1 = 673\n\nmod2 = 3\n\n\n\nnum1 = 0\n\nnum2 = 0\n\nli1 = []\n\nli2 = []\n\npw1 = 10\n\npw2 = 10\n\nfor i, e in enumerate(s, 1):\n\n num1 *= 10\n\n num1 += int(e)\n\n num1 %= mod1\n\n inv = pow(pw1, mod1 - 2, mod1)\n\n li1.append(num1 * inv % mod1)\n\n\n\n num2 *= 10\n\n num2 += int(e)\n\n num2 %= mod2\n\n inv = pow(pw2, mod2 - 2, mod2)\n\n li2.append(num2 * inv % mod2)\n\n\n\n pw1 *= 10\n\n pw1 %= mod1\n\n pw2 *= 10\n\n pw2 %= mod2\n\n\n\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\n\nc = Counter(li)\n\n\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) // 2\n\n\n\nprint(ans)\n", "target": "from collections import Counter\n\n\n\n\n\ndef f(mod):\n\n ret = [0]\n\n power = 1\n\n num = 0\n\n for i, e in enumerate(s, 1):\n\n num *= 10\n\n num += int(e)\n\n num %= mod\n\n\n\n power *= 10\n\n power %= mod\n\n inv = pow(power, mod - 2, mod)\n\n\n\n ret.append(num * inv % mod)\n\n\n\n return ret\n\n\n\n\n\ns = input()\n\n\n\nmod3 = f(3)\n\nmod673 = f(673)\n\n\n\nli = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]\n\n\n\nc = Counter(li)\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) // 2\n\nprint(ans)\n", "code_v0_loc": 38, "code_v1_loc": 33, "code_v0_num_chars": 629, "code_v1_num_chars": 529, "code_v0_no_empty_lines": "from collections import Counter\n\ns = input()\nmod1 = 673\nmod2 = 3\nnum1 = 0\nnum2 = 0\nli1 = []\nli2 = []\npw1 = 10\npw2 = 10\nfor i, e in enumerate(s, 1):\n num1 *= 10\n num1 += int(e)\n num1 %= mod1\n inv = pow(pw1, mod1 - 2, mod1)\n li1.append(num1 * inv % mod1)\n num2 *= 10\n num2 += int(e)\n num2 %= mod2\n inv = pow(pw2, mod2 - 2, mod2)\n li2.append(num2 * inv % mod2)\n pw1 *= 10\n pw1 %= mod1\n pw2 *= 10\n pw2 %= mod2\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\nc = Counter(li)\nans = 0\nfor v in list(c.values()):\n ans += v * (v - 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import Counter\n\n\ndef f(mod):\n ret = [0]\n power = 1\n num = 0\n for i, e in enumerate(s, 1):\n num *= 10\n num += int(e)\n num %= mod\n power *= 10\n power %= mod\n inv = pow(power, mod - 2, mod)\n ret.append(num * inv % mod)\n return ret\n\n\ns = input()\nmod3 = f(3)\nmod673 = f(673)\nli = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]\nc = Counter(li)\nans = 0\nfor v in list(c.values()):\n ans += v * (v - 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 13.1578947368, "diff": ["+", "+def f(mod):", "+ ret = [0]", "+ power = 1", "+ num = 0", "+ for i, e in enumerate(s, 1):", "+ num *= 10", "+ num += int(e)", "+ num %= mod", "+ power *= 10", "+ power %= mod", "+ inv = pow(power, mod - 2, mod)", "+ ret.append(num * inv % mod)", "+ return ret", "+", "+", "-mod1 = 673", "-mod2 = 3", "-num1 = 0", "-num2 = 0", "-li1 = []", "-li2 = []", "-pw1 = 10", "-pw2 = 10", "-for i, e in enumerate(s, 1):", "- num1 *= 10", "- num1 += int(e)", "- num1 %= mod1", "- inv = pow(pw1, mod1 - 2, mod1)", "- li1.append(num1 * inv % mod1)", "- num2 *= 10", "- num2 += int(e)", "- num2 %= mod2", "- inv = pow(pw2, mod2 - 2, mod2)", "- li2.append(num2 * inv % mod2)", "- pw1 *= 10", "- pw1 %= mod1", "- pw2 *= 10", "- pw2 %= mod2", "-li = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]", "+mod3 = f(3)", "+mod673 = f(673)", "+li = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4600284932, "measured_runtime_v1": 0.2683121743, "runtime_lift": 1.7145270963, "key": ["s375368375", "s846087139"]} +{"user_id": "u207799478", "problem_id": "p03568", "language": "python", "submission_id_v0": "s195491532", "submission_id_v1": "s278252901", "cpu_time_v0": 90, "cpu_time_v1": 25, "memory_v0": 3832, "memory_v1": 3832, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.22, "input": "import math\n\nimport string\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\n\nn = int(input())\n\na = readints()\n\n\n\n\n\ndef func(l):\n\n if len(l) == n:\n\n for i in range(len(l)):\n\n if l[i] % 2 == 0:\n\n return 1\n\n\n\n return 0\n\n return func(l+[(a[len(l)])])+func(l+[(a[len(l)]-1)])+func(l+[(a[len(l)]+1)])\n\n\n\n\n\nprint((func([])))\n", "target": "import math\n\nimport string\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\n\nn = int(input())\n\na = readints()\n\nsum = 1\n\nfor i in range(len(a)):\n\n if a[i] % 2 == 0:\n\n sum *= 2\n\n else:\n\n sum *= 1\n\nprint((3**len(a)-sum))\n", "code_v0_loc": 47, "code_v1_loc": 41, "code_v0_num_chars": 865, "code_v1_num_chars": 739, "code_v0_no_empty_lines": "import math\nimport string\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not (item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n + 1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\nn = int(input())\na = readints()\n\n\ndef func(l):\n if len(l) == n:\n for i in range(len(l)):\n if l[i] % 2 == 0:\n return 1\n return 0\n return (\n func(l + [(a[len(l)])])\n + func(l + [(a[len(l)] - 1)])\n + func(l + [(a[len(l)] + 1)])\n )\n\n\nprint((func([])))\n", "code_v1_no_empty_lines": "import math\nimport string\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not (item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n + 1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\nn = int(input())\na = readints()\nsum = 1\nfor i in range(len(a)):\n if a[i] % 2 == 0:\n sum *= 2\n else:\n sum *= 1\nprint((3 ** len(a) - sum))\n", "code_same": false, "relative_loc_diff_percent": 12.7659574468, "diff": ["-", "-", "-def func(l):", "- if len(l) == n:", "- for i in range(len(l)):", "- if l[i] % 2 == 0:", "- return 1", "- return 0", "- return (", "- func(l + [(a[len(l)])])", "- + func(l + [(a[len(l)] - 1)])", "- + func(l + [(a[len(l)] + 1)])", "- )", "-", "-", "-print((func([])))", "+sum = 1", "+for i in range(len(a)):", "+ if a[i] % 2 == 0:", "+ sum *= 2", "+ else:", "+ sum *= 1", "+print((3 ** len(a) - sum))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3073070612, "measured_runtime_v1": 0.2000235903, "runtime_lift": 1.5363540904, "key": ["s195491532", "s278252901"]} +{"user_id": "u312025627", "problem_id": "p03241", "language": "python", "submission_id_v0": "s848556972", "submission_id_v1": "s836748791", "cpu_time_v0": 174, "cpu_time_v1": 20, "memory_v0": 38640, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 88.51, "input": "def main():\n\n N, M = (int(i) for i in input().split())\n\n\n\n def trial_division(n):\n\n divs = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divs.append(i)\n\n if i != n//i:\n\n divs.append(n//i)\n\n divs.sort(reverse=True)\n\n return divs\n\n divs = trial_division(M)\n\n for d in divs:\n\n if d*N <= M:\n\n return print(d)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n def trial_division(n):\n\n divs = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divs.append(i)\n\n if i != n//i:\n\n divs.append(n//i)\n\n divs.sort(reverse=True)\n\n return divs\n\n\n\n N, M = (int(i) for i in input().split())\n\n divs = trial_division(M)\n\n for d in divs:\n\n if N*d <= M:\n\n return print(d)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 20, "code_v1_loc": 20, "code_v0_num_chars": 479, "code_v1_num_chars": 479, "code_v0_no_empty_lines": "def main():\n N, M = (int(i) for i in input().split())\n\n def trial_division(n):\n divs = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divs.append(i)\n if i != n // i:\n divs.append(n // i)\n divs.sort(reverse=True)\n return divs\n\n divs = trial_division(M)\n for d in divs:\n if d * N <= M:\n return print(d)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n def trial_division(n):\n divs = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divs.append(i)\n if i != n // i:\n divs.append(n // i)\n divs.sort(reverse=True)\n return divs\n\n N, M = (int(i) for i in input().split())\n divs = trial_division(M)\n for d in divs:\n if N * d <= M:\n return print(d)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- N, M = (int(i) for i in input().split())", "-", "+ N, M = (int(i) for i in input().split())", "- if d * N <= M:", "+ if N * d <= M:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3135980744, "measured_runtime_v1": 0.0063253348, "runtime_lift": 49.5780989437, "key": ["s848556972", "s836748791"]} +{"user_id": "u754022296", "problem_id": "p04017", "language": "python", "submission_id_v0": "s083196734", "submission_id_v1": "s862767700", "cpu_time_v0": 1272, "cpu_time_v1": 635, "memory_v0": 90144, "memory_v1": 80288, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.08, "input": "import sys\n\ninput = sys.stdin.readline\n\nimport bisect\n\n\n\nn = int(input())\n\nX = list(map(int, input().split()))\n\nl = int(input())\n\nU = 17\n\ndp = [[0]*n for _ in range(U+1)]\n\nfor i, x in enumerate(X):\n\n t = bisect.bisect_left(X, x+l)\n\n dp[0][i] = bisect.bisect_right(X, x+l) - 1\n\nfor k in range(U):\n\n for i in range(n):\n\n dp[k+1][i] = dp[k][dp[k][i]]\n\ndef test(x, a, b):\n\n for i in range(U, -1, -1):\n\n if x >> i & 1:\n\n a = dp[i][a]\n\n return a >= b\n\ndef solve(a, b):\n\n if a > b:\n\n a, b = b, a\n\n ng = 0\n\n ok = n-1\n\n while ok - ng > 1:\n\n mid = (ng + ok) // 2\n\n if test(mid, a, b):\n\n ok = mid\n\n else:\n\n ng = mid\n\n print(ok)\n\nq = int(input())\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n solve(a, b)", "target": "import sys\n\ninput = sys.stdin.readline\n\nimport bisect\n\n\n\nn = int(input())\n\nX = list(map(int, input().split()))\n\nl = int(input())\n\nU = 17\n\ndp = [[0]*n for _ in range(U+1)]\n\nfor i, x in enumerate(X):\n\n t = bisect.bisect_left(X, x+l)\n\n dp[0][i] = bisect.bisect_right(X, x+l) - 1\n\nfor k in range(U):\n\n for i in range(n):\n\n dp[k+1][i] = dp[k][dp[k][i]]\n\nq = int(input())\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n if a > b:\n\n a, b = b, a\n\n res = 1\n\n for k in range(U, -1, -1):\n\n if dp[k][a] < b:\n\n a = dp[k][a]\n\n res += (1<> i & 1:\n a = dp[i][a]\n return a >= b\n\n\ndef solve(a, b):\n if a > b:\n a, b = b, a\n ng = 0\n ok = n - 1\n while ok - ng > 1:\n mid = (ng + ok) // 2\n if test(mid, a, b):\n ok = mid\n else:\n ng = mid\n print(ok)\n\n\nq = int(input())\nfor _ in range(q):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n solve(a, b)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nimport bisect\n\nn = int(input())\nX = list(map(int, input().split()))\nl = int(input())\nU = 17\ndp = [[0] * n for _ in range(U + 1)]\nfor i, x in enumerate(X):\n t = bisect.bisect_left(X, x + l)\n dp[0][i] = bisect.bisect_right(X, x + l) - 1\nfor k in range(U):\n for i in range(n):\n dp[k + 1][i] = dp[k][dp[k][i]]\nq = int(input())\nfor _ in range(q):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n if a > b:\n a, b = b, a\n res = 1\n for k in range(U, -1, -1):\n if dp[k][a] < b:\n a = dp[k][a]\n res += 1 << k\n if a == b:\n break\n print(res)\n", "code_same": false, "relative_loc_diff_percent": 21.0526315789, "diff": ["-", "-", "-def test(x, a, b):", "- for i in range(U, -1, -1):", "- if x >> i & 1:", "- a = dp[i][a]", "- return a >= b", "-", "-", "-def solve(a, b):", "- if a > b:", "- a, b = b, a", "- ng = 0", "- ok = n - 1", "- while ok - ng > 1:", "- mid = (ng + ok) // 2", "- if test(mid, a, b):", "- ok = mid", "- else:", "- ng = mid", "- print(ok)", "-", "-", "- solve(a, b)", "+ if a > b:", "+ a, b = b, a", "+ res = 1", "+ for k in range(U, -1, -1):", "+ if dp[k][a] < b:", "+ a = dp[k][a]", "+ res += 1 << k", "+ if a == b:", "+ break", "+ print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.33038889, "measured_runtime_v1": 0.2620919657, "runtime_lift": 1.2605838152, "key": ["s083196734", "s862767700"]} +{"user_id": "u002459665", "problem_id": "p03854", "language": "python", "submission_id_v0": "s451133157", "submission_id_v1": "s498631928", "cpu_time_v0": 759, "cpu_time_v1": 146, "memory_v0": 3936, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.76, "input": "def main():\n\n S = input()\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n # print(w1,w2,w3,w4)\n\n S = S[::-1]\n\n # print(S)\n\n\n\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n\n words = [w1, w2, w3, w4]\n\n T = ''\n\n while S != T:\n\n cand = []\n\n for w in words:\n\n new_t = T + w\n\n cand.append(new_t) \n\n # print('cand', cand)\n\n ans = False\n\n for c in cand:\n\n if c == S[:len(c)]:\n\n T = c\n\n ans = True\n\n\n\n if not ans:\n\n break\n\n\n\n if S == T:\n\n print('YES')\n\n else:\n\n print(\"NO\")\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "def main():\n\n S = input()\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n S = S[::-1]\n\n words = [w1, w2, w3, w4]\n\n\n\n flag = False\n\n i = 0\n\n while i < len(S):\n\n for w in words:\n\n if S[i:].startswith(w):\n\n i += len(w)\n\n flag = True\n\n break\n\n\n\n if not flag:\n\n print(\"NO\")\n\n exit()\n\n flag = False\n\n\n\n print(\"YES\")\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 35, "code_v1_loc": 29, "code_v0_num_chars": 724, "code_v1_num_chars": 528, "code_v0_no_empty_lines": "def main():\n S = input()\n w1 = \"dream\"[::-1]\n w2 = \"dreamer\"[::-1]\n w3 = \"erase\"[::-1]\n w4 = \"eraser\"[::-1]\n # print(w1,w2,w3,w4)\n S = S[::-1]\n # print(S)\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n words = [w1, w2, w3, w4]\n T = \"\"\n while S != T:\n cand = []\n for w in words:\n new_t = T + w\n cand.append(new_t)\n # print('cand', cand)\n ans = False\n for c in cand:\n if c == S[: len(c)]:\n T = c\n ans = True\n if not ans:\n break\n if S == T:\n print(\"YES\")\n else:\n print(\"NO\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n S = input()\n w1 = \"dream\"[::-1]\n w2 = \"dreamer\"[::-1]\n w3 = \"erase\"[::-1]\n w4 = \"eraser\"[::-1]\n S = S[::-1]\n words = [w1, w2, w3, w4]\n flag = False\n i = 0\n while i < len(S):\n for w in words:\n if S[i:].startswith(w):\n i += len(w)\n flag = True\n break\n if not flag:\n print(\"NO\")\n exit()\n flag = False\n print(\"YES\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 17.1428571429, "diff": ["- # print(w1,w2,w3,w4)", "- # print(S)", "- # words = ['dream', 'dreamer', 'erase', 'eraser']", "- T = \"\"", "- while S != T:", "- cand = []", "+ flag = False", "+ i = 0", "+ while i < len(S):", "- new_t = T + w", "- cand.append(new_t)", "- # print('cand', cand)", "- ans = False", "- for c in cand:", "- if c == S[: len(c)]:", "- T = c", "- ans = True", "- if not ans:", "- break", "- if S == T:", "- print(\"YES\")", "- else:", "- print(\"NO\")", "+ if S[i:].startswith(w):", "+ i += len(w)", "+ flag = True", "+ break", "+ if not flag:", "+ print(\"NO\")", "+ exit()", "+ flag = False", "+ print(\"YES\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3388795207, "measured_runtime_v1": 0.2570693116, "runtime_lift": 1.3182418333, "key": ["s451133157", "s498631928"]} +{"user_id": "u761320129", "problem_id": "p03806", "language": "python", "submission_id_v0": "s128261336", "submission_id_v1": "s895482909", "cpu_time_v0": 493, "cpu_time_v1": 263, "memory_v0": 4852, "memory_v1": 4852, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.65, "input": "N,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\nmaxa = maxb = 0\n\nfor a,b,c in src:\n\n for ai in range(maxa,-1,-1):\n\n for bi in range(maxb,-1,-1):\n\n dp[ai+a][bi+b] = min(dp[ai+a][bi+b], dp[ai][bi] + c)\n\n maxa += a\n\n maxb += b\n\n\n\nans = INF\n\nfor i in range(1,401):\n\n if MA*i > 400 or MB*i > 400: break\n\n ans = min(ans, dp[MA*i][MB*i])\n\nprint((-1 if ans == INF else ans))", "target": "N,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\nMAX = 401\n\ndp = [[INF] * MAX for i in range(MAX)]\n\ndp[0][0] = 0\n\namax = bmax = 0\n\nfor a,b,n in src:\n\n for i in reversed(list(range(bmax+1))):\n\n for j in range(amax+1):\n\n if dp[i][j] == INF: continue\n\n dp[i+b][j+a] = min(dp[i+b][j+a], dp[i][j] + n)\n\n amax += a\n\n bmax += b\n\n\n\nans = INF\n\nfor i in range(1,MAX):\n\n if i*MA >= MAX or i*MB >= MAX: break\n\n ans = min(ans, dp[i*MB][i*MA])\n\nprint((-1 if ans == INF else ans))", "code_v0_loc": 19, "code_v1_loc": 21, "code_v0_num_chars": 527, "code_v1_num_chars": 562, "code_v0_no_empty_lines": "N, MA, MB = list(map(int, input().split()))\nsrc = [tuple(map(int, input().split())) for i in range(N)]\nINF = 10**9\ndp = [[INF for j in range(401)] for i in range(401)]\ndp[0][0] = 0\nmaxa = maxb = 0\nfor a, b, c in src:\n for ai in range(maxa, -1, -1):\n for bi in range(maxb, -1, -1):\n dp[ai + a][bi + b] = min(dp[ai + a][bi + b], dp[ai][bi] + c)\n maxa += a\n maxb += b\nans = INF\nfor i in range(1, 401):\n if MA * i > 400 or MB * i > 400:\n break\n ans = min(ans, dp[MA * i][MB * i])\nprint((-1 if ans == INF else ans))\n", "code_v1_no_empty_lines": "N, MA, MB = list(map(int, input().split()))\nsrc = [tuple(map(int, input().split())) for i in range(N)]\nINF = 10**9\nMAX = 401\ndp = [[INF] * MAX for i in range(MAX)]\ndp[0][0] = 0\namax = bmax = 0\nfor a, b, n in src:\n for i in reversed(list(range(bmax + 1))):\n for j in range(amax + 1):\n if dp[i][j] == INF:\n continue\n dp[i + b][j + a] = min(dp[i + b][j + a], dp[i][j] + n)\n amax += a\n bmax += b\nans = INF\nfor i in range(1, MAX):\n if i * MA >= MAX or i * MB >= MAX:\n break\n ans = min(ans, dp[i * MB][i * MA])\nprint((-1 if ans == INF else ans))\n", "code_same": false, "relative_loc_diff_percent": 9.5238095238, "diff": ["-dp = [[INF for j in range(401)] for i in range(401)]", "+MAX = 401", "+dp = [[INF] * MAX for i in range(MAX)]", "-maxa = maxb = 0", "-for a, b, c in src:", "- for ai in range(maxa, -1, -1):", "- for bi in range(maxb, -1, -1):", "- dp[ai + a][bi + b] = min(dp[ai + a][bi + b], dp[ai][bi] + c)", "- maxa += a", "- maxb += b", "+amax = bmax = 0", "+for a, b, n in src:", "+ for i in reversed(list(range(bmax + 1))):", "+ for j in range(amax + 1):", "+ if dp[i][j] == INF:", "+ continue", "+ dp[i + b][j + a] = min(dp[i + b][j + a], dp[i][j] + n)", "+ amax += a", "+ bmax += b", "-for i in range(1, 401):", "- if MA * i > 400 or MB * i > 400:", "+for i in range(1, MAX):", "+ if i * MA >= MAX or i * MB >= MAX:", "- ans = min(ans, dp[MA * i][MB * i])", "+ ans = min(ans, dp[i * MB][i * MA])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4613628248, "measured_runtime_v1": 0.3376750898, "runtime_lift": 1.3662921511, "key": ["s128261336", "s895482909"]} +{"user_id": "u325282913", "problem_id": "p03013", "language": "python", "submission_id_v0": "s961535130", "submission_id_v1": "s147927462", "cpu_time_v0": 230, "cpu_time_v1": 192, "memory_v0": 40940, "memory_v1": 7668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.52, "input": "import sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int,input().split()))\n\nhole = [0] * (N+1)\n\nfor i in range(M):\n\n hole[int(input())] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nif N == 2:\n\n if hole[1] == 1:\n\n print((1))\n\n exit()\n\n if hole[1] == 0:\n\n print((2))\n\n exit()\n\nflg_one = False\n\nflg_two = False\n\nfirst = 1\n\nsecond = 2\n\nif hole[1] == 1:\n\n first = 0\n\n second = 1\n\n flg_one = True\n\nif hole[2] == 1:\n\n first = 1\n\n second = 0\n\n flg_two = True\n\nif flg_one and flg_two:\n\n print((0))\n\n exit()\n\n\n\nfor i in range(3,N):\n\n if hole[i] == 1:\n\n first = second\n\n second = 0\n\n continue\n\n tmp = first + second\n\n tmp %= 1000000007\n\n first = second\n\n second = tmp\n\ntmp = first + second\n\ntmp %= 1000000007\n\nprint(tmp)", "target": "MOD = 10**9 + 7\n\nN, M = list(map(int, input().split()))\n\nstairs = [0]*(N+1)\n\nfor _ in range(M):\n\n stairs[int(input())] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nans = [0]*(N+1)\n\nans[1] = 1 if stairs[1] == 0 else 0\n\nans[2] = 1 + ans[1] if stairs[2] == 0 else 0\n\nfor i in range(3,N+1):\n\n if stairs[i] == 1:\n\n ans[i] = 0\n\n continue\n\n ans[i] = (ans[i-1] + ans[i-2]) % MOD\n\nprint((ans[N]))", "code_v0_loc": 44, "code_v1_loc": 17, "code_v0_num_chars": 795, "code_v1_num_chars": 400, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nhole = [0] * (N + 1)\nfor i in range(M):\n hole[int(input())] = 1\nif N == 1:\n print((1))\n exit()\nif N == 2:\n if hole[1] == 1:\n print((1))\n exit()\n if hole[1] == 0:\n print((2))\n exit()\nflg_one = False\nflg_two = False\nfirst = 1\nsecond = 2\nif hole[1] == 1:\n first = 0\n second = 1\n flg_one = True\nif hole[2] == 1:\n first = 1\n second = 0\n flg_two = True\nif flg_one and flg_two:\n print((0))\n exit()\nfor i in range(3, N):\n if hole[i] == 1:\n first = second\n second = 0\n continue\n tmp = first + second\n tmp %= 1000000007\n first = second\n second = tmp\ntmp = first + second\ntmp %= 1000000007\nprint(tmp)\n", "code_v1_no_empty_lines": "MOD = 10**9 + 7\nN, M = list(map(int, input().split()))\nstairs = [0] * (N + 1)\nfor _ in range(M):\n stairs[int(input())] = 1\nif N == 1:\n print((1))\n exit()\nans = [0] * (N + 1)\nans[1] = 1 if stairs[1] == 0 else 0\nans[2] = 1 + ans[1] if stairs[2] == 0 else 0\nfor i in range(3, N + 1):\n if stairs[i] == 1:\n ans[i] = 0\n continue\n ans[i] = (ans[i - 1] + ans[i - 2]) % MOD\nprint((ans[N]))\n", "code_same": false, "relative_loc_diff_percent": 61.3636363636, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "+MOD = 10**9 + 7", "-hole = [0] * (N + 1)", "-for i in range(M):", "- hole[int(input())] = 1", "+stairs = [0] * (N + 1)", "+for _ in range(M):", "+ stairs[int(input())] = 1", "-if N == 2:", "- if hole[1] == 1:", "- print((1))", "- exit()", "- if hole[1] == 0:", "- print((2))", "- exit()", "-flg_one = False", "-flg_two = False", "-first = 1", "-second = 2", "-if hole[1] == 1:", "- first = 0", "- second = 1", "- flg_one = True", "-if hole[2] == 1:", "- first = 1", "- second = 0", "- flg_two = True", "-if flg_one and flg_two:", "- print((0))", "- exit()", "-for i in range(3, N):", "- if hole[i] == 1:", "- first = second", "- second = 0", "+ans = [0] * (N + 1)", "+ans[1] = 1 if stairs[1] == 0 else 0", "+ans[2] = 1 + ans[1] if stairs[2] == 0 else 0", "+for i in range(3, N + 1):", "+ if stairs[i] == 1:", "+ ans[i] = 0", "- tmp = first + second", "- tmp %= 1000000007", "- first = second", "- second = tmp", "-tmp = first + second", "-tmp %= 1000000007", "-print(tmp)", "+ ans[i] = (ans[i - 1] + ans[i - 2]) % MOD", "+print((ans[N]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3368466201, "measured_runtime_v1": 0.2647972648, "runtime_lift": 1.2720925207, "key": ["s961535130", "s147927462"]} +{"user_id": "u164727245", "problem_id": "p02596", "language": "python", "submission_id_v0": "s121951272", "submission_id_v1": "s390007993", "cpu_time_v0": 131, "cpu_time_v1": 33, "memory_v0": 9476, "memory_v1": 9244, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 74.81, "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k//7 if k % 7 == 0 else k)\n\n if l % 2 == 0 or l % 5 == 0:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(-pow(l, 1/2))):\n\n if r % i == 0:\n\n phi = phi//i*(i-1)\n\n while r % i:\n\n r //= i\n\n\n\n a = 10 % l\n\n ret = 1\n\n while(a != 1):\n\n a = a*10 % l\n\n ret += 1\n\n if phi < ret:\n\n ret = -1\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "target": "# coding: utf-8\n\nfrom math import sqrt\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k//7 if 0 == k % 7 else k)\n\n if 0 == l % 2 or 0 == l % 5:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(sqrt(l)+1)):\n\n if 0 == r % i:\n\n phi = phi*(i-1)//i\n\n while 0 == r % i:\n\n r //= i\n\n if 1 < r:\n\n phi = phi*(r-1)//r\n\n\n\n D = set()\n\n for d in range(1, int(sqrt(phi)+1)):\n\n if 0 == phi % d:\n\n D.add(d)\n\n D.add(phi//d)\n\n\n\n ret = -1\n\n for m in sorted(D):\n\n if 1 == pow(10, m, l):\n\n ret = m\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "code_v0_loc": 31, "code_v1_loc": 37, "code_v0_num_chars": 598, "code_v1_num_chars": 758, "code_v0_no_empty_lines": "# coding: utf-8\ndef solve(*args: str) -> str:\n k = int(args[0])\n l = 9 * (k // 7 if k % 7 == 0 else k)\n if l % 2 == 0 or l % 5 == 0:\n return \"-1\"\n r = phi = l\n for i in range(2, int(-pow(l, 1 / 2))):\n if r % i == 0:\n phi = phi // i * (i - 1)\n while r % i:\n r //= i\n a = 10 % l\n ret = 1\n while a != 1:\n a = a * 10 % l\n ret += 1\n if phi < ret:\n ret = -1\n break\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_v1_no_empty_lines": "# coding: utf-8\nfrom math import sqrt\n\n\ndef solve(*args: str) -> str:\n k = int(args[0])\n l = 9 * (k // 7 if 0 == k % 7 else k)\n if 0 == l % 2 or 0 == l % 5:\n return \"-1\"\n r = phi = l\n for i in range(2, int(sqrt(l) + 1)):\n if 0 == r % i:\n phi = phi * (i - 1) // i\n while 0 == r % i:\n r //= i\n if 1 < r:\n phi = phi * (r - 1) // r\n D = set()\n for d in range(1, int(sqrt(phi) + 1)):\n if 0 == phi % d:\n D.add(d)\n D.add(phi // d)\n ret = -1\n for m in sorted(D):\n if 1 == pow(10, m, l):\n ret = m\n break\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_same": false, "relative_loc_diff_percent": 16.2162162162, "diff": ["+from math import sqrt", "+", "+", "- l = 9 * (k // 7 if k % 7 == 0 else k)", "- if l % 2 == 0 or l % 5 == 0:", "+ l = 9 * (k // 7 if 0 == k % 7 else k)", "+ if 0 == l % 2 or 0 == l % 5:", "- for i in range(2, int(-pow(l, 1 / 2))):", "- if r % i == 0:", "- phi = phi // i * (i - 1)", "- while r % i:", "+ for i in range(2, int(sqrt(l) + 1)):", "+ if 0 == r % i:", "+ phi = phi * (i - 1) // i", "+ while 0 == r % i:", "- a = 10 % l", "- ret = 1", "- while a != 1:", "- a = a * 10 % l", "- ret += 1", "- if phi < ret:", "- ret = -1", "+ if 1 < r:", "+ phi = phi * (r - 1) // r", "+ D = set()", "+ for d in range(1, int(sqrt(phi) + 1)):", "+ if 0 == phi % d:", "+ D.add(d)", "+ D.add(phi // d)", "+ ret = -1", "+ for m in sorted(D):", "+ if 1 == pow(10, m, l):", "+ ret = m"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4349818358, "measured_runtime_v1": 0.2757263954, "runtime_lift": 1.5775850377, "key": ["s121951272", "s390007993"]} +{"user_id": "u618107373", "problem_id": "p03013", "language": "python", "submission_id_v0": "s205446737", "submission_id_v1": "s887904874", "cpu_time_v0": 450, "cpu_time_v1": 113, "memory_v0": 473344, "memory_v1": 11884, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 74.89, "input": "import sys\n\nsys.setrecursionlimit(100000)\n\n\n\ndef intinput(): return list(map(int,sys.stdin.readline().split()))\n\n\n\nfib={0:0,1:1,2:1}\n\nfor i in range(3,100003):\n\n fib[i]=fib[i-1]+fib[i-2]\n\n # fib.append(fib[i-1]+fib[i-2])\n\n\n\nn,m=intinput()\n\nmod=10**9+7\n\na=[int(sys.stdin.readline()) for _ in range(m)]\n\nif m!=0:\n\n l=[a[0]]\n\n for i in range(len(a)-1):\n\n l.append(a[i+1]-a[i]-1)\n\n l.append(n-a[-1])\n\n k=1\n\n for i in l:\n\n k=fib[i]*k%mod\n\n print((k%mod))\n\nelse:\n\n print((fib[n+1]%mod))", "target": "import sys\n\nsys.setrecursionlimit(100000)\n\n\n\ndef intinput(): return list(map(int,sys.stdin.readline().split()))\n\n\n\n\n\nn, m = intinput()\n\na = {int(sys.stdin.readline()) for _ in range(m)}\n\nmemo = [0 for x in range(n + 4)]\n\nmemo[0] = 1\n\nmod = 10 ** 9 + 7\n\nfor i in range(n):\n\n if i + 1 not in a:\n\n memo[i + 1] = (memo[i + 1] + memo[i]) % mod\n\n if i + 2 not in a:\n\n memo[i + 2] = (memo[i + 2] + memo[i]) % mod\n\nprint((memo[n]))", "code_v0_loc": 24, "code_v1_loc": 17, "code_v0_num_chars": 510, "code_v1_num_chars": 435, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(100000)\n\n\ndef intinput():\n return list(map(int, sys.stdin.readline().split()))\n\n\nfib = {0: 0, 1: 1, 2: 1}\nfor i in range(3, 100003):\n fib[i] = fib[i - 1] + fib[i - 2]\n# fib.append(fib[i-1]+fib[i-2])\nn, m = intinput()\nmod = 10**9 + 7\na = [int(sys.stdin.readline()) for _ in range(m)]\nif m != 0:\n l = [a[0]]\n for i in range(len(a) - 1):\n l.append(a[i + 1] - a[i] - 1)\n l.append(n - a[-1])\n k = 1\n for i in l:\n k = fib[i] * k % mod\n print((k % mod))\nelse:\n print((fib[n + 1] % mod))\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(100000)\n\n\ndef intinput():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn, m = intinput()\na = {int(sys.stdin.readline()) for _ in range(m)}\nmemo = [0 for x in range(n + 4)]\nmemo[0] = 1\nmod = 10**9 + 7\nfor i in range(n):\n if i + 1 not in a:\n memo[i + 1] = (memo[i + 1] + memo[i]) % mod\n if i + 2 not in a:\n memo[i + 2] = (memo[i + 2] + memo[i]) % mod\nprint((memo[n]))\n", "code_same": false, "relative_loc_diff_percent": 29.1666666667, "diff": ["-fib = {0: 0, 1: 1, 2: 1}", "-for i in range(3, 100003):", "- fib[i] = fib[i - 1] + fib[i - 2]", "-# fib.append(fib[i-1]+fib[i-2])", "+a = {int(sys.stdin.readline()) for _ in range(m)}", "+memo = [0 for x in range(n + 4)]", "+memo[0] = 1", "-a = [int(sys.stdin.readline()) for _ in range(m)]", "-if m != 0:", "- l = [a[0]]", "- for i in range(len(a) - 1):", "- l.append(a[i + 1] - a[i] - 1)", "- l.append(n - a[-1])", "- k = 1", "- for i in l:", "- k = fib[i] * k % mod", "- print((k % mod))", "-else:", "- print((fib[n + 1] % mod))", "+for i in range(n):", "+ if i + 1 not in a:", "+ memo[i + 1] = (memo[i + 1] + memo[i]) % mod", "+ if i + 2 not in a:", "+ memo[i + 2] = (memo[i + 2] + memo[i]) % mod", "+print((memo[n]))"], "diff_only_import_comment": false, "measured_runtime_v0": 3.8133613999, "measured_runtime_v1": 0.2074506006, "runtime_lift": 18.3820214944, "key": ["s205446737", "s887904874"]} +{"user_id": "u606045429", "problem_id": "p02850", "language": "python", "submission_id_v0": "s780367922", "submission_id_v1": "s062691036", "cpu_time_v0": 222, "cpu_time_v1": 198, "memory_v0": 25900, "memory_v1": 25900, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.81, "input": "\"\"\"\n\nchallenge case\n\n\n\nin:\n\n3\n\n1 3\n\n2 3\n\n\n\nout:\n\n1\n\n1\n\n1\n\n\"\"\"\n\n\n\nfrom collections import deque\n\n\n\ndef main():\n\n\tN, *AB = list(map(int, open(0).read().split()))\n\n\tB = AB[1::2]\n\n\n\n\tE = [[] for _ in range(N + 1)]\n\n\tfor a, b in zip(*[iter(AB)] * 2):\n\n\t\tE[a] += b,\n\n\n\n\tQ = deque([1])\n\n\tC = [0] * (N + 1)\n\n\twhile Q:\n\n\t\tv = Q.popleft()\n\n\t\tc = 0\n\n\t\tfor u in E[v]:\n\n\t\t\tc += 1 + (c + 1 == C[v])\n\n\t\t\tC[u] = c\n\n\t\t\tQ += u,\n\n\n\n\tprint((max(C)))\n\n\tfor b in B:\n\n\t\tprint((C[b]))\n\n\n\nmain()", "target": "\"\"\"\n\nchallenge case\n\n\n\nin:\n\n3\n\n1 3\n\n2 3\n\n\n\nout:\n\n1\n\n1\n\n1\n\n\"\"\"\n\n\n\nfrom collections import deque\n\n\n\ndef main():\n\n\tN, *AB = list(map(int, open(0).read().split()))\n\n\tB = AB[1::2]\n\n\n\n\tE = [[] for _ in range(N + 1)]\n\n\tfor a, b in zip(*[iter(AB)] * 2):\n\n\t\tE[a].append(b)\n\n\n\n\tQ = deque([1])\n\n\tC = [0] * (N + 1)\n\n\twhile Q:\n\n\t\tv = Q.popleft()\n\n\t\tc = 0\n\n\t\tfor u in E[v]:\n\n\t\t\tc += 1 + (c + 1 == C[v])\n\n\t\t\tC[u] = c\n\n\t\t\tQ.append(u)\n\n\n\n\tprint((max(C)))\n\n\tfor b in B:\n\n\t\tprint((C[b]))\n\n\n\nmain()", "code_v0_loc": 39, "code_v1_loc": 39, "code_v0_num_chars": 460, "code_v1_num_chars": 468, "code_v0_no_empty_lines": "\"\"\"\nchallenge case\nin:\n3\n1 3\n2 3\nout:\n1\n1\n1\n\"\"\"\nfrom collections import deque\n\n\ndef main():\n N, *AB = list(map(int, open(0).read().split()))\n B = AB[1::2]\n E = [[] for _ in range(N + 1)]\n for a, b in zip(*[iter(AB)] * 2):\n E[a] += (b,)\n Q = deque([1])\n C = [0] * (N + 1)\n while Q:\n v = Q.popleft()\n c = 0\n for u in E[v]:\n c += 1 + (c + 1 == C[v])\n C[u] = c\n Q += (u,)\n print((max(C)))\n for b in B:\n print((C[b]))\n\n\nmain()\n", "code_v1_no_empty_lines": "\"\"\"\nchallenge case\nin:\n3\n1 3\n2 3\nout:\n1\n1\n1\n\"\"\"\nfrom collections import deque\n\n\ndef main():\n N, *AB = list(map(int, open(0).read().split()))\n B = AB[1::2]\n E = [[] for _ in range(N + 1)]\n for a, b in zip(*[iter(AB)] * 2):\n E[a].append(b)\n Q = deque([1])\n C = [0] * (N + 1)\n while Q:\n v = Q.popleft()\n c = 0\n for u in E[v]:\n c += 1 + (c + 1 == C[v])\n C[u] = c\n Q.append(u)\n print((max(C)))\n for b in B:\n print((C[b]))\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- E[a] += (b,)", "+ E[a].append(b)", "- Q += (u,)", "+ Q.append(u)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2432860727, "measured_runtime_v1": 0.1842362597, "runtime_lift": 1.3205113538, "key": ["s780367922", "s062691036"]} +{"user_id": "u912237403", "problem_id": "p00145", "language": "python", "submission_id_v0": "s120507501", "submission_id_v1": "s768605614", "cpu_time_v0": 160, "cpu_time_v1": 130, "memory_v0": 4524, "memory_v1": 4520, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.75, "input": "from functools import reduce\ndef f(a,b): return [Card[a][0], Card[b][1]]\n\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, f(j, k) + f(k+1, a)) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])", "target": "from functools import reduce\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, [Card[j][0],Card[k][1],Card[k+1][0],Card[a][1]]) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])", "code_v0_loc": 12, "code_v1_loc": 11, "code_v0_num_chars": 397, "code_v1_num_chars": 380, "code_v0_no_empty_lines": "from functools import reduce\n\n\ndef f(a, b):\n return [Card[a][0], Card[b][1]]\n\n\nn = int(input())\nCard = [[] for _ in [0] * n]\nCost = {}\nfor i in range(n):\n Card[i] = list(map(int, input().split()))\n Cost[(i, i)] = 0\nfor i in range(1, n):\n for j in range(0, n - i):\n a = j + i\n Cost[(j, a)] = min(\n [\n reduce(lambda a, b: a * b, f(j, k) + f(k + 1, a))\n + Cost[(j, k)]\n + Cost[(k + 1, a)]\n for k in range(j, j + i)\n ]\n )\nprint(Cost[0, n - 1])\n", "code_v1_no_empty_lines": "from functools import reduce\n\nn = int(input())\nCard = [[] for _ in [0] * n]\nCost = {}\nfor i in range(n):\n Card[i] = list(map(int, input().split()))\n Cost[(i, i)] = 0\nfor i in range(1, n):\n for j in range(0, n - i):\n a = j + i\n Cost[(j, a)] = min(\n [\n reduce(\n lambda a, b: a * b,\n [Card[j][0], Card[k][1], Card[k + 1][0], Card[a][1]],\n )\n + Cost[(j, k)]\n + Cost[(k + 1, a)]\n for k in range(j, j + i)\n ]\n )\nprint(Cost[0, n - 1])\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-", "-", "-def f(a, b):", "- return [Card[a][0], Card[b][1]]", "-", "- reduce(lambda a, b: a * b, f(j, k) + f(k + 1, a))", "+ reduce(", "+ lambda a, b: a * b,", "+ [Card[j][0], Card[k][1], Card[k + 1][0], Card[a][1]],", "+ )"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2898506114, "measured_runtime_v1": 0.2096236434, "runtime_lift": 1.3827190804, "key": ["s120507501", "s768605614"]} +{"user_id": "u156896646", "problem_id": "p03854", "language": "python", "submission_id_v0": "s725954700", "submission_id_v1": "s400985362", "cpu_time_v0": 76, "cpu_time_v1": 64, "memory_v0": 21348, "memory_v1": 21348, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.79, "input": "import sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = input()\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isDream #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n #print('d:', d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #; print(d, pout)\n\n if pout == len(S): \n\n isDream = True #; print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisDream = False\n\ndayDream(0)\n\nif isDream:\n\n print('YES')\n\nelse:\n\n print('NO')", "target": "import sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = input()\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isGoal #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n if isGoal:\n\n return\n\n #print('i, d:', i, d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #;print(d, pout)\n\n if pout == len(S): \n\n isGoal = True #;print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisGoal = False\n\ndayDream(0)\n\nif isGoal:\n\n print('YES')\n\nelse:\n\n print('NO')", "code_v0_loc": 28, "code_v1_loc": 30, "code_v0_num_chars": 694, "code_v1_num_chars": 735, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(1000000)\nS = input()\nT = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nlenT = [len(i) for i in T]\n\n\ndef dayDream(pin):\n global isDream # ;print('dayDream: ', pin, S[pin:])\n for i, d in enumerate(T):\n # print('d:', d)\n if S[pin : pin + lenT[i]] == d:\n pout = pin + lenT[i] # ; print(d, pout)\n if pout == len(S):\n isDream = True # ; print('YES')\n return\n else:\n dayDream(pout)\n # print('dayDream return', pin)\n return\n\n\nisDream = False\ndayDream(0)\nif isDream:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(1000000)\nS = input()\nT = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nlenT = [len(i) for i in T]\n\n\ndef dayDream(pin):\n global isGoal # ;print('dayDream: ', pin, S[pin:])\n for i, d in enumerate(T):\n if isGoal:\n return\n # print('i, d:', i, d)\n if S[pin : pin + lenT[i]] == d:\n pout = pin + lenT[i] # ;print(d, pout)\n if pout == len(S):\n isGoal = True # ;print('YES')\n return\n else:\n dayDream(pout)\n # print('dayDream return', pin)\n return\n\n\nisGoal = False\ndayDream(0)\nif isGoal:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["- global isDream # ;print('dayDream: ', pin, S[pin:])", "+ global isGoal # ;print('dayDream: ', pin, S[pin:])", "- # print('d:', d)", "+ if isGoal:", "+ return", "+ # print('i, d:', i, d)", "- pout = pin + lenT[i] # ; print(d, pout)", "+ pout = pin + lenT[i] # ;print(d, pout)", "- isDream = True # ; print('YES')", "+ isGoal = True # ;print('YES')", "-isDream = False", "+isGoal = False", "-if isDream:", "+if isGoal:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3036904747, "measured_runtime_v1": 0.2140211895, "runtime_lift": 1.4189738666, "key": ["s725954700", "s400985362"]} +{"user_id": "u256351611", "problem_id": "p02850", "language": "python", "submission_id_v0": "s596506481", "submission_id_v1": "s115492739", "cpu_time_v0": 760, "cpu_time_v1": 557, "memory_v0": 96808, "memory_v1": 30744, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.71, "input": "import copy\n\n\n\nn=int(input())\n\norg_set=set([i for i in range(1,10**5)])\n\nedges=[]\n\nrelations={}\n\nnodes=[]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split(\" \")))\n\n edges.append([a,b])\n\n relations.setdefault(a,[]).append(b)\n\n nodes.append([])\n\nnodes.append([])\n\nnodes.append([])\n\n\n\nmax_color=0\n\nfor start in range(1,n+1):\n\n targets=relations.get(start,[])\n\n color=1\n\n for target in targets:\n\n if color in nodes[start]:\n\n color+=1\n\n else:\n\n pass\n\n nodes[target].append(color)\n\n if color>=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]][0]))", "target": "n=int(input())\n\nedges=[]\n\nrelations={}\n\nnodes=[0,0]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split(\" \")))\n\n edges.append([a,b])\n\n relations.setdefault(a,[]).append(b)\n\n nodes.append(0)\n\n\n\nmax_color=0\n\nfor start in range(1,n+1):\n\n targets=relations.get(start,[])\n\n color=1\n\n for target in targets:\n\n if color == nodes[start]:\n\n color+=1\n\n else:\n\n pass\n\n nodes[target]=color\n\n if color>=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]]))", "code_v0_loc": 32, "code_v1_loc": 27, "code_v0_num_chars": 684, "code_v1_num_chars": 582, "code_v0_no_empty_lines": "import copy\n\nn = int(input())\norg_set = set([i for i in range(1, 10**5)])\nedges = []\nrelations = {}\nnodes = []\nfor i in range(n - 1):\n a, b = list(map(int, input().split(\" \")))\n edges.append([a, b])\n relations.setdefault(a, []).append(b)\n nodes.append([])\nnodes.append([])\nnodes.append([])\nmax_color = 0\nfor start in range(1, n + 1):\n targets = relations.get(start, [])\n color = 1\n for target in targets:\n if color in nodes[start]:\n color += 1\n else:\n pass\n nodes[target].append(color)\n if color >= max_color:\n max_color = color\n color += 1\nprint(max_color)\nfor edge in edges:\n print((nodes[edge[1]][0]))\n", "code_v1_no_empty_lines": "n = int(input())\nedges = []\nrelations = {}\nnodes = [0, 0]\nfor i in range(n - 1):\n a, b = list(map(int, input().split(\" \")))\n edges.append([a, b])\n relations.setdefault(a, []).append(b)\n nodes.append(0)\nmax_color = 0\nfor start in range(1, n + 1):\n targets = relations.get(start, [])\n color = 1\n for target in targets:\n if color == nodes[start]:\n color += 1\n else:\n pass\n nodes[target] = color\n if color >= max_color:\n max_color = color\n color += 1\nprint(max_color)\nfor edge in edges:\n print((nodes[edge[1]]))\n", "code_same": false, "relative_loc_diff_percent": 15.625, "diff": ["-import copy", "-", "-org_set = set([i for i in range(1, 10**5)])", "-nodes = []", "+nodes = [0, 0]", "- nodes.append([])", "-nodes.append([])", "-nodes.append([])", "+ nodes.append(0)", "- if color in nodes[start]:", "+ if color == nodes[start]:", "- nodes[target].append(color)", "+ nodes[target] = color", "- print((nodes[edge[1]][0]))", "+ print((nodes[edge[1]]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2673016732, "measured_runtime_v1": 0.1941296165, "runtime_lift": 1.3769237172, "key": ["s596506481", "s115492739"]} +{"user_id": "u634079249", "problem_id": "p02881", "language": "python", "submission_id_v0": "s671057519", "submission_id_v1": "s116621872", "cpu_time_v0": 992, "cpu_time_v1": 126, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.3, "input": "import sys\n\nimport os\n\nimport math\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n ret = float('inf')\n\n I = int(math.sqrt(N)) * 10\n\n for i in range(1, I):\n\n if N%i == 0:\n\n j = N//i\n\n ret = min(ret, j + i - 2)\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\nimport os\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n m = int(N ** .5)\n\n while N % m != 0:\n\n m -= 1\n\n else:\n\n print((int(N / m + m - 2)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 29, "code_v1_loc": 25, "code_v0_num_chars": 717, "code_v1_num_chars": 627, "code_v0_no_empty_lines": "import sys\nimport os\nimport math\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = ii()\n ret = float(\"inf\")\n I = int(math.sqrt(N)) * 10\n for i in range(1, I):\n if N % i == 0:\n j = N // i\n ret = min(ret, j + i - 2)\n print(ret)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\nimport os\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = ii()\n m = int(N**0.5)\n while N % m != 0:\n m -= 1\n else:\n print((int(N / m + m - 2)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 13.7931034483, "diff": ["-import math", "- ret = float(\"inf\")", "- I = int(math.sqrt(N)) * 10", "- for i in range(1, I):", "- if N % i == 0:", "- j = N // i", "- ret = min(ret, j + i - 2)", "- print(ret)", "+ m = int(N**0.5)", "+ while N % m != 0:", "+ m -= 1", "+ else:", "+ print((int(N / m + m - 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3067429993, "measured_runtime_v1": 0.2119246759, "runtime_lift": 1.4474152099, "key": ["s671057519", "s116621872"]} diff --git a/python_splits/test_verified.target_bucket_subsets/1_128.jsonl b/python_splits/test_verified.target_bucket_subsets/1_128.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..16247c8858c7a2f23585ae4aac7d3a84ee18b2ff --- /dev/null +++ b/python_splits/test_verified.target_bucket_subsets/1_128.jsonl @@ -0,0 +1,364 @@ +{"user_id": "u732870425", "problem_id": "p03371", "language": "python", "submission_id_v0": "s504204235", "submission_id_v1": "s825991485", "cpu_time_v0": 104, "cpu_time_v1": 26, "memory_v0": 9176, "memory_v1": 9180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.0, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 5000 * 2 * 10 ** 5\n\nfor i in range(10 ** 5 + 1):\n\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n\n ans = min(ans, s)\n\n\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nif X > Y:\n\n v = A\n\nelse:\n\n v = B\n\n\n\nans = min(A*X+B*Y, C*max(X, Y)*2, C*min(X,Y)*2+(max(X,Y)-min(X,Y))*v)\n\n\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 10, "code_v0_num_chars": 195, "code_v1_num_chars": 170, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = 5000 * 2 * 10**5\nfor i in range(10**5 + 1):\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n ans = min(ans, s)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nif X > Y:\n v = A\nelse:\n v = B\nans = min(\n A * X + B * Y, C * max(X, Y) * 2, C * min(X, Y) * 2 + (max(X, Y) - min(X, Y)) * v\n)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-ans = 5000 * 2 * 10**5", "-for i in range(10**5 + 1):", "- s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B", "- ans = min(ans, s)", "+if X > Y:", "+ v = A", "+else:", "+ v = B", "+ans = min(", "+ A * X + B * Y, C * max(X, Y) * 2, C * min(X, Y) * 2 + (max(X, Y) - min(X, Y)) * v", "+)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.5409223008, "measured_runtime_v1": 0.2907806964, "runtime_lift": 5.2992592696, "key": ["s504204235", "s825991485"]} +{"user_id": "u102461423", "problem_id": "p02612", "language": "python", "submission_id_v0": "s840955881", "submission_id_v1": "s608348800", "cpu_time_v0": 35, "cpu_time_v1": 29, "memory_v0": 9152, "memory_v1": 9160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.14, "input": "import sys\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(read())\n\nx = N + (-N) % 1000\n\nprint((x - N))", "target": "import math\n\nN = int(input())\n\nx = math.ceil(N/1000) * 1000\n\nprint((x-N))", "code_v0_loc": 9, "code_v1_loc": 4, "code_v0_num_chars": 174, "code_v1_num_chars": 71, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(read())\nx = N + (-N) % 1000\nprint((x - N))\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\nx = math.ceil(N / 1000) * 1000\nprint((x - N))\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-import sys", "+import math", "-read = sys.stdin.buffer.read", "-readline = sys.stdin.buffer.readline", "-readlines = sys.stdin.buffer.readlines", "-N = int(read())", "-x = N + (-N) % 1000", "+N = int(input())", "+x = math.ceil(N / 1000) * 1000"], "diff_only_import_comment": false, "measured_runtime_v0": 0.260022393, "measured_runtime_v1": 0.1385840868, "runtime_lift": 1.8762788639, "key": ["s840955881", "s608348800"]} +{"user_id": "u761320129", "problem_id": "p03559", "language": "python", "submission_id_v0": "s241549796", "submission_id_v1": "s763191935", "cpu_time_v0": 368, "cpu_time_v1": 263, "memory_v0": 23328, "memory_v1": 29344, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.53, "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nans = 0\n\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n\n i = bisect_left(A, b)\n\n j = bisect(C, b)\n\n ans += i * (N-j)\n\nprint(ans)", "target": "N = int(input())\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nfrom bisect import bisect_left, bisect\n\nans = 0\n\nfor b in B:\n\n i = bisect_left(A,b)\n\n j = bisect(C,b)\n\n ans += i * (N-j)\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 14, "code_v0_num_chars": 291, "code_v1_num_chars": 289, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort()\nC.sort()\nans = 0\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n i = bisect_left(A, b)\n j = bisect(C, b)\n ans += i * (N - j)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort()\nC.sort()\nfrom bisect import bisect_left, bisect\n\nans = 0\nfor b in B:\n i = bisect_left(A, b)\n j = bisect(C, b)\n ans += i * (N - j)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+from bisect import bisect_left, bisect", "+", "-from bisect import bisect, bisect_left", "-"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2898341594, "measured_runtime_v1": 0.1261365476, "runtime_lift": 2.2977809758, "key": ["s241549796", "s763191935"]} +{"user_id": "u671060652", "problem_id": "p02952", "language": "python", "submission_id_v0": "s923935687", "submission_id_v1": "s007434774", "cpu_time_v0": 222, "cpu_time_v1": 60, "memory_v0": 40940, "memory_v1": 61860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.97, "input": "n = int(input())\n\n\n\n\n\ndef countKeta(num):\n\n count = 1\n\n while num / 10 >= 1:\n\n count += 1\n\n num = num // 10\n\n return count\n\n\n\n\n\ncount = 0\n\n\n\nfor i in range(1, n+1):\n\n if(countKeta(i) % 2 == 1):\n\n count += 1\n\n\n\nprint(count)", "target": "n = int(input())\n\n\n\nif n < 10:\n\n print(n)\n\nelif n < 100:\n\n print((9))\n\nelif n < 1000:\n\n print((n-90))\n\nelif n < 10000:\n\n print((909))\n\nelif n < 100000:\n\n print((n-9090))\n\nelif n < 1000000:\n\n print((90909))", "code_v0_loc": 18, "code_v1_loc": 14, "code_v0_num_chars": 255, "code_v1_num_chars": 213, "code_v0_no_empty_lines": "n = int(input())\n\n\ndef countKeta(num):\n count = 1\n while num / 10 >= 1:\n count += 1\n num = num // 10\n return count\n\n\ncount = 0\nfor i in range(1, n + 1):\n if countKeta(i) % 2 == 1:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "n = int(input())\nif n < 10:\n print(n)\nelif n < 100:\n print((9))\nelif n < 1000:\n print((n - 90))\nelif n < 10000:\n print((909))\nelif n < 100000:\n print((n - 9090))\nelif n < 1000000:\n print((90909))\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-", "-", "-def countKeta(num):", "- count = 1", "- while num / 10 >= 1:", "- count += 1", "- num = num // 10", "- return count", "-", "-", "-count = 0", "-for i in range(1, n + 1):", "- if countKeta(i) % 2 == 1:", "- count += 1", "-print(count)", "+if n < 10:", "+ print(n)", "+elif n < 100:", "+ print((9))", "+elif n < 1000:", "+ print((n - 90))", "+elif n < 10000:", "+ print((909))", "+elif n < 100000:", "+ print((n - 9090))", "+elif n < 1000000:", "+ print((90909))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2693535981, "measured_runtime_v1": 0.1929554205, "runtime_lift": 1.3959369341, "key": ["s923935687", "s007434774"]} +{"user_id": "u837286475", "problem_id": "p02996", "language": "python", "submission_id_v0": "s244057022", "submission_id_v1": "s796254109", "cpu_time_v0": 1201, "cpu_time_v1": 941, "memory_v0": 53532, "memory_v1": 53600, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.65, "input": "\n\n\n\nn = int(input())\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\nabn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))", "target": "\n\nn = int(input())\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\n#abn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))", "code_v0_loc": 25, "code_v1_loc": 24, "code_v0_num_chars": 345, "code_v1_num_chars": 344, "code_v0_no_empty_lines": "n = int(input())\nabn = [list(map(int, input().split())) for _ in range(n)]\nabn.sort()\nabn.sort(key=lambda x: x[1])\n# print(abn)\nts = 0 # time_stamp\nenable = True\nfor abi in abn:\n a, b = abi\n if not ts + a <= b:\n enable = False\n break\n else:\n ts += a\nprint((\"Yes\" if enable else \"No\"))\n", "code_v1_no_empty_lines": "n = int(input())\nabn = [list(map(int, input().split())) for _ in range(n)]\n# abn.sort()\nabn.sort(key=lambda x: x[1])\n# print(abn)\nts = 0 # time_stamp\nenable = True\nfor abi in abn:\n a, b = abi\n if not ts + a <= b:\n enable = False\n break\n else:\n ts += a\nprint((\"Yes\" if enable else \"No\"))\n", "code_same": false, "relative_loc_diff_percent": 4.0, "diff": ["-abn.sort()", "+# abn.sort()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.205832685, "measured_runtime_v1": 0.0061624551, "runtime_lift": 33.4010847824, "key": ["s244057022", "s796254109"]} +{"user_id": "u546285759", "problem_id": "p00053", "language": "python", "submission_id_v0": "s431311473", "submission_id_v1": "s975765781", "cpu_time_v0": 360, "cpu_time_v1": 100, "memory_v0": 8104, "memory_v1": 9480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.22, "input": "def isPrime(x):\n\n if x == 2:\n\n return True\n\n if x < 2 or x % 2 == 0:\n\n return False\n\n i, root_x = 3, int(pow(x, 0.5))\n\n while i <= root_x:\n\n if x % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nprimes = [2]\n\nfor i in range(3, 104730):\n\n if isPrime(i):\n\n primes.append(primes[-1]+i)\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n print((primes[n-1]))", "target": "primes = [0, 0] + [1] * 150000\n\nfor i in range(2, 388):\n\n if primes[i]:\n\n for j in range(i*i, 150001, i):\n\n primes[j] = 0\n\n\n\nvalues = [i for i, v in enumerate(primes) if v]\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n print((sum(values[:n])))", "code_v0_loc": 21, "code_v1_loc": 12, "code_v0_num_chars": 438, "code_v1_num_chars": 287, "code_v0_no_empty_lines": "def isPrime(x):\n if x == 2:\n return True\n if x < 2 or x % 2 == 0:\n return False\n i, root_x = 3, int(pow(x, 0.5))\n while i <= root_x:\n if x % i == 0:\n return False\n i += 2\n return True\n\n\nprimes = [2]\nfor i in range(3, 104730):\n if isPrime(i):\n primes.append(primes[-1] + i)\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((primes[n - 1]))\n", "code_v1_no_empty_lines": "primes = [0, 0] + [1] * 150000\nfor i in range(2, 388):\n if primes[i]:\n for j in range(i * i, 150001, i):\n primes[j] = 0\nvalues = [i for i, v in enumerate(primes) if v]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(values[:n])))\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-def isPrime(x):", "- if x == 2:", "- return True", "- if x < 2 or x % 2 == 0:", "- return False", "- i, root_x = 3, int(pow(x, 0.5))", "- while i <= root_x:", "- if x % i == 0:", "- return False", "- i += 2", "- return True", "-", "-", "-primes = [2]", "-for i in range(3, 104730):", "- if isPrime(i):", "- primes.append(primes[-1] + i)", "+primes = [0, 0] + [1] * 150000", "+for i in range(2, 388):", "+ if primes[i]:", "+ for j in range(i * i, 150001, i):", "+ primes[j] = 0", "+values = [i for i, v in enumerate(primes) if v]", "- print((primes[n - 1]))", "+ print((sum(values[:n])))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.4180367088, "measured_runtime_v1": 0.5017841969, "runtime_lift": 2.8259891756, "key": ["s431311473", "s975765781"]} +{"user_id": "u714300041", "problem_id": "p03835", "language": "python", "submission_id_v0": "s859897716", "submission_id_v1": "s908338086", "cpu_time_v0": 324, "cpu_time_v1": 265, "memory_v0": 40684, "memory_v1": 40684, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.21, "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if x >= 0 and x <= K:\n\n ans += 1\n\nprint(ans)", "target": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if 0 <= x <= K:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 255, "code_v1_num_chars": 249, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nK, S = list(map(int, input().split()))\nans = 0\nfor z in range(K + 1):\n for y in range(K + 1):\n x = S - (z + y)\n if x >= 0 and x <= K:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nK, S = list(map(int, input().split()))\nans = 0\nfor z in range(K + 1):\n for y in range(K + 1):\n x = S - (z + y)\n if 0 <= x <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if x >= 0 and x <= K:", "+ if 0 <= x <= K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.450106571, "measured_runtime_v1": 0.2041984936, "runtime_lift": 2.2042599977, "key": ["s859897716", "s908338086"]} +{"user_id": "u994988729", "problem_id": "p02996", "language": "python", "submission_id_v0": "s348750359", "submission_id_v1": "s832149929", "cpu_time_v0": 885, "cpu_time_v1": 774, "memory_v0": 30828, "memory_v1": 41916, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.54, "input": "n=int(input())\n\ntask=[] \n\nfor _ in range(n):\n\n a,b=list(map(int,input().split()))\n\n task.append((b, -a))\n\n\n\ntask.sort()\n\n\n\ntime=0\n\nflag=True\n\nfor i in task:\n\n time-=i[1]\n\n if time>i[0]:\n\n flag=False\n\n break\n\n\n\nif flag:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n\n", "target": "import sys\n\nfrom collections import defaultdict\n\nfrom operator import itemgetter\n\ninput = sys.stdin.readline\n\n\n\nN = int(input())\n\nd = defaultdict(int)\n\nfor _ in range(N):\n\n a, b = list(map(int, input().split()))\n\n d[b] += a\n\ntask = list(d.items())\n\ntask.sort()\n\n\n\nnow = 0\n\nans = \"Yes\"\n\nfor limit, time in task:\n\n now += time\n\n if now > limit:\n\n ans = \"No\"\n\n break\n\n\n\nprint(ans)\n", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 283, "code_v1_num_chars": 398, "code_v0_no_empty_lines": "n = int(input())\ntask = []\nfor _ in range(n):\n a, b = list(map(int, input().split()))\n task.append((b, -a))\ntask.sort()\ntime = 0\nflag = True\nfor i in task:\n time -= i[1]\n if time > i[0]:\n flag = False\n break\nif flag:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "import sys\nfrom collections import defaultdict\nfrom operator import itemgetter\n\ninput = sys.stdin.readline\nN = int(input())\nd = defaultdict(int)\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n d[b] += a\ntask = list(d.items())\ntask.sort()\nnow = 0\nans = \"Yes\"\nfor limit, time in task:\n now += time\n if now > limit:\n ans = \"No\"\n break\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-n = int(input())", "-task = []", "-for _ in range(n):", "+import sys", "+from collections import defaultdict", "+from operator import itemgetter", "+", "+input = sys.stdin.readline", "+N = int(input())", "+d = defaultdict(int)", "+for _ in range(N):", "- task.append((b, -a))", "+ d[b] += a", "+task = list(d.items())", "-time = 0", "-flag = True", "-for i in task:", "- time -= i[1]", "- if time > i[0]:", "- flag = False", "+now = 0", "+ans = \"Yes\"", "+for limit, time in task:", "+ now += time", "+ if now > limit:", "+ ans = \"No\"", "-if flag:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3182171457, "measured_runtime_v1": 0.1977030051, "runtime_lift": 1.6095716175, "key": ["s348750359", "s832149929"]} +{"user_id": "u367130284", "problem_id": "p03081", "language": "python", "submission_id_v0": "s141729674", "submission_id_v1": "s328617225", "cpu_time_v0": 599, "cpu_time_v1": 524, "memory_v0": 40892, "memory_v1": 40892, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.52, "input": "n,q=list(map(int,input().split()));s=\"_\"+input()+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:L=h==\"L\";R=h==\"R\";l,r=[l,l-1,l+1][(m==s[l]and R)-(m==s[l+1]and L)],[r,r-1,r+1][(m==s[r-1]and R)-(m==s[r]and L)]\n\nprint((max(0,r-l-1)))", "target": "n,q=list(map(int,input().split()));s=\"_\"+input()+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:\n\n L=h==\"L\";R=h==\"R\";\n\n l+=(m==s[l+1]and L)-(m==s[l]and R)\n\n r+=(m==s[r]and L)-(m==s[r-1]and R)\n\nprint((max(0,r-l-1)))", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 241, "code_v1_num_chars": 234, "code_v0_no_empty_lines": "n, q = list(map(int, input().split()))\ns = \"_\" + input() + \"_\"\nl, r = 0, n + 1\nfor (m, h) in [input().split() for i in range(q)][::-1]:\n L = h == \"L\"\n R = h == \"R\"\n l, r = [l, l - 1, l + 1][(m == s[l] and R) - (m == s[l + 1] and L)], [\n r,\n r - 1,\n r + 1,\n ][(m == s[r - 1] and R) - (m == s[r] and L)]\nprint((max(0, r - l - 1)))\n", "code_v1_no_empty_lines": "n, q = list(map(int, input().split()))\ns = \"_\" + input() + \"_\"\nl, r = 0, n + 1\nfor (m, h) in [input().split() for i in range(q)][::-1]:\n L = h == \"L\"\n R = h == \"R\"\n l += (m == s[l + 1] and L) - (m == s[l] and R)\n r += (m == s[r] and L) - (m == s[r - 1] and R)\nprint((max(0, r - l - 1)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["- l, r = [l, l - 1, l + 1][(m == s[l] and R) - (m == s[l + 1] and L)], [", "- r,", "- r - 1,", "- r + 1,", "- ][(m == s[r - 1] and R) - (m == s[r] and L)]", "+ l += (m == s[l + 1] and L) - (m == s[l] and R)", "+ r += (m == s[r] and L) - (m == s[r - 1] and R)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2496840062, "measured_runtime_v1": 0.1505171778, "runtime_lift": 1.6588406042, "key": ["s141729674", "s328617225"]} +{"user_id": "u134019875", "problem_id": "p03796", "language": "python", "submission_id_v0": "s983655328", "submission_id_v1": "s754374761", "cpu_time_v0": 231, "cpu_time_v1": 36, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.42, "input": "import math\n\n\n\nn = int(input())\n\nprint((math.factorial(n) % (10 ** 9 + 7)))", "target": "n = int(input())\n\np = 1\n\nfor i in range(1, n + 1):\n\n p = p * i % (10 ** 9 + 7)\n\nprint(p)", "code_v0_loc": 4, "code_v1_loc": 5, "code_v0_num_chars": 73, "code_v1_num_chars": 89, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\np = 1\nfor i in range(1, n + 1):\n p = p * i % (10**9 + 7)\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+p = 1", "+for i in range(1, n + 1):", "+ p = p * i % (10**9 + 7)", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1349290106, "measured_runtime_v1": 0.0997186968, "runtime_lift": 1.3530964092, "key": ["s983655328", "s754374761"]} +{"user_id": "u597374218", "problem_id": "p03035", "language": "python", "submission_id_v0": "s085289040", "submission_id_v1": "s328762084", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "a,b=list(map(int,input().split()))\n\nprint((b if 13<=a else b//2 if 6<=a else 0))", "target": "a,b=list(map(int,input().split()))\n\nprint((b if 12=b[i]):\n\n cnt+=b[i]\n\n else:\n\n cnt+=a[i]\n\n d=b[i]-a[i]\n\n cnt+=min(a[i+1],d)\n\n if(d>a[i+1]):\n\n a[i+1]=0\n\n else: a[i+1]-=d\n\n \n\n stdout.write(str(cnt)+\"\\n\")\n", "target": "n = int(input())\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\na1 = sum(A)\n\nfor i in range(n):\n\n b = B[i]\n\n if A[i] >= b:A[i] -= b\n\n else:\n\n if A[i+1]+A[i] >= b:\n\n A[i+1] = A[i+1]+A[i]-b\n\n A[i] = 0\n\n else:A[i], A[i+1] = 0, 0\n\na2 = sum(A)\n\nprint((a1-a2))", "code_v0_loc": 22, "code_v1_loc": 14, "code_v0_num_chars": 499, "code_v1_num_chars": 299, "code_v0_no_empty_lines": "from sys import stdin, stdout\n\nif __name__ == \"__main__\":\n n = int(stdin.readline())\n a = [int(x) for x in stdin.readline().split()]\n b = [int(x) for x in stdin.readline().split()]\n cnt = 0\n for i in range(n):\n if a[i] >= b[i]:\n cnt += b[i]\n else:\n cnt += a[i]\n d = b[i] - a[i]\n cnt += min(a[i + 1], d)\n if d > a[i + 1]:\n a[i + 1] = 0\n else:\n a[i + 1] -= d\n stdout.write(str(cnt) + \"\\n\")\n", "code_v1_no_empty_lines": "n = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\na1 = sum(A)\nfor i in range(n):\n b = B[i]\n if A[i] >= b:\n A[i] -= b\n else:\n if A[i + 1] + A[i] >= b:\n A[i + 1] = A[i + 1] + A[i] - b\n A[i] = 0\n else:\n A[i], A[i + 1] = 0, 0\na2 = sum(A)\nprint((a1 - a2))\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-from sys import stdin, stdout", "-", "-if __name__ == \"__main__\":", "- n = int(stdin.readline())", "- a = [int(x) for x in stdin.readline().split()]", "- b = [int(x) for x in stdin.readline().split()]", "- cnt = 0", "- for i in range(n):", "- if a[i] >= b[i]:", "- cnt += b[i]", "+n = int(input())", "+A = list(map(int, input().split()))", "+B = list(map(int, input().split()))", "+a1 = sum(A)", "+for i in range(n):", "+ b = B[i]", "+ if A[i] >= b:", "+ A[i] -= b", "+ else:", "+ if A[i + 1] + A[i] >= b:", "+ A[i + 1] = A[i + 1] + A[i] - b", "+ A[i] = 0", "- cnt += a[i]", "- d = b[i] - a[i]", "- cnt += min(a[i + 1], d)", "- if d > a[i + 1]:", "- a[i + 1] = 0", "- else:", "- a[i + 1] -= d", "- stdout.write(str(cnt) + \"\\n\")", "+ A[i], A[i + 1] = 0, 0", "+a2 = sum(A)", "+print((a1 - a2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2530250838, "measured_runtime_v1": 0.0949857178, "runtime_lift": 2.6638224113, "key": ["s078643579", "s464947070"]} +{"user_id": "u732159958", "problem_id": "p03416", "language": "python", "submission_id_v0": "s130057185", "submission_id_v1": "s637640023", "cpu_time_v0": 68, "cpu_time_v1": 50, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.47, "input": "counter = 0\n\nc = list(map(int, input().split(' ')))\n\nfor i in range(c[0], c[1] + 1):\n\n if str(i)[0] != str(i)[4]:\n\n continue\n\n if str(i)[1] != str(i)[3]:\n\n continue\n\n counter += 1\n\n\n\nprint(counter)", "target": "a = list(map(int, input().split()))\n\ncounter = 0\n\nfor i in range(a[0], a[1] + 1):\n\n stri = str(i)\n\n if (stri[0] == stri[4] and stri[1] == stri[3]):\n\n counter += 1\n\n \n\nprint(counter)", "code_v0_loc": 10, "code_v1_loc": 8, "code_v0_num_chars": 206, "code_v1_num_chars": 189, "code_v0_no_empty_lines": "counter = 0\nc = list(map(int, input().split(\" \")))\nfor i in range(c[0], c[1] + 1):\n if str(i)[0] != str(i)[4]:\n continue\n if str(i)[1] != str(i)[3]:\n continue\n counter += 1\nprint(counter)\n", "code_v1_no_empty_lines": "a = list(map(int, input().split()))\ncounter = 0\nfor i in range(a[0], a[1] + 1):\n stri = str(i)\n if stri[0] == stri[4] and stri[1] == stri[3]:\n counter += 1\nprint(counter)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["+a = list(map(int, input().split()))", "-c = list(map(int, input().split(\" \")))", "-for i in range(c[0], c[1] + 1):", "- if str(i)[0] != str(i)[4]:", "- continue", "- if str(i)[1] != str(i)[3]:", "- continue", "- counter += 1", "+for i in range(a[0], a[1] + 1):", "+ stri = str(i)", "+ if stri[0] == stri[4] and stri[1] == stri[3]:", "+ counter += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.442622024, "measured_runtime_v1": 0.3161446974, "runtime_lift": 1.4000615148, "key": ["s130057185", "s637640023"]} +{"user_id": "u089230684", "problem_id": "p03038", "language": "python", "submission_id_v0": "s817533229", "submission_id_v1": "s906455398", "cpu_time_v0": 826, "cpu_time_v1": 662, "memory_v0": 82456, "memory_v1": 25196, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.85, "input": "I=lambda:list(map(int,input().split()))\n\nn,m=I()\n\na=I()\n\na.sort(reverse=True)\n\nqq=[I() for i in range(m)]\n\nqq.sort(key=lambda x:x[1],reverse=True)\n\nans=0\n\nfor x,y in qq:\n\n for j in range(x):\n\n if not a:\n\n break\n\n aa=a.pop()\n\n ans+=max(aa,y)\n\nans+=sum(a)\n\nprint(ans)\n\n ", "target": "I=lambda : list(map(int,input().split()))\n\nn,m = I()\n\nl=I();s=sum(l);l.sort();d=[]\n\nfor _ in range(m):\n\n b,c=I()\n\n d.append([c,b])\n\np=s=0 \n\nfor i in sorted(d,reverse=True):\n\n while i[1]:\n\n if p>=n or l[p]>=i[0]:\n\n break\n\n i[1]-=1\n\n s+=i[0]\n\n p+=1\n\n if p>=n:\n\n break\n\ns+=sum(l[p:])\n\nprint(s)", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 310, "code_v1_num_chars": 351, "code_v0_no_empty_lines": "I = lambda: list(map(int, input().split()))\nn, m = I()\na = I()\na.sort(reverse=True)\nqq = [I() for i in range(m)]\nqq.sort(key=lambda x: x[1], reverse=True)\nans = 0\nfor x, y in qq:\n for j in range(x):\n if not a:\n break\n aa = a.pop()\n ans += max(aa, y)\nans += sum(a)\nprint(ans)\n", "code_v1_no_empty_lines": "I = lambda: list(map(int, input().split()))\nn, m = I()\nl = I()\ns = sum(l)\nl.sort()\nd = []\nfor _ in range(m):\n b, c = I()\n d.append([c, b])\np = s = 0\nfor i in sorted(d, reverse=True):\n while i[1]:\n if p >= n or l[p] >= i[0]:\n break\n i[1] -= 1\n s += i[0]\n p += 1\n if p >= n:\n break\ns += sum(l[p:])\nprint(s)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-a = I()", "-a.sort(reverse=True)", "-qq = [I() for i in range(m)]", "-qq.sort(key=lambda x: x[1], reverse=True)", "-ans = 0", "-for x, y in qq:", "- for j in range(x):", "- if not a:", "+l = I()", "+s = sum(l)", "+l.sort()", "+d = []", "+for _ in range(m):", "+ b, c = I()", "+ d.append([c, b])", "+p = s = 0", "+for i in sorted(d, reverse=True):", "+ while i[1]:", "+ if p >= n or l[p] >= i[0]:", "- aa = a.pop()", "- ans += max(aa, y)", "-ans += sum(a)", "-print(ans)", "+ i[1] -= 1", "+ s += i[0]", "+ p += 1", "+ if p >= n:", "+ break", "+s += sum(l[p:])", "+print(s)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3493785617, "measured_runtime_v1": 0.2761461248, "runtime_lift": 1.2651945122, "key": ["s817533229", "s906455398"]} +{"user_id": "u062691227", "problem_id": "p03723", "language": "python", "submission_id_v0": "s522426109", "submission_id_v1": "s794063832", "cpu_time_v0": 61, "cpu_time_v1": 29, "memory_v0": 61360, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.46, "input": "a,b,c=list(map(int,input().split()))\n\ne=(a-b)|(b-c)\n\nprint((bool(e|(a|b|c)%2)*(e^~-e).bit_length()-1))", "target": "a,b,c=list(map(int,input().split()))\n\ne=(a-b)|(b-c)\n\nprint((bool(e|b%2)*(e^~-e).bit_length()-1))", "code_v0_loc": 3, "code_v1_loc": 3, "code_v0_num_chars": 94, "code_v1_num_chars": 88, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\ne = (a - b) | (b - c)\nprint((bool(e | (a | b | c) % 2) * (e ^ ~-e).bit_length() - 1))\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\ne = (a - b) | (b - c)\nprint((bool(e | b % 2) * (e ^ ~-e).bit_length() - 1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-print((bool(e | (a | b | c) % 2) * (e ^ ~-e).bit_length() - 1))", "+print((bool(e | b % 2) * (e ^ ~-e).bit_length() - 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2914967289, "measured_runtime_v1": 0.0905496902, "runtime_lift": 3.2191907898, "key": ["s522426109", "s794063832"]} +{"user_id": "u298297089", "problem_id": "p03037", "language": "python", "submission_id_v0": "s092044899", "submission_id_v1": "s679810914", "cpu_time_v0": 352, "cpu_time_v1": 284, "memory_v0": 4760, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.32, "input": "N, M =list(map(int, input().split()))\n\nL = [0 for i in range(N+1)]\n\nR = [0 for i in range(N+1)]\n\nfor i in range(M):\n\n l,r = list(map(int, input().split()))\n\n L[l] += 1\n\n R[r] += 1\n\ncnt = 0\n\ntmp = 0\n\nfor i in range(N+1):\n\n tmp += L[i]\n\n if tmp == M:\n\n cnt += 1\n\n tmp -= R[i]\n\nprint(cnt)\n", "target": "n,m = list(map(int, input().split()))\n\nll = 1\n\nrr = n\n\nfor i in range(m):\n\n l,r = list(map(int,input().split()))\n\n if l > ll:\n\n ll = l\n\n if r < rr:\n\n rr = r\n\nprint((max(rr - ll + 1, 0)))\n", "code_v0_loc": 15, "code_v1_loc": 10, "code_v0_num_chars": 299, "code_v1_num_chars": 196, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL = [0 for i in range(N + 1)]\nR = [0 for i in range(N + 1)]\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L[l] += 1\n R[r] += 1\ncnt = 0\ntmp = 0\nfor i in range(N + 1):\n tmp += L[i]\n if tmp == M:\n cnt += 1\n tmp -= R[i]\nprint(cnt)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nll = 1\nrr = n\nfor i in range(m):\n l, r = list(map(int, input().split()))\n if l > ll:\n ll = l\n if r < rr:\n rr = r\nprint((max(rr - ll + 1, 0)))\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-N, M = list(map(int, input().split()))", "-L = [0 for i in range(N + 1)]", "-R = [0 for i in range(N + 1)]", "-for i in range(M):", "+n, m = list(map(int, input().split()))", "+ll = 1", "+rr = n", "+for i in range(m):", "- L[l] += 1", "- R[r] += 1", "-cnt = 0", "-tmp = 0", "-for i in range(N + 1):", "- tmp += L[i]", "- if tmp == M:", "- cnt += 1", "- tmp -= R[i]", "-print(cnt)", "+ if l > ll:", "+ ll = l", "+ if r < rr:", "+ rr = r", "+print((max(rr - ll + 1, 0)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2886495962, "measured_runtime_v1": 0.2151292083, "runtime_lift": 1.3417499114, "key": ["s092044899", "s679810914"]} +{"user_id": "u305366205", "problem_id": "p03307", "language": "python", "submission_id_v0": "s023207655", "submission_id_v1": "s158622460", "cpu_time_v0": 36, "cpu_time_v1": 17, "memory_v0": 5176, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.78, "input": "import math\n\n\n\n\n\ndef lcm(x, y):\n\n return (x * y) // math.gcd(x, y)\n\n\n\n\n\nN = int(input())\n\nprint((lcm(N, 2)))", "target": "N = int(input())\n\nif N % 2 == 0:\n\n print(N)\n\nelse:\n\n print((2 * N))", "code_v0_loc": 9, "code_v1_loc": 5, "code_v0_num_chars": 119, "code_v1_num_chars": 71, "code_v0_no_empty_lines": "import math\n\n\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\n\nN = int(input())\nprint((lcm(N, 2)))\n", "code_v1_no_empty_lines": "N = int(input())\nif N % 2 == 0:\n print(N)\nelse:\n print((2 * N))\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-import math", "-", "-", "-def lcm(x, y):", "- return (x * y) // math.gcd(x, y)", "-", "-", "-print((lcm(N, 2)))", "+if N % 2 == 0:", "+ print(N)", "+else:", "+ print((2 * N))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2764545197, "measured_runtime_v1": 0.1953277736, "runtime_lift": 1.4153364608, "key": ["s023207655", "s158622460"]} +{"user_id": "u254871849", "problem_id": "p03037", "language": "python", "submission_id_v0": "s133611442", "submission_id_v1": "s023877292", "cpu_time_v0": 105, "cpu_time_v1": 71, "memory_v0": 25076, "memory_v1": 25076, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.38, "input": "import sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nlr = list(zip(*[iter(lr)] * 2))\n\n\n\ndef main():\n\n cnt = [0] * (n + 1)\n\n for l, r in lr:\n\n cnt[l-1] += 1\n\n cnt[r] -= 1\n\n \n\n for i in range(n):\n\n cnt[i+1] += cnt[i]\n\n \n\n res = 0\n\n for i in range(n):\n\n res += (cnt[i] == m) & 1\n\n \n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "target": "import sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nl, r = lr[::2], lr[1::2]\n\n\n\ndef main():\n\n ans = max(min(r) - max(l) + 1, 0)\n\n return ans\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 23, "code_v1_loc": 12, "code_v0_num_chars": 413, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "import sys\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\nlr = list(zip(*[iter(lr)] * 2))\n\n\ndef main():\n cnt = [0] * (n + 1)\n for l, r in lr:\n cnt[l - 1] += 1\n cnt[r] -= 1\n for i in range(n):\n cnt[i + 1] += cnt[i]\n res = 0\n for i in range(n):\n res += (cnt[i] == m) & 1\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_v1_no_empty_lines": "import sys\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\nl, r = lr[::2], lr[1::2]\n\n\ndef main():\n ans = max(min(r) - max(l) + 1, 0)\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 47.8260869565, "diff": ["-lr = list(zip(*[iter(lr)] * 2))", "+l, r = lr[::2], lr[1::2]", "- cnt = [0] * (n + 1)", "- for l, r in lr:", "- cnt[l - 1] += 1", "- cnt[r] -= 1", "- for i in range(n):", "- cnt[i + 1] += cnt[i]", "- res = 0", "- for i in range(n):", "- res += (cnt[i] == m) & 1", "- return res", "+ ans = max(min(r) - max(l) + 1, 0)", "+ return ans"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3223134096, "measured_runtime_v1": 0.2034767451, "runtime_lift": 1.5840306928, "key": ["s133611442", "s023877292"]} +{"user_id": "u392319141", "problem_id": "p03208", "language": "python", "submission_id_v0": "s260498412", "submission_id_v1": "s755290756", "cpu_time_v0": 275, "cpu_time_v1": 243, "memory_v0": 7384, "memory_v1": 7484, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.64, "input": "N, K = list(map(int, input().split()))\n\n\n\nheight = []\n\nfor _ in range(N) :\n\n height.append(int(input()))\n\n\n\nheight.sort()\n\nans = float('inf')\n\n\n\nfor i in range(N-K+1) :\n\n diff = height[i + K - 1] - height[i]\n\n ans = min(ans, diff)\n\n\n\nprint(ans)", "target": "N, K = list(map(int, input().split()))\n\nH = [int(input()) for _ in range(N)]\n\nH.sort()\n\n\n\nans = 10**18\n\nfor i in range(N - K + 1):\n\n ans = min(ans, H[i + K - 1] - H[i])\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 8, "code_v0_num_chars": 247, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nheight = []\nfor _ in range(N):\n height.append(int(input()))\nheight.sort()\nans = float(\"inf\")\nfor i in range(N - K + 1):\n diff = height[i + K - 1] - height[i]\n ans = min(ans, diff)\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nH = [int(input()) for _ in range(N)]\nH.sort()\nans = 10**18\nfor i in range(N - K + 1):\n ans = min(ans, H[i + K - 1] - H[i])\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-height = []", "-for _ in range(N):", "- height.append(int(input()))", "-height.sort()", "-ans = float(\"inf\")", "+H = [int(input()) for _ in range(N)]", "+H.sort()", "+ans = 10**18", "- diff = height[i + K - 1] - height[i]", "- ans = min(ans, diff)", "+ ans = min(ans, H[i + K - 1] - H[i])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2545773742, "measured_runtime_v1": 0.0892174052, "runtime_lift": 2.8534496549, "key": ["s260498412", "s755290756"]} +{"user_id": "u867069435", "problem_id": "p03399", "language": "python", "submission_id_v0": "s852784971", "submission_id_v1": "s460322800", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "a, b, c, d = int(input()), int(input()), int(input()), int(input()),\n\nprint((min(a, b)+min(c, d)))", "target": "print((min(int(input()), int(input())) + min(int(input()), int(input()))))", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 96, "code_v1_num_chars": 72, "code_v0_no_empty_lines": "a, b, c, d = (\n int(input()),\n int(input()),\n int(input()),\n int(input()),\n)\nprint((min(a, b) + min(c, d)))\n", "code_v1_no_empty_lines": "print(\n (\n min(int(input()), int(input()))\n + min(int(input()), int(input()))\n )\n)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-a, b, c, d = (", "- int(input()),", "- int(input()),", "- int(input()),", "- int(input()),", "+print(", "+ (", "+ min(int(input()), int(input()))", "+ + min(int(input()), int(input()))", "+ )", "-print((min(a, b) + min(c, d)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2959700694, "measured_runtime_v1": 0.2359499116, "runtime_lift": 1.2543766912, "key": ["s852784971", "s460322800"]} +{"user_id": "u021019433", "problem_id": "p02837", "language": "python", "submission_id_v0": "s475579950", "submission_id_v1": "s165212154", "cpu_time_v0": 219, "cpu_time_v1": 58, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 73.52, "input": "def popcount(x):\n\n r = 0\n\n while x:\n\n if x & 1:\n\n r += 1\n\n x >>= 1\n\n return r\n\n\n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\n\n\nm = 0\n\nl = (1 << n) - 1\n\nfor x in range(1, l + 1):\n\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n\n m = max(m, popcount(x))\n\nprint(m)\n", "target": "from itertools import combinations\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [(set(), set()) for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y].add(x - 1)\n\n \n\nfail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)\n\n \n\nwhile all(map(fail, list(map(set, combinations(r, n))))):\n\n n -= 1\n\nprint(n)", "code_v0_loc": 22, "code_v1_loc": 15, "code_v0_num_chars": 430, "code_v1_num_chars": 365, "code_v0_no_empty_lines": "def popcount(x):\n r = 0\n while x:\n if x & 1:\n r += 1\n x >>= 1\n return r\n\n\nn = int(input())\nr = list(range(n))\na = [[0, 0] for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y] |= 1 << (x - 1)\nm = 0\nl = (1 << n) - 1\nfor x in range(1, l + 1):\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n m = max(m, popcount(x))\nprint(m)\n", "code_v1_no_empty_lines": "from itertools import combinations\n\nn = int(input())\nr = list(range(n))\na = [(set(), set()) for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y].add(x - 1)\nfail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)\nwhile all(map(fail, list(map(set, combinations(r, n))))):\n n -= 1\nprint(n)\n", "code_same": false, "relative_loc_diff_percent": 31.8181818182, "diff": ["-def popcount(x):", "- r = 0", "- while x:", "- if x & 1:", "- r += 1", "- x >>= 1", "- return r", "-", "+from itertools import combinations", "-a = [[0, 0] for _ in r]", "+a = [(set(), set()) for _ in r]", "- a[i][y] |= 1 << (x - 1)", "-m = 0", "-l = (1 << n) - 1", "-for x in range(1, l + 1):", "- if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):", "- m = max(m, popcount(x))", "-print(m)", "+ a[i][y].add(x - 1)", "+fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)", "+while all(map(fail, list(map(set, combinations(r, n))))):", "+ n -= 1", "+print(n)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2279194756, "measured_runtime_v1": 0.0067682672, "runtime_lift": 33.6747161436, "key": ["s475579950", "s165212154"]} +{"user_id": "u644907318", "problem_id": "p03241", "language": "python", "submission_id_v0": "s205255104", "submission_id_v1": "s496579949", "cpu_time_v0": 180, "cpu_time_v1": 73, "memory_v0": 38640, "memory_v1": 63824, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.44, "input": "N,M = list(map(int,input().split()))\n\nif N==1:\n\n nmax=M\n\nelse:\n\n nmax = 1\n\n for i in range(2,int(M**0.5)+1):\n\n if M%i==0 and M//i>=N:\n\n nmax = max(nmax,i)\n\n if M%i==0 and i>=N:\n\n nmax = max(nmax,M//i)\n\nprint(nmax)", "target": "N,M = list(map(int,input().split()))\n\namax = 1\n\nfor i in range(1,int(M**0.5)+1):\n\n if M%i==0:\n\n a = i\n\n b = M//i\n\n if b>=N:\n\n amax = max(amax,a)\n\n a,b = b,a\n\n if b>=N:\n\n amax = max(amax,a)\n\nprint(amax)", "code_v0_loc": 11, "code_v1_loc": 12, "code_v0_num_chars": 252, "code_v1_num_chars": 255, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nif N == 1:\n nmax = M\nelse:\n nmax = 1\n for i in range(2, int(M**0.5) + 1):\n if M % i == 0 and M // i >= N:\n nmax = max(nmax, i)\n if M % i == 0 and i >= N:\n nmax = max(nmax, M // i)\nprint(nmax)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\namax = 1\nfor i in range(1, int(M**0.5) + 1):\n if M % i == 0:\n a = i\n b = M // i\n if b >= N:\n amax = max(amax, a)\n a, b = b, a\n if b >= N:\n amax = max(amax, a)\nprint(amax)\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-if N == 1:", "- nmax = M", "-else:", "- nmax = 1", "- for i in range(2, int(M**0.5) + 1):", "- if M % i == 0 and M // i >= N:", "- nmax = max(nmax, i)", "- if M % i == 0 and i >= N:", "- nmax = max(nmax, M // i)", "-print(nmax)", "+amax = 1", "+for i in range(1, int(M**0.5) + 1):", "+ if M % i == 0:", "+ a = i", "+ b = M // i", "+ if b >= N:", "+ amax = max(amax, a)", "+ a, b = b, a", "+ if b >= N:", "+ amax = max(amax, a)", "+print(amax)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3445633175, "measured_runtime_v1": 0.2717220852, "runtime_lift": 1.26807255, "key": ["s205255104", "s496579949"]} +{"user_id": "u144913062", "problem_id": "p03457", "language": "python", "submission_id_v0": "s956976175", "submission_id_v1": "s285518014", "cpu_time_v0": 628, "cpu_time_v1": 555, "memory_v0": 62040, "memory_v1": 46056, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.62, "input": "N = int(input())\n\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\n\nfor i in range(N):\n\n t1, x1, y1 = txy[i]\n\n t2, x2, y2 = txy[i+1]\n\n if abs(x2-x1) + abs(y2-y1) <= t2 - t1 and (x1+y1+x2+y2) % 2 == (t2-t1) % 2:\n\n continue\n\n else:\n\n print('No')\n\n exit()\n\nprint('Yes')", "target": "N = int(input())\n\nt0 = x0 = y0 = 0\n\nfor _ in range(N):\n\n t1, x1, y1 = list(map(int, input().split()))\n\n d = abs(x1 - x0) + abs(y1 - y0)\n\n if d > t1 - t0 or d % 2 != (t1 - t0) % 2:\n\n print('No')\n\n exit()\n\n t0, x0, y0 = t1, x1, y1\n\nprint('Yes')\n", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 323, "code_v1_num_chars": 263, "code_v0_no_empty_lines": "N = int(input())\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\nfor i in range(N):\n t1, x1, y1 = txy[i]\n t2, x2, y2 = txy[i + 1]\n if (\n abs(x2 - x1) + abs(y2 - y1) <= t2 - t1\n and (x1 + y1 + x2 + y2) % 2 == (t2 - t1) % 2\n ):\n continue\n else:\n print(\"No\")\n exit()\nprint(\"Yes\")\n", "code_v1_no_empty_lines": "N = int(input())\nt0 = x0 = y0 = 0\nfor _ in range(N):\n t1, x1, y1 = list(map(int, input().split()))\n d = abs(x1 - x0) + abs(y1 - y0)\n if d > t1 - t0 or d % 2 != (t1 - t0) % 2:\n print(\"No\")\n exit()\n t0, x0, y0 = t1, x1, y1\nprint(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-txy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]", "-for i in range(N):", "- t1, x1, y1 = txy[i]", "- t2, x2, y2 = txy[i + 1]", "- if (", "- abs(x2 - x1) + abs(y2 - y1) <= t2 - t1", "- and (x1 + y1 + x2 + y2) % 2 == (t2 - t1) % 2", "- ):", "- continue", "- else:", "+t0 = x0 = y0 = 0", "+for _ in range(N):", "+ t1, x1, y1 = list(map(int, input().split()))", "+ d = abs(x1 - x0) + abs(y1 - y0)", "+ if d > t1 - t0 or d % 2 != (t1 - t0) % 2:", "+ t0, x0, y0 = t1, x1, y1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3724059272, "measured_runtime_v1": 0.2797260373, "runtime_lift": 1.3313237867, "key": ["s956976175", "s285518014"]} +{"user_id": "u729133443", "problem_id": "p02537", "language": "python", "submission_id_v0": "s897150427", "submission_id_v1": "s003067542", "cpu_time_v0": 1389, "cpu_time_v1": 1137, "memory_v0": 275544, "memory_v1": 157144, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.14, "input": "d=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()+d))\n\nfor i in range(n):d[i]=max(d[j]for j in range(i-99,i+1)if abs(a[i]-a[j])<=k)+1\n\nprint((max(d)))", "target": "d=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()))\n\na=d+a\n\nwhile n:d[n]=max(d[j]for j in range(n,n+99)if abs(a[-n]-a[-j])<=k)+1;n-=1\n\nprint((max(d)))", "code_v0_loc": 4, "code_v1_loc": 5, "code_v0_num_chars": 147, "code_v1_num_chars": 147, "code_v0_no_empty_lines": "d = [0] * 6**8\nn, k, *a = list(map(int, open(0).read().split() + d))\nfor i in range(n):\n d[i] = max(d[j] for j in range(i - 99, i + 1) if abs(a[i] - a[j]) <= k) + 1\nprint((max(d)))\n", "code_v1_no_empty_lines": "d = [0] * 6**8\nn, k, *a = list(map(int, open(0).read().split()))\na = d + a\nwhile n:\n d[n] = max(d[j] for j in range(n, n + 99) if abs(a[-n] - a[-j]) <= k) + 1\n n -= 1\nprint((max(d)))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-n, k, *a = list(map(int, open(0).read().split() + d))", "-for i in range(n):", "- d[i] = max(d[j] for j in range(i - 99, i + 1) if abs(a[i] - a[j]) <= k) + 1", "+n, k, *a = list(map(int, open(0).read().split()))", "+a = d + a", "+while n:", "+ d[n] = max(d[j] for j in range(n, n + 99) if abs(a[-n] - a[-j]) <= k) + 1", "+ n -= 1"], "diff_only_import_comment": false, "measured_runtime_v0": 1.750332129, "measured_runtime_v1": 0.822091434, "runtime_lift": 2.1291209914, "key": ["s897150427", "s003067542"]} +{"user_id": "u118019047", "problem_id": "p03416", "language": "python", "submission_id_v0": "s640144582", "submission_id_v1": "s252292470", "cpu_time_v0": 78, "cpu_time_v1": 54, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.77, "input": "a , b = input().split()\n\na = int(a)\n\nb = int(b)\n\ncount=0\n\nfor i in range(a,b+1):\n\n test = list(str(i))\n\n if (test[0] == test[4]) and (test[1]==test[3]):\n\n count=count+1\n\nprint(count)", "target": "A,B=list(map(int,input().split()))\n\nct=0\n\nfor i in range(A,B+1):\n\n s=str(i)\n\n if s==s[::-1]:\n\n ct+=1\n\nprint(ct)", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 195, "code_v1_num_chars": 118, "code_v0_no_empty_lines": "a, b = input().split()\na = int(a)\nb = int(b)\ncount = 0\nfor i in range(a, b + 1):\n test = list(str(i))\n if (test[0] == test[4]) and (test[1] == test[3]):\n count = count + 1\nprint(count)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nct = 0\nfor i in range(A, B + 1):\n s = str(i)\n if s == s[::-1]:\n ct += 1\nprint(ct)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-a, b = input().split()", "-a = int(a)", "-b = int(b)", "-count = 0", "-for i in range(a, b + 1):", "- test = list(str(i))", "- if (test[0] == test[4]) and (test[1] == test[3]):", "- count = count + 1", "-print(count)", "+A, B = list(map(int, input().split()))", "+ct = 0", "+for i in range(A, B + 1):", "+ s = str(i)", "+ if s == s[::-1]:", "+ ct += 1", "+print(ct)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4764800201, "measured_runtime_v1": 0.3351052109, "runtime_lift": 1.4218818588, "key": ["s640144582", "s252292470"]} +{"user_id": "u562016607", "problem_id": "p03835", "language": "python", "submission_id_v0": "s390314187", "submission_id_v1": "s016239384", "cpu_time_v0": 1476, "cpu_time_v1": 282, "memory_v0": 2940, "memory_v1": 41180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.89, "input": "K,S=list(map(int,input().split()))\n\nO=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n O+=1\n\nprint(O)\n", "target": "K,S=list(map(int,input().split()))\n\nans=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n ans+=1\n\nprint(ans)\n", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 132, "code_v1_num_chars": 154, "code_v0_no_empty_lines": "K, S = list(map(int, input().split()))\nO = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if 0 <= Z <= K:\n O += 1\nprint(O)\n", "code_v1_no_empty_lines": "K, S = list(map(int, input().split()))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if 0 <= Z <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-O = 0", "+ans = 0", "- O += 1", "-print(O)", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2257852338, "measured_runtime_v1": 0.0060590109, "runtime_lift": 37.2643715379, "key": ["s390314187", "s016239384"]} +{"user_id": "u812576525", "problem_id": "p03309", "language": "python", "submission_id_v0": "s649374585", "submission_id_v1": "s527849910", "cpu_time_v0": 249, "cpu_time_v1": 171, "memory_v0": 26180, "memory_v1": 30980, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 31.33, "input": "n = int(input())\n\na = list(map(int,input().split()))\n\naa = []\n\nfor i in range(n):\n\n aa.append(a[i]-(i+1))\n\nb = (sorted(aa)[n//2])\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans += abs(a[i]-(b+i+1))\n\nprint(ans)", "target": "N= int(input())\n\nA = list(map(int,input().split()))\n\n\n\nB = []\n\nfor i in range(N):\n\n B.append(A[i]-(i+1))\n\n#print(B)\n\nb= (sorted(B)[N//2])\n\n#print(b)\n\nans = 0\n\nfor i in range(N):\n\n ans += abs(B[i]-b)\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 13, "code_v0_num_chars": 205, "code_v1_num_chars": 216, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\naa = []\nfor i in range(n):\n aa.append(a[i] - (i + 1))\nb = sorted(aa)[n // 2]\nans = 0\nfor i in range(n):\n ans += abs(a[i] - (b + i + 1))\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nB = []\nfor i in range(N):\n B.append(A[i] - (i + 1))\n# print(B)\nb = sorted(B)[N // 2]\n# print(b)\nans = 0\nfor i in range(N):\n ans += abs(B[i] - b)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["-n = int(input())", "-a = list(map(int, input().split()))", "-aa = []", "-for i in range(n):", "- aa.append(a[i] - (i + 1))", "-b = sorted(aa)[n // 2]", "+N = int(input())", "+A = list(map(int, input().split()))", "+B = []", "+for i in range(N):", "+ B.append(A[i] - (i + 1))", "+# print(B)", "+b = sorted(B)[N // 2]", "+# print(b)", "-for i in range(n):", "- ans += abs(a[i] - (b + i + 1))", "+for i in range(N):", "+ ans += abs(B[i] - b)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.277994447, "measured_runtime_v1": 0.0063325391, "runtime_lift": 43.8993653214, "key": ["s649374585", "s527849910"]} +{"user_id": "u944325914", "problem_id": "p02773", "language": "python", "submission_id_v0": "s220148525", "submission_id_v1": "s009987907", "cpu_time_v0": 1010, "cpu_time_v1": 521, "memory_v0": 104656, "memory_v1": 50176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.42, "input": "import collections\n\nn = int(input())\n\na=[input() for _ in range(n)]\n\nanslist=[]\n\nb=collections.Counter(a)\n\nc=max(list(b.values()))\n\nfor i in b:\n\n if b[i]==c:\n\n anslist.append(i)\n\nd=sorted(anslist)\n\nfor i in tuple(d):\n\n print(i)", "target": "from collections import Counter\n\nn=int(input())\n\na=[]\n\nfor i in range(n):\n\n a.append(input())\n\nac=Counter(a)\n\nacs=sorted(list(ac.items()),key=lambda x:x[1],reverse=1)\n\nz=len(acs)\n\ni=0\n\ntemp=[]\n\n\n\nwhile i<=z-1 and acs[i][1]==acs[0][1] :\n\n temp.append(acs[i][0])\n\n i+=1\n\ntemp.sort()\n\nfor i in temp:\n\n print(i)", "code_v0_loc": 12, "code_v1_loc": 17, "code_v0_num_chars": 240, "code_v1_num_chars": 305, "code_v0_no_empty_lines": "import collections\n\nn = int(input())\na = [input() for _ in range(n)]\nanslist = []\nb = collections.Counter(a)\nc = max(list(b.values()))\nfor i in b:\n if b[i] == c:\n anslist.append(i)\nd = sorted(anslist)\nfor i in tuple(d):\n print(i)\n", "code_v1_no_empty_lines": "from collections import Counter\n\nn = int(input())\na = []\nfor i in range(n):\n a.append(input())\nac = Counter(a)\nacs = sorted(list(ac.items()), key=lambda x: x[1], reverse=1)\nz = len(acs)\ni = 0\ntemp = []\nwhile i <= z - 1 and acs[i][1] == acs[0][1]:\n temp.append(acs[i][0])\n i += 1\ntemp.sort()\nfor i in temp:\n print(i)\n", "code_same": false, "relative_loc_diff_percent": 29.4117647059, "diff": ["-import collections", "+from collections import Counter", "-a = [input() for _ in range(n)]", "-anslist = []", "-b = collections.Counter(a)", "-c = max(list(b.values()))", "-for i in b:", "- if b[i] == c:", "- anslist.append(i)", "-d = sorted(anslist)", "-for i in tuple(d):", "+a = []", "+for i in range(n):", "+ a.append(input())", "+ac = Counter(a)", "+acs = sorted(list(ac.items()), key=lambda x: x[1], reverse=1)", "+z = len(acs)", "+i = 0", "+temp = []", "+while i <= z - 1 and acs[i][1] == acs[0][1]:", "+ temp.append(acs[i][0])", "+ i += 1", "+temp.sort()", "+for i in temp:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3929853504, "measured_runtime_v1": 0.3037585902, "runtime_lift": 1.2937423435, "key": ["s220148525", "s009987907"]} +{"user_id": "u857759499", "problem_id": "p03371", "language": "python", "submission_id_v0": "s203363465", "submission_id_v1": "s893730989", "cpu_time_v0": 85, "cpu_time_v1": 17, "memory_v0": 7096, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.0, "input": "a,b,c,x,y = list(map(int,input().split()))\n\nxy = max(x,y)*2+1\n\nprint((min([c*i + max(0,a*(x-i//2)) +max(0,b*(y-i//2)) for i in range(0,xy,2)])))", "target": "a,b,c,x,y = list(map(int,input().split()))\n\nif x < y:\n\n a, b, x, y = b, a, y, x\n\nprint((min(a*x+b*y,2*c*y + a*(x-y),2*c*x)))", "code_v0_loc": 3, "code_v1_loc": 4, "code_v0_num_chars": 136, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nxy = max(x, y) * 2 + 1\nprint(\n (\n min(\n [\n c * i + max(0, a * (x - i // 2)) + max(0, b * (y - i // 2))\n for i in range(0, xy, 2)\n ]\n )\n )\n)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nif x < y:\n a, b, x, y = b, a, y, x\nprint((min(a * x + b * y, 2 * c * y + a * (x - y), 2 * c * x)))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-xy = max(x, y) * 2 + 1", "-print(", "- (", "- min(", "- [", "- c * i + max(0, a * (x - i // 2)) + max(0, b * (y - i // 2))", "- for i in range(0, xy, 2)", "- ]", "- )", "- )", "-)", "+if x < y:", "+ a, b, x, y = b, a, y, x", "+print((min(a * x + b * y, 2 * c * y + a * (x - y), 2 * c * x)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2887920134, "measured_runtime_v1": 0.2046661584, "runtime_lift": 1.4110394, "key": ["s203363465", "s893730989"]} +{"user_id": "u628732336", "problem_id": "p02412", "language": "python", "submission_id_v0": "s343999289", "submission_id_v1": "s206971885", "cpu_time_v0": 1010, "cpu_time_v1": 530, "memory_v0": 7716, "memory_v1": 7724, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.52, "input": "while True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == sum([s, m, e]):\n\n count += 1\n\n\n\n print(count)", "target": "while True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == s+m+e:\n\n count += 1\n\n\n\n print(count)", "code_v0_loc": 14, "code_v1_loc": 14, "code_v0_num_chars": 314, "code_v1_num_chars": 305, "code_v0_no_empty_lines": "while True:\n n, x = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for s in range(1, n - 1):\n for m in range(s + 1, n):\n for e in range(m + 1, n + 1):\n if x == sum([s, m, e]):\n count += 1\n print(count)\n", "code_v1_no_empty_lines": "while True:\n n, x = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for s in range(1, n - 1):\n for m in range(s + 1, n):\n for e in range(m + 1, n + 1):\n if x == s + m + e:\n count += 1\n print(count)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if x == sum([s, m, e]):", "+ if x == s + m + e:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3385973902, "measured_runtime_v1": 0.2597145021, "runtime_lift": 1.3037292389, "key": ["s343999289", "s206971885"]} +{"user_id": "u102461423", "problem_id": "p03000", "language": "python", "submission_id_v0": "s091839409", "submission_id_v1": "s096312338", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N,X = list(map(int,input().split()))\n\nL = [0] + [int(x) for x in input().split()]\n\n\n\nD = [0] * (N+2)\n\nanswer = 1\n\nfor n in range(2,N+2):\n\n D[n] = D[n-1] + L[n-1]\n\n if D[n] <= X:\n\n answer += 1\n\n \n\nprint(answer)", "target": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nimport itertools\n\n\n\nN,X,*L = list(map(int,read().split()))\n\n\n\nanswer = sum(x <= X for x in itertools.accumulate([0]+L))\n\nprint(answer)", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 211, "code_v1_num_chars": 250, "code_v0_no_empty_lines": "N, X = list(map(int, input().split()))\nL = [0] + [int(x) for x in input().split()]\nD = [0] * (N + 2)\nanswer = 1\nfor n in range(2, N + 2):\n D[n] = D[n - 1] + L[n - 1]\n if D[n] <= X:\n answer += 1\nprint(answer)\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport itertools\n\nN, X, *L = list(map(int, read().split()))\nanswer = sum(x <= X for x in itertools.accumulate([0] + L))\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-N, X = list(map(int, input().split()))", "-L = [0] + [int(x) for x in input().split()]", "-D = [0] * (N + 2)", "-answer = 1", "-for n in range(2, N + 2):", "- D[n] = D[n - 1] + L[n - 1]", "- if D[n] <= X:", "- answer += 1", "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "+import itertools", "+", "+N, X, *L = list(map(int, read().split()))", "+answer = sum(x <= X for x in itertools.accumulate([0] + L))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4454345685, "measured_runtime_v1": 0.3287086122, "runtime_lift": 1.3551046487, "key": ["s091839409", "s096312338"]} +{"user_id": "u133936772", "problem_id": "p02983", "language": "python", "submission_id_v0": "s915950177", "submission_id_v1": "s423283368", "cpu_time_v0": 97, "cpu_time_v1": 51, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.42, "input": "mod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r//mod - l//mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l+1, r+1):\n\n for j in range(l, i):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)", "target": "mod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r//mod - l//mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l, r):\n\n for j in range(i+1, r+1):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)", "code_v0_loc": 15, "code_v1_loc": 15, "code_v0_num_chars": 259, "code_v1_num_chars": 259, "code_v0_no_empty_lines": "mod = 2019\nl, r = list(map(int, input().split()))\nif r // mod - l // mod > 0:\n print((0))\nelse:\n l %= mod\n r %= mod\n ans = mod\n for i in range(l + 1, r + 1):\n for j in range(l, i):\n ans = min(i * j % mod, ans)\n if ans == 0:\n break\n print(ans)\n", "code_v1_no_empty_lines": "mod = 2019\nl, r = list(map(int, input().split()))\nif r // mod - l // mod > 0:\n print((0))\nelse:\n l %= mod\n r %= mod\n ans = mod\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n ans = min(i * j % mod, ans)\n if ans == 0:\n break\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- for i in range(l + 1, r + 1):", "- for j in range(l, i):", "+ for i in range(l, r):", "+ for j in range(i + 1, r + 1):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3490325066, "measured_runtime_v1": 0.2693671175, "runtime_lift": 1.2957502381, "key": ["s915950177", "s423283368"]} +{"user_id": "u661290476", "problem_id": "p00053", "language": "python", "submission_id_v0": "s978814614", "submission_id_v1": "s421101567", "cpu_time_v0": 420, "cpu_time_v1": 210, "memory_v0": 18368, "memory_v1": 51028, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "prim=[True]*1000000\n\nprim[0],prim[1]=False,False\n\nfor i in range(2,1000):\n\n if prim[i]:\n\n for j in range(i*2,1000000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(input())\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))", "target": "prim=[True]*1000000\n\nprim[0]=prim[1]=False\n\nfor i in range(2,350):\n\n if prim[i]:\n\n for j in range(i*2,110000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(input())\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 297, "code_v1_num_chars": 289, "code_v0_no_empty_lines": "prim = [True] * 1000000\nprim[0], prim[1] = False, False\nfor i in range(2, 1000):\n if prim[i]:\n for j in range(i * 2, 1000000, i):\n prim[j] = False\nprime = [i for i, j in enumerate(prim) if j == True]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(prime[:n])))\n", "code_v1_no_empty_lines": "prim = [True] * 1000000\nprim[0] = prim[1] = False\nfor i in range(2, 350):\n if prim[i]:\n for j in range(i * 2, 110000, i):\n prim[j] = False\nprime = [i for i, j in enumerate(prim) if j == True]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(prime[:n])))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-prim[0], prim[1] = False, False", "-for i in range(2, 1000):", "+prim[0] = prim[1] = False", "+for i in range(2, 350):", "- for j in range(i * 2, 1000000, i):", "+ for j in range(i * 2, 110000, i):"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0302433112, "measured_runtime_v1": 0.6551637814, "runtime_lift": 1.5724973516, "key": ["s978814614", "s421101567"]} +{"user_id": "u347600233", "problem_id": "p03037", "language": "python", "submission_id_v0": "s661845965", "submission_id_v1": "s817506416", "cpu_time_v0": 279, "cpu_time_v1": 195, "memory_v0": 7088, "memory_v1": 16564, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.11, "input": "n, m = list(map(int, input().split()))\n\ngate = []\n\nl, r = list(map(int, input().split()))\n\nfor i in range(1, m):\n\n m, s = list(map(int, input().split()))\n\n if l < m:\n\n l = m\n\n if s < r:\n\n r = s\n\nprint((len([i for i in range(l, r + 1)])))", "target": "n, m = list(map(int, input().split()))\n\nl, r = [0] * m, [0] * m\n\nfor i in range(m):\n\n l[i], r[i] = list(map(int, input().split()))\n\nprint((max(min(r) - max(l) + 1, 0)))", "code_v0_loc": 10, "code_v1_loc": 5, "code_v0_num_chars": 240, "code_v1_num_chars": 157, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\ngate = []\nl, r = list(map(int, input().split()))\nfor i in range(1, m):\n m, s = list(map(int, input().split()))\n if l < m:\n l = m\n if s < r:\n r = s\nprint((len([i for i in range(l, r + 1)])))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nl, r = [0] * m, [0] * m\nfor i in range(m):\n l[i], r[i] = list(map(int, input().split()))\nprint((max(min(r) - max(l) + 1, 0)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-gate = []", "-l, r = list(map(int, input().split()))", "-for i in range(1, m):", "- m, s = list(map(int, input().split()))", "- if l < m:", "- l = m", "- if s < r:", "- r = s", "-print((len([i for i in range(l, r + 1)])))", "+l, r = [0] * m, [0] * m", "+for i in range(m):", "+ l[i], r[i] = list(map(int, input().split()))", "+print((max(min(r) - max(l) + 1, 0)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.317712152, "measured_runtime_v1": 0.2449507949, "runtime_lift": 1.2970447884, "key": ["s661845965", "s817506416"]} +{"user_id": "u585963734", "problem_id": "p02596", "language": "python", "submission_id_v0": "s961921352", "submission_id_v1": "s631804156", "cpu_time_v0": 290, "cpu_time_v1": 180, "memory_v0": 48468, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.93, "input": "K=int(input())\n\n\n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n \n\nans=[0]*(pow(10,6)+1)\n\nans[0]=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n ans[i]=(ans[i-1]*10+7)%K\n\n if ans[i]==0:\n\n print(i)\n\n exit(0)\n\n\n\nprint((-1))", "target": "import functools\n\n\n\nK=int(input())\n\n \n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n\n\nmod=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n mod=(mod*10+7)%K\n\n if mod==0:\n\n print(i)\n\n exit(0)\n\n \n\nprint((-1))", "code_v0_loc": 16, "code_v1_loc": 17, "code_v0_num_chars": 224, "code_v1_num_chars": 212, "code_v0_no_empty_lines": "K = int(input())\nif K % 2 == 0:\n print((-1))\n exit(0)\nans = [0] * (pow(10, 6) + 1)\nans[0] = 0\nfor i in range(1, pow(10, 6)):\n ans[i] = (ans[i - 1] * 10 + 7) % K\n if ans[i] == 0:\n print(i)\n exit(0)\nprint((-1))\n", "code_v1_no_empty_lines": "import functools\n\nK = int(input())\nif K % 2 == 0:\n print((-1))\n exit(0)\nmod = 0\nfor i in range(1, pow(10, 6)):\n mod = (mod * 10 + 7) % K\n if mod == 0:\n print(i)\n exit(0)\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["+import functools", "+", "-ans = [0] * (pow(10, 6) + 1)", "-ans[0] = 0", "+mod = 0", "- ans[i] = (ans[i - 1] * 10 + 7) % K", "- if ans[i] == 0:", "+ mod = (mod * 10 + 7) % K", "+ if mod == 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7143074386, "measured_runtime_v1": 0.5444337668, "runtime_lift": 1.3120189858, "key": ["s961921352", "s631804156"]} +{"user_id": "u188827677", "problem_id": "p03037", "language": "python", "submission_id_v0": "s698380012", "submission_id_v1": "s714478978", "cpu_time_v0": 302, "cpu_time_v1": 221, "memory_v0": 11020, "memory_v1": 9144, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.82, "input": "N,M = list(map(int, input().split()))\n\nL = []\n\nR = []\n\nfor _ in range(M):\n\n l,r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n\n\nans = min(R)-max(L)+1\n\nif ans < 0:\n\n print((0))\n\nelse:\n\n print(ans)\n\n ", "target": "n,m = list(map(int, input().split()))\n\nmax_l = float(\"-inf\")\n\nmin_r = float(\"inf\")\n\nfor _ in range(m):\n\n l,r = list(map(int, input().split()))\n\n max_l = max(max_l, l)\n\n min_r = min(min_r, r)\n\nans = min_r - max_l + 1\n\nif ans > 0:\n\n print(ans)\n\nelse:\n\n print((0))", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 207, "code_v1_num_chars": 252, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL = []\nR = []\nfor _ in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\nans = min(R) - max(L) + 1\nif ans < 0:\n print((0))\nelse:\n print(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nmax_l = float(\"-inf\")\nmin_r = float(\"inf\")\nfor _ in range(m):\n l, r = list(map(int, input().split()))\n max_l = max(max_l, l)\n min_r = min(min_r, r)\nans = min_r - max_l + 1\nif ans > 0:\n print(ans)\nelse:\n print((0))\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-N, M = list(map(int, input().split()))", "-L = []", "-R = []", "-for _ in range(M):", "+n, m = list(map(int, input().split()))", "+max_l = float(\"-inf\")", "+min_r = float(\"inf\")", "+for _ in range(m):", "- L.append(l)", "- R.append(r)", "-ans = min(R) - max(L) + 1", "-if ans < 0:", "+ max_l = max(max_l, l)", "+ min_r = min(min_r, r)", "+ans = min_r - max_l + 1", "+if ans > 0:", "+ print(ans)", "+else:", "-else:", "- print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2637555127, "measured_runtime_v1": 0.1756164875, "runtime_lift": 1.5018835444, "key": ["s698380012", "s714478978"]} +{"user_id": "u803617136", "problem_id": "p03325", "language": "python", "submission_id_v0": "s116805601", "submission_id_v1": "s513357045", "cpu_time_v0": 184, "cpu_time_v1": 27, "memory_v0": 40560, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.33, "input": "N = int(input())\n\n\n\nseq = list(map(int, input().split()))\n\n\n\ncnt = 0\n\n\n\nfor num in seq:\n\n while num % 2 == 0:\n\n cnt += 1\n\n num /= 2\n\n\n\nprint(cnt)\n", "target": "n = int(input())\n\na = list(map(int, input().split()))\n\nans = 0\n\nfor num in a:\n\n ans += format(num, 'b')[::-1].find('1')\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 6, "code_v0_num_chars": 163, "code_v1_num_chars": 134, "code_v0_no_empty_lines": "N = int(input())\nseq = list(map(int, input().split()))\ncnt = 0\nfor num in seq:\n while num % 2 == 0:\n cnt += 1\n num /= 2\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nans = 0\nfor num in a:\n ans += format(num, \"b\")[::-1].find(\"1\")\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-N = int(input())", "-seq = list(map(int, input().split()))", "-cnt = 0", "-for num in seq:", "- while num % 2 == 0:", "- cnt += 1", "- num /= 2", "-print(cnt)", "+n = int(input())", "+a = list(map(int, input().split()))", "+ans = 0", "+for num in a:", "+ ans += format(num, \"b\")[::-1].find(\"1\")", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1574799829, "measured_runtime_v1": 0.0061847587, "runtime_lift": 25.4625913758, "key": ["s116805601", "s513357045"]} +{"user_id": "u186838327", "problem_id": "p03796", "language": "python", "submission_id_v0": "s155084707", "submission_id_v1": "s301395968", "cpu_time_v0": 231, "cpu_time_v1": 177, "memory_v0": 4104, "memory_v1": 38640, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.38, "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))", "target": "n = int(input())\n\nans = 1\n\nmod = 10**9+7\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= mod\n\n\n\nans %= mod\n\nprint(ans)\n", "code_v0_loc": 3, "code_v1_loc": 9, "code_v0_num_chars": 65, "code_v1_num_chars": 122, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nmod = 10**9 + 7\nfor i in range(1, n + 1):\n ans *= i\n ans %= mod\nans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+ans = 1", "+mod = 10**9 + 7", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= mod", "+ans %= mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5786725054, "measured_runtime_v1": 0.2556207638, "runtime_lift": 2.2637930378, "key": ["s155084707", "s301395968"]} +{"user_id": "u014333473", "problem_id": "p03845", "language": "python", "submission_id_v0": "s045706452", "submission_id_v1": "s705375036", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9180, "memory_v1": 9164, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "n,t=int(input()),list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n", "target": "input();t=list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n", "code_v0_loc": 2, "code_v1_loc": 2, "code_v0_num_chars": 160, "code_v1_num_chars": 153, "code_v0_no_empty_lines": "n, t = int(input()), list(map(int, input().split()))\nT = sum(t)\nprint(\n *[\n T - t[i - 1] + j\n for i, j in [list(map(int, input().split())) for _ in range(int(input()))]\n ],\n sep=\"\\n\"\n)\n", "code_v1_no_empty_lines": "input()\nt = list(map(int, input().split()))\nT = sum(t)\nprint(\n *[\n T - t[i - 1] + j\n for i, j in [list(map(int, input().split())) for _ in range(int(input()))]\n ],\n sep=\"\\n\"\n)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-n, t = int(input()), list(map(int, input().split()))", "+input()", "+t = list(map(int, input().split()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.308619008, "measured_runtime_v1": 0.2417461898, "runtime_lift": 1.2766240837, "key": ["s045706452", "s705375036"]} +{"user_id": "u906501980", "problem_id": "p03363", "language": "python", "submission_id_v0": "s203042500", "submission_id_v1": "s990747122", "cpu_time_v0": 316, "cpu_time_v1": 264, "memory_v0": 52496, "memory_v1": 52544, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.46, "input": "n = int(input())\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum={}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n if str(i) in list(num.keys()):\n\n num[str(i)] += 1\n\n else:\n\n num[str(i)] = 1\n\nout = [i*(i-1)//2 for i in list(num.values()) if i>1]\n\nprint((sum(out)))", "target": "n = int(input())\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum = {}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n s = str(i)\n\n num[s] = 1 if s not in list(num.keys()) else num[s]+1\n\nout = [i*(i-1)//2 for i in list(num.values()) if i > 1]\n\nprint((sum(out)))", "code_v0_loc": 13, "code_v1_loc": 11, "code_v0_num_chars": 295, "code_v1_num_chars": 276, "code_v0_no_empty_lines": "n = int(input())\nA = [int(i) for i in input().split()]\nS = [0] * (n + 1)\nnum = {}\nfor i in range(n):\n S[i + 1] = S[i] + A[i]\nfor i in S:\n if str(i) in list(num.keys()):\n num[str(i)] += 1\n else:\n num[str(i)] = 1\nout = [i * (i - 1) // 2 for i in list(num.values()) if i > 1]\nprint((sum(out)))\n", "code_v1_no_empty_lines": "n = int(input())\nA = [int(i) for i in input().split()]\nS = [0] * (n + 1)\nnum = {}\nfor i in range(n):\n S[i + 1] = S[i] + A[i]\nfor i in S:\n s = str(i)\n num[s] = 1 if s not in list(num.keys()) else num[s] + 1\nout = [i * (i - 1) // 2 for i in list(num.values()) if i > 1]\nprint((sum(out)))\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["- if str(i) in list(num.keys()):", "- num[str(i)] += 1", "- else:", "- num[str(i)] = 1", "+ s = str(i)", "+ num[s] = 1 if s not in list(num.keys()) else num[s] + 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4443410683, "measured_runtime_v1": 0.2339228122, "runtime_lift": 1.8995200341, "key": ["s203042500", "s990747122"]} +{"user_id": "u805332733", "problem_id": "p02555", "language": "python", "submission_id_v0": "s317659277", "submission_id_v1": "s521440898", "cpu_time_v0": 89, "cpu_time_v1": 65, "memory_v0": 64652, "memory_v1": 63416, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.97, "input": "def resolve():\n\n base = 10**9+7\n\n S = int(input())\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(1, S+1):\n\n for u in range(i-2):\n\n dp[i] += dp[u]\n\n dp[i] %= base\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n", "target": "def resolve():\n\n base = 10**9+7\n\n S = int(input())\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(3, S+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()", "code_v0_loc": 15, "code_v1_loc": 13, "code_v0_num_chars": 263, "code_v1_num_chars": 224, "code_v0_no_empty_lines": "def resolve():\n base = 10**9 + 7\n S = int(input())\n dp = [0] * (S + 1)\n dp[0] = 1\n for i in range(1, S + 1):\n for u in range(i - 2):\n dp[i] += dp[u]\n dp[i] %= base\n # print(dp)\n print((dp[S] % base))\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_v1_no_empty_lines": "def resolve():\n base = 10**9 + 7\n S = int(input())\n dp = [0] * (S + 1)\n dp[0] = 1\n for i in range(3, S + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n # print(dp)\n print((dp[S] % base))\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 13.3333333333, "diff": ["- for i in range(1, S + 1):", "- for u in range(i - 2):", "- dp[i] += dp[u]", "- dp[i] %= base", "+ for i in range(3, S + 1):", "+ dp[i] = dp[i - 1] + dp[i - 3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5217176821, "measured_runtime_v1": 0.2045270953, "runtime_lift": 2.5508487337, "key": ["s317659277", "s521440898"]} +{"user_id": "u450904670", "problem_id": "p03796", "language": "python", "submission_id_v0": "s280545626", "submission_id_v1": "s422534863", "cpu_time_v0": 73, "cpu_time_v1": 40, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.21, "input": "n = int(input())\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (pow(10,9) + 7)\n\nprint(res)", "target": "n = int(input())\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (10**9 + 7)\n\nprint(res)\n", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 114, "code_v1_num_chars": 115, "code_v0_no_empty_lines": "n = int(input())\nres = 1\nfor num in range(1, n + 1):\n res = res * num\n res = res % (pow(10, 9) + 7)\nprint(res)\n", "code_v1_no_empty_lines": "n = int(input())\nres = 1\nfor num in range(1, n + 1):\n res = res * num\n res = res % (10**9 + 7)\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- res = res % (pow(10, 9) + 7)", "+ res = res % (10**9 + 7)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4279417639, "measured_runtime_v1": 0.3313806841, "runtime_lift": 1.2913901876, "key": ["s280545626", "s422534863"]} +{"user_id": "u498487134", "problem_id": "p02917", "language": "python", "submission_id_v0": "s303870321", "submission_id_v1": "s766724876", "cpu_time_v0": 162, "cpu_time_v1": 67, "memory_v0": 38256, "memory_v1": 61812, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.64, "input": "N = int(input())\n\nB =list(map(int,input().split()))\n\nA=[0]*N\n\n\n\nA[0]=B[0]\n\nfor i in range(1,N-1):\n\n A[i]=min(B[i],B[i-1])\n\nA[-1]=B[-1]\n\nprint((sum(A)))", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(input())\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N=I()\n\n B=LI()\n\n A=[0]*N\n\n A[0]=B[0]\n\n A[-1]=B[-1]\n\n for i in range(N-2):\n\n A[i+1]=min(B[i],B[i+1])\n\n \n\n print((sum(A)))\n\n\n\nmain()\n", "code_v0_loc": 9, "code_v1_loc": 20, "code_v0_num_chars": 152, "code_v1_num_chars": 363, "code_v0_no_empty_lines": "N = int(input())\nB = list(map(int, input().split()))\nA = [0] * N\nA[0] = B[0]\nfor i in range(1, N - 1):\n A[i] = min(B[i], B[i - 1])\nA[-1] = B[-1]\nprint((sum(A)))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N = I()\n B = LI()\n A = [0] * N\n A[0] = B[0]\n A[-1] = B[-1]\n for i in range(N - 2):\n A[i + 1] = min(B[i], B[i + 1])\n print((sum(A)))\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 55.0, "diff": ["-N = int(input())", "-B = list(map(int, input().split()))", "-A = [0] * N", "-A[0] = B[0]", "-for i in range(1, N - 1):", "- A[i] = min(B[i], B[i - 1])", "-A[-1] = B[-1]", "-print((sum(A)))", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def I():", "+ return int(input())", "+", "+", "+def MI():", "+ return list(map(int, input().split()))", "+", "+", "+def LI():", "+ return list(map(int, input().split()))", "+", "+", "+def main():", "+ mod = 10**9 + 7", "+ N = I()", "+ B = LI()", "+ A = [0] * N", "+ A[0] = B[0]", "+ A[-1] = B[-1]", "+ for i in range(N - 2):", "+ A[i + 1] = min(B[i], B[i + 1])", "+ print((sum(A)))", "+", "+", "+main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.251366816, "measured_runtime_v1": 0.147175539, "runtime_lift": 1.7079388172, "key": ["s303870321", "s766724876"]} +{"user_id": "u047796752", "problem_id": "p02700", "language": "python", "submission_id_v0": "s232689719", "submission_id_v1": "s065315130", "cpu_time_v0": 74, "cpu_time_v1": 57, "memory_v0": 64716, "memory_v1": 61776, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.97, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nA, B, C, D = list(map(int, input().split()))\n\n\n\nwhile True:\n\n C -= B\n\n \n\n if C<=0:\n\n print('Yes')\n\n exit()\n\n \n\n A -= D\n\n \n\n if A<=0:\n\n print('No')\n\n exit()", "target": "A, B, C, D = list(map(int, input().split()))\n\nc1 = (C+B-1)//B\n\nc2 = (A+D-1)//D\n\n\n\nif c1<=c2:\n\n print('Yes')\n\nelse:\n\n print('No')", "code_v0_loc": 18, "code_v1_loc": 8, "code_v0_num_chars": 267, "code_v1_num_chars": 128, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\nA, B, C, D = list(map(int, input().split()))\nwhile True:\n C -= B\n if C <= 0:\n print(\"Yes\")\n exit()\n A -= D\n if A <= 0:\n print(\"No\")\n exit()\n", "code_v1_no_empty_lines": "A, B, C, D = list(map(int, input().split()))\nc1 = (C + B - 1) // B\nc2 = (A + D - 1) // D\nif c1 <= c2:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-from collections import *", "-", "-while True:", "- C -= B", "- if C <= 0:", "- print(\"Yes\")", "- exit()", "- A -= D", "- if A <= 0:", "- print(\"No\")", "- exit()", "+c1 = (C + B - 1) // B", "+c2 = (A + D - 1) // D", "+if c1 <= c2:", "+ print(\"Yes\")", "+else:", "+ print(\"No\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2898896478, "measured_runtime_v1": 0.0638447898, "runtime_lift": 4.5405372711, "key": ["s232689719", "s065315130"]} +{"user_id": "u086503932", "problem_id": "p02814", "language": "python", "submission_id_v0": "s657535199", "submission_id_v1": "s415753878", "cpu_time_v0": 500, "cpu_time_v1": 202, "memory_v0": 16280, "memory_v1": 91128, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.6, "input": "#!/usr/bin/env python3\n\nimport sys\n\nfrom math import gcd\n\nimport math\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n tmp = 1\n\n count = None\n\n for i in range(N):\n\n tmp = (tmp * a[i]//2) // gcd(tmp,a[i]//2)\n\n c = 0\n\n n = a[i]//2\n\n while n % 2 == 0:\n\n c += 1\n\n n //= 2\n\n if i == 0:\n\n count = c\n\n elif count != c:\n\n print((0))\n\n exit()\n\n print(((M//tmp +1)//2))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "from math import gcd\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = [a//2 for a in A]\n\nLCM = 1\n\nfor i in range(N):\n\n LCM = LCM * B[i] // gcd(LCM, B[i])\n\nfor i in range(N):\n\n if LCM // B[i] % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((M//LCM + 1)//2))", "code_v0_loc": 26, "code_v1_loc": 13, "code_v0_num_chars": 527, "code_v1_num_chars": 293, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nimport sys\nfrom math import gcd\nimport math\n\n\ndef main():\n N, M = list(map(int, input().split()))\n a = list(map(int, input().split()))\n tmp = 1\n count = None\n for i in range(N):\n tmp = (tmp * a[i] // 2) // gcd(tmp, a[i] // 2)\n c = 0\n n = a[i] // 2\n while n % 2 == 0:\n c += 1\n n //= 2\n if i == 0:\n count = c\n elif count != c:\n print((0))\n exit()\n print(((M // tmp + 1) // 2))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from math import gcd\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = [a // 2 for a in A]\nLCM = 1\nfor i in range(N):\n LCM = LCM * B[i] // gcd(LCM, B[i])\nfor i in range(N):\n if LCM // B[i] % 2 == 0:\n print((0))\n exit()\nprint(((M // LCM + 1) // 2))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-#!/usr/bin/env python3", "-import sys", "-from math import gcd", "-import math", "+from math import gcd", "-", "-def main():", "- N, M = list(map(int, input().split()))", "- a = list(map(int, input().split()))", "- tmp = 1", "- count = None", "- for i in range(N):", "- tmp = (tmp * a[i] // 2) // gcd(tmp, a[i] // 2)", "- c = 0", "- n = a[i] // 2", "- while n % 2 == 0:", "- c += 1", "- n //= 2", "- if i == 0:", "- count = c", "- elif count != c:", "- print((0))", "- exit()", "- print(((M // tmp + 1) // 2))", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+N, M = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "+B = [a // 2 for a in A]", "+LCM = 1", "+for i in range(N):", "+ LCM = LCM * B[i] // gcd(LCM, B[i])", "+for i in range(N):", "+ if LCM // B[i] % 2 == 0:", "+ print((0))", "+ exit()", "+print(((M // LCM + 1) // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4621698339, "measured_runtime_v1": 0.3237110667, "runtime_lift": 1.4277233045, "key": ["s657535199", "s415753878"]} +{"user_id": "u433181015", "problem_id": "p02394", "language": "python", "submission_id_v0": "s560769298", "submission_id_v1": "s595626547", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7680, "memory_v1": 7728, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "a=input().split()\n\nb=list(map(int,a))\n\nW=b[0]\n\nH=b[1]\n\nx=b[2]\n\ny=b[3]\n\nr=b[4]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')", "target": "W,H,x,y,r = [int(i) for i in input().split()]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')", "code_v0_loc": 11, "code_v1_loc": 5, "code_v0_num_chars": 164, "code_v1_num_chars": 132, "code_v0_no_empty_lines": "a = input().split()\nb = list(map(int, a))\nW = b[0]\nH = b[1]\nx = b[2]\ny = b[3]\nr = b[4]\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "W, H, x, y, r = [int(i) for i in input().split()]\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 54.5454545455, "diff": ["-a = input().split()", "-b = list(map(int, a))", "-W = b[0]", "-H = b[1]", "-x = b[2]", "-y = b[3]", "-r = b[4]", "+W, H, x, y, r = [int(i) for i in input().split()]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3832537071, "measured_runtime_v1": 0.2996923448, "runtime_lift": 1.2788238128, "key": ["s560769298", "s595626547"]} +{"user_id": "u454022848", "problem_id": "p02394", "language": "python", "submission_id_v0": "s949778573", "submission_id_v1": "s992404688", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 6724, "memory_v1": 6432, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "ia = [int(i) for i in input().split(\" \")]\n\nW=ia[0]\n\nH=ia[1]\n\nx=ia[2]\n\ny=ia[3]\n\nr=ia[4]\n\nprint((\"Yes\" if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H else \"No\"))", "target": "# encoding:utf-8\n\n\n\ninput = list(map(int, input().split()))\n\nW, H, x, y, r = input\n\n\n\nif x - r < 0 or x + r > W:\n\n\tprint(\"No\")\n\nelif y - r < 0 or y + r > H:\n\n\tprint(\"No\")\n\nelse:\n\n\tprint(\"Yes\")", "code_v0_loc": 7, "code_v1_loc": 11, "code_v0_num_chars": 153, "code_v1_num_chars": 190, "code_v0_no_empty_lines": "ia = [int(i) for i in input().split(\" \")]\nW = ia[0]\nH = ia[1]\nx = ia[2]\ny = ia[3]\nr = ia[4]\nprint((\"Yes\" if 0 <= x - r and x + r <= W and 0 <= y - r and y + r <= H else \"No\"))\n", "code_v1_no_empty_lines": "# encoding:utf-8\ninput = list(map(int, input().split()))\nW, H, x, y, r = input\nif x - r < 0 or x + r > W:\n print(\"No\")\nelif y - r < 0 or y + r > H:\n print(\"No\")\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-ia = [int(i) for i in input().split(\" \")]", "-W = ia[0]", "-H = ia[1]", "-x = ia[2]", "-y = ia[3]", "-r = ia[4]", "-print((\"Yes\" if 0 <= x - r and x + r <= W and 0 <= y - r and y + r <= H else \"No\"))", "+# encoding:utf-8", "+input = list(map(int, input().split()))", "+W, H, x, y, r = input", "+if x - r < 0 or x + r > W:", "+ print(\"No\")", "+elif y - r < 0 or y + r > H:", "+ print(\"No\")", "+else:", "+ print(\"Yes\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.354291319, "measured_runtime_v1": 0.2815986323, "runtime_lift": 1.2581428969, "key": ["s949778573", "s992404688"]} +{"user_id": "u576432509", "problem_id": "p03371", "language": "python", "submission_id_v0": "s537618501", "submission_id_v1": "s493344814", "cpu_time_v0": 215, "cpu_time_v1": 122, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.26, "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nyenmin=a*x+b*y\n\nfor zz in range(2*10**5+1):\n\n xx=max(x-zz//2,0)\n\n yy=max(y-zz//2,0)\n\n yen=a*xx+b*yy+c*zz\n\n if yen (N ** 0.5):\n\n break\n\n if N % i == 0:\n\n p = i\n\n j = N // i\n\n m = i + j - 2\n\n if m < ans:\n\n ans = m\n\n else:\n\n continue\n\n else:\n\n continue\n\nprint(ans)\n", "target": "N = int(input())\n\nans = N - 1\n\nfor i in range(2, int((N ** 0.5) + 1)):\n\n if N % i == 0:\n\n j = N // i\n\n m = i + j - 2\n\n ans = min(ans, m)\n\nprint(ans)\n", "code_v0_loc": 17, "code_v1_loc": 8, "code_v0_num_chars": 330, "code_v1_num_chars": 173, "code_v0_no_empty_lines": "N = int(input())\nans = N - 1\np = 1\nfor i in range(2, int((N**0.5) + 1)):\n if p % 2 == 1 and i > (N**0.5):\n break\n if N % i == 0:\n p = i\n j = N // i\n m = i + j - 2\n if m < ans:\n ans = m\n else:\n continue\n else:\n continue\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nans = N - 1\nfor i in range(2, int((N**0.5) + 1)):\n if N % i == 0:\n j = N // i\n m = i + j - 2\n ans = min(ans, m)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 52.9411764706, "diff": ["-p = 1", "- if p % 2 == 1 and i > (N**0.5):", "- break", "- p = i", "- if m < ans:", "- ans = m", "- else:", "- continue", "- else:", "- continue", "+ ans = min(ans, m)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3775834899, "measured_runtime_v1": 0.2214011464, "runtime_lift": 1.7054269863, "key": ["s987616882", "s695744152"]} +{"user_id": "u599547273", "problem_id": "p03494", "language": "python", "submission_id_v0": "s252753387", "submission_id_v1": "s505612116", "cpu_time_v0": 21, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.29, "input": "def two_count(x):\n\n\tif int(str(x)[-1]) % 2 == 0:\n\n\t\treturn 1 + two_count(x//2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(input())\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))", "target": "def two_count(x):\n\n\tif x % 2 == 0:\n\n\t\treturn 1 + two_count(x//2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(input())\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))", "code_v0_loc": 12, "code_v1_loc": 12, "code_v0_num_chars": 250, "code_v1_num_chars": 236, "code_v0_no_empty_lines": "def two_count(x):\n if int(str(x)[-1]) % 2 == 0:\n return 1 + two_count(x // 2)\n else:\n return 0\n\n\nn = int(input())\nn_list = [int(n) for n in input().split(\" \")]\nn_two_count_list = [two_count(n) for n in n_list]\nprint((min(n_two_count_list)))\n", "code_v1_no_empty_lines": "def two_count(x):\n if x % 2 == 0:\n return 1 + two_count(x // 2)\n else:\n return 0\n\n\nn = int(input())\nn_list = [int(n) for n in input().split(\" \")]\nn_two_count_list = [two_count(n) for n in n_list]\nprint((min(n_two_count_list)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if int(str(x)[-1]) % 2 == 0:", "+ if x % 2 == 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3392717605, "measured_runtime_v1": 0.2706325946, "runtime_lift": 1.2536249042, "key": ["s252753387", "s505612116"]} +{"user_id": "u923270446", "problem_id": "p02814", "language": "python", "submission_id_v0": "s885010221", "submission_id_v1": "s420231524", "cpu_time_v0": 220, "cpu_time_v1": 172, "memory_v0": 16320, "memory_v1": 20208, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.82, "input": "from math import gcd\n\nn, m = list(map(int, input().split()))\n\na = [int(i) // 2 for i in input().split()]\n\nx = 1\n\nfor i in range(n):\n\n x *= a[i] // gcd(x, a[i])\n\nfor i in a:\n\n if x // i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((m // x + 1) // 2))", "target": "from math import gcd, ceil\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = [i // 2 for i in a]\n\nl = 1\n\nfor i in a:\n\n l *= i // gcd(l, i)\n\nfor i in a:\n\n if l // i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint((ceil((m // l) / 2)))", "code_v0_loc": 11, "code_v1_loc": 12, "code_v0_num_chars": 259, "code_v1_num_chars": 266, "code_v0_no_empty_lines": "from math import gcd\n\nn, m = list(map(int, input().split()))\na = [int(i) // 2 for i in input().split()]\nx = 1\nfor i in range(n):\n x *= a[i] // gcd(x, a[i])\nfor i in a:\n if x // i % 2 == 0:\n print((0))\n exit()\nprint(((m // x + 1) // 2))\n", "code_v1_no_empty_lines": "from math import gcd, ceil\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = [i // 2 for i in a]\nl = 1\nfor i in a:\n l *= i // gcd(l, i)\nfor i in a:\n if l // i % 2 == 0:\n print((0))\n exit()\nprint((ceil((m // l) / 2)))\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-from math import gcd", "+from math import gcd, ceil", "-a = [int(i) // 2 for i in input().split()]", "-x = 1", "-for i in range(n):", "- x *= a[i] // gcd(x, a[i])", "+a = list(map(int, input().split()))", "+a = [i // 2 for i in a]", "+l = 1", "- if x // i % 2 == 0:", "+ l *= i // gcd(l, i)", "+for i in a:", "+ if l // i % 2 == 0:", "-print(((m // x + 1) // 2))", "+print((ceil((m // l) / 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2764406667, "measured_runtime_v1": 0.214073961, "runtime_lift": 1.2913325159, "key": ["s885010221", "s420231524"]} +{"user_id": "u780475861", "problem_id": "p03416", "language": "python", "submission_id_v0": "s789877064", "submission_id_v1": "s762526319", "cpu_time_v0": 111, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.68, "input": "a,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(a, b + 1):\n\n f = True\n\n s = str(i)\n\n l = len(s)\n\n for j in range(l//2 + 1):\n\n if s[j] != s[- j - 1]:\n\n f = False\n\n break\n\n if f:\n\n n += 1\n\nprint(n)", "target": "a,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(1, 10):\n\n for j in range(10):\n\n for k in range(10):\n\n s = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n\n if a <= s <= b:\n\n n += 1\n\nprint(n)", "code_v0_loc": 13, "code_v1_loc": 9, "code_v0_num_chars": 253, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nn = 0\nfor i in range(a, b + 1):\n f = True\n s = str(i)\n l = len(s)\n for j in range(l // 2 + 1):\n if s[j] != s[-j - 1]:\n f = False\n break\n if f:\n n += 1\nprint(n)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nn = 0\nfor i in range(1, 10):\n for j in range(10):\n for k in range(10):\n s = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n if a <= s <= b:\n n += 1\nprint(n)\n", "code_same": false, "relative_loc_diff_percent": 30.7692307692, "diff": ["-for i in range(a, b + 1):", "- f = True", "- s = str(i)", "- l = len(s)", "- for j in range(l // 2 + 1):", "- if s[j] != s[-j - 1]:", "- f = False", "- break", "- if f:", "- n += 1", "+for i in range(1, 10):", "+ for j in range(10):", "+ for k in range(10):", "+ s = 10000 * i + 1000 * j + 100 * k + 10 * j + i", "+ if a <= s <= b:", "+ n += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.319382349, "measured_runtime_v1": 0.1601409102, "runtime_lift": 1.99438325, "key": ["s789877064", "s762526319"]} +{"user_id": "u347600233", "problem_id": "p02952", "language": "python", "submission_id_v0": "s073920837", "submission_id_v1": "s426081507", "cpu_time_v0": 75, "cpu_time_v1": 58, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.67, "input": "import math\n\nn = int(input())\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if math.floor(math.log10(i) + 1) % 2:\n\n cnt += 1\n\nprint(cnt)", "target": "n = int(input())\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if len(str(i)) % 2:\n\n cnt += 1\n\nprint(cnt)", "code_v0_loc": 7, "code_v1_loc": 6, "code_v0_num_chars": 138, "code_v1_num_chars": 107, "code_v0_no_empty_lines": "import math\n\nn = int(input())\ncnt = 0\nfor i in range(1, n + 1):\n if math.floor(math.log10(i) + 1) % 2:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\ncnt = 0\nfor i in range(1, n + 1):\n if len(str(i)) % 2:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-import math", "-", "- if math.floor(math.log10(i) + 1) % 2:", "+ if len(str(i)) % 2:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3655955575, "measured_runtime_v1": 0.2850201683, "runtime_lift": 1.282700658, "key": ["s073920837", "s426081507"]} +{"user_id": "u423966555", "problem_id": "p02773", "language": "python", "submission_id_v0": "s252908207", "submission_id_v1": "s096619437", "cpu_time_v0": 859, "cpu_time_v1": 768, "memory_v0": 46080, "memory_v1": 48888, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.59, "input": "from collections import defaultdict\n\nn = int(input())\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = input()\n\n d[key] += 1\n\n\n\ndict = sorted(list(d.items()), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nfor s in dict_li:\n\n print(s)\n", "target": "from collections import defaultdict\n\nn = int(input())\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = input()\n\n d[key] += 1\n\n\n\ndict = sorted(d.items(), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nprint(*dict_li, sep='\\n')\n", "code_v0_loc": 19, "code_v1_loc": 18, "code_v0_num_chars": 354, "code_v1_num_chars": 348, "code_v0_no_empty_lines": "from collections import defaultdict\n\nn = int(input())\nd = defaultdict(int)\nfor _ in range(n):\n key = input()\n d[key] += 1\ndict = sorted(list(d.items()), key=lambda x: x[1], reverse=True)\nmax_v = max(d.values())\ndict_li = []\nfor a in dict:\n if a[1] == max_v:\n dict_li.append(a[0])\ndict_li.sort()\nfor s in dict_li:\n print(s)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nn = int(input())\nd = defaultdict(int)\nfor _ in range(n):\n key = input()\n d[key] += 1\ndict = sorted(d.items(), key=lambda x: x[1], reverse=True)\nmax_v = max(d.values())\ndict_li = []\nfor a in dict:\n if a[1] == max_v:\n dict_li.append(a[0])\ndict_li.sort()\nprint(*dict_li, sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 5.2631578947, "diff": ["-n = int(input())", "+n = int(input())", "- key = input()", "+ key = input()", "-dict = sorted(list(d.items()), key=lambda x: x[1], reverse=True)", "+dict = sorted(d.items(), key=lambda x: x[1], reverse=True)", "-for s in dict_li:", "- print(s)", "+print(*dict_li, sep=\"\\n\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2625157752, "measured_runtime_v1": 0.2092528682, "runtime_lift": 1.2545384801, "key": ["s252908207", "s096619437"]} +{"user_id": "u867826040", "problem_id": "p03721", "language": "python", "submission_id_v0": "s719602965", "submission_id_v1": "s173376033", "cpu_time_v0": 194, "cpu_time_v1": 151, "memory_v0": 76876, "memory_v1": 16524, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.16, "input": "n,k = list(map(int,input().split()))\n\nl = [0]*(10**5+1)\n\nfor i in range(n):\n\n ai,bi = list(map(int,input().split()))\n\n l[ai]+=bi\n\nfor index,i in enumerate(l):\n\n if i:\n\n k-=i\n\n if k<=0:\n\n break\n\nprint(index)", "target": "from collections import defaultdict\n\nfrom sys import stdin\n\ninput = stdin.readline\n\nd = defaultdict(int)\n\nn,k = list(map(int,input().split()))\n\nfor _ in range(n):\n\n a,b = list(map(int,input().split()))\n\n d[a]+=b\n\nfor key in sorted(d.keys()):\n\n v = d[key]\n\n k-=v\n\n if k <= 0:\n\n break\n\nprint(key)", "code_v0_loc": 11, "code_v1_loc": 14, "code_v0_num_chars": 228, "code_v1_num_chars": 304, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\nl = [0] * (10**5 + 1)\nfor i in range(n):\n ai, bi = list(map(int, input().split()))\n l[ai] += bi\nfor index, i in enumerate(l):\n if i:\n k -= i\n if k <= 0:\n break\nprint(index)\n", "code_v1_no_empty_lines": "from collections import defaultdict\nfrom sys import stdin\n\ninput = stdin.readline\nd = defaultdict(int)\nn, k = list(map(int, input().split()))\nfor _ in range(n):\n a, b = list(map(int, input().split()))\n d[a] += b\nfor key in sorted(d.keys()):\n v = d[key]\n k -= v\n if k <= 0:\n break\nprint(key)\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["+from collections import defaultdict", "+from sys import stdin", "+", "+input = stdin.readline", "+d = defaultdict(int)", "-l = [0] * (10**5 + 1)", "-for i in range(n):", "- ai, bi = list(map(int, input().split()))", "- l[ai] += bi", "-for index, i in enumerate(l):", "- if i:", "- k -= i", "- if k <= 0:", "- break", "-print(index)", "+for _ in range(n):", "+ a, b = list(map(int, input().split()))", "+ d[a] += b", "+for key in sorted(d.keys()):", "+ v = d[key]", "+ k -= v", "+ if k <= 0:", "+ break", "+print(key)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5501943195, "measured_runtime_v1": 0.4111647634, "runtime_lift": 1.3381358727, "key": ["s719602965", "s173376033"]} +{"user_id": "u271934630", "problem_id": "p03416", "language": "python", "submission_id_v0": "s986292698", "submission_id_v1": "s820058882", "cpu_time_v0": 225, "cpu_time_v1": 186, "memory_v0": 40684, "memory_v1": 40300, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.33, "input": "A, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = list(str(i))\n\n\n\n if l == list(reversed(l)):\n\n cnt += 1\n\n\n\nprint(cnt)\n", "target": "A, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = str(i)\n\n if l == l[::-1]:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 155, "code_v1_num_chars": 137, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor i in range(A, B + 1):\n l = list(str(i))\n if l == list(reversed(l)):\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor i in range(A, B + 1):\n l = str(i)\n if l == l[::-1]:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- l = list(str(i))", "- if l == list(reversed(l)):", "+ l = str(i)", "+ if l == l[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3457211592, "measured_runtime_v1": 0.2683477015, "runtime_lift": 1.2883328503, "key": ["s986292698", "s820058882"]} +{"user_id": "u761320129", "problem_id": "p02792", "language": "python", "submission_id_v0": "s858070624", "submission_id_v1": "s144947075", "cpu_time_v0": 459, "cpu_time_v1": 184, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.91, "input": "N = int(input())\n\nmem = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)", "target": "N = int(input())\n\n\n\nd = [[0]*10 for i in range(10)]\n\nfor n in range(1,N+1):\n\n s = str(n)\n\n d[int(s[0])][int(s[-1])] += 1\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += d[i][j] * d[j][i]\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 264, "code_v1_num_chars": 227, "code_v0_no_empty_lines": "N = int(input())\nmem = [[0] * 10 for i in range(10)]\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n mem[a][b] += 1\nans = 0\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n ans += mem[b][a]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nd = [[0] * 10 for i in range(10)]\nfor n in range(1, N + 1):\n s = str(n)\n d[int(s[0])][int(s[-1])] += 1\nans = 0\nfor i in range(10):\n for j in range(10):\n ans += d[i][j] * d[j][i]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-mem = [[0] * 10 for i in range(10)]", "-for i in range(1, N + 1):", "- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- mem[a][b] += 1", "+d = [[0] * 10 for i in range(10)]", "+for n in range(1, N + 1):", "+ s = str(n)", "+ d[int(s[0])][int(s[-1])] += 1", "-for i in range(1, N + 1):", "- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- ans += mem[b][a]", "+for i in range(10):", "+ for j in range(10):", "+ ans += d[i][j] * d[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4986082915, "measured_runtime_v1": 0.3140420772, "runtime_lift": 1.5877117355, "key": ["s858070624", "s144947075"]} +{"user_id": "u790012205", "problem_id": "p03796", "language": "python", "submission_id_v0": "s234232673", "submission_id_v1": "s468100683", "cpu_time_v0": 175, "cpu_time_v1": 49, "memory_v0": 38512, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.0, "input": "N = int(input())\n\np = 1\n\nfor i in range(N):\n\n p *= (i + 1)\n\n p %= (1e9 + 7)\n\nprint((int(p)))", "target": "N = int(input())\n\np = 1\n\nfor i in range(N):\n\n p = p * (i + 1) % (1e9 + 7)\n\nprint((int(p)))", "code_v0_loc": 6, "code_v1_loc": 5, "code_v0_num_chars": 96, "code_v1_num_chars": 91, "code_v0_no_empty_lines": "N = int(input())\np = 1\nfor i in range(N):\n p *= i + 1\n p %= 1e9 + 7\nprint((int(p)))\n", "code_v1_no_empty_lines": "N = int(input())\np = 1\nfor i in range(N):\n p = p * (i + 1) % (1e9 + 7)\nprint((int(p)))\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["- p *= i + 1", "- p %= 1e9 + 7", "+ p = p * (i + 1) % (1e9 + 7)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4166263335, "measured_runtime_v1": 0.2939343722, "runtime_lift": 1.4174127727, "key": ["s234232673", "s468100683"]} +{"user_id": "u771634798", "problem_id": "p02725", "language": "python", "submission_id_v0": "s591694965", "submission_id_v1": "s705639429", "cpu_time_v0": 110, "cpu_time_v1": 85, "memory_v0": 32148, "memory_v1": 32380, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.73, "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\ndiff = []\n\n\n\nfor i in range(n - 1):\n\n diff.append(a[i + 1] - a[i])\n\ndiff.append(k - a[-1] + a[0])\n\n\n\nprint((k - max(diff)))\n", "target": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\na.append(k + a[0])\n\ndiff = [a1 - a0 for a0, a1 in zip(a, a[1:])]\n\n\n\nprint((k - max(diff)))\n", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 198, "code_v1_num_chars": 162, "code_v0_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\ndiff = []\nfor i in range(n - 1):\n diff.append(a[i + 1] - a[i])\ndiff.append(k - a[-1] + a[0])\nprint((k - max(diff)))\n", "code_v1_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(k + a[0])\ndiff = [a1 - a0 for a0, a1 in zip(a, a[1:])]\nprint((k - max(diff)))\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-diff = []", "-for i in range(n - 1):", "- diff.append(a[i + 1] - a[i])", "-diff.append(k - a[-1] + a[0])", "+a.append(k + a[0])", "+diff = [a1 - a0 for a0, a1 in zip(a, a[1:])]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3387992765, "measured_runtime_v1": 0.2554280306, "runtime_lift": 1.3263981864, "key": ["s591694965", "s705639429"]} +{"user_id": "u562935282", "problem_id": "p03371", "language": "python", "submission_id_v0": "s950527789", "submission_id_v1": "s848046688", "cpu_time_v0": 119, "cpu_time_v1": 19, "memory_v0": 3060, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.03, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nval = float('inf')\n\nfor k in range(10 ** 5 + 1):\n\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\n\nprint(val)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 0\n\nans += min(A + B, 2 * C) * min(X, Y)\n\nif X > Y:\n\n ans += min(A, 2 * C) * (X - Y)\n\nelif X < Y:\n\n ans += min(B, 2 * C) * (Y - X)\n\nprint(ans)\n", "code_v0_loc": 5, "code_v1_loc": 9, "code_v0_num_chars": 174, "code_v1_num_chars": 199, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nval = float(\"inf\")\nfor k in range(10**5 + 1):\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\nprint(val)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = 0\nans += min(A + B, 2 * C) * min(X, Y)\nif X > Y:\n ans += min(A, 2 * C) * (X - Y)\nelif X < Y:\n ans += min(B, 2 * C) * (Y - X)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-a, b, c, x, y = list(map(int, input().split()))", "-val = float(\"inf\")", "-for k in range(10**5 + 1):", "- val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)", "-print(val)", "+A, B, C, X, Y = list(map(int, input().split()))", "+ans = 0", "+ans += min(A + B, 2 * C) * min(X, Y)", "+if X > Y:", "+ ans += min(A, 2 * C) * (X - Y)", "+elif X < Y:", "+ ans += min(B, 2 * C) * (Y - X)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3470396991, "measured_runtime_v1": 0.2883047278, "runtime_lift": 4.6722775216, "key": ["s950527789", "s848046688"]} +{"user_id": "u869919400", "problem_id": "p03796", "language": "python", "submission_id_v0": "s127994042", "submission_id_v1": "s163960956", "cpu_time_v0": 229, "cpu_time_v1": 37, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.84, "input": "from math import factorial as f\n\nn = int(input())\n\nprint((f(n) % (10 ** 9 + 7)))", "target": "n = int(input())\n\np = 1\n\nfor i in range(n):\n\n p = (p * (i+1)) % (10 ** 9 + 7)\n\nprint(p)", "code_v0_loc": 3, "code_v1_loc": 5, "code_v0_num_chars": 78, "code_v1_num_chars": 90, "code_v0_no_empty_lines": "from math import factorial as f\n\nn = int(input())\nprint((f(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\np = 1\nfor i in range(n):\n p = (p * (i + 1)) % (10**9 + 7)\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-from math import factorial as f", "-", "-print((f(n) % (10**9 + 7)))", "+p = 1", "+for i in range(n):", "+ p = (p * (i + 1)) % (10**9 + 7)", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8111317687, "measured_runtime_v1": 0.3589184887, "runtime_lift": 2.2599330882, "key": ["s127994042", "s163960956"]} +{"user_id": "u617203831", "problem_id": "p03796", "language": "python", "submission_id_v0": "s015060265", "submission_id_v1": "s192076282", "cpu_time_v0": 230, "cpu_time_v1": 40, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.61, "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "target": "ans=1\n\nn=int(input())\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 6, "code_v0_num_chars": 58, "code_v1_num_chars": 88, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nn = int(input())\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % (10**9 + 7)))", "+ans = 1", "+n = int(input())", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans = ans % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7955839839, "measured_runtime_v1": 0.4261377716, "runtime_lift": 1.866964247, "key": ["s015060265", "s192076282"]} +{"user_id": "u844789719", "problem_id": "p03371", "language": "python", "submission_id_v0": "s272710522", "submission_id_v1": "s867287513", "cpu_time_v0": 94, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.91, "input": "A, B, C, X, Y = [int(_) for _ in input().split()]\n\nans = A * X + B * Y\n\nfor i in range(max(X, Y) + 1):\n\n cost = 2 * C * i\n\n if X > i:\n\n cost += A * (X - i)\n\n if Y > i:\n\n cost += B * (Y - i)\n\n ans = min(ans, cost)\n\nprint(ans)", "target": "A, B, C, X, Y = [int(_) for _ in input().split()]\n\nM = max(X, Y)\n\nprint((min(2 * C * M, 2 * C * (X + Y - M) + A *\n\n (M - Y) + B * (M - X), A * X + B * Y)))\n", "code_v0_loc": 10, "code_v1_loc": 4, "code_v0_num_chars": 250, "code_v1_num_chars": 163, "code_v0_no_empty_lines": "A, B, C, X, Y = [int(_) for _ in input().split()]\nans = A * X + B * Y\nfor i in range(max(X, Y) + 1):\n cost = 2 * C * i\n if X > i:\n cost += A * (X - i)\n if Y > i:\n cost += B * (Y - i)\n ans = min(ans, cost)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = [int(_) for _ in input().split()]\nM = max(X, Y)\nprint((min(2 * C * M, 2 * C * (X + Y - M) + A * (M - Y) + B * (M - X), A * X + B * Y)))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-ans = A * X + B * Y", "-for i in range(max(X, Y) + 1):", "- cost = 2 * C * i", "- if X > i:", "- cost += A * (X - i)", "- if Y > i:", "- cost += B * (Y - i)", "- ans = min(ans, cost)", "-print(ans)", "+M = max(X, Y)", "+print((min(2 * C * M, 2 * C * (X + Y - M) + A * (M - Y) + B * (M - X), A * X + B * Y)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5275072498, "measured_runtime_v1": 0.332789422, "runtime_lift": 1.5851082243, "key": ["s272710522", "s867287513"]} +{"user_id": "u691018832", "problem_id": "p03945", "language": "python", "submission_id_v0": "s808413359", "submission_id_v1": "s766599872", "cpu_time_v0": 84, "cpu_time_v1": 46, "memory_v0": 3188, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.24, "input": "s = input()\n\nlen_s = len(s)\n\ncnt = [0, 0]\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n memo_1 = s[len_s - i]\n\n if s[i] != memo_0:\n\n cnt[0] += 1\n\n if s[len_s - i - 1] != memo_1:\n\n cnt[1] += 1\n\nprint((min(cnt)))\n", "target": "s = input()\n\nlen_s = len(s)\n\ncnt = 0\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n if s[i] != memo_0:\n\n cnt += 1\n\nprint(cnt)\n", "code_v0_loc": 11, "code_v1_loc": 8, "code_v0_num_chars": 239, "code_v1_num_chars": 142, "code_v0_no_empty_lines": "s = input()\nlen_s = len(s)\ncnt = [0, 0]\nfor i in range(1, len(s)):\n memo_0 = s[i - 1]\n memo_1 = s[len_s - i]\n if s[i] != memo_0:\n cnt[0] += 1\n if s[len_s - i - 1] != memo_1:\n cnt[1] += 1\nprint((min(cnt)))\n", "code_v1_no_empty_lines": "s = input()\nlen_s = len(s)\ncnt = 0\nfor i in range(1, len(s)):\n memo_0 = s[i - 1]\n if s[i] != memo_0:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["-cnt = [0, 0]", "+cnt = 0", "- memo_1 = s[len_s - i]", "- cnt[0] += 1", "- if s[len_s - i - 1] != memo_1:", "- cnt[1] += 1", "-print((min(cnt)))", "+ cnt += 1", "+print(cnt)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3379861441, "measured_runtime_v1": 0.264947257, "runtime_lift": 1.2756733088, "key": ["s808413359", "s766599872"]} +{"user_id": "u562016607", "problem_id": "p03558", "language": "python", "submission_id_v0": "s159640382", "submission_id_v1": "s651180421", "cpu_time_v0": 376, "cpu_time_v1": 167, "memory_v0": 8948, "memory_v1": 6060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.59, "input": "import heapq\n\nK=int(input())\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=[]\n\nheapq.heappush(q,(0,1))\n\nwhile (len(q)!=0):\n\n prc,src=heapq.heappop(q)\n\n if dist[src]dist[src]+1:\n\n dist[(src+1)%K]=dist[src]+1\n\n heapq.heappush(q,(dist[(src+1)%K],(src+1)%K))\n\n if dist[(10*src)%K]>dist[src]:\n\n dist[(10*src)%K]=dist[src]\n\n heapq.heappush(q,(dist[(src*10)%K],(src*10)%K))\n\nprint((dist[0]))\n", "target": "from collections import deque\n\nK=int(input())\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=deque([1])\n\nwhile(len(q)>0):\n\n r=q.popleft()\n\n s=(r+1)%K\n\n if dist[r]+1 dist[src] + 1:\n dist[(src + 1) % K] = dist[src] + 1\n heapq.heappush(q, (dist[(src + 1) % K], (src + 1) % K))\n if dist[(10 * src) % K] > dist[src]:\n dist[(10 * src) % K] = dist[src]\n heapq.heappush(q, (dist[(src * 10) % K], (src * 10) % K))\nprint((dist[0]))\n", "code_v1_no_empty_lines": "from collections import deque\n\nK = int(input())\ndist = [10**15 for i in range(K)]\ndist[1] = 1\nq = deque([1])\nwhile len(q) > 0:\n r = q.popleft()\n s = (r + 1) % K\n if dist[r] + 1 < dist[s]:\n dist[s] = dist[r] + 1\n q.append(s)\n t = (r * 10) % K\n if dist[r] < dist[t]:\n dist[t] = dist[r]\n q.appendleft(t)\nprint((dist[0]))\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-import heapq", "+from collections import deque", "-q = []", "-heapq.heappush(q, (0, 1))", "-while len(q) != 0:", "- prc, src = heapq.heappop(q)", "- if dist[src] < prc:", "- continue", "- if dist[(src + 1) % K] > dist[src] + 1:", "- dist[(src + 1) % K] = dist[src] + 1", "- heapq.heappush(q, (dist[(src + 1) % K], (src + 1) % K))", "- if dist[(10 * src) % K] > dist[src]:", "- dist[(10 * src) % K] = dist[src]", "- heapq.heappush(q, (dist[(src * 10) % K], (src * 10) % K))", "+q = deque([1])", "+while len(q) > 0:", "+ r = q.popleft()", "+ s = (r + 1) % K", "+ if dist[r] + 1 < dist[s]:", "+ dist[s] = dist[r] + 1", "+ q.append(s)", "+ t = (r * 10) % K", "+ if dist[r] < dist[t]:", "+ dist[t] = dist[r]", "+ q.appendleft(t)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4453229659, "measured_runtime_v1": 0.2901842129, "runtime_lift": 1.5346216162, "key": ["s159640382", "s651180421"]} +{"user_id": "u287132915", "problem_id": "p02792", "language": "python", "submission_id_v0": "s161079550", "submission_id_v1": "s476355973", "cpu_time_v0": 369, "cpu_time_v1": 198, "memory_v0": 46468, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.34, "input": "n = int(input())\n\n\n\ncnt = 0\n\nfor i in range(1, n+1):\n\n i_str = str(i)\n\n if len(i_str) == 1:\n\n cnt += 1\n\n continue\n\n if len(i_str) == 2:\n\n if int(i_str[0]) == int(i_str[1]):\n\n cnt += 3\n\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 3:\n\n if int(i_str[0]) == int(i_str[2]):\n\n cnt += 4 + (2 * (int(i_str[1])+1) - 1)\n\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n\n cnt += 22\n\n elif int(i_str[0]) < int(i_str[2]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 4:\n\n if int(i_str[0]) == int(i_str[3]):\n\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2])+1) - 1\n\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n\n cnt += 222\n\n elif int(i_str[0]) < int(i_str[3]):\n\n cnt += 22\n\n continue\n\n if len(i_str) == 5:\n\n if int(i_str[0]) == int(i_str[4]):\n\n cnt += 224 + 200 * int(i_str[1]) + 20 * int(i_str[2]) + 2 * (int(i_str[3])+1) - 1\n\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n\n cnt += 2222\n\n elif int(i_str[0]) < int(i_str[4]):\n\n cnt += 222\n\n continue\n\n if len(i_str) == 6:\n\n if int(i_str[0]) == int(i_str[5]):\n\n cnt += 2224 + 2000 * int(i_str[1]) + 200 * int(i_str[2]) + 20 * int(i_str[3]) + 2 * (int(i_str[4])+1) - 1\n\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n\n cnt += 22222\n\n elif int(i_str[0]) < int(i_str[5]):\n\n cnt += 2222\n\n continue\n\n\n\nprint(cnt)", "target": "n = int(input())\n\n\n\nc = [[0 for _ in range(10)] for __ in range(10)]\n\nfor i in range(1, n+1):\n\n str_i = str(i)\n\n head = int(str_i[0])\n\n tail = int(str_i[-1])\n\n c[head][tail] += 1\n\n\n\ncnt = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n cnt += c[i][j] * c[j][i]\n\n\n\nprint(cnt)", "code_v0_loc": 48, "code_v1_loc": 15, "code_v0_num_chars": 1676, "code_v1_num_chars": 295, "code_v0_no_empty_lines": "n = int(input())\ncnt = 0\nfor i in range(1, n + 1):\n i_str = str(i)\n if len(i_str) == 1:\n cnt += 1\n continue\n if len(i_str) == 2:\n if int(i_str[0]) == int(i_str[1]):\n cnt += 3\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n cnt += 2\n continue\n if len(i_str) == 3:\n if int(i_str[0]) == int(i_str[2]):\n cnt += 4 + (2 * (int(i_str[1]) + 1) - 1)\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n cnt += 22\n elif int(i_str[0]) < int(i_str[2]):\n cnt += 2\n continue\n if len(i_str) == 4:\n if int(i_str[0]) == int(i_str[3]):\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2]) + 1) - 1\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n cnt += 222\n elif int(i_str[0]) < int(i_str[3]):\n cnt += 22\n continue\n if len(i_str) == 5:\n if int(i_str[0]) == int(i_str[4]):\n cnt += (\n 224\n + 200 * int(i_str[1])\n + 20 * int(i_str[2])\n + 2 * (int(i_str[3]) + 1)\n - 1\n )\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n cnt += 2222\n elif int(i_str[0]) < int(i_str[4]):\n cnt += 222\n continue\n if len(i_str) == 6:\n if int(i_str[0]) == int(i_str[5]):\n cnt += (\n 2224\n + 2000 * int(i_str[1])\n + 200 * int(i_str[2])\n + 20 * int(i_str[3])\n + 2 * (int(i_str[4]) + 1)\n - 1\n )\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n cnt += 22222\n elif int(i_str[0]) < int(i_str[5]):\n cnt += 2222\n continue\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\nc = [[0 for _ in range(10)] for __ in range(10)]\nfor i in range(1, n + 1):\n str_i = str(i)\n head = int(str_i[0])\n tail = int(str_i[-1])\n c[head][tail] += 1\ncnt = 0\nfor i in range(10):\n for j in range(10):\n cnt += c[i][j] * c[j][i]\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 68.75, "diff": ["+c = [[0 for _ in range(10)] for __ in range(10)]", "+for i in range(1, n + 1):", "+ str_i = str(i)", "+ head = int(str_i[0])", "+ tail = int(str_i[-1])", "+ c[head][tail] += 1", "-for i in range(1, n + 1):", "- i_str = str(i)", "- if len(i_str) == 1:", "- cnt += 1", "- continue", "- if len(i_str) == 2:", "- if int(i_str[0]) == int(i_str[1]):", "- cnt += 3", "- elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):", "- cnt += 2", "- continue", "- if len(i_str) == 3:", "- if int(i_str[0]) == int(i_str[2]):", "- cnt += 4 + (2 * (int(i_str[1]) + 1) - 1)", "- elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):", "- cnt += 22", "- elif int(i_str[0]) < int(i_str[2]):", "- cnt += 2", "- continue", "- if len(i_str) == 4:", "- if int(i_str[0]) == int(i_str[3]):", "- cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2]) + 1) - 1", "- elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):", "- cnt += 222", "- elif int(i_str[0]) < int(i_str[3]):", "- cnt += 22", "- continue", "- if len(i_str) == 5:", "- if int(i_str[0]) == int(i_str[4]):", "- cnt += (", "- 224", "- + 200 * int(i_str[1])", "- + 20 * int(i_str[2])", "- + 2 * (int(i_str[3]) + 1)", "- - 1", "- )", "- elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):", "- cnt += 2222", "- elif int(i_str[0]) < int(i_str[4]):", "- cnt += 222", "- continue", "- if len(i_str) == 6:", "- if int(i_str[0]) == int(i_str[5]):", "- cnt += (", "- 2224", "- + 2000 * int(i_str[1])", "- + 200 * int(i_str[2])", "- + 20 * int(i_str[3])", "- + 2 * (int(i_str[4]) + 1)", "- - 1", "- )", "- elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):", "- cnt += 22222", "- elif int(i_str[0]) < int(i_str[5]):", "- cnt += 2222", "- continue", "+for i in range(10):", "+ for j in range(10):", "+ cnt += c[i][j] * c[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.528624272, "measured_runtime_v1": 0.3498814137, "runtime_lift": 1.5108669718, "key": ["s161079550", "s476355973"]} +{"user_id": "u285681431", "problem_id": "p03796", "language": "python", "submission_id_v0": "s922366861", "submission_id_v1": "s031671477", "cpu_time_v0": 154, "cpu_time_v1": 82, "memory_v0": 9940, "memory_v1": 62860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.75, "input": "import math\n\n\n\nN = int(input())\n\nans = math.factorial(N) % (10**9 + 7)\n\nprint(ans)", "target": "N = int(input())\n\nmod = 10**9 + 7\n\nans = 1\n\nfor i in range(1, N + 1):\n\n ans *= i\n\n ans %= mod\n\nprint(ans)\n", "code_v0_loc": 5, "code_v1_loc": 7, "code_v0_num_chars": 82, "code_v1_num_chars": 112, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nmod = 10**9 + 7\nans = 1\nfor i in range(1, N + 1):\n ans *= i\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-import math", "-", "-ans = math.factorial(N) % (10**9 + 7)", "+mod = 10**9 + 7", "+ans = 1", "+for i in range(1, N + 1):", "+ ans *= i", "+ ans %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.599384095, "measured_runtime_v1": 0.2730524833, "runtime_lift": 2.1951241301, "key": ["s922366861", "s031671477"]} +{"user_id": "u170201762", "problem_id": "p03371", "language": "python", "submission_id_v0": "s850530798", "submission_id_v1": "s933367975", "cpu_time_v0": 94, "cpu_time_v1": 18, "memory_v0": 7096, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.85, "input": "A,B,C,X,Y = list(map(int,input().split()))\n\nl = []\n\nfor i in range(max(X,Y)+1):\n\n T = i * C * 2\n\n if i < X: \n\n T += (X-i)*A\n\n if i < Y:\n\n T += (Y-i)*B\n\n l.append(T)\n\nl.sort()\n\nprint((l[0]))", "target": "A,B,C,X,Y = list(map(int,input().split()))\n\nans = 0\n\nif 2*C <= A+B:\n\n Z = min(X,Y)\n\n ans = 2*C*Z\n\n X -= Z\n\n Y -= Z\n\nans += min(2*C*X,A*X)\n\nans += min(2*C*Y,B*Y)\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 207, "code_v1_num_chars": 178, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nl = []\nfor i in range(max(X, Y) + 1):\n T = i * C * 2\n if i < X:\n T += (X - i) * A\n if i < Y:\n T += (Y - i) * B\n l.append(T)\nl.sort()\nprint((l[0]))\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = 0\nif 2 * C <= A + B:\n Z = min(X, Y)\n ans = 2 * C * Z\n X -= Z\n Y -= Z\nans += min(2 * C * X, A * X)\nans += min(2 * C * Y, B * Y)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-l = []", "-for i in range(max(X, Y) + 1):", "- T = i * C * 2", "- if i < X:", "- T += (X - i) * A", "- if i < Y:", "- T += (Y - i) * B", "- l.append(T)", "-l.sort()", "-print((l[0]))", "+ans = 0", "+if 2 * C <= A + B:", "+ Z = min(X, Y)", "+ ans = 2 * C * Z", "+ X -= Z", "+ Y -= Z", "+ans += min(2 * C * X, A * X)", "+ans += min(2 * C * Y, B * Y)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.290536653, "measured_runtime_v1": 0.1943999538, "runtime_lift": 1.494530463, "key": ["s850530798", "s933367975"]} +{"user_id": "u708211626", "problem_id": "p04012", "language": "python", "submission_id_v0": "s951351679", "submission_id_v1": "s246688975", "cpu_time_v0": 32, "cpu_time_v1": 26, "memory_v0": 9372, "memory_v1": 9000, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.75, "input": "import collections\n\nimport sys\n\na=input()\n\nb=[]\n\n\n\nfor i in a:\n\n b.append(i)\n\n \n\nb.sort()\n\nc=collections.Counter(b)\n\nc=list(c.values())\n\n\n\nfor i in range(len(c)):\n\n if int(c[i])%2==0:\n\n q=0\n\n else:\n\n q=1\n\n print('No')\n\n sys.exit()\n\n \n\nprint('Yes')\n", "target": "w = list(input())\n\ns = set(w)\n\nfor i in s:\n\n if w.count(i)%2 != 0:\n\n print(\"No\")\n\n break\n\nelse:\n\n print(\"Yes\")\n\n ", "code_v0_loc": 21, "code_v1_loc": 9, "code_v0_num_chars": 267, "code_v1_num_chars": 122, "code_v0_no_empty_lines": "import collections\nimport sys\n\na = input()\nb = []\nfor i in a:\n b.append(i)\nb.sort()\nc = collections.Counter(b)\nc = list(c.values())\nfor i in range(len(c)):\n if int(c[i]) % 2 == 0:\n q = 0\n else:\n q = 1\n print(\"No\")\n sys.exit()\nprint(\"Yes\")\n", "code_v1_no_empty_lines": "w = list(input())\ns = set(w)\nfor i in s:\n if w.count(i) % 2 != 0:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-import collections", "-import sys", "-", "-a = input()", "-b = []", "-for i in a:", "- b.append(i)", "-b.sort()", "-c = collections.Counter(b)", "-c = list(c.values())", "-for i in range(len(c)):", "- if int(c[i]) % 2 == 0:", "- q = 0", "- else:", "- q = 1", "+w = list(input())", "+s = set(w)", "+for i in s:", "+ if w.count(i) % 2 != 0:", "- sys.exit()", "-print(\"Yes\")", "+ break", "+else:", "+ print(\"Yes\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2393270415, "measured_runtime_v1": 0.1892163638, "runtime_lift": 1.2648326847, "key": ["s951351679", "s246688975"]} +{"user_id": "u379959788", "problem_id": "p03835", "language": "python", "submission_id_v0": "s258964318", "submission_id_v1": "s303783261", "cpu_time_v0": 1751, "cpu_time_v1": 1557, "memory_v0": 2940, "memory_v1": 3444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.08, "input": "#ABC951B/Sum_of_Three_Integers\n\n\n\nK, S = list(map(int, input().split()))\n\nans = 0\n\nfor x in range(0, K+1):\n\n for y in range(0, K+1):\n\n z = S - x - y\n\n if 0 <= z and z <= K:\n\n ans += 1\n\nprint(ans)", "target": "K, S = list(map(int, input().split()))\n\nans = 0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z = S - X - Y\n\n if Z >= 0 and Z <= K:\n\n ans += 1\n\nprint(ans) ", "code_v0_loc": 10, "code_v1_loc": 8, "code_v0_num_chars": 217, "code_v1_num_chars": 184, "code_v0_no_empty_lines": "# ABC951B/Sum_of_Three_Integers\nK, S = list(map(int, input().split()))\nans = 0\nfor x in range(0, K + 1):\n for y in range(0, K + 1):\n z = S - x - y\n if 0 <= z and z <= K:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "K, S = list(map(int, input().split()))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if Z >= 0 and Z <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-# ABC951B/Sum_of_Three_Integers", "-for x in range(0, K + 1):", "- for y in range(0, K + 1):", "- z = S - x - y", "- if 0 <= z and z <= K:", "+for X in range(K + 1):", "+ for Y in range(K + 1):", "+ Z = S - X - Y", "+ if Z >= 0 and Z <= K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2646004359, "measured_runtime_v1": 0.0728798735, "runtime_lift": 3.6306379676, "key": ["s258964318", "s303783261"]} +{"user_id": "u150984829", "problem_id": "p02276", "language": "python", "submission_id_v0": "s439916574", "submission_id_v1": "s927428389", "cpu_time_v0": 80, "cpu_time_v1": 60, "memory_v0": 16392, "memory_v1": 16388, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "n=int(input())-1\n\nA=list(map(int,input().split()))\n\ni=0\n\nfor j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\nA[i],A[n]=A[n],A[i]\n\nprint((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n", "target": "def s():\n\n n=int(input())-1\n\n A=list(map(int,input().split()))\n\n i=0\n\n for j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\n A[i],A[n]=A[n],A[i]\n\n print((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n\nif'__main__'==__name__:s()\n", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 219, "code_v1_num_chars": 264, "code_v0_no_empty_lines": "n = int(input()) - 1\nA = list(map(int, input().split()))\ni = 0\nfor j in range(n):\n if A[j] <= A[-1]:\n A[i], A[j] = A[j], A[i]\n i += 1\nA[i], A[n] = A[n], A[i]\nprint(\n (\n \" \".join(map(str, A[:i]))\n + \" [\"\n + str(A[i])\n + \"] \"\n + \" \".join(map(str, A[i + 1 :]))\n )\n)\n", "code_v1_no_empty_lines": "def s():\n n = int(input()) - 1\n A = list(map(int, input().split()))\n i = 0\n for j in range(n):\n if A[j] <= A[-1]:\n A[i], A[j] = A[j], A[i]\n i += 1\n A[i], A[n] = A[n], A[i]\n print(\n (\n \" \".join(map(str, A[:i]))\n + \" [\"\n + str(A[i])\n + \"] \"\n + \" \".join(map(str, A[i + 1 :]))\n )\n )\n\n\nif \"__main__\" == __name__:\n s()\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-n = int(input()) - 1", "-A = list(map(int, input().split()))", "-i = 0", "-for j in range(n):", "- if A[j] <= A[-1]:", "- A[i], A[j] = A[j], A[i]", "- i += 1", "-A[i], A[n] = A[n], A[i]", "-print(", "- (", "- \" \".join(map(str, A[:i]))", "- + \" [\"", "- + str(A[i])", "- + \"] \"", "- + \" \".join(map(str, A[i + 1 :]))", "+def s():", "+ n = int(input()) - 1", "+ A = list(map(int, input().split()))", "+ i = 0", "+ for j in range(n):", "+ if A[j] <= A[-1]:", "+ A[i], A[j] = A[j], A[i]", "+ i += 1", "+ A[i], A[n] = A[n], A[i]", "+ print(", "+ (", "+ \" \".join(map(str, A[:i]))", "+ + \" [\"", "+ + str(A[i])", "+ + \"] \"", "+ + \" \".join(map(str, A[i + 1 :]))", "+ )", "-)", "+", "+", "+if \"__main__\" == __name__:", "+ s()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2844968953, "measured_runtime_v1": 0.0927553341, "runtime_lift": 3.0671755746, "key": ["s439916574", "s927428389"]} +{"user_id": "u580404776", "problem_id": "p02792", "language": "python", "submission_id_v0": "s545080507", "submission_id_v1": "s376438645", "cpu_time_v0": 492, "cpu_time_v1": 192, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.98, "input": "N = int(input())\n\nmem = [[0]*10 for _ in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)\n", "target": "N = int(input())\n\nmem=[[0] * 10 for _ in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n mem[int(s[0])][int(s[-1])] += 1 \n\n \n\nans = 0\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += mem[i][j] * mem[j][i]\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 265, "code_v1_num_chars": 249, "code_v0_no_empty_lines": "N = int(input())\nmem = [[0] * 10 for _ in range(10)]\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n mem[a][b] += 1\nans = 0\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n ans += mem[b][a]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nmem = [[0] * 10 for _ in range(10)]\nfor i in range(1, N + 1):\n s = str(i)\n mem[int(s[0])][int(s[-1])] += 1\nans = 0\nfor i in range(1, 10):\n for j in range(1, 10):\n ans += mem[i][j] * mem[j][i]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- mem[a][b] += 1", "+ s = str(i)", "+ mem[int(s[0])][int(s[-1])] += 1", "-for i in range(1, N + 1):", "- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- ans += mem[b][a]", "+for i in range(1, 10):", "+ for j in range(1, 10):", "+ ans += mem[i][j] * mem[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4534644659, "measured_runtime_v1": 0.3052516449, "runtime_lift": 1.4855430706, "key": ["s545080507", "s376438645"]} +{"user_id": "u107077660", "problem_id": "p04012", "language": "python", "submission_id_v0": "s204906128", "submission_id_v1": "s764910207", "cpu_time_v0": 38, "cpu_time_v1": 29, "memory_v0": 3064, "memory_v1": 3444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.68, "input": "w = input()\n\nfor l in w:\n\n\tif w.count(l) % 2 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")", "target": "from collections import Counter\n\ns = input()\n\nc = list(Counter(s).values())\n\nfor n in c:\n\n\tif n & 1 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")\n\n\n", "code_v0_loc": 7, "code_v1_loc": 10, "code_v0_num_chars": 96, "code_v1_num_chars": 148, "code_v0_no_empty_lines": "w = input()\nfor l in w:\n if w.count(l) % 2 == 1:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_v1_no_empty_lines": "from collections import Counter\n\ns = input()\nc = list(Counter(s).values())\nfor n in c:\n if n & 1 == 1:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-w = input()", "-for l in w:", "- if w.count(l) % 2 == 1:", "+from collections import Counter", "+", "+s = input()", "+c = list(Counter(s).values())", "+for n in c:", "+ if n & 1 == 1:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3070713311, "measured_runtime_v1": 0.212444066, "runtime_lift": 1.44542202, "key": ["s204906128", "s764910207"]} +{"user_id": "u391875425", "problem_id": "p03416", "language": "python", "submission_id_v0": "s339057919", "submission_id_v1": "s254043060", "cpu_time_v0": 204, "cpu_time_v1": 57, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.06, "input": "a, b = list(map(int, input().split()))\n\ntmp=str(a)\n\nc=0\n\nfor i in range(a,b+1):\n\n tmp=str(i)\n\n tmp2=\"\"\n\n for s in range(len(tmp)):\n\n tmp2=tmp2+tmp[len(tmp)-1-s]\n\n if tmp==tmp2:\n\n c=c+1\n\nprint(c)", "target": "def main():\n\n #1. input\n\n a, b = list(map(int, input().split()))\n\n\n\n ans = 0\n\n\n\n #2. from A to B\n\n for i in range(a, b+1):\n\n #2.1. judge if the number is palindromic\n\n if (str(i)[0]==str(i)[4]) and (str(i)[1]==str(i)[3]):\n\n ans = ans+1\n\n\n\n #3. output\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 11, "code_v1_loc": 18, "code_v0_num_chars": 214, "code_v1_num_chars": 347, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ntmp = str(a)\nc = 0\nfor i in range(a, b + 1):\n tmp = str(i)\n tmp2 = \"\"\n for s in range(len(tmp)):\n tmp2 = tmp2 + tmp[len(tmp) - 1 - s]\n if tmp == tmp2:\n c = c + 1\nprint(c)\n", "code_v1_no_empty_lines": "def main():\n # 1. input\n a, b = list(map(int, input().split()))\n ans = 0\n # 2. from A to B\n for i in range(a, b + 1):\n # 2.1. judge if the number is palindromic\n if (str(i)[0] == str(i)[4]) and (str(i)[1] == str(i)[3]):\n ans = ans + 1\n # 3. output\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 38.8888888889, "diff": ["-a, b = list(map(int, input().split()))", "-tmp = str(a)", "-c = 0", "-for i in range(a, b + 1):", "- tmp = str(i)", "- tmp2 = \"\"", "- for s in range(len(tmp)):", "- tmp2 = tmp2 + tmp[len(tmp) - 1 - s]", "- if tmp == tmp2:", "- c = c + 1", "-print(c)", "+def main():", "+ # 1. input", "+ a, b = list(map(int, input().split()))", "+ ans = 0", "+ # 2. from A to B", "+ for i in range(a, b + 1):", "+ # 2.1. judge if the number is palindromic", "+ if (str(i)[0] == str(i)[4]) and (str(i)[1] == str(i)[3]):", "+ ans = ans + 1", "+ # 3. output", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5203332471, "measured_runtime_v1": 0.2634068646, "runtime_lift": 1.9753974444, "key": ["s339057919", "s254043060"]} +{"user_id": "u505420467", "problem_id": "p03835", "language": "python", "submission_id_v0": "s014481361", "submission_id_v1": "s844546698", "cpu_time_v0": 1491, "cpu_time_v1": 1254, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.9, "input": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n z=s-i-j\n\n if 0<=z<=k:\n\n ans+=1\n\nprint(ans)\n", "target": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0<=s-i-j<=k:\n\n ans+=1\n\nprint(ans)\n", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 154, "code_v1_num_chars": 141, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n z = s - i - j\n if 0 <= z <= k:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- z = s - i - j", "- if 0 <= z <= k:", "+ if 0 <= s - i - j <= k:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2451675486, "measured_runtime_v1": 0.0064913454, "runtime_lift": 37.7683720217, "key": ["s014481361", "s844546698"]} +{"user_id": "u867848444", "problem_id": "p03559", "language": "python", "submission_id_v0": "s912886810", "submission_id_v1": "s338115037", "cpu_time_v0": 472, "cpu_time_v1": 254, "memory_v0": 106340, "memory_v1": 29384, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.19, "input": "from bisect import *\n\nn = int(input())\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na = sorted(a)\n\nc = sorted(c)\n\n\n\nrec = 0\n\nfor i in range(n):\n\n temp = b[i]\n\n l = bisect_left(a, temp)\n\n r = bisect_right(c, temp)\n\n rec += l * (n - r)\n\nprint(rec)", "target": "from bisect import *\n\nn = int(input())\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na.sort()\n\nc.sort()\n\nres = 0\n\nfor i in b:\n\n temp_a = bisect_left(a, i)\n\n temp_c = n - bisect_right(c, i)\n\n res += temp_a*temp_c\n\nprint(res)", "code_v0_loc": 16, "code_v1_loc": 14, "code_v0_num_chars": 323, "code_v1_num_chars": 297, "code_v0_no_empty_lines": "from bisect import *\n\nn = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na = sorted(a)\nc = sorted(c)\nrec = 0\nfor i in range(n):\n temp = b[i]\n l = bisect_left(a, temp)\n r = bisect_right(c, temp)\n rec += l * (n - r)\nprint(rec)\n", "code_v1_no_empty_lines": "from bisect import *\n\nn = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort()\nc.sort()\nres = 0\nfor i in b:\n temp_a = bisect_left(a, i)\n temp_c = n - bisect_right(c, i)\n res += temp_a * temp_c\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-a = sorted(a)", "-c = sorted(c)", "-rec = 0", "-for i in range(n):", "- temp = b[i]", "- l = bisect_left(a, temp)", "- r = bisect_right(c, temp)", "- rec += l * (n - r)", "-print(rec)", "+a.sort()", "+c.sort()", "+res = 0", "+for i in b:", "+ temp_a = bisect_left(a, i)", "+ temp_c = n - bisect_right(c, i)", "+ res += temp_a * temp_c", "+print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2357759671, "measured_runtime_v1": 0.1661899195, "runtime_lift": 1.4187140102, "key": ["s912886810", "s338115037"]} +{"user_id": "u761320129", "problem_id": "p03592", "language": "python", "submission_id_v0": "s651607907", "submission_id_v1": "s022339691", "cpu_time_v0": 277, "cpu_time_v1": 242, "memory_v0": 9168, "memory_v1": 9152, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.64, "input": "N,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n t = i*M + j*N - i*j*2\n\n if t==K:\n\n print('Yes')\n\n exit()\n\nprint('No')", "target": "N,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n if i*(M-j) + j*(N-i) == K:\n\n print('Yes')\n\n exit()\n\nprint('No')", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 190, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "N, M, K = list(map(int, input().split()))\nfor i in range(N + 1):\n for j in range(M + 1):\n t = i * M + j * N - i * j * 2\n if t == K:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_v1_no_empty_lines": "N, M, K = list(map(int, input().split()))\nfor i in range(N + 1):\n for j in range(M + 1):\n if i * (M - j) + j * (N - i) == K:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- t = i * M + j * N - i * j * 2", "- if t == K:", "+ if i * (M - j) + j * (N - i) == K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2590724151, "measured_runtime_v1": 0.2069754691, "runtime_lift": 1.2517058964, "key": ["s651607907", "s022339691"]} +{"user_id": "u078042885", "problem_id": "p00542", "language": "python", "submission_id_v0": "s237799080", "submission_id_v1": "s666902384", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7744, "memory_v1": 7736, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "a,b,c,d,e,f=[int(input()) for _ in range(6)]\n\nprint((sum([a,b,c,d,max(e,f)])-min([a,b,c,d])))", "target": "print((sum(sorted(int(input()) for _ in range(4))[1:])+max([int(input()) for _ in range(2)])))", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 91, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "a, b, c, d, e, f = [int(input()) for _ in range(6)]\nprint((sum([a, b, c, d, max(e, f)]) - min([a, b, c, d])))\n", "code_v1_no_empty_lines": "print(\n (\n sum(sorted(int(input()) for _ in range(4))[1:])\n + max([int(input()) for _ in range(2)])\n )\n)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-a, b, c, d, e, f = [int(input()) for _ in range(6)]", "-print((sum([a, b, c, d, max(e, f)]) - min([a, b, c, d])))", "+print(", "+ (", "+ sum(sorted(int(input()) for _ in range(4))[1:])", "+ + max([int(input()) for _ in range(2)])", "+ )", "+)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1785885925, "measured_runtime_v1": 0.1362432997, "runtime_lift": 1.3108064241, "key": ["s237799080", "s666902384"]} +{"user_id": "u545368057", "problem_id": "p02773", "language": "python", "submission_id_v0": "s347160213", "submission_id_v1": "s313812634", "cpu_time_v0": 801, "cpu_time_v1": 714, "memory_v0": 32480, "memory_v1": 35572, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.86, "input": "from collections import defaultdict\n\nN = int(input())\n\nd = defaultdict(int)\n\n\n\nfor i in range(N):\n\n S = input()\n\n d[S] += 1\n\n\n\nm = 0\n\nfor k in list(d.keys()):\n\n m = max(d[k],m)\n\n\n\nli = []\n\nfor k in list(d.keys()):\n\n if d[k] == m:\n\n li.append(k)\n\n\n\nli.sort()\n\nfor l in li:\n\n print(l)", "target": "from collections import defaultdict\n\nN = int(input())\n\nSs = [input() for i in range(N)]\n\n\n\nd = defaultdict(int)\n\nfor S in Ss:\n\n d[S] += 1\n\n\n\nmx = max([d[k] for k in list(d.keys())])\n\n\n\nans = []\n\nfor k in list(d.keys()):\n\n if d[k] == mx:\n\n ans.append(k)\n\n \n\nfor a in sorted(ans):\n\n print(a)", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 292, "code_v1_num_chars": 298, "code_v0_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nd = defaultdict(int)\nfor i in range(N):\n S = input()\n d[S] += 1\nm = 0\nfor k in list(d.keys()):\n m = max(d[k], m)\nli = []\nfor k in list(d.keys()):\n if d[k] == m:\n li.append(k)\nli.sort()\nfor l in li:\n print(l)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nSs = [input() for i in range(N)]\nd = defaultdict(int)\nfor S in Ss:\n d[S] += 1\nmx = max([d[k] for k in list(d.keys())])\nans = []\nfor k in list(d.keys()):\n if d[k] == mx:\n ans.append(k)\nfor a in sorted(ans):\n print(a)\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["+Ss = [input() for i in range(N)]", "-for i in range(N):", "- S = input()", "+for S in Ss:", "-m = 0", "+mx = max([d[k] for k in list(d.keys())])", "+ans = []", "- m = max(d[k], m)", "-li = []", "-for k in list(d.keys()):", "- if d[k] == m:", "- li.append(k)", "-li.sort()", "-for l in li:", "- print(l)", "+ if d[k] == mx:", "+ ans.append(k)", "+for a in sorted(ans):", "+ print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1866922059, "measured_runtime_v1": 0.0060809708, "runtime_lift": 30.7010529798, "key": ["s347160213", "s313812634"]} +{"user_id": "u600402037", "problem_id": "p03037", "language": "python", "submission_id_v0": "s181457641", "submission_id_v1": "s911516772", "cpu_time_v0": 300, "cpu_time_v1": 197, "memory_v0": 11012, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 34.33, "input": "N,M = list(map(int,input().split()))\n\nL,R = [],[]\n\nfor i in range(M):\n\n l,r = list(map(int,input().split()))\n\n L.append(l)\n\n R.append(r)\n\nans = min(R)-max(L)+1\n\nprint((ans if ans >= 0 else 0))", "target": "# coding: utf-8\n\nimport sys\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN, M = lr()\n\nL = 0; R = 10 ** 6\n\nfor _ in range(M):\n\n l, r = lr()\n\n if l > L:\n\n L = l\n\n if r < R:\n\n R = r\n\n\n\nanswer = max(0, R - L + 1)\n\nprint(answer)\n", "code_v0_loc": 8, "code_v1_loc": 18, "code_v0_num_chars": 187, "code_v1_num_chars": 318, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL, R = [], []\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\nans = min(R) - max(L) + 1\nprint((ans if ans >= 0 else 0))\n", "code_v1_no_empty_lines": "# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN, M = lr()\nL = 0\nR = 10**6\nfor _ in range(M):\n l, r = lr()\n if l > L:\n L = l\n if r < R:\n R = r\nanswer = max(0, R - L + 1)\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-N, M = list(map(int, input().split()))", "-L, R = [], []", "-for i in range(M):", "- l, r = list(map(int, input().split()))", "- L.append(l)", "- R.append(r)", "-ans = min(R) - max(L) + 1", "-print((ans if ans >= 0 else 0))", "+# coding: utf-8", "+import sys", "+", "+sr = lambda: sys.stdin.readline().rstrip()", "+ir = lambda: int(sr())", "+lr = lambda: list(map(int, sr().split()))", "+N, M = lr()", "+L = 0", "+R = 10**6", "+for _ in range(M):", "+ l, r = lr()", "+ if l > L:", "+ L = l", "+ if r < R:", "+ R = r", "+answer = max(0, R - L + 1)", "+print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2034662783, "measured_runtime_v1": 0.0060762894, "runtime_lift": 33.4852842041, "key": ["s181457641", "s911516772"]} +{"user_id": "u175590965", "problem_id": "p02881", "language": "python", "submission_id_v0": "s837964487", "submission_id_v1": "s558772824", "cpu_time_v0": 232, "cpu_time_v1": 167, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.02, "input": "n = int(input())\n\nl = []\n\nfor i in range(1,1000001):\n\n a = n / i\n\n if a.is_integer():\n\n l.append(i+n/i)\n\nprint((int(min(l)-2)))", "target": "n = int(input())\n\na = 10**20\n\nfor i in range(1,int(n**0.5)+1):\n\n if n%i==0:\n\n a = min(a,i+n//i)\n\nprint((a-2))", "code_v0_loc": 7, "code_v1_loc": 6, "code_v0_num_chars": 138, "code_v1_num_chars": 117, "code_v0_no_empty_lines": "n = int(input())\nl = []\nfor i in range(1, 1000001):\n a = n / i\n if a.is_integer():\n l.append(i + n / i)\nprint((int(min(l) - 2)))\n", "code_v1_no_empty_lines": "n = int(input())\na = 10**20\nfor i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n a = min(a, i + n // i)\nprint((a - 2))\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-l = []", "-for i in range(1, 1000001):", "- a = n / i", "- if a.is_integer():", "- l.append(i + n / i)", "-print((int(min(l) - 2)))", "+a = 10**20", "+for i in range(1, int(n**0.5) + 1):", "+ if n % i == 0:", "+ a = min(a, i + n // i)", "+print((a - 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3549120984, "measured_runtime_v1": 0.219868273, "runtime_lift": 6.1623811373, "key": ["s837964487", "s558772824"]} +{"user_id": "u186838327", "problem_id": "p02881", "language": "python", "submission_id_v0": "s806961932", "submission_id_v1": "s386327339", "cpu_time_v0": 218, "cpu_time_v1": 179, "memory_v0": 40428, "memory_v1": 39280, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.89, "input": "n = int(input())\n\nimport math\n\nm = int(math.sqrt(n))+1\n\nanss = []\n\nfor x in range(1, m+1):\n\n y = n//x\n\n z = n%x\n\n if z == 0:\n\n anss.append(abs(x-1)+abs(y-1))\n\nprint((min(anss)))\n", "target": "n = int(input())\n\ndef make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n // i:\n\n divisors.append(n//i)\n\n\n\n #divisors.sort(reverse=True)\n\n return divisors\n\n\n\nl = make_divisors(n)\n\nmin_ = float('inf')\n\nfor i in range(len(l)):\n\n min_ = min(min_, l[i]-1+n//l[i]-1)\n\nprint(min_)\n", "code_v0_loc": 10, "code_v1_loc": 17, "code_v0_num_chars": 182, "code_v1_num_chars": 402, "code_v0_no_empty_lines": "n = int(input())\nimport math\n\nm = int(math.sqrt(n)) + 1\nanss = []\nfor x in range(1, m + 1):\n y = n // x\n z = n % x\n if z == 0:\n anss.append(abs(x - 1) + abs(y - 1))\nprint((min(anss)))\n", "code_v1_no_empty_lines": "n = int(input())\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n // i)\n # divisors.sort(reverse=True)\n return divisors\n\n\nl = make_divisors(n)\nmin_ = float(\"inf\")\nfor i in range(len(l)):\n min_ = min(min_, l[i] - 1 + n // l[i] - 1)\nprint(min_)\n", "code_same": false, "relative_loc_diff_percent": 41.1764705882, "diff": ["-import math", "-m = int(math.sqrt(n)) + 1", "-anss = []", "-for x in range(1, m + 1):", "- y = n // x", "- z = n % x", "- if z == 0:", "- anss.append(abs(x - 1) + abs(y - 1))", "-print((min(anss)))", "+", "+def make_divisors(n):", "+ divisors = []", "+ for i in range(1, int(n**0.5) + 1):", "+ if n % i == 0:", "+ divisors.append(i)", "+ if i != n // i:", "+ divisors.append(n // i)", "+ # divisors.sort(reverse=True)", "+ return divisors", "+", "+", "+l = make_divisors(n)", "+min_ = float(\"inf\")", "+for i in range(len(l)):", "+ min_ = min(min_, l[i] - 1 + n // l[i] - 1)", "+print(min_)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3428507342, "measured_runtime_v1": 0.2632945333, "runtime_lift": 1.302156676, "key": ["s806961932", "s386327339"]} +{"user_id": "u850516963", "problem_id": "p03455", "language": "python", "submission_id_v0": "s887829630", "submission_id_v1": "s071542109", "cpu_time_v0": 67, "cpu_time_v1": 30, "memory_v0": 61732, "memory_v1": 9060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.22, "input": "a, b = list(map(int, input().split()))\n\nif a*b%2 == 1:\n\n print(\"Odd\")\n\nelse:\n\n print(\"Even\")", "target": "a, b = list(map(int, input().split()))\n\nprint(('Odd'if a&b&1 else 'Even'))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 92, "code_v1_num_chars": 66, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nif a * b % 2 == 1:\n print(\"Odd\")\nelse:\n print(\"Even\")\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nprint((\"Odd\" if a & b & 1 else \"Even\"))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-if a * b % 2 == 1:", "- print(\"Odd\")", "-else:", "- print(\"Even\")", "+print((\"Odd\" if a & b & 1 else \"Even\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1895228839, "measured_runtime_v1": 0.0064490705, "runtime_lift": 29.3876276628, "key": ["s887829630", "s071542109"]} +{"user_id": "u754022296", "problem_id": "p04021", "language": "python", "submission_id_v0": "s724849949", "submission_id_v1": "s422278370", "cpu_time_v0": 219, "cpu_time_v1": 182, "memory_v0": 23552, "memory_v1": 23552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.89, "input": "import sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(input())\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n if (L[i][1]-i)%2:\n\n count += 1\n\nans = (count+1) // 2\n\nprint(ans)", "target": "import sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(input())\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n count += (L[i][1]-i)%2\n\nans = (count+1) // 2\n\nprint(ans)\n", "code_v0_loc": 13, "code_v1_loc": 12, "code_v0_num_chars": 260, "code_v1_num_chars": 250, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nread = sys.stdin.read\nn = int(input())\nA = list(map(int, read().split()))\nL = sorted([(j, i) for i, j in enumerate(A)])\ncount = 0\nfor i in range(n):\n if (L[i][1] - i) % 2:\n count += 1\nans = (count + 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nread = sys.stdin.read\nn = int(input())\nA = list(map(int, read().split()))\nL = sorted([(j, i) for i, j in enumerate(A)])\ncount = 0\nfor i in range(n):\n count += (L[i][1] - i) % 2\nans = (count + 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["- if (L[i][1] - i) % 2:", "- count += 1", "+ count += (L[i][1] - i) % 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2933020202, "measured_runtime_v1": 0.2201511685, "runtime_lift": 1.3322755547, "key": ["s724849949", "s422278370"]} +{"user_id": "u357751375", "problem_id": "p04012", "language": "python", "submission_id_v0": "s590976745", "submission_id_v1": "s361487799", "cpu_time_v0": 31, "cpu_time_v1": 26, "memory_v0": 9044, "memory_v1": 9092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.13, "input": "w = input()\n\ny = list(set(w))\n\n\n\nfor i in range(len(y)):\n\n if w.count(y[i]) % 2 != 0:\n\n print('No')\n\n exit(0)\n\n\n\nprint('Yes')", "target": "w = list(input())\n\nx = list(set(w))\n\nfor i in x:\n\n y = w.count(i)\n\n if y % 2 != 0:\n\n print('No')\n\n exit(0)\n\nprint('Yes')", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 142, "code_v1_num_chars": 140, "code_v0_no_empty_lines": "w = input()\ny = list(set(w))\nfor i in range(len(y)):\n if w.count(y[i]) % 2 != 0:\n print(\"No\")\n exit(0)\nprint(\"Yes\")\n", "code_v1_no_empty_lines": "w = list(input())\nx = list(set(w))\nfor i in x:\n y = w.count(i)\n if y % 2 != 0:\n print(\"No\")\n exit(0)\nprint(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-w = input()", "-y = list(set(w))", "-for i in range(len(y)):", "- if w.count(y[i]) % 2 != 0:", "+w = list(input())", "+x = list(set(w))", "+for i in x:", "+ y = w.count(i)", "+ if y % 2 != 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2480834422, "measured_runtime_v1": 0.172200387, "runtime_lift": 1.4406671583, "key": ["s590976745", "s361487799"]} +{"user_id": "u576432509", "problem_id": "p02767", "language": "python", "submission_id_v0": "s320006452", "submission_id_v1": "s025352649", "cpu_time_v0": 403, "cpu_time_v1": 21, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 94.79, "input": "n=int(input())\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\nfor p in range(x[0],x[len(x)-1]+1):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\n pmin=psum \n\n for j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) ", "target": "n=int(input())\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\npsum=0\n\nfor i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\npmin=psum \n\nfor j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) \n", "code_v0_loc": 19, "code_v1_loc": 18, "code_v0_num_chars": 421, "code_v1_num_chars": 353, "code_v0_no_empty_lines": "n = int(input())\nx = list(map(int, input().split()))\nx.sort()\nfor p in range(x[0], x[len(x) - 1] + 1):\n psum = 0\n for i in range(len(x)):\n psum = psum + (x[0] - x[i]) ** 2\n # print(psum)\n pmin = psum\n for j in range(x[0] + 1, x[len(x) - 1]):\n psum = 0\n for i in range(len(x)):\n psum = psum + (j - x[i]) ** 2\n # print(psum)\n if pmin > psum:\n pmin = psum\nprint(pmin)\n", "code_v1_no_empty_lines": "n = int(input())\nx = list(map(int, input().split()))\nx.sort()\npsum = 0\nfor i in range(len(x)):\n psum = psum + (x[0] - x[i]) ** 2\n# print(psum)\npmin = psum\nfor j in range(x[0] + 1, x[len(x) - 1]):\n psum = 0\n for i in range(len(x)):\n psum = psum + (j - x[i]) ** 2\n # print(psum)\n if pmin > psum:\n pmin = psum\nprint(pmin)\n", "code_same": false, "relative_loc_diff_percent": 5.2631578947, "diff": ["-for p in range(x[0], x[len(x) - 1] + 1):", "+psum = 0", "+for i in range(len(x)):", "+ psum = psum + (x[0] - x[i]) ** 2", "+# print(psum)", "+pmin = psum", "+for j in range(x[0] + 1, x[len(x) - 1]):", "- psum = psum + (x[0] - x[i]) ** 2", "- # print(psum)", "- pmin = psum", "- for j in range(x[0] + 1, x[len(x) - 1]):", "- psum = 0", "- for i in range(len(x)):", "- psum = psum + (j - x[i]) ** 2", "- # print(psum)", "- if pmin > psum:", "- pmin = psum", "+ psum = psum + (j - x[i]) ** 2", "+ # print(psum)", "+ if pmin > psum:", "+ pmin = psum"], "diff_only_import_comment": false, "measured_runtime_v0": 0.298344056, "measured_runtime_v1": 0.1876089347, "runtime_lift": 1.59024439, "key": ["s320006452", "s025352649"]} +{"user_id": "u438662618", "problem_id": "p03086", "language": "python", "submission_id_v0": "s956521892", "submission_id_v1": "s325345686", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "import re\n\n\n\nS = input()\n\nmax = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i + 1, len(S) + 1) :\n\n pattern = re.compile(r'[A|T|C|G]{%d}' % int(j - i))\n\n subStr = S[i:j]\n\n\n\n if pattern.match(subStr) and j - i > max :\n\n max = j - i\n\n\n\nprint(max)\n", "target": "S = input()\n\n\n\nans = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i, len(S)) :\n\n if all('ACGT'.count(c) == 1 for c in S[i : j + 1]) :\n\n ans = max(ans, j - i + 1)\n\n\n\n\n\nprint(ans)\n", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 282, "code_v1_num_chars": 201, "code_v0_no_empty_lines": "import re\n\nS = input()\nmax = 0\nfor i in range(len(S)):\n for j in range(i + 1, len(S) + 1):\n pattern = re.compile(r\"[A|T|C|G]{%d}\" % int(j - i))\n subStr = S[i:j]\n if pattern.match(subStr) and j - i > max:\n max = j - i\nprint(max)\n", "code_v1_no_empty_lines": "S = input()\nans = 0\nfor i in range(len(S)):\n for j in range(i, len(S)):\n if all(\"ACGT\".count(c) == 1 for c in S[i : j + 1]):\n ans = max(ans, j - i + 1)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-import re", "-", "-max = 0", "+ans = 0", "- for j in range(i + 1, len(S) + 1):", "- pattern = re.compile(r\"[A|T|C|G]{%d}\" % int(j - i))", "- subStr = S[i:j]", "- if pattern.match(subStr) and j - i > max:", "- max = j - i", "-print(max)", "+ for j in range(i, len(S)):", "+ if all(\"ACGT\".count(c) == 1 for c in S[i : j + 1]):", "+ ans = max(ans, j - i + 1)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3271781678, "measured_runtime_v1": 0.2537176473, "runtime_lift": 1.2895365036, "key": ["s956521892", "s325345686"]} +{"user_id": "u379136995", "problem_id": "p02921", "language": "python", "submission_id_v0": "s545345968", "submission_id_v1": "s346622706", "cpu_time_v0": 27, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.04, "input": "s=input()\n\nt=input()\n\nans=0\n\nif s[0]==t[0]:\n\n ans+=1\n\nif s[1]==t[1]:\n\n ans+=1\n\nif s[2]==t[2]:\n\n ans+=1\n\nprint(ans)\n", "target": "s=input()\n\nt=input()\n\nans=0\n\nfor i in range(0,3):\n\n if s[i]==t[i]:\n\n ans+=1\n\nprint(ans)\n", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 124, "code_v1_num_chars": 98, "code_v0_no_empty_lines": "s = input()\nt = input()\nans = 0\nif s[0] == t[0]:\n ans += 1\nif s[1] == t[1]:\n ans += 1\nif s[2] == t[2]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "s = input()\nt = input()\nans = 0\nfor i in range(0, 3):\n if s[i] == t[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-if s[0] == t[0]:", "- ans += 1", "-if s[1] == t[1]:", "- ans += 1", "-if s[2] == t[2]:", "- ans += 1", "+for i in range(0, 3):", "+ if s[i] == t[i]:", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3561623907, "measured_runtime_v1": 0.2681128595, "runtime_lift": 1.3284047299, "key": ["s545345968", "s346622706"]} +{"user_id": "u263753244", "problem_id": "p03835", "language": "python", "submission_id_v0": "s871403539", "submission_id_v1": "s899034376", "cpu_time_v0": 1228, "cpu_time_v1": 261, "memory_v0": 2940, "memory_v1": 42092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.75, "input": "k,s=list(map(int,input().split()))\n\ncnt=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0 <= s-i-j <= k:\n\n cnt+=1\n\nprint(cnt)", "target": "k,s=list(map(int,input().split()))\n\na=0\n\nfor i in range(0,k+1):\n\n for j in range(0,k+1):\n\n if 0<=s-i-j<=k:\n\n a+=1\n\nprint(a)", "code_v0_loc": 7, "code_v1_loc": 7, "code_v0_num_chars": 144, "code_v1_num_chars": 138, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\na = 0\nfor i in range(0, k + 1):\n for j in range(0, k + 1):\n if 0 <= s - i - j <= k:\n a += 1\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-cnt = 0", "-for i in range(k + 1):", "- for j in range(k + 1):", "+a = 0", "+for i in range(0, k + 1):", "+ for j in range(0, k + 1):", "- cnt += 1", "-print(cnt)", "+ a += 1", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2440719529, "measured_runtime_v1": 0.12879462, "runtime_lift": 1.8950477354, "key": ["s871403539", "s899034376"]} +{"user_id": "u027685417", "problem_id": "p03038", "language": "python", "submission_id_v0": "s124992398", "submission_id_v1": "s099446399", "cpu_time_v0": 678, "cpu_time_v1": 544, "memory_v0": 33104, "memory_v1": 28888, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.76, "input": "from heapq import *\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nPAIRS = [[-a, -1] for a in map(int, input().split())]\n\nheapify(PAIRS)\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(PAIRS, [-c, -b])\n\n\n\nanswer = 0\n\nfor _ in range(n):\n\n pair = heappop(PAIRS)\n\n answer += -pair[0]\n\n pair[1] += 1\n\n if pair[1] != 0:\n\n heappush(PAIRS, pair)\n\n\n\nprint(answer)\n", "target": "n, m = list(map(int, input().split()))\n\nPAIRS = [(a, 1) for a in map(int, input().split())]\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n PAIRS.append((c, b))\n\nPAIRS.sort(reverse = True)\n\n\n\nanswer, count = 0, 0\n\nfor pair in PAIRS:\n\n answer += pair[0] * pair[1]\n\n count += pair[1]\n\n if count > n:\n\n answer -= pair[0] * (count - n)\n\n break\n\n\n\nprint(answer)\n", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 393, "code_v1_num_chars": 391, "code_v0_no_empty_lines": "from heapq import *\n\nn, m = list(map(int, input().split()))\nPAIRS = [[-a, -1] for a in map(int, input().split())]\nheapify(PAIRS)\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n heappush(PAIRS, [-c, -b])\nanswer = 0\nfor _ in range(n):\n pair = heappop(PAIRS)\n answer += -pair[0]\n pair[1] += 1\n if pair[1] != 0:\n heappush(PAIRS, pair)\nprint(answer)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nPAIRS = [(a, 1) for a in map(int, input().split())]\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n PAIRS.append((c, b))\nPAIRS.sort(reverse=True)\nanswer, count = 0, 0\nfor pair in PAIRS:\n answer += pair[0] * pair[1]\n count += pair[1]\n if count > n:\n answer -= pair[0] * (count - n)\n break\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["-from heapq import *", "-", "-PAIRS = [[-a, -1] for a in map(int, input().split())]", "-heapify(PAIRS)", "+PAIRS = [(a, 1) for a in map(int, input().split())]", "- heappush(PAIRS, [-c, -b])", "-answer = 0", "-for _ in range(n):", "- pair = heappop(PAIRS)", "- answer += -pair[0]", "- pair[1] += 1", "- if pair[1] != 0:", "- heappush(PAIRS, pair)", "+ PAIRS.append((c, b))", "+PAIRS.sort(reverse=True)", "+answer, count = 0, 0", "+for pair in PAIRS:", "+ answer += pair[0] * pair[1]", "+ count += pair[1]", "+ if count > n:", "+ answer -= pair[0] * (count - n)", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2969929054, "measured_runtime_v1": 0.0828762929, "runtime_lift": 3.5835688928, "key": ["s124992398", "s099446399"]} +{"user_id": "u803617136", "problem_id": "p03796", "language": "python", "submission_id_v0": "s262574211", "submission_id_v1": "s998310124", "cpu_time_v0": 230, "cpu_time_v1": 37, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.91, "input": "import math\n\n\n\nn = int(input())\n\nans = math.factorial(n) % (pow(10, 9) + 7)\n\nprint(ans)", "target": "n = int(input())\n\nans = 1\n\nmod = 10 ** 9 + 7\n\nfor i in range(1, n + 1):\n\n ans = (ans * i % mod) % mod\n\nprint(ans)", "code_v0_loc": 5, "code_v1_loc": 6, "code_v0_num_chars": 87, "code_v1_num_chars": 116, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nans = math.factorial(n) % (pow(10, 9) + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nmod = 10**9 + 7\nfor i in range(1, n + 1):\n ans = (ans * i % mod) % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-import math", "-", "-ans = math.factorial(n) % (pow(10, 9) + 7)", "+ans = 1", "+mod = 10**9 + 7", "+for i in range(1, n + 1):", "+ ans = (ans * i % mod) % mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5572224624, "measured_runtime_v1": 0.2586410534, "runtime_lift": 2.154423882, "key": ["s262574211", "s998310124"]} +{"user_id": "u991567869", "problem_id": "p02596", "language": "python", "submission_id_v0": "s146225899", "submission_id_v1": "s204753661", "cpu_time_v0": 292, "cpu_time_v1": 175, "memory_v0": 9152, "memory_v1": 9164, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.07, "input": "k = int(input())\n\nx = 1\n\n\n\nif k%7 != 0:\n\n mod = 9*k\n\nelse:\n\n mod = 9*k//7\n\n\n\nfor i in range(10**6):\n\n x = x*10%mod\n\n if x == 1:\n\n print((i + 1))\n\n exit()\n\n\n\nprint((-1))", "target": "k = int(input())\n\na = 0\n\n\n\nfor i in range(k + 10):\n\n a = (a*10 + 7)%k\n\n if a == 0:\n\n print((i + 1))\n\n exit()\n\nprint((-1))", "code_v0_loc": 15, "code_v1_loc": 9, "code_v0_num_chars": 190, "code_v1_num_chars": 137, "code_v0_no_empty_lines": "k = int(input())\nx = 1\nif k % 7 != 0:\n mod = 9 * k\nelse:\n mod = 9 * k // 7\nfor i in range(10**6):\n x = x * 10 % mod\n if x == 1:\n print((i + 1))\n exit()\nprint((-1))\n", "code_v1_no_empty_lines": "k = int(input())\na = 0\nfor i in range(k + 10):\n a = (a * 10 + 7) % k\n if a == 0:\n print((i + 1))\n exit()\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-x = 1", "-if k % 7 != 0:", "- mod = 9 * k", "-else:", "- mod = 9 * k // 7", "-for i in range(10**6):", "- x = x * 10 % mod", "- if x == 1:", "+a = 0", "+for i in range(k + 10):", "+ a = (a * 10 + 7) % k", "+ if a == 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5332653046, "measured_runtime_v1": 0.4200988929, "runtime_lift": 1.2693804091, "key": ["s146225899", "s204753661"]} +{"user_id": "u562935282", "problem_id": "p03200", "language": "python", "submission_id_v0": "s639682353", "submission_id_v1": "s546135650", "cpu_time_v0": 48, "cpu_time_v1": 43, "memory_v0": 3500, "memory_v1": 3500, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.42, "input": "s = input()\n\n\n\ncnt = 0\n\nans = 0\n\nfor c in s:\n\n if c == 'B':\n\n cnt += 1\n\n elif c == 'W':\n\n ans += cnt\n\nprint(ans)\n", "target": "s = input()\n\n\n\nans = 0\n\nb = 0\n\nfor ss in s:\n\n if ss == 'W':\n\n ans += b\n\n else:\n\n b += 1\n\nprint(ans)\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 133, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "s = input()\ncnt = 0\nans = 0\nfor c in s:\n if c == \"B\":\n cnt += 1\n elif c == \"W\":\n ans += cnt\nprint(ans)\n", "code_v1_no_empty_lines": "s = input()\nans = 0\nb = 0\nfor ss in s:\n if ss == \"W\":\n ans += b\n else:\n b += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-cnt = 0", "-for c in s:", "- if c == \"B\":", "- cnt += 1", "- elif c == \"W\":", "- ans += cnt", "+b = 0", "+for ss in s:", "+ if ss == \"W\":", "+ ans += b", "+ else:", "+ b += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2094221431, "measured_runtime_v1": 0.1051600281, "runtime_lift": 1.9914614603, "key": ["s639682353", "s546135650"]} +{"user_id": "u744114948", "problem_id": "p00053", "language": "python", "submission_id_v0": "s391855332", "submission_id_v1": "s612183692", "cpu_time_v0": 660, "cpu_time_v1": 70, "memory_v0": 7228, "memory_v1": 8024, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 89.39, "input": "import math\n\ndef pri(n):\n\n if n < 2:\n\n return False\n\n elif n == 2:\n\n return True\n\n elif n % 2 == 0:\n\n return False\n\n\n\n i = 3\n\n while i <= math.sqrt(n):\n\n if n % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nl=[i for i in range(110000)if pri(i) ]\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0: break\n\n print((sum(l[:n])))", "target": "import math\n\ndef pri(n):\n\n l =[True] * n\n\n l[0] = l[1] = False\n\n for i in range(2,n):\n\n if l[i]:\n\n for j in range(i*2, n, i):\n\n l[j] = False\n\n return l\n\nn=105000\n\ns=pri(n)\n\nl=[i for i in range(n) if s[i]]\n\nwhile True:\n\n n = int(input())\n\n if n == 0: break\n\n print((sum(l[:n])))", "code_v0_loc": 22, "code_v1_loc": 16, "code_v0_num_chars": 394, "code_v1_num_chars": 329, "code_v0_no_empty_lines": "import math\n\n\ndef pri(n):\n if n < 2:\n return False\n elif n == 2:\n return True\n elif n % 2 == 0:\n return False\n i = 3\n while i <= math.sqrt(n):\n if n % i == 0:\n return False\n i += 2\n return True\n\n\nl = [i for i in range(110000) if pri(i)]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(l[:n])))\n", "code_v1_no_empty_lines": "import math\n\n\ndef pri(n):\n l = [True] * n\n l[0] = l[1] = False\n for i in range(2, n):\n if l[i]:\n for j in range(i * 2, n, i):\n l[j] = False\n return l\n\n\nn = 105000\ns = pri(n)\nl = [i for i in range(n) if s[i]]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(l[:n])))\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["- if n < 2:", "- return False", "- elif n == 2:", "- return True", "- elif n % 2 == 0:", "- return False", "- i = 3", "- while i <= math.sqrt(n):", "- if n % i == 0:", "- return False", "- i += 2", "- return True", "+ l = [True] * n", "+ l[0] = l[1] = False", "+ for i in range(2, n):", "+ if l[i]:", "+ for j in range(i * 2, n, i):", "+ l[j] = False", "+ return l", "-l = [i for i in range(110000) if pri(i)]", "+n = 105000", "+s = pri(n)", "+l = [i for i in range(n) if s[i]]"], "diff_only_import_comment": false, "measured_runtime_v0": 2.8203961465, "measured_runtime_v1": 0.4705428715, "runtime_lift": 5.9939196138, "key": ["s391855332", "s612183692"]} +{"user_id": "u133936772", "problem_id": "p02988", "language": "python", "submission_id_v0": "s657683547", "submission_id_v1": "s740427744", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "n = int(input())\n\nl = list(map(int, input().split()))\n\nprint((sum(l[i]l[i+1]>l[i+2] for i in range(n-2))))", "target": "n=int(input())\n\nl=list(map(int,input().split()))\n\na=0\n\nfor i in range(n-2):\n\n p,q,r=l[i:i+3]\n\n if p l[i + 1] > l[i + 2]\n for i in range(n - 2)\n )\n )\n)\n", "code_v1_no_empty_lines": "n = int(input())\nl = list(map(int, input().split()))\na = 0\nfor i in range(n - 2):\n p, q, r = l[i : i + 3]\n if p < q < r or r < q < p:\n a += 1\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-print(", "- (", "- sum(", "- l[i] < l[i + 1] < l[i + 2] or l[i] > l[i + 1] > l[i + 2]", "- for i in range(n - 2)", "- )", "- )", "-)", "+a = 0", "+for i in range(n - 2):", "+ p, q, r = l[i : i + 3]", "+ if p < q < r or r < q < p:", "+ a += 1", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1639216754, "measured_runtime_v1": 0.0058678908, "runtime_lift": 27.9353658749, "key": ["s657683547", "s740427744"]} +{"user_id": "u813098295", "problem_id": "p03363", "language": "python", "submission_id_v0": "s373502740", "submission_id_v1": "s912924761", "cpu_time_v0": 217, "cpu_time_v1": 194, "memory_v0": 31620, "memory_v1": 45788, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.6, "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\n\n\nans, s = 0, 0\n\nd = {0:1}\n\n\n\nfor i in A:\n\n s += i\n\n ans += d.get(s, 0)\n\n d[s] = d.get(s, 0) + 1\n\n\n\nprint(ans)", "target": "#!/usr/bin/env python3\n\n\n\nfrom collections import defaultdict\n\n\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\n\n\nd = defaultdict(int)\n\nd[0] = 1\n\n\n\ns, ans = 0, 0\n\n\n\nfor a in A:\n\n s += a\n\n ans += d[s]\n\n d[s] += 1\n\n\n\nprint (ans)", "code_v0_loc": 12, "code_v1_loc": 18, "code_v0_num_chars": 175, "code_v1_num_chars": 237, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nans, s = 0, 0\nd = {0: 1}\nfor i in A:\n s += i\n ans += d.get(s, 0)\n d[s] = d.get(s, 0) + 1\nprint(ans)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nfrom collections import defaultdict\n\nN = int(input())\nA = list(map(int, input().split()))\nd = defaultdict(int)\nd[0] = 1\ns, ans = 0, 0\nfor a in A:\n s += a\n ans += d[s]\n d[s] += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-N = int(input())", "+#!/usr/bin/env python3", "+from collections import defaultdict", "+", "+N = int(input())", "-ans, s = 0, 0", "-d = {0: 1}", "-for i in A:", "- s += i", "- ans += d.get(s, 0)", "- d[s] = d.get(s, 0) + 1", "+d = defaultdict(int)", "+d[0] = 1", "+s, ans = 0, 0", "+for a in A:", "+ s += a", "+ ans += d[s]", "+ d[s] += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2992557037, "measured_runtime_v1": 0.2235582159, "runtime_lift": 1.3386030235, "key": ["s373502740", "s912924761"]} +{"user_id": "u120865944", "problem_id": "p03162", "language": "python", "submission_id_v0": "s595235842", "submission_id_v1": "s886147212", "cpu_time_v0": 1019, "cpu_time_v1": 680, "memory_v0": 47328, "memory_v1": 59484, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.27, "input": "N = int(input())\n\nl = [list(map(int, input().split())) for _ in range(N)]\n\n\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\n\n\nfor i in range(1, N+1):\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k]+l[i-1][k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n\n\n", "target": "N = int(input())\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\nfor i in range(1, N+1):\n\n hapiness = list(map(int, input().split()))\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k] + hapiness[k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 341, "code_v1_num_chars": 329, "code_v0_no_empty_lines": "N = int(input())\nl = [list(map(int, input().split())) for _ in range(N)]\ndp = [[0 for i in range(3)] for j in range(N + 1)]\nfor i in range(1, N + 1):\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[i][j] = max(dp[i][j], dp[i - 1][k] + l[i - 1][k])\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n", "code_v1_no_empty_lines": "N = int(input())\ndp = [[0 for i in range(3)] for j in range(N + 1)]\nfor i in range(1, N + 1):\n hapiness = list(map(int, input().split()))\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[i][j] = max(dp[i][j], dp[i - 1][k] + hapiness[k])\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-l = [list(map(int, input().split())) for _ in range(N)]", "+ hapiness = list(map(int, input().split()))", "- dp[i][j] = max(dp[i][j], dp[i - 1][k] + l[i - 1][k])", "+ dp[i][j] = max(dp[i][j], dp[i - 1][k] + hapiness[k])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.267745409, "measured_runtime_v1": 0.0801038151, "runtime_lift": 3.3424801143, "key": ["s595235842", "s886147212"]} +{"user_id": "u394731058", "problem_id": "p02899", "language": "python", "submission_id_v0": "s948462743", "submission_id_v1": "s673167226", "cpu_time_v0": 210, "cpu_time_v1": 76, "memory_v0": 13304, "memory_v1": 17740, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 63.81, "input": "import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(input())\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n for i in range(len(l)):\n\n if i != len(l)-1:\n\n print(\"{} \".format(l[i]), end='')\n\n else:\n\n print(l[i])\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(input())\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n print((\" \".join(map(str,l))))\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 19, "code_v1_loc": 14, "code_v0_num_chars": 381, "code_v1_num_chars": 268, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n ans = 0\n n = int(input())\n o = list(map(int, input().split()))\n l = [0] * n\n for i in range(n):\n l[o[i] - 1] = i + 1\n for i in range(len(l)):\n if i != len(l) - 1:\n print(\"{} \".format(l[i]), end=\"\")\n else:\n print(l[i])\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n ans = 0\n n = int(input())\n o = list(map(int, input().split()))\n l = [0] * n\n for i in range(n):\n l[o[i] - 1] = i + 1\n print((\" \".join(map(str, l))))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 26.3157894737, "diff": ["- n = int(input())", "+ n = int(input())", "- for i in range(len(l)):", "- if i != len(l) - 1:", "- print(\"{} \".format(l[i]), end=\"\")", "- else:", "- print(l[i])", "+ print((\" \".join(map(str, l))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3305146998, "measured_runtime_v1": 0.2638847903, "runtime_lift": 1.2524962104, "key": ["s948462743", "s673167226"]} +{"user_id": "u531220228", "problem_id": "p02994", "language": "python", "submission_id_v0": "s512634929", "submission_id_v1": "s713379557", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "N,L = list(map(int, input().split()))\n\ntaste = [L+i-1 for i in range(1,N+1)]\n\nif taste[-1] < 0:\n\n print((sum(taste) + min([abs(x) for x in taste])))\n\nelse:\n\n print((sum(taste) - min([abs(x) for x in taste])))", "target": "N, L = list(map(int, input().split()))\n\n\n\ntaste = [L+i-1 for i in range(1, N+1)]\n\n\n\nif 0 in taste:\n\n select = 0\n\nelse:\n\n select_with_ind = min(enumerate(taste), key = lambda x: abs(x[1]))\n\n select = select_with_ind[1]\n\n \n\nprint((sum(taste) - select))", "code_v0_loc": 6, "code_v1_loc": 11, "code_v0_num_chars": 200, "code_v1_num_chars": 254, "code_v0_no_empty_lines": "N, L = list(map(int, input().split()))\ntaste = [L + i - 1 for i in range(1, N + 1)]\nif taste[-1] < 0:\n print((sum(taste) + min([abs(x) for x in taste])))\nelse:\n print((sum(taste) - min([abs(x) for x in taste])))\n", "code_v1_no_empty_lines": "N, L = list(map(int, input().split()))\ntaste = [L + i - 1 for i in range(1, N + 1)]\nif 0 in taste:\n select = 0\nelse:\n select_with_ind = min(enumerate(taste), key=lambda x: abs(x[1]))\n select = select_with_ind[1]\nprint((sum(taste) - select))\n", "code_same": false, "relative_loc_diff_percent": 45.4545454545, "diff": ["-if taste[-1] < 0:", "- print((sum(taste) + min([abs(x) for x in taste])))", "+if 0 in taste:", "+ select = 0", "- print((sum(taste) - min([abs(x) for x in taste])))", "+ select_with_ind = min(enumerate(taste), key=lambda x: abs(x[1]))", "+ select = select_with_ind[1]", "+print((sum(taste) - select))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3334629779, "measured_runtime_v1": 0.1486533701, "runtime_lift": 2.2432251455, "key": ["s512634929", "s713379557"]} +{"user_id": "u077291787", "problem_id": "p03416", "language": "python", "submission_id_v0": "s642708796", "submission_id_v1": "s868202811", "cpu_time_v0": 245, "cpu_time_v1": 42, "memory_v0": 40940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.86, "input": "# ABC090B - Palindromic Numbers\n\na, b = list(map(int, input().rstrip().split()))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n lst = list(map(int, list(str(i))))\n\n if lst[0] == lst[4] and lst[1] == lst[3]:\n\n count += 1\n\nprint(count)", "target": "# ABC090B - Palindromic Numbers\n\ndef main():\n\n a, b = list(map(int, input().rstrip().split()))\n\n cnt = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n if s == s[::-1]:\n\n cnt += 1\n\n print(cnt)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 8, "code_v1_loc": 13, "code_v0_num_chars": 239, "code_v1_num_chars": 269, "code_v0_no_empty_lines": "# ABC090B - Palindromic Numbers\na, b = list(map(int, input().rstrip().split()))\ncount = 0\nfor i in range(a, b + 1):\n lst = list(map(int, list(str(i))))\n if lst[0] == lst[4] and lst[1] == lst[3]:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "# ABC090B - Palindromic Numbers\ndef main():\n a, b = list(map(int, input().rstrip().split()))\n cnt = 0\n for i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n cnt += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 38.4615384615, "diff": ["-a, b = list(map(int, input().rstrip().split()))", "-count = 0", "-for i in range(a, b + 1):", "- lst = list(map(int, list(str(i))))", "- if lst[0] == lst[4] and lst[1] == lst[3]:", "- count += 1", "-print(count)", "+def main():", "+ a, b = list(map(int, input().rstrip().split()))", "+ cnt = 0", "+ for i in range(a, b + 1):", "+ s = str(i)", "+ if s == s[::-1]:", "+ cnt += 1", "+ print(cnt)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3956292481, "measured_runtime_v1": 0.2484657222, "runtime_lift": 1.5922890477, "key": ["s642708796", "s868202811"]} +{"user_id": "u977389981", "problem_id": "p03720", "language": "python", "submission_id_v0": "s310815601", "submission_id_v1": "s089084009", "cpu_time_v0": 25, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.0, "input": "n, m = list(map(int, input().split()))\n\ndp = [0] * n\n\nfor i in range(m):\n\n x, y = list(map(int, input().split()))\n\n dp[x - 1] += 1\n\n dp[y - 1] += 1\n\nfor i in range(n):\n\n print((dp[i]))", "target": "n, m = list(map(int, input().split()))\n\nA = [0] * n\n\nfor i in range(m):\n\n a, b = list(map(int, input().split()))\n\n A[a - 1] += 1\n\n A[b - 1] += 1\n\n \n\nfor i in range(n):\n\n print((A[i]))", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 182, "code_v1_num_chars": 184, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\ndp = [0] * n\nfor i in range(m):\n x, y = list(map(int, input().split()))\n dp[x - 1] += 1\n dp[y - 1] += 1\nfor i in range(n):\n print((dp[i]))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nA = [0] * n\nfor i in range(m):\n a, b = list(map(int, input().split()))\n A[a - 1] += 1\n A[b - 1] += 1\nfor i in range(n):\n print((A[i]))\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-dp = [0] * n", "+A = [0] * n", "- x, y = list(map(int, input().split()))", "- dp[x - 1] += 1", "- dp[y - 1] += 1", "+ a, b = list(map(int, input().split()))", "+ A[a - 1] += 1", "+ A[b - 1] += 1", "- print((dp[i]))", "+ print((A[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2766861832, "measured_runtime_v1": 0.17692909, "runtime_lift": 1.5638252769, "key": ["s310815601", "s089084009"]} +{"user_id": "u171065106", "problem_id": "p03796", "language": "python", "submission_id_v0": "s258128729", "submission_id_v1": "s727911974", "cpu_time_v0": 230, "cpu_time_v1": 43, "memory_v0": 3976, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.3, "input": "import math\n\n\n\nn = int(input())\n\n\n\nprint((math.factorial(n) % (10**9 + 7)))\n", "target": "n = int(input())\n\n\n\nans = 1\n\n\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= 10**9 + 7\n\n\n\nprint(ans)\n", "code_v0_loc": 5, "code_v1_loc": 9, "code_v0_num_chars": 74, "code_v1_num_chars": 105, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= 10**9 + 7\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+ans = 1", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= 10**9 + 7", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6649877462, "measured_runtime_v1": 0.4034042664, "runtime_lift": 1.6484400431, "key": ["s258128729", "s727911974"]} +{"user_id": "u488127128", "problem_id": "p03796", "language": "python", "submission_id_v0": "s637972642", "submission_id_v1": "s581563839", "cpu_time_v0": 32, "cpu_time_v1": 28, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.5, "input": "def factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r *= n\n\n power_r %= 10**9+7\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "target": "def factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r = power_r*n % (10**9+7)\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "code_v0_loc": 10, "code_v1_loc": 9, "code_v0_num_chars": 209, "code_v1_num_chars": 200, "code_v0_no_empty_lines": "def factorial(N):\n power_r = 1\n for n in range(2, N + 1):\n power_r *= n\n power_r %= 10**9 + 7\n return power_r\n\n\nif __name__ == \"__main__\":\n N = int(input())\n print((factorial(N)))\n", "code_v1_no_empty_lines": "def factorial(N):\n power_r = 1\n for n in range(2, N + 1):\n power_r = power_r * n % (10**9 + 7)\n return power_r\n\n\nif __name__ == \"__main__\":\n N = int(input())\n print((factorial(N)))\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["- power_r *= n", "- power_r %= 10**9 + 7", "+ power_r = power_r * n % (10**9 + 7)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3227770622, "measured_runtime_v1": 0.2497183731, "runtime_lift": 1.2925643324, "key": ["s637972642", "s581563839"]} +{"user_id": "u189479417", "problem_id": "p02596", "language": "python", "submission_id_v0": "s892012548", "submission_id_v1": "s295850055", "cpu_time_v0": 350, "cpu_time_v1": 211, "memory_v0": 9176, "memory_v1": 9188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.71, "input": "import sys\n\nK = int(input())\n\n\n\npower = 7\n\nSUM = 0\n\n\n\nfor i in range(1, 10 ** 6):\n\n SUM += power\n\n if SUM % K == 0:\n\n print(i)\n\n sys.exit()\n\n power *= 10\n\n power %= K\n\n\n\nprint((-1))", "target": "import sys\n\nK = int(input())\n\n\n\nL = 9 * K\n\n\n\nif K % 7 == 0:\n\n L //= 7\n\n\n\npower = 1\n\n\n\nfor i in range(1, 10 ** 6):\n\n power *= 10\n\n power %= L\n\n if power == 1:\n\n print(i)\n\n sys.exit()\n\n\n\nprint((-1))", "code_v0_loc": 15, "code_v1_loc": 18, "code_v0_num_chars": 205, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "import sys\n\nK = int(input())\npower = 7\nSUM = 0\nfor i in range(1, 10**6):\n SUM += power\n if SUM % K == 0:\n print(i)\n sys.exit()\n power *= 10\n power %= K\nprint((-1))\n", "code_v1_no_empty_lines": "import sys\n\nK = int(input())\nL = 9 * K\nif K % 7 == 0:\n L //= 7\npower = 1\nfor i in range(1, 10**6):\n power *= 10\n power %= L\n if power == 1:\n print(i)\n sys.exit()\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-power = 7", "-SUM = 0", "+L = 9 * K", "+if K % 7 == 0:", "+ L //= 7", "+power = 1", "- SUM += power", "- if SUM % K == 0:", "+ power *= 10", "+ power %= L", "+ if power == 1:", "- power *= 10", "- power %= K"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9885553987, "measured_runtime_v1": 0.6379526145, "runtime_lift": 1.5495749624, "key": ["s892012548", "s295850055"]} +{"user_id": "u497046426", "problem_id": "p03568", "language": "python", "submission_id_v0": "s711599117", "submission_id_v1": "s424536945", "cpu_time_v0": 181, "cpu_time_v1": 17, "memory_v0": 3572, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 90.61, "input": "from functools import reduce\n\nfrom itertools import product\n\n\n\nN = int(input())\n\n*A, = list(map(int, input().split()))\n\nans = 0\n\nfor t in product([-1, 0, 1], repeat=N):\n\n prod = reduce(lambda x, y: x*y, [a + t[i] for i, a in enumerate(A)])\n\n if prod % 2 == 0: ans += 1\n\nprint(ans)", "target": "N = int(input())\n\n*A, = list(map(int, input().split()))\n\nevens = 0\n\nfor a in A:\n\n if a % 2 == 0: evens += 1\n\nans = 3**N - 2**evens\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 280, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "from functools import reduce\nfrom itertools import product\n\nN = int(input())\n(*A,) = list(map(int, input().split()))\nans = 0\nfor t in product([-1, 0, 1], repeat=N):\n prod = reduce(lambda x, y: x * y, [a + t[i] for i, a in enumerate(A)])\n if prod % 2 == 0:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\n(*A,) = list(map(int, input().split()))\nevens = 0\nfor a in A:\n if a % 2 == 0:\n evens += 1\nans = 3**N - 2**evens\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-from functools import reduce", "-from itertools import product", "-", "-ans = 0", "-for t in product([-1, 0, 1], repeat=N):", "- prod = reduce(lambda x, y: x * y, [a + t[i] for i, a in enumerate(A)])", "- if prod % 2 == 0:", "- ans += 1", "+evens = 0", "+for a in A:", "+ if a % 2 == 0:", "+ evens += 1", "+ans = 3**N - 2**evens"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6547077734, "measured_runtime_v1": 0.2760411811, "runtime_lift": 2.3717757287, "key": ["s711599117", "s424536945"]} +{"user_id": "u306664745", "problem_id": "p02983", "language": "python", "submission_id_v0": "s965697641", "submission_id_v1": "s560038811", "cpu_time_v0": 68, "cpu_time_v1": 56, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.65, "input": "l, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (((i%2019)*(j%2019))%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)", "target": "l, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (i*j%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 217, "code_v1_num_chars": 201, "code_v0_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 672:\n p = 0\nelse:\n p = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n p = min(p, (((i % 2019) * (j % 2019)) % 2019))\n if not p:\n break\n if not p:\n break\nprint(p)\n", "code_v1_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 672:\n p = 0\nelse:\n p = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n p = min(p, (i * j % 2019))\n if not p:\n break\n if not p:\n break\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- p = min(p, (((i % 2019) * (j % 2019)) % 2019))", "+ p = min(p, (i * j % 2019))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3854847456, "measured_runtime_v1": 0.191389215, "runtime_lift": 2.0141403766, "key": ["s965697641", "s560038811"]} +{"user_id": "u046592970", "problem_id": "p03371", "language": "python", "submission_id_v0": "s911937877", "submission_id_v1": "s225349134", "cpu_time_v0": 121, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.95, "input": "a,b,c,x,y = list(map(int,input().split()))\n\nprice = 10**10\n\nfor k in range(10**5+1):\n\n re = 2*c*k + max(0,x-k)*a + max(0,y-k)*b\n\n price = min(re,price)\n\nprint(price)", "target": "a,b,c,x,y = list(map(int,input().split()))\n\na1 = a*x + b*y\n\na2 = max(x,y) * 2*c\n\nif y >= x:\n\n a3 = 2*c*x + (y-x)*b\n\nelse:\n\n a3 = 2*c*y + (x-y)*a\n\nprint((min(a1,a2,a3)))", "code_v0_loc": 6, "code_v1_loc": 8, "code_v0_num_chars": 165, "code_v1_num_chars": 166, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nprice = 10**10\nfor k in range(10**5 + 1):\n re = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b\n price = min(re, price)\nprint(price)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\na1 = a * x + b * y\na2 = max(x, y) * 2 * c\nif y >= x:\n a3 = 2 * c * x + (y - x) * b\nelse:\n a3 = 2 * c * y + (x - y) * a\nprint((min(a1, a2, a3)))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-price = 10**10", "-for k in range(10**5 + 1):", "- re = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b", "- price = min(re, price)", "-print(price)", "+a1 = a * x + b * y", "+a2 = max(x, y) * 2 * c", "+if y >= x:", "+ a3 = 2 * c * x + (y - x) * b", "+else:", "+ a3 = 2 * c * y + (x - y) * a", "+print((min(a1, a2, a3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4459569323, "measured_runtime_v1": 0.1564870899, "runtime_lift": 2.8498001506, "key": ["s911937877", "s225349134"]} +{"user_id": "u597374218", "problem_id": "p03796", "language": "python", "submission_id_v0": "s873197292", "submission_id_v1": "s712740845", "cpu_time_v0": 231, "cpu_time_v1": 40, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.68, "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "target": "ans=1\n\nn=int(input())\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 6, "code_v0_num_chars": 58, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nn = int(input())\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % (10**9 + 7)))", "+ans = 1", "+n = int(input())", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans = ans % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5415332041, "measured_runtime_v1": 0.2632789848, "runtime_lift": 2.0568797183, "key": ["s873197292", "s712740845"]} +{"user_id": "u222668979", "problem_id": "p02996", "language": "python", "submission_id_v0": "s000658921", "submission_id_v1": "s911267857", "cpu_time_v0": 791, "cpu_time_v1": 572, "memory_v0": 38028, "memory_v1": 117796, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.69, "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(input())\n\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\n\n\n\ncnt = 0\n\nfor b, a in ab:\n\n cnt += a\n\n if cnt > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n", "target": "n = int(input())\n\nab = [list(map(int, input().split())) for _ in range(n)]\n\nab = sorted(ab, key=lambda x: x[1])\n\n\n\nt = 0\n\nfor a, b in ab:\n\n t += a\n\n if t > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 251, "code_v1_num_chars": 226, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nn = int(input())\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\ncnt = 0\nfor b, a in ab:\n cnt += a\n if cnt > b:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_v1_no_empty_lines": "n = int(input())\nab = [list(map(int, input().split())) for _ in range(n)]\nab = sorted(ab, key=lambda x: x[1])\nt = 0\nfor a, b in ab:\n t += a\n if t > b:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-ab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])", "-cnt = 0", "-for b, a in ab:", "- cnt += a", "- if cnt > b:", "+ab = [list(map(int, input().split())) for _ in range(n)]", "+ab = sorted(ab, key=lambda x: x[1])", "+t = 0", "+for a, b in ab:", "+ t += a", "+ if t > b:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2345721078, "measured_runtime_v1": 0.0064230425, "runtime_lift": 36.5204038616, "key": ["s000658921", "s911267857"]} +{"user_id": "u896741788", "problem_id": "p03037", "language": "python", "submission_id_v0": "s129241236", "submission_id_v1": "s743438543", "cpu_time_v0": 355, "cpu_time_v1": 218, "memory_v0": 7832, "memory_v1": 15472, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 38.59, "input": "k,m=list(map(int,input().split()))\n\nl=[0 for i in range(k+1)]\n\nfor i in range(m):\n\n a,s=list(map(int,input().split()))\n\n l[a-1]+=1;l[s]-=1\n\nans=0\n\nf=0\n\nfor j in range(k):\n\n l[j]+=f\n\n f=l[j]\n\nprint((len([1 for i in l if i==m])))", "target": "n,m=list(map(int,input().split()))\n\ntable=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n table[l]+=1\n\n table[r+1]-=1\n\nfrom itertools import accumulate\n\nfrom collections import Counter as co\n\nvar=co((accumulate(table)))\n\n\n\nif m not in var:print((0))\n\nelse:print((var[m]))\n\n\n\n\n", "code_v0_loc": 11, "code_v1_loc": 14, "code_v0_num_chars": 217, "code_v1_num_chars": 290, "code_v0_no_empty_lines": "k, m = list(map(int, input().split()))\nl = [0 for i in range(k + 1)]\nfor i in range(m):\n a, s = list(map(int, input().split()))\n l[a - 1] += 1\n l[s] -= 1\nans = 0\nf = 0\nfor j in range(k):\n l[j] += f\n f = l[j]\nprint((len([1 for i in l if i == m])))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\ntable = [0] * (n + 2)\nfor i in range(m):\n l, r = list(map(int, input().split()))\n table[l] += 1\n table[r + 1] -= 1\nfrom itertools import accumulate\nfrom collections import Counter as co\n\nvar = co((accumulate(table)))\nif m not in var:\n print((0))\nelse:\n print((var[m]))\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-k, m = list(map(int, input().split()))", "-l = [0 for i in range(k + 1)]", "+n, m = list(map(int, input().split()))", "+table = [0] * (n + 2)", "- a, s = list(map(int, input().split()))", "- l[a - 1] += 1", "- l[s] -= 1", "-ans = 0", "-f = 0", "-for j in range(k):", "- l[j] += f", "- f = l[j]", "-print((len([1 for i in l if i == m])))", "+ l, r = list(map(int, input().split()))", "+ table[l] += 1", "+ table[r + 1] -= 1", "+from itertools import accumulate", "+from collections import Counter as co", "+", "+var = co((accumulate(table)))", "+if m not in var:", "+ print((0))", "+else:", "+ print((var[m]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4122046263, "measured_runtime_v1": 0.3202181025, "runtime_lift": 1.2872620978, "key": ["s129241236", "s743438543"]} +{"user_id": "u442877951", "problem_id": "p02881", "language": "python", "submission_id_v0": "s498895748", "submission_id_v1": "s605488454", "cpu_time_v0": 574, "cpu_time_v1": 295, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.61, "input": "import math\n\nN = int(input())\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = math.ceil(N/(i+1))\n\n if (1+i)*j == N:\n\n ans = min(i+j-1,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)", "target": "N = int(input())\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = N//i\n\n if i*j == N:\n\n ans = min(i+j-2,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 217, "code_v1_num_chars": 186, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = 10**12\nfor i in range(1, 10**6 + 1):\n j = math.ceil(N / (i + 1))\n if (1 + i) * j == N:\n ans = min(i + j - 1, ans)\n if i == 10**6 and ans == 10**12:\n ans = N - 1\n break\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nans = 10**12\nfor i in range(1, 10**6 + 1):\n j = N // i\n if i * j == N:\n ans = min(i + j - 2, ans)\n if i == 10**6 and ans == 10**12:\n ans = N - 1\n break\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-import math", "-", "- j = math.ceil(N / (i + 1))", "- if (1 + i) * j == N:", "- ans = min(i + j - 1, ans)", "+ j = N // i", "+ if i * j == N:", "+ ans = min(i + j - 2, ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 3.3566168053, "measured_runtime_v1": 2.0076369724, "runtime_lift": 1.6719241832, "key": ["s498895748", "s605488454"]} +{"user_id": "u539692012", "problem_id": "p02622", "language": "python", "submission_id_v0": "s511745855", "submission_id_v1": "s953276742", "cpu_time_v0": 78, "cpu_time_v1": 44, "memory_v0": 68212, "memory_v1": 9464, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.59, "input": "print((sum(si != ti for si, ti in zip(input(), input()))))\n", "target": "print((sum(a!=b for a,b in zip(*open(0)))))", "code_v0_loc": 1, "code_v1_loc": 1, "code_v0_num_chars": 57, "code_v1_num_chars": 41, "code_v0_no_empty_lines": "print((sum(si != ti for si, ti in zip(input(), input()))))\n", "code_v1_no_empty_lines": "print((sum(a != b for a, b in zip(*open(0)))))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-print((sum(si != ti for si, ti in zip(input(), input()))))", "+print((sum(a != b for a, b in zip(*open(0)))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3334237881, "measured_runtime_v1": 0.1220404458, "runtime_lift": 2.7320761232, "key": ["s511745855", "s953276742"]} +{"user_id": "u540631540", "problem_id": "p02767", "language": "python", "submission_id_v0": "s304816826", "submission_id_v1": "s138180908", "cpu_time_v0": 22, "cpu_time_v1": 19, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.64, "input": "n = int(input())\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n # else:\n\n # break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)", "target": "n = int(input())\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n else:\n\n break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 269, "code_v1_num_chars": 265, "code_v0_no_empty_lines": "n = int(input())\nx = [int(i) for i in input().split()]\np = 10000000\nfor i in range(100):\n pi = 0\n for j in range(n):\n pi += (x[j] - (i + 1)) ** 2\n if pi < p:\n p = pi\n # else:\n # break\n # p[i] += (x[j]-(i+1))**2\nprint(p)\n", "code_v1_no_empty_lines": "n = int(input())\nx = [int(i) for i in input().split()]\np = 10000000\nfor i in range(100):\n pi = 0\n for j in range(n):\n pi += (x[j] - (i + 1)) ** 2\n if pi < p:\n p = pi\n else:\n break\n # p[i] += (x[j]-(i+1))**2\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- # else:", "- # break", "- # p[i] += (x[j]-(i+1))**2", "+ else:", "+ break", "+ # p[i] += (x[j]-(i+1))**2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.18753242, "measured_runtime_v1": 0.0060767163, "runtime_lift": 30.860815536, "key": ["s304816826", "s138180908"]} +{"user_id": "u777923818", "problem_id": "p03086", "language": "python", "submission_id_v0": "s716593637", "submission_id_v1": "s955967436", "cpu_time_v0": 22, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.73, "input": "# -*- coding: utf-8 -*-\n\nfrom collections import deque\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nS = input()\n\nA = set(\"ATCG\")\n\nans = 0\n\nmode = 0\n\nfor i, s in enumerate(S):\n\n if s in A:\n\n if mode == 0:\n\n mode = 1\n\n start = i\n\n else:\n\n if mode == 1:\n\n ans = max(i - start, ans)\n\n mode = 0\n\nif mode == 1:\n\n ans = max(len(S) - start, ans)\n\nprint(ans)", "target": "def inpl(): return list(map(int, input().split()))\n\nS = input()\n\nC = set(\"ACGT\")\n\n\n\ntmp = 0\n\nans = 0\n\n\n\nfor s in S:\n\n if s in C:\n\n tmp += 1\n\n else:\n\n ans = max(ans, tmp)\n\n tmp = 0\n\nans = max(ans, tmp)\n\nprint(ans)", "code_v0_loc": 20, "code_v1_loc": 15, "code_v0_num_chars": 426, "code_v1_num_chars": 239, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nfrom collections import deque\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\nS = input()\nA = set(\"ATCG\")\nans = 0\nmode = 0\nfor i, s in enumerate(S):\n if s in A:\n if mode == 0:\n mode = 1\n start = i\n else:\n if mode == 1:\n ans = max(i - start, ans)\n mode = 0\nif mode == 1:\n ans = max(len(S) - start, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "def inpl():\n return list(map(int, input().split()))\n\n\nS = input()\nC = set(\"ACGT\")\ntmp = 0\nans = 0\nfor s in S:\n if s in C:\n tmp += 1\n else:\n ans = max(ans, tmp)\n tmp = 0\nans = max(ans, tmp)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-# -*- coding: utf-8 -*-", "-from collections import deque", "-", "-", "-A = set(\"ATCG\")", "+C = set(\"ACGT\")", "+tmp = 0", "-mode = 0", "-for i, s in enumerate(S):", "- if s in A:", "- if mode == 0:", "- mode = 1", "- start = i", "+for s in S:", "+ if s in C:", "+ tmp += 1", "- if mode == 1:", "- ans = max(i - start, ans)", "- mode = 0", "-if mode == 1:", "- ans = max(len(S) - start, ans)", "+ ans = max(ans, tmp)", "+ tmp = 0", "+ans = max(ans, tmp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1640799, "measured_runtime_v1": 0.006362747, "runtime_lift": 25.7875884356, "key": ["s716593637", "s955967436"]} +{"user_id": "u854690176", "problem_id": "p02952", "language": "python", "submission_id_v0": "s720457111", "submission_id_v1": "s185706611", "cpu_time_v0": 60, "cpu_time_v1": 51, "memory_v0": 2940, "memory_v1": 6732, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N = int(input())\n\nans = 0\n\nfor i in range(1, N + 1):\n\n if len(str(i)) % 2 == 1:\n\n ans += 1\n\nprint(ans)", "target": "N = int(input())\n\nprint((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))", "code_v0_loc": 6, "code_v1_loc": 2, "code_v0_num_chars": 112, "code_v1_num_chars": 91, "code_v0_no_empty_lines": "N = int(input())\nans = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 == 1:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nprint((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-ans = 0", "-for i in range(1, N + 1):", "- if len(str(i)) % 2 == 1:", "- ans += 1", "-print(ans)", "+print((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1607959216, "measured_runtime_v1": 0.006350698, "runtime_lift": 25.3194092141, "key": ["s720457111", "s185706611"]} +{"user_id": "u282228874", "problem_id": "p03353", "language": "python", "submission_id_v0": "s703764972", "submission_id_v1": "s575406884", "cpu_time_v0": 39, "cpu_time_v1": 34, "memory_v0": 4976, "memory_v1": 4592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.82, "input": "S = input()\n\nk = int(input())\n\nA = set()\n\nfor l in range(k+1):\n\n\tfor i in range(len(S)-l):\n\n\t\t\tA.add(S[i:i+l+1])\n\nA = sorted(list(A))\n\nprint((A[k-1]))", "target": "S = input()\n\nl = len(S)\n\nd = set()\n\nK = int(input())\n\nfor i in range(5):\n\n for j in range(l-i):\n\n d.add(S[j:j+i+1])\n\nD = sorted(list(d))\n\nprint((D[K-1]))", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 148, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "S = input()\nk = int(input())\nA = set()\nfor l in range(k + 1):\n for i in range(len(S) - l):\n A.add(S[i : i + l + 1])\nA = sorted(list(A))\nprint((A[k - 1]))\n", "code_v1_no_empty_lines": "S = input()\nl = len(S)\nd = set()\nK = int(input())\nfor i in range(5):\n for j in range(l - i):\n d.add(S[j : j + i + 1])\nD = sorted(list(d))\nprint((D[K - 1]))\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-k = int(input())", "-A = set()", "-for l in range(k + 1):", "- for i in range(len(S) - l):", "- A.add(S[i : i + l + 1])", "-A = sorted(list(A))", "-print((A[k - 1]))", "+l = len(S)", "+d = set()", "+K = int(input())", "+for i in range(5):", "+ for j in range(l - i):", "+ d.add(S[j : j + i + 1])", "+D = sorted(list(d))", "+print((D[K - 1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2549800012, "measured_runtime_v1": 0.1151928709, "runtime_lift": 2.2135050485, "key": ["s703764972", "s575406884"]} +{"user_id": "u047796752", "problem_id": "p02693", "language": "python", "submission_id_v0": "s690438210", "submission_id_v1": "s726211396", "cpu_time_v0": 69, "cpu_time_v1": 61, "memory_v0": 64680, "memory_v1": 61880, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.59, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nK = int(input())\n\nA, B = list(map(int, input().split()))\n\n\n\nfor i in range(A, B+1):\n\n if i%K==0:\n\n print('OK')\n\n exit()\n\n \n\nprint('NG')", "target": "K = int(input())\n\nA, B = list(map(int, input().split()))\n\n\n\nif (A-1)//K!=B//K:\n\n print('OK')\n\nelse:\n\n print('NG')", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 218, "code_v1_num_chars": 113, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\nK = int(input())\nA, B = list(map(int, input().split()))\nfor i in range(A, B + 1):\n if i % K == 0:\n print(\"OK\")\n exit()\nprint(\"NG\")\n", "code_v1_no_empty_lines": "K = int(input())\nA, B = list(map(int, input().split()))\nif (A - 1) // K != B // K:\n print(\"OK\")\nelse:\n print(\"NG\")\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-from collections import *", "-", "-for i in range(A, B + 1):", "- if i % K == 0:", "- print(\"OK\")", "- exit()", "-print(\"NG\")", "+if (A - 1) // K != B // K:", "+ print(\"OK\")", "+else:", "+ print(\"NG\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2312573931, "measured_runtime_v1": 0.006134352, "runtime_lift": 37.6987486082, "key": ["s690438210", "s726211396"]} +{"user_id": "u803848678", "problem_id": "p03558", "language": "python", "submission_id_v0": "s650935446", "submission_id_v1": "s013593877", "cpu_time_v0": 647, "cpu_time_v1": 206, "memory_v0": 80204, "memory_v1": 46940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 68.16, "input": "from heapq import heappush, heappop\n\nk = int(input())\n\n\n\nheap = [(1,1)]\n\ndist = [float(\"inf\")]*k\n\nwhile heap:\n\n cost, cur = heappop(heap)\n\n if dist[cur] <= cost:\n\n continue\n\n dist[cur] = cost\n\n # +1\n\n nxt = (cur+1)%k\n\n heappush(heap, (cost+1, nxt))\n\n # *10\n\n nxt = cur*10 % k\n\n heappush(heap, (cost, nxt))\n\n\n\nprint((dist[0]))", "target": "from collections import deque\n\nk = int(input())\n\n\n\nque = deque()\n\nque.append((1,1))\n\ndist = [float(\"inf\")]*k\n\nwhile que:\n\n cost, cur = que.popleft()\n\n if dist[cur] <= cost:\n\n continue\n\n dist[cur] = cost\n\n # +1\n\n nxt = (cur+1)%k\n\n que.append((cost+1,nxt))\n\n # *10\n\n nxt = cur*10 % k\n\n que.appendleft((cost, nxt))\n\nprint((dist[0]))", "code_v0_loc": 18, "code_v1_loc": 18, "code_v0_num_chars": 357, "code_v1_num_chars": 361, "code_v0_no_empty_lines": "from heapq import heappush, heappop\n\nk = int(input())\nheap = [(1, 1)]\ndist = [float(\"inf\")] * k\nwhile heap:\n cost, cur = heappop(heap)\n if dist[cur] <= cost:\n continue\n dist[cur] = cost\n # +1\n nxt = (cur + 1) % k\n heappush(heap, (cost + 1, nxt))\n # *10\n nxt = cur * 10 % k\n heappush(heap, (cost, nxt))\nprint((dist[0]))\n", "code_v1_no_empty_lines": "from collections import deque\n\nk = int(input())\nque = deque()\nque.append((1, 1))\ndist = [float(\"inf\")] * k\nwhile que:\n cost, cur = que.popleft()\n if dist[cur] <= cost:\n continue\n dist[cur] = cost\n # +1\n nxt = (cur + 1) % k\n que.append((cost + 1, nxt))\n # *10\n nxt = cur * 10 % k\n que.appendleft((cost, nxt))\nprint((dist[0]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-from heapq import heappush, heappop", "+from collections import deque", "-heap = [(1, 1)]", "+que = deque()", "+que.append((1, 1))", "-while heap:", "- cost, cur = heappop(heap)", "+while que:", "+ cost, cur = que.popleft()", "- heappush(heap, (cost + 1, nxt))", "+ que.append((cost + 1, nxt))", "- heappush(heap, (cost, nxt))", "+ que.appendleft((cost, nxt))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7778599041, "measured_runtime_v1": 0.4842932501, "runtime_lift": 1.6061753987, "key": ["s650935446", "s013593877"]} +{"user_id": "u853010060", "problem_id": "p02921", "language": "python", "submission_id_v0": "s066833687", "submission_id_v1": "s453964878", "cpu_time_v0": 21, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.05, "input": "S = input()\n\nT = input()\n\n\n\nl = len(S)\n\nres = 0\n\nfor n in range(l):\n\n if S[n] == T[n]:\n\n res += 1\n\nprint(res)", "target": "S = input()\n\nT = input()\n\nl = len(S)\n\nans = 0\n\nfor n in range(l):\n\n if S[n] == T[n]:\n\n ans += 1\n\nprint(ans)\n", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 119, "code_v1_num_chars": 118, "code_v0_no_empty_lines": "S = input()\nT = input()\nl = len(S)\nres = 0\nfor n in range(l):\n if S[n] == T[n]:\n res += 1\nprint(res)\n", "code_v1_no_empty_lines": "S = input()\nT = input()\nl = len(S)\nans = 0\nfor n in range(l):\n if S[n] == T[n]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-res = 0", "+ans = 0", "- res += 1", "-print(res)", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3049550076, "measured_runtime_v1": 0.2412325363, "runtime_lift": 1.2641537174, "key": ["s066833687", "s453964878"]} +{"user_id": "u884323674", "problem_id": "p03371", "language": "python", "submission_id_v0": "s486102959", "submission_id_v1": "s507293588", "cpu_time_v0": 228, "cpu_time_v1": 129, "memory_v0": 3064, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.42, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nmax_iter = max(X, Y) * 2\n\nans = float(\"inf\")\n\nfor i in range(max_iter):\n\n a = max(X - i, 0)\n\n b = max(Y - i, 0)\n\n price = 2*C * i + A * a + B * b\n\n ans = min(ans, price)\n\n\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float(\"inf\")\n\nfor i in range(max(X, Y)+1):\n\n x = max(X - i, 0)\n\n y = max(Y - i, 0)\n\n cost = 2*C * i + A * x + B * y\n\n ans = min(ans, cost)\n\n\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 240, "code_v1_num_chars": 215, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nmax_iter = max(X, Y) * 2\nans = float(\"inf\")\nfor i in range(max_iter):\n a = max(X - i, 0)\n b = max(Y - i, 0)\n price = 2 * C * i + A * a + B * b\n ans = min(ans, price)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(max(X, Y) + 1):\n x = max(X - i, 0)\n y = max(Y - i, 0)\n cost = 2 * C * i + A * x + B * y\n ans = min(ans, cost)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-max_iter = max(X, Y) * 2", "-for i in range(max_iter):", "- a = max(X - i, 0)", "- b = max(Y - i, 0)", "- price = 2 * C * i + A * a + B * b", "- ans = min(ans, price)", "+for i in range(max(X, Y) + 1):", "+ x = max(X - i, 0)", "+ y = max(Y - i, 0)", "+ cost = 2 * C * i + A * x + B * y", "+ ans = min(ans, cost)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4454369638, "measured_runtime_v1": 0.3371012073, "runtime_lift": 1.321374573, "key": ["s486102959", "s507293588"]} +{"user_id": "u982896977", "problem_id": "p03371", "language": "python", "submission_id_v0": "s299972417", "submission_id_v1": "s929413776", "cpu_time_v0": 102, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.33, "input": "a,b,c,x,y = list(map(int,input().split()))\n\nans = a*x + b*y\n\nfor i in range(max(x,y) + 1):\n\n\tmoney = max(0,(x-i)*a) + max(0,(y-i)*b) + 2*i*c\n\n\tif money <= ans:\n\n\t\tans = money\n\nprint(ans)", "target": "a,b,c,x,y = list(map(int,input().split()))\n\nif a + b >= 2*c:\n\n\tif x >= y:\n\n\t\tans = 2*y*c + (x-y)*min(a,2*c)\n\n\telse:\n\n\t\tans = 2*x*c + (y-x)*min(b,2*c)\n\nelse:\n\n\tans = (x*a + y*b)\n\nprint(ans)", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 180, "code_v1_num_chars": 182, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nfor i in range(max(x, y) + 1):\n money = max(0, (x - i) * a) + max(0, (y - i) * b) + 2 * i * c\n if money <= ans:\n ans = money\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nif a + b >= 2 * c:\n if x >= y:\n ans = 2 * y * c + (x - y) * min(a, 2 * c)\n else:\n ans = 2 * x * c + (y - x) * min(b, 2 * c)\nelse:\n ans = x * a + y * b\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-ans = a * x + b * y", "-for i in range(max(x, y) + 1):", "- money = max(0, (x - i) * a) + max(0, (y - i) * b) + 2 * i * c", "- if money <= ans:", "- ans = money", "+if a + b >= 2 * c:", "+ if x >= y:", "+ ans = 2 * y * c + (x - y) * min(a, 2 * c)", "+ else:", "+ ans = 2 * x * c + (y - x) * min(b, 2 * c)", "+else:", "+ ans = x * a + y * b"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3295188012, "measured_runtime_v1": 0.2310098734, "runtime_lift": 1.4264273486, "key": ["s299972417", "s929413776"]} +{"user_id": "u546285759", "problem_id": "p00500", "language": "python", "submission_id_v0": "s199562246", "submission_id_v1": "s512442556", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7644, "memory_v1": 7672, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "N = int(input())\n\nscore = [list(map(int, input().split())) for _ in range(N)]\n\nplayers = [0 for _ in range(N)]\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += p\n\nprint(*players, sep='\\n')\n", "target": "N = int(input())\n\nscore = [input().split() for _ in range(N)]\n\nplayers = [0]*N\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += int(p)\n\nprint(*players, sep='\\n')\n", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 264, "code_v1_num_chars": 237, "code_v0_no_empty_lines": "N = int(input())\nscore = [list(map(int, input().split())) for _ in range(N)]\nplayers = [0 for _ in range(N)]\nfor play in list(zip(*score)):\n for i, p in enumerate(play):\n if play.count(p) == 1:\n players[i] += p\nprint(*players, sep=\"\\n\")\n", "code_v1_no_empty_lines": "N = int(input())\nscore = [input().split() for _ in range(N)]\nplayers = [0] * N\nfor play in list(zip(*score)):\n for i, p in enumerate(play):\n if play.count(p) == 1:\n players[i] += int(p)\nprint(*players, sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-score = [list(map(int, input().split())) for _ in range(N)]", "-players = [0 for _ in range(N)]", "+score = [input().split() for _ in range(N)]", "+players = [0] * N", "- players[i] += p", "+ players[i] += int(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3026783457, "measured_runtime_v1": 0.2355215042, "runtime_lift": 1.2851410182, "key": ["s199562246", "s512442556"]} +{"user_id": "u419963262", "problem_id": "p03170", "language": "python", "submission_id_v0": "s690193516", "submission_id_v1": "s176737022", "cpu_time_v0": 1807, "cpu_time_v1": 395, "memory_v0": 3828, "memory_v1": 43416, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.14, "input": "n,k = list(map(int,input().split()))\n\narr = list(map(int,input().split()))\n\n\n\ndp = [False]*(k+1)\n\n\n\nfor stones in range(k+1):\n\n for x in arr:\n\n if stones >= x and dp[stones-x] == False:\n\n dp[stones] = True\n\n\n\nif dp[k]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")\n", "target": "N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\n\n\ndp = [False]*(K+1)\n\n\n\nfor i in range(K+1):\n\n for j in range(N):\n\n if i-A[j]>=0 and dp[i-A[j]] == False:\n\n dp[i] = True\n\n\n\n \n\nif dp[K]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")", "code_v0_loc": 14, "code_v1_loc": 15, "code_v0_num_chars": 282, "code_v1_num_chars": 280, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\narr = list(map(int, input().split()))\ndp = [False] * (k + 1)\nfor stones in range(k + 1):\n for x in arr:\n if stones >= x and dp[stones - x] == False:\n dp[stones] = True\nif dp[k]:\n print(\"First\")\nelse:\n print(\"Second\")\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\ndp = [False] * (K + 1)\nfor i in range(K + 1):\n for j in range(N):\n if i - A[j] >= 0 and dp[i - A[j]] == False:\n dp[i] = True\nif dp[K]:\n print(\"First\")\nelse:\n print(\"Second\")\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["-n, k = list(map(int, input().split()))", "-arr = list(map(int, input().split()))", "-dp = [False] * (k + 1)", "-for stones in range(k + 1):", "- for x in arr:", "- if stones >= x and dp[stones - x] == False:", "- dp[stones] = True", "-if dp[k]:", "+N, K = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "+dp = [False] * (K + 1)", "+for i in range(K + 1):", "+ for j in range(N):", "+ if i - A[j] >= 0 and dp[i - A[j]] == False:", "+ dp[i] = True", "+if dp[K]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2082244466, "measured_runtime_v1": 0.0065503952, "runtime_lift": 31.7880739295, "key": ["s690193516", "s176737022"]} +{"user_id": "u579833671", "problem_id": "p02419", "language": "python", "submission_id_v0": "s913061371", "submission_id_v1": "s394956399", "cpu_time_v0": 20, "cpu_time_v1": 10, "memory_v0": 4220, "memory_v1": 4212, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "W = input().lower()\n\ns = []\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n s.append(T[i].lower())\n\nans = 0\n\nfor i in range(len(s)):\n\n if(s[i] == W):\n\n ans += 1\n\nprint(ans)", "target": "W = input().lower()\n\ns = []\n\nans = 0\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n if(W == T[i].lower()):\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 294, "code_v1_num_chars": 257, "code_v0_no_empty_lines": "W = input().lower()\ns = []\nwhile True:\n T = list(map(str, input().split()))\n if T[0] == \"END_OF_TEXT\":\n break\n else:\n for i in range(len(T)):\n s.append(T[i].lower())\nans = 0\nfor i in range(len(s)):\n if s[i] == W:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "W = input().lower()\ns = []\nans = 0\nwhile True:\n T = list(map(str, input().split()))\n if T[0] == \"END_OF_TEXT\":\n break\n else:\n for i in range(len(T)):\n if W == T[i].lower():\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["+ans = 0", "- s.append(T[i].lower())", "-ans = 0", "-for i in range(len(s)):", "- if s[i] == W:", "- ans += 1", "+ if W == T[i].lower():", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1894613738, "measured_runtime_v1": 0.0060594826, "runtime_lift": 31.2669227389, "key": ["s913061371", "s394956399"]} +{"user_id": "u919633157", "problem_id": "p03796", "language": "python", "submission_id_v0": "s593917202", "submission_id_v1": "s901232961", "cpu_time_v0": 230, "cpu_time_v1": 42, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.74, "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "target": "n=int(input())\n\nans=1\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans%=10**9+7\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 6, "code_v0_num_chars": 58, "code_v1_num_chars": 87, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= 10**9 + 7\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % (10**9 + 7)))", "+n = int(input())", "+ans = 1", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= 10**9 + 7", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9124054093, "measured_runtime_v1": 0.4053284261, "runtime_lift": 2.2510274398, "key": ["s593917202", "s901232961"]} +{"user_id": "u414980766", "problem_id": "p02773", "language": "python", "submission_id_v0": "s498649498", "submission_id_v1": "s794455280", "cpu_time_v0": 480, "cpu_time_v1": 421, "memory_v0": 47872, "memory_v1": 43256, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.29, "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nS = sorted(S)\n\nls = [[] for i in range(N + 1)]\n\nmax_num = 0\n\nleft = 0\n\nright = 0\n\nwhile right < N:\n\n while right < N and S[left] == S[right]:\n\n right += 1\n\n if (right - left) >= max_num:\n\n ls[right - left].append(S[left].decode())\n\n max_num = right - left\n\n left = right\n\n \n\nprint(('\\n'.join(ls[max_num])))\n", "target": "from collections import Counter\n\n\n\nimport sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nres = []\n\nc = Counter(S)\n\nmax_num = c.most_common(1)[0][1]\n\nfor i, j in list(c.items()):\n\n if j == max_num:\n\n res.append(i)\n\n \n\nres.sort()\n\n\n\n \n\nprint(('\\n'.join(list([x.decode() for x in res]))))\n", "code_v0_loc": 21, "code_v1_loc": 20, "code_v0_num_chars": 502, "code_v1_num_chars": 421, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nS = read().split()\nS = sorted(S)\nls = [[] for i in range(N + 1)]\nmax_num = 0\nleft = 0\nright = 0\nwhile right < N:\n while right < N and S[left] == S[right]:\n right += 1\n if (right - left) >= max_num:\n ls[right - left].append(S[left].decode())\n max_num = right - left\n left = right\nprint((\"\\n\".join(ls[max_num])))\n", "code_v1_no_empty_lines": "from collections import Counter\nimport sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nS = read().split()\nres = []\nc = Counter(S)\nmax_num = c.most_common(1)[0][1]\nfor i, j in list(c.items()):\n if j == max_num:\n res.append(i)\nres.sort()\nprint((\"\\n\".join(list([x.decode() for x in res]))))\n", "code_same": false, "relative_loc_diff_percent": 4.7619047619, "diff": ["+from collections import Counter", "-S = sorted(S)", "-ls = [[] for i in range(N + 1)]", "-max_num = 0", "-left = 0", "-right = 0", "-while right < N:", "- while right < N and S[left] == S[right]:", "- right += 1", "- if (right - left) >= max_num:", "- ls[right - left].append(S[left].decode())", "- max_num = right - left", "- left = right", "-print((\"\\n\".join(ls[max_num])))", "+res = []", "+c = Counter(S)", "+max_num = c.most_common(1)[0][1]", "+for i, j in list(c.items()):", "+ if j == max_num:", "+ res.append(i)", "+res.sort()", "+print((\"\\n\".join(list([x.decode() for x in res]))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2394288239, "measured_runtime_v1": 0.0062145643, "runtime_lift": 38.5270488971, "key": ["s498649498", "s794455280"]} +{"user_id": "u021548497", "problem_id": "p02555", "language": "python", "submission_id_v0": "s983449721", "submission_id_v1": "s321084928", "cpu_time_v0": 330, "cpu_time_v1": 30, "memory_v0": 9192, "memory_v1": 9108, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 90.91, "input": "def main():\n\n n = int(input())\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(n+1):\n\n for j in range(i-2):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "def main():\n\n n = int(input())\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(3, n+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 15, "code_v1_loc": 14, "code_v0_num_chars": 242, "code_v1_num_chars": 226, "code_v0_no_empty_lines": "def main():\n n = int(input())\n dp = [0] * (n + 1)\n dp[0] = 1\n mod = pow(10, 9) + 7\n for i in range(n + 1):\n for j in range(i - 2):\n dp[i] += dp[j]\n dp[i] %= mod\n print((dp[n]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n n = int(input())\n dp = [0] * (n + 1)\n dp[0] = 1\n mod = pow(10, 9) + 7\n for i in range(3, n + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n dp[i] %= mod\n print((dp[n]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["- for i in range(n + 1):", "- for j in range(i - 2):", "- dp[i] += dp[j]", "- dp[i] %= mod", "+ for i in range(3, n + 1):", "+ dp[i] = dp[i - 1] + dp[i - 3]", "+ dp[i] %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6721006331, "measured_runtime_v1": 0.344866425, "runtime_lift": 1.9488723295, "key": ["s983449721", "s321084928"]} +{"user_id": "u672220554", "problem_id": "p02983", "language": "python", "submission_id_v0": "s554161170", "submission_id_v1": "s606893257", "cpu_time_v0": 990, "cpu_time_v1": 76, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.32, "input": "l,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n print(tres)\n", "target": "l,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n if tres == 0:\n\n break\n\n if tres == 0:\n\n break\n\n print(tres)\n", "code_v0_loc": 11, "code_v1_loc": 15, "code_v0_num_chars": 250, "code_v1_num_chars": 342, "code_v0_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 2019:\n print((0))\nelse:\n tres = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n mod = (i % 2019) * (j % 2019) % 2019\n tres = min(tres, mod)\n print(tres)\n", "code_v1_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 2019:\n print((0))\nelse:\n tres = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n mod = (i % 2019) * (j % 2019) % 2019\n tres = min(tres, mod)\n if tres == 0:\n break\n if tres == 0:\n break\n print(tres)\n", "code_same": false, "relative_loc_diff_percent": 26.6666666667, "diff": ["+ if tres == 0:", "+ break", "+ if tres == 0:", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2616734529, "measured_runtime_v1": 0.2086780975, "runtime_lift": 1.2539574397, "key": ["s554161170", "s606893257"]} +{"user_id": "u254871849", "problem_id": "p03309", "language": "python", "submission_id_v0": "s802702568", "submission_id_v1": "s939867576", "cpu_time_v0": 372, "cpu_time_v1": 200, "memory_v0": 27268, "memory_v1": 25180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.24, "input": "# author: kagemeka \n\n# created: 2019-11-08 14:51:29(JST)\n\n## internal modules\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\nimport statistics\n\n# import functools\n\n# import operator\n\n## external modules\n\n# import scipy.special # if use comb function on AtCoder, \n\n# import scipy.misc # select scipy.misc.comb (old version) \n\n\n\ndef main():\n\n n, *a = (int(x) for x in sys.stdin.read().split())\n\n \n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n\n\n if n % 2 != 0:\n\n b = statistics.median(a)\n\n else:\n\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n\n b = statistics.median_high(a)\n\n else:\n\n b = statistics.median_low(a)\n\n \n\n ans = sum([abs(a[i] - b) for i in range(n)])\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n\n\n\n\n", "target": "import sys\n\n\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\n\n\ndef main():\n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n a.sort()\n\n b = a[n // 2]\n\n res = 0\n\n for i in range(n):\n\n res += abs(a[i] - b)\n\n \n\n return res\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 40, "code_v1_loc": 18, "code_v0_num_chars": 987, "code_v1_num_chars": 310, "code_v0_no_empty_lines": "# author: kagemeka\n# created: 2019-11-08 14:51:29(JST)\n## internal modules\nimport sys\n\n# import collections\n# import math\n# import string\n# import bisect\n# import re\n# import itertools\nimport statistics\n\n# import functools\n# import operator\n## external modules\n# import scipy.special # if use comb function on AtCoder,\n# import scipy.misc # select scipy.misc.comb (old version)\ndef main():\n n, *a = (int(x) for x in sys.stdin.read().split())\n for i in range(n):\n a[i] -= i + 1\n if n % 2 != 0:\n b = statistics.median(a)\n else:\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n b = statistics.median_high(a)\n else:\n b = statistics.median_low(a)\n ans = sum([abs(a[i] - b) for i in range(n)])\n print(ans)\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n", "code_v1_no_empty_lines": "import sys\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\n\ndef main():\n for i in range(n):\n a[i] -= i + 1\n a.sort()\n b = a[n // 2]\n res = 0\n for i in range(n):\n res += abs(a[i] - b)\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 55.0, "diff": ["-# author: kagemeka", "-# created: 2019-11-08 14:51:29(JST)", "-## internal modules", "-# import collections", "-# import math", "-# import string", "-# import bisect", "-# import re", "-# import itertools", "-import statistics", "+n, *a = list(map(int, sys.stdin.read().split()))", "-# import functools", "-# import operator", "-## external modules", "-# import scipy.special # if use comb function on AtCoder,", "-# import scipy.misc # select scipy.misc.comb (old version)", "+", "- n, *a = (int(x) for x in sys.stdin.read().split())", "- if n % 2 != 0:", "- b = statistics.median(a)", "- else:", "- if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):", "- b = statistics.median_high(a)", "- else:", "- b = statistics.median_low(a)", "- ans = sum([abs(a[i] - b) for i in range(n)])", "- print(ans)", "+ a.sort()", "+ b = a[n // 2]", "+ res = 0", "+ for i in range(n):", "+ res += abs(a[i] - b)", "+ return res", "- # execute only if run as a script", "- main()", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2726693273, "measured_runtime_v1": 0.2052652476, "runtime_lift": 1.3283755066, "key": ["s802702568", "s939867576"]} +{"user_id": "u416758623", "problem_id": "p03416", "language": "python", "submission_id_v0": "s698254896", "submission_id_v1": "s209236188", "cpu_time_v0": 210, "cpu_time_v1": 54, "memory_v0": 3060, "memory_v1": 9152, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 74.29, "input": "def findSumDigit(num):\n\n global total\n\n total = \"\"\n\n while num > 0:\n\n total += str(num % 10)\n\n num //= 10\n\n return total\n\n\n\ndef main():\n\n a,b = list(map(int, input().split()))\n\n ans = 0\n\n for i in range(a,b+1):\n\n tmp = str(findSumDigit(i))\n\n if tmp == str(i):\n\n ans += 1\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "a, b = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor i in range(a,b+1):\n\n seki_gyaku = str(i)\n\n if seki_gyaku == seki_gyaku[::-1]:\n\n ans += 1\n\n\n\nprint(ans)\n", "code_v0_loc": 19, "code_v1_loc": 9, "code_v0_num_chars": 382, "code_v1_num_chars": 165, "code_v0_no_empty_lines": "def findSumDigit(num):\n global total\n total = \"\"\n while num > 0:\n total += str(num % 10)\n num //= 10\n return total\n\n\ndef main():\n a, b = list(map(int, input().split()))\n ans = 0\n for i in range(a, b + 1):\n tmp = str(findSumDigit(i))\n if tmp == str(i):\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n seki_gyaku = str(i)\n if seki_gyaku == seki_gyaku[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 52.6315789474, "diff": ["-def findSumDigit(num):", "- global total", "- total = \"\"", "- while num > 0:", "- total += str(num % 10)", "- num //= 10", "- return total", "-", "-", "-def main():", "- a, b = list(map(int, input().split()))", "- ans = 0", "- for i in range(a, b + 1):", "- tmp = str(findSumDigit(i))", "- if tmp == str(i):", "- ans += 1", "- print(ans)", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+a, b = list(map(int, input().split()))", "+ans = 0", "+for i in range(a, b + 1):", "+ seki_gyaku = str(i)", "+ if seki_gyaku == seki_gyaku[::-1]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.908202547, "measured_runtime_v1": 0.4125540495, "runtime_lift": 2.2014146949, "key": ["s698254896", "s209236188"]} +{"user_id": "u759412327", "problem_id": "p03680", "language": "python", "submission_id_v0": "s086989807", "submission_id_v1": "s510724514", "cpu_time_v0": 397, "cpu_time_v1": 201, "memory_v0": 7084, "memory_v1": 13724, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 49.37, "input": "N = int(input())\n\na = [int(input()) for i in range(N)]\n\nnow = a[0]\n\ncount = 1\n\nc = 0\n\nfor i in range(10**6):\n\n if now != 2:\n\n count += 1\n\n now = a[now - 1]\n\n else:\n\n print(count)\n\n c = 1\n\n break\n\nif c == 0:\n\n print((-1))\n", "target": "N = int(input())\n\na = [0] + [int(input()) for _ in range(N)]\n\nx = 1\n\nvisited = set([1])\n\nanswer = 0\n\n\n\nwhile True:\n\n x = a[x]\n\n if x in visited:\n\n answer = -1\n\n break\n\n visited.add(x)\n\n answer += 1\n\n if x == 2:\n\n break\n\n \n\nprint(answer)\n", "code_v0_loc": 15, "code_v1_loc": 17, "code_v0_num_chars": 263, "code_v1_num_chars": 254, "code_v0_no_empty_lines": "N = int(input())\na = [int(input()) for i in range(N)]\nnow = a[0]\ncount = 1\nc = 0\nfor i in range(10**6):\n if now != 2:\n count += 1\n now = a[now - 1]\n else:\n print(count)\n c = 1\n break\nif c == 0:\n print((-1))\n", "code_v1_no_empty_lines": "N = int(input())\na = [0] + [int(input()) for _ in range(N)]\nx = 1\nvisited = set([1])\nanswer = 0\nwhile True:\n x = a[x]\n if x in visited:\n answer = -1\n break\n visited.add(x)\n answer += 1\n if x == 2:\n break\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 11.7647058824, "diff": ["-a = [int(input()) for i in range(N)]", "-now = a[0]", "-count = 1", "-c = 0", "-for i in range(10**6):", "- if now != 2:", "- count += 1", "- now = a[now - 1]", "- else:", "- print(count)", "- c = 1", "+a = [0] + [int(input()) for _ in range(N)]", "+x = 1", "+visited = set([1])", "+answer = 0", "+while True:", "+ x = a[x]", "+ if x in visited:", "+ answer = -1", "-if c == 0:", "- print((-1))", "+ visited.add(x)", "+ answer += 1", "+ if x == 2:", "+ break", "+print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8020722582, "measured_runtime_v1": 0.2096916373, "runtime_lift": 3.8250083246, "key": ["s086989807", "s510724514"]} +{"user_id": "u860002137", "problem_id": "p02952", "language": "python", "submission_id_v0": "s726498671", "submission_id_v1": "s714071292", "cpu_time_v0": 61, "cpu_time_v1": 26, "memory_v0": 2940, "memory_v1": 9004, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.38, "input": "N = int(input())\n\n\n\nans = 0\n\n\n\nfor i in range(1, N+1):\n\n if len(str(i))%2==1:\n\n ans += 1\n\n\n\nprint(ans)", "target": "import sys\n\n\n\n\n\ndef rec(length):\n\n if length == 1:\n\n return 9\n\n else:\n\n return 9 * 10**(length - 1) + rec(length - 2)\n\n\n\n\n\nn = input()\n\nlength = len(n)\n\n\n\nif length == 1:\n\n print(n)\n\n sys.exit()\n\n\n\nif length % 2 == 0:\n\n ans = rec(length - 1)\n\nelse:\n\n ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1\n\n\n\nprint(ans)", "code_v0_loc": 9, "code_v1_loc": 23, "code_v0_num_chars": 112, "code_v1_num_chars": 363, "code_v0_no_empty_lines": "N = int(input())\nans = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 == 1:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\n\ndef rec(length):\n if length == 1:\n return 9\n else:\n return 9 * 10 ** (length - 1) + rec(length - 2)\n\n\nn = input()\nlength = len(n)\nif length == 1:\n print(n)\n sys.exit()\nif length % 2 == 0:\n ans = rec(length - 1)\nelse:\n ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 60.8695652174, "diff": ["-N = int(input())", "-ans = 0", "-for i in range(1, N + 1):", "- if len(str(i)) % 2 == 1:", "- ans += 1", "+import sys", "+", "+", "+def rec(length):", "+ if length == 1:", "+ return 9", "+ else:", "+ return 9 * 10 ** (length - 1) + rec(length - 2)", "+", "+", "+n = input()", "+length = len(n)", "+if length == 1:", "+ print(n)", "+ sys.exit()", "+if length % 2 == 0:", "+ ans = rec(length - 1)", "+else:", "+ ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2155013096, "measured_runtime_v1": 0.1672313638, "runtime_lift": 1.2886417043, "key": ["s726498671", "s714071292"]} +{"user_id": "u761320129", "problem_id": "p03425", "language": "python", "submission_id_v0": "s293375746", "submission_id_v1": "s279901441", "cpu_time_v0": 180, "cpu_time_v1": 149, "memory_v0": 10112, "memory_v1": 10876, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.22, "input": "import itertools\n\nfrom collections import Counter\n\nN = int(input())\n\nsrc = [input() for i in range(N)]\n\nctr = Counter()\n\nfor s in src:\n\n ctr[s[0]] += 1\n\n\n\nans = 0\n\nfor ptn in itertools.combinations('MARCH',3):\n\n a,b,c = ptn\n\n ans += ctr[a]*ctr[b]*ctr[c]\n\nprint(ans)", "target": "N = int(input())\n\nS = [input() for i in range(N)]\n\nfrom collections import Counter\n\nctr = Counter([s[0] for s in S])\n\n\n\nans = 0\n\nimport itertools\n\nfor ptn in itertools.combinations('MARCH', 3):\n\n t = 1\n\n for c in ptn:\n\n t *= ctr[c]\n\n ans += t\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 274, "code_v1_num_chars": 270, "code_v0_no_empty_lines": "import itertools\nfrom collections import Counter\n\nN = int(input())\nsrc = [input() for i in range(N)]\nctr = Counter()\nfor s in src:\n ctr[s[0]] += 1\nans = 0\nfor ptn in itertools.combinations(\"MARCH\", 3):\n a, b, c = ptn\n ans += ctr[a] * ctr[b] * ctr[c]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nS = [input() for i in range(N)]\nfrom collections import Counter\n\nctr = Counter([s[0] for s in S])\nans = 0\nimport itertools\n\nfor ptn in itertools.combinations(\"MARCH\", 3):\n t = 1\n for c in ptn:\n t *= ctr[c]\n ans += t\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-import itertools", "+N = int(input())", "+S = [input() for i in range(N)]", "-N = int(input())", "-src = [input() for i in range(N)]", "-ctr = Counter()", "-for s in src:", "- ctr[s[0]] += 1", "+ctr = Counter([s[0] for s in S])", "+import itertools", "+", "- a, b, c = ptn", "- ans += ctr[a] * ctr[b] * ctr[c]", "+ t = 1", "+ for c in ptn:", "+ t *= ctr[c]", "+ ans += t"], "diff_only_import_comment": false, "measured_runtime_v0": 0.206595207, "measured_runtime_v1": 0.1454657862, "runtime_lift": 1.420232292, "key": ["s293375746", "s279901441"]} +{"user_id": "u047102107", "problem_id": "p02952", "language": "python", "submission_id_v0": "s855248831", "submission_id_v1": "s153783643", "cpu_time_v0": 193, "cpu_time_v1": 64, "memory_v0": 40812, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.84, "input": "N = int(input())\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n num_dig = 0\n\n ii = i\n\n while ii > 0:\n\n ii = int(ii / 10)\n\n num_dig += 1\n\n if num_dig % 2 != 0:\n\n count += 1\n\n\n\nprint(count)", "target": "N = int(input())\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n if len(str(i)) % 2 != 0:\n\n count += 1\n\nprint(count)", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 215, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "N = int(input())\ncount = 0\nfor i in range(1, N + 1):\n num_dig = 0\n ii = i\n while ii > 0:\n ii = int(ii / 10)\n num_dig += 1\n if num_dig % 2 != 0:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "N = int(input())\ncount = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 != 0:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["- num_dig = 0", "- ii = i", "- while ii > 0:", "- ii = int(ii / 10)", "- num_dig += 1", "- if num_dig % 2 != 0:", "+ if len(str(i)) % 2 != 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3673675511, "measured_runtime_v1": 0.2702338476, "runtime_lift": 1.3594431427, "key": ["s855248831", "s153783643"]} +{"user_id": "u372550522", "problem_id": "p02801", "language": "python", "submission_id_v0": "s439687684", "submission_id_v1": "s397132828", "cpu_time_v0": 25, "cpu_time_v1": 17, "memory_v0": 3768, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.0, "input": "from string import ascii_lowercase as lower\n\nprint((lower[lower.find(input())+1]))", "target": "print((chr(ord(input())+1)))", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 80, "code_v1_num_chars": 26, "code_v0_no_empty_lines": "from string import ascii_lowercase as lower\n\nprint((lower[lower.find(input()) + 1]))\n", "code_v1_no_empty_lines": "print((chr(ord(input()) + 1)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-from string import ascii_lowercase as lower", "-", "-print((lower[lower.find(input()) + 1]))", "+print((chr(ord(input()) + 1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3241319713, "measured_runtime_v1": 0.2361063808, "runtime_lift": 1.3728217348, "key": ["s439687684", "s397132828"]} +{"user_id": "u419874471", "problem_id": "p04012", "language": "python", "submission_id_v0": "s872816747", "submission_id_v1": "s223982270", "cpu_time_v0": 32, "cpu_time_v1": 17, "memory_v0": 3956, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.88, "input": "import string\n\nw = input()\n\nfor a in string.ascii_lowercase:\n\n cnt = 0\n\n for t in w:\n\n if t == a:\n\n cnt = cnt + 1\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")", "target": "w = input()\n\nm = [0] * 26\n\nfor t in w:\n\n m[ord(t) - ord('a')] += 1\n\n\n\nfor cnt in m:\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")", "code_v0_loc": 12, "code_v1_loc": 11, "code_v0_num_chars": 212, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "import string\n\nw = input()\nfor a in string.ascii_lowercase:\n cnt = 0\n for t in w:\n if t == a:\n cnt = cnt + 1\n if cnt % 2 == 1:\n print(\"No\")\n exit()\nprint(\"Yes\")\n", "code_v1_no_empty_lines": "w = input()\nm = [0] * 26\nfor t in w:\n m[ord(t) - ord(\"a\")] += 1\nfor cnt in m:\n if cnt % 2 == 1:\n print(\"No\")\n exit()\nprint(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-import string", "-", "-for a in string.ascii_lowercase:", "- cnt = 0", "- for t in w:", "- if t == a:", "- cnt = cnt + 1", "+m = [0] * 26", "+for t in w:", "+ m[ord(t) - ord(\"a\")] += 1", "+for cnt in m:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2442542629, "measured_runtime_v1": 0.193693031, "runtime_lift": 1.2610379509, "key": ["s872816747", "s223982270"]} +{"user_id": "u133936772", "problem_id": "p03013", "language": "python", "submission_id_v0": "s323963688", "submission_id_v1": "s220101257", "cpu_time_v0": 187, "cpu_time_v1": 70, "memory_v0": 3828, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 62.57, "input": "mod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(input())-1] = 1\n\n\n\ns = 0\n\nt = 1\n\n\n\nfor i in range(n):\n\n if l[i] > 0:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\nmod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(input())-1] = 1\n\n\n\nt, s = 1, 0\n\n\n\nfor i in range(n):\n\n if l[i]:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 220, "code_v1_num_chars": 257, "code_v0_no_empty_lines": "mod = 10**9 + 7\nn, m = list(map(int, input().split()))\nl = [0] * n\nfor _ in range(m):\n l[int(input()) - 1] = 1\ns = 0\nt = 1\nfor i in range(n):\n if l[i] > 0:\n t, s = 0, t\n else:\n t, s = (s + t) % mod, t\nprint(t)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nmod = 10**9 + 7\nn, m = list(map(int, input().split()))\nl = [0] * n\nfor _ in range(m):\n l[int(input()) - 1] = 1\nt, s = 1, 0\nfor i in range(n):\n if l[i]:\n t, s = 0, t\n else:\n t, s = (s + t) % mod, t\nprint(t)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["+import sys", "+", "+input = sys.stdin.readline", "-s = 0", "-t = 1", "+t, s = 1, 0", "- if l[i] > 0:", "+ if l[i]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3071881404, "measured_runtime_v1": 0.1884790037, "runtime_lift": 1.6298268475, "key": ["s323963688", "s220101257"]} +{"user_id": "u911856499", "problem_id": "p03774", "language": "python", "submission_id_v0": "s205905114", "submission_id_v1": "s474977819", "cpu_time_v0": 31, "cpu_time_v1": 26, "memory_v0": 9140, "memory_v1": 9144, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.13, "input": "N,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 2*10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n", "target": "N,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 360, "code_v1_num_chars": 358, "code_v0_no_empty_lines": "N, M = [int(c) for c in input().split()]\nab = [list(map(int, input().split())) for c in range(N)]\ncd = [list(map(int, input().split())) for c in range(M)]\nfor i in range(N):\n mi = 2 * 10**9\n for j in range(M):\n tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n if mi > tmp:\n mi = tmp\n ans = j + 1\n print(ans)\n", "code_v1_no_empty_lines": "N, M = [int(c) for c in input().split()]\nab = [list(map(int, input().split())) for c in range(N)]\ncd = [list(map(int, input().split())) for c in range(M)]\nfor i in range(N):\n mi = 10**9\n for j in range(M):\n tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n if mi > tmp:\n mi = tmp\n ans = j + 1\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- mi = 2 * 10**9", "+ mi = 10**9"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2982070241, "measured_runtime_v1": 0.232865705, "runtime_lift": 1.2805965742, "key": ["s205905114", "s474977819"]} +{"user_id": "u187857228", "problem_id": "p03416", "language": "python", "submission_id_v0": "s720217601", "submission_id_v1": "s964731712", "cpu_time_v0": 154, "cpu_time_v1": 57, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 62.99, "input": "def test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n j = list(map(int,list(str(i))))\n\n if j[0] == j[4] and j[1] == j[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n", "target": "def test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n", "code_v0_loc": 12, "code_v1_loc": 11, "code_v0_num_chars": 261, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "def test():\n a, b = list(map(int, input().split()))\n count = 0\n for i in range(a, b + 1):\n j = list(map(int, list(str(i))))\n if j[0] == j[4] and j[1] == j[3]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n test()\n", "code_v1_no_empty_lines": "def test():\n a, b = list(map(int, input().split()))\n count = 0\n for i in range(a, b + 1):\n if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n test()\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["- j = list(map(int, list(str(i))))", "- if j[0] == j[4] and j[1] == j[3]:", "+ if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4881631348, "measured_runtime_v1": 0.3868406759, "runtime_lift": 1.2619229704, "key": ["s720217601", "s964731712"]} +{"user_id": "u624475441", "problem_id": "p03548", "language": "python", "submission_id_v0": "s161926153", "submission_id_v1": "s067842786", "cpu_time_v0": 36, "cpu_time_v1": 18, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "X, Y, Z = list(map(int, input().split()))\n\nfor n in range(10 ** 5, 0, -1):\n\n if X >= n * (Y + Z) + Z:\n\n break\n\nprint(n)", "target": "X, Y, Z = list(map(int, input().split()))\n\nprint(((X - Z) // (Y + Z)))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 123, "code_v1_num_chars": 62, "code_v0_no_empty_lines": "X, Y, Z = list(map(int, input().split()))\nfor n in range(10**5, 0, -1):\n if X >= n * (Y + Z) + Z:\n break\nprint(n)\n", "code_v1_no_empty_lines": "X, Y, Z = list(map(int, input().split()))\nprint(((X - Z) // (Y + Z)))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-for n in range(10**5, 0, -1):", "- if X >= n * (Y + Z) + Z:", "- break", "-print(n)", "+print(((X - Z) // (Y + Z)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4167550103, "measured_runtime_v1": 0.2488601058, "runtime_lift": 1.6746557624, "key": ["s161926153", "s067842786"]} +{"user_id": "u465961647", "problem_id": "p02576", "language": "python", "submission_id_v0": "s578033438", "submission_id_v1": "s457299018", "cpu_time_v0": 28, "cpu_time_v1": 25, "memory_v0": 9032, "memory_v1": 9096, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.71, "input": "array = list(map(int, input().split()))\n\nif array[0] % array[1] > 0:\n\n print(((array[0] // array[1] + 1) * array[2]))\n\nelse:\n\n print(((array[0] // array[1]) * array[2]))", "target": "n, x, t = list(map(int, input().split()))\n\n\n\nprint((0--n//x*t))", "code_v0_loc": 5, "code_v1_loc": 3, "code_v0_num_chars": 171, "code_v1_num_chars": 55, "code_v0_no_empty_lines": "array = list(map(int, input().split()))\nif array[0] % array[1] > 0:\n print(((array[0] // array[1] + 1) * array[2]))\nelse:\n print(((array[0] // array[1]) * array[2]))\n", "code_v1_no_empty_lines": "n, x, t = list(map(int, input().split()))\nprint((0 - -n // x * t))\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-array = list(map(int, input().split()))", "-if array[0] % array[1] > 0:", "- print(((array[0] // array[1] + 1) * array[2]))", "-else:", "- print(((array[0] // array[1]) * array[2]))", "+n, x, t = list(map(int, input().split()))", "+print((0 - -n // x * t))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1827679622, "measured_runtime_v1": 0.0061908547, "runtime_lift": 29.5222502437, "key": ["s578033438", "s457299018"]} +{"user_id": "u924353076", "problem_id": "p03796", "language": "python", "submission_id_v0": "s982585501", "submission_id_v1": "s413088188", "cpu_time_v0": 118, "cpu_time_v1": 40, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.1, "input": "n=input()\n\nn=int(n)\n\na=1\n\nfor i in range(n):\n\n a=a*(i+1)\n\n if a>=pow(10,9)+7:\n\n a=a%(pow(10,9)+7)\n\nprint(a)", "target": "n=int(input())\n\na=1\n\nfor i in range(1,n+1):\n\n a*=i\n\n a %= (10**9+7)\n\nprint(a)", "code_v0_loc": 8, "code_v1_loc": 6, "code_v0_num_chars": 120, "code_v1_num_chars": 83, "code_v0_no_empty_lines": "n = input()\nn = int(n)\na = 1\nfor i in range(n):\n a = a * (i + 1)\n if a >= pow(10, 9) + 7:\n a = a % (pow(10, 9) + 7)\nprint(a)\n", "code_v1_no_empty_lines": "n = int(input())\na = 1\nfor i in range(1, n + 1):\n a *= i\n a %= 10**9 + 7\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-n = input()", "-n = int(n)", "+n = int(input())", "-for i in range(n):", "- a = a * (i + 1)", "- if a >= pow(10, 9) + 7:", "- a = a % (pow(10, 9) + 7)", "+for i in range(1, n + 1):", "+ a *= i", "+ a %= 10**9 + 7"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4161043401, "measured_runtime_v1": 0.2489673834, "runtime_lift": 1.6713206943, "key": ["s982585501", "s413088188"]} +{"user_id": "u935184340", "problem_id": "p00003", "language": "python", "submission_id_v0": "s695745765", "submission_id_v1": "s444816349", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 7832, "memory_v1": 7708, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "import sys\n\nr = []\n\nn = int(input())\n\nl = sys.stdin.readlines()\n\nfor i in l:\n\n x, y, z = sorted([x*x for x in list(map(int, i.split()))])\n\n if x + y == z:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")", "target": "import sys\n\n\n\nn = int(input())\n\nl = sys.stdin.readlines()\n\ns = \"\"\n\nfor i in l:\n\n x, y, z = sorted(map(lambda x:x*x,map(int, i.split())))\n\n if x + y == z:\n\n s += \"YES\\n\"\n\n else:\n\n s += \"NO\\n\"\n\n\n\nprint(s,end=\"\")\n", "code_v0_loc": 10, "code_v1_loc": 13, "code_v0_num_chars": 201, "code_v1_num_chars": 222, "code_v0_no_empty_lines": "import sys\n\nr = []\nn = int(input())\nl = sys.stdin.readlines()\nfor i in l:\n x, y, z = sorted([x * x for x in list(map(int, i.split()))])\n if x + y == z:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nn = int(input())\nl = sys.stdin.readlines()\ns = \"\"\nfor i in l:\n x, y, z = sorted(map(lambda x: x * x, map(int, i.split())))\n if x + y == z:\n s += \"YES\\n\"\n else:\n s += \"NO\\n\"\nprint(s, end=\"\")\n", "code_same": false, "relative_loc_diff_percent": 23.0769230769, "diff": ["-r = []", "-n = int(input())", "+n = int(input())", "+s = \"\"", "- x, y, z = sorted([x * x for x in list(map(int, i.split()))])", "+ x, y, z = sorted(map(lambda x: x * x, map(int, i.split())))", "- print(\"YES\")", "+ s += \"YES\\n\"", "- print(\"NO\")", "+ s += \"NO\\n\"", "+print(s, end=\"\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3577006006, "measured_runtime_v1": 0.2704619627, "runtime_lift": 1.3225541848, "key": ["s695745765", "s444816349"]} +{"user_id": "u243699903", "problem_id": "p03371", "language": "python", "submission_id_v0": "s088381244", "submission_id_v1": "s357905210", "cpu_time_v0": 104, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.65, "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nans=a*x+b*y\n\nfor ci in range(max(x,y)+1):\n\n sumc = 2*ci*c\n\n sumc += (x-ci)*a if (x-ci)>0 else 0\n\n sumc += (y-ci)*b if (y-ci)>0 else 0\n\n ans=min(ans,sumc)\n\n\n\nprint(ans)", "target": "a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nif x==y:\n\n ans=min(ans,2*x*c)\n\nelif x>y:\n\n ans=min(ans,a*(x-y)+2*y*c)\n\n ans=min(ans,2*x*c)\n\nelse:\n\n ans=min(ans,b*(y-x)+2*x*c)\n\n ans=min(ans,2*y*c)\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 11, "code_v0_num_chars": 217, "code_v1_num_chars": 223, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nfor ci in range(max(x, y) + 1):\n sumc = 2 * ci * c\n sumc += (x - ci) * a if (x - ci) > 0 else 0\n sumc += (y - ci) * b if (y - ci) > 0 else 0\n ans = min(ans, sumc)\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nif x == y:\n ans = min(ans, 2 * x * c)\nelif x > y:\n ans = min(ans, a * (x - y) + 2 * y * c)\n ans = min(ans, 2 * x * c)\nelse:\n ans = min(ans, b * (y - x) + 2 * x * c)\n ans = min(ans, 2 * y * c)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-for ci in range(max(x, y) + 1):", "- sumc = 2 * ci * c", "- sumc += (x - ci) * a if (x - ci) > 0 else 0", "- sumc += (y - ci) * b if (y - ci) > 0 else 0", "- ans = min(ans, sumc)", "+if x == y:", "+ ans = min(ans, 2 * x * c)", "+elif x > y:", "+ ans = min(ans, a * (x - y) + 2 * y * c)", "+ ans = min(ans, 2 * x * c)", "+else:", "+ ans = min(ans, b * (y - x) + 2 * x * c)", "+ ans = min(ans, 2 * y * c)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2025436199, "measured_runtime_v1": 0.1559800074, "runtime_lift": 1.2985229532, "key": ["s088381244", "s357905210"]} +{"user_id": "u193598069", "problem_id": "p03544", "language": "python", "submission_id_v0": "s403516424", "submission_id_v1": "s258691406", "cpu_time_v0": 27, "cpu_time_v1": 17, "memory_v0": 10740, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.04, "input": "N = int(input())\n\nL = [ 0 ] * 1000000\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n", "target": "N = int(input())\n\nL = [ 0 ] * (N+1)\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 129, "code_v1_num_chars": 127, "code_v0_no_empty_lines": "N = int(input())\nL = [0] * 1000000\nL[0] = 2\nL[1] = 1\nfor i in range(2, N + 1):\n L[i] = L[i - 2] + L[i - 1]\nprint((L[N]))\n", "code_v1_no_empty_lines": "N = int(input())\nL = [0] * (N + 1)\nL[0] = 2\nL[1] = 1\nfor i in range(2, N + 1):\n L[i] = L[i - 2] + L[i - 1]\nprint((L[N]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-L = [0] * 1000000", "+L = [0] * (N + 1)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4811118691, "measured_runtime_v1": 0.3226976706, "runtime_lift": 1.4909059249, "key": ["s403516424", "s258691406"]} +{"user_id": "u218834617", "problem_id": "p03013", "language": "python", "submission_id_v0": "s048931274", "submission_id_v1": "s960526895", "cpu_time_v0": 127, "cpu_time_v1": 59, "memory_v0": 17264, "memory_v1": 17228, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 53.54, "input": "import sys\n\nN,M=list(map(int,input().split()))\n\nS=set(map(int,sys.stdin))\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in S:\n\n a,b=b,0\n\n else:\n\n a,b=b,a+b\n\n\n\nprint((b%(10**9+7)))\n", "target": "import sys\n\n\n\nN,M=list(map(int,input().split()))\n\nbad=set(map(int,sys.stdin))\n\nMOD=10**9+7\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in bad:\n\n a,b=b,0\n\n if a==0:\n\n break\n\n else:\n\n a,b=b,(a+b)%MOD\n\n\n\nprint(b)\n", "code_v0_loc": 12, "code_v1_loc": 16, "code_v0_num_chars": 188, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "import sys\n\nN, M = list(map(int, input().split()))\nS = set(map(int, sys.stdin))\na, b = 0, 1\nfor i in range(1, N + 1):\n if i in S:\n a, b = b, 0\n else:\n a, b = b, a + b\nprint((b % (10**9 + 7)))\n", "code_v1_no_empty_lines": "import sys\n\nN, M = list(map(int, input().split()))\nbad = set(map(int, sys.stdin))\nMOD = 10**9 + 7\na, b = 0, 1\nfor i in range(1, N + 1):\n if i in bad:\n a, b = b, 0\n if a == 0:\n break\n else:\n a, b = b, (a + b) % MOD\nprint(b)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-S = set(map(int, sys.stdin))", "+bad = set(map(int, sys.stdin))", "+MOD = 10**9 + 7", "- if i in S:", "+ if i in bad:", "+ if a == 0:", "+ break", "- a, b = b, a + b", "-print((b % (10**9 + 7)))", "+ a, b = b, (a + b) % MOD", "+print(b)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3212681165, "measured_runtime_v1": 0.212405349, "runtime_lift": 1.5125236626, "key": ["s048931274", "s960526895"]} +{"user_id": "u813384600", "problem_id": "p01138", "language": "python", "submission_id_v0": "s409826221", "submission_id_v1": "s148489336", "cpu_time_v0": 6790, "cpu_time_v1": 260, "memory_v0": 9596, "memory_v1": 7608, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 96.17, "input": "import re\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = [0] * (24*60*60+1)\n\n for _ in range(n):\n\n h1,m1,s1,h2,m2,s2 = list(map(int, re.split(':| ', input())))\n\n l[h1*60*60 + m1*60 + s1] += 1\n\n l[h2*60*60 + m2*60 + s2] -= 1\n\n r = 0\n\n for i in range(24*60*60):\n\n l[i+1] += l[i]\n\n r = max(r, l[i+1])\n\n print(r)", "target": "while True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = []\n\n for _ in range(n):\n\n hms1, hms2 = input().split()\n\n l.append((hms1, True))\n\n l.append((hms2, False))\n\n l.sort()\n\n r, t = 0, 0\n\n for i in range(len(l)):\n\n if l[i][1]:\n\n t += 1\n\n else:\n\n t -= 1\n\n r = max(r, t)\n\n print(r)", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 386, "code_v1_num_chars": 383, "code_v0_no_empty_lines": "import re\n\nwhile True:\n n = int(input())\n if n == 0:\n break\n l = [0] * (24 * 60 * 60 + 1)\n for _ in range(n):\n h1, m1, s1, h2, m2, s2 = list(map(int, re.split(\":| \", input())))\n l[h1 * 60 * 60 + m1 * 60 + s1] += 1\n l[h2 * 60 * 60 + m2 * 60 + s2] -= 1\n r = 0\n for i in range(24 * 60 * 60):\n l[i + 1] += l[i]\n r = max(r, l[i + 1])\n print(r)\n", "code_v1_no_empty_lines": "while True:\n n = int(input())\n if n == 0:\n break\n l = []\n for _ in range(n):\n hms1, hms2 = input().split()\n l.append((hms1, True))\n l.append((hms2, False))\n l.sort()\n r, t = 0, 0\n for i in range(len(l)):\n if l[i][1]:\n t += 1\n else:\n t -= 1\n r = max(r, t)\n print(r)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-import re", "-", "- l = [0] * (24 * 60 * 60 + 1)", "+ l = []", "- h1, m1, s1, h2, m2, s2 = list(map(int, re.split(\":| \", input())))", "- l[h1 * 60 * 60 + m1 * 60 + s1] += 1", "- l[h2 * 60 * 60 + m2 * 60 + s2] -= 1", "- r = 0", "- for i in range(24 * 60 * 60):", "- l[i + 1] += l[i]", "- r = max(r, l[i + 1])", "+ hms1, hms2 = input().split()", "+ l.append((hms1, True))", "+ l.append((hms2, False))", "+ l.sort()", "+ r, t = 0, 0", "+ for i in range(len(l)):", "+ if l[i][1]:", "+ t += 1", "+ else:", "+ t -= 1", "+ r = max(r, t)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.2066217821, "measured_runtime_v1": 0.2932185929, "runtime_lift": 4.1150930102, "key": ["s409826221", "s148489336"]} +{"user_id": "u242518667", "problem_id": "p03424", "language": "python", "submission_id_v0": "s488879497", "submission_id_v1": "s152130126", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "n=int(input())\n\ns=list(map(str,input().split()))\n\ntotal=[]\n\nfor i in range(n):\n\n if s[i] not in total:\n\n total.append(s[i])\n\nprint(('Three' if len(total)==3 else 'Four'))", "target": "input()\n\nl=list(map(str,input().split()))\n\nprint(('Three' if len(set(l))==3 else 'Four'))", "code_v0_loc": 7, "code_v1_loc": 3, "code_v0_num_chars": 178, "code_v1_num_chars": 81, "code_v0_no_empty_lines": "n = int(input())\ns = list(map(str, input().split()))\ntotal = []\nfor i in range(n):\n if s[i] not in total:\n total.append(s[i])\nprint((\"Three\" if len(total) == 3 else \"Four\"))\n", "code_v1_no_empty_lines": "input()\nl = list(map(str, input().split()))\nprint((\"Three\" if len(set(l)) == 3 else \"Four\"))\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-n = int(input())", "-s = list(map(str, input().split()))", "-total = []", "-for i in range(n):", "- if s[i] not in total:", "- total.append(s[i])", "-print((\"Three\" if len(total) == 3 else \"Four\"))", "+input()", "+l = list(map(str, input().split()))", "+print((\"Three\" if len(set(l)) == 3 else \"Four\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3119253957, "measured_runtime_v1": 0.2361336248, "runtime_lift": 1.3209698364, "key": ["s488879497", "s152130126"]} +{"user_id": "u882209234", "problem_id": "p03796", "language": "python", "submission_id_v0": "s179415880", "submission_id_v1": "s895771571", "cpu_time_v0": 230, "cpu_time_v1": 42, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.74, "input": "from math import factorial\n\nN = int(input())\n\nprint((factorial(N) % (10**9 + 7)))", "target": "from math import factorial\n\nN = int(input())\n\nans = 1\n\nfor i in range(1,N+1):\n\n ans *= i % (10**9 + 7)\n\n ans %= 10**9 + 7\n\nprint(ans)", "code_v0_loc": 3, "code_v1_loc": 7, "code_v0_num_chars": 79, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "from math import factorial\n\nN = int(input())\nprint((factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "from math import factorial\n\nN = int(input())\nans = 1\nfor i in range(1, N + 1):\n ans *= i % (10**9 + 7)\n ans %= 10**9 + 7\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-print((factorial(N) % (10**9 + 7)))", "+ans = 1", "+for i in range(1, N + 1):", "+ ans *= i % (10**9 + 7)", "+ ans %= 10**9 + 7", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9434056597, "measured_runtime_v1": 0.3957924933, "runtime_lift": 2.3835865397, "key": ["s179415880", "s895771571"]} +{"user_id": "u146816547", "problem_id": "p00005", "language": "python", "submission_id_v0": "s153581221", "submission_id_v1": "s486237781", "cpu_time_v0": 30, "cpu_time_v1": 10, "memory_v0": 5872, "memory_v1": 6452, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.67, "input": "import math\n\nwhile True:\n\n\ttry:\n\n\t\tx,y = list(map(int,input().split()))\n\n\t\tprint('%d %d' % (math.gcd(x,y),x/math.gcd(x,y)*y))\n\n\texcept EOFError:\n\n\t\tbreak", "target": "def gcd(x, y):\n\n if y == 0:\n\n return x\n\n else:\n\n return gcd(y, x%y)\n\n\n\n\n\ndef lcm(x,y):\n\n return x/gcd(x, y)*y\n\n\n\n\n\nwhile True:\n\n try:\n\n x, y = list(map(int, input().split()))\n\n except EOFError:\n\n break\n\n\n\n print(\"%d %d\" % (gcd(x, y), lcm(x, y)))", "code_v0_loc": 7, "code_v1_loc": 18, "code_v0_num_chars": 165, "code_v1_num_chars": 288, "code_v0_no_empty_lines": "import math\n\nwhile True:\n try:\n x, y = list(map(int, input().split()))\n print(\"%d %d\" % (math.gcd(x, y), x / math.gcd(x, y) * y))\n except EOFError:\n break\n", "code_v1_no_empty_lines": "def gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\n\ndef lcm(x, y):\n return x / gcd(x, y) * y\n\n\nwhile True:\n try:\n x, y = list(map(int, input().split()))\n except EOFError:\n break\n print(\"%d %d\" % (gcd(x, y), lcm(x, y)))\n", "code_same": false, "relative_loc_diff_percent": 61.1111111111, "diff": ["-import math", "+def gcd(x, y):", "+ if y == 0:", "+ return x", "+ else:", "+ return gcd(y, x % y)", "+", "+", "+def lcm(x, y):", "+ return x / gcd(x, y) * y", "+", "- print(\"%d %d\" % (math.gcd(x, y), x / math.gcd(x, y) * y))", "+ print(\"%d %d\" % (gcd(x, y), lcm(x, y)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2843708012, "measured_runtime_v1": 0.2133130357, "runtime_lift": 1.3331149699, "key": ["s153581221", "s486237781"]} +{"user_id": "u111365362", "problem_id": "p02881", "language": "python", "submission_id_v0": "s326793866", "submission_id_v1": "s577051886", "cpu_time_v0": 202, "cpu_time_v1": 174, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.86, "input": "n = int(input())\n\nr = int(n**.5)\n\nfor i in range(r):\n\n if n % (r-i) == 0:\n\n print(( (r-i) + n//(r-i) - 2 ))\n\n break", "target": "n = int(input())\n\ns = int(n**.5)\n\nfor i in range(s):\n\n if n % (s-i) == 0:\n\n print(((s-i) + n // (s-i) - 2))\n\n break", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 120, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "n = int(input())\nr = int(n**0.5)\nfor i in range(r):\n if n % (r - i) == 0:\n print(((r - i) + n // (r - i) - 2))\n break\n", "code_v1_no_empty_lines": "n = int(input())\ns = int(n**0.5)\nfor i in range(s):\n if n % (s - i) == 0:\n print(((s - i) + n // (s - i) - 2))\n break\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-r = int(n**0.5)", "-for i in range(r):", "- if n % (r - i) == 0:", "- print(((r - i) + n // (r - i) - 2))", "+s = int(n**0.5)", "+for i in range(s):", "+ if n % (s - i) == 0:", "+ print(((s - i) + n // (s - i) - 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3217455449, "measured_runtime_v1": 0.1190871449, "runtime_lift": 2.7017655456, "key": ["s326793866", "s577051886"]} +{"user_id": "u346812984", "problem_id": "p02725", "language": "python", "submission_id_v0": "s133823600", "submission_id_v1": "s446849062", "cpu_time_v0": 124, "cpu_time_v1": 97, "memory_v0": 26420, "memory_v1": 26444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.77, "input": "K, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\ndiff = A[0] + K - A[-1]\n\nans = A[-1] - A[0]\n\nfor i in range(1, N):\n\n dist = K - A[i] + A[i - 1]\n\n if dist < ans:\n\n ans = dist\n\n\n\nprint(ans)\n", "target": "import sys\n\n\n\n\n\ndef input():\n\n return sys.stdin.readline().strip()\n\n\n\n\n\ndef main():\n\n K, N = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n\n\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n\n print((min(min(ans), A[-1] - A[0])))\n\n\n\n\n\nmain()\n", "code_v0_loc": 11, "code_v1_loc": 16, "code_v0_num_chars": 226, "code_v1_num_chars": 274, "code_v0_no_empty_lines": "K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\ndiff = A[0] + K - A[-1]\nans = A[-1] - A[0]\nfor i in range(1, N):\n dist = K - A[i] + A[i - 1]\n if dist < ans:\n ans = dist\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n K, N = list(map(int, input().split()))\n A = list(map(int, input().split()))\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n print((min(min(ans), A[-1] - A[0])))\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 31.25, "diff": ["-K, N = list(map(int, input().split()))", "-A = list(map(int, input().split()))", "-diff = A[0] + K - A[-1]", "-ans = A[-1] - A[0]", "-for i in range(1, N):", "- dist = K - A[i] + A[i - 1]", "- if dist < ans:", "- ans = dist", "-print(ans)", "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "+def main():", "+ K, N = list(map(int, input().split()))", "+ A = list(map(int, input().split()))", "+ ans = [K - A[i] + A[i - 1] for i in range(1, N)]", "+ print((min(min(ans), A[-1] - A[0])))", "+", "+", "+main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2153115588, "measured_runtime_v1": 0.0063990955, "runtime_lift": 33.6471865365, "key": ["s133823600", "s446849062"]} +{"user_id": "u648881683", "problem_id": "p03371", "language": "python", "submission_id_v0": "s115897723", "submission_id_v1": "s652896869", "cpu_time_v0": 101, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.18, "input": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = float('inf')\n\n for i in range(0, max(X, Y)*2+1, 2):\n\n ans = min(A*max(X-i//2, 0)+B*max(Y-i//2, 0)+C*i, ans)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "target": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = 0\n\n if A+B > 2*C:\n\n ans = 2*C*min(X, Y)+min((A if X>Y else B)*abs(X-Y), 2*C*abs(X-Y))\n\n else:\n\n ans = A*X+B*Y\n\n \n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "code_v0_loc": 13, "code_v1_loc": 16, "code_v0_num_chars": 316, "code_v1_num_chars": 334, "code_v0_no_empty_lines": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = float(\"inf\")\n for i in range(0, max(X, Y) * 2 + 1, 2):\n ans = min(A * max(X - i // 2, 0) + B * max(Y - i // 2, 0) + C * i, ans)\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_v1_no_empty_lines": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = 0\n if A + B > 2 * C:\n ans = 2 * C * min(X, Y) + min(\n (A if X > Y else B) * abs(X - Y), 2 * C * abs(X - Y)\n )\n else:\n ans = A * X + B * Y\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 18.75, "diff": ["- ans = float(\"inf\")", "- for i in range(0, max(X, Y) * 2 + 1, 2):", "- ans = min(A * max(X - i // 2, 0) + B * max(Y - i // 2, 0) + C * i, ans)", "+ ans = 0", "+ if A + B > 2 * C:", "+ ans = 2 * C * min(X, Y) + min(", "+ (A if X > Y else B) * abs(X - Y), 2 * C * abs(X - Y)", "+ )", "+ else:", "+ ans = A * X + B * Y"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4475863097, "measured_runtime_v1": 0.2669118404, "runtime_lift": 1.6769069102, "key": ["s115897723", "s652896869"]} +{"user_id": "u556589653", "problem_id": "p03416", "language": "python", "submission_id_v0": "s253072561", "submission_id_v1": "s839464643", "cpu_time_v0": 58, "cpu_time_v1": 50, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n i = str(i)\n\n if i[0] == i[4]:\n\n if i[1] == i[3]:\n\n ans += 1\n\n else:\n\n ans += 0\n\n else:\n\n ans += 0\n\nprint(ans)", "target": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n k = str(i)\n\n if k[0] == k[4] and k[1] == k[3]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 7, "code_v0_num_chars": 227, "code_v1_num_chars": 148, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n i = str(i)\n if i[0] == i[4]:\n if i[1] == i[3]:\n ans += 1\n else:\n ans += 0\n else:\n ans += 0\nprint(ans)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n k = str(i)\n if k[0] == k[4] and k[1] == k[3]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.6666666667, "diff": ["- i = str(i)", "- if i[0] == i[4]:", "- if i[1] == i[3]:", "- ans += 1", "- else:", "- ans += 0", "- else:", "- ans += 0", "+ k = str(i)", "+ if k[0] == k[4] and k[1] == k[3]:", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1907642818, "measured_runtime_v1": 0.0059664835, "runtime_lift": 31.9726487264, "key": ["s253072561", "s839464643"]} +{"user_id": "u312025627", "problem_id": "p03568", "language": "python", "submission_id_v0": "s088632051", "submission_id_v1": "s935108099", "cpu_time_v0": 196, "cpu_time_v1": 167, "memory_v0": 41068, "memory_v1": 38256, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.8, "input": "def main():\n\n N = int(input())\n\n A = [int(i) for i in input().split()]\n\n if N == 1:\n\n return print(1 if A[0] % 2 == 0 else 2)\n\n ans = 0\n\n d = (-1, 0, 1)\n\n from itertools import product\n\n for i in product(range(3), repeat=N):\n\n cur = 1\n\n for j in range(N):\n\n cur *= (A[j] + d[i[j]])\n\n if cur % 2 == 0:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n N = int(input())\n\n A = [int(i) for i in input().split()]\n\n ans = 3**N\n\n cnt = len([a for a in A if a % 2 == 0])\n\n ans -= 2**cnt\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 19, "code_v1_loc": 11, "code_v0_num_chars": 443, "code_v1_num_chars": 217, "code_v0_no_empty_lines": "def main():\n N = int(input())\n A = [int(i) for i in input().split()]\n if N == 1:\n return print(1 if A[0] % 2 == 0 else 2)\n ans = 0\n d = (-1, 0, 1)\n from itertools import product\n\n for i in product(range(3), repeat=N):\n cur = 1\n for j in range(N):\n cur *= A[j] + d[i[j]]\n if cur % 2 == 0:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n N = int(input())\n A = [int(i) for i in input().split()]\n ans = 3**N\n cnt = len([a for a in A if a % 2 == 0])\n ans -= 2**cnt\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 42.1052631579, "diff": ["- N = int(input())", "+ N = int(input())", "- if N == 1:", "- return print(1 if A[0] % 2 == 0 else 2)", "- ans = 0", "- d = (-1, 0, 1)", "- from itertools import product", "-", "- for i in product(range(3), repeat=N):", "- cur = 1", "- for j in range(N):", "- cur *= A[j] + d[i[j]]", "- if cur % 2 == 0:", "- ans += 1", "+ ans = 3**N", "+ cnt = len([a for a in A if a % 2 == 0])", "+ ans -= 2**cnt"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4432550566, "measured_runtime_v1": 0.2109588499, "runtime_lift": 2.1011446393, "key": ["s088632051", "s935108099"]} +{"user_id": "u777923818", "problem_id": "p03425", "language": "python", "submission_id_v0": "s258539301", "submission_id_v1": "s541501179", "cpu_time_v0": 165, "cpu_time_v1": 142, "memory_v0": 3316, "memory_v1": 9336, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.94, "input": "# -*- coding: utf-8 -*-\n\nfrom collections import defaultdict\n\nfrom itertools import combinations\n\nN = int(input())\n\nC = [0, 0, 0, 0, 0, 0]\n\nD = defaultdict(int)\n\nfor i, m in enumerate(\"MARCH\", start=1):\n\n D[m] = i\n\n\n\nfor _ in range(N):\n\n C[D[input()[0]]] += 1\n\n\n\nans = 0\n\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n\n ans += C[a]*C[b]*C[c]\n\nprint(ans)", "target": "from collections import defaultdict\n\nfrom itertools import combinations\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nC = defaultdict(int)\n\nN = int(input())\n\nfor _ in range(N):\n\n C[input()[0]] += 1\n\n\n\nres = 0\n\nfor H in combinations(\"MARCH\", r=3):\n\n res += C[H[0]] * C[H[1]] * C[H[2]]\n\nprint(res)", "code_v0_loc": 16, "code_v1_loc": 13, "code_v0_num_chars": 363, "code_v1_num_chars": 310, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nfrom collections import defaultdict\nfrom itertools import combinations\n\nN = int(input())\nC = [0, 0, 0, 0, 0, 0]\nD = defaultdict(int)\nfor i, m in enumerate(\"MARCH\", start=1):\n D[m] = i\nfor _ in range(N):\n C[D[input()[0]]] += 1\nans = 0\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n ans += C[a] * C[b] * C[c]\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\nfrom itertools import combinations\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\nC = defaultdict(int)\nN = int(input())\nfor _ in range(N):\n C[input()[0]] += 1\nres = 0\nfor H in combinations(\"MARCH\", r=3):\n res += C[H[0]] * C[H[1]] * C[H[2]]\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 18.75, "diff": ["-# -*- coding: utf-8 -*-", "+", "+def inpl():", "+ return list(map(int, input().split()))", "+", "+", "+C = defaultdict(int)", "-C = [0, 0, 0, 0, 0, 0]", "-D = defaultdict(int)", "-for i, m in enumerate(\"MARCH\", start=1):", "- D[m] = i", "- C[D[input()[0]]] += 1", "-ans = 0", "-for a, b, c in combinations(list(range(1, 6)), r=3):", "- ans += C[a] * C[b] * C[c]", "-print(ans)", "+ C[input()[0]] += 1", "+res = 0", "+for H in combinations(\"MARCH\", r=3):", "+ res += C[H[0]] * C[H[1]] * C[H[2]]", "+print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.388673193, "measured_runtime_v1": 0.2150466468, "runtime_lift": 1.8073901578, "key": ["s258539301", "s541501179"]} +{"user_id": "u964904181", "problem_id": "p03796", "language": "python", "submission_id_v0": "s459904551", "submission_id_v1": "s685671735", "cpu_time_v0": 153, "cpu_time_v1": 46, "memory_v0": 9880, "memory_v1": 9092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 69.93, "input": "import math\n\n\n\nN = int(input())\n\n\n\nprint((math.factorial(N) % (1000000000 + 7)))\n", "target": "import math\n\n\n\nN = int(input())\n\n\n\np = 1\n\nfor i in range(2, N+1):\n\n p *= i\n\n p = p % (1000000000 + 7)\n\n \n\nprint(p)\n", "code_v0_loc": 5, "code_v1_loc": 10, "code_v0_num_chars": 79, "code_v1_num_chars": 118, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (1000000000 + 7)))\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\np = 1\nfor i in range(2, N + 1):\n p *= i\n p = p % (1000000000 + 7)\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-print((math.factorial(N) % (1000000000 + 7)))", "+p = 1", "+for i in range(2, N + 1):", "+ p *= i", "+ p = p % (1000000000 + 7)", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5259809067, "measured_runtime_v1": 0.2554857254, "runtime_lift": 2.0587487065, "key": ["s459904551", "s685671735"]} +{"user_id": "u127499732", "problem_id": "p03309", "language": "python", "submission_id_v0": "s031191514", "submission_id_v1": "s488102802", "cpu_time_v0": 214, "cpu_time_v1": 169, "memory_v0": 27212, "memory_v1": 25180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.03, "input": "def main():\n\n from statistics import median\n\n\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n m = int(median(a))\n\n\n\n ans = sum([abs(x - m) for x in a])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n if n % 2 == 0:\n\n ans = sum(a[n // 2:]) - sum(a[:n // 2])\n\n else:\n\n ans = sum(a[n // 2 + 1:]) - sum(a[:n // 2])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 281, "code_v1_num_chars": 311, "code_v0_no_empty_lines": "def main():\n from statistics import median\n\n (\n n,\n *a,\n ) = list(map(int, open(0).read().split()))\n a = [x - i for i, x in enumerate(a, 1)]\n a.sort()\n m = int(median(a))\n ans = sum([abs(x - m) for x in a])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n (\n n,\n *a,\n ) = list(map(int, open(0).read().split()))\n a = [x - i for i, x in enumerate(a, 1)]\n a.sort()\n if n % 2 == 0:\n ans = sum(a[n // 2 :]) - sum(a[: n // 2])\n else:\n ans = sum(a[n // 2 + 1 :]) - sum(a[: n // 2])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["- from statistics import median", "-", "- m = int(median(a))", "- ans = sum([abs(x - m) for x in a])", "+ if n % 2 == 0:", "+ ans = sum(a[n // 2 :]) - sum(a[: n // 2])", "+ else:", "+ ans = sum(a[n // 2 + 1 :]) - sum(a[: n // 2])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2784859991, "measured_runtime_v1": 0.2092100859, "runtime_lift": 1.3311308484, "key": ["s031191514", "s488102802"]} +{"user_id": "u159994501", "problem_id": "p03037", "language": "python", "submission_id_v0": "s060142514", "submission_id_v1": "s502871070", "cpu_time_v0": 326, "cpu_time_v1": 290, "memory_v0": 10996, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.04, "input": "N, M = list(map(int, input().split()))\n\nL, R = [], []\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n", "target": "N, M = list(map(int, input().split()))\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n", "code_v0_loc": 13, "code_v1_loc": 10, "code_v0_num_chars": 283, "code_v1_num_chars": 234, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL, R = [], []\nlow = -float(\"INF\")\nhigh = float(\"INF\")\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\n if l > low:\n low = l\n if r < high:\n high = r\nprint((max(0, high - low + 1)))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nlow = -float(\"INF\")\nhigh = float(\"INF\")\nfor i in range(M):\n l, r = list(map(int, input().split()))\n if l > low:\n low = l\n if r < high:\n high = r\nprint((max(0, high - low + 1)))\n", "code_same": false, "relative_loc_diff_percent": 23.0769230769, "diff": ["-L, R = [], []", "- L.append(l)", "- R.append(r)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2778050728, "measured_runtime_v1": 0.0913613791, "runtime_lift": 3.0407276614, "key": ["s060142514", "s502871070"]} +{"user_id": "u729133443", "problem_id": "p02555", "language": "python", "submission_id_v0": "s039277419", "submission_id_v1": "s210669705", "cpu_time_v0": 66, "cpu_time_v1": 51, "memory_v0": 29052, "memory_v1": 22328, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.73, "input": "a,b,c=1,0,0\n\nexec('a,b,c=b,c,(a+c)%(10**9+7);'*(int(input())-2))\n\nprint(c)", "target": "a,b,c=1,0,0\n\nexec('a,b,c=b,c,a+c;'*(int(input())-2))\n\nprint((c%(10**9+7)))", "code_v0_loc": 3, "code_v1_loc": 3, "code_v0_num_chars": 74, "code_v1_num_chars": 72, "code_v0_no_empty_lines": "a, b, c = 1, 0, 0\nexec(\"a,b,c=b,c,(a+c)%(10**9+7);\" * (int(input()) - 2))\nprint(c)\n", "code_v1_no_empty_lines": "a, b, c = 1, 0, 0\nexec(\"a,b,c=b,c,a+c;\" * (int(input()) - 2))\nprint((c % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-exec(\"a,b,c=b,c,(a+c)%(10**9+7);\" * (int(input()) - 2))", "-print(c)", "+exec(\"a,b,c=b,c,a+c;\" * (int(input()) - 2))", "+print((c % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4045331192, "measured_runtime_v1": 0.1489405618, "runtime_lift": 2.7160708565, "key": ["s039277419", "s210669705"]} +{"user_id": "u768896740", "problem_id": "p03371", "language": "python", "submission_id_v0": "s303630482", "submission_id_v1": "s785488691", "cpu_time_v0": 197, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.37, "input": "a, b, c, x, y = list(map(int, input().split()))\n\n\n\nz = max(x,y) * 2\n\nmin_sum = c * z\n\n\n\nfor i in range(z):\n\n r = max(0, y - i) * b\n\n t = max(0, x - i) * a\n\n sum = c * i * 2 + r + t\n\n if sum < min_sum:\n\n min_sum = sum\n\n\n\nprint(min_sum)", "target": "a,b,c,x,y = list(map(int, input().split()))\n\n\n\nplan_a = c * (2*x) + max(0, y-x) * b\n\nplan_b = c * (2*y) + max(0, x-y) * a\n\nplan_c = a * x + b * y\n\n\n\nprint((min(plan_a, plan_b, plan_c)))", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 247, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nz = max(x, y) * 2\nmin_sum = c * z\nfor i in range(z):\n r = max(0, y - i) * b\n t = max(0, x - i) * a\n sum = c * i * 2 + r + t\n if sum < min_sum:\n min_sum = sum\nprint(min_sum)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nplan_a = c * (2 * x) + max(0, y - x) * b\nplan_b = c * (2 * y) + max(0, x - y) * a\nplan_c = a * x + b * y\nprint((min(plan_a, plan_b, plan_c)))\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["-z = max(x, y) * 2", "-min_sum = c * z", "-for i in range(z):", "- r = max(0, y - i) * b", "- t = max(0, x - i) * a", "- sum = c * i * 2 + r + t", "- if sum < min_sum:", "- min_sum = sum", "-print(min_sum)", "+plan_a = c * (2 * x) + max(0, y - x) * b", "+plan_b = c * (2 * y) + max(0, x - y) * a", "+plan_c = a * x + b * y", "+print((min(plan_a, plan_b, plan_c)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7115524154, "measured_runtime_v1": 0.3421670091, "runtime_lift": 2.0795471112, "key": ["s303630482", "s785488691"]} +{"user_id": "u488127128", "problem_id": "p03796", "language": "python", "submission_id_v0": "s349010345", "submission_id_v1": "s174569561", "cpu_time_v0": 35, "cpu_time_v1": 29, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.14, "input": "N = int(input())\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)", "target": "def factorial(N):\n\n a = 1\n\n for n in range(2,N+1):\n\n a = a*n % (10**9 + 7)\n\n return a\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "code_v0_loc": 5, "code_v1_loc": 9, "code_v0_num_chars": 82, "code_v1_num_chars": 178, "code_v0_no_empty_lines": "N = int(input())\na = 1\nfor n in range(2, N + 1):\n a = a * n % (10**9 + 7)\nprint(a)\n", "code_v1_no_empty_lines": "def factorial(N):\n a = 1\n for n in range(2, N + 1):\n a = a * n % (10**9 + 7)\n return a\n\n\nif __name__ == \"__main__\":\n N = int(input())\n print((factorial(N)))\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-N = int(input())", "-a = 1", "-for n in range(2, N + 1):", "- a = a * n % (10**9 + 7)", "-print(a)", "+def factorial(N):", "+ a = 1", "+ for n in range(2, N + 1):", "+ a = a * n % (10**9 + 7)", "+ return a", "+", "+", "+if __name__ == \"__main__\":", "+ N = int(input())", "+ print((factorial(N)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3416386657, "measured_runtime_v1": 0.2695478878, "runtime_lift": 1.2674507244, "key": ["s349010345", "s174569561"]} +{"user_id": "u102461423", "problem_id": "p03170", "language": "python", "submission_id_v0": "s503646377", "submission_id_v1": "s803807514", "cpu_time_v0": 1298, "cpu_time_v1": 123, "memory_v0": 3684, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 90.52, "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom operator import xor\n\nfrom functools import reduce\n\n\n\nN,K,*A = list(map(int,read().split()))\n\n\n\na = reduce(xor,(1<K:\n\n break\n\n dp[n+a]=1\n\n\n\nanswer = 'First' if dp[-1] else 'Second'\n\nprint(answer)", "code_v0_loc": 19, "code_v1_loc": 17, "code_v0_num_chars": 396, "code_v1_num_chars": 369, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom operator import xor\nfrom functools import reduce\n\nN, K, *A = list(map(int, read().split()))\na = reduce(xor, (1 << a for a in A))\ndp = 0 # bitset\nfor n in range(K):\n if not (dp & (1 << n)):\n dp |= a << n\nanswer = \"First\" if dp & (1 << K) else \"Second\"\nprint(answer)\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN, K, *A = list(map(int, read().split()))\ndp = [0] * (K + 1) # bitset\nfor n in range(K):\n if not dp[n]:\n for a in A:\n if n + a > K:\n break\n dp[n + a] = 1\nanswer = \"First\" if dp[-1] else \"Second\"\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 10.5263157895, "diff": ["-from operator import xor", "-from functools import reduce", "-", "-a = reduce(xor, (1 << a for a in A))", "-dp = 0 # bitset", "+dp = [0] * (K + 1) # bitset", "- if not (dp & (1 << n)):", "- dp |= a << n", "-answer = \"First\" if dp & (1 << K) else \"Second\"", "+ if not dp[n]:", "+ for a in A:", "+ if n + a > K:", "+ break", "+ dp[n + a] = 1", "+answer = \"First\" if dp[-1] else \"Second\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.510753959, "measured_runtime_v1": 0.2748723721, "runtime_lift": 1.8581494935, "key": ["s503646377", "s803807514"]} +{"user_id": "u102960641", "problem_id": "p02624", "language": "python", "submission_id_v0": "s523843051", "submission_id_v1": "s066295883", "cpu_time_v0": 36, "cpu_time_v1": 31, "memory_v0": 9312, "memory_v1": 9436, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.89, "input": "n = int(input())\n\nans = 0\n\nSQRT = int(n ** 0.5)\n\nfor m in range(1,SQRT + 1):\n\n b = int(n/m)\n\n ans += m * (m + b) * (b + 1 - m)\n\nans -= SQRT * (SQRT+1) * (2*SQRT+1) // 6\n\nprint(ans)", "target": "def main():\n\n n = int(input())\n\n ans = 0\n\n SQRT = int(n ** 0.5)\n\n for m in range(1,SQRT + 1):\n\n b = int(n/m)\n\n ans += m * (m + b) * (b + 1 - m)\n\n ans -= SQRT * (SQRT+1) * (2*SQRT+1) // 6\n\n print(ans)\n\nmain()\n", "code_v0_loc": 8, "code_v1_loc": 10, "code_v0_num_chars": 186, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "n = int(input())\nans = 0\nSQRT = int(n**0.5)\nfor m in range(1, SQRT + 1):\n b = int(n / m)\n ans += m * (m + b) * (b + 1 - m)\nans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6\nprint(ans)\n", "code_v1_no_empty_lines": "def main():\n n = int(input())\n ans = 0\n SQRT = int(n**0.5)\n for m in range(1, SQRT + 1):\n b = int(n / m)\n ans += m * (m + b) * (b + 1 - m)\n ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6\n print(ans)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-n = int(input())", "-ans = 0", "-SQRT = int(n**0.5)", "-for m in range(1, SQRT + 1):", "- b = int(n / m)", "- ans += m * (m + b) * (b + 1 - m)", "-ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6", "-print(ans)", "+def main():", "+ n = int(input())", "+ ans = 0", "+ SQRT = int(n**0.5)", "+ for m in range(1, SQRT + 1):", "+ b = int(n / m)", "+ ans += m * (m + b) * (b + 1 - m)", "+ ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6", "+ print(ans)", "+", "+", "+main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3880330081, "measured_runtime_v1": 0.212660579, "runtime_lift": 1.8246588529, "key": ["s523843051", "s066295883"]} +{"user_id": "u513081876", "problem_id": "p03828", "language": "python", "submission_id_v0": "s988350400", "submission_id_v1": "s443952708", "cpu_time_v0": 39, "cpu_time_v1": 35, "memory_v0": 3316, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.26, "input": "import math\n\nimport collections\n\n\n\nN = int(input())\n\na = math.factorial(N)\n\ncheck = []\n\nans = 1\n\ni = 2\n\n\n\nwhile a != 1:\n\n if a % i == 0:\n\n a //= i\n\n check.append(i)\n\n else:\n\n i += 1\n\n \n\ncheck = list(collections.Counter(check).values())\n\nfor i in check:\n\n ans *= (i+1)\n\n ans %= 10**9+7\n\nprint(ans)", "target": "from math import factorial\n\n\n\nN = factorial(int(input()))\n\n\n\ni = 2\n\ncheck = 1\n\nans = 1\n\nwhile N != 1:\n\n if N % i == 0:\n\n N //= i\n\n check += 1\n\n else:\n\n ans *= check\n\n check = 1\n\n i += 1\n\nprint(((ans*check)%(10**9+7)))", "code_v0_loc": 21, "code_v1_loc": 16, "code_v0_num_chars": 330, "code_v1_num_chars": 256, "code_v0_no_empty_lines": "import math\nimport collections\n\nN = int(input())\na = math.factorial(N)\ncheck = []\nans = 1\ni = 2\nwhile a != 1:\n if a % i == 0:\n a //= i\n check.append(i)\n else:\n i += 1\ncheck = list(collections.Counter(check).values())\nfor i in check:\n ans *= i + 1\n ans %= 10**9 + 7\nprint(ans)\n", "code_v1_no_empty_lines": "from math import factorial\n\nN = factorial(int(input()))\ni = 2\ncheck = 1\nans = 1\nwhile N != 1:\n if N % i == 0:\n N //= i\n check += 1\n else:\n ans *= check\n check = 1\n i += 1\nprint(((ans * check) % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 23.8095238095, "diff": ["-import math", "-import collections", "+from math import factorial", "-N = int(input())", "-a = math.factorial(N)", "-check = []", "+N = factorial(int(input()))", "+i = 2", "+check = 1", "-i = 2", "-while a != 1:", "- if a % i == 0:", "- a //= i", "- check.append(i)", "+while N != 1:", "+ if N % i == 0:", "+ N //= i", "+ check += 1", "+ ans *= check", "+ check = 1", "-check = list(collections.Counter(check).values())", "-for i in check:", "- ans *= i + 1", "- ans %= 10**9 + 7", "-print(ans)", "+print(((ans * check) % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1990540142, "measured_runtime_v1": 0.0063210642, "runtime_lift": 31.4905855295, "key": ["s988350400", "s443952708"]} +{"user_id": "u693694535", "problem_id": "p03371", "language": "python", "submission_id_v0": "s328045307", "submission_id_v1": "s953197610", "cpu_time_v0": 105, "cpu_time_v1": 26, "memory_v0": 9176, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.24, "input": "A,B,C,X,Y=list(map(int,input().split()))\n\n\n\nK=10**9\n\nfor i in range(10**5+1):\n\n S=i*2*C+max(0,X-i)*A+max(0,Y-i)*B\n\n K=min(K,S)\n\nprint(K)", "target": "A,B,C,X,Y=list(map(int,input().split()))\n\n\n\na=min(X,Y)*min(A+B,2*C)\n\n\n\na+=max(0,X-Y)*min(A,2*C)\n\na+=max(0,Y-X)*min(B,2*C)\n\n\n\n\n\nprint(a)", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 136, "code_v1_num_chars": 129, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nK = 10**9\nfor i in range(10**5 + 1):\n S = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n K = min(K, S)\nprint(K)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\na = min(X, Y) * min(A + B, 2 * C)\na += max(0, X - Y) * min(A, 2 * C)\na += max(0, Y - X) * min(B, 2 * C)\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-K = 10**9", "-for i in range(10**5 + 1):", "- S = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B", "- K = min(K, S)", "-print(K)", "+a = min(X, Y) * min(A + B, 2 * C)", "+a += max(0, X - Y) * min(A, 2 * C)", "+a += max(0, Y - X) * min(B, 2 * C)", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3979784026, "measured_runtime_v1": 0.2418090019, "runtime_lift": 5.7813331656, "key": ["s328045307", "s953197610"]} +{"user_id": "u365686736", "problem_id": "p02390", "language": "python", "submission_id_v0": "s143749551", "submission_id_v1": "s514847697", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7676, "memory_v1": 5584, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "S = int(input())\n\n\n\nif S >= 3600:\n\n h=S//3600\n\n m=S%3600//60\n\n s=S%60\n\nelif 3600 > S >= 60:\n\n h=0\n\n m=S//60\n\n s=S%60\n\nelse:\n\n h=m=0\n\n s=S\n\nprint(h, m, s, sep=\":\")\n", "target": "s = int(input())\n\nh = s // 3600\n\nm = (s - h * 3600) // 60\n\ns = s - h * 3600 - m * 60\n\nprint(h, m, s, sep=\":\")\n", "code_v0_loc": 14, "code_v1_loc": 5, "code_v0_num_chars": 186, "code_v1_num_chars": 110, "code_v0_no_empty_lines": "S = int(input())\nif S >= 3600:\n h = S // 3600\n m = S % 3600 // 60\n s = S % 60\nelif 3600 > S >= 60:\n h = 0\n m = S // 60\n s = S % 60\nelse:\n h = m = 0\n s = S\nprint(h, m, s, sep=\":\")\n", "code_v1_no_empty_lines": "s = int(input())\nh = s // 3600\nm = (s - h * 3600) // 60\ns = s - h * 3600 - m * 60\nprint(h, m, s, sep=\":\")\n", "code_same": false, "relative_loc_diff_percent": 64.2857142857, "diff": ["-S = int(input())", "-if S >= 3600:", "- h = S // 3600", "- m = S % 3600 // 60", "- s = S % 60", "-elif 3600 > S >= 60:", "- h = 0", "- m = S // 60", "- s = S % 60", "-else:", "- h = m = 0", "- s = S", "+s = int(input())", "+h = s // 3600", "+m = (s - h * 3600) // 60", "+s = s - h * 3600 - m * 60"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3295819011, "measured_runtime_v1": 0.255378567, "runtime_lift": 1.2905621053, "key": ["s143749551", "s514847697"]} +{"user_id": "u729133443", "problem_id": "p03434", "language": "python", "submission_id_v0": "s231475572", "submission_id_v1": "s619171000", "cpu_time_v0": 35, "cpu_time_v1": 30, "memory_v0": 9016, "memory_v1": 9012, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.29, "input": "_,s=open(c:=0)\n\nfor a in sorted(map(int,s.split())):c=a-c\n\nprint(c)", "target": "for a in sorted(map(int,[*open(c:=0)][1].split())):c=a-c\n\nprint(c)", "code_v0_loc": 3, "code_v1_loc": 2, "code_v0_num_chars": 67, "code_v1_num_chars": 66, "code_v0_no_empty_lines": "_, s = open(c := 0)\nfor a in sorted(map(int, s.split())):\n c = a - c\nprint(c)\n", "code_v1_no_empty_lines": "for a in sorted(map(int, [*open(c := 0)][1].split())):\n c = a - c\nprint(c)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-_, s = open(c := 0)", "-for a in sorted(map(int, s.split())):", "+for a in sorted(map(int, [*open(c := 0)][1].split())):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.269129122, "measured_runtime_v1": 0.112153646, "runtime_lift": 2.3996466598, "key": ["s231475572", "s619171000"]} +{"user_id": "u808429775", "problem_id": "p00134", "language": "python", "submission_id_v0": "s571351483", "submission_id_v1": "s722552691", "cpu_time_v0": 100, "cpu_time_v1": 60, "memory_v0": 7404, "memory_v1": 5952, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.0, "input": "from statistics import mean\n\n\n\ninputCount = int(input())\n\nprices = [int(input()) for lp in range(inputCount)]\n\naverage = mean(prices)\n\nprint((int(average)))\n\n\n", "target": "inputCount = int(input())\n\nprices = [int(input()) for lp in range(inputCount)]\n\naverage = sum(prices) // inputCount\n\nprint(average)\n\n\n", "code_v0_loc": 7, "code_v1_loc": 5, "code_v0_num_chars": 157, "code_v1_num_chars": 134, "code_v0_no_empty_lines": "from statistics import mean\n\ninputCount = int(input())\nprices = [int(input()) for lp in range(inputCount)]\naverage = mean(prices)\nprint((int(average)))\n", "code_v1_no_empty_lines": "inputCount = int(input())\nprices = [int(input()) for lp in range(inputCount)]\naverage = sum(prices) // inputCount\nprint(average)\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-from statistics import mean", "-", "-average = mean(prices)", "-print((int(average)))", "+average = sum(prices) // inputCount", "+print(average)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.453101104, "measured_runtime_v1": 0.2992461076, "runtime_lift": 1.514142014, "key": ["s571351483", "s722552691"]} +{"user_id": "u145950990", "problem_id": "p02552", "language": "python", "submission_id_v0": "s431367942", "submission_id_v1": "s270499104", "cpu_time_v0": 32, "cpu_time_v1": 25, "memory_v0": 9148, "memory_v1": 9028, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.88, "input": "x = int(input())\n\nprint((0 if x==1 else 1))", "target": "s = input()\n\nif s == '0':\n\n print((1))\n\nelse:\n\n print((0))", "code_v0_loc": 2, "code_v1_loc": 5, "code_v0_num_chars": 41, "code_v1_num_chars": 56, "code_v0_no_empty_lines": "x = int(input())\nprint((0 if x == 1 else 1))\n", "code_v1_no_empty_lines": "s = input()\nif s == \"0\":\n print((1))\nelse:\n print((0))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-x = int(input())", "-print((0 if x == 1 else 1))", "+s = input()", "+if s == \"0\":", "+ print((1))", "+else:", "+ print((0))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2680207849, "measured_runtime_v1": 0.0548314691, "runtime_lift": 4.8880832377, "key": ["s431367942", "s270499104"]} +{"user_id": "u600065151", "problem_id": "p02268", "language": "python", "submission_id_v0": "s783851867", "submission_id_v1": "s366216704", "cpu_time_v0": 50, "cpu_time_v1": 40, "memory_v0": 18684, "memory_v1": 20588, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.0, "input": "def binarySearch():\n\n n = int(input())\n\n S = set(map(int, input().split()))\n\n q = int(input())\n\n T = set(map(int, input().split()))\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()", "target": "def binarySearch():\n\n n = int(input())\n\n S = set(input().split())\n\n q = int(input())\n\n T = set(input().split())\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()", "code_v0_loc": 9, "code_v1_loc": 9, "code_v0_num_chars": 202, "code_v1_num_chars": 182, "code_v0_no_empty_lines": "def binarySearch():\n n = int(input())\n S = set(map(int, input().split()))\n q = int(input())\n T = set(map(int, input().split()))\n print((len(S.intersection(T))))\n\n\nbinarySearch()\n", "code_v1_no_empty_lines": "def binarySearch():\n n = int(input())\n S = set(input().split())\n q = int(input())\n T = set(input().split())\n print((len(S.intersection(T))))\n\n\nbinarySearch()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- S = set(map(int, input().split()))", "+ S = set(input().split())", "- T = set(map(int, input().split()))", "+ T = set(input().split())"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3310329242, "measured_runtime_v1": 0.2247743328, "runtime_lift": 1.4727345427, "key": ["s783851867", "s366216704"]} +{"user_id": "u996434204", "problem_id": "p03416", "language": "python", "submission_id_v0": "s285618885", "submission_id_v1": "s172989285", "cpu_time_v0": 114, "cpu_time_v1": 57, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "a,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])\n\n str1=buf[0:int(len(buf)/2)]\n\n str2=buf[int(len(buf)/2+1):]\n\n if str1[0]==str2[1] and str1[1]==str2[0]:\n\n ans+=1\n\n\n\nprint(ans)\n", "target": "a,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n str1=buf[::-1]\n\n if buf==str1:\n\n ans+=1\n\n\n\nprint(ans)\n", "code_v0_loc": 13, "code_v1_loc": 11, "code_v0_num_chars": 284, "code_v1_num_chars": 149, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n buf = str(i)\n # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])\n str1 = buf[0 : int(len(buf) / 2)]\n str2 = buf[int(len(buf) / 2 + 1) :]\n if str1[0] == str2[1] and str1[1] == str2[0]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n buf = str(i)\n str1 = buf[::-1]\n if buf == str1:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["- # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])", "- str1 = buf[0 : int(len(buf) / 2)]", "- str2 = buf[int(len(buf) / 2 + 1) :]", "- if str1[0] == str2[1] and str1[1] == str2[0]:", "+ str1 = buf[::-1]", "+ if buf == str1:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3597218115, "measured_runtime_v1": 0.2724662972, "runtime_lift": 1.3202433295, "key": ["s285618885", "s172989285"]} +{"user_id": "u537976628", "problem_id": "p03720", "language": "python", "submission_id_v0": "s957846271", "submission_id_v1": "s235024999", "cpu_time_v0": 28, "cpu_time_v1": 25, "memory_v0": 9128, "memory_v1": 9136, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.71, "input": "n, m = list(map(int, input().split()))\n\nRD = list(list(map(int, input().split())) for _ in range(m))\n\nfor i in range(1, n + 1):\n\n ans = 0\n\n for j in RD:\n\n ans += j.count(i)\n\n print(ans)", "target": "n, m = list(map(int, input().split()))\n\nNRD = list(0 for i in range(n))\n\nfor i in range(m):\n\n r1, r2 = list(map(int, input().split()))\n\n NRD[r1 - 1] += 1\n\n NRD[r2 - 1] += 1\n\nfor i in range(n):\n\n print((NRD[i]))", "code_v0_loc": 7, "code_v1_loc": 8, "code_v0_num_chars": 195, "code_v1_num_chars": 208, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\nRD = list(list(map(int, input().split())) for _ in range(m))\nfor i in range(1, n + 1):\n ans = 0\n for j in RD:\n ans += j.count(i)\n print(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nNRD = list(0 for i in range(n))\nfor i in range(m):\n r1, r2 = list(map(int, input().split()))\n NRD[r1 - 1] += 1\n NRD[r2 - 1] += 1\nfor i in range(n):\n print((NRD[i]))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-RD = list(list(map(int, input().split())) for _ in range(m))", "-for i in range(1, n + 1):", "- ans = 0", "- for j in RD:", "- ans += j.count(i)", "- print(ans)", "+NRD = list(0 for i in range(n))", "+for i in range(m):", "+ r1, r2 = list(map(int, input().split()))", "+ NRD[r1 - 1] += 1", "+ NRD[r2 - 1] += 1", "+for i in range(n):", "+ print((NRD[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2888841586, "measured_runtime_v1": 0.0609361191, "runtime_lift": 4.7407705467, "key": ["s957846271", "s235024999"]} +{"user_id": "u298297089", "problem_id": "p03325", "language": "python", "submission_id_v0": "s106132375", "submission_id_v1": "s827937559", "cpu_time_v0": 122, "cpu_time_v1": 72, "memory_v0": 4148, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.98, "input": "N = int(input())\n\nx = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in x:\n\n while i % 2 == 0:\n\n cnt += 1\n\n i /= 2\n\nprint(cnt)", "target": "n = int(input())\n\nans = 0\n\nfor i in map(int, input().split()):\n\n cnt = 0\n\n while i % 2 == 0:\n\n i >>= 1\n\n cnt += 1\n\n ans += cnt\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 134, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "N = int(input())\nx = list(map(int, input().split()))\ncnt = 0\nfor i in x:\n while i % 2 == 0:\n cnt += 1\n i /= 2\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\nans = 0\nfor i in map(int, input().split()):\n cnt = 0\n while i % 2 == 0:\n i >>= 1\n cnt += 1\n ans += cnt\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-N = int(input())", "-x = list(map(int, input().split()))", "-cnt = 0", "-for i in x:", "+n = int(input())", "+ans = 0", "+for i in map(int, input().split()):", "+ cnt = 0", "+ i >>= 1", "- i /= 2", "-print(cnt)", "+ ans += cnt", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2336064763, "measured_runtime_v1": 0.0059840708, "runtime_lift": 39.0380536239, "key": ["s106132375", "s827937559"]} +{"user_id": "u230717961", "problem_id": "p03796", "language": "python", "submission_id_v0": "s450924156", "submission_id_v1": "s743009434", "cpu_time_v0": 229, "cpu_time_v1": 35, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.72, "input": "import math\n\nn = int(input())\n\n\n\npower = math.factorial(n)\n\n\n\nprint((power % (10**9 + 7)))\n", "target": "import math\n\nn = int(input())\n\n\n\npower = 1\n\n\n\nfor i in range(1, n+1):\n\n power = i * power % (10**9 + 7)\n\n\n\nprint(power)\n", "code_v0_loc": 6, "code_v1_loc": 9, "code_v0_num_chars": 89, "code_v1_num_chars": 123, "code_v0_no_empty_lines": "import math\n\nn = int(input())\npower = math.factorial(n)\nprint((power % (10**9 + 7)))\n", "code_v1_no_empty_lines": "import math\n\nn = int(input())\npower = 1\nfor i in range(1, n + 1):\n power = i * power % (10**9 + 7)\nprint(power)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-power = math.factorial(n)", "-print((power % (10**9 + 7)))", "+power = 1", "+for i in range(1, n + 1):", "+ power = i * power % (10**9 + 7)", "+print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5500237288, "measured_runtime_v1": 0.2133381867, "runtime_lift": 2.5781775744, "key": ["s450924156", "s743009434"]} +{"user_id": "u077898957", "problem_id": "p03796", "language": "python", "submission_id_v0": "s080864979", "submission_id_v1": "s354066004", "cpu_time_v0": 230, "cpu_time_v1": 42, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.74, "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))\n", "target": "n = int(input())\n\npw = 1\n\nfor i in range(n):\n\n pw *= (i+1)\n\n pw %= 10**9+7\n\nprint(pw)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 66, "code_v1_num_chars": 87, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\npw = 1\nfor i in range(n):\n pw *= i + 1\n pw %= 10**9 + 7\nprint(pw)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+pw = 1", "+for i in range(n):", "+ pw *= i + 1", "+ pw %= 10**9 + 7", "+print(pw)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9190823469, "measured_runtime_v1": 0.4266894727, "runtime_lift": 2.1539841167, "key": ["s080864979", "s354066004"]} +{"user_id": "u467041847", "problem_id": "p03416", "language": "python", "submission_id_v0": "s364629573", "submission_id_v1": "s490395080", "cpu_time_v0": 93, "cpu_time_v1": 62, "memory_v0": 3316, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "A,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(n):\n\n\tkey = 0\n\n\tfor i in range(1,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(B)-kaibun(A-1)))", "target": "A,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(m, n):\n\n\tkey = 0\n\n\tfor i in range(m,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(A,B)))", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 173, "code_v1_num_chars": 166, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\n\n\ndef kaibun(n):\n key = 0\n for i in range(1, n + 1):\n if str(i) == str(i)[::-1]:\n key += 1\n return key\n\n\nprint((kaibun(B) - kaibun(A - 1)))\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\n\n\ndef kaibun(m, n):\n key = 0\n for i in range(m, n + 1):\n if str(i) == str(i)[::-1]:\n key += 1\n return key\n\n\nprint((kaibun(A, B)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-def kaibun(n):", "+def kaibun(m, n):", "- for i in range(1, n + 1):", "+ for i in range(m, n + 1):", "-print((kaibun(B) - kaibun(A - 1)))", "+print((kaibun(A, B)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5900465159, "measured_runtime_v1": 0.3264039189, "runtime_lift": 1.8077188467, "key": ["s364629573", "s490395080"]} +{"user_id": "u868628468", "problem_id": "p02555", "language": "python", "submission_id_v0": "s517832809", "submission_id_v1": "s490323912", "cpu_time_v0": 151, "cpu_time_v1": 62, "memory_v0": 73984, "memory_v1": 63380, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.94, "input": "from sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n for x in range(3,i+1):\n\n if x in [i-1,i-2]:\n\n continue\n\n dp[i] += dp[i-x]\n\n return dp[s]%mod\n\nprint((solve()))", "target": "from sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n return dp[s]%mod\n\nprint((solve()))", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 330, "code_v1_num_chars": 245, "code_v0_no_empty_lines": "from sys import stdin\n\n\ndef solve():\n s = int(stdin.readline())\n mod = 10**9 + 7\n if s < 3:\n return 0\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(3, s + 1):\n for x in range(3, i + 1):\n if x in [i - 1, i - 2]:\n continue\n dp[i] += dp[i - x]\n return dp[s] % mod\n\n\nprint((solve()))\n", "code_v1_no_empty_lines": "from sys import stdin\n\n\ndef solve():\n s = int(stdin.readline())\n mod = 10**9 + 7\n if s < 3:\n return 0\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(3, s + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n return dp[s] % mod\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["- for x in range(3, i + 1):", "- if x in [i - 1, i - 2]:", "- continue", "- dp[i] += dp[i - x]", "+ dp[i] = dp[i - 1] + dp[i - 3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6190335753, "measured_runtime_v1": 0.2015811858, "runtime_lift": 3.0708896406, "key": ["s517832809", "s490323912"]} +{"user_id": "u678167152", "problem_id": "p02773", "language": "python", "submission_id_v0": "s779115559", "submission_id_v1": "s953043553", "cpu_time_v0": 682, "cpu_time_v1": 392, "memory_v0": 32096, "memory_v1": 38716, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.52, "input": "N = int(input())\n\ns_list = {}\n\nfor i in range(N):\n\n S = input()\n\n if S in list(s_list.keys()):\n\n s_list[S] += 1\n\n else:\n\n s_list[S] = 0\n\nmax = 0\n\nmaxs = []\n\nfor s,c in list(s_list.items()):\n\n if c > max:\n\n maxs = [s]\n\n max = c\n\n elif c == max:\n\n maxs.append(s)\n\nmaxs.sort()\n\nfor m in maxs:\n\n print(m)", "target": "from collections import Counter\n\ndef solve():\n\n N = int(input())\n\n S = [input() for _ in range(N)]\n\n c = Counter(S)\n\n M = max(c.values())\n\n ans = []\n\n for k,v in c.items():\n\n if v==M:\n\n ans.append(k)\n\n ans.sort()\n\n return ans\n\nprint(*solve(),sep='\\n')\n", "code_v0_loc": 19, "code_v1_loc": 13, "code_v0_num_chars": 309, "code_v1_num_chars": 267, "code_v0_no_empty_lines": "N = int(input())\ns_list = {}\nfor i in range(N):\n S = input()\n if S in list(s_list.keys()):\n s_list[S] += 1\n else:\n s_list[S] = 0\nmax = 0\nmaxs = []\nfor s, c in list(s_list.items()):\n if c > max:\n maxs = [s]\n max = c\n elif c == max:\n maxs.append(s)\nmaxs.sort()\nfor m in maxs:\n print(m)\n", "code_v1_no_empty_lines": "from collections import Counter\n\n\ndef solve():\n N = int(input())\n S = [input() for _ in range(N)]\n c = Counter(S)\n M = max(c.values())\n ans = []\n for k, v in c.items():\n if v == M:\n ans.append(k)\n ans.sort()\n return ans\n\n\nprint(*solve(), sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 31.5789473684, "diff": ["-N = int(input())", "-s_list = {}", "-for i in range(N):", "- S = input()", "- if S in list(s_list.keys()):", "- s_list[S] += 1", "- else:", "- s_list[S] = 0", "-max = 0", "-maxs = []", "-for s, c in list(s_list.items()):", "- if c > max:", "- maxs = [s]", "- max = c", "- elif c == max:", "- maxs.append(s)", "-maxs.sort()", "-for m in maxs:", "- print(m)", "+from collections import Counter", "+", "+", "+def solve():", "+ N = int(input())", "+ S = [input() for _ in range(N)]", "+ c = Counter(S)", "+ M = max(c.values())", "+ ans = []", "+ for k, v in c.items():", "+ if v == M:", "+ ans.append(k)", "+ ans.sort()", "+ return ans", "+", "+", "+print(*solve(), sep=\"\\n\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1935686147, "measured_runtime_v1": 0.0062823365, "runtime_lift": 30.8115643329, "key": ["s779115559", "s953043553"]} +{"user_id": "u018679195", "problem_id": "p03796", "language": "python", "submission_id_v0": "s992615685", "submission_id_v1": "s822858934", "cpu_time_v0": 232, "cpu_time_v1": 36, "memory_v0": 4024, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.48, "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))", "target": "M = 1000000007\n\nn=int(input())\n\nf = 1\n\nfor i in range(1, n + 1): \n\n f = (f * i) % M \n\nprint(f)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 69, "code_v1_num_chars": 98, "code_v0_no_empty_lines": "import math\n\nx = int(input())\nprint((math.factorial(x) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "M = 1000000007\nn = int(input())\nf = 1\nfor i in range(1, n + 1):\n f = (f * i) % M\nprint(f)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-x = int(input())", "-print((math.factorial(x) % (10**9 + 7)))", "+M = 1000000007", "+n = int(input())", "+f = 1", "+for i in range(1, n + 1):", "+ f = (f * i) % M", "+print(f)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5256081567, "measured_runtime_v1": 0.2486211307, "runtime_lift": 2.1140928576, "key": ["s992615685", "s822858934"]} +{"user_id": "u926412290", "problem_id": "p02730", "language": "python", "submission_id_v0": "s449146060", "submission_id_v1": "s811980926", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "S = input()\n\nN = len(S)\n\nleft = S[:int(N/2)]\n\nright = S[int((N+2)/2):]\n\nS_reversed = \"\".join(reversed(list(S)))\n\nleft_reversed = \"\".join(reversed(list(left)))\n\nright_reversed = \"\".join(reversed(list(right)))\n\n\n\nif S == S_reversed and left == left_reversed and right == right_reversed:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "target": "S = input()\n\nN = len(S)\n\nleft = S[:int(N/2)]\n\nright = S[int((N+2)/2):]\n\n\n\nif S == S[::-1] and left == left[::-1] and right == right[::-1]:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "code_v0_loc": 12, "code_v1_loc": 9, "code_v0_num_chars": 326, "code_v1_num_chars": 180, "code_v0_no_empty_lines": "S = input()\nN = len(S)\nleft = S[: int(N / 2)]\nright = S[int((N + 2) / 2) :]\nS_reversed = \"\".join(reversed(list(S)))\nleft_reversed = \"\".join(reversed(list(left)))\nright_reversed = \"\".join(reversed(list(right)))\nif S == S_reversed and left == left_reversed and right == right_reversed:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "S = input()\nN = len(S)\nleft = S[: int(N / 2)]\nright = S[int((N + 2) / 2) :]\nif S == S[::-1] and left == left[::-1] and right == right[::-1]:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-S_reversed = \"\".join(reversed(list(S)))", "-left_reversed = \"\".join(reversed(list(left)))", "-right_reversed = \"\".join(reversed(list(right)))", "-if S == S_reversed and left == left_reversed and right == right_reversed:", "+if S == S[::-1] and left == left[::-1] and right == right[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2928721476, "measured_runtime_v1": 0.0555575957, "runtime_lift": 5.2715050689, "key": ["s449146060", "s811980926"]} +{"user_id": "u896741788", "problem_id": "p03416", "language": "python", "submission_id_v0": "s606562684", "submission_id_v1": "s721402043", "cpu_time_v0": 284, "cpu_time_v1": 62, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.17, "input": "a,b=list(map(int,input().split()))\n\nans=0\n\nfor i in range(b+1)[a:]:\n\n if len(str(i))%2==0:\n\n p=list(str(i))[:len(str(i))//2]\n\n q=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if p==q:\n\n ans+=1\n\n else:\n\n s=list(str(i))[:len(str(i))//2+1]\n\n d=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if s==d:\n\n ans += 1\n\nprint(ans)", "target": "a,s=list(map(int,input().split()))\n\nad=0\n\nfor i in range(a,s+1):\n\n if str(i)==str(i)[::-1]:ad+=1\n\nprint(ad)", "code_v0_loc": 14, "code_v1_loc": 5, "code_v0_num_chars": 346, "code_v1_num_chars": 102, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(b + 1)[a:]:\n if len(str(i)) % 2 == 0:\n p = list(str(i))[: len(str(i)) // 2]\n q = list(reversed(list(str(i))[len(str(i)) // 2 :]))\n if p == q:\n ans += 1\n else:\n s = list(str(i))[: len(str(i)) // 2 + 1]\n d = list(reversed(list(str(i))[len(str(i)) // 2 :]))\n if s == d:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "a, s = list(map(int, input().split()))\nad = 0\nfor i in range(a, s + 1):\n if str(i) == str(i)[::-1]:\n ad += 1\nprint(ad)\n", "code_same": false, "relative_loc_diff_percent": 64.2857142857, "diff": ["-a, b = list(map(int, input().split()))", "-ans = 0", "-for i in range(b + 1)[a:]:", "- if len(str(i)) % 2 == 0:", "- p = list(str(i))[: len(str(i)) // 2]", "- q = list(reversed(list(str(i))[len(str(i)) // 2 :]))", "- if p == q:", "- ans += 1", "- else:", "- s = list(str(i))[: len(str(i)) // 2 + 1]", "- d = list(reversed(list(str(i))[len(str(i)) // 2 :]))", "- if s == d:", "- ans += 1", "-print(ans)", "+a, s = list(map(int, input().split()))", "+ad = 0", "+for i in range(a, s + 1):", "+ if str(i) == str(i)[::-1]:", "+ ad += 1", "+print(ad)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6921946588, "measured_runtime_v1": 0.3831296915, "runtime_lift": 1.8066849794, "key": ["s606562684", "s721402043"]} +{"user_id": "u590871958", "problem_id": "p01093", "language": "python", "submission_id_v0": "s330226420", "submission_id_v1": "s459093378", "cpu_time_v0": 50, "cpu_time_v1": 40, "memory_v0": 7684, "memory_v1": 7704, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.0, "input": "while int(input()) > 0:\n\n s = sorted(map(int, input().split()))\n\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))", "target": "while True:\n\n if int(input()) == 0:\n\n break\n\n s = sorted(map(int, input().split()))\n\n r = min(abs(x - y) for (x, y) in zip(s, s[1:]))\n\n print(r)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 122, "code_v1_num_chars": 163, "code_v0_no_empty_lines": "while int(input()) > 0:\n s = sorted(map(int, input().split()))\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))\n", "code_v1_no_empty_lines": "while True:\n if int(input()) == 0:\n break\n s = sorted(map(int, input().split()))\n r = min(abs(x - y) for (x, y) in zip(s, s[1:]))\n print(r)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-while int(input()) > 0:", "+while True:", "+ if int(input()) == 0:", "+ break", "- print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))", "+ r = min(abs(x - y) for (x, y) in zip(s, s[1:]))", "+ print(r)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2760278752, "measured_runtime_v1": 0.2140542445, "runtime_lift": 1.2895230169, "key": ["s330226420", "s459093378"]} +{"user_id": "u392029857", "problem_id": "p03416", "language": "python", "submission_id_v0": "s263636434", "submission_id_v1": "s255168613", "cpu_time_v0": 110, "cpu_time_v1": 20, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.82, "input": "A, B = list(map(int, input().split()))\n\nnumbers = list(range(A, B+1))\n\ncount = 0\n\nfor i in numbers:\n\n m = str(i)\n\n rm = ''.join(list(reversed(m)))\n\n if m == rm:\n\n count += 1\n\nprint(count)", "target": "A, B = list(map(int, input().split()))\n\nx = list(range(1,10))\n\ny = list(range(10))\n\ncount = 0\n\nfor p in x:\n\n for q in y:\n\n for r in y:\n\n sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))\n\n if A <= sakasama <= B:\n\n count += 1\n\nprint(count)", "code_v0_loc": 9, "code_v1_loc": 11, "code_v0_num_chars": 191, "code_v1_num_chars": 268, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\nnumbers = list(range(A, B + 1))\ncount = 0\nfor i in numbers:\n m = str(i)\n rm = \"\".join(list(reversed(m)))\n if m == rm:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nx = list(range(1, 10))\ny = list(range(10))\ncount = 0\nfor p in x:\n for q in y:\n for r in y:\n sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))\n if A <= sakasama <= B:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-numbers = list(range(A, B + 1))", "+x = list(range(1, 10))", "+y = list(range(10))", "-for i in numbers:", "- m = str(i)", "- rm = \"\".join(list(reversed(m)))", "- if m == rm:", "- count += 1", "+for p in x:", "+ for q in y:", "+ for r in y:", "+ sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))", "+ if A <= sakasama <= B:", "+ count += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3536295901, "measured_runtime_v1": 0.1996227459, "runtime_lift": 1.7714894587, "key": ["s263636434", "s255168613"]} +{"user_id": "u855831834", "problem_id": "p02596", "language": "python", "submission_id_v0": "s777833838", "submission_id_v1": "s349314776", "cpu_time_v0": 179, "cpu_time_v1": 88, "memory_v0": 9072, "memory_v1": 63520, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.84, "input": "k = int(input())\n\nnum = 0\n\nif not k%2:\n\n print((-1))\n\nelse:\n\n for i in range(k):\n\n num = (num*10+7)%k\n\n if num == 0:\n\n print((i+1))\n\n break\n\n else:\n\n print((-1))", "target": "K = int(input())\n\n\n\nans = 1\n\nnum = 0\n\nseven = 7\n\n\n\nif not K%2:\n\n print((-1))\n\nelse:\n\n for i in range(K):\n\n num = num + seven\n\n seven = seven*10%K\n\n num = num%K\n\n if num == 0:\n\n print(ans)\n\n break\n\n ans += 1\n\n else:\n\n print((-1))", "code_v0_loc": 12, "code_v1_loc": 19, "code_v0_num_chars": 207, "code_v1_num_chars": 297, "code_v0_no_empty_lines": "k = int(input())\nnum = 0\nif not k % 2:\n print((-1))\nelse:\n for i in range(k):\n num = (num * 10 + 7) % k\n if num == 0:\n print((i + 1))\n break\n else:\n print((-1))\n", "code_v1_no_empty_lines": "K = int(input())\nans = 1\nnum = 0\nseven = 7\nif not K % 2:\n print((-1))\nelse:\n for i in range(K):\n num = num + seven\n seven = seven * 10 % K\n num = num % K\n if num == 0:\n print(ans)\n break\n ans += 1\n else:\n print((-1))\n", "code_same": false, "relative_loc_diff_percent": 36.8421052632, "diff": ["-k = int(input())", "+K = int(input())", "+ans = 1", "-if not k % 2:", "+seven = 7", "+if not K % 2:", "- for i in range(k):", "- num = (num * 10 + 7) % k", "+ for i in range(K):", "+ num = num + seven", "+ seven = seven * 10 % K", "+ num = num % K", "- print((i + 1))", "+ print(ans)", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.513984643, "measured_runtime_v1": 0.3340408325, "runtime_lift": 1.5386880672, "key": ["s777833838", "s349314776"]} +{"user_id": "u444560129", "problem_id": "p02596", "language": "python", "submission_id_v0": "s838540391", "submission_id_v1": "s786083962", "cpu_time_v0": 192, "cpu_time_v1": 156, "memory_v0": 9088, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.75, "input": "k = int(input())\n\ncount = 1\n\nn = 0\n\nif k % 2 == 0 or k % 5 == 0:\n\n print((-1))\n\nelse:\n\n while 1:\n\n n = (n * 10 + 7) % k \n\n if n == 0:\n\n break \n\n count += 1\n\n print(count)", "target": "def main(h):\n\n count = 1\n\n n = 0\n\n for i in range (k):\n\n n = (n * 10 + 7) % k \n\n if n == 0: \n\n print(count)\n\n return 0\n\n count += 1\n\n print((-1))\n\n \n\nif __name__ == '__main__':\n\n k = int(input())\n\n main(k)", "code_v0_loc": 12, "code_v1_loc": 14, "code_v0_num_chars": 196, "code_v1_num_chars": 230, "code_v0_no_empty_lines": "k = int(input())\ncount = 1\nn = 0\nif k % 2 == 0 or k % 5 == 0:\n print((-1))\nelse:\n while 1:\n n = (n * 10 + 7) % k\n if n == 0:\n break\n count += 1\n print(count)\n", "code_v1_no_empty_lines": "def main(h):\n count = 1\n n = 0\n for i in range(k):\n n = (n * 10 + 7) % k\n if n == 0:\n print(count)\n return 0\n count += 1\n print((-1))\n\n\nif __name__ == \"__main__\":\n k = int(input())\n main(k)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-k = int(input())", "-count = 1", "-n = 0", "-if k % 2 == 0 or k % 5 == 0:", "- print((-1))", "-else:", "- while 1:", "+def main(h):", "+ count = 1", "+ n = 0", "+ for i in range(k):", "- break", "+ print(count)", "+ return 0", "- print(count)", "+ print((-1))", "+", "+", "+if __name__ == \"__main__\":", "+ k = int(input())", "+ main(k)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.359774395, "measured_runtime_v1": 0.0061541715, "runtime_lift": 58.4602486856, "key": ["s838540391", "s786083962"]} +{"user_id": "u089376182", "problem_id": "p03250", "language": "python", "submission_id_v0": "s131709017", "submission_id_v1": "s244884559", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "a, b, c = sorted(map(int, input().split()))\n\n\n\nprint((c*10 + b + a))", "target": "a, b, c = list(map(int, input().split()))\n\n\n\nprint((max(a, b, c)*9 + (a + b + c)))", "code_v0_loc": 3, "code_v1_loc": 3, "code_v0_num_chars": 66, "code_v1_num_chars": 74, "code_v0_no_empty_lines": "a, b, c = sorted(map(int, input().split()))\nprint((c * 10 + b + a))\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nprint((max(a, b, c) * 9 + (a + b + c)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-a, b, c = sorted(map(int, input().split()))", "-print((c * 10 + b + a))", "+a, b, c = list(map(int, input().split()))", "+print((max(a, b, c) * 9 + (a + b + c)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2633334219, "measured_runtime_v1": 0.0501041813, "runtime_lift": 5.2557174893, "key": ["s131709017", "s244884559"]} +{"user_id": "u813098295", "problem_id": "p03371", "language": "python", "submission_id_v0": "s229566237", "submission_id_v1": "s072536815", "cpu_time_v0": 222, "cpu_time_v1": 129, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 41.89, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(200005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)", "target": "a, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(100005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 204, "code_v1_num_chars": 204, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(200005):\n tmp = i * 2 * c\n tmp += max(0, x - i) * a\n tmp += max(0, y - i) * b\n ans = min(ans, tmp)\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(100005):\n tmp = i * 2 * c\n tmp += max(0, x - i) * a\n tmp += max(0, y - i) * b\n ans = min(ans, tmp)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-for i in range(200005):", "+for i in range(100005):"], "diff_only_import_comment": false, "measured_runtime_v0": 2.0992211397, "measured_runtime_v1": 1.3130319312, "runtime_lift": 1.5987586363, "key": ["s229566237", "s072536815"]} +{"user_id": "u576434377", "problem_id": "p03568", "language": "python", "submission_id_v0": "s245503579", "submission_id_v1": "s305475228", "cpu_time_v0": 101, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.17, "input": "N = int(input())\n\nAs = list(map(int,input().split()))\n\n\n\n\n\ndef dfs(A_s, index,Bss):\n\n if index == N:\n\n tmp = 1\n\n for b in Bss:\n\n tmp *= b\n\n return 1 if tmp % 2 == 0 else 0\n\n b_mi = Bss.copy()\n\n b_mi.append(A_s[index] - 1)\n\n\n\n b = Bss.copy()\n\n b.append(A_s[index])\n\n\n\n b_pl = Bss.copy()\n\n b_pl.append(A_s[index] + 1)\n\n return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)\n\n\n\n\n\nprint((dfs(As,0,[])))\n", "target": "N = int(input())\n\nAs = list(map(int,input().split()))\n\n\n\ntmp = 1\n\nfor i in range(N):\n\n if As[i] % 2 == 0:\n\n tmp *= 2\n\n\n\nprint((3 ** N - tmp))", "code_v0_loc": 22, "code_v1_loc": 9, "code_v0_num_chars": 480, "code_v1_num_chars": 148, "code_v0_no_empty_lines": "N = int(input())\nAs = list(map(int, input().split()))\n\n\ndef dfs(A_s, index, Bss):\n if index == N:\n tmp = 1\n for b in Bss:\n tmp *= b\n return 1 if tmp % 2 == 0 else 0\n b_mi = Bss.copy()\n b_mi.append(A_s[index] - 1)\n b = Bss.copy()\n b.append(A_s[index])\n b_pl = Bss.copy()\n b_pl.append(A_s[index] + 1)\n return (\n dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)\n )\n\n\nprint((dfs(As, 0, [])))\n", "code_v1_no_empty_lines": "N = int(input())\nAs = list(map(int, input().split()))\ntmp = 1\nfor i in range(N):\n if As[i] % 2 == 0:\n tmp *= 2\nprint((3**N - tmp))\n", "code_same": false, "relative_loc_diff_percent": 59.0909090909, "diff": ["-", "-", "-def dfs(A_s, index, Bss):", "- if index == N:", "- tmp = 1", "- for b in Bss:", "- tmp *= b", "- return 1 if tmp % 2 == 0 else 0", "- b_mi = Bss.copy()", "- b_mi.append(A_s[index] - 1)", "- b = Bss.copy()", "- b.append(A_s[index])", "- b_pl = Bss.copy()", "- b_pl.append(A_s[index] + 1)", "- return (", "- dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)", "- )", "-", "-", "-print((dfs(As, 0, [])))", "+tmp = 1", "+for i in range(N):", "+ if As[i] % 2 == 0:", "+ tmp *= 2", "+print((3**N - tmp))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4574659042, "measured_runtime_v1": 0.2742938831, "runtime_lift": 1.6677947721, "key": ["s245503579", "s305475228"]} +{"user_id": "u414877092", "problem_id": "p03796", "language": "python", "submission_id_v0": "s477602976", "submission_id_v1": "s500304823", "cpu_time_v0": 230, "cpu_time_v1": 31, "memory_v0": 4024, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 86.52, "input": "import math\n\nn=int(input())\n\nprint((math.factorial(n)%(10**9+7)))", "target": "N=int(input())\n\ndef fact(n):\n\n val=1\n\n for i in range(2,n+1):\n\n val*=i\n\n val%=1000000007\n\n return val\n\nprint((fact(N)))", "code_v0_loc": 3, "code_v1_loc": 8, "code_v0_num_chars": 63, "code_v1_num_chars": 140, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "N = int(input())\n\n\ndef fact(n):\n val = 1\n for i in range(2, n + 1):\n val *= i\n val %= 1000000007\n return val\n\n\nprint((fact(N)))\n", "code_same": false, "relative_loc_diff_percent": 62.5, "diff": ["-import math", "+N = int(input())", "-n = int(input())", "-print((math.factorial(n) % (10**9 + 7)))", "+", "+def fact(n):", "+ val = 1", "+ for i in range(2, n + 1):", "+ val *= i", "+ val %= 1000000007", "+ return val", "+", "+", "+print((fact(N)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5394072673, "measured_runtime_v1": 0.259771318, "runtime_lift": 2.0764696871, "key": ["s477602976", "s500304823"]} +{"user_id": "u573754721", "problem_id": "p02792", "language": "python", "submission_id_v0": "s001079757", "submission_id_v1": "s791261959", "cpu_time_v0": 461, "cpu_time_v1": 326, "memory_v0": 40684, "memory_v1": 40428, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.28, "input": "n=int(input())\n\nD={}\n\nDD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n t=(str(i)[-1],str(i)[0])\n\n if s not in D:\n\n D[s]=1\n\n else:\n\n D[s]+=1\n\n if t not in DD:\n\n DD[t]=1\n\n else:\n\n DD[t]+=1\n\nans=0\n\nfor i in D:\n\n if i in DD:\n\n ans+=D[i]*DD[i]\n\nprint(ans)\n\n ", "target": "n=int(input())\n\nD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n if s in D:\n\n D[s]+=1\n\n else:\n\n D[s]=1\n\n\n\nans=0\n\nfor aj,bj in D:\n\n if (bj,aj) in D:\n\n ans+=D[(aj,bj)]*D[(bj,aj)]\n\nprint(ans)", "code_v0_loc": 20, "code_v1_loc": 14, "code_v0_num_chars": 307, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "n = int(input())\nD = {}\nDD = {}\nfor i in range(1, n + 1):\n s = (str(i)[0], str(i)[-1])\n t = (str(i)[-1], str(i)[0])\n if s not in D:\n D[s] = 1\n else:\n D[s] += 1\n if t not in DD:\n DD[t] = 1\n else:\n DD[t] += 1\nans = 0\nfor i in D:\n if i in DD:\n ans += D[i] * DD[i]\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nD = {}\nfor i in range(1, n + 1):\n s = (str(i)[0], str(i)[-1])\n if s in D:\n D[s] += 1\n else:\n D[s] = 1\nans = 0\nfor aj, bj in D:\n if (bj, aj) in D:\n ans += D[(aj, bj)] * D[(bj, aj)]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-DD = {}", "- t = (str(i)[-1], str(i)[0])", "- if s not in D:", "+ if s in D:", "+ D[s] += 1", "+ else:", "- else:", "- D[s] += 1", "- if t not in DD:", "- DD[t] = 1", "- else:", "- DD[t] += 1", "-for i in D:", "- if i in DD:", "- ans += D[i] * DD[i]", "+for aj, bj in D:", "+ if (bj, aj) in D:", "+ ans += D[(aj, bj)] * D[(bj, aj)]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4521915812, "measured_runtime_v1": 0.3498246684, "runtime_lift": 1.2926234825, "key": ["s001079757", "s791261959"]} +{"user_id": "u486297080", "problem_id": "p03796", "language": "python", "submission_id_v0": "s015826115", "submission_id_v1": "s256698183", "cpu_time_v0": 231, "cpu_time_v1": 37, "memory_v0": 4020, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.98, "input": "import math\n\n\n\nN = int(input())\n\nans = 0\n\n\n\nans =math.factorial(N) % (10**9 +7)\n\n\n\nprint(ans)", "target": "N = int(input())\n\npower = 1\n\n\n\nfor i in range(N):\n\n power = ((i+1) * power) % 1000000007\n\n\n\nprint(power)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 93, "code_v1_num_chars": 107, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = 0\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\npower = 1\nfor i in range(N):\n power = ((i + 1) * power) % 1000000007\nprint(power)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-import math", "-", "-ans = 0", "-ans = math.factorial(N) % (10**9 + 7)", "-print(ans)", "+power = 1", "+for i in range(N):", "+ power = ((i + 1) * power) % 1000000007", "+print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5450858786, "measured_runtime_v1": 0.2547745125, "runtime_lift": 2.1394835503, "key": ["s015826115", "s256698183"]} +{"user_id": "u969190727", "problem_id": "p03371", "language": "python", "submission_id_v0": "s944521020", "submission_id_v1": "s713825460", "cpu_time_v0": 121, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.95, "input": "a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nn=max(x,y)\n\nfor i in range(1,n+1):\n\n ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))\n\nprint(ans)\n\n\n\n\n", "target": "a,b,c,x,y=list(map(int,input().split()))\n\nans1=a*x+b*y\n\nans2=2*c*max(x,y)\n\nans3=2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y))\n\nprint((min(ans1,ans2,ans3)))", "code_v0_loc": 8, "code_v1_loc": 5, "code_v0_num_chars": 148, "code_v1_num_chars": 144, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nn = max(x, y)\nfor i in range(1, n + 1):\n ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans1 = a * x + b * y\nans2 = 2 * c * max(x, y)\nans3 = 2 * c * min(x, y) + a * (x - min(x, y)) + b * (y - min(x, y))\nprint((min(ans1, ans2, ans3)))\n", "code_same": false, "relative_loc_diff_percent": 37.5, "diff": ["-ans = a * x + b * y", "-n = max(x, y)", "-for i in range(1, n + 1):", "- ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))", "-print(ans)", "+ans1 = a * x + b * y", "+ans2 = 2 * c * max(x, y)", "+ans3 = 2 * c * min(x, y) + a * (x - min(x, y)) + b * (y - min(x, y))", "+print((min(ans1, ans2, ans3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.247306282, "measured_runtime_v1": 0.1774894836, "runtime_lift": 1.3933573811, "key": ["s944521020", "s713825460"]} +{"user_id": "u879870653", "problem_id": "p03325", "language": "python", "submission_id_v0": "s933212033", "submission_id_v1": "s130104970", "cpu_time_v0": 143, "cpu_time_v1": 121, "memory_v0": 4148, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.38, "input": "answer = 0\n\nN = int(input())\n\nA = list(map(int,input().split()))\n\nfor i in range(N) :\n\n while A[i] % 2 == 0 :\n\n A[i] = A[i] / 2\n\n answer += 1\n\nprint(answer)\n\n\n", "target": "N = int(input())\n\nL = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor i in range(N) :\n\n flag = 0\n\n while flag == 0 :\n\n if (L[i] % 2) == 0 :\n\n ans += 1\n\n L[i] = L[i]//2\n\n else :\n\n flag = 1\n\nprint(ans)\n", "code_v0_loc": 9, "code_v1_loc": 13, "code_v0_num_chars": 176, "code_v1_num_chars": 252, "code_v0_no_empty_lines": "answer = 0\nN = int(input())\nA = list(map(int, input().split()))\nfor i in range(N):\n while A[i] % 2 == 0:\n A[i] = A[i] / 2\n answer += 1\nprint(answer)\n", "code_v1_no_empty_lines": "N = int(input())\nL = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n flag = 0\n while flag == 0:\n if (L[i] % 2) == 0:\n ans += 1\n L[i] = L[i] // 2\n else:\n flag = 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.7692307692, "diff": ["-answer = 0", "-A = list(map(int, input().split()))", "+L = list(map(int, input().split()))", "+ans = 0", "- while A[i] % 2 == 0:", "- A[i] = A[i] / 2", "- answer += 1", "-print(answer)", "+ flag = 0", "+ while flag == 0:", "+ if (L[i] % 2) == 0:", "+ ans += 1", "+ L[i] = L[i] // 2", "+ else:", "+ flag = 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2890260706, "measured_runtime_v1": 0.1461268132, "runtime_lift": 1.9779126383, "key": ["s933212033", "s130104970"]} +{"user_id": "u728498511", "problem_id": "p03416", "language": "python", "submission_id_v0": "s773095214", "submission_id_v1": "s841162290", "cpu_time_v0": 111, "cpu_time_v1": 67, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.64, "input": "n, m = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n, m+1):\n\n if str(i)[0]+str(i)[1] == str(i)[-1]+str(i)[-2]: ans += 1\n\nprint(ans)", "target": "a, b = list(map(int, input().split()))\n\nans = 0\n\nfor n in range(a, b+1):\n\n if str(n) == str(n)[::-1]: ans += 1\n\nprint(ans)", "code_v0_loc": 5, "code_v1_loc": 5, "code_v0_num_chars": 141, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\nans = 0\nfor i in range(n, m + 1):\n if str(i)[0] + str(i)[1] == str(i)[-1] + str(i)[-2]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor n in range(a, b + 1):\n if str(n) == str(n)[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-n, m = list(map(int, input().split()))", "+a, b = list(map(int, input().split()))", "-for i in range(n, m + 1):", "- if str(i)[0] + str(i)[1] == str(i)[-1] + str(i)[-2]:", "+for n in range(a, b + 1):", "+ if str(n) == str(n)[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6137721554, "measured_runtime_v1": 0.3378130706, "runtime_lift": 1.8168987785, "key": ["s773095214", "s841162290"]} +{"user_id": "u498511622", "problem_id": "p00001", "language": "python", "submission_id_v0": "s534000808", "submission_id_v1": "s891056906", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7536, "memory_v1": 7656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "ans=[]\n\nfor i in range (0,10):\n\n ans.append(int(input()))\n\nans.sort(reverse=True)\n\nfor i in range (0,3):\n\n print((ans[i]))", "target": "mountain=[]\n\nfor s in range(0,10):\n\n mountain.append(int(input()))\n\nmountain.sort(reverse=True)\n\nfor s in range(0,3):\n\n print((mountain[s]))", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 126, "code_v1_num_chars": 141, "code_v0_no_empty_lines": "ans = []\nfor i in range(0, 10):\n ans.append(int(input()))\nans.sort(reverse=True)\nfor i in range(0, 3):\n print((ans[i]))\n", "code_v1_no_empty_lines": "mountain = []\nfor s in range(0, 10):\n mountain.append(int(input()))\nmountain.sort(reverse=True)\nfor s in range(0, 3):\n print((mountain[s]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-ans = []", "-for i in range(0, 10):", "- ans.append(int(input()))", "-ans.sort(reverse=True)", "-for i in range(0, 3):", "- print((ans[i]))", "+mountain = []", "+for s in range(0, 10):", "+ mountain.append(int(input()))", "+mountain.sort(reverse=True)", "+for s in range(0, 3):", "+ print((mountain[s]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3030959003, "measured_runtime_v1": 0.0643225815, "runtime_lift": 4.7121227575, "key": ["s534000808", "s891056906"]} +{"user_id": "u530383736", "problem_id": "p02555", "language": "python", "submission_id_v0": "s720124366", "submission_id_v1": "s340965185", "cpu_time_v0": 275, "cpu_time_v1": 33, "memory_v0": 9116, "memory_v1": 9000, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 88.0, "input": "# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n cnt = 0\n\n\n\n for j in range(3, i+1):\n\n cnt += dp[i-j]\n\n cnt %= mod\n\n \n\n dp[i] = cnt\n\n\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n dp[i] = dp[i-3] + dp[i-1]\n\n dp[i] %= mod\n\n \n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 26, "code_v1_loc": 21, "code_v0_num_chars": 381, "code_v1_num_chars": 307, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\n\n\ndef main():\n S = int(sys.stdin.readline())\n dp = [0] * (S + 1)\n dp[0] = 1\n mod = 10**9 + 7\n for i in range(3, S + 1):\n cnt = 0\n for j in range(3, i + 1):\n cnt += dp[i - j]\n cnt %= mod\n dp[i] = cnt\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\n\n\ndef main():\n S = int(sys.stdin.readline())\n dp = [0] * (S + 1)\n dp[0] = 1\n mod = 10**9 + 7\n for i in range(3, S + 1):\n dp[i] = dp[i - 3] + dp[i - 1]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 19.2307692308, "diff": ["- cnt = 0", "- for j in range(3, i + 1):", "- cnt += dp[i - j]", "- cnt %= mod", "- dp[i] = cnt", "+ dp[i] = dp[i - 3] + dp[i - 1]", "+ dp[i] %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4620170944, "measured_runtime_v1": 0.1881556332, "runtime_lift": 2.4555049799, "key": ["s720124366", "s340965185"]} +{"user_id": "u678167152", "problem_id": "p02785", "language": "python", "submission_id_v0": "s271865493", "submission_id_v1": "s007549888", "cpu_time_v0": 145, "cpu_time_v1": 112, "memory_v0": 104796, "memory_v1": 31552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.76, "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n if K>=N:\n\n return 0\n\n H.sort()\n\n ans = sum(H[:N-K])\n\n return ans\n\nprint((solve()))", "target": "def solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n H.sort()\n\n ans = sum(H[:max(N-K,0)])\n\n return ans\n\nprint((solve()))", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 177, "code_v1_num_chars": 158, "code_v0_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n H = list(map(int, input().split()))\n if K >= N:\n return 0\n H.sort()\n ans = sum(H[: N - K])\n return ans\n\n\nprint((solve()))\n", "code_v1_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n H = list(map(int, input().split()))\n H.sort()\n ans = sum(H[: max(N - K, 0)])\n return ans\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["- if K >= N:", "- return 0", "- ans = sum(H[: N - K])", "+ ans = sum(H[: max(N - K, 0)])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1896718335, "measured_runtime_v1": 0.0060620093, "runtime_lift": 31.2886079077, "key": ["s271865493", "s007549888"]} +{"user_id": "u583507988", "problem_id": "p03835", "language": "python", "submission_id_v0": "s254920914", "submission_id_v1": "s788748142", "cpu_time_v0": 1001, "cpu_time_v1": 785, "memory_v0": 9104, "memory_v1": 9072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.58, "input": "k, s = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n if 0<=s-x-y<=k:\n\n ans += 1\n\n \n\nprint(ans)", "target": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n num=s-i\n\n for j in range(min(num+1,k+1)):\n\n if 0<=num-j<=k:\n\n ans+=1\n\nprint(ans)", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 146, "code_v1_num_chars": 150, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor x in range(k + 1):\n for y in range(k + 1):\n if 0 <= s - x - y <= k:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n num = s - i\n for j in range(min(num + 1, k + 1)):\n if 0 <= num - j <= k:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-for x in range(k + 1):", "- for y in range(k + 1):", "- if 0 <= s - x - y <= k:", "+for i in range(k + 1):", "+ num = s - i", "+ for j in range(min(num + 1, k + 1)):", "+ if 0 <= num - j <= k:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2276177601, "measured_runtime_v1": 0.0063076721, "runtime_lift": 36.0858579862, "key": ["s254920914", "s788748142"]} +{"user_id": "u528470578", "problem_id": "p03680", "language": "python", "submission_id_v0": "s142356798", "submission_id_v1": "s532531190", "cpu_time_v0": 547, "cpu_time_v1": 248, "memory_v0": 7084, "memory_v1": 7084, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.66, "input": "import sys\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(1e6):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))", "target": "import sys\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(2e5):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))", "code_v0_loc": 21, "code_v1_loc": 21, "code_v0_num_chars": 280, "code_v1_num_chars": 280, "code_v0_no_empty_lines": "import sys\n\nN = int(input())\na = [int(input()) for _ in range(N)]\nl = 1\np = a[0] - 1\nif a[0] == 2:\n print(l)\n sys.exit()\nwhile l < int(1e6):\n l += 1\n if a[p] == 2:\n print(l)\n break\n else:\n p = a[p] - 1\nelse:\n print((-1))\n", "code_v1_no_empty_lines": "import sys\n\nN = int(input())\na = [int(input()) for _ in range(N)]\nl = 1\np = a[0] - 1\nif a[0] == 2:\n print(l)\n sys.exit()\nwhile l < int(2e5):\n l += 1\n if a[p] == 2:\n print(l)\n break\n else:\n p = a[p] - 1\nelse:\n print((-1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-while l < int(1e6):", "+while l < int(2e5):"], "diff_only_import_comment": false, "measured_runtime_v0": 1.1321929171, "measured_runtime_v1": 0.4105077217, "runtime_lift": 2.7580307442, "key": ["s142356798", "s532531190"]} +{"user_id": "u359358631", "problem_id": "p03796", "language": "python", "submission_id_v0": "s916466489", "submission_id_v1": "s520315696", "cpu_time_v0": 158, "cpu_time_v1": 44, "memory_v0": 10172, "memory_v1": 8932, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.15, "input": "import math\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n power = math.factorial(N)\n\n print((power % (10 ** 9 + 7)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "def main():\n\n N = int(input())\n\n power = 1\n\n for i in range(1, N + 1):\n\n power *= i\n\n power %= 10 ** 9 + 7\n\n print(power)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 160, "code_v1_num_chars": 192, "code_v0_no_empty_lines": "import math\n\n\ndef main():\n N = int(input())\n power = math.factorial(N)\n print((power % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n N = int(input())\n power = 1\n for i in range(1, N + 1):\n power *= i\n power %= 10**9 + 7\n print(power)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-import math", "-", "-", "- power = math.factorial(N)", "- print((power % (10**9 + 7)))", "+ power = 1", "+ for i in range(1, N + 1):", "+ power *= i", "+ power %= 10**9 + 7", "+ print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7842813587, "measured_runtime_v1": 0.3569579227, "runtime_lift": 2.1971255121, "key": ["s916466489", "s520315696"]} +{"user_id": "u259738923", "problem_id": "p03796", "language": "python", "submission_id_v0": "s911512169", "submission_id_v1": "s353747803", "cpu_time_v0": 231, "cpu_time_v1": 41, "memory_v0": 3972, "memory_v1": 7396, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.25, "input": "import math\n\nN = int(input())\n\nans = math.factorial(N) % (10 ** 9 + 7)\n\nprint(ans)", "target": "n = int(input())\n\nfrom functools import reduce\n\nprint((reduce(lambda x,y:x*y%1000000007,list(range(1,n+1)))))", "code_v0_loc": 4, "code_v1_loc": 3, "code_v0_num_chars": 82, "code_v1_num_chars": 107, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nfrom functools import reduce\n\nprint((reduce(lambda x, y: x * y % 1000000007, list(range(1, n + 1)))))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-import math", "+n = int(input())", "+from functools import reduce", "-N = int(input())", "-ans = math.factorial(N) % (10**9 + 7)", "-print(ans)", "+print((reduce(lambda x, y: x * y % 1000000007, list(range(1, n + 1)))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5315986769, "measured_runtime_v1": 0.2369310765, "runtime_lift": 2.2436848922, "key": ["s911512169", "s353747803"]} +{"user_id": "u775681539", "problem_id": "p03371", "language": "python", "submission_id_v0": "s986639109", "submission_id_v1": "s095330807", "cpu_time_v0": 186, "cpu_time_v1": 89, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.15, "input": "#python3\n\nINF = int(1e9)\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF\n\n for i in range(2*10**5+100):\n\n t = 2*c*i + max(x-i, 0) * a + max(y-i, 0) * b\n\n ans = min(ans, t)\n\n print(ans)\n\nmain()", "target": "INF = int(1e5)+5\n\n\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF*INF\n\n for i in range(INF):\n\n tmp = 2*i*c + a*max(x-i, 0) + b*max(y-i, 0) \n\n ans = min(tmp, ans)\n\n print(ans)\n\nmain()\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 239, "code_v1_num_chars": 231, "code_v0_no_empty_lines": "# python3\nINF = int(1e9)\n\n\ndef main():\n a, b, c, x, y = list(map(int, input().split()))\n ans = INF\n for i in range(2 * 10**5 + 100):\n t = 2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b\n ans = min(ans, t)\n print(ans)\n\n\nmain()\n", "code_v1_no_empty_lines": "INF = int(1e5) + 5\n\n\ndef main():\n a, b, c, x, y = list(map(int, input().split()))\n ans = INF * INF\n for i in range(INF):\n tmp = 2 * i * c + a * max(x - i, 0) + b * max(y - i, 0)\n ans = min(tmp, ans)\n print(ans)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-# python3", "-INF = int(1e9)", "+INF = int(1e5) + 5", "- ans = INF", "- for i in range(2 * 10**5 + 100):", "- t = 2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b", "- ans = min(ans, t)", "+ ans = INF * INF", "+ for i in range(INF):", "+ tmp = 2 * i * c + a * max(x - i, 0) + b * max(y - i, 0)", "+ ans = min(tmp, ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3276309614, "measured_runtime_v1": 0.7168484554, "runtime_lift": 1.8520385325, "key": ["s986639109", "s095330807"]} +{"user_id": "u925364229", "problem_id": "p03835", "language": "python", "submission_id_v0": "s889927917", "submission_id_v1": "s987244986", "cpu_time_v0": 1777, "cpu_time_v1": 266, "memory_v0": 2940, "memory_v1": 42092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.03, "input": "K,S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor i in range(K+1):\n\n\tfor j in range(K+1):\n\n\t\tif (S - i - j) <= K and (S-i-j) >= 0:\n\n\t\t\tans += 1\n\n\n\nprint(ans)\n", "target": "K, S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n if 0 <= (S - X - Y) <= K:\n\n ans += 1\n\n\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 156, "code_v1_num_chars": 162, "code_v0_no_empty_lines": "K, S = list(map(int, input().split(\" \")))\nans = 0\nfor i in range(K + 1):\n for j in range(K + 1):\n if (S - i - j) <= K and (S - i - j) >= 0:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "K, S = list(map(int, input().split(\" \")))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n if 0 <= (S - X - Y) <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-for i in range(K + 1):", "- for j in range(K + 1):", "- if (S - i - j) <= K and (S - i - j) >= 0:", "+for X in range(K + 1):", "+ for Y in range(K + 1):", "+ if 0 <= (S - X - Y) <= K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.441297763, "measured_runtime_v1": 0.3279348275, "runtime_lift": 1.3456873926, "key": ["s889927917", "s987244986"]} +{"user_id": "u140201022", "problem_id": "p02412", "language": "python", "submission_id_v0": "s179146540", "submission_id_v1": "s419434066", "cpu_time_v0": 420, "cpu_time_v1": 30, "memory_v0": 4208, "memory_v1": 4204, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.86, "input": "while 1:\n\n ans=0\n\n n,x=list(map(int,input().split()))\n\n if n:\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n for k in range(j+1,n+1):\n\n if i+j+k==x:ans+=1\n\n else:break\n\n print(ans)", "target": "while 1:\n\n a=0\n\n n,x=list(map(int,input().split()))\n\n if n==0:break\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n c=x-i-j\n\n if c>j and c<=n:a+=1\n\n print(a)", "code_v0_loc": 10, "code_v1_loc": 9, "code_v0_num_chars": 249, "code_v1_num_chars": 202, "code_v0_no_empty_lines": "while 1:\n ans = 0\n n, x = list(map(int, input().split()))\n if n:\n for i in range(1, n - 1):\n for j in range(i + 1, n):\n for k in range(j + 1, n + 1):\n if i + j + k == x:\n ans += 1\n else:\n break\n print(ans)\n", "code_v1_no_empty_lines": "while 1:\n a = 0\n n, x = list(map(int, input().split()))\n if n == 0:\n break\n for i in range(1, n - 1):\n for j in range(i + 1, n):\n c = x - i - j\n if c > j and c <= n:\n a += 1\n print(a)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["- ans = 0", "+ a = 0", "- if n:", "- for i in range(1, n - 1):", "- for j in range(i + 1, n):", "- for k in range(j + 1, n + 1):", "- if i + j + k == x:", "- ans += 1", "- else:", "+ if n == 0:", "- print(ans)", "+ for i in range(1, n - 1):", "+ for j in range(i + 1, n):", "+ c = x - i - j", "+ if c > j and c <= n:", "+ a += 1", "+ print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3642889087, "measured_runtime_v1": 0.2896689522, "runtime_lift": 1.2576042614, "key": ["s179146540", "s419434066"]} +{"user_id": "u072717685", "problem_id": "p02767", "language": "python", "submission_id_v0": "s067063811", "submission_id_v1": "s910505357", "cpu_time_v0": 35, "cpu_time_v1": 31, "memory_v0": 5084, "memory_v1": 9036, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.43, "input": "def main():\n\n from statistics import mean\n\n from math import floor,ceil\n\n\n\n n = int(input())\n\n x = list(map(int, input().split()))\n\n x_mean = mean(x) \n\n if x_mean == 0.5:\n\n greater_than_x = len([i for i in x if i > x_mean])\n\n if greater_than_x * 2 >= n:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n elif x_mean % 1 > 0.5:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n x2 = [(num - x_mean)**2 for num in x]\n\n print((sum(x2)))\n\n\n\nmain()", "target": "import sys\n\nread = sys.stdin.read\n\ndef main():\n\n n, *x = list(map(int, read().split()))\n\n r = float('inf')\n\n for i1 in range(1, 101):\n\n rt = 0\n\n for xe in x:\n\n rt += (xe - i1)**2\n\n r = min(r, rt)\n\n print(r)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 21, "code_v1_loc": 14, "code_v0_num_chars": 512, "code_v1_num_chars": 287, "code_v0_no_empty_lines": "def main():\n from statistics import mean\n from math import floor, ceil\n\n n = int(input())\n x = list(map(int, input().split()))\n x_mean = mean(x)\n if x_mean == 0.5:\n greater_than_x = len([i for i in x if i > x_mean])\n if greater_than_x * 2 >= n:\n x_mean = ceil(x_mean)\n else:\n x_mean = floor(x_mean)\n elif x_mean % 1 > 0.5:\n x_mean = ceil(x_mean)\n else:\n x_mean = floor(x_mean)\n x2 = [(num - x_mean) ** 2 for num in x]\n print((sum(x2)))\n\n\nmain()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.read\n\n\ndef main():\n n, *x = list(map(int, read().split()))\n r = float(\"inf\")\n for i1 in range(1, 101):\n rt = 0\n for xe in x:\n rt += (xe - i1) ** 2\n r = min(r, rt)\n print(r)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-def main():", "- from statistics import mean", "- from math import floor, ceil", "+import sys", "- n = int(input())", "- x = list(map(int, input().split()))", "- x_mean = mean(x)", "- if x_mean == 0.5:", "- greater_than_x = len([i for i in x if i > x_mean])", "- if greater_than_x * 2 >= n:", "- x_mean = ceil(x_mean)", "- else:", "- x_mean = floor(x_mean)", "- elif x_mean % 1 > 0.5:", "- x_mean = ceil(x_mean)", "- else:", "- x_mean = floor(x_mean)", "- x2 = [(num - x_mean) ** 2 for num in x]", "- print((sum(x2)))", "+read = sys.stdin.read", "-main()", "+def main():", "+ n, *x = list(map(int, read().split()))", "+ r = float(\"inf\")", "+ for i1 in range(1, 101):", "+ rt = 0", "+ for xe in x:", "+ rt += (xe - i1) ** 2", "+ r = min(r, rt)", "+ print(r)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3305953437, "measured_runtime_v1": 0.2443374534, "runtime_lift": 1.3530277041, "key": ["s067063811", "s910505357"]} +{"user_id": "u112317104", "problem_id": "p02773", "language": "python", "submission_id_v0": "s565064219", "submission_id_v1": "s656135042", "cpu_time_v0": 1126, "cpu_time_v1": 742, "memory_v0": 46132, "memory_v1": 32480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 34.1, "input": "from collections import defaultdict\n\n\n\nN = int(input())\n\nA = [input() for _ in range(N)]\n\nA.sort()\n\nd = defaultdict(int)\n\nfor a in A:\n\n d[a] += 1\n\n\n\nl = sorted(d.items())\n\nmax_v = 0\n\n\n\nfor _, v in l:\n\n if v > max_v:\n\n max_v = v\n\n \n\nfor k, v in l:\n\n if v == max_v:\n\n print(k)\n\n else:\n\n continue\n", "target": "from collections import defaultdict\n\n\n\ndef solve():\n\n N = int(input())\n\n d = defaultdict(int)\n\n for _ in range(N):\n\n a = input()\n\n d[a] += 1\n\n\n\n m = 0\n\n for k, v in list(d.items()):\n\n m = max(m, v)\n\n \n\n l = []\n\n for k, v in list(d.items()):\n\n if m == v:\n\n l.append(k)\n\n l.sort()\n\n for ans in l:\n\n print(ans)\n\n \n\nsolve()", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 330, "code_v1_num_chars": 386, "code_v0_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nA = [input() for _ in range(N)]\nA.sort()\nd = defaultdict(int)\nfor a in A:\n d[a] += 1\nl = sorted(d.items())\nmax_v = 0\nfor _, v in l:\n if v > max_v:\n max_v = v\nfor k, v in l:\n if v == max_v:\n print(k)\n else:\n continue\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\n\ndef solve():\n N = int(input())\n d = defaultdict(int)\n for _ in range(N):\n a = input()\n d[a] += 1\n m = 0\n for k, v in list(d.items()):\n m = max(m, v)\n l = []\n for k, v in list(d.items()):\n if m == v:\n l.append(k)\n l.sort()\n for ans in l:\n print(ans)\n\n\nsolve()\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-N = int(input())", "-A = [input() for _ in range(N)]", "-A.sort()", "-d = defaultdict(int)", "-for a in A:", "- d[a] += 1", "-l = sorted(d.items())", "-max_v = 0", "-for _, v in l:", "- if v > max_v:", "- max_v = v", "-for k, v in l:", "- if v == max_v:", "- print(k)", "- else:", "- continue", "+", "+def solve():", "+ N = int(input())", "+ d = defaultdict(int)", "+ for _ in range(N):", "+ a = input()", "+ d[a] += 1", "+ m = 0", "+ for k, v in list(d.items()):", "+ m = max(m, v)", "+ l = []", "+ for k, v in list(d.items()):", "+ if m == v:", "+ l.append(k)", "+ l.sort()", "+ for ans in l:", "+ print(ans)", "+", "+", "+solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2730668259, "measured_runtime_v1": 0.1417047331, "runtime_lift": 1.9270127385, "key": ["s565064219", "s656135042"]} +{"user_id": "u038408819", "problem_id": "p02691", "language": "python", "submission_id_v0": "s116716284", "submission_id_v1": "s825945845", "cpu_time_v0": 328, "cpu_time_v1": 178, "memory_v0": 73948, "memory_v1": 132600, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.73, "input": "n = int(input())\n\na = list(map(int, input().split()))\n\na_index = []\n\nfor i in range(n):\n\n a_index.append((i, a[i]))\n\ndic1 = {}\n\ndic2 = {}\n\nfor i in range(n):\n\n one = a_index[i][0] + a_index[i][1]\n\n two = a_index[i][0] - a_index[i][1]\n\n if one not in dic1:\n\n dic1[one] = 1\n\n else:\n\n dic1[one] += 1\n\n if two not in dic2:\n\n dic2[two] = 1\n\n else:\n\n dic2[two] += 1\n\nans = 0\n\nfor i in list(dic1.keys()):\n\n if i in dic2:\n\n ans += dic2[i] * dic1[i]\n\nfor i in list(dic2.keys()):\n\n if i in dic1:\n\n ans += dic1[i] * dic2[i]\n\n #print(i)\n\nprint((ans // 2))\n", "target": "n = int(input())\n\na = list(map(int, input().split()))\n\nimport collections\n\nans = 0\n\ndic = collections.defaultdict(int)\n\nfor i in range(1, n + 1):\n\n ans += dic[i - a[i - 1]]\n\n dic[i + a[i - 1]] += 1\n\nprint(ans)", "code_v0_loc": 27, "code_v1_loc": 9, "code_v0_num_chars": 606, "code_v1_num_chars": 215, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\na_index = []\nfor i in range(n):\n a_index.append((i, a[i]))\ndic1 = {}\ndic2 = {}\nfor i in range(n):\n one = a_index[i][0] + a_index[i][1]\n two = a_index[i][0] - a_index[i][1]\n if one not in dic1:\n dic1[one] = 1\n else:\n dic1[one] += 1\n if two not in dic2:\n dic2[two] = 1\n else:\n dic2[two] += 1\nans = 0\nfor i in list(dic1.keys()):\n if i in dic2:\n ans += dic2[i] * dic1[i]\nfor i in list(dic2.keys()):\n if i in dic1:\n ans += dic1[i] * dic2[i]\n # print(i)\nprint((ans // 2))\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nimport collections\n\nans = 0\ndic = collections.defaultdict(int)\nfor i in range(1, n + 1):\n ans += dic[i - a[i - 1]]\n dic[i + a[i - 1]] += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-a_index = []", "-for i in range(n):", "- a_index.append((i, a[i]))", "-dic1 = {}", "-dic2 = {}", "-for i in range(n):", "- one = a_index[i][0] + a_index[i][1]", "- two = a_index[i][0] - a_index[i][1]", "- if one not in dic1:", "- dic1[one] = 1", "- else:", "- dic1[one] += 1", "- if two not in dic2:", "- dic2[two] = 1", "- else:", "- dic2[two] += 1", "+import collections", "+", "-for i in list(dic1.keys()):", "- if i in dic2:", "- ans += dic2[i] * dic1[i]", "-for i in list(dic2.keys()):", "- if i in dic1:", "- ans += dic1[i] * dic2[i]", "- # print(i)", "-print((ans // 2))", "+dic = collections.defaultdict(int)", "+for i in range(1, n + 1):", "+ ans += dic[i - a[i - 1]]", "+ dic[i + a[i - 1]] += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3792731187, "measured_runtime_v1": 0.2976846831, "runtime_lift": 1.2740767002, "key": ["s116716284", "s825945845"]} +{"user_id": "u123756661", "problem_id": "p03835", "language": "python", "submission_id_v0": "s113088304", "submission_id_v1": "s025062934", "cpu_time_v0": 1218, "cpu_time_v1": 258, "memory_v0": 2940, "memory_v1": 41580, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.82, "input": "k,s=list(map(int,input().split()))\n\nans=chk=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if (0<=s-i-j<=k): ans+=1\n\nprint(ans)", "target": "k,s=list(map(int,input().split()))\n\nans=0\n\nx=min(k+1,s+1)\n\ny=max(0,s-k-k)\n\nfor i in range(y,x):\n\n for j in range(y,x):\n\n if i+j>s: break\n\n if 0<=s-i-j<=k:\n\n ans+=1\n\nprint(ans)", "code_v0_loc": 6, "code_v1_loc": 10, "code_v0_num_chars": 133, "code_v1_num_chars": 197, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\nans = chk = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nx = min(k + 1, s + 1)\ny = max(0, s - k - k)\nfor i in range(y, x):\n for j in range(y, x):\n if i + j > s:\n break\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-ans = chk = 0", "-for i in range(k + 1):", "- for j in range(k + 1):", "+ans = 0", "+x = min(k + 1, s + 1)", "+y = max(0, s - k - k)", "+for i in range(y, x):", "+ for j in range(y, x):", "+ if i + j > s:", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3946401063, "measured_runtime_v1": 0.3009130723, "runtime_lift": 1.3114754477, "key": ["s113088304", "s025062934"]} +{"user_id": "u761320129", "problem_id": "p03564", "language": "python", "submission_id_v0": "s515134391", "submission_id_v1": "s980600609", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N,K = int(input()), int(input())\n\nnow = 1\n\nfor i in range(N):\n\n if now*2 < now + K:\n\n now *= 2\n\n else:\n\n now += K\n\nprint(now)\n", "target": "N = int(input())\n\nK = int(input())\n\nans = 1\n\nfor i in range(N):\n\n if ans < K:\n\n ans *= 2\n\n else:\n\n ans += K\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 146, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "N, K = int(input()), int(input())\nnow = 1\nfor i in range(N):\n if now * 2 < now + K:\n now *= 2\n else:\n now += K\nprint(now)\n", "code_v1_no_empty_lines": "N = int(input())\nK = int(input())\nans = 1\nfor i in range(N):\n if ans < K:\n ans *= 2\n else:\n ans += K\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-N, K = int(input()), int(input())", "-now = 1", "+N = int(input())", "+K = int(input())", "+ans = 1", "- if now * 2 < now + K:", "- now *= 2", "+ if ans < K:", "+ ans *= 2", "- now += K", "-print(now)", "+ ans += K", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2990638907, "measured_runtime_v1": 0.1086408798, "runtime_lift": 2.7527749338, "key": ["s515134391", "s980600609"]} +{"user_id": "u177388368", "problem_id": "p02881", "language": "python", "submission_id_v0": "s386884404", "submission_id_v1": "s516418112", "cpu_time_v0": 474, "cpu_time_v1": 256, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.99, "input": "import math\n\nn=int(input())\n\nans=n\n\ni=1\n\nwhile(i<=math.sqrt(n)):\n\n if n%i==0:\n\n d=i+n/i-2\n\n ans=min(ans,d)\n\n i+=1\n\nprint((int(ans)))", "target": "from math import floor\n\nfrom math import sqrt\n\nn=int(input())\n\nnn=floor(sqrt(n))\n\nrest=n%nn\n\nwhile rest!=0:\n\n nn-=1\n\n rest=n%nn\n\nnnn=n/nn\n\nprint((int(nn+nnn-2)))", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 150, "code_v1_num_chars": 165, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nans = n\ni = 1\nwhile i <= math.sqrt(n):\n if n % i == 0:\n d = i + n / i - 2\n ans = min(ans, d)\n i += 1\nprint((int(ans)))\n", "code_v1_no_empty_lines": "from math import floor\nfrom math import sqrt\n\nn = int(input())\nnn = floor(sqrt(n))\nrest = n % nn\nwhile rest != 0:\n nn -= 1\n rest = n % nn\nnnn = n / nn\nprint((int(nn + nnn - 2)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-import math", "+from math import floor", "+from math import sqrt", "-ans = n", "-i = 1", "-while i <= math.sqrt(n):", "- if n % i == 0:", "- d = i + n / i - 2", "- ans = min(ans, d)", "- i += 1", "-print((int(ans)))", "+nn = floor(sqrt(n))", "+rest = n % nn", "+while rest != 0:", "+ nn -= 1", "+ rest = n % nn", "+nnn = n / nn", "+print((int(nn + nnn - 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3770523396, "measured_runtime_v1": 0.2395324836, "runtime_lift": 1.5741177727, "key": ["s386884404", "s516418112"]} +{"user_id": "u275934251", "problem_id": "p03796", "language": "python", "submission_id_v0": "s111144925", "submission_id_v1": "s028336395", "cpu_time_v0": 229, "cpu_time_v1": 37, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.84, "input": "import math\n\n\n\nN = int(input())\n\n\n\npower = math.factorial(N)\n\n\n\nprint((power % 1000000007))\n\n\n", "target": "n=int(input())\n\nans=1\n\nfor i in range(n):\n\n ans=(ans*(i+1))%(10**9+7)\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 5, "code_v0_num_chars": 92, "code_v1_num_chars": 84, "code_v0_no_empty_lines": "import math\n\nN = int(input())\npower = math.factorial(N)\nprint((power % 1000000007))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nfor i in range(n):\n ans = (ans * (i + 1)) % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 37.5, "diff": ["-import math", "-", "-N = int(input())", "-power = math.factorial(N)", "-print((power % 1000000007))", "+n = int(input())", "+ans = 1", "+for i in range(n):", "+ ans = (ans * (i + 1)) % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7185150633, "measured_runtime_v1": 0.3322105608, "runtime_lift": 2.1628302891, "key": ["s111144925", "s028336395"]} +{"user_id": "u353797797", "problem_id": "p03170", "language": "python", "submission_id_v0": "s365373544", "submission_id_v1": "s835744397", "cpu_time_v0": 126, "cpu_time_v1": 112, "memory_v0": 3828, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.11, "input": "n, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii <= k:\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n", "target": "n, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii > k:break\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 271, "code_v1_num_chars": 271, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\na_s = list(map(int, input().split()))\ndp = [\"Second\"] * (k + 1)\nfor i in range(k + 1):\n if dp[i] == \"Second\":\n for a in a_s:\n ii = i + a\n if ii <= k:\n dp[ii] = \"First\"\nprint((dp[-1]))\n", "code_v1_no_empty_lines": "n, k = list(map(int, input().split()))\na_s = list(map(int, input().split()))\ndp = [\"Second\"] * (k + 1)\nfor i in range(k + 1):\n if dp[i] == \"Second\":\n for a in a_s:\n ii = i + a\n if ii > k:\n break\n dp[ii] = \"First\"\nprint((dp[-1]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if ii <= k:", "- dp[ii] = \"First\"", "+ if ii > k:", "+ break", "+ dp[ii] = \"First\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.3611531999, "measured_runtime_v1": 0.2298232606, "runtime_lift": 1.5714388476, "key": ["s365373544", "s835744397"]} +{"user_id": "u604839890", "problem_id": "p02622", "language": "python", "submission_id_v0": "s830524393", "submission_id_v1": "s723518358", "cpu_time_v0": 83, "cpu_time_v1": 70, "memory_v0": 85616, "memory_v1": 73748, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.66, "input": "S, T = [list(input()) for _ in range(2)]\n\ncnt = 0\n\nfor i in range(len(S)):\n\n if S[i] != T[i]:\n\n cnt += 1\n\nprint(cnt)\n", "target": "s, t = [input() for i in range(2)]\n\nans = 0\n\nfor i in range(len(s)):\n\n if s[i] != t[i]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 127, "code_v1_num_chars": 114, "code_v0_no_empty_lines": "S, T = [list(input()) for _ in range(2)]\ncnt = 0\nfor i in range(len(S)):\n if S[i] != T[i]:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "s, t = [input() for i in range(2)]\nans = 0\nfor i in range(len(s)):\n if s[i] != t[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-S, T = [list(input()) for _ in range(2)]", "-cnt = 0", "-for i in range(len(S)):", "- if S[i] != T[i]:", "- cnt += 1", "-print(cnt)", "+s, t = [input() for i in range(2)]", "+ans = 0", "+for i in range(len(s)):", "+ if s[i] != t[i]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2683959379, "measured_runtime_v1": 0.2054475396, "runtime_lift": 1.3063964576, "key": ["s830524393", "s723518358"]} +{"user_id": "u644907318", "problem_id": "p02886", "language": "python", "submission_id_v0": "s745140004", "submission_id_v1": "s021490246", "cpu_time_v0": 167, "cpu_time_v1": 89, "memory_v0": 38512, "memory_v1": 61656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.71, "input": "N = int(input())\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N-1):\n\n for j in range(i+1,N):\n\n cnt += D[i]*D[j]\n\nprint(cnt)", "target": "N = int(input())\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += D[i]**2\n\ntot = 0\n\nfor i in range(N):\n\n tot += D[i]\n\ntot = tot**2\n\ntot -= cnt\n\nprint((tot//2))", "code_v0_loc": 7, "code_v1_loc": 11, "code_v0_num_chars": 149, "code_v1_num_chars": 188, "code_v0_no_empty_lines": "N = int(input())\nD = list(map(int, input().split()))\ncnt = 0\nfor i in range(N - 1):\n for j in range(i + 1, N):\n cnt += D[i] * D[j]\nprint(cnt)\n", "code_v1_no_empty_lines": "N = int(input())\nD = list(map(int, input().split()))\ncnt = 0\nfor i in range(N):\n cnt += D[i] ** 2\ntot = 0\nfor i in range(N):\n tot += D[i]\ntot = tot**2\ntot -= cnt\nprint((tot // 2))\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-for i in range(N - 1):", "- for j in range(i + 1, N):", "- cnt += D[i] * D[j]", "-print(cnt)", "+for i in range(N):", "+ cnt += D[i] ** 2", "+tot = 0", "+for i in range(N):", "+ tot += D[i]", "+tot = tot**2", "+tot -= cnt", "+print((tot // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2884610276, "measured_runtime_v1": 0.2260356005, "runtime_lift": 1.2761751997, "key": ["s745140004", "s021490246"]} +{"user_id": "u258073778", "problem_id": "p03370", "language": "python", "submission_id_v0": "s864579791", "submission_id_v1": "s018766024", "cpu_time_v0": 712, "cpu_time_v1": 525, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.26, "input": "N, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(input())\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x // min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n if x >= min(mn):\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)", "target": "N, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(input())\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x // min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)", "code_v0_loc": 18, "code_v1_loc": 17, "code_v0_num_chars": 293, "code_v1_num_chars": 267, "code_v0_no_empty_lines": "N, X = list(map(int, input().split()))\nmn = [0] * N\nfor i in range(N):\n mn[i] = int(input())\nans = N\nx = X - sum(mn)\nwhile x >= min(mn):\n if x // min(mn) == 0:\n mn[mn.index(min(mn))] = 1000000\n else:\n if x >= min(mn):\n x -= min(mn)\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N, X = list(map(int, input().split()))\nmn = [0] * N\nfor i in range(N):\n mn[i] = int(input())\nans = N\nx = X - sum(mn)\nwhile x >= min(mn):\n if x // min(mn) == 0:\n mn[mn.index(min(mn))] = 1000000\n else:\n x -= min(mn)\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 5.5555555556, "diff": ["- if x >= min(mn):", "- x -= min(mn)", "- ans += 1", "+ x -= min(mn)", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2841449485, "measured_runtime_v1": 0.2087575016, "runtime_lift": 1.3611244927, "key": ["s864579791", "s018766024"]} +{"user_id": "u961683878", "problem_id": "p02596", "language": "python", "submission_id_v0": "s650878996", "submission_id_v1": "s172963527", "cpu_time_v0": 1976, "cpu_time_v1": 198, "memory_v0": 165028, "memory_v1": 9244, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 89.98, "input": "#! /usr/bin/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\n\n\ndef isMultiple(s, m):\n\n tmp = 0\n\n for i in range(len(s)):\n\n tmp = (tmp * 10 + int(s[i])) % m\n\n if tmp == 0:\n\n return i\n\n return -1\n\n\n\n\n\nk = int(readline())\n\nacc = \"7\" * 50000000\n\nif k % 2 == 0:\n\n ans = -1\n\nelse:\n\n\n\n ans = isMultiple(acc, k)\n\n if ans != -1:\n\n ans += 1\n\n\n\nprint(ans)\n", "target": "#! /usr/bin/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\nk = int(readline())\n\n\n\nans = -1\n\nacc = 7 % k\n\nfor n in range(1, k + 10):\n\n if acc == 0:\n\n ans = n\n\n break\n\n acc = (10 * acc + 7) % k\n\n\n\nprint(ans)\n", "code_v0_loc": 30, "code_v1_loc": 20, "code_v0_num_chars": 543, "code_v1_num_chars": 376, "code_v0_no_empty_lines": "#! /usr/bin/env python3\nimport sys\n\nint1 = lambda x: int(x) - 1\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(500000)\n\n\ndef isMultiple(s, m):\n tmp = 0\n for i in range(len(s)):\n tmp = (tmp * 10 + int(s[i])) % m\n if tmp == 0:\n return i\n return -1\n\n\nk = int(readline())\nacc = \"7\" * 50000000\nif k % 2 == 0:\n ans = -1\nelse:\n ans = isMultiple(acc, k)\n if ans != -1:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "#! /usr/bin/env python3\nimport sys\n\nint1 = lambda x: int(x) - 1\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(500000)\nk = int(readline())\nans = -1\nacc = 7 % k\nfor n in range(1, k + 10):\n if acc == 0:\n ans = n\n break\n acc = (10 * acc + 7) % k\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-", "-", "-def isMultiple(s, m):", "- tmp = 0", "- for i in range(len(s)):", "- tmp = (tmp * 10 + int(s[i])) % m", "- if tmp == 0:", "- return i", "- return -1", "-", "-", "-acc = \"7\" * 50000000", "-if k % 2 == 0:", "- ans = -1", "-else:", "- ans = isMultiple(acc, k)", "- if ans != -1:", "- ans += 1", "+ans = -1", "+acc = 7 % k", "+for n in range(1, k + 10):", "+ if acc == 0:", "+ ans = n", "+ break", "+ acc = (10 * acc + 7) % k"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8533027549, "measured_runtime_v1": 0.4769769247, "runtime_lift": 1.788981208, "key": ["s650878996", "s172963527"]} +{"user_id": "u133936772", "problem_id": "p02615", "language": "python", "submission_id_v0": "s324254523", "submission_id_v1": "s548223725", "cpu_time_v0": 146, "cpu_time_v1": 118, "memory_v0": 31756, "memory_v1": 31752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.18, "input": "n,*l=list(map(int,open(0).read().split()));print((sum(sorted(l*2)[-2:~n:-1])))", "target": "n,*l=list(map(int,open(0).read().split()))\n\nl.sort(reverse=1)\n\nprint((sum(l[i//2] for i in range(1,n))))", "code_v0_loc": 1, "code_v1_loc": 3, "code_v0_num_chars": 70, "code_v1_num_chars": 96, "code_v0_no_empty_lines": "n, *l = list(map(int, open(0).read().split()))\nprint((sum(sorted(l * 2)[-2:~n:-1])))\n", "code_v1_no_empty_lines": "n, *l = list(map(int, open(0).read().split()))\nl.sort(reverse=1)\nprint((sum(l[i // 2] for i in range(1, n))))\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-print((sum(sorted(l * 2)[-2:~n:-1])))", "+l.sort(reverse=1)", "+print((sum(l[i // 2] for i in range(1, n))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2901719676, "measured_runtime_v1": 0.1990829677, "runtime_lift": 1.4575429076, "key": ["s324254523", "s548223725"]} +{"user_id": "u727072969", "problem_id": "p02881", "language": "python", "submission_id_v0": "s064089444", "submission_id_v1": "s044740610", "cpu_time_v0": 519, "cpu_time_v1": 181, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.13, "input": "import math\n\nN = int(input())\n\nfor i in range(int(math.sqrt(N))):\n\n if N % (int(math.sqrt(N))-i) == 0:\n\n print((int(N/(int(math.sqrt(N))-i)+int(math.sqrt(N))-i-2)))\n\n break", "target": "import math\n\nN = int(input())\n\nM = int(math.sqrt(N))\n\nfor i in range(M):\n\n if N % (M-i) == 0:\n\n print((int(N/(M-i)+M-i-2)))\n\n break\n", "code_v0_loc": 6, "code_v1_loc": 7, "code_v0_num_chars": 187, "code_v1_num_chars": 147, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nfor i in range(int(math.sqrt(N))):\n if N % (int(math.sqrt(N)) - i) == 0:\n print((int(N / (int(math.sqrt(N)) - i) + int(math.sqrt(N)) - i - 2)))\n break\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\nM = int(math.sqrt(N))\nfor i in range(M):\n if N % (M - i) == 0:\n print((int(N / (M - i) + M - i - 2)))\n break\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-for i in range(int(math.sqrt(N))):", "- if N % (int(math.sqrt(N)) - i) == 0:", "- print((int(N / (int(math.sqrt(N)) - i) + int(math.sqrt(N)) - i - 2)))", "+M = int(math.sqrt(N))", "+for i in range(M):", "+ if N % (M - i) == 0:", "+ print((int(N / (M - i) + M - i - 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3627885733, "measured_runtime_v1": 0.269237565, "runtime_lift": 1.3474664028, "key": ["s064089444", "s044740610"]} +{"user_id": "u753589982", "problem_id": "p02994", "language": "python", "submission_id_v0": "s918408995", "submission_id_v1": "s703264591", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "N, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple():\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)//2 - eat_apple()))", "target": "N, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple(N, L, max_):\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)//2 - eat_apple(N, L, max_)))", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 227, "code_v1_num_chars": 247, "code_v0_no_empty_lines": "N, L = [int(i) for i in input().split()]\nmin_ = L\nmax_ = L + N - 1\n\n\ndef eat_apple():\n if max_ < 0:\n return max_\n if L < 0:\n return 0\n return L\n\n\nprint(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple()))\n", "code_v1_no_empty_lines": "N, L = [int(i) for i in input().split()]\nmin_ = L\nmax_ = L + N - 1\n\n\ndef eat_apple(N, L, max_):\n if max_ < 0:\n return max_\n if L < 0:\n return 0\n return L\n\n\nprint(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple(N, L, max_)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-def eat_apple():", "+def eat_apple(N, L, max_):", "-print(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple()))", "+print(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple(N, L, max_)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2025646191, "measured_runtime_v1": 0.0060813091, "runtime_lift": 33.309377317, "key": ["s918408995", "s703264591"]} +{"user_id": "u280978334", "problem_id": "p03107", "language": "python", "submission_id_v0": "s353947972", "submission_id_v1": "s266533401", "cpu_time_v0": 65, "cpu_time_v1": 18, "memory_v0": 5400, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.31, "input": "S = [int(_) for _ in input()]\n\nlength = len(S)\n\ntemp = [S[0]]\n\nfor x in S[1:]:\n\n if(len(temp) == 0):\n\n temp.append(x)\n\n elif( temp[-1] == x):\n\n temp.append(x)\n\n else:\n\n temp.pop(-1)\n\nprint((length-len(temp)))\n\n ", "target": "def main():\n\n A = input()\n\n print((2*min(A.count(\"0\"),A.count(\"1\"))))\n\n \n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 12, "code_v1_loc": 6, "code_v0_num_chars": 246, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "S = [int(_) for _ in input()]\nlength = len(S)\ntemp = [S[0]]\nfor x in S[1:]:\n if len(temp) == 0:\n temp.append(x)\n elif temp[-1] == x:\n temp.append(x)\n else:\n temp.pop(-1)\nprint((length - len(temp)))\n", "code_v1_no_empty_lines": "def main():\n A = input()\n print((2 * min(A.count(\"0\"), A.count(\"1\"))))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-S = [int(_) for _ in input()]", "-length = len(S)", "-temp = [S[0]]", "-for x in S[1:]:", "- if len(temp) == 0:", "- temp.append(x)", "- elif temp[-1] == x:", "- temp.append(x)", "- else:", "- temp.pop(-1)", "-print((length - len(temp)))", "+def main():", "+ A = input()", "+ print((2 * min(A.count(\"0\"), A.count(\"1\"))))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2279973624, "measured_runtime_v1": 0.00614361, "runtime_lift": 37.1113013328, "key": ["s353947972", "s266533401"]} +{"user_id": "u423966555", "problem_id": "p02596", "language": "python", "submission_id_v0": "s734835984", "submission_id_v1": "s256781932", "cpu_time_v0": 338, "cpu_time_v1": 178, "memory_v0": 16560, "memory_v1": 9056, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.34, "input": "K = int(input())\n\n\n\nflg = [False]*K\n\n\n\ntmp = 7 % K\n\ncnt = 1\n\nif tmp == 0:\n\n print(cnt)\n\n exit()\n\nwhile True:\n\n tmp = (tmp*10+7)%K\n\n if flg[tmp]:\n\n print((-1))\n\n break\n\n else:\n\n cnt += 1\n\n if tmp == 0:\n\n print(cnt)\n\n break\n\n flg[tmp] = True\n", "target": "K = int(input())\n\nt = 7\n\nt %= K\n\n\n\nfor i in range(K+1):\n\n if t == 0:\n\n print((i+1))\n\n exit()\n\n t = (t*10+7)%K\n\nprint((-1))\n", "code_v0_loc": 20, "code_v1_loc": 10, "code_v0_num_chars": 310, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "K = int(input())\nflg = [False] * K\ntmp = 7 % K\ncnt = 1\nif tmp == 0:\n print(cnt)\n exit()\nwhile True:\n tmp = (tmp * 10 + 7) % K\n if flg[tmp]:\n print((-1))\n break\n else:\n cnt += 1\n if tmp == 0:\n print(cnt)\n break\n flg[tmp] = True\n", "code_v1_no_empty_lines": "K = int(input())\nt = 7\nt %= K\nfor i in range(K + 1):\n if t == 0:\n print((i + 1))\n exit()\n t = (t * 10 + 7) % K\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-flg = [False] * K", "-tmp = 7 % K", "-cnt = 1", "-if tmp == 0:", "- print(cnt)", "- exit()", "-while True:", "- tmp = (tmp * 10 + 7) % K", "- if flg[tmp]:", "- print((-1))", "- break", "- else:", "- cnt += 1", "- if tmp == 0:", "- print(cnt)", "- break", "- flg[tmp] = True", "+t = 7", "+t %= K", "+for i in range(K + 1):", "+ if t == 0:", "+ print((i + 1))", "+ exit()", "+ t = (t * 10 + 7) % K", "+print((-1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6767371264, "measured_runtime_v1": 0.4369205115, "runtime_lift": 1.5488792779, "key": ["s734835984", "s256781932"]} +{"user_id": "u239981649", "problem_id": "p03796", "language": "python", "submission_id_v0": "s383796227", "submission_id_v1": "s138334572", "cpu_time_v0": 232, "cpu_time_v1": 34, "memory_v0": 3972, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.34, "input": "from math import factorial\n\nprint((factorial(int(input())) % (10**9+7)))", "target": "ans = 1\n\nfor k in range(1, int(input())+1):\n\n ans = ans*k % (10**9+7)\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 4, "code_v0_num_chars": 70, "code_v1_num_chars": 84, "code_v0_no_empty_lines": "from math import factorial\n\nprint((factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nfor k in range(1, int(input()) + 1):\n ans = ans * k % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-from math import factorial", "-", "-print((factorial(int(input())) % (10**9 + 7)))", "+ans = 1", "+for k in range(1, int(input()) + 1):", "+ ans = ans * k % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3382144179, "measured_runtime_v1": 0.1644267938, "runtime_lift": 2.0569300785, "key": ["s383796227", "s138334572"]} +{"user_id": "u263737105", "problem_id": "p02595", "language": "python", "submission_id_v0": "s947121829", "submission_id_v1": "s479170385", "cpu_time_v0": 481, "cpu_time_v1": 391, "memory_v0": 9072, "memory_v1": 9124, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.71, "input": "N, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a**2 + b**2) <= D**2:\n\n count += 1\n\nprint(count)\n", "target": "N, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a*a + b*b) <= D*D:\n\n count += 1\n\nprint(count)\n", "code_v0_loc": 7, "code_v1_loc": 7, "code_v0_num_chars": 167, "code_v1_num_chars": 164, "code_v0_no_empty_lines": "N, D = list(map(int, input().split()))\ncount = 0\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if (a**2 + b**2) <= D**2:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "N, D = list(map(int, input().split()))\ncount = 0\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if (a * a + b * b) <= D * D:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if (a**2 + b**2) <= D**2:", "+ if (a * a + b * b) <= D * D:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2832637064, "measured_runtime_v1": 0.1751975398, "runtime_lift": 1.6168246811, "key": ["s947121829", "s479170385"]} +{"user_id": "u077291787", "problem_id": "p03309", "language": "python", "submission_id_v0": "s828043733", "submission_id_v1": "s360156642", "cpu_time_v0": 210, "cpu_time_v1": 183, "memory_v0": 27472, "memory_v1": 25324, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.86, "input": "# ABC102C - Linear Approximation (ARC100C)\n\nfrom statistics import median\n\n\n\n\n\ndef main():\n\n n = int(input())\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = tuple(j - i for i, j in enumerate(A, start=1))\n\n b = median(A)\n\n ans = sum(abs(a - b) for a in A)\n\n print((int(ans)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "# ABC102C - Linear Approximation (ARC100C)\n\ndef main():\n\n n = int(input())\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = sorted(j - i for i, j in enumerate(A, start=1))\n\n b = A[n // 2]\n\n ans = sum(abs(a - b) for a in A)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 15, "code_v1_loc": 12, "code_v0_num_chars": 341, "code_v1_num_chars": 302, "code_v0_no_empty_lines": "# ABC102C - Linear Approximation (ARC100C)\nfrom statistics import median\n\n\ndef main():\n n = int(input())\n A = tuple(map(int, input().rstrip().split()))\n A = tuple(j - i for i, j in enumerate(A, start=1))\n b = median(A)\n ans = sum(abs(a - b) for a in A)\n print((int(ans)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# ABC102C - Linear Approximation (ARC100C)\ndef main():\n n = int(input())\n A = tuple(map(int, input().rstrip().split()))\n A = sorted(j - i for i, j in enumerate(A, start=1))\n b = A[n // 2]\n ans = sum(abs(a - b) for a in A)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-from statistics import median", "-", "-", "- A = tuple(j - i for i, j in enumerate(A, start=1))", "- b = median(A)", "+ A = sorted(j - i for i, j in enumerate(A, start=1))", "+ b = A[n // 2]", "- print((int(ans)))", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2185840318, "measured_runtime_v1": 0.1650515537, "runtime_lift": 1.3243379227, "key": ["s828043733", "s360156642"]} +{"user_id": "u893063840", "problem_id": "p03038", "language": "python", "submission_id_v0": "s696312664", "submission_id_v1": "s914180377", "cpu_time_v0": 588, "cpu_time_v1": 493, "memory_v0": 32888, "memory_v1": 36036, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.16, "input": "n, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(key=lambda x: x[1], reverse=True)\n\na.sort()\n\n\n\ni = 0\n\nfor b, c in bc:\n\n for _ in range(b):\n\n if i < n and a[i] < c:\n\n a[i] = c\n\n i += 1\n\n else:\n\n break\n\n\n\nans = sum(a)\n\nprint(ans)\n", "target": "n, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(reverse=True, key=lambda x: x[1])\n\n\n\nli = []\n\nl = 0\n\ni = 0\n\nwhile i < m and l < n:\n\n b, c = bc[i]\n\n li += [c] * b\n\n i += 1\n\n l += b\n\n\n\na += li\n\na.sort(reverse=True)\n\nans = sum(a[:n])\n\nprint(ans)\n", "code_v0_loc": 18, "code_v1_loc": 19, "code_v0_num_chars": 369, "code_v1_num_chars": 346, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = [list(map(int, input().split())) for _ in range(m)]\nbc.sort(key=lambda x: x[1], reverse=True)\na.sort()\ni = 0\nfor b, c in bc:\n for _ in range(b):\n if i < n and a[i] < c:\n a[i] = c\n i += 1\n else:\n break\nans = sum(a)\nprint(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = [list(map(int, input().split())) for _ in range(m)]\nbc.sort(reverse=True, key=lambda x: x[1])\nli = []\nl = 0\ni = 0\nwhile i < m and l < n:\n b, c = bc[i]\n li += [c] * b\n i += 1\n l += b\na += li\na.sort(reverse=True)\nans = sum(a[:n])\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 5.2631578947, "diff": ["-bc.sort(key=lambda x: x[1], reverse=True)", "-a.sort()", "+bc.sort(reverse=True, key=lambda x: x[1])", "+li = []", "+l = 0", "-for b, c in bc:", "- for _ in range(b):", "- if i < n and a[i] < c:", "- a[i] = c", "- i += 1", "- else:", "- break", "-ans = sum(a)", "+while i < m and l < n:", "+ b, c = bc[i]", "+ li += [c] * b", "+ i += 1", "+ l += b", "+a += li", "+a.sort(reverse=True)", "+ans = sum(a[:n])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2346956289, "measured_runtime_v1": 0.006594183, "runtime_lift": 35.5913127767, "key": ["s696312664", "s914180377"]} +{"user_id": "u189326411", "problem_id": "p03796", "language": "python", "submission_id_v0": "s862494830", "submission_id_v1": "s415254610", "cpu_time_v0": 230, "cpu_time_v1": 37, "memory_v0": 4020, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.91, "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))\n", "target": "n = int(input())\n\nmod = 10**9 + 7\n\n\n\npow = 1\n\nfor i in range(n):\n\n pow = pow*(i+1)%mod\n\n\n\nprint(pow)\n", "code_v0_loc": 3, "code_v1_loc": 8, "code_v0_num_chars": 66, "code_v1_num_chars": 104, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nmod = 10**9 + 7\npow = 1\nfor i in range(n):\n pow = pow * (i + 1) % mod\nprint(pow)\n", "code_same": false, "relative_loc_diff_percent": 62.5, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+mod = 10**9 + 7", "+pow = 1", "+for i in range(n):", "+ pow = pow * (i + 1) % mod", "+print(pow)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5275577738, "measured_runtime_v1": 0.2526761317, "runtime_lift": 2.0878813135, "key": ["s862494830", "s415254610"]} +{"user_id": "u982591663", "problem_id": "p03107", "language": "python", "submission_id_v0": "s749413264", "submission_id_v1": "s028114766", "cpu_time_v0": 22, "cpu_time_v1": 19, "memory_v0": 3956, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.64, "input": "S = list(input())\n\nnum_one = S.count(\"1\")\n\nnum_zero = S.count(\"0\")\n\nans = min(num_one, num_zero) *2\n\nprint(ans)\n", "target": "S = input()\n\n\n\nans = min(S.count(\"0\"), S.count(\"1\")) * 2\n\nprint(ans)\n", "code_v0_loc": 5, "code_v1_loc": 4, "code_v0_num_chars": 112, "code_v1_num_chars": 69, "code_v0_no_empty_lines": "S = list(input())\nnum_one = S.count(\"1\")\nnum_zero = S.count(\"0\")\nans = min(num_one, num_zero) * 2\nprint(ans)\n", "code_v1_no_empty_lines": "S = input()\nans = min(S.count(\"0\"), S.count(\"1\")) * 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-S = list(input())", "-num_one = S.count(\"1\")", "-num_zero = S.count(\"0\")", "-ans = min(num_one, num_zero) * 2", "+S = input()", "+ans = min(S.count(\"0\"), S.count(\"1\")) * 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2118026633, "measured_runtime_v1": 0.0063807995, "runtime_lift": 33.1937497698, "key": ["s749413264", "s028114766"]} +{"user_id": "u624475441", "problem_id": "p03457", "language": "python", "submission_id_v0": "s302891502", "submission_id_v1": "s171916715", "cpu_time_v0": 228, "cpu_time_v1": 146, "memory_v0": 28148, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 35.96, "input": "import sys\n\ncan = True; input()\n\ne = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]\n\nfor a, b in zip(e[1:], e):\n\n t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])\n\n if t < 0 or t % 2 == 1: can = False; break\n\nprint((['No', 'Yes'][can]))", "target": "import sys\n\nans = 'Yes'; input()\n\nfor e in sys.stdin:\n\n t, x, y = list(map(int, e.split()))\n\n t = t - x - y\n\n if t < 0 or t % 2 == 1: ans = 'No'; break\n\nprint(ans)", "code_v0_loc": 7, "code_v1_loc": 7, "code_v0_num_chars": 259, "code_v1_num_chars": 166, "code_v0_no_empty_lines": "import sys\n\ncan = True\ninput()\ne = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]\nfor a, b in zip(e[1:], e):\n t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])\n if t < 0 or t % 2 == 1:\n can = False\n break\nprint(([\"No\", \"Yes\"][can]))\n", "code_v1_no_empty_lines": "import sys\n\nans = \"Yes\"\ninput()\nfor e in sys.stdin:\n t, x, y = list(map(int, e.split()))\n t = t - x - y\n if t < 0 or t % 2 == 1:\n ans = \"No\"\n break\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-can = True", "+ans = \"Yes\"", "-e = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]", "-for a, b in zip(e[1:], e):", "- t = a[0] - b[0] - abs(a[1] - b[1]) - abs(a[2] - b[2])", "+for e in sys.stdin:", "+ t, x, y = list(map(int, e.split()))", "+ t = t - x - y", "- can = False", "+ ans = \"No\"", "-print(([\"No\", \"Yes\"][can]))", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2223628902, "measured_runtime_v1": 0.1447919474, "runtime_lift": 1.5357407251, "key": ["s302891502", "s171916715"]} +{"user_id": "u628794221", "problem_id": "p02688", "language": "python", "submission_id_v0": "s048784054", "submission_id_v1": "s441243732", "cpu_time_v0": 24, "cpu_time_v1": 20, "memory_v0": 9192, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.67, "input": "N, K = list(map(int, input().split()))\n\nsunuke = [True]*N\n\nfor i in range(K):\n\n d = int(input())\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n sunuke[a-1] = False\n\n\n\nans = 0\n\nfor i in range(N):\n\n if sunuke[i]:\n\n ans += 1\n\nprint(ans)", "target": "N, K = list(map(int, input().split()))\n\nflag = [True]*N\n\nfor i in range(K):\n\n d = int(input())\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n flag[a-1] = False\n\nans = 0\n\nfor i in range(N):\n\n if flag[i]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 12, "code_v0_num_chars": 260, "code_v1_num_chars": 252, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nsunuke = [True] * N\nfor i in range(K):\n d = int(input())\n A = list(map(int, input().split()))\n for a in A:\n sunuke[a - 1] = False\nans = 0\nfor i in range(N):\n if sunuke[i]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nflag = [True] * N\nfor i in range(K):\n d = int(input())\n A = list(map(int, input().split()))\n for a in A:\n flag[a - 1] = False\nans = 0\nfor i in range(N):\n if flag[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["-sunuke = [True] * N", "+flag = [True] * N", "- sunuke[a - 1] = False", "+ flag[a - 1] = False", "- if sunuke[i]:", "+ if flag[i]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3757941551, "measured_runtime_v1": 0.2950303654, "runtime_lift": 1.2737473806, "key": ["s048784054", "s441243732"]} +{"user_id": "u057964173", "problem_id": "p03796", "language": "python", "submission_id_v0": "s018166938", "submission_id_v1": "s633160279", "cpu_time_v0": 298, "cpu_time_v1": 42, "memory_v0": 42992, "memory_v1": 28396, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.91, "input": "import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n import math\n\n n=int(input())\n\n print((math.factorial(n)%(10**9+7)))\n\nresolve()", "target": "import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n answer=1\n\n n=int(input())\n\n for i in range(1,n+1):\n\n answer*=i\n\n answer%=10**9+7\n\n print(answer)\n\nresolve()", "code_v0_loc": 8, "code_v1_loc": 11, "code_v0_num_chars": 166, "code_v1_num_chars": 214, "code_v0_no_empty_lines": "import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n import math\n\n n = int(input())\n print((math.factorial(n) % (10**9 + 7)))\n\n\nresolve()\n", "code_v1_no_empty_lines": "import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n answer = 1\n n = int(input())\n for i in range(1, n + 1):\n answer *= i\n answer %= 10**9 + 7\n print(answer)\n\n\nresolve()\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["- import math", "-", "+ answer = 1", "- print((math.factorial(n) % (10**9 + 7)))", "+ for i in range(1, n + 1):", "+ answer *= i", "+ answer %= 10**9 + 7", "+ print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5731575236, "measured_runtime_v1": 0.2333363581, "runtime_lift": 2.4563575447, "key": ["s018166938", "s633160279"]} +{"user_id": "u983918956", "problem_id": "p03416", "language": "python", "submission_id_v0": "s018952102", "submission_id_v1": "s778219351", "cpu_time_v0": 118, "cpu_time_v1": 60, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 49.15, "input": "A,B = list(map(int,input().split()))\n\nj = 0\n\nfor i in range(A,B+1):\n\n l = list(str(i))\n\n l_reverse = list(reversed(l))\n\n if l == l_reverse:\n\n j += 1\n\nprint(j)", "target": "A, B = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor n in range(A, B+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 158, "code_v1_num_chars": 135, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\nj = 0\nfor i in range(A, B + 1):\n l = list(str(i))\n l_reverse = list(reversed(l))\n if l == l_reverse:\n j += 1\nprint(j)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor n in range(A, B + 1):\n n = str(n)\n if n == n[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-j = 0", "-for i in range(A, B + 1):", "- l = list(str(i))", "- l_reverse = list(reversed(l))", "- if l == l_reverse:", "- j += 1", "-print(j)", "+ans = 0", "+for n in range(A, B + 1):", "+ n = str(n)", "+ if n == n[::-1]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4538340874, "measured_runtime_v1": 0.3384370139, "runtime_lift": 1.340970605, "key": ["s018952102", "s778219351"]} +{"user_id": "u811841526", "problem_id": "p02390", "language": "python", "submission_id_v0": "s941329471", "submission_id_v1": "s549187322", "cpu_time_v0": 40, "cpu_time_v1": 20, "memory_v0": 7664, "memory_v1": 5592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "s = int(input())\n\nm, s = s // 60, s % 60\n\nh, m = m // 60, m % 60\n\nprint((':'.join(map(str, [h,m,s]))))", "target": "s = int(input())\n\n\n\nsecond = s % 60\n\ns = s // 60\n\nmin = s % 60\n\nhour = s // 60\n\n\n\nprint(f'{hour}:{min}:{second}')\n", "code_v0_loc": 4, "code_v1_loc": 8, "code_v0_num_chars": 100, "code_v1_num_chars": 114, "code_v0_no_empty_lines": "s = int(input())\nm, s = s // 60, s % 60\nh, m = m // 60, m % 60\nprint((\":\".join(map(str, [h, m, s]))))\n", "code_v1_no_empty_lines": "s = int(input())\nsecond = s % 60\ns = s // 60\nmin = s % 60\nhour = s // 60\nprint(f\"{hour}:{min}:{second}\")\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-m, s = s // 60, s % 60", "-h, m = m // 60, m % 60", "-print((\":\".join(map(str, [h, m, s]))))", "+second = s % 60", "+s = s // 60", "+min = s % 60", "+hour = s // 60", "+print(f\"{hour}:{min}:{second}\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1672595444, "measured_runtime_v1": 0.0066597962, "runtime_lift": 25.1148140492, "key": ["s941329471", "s549187322"]} +{"user_id": "u488127128", "problem_id": "p03796", "language": "python", "submission_id_v0": "s848409194", "submission_id_v1": "s870468874", "cpu_time_v0": 231, "cpu_time_v1": 35, "memory_v0": 4020, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.85, "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "target": "import math\n\nN = int(input())\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 65, "code_v1_num_chars": 95, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\na = 1\nfor n in range(2, N + 1):\n a = a * n % (10**9 + 7)\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-print((math.factorial(N) % (10**9 + 7)))", "+a = 1", "+for n in range(2, N + 1):", "+ a = a * n % (10**9 + 7)", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8454835632, "measured_runtime_v1": 0.3383059211, "runtime_lift": 2.4991686828, "key": ["s848409194", "s870468874"]} +{"user_id": "u550574002", "problem_id": "p03126", "language": "python", "submission_id_v0": "s757696098", "submission_id_v1": "s038854174", "cpu_time_v0": 23, "cpu_time_v1": 19, "memory_v0": 3572, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.39, "input": "import functools\n\nprint((len(functools.reduce(lambda x, y: x&y,[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))", "target": "print((len(set.intersection(*[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 128, "code_v1_num_chars": 94, "code_v0_no_empty_lines": "import functools\n\nprint(\n (\n len(\n functools.reduce(\n lambda x, y: x & y,\n [set(input().split()[1:]) for _ in [0] * int(input().split()[0])],\n )\n )\n )\n)\n", "code_v1_no_empty_lines": "print(\n (\n len(\n set.intersection(\n *[set(input().split()[1:]) for _ in [0] * int(input().split()[0])]\n )\n )\n )\n)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import functools", "-", "- functools.reduce(", "- lambda x, y: x & y,", "- [set(input().split()[1:]) for _ in [0] * int(input().split()[0])],", "+ set.intersection(", "+ *[set(input().split()[1:]) for _ in [0] * int(input().split()[0])]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2541026509, "measured_runtime_v1": 0.0938221338, "runtime_lift": 2.7083444025, "key": ["s757696098", "s038854174"]} +{"user_id": "u801359367", "problem_id": "p03325", "language": "python", "submission_id_v0": "s586527827", "submission_id_v1": "s564078636", "cpu_time_v0": 89, "cpu_time_v1": 80, "memory_v0": 4148, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.11, "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\n\n\nSUM = 0\n\nfor i in A:\n\n count = 0\n\n while i%2 == 0:\n\n i//=2\n\n count += 1\n\n SUM+=count\n\nprint(SUM)", "target": "N = int(input())\n\nA = list(map(int,input().split()))\n\nSUM = 0\n\nfor i in A:\n\n while i%2 == 0:\n\n i//=2\n\n SUM += 1\n\nprint(SUM)", "code_v0_loc": 11, "code_v1_loc": 8, "code_v0_num_chars": 175, "code_v1_num_chars": 140, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nSUM = 0\nfor i in A:\n count = 0\n while i % 2 == 0:\n i //= 2\n count += 1\n SUM += count\nprint(SUM)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nSUM = 0\nfor i in A:\n while i % 2 == 0:\n i //= 2\n SUM += 1\nprint(SUM)\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["- count = 0", "- count += 1", "- SUM += count", "+ SUM += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3107097435, "measured_runtime_v1": 0.2124449382, "runtime_lift": 1.4625424646, "key": ["s586527827", "s564078636"]} +{"user_id": "u253681061", "problem_id": "p03796", "language": "python", "submission_id_v0": "s618901729", "submission_id_v1": "s057938516", "cpu_time_v0": 49, "cpu_time_v1": 34, "memory_v0": 6900, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.61, "input": "n = int(input())\n\n\n\nINF = 10**9 + 7\n\n\n\nans = [0] * (10**5 + 1)\n\nans[0] = 1\n\n\n\nfor i in range(1,10**5 + 1):\n\n ans[i] = ans[i-1] * i % INF\n\n\n\nprint((ans[n]))\n", "target": "n = int(input())\n\nmod = 10**9 + 7\n\n\n\nans = 1\n\n\n\nfor i in range(1,n+1):\n\n ans = ans * i % mod\n\n\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 9, "code_v0_num_chars": 157, "code_v1_num_chars": 109, "code_v0_no_empty_lines": "n = int(input())\nINF = 10**9 + 7\nans = [0] * (10**5 + 1)\nans[0] = 1\nfor i in range(1, 10**5 + 1):\n ans[i] = ans[i - 1] * i % INF\nprint((ans[n]))\n", "code_v1_no_empty_lines": "n = int(input())\nmod = 10**9 + 7\nans = 1\nfor i in range(1, n + 1):\n ans = ans * i % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-INF = 10**9 + 7", "-ans = [0] * (10**5 + 1)", "-ans[0] = 1", "-for i in range(1, 10**5 + 1):", "- ans[i] = ans[i - 1] * i % INF", "-print((ans[n]))", "+mod = 10**9 + 7", "+ans = 1", "+for i in range(1, n + 1):", "+ ans = ans * i % mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8708683834, "measured_runtime_v1": 0.4576160941, "runtime_lift": 1.9030545354, "key": ["s618901729", "s057938516"]} +{"user_id": "u813450984", "problem_id": "p03371", "language": "python", "submission_id_v0": "s722861535", "submission_id_v1": "s015018251", "cpu_time_v0": 77, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 77.92, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nm = max(x, y)\n\nfor i in range(1, m+1):\n\n x -= 1\n\n y -= 1\n\n if x < 0:\n\n x = 0\n\n if y < 0:\n\n y = 0\n\n temp = c*(i*2) + x*a + y*b\n\n if temp < ans:\n\n ans = temp\n\n\n\nprint(ans)\n", "target": "a, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nans = min(c * max(x, y) * 2, ans)\n\nif x < y:\n\n ans = min(c * x * 2 + (y - x) * b, ans)\n\nelse:\n\n ans = min(c * y * 2 + (x - y) * a, ans)\n\n\n\nprint(ans)", "code_v0_loc": 15, "code_v1_loc": 9, "code_v0_num_chars": 249, "code_v1_num_chars": 219, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nm = max(x, y)\nfor i in range(1, m + 1):\n x -= 1\n y -= 1\n if x < 0:\n x = 0\n if y < 0:\n y = 0\n temp = c * (i * 2) + x * a + y * b\n if temp < ans:\n ans = temp\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nans = min(c * max(x, y) * 2, ans)\nif x < y:\n ans = min(c * x * 2 + (y - x) * b, ans)\nelse:\n ans = min(c * y * 2 + (x - y) * a, ans)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-m = max(x, y)", "-for i in range(1, m + 1):", "- x -= 1", "- y -= 1", "- if x < 0:", "- x = 0", "- if y < 0:", "- y = 0", "- temp = c * (i * 2) + x * a + y * b", "- if temp < ans:", "- ans = temp", "+ans = min(c * max(x, y) * 2, ans)", "+if x < y:", "+ ans = min(c * x * 2 + (y - x) * b, ans)", "+else:", "+ ans = min(c * y * 2 + (x - y) * a, ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2966257923, "measured_runtime_v1": 0.2002350025, "runtime_lift": 1.4813883113, "key": ["s722861535", "s015018251"]} +{"user_id": "u945199633", "problem_id": "p02595", "language": "python", "submission_id_v0": "s028374925", "submission_id_v1": "s480019615", "cpu_time_v0": 580, "cpu_time_v1": 443, "memory_v0": 45308, "memory_v1": 9156, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.62, "input": "N, D = list(map(int, input().split()))\n\npoint = []\n\nfor i in range(N):\n\n point.append(list(map(int, input().split())))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in point:\n\n if (i[0]**2 + i[1]**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)", "target": "N, D = list(map(int, input().split()))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in range(N):\n\n X, Y = list(map(int, input().split()))\n\n if (X**2 + Y**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)", "code_v0_loc": 12, "code_v1_loc": 10, "code_v0_num_chars": 219, "code_v1_num_chars": 171, "code_v0_no_empty_lines": "N, D = list(map(int, input().split()))\npoint = []\nfor i in range(N):\n point.append(list(map(int, input().split())))\nct = 0\nD2 = D * D\nfor i in point:\n if (i[0] ** 2 + i[1] ** 2) <= D2:\n ct += 1\nprint(ct)\n", "code_v1_no_empty_lines": "N, D = list(map(int, input().split()))\nct = 0\nD2 = D * D\nfor i in range(N):\n X, Y = list(map(int, input().split()))\n if (X**2 + Y**2) <= D2:\n ct += 1\nprint(ct)\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-point = []", "-for i in range(N):", "- point.append(list(map(int, input().split())))", "-for i in point:", "- if (i[0] ** 2 + i[1] ** 2) <= D2:", "+for i in range(N):", "+ X, Y = list(map(int, input().split()))", "+ if (X**2 + Y**2) <= D2:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.399467237, "measured_runtime_v1": 0.2084539161, "runtime_lift": 1.9163335691, "key": ["s028374925", "s480019615"]} +{"user_id": "u624689667", "problem_id": "p03796", "language": "python", "submission_id_v0": "s800016333", "submission_id_v1": "s112879561", "cpu_time_v0": 271, "cpu_time_v1": 164, "memory_v0": 42736, "memory_v1": 38512, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.48, "input": "from math import factorial\n\n\n\nmod = 10**9 + 7\n\nn = int(input())\n\n\n\nans = factorial(n) % mod\n\nprint(ans)", "target": "N = int(input())\n\nMOD = 10**9 + 7\n\nans = 1\n\nfor i in range(2, N+1):\n\n ans *= i\n\n ans %= MOD\n\nprint(ans)\n", "code_v0_loc": 7, "code_v1_loc": 7, "code_v0_num_chars": 103, "code_v1_num_chars": 110, "code_v0_no_empty_lines": "from math import factorial\n\nmod = 10**9 + 7\nn = int(input())\nans = factorial(n) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nMOD = 10**9 + 7\nans = 1\nfor i in range(2, N + 1):\n ans *= i\n ans %= MOD\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-from math import factorial", "-", "-mod = 10**9 + 7", "-n = int(input())", "-ans = factorial(n) % mod", "+N = int(input())", "+MOD = 10**9 + 7", "+ans = 1", "+for i in range(2, N + 1):", "+ ans *= i", "+ ans %= MOD"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5071064572, "measured_runtime_v1": 0.006458343, "runtime_lift": 78.5195915066, "key": ["s800016333", "s112879561"]} +{"user_id": "u297574184", "problem_id": "p02773", "language": "python", "submission_id_v0": "s609062581", "submission_id_v1": "s989407304", "cpu_time_v0": 358, "cpu_time_v1": 258, "memory_v0": 35944, "memory_v1": 38716, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.93, "input": "from collections import Counter\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef solve():\n\n N = int(input())\n\n Sss = [input().rstrip() for _ in range(N)]\n\n\n\n cnt = Counter(Sss)\n\n #print('cnt:', cnt)\n\n\n\n maxNum = max(cnt.values())\n\n #print('maxNum:', maxNum)\n\n\n\n anss = []\n\n for key, value in list(cnt.items()):\n\n if value == maxNum:\n\n anss.append(key)\n\n #print('anss:', anss)\n\n\n\n anss.sort()\n\n\n\n print(('\\n'.join(anss)))\n\n\n\n\n\nsolve()\n", "target": "from collections import Counter\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(input())\n\nSss = [input().rstrip() for _ in range(N)]\n\n\n\ncnt = Counter(Sss)\n\n\n\nnum = max(cnt.values())\n\n\n\nanss = []\n\nfor key in sorted(cnt.keys()):\n\n if cnt[key] == num:\n\n anss.append(key)\n\n\n\nprint(('\\n'.join(anss)))\n", "code_v0_loc": 26, "code_v1_loc": 17, "code_v0_num_chars": 475, "code_v1_num_chars": 307, "code_v0_no_empty_lines": "from collections import Counter\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef solve():\n N = int(input())\n Sss = [input().rstrip() for _ in range(N)]\n cnt = Counter(Sss)\n # print('cnt:', cnt)\n maxNum = max(cnt.values())\n # print('maxNum:', maxNum)\n anss = []\n for key, value in list(cnt.items()):\n if value == maxNum:\n anss.append(key)\n # print('anss:', anss)\n anss.sort()\n print((\"\\n\".join(anss)))\n\n\nsolve()\n", "code_v1_no_empty_lines": "from collections import Counter\nimport sys\n\ninput = sys.stdin.readline\nN = int(input())\nSss = [input().rstrip() for _ in range(N)]\ncnt = Counter(Sss)\nnum = max(cnt.values())\nanss = []\nfor key in sorted(cnt.keys()):\n if cnt[key] == num:\n anss.append(key)\nprint((\"\\n\".join(anss)))\n", "code_same": false, "relative_loc_diff_percent": 34.6153846154, "diff": ["-", "-", "-def solve():", "- N = int(input())", "- Sss = [input().rstrip() for _ in range(N)]", "- cnt = Counter(Sss)", "- # print('cnt:', cnt)", "- maxNum = max(cnt.values())", "- # print('maxNum:', maxNum)", "- anss = []", "- for key, value in list(cnt.items()):", "- if value == maxNum:", "- anss.append(key)", "- # print('anss:', anss)", "- anss.sort()", "- print((\"\\n\".join(anss)))", "-", "-", "-solve()", "+N = int(input())", "+Sss = [input().rstrip() for _ in range(N)]", "+cnt = Counter(Sss)", "+num = max(cnt.values())", "+anss = []", "+for key in sorted(cnt.keys()):", "+ if cnt[key] == num:", "+ anss.append(key)", "+print((\"\\n\".join(anss)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2647752221, "measured_runtime_v1": 0.1462080963, "runtime_lift": 1.8109477437, "key": ["s609062581", "s989407304"]} +{"user_id": "u811436126", "problem_id": "p02555", "language": "python", "submission_id_v0": "s082576202", "submission_id_v1": "s465570710", "cpu_time_v0": 367, "cpu_time_v1": 30, "memory_v0": 9988, "memory_v1": 9128, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.83, "input": "from functools import lru_cache\n\nimport sys\n\n\n\nsys.setrecursionlimit(2000)\n\n\n\ns = int(input())\n\nmod = 10 ** 9 + 7\n\n\n\n\n\n@lru_cache(maxsize=None)\n\ndef dfs(n):\n\n if n <= 2:\n\n return 0\n\n elif 3<=n<=5:\n\n return 1\n\n else:\n\n count = 1\n\n for i in range(3, n + 1):\n\n count += dfs(n - i)\n\n count %= mod\n\n\n\n return count % mod\n\n\n\n\n\nans = dfs(s)\n\nprint(ans)\n", "target": "s = int(input())\n\nmod = 10 ** 9 + 7\n\n\n\ndp = [0] * (s + 1)\n\ndp[0] = 1\n\n\n\nx = 0\n\nfor i in range(3, s + 1):\n\n x += dp[i - 3]\n\n dp[i] = x % mod\n\n\n\nans = dp[s] % mod\n\nprint(ans)\n", "code_v0_loc": 26, "code_v1_loc": 13, "code_v0_num_chars": 412, "code_v1_num_chars": 179, "code_v0_no_empty_lines": "from functools import lru_cache\nimport sys\n\nsys.setrecursionlimit(2000)\ns = int(input())\nmod = 10**9 + 7\n\n\n@lru_cache(maxsize=None)\ndef dfs(n):\n if n <= 2:\n return 0\n elif 3 <= n <= 5:\n return 1\n else:\n count = 1\n for i in range(3, n + 1):\n count += dfs(n - i)\n count %= mod\n return count % mod\n\n\nans = dfs(s)\nprint(ans)\n", "code_v1_no_empty_lines": "s = int(input())\nmod = 10**9 + 7\ndp = [0] * (s + 1)\ndp[0] = 1\nx = 0\nfor i in range(3, s + 1):\n x += dp[i - 3]\n dp[i] = x % mod\nans = dp[s] % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-from functools import lru_cache", "-import sys", "-", "-sys.setrecursionlimit(2000)", "-", "-", "-@lru_cache(maxsize=None)", "-def dfs(n):", "- if n <= 2:", "- return 0", "- elif 3 <= n <= 5:", "- return 1", "- else:", "- count = 1", "- for i in range(3, n + 1):", "- count += dfs(n - i)", "- count %= mod", "- return count % mod", "-", "-", "-ans = dfs(s)", "+dp = [0] * (s + 1)", "+dp[0] = 1", "+x = 0", "+for i in range(3, s + 1):", "+ x += dp[i - 3]", "+ dp[i] = x % mod", "+ans = dp[s] % mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5571973288, "measured_runtime_v1": 0.21483691, "runtime_lift": 2.593582866, "key": ["s082576202", "s465570710"]} +{"user_id": "u599114793", "problem_id": "p03721", "language": "python", "submission_id_v0": "s168629717", "submission_id_v1": "s331365181", "cpu_time_v0": 827, "cpu_time_v1": 370, "memory_v0": 54036, "memory_v1": 83348, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.26, "input": "n,k = list(map(int,input().split()))\n\nnum = 0\n\nq = []\n\nfor i in range(n):\n\n a,b = list(map(int,input().split()))\n\n q.append((a,b))\n\nq.sort()\n\nfor i in range(n):\n\n a, b = q[i][0], q[i][1]\n\n num += b\n\n if num >= k:\n\n print(a)\n\n exit()\n\n\n", "target": "n,k = list(map(int,input().split()))\n\ncnt = 0\n\nnum = []\n\nfor i in range(n):\n\n a,b = list(map(int,input().split()))\n\n num.append((a,b))\n\nnum.sort()\n\nfor i in range(n):\n\n cnt += num[i][1]\n\n if cnt >= k:\n\n print((num[i][0]))\n\n exit()", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 252, "code_v1_num_chars": 242, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\nnum = 0\nq = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n q.append((a, b))\nq.sort()\nfor i in range(n):\n a, b = q[i][0], q[i][1]\n num += b\n if num >= k:\n print(a)\n exit()\n", "code_v1_no_empty_lines": "n, k = list(map(int, input().split()))\ncnt = 0\nnum = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n num.append((a, b))\nnum.sort()\nfor i in range(n):\n cnt += num[i][1]\n if cnt >= k:\n print((num[i][0]))\n exit()\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-num = 0", "-q = []", "+cnt = 0", "+num = []", "- q.append((a, b))", "-q.sort()", "+ num.append((a, b))", "+num.sort()", "- a, b = q[i][0], q[i][1]", "- num += b", "- if num >= k:", "- print(a)", "+ cnt += num[i][1]", "+ if cnt >= k:", "+ print((num[i][0]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3024329725, "measured_runtime_v1": 0.2289340452, "runtime_lift": 1.3210484801, "key": ["s168629717", "s331365181"]} +{"user_id": "u094191970", "problem_id": "p03416", "language": "python", "submission_id_v0": "s196951264", "submission_id_v1": "s755826464", "cpu_time_v0": 127, "cpu_time_v1": 57, "memory_v0": 2940, "memory_v1": 9184, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.12, "input": "a,b=list(map(int, input().split()))\n\ncnt=0\n\nfor i in range(a,b+1):\n\n n=list(str(i))\n\n if n==list(reversed(n)):\n\n cnt+=1\n\nprint(cnt)", "target": "from sys import stdin\n\nnii=lambda:list(map(int,stdin.readline().split()))\n\nlnii=lambda:list(map(int,stdin.readline().split()))\n\n\n\na,b=nii()\n\nans=0\n\nfor i in range(a,b+1):\n\n s=str(i)\n\n if s==s[::-1]:\n\n ans+=1\n\n\n\nprint(ans)", "code_v0_loc": 7, "code_v1_loc": 12, "code_v0_num_chars": 138, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(a, b + 1):\n n = list(str(i))\n if n == list(reversed(n)):\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "from sys import stdin\n\nnii = lambda: list(map(int, stdin.readline().split()))\nlnii = lambda: list(map(int, stdin.readline().split()))\na, b = nii()\nans = 0\nfor i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.6666666667, "diff": ["-a, b = list(map(int, input().split()))", "-cnt = 0", "+from sys import stdin", "+", "+nii = lambda: list(map(int, stdin.readline().split()))", "+lnii = lambda: list(map(int, stdin.readline().split()))", "+a, b = nii()", "+ans = 0", "- n = list(str(i))", "- if n == list(reversed(n)):", "- cnt += 1", "-print(cnt)", "+ s = str(i)", "+ if s == s[::-1]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4537812017, "measured_runtime_v1": 0.1270140123, "runtime_lift": 3.5726861437, "key": ["s196951264", "s755826464"]} +{"user_id": "u046187684", "problem_id": "p03416", "language": "python", "submission_id_v0": "s340270167", "submission_id_v1": "s097893502", "cpu_time_v0": 67, "cpu_time_v1": 60, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.45, "input": "a, b = list(map(int, input().strip().split(\" \")))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\nprint(count)\n", "target": "def solve(string):\n\n a, b = list(map(int, string.split()))\n\n count = 0\n\n for i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\n return str(count)\n\n\n\n\n\nif __name__ == '__main__':\n\n print((solve(input())))\n", "code_v0_loc": 6, "code_v1_loc": 11, "code_v0_num_chars": 148, "code_v1_num_chars": 244, "code_v0_no_empty_lines": "a, b = list(map(int, input().strip().split(\" \")))\ncount = 0\nfor i in range(a, b + 1):\n if str(i) == str(i)[::-1]:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "def solve(string):\n a, b = list(map(int, string.split()))\n count = 0\n for i in range(a, b + 1):\n if str(i) == str(i)[::-1]:\n count += 1\n return str(count)\n\n\nif __name__ == \"__main__\":\n print((solve(input())))\n", "code_same": false, "relative_loc_diff_percent": 45.4545454545, "diff": ["-a, b = list(map(int, input().strip().split(\" \")))", "-count = 0", "-for i in range(a, b + 1):", "- if str(i) == str(i)[::-1]:", "- count += 1", "-print(count)", "+def solve(string):", "+ a, b = list(map(int, string.split()))", "+ count = 0", "+ for i in range(a, b + 1):", "+ if str(i) == str(i)[::-1]:", "+ count += 1", "+ return str(count)", "+", "+", "+if __name__ == \"__main__\":", "+ print((solve(input())))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2889559059, "measured_runtime_v1": 0.2039610577, "runtime_lift": 1.4167209624, "key": ["s340270167", "s097893502"]} +{"user_id": "u257974487", "problem_id": "p03796", "language": "python", "submission_id_v0": "s235320519", "submission_id_v1": "s032021754", "cpu_time_v0": 230, "cpu_time_v1": 40, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.61, "input": "import math\n\nN = int(input())\n\np = math.factorial(N)\n\nprint((p % 1000000007))", "target": "N = int(input())\n\np = 1\n\nfor i in range(1,N+1):\n\n p *= i\n\n p %= 1000000007\n\nprint(p)\n", "code_v0_loc": 4, "code_v1_loc": 6, "code_v0_num_chars": 75, "code_v1_num_chars": 91, "code_v0_no_empty_lines": "import math\n\nN = int(input())\np = math.factorial(N)\nprint((p % 1000000007))\n", "code_v1_no_empty_lines": "N = int(input())\np = 1\nfor i in range(1, N + 1):\n p *= i\n p %= 1000000007\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-import math", "-", "-p = math.factorial(N)", "-print((p % 1000000007))", "+p = 1", "+for i in range(1, N + 1):", "+ p *= i", "+ p %= 1000000007", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.768677109, "measured_runtime_v1": 0.410683428, "runtime_lift": 1.8717022808, "key": ["s235320519", "s032021754"]} +{"user_id": "u706929073", "problem_id": "p02881", "language": "python", "submission_id_v0": "s504662720", "submission_id_v1": "s470778572", "cpu_time_v0": 504, "cpu_time_v1": 137, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.82, "input": "N = int(input())\n\n\n\n\n\ndef dist(i, j):\n\n return i + j - 2\n\n\n\n\n\nmin = 10 ** 24\n\ni = 1\n\nwhile (i ** 2) <= N:\n\n if 0 == N % i:\n\n j = N // i\n\n d = dist(i, j)\n\n if min > d:\n\n min = d\n\n i += 1\n\nprint(d)\n", "target": "import math\n\nn = int(input())\n\n\n\nans = 0\n\nfor i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:\n\n if 0 == n % i:\n\n ans = i\n\n break\n\nans_partner = n // ans\n\nprint((ans + ans_partner - 2))\n", "code_v0_loc": 17, "code_v1_loc": 10, "code_v0_num_chars": 237, "code_v1_num_chars": 200, "code_v0_no_empty_lines": "N = int(input())\n\n\ndef dist(i, j):\n return i + j - 2\n\n\nmin = 10**24\ni = 1\nwhile (i**2) <= N:\n if 0 == N % i:\n j = N // i\n d = dist(i, j)\n if min > d:\n min = d\n i += 1\nprint(d)\n", "code_v1_no_empty_lines": "import math\n\nn = int(input())\nans = 0\nfor i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:\n if 0 == n % i:\n ans = i\n break\nans_partner = n // ans\nprint((ans + ans_partner - 2))\n", "code_same": false, "relative_loc_diff_percent": 41.1764705882, "diff": ["-N = int(input())", "+import math", "-", "-def dist(i, j):", "- return i + j - 2", "-", "-", "-min = 10**24", "-i = 1", "-while (i**2) <= N:", "- if 0 == N % i:", "- j = N // i", "- d = dist(i, j)", "- if min > d:", "- min = d", "- i += 1", "-print(d)", "+n = int(input())", "+ans = 0", "+for i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:", "+ if 0 == n % i:", "+ ans = i", "+ break", "+ans_partner = n // ans", "+print((ans + ans_partner - 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.327980933, "measured_runtime_v1": 0.2062122526, "runtime_lift": 1.5905016738, "key": ["s504662720", "s470778572"]} +{"user_id": "u222668979", "problem_id": "p02552", "language": "python", "submission_id_v0": "s235847366", "submission_id_v1": "s896909207", "cpu_time_v0": 81, "cpu_time_v1": 70, "memory_v0": 61596, "memory_v1": 61788, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.58, "input": "n = int(input())\n\nprint((1 if n == 0 else 0))\n", "target": "n = int(input())\n\nprint((0 if n else 1))\n", "code_v0_loc": 2, "code_v1_loc": 2, "code_v0_num_chars": 44, "code_v1_num_chars": 39, "code_v0_no_empty_lines": "n = int(input())\nprint((1 if n == 0 else 0))\n", "code_v1_no_empty_lines": "n = int(input())\nprint((0 if n else 1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-print((1 if n == 0 else 0))", "+print((0 if n else 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.340472885, "measured_runtime_v1": 0.2658090671, "runtime_lift": 1.2808926674, "key": ["s235847366", "s896909207"]} +{"user_id": "u282228874", "problem_id": "p03013", "language": "python", "submission_id_v0": "s600331807", "submission_id_v1": "s809304917", "cpu_time_v0": 241, "cpu_time_v1": 180, "memory_v0": 9592, "memory_v1": 13192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.31, "input": "N,M = list(map(int,input().split()))\n\nMOD = 10**9+7\n\ndp = [0]*(N+1)\n\ndp[0]=1\n\nA = [int(input()) for i in range(M)]\n\nban = [1]*(N+1)\n\nfor a in A:\n\n ban[a]=0\n\nfor i in range(N):\n\n if i-1>=0:\n\n dp[i+1]=dp[i]*ban[i]+dp[i-1]*ban[i-1]\n\n else:\n\n dp[i+1]=dp[i]*ban[i]\n\n dp[i+1] %= MOD \n\nprint((dp[N]))", "target": "N,M = list(map(int,input().split()))\n\nA = [int(input()) for i in range(M)]\n\nMOD = 10**9+7\n\nA = set(A)\n\ndp = [0]*(N+1)\n\ndp[0] = 1\n\nfor i in range(1,N+1):\n\n if i in A:\n\n continue\n\n if i == 1:\n\n dp[1] = dp[0]\n\n else:\n\n dp[i] = (dp[i-1]+dp[i-2])%MOD\n\nprint((dp[N]))", "code_v0_loc": 15, "code_v1_loc": 14, "code_v0_num_chars": 311, "code_v1_num_chars": 283, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nMOD = 10**9 + 7\ndp = [0] * (N + 1)\ndp[0] = 1\nA = [int(input()) for i in range(M)]\nban = [1] * (N + 1)\nfor a in A:\n ban[a] = 0\nfor i in range(N):\n if i - 1 >= 0:\n dp[i + 1] = dp[i] * ban[i] + dp[i - 1] * ban[i - 1]\n else:\n dp[i + 1] = dp[i] * ban[i]\n dp[i + 1] %= MOD\nprint((dp[N]))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nA = [int(input()) for i in range(M)]\nMOD = 10**9 + 7\nA = set(A)\ndp = [0] * (N + 1)\ndp[0] = 1\nfor i in range(1, N + 1):\n if i in A:\n continue\n if i == 1:\n dp[1] = dp[0]\n else:\n dp[i] = (dp[i - 1] + dp[i - 2]) % MOD\nprint((dp[N]))\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["+A = [int(input()) for i in range(M)]", "+A = set(A)", "-A = [int(input()) for i in range(M)]", "-ban = [1] * (N + 1)", "-for a in A:", "- ban[a] = 0", "-for i in range(N):", "- if i - 1 >= 0:", "- dp[i + 1] = dp[i] * ban[i] + dp[i - 1] * ban[i - 1]", "+for i in range(1, N + 1):", "+ if i in A:", "+ continue", "+ if i == 1:", "+ dp[1] = dp[0]", "- dp[i + 1] = dp[i] * ban[i]", "- dp[i + 1] %= MOD", "+ dp[i] = (dp[i - 1] + dp[i - 2]) % MOD"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2076114528, "measured_runtime_v1": 0.0063931749, "runtime_lift": 32.4739204186, "key": ["s600331807", "s809304917"]} +{"user_id": "u562935282", "problem_id": "p03371", "language": "python", "submission_id_v0": "s471284270", "submission_id_v1": "s058926350", "cpu_time_v0": 98, "cpu_time_v1": 81, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.35, "input": "def main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = 1 << 30\n\n c = 0 # even\n\n while True:\n\n j = c // 2\n\n t = A * max(0, X - j) + B * max(0, Y - j) + C * c\n\n if ans <= t: break\n\n ans = t\n\n c += 2\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 353, "code_v1_num_chars": 318, "code_v0_no_empty_lines": "def main():\n A, B, AB, X, Y = list(map(int, input().split()))\n M = max(X, Y)\n k = 0\n ans = A * X + B * Y\n while True:\n ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)\n if k >= M:\n break\n k += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = 1 << 30\n c = 0 # even\n while True:\n j = c // 2\n t = A * max(0, X - j) + B * max(0, Y - j) + C * c\n if ans <= t:\n break\n ans = t\n c += 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["- A, B, AB, X, Y = list(map(int, input().split()))", "- M = max(X, Y)", "- k = 0", "- ans = A * X + B * Y", "+ A, B, C, X, Y = list(map(int, input().split()))", "+ ans = 1 << 30", "+ c = 0 # even", "- ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)", "- if k >= M:", "+ j = c // 2", "+ t = A * max(0, X - j) + B * max(0, Y - j) + C * c", "+ if ans <= t:", "- k += 1", "+ ans = t", "+ c += 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3021148317, "measured_runtime_v1": 0.1545656888, "runtime_lift": 1.9546047633, "key": ["s471284270", "s058926350"]} +{"user_id": "u021019433", "problem_id": "p02837", "language": "python", "submission_id_v0": "s456284110", "submission_id_v1": "s644980365", "cpu_time_v0": 95, "cpu_time_v1": 55, "memory_v0": 6500, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.11, "input": "def popcount(x):\n\n r, q = 0, x\n\n while x:\n\n r += 1\n\n x &= x - 1\n\n return r, q\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\nl = (1 << n) - 1 \n\nb = sorted(map(popcount, list(range(1, l + 1))))\n\nans = next((i for i, x in reversed(b)\n\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)), 0)\n\nprint(ans)\n", "target": "from itertools import combinations, count\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [(set(), set()) for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y].add(x - 1)\n\nr = next(i for i in count(n, - 1) for x in map(set, combinations(r, i))\n\n if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x))\n\nprint(r)\n", "code_v0_loc": 19, "code_v1_loc": 12, "code_v0_num_chars": 460, "code_v1_num_chars": 369, "code_v0_no_empty_lines": "def popcount(x):\n r, q = 0, x\n while x:\n r += 1\n x &= x - 1\n return r, q\n\n\nn = int(input())\nr = list(range(n))\na = [[0, 0] for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y] |= 1 << (x - 1)\nl = (1 << n) - 1\nb = sorted(map(popcount, list(range(1, l + 1))))\nans = next(\n (\n i\n for i, x in reversed(b)\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)\n ),\n 0,\n)\nprint(ans)\n", "code_v1_no_empty_lines": "from itertools import combinations, count\n\nn = int(input())\nr = list(range(n))\na = [(set(), set()) for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y].add(x - 1)\nr = next(\n i\n for i in count(n, -1)\n for x in map(set, combinations(r, i))\n if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x)\n)\nprint(r)\n", "code_same": false, "relative_loc_diff_percent": 36.8421052632, "diff": ["-def popcount(x):", "- r, q = 0, x", "- while x:", "- r += 1", "- x &= x - 1", "- return r, q", "-", "+from itertools import combinations, count", "-a = [[0, 0] for _ in r]", "+a = [(set(), set()) for _ in r]", "- a[i][y] |= 1 << (x - 1)", "-l = (1 << n) - 1", "-b = sorted(map(popcount, list(range(1, l + 1))))", "-ans = next(", "- (", "- i", "- for i, x in reversed(b)", "- if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)", "- ),", "- 0,", "+ a[i][y].add(x - 1)", "+r = next(", "+ i", "+ for i in count(n, -1)", "+ for x in map(set, combinations(r, i))", "+ if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x)", "-print(ans)", "+print(r)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3135637941, "measured_runtime_v1": 0.2051509681, "runtime_lift": 1.5284538848, "key": ["s456284110", "s644980365"]} +{"user_id": "u227438830", "problem_id": "p02394", "language": "python", "submission_id_v0": "s015330345", "submission_id_v1": "s144446421", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7644, "memory_v1": 5592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "W,H,x,y,r = [int(i) for i in input().split()]\n\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "target": "W, H, x, y, r = list(map(int, input().split()))\n\nif r <= x <= W-r and r <= y <= H-r:\n\n print('Yes')\n\nelse:\n\n print('No')\n", "code_v0_loc": 5, "code_v1_loc": 5, "code_v0_num_chars": 148, "code_v1_num_chars": 121, "code_v0_no_empty_lines": "W, H, x, y, r = [int(i) for i in input().split()]\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "W, H, x, y, r = list(map(int, input().split()))\nif r <= x <= W - r and r <= y <= H - r:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-W, H, x, y, r = [int(i) for i in input().split()]", "-if x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:", "+W, H, x, y, r = list(map(int, input().split()))", "+if r <= x <= W - r and r <= y <= H - r:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1765992579, "measured_runtime_v1": 0.0064357525, "runtime_lift": 27.44034336, "key": ["s015330345", "s144446421"]} +{"user_id": "u353895424", "problem_id": "p03325", "language": "python", "submission_id_v0": "s954474488", "submission_id_v1": "s311308759", "cpu_time_v0": 81, "cpu_time_v1": 56, "memory_v0": 4148, "memory_v1": 10088, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.86, "input": "from math import log2\n\nn = int(input())\n\na = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor _a in a:\n\n if _a%2 == 0:\n\n cnt =0\n\n while _a%2 == 0:\n\n _a //= 2\n\n cnt += 1\n\n ans += cnt\n\n\n\nprint((int(ans)))", "target": "def f(k):\n\n cnt = 0\n\n while k%2 == 0:\n\n k //= 2\n\n cnt += 1\n\n # print(k)\n\n # print(\"-----\")\n\n return cnt\n\n\n\nn = int(input())\n\nA = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor a in A:\n\n if a%2 == 0:\n\n ans += f(a)\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 17, "code_v0_num_chars": 245, "code_v1_num_chars": 272, "code_v0_no_empty_lines": "from math import log2\n\nn = int(input())\na = list(map(int, input().split()))\nans = 0\nfor _a in a:\n if _a % 2 == 0:\n cnt = 0\n while _a % 2 == 0:\n _a //= 2\n cnt += 1\n ans += cnt\nprint((int(ans)))\n", "code_v1_no_empty_lines": "def f(k):\n cnt = 0\n while k % 2 == 0:\n k //= 2\n cnt += 1\n # print(k)\n # print(\"-----\")\n return cnt\n\n\nn = int(input())\nA = list(map(int, input().split()))\nans = 0\nfor a in A:\n if a % 2 == 0:\n ans += f(a)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["-from math import log2", "+def f(k):", "+ cnt = 0", "+ while k % 2 == 0:", "+ k //= 2", "+ cnt += 1", "+ # print(k)", "+ return cnt", "+", "-a = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "-for _a in a:", "- if _a % 2 == 0:", "- cnt = 0", "- while _a % 2 == 0:", "- _a //= 2", "- cnt += 1", "- ans += cnt", "-print((int(ans)))", "+for a in A:", "+ if a % 2 == 0:", "+ ans += f(a)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3309142907, "measured_runtime_v1": 0.2479304838, "runtime_lift": 1.3347059448, "key": ["s954474488", "s311308759"]} +{"user_id": "u133936772", "problem_id": "p02685", "language": "python", "submission_id_v0": "s693454638", "submission_id_v1": "s088786085", "cpu_time_v0": 1252, "cpu_time_v1": 782, "memory_v0": 9184, "memory_v1": 9192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.54, "input": "M=998244353\n\nn,m,k=list(map(int,input().split()))\n\na=0\n\nc=1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n-i-1,M)\n\n c=c*(n-i-1)*pow(i+1,M-2,M)%M\n\nprint((a%M))", "target": "M=998244353\n\nn,m,k=list(map(int,input().split()))\n\na,c=0,1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n+~i,M)\n\n c=c*(n+~i)*pow(i+1,-1,M)%M\n\nprint((a%M))", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 146, "code_v1_num_chars": 142, "code_v0_no_empty_lines": "M = 998244353\nn, m, k = list(map(int, input().split()))\na = 0\nc = 1\nfor i in range(k + 1):\n a += c * m * pow(m - 1, n - i - 1, M)\n c = c * (n - i - 1) * pow(i + 1, M - 2, M) % M\nprint((a % M))\n", "code_v1_no_empty_lines": "M = 998244353\nn, m, k = list(map(int, input().split()))\na, c = 0, 1\nfor i in range(k + 1):\n a += c * m * pow(m - 1, n + ~i, M)\n c = c * (n + ~i) * pow(i + 1, -1, M) % M\nprint((a % M))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-a = 0", "-c = 1", "+a, c = 0, 1", "- a += c * m * pow(m - 1, n - i - 1, M)", "- c = c * (n - i - 1) * pow(i + 1, M - 2, M) % M", "+ a += c * m * pow(m - 1, n + ~i, M)", "+ c = c * (n + ~i) * pow(i + 1, -1, M) % M"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5053028598, "measured_runtime_v1": 0.3381624324, "runtime_lift": 1.4942607792, "key": ["s693454638", "s088786085"]} +{"user_id": "u038408819", "problem_id": "p03680", "language": "python", "submission_id_v0": "s808331415", "submission_id_v1": "s267927939", "cpu_time_v0": 450, "cpu_time_v1": 202, "memory_v0": 7084, "memory_v1": 7084, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.11, "input": "N = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(10 ** 6):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))", "target": "N = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(len(a)):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 226, "code_v1_num_chars": 225, "code_v0_no_empty_lines": "N = int(input())\na = [int(input()) for _ in range(N)]\ncnt, i = 0, 0\nfor j in range(10**6):\n cnt += 1\n if a[i] == 2:\n print(cnt)\n # break\n quit()\n else:\n i = a[i] - 1\nprint((-1))\n", "code_v1_no_empty_lines": "N = int(input())\na = [int(input()) for _ in range(N)]\ncnt, i = 0, 0\nfor j in range(len(a)):\n cnt += 1\n if a[i] == 2:\n print(cnt)\n # break\n quit()\n else:\n i = a[i] - 1\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-for j in range(10**6):", "+for j in range(len(a)):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6719723573, "measured_runtime_v1": 0.1459480231, "runtime_lift": 4.6041895124, "key": ["s808331415", "s267927939"]} +{"user_id": "u581511366", "problem_id": "p02555", "language": "python", "submission_id_v0": "s399411060", "submission_id_v1": "s856192378", "cpu_time_v0": 183, "cpu_time_v1": 64, "memory_v0": 72444, "memory_v1": 63820, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.03, "input": "import math\n\n\n\n\n\ndef combinations_count(n, r):\n\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n s = int(input())\n\n ans = 0\n\n n = s // 3\n\n\n\n for i in range(1, n + 1):\n\n ans += combinations_with_replacement_count(i, 3*(n-i)+s % 3)\n\n\n\n print((ans % (10**9 + 7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n s = int(input())\n\n dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]\n\n\n\n for i in range(6, s+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n\n\n print((dp[s] % (10**9+7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 24, "code_v1_loc": 12, "code_v0_num_chars": 468, "code_v1_num_chars": 228, "code_v0_no_empty_lines": "import math\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\ndef combinations_with_replacement_count(n, r):\n return combinations_count(n + r - 1, r)\n\n\ndef main():\n s = int(input())\n ans = 0\n n = s // 3\n for i in range(1, n + 1):\n ans += combinations_with_replacement_count(i, 3 * (n - i) + s % 3)\n print((ans % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n s = int(input())\n dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]\n for i in range(6, s + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n print((dp[s] % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-", "-def combinations_count(n, r):", "- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))", "-", "-", "-def combinations_with_replacement_count(n, r):", "- return combinations_count(n + r - 1, r)", "-", "-", "- ans = 0", "- n = s // 3", "- for i in range(1, n + 1):", "- ans += combinations_with_replacement_count(i, 3 * (n - i) + s % 3)", "- print((ans % (10**9 + 7)))", "+ dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]", "+ for i in range(6, s + 1):", "+ dp[i] = dp[i - 1] + dp[i - 3]", "+ print((dp[s] % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2865847409, "measured_runtime_v1": 0.2083418293, "runtime_lift": 1.3755506603, "key": ["s399411060", "s856192378"]} +{"user_id": "u170183831", "problem_id": "p03568", "language": "python", "submission_id_v0": "s971455595", "submission_id_v1": "s272804435", "cpu_time_v0": 148, "cpu_time_v1": 29, "memory_v0": 9116, "memory_v1": 9072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.41, "input": "from itertools import product\n\n\n\nn = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ncount = 0\n\nfor C in product((-1, 0, 1), repeat=n):\n\n total = 1\n\n for a, c in zip(A, C):\n\n total *= (a + c)\n\n if total % 2 == 0:\n\n count += 1\n\nprint(count)", "target": "n = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ncount = 1\n\nfor a in A:\n\n count *= 2 if a % 2 == 0 else 1\n\nprint((3 ** n - count))", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 253, "code_v1_num_chars": 137, "code_v0_no_empty_lines": "from itertools import product\n\nn = int(input())\nA = list(map(int, input().split()))\ncount = 0\nfor C in product((-1, 0, 1), repeat=n):\n total = 1\n for a, c in zip(A, C):\n total *= a + c\n if total % 2 == 0:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "n = int(input())\nA = list(map(int, input().split()))\ncount = 1\nfor a in A:\n count *= 2 if a % 2 == 0 else 1\nprint((3**n - count))\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["-from itertools import product", "-", "-count = 0", "-for C in product((-1, 0, 1), repeat=n):", "- total = 1", "- for a, c in zip(A, C):", "- total *= a + c", "- if total % 2 == 0:", "- count += 1", "-print(count)", "+count = 1", "+for a in A:", "+ count *= 2 if a % 2 == 0 else 1", "+print((3**n - count))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2956474931, "measured_runtime_v1": 0.0067464924, "runtime_lift": 43.8224007049, "key": ["s971455595", "s272804435"]} +{"user_id": "u023958502", "problem_id": "p02899", "language": "python", "submission_id_v0": "s601919152", "submission_id_v1": "s937084523", "cpu_time_v0": 140, "cpu_time_v1": 86, "memory_v0": 19300, "memory_v1": 15588, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 38.57, "input": "n = int(input())\n\na = list(map(int,input().split()))\n\nans = [i for i in range(n)]\n\na1 = sorted(a)\n\nfor i in range(n):\n\n num = a[i]\n\n ans[num - 1] = str(i + 1)\n\n \n\nprint((' '.join(ans)))", "target": "n = int(input())\n\n# n,k = map(int,input().split())\n\na = list(map(int,input().split()))\n\nans = [0 for _ in range(n)]\n\nfor i in range(n):\n\n ans[a[i] - 1] = str(i + 1)\n\nprint((\" \".join(ans)))", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 192, "code_v1_num_chars": 187, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nans = [i for i in range(n)]\na1 = sorted(a)\nfor i in range(n):\n num = a[i]\n ans[num - 1] = str(i + 1)\nprint((\" \".join(ans)))\n", "code_v1_no_empty_lines": "n = int(input())\n# n,k = map(int,input().split())\na = list(map(int, input().split()))\nans = [0 for _ in range(n)]\nfor i in range(n):\n ans[a[i] - 1] = str(i + 1)\nprint((\" \".join(ans)))\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["+# n,k = map(int,input().split())", "-ans = [i for i in range(n)]", "-a1 = sorted(a)", "+ans = [0 for _ in range(n)]", "- num = a[i]", "- ans[num - 1] = str(i + 1)", "+ ans[a[i] - 1] = str(i + 1)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2984062884, "measured_runtime_v1": 0.2260574257, "runtime_lift": 1.3200463887, "key": ["s601919152", "s937084523"]} +{"user_id": "u768896740", "problem_id": "p02951", "language": "python", "submission_id_v0": "s688063139", "submission_id_v1": "s870650241", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif a < b + c:\n\n print((b+c-a))\n\nelse:\n\n print((0))", "target": "a,b,c = list(map(int, input().split()))\n\n\n\nprint((max(0, c-(a-b))))", "code_v0_loc": 6, "code_v1_loc": 3, "code_v0_num_chars": 91, "code_v1_num_chars": 59, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif a < b + c:\n print((b + c - a))\nelse:\n print((0))\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nprint((max(0, c - (a - b))))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-if a < b + c:", "- print((b + c - a))", "-else:", "- print((0))", "+print((max(0, c - (a - b))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2555535069, "measured_runtime_v1": 0.0829026203, "runtime_lift": 3.0825745416, "key": ["s688063139", "s870650241"]} +{"user_id": "u075012704", "problem_id": "p03038", "language": "python", "submission_id_v0": "s846597544", "submission_id_v1": "s758849446", "cpu_time_v0": 756, "cpu_time_v1": 520, "memory_v0": 43296, "memory_v1": 25512, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 31.22, "input": "from collections import Counter\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\nX = Counter(A)\n\nfor i in range(M):\n\n B, C = list(map(int, input().split()))\n\n X[C] += B\n\n\n\nZ = []\n\nfor key, value in list(X.items()):\n\n Z.append((key, value))\n\n\n\nZ.sort(key=lambda x: x[0], reverse=True)\n\n\n\nans = 0\n\ncnt = 0\n\n\n\nfor value, key in Z:\n\n if cnt + key <= N:\n\n ans += key * value\n\n cnt += key\n\n else:\n\n ans += (N - cnt) * value\n\n break\n\n\n\nprint(ans)\n", "target": "N, M = list(map(int, input().split()))\n\nA = sorted(list(map(int, input().split())))\n\nquery = []\n\nfor i in range(M):\n\n b, c = list(map(int, input().split()))\n\n query.append([b, c])\n\nquery.sort(key=lambda q: q[1], reverse=True)\n\n\n\n\n\ni = 0\n\nfor b, c in query:\n\n while i < N and b > 0:\n\n if A[i] < c:\n\n A[i] = c\n\n b -= 1\n\n i += 1\n\n\n\nprint((sum(A)))\n", "code_v0_loc": 27, "code_v1_loc": 18, "code_v0_num_chars": 496, "code_v1_num_chars": 376, "code_v0_no_empty_lines": "from collections import Counter\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nX = Counter(A)\nfor i in range(M):\n B, C = list(map(int, input().split()))\n X[C] += B\nZ = []\nfor key, value in list(X.items()):\n Z.append((key, value))\nZ.sort(key=lambda x: x[0], reverse=True)\nans = 0\ncnt = 0\nfor value, key in Z:\n if cnt + key <= N:\n ans += key * value\n cnt += key\n else:\n ans += (N - cnt) * value\n break\nprint(ans)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())))\nquery = []\nfor i in range(M):\n b, c = list(map(int, input().split()))\n query.append([b, c])\nquery.sort(key=lambda q: q[1], reverse=True)\ni = 0\nfor b, c in query:\n while i < N and b > 0:\n if A[i] < c:\n A[i] = c\n b -= 1\n i += 1\nprint((sum(A)))\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-from collections import Counter", "-", "-A = list(map(int, input().split()))", "-X = Counter(A)", "+A = sorted(list(map(int, input().split())))", "+query = []", "- B, C = list(map(int, input().split()))", "- X[C] += B", "-Z = []", "-for key, value in list(X.items()):", "- Z.append((key, value))", "-Z.sort(key=lambda x: x[0], reverse=True)", "-ans = 0", "-cnt = 0", "-for value, key in Z:", "- if cnt + key <= N:", "- ans += key * value", "- cnt += key", "- else:", "- ans += (N - cnt) * value", "- break", "-print(ans)", "+ b, c = list(map(int, input().split()))", "+ query.append([b, c])", "+query.sort(key=lambda q: q[1], reverse=True)", "+i = 0", "+for b, c in query:", "+ while i < N and b > 0:", "+ if A[i] < c:", "+ A[i] = c", "+ b -= 1", "+ i += 1", "+print((sum(A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.254084451, "measured_runtime_v1": 0.0066267376, "runtime_lift": 38.3423135365, "key": ["s846597544", "s758849446"]} +{"user_id": "u576335153", "problem_id": "p03723", "language": "python", "submission_id_v0": "s032726803", "submission_id_v1": "s012708150", "cpu_time_v0": 58, "cpu_time_v1": 26, "memory_v0": 32492, "memory_v1": 9200, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.17, "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif any(i % 2 != 0 for i in [a, b, c]):\n\n print((0))\n\n exit()\n\n\n\nif a == b and b == c:\n\n print((-1))\n\n exit()\n\n\n\ncnt = 0\n\na_list = [0]*(1001001)\n\nb_list = [0]*(1001001)\n\nc_list = [0]*(1001001)\n\na_list[0] = a\n\nb_list[0] = b\n\nc_list[0] = c\n\n\n\nfor i in range(1, 1001001):\n\n a_list[i] = (b_list[i-1] + c_list[i-1]) // 2\n\n b_list[i] = (c_list[i-1] + a_list[i-1]) // 2\n\n c_list[i] = (a_list[i-1] + b_list[i-1]) // 2\n\n cnt += 1\n\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n\n break\n\n\n\nprint(cnt)\n", "target": "def solve(a, b, c):\n\n if any(i % 2 == 1 for i in [a, b, c]):\n\n return 0\n\n if a == b == c:\n\n return -1\n\n a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2\n\n return solve(a, b, c) + 1\n\n\n\na, b, c = list(map(int, input().split()))\n\n\n\nprint((solve(a, b, c)))", "code_v0_loc": 27, "code_v1_loc": 11, "code_v0_num_chars": 580, "code_v1_num_chars": 272, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif any(i % 2 != 0 for i in [a, b, c]):\n print((0))\n exit()\nif a == b and b == c:\n print((-1))\n exit()\ncnt = 0\na_list = [0] * (1001001)\nb_list = [0] * (1001001)\nc_list = [0] * (1001001)\na_list[0] = a\nb_list[0] = b\nc_list[0] = c\nfor i in range(1, 1001001):\n a_list[i] = (b_list[i - 1] + c_list[i - 1]) // 2\n b_list[i] = (c_list[i - 1] + a_list[i - 1]) // 2\n c_list[i] = (a_list[i - 1] + b_list[i - 1]) // 2\n cnt += 1\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n break\nprint(cnt)\n", "code_v1_no_empty_lines": "def solve(a, b, c):\n if any(i % 2 == 1 for i in [a, b, c]):\n return 0\n if a == b == c:\n return -1\n a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2\n return solve(a, b, c) + 1\n\n\na, b, c = list(map(int, input().split()))\nprint((solve(a, b, c)))\n", "code_same": false, "relative_loc_diff_percent": 59.2592592593, "diff": ["+def solve(a, b, c):", "+ if any(i % 2 == 1 for i in [a, b, c]):", "+ return 0", "+ if a == b == c:", "+ return -1", "+ a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2", "+ return solve(a, b, c) + 1", "+", "+", "-if any(i % 2 != 0 for i in [a, b, c]):", "- print((0))", "- exit()", "-if a == b and b == c:", "- print((-1))", "- exit()", "-cnt = 0", "-a_list = [0] * (1001001)", "-b_list = [0] * (1001001)", "-c_list = [0] * (1001001)", "-a_list[0] = a", "-b_list[0] = b", "-c_list[0] = c", "-for i in range(1, 1001001):", "- a_list[i] = (b_list[i - 1] + c_list[i - 1]) // 2", "- b_list[i] = (c_list[i - 1] + a_list[i - 1]) // 2", "- c_list[i] = (a_list[i - 1] + b_list[i - 1]) // 2", "- cnt += 1", "- if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:", "- break", "-print(cnt)", "+print((solve(a, b, c)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6101216149, "measured_runtime_v1": 0.3266951015, "runtime_lift": 1.8675566671, "key": ["s032726803", "s012708150"]} +{"user_id": "u254871849", "problem_id": "p02921", "language": "python", "submission_id_v0": "s533958811", "submission_id_v1": "s140590362", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "# 2019-11-17 20:44:23(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# import re\n\n# import heapq\n\n# import array\n\n# from scipy.misc import comb # (default: exact=False)\n\n# import numpy as np \n\n\n\n\n\ndef main():\n\n s, t = sys.stdin.read().split()\n\n\n\n count = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "import sys\n\n\n\ns, t = sys.stdin.read().split()\n\n\n\ndef main():\n\n cnt = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n cnt += 1\n\n return cnt\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 28, "code_v1_loc": 14, "code_v0_num_chars": 611, "code_v1_num_chars": 229, "code_v0_no_empty_lines": "# 2019-11-17 20:44:23(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# import re\n# import heapq\n# import array\n# from scipy.misc import comb # (default: exact=False)\n# import numpy as np\ndef main():\n s, t = sys.stdin.read().split()\n count = 0\n for i in range(3):\n if s[i] == t[i]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ns, t = sys.stdin.read().split()\n\n\ndef main():\n cnt = 0\n for i in range(3):\n if s[i] == t[i]:\n cnt += 1\n return cnt\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-# 2019-11-17 20:44:23(JST)", "-# import collections", "-# import math", "-# from string import ascii_lowercase, ascii_uppercase, digits", "-# from bisect import bisect_left as bi_l, bisect_right as bi_r", "-# import itertools", "-# from functools import reduce", "-# import operator as op", "-# import re", "-# import heapq", "-# import array", "-# from scipy.misc import comb # (default: exact=False)", "-# import numpy as np", "+s, t = sys.stdin.read().split()", "+", "+", "- s, t = sys.stdin.read().split()", "- count = 0", "+ cnt = 0", "- count += 1", "- print(count)", "+ cnt += 1", "+ return cnt", "- main()", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2871051877, "measured_runtime_v1": 0.085240711, "runtime_lift": 3.3681697905, "key": ["s533958811", "s140590362"]} +{"user_id": "u729939940", "problem_id": "p02767", "language": "python", "submission_id_v0": "s286517602", "submission_id_v1": "s316820501", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N = int(input())\n\nX = list(map(int, input().split()))\n\nX = list(sorted(X))\n\nif N == 1:\n\n print((0))\n\n exit()\n\nans = float('inf')\n\nfor p in range(X[0], X[N - 1] + 1):\n\n sum = 0\n\n for x in X:\n\n sum += (x - p) ** 2\n\n ans = min(sum, ans)\n\nprint(ans)", "target": "N = int(input())\n\nX = list(map(int, input().split()))\n\navg = round(sum(X) / N)\n\nprint((sum([(x - avg) ** 2 for x in X])))", "code_v0_loc": 13, "code_v1_loc": 4, "code_v0_num_chars": 251, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "N = int(input())\nX = list(map(int, input().split()))\nX = list(sorted(X))\nif N == 1:\n print((0))\n exit()\nans = float(\"inf\")\nfor p in range(X[0], X[N - 1] + 1):\n sum = 0\n for x in X:\n sum += (x - p) ** 2\n ans = min(sum, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nX = list(map(int, input().split()))\navg = round(sum(X) / N)\nprint((sum([(x - avg) ** 2 for x in X])))\n", "code_same": false, "relative_loc_diff_percent": 69.2307692308, "diff": ["-X = list(sorted(X))", "-if N == 1:", "- print((0))", "- exit()", "-ans = float(\"inf\")", "-for p in range(X[0], X[N - 1] + 1):", "- sum = 0", "- for x in X:", "- sum += (x - p) ** 2", "- ans = min(sum, ans)", "-print(ans)", "+avg = round(sum(X) / N)", "+print((sum([(x - avg) ** 2 for x in X])))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2590025333, "measured_runtime_v1": 0.1089487125, "runtime_lift": 2.3772886094, "key": ["s286517602", "s316820501"]} +{"user_id": "u628335443", "problem_id": "p02725", "language": "python", "submission_id_v0": "s320196234", "submission_id_v1": "s733866625", "cpu_time_v0": 189, "cpu_time_v1": 163, "memory_v0": 26444, "memory_v1": 26444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.76, "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd = [0] * n\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d[i] = a[i + 1] - a[i]\n\n d_max = max(d_max, d[i])\n\n\n\nd[-1] = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d[-1])\n\n\n\nprint((k - d_max))\n", "target": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d = a[i + 1] - a[i]\n\n d_max = max(d_max, d)\n\n\n\nd = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d)\n\n\n\nprint((k - d_max))\n", "code_v0_loc": 13, "code_v1_loc": 12, "code_v0_num_chars": 255, "code_v1_num_chars": 228, "code_v0_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nd = [0] * n\nd_max = 0\nfor i in range(n - 1):\n d[i] = a[i + 1] - a[i]\n d_max = max(d_max, d[i])\nd[-1] = (k - a[-1]) + a[0]\nd_max = max(d_max, d[-1])\nprint((k - d_max))\n", "code_v1_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nd_max = 0\nfor i in range(n - 1):\n d = a[i + 1] - a[i]\n d_max = max(d_max, d)\nd = (k - a[-1]) + a[0]\nd_max = max(d_max, d)\nprint((k - d_max))\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["-d = [0] * n", "- d[i] = a[i + 1] - a[i]", "- d_max = max(d_max, d[i])", "-d[-1] = (k - a[-1]) + a[0]", "-d_max = max(d_max, d[-1])", "+ d = a[i + 1] - a[i]", "+ d_max = max(d_max, d)", "+d = (k - a[-1]) + a[0]", "+d_max = max(d_max, d)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3049341288, "measured_runtime_v1": 0.200526454, "runtime_lift": 1.5206678356, "key": ["s320196234", "s733866625"]} +{"user_id": "u301624971", "problem_id": "p03796", "language": "python", "submission_id_v0": "s825153134", "submission_id_v1": "s210395809", "cpu_time_v0": 230, "cpu_time_v1": 29, "memory_v0": 3972, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.39, "input": "from math import factorial\n\ndef myAnswer(N:int) ->int:\n\n ans =factorial(N)\n\n return ans % (10**9 + 7)\n\n\n\ndef modelAnswer():\n\n tmp=1\n\ndef main():\n\n N = int(input())\n\n print((myAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "def modelAnswer(N:int) -> int:\n\n ans = 1\n\n for i in range(1,N+1):\n\n ans = (ans*i) % (10**9 + 7)\n\n return ans \n\ndef main():\n\n N = int(input())\n\n print((modelAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 237, "code_v1_num_chars": 224, "code_v0_no_empty_lines": "from math import factorial\n\n\ndef myAnswer(N: int) -> int:\n ans = factorial(N)\n return ans % (10**9 + 7)\n\n\ndef modelAnswer():\n tmp = 1\n\n\ndef main():\n N = int(input())\n print((myAnswer(N)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def modelAnswer(N: int) -> int:\n ans = 1\n for i in range(1, N + 1):\n ans = (ans * i) % (10**9 + 7)\n return ans\n\n\ndef main():\n N = int(input())\n print((modelAnswer(N)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-from math import factorial", "-", "-", "-def myAnswer(N: int) -> int:", "- ans = factorial(N)", "- return ans % (10**9 + 7)", "-", "-", "-def modelAnswer():", "- tmp = 1", "+def modelAnswer(N: int) -> int:", "+ ans = 1", "+ for i in range(1, N + 1):", "+ ans = (ans * i) % (10**9 + 7)", "+ return ans", "- print((myAnswer(N)))", "+ print((modelAnswer(N)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7093277271, "measured_runtime_v1": 0.3704600389, "runtime_lift": 1.9147212994, "key": ["s825153134", "s210395809"]} +{"user_id": "u991567869", "problem_id": "p03854", "language": "python", "submission_id_v0": "s135519212", "submission_id_v1": "s896370774", "cpu_time_v0": 59, "cpu_time_v1": 42, "memory_v0": 9264, "memory_v1": 12828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.81, "input": "s = input()[::-1]\n\n\n\nwhile True:\n\n if len(s) == 0:\n\n break\n\n if s[:7] == \"remaerd\":\n\n s = s[7:]\n\n elif s[:6] == \"resare\":\n\n s = s[6:]\n\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n\n s = s[5:]\n\n else:\n\n print(\"NO\")\n\n exit()\n\n\n\nprint(\"YES\")", "target": "import re\n\n\n\ns = input()\n\n\n\nif re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "code_v0_loc": 16, "code_v1_loc": 8, "code_v0_num_chars": 294, "code_v1_num_chars": 123, "code_v0_no_empty_lines": "s = input()[::-1]\nwhile True:\n if len(s) == 0:\n break\n if s[:7] == \"remaerd\":\n s = s[7:]\n elif s[:6] == \"resare\":\n s = s[6:]\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n s = s[5:]\n else:\n print(\"NO\")\n exit()\nprint(\"YES\")\n", "code_v1_no_empty_lines": "import re\n\ns = input()\nif re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-s = input()[::-1]", "-while True:", "- if len(s) == 0:", "- break", "- if s[:7] == \"remaerd\":", "- s = s[7:]", "- elif s[:6] == \"resare\":", "- s = s[6:]", "- elif s[:5] == \"maerd\" or s[:5] == \"esare\":", "- s = s[5:]", "- else:", "- print(\"NO\")", "- exit()", "-print(\"YES\")", "+import re", "+", "+s = input()", "+if re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):", "+ print(\"YES\")", "+else:", "+ print(\"NO\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1782437842, "measured_runtime_v1": 0.0065195048, "runtime_lift": 27.340080233, "key": ["s135519212", "s896370774"]} +{"user_id": "u886655280", "problem_id": "p03416", "language": "python", "submission_id_v0": "s576934995", "submission_id_v1": "s588523024", "cpu_time_v0": 174, "cpu_time_v1": 53, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 69.54, "input": "A, B = list(map(int, input().split()))\n\ncount_target = 0\n\n\n\nfor i in range(A, B + 1):\n\n str_i = str(i)\n\n reversed_i = ''\n\n for n_th_i in reversed(list(range(len(str_i)))):\n\n reversed_i += str_i[n_th_i]\n\n\n\n if str_i == reversed_i:\n\n count_target += 1\n\n\n\nprint(count_target)", "target": "A, B = list(map(int, input().split()))\n\ncount_target = 0\n\n\n\nfor i in range(A, B+1):\n\n str_i = str(i)\n\n reversed_i = str_i[::-1]\n\n\n\n if str_i == reversed_i:\n\n count_target += 1\n\n\n\nprint(count_target)\n", "code_v0_loc": 13, "code_v1_loc": 11, "code_v0_num_chars": 286, "code_v1_num_chars": 209, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\ncount_target = 0\nfor i in range(A, B + 1):\n str_i = str(i)\n reversed_i = \"\"\n for n_th_i in reversed(list(range(len(str_i)))):\n reversed_i += str_i[n_th_i]\n if str_i == reversed_i:\n count_target += 1\nprint(count_target)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\ncount_target = 0\nfor i in range(A, B + 1):\n str_i = str(i)\n reversed_i = str_i[::-1]\n if str_i == reversed_i:\n count_target += 1\nprint(count_target)\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["- reversed_i = \"\"", "- for n_th_i in reversed(list(range(len(str_i)))):", "- reversed_i += str_i[n_th_i]", "+ reversed_i = str_i[::-1]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5743804177, "measured_runtime_v1": 0.3217681063, "runtime_lift": 1.7850756691, "key": ["s576934995", "s588523024"]} +{"user_id": "u721446434", "problem_id": "p02390", "language": "python", "submission_id_v0": "s466287089", "submission_id_v1": "s267092190", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 7676, "memory_v1": 7660, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "a = int(input())\n\nh = int(a / 3600)\n\nm = int((a - h * 3600) / 60)\n\ns = int(a - h * 3600 - m * 60)\n\nprint((\":\" .join(map(str, [h, m, s]))))", "target": "num = int(input())\n\nprint(int(num/3600), int((num%3600)/60), num%60, sep=\":\")\n", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 136, "code_v1_num_chars": 77, "code_v0_no_empty_lines": "a = int(input())\nh = int(a / 3600)\nm = int((a - h * 3600) / 60)\ns = int(a - h * 3600 - m * 60)\nprint((\":\".join(map(str, [h, m, s]))))\n", "code_v1_no_empty_lines": "num = int(input())\nprint(int(num / 3600), int((num % 3600) / 60), num % 60, sep=\":\")\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-a = int(input())", "-h = int(a / 3600)", "-m = int((a - h * 3600) / 60)", "-s = int(a - h * 3600 - m * 60)", "-print((\":\".join(map(str, [h, m, s]))))", "+num = int(input())", "+print(int(num / 3600), int((num % 3600) / 60), num % 60, sep=\":\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3158221226, "measured_runtime_v1": 0.2260731559, "runtime_lift": 1.3969908162, "key": ["s466287089", "s267092190"]} +{"user_id": "u141786930", "problem_id": "p02899", "language": "python", "submission_id_v0": "s528079976", "submission_id_v1": "s501403941", "cpu_time_v0": 88, "cpu_time_v1": 79, "memory_v0": 17832, "memory_v1": 17764, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.23, "input": "n = int(input())\n\na = [int(x) for x in input().split()]\n\n\n\nans = list(range(n))\n\n\n\nfor i in range(n):\n\n ans[a[i]-1] = i+1\n\n \n\nprint((' '.join(map(str,ans))))", "target": "def main():\n\n\n\n N = int(input())\n\n A = list(int(x) for x in input().split())\n\n ans = [0] * N\n\n\n\n for i, a in enumerate(A):\n\n ans[a-1] = i+1\n\n\n\n print((' '.join(map(str, ans))))\n\n \n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 9, "code_v1_loc": 13, "code_v0_num_chars": 161, "code_v1_num_chars": 242, "code_v0_no_empty_lines": "n = int(input())\na = [int(x) for x in input().split()]\nans = list(range(n))\nfor i in range(n):\n ans[a[i] - 1] = i + 1\nprint((\" \".join(map(str, ans))))\n", "code_v1_no_empty_lines": "def main():\n N = int(input())\n A = list(int(x) for x in input().split())\n ans = [0] * N\n for i, a in enumerate(A):\n ans[a - 1] = i + 1\n print((\" \".join(map(str, ans))))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 30.7692307692, "diff": ["-n = int(input())", "-a = [int(x) for x in input().split()]", "-ans = list(range(n))", "-for i in range(n):", "- ans[a[i] - 1] = i + 1", "-print((\" \".join(map(str, ans))))", "+def main():", "+ N = int(input())", "+ A = list(int(x) for x in input().split())", "+ ans = [0] * N", "+ for i, a in enumerate(A):", "+ ans[a - 1] = i + 1", "+ print((\" \".join(map(str, ans))))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3514640877, "measured_runtime_v1": 0.2437312019, "runtime_lift": 1.4420151581, "key": ["s528079976", "s501403941"]} +{"user_id": "u562935282", "problem_id": "p03416", "language": "python", "submission_id_v0": "s637446217", "submission_id_v1": "s864775628", "cpu_time_v0": 111, "cpu_time_v1": 46, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.56, "input": "a, b = list(map(int, input().split()))\n\ncnt = 0\n\nfor x in range(a, b + 1):\n\n s = str(x)\n\n l = len(s)\n\n flg = True\n\n for i in range(l // 2):\n\n if s[i] != s[l - 1 - i]:\n\n flg = False\n\n break\n\n if flg:\n\n cnt += 1\n\nprint(cnt)\n", "target": "a, b = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(a, b + 1):\n\n s = str(i)\n\n if s[0] == s[4] and s[1] == s[3]:\n\n cnt += 1\n\nprint(cnt)", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 267, "code_v1_num_chars": 153, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncnt = 0\nfor x in range(a, b + 1):\n s = str(x)\n l = len(s)\n flg = True\n for i in range(l // 2):\n if s[i] != s[l - 1 - i]:\n flg = False\n break\n if flg:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(a, b + 1):\n s = str(i)\n if s[0] == s[4] and s[1] == s[3]:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["-for x in range(a, b + 1):", "- s = str(x)", "- l = len(s)", "- flg = True", "- for i in range(l // 2):", "- if s[i] != s[l - 1 - i]:", "- flg = False", "- break", "- if flg:", "+for i in range(a, b + 1):", "+ s = str(i)", "+ if s[0] == s[4] and s[1] == s[3]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.334243765, "measured_runtime_v1": 0.2510879046, "runtime_lift": 1.3311822625, "key": ["s637446217", "s864775628"]} +{"user_id": "u803617136", "problem_id": "p02959", "language": "python", "submission_id_v0": "s395849964", "submission_id_v1": "s383743178", "cpu_time_v0": 279, "cpu_time_v1": 251, "memory_v0": 82148, "memory_v1": 18624, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.04, "input": "N = int(input())\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\na.reverse()\n\nb.reverse()\n\nans = 0\n\ncapacity = 0\n\nfor i in range(N):\n\n ans += min(b[i] + capacity, a[i])\n\n capacity = max(b[i] - max(a[i] - capacity, 0), 0)\n\nans += min(a[-1], capacity)\n\nprint(ans)", "target": "n = int(input())\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\n\n\na = a[::-1]\n\nb = b[::-1]\n\nans = 0\n\nfor i, bi in enumerate(b):\n\n ans += min(a[i], b[i])\n\n remain = max(0, b[i] - a[i])\n\n ans += min(a[i + 1], remain)\n\n a[i + 1] = max(0, a[i + 1] - remain)\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 13, "code_v0_num_chars": 294, "code_v1_num_chars": 305, "code_v0_no_empty_lines": "N = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\na.reverse()\nb.reverse()\nans = 0\ncapacity = 0\nfor i in range(N):\n ans += min(b[i] + capacity, a[i])\n capacity = max(b[i] - max(a[i] - capacity, 0), 0)\nans += min(a[-1], capacity)\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\na = a[::-1]\nb = b[::-1]\nans = 0\nfor i, bi in enumerate(b):\n ans += min(a[i], b[i])\n remain = max(0, b[i] - a[i])\n ans += min(a[i + 1], remain)\n a[i + 1] = max(0, a[i + 1] - remain)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["-N = int(input())", "+n = int(input())", "-a.reverse()", "-b.reverse()", "+a = a[::-1]", "+b = b[::-1]", "-capacity = 0", "-for i in range(N):", "- ans += min(b[i] + capacity, a[i])", "- capacity = max(b[i] - max(a[i] - capacity, 0), 0)", "-ans += min(a[-1], capacity)", "+for i, bi in enumerate(b):", "+ ans += min(a[i], b[i])", "+ remain = max(0, b[i] - a[i])", "+ ans += min(a[i + 1], remain)", "+ a[i + 1] = max(0, a[i + 1] - remain)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2854677742, "measured_runtime_v1": 0.2055514226, "runtime_lift": 1.3887900679, "key": ["s395849964", "s383743178"]} +{"user_id": "u537976628", "problem_id": "p04044", "language": "python", "submission_id_v0": "s532034645", "submission_id_v1": "s761755032", "cpu_time_v0": 23, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.09, "input": "N, L = list(map(int, input().split()))\n\nS = list(input() for i in range(N))\n\nstr = \"\"\n\nfor i in range(N-1):\n\n for j in range(N-1):\n\n if S[j+1] + S[j] <= S[j] + S[j+1]:\n\n S[j], S[j+1] = S[j+1], S[j]\n\nfor i in S:\n\n str += i\n\nprint(str)\n", "target": "N, L = list(map(int, input().split()))\n\nS = list(input() for i in range(N))\n\nS.sort()\n\nstr = \"\"\n\nfor i in S:\n\n str += i\n\nprint(str)\n", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 252, "code_v1_num_chars": 129, "code_v0_no_empty_lines": "N, L = list(map(int, input().split()))\nS = list(input() for i in range(N))\nstr = \"\"\nfor i in range(N - 1):\n for j in range(N - 1):\n if S[j + 1] + S[j] <= S[j] + S[j + 1]:\n S[j], S[j + 1] = S[j + 1], S[j]\nfor i in S:\n str += i\nprint(str)\n", "code_v1_no_empty_lines": "N, L = list(map(int, input().split()))\nS = list(input() for i in range(N))\nS.sort()\nstr = \"\"\nfor i in S:\n str += i\nprint(str)\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["+S.sort()", "-for i in range(N - 1):", "- for j in range(N - 1):", "- if S[j + 1] + S[j] <= S[j] + S[j + 1]:", "- S[j], S[j + 1] = S[j + 1], S[j]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3469125528, "measured_runtime_v1": 0.2633319349, "runtime_lift": 1.317396437, "key": ["s532034645", "s761755032"]} +{"user_id": "u617990214", "problem_id": "p02412", "language": "python", "submission_id_v0": "s470319892", "submission_id_v1": "s042746843", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 6348, "memory_v1": 6436, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "while True:\n\n\tk=list(map(int,input().split(\" \")))\n\n\tif k[0]==k[1]==0:\n\n\t\tbreak\n\n\tct=0\n\n\ta=0\n\n\tb=0\n\n\tc=0\t\n\n\tmax=k[0]\n\n\tsum=k[1]\n\n\ta=max+1\n\n\t\n\n\twhile True:\n\n\t\ta-=1\n\n\t\tb=a-1\n\n\t\tc=sum-a-b\n\n\t\tif not a>b>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile a>b>c:\n\n\t\t\tif a>b>c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1\n\n\t\t\t", "target": "while True:\n\n\tk=list(map(int,input().split(\" \")))\n\n\tif k[0]==k[1]==0:\n\n\t\tbreak\n\n\tct=0\n\n\ta=0\n\n\tb=0\n\n\tc=0\t\n\n\tmax=k[0]\n\n\tsum=k[1]\n\n\ta=max+1\n\n\twhile True:\n\n\t\ta-=1\n\n\t\tb=a-1\n\n\t\tc=sum-a-b\n\n\t\tif not a>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile b>c:\n\n\t\t\tif c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 287, "code_v1_num_chars": 271, "code_v0_no_empty_lines": "while True:\n k = list(map(int, input().split(\" \")))\n if k[0] == k[1] == 0:\n break\n ct = 0\n a = 0\n b = 0\n c = 0\n max = k[0]\n sum = k[1]\n a = max + 1\n while True:\n a -= 1\n b = a - 1\n c = sum - a - b\n if not a > b > c:\n print(ct)\n break\n while a > b > c:\n if a > b > c > 0:\n ct += 1\n b -= 1\n c += 1\n", "code_v1_no_empty_lines": "while True:\n k = list(map(int, input().split(\" \")))\n if k[0] == k[1] == 0:\n break\n ct = 0\n a = 0\n b = 0\n c = 0\n max = k[0]\n sum = k[1]\n a = max + 1\n while True:\n a -= 1\n b = a - 1\n c = sum - a - b\n if not a > c:\n print(ct)\n break\n while b > c:\n if c > 0:\n ct += 1\n b -= 1\n c += 1\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- if not a > b > c:", "+ if not a > c:", "- while a > b > c:", "- if a > b > c > 0:", "+ while b > c:", "+ if c > 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2289849162, "measured_runtime_v1": 0.1798006518, "runtime_lift": 1.273548866, "key": ["s470319892", "s042746843"]} +{"user_id": "u536034761", "problem_id": "p04044", "language": "python", "submission_id_v0": "s161300550", "submission_id_v1": "s718856768", "cpu_time_v0": 29, "cpu_time_v1": 24, "memory_v0": 9032, "memory_v1": 9016, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.24, "input": "n, l = list(map(int, input().split()))\n\nS = [input() for i in range(n)]\n\nS.sort()\n\nprint((\"\".join(S)))", "target": "n, l = list(map(int, input().split()))\n\nA = [input() for _ in range(n)]\n\nA.sort()\n\nprint((\"\".join(A)))\n", "code_v0_loc": 4, "code_v1_loc": 4, "code_v0_num_chars": 94, "code_v1_num_chars": 95, "code_v0_no_empty_lines": "n, l = list(map(int, input().split()))\nS = [input() for i in range(n)]\nS.sort()\nprint((\"\".join(S)))\n", "code_v1_no_empty_lines": "n, l = list(map(int, input().split()))\nA = [input() for _ in range(n)]\nA.sort()\nprint((\"\".join(A)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-S = [input() for i in range(n)]", "-S.sort()", "-print((\"\".join(S)))", "+A = [input() for _ in range(n)]", "+A.sort()", "+print((\"\".join(A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3658422339, "measured_runtime_v1": 0.2564776862, "runtime_lift": 1.4264096006, "key": ["s161300550", "s718856768"]} +{"user_id": "u996564551", "problem_id": "p03644", "language": "python", "submission_id_v0": "s317462383", "submission_id_v1": "s803396146", "cpu_time_v0": 32, "cpu_time_v1": 25, "memory_v0": 9180, "memory_v1": 9176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.88, "input": "N = int(input())\n\nif N < 2:\n\n print(N)\n\nelif 2<=N<4:\n\n print((2))\n\nelif 4<=N<8:\n\n print((4))\n\nelif 8<=N<16:\n\n print((8))\n\nelif 16<=N<32:\n\n print((16))\n\nelif 32<=N<64:\n\n print((32))\n\nelif 64<=N:\n\n print((64))", "target": "N = int(input())\n\nNum = [int(2**i) for i in range(7)]\n\nif N in Num:\n\n print(N)\n\nelse:\n\n Num.append(N)\n\n Num = sorted(Num)\n\n print((2 ** (Num.index(N) - 1)))", "code_v0_loc": 15, "code_v1_loc": 8, "code_v0_num_chars": 202, "code_v1_num_chars": 158, "code_v0_no_empty_lines": "N = int(input())\nif N < 2:\n print(N)\nelif 2 <= N < 4:\n print((2))\nelif 4 <= N < 8:\n print((4))\nelif 8 <= N < 16:\n print((8))\nelif 16 <= N < 32:\n print((16))\nelif 32 <= N < 64:\n print((32))\nelif 64 <= N:\n print((64))\n", "code_v1_no_empty_lines": "N = int(input())\nNum = [int(2**i) for i in range(7)]\nif N in Num:\n print(N)\nelse:\n Num.append(N)\n Num = sorted(Num)\n print((2 ** (Num.index(N) - 1)))\n", "code_same": false, "relative_loc_diff_percent": 46.6666666667, "diff": ["-if N < 2:", "+Num = [int(2**i) for i in range(7)]", "+if N in Num:", "-elif 2 <= N < 4:", "- print((2))", "-elif 4 <= N < 8:", "- print((4))", "-elif 8 <= N < 16:", "- print((8))", "-elif 16 <= N < 32:", "- print((16))", "-elif 32 <= N < 64:", "- print((32))", "-elif 64 <= N:", "- print((64))", "+else:", "+ Num.append(N)", "+ Num = sorted(Num)", "+ print((2 ** (Num.index(N) - 1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3866926632, "measured_runtime_v1": 0.2723876703, "runtime_lift": 1.4196408479, "key": ["s317462383", "s803396146"]} +{"user_id": "u815878613", "problem_id": "p03037", "language": "python", "submission_id_v0": "s043802358", "submission_id_v1": "s120994164", "cpu_time_v0": 220, "cpu_time_v1": 195, "memory_v0": 27220, "memory_v1": 9100, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.36, "input": "N, M = list(map(int, input().split()))\n\nLR = [list(map(int, input().split())) for _ in range(M)]\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor l, r in LR:\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n", "target": "N, M = list(map(int, input().split()))\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor _ in range(M):\n\n l, r = list(map(int, input().split()))\n\n\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n", "code_v0_loc": 15, "code_v1_loc": 16, "code_v0_num_chars": 266, "code_v1_num_chars": 251, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nLR = [list(map(int, input().split())) for _ in range(M)]\nleft = 1\nright = N\nfor l, r in LR:\n if left < l:\n left = l\n if right > r:\n right = r\nans = right - left\nprint((ans + 1 if ans >= 0 else 0))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nleft = 1\nright = N\nfor _ in range(M):\n l, r = list(map(int, input().split()))\n if left < l:\n left = l\n if right > r:\n right = r\nans = right - left\nprint((ans + 1 if ans >= 0 else 0))\n", "code_same": false, "relative_loc_diff_percent": 6.25, "diff": ["-LR = [list(map(int, input().split())) for _ in range(M)]", "-for l, r in LR:", "+for _ in range(M):", "+ l, r = list(map(int, input().split()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2458969798, "measured_runtime_v1": 0.1910107524, "runtime_lift": 1.2873462706, "key": ["s043802358", "s120994164"]} +{"user_id": "u282228874", "problem_id": "p03293", "language": "python", "submission_id_v0": "s664706993", "submission_id_v1": "s616247709", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "s = input()\n\nt = input()\n\nfor i in range(len(s)):\n\n if s[i:]+s[:i]==t:\n\n print('Yes')\n\n exit()\n\nprint('No')", "target": "s = input()\n\nt = input()\n\n\n\nfor i in range(len(s)):\n\n s = s[1:] + s[0]\n\n if s == t:\n\n print(\"Yes\")\n\n exit()\n\nprint(\"No\")", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 144, "code_v1_num_chars": 140, "code_v0_no_empty_lines": "s = input()\nt = input()\nfor i in range(len(s)):\n if s[i:] + s[:i] == t:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_v1_no_empty_lines": "s = input()\nt = input()\nfor i in range(len(s)):\n s = s[1:] + s[0]\n if s == t:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["- if s[i:] + s[:i] == t:", "+ s = s[1:] + s[0]", "+ if s == t:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1894659722, "measured_runtime_v1": 0.0060859642, "runtime_lift": 31.1316277188, "key": ["s664706993", "s616247709"]} +{"user_id": "u285121325", "problem_id": "p03060", "language": "python", "submission_id_v0": "s176163369", "submission_id_v1": "s307096938", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "n = int(input())\n\nv = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\nresult = 0\n\nfor i in range(n):\n\n if v[i] > c[i]:\n\n result += v[i] - c[i]\n\nprint(result)", "target": "N = int(input())\n\nV = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\nprint((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))\n", "code_v0_loc": 8, "code_v1_loc": 4, "code_v0_num_chars": 183, "code_v1_num_chars": 151, "code_v0_no_empty_lines": "n = int(input())\nv = list(map(int, input().split()))\nc = list(map(int, input().split()))\nresult = 0\nfor i in range(n):\n if v[i] > c[i]:\n result += v[i] - c[i]\nprint(result)\n", "code_v1_no_empty_lines": "N = int(input())\nV = list(map(int, input().split()))\nC = list(map(int, input().split()))\nprint((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-n = int(input())", "-v = list(map(int, input().split()))", "-c = list(map(int, input().split()))", "-result = 0", "-for i in range(n):", "- if v[i] > c[i]:", "- result += v[i] - c[i]", "-print(result)", "+N = int(input())", "+V = list(map(int, input().split()))", "+C = list(map(int, input().split()))", "+print((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1697382522, "measured_runtime_v1": 0.0057968805, "runtime_lift": 29.2809645377, "key": ["s176163369", "s307096938"]} +{"user_id": "u879870653", "problem_id": "p03416", "language": "python", "submission_id_v0": "s279175230", "submission_id_v1": "s789865740", "cpu_time_v0": 111, "cpu_time_v1": 45, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.46, "input": "a,b = list(map(int,input().split()))\n\nanswer = 0\n\nfor i in range(a,b+1) :\n\n j = str(i)\n\n p1 = j[4]\n\n p2 = j[3]\n\n p3 = j[2]\n\n p4 = j[1]\n\n p5 = j[0]\n\n k = int(p1+p2+p3+p4+p5)\n\n if i == k :\n\n answer += 1\n\nprint(answer)\n\n\n", "target": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1) :\n\n l = str(i)\n\n if l[0] == l[4] and l[1] == l[3] :\n\n ans += 1\n\nprint(ans)\n", "code_v0_loc": 14, "code_v1_loc": 7, "code_v0_num_chars": 243, "code_v1_num_chars": 151, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nanswer = 0\nfor i in range(a, b + 1):\n j = str(i)\n p1 = j[4]\n p2 = j[3]\n p3 = j[2]\n p4 = j[1]\n p5 = j[0]\n k = int(p1 + p2 + p3 + p4 + p5)\n if i == k:\n answer += 1\nprint(answer)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n l = str(i)\n if l[0] == l[4] and l[1] == l[3]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-a, b = list(map(int, input().split()))", "-answer = 0", "-for i in range(a, b + 1):", "- j = str(i)", "- p1 = j[4]", "- p2 = j[3]", "- p3 = j[2]", "- p4 = j[1]", "- p5 = j[0]", "- k = int(p1 + p2 + p3 + p4 + p5)", "- if i == k:", "- answer += 1", "-print(answer)", "+A, B = list(map(int, input().split()))", "+ans = 0", "+for i in range(A, B + 1):", "+ l = str(i)", "+ if l[0] == l[4] and l[1] == l[3]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5475045266, "measured_runtime_v1": 0.378210106, "runtime_lift": 1.4476200343, "key": ["s279175230", "s789865740"]} +{"user_id": "u936985471", "problem_id": "p03721", "language": "python", "submission_id_v0": "s865752287", "submission_id_v1": "s921873406", "cpu_time_v0": 343, "cpu_time_v1": 288, "memory_v0": 15072, "memory_v1": 29824, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.03, "input": "N,K=list(map(int,input().split()))\n\ndic={}\n\nfor i in range(N):\n\n a,b=list(map(int,input().split()))\n\n if a in dic:\n\n dic[a]+=b\n\n else:\n\n dic[a]=b\n\n \n\ndic=sorted(list(dic.items()),key=lambda x:x[0])\n\nfor d in range(len(dic)):\n\n amount=dic[d][1]\n\n if amount>=K:\n\n print((dic[d][0]))\n\n exit(0)\n\n else:\n\n K-=amount\n\n ", "target": "import sys\n\nreadline = sys.stdin.readline\n\n\n\nN,K = list(map(int,readline().split()))\n\n\n\nAB = [list(map(int,readline().split())) for i in range(N)]\n\n\n\nAB = sorted(AB, key = lambda x:x[0])\n\namount = 0\n\nfor a,b in AB:\n\n amount += b\n\n if amount >= K:\n\n print(a)\n\n break\n", "code_v0_loc": 18, "code_v1_loc": 14, "code_v0_num_chars": 318, "code_v1_num_chars": 268, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\ndic = {}\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if a in dic:\n dic[a] += b\n else:\n dic[a] = b\ndic = sorted(list(dic.items()), key=lambda x: x[0])\nfor d in range(len(dic)):\n amount = dic[d][1]\n if amount >= K:\n print((dic[d][0]))\n exit(0)\n else:\n K -= amount\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nN, K = list(map(int, readline().split()))\nAB = [list(map(int, readline().split())) for i in range(N)]\nAB = sorted(AB, key=lambda x: x[0])\namount = 0\nfor a, b in AB:\n amount += b\n if amount >= K:\n print(a)\n break\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-N, K = list(map(int, input().split()))", "-dic = {}", "-for i in range(N):", "- a, b = list(map(int, input().split()))", "- if a in dic:", "- dic[a] += b", "- else:", "- dic[a] = b", "-dic = sorted(list(dic.items()), key=lambda x: x[0])", "-for d in range(len(dic)):", "- amount = dic[d][1]", "+import sys", "+", "+readline = sys.stdin.readline", "+N, K = list(map(int, readline().split()))", "+AB = [list(map(int, readline().split())) for i in range(N)]", "+AB = sorted(AB, key=lambda x: x[0])", "+amount = 0", "+for a, b in AB:", "+ amount += b", "- print((dic[d][0]))", "- exit(0)", "- else:", "- K -= amount", "+ print(a)", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3684674098, "measured_runtime_v1": 0.2810288085, "runtime_lift": 1.3111375012, "key": ["s865752287", "s921873406"]} +{"user_id": "u821588465", "problem_id": "p03000", "language": "python", "submission_id_v0": "s259788442", "submission_id_v1": "s163625054", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9172, "memory_v1": 8984, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "from itertools import accumulate\n\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\n\nL = list(tuple(map(int, input().split())))\n\n\n\nacc = sorted(list(accumulate(L)) + [0])\n\n\n\nn = bisect_right(acc,X)\n\nprint(n)\n\n\n", "target": "N,X = list(map(int,input().split()))\n\nL = list(map(int,input().split()))\n\nList = [0]*(N+1)\n\nfor i in range(1,N+1):\n\n List[i] = List[i-1] + L[i-1]\n\nA = [i for i in List if i <=X]\n\nprint((len(A)))", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 215, "code_v1_num_chars": 189, "code_v0_no_empty_lines": "from itertools import accumulate\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\nL = list(tuple(map(int, input().split())))\nacc = sorted(list(accumulate(L)) + [0])\nn = bisect_right(acc, X)\nprint(n)\n", "code_v1_no_empty_lines": "N, X = list(map(int, input().split()))\nL = list(map(int, input().split()))\nList = [0] * (N + 1)\nfor i in range(1, N + 1):\n List[i] = List[i - 1] + L[i - 1]\nA = [i for i in List if i <= X]\nprint((len(A)))\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-from itertools import accumulate", "-from bisect import *", "-", "-L = list(tuple(map(int, input().split())))", "-acc = sorted(list(accumulate(L)) + [0])", "-n = bisect_right(acc, X)", "-print(n)", "+L = list(map(int, input().split()))", "+List = [0] * (N + 1)", "+for i in range(1, N + 1):", "+ List[i] = List[i - 1] + L[i - 1]", "+A = [i for i in List if i <= X]", "+print((len(A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2199657279, "measured_runtime_v1": 0.1756561113, "runtime_lift": 1.2522520635, "key": ["s259788442", "s163625054"]} +{"user_id": "u460245024", "problem_id": "p03416", "language": "python", "submission_id_v0": "s770002751", "submission_id_v1": "s323286862", "cpu_time_v0": 51, "cpu_time_v1": 32, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.25, "input": "A, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n n_s = str(n)\n\n n_s_rvs = n_s[::-1]\n\n if n_s == n_s_rvs:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "target": "A, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n if n//10000 == n%10 and (n//1000)%10 == (n//10)%10:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "code_v0_loc": 10, "code_v1_loc": 8, "code_v0_num_chars": 168, "code_v1_num_chars": 158, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor n in range(A, B + 1):\n n_s = str(n)\n n_s_rvs = n_s[::-1]\n if n_s == n_s_rvs:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor n in range(A, B + 1):\n if n // 10000 == n % 10 and (n // 1000) % 10 == (n // 10) % 10:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["- n_s = str(n)", "- n_s_rvs = n_s[::-1]", "- if n_s == n_s_rvs:", "+ if n // 10000 == n % 10 and (n // 1000) % 10 == (n // 10) % 10:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3429904201, "measured_runtime_v1": 0.2179555298, "runtime_lift": 1.5736715671, "key": ["s770002751", "s323286862"]} +{"user_id": "u597374218", "problem_id": "p03796", "language": "python", "submission_id_v0": "s636787028", "submission_id_v1": "s575140392", "cpu_time_v0": 154, "cpu_time_v1": 44, "memory_v0": 10168, "memory_v1": 9028, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 71.43, "input": "import math\n\nN=int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "target": "N=int(input())\n\npower=1\n\nfor i in range(1,N+1):\n\n power*=i\n\n power%=10**9+7\n\nprint(power)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 63, "code_v1_num_chars": 95, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "N = int(input())\npower = 1\nfor i in range(1, N + 1):\n power *= i\n power %= 10**9 + 7\nprint(power)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-print((math.factorial(N) % (10**9 + 7)))", "+power = 1", "+for i in range(1, N + 1):", "+ power *= i", "+ power %= 10**9 + 7", "+print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6653705416, "measured_runtime_v1": 0.3042658694, "runtime_lift": 2.1868063707, "key": ["s636787028", "s575140392"]} +{"user_id": "u970197315", "problem_id": "p03371", "language": "python", "submission_id_v0": "s588181559", "submission_id_v1": "s154731902", "cpu_time_v0": 63, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 73.02, "input": "# ABC95 C -Half and Half\n\na,b,c,x,y = list(map(float,input().split()))\n\nans = 0\n\nif a+b > 2*c:\n\n while x != 0.0 and y != 0.0:\n\n ans += 2*c\n\n x -= 1.0\n\n y -= 1.0\n\n if y == 0.0:\n\n while x != 0.0:\n\n if a > 2*c:\n\n ans += 2*c\n\n x -= 1.0\n\n else:\n\n ans += a\n\n x -= 1.0\n\n if x == 0.0:\n\n while y != 0.0:\n\n if b > 2*c:\n\n ans += 2*c\n\n y -= 1.0\n\n else:\n\n ans += b\n\n y -= 1.0\n\nelse:\n\n ans += a*x + b*y\n\nprint((int(ans)))\n\n\n\n ", "target": "a,b,c,x,y=list(map(int,input().split()))\n\nans=0\n\nans1=0\n\n\n\ne=max(x,y)\n\nans1=e*(2*c)\n\nif 2*c 2 * c:\n while x != 0.0 and y != 0.0:\n ans += 2 * c\n x -= 1.0\n y -= 1.0\n if y == 0.0:\n while x != 0.0:\n if a > 2 * c:\n ans += 2 * c\n x -= 1.0\n else:\n ans += a\n x -= 1.0\n if x == 0.0:\n while y != 0.0:\n if b > 2 * c:\n ans += 2 * c\n y -= 1.0\n else:\n ans += b\n y -= 1.0\nelse:\n ans += a * x + b * y\nprint((int(ans)))\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = 0\nans1 = 0\ne = max(x, y)\nans1 = e * (2 * c)\nif 2 * c < a + b:\n d = min(x, y)\n ans += c * (2 * d)\n x -= d\n y -= d\nelse:\n ans = a * x + b * y\n x -= x\n y -= y\nans += x * a\nans += y * b\nprint((min(ans, ans1)))\n", "code_same": false, "relative_loc_diff_percent": 37.9310344828, "diff": ["-# ABC95 C -Half and Half", "-a, b, c, x, y = list(map(float, input().split()))", "+a, b, c, x, y = list(map(int, input().split()))", "-if a + b > 2 * c:", "- while x != 0.0 and y != 0.0:", "- ans += 2 * c", "- x -= 1.0", "- y -= 1.0", "- if y == 0.0:", "- while x != 0.0:", "- if a > 2 * c:", "- ans += 2 * c", "- x -= 1.0", "- else:", "- ans += a", "- x -= 1.0", "- if x == 0.0:", "- while y != 0.0:", "- if b > 2 * c:", "- ans += 2 * c", "- y -= 1.0", "- else:", "- ans += b", "- y -= 1.0", "+ans1 = 0", "+e = max(x, y)", "+ans1 = e * (2 * c)", "+if 2 * c < a + b:", "+ d = min(x, y)", "+ ans += c * (2 * d)", "+ x -= d", "+ y -= d", "- ans += a * x + b * y", "-print((int(ans)))", "+ ans = a * x + b * y", "+ x -= x", "+ y -= y", "+ans += x * a", "+ans += y * b", "+print((min(ans, ans1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3221288462, "measured_runtime_v1": 0.2473681471, "runtime_lift": 1.3022244371, "key": ["s588181559", "s154731902"]} +{"user_id": "u632413369", "problem_id": "p02595", "language": "python", "submission_id_v0": "s512106161", "submission_id_v1": "s251902862", "cpu_time_v0": 491, "cpu_time_v1": 390, "memory_v0": 9080, "memory_v1": 9188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.57, "input": "N, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x ** 2 + y ** 2 <= D ** 2:\n\n cnt += 1\n\n \n\nprint(cnt)", "target": "N, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x * x + y * y <= D * D:\n\n cnt += 1\n\n \n\nprint(cnt)", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 174, "code_v1_num_chars": 171, "code_v0_no_empty_lines": "N, D = list(map(int, input().split()))\ncnt = 0\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if x**2 + y**2 <= D**2:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "N, D = list(map(int, input().split()))\ncnt = 0\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if x * x + y * y <= D * D:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if x**2 + y**2 <= D**2:", "+ if x * x + y * y <= D * D:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1756704731, "measured_runtime_v1": 0.0073727348, "runtime_lift": 23.8270435573, "key": ["s512106161", "s251902862"]} +{"user_id": "u209275335", "problem_id": "p02693", "language": "python", "submission_id_v0": "s337733409", "submission_id_v1": "s217218479", "cpu_time_v0": 61, "cpu_time_v1": 22, "memory_v0": 61660, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 63.93, "input": "S = int(input())\n\na = 0\n\ncount = 0\n\nn,m = list(map(int,input().split()))\n\nwhile count == 0:\n\n a += S\n\n if n <= a and m >= a:\n\n count = 1\n\n if a >= 1000:\n\n break\n\nif count == 0:\n\n print(\"NG\")\n\nelse:\n\n print(\"OK\")", "target": "k = int(input())\n\nn = 0\n\na,b = list(map(int,input().split()))\n\nwhile True:\n\n n += k\n\n if n >= a and n <= b:\n\n print(\"OK\")\n\n break\n\n if n > b:\n\n print(\"NG\")\n\n break", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 234, "code_v1_num_chars": 194, "code_v0_no_empty_lines": "S = int(input())\na = 0\ncount = 0\nn, m = list(map(int, input().split()))\nwhile count == 0:\n a += S\n if n <= a and m >= a:\n count = 1\n if a >= 1000:\n break\nif count == 0:\n print(\"NG\")\nelse:\n print(\"OK\")\n", "code_v1_no_empty_lines": "k = int(input())\nn = 0\na, b = list(map(int, input().split()))\nwhile True:\n n += k\n if n >= a and n <= b:\n print(\"OK\")\n break\n if n > b:\n print(\"NG\")\n break\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-S = int(input())", "-a = 0", "-count = 0", "-n, m = list(map(int, input().split()))", "-while count == 0:", "- a += S", "- if n <= a and m >= a:", "- count = 1", "- if a >= 1000:", "+k = int(input())", "+n = 0", "+a, b = list(map(int, input().split()))", "+while True:", "+ n += k", "+ if n >= a and n <= b:", "+ print(\"OK\")", "-if count == 0:", "- print(\"NG\")", "-else:", "- print(\"OK\")", "+ if n > b:", "+ print(\"NG\")", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2075882792, "measured_runtime_v1": 0.0060749435, "runtime_lift": 34.1712276754, "key": ["s337733409", "s217218479"]} +{"user_id": "u754022296", "problem_id": "p03796", "language": "python", "submission_id_v0": "s893557911", "submission_id_v1": "s686331748", "cpu_time_v0": 230, "cpu_time_v1": 48, "memory_v0": 3984, "memory_v1": 9008, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 79.13, "input": "from math import factorial as fc\n\na = int(input())\n\nprint((fc(a)%(10**9+7)))", "target": "n = int(input())\n\nm = 10**9+7\n\nans = 1\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= m\n\nprint(ans)", "code_v0_loc": 3, "code_v1_loc": 7, "code_v0_num_chars": 74, "code_v1_num_chars": 99, "code_v0_no_empty_lines": "from math import factorial as fc\n\na = int(input())\nprint((fc(a) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nm = 10**9 + 7\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= m\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-from math import factorial as fc", "-", "-a = int(input())", "-print((fc(a) % (10**9 + 7)))", "+n = int(input())", "+m = 10**9 + 7", "+ans = 1", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= m", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4826196883, "measured_runtime_v1": 0.2178869207, "runtime_lift": 2.2150007294, "key": ["s893557911", "s686331748"]} +{"user_id": "u234052535", "problem_id": "p00003", "language": "python", "submission_id_v0": "s822995507", "submission_id_v1": "s034189952", "cpu_time_v0": 50, "cpu_time_v1": 30, "memory_v0": 7724, "memory_v1": 7764, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.0, "input": "for i in range(0, int(input())):\n\n sidelen = [int(j) for j in input().split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")", "target": "import sys\n\nfor i in sys.stdin:\n\n try:\n\n sidelen = [int(j) for j in i.split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n except:\n\n continue", "code_v0_loc": 7, "code_v1_loc": 11, "code_v0_num_chars": 227, "code_v1_num_chars": 285, "code_v0_no_empty_lines": "for i in range(0, int(input())):\n sidelen = [int(j) for j in input().split(\" \")]\n sidelen.sort(reverse=True)\n if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nfor i in sys.stdin:\n try:\n sidelen = [int(j) for j in i.split(\" \")]\n sidelen.sort(reverse=True)\n if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:\n print(\"YES\")\n else:\n print(\"NO\")\n except:\n continue\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-for i in range(0, int(input())):", "- sidelen = [int(j) for j in input().split(\" \")]", "- sidelen.sort(reverse=True)", "- if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:", "- print(\"YES\")", "- else:", "- print(\"NO\")", "+import sys", "+", "+for i in sys.stdin:", "+ try:", "+ sidelen = [int(j) for j in i.split(\" \")]", "+ sidelen.sort(reverse=True)", "+ if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:", "+ print(\"YES\")", "+ else:", "+ print(\"NO\")", "+ except:", "+ continue"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3279889946, "measured_runtime_v1": 0.2582271154, "runtime_lift": 1.2701570634, "key": ["s822995507", "s034189952"]} +{"user_id": "u341543478", "problem_id": "p03424", "language": "python", "submission_id_v0": "s841365629", "submission_id_v1": "s932855105", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9156, "memory_v1": 8908, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "n = int(input())\n\ns = input().split()\n\ns = set(s)\n\nprint(('Four' if len(s) == 4 else 'Three'))", "target": "n = int(input())\n\ns = input().split()\n\nprint(('Four' if len(set(s)) == 4 else 'Three'))", "code_v0_loc": 4, "code_v1_loc": 3, "code_v0_num_chars": 92, "code_v1_num_chars": 85, "code_v0_no_empty_lines": "n = int(input())\ns = input().split()\ns = set(s)\nprint((\"Four\" if len(s) == 4 else \"Three\"))\n", "code_v1_no_empty_lines": "n = int(input())\ns = input().split()\nprint((\"Four\" if len(set(s)) == 4 else \"Three\"))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-s = set(s)", "-print((\"Four\" if len(s) == 4 else \"Three\"))", "+print((\"Four\" if len(set(s)) == 4 else \"Three\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2928216946, "measured_runtime_v1": 0.09356422, "runtime_lift": 3.1296332587, "key": ["s841365629", "s932855105"]} +{"user_id": "u990900604", "problem_id": "p02390", "language": "python", "submission_id_v0": "s359089221", "submission_id_v1": "s084524983", "cpu_time_v0": 50, "cpu_time_v1": 10, "memory_v0": 9852, "memory_v1": 4632, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.0, "input": "import sys\n\n\n\nif __name__ == '__main__':\n\n import doctest\n\n doctest.testmod()\n\n S = int(sys.stdin.read())\n\n h = S / 3600\n\n m = (S % 3600) / 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n", "target": "#!/usr/bin/env python\n\n#-*- coding: utf-8 -*-\n\n\n\n# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D\n\n\n\nif __name__ == '__main__':\n\n S = int(input())\n\n h = S / 3600\n\n m = (S % 3600) / 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n", "code_v0_loc": 10, "code_v1_loc": 11, "code_v0_num_chars": 208, "code_v1_num_chars": 266, "code_v0_no_empty_lines": "import sys\n\nif __name__ == \"__main__\":\n import doctest\n\n doctest.testmod()\n S = int(sys.stdin.read())\n h = S / 3600\n m = (S % 3600) / 60\n s = S % 60\n print(\"%d:%d:%d\" % (h, m, s))\n", "code_v1_no_empty_lines": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D\nif __name__ == \"__main__\":\n S = int(input())\n h = S / 3600\n m = (S % 3600) / 60\n s = S % 60\n print(\"%d:%d:%d\" % (h, m, s))\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-import sys", "-", "+#!/usr/bin/env python", "+# -*- coding: utf-8 -*-", "+# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D", "- import doctest", "-", "- doctest.testmod()", "- S = int(sys.stdin.read())", "+ S = int(input())"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7406475422, "measured_runtime_v1": 0.2172099149, "runtime_lift": 3.4098238217, "key": ["s359089221", "s084524983"]} +{"user_id": "u780698286", "problem_id": "p02880", "language": "python", "submission_id_v0": "s530137772", "submission_id_v1": "s289678775", "cpu_time_v0": 31, "cpu_time_v1": 26, "memory_v0": 9160, "memory_v1": 9096, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.13, "input": "n = int(input())\n\ns = []\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n s.append(i*j)\n\nif n in s:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "target": "import sys\n\n\n\nn = int(input())\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n if i*j == n:\n\n print(\"Yes\")\n\n sys.exit()\n\nprint(\"No\")\n", "code_v0_loc": 9, "code_v1_loc": 9, "code_v0_num_chars": 143, "code_v1_num_chars": 150, "code_v0_no_empty_lines": "n = int(input())\ns = []\nfor i in range(1, 10):\n for j in range(1, 10):\n s.append(i * j)\nif n in s:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "import sys\n\nn = int(input())\nfor i in range(1, 10):\n for j in range(1, 10):\n if i * j == n:\n print(\"Yes\")\n sys.exit()\nprint(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+import sys", "+", "-s = []", "- s.append(i * j)", "-if n in s:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+ if i * j == n:", "+ print(\"Yes\")", "+ sys.exit()", "+print(\"No\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2618995297, "measured_runtime_v1": 0.0062340605, "runtime_lift": 42.0110661723, "key": ["s530137772", "s289678775"]} +{"user_id": "u814986259", "problem_id": "p03796", "language": "python", "submission_id_v0": "s294020052", "submission_id_v1": "s579876547", "cpu_time_v0": 229, "cpu_time_v1": 40, "memory_v0": 3968, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.53, "input": "import math\n\nN=int(input())\n\nans=math.factorial(N)\n\nprint((ans%(10**9 +7)))", "target": "mod=10**9+7\n\nN=int(input())\n\nans=1\n\nfor i in range(1,N+1):\n\n ans*=i\n\n ans%=mod\n\nprint(ans)", "code_v0_loc": 4, "code_v1_loc": 7, "code_v0_num_chars": 73, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = math.factorial(N)\nprint((ans % (10**9 + 7)))\n", "code_v1_no_empty_lines": "mod = 10**9 + 7\nN = int(input())\nans = 1\nfor i in range(1, N + 1):\n ans *= i\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-import math", "-", "+mod = 10**9 + 7", "-ans = math.factorial(N)", "-print((ans % (10**9 + 7)))", "+ans = 1", "+for i in range(1, N + 1):", "+ ans *= i", "+ ans %= mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3063099709, "measured_runtime_v1": 0.2071282012, "runtime_lift": 1.4788424222, "key": ["s294020052", "s579876547"]} +{"user_id": "u724687935", "problem_id": "p02622", "language": "python", "submission_id_v0": "s346270661", "submission_id_v1": "s299240564", "cpu_time_v0": 67, "cpu_time_v1": 60, "memory_v0": 9408, "memory_v1": 9320, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.45, "input": "S = input()\n\nT = input()\n\nN = len(S)\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)\n", "target": "S = input()\n\nT = input()\n\ncnt = 0\n\nfor i in range(len(S)):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 107, "code_v1_num_chars": 99, "code_v0_no_empty_lines": "S = input()\nT = input()\nN = len(S)\ncnt = 0\nfor i in range(N):\n cnt += S[i] != T[i]\nprint(cnt)\n", "code_v1_no_empty_lines": "S = input()\nT = input()\ncnt = 0\nfor i in range(len(S)):\n cnt += S[i] != T[i]\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-N = len(S)", "-for i in range(N):", "+for i in range(len(S)):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3924936354, "measured_runtime_v1": 0.2147260756, "runtime_lift": 1.8278806345, "key": ["s346270661", "s299240564"]} +{"user_id": "u629538480", "problem_id": "p02688", "language": "python", "submission_id_v0": "s093466568", "submission_id_v1": "s996398988", "cpu_time_v0": 24, "cpu_time_v1": 21, "memory_v0": 9192, "memory_v1": 8948, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.5, "input": "N,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(input())\n\n b=input().split(' ')\n\n for j in range(count):\n\n if int(b[j]) in a:\n\n a.remove(int(b[j]))\n\nprint((len(a)))", "target": "N,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(input())\n\n b=[int(x.strip()) for x in input().split(' ')]\n\n for j in range(count):\n\n if b[j] in a:\n\n a.remove(b[j])\n\nprint((len(a)))", "code_v0_loc": 9, "code_v1_loc": 9, "code_v0_num_chars": 214, "code_v1_num_chars": 230, "code_v0_no_empty_lines": "N, K = list(map(int, input().split(\" \")))\na = list(range(1, N + 1))\nfor i in range(K):\n count = int(input())\n b = input().split(\" \")\n for j in range(count):\n if int(b[j]) in a:\n a.remove(int(b[j]))\nprint((len(a)))\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split(\" \")))\na = list(range(1, N + 1))\nfor i in range(K):\n count = int(input())\n b = [int(x.strip()) for x in input().split(\" \")]\n for j in range(count):\n if b[j] in a:\n a.remove(b[j])\nprint((len(a)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- b = input().split(\" \")", "+ b = [int(x.strip()) for x in input().split(\" \")]", "- if int(b[j]) in a:", "- a.remove(int(b[j]))", "+ if b[j] in a:", "+ a.remove(b[j])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2616522854, "measured_runtime_v1": 0.1381282375, "runtime_lift": 1.8942707889, "key": ["s093466568", "s996398988"]} +{"user_id": "u780342333", "problem_id": "p02416", "language": "python", "submission_id_v0": "s248122741", "submission_id_v1": "s360997133", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7732, "memory_v1": 5624, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "res = []\n\nwhile True:\n\n s = input()\n\n if s == '0':\n\n break\n\n\n\n res.append(sum([int(x) for x in s]))\n\n\n\nfor e in res:\n\n print(e)", "target": "def sum_of_numbers(n):\n\n '''\n\n (* int -> int *)\n\n '''\n\n res = [int(n) for n in list(str(n))]\n\n \n\n return sum(res)\n\n\n\nif __name__ == \"__main__\":\n\n while True:\n\n n = input()\n\n if n == '0':\n\n break\n\n print((sum_of_numbers(n)))\n", "code_v0_loc": 10, "code_v1_loc": 14, "code_v0_num_chars": 146, "code_v1_num_chars": 275, "code_v0_no_empty_lines": "res = []\nwhile True:\n s = input()\n if s == \"0\":\n break\n res.append(sum([int(x) for x in s]))\nfor e in res:\n print(e)\n", "code_v1_no_empty_lines": "def sum_of_numbers(n):\n \"\"\"\n (* int -> int *)\n \"\"\"\n res = [int(n) for n in list(str(n))]\n return sum(res)\n\n\nif __name__ == \"__main__\":\n while True:\n n = input()\n if n == \"0\":\n break\n print((sum_of_numbers(n)))\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-res = []", "-while True:", "- s = input()", "- if s == \"0\":", "- break", "- res.append(sum([int(x) for x in s]))", "-for e in res:", "- print(e)", "+def sum_of_numbers(n):", "+ \"\"\"", "+ (* int -> int *)", "+ \"\"\"", "+ res = [int(n) for n in list(str(n))]", "+ return sum(res)", "+", "+", "+if __name__ == \"__main__\":", "+ while True:", "+ n = input()", "+ if n == \"0\":", "+ break", "+ print((sum_of_numbers(n)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2668570542, "measured_runtime_v1": 0.0949980106, "runtime_lift": 2.8090804473, "key": ["s248122741", "s360997133"]} +{"user_id": "u729133443", "problem_id": "p03086", "language": "python", "submission_id_v0": "s780520490", "submission_id_v1": "s016683067", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "import re;print((max(list(map(len,re.split('[^ACGT]',input()))))))", "target": "p=m=0\n\nfor c in input():p=-~p*(c in'ATGC');m=max(m,p)\n\nprint(m)", "code_v0_loc": 1, "code_v1_loc": 3, "code_v0_num_chars": 58, "code_v1_num_chars": 63, "code_v0_no_empty_lines": "import re\n\nprint((max(list(map(len, re.split(\"[^ACGT]\", input()))))))\n", "code_v1_no_empty_lines": "p = m = 0\nfor c in input():\n p = -~p * (c in \"ATGC\")\n m = max(m, p)\nprint(m)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import re", "-", "-print((max(list(map(len, re.split(\"[^ACGT]\", input()))))))", "+p = m = 0", "+for c in input():", "+ p = -~p * (c in \"ATGC\")", "+ m = max(m, p)", "+print(m)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2963340635, "measured_runtime_v1": 0.1579363909, "runtime_lift": 1.8762874209, "key": ["s780520490", "s016683067"]} +{"user_id": "u513081876", "problem_id": "p03325", "language": "python", "submission_id_v0": "s352799823", "submission_id_v1": "s651648403", "cpu_time_v0": 118, "cpu_time_v1": 82, "memory_v0": 4148, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.51, "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nans = 0\n\ncheck = [0]*30\n\nfor i in range(1, 31):\n\n check[i-1] = 2**i\n\n\n\nfor i in A:\n\n if i % 2 == 0:\n\n j = 0\n\n while check[j] <= i:\n\n if i % check[j] == 0:\n\n add = check[j]\n\n else:\n\n break\n\n \n\n j += 1\n\n ans += j\n\n \n\nprint(ans)", "target": "N = int(input())\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in a:\n\n while i % 2 == 0:\n\n i //= 2\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 20, "code_v1_loc": 9, "code_v0_num_chars": 394, "code_v1_num_chars": 149, "code_v0_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nans = 0\ncheck = [0] * 30\nfor i in range(1, 31):\n check[i - 1] = 2**i\nfor i in A:\n if i % 2 == 0:\n j = 0\n while check[j] <= i:\n if i % check[j] == 0:\n add = check[j]\n else:\n break\n j += 1\n ans += j\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\na = [int(i) for i in input().split()]\nans = 0\nfor i in a:\n while i % 2 == 0:\n i //= 2\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 55.0, "diff": ["-A = [int(i) for i in input().split()]", "+a = [int(i) for i in input().split()]", "-check = [0] * 30", "-for i in range(1, 31):", "- check[i - 1] = 2**i", "-for i in A:", "- if i % 2 == 0:", "- j = 0", "- while check[j] <= i:", "- if i % check[j] == 0:", "- add = check[j]", "- else:", "- break", "- j += 1", "- ans += j", "+for i in a:", "+ while i % 2 == 0:", "+ i //= 2", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3522037606, "measured_runtime_v1": 0.279608284, "runtime_lift": 1.2596327819, "key": ["s352799823", "s651648403"]} +{"user_id": "u513081876", "problem_id": "p03845", "language": "python", "submission_id_v0": "s710663686", "submission_id_v1": "s021252857", "cpu_time_v0": 28, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.29, "input": "N = int(input())\n\nT = list(map(int, input().split()))\n\nM = int(input())\n\np = []\n\nx = []\n\nans = []\n\nfor i in range(M):\n\n p, x = list(map(int, input().split()))\n\n ans.append(sum(T[:p-1])+x+sum(T[p:]))\n\n\n\nfor _ in ans:\n\n print(_)", "target": "N = int(input())\n\nT = list(map(int, input().split()))\n\nM = int(input())\n\nP, X, ans = [0]*M, [0]*M, []\n\nbase = sum(T)\n\n\n\nfor i in range(M):\n\n P, X = list(map(int, input().split()))\n\n ans.append(base-T[P-1]+X)\n\n\n\nfor i in ans:\n\n print(i)", "code_v0_loc": 12, "code_v1_loc": 12, "code_v0_num_chars": 229, "code_v1_num_chars": 238, "code_v0_no_empty_lines": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\np = []\nx = []\nans = []\nfor i in range(M):\n p, x = list(map(int, input().split()))\n ans.append(sum(T[: p - 1]) + x + sum(T[p:]))\nfor _ in ans:\n print(_)\n", "code_v1_no_empty_lines": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nP, X, ans = [0] * M, [0] * M, []\nbase = sum(T)\nfor i in range(M):\n P, X = list(map(int, input().split()))\n ans.append(base - T[P - 1] + X)\nfor i in ans:\n print(i)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-p = []", "-x = []", "-ans = []", "+P, X, ans = [0] * M, [0] * M, []", "+base = sum(T)", "- p, x = list(map(int, input().split()))", "- ans.append(sum(T[: p - 1]) + x + sum(T[p:]))", "-for _ in ans:", "- print(_)", "+ P, X = list(map(int, input().split()))", "+ ans.append(base - T[P - 1] + X)", "+for i in ans:", "+ print(i)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2214040067, "measured_runtime_v1": 0.1726463588, "runtime_lift": 1.2824134157, "key": ["s710663686", "s021252857"]} +{"user_id": "u581603131", "problem_id": "p03796", "language": "python", "submission_id_v0": "s669812244", "submission_id_v1": "s638032890", "cpu_time_v0": 230, "cpu_time_v1": 41, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.17, "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "target": "ans=1\n\nn=int(input())\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 65, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nn = int(input())\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-N = int(input())", "-print((math.factorial(N) % (10**9 + 7)))", "+ans = 1", "+n = int(input())", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans = ans % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8658925366, "measured_runtime_v1": 0.3537542467, "runtime_lift": 2.4477233692, "key": ["s669812244", "s638032890"]} +{"user_id": "u197300773", "problem_id": "p02901", "language": "python", "submission_id_v0": "s172477662", "submission_id_v1": "s096488733", "cpu_time_v0": 1463, "cpu_time_v1": 1316, "memory_v0": 36468, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.05, "input": "def main():\n\n import math\n\n N,M=list(map(int,input().split()))\n\n a=[]\n\n for i in range(M):\n\n tmp=list(map(int,input().split()))\n\n tmpc=list(map(int,input().split()))\n\n c=0\n\n for j in range(len(tmpc)):\n\n c+=2**(tmpc[j]-1)\n\n tmp[1]=c\n\n a+=[tmp]\n\n\n\n\n\n dp=[[10**10 for j in range(2**N)] for i in range(M)]\n\n dp[0][0]=0\n\n dp[0][a[0][1]]=a[0][0]\n\n\n\n\n\n for i in range(1,M):\n\n dp[i]=dp[i-1]\n\n for j in range(2**N):\n\n z,p=a[i][0],a[i][1]\n\n q=j|p\n\n x=dp[i-1][j]+z\n\n if dp[i][q]>x: dp[i][q]=x\n\n\n\n ans=dp[M-1][2**N-1]\n\n print((ans if ans<10**10 else -1))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "n,m=list(map(int,input().split()))\n\nL=2**n\n\ncost=[0]+[10**8 for i in range(L-1)]\n\n\n\nfor i in range(m):\n\n a,b=list(map(int,input().split()))\n\n c=sum([2**(int(i)-1) for i in input().split()])\n\n for j in range(L):\n\n q=j|c\n\n x=cost[j]+a\n\n if cost[q]>x:\n\n cost[q]=x\n\nprint((cost[L-1] if cost[L-1]<10**8 else -1))", "code_v0_loc": 32, "code_v1_loc": 13, "code_v0_num_chars": 718, "code_v1_num_chars": 334, "code_v0_no_empty_lines": "def main():\n import math\n\n N, M = list(map(int, input().split()))\n a = []\n for i in range(M):\n tmp = list(map(int, input().split()))\n tmpc = list(map(int, input().split()))\n c = 0\n for j in range(len(tmpc)):\n c += 2 ** (tmpc[j] - 1)\n tmp[1] = c\n a += [tmp]\n dp = [[10**10 for j in range(2**N)] for i in range(M)]\n dp[0][0] = 0\n dp[0][a[0][1]] = a[0][0]\n for i in range(1, M):\n dp[i] = dp[i - 1]\n for j in range(2**N):\n z, p = a[i][0], a[i][1]\n q = j | p\n x = dp[i - 1][j] + z\n if dp[i][q] > x:\n dp[i][q] = x\n ans = dp[M - 1][2**N - 1]\n print((ans if ans < 10**10 else -1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nL = 2**n\ncost = [0] + [10**8 for i in range(L - 1)]\nfor i in range(m):\n a, b = list(map(int, input().split()))\n c = sum([2 ** (int(i) - 1) for i in input().split()])\n for j in range(L):\n q = j | c\n x = cost[j] + a\n if cost[q] > x:\n cost[q] = x\nprint((cost[L - 1] if cost[L - 1] < 10**8 else -1))\n", "code_same": false, "relative_loc_diff_percent": 59.375, "diff": ["-def main():", "- import math", "-", "- N, M = list(map(int, input().split()))", "- a = []", "- for i in range(M):", "- tmp = list(map(int, input().split()))", "- tmpc = list(map(int, input().split()))", "- c = 0", "- for j in range(len(tmpc)):", "- c += 2 ** (tmpc[j] - 1)", "- tmp[1] = c", "- a += [tmp]", "- dp = [[10**10 for j in range(2**N)] for i in range(M)]", "- dp[0][0] = 0", "- dp[0][a[0][1]] = a[0][0]", "- for i in range(1, M):", "- dp[i] = dp[i - 1]", "- for j in range(2**N):", "- z, p = a[i][0], a[i][1]", "- q = j | p", "- x = dp[i - 1][j] + z", "- if dp[i][q] > x:", "- dp[i][q] = x", "- ans = dp[M - 1][2**N - 1]", "- print((ans if ans < 10**10 else -1))", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+n, m = list(map(int, input().split()))", "+L = 2**n", "+cost = [0] + [10**8 for i in range(L - 1)]", "+for i in range(m):", "+ a, b = list(map(int, input().split()))", "+ c = sum([2 ** (int(i) - 1) for i in input().split()])", "+ for j in range(L):", "+ q = j | c", "+ x = cost[j] + a", "+ if cost[q] > x:", "+ cost[q] = x", "+print((cost[L - 1] if cost[L - 1] < 10**8 else -1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3366471643, "measured_runtime_v1": 0.2183672116, "runtime_lift": 1.5416561941, "key": ["s172477662", "s096488733"]} +{"user_id": "u987846648", "problem_id": "p02627", "language": "python", "submission_id_v0": "s793826721", "submission_id_v1": "s875451520", "cpu_time_v0": 75, "cpu_time_v1": 67, "memory_v0": 61796, "memory_v1": 61608, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.67, "input": "alph = input()\n\nif alph.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")\n", "target": "a = input()\n\n\n\nif a.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")", "code_v0_loc": 5, "code_v1_loc": 6, "code_v0_num_chars": 74, "code_v1_num_chars": 69, "code_v0_no_empty_lines": "alph = input()\nif alph.isupper():\n print(\"A\")\nelse:\n print(\"a\")\n", "code_v1_no_empty_lines": "a = input()\nif a.isupper():\n print(\"A\")\nelse:\n print(\"a\")\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-alph = input()", "-if alph.isupper():", "+a = input()", "+if a.isupper():"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1834881261, "measured_runtime_v1": 0.0064039894, "runtime_lift": 28.6521595413, "key": ["s793826721", "s875451520"]} +{"user_id": "u729133443", "problem_id": "p03371", "language": "python", "submission_id_v0": "s416055764", "submission_id_v1": "s218640380", "cpu_time_v0": 227, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.51, "input": "a,b,c,x,y=list(map(int,input().split()));print((min(k*c*2+a*max(x-k,0)+b*max(y-k,0)for k in range(max(x,y)*3))))", "target": "a,b,c,x,y=list(map(int,input().split()));print((min(x*a+y*b,2*x*c+b*max(0,y-x),2*y*c+a*max(0,x-y))))", "code_v0_loc": 1, "code_v1_loc": 1, "code_v0_num_chars": 104, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nprint(\n (\n min(\n k * c * 2 + a * max(x - k, 0) + b * max(y - k, 0)\n for k in range(max(x, y) * 3)\n )\n )\n)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nprint(\n (min(x * a + y * b, 2 * x * c + b * max(0, y - x), 2 * y * c + a * max(0, x - y)))\n)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- (", "- min(", "- k * c * 2 + a * max(x - k, 0) + b * max(y - k, 0)", "- for k in range(max(x, y) * 3)", "- )", "- )", "+ (min(x * a + y * b, 2 * x * c + b * max(0, y - x), 2 * y * c + a * max(0, x - y)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4340552337, "measured_runtime_v1": 0.2001633718, "runtime_lift": 2.1685048058, "key": ["s416055764", "s218640380"]} +{"user_id": "u064408584", "problem_id": "p03723", "language": "python", "submission_id_v0": "s414644536", "submission_id_v1": "s610159769", "cpu_time_v0": 146, "cpu_time_v1": 26, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.19, "input": "a,b,c=list(map(int, input().split()))\n\nd=0\n\nwhile d<10**5:\n\n if a%2==1 or b%2==1 or c%2==1:break\n\n a,b,c=b/2+c/2,a/2+c/2,a/2+b/2\n\n d+=1\n\nelse:d=-1\n\nprint(d)", "target": "a,b,c=list(map(int, input().split()))\n\nans=0\n\nwhile a%2==0 and b%2==0 and c%2==0 and ans<10000:\n\n a,b,c=b//2+c//2,a//2+c//2,a//2+b//2\n\n ans+=1\n\nif ans==10000:ans=-1\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 159, "code_v1_num_chars": 176, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nd = 0\nwhile d < 10**5:\n if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:\n break\n a, b, c = b / 2 + c / 2, a / 2 + c / 2, a / 2 + b / 2\n d += 1\nelse:\n d = -1\nprint(d)\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nans = 0\nwhile a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and ans < 10000:\n a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2\n ans += 1\nif ans == 10000:\n ans = -1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-d = 0", "-while d < 10**5:", "- if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:", "- break", "- a, b, c = b / 2 + c / 2, a / 2 + c / 2, a / 2 + b / 2", "- d += 1", "-else:", "- d = -1", "-print(d)", "+ans = 0", "+while a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and ans < 10000:", "+ a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2", "+ ans += 1", "+if ans == 10000:", "+ ans = -1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5153860836, "measured_runtime_v1": 0.3941329796, "runtime_lift": 1.307645161, "key": ["s414644536", "s610159769"]} +{"user_id": "u285443936", "problem_id": "p03309", "language": "python", "submission_id_v0": "s057200482", "submission_id_v1": "s045600813", "cpu_time_v0": 246, "cpu_time_v1": 216, "memory_v0": 27232, "memory_v1": 25200, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.2, "input": "import statistics\n\nN = int(input())\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in range(1,N+1):\n\n a[i-1] -= i\n\n\n\nb = statistics.median(a)\n\nfor i in range(N):\n\n ans += abs(a[i]-b)\n\nprint((int(ans)))", "target": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nC = [A[i]-i for i in range(N)]\n\nC.sort()\n\nans = 0\n\nmed = C[N//2]\n\nfor i in range(N):\n\n ans += abs(C[i]-med)\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 9, "code_v0_num_chars": 211, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "import statistics\n\nN = int(input())\na = [int(i) for i in input().split()]\nans = 0\nfor i in range(1, N + 1):\n a[i - 1] -= i\nb = statistics.median(a)\nfor i in range(N):\n ans += abs(a[i] - b)\nprint((int(ans)))\n", "code_v1_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nC = [A[i] - i for i in range(N)]\nC.sort()\nans = 0\nmed = C[N // 2]\nfor i in range(N):\n ans += abs(C[i] - med)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-import statistics", "-", "-a = [int(i) for i in input().split()]", "+A = [int(i) for i in input().split()]", "+C = [A[i] - i for i in range(N)]", "+C.sort()", "-for i in range(1, N + 1):", "- a[i - 1] -= i", "-b = statistics.median(a)", "+med = C[N // 2]", "- ans += abs(a[i] - b)", "-print((int(ans)))", "+ ans += abs(C[i] - med)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2933883266, "measured_runtime_v1": 0.2086455548, "runtime_lift": 1.406156613, "key": ["s057200482", "s045600813"]} +{"user_id": "u060896757", "problem_id": "p02691", "language": "python", "submission_id_v0": "s720467562", "submission_id_v1": "s807450341", "cpu_time_v0": 266, "cpu_time_v1": 106, "memory_v0": 97968, "memory_v1": 92728, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.15, "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\ndp = [0] * 10 ** 7\n\nans = 0\n\nfor i in range(N):\n\n x = i + 1 - A[i]\n\n if x >= 0:\n\n ans += dp[x]\n\n y = i + 1 + A[i]\n\n if y < 10 ** 7:\n\n dp[y] += 1\n\n\n\nprint(ans)\n", "target": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nINF = 2 * 10 ** 5\n\ndp = [0] * INF\n\nans = 0\n\nfor i in range(N):\n\n i_i_ = i + 1 - A[i]\n\n if 0 < i_i_ < INF:\n\n ans += dp[i_i_]\n\n i_ = i + 1 + A[i]\n\n if 0 < i_ < INF:\n\n dp[i_] += 1\n\n\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 14, "code_v0_num_chars": 242, "code_v1_num_chars": 273, "code_v0_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\ndp = [0] * 10**7\nans = 0\nfor i in range(N):\n x = i + 1 - A[i]\n if x >= 0:\n ans += dp[x]\n y = i + 1 + A[i]\n if y < 10**7:\n dp[y] += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nINF = 2 * 10**5\ndp = [0] * INF\nans = 0\nfor i in range(N):\n i_i_ = i + 1 - A[i]\n if 0 < i_i_ < INF:\n ans += dp[i_i_]\n i_ = i + 1 + A[i]\n if 0 < i_ < INF:\n dp[i_] += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-dp = [0] * 10**7", "+INF = 2 * 10**5", "+dp = [0] * INF", "- x = i + 1 - A[i]", "- if x >= 0:", "- ans += dp[x]", "- y = i + 1 + A[i]", "- if y < 10**7:", "- dp[y] += 1", "+ i_i_ = i + 1 - A[i]", "+ if 0 < i_i_ < INF:", "+ ans += dp[i_i_]", "+ i_ = i + 1 + A[i]", "+ if 0 < i_ < INF:", "+ dp[i_] += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 1.4942608066, "measured_runtime_v1": 0.2557353399, "runtime_lift": 5.8429969327, "key": ["s720467562", "s807450341"]} +{"user_id": "u880730787", "problem_id": "p02555", "language": "python", "submission_id_v0": "s669686668", "submission_id_v1": "s427616795", "cpu_time_v0": 487, "cpu_time_v1": 297, "memory_v0": 9116, "memory_v1": 9128, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.01, "input": "S = int(input())\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))", "target": "S = int(input())\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 176, "code_v1_num_chars": 172, "code_v0_no_empty_lines": "S = int(input())\nmod = 10**9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\nfor i in range(1, S + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\nprint((dp[S]))\n", "code_v1_no_empty_lines": "S = int(input())\nmod = 10**9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\nfor i in range(1, S + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\nprint((dp[S]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- dp[i] %= mod", "+ dp[i] %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6781705019, "measured_runtime_v1": 0.481741133, "runtime_lift": 1.4077488002, "key": ["s669686668", "s427616795"]} +{"user_id": "u733814820", "problem_id": "p03107", "language": "python", "submission_id_v0": "s607050481", "submission_id_v1": "s627055692", "cpu_time_v0": 41, "cpu_time_v1": 35, "memory_v0": 3316, "memory_v1": 3956, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.63, "input": "# ABC 120 C\n\n\n\nimport re\n\n\n\nS = input()\n\n\n\nl0 = 0\n\nl1 = 0\n\n\n\nfor i in range(len(S)):\n\n if S[i] == '0':\n\n l0 += 1\n\n elif S[i] == '1':\n\n l1 += 1\n\n\n\nprint((min(l0, l1) * 2))\n", "target": "def resolve():\n\n S = input()\n\n arr = []\n\n for s in S:\n\n if len(arr) != 0 and arr[-1] != s:\n\n arr.pop()\n\n else:\n\n arr.append(s)\n\n\n\n print((len(S) - len(arr)))\n\n return\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n", "code_v0_loc": 16, "code_v1_loc": 14, "code_v0_num_chars": 189, "code_v1_num_chars": 229, "code_v0_no_empty_lines": "# ABC 120 C\nimport re\n\nS = input()\nl0 = 0\nl1 = 0\nfor i in range(len(S)):\n if S[i] == \"0\":\n l0 += 1\n elif S[i] == \"1\":\n l1 += 1\nprint((min(l0, l1) * 2))\n", "code_v1_no_empty_lines": "def resolve():\n S = input()\n arr = []\n for s in S:\n if len(arr) != 0 and arr[-1] != s:\n arr.pop()\n else:\n arr.append(s)\n print((len(S) - len(arr)))\n return\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-# ABC 120 C", "-import re", "+def resolve():", "+ S = input()", "+ arr = []", "+ for s in S:", "+ if len(arr) != 0 and arr[-1] != s:", "+ arr.pop()", "+ else:", "+ arr.append(s)", "+ print((len(S) - len(arr)))", "+ return", "-S = input()", "-l0 = 0", "-l1 = 0", "-for i in range(len(S)):", "- if S[i] == \"0\":", "- l0 += 1", "- elif S[i] == \"1\":", "- l1 += 1", "-print((min(l0, l1) * 2))", "+", "+if __name__ == \"__main__\":", "+ resolve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4207458491, "measured_runtime_v1": 0.3073607309, "runtime_lift": 1.3688991691, "key": ["s607050481", "s627055692"]} +{"user_id": "u075304271", "problem_id": "p02657", "language": "python", "submission_id_v0": "s027336468", "submission_id_v1": "s218994202", "cpu_time_v0": 65, "cpu_time_v1": 22, "memory_v0": 61680, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.15, "input": "def iput(): return int(input())\n\ndef mput(): return list(map(int, input().split()))\n\ndef lput(): return list(map(int, input().split()))\n\n\n\ndef solve():\n\n a, b = mput()\n\n print((a*b))\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()", "target": "import math\n\ndef solve():\n\n a, b = input().split()\n\n a = int(a)\n\n b = float(b)\n\n print((int(a*b)))\n\n return 0\n\n \n\nif __name__ == \"__main__\":\n\n solve()", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 237, "code_v1_num_chars": 166, "code_v0_no_empty_lines": "def iput():\n return int(input())\n\n\ndef mput():\n return list(map(int, input().split()))\n\n\ndef lput():\n return list(map(int, input().split()))\n\n\ndef solve():\n a, b = mput()\n print((a * b))\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_v1_no_empty_lines": "import math\n\n\ndef solve():\n a, b = input().split()\n a = int(a)\n b = float(b)\n print((int(a * b)))\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-def iput():", "- return int(input())", "-", "-", "-def mput():", "- return list(map(int, input().split()))", "-", "-", "-def lput():", "- return list(map(int, input().split()))", "+import math", "- a, b = mput()", "- print((a * b))", "+ a, b = input().split()", "+ a = int(a)", "+ b = float(b)", "+ print((int(a * b)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2298483524, "measured_runtime_v1": 0.0062991838, "runtime_lift": 36.4885924311, "key": ["s027336468", "s218994202"]} +{"user_id": "u762420987", "problem_id": "p03759", "language": "python", "submission_id_v0": "s246152829", "submission_id_v1": "s501080791", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "a, b, c = list(map(int, input().split()))\n\nif (b - a) == (c - b):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "target": "a, b, c = list(map(int, input().split()))\n\nif b - a == c - b:\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "code_v0_loc": 5, "code_v1_loc": 5, "code_v0_num_chars": 101, "code_v1_num_chars": 97, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif (b - a) == (c - b):\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif b - a == c - b:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-if (b - a) == (c - b):", "+if b - a == c - b:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1914725397, "measured_runtime_v1": 0.0060755644, "runtime_lift": 31.5151856242, "key": ["s246152829", "s501080791"]} +{"user_id": "u033606236", "problem_id": "p03796", "language": "python", "submission_id_v0": "s645296559", "submission_id_v1": "s055332014", "cpu_time_v0": 229, "cpu_time_v1": 39, "memory_v0": 4020, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.97, "input": "import math\n\nprint((math.factorial(int(input()))%1000000007))", "target": "num = int(input())\n\nresult = 1\n\nfor i in range(1,num+1):\n\n result = result *i % 1000000007\n\nprint(result)", "code_v0_loc": 2, "code_v1_loc": 5, "code_v0_num_chars": 59, "code_v1_num_chars": 108, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % 1000000007))\n", "code_v1_no_empty_lines": "num = int(input())\nresult = 1\nfor i in range(1, num + 1):\n result = result * i % 1000000007\nprint(result)\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % 1000000007))", "+num = int(input())", "+result = 1", "+for i in range(1, num + 1):", "+ result = result * i % 1000000007", "+print(result)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7005937328, "measured_runtime_v1": 0.3298725822, "runtime_lift": 2.1238313537, "key": ["s645296559", "s055332014"]} +{"user_id": "u488127128", "problem_id": "p03416", "language": "python", "submission_id_v0": "s570028181", "submission_id_v1": "s434791726", "cpu_time_v0": 103, "cpu_time_v1": 46, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.34, "input": "a,b = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n j = str(i)\n\n if j==''.join(reversed(j)):\n\n count += 1\n\nprint(count)", "target": "a,b = list(map(int, input().split()))\n\nn = [i for i in map(str, list(range(a,b+1))) if i==i[::-1]]\n\nprint((len(n)))", "code_v0_loc": 7, "code_v1_loc": 3, "code_v0_num_chars": 149, "code_v1_num_chars": 101, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n j = str(i)\n if j == \"\".join(reversed(j)):\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nn = [i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]\nprint((len(n)))\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-count = 0", "-for i in range(a, b + 1):", "- j = str(i)", "- if j == \"\".join(reversed(j)):", "- count += 1", "-print(count)", "+n = [i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]", "+print((len(n)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4183517286, "measured_runtime_v1": 0.2983190859, "runtime_lift": 1.4023632692, "key": ["s570028181", "s434791726"]} +{"user_id": "u642883360", "problem_id": "p03796", "language": "python", "submission_id_v0": "s671319819", "submission_id_v1": "s345697128", "cpu_time_v0": 230, "cpu_time_v1": 167, "memory_v0": 3984, "memory_v1": 38512, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.39, "input": "#!/usr/bin/env pypy3\n\n\n\nimport math\n\nprint((math.factorial(int(input())) % 1000000007))", "target": "n = int(input())\n\nfor i in range(n - 1, 1, -1):\n\n\tn *= i\n\n\tn %= 10**9 + 7\n\nprint(n)", "code_v0_loc": 4, "code_v1_loc": 5, "code_v0_num_chars": 85, "code_v1_num_chars": 83, "code_v0_no_empty_lines": "#!/usr/bin/env pypy3\nimport math\n\nprint((math.factorial(int(input())) % 1000000007))\n", "code_v1_no_empty_lines": "n = int(input())\nfor i in range(n - 1, 1, -1):\n n *= i\n n %= 10**9 + 7\nprint(n)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-#!/usr/bin/env pypy3", "-import math", "-", "-print((math.factorial(int(input())) % 1000000007))", "+n = int(input())", "+for i in range(n - 1, 1, -1):", "+ n *= i", "+ n %= 10**9 + 7", "+print(n)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5574923191, "measured_runtime_v1": 0.2242465372, "runtime_lift": 2.4860687974, "key": ["s671319819", "s345697128"]} +{"user_id": "u888092736", "problem_id": "p03721", "language": "python", "submission_id_v0": "s705162733", "submission_id_v1": "s360654843", "cpu_time_v0": 281, "cpu_time_v1": 145, "memory_v0": 28552, "memory_v1": 31636, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.4, "input": "(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\n\nfor a, b in sorted(AB):\n\n K -= b\n\n if K <= 0:\n\n print(a)\n\n break\n", "target": "N, K, *AB = list(map(int, open(0).read().split()))\n\nli = [(a, b) for a, b in zip(*[iter(AB)] * 2)]\n\nli.sort()\n\nfor a, b in li:\n\n if K > b:\n\n K -= b\n\n else:\n\n print(a)\n\n break\n", "code_v0_loc": 6, "code_v1_loc": 9, "code_v0_num_chars": 145, "code_v1_num_chars": 196, "code_v0_no_empty_lines": "(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\nfor a, b in sorted(AB):\n K -= b\n if K <= 0:\n print(a)\n break\n", "code_v1_no_empty_lines": "N, K, *AB = list(map(int, open(0).read().split()))\nli = [(a, b) for a, b in zip(*[iter(AB)] * 2)]\nli.sort()\nfor a, b in li:\n if K > b:\n K -= b\n else:\n print(a)\n break\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-(N, K), *AB = [list(map(int, s.split())) for s in open(0)]", "-for a, b in sorted(AB):", "- K -= b", "- if K <= 0:", "+N, K, *AB = list(map(int, open(0).read().split()))", "+li = [(a, b) for a, b in zip(*[iter(AB)] * 2)]", "+li.sort()", "+for a, b in li:", "+ if K > b:", "+ K -= b", "+ else:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2949739402, "measured_runtime_v1": 0.0817868489, "runtime_lift": 3.6066182276, "key": ["s705162733", "s360654843"]} +{"user_id": "u254871849", "problem_id": "p03796", "language": "python", "submission_id_v0": "s710953077", "submission_id_v1": "s484408635", "cpu_time_v0": 36, "cpu_time_v1": 32, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.11, "input": "mod = int(1e9+7)\n\nn = int(input())\n\n\n\npower = 1\n\nfor i in range(1, n+1):\n\n power = power * i % mod\n\nprint(power)", "target": "import sys\n\n\n\nMOD = 10 ** 9 + 7\n\nn = int(sys.stdin.readline().rstrip())\n\n\n\ndef main():\n\n res = 1\n\n for i in range(1, n+1):\n\n res *= i\n\n res %= MOD\n\n\n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 7, "code_v1_loc": 16, "code_v0_num_chars": 115, "code_v1_num_chars": 248, "code_v0_no_empty_lines": "mod = int(1e9 + 7)\nn = int(input())\npower = 1\nfor i in range(1, n + 1):\n power = power * i % mod\nprint(power)\n", "code_v1_no_empty_lines": "import sys\n\nMOD = 10**9 + 7\nn = int(sys.stdin.readline().rstrip())\n\n\ndef main():\n res = 1\n for i in range(1, n + 1):\n res *= i\n res %= MOD\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 56.25, "diff": ["-mod = int(1e9 + 7)", "-n = int(input())", "-power = 1", "-for i in range(1, n + 1):", "- power = power * i % mod", "-print(power)", "+import sys", "+", "+MOD = 10**9 + 7", "+n = int(sys.stdin.readline().rstrip())", "+", "+", "+def main():", "+ res = 1", "+ for i in range(1, n + 1):", "+ res *= i", "+ res %= MOD", "+ return res", "+", "+", "+if __name__ == \"__main__\":", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3650334806, "measured_runtime_v1": 0.2122802832, "runtime_lift": 1.7195825967, "key": ["s710953077", "s484408635"]} +{"user_id": "u494927057", "problem_id": "p03814", "language": "python", "submission_id_v0": "s883482084", "submission_id_v1": "s072538424", "cpu_time_v0": 59, "cpu_time_v1": 35, "memory_v0": 3516, "memory_v1": 3516, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.68, "input": "s = input()\n\n\n\nstart = -1\n\nend = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A' and start < 0:\n\n start = i\n\n elif s[i] == 'Z':\n\n end = i\n\nprint((end - start + 1))\n", "target": "s = input()\n\n\n\nstart = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A':\n\n start = i\n\n break\n\n\n\nend = 0\n\nfor i in reversed(list(range(len(s)))):\n\n if s[i] == 'Z':\n\n end = i\n\n break\n\nprint((end - start + 1))\n", "code_v0_loc": 10, "code_v1_loc": 14, "code_v0_num_chars": 178, "code_v1_num_chars": 228, "code_v0_no_empty_lines": "s = input()\nstart = -1\nend = 0\nfor i in range(len(s)):\n if s[i] == \"A\" and start < 0:\n start = i\n elif s[i] == \"Z\":\n end = i\nprint((end - start + 1))\n", "code_v1_no_empty_lines": "s = input()\nstart = 0\nfor i in range(len(s)):\n if s[i] == \"A\":\n start = i\n break\nend = 0\nfor i in reversed(list(range(len(s)))):\n if s[i] == \"Z\":\n end = i\n break\nprint((end - start + 1))\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-start = -1", "+start = 0", "+for i in range(len(s)):", "+ if s[i] == \"A\":", "+ start = i", "+ break", "-for i in range(len(s)):", "- if s[i] == \"A\" and start < 0:", "- start = i", "- elif s[i] == \"Z\":", "+for i in reversed(list(range(len(s)))):", "+ if s[i] == \"Z\":", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2661928608, "measured_runtime_v1": 0.1145644054, "runtime_lift": 2.3235215143, "key": ["s883482084", "s072538424"]} +{"user_id": "u150984829", "problem_id": "p02412", "language": "python", "submission_id_v0": "s777094380", "submission_id_v1": "s391711407", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 5608, "memory_v1": 5612, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "while 1:\n\n n,x=list(map(int,input().split()))\n\n if n+x==0:break\n\n print((len([1 for i in range(3,n+1)for j in range(2,x-i)if x-i-j s:\n\n break\n\n elif s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n", "target": "k, s = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if 0 <= s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 200, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if i + j > s:\n break\n elif s - i - j <= k:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["- if i + j > s:", "- break", "- elif s - i - j <= k:", "+ if 0 <= s - i - j <= k:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3744940901, "measured_runtime_v1": 0.2492418245, "runtime_lift": 1.5025330956, "key": ["s742815481", "s376437490"]} +{"user_id": "u882564128", "problem_id": "p03371", "language": "python", "submission_id_v0": "s136733954", "submission_id_v1": "s827725289", "cpu_time_v0": 100, "cpu_time_v1": 70, "memory_v0": 9180, "memory_v1": 9068, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.0, "input": "a, b, c, x, y = list(map(int, input().split(' ')))\n\n\n\nc = int(c*2)\n\nm = float('inf')\n\nfor i in range(10**5+1):\n\n m = min(m, a*max(0, x-i)+b*max(0,y-i)+c*i)\n\nprint(m)", "target": "import math\n\na, b, c, x, y = list(map(int, input().split(' ')))\n\nans = float('inf')\n\nc = c*2\n\nfor i in range(max(x, y)+1):\n\n if i > x:\n\n price = b*(y-i) + c*i\n\n elif i > y:\n\n price = a*(x-i) + c*i\n\n else:\n\n price = a*(x-i) + b*(y-i) + c*i\n\n\n\n if ans > price:\n\n ans = price\n\nprint(ans)", "code_v0_loc": 7, "code_v1_loc": 15, "code_v0_num_chars": 162, "code_v1_num_chars": 318, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split(\" \")))\nc = int(c * 2)\nm = float(\"inf\")\nfor i in range(10**5 + 1):\n m = min(m, a * max(0, x - i) + b * max(0, y - i) + c * i)\nprint(m)\n", "code_v1_no_empty_lines": "import math\n\na, b, c, x, y = list(map(int, input().split(\" \")))\nans = float(\"inf\")\nc = c * 2\nfor i in range(max(x, y) + 1):\n if i > x:\n price = b * (y - i) + c * i\n elif i > y:\n price = a * (x - i) + c * i\n else:\n price = a * (x - i) + b * (y - i) + c * i\n if ans > price:\n ans = price\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 53.3333333333, "diff": ["+import math", "+", "-c = int(c * 2)", "-m = float(\"inf\")", "-for i in range(10**5 + 1):", "- m = min(m, a * max(0, x - i) + b * max(0, y - i) + c * i)", "-print(m)", "+ans = float(\"inf\")", "+c = c * 2", "+for i in range(max(x, y) + 1):", "+ if i > x:", "+ price = b * (y - i) + c * i", "+ elif i > y:", "+ price = a * (x - i) + c * i", "+ else:", "+ price = a * (x - i) + b * (y - i) + c * i", "+ if ans > price:", "+ ans = price", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0457227323, "measured_runtime_v1": 0.348341011, "runtime_lift": 3.0020086614, "key": ["s136733954", "s827725289"]} +{"user_id": "u729133443", "problem_id": "p02983", "language": "python", "submission_id_v0": "s140577970", "submission_id_v1": "s371672772", "cpu_time_v0": 591, "cpu_time_v1": 74, "memory_v0": 40556, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.48, "input": "l,r=list(map(int,input().split()))\n\ns=list(range(l,r+1))[:2019]\n\nprint((min(i*j%2019for i in s for j in s if i= Y:\n\n tmp = min(tmp,2*Y*C+(X-Y)*A)\n\nelse:\n\n tmp = min(tmp,2*X*C+(Y-X)*B)\n\ntmp = min(tmp,max(X,Y)*2*C)\n\nprint(tmp)", "code_v0_loc": 6, "code_v1_loc": 8, "code_v0_num_chars": 178, "code_v1_num_chars": 186, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(max(X, Y) + 1):\n cost = 2 * C * i + max(0, X - i) * A + max(0, Y - i) * B\n ans = min(ans, cost)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\ntmp = A * X + B * Y\nif X >= Y:\n tmp = min(tmp, 2 * Y * C + (X - Y) * A)\nelse:\n tmp = min(tmp, 2 * X * C + (Y - X) * B)\ntmp = min(tmp, max(X, Y) * 2 * C)\nprint(tmp)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-ans = float(\"inf\")", "-for i in range(max(X, Y) + 1):", "- cost = 2 * C * i + max(0, X - i) * A + max(0, Y - i) * B", "- ans = min(ans, cost)", "-print(ans)", "+tmp = A * X + B * Y", "+if X >= Y:", "+ tmp = min(tmp, 2 * Y * C + (X - Y) * A)", "+else:", "+ tmp = min(tmp, 2 * X * C + (Y - X) * B)", "+tmp = min(tmp, max(X, Y) * 2 * C)", "+print(tmp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.571060118, "measured_runtime_v1": 0.3373241339, "runtime_lift": 1.6929121299, "key": ["s614340278", "s677161923"]} +{"user_id": "u678167152", "problem_id": "p03814", "language": "python", "submission_id_v0": "s292011694", "submission_id_v1": "s577750700", "cpu_time_v0": 173, "cpu_time_v1": 33, "memory_v0": 41456, "memory_v1": 9328, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.92, "input": "s = input()\n\na = s.find('A')\n\nz = s[::-1].find('Z')\n\nans = len(s)-a-z\n\n\n\nprint(ans)\n\n\n\n#print(*ans, sep='\\n')", "target": "def solve():\n\n S = input()\n\n a = S.find('A')\n\n z = S[::-1].find('Z')\n\n ans = len(S)-a-z\n\n return ans\n\nprint((solve()))", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 109, "code_v1_num_chars": 121, "code_v0_no_empty_lines": "s = input()\na = s.find(\"A\")\nz = s[::-1].find(\"Z\")\nans = len(s) - a - z\nprint(ans)\n# print(*ans, sep='\\n')\n", "code_v1_no_empty_lines": "def solve():\n S = input()\n a = S.find(\"A\")\n z = S[::-1].find(\"Z\")\n ans = len(S) - a - z\n return ans\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-s = input()", "-a = s.find(\"A\")", "-z = s[::-1].find(\"Z\")", "-ans = len(s) - a - z", "-print(ans)", "-# print(*ans, sep='\\n')", "+def solve():", "+ S = input()", "+ a = S.find(\"A\")", "+ z = S[::-1].find(\"Z\")", "+ ans = len(S) - a - z", "+ return ans", "+", "+", "+print((solve()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3115016568, "measured_runtime_v1": 0.2242342863, "runtime_lift": 1.3891794243, "key": ["s292011694", "s577750700"]} +{"user_id": "u729133443", "problem_id": "p03494", "language": "python", "submission_id_v0": "s130510697", "submission_id_v1": "s993121873", "cpu_time_v0": 166, "cpu_time_v1": 32, "memory_v0": 38256, "memory_v1": 9048, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.72, "input": "_,t=open(0);n=eval(t.replace(' ','|'));print((len(bin(n&-n))-3))", "target": "n=eval([*open(0)][1].replace(*' |'))\n\nprint((len(bin(n&-n))-3))", "code_v0_loc": 1, "code_v1_loc": 2, "code_v0_num_chars": 62, "code_v1_num_chars": 61, "code_v0_no_empty_lines": "_, t = open(0)\nn = eval(t.replace(\" \", \"|\"))\nprint((len(bin(n & -n)) - 3))\n", "code_v1_no_empty_lines": "n = eval([*open(0)][1].replace(*\" |\"))\nprint((len(bin(n & -n)) - 3))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-_, t = open(0)", "-n = eval(t.replace(\" \", \"|\"))", "+n = eval([*open(0)][1].replace(*\" |\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2380404282, "measured_runtime_v1": 0.1070810323, "runtime_lift": 2.2229934012, "key": ["s130510697", "s993121873"]} +{"user_id": "u923662841", "problem_id": "p03309", "language": "python", "submission_id_v0": "s990999147", "submission_id_v1": "s307361938", "cpu_time_v0": 211, "cpu_time_v1": 159, "memory_v0": 34024, "memory_v1": 31160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 24.64, "input": "import statistics\n\nN = int(input())\n\nA = [int(a)-i-1 for i,a in enumerate(input().split(),1)]\n\nb = statistics.median_low(A)\n\nc = statistics.median_high(A)\n\nd = sum([abs(x-b) for x in A])\n\ne = sum([abs(x-c) for x in A])\n\nprint((min(d,e)))", "target": "N=int(input())\n\nA=sorted(a-i-1 for i,a in enumerate(map(int,input().split())))\n\nprint((sum(abs(a-A[N//2]) for a in A)))", "code_v0_loc": 8, "code_v1_loc": 3, "code_v0_num_chars": 241, "code_v1_num_chars": 117, "code_v0_no_empty_lines": "import statistics\n\nN = int(input())\nA = [int(a) - i - 1 for i, a in enumerate(input().split(), 1)]\nb = statistics.median_low(A)\nc = statistics.median_high(A)\nd = sum([abs(x - b) for x in A])\ne = sum([abs(x - c) for x in A])\nprint((min(d, e)))\n", "code_v1_no_empty_lines": "N = int(input())\nA = sorted(a - i - 1 for i, a in enumerate(map(int, input().split())))\nprint((sum(abs(a - A[N // 2]) for a in A)))\n", "code_same": false, "relative_loc_diff_percent": 62.5, "diff": ["-import statistics", "-", "-A = [int(a) - i - 1 for i, a in enumerate(input().split(), 1)]", "-b = statistics.median_low(A)", "-c = statistics.median_high(A)", "-d = sum([abs(x - b) for x in A])", "-e = sum([abs(x - c) for x in A])", "-print((min(d, e)))", "+A = sorted(a - i - 1 for i, a in enumerate(map(int, input().split())))", "+print((sum(abs(a - A[N // 2]) for a in A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3014758439, "measured_runtime_v1": 0.2369829128, "runtime_lift": 1.2721416931, "key": ["s990999147", "s307361938"]} +{"user_id": "u294385082", "problem_id": "p03416", "language": "python", "submission_id_v0": "s823919342", "submission_id_v1": "s499216276", "cpu_time_v0": 175, "cpu_time_v1": 125, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.57, "input": "a,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n new = list(reversed(list(str(i))))\n\n if new == list(str(i)):\n\n c += 1\n\n \n\n \n\nprint(c)", "target": "a,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n if list(str(i)) == list(str(i))[::-1]:\n\n c += 1\n\n \n\n \n\nprint(c)", "code_v0_loc": 10, "code_v1_loc": 9, "code_v0_num_chars": 162, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nc = 0\nfor i in range(a, b + 1):\n new = list(reversed(list(str(i))))\n if new == list(str(i)):\n c += 1\nprint(c)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nc = 0\nfor i in range(a, b + 1):\n if list(str(i)) == list(str(i))[::-1]:\n c += 1\nprint(c)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["- new = list(reversed(list(str(i))))", "- if new == list(str(i)):", "+ if list(str(i)) == list(str(i))[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7237584333, "measured_runtime_v1": 0.3522657444, "runtime_lift": 2.0545807954, "key": ["s823919342", "s499216276"]} +{"user_id": "u089230684", "problem_id": "p03796", "language": "python", "submission_id_v0": "s560811979", "submission_id_v1": "s868944422", "cpu_time_v0": 230, "cpu_time_v1": 37, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.91, "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))", "target": "n = int(input())\n\nfact = 1\n\nfor i in range(1,n+1):\n\n fact = fact * i % (10**9 +7)\n\nres = fact % (10**9 + 7)\n\nprint(res)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 69, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "import math\n\nx = int(input())\nprint((math.factorial(x) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nfact = 1\nfor i in range(1, n + 1):\n fact = fact * i % (10**9 + 7)\nres = fact % (10**9 + 7)\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-x = int(input())", "-print((math.factorial(x) % (10**9 + 7)))", "+n = int(input())", "+fact = 1", "+for i in range(1, n + 1):", "+ fact = fact * i % (10**9 + 7)", "+res = fact % (10**9 + 7)", "+print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5532854562, "measured_runtime_v1": 0.2473686228, "runtime_lift": 2.2366840626, "key": ["s560811979", "s868944422"]} +{"user_id": "u732061897", "problem_id": "p02767", "language": "python", "submission_id_v0": "s699773211", "submission_id_v1": "s064206410", "cpu_time_v0": 21, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.29, "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nanswer = 10 ** 9\n\nfor i in range(1,101):\n\n tmp = 0\n\n for a in A:\n\n tmp += abs(a-i) ** 2\n\n answer = min(answer,tmp)\n\nprint(answer)", "target": "N = int(input())\n\nA = list(map(int, input().split()))\n\nchushin = sum(A)//N\n\nchushin_1 = sum(A)//N +1\n\nanswer = 0\n\nanswer_1 = 0\n\nfor a in A:\n\n answer += abs(a-chushin) ** 2\n\n answer_1 += abs(a-chushin_1) ** 2\n\nprint((min(answer,answer_1)))", "code_v0_loc": 9, "code_v1_loc": 10, "code_v0_num_chars": 200, "code_v1_num_chars": 242, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nanswer = 10**9\nfor i in range(1, 101):\n tmp = 0\n for a in A:\n tmp += abs(a - i) ** 2\n answer = min(answer, tmp)\nprint(answer)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nchushin = sum(A) // N\nchushin_1 = sum(A) // N + 1\nanswer = 0\nanswer_1 = 0\nfor a in A:\n answer += abs(a - chushin) ** 2\n answer_1 += abs(a - chushin_1) ** 2\nprint((min(answer, answer_1)))\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-answer = 10**9", "-for i in range(1, 101):", "- tmp = 0", "- for a in A:", "- tmp += abs(a - i) ** 2", "- answer = min(answer, tmp)", "-print(answer)", "+chushin = sum(A) // N", "+chushin_1 = sum(A) // N + 1", "+answer = 0", "+answer_1 = 0", "+for a in A:", "+ answer += abs(a - chushin) ** 2", "+ answer_1 += abs(a - chushin_1) ** 2", "+print((min(answer, answer_1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3756797752, "measured_runtime_v1": 0.2943871524, "runtime_lift": 1.2761418836, "key": ["s699773211", "s064206410"]} +{"user_id": "u440161695", "problem_id": "p03107", "language": "python", "submission_id_v0": "s703980325", "submission_id_v1": "s025529722", "cpu_time_v0": 26, "cpu_time_v1": 18, "memory_v0": 3444, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.77, "input": "from collections import Counter\n\nd={chr(i):0 for i in range(2)}\n\ns=Counter(input())\n\nd=d.update(s)\n\nprint((min(s[\"0\"],s[\"1\"])*2))", "target": "s=input()\n\nprint((min(s.count(\"0\"),s.count(\"1\"))*2))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 127, "code_v1_num_chars": 50, "code_v0_no_empty_lines": "from collections import Counter\n\nd = {chr(i): 0 for i in range(2)}\ns = Counter(input())\nd = d.update(s)\nprint((min(s[\"0\"], s[\"1\"]) * 2))\n", "code_v1_no_empty_lines": "s = input()\nprint((min(s.count(\"0\"), s.count(\"1\")) * 2))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-from collections import Counter", "-", "-d = {chr(i): 0 for i in range(2)}", "-s = Counter(input())", "-d = d.update(s)", "-print((min(s[\"0\"], s[\"1\"]) * 2))", "+s = input()", "+print((min(s.count(\"0\"), s.count(\"1\")) * 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5096813786, "measured_runtime_v1": 0.1983500416, "runtime_lift": 2.5696056043, "key": ["s703980325", "s025529722"]} +{"user_id": "u238940874", "problem_id": "p02725", "language": "python", "submission_id_v0": "s425361145", "submission_id_v1": "s820245641", "cpu_time_v0": 183, "cpu_time_v1": 162, "memory_v0": 25840, "memory_v1": 25840, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.48, "input": "k,n = list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\nlongd=0\n\nfor i in range(n):\n\n tmp=abs(a[i+1]-a[i])\n\n longd=max(longd,tmp)\n\nprint((k-longd))", "target": "k,n=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\n\n\nx=0\n\nfor i in range(len(a)-1):\n\n dis=abs(a[i+1]-a[i])\n\n x=max(x,dis)\n\n\n\nprint((k-x))", "code_v0_loc": 8, "code_v1_loc": 10, "code_v0_num_chars": 179, "code_v1_num_chars": 172, "code_v0_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(a[0] + k)\nlongd = 0\nfor i in range(n):\n tmp = abs(a[i + 1] - a[i])\n longd = max(longd, tmp)\nprint((k - longd))\n", "code_v1_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(a[0] + k)\nx = 0\nfor i in range(len(a) - 1):\n dis = abs(a[i + 1] - a[i])\n x = max(x, dis)\nprint((k - x))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-longd = 0", "-for i in range(n):", "- tmp = abs(a[i + 1] - a[i])", "- longd = max(longd, tmp)", "-print((k - longd))", "+x = 0", "+for i in range(len(a) - 1):", "+ dis = abs(a[i + 1] - a[i])", "+ x = max(x, dis)", "+print((k - x))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2313908032, "measured_runtime_v1": 0.1406400898, "runtime_lift": 1.645269165, "key": ["s425361145", "s820245641"]} +{"user_id": "u021916304", "problem_id": "p02886", "language": "python", "submission_id_v0": "s631255245", "submission_id_v1": "s295881998", "cpu_time_v0": 21, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.05, "input": "def ii():return int(input())\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nans = 0\n\nfor i in range(n):\n\n for j in range(i+1,n):\n\n# print(i,j)\n\n ans += D[i]*D[j] \n\nprint(ans)", "target": "def ii():return int(input())\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nsumD = sum(D)\n\nans = 0\n\nfor i in range(n):\n\n ans += D[i]*(sum(D)-D[i])\n\nprint((ans//2))", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 352, "code_v1_num_chars": 325, "code_v0_no_empty_lines": "def ii():\n return int(input())\n\n\ndef iim():\n return list(map(int, input().split()))\n\n\ndef iil():\n return list(map(int, input().split()))\n\n\ndef ism():\n return list(map(str, input().split()))\n\n\ndef isl():\n return list(map(str, input().split()))\n\n\nn = ii()\nD = iil()\nans = 0\nfor i in range(n):\n for j in range(i + 1, n):\n # print(i,j)\n ans += D[i] * D[j]\nprint(ans)\n", "code_v1_no_empty_lines": "def ii():\n return int(input())\n\n\ndef iim():\n return list(map(int, input().split()))\n\n\ndef iil():\n return list(map(int, input().split()))\n\n\ndef ism():\n return list(map(str, input().split()))\n\n\ndef isl():\n return list(map(str, input().split()))\n\n\nn = ii()\nD = iil()\nsumD = sum(D)\nans = 0\nfor i in range(n):\n ans += D[i] * (sum(D) - D[i])\nprint((ans // 2))\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["+sumD = sum(D)", "- for j in range(i + 1, n):", "- # print(i,j)", "- ans += D[i] * D[j]", "-print(ans)", "+ ans += D[i] * (sum(D) - D[i])", "+print((ans // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2355280421, "measured_runtime_v1": 0.0063002633, "runtime_lift": 37.3838408874, "key": ["s631255245", "s295881998"]} +{"user_id": "u175034939", "problem_id": "p03353", "language": "python", "submission_id_v0": "s387813464", "submission_id_v1": "s460839958", "cpu_time_v0": 62, "cpu_time_v1": 40, "memory_v0": 5068, "memory_v1": 5068, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 35.48, "input": "S = input()\n\nK = int(input())\n\na = list(set(S))\n\na.sort()\n\n\n\nk = []\n\nl = 0\n\nwhile l < len(a):\n\n for i in range(len(S)):\n\n if S[i] == a[l]:\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n k.append(S[i:i+j])\n\n else:\n\n break\n\n l += 1\n\n\n\nk = list(set(k))\n\nk.sort()\n\nprint((k[K-1]))", "target": "S = input()\n\nK = int(input())\n\na = []\n\nfor i in range(len(S)+1):\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n a.append(S[i:i+j])\n\n else:\n\n break\n\n \n\na = list(set(a))\n\na.sort()\n\nprint((a[K-1]))", "code_v0_loc": 20, "code_v1_loc": 13, "code_v0_num_chars": 364, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "S = input()\nK = int(input())\na = list(set(S))\na.sort()\nk = []\nl = 0\nwhile l < len(a):\n for i in range(len(S)):\n if S[i] == a[l]:\n for j in range(1, 6):\n if i + j <= len(S):\n k.append(S[i : i + j])\n else:\n break\n l += 1\nk = list(set(k))\nk.sort()\nprint((k[K - 1]))\n", "code_v1_no_empty_lines": "S = input()\nK = int(input())\na = []\nfor i in range(len(S) + 1):\n for j in range(1, 6):\n if i + j <= len(S):\n a.append(S[i : i + j])\n else:\n break\na = list(set(a))\na.sort()\nprint((a[K - 1]))\n", "code_same": false, "relative_loc_diff_percent": 35.0, "diff": ["-a = list(set(S))", "+a = []", "+for i in range(len(S) + 1):", "+ for j in range(1, 6):", "+ if i + j <= len(S):", "+ a.append(S[i : i + j])", "+ else:", "+ break", "+a = list(set(a))", "-k = []", "-l = 0", "-while l < len(a):", "- for i in range(len(S)):", "- if S[i] == a[l]:", "- for j in range(1, 6):", "- if i + j <= len(S):", "- k.append(S[i : i + j])", "- else:", "- break", "- l += 1", "-k = list(set(k))", "-k.sort()", "-print((k[K - 1]))", "+print((a[K - 1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3274912031, "measured_runtime_v1": 0.2526222069, "runtime_lift": 1.2963674375, "key": ["s387813464", "s460839958"]} +{"user_id": "u653837719", "problem_id": "p02702", "language": "python", "submission_id_v0": "s121665958", "submission_id_v1": "s794197403", "cpu_time_v0": 113, "cpu_time_v1": 101, "memory_v0": 9288, "memory_v1": 9236, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.62, "input": "s = input()[::-1]\n\nl = len(s)\n\nc = [0] * 2019\n\nc[0] = 1\n\nten = 1\n\nmod = 0\n\nans = 0\n\n\n\nfor i in range(l):\n\n mod = (mod + int(s[i]) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) // 2\n\n\n\nprint(ans)", "target": "s = input()[::-1]\n\nc = [0] * 2019\n\nc[0] = 1\n\nmod = 0\n\nten = 1\n\nans = 0\n\n\n\nfor i in s:\n\n mod = (mod + int(i) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) // 2\n\n\n\nprint(ans)", "code_v0_loc": 17, "code_v1_loc": 16, "code_v0_num_chars": 248, "code_v1_num_chars": 226, "code_v0_no_empty_lines": "s = input()[::-1]\nl = len(s)\nc = [0] * 2019\nc[0] = 1\nten = 1\nmod = 0\nans = 0\nfor i in range(l):\n mod = (mod + int(s[i]) * ten) % 2019\n ten = ten * 10 % 2019\n c[mod] += 1\nfor i in c:\n ans += i * (i - 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "s = input()[::-1]\nc = [0] * 2019\nc[0] = 1\nmod = 0\nten = 1\nans = 0\nfor i in s:\n mod = (mod + int(i) * ten) % 2019\n ten = ten * 10 % 2019\n c[mod] += 1\nfor i in c:\n ans += i * (i - 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-l = len(s)", "+mod = 0", "-mod = 0", "-for i in range(l):", "- mod = (mod + int(s[i]) * ten) % 2019", "+for i in s:", "+ mod = (mod + int(i) * ten) % 2019"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2661841769, "measured_runtime_v1": 0.1600983288, "runtime_lift": 1.6626293282, "key": ["s121665958", "s794197403"]} +{"user_id": "u045939752", "problem_id": "p03814", "language": "python", "submission_id_v0": "s574890983", "submission_id_v1": "s839527046", "cpu_time_v0": 23, "cpu_time_v1": 18, "memory_v0": 3516, "memory_v1": 3500, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.74, "input": "S=input()\n\nprint((S.rfind('Z')-S.find('A')+1))", "target": "s=input().strip()\n\na = s.find('A')\n\nz = s.rfind('Z')\n\nprint((z-a+1))\n", "code_v0_loc": 2, "code_v1_loc": 4, "code_v0_num_chars": 44, "code_v1_num_chars": 67, "code_v0_no_empty_lines": "S = input()\nprint((S.rfind(\"Z\") - S.find(\"A\") + 1))\n", "code_v1_no_empty_lines": "s = input().strip()\na = s.find(\"A\")\nz = s.rfind(\"Z\")\nprint((z - a + 1))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-S = input()", "-print((S.rfind(\"Z\") - S.find(\"A\") + 1))", "+s = input().strip()", "+a = s.find(\"A\")", "+z = s.rfind(\"Z\")", "+print((z - a + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.286565238, "measured_runtime_v1": 0.2292430663, "runtime_lift": 1.2500497511, "key": ["s574890983", "s839527046"]} +{"user_id": "u183422236", "problem_id": "p02612", "language": "python", "submission_id_v0": "s828418851", "submission_id_v1": "s809335980", "cpu_time_v0": 81, "cpu_time_v1": 70, "memory_v0": 61540, "memory_v1": 61736, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.58, "input": "n = int(input()) % 1000\n\nif n == 0:\n\n print((0))\n\nelse:\n\n print((1000 - n))", "target": "n = int(input())\n\nprint(((1000 - n % 1000) % 1000))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 77, "code_v1_num_chars": 49, "code_v0_no_empty_lines": "n = int(input()) % 1000\nif n == 0:\n print((0))\nelse:\n print((1000 - n))\n", "code_v1_no_empty_lines": "n = int(input())\nprint(((1000 - n % 1000) % 1000))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-n = int(input()) % 1000", "-if n == 0:", "- print((0))", "-else:", "- print((1000 - n))", "+n = int(input())", "+print(((1000 - n % 1000) % 1000))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2545247498, "measured_runtime_v1": 0.1889497155, "runtime_lift": 1.3470501881, "key": ["s828418851", "s809335980"]} +{"user_id": "u912650255", "problem_id": "p02983", "language": "python", "submission_id_v0": "s074902378", "submission_id_v1": "s358904585", "cpu_time_v0": 618, "cpu_time_v1": 67, "memory_v0": 75568, "memory_v1": 6888, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 89.16, "input": "L ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nif R - L <= 2019:\n\n for i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n\n\nelse:\n\n for i in range(R-L-1010,R-L+1010):\n\n for j in range(i,R-L+1010):\n\n ans.append(i*j%2019)\n\n\n\nprint((min(ans)))\n", "target": "L ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nfor i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n if (i * j % 2019) == 0:\n\n break\n\n else:\n\n continue\n\n break\n\n\n\nprint((min(ans)))", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 297, "code_v1_num_chars": 237, "code_v0_no_empty_lines": "L, R = list(map(int, input().split()))\nans = []\nif R - L <= 2019:\n for i in range(L, R + 1):\n for j in range(i + 1, R + 1):\n ans.append(i * j % 2019)\nelse:\n for i in range(R - L - 1010, R - L + 1010):\n for j in range(i, R - L + 1010):\n ans.append(i * j % 2019)\nprint((min(ans)))\n", "code_v1_no_empty_lines": "L, R = list(map(int, input().split()))\nans = []\nfor i in range(L, R + 1):\n for j in range(i + 1, R + 1):\n ans.append(i * j % 2019)\n if (i * j % 2019) == 0:\n break\n else:\n continue\n break\nprint((min(ans)))\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-if R - L <= 2019:", "- for i in range(L, R + 1):", "- for j in range(i + 1, R + 1):", "- ans.append(i * j % 2019)", "-else:", "- for i in range(R - L - 1010, R - L + 1010):", "- for j in range(i, R - L + 1010):", "- ans.append(i * j % 2019)", "+for i in range(L, R + 1):", "+ for j in range(i + 1, R + 1):", "+ ans.append(i * j % 2019)", "+ if (i * j % 2019) == 0:", "+ break", "+ else:", "+ continue", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3668963638, "measured_runtime_v1": 0.2102679547, "runtime_lift": 1.7448990943, "key": ["s074902378", "s358904585"]} +{"user_id": "u622570247", "problem_id": "p02773", "language": "python", "submission_id_v0": "s074380513", "submission_id_v1": "s228830644", "cpu_time_v0": 1054, "cpu_time_v1": 898, "memory_v0": 45492, "memory_v1": 47732, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.8, "input": "from collections import Counter\n\nimport heapq\n\n\n\nn = int(input())\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\nheap = [(-v, k) for k, v in list(ctr.items())]\n\nheapq.heapify(heap)\n\nmaxv = heap[0][0]\n\nwhile heap:\n\n c = heapq.heappop(heap)\n\n if c[0] != maxv:\n\n break\n\n print((c[1]))\n", "target": "from collections import Counter\n\n\n\nn = int(input())\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\n\n\na = sorted([(-v, k) for k, v in list(ctr.items())])\n\nmaxv = a[0][0]\n\nfor i in range(len(a)):\n\n if a[i][0] != maxv:\n\n break\n\n print((a[i][1]))", "code_v0_loc": 16, "code_v1_loc": 14, "code_v0_num_chars": 325, "code_v1_num_chars": 282, "code_v0_no_empty_lines": "from collections import Counter\nimport heapq\n\nn = int(input())\nss = []\nfor _ in range(n):\n ss.append(input().rstrip())\nctr = Counter(ss)\nheap = [(-v, k) for k, v in list(ctr.items())]\nheapq.heapify(heap)\nmaxv = heap[0][0]\nwhile heap:\n c = heapq.heappop(heap)\n if c[0] != maxv:\n break\n print((c[1]))\n", "code_v1_no_empty_lines": "from collections import Counter\n\nn = int(input())\nss = []\nfor _ in range(n):\n ss.append(input().rstrip())\nctr = Counter(ss)\na = sorted([(-v, k) for k, v in list(ctr.items())])\nmaxv = a[0][0]\nfor i in range(len(a)):\n if a[i][0] != maxv:\n break\n print((a[i][1]))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-import heapq", "-heap = [(-v, k) for k, v in list(ctr.items())]", "-heapq.heapify(heap)", "-maxv = heap[0][0]", "-while heap:", "- c = heapq.heappop(heap)", "- if c[0] != maxv:", "+a = sorted([(-v, k) for k, v in list(ctr.items())])", "+maxv = a[0][0]", "+for i in range(len(a)):", "+ if a[i][0] != maxv:", "- print((c[1]))", "+ print((a[i][1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3121475418, "measured_runtime_v1": 0.0064239368, "runtime_lift": 48.5913153977, "key": ["s074380513", "s228830644"]} +{"user_id": "u428397309", "problem_id": "p03037", "language": "python", "submission_id_v0": "s058389905", "submission_id_v1": "s302443687", "cpu_time_v0": 285, "cpu_time_v1": 131, "memory_v0": 10868, "memory_v1": 10868, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.04, "input": "# -*- coding: utf-8 -*-\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nl = max(L)\n\nr = min(R)\n\n\n\nans = max(r - l + 1, 0)\n\n\n\nprint(ans)\n", "target": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nans = max(min(R) - max(L) + 1, 0)\n\n\n\nprint(ans)\n", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 222, "code_v1_num_chars": 248, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nN, M = list(map(int, input().split()))\nL, R = [None] * M, [None] * M\nfor i in range(M):\n L[i], R[i] = list(map(int, input().split()))\nl = max(L)\nr = min(R)\nans = max(r - l + 1, 0)\nprint(ans)\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nL, R = [None] * M, [None] * M\nfor i in range(M):\n L[i], R[i] = list(map(int, input().split()))\nans = max(min(R) - max(L) + 1, 0)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+import sys", "+", "+input = sys.stdin.readline", "-l = max(L)", "-r = min(R)", "-ans = max(r - l + 1, 0)", "+ans = max(min(R) - max(L) + 1, 0)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2363609416, "measured_runtime_v1": 0.0060358713, "runtime_lift": 39.1593741465, "key": ["s058389905", "s302443687"]} +{"user_id": "u756270013", "problem_id": "p02881", "language": "python", "submission_id_v0": "s868775809", "submission_id_v1": "s345973481", "cpu_time_v0": 439, "cpu_time_v1": 210, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.16, "input": "import math\n\ninput_num = int(input())\n\nnum_sqrt = int(math.sqrt(input_num))\n\n\n\nminimam = input_num\n\nfor i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n distance = q + i -2\n\n if mod == 0 and minimam > distance:\n\n minimam = distance\n\nprint(minimam)", "target": "import math\n\ndef main1():\n\n input_num = int(input())\n\n num_sqrt = int(math.sqrt(input_num))\n\n\n\n minimam = input_num\n\n for i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n if mod == 0:\n\n distance = q + i -2\n\n if minimam > distance:\n\n minimam = distance\n\n print(minimam)\n\nmain1()", "code_v0_loc": 11, "code_v1_loc": 14, "code_v0_num_chars": 277, "code_v1_num_chars": 357, "code_v0_no_empty_lines": "import math\n\ninput_num = int(input())\nnum_sqrt = int(math.sqrt(input_num))\nminimam = input_num\nfor i in range(num_sqrt + 1, 0, -1):\n q, mod = divmod(input_num, i)\n distance = q + i - 2\n if mod == 0 and minimam > distance:\n minimam = distance\nprint(minimam)\n", "code_v1_no_empty_lines": "import math\n\n\ndef main1():\n input_num = int(input())\n num_sqrt = int(math.sqrt(input_num))\n minimam = input_num\n for i in range(num_sqrt + 1, 0, -1):\n q, mod = divmod(input_num, i)\n if mod == 0:\n distance = q + i - 2\n if minimam > distance:\n minimam = distance\n print(minimam)\n\n\nmain1()\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-input_num = int(input())", "-num_sqrt = int(math.sqrt(input_num))", "-minimam = input_num", "-for i in range(num_sqrt + 1, 0, -1):", "- q, mod = divmod(input_num, i)", "- distance = q + i - 2", "- if mod == 0 and minimam > distance:", "- minimam = distance", "-print(minimam)", "+", "+def main1():", "+ input_num = int(input())", "+ num_sqrt = int(math.sqrt(input_num))", "+ minimam = input_num", "+ for i in range(num_sqrt + 1, 0, -1):", "+ q, mod = divmod(input_num, i)", "+ if mod == 0:", "+ distance = q + i - 2", "+ if minimam > distance:", "+ minimam = distance", "+ print(minimam)", "+", "+", "+main1()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.27158184, "measured_runtime_v1": 0.2170004892, "runtime_lift": 1.2515263951, "key": ["s868775809", "s345973481"]} +{"user_id": "u802963389", "problem_id": "p02881", "language": "python", "submission_id_v0": "s879601223", "submission_id_v1": "s706921267", "cpu_time_v0": 178, "cpu_time_v1": 148, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.85, "input": "# C - Walk on Multiplication Table\n\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\n\n\n\nn = int(input())\n\n\n\nans = 10 ** 12\n\nfor i in range(1, 10 ** 6 + 1):\n\n if n % i == 0:\n\n ans = min(ans, n // i + i)\n\n\n\nprint((ans - 2))", "target": "# C - Walk on Multiplication Table\n\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\n\n\n\nn = int(input())\n\n\n\nans = n\n\nfor i in range(1, int(n**.5) + 2):\n\n if n % i == 0:\n\n ans = min(ans, n // i + i - 2)\n\n\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 226, "code_v1_num_chars": 222, "code_v0_no_empty_lines": "# C - Walk on Multiplication Table\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\nn = int(input())\nans = 10**12\nfor i in range(1, 10**6 + 1):\n if n % i == 0:\n ans = min(ans, n // i + i)\nprint((ans - 2))\n", "code_v1_no_empty_lines": "# C - Walk on Multiplication Table\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\nn = int(input())\nans = n\nfor i in range(1, int(n**0.5) + 2):\n if n % i == 0:\n ans = min(ans, n // i + i - 2)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-ans = 10**12", "-for i in range(1, 10**6 + 1):", "+ans = n", "+for i in range(1, int(n**0.5) + 2):", "- ans = min(ans, n // i + i)", "-print((ans - 2))", "+ ans = min(ans, n // i + i - 2)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0824642203, "measured_runtime_v1": 0.2210092547, "runtime_lift": 4.8978230425, "key": ["s879601223", "s706921267"]} +{"user_id": "u077291787", "problem_id": "p04020", "language": "python", "submission_id_v0": "s648607888", "submission_id_v1": "s112859245", "cpu_time_v0": 58, "cpu_time_v1": 46, "memory_v0": 14252, "memory_v1": 14092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.69, "input": "# AGC003B - Simplified mahjong\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur // 2\n\n N = int(input())\n\n A = list(map(int, [input() for _ in range(N)])) + [0]\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur // 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "# AGC003B - Simplified mahjong\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur // 2\n\n N, *A = list(map(int, open(0).read().split()))\n\n A.append(0)\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur // 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 429, "code_v1_num_chars": 369, "code_v0_no_empty_lines": "# AGC003B - Simplified mahjong\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n # split in subsequences when 0 appears -> sum up cur // 2\n N = int(input())\n A = list(map(int, [input() for _ in range(N)])) + [0]\n ans, cur = 0, 0\n for i in A:\n if i:\n cur += i\n else:\n ans += cur // 2\n cur = 0\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# AGC003B - Simplified mahjong\ndef main():\n # split in subsequences when 0 appears -> sum up cur // 2\n N, *A = list(map(int, open(0).read().split()))\n A.append(0)\n ans, cur = 0, 0\n for i in A:\n if i:\n cur += i\n else:\n ans += cur // 2\n cur = 0\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-", "-", "- N = int(input())", "- A = list(map(int, [input() for _ in range(N)])) + [0]", "+ N, *A = list(map(int, open(0).read().split()))", "+ A.append(0)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.282343082, "measured_runtime_v1": 0.1984000847, "runtime_lift": 1.4230996042, "key": ["s648607888", "s112859245"]} +{"user_id": "u131984977", "problem_id": "p02412", "language": "python", "submission_id_v0": "s229334190", "submission_id_v1": "s721700065", "cpu_time_v0": 1150, "cpu_time_v1": 900, "memory_v0": 6724, "memory_v1": 6720, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.74, "input": "while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for a in range(1, n + 1):\n\n for b in range(a + 1, n + 1):\n\n for c in range(b + 1, n + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)", "target": "while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n limit = n if n < x else x\n\n for a in range(1, limit + 1):\n\n for b in range(a + 1, limit + 1):\n\n for c in range(b + 1, limit + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)", "code_v0_loc": 13, "code_v1_loc": 14, "code_v0_num_chars": 316, "code_v1_num_chars": 359, "code_v0_no_empty_lines": "while True:\n (n, x) = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for a in range(1, n + 1):\n for b in range(a + 1, n + 1):\n for c in range(b + 1, n + 1):\n if sum([a, b, c]) == x:\n count += 1\n print(count)\n", "code_v1_no_empty_lines": "while True:\n (n, x) = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n limit = n if n < x else x\n for a in range(1, limit + 1):\n for b in range(a + 1, limit + 1):\n for c in range(b + 1, limit + 1):\n if sum([a, b, c]) == x:\n count += 1\n print(count)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["- for a in range(1, n + 1):", "- for b in range(a + 1, n + 1):", "- for c in range(b + 1, n + 1):", "+ limit = n if n < x else x", "+ for a in range(1, limit + 1):", "+ for b in range(a + 1, limit + 1):", "+ for c in range(b + 1, limit + 1):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2860648324, "measured_runtime_v1": 0.2158536868, "runtime_lift": 1.3252719315, "key": ["s229334190", "s721700065"]} +{"user_id": "u562935282", "problem_id": "p03371", "language": "python", "submission_id_v0": "s168362535", "submission_id_v1": "s471284270", "cpu_time_v0": 242, "cpu_time_v1": 98, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.5, "input": "inf = (5000 * 10 ** 5) * 3\n\n\n\na, b, c, x, y = list(map(int, input().split()))\n\n\n\nret = inf\n\nfor cnt_ab in range(max(x, y) * 2 + 1):\n\n d = cnt_ab // 2\n\n\n\n cnt_a = max(0, x - d)\n\n cnt_b = max(0, y - d)\n\n\n\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n\n ret = min(ret, t)\n\nprint(ret)\n", "target": "def main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 14, "code_v1_loc": 20, "code_v0_num_chars": 284, "code_v1_num_chars": 353, "code_v0_no_empty_lines": "inf = (5000 * 10**5) * 3\na, b, c, x, y = list(map(int, input().split()))\nret = inf\nfor cnt_ab in range(max(x, y) * 2 + 1):\n d = cnt_ab // 2\n cnt_a = max(0, x - d)\n cnt_b = max(0, y - d)\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n ret = min(ret, t)\nprint(ret)\n", "code_v1_no_empty_lines": "def main():\n A, B, AB, X, Y = list(map(int, input().split()))\n M = max(X, Y)\n k = 0\n ans = A * X + B * Y\n while True:\n ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)\n if k >= M:\n break\n k += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-inf = (5000 * 10**5) * 3", "-a, b, c, x, y = list(map(int, input().split()))", "-ret = inf", "-for cnt_ab in range(max(x, y) * 2 + 1):", "- d = cnt_ab // 2", "- cnt_a = max(0, x - d)", "- cnt_b = max(0, y - d)", "- t = cnt_ab * c + cnt_a * a + cnt_b * b", "- ret = min(ret, t)", "-print(ret)", "+def main():", "+ A, B, AB, X, Y = list(map(int, input().split()))", "+ M = max(X, Y)", "+ k = 0", "+ ans = A * X + B * Y", "+ while True:", "+ ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)", "+ if k >= M:", "+ break", "+ k += 1", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4937371187, "measured_runtime_v1": 0.3021148317, "runtime_lift": 1.6342697111, "key": ["s168362535", "s471284270"]} +{"user_id": "u349449706", "problem_id": "p02555", "language": "python", "submission_id_v0": "s796837031", "submission_id_v1": "s077713004", "cpu_time_v0": 96, "cpu_time_v1": 64, "memory_v0": 68168, "memory_v1": 63448, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "S = int(input())\n\nf = [0]*(S+1)\n\nf[0] = 1\n\nif S >= 3: f[3] = 1\n\nif S >= 4: f[4] = 1\n\nif S >= 5: f[5] = 1\n\nfor i in range(6, S+1):\n\n f[i] = sum(f[i-j] for j in range(3, i+1))%(10**9+7)\n\nprint((f[S]))\n", "target": "S=int(input())\n\nf=[1,0,0]\n\nfor i in range(S-2):f.append(f[i]+f[i+2])\n\nprint((f[S]%(10**9+7)))\n", "code_v0_loc": 9, "code_v1_loc": 4, "code_v0_num_chars": 200, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "S = int(input())\nf = [0] * (S + 1)\nf[0] = 1\nif S >= 3:\n f[3] = 1\nif S >= 4:\n f[4] = 1\nif S >= 5:\n f[5] = 1\nfor i in range(6, S + 1):\n f[i] = sum(f[i - j] for j in range(3, i + 1)) % (10**9 + 7)\nprint((f[S]))\n", "code_v1_no_empty_lines": "S = int(input())\nf = [1, 0, 0]\nfor i in range(S - 2):\n f.append(f[i] + f[i + 2])\nprint((f[S] % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-f = [0] * (S + 1)", "-f[0] = 1", "-if S >= 3:", "- f[3] = 1", "-if S >= 4:", "- f[4] = 1", "-if S >= 5:", "- f[5] = 1", "-for i in range(6, S + 1):", "- f[i] = sum(f[i - j] for j in range(3, i + 1)) % (10**9 + 7)", "-print((f[S]))", "+f = [1, 0, 0]", "+for i in range(S - 2):", "+ f.append(f[i] + f[i + 2])", "+print((f[S] % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5486869376, "measured_runtime_v1": 0.341561399, "runtime_lift": 1.6064079231, "key": ["s796837031", "s077713004"]} +{"user_id": "u752898745", "problem_id": "p03307", "language": "python", "submission_id_v0": "s632972821", "submission_id_v1": "s560495025", "cpu_time_v0": 37, "cpu_time_v1": 17, "memory_v0": 5304, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.05, "input": "import math\n\nn=int(input())\n\nprint(((2*n)//math.gcd(2,n)))", "target": "N=int(input());print((N if N%2==0 else N*2))", "code_v0_loc": 3, "code_v1_loc": 1, "code_v0_num_chars": 66, "code_v1_num_chars": 42, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint(((2 * n) // math.gcd(2, n)))\n", "code_v1_no_empty_lines": "N = int(input())\nprint((N if N % 2 == 0 else N * 2))\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-n = int(input())", "-print(((2 * n) // math.gcd(2, n)))", "+N = int(input())", "+print((N if N % 2 == 0 else N * 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4506682441, "measured_runtime_v1": 0.3598311198, "runtime_lift": 1.2524437697, "key": ["s632972821", "s560495025"]} +{"user_id": "u347640436", "problem_id": "p03854", "language": "python", "submission_id_v0": "s259161069", "submission_id_v1": "s688102427", "cpu_time_v0": 1216, "cpu_time_v1": 697, "memory_v0": 3420, "memory_v1": 3992, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.68, "input": "import sys\n\ns = input()\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n if s == t + w:\n\n print('YES')\n\n sys.exit()\n\n if s.startswith(t + w):\n\n nts.append(t + w)\n\n if len(nts) == 0:\n\n print('NO')\n\n sys.exit()\n\n ts = nts\n", "target": "from sys import exit\n\ns = input()\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n tw = t + w\n\n if s == tw:\n\n print('YES')\n\n exit()\n\n if s.startswith(tw):\n\n nts.append(tw)\n\n if len(nts) == 0:\n\n print('NO')\n\n exit()\n\n ts = nts\n", "code_v0_loc": 16, "code_v1_loc": 17, "code_v0_num_chars": 320, "code_v1_num_chars": 329, "code_v0_no_empty_lines": "import sys\n\ns = input()\nts = [\"\"]\nwhile True:\n nts = []\n for t in ts:\n for w in [\"dreamer\", \"eraser\", \"dream\", \"erase\"]:\n if s == t + w:\n print(\"YES\")\n sys.exit()\n if s.startswith(t + w):\n nts.append(t + w)\n if len(nts) == 0:\n print(\"NO\")\n sys.exit()\n ts = nts\n", "code_v1_no_empty_lines": "from sys import exit\n\ns = input()\nts = [\"\"]\nwhile True:\n nts = []\n for t in ts:\n for w in [\"dreamer\", \"eraser\", \"dream\", \"erase\"]:\n tw = t + w\n if s == tw:\n print(\"YES\")\n exit()\n if s.startswith(tw):\n nts.append(tw)\n if len(nts) == 0:\n print(\"NO\")\n exit()\n ts = nts\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-import sys", "+from sys import exit", "-s = input()", "+s = input()", "- if s == t + w:", "+ tw = t + w", "+ if s == tw:", "- sys.exit()", "- if s.startswith(t + w):", "- nts.append(t + w)", "+ exit()", "+ if s.startswith(tw):", "+ nts.append(tw)", "- sys.exit()", "+ exit()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2929967599, "measured_runtime_v1": 0.1979754126, "runtime_lift": 1.4799653958, "key": ["s259161069", "s688102427"]} +{"user_id": "u584658281", "problem_id": "p02688", "language": "python", "submission_id_v0": "s600438109", "submission_id_v1": "s928531547", "cpu_time_v0": 27, "cpu_time_v1": 24, "memory_v0": 9216, "memory_v1": 9264, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.11, "input": "N,K=list(map(int,input().split()))\n\na = [[0]*N]*K\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(input())\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)", "target": "N,K=list(map(int,input().split()))\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(input())\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)", "code_v0_loc": 21, "code_v1_loc": 20, "code_v0_num_chars": 365, "code_v1_num_chars": 350, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\na = [[0] * N] * K\na = [[0 for n in range(N)] for k in range(K)]\nfor k in range(K):\n d = int(input())\n have_k = list(map(int, input().split()))\n for h in have_k:\n a[k][h - 1] = 1\nan = [0] * N\nfor k in range(K):\n for n in range(N):\n an[n] = an[n] + a[k][n]\nresult = 0\nfor i in an:\n if i == 0:\n result += 1\nprint(result)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\na = [[0 for n in range(N)] for k in range(K)]\nfor k in range(K):\n d = int(input())\n have_k = list(map(int, input().split()))\n for h in have_k:\n a[k][h - 1] = 1\nan = [0] * N\nfor k in range(K):\n for n in range(N):\n an[n] = an[n] + a[k][n]\nresult = 0\nfor i in an:\n if i == 0:\n result += 1\nprint(result)\n", "code_same": false, "relative_loc_diff_percent": 4.7619047619, "diff": ["-a = [[0] * N] * K"], "diff_only_import_comment": false, "measured_runtime_v0": 0.33595281, "measured_runtime_v1": 0.2656919487, "runtime_lift": 1.264444827, "key": ["s600438109", "s928531547"]} +{"user_id": "u163320134", "problem_id": "p03037", "language": "python", "submission_id_v0": "s012458960", "submission_id_v1": "s740832114", "cpu_time_v0": 351, "cpu_time_v1": 278, "memory_v0": 6900, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.8, "input": "n,m=list(map(int,input().split()))\n\nc=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n c[l-1]+=1\n\n c[r]-=1\n\nfor i in range(1,n+2):\n\n c[i]=c[i]+c[i-1]\n\nans=0\n\nfor i in range(n+2):\n\n if c[i]==m:\n\n ans+=1\n\nprint(ans)", "target": "n,m=list(map(int,input().split()))\n\nl,r=list(map(int,input().split()))\n\nfor i in range(m-1):\n\n tl,tr=list(map(int,input().split()))\n\n if l=0:\n\n ans+=k[i-a[i]]\n\n if a[i]+i<400005:\n\n k[a[i]+i]+=1\n\nprint(ans)", "target": "n=int(input())\n\na=list(map(int,input().split()))\n\nthing={}\n\nans=0\n\nfor i in range(n):\n\n if i-a[i] in thing:\n\n ans+=thing[i-a[i]]\n\n if i+a[i] in thing:\n\n thing[i+a[i]]+=1\n\n else:\n\n thing[i+a[i]]=1\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 12, "code_v0_num_chars": 209, "code_v1_num_chars": 219, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nk = []\nans = 0\nfor i in range(400005):\n k.append(0)\nfor i in range(n):\n if i - a[i] >= 0:\n ans += k[i - a[i]]\n if a[i] + i < 400005:\n k[a[i] + i] += 1\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nthing = {}\nans = 0\nfor i in range(n):\n if i - a[i] in thing:\n ans += thing[i - a[i]]\n if i + a[i] in thing:\n thing[i + a[i]] += 1\n else:\n thing[i + a[i]] = 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-k = []", "+thing = {}", "-for i in range(400005):", "- k.append(0)", "- if i - a[i] >= 0:", "- ans += k[i - a[i]]", "- if a[i] + i < 400005:", "- k[a[i] + i] += 1", "+ if i - a[i] in thing:", "+ ans += thing[i - a[i]]", "+ if i + a[i] in thing:", "+ thing[i + a[i]] += 1", "+ else:", "+ thing[i + a[i]] = 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5354380305, "measured_runtime_v1": 0.0057934456, "runtime_lift": 92.4213443454, "key": ["s021965299", "s412762136"]} diff --git a/python_splits/test_verified.target_bucket_subsets/256_512.jsonl b/python_splits/test_verified.target_bucket_subsets/256_512.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..4a3d1a01ce96681fc2822fc7b2860425ddecc9ae --- /dev/null +++ b/python_splits/test_verified.target_bucket_subsets/256_512.jsonl @@ -0,0 +1,55 @@ +{"user_id": "u056277698", "problem_id": "p03078", "language": "python", "submission_id_v0": "s581139547", "submission_id_v1": "s213757381", "cpu_time_v0": 104, "cpu_time_v1": 36, "memory_v0": 8708, "memory_v1": 4976, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.38, "input": "# -*- coding: utf-8 -*-\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nabc = []\n\n\n\nfor i, _a in enumerate(a):\n\n for j, _b in enumerate(b):\n\n if (i+1) * (j+1) > k:\n\n break\n\n for l, _c in enumerate(c):\n\n if (i+1) * (j+1) * (l+1) > k:\n\n break\n\n abc.append(_a + _b + _c)\n\n\n\nabc.sort(reverse=True)\n\nfor x in abc[:k]:\n\n print(x)\n", "target": "# -*- coding: utf-8 -*-\n\nimport heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\nla, lb, lc = len(a), len(b), len(c)\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nfix = set()\n\n\n\nq = [(-(a[0]+b[0]+c[0]), 0, 0, 0)]\n\n\n\nfor _ in range(k):\n\n abc, i, j, l = heapq.heappop(q)\n\n print((-abc))\n\n\n\n if i+1 < la and (i+1, j, l) not in fix:\n\n heapq.heappush(q, (-(a[i+1]+b[j]+c[l]), i+1, j, l))\n\n fix.add((i+1, j, l))\n\n\n\n if j+1 < lb and (i, j+1, l) not in fix:\n\n heapq.heappush(q, (-(a[i]+b[j+1]+c[l]), i, j+1, l))\n\n fix.add((i, j+1, l))\n\n\n\n if l+1 < lc and (i, j, l+1) not in fix:\n\n heapq.heappush(q, (-(a[i]+b[j]+c[l+1]), i, j, l+1))\n\n fix.add((i, j, l+1))\n", "code_v0_loc": 24, "code_v1_loc": 33, "code_v0_num_chars": 566, "code_v1_num_chars": 841, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nabc = []\nfor i, _a in enumerate(a):\n for j, _b in enumerate(b):\n if (i + 1) * (j + 1) > k:\n break\n for l, _c in enumerate(c):\n if (i + 1) * (j + 1) * (l + 1) > k:\n break\n abc.append(_a + _b + _c)\nabc.sort(reverse=True)\nfor x in abc[:k]:\n print(x)\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport heapq\n\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\nla, lb, lc = len(a), len(b), len(c)\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nfix = set()\nq = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]\nfor _ in range(k):\n abc, i, j, l = heapq.heappop(q)\n print((-abc))\n if i + 1 < la and (i + 1, j, l) not in fix:\n heapq.heappush(q, (-(a[i + 1] + b[j] + c[l]), i + 1, j, l))\n fix.add((i + 1, j, l))\n if j + 1 < lb and (i, j + 1, l) not in fix:\n heapq.heappush(q, (-(a[i] + b[j + 1] + c[l]), i, j + 1, l))\n fix.add((i, j + 1, l))\n if l + 1 < lc and (i, j, l + 1) not in fix:\n heapq.heappush(q, (-(a[i] + b[j] + c[l + 1]), i, j, l + 1))\n fix.add((i, j, l + 1))\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["+import heapq", "+", "+la, lb, lc = len(a), len(b), len(c)", "-abc = []", "-for i, _a in enumerate(a):", "- for j, _b in enumerate(b):", "- if (i + 1) * (j + 1) > k:", "- break", "- for l, _c in enumerate(c):", "- if (i + 1) * (j + 1) * (l + 1) > k:", "- break", "- abc.append(_a + _b + _c)", "-abc.sort(reverse=True)", "-for x in abc[:k]:", "- print(x)", "+fix = set()", "+q = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]", "+for _ in range(k):", "+ abc, i, j, l = heapq.heappop(q)", "+ print((-abc))", "+ if i + 1 < la and (i + 1, j, l) not in fix:", "+ heapq.heappush(q, (-(a[i + 1] + b[j] + c[l]), i + 1, j, l))", "+ fix.add((i + 1, j, l))", "+ if j + 1 < lb and (i, j + 1, l) not in fix:", "+ heapq.heappush(q, (-(a[i] + b[j + 1] + c[l]), i, j + 1, l))", "+ fix.add((i, j + 1, l))", "+ if l + 1 < lc and (i, j, l + 1) not in fix:", "+ heapq.heappush(q, (-(a[i] + b[j] + c[l + 1]), i, j, l + 1))", "+ fix.add((i, j, l + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4343315315, "measured_runtime_v1": 0.2096420834, "runtime_lift": 2.0717764508, "key": ["s581139547", "s213757381"]} +{"user_id": "u127499732", "problem_id": "p03608", "language": "python", "submission_id_v0": "s266235653", "submission_id_v1": "s503227515", "cpu_time_v0": 246, "cpu_time_v1": 190, "memory_v0": 83588, "memory_v1": 83656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.76, "input": "def main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = float(\"Inf\")\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[10 ** 8] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = 10 ** 8\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 34, "code_v1_loc": 34, "code_v0_num_chars": 771, "code_v1_num_chars": 761, "code_v0_no_empty_lines": "def main():\n from itertools import permutations\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n to = x[:r]\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n for i in range(1, n + 1):\n dis[i][i] = 0\n for a, b, c in zip(*[iter(x[r:])] * 3):\n dis[a][b] = c\n dis[b][a] = c\n for k in range(1, n + 1):\n for i in range(1, n + 1):\n for j in range(1, n + 1):\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n ans = float(\"Inf\")\n for p in permutations(to):\n tmp = 0\n nw = p[0]\n for nx in p[1:]:\n tmp += dis[nw][nx]\n nw = nx\n ans = min(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n from itertools import permutations\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n to = x[:r]\n dis = [[10**8] * (n + 1) for _ in range(n + 1)]\n for i in range(1, n + 1):\n dis[i][i] = 0\n for a, b, c in zip(*[iter(x[r:])] * 3):\n dis[a][b] = c\n dis[b][a] = c\n for k in range(1, n + 1):\n for i in range(1, n + 1):\n for j in range(1, n + 1):\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n ans = 10**8\n for p in permutations(to):\n tmp = 0\n nw = p[0]\n for nx in p[1:]:\n tmp += dis[nw][nx]\n nw = nx\n ans = min(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]", "+ dis = [[10**8] * (n + 1) for _ in range(n + 1)]", "- ans = float(\"Inf\")", "+ ans = 10**8"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3828251469, "measured_runtime_v1": 0.1865792952, "runtime_lift": 2.0518093745, "key": ["s266235653", "s503227515"]} +{"user_id": "u279493135", "problem_id": "p02555", "language": "python", "submission_id_v0": "s706729835", "submission_id_v1": "s005580579", "cpu_time_v0": 319, "cpu_time_v1": 39, "memory_v0": 10348, "memory_v1": 11860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.77, "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n for i in range(x-2):\n\n ret += rec(i)\n\n ret %= mod\n\n return ret\n\n\n\nprint((rec(S)))\n", "target": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n if x >= 3:\n\n return (rec(x-1)+rec(x-3))%mod\n\n else:\n\n return 0\n\n\n\nprint((rec(S)))\n", "code_v0_loc": 32, "code_v1_loc": 32, "code_v0_num_chars": 996, "code_v1_num_chars": 996, "code_v0_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n product,\n groupby,\n combinations_with_replacement,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nS = INT()\n\n\n@lru_cache(maxsize=None)\ndef rec(x):\n if x == 0:\n return 1\n ret = 0\n for i in range(x - 2):\n ret += rec(i)\n ret %= mod\n return ret\n\n\nprint((rec(S)))\n", "code_v1_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n product,\n groupby,\n combinations_with_replacement,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nS = INT()\n\n\n@lru_cache(maxsize=None)\ndef rec(x):\n if x == 0:\n return 1\n ret = 0\n if x >= 3:\n return (rec(x - 1) + rec(x - 3)) % mod\n else:\n return 0\n\n\nprint((rec(S)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- for i in range(x - 2):", "- ret += rec(i)", "- ret %= mod", "- return ret", "+ if x >= 3:", "+ return (rec(x - 1) + rec(x - 3)) % mod", "+ else:", "+ return 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4423550682, "measured_runtime_v1": 0.2103828435, "runtime_lift": 2.1026194952, "key": ["s706729835", "s005580579"]} +{"user_id": "u227082700", "problem_id": "p02834", "language": "python", "submission_id_v0": "s854767798", "submission_id_v1": "s662268715", "cpu_time_v0": 780, "cpu_time_v1": 670, "memory_v0": 84508, "memory_v1": 38312, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.1, "input": "n,u,v=list(map(int,input().split()))\n\nanss=0\n\nu-=1\n\nv-=1\n\nd=[[]for _ in range(n)]\n\ninf=float('inf')\n\naoki=[inf]*n\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n d[a].append(b)\n\n d[b].append(a)\n\nQ=d[v]\n\naoki[v]=0\n\ndis=1\n\nvisited={v}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n aoki[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[u]\n\nchokudai=[-1]*n\n\nchokudai[u]=0\n\ndis=1\n\nvisited={u}\n\npoint=-1\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if aoki[j]<=dis+1:\n\n if aoki[j]==dis+1:anss=1\n\n if point<0:point=i\n\n continue\n\n if j not in visited:P.append(j)\n\n chokudai[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[point]\n\ndis=chokudai[point]+1\n\nvisited={point}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n if chokudai[i]==-1:continue\n\n chokudai[i]=max(dis,chokudai[i])\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n dis+=1\n\n Q=P\n\nans=0\n\nfor i in range(n):\n\n if aoki[i]>chokudai[i]:ans=max(ans,chokudai[i])\n\nprint((ans+anss))\n\n#print(aoki)\n\n#print(chokudai)", "target": "n,u,v=list(map(int,input().split()))\n\nu-=1\n\nv-=1\n\ne=[[]for _ in range(n)]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n e[a].append(b)\n\n e[b].append(a)\n\ncho=[u]\n\ncho_dis=[10**7]*n\n\ncho_dis[u]=0\n\ncho_visited={u}\n\ncountt=1\n\nwhile cho:\n\n CHO=[]\n\n for i in cho:\n\n for j in e[i]:\n\n if j in cho_visited:continue\n\n cho_visited.add(j)\n\n CHO.append(j)\n\n cho_dis[j]=countt\n\n countt+=1\n\n cho=CHO\n\naok=[v]\n\naok_dis=[10**7]*n\n\naok_dis[v]=0\n\naok_visited={v}\n\ncountt=1\n\nwhile aok:\n\n AOK=[]\n\n for i in aok:\n\n for j in e[i]:\n\n if j in aok_visited:continue\n\n aok_visited.add(j)\n\n AOK.append(j)\n\n aok_dis[j]=countt\n\n countt+=1\n\n aok=AOK\n\nans=0\n\nfor i in range(n):\n\n if cho_dis[i] chokudai[i]:\n ans = max(ans, chokudai[i])\nprint((ans + anss))\n# print(aoki)\n# print(chokudai)\n", "code_v1_no_empty_lines": "n, u, v = list(map(int, input().split()))\nu -= 1\nv -= 1\ne = [[] for _ in range(n)]\nfor i in range(n - 1):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n e[a].append(b)\n e[b].append(a)\ncho = [u]\ncho_dis = [10**7] * n\ncho_dis[u] = 0\ncho_visited = {u}\ncountt = 1\nwhile cho:\n CHO = []\n for i in cho:\n for j in e[i]:\n if j in cho_visited:\n continue\n cho_visited.add(j)\n CHO.append(j)\n cho_dis[j] = countt\n countt += 1\n cho = CHO\naok = [v]\naok_dis = [10**7] * n\naok_dis[v] = 0\naok_visited = {v}\ncountt = 1\nwhile aok:\n AOK = []\n for i in aok:\n for j in e[i]:\n if j in aok_visited:\n continue\n aok_visited.add(j)\n AOK.append(j)\n aok_dis[j] = countt\n countt += 1\n aok = AOK\nans = 0\nfor i in range(n):\n if cho_dis[i] < aok_dis[i]:\n ans = max(ans, aok_dis[i] - 1)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 31.25, "diff": ["-anss = 0", "-d = [[] for _ in range(n)]", "-inf = float(\"inf\")", "-aoki = [inf] * n", "+e = [[] for _ in range(n)]", "- d[a].append(b)", "- d[b].append(a)", "-Q = d[v]", "-aoki[v] = 0", "-dis = 1", "-visited = {v}", "-while Q:", "- P = []", "- for i in Q:", "- visited.add(i)", "- for j in d[i]:", "- if j not in visited:", "- P.append(j)", "- aoki[i] = dis", "- dis += 1", "- Q = P", "-Q = d[u]", "-chokudai = [-1] * n", "-chokudai[u] = 0", "-dis = 1", "-visited = {u}", "-point = -1", "-while Q:", "- P = []", "- for i in Q:", "- visited.add(i)", "- for j in d[i]:", "- if aoki[j] <= dis + 1:", "- if aoki[j] == dis + 1:", "- anss = 1", "- if point < 0:", "- point = i", "+ e[a].append(b)", "+ e[b].append(a)", "+cho = [u]", "+cho_dis = [10**7] * n", "+cho_dis[u] = 0", "+cho_visited = {u}", "+countt = 1", "+while cho:", "+ CHO = []", "+ for i in cho:", "+ for j in e[i]:", "+ if j in cho_visited:", "- if j not in visited:", "- P.append(j)", "- chokudai[i] = dis", "- dis += 1", "- Q = P", "-Q = d[point]", "-dis = chokudai[point] + 1", "-visited = {point}", "-while Q:", "- P = []", "- for i in Q:", "- visited.add(i)", "- if chokudai[i] == -1:", "- continue", "- chokudai[i] = max(dis, chokudai[i])", "- for j in d[i]:", "- if j not in visited:", "- P.append(j)", "- dis += 1", "- Q = P", "+ cho_visited.add(j)", "+ CHO.append(j)", "+ cho_dis[j] = countt", "+ countt += 1", "+ cho = CHO", "+aok = [v]", "+aok_dis = [10**7] * n", "+aok_dis[v] = 0", "+aok_visited = {v}", "+countt = 1", "+while aok:", "+ AOK = []", "+ for i in aok:", "+ for j in e[i]:", "+ if j in aok_visited:", "+ continue", "+ aok_visited.add(j)", "+ AOK.append(j)", "+ aok_dis[j] = countt", "+ countt += 1", "+ aok = AOK", "- if aoki[i] > chokudai[i]:", "- ans = max(ans, chokudai[i])", "-print((ans + anss))", "-# print(aoki)", "-# print(chokudai)", "+ if cho_dis[i] < aok_dis[i]:", "+ ans = max(ans, aok_dis[i] - 1)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2686464586, "measured_runtime_v1": 0.0699197628, "runtime_lift": 3.842210666, "key": ["s854767798", "s662268715"]} +{"user_id": "u311379832", "problem_id": "p02537", "language": "python", "submission_id_v0": "s277145927", "submission_id_v1": "s770419806", "cpu_time_v0": 790, "cpu_time_v1": 668, "memory_v0": 119112, "memory_v1": 103304, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.44, "input": "def segfunc(x, y): return max(x, y)\n\n\n\nclass SegmentTree:\n\n def __init__(self, arr):\n\n size = len(arr)\n\n n = 2 ** (size - 1).bit_length()\n\n self.n = n\n\n self.node = [0] * (2*n)\n\n for i in range(size):\n\n self.node[i+n-1] = arr[i]\n\n for i in reversed(list(range(n-2))):\n\n self.node[i] = segfunc(self.node[2*i+1], self.node[2*i+2])\n\n\n\n def update(self, i, x):\n\n i += self.n - 1\n\n self.node[i] = x\n\n while i > 0:\n\n i = (i - 1) // 2\n\n self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])\n\n\n\n def update(self, x, val):\n\n x += (self.n - 1)\n\n self.node[x] = val\n\n while x > 0:\n\n x = (x - 1) // 2\n\n self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])\n\n\n\n def query(self, a, b):\n\n res = 0\n\n l = self.n - 1 + a\n\n r = self.n - 1 + (b - 1)\n\n\n\n while l <= r:\n\n if l == r:\n\n res = segfunc(res, self.node[l])\n\n break\n\n\n\n if l % 2 == 0:\n\n res = segfunc(res, self.node[l])\n\n if r % 2 == 1:\n\n res = segfunc(res, self.node[r])\n\n l = l // 2\n\n r = r // 2 - 1\n\n\n\n return res\n\n\n\nN, K = list(map(int, input().split()))\n\nINF = 0\n\nseg = SegmentTree([0] * 300000)\n\nfor i in range(N):\n\n a = int(input())\n\n tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1\n\n seg.update(a, tmp)\n\nprint((seg.query(0, 300000)))\n", "target": "def segfunc(x, y): return max(x, y)\n\ndef update(i, x):\n\n i += MAX_N-1\n\n node[i] = x\n\n while i:\n\n i = (i-1)//2\n\n node[i] = segfunc(node[i*2+1], node[i*2+2])\n\n\n\ndef query(l, r):\n\n L = l + MAX_N\n\n R = r + MAX_N\n\n s = INF\n\n while L < R:\n\n if R & 1:\n\n R -= 1\n\n s = segfunc(s, node[R - 1])\n\n if L & 1:\n\n s = segfunc(s, node[L - 1])\n\n L += 1\n\n L >>= 1\n\n R >>= 1\n\n return s\n\n\n\nN, K = list(map(int, input().split()))\n\nMAX_N = 2**(300005).bit_length()\n\na = [int(input()) for _ in range(N)]\n\nnode = [0] * (2 * MAX_N)\n\nINF = 0\n\nans = 0\n\n\n\n#for i in range(N):\n\n# update(i, a[i])\n\n\n\nfor i in a:\n\n tmp = query(max(i - K, 0), min(300005, i + K) + 1)\n\n update(i, tmp + 1)\n\n ans = max(ans, tmp + 1)\n\nprint(ans)\n", "code_v0_loc": 54, "code_v1_loc": 38, "code_v0_num_chars": 1524, "code_v1_num_chars": 809, "code_v0_no_empty_lines": "def segfunc(x, y):\n return max(x, y)\n\n\nclass SegmentTree:\n def __init__(self, arr):\n size = len(arr)\n n = 2 ** (size - 1).bit_length()\n self.n = n\n self.node = [0] * (2 * n)\n for i in range(size):\n self.node[i + n - 1] = arr[i]\n for i in reversed(list(range(n - 2))):\n self.node[i] = segfunc(self.node[2 * i + 1], self.node[2 * i + 2])\n\n def update(self, i, x):\n i += self.n - 1\n self.node[i] = x\n while i > 0:\n i = (i - 1) // 2\n self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])\n\n def update(self, x, val):\n x += self.n - 1\n self.node[x] = val\n while x > 0:\n x = (x - 1) // 2\n self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])\n\n def query(self, a, b):\n res = 0\n l = self.n - 1 + a\n r = self.n - 1 + (b - 1)\n while l <= r:\n if l == r:\n res = segfunc(res, self.node[l])\n break\n if l % 2 == 0:\n res = segfunc(res, self.node[l])\n if r % 2 == 1:\n res = segfunc(res, self.node[r])\n l = l // 2\n r = r // 2 - 1\n return res\n\n\nN, K = list(map(int, input().split()))\nINF = 0\nseg = SegmentTree([0] * 300000)\nfor i in range(N):\n a = int(input())\n tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1\n seg.update(a, tmp)\nprint((seg.query(0, 300000)))\n", "code_v1_no_empty_lines": "def segfunc(x, y):\n return max(x, y)\n\n\ndef update(i, x):\n i += MAX_N - 1\n node[i] = x\n while i:\n i = (i - 1) // 2\n node[i] = segfunc(node[i * 2 + 1], node[i * 2 + 2])\n\n\ndef query(l, r):\n L = l + MAX_N\n R = r + MAX_N\n s = INF\n while L < R:\n if R & 1:\n R -= 1\n s = segfunc(s, node[R - 1])\n if L & 1:\n s = segfunc(s, node[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\nN, K = list(map(int, input().split()))\nMAX_N = 2 ** (300005).bit_length()\na = [int(input()) for _ in range(N)]\nnode = [0] * (2 * MAX_N)\nINF = 0\nans = 0\n# for i in range(N):\n# update(i, a[i])\nfor i in a:\n tmp = query(max(i - K, 0), min(300005, i + K) + 1)\n update(i, tmp + 1)\n ans = max(ans, tmp + 1)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 29.6296296296, "diff": ["-class SegmentTree:", "- def __init__(self, arr):", "- size = len(arr)", "- n = 2 ** (size - 1).bit_length()", "- self.n = n", "- self.node = [0] * (2 * n)", "- for i in range(size):", "- self.node[i + n - 1] = arr[i]", "- for i in reversed(list(range(n - 2))):", "- self.node[i] = segfunc(self.node[2 * i + 1], self.node[2 * i + 2])", "+def update(i, x):", "+ i += MAX_N - 1", "+ node[i] = x", "+ while i:", "+ i = (i - 1) // 2", "+ node[i] = segfunc(node[i * 2 + 1], node[i * 2 + 2])", "- def update(self, i, x):", "- i += self.n - 1", "- self.node[i] = x", "- while i > 0:", "- i = (i - 1) // 2", "- self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])", "- def update(self, x, val):", "- x += self.n - 1", "- self.node[x] = val", "- while x > 0:", "- x = (x - 1) // 2", "- self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])", "-", "- def query(self, a, b):", "- res = 0", "- l = self.n - 1 + a", "- r = self.n - 1 + (b - 1)", "- while l <= r:", "- if l == r:", "- res = segfunc(res, self.node[l])", "- break", "- if l % 2 == 0:", "- res = segfunc(res, self.node[l])", "- if r % 2 == 1:", "- res = segfunc(res, self.node[r])", "- l = l // 2", "- r = r // 2 - 1", "- return res", "+def query(l, r):", "+ L = l + MAX_N", "+ R = r + MAX_N", "+ s = INF", "+ while L < R:", "+ if R & 1:", "+ R -= 1", "+ s = segfunc(s, node[R - 1])", "+ if L & 1:", "+ s = segfunc(s, node[L - 1])", "+ L += 1", "+ L >>= 1", "+ R >>= 1", "+ return s", "+MAX_N = 2 ** (300005).bit_length()", "+a = [int(input()) for _ in range(N)]", "+node = [0] * (2 * MAX_N)", "-seg = SegmentTree([0] * 300000)", "-for i in range(N):", "- a = int(input())", "- tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1", "- seg.update(a, tmp)", "-print((seg.query(0, 300000)))", "+ans = 0", "+# for i in range(N):", "+# update(i, a[i])", "+for i in a:", "+ tmp = query(max(i - K, 0), min(300005, i + K) + 1)", "+ update(i, tmp + 1)", "+ ans = max(ans, tmp + 1)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 2.9777374048, "measured_runtime_v1": 0.391063194, "runtime_lift": 7.6144660253, "key": ["s277145927", "s770419806"]} +{"user_id": "u564589929", "problem_id": "p03371", "language": "python", "submission_id_v0": "s501790970", "submission_id_v1": "s324668886", "cpu_time_v0": 93, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.72, "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(input())\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = INF\n\n for k in range(100001):\n\n yen = 2 * c * k + max(0, x-k) * a + max(0, y-k) * b\n\n ans = min(ans, yen)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "target": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(input())\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = 0\n\n if a + b <= 2 * c:\n\n mn = min(x, y)\n\n ans = a * mn + b * mn + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)\n\n\n\n else:\n\n mn = min(x, y)\n\n ans = mn * 2 * c + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)\n\n\n\n print(ans)\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "code_v0_loc": 28, "code_v1_loc": 34, "code_v0_num_chars": 727, "code_v1_num_chars": 868, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\n\n\ndef II():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MI1():\n return list(map(int1, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI1():\n return list(map(int1, input().split()))\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef printlist(lst, k=\"\\n\"):\n print((k.join(list(map(str, lst)))))\n\n\nINF = float(\"inf\")\n\n\ndef solve():\n a, b, c, x, y = MI()\n ans = INF\n for k in range(100001):\n yen = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b\n ans = min(ans, yen)\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\n\n\ndef II():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MI1():\n return list(map(int1, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI1():\n return list(map(int1, input().split()))\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef printlist(lst, k=\"\\n\"):\n print((k.join(list(map(str, lst)))))\n\n\nINF = float(\"inf\")\n\n\ndef solve():\n a, b, c, x, y = MI()\n ans = 0\n if a + b <= 2 * c:\n mn = min(x, y)\n ans = (\n a * mn\n + b * mn\n + max(0, x - mn) * min(a, 2 * c)\n + max(0, y - mn) * min(b, 2 * c)\n )\n else:\n mn = min(x, y)\n ans = (\n mn * 2 * c + max(0, x - mn) * min(a, 2 * c) + max(0, y - mn) * min(b, 2 * c)\n )\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["- ans = INF", "- for k in range(100001):", "- yen = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b", "- ans = min(ans, yen)", "+ ans = 0", "+ if a + b <= 2 * c:", "+ mn = min(x, y)", "+ ans = (", "+ a * mn", "+ + b * mn", "+ + max(0, x - mn) * min(a, 2 * c)", "+ + max(0, y - mn) * min(b, 2 * c)", "+ )", "+ else:", "+ mn = min(x, y)", "+ ans = (", "+ mn * 2 * c + max(0, x - mn) * min(a, 2 * c) + max(0, y - mn) * min(b, 2 * c)", "+ )"], "diff_only_import_comment": false, "measured_runtime_v0": 1.2337559407, "measured_runtime_v1": 0.3123451986, "runtime_lift": 3.9499756873, "key": ["s501790970", "s324668886"]} +{"user_id": "u333190709", "problem_id": "p03371", "language": "python", "submission_id_v0": "s264866690", "submission_id_v1": "s762683898", "cpu_time_v0": 127, "cpu_time_v1": 17, "memory_v0": 5304, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 86.61, "input": "#!/usr/bin/env python3\n\nimport sys, math, math, itertools\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n mn = 1e9\n\n for i in range(0, 2*(max(X, Y)+1), 2):\n\n mn = min(mn, C*i+A*max(X-i//2, 0)+B*max(Y-i//2, 0))\n\n print((int(mn)))\n\n return\n\n\n\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n c = 0\n\n if (A + B < 2 * C):\n\n c += min(X, Y) * (A + B)\n\n else:\n\n c += min(X, Y) * 2 * C\n\n if X > Y:\n\n c += (X - Y) * min(A, 2 * C)\n\n else:\n\n c += (Y - X) * min(B, 2 * C)\n\n print(c)\n\n return\n\n\n\n\n\n# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 28, "code_v1_loc": 34, "code_v0_num_chars": 879, "code_v1_num_chars": 941, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nimport sys, math, math, itertools\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n mn = 1e9\n for i in range(0, 2 * (max(X, Y) + 1), 2):\n mn = min(mn, C * i + A * max(X - i // 2, 0) + B * max(Y - i // 2, 0))\n print((int(mn)))\n return\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n C = int(next(tokens)) # type: int\n X = int(next(tokens)) # type: int\n Y = int(next(tokens)) # type: int\n solve(A, B, C, X, Y)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n c = 0\n if A + B < 2 * C:\n c += min(X, Y) * (A + B)\n else:\n c += min(X, Y) * 2 * C\n if X > Y:\n c += (X - Y) * min(A, 2 * C)\n else:\n c += (Y - X) * min(B, 2 * C)\n print(c)\n return\n\n\n# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n C = int(next(tokens)) # type: int\n X = int(next(tokens)) # type: int\n Y = int(next(tokens)) # type: int\n solve(A, B, C, X, Y)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["-import sys, math, math, itertools", "+import sys", "- mn = 1e9", "- for i in range(0, 2 * (max(X, Y) + 1), 2):", "- mn = min(mn, C * i + A * max(X - i // 2, 0) + B * max(Y - i // 2, 0))", "- print((int(mn)))", "+ c = 0", "+ if A + B < 2 * C:", "+ c += min(X, Y) * (A + B)", "+ else:", "+ c += min(X, Y) * 2 * C", "+ if X > Y:", "+ c += (X - Y) * min(A, 2 * C)", "+ else:", "+ c += (Y - X) * min(B, 2 * C)", "+ print(c)", "-# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)", "+# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4482344875, "measured_runtime_v1": 0.3314408262, "runtime_lift": 1.3523816383, "key": ["s264866690", "s762683898"]} +{"user_id": "u696805736", "problem_id": "p03837", "language": "python", "submission_id_v0": "s032580281", "submission_id_v1": "s724625000", "cpu_time_v0": 677, "cpu_time_v1": 276, "memory_v0": 62548, "memory_v1": 41072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.23, "input": "import queue\n\n\n\nINF = 123456789\n\n\n\ndef main():\n\n n,m = list(map(int,input().split()))\n\n\n\n G = [[] for _ in range(n)]\n\n for _ in range(m):\n\n a,b,c = list(map(int,input().split()))\n\n a -= 1\n\n b -= 1\n\n G[a].append((b,c))\n\n G[b].append((a,c))\n\n\n\n used = set()\n\n for i in range(n):\n\n d = [INF for _ in range(n)]\n\n par = [-1 for _ in range(n)]\n\n\n\n # dijkstra\n\n que = queue.PriorityQueue()\n\n d[i] = 0\n\n que.put((0,i))\n\n while not que.empty():\n\n p = que.get()\n\n v = p[1]\n\n if d[v] < p[0]:\n\n continue\n\n for (to,cost) in G[v]:\n\n if d[to] > d[v]+cost:\n\n d[to] = d[v]+cost\n\n par[to] = v\n\n que.put((d[to],to))\n\n\n\n for j in range(n):\n\n if i != j:\n\n a,b = j,par[j]\n\n if a>b:\n\n a,b = b,a\n\n used.add((a,b))\n\n\n\n print((m - len(used)))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "INF = 123456789\n\n\n\ndef main():\n\n n,m = list(map(int,input().split()))\n\n\n\n d = [ [INF for i in range(n)] for j in range(n) ]\n\n for i in range(n):\n\n d[i][i] = 0\n\n\n\n a = [0 for _ in range(m)]\n\n b = [0 for _ in range(m)]\n\n c = [0 for _ in range(m)]\n\n for i in range(m):\n\n a[i],b[i],c[i] = list(map(int,input().split()))\n\n a[i] -= 1\n\n b[i] -= 1\n\n d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])\n\n d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])\n\n\n\n # Warshall-Floyd\n\n for k in range(n):\n\n for i in range(n):\n\n for j in range(n):\n\n d[i][j] = min(d[i][j], d[i][k]+d[k][j])\n\n\n\n ans = 0\n\n for i in range(m):\n\n found = 1\n\n for j in range(n):\n\n if d[j][a[i]] + c[i] == d[j][b[i]]:\n\n found = 0\n\n break\n\n ans += found\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 46, "code_v1_loc": 37, "code_v0_num_chars": 1060, "code_v1_num_chars": 907, "code_v0_no_empty_lines": "import queue\n\nINF = 123456789\n\n\ndef main():\n n, m = list(map(int, input().split()))\n G = [[] for _ in range(n)]\n for _ in range(m):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n G[a].append((b, c))\n G[b].append((a, c))\n used = set()\n for i in range(n):\n d = [INF for _ in range(n)]\n par = [-1 for _ in range(n)]\n # dijkstra\n que = queue.PriorityQueue()\n d[i] = 0\n que.put((0, i))\n while not que.empty():\n p = que.get()\n v = p[1]\n if d[v] < p[0]:\n continue\n for (to, cost) in G[v]:\n if d[to] > d[v] + cost:\n d[to] = d[v] + cost\n par[to] = v\n que.put((d[to], to))\n for j in range(n):\n if i != j:\n a, b = j, par[j]\n if a > b:\n a, b = b, a\n used.add((a, b))\n print((m - len(used)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "INF = 123456789\n\n\ndef main():\n n, m = list(map(int, input().split()))\n d = [[INF for i in range(n)] for j in range(n)]\n for i in range(n):\n d[i][i] = 0\n a = [0 for _ in range(m)]\n b = [0 for _ in range(m)]\n c = [0 for _ in range(m)]\n for i in range(m):\n a[i], b[i], c[i] = list(map(int, input().split()))\n a[i] -= 1\n b[i] -= 1\n d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])\n d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])\n # Warshall-Floyd\n for k in range(n):\n for i in range(n):\n for j in range(n):\n d[i][j] = min(d[i][j], d[i][k] + d[k][j])\n ans = 0\n for i in range(m):\n found = 1\n for j in range(n):\n if d[j][a[i]] + c[i] == d[j][b[i]]:\n found = 0\n break\n ans += found\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 19.5652173913, "diff": ["-import queue", "-", "- G = [[] for _ in range(n)]", "- for _ in range(m):", "- a, b, c = list(map(int, input().split()))", "- a -= 1", "- b -= 1", "- G[a].append((b, c))", "- G[b].append((a, c))", "- used = set()", "+ d = [[INF for i in range(n)] for j in range(n)]", "- d = [INF for _ in range(n)]", "- par = [-1 for _ in range(n)]", "- # dijkstra", "- que = queue.PriorityQueue()", "- d[i] = 0", "- que.put((0, i))", "- while not que.empty():", "- p = que.get()", "- v = p[1]", "- if d[v] < p[0]:", "- continue", "- for (to, cost) in G[v]:", "- if d[to] > d[v] + cost:", "- d[to] = d[v] + cost", "- par[to] = v", "- que.put((d[to], to))", "+ d[i][i] = 0", "+ a = [0 for _ in range(m)]", "+ b = [0 for _ in range(m)]", "+ c = [0 for _ in range(m)]", "+ for i in range(m):", "+ a[i], b[i], c[i] = list(map(int, input().split()))", "+ a[i] -= 1", "+ b[i] -= 1", "+ d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])", "+ d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])", "+ # Warshall-Floyd", "+ for k in range(n):", "+ for i in range(n):", "+ for j in range(n):", "+ d[i][j] = min(d[i][j], d[i][k] + d[k][j])", "+ ans = 0", "+ for i in range(m):", "+ found = 1", "- if i != j:", "- a, b = j, par[j]", "- if a > b:", "- a, b = b, a", "- used.add((a, b))", "- print((m - len(used)))", "+ if d[j][a[i]] + c[i] == d[j][b[i]]:", "+ found = 0", "+ break", "+ ans += found", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3167709551, "measured_runtime_v1": 0.2522355395, "runtime_lift": 1.2558537773, "key": ["s032580281", "s724625000"]} +{"user_id": "u426534722", "problem_id": "p02248", "language": "python", "submission_id_v0": "s909106276", "submission_id_v1": "s961733692", "cpu_time_v0": 910, "cpu_time_v1": 790, "memory_v0": 117852, "memory_v1": 117860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.19, "input": "def kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return nx\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = input()\n\nP = input()\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n", "target": "def kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return tuple(nx)\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = input()\n\nP = input()\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n", "code_v0_loc": 36, "code_v1_loc": 36, "code_v0_num_chars": 860, "code_v1_num_chars": 867, "code_v0_no_empty_lines": "def kmpTable(w):\n lw = len(w)\n nx = [-1] * (lw + 1)\n j = -1\n for i in range(lw):\n while j >= 0 and w[i] != w[j]:\n j = nx[j]\n j += 1\n nx[i + 1] = j\n return nx\n\n\ndef kmpSearch(s, w):\n ls = len(s)\n start = 0\n w_idx = 0\n ret = []\n nx = kmpTable(w)\n while start + w_idx < ls:\n if s[start + w_idx] == w[w_idx]:\n w_idx += 1\n if w_idx == len(w):\n ret.append(start)\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n else:\n if w_idx == 0:\n start += 1\n else:\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n return ret\n\n\nT = input()\nP = input()\nans = kmpSearch(T, P)\nif ans:\n print((\"\\n\".join(map(str, ans))))\n", "code_v1_no_empty_lines": "def kmpTable(w):\n lw = len(w)\n nx = [-1] * (lw + 1)\n j = -1\n for i in range(lw):\n while j >= 0 and w[i] != w[j]:\n j = nx[j]\n j += 1\n nx[i + 1] = j\n return tuple(nx)\n\n\ndef kmpSearch(s, w):\n ls = len(s)\n start = 0\n w_idx = 0\n ret = []\n nx = kmpTable(w)\n while start + w_idx < ls:\n if s[start + w_idx] == w[w_idx]:\n w_idx += 1\n if w_idx == len(w):\n ret.append(start)\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n else:\n if w_idx == 0:\n start += 1\n else:\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n return ret\n\n\nT = input()\nP = input()\nans = kmpSearch(T, P)\nif ans:\n print((\"\\n\".join(map(str, ans))))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- return nx", "+ return tuple(nx)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.215319014, "measured_runtime_v1": 0.1265300495, "runtime_lift": 1.7017223565, "key": ["s909106276", "s961733692"]} +{"user_id": "u285891772", "problem_id": "p03078", "language": "python", "submission_id_v0": "s323914382", "submission_id_v1": "s323368336", "cpu_time_v0": 910, "cpu_time_v1": 524, "memory_v0": 69644, "memory_v1": 18184, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.42, "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return map(int, input().split())\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nAB = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tAB.append(A[i]+B[j])\n\n\n\nAB.sort(reverse = True)\n\nAB = AB[:3000]\n\nABC = sorted([C[0]+AB[i] for i in range(min(3000, X*Y))], reverse = True)\n\n\n\nfor j in range(1, Z):\n\n\tABC_tmp = sorted([C[j]+AB[i] for i in range(min(3000, X*Y))])\n\n\tABC += ABC_tmp\n\n\tABC.sort(reverse = True)\n\n\tABC = ABC[:3000]\n\n\n\nprint(*ABC[:K], sep= \"\\n\")\n\n\n", "target": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nans = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tfor k in range(Z):\n\n\t\t\tif (i+1)*(j+1)*(k+1) <= K:\n\n\t\t\t\tans.append(A[i]+B[j]+C[k])\n\n\t\t\telse:\n\n\t\t\t\tbreak\n\n\n\nfor a in sorted(ans)[::-1][:K]:\n\n\tprint(a)\n", "code_v0_loc": 46, "code_v1_loc": 40, "code_v0_num_chars": 1517, "code_v1_num_chars": 1344, "code_v0_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return map(int, input().split())\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return zip(*(MAP() for _ in range(n)))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nAB = []\nfor i in range(X):\n for j in range(Y):\n AB.append(A[i] + B[j])\nAB.sort(reverse=True)\nAB = AB[:3000]\nABC = sorted([C[0] + AB[i] for i in range(min(3000, X * Y))], reverse=True)\nfor j in range(1, Z):\n ABC_tmp = sorted([C[j] + AB[i] for i in range(min(3000, X * Y))])\n ABC += ABC_tmp\n ABC.sort(reverse=True)\n ABC = ABC[:3000]\nprint(*ABC[:K], sep=\"\\n\")\n", "code_v1_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nans = []\nfor i in range(X):\n for j in range(Y):\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) <= K:\n ans.append(A[i] + B[j] + C[k])\n else:\n break\nfor a in sorted(ans)[::-1][:K]:\n print(a)\n", "code_same": false, "relative_loc_diff_percent": 13.0434782609, "diff": ["- return int(input())", "+ return int(input())", "- return map(int, input().split())", "+ return list(map(int, input().split()))", "- return zip(*(MAP() for _ in range(n)))", "+ return list(zip(*(MAP() for _ in range(n))))", "-AB = []", "+ans = []", "- AB.append(A[i] + B[j])", "-AB.sort(reverse=True)", "-AB = AB[:3000]", "-ABC = sorted([C[0] + AB[i] for i in range(min(3000, X * Y))], reverse=True)", "-for j in range(1, Z):", "- ABC_tmp = sorted([C[j] + AB[i] for i in range(min(3000, X * Y))])", "- ABC += ABC_tmp", "- ABC.sort(reverse=True)", "- ABC = ABC[:3000]", "-print(*ABC[:K], sep=\"\\n\")", "+ for k in range(Z):", "+ if (i + 1) * (j + 1) * (k + 1) <= K:", "+ ans.append(A[i] + B[j] + C[k])", "+ else:", "+ break", "+for a in sorted(ans)[::-1][:K]:", "+ print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3039683881, "measured_runtime_v1": 0.2292593994, "runtime_lift": 1.3258709952, "key": ["s323914382", "s323368336"]} +{"user_id": "u285891772", "problem_id": "p02837", "language": "python", "submission_id_v0": "s234390283", "submission_id_v1": "s698943579", "cpu_time_v0": 281, "cpu_time_v1": 125, "memory_v0": 5204, "memory_v1": 5964, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.52, "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom math import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\nfrom decimal import Decimal\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\nfrom decimal import *\n\n\n\nN = INT()\n\nxy = []\n\n\n\nfor i in range(N):\n\n\tA = INT()\n\n\txy.append([LIST() for _ in range(A)])\n\n\n\nans = 0\n\nfor i in range(1< j:\n\n i, j = j, i\n\n return a[:i] + a[j] + a[i + 1:j] + a[i] + a[j + 1:]\n\ndef MAIN():\n\n m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = MAP.find(\"0\")\n\n goal = \"123456780\"\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n print(cnt)\n\n break\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\nMAIN()\n\n\n", "code_v0_loc": 30, "code_v1_loc": 27, "code_v0_num_chars": 885, "code_v1_num_chars": 783, "code_v0_no_empty_lines": "from collections import deque\nfrom copy import deepcopy, copy\n\ndy = [-1, 0, 0, 1]\ndx = [0, -1, 1, 0]\nN = 3\n\n\ndef g(i, j, a):\n t = a // (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef MAIN():\n m = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n }\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = 8 - MAP.find(\"0\")\n MAP = int(MAP)\n goal = (\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"0\")\n goal = 123456780\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n print(cnt)\n break\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\nMAIN()\n", "code_v1_no_empty_lines": "from collections import deque\nfrom copy import deepcopy, copy\n\nN = 3\n\n\ndef g(i, j, a):\n if i > j:\n i, j = j, i\n return a[:i] + a[j] + a[i + 1 : j] + a[i] + a[j + 1 :]\n\n\ndef MAIN():\n m = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n }\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = MAP.find(\"0\")\n goal = \"123456780\"\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n print(cnt)\n break\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\nMAIN()\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-dy = [-1, 0, 0, 1]", "-dx = [0, -1, 1, 0]", "- t = a // (10**j) % 10", "- return a - t * (10**j) + t * (10**i)", "+ if i > j:", "+ i, j = j, i", "+ return a[:i] + a[j] + a[i + 1 : j] + a[i] + a[j + 1 :]", "- start = 8 - MAP.find(\"0\")", "- MAP = int(MAP)", "- goal = (\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"0\")", "- goal = 123456780", "+ start = MAP.find(\"0\")", "+ goal = \"123456780\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.3641724348, "measured_runtime_v1": 0.096000421, "runtime_lift": 3.7934462245, "key": ["s804728708", "s622088378"]} +{"user_id": "u588341295", "problem_id": "p03078", "language": "python", "submission_id_v0": "s622309249", "submission_id_v1": "s171509372", "cpu_time_v0": 118, "cpu_time_v1": 37, "memory_v0": 8728, "memory_v1": 4976, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 68.64, "input": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x // y))\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\nABC=[]\n\nfor i in range(X):\n\n for j in range(Y):\n\n if (i+1)*(j+1)>K:\n\n break\n\n for k in range(Z):\n\n if (i+1)*(j+1)*(k+1)>K:\n\n break\n\n ABC.append(A[i]+B[j]+C[k])\n\nABC.sort(reverse=True)\n\nfor i in range(K):\n\n print((ABC[i]))\n\n\n", "target": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\nfrom heapq import heappush, heappop\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x // y))\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\n\n\nque=[]\n\nheappush(que, (-(A[0]+B[0]+C[0]), 0, 0, 0))\n\nS={(0,0,0)}\n\nfor i in range(K):\n\n ans=heappop(que)\n\n print((-ans[0]))\n\n a,b,c=ans[1:]\n\n if a+1 K:\n break\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) > K:\n break\n ABC.append(A[i] + B[j] + C[k])\nABC.sort(reverse=True)\nfor i in range(K):\n print((ABC[i]))\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\nfrom heapq import heappush, heappop\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x // y))\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nMOD = 10**9 + 7\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nque = []\nheappush(que, (-(A[0] + B[0] + C[0]), 0, 0, 0))\nS = {(0, 0, 0)}\nfor i in range(K):\n ans = heappop(que)\n print((-ans[0]))\n a, b, c = ans[1:]\n if a + 1 < X and (a + 1, b, c) not in S:\n heappush(que, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))\n S.add((a + 1, b, c))\n if b + 1 < Y and (a, b + 1, c) not in S:\n heappush(que, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))\n S.add((a, b + 1, c))\n if c + 1 < Z and (a, b, c + 1) not in S:\n heappush(que, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))\n S.add((a, b, c + 1))\n", "code_same": false, "relative_loc_diff_percent": 11.9047619048, "diff": ["+from heapq import heappush, heappop", "-ABC = []", "-for i in range(X):", "- for j in range(Y):", "- if (i + 1) * (j + 1) > K:", "- break", "- for k in range(Z):", "- if (i + 1) * (j + 1) * (k + 1) > K:", "- break", "- ABC.append(A[i] + B[j] + C[k])", "-ABC.sort(reverse=True)", "+que = []", "+heappush(que, (-(A[0] + B[0] + C[0]), 0, 0, 0))", "+S = {(0, 0, 0)}", "- print((ABC[i]))", "+ ans = heappop(que)", "+ print((-ans[0]))", "+ a, b, c = ans[1:]", "+ if a + 1 < X and (a + 1, b, c) not in S:", "+ heappush(que, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))", "+ S.add((a + 1, b, c))", "+ if b + 1 < Y and (a, b + 1, c) not in S:", "+ heappush(que, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))", "+ S.add((a, b + 1, c))", "+ if c + 1 < Z and (a, b, c + 1) not in S:", "+ heappush(que, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))", "+ S.add((a, b, c + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2840606916, "measured_runtime_v1": 0.2124910862, "runtime_lift": 1.3368122711, "key": ["s622309249", "s171509372"]} +{"user_id": "u864197622", "problem_id": "p02758", "language": "python", "submission_id_v0": "s598598719", "submission_id_v1": "s066197035", "cpu_time_v0": 1348, "cpu_time_v1": 954, "memory_v0": 102564, "memory_v1": 97192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.23, "input": "mod = 998244353\n\nN = int(input())\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\nmod = 998244353\n\nN = int(input())\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))", "code_v0_loc": 32, "code_v1_loc": 35, "code_v0_num_chars": 675, "code_v1_num_chars": 717, "code_v0_no_empty_lines": "mod = 998244353\nN = int(input())\nX = []\nfor _ in range(N):\n x, d = list(map(int, input().split()))\n X.append((x, x + d))\nX = sorted(X, key=lambda x: x[0])\nL = [(0, -(10**9 + 1), 10**9 + 1)]\nP = [-1] * (N + 1)\nfor i, (x, y) in enumerate(X):\n while L[-1][2] <= y:\n if L[-1][2] > x and P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.pop()\n if P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.append((i + 1, x, y))\nC = [[] for _ in range(N + 1)]\nfor i, p in enumerate(P):\n if p >= 0:\n C[p].append(i)\nY = [1] * (N + 1)\nfor i in range(N + 1)[::-1]:\n s = 1\n for j in C[i]:\n s = s * (Y[j] + 1) % mod\n Y[i] = s\nprint((Y[0]))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nmod = 998244353\nN = int(input())\nX = []\nfor _ in range(N):\n x, d = list(map(int, input().split()))\n X.append((x, x + d))\nX = sorted(X, key=lambda x: x[0])\nL = [(0, -(10**9 + 1), 10**9 + 1)]\nP = [-1] * (N + 1)\nfor i, (x, y) in enumerate(X):\n while L[-1][2] <= y:\n if L[-1][2] > x and P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.pop()\n if P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.append((i + 1, x, y))\nC = [[] for _ in range(N + 1)]\nfor i, p in enumerate(P):\n if p >= 0:\n C[p].append(i)\nY = [1] * (N + 1)\nfor i in range(N + 1)[::-1]:\n s = 1\n for j in C[i]:\n s = s * (Y[j] + 1) % mod\n Y[i] = s\nprint((Y[0]))\n", "code_same": false, "relative_loc_diff_percent": 8.5714285714, "diff": ["+import sys", "+", "+input = sys.stdin.readline"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2547301891, "measured_runtime_v1": 0.0065454967, "runtime_lift": 38.9168615134, "key": ["s598598719", "s066197035"]} +{"user_id": "u297574184", "problem_id": "p02792", "language": "python", "submission_id_v0": "s401307257", "submission_id_v1": "s179676165", "cpu_time_v0": 236, "cpu_time_v1": 18, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.37, "input": "def solve():\n\n N = int(input())\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, 5):\n\n for i in range(10**d):\n\n j = x*10**(d+1) + i*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n else:\n\n break\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for A in range(1, N+1):\n\n ss = str(A)\n\n ans += numss[int(ss[-1])][int(ss[0])]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n", "target": "def solve():\n\n strN = input()\n\n N = int(strN)\n\n\n\n maxD = len(strN)\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, maxD-2):\n\n num += 10**d\n\n if maxD-2 > 0:\n\n if x < int(strN[0]):\n\n num += 10**(maxD-2)\n\n elif x == int(strN[0]):\n\n num += int(strN[1:-1]) + 1\n\n if y > int(strN[-1]):\n\n num -= 1\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += numss[i][j]*numss[j][i]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n", "code_v0_loc": 32, "code_v1_loc": 37, "code_v0_num_chars": 778, "code_v1_num_chars": 917, "code_v0_no_empty_lines": "def solve():\n N = int(input())\n numss = [[0] * (10) for _ in range(10)]\n for x in range(1, 10):\n for y in range(1, 10):\n num = 0\n for d in range(1, 5):\n for i in range(10**d):\n j = x * 10 ** (d + 1) + i * 10 + y\n if 1 <= j <= N:\n num += 1\n else:\n break\n j = x * 10 + y\n if 1 <= j <= N:\n num += 1\n if x == y:\n j = x\n if 1 <= j <= N:\n num += 1\n numss[x][y] = num\n ans = 0\n for A in range(1, N + 1):\n ss = str(A)\n ans += numss[int(ss[-1])][int(ss[0])]\n print(ans)\n\n\nsolve()\n", "code_v1_no_empty_lines": "def solve():\n strN = input()\n N = int(strN)\n maxD = len(strN)\n numss = [[0] * (10) for _ in range(10)]\n for x in range(1, 10):\n for y in range(1, 10):\n num = 0\n for d in range(1, maxD - 2):\n num += 10**d\n if maxD - 2 > 0:\n if x < int(strN[0]):\n num += 10 ** (maxD - 2)\n elif x == int(strN[0]):\n num += int(strN[1:-1]) + 1\n if y > int(strN[-1]):\n num -= 1\n j = x * 10 + y\n if 1 <= j <= N:\n num += 1\n if x == y:\n j = x\n if 1 <= j <= N:\n num += 1\n numss[x][y] = num\n ans = 0\n for i in range(1, 10):\n for j in range(1, 10):\n ans += numss[i][j] * numss[j][i]\n print(ans)\n\n\nsolve()\n", "code_same": false, "relative_loc_diff_percent": 13.5135135135, "diff": ["- N = int(input())", "+ strN = input()", "+ N = int(strN)", "+ maxD = len(strN)", "- for d in range(1, 5):", "- for i in range(10**d):", "- j = x * 10 ** (d + 1) + i * 10 + y", "- if 1 <= j <= N:", "- num += 1", "- else:", "- break", "+ for d in range(1, maxD - 2):", "+ num += 10**d", "+ if maxD - 2 > 0:", "+ if x < int(strN[0]):", "+ num += 10 ** (maxD - 2)", "+ elif x == int(strN[0]):", "+ num += int(strN[1:-1]) + 1", "+ if y > int(strN[-1]):", "+ num -= 1", "- for A in range(1, N + 1):", "- ss = str(A)", "- ans += numss[int(ss[-1])][int(ss[0])]", "+ for i in range(1, 10):", "+ for j in range(1, 10):", "+ ans += numss[i][j] * numss[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3220527915, "measured_runtime_v1": 0.2179562147, "runtime_lift": 1.4776031599, "key": ["s401307257", "s179676165"]} +{"user_id": "u020390084", "problem_id": "p03309", "language": "python", "submission_id_v0": "s289814925", "submission_id_v1": "s781437429", "cpu_time_v0": 334, "cpu_time_v1": 258, "memory_v0": 27244, "memory_v1": 36640, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.75, "input": "import math\n\nimport statistics\n\nn = int(input())\n\na = list(map(int,input().split()))\n\na = [aa-i-1 for i, aa in enumerate(a)]\n\nanswer = n*10**20\n\nmedian_low = statistics.median_low(a)\n\nmedian_high = statistics.median_high(a)\n\n\n\nfor m in (median_low,median_high):\n\n ans=0\n\n for aa in a:\n\n ans += abs(aa-m)\n\n answer = min(ans,answer)\n\nprint(answer)\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\n\n\n\n\ndef solve(N: int, A: \"List[int]\"):\n\n difA = [0]*N\n\n\n\n for i in range(N):\n\n difA[i] = A[i]-(i+1)\n\n\n\n difA.sort()\n\n if N%2 == 0:\n\n g1 = difA[N//2]\n\n g2 = difA[N//2-1]\n\n a1 = 0\n\n a2 = 0\n\n for i in range(N):\n\n a1 += abs(difA[i]-g1)\n\n a2 += abs(difA[i]-g2)\n\n print((min(a1,a2)))\n\n \n\n else:\n\n g = difA[N//2]\n\n a = 0\n\n for i in range(N):\n\n a += abs(difA[i]-g)\n\n print(a)\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, A)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 15, "code_v1_loc": 42, "code_v0_num_chars": 352, "code_v1_num_chars": 891, "code_v0_no_empty_lines": "import math\nimport statistics\n\nn = int(input())\na = list(map(int, input().split()))\na = [aa - i - 1 for i, aa in enumerate(a)]\nanswer = n * 10**20\nmedian_low = statistics.median_low(a)\nmedian_high = statistics.median_high(a)\nfor m in (median_low, median_high):\n ans = 0\n for aa in a:\n ans += abs(aa - m)\n answer = min(ans, answer)\nprint(answer)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int, A: \"List[int]\"):\n difA = [0] * N\n for i in range(N):\n difA[i] = A[i] - (i + 1)\n difA.sort()\n if N % 2 == 0:\n g1 = difA[N // 2]\n g2 = difA[N // 2 - 1]\n a1 = 0\n a2 = 0\n for i in range(N):\n a1 += abs(difA[i] - g1)\n a2 += abs(difA[i] - g2)\n print((min(a1, a2)))\n else:\n g = difA[N // 2]\n a = 0\n for i in range(N):\n a += abs(difA[i] - g)\n print(a)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, A)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 64.2857142857, "diff": ["-import math", "-import statistics", "+#!/usr/bin/env python3", "+import sys", "-n = int(input())", "-a = list(map(int, input().split()))", "-a = [aa - i - 1 for i, aa in enumerate(a)]", "-answer = n * 10**20", "-median_low = statistics.median_low(a)", "-median_high = statistics.median_high(a)", "-for m in (median_low, median_high):", "- ans = 0", "- for aa in a:", "- ans += abs(aa - m)", "- answer = min(ans, answer)", "-print(answer)", "+", "+def solve(N: int, A: \"List[int]\"):", "+ difA = [0] * N", "+ for i in range(N):", "+ difA[i] = A[i] - (i + 1)", "+ difA.sort()", "+ if N % 2 == 0:", "+ g1 = difA[N // 2]", "+ g2 = difA[N // 2 - 1]", "+ a1 = 0", "+ a2 = 0", "+ for i in range(N):", "+ a1 += abs(difA[i] - g1)", "+ a2 += abs(difA[i] - g2)", "+ print((min(a1, a2)))", "+ else:", "+ g = difA[N // 2]", "+ a = 0", "+ for i in range(N):", "+ a += abs(difA[i] - g)", "+ print(a)", "+ return", "+", "+", "+def main():", "+ def iterate_tokens():", "+ for line in sys.stdin:", "+ for word in line.split():", "+ yield word", "+", "+ tokens = iterate_tokens()", "+ N = int(next(tokens)) # type: int", "+ A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"", "+ solve(N, A)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2912476273, "measured_runtime_v1": 0.217194303, "runtime_lift": 1.3409542662, "key": ["s289814925", "s781437429"]} +{"user_id": "u753803401", "problem_id": "p03078", "language": "python", "submission_id_v0": "s362357786", "submission_id_v1": "s175109634", "cpu_time_v0": 451, "cpu_time_v1": 323, "memory_v0": 62572, "memory_v1": 53208, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.38, "input": "def slove():\n\n import sys\n\n import heapq\n\n import collections\n\n input = sys.stdin.readline\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n b.sort(reverse=True)\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n c.sort(reverse=True)\n\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(q)\n\n fq = collections.defaultdict(list)\n\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n\n t = 0\n\n for _ in range(k):\n\n if len(q) != 0:\n\n p = heapq.heappop(q)\n\n t = p[0]\n\n aq = p[1]\n\n bq = p[2]\n\n cq = p[3]\n\n if aq + 1 < len(a):\n\n if (-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq])\n\n fq[(-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq)] = 1\n\n if bq + 1 < len(b):\n\n if (-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq])\n\n fq[(-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq)] = 1\n\n if cq + 1 < len(c):\n\n if (-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1])\n\n fq[(-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1)] = 1\n\n print((-t))\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n", "target": "import sys\n\nimport collections\n\nimport heapq\n\n\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n mod = 10 ** 9 + 7\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b.sort(reverse=True)\n\n c.sort(reverse=True)\n\n ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(ql)\n\n fq = collections.defaultdict(int)\n\n fq[0, 0, 0]\n\n for i in range(k):\n\n s, ap, bp, cp = heapq.heappop(ql)\n\n for app, bpp, cpp in ([[ap+1, bp, cp], [ap, bp+1, cp], [ap, bp, cp+1]]):\n\n if app < x and bpp < y and cpp < z:\n\n if (app, bpp, cpp) not in fq:\n\n heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])\n\n fq[app, bpp, cpp]\n\n print((-s))\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "code_v0_loc": 41, "code_v1_loc": 31, "code_v0_num_chars": 1596, "code_v1_num_chars": 979, "code_v0_no_empty_lines": "def slove():\n import sys\n import heapq\n import collections\n\n input = sys.stdin.readline\n x, y, z, k = list(map(int, input().rstrip(\"\\n\").split()))\n a = list(map(int, input().rstrip(\"\\n\").split()))\n a.sort(reverse=True)\n b = list(map(int, input().rstrip(\"\\n\").split()))\n b.sort(reverse=True)\n c = list(map(int, input().rstrip(\"\\n\").split()))\n c.sort(reverse=True)\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n heapq.heapify(q)\n fq = collections.defaultdict(list)\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n t = 0\n for _ in range(k):\n if len(q) != 0:\n p = heapq.heappop(q)\n t = p[0]\n aq = p[1]\n bq = p[2]\n cq = p[3]\n if aq + 1 < len(a):\n if (-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq) not in fq:\n heapq.heappush(q, [-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq])\n fq[(-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq)] = 1\n if bq + 1 < len(b):\n if (-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq) not in fq:\n heapq.heappush(q, [-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq])\n fq[(-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq)] = 1\n if cq + 1 < len(c):\n if (-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1) not in fq:\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1])\n fq[(-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1)] = 1\n print((-t))\n\n\nif __name__ == \"__main__\":\n slove()\n", "code_v1_no_empty_lines": "import sys\nimport collections\nimport heapq\n\n\ndef solve():\n input = sys.stdin.readline\n mod = 10**9 + 7\n x, y, z, k = list(map(int, input().rstrip(\"\\n\").split()))\n a = list(map(int, input().rstrip(\"\\n\").split()))\n b = list(map(int, input().rstrip(\"\\n\").split()))\n c = list(map(int, input().rstrip(\"\\n\").split()))\n a.sort(reverse=True)\n b.sort(reverse=True)\n c.sort(reverse=True)\n ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n heapq.heapify(ql)\n fq = collections.defaultdict(int)\n fq[0, 0, 0]\n for i in range(k):\n s, ap, bp, cp = heapq.heappop(ql)\n for app, bpp, cpp in [[ap + 1, bp, cp], [ap, bp + 1, cp], [ap, bp, cp + 1]]:\n if app < x and bpp < y and cpp < z:\n if (app, bpp, cpp) not in fq:\n heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])\n fq[app, bpp, cpp]\n print((-s))\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 24.3902439024, "diff": ["-def slove():", "- import sys", "- import heapq", "- import collections", "+import sys", "+import collections", "+import heapq", "+", "+def solve():", "+ mod = 10**9 + 7", "+ b = list(map(int, input().rstrip(\"\\n\").split()))", "+ c = list(map(int, input().rstrip(\"\\n\").split()))", "- b = list(map(int, input().rstrip(\"\\n\").split()))", "- c = list(map(int, input().rstrip(\"\\n\").split()))", "- q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]", "- heapq.heapify(q)", "- fq = collections.defaultdict(list)", "- fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1", "- t = 0", "- for _ in range(k):", "- if len(q) != 0:", "- p = heapq.heappop(q)", "- t = p[0]", "- aq = p[1]", "- bq = p[2]", "- cq = p[3]", "- if aq + 1 < len(a):", "- if (-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq) not in fq:", "- heapq.heappush(q, [-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq])", "- fq[(-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq)] = 1", "- if bq + 1 < len(b):", "- if (-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq) not in fq:", "- heapq.heappush(q, [-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq])", "- fq[(-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq)] = 1", "- if cq + 1 < len(c):", "- if (-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1) not in fq:", "- heapq.heappush(q, [-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1])", "- fq[(-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1)] = 1", "- print((-t))", "+ ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]", "+ heapq.heapify(ql)", "+ fq = collections.defaultdict(int)", "+ fq[0, 0, 0]", "+ for i in range(k):", "+ s, ap, bp, cp = heapq.heappop(ql)", "+ for app, bpp, cpp in [[ap + 1, bp, cp], [ap, bp + 1, cp], [ap, bp, cp + 1]]:", "+ if app < x and bpp < y and cpp < z:", "+ if (app, bpp, cpp) not in fq:", "+ heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])", "+ fq[app, bpp, cpp]", "+ print((-s))", "- slove()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3093440776, "measured_runtime_v1": 0.1565137908, "runtime_lift": 1.9764653063, "key": ["s362357786", "s175109634"]} +{"user_id": "u881590806", "problem_id": "p02264", "language": "python", "submission_id_v0": "s309974156", "submission_id_v1": "s779537604", "cpu_time_v0": 780, "cpu_time_v1": 600, "memory_v0": 14072, "memory_v1": 28548, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.08, "input": "class Queue:\n\n def __init__(self,values):\n\n self.values = values\n\n\n\n def empty(self):\n\n if len(self.values) == 0:\n\n return True\n\n else:\n\n return False\n\n\n\n def enqueue(self,v):\n\n self.values.append(v)\n\n\n\n def dequeue(self):\n\n if len(self.values) <= 0:\n\n raise\n\n else:\n\n v = self.values[0]\n\n del self.values[0]\n\n return v\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nprocesses = []\n\nfor i in range(n):\n\n n,t = input().split(' ')\n\n processes.append((n,int(t)))\n\n\n\nqueue = Queue(processes)\n\n\n\nclock = 0\n\ndone = []\n\nwhile not queue.empty():\n\n p = queue.dequeue()\n\n n = p[0]\n\n t = p[1]\n\n if t <= q:\n\n clock+=t\n\n done.append((n,clock))\n\n else:\n\n queue.enqueue((n,t-q))\n\n clock+=q\n\n\n\nfor p in done:\n\n print(p[0],p[1])", "target": "class Queue:\n\n def __init__(self,l):\n\n self.values = []\n\n self.l = l\n\n for _ in range(l):\n\n self.values.append(None)\n\n self.head = 0\n\n self.tail = 0\n\n def inc(self,n):\n\n if n+1 >= self.l:\n\n return 0\n\n else:\n\n return n+1\n\n def enqueue(self,v):\n\n if self.inc(self.head) == self.tail:\n\n print('overflow')\n\n exit()\n\n self.values[self.head] = v\n\n self.head = self.inc(self.head)\n\n def dequeue(self):\n\n if self.head == self.tail:\n\n print('underflow')\n\n exit()\n\n v = self.values[self.tail]\n\n self.tail = self.inc(self.tail)\n\n return v\n\n def size(self):\n\n if self.head >= self.tail:\n\n return self.head-self.tail\n\n else:\n\n self.head + (self.l-self.tail)\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nqueue = Queue(200000)\n\nfor _ in range(n):\n\n n,t = input().split(' ')\n\n t = int(t)\n\n queue.enqueue((n,t))\n\n\n\nc = 0\n\nwhile queue.size()>0:\n\n n,t = queue.dequeue()\n\n if t <= q:\n\n c += t\n\n print(n,c)\n\n else:\n\n queue.enqueue((n,t-q))\n\n c += q", "code_v0_loc": 44, "code_v1_loc": 48, "code_v0_num_chars": 881, "code_v1_num_chars": 1197, "code_v0_no_empty_lines": "class Queue:\n def __init__(self, values):\n self.values = values\n\n def empty(self):\n if len(self.values) == 0:\n return True\n else:\n return False\n\n def enqueue(self, v):\n self.values.append(v)\n\n def dequeue(self):\n if len(self.values) <= 0:\n raise\n else:\n v = self.values[0]\n del self.values[0]\n return v\n\n\nn, q = list(map(int, input().split(\" \")))\nprocesses = []\nfor i in range(n):\n n, t = input().split(\" \")\n processes.append((n, int(t)))\nqueue = Queue(processes)\nclock = 0\ndone = []\nwhile not queue.empty():\n p = queue.dequeue()\n n = p[0]\n t = p[1]\n if t <= q:\n clock += t\n done.append((n, clock))\n else:\n queue.enqueue((n, t - q))\n clock += q\nfor p in done:\n print(p[0], p[1])\n", "code_v1_no_empty_lines": "class Queue:\n def __init__(self, l):\n self.values = []\n self.l = l\n for _ in range(l):\n self.values.append(None)\n self.head = 0\n self.tail = 0\n\n def inc(self, n):\n if n + 1 >= self.l:\n return 0\n else:\n return n + 1\n\n def enqueue(self, v):\n if self.inc(self.head) == self.tail:\n print(\"overflow\")\n exit()\n self.values[self.head] = v\n self.head = self.inc(self.head)\n\n def dequeue(self):\n if self.head == self.tail:\n print(\"underflow\")\n exit()\n v = self.values[self.tail]\n self.tail = self.inc(self.tail)\n return v\n\n def size(self):\n if self.head >= self.tail:\n return self.head - self.tail\n else:\n self.head + (self.l - self.tail)\n\n\nn, q = list(map(int, input().split(\" \")))\nqueue = Queue(200000)\nfor _ in range(n):\n n, t = input().split(\" \")\n t = int(t)\n queue.enqueue((n, t))\nc = 0\nwhile queue.size() > 0:\n n, t = queue.dequeue()\n if t <= q:\n c += t\n print(n, c)\n else:\n queue.enqueue((n, t - q))\n c += q\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["- def __init__(self, values):", "- self.values = values", "+ def __init__(self, l):", "+ self.values = []", "+ self.l = l", "+ for _ in range(l):", "+ self.values.append(None)", "+ self.head = 0", "+ self.tail = 0", "- def empty(self):", "- if len(self.values) == 0:", "- return True", "+ def inc(self, n):", "+ if n + 1 >= self.l:", "+ return 0", "- return False", "+ return n + 1", "- self.values.append(v)", "+ if self.inc(self.head) == self.tail:", "+ print(\"overflow\")", "+ exit()", "+ self.values[self.head] = v", "+ self.head = self.inc(self.head)", "- if len(self.values) <= 0:", "- raise", "+ if self.head == self.tail:", "+ print(\"underflow\")", "+ exit()", "+ v = self.values[self.tail]", "+ self.tail = self.inc(self.tail)", "+ return v", "+", "+ def size(self):", "+ if self.head >= self.tail:", "+ return self.head - self.tail", "- v = self.values[0]", "- del self.values[0]", "- return v", "+ self.head + (self.l - self.tail)", "-processes = []", "-for i in range(n):", "+queue = Queue(200000)", "+for _ in range(n):", "- processes.append((n, int(t)))", "-queue = Queue(processes)", "-clock = 0", "-done = []", "-while not queue.empty():", "- p = queue.dequeue()", "- n = p[0]", "- t = p[1]", "+ t = int(t)", "+ queue.enqueue((n, t))", "+c = 0", "+while queue.size() > 0:", "+ n, t = queue.dequeue()", "- clock += t", "- done.append((n, clock))", "+ c += t", "+ print(n, c)", "- clock += q", "-for p in done:", "- print(p[0], p[1])", "+ c += q"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3044010155, "measured_runtime_v1": 0.1198908706, "runtime_lift": 2.5389841115, "key": ["s309974156", "s779537604"]} +{"user_id": "u906428167", "problem_id": "p02821", "language": "python", "submission_id_v0": "s228028161", "submission_id_v1": "s587768475", "cpu_time_v0": 305, "cpu_time_v1": 262, "memory_v0": 55448, "memory_v1": 54460, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.1, "input": "from bisect import bisect_left\n\nfrom bisect import bisect_right\n\n\n\nn,m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = sorted(a)\n\n\n\na_count = [0]*100010\n\na_sum = [0]*100010\n\n\n\nfor i in range(n):\n\n a_count[a[i]] += 1\n\n a_sum[a[i]] += a[i]\n\n\n\nfor i in range(100005,-1,-1):\n\n a_count[i] += a_count[i+1]\n\n a_sum[i] += a_sum[i+1]\n\n\n\ndef chk(x):\n\n case = 0\n\n for i in range(n):\n\n if 0<= x-a[i]<= 10**5+5:\n\n case += a_count[x-a[i]]\n\n elif x-a[i] < 0:\n\n case += n\n\n if case >= m:\n\n ch = True\n\n else:\n\n ch = False\n\n return ch\n\n\n\nl = 2*a[-1]+1 #NG\n\nr = 1 #OK\n\n\n\nwhile abs(r-l) > 1:\n\n kk = (r+l)//2\n\n if chk(kk):\n\n r = kk\n\n else:\n\n l = kk\n\n\n\nans = 0\n\nsm = sum(a)\n\n\n\nl = r\n\n\n\ncase = 0\n\nfor i in range(n):\n\n num = n-bisect_right(a,l-a[i]-1)\n\n case += num\n\n ans += num*a[i]*2\n\n\n\nans -= (case-m)*l\n\n\n\nprint(ans)", "target": "n, m = list(map(int, input().split()))\n\na = [int(x) for x in input().split()]\n\n\n\naa = [0]*(10**5+1)\n\naa_sum = [0]*(10**5+1)\n\n\n\nfor x in a:\n\n aa[x] += 1\n\n aa_sum[x] += x\n\n\n\nfor i in range(10**5)[::-1]:\n\n aa[i] = aa[i] + aa[i+1]\n\n aa_sum[i] = aa_sum[i] + aa_sum[i+1]\n\n\n\n\n\ndef count(x):\n\n cnt = 0\n\n sm = 0\n\n for i in range(n):\n\n if x-a[i] < 0:\n\n cnt += n\n\n sm += aa_sum[0]+n*a[i]\n\n elif x-a[i] > 10**5:\n\n continue\n\n else:\n\n cnt += aa[x-a[i]]\n\n sm += aa_sum[x-a[i]]+aa[x-a[i]]*a[i]\n\n\n\n return cnt, sm\n\n\n\n\n\nbottom = 0\n\ntop = 10**6\n\n\n\nwhile top - bottom > 1:\n\n mid = (top+bottom) // 2\n\n cnt, sm = count(mid)\n\n if cnt < m:\n\n top = mid\n\n else:\n\n bottom = mid\n\n\n\ncnt, sm = count(bottom)\n\nans = sm - (cnt-m)*bottom\n\n\n\nprint(ans)\n", "code_v0_loc": 55, "code_v1_loc": 46, "code_v0_num_chars": 930, "code_v1_num_chars": 839, "code_v0_no_empty_lines": "from bisect import bisect_left\nfrom bisect import bisect_right\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = sorted(a)\na_count = [0] * 100010\na_sum = [0] * 100010\nfor i in range(n):\n a_count[a[i]] += 1\n a_sum[a[i]] += a[i]\nfor i in range(100005, -1, -1):\n a_count[i] += a_count[i + 1]\n a_sum[i] += a_sum[i + 1]\n\n\ndef chk(x):\n case = 0\n for i in range(n):\n if 0 <= x - a[i] <= 10**5 + 5:\n case += a_count[x - a[i]]\n elif x - a[i] < 0:\n case += n\n if case >= m:\n ch = True\n else:\n ch = False\n return ch\n\n\nl = 2 * a[-1] + 1 # NG\nr = 1 # OK\nwhile abs(r - l) > 1:\n kk = (r + l) // 2\n if chk(kk):\n r = kk\n else:\n l = kk\nans = 0\nsm = sum(a)\nl = r\ncase = 0\nfor i in range(n):\n num = n - bisect_right(a, l - a[i] - 1)\n case += num\n ans += num * a[i] * 2\nans -= (case - m) * l\nprint(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\na = [int(x) for x in input().split()]\naa = [0] * (10**5 + 1)\naa_sum = [0] * (10**5 + 1)\nfor x in a:\n aa[x] += 1\n aa_sum[x] += x\nfor i in range(10**5)[::-1]:\n aa[i] = aa[i] + aa[i + 1]\n aa_sum[i] = aa_sum[i] + aa_sum[i + 1]\n\n\ndef count(x):\n cnt = 0\n sm = 0\n for i in range(n):\n if x - a[i] < 0:\n cnt += n\n sm += aa_sum[0] + n * a[i]\n elif x - a[i] > 10**5:\n continue\n else:\n cnt += aa[x - a[i]]\n sm += aa_sum[x - a[i]] + aa[x - a[i]] * a[i]\n return cnt, sm\n\n\nbottom = 0\ntop = 10**6\nwhile top - bottom > 1:\n mid = (top + bottom) // 2\n cnt, sm = count(mid)\n if cnt < m:\n top = mid\n else:\n bottom = mid\ncnt, sm = count(bottom)\nans = sm - (cnt - m) * bottom\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 16.3636363636, "diff": ["-from bisect import bisect_left", "-from bisect import bisect_right", "-", "-a = list(map(int, input().split()))", "-a = sorted(a)", "-a_count = [0] * 100010", "-a_sum = [0] * 100010", "-for i in range(n):", "- a_count[a[i]] += 1", "- a_sum[a[i]] += a[i]", "-for i in range(100005, -1, -1):", "- a_count[i] += a_count[i + 1]", "- a_sum[i] += a_sum[i + 1]", "+a = [int(x) for x in input().split()]", "+aa = [0] * (10**5 + 1)", "+aa_sum = [0] * (10**5 + 1)", "+for x in a:", "+ aa[x] += 1", "+ aa_sum[x] += x", "+for i in range(10**5)[::-1]:", "+ aa[i] = aa[i] + aa[i + 1]", "+ aa_sum[i] = aa_sum[i] + aa_sum[i + 1]", "-def chk(x):", "- case = 0", "+def count(x):", "+ cnt = 0", "+ sm = 0", "- if 0 <= x - a[i] <= 10**5 + 5:", "- case += a_count[x - a[i]]", "- elif x - a[i] < 0:", "- case += n", "- if case >= m:", "- ch = True", "- else:", "- ch = False", "- return ch", "+ if x - a[i] < 0:", "+ cnt += n", "+ sm += aa_sum[0] + n * a[i]", "+ elif x - a[i] > 10**5:", "+ continue", "+ else:", "+ cnt += aa[x - a[i]]", "+ sm += aa_sum[x - a[i]] + aa[x - a[i]] * a[i]", "+ return cnt, sm", "-l = 2 * a[-1] + 1 # NG", "-r = 1 # OK", "-while abs(r - l) > 1:", "- kk = (r + l) // 2", "- if chk(kk):", "- r = kk", "+bottom = 0", "+top = 10**6", "+while top - bottom > 1:", "+ mid = (top + bottom) // 2", "+ cnt, sm = count(mid)", "+ if cnt < m:", "+ top = mid", "- l = kk", "-ans = 0", "-sm = sum(a)", "-l = r", "-case = 0", "-for i in range(n):", "- num = n - bisect_right(a, l - a[i] - 1)", "- case += num", "- ans += num * a[i] * 2", "-ans -= (case - m) * l", "+ bottom = mid", "+cnt, sm = count(bottom)", "+ans = sm - (cnt - m) * bottom"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6311447213, "measured_runtime_v1": 0.3899716654, "runtime_lift": 1.6184373822, "key": ["s228028161", "s587768475"]} +{"user_id": "u260980560", "problem_id": "p01105", "language": "python", "submission_id_v0": "s936098014", "submission_id_v1": "s480075396", "cpu_time_v0": 50, "cpu_time_v1": 40, "memory_v0": 8604, "memory_v1": 8508, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.0, "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p ^ e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&%s\"%\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n", "target": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nQ = [(1, a), (1, b), (1, c), (1, d)]\n\nL = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n l < 15 and heappush(Q, (l+1, p ^ e))\n\n if l < 13:\n\n li = 13-l; l3 = 3+l\n\n for q, r in H:\n\n if r <= li:\n\n k = p & q\n\n if r < get(k, 17)-l3:\n\n L[k] = l3+r\n\n r < li and heappush(Q, (l3+r, k))\n\n k = p ^ q\n\n if r < get(k, 17)-l3:\n\n L[k] = l3+r\n\n r < li and heappush(Q, (l3+r, k))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&\"+\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n", "code_v0_loc": 26, "code_v1_loc": 28, "code_v0_num_chars": 917, "code_v1_num_chars": 953, "code_v0_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\nQ = [(1, el) for el in base]\nL = {el: 1 for el in base}\nH = []\nget = L.get\npush = H.append\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < get(p ^ e, 17):\n L[p ^ e] = l + 1\n if l + 1 < 16:\n heappush(Q, (l + 1, p ^ e))\n if l + 3 < 16:\n for q, r in H:\n if l + r + 3 <= 16:\n if l + r + 3 < get(p & q, 17):\n L[p & q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p & q))\n if l + r + 3 < get(p ^ q, 17):\n L[p ^ q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p ^ q))\n else:\n break\n if l < 7:\n push((p, l))\nprint(\n *map(\n L.__getitem__,\n eval(\n \"e&%s\"\n % \",e&\".join(\n open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]\n )\n ),\n ),\n sep=\"\\n\"\n)\n", "code_v1_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nQ = [(1, a), (1, b), (1, c), (1, d)]\nL = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}\nH = []\nget = L.get\npush = H.append\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < get(p ^ e, 17):\n L[p ^ e] = l + 1\n l < 15 and heappush(Q, (l + 1, p ^ e))\n if l < 13:\n li = 13 - l\n l3 = 3 + l\n for q, r in H:\n if r <= li:\n k = p & q\n if r < get(k, 17) - l3:\n L[k] = l3 + r\n r < li and heappush(Q, (l3 + r, k))\n k = p ^ q\n if r < get(k, 17) - l3:\n L[k] = l3 + r\n r < li and heappush(Q, (l3 + r, k))\n else:\n break\n if l < 7:\n push((p, l))\nprint(\n *map(\n L.__getitem__,\n eval(\n \"e&\"\n + \",e&\".join(\n open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]\n )\n ),\n ),\n sep=\"\\n\"\n)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-base = [a, b, c, d, e, 0]", "-Q = [(1, el) for el in base]", "-L = {el: 1 for el in base}", "+Q = [(1, a), (1, b), (1, c), (1, d)]", "+L = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}", "- if l + 1 < 16:", "- heappush(Q, (l + 1, p ^ e))", "- if l + 3 < 16:", "+ l < 15 and heappush(Q, (l + 1, p ^ e))", "+ if l < 13:", "+ li = 13 - l", "+ l3 = 3 + l", "- if l + r + 3 <= 16:", "- if l + r + 3 < get(p & q, 17):", "- L[p & q] = l + r + 3", "- if l + r + 3 < 16:", "- heappush(Q, (l + r + 3, p & q))", "- if l + r + 3 < get(p ^ q, 17):", "- L[p ^ q] = l + r + 3", "- if l + r + 3 < 16:", "- heappush(Q, (l + r + 3, p ^ q))", "+ if r <= li:", "+ k = p & q", "+ if r < get(k, 17) - l3:", "+ L[k] = l3 + r", "+ r < li and heappush(Q, (l3 + r, k))", "+ k = p ^ q", "+ if r < get(k, 17) - l3:", "+ L[k] = l3 + r", "+ r < li and heappush(Q, (l3 + r, k))", "- \"e&%s\"", "- % \",e&\".join(", "+ \"e&\"", "+ + \",e&\".join("], "diff_only_import_comment": false, "measured_runtime_v0": 0.4434673564, "measured_runtime_v1": 0.3305070457, "runtime_lift": 1.3417788278, "key": ["s936098014", "s480075396"]} +{"user_id": "u638795007", "problem_id": "p04020", "language": "python", "submission_id_v0": "s043977447", "submission_id_v1": "s372001933", "cpu_time_v0": 265, "cpu_time_v1": 111, "memory_v0": 44252, "memory_v1": 8004, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.11, "input": "def examB():\n\n N = I(); A = [I() for _ in range(N)]\n\n ans = 0; cur= 0\n\n for i in A:\n\n if i==0:\n\n ans += cur//2\n\n cur = 0\n\n else:\n\n cur += i\n\n ans += cur // 2\n\n print(ans)\n\n return\n\n\n\nimport sys,copy,bisect,itertools,heapq,math\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\n\n\nif __name__ == '__main__':\n\n examB()\n", "target": "def examA():\n\n S = SI()\n\n if \"W\" in S and not \"E\" in S:\n\n print(\"No\")\n\n elif \"E\" in S and not \"W\" in S:\n\n print(\"No\")\n\n elif \"N\" in S and not \"S\" in S:\n\n print(\"No\")\n\n elif \"S\" in S and not \"N\" in S:\n\n print(\"No\")\n\n else:\n\n print(\"Yes\")\n\n return\n\n\n\ndef examB():\n\n N = I()\n\n A = [I()for _ in range(N)]\n\n ans = 0\n\n for i in range(N-1):\n\n ans += A[i]//2\n\n if A[i]%2 and A[i+1]>=1:\n\n ans += 1\n\n A[i+1] -= 1\n\n ans += A[N-1]//2\n\n print(ans)\n\n return\n\n\n\ndef examC():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examD():\n\n N = I()\n\n S = [I()for _ in range(N)]\n\n\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examE():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examF():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\nimport sys,bisect,itertools,heapq,math,random\n\nfrom copy import deepcopy\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nglobal mod,mod2,inf,alphabet,_ep\n\nmod = 10**9 + 7\n\nmod2 = 998244353\n\ninf = 10**18\n\n_ep = 10**(-12)\n\nalphabet = [chr(ord('a') + i) for i in range(26)]\n\n\n\nsys.setrecursionlimit(10**6)\n\n\n\nif __name__ == '__main__':\n\n examB()\n\n\n\n\"\"\"\n\n\n\n\"\"\"", "code_v0_loc": 26, "code_v1_loc": 74, "code_v0_num_chars": 729, "code_v1_num_chars": 1504, "code_v0_no_empty_lines": "def examB():\n N = I()\n A = [I() for _ in range(N)]\n ans = 0\n cur = 0\n for i in A:\n if i == 0:\n ans += cur // 2\n cur = 0\n else:\n cur += i\n ans += cur // 2\n print(ans)\n return\n\n\nimport sys, copy, bisect, itertools, heapq, math\nfrom heapq import heappop, heappush, heapify\nfrom collections import Counter, defaultdict, deque\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LSI():\n return list(map(str, sys.stdin.readline().split()))\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef SI():\n return sys.stdin.readline().strip()\n\n\nmod = 10**9 + 7\ninf = float(\"inf\")\nif __name__ == \"__main__\":\n examB()\n", "code_v1_no_empty_lines": "def examA():\n S = SI()\n if \"W\" in S and not \"E\" in S:\n print(\"No\")\n elif \"E\" in S and not \"W\" in S:\n print(\"No\")\n elif \"N\" in S and not \"S\" in S:\n print(\"No\")\n elif \"S\" in S and not \"N\" in S:\n print(\"No\")\n else:\n print(\"Yes\")\n return\n\n\ndef examB():\n N = I()\n A = [I() for _ in range(N)]\n ans = 0\n for i in range(N - 1):\n ans += A[i] // 2\n if A[i] % 2 and A[i + 1] >= 1:\n ans += 1\n A[i + 1] -= 1\n ans += A[N - 1] // 2\n print(ans)\n return\n\n\ndef examC():\n ans = 0\n print(ans)\n return\n\n\ndef examD():\n N = I()\n S = [I() for _ in range(N)]\n ans = 0\n print(ans)\n return\n\n\ndef examE():\n ans = 0\n print(ans)\n return\n\n\ndef examF():\n ans = 0\n print(ans)\n return\n\n\nimport sys, bisect, itertools, heapq, math, random\nfrom copy import deepcopy\nfrom heapq import heappop, heappush, heapify\nfrom collections import Counter, defaultdict, deque\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LSI():\n return list(map(str, sys.stdin.readline().split()))\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef SI():\n return sys.stdin.readline().strip()\n\n\nglobal mod, mod2, inf, alphabet, _ep\nmod = 10**9 + 7\nmod2 = 998244353\ninf = 10**18\n_ep = 10 ** (-12)\nalphabet = [chr(ord(\"a\") + i) for i in range(26)]\nsys.setrecursionlimit(10**6)\nif __name__ == \"__main__\":\n examB()\n\"\"\"\n\"\"\"\n", "code_same": false, "relative_loc_diff_percent": 64.8648648649, "diff": ["+def examA():", "+ S = SI()", "+ if \"W\" in S and not \"E\" in S:", "+ print(\"No\")", "+ elif \"E\" in S and not \"W\" in S:", "+ print(\"No\")", "+ elif \"N\" in S and not \"S\" in S:", "+ print(\"No\")", "+ elif \"S\" in S and not \"N\" in S:", "+ print(\"No\")", "+ else:", "+ print(\"Yes\")", "+ return", "+", "+", "- cur = 0", "- for i in A:", "- if i == 0:", "- ans += cur // 2", "- cur = 0", "- else:", "- cur += i", "- ans += cur // 2", "+ for i in range(N - 1):", "+ ans += A[i] // 2", "+ if A[i] % 2 and A[i + 1] >= 1:", "+ ans += 1", "+ A[i + 1] -= 1", "+ ans += A[N - 1] // 2", "-import sys, copy, bisect, itertools, heapq, math", "+def examC():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def examD():", "+ N = I()", "+ S = [I() for _ in range(N)]", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def examE():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def examF():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+import sys, bisect, itertools, heapq, math, random", "+from copy import deepcopy", "+global mod, mod2, inf, alphabet, _ep", "-inf = float(\"inf\")", "+mod2 = 998244353", "+inf = 10**18", "+_ep = 10 ** (-12)", "+alphabet = [chr(ord(\"a\") + i) for i in range(26)]", "+sys.setrecursionlimit(10**6)", "+\"\"\"", "+\"\"\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.1928541586, "measured_runtime_v1": 0.006450581, "runtime_lift": 29.8971764609, "key": ["s043977447", "s372001933"]} +{"user_id": "u607865971", "problem_id": "p03164", "language": "python", "submission_id_v0": "s900171177", "submission_id_v1": "s494365384", "cpu_time_v0": 1438, "cpu_time_v1": 1016, "memory_v0": 27184, "memory_v1": 19300, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.35, "input": "import sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = [float('inf')] * 1000 * 100*10\n\nvs = set()\n\nvs.add(0)\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n tmpDP = dp.copy()\n\n for vv in list(vs):\n\n if dp[vv + v] > dp[vv] + w:\n\n tmpDP[vv + v] = dp[vv] + w\n\n vs.add(vv + v)\n\n dp = tmpDP\n\n\n\n\n\nans = 0\n\nfor v in list(vs):\n\n if dp[v] <= W:\n\n ans = max(ans, v)\n\nprint(ans)\n", "target": "import sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = defaultdict(lambda: float('inf'))\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n add = defaultdict(lambda: float('inf'))\n\n for vv in list(dp.keys()):\n\n if dp[vv + v] > dp[vv] + w:\n\n add[vv + v] = dp[vv] + w\n\n dp.update(add)\n\n\n\nprint((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x:x[0])[0]))\n", "code_v0_loc": 37, "code_v1_loc": 29, "code_v0_num_chars": 908, "code_v1_num_chars": 876, "code_v0_no_empty_lines": "import sys\nfrom collections import Counter, deque, defaultdict\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\nfrom functools import reduce\nfrom math import ceil, floor, log10, log2, factorial\nfrom pprint import pprint\n\nsys.setrecursionlimit(1000000)\n# MOD = 10 ** 9 + 7\n# N = int(input())\n# A = [int(x) for x in input().split()]\n# V = [[0] * 100 for _ in range(100)]\n# A = [int(input()) for _ in range(N)]\nN, W = [int(x) for x in input().split()]\ndp = [float(\"inf\")] * 1000 * 100 * 10\nvs = set()\nvs.add(0)\ndp[0] = 0\nfor i in range(N):\n w, v = [int(x) for x in input().split()]\n tmpDP = dp.copy()\n for vv in list(vs):\n if dp[vv + v] > dp[vv] + w:\n tmpDP[vv + v] = dp[vv] + w\n vs.add(vv + v)\n dp = tmpDP\nans = 0\nfor v in list(vs):\n if dp[v] <= W:\n ans = max(ans, v)\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\nfrom collections import Counter, deque, defaultdict\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\nfrom functools import reduce\nfrom math import ceil, floor, log10, log2, factorial\nfrom pprint import pprint\n\nsys.setrecursionlimit(1000000)\n# MOD = 10 ** 9 + 7\n# N = int(input())\n# A = [int(x) for x in input().split()]\n# V = [[0] * 100 for _ in range(100)]\n# A = [int(input()) for _ in range(N)]\nN, W = [int(x) for x in input().split()]\ndp = defaultdict(lambda: float(\"inf\"))\ndp[0] = 0\nfor i in range(N):\n w, v = [int(x) for x in input().split()]\n add = defaultdict(lambda: float(\"inf\"))\n for vv in list(dp.keys()):\n if dp[vv + v] > dp[vv] + w:\n add[vv + v] = dp[vv] + w\n dp.update(add)\nprint((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x: x[0])[0]))\n", "code_same": false, "relative_loc_diff_percent": 21.6216216216, "diff": ["-dp = [float(\"inf\")] * 1000 * 100 * 10", "-vs = set()", "-vs.add(0)", "+dp = defaultdict(lambda: float(\"inf\"))", "- tmpDP = dp.copy()", "- for vv in list(vs):", "+ add = defaultdict(lambda: float(\"inf\"))", "+ for vv in list(dp.keys()):", "- tmpDP[vv + v] = dp[vv] + w", "- vs.add(vv + v)", "- dp = tmpDP", "-ans = 0", "-for v in list(vs):", "- if dp[v] <= W:", "- ans = max(ans, v)", "-print(ans)", "+ add[vv + v] = dp[vv] + w", "+ dp.update(add)", "+print((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x: x[0])[0]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5805827644, "measured_runtime_v1": 0.1952783756, "runtime_lift": 2.9731032046, "key": ["s900171177", "s494365384"]} +{"user_id": "u670180528", "problem_id": "p03806", "language": "python", "submission_id_v0": "s355426542", "submission_id_v1": "s468498336", "cpu_time_v0": 1133, "cpu_time_v1": 172, "memory_v0": 4980, "memory_v1": 4980, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.82, "input": "def main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1<<30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(400, -1, -1):\n\n\t\t\tfor j in range(400, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\nif __name__==\"__main__\":\n\n\tmain()", "target": "def main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1 << 30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tua = ub = 15\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(ua, -1, -1):\n\n\t\t\tfor j in range(ub, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\t\t\t\t\tif ua < i + a:\n\n\t\t\t\t\t\tua = i + a\n\n\t\t\t\t\tif ub < j + b:\n\n\t\t\t\t\t\tub = j + b\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()\n", "code_v0_loc": 21, "code_v1_loc": 27, "code_v0_num_chars": 492, "code_v1_num_chars": 590, "code_v0_no_empty_lines": "def main():\n n, ma, mb, *L = list(map(int, open(0).read().split()))\n M = 1 << 30\n dp = [[M] * 420 for _ in range(420)]\n dp[0][0] = 0\n for a, b, c in zip(*[iter(L)] * 3):\n for i in range(400, -1, -1):\n for j in range(400, -1, -1):\n t = dp[i][j] + c\n if dp[i + a][j + b] > t:\n dp[i + a][j + b] = t\n ans = M\n _ma, _mb = ma, mb\n while _ma < 410 > _mb:\n ans = min(ans, dp[_ma][_mb])\n _ma += ma\n _mb += mb\n print((ans if ans < M else -1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n n, ma, mb, *L = list(map(int, open(0).read().split()))\n M = 1 << 30\n dp = [[M] * 420 for _ in range(420)]\n dp[0][0] = 0\n ua = ub = 15\n for a, b, c in zip(*[iter(L)] * 3):\n for i in range(ua, -1, -1):\n for j in range(ub, -1, -1):\n t = dp[i][j] + c\n if dp[i + a][j + b] > t:\n dp[i + a][j + b] = t\n if ua < i + a:\n ua = i + a\n if ub < j + b:\n ub = j + b\n ans = M\n _ma, _mb = ma, mb\n while _ma < 410 > _mb:\n ans = min(ans, dp[_ma][_mb])\n _ma += ma\n _mb += mb\n print((ans if ans < M else -1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["+ ua = ub = 15", "- for i in range(400, -1, -1):", "- for j in range(400, -1, -1):", "+ for i in range(ua, -1, -1):", "+ for j in range(ub, -1, -1):", "+ if ua < i + a:", "+ ua = i + a", "+ if ub < j + b:", "+ ub = j + b"], "diff_only_import_comment": false, "measured_runtime_v0": 1.1710306553, "measured_runtime_v1": 0.275720624, "runtime_lift": 4.2471638081, "key": ["s355426542", "s468498336"]} +{"user_id": "u761529120", "problem_id": "p03634", "language": "python", "submission_id_v0": "s135133436", "submission_id_v1": "s083939253", "cpu_time_v0": 1459, "cpu_time_v1": 754, "memory_v0": 135740, "memory_v1": 94752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.32, "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\ndef dfs(v,p,d):\n\n for i, j in tree[v]:\n\n if i != p:\n\n depth[i] = d + j\n\n dfs(i,v,d+j)\n\n\n\nN = int(input())\n\n\n\ntree = [[] for _ in range(N)]\n\n\n\nfor i in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n tree[a].append((b,c))\n\n tree[b].append((a,c))\n\n\n\nQ, K = list(map(int, input().split()))\n\n\n\ndepth = [0 for i in range(N)]\n\ndepth[K-1] = 0\n\n\n\ndfs(K-1,-1,0)\n\n\n\nfor _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n print((depth[x-1] + depth[y-1]))", "target": "import heapq\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef dijkstra(s, edge, N):\n\n d = [float('inf')] * N\n\n used = [True] * N\n\n d[s] = 0\n\n used[s] = False\n\n edgelist = []\n\n for a, b in edge[s]:\n\n heapq.heappush(edgelist, a * (10 ** 6) + b)\n\n while len(edgelist):\n\n minedge = heapq.heappop(edgelist)\n\n\n\n if not used[minedge%(10 ** 6)]:\n\n continue\n\n v = minedge % (10 ** 6)\n\n d[v] = minedge // (10 ** 6)\n\n used[v] = False\n\n for e in edge[v]:\n\n if used[e[1]]:\n\n heapq.heappush(edgelist, (e[0] + d[v]) * (10 ** 6) + e[1])\n\n return d\n\n\n\ndef main():\n\n N = int(input())\n\n edge = [[] for _ in range(N)]\n\n for _ in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n edge[a].append([c,b])\n\n edge[b].append([c,a])\n\n Q, K = list(map(int, input().split()))\n\n K -= 1\n\n d = dijkstra(K, edge, N)\n\n for _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n x -= 1\n\n y -= 1\n\n print((d[x] + d[y]))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 29, "code_v1_loc": 48, "code_v0_num_chars": 553, "code_v1_num_chars": 1130, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef dfs(v, p, d):\n for i, j in tree[v]:\n if i != p:\n depth[i] = d + j\n dfs(i, v, d + j)\n\n\nN = int(input())\ntree = [[] for _ in range(N)]\nfor i in range(N - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n tree[a].append((b, c))\n tree[b].append((a, c))\nQ, K = list(map(int, input().split()))\ndepth = [0 for i in range(N)]\ndepth[K - 1] = 0\ndfs(K - 1, -1, 0)\nfor _ in range(Q):\n x, y = list(map(int, input().split()))\n print((depth[x - 1] + depth[y - 1]))\n", "code_v1_no_empty_lines": "import heapq\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef dijkstra(s, edge, N):\n d = [float(\"inf\")] * N\n used = [True] * N\n d[s] = 0\n used[s] = False\n edgelist = []\n for a, b in edge[s]:\n heapq.heappush(edgelist, a * (10**6) + b)\n while len(edgelist):\n minedge = heapq.heappop(edgelist)\n if not used[minedge % (10**6)]:\n continue\n v = minedge % (10**6)\n d[v] = minedge // (10**6)\n used[v] = False\n for e in edge[v]:\n if used[e[1]]:\n heapq.heappush(edgelist, (e[0] + d[v]) * (10**6) + e[1])\n return d\n\n\ndef main():\n N = int(input())\n edge = [[] for _ in range(N)]\n for _ in range(N - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n edge[a].append([c, b])\n edge[b].append([c, a])\n Q, K = list(map(int, input().split()))\n K -= 1\n d = dijkstra(K, edge, N)\n for _ in range(Q):\n x, y = list(map(int, input().split()))\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 39.5833333333, "diff": ["+import heapq", "-sys.setrecursionlimit(10**6)", "+input = sys.stdin.readline", "-def dfs(v, p, d):", "- for i, j in tree[v]:", "- if i != p:", "- depth[i] = d + j", "- dfs(i, v, d + j)", "+def dijkstra(s, edge, N):", "+ d = [float(\"inf\")] * N", "+ used = [True] * N", "+ d[s] = 0", "+ used[s] = False", "+ edgelist = []", "+ for a, b in edge[s]:", "+ heapq.heappush(edgelist, a * (10**6) + b)", "+ while len(edgelist):", "+ minedge = heapq.heappop(edgelist)", "+ if not used[minedge % (10**6)]:", "+ continue", "+ v = minedge % (10**6)", "+ d[v] = minedge // (10**6)", "+ used[v] = False", "+ for e in edge[v]:", "+ if used[e[1]]:", "+ heapq.heappush(edgelist, (e[0] + d[v]) * (10**6) + e[1])", "+ return d", "-N = int(input())", "-tree = [[] for _ in range(N)]", "-for i in range(N - 1):", "- a, b, c = list(map(int, input().split()))", "- a -= 1", "- b -= 1", "- tree[a].append((b, c))", "- tree[b].append((a, c))", "-Q, K = list(map(int, input().split()))", "-depth = [0 for i in range(N)]", "-depth[K - 1] = 0", "-dfs(K - 1, -1, 0)", "-for _ in range(Q):", "- x, y = list(map(int, input().split()))", "- print((depth[x - 1] + depth[y - 1]))", "+def main():", "+ N = int(input())", "+ edge = [[] for _ in range(N)]", "+ for _ in range(N - 1):", "+ a, b, c = list(map(int, input().split()))", "+ a -= 1", "+ b -= 1", "+ edge[a].append([c, b])", "+ edge[b].append([c, a])", "+ Q, K = list(map(int, input().split()))", "+ K -= 1", "+ d = dijkstra(K, edge, N)", "+ for _ in range(Q):", "+ x, y = list(map(int, input().split()))", "+ x -= 1", "+ y -= 1", "+ print((d[x] + d[y]))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5217886055, "measured_runtime_v1": 0.3235212803, "runtime_lift": 1.6128416807, "key": ["s135133436", "s083939253"]} +{"user_id": "u968166680", "problem_id": "p02599", "language": "python", "submission_id_v0": "s648865207", "submission_id_v1": "s892817156", "cpu_time_v0": 1665, "cpu_time_v1": 1042, "memory_v0": 247668, "memory_v1": 267648, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.42, "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/\n\n# Python3 code to find number of\n\n# distinct numbers in a subarray\n\nMAX = 1000001\n\n\n\n# structure to store queries\n\nclass Query:\n\n def __init__(self, l, r, idx):\n\n self.l = l\n\n self.r = r\n\n self.idx = idx\n\n\n\n\n\n# updating the bit array\n\ndef update(idx, val, bit, n):\n\n while idx <= n:\n\n bit[idx] += val\n\n idx += idx & -idx\n\n\n\n\n\n# querying the bit array\n\ndef query(idx, bit, n):\n\n summ = 0\n\n while idx:\n\n summ += bit[idx]\n\n idx -= idx & -idx\n\n return summ\n\n\n\n\n\ndef answeringQueries(arr, n, queries, q):\n\n\n\n # initialising bit array\n\n bit = [0] * (n + 1)\n\n\n\n # holds the rightmost index of\n\n # any number as numbers of a[i]\n\n # are less than or equal to 10^6\n\n last_visit = [-1] * MAX\n\n\n\n # answer for each query\n\n ans = [0] * q\n\n\n\n query_counter = 0\n\n for i in range(n):\n\n\n\n # If last visit is not -1 update -1 at the\n\n # idx equal to last_visit[arr[i]]\n\n if last_visit[arr[i]] != -1:\n\n update(last_visit[arr[i]] + 1, -1, bit, n)\n\n\n\n # Setting last_visit[arr[i]] as i and\n\n # updating the bit array accordingly\n\n last_visit[arr[i]] = i\n\n update(i + 1, 1, bit, n)\n\n\n\n # If i is equal to r of any query store answer\n\n # for that query in ans[]\n\n while query_counter < q and queries[query_counter].r == i:\n\n ans[queries[query_counter].idx] = query(queries[query_counter].r + 1, bit, n) - query(\n\n queries[query_counter].l, bit, n\n\n )\n\n query_counter += 1\n\n\n\n # print answer for each query\n\n for i in range(q):\n\n print((ans[i]))\n\n\n\n\n\n# This code is contributed by\n\n# sanjeev2552\n\n\n\n\n\ndef main():\n\n N, Q = list(map(int, readline().split()))\n\n C = list(map(int, readline().split()))\n\n (*LR,) = list(map(int, read().split()))\n\n\n\n queries = [0] * Q\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n queries[i] = Query(l - 1, r - 1, i)\n\n\n\n queries.sort(key=lambda x: x.r)\n\n answeringQueries(C, N, queries, Q)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n", "target": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n\n\nclass BIT:\n\n def __init__(self, n):\n\n self.n = n\n\n self.data = [0] * (n + 1)\n\n\n\n def add(self, i, x=1):\n\n i += 1\n\n while i <= self.n:\n\n self.data[i] += x\n\n i += i & -i\n\n\n\n def get_sum(self, i):\n\n i += 1\n\n x = 0\n\n while i > 0:\n\n x += self.data[i]\n\n i -= i & -i\n\n return x\n\n\n\n # Return sum for [l, r)\n\n def get_sum_range(self, l, r):\n\n return self.get_sum(r - 1) - self.get_sum(l - 1)\n\n\n\n\n\ndef main():\n\n N, Q = map(int, readline().split())\n\n C = list(map(int, readline().split()))\n\n LR = map(int, read().split())\n\n\n\n prev = [-1] * (N + 1)\n\n ps = [[] for _ in range(N)]\n\n for i, c in enumerate(C):\n\n if prev[c] != -1:\n\n ps[prev[c]].append(i)\n\n prev[c] = i\n\n\n\n qs = [[] for _ in range(N + 1)]\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n l -= 1\n\n r -= 1\n\n qs[l].append((r, i))\n\n\n\n ans = [0] * Q\n\n bit = BIT(N)\n\n\n\n for l in range(N - 1, -1, -1):\n\n for r in ps[l]:\n\n bit.add(r)\n\n for r, i in qs[l]:\n\n ans[i] = (r - l + 1) - bit.get_sum(r)\n\n\n\n print(*ans, sep='\\n')\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 99, "code_v1_loc": 68, "code_v0_num_chars": 2366, "code_v1_num_chars": 1436, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/\n# Python3 code to find number of\n# distinct numbers in a subarray\nMAX = 1000001\n# structure to store queries\nclass Query:\n def __init__(self, l, r, idx):\n self.l = l\n self.r = r\n self.idx = idx\n\n\n# updating the bit array\ndef update(idx, val, bit, n):\n while idx <= n:\n bit[idx] += val\n idx += idx & -idx\n\n\n# querying the bit array\ndef query(idx, bit, n):\n summ = 0\n while idx:\n summ += bit[idx]\n idx -= idx & -idx\n return summ\n\n\ndef answeringQueries(arr, n, queries, q):\n # initialising bit array\n bit = [0] * (n + 1)\n # holds the rightmost index of\n # any number as numbers of a[i]\n # are less than or equal to 10^6\n last_visit = [-1] * MAX\n # answer for each query\n ans = [0] * q\n query_counter = 0\n for i in range(n):\n # If last visit is not -1 update -1 at the\n # idx equal to last_visit[arr[i]]\n if last_visit[arr[i]] != -1:\n update(last_visit[arr[i]] + 1, -1, bit, n)\n # Setting last_visit[arr[i]] as i and\n # updating the bit array accordingly\n last_visit[arr[i]] = i\n update(i + 1, 1, bit, n)\n # If i is equal to r of any query store answer\n # for that query in ans[]\n while query_counter < q and queries[query_counter].r == i:\n ans[queries[query_counter].idx] = query(\n queries[query_counter].r + 1, bit, n\n ) - query(queries[query_counter].l, bit, n)\n query_counter += 1\n # print answer for each query\n for i in range(q):\n print((ans[i]))\n\n\n# This code is contributed by\n# sanjeev2552\ndef main():\n N, Q = list(map(int, readline().split()))\n C = list(map(int, readline().split()))\n (*LR,) = list(map(int, read().split()))\n queries = [0] * Q\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n queries[i] = Query(l - 1, r - 1, i)\n queries.sort(key=lambda x: x.r)\n answeringQueries(C, N, queries, Q)\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n\n\nclass BIT:\n def __init__(self, n):\n self.n = n\n self.data = [0] * (n + 1)\n\n def add(self, i, x=1):\n i += 1\n while i <= self.n:\n self.data[i] += x\n i += i & -i\n\n def get_sum(self, i):\n i += 1\n x = 0\n while i > 0:\n x += self.data[i]\n i -= i & -i\n return x\n\n # Return sum for [l, r)\n def get_sum_range(self, l, r):\n return self.get_sum(r - 1) - self.get_sum(l - 1)\n\n\ndef main():\n N, Q = map(int, readline().split())\n C = list(map(int, readline().split()))\n LR = map(int, read().split())\n prev = [-1] * (N + 1)\n ps = [[] for _ in range(N)]\n for i, c in enumerate(C):\n if prev[c] != -1:\n ps[prev[c]].append(i)\n prev[c] = i\n qs = [[] for _ in range(N + 1)]\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n l -= 1\n r -= 1\n qs[l].append((r, i))\n ans = [0] * Q\n bit = BIT(N)\n for l in range(N - 1, -1, -1):\n for r in ps[l]:\n bit.add(r)\n for r, i in qs[l]:\n ans[i] = (r - l + 1) - bit.get_sum(r)\n print(*ans, sep=\"\\n\")\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 31.3131313131, "diff": ["-# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/", "-# Python3 code to find number of", "-# distinct numbers in a subarray", "-MAX = 1000001", "-# structure to store queries", "-class Query:", "- def __init__(self, l, r, idx):", "- self.l = l", "- self.r = r", "- self.idx = idx", "-# updating the bit array", "-def update(idx, val, bit, n):", "- while idx <= n:", "- bit[idx] += val", "- idx += idx & -idx", "+class BIT:", "+ def __init__(self, n):", "+ self.n = n", "+ self.data = [0] * (n + 1)", "+", "+ def add(self, i, x=1):", "+ i += 1", "+ while i <= self.n:", "+ self.data[i] += x", "+ i += i & -i", "+", "+ def get_sum(self, i):", "+ i += 1", "+ x = 0", "+ while i > 0:", "+ x += self.data[i]", "+ i -= i & -i", "+ return x", "+", "+ # Return sum for [l, r)", "+ def get_sum_range(self, l, r):", "+ return self.get_sum(r - 1) - self.get_sum(l - 1)", "-# querying the bit array", "-def query(idx, bit, n):", "- summ = 0", "- while idx:", "- summ += bit[idx]", "- idx -= idx & -idx", "- return summ", "-", "-", "-def answeringQueries(arr, n, queries, q):", "- # initialising bit array", "- bit = [0] * (n + 1)", "- # holds the rightmost index of", "- # any number as numbers of a[i]", "- # are less than or equal to 10^6", "- last_visit = [-1] * MAX", "- # answer for each query", "- ans = [0] * q", "- query_counter = 0", "- for i in range(n):", "- # If last visit is not -1 update -1 at the", "- # idx equal to last_visit[arr[i]]", "- if last_visit[arr[i]] != -1:", "- update(last_visit[arr[i]] + 1, -1, bit, n)", "- # Setting last_visit[arr[i]] as i and", "- # updating the bit array accordingly", "- last_visit[arr[i]] = i", "- update(i + 1, 1, bit, n)", "- # If i is equal to r of any query store answer", "- # for that query in ans[]", "- while query_counter < q and queries[query_counter].r == i:", "- ans[queries[query_counter].idx] = query(", "- queries[query_counter].r + 1, bit, n", "- ) - query(queries[query_counter].l, bit, n)", "- query_counter += 1", "- # print answer for each query", "- for i in range(q):", "- print((ans[i]))", "-", "-", "-# This code is contributed by", "-# sanjeev2552", "- N, Q = list(map(int, readline().split()))", "+ N, Q = map(int, readline().split())", "- (*LR,) = list(map(int, read().split()))", "- queries = [0] * Q", "+ LR = map(int, read().split())", "+ prev = [-1] * (N + 1)", "+ ps = [[] for _ in range(N)]", "+ for i, c in enumerate(C):", "+ if prev[c] != -1:", "+ ps[prev[c]].append(i)", "+ prev[c] = i", "+ qs = [[] for _ in range(N + 1)]", "- queries[i] = Query(l - 1, r - 1, i)", "- queries.sort(key=lambda x: x.r)", "- answeringQueries(C, N, queries, Q)", "+ l -= 1", "+ r -= 1", "+ qs[l].append((r, i))", "+ ans = [0] * Q", "+ bit = BIT(N)", "+ for l in range(N - 1, -1, -1):", "+ for r in ps[l]:", "+ bit.add(r)", "+ for r, i in qs[l]:", "+ ans[i] = (r - l + 1) - bit.get_sum(r)", "+ print(*ans, sep=\"\\n\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.264044944, "measured_runtime_v1": 0.2106282006, "runtime_lift": 1.2536067971, "key": ["s648865207", "s892817156"]} +{"user_id": "u023958502", "problem_id": "p03078", "language": "python", "submission_id_v0": "s928848207", "submission_id_v1": "s406476908", "cpu_time_v0": 1927, "cpu_time_v1": 827, "memory_v0": 4720, "memory_v1": 4592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.08, "input": "X,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nalready = [[0,0,0]]\n\nx,y,z = 0,0,0\n\nplace_sum = []\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n place_sum.append([x + 1,y,z])\n\n check.append(asort[x + 1] + bsort[y] + csort[z])\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n place_sum.append([x,y + 1,z])\n\n check.append(asort[x] + bsort[y + 1] + csort[z])\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n place_sum.append([x,y,z + 1])\n\n check.append(asort[x] + bsort[y] + csort[z + 1])\n\n print((max(check)))\n\n x,y,z = place_sum[check.index(max(check))][0],place_sum[check.index(max(check))][1],place_sum[check.index(max(check))][2]\n\n place_sum.pop(check.index(max(check)))\n\n check.remove(max(check))", "target": "import heapq\n\nX,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nalready = [[0,0,0]]\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nx,y,z = 0,0,0\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n heapq.heappush(check,(-(asort[x + 1] + bsort[y] + csort[z]),x + 1,y,z))\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n heapq.heappush(check,(-(asort[x] + bsort[y + 1] + csort[z]),x,y + 1,z))\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n heapq.heappush(check,(-(asort[x] + bsort[y] + csort[z + 1]),x,y,z + 1))\n\n maxsum = heapq.heappop(check)\n\n print((-maxsum[0]))\n\n x,y,z = maxsum[1],maxsum[2],maxsum[3]", "code_v0_loc": 27, "code_v1_loc": 23, "code_v0_num_chars": 1135, "code_v1_num_chars": 962, "code_v0_no_empty_lines": "X, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nasort, bsort, csort = (\n sorted(A, reverse=True),\n sorted(B, reverse=True),\n sorted(C, reverse=True),\n)\nprint((asort[0] + bsort[0] + csort[0]))\nalready = [[0, 0, 0]]\nx, y, z = 0, 0, 0\nplace_sum = []\ncheck = []\nfor k in range(K - 1):\n if [x + 1, y, z] not in already and x + 1 < X:\n already.append([x + 1, y, z])\n place_sum.append([x + 1, y, z])\n check.append(asort[x + 1] + bsort[y] + csort[z])\n if [x, y + 1, z] not in already and y + 1 < Y:\n already.append([x, y + 1, z])\n place_sum.append([x, y + 1, z])\n check.append(asort[x] + bsort[y + 1] + csort[z])\n if [x, y, z + 1] not in already and z + 1 < Z:\n already.append([x, y, z + 1])\n place_sum.append([x, y, z + 1])\n check.append(asort[x] + bsort[y] + csort[z + 1])\n print((max(check)))\n x, y, z = (\n place_sum[check.index(max(check))][0],\n place_sum[check.index(max(check))][1],\n place_sum[check.index(max(check))][2],\n )\n place_sum.pop(check.index(max(check)))\n check.remove(max(check))\n", "code_v1_no_empty_lines": "import heapq\n\nX, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nasort, bsort, csort = (\n sorted(A, reverse=True),\n sorted(B, reverse=True),\n sorted(C, reverse=True),\n)\nalready = [[0, 0, 0]]\nprint((asort[0] + bsort[0] + csort[0]))\nx, y, z = 0, 0, 0\ncheck = []\nfor k in range(K - 1):\n if [x + 1, y, z] not in already and x + 1 < X:\n already.append([x + 1, y, z])\n heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))\n if [x, y + 1, z] not in already and y + 1 < Y:\n already.append([x, y + 1, z])\n heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))\n if [x, y, z + 1] not in already and z + 1 < Z:\n already.append([x, y, z + 1])\n heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))\n maxsum = heapq.heappop(check)\n print((-maxsum[0]))\n x, y, z = maxsum[1], maxsum[2], maxsum[3]\n", "code_same": false, "relative_loc_diff_percent": 14.8148148148, "diff": ["+import heapq", "+", "+already = [[0, 0, 0]]", "-already = [[0, 0, 0]]", "-place_sum = []", "- place_sum.append([x + 1, y, z])", "- check.append(asort[x + 1] + bsort[y] + csort[z])", "+ heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))", "- place_sum.append([x, y + 1, z])", "- check.append(asort[x] + bsort[y + 1] + csort[z])", "+ heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))", "- place_sum.append([x, y, z + 1])", "- check.append(asort[x] + bsort[y] + csort[z + 1])", "- print((max(check)))", "- x, y, z = (", "- place_sum[check.index(max(check))][0],", "- place_sum[check.index(max(check))][1],", "- place_sum[check.index(max(check))][2],", "- )", "- place_sum.pop(check.index(max(check)))", "- check.remove(max(check))", "+ heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))", "+ maxsum = heapq.heappop(check)", "+ print((-maxsum[0]))", "+ x, y, z = maxsum[1], maxsum[2], maxsum[3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2974797392, "measured_runtime_v1": 0.2210724421, "runtime_lift": 1.3456210843, "key": ["s928848207", "s406476908"]} +{"user_id": "u619458041", "problem_id": "p03034", "language": "python", "submission_id_v0": "s001695168", "submission_id_v1": "s404140535", "cpu_time_v0": 1002, "cpu_time_v1": 783, "memory_v0": 17360, "memory_v1": 14388, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.86, "input": "import sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n for C in range(1, N//2):\n\n n = N // C\n\n point = 0\n\n used = set([0])\n\n for k in range(1, n):\n\n A = N - 1 - k*C\n\n\n\n if A in used or k*C in used or A == k*C:\n\n break\n\n used.add(A)\n\n used.add(k*C)\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n", "target": "import sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n # C = A - B\n\n for C in range(1, N//2):\n\n n = (N-1) // C\n\n point = 0\n\n for k in range(1, n):\n\n A = N-1 - k*C\n\n\n\n # Check A and B are positive integer, and S_i is not used twice.\n\n #\n\n # B = A - C and B >= 0, so A must be over C (A > C).\n\n #\n\n # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1\n\n # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than\n\n # or equal kC, the A's value is already used by kC.\n\n if A < C or ((N-1) % C == 0 and A <= k*C):\n\n break\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n", "code_v0_loc": 28, "code_v1_loc": 33, "code_v0_num_chars": 563, "code_v1_num_chars": 905, "code_v0_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n S = list(map(int, input().split()))\n ans = 0\n for C in range(1, N // 2):\n n = N // C\n point = 0\n used = set([0])\n for k in range(1, n):\n A = N - 1 - k * C\n if A in used or k * C in used or A == k * C:\n break\n used.add(A)\n used.add(k * C)\n point += S[A] + S[k * C]\n ans = max(ans, point)\n return ans\n\n\nif __name__ == \"__main__\":\n print((main()))\n", "code_v1_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n S = list(map(int, input().split()))\n ans = 0\n # C = A - B\n for C in range(1, N // 2):\n n = (N - 1) // C\n point = 0\n for k in range(1, n):\n A = N - 1 - k * C\n # Check A and B are positive integer, and S_i is not used twice.\n #\n # B = A - C and B >= 0, so A must be over C (A > C).\n #\n # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1\n # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than\n # or equal kC, the A's value is already used by kC.\n if A < C or ((N - 1) % C == 0 and A <= k * C):\n break\n point += S[A] + S[k * C]\n ans = max(ans, point)\n return ans\n\n\nif __name__ == \"__main__\":\n print((main()))\n", "code_same": false, "relative_loc_diff_percent": 15.1515151515, "diff": ["+ # C = A - B", "- n = N // C", "+ n = (N - 1) // C", "- used = set([0])", "- if A in used or k * C in used or A == k * C:", "+ # Check A and B are positive integer, and S_i is not used twice.", "+ #", "+ # B = A - C and B >= 0, so A must be over C (A > C).", "+ #", "+ # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1", "+ # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than", "+ # or equal kC, the A's value is already used by kC.", "+ if A < C or ((N - 1) % C == 0 and A <= k * C):", "- used.add(A)", "- used.add(k * C)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3095349545, "measured_runtime_v1": 0.0814658375, "runtime_lift": 3.7995675745, "key": ["s001695168", "s404140535"]} +{"user_id": "u260980560", "problem_id": "p00713", "language": "python", "submission_id_v0": "s376249504", "submission_id_v1": "s496295641", "cpu_time_v0": 32130, "cpu_time_v1": 27750, "memory_v0": 6520, "memory_v1": 6552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.63, "input": "from math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) / d) / 2.0\n\n xc = (x1 + x2) / 2.0\n\n yc = (y1 + y2) / 2.0\n\n return [[xc - k*yd, yc + k*xd], [xc + k*yd, yc - k*xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = [list(map(float, input().split())) for i in range(n)]\n\n p.sort()\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - bx >= 2.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)", "target": "from math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) / d) / 2.0\n\n xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0\n\n xd *= k; yd *= k\n\n return [[xc - yd, yc + xd], [xc + yd, yc - xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = sorted(list(map(float, input().split())) for i in range(n))\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - ex >= 1.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)", "code_v0_loc": 33, "code_v1_loc": 32, "code_v0_num_chars": 1141, "code_v1_num_chars": 1143, "code_v0_no_empty_lines": "from math import sqrt\nfrom bisect import bisect_left\n\n\ndef circle_center(x1, y1, x2, y2):\n xd = x2 - x1\n yd = y2 - y1\n d = xd**2 + yd**2\n k = sqrt((4.0 - d) / d) / 2.0\n xc = (x1 + x2) / 2.0\n yc = (y1 + y2) / 2.0\n return [[xc - k * yd, yc + k * xd], [xc + k * yd, yc - k * xd]]\n\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n p = [list(map(float, input().split())) for i in range(n)]\n p.sort()\n prev = 0\n ans = 1\n for i in range(n):\n bx, by = p[i]\n while bx - p[prev][0] >= 2.0:\n prev += 1\n for j in range(i + 1, n):\n cx, cy = p[j]\n if cx - bx >= 2.0:\n break\n if (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0:\n for ex, ey in circle_center(bx, by, cx, cy):\n count = 2\n for k in range(prev, n):\n if k == i or k == j:\n continue\n dx, dy = p[k]\n if dx - bx >= 2.0:\n break\n if (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0:\n count += 1\n ans = max(ans, count)\n print(ans)\n", "code_v1_no_empty_lines": "from math import sqrt\nfrom bisect import bisect_left\n\n\ndef circle_center(x1, y1, x2, y2):\n xd = x2 - x1\n yd = y2 - y1\n d = xd**2 + yd**2\n k = sqrt((4.0 - d) / d) / 2.0\n xc = (x1 + x2) / 2.0\n yc = (y1 + y2) / 2.0\n xd *= k\n yd *= k\n return [[xc - yd, yc + xd], [xc + yd, yc - xd]]\n\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n p = sorted(list(map(float, input().split())) for i in range(n))\n prev = 0\n ans = 1\n for i in range(n):\n bx, by = p[i]\n while bx - p[prev][0] >= 2.0:\n prev += 1\n for j in range(i + 1, n):\n cx, cy = p[j]\n if cx - bx >= 2.0:\n break\n if (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0:\n for ex, ey in circle_center(bx, by, cx, cy):\n count = 2\n for k in range(prev, n):\n if k == i or k == j:\n continue\n dx, dy = p[k]\n if dx - ex >= 1.0:\n break\n if (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0:\n count += 1\n ans = max(ans, count)\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 3.0303030303, "diff": ["- return [[xc - k * yd, yc + k * xd], [xc + k * yd, yc - k * xd]]", "+ xd *= k", "+ yd *= k", "+ return [[xc - yd, yc + xd], [xc + yd, yc - xd]]", "- p = [list(map(float, input().split())) for i in range(n)]", "- p.sort()", "+ p = sorted(list(map(float, input().split())) for i in range(n))", "- if dx - bx >= 2.0:", "+ if dx - ex >= 1.0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3026192219, "measured_runtime_v1": 0.1054183228, "runtime_lift": 2.8706510771, "key": ["s376249504", "s496295641"]} +{"user_id": "u260980560", "problem_id": "p01105", "language": "python", "submission_id_v0": "s457180384", "submission_id_v1": "s699385465", "cpu_time_v0": 130, "cpu_time_v1": 50, "memory_v0": 7848, "memory_v1": 7824, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.54, "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nL = {el: 1 for el in [a, b, c, d, e, 0]}\n\nfor i in range(6):\n\n R = sorted(L.items(), key=lambda x: x[1])\n\n for p, l in R:\n\n if l < 16:\n\n L[p ^ e] = min(L.get(p ^ e, 16), l+1)\n\n if l+3 < 16:\n\n for q, r in R:\n\n if l+r+3 <= 16:\n\n L[p & q] = min(L.get(p & q, 16), l+r+3)\n\n L[p ^ q] = min(L.get(p ^ q, 16), l+r+3)\n\n else: break\n\n else: break\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n", "target": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < L.get(p ^ e, 17):\n\n L[p^e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p^e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < L.get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < L.get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: H.append((p, l))\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n", "code_v0_loc": 15, "code_v1_loc": 24, "code_v0_num_chars": 639, "code_v1_num_chars": 874, "code_v0_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nL = {el: 1 for el in [a, b, c, d, e, 0]}\nfor i in range(6):\n R = sorted(L.items(), key=lambda x: x[1])\n for p, l in R:\n if l < 16:\n L[p ^ e] = min(L.get(p ^ e, 16), l + 1)\n if l + 3 < 16:\n for q, r in R:\n if l + r + 3 <= 16:\n L[p & q] = min(L.get(p & q, 16), l + r + 3)\n L[p ^ q] = min(L.get(p ^ q, 16), l + r + 3)\n else:\n break\n else:\n break\nprint(\n *(\n L[e & eval(s)]\n for s in open(0)\n .read()\n .replace(*\"-~\")\n .replace(*\"*&\")\n .replace(*\"1e\")\n .split()[:-1]\n ),\n sep=\"\\n\"\n)\n", "code_v1_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\nQ = [(1, el) for el in base]\nL = {el: 1 for el in base}\nH = []\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < L.get(p ^ e, 17):\n L[p ^ e] = l + 1\n if l + 1 < 16:\n heappush(Q, (l + 1, p ^ e))\n if l + 3 < 16:\n for q, r in H:\n if l + r + 3 <= 16:\n if l + r + 3 < L.get(p & q, 17):\n L[p & q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p & q))\n if l + r + 3 < L.get(p ^ q, 17):\n L[p ^ q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p ^ q))\n else:\n break\n if l < 7:\n H.append((p, l))\nprint(\n *(\n L[e & eval(s)]\n for s in open(0)\n .read()\n .replace(*\"-~\")\n .replace(*\"*&\")\n .replace(*\"1e\")\n .split()[:-1]\n ),\n sep=\"\\n\"\n)\n", "code_same": false, "relative_loc_diff_percent": 37.5, "diff": ["-L = {el: 1 for el in [a, b, c, d, e, 0]}", "-for i in range(6):", "- R = sorted(L.items(), key=lambda x: x[1])", "- for p, l in R:", "- if l < 16:", "- L[p ^ e] = min(L.get(p ^ e, 16), l + 1)", "- if l + 3 < 16:", "- for q, r in R:", "- if l + r + 3 <= 16:", "- L[p & q] = min(L.get(p & q, 16), l + r + 3)", "- L[p ^ q] = min(L.get(p ^ q, 16), l + r + 3)", "- else:", "- break", "- else:", "- break", "+from heapq import heappush, heappop", "+", "+base = [a, b, c, d, e, 0]", "+Q = [(1, el) for el in base]", "+L = {el: 1 for el in base}", "+H = []", "+while Q:", "+ l, p = heappop(Q)", "+ if L[p] < l:", "+ continue", "+ if l + 1 < L.get(p ^ e, 17):", "+ L[p ^ e] = l + 1", "+ if l + 1 < 16:", "+ heappush(Q, (l + 1, p ^ e))", "+ if l + 3 < 16:", "+ for q, r in H:", "+ if l + r + 3 <= 16:", "+ if l + r + 3 < L.get(p & q, 17):", "+ L[p & q] = l + r + 3", "+ if l + r + 3 < 16:", "+ heappush(Q, (l + r + 3, p & q))", "+ if l + r + 3 < L.get(p ^ q, 17):", "+ L[p ^ q] = l + r + 3", "+ if l + r + 3 < 16:", "+ heappush(Q, (l + r + 3, p ^ q))", "+ else:", "+ break", "+ if l < 7:", "+ H.append((p, l))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.012686343, "measured_runtime_v1": 0.2560091887, "runtime_lift": 3.9556640457, "key": ["s457180384", "s699385465"]} +{"user_id": "u989345508", "problem_id": "p03798", "language": "python", "submission_id_v0": "s244589711", "submission_id_v1": "s160001244", "cpu_time_v0": 1408, "cpu_time_v1": 1267, "memory_v0": 3892, "memory_v1": 3880, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.01, "input": "n=int(input())\n\ns=input()\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\n\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n #print(x[i])\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n", "target": "n=int(input())\n\ns=input()\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\na=[\"S\",\"W\"]\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n x[i]+=a[x[i][j]!=\"S\"]\n\n else:\n\n x[i]+=a[x[i][j]==\"S\"]\n\n else:\n\n if s[j+1]==\"o\":\n\n x[i]+=a[x[i][j]==\"S\"]\n\n else:\n\n x[i]+=a[x[i][j]!=\"S\"]\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n", "code_v0_loc": 82, "code_v1_loc": 69, "code_v0_num_chars": 2079, "code_v1_num_chars": 1752, "code_v0_no_empty_lines": "n = int(input())\ns = input()\nx = [\"SS\", \"SW\", \"WS\", \"WW\"]\n\n\ndef check0(i):\n if x[i][0] == \"S\":\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n\n\ndef check1(i):\n if x[i][n - 1] == \"S\":\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n\n\nfor i in range(4):\n for j in range(n - 2):\n if x[i][j + 1] == \"S\":\n if s[j + 1] == \"o\":\n if x[i][j] == \"S\":\n x[i] += \"S\"\n else:\n x[i] += \"W\"\n else:\n if x[i][j] == \"S\":\n x[i] += \"W\"\n else:\n x[i] += \"S\"\n else:\n if s[j + 1] == \"o\":\n if x[i][j] == \"S\":\n x[i] += \"W\"\n else:\n x[i] += \"S\"\n else:\n if x[i][j] == \"S\":\n x[i] += \"S\"\n else:\n x[i] += \"W\"\n # print(x[i])\n if check0(i) and check1(i):\n print((x[i]))\n break\nelse:\n print((-1))\n", "code_v1_no_empty_lines": "n = int(input())\ns = input()\nx = [\"SS\", \"SW\", \"WS\", \"WW\"]\n\n\ndef check0(i):\n if x[i][0] == \"S\":\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n\n\ndef check1(i):\n if x[i][n - 1] == \"S\":\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n\n\na = [\"S\", \"W\"]\nfor i in range(4):\n for j in range(n - 2):\n if x[i][j + 1] == \"S\":\n if s[j + 1] == \"o\":\n x[i] += a[x[i][j] != \"S\"]\n else:\n x[i] += a[x[i][j] == \"S\"]\n else:\n if s[j + 1] == \"o\":\n x[i] += a[x[i][j] == \"S\"]\n else:\n x[i] += a[x[i][j] != \"S\"]\n if check0(i) and check1(i):\n print((x[i]))\n break\nelse:\n print((-1))\n", "code_same": false, "relative_loc_diff_percent": 15.8536585366, "diff": ["+a = [\"S\", \"W\"]", "- if x[i][j] == \"S\":", "- x[i] += \"S\"", "- else:", "- x[i] += \"W\"", "+ x[i] += a[x[i][j] != \"S\"]", "- if x[i][j] == \"S\":", "- x[i] += \"W\"", "- else:", "- x[i] += \"S\"", "+ x[i] += a[x[i][j] == \"S\"]", "- if x[i][j] == \"S\":", "- x[i] += \"W\"", "- else:", "- x[i] += \"S\"", "+ x[i] += a[x[i][j] == \"S\"]", "- if x[i][j] == \"S\":", "- x[i] += \"S\"", "- else:", "- x[i] += \"W\"", "- # print(x[i])", "+ x[i] += a[x[i][j] != \"S\"]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.206637172, "measured_runtime_v1": 0.0056119666, "runtime_lift": 36.8208127342, "key": ["s244589711", "s160001244"]} +{"user_id": "u747602774", "problem_id": "p03039", "language": "python", "submission_id_v0": "s108635717", "submission_id_v1": "s387237372", "cpu_time_v0": 543, "cpu_time_v1": 230, "memory_v0": 9432, "memory_v1": 9412, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.64, "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n ans += f1(x,y,n,m)+f1(1,1,x,y)+f1(1,y,x,m)+f1(x,1,n,y)\n\n ans -= f2(x,n) + f2(1,x) + f2(1,y) + f2(y,m)\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n", "target": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)//2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "code_v0_loc": 38, "code_v1_loc": 42, "code_v0_num_chars": 796, "code_v1_num_chars": 809, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) // 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n ans += f1(x, y, n, m) + f1(1, 1, x, y) + f1(1, y, x, m) + f1(x, 1, n, y)\n ans -= f2(x, n) + f2(1, x) + f2(1, y) + f2(y, m)\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) // 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n a = n - x + 1\n b = m - y + 1\n c = m * (a * (a - 1) + x * (x - 1))\n d = n * (b * (b - 1) + y * (y - 1))\n ans += (c + d) // 2\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.5238095238, "diff": ["- ans += f1(x, y, n, m) + f1(1, 1, x, y) + f1(1, y, x, m) + f1(x, 1, n, y)", "- ans -= f2(x, n) + f2(1, x) + f2(1, y) + f2(y, m)", "+ a = n - x + 1", "+ b = m - y + 1", "+ c = m * (a * (a - 1) + x * (x - 1))", "+ d = n * (b * (b - 1) + y * (y - 1))", "+ ans += (c + d) // 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4582999928, "measured_runtime_v1": 0.3618569455, "runtime_lift": 1.2665225816, "key": ["s108635717", "s387237372"]} +{"user_id": "u072053884", "problem_id": "p02245", "language": "python", "submission_id_v0": "s696240934", "submission_id_v1": "s480327836", "cpu_time_v0": 120, "cpu_time_v1": 60, "memory_v0": 10724, "memory_v1": 13476, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "import sys\n\n\n\ninit = ''.join(sys.stdin.read().split())\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start, goal):\n\n if start == goal:\n\n return 0\n\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n\n step = {start: 0, goal: 0}\n\n s = 0\n\n c_d = [(start, 0), (goal, 1)] # configure and direction\n\n while True:\n\n q = iter(c_d)\n\n c_d = []\n\n s += 1\n\n for c, d in q:\n\n i = c.find('0')\n\n if 0 <= i <= 5:\n\n t = str.maketrans('0' + c[i+3], c[i+3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i >= 3:\n\n t = str.maketrans('0' + c[i-3], c[i-3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n\n t = str.maketrans('0' + c[i+1], c[i+1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n\n t = str.maketrans('0' + c[i-1], c[i-1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n\n\nprint((solve(init, '123456780')))", "target": "adjacent = (\n\n (1, 3), # 0\n\n (0, 2, 4), # 1\n\n (1, 5), # 2\n\n (0, 4, 6), # 3\n\n (1, 3, 5, 7), # 4\n\n (2, 4, 8), # 5\n\n (3, 7), # 6\n\n (4, 6, 8), # 7\n\n (5, 7) # 8\n\n)\n\n\n\nimport collections\n\n\n\nGOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start):\n\n if start == GOAL:\n\n return 0\n\n # 0: forward, 1: backward\n\n generated_state = {tuple(start): 0, tuple(GOAL): 1}\n\n step = {tuple(start): 0, tuple(GOAL): 0}\n\n s = 0\n\n state1 = [(start, 0), (GOAL, 1)]\n\n while state1:\n\n state2 = state1[:]\n\n state1 = []\n\n s += 1\n\n for s2, d in state2:\n\n i = s2.index(0)\n\n for p in adjacent[i]:\n\n s1 = s2[:]\n\n s1[i], s1[p] = s1[p], 0\n\n key = tuple(s1)\n\n if key in generated_state:\n\n if generated_state[key] != d:\n\n return s + step[key]\n\n continue\n\n state1.append((s1, d))\n\n generated_state[key] = d\n\n step[key] = s\n\n\n\nimport sys\n\n\n\nstart = list(map(int, sys.stdin.read().split()))\n\n\n\nprint((solve(start)))", "code_v0_loc": 60, "code_v1_loc": 48, "code_v0_num_chars": 2264, "code_v1_num_chars": 1231, "code_v0_no_empty_lines": "import sys\n\ninit = \"\".join(sys.stdin.read().split())\n# Bidirectional search using breadth-first search\ndef solve(start, goal):\n if start == goal:\n return 0\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n step = {start: 0, goal: 0}\n s = 0\n c_d = [(start, 0), (goal, 1)] # configure and direction\n while True:\n q = iter(c_d)\n c_d = []\n s += 1\n for c, d in q:\n i = c.find(\"0\")\n if 0 <= i <= 5:\n t = str.maketrans(\"0\" + c[i + 3], c[i + 3] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i >= 3:\n t = str.maketrans(\"0\" + c[i - 3], c[i - 3] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n t = str.maketrans(\"0\" + c[i + 1], c[i + 1] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n t = str.maketrans(\"0\" + c[i - 1], c[i - 1] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n\n\nprint((solve(init, \"123456780\")))\n", "code_v1_no_empty_lines": "adjacent = (\n (1, 3), # 0\n (0, 2, 4), # 1\n (1, 5), # 2\n (0, 4, 6), # 3\n (1, 3, 5, 7), # 4\n (2, 4, 8), # 5\n (3, 7), # 6\n (4, 6, 8), # 7\n (5, 7), # 8\n)\nimport collections\n\nGOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]\n# Bidirectional search using breadth-first search\ndef solve(start):\n if start == GOAL:\n return 0\n # 0: forward, 1: backward\n generated_state = {tuple(start): 0, tuple(GOAL): 1}\n step = {tuple(start): 0, tuple(GOAL): 0}\n s = 0\n state1 = [(start, 0), (GOAL, 1)]\n while state1:\n state2 = state1[:]\n state1 = []\n s += 1\n for s2, d in state2:\n i = s2.index(0)\n for p in adjacent[i]:\n s1 = s2[:]\n s1[i], s1[p] = s1[p], 0\n key = tuple(s1)\n if key in generated_state:\n if generated_state[key] != d:\n return s + step[key]\n continue\n state1.append((s1, d))\n generated_state[key] = d\n step[key] = s\n\n\nimport sys\n\nstart = list(map(int, sys.stdin.read().split()))\nprint((solve(start)))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["+adjacent = (", "+ (1, 3), # 0", "+ (0, 2, 4), # 1", "+ (1, 5), # 2", "+ (0, 4, 6), # 3", "+ (1, 3, 5, 7), # 4", "+ (2, 4, 8), # 5", "+ (3, 7), # 6", "+ (4, 6, 8), # 7", "+ (5, 7), # 8", "+)", "+import collections", "+", "+GOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]", "+# Bidirectional search using breadth-first search", "+def solve(start):", "+ if start == GOAL:", "+ return 0", "+ # 0: forward, 1: backward", "+ generated_state = {tuple(start): 0, tuple(GOAL): 1}", "+ step = {tuple(start): 0, tuple(GOAL): 0}", "+ s = 0", "+ state1 = [(start, 0), (GOAL, 1)]", "+ while state1:", "+ state2 = state1[:]", "+ state1 = []", "+ s += 1", "+ for s2, d in state2:", "+ i = s2.index(0)", "+ for p in adjacent[i]:", "+ s1 = s2[:]", "+ s1[i], s1[p] = s1[p], 0", "+ key = tuple(s1)", "+ if key in generated_state:", "+ if generated_state[key] != d:", "+ return s + step[key]", "+ continue", "+ state1.append((s1, d))", "+ generated_state[key] = d", "+ step[key] = s", "+", "+", "-init = \"\".join(sys.stdin.read().split())", "-# Bidirectional search using breadth-first search", "-def solve(start, goal):", "- if start == goal:", "- return 0", "- generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward", "- step = {start: 0, goal: 0}", "- s = 0", "- c_d = [(start, 0), (goal, 1)] # configure and direction", "- while True:", "- q = iter(c_d)", "- c_d = []", "- s += 1", "- for c, d in q:", "- i = c.find(\"0\")", "- if 0 <= i <= 5:", "- t = str.maketrans(\"0\" + c[i + 3], c[i + 3] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "- if i >= 3:", "- t = str.maketrans(\"0\" + c[i - 3], c[i - 3] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "- if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:", "- t = str.maketrans(\"0\" + c[i + 1], c[i + 1] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "- if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:", "- t = str.maketrans(\"0\" + c[i - 1], c[i - 1] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "-", "-", "-print((solve(init, \"123456780\")))", "+start = list(map(int, sys.stdin.read().split()))", "+print((solve(start)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3218115091, "measured_runtime_v1": 0.2098443508, "runtime_lift": 1.533572421, "key": ["s696240934", "s480327836"]} +{"user_id": "u852690916", "problem_id": "p02794", "language": "python", "submission_id_v0": "s356881403", "submission_id_v1": "s623982203", "cpu_time_v0": 2735, "cpu_time_v1": 2229, "memory_v0": 44580, "memory_v1": 43936, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.5, "input": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(input())\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(input())\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 52, "code_v1_loc": 54, "code_v0_num_chars": 1262, "code_v1_num_chars": 1288, "code_v0_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n E = [[] for _ in range(N)]\n for i in range(N - 1):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n E[a].append((b, i))\n E[b].append((a, i))\n\n def dfs(s, g):\n par = [(-1, -1)] * N\n par[s] = (s, -1)\n stack = [s]\n while stack:\n v = stack.pop()\n for to, i in E[v]:\n if par[to][0] >= 0:\n continue\n par[to] = (v, i)\n if to == g:\n break\n stack.append(to)\n r = set()\n v = g\n while v != s:\n v, i = par[v]\n r.add(i)\n return r\n\n M = int(input())\n path = [None] * M\n for i in range(M):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n path[i] = dfs(u, v)\n\n def calc(s):\n return 1 << (N - 1 - len(s))\n\n i_ans = 0\n for p in range(1, 1 << M):\n is_odd = bin(p).count(\"1\") & 1\n s = set()\n for i in range(M):\n if p & 1:\n s |= path[i]\n p >>= 1\n if is_odd:\n i_ans += calc(s)\n else:\n i_ans -= calc(s)\n print(((1 << (N - 1)) - i_ans))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n E = [[] for _ in range(N)]\n for i in range(N - 1):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n E[a].append((b, i))\n E[b].append((a, i))\n\n def dfs(s, g):\n par = [(-1, -1)] * N\n par[s] = (s, -1)\n stack = [s]\n while stack:\n v = stack.pop()\n for to, i in E[v]:\n if par[to][0] >= 0:\n continue\n par[to] = (v, i)\n if to == g:\n break\n stack.append(to)\n r = set()\n v = g\n while v != s:\n v, i = par[v]\n r.add(i)\n return r\n\n M = int(input())\n path = [None] * M\n for i in range(M):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n path[i] = dfs(u, v)\n\n def calc(s):\n return 1 << (N - 1 - len(s))\n\n i_ans = 0\n for p in range(1, 1 << M):\n is_odd = 0\n s = set()\n for i in range(M):\n if p & 1:\n s |= path[i]\n is_odd ^= 1\n p >>= 1\n if is_odd:\n i_ans += calc(s)\n else:\n i_ans -= calc(s)\n print(((1 << (N - 1)) - i_ans))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 3.7037037037, "diff": ["- is_odd = bin(p).count(\"1\") & 1", "+ is_odd = 0", "+ is_odd ^= 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3895377469, "measured_runtime_v1": 0.2566085732, "runtime_lift": 1.5180231199, "key": ["s356881403", "s623982203"]} +{"user_id": "u295361373", "problem_id": "p02612", "language": "python", "submission_id_v0": "s197156959", "submission_id_v1": "s836901225", "cpu_time_v0": 226, "cpu_time_v1": 180, "memory_v0": 68124, "memory_v1": 68072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.35, "input": "'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(input())\n\ndef si():return input()\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n#mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile = 0\n\n\n\ndef solve():\n\n \n\n\n\n\n\n\n\n # for _ in range(ii()):\n\n\n\n n=ii()\n\n n%=1000\n\n if n!=0:\n\n n=1000-n\n\n print(n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()", "target": "'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom heapq import heappush,heappop\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(input())\n\ndef si():return input()\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n# mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile=0\n\n\n\n\n\n\n\n\n\n\n\ndef solve():\n\n\n\n\n\n # for _ in range(ii()):\n\n \n\n \n\n\n\n n=ii()\n\n n%=1000\n\n if(n!=0):\n\n n=1000-n\n\n print(n)\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()\n", "code_v0_loc": 77, "code_v1_loc": 66, "code_v0_num_chars": 1162, "code_v1_num_chars": 1190, "code_v0_no_empty_lines": "\"\"\"\n Auther: ghoshashis545 Ashis Ghosh\n College: jalpaiguri Govt Enggineering College\n\"\"\"\nfrom os import path\nimport sys\nfrom functools import cmp_to_key as ctk\nfrom collections import deque, defaultdict as dd\nfrom bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right\nfrom itertools import permutations\nfrom datetime import datetime\nfrom math import ceil, sqrt, log, gcd\n\n\ndef ii():\n return int(input())\n\n\ndef si():\n return input()\n\n\ndef mi():\n return list(map(int, input().split()))\n\n\ndef li():\n return list(mi())\n\n\nabc = \"abcdefghijklmnopqrstuvwxyz\"\nmod = 1000000007\n# mod=998244353\ninf = float(\"inf\")\nvow = [\"a\", \"e\", \"i\", \"o\", \"u\"]\ndx, dy = [-1, 1, 0, 0], [0, 0, 1, -1]\n\n\ndef bo(i):\n return ord(i) - ord(\"a\")\n\n\nfile = 0\n\n\ndef solve():\n # for _ in range(ii()):\n n = ii()\n n %= 1000\n if n != 0:\n n = 1000 - n\n print(n)\n\n\nif __name__ == \"__main__\":\n if file:\n if path.exists(\"input1.txt\"):\n sys.stdin = open(\"input1.txt\", \"r\")\n sys.stdout = open(\"output1.txt\", \"w\")\n else:\n input = sys.stdin.readline\n solve()\n", "code_v1_no_empty_lines": "\"\"\"\n Auther: ghoshashis545 Ashis Ghosh\n College: jalpaiguri Govt Enggineering College\n\"\"\"\nfrom os import path\nimport sys\nfrom heapq import heappush, heappop\nfrom functools import cmp_to_key as ctk\nfrom collections import deque, defaultdict as dd\nfrom bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right\nfrom itertools import permutations\nfrom datetime import datetime\nfrom math import ceil, sqrt, log, gcd\n\n\ndef ii():\n return int(input())\n\n\ndef si():\n return input()\n\n\ndef mi():\n return list(map(int, input().split()))\n\n\ndef li():\n return list(mi())\n\n\nabc = \"abcdefghijklmnopqrstuvwxyz\"\nmod = 1000000007\n# mod=998244353\ninf = float(\"inf\")\nvow = [\"a\", \"e\", \"i\", \"o\", \"u\"]\ndx, dy = [-1, 1, 0, 0], [0, 0, 1, -1]\n\n\ndef bo(i):\n return ord(i) - ord(\"a\")\n\n\nfile = 0\n\n\ndef solve():\n # for _ in range(ii()):\n n = ii()\n n %= 1000\n if n != 0:\n n = 1000 - n\n print(n)\n\n\nif __name__ == \"__main__\":\n if file:\n if path.exists(\"input1.txt\"):\n sys.stdin = open(\"input1.txt\", \"r\")\n sys.stdout = open(\"output1.txt\", \"w\")\n else:\n input = sys.stdin.readline\n solve()\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["+from heapq import heappush, heappop"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3258618799, "measured_runtime_v1": 0.2078528001, "runtime_lift": 1.5677531392, "key": ["s197156959", "s836901225"]} +{"user_id": "u001024152", "problem_id": "p03806", "language": "python", "submission_id_v0": "s636298531", "submission_id_v1": "s857325561", "cpu_time_v0": 1682, "cpu_time_v1": 292, "memory_v0": 59496, "memory_v1": 48860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.64, "input": "G_MAX = 40*10\n\nN_MAX = 40\n\nINF = float('inf')\n\n\n\ndp = [[[INF]*(G_MAX+1) for _ in range(G_MAX+1)] \n\n for _ in range(N_MAX+1)]\n\nN,Ma,Mb = list(map(int, input().split()))\n\na,b,c = [],[],[]\n\nfor _ in range(N):\n\n ai,bi,ci = list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\n c.append(ci)\n\n\n\ndp[0][0][0] = 0\n\nfrom math import isinf\n\nfor i in range(N):\n\n for ca in range(G_MAX+1):\n\n for cb in range(G_MAX+1):\n\n if isinf(dp[i][ca][cb]): continue\n\n dp[i+1][ca][cb] = min(dp[i+1][ca][cb],\n\n dp[i][ca][cb])\n\n dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]],\n\n dp[i][ca][cb]+c[i])\n\n \n\n \n\nans = INF\n\nfor ca in range(1,G_MAX+1):\n\n for cb in range(1,G_MAX+1):\n\n if ca*Mb==cb*Ma:\n\n ans = min(ans, dp[N][ca][cb])\n\n \n\nif isinf(ans): ans = -1\n\nprint(ans)", "target": "from math import isinf\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\na = [0]*N\n\nb = [0]*N\n\nc = [0]*N\n\nfor i in range(N):\n\n a[i],b[i],c[i] = list(map(int, input().split()))\n\n\n\nW_MAX = 40*10\n\ndp = [[float('inf')]*(W_MAX+1) for _ in range(W_MAX+1)]\n\ndp[0][0] = 0\n\n\n\nfor i in range(N):\n\n for wa in reversed(list(range(W_MAX+1))):\n\n for wb in reversed(list(range(W_MAX+1))):\n\n if isinf(dp[wa][wb]): continue\n\n if wa+a[i]<=W_MAX and wb+b[i]<=W_MAX:\n\n dp[wa+a[i]][wb+b[i]] = min(dp[wa+a[i]][wb+b[i]],\n\n dp[wa][wb]+c[i])\n\n\n\nans = float('inf')\n\nfor wa in range(1, W_MAX+1):\n\n for wb in range(1, W_MAX+1):\n\n if wa*Mb == wb*Ma:\n\n ans = min(ans, dp[wa][wb])\n\n\n\nif isinf(ans): ans = -1\n\nprint(ans)", "code_v0_loc": 34, "code_v1_loc": 29, "code_v0_num_chars": 926, "code_v1_num_chars": 775, "code_v0_no_empty_lines": "G_MAX = 40 * 10\nN_MAX = 40\nINF = float(\"inf\")\ndp = [[[INF] * (G_MAX + 1) for _ in range(G_MAX + 1)] for _ in range(N_MAX + 1)]\nN, Ma, Mb = list(map(int, input().split()))\na, b, c = [], [], []\nfor _ in range(N):\n ai, bi, ci = list(map(int, input().split()))\n a.append(ai)\n b.append(bi)\n c.append(ci)\ndp[0][0][0] = 0\nfrom math import isinf\n\nfor i in range(N):\n for ca in range(G_MAX + 1):\n for cb in range(G_MAX + 1):\n if isinf(dp[i][ca][cb]):\n continue\n dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb])\n dp[i + 1][ca + a[i]][cb + b[i]] = min(\n dp[i + 1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]\n )\nans = INF\nfor ca in range(1, G_MAX + 1):\n for cb in range(1, G_MAX + 1):\n if ca * Mb == cb * Ma:\n ans = min(ans, dp[N][ca][cb])\nif isinf(ans):\n ans = -1\nprint(ans)\n", "code_v1_no_empty_lines": "from math import isinf\n\nN, Ma, Mb = list(map(int, input().split()))\na = [0] * N\nb = [0] * N\nc = [0] * N\nfor i in range(N):\n a[i], b[i], c[i] = list(map(int, input().split()))\nW_MAX = 40 * 10\ndp = [[float(\"inf\")] * (W_MAX + 1) for _ in range(W_MAX + 1)]\ndp[0][0] = 0\nfor i in range(N):\n for wa in reversed(list(range(W_MAX + 1))):\n for wb in reversed(list(range(W_MAX + 1))):\n if isinf(dp[wa][wb]):\n continue\n if wa + a[i] <= W_MAX and wb + b[i] <= W_MAX:\n dp[wa + a[i]][wb + b[i]] = min(\n dp[wa + a[i]][wb + b[i]], dp[wa][wb] + c[i]\n )\nans = float(\"inf\")\nfor wa in range(1, W_MAX + 1):\n for wb in range(1, W_MAX + 1):\n if wa * Mb == wb * Ma:\n ans = min(ans, dp[wa][wb])\nif isinf(ans):\n ans = -1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 14.7058823529, "diff": ["-G_MAX = 40 * 10", "-N_MAX = 40", "-INF = float(\"inf\")", "-dp = [[[INF] * (G_MAX + 1) for _ in range(G_MAX + 1)] for _ in range(N_MAX + 1)]", "-N, Ma, Mb = list(map(int, input().split()))", "-a, b, c = [], [], []", "-for _ in range(N):", "- ai, bi, ci = list(map(int, input().split()))", "- a.append(ai)", "- b.append(bi)", "- c.append(ci)", "-dp[0][0][0] = 0", "+N, Ma, Mb = list(map(int, input().split()))", "+a = [0] * N", "+b = [0] * N", "+c = [0] * N", "- for ca in range(G_MAX + 1):", "- for cb in range(G_MAX + 1):", "- if isinf(dp[i][ca][cb]):", "+ a[i], b[i], c[i] = list(map(int, input().split()))", "+W_MAX = 40 * 10", "+dp = [[float(\"inf\")] * (W_MAX + 1) for _ in range(W_MAX + 1)]", "+dp[0][0] = 0", "+for i in range(N):", "+ for wa in reversed(list(range(W_MAX + 1))):", "+ for wb in reversed(list(range(W_MAX + 1))):", "+ if isinf(dp[wa][wb]):", "- dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb])", "- dp[i + 1][ca + a[i]][cb + b[i]] = min(", "- dp[i + 1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]", "- )", "-ans = INF", "-for ca in range(1, G_MAX + 1):", "- for cb in range(1, G_MAX + 1):", "- if ca * Mb == cb * Ma:", "- ans = min(ans, dp[N][ca][cb])", "+ if wa + a[i] <= W_MAX and wb + b[i] <= W_MAX:", "+ dp[wa + a[i]][wb + b[i]] = min(", "+ dp[wa + a[i]][wb + b[i]], dp[wa][wb] + c[i]", "+ )", "+ans = float(\"inf\")", "+for wa in range(1, W_MAX + 1):", "+ for wb in range(1, W_MAX + 1):", "+ if wa * Mb == wb * Ma:", "+ ans = min(ans, dp[wa][wb])"], "diff_only_import_comment": false, "measured_runtime_v0": 2.4082550259, "measured_runtime_v1": 0.8679478877, "runtime_lift": 2.7746539396, "key": ["s636298531", "s857325561"]} +{"user_id": "u312025627", "problem_id": "p02901", "language": "python", "submission_id_v0": "s827366183", "submission_id_v1": "s086626630", "cpu_time_v0": 364, "cpu_time_v1": 311, "memory_v0": 78552, "memory_v1": 75116, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.56, "input": "INF = 2*10**7\n\n\n\n\n\ndef main():\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "INF = 2*10**7\n\n\n\n\n\ndef main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 34, "code_v1_loc": 36, "code_v0_num_chars": 827, "code_v1_num_chars": 882, "code_v0_no_empty_lines": "INF = 2 * 10**7\n\n\ndef main():\n N, M = (int(i) for i in input().split())\n A = []\n B = []\n C = []\n for _ in range(M):\n a, b = (int(i) for i in input().split())\n A.append(a)\n B.append(b)\n bit = 0\n for i in input().split():\n bit |= 1 << (int(i) - 1)\n C.append(bit)\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n if dp[i][j] != INF:\n next_bit = j | C[i]\n dp[i + 1][next_bit] = min(dp[i + 1][next_bit], dp[i][j] + A[i])\n ans = dp[-1][-1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n # print(*dp, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "INF = 2 * 10**7\n\n\ndef main():\n import sys\n\n input = sys.stdin.buffer.readline\n N, M = (int(i) for i in input().split())\n A = []\n B = []\n C = []\n for _ in range(M):\n a, b = (int(i) for i in input().split())\n A.append(a)\n B.append(b)\n bit = 0\n for i in input().split():\n bit |= 1 << (int(i) - 1)\n C.append(bit)\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n if dp[i][j] != INF:\n next_bit = j | C[i]\n dp[i + 1][next_bit] = min(dp[i + 1][next_bit], dp[i][j] + A[i])\n ans = dp[-1][-1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n # print(*dp, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 5.5555555556, "diff": ["+ import sys", "+", "+ input = sys.stdin.buffer.readline"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4147989278, "measured_runtime_v1": 0.289175185, "runtime_lift": 1.4344208955, "key": ["s827366183", "s086626630"]} +{"user_id": "u427344224", "problem_id": "p03253", "language": "python", "submission_id_v0": "s043094515", "submission_id_v1": "s952701444", "cpu_time_v0": 1290, "cpu_time_v1": 20, "memory_v0": 5164, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 98.45, "input": "def prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num //= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\nfrom math import factorial\n\n\n\n\n\ndef comb(n, r, R):\n\n if n not in R:\n\n a = factorial(n)\n\n R[n] = a\n\n else:\n\n a = R[n]\n\n\n\n if n - r not in R:\n\n b = factorial(n - r)\n\n R[n - r] = b\n\n else:\n\n b = R[n - r]\n\n\n\n if r not in R:\n\n c = factorial(r)\n\n R[r] = c\n\n else:\n\n c = R[r]\n\n return a // (b * c)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nR = dict()\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= comb(v + n - 1, v, R)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n", "target": "def prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num //= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\n\n\ndef combination(n, r):\n\n r = min(n-r, r)\n\n result = 1\n\n for i in range(n, n-r, -1):\n\n result *= i\n\n for i in range(1, r+1):\n\n result //= i\n\n return result\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= combination(v + n - 1, v)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n", "code_v0_loc": 56, "code_v1_loc": 42, "code_v0_num_chars": 1269, "code_v1_num_chars": 1072, "code_v0_no_empty_lines": "def prime_factorize(num):\n \"\"\"\n This function performs prime factorization on the input natural number.\n The result is returned in the form of a dictionary with the prime number as the key\n and its number as the value.\n :param num:\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n \"\"\"\n prime_factor = {}\n i = 2\n while i**2 <= num:\n while num % i == 0:\n num //= i\n if i in list(prime_factor.keys()):\n prime_factor[i] += 1\n else:\n prime_factor[i] = 1\n i += 1\n if num > 1:\n prime_factor[num] = 1\n return prime_factor\n\n\nfrom math import factorial\n\n\ndef comb(n, r, R):\n if n not in R:\n a = factorial(n)\n R[n] = a\n else:\n a = R[n]\n if n - r not in R:\n b = factorial(n - r)\n R[n - r] = b\n else:\n b = R[n - r]\n if r not in R:\n c = factorial(r)\n R[r] = c\n else:\n c = R[r]\n return a // (b * c)\n\n\nn, m = list(map(int, input().split()))\nr = 1\nR = dict()\nprime_fac = prime_factorize(m)\nfor v in list(prime_fac.values()):\n r *= comb(v + n - 1, v, R)\nmod = 1000000000 + 7\nprint((r % mod))\n", "code_v1_no_empty_lines": "def prime_factorize(num):\n \"\"\"\n This function performs prime factorization on the input natural number.\n The result is returned in the form of a dictionary with the prime number as the key\n and its number as the value.\n :param num:\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n \"\"\"\n prime_factor = {}\n i = 2\n while i**2 <= num:\n while num % i == 0:\n num //= i\n if i in list(prime_factor.keys()):\n prime_factor[i] += 1\n else:\n prime_factor[i] = 1\n i += 1\n if num > 1:\n prime_factor[num] = 1\n return prime_factor\n\n\ndef combination(n, r):\n r = min(n - r, r)\n result = 1\n for i in range(n, n - r, -1):\n result *= i\n for i in range(1, r + 1):\n result //= i\n return result\n\n\nn, m = list(map(int, input().split()))\nr = 1\nprime_fac = prime_factorize(m)\nfor v in list(prime_fac.values()):\n r *= combination(v + n - 1, v)\nmod = 1000000000 + 7\nprint((r % mod))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-from math import factorial", "-", "-", "-def comb(n, r, R):", "- if n not in R:", "- a = factorial(n)", "- R[n] = a", "- else:", "- a = R[n]", "- if n - r not in R:", "- b = factorial(n - r)", "- R[n - r] = b", "- else:", "- b = R[n - r]", "- if r not in R:", "- c = factorial(r)", "- R[r] = c", "- else:", "- c = R[r]", "- return a // (b * c)", "+def combination(n, r):", "+ r = min(n - r, r)", "+ result = 1", "+ for i in range(n, n - r, -1):", "+ result *= i", "+ for i in range(1, r + 1):", "+ result //= i", "+ return result", "-R = dict()", "- r *= comb(v + n - 1, v, R)", "+ r *= combination(v + n - 1, v)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4743831277, "measured_runtime_v1": 0.1920195122, "runtime_lift": 2.4704943903, "key": ["s043094515", "s952701444"]} +{"user_id": "u864197622", "problem_id": "p02822", "language": "python", "submission_id_v0": "s981663077", "submission_id_v1": "s820806781", "cpu_time_v0": 1240, "cpu_time_v1": 890, "memory_v0": 93784, "memory_v1": 100756, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.23, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\ninv2 = (mod + 1) // 2\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n\n for j in X[i]:\n\n s = (s * pow(inv2, A[j], mod)) % mod\n\n t = (t + (1-pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))", "target": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\npow2 = [1]\n\nfor i in range(N + 10):\n\n pow2.append(pow2[-1] * 2 % mod)\n\ninv2 = (mod + 1) // 2\n\n\n\ninvpow2 = [pow(pow2[-1], mod-2, mod)]\n\nfor i in range(N + 10)[::-1]:\n\n invpow2.append(invpow2[-1] * 2 % mod)\n\ninvpow2 = invpow2[::-1]\n\n\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-invpow2[N-A[i]]) * pow2[N-A[i]]\n\n for j in X[i]:\n\n s = (s * invpow2[A[j]]) % mod\n\n t = (t + (1-invpow2[A[j]]) * pow2[A[j]]) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))", "code_v0_loc": 41, "code_v1_loc": 50, "code_v0_num_chars": 951, "code_v1_num_chars": 1128, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import deque\n\nN = int(input())\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\ni0 = min([i for i in range(N) if len(X[i]) == 1])\nP = [-1] * N\nQ = deque([i0])\nR = []\nwhile Q:\n i = deque.popleft(Q)\n R.append(i)\n for a in X[i]:\n if a != P[i]:\n P[a] = i\n X[a].remove(i)\n deque.append(Q, a)\nmod = 10**9 + 7\ninv2 = (mod + 1) // 2\nA = [1] * N\nfor i in R[::-1]:\n s = 0\n for j in X[i]:\n A[i] += A[j]\nans = 0\nfor i in range(N):\n s = pow(inv2, N - A[i], mod)\n t = 1 + (1 - pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n for j in X[i]:\n s = (s * pow(inv2, A[j], mod)) % mod\n t = (t + (1 - pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n ans = (ans + 1 - s * t) % mod\nprint((ans * inv2 % mod))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import deque\n\nN = int(input())\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\ni0 = min([i for i in range(N) if len(X[i]) == 1])\nP = [-1] * N\nQ = deque([i0])\nR = []\nwhile Q:\n i = deque.popleft(Q)\n R.append(i)\n for a in X[i]:\n if a != P[i]:\n P[a] = i\n X[a].remove(i)\n deque.append(Q, a)\nmod = 10**9 + 7\npow2 = [1]\nfor i in range(N + 10):\n pow2.append(pow2[-1] * 2 % mod)\ninv2 = (mod + 1) // 2\ninvpow2 = [pow(pow2[-1], mod - 2, mod)]\nfor i in range(N + 10)[::-1]:\n invpow2.append(invpow2[-1] * 2 % mod)\ninvpow2 = invpow2[::-1]\nA = [1] * N\nfor i in R[::-1]:\n s = 0\n for j in X[i]:\n A[i] += A[j]\nans = 0\nfor i in range(N):\n s = pow(inv2, N - A[i], mod)\n t = 1 + (1 - invpow2[N - A[i]]) * pow2[N - A[i]]\n for j in X[i]:\n s = (s * invpow2[A[j]]) % mod\n t = (t + (1 - invpow2[A[j]]) * pow2[A[j]]) % mod\n ans = (ans + 1 - s * t) % mod\nprint((ans * inv2 % mod))\n", "code_same": false, "relative_loc_diff_percent": 18.0, "diff": ["+pow2 = [1]", "+for i in range(N + 10):", "+ pow2.append(pow2[-1] * 2 % mod)", "+invpow2 = [pow(pow2[-1], mod - 2, mod)]", "+for i in range(N + 10)[::-1]:", "+ invpow2.append(invpow2[-1] * 2 % mod)", "+invpow2 = invpow2[::-1]", "- t = 1 + (1 - pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)", "+ t = 1 + (1 - invpow2[N - A[i]]) * pow2[N - A[i]]", "- s = (s * pow(inv2, A[j], mod)) % mod", "- t = (t + (1 - pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod", "+ s = (s * invpow2[A[j]]) % mod", "+ t = (t + (1 - invpow2[A[j]]) * pow2[A[j]]) % mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2550587091, "measured_runtime_v1": 0.1362446928, "runtime_lift": 1.8720634461, "key": ["s981663077", "s820806781"]} +{"user_id": "u687343821", "problem_id": "p03074", "language": "python", "submission_id_v0": "s599311447", "submission_id_v1": "s168736691", "cpu_time_v0": 62, "cpu_time_v1": 44, "memory_v0": 5568, "memory_v1": 4596, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.03, "input": "import sys\n\nstdin = sys.stdin \n\nni = lambda: int(ns())\n\nna = lambda: list(map(int, stdin.readline().split()))\n\nns = lambda: stdin.readline()\n\n\n\ndef Solve():\n\n N,K=na()\n\n S=[int(d) for d in input()]\n\n l=[]\n\n N=len(S)\n\n if(S[0]==0):\n\n l.append(0)\n\n b=S[0]\n\n ct=1\n\n for i in S[1:]:\n\n if(b!=i):\n\n l.append(ct)\n\n ct=1\n\n b=i\n\n else:\n\n ct+=1\n\n l.append(ct)\n\n len_l=len(l)\n\n if(len_l//2 <= K):\n\n return sum(l)\n\n ans = res = sum(l[:2*K+1])\n\n \n\n if(len_l%2==0):\n\n l.append(0)\n\n len_l+=1\n\n g = K * 2 + 1\n\n for i in range(K*2+1,len_l-1,2):\n\n ans -= l[i-g] + l[i-g+1]\n\n ans += l[i] + l[1+i]\n\n if(res 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\nfac = [1]\n\ninv = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n inv.append(pow(fac[i], mod - 2))\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\n\ndef doit(n, m, k):\n\n ret = 0\n\n for d in range(m):\n\n ret = (ret + d * (m - d)) % mod\n\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))", "target": "n, m, k = list(map(int, input().split()))\n\n\n\nmod = 1000000007\n\nfac = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n\n\ndef pow(x, n):\n\n ret = 1\n\n while n > 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\ndef inv(i):\n\n return pow(fac[i], mod - 2)\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv(k) * inv(n - k)) % mod\n\n\n\nx = sum(d * (m - d) for d in range(m)) % mod\n\ny = sum(d * (n - d) for d in range(n)) % mod\n\n\n\nc = cmb(n * m - 2, k - 2)\n\nx = (x * n * n * c) % mod\n\ny = (y * m * m * c) % mod\n\n\n\nprint(((x + y) % mod))", "code_v0_loc": 28, "code_v1_loc": 30, "code_v0_num_chars": 624, "code_v1_num_chars": 620, "code_v0_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 1000000007\n\n\ndef pow(x, n):\n ret = 1\n while n > 0:\n if (n & 1) == 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n n >>= 1\n return ret\n\n\nfac = [1]\ninv = [1]\nfor i in range(1, n * m + 1):\n fac.append((fac[-1] * i) % mod)\n inv.append(pow(fac[i], mod - 2))\n\n\ndef cmb(n, k):\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\ndef doit(n, m, k):\n ret = 0\n for d in range(m):\n ret = (ret + d * (m - d)) % mod\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))\n", "code_v1_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 1000000007\nfac = [1]\nfor i in range(1, n * m + 1):\n fac.append((fac[-1] * i) % mod)\n\n\ndef pow(x, n):\n ret = 1\n while n > 0:\n if (n & 1) == 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n n >>= 1\n return ret\n\n\ndef inv(i):\n return pow(fac[i], mod - 2)\n\n\ndef cmb(n, k):\n return (fac[n] * inv(k) * inv(n - k)) % mod\n\n\nx = sum(d * (m - d) for d in range(m)) % mod\ny = sum(d * (n - d) for d in range(n)) % mod\nc = cmb(n * m - 2, k - 2)\nx = (x * n * n * c) % mod\ny = (y * m * m * c) % mod\nprint(((x + y) % mod))\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["+fac = [1]", "+for i in range(1, n * m + 1):", "+ fac.append((fac[-1] * i) % mod)", "-fac = [1]", "-inv = [1]", "-for i in range(1, n * m + 1):", "- fac.append((fac[-1] * i) % mod)", "- inv.append(pow(fac[i], mod - 2))", "+def inv(i):", "+ return pow(fac[i], mod - 2)", "- return (fac[n] * inv[k] * inv[n - k]) % mod", "+ return (fac[n] * inv(k) * inv(n - k)) % mod", "-def doit(n, m, k):", "- ret = 0", "- for d in range(m):", "- ret = (ret + d * (m - d)) % mod", "- return (ret * n * n * cmb(n * m - 2, k - 2)) % mod", "-", "-", "-print(((doit(n, m, k) + doit(m, n, k)) % mod))", "+x = sum(d * (m - d) for d in range(m)) % mod", "+y = sum(d * (n - d) for d in range(n)) % mod", "+c = cmb(n * m - 2, k - 2)", "+x = (x * n * n * c) % mod", "+y = (y * m * m * c) % mod", "+print(((x + y) % mod))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7987827396, "measured_runtime_v1": 0.3213389852, "runtime_lift": 2.4857946791, "key": ["s871362008", "s362897835"]} +{"user_id": "u070201429", "problem_id": "p03608", "language": "python", "submission_id_v0": "s030633020", "submission_id_v1": "s301564470", "cpu_time_v0": 137, "cpu_time_v1": 113, "memory_v0": 74552, "memory_v1": 74516, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.52, "input": "def main():\n\n from sys import stdin\n\n input = stdin.readline\n\n\n\n n, m, r = list(map(int, input().split()))\n\n l = list(map(int, input().split()))\n\n for i in range(r):\n\n l[i] -= 1\n\n d = [[10**8] * n for _ in range(n)]\n\n for _ in range(m):\n\n i, j, k = list(map(int, input().split()))\n\n d[i-1][j-1] = k\n\n d[j-1][i-1] = k\n\n\n\n # Warshall-Floyd algorithm\n\n for k in range(n):\n\n for i in range(n):\n\n for j in range(n):\n\n if d[i][j] > d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n", "target": "def main():\n\n from sys import stdin\n\n input = stdin.readline\n\n\n\n n, m, r = list(map(int, input().split()))\n\n l = list(map(int, input().split()))\n\n for i in range(r):\n\n l[i] -= 1\n\n d = [[10**8] * n for _ in range(n)]\n\n for _ in range(m):\n\n i, j, k = list(map(int, input().split()))\n\n d[i-1][j-1] = k\n\n d[j-1][i-1] = k\n\n\n\n # Warshall-Floyd algorithm\n\n for k in range(n):\n\n for i in range(n-1):\n\n for j in range(i+1, n):\n\n if d[i][j] > d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n d[j][i] = d[i][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n", "code_v0_loc": 36, "code_v1_loc": 37, "code_v0_num_chars": 868, "code_v1_num_chars": 914, "code_v0_no_empty_lines": "def main():\n from sys import stdin\n\n input = stdin.readline\n n, m, r = list(map(int, input().split()))\n l = list(map(int, input().split()))\n for i in range(r):\n l[i] -= 1\n d = [[10**8] * n for _ in range(n)]\n for _ in range(m):\n i, j, k = list(map(int, input().split()))\n d[i - 1][j - 1] = k\n d[j - 1][i - 1] = k\n # Warshall-Floyd algorithm\n for k in range(n):\n for i in range(n):\n for j in range(n):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\n # full search\n # 8! = 40320\n from itertools import permutations\n\n answer = 10**8\n for i in permutations(l):\n ans = 0\n for j in range(r - 1):\n ans += d[i[j]][i[j + 1]]\n if ans < answer:\n answer = ans\n print(answer)\n\n\nmain()\n", "code_v1_no_empty_lines": "def main():\n from sys import stdin\n\n input = stdin.readline\n n, m, r = list(map(int, input().split()))\n l = list(map(int, input().split()))\n for i in range(r):\n l[i] -= 1\n d = [[10**8] * n for _ in range(n)]\n for _ in range(m):\n i, j, k = list(map(int, input().split()))\n d[i - 1][j - 1] = k\n d[j - 1][i - 1] = k\n # Warshall-Floyd algorithm\n for k in range(n):\n for i in range(n - 1):\n for j in range(i + 1, n):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\n d[j][i] = d[i][j]\n # full search\n # 8! = 40320\n from itertools import permutations\n\n answer = 10**8\n for i in permutations(l):\n ans = 0\n for j in range(r - 1):\n ans += d[i[j]][i[j + 1]]\n if ans < answer:\n answer = ans\n print(answer)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 2.7027027027, "diff": ["- for i in range(n):", "- for j in range(n):", "+ for i in range(n - 1):", "+ for j in range(i + 1, n):", "+ d[j][i] = d[i][j]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2599997888, "measured_runtime_v1": 0.1532082543, "runtime_lift": 1.697035123, "key": ["s030633020", "s301564470"]} +{"user_id": "u873917047", "problem_id": "p03828", "language": "python", "submission_id_v0": "s924740576", "submission_id_v1": "s078000611", "cpu_time_v0": 523, "cpu_time_v1": 182, "memory_v0": 3188, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.2, "input": "#coding: UTF-8\n\nimport math\n\nN=int(input())\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N):\n\n plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k/(i+1)\n\n lis[i]=n\n\n return lis\n\nout_lis=[0]*N\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\nprint((out%1000000007))", "target": "#coding: UTF-8\n\nimport math\n\nN=int(input())\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N,plist):\n\n# plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k/(i+1)\n\n lis[i]=n\n\n return lis\n\n# print(lis)\n\nout_lis=[0]*N\n\nplist=prime_list(N)\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N,plist)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\n#print(out%1000000007)\n\nprint((out%(10**9+7)))", "code_v0_loc": 36, "code_v1_loc": 39, "code_v0_num_chars": 791, "code_v1_num_chars": 865, "code_v0_no_empty_lines": "# coding: UTF-8\nimport math\n\nN = int(input())\n\n\ndef prime_list(k):\n lis = [True for i in range(1, k + 1)]\n lis[0] = False\n for i in range(2, k + 1):\n j = 2\n while j * j <= i:\n if i % j == 0:\n lis[i - 1] = False\n break\n else:\n j += 1\n return lis\n\n\n# print(lis)\ndef p_fact(k, N):\n plist = prime_list(k)\n lis = [0] * N\n for i in range(0, k):\n n = 0\n if plist[i]:\n while k % (i + 1) == 0:\n n += 1\n k = k / (i + 1)\n lis[i] = n\n return lis\n\n\nout_lis = [0] * N\nfor i in range(1, N + 1):\n input_lis = p_fact(i, N)\n out_lis = [out_lis[j] + input_lis[j] for j in range(0, N)]\n# print(out_lis)\nout = 1\nfor i in range(0, N):\n out = out * (out_lis[i] + 1)\nprint((out % 1000000007))\n", "code_v1_no_empty_lines": "# coding: UTF-8\nimport math\n\nN = int(input())\n\n\ndef prime_list(k):\n lis = [True for i in range(1, k + 1)]\n lis[0] = False\n for i in range(2, k + 1):\n j = 2\n while j * j <= i:\n if i % j == 0:\n lis[i - 1] = False\n break\n else:\n j += 1\n return lis\n\n\n# print(lis)\ndef p_fact(k, N, plist):\n # plist=prime_list(k)\n lis = [0] * N\n for i in range(0, k):\n n = 0\n if plist[i]:\n while k % (i + 1) == 0:\n n += 1\n k = k / (i + 1)\n lis[i] = n\n return lis\n\n\n# print(lis)\nout_lis = [0] * N\nplist = prime_list(N)\nfor i in range(1, N + 1):\n input_lis = p_fact(i, N, plist)\n out_lis = [out_lis[j] + input_lis[j] for j in range(0, N)]\n# print(out_lis)\nout = 1\nfor i in range(0, N):\n out = out * (out_lis[i] + 1)\n# print(out%1000000007)\nprint((out % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["-def p_fact(k, N):", "- plist = prime_list(k)", "+def p_fact(k, N, plist):", "+ # plist=prime_list(k)", "+# print(lis)", "+plist = prime_list(N)", "- input_lis = p_fact(i, N)", "+ input_lis = p_fact(i, N, plist)", "-print((out % 1000000007))", "+# print(out%1000000007)", "+print((out % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6020502172, "measured_runtime_v1": 0.3540123932, "runtime_lift": 1.7006472899, "key": ["s924740576", "s078000611"]} +{"user_id": "u800534567", "problem_id": "p02245", "language": "python", "submission_id_v0": "s424620538", "submission_id_v1": "s007973982", "cpu_time_v0": 3310, "cpu_time_v1": 2340, "memory_v0": 34416, "memory_v1": 34452, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.31, "input": "import sys\n\nimport queue\n\n\n\nN = 3\n\nf= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = queue.Queue()\n\nV = dict()\n\n\n\nQ.put([f,f.index('0'),0])\n\nV[f] = True\n\n\n\nwhile not Q.empty():\n\n u = Q.get()\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]//N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 \n\n Q.put(v)\n\n\n\nprint((u[2]))\n", "target": "import sys\n\nimport queue\n\n\n\nN = 3\n\n\n\nf = ''.join(sys.stdin.readline().split())\n\nf += ''.join(sys.stdin.readline().split())\n\nf += ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = [[f,f.index('0'),0]]\n\nV = { f: True }\n\n\n\nwhile len(Q)>0:\n\n u = Q.pop(0)\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]//N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 # dir[r] \n\n Q.append(v)\n\n\n\nprint((u[2]))\n", "code_v0_loc": 34, "code_v1_loc": 32, "code_v0_num_chars": 845, "code_v1_num_chars": 831, "code_v0_no_empty_lines": "import sys\nimport queue\n\nN = 3\nf = \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\nQ = queue.Queue()\nV = dict()\nQ.put([f, f.index(\"0\"), 0])\nV[f] = True\nwhile not Q.empty():\n u = Q.get()\n if u[0] == \"123456780\":\n break\n sx, sy = u[1] // N, u[1] % N\n for dx, dy in dd:\n tx, ty = sx + dx, sy + dy\n if tx < 0 or ty < 0 or tx >= N or ty >= N:\n continue\n v = u[:]\n n1, n2 = u[1], tx * N + ty\n v[1] = n2\n if n1 > n2:\n n1, n2 = n2, n1\n v[0] = v[0][0:n1] + v[0][n2] + v[0][n1 + 1 : n2] + v[0][n1] + v[0][n2 + 1 :]\n if not V.get(v[0], False):\n V[v[0]] = True\n v[2] += 1\n Q.put(v)\nprint((u[2]))\n", "code_v1_no_empty_lines": "import sys\nimport queue\n\nN = 3\nf = \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\nQ = [[f, f.index(\"0\"), 0]]\nV = {f: True}\nwhile len(Q) > 0:\n u = Q.pop(0)\n if u[0] == \"123456780\":\n break\n sx, sy = u[1] // N, u[1] % N\n for dx, dy in dd:\n tx, ty = sx + dx, sy + dy\n if tx < 0 or ty < 0 or tx >= N or ty >= N:\n continue\n v = u[:]\n n1, n2 = u[1], tx * N + ty\n v[1] = n2\n if n1 > n2:\n n1, n2 = n2, n1\n v[0] = v[0][0:n1] + v[0][n2] + v[0][n1 + 1 : n2] + v[0][n1] + v[0][n2 + 1 :]\n if not V.get(v[0], False):\n V[v[0]] = True\n v[2] += 1 # dir[r]\n Q.append(v)\nprint((u[2]))\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-Q = queue.Queue()", "-V = dict()", "-Q.put([f, f.index(\"0\"), 0])", "-V[f] = True", "-while not Q.empty():", "- u = Q.get()", "+Q = [[f, f.index(\"0\"), 0]]", "+V = {f: True}", "+while len(Q) > 0:", "+ u = Q.pop(0)", "- v[2] += 1", "- Q.put(v)", "+ v[2] += 1 # dir[r]", "+ Q.append(v)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5507428885, "measured_runtime_v1": 0.3782181978, "runtime_lift": 1.4561512154, "key": ["s424620538", "s007973982"]} +{"user_id": "u585482323", "problem_id": "p03558", "language": "python", "submission_id_v0": "s378178699", "submission_id_v1": "s370816259", "cpu_time_v0": 982, "cpu_time_v1": 230, "memory_v0": 88880, "memory_v1": 47180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 76.58, "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n s = S()\n\n t = S()\n\n if s+t == t[::-1]+s[::-1]:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n\n\n#B\n\ndef B():\n\n n = I()\n\n for i in range(int(n**0.5)+2)[::-1]:\n\n if i*i <= n:\n\n print((i*i))\n\n quit()\n\n#C\n\ndef C():\n\n n = I()\n\n a = LI()\n\n b = LI()\n\n c = LI()\n\n q = [0 for i in range(n)]\n\n ans = 0\n\n a.sort()\n\n b.sort()\n\n c.sort()\n\n for i in range(n):\n\n j = bisect.bisect_left(a,b[i])\n\n q[i] = j\n\n for i in range(n-1):\n\n q[i+1] += q[i]\n\n q.insert(0,0)\n\n for i in range(n):\n\n j = bisect.bisect_left(b,c[i])\n\n ans += q[j]\n\n print(ans)\n\n#D\n\ndef D():\n\n def dijkstra():\n\n d = [float(\"inf\") for i in range(k)]\n\n q = [[0,1]]\n\n d[1] = 0\n\n while q:\n\n dx,x = heappop(q)\n\n for y,dy in v[x]:\n\n if d[y] > dx+dy:\n\n d[y] = dx+dy\n\n heappush(q,[d[y],y])\n\n print((d[0]+1))\n\n k = I()\n\n if k == 1:\n\n print((1))\n\n quit()\n\n v = [[] for i in range(k)]\n\n for i in range(1,k):\n\n v[i].append([(i+1)%k,1])\n\n v[i].append([i*10%k,0])\n\n dijkstra()\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n return\n\n\n\n#G\n\ndef G():\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n D()\n", "target": "#!usr/bin/env python3\n\nfrom collections import defaultdict,deque\n\nfrom heapq import heappush, heappop\n\nfrom itertools import permutations\n\nimport sys\n\nimport math\n\nimport bisect\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\n\ndef S():\n\n res = list(sys.stdin.readline())\n\n if res[-1] == \"\\n\":\n\n return res[:-1]\n\n return res\n\ndef IR(n):\n\n return [I() for i in range(n)]\n\ndef LIR(n):\n\n return [LI() for i in range(n)]\n\ndef SR(n):\n\n return [S() for i in range(n)]\n\ndef LSR(n):\n\n return [LS() for i in range(n)]\n\n\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\ndef solve():\n\n def v(n):\n\n return [n*10%k, (n+1)%k]\n\n k = I()\n\n d = [float(\"inf\")]*k\n\n d[1] = 1\n\n q = deque([1])\n\n while q:\n\n x = q.popleft()\n\n vx = v(x)\n\n dx = d[x]\n\n for c in range(2):\n\n nd = dx+c\n\n y = vx[c]\n\n if nd < d[y]:\n\n d[y] = nd\n\n if c:\n\n q.append(y)\n\n else:\n\n q.appendleft(y)\n\n print((d[0]))\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n solve()\n", "code_v0_loc": 108, "code_v1_loc": 53, "code_v0_num_chars": 2164, "code_v1_num_chars": 1252, "code_v0_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\ndef A():\n s = S()\n t = S()\n if s + t == t[::-1] + s[::-1]:\n print(\"YES\")\n else:\n print(\"NO\")\n\n\n# B\ndef B():\n n = I()\n for i in range(int(n**0.5) + 2)[::-1]:\n if i * i <= n:\n print((i * i))\n quit()\n\n\n# C\ndef C():\n n = I()\n a = LI()\n b = LI()\n c = LI()\n q = [0 for i in range(n)]\n ans = 0\n a.sort()\n b.sort()\n c.sort()\n for i in range(n):\n j = bisect.bisect_left(a, b[i])\n q[i] = j\n for i in range(n - 1):\n q[i + 1] += q[i]\n q.insert(0, 0)\n for i in range(n):\n j = bisect.bisect_left(b, c[i])\n ans += q[j]\n print(ans)\n\n\n# D\ndef D():\n def dijkstra():\n d = [float(\"inf\") for i in range(k)]\n q = [[0, 1]]\n d[1] = 0\n while q:\n dx, x = heappop(q)\n for y, dy in v[x]:\n if d[y] > dx + dy:\n d[y] = dx + dy\n heappush(q, [d[y], y])\n print((d[0] + 1))\n\n k = I()\n if k == 1:\n print((1))\n quit()\n v = [[] for i in range(k)]\n for i in range(1, k):\n v[i].append([(i + 1) % k, 1])\n v[i].append([i * 10 % k, 0])\n dijkstra()\n\n\n# E\ndef E():\n return\n\n\n# F\ndef F():\n return\n\n\n# G\ndef G():\n return\n\n\n# H\ndef H():\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n D()\n", "code_v1_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations\nimport sys\nimport math\nimport bisect\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == \"\\n\":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n\n\ndef solve():\n def v(n):\n return [n * 10 % k, (n + 1) % k]\n\n k = I()\n d = [float(\"inf\")] * k\n d[1] = 1\n q = deque([1])\n while q:\n x = q.popleft()\n vx = v(x)\n dx = d[x]\n for c in range(2):\n nd = dx + c\n y = vx[c]\n if nd < d[y]:\n d[y] = nd\n if c:\n q.append(y)\n else:\n q.appendleft(y)\n print((d[0]))\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 50.9259259259, "diff": ["-from collections import defaultdict", "-from collections import deque", "+from collections import defaultdict, deque", "+from itertools import permutations", "-import random", "- return list(map(int, sys.stdin.readline().split()))", "+ return [int(x) for x in sys.stdin.readline().split()]", "- return list(map(list, sys.stdin.readline().split()))", "+ return [list(x) for x in sys.stdin.readline().split()]", "- return list(sys.stdin.readline())[:-1]", "+ res = list(sys.stdin.readline())", "+ if res[-1] == \"\\n\":", "+ return res[:-1]", "+ return res", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = I()", "- return l", "+ return [I() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = LI()", "- return l", "+ return [LI() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = S()", "- return l", "+ return [S() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = SR()", "- return l", "+ return [LS() for i in range(n)]", "+sys.setrecursionlimit(1000000)", "-# A", "-def A():", "- s = S()", "- t = S()", "- if s + t == t[::-1] + s[::-1]:", "- print(\"YES\")", "- else:", "- print(\"NO\")", "-# B", "-def B():", "- n = I()", "- for i in range(int(n**0.5) + 2)[::-1]:", "- if i * i <= n:", "- print((i * i))", "- quit()", "-", "-", "-# C", "-def C():", "- n = I()", "- a = LI()", "- b = LI()", "- c = LI()", "- q = [0 for i in range(n)]", "- ans = 0", "- a.sort()", "- b.sort()", "- c.sort()", "- for i in range(n):", "- j = bisect.bisect_left(a, b[i])", "- q[i] = j", "- for i in range(n - 1):", "- q[i + 1] += q[i]", "- q.insert(0, 0)", "- for i in range(n):", "- j = bisect.bisect_left(b, c[i])", "- ans += q[j]", "- print(ans)", "-", "-", "-# D", "-def D():", "- def dijkstra():", "- d = [float(\"inf\") for i in range(k)]", "- q = [[0, 1]]", "- d[1] = 0", "- while q:", "- dx, x = heappop(q)", "- for y, dy in v[x]:", "- if d[y] > dx + dy:", "- d[y] = dx + dy", "- heappush(q, [d[y], y])", "- print((d[0] + 1))", "+def solve():", "+ def v(n):", "+ return [n * 10 % k, (n + 1) % k]", "- if k == 1:", "- print((1))", "- quit()", "- v = [[] for i in range(k)]", "- for i in range(1, k):", "- v[i].append([(i + 1) % k, 1])", "- v[i].append([i * 10 % k, 0])", "- dijkstra()", "-", "-", "-# E", "-def E():", "- return", "-", "-", "-# F", "-def F():", "- return", "-", "-", "-# G", "-def G():", "- return", "-", "-", "-# H", "-def H():", "+ d = [float(\"inf\")] * k", "+ d[1] = 1", "+ q = deque([1])", "+ while q:", "+ x = q.popleft()", "+ vx = v(x)", "+ dx = d[x]", "+ for c in range(2):", "+ nd = dx + c", "+ y = vx[c]", "+ if nd < d[y]:", "+ d[y] = nd", "+ if c:", "+ q.append(y)", "+ else:", "+ q.appendleft(y)", "+ print((d[0]))", "- D()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6112481251, "measured_runtime_v1": 0.2866115916, "runtime_lift": 2.1326706352, "key": ["s378178699", "s370816259"]} +{"user_id": "u648212584", "problem_id": "p03253", "language": "python", "submission_id_v0": "s901379470", "submission_id_v1": "s767594103", "cpu_time_v0": 251, "cpu_time_v1": 204, "memory_v0": 16168, "memory_v1": 45680, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.73, "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\nfrom collections import defaultdict\n\nimport copy\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n d = defaultdict(int)\n\n MOD = 10**9+7\n\n R = 10**5+100\n\n fac = [0 for _ in range(R+1)]\n\n fac[0],fac[1] = 1,1\n\n inv = copy.deepcopy(fac)\n\n invfac = copy.deepcopy(fac)\n\n \n\n for i in range(2,R+1):\n\n fac[i] = (fac[i-1]*i)%MOD\n\n inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD\n\n invfac[i] = (invfac[i-1]*inv[i])%MOD\n\n \n\n def coef(x,y):\n\n num = (((fac[x+y]*invfac[y])%MOD)*invfac[x]%MOD)\n\n return num\n\n\n\n while M%2 == 0:\n\n d[2] += 1\n\n M //= 2\n\n f = 3\n\n while f ** 2 <= M:\n\n if M % f == 0:\n\n d[f] += 1\n\n M //= f\n\n else:\n\n f += 2\n\n if M != 1:\n\n d[M] += 1\n\n \n\n l = list(d.values())\n\n ans = 1\n\n for num in l:\n\n ans *= coef(num,N-1)\n\n ans %= MOD\n\n \n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()", "target": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n MOD = 10**9+7\n\n \n\n def factorization(n):\n\n arr = []\n\n temp = n\n\n for i in range(2, int(-(-n**0.5//1))+1):\n\n if temp%i==0:\n\n cnt=0\n\n while temp%i==0:\n\n cnt+=1\n\n temp //= i\n\n arr.append([i, cnt])\n\n\n\n if temp!=1:\n\n arr.append([temp, 1])\n\n\n\n return arr\n\n \n\n cl = factorization(M)\n\n \n\n def combinations(x,y,N):\n\n fac = [0]*(N+1)\n\n fac[0],fac[1] = 1,1\n\n \n\n for i in range(2,N+1):\n\n fac[i] = (fac[i-1]*i)%MOD\n\n \n\n return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD\n\n \n\n ans = 1\n\n for pr,num in cl:\n\n ans *= combinations(N-1,num,N+num)\n\n ans %= MOD\n\n \n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 47, "code_v1_loc": 43, "code_v0_num_chars": 1020, "code_v1_num_chars": 972, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nfrom collections import defaultdict\nimport copy\n\n\ndef main():\n N, M = list(map(int, input().split()))\n d = defaultdict(int)\n MOD = 10**9 + 7\n R = 10**5 + 100\n fac = [0 for _ in range(R + 1)]\n fac[0], fac[1] = 1, 1\n inv = copy.deepcopy(fac)\n invfac = copy.deepcopy(fac)\n for i in range(2, R + 1):\n fac[i] = (fac[i - 1] * i) % MOD\n inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD\n invfac[i] = (invfac[i - 1] * inv[i]) % MOD\n\n def coef(x, y):\n num = ((fac[x + y] * invfac[y]) % MOD) * invfac[x] % MOD\n return num\n\n while M % 2 == 0:\n d[2] += 1\n M //= 2\n f = 3\n while f**2 <= M:\n if M % f == 0:\n d[f] += 1\n M //= f\n else:\n f += 2\n if M != 1:\n d[M] += 1\n l = list(d.values())\n ans = 1\n for num in l:\n ans *= coef(num, N - 1)\n ans %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\ndef main():\n N, M = list(map(int, input().split()))\n MOD = 10**9 + 7\n\n def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-(n**0.5) // 1)) + 1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append([i, cnt])\n if temp != 1:\n arr.append([temp, 1])\n return arr\n\n cl = factorization(M)\n\n def combinations(x, y, N):\n fac = [0] * (N + 1)\n fac[0], fac[1] = 1, 1\n for i in range(2, N + 1):\n fac[i] = (fac[i - 1] * i) % MOD\n return (\n fac[x + y] * pow(fac[x], MOD - 2, MOD) * pow(fac[y], MOD - 2, MOD)\n ) % MOD\n\n ans = 1\n for pr, num in cl:\n ans *= combinations(N - 1, num, N + num)\n ans %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 8.5106382979, "diff": ["-from collections import defaultdict", "-import copy", "- d = defaultdict(int)", "- R = 10**5 + 100", "- fac = [0 for _ in range(R + 1)]", "- fac[0], fac[1] = 1, 1", "- inv = copy.deepcopy(fac)", "- invfac = copy.deepcopy(fac)", "- for i in range(2, R + 1):", "- fac[i] = (fac[i - 1] * i) % MOD", "- inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD", "- invfac[i] = (invfac[i - 1] * inv[i]) % MOD", "- def coef(x, y):", "- num = ((fac[x + y] * invfac[y]) % MOD) * invfac[x] % MOD", "- return num", "+ def factorization(n):", "+ arr = []", "+ temp = n", "+ for i in range(2, int(-(-(n**0.5) // 1)) + 1):", "+ if temp % i == 0:", "+ cnt = 0", "+ while temp % i == 0:", "+ cnt += 1", "+ temp //= i", "+ arr.append([i, cnt])", "+ if temp != 1:", "+ arr.append([temp, 1])", "+ return arr", "- while M % 2 == 0:", "- d[2] += 1", "- M //= 2", "- f = 3", "- while f**2 <= M:", "- if M % f == 0:", "- d[f] += 1", "- M //= f", "- else:", "- f += 2", "- if M != 1:", "- d[M] += 1", "- l = list(d.values())", "+ cl = factorization(M)", "+", "+ def combinations(x, y, N):", "+ fac = [0] * (N + 1)", "+ fac[0], fac[1] = 1, 1", "+ for i in range(2, N + 1):", "+ fac[i] = (fac[i - 1] * i) % MOD", "+ return (", "+ fac[x + y] * pow(fac[x], MOD - 2, MOD) * pow(fac[y], MOD - 2, MOD)", "+ ) % MOD", "+", "- for num in l:", "- ans *= coef(num, N - 1)", "+ for pr, num in cl:", "+ ans *= combinations(N - 1, num, N + num)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.7565106795, "measured_runtime_v1": 0.2943952236, "runtime_lift": 5.9665053592, "key": ["s901379470", "s767594103"]} +{"user_id": "u532966492", "problem_id": "p03039", "language": "python", "submission_id_v0": "s814969347", "submission_id_v1": "s884180243", "cpu_time_v0": 555, "cpu_time_v1": 399, "memory_v0": 27096, "memory_v1": 3192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.11, "input": "def cmb(n, r, mod):\n\n if ( r<0 or r>n ):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\nA=2*10**5\n\nmod = 10**9+7\n\ng1 = [1, 1]\n\ng2 = [1, 1]\n\ninverse = [0, 1]\n\n\n\nfor i in range( 2, A + 1 ):\n\n g1.append( ( g1[-1] * i ) % mod )\n\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=cmb(N*M-2,K-2,mod)\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nprint(((keisuu * (sum_//2))%mod))", "target": "def power_mod(a,b,mod=10**9+7):\n\n i,temp,box=0,b,[]\n\n while(2**i<=b):\n\n i+=1\n\n for j in range(i-1,-1,-1):\n\n box=[[j,temp//2**j]]+box\n\n temp-=2**j*(temp//2**j)\n\n box[0].append(a)\n\n ans=box[0][1]*a%mod\n\n for j in range(1,i):\n\n box[j].append(box[j-1][2]**2%mod)\n\n if box[j][1]==1:\n\n ans=(ans*box[j][2])%mod\n\n return ans\n\ndef n_func(n,mod=10**9+7):\n\n ans=1\n\n for i in range(1,n+1):\n\n ans=(ans*i)%mod\n\n return ans\n\ndef nPr(n,r,mod=10**9+7):\n\n ans=n_func(n-r,mod)\n\n ans=power_mod(ans,mod-2,mod)\n\n return ans*n_func(n,mod)%mod\n\ndef nCr(n,r,mod=10**9+7):\n\n ans=n_func(n-r,mod)*n_func(r,mod)%mod\n\n ans=power_mod(ans,mod-2,mod)\n\n return ans*n_func(n,mod)%mod\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=nCr(N*M-2,K-2)\n\nmod=10**9+7\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nprint(((keisuu * (sum_//2))%mod))", "code_v0_loc": 30, "code_v1_loc": 42, "code_v0_num_chars": 731, "code_v1_num_chars": 1114, "code_v0_no_empty_lines": "def cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\nA = 2 * 10**5\nmod = 10**9 + 7\ng1 = [1, 1]\ng2 = [1, 1]\ninverse = [0, 1]\nfor i in range(2, A + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod // i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\nN, M, K = list(map(int, input().split()))\nkeisuu = cmb(N * M - 2, K - 2, mod)\nsum_ = 0\nfor i in range(N):\n a = min(abs(i), abs(N - i - 1))\n b = max(abs(i), abs(N - i - 1))\n sum_ += (M**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nfor i in range(M):\n a = min(abs(i), abs(M - i - 1))\n b = max(abs(i), abs(M - i - 1))\n sum_ += (N**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nprint(((keisuu * (sum_ // 2)) % mod))\n", "code_v1_no_empty_lines": "def power_mod(a, b, mod=10**9 + 7):\n i, temp, box = 0, b, []\n while 2**i <= b:\n i += 1\n for j in range(i - 1, -1, -1):\n box = [[j, temp // 2**j]] + box\n temp -= 2**j * (temp // 2**j)\n box[0].append(a)\n ans = box[0][1] * a % mod\n for j in range(1, i):\n box[j].append(box[j - 1][2] ** 2 % mod)\n if box[j][1] == 1:\n ans = (ans * box[j][2]) % mod\n return ans\n\n\ndef n_func(n, mod=10**9 + 7):\n ans = 1\n for i in range(1, n + 1):\n ans = (ans * i) % mod\n return ans\n\n\ndef nPr(n, r, mod=10**9 + 7):\n ans = n_func(n - r, mod)\n ans = power_mod(ans, mod - 2, mod)\n return ans * n_func(n, mod) % mod\n\n\ndef nCr(n, r, mod=10**9 + 7):\n ans = n_func(n - r, mod) * n_func(r, mod) % mod\n ans = power_mod(ans, mod - 2, mod)\n return ans * n_func(n, mod) % mod\n\n\nN, M, K = list(map(int, input().split()))\nkeisuu = nCr(N * M - 2, K - 2)\nmod = 10**9 + 7\nsum_ = 0\nfor i in range(N):\n a = min(abs(i), abs(N - i - 1))\n b = max(abs(i), abs(N - i - 1))\n sum_ += (M**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nfor i in range(M):\n a = min(abs(i), abs(M - i - 1))\n b = max(abs(i), abs(M - i - 1))\n sum_ += (N**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nprint(((keisuu * (sum_ // 2)) % mod))\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-def cmb(n, r, mod):", "- if r < 0 or r > n:", "- return 0", "- r = min(r, n - r)", "- return g1[n] * g2[r] * g2[n - r] % mod", "+def power_mod(a, b, mod=10**9 + 7):", "+ i, temp, box = 0, b, []", "+ while 2**i <= b:", "+ i += 1", "+ for j in range(i - 1, -1, -1):", "+ box = [[j, temp // 2**j]] + box", "+ temp -= 2**j * (temp // 2**j)", "+ box[0].append(a)", "+ ans = box[0][1] * a % mod", "+ for j in range(1, i):", "+ box[j].append(box[j - 1][2] ** 2 % mod)", "+ if box[j][1] == 1:", "+ ans = (ans * box[j][2]) % mod", "+ return ans", "-A = 2 * 10**5", "+def n_func(n, mod=10**9 + 7):", "+ ans = 1", "+ for i in range(1, n + 1):", "+ ans = (ans * i) % mod", "+ return ans", "+", "+", "+def nPr(n, r, mod=10**9 + 7):", "+ ans = n_func(n - r, mod)", "+ ans = power_mod(ans, mod - 2, mod)", "+ return ans * n_func(n, mod) % mod", "+", "+", "+def nCr(n, r, mod=10**9 + 7):", "+ ans = n_func(n - r, mod) * n_func(r, mod) % mod", "+ ans = power_mod(ans, mod - 2, mod)", "+ return ans * n_func(n, mod) % mod", "+", "+", "+N, M, K = list(map(int, input().split()))", "+keisuu = nCr(N * M - 2, K - 2)", "-g1 = [1, 1]", "-g2 = [1, 1]", "-inverse = [0, 1]", "-for i in range(2, A + 1):", "- g1.append((g1[-1] * i) % mod)", "- inverse.append((-inverse[mod % i] * (mod // i)) % mod)", "- g2.append((g2[-1] * inverse[-1]) % mod)", "-N, M, K = list(map(int, input().split()))", "-keisuu = cmb(N * M - 2, K - 2, mod)"], "diff_only_import_comment": false, "measured_runtime_v0": 2.5172936699, "measured_runtime_v1": 0.2314554, "runtime_lift": 10.8759340674, "key": ["s814969347", "s884180243"]} +{"user_id": "u585482323", "problem_id": "p03371", "language": "python", "submission_id_v0": "s026349855", "submission_id_v1": "s676818074", "cpu_time_v0": 206, "cpu_time_v1": 183, "memory_v0": 40944, "memory_v1": 39408, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.17, "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LS()\n\n return l\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n return\n\n\n\n#B\n\ndef B():\n\n return\n\n\n\n#C\n\ndef C():\n\n return\n\n\n\n#D\n\ndef D():\n\n return\n\n\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n a,b,c,X,Y = LI()\n\n ans = float(\"inf\")\n\n for z in range(300001):\n\n if z%2 == 0:\n\n m = c*z\n\n x = z//2\n\n y = z//2\n\n m += a*max(0,X-x)\n\n m += b*max(0,Y-y)\n\n if m < ans:\n\n ans = m\n\n print(ans)\n\n return\n\n\n\n#G\n\ndef G():\n\n n = I()\n\n x = LI()\n\n f = [(i,x[i]) for i in range(n)]\n\n f.sort(key = lambda x:x[1])\n\n g = [(f[i][0],i) for i in range(n)]\n\n g.sort(key = lambda x:x[0])\n\n for i in range(n):\n\n if g[i][1] < n//2:\n\n print((f[n//2][1]))\n\n else:\n\n print((f[n//2-1][1]))\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#I\n\ndef I_():\n\n return\n\n\n\n#J\n\ndef J():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n F()\n", "target": "#!usr/bin/env python3\n\nfrom collections import defaultdict,deque\n\nfrom heapq import heappush, heappop\n\nfrom itertools import permutations\n\nimport sys\n\nimport math\n\nimport bisect\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\n\ndef S():\n\n res = list(sys.stdin.readline())\n\n if res[-1] == \"\\n\":\n\n return res[:-1]\n\n return res\n\ndef IR(n):\n\n return [I() for i in range(n)]\n\ndef LIR(n):\n\n return [LI() for i in range(n)]\n\ndef SR(n):\n\n return [S() for i in range(n)]\n\ndef LSR(n):\n\n return [LS() for i in range(n)]\n\n\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\ndef solve():\n\n A,B,C,x,y = LI()\n\n ans = float(\"inf\")\n\n for c in range(200001)[::2]:\n\n a = b = c >> 1\n\n a = max(0,x-a)\n\n b = max(0,y-b)\n\n s = A*a+B*b+C*c\n\n if s < ans:\n\n ans = s\n\n print(ans)\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n solve()\n", "code_v0_loc": 97, "code_v1_loc": 43, "code_v0_num_chars": 1751, "code_v1_num_chars": 1027, "code_v0_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LS()\n return l\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n# A\ndef A():\n return\n\n\n# B\ndef B():\n return\n\n\n# C\ndef C():\n return\n\n\n# D\ndef D():\n return\n\n\n# E\ndef E():\n return\n\n\n# F\ndef F():\n a, b, c, X, Y = LI()\n ans = float(\"inf\")\n for z in range(300001):\n if z % 2 == 0:\n m = c * z\n x = z // 2\n y = z // 2\n m += a * max(0, X - x)\n m += b * max(0, Y - y)\n if m < ans:\n ans = m\n print(ans)\n return\n\n\n# G\ndef G():\n n = I()\n x = LI()\n f = [(i, x[i]) for i in range(n)]\n f.sort(key=lambda x: x[1])\n g = [(f[i][0], i) for i in range(n)]\n g.sort(key=lambda x: x[0])\n for i in range(n):\n if g[i][1] < n // 2:\n print((f[n // 2][1]))\n else:\n print((f[n // 2 - 1][1]))\n return\n\n\n# H\ndef H():\n return\n\n\n# I\ndef I_():\n return\n\n\n# J\ndef J():\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n F()\n", "code_v1_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations\nimport sys\nimport math\nimport bisect\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == \"\\n\":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n\n\ndef solve():\n A, B, C, x, y = LI()\n ans = float(\"inf\")\n for c in range(200001)[::2]:\n a = b = c >> 1\n a = max(0, x - a)\n b = max(0, y - b)\n s = A * a + B * b + C * c\n if s < ans:\n ans = s\n print(ans)\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 55.6701030928, "diff": ["-from collections import defaultdict", "-from collections import deque", "+from collections import defaultdict, deque", "+from itertools import permutations", "-import random", "- return list(map(int, sys.stdin.readline().split()))", "+ return [int(x) for x in sys.stdin.readline().split()]", "- return list(map(list, sys.stdin.readline().split()))", "+ return [list(x) for x in sys.stdin.readline().split()]", "- return list(sys.stdin.readline())[:-1]", "+ res = list(sys.stdin.readline())", "+ if res[-1] == \"\\n\":", "+ return res[:-1]", "+ return res", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = I()", "- return l", "+ return [I() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = LI()", "- return l", "+ return [LI() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = S()", "- return l", "+ return [S() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = LS()", "- return l", "+ return [LS() for i in range(n)]", "-# A", "-def A():", "- return", "-# B", "-def B():", "- return", "-", "-", "-# C", "-def C():", "- return", "-", "-", "-# D", "-def D():", "- return", "-", "-", "-# E", "-def E():", "- return", "-", "-", "-# F", "-def F():", "- a, b, c, X, Y = LI()", "+def solve():", "+ A, B, C, x, y = LI()", "- for z in range(300001):", "- if z % 2 == 0:", "- m = c * z", "- x = z // 2", "- y = z // 2", "- m += a * max(0, X - x)", "- m += b * max(0, Y - y)", "- if m < ans:", "- ans = m", "+ for c in range(200001)[::2]:", "+ a = b = c >> 1", "+ a = max(0, x - a)", "+ b = max(0, y - b)", "+ s = A * a + B * b + C * c", "+ if s < ans:", "+ ans = s", "- return", "-", "-", "-# G", "-def G():", "- n = I()", "- x = LI()", "- f = [(i, x[i]) for i in range(n)]", "- f.sort(key=lambda x: x[1])", "- g = [(f[i][0], i) for i in range(n)]", "- g.sort(key=lambda x: x[0])", "- for i in range(n):", "- if g[i][1] < n // 2:", "- print((f[n // 2][1]))", "- else:", "- print((f[n // 2 - 1][1]))", "- return", "-", "-", "-# H", "-def H():", "- return", "-", "-", "-# I", "-def I_():", "- return", "-", "-", "-# J", "-def J():", "- F()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3533082061, "measured_runtime_v1": 0.0063346879, "runtime_lift": 213.6345491689, "key": ["s026349855", "s676818074"]} +{"user_id": "u426534722", "problem_id": "p02245", "language": "python", "submission_id_v0": "s237914915", "submission_id_v1": "s694650984", "cpu_time_v0": 730, "cpu_time_v1": 50, "memory_v0": 25688, "memory_v1": 8488, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 93.15, "input": "from collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n if MAP == goal:\n\n return 0\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n return cnt\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n", "target": "from collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n zero = 8 - MAP.find(\"0\")\n\n start = int(MAP)\n\n if start == goal:\n\n return 0\n\n dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])\n\n TABLE = {start: (1, 0), goal: (0, 0)}\n\n while dp:\n\n cnt, M, yx, flg = dp.popleft()\n\n cnt += 1\n\n for nyx in m[yx]:\n\n key = g(yx, nyx, M)\n\n if key in TABLE:\n\n if TABLE[key][0] != flg:\n\n return TABLE[key][1] + cnt\n\n continue\n\n TABLE[key] = (flg, cnt)\n\n dp.append((cnt, key, nyx, flg))\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n", "code_v0_loc": 30, "code_v1_loc": 31, "code_v0_num_chars": 815, "code_v1_num_chars": 949, "code_v0_no_empty_lines": "from collections import deque\n\nN = 3\nm = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n}\ngoal = 123456780\n\n\ndef g(i, j, a):\n t = a // (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef solve():\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = 8 - MAP.find(\"0\")\n MAP = int(MAP)\n if MAP == goal:\n return 0\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n return cnt\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\ndef MAIN():\n print((solve()))\n\n\nMAIN()\n", "code_v1_no_empty_lines": "from collections import deque\n\nN = 3\nm = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n}\ngoal = 123456780\n\n\ndef g(i, j, a):\n t = a // (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef solve():\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n zero = 8 - MAP.find(\"0\")\n start = int(MAP)\n if start == goal:\n return 0\n dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])\n TABLE = {start: (1, 0), goal: (0, 0)}\n while dp:\n cnt, M, yx, flg = dp.popleft()\n cnt += 1\n for nyx in m[yx]:\n key = g(yx, nyx, M)\n if key in TABLE:\n if TABLE[key][0] != flg:\n return TABLE[key][1] + cnt\n continue\n TABLE[key] = (flg, cnt)\n dp.append((cnt, key, nyx, flg))\n\n\ndef MAIN():\n print((solve()))\n\n\nMAIN()\n", "code_same": false, "relative_loc_diff_percent": 3.2258064516, "diff": ["- start = 8 - MAP.find(\"0\")", "- MAP = int(MAP)", "- if MAP == goal:", "+ zero = 8 - MAP.find(\"0\")", "+ start = int(MAP)", "+ if start == goal:", "- dp = deque([(0, start, MAP)])", "- LOG = {MAP}", "+ dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])", "+ TABLE = {start: (1, 0), goal: (0, 0)}", "- cnt, yx, M = dp.popleft()", "- if M == goal:", "- return cnt", "+ cnt, M, yx, flg = dp.popleft()", "- CM = g(yx, nyx, M)", "- if not CM in LOG:", "- dp.append((cnt, nyx, CM))", "- LOG.add(CM)", "+ key = g(yx, nyx, M)", "+ if key in TABLE:", "+ if TABLE[key][0] != flg:", "+ return TABLE[key][1] + cnt", "+ continue", "+ TABLE[key] = (flg, cnt)", "+ dp.append((cnt, key, nyx, flg))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2854871392, "measured_runtime_v1": 0.2155938864, "runtime_lift": 1.3241894008, "key": ["s237914915", "s694650984"]} +{"user_id": "u296518383", "problem_id": "p03806", "language": "python", "submission_id_v0": "s823150149", "submission_id_v1": "s174409855", "cpu_time_v0": 255, "cpu_time_v1": 220, "memory_v0": 44124, "memory_v1": 43356, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.73, "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(400, -1, -1):\n\n for j in range(400, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, 401):\n\n for j in range(1, 401):\n\n if dp[i][j] != INF and i / j == Ma / Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))", "target": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nsumA = sum([ABC[i][0] for i in range(N)])\n\nsumB = sum([ABC[i][1] for i in range(N)])\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(sumA, -1, -1):\n\n for j in range(sumB, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, sumA + 1):\n\n for j in range(1, sumB + 1):\n\n if dp[i][j] != INF and i / j == Ma / Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))", "code_v0_loc": 23, "code_v1_loc": 26, "code_v0_num_chars": 611, "code_v1_num_chars": 721, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nN, Ma, Mb = list(map(int, input().split()))\nABC = [list(map(int, input().split())) for _ in range(N)]\nINF = 10**15\ndp = [[INF for j in range(401)] for i in range(401)]\ndp[0][0] = 0\nfor a, b, c in ABC:\n for i in range(400, -1, -1):\n for j in range(400, -1, -1):\n if dp[i][j] != INF:\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\nanswer = INF\nfor i in range(1, 401):\n for j in range(1, 401):\n if dp[i][j] != INF and i / j == Ma / Mb:\n answer = min(answer, dp[i][j])\nprint((answer if answer != INF else -1))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nN, Ma, Mb = list(map(int, input().split()))\nABC = [list(map(int, input().split())) for _ in range(N)]\nsumA = sum([ABC[i][0] for i in range(N)])\nsumB = sum([ABC[i][1] for i in range(N)])\nINF = 10**15\ndp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]\ndp[0][0] = 0\nfor a, b, c in ABC:\n for i in range(sumA, -1, -1):\n for j in range(sumB, -1, -1):\n if dp[i][j] != INF:\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\nanswer = INF\nfor i in range(1, sumA + 1):\n for j in range(1, sumB + 1):\n if dp[i][j] != INF and i / j == Ma / Mb:\n answer = min(answer, dp[i][j])\nprint((answer if answer != INF else -1))\n", "code_same": false, "relative_loc_diff_percent": 11.5384615385, "diff": ["+sumA = sum([ABC[i][0] for i in range(N)])", "+sumB = sum([ABC[i][1] for i in range(N)])", "-dp = [[INF for j in range(401)] for i in range(401)]", "+dp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]", "- for i in range(400, -1, -1):", "- for j in range(400, -1, -1):", "+ for i in range(sumA, -1, -1):", "+ for j in range(sumB, -1, -1):", "-for i in range(1, 401):", "- for j in range(1, 401):", "+for i in range(1, sumA + 1):", "+ for j in range(1, sumB + 1):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8101779278, "measured_runtime_v1": 0.2126889092, "runtime_lift": 3.8092156792, "key": ["s823150149", "s174409855"]} +{"user_id": "u064505481", "problem_id": "p02555", "language": "python", "submission_id_v0": "s988049268", "submission_id_v1": "s031685542", "cpu_time_v0": 173, "cpu_time_v1": 74, "memory_v0": 76464, "memory_v1": 70408, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.23, "input": "from sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\nsetrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\t@lru_cache(None)\n\n\tdef dp(currsum):\n\n\t\tif currsum == s: return 1\n\n\t\tcnt = 0\n\n\t\tfor d in range(3, 2001):\n\n\t\t\tif currsum + d <= s:\n\n\t\t\t\tcnt += dp(currsum + d)\n\n\t\t\t\tcnt %= MOD \n\n\t\treturn cnt\n\n\tprint((dp(0)))\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "target": "from sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\n#setrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\tdef binom_tables(n, q):\n\n\t\tfact = [1 for _ in range(n + 1)]\n\n\t\tinv = [1 for _ in range(n + 1)]\n\n\t\tfor i in range(1, n+1):\n\n\t\t\tfact[i] = (fact[i-1] * i) % q\n\n\t\t\tinv[i] = pow(fact[i], q-2, q)\n\n\t\treturn fact, inv\n\n\n\n\tF, I = binom_tables(s + 700, MOD)\n\n\n\n\tdef binom(n, k, q):\n\n\t\treturn (F[n]*((I[k]*I[n-k])%q))%q\n\n\n\n\tans = 0\n\n\tfor r in range(1, 700):\n\n\t\tobjects = s - 3*r\n\n\t\tif objects + r - 1 < objects or objects < 0: \n\n\t\t\tbreak\n\n\t\tx = binom(objects + r - 1, objects, MOD)\n\n\t\tans += x\n\n\t\tans %= MOD \n\n\n\n\tprint(ans)\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "code_v0_loc": 32, "code_v1_loc": 45, "code_v0_num_chars": 739, "code_v1_num_chars": 1050, "code_v0_no_empty_lines": "from sys import stdin, stdout, setrecursionlimit\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\nfrom functools import lru_cache\nimport math\n\nsetrecursionlimit(10**6)\nrl = lambda: stdin.readline()\nrll = lambda: stdin.readline().split()\nrli = lambda: list(map(int, stdin.readline().split()))\nrlf = lambda: list(map(float, stdin.readline().split()))\nINF, NINF = float(\"inf\"), float(\"-inf\")\nMOD = 10**9 + 7\n\n\ndef main():\n s = int(rl())\n\n @lru_cache(None)\n def dp(currsum):\n if currsum == s:\n return 1\n cnt = 0\n for d in range(3, 2001):\n if currsum + d <= s:\n cnt += dp(currsum + d)\n cnt %= MOD\n return cnt\n\n print((dp(0)))\n stdout.close()\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from sys import stdin, stdout, setrecursionlimit\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\nfrom functools import lru_cache\nimport math\n\n# setrecursionlimit(10**6)\nrl = lambda: stdin.readline()\nrll = lambda: stdin.readline().split()\nrli = lambda: list(map(int, stdin.readline().split()))\nrlf = lambda: list(map(float, stdin.readline().split()))\nINF, NINF = float(\"inf\"), float(\"-inf\")\nMOD = 10**9 + 7\n\n\ndef main():\n s = int(rl())\n\n def binom_tables(n, q):\n fact = [1 for _ in range(n + 1)]\n inv = [1 for _ in range(n + 1)]\n for i in range(1, n + 1):\n fact[i] = (fact[i - 1] * i) % q\n inv[i] = pow(fact[i], q - 2, q)\n return fact, inv\n\n F, I = binom_tables(s + 700, MOD)\n\n def binom(n, k, q):\n return (F[n] * ((I[k] * I[n - k]) % q)) % q\n\n ans = 0\n for r in range(1, 700):\n objects = s - 3 * r\n if objects + r - 1 < objects or objects < 0:\n break\n x = binom(objects + r - 1, objects, MOD)\n ans += x\n ans %= MOD\n print(ans)\n stdout.close()\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 28.8888888889, "diff": ["-setrecursionlimit(10**6)", "+# setrecursionlimit(10**6)", "- @lru_cache(None)", "- def dp(currsum):", "- if currsum == s:", "- return 1", "- cnt = 0", "- for d in range(3, 2001):", "- if currsum + d <= s:", "- cnt += dp(currsum + d)", "- cnt %= MOD", "- return cnt", "+ def binom_tables(n, q):", "+ fact = [1 for _ in range(n + 1)]", "+ inv = [1 for _ in range(n + 1)]", "+ for i in range(1, n + 1):", "+ fact[i] = (fact[i - 1] * i) % q", "+ inv[i] = pow(fact[i], q - 2, q)", "+ return fact, inv", "- print((dp(0)))", "+ F, I = binom_tables(s + 700, MOD)", "+", "+ def binom(n, k, q):", "+ return (F[n] * ((I[k] * I[n - k]) % q)) % q", "+", "+ ans = 0", "+ for r in range(1, 700):", "+ objects = s - 3 * r", "+ if objects + r - 1 < objects or objects < 0:", "+ break", "+ x = binom(objects + r - 1, objects, MOD)", "+ ans += x", "+ ans %= MOD", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7214400458, "measured_runtime_v1": 0.2090635548, "runtime_lift": 3.4508168897, "key": ["s988049268", "s031685542"]} diff --git a/python_splits/test_verified.target_bucket_subsets/512_1024.jsonl b/python_splits/test_verified.target_bucket_subsets/512_1024.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..2ad9dba6e927b5f4094a1f3ec4d305d31523c62c --- /dev/null +++ b/python_splits/test_verified.target_bucket_subsets/512_1024.jsonl @@ -0,0 +1,7 @@ +{"user_id": "u984276646", "problem_id": "p03674", "language": "python", "submission_id_v0": "s545310428", "submission_id_v1": "s792744532", "cpu_time_v0": 433, "cpu_time_v1": 334, "memory_v0": 43480, "memory_v1": 43988, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.86, "input": "n = int(input())\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp //= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp //= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n]*invf[i-1]*invf[n-i+1]%mod\n\n if i <= n-1:\n\n S += fact[n-1]*invf[i]*invf[n-1-i]%mod\n\n S %= mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n if i <= n:\n\n S += fact[n-1]*invf[i-1]*invf[n-i]%mod\n\n S %= mod\n\n print(S)", "target": "n = int(input())\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp //= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp //= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n+1]*invf[i]*invf[n-i+1]%mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n print(S)\n", "code_v0_loc": 75, "code_v1_loc": 69, "code_v0_num_chars": 1780, "code_v1_num_chars": 1635, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nD = {i: [0] for i in range(1, n + 1)}\nfor i in range(n + 1):\n D[a[i]][0] += 1\n D[a[i]].append(i)\npl, pr = 0, 0\nfor i in D:\n if D[i][0] == 2:\n pl = D[i][1]\n pr = D[i][2]\n break\nL = pl\nM = pr - pl - 1\nN = n - pr\nmod = int(1e9) + 7 # <-- input modulo\nmaxf = n + 11 # <-- input factional limitation\n\n\ndef make_fact(n, k):\n tmp = n\n perm = [i for i in range(k)]\n L = [0 for _ in range(k)]\n for i in range(k):\n L[i] = tmp % (i + 1)\n tmp //= i + 1\n LL = [0 for _ in range(k)]\n for i in range(k):\n LL[i] = perm[L[-i - 1]]\n for j in range(L[-i - 1] + 1, k):\n perm[j - 1] = perm[j]\n return LL\n\n\ndef doubling(n, m, modulo=mod):\n y = 1\n base = n\n tmp = m\n while tmp != 0:\n if tmp % 2 == 1:\n y *= base\n if modulo > 0:\n y %= modulo\n base *= base\n if modulo > 0:\n base %= modulo\n tmp //= 2\n return y\n\n\ndef inved(a, modulo=mod):\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n while l != 0:\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n k, l = l, k % l\n return x % modulo\n\n\nfact = [1 for _ in range(maxf + 1)]\ninvf = [1 for _ in range(maxf + 1)]\nfor i in range(maxf):\n fact[i + 1] = (fact[i] * (i + 1)) % mod\ninvf[-1] = inved(fact[-1])\nfor i in range(maxf, 0, -1):\n invf[i - 1] = (invf[i] * i) % mod\nfor i in range(1, n + 2):\n S = fact[n] * invf[i - 1] * invf[n - i + 1] % mod\n if i <= n - 1:\n S += fact[n - 1] * invf[i] * invf[n - 1 - i] % mod\n S %= mod\n if i <= n - M:\n S -= fact[n - 1 - M] * invf[i - 1] * invf[n - M - i] % mod\n S %= mod\n if i <= n:\n S += fact[n - 1] * invf[i - 1] * invf[n - i] % mod\n S %= mod\n print(S)\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nD = {i: [0] for i in range(1, n + 1)}\nfor i in range(n + 1):\n D[a[i]][0] += 1\n D[a[i]].append(i)\npl, pr = 0, 0\nfor i in D:\n if D[i][0] == 2:\n pl = D[i][1]\n pr = D[i][2]\n break\nL = pl\nM = pr - pl - 1\nN = n - pr\nmod = int(1e9) + 7 # <-- input modulo\nmaxf = n + 11 # <-- input factional limitation\n\n\ndef make_fact(n, k):\n tmp = n\n perm = [i for i in range(k)]\n L = [0 for _ in range(k)]\n for i in range(k):\n L[i] = tmp % (i + 1)\n tmp //= i + 1\n LL = [0 for _ in range(k)]\n for i in range(k):\n LL[i] = perm[L[-i - 1]]\n for j in range(L[-i - 1] + 1, k):\n perm[j - 1] = perm[j]\n return LL\n\n\ndef doubling(n, m, modulo=mod):\n y = 1\n base = n\n tmp = m\n while tmp != 0:\n if tmp % 2 == 1:\n y *= base\n if modulo > 0:\n y %= modulo\n base *= base\n if modulo > 0:\n base %= modulo\n tmp //= 2\n return y\n\n\ndef inved(a, modulo=mod):\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n while l != 0:\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n k, l = l, k % l\n return x % modulo\n\n\nfact = [1 for _ in range(maxf + 1)]\ninvf = [1 for _ in range(maxf + 1)]\nfor i in range(maxf):\n fact[i + 1] = (fact[i] * (i + 1)) % mod\ninvf[-1] = inved(fact[-1])\nfor i in range(maxf, 0, -1):\n invf[i - 1] = (invf[i] * i) % mod\nfor i in range(1, n + 2):\n S = fact[n + 1] * invf[i] * invf[n - i + 1] % mod\n if i <= n - M:\n S -= fact[n - 1 - M] * invf[i - 1] * invf[n - M - i] % mod\n S %= mod\n print(S)\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- S = fact[n] * invf[i - 1] * invf[n - i + 1] % mod", "- if i <= n - 1:", "- S += fact[n - 1] * invf[i] * invf[n - 1 - i] % mod", "- S %= mod", "+ S = fact[n + 1] * invf[i] * invf[n - i + 1] % mod", "- if i <= n:", "- S += fact[n - 1] * invf[i - 1] * invf[n - i] % mod", "- S %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3162681131, "measured_runtime_v1": 0.0655883436, "runtime_lift": 4.8220170785, "key": ["s545310428", "s792744532"]} +{"user_id": "u864197622", "problem_id": "p02794", "language": "python", "submission_id_v0": "s167224132", "submission_id_v1": "s245735210", "cpu_time_v0": 294, "cpu_time_v1": 228, "memory_v0": 50156, "memory_v1": 49128, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.45, "input": "N = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(input())\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\nD = {1<>= 17\n\n bc += BC[aa % (1<<17)]\n\n aa >>= 17\n\n bc += BC[aa]\n\n CC[N - 1 - bc] += (1 if BC[m%1024] + BC[m>>10] & 1 == 0 else -1)\n\n\n\nprint((sum([2 ** i * CC[i] for i in range(N)])))", "target": "N = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(input())\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\ndef popcnt(n):\n\n c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)\n\n c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)\n\n c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)\n\n c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)\n\n c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)\n\n c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)\n\n return c\n\n\n\nD = {1< DE[v]:\n t += 1 << u - 1\n u = P[u]\n elif DE[u] < DE[v]:\n t += 1 << v - 1\n v = P[v]\n else:\n t += 1 << u - 1\n t += 1 << v - 1\n u = P[u]\n v = P[v]\n return t\n\n\nY = []\nM = int(input())\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n Y.append(lp(a, b))\nD = {1 << i: i for i in range(50)}\nZ = [0] * (1 << M)\nans = 0\nCC = [0] * N\nBC = [0] * (1 << 17)\nfor m in range(1, 1 << 17):\n a = m & (-m)\n BC[m] = BC[m ^ a] + 1\nfor m in range(1 << M):\n a = m & (-m)\n if a == m:\n if a == 0:\n Z[m] = 0\n else:\n Z[m] = Y[D[a]]\n else:\n Z[m] = Z[m ^ a] | Y[D[a]]\n aa = Z[m]\n bc = BC[aa % (1 << 17)]\n aa >>= 17\n bc += BC[aa % (1 << 17)]\n aa >>= 17\n bc += BC[aa]\n CC[N - 1 - bc] += 1 if BC[m % 1024] + BC[m >> 10] & 1 == 0 else -1\nprint((sum([2**i * CC[i] for i in range(N)])))\n", "code_v1_no_empty_lines": "N = int(input())\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\nP = [-1] * N\nDE = [0] * N\nQ = [0]\nwhile Q:\n i = Q.pop()\n for a in X[i][::-1]:\n if a != P[i]:\n P[a] = i\n DE[a] = DE[i] + 1\n X[a].remove(i)\n Q.append(a)\n\n\ndef lp(u, v):\n t = 0\n while u != v:\n if DE[u] > DE[v]:\n t += 1 << u - 1\n u = P[u]\n elif DE[u] < DE[v]:\n t += 1 << v - 1\n v = P[v]\n else:\n t += 1 << u - 1\n t += 1 << v - 1\n u = P[u]\n v = P[v]\n return t\n\n\nY = []\nM = int(input())\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n Y.append(lp(a, b))\n\n\ndef popcnt(n):\n c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)\n c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)\n c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)\n c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)\n c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)\n c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)\n return c\n\n\nD = {1 << i: i for i in range(50)}\nZ = [0] * (1 << M)\nans = 0\nCC = [0] * N\nfor m in range(1 << M):\n a = m & (-m)\n if a == m:\n if a == 0:\n Z[m] = 0\n else:\n Z[m] = Y[D[a]]\n else:\n Z[m] = Z[m ^ a] | Y[D[a]]\n CC[N - 1 - popcnt(Z[m])] += 1 if popcnt(m) & 1 == 0 else -1\nprint((sum([2**i * CC[i] for i in range(N)])))\n", "code_same": false, "relative_loc_diff_percent": 1.4285714286, "diff": ["+", "+", "+def popcnt(n):", "+ c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)", "+ c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)", "+ c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)", "+ c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)", "+ c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)", "+ c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)", "+ return c", "+", "+", "-BC = [0] * (1 << 17)", "-for m in range(1, 1 << 17):", "- a = m & (-m)", "- BC[m] = BC[m ^ a] + 1", "- aa = Z[m]", "- bc = BC[aa % (1 << 17)]", "- aa >>= 17", "- bc += BC[aa % (1 << 17)]", "- aa >>= 17", "- bc += BC[aa]", "- CC[N - 1 - bc] += 1 if BC[m % 1024] + BC[m >> 10] & 1 == 0 else -1", "+ CC[N - 1 - popcnt(Z[m])] += 1 if popcnt(m) & 1 == 0 else -1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4825011034, "measured_runtime_v1": 0.2223737774, "runtime_lift": 2.1697751823, "key": ["s167224132", "s245735210"]} +{"user_id": "u637175065", "problem_id": "p03553", "language": "python", "submission_id_v0": "s305170925", "submission_id_v1": "s833575440", "cpu_time_v0": 88, "cpu_time_v1": 46, "memory_v0": 7240, "memory_v1": 10956, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.73, "input": "import math,string,itertools,math,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf = 10**20\n\neps = 1.0 / 10**15\n\nmod = 10**9+7\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef F(): return float(sys.stdin.readline())\n\ndef S(): return input()\n\ndef pf(s): return print(s, flush=True)\n\ndef divisions(n):\n\n sq = int(math.sqrt(n)+1)\n\n d = collections.defaultdict(int)\n\n while n % 2 == 0:\n\n n //= 2\n\n d[2] += 1\n\n i = 3\n\n while n > 1 and sq >= i:\n\n if n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n else:\n\n i += 2\n\n\n\n if n > 1:\n\n d[n] += 1\n\n\n\n r = [1]\n\n for k, v in d.items():\n\n for c in r[:]:\n\n for i in range(1,v+1):\n\n r.append(c*(k**i))\n\n\n\n return sorted(r)\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n s = set()\n\n for i in range(n,0,-1):\n\n d = divisions(i)\n\n ld = len(d)\n\n for j in range(1,2**ld):\n\n c = []\n\n ff = True\n\n for k in range(ld):\n\n if j & (1< 0:\n\n e[c][i] -= k\n\n e[i][c] += k\n\n return k\n\n return 0\n\n\n\n while True:\n\n self.v = [None] * self.N\n\n fs = f(s, inf)\n\n if fs == 0:\n\n break\n\n r += fs\n\n\n\n return r\n\n\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n\n\n s = n\n\n t = n + 1\n\n e = [[0] * (n+2) for _ in range(n+2)]\n\n for i in range(n):\n\n c = a[i]\n\n if c < 0:\n\n e[s][i] = -c\n\n ii = i + 1\n\n for j in range(ii*2, n+1, ii):\n\n e[i][j-1] = inf\n\n else:\n\n e[i][t] = c\n\n\n\n\n\n fl = Flow(e, n+2)\n\n r = fl.max_flow(s,t)\n\n\n\n return sum(map(lambda x: max(0,x), a)) - r\n\n\n\n# start = time.time()\n\nprint(main())\n\n# pe(time.time() - start)\n\n\n\n\n\n\n", "code_v0_loc": 92, "code_v1_loc": 89, "code_v0_num_chars": 2351, "code_v1_num_chars": 2252, "code_v0_no_empty_lines": "import math, string, itertools, math, heapq, collections, re, array, bisect, sys, random, time, copy, functools\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**15\nmod = 10**9 + 7\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef F():\n return float(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\ndef pf(s):\n return print(s, flush=True)\n\n\ndef divisions(n):\n sq = int(math.sqrt(n) + 1)\n d = collections.defaultdict(int)\n while n % 2 == 0:\n n //= 2\n d[2] += 1\n i = 3\n while n > 1 and sq >= i:\n if n % i == 0:\n n //= i\n d[i] += 1\n else:\n i += 2\n if n > 1:\n d[n] += 1\n r = [1]\n for k, v in d.items():\n for c in r[:]:\n for i in range(1, v + 1):\n r.append(c * (k**i))\n return sorted(r)\n\n\ndef main():\n n = I()\n a = LI()\n s = set()\n for i in range(n, 0, -1):\n d = divisions(i)\n ld = len(d)\n for j in range(1, 2**ld):\n c = []\n ff = True\n for k in range(ld):\n if j & (1 << k):\n f = True\n for e in c:\n if d[k] % e == 0:\n f = False\n ff = False\n break\n if f:\n c.append(d[k])\n if not ff:\n break\n if ff:\n s.add(tuple(c + [n + 1]))\n b = sorted(list(s), reverse=True)\n for c in b:\n t = 0\n for j in range(1, n + 1):\n f = False\n for e in c:\n if j % e == 0:\n f = True\n break\n if f:\n t += a[j - 1]\n if t < 0:\n for j in range(1, n + 1):\n f = False\n for e in c:\n if j % e == 0:\n f = True\n break\n if f:\n a[j - 1] = 0\n return sum(a)\n\n\nprint(main())\n", "code_v1_no_empty_lines": "import math, string, itertools, math, heapq, collections, re, array, bisect, sys, copy, functools\nimport time, random\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**10\nmod = 10**9 + 7\nmod2 = 998244353\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LLI():\n return [list(map(int, l.split())) for l in sys.stdin.readlines()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef F():\n return float(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\ndef pf(s):\n return print(s, flush=True)\n\n\ndef pe(s):\n return print(str(s), file=sys.stderr)\n\n\ndef JA(a, sep):\n return sep.join(map(str, a))\n\n\ndef JAA(a, s, t):\n return s.join(t.join(map(str, b)) for b in a)\n\n\nclass Flow:\n def __init__(self, e, N):\n self.E = e\n self.N = N\n\n def max_flow(self, s, t):\n r = 0\n e = self.E\n\n def f(c, cap):\n v = self.v\n v[c] = 1\n if c == t:\n return cap\n for i in range(self.N):\n if v[i] or e[c][i] <= 0:\n continue\n cp = min(cap, e[c][i])\n k = f(i, cp)\n if k > 0:\n e[c][i] -= k\n e[i][c] += k\n return k\n return 0\n\n while True:\n self.v = [None] * self.N\n fs = f(s, inf)\n if fs == 0:\n break\n r += fs\n return r\n\n\ndef main():\n n = I()\n a = LI()\n s = n\n t = n + 1\n e = [[0] * (n + 2) for _ in range(n + 2)]\n for i in range(n):\n c = a[i]\n if c < 0:\n e[s][i] = -c\n ii = i + 1\n for j in range(ii * 2, n + 1, ii):\n e[i][j - 1] = inf\n else:\n e[i][t] = c\n fl = Flow(e, n + 2)\n r = fl.max_flow(s, t)\n return sum(map(lambda x: max(0, x), a)) - r\n\n\n# start = time.time()\nprint(main())\n# pe(time.time() - start)\n", "code_same": false, "relative_loc_diff_percent": 3.2608695652, "diff": ["-import math, string, itertools, math, heapq, collections, re, array, bisect, sys, random, time, copy, functools", "+import math, string, itertools, math, heapq, collections, re, array, bisect, sys, copy, functools", "+import time, random", "-eps = 1.0 / 10**15", "+eps = 1.0 / 10**10", "+mod2 = 998244353", "+dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]", "+ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]", "- return [int(x) for x in sys.stdin.readline().split()]", "+ return list(map(int, sys.stdin.readline().split()))", "+", "+", "+def LLI():", "+ return [list(map(int, l.split())) for l in sys.stdin.readlines()]", "-def divisions(n):", "- sq = int(math.sqrt(n) + 1)", "- d = collections.defaultdict(int)", "- while n % 2 == 0:", "- n //= 2", "- d[2] += 1", "- i = 3", "- while n > 1 and sq >= i:", "- if n % i == 0:", "- n //= i", "- d[i] += 1", "- else:", "- i += 2", "- if n > 1:", "- d[n] += 1", "- r = [1]", "- for k, v in d.items():", "- for c in r[:]:", "- for i in range(1, v + 1):", "- r.append(c * (k**i))", "- return sorted(r)", "+def pe(s):", "+ return print(str(s), file=sys.stderr)", "+", "+", "+def JA(a, sep):", "+ return sep.join(map(str, a))", "+", "+", "+def JAA(a, s, t):", "+ return s.join(t.join(map(str, b)) for b in a)", "+", "+", "+class Flow:", "+ def __init__(self, e, N):", "+ self.E = e", "+ self.N = N", "+", "+ def max_flow(self, s, t):", "+ r = 0", "+ e = self.E", "+", "+ def f(c, cap):", "+ v = self.v", "+ v[c] = 1", "+ if c == t:", "+ return cap", "+ for i in range(self.N):", "+ if v[i] or e[c][i] <= 0:", "+ continue", "+ cp = min(cap, e[c][i])", "+ k = f(i, cp)", "+ if k > 0:", "+ e[c][i] -= k", "+ e[i][c] += k", "+ return k", "+ return 0", "+", "+ while True:", "+ self.v = [None] * self.N", "+ fs = f(s, inf)", "+ if fs == 0:", "+ break", "+ r += fs", "+ return r", "- s = set()", "- for i in range(n, 0, -1):", "- d = divisions(i)", "- ld = len(d)", "- for j in range(1, 2**ld):", "- c = []", "- ff = True", "- for k in range(ld):", "- if j & (1 << k):", "- f = True", "- for e in c:", "- if d[k] % e == 0:", "- f = False", "- ff = False", "- break", "- if f:", "- c.append(d[k])", "- if not ff:", "- break", "- if ff:", "- s.add(tuple(c + [n + 1]))", "- b = sorted(list(s), reverse=True)", "- for c in b:", "- t = 0", "- for j in range(1, n + 1):", "- f = False", "- for e in c:", "- if j % e == 0:", "- f = True", "- break", "- if f:", "- t += a[j - 1]", "- if t < 0:", "- for j in range(1, n + 1):", "- f = False", "- for e in c:", "- if j % e == 0:", "- f = True", "- break", "- if f:", "- a[j - 1] = 0", "- return sum(a)", "+ s = n", "+ t = n + 1", "+ e = [[0] * (n + 2) for _ in range(n + 2)]", "+ for i in range(n):", "+ c = a[i]", "+ if c < 0:", "+ e[s][i] = -c", "+ ii = i + 1", "+ for j in range(ii * 2, n + 1, ii):", "+ e[i][j - 1] = inf", "+ else:", "+ e[i][t] = c", "+ fl = Flow(e, n + 2)", "+ r = fl.max_flow(s, t)", "+ return sum(map(lambda x: max(0, x), a)) - r", "+# start = time.time()", "+# pe(time.time() - start)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2170818343, "measured_runtime_v1": 0.0062613072, "runtime_lift": 34.670369248, "key": ["s305170925", "s833575440"]} +{"user_id": "u072053884", "problem_id": "p02378", "language": "python", "submission_id_v0": "s432486243", "submission_id_v1": "s242092393", "cpu_time_v0": 350, "cpu_time_v1": 120, "memory_v0": 8348, "memory_v1": 8420, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.71, "input": "# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if unvisited[v] and (r_capacity > 0):\n\n parent[v].append(u)\n\n queue.append(v)\n\n unvisited[v] = False\n\n return unvisited[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while not bfs(source, sink, parent):\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))", "target": "# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n level = [v_num] * v_num\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n level[start] = 0\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n next_level = level[u] + 1\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if (level[v] >= next_level) and (r_capacity > 0):\n\n level[v] = next_level\n\n parent[v].append(u)\n\n if unvisited[v]:\n\n queue.append(v)\n\n unvisited[v] = False\n\n return level[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while bfs(source, sink, parent) != v_num:\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))", "code_v0_loc": 75, "code_v1_loc": 80, "code_v0_num_chars": 1953, "code_v1_num_chars": 2133, "code_v0_no_empty_lines": "# Acceptance of input\nimport sys\n\nfile_input = sys.stdin\nX, Y, E = list(map(int, file_input.readline().split()))\nv_num = X + Y + 2\nadj_mat = [[0] * (v_num) for i in range(v_num)]\nfor line in file_input:\n x, y = list(map(int, line.split()))\n adj_mat[x][X + y] = 1\ns = X + Y\nt = s + 1\nfor i in range(X):\n adj_mat[s][i] = 1\nfor i in range(X, s):\n adj_mat[i][t] = 1\n# Dinic's algorithm\nimport collections\n\n# BFS for residual capacity network to construct level graph\ndef bfs(start, goal, parent):\n unvisited = [True] * v_num\n queue = collections.deque()\n queue.append(start)\n unvisited[start] = False\n while queue:\n u = queue.popleft()\n for v, r_capacity in enumerate(adj_mat[u]):\n if unvisited[v] and (r_capacity > 0):\n parent[v].append(u)\n queue.append(v)\n unvisited[v] = False\n return unvisited[goal]\n\n\n# DFS for level graph and construct blocking flow\ndef dfs(goal, path, parent, blocking_flow):\n v = path[-1]\n if v == goal:\n aug_path_flow = 10000\n for x, y in zip(path[1:], path[:-1]):\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n for x, y in zip(path[1:], path[:-1]):\n adj_mat[x][y] -= aug_path_flow\n adj_mat[y][x] += aug_path_flow\n blocking_flow[0] += aug_path_flow\n else:\n for u in parent[v]:\n path.append(u)\n dfs(goal, path, parent, blocking_flow)\n path.pop()\n\n\ndef dinic(source, sink):\n max_flow = 0\n parent = [[] for i in range(v_num)]\n while not bfs(source, sink, parent):\n blocking_flow = [0]\n path = [sink]\n # search in reverse direction from sink\n dfs(source, path, parent, blocking_flow)\n max_flow += blocking_flow[0]\n parent = [[] for i in range(v_num)]\n return max_flow\n\n\n# output\nprint((dinic(s, t)))\n", "code_v1_no_empty_lines": "# Acceptance of input\nimport sys\n\nfile_input = sys.stdin\nX, Y, E = list(map(int, file_input.readline().split()))\nv_num = X + Y + 2\nadj_mat = [[0] * (v_num) for i in range(v_num)]\nfor line in file_input:\n x, y = list(map(int, line.split()))\n adj_mat[x][X + y] = 1\ns = X + Y\nt = s + 1\nfor i in range(X):\n adj_mat[s][i] = 1\nfor i in range(X, s):\n adj_mat[i][t] = 1\n# Dinic's algorithm\nimport collections\n\n# BFS for residual capacity network to construct level graph\ndef bfs(start, goal, parent):\n level = [v_num] * v_num\n unvisited = [True] * v_num\n queue = collections.deque()\n queue.append(start)\n level[start] = 0\n unvisited[start] = False\n while queue:\n u = queue.popleft()\n next_level = level[u] + 1\n for v, r_capacity in enumerate(adj_mat[u]):\n if (level[v] >= next_level) and (r_capacity > 0):\n level[v] = next_level\n parent[v].append(u)\n if unvisited[v]:\n queue.append(v)\n unvisited[v] = False\n return level[goal]\n\n\n# DFS for level graph and construct blocking flow\ndef dfs(goal, path, parent, blocking_flow):\n v = path[-1]\n if v == goal:\n aug_path_flow = 10000\n for x, y in zip(path[1:], path[:-1]):\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n for x, y in zip(path[1:], path[:-1]):\n adj_mat[x][y] -= aug_path_flow\n adj_mat[y][x] += aug_path_flow\n blocking_flow[0] += aug_path_flow\n else:\n for u in parent[v]:\n path.append(u)\n dfs(goal, path, parent, blocking_flow)\n path.pop()\n\n\ndef dinic(source, sink):\n max_flow = 0\n parent = [[] for i in range(v_num)]\n while bfs(source, sink, parent) != v_num:\n blocking_flow = [0]\n path = [sink]\n # search in reverse direction from sink\n dfs(source, path, parent, blocking_flow)\n max_flow += blocking_flow[0]\n parent = [[] for i in range(v_num)]\n return max_flow\n\n\n# output\nprint((dinic(s, t)))\n", "code_same": false, "relative_loc_diff_percent": 6.25, "diff": ["+ level = [v_num] * v_num", "+ level[start] = 0", "+ next_level = level[u] + 1", "- if unvisited[v] and (r_capacity > 0):", "+ if (level[v] >= next_level) and (r_capacity > 0):", "+ level[v] = next_level", "- queue.append(v)", "- unvisited[v] = False", "- return unvisited[goal]", "+ if unvisited[v]:", "+ queue.append(v)", "+ unvisited[v] = False", "+ return level[goal]", "- while not bfs(source, sink, parent):", "+ while bfs(source, sink, parent) != v_num:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2959556043, "measured_runtime_v1": 0.2352844019, "runtime_lift": 1.2578632579, "key": ["s432486243", "s242092393"]} +{"user_id": "u216928054", "problem_id": "p02560", "language": "python", "submission_id_v0": "s978863609", "submission_id_v1": "s598945859", "cpu_time_v0": 297, "cpu_time_v1": 234, "memory_v0": 78412, "memory_v1": 70336, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.21, "input": "#!/usr/bin/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum_1(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n while True:\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n n = y_max\n\n m, a, b = a, m, (a - x_max % a) % a\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n", "code_v0_loc": 87, "code_v1_loc": 105, "code_v0_num_chars": 1613, "code_v1_num_chars": 2066, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\nsys.setrecursionlimit(10**6)\nINF = 10**9 + 1 # sys.maxsize # float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef floor_sum(n, m, a, b):\n ret = 0\n if a >= m:\n ret += (n - 1) * n * (a // m) // 2\n a %= m\n if b >= m:\n ret += n * (b // m)\n b %= m\n y_max = (a * n + b) // m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) // a) * y_max\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n return ret\n\n\ndef debug(*x):\n print(*x, file=sys.stderr)\n\n\ndef solve(SOLVE_PARAMS):\n pass\n\n\ndef main():\n # parse input\n T = int(input())\n for _t in range(T):\n N, M, A, B = map(int, input().split())\n print(floor_sum(N, M, A, B))\n\n\n# tests\nT1 = \"\"\"\n5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n\"\"\"\nTEST_T1 = \"\"\"\n>>> as_input(T1)\n>>> main()\n3\n13\n0\n314095480\n499999999500000000\n\"\"\"\n\n\ndef _test():\n import doctest\n\n doctest.testmod()\n g = globals()\n for k in sorted(g):\n if k.startswith(\"TEST_\"):\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\ndef as_input(s):\n \"use in test, use given string as input file\"\n import io\n\n f = io.StringIO(s.strip())\n g = globals()\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\ninput = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nif sys.argv[-1] == \"-t\":\n print(\"testing\")\n _test()\n sys.exit()\nmain()\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\nsys.setrecursionlimit(10**6)\nINF = 10**9 + 1 # sys.maxsize # float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef floor_sum_1(n, m, a, b):\n ret = 0\n if a >= m:\n ret += (n - 1) * n * (a // m) // 2\n a %= m\n if b >= m:\n ret += n * (b // m)\n b %= m\n y_max = (a * n + b) // m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) // a) * y_max\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n return ret\n\n\ndef floor_sum(n, m, a, b):\n ret = 0\n while True:\n if a >= m:\n ret += (n - 1) * n * (a // m) // 2\n a %= m\n if b >= m:\n ret += n * (b // m)\n b %= m\n y_max = (a * n + b) // m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) // a) * y_max\n n = y_max\n m, a, b = a, m, (a - x_max % a) % a\n\n\ndef debug(*x):\n print(*x, file=sys.stderr)\n\n\ndef solve(SOLVE_PARAMS):\n pass\n\n\ndef main():\n # parse input\n T = int(input())\n for _t in range(T):\n N, M, A, B = map(int, input().split())\n print(floor_sum(N, M, A, B))\n\n\n# tests\nT1 = \"\"\"\n5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n\"\"\"\nTEST_T1 = \"\"\"\n>>> as_input(T1)\n>>> main()\n3\n13\n0\n314095480\n499999999500000000\n\"\"\"\n\n\ndef _test():\n import doctest\n\n doctest.testmod()\n g = globals()\n for k in sorted(g):\n if k.startswith(\"TEST_\"):\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\ndef as_input(s):\n \"use in test, use given string as input file\"\n import io\n\n f = io.StringIO(s.strip())\n g = globals()\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\ninput = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nif sys.argv[-1] == \"-t\":\n print(\"testing\")\n _test()\n sys.exit()\nmain()\n", "code_same": false, "relative_loc_diff_percent": 17.1428571429, "diff": ["-def floor_sum(n, m, a, b):", "+def floor_sum_1(n, m, a, b):", "+", "+", "+def floor_sum(n, m, a, b):", "+ ret = 0", "+ while True:", "+ if a >= m:", "+ ret += (n - 1) * n * (a // m) // 2", "+ a %= m", "+ if b >= m:", "+ ret += n * (b // m)", "+ b %= m", "+ y_max = (a * n + b) // m", "+ x_max = y_max * m - b", "+ if y_max == 0:", "+ return ret", "+ ret += (n - (x_max + a - 1) // a) * y_max", "+ n = y_max", "+ m, a, b = a, m, (a - x_max % a) % a"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1788789105, "measured_runtime_v1": 0.0066359096, "runtime_lift": 26.9562007629, "key": ["s978863609", "s598945859"]} +{"user_id": "u585482323", "problem_id": "p03634", "language": "python", "submission_id_v0": "s798160758", "submission_id_v1": "s876456894", "cpu_time_v0": 777, "cpu_time_v1": 659, "memory_v0": 85552, "memory_v1": 85552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.19, "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]//g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.pop()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n", "target": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]//g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.popleft()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n", "code_v0_loc": 105, "code_v1_loc": 105, "code_v0_num_chars": 1535, "code_v1_num_chars": 1539, "code_v0_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\n\"\"\"\ndef gcd(a,b):\n if a == 0:\n return b\n return gcd(b%a,a)\nn = I()\na = IR(n)\nl = a[0]\nfor i in range(1,n):\n g = gcd(l,a[i])\n l *= a[i]//g\nprint(l)\n\"\"\"\n# B\nn = I()\nv = [[] for i in range(n)]\nfor i in range(n - 1):\n a, b, c = LI()\n a -= 1\n b -= 1\n v[a].append([b, c])\n v[b].append([a, c])\nQ, k = LI()\nd = [-1 for i in range(n)]\nd[k - 1] = 0\nq = deque()\nq.append(k - 1)\nwhile q:\n x = q.pop()\n for y, c in v[x]:\n if d[y] == -1:\n d[y] = d[x] + c\n q.append(y)\nfor i in range(Q):\n x, y = LI()\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n# C\n# D\n# E\n# F\n# G\n# H\n# I\n# J\n# K\n# L\n# M\n# N\n# O\n# P\n# Q\n# R\n# S\n# T\n", "code_v1_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\n\"\"\"\ndef gcd(a,b):\n if a == 0:\n return b\n return gcd(b%a,a)\nn = I()\na = IR(n)\nl = a[0]\nfor i in range(1,n):\n g = gcd(l,a[i])\n l *= a[i]//g\nprint(l)\n\"\"\"\n# B\nn = I()\nv = [[] for i in range(n)]\nfor i in range(n - 1):\n a, b, c = LI()\n a -= 1\n b -= 1\n v[a].append([b, c])\n v[b].append([a, c])\nQ, k = LI()\nd = [-1 for i in range(n)]\nd[k - 1] = 0\nq = deque()\nq.append(k - 1)\nwhile q:\n x = q.popleft()\n for y, c in v[x]:\n if d[y] == -1:\n d[y] = d[x] + c\n q.append(y)\nfor i in range(Q):\n x, y = LI()\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n# C\n# D\n# E\n# F\n# G\n# H\n# I\n# J\n# K\n# L\n# M\n# N\n# O\n# P\n# Q\n# R\n# S\n# T\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- x = q.pop()", "+ x = q.popleft()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3495916958, "measured_runtime_v1": 0.1121557097, "runtime_lift": 3.1170209395, "key": ["s798160758", "s876456894"]} +{"user_id": "u488401358", "problem_id": "p02649", "language": "python", "submission_id_v0": "s231020544", "submission_id_v1": "s831601953", "cpu_time_v0": 688, "cpu_time_v1": 413, "memory_v0": 76468, "memory_v1": 102912, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.97, "input": "def popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50 and j!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\nfor i in range(2**n):\n\n t=set([])\n\n for a in A:\n\n data[a&i]+=1\n\n t.add(a&i)\n\n temp=0\n\n for val in t:\n\n temp+=cmb[data[val]][min(K,data[val])]\n\n ans+=temp*(-1)**popcount(i)\n\n for val in t:\n\n data[val]=0\n\n\n\nprint(ans)\n", "target": "def popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n if j!=50 and i!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nimport random\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\npc=[popcount(i) for i in range(2**n)]\n\nfor i in range(2**n):\n\n for a in A:\n\n data[a&i]+=1\n\n for a in A:\n\n if data[a&i]:\n\n ans+=cmb[data[a&i]][min(K,data[a&i])]*(-1)**pc[i]\n\n data[a&i]=0\n\n\n\nprint(ans)", "code_v0_loc": 68, "code_v1_loc": 67, "code_v0_num_chars": 1445, "code_v1_num_chars": 1441, "code_v0_no_empty_lines": "def popcount(x):\n x = x - ((x >> 1) & 0x55555555)\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0F0F0F0F\n x = x + (x >> 8)\n x = x + (x >> 16)\n return x & 0x0000007F\n\n\ncmb = [[0 for i in range(51)] for j in range(51)]\ncmb[0][0] = 1\nfor i in range(51):\n for j in range(51):\n if i != 50 and j != 50:\n cmb[i + 1][j + 1] += cmb[i][j]\n if i != 50:\n cmb[i + 1][j] += cmb[i][j]\nfor i in range(1, 51):\n for j in range(2, 51):\n cmb[i][j] += cmb[i][j - 1]\nN, K, T, S = list(map(int, input().split()))\na = list(map(int, input().split()))\nmust0 = [i for i in range(18) if S >> i & 1 == 0]\nmust1 = [i for i in range(18) if T >> i & 1 == 1]\nA = []\nfor val in a:\n check = True\n for j in must0:\n check = check & (val >> j & 1 == 0)\n for j in must1:\n check = check & (val >> j & 1 == 1)\n if check:\n A.append(val)\nif not A:\n print((0))\n exit()\nbit = []\nfor i in range(18):\n if i not in must0 and i not in must1:\n bit.append(i)\nfor i in range(len(A)):\n temp = 0\n for j in range(len(bit)):\n temp += (A[i] >> bit[j] & 1 == 1) * 2**j\n A[i] = temp\nans = 0\nn = len(bit)\ndata = [0] * (2**n)\nfor i in range(2**n):\n t = set([])\n for a in A:\n data[a & i] += 1\n t.add(a & i)\n temp = 0\n for val in t:\n temp += cmb[data[val]][min(K, data[val])]\n ans += temp * (-1) ** popcount(i)\n for val in t:\n data[val] = 0\nprint(ans)\n", "code_v1_no_empty_lines": "def popcount(x):\n x = x - ((x >> 1) & 0x55555555)\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0F0F0F0F\n x = x + (x >> 8)\n x = x + (x >> 16)\n return x & 0x0000007F\n\n\ncmb = [[0 for i in range(51)] for j in range(51)]\ncmb[0][0] = 1\nfor i in range(51):\n for j in range(51):\n if i != 50:\n cmb[i + 1][j] += cmb[i][j]\n if j != 50 and i != 50:\n cmb[i + 1][j + 1] += cmb[i][j]\nfor i in range(1, 51):\n for j in range(2, 51):\n cmb[i][j] += cmb[i][j - 1]\nimport random\n\nN, K, T, S = list(map(int, input().split()))\na = list(map(int, input().split()))\nmust0 = [i for i in range(18) if S >> i & 1 == 0]\nmust1 = [i for i in range(18) if T >> i & 1 == 1]\nA = []\nfor val in a:\n check = True\n for j in must0:\n check = check & (val >> j & 1 == 0)\n for j in must1:\n check = check & (val >> j & 1 == 1)\n if check:\n A.append(val)\nif not A:\n print((0))\n exit()\nbit = []\nfor i in range(18):\n if i not in must0 and i not in must1:\n bit.append(i)\nfor i in range(len(A)):\n temp = 0\n for j in range(len(bit)):\n temp += (A[i] >> bit[j] & 1 == 1) * 2**j\n A[i] = temp\nans = 0\nn = len(bit)\ndata = [0] * (2**n)\npc = [popcount(i) for i in range(2**n)]\nfor i in range(2**n):\n for a in A:\n data[a & i] += 1\n for a in A:\n if data[a & i]:\n ans += cmb[data[a & i]][min(K, data[a & i])] * (-1) ** pc[i]\n data[a & i] = 0\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 1.4705882353, "diff": ["- if i != 50 and j != 50:", "- cmb[i + 1][j + 1] += cmb[i][j]", "+ if j != 50 and i != 50:", "+ cmb[i + 1][j + 1] += cmb[i][j]", "+import random", "+", "+pc = [popcount(i) for i in range(2**n)]", "- t = set([])", "- t.add(a & i)", "- temp = 0", "- for val in t:", "- temp += cmb[data[val]][min(K, data[val])]", "- ans += temp * (-1) ** popcount(i)", "- for val in t:", "- data[val] = 0", "+ for a in A:", "+ if data[a & i]:", "+ ans += cmb[data[a & i]][min(K, data[a & i])] * (-1) ** pc[i]", "+ data[a & i] = 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3163019059, "measured_runtime_v1": 0.2340069544, "runtime_lift": 1.3516773748, "key": ["s231020544", "s831601953"]} diff --git a/python_splits/test_verified.target_bucket_to_keys.json b/python_splits/test_verified.target_bucket_to_keys.json new file mode 100644 index 0000000000000000000000000000000000000000..c1abf643be6a9827e9cedeed3c3073f7d06517e1 --- /dev/null +++ b/python_splits/test_verified.target_bucket_to_keys.json @@ -0,0 +1,5025 @@ +{ + "<128": [ + { + "index": 0, + "problem_id": "p03371", + "sample_key": [ + "s504204235", + "s825991485" + ], + "token_count": 75 + }, + { + "index": 1, + "problem_id": "p02612", + "sample_key": [ + "s840955881", + "s608348800" + ], + "token_count": 31 + }, + { + "index": 3, + "problem_id": "p03559", + "sample_key": [ + "s241549796", + "s763191935" + ], + "token_count": 88 + }, + { + "index": 5, + "problem_id": "p02952", + "sample_key": [ + "s923935687", + "s007434774" + ], + "token_count": 106 + }, + { + "index": 6, + "problem_id": "p02996", + "sample_key": [ + "s244057022", + "s796254109" + ], + "token_count": 105 + }, + { + "index": 7, + "problem_id": "p00053", + "sample_key": [ + "s431311473", + "s975765781" + ], + "token_count": 108 + }, + { + "index": 8, + "problem_id": "p03835", + "sample_key": [ + "s859897716", + "s908338086" + ], + "token_count": 84 + }, + { + "index": 9, + "problem_id": "p02996", + "sample_key": [ + "s348750359", + "s832149929" + ], + "token_count": 105 + }, + { + "index": 12, + "problem_id": "p03081", + "sample_key": [ + "s141729674", + "s328617225" + ], + "token_count": 105 + }, + { + "index": 13, + "problem_id": "p03796", + "sample_key": [ + "s983655328", + "s754374761" + ], + "token_count": 42 + }, + { + "index": 14, + "problem_id": "p03035", + "sample_key": [ + "s085289040", + "s328762084" + ], + "token_count": 29 + }, + { + "index": 15, + "problem_id": "p02688", + "sample_key": [ + "s393142342", + "s768184755" + ], + "token_count": 99 + }, + { + "index": 16, + "problem_id": "p03162", + "sample_key": [ + "s935693074", + "s530388872" + ], + "token_count": 82 + }, + { + "index": 17, + "problem_id": "p02414", + "sample_key": [ + "s058277941", + "s168687059" + ], + "token_count": 77 + }, + { + "index": 19, + "problem_id": "p02552", + "sample_key": [ + "s410377980", + "s110616608" + ], + "token_count": 11 + }, + { + "index": 20, + "problem_id": "p02959", + "sample_key": [ + "s078643579", + "s464947070" + ], + "token_count": 127 + }, + { + "index": 22, + "problem_id": "p03416", + "sample_key": [ + "s130057185", + "s637640023" + ], + "token_count": 70 + }, + { + "index": 23, + "problem_id": "p03038", + "sample_key": [ + "s817533229", + "s906455398" + ], + "token_count": 123 + }, + { + "index": 24, + "problem_id": "p03723", + "sample_key": [ + "s522426109", + "s794063832" + ], + "token_count": 37 + }, + { + "index": 25, + "problem_id": "p03037", + "sample_key": [ + "s092044899", + "s679810914" + ], + "token_count": 72 + }, + { + "index": 27, + "problem_id": "p03307", + "sample_key": [ + "s023207655", + "s158622460" + ], + "token_count": 27 + }, + { + "index": 29, + "problem_id": "p03037", + "sample_key": [ + "s133611442", + "s023877292" + ], + "token_count": 78 + }, + { + "index": 31, + "problem_id": "p03208", + "sample_key": [ + "s260498412", + "s755290756" + ], + "token_count": 68 + }, + { + "index": 34, + "problem_id": "p03399", + "sample_key": [ + "s852784971", + "s460322800" + ], + "token_count": 18 + }, + { + "index": 35, + "problem_id": "p02837", + "sample_key": [ + "s475579950", + "s165212154" + ], + "token_count": 126 + }, + { + "index": 37, + "problem_id": "p03241", + "sample_key": [ + "s205255104", + "s496579949" + ], + "token_count": 90 + }, + { + "index": 40, + "problem_id": "p03457", + "sample_key": [ + "s956976175", + "s285518014" + ], + "token_count": 116 + }, + { + "index": 42, + "problem_id": "p02537", + "sample_key": [ + "s897150427", + "s003067542" + ], + "token_count": 70 + }, + { + "index": 45, + "problem_id": "p03416", + "sample_key": [ + "s640144582", + "s252292470" + ], + "token_count": 43 + }, + { + "index": 46, + "problem_id": "p03835", + "sample_key": [ + "s390314187", + "s016239384" + ], + "token_count": 53 + }, + { + "index": 49, + "problem_id": "p03309", + "sample_key": [ + "s649374585", + "s527849910" + ], + "token_count": 74 + }, + { + "index": 52, + "problem_id": "p02773", + "sample_key": [ + "s220148525", + "s009987907" + ], + "token_count": 104 + }, + { + "index": 53, + "problem_id": "p03371", + "sample_key": [ + "s203363465", + "s893730989" + ], + "token_count": 56 + }, + { + "index": 54, + "problem_id": "p02412", + "sample_key": [ + "s343999289", + "s206971885" + ], + "token_count": 97 + }, + { + "index": 56, + "problem_id": "p03000", + "sample_key": [ + "s091839409", + "s096312338" + ], + "token_count": 63 + }, + { + "index": 57, + "problem_id": "p02983", + "sample_key": [ + "s915950177", + "s423283368" + ], + "token_count": 102 + }, + { + "index": 59, + "problem_id": "p00053", + "sample_key": [ + "s978814614", + "s421101567" + ], + "token_count": 103 + }, + { + "index": 60, + "problem_id": "p03037", + "sample_key": [ + "s661845965", + "s817506416" + ], + "token_count": 67 + }, + { + "index": 61, + "problem_id": "p02596", + "sample_key": [ + "s961921352", + "s631804156" + ], + "token_count": 76 + }, + { + "index": 63, + "problem_id": "p03037", + "sample_key": [ + "s698380012", + "s714478978" + ], + "token_count": 91 + }, + { + "index": 64, + "problem_id": "p03325", + "sample_key": [ + "s116805601", + "s513357045" + ], + "token_count": 44 + }, + { + "index": 66, + "problem_id": "p03796", + "sample_key": [ + "s155084707", + "s301395968" + ], + "token_count": 48 + }, + { + "index": 67, + "problem_id": "p03845", + "sample_key": [ + "s045706452", + "s705375036" + ], + "token_count": 48 + }, + { + "index": 68, + "problem_id": "p03363", + "sample_key": [ + "s203042500", + "s990747122" + ], + "token_count": 110 + }, + { + "index": 69, + "problem_id": "p02555", + "sample_key": [ + "s317659277", + "s521440898" + ], + "token_count": 95 + }, + { + "index": 71, + "problem_id": "p03796", + "sample_key": [ + "s280545626", + "s422534863" + ], + "token_count": 45 + }, + { + "index": 73, + "problem_id": "p02917", + "sample_key": [ + "s303870321", + "s766724876" + ], + "token_count": 123 + }, + { + "index": 74, + "problem_id": "p02700", + "sample_key": [ + "s232689719", + "s065315130" + ], + "token_count": 58 + }, + { + "index": 76, + "problem_id": "p02814", + "sample_key": [ + "s657535199", + "s415753878" + ], + "token_count": 109 + }, + { + "index": 77, + "problem_id": "p02394", + "sample_key": [ + "s560769298", + "s595626547" + ], + "token_count": 52 + }, + { + "index": 78, + "problem_id": "p02394", + "sample_key": [ + "s949778573", + "s992404688" + ], + "token_count": 70 + }, + { + "index": 80, + "problem_id": "p03371", + "sample_key": [ + "s537618501", + "s493344814" + ], + "token_count": 92 + }, + { + "index": 82, + "problem_id": "p03416", + "sample_key": [ + "s105404887", + "s977655968" + ], + "token_count": 47 + }, + { + "index": 83, + "problem_id": "p02921", + "sample_key": [ + "s427233353", + "s366680967" + ], + "token_count": 38 + }, + { + "index": 88, + "problem_id": "p02881", + "sample_key": [ + "s987616882", + "s695744152" + ], + "token_count": 70 + }, + { + "index": 90, + "problem_id": "p03494", + "sample_key": [ + "s252753387", + "s505612116" + ], + "token_count": 78 + }, + { + "index": 92, + "problem_id": "p02814", + "sample_key": [ + "s885010221", + "s420231524" + ], + "token_count": 98 + }, + { + "index": 95, + "problem_id": "p03416", + "sample_key": [ + "s789877064", + "s762526319" + ], + "token_count": 97 + }, + { + "index": 97, + "problem_id": "p02952", + "sample_key": [ + "s073920837", + "s426081507" + ], + "token_count": 41 + }, + { + "index": 98, + "problem_id": "p02773", + "sample_key": [ + "s252908207", + "s096619437" + ], + "token_count": 99 + }, + { + "index": 99, + "problem_id": "p03721", + "sample_key": [ + "s719602965", + "s173376033" + ], + "token_count": 85 + }, + { + "index": 100, + "problem_id": "p03416", + "sample_key": [ + "s986292698", + "s820058882" + ], + "token_count": 50 + }, + { + "index": 102, + "problem_id": "p02792", + "sample_key": [ + "s858070624", + "s144947075" + ], + "token_count": 93 + }, + { + "index": 103, + "problem_id": "p03796", + "sample_key": [ + "s234232673", + "s468100683" + ], + "token_count": 41 + }, + { + "index": 104, + "problem_id": "p02725", + "sample_key": [ + "s591694965", + "s705639429" + ], + "token_count": 61 + }, + { + "index": 107, + "problem_id": "p03371", + "sample_key": [ + "s950527789", + "s848046688" + ], + "token_count": 89 + }, + { + "index": 108, + "problem_id": "p03796", + "sample_key": [ + "s127994042", + "s163960956" + ], + "token_count": 41 + }, + { + "index": 110, + "problem_id": "p03796", + "sample_key": [ + "s015060265", + "s192076282" + ], + "token_count": 38 + }, + { + "index": 111, + "problem_id": "p03371", + "sample_key": [ + "s272710522", + "s867287513" + ], + "token_count": 74 + }, + { + "index": 112, + "problem_id": "p03945", + "sample_key": [ + "s808413359", + "s766599872" + ], + "token_count": 56 + }, + { + "index": 113, + "problem_id": "p03558", + "sample_key": [ + "s159640382", + "s651180421" + ], + "token_count": 116 + }, + { + "index": 114, + "problem_id": "p02792", + "sample_key": [ + "s161079550", + "s476355973" + ], + "token_count": 112 + }, + { + "index": 115, + "problem_id": "p03796", + "sample_key": [ + "s922366861", + "s031671477" + ], + "token_count": 46 + }, + { + "index": 117, + "problem_id": "p03371", + "sample_key": [ + "s850530798", + "s933367975" + ], + "token_count": 77 + }, + { + "index": 118, + "problem_id": "p04012", + "sample_key": [ + "s951351679", + "s246688975" + ], + "token_count": 42 + }, + { + "index": 119, + "problem_id": "p03835", + "sample_key": [ + "s258964318", + "s303783261" + ], + "token_count": 64 + }, + { + "index": 120, + "problem_id": "p02276", + "sample_key": [ + "s439916574", + "s927428389" + ], + "token_count": 107 + }, + { + "index": 121, + "problem_id": "p02792", + "sample_key": [ + "s545080507", + "s376438645" + ], + "token_count": 102 + }, + { + "index": 122, + "problem_id": "p04012", + "sample_key": [ + "s204906128", + "s764910207" + ], + "token_count": 46 + }, + { + "index": 123, + "problem_id": "p03416", + "sample_key": [ + "s339057919", + "s254043060" + ], + "token_count": 120 + }, + { + "index": 124, + "problem_id": "p03835", + "sample_key": [ + "s014481361", + "s844546698" + ], + "token_count": 49 + }, + { + "index": 127, + "problem_id": "p03559", + "sample_key": [ + "s912886810", + "s338115037" + ], + "token_count": 90 + }, + { + "index": 128, + "problem_id": "p03592", + "sample_key": [ + "s651607907", + "s022339691" + ], + "token_count": 57 + }, + { + "index": 129, + "problem_id": "p00542", + "sample_key": [ + "s237799080", + "s666902384" + ], + "token_count": 30 + }, + { + "index": 131, + "problem_id": "p02773", + "sample_key": [ + "s347160213", + "s313812634" + ], + "token_count": 93 + }, + { + "index": 132, + "problem_id": "p03037", + "sample_key": [ + "s181457641", + "s911516772" + ], + "token_count": 111 + }, + { + "index": 133, + "problem_id": "p02881", + "sample_key": [ + "s837964487", + "s558772824" + ], + "token_count": 52 + }, + { + "index": 134, + "problem_id": "p02881", + "sample_key": [ + "s806961932", + "s386327339" + ], + "token_count": 120 + }, + { + "index": 135, + "problem_id": "p03455", + "sample_key": [ + "s887829630", + "s071542109" + ], + "token_count": 26 + }, + { + "index": 137, + "problem_id": "p04021", + "sample_key": [ + "s724849949", + "s422278370" + ], + "token_count": 84 + }, + { + "index": 140, + "problem_id": "p04012", + "sample_key": [ + "s590976745", + "s361487799" + ], + "token_count": 47 + }, + { + "index": 142, + "problem_id": "p02767", + "sample_key": [ + "s320006452", + "s025352649" + ], + "token_count": 122 + }, + { + "index": 143, + "problem_id": "p03086", + "sample_key": [ + "s956521892", + "s325345686" + ], + "token_count": 69 + }, + { + "index": 145, + "problem_id": "p02921", + "sample_key": [ + "s545345968", + "s346622706" + ], + "token_count": 35 + }, + { + "index": 146, + "problem_id": "p03835", + "sample_key": [ + "s871403539", + "s899034376" + ], + "token_count": 53 + }, + { + "index": 148, + "problem_id": "p03038", + "sample_key": [ + "s124992398", + "s099446399" + ], + "token_count": 127 + }, + { + "index": 149, + "problem_id": "p03796", + "sample_key": [ + "s262574211", + "s998310124" + ], + "token_count": 50 + }, + { + "index": 150, + "problem_id": "p02596", + "sample_key": [ + "s146225899", + "s204753661" + ], + "token_count": 56 + }, + { + "index": 151, + "problem_id": "p03200", + "sample_key": [ + "s639682353", + "s546135650" + ], + "token_count": 43 + }, + { + "index": 152, + "problem_id": "p00053", + "sample_key": [ + "s391855332", + "s612183692" + ], + "token_count": 119 + }, + { + "index": 153, + "problem_id": "p02988", + "sample_key": [ + "s657683547", + "s740427744" + ], + "token_count": 53 + }, + { + "index": 154, + "problem_id": "p03363", + "sample_key": [ + "s373502740", + "s912924761" + ], + "token_count": 79 + }, + { + "index": 155, + "problem_id": "p03162", + "sample_key": [ + "s595235842", + "s886147212" + ], + "token_count": 114 + }, + { + "index": 156, + "problem_id": "p02899", + "sample_key": [ + "s948462743", + "s673167226" + ], + "token_count": 83 + }, + { + "index": 157, + "problem_id": "p02994", + "sample_key": [ + "s512634929", + "s713379557" + ], + "token_count": 87 + }, + { + "index": 158, + "problem_id": "p03416", + "sample_key": [ + "s642708796", + "s868202811" + ], + "token_count": 85 + }, + { + "index": 159, + "problem_id": "p03720", + "sample_key": [ + "s310815601", + "s089084009" + ], + "token_count": 74 + }, + { + "index": 161, + "problem_id": "p03796", + "sample_key": [ + "s258128729", + "s727911974" + ], + "token_count": 42 + }, + { + "index": 163, + "problem_id": "p03796", + "sample_key": [ + "s637972642", + "s581563839" + ], + "token_count": 65 + }, + { + "index": 164, + "problem_id": "p02596", + "sample_key": [ + "s892012548", + "s295850055" + ], + "token_count": 81 + }, + { + "index": 167, + "problem_id": "p03568", + "sample_key": [ + "s711599117", + "s424536945" + ], + "token_count": 59 + }, + { + "index": 169, + "problem_id": "p02983", + "sample_key": [ + "s965697641", + "s560038811" + ], + "token_count": 86 + }, + { + "index": 170, + "problem_id": "p03371", + "sample_key": [ + "s911937877", + "s225349134" + ], + "token_count": 81 + }, + { + "index": 171, + "problem_id": "p03796", + "sample_key": [ + "s873197292", + "s712740845" + ], + "token_count": 38 + }, + { + "index": 172, + "problem_id": "p02996", + "sample_key": [ + "s000658921", + "s911267857" + ], + "token_count": 74 + }, + { + "index": 177, + "problem_id": "p03037", + "sample_key": [ + "s129241236", + "s743438543" + ], + "token_count": 86 + }, + { + "index": 181, + "problem_id": "p02881", + "sample_key": [ + "s498895748", + "s605488454" + ], + "token_count": 85 + }, + { + "index": 183, + "problem_id": "p02622", + "sample_key": [ + "s511745855", + "s953276742" + ], + "token_count": 17 + }, + { + "index": 184, + "problem_id": "p02767", + "sample_key": [ + "s304816826", + "s138180908" + ], + "token_count": 107 + }, + { + "index": 186, + "problem_id": "p03086", + "sample_key": [ + "s716593637", + "s955967436" + ], + "token_count": 79 + }, + { + "index": 187, + "problem_id": "p02952", + "sample_key": [ + "s720457111", + "s185706611" + ], + "token_count": 36 + }, + { + "index": 188, + "problem_id": "p03353", + "sample_key": [ + "s703764972", + "s575406884" + ], + "token_count": 56 + }, + { + "index": 189, + "problem_id": "p02693", + "sample_key": [ + "s690438210", + "s726211396" + ], + "token_count": 42 + }, + { + "index": 190, + "problem_id": "p03558", + "sample_key": [ + "s650935446", + "s013593877" + ], + "token_count": 118 + }, + { + "index": 191, + "problem_id": "p02921", + "sample_key": [ + "s066833687", + "s453964878" + ], + "token_count": 42 + }, + { + "index": 192, + "problem_id": "p03371", + "sample_key": [ + "s486102959", + "s507293588" + ], + "token_count": 86 + }, + { + "index": 194, + "problem_id": "p03371", + "sample_key": [ + "s299972417", + "s929413776" + ], + "token_count": 79 + }, + { + "index": 198, + "problem_id": "p00500", + "sample_key": [ + "s199562246", + "s512442556" + ], + "token_count": 69 + }, + { + "index": 199, + "problem_id": "p03170", + "sample_key": [ + "s690193516", + "s176737022" + ], + "token_count": 84 + }, + { + "index": 200, + "problem_id": "p02419", + "sample_key": [ + "s913061371", + "s394956399" + ], + "token_count": 75 + }, + { + "index": 201, + "problem_id": "p03796", + "sample_key": [ + "s593917202", + "s901232961" + ], + "token_count": 36 + }, + { + "index": 202, + "problem_id": "p02773", + "sample_key": [ + "s498649498", + "s794455280" + ], + "token_count": 109 + }, + { + "index": 204, + "problem_id": "p02555", + "sample_key": [ + "s983449721", + "s321084928" + ], + "token_count": 99 + }, + { + "index": 206, + "problem_id": "p02983", + "sample_key": [ + "s554161170", + "s606893257" + ], + "token_count": 121 + }, + { + "index": 208, + "problem_id": "p03309", + "sample_key": [ + "s802702568", + "s939867576" + ], + "token_count": 100 + }, + { + "index": 209, + "problem_id": "p03416", + "sample_key": [ + "s698254896", + "s209236188" + ], + "token_count": 61 + }, + { + "index": 210, + "problem_id": "p03680", + "sample_key": [ + "s086989807", + "s510724514" + ], + "token_count": 86 + }, + { + "index": 212, + "problem_id": "p02952", + "sample_key": [ + "s726498671", + "s714071292" + ], + "token_count": 122 + }, + { + "index": 213, + "problem_id": "p03425", + "sample_key": [ + "s293375746", + "s279901441" + ], + "token_count": 84 + }, + { + "index": 214, + "problem_id": "p02952", + "sample_key": [ + "s855248831", + "s153783643" + ], + "token_count": 45 + }, + { + "index": 215, + "problem_id": "p02801", + "sample_key": [ + "s439687684", + "s397132828" + ], + "token_count": 9 + }, + { + "index": 217, + "problem_id": "p04012", + "sample_key": [ + "s872816747", + "s223982270" + ], + "token_count": 61 + }, + { + "index": 218, + "problem_id": "p03013", + "sample_key": [ + "s323963688", + "s220101257" + ], + "token_count": 106 + }, + { + "index": 219, + "problem_id": "p03774", + "sample_key": [ + "s205905114", + "s474977819" + ], + "token_count": 115 + }, + { + "index": 220, + "problem_id": "p03416", + "sample_key": [ + "s720217601", + "s964731712" + ], + "token_count": 77 + }, + { + "index": 222, + "problem_id": "p03548", + "sample_key": [ + "s161926153", + "s067842786" + ], + "token_count": 26 + }, + { + "index": 223, + "problem_id": "p02576", + "sample_key": [ + "s578033438", + "s457299018" + ], + "token_count": 24 + }, + { + "index": 225, + "problem_id": "p03796", + "sample_key": [ + "s982585501", + "s413088188" + ], + "token_count": 37 + }, + { + "index": 226, + "problem_id": "p00003", + "sample_key": [ + "s695745765", + "s444816349" + ], + "token_count": 71 + }, + { + "index": 229, + "problem_id": "p03371", + "sample_key": [ + "s088381244", + "s357905210" + ], + "token_count": 85 + }, + { + "index": 232, + "problem_id": "p03544", + "sample_key": [ + "s403516424", + "s258691406" + ], + "token_count": 65 + }, + { + "index": 233, + "problem_id": "p03013", + "sample_key": [ + "s048931274", + "s960526895" + ], + "token_count": 84 + }, + { + "index": 234, + "problem_id": "p01138", + "sample_key": [ + "s409826221", + "s148489336" + ], + "token_count": 121 + }, + { + "index": 236, + "problem_id": "p03424", + "sample_key": [ + "s488879497", + "s152130126" + ], + "token_count": 24 + }, + { + "index": 238, + "problem_id": "p03796", + "sample_key": [ + "s179415880", + "s895771571" + ], + "token_count": 54 + }, + { + "index": 239, + "problem_id": "p00005", + "sample_key": [ + "s153581221", + "s486237781" + ], + "token_count": 91 + }, + { + "index": 240, + "problem_id": "p02881", + "sample_key": [ + "s326793866", + "s577051886" + ], + "token_count": 50 + }, + { + "index": 242, + "problem_id": "p02725", + "sample_key": [ + "s133823600", + "s446849062" + ], + "token_count": 87 + }, + { + "index": 243, + "problem_id": "p03371", + "sample_key": [ + "s115897723", + "s652896869" + ], + "token_count": 115 + }, + { + "index": 244, + "problem_id": "p03416", + "sample_key": [ + "s253072561", + "s839464643" + ], + "token_count": 60 + }, + { + "index": 245, + "problem_id": "p03568", + "sample_key": [ + "s088632051", + "s935108099" + ], + "token_count": 74 + }, + { + "index": 246, + "problem_id": "p03425", + "sample_key": [ + "s258539301", + "s541501179" + ], + "token_count": 90 + }, + { + "index": 247, + "problem_id": "p03796", + "sample_key": [ + "s459904551", + "s685671735" + ], + "token_count": 54 + }, + { + "index": 248, + "problem_id": "p03309", + "sample_key": [ + "s031191514", + "s488102802" + ], + "token_count": 114 + }, + { + "index": 249, + "problem_id": "p03037", + "sample_key": [ + "s060142514", + "s502871070" + ], + "token_count": 79 + }, + { + "index": 250, + "problem_id": "p02555", + "sample_key": [ + "s039277419", + "s210669705" + ], + "token_count": 38 + }, + { + "index": 251, + "problem_id": "p03371", + "sample_key": [ + "s303630482", + "s785488691" + ], + "token_count": 78 + }, + { + "index": 252, + "problem_id": "p03796", + "sample_key": [ + "s349010345", + "s174569561" + ], + "token_count": 62 + }, + { + "index": 253, + "problem_id": "p03170", + "sample_key": [ + "s503646377", + "s803807514" + ], + "token_count": 104 + }, + { + "index": 254, + "problem_id": "p02624", + "sample_key": [ + "s523843051", + "s066295883" + ], + "token_count": 98 + }, + { + "index": 255, + "problem_id": "p03828", + "sample_key": [ + "s988350400", + "s443952708" + ], + "token_count": 87 + }, + { + "index": 256, + "problem_id": "p03371", + "sample_key": [ + "s328045307", + "s953197610" + ], + "token_count": 56 + }, + { + "index": 257, + "problem_id": "p02390", + "sample_key": [ + "s143749551", + "s514847697" + ], + "token_count": 62 + }, + { + "index": 259, + "problem_id": "p03434", + "sample_key": [ + "s231475572", + "s619171000" + ], + "token_count": 25 + }, + { + "index": 261, + "problem_id": "p00134", + "sample_key": [ + "s571351483", + "s722552691" + ], + "token_count": 33 + }, + { + "index": 263, + "problem_id": "p02552", + "sample_key": [ + "s431367942", + "s270499104" + ], + "token_count": 22 + }, + { + "index": 264, + "problem_id": "p02268", + "sample_key": [ + "s783851867", + "s366216704" + ], + "token_count": 45 + }, + { + "index": 265, + "problem_id": "p03416", + "sample_key": [ + "s285618885", + "s172989285" + ], + "token_count": 51 + }, + { + "index": 266, + "problem_id": "p03720", + "sample_key": [ + "s957846271", + "s235024999" + ], + "token_count": 84 + }, + { + "index": 267, + "problem_id": "p03325", + "sample_key": [ + "s106132375", + "s827937559" + ], + "token_count": 57 + }, + { + "index": 271, + "problem_id": "p03796", + "sample_key": [ + "s450924156", + "s743009434" + ], + "token_count": 44 + }, + { + "index": 272, + "problem_id": "p03796", + "sample_key": [ + "s080864979", + "s354066004" + ], + "token_count": 39 + }, + { + "index": 274, + "problem_id": "p03416", + "sample_key": [ + "s364629573", + "s490395080" + ], + "token_count": 62 + }, + { + "index": 275, + "problem_id": "p02555", + "sample_key": [ + "s517832809", + "s490323912" + ], + "token_count": 94 + }, + { + "index": 276, + "problem_id": "p02773", + "sample_key": [ + "s779115559", + "s953043553" + ], + "token_count": 78 + }, + { + "index": 277, + "problem_id": "p03796", + "sample_key": [ + "s992615685", + "s822858934" + ], + "token_count": 50 + }, + { + "index": 278, + "problem_id": "p02730", + "sample_key": [ + "s449146060", + "s811980926" + ], + "token_count": 63 + }, + { + "index": 279, + "problem_id": "p03416", + "sample_key": [ + "s606562684", + "s721402043" + ], + "token_count": 40 + }, + { + "index": 281, + "problem_id": "p01093", + "sample_key": [ + "s330226420", + "s459093378" + ], + "token_count": 54 + }, + { + "index": 284, + "problem_id": "p03416", + "sample_key": [ + "s263636434", + "s255168613" + ], + "token_count": 92 + }, + { + "index": 287, + "problem_id": "p02596", + "sample_key": [ + "s777833838", + "s349314776" + ], + "token_count": 93 + }, + { + "index": 288, + "problem_id": "p02596", + "sample_key": [ + "s838540391", + "s786083962" + ], + "token_count": 88 + }, + { + "index": 289, + "problem_id": "p03250", + "sample_key": [ + "s131709017", + "s244884559" + ], + "token_count": 33 + }, + { + "index": 290, + "problem_id": "p03371", + "sample_key": [ + "s229566237", + "s072536815" + ], + "token_count": 83 + }, + { + "index": 291, + "problem_id": "p03568", + "sample_key": [ + "s245503579", + "s305475228" + ], + "token_count": 52 + }, + { + "index": 292, + "problem_id": "p03796", + "sample_key": [ + "s477602976", + "s500304823" + ], + "token_count": 52 + }, + { + "index": 295, + "problem_id": "p02792", + "sample_key": [ + "s001079757", + "s791261959" + ], + "token_count": 91 + }, + { + "index": 296, + "problem_id": "p03796", + "sample_key": [ + "s015826115", + "s256698183" + ], + "token_count": 43 + }, + { + "index": 298, + "problem_id": "p03371", + "sample_key": [ + "s944521020", + "s713825460" + ], + "token_count": 65 + }, + { + "index": 299, + "problem_id": "p03325", + "sample_key": [ + "s933212033", + "s130104970" + ], + "token_count": 83 + }, + { + "index": 305, + "problem_id": "p03416", + "sample_key": [ + "s773095214", + "s841162290" + ], + "token_count": 47 + }, + { + "index": 306, + "problem_id": "p00001", + "sample_key": [ + "s534000808", + "s891056906" + ], + "token_count": 41 + }, + { + "index": 307, + "problem_id": "p02555", + "sample_key": [ + "s720124366", + "s340965185" + ], + "token_count": 113 + }, + { + "index": 308, + "problem_id": "p02785", + "sample_key": [ + "s271865493", + "s007549888" + ], + "token_count": 51 + }, + { + "index": 309, + "problem_id": "p03835", + "sample_key": [ + "s254920914", + "s788748142" + ], + "token_count": 58 + }, + { + "index": 310, + "problem_id": "p03680", + "sample_key": [ + "s142356798", + "s532531190" + ], + "token_count": 104 + }, + { + "index": 311, + "problem_id": "p03796", + "sample_key": [ + "s916466489", + "s520315696" + ], + "token_count": 62 + }, + { + "index": 315, + "problem_id": "p03796", + "sample_key": [ + "s911512169", + "s353747803" + ], + "token_count": 38 + }, + { + "index": 316, + "problem_id": "p03371", + "sample_key": [ + "s986639109", + "s095330807" + ], + "token_count": 89 + }, + { + "index": 318, + "problem_id": "p03835", + "sample_key": [ + "s889927917", + "s987244986" + ], + "token_count": 59 + }, + { + "index": 319, + "problem_id": "p02412", + "sample_key": [ + "s179146540", + "s419434066" + ], + "token_count": 70 + }, + { + "index": 320, + "problem_id": "p02767", + "sample_key": [ + "s067063811", + "s910505357" + ], + "token_count": 94 + }, + { + "index": 322, + "problem_id": "p02773", + "sample_key": [ + "s565064219", + "s656135042" + ], + "token_count": 109 + }, + { + "index": 323, + "problem_id": "p02691", + "sample_key": [ + "s116716284", + "s825945845" + ], + "token_count": 71 + }, + { + "index": 324, + "problem_id": "p03835", + "sample_key": [ + "s113088304", + "s025062934" + ], + "token_count": 72 + }, + { + "index": 325, + "problem_id": "p03564", + "sample_key": [ + "s515134391", + "s980600609" + ], + "token_count": 44 + }, + { + "index": 326, + "problem_id": "p02881", + "sample_key": [ + "s386884404", + "s516418112" + ], + "token_count": 57 + }, + { + "index": 327, + "problem_id": "p03796", + "sample_key": [ + "s111144925", + "s028336395" + ], + "token_count": 34 + }, + { + "index": 328, + "problem_id": "p03170", + "sample_key": [ + "s365373544", + "s835744397" + ], + "token_count": 89 + }, + { + "index": 329, + "problem_id": "p02622", + "sample_key": [ + "s830524393", + "s723518358" + ], + "token_count": 45 + }, + { + "index": 330, + "problem_id": "p02886", + "sample_key": [ + "s745140004", + "s021490246" + ], + "token_count": 66 + }, + { + "index": 331, + "problem_id": "p03370", + "sample_key": [ + "s864579791", + "s018766024" + ], + "token_count": 106 + }, + { + "index": 332, + "problem_id": "p02596", + "sample_key": [ + "s650878996", + "s172963527" + ], + "token_count": 125 + }, + { + "index": 333, + "problem_id": "p02615", + "sample_key": [ + "s324254523", + "s548223725" + ], + "token_count": 37 + }, + { + "index": 334, + "problem_id": "p02881", + "sample_key": [ + "s064089444", + "s044740610" + ], + "token_count": 50 + }, + { + "index": 335, + "problem_id": "p02994", + "sample_key": [ + "s918408995", + "s703264591" + ], + "token_count": 95 + }, + { + "index": 338, + "problem_id": "p03107", + "sample_key": [ + "s353947972", + "s266533401" + ], + "token_count": 38 + }, + { + "index": 339, + "problem_id": "p02596", + "sample_key": [ + "s734835984", + "s256781932" + ], + "token_count": 56 + }, + { + "index": 340, + "problem_id": "p03796", + "sample_key": [ + "s383796227", + "s138334572" + ], + "token_count": 35 + }, + { + "index": 342, + "problem_id": "p02595", + "sample_key": [ + "s947121829", + "s479170385" + ], + "token_count": 58 + }, + { + "index": 343, + "problem_id": "p03309", + "sample_key": [ + "s828043733", + "s360156642" + ], + "token_count": 97 + }, + { + "index": 346, + "problem_id": "p03038", + "sample_key": [ + "s696312664", + "s914180377" + ], + "token_count": 123 + }, + { + "index": 348, + "problem_id": "p03796", + "sample_key": [ + "s862494830", + "s415254610" + ], + "token_count": 41 + }, + { + "index": 349, + "problem_id": "p03107", + "sample_key": [ + "s749413264", + "s028114766" + ], + "token_count": 24 + }, + { + "index": 350, + "problem_id": "p03457", + "sample_key": [ + "s302891502", + "s171916715" + ], + "token_count": 64 + }, + { + "index": 353, + "problem_id": "p02688", + "sample_key": [ + "s048784054", + "s441243732" + ], + "token_count": 82 + }, + { + "index": 354, + "problem_id": "p03796", + "sample_key": [ + "s018166938", + "s633160279" + ], + "token_count": 58 + }, + { + "index": 355, + "problem_id": "p03416", + "sample_key": [ + "s018952102", + "s778219351" + ], + "token_count": 50 + }, + { + "index": 356, + "problem_id": "p02390", + "sample_key": [ + "s941329471", + "s549187322" + ], + "token_count": 47 + }, + { + "index": 357, + "problem_id": "p03796", + "sample_key": [ + "s848409194", + "s870468874" + ], + "token_count": 40 + }, + { + "index": 359, + "problem_id": "p03126", + "sample_key": [ + "s757696098", + "s038854174" + ], + "token_count": 29 + }, + { + "index": 361, + "problem_id": "p03325", + "sample_key": [ + "s586527827", + "s564078636" + ], + "token_count": 48 + }, + { + "index": 362, + "problem_id": "p03796", + "sample_key": [ + "s618901729", + "s057938516" + ], + "token_count": 43 + }, + { + "index": 363, + "problem_id": "p03371", + "sample_key": [ + "s722861535", + "s015018251" + ], + "token_count": 96 + }, + { + "index": 366, + "problem_id": "p02595", + "sample_key": [ + "s028374925", + "s480019615" + ], + "token_count": 68 + }, + { + "index": 367, + "problem_id": "p03796", + "sample_key": [ + "s800016333", + "s112879561" + ], + "token_count": 45 + }, + { + "index": 370, + "problem_id": "p02773", + "sample_key": [ + "s609062581", + "s989407304" + ], + "token_count": 82 + }, + { + "index": 372, + "problem_id": "p02555", + "sample_key": [ + "s082576202", + "s465570710" + ], + "token_count": 83 + }, + { + "index": 373, + "problem_id": "p03721", + "sample_key": [ + "s168629717", + "s331365181" + ], + "token_count": 76 + }, + { + "index": 375, + "problem_id": "p03416", + "sample_key": [ + "s196951264", + "s755826464" + ], + "token_count": 69 + }, + { + "index": 376, + "problem_id": "p03416", + "sample_key": [ + "s340270167", + "s097893502" + ], + "token_count": 72 + }, + { + "index": 377, + "problem_id": "p03796", + "sample_key": [ + "s235320519", + "s032021754" + ], + "token_count": 43 + }, + { + "index": 379, + "problem_id": "p02881", + "sample_key": [ + "s504662720", + "s470778572" + ], + "token_count": 67 + }, + { + "index": 380, + "problem_id": "p02552", + "sample_key": [ + "s235847366", + "s896909207" + ], + "token_count": 14 + }, + { + "index": 383, + "problem_id": "p03013", + "sample_key": [ + "s600331807", + "s809304917" + ], + "token_count": 117 + }, + { + "index": 384, + "problem_id": "p03371", + "sample_key": [ + "s471284270", + "s058926350" + ], + "token_count": 118 + }, + { + "index": 386, + "problem_id": "p02837", + "sample_key": [ + "s456284110", + "s644980365" + ], + "token_count": 124 + }, + { + "index": 388, + "problem_id": "p02394", + "sample_key": [ + "s015330345", + "s144446421" + ], + "token_count": 45 + }, + { + "index": 389, + "problem_id": "p03325", + "sample_key": [ + "s954474488", + "s311308759" + ], + "token_count": 89 + }, + { + "index": 394, + "problem_id": "p02685", + "sample_key": [ + "s693454638", + "s088786085" + ], + "token_count": 76 + }, + { + "index": 395, + "problem_id": "p03680", + "sample_key": [ + "s808331415", + "s267927939" + ], + "token_count": 79 + }, + { + "index": 396, + "problem_id": "p02555", + "sample_key": [ + "s399411060", + "s856192378" + ], + "token_count": 91 + }, + { + "index": 398, + "problem_id": "p03568", + "sample_key": [ + "s971455595", + "s272804435" + ], + "token_count": 51 + }, + { + "index": 405, + "problem_id": "p02899", + "sample_key": [ + "s601919152", + "s937084523" + ], + "token_count": 62 + }, + { + "index": 408, + "problem_id": "p02951", + "sample_key": [ + "s688063139", + "s870650241" + ], + "token_count": 24 + }, + { + "index": 409, + "problem_id": "p03038", + "sample_key": [ + "s846597544", + "s758849446" + ], + "token_count": 122 + }, + { + "index": 410, + "problem_id": "p03723", + "sample_key": [ + "s032726803", + "s012708150" + ], + "token_count": 118 + }, + { + "index": 412, + "problem_id": "p02921", + "sample_key": [ + "s533958811", + "s140590362" + ], + "token_count": 68 + }, + { + "index": 414, + "problem_id": "p02767", + "sample_key": [ + "s286517602", + "s316820501" + ], + "token_count": 40 + }, + { + "index": 415, + "problem_id": "p02725", + "sample_key": [ + "s320196234", + "s733866625" + ], + "token_count": 90 + }, + { + "index": 417, + "problem_id": "p03796", + "sample_key": [ + "s825153134", + "s210395809" + ], + "token_count": 76 + }, + { + "index": 418, + "problem_id": "p03854", + "sample_key": [ + "s135519212", + "s896370774" + ], + "token_count": 38 + }, + { + "index": 421, + "problem_id": "p03416", + "sample_key": [ + "s576934995", + "s588523024" + ], + "token_count": 63 + }, + { + "index": 425, + "problem_id": "p02390", + "sample_key": [ + "s466287089", + "s267092190" + ], + "token_count": 34 + }, + { + "index": 426, + "problem_id": "p02899", + "sample_key": [ + "s528079976", + "s501403941" + ], + "token_count": 76 + }, + { + "index": 427, + "problem_id": "p03416", + "sample_key": [ + "s637446217", + "s864775628" + ], + "token_count": 64 + }, + { + "index": 428, + "problem_id": "p02959", + "sample_key": [ + "s395849964", + "s383743178" + ], + "token_count": 111 + }, + { + "index": 431, + "problem_id": "p04044", + "sample_key": [ + "s532034645", + "s761755032" + ], + "token_count": 42 + }, + { + "index": 432, + "problem_id": "p02412", + "sample_key": [ + "s470319892", + "s042746843" + ], + "token_count": 116 + }, + { + "index": 433, + "problem_id": "p04044", + "sample_key": [ + "s161300550", + "s718856768" + ], + "token_count": 32 + }, + { + "index": 434, + "problem_id": "p03644", + "sample_key": [ + "s317462383", + "s803396146" + ], + "token_count": 58 + }, + { + "index": 435, + "problem_id": "p03037", + "sample_key": [ + "s043802358", + "s120994164" + ], + "token_count": 85 + }, + { + "index": 436, + "problem_id": "p03293", + "sample_key": [ + "s664706993", + "s616247709" + ], + "token_count": 46 + }, + { + "index": 437, + "problem_id": "p03060", + "sample_key": [ + "s176163369", + "s307096938" + ], + "token_count": 51 + }, + { + "index": 438, + "problem_id": "p03416", + "sample_key": [ + "s279175230", + "s789865740" + ], + "token_count": 62 + }, + { + "index": 439, + "problem_id": "p03721", + "sample_key": [ + "s865752287", + "s921873406" + ], + "token_count": 85 + }, + { + "index": 441, + "problem_id": "p03000", + "sample_key": [ + "s259788442", + "s163625054" + ], + "token_count": 72 + }, + { + "index": 442, + "problem_id": "p03416", + "sample_key": [ + "s770002751", + "s323286862" + ], + "token_count": 72 + }, + { + "index": 443, + "problem_id": "p03796", + "sample_key": [ + "s636787028", + "s575140392" + ], + "token_count": 36 + }, + { + "index": 444, + "problem_id": "p03371", + "sample_key": [ + "s588181559", + "s154731902" + ], + "token_count": 101 + }, + { + "index": 445, + "problem_id": "p02595", + "sample_key": [ + "s512106161", + "s251902862" + ], + "token_count": 60 + }, + { + "index": 447, + "problem_id": "p02693", + "sample_key": [ + "s337733409", + "s217218479" + ], + "token_count": 59 + }, + { + "index": 449, + "problem_id": "p03796", + "sample_key": [ + "s893557911", + "s686331748" + ], + "token_count": 44 + }, + { + "index": 452, + "problem_id": "p00003", + "sample_key": [ + "s822995507", + "s034189952" + ], + "token_count": 76 + }, + { + "index": 453, + "problem_id": "p03424", + "sample_key": [ + "s841365629", + "s932855105" + ], + "token_count": 27 + }, + { + "index": 456, + "problem_id": "p02390", + "sample_key": [ + "s359089221", + "s084524983" + ], + "token_count": 108 + }, + { + "index": 457, + "problem_id": "p02880", + "sample_key": [ + "s530137772", + "s289678775" + ], + "token_count": 51 + }, + { + "index": 458, + "problem_id": "p03796", + "sample_key": [ + "s294020052", + "s579876547" + ], + "token_count": 40 + }, + { + "index": 460, + "problem_id": "p02622", + "sample_key": [ + "s346270661", + "s299240564" + ], + "token_count": 36 + }, + { + "index": 462, + "problem_id": "p02688", + "sample_key": [ + "s093466568", + "s996398988" + ], + "token_count": 75 + }, + { + "index": 463, + "problem_id": "p02416", + "sample_key": [ + "s248122741", + "s360997133" + ], + "token_count": 73 + }, + { + "index": 464, + "problem_id": "p03086", + "sample_key": [ + "s780520490", + "s016683067" + ], + "token_count": 29 + }, + { + "index": 466, + "problem_id": "p03325", + "sample_key": [ + "s352799823", + "s651648403" + ], + "token_count": 53 + }, + { + "index": 467, + "problem_id": "p03845", + "sample_key": [ + "s710663686", + "s021252857" + ], + "token_count": 81 + }, + { + "index": 468, + "problem_id": "p03796", + "sample_key": [ + "s669812244", + "s638032890" + ], + "token_count": 38 + }, + { + "index": 469, + "problem_id": "p02901", + "sample_key": [ + "s172477662", + "s096488733" + ], + "token_count": 123 + }, + { + "index": 471, + "problem_id": "p02627", + "sample_key": [ + "s793826721", + "s875451520" + ], + "token_count": 21 + }, + { + "index": 474, + "problem_id": "p03371", + "sample_key": [ + "s416055764", + "s218640380" + ], + "token_count": 42 + }, + { + "index": 475, + "problem_id": "p03723", + "sample_key": [ + "s414644536", + "s610159769" + ], + "token_count": 86 + }, + { + "index": 476, + "problem_id": "p03309", + "sample_key": [ + "s057200482", + "s045600813" + ], + "token_count": 64 + }, + { + "index": 478, + "problem_id": "p02691", + "sample_key": [ + "s720467562", + "s807450341" + ], + "token_count": 114 + }, + { + "index": 479, + "problem_id": "p02555", + "sample_key": [ + "s669686668", + "s427616795" + ], + "token_count": 76 + }, + { + "index": 480, + "problem_id": "p03107", + "sample_key": [ + "s607050481", + "s627055692" + ], + "token_count": 71 + }, + { + "index": 481, + "problem_id": "p02657", + "sample_key": [ + "s027336468", + "s218994202" + ], + "token_count": 52 + }, + { + "index": 482, + "problem_id": "p03759", + "sample_key": [ + "s246152829", + "s501080791" + ], + "token_count": 35 + }, + { + "index": 483, + "problem_id": "p03796", + "sample_key": [ + "s645296559", + "s055332014" + ], + "token_count": 42 + }, + { + "index": 484, + "problem_id": "p03416", + "sample_key": [ + "s570028181", + "s434791726" + ], + "token_count": 40 + }, + { + "index": 485, + "problem_id": "p03796", + "sample_key": [ + "s671319819", + "s345697128" + ], + "token_count": 38 + }, + { + "index": 486, + "problem_id": "p03721", + "sample_key": [ + "s705162733", + "s360654843" + ], + "token_count": 73 + }, + { + "index": 487, + "problem_id": "p03796", + "sample_key": [ + "s710953077", + "s484408635" + ], + "token_count": 78 + }, + { + "index": 489, + "problem_id": "p03814", + "sample_key": [ + "s883482084", + "s072538424" + ], + "token_count": 75 + }, + { + "index": 490, + "problem_id": "p02412", + "sample_key": [ + "s777094380", + "s391711407" + ], + "token_count": 53 + }, + { + "index": 492, + "problem_id": "p02702", + "sample_key": [ + "s376874744", + "s887269917" + ], + "token_count": 113 + }, + { + "index": 493, + "problem_id": "p02627", + "sample_key": [ + "s724454634", + "s209300808" + ], + "token_count": 14 + }, + { + "index": 494, + "problem_id": "p03325", + "sample_key": [ + "s558724347", + "s377057284" + ], + "token_count": 81 + }, + { + "index": 495, + "problem_id": "p03416", + "sample_key": [ + "s181217545", + "s674939126" + ], + "token_count": 87 + }, + { + "index": 496, + "problem_id": "p03835", + "sample_key": [ + "s742815481", + "s376437490" + ], + "token_count": 58 + }, + { + "index": 498, + "problem_id": "p03371", + "sample_key": [ + "s136733954", + "s827725289" + ], + "token_count": 117 + }, + { + "index": 499, + "problem_id": "p02983", + "sample_key": [ + "s140577970", + "s371672772" + ], + "token_count": 44 + }, + { + "index": 500, + "problem_id": "p03945", + "sample_key": [ + "s766452702", + "s266627272" + ], + "token_count": 44 + }, + { + "index": 501, + "problem_id": "p03796", + "sample_key": [ + "s559298633", + "s569125766" + ], + "token_count": 47 + }, + { + "index": 502, + "problem_id": "p03416", + "sample_key": [ + "s658008469", + "s153128369" + ], + "token_count": 86 + }, + { + "index": 504, + "problem_id": "p03796", + "sample_key": [ + "s064171222", + "s323999427" + ], + "token_count": 60 + }, + { + "index": 506, + "problem_id": "p03796", + "sample_key": [ + "s700640855", + "s281752333" + ], + "token_count": 45 + }, + { + "index": 508, + "problem_id": "p02994", + "sample_key": [ + "s135697405", + "s243236458" + ], + "token_count": 38 + }, + { + "index": 509, + "problem_id": "p03371", + "sample_key": [ + "s614340278", + "s677161923" + ], + "token_count": 79 + }, + { + "index": 514, + "problem_id": "p03814", + "sample_key": [ + "s292011694", + "s577750700" + ], + "token_count": 44 + }, + { + "index": 515, + "problem_id": "p03494", + "sample_key": [ + "s130510697", + "s993121873" + ], + "token_count": 27 + }, + { + "index": 516, + "problem_id": "p03309", + "sample_key": [ + "s990999147", + "s307361938" + ], + "token_count": 38 + }, + { + "index": 517, + "problem_id": "p03416", + "sample_key": [ + "s823919342", + "s499216276" + ], + "token_count": 49 + }, + { + "index": 520, + "problem_id": "p03796", + "sample_key": [ + "s560811979", + "s868944422" + ], + "token_count": 51 + }, + { + "index": 523, + "problem_id": "p02767", + "sample_key": [ + "s699773211", + "s064206410" + ], + "token_count": 93 + }, + { + "index": 526, + "problem_id": "p03107", + "sample_key": [ + "s703980325", + "s025529722" + ], + "token_count": 19 + }, + { + "index": 529, + "problem_id": "p02725", + "sample_key": [ + "s425361145", + "s820245641" + ], + "token_count": 62 + }, + { + "index": 530, + "problem_id": "p02886", + "sample_key": [ + "s631255245", + "s295881998" + ], + "token_count": 99 + }, + { + "index": 531, + "problem_id": "p03353", + "sample_key": [ + "s387813464", + "s460839958" + ], + "token_count": 70 + }, + { + "index": 532, + "problem_id": "p02702", + "sample_key": [ + "s121665958", + "s794197403" + ], + "token_count": 113 + }, + { + "index": 533, + "problem_id": "p03814", + "sample_key": [ + "s574890983", + "s839527046" + ], + "token_count": 27 + }, + { + "index": 535, + "problem_id": "p02612", + "sample_key": [ + "s828418851", + "s809335980" + ], + "token_count": 27 + }, + { + "index": 536, + "problem_id": "p02983", + "sample_key": [ + "s074902378", + "s358904585" + ], + "token_count": 82 + }, + { + "index": 537, + "problem_id": "p02773", + "sample_key": [ + "s074380513", + "s228830644" + ], + "token_count": 90 + }, + { + "index": 538, + "problem_id": "p03037", + "sample_key": [ + "s058389905", + "s302443687" + ], + "token_count": 89 + }, + { + "index": 539, + "problem_id": "p02881", + "sample_key": [ + "s868775809", + "s345973481" + ], + "token_count": 96 + }, + { + "index": 540, + "problem_id": "p02881", + "sample_key": [ + "s879601223", + "s706921267" + ], + "token_count": 85 + }, + { + "index": 541, + "problem_id": "p04020", + "sample_key": [ + "s648607888", + "s112859245" + ], + "token_count": 117 + }, + { + "index": 542, + "problem_id": "p02412", + "sample_key": [ + "s229334190", + "s721700065" + ], + "token_count": 114 + }, + { + "index": 544, + "problem_id": "p03371", + "sample_key": [ + "s168362535", + "s471284270" + ], + "token_count": 122 + }, + { + "index": 545, + "problem_id": "p02555", + "sample_key": [ + "s796837031", + "s077713004" + ], + "token_count": 43 + }, + { + "index": 548, + "problem_id": "p03307", + "sample_key": [ + "s632972821", + "s560495025" + ], + "token_count": 18 + }, + { + "index": 549, + "problem_id": "p03854", + "sample_key": [ + "s259161069", + "s688102427" + ], + "token_count": 105 + }, + { + "index": 550, + "problem_id": "p02688", + "sample_key": [ + "s600438109", + "s928531547" + ], + "token_count": 120 + }, + { + "index": 552, + "problem_id": "p03037", + "sample_key": [ + "s012458960", + "s740832114" + ], + "token_count": 67 + }, + { + "index": 553, + "problem_id": "p03287", + "sample_key": [ + "s303506832", + "s561375948" + ], + "token_count": 118 + }, + { + "index": 555, + "problem_id": "p02691", + "sample_key": [ + "s021965299", + "s412762136" + ], + "token_count": 74 + } + ], + "256-512": [ + { + "index": 2, + "problem_id": "p03078", + "sample_key": [ + "s581139547", + "s213757381" + ], + "token_count": 330 + }, + { + "index": 21, + "problem_id": "p03608", + "sample_key": [ + "s266235653", + "s503227515" + ], + "token_count": 266 + }, + { + "index": 28, + "problem_id": "p02555", + "sample_key": [ + "s706729835", + "s005580579" + ], + "token_count": 267 + }, + { + "index": 41, + "problem_id": "p02834", + "sample_key": [ + "s854767798", + "s662268715" + ], + "token_count": 293 + }, + { + "index": 62, + "problem_id": "p02537", + "sample_key": [ + "s277145927", + "s770419806" + ], + "token_count": 305 + }, + { + "index": 65, + "problem_id": "p03371", + "sample_key": [ + "s501790970", + "s324668886" + ], + "token_count": 297 + }, + { + "index": 72, + "problem_id": "p03371", + "sample_key": [ + "s264866690", + "s762683898" + ], + "token_count": 296 + }, + { + "index": 81, + "problem_id": "p03837", + "sample_key": [ + "s032580281", + "s724625000" + ], + "token_count": 307 + }, + { + "index": 85, + "problem_id": "p02248", + "sample_key": [ + "s909106276", + "s961733692" + ], + "token_count": 258 + }, + { + "index": 125, + "problem_id": "p03078", + "sample_key": [ + "s323914382", + "s323368336" + ], + "token_count": 378 + }, + { + "index": 139, + "problem_id": "p02837", + "sample_key": [ + "s234390283", + "s698943579" + ], + "token_count": 339 + }, + { + "index": 174, + "problem_id": "p02245", + "sample_key": [ + "s804728708", + "s622088378" + ], + "token_count": 303 + }, + { + "index": 179, + "problem_id": "p03078", + "sample_key": [ + "s622309249", + "s171509372" + ], + "token_count": 465 + }, + { + "index": 182, + "problem_id": "p02758", + "sample_key": [ + "s598598719", + "s066197035" + ], + "token_count": 300 + }, + { + "index": 185, + "problem_id": "p02792", + "sample_key": [ + "s401307257", + "s179676165" + ], + "token_count": 282 + }, + { + "index": 193, + "problem_id": "p03309", + "sample_key": [ + "s289814925", + "s781437429" + ], + "token_count": 275 + }, + { + "index": 197, + "problem_id": "p03078", + "sample_key": [ + "s362357786", + "s175109634" + ], + "token_count": 313 + }, + { + "index": 205, + "problem_id": "p02264", + "sample_key": [ + "s309974156", + "s779537604" + ], + "token_count": 298 + }, + { + "index": 221, + "problem_id": "p02821", + "sample_key": [ + "s228028161", + "s587768475" + ], + "token_count": 299 + }, + { + "index": 230, + "problem_id": "p01105", + "sample_key": [ + "s936098014", + "s480075396" + ], + "token_count": 393 + }, + { + "index": 231, + "problem_id": "p04020", + "sample_key": [ + "s043977447", + "s372001933" + ], + "token_count": 483 + }, + { + "index": 237, + "problem_id": "p03164", + "sample_key": [ + "s900171177", + "s494365384" + ], + "token_count": 277 + }, + { + "index": 258, + "problem_id": "p03806", + "sample_key": [ + "s355426542", + "s468498336" + ], + "token_count": 259 + }, + { + "index": 270, + "problem_id": "p03634", + "sample_key": [ + "s135133436", + "s083939253" + ], + "token_count": 373 + }, + { + "index": 286, + "problem_id": "p02599", + "sample_key": [ + "s648865207", + "s892817156" + ], + "token_count": 464 + }, + { + "index": 297, + "problem_id": "p03078", + "sample_key": [ + "s928848207", + "s406476908" + ], + "token_count": 350 + }, + { + "index": 300, + "problem_id": "p03034", + "sample_key": [ + "s001695168", + "s404140535" + ], + "token_count": 280 + }, + { + "index": 313, + "problem_id": "p00713", + "sample_key": [ + "s376249504", + "s496295641" + ], + "token_count": 382 + }, + { + "index": 344, + "problem_id": "p01105", + "sample_key": [ + "s457180384", + "s699385465" + ], + "token_count": 368 + }, + { + "index": 364, + "problem_id": "p03798", + "sample_key": [ + "s244589711", + "s160001244" + ], + "token_count": 485 + }, + { + "index": 381, + "problem_id": "p03039", + "sample_key": [ + "s108635717", + "s387237372" + ], + "token_count": 339 + }, + { + "index": 385, + "problem_id": "p02245", + "sample_key": [ + "s696240934", + "s480327836" + ], + "token_count": 414 + }, + { + "index": 392, + "problem_id": "p02794", + "sample_key": [ + "s356881403", + "s623982203" + ], + "token_count": 391 + }, + { + "index": 393, + "problem_id": "p02612", + "sample_key": [ + "s197156959", + "s836901225" + ], + "token_count": 348 + }, + { + "index": 397, + "problem_id": "p03806", + "sample_key": [ + "s636298531", + "s857325561" + ], + "token_count": 271 + }, + { + "index": 406, + "problem_id": "p02901", + "sample_key": [ + "s827366183", + "s086626630" + ], + "token_count": 282 + }, + { + "index": 407, + "problem_id": "p03253", + "sample_key": [ + "s043094515", + "s952701444" + ], + "token_count": 300 + }, + { + "index": 416, + "problem_id": "p02822", + "sample_key": [ + "s981663077", + "s820806781" + ], + "token_count": 431 + }, + { + "index": 419, + "problem_id": "p03074", + "sample_key": [ + "s599311447", + "s168736691" + ], + "token_count": 320 + }, + { + "index": 424, + "problem_id": "p02248", + "sample_key": [ + "s637132288", + "s753981495" + ], + "token_count": 278 + }, + { + "index": 429, + "problem_id": "p02863", + "sample_key": [ + "s185891854", + "s652115022" + ], + "token_count": 288 + }, + { + "index": 455, + "problem_id": "p03988", + "sample_key": [ + "s661300903", + "s790648502" + ], + "token_count": 373 + }, + { + "index": 465, + "problem_id": "p03828", + "sample_key": [ + "s594973511", + "s914422541" + ], + "token_count": 288 + }, + { + "index": 470, + "problem_id": "p02574", + "sample_key": [ + "s911286307", + "s843819881" + ], + "token_count": 447 + }, + { + "index": 472, + "problem_id": "p03039", + "sample_key": [ + "s871362008", + "s362897835" + ], + "token_count": 256 + }, + { + "index": 491, + "problem_id": "p03608", + "sample_key": [ + "s030633020", + "s301564470" + ], + "token_count": 289 + }, + { + "index": 510, + "problem_id": "p03828", + "sample_key": [ + "s924740576", + "s078000611" + ], + "token_count": 292 + }, + { + "index": 511, + "problem_id": "p02245", + "sample_key": [ + "s424620538", + "s007973982" + ], + "token_count": 325 + }, + { + "index": 519, + "problem_id": "p03558", + "sample_key": [ + "s378178699", + "s370816259" + ], + "token_count": 363 + }, + { + "index": 525, + "problem_id": "p03253", + "sample_key": [ + "s901379470", + "s767594103" + ], + "token_count": 280 + }, + { + "index": 528, + "problem_id": "p03039", + "sample_key": [ + "s814969347", + "s884180243" + ], + "token_count": 458 + }, + { + "index": 534, + "problem_id": "p03371", + "sample_key": [ + "s026349855", + "s676818074" + ], + "token_count": 312 + }, + { + "index": 543, + "problem_id": "p02245", + "sample_key": [ + "s237914915", + "s694650984" + ], + "token_count": 375 + }, + { + "index": 546, + "problem_id": "p03806", + "sample_key": [ + "s823150149", + "s174409855" + ], + "token_count": 267 + }, + { + "index": 547, + "problem_id": "p02555", + "sample_key": [ + "s988049268", + "s031685542" + ], + "token_count": 360 + } + ], + "512-1024": [ + { + "index": 4, + "problem_id": "p03674", + "sample_key": [ + "s545310428", + "s792744532" + ], + "token_count": 628 + }, + { + "index": 50, + "problem_id": "p02794", + "sample_key": [ + "s167224132", + "s245735210" + ], + "token_count": 744 + }, + { + "index": 87, + "problem_id": "p03553", + "sample_key": [ + "s305170925", + "s833575440" + ], + "token_count": 690 + }, + { + "index": 138, + "problem_id": "p02378", + "sample_key": [ + "s432486243", + "s242092393" + ], + "token_count": 579 + }, + { + "index": 180, + "problem_id": "p02560", + "sample_key": [ + "s978863609", + "s598945859" + ], + "token_count": 757 + }, + { + "index": 216, + "problem_id": "p03634", + "sample_key": [ + "s798160758", + "s876456894" + ], + "token_count": 531 + }, + { + "index": 268, + "problem_id": "p02649", + "sample_key": [ + "s231020544", + "s831601953" + ], + "token_count": 573 + } + ], + "128-256": [ + { + "index": 10, + "problem_id": "p03038", + "sample_key": [ + "s890208193", + "s797826633" + ], + "token_count": 239 + }, + { + "index": 11, + "problem_id": "p02891", + "sample_key": [ + "s480399361", + "s640908939" + ], + "token_count": 209 + }, + { + "index": 18, + "problem_id": "p02814", + "sample_key": [ + "s505874222", + "s539286615" + ], + "token_count": 157 + }, + { + "index": 26, + "problem_id": "p03558", + "sample_key": [ + "s239051528", + "s690298448" + ], + "token_count": 155 + }, + { + "index": 30, + "problem_id": "p01438", + "sample_key": [ + "s057521298", + "s672157071" + ], + "token_count": 204 + }, + { + "index": 32, + "problem_id": "p03032", + "sample_key": [ + "s669893633", + "s465849215" + ], + "token_count": 208 + }, + { + "index": 33, + "problem_id": "p02863", + "sample_key": [ + "s340691380", + "s390961057" + ], + "token_count": 131 + }, + { + "index": 36, + "problem_id": "p03039", + "sample_key": [ + "s835548762", + "s860519661" + ], + "token_count": 248 + }, + { + "index": 38, + "problem_id": "p02596", + "sample_key": [ + "s410919516", + "s753895766" + ], + "token_count": 138 + }, + { + "index": 39, + "problem_id": "p02959", + "sample_key": [ + "s872669573", + "s116182226" + ], + "token_count": 146 + }, + { + "index": 43, + "problem_id": "p02873", + "sample_key": [ + "s874712614", + "s975354355" + ], + "token_count": 142 + }, + { + "index": 44, + "problem_id": "p03253", + "sample_key": [ + "s968664754", + "s390670273" + ], + "token_count": 145 + }, + { + "index": 47, + "problem_id": "p04020", + "sample_key": [ + "s879592559", + "s107006666" + ], + "token_count": 174 + }, + { + "index": 48, + "problem_id": "p03164", + "sample_key": [ + "s478711084", + "s154638745" + ], + "token_count": 214 + }, + { + "index": 51, + "problem_id": "p03078", + "sample_key": [ + "s065985582", + "s294135268" + ], + "token_count": 148 + }, + { + "index": 55, + "problem_id": "p02837", + "sample_key": [ + "s705992872", + "s870269222" + ], + "token_count": 160 + }, + { + "index": 58, + "problem_id": "p03425", + "sample_key": [ + "s570150327", + "s255248054" + ], + "token_count": 177 + }, + { + "index": 70, + "problem_id": "p02792", + "sample_key": [ + "s475401488", + "s941984259" + ], + "token_count": 255 + }, + { + "index": 75, + "problem_id": "p03575", + "sample_key": [ + "s579377069", + "s043222526" + ], + "token_count": 255 + }, + { + "index": 79, + "problem_id": "p03457", + "sample_key": [ + "s861400279", + "s171825130" + ], + "token_count": 146 + }, + { + "index": 84, + "problem_id": "p03579", + "sample_key": [ + "s986959512", + "s945473888" + ], + "token_count": 255 + }, + { + "index": 86, + "problem_id": "p03457", + "sample_key": [ + "s103328073", + "s130173321" + ], + "token_count": 146 + }, + { + "index": 89, + "problem_id": "p03078", + "sample_key": [ + "s229462844", + "s240353408" + ], + "token_count": 199 + }, + { + "index": 91, + "problem_id": "p02386", + "sample_key": [ + "s799017760", + "s414241098" + ], + "token_count": 208 + }, + { + "index": 93, + "problem_id": "p03038", + "sample_key": [ + "s839494003", + "s928697183" + ], + "token_count": 148 + }, + { + "index": 94, + "problem_id": "p03200", + "sample_key": [ + "s951894178", + "s605042414" + ], + "token_count": 137 + }, + { + "index": 96, + "problem_id": "p03752", + "sample_key": [ + "s863090450", + "s059435285" + ], + "token_count": 210 + }, + { + "index": 101, + "problem_id": "p03363", + "sample_key": [ + "s954809041", + "s284059915" + ], + "token_count": 129 + }, + { + "index": 105, + "problem_id": "p03253", + "sample_key": [ + "s242343005", + "s569938093" + ], + "token_count": 210 + }, + { + "index": 106, + "problem_id": "p02983", + "sample_key": [ + "s271837395", + "s778364451" + ], + "token_count": 131 + }, + { + "index": 109, + "problem_id": "p03039", + "sample_key": [ + "s481435936", + "s241948863" + ], + "token_count": 164 + }, + { + "index": 116, + "problem_id": "p03038", + "sample_key": [ + "s653342727", + "s579349204" + ], + "token_count": 206 + }, + { + "index": 126, + "problem_id": "p00174", + "sample_key": [ + "s437122774", + "s723923476" + ], + "token_count": 132 + }, + { + "index": 130, + "problem_id": "p03371", + "sample_key": [ + "s681762997", + "s948041496" + ], + "token_count": 197 + }, + { + "index": 136, + "problem_id": "p02555", + "sample_key": [ + "s264986040", + "s936814116" + ], + "token_count": 155 + }, + { + "index": 141, + "problem_id": "p02851", + "sample_key": [ + "s203769987", + "s522861811" + ], + "token_count": 144 + }, + { + "index": 144, + "problem_id": "p02792", + "sample_key": [ + "s736173164", + "s628306332" + ], + "token_count": 165 + }, + { + "index": 147, + "problem_id": "p02814", + "sample_key": [ + "s285073705", + "s453740847" + ], + "token_count": 212 + }, + { + "index": 160, + "problem_id": "p03558", + "sample_key": [ + "s333680155", + "s106353030" + ], + "token_count": 212 + }, + { + "index": 162, + "problem_id": "p03839", + "sample_key": [ + "s934844992", + "s135860240" + ], + "token_count": 136 + }, + { + "index": 165, + "problem_id": "p02821", + "sample_key": [ + "s756543404", + "s283463453" + ], + "token_count": 219 + }, + { + "index": 166, + "problem_id": "p03634", + "sample_key": [ + "s144783413", + "s080655040" + ], + "token_count": 199 + }, + { + "index": 168, + "problem_id": "p02748", + "sample_key": [ + "s393648468", + "s394235092" + ], + "token_count": 134 + }, + { + "index": 173, + "problem_id": "p03828", + "sample_key": [ + "s909168869", + "s458659043" + ], + "token_count": 166 + }, + { + "index": 175, + "problem_id": "p03416", + "sample_key": [ + "s971943319", + "s985131399" + ], + "token_count": 151 + }, + { + "index": 176, + "problem_id": "p03371", + "sample_key": [ + "s157366337", + "s208344914" + ], + "token_count": 159 + }, + { + "index": 178, + "problem_id": "p02792", + "sample_key": [ + "s746150122", + "s989284284" + ], + "token_count": 148 + }, + { + "index": 196, + "problem_id": "p02555", + "sample_key": [ + "s269976358", + "s000228897" + ], + "token_count": 161 + }, + { + "index": 203, + "problem_id": "p03164", + "sample_key": [ + "s644346369", + "s649660252" + ], + "token_count": 171 + }, + { + "index": 207, + "problem_id": "p03086", + "sample_key": [ + "s827296868", + "s358574733" + ], + "token_count": 225 + }, + { + "index": 211, + "problem_id": "p02386", + "sample_key": [ + "s352388599", + "s199670495" + ], + "token_count": 239 + }, + { + "index": 224, + "problem_id": "p02268", + "sample_key": [ + "s156684058", + "s820654012" + ], + "token_count": 141 + }, + { + "index": 227, + "problem_id": "p03086", + "sample_key": [ + "s916999030", + "s575230730" + ], + "token_count": 153 + }, + { + "index": 228, + "problem_id": "p03371", + "sample_key": [ + "s775348159", + "s575049266" + ], + "token_count": 166 + }, + { + "index": 235, + "problem_id": "p03074", + "sample_key": [ + "s221518045", + "s305948108" + ], + "token_count": 212 + }, + { + "index": 241, + "problem_id": "p03253", + "sample_key": [ + "s289323588", + "s397757622" + ], + "token_count": 227 + }, + { + "index": 260, + "problem_id": "p03854", + "sample_key": [ + "s146499990", + "s321967328" + ], + "token_count": 139 + }, + { + "index": 262, + "problem_id": "p03559", + "sample_key": [ + "s643210131", + "s973528764" + ], + "token_count": 239 + }, + { + "index": 269, + "problem_id": "p02814", + "sample_key": [ + "s703991862", + "s702868581" + ], + "token_count": 226 + }, + { + "index": 273, + "problem_id": "p03634", + "sample_key": [ + "s145761901", + "s949294302" + ], + "token_count": 218 + }, + { + "index": 280, + "problem_id": "p02814", + "sample_key": [ + "s934732087", + "s059526149" + ], + "token_count": 255 + }, + { + "index": 282, + "problem_id": "p02814", + "sample_key": [ + "s991587805", + "s856136819" + ], + "token_count": 152 + }, + { + "index": 283, + "problem_id": "p02412", + "sample_key": [ + "s921182397", + "s148735991" + ], + "token_count": 160 + }, + { + "index": 285, + "problem_id": "p02863", + "sample_key": [ + "s061535189", + "s586045080" + ], + "token_count": 227 + }, + { + "index": 293, + "problem_id": "p03801", + "sample_key": [ + "s790222372", + "s964537161" + ], + "token_count": 217 + }, + { + "index": 294, + "problem_id": "p03013", + "sample_key": [ + "s479618893", + "s899240371" + ], + "token_count": 149 + }, + { + "index": 301, + "problem_id": "p03038", + "sample_key": [ + "s547925628", + "s764313725" + ], + "token_count": 228 + }, + { + "index": 302, + "problem_id": "p03828", + "sample_key": [ + "s749493108", + "s831049300" + ], + "token_count": 148 + }, + { + "index": 303, + "problem_id": "p02937", + "sample_key": [ + "s126195271", + "s641311638" + ], + "token_count": 156 + }, + { + "index": 304, + "problem_id": "p02996", + "sample_key": [ + "s825135097", + "s901008925" + ], + "token_count": 180 + }, + { + "index": 312, + "problem_id": "p03078", + "sample_key": [ + "s149883415", + "s931960732" + ], + "token_count": 201 + }, + { + "index": 314, + "problem_id": "p03074", + "sample_key": [ + "s853547546", + "s138697044" + ], + "token_count": 198 + }, + { + "index": 317, + "problem_id": "p03828", + "sample_key": [ + "s058426510", + "s587454237" + ], + "token_count": 164 + }, + { + "index": 321, + "problem_id": "p03854", + "sample_key": [ + "s952373499", + "s487524594" + ], + "token_count": 162 + }, + { + "index": 336, + "problem_id": "p03363", + "sample_key": [ + "s520227607", + "s241017574" + ], + "token_count": 129 + }, + { + "index": 337, + "problem_id": "p03457", + "sample_key": [ + "s991338937", + "s211926413" + ], + "token_count": 136 + }, + { + "index": 341, + "problem_id": "p03822", + "sample_key": [ + "s508015569", + "s203932637" + ], + "token_count": 165 + }, + { + "index": 345, + "problem_id": "p02792", + "sample_key": [ + "s313172456", + "s731114638" + ], + "token_count": 151 + }, + { + "index": 347, + "problem_id": "p01138", + "sample_key": [ + "s367659771", + "s546819347" + ], + "token_count": 132 + }, + { + "index": 351, + "problem_id": "p02901", + "sample_key": [ + "s462370890", + "s446448975" + ], + "token_count": 191 + }, + { + "index": 352, + "problem_id": "p02721", + "sample_key": [ + "s949081681", + "s434725940" + ], + "token_count": 209 + }, + { + "index": 358, + "problem_id": "p03819", + "sample_key": [ + "s951638556", + "s089571448" + ], + "token_count": 238 + }, + { + "index": 360, + "problem_id": "p03480", + "sample_key": [ + "s964601714", + "s413566853" + ], + "token_count": 131 + }, + { + "index": 365, + "problem_id": "p03162", + "sample_key": [ + "s337419843", + "s763303888" + ], + "token_count": 163 + }, + { + "index": 368, + "problem_id": "p03078", + "sample_key": [ + "s052587697", + "s157699880" + ], + "token_count": 228 + }, + { + "index": 369, + "problem_id": "p02837", + "sample_key": [ + "s473277676", + "s669766257" + ], + "token_count": 175 + }, + { + "index": 371, + "problem_id": "p02278", + "sample_key": [ + "s595158290", + "s757741528" + ], + "token_count": 220 + }, + { + "index": 374, + "problem_id": "p03197", + "sample_key": [ + "s531607176", + "s450058032" + ], + "token_count": 197 + }, + { + "index": 378, + "problem_id": "p02891", + "sample_key": [ + "s581989830", + "s729822755" + ], + "token_count": 232 + }, + { + "index": 382, + "problem_id": "p03013", + "sample_key": [ + "s193052587", + "s829443238" + ], + "token_count": 157 + }, + { + "index": 387, + "problem_id": "p03634", + "sample_key": [ + "s279386500", + "s990337521" + ], + "token_count": 217 + }, + { + "index": 390, + "problem_id": "p02685", + "sample_key": [ + "s549338354", + "s173586541" + ], + "token_count": 232 + }, + { + "index": 391, + "problem_id": "p03828", + "sample_key": [ + "s442927172", + "s952876179" + ], + "token_count": 150 + }, + { + "index": 399, + "problem_id": "p03164", + "sample_key": [ + "s415436180", + "s201445864" + ], + "token_count": 230 + }, + { + "index": 400, + "problem_id": "p02691", + "sample_key": [ + "s430506044", + "s372862352" + ], + "token_count": 171 + }, + { + "index": 401, + "problem_id": "p03039", + "sample_key": [ + "s387237372", + "s322645394" + ], + "token_count": 217 + }, + { + "index": 402, + "problem_id": "p03253", + "sample_key": [ + "s723979708", + "s327831897" + ], + "token_count": 218 + }, + { + "index": 403, + "problem_id": "p03371", + "sample_key": [ + "s511736682", + "s377839923" + ], + "token_count": 196 + }, + { + "index": 404, + "problem_id": "p03425", + "sample_key": [ + "s819679830", + "s546088432" + ], + "token_count": 132 + }, + { + "index": 411, + "problem_id": "p03013", + "sample_key": [ + "s227334045", + "s524241188" + ], + "token_count": 161 + }, + { + "index": 413, + "problem_id": "p03416", + "sample_key": [ + "s286428945", + "s838954646" + ], + "token_count": 153 + }, + { + "index": 420, + "problem_id": "p02837", + "sample_key": [ + "s547554870", + "s193607306" + ], + "token_count": 130 + }, + { + "index": 422, + "problem_id": "p02881", + "sample_key": [ + "s106501170", + "s046181145" + ], + "token_count": 160 + }, + { + "index": 423, + "problem_id": "p02555", + "sample_key": [ + "s422627112", + "s801844924" + ], + "token_count": 187 + }, + { + "index": 430, + "problem_id": "p03074", + "sample_key": [ + "s171288721", + "s319292568" + ], + "token_count": 219 + }, + { + "index": 440, + "problem_id": "p03814", + "sample_key": [ + "s932284243", + "s708109984" + ], + "token_count": 170 + }, + { + "index": 446, + "problem_id": "p02814", + "sample_key": [ + "s956521329", + "s164820491" + ], + "token_count": 142 + }, + { + "index": 448, + "problem_id": "p03171", + "sample_key": [ + "s330952971", + "s165498833" + ], + "token_count": 132 + }, + { + "index": 450, + "problem_id": "p02574", + "sample_key": [ + "s835620267", + "s021486096" + ], + "token_count": 250 + }, + { + "index": 451, + "problem_id": "p02850", + "sample_key": [ + "s943818401", + "s978957689" + ], + "token_count": 166 + }, + { + "index": 454, + "problem_id": "p00122", + "sample_key": [ + "s871701752", + "s889694954" + ], + "token_count": 249 + }, + { + "index": 459, + "problem_id": "p03634", + "sample_key": [ + "s592706363", + "s081294326" + ], + "token_count": 218 + }, + { + "index": 461, + "problem_id": "p02264", + "sample_key": [ + "s685908626", + "s418135932" + ], + "token_count": 159 + }, + { + "index": 473, + "problem_id": "p02555", + "sample_key": [ + "s550500681", + "s439989437" + ], + "token_count": 158 + }, + { + "index": 477, + "problem_id": "p02665", + "sample_key": [ + "s890279539", + "s923250526" + ], + "token_count": 230 + }, + { + "index": 488, + "problem_id": "p03164", + "sample_key": [ + "s292196170", + "s917581247" + ], + "token_count": 146 + }, + { + "index": 497, + "problem_id": "p02702", + "sample_key": [ + "s375368375", + "s846087139" + ], + "token_count": 185 + }, + { + "index": 503, + "problem_id": "p03568", + "sample_key": [ + "s195491532", + "s278252901" + ], + "token_count": 238 + }, + { + "index": 505, + "problem_id": "p03241", + "sample_key": [ + "s848556972", + "s836748791" + ], + "token_count": 131 + }, + { + "index": 507, + "problem_id": "p04017", + "sample_key": [ + "s083196734", + "s862767700" + ], + "token_count": 237 + }, + { + "index": 512, + "problem_id": "p03854", + "sample_key": [ + "s451133157", + "s498631928" + ], + "token_count": 155 + }, + { + "index": 513, + "problem_id": "p03806", + "sample_key": [ + "s128261336", + "s895482909" + ], + "token_count": 209 + }, + { + "index": 518, + "problem_id": "p03013", + "sample_key": [ + "s961535130", + "s147927462" + ], + "token_count": 169 + }, + { + "index": 521, + "problem_id": "p02596", + "sample_key": [ + "s121951272", + "s390007993" + ], + "token_count": 253 + }, + { + "index": 522, + "problem_id": "p03013", + "sample_key": [ + "s205446737", + "s887904874" + ], + "token_count": 161 + }, + { + "index": 524, + "problem_id": "p02850", + "sample_key": [ + "s780367922", + "s062691036" + ], + "token_count": 181 + }, + { + "index": 527, + "problem_id": "p00145", + "sample_key": [ + "s120507501", + "s768605614" + ], + "token_count": 156 + }, + { + "index": 551, + "problem_id": "p03854", + "sample_key": [ + "s725954700", + "s400985362" + ], + "token_count": 209 + }, + { + "index": 554, + "problem_id": "p02850", + "sample_key": [ + "s596506481", + "s115492739" + ], + "token_count": 153 + }, + { + "index": 556, + "problem_id": "p02881", + "sample_key": [ + "s671057519", + "s116621872" + ], + "token_count": 173 + } + ], + "1024-2048": [ + { + "index": 195, + "problem_id": "p02680", + "sample_key": [ + "s341076610", + "s034276815" + ], + "token_count": 1074 + } + ] +} \ No newline at end of file diff --git a/python_splits/test_verified.target_token_bucket_summary.json b/python_splits/test_verified.target_token_bucket_summary.json new file mode 100644 index 0000000000000000000000000000000000000000..54c44f5b9ffd06a499cbda2ab08f2a2c28aa8ab3 --- /dev/null +++ b/python_splits/test_verified.target_token_bucket_summary.json @@ -0,0 +1,23 @@ +{ + "input_jsonl": "/research/jiamin0630/codediffu/CodeDllm/data/python_splits/test_verified.jsonl", + "model_path": "../dLLM-RL/local_models/dream-7b-base", + "text_field": "target", + "add_special_tokens": false, + "total_samples": 557, + "bucket_counts": { + "<128": 364, + "128-256": 130, + "256-512": 55, + "512-1024": 7, + "1024-2048": 1, + ">=2048": 0 + }, + "bucket_ratios": { + "<128": 0.6535008976660682, + "128-256": 0.2333931777378815, + "256-512": 0.09874326750448834, + "512-1024": 0.012567324955116697, + "1024-2048": 0.0017953321364452424, + ">=2048": 0.0 + } +} \ No newline at end of file diff --git a/python_splits/test_verified.target_with_token_buckets.jsonl b/python_splits/test_verified.target_with_token_buckets.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..4853f7936f0fa51ec584dca6c1f04fc55e9fb17a --- /dev/null +++ b/python_splits/test_verified.target_with_token_buckets.jsonl @@ -0,0 +1,557 @@ +{"user_id": "u732870425", "problem_id": "p03371", "language": "python", "submission_id_v0": "s504204235", "submission_id_v1": "s825991485", "cpu_time_v0": 104, "cpu_time_v1": 26, "memory_v0": 9176, "memory_v1": 9180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.0, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 5000 * 2 * 10 ** 5\n\nfor i in range(10 ** 5 + 1):\n\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n\n ans = min(ans, s)\n\n\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nif X > Y:\n\n v = A\n\nelse:\n\n v = B\n\n\n\nans = min(A*X+B*Y, C*max(X, Y)*2, C*min(X,Y)*2+(max(X,Y)-min(X,Y))*v)\n\n\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 10, "code_v0_num_chars": 195, "code_v1_num_chars": 170, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = 5000 * 2 * 10**5\nfor i in range(10**5 + 1):\n s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n ans = min(ans, s)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nif X > Y:\n v = A\nelse:\n v = B\nans = min(\n A * X + B * Y, C * max(X, Y) * 2, C * min(X, Y) * 2 + (max(X, Y) - min(X, Y)) * v\n)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-ans = 5000 * 2 * 10**5", "-for i in range(10**5 + 1):", "- s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B", "- ans = min(ans, s)", "+if X > Y:", "+ v = A", "+else:", "+ v = B", "+ans = min(", "+ A * X + B * Y, C * max(X, Y) * 2, C * min(X, Y) * 2 + (max(X, Y) - min(X, Y)) * v", "+)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.5409223008, "measured_runtime_v1": 0.2907806964, "runtime_lift": 5.2992592696, "key": ["s504204235", "s825991485"], "target_token_count_dream": 75, "target_token_bucket_dream": "<128"} +{"user_id": "u102461423", "problem_id": "p02612", "language": "python", "submission_id_v0": "s840955881", "submission_id_v1": "s608348800", "cpu_time_v0": 35, "cpu_time_v1": 29, "memory_v0": 9152, "memory_v1": 9160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.14, "input": "import sys\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(read())\n\nx = N + (-N) % 1000\n\nprint((x - N))", "target": "import math\n\nN = int(input())\n\nx = math.ceil(N/1000) * 1000\n\nprint((x-N))", "code_v0_loc": 9, "code_v1_loc": 4, "code_v0_num_chars": 174, "code_v1_num_chars": 71, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(read())\nx = N + (-N) % 1000\nprint((x - N))\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\nx = math.ceil(N / 1000) * 1000\nprint((x - N))\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-import sys", "+import math", "-read = sys.stdin.buffer.read", "-readline = sys.stdin.buffer.readline", "-readlines = sys.stdin.buffer.readlines", "-N = int(read())", "-x = N + (-N) % 1000", "+N = int(input())", "+x = math.ceil(N / 1000) * 1000"], "diff_only_import_comment": false, "measured_runtime_v0": 0.260022393, "measured_runtime_v1": 0.1385840868, "runtime_lift": 1.8762788639, "key": ["s840955881", "s608348800"], "target_token_count_dream": 31, "target_token_bucket_dream": "<128"} +{"user_id": "u056277698", "problem_id": "p03078", "language": "python", "submission_id_v0": "s581139547", "submission_id_v1": "s213757381", "cpu_time_v0": 104, "cpu_time_v1": 36, "memory_v0": 8708, "memory_v1": 4976, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.38, "input": "# -*- coding: utf-8 -*-\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nabc = []\n\n\n\nfor i, _a in enumerate(a):\n\n for j, _b in enumerate(b):\n\n if (i+1) * (j+1) > k:\n\n break\n\n for l, _c in enumerate(c):\n\n if (i+1) * (j+1) * (l+1) > k:\n\n break\n\n abc.append(_a + _b + _c)\n\n\n\nabc.sort(reverse=True)\n\nfor x in abc[:k]:\n\n print(x)\n", "target": "# -*- coding: utf-8 -*-\n\nimport heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\nla, lb, lc = len(a), len(b), len(c)\n\n\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\n\n\nfix = set()\n\n\n\nq = [(-(a[0]+b[0]+c[0]), 0, 0, 0)]\n\n\n\nfor _ in range(k):\n\n abc, i, j, l = heapq.heappop(q)\n\n print((-abc))\n\n\n\n if i+1 < la and (i+1, j, l) not in fix:\n\n heapq.heappush(q, (-(a[i+1]+b[j]+c[l]), i+1, j, l))\n\n fix.add((i+1, j, l))\n\n\n\n if j+1 < lb and (i, j+1, l) not in fix:\n\n heapq.heappush(q, (-(a[i]+b[j+1]+c[l]), i, j+1, l))\n\n fix.add((i, j+1, l))\n\n\n\n if l+1 < lc and (i, j, l+1) not in fix:\n\n heapq.heappush(q, (-(a[i]+b[j]+c[l+1]), i, j, l+1))\n\n fix.add((i, j, l+1))\n", "code_v0_loc": 24, "code_v1_loc": 33, "code_v0_num_chars": 566, "code_v1_num_chars": 841, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nabc = []\nfor i, _a in enumerate(a):\n for j, _b in enumerate(b):\n if (i + 1) * (j + 1) > k:\n break\n for l, _c in enumerate(c):\n if (i + 1) * (j + 1) * (l + 1) > k:\n break\n abc.append(_a + _b + _c)\nabc.sort(reverse=True)\nfor x in abc[:k]:\n print(x)\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport heapq\n\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\nla, lb, lc = len(a), len(b), len(c)\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nfix = set()\nq = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]\nfor _ in range(k):\n abc, i, j, l = heapq.heappop(q)\n print((-abc))\n if i + 1 < la and (i + 1, j, l) not in fix:\n heapq.heappush(q, (-(a[i + 1] + b[j] + c[l]), i + 1, j, l))\n fix.add((i + 1, j, l))\n if j + 1 < lb and (i, j + 1, l) not in fix:\n heapq.heappush(q, (-(a[i] + b[j + 1] + c[l]), i, j + 1, l))\n fix.add((i, j + 1, l))\n if l + 1 < lc and (i, j, l + 1) not in fix:\n heapq.heappush(q, (-(a[i] + b[j] + c[l + 1]), i, j, l + 1))\n fix.add((i, j, l + 1))\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["+import heapq", "+", "+la, lb, lc = len(a), len(b), len(c)", "-abc = []", "-for i, _a in enumerate(a):", "- for j, _b in enumerate(b):", "- if (i + 1) * (j + 1) > k:", "- break", "- for l, _c in enumerate(c):", "- if (i + 1) * (j + 1) * (l + 1) > k:", "- break", "- abc.append(_a + _b + _c)", "-abc.sort(reverse=True)", "-for x in abc[:k]:", "- print(x)", "+fix = set()", "+q = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]", "+for _ in range(k):", "+ abc, i, j, l = heapq.heappop(q)", "+ print((-abc))", "+ if i + 1 < la and (i + 1, j, l) not in fix:", "+ heapq.heappush(q, (-(a[i + 1] + b[j] + c[l]), i + 1, j, l))", "+ fix.add((i + 1, j, l))", "+ if j + 1 < lb and (i, j + 1, l) not in fix:", "+ heapq.heappush(q, (-(a[i] + b[j + 1] + c[l]), i, j + 1, l))", "+ fix.add((i, j + 1, l))", "+ if l + 1 < lc and (i, j, l + 1) not in fix:", "+ heapq.heappush(q, (-(a[i] + b[j] + c[l + 1]), i, j, l + 1))", "+ fix.add((i, j, l + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4343315315, "measured_runtime_v1": 0.2096420834, "runtime_lift": 2.0717764508, "key": ["s581139547", "s213757381"], "target_token_count_dream": 330, "target_token_bucket_dream": "256-512"} +{"user_id": "u761320129", "problem_id": "p03559", "language": "python", "submission_id_v0": "s241549796", "submission_id_v1": "s763191935", "cpu_time_v0": 368, "cpu_time_v1": 263, "memory_v0": 23328, "memory_v1": 29344, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.53, "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nans = 0\n\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n\n i = bisect_left(A, b)\n\n j = bisect(C, b)\n\n ans += i * (N-j)\n\nprint(ans)", "target": "N = int(input())\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nA.sort()\n\nC.sort()\n\n\n\nfrom bisect import bisect_left, bisect\n\nans = 0\n\nfor b in B:\n\n i = bisect_left(A,b)\n\n j = bisect(C,b)\n\n ans += i * (N-j)\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 14, "code_v0_num_chars": 291, "code_v1_num_chars": 289, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort()\nC.sort()\nans = 0\nfrom bisect import bisect, bisect_left\n\nfor b in B:\n i = bisect_left(A, b)\n j = bisect(C, b)\n ans += i * (N - j)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort()\nC.sort()\nfrom bisect import bisect_left, bisect\n\nans = 0\nfor b in B:\n i = bisect_left(A, b)\n j = bisect(C, b)\n ans += i * (N - j)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+from bisect import bisect_left, bisect", "+", "-from bisect import bisect, bisect_left", "-"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2898341594, "measured_runtime_v1": 0.1261365476, "runtime_lift": 2.2977809758, "key": ["s241549796", "s763191935"], "target_token_count_dream": 88, "target_token_bucket_dream": "<128"} +{"user_id": "u984276646", "problem_id": "p03674", "language": "python", "submission_id_v0": "s545310428", "submission_id_v1": "s792744532", "cpu_time_v0": 433, "cpu_time_v1": 334, "memory_v0": 43480, "memory_v1": 43988, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.86, "input": "n = int(input())\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp //= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp //= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n]*invf[i-1]*invf[n-i+1]%mod\n\n if i <= n-1:\n\n S += fact[n-1]*invf[i]*invf[n-1-i]%mod\n\n S %= mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n if i <= n:\n\n S += fact[n-1]*invf[i-1]*invf[n-i]%mod\n\n S %= mod\n\n print(S)", "target": "n = int(input())\n\na = list(map(int, input().split()))\n\nD = {i: [0] for i in range(1, n+1)}\n\nfor i in range(n+1):\n\n D[a[i]][0] += 1\n\n D[a[i]].append(i)\n\npl, pr = 0, 0\n\nfor i in D:\n\n if D[i][0] == 2:\n\n pl = D[i][1]\n\n pr = D[i][2]\n\n break\n\nL = pl\n\nM = pr - pl - 1\n\nN = n - pr\n\nmod = int(1e9) + 7 # <-- input modulo\n\nmaxf = n+11 # <-- input factional limitation\n\n\n\ndef make_fact(n, k):\n\n tmp = n\n\n perm = [i for i in range(k)]\n\n L = [0 for _ in range(k)]\n\n for i in range(k):\n\n L[i] = tmp % (i + 1)\n\n tmp //= i + 1\n\n LL = [0 for _ in range(k)]\n\n for i in range(k):\n\n LL[i] = perm[L[-i-1]]\n\n for j in range(L[-i-1]+1, k):\n\n perm[j-1] = perm[j]\n\n return LL\n\n\n\ndef doubling(n, m, modulo=mod):\n\n y = 1\n\n base = n\n\n tmp = m\n\n while tmp != 0:\n\n if tmp % 2 == 1:\n\n y *= base\n\n if modulo > 0:\n\n y %= modulo\n\n base *= base\n\n if modulo > 0:\n\n base %= modulo\n\n tmp //= 2\n\n return y\n\n\n\ndef inved(a, modulo=mod):\n\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n\n while l != 0:\n\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n\n k, l = l, k % l\n\n return x % modulo\n\n\n\nfact = [1 for _ in range(maxf+1)]\n\ninvf = [1 for _ in range(maxf+1)]\n\n\n\nfor i in range(maxf):\n\n fact[i+1] = (fact[i] * (i+1)) % mod\n\ninvf[-1] = inved(fact[-1])\n\nfor i in range(maxf, 0, -1):\n\n invf[i-1] = (invf[i] * i) % mod\n\n\n\nfor i in range(1, n+2):\n\n S = fact[n+1]*invf[i]*invf[n-i+1]%mod\n\n if i <= n-M:\n\n S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod\n\n S %= mod\n\n print(S)\n", "code_v0_loc": 75, "code_v1_loc": 69, "code_v0_num_chars": 1780, "code_v1_num_chars": 1635, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nD = {i: [0] for i in range(1, n + 1)}\nfor i in range(n + 1):\n D[a[i]][0] += 1\n D[a[i]].append(i)\npl, pr = 0, 0\nfor i in D:\n if D[i][0] == 2:\n pl = D[i][1]\n pr = D[i][2]\n break\nL = pl\nM = pr - pl - 1\nN = n - pr\nmod = int(1e9) + 7 # <-- input modulo\nmaxf = n + 11 # <-- input factional limitation\n\n\ndef make_fact(n, k):\n tmp = n\n perm = [i for i in range(k)]\n L = [0 for _ in range(k)]\n for i in range(k):\n L[i] = tmp % (i + 1)\n tmp //= i + 1\n LL = [0 for _ in range(k)]\n for i in range(k):\n LL[i] = perm[L[-i - 1]]\n for j in range(L[-i - 1] + 1, k):\n perm[j - 1] = perm[j]\n return LL\n\n\ndef doubling(n, m, modulo=mod):\n y = 1\n base = n\n tmp = m\n while tmp != 0:\n if tmp % 2 == 1:\n y *= base\n if modulo > 0:\n y %= modulo\n base *= base\n if modulo > 0:\n base %= modulo\n tmp //= 2\n return y\n\n\ndef inved(a, modulo=mod):\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n while l != 0:\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n k, l = l, k % l\n return x % modulo\n\n\nfact = [1 for _ in range(maxf + 1)]\ninvf = [1 for _ in range(maxf + 1)]\nfor i in range(maxf):\n fact[i + 1] = (fact[i] * (i + 1)) % mod\ninvf[-1] = inved(fact[-1])\nfor i in range(maxf, 0, -1):\n invf[i - 1] = (invf[i] * i) % mod\nfor i in range(1, n + 2):\n S = fact[n] * invf[i - 1] * invf[n - i + 1] % mod\n if i <= n - 1:\n S += fact[n - 1] * invf[i] * invf[n - 1 - i] % mod\n S %= mod\n if i <= n - M:\n S -= fact[n - 1 - M] * invf[i - 1] * invf[n - M - i] % mod\n S %= mod\n if i <= n:\n S += fact[n - 1] * invf[i - 1] * invf[n - i] % mod\n S %= mod\n print(S)\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nD = {i: [0] for i in range(1, n + 1)}\nfor i in range(n + 1):\n D[a[i]][0] += 1\n D[a[i]].append(i)\npl, pr = 0, 0\nfor i in D:\n if D[i][0] == 2:\n pl = D[i][1]\n pr = D[i][2]\n break\nL = pl\nM = pr - pl - 1\nN = n - pr\nmod = int(1e9) + 7 # <-- input modulo\nmaxf = n + 11 # <-- input factional limitation\n\n\ndef make_fact(n, k):\n tmp = n\n perm = [i for i in range(k)]\n L = [0 for _ in range(k)]\n for i in range(k):\n L[i] = tmp % (i + 1)\n tmp //= i + 1\n LL = [0 for _ in range(k)]\n for i in range(k):\n LL[i] = perm[L[-i - 1]]\n for j in range(L[-i - 1] + 1, k):\n perm[j - 1] = perm[j]\n return LL\n\n\ndef doubling(n, m, modulo=mod):\n y = 1\n base = n\n tmp = m\n while tmp != 0:\n if tmp % 2 == 1:\n y *= base\n if modulo > 0:\n y %= modulo\n base *= base\n if modulo > 0:\n base %= modulo\n tmp //= 2\n return y\n\n\ndef inved(a, modulo=mod):\n x, y, u, v, k, l = 1, 0, 0, 1, a, modulo\n while l != 0:\n x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)\n k, l = l, k % l\n return x % modulo\n\n\nfact = [1 for _ in range(maxf + 1)]\ninvf = [1 for _ in range(maxf + 1)]\nfor i in range(maxf):\n fact[i + 1] = (fact[i] * (i + 1)) % mod\ninvf[-1] = inved(fact[-1])\nfor i in range(maxf, 0, -1):\n invf[i - 1] = (invf[i] * i) % mod\nfor i in range(1, n + 2):\n S = fact[n + 1] * invf[i] * invf[n - i + 1] % mod\n if i <= n - M:\n S -= fact[n - 1 - M] * invf[i - 1] * invf[n - M - i] % mod\n S %= mod\n print(S)\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- S = fact[n] * invf[i - 1] * invf[n - i + 1] % mod", "- if i <= n - 1:", "- S += fact[n - 1] * invf[i] * invf[n - 1 - i] % mod", "- S %= mod", "+ S = fact[n + 1] * invf[i] * invf[n - i + 1] % mod", "- if i <= n:", "- S += fact[n - 1] * invf[i - 1] * invf[n - i] % mod", "- S %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3162681131, "measured_runtime_v1": 0.0655883436, "runtime_lift": 4.8220170785, "key": ["s545310428", "s792744532"], "target_token_count_dream": 628, "target_token_bucket_dream": "512-1024"} +{"user_id": "u671060652", "problem_id": "p02952", "language": "python", "submission_id_v0": "s923935687", "submission_id_v1": "s007434774", "cpu_time_v0": 222, "cpu_time_v1": 60, "memory_v0": 40940, "memory_v1": 61860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.97, "input": "n = int(input())\n\n\n\n\n\ndef countKeta(num):\n\n count = 1\n\n while num / 10 >= 1:\n\n count += 1\n\n num = num // 10\n\n return count\n\n\n\n\n\ncount = 0\n\n\n\nfor i in range(1, n+1):\n\n if(countKeta(i) % 2 == 1):\n\n count += 1\n\n\n\nprint(count)", "target": "n = int(input())\n\n\n\nif n < 10:\n\n print(n)\n\nelif n < 100:\n\n print((9))\n\nelif n < 1000:\n\n print((n-90))\n\nelif n < 10000:\n\n print((909))\n\nelif n < 100000:\n\n print((n-9090))\n\nelif n < 1000000:\n\n print((90909))", "code_v0_loc": 18, "code_v1_loc": 14, "code_v0_num_chars": 255, "code_v1_num_chars": 213, "code_v0_no_empty_lines": "n = int(input())\n\n\ndef countKeta(num):\n count = 1\n while num / 10 >= 1:\n count += 1\n num = num // 10\n return count\n\n\ncount = 0\nfor i in range(1, n + 1):\n if countKeta(i) % 2 == 1:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "n = int(input())\nif n < 10:\n print(n)\nelif n < 100:\n print((9))\nelif n < 1000:\n print((n - 90))\nelif n < 10000:\n print((909))\nelif n < 100000:\n print((n - 9090))\nelif n < 1000000:\n print((90909))\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-", "-", "-def countKeta(num):", "- count = 1", "- while num / 10 >= 1:", "- count += 1", "- num = num // 10", "- return count", "-", "-", "-count = 0", "-for i in range(1, n + 1):", "- if countKeta(i) % 2 == 1:", "- count += 1", "-print(count)", "+if n < 10:", "+ print(n)", "+elif n < 100:", "+ print((9))", "+elif n < 1000:", "+ print((n - 90))", "+elif n < 10000:", "+ print((909))", "+elif n < 100000:", "+ print((n - 9090))", "+elif n < 1000000:", "+ print((90909))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2693535981, "measured_runtime_v1": 0.1929554205, "runtime_lift": 1.3959369341, "key": ["s923935687", "s007434774"], "target_token_count_dream": 106, "target_token_bucket_dream": "<128"} +{"user_id": "u837286475", "problem_id": "p02996", "language": "python", "submission_id_v0": "s244057022", "submission_id_v1": "s796254109", "cpu_time_v0": 1201, "cpu_time_v1": 941, "memory_v0": 53532, "memory_v1": 53600, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.65, "input": "\n\n\n\nn = int(input())\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\nabn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))", "target": "\n\nn = int(input())\n\n\n\nabn = [list(map(int,input().split())) for _ in range(n)]\n\n\n\n\n\n#abn.sort()\n\nabn.sort(key = lambda x:x[1])\n\n\n\n\n\n#print(abn)\n\n\n\nts = 0 # time_stamp\n\nenable = True\n\nfor abi in abn:\n\n a, b = abi\n\n\n\n if not ts + a <= b:\n\n enable = False\n\n break\n\n else:\n\n ts += a\n\n\n\nprint(('Yes' if enable else 'No'))", "code_v0_loc": 25, "code_v1_loc": 24, "code_v0_num_chars": 345, "code_v1_num_chars": 344, "code_v0_no_empty_lines": "n = int(input())\nabn = [list(map(int, input().split())) for _ in range(n)]\nabn.sort()\nabn.sort(key=lambda x: x[1])\n# print(abn)\nts = 0 # time_stamp\nenable = True\nfor abi in abn:\n a, b = abi\n if not ts + a <= b:\n enable = False\n break\n else:\n ts += a\nprint((\"Yes\" if enable else \"No\"))\n", "code_v1_no_empty_lines": "n = int(input())\nabn = [list(map(int, input().split())) for _ in range(n)]\n# abn.sort()\nabn.sort(key=lambda x: x[1])\n# print(abn)\nts = 0 # time_stamp\nenable = True\nfor abi in abn:\n a, b = abi\n if not ts + a <= b:\n enable = False\n break\n else:\n ts += a\nprint((\"Yes\" if enable else \"No\"))\n", "code_same": false, "relative_loc_diff_percent": 4.0, "diff": ["-abn.sort()", "+# abn.sort()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.205832685, "measured_runtime_v1": 0.0061624551, "runtime_lift": 33.4010847824, "key": ["s244057022", "s796254109"], "target_token_count_dream": 105, "target_token_bucket_dream": "<128"} +{"user_id": "u546285759", "problem_id": "p00053", "language": "python", "submission_id_v0": "s431311473", "submission_id_v1": "s975765781", "cpu_time_v0": 360, "cpu_time_v1": 100, "memory_v0": 8104, "memory_v1": 9480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.22, "input": "def isPrime(x):\n\n if x == 2:\n\n return True\n\n if x < 2 or x % 2 == 0:\n\n return False\n\n i, root_x = 3, int(pow(x, 0.5))\n\n while i <= root_x:\n\n if x % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nprimes = [2]\n\nfor i in range(3, 104730):\n\n if isPrime(i):\n\n primes.append(primes[-1]+i)\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n print((primes[n-1]))", "target": "primes = [0, 0] + [1] * 150000\n\nfor i in range(2, 388):\n\n if primes[i]:\n\n for j in range(i*i, 150001, i):\n\n primes[j] = 0\n\n\n\nvalues = [i for i, v in enumerate(primes) if v]\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n print((sum(values[:n])))", "code_v0_loc": 21, "code_v1_loc": 12, "code_v0_num_chars": 438, "code_v1_num_chars": 287, "code_v0_no_empty_lines": "def isPrime(x):\n if x == 2:\n return True\n if x < 2 or x % 2 == 0:\n return False\n i, root_x = 3, int(pow(x, 0.5))\n while i <= root_x:\n if x % i == 0:\n return False\n i += 2\n return True\n\n\nprimes = [2]\nfor i in range(3, 104730):\n if isPrime(i):\n primes.append(primes[-1] + i)\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((primes[n - 1]))\n", "code_v1_no_empty_lines": "primes = [0, 0] + [1] * 150000\nfor i in range(2, 388):\n if primes[i]:\n for j in range(i * i, 150001, i):\n primes[j] = 0\nvalues = [i for i, v in enumerate(primes) if v]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(values[:n])))\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-def isPrime(x):", "- if x == 2:", "- return True", "- if x < 2 or x % 2 == 0:", "- return False", "- i, root_x = 3, int(pow(x, 0.5))", "- while i <= root_x:", "- if x % i == 0:", "- return False", "- i += 2", "- return True", "-", "-", "-primes = [2]", "-for i in range(3, 104730):", "- if isPrime(i):", "- primes.append(primes[-1] + i)", "+primes = [0, 0] + [1] * 150000", "+for i in range(2, 388):", "+ if primes[i]:", "+ for j in range(i * i, 150001, i):", "+ primes[j] = 0", "+values = [i for i, v in enumerate(primes) if v]", "- print((primes[n - 1]))", "+ print((sum(values[:n])))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.4180367088, "measured_runtime_v1": 0.5017841969, "runtime_lift": 2.8259891756, "key": ["s431311473", "s975765781"], "target_token_count_dream": 108, "target_token_bucket_dream": "<128"} +{"user_id": "u714300041", "problem_id": "p03835", "language": "python", "submission_id_v0": "s859897716", "submission_id_v1": "s908338086", "cpu_time_v0": 324, "cpu_time_v1": 265, "memory_v0": 40684, "memory_v1": 40684, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.21, "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if x >= 0 and x <= K:\n\n ans += 1\n\nprint(ans)", "target": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nK, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor z in range(K+1):\n\n for y in range(K+1):\n\n x = S - (z + y)\n\n if 0 <= x <= K:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 255, "code_v1_num_chars": 249, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nK, S = list(map(int, input().split()))\nans = 0\nfor z in range(K + 1):\n for y in range(K + 1):\n x = S - (z + y)\n if x >= 0 and x <= K:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nK, S = list(map(int, input().split()))\nans = 0\nfor z in range(K + 1):\n for y in range(K + 1):\n x = S - (z + y)\n if 0 <= x <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if x >= 0 and x <= K:", "+ if 0 <= x <= K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.450106571, "measured_runtime_v1": 0.2041984936, "runtime_lift": 2.2042599977, "key": ["s859897716", "s908338086"], "target_token_count_dream": 84, "target_token_bucket_dream": "<128"} +{"user_id": "u994988729", "problem_id": "p02996", "language": "python", "submission_id_v0": "s348750359", "submission_id_v1": "s832149929", "cpu_time_v0": 885, "cpu_time_v1": 774, "memory_v0": 30828, "memory_v1": 41916, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.54, "input": "n=int(input())\n\ntask=[] \n\nfor _ in range(n):\n\n a,b=list(map(int,input().split()))\n\n task.append((b, -a))\n\n\n\ntask.sort()\n\n\n\ntime=0\n\nflag=True\n\nfor i in task:\n\n time-=i[1]\n\n if time>i[0]:\n\n flag=False\n\n break\n\n\n\nif flag:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n\n", "target": "import sys\n\nfrom collections import defaultdict\n\nfrom operator import itemgetter\n\ninput = sys.stdin.readline\n\n\n\nN = int(input())\n\nd = defaultdict(int)\n\nfor _ in range(N):\n\n a, b = list(map(int, input().split()))\n\n d[b] += a\n\ntask = list(d.items())\n\ntask.sort()\n\n\n\nnow = 0\n\nans = \"Yes\"\n\nfor limit, time in task:\n\n now += time\n\n if now > limit:\n\n ans = \"No\"\n\n break\n\n\n\nprint(ans)\n", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 283, "code_v1_num_chars": 398, "code_v0_no_empty_lines": "n = int(input())\ntask = []\nfor _ in range(n):\n a, b = list(map(int, input().split()))\n task.append((b, -a))\ntask.sort()\ntime = 0\nflag = True\nfor i in task:\n time -= i[1]\n if time > i[0]:\n flag = False\n break\nif flag:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "import sys\nfrom collections import defaultdict\nfrom operator import itemgetter\n\ninput = sys.stdin.readline\nN = int(input())\nd = defaultdict(int)\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n d[b] += a\ntask = list(d.items())\ntask.sort()\nnow = 0\nans = \"Yes\"\nfor limit, time in task:\n now += time\n if now > limit:\n ans = \"No\"\n break\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-n = int(input())", "-task = []", "-for _ in range(n):", "+import sys", "+from collections import defaultdict", "+from operator import itemgetter", "+", "+input = sys.stdin.readline", "+N = int(input())", "+d = defaultdict(int)", "+for _ in range(N):", "- task.append((b, -a))", "+ d[b] += a", "+task = list(d.items())", "-time = 0", "-flag = True", "-for i in task:", "- time -= i[1]", "- if time > i[0]:", "- flag = False", "+now = 0", "+ans = \"Yes\"", "+for limit, time in task:", "+ now += time", "+ if now > limit:", "+ ans = \"No\"", "-if flag:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3182171457, "measured_runtime_v1": 0.1977030051, "runtime_lift": 1.6095716175, "key": ["s348750359", "s832149929"], "target_token_count_dream": 105, "target_token_bucket_dream": "<128"} +{"user_id": "u645250356", "problem_id": "p03038", "language": "python", "submission_id_v0": "s890208193", "submission_id_v1": "s797826633", "cpu_time_v0": 490, "cpu_time_v1": 431, "memory_v0": 71452, "memory_v1": 34916, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.04, "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heapify,heappop,heappush\n\nfrom bisect import bisect_left,bisect_right\n\nimport sys,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn,m = inpl()\n\na = inpl()\n\nb = [0] * m\n\nfor i in range(m):\n\n x,y = inpl()\n\n b[i] = [x,y]\n\na.sort()\n\nb.sort(key=lambda x:x[1], reverse = True)\n\nres = sum(a)\n\ni = 0\n\nj = 0\n\nwhile True:\n\n # print(i,j)\n\n if a[i] < b[j][1]:\n\n res += b[j][1] - a[i]\n\n i += 1\n\n else:\n\n break\n\n b[j][0] -= 1\n\n if b[j][0] == 0:\n\n j += 1\n\n if i >= n or j >= m:\n\n break\n\nprint(res)\n", "target": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nfrom bisect import bisect_left,bisect_right \n\nimport sys,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn,m = inpl()\n\na = inpl()\n\na.sort()\n\nbc = [inpl() for _ in range(m)]\n\nbc.sort(key = lambda x:x[1], reverse = True)\n\nlm = sum(x[1] for x in bc)\n\nnow = 0\n\nalt = 0\n\nwhile now < n and alt < m:\n\n c,b = bc[alt]\n\n if a[now] > b:\n\n break\n\n else:\n\n a[now] = b\n\n bc[alt][0] -= 1\n\n if bc[alt][0] == 0:\n\n alt += 1\n\n now += 1\n\nprint((sum(a)))\n", "code_v0_loc": 35, "code_v1_loc": 29, "code_v0_num_chars": 880, "code_v1_num_chars": 728, "code_v0_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heapify, heappop, heappush\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, string, queue\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef inpl_str():\n return list(sys.stdin.readline().split())\n\n\ndef inpln(n):\n return list(int(sys.stdin.readline()) for i in range(n))\n\n\nn, m = inpl()\na = inpl()\nb = [0] * m\nfor i in range(m):\n x, y = inpl()\n b[i] = [x, y]\na.sort()\nb.sort(key=lambda x: x[1], reverse=True)\nres = sum(a)\ni = 0\nj = 0\nwhile True:\n # print(i,j)\n if a[i] < b[j][1]:\n res += b[j][1] - a[i]\n i += 1\n else:\n break\n b[j][0] -= 1\n if b[j][0] == 0:\n j += 1\n if i >= n or j >= m:\n break\nprint(res)\n", "code_v1_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, math, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn, m = inpl()\na = inpl()\na.sort()\nbc = [inpl() for _ in range(m)]\nbc.sort(key=lambda x: x[1], reverse=True)\nlm = sum(x[1] for x in bc)\nnow = 0\nalt = 0\nwhile now < n and alt < m:\n c, b = bc[alt]\n if a[now] > b:\n break\n else:\n a[now] = b\n bc[alt][0] -= 1\n if bc[alt][0] == 0:\n alt += 1\n now += 1\nprint((sum(a)))\n", "code_same": false, "relative_loc_diff_percent": 17.1428571429, "diff": ["-from heapq import heapify, heappop, heappush", "+from heapq import heappop, heappush, heapify", "-import sys, math, itertools, string, queue", "+import sys, math, itertools, math, pprint", "+INF = float(\"inf\")", "-def inpl_str():", "- return list(sys.stdin.readline().split())", "-", "-", "-def inpln(n):", "- return list(int(sys.stdin.readline()) for i in range(n))", "-", "-", "-b = [0] * m", "-for i in range(m):", "- x, y = inpl()", "- b[i] = [x, y]", "-b.sort(key=lambda x: x[1], reverse=True)", "-res = sum(a)", "-i = 0", "-j = 0", "-while True:", "- # print(i,j)", "- if a[i] < b[j][1]:", "- res += b[j][1] - a[i]", "- i += 1", "+bc = [inpl() for _ in range(m)]", "+bc.sort(key=lambda x: x[1], reverse=True)", "+lm = sum(x[1] for x in bc)", "+now = 0", "+alt = 0", "+while now < n and alt < m:", "+ c, b = bc[alt]", "+ if a[now] > b:", "+ break", "- break", "- b[j][0] -= 1", "- if b[j][0] == 0:", "- j += 1", "- if i >= n or j >= m:", "- break", "-print(res)", "+ a[now] = b", "+ bc[alt][0] -= 1", "+ if bc[alt][0] == 0:", "+ alt += 1", "+ now += 1", "+print((sum(a)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.310756367, "measured_runtime_v1": 0.2053928638, "runtime_lift": 1.5129852191, "key": ["s890208193", "s797826633"], "target_token_count_dream": 239, "target_token_bucket_dream": "128-256"} +{"user_id": "u287132915", "problem_id": "p02891", "language": "python", "submission_id_v0": "s480399361", "submission_id_v1": "s640908939", "cpu_time_v0": 182, "cpu_time_v1": 72, "memory_v0": 38256, "memory_v1": 61768, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.44, "input": "s = input()\n\nk = int(input())\n\n\n\nif len(set(s)) == 1:\n\n print(((len(s)*k)//2))\n\n exit()\n\n\n\nss = s + s\n\n\n\nshoko = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(s)):\n\n if s[i] == prev:\n\n cnt += 1\n\n else:\n\n shoko += cnt // 2\n\n cnt = 1\n\n prev = s[i]\n\nshoko += cnt // 2\n\n\n\nkosa = 0\n\nprev = ''\n\ncnt = 0\n\nfor i in range(len(ss)):\n\n if ss[i] == prev:\n\n cnt += 1\n\n else:\n\n kosa += cnt // 2\n\n cnt = 1\n\n prev = ss[i]\n\nkosa += cnt // 2\n\nkosa -= shoko\n\n\n\nprint((shoko + (k-1)*kosa))", "target": "s = input()\n\nk = int(input())\n\nn = len(s)\n\n\n\nif len(set(s)) == 1:\n\n print((n*k//2))\n\n exit()\n\n\n\nss = s + s\n\ncnts = 0\n\nnow = s[0]\n\ntemp = 1\n\nfor i in range(1, n):\n\n if s[i] == now:\n\n temp += 1\n\n else:\n\n cnts += temp // 2\n\n temp = 1\n\n now = s[i]\n\ncnts += temp // 2\n\n\n\ncntss = 0\n\nnow = ss[0]\n\ntemp = 1\n\nfor i in range(1, 2*n):\n\n if ss[i] == now:\n\n temp += 1\n\n else:\n\n cntss += temp // 2\n\n temp = 1\n\n now = ss[i]\n\ncntss += temp // 2\n\n\n\nkousa = cntss - cnts\n\nprint((cnts + kousa*(k-1)))", "code_v0_loc": 35, "code_v1_loc": 35, "code_v0_num_chars": 527, "code_v1_num_chars": 551, "code_v0_no_empty_lines": "s = input()\nk = int(input())\nif len(set(s)) == 1:\n print(((len(s) * k) // 2))\n exit()\nss = s + s\nshoko = 0\nprev = \"\"\ncnt = 0\nfor i in range(len(s)):\n if s[i] == prev:\n cnt += 1\n else:\n shoko += cnt // 2\n cnt = 1\n prev = s[i]\nshoko += cnt // 2\nkosa = 0\nprev = \"\"\ncnt = 0\nfor i in range(len(ss)):\n if ss[i] == prev:\n cnt += 1\n else:\n kosa += cnt // 2\n cnt = 1\n prev = ss[i]\nkosa += cnt // 2\nkosa -= shoko\nprint((shoko + (k - 1) * kosa))\n", "code_v1_no_empty_lines": "s = input()\nk = int(input())\nn = len(s)\nif len(set(s)) == 1:\n print((n * k // 2))\n exit()\nss = s + s\ncnts = 0\nnow = s[0]\ntemp = 1\nfor i in range(1, n):\n if s[i] == now:\n temp += 1\n else:\n cnts += temp // 2\n temp = 1\n now = s[i]\ncnts += temp // 2\ncntss = 0\nnow = ss[0]\ntemp = 1\nfor i in range(1, 2 * n):\n if ss[i] == now:\n temp += 1\n else:\n cntss += temp // 2\n temp = 1\n now = ss[i]\ncntss += temp // 2\nkousa = cntss - cnts\nprint((cnts + kousa * (k - 1)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+n = len(s)", "- print(((len(s) * k) // 2))", "+ print((n * k // 2))", "-shoko = 0", "-prev = \"\"", "-cnt = 0", "-for i in range(len(s)):", "- if s[i] == prev:", "- cnt += 1", "+cnts = 0", "+now = s[0]", "+temp = 1", "+for i in range(1, n):", "+ if s[i] == now:", "+ temp += 1", "- shoko += cnt // 2", "- cnt = 1", "- prev = s[i]", "-shoko += cnt // 2", "-kosa = 0", "-prev = \"\"", "-cnt = 0", "-for i in range(len(ss)):", "- if ss[i] == prev:", "- cnt += 1", "+ cnts += temp // 2", "+ temp = 1", "+ now = s[i]", "+cnts += temp // 2", "+cntss = 0", "+now = ss[0]", "+temp = 1", "+for i in range(1, 2 * n):", "+ if ss[i] == now:", "+ temp += 1", "- kosa += cnt // 2", "- cnt = 1", "- prev = ss[i]", "-kosa += cnt // 2", "-kosa -= shoko", "-print((shoko + (k - 1) * kosa))", "+ cntss += temp // 2", "+ temp = 1", "+ now = ss[i]", "+cntss += temp // 2", "+kousa = cntss - cnts", "+print((cnts + kousa * (k - 1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2980948234, "measured_runtime_v1": 0.2282131991, "runtime_lift": 1.3062120179, "key": ["s480399361", "s640908939"], "target_token_count_dream": 209, "target_token_bucket_dream": "128-256"} +{"user_id": "u367130284", "problem_id": "p03081", "language": "python", "submission_id_v0": "s141729674", "submission_id_v1": "s328617225", "cpu_time_v0": 599, "cpu_time_v1": 524, "memory_v0": 40892, "memory_v1": 40892, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.52, "input": "n,q=list(map(int,input().split()));s=\"_\"+input()+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:L=h==\"L\";R=h==\"R\";l,r=[l,l-1,l+1][(m==s[l]and R)-(m==s[l+1]and L)],[r,r-1,r+1][(m==s[r-1]and R)-(m==s[r]and L)]\n\nprint((max(0,r-l-1)))", "target": "n,q=list(map(int,input().split()));s=\"_\"+input()+\"_\";l,r=0,n+1\n\nfor(m,h)in[input().split()for i in range(q)][::-1]:\n\n L=h==\"L\";R=h==\"R\";\n\n l+=(m==s[l+1]and L)-(m==s[l]and R)\n\n r+=(m==s[r]and L)-(m==s[r-1]and R)\n\nprint((max(0,r-l-1)))", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 241, "code_v1_num_chars": 234, "code_v0_no_empty_lines": "n, q = list(map(int, input().split()))\ns = \"_\" + input() + \"_\"\nl, r = 0, n + 1\nfor (m, h) in [input().split() for i in range(q)][::-1]:\n L = h == \"L\"\n R = h == \"R\"\n l, r = [l, l - 1, l + 1][(m == s[l] and R) - (m == s[l + 1] and L)], [\n r,\n r - 1,\n r + 1,\n ][(m == s[r - 1] and R) - (m == s[r] and L)]\nprint((max(0, r - l - 1)))\n", "code_v1_no_empty_lines": "n, q = list(map(int, input().split()))\ns = \"_\" + input() + \"_\"\nl, r = 0, n + 1\nfor (m, h) in [input().split() for i in range(q)][::-1]:\n L = h == \"L\"\n R = h == \"R\"\n l += (m == s[l + 1] and L) - (m == s[l] and R)\n r += (m == s[r] and L) - (m == s[r - 1] and R)\nprint((max(0, r - l - 1)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["- l, r = [l, l - 1, l + 1][(m == s[l] and R) - (m == s[l + 1] and L)], [", "- r,", "- r - 1,", "- r + 1,", "- ][(m == s[r - 1] and R) - (m == s[r] and L)]", "+ l += (m == s[l + 1] and L) - (m == s[l] and R)", "+ r += (m == s[r] and L) - (m == s[r - 1] and R)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2496840062, "measured_runtime_v1": 0.1505171778, "runtime_lift": 1.6588406042, "key": ["s141729674", "s328617225"], "target_token_count_dream": 105, "target_token_bucket_dream": "<128"} +{"user_id": "u134019875", "problem_id": "p03796", "language": "python", "submission_id_v0": "s983655328", "submission_id_v1": "s754374761", "cpu_time_v0": 231, "cpu_time_v1": 36, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.42, "input": "import math\n\n\n\nn = int(input())\n\nprint((math.factorial(n) % (10 ** 9 + 7)))", "target": "n = int(input())\n\np = 1\n\nfor i in range(1, n + 1):\n\n p = p * i % (10 ** 9 + 7)\n\nprint(p)", "code_v0_loc": 4, "code_v1_loc": 5, "code_v0_num_chars": 73, "code_v1_num_chars": 89, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\np = 1\nfor i in range(1, n + 1):\n p = p * i % (10**9 + 7)\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+p = 1", "+for i in range(1, n + 1):", "+ p = p * i % (10**9 + 7)", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1349290106, "measured_runtime_v1": 0.0997186968, "runtime_lift": 1.3530964092, "key": ["s983655328", "s754374761"], "target_token_count_dream": 42, "target_token_bucket_dream": "<128"} +{"user_id": "u597374218", "problem_id": "p03035", "language": "python", "submission_id_v0": "s085289040", "submission_id_v1": "s328762084", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "a,b=list(map(int,input().split()))\n\nprint((b if 13<=a else b//2 if 6<=a else 0))", "target": "a,b=list(map(int,input().split()))\n\nprint((b if 12=b[i]):\n\n cnt+=b[i]\n\n else:\n\n cnt+=a[i]\n\n d=b[i]-a[i]\n\n cnt+=min(a[i+1],d)\n\n if(d>a[i+1]):\n\n a[i+1]=0\n\n else: a[i+1]-=d\n\n \n\n stdout.write(str(cnt)+\"\\n\")\n", "target": "n = int(input())\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\na1 = sum(A)\n\nfor i in range(n):\n\n b = B[i]\n\n if A[i] >= b:A[i] -= b\n\n else:\n\n if A[i+1]+A[i] >= b:\n\n A[i+1] = A[i+1]+A[i]-b\n\n A[i] = 0\n\n else:A[i], A[i+1] = 0, 0\n\na2 = sum(A)\n\nprint((a1-a2))", "code_v0_loc": 22, "code_v1_loc": 14, "code_v0_num_chars": 499, "code_v1_num_chars": 299, "code_v0_no_empty_lines": "from sys import stdin, stdout\n\nif __name__ == \"__main__\":\n n = int(stdin.readline())\n a = [int(x) for x in stdin.readline().split()]\n b = [int(x) for x in stdin.readline().split()]\n cnt = 0\n for i in range(n):\n if a[i] >= b[i]:\n cnt += b[i]\n else:\n cnt += a[i]\n d = b[i] - a[i]\n cnt += min(a[i + 1], d)\n if d > a[i + 1]:\n a[i + 1] = 0\n else:\n a[i + 1] -= d\n stdout.write(str(cnt) + \"\\n\")\n", "code_v1_no_empty_lines": "n = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\na1 = sum(A)\nfor i in range(n):\n b = B[i]\n if A[i] >= b:\n A[i] -= b\n else:\n if A[i + 1] + A[i] >= b:\n A[i + 1] = A[i + 1] + A[i] - b\n A[i] = 0\n else:\n A[i], A[i + 1] = 0, 0\na2 = sum(A)\nprint((a1 - a2))\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-from sys import stdin, stdout", "-", "-if __name__ == \"__main__\":", "- n = int(stdin.readline())", "- a = [int(x) for x in stdin.readline().split()]", "- b = [int(x) for x in stdin.readline().split()]", "- cnt = 0", "- for i in range(n):", "- if a[i] >= b[i]:", "- cnt += b[i]", "+n = int(input())", "+A = list(map(int, input().split()))", "+B = list(map(int, input().split()))", "+a1 = sum(A)", "+for i in range(n):", "+ b = B[i]", "+ if A[i] >= b:", "+ A[i] -= b", "+ else:", "+ if A[i + 1] + A[i] >= b:", "+ A[i + 1] = A[i + 1] + A[i] - b", "+ A[i] = 0", "- cnt += a[i]", "- d = b[i] - a[i]", "- cnt += min(a[i + 1], d)", "- if d > a[i + 1]:", "- a[i + 1] = 0", "- else:", "- a[i + 1] -= d", "- stdout.write(str(cnt) + \"\\n\")", "+ A[i], A[i + 1] = 0, 0", "+a2 = sum(A)", "+print((a1 - a2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2530250838, "measured_runtime_v1": 0.0949857178, "runtime_lift": 2.6638224113, "key": ["s078643579", "s464947070"], "target_token_count_dream": 127, "target_token_bucket_dream": "<128"} +{"user_id": "u127499732", "problem_id": "p03608", "language": "python", "submission_id_v0": "s266235653", "submission_id_v1": "s503227515", "cpu_time_v0": 246, "cpu_time_v1": 190, "memory_v0": 83588, "memory_v1": 83656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.76, "input": "def main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = float(\"Inf\")\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n from itertools import permutations\n\n\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n\n to = x[:r]\n\n\n\n dis = [[10 ** 8] * (n + 1) for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n dis[i][i] = 0\n\n\n\n for a, b, c in zip(*[iter(x[r:])] * 3):\n\n dis[a][b] = c\n\n dis[b][a] = c\n\n\n\n for k in range(1, n + 1):\n\n for i in range(1, n + 1):\n\n for j in range(1, n + 1):\n\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n\n\n\n ans = 10 ** 8\n\n for p in permutations(to):\n\n tmp = 0\n\n nw = p[0]\n\n for nx in p[1:]:\n\n tmp += dis[nw][nx]\n\n nw = nx\n\n\n\n ans = min(ans, tmp)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 34, "code_v1_loc": 34, "code_v0_num_chars": 771, "code_v1_num_chars": 761, "code_v0_no_empty_lines": "def main():\n from itertools import permutations\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n to = x[:r]\n dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]\n for i in range(1, n + 1):\n dis[i][i] = 0\n for a, b, c in zip(*[iter(x[r:])] * 3):\n dis[a][b] = c\n dis[b][a] = c\n for k in range(1, n + 1):\n for i in range(1, n + 1):\n for j in range(1, n + 1):\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n ans = float(\"Inf\")\n for p in permutations(to):\n tmp = 0\n nw = p[0]\n for nx in p[1:]:\n tmp += dis[nw][nx]\n nw = nx\n ans = min(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n from itertools import permutations\n\n n, m, r, *x = list(map(int, open(0).read().split()))\n to = x[:r]\n dis = [[10**8] * (n + 1) for _ in range(n + 1)]\n for i in range(1, n + 1):\n dis[i][i] = 0\n for a, b, c in zip(*[iter(x[r:])] * 3):\n dis[a][b] = c\n dis[b][a] = c\n for k in range(1, n + 1):\n for i in range(1, n + 1):\n for j in range(1, n + 1):\n dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])\n ans = 10**8\n for p in permutations(to):\n tmp = 0\n nw = p[0]\n for nx in p[1:]:\n tmp += dis[nw][nx]\n nw = nx\n ans = min(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- dis = [[float(\"Inf\")] * (n + 1) for _ in range(n + 1)]", "+ dis = [[10**8] * (n + 1) for _ in range(n + 1)]", "- ans = float(\"Inf\")", "+ ans = 10**8"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3828251469, "measured_runtime_v1": 0.1865792952, "runtime_lift": 2.0518093745, "key": ["s266235653", "s503227515"], "target_token_count_dream": 266, "target_token_bucket_dream": "256-512"} +{"user_id": "u732159958", "problem_id": "p03416", "language": "python", "submission_id_v0": "s130057185", "submission_id_v1": "s637640023", "cpu_time_v0": 68, "cpu_time_v1": 50, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.47, "input": "counter = 0\n\nc = list(map(int, input().split(' ')))\n\nfor i in range(c[0], c[1] + 1):\n\n if str(i)[0] != str(i)[4]:\n\n continue\n\n if str(i)[1] != str(i)[3]:\n\n continue\n\n counter += 1\n\n\n\nprint(counter)", "target": "a = list(map(int, input().split()))\n\ncounter = 0\n\nfor i in range(a[0], a[1] + 1):\n\n stri = str(i)\n\n if (stri[0] == stri[4] and stri[1] == stri[3]):\n\n counter += 1\n\n \n\nprint(counter)", "code_v0_loc": 10, "code_v1_loc": 8, "code_v0_num_chars": 206, "code_v1_num_chars": 189, "code_v0_no_empty_lines": "counter = 0\nc = list(map(int, input().split(\" \")))\nfor i in range(c[0], c[1] + 1):\n if str(i)[0] != str(i)[4]:\n continue\n if str(i)[1] != str(i)[3]:\n continue\n counter += 1\nprint(counter)\n", "code_v1_no_empty_lines": "a = list(map(int, input().split()))\ncounter = 0\nfor i in range(a[0], a[1] + 1):\n stri = str(i)\n if stri[0] == stri[4] and stri[1] == stri[3]:\n counter += 1\nprint(counter)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["+a = list(map(int, input().split()))", "-c = list(map(int, input().split(\" \")))", "-for i in range(c[0], c[1] + 1):", "- if str(i)[0] != str(i)[4]:", "- continue", "- if str(i)[1] != str(i)[3]:", "- continue", "- counter += 1", "+for i in range(a[0], a[1] + 1):", "+ stri = str(i)", "+ if stri[0] == stri[4] and stri[1] == stri[3]:", "+ counter += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.442622024, "measured_runtime_v1": 0.3161446974, "runtime_lift": 1.4000615148, "key": ["s130057185", "s637640023"], "target_token_count_dream": 70, "target_token_bucket_dream": "<128"} +{"user_id": "u089230684", "problem_id": "p03038", "language": "python", "submission_id_v0": "s817533229", "submission_id_v1": "s906455398", "cpu_time_v0": 826, "cpu_time_v1": 662, "memory_v0": 82456, "memory_v1": 25196, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.85, "input": "I=lambda:list(map(int,input().split()))\n\nn,m=I()\n\na=I()\n\na.sort(reverse=True)\n\nqq=[I() for i in range(m)]\n\nqq.sort(key=lambda x:x[1],reverse=True)\n\nans=0\n\nfor x,y in qq:\n\n for j in range(x):\n\n if not a:\n\n break\n\n aa=a.pop()\n\n ans+=max(aa,y)\n\nans+=sum(a)\n\nprint(ans)\n\n ", "target": "I=lambda : list(map(int,input().split()))\n\nn,m = I()\n\nl=I();s=sum(l);l.sort();d=[]\n\nfor _ in range(m):\n\n b,c=I()\n\n d.append([c,b])\n\np=s=0 \n\nfor i in sorted(d,reverse=True):\n\n while i[1]:\n\n if p>=n or l[p]>=i[0]:\n\n break\n\n i[1]-=1\n\n s+=i[0]\n\n p+=1\n\n if p>=n:\n\n break\n\ns+=sum(l[p:])\n\nprint(s)", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 310, "code_v1_num_chars": 351, "code_v0_no_empty_lines": "I = lambda: list(map(int, input().split()))\nn, m = I()\na = I()\na.sort(reverse=True)\nqq = [I() for i in range(m)]\nqq.sort(key=lambda x: x[1], reverse=True)\nans = 0\nfor x, y in qq:\n for j in range(x):\n if not a:\n break\n aa = a.pop()\n ans += max(aa, y)\nans += sum(a)\nprint(ans)\n", "code_v1_no_empty_lines": "I = lambda: list(map(int, input().split()))\nn, m = I()\nl = I()\ns = sum(l)\nl.sort()\nd = []\nfor _ in range(m):\n b, c = I()\n d.append([c, b])\np = s = 0\nfor i in sorted(d, reverse=True):\n while i[1]:\n if p >= n or l[p] >= i[0]:\n break\n i[1] -= 1\n s += i[0]\n p += 1\n if p >= n:\n break\ns += sum(l[p:])\nprint(s)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-a = I()", "-a.sort(reverse=True)", "-qq = [I() for i in range(m)]", "-qq.sort(key=lambda x: x[1], reverse=True)", "-ans = 0", "-for x, y in qq:", "- for j in range(x):", "- if not a:", "+l = I()", "+s = sum(l)", "+l.sort()", "+d = []", "+for _ in range(m):", "+ b, c = I()", "+ d.append([c, b])", "+p = s = 0", "+for i in sorted(d, reverse=True):", "+ while i[1]:", "+ if p >= n or l[p] >= i[0]:", "- aa = a.pop()", "- ans += max(aa, y)", "-ans += sum(a)", "-print(ans)", "+ i[1] -= 1", "+ s += i[0]", "+ p += 1", "+ if p >= n:", "+ break", "+s += sum(l[p:])", "+print(s)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3493785617, "measured_runtime_v1": 0.2761461248, "runtime_lift": 1.2651945122, "key": ["s817533229", "s906455398"], "target_token_count_dream": 123, "target_token_bucket_dream": "<128"} +{"user_id": "u062691227", "problem_id": "p03723", "language": "python", "submission_id_v0": "s522426109", "submission_id_v1": "s794063832", "cpu_time_v0": 61, "cpu_time_v1": 29, "memory_v0": 61360, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.46, "input": "a,b,c=list(map(int,input().split()))\n\ne=(a-b)|(b-c)\n\nprint((bool(e|(a|b|c)%2)*(e^~-e).bit_length()-1))", "target": "a,b,c=list(map(int,input().split()))\n\ne=(a-b)|(b-c)\n\nprint((bool(e|b%2)*(e^~-e).bit_length()-1))", "code_v0_loc": 3, "code_v1_loc": 3, "code_v0_num_chars": 94, "code_v1_num_chars": 88, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\ne = (a - b) | (b - c)\nprint((bool(e | (a | b | c) % 2) * (e ^ ~-e).bit_length() - 1))\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\ne = (a - b) | (b - c)\nprint((bool(e | b % 2) * (e ^ ~-e).bit_length() - 1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-print((bool(e | (a | b | c) % 2) * (e ^ ~-e).bit_length() - 1))", "+print((bool(e | b % 2) * (e ^ ~-e).bit_length() - 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2914967289, "measured_runtime_v1": 0.0905496902, "runtime_lift": 3.2191907898, "key": ["s522426109", "s794063832"], "target_token_count_dream": 37, "target_token_bucket_dream": "<128"} +{"user_id": "u298297089", "problem_id": "p03037", "language": "python", "submission_id_v0": "s092044899", "submission_id_v1": "s679810914", "cpu_time_v0": 352, "cpu_time_v1": 284, "memory_v0": 4760, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.32, "input": "N, M =list(map(int, input().split()))\n\nL = [0 for i in range(N+1)]\n\nR = [0 for i in range(N+1)]\n\nfor i in range(M):\n\n l,r = list(map(int, input().split()))\n\n L[l] += 1\n\n R[r] += 1\n\ncnt = 0\n\ntmp = 0\n\nfor i in range(N+1):\n\n tmp += L[i]\n\n if tmp == M:\n\n cnt += 1\n\n tmp -= R[i]\n\nprint(cnt)\n", "target": "n,m = list(map(int, input().split()))\n\nll = 1\n\nrr = n\n\nfor i in range(m):\n\n l,r = list(map(int,input().split()))\n\n if l > ll:\n\n ll = l\n\n if r < rr:\n\n rr = r\n\nprint((max(rr - ll + 1, 0)))\n", "code_v0_loc": 15, "code_v1_loc": 10, "code_v0_num_chars": 299, "code_v1_num_chars": 196, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL = [0 for i in range(N + 1)]\nR = [0 for i in range(N + 1)]\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L[l] += 1\n R[r] += 1\ncnt = 0\ntmp = 0\nfor i in range(N + 1):\n tmp += L[i]\n if tmp == M:\n cnt += 1\n tmp -= R[i]\nprint(cnt)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nll = 1\nrr = n\nfor i in range(m):\n l, r = list(map(int, input().split()))\n if l > ll:\n ll = l\n if r < rr:\n rr = r\nprint((max(rr - ll + 1, 0)))\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-N, M = list(map(int, input().split()))", "-L = [0 for i in range(N + 1)]", "-R = [0 for i in range(N + 1)]", "-for i in range(M):", "+n, m = list(map(int, input().split()))", "+ll = 1", "+rr = n", "+for i in range(m):", "- L[l] += 1", "- R[r] += 1", "-cnt = 0", "-tmp = 0", "-for i in range(N + 1):", "- tmp += L[i]", "- if tmp == M:", "- cnt += 1", "- tmp -= R[i]", "-print(cnt)", "+ if l > ll:", "+ ll = l", "+ if r < rr:", "+ rr = r", "+print((max(rr - ll + 1, 0)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2886495962, "measured_runtime_v1": 0.2151292083, "runtime_lift": 1.3417499114, "key": ["s092044899", "s679810914"], "target_token_count_dream": 72, "target_token_bucket_dream": "<128"} +{"user_id": "u075012704", "problem_id": "p03558", "language": "python", "submission_id_v0": "s239051528", "submission_id_v1": "s690298448", "cpu_time_v0": 622, "cpu_time_v1": 294, "memory_v0": 102192, "memory_v1": 35324, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.73, "input": "from collections import deque\n\nK = int(input())\n\nG = [[] for i in range(K)]\n\n\n\nfor n in range(K):\n\n G[n].append([(n + 1) % K, 1])\n\n G[n].append([(10 * n) % K, 0])\n\n\n\nque = deque([[1, 1]])\n\ndist = [float('inf')] * K\n\n\n\nwhile que:\n\n node, cost = que.pop()\n\n dist[node] = min(cost, dist[node])\n\n for e, e_cost in G[node]:\n\n if dist[e] != float('inf'):\n\n continue\n\n\n\n if e_cost == 0:\n\n que.append([e, cost + 0])\n\n\n\n if e_cost == 1:\n\n que.appendleft([e, cost + 1])\n\n\n\nprint((dist[0]))\n", "target": "from collections import deque\n\nK = int(input())\n\nG = [[] for i in range(K)]\n\nfor i in range(K):\n\n G[i].append(((10 * i) % K, 0))\n\n G[i].append(((i + 1) % K, 1))\n\n\n\ndist = [float('inf')] * K\n\ndist[1] = 1\n\nque = deque()\n\nque.append(1)\n\n\n\nwhile que:\n\n n = que.pop()\n\n for v, c in G[n]:\n\n if dist[v] > dist[n] + c:\n\n dist[v] = dist[n] + c\n\n if c == 0:\n\n que.append(v)\n\n else:\n\n que.appendleft(v)\n\n\n\nprint((dist[0]))\n", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 547, "code_v1_num_chars": 492, "code_v0_no_empty_lines": "from collections import deque\n\nK = int(input())\nG = [[] for i in range(K)]\nfor n in range(K):\n G[n].append([(n + 1) % K, 1])\n G[n].append([(10 * n) % K, 0])\nque = deque([[1, 1]])\ndist = [float(\"inf\")] * K\nwhile que:\n node, cost = que.pop()\n dist[node] = min(cost, dist[node])\n for e, e_cost in G[node]:\n if dist[e] != float(\"inf\"):\n continue\n if e_cost == 0:\n que.append([e, cost + 0])\n if e_cost == 1:\n que.appendleft([e, cost + 1])\nprint((dist[0]))\n", "code_v1_no_empty_lines": "from collections import deque\n\nK = int(input())\nG = [[] for i in range(K)]\nfor i in range(K):\n G[i].append(((10 * i) % K, 0))\n G[i].append(((i + 1) % K, 1))\ndist = [float(\"inf\")] * K\ndist[1] = 1\nque = deque()\nque.append(1)\nwhile que:\n n = que.pop()\n for v, c in G[n]:\n if dist[v] > dist[n] + c:\n dist[v] = dist[n] + c\n if c == 0:\n que.append(v)\n else:\n que.appendleft(v)\nprint((dist[0]))\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["-for n in range(K):", "- G[n].append([(n + 1) % K, 1])", "- G[n].append([(10 * n) % K, 0])", "-que = deque([[1, 1]])", "+for i in range(K):", "+ G[i].append(((10 * i) % K, 0))", "+ G[i].append(((i + 1) % K, 1))", "+dist[1] = 1", "+que = deque()", "+que.append(1)", "- node, cost = que.pop()", "- dist[node] = min(cost, dist[node])", "- for e, e_cost in G[node]:", "- if dist[e] != float(\"inf\"):", "- continue", "- if e_cost == 0:", "- que.append([e, cost + 0])", "- if e_cost == 1:", "- que.appendleft([e, cost + 1])", "+ n = que.pop()", "+ for v, c in G[n]:", "+ if dist[v] > dist[n] + c:", "+ dist[v] = dist[n] + c", "+ if c == 0:", "+ que.append(v)", "+ else:", "+ que.appendleft(v)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7363213913, "measured_runtime_v1": 0.4714232118, "runtime_lift": 1.5619116176, "key": ["s239051528", "s690298448"], "target_token_count_dream": 155, "target_token_bucket_dream": "128-256"} +{"user_id": "u305366205", "problem_id": "p03307", "language": "python", "submission_id_v0": "s023207655", "submission_id_v1": "s158622460", "cpu_time_v0": 36, "cpu_time_v1": 17, "memory_v0": 5176, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.78, "input": "import math\n\n\n\n\n\ndef lcm(x, y):\n\n return (x * y) // math.gcd(x, y)\n\n\n\n\n\nN = int(input())\n\nprint((lcm(N, 2)))", "target": "N = int(input())\n\nif N % 2 == 0:\n\n print(N)\n\nelse:\n\n print((2 * N))", "code_v0_loc": 9, "code_v1_loc": 5, "code_v0_num_chars": 119, "code_v1_num_chars": 71, "code_v0_no_empty_lines": "import math\n\n\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\n\nN = int(input())\nprint((lcm(N, 2)))\n", "code_v1_no_empty_lines": "N = int(input())\nif N % 2 == 0:\n print(N)\nelse:\n print((2 * N))\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-import math", "-", "-", "-def lcm(x, y):", "- return (x * y) // math.gcd(x, y)", "-", "-", "-print((lcm(N, 2)))", "+if N % 2 == 0:", "+ print(N)", "+else:", "+ print((2 * N))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2764545197, "measured_runtime_v1": 0.1953277736, "runtime_lift": 1.4153364608, "key": ["s023207655", "s158622460"], "target_token_count_dream": 27, "target_token_bucket_dream": "<128"} +{"user_id": "u279493135", "problem_id": "p02555", "language": "python", "submission_id_v0": "s706729835", "submission_id_v1": "s005580579", "cpu_time_v0": 319, "cpu_time_v1": 39, "memory_v0": 10348, "memory_v1": 11860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.77, "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n for i in range(x-2):\n\n ret += rec(i)\n\n ret %= mod\n\n return ret\n\n\n\nprint((rec(S)))\n", "target": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n\nfrom itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nS = INT()\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(x):\n\n if x == 0: return 1\n\n\n\n ret = 0\n\n if x >= 3:\n\n return (rec(x-1)+rec(x-3))%mod\n\n else:\n\n return 0\n\n\n\nprint((rec(S)))\n", "code_v0_loc": 32, "code_v1_loc": 32, "code_v0_num_chars": 996, "code_v1_num_chars": 996, "code_v0_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n product,\n groupby,\n combinations_with_replacement,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nS = INT()\n\n\n@lru_cache(maxsize=None)\ndef rec(x):\n if x == 0:\n return 1\n ret = 0\n for i in range(x - 2):\n ret += rec(i)\n ret %= mod\n return ret\n\n\nprint((rec(S)))\n", "code_v1_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n product,\n groupby,\n combinations_with_replacement,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nS = INT()\n\n\n@lru_cache(maxsize=None)\ndef rec(x):\n if x == 0:\n return 1\n ret = 0\n if x >= 3:\n return (rec(x - 1) + rec(x - 3)) % mod\n else:\n return 0\n\n\nprint((rec(S)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- for i in range(x - 2):", "- ret += rec(i)", "- ret %= mod", "- return ret", "+ if x >= 3:", "+ return (rec(x - 1) + rec(x - 3)) % mod", "+ else:", "+ return 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4423550682, "measured_runtime_v1": 0.2103828435, "runtime_lift": 2.1026194952, "key": ["s706729835", "s005580579"], "target_token_count_dream": 267, "target_token_bucket_dream": "256-512"} +{"user_id": "u254871849", "problem_id": "p03037", "language": "python", "submission_id_v0": "s133611442", "submission_id_v1": "s023877292", "cpu_time_v0": 105, "cpu_time_v1": 71, "memory_v0": 25076, "memory_v1": 25076, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.38, "input": "import sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nlr = list(zip(*[iter(lr)] * 2))\n\n\n\ndef main():\n\n cnt = [0] * (n + 1)\n\n for l, r in lr:\n\n cnt[l-1] += 1\n\n cnt[r] -= 1\n\n \n\n for i in range(n):\n\n cnt[i+1] += cnt[i]\n\n \n\n res = 0\n\n for i in range(n):\n\n res += (cnt[i] == m) & 1\n\n \n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "target": "import sys\n\n\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\n\nl, r = lr[::2], lr[1::2]\n\n\n\ndef main():\n\n ans = max(min(r) - max(l) + 1, 0)\n\n return ans\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 23, "code_v1_loc": 12, "code_v0_num_chars": 413, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "import sys\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\nlr = list(zip(*[iter(lr)] * 2))\n\n\ndef main():\n cnt = [0] * (n + 1)\n for l, r in lr:\n cnt[l - 1] += 1\n cnt[r] -= 1\n for i in range(n):\n cnt[i + 1] += cnt[i]\n res = 0\n for i in range(n):\n res += (cnt[i] == m) & 1\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_v1_no_empty_lines": "import sys\n\nn, m, *lr = list(map(int, sys.stdin.read().split()))\nl, r = lr[::2], lr[1::2]\n\n\ndef main():\n ans = max(min(r) - max(l) + 1, 0)\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 47.8260869565, "diff": ["-lr = list(zip(*[iter(lr)] * 2))", "+l, r = lr[::2], lr[1::2]", "- cnt = [0] * (n + 1)", "- for l, r in lr:", "- cnt[l - 1] += 1", "- cnt[r] -= 1", "- for i in range(n):", "- cnt[i + 1] += cnt[i]", "- res = 0", "- for i in range(n):", "- res += (cnt[i] == m) & 1", "- return res", "+ ans = max(min(r) - max(l) + 1, 0)", "+ return ans"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3223134096, "measured_runtime_v1": 0.2034767451, "runtime_lift": 1.5840306928, "key": ["s133611442", "s023877292"], "target_token_count_dream": 78, "target_token_bucket_dream": "<128"} +{"user_id": "u633068244", "problem_id": "p01438", "language": "python", "submission_id_v0": "s057521298", "submission_id_v1": "s672157071", "cpu_time_v0": 350, "cpu_time_v1": 160, "memory_v0": 16636, "memory_v1": 11468, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.29, "input": "from collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n D = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n for s in range(s-6,e-6):\n\n t |= 1 << s\n\n D[man] = t\n\n\n\n dp = [defaultdict(int) for i in range(n)]\n\n dp[0][D[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp[i-1].keys()):\n\n if bit&D[i] == 0:\n\n dp[i][bit|D[i]] = max(dp[i][bit|D[i]], dp[i-1][bit]+L[i])\n\n dp[i][bit] = max(dp[i][bit],dp[i-1][bit])\n\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n\n \n\n ans = max(max(dp[i].values()) for i in range(n))\n\n print(ans)", "target": "from collections import defaultdict\n\nwhile 1:\n\n n = int(input())\n\n if n == 0: break\n\n L = [0]*n\n\n T = [0]*n\n\n for man in range(n):\n\n m,l = list(map(int,input().split()))\n\n L[man] = l\n\n t = 0\n\n for date in range(m):\n\n s,e = list(map(int,input().split()))\n\n t |= 2**(e-6)-2**(s-6)\n\n T[man] = t\n\n\n\n dp = defaultdict(int)\n\n dp[T[0]] = L[0]\n\n for i in range(1,n):\n\n for bit in list(dp.keys()):\n\n if bit&T[i] == 0:\n\n dp[bit|T[i]] = max(dp[bit|T[i]], dp[bit]+L[i])\n\n dp[T[i]] = max(dp[T[i]], L[i])\n\n \n\n print(max(dp.values()))", "code_v0_loc": 27, "code_v1_loc": 24, "code_v0_num_chars": 821, "code_v1_num_chars": 646, "code_v0_no_empty_lines": "from collections import defaultdict\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n L = [0] * n\n D = [0] * n\n for man in range(n):\n m, l = list(map(int, input().split()))\n L[man] = l\n t = 0\n for date in range(m):\n s, e = list(map(int, input().split()))\n for s in range(s - 6, e - 6):\n t |= 1 << s\n D[man] = t\n dp = [defaultdict(int) for i in range(n)]\n dp[0][D[0]] = L[0]\n for i in range(1, n):\n for bit in list(dp[i - 1].keys()):\n if bit & D[i] == 0:\n dp[i][bit | D[i]] = max(dp[i][bit | D[i]], dp[i - 1][bit] + L[i])\n dp[i][bit] = max(dp[i][bit], dp[i - 1][bit])\n dp[i][D[i]] = max(dp[i][D[i]], L[i])\n ans = max(max(dp[i].values()) for i in range(n))\n print(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n L = [0] * n\n T = [0] * n\n for man in range(n):\n m, l = list(map(int, input().split()))\n L[man] = l\n t = 0\n for date in range(m):\n s, e = list(map(int, input().split()))\n t |= 2 ** (e - 6) - 2 ** (s - 6)\n T[man] = t\n dp = defaultdict(int)\n dp[T[0]] = L[0]\n for i in range(1, n):\n for bit in list(dp.keys()):\n if bit & T[i] == 0:\n dp[bit | T[i]] = max(dp[bit | T[i]], dp[bit] + L[i])\n dp[T[i]] = max(dp[T[i]], L[i])\n print(max(dp.values()))\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- D = [0] * n", "+ T = [0] * n", "- for s in range(s - 6, e - 6):", "- t |= 1 << s", "- D[man] = t", "- dp = [defaultdict(int) for i in range(n)]", "- dp[0][D[0]] = L[0]", "+ t |= 2 ** (e - 6) - 2 ** (s - 6)", "+ T[man] = t", "+ dp = defaultdict(int)", "+ dp[T[0]] = L[0]", "- for bit in list(dp[i - 1].keys()):", "- if bit & D[i] == 0:", "- dp[i][bit | D[i]] = max(dp[i][bit | D[i]], dp[i - 1][bit] + L[i])", "- dp[i][bit] = max(dp[i][bit], dp[i - 1][bit])", "- dp[i][D[i]] = max(dp[i][D[i]], L[i])", "- ans = max(max(dp[i].values()) for i in range(n))", "- print(ans)", "+ for bit in list(dp.keys()):", "+ if bit & T[i] == 0:", "+ dp[bit | T[i]] = max(dp[bit | T[i]], dp[bit] + L[i])", "+ dp[T[i]] = max(dp[T[i]], L[i])", "+ print(max(dp.values()))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0352676418, "measured_runtime_v1": 0.6319530358, "runtime_lift": 1.6382034472, "key": ["s057521298", "s672157071"], "target_token_count_dream": 204, "target_token_bucket_dream": "128-256"} +{"user_id": "u392319141", "problem_id": "p03208", "language": "python", "submission_id_v0": "s260498412", "submission_id_v1": "s755290756", "cpu_time_v0": 275, "cpu_time_v1": 243, "memory_v0": 7384, "memory_v1": 7484, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.64, "input": "N, K = list(map(int, input().split()))\n\n\n\nheight = []\n\nfor _ in range(N) :\n\n height.append(int(input()))\n\n\n\nheight.sort()\n\nans = float('inf')\n\n\n\nfor i in range(N-K+1) :\n\n diff = height[i + K - 1] - height[i]\n\n ans = min(ans, diff)\n\n\n\nprint(ans)", "target": "N, K = list(map(int, input().split()))\n\nH = [int(input()) for _ in range(N)]\n\nH.sort()\n\n\n\nans = 10**18\n\nfor i in range(N - K + 1):\n\n ans = min(ans, H[i + K - 1] - H[i])\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 8, "code_v0_num_chars": 247, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nheight = []\nfor _ in range(N):\n height.append(int(input()))\nheight.sort()\nans = float(\"inf\")\nfor i in range(N - K + 1):\n diff = height[i + K - 1] - height[i]\n ans = min(ans, diff)\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nH = [int(input()) for _ in range(N)]\nH.sort()\nans = 10**18\nfor i in range(N - K + 1):\n ans = min(ans, H[i + K - 1] - H[i])\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-height = []", "-for _ in range(N):", "- height.append(int(input()))", "-height.sort()", "-ans = float(\"inf\")", "+H = [int(input()) for _ in range(N)]", "+H.sort()", "+ans = 10**18", "- diff = height[i + K - 1] - height[i]", "- ans = min(ans, diff)", "+ ans = min(ans, H[i + K - 1] - H[i])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2545773742, "measured_runtime_v1": 0.0892174052, "runtime_lift": 2.8534496549, "key": ["s260498412", "s755290756"], "target_token_count_dream": 68, "target_token_bucket_dream": "<128"} +{"user_id": "u380524497", "problem_id": "p03032", "language": "python", "submission_id_v0": "s669893633", "submission_id_v1": "s465849215", "cpu_time_v0": 57, "cpu_time_v1": 34, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.35, "input": "from collections import deque\n\n\n\nn, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor t in range(k//2 + 1):\n\n hand = deque(V[:k-t])\n\n rest = deque(V[k-t:])\n\n cur_sum = sum(hand)\n\n\n\n for j in range(k-t+1):\n\n put_back = 0\n\n rev_hand = sorted(hand)\n\n\n\n for i in range(t):\n\n jewel = rev_hand[i]\n\n if jewel < 0:\n\n put_back -= jewel\n\n else:\n\n break\n\n\n\n candidate = cur_sum + put_back\n\n ans = max(candidate, ans)\n\n\n\n to_rest = hand.pop()\n\n rest.appendleft(to_rest)\n\n to_hand = rest.pop()\n\n hand.appendleft(to_hand)\n\n\n\n cur_sum += to_hand - to_rest\n\n\n\nprint(ans)", "target": "n, k = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\n\n\ndef get_jewelries(box, left_pop, right_pop):\n\n if left_pop + right_pop >= len(box):\n\n return box[:]\n\n\n\n left = box[:left_pop]\n\n right = box[-right_pop:] if right_pop else []\n\n\n\n return left + right\n\n\n\n\n\ncandidates = []\n\npop_max = min(k, n)\n\nfor pop_count in range(pop_max+1):\n\n residue = k - pop_count\n\n\n\n for left_pop in range(pop_count+1):\n\n right_pop = pop_count - left_pop\n\n jewelries = get_jewelries(V, left_pop, right_pop)\n\n jewelries.sort(reverse=True)\n\n\n\n for _ in range(residue):\n\n if not jewelries:\n\n break\n\n if jewelries[-1] < 0:\n\n jewelries.pop()\n\n\n\n value = sum(jewelries)\n\n candidates.append(value)\n\n\n\nprint((max(candidates)))\n", "code_v0_loc": 33, "code_v1_loc": 34, "code_v0_num_chars": 732, "code_v1_num_chars": 833, "code_v0_no_empty_lines": "from collections import deque\n\nn, k = list(map(int, input().split()))\nV = list(map(int, input().split()))\nans = 0\nfor t in range(k // 2 + 1):\n hand = deque(V[: k - t])\n rest = deque(V[k - t :])\n cur_sum = sum(hand)\n for j in range(k - t + 1):\n put_back = 0\n rev_hand = sorted(hand)\n for i in range(t):\n jewel = rev_hand[i]\n if jewel < 0:\n put_back -= jewel\n else:\n break\n candidate = cur_sum + put_back\n ans = max(candidate, ans)\n to_rest = hand.pop()\n rest.appendleft(to_rest)\n to_hand = rest.pop()\n hand.appendleft(to_hand)\n cur_sum += to_hand - to_rest\nprint(ans)\n", "code_v1_no_empty_lines": "n, k = list(map(int, input().split()))\nV = list(map(int, input().split()))\n\n\ndef get_jewelries(box, left_pop, right_pop):\n if left_pop + right_pop >= len(box):\n return box[:]\n left = box[:left_pop]\n right = box[-right_pop:] if right_pop else []\n return left + right\n\n\ncandidates = []\npop_max = min(k, n)\nfor pop_count in range(pop_max + 1):\n residue = k - pop_count\n for left_pop in range(pop_count + 1):\n right_pop = pop_count - left_pop\n jewelries = get_jewelries(V, left_pop, right_pop)\n jewelries.sort(reverse=True)\n for _ in range(residue):\n if not jewelries:\n break\n if jewelries[-1] < 0:\n jewelries.pop()\n value = sum(jewelries)\n candidates.append(value)\nprint((max(candidates)))\n", "code_same": false, "relative_loc_diff_percent": 2.9411764706, "diff": ["-from collections import deque", "-", "-ans = 0", "-for t in range(k // 2 + 1):", "- hand = deque(V[: k - t])", "- rest = deque(V[k - t :])", "- cur_sum = sum(hand)", "- for j in range(k - t + 1):", "- put_back = 0", "- rev_hand = sorted(hand)", "- for i in range(t):", "- jewel = rev_hand[i]", "- if jewel < 0:", "- put_back -= jewel", "- else:", "+", "+", "+def get_jewelries(box, left_pop, right_pop):", "+ if left_pop + right_pop >= len(box):", "+ return box[:]", "+ left = box[:left_pop]", "+ right = box[-right_pop:] if right_pop else []", "+ return left + right", "+", "+", "+candidates = []", "+pop_max = min(k, n)", "+for pop_count in range(pop_max + 1):", "+ residue = k - pop_count", "+ for left_pop in range(pop_count + 1):", "+ right_pop = pop_count - left_pop", "+ jewelries = get_jewelries(V, left_pop, right_pop)", "+ jewelries.sort(reverse=True)", "+ for _ in range(residue):", "+ if not jewelries:", "- candidate = cur_sum + put_back", "- ans = max(candidate, ans)", "- to_rest = hand.pop()", "- rest.appendleft(to_rest)", "- to_hand = rest.pop()", "- hand.appendleft(to_hand)", "- cur_sum += to_hand - to_rest", "-print(ans)", "+ if jewelries[-1] < 0:", "+ jewelries.pop()", "+ value = sum(jewelries)", "+ candidates.append(value)", "+print((max(candidates)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2830656636, "measured_runtime_v1": 0.1950679789, "runtime_lift": 1.4511129157, "key": ["s669893633", "s465849215"], "target_token_count_dream": 208, "target_token_bucket_dream": "128-256"} +{"user_id": "u227082700", "problem_id": "p02863", "language": "python", "submission_id_v0": "s340691380", "submission_id_v1": "s390961057", "cpu_time_v0": 541, "cpu_time_v1": 362, "memory_v0": 216520, "memory_v1": 217248, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.09, "input": "n,t=list(map(int,input().split()))\n\nab=[list(map(int,input().split()))for _ in range(n)]\n\nab.sort()\n\ndp=[(6007)*[0]for _ in range(n+1)]\n\ndp[0][0]=0\n\nans=0\n\nfor i in range(n):\n\n for j in range(6007):\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\n if j>= 1\n\n return r\n\n\n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\n\n\nm = 0\n\nl = (1 << n) - 1\n\nfor x in range(1, l + 1):\n\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n\n m = max(m, popcount(x))\n\nprint(m)\n", "target": "from itertools import combinations\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [(set(), set()) for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y].add(x - 1)\n\n \n\nfail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)\n\n \n\nwhile all(map(fail, list(map(set, combinations(r, n))))):\n\n n -= 1\n\nprint(n)", "code_v0_loc": 22, "code_v1_loc": 15, "code_v0_num_chars": 430, "code_v1_num_chars": 365, "code_v0_no_empty_lines": "def popcount(x):\n r = 0\n while x:\n if x & 1:\n r += 1\n x >>= 1\n return r\n\n\nn = int(input())\nr = list(range(n))\na = [[0, 0] for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y] |= 1 << (x - 1)\nm = 0\nl = (1 << n) - 1\nfor x in range(1, l + 1):\n if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):\n m = max(m, popcount(x))\nprint(m)\n", "code_v1_no_empty_lines": "from itertools import combinations\n\nn = int(input())\nr = list(range(n))\na = [(set(), set()) for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y].add(x - 1)\nfail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)\nwhile all(map(fail, list(map(set, combinations(r, n))))):\n n -= 1\nprint(n)\n", "code_same": false, "relative_loc_diff_percent": 31.8181818182, "diff": ["-def popcount(x):", "- r = 0", "- while x:", "- if x & 1:", "- r += 1", "- x >>= 1", "- return r", "-", "+from itertools import combinations", "-a = [[0, 0] for _ in r]", "+a = [(set(), set()) for _ in r]", "- a[i][y] |= 1 << (x - 1)", "-m = 0", "-l = (1 << n) - 1", "-for x in range(1, l + 1):", "- if all(a[i][0] & x == a[i][1] & l - x == 0 for i in r if x >> i & 1):", "- m = max(m, popcount(x))", "-print(m)", "+ a[i][y].add(x - 1)", "+fail = lambda x: not all(a[i][0].isdisjoint(x) and a[i][1] < x for i in x)", "+while all(map(fail, list(map(set, combinations(r, n))))):", "+ n -= 1", "+print(n)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2279194756, "measured_runtime_v1": 0.0067682672, "runtime_lift": 33.6747161436, "key": ["s475579950", "s165212154"], "target_token_count_dream": 126, "target_token_bucket_dream": "<128"} +{"user_id": "u893063840", "problem_id": "p03039", "language": "python", "submission_id_v0": "s835548762", "submission_id_v1": "s860519661", "cpu_time_v0": 1667, "cpu_time_v1": 328, "memory_v0": 85236, "memory_v1": 18804, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.32, "input": "n, m, k = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\nMAX = n * m\n\n\n\n\n\nclass ModInt:\n\n def __init__(self, num):\n\n self.num = num\n\n\n\n def __str__(self):\n\n return str(self.num)\n\n\n\n def __repr__(self):\n\n return \"ModInt(num: {}, mod: {}\".format(self.num, mod)\n\n\n\n def __add__(self, other):\n\n ret = self.num + other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __sub__(self, other):\n\n ret = self.num - other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def __mul__(self, other):\n\n ret = self.num * other.num\n\n ret %= mod\n\n return ModInt(ret)\n\n\n\n def pow(self, times):\n\n pw = pow(self.num, times, mod)\n\n return ModInt(pw)\n\n\n\n def inverse(self):\n\n return ModInt(inv[self.num])\n\n\n\n def __truediv__(self, other):\n\n num = self * other.inverse()\n\n return ModInt(num)\n\n\n\n\n\ndef comb(n, k):\n\n return fact[n] * inv[n-k] * inv[k]\n\n\n\n\n\nfact = [None] * (MAX + 1)\n\nfact[0] = ModInt(1)\n\nfor i in range(1, MAX + 1):\n\n fact[i] = fact[i-1] * ModInt(i)\n\n\n\ninv = [None] * (MAX + 1)\n\ninv[MAX] = fact[MAX].pow(mod - 2)\n\nfor i in range(MAX, 0, -1):\n\n inv[i-1] = inv[i] * ModInt(i)\n\n\n\nans = ModInt(0)\n\nfor i in range(n):\n\n for j in range(m):\n\n add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)\n\n if i != 0 and j != 0:\n\n add *= ModInt(2)\n\n\n\n ans += add\n\n\n\nans *= comb(n * m - 2, k - 2)\n\nprint(ans)\n", "target": "n, m, k = list(map(int, input().split()))\n\n\n\nmod = 10 ** 9 + 7\n\nMAX = n * m\n\n\n\nfact = [1] * (MAX + 1)\n\nfor i in range(1, MAX + 1):\n\n fact[i] = (fact[i-1] * i) % mod\n\n\n\ninv = [1] * (MAX + 1)\n\ninv[MAX] = pow(fact[MAX], mod - 2, mod)\n\nfor i in range(MAX, 0, -1):\n\n inv[i-1] = (inv[i] * i) % mod\n\n\n\n\n\ndef comb(n, k):\n\n return fact[n] * inv[n-k] * inv[k] % mod\n\n\n\n\n\nans = 0\n\nfor i in range(n):\n\n for j in range(m):\n\n add = (n - i) * (m - j) * (i + j) % mod\n\n if i != 0 and j != 0:\n\n add *= 2\n\n add %= mod\n\n\n\n ans += add\n\n ans %= mod\n\n\n\nans *= comb(MAX - 2, k - 2)\n\nans %= mod\n\nprint(ans)\n", "code_v0_loc": 67, "code_v1_loc": 33, "code_v0_num_chars": 1460, "code_v1_num_chars": 639, "code_v0_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nMAX = n * m\n\n\nclass ModInt:\n def __init__(self, num):\n self.num = num\n\n def __str__(self):\n return str(self.num)\n\n def __repr__(self):\n return \"ModInt(num: {}, mod: {}\".format(self.num, mod)\n\n def __add__(self, other):\n ret = self.num + other.num\n ret %= mod\n return ModInt(ret)\n\n def __sub__(self, other):\n ret = self.num - other.num\n ret %= mod\n return ModInt(ret)\n\n def __mul__(self, other):\n ret = self.num * other.num\n ret %= mod\n return ModInt(ret)\n\n def pow(self, times):\n pw = pow(self.num, times, mod)\n return ModInt(pw)\n\n def inverse(self):\n return ModInt(inv[self.num])\n\n def __truediv__(self, other):\n num = self * other.inverse()\n return ModInt(num)\n\n\ndef comb(n, k):\n return fact[n] * inv[n - k] * inv[k]\n\n\nfact = [None] * (MAX + 1)\nfact[0] = ModInt(1)\nfor i in range(1, MAX + 1):\n fact[i] = fact[i - 1] * ModInt(i)\ninv = [None] * (MAX + 1)\ninv[MAX] = fact[MAX].pow(mod - 2)\nfor i in range(MAX, 0, -1):\n inv[i - 1] = inv[i] * ModInt(i)\nans = ModInt(0)\nfor i in range(n):\n for j in range(m):\n add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)\n if i != 0 and j != 0:\n add *= ModInt(2)\n ans += add\nans *= comb(n * m - 2, k - 2)\nprint(ans)\n", "code_v1_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nMAX = n * m\nfact = [1] * (MAX + 1)\nfor i in range(1, MAX + 1):\n fact[i] = (fact[i - 1] * i) % mod\ninv = [1] * (MAX + 1)\ninv[MAX] = pow(fact[MAX], mod - 2, mod)\nfor i in range(MAX, 0, -1):\n inv[i - 1] = (inv[i] * i) % mod\n\n\ndef comb(n, k):\n return fact[n] * inv[n - k] * inv[k] % mod\n\n\nans = 0\nfor i in range(n):\n for j in range(m):\n add = (n - i) * (m - j) * (i + j) % mod\n if i != 0 and j != 0:\n add *= 2\n add %= mod\n ans += add\n ans %= mod\nans *= comb(MAX - 2, k - 2)\nans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.7462686567, "diff": ["-", "-", "-class ModInt:", "- def __init__(self, num):", "- self.num = num", "-", "- def __str__(self):", "- return str(self.num)", "-", "- def __repr__(self):", "- return \"ModInt(num: {}, mod: {}\".format(self.num, mod)", "-", "- def __add__(self, other):", "- ret = self.num + other.num", "- ret %= mod", "- return ModInt(ret)", "-", "- def __sub__(self, other):", "- ret = self.num - other.num", "- ret %= mod", "- return ModInt(ret)", "-", "- def __mul__(self, other):", "- ret = self.num * other.num", "- ret %= mod", "- return ModInt(ret)", "-", "- def pow(self, times):", "- pw = pow(self.num, times, mod)", "- return ModInt(pw)", "-", "- def inverse(self):", "- return ModInt(inv[self.num])", "-", "- def __truediv__(self, other):", "- num = self * other.inverse()", "- return ModInt(num)", "+fact = [1] * (MAX + 1)", "+for i in range(1, MAX + 1):", "+ fact[i] = (fact[i - 1] * i) % mod", "+inv = [1] * (MAX + 1)", "+inv[MAX] = pow(fact[MAX], mod - 2, mod)", "+for i in range(MAX, 0, -1):", "+ inv[i - 1] = (inv[i] * i) % mod", "- return fact[n] * inv[n - k] * inv[k]", "+ return fact[n] * inv[n - k] * inv[k] % mod", "-fact = [None] * (MAX + 1)", "-fact[0] = ModInt(1)", "-for i in range(1, MAX + 1):", "- fact[i] = fact[i - 1] * ModInt(i)", "-inv = [None] * (MAX + 1)", "-inv[MAX] = fact[MAX].pow(mod - 2)", "-for i in range(MAX, 0, -1):", "- inv[i - 1] = inv[i] * ModInt(i)", "-ans = ModInt(0)", "+ans = 0", "- add = ModInt(n - i) * ModInt(m - j) * ModInt(i + j)", "+ add = (n - i) * (m - j) * (i + j) % mod", "- add *= ModInt(2)", "+ add *= 2", "+ add %= mod", "-ans *= comb(n * m - 2, k - 2)", "+ ans %= mod", "+ans *= comb(MAX - 2, k - 2)", "+ans %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0146762717, "measured_runtime_v1": 0.4959636457, "runtime_lift": 2.0458682415, "key": ["s835548762", "s860519661"], "target_token_count_dream": 248, "target_token_bucket_dream": "128-256"} +{"user_id": "u644907318", "problem_id": "p03241", "language": "python", "submission_id_v0": "s205255104", "submission_id_v1": "s496579949", "cpu_time_v0": 180, "cpu_time_v1": 73, "memory_v0": 38640, "memory_v1": 63824, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.44, "input": "N,M = list(map(int,input().split()))\n\nif N==1:\n\n nmax=M\n\nelse:\n\n nmax = 1\n\n for i in range(2,int(M**0.5)+1):\n\n if M%i==0 and M//i>=N:\n\n nmax = max(nmax,i)\n\n if M%i==0 and i>=N:\n\n nmax = max(nmax,M//i)\n\nprint(nmax)", "target": "N,M = list(map(int,input().split()))\n\namax = 1\n\nfor i in range(1,int(M**0.5)+1):\n\n if M%i==0:\n\n a = i\n\n b = M//i\n\n if b>=N:\n\n amax = max(amax,a)\n\n a,b = b,a\n\n if b>=N:\n\n amax = max(amax,a)\n\nprint(amax)", "code_v0_loc": 11, "code_v1_loc": 12, "code_v0_num_chars": 252, "code_v1_num_chars": 255, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nif N == 1:\n nmax = M\nelse:\n nmax = 1\n for i in range(2, int(M**0.5) + 1):\n if M % i == 0 and M // i >= N:\n nmax = max(nmax, i)\n if M % i == 0 and i >= N:\n nmax = max(nmax, M // i)\nprint(nmax)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\namax = 1\nfor i in range(1, int(M**0.5) + 1):\n if M % i == 0:\n a = i\n b = M // i\n if b >= N:\n amax = max(amax, a)\n a, b = b, a\n if b >= N:\n amax = max(amax, a)\nprint(amax)\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-if N == 1:", "- nmax = M", "-else:", "- nmax = 1", "- for i in range(2, int(M**0.5) + 1):", "- if M % i == 0 and M // i >= N:", "- nmax = max(nmax, i)", "- if M % i == 0 and i >= N:", "- nmax = max(nmax, M // i)", "-print(nmax)", "+amax = 1", "+for i in range(1, int(M**0.5) + 1):", "+ if M % i == 0:", "+ a = i", "+ b = M // i", "+ if b >= N:", "+ amax = max(amax, a)", "+ a, b = b, a", "+ if b >= N:", "+ amax = max(amax, a)", "+print(amax)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3445633175, "measured_runtime_v1": 0.2717220852, "runtime_lift": 1.26807255, "key": ["s205255104", "s496579949"], "target_token_count_dream": 90, "target_token_bucket_dream": "<128"} +{"user_id": "u543954314", "problem_id": "p02596", "language": "python", "submission_id_v0": "s410919516", "submission_id_v1": "s753895766", "cpu_time_v0": 302, "cpu_time_v1": 127, "memory_v0": 114648, "memory_v1": 9196, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.95, "input": "import sys\n\n\n\nreadline = sys.stdin.readline\n\nreadall = sys.stdin.read\n\nns = lambda: readline().rstrip()\n\nni = lambda: int(readline().rstrip())\n\nnm = lambda: map(int, readline().split())\n\nnl = lambda: list(map(int, readline().split()))\n\nprn = lambda x: print(*x, sep='\\n')\n\n\n\ndef solve():\n\n d = dict()\n\n k = ni()\n\n c = 7 % k\n\n x = d[c] = 1\n\n while True:\n\n c = (c * 10 + 7) % k\n\n if c in d:\n\n break\n\n x += 1\n\n d[c] = x\n\n print(d.get(0, -1))\n\n return\n\n\n\nsolve()\n", "target": "import sys\n\n\n\nreadline = sys.stdin.readline\n\nreadall = sys.stdin.read\n\nns = lambda: readline().rstrip()\n\nni = lambda: int(readline().rstrip())\n\nnm = lambda: map(int, readline().split())\n\nnl = lambda: list(map(int, readline().split()))\n\nprn = lambda x: print(*x, sep='\\n')\n\n\n\ndef solve():\n\n k = ni()\n\n c = 0\n\n for i in range(k):\n\n c = (c * 10 + 7) % k\n\n if c == 0:\n\n print(i+1)\n\n break\n\n else:\n\n print(-1)\n\n return\n\n\n\nsolve()\n", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 519, "code_v1_num_chars": 483, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nreadall = sys.stdin.read\nns = lambda: readline().rstrip()\nni = lambda: int(readline().rstrip())\nnm = lambda: map(int, readline().split())\nnl = lambda: list(map(int, readline().split()))\nprn = lambda x: print(*x, sep=\"\\n\")\n\n\ndef solve():\n d = dict()\n k = ni()\n c = 7 % k\n x = d[c] = 1\n while True:\n c = (c * 10 + 7) % k\n if c in d:\n break\n x += 1\n d[c] = x\n print(d.get(0, -1))\n return\n\n\nsolve()\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nreadall = sys.stdin.read\nns = lambda: readline().rstrip()\nni = lambda: int(readline().rstrip())\nnm = lambda: map(int, readline().split())\nnl = lambda: list(map(int, readline().split()))\nprn = lambda x: print(*x, sep=\"\\n\")\n\n\ndef solve():\n k = ni()\n c = 0\n for i in range(k):\n c = (c * 10 + 7) % k\n if c == 0:\n print(i + 1)\n break\n else:\n print(-1)\n return\n\n\nsolve()\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- d = dict()", "- c = 7 % k", "- x = d[c] = 1", "- while True:", "+ c = 0", "+ for i in range(k):", "- if c in d:", "+ if c == 0:", "+ print(i + 1)", "- x += 1", "- d[c] = x", "- print(d.get(0, -1))", "+ else:", "+ print(-1)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7691566973, "measured_runtime_v1": 0.3673865876, "runtime_lift": 2.0935894863, "key": ["s410919516", "s753895766"], "target_token_count_dream": 138, "target_token_bucket_dream": "128-256"} +{"user_id": "u561083515", "problem_id": "p02959", "language": "python", "submission_id_v0": "s872669573", "submission_id_v1": "s116182226", "cpu_time_v0": 274, "cpu_time_v1": 160, "memory_v0": 73316, "memory_v1": 19648, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 41.61, "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nN = int(input())\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\nbefore = sum(A)\n\n\n\nfor i in range(N):\n\n nokori = B[i]\n\n for j in range(i,i+2):\n\n if nokori >= A[j]:\n\n nokori -= A[j]\n\n A[j] = 0\n\n else:\n\n A[j] -= nokori\n\n nokori = 0\n\nafter = sum(A)\n\n\n\nprint((before - after))", "target": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nB = [int(i) for i in input().split()]\n\n\n\ncnt = 0\n\nfor i in range(N):\n\n if B[i] >= A[i]:\n\n cnt += A[i]\n\n B[i] -= A[i]\n\n else:\n\n cnt += B[i]\n\n B[i] = 0\n\n if B[i] == 0:\n\n continue\n\n if B[i] >= A[i+1]:\n\n cnt += A[i+1]\n\n A[i+1] = 0\n\n else:\n\n cnt += B[i]\n\n A[i+1] -= B[i]\n\n\n\nprint(cnt)", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 440, "code_v1_num_chars": 414, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nN = int(input())\nA = [int(i) for i in input().split()]\nB = [int(i) for i in input().split()]\nbefore = sum(A)\nfor i in range(N):\n nokori = B[i]\n for j in range(i, i + 2):\n if nokori >= A[j]:\n nokori -= A[j]\n A[j] = 0\n else:\n A[j] -= nokori\n nokori = 0\nafter = sum(A)\nprint((before - after))\n", "code_v1_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nB = [int(i) for i in input().split()]\ncnt = 0\nfor i in range(N):\n if B[i] >= A[i]:\n cnt += A[i]\n B[i] -= A[i]\n else:\n cnt += B[i]\n B[i] = 0\n if B[i] == 0:\n continue\n if B[i] >= A[i + 1]:\n cnt += A[i + 1]\n A[i + 1] = 0\n else:\n cnt += B[i]\n A[i + 1] -= B[i]\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-sys.setrecursionlimit(10**7)", "-before = sum(A)", "+cnt = 0", "- nokori = B[i]", "- for j in range(i, i + 2):", "- if nokori >= A[j]:", "- nokori -= A[j]", "- A[j] = 0", "- else:", "- A[j] -= nokori", "- nokori = 0", "-after = sum(A)", "-print((before - after))", "+ if B[i] >= A[i]:", "+ cnt += A[i]", "+ B[i] -= A[i]", "+ else:", "+ cnt += B[i]", "+ B[i] = 0", "+ if B[i] == 0:", "+ continue", "+ if B[i] >= A[i + 1]:", "+ cnt += A[i + 1]", "+ A[i + 1] = 0", "+ else:", "+ cnt += B[i]", "+ A[i + 1] -= B[i]", "+print(cnt)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3369382279, "measured_runtime_v1": 0.0062937415, "runtime_lift": 53.5354413986, "key": ["s872669573", "s116182226"], "target_token_count_dream": 146, "target_token_bucket_dream": "128-256"} +{"user_id": "u144913062", "problem_id": "p03457", "language": "python", "submission_id_v0": "s956976175", "submission_id_v1": "s285518014", "cpu_time_v0": 628, "cpu_time_v1": 555, "memory_v0": 62040, "memory_v1": 46056, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.62, "input": "N = int(input())\n\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\n\nfor i in range(N):\n\n t1, x1, y1 = txy[i]\n\n t2, x2, y2 = txy[i+1]\n\n if abs(x2-x1) + abs(y2-y1) <= t2 - t1 and (x1+y1+x2+y2) % 2 == (t2-t1) % 2:\n\n continue\n\n else:\n\n print('No')\n\n exit()\n\nprint('Yes')", "target": "N = int(input())\n\nt0 = x0 = y0 = 0\n\nfor _ in range(N):\n\n t1, x1, y1 = list(map(int, input().split()))\n\n d = abs(x1 - x0) + abs(y1 - y0)\n\n if d > t1 - t0 or d % 2 != (t1 - t0) % 2:\n\n print('No')\n\n exit()\n\n t0, x0, y0 = t1, x1, y1\n\nprint('Yes')\n", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 323, "code_v1_num_chars": 263, "code_v0_no_empty_lines": "N = int(input())\ntxy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]\nfor i in range(N):\n t1, x1, y1 = txy[i]\n t2, x2, y2 = txy[i + 1]\n if (\n abs(x2 - x1) + abs(y2 - y1) <= t2 - t1\n and (x1 + y1 + x2 + y2) % 2 == (t2 - t1) % 2\n ):\n continue\n else:\n print(\"No\")\n exit()\nprint(\"Yes\")\n", "code_v1_no_empty_lines": "N = int(input())\nt0 = x0 = y0 = 0\nfor _ in range(N):\n t1, x1, y1 = list(map(int, input().split()))\n d = abs(x1 - x0) + abs(y1 - y0)\n if d > t1 - t0 or d % 2 != (t1 - t0) % 2:\n print(\"No\")\n exit()\n t0, x0, y0 = t1, x1, y1\nprint(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-txy = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]", "-for i in range(N):", "- t1, x1, y1 = txy[i]", "- t2, x2, y2 = txy[i + 1]", "- if (", "- abs(x2 - x1) + abs(y2 - y1) <= t2 - t1", "- and (x1 + y1 + x2 + y2) % 2 == (t2 - t1) % 2", "- ):", "- continue", "- else:", "+t0 = x0 = y0 = 0", "+for _ in range(N):", "+ t1, x1, y1 = list(map(int, input().split()))", "+ d = abs(x1 - x0) + abs(y1 - y0)", "+ if d > t1 - t0 or d % 2 != (t1 - t0) % 2:", "+ t0, x0, y0 = t1, x1, y1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3724059272, "measured_runtime_v1": 0.2797260373, "runtime_lift": 1.3313237867, "key": ["s956976175", "s285518014"], "target_token_count_dream": 116, "target_token_bucket_dream": "<128"} +{"user_id": "u227082700", "problem_id": "p02834", "language": "python", "submission_id_v0": "s854767798", "submission_id_v1": "s662268715", "cpu_time_v0": 780, "cpu_time_v1": 670, "memory_v0": 84508, "memory_v1": 38312, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.1, "input": "n,u,v=list(map(int,input().split()))\n\nanss=0\n\nu-=1\n\nv-=1\n\nd=[[]for _ in range(n)]\n\ninf=float('inf')\n\naoki=[inf]*n\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n d[a].append(b)\n\n d[b].append(a)\n\nQ=d[v]\n\naoki[v]=0\n\ndis=1\n\nvisited={v}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n aoki[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[u]\n\nchokudai=[-1]*n\n\nchokudai[u]=0\n\ndis=1\n\nvisited={u}\n\npoint=-1\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n for j in d[i]:\n\n if aoki[j]<=dis+1:\n\n if aoki[j]==dis+1:anss=1\n\n if point<0:point=i\n\n continue\n\n if j not in visited:P.append(j)\n\n chokudai[i]=dis\n\n dis+=1\n\n Q=P\n\nQ=d[point]\n\ndis=chokudai[point]+1\n\nvisited={point}\n\nwhile Q:\n\n P=[]\n\n for i in Q:\n\n visited.add(i)\n\n if chokudai[i]==-1:continue\n\n chokudai[i]=max(dis,chokudai[i])\n\n for j in d[i]:\n\n if j not in visited:P.append(j)\n\n dis+=1\n\n Q=P\n\nans=0\n\nfor i in range(n):\n\n if aoki[i]>chokudai[i]:ans=max(ans,chokudai[i])\n\nprint((ans+anss))\n\n#print(aoki)\n\n#print(chokudai)", "target": "n,u,v=list(map(int,input().split()))\n\nu-=1\n\nv-=1\n\ne=[[]for _ in range(n)]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n e[a].append(b)\n\n e[b].append(a)\n\ncho=[u]\n\ncho_dis=[10**7]*n\n\ncho_dis[u]=0\n\ncho_visited={u}\n\ncountt=1\n\nwhile cho:\n\n CHO=[]\n\n for i in cho:\n\n for j in e[i]:\n\n if j in cho_visited:continue\n\n cho_visited.add(j)\n\n CHO.append(j)\n\n cho_dis[j]=countt\n\n countt+=1\n\n cho=CHO\n\naok=[v]\n\naok_dis=[10**7]*n\n\naok_dis[v]=0\n\naok_visited={v}\n\ncountt=1\n\nwhile aok:\n\n AOK=[]\n\n for i in aok:\n\n for j in e[i]:\n\n if j in aok_visited:continue\n\n aok_visited.add(j)\n\n AOK.append(j)\n\n aok_dis[j]=countt\n\n countt+=1\n\n aok=AOK\n\nans=0\n\nfor i in range(n):\n\n if cho_dis[i] chokudai[i]:\n ans = max(ans, chokudai[i])\nprint((ans + anss))\n# print(aoki)\n# print(chokudai)\n", "code_v1_no_empty_lines": "n, u, v = list(map(int, input().split()))\nu -= 1\nv -= 1\ne = [[] for _ in range(n)]\nfor i in range(n - 1):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n e[a].append(b)\n e[b].append(a)\ncho = [u]\ncho_dis = [10**7] * n\ncho_dis[u] = 0\ncho_visited = {u}\ncountt = 1\nwhile cho:\n CHO = []\n for i in cho:\n for j in e[i]:\n if j in cho_visited:\n continue\n cho_visited.add(j)\n CHO.append(j)\n cho_dis[j] = countt\n countt += 1\n cho = CHO\naok = [v]\naok_dis = [10**7] * n\naok_dis[v] = 0\naok_visited = {v}\ncountt = 1\nwhile aok:\n AOK = []\n for i in aok:\n for j in e[i]:\n if j in aok_visited:\n continue\n aok_visited.add(j)\n AOK.append(j)\n aok_dis[j] = countt\n countt += 1\n aok = AOK\nans = 0\nfor i in range(n):\n if cho_dis[i] < aok_dis[i]:\n ans = max(ans, aok_dis[i] - 1)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 31.25, "diff": ["-anss = 0", "-d = [[] for _ in range(n)]", "-inf = float(\"inf\")", "-aoki = [inf] * n", "+e = [[] for _ in range(n)]", "- d[a].append(b)", "- d[b].append(a)", "-Q = d[v]", "-aoki[v] = 0", "-dis = 1", "-visited = {v}", "-while Q:", "- P = []", "- for i in Q:", "- visited.add(i)", "- for j in d[i]:", "- if j not in visited:", "- P.append(j)", "- aoki[i] = dis", "- dis += 1", "- Q = P", "-Q = d[u]", "-chokudai = [-1] * n", "-chokudai[u] = 0", "-dis = 1", "-visited = {u}", "-point = -1", "-while Q:", "- P = []", "- for i in Q:", "- visited.add(i)", "- for j in d[i]:", "- if aoki[j] <= dis + 1:", "- if aoki[j] == dis + 1:", "- anss = 1", "- if point < 0:", "- point = i", "+ e[a].append(b)", "+ e[b].append(a)", "+cho = [u]", "+cho_dis = [10**7] * n", "+cho_dis[u] = 0", "+cho_visited = {u}", "+countt = 1", "+while cho:", "+ CHO = []", "+ for i in cho:", "+ for j in e[i]:", "+ if j in cho_visited:", "- if j not in visited:", "- P.append(j)", "- chokudai[i] = dis", "- dis += 1", "- Q = P", "-Q = d[point]", "-dis = chokudai[point] + 1", "-visited = {point}", "-while Q:", "- P = []", "- for i in Q:", "- visited.add(i)", "- if chokudai[i] == -1:", "- continue", "- chokudai[i] = max(dis, chokudai[i])", "- for j in d[i]:", "- if j not in visited:", "- P.append(j)", "- dis += 1", "- Q = P", "+ cho_visited.add(j)", "+ CHO.append(j)", "+ cho_dis[j] = countt", "+ countt += 1", "+ cho = CHO", "+aok = [v]", "+aok_dis = [10**7] * n", "+aok_dis[v] = 0", "+aok_visited = {v}", "+countt = 1", "+while aok:", "+ AOK = []", "+ for i in aok:", "+ for j in e[i]:", "+ if j in aok_visited:", "+ continue", "+ aok_visited.add(j)", "+ AOK.append(j)", "+ aok_dis[j] = countt", "+ countt += 1", "+ aok = AOK", "- if aoki[i] > chokudai[i]:", "- ans = max(ans, chokudai[i])", "-print((ans + anss))", "-# print(aoki)", "-# print(chokudai)", "+ if cho_dis[i] < aok_dis[i]:", "+ ans = max(ans, aok_dis[i] - 1)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2686464586, "measured_runtime_v1": 0.0699197628, "runtime_lift": 3.842210666, "key": ["s854767798", "s662268715"], "target_token_count_dream": 293, "target_token_bucket_dream": "256-512"} +{"user_id": "u729133443", "problem_id": "p02537", "language": "python", "submission_id_v0": "s897150427", "submission_id_v1": "s003067542", "cpu_time_v0": 1389, "cpu_time_v1": 1137, "memory_v0": 275544, "memory_v1": 157144, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.14, "input": "d=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()+d))\n\nfor i in range(n):d[i]=max(d[j]for j in range(i-99,i+1)if abs(a[i]-a[j])<=k)+1\n\nprint((max(d)))", "target": "d=[0]*6**8\n\nn,k,*a=list(map(int,open(0).read().split()))\n\na=d+a\n\nwhile n:d[n]=max(d[j]for j in range(n,n+99)if abs(a[-n]-a[-j])<=k)+1;n-=1\n\nprint((max(d)))", "code_v0_loc": 4, "code_v1_loc": 5, "code_v0_num_chars": 147, "code_v1_num_chars": 147, "code_v0_no_empty_lines": "d = [0] * 6**8\nn, k, *a = list(map(int, open(0).read().split() + d))\nfor i in range(n):\n d[i] = max(d[j] for j in range(i - 99, i + 1) if abs(a[i] - a[j]) <= k) + 1\nprint((max(d)))\n", "code_v1_no_empty_lines": "d = [0] * 6**8\nn, k, *a = list(map(int, open(0).read().split()))\na = d + a\nwhile n:\n d[n] = max(d[j] for j in range(n, n + 99) if abs(a[-n] - a[-j]) <= k) + 1\n n -= 1\nprint((max(d)))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-n, k, *a = list(map(int, open(0).read().split() + d))", "-for i in range(n):", "- d[i] = max(d[j] for j in range(i - 99, i + 1) if abs(a[i] - a[j]) <= k) + 1", "+n, k, *a = list(map(int, open(0).read().split()))", "+a = d + a", "+while n:", "+ d[n] = max(d[j] for j in range(n, n + 99) if abs(a[-n] - a[-j]) <= k) + 1", "+ n -= 1"], "diff_only_import_comment": false, "measured_runtime_v0": 1.750332129, "measured_runtime_v1": 0.822091434, "runtime_lift": 2.1291209914, "key": ["s897150427", "s003067542"], "target_token_count_dream": 70, "target_token_bucket_dream": "<128"} +{"user_id": "u185948224", "problem_id": "p02873", "language": "python", "submission_id_v0": "s874712614", "submission_id_v1": "s975354355", "cpu_time_v0": 481, "cpu_time_v1": 429, "memory_v0": 27676, "memory_v1": 27548, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.81, "input": "S = input()\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in range(len(lst)):\n\n if lst[i] > 0:\n\n ans += list(range(1,lst[i]+1))\n\n else:\n\n ans[-1] = max(ans[-1], -lst[i])\n\n ans += list(range(-lst[i]-1,-1, -1))\n\n\n\nprint((sum(ans)))\n", "target": "S = input()\n\n\n\nlst = [1 if S[0]=='<' else -1]\n\nfor i in range(1, len(S)):\n\n if S[i] == S[i - 1]:\n\n lst[-1] += 1 if S[i]=='<' else -1\n\n else:\n\n lst.append(-1 if S[i]=='>' else 1)\n\n \n\nans = [0]\n\n\n\nfor i in lst:\n\n if i > 0:\n\n ans += list(range(1,i+1))\n\n else:\n\n ans[-1] = max(ans[-1], -i)\n\n ans += list(range(-i-1,-1, -1))\n\n\n\n\n\nprint((sum(ans)))", "code_v0_loc": 19, "code_v1_loc": 20, "code_v0_num_chars": 425, "code_v1_num_chars": 394, "code_v0_no_empty_lines": "S = input()\nlst = [1 if S[0] == \"<\" else -1]\nfor i in range(1, len(S)):\n if S[i] == S[i - 1]:\n lst[-1] += 1 if S[i] == \"<\" else -1\n else:\n lst.append(-1 if S[i] == \">\" else 1)\nans = [0]\nfor i in range(len(lst)):\n if lst[i] > 0:\n ans += list(range(1, lst[i] + 1))\n else:\n ans[-1] = max(ans[-1], -lst[i])\n ans += list(range(-lst[i] - 1, -1, -1))\nprint((sum(ans)))\n", "code_v1_no_empty_lines": "S = input()\nlst = [1 if S[0] == \"<\" else -1]\nfor i in range(1, len(S)):\n if S[i] == S[i - 1]:\n lst[-1] += 1 if S[i] == \"<\" else -1\n else:\n lst.append(-1 if S[i] == \">\" else 1)\nans = [0]\nfor i in lst:\n if i > 0:\n ans += list(range(1, i + 1))\n else:\n ans[-1] = max(ans[-1], -i)\n ans += list(range(-i - 1, -1, -1))\nprint((sum(ans)))\n", "code_same": false, "relative_loc_diff_percent": 5.0, "diff": ["-for i in range(len(lst)):", "- if lst[i] > 0:", "- ans += list(range(1, lst[i] + 1))", "+for i in lst:", "+ if i > 0:", "+ ans += list(range(1, i + 1))", "- ans[-1] = max(ans[-1], -lst[i])", "- ans += list(range(-lst[i] - 1, -1, -1))", "+ ans[-1] = max(ans[-1], -i)", "+ ans += list(range(-i - 1, -1, -1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2820563465, "measured_runtime_v1": 0.2050767321, "runtime_lift": 1.3753698122, "key": ["s874712614", "s975354355"], "target_token_count_dream": 142, "target_token_bucket_dream": "128-256"} +{"user_id": "u231095456", "problem_id": "p03253", "language": "python", "submission_id_v0": "s968664754", "submission_id_v1": "s390670273", "cpu_time_v0": 89, "cpu_time_v1": 32, "memory_v0": 11252, "memory_v1": 9336, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 64.04, "input": "from math import floor, sqrt\n\nfrom collections import defaultdict\n\ndef factors(n):\n\n d = defaultdict(int)\n\n for i in range(2,floor(sqrt(n))+1):\n\n while n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n if n == 1:\n\n break\n\n if n != 1:\n\n d[n] += 1\n\n return d\n\ndef inv(x, mod):\n\n k = mod - 2\n\n ret = 1\n\n while k > 0:\n\n if k&1:\n\n ret = (ret*x) % mod\n\n x = (x*x) % mod\n\n k >>= 1\n\n return ret\n\nN, M = list(map(int,input().split()))\n\nmod = 10**9+7\n\ndic = factors(M)\n\nK = len(dic)\n\nSIZE = N+max(dic.values()) if list(dic.values()) else N\n\nfact = [None]*(SIZE+1)\n\nfinv = [None]*(SIZE+1)\n\nfact[0] = 1\n\nfor i in range(1,SIZE+1):\n\n fact[i] = (fact[i-1]*i) % mod\n\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\n\nfor i in range(SIZE, 0, -1):\n\n finv[i-1] = (finv[i]*i) % mod\n\ndef comb(n,k):\n\n tmp = (finv[k]*finv[n-k]) % mod\n\n return (fact[n]*tmp) % mod\n\nans = 1\n\nfor p in dic:\n\n ans = (ans*comb(dic[p]+N-1, dic[p])) % mod\n\nprint(ans)", "target": "from math import floor, sqrt\n\nfrom collections import defaultdict\n\nN,M = list(map(int,input().split()))\n\nd = defaultdict(int)\n\nfor i in range(2, floor(sqrt(M))+1):\n\n while M % i == 0:\n\n d[i] += 1\n\n M //= i\n\nif M != 1:\n\n d[M] += 1\n\ndef comb(n,k):\n\n if k == 0:\n\n return 1\n\n return comb(n-1,k-1) * n // k\n\nans = 1\n\nfor e in list(d.values()):\n\n ans *= comb(N+e-1, e)\n\nprint((ans % (10**9+7)))", "code_v0_loc": 42, "code_v1_loc": 18, "code_v0_num_chars": 1009, "code_v1_num_chars": 410, "code_v0_no_empty_lines": "from math import floor, sqrt\nfrom collections import defaultdict\n\n\ndef factors(n):\n d = defaultdict(int)\n for i in range(2, floor(sqrt(n)) + 1):\n while n % i == 0:\n n //= i\n d[i] += 1\n if n == 1:\n break\n if n != 1:\n d[n] += 1\n return d\n\n\ndef inv(x, mod):\n k = mod - 2\n ret = 1\n while k > 0:\n if k & 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n k >>= 1\n return ret\n\n\nN, M = list(map(int, input().split()))\nmod = 10**9 + 7\ndic = factors(M)\nK = len(dic)\nSIZE = N + max(dic.values()) if list(dic.values()) else N\nfact = [None] * (SIZE + 1)\nfinv = [None] * (SIZE + 1)\nfact[0] = 1\nfor i in range(1, SIZE + 1):\n fact[i] = (fact[i - 1] * i) % mod\nfinv[SIZE] = inv(fact[SIZE], mod=mod)\nfor i in range(SIZE, 0, -1):\n finv[i - 1] = (finv[i] * i) % mod\n\n\ndef comb(n, k):\n tmp = (finv[k] * finv[n - k]) % mod\n return (fact[n] * tmp) % mod\n\n\nans = 1\nfor p in dic:\n ans = (ans * comb(dic[p] + N - 1, dic[p])) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "from math import floor, sqrt\nfrom collections import defaultdict\n\nN, M = list(map(int, input().split()))\nd = defaultdict(int)\nfor i in range(2, floor(sqrt(M)) + 1):\n while M % i == 0:\n d[i] += 1\n M //= i\nif M != 1:\n d[M] += 1\n\n\ndef comb(n, k):\n if k == 0:\n return 1\n return comb(n - 1, k - 1) * n // k\n\n\nans = 1\nfor e in list(d.values()):\n ans *= comb(N + e - 1, e)\nprint((ans % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-", "-def factors(n):", "- d = defaultdict(int)", "- for i in range(2, floor(sqrt(n)) + 1):", "- while n % i == 0:", "- n //= i", "- d[i] += 1", "- if n == 1:", "- break", "- if n != 1:", "- d[n] += 1", "- return d", "-", "-", "-def inv(x, mod):", "- k = mod - 2", "- ret = 1", "- while k > 0:", "- if k & 1:", "- ret = (ret * x) % mod", "- x = (x * x) % mod", "- k >>= 1", "- return ret", "-", "-", "-mod = 10**9 + 7", "-dic = factors(M)", "-K = len(dic)", "-SIZE = N + max(dic.values()) if list(dic.values()) else N", "-fact = [None] * (SIZE + 1)", "-finv = [None] * (SIZE + 1)", "-fact[0] = 1", "-for i in range(1, SIZE + 1):", "- fact[i] = (fact[i - 1] * i) % mod", "-finv[SIZE] = inv(fact[SIZE], mod=mod)", "-for i in range(SIZE, 0, -1):", "- finv[i - 1] = (finv[i] * i) % mod", "+d = defaultdict(int)", "+for i in range(2, floor(sqrt(M)) + 1):", "+ while M % i == 0:", "+ d[i] += 1", "+ M //= i", "+if M != 1:", "+ d[M] += 1", "- tmp = (finv[k] * finv[n - k]) % mod", "- return (fact[n] * tmp) % mod", "+ if k == 0:", "+ return 1", "+ return comb(n - 1, k - 1) * n // k", "-for p in dic:", "- ans = (ans * comb(dic[p] + N - 1, dic[p])) % mod", "-print(ans)", "+for e in list(d.values()):", "+ ans *= comb(N + e - 1, e)", "+print((ans % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3098533685, "measured_runtime_v1": 0.2185445104, "runtime_lift": 1.4178044005, "key": ["s968664754", "s390670273"], "target_token_count_dream": 145, "target_token_bucket_dream": "128-256"} +{"user_id": "u118019047", "problem_id": "p03416", "language": "python", "submission_id_v0": "s640144582", "submission_id_v1": "s252292470", "cpu_time_v0": 78, "cpu_time_v1": 54, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.77, "input": "a , b = input().split()\n\na = int(a)\n\nb = int(b)\n\ncount=0\n\nfor i in range(a,b+1):\n\n test = list(str(i))\n\n if (test[0] == test[4]) and (test[1]==test[3]):\n\n count=count+1\n\nprint(count)", "target": "A,B=list(map(int,input().split()))\n\nct=0\n\nfor i in range(A,B+1):\n\n s=str(i)\n\n if s==s[::-1]:\n\n ct+=1\n\nprint(ct)", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 195, "code_v1_num_chars": 118, "code_v0_no_empty_lines": "a, b = input().split()\na = int(a)\nb = int(b)\ncount = 0\nfor i in range(a, b + 1):\n test = list(str(i))\n if (test[0] == test[4]) and (test[1] == test[3]):\n count = count + 1\nprint(count)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nct = 0\nfor i in range(A, B + 1):\n s = str(i)\n if s == s[::-1]:\n ct += 1\nprint(ct)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-a, b = input().split()", "-a = int(a)", "-b = int(b)", "-count = 0", "-for i in range(a, b + 1):", "- test = list(str(i))", "- if (test[0] == test[4]) and (test[1] == test[3]):", "- count = count + 1", "-print(count)", "+A, B = list(map(int, input().split()))", "+ct = 0", "+for i in range(A, B + 1):", "+ s = str(i)", "+ if s == s[::-1]:", "+ ct += 1", "+print(ct)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4764800201, "measured_runtime_v1": 0.3351052109, "runtime_lift": 1.4218818588, "key": ["s640144582", "s252292470"], "target_token_count_dream": 43, "target_token_bucket_dream": "<128"} +{"user_id": "u562016607", "problem_id": "p03835", "language": "python", "submission_id_v0": "s390314187", "submission_id_v1": "s016239384", "cpu_time_v0": 1476, "cpu_time_v1": 282, "memory_v0": 2940, "memory_v1": 41180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.89, "input": "K,S=list(map(int,input().split()))\n\nO=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n O+=1\n\nprint(O)\n", "target": "K,S=list(map(int,input().split()))\n\nans=0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z=S-X-Y\n\n if 0<=Z<=K:\n\n ans+=1\n\nprint(ans)\n", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 132, "code_v1_num_chars": 154, "code_v0_no_empty_lines": "K, S = list(map(int, input().split()))\nO = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if 0 <= Z <= K:\n O += 1\nprint(O)\n", "code_v1_no_empty_lines": "K, S = list(map(int, input().split()))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if 0 <= Z <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-O = 0", "+ans = 0", "- O += 1", "-print(O)", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2257852338, "measured_runtime_v1": 0.0060590109, "runtime_lift": 37.2643715379, "key": ["s390314187", "s016239384"], "target_token_count_dream": 53, "target_token_bucket_dream": "<128"} +{"user_id": "u631277801", "problem_id": "p04020", "language": "python", "submission_id_v0": "s879592559", "submission_id_v1": "s107006666", "cpu_time_v0": 164, "cpu_time_v1": 99, "memory_v0": 19100, "memory_v1": 7072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.63, "input": "import sys\n\nstdin = sys.stdin\n\n \n\nsys.setrecursionlimit(10**8) \n\n \n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x)-1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\n\n\nn = ni()\n\na = [ni() for _ in range(n)]\n\n\n\ncnt = {i+1: ai for i, ai in enumerate(a)}\n\n\n\nprev = -100\n\ncur = 0\n\nans = 0\n\nfor key in sorted(cnt.keys()):\n\n if cnt[key] == 0:\n\n continue\n\n \n\n if prev == -100:\n\n prev = key\n\n \n\n if (key-prev) < 2:\n\n cur += cnt[key]\n\n else:\n\n cur = cnt[key]\n\n \n\n ans += cur // 2\n\n cur -= 2 * (cur//2)\n\n \n\n prev = key\n\n \n\nprint(ans)", "target": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\n\n\nans = 0\n\nplus = 0\n\na = [ni() for _ in range(n)]\n\n\n\nfor ai in a:\n\n ans += ((ai+plus) // 2)\n\n plus = (ai+plus) % 2 if ai > 0 else 0\n\n\n\nprint(ans)", "code_v0_loc": 41, "code_v1_loc": 25, "code_v0_num_chars": 874, "code_v1_num_chars": 607, "code_v0_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**8)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\na = [ni() for _ in range(n)]\ncnt = {i + 1: ai for i, ai in enumerate(a)}\nprev = -100\ncur = 0\nans = 0\nfor key in sorted(cnt.keys()):\n if cnt[key] == 0:\n continue\n if prev == -100:\n prev = key\n if (key - prev) < 2:\n cur += cnt[key]\n else:\n cur = cnt[key]\n ans += cur // 2\n cur -= 2 * (cur // 2)\n prev = key\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nans = 0\nplus = 0\na = [ni() for _ in range(n)]\nfor ai in a:\n ans += (ai + plus) // 2\n plus = (ai + plus) % 2 if ai > 0 else 0\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 39.0243902439, "diff": ["-sys.setrecursionlimit(10**8)", "+sys.setrecursionlimit(10**7)", "+ans = 0", "+plus = 0", "-cnt = {i + 1: ai for i, ai in enumerate(a)}", "-prev = -100", "-cur = 0", "-ans = 0", "-for key in sorted(cnt.keys()):", "- if cnt[key] == 0:", "- continue", "- if prev == -100:", "- prev = key", "- if (key - prev) < 2:", "- cur += cnt[key]", "- else:", "- cur = cnt[key]", "- ans += cur // 2", "- cur -= 2 * (cur // 2)", "- prev = key", "+for ai in a:", "+ ans += (ai + plus) // 2", "+ plus = (ai + plus) % 2 if ai > 0 else 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2743015865, "measured_runtime_v1": 0.1203746786, "runtime_lift": 2.278731621, "key": ["s879592559", "s107006666"], "target_token_count_dream": 174, "target_token_bucket_dream": "128-256"} +{"user_id": "u761529120", "problem_id": "p03164", "language": "python", "submission_id_v0": "s478711084", "submission_id_v1": "s154638745", "cpu_time_v0": 1151, "cpu_time_v1": 682, "memory_v0": 312192, "memory_v1": 334552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.75, "input": "def main():\n\n N, W = list(map(int, input().split()))\n\n w = [0] * N\n\n v = [0] * N\n\n for i in range(N):\n\n w[i], v[i] = list(map(int, input().split()))\n\n\n\n max_v = max(v)\n\n dp = [[float('inf')] * (max_v * N + 5) for _ in range(N + 5)]\n\n\n\n dp[0][0] = 0\n\n\n\n for i in range(N):\n\n for j in range(max_v * N):\n\n if j + v[i] <= max_v * N:\n\n dp[i+1][j + v[i]] = min(dp[i+1][j + v[i]], dp[i][j] + w[i])\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j]) \n\n\n\n ans = 0\n\n for j in range(max_v * N + 1):\n\n if dp[N][j] <= W:\n\n ans = j\n\n\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "def main():\n\n N, W = list(map(int, input().split()))\n\n weight = [0] * N\n\n value = [0] * N\n\n for i in range(N):\n\n weight[i], value[i] = list(map(int, input().split()))\n\n V = sum(value)\n\n dp = [[float('inf')] * (V + 5) for _ in range(N + 5)]\n\n dp[0][0] = 0\n\n for i in range(N):\n\n for v in range(V+1):\n\n if v - value[i] >= 0:\n\n dp[i+1][v] = min(dp[i][v-value[i]] + weight[i], dp[i][v])\n\n else:\n\n dp[i+1][v] = dp[i][v]\n\n ans = 0\n\n for v in range(V+1):\n\n if dp[N][v] <= W:\n\n ans = v\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 27, "code_v1_loc": 23, "code_v0_num_chars": 654, "code_v1_num_chars": 637, "code_v0_no_empty_lines": "def main():\n N, W = list(map(int, input().split()))\n w = [0] * N\n v = [0] * N\n for i in range(N):\n w[i], v[i] = list(map(int, input().split()))\n max_v = max(v)\n dp = [[float(\"inf\")] * (max_v * N + 5) for _ in range(N + 5)]\n dp[0][0] = 0\n for i in range(N):\n for j in range(max_v * N):\n if j + v[i] <= max_v * N:\n dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i])\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n ans = 0\n for j in range(max_v * N + 1):\n if dp[N][j] <= W:\n ans = j\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n N, W = list(map(int, input().split()))\n weight = [0] * N\n value = [0] * N\n for i in range(N):\n weight[i], value[i] = list(map(int, input().split()))\n V = sum(value)\n dp = [[float(\"inf\")] * (V + 5) for _ in range(N + 5)]\n dp[0][0] = 0\n for i in range(N):\n for v in range(V + 1):\n if v - value[i] >= 0:\n dp[i + 1][v] = min(dp[i][v - value[i]] + weight[i], dp[i][v])\n else:\n dp[i + 1][v] = dp[i][v]\n ans = 0\n for v in range(V + 1):\n if dp[N][v] <= W:\n ans = v\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 14.8148148148, "diff": ["- w = [0] * N", "- v = [0] * N", "+ weight = [0] * N", "+ value = [0] * N", "- w[i], v[i] = list(map(int, input().split()))", "- max_v = max(v)", "- dp = [[float(\"inf\")] * (max_v * N + 5) for _ in range(N + 5)]", "+ weight[i], value[i] = list(map(int, input().split()))", "+ V = sum(value)", "+ dp = [[float(\"inf\")] * (V + 5) for _ in range(N + 5)]", "- for j in range(max_v * N):", "- if j + v[i] <= max_v * N:", "- dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i])", "- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])", "+ for v in range(V + 1):", "+ if v - value[i] >= 0:", "+ dp[i + 1][v] = min(dp[i][v - value[i]] + weight[i], dp[i][v])", "+ else:", "+ dp[i + 1][v] = dp[i][v]", "- for j in range(max_v * N + 1):", "- if dp[N][j] <= W:", "- ans = j", "+ for v in range(V + 1):", "+ if dp[N][v] <= W:", "+ ans = v"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2676751952, "measured_runtime_v1": 0.1215952404, "runtime_lift": 2.2013624416, "key": ["s478711084", "s154638745"], "target_token_count_dream": 214, "target_token_bucket_dream": "128-256"} +{"user_id": "u812576525", "problem_id": "p03309", "language": "python", "submission_id_v0": "s649374585", "submission_id_v1": "s527849910", "cpu_time_v0": 249, "cpu_time_v1": 171, "memory_v0": 26180, "memory_v1": 30980, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 31.33, "input": "n = int(input())\n\na = list(map(int,input().split()))\n\naa = []\n\nfor i in range(n):\n\n aa.append(a[i]-(i+1))\n\nb = (sorted(aa)[n//2])\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans += abs(a[i]-(b+i+1))\n\nprint(ans)", "target": "N= int(input())\n\nA = list(map(int,input().split()))\n\n\n\nB = []\n\nfor i in range(N):\n\n B.append(A[i]-(i+1))\n\n#print(B)\n\nb= (sorted(B)[N//2])\n\n#print(b)\n\nans = 0\n\nfor i in range(N):\n\n ans += abs(B[i]-b)\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 13, "code_v0_num_chars": 205, "code_v1_num_chars": 216, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\naa = []\nfor i in range(n):\n aa.append(a[i] - (i + 1))\nb = sorted(aa)[n // 2]\nans = 0\nfor i in range(n):\n ans += abs(a[i] - (b + i + 1))\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nB = []\nfor i in range(N):\n B.append(A[i] - (i + 1))\n# print(B)\nb = sorted(B)[N // 2]\n# print(b)\nans = 0\nfor i in range(N):\n ans += abs(B[i] - b)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["-n = int(input())", "-a = list(map(int, input().split()))", "-aa = []", "-for i in range(n):", "- aa.append(a[i] - (i + 1))", "-b = sorted(aa)[n // 2]", "+N = int(input())", "+A = list(map(int, input().split()))", "+B = []", "+for i in range(N):", "+ B.append(A[i] - (i + 1))", "+# print(B)", "+b = sorted(B)[N // 2]", "+# print(b)", "-for i in range(n):", "- ans += abs(a[i] - (b + i + 1))", "+for i in range(N):", "+ ans += abs(B[i] - b)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.277994447, "measured_runtime_v1": 0.0063325391, "runtime_lift": 43.8993653214, "key": ["s649374585", "s527849910"], "target_token_count_dream": 74, "target_token_bucket_dream": "<128"} +{"user_id": "u864197622", "problem_id": "p02794", "language": "python", "submission_id_v0": "s167224132", "submission_id_v1": "s245735210", "cpu_time_v0": 294, "cpu_time_v1": 228, "memory_v0": 50156, "memory_v1": 49128, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.45, "input": "N = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(input())\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\nD = {1<>= 17\n\n bc += BC[aa % (1<<17)]\n\n aa >>= 17\n\n bc += BC[aa]\n\n CC[N - 1 - bc] += (1 if BC[m%1024] + BC[m>>10] & 1 == 0 else -1)\n\n\n\nprint((sum([2 ** i * CC[i] for i in range(N)])))", "target": "N = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\n\n\nP = [-1] * N\n\nDE = [0] * N\n\nQ = [0]\n\nwhile Q:\n\n i = Q.pop()\n\n for a in X[i][::-1]:\n\n if a != P[i]:\n\n P[a] = i\n\n DE[a] = DE[i] + 1\n\n X[a].remove(i)\n\n Q.append(a)\n\n\n\ndef lp(u, v):\n\n t = 0\n\n while u != v:\n\n if DE[u] > DE[v]:\n\n t += 1 << u-1\n\n u = P[u]\n\n elif DE[u] < DE[v]:\n\n t += 1 << v-1\n\n v = P[v]\n\n else:\n\n t += 1 << u-1\n\n t += 1 << v-1\n\n u = P[u]\n\n v = P[v]\n\n \n\n return t\n\n\n\nY = []\n\nM = int(input())\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n Y.append(lp(a, b))\n\n\n\ndef popcnt(n):\n\n c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)\n\n c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)\n\n c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)\n\n c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)\n\n c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)\n\n c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)\n\n return c\n\n\n\nD = {1< DE[v]:\n t += 1 << u - 1\n u = P[u]\n elif DE[u] < DE[v]:\n t += 1 << v - 1\n v = P[v]\n else:\n t += 1 << u - 1\n t += 1 << v - 1\n u = P[u]\n v = P[v]\n return t\n\n\nY = []\nM = int(input())\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n Y.append(lp(a, b))\nD = {1 << i: i for i in range(50)}\nZ = [0] * (1 << M)\nans = 0\nCC = [0] * N\nBC = [0] * (1 << 17)\nfor m in range(1, 1 << 17):\n a = m & (-m)\n BC[m] = BC[m ^ a] + 1\nfor m in range(1 << M):\n a = m & (-m)\n if a == m:\n if a == 0:\n Z[m] = 0\n else:\n Z[m] = Y[D[a]]\n else:\n Z[m] = Z[m ^ a] | Y[D[a]]\n aa = Z[m]\n bc = BC[aa % (1 << 17)]\n aa >>= 17\n bc += BC[aa % (1 << 17)]\n aa >>= 17\n bc += BC[aa]\n CC[N - 1 - bc] += 1 if BC[m % 1024] + BC[m >> 10] & 1 == 0 else -1\nprint((sum([2**i * CC[i] for i in range(N)])))\n", "code_v1_no_empty_lines": "N = int(input())\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\nP = [-1] * N\nDE = [0] * N\nQ = [0]\nwhile Q:\n i = Q.pop()\n for a in X[i][::-1]:\n if a != P[i]:\n P[a] = i\n DE[a] = DE[i] + 1\n X[a].remove(i)\n Q.append(a)\n\n\ndef lp(u, v):\n t = 0\n while u != v:\n if DE[u] > DE[v]:\n t += 1 << u - 1\n u = P[u]\n elif DE[u] < DE[v]:\n t += 1 << v - 1\n v = P[v]\n else:\n t += 1 << u - 1\n t += 1 << v - 1\n u = P[u]\n v = P[v]\n return t\n\n\nY = []\nM = int(input())\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n Y.append(lp(a, b))\n\n\ndef popcnt(n):\n c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)\n c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)\n c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)\n c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)\n c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)\n c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)\n return c\n\n\nD = {1 << i: i for i in range(50)}\nZ = [0] * (1 << M)\nans = 0\nCC = [0] * N\nfor m in range(1 << M):\n a = m & (-m)\n if a == m:\n if a == 0:\n Z[m] = 0\n else:\n Z[m] = Y[D[a]]\n else:\n Z[m] = Z[m ^ a] | Y[D[a]]\n CC[N - 1 - popcnt(Z[m])] += 1 if popcnt(m) & 1 == 0 else -1\nprint((sum([2**i * CC[i] for i in range(N)])))\n", "code_same": false, "relative_loc_diff_percent": 1.4285714286, "diff": ["+", "+", "+def popcnt(n):", "+ c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)", "+ c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)", "+ c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)", "+ c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)", "+ c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)", "+ c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)", "+ return c", "+", "+", "-BC = [0] * (1 << 17)", "-for m in range(1, 1 << 17):", "- a = m & (-m)", "- BC[m] = BC[m ^ a] + 1", "- aa = Z[m]", "- bc = BC[aa % (1 << 17)]", "- aa >>= 17", "- bc += BC[aa % (1 << 17)]", "- aa >>= 17", "- bc += BC[aa]", "- CC[N - 1 - bc] += 1 if BC[m % 1024] + BC[m >> 10] & 1 == 0 else -1", "+ CC[N - 1 - popcnt(Z[m])] += 1 if popcnt(m) & 1 == 0 else -1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4825011034, "measured_runtime_v1": 0.2223737774, "runtime_lift": 2.1697751823, "key": ["s167224132", "s245735210"], "target_token_count_dream": 744, "target_token_bucket_dream": "512-1024"} +{"user_id": "u057109575", "problem_id": "p03078", "language": "python", "submission_id_v0": "s065985582", "submission_id_v1": "s294135268", "cpu_time_v0": 153, "cpu_time_v1": 124, "memory_v0": 79232, "memory_v1": 73392, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.95, "input": "\n\nfrom heapq import heappop, heappush\n\n\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\npq = []\n\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\n\nappeared = set((0, 0, 0))\n\n\n\nfor _ in range(K):\n\n # Pop maximum value\n\n val, i, j, k = heappop(pq)\n\n print((-val))\n\n\n\n # Add next value\n\n if i + 1 < X and (i + 1, j, k) not in appeared:\n\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n\n appeared.add((i + 1, j, k))\n\n\n\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n\n appeared.add((i, j + 1, k))\n\n\n\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n\n appeared.add((i, j, k + 1))\n", "target": "\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\nres = []\n\nfor i in range(X):\n\n for j in range(Y):\n\n for k in range(Z):\n\n if (i + 1) * (j + 1) * (k + 1) <= K:\n\n res.append(A[i] + B[j] + C[k])\n\n else:\n\n break\n\n\n\nres.sort(reverse=True)\n\nfor i in range(K):\n\n print((res[i]))\n", "code_v0_loc": 33, "code_v1_loc": 22, "code_v0_num_chars": 923, "code_v1_num_chars": 509, "code_v0_no_empty_lines": "from heapq import heappop, heappush\n\nX, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort(reverse=True)\nB.sort(reverse=True)\nC.sort(reverse=True)\npq = []\nheappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))\nappeared = set((0, 0, 0))\nfor _ in range(K):\n # Pop maximum value\n val, i, j, k = heappop(pq)\n print((-val))\n # Add next value\n if i + 1 < X and (i + 1, j, k) not in appeared:\n heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))\n appeared.add((i + 1, j, k))\n if j + 1 < Y and (i, j + 1, k) not in appeared:\n heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))\n appeared.add((i, j + 1, k))\n if k + 1 < Z and (i, j, k + 1) not in appeared:\n heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))\n appeared.add((i, j, k + 1))\n", "code_v1_no_empty_lines": "X, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort(reverse=True)\nB.sort(reverse=True)\nC.sort(reverse=True)\nres = []\nfor i in range(X):\n for j in range(Y):\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) <= K:\n res.append(A[i] + B[j] + C[k])\n else:\n break\nres.sort(reverse=True)\nfor i in range(K):\n print((res[i]))\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-from heapq import heappop, heappush", "-", "-pq = []", "-heappush(pq, (-A[0] - B[0] - C[0], 0, 0, 0))", "-appeared = set((0, 0, 0))", "-for _ in range(K):", "- # Pop maximum value", "- val, i, j, k = heappop(pq)", "- print((-val))", "- # Add next value", "- if i + 1 < X and (i + 1, j, k) not in appeared:", "- heappush(pq, (-A[i + 1] - B[j] - C[k], i + 1, j, k))", "- appeared.add((i + 1, j, k))", "- if j + 1 < Y and (i, j + 1, k) not in appeared:", "- heappush(pq, (-A[i] - B[j + 1] - C[k], i, j + 1, k))", "- appeared.add((i, j + 1, k))", "- if k + 1 < Z and (i, j, k + 1) not in appeared:", "- heappush(pq, (-A[i] - B[j] - C[k + 1], i, j, k + 1))", "- appeared.add((i, j, k + 1))", "+res = []", "+for i in range(X):", "+ for j in range(Y):", "+ for k in range(Z):", "+ if (i + 1) * (j + 1) * (k + 1) <= K:", "+ res.append(A[i] + B[j] + C[k])", "+ else:", "+ break", "+res.sort(reverse=True)", "+for i in range(K):", "+ print((res[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3859105117, "measured_runtime_v1": 0.2075348065, "runtime_lift": 1.8594977789, "key": ["s065985582", "s294135268"], "target_token_count_dream": 148, "target_token_bucket_dream": "128-256"} +{"user_id": "u944325914", "problem_id": "p02773", "language": "python", "submission_id_v0": "s220148525", "submission_id_v1": "s009987907", "cpu_time_v0": 1010, "cpu_time_v1": 521, "memory_v0": 104656, "memory_v1": 50176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.42, "input": "import collections\n\nn = int(input())\n\na=[input() for _ in range(n)]\n\nanslist=[]\n\nb=collections.Counter(a)\n\nc=max(list(b.values()))\n\nfor i in b:\n\n if b[i]==c:\n\n anslist.append(i)\n\nd=sorted(anslist)\n\nfor i in tuple(d):\n\n print(i)", "target": "from collections import Counter\n\nn=int(input())\n\na=[]\n\nfor i in range(n):\n\n a.append(input())\n\nac=Counter(a)\n\nacs=sorted(list(ac.items()),key=lambda x:x[1],reverse=1)\n\nz=len(acs)\n\ni=0\n\ntemp=[]\n\n\n\nwhile i<=z-1 and acs[i][1]==acs[0][1] :\n\n temp.append(acs[i][0])\n\n i+=1\n\ntemp.sort()\n\nfor i in temp:\n\n print(i)", "code_v0_loc": 12, "code_v1_loc": 17, "code_v0_num_chars": 240, "code_v1_num_chars": 305, "code_v0_no_empty_lines": "import collections\n\nn = int(input())\na = [input() for _ in range(n)]\nanslist = []\nb = collections.Counter(a)\nc = max(list(b.values()))\nfor i in b:\n if b[i] == c:\n anslist.append(i)\nd = sorted(anslist)\nfor i in tuple(d):\n print(i)\n", "code_v1_no_empty_lines": "from collections import Counter\n\nn = int(input())\na = []\nfor i in range(n):\n a.append(input())\nac = Counter(a)\nacs = sorted(list(ac.items()), key=lambda x: x[1], reverse=1)\nz = len(acs)\ni = 0\ntemp = []\nwhile i <= z - 1 and acs[i][1] == acs[0][1]:\n temp.append(acs[i][0])\n i += 1\ntemp.sort()\nfor i in temp:\n print(i)\n", "code_same": false, "relative_loc_diff_percent": 29.4117647059, "diff": ["-import collections", "+from collections import Counter", "-a = [input() for _ in range(n)]", "-anslist = []", "-b = collections.Counter(a)", "-c = max(list(b.values()))", "-for i in b:", "- if b[i] == c:", "- anslist.append(i)", "-d = sorted(anslist)", "-for i in tuple(d):", "+a = []", "+for i in range(n):", "+ a.append(input())", "+ac = Counter(a)", "+acs = sorted(list(ac.items()), key=lambda x: x[1], reverse=1)", "+z = len(acs)", "+i = 0", "+temp = []", "+while i <= z - 1 and acs[i][1] == acs[0][1]:", "+ temp.append(acs[i][0])", "+ i += 1", "+temp.sort()", "+for i in temp:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3929853504, "measured_runtime_v1": 0.3037585902, "runtime_lift": 1.2937423435, "key": ["s220148525", "s009987907"], "target_token_count_dream": 104, "target_token_bucket_dream": "<128"} +{"user_id": "u857759499", "problem_id": "p03371", "language": "python", "submission_id_v0": "s203363465", "submission_id_v1": "s893730989", "cpu_time_v0": 85, "cpu_time_v1": 17, "memory_v0": 7096, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.0, "input": "a,b,c,x,y = list(map(int,input().split()))\n\nxy = max(x,y)*2+1\n\nprint((min([c*i + max(0,a*(x-i//2)) +max(0,b*(y-i//2)) for i in range(0,xy,2)])))", "target": "a,b,c,x,y = list(map(int,input().split()))\n\nif x < y:\n\n a, b, x, y = b, a, y, x\n\nprint((min(a*x+b*y,2*c*y + a*(x-y),2*c*x)))", "code_v0_loc": 3, "code_v1_loc": 4, "code_v0_num_chars": 136, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nxy = max(x, y) * 2 + 1\nprint(\n (\n min(\n [\n c * i + max(0, a * (x - i // 2)) + max(0, b * (y - i // 2))\n for i in range(0, xy, 2)\n ]\n )\n )\n)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nif x < y:\n a, b, x, y = b, a, y, x\nprint((min(a * x + b * y, 2 * c * y + a * (x - y), 2 * c * x)))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-xy = max(x, y) * 2 + 1", "-print(", "- (", "- min(", "- [", "- c * i + max(0, a * (x - i // 2)) + max(0, b * (y - i // 2))", "- for i in range(0, xy, 2)", "- ]", "- )", "- )", "-)", "+if x < y:", "+ a, b, x, y = b, a, y, x", "+print((min(a * x + b * y, 2 * c * y + a * (x - y), 2 * c * x)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2887920134, "measured_runtime_v1": 0.2046661584, "runtime_lift": 1.4110394, "key": ["s203363465", "s893730989"], "target_token_count_dream": 56, "target_token_bucket_dream": "<128"} +{"user_id": "u628732336", "problem_id": "p02412", "language": "python", "submission_id_v0": "s343999289", "submission_id_v1": "s206971885", "cpu_time_v0": 1010, "cpu_time_v1": 530, "memory_v0": 7716, "memory_v1": 7724, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.52, "input": "while True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == sum([s, m, e]):\n\n count += 1\n\n\n\n print(count)", "target": "while True:\n\n n, x = [int(i) for i in input().split()]\n\n\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for s in range(1, n - 1):\n\n for m in range(s + 1, n):\n\n for e in range(m + 1, n + 1):\n\n if x == s+m+e:\n\n count += 1\n\n\n\n print(count)", "code_v0_loc": 14, "code_v1_loc": 14, "code_v0_num_chars": 314, "code_v1_num_chars": 305, "code_v0_no_empty_lines": "while True:\n n, x = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for s in range(1, n - 1):\n for m in range(s + 1, n):\n for e in range(m + 1, n + 1):\n if x == sum([s, m, e]):\n count += 1\n print(count)\n", "code_v1_no_empty_lines": "while True:\n n, x = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for s in range(1, n - 1):\n for m in range(s + 1, n):\n for e in range(m + 1, n + 1):\n if x == s + m + e:\n count += 1\n print(count)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if x == sum([s, m, e]):", "+ if x == s + m + e:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3385973902, "measured_runtime_v1": 0.2597145021, "runtime_lift": 1.3037292389, "key": ["s343999289", "s206971885"], "target_token_count_dream": 97, "target_token_bucket_dream": "<128"} +{"user_id": "u867826040", "problem_id": "p02837", "language": "python", "submission_id_v0": "s705992872", "submission_id_v1": "s870269222", "cpu_time_v0": 258, "cpu_time_v1": 223, "memory_v0": 9120, "memory_v1": 9160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.57, "input": "n = int(input())\n\nv = [[tuple(map(int, input().split()))for i in range(int(input()))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [False] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = True\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n if f[x - 1] is not bool(y):\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n", "target": "n = int(input())\n\nv = [[tuple(map(int, input().split()))for i in range(int(input()))]\n\n for i in range(n)]\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n f = [0] * n\n\n xy = []\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n f[j] = 1\n\n xy.append(v[j])\n\n flag = True\n\n for xyi in xy:\n\n for x, y in xyi:\n\n #print(f,x,y,bin(i))\n\n if (i>>(x-1))&1 != y:\n\n flag = False\n\n break\n\n if flag:\n\n ans = max(ans, len(xy))\n\nprint(ans)\n", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 499, "code_v1_num_chars": 520, "code_v0_no_empty_lines": "n = int(input())\nv = [\n [tuple(map(int, input().split())) for i in range(int(input()))]\n for i in range(n)\n]\nans = 0\nfor i in range(2**n):\n f = [False] * n\n xy = []\n for j in range(n):\n if (i >> j) & 1:\n f[j] = True\n xy.append(v[j])\n flag = True\n for xyi in xy:\n for x, y in xyi:\n if f[x - 1] is not bool(y):\n flag = False\n break\n if flag:\n ans = max(ans, len(xy))\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nv = [\n [tuple(map(int, input().split())) for i in range(int(input()))]\n for i in range(n)\n]\nans = 0\nfor i in range(2**n):\n f = [0] * n\n xy = []\n for j in range(n):\n if (i >> j) & 1:\n f[j] = 1\n xy.append(v[j])\n flag = True\n for xyi in xy:\n for x, y in xyi:\n # print(f,x,y,bin(i))\n if (i >> (x - 1)) & 1 != y:\n flag = False\n break\n if flag:\n ans = max(ans, len(xy))\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["- f = [False] * n", "+ f = [0] * n", "- f[j] = True", "+ f[j] = 1", "- if f[x - 1] is not bool(y):", "+ # print(f,x,y,bin(i))", "+ if (i >> (x - 1)) & 1 != y:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.289290843, "measured_runtime_v1": 0.2134317408, "runtime_lift": 1.3554255893, "key": ["s705992872", "s870269222"], "target_token_count_dream": 160, "target_token_bucket_dream": "128-256"} +{"user_id": "u102461423", "problem_id": "p03000", "language": "python", "submission_id_v0": "s091839409", "submission_id_v1": "s096312338", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N,X = list(map(int,input().split()))\n\nL = [0] + [int(x) for x in input().split()]\n\n\n\nD = [0] * (N+2)\n\nanswer = 1\n\nfor n in range(2,N+2):\n\n D[n] = D[n-1] + L[n-1]\n\n if D[n] <= X:\n\n answer += 1\n\n \n\nprint(answer)", "target": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nimport itertools\n\n\n\nN,X,*L = list(map(int,read().split()))\n\n\n\nanswer = sum(x <= X for x in itertools.accumulate([0]+L))\n\nprint(answer)", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 211, "code_v1_num_chars": 250, "code_v0_no_empty_lines": "N, X = list(map(int, input().split()))\nL = [0] + [int(x) for x in input().split()]\nD = [0] * (N + 2)\nanswer = 1\nfor n in range(2, N + 2):\n D[n] = D[n - 1] + L[n - 1]\n if D[n] <= X:\n answer += 1\nprint(answer)\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport itertools\n\nN, X, *L = list(map(int, read().split()))\nanswer = sum(x <= X for x in itertools.accumulate([0] + L))\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-N, X = list(map(int, input().split()))", "-L = [0] + [int(x) for x in input().split()]", "-D = [0] * (N + 2)", "-answer = 1", "-for n in range(2, N + 2):", "- D[n] = D[n - 1] + L[n - 1]", "- if D[n] <= X:", "- answer += 1", "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "+import itertools", "+", "+N, X, *L = list(map(int, read().split()))", "+answer = sum(x <= X for x in itertools.accumulate([0] + L))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4454345685, "measured_runtime_v1": 0.3287086122, "runtime_lift": 1.3551046487, "key": ["s091839409", "s096312338"], "target_token_count_dream": 63, "target_token_bucket_dream": "<128"} +{"user_id": "u133936772", "problem_id": "p02983", "language": "python", "submission_id_v0": "s915950177", "submission_id_v1": "s423283368", "cpu_time_v0": 97, "cpu_time_v1": 51, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.42, "input": "mod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r//mod - l//mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l+1, r+1):\n\n for j in range(l, i):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)", "target": "mod = 2019\n\nl, r = list(map(int, input().split()))\n\n\n\nif r//mod - l//mod > 0:\n\n print((0))\n\nelse:\n\n l %= mod\n\n r %= mod\n\n ans = mod\n\n for i in range(l, r):\n\n for j in range(i+1, r+1):\n\n ans = min(i*j%mod, ans)\n\n if ans == 0:\n\n break\n\n print(ans)", "code_v0_loc": 15, "code_v1_loc": 15, "code_v0_num_chars": 259, "code_v1_num_chars": 259, "code_v0_no_empty_lines": "mod = 2019\nl, r = list(map(int, input().split()))\nif r // mod - l // mod > 0:\n print((0))\nelse:\n l %= mod\n r %= mod\n ans = mod\n for i in range(l + 1, r + 1):\n for j in range(l, i):\n ans = min(i * j % mod, ans)\n if ans == 0:\n break\n print(ans)\n", "code_v1_no_empty_lines": "mod = 2019\nl, r = list(map(int, input().split()))\nif r // mod - l // mod > 0:\n print((0))\nelse:\n l %= mod\n r %= mod\n ans = mod\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n ans = min(i * j % mod, ans)\n if ans == 0:\n break\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- for i in range(l + 1, r + 1):", "- for j in range(l, i):", "+ for i in range(l, r):", "+ for j in range(i + 1, r + 1):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3490325066, "measured_runtime_v1": 0.2693671175, "runtime_lift": 1.2957502381, "key": ["s915950177", "s423283368"], "target_token_count_dream": 102, "target_token_bucket_dream": "<128"} +{"user_id": "u998741086", "problem_id": "p03425", "language": "python", "submission_id_v0": "s570150327", "submission_id_v1": "s255248054", "cpu_time_v0": 227, "cpu_time_v1": 144, "memory_v0": 16268, "memory_v1": 16064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 36.56, "input": "#!/usr/bin/env python3\n\n\n\nn = int(input())\n\ns = [input() for _ in range(n)]\n\n\n\nc = [0 for _ in range(5)]\n\nt = 'MARCH'\n\n\n\nfor i in range(n):\n\n for j in range(5):\n\n if s[i][0] == t[j]:\n\n c[j] += 1\n\nans = 0 \n\nfor i in range(5):\n\n for j in range(i+1, 5): \n\n for k in range(j+1, 5): \n\n ans += c[i]*c[k]*c[j]\n\nprint(ans)\n", "target": "#!/usr/bin/env python3\n\n\n\nn = int(input())\n\ns = [input() for _ in range(n)]\n\nd = {}\n\n\n\nfor c in s:\n\n if c[0] not in d:\n\n d[c[0]] = 1 \n\n else:\n\n d[c[0]] += 1\n\n\n\ntmp = d.copy()\n\nt = ['M', 'A', 'R', 'C', 'H']\n\nfor c in tmp:\n\n if c not in t:\n\n d.pop(c)\n\n\n\nans = 0 \n\ndlist = list(d.items())\n\nfor i in range(len(dlist)):\n\n for j in range(i+1, len(dlist)):\n\n for k in range(j+1, len(dlist)):\n\n ans += dlist[i][1]*dlist[j][1]*dlist[k][1]\n\nprint(ans)\n", "code_v0_loc": 18, "code_v1_loc": 25, "code_v0_num_chars": 357, "code_v1_num_chars": 493, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nn = int(input())\ns = [input() for _ in range(n)]\nc = [0 for _ in range(5)]\nt = \"MARCH\"\nfor i in range(n):\n for j in range(5):\n if s[i][0] == t[j]:\n c[j] += 1\nans = 0\nfor i in range(5):\n for j in range(i + 1, 5):\n for k in range(j + 1, 5):\n ans += c[i] * c[k] * c[j]\nprint(ans)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nn = int(input())\ns = [input() for _ in range(n)]\nd = {}\nfor c in s:\n if c[0] not in d:\n d[c[0]] = 1\n else:\n d[c[0]] += 1\ntmp = d.copy()\nt = [\"M\", \"A\", \"R\", \"C\", \"H\"]\nfor c in tmp:\n if c not in t:\n d.pop(c)\nans = 0\ndlist = list(d.items())\nfor i in range(len(dlist)):\n for j in range(i + 1, len(dlist)):\n for k in range(j + 1, len(dlist)):\n ans += dlist[i][1] * dlist[j][1] * dlist[k][1]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 28.0, "diff": ["-c = [0 for _ in range(5)]", "-t = \"MARCH\"", "-for i in range(n):", "- for j in range(5):", "- if s[i][0] == t[j]:", "- c[j] += 1", "+d = {}", "+for c in s:", "+ if c[0] not in d:", "+ d[c[0]] = 1", "+ else:", "+ d[c[0]] += 1", "+tmp = d.copy()", "+t = [\"M\", \"A\", \"R\", \"C\", \"H\"]", "+for c in tmp:", "+ if c not in t:", "+ d.pop(c)", "-for i in range(5):", "- for j in range(i + 1, 5):", "- for k in range(j + 1, 5):", "- ans += c[i] * c[k] * c[j]", "+dlist = list(d.items())", "+for i in range(len(dlist)):", "+ for j in range(i + 1, len(dlist)):", "+ for k in range(j + 1, len(dlist)):", "+ ans += dlist[i][1] * dlist[j][1] * dlist[k][1]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3218575408, "measured_runtime_v1": 0.2488505929, "runtime_lift": 1.2933766287, "key": ["s570150327", "s255248054"], "target_token_count_dream": 177, "target_token_bucket_dream": "128-256"} +{"user_id": "u661290476", "problem_id": "p00053", "language": "python", "submission_id_v0": "s978814614", "submission_id_v1": "s421101567", "cpu_time_v0": 420, "cpu_time_v1": 210, "memory_v0": 18368, "memory_v1": 51028, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "prim=[True]*1000000\n\nprim[0],prim[1]=False,False\n\nfor i in range(2,1000):\n\n if prim[i]:\n\n for j in range(i*2,1000000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(input())\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))", "target": "prim=[True]*1000000\n\nprim[0]=prim[1]=False\n\nfor i in range(2,350):\n\n if prim[i]:\n\n for j in range(i*2,110000,i):\n\n prim[j]=False\n\nprime=[i for i,j in enumerate(prim) if j==True]\n\n\n\nwhile True:\n\n n=int(input())\n\n if n==0:\n\n break\n\n print((sum(prime[:n])))", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 297, "code_v1_num_chars": 289, "code_v0_no_empty_lines": "prim = [True] * 1000000\nprim[0], prim[1] = False, False\nfor i in range(2, 1000):\n if prim[i]:\n for j in range(i * 2, 1000000, i):\n prim[j] = False\nprime = [i for i, j in enumerate(prim) if j == True]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(prime[:n])))\n", "code_v1_no_empty_lines": "prim = [True] * 1000000\nprim[0] = prim[1] = False\nfor i in range(2, 350):\n if prim[i]:\n for j in range(i * 2, 110000, i):\n prim[j] = False\nprime = [i for i, j in enumerate(prim) if j == True]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(prime[:n])))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-prim[0], prim[1] = False, False", "-for i in range(2, 1000):", "+prim[0] = prim[1] = False", "+for i in range(2, 350):", "- for j in range(i * 2, 1000000, i):", "+ for j in range(i * 2, 110000, i):"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0302433112, "measured_runtime_v1": 0.6551637814, "runtime_lift": 1.5724973516, "key": ["s978814614", "s421101567"], "target_token_count_dream": 103, "target_token_bucket_dream": "<128"} +{"user_id": "u347600233", "problem_id": "p03037", "language": "python", "submission_id_v0": "s661845965", "submission_id_v1": "s817506416", "cpu_time_v0": 279, "cpu_time_v1": 195, "memory_v0": 7088, "memory_v1": 16564, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.11, "input": "n, m = list(map(int, input().split()))\n\ngate = []\n\nl, r = list(map(int, input().split()))\n\nfor i in range(1, m):\n\n m, s = list(map(int, input().split()))\n\n if l < m:\n\n l = m\n\n if s < r:\n\n r = s\n\nprint((len([i for i in range(l, r + 1)])))", "target": "n, m = list(map(int, input().split()))\n\nl, r = [0] * m, [0] * m\n\nfor i in range(m):\n\n l[i], r[i] = list(map(int, input().split()))\n\nprint((max(min(r) - max(l) + 1, 0)))", "code_v0_loc": 10, "code_v1_loc": 5, "code_v0_num_chars": 240, "code_v1_num_chars": 157, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\ngate = []\nl, r = list(map(int, input().split()))\nfor i in range(1, m):\n m, s = list(map(int, input().split()))\n if l < m:\n l = m\n if s < r:\n r = s\nprint((len([i for i in range(l, r + 1)])))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nl, r = [0] * m, [0] * m\nfor i in range(m):\n l[i], r[i] = list(map(int, input().split()))\nprint((max(min(r) - max(l) + 1, 0)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-gate = []", "-l, r = list(map(int, input().split()))", "-for i in range(1, m):", "- m, s = list(map(int, input().split()))", "- if l < m:", "- l = m", "- if s < r:", "- r = s", "-print((len([i for i in range(l, r + 1)])))", "+l, r = [0] * m, [0] * m", "+for i in range(m):", "+ l[i], r[i] = list(map(int, input().split()))", "+print((max(min(r) - max(l) + 1, 0)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.317712152, "measured_runtime_v1": 0.2449507949, "runtime_lift": 1.2970447884, "key": ["s661845965", "s817506416"], "target_token_count_dream": 67, "target_token_bucket_dream": "<128"} +{"user_id": "u585963734", "problem_id": "p02596", "language": "python", "submission_id_v0": "s961921352", "submission_id_v1": "s631804156", "cpu_time_v0": 290, "cpu_time_v1": 180, "memory_v0": 48468, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.93, "input": "K=int(input())\n\n\n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n \n\nans=[0]*(pow(10,6)+1)\n\nans[0]=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n ans[i]=(ans[i-1]*10+7)%K\n\n if ans[i]==0:\n\n print(i)\n\n exit(0)\n\n\n\nprint((-1))", "target": "import functools\n\n\n\nK=int(input())\n\n \n\nif K%2==0:\n\n print((-1))\n\n exit(0)\n\n\n\nmod=0\n\n\n\nfor i in range(1,pow(10,6)):\n\n mod=(mod*10+7)%K\n\n if mod==0:\n\n print(i)\n\n exit(0)\n\n \n\nprint((-1))", "code_v0_loc": 16, "code_v1_loc": 17, "code_v0_num_chars": 224, "code_v1_num_chars": 212, "code_v0_no_empty_lines": "K = int(input())\nif K % 2 == 0:\n print((-1))\n exit(0)\nans = [0] * (pow(10, 6) + 1)\nans[0] = 0\nfor i in range(1, pow(10, 6)):\n ans[i] = (ans[i - 1] * 10 + 7) % K\n if ans[i] == 0:\n print(i)\n exit(0)\nprint((-1))\n", "code_v1_no_empty_lines": "import functools\n\nK = int(input())\nif K % 2 == 0:\n print((-1))\n exit(0)\nmod = 0\nfor i in range(1, pow(10, 6)):\n mod = (mod * 10 + 7) % K\n if mod == 0:\n print(i)\n exit(0)\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["+import functools", "+", "-ans = [0] * (pow(10, 6) + 1)", "-ans[0] = 0", "+mod = 0", "- ans[i] = (ans[i - 1] * 10 + 7) % K", "- if ans[i] == 0:", "+ mod = (mod * 10 + 7) % K", "+ if mod == 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7143074386, "measured_runtime_v1": 0.5444337668, "runtime_lift": 1.3120189858, "key": ["s961921352", "s631804156"], "target_token_count_dream": 76, "target_token_bucket_dream": "<128"} +{"user_id": "u311379832", "problem_id": "p02537", "language": "python", "submission_id_v0": "s277145927", "submission_id_v1": "s770419806", "cpu_time_v0": 790, "cpu_time_v1": 668, "memory_v0": 119112, "memory_v1": 103304, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.44, "input": "def segfunc(x, y): return max(x, y)\n\n\n\nclass SegmentTree:\n\n def __init__(self, arr):\n\n size = len(arr)\n\n n = 2 ** (size - 1).bit_length()\n\n self.n = n\n\n self.node = [0] * (2*n)\n\n for i in range(size):\n\n self.node[i+n-1] = arr[i]\n\n for i in reversed(list(range(n-2))):\n\n self.node[i] = segfunc(self.node[2*i+1], self.node[2*i+2])\n\n\n\n def update(self, i, x):\n\n i += self.n - 1\n\n self.node[i] = x\n\n while i > 0:\n\n i = (i - 1) // 2\n\n self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])\n\n\n\n def update(self, x, val):\n\n x += (self.n - 1)\n\n self.node[x] = val\n\n while x > 0:\n\n x = (x - 1) // 2\n\n self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])\n\n\n\n def query(self, a, b):\n\n res = 0\n\n l = self.n - 1 + a\n\n r = self.n - 1 + (b - 1)\n\n\n\n while l <= r:\n\n if l == r:\n\n res = segfunc(res, self.node[l])\n\n break\n\n\n\n if l % 2 == 0:\n\n res = segfunc(res, self.node[l])\n\n if r % 2 == 1:\n\n res = segfunc(res, self.node[r])\n\n l = l // 2\n\n r = r // 2 - 1\n\n\n\n return res\n\n\n\nN, K = list(map(int, input().split()))\n\nINF = 0\n\nseg = SegmentTree([0] * 300000)\n\nfor i in range(N):\n\n a = int(input())\n\n tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1\n\n seg.update(a, tmp)\n\nprint((seg.query(0, 300000)))\n", "target": "def segfunc(x, y): return max(x, y)\n\ndef update(i, x):\n\n i += MAX_N-1\n\n node[i] = x\n\n while i:\n\n i = (i-1)//2\n\n node[i] = segfunc(node[i*2+1], node[i*2+2])\n\n\n\ndef query(l, r):\n\n L = l + MAX_N\n\n R = r + MAX_N\n\n s = INF\n\n while L < R:\n\n if R & 1:\n\n R -= 1\n\n s = segfunc(s, node[R - 1])\n\n if L & 1:\n\n s = segfunc(s, node[L - 1])\n\n L += 1\n\n L >>= 1\n\n R >>= 1\n\n return s\n\n\n\nN, K = list(map(int, input().split()))\n\nMAX_N = 2**(300005).bit_length()\n\na = [int(input()) for _ in range(N)]\n\nnode = [0] * (2 * MAX_N)\n\nINF = 0\n\nans = 0\n\n\n\n#for i in range(N):\n\n# update(i, a[i])\n\n\n\nfor i in a:\n\n tmp = query(max(i - K, 0), min(300005, i + K) + 1)\n\n update(i, tmp + 1)\n\n ans = max(ans, tmp + 1)\n\nprint(ans)\n", "code_v0_loc": 54, "code_v1_loc": 38, "code_v0_num_chars": 1524, "code_v1_num_chars": 809, "code_v0_no_empty_lines": "def segfunc(x, y):\n return max(x, y)\n\n\nclass SegmentTree:\n def __init__(self, arr):\n size = len(arr)\n n = 2 ** (size - 1).bit_length()\n self.n = n\n self.node = [0] * (2 * n)\n for i in range(size):\n self.node[i + n - 1] = arr[i]\n for i in reversed(list(range(n - 2))):\n self.node[i] = segfunc(self.node[2 * i + 1], self.node[2 * i + 2])\n\n def update(self, i, x):\n i += self.n - 1\n self.node[i] = x\n while i > 0:\n i = (i - 1) // 2\n self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])\n\n def update(self, x, val):\n x += self.n - 1\n self.node[x] = val\n while x > 0:\n x = (x - 1) // 2\n self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])\n\n def query(self, a, b):\n res = 0\n l = self.n - 1 + a\n r = self.n - 1 + (b - 1)\n while l <= r:\n if l == r:\n res = segfunc(res, self.node[l])\n break\n if l % 2 == 0:\n res = segfunc(res, self.node[l])\n if r % 2 == 1:\n res = segfunc(res, self.node[r])\n l = l // 2\n r = r // 2 - 1\n return res\n\n\nN, K = list(map(int, input().split()))\nINF = 0\nseg = SegmentTree([0] * 300000)\nfor i in range(N):\n a = int(input())\n tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1\n seg.update(a, tmp)\nprint((seg.query(0, 300000)))\n", "code_v1_no_empty_lines": "def segfunc(x, y):\n return max(x, y)\n\n\ndef update(i, x):\n i += MAX_N - 1\n node[i] = x\n while i:\n i = (i - 1) // 2\n node[i] = segfunc(node[i * 2 + 1], node[i * 2 + 2])\n\n\ndef query(l, r):\n L = l + MAX_N\n R = r + MAX_N\n s = INF\n while L < R:\n if R & 1:\n R -= 1\n s = segfunc(s, node[R - 1])\n if L & 1:\n s = segfunc(s, node[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\nN, K = list(map(int, input().split()))\nMAX_N = 2 ** (300005).bit_length()\na = [int(input()) for _ in range(N)]\nnode = [0] * (2 * MAX_N)\nINF = 0\nans = 0\n# for i in range(N):\n# update(i, a[i])\nfor i in a:\n tmp = query(max(i - K, 0), min(300005, i + K) + 1)\n update(i, tmp + 1)\n ans = max(ans, tmp + 1)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 29.6296296296, "diff": ["-class SegmentTree:", "- def __init__(self, arr):", "- size = len(arr)", "- n = 2 ** (size - 1).bit_length()", "- self.n = n", "- self.node = [0] * (2 * n)", "- for i in range(size):", "- self.node[i + n - 1] = arr[i]", "- for i in reversed(list(range(n - 2))):", "- self.node[i] = segfunc(self.node[2 * i + 1], self.node[2 * i + 2])", "+def update(i, x):", "+ i += MAX_N - 1", "+ node[i] = x", "+ while i:", "+ i = (i - 1) // 2", "+ node[i] = segfunc(node[i * 2 + 1], node[i * 2 + 2])", "- def update(self, i, x):", "- i += self.n - 1", "- self.node[i] = x", "- while i > 0:", "- i = (i - 1) // 2", "- self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])", "- def update(self, x, val):", "- x += self.n - 1", "- self.node[x] = val", "- while x > 0:", "- x = (x - 1) // 2", "- self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])", "-", "- def query(self, a, b):", "- res = 0", "- l = self.n - 1 + a", "- r = self.n - 1 + (b - 1)", "- while l <= r:", "- if l == r:", "- res = segfunc(res, self.node[l])", "- break", "- if l % 2 == 0:", "- res = segfunc(res, self.node[l])", "- if r % 2 == 1:", "- res = segfunc(res, self.node[r])", "- l = l // 2", "- r = r // 2 - 1", "- return res", "+def query(l, r):", "+ L = l + MAX_N", "+ R = r + MAX_N", "+ s = INF", "+ while L < R:", "+ if R & 1:", "+ R -= 1", "+ s = segfunc(s, node[R - 1])", "+ if L & 1:", "+ s = segfunc(s, node[L - 1])", "+ L += 1", "+ L >>= 1", "+ R >>= 1", "+ return s", "+MAX_N = 2 ** (300005).bit_length()", "+a = [int(input()) for _ in range(N)]", "+node = [0] * (2 * MAX_N)", "-seg = SegmentTree([0] * 300000)", "-for i in range(N):", "- a = int(input())", "- tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1", "- seg.update(a, tmp)", "-print((seg.query(0, 300000)))", "+ans = 0", "+# for i in range(N):", "+# update(i, a[i])", "+for i in a:", "+ tmp = query(max(i - K, 0), min(300005, i + K) + 1)", "+ update(i, tmp + 1)", "+ ans = max(ans, tmp + 1)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 2.9777374048, "measured_runtime_v1": 0.391063194, "runtime_lift": 7.6144660253, "key": ["s277145927", "s770419806"], "target_token_count_dream": 305, "target_token_bucket_dream": "256-512"} +{"user_id": "u188827677", "problem_id": "p03037", "language": "python", "submission_id_v0": "s698380012", "submission_id_v1": "s714478978", "cpu_time_v0": 302, "cpu_time_v1": 221, "memory_v0": 11020, "memory_v1": 9144, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.82, "input": "N,M = list(map(int, input().split()))\n\nL = []\n\nR = []\n\nfor _ in range(M):\n\n l,r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n\n\nans = min(R)-max(L)+1\n\nif ans < 0:\n\n print((0))\n\nelse:\n\n print(ans)\n\n ", "target": "n,m = list(map(int, input().split()))\n\nmax_l = float(\"-inf\")\n\nmin_r = float(\"inf\")\n\nfor _ in range(m):\n\n l,r = list(map(int, input().split()))\n\n max_l = max(max_l, l)\n\n min_r = min(min_r, r)\n\nans = min_r - max_l + 1\n\nif ans > 0:\n\n print(ans)\n\nelse:\n\n print((0))", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 207, "code_v1_num_chars": 252, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL = []\nR = []\nfor _ in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\nans = min(R) - max(L) + 1\nif ans < 0:\n print((0))\nelse:\n print(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nmax_l = float(\"-inf\")\nmin_r = float(\"inf\")\nfor _ in range(m):\n l, r = list(map(int, input().split()))\n max_l = max(max_l, l)\n min_r = min(min_r, r)\nans = min_r - max_l + 1\nif ans > 0:\n print(ans)\nelse:\n print((0))\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-N, M = list(map(int, input().split()))", "-L = []", "-R = []", "-for _ in range(M):", "+n, m = list(map(int, input().split()))", "+max_l = float(\"-inf\")", "+min_r = float(\"inf\")", "+for _ in range(m):", "- L.append(l)", "- R.append(r)", "-ans = min(R) - max(L) + 1", "-if ans < 0:", "+ max_l = max(max_l, l)", "+ min_r = min(min_r, r)", "+ans = min_r - max_l + 1", "+if ans > 0:", "+ print(ans)", "+else:", "-else:", "- print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2637555127, "measured_runtime_v1": 0.1756164875, "runtime_lift": 1.5018835444, "key": ["s698380012", "s714478978"], "target_token_count_dream": 91, "target_token_bucket_dream": "<128"} +{"user_id": "u803617136", "problem_id": "p03325", "language": "python", "submission_id_v0": "s116805601", "submission_id_v1": "s513357045", "cpu_time_v0": 184, "cpu_time_v1": 27, "memory_v0": 40560, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.33, "input": "N = int(input())\n\n\n\nseq = list(map(int, input().split()))\n\n\n\ncnt = 0\n\n\n\nfor num in seq:\n\n while num % 2 == 0:\n\n cnt += 1\n\n num /= 2\n\n\n\nprint(cnt)\n", "target": "n = int(input())\n\na = list(map(int, input().split()))\n\nans = 0\n\nfor num in a:\n\n ans += format(num, 'b')[::-1].find('1')\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 6, "code_v0_num_chars": 163, "code_v1_num_chars": 134, "code_v0_no_empty_lines": "N = int(input())\nseq = list(map(int, input().split()))\ncnt = 0\nfor num in seq:\n while num % 2 == 0:\n cnt += 1\n num /= 2\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nans = 0\nfor num in a:\n ans += format(num, \"b\")[::-1].find(\"1\")\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-N = int(input())", "-seq = list(map(int, input().split()))", "-cnt = 0", "-for num in seq:", "- while num % 2 == 0:", "- cnt += 1", "- num /= 2", "-print(cnt)", "+n = int(input())", "+a = list(map(int, input().split()))", "+ans = 0", "+for num in a:", "+ ans += format(num, \"b\")[::-1].find(\"1\")", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1574799829, "measured_runtime_v1": 0.0061847587, "runtime_lift": 25.4625913758, "key": ["s116805601", "s513357045"], "target_token_count_dream": 44, "target_token_bucket_dream": "<128"} +{"user_id": "u564589929", "problem_id": "p03371", "language": "python", "submission_id_v0": "s501790970", "submission_id_v1": "s324668886", "cpu_time_v0": 93, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.72, "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(input())\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = INF\n\n for k in range(100001):\n\n yen = 2 * c * k + max(0, x-k) * a + max(0, y-k) * b\n\n ans = min(ans, yen)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "target": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n# input = sys.stdin.readline ####\n\nint1 = lambda x: int(x) - 1\n\ndef II(): return int(input())\n\n\n\ndef MI(): return list(map(int, input().split()))\n\ndef MI1(): return list(map(int1, input().split()))\n\n\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI1(): return list(map(int1, input().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\n\n\ndef printlist(lst, k='\\n'): print((k.join(list(map(str, lst)))))\n\nINF = float('inf')\n\n\n\ndef solve():\n\n a, b, c, x, y = MI()\n\n\n\n ans = 0\n\n if a + b <= 2 * c:\n\n mn = min(x, y)\n\n ans = a * mn + b * mn + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)\n\n\n\n else:\n\n mn = min(x, y)\n\n ans = mn * 2 * c + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)\n\n\n\n print(ans)\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "code_v0_loc": 28, "code_v1_loc": 34, "code_v0_num_chars": 727, "code_v1_num_chars": 868, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\n\n\ndef II():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MI1():\n return list(map(int1, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI1():\n return list(map(int1, input().split()))\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef printlist(lst, k=\"\\n\"):\n print((k.join(list(map(str, lst)))))\n\n\nINF = float(\"inf\")\n\n\ndef solve():\n a, b, c, x, y = MI()\n ans = INF\n for k in range(100001):\n yen = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b\n ans = min(ans, yen)\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\n\n\ndef II():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MI1():\n return list(map(int1, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI1():\n return list(map(int1, input().split()))\n\n\ndef LLI(rows_number):\n return [LI() for _ in range(rows_number)]\n\n\ndef printlist(lst, k=\"\\n\"):\n print((k.join(list(map(str, lst)))))\n\n\nINF = float(\"inf\")\n\n\ndef solve():\n a, b, c, x, y = MI()\n ans = 0\n if a + b <= 2 * c:\n mn = min(x, y)\n ans = (\n a * mn\n + b * mn\n + max(0, x - mn) * min(a, 2 * c)\n + max(0, y - mn) * min(b, 2 * c)\n )\n else:\n mn = min(x, y)\n ans = (\n mn * 2 * c + max(0, x - mn) * min(a, 2 * c) + max(0, y - mn) * min(b, 2 * c)\n )\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["- ans = INF", "- for k in range(100001):", "- yen = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b", "- ans = min(ans, yen)", "+ ans = 0", "+ if a + b <= 2 * c:", "+ mn = min(x, y)", "+ ans = (", "+ a * mn", "+ + b * mn", "+ + max(0, x - mn) * min(a, 2 * c)", "+ + max(0, y - mn) * min(b, 2 * c)", "+ )", "+ else:", "+ mn = min(x, y)", "+ ans = (", "+ mn * 2 * c + max(0, x - mn) * min(a, 2 * c) + max(0, y - mn) * min(b, 2 * c)", "+ )"], "diff_only_import_comment": false, "measured_runtime_v0": 1.2337559407, "measured_runtime_v1": 0.3123451986, "runtime_lift": 3.9499756873, "key": ["s501790970", "s324668886"], "target_token_count_dream": 297, "target_token_bucket_dream": "256-512"} +{"user_id": "u186838327", "problem_id": "p03796", "language": "python", "submission_id_v0": "s155084707", "submission_id_v1": "s301395968", "cpu_time_v0": 231, "cpu_time_v1": 177, "memory_v0": 4104, "memory_v1": 38640, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.38, "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))", "target": "n = int(input())\n\nans = 1\n\nmod = 10**9+7\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= mod\n\n\n\nans %= mod\n\nprint(ans)\n", "code_v0_loc": 3, "code_v1_loc": 9, "code_v0_num_chars": 65, "code_v1_num_chars": 122, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nmod = 10**9 + 7\nfor i in range(1, n + 1):\n ans *= i\n ans %= mod\nans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+ans = 1", "+mod = 10**9 + 7", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= mod", "+ans %= mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5786725054, "measured_runtime_v1": 0.2556207638, "runtime_lift": 2.2637930378, "key": ["s155084707", "s301395968"], "target_token_count_dream": 48, "target_token_bucket_dream": "<128"} +{"user_id": "u014333473", "problem_id": "p03845", "language": "python", "submission_id_v0": "s045706452", "submission_id_v1": "s705375036", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9180, "memory_v1": 9164, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "n,t=int(input()),list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n", "target": "input();t=list(map(int,input().split()));T=sum(t)\n\nprint(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\\n')\n", "code_v0_loc": 2, "code_v1_loc": 2, "code_v0_num_chars": 160, "code_v1_num_chars": 153, "code_v0_no_empty_lines": "n, t = int(input()), list(map(int, input().split()))\nT = sum(t)\nprint(\n *[\n T - t[i - 1] + j\n for i, j in [list(map(int, input().split())) for _ in range(int(input()))]\n ],\n sep=\"\\n\"\n)\n", "code_v1_no_empty_lines": "input()\nt = list(map(int, input().split()))\nT = sum(t)\nprint(\n *[\n T - t[i - 1] + j\n for i, j in [list(map(int, input().split())) for _ in range(int(input()))]\n ],\n sep=\"\\n\"\n)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-n, t = int(input()), list(map(int, input().split()))", "+input()", "+t = list(map(int, input().split()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.308619008, "measured_runtime_v1": 0.2417461898, "runtime_lift": 1.2766240837, "key": ["s045706452", "s705375036"], "target_token_count_dream": 48, "target_token_bucket_dream": "<128"} +{"user_id": "u906501980", "problem_id": "p03363", "language": "python", "submission_id_v0": "s203042500", "submission_id_v1": "s990747122", "cpu_time_v0": 316, "cpu_time_v1": 264, "memory_v0": 52496, "memory_v1": 52544, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.46, "input": "n = int(input())\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum={}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n if str(i) in list(num.keys()):\n\n num[str(i)] += 1\n\n else:\n\n num[str(i)] = 1\n\nout = [i*(i-1)//2 for i in list(num.values()) if i>1]\n\nprint((sum(out)))", "target": "n = int(input())\n\nA = [int(i) for i in input().split()]\n\nS = [0]*(n+1)\n\nnum = {}\n\nfor i in range(n):\n\n S[i+1] = S[i] + A[i]\n\nfor i in S:\n\n s = str(i)\n\n num[s] = 1 if s not in list(num.keys()) else num[s]+1\n\nout = [i*(i-1)//2 for i in list(num.values()) if i > 1]\n\nprint((sum(out)))", "code_v0_loc": 13, "code_v1_loc": 11, "code_v0_num_chars": 295, "code_v1_num_chars": 276, "code_v0_no_empty_lines": "n = int(input())\nA = [int(i) for i in input().split()]\nS = [0] * (n + 1)\nnum = {}\nfor i in range(n):\n S[i + 1] = S[i] + A[i]\nfor i in S:\n if str(i) in list(num.keys()):\n num[str(i)] += 1\n else:\n num[str(i)] = 1\nout = [i * (i - 1) // 2 for i in list(num.values()) if i > 1]\nprint((sum(out)))\n", "code_v1_no_empty_lines": "n = int(input())\nA = [int(i) for i in input().split()]\nS = [0] * (n + 1)\nnum = {}\nfor i in range(n):\n S[i + 1] = S[i] + A[i]\nfor i in S:\n s = str(i)\n num[s] = 1 if s not in list(num.keys()) else num[s] + 1\nout = [i * (i - 1) // 2 for i in list(num.values()) if i > 1]\nprint((sum(out)))\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["- if str(i) in list(num.keys()):", "- num[str(i)] += 1", "- else:", "- num[str(i)] = 1", "+ s = str(i)", "+ num[s] = 1 if s not in list(num.keys()) else num[s] + 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4443410683, "measured_runtime_v1": 0.2339228122, "runtime_lift": 1.8995200341, "key": ["s203042500", "s990747122"], "target_token_count_dream": 110, "target_token_bucket_dream": "<128"} +{"user_id": "u805332733", "problem_id": "p02555", "language": "python", "submission_id_v0": "s317659277", "submission_id_v1": "s521440898", "cpu_time_v0": 89, "cpu_time_v1": 65, "memory_v0": 64652, "memory_v1": 63416, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.97, "input": "def resolve():\n\n base = 10**9+7\n\n S = int(input())\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(1, S+1):\n\n for u in range(i-2):\n\n dp[i] += dp[u]\n\n dp[i] %= base\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n", "target": "def resolve():\n\n base = 10**9+7\n\n S = int(input())\n\n dp = [0] * (S+1)\n\n dp[0] = 1\n\n\n\n for i in range(3, S+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n # print(dp)\n\n print((dp[S]%base))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()", "code_v0_loc": 15, "code_v1_loc": 13, "code_v0_num_chars": 263, "code_v1_num_chars": 224, "code_v0_no_empty_lines": "def resolve():\n base = 10**9 + 7\n S = int(input())\n dp = [0] * (S + 1)\n dp[0] = 1\n for i in range(1, S + 1):\n for u in range(i - 2):\n dp[i] += dp[u]\n dp[i] %= base\n # print(dp)\n print((dp[S] % base))\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_v1_no_empty_lines": "def resolve():\n base = 10**9 + 7\n S = int(input())\n dp = [0] * (S + 1)\n dp[0] = 1\n for i in range(3, S + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n # print(dp)\n print((dp[S] % base))\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 13.3333333333, "diff": ["- for i in range(1, S + 1):", "- for u in range(i - 2):", "- dp[i] += dp[u]", "- dp[i] %= base", "+ for i in range(3, S + 1):", "+ dp[i] = dp[i - 1] + dp[i - 3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5217176821, "measured_runtime_v1": 0.2045270953, "runtime_lift": 2.5508487337, "key": ["s317659277", "s521440898"], "target_token_count_dream": 95, "target_token_bucket_dream": "<128"} +{"user_id": "u922449550", "problem_id": "p02792", "language": "python", "submission_id_v0": "s475401488", "submission_id_v1": "s941984259", "cpu_time_v0": 197, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.37, "input": "N = int(input())\n\n\n\ntable = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n id1 = int(s[0])\n\n id2 = int(s[-1])\n\n table[id1][id2] += 1\n\n\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += table[i][j]*table[j][i]\n\n\n\nprint(ans)", "target": "N = input()\n\nm = len(N)\n\n\n\na0 = int(N[0])\n\na1 = int(N[-1])\n\n\n\nans = 0\n\nif m == 1:\n\n ans = int(N)\n\nelse:\n\n mid = (int(N[1:]) - a1)//10\n\n t = 10**(m-2)\n\n ans = 9\n\n ans += ((a0-1)*t) * 2\n\n ans += (mid + (a1>=a0)) * 2\n\n ans += ((a0-1)*t)**2\n\n ans += ((mid*(a0-1) + min(a0-1, a1))*t) * 2\n\n ans += (mid + (a1>=a0))**2\n\n if m >= 3:\n\n ans += (t - 1) * 2\n\n ans += ((a0-1)*(t - 1)*t) * 2\n\n ans += (mid * (t - 1)) * 2\n\n ans += (a1 * (t - 1)//9) * 2\n\n ans += (t - 1)**2\n\n\n\nprint(ans)", "code_v0_loc": 16, "code_v1_loc": 26, "code_v0_num_chars": 264, "code_v1_num_chars": 496, "code_v0_no_empty_lines": "N = int(input())\ntable = [[0] * 10 for i in range(10)]\nfor i in range(1, N + 1):\n s = str(i)\n id1 = int(s[0])\n id2 = int(s[-1])\n table[id1][id2] += 1\nans = 0\nfor i in range(10):\n for j in range(10):\n ans += table[i][j] * table[j][i]\nprint(ans)\n", "code_v1_no_empty_lines": "N = input()\nm = len(N)\na0 = int(N[0])\na1 = int(N[-1])\nans = 0\nif m == 1:\n ans = int(N)\nelse:\n mid = (int(N[1:]) - a1) // 10\n t = 10 ** (m - 2)\n ans = 9\n ans += ((a0 - 1) * t) * 2\n ans += (mid + (a1 >= a0)) * 2\n ans += ((a0 - 1) * t) ** 2\n ans += ((mid * (a0 - 1) + min(a0 - 1, a1)) * t) * 2\n ans += (mid + (a1 >= a0)) ** 2\n if m >= 3:\n ans += (t - 1) * 2\n ans += ((a0 - 1) * (t - 1) * t) * 2\n ans += (mid * (t - 1)) * 2\n ans += (a1 * (t - 1) // 9) * 2\n ans += (t - 1) ** 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 38.4615384615, "diff": ["-N = int(input())", "-table = [[0] * 10 for i in range(10)]", "-for i in range(1, N + 1):", "- s = str(i)", "- id1 = int(s[0])", "- id2 = int(s[-1])", "- table[id1][id2] += 1", "+N = input()", "+m = len(N)", "+a0 = int(N[0])", "+a1 = int(N[-1])", "-for i in range(10):", "- for j in range(10):", "- ans += table[i][j] * table[j][i]", "+if m == 1:", "+ ans = int(N)", "+else:", "+ mid = (int(N[1:]) - a1) // 10", "+ t = 10 ** (m - 2)", "+ ans = 9", "+ ans += ((a0 - 1) * t) * 2", "+ ans += (mid + (a1 >= a0)) * 2", "+ ans += ((a0 - 1) * t) ** 2", "+ ans += ((mid * (a0 - 1) + min(a0 - 1, a1)) * t) * 2", "+ ans += (mid + (a1 >= a0)) ** 2", "+ if m >= 3:", "+ ans += (t - 1) * 2", "+ ans += ((a0 - 1) * (t - 1) * t) * 2", "+ ans += (mid * (t - 1)) * 2", "+ ans += (a1 * (t - 1) // 9) * 2", "+ ans += (t - 1) ** 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.589133962, "measured_runtime_v1": 0.3507217311, "runtime_lift": 1.6797760439, "key": ["s475401488", "s941984259"], "target_token_count_dream": 255, "target_token_bucket_dream": "128-256"} +{"user_id": "u450904670", "problem_id": "p03796", "language": "python", "submission_id_v0": "s280545626", "submission_id_v1": "s422534863", "cpu_time_v0": 73, "cpu_time_v1": 40, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.21, "input": "n = int(input())\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (pow(10,9) + 7)\n\nprint(res)", "target": "n = int(input())\n\nres = 1\n\nfor num in range(1, n+1):\n\n res = res * num\n\n res = res % (10**9 + 7)\n\nprint(res)\n", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 114, "code_v1_num_chars": 115, "code_v0_no_empty_lines": "n = int(input())\nres = 1\nfor num in range(1, n + 1):\n res = res * num\n res = res % (pow(10, 9) + 7)\nprint(res)\n", "code_v1_no_empty_lines": "n = int(input())\nres = 1\nfor num in range(1, n + 1):\n res = res * num\n res = res % (10**9 + 7)\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- res = res % (pow(10, 9) + 7)", "+ res = res % (10**9 + 7)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4279417639, "measured_runtime_v1": 0.3313806841, "runtime_lift": 1.2913901876, "key": ["s280545626", "s422534863"], "target_token_count_dream": 45, "target_token_bucket_dream": "<128"} +{"user_id": "u333190709", "problem_id": "p03371", "language": "python", "submission_id_v0": "s264866690", "submission_id_v1": "s762683898", "cpu_time_v0": 127, "cpu_time_v1": 17, "memory_v0": 5304, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 86.61, "input": "#!/usr/bin/env python3\n\nimport sys, math, math, itertools\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n mn = 1e9\n\n for i in range(0, 2*(max(X, Y)+1), 2):\n\n mn = min(mn, C*i+A*max(X-i//2, 0)+B*max(Y-i//2, 0))\n\n print((int(mn)))\n\n return\n\n\n\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\n\n\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n\n c = 0\n\n if (A + B < 2 * C):\n\n c += min(X, Y) * (A + B)\n\n else:\n\n c += min(X, Y) * 2 * C\n\n if X > Y:\n\n c += (X - Y) * min(A, 2 * C)\n\n else:\n\n c += (Y - X) * min(B, 2 * C)\n\n print(c)\n\n return\n\n\n\n\n\n# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n A = int(next(tokens)) # type: int\n\n B = int(next(tokens)) # type: int\n\n C = int(next(tokens)) # type: int\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n solve(A, B, C, X, Y)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 28, "code_v1_loc": 34, "code_v0_num_chars": 879, "code_v1_num_chars": 941, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nimport sys, math, math, itertools\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n mn = 1e9\n for i in range(0, 2 * (max(X, Y) + 1), 2):\n mn = min(mn, C * i + A * max(X - i // 2, 0) + B * max(Y - i // 2, 0))\n print((int(mn)))\n return\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n C = int(next(tokens)) # type: int\n X = int(next(tokens)) # type: int\n Y = int(next(tokens)) # type: int\n solve(A, B, C, X, Y)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(A: int, B: int, C: int, X: int, Y: int):\n c = 0\n if A + B < 2 * C:\n c += min(X, Y) * (A + B)\n else:\n c += min(X, Y) * 2 * C\n if X > Y:\n c += (X - Y) * min(A, 2 * C)\n else:\n c += (Y - X) * min(B, 2 * C)\n print(c)\n return\n\n\n# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n A = int(next(tokens)) # type: int\n B = int(next(tokens)) # type: int\n C = int(next(tokens)) # type: int\n X = int(next(tokens)) # type: int\n Y = int(next(tokens)) # type: int\n solve(A, B, C, X, Y)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["-import sys, math, math, itertools", "+import sys", "- mn = 1e9", "- for i in range(0, 2 * (max(X, Y) + 1), 2):", "- mn = min(mn, C * i + A * max(X - i // 2, 0) + B * max(Y - i // 2, 0))", "- print((int(mn)))", "+ c = 0", "+ if A + B < 2 * C:", "+ c += min(X, Y) * (A + B)", "+ else:", "+ c += min(X, Y) * 2 * C", "+ if X > Y:", "+ c += (X - Y) * min(A, 2 * C)", "+ else:", "+ c += (Y - X) * min(B, 2 * C)", "+ print(c)", "-# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)", "+# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4482344875, "measured_runtime_v1": 0.3314408262, "runtime_lift": 1.3523816383, "key": ["s264866690", "s762683898"], "target_token_count_dream": 296, "target_token_bucket_dream": "256-512"} +{"user_id": "u498487134", "problem_id": "p02917", "language": "python", "submission_id_v0": "s303870321", "submission_id_v1": "s766724876", "cpu_time_v0": 162, "cpu_time_v1": 67, "memory_v0": 38256, "memory_v1": 61812, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.64, "input": "N = int(input())\n\nB =list(map(int,input().split()))\n\nA=[0]*N\n\n\n\nA[0]=B[0]\n\nfor i in range(1,N-1):\n\n A[i]=min(B[i],B[i-1])\n\nA[-1]=B[-1]\n\nprint((sum(A)))", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(input())\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N=I()\n\n B=LI()\n\n A=[0]*N\n\n A[0]=B[0]\n\n A[-1]=B[-1]\n\n for i in range(N-2):\n\n A[i+1]=min(B[i],B[i+1])\n\n \n\n print((sum(A)))\n\n\n\nmain()\n", "code_v0_loc": 9, "code_v1_loc": 20, "code_v0_num_chars": 152, "code_v1_num_chars": 363, "code_v0_no_empty_lines": "N = int(input())\nB = list(map(int, input().split()))\nA = [0] * N\nA[0] = B[0]\nfor i in range(1, N - 1):\n A[i] = min(B[i], B[i - 1])\nA[-1] = B[-1]\nprint((sum(A)))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N = I()\n B = LI()\n A = [0] * N\n A[0] = B[0]\n A[-1] = B[-1]\n for i in range(N - 2):\n A[i + 1] = min(B[i], B[i + 1])\n print((sum(A)))\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 55.0, "diff": ["-N = int(input())", "-B = list(map(int, input().split()))", "-A = [0] * N", "-A[0] = B[0]", "-for i in range(1, N - 1):", "- A[i] = min(B[i], B[i - 1])", "-A[-1] = B[-1]", "-print((sum(A)))", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def I():", "+ return int(input())", "+", "+", "+def MI():", "+ return list(map(int, input().split()))", "+", "+", "+def LI():", "+ return list(map(int, input().split()))", "+", "+", "+def main():", "+ mod = 10**9 + 7", "+ N = I()", "+ B = LI()", "+ A = [0] * N", "+ A[0] = B[0]", "+ A[-1] = B[-1]", "+ for i in range(N - 2):", "+ A[i + 1] = min(B[i], B[i + 1])", "+ print((sum(A)))", "+", "+", "+main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.251366816, "measured_runtime_v1": 0.147175539, "runtime_lift": 1.7079388172, "key": ["s303870321", "s766724876"], "target_token_count_dream": 123, "target_token_bucket_dream": "<128"} +{"user_id": "u047796752", "problem_id": "p02700", "language": "python", "submission_id_v0": "s232689719", "submission_id_v1": "s065315130", "cpu_time_v0": 74, "cpu_time_v1": 57, "memory_v0": 64716, "memory_v1": 61776, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.97, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nA, B, C, D = list(map(int, input().split()))\n\n\n\nwhile True:\n\n C -= B\n\n \n\n if C<=0:\n\n print('Yes')\n\n exit()\n\n \n\n A -= D\n\n \n\n if A<=0:\n\n print('No')\n\n exit()", "target": "A, B, C, D = list(map(int, input().split()))\n\nc1 = (C+B-1)//B\n\nc2 = (A+D-1)//D\n\n\n\nif c1<=c2:\n\n print('Yes')\n\nelse:\n\n print('No')", "code_v0_loc": 18, "code_v1_loc": 8, "code_v0_num_chars": 267, "code_v1_num_chars": 128, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\nA, B, C, D = list(map(int, input().split()))\nwhile True:\n C -= B\n if C <= 0:\n print(\"Yes\")\n exit()\n A -= D\n if A <= 0:\n print(\"No\")\n exit()\n", "code_v1_no_empty_lines": "A, B, C, D = list(map(int, input().split()))\nc1 = (C + B - 1) // B\nc2 = (A + D - 1) // D\nif c1 <= c2:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-from collections import *", "-", "-while True:", "- C -= B", "- if C <= 0:", "- print(\"Yes\")", "- exit()", "- A -= D", "- if A <= 0:", "- print(\"No\")", "- exit()", "+c1 = (C + B - 1) // B", "+c2 = (A + D - 1) // D", "+if c1 <= c2:", "+ print(\"Yes\")", "+else:", "+ print(\"No\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2898896478, "measured_runtime_v1": 0.0638447898, "runtime_lift": 4.5405372711, "key": ["s232689719", "s065315130"], "target_token_count_dream": 58, "target_token_bucket_dream": "<128"} +{"user_id": "u576432509", "problem_id": "p03575", "language": "python", "submission_id_v0": "s579377069", "submission_id_v1": "s043222526", "cpu_time_v0": 33, "cpu_time_v1": 26, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.21, "input": "icase=0\n\nif icase==0:\n\n n,m=list(map(int, input().split()))\n\n a=[]\n\n b=[]\n\n for i in range(m):\n\n ai,bi=list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\nelif icase==1:\n\n n=6\n\n m=5\n\n# a=[[1],[2],[3],[4],[5]]\n\n# b=[[2],[3],[4],[5],[6]]\n\n a=[1,2,3,4,5]\n\n b=[2,3,4,5,6]\n\nelif icase==2:\n\n n=7\n\n m=7\n\n a=[1,2,3,4,4,5,6]\n\n b=[3,7,4,5,6,6,7]\n\n\n\n \n\nvtx=[]\n\nfor i in range(n):\n\n vtx.append([i+1])\n\nicnt=0\n\n\n\nfor j in range(m): \n\n vtx1=vtx.copy()\n\n a1=a.copy()\n\n b1=b.copy()\n\n del a1[j]\n\n del b1[j]\n\n \n\n for i in range(m-1):\n\n for v1 in vtx1:\n\n if a1[i] in v1:\n\n if not b1[i] in v1:\n\n for v2 in vtx1:\n\n if v1!=v2:\n\n if b1[i] in v2:\n\n break\n\n vtx1.remove(v1)\n\n vtx1.remove(v2)\n\n v3=v1+v2\n\n vtx1.append(v3)\n\n# print(a[i],b[i],len(vtx1),vtx1)\n\n# print(len(vtx1),vtx1)\n\n if len(vtx1)!=1:\n\n icnt=icnt+1\n\nprint(icnt) ", "target": "limit=50\n\ngraph=[[False]*limit for i in range(limit)]\n\nvisited=[]*limit\n\n\n\ndef dfs(v,n,graph,visited):\n\n visited[v]=True\n\n for v2 in range(n):\n\n if graph[v][v2]==False:\n\n continue\n\n if visited[v2]==True:\n\n continue\n\n dfs(v2,n,graph,visited)\n\n\n\nn,m=list(map(int,input().split()))\n\na=[0]*m\n\nb=[0]*m\n\nfor i in range(m):\n\n ai,bi=list(map(int,input().split()))\n\n a[i]=ai-1\n\n b[i]=bi-1\n\n graph[a[i]][b[i]]=True\n\n graph[b[i]][a[i]]=True\n\n \n\nans=0 \n\nfor i in range(m):\n\n graph[a[i]][b[i]]=False\n\n graph[b[i]][a[i]]=False\n\n visited=[False]*n\n\n dfs(0,n,graph,visited)\n\n bridge=False\n\n for j in range(n):\n\n if visited[j]==False:\n\n bridge=True\n\n if bridge:\n\n ans+=1\n\n graph[a[i]][b[i]]=True\n\n graph[b[i]][a[i]]=True\n\n \n\nprint(ans)", "code_v0_loc": 52, "code_v1_loc": 39, "code_v0_num_chars": 1130, "code_v1_num_chars": 828, "code_v0_no_empty_lines": "icase = 0\nif icase == 0:\n n, m = list(map(int, input().split()))\n a = []\n b = []\n for i in range(m):\n ai, bi = list(map(int, input().split()))\n a.append(ai)\n b.append(bi)\nelif icase == 1:\n n = 6\n m = 5\n # a=[[1],[2],[3],[4],[5]]\n # b=[[2],[3],[4],[5],[6]]\n a = [1, 2, 3, 4, 5]\n b = [2, 3, 4, 5, 6]\nelif icase == 2:\n n = 7\n m = 7\n a = [1, 2, 3, 4, 4, 5, 6]\n b = [3, 7, 4, 5, 6, 6, 7]\nvtx = []\nfor i in range(n):\n vtx.append([i + 1])\nicnt = 0\nfor j in range(m):\n vtx1 = vtx.copy()\n a1 = a.copy()\n b1 = b.copy()\n del a1[j]\n del b1[j]\n for i in range(m - 1):\n for v1 in vtx1:\n if a1[i] in v1:\n if not b1[i] in v1:\n for v2 in vtx1:\n if v1 != v2:\n if b1[i] in v2:\n break\n vtx1.remove(v1)\n vtx1.remove(v2)\n v3 = v1 + v2\n vtx1.append(v3)\n # print(a[i],b[i],len(vtx1),vtx1)\n # print(len(vtx1),vtx1)\n if len(vtx1) != 1:\n icnt = icnt + 1\nprint(icnt)\n", "code_v1_no_empty_lines": "limit = 50\ngraph = [[False] * limit for i in range(limit)]\nvisited = [] * limit\n\n\ndef dfs(v, n, graph, visited):\n visited[v] = True\n for v2 in range(n):\n if graph[v][v2] == False:\n continue\n if visited[v2] == True:\n continue\n dfs(v2, n, graph, visited)\n\n\nn, m = list(map(int, input().split()))\na = [0] * m\nb = [0] * m\nfor i in range(m):\n ai, bi = list(map(int, input().split()))\n a[i] = ai - 1\n b[i] = bi - 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\nans = 0\nfor i in range(m):\n graph[a[i]][b[i]] = False\n graph[b[i]][a[i]] = False\n visited = [False] * n\n dfs(0, n, graph, visited)\n bridge = False\n for j in range(n):\n if visited[j] == False:\n bridge = True\n if bridge:\n ans += 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-icase = 0", "-if icase == 0:", "- n, m = list(map(int, input().split()))", "- a = []", "- b = []", "- for i in range(m):", "- ai, bi = list(map(int, input().split()))", "- a.append(ai)", "- b.append(bi)", "-elif icase == 1:", "- n = 6", "- m = 5", "- # a=[[1],[2],[3],[4],[5]]", "- # b=[[2],[3],[4],[5],[6]]", "- a = [1, 2, 3, 4, 5]", "- b = [2, 3, 4, 5, 6]", "-elif icase == 2:", "- n = 7", "- m = 7", "- a = [1, 2, 3, 4, 4, 5, 6]", "- b = [3, 7, 4, 5, 6, 6, 7]", "-vtx = []", "-for i in range(n):", "- vtx.append([i + 1])", "-icnt = 0", "-for j in range(m):", "- vtx1 = vtx.copy()", "- a1 = a.copy()", "- b1 = b.copy()", "- del a1[j]", "- del b1[j]", "- for i in range(m - 1):", "- for v1 in vtx1:", "- if a1[i] in v1:", "- if not b1[i] in v1:", "- for v2 in vtx1:", "- if v1 != v2:", "- if b1[i] in v2:", "- break", "- vtx1.remove(v1)", "- vtx1.remove(v2)", "- v3 = v1 + v2", "- vtx1.append(v3)", "- # print(a[i],b[i],len(vtx1),vtx1)", "- # print(len(vtx1),vtx1)", "- if len(vtx1) != 1:", "- icnt = icnt + 1", "-print(icnt)", "+limit = 50", "+graph = [[False] * limit for i in range(limit)]", "+visited = [] * limit", "+", "+", "+def dfs(v, n, graph, visited):", "+ visited[v] = True", "+ for v2 in range(n):", "+ if graph[v][v2] == False:", "+ continue", "+ if visited[v2] == True:", "+ continue", "+ dfs(v2, n, graph, visited)", "+", "+", "+n, m = list(map(int, input().split()))", "+a = [0] * m", "+b = [0] * m", "+for i in range(m):", "+ ai, bi = list(map(int, input().split()))", "+ a[i] = ai - 1", "+ b[i] = bi - 1", "+ graph[a[i]][b[i]] = True", "+ graph[b[i]][a[i]] = True", "+ans = 0", "+for i in range(m):", "+ graph[a[i]][b[i]] = False", "+ graph[b[i]][a[i]] = False", "+ visited = [False] * n", "+ dfs(0, n, graph, visited)", "+ bridge = False", "+ for j in range(n):", "+ if visited[j] == False:", "+ bridge = True", "+ if bridge:", "+ ans += 1", "+ graph[a[i]][b[i]] = True", "+ graph[b[i]][a[i]] = True", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3351877429, "measured_runtime_v1": 0.2583705549, "runtime_lift": 1.2973140188, "key": ["s579377069", "s043222526"], "target_token_count_dream": 255, "target_token_bucket_dream": "128-256"} +{"user_id": "u086503932", "problem_id": "p02814", "language": "python", "submission_id_v0": "s657535199", "submission_id_v1": "s415753878", "cpu_time_v0": 500, "cpu_time_v1": 202, "memory_v0": 16280, "memory_v1": 91128, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.6, "input": "#!/usr/bin/env python3\n\nimport sys\n\nfrom math import gcd\n\nimport math\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n tmp = 1\n\n count = None\n\n for i in range(N):\n\n tmp = (tmp * a[i]//2) // gcd(tmp,a[i]//2)\n\n c = 0\n\n n = a[i]//2\n\n while n % 2 == 0:\n\n c += 1\n\n n //= 2\n\n if i == 0:\n\n count = c\n\n elif count != c:\n\n print((0))\n\n exit()\n\n print(((M//tmp +1)//2))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "from math import gcd\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = [a//2 for a in A]\n\nLCM = 1\n\nfor i in range(N):\n\n LCM = LCM * B[i] // gcd(LCM, B[i])\n\nfor i in range(N):\n\n if LCM // B[i] % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((M//LCM + 1)//2))", "code_v0_loc": 26, "code_v1_loc": 13, "code_v0_num_chars": 527, "code_v1_num_chars": 293, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nimport sys\nfrom math import gcd\nimport math\n\n\ndef main():\n N, M = list(map(int, input().split()))\n a = list(map(int, input().split()))\n tmp = 1\n count = None\n for i in range(N):\n tmp = (tmp * a[i] // 2) // gcd(tmp, a[i] // 2)\n c = 0\n n = a[i] // 2\n while n % 2 == 0:\n c += 1\n n //= 2\n if i == 0:\n count = c\n elif count != c:\n print((0))\n exit()\n print(((M // tmp + 1) // 2))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from math import gcd\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = [a // 2 for a in A]\nLCM = 1\nfor i in range(N):\n LCM = LCM * B[i] // gcd(LCM, B[i])\nfor i in range(N):\n if LCM // B[i] % 2 == 0:\n print((0))\n exit()\nprint(((M // LCM + 1) // 2))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-#!/usr/bin/env python3", "-import sys", "-from math import gcd", "-import math", "+from math import gcd", "-", "-def main():", "- N, M = list(map(int, input().split()))", "- a = list(map(int, input().split()))", "- tmp = 1", "- count = None", "- for i in range(N):", "- tmp = (tmp * a[i] // 2) // gcd(tmp, a[i] // 2)", "- c = 0", "- n = a[i] // 2", "- while n % 2 == 0:", "- c += 1", "- n //= 2", "- if i == 0:", "- count = c", "- elif count != c:", "- print((0))", "- exit()", "- print(((M // tmp + 1) // 2))", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+N, M = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "+B = [a // 2 for a in A]", "+LCM = 1", "+for i in range(N):", "+ LCM = LCM * B[i] // gcd(LCM, B[i])", "+for i in range(N):", "+ if LCM // B[i] % 2 == 0:", "+ print((0))", "+ exit()", "+print(((M // LCM + 1) // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4621698339, "measured_runtime_v1": 0.3237110667, "runtime_lift": 1.4277233045, "key": ["s657535199", "s415753878"], "target_token_count_dream": 109, "target_token_bucket_dream": "<128"} +{"user_id": "u433181015", "problem_id": "p02394", "language": "python", "submission_id_v0": "s560769298", "submission_id_v1": "s595626547", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7680, "memory_v1": 7728, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "a=input().split()\n\nb=list(map(int,a))\n\nW=b[0]\n\nH=b[1]\n\nx=b[2]\n\ny=b[3]\n\nr=b[4]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')", "target": "W,H,x,y,r = [int(i) for i in input().split()]\n\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n\n print('Yes')\n\nelse:\n\n print('No')", "code_v0_loc": 11, "code_v1_loc": 5, "code_v0_num_chars": 164, "code_v1_num_chars": 132, "code_v0_no_empty_lines": "a = input().split()\nb = list(map(int, a))\nW = b[0]\nH = b[1]\nx = b[2]\ny = b[3]\nr = b[4]\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "W, H, x, y, r = [int(i) for i in input().split()]\nif (r <= x <= (W - r)) and (r <= y <= (H - r)):\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 54.5454545455, "diff": ["-a = input().split()", "-b = list(map(int, a))", "-W = b[0]", "-H = b[1]", "-x = b[2]", "-y = b[3]", "-r = b[4]", "+W, H, x, y, r = [int(i) for i in input().split()]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3832537071, "measured_runtime_v1": 0.2996923448, "runtime_lift": 1.2788238128, "key": ["s560769298", "s595626547"], "target_token_count_dream": 52, "target_token_bucket_dream": "<128"} +{"user_id": "u454022848", "problem_id": "p02394", "language": "python", "submission_id_v0": "s949778573", "submission_id_v1": "s992404688", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 6724, "memory_v1": 6432, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "ia = [int(i) for i in input().split(\" \")]\n\nW=ia[0]\n\nH=ia[1]\n\nx=ia[2]\n\ny=ia[3]\n\nr=ia[4]\n\nprint((\"Yes\" if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H else \"No\"))", "target": "# encoding:utf-8\n\n\n\ninput = list(map(int, input().split()))\n\nW, H, x, y, r = input\n\n\n\nif x - r < 0 or x + r > W:\n\n\tprint(\"No\")\n\nelif y - r < 0 or y + r > H:\n\n\tprint(\"No\")\n\nelse:\n\n\tprint(\"Yes\")", "code_v0_loc": 7, "code_v1_loc": 11, "code_v0_num_chars": 153, "code_v1_num_chars": 190, "code_v0_no_empty_lines": "ia = [int(i) for i in input().split(\" \")]\nW = ia[0]\nH = ia[1]\nx = ia[2]\ny = ia[3]\nr = ia[4]\nprint((\"Yes\" if 0 <= x - r and x + r <= W and 0 <= y - r and y + r <= H else \"No\"))\n", "code_v1_no_empty_lines": "# encoding:utf-8\ninput = list(map(int, input().split()))\nW, H, x, y, r = input\nif x - r < 0 or x + r > W:\n print(\"No\")\nelif y - r < 0 or y + r > H:\n print(\"No\")\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-ia = [int(i) for i in input().split(\" \")]", "-W = ia[0]", "-H = ia[1]", "-x = ia[2]", "-y = ia[3]", "-r = ia[4]", "-print((\"Yes\" if 0 <= x - r and x + r <= W and 0 <= y - r and y + r <= H else \"No\"))", "+# encoding:utf-8", "+input = list(map(int, input().split()))", "+W, H, x, y, r = input", "+if x - r < 0 or x + r > W:", "+ print(\"No\")", "+elif y - r < 0 or y + r > H:", "+ print(\"No\")", "+else:", "+ print(\"Yes\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.354291319, "measured_runtime_v1": 0.2815986323, "runtime_lift": 1.2581428969, "key": ["s949778573", "s992404688"], "target_token_count_dream": 70, "target_token_bucket_dream": "<128"} +{"user_id": "u310381103", "problem_id": "p03457", "language": "python", "submission_id_v0": "s861400279", "submission_id_v1": "s171825130", "cpu_time_v0": 647, "cpu_time_v1": 294, "memory_v0": 63064, "memory_v1": 27216, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.56, "input": "N=input()\n\na=[]\n\nt=True\n\nfor _ in range(int(N)):\n\n a+=[list(map(int,input().split()))]\n\nfor i in range(int(N)):\n\n if a[i][0]%2==0:\n\n if abs(a[i][1]+a[i][2])<=a[i][0] and (a[i][1]+a[i][2])%2==0:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\n else:\n\n if abs(a[i][1]+a[i][2]<=a[i][0]) and (a[i][1]+a[i][2])%2==1:\n\n continue\n\n else:\n\n print('No')\n\n t=False\n\n break\n\nif t:\n\n print('Yes')", "target": "import sys\n\nn=int(input())\n\nt=[]\n\nfor i in range(n):\n\n t.append(list(map(int,input().split())))\n\nfor i,d in enumerate(t):\n\n if i>0:\n\n b=d[0]-a\n\n c=abs(d[1]+d[2]-aa)\n\n a=d[0]\n\n aa=d[1]+d[2]\n\n if i==0:\n\n if not (a >= aa and a % 2 == aa % 2):\n\n print('No')\n\n sys.exit()\n\n else:\n\n continue\n\n if not (b>=c and b%2==c%2):\n\n print('No')\n\n sys.exit()\n\nprint('Yes')", "code_v0_loc": 22, "code_v1_loc": 21, "code_v0_num_chars": 516, "code_v1_num_chars": 449, "code_v0_no_empty_lines": "N = input()\na = []\nt = True\nfor _ in range(int(N)):\n a += [list(map(int, input().split()))]\nfor i in range(int(N)):\n if a[i][0] % 2 == 0:\n if abs(a[i][1] + a[i][2]) <= a[i][0] and (a[i][1] + a[i][2]) % 2 == 0:\n continue\n else:\n print(\"No\")\n t = False\n break\n else:\n if abs(a[i][1] + a[i][2] <= a[i][0]) and (a[i][1] + a[i][2]) % 2 == 1:\n continue\n else:\n print(\"No\")\n t = False\n break\nif t:\n print(\"Yes\")\n", "code_v1_no_empty_lines": "import sys\n\nn = int(input())\nt = []\nfor i in range(n):\n t.append(list(map(int, input().split())))\nfor i, d in enumerate(t):\n if i > 0:\n b = d[0] - a\n c = abs(d[1] + d[2] - aa)\n a = d[0]\n aa = d[1] + d[2]\n if i == 0:\n if not (a >= aa and a % 2 == aa % 2):\n print(\"No\")\n sys.exit()\n else:\n continue\n if not (b >= c and b % 2 == c % 2):\n print(\"No\")\n sys.exit()\nprint(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-N = input()", "-a = []", "-t = True", "-for _ in range(int(N)):", "- a += [list(map(int, input().split()))]", "-for i in range(int(N)):", "- if a[i][0] % 2 == 0:", "- if abs(a[i][1] + a[i][2]) <= a[i][0] and (a[i][1] + a[i][2]) % 2 == 0:", "+import sys", "+", "+n = int(input())", "+t = []", "+for i in range(n):", "+ t.append(list(map(int, input().split())))", "+for i, d in enumerate(t):", "+ if i > 0:", "+ b = d[0] - a", "+ c = abs(d[1] + d[2] - aa)", "+ a = d[0]", "+ aa = d[1] + d[2]", "+ if i == 0:", "+ if not (a >= aa and a % 2 == aa % 2):", "+ print(\"No\")", "+ sys.exit()", "+ else:", "- else:", "- print(\"No\")", "- t = False", "- break", "- else:", "- if abs(a[i][1] + a[i][2] <= a[i][0]) and (a[i][1] + a[i][2]) % 2 == 1:", "- continue", "- else:", "- print(\"No\")", "- t = False", "- break", "-if t:", "- print(\"Yes\")", "+ if not (b >= c and b % 2 == c % 2):", "+ print(\"No\")", "+ sys.exit()", "+print(\"Yes\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2371032157, "measured_runtime_v1": 0.0063223619, "runtime_lift": 37.5023159605, "key": ["s861400279", "s171825130"], "target_token_count_dream": 146, "target_token_bucket_dream": "128-256"} +{"user_id": "u576432509", "problem_id": "p03371", "language": "python", "submission_id_v0": "s537618501", "submission_id_v1": "s493344814", "cpu_time_v0": 215, "cpu_time_v1": 122, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.26, "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nyenmin=a*x+b*y\n\nfor zz in range(2*10**5+1):\n\n xx=max(x-zz//2,0)\n\n yy=max(y-zz//2,0)\n\n yen=a*xx+b*yy+c*zz\n\n if yen d[v]+cost:\n\n d[to] = d[v]+cost\n\n par[to] = v\n\n que.put((d[to],to))\n\n\n\n for j in range(n):\n\n if i != j:\n\n a,b = j,par[j]\n\n if a>b:\n\n a,b = b,a\n\n used.add((a,b))\n\n\n\n print((m - len(used)))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "INF = 123456789\n\n\n\ndef main():\n\n n,m = list(map(int,input().split()))\n\n\n\n d = [ [INF for i in range(n)] for j in range(n) ]\n\n for i in range(n):\n\n d[i][i] = 0\n\n\n\n a = [0 for _ in range(m)]\n\n b = [0 for _ in range(m)]\n\n c = [0 for _ in range(m)]\n\n for i in range(m):\n\n a[i],b[i],c[i] = list(map(int,input().split()))\n\n a[i] -= 1\n\n b[i] -= 1\n\n d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])\n\n d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])\n\n\n\n # Warshall-Floyd\n\n for k in range(n):\n\n for i in range(n):\n\n for j in range(n):\n\n d[i][j] = min(d[i][j], d[i][k]+d[k][j])\n\n\n\n ans = 0\n\n for i in range(m):\n\n found = 1\n\n for j in range(n):\n\n if d[j][a[i]] + c[i] == d[j][b[i]]:\n\n found = 0\n\n break\n\n ans += found\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 46, "code_v1_loc": 37, "code_v0_num_chars": 1060, "code_v1_num_chars": 907, "code_v0_no_empty_lines": "import queue\n\nINF = 123456789\n\n\ndef main():\n n, m = list(map(int, input().split()))\n G = [[] for _ in range(n)]\n for _ in range(m):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n G[a].append((b, c))\n G[b].append((a, c))\n used = set()\n for i in range(n):\n d = [INF for _ in range(n)]\n par = [-1 for _ in range(n)]\n # dijkstra\n que = queue.PriorityQueue()\n d[i] = 0\n que.put((0, i))\n while not que.empty():\n p = que.get()\n v = p[1]\n if d[v] < p[0]:\n continue\n for (to, cost) in G[v]:\n if d[to] > d[v] + cost:\n d[to] = d[v] + cost\n par[to] = v\n que.put((d[to], to))\n for j in range(n):\n if i != j:\n a, b = j, par[j]\n if a > b:\n a, b = b, a\n used.add((a, b))\n print((m - len(used)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "INF = 123456789\n\n\ndef main():\n n, m = list(map(int, input().split()))\n d = [[INF for i in range(n)] for j in range(n)]\n for i in range(n):\n d[i][i] = 0\n a = [0 for _ in range(m)]\n b = [0 for _ in range(m)]\n c = [0 for _ in range(m)]\n for i in range(m):\n a[i], b[i], c[i] = list(map(int, input().split()))\n a[i] -= 1\n b[i] -= 1\n d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])\n d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])\n # Warshall-Floyd\n for k in range(n):\n for i in range(n):\n for j in range(n):\n d[i][j] = min(d[i][j], d[i][k] + d[k][j])\n ans = 0\n for i in range(m):\n found = 1\n for j in range(n):\n if d[j][a[i]] + c[i] == d[j][b[i]]:\n found = 0\n break\n ans += found\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 19.5652173913, "diff": ["-import queue", "-", "- G = [[] for _ in range(n)]", "- for _ in range(m):", "- a, b, c = list(map(int, input().split()))", "- a -= 1", "- b -= 1", "- G[a].append((b, c))", "- G[b].append((a, c))", "- used = set()", "+ d = [[INF for i in range(n)] for j in range(n)]", "- d = [INF for _ in range(n)]", "- par = [-1 for _ in range(n)]", "- # dijkstra", "- que = queue.PriorityQueue()", "- d[i] = 0", "- que.put((0, i))", "- while not que.empty():", "- p = que.get()", "- v = p[1]", "- if d[v] < p[0]:", "- continue", "- for (to, cost) in G[v]:", "- if d[to] > d[v] + cost:", "- d[to] = d[v] + cost", "- par[to] = v", "- que.put((d[to], to))", "+ d[i][i] = 0", "+ a = [0 for _ in range(m)]", "+ b = [0 for _ in range(m)]", "+ c = [0 for _ in range(m)]", "+ for i in range(m):", "+ a[i], b[i], c[i] = list(map(int, input().split()))", "+ a[i] -= 1", "+ b[i] -= 1", "+ d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])", "+ d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])", "+ # Warshall-Floyd", "+ for k in range(n):", "+ for i in range(n):", "+ for j in range(n):", "+ d[i][j] = min(d[i][j], d[i][k] + d[k][j])", "+ ans = 0", "+ for i in range(m):", "+ found = 1", "- if i != j:", "- a, b = j, par[j]", "- if a > b:", "- a, b = b, a", "- used.add((a, b))", "- print((m - len(used)))", "+ if d[j][a[i]] + c[i] == d[j][b[i]]:", "+ found = 0", "+ break", "+ ans += found", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3167709551, "measured_runtime_v1": 0.2522355395, "runtime_lift": 1.2558537773, "key": ["s032580281", "s724625000"], "target_token_count_dream": 307, "target_token_bucket_dream": "256-512"} +{"user_id": "u282228874", "problem_id": "p03416", "language": "python", "submission_id_v0": "s105404887", "submission_id_v1": "s977655968", "cpu_time_v0": 128, "cpu_time_v1": 48, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 62.5, "input": "a,b = list(map(int,input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n s = str(i)\n\n l = len(s)\n\n if all(s[j] == s[l-j-1] for j in range(l)):\n\n count += 1\n\nprint(count)", "target": "a,b = list(map(int,input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n s = str(i)\n\n if s == s[::-1]:\n\n count += 1\n\nprint(count)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 184, "code_v1_num_chars": 138, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n s = str(i)\n l = len(s)\n if all(s[j] == s[l - j - 1] for j in range(l)):\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- l = len(s)", "- if all(s[j] == s[l - j - 1] for j in range(l)):", "+ if s == s[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5951726662, "measured_runtime_v1": 0.34452695, "runtime_lift": 1.72750685, "key": ["s105404887", "s977655968"], "target_token_count_dream": 47, "target_token_bucket_dream": "<128"} +{"user_id": "u156815136", "problem_id": "p02921", "language": "python", "submission_id_v0": "s427233353", "submission_id_v1": "s366680967", "cpu_time_v0": 35, "cpu_time_v1": 17, "memory_v0": 5048, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 51.43, "input": "import itertools\n\nimport math\n\ndef main():\n\n s = input()\n\n t = input()\n\n cnt = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n cnt += 1\n\n print(cnt)\n\nif __name__ == '__main__':\n\n main()", "target": "s = input()\n\nt = input()\n\nans = 0\n\nfor i in range(3):\n\n if s[i] == t[i]:\n\n ans += 1\n\nprint(ans)\n", "code_v0_loc": 12, "code_v1_loc": 7, "code_v0_num_chars": 200, "code_v1_num_chars": 106, "code_v0_no_empty_lines": "import itertools\nimport math\n\n\ndef main():\n s = input()\n t = input()\n cnt = 0\n for i in range(3):\n if s[i] == t[i]:\n cnt += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "s = input()\nt = input()\nans = 0\nfor i in range(3):\n if s[i] == t[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.6666666667, "diff": ["-import itertools", "-import math", "-", "-", "-def main():", "- s = input()", "- t = input()", "- cnt = 0", "- for i in range(3):", "- if s[i] == t[i]:", "- cnt += 1", "- print(cnt)", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+s = input()", "+t = input()", "+ans = 0", "+for i in range(3):", "+ if s[i] == t[i]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.370313344, "measured_runtime_v1": 0.278846802, "runtime_lift": 1.3280171813, "key": ["s427233353", "s366680967"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u057109575", "problem_id": "p03579", "language": "python", "submission_id_v0": "s986959512", "submission_id_v1": "s945473888", "cpu_time_v0": 918, "cpu_time_v1": 684, "memory_v0": 108376, "memory_v1": 76248, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.49, "input": "import sys\n\nsys.setrecursionlimit(100000)\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(v, c):\n\n # c: color = 1 or -1\n\n node[v] = c\n\n for i in graph[v]:\n\n if node[i] == c:\n\n return False\n\n \n\n if node[i] == 0 and not dfs(i, -c):\n\n return False\n\n \n\n return True\n\n\n\nnode = [0] * N\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in node) // 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) // 2 - M))\n", "target": "from collections import deque\n\nN, M = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor x, y in edges:\n\n graph[x - 1].append(y - 1)\n\n graph[y - 1].append(x - 1)\n\n\n\ndef dfs(s, c):\n\n q = deque()\n\n q.append(s)\n\n visited[s] = True\n\n color[s] = c\n\n \n\n while len(q) > 0:\n\n v = q.pop()\n\n for i in graph[v]:\n\n if visited[i] and color[i] == color[v]:\n\n return False\n\n \n\n if not visited[i]:\n\n visited[i] = True\n\n color[i] = -color[v]\n\n q.append(i)\n\n \n\n return True\n\n\n\nvisited = [False] * N\n\ncolor = [0] * N\n\n\n\nif dfs(0, 1):\n\n x = sum(v + 1 for v in color) // 2\n\n print((x * (N - x) - M))\n\nelse:\n\n print((N * (N - 1) // 2 - M))\n\n \n\n ", "code_v0_loc": 28, "code_v1_loc": 38, "code_v0_num_chars": 640, "code_v1_num_chars": 858, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(100000)\nN, M = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N)]\nfor x, y in edges:\n graph[x - 1].append(y - 1)\n graph[y - 1].append(x - 1)\n\n\ndef dfs(v, c):\n # c: color = 1 or -1\n node[v] = c\n for i in graph[v]:\n if node[i] == c:\n return False\n if node[i] == 0 and not dfs(i, -c):\n return False\n return True\n\n\nnode = [0] * N\nif dfs(0, 1):\n x = sum(v + 1 for v in node) // 2\n print((x * (N - x) - M))\nelse:\n print((N * (N - 1) // 2 - M))\n", "code_v1_no_empty_lines": "from collections import deque\n\nN, M = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N)]\nfor x, y in edges:\n graph[x - 1].append(y - 1)\n graph[y - 1].append(x - 1)\n\n\ndef dfs(s, c):\n q = deque()\n q.append(s)\n visited[s] = True\n color[s] = c\n while len(q) > 0:\n v = q.pop()\n for i in graph[v]:\n if visited[i] and color[i] == color[v]:\n return False\n if not visited[i]:\n visited[i] = True\n color[i] = -color[v]\n q.append(i)\n return True\n\n\nvisited = [False] * N\ncolor = [0] * N\nif dfs(0, 1):\n x = sum(v + 1 for v in color) // 2\n print((x * (N - x) - M))\nelse:\n print((N * (N - 1) // 2 - M))\n", "code_same": false, "relative_loc_diff_percent": 26.3157894737, "diff": ["-import sys", "+from collections import deque", "-sys.setrecursionlimit(100000)", "-def dfs(v, c):", "- # c: color = 1 or -1", "- node[v] = c", "- for i in graph[v]:", "- if node[i] == c:", "- return False", "- if node[i] == 0 and not dfs(i, -c):", "- return False", "+def dfs(s, c):", "+ q = deque()", "+ q.append(s)", "+ visited[s] = True", "+ color[s] = c", "+ while len(q) > 0:", "+ v = q.pop()", "+ for i in graph[v]:", "+ if visited[i] and color[i] == color[v]:", "+ return False", "+ if not visited[i]:", "+ visited[i] = True", "+ color[i] = -color[v]", "+ q.append(i)", "-node = [0] * N", "+visited = [False] * N", "+color = [0] * N", "- x = sum(v + 1 for v in node) // 2", "+ x = sum(v + 1 for v in color) // 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2537954175, "measured_runtime_v1": 0.006062909, "runtime_lift": 41.8603372027, "key": ["s986959512", "s945473888"], "target_token_count_dream": 255, "target_token_bucket_dream": "128-256"} +{"user_id": "u426534722", "problem_id": "p02248", "language": "python", "submission_id_v0": "s909106276", "submission_id_v1": "s961733692", "cpu_time_v0": 910, "cpu_time_v1": 790, "memory_v0": 117852, "memory_v1": 117860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.19, "input": "def kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return nx\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = input()\n\nP = input()\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n", "target": "def kmpTable(w):\n\n lw = len(w)\n\n nx = [-1] * (lw + 1)\n\n j = -1\n\n for i in range(lw):\n\n while j >= 0 and w[i] != w[j]:\n\n j = nx[j]\n\n j += 1\n\n nx[i + 1] = j\n\n return tuple(nx)\n\ndef kmpSearch(s, w):\n\n ls = len(s)\n\n start = 0\n\n w_idx = 0\n\n ret = []\n\n nx = kmpTable(w)\n\n while start + w_idx < ls:\n\n if s[start + w_idx] == w[w_idx]:\n\n w_idx += 1\n\n if w_idx == len(w):\n\n ret.append(start)\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n else:\n\n if w_idx == 0:\n\n start += 1\n\n else:\n\n start = start + w_idx - nx[w_idx]\n\n w_idx = nx[w_idx]\n\n return ret\n\nT = input()\n\nP = input()\n\nans = kmpSearch(T, P)\n\nif ans:\n\n print((\"\\n\".join(map(str, ans))))\t\n\n\n", "code_v0_loc": 36, "code_v1_loc": 36, "code_v0_num_chars": 860, "code_v1_num_chars": 867, "code_v0_no_empty_lines": "def kmpTable(w):\n lw = len(w)\n nx = [-1] * (lw + 1)\n j = -1\n for i in range(lw):\n while j >= 0 and w[i] != w[j]:\n j = nx[j]\n j += 1\n nx[i + 1] = j\n return nx\n\n\ndef kmpSearch(s, w):\n ls = len(s)\n start = 0\n w_idx = 0\n ret = []\n nx = kmpTable(w)\n while start + w_idx < ls:\n if s[start + w_idx] == w[w_idx]:\n w_idx += 1\n if w_idx == len(w):\n ret.append(start)\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n else:\n if w_idx == 0:\n start += 1\n else:\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n return ret\n\n\nT = input()\nP = input()\nans = kmpSearch(T, P)\nif ans:\n print((\"\\n\".join(map(str, ans))))\n", "code_v1_no_empty_lines": "def kmpTable(w):\n lw = len(w)\n nx = [-1] * (lw + 1)\n j = -1\n for i in range(lw):\n while j >= 0 and w[i] != w[j]:\n j = nx[j]\n j += 1\n nx[i + 1] = j\n return tuple(nx)\n\n\ndef kmpSearch(s, w):\n ls = len(s)\n start = 0\n w_idx = 0\n ret = []\n nx = kmpTable(w)\n while start + w_idx < ls:\n if s[start + w_idx] == w[w_idx]:\n w_idx += 1\n if w_idx == len(w):\n ret.append(start)\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n else:\n if w_idx == 0:\n start += 1\n else:\n start = start + w_idx - nx[w_idx]\n w_idx = nx[w_idx]\n return ret\n\n\nT = input()\nP = input()\nans = kmpSearch(T, P)\nif ans:\n print((\"\\n\".join(map(str, ans))))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- return nx", "+ return tuple(nx)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.215319014, "measured_runtime_v1": 0.1265300495, "runtime_lift": 1.7017223565, "key": ["s909106276", "s961733692"], "target_token_count_dream": 258, "target_token_bucket_dream": "256-512"} +{"user_id": "u312025627", "problem_id": "p03457", "language": "python", "submission_id_v0": "s103328073", "submission_id_v1": "s130173321", "cpu_time_v0": 250, "cpu_time_v1": 183, "memory_v0": 55644, "memory_v1": 21108, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.8, "input": "def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time, px, py = 0, 0, 0\n\n for t, x, y in TXY:\n\n move = abs(x-px) + abs(y-py)\n\n # print(move, t-time)\n\n if (t - time) % 2 != move % 2 or t - time < move:\n\n return print(\"No\")\n\n time, px, py = t, x, y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N = int(input())\n\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n\n time = 0\n\n px = 0\n\n py = 0\n\n for t, x, y in TXY:\n\n move = abs(py-y) + abs(px - x)\n\n if (t-time) < move or (t - time) % 2 != move % 2:\n\n return print(\"No\")\n\n time = t\n\n px = x\n\n py = y\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 17, "code_v1_loc": 20, "code_v0_num_chars": 461, "code_v1_num_chars": 460, "code_v0_no_empty_lines": "def main():\n import sys\n\n input = sys.stdin.buffer.readline\n N = int(input())\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n time, px, py = 0, 0, 0\n for t, x, y in TXY:\n move = abs(x - px) + abs(y - py)\n # print(move, t-time)\n if (t - time) % 2 != move % 2 or t - time < move:\n return print(\"No\")\n time, px, py = t, x, y\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n import sys\n\n input = sys.stdin.buffer.readline\n N = int(input())\n TXY = [[int(i) for i in input().split()] for j in range(N)]\n time = 0\n px = 0\n py = 0\n for t, x, y in TXY:\n move = abs(py - y) + abs(px - x)\n if (t - time) < move or (t - time) % 2 != move % 2:\n return print(\"No\")\n time = t\n px = x\n py = y\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["- time, px, py = 0, 0, 0", "+ time = 0", "+ px = 0", "+ py = 0", "- move = abs(x - px) + abs(y - py)", "- # print(move, t-time)", "- if (t - time) % 2 != move % 2 or t - time < move:", "+ move = abs(py - y) + abs(px - x)", "+ if (t - time) < move or (t - time) % 2 != move % 2:", "- time, px, py = t, x, y", "+ time = t", "+ px = x", "+ py = y"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3387642326, "measured_runtime_v1": 0.1945750663, "runtime_lift": 1.7410464712, "key": ["s103328073", "s130173321"], "target_token_count_dream": 146, "target_token_bucket_dream": "128-256"} +{"user_id": "u637175065", "problem_id": "p03553", "language": "python", "submission_id_v0": "s305170925", "submission_id_v1": "s833575440", "cpu_time_v0": 88, "cpu_time_v1": 46, "memory_v0": 7240, "memory_v1": 10956, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.73, "input": "import math,string,itertools,math,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf = 10**20\n\neps = 1.0 / 10**15\n\nmod = 10**9+7\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef F(): return float(sys.stdin.readline())\n\ndef S(): return input()\n\ndef pf(s): return print(s, flush=True)\n\ndef divisions(n):\n\n sq = int(math.sqrt(n)+1)\n\n d = collections.defaultdict(int)\n\n while n % 2 == 0:\n\n n //= 2\n\n d[2] += 1\n\n i = 3\n\n while n > 1 and sq >= i:\n\n if n % i == 0:\n\n n //= i\n\n d[i] += 1\n\n else:\n\n i += 2\n\n\n\n if n > 1:\n\n d[n] += 1\n\n\n\n r = [1]\n\n for k, v in d.items():\n\n for c in r[:]:\n\n for i in range(1,v+1):\n\n r.append(c*(k**i))\n\n\n\n return sorted(r)\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n s = set()\n\n for i in range(n,0,-1):\n\n d = divisions(i)\n\n ld = len(d)\n\n for j in range(1,2**ld):\n\n c = []\n\n ff = True\n\n for k in range(ld):\n\n if j & (1< 0:\n\n e[c][i] -= k\n\n e[i][c] += k\n\n return k\n\n return 0\n\n\n\n while True:\n\n self.v = [None] * self.N\n\n fs = f(s, inf)\n\n if fs == 0:\n\n break\n\n r += fs\n\n\n\n return r\n\n\n\n\n\ndef main():\n\n n = I()\n\n a = LI()\n\n\n\n s = n\n\n t = n + 1\n\n e = [[0] * (n+2) for _ in range(n+2)]\n\n for i in range(n):\n\n c = a[i]\n\n if c < 0:\n\n e[s][i] = -c\n\n ii = i + 1\n\n for j in range(ii*2, n+1, ii):\n\n e[i][j-1] = inf\n\n else:\n\n e[i][t] = c\n\n\n\n\n\n fl = Flow(e, n+2)\n\n r = fl.max_flow(s,t)\n\n\n\n return sum(map(lambda x: max(0,x), a)) - r\n\n\n\n# start = time.time()\n\nprint(main())\n\n# pe(time.time() - start)\n\n\n\n\n\n\n", "code_v0_loc": 92, "code_v1_loc": 89, "code_v0_num_chars": 2351, "code_v1_num_chars": 2252, "code_v0_no_empty_lines": "import math, string, itertools, math, heapq, collections, re, array, bisect, sys, random, time, copy, functools\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**15\nmod = 10**9 + 7\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef F():\n return float(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\ndef pf(s):\n return print(s, flush=True)\n\n\ndef divisions(n):\n sq = int(math.sqrt(n) + 1)\n d = collections.defaultdict(int)\n while n % 2 == 0:\n n //= 2\n d[2] += 1\n i = 3\n while n > 1 and sq >= i:\n if n % i == 0:\n n //= i\n d[i] += 1\n else:\n i += 2\n if n > 1:\n d[n] += 1\n r = [1]\n for k, v in d.items():\n for c in r[:]:\n for i in range(1, v + 1):\n r.append(c * (k**i))\n return sorted(r)\n\n\ndef main():\n n = I()\n a = LI()\n s = set()\n for i in range(n, 0, -1):\n d = divisions(i)\n ld = len(d)\n for j in range(1, 2**ld):\n c = []\n ff = True\n for k in range(ld):\n if j & (1 << k):\n f = True\n for e in c:\n if d[k] % e == 0:\n f = False\n ff = False\n break\n if f:\n c.append(d[k])\n if not ff:\n break\n if ff:\n s.add(tuple(c + [n + 1]))\n b = sorted(list(s), reverse=True)\n for c in b:\n t = 0\n for j in range(1, n + 1):\n f = False\n for e in c:\n if j % e == 0:\n f = True\n break\n if f:\n t += a[j - 1]\n if t < 0:\n for j in range(1, n + 1):\n f = False\n for e in c:\n if j % e == 0:\n f = True\n break\n if f:\n a[j - 1] = 0\n return sum(a)\n\n\nprint(main())\n", "code_v1_no_empty_lines": "import math, string, itertools, math, heapq, collections, re, array, bisect, sys, copy, functools\nimport time, random\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**10\nmod = 10**9 + 7\nmod2 = 998244353\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LLI():\n return [list(map(int, l.split())) for l in sys.stdin.readlines()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef F():\n return float(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\ndef pf(s):\n return print(s, flush=True)\n\n\ndef pe(s):\n return print(str(s), file=sys.stderr)\n\n\ndef JA(a, sep):\n return sep.join(map(str, a))\n\n\ndef JAA(a, s, t):\n return s.join(t.join(map(str, b)) for b in a)\n\n\nclass Flow:\n def __init__(self, e, N):\n self.E = e\n self.N = N\n\n def max_flow(self, s, t):\n r = 0\n e = self.E\n\n def f(c, cap):\n v = self.v\n v[c] = 1\n if c == t:\n return cap\n for i in range(self.N):\n if v[i] or e[c][i] <= 0:\n continue\n cp = min(cap, e[c][i])\n k = f(i, cp)\n if k > 0:\n e[c][i] -= k\n e[i][c] += k\n return k\n return 0\n\n while True:\n self.v = [None] * self.N\n fs = f(s, inf)\n if fs == 0:\n break\n r += fs\n return r\n\n\ndef main():\n n = I()\n a = LI()\n s = n\n t = n + 1\n e = [[0] * (n + 2) for _ in range(n + 2)]\n for i in range(n):\n c = a[i]\n if c < 0:\n e[s][i] = -c\n ii = i + 1\n for j in range(ii * 2, n + 1, ii):\n e[i][j - 1] = inf\n else:\n e[i][t] = c\n fl = Flow(e, n + 2)\n r = fl.max_flow(s, t)\n return sum(map(lambda x: max(0, x), a)) - r\n\n\n# start = time.time()\nprint(main())\n# pe(time.time() - start)\n", "code_same": false, "relative_loc_diff_percent": 3.2608695652, "diff": ["-import math, string, itertools, math, heapq, collections, re, array, bisect, sys, random, time, copy, functools", "+import math, string, itertools, math, heapq, collections, re, array, bisect, sys, copy, functools", "+import time, random", "-eps = 1.0 / 10**15", "+eps = 1.0 / 10**10", "+mod2 = 998244353", "+dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]", "+ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]", "- return [int(x) for x in sys.stdin.readline().split()]", "+ return list(map(int, sys.stdin.readline().split()))", "+", "+", "+def LLI():", "+ return [list(map(int, l.split())) for l in sys.stdin.readlines()]", "-def divisions(n):", "- sq = int(math.sqrt(n) + 1)", "- d = collections.defaultdict(int)", "- while n % 2 == 0:", "- n //= 2", "- d[2] += 1", "- i = 3", "- while n > 1 and sq >= i:", "- if n % i == 0:", "- n //= i", "- d[i] += 1", "- else:", "- i += 2", "- if n > 1:", "- d[n] += 1", "- r = [1]", "- for k, v in d.items():", "- for c in r[:]:", "- for i in range(1, v + 1):", "- r.append(c * (k**i))", "- return sorted(r)", "+def pe(s):", "+ return print(str(s), file=sys.stderr)", "+", "+", "+def JA(a, sep):", "+ return sep.join(map(str, a))", "+", "+", "+def JAA(a, s, t):", "+ return s.join(t.join(map(str, b)) for b in a)", "+", "+", "+class Flow:", "+ def __init__(self, e, N):", "+ self.E = e", "+ self.N = N", "+", "+ def max_flow(self, s, t):", "+ r = 0", "+ e = self.E", "+", "+ def f(c, cap):", "+ v = self.v", "+ v[c] = 1", "+ if c == t:", "+ return cap", "+ for i in range(self.N):", "+ if v[i] or e[c][i] <= 0:", "+ continue", "+ cp = min(cap, e[c][i])", "+ k = f(i, cp)", "+ if k > 0:", "+ e[c][i] -= k", "+ e[i][c] += k", "+ return k", "+ return 0", "+", "+ while True:", "+ self.v = [None] * self.N", "+ fs = f(s, inf)", "+ if fs == 0:", "+ break", "+ r += fs", "+ return r", "- s = set()", "- for i in range(n, 0, -1):", "- d = divisions(i)", "- ld = len(d)", "- for j in range(1, 2**ld):", "- c = []", "- ff = True", "- for k in range(ld):", "- if j & (1 << k):", "- f = True", "- for e in c:", "- if d[k] % e == 0:", "- f = False", "- ff = False", "- break", "- if f:", "- c.append(d[k])", "- if not ff:", "- break", "- if ff:", "- s.add(tuple(c + [n + 1]))", "- b = sorted(list(s), reverse=True)", "- for c in b:", "- t = 0", "- for j in range(1, n + 1):", "- f = False", "- for e in c:", "- if j % e == 0:", "- f = True", "- break", "- if f:", "- t += a[j - 1]", "- if t < 0:", "- for j in range(1, n + 1):", "- f = False", "- for e in c:", "- if j % e == 0:", "- f = True", "- break", "- if f:", "- a[j - 1] = 0", "- return sum(a)", "+ s = n", "+ t = n + 1", "+ e = [[0] * (n + 2) for _ in range(n + 2)]", "+ for i in range(n):", "+ c = a[i]", "+ if c < 0:", "+ e[s][i] = -c", "+ ii = i + 1", "+ for j in range(ii * 2, n + 1, ii):", "+ e[i][j - 1] = inf", "+ else:", "+ e[i][t] = c", "+ fl = Flow(e, n + 2)", "+ r = fl.max_flow(s, t)", "+ return sum(map(lambda x: max(0, x), a)) - r", "+# start = time.time()", "+# pe(time.time() - start)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2170818343, "measured_runtime_v1": 0.0062613072, "runtime_lift": 34.670369248, "key": ["s305170925", "s833575440"], "target_token_count_dream": 690, "target_token_bucket_dream": "512-1024"} +{"user_id": "u096128910", "problem_id": "p02881", "language": "python", "submission_id_v0": "s987616882", "submission_id_v1": "s695744152", "cpu_time_v0": 126, "cpu_time_v1": 81, "memory_v0": 66508, "memory_v1": 64160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 35.71, "input": "N = int(input())\n\nans = N - 1\n\np = 1\n\nfor i in range(2, int((N ** 0.5) + 1)):\n\n if p % 2 == 1 and i > (N ** 0.5):\n\n break\n\n if N % i == 0:\n\n p = i\n\n j = N // i\n\n m = i + j - 2\n\n if m < ans:\n\n ans = m\n\n else:\n\n continue\n\n else:\n\n continue\n\nprint(ans)\n", "target": "N = int(input())\n\nans = N - 1\n\nfor i in range(2, int((N ** 0.5) + 1)):\n\n if N % i == 0:\n\n j = N // i\n\n m = i + j - 2\n\n ans = min(ans, m)\n\nprint(ans)\n", "code_v0_loc": 17, "code_v1_loc": 8, "code_v0_num_chars": 330, "code_v1_num_chars": 173, "code_v0_no_empty_lines": "N = int(input())\nans = N - 1\np = 1\nfor i in range(2, int((N**0.5) + 1)):\n if p % 2 == 1 and i > (N**0.5):\n break\n if N % i == 0:\n p = i\n j = N // i\n m = i + j - 2\n if m < ans:\n ans = m\n else:\n continue\n else:\n continue\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nans = N - 1\nfor i in range(2, int((N**0.5) + 1)):\n if N % i == 0:\n j = N // i\n m = i + j - 2\n ans = min(ans, m)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 52.9411764706, "diff": ["-p = 1", "- if p % 2 == 1 and i > (N**0.5):", "- break", "- p = i", "- if m < ans:", "- ans = m", "- else:", "- continue", "- else:", "- continue", "+ ans = min(ans, m)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3775834899, "measured_runtime_v1": 0.2214011464, "runtime_lift": 1.7054269863, "key": ["s987616882", "s695744152"], "target_token_count_dream": 70, "target_token_bucket_dream": "<128"} +{"user_id": "u408071652", "problem_id": "p03078", "language": "python", "submission_id_v0": "s229462844", "submission_id_v1": "s240353408", "cpu_time_v0": 159, "cpu_time_v1": 114, "memory_v0": 72796, "memory_v1": 80804, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.3, "input": "import sys\n\nimport heapq\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n Q = []\n\n S = set()\n\n heapq.heapify(Q)\n\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n\n for i in range(K):\n\n m, a, b, c = heapq.heappop(Q)\n\n print((-m))\n\n if (a + 1, b, c) not in S and a + 1 < X:\n\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n\n S.add((a + 1, b, c))\n\n if (a, b + 1, c) not in S and b + 1 < Y:\n\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n\n S.add((a, b + 1, c))\n\n if (a, b, c + 1) not in S and c + 1 < Z:\n\n heapq.heappush(Q, (-A[a ] - B[b] - C[c+1], a, b, c + 1))\n\n S.add((a, b, c + 1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "import sys\n\n\n\n\n\n# \\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n X, Y, Z, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n\n\n L = []\n\n\n\n for i in range(X):\n\n for j in range(min(Y, K // (i + 1) + 1)):\n\n for k in range(min(Z, K // (i + 1) // (j + 1) + 1)):\n\n L.append(A[i] + B[j] + C[k])\n\n\n\n L.sort(reverse=True)\n\n\n\n for i in range(K):\n\n print((L[i]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 39, "code_v1_loc": 33, "code_v0_num_chars": 1051, "code_v1_num_chars": 663, "code_v0_no_empty_lines": "import sys\nimport heapq\n\n# \\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n X, Y, Z, K = list(map(int, input().split()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n C = list(map(int, input().split()))\n A.sort(reverse=True)\n B.sort(reverse=True)\n C.sort(reverse=True)\n Q = []\n S = set()\n heapq.heapify(Q)\n heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))\n for i in range(K):\n m, a, b, c = heapq.heappop(Q)\n print((-m))\n if (a + 1, b, c) not in S and a + 1 < X:\n heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))\n S.add((a + 1, b, c))\n if (a, b + 1, c) not in S and b + 1 < Y:\n heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))\n S.add((a, b + 1, c))\n if (a, b, c + 1) not in S and c + 1 < Z:\n heapq.heappush(Q, (-A[a] - B[b] - C[c + 1], a, b, c + 1))\n S.add((a, b, c + 1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\n# \\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n X, Y, Z, K = list(map(int, input().split()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n C = list(map(int, input().split()))\n A.sort(reverse=True)\n B.sort(reverse=True)\n C.sort(reverse=True)\n L = []\n for i in range(X):\n for j in range(min(Y, K // (i + 1) + 1)):\n for k in range(min(Z, K // (i + 1) // (j + 1) + 1)):\n L.append(A[i] + B[j] + C[k])\n L.sort(reverse=True)\n for i in range(K):\n print((L[i]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["-import heapq", "- Q = []", "- S = set()", "- heapq.heapify(Q)", "- heapq.heappush(Q, (-A[0] - B[0] - C[0], 0, 0, 0))", "+ L = []", "+ for i in range(X):", "+ for j in range(min(Y, K // (i + 1) + 1)):", "+ for k in range(min(Z, K // (i + 1) // (j + 1) + 1)):", "+ L.append(A[i] + B[j] + C[k])", "+ L.sort(reverse=True)", "- m, a, b, c = heapq.heappop(Q)", "- print((-m))", "- if (a + 1, b, c) not in S and a + 1 < X:", "- heapq.heappush(Q, (-A[a + 1] - B[b] - C[c], a + 1, b, c))", "- S.add((a + 1, b, c))", "- if (a, b + 1, c) not in S and b + 1 < Y:", "- heapq.heappush(Q, (-A[a] - B[b + 1] - C[c], a, b + 1, c))", "- S.add((a, b + 1, c))", "- if (a, b, c + 1) not in S and c + 1 < Z:", "- heapq.heappush(Q, (-A[a] - B[b] - C[c + 1], a, b, c + 1))", "- S.add((a, b, c + 1))", "+ print((L[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3053240893, "measured_runtime_v1": 0.1252524042, "runtime_lift": 2.4376704877, "key": ["s229462844", "s240353408"], "target_token_count_dream": 199, "target_token_bucket_dream": "128-256"} +{"user_id": "u599547273", "problem_id": "p03494", "language": "python", "submission_id_v0": "s252753387", "submission_id_v1": "s505612116", "cpu_time_v0": 21, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.29, "input": "def two_count(x):\n\n\tif int(str(x)[-1]) % 2 == 0:\n\n\t\treturn 1 + two_count(x//2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(input())\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))", "target": "def two_count(x):\n\n\tif x % 2 == 0:\n\n\t\treturn 1 + two_count(x//2)\n\n\telse:\n\n\t\treturn 0\n\n\n\nn = int(input())\n\nn_list = [int(n) for n in input().split(\" \")]\n\n\n\nn_two_count_list = [two_count(n) for n in n_list]\n\n\n\nprint((min(n_two_count_list)))", "code_v0_loc": 12, "code_v1_loc": 12, "code_v0_num_chars": 250, "code_v1_num_chars": 236, "code_v0_no_empty_lines": "def two_count(x):\n if int(str(x)[-1]) % 2 == 0:\n return 1 + two_count(x // 2)\n else:\n return 0\n\n\nn = int(input())\nn_list = [int(n) for n in input().split(\" \")]\nn_two_count_list = [two_count(n) for n in n_list]\nprint((min(n_two_count_list)))\n", "code_v1_no_empty_lines": "def two_count(x):\n if x % 2 == 0:\n return 1 + two_count(x // 2)\n else:\n return 0\n\n\nn = int(input())\nn_list = [int(n) for n in input().split(\" \")]\nn_two_count_list = [two_count(n) for n in n_list]\nprint((min(n_two_count_list)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if int(str(x)[-1]) % 2 == 0:", "+ if x % 2 == 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3392717605, "measured_runtime_v1": 0.2706325946, "runtime_lift": 1.2536249042, "key": ["s252753387", "s505612116"], "target_token_count_dream": 78, "target_token_bucket_dream": "<128"} +{"user_id": "u150984829", "problem_id": "p02386", "language": "python", "submission_id_v0": "s799017760", "submission_id_v1": "s414241098", "cpu_time_v0": 150, "cpu_time_v1": 130, "memory_v0": 5608, "memory_v1": 5608, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.33, "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if(g[k:k+4]==e[1:5])*(f[0]==e[0])*(f[5]==e[5]):return 'No'\n\n return 'Yes'\n\nprint((f()))\n", "target": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in('012345','152043','215304','302541','410352','514320'):\n\n f=[d[int(k)]for k in p]\n\n g=f[1:5]*2\n\n for k in range(4):\n\n if g[k:k+4]==e[1:5]:\n\n if f[0]==e[0]:\n\n if f[5]==e[5]:return 'No'\n\n return 'Yes'\n\nprint((f()))\n", "code_v0_loc": 14, "code_v1_loc": 16, "code_v0_num_chars": 424, "code_v1_num_chars": 442, "code_v0_no_empty_lines": "n = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):\n f = [d[int(k)] for k in p]\n g = f[1:5] * 2\n for k in range(4):\n if (g[k : k + 4] == e[1:5]) * (f[0] == e[0]) * (f[5] == e[5]):\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_v1_no_empty_lines": "n = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\"012345\", \"152043\", \"215304\", \"302541\", \"410352\", \"514320\"):\n f = [d[int(k)] for k in p]\n g = f[1:5] * 2\n for k in range(4):\n if g[k : k + 4] == e[1:5]:\n if f[0] == e[0]:\n if f[5] == e[5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- if (g[k : k + 4] == e[1:5]) * (f[0] == e[0]) * (f[5] == e[5]):", "- return \"No\"", "+ if g[k : k + 4] == e[1:5]:", "+ if f[0] == e[0]:", "+ if f[5] == e[5]:", "+ return \"No\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.3438470016, "measured_runtime_v1": 0.1932190149, "runtime_lift": 1.7795712385, "key": ["s799017760", "s414241098"], "target_token_count_dream": 208, "target_token_bucket_dream": "128-256"} +{"user_id": "u923270446", "problem_id": "p02814", "language": "python", "submission_id_v0": "s885010221", "submission_id_v1": "s420231524", "cpu_time_v0": 220, "cpu_time_v1": 172, "memory_v0": 16320, "memory_v1": 20208, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.82, "input": "from math import gcd\n\nn, m = list(map(int, input().split()))\n\na = [int(i) // 2 for i in input().split()]\n\nx = 1\n\nfor i in range(n):\n\n x *= a[i] // gcd(x, a[i])\n\nfor i in a:\n\n if x // i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint(((m // x + 1) // 2))", "target": "from math import gcd, ceil\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = [i // 2 for i in a]\n\nl = 1\n\nfor i in a:\n\n l *= i // gcd(l, i)\n\nfor i in a:\n\n if l // i % 2 == 0:\n\n print((0))\n\n exit()\n\nprint((ceil((m // l) / 2)))", "code_v0_loc": 11, "code_v1_loc": 12, "code_v0_num_chars": 259, "code_v1_num_chars": 266, "code_v0_no_empty_lines": "from math import gcd\n\nn, m = list(map(int, input().split()))\na = [int(i) // 2 for i in input().split()]\nx = 1\nfor i in range(n):\n x *= a[i] // gcd(x, a[i])\nfor i in a:\n if x // i % 2 == 0:\n print((0))\n exit()\nprint(((m // x + 1) // 2))\n", "code_v1_no_empty_lines": "from math import gcd, ceil\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = [i // 2 for i in a]\nl = 1\nfor i in a:\n l *= i // gcd(l, i)\nfor i in a:\n if l // i % 2 == 0:\n print((0))\n exit()\nprint((ceil((m // l) / 2)))\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-from math import gcd", "+from math import gcd, ceil", "-a = [int(i) // 2 for i in input().split()]", "-x = 1", "-for i in range(n):", "- x *= a[i] // gcd(x, a[i])", "+a = list(map(int, input().split()))", "+a = [i // 2 for i in a]", "+l = 1", "- if x // i % 2 == 0:", "+ l *= i // gcd(l, i)", "+for i in a:", "+ if l // i % 2 == 0:", "-print(((m // x + 1) // 2))", "+print((ceil((m // l) / 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2764406667, "measured_runtime_v1": 0.214073961, "runtime_lift": 1.2913325159, "key": ["s885010221", "s420231524"], "target_token_count_dream": 98, "target_token_bucket_dream": "<128"} +{"user_id": "u716530146", "problem_id": "p03038", "language": "python", "submission_id_v0": "s839494003", "submission_id_v1": "s928697183", "cpu_time_v0": 613, "cpu_time_v1": 410, "memory_v0": 89216, "memory_v1": 43704, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.12, "input": "import sys\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nn,m=list(map(int,input().split()))\n\na0=list(map(int,input().split()))\n\ndata=[list(map(int,input().split())) for i in range(m)]\n\nfor i in a0:\n\n\tdata.append([1,i])\n\ndata.sort(key=lambda tup:-tup[1])\n\nans=0\n\nfor num,val in data:\n\n\tif n>=num:\n\n\t\tn-=num\n\n\t\tans+=val*num\n\n\telse:\n\n\t\tans+=val*n\n\n\t\tbreak\n\nprint(ans)\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\nfrom collections import Counter\n\ninput = lambda: sys.stdin.readline()[:-1]\n\nsys.setrecursionlimit(10**8)\n\n\n\nans=0\n\nn,m=list(map(int,input().split()))\n\nA=list(map(int,input().split()))\n\nbc=[]\n\nfor i in range(m):\n\n b,c=list(map(int,input().split()))\n\n bc.append((c,b))\n\nC=Counter(A)\n\nbc+=list(C.items())\n\nbc.sort(key=lambda tup:-tup[0])\n\n# print(bc)\n\nfor c,b in bc:\n\n if n>=b:\n\n n-=b\n\n ans+=c*b\n\n else:\n\n ans+=c*n\n\n break\n\nprint(ans)\n\n\n", "code_v0_loc": 17, "code_v1_loc": 26, "code_v0_num_chars": 357, "code_v1_num_chars": 498, "code_v0_no_empty_lines": "import sys\n\ninput = lambda: sys.stdin.readline()[:-1]\nn, m = list(map(int, input().split()))\na0 = list(map(int, input().split()))\ndata = [list(map(int, input().split())) for i in range(m)]\nfor i in a0:\n data.append([1, i])\ndata.sort(key=lambda tup: -tup[1])\nans = 0\nfor num, val in data:\n if n >= num:\n n -= num\n ans += val * num\n else:\n ans += val * n\n break\nprint(ans)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\nfrom collections import Counter\n\ninput = lambda: sys.stdin.readline()[:-1]\nsys.setrecursionlimit(10**8)\nans = 0\nn, m = list(map(int, input().split()))\nA = list(map(int, input().split()))\nbc = []\nfor i in range(m):\n b, c = list(map(int, input().split()))\n bc.append((c, b))\nC = Counter(A)\nbc += list(C.items())\nbc.sort(key=lambda tup: -tup[0])\n# print(bc)\nfor c, b in bc:\n if n >= b:\n n -= b\n ans += c * b\n else:\n ans += c * n\n break\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 34.6153846154, "diff": ["+#!/usr/bin/env python3", "+from collections import Counter", "+sys.setrecursionlimit(10**8)", "+ans = 0", "-a0 = list(map(int, input().split()))", "-data = [list(map(int, input().split())) for i in range(m)]", "-for i in a0:", "- data.append([1, i])", "-data.sort(key=lambda tup: -tup[1])", "-ans = 0", "-for num, val in data:", "- if n >= num:", "- n -= num", "- ans += val * num", "+A = list(map(int, input().split()))", "+bc = []", "+for i in range(m):", "+ b, c = list(map(int, input().split()))", "+ bc.append((c, b))", "+C = Counter(A)", "+bc += list(C.items())", "+bc.sort(key=lambda tup: -tup[0])", "+# print(bc)", "+for c, b in bc:", "+ if n >= b:", "+ n -= b", "+ ans += c * b", "- ans += val * n", "+ ans += c * n"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2703684399, "measured_runtime_v1": 0.1342513988, "runtime_lift": 2.013896632, "key": ["s839494003", "s928697183"], "target_token_count_dream": 148, "target_token_bucket_dream": "128-256"} +{"user_id": "u846634344", "problem_id": "p03200", "language": "python", "submission_id_v0": "s951894178", "submission_id_v1": "s605042414", "cpu_time_v0": 58, "cpu_time_v1": 51, "memory_v0": 5932, "memory_v1": 3500, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.07, "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(input())\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tA = []\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': A.append(bcnt)\n\n\t\n\n\tprint((sum(A)))\n\n\n\nif __name__ == '__main__':\n\n\tmain()", "target": "import sys\n\nsys.setrecursionlimit(10**6)\n\nif sys.platform in (['ios','darwin','win32']):\n\n\tsys.stdin=open('Untitled.txt')\n\ninput = sys.stdin.readline\n\ndef INT(): return int(input())\n\ndef MAP(): return [int(s) for s in input().split()]\n\n\n\ndef main():\n\n\tS = input().rstrip()\n\n\tbcnt = 0\n\n\tans = 0\n\n\tfor i in range(len(S)):\n\n\t\tif S[i] == 'B': bcnt += 1\n\n\t\tif S[i] == 'W': ans += bcnt\n\n\t\n\n\tprint(ans)\n\n\n\nif __name__ == '__main__':\n\n\tmain()", "code_v0_loc": 20, "code_v1_loc": 20, "code_v0_num_chars": 439, "code_v1_num_chars": 434, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\nif sys.platform in ([\"ios\", \"darwin\", \"win32\"]):\n sys.stdin = open(\"Untitled.txt\")\ninput = sys.stdin.readline\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return [int(s) for s in input().split()]\n\n\ndef main():\n S = input().rstrip()\n bcnt = 0\n A = []\n for i in range(len(S)):\n if S[i] == \"B\":\n bcnt += 1\n if S[i] == \"W\":\n A.append(bcnt)\n print((sum(A)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\nif sys.platform in ([\"ios\", \"darwin\", \"win32\"]):\n sys.stdin = open(\"Untitled.txt\")\ninput = sys.stdin.readline\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return [int(s) for s in input().split()]\n\n\ndef main():\n S = input().rstrip()\n bcnt = 0\n ans = 0\n for i in range(len(S)):\n if S[i] == \"B\":\n bcnt += 1\n if S[i] == \"W\":\n ans += bcnt\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- A = []", "+ ans = 0", "- A.append(bcnt)", "- print((sum(A)))", "+ ans += bcnt", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2057990801, "measured_runtime_v1": 0.0065612807, "runtime_lift": 31.365687324, "key": ["s951894178", "s605042414"], "target_token_count_dream": 137, "target_token_bucket_dream": "128-256"} +{"user_id": "u780475861", "problem_id": "p03416", "language": "python", "submission_id_v0": "s789877064", "submission_id_v1": "s762526319", "cpu_time_v0": 111, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.68, "input": "a,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(a, b + 1):\n\n f = True\n\n s = str(i)\n\n l = len(s)\n\n for j in range(l//2 + 1):\n\n if s[j] != s[- j - 1]:\n\n f = False\n\n break\n\n if f:\n\n n += 1\n\nprint(n)", "target": "a,b = list(map(int, input().split()))\n\nn = 0\n\nfor i in range(1, 10):\n\n for j in range(10):\n\n for k in range(10):\n\n s = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n\n if a <= s <= b:\n\n n += 1\n\nprint(n)", "code_v0_loc": 13, "code_v1_loc": 9, "code_v0_num_chars": 253, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nn = 0\nfor i in range(a, b + 1):\n f = True\n s = str(i)\n l = len(s)\n for j in range(l // 2 + 1):\n if s[j] != s[-j - 1]:\n f = False\n break\n if f:\n n += 1\nprint(n)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nn = 0\nfor i in range(1, 10):\n for j in range(10):\n for k in range(10):\n s = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n if a <= s <= b:\n n += 1\nprint(n)\n", "code_same": false, "relative_loc_diff_percent": 30.7692307692, "diff": ["-for i in range(a, b + 1):", "- f = True", "- s = str(i)", "- l = len(s)", "- for j in range(l // 2 + 1):", "- if s[j] != s[-j - 1]:", "- f = False", "- break", "- if f:", "- n += 1", "+for i in range(1, 10):", "+ for j in range(10):", "+ for k in range(10):", "+ s = 10000 * i + 1000 * j + 100 * k + 10 * j + i", "+ if a <= s <= b:", "+ n += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.319382349, "measured_runtime_v1": 0.1601409102, "runtime_lift": 1.99438325, "key": ["s789877064", "s762526319"], "target_token_count_dream": 97, "target_token_bucket_dream": "<128"} +{"user_id": "u968166680", "problem_id": "p03752", "language": "python", "submission_id_v0": "s863090450", "submission_id_v1": "s059435285", "cpu_time_v0": 32, "cpu_time_v1": 24, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for bit in range(1 << N):\n\n if (not (bit & 1)) or bin(bit).count('1') != K:\n\n continue\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if bit & (1 << i):\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\nfrom itertools import combinations\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef main():\n\n N, K, *A = list(map(int, read().split()))\n\n\n\n ans = INF\n\n for comb in combinations(list(range(1, N)), K - 1):\n\n included = [False] * N\n\n for i in comb:\n\n included[i] = True\n\n\n\n total = 0\n\n max_height = A[0]\n\n for i, a in enumerate(A[1:], 1):\n\n if a <= max_height:\n\n if included[i]:\n\n total += max_height - a + 1\n\n max_height += 1\n\n else:\n\n max_height = a\n\n\n\n if ans > total:\n\n ans = total\n\n\n\n print(ans)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 37, "code_v1_loc": 39, "code_v0_num_chars": 756, "code_v1_num_chars": 818, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef main():\n N, K, *A = list(map(int, read().split()))\n ans = INF\n for bit in range(1 << N):\n if (not (bit & 1)) or bin(bit).count(\"1\") != K:\n continue\n total = 0\n max_height = A[0]\n for i, a in enumerate(A[1:], 1):\n if a <= max_height:\n if bit & (1 << i):\n total += max_height - a + 1\n max_height += 1\n else:\n max_height = a\n if ans > total:\n ans = total\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\nfrom itertools import combinations\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef main():\n N, K, *A = list(map(int, read().split()))\n ans = INF\n for comb in combinations(list(range(1, N)), K - 1):\n included = [False] * N\n for i in comb:\n included[i] = True\n total = 0\n max_height = A[0]\n for i, a in enumerate(A[1:], 1):\n if a <= max_height:\n if included[i]:\n total += max_height - a + 1\n max_height += 1\n else:\n max_height = a\n if ans > total:\n ans = total\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 5.1282051282, "diff": ["+from itertools import combinations", "- for bit in range(1 << N):", "- if (not (bit & 1)) or bin(bit).count(\"1\") != K:", "- continue", "+ for comb in combinations(list(range(1, N)), K - 1):", "+ included = [False] * N", "+ for i in comb:", "+ included[i] = True", "- if bit & (1 << i):", "+ if included[i]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4393207397, "measured_runtime_v1": 0.2213684809, "runtime_lift": 1.9845677122, "key": ["s863090450", "s059435285"], "target_token_count_dream": 210, "target_token_bucket_dream": "128-256"} +{"user_id": "u347600233", "problem_id": "p02952", "language": "python", "submission_id_v0": "s073920837", "submission_id_v1": "s426081507", "cpu_time_v0": 75, "cpu_time_v1": 58, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.67, "input": "import math\n\nn = int(input())\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if math.floor(math.log10(i) + 1) % 2:\n\n cnt += 1\n\nprint(cnt)", "target": "n = int(input())\n\ncnt = 0\n\nfor i in range(1, n + 1):\n\n if len(str(i)) % 2:\n\n cnt += 1\n\nprint(cnt)", "code_v0_loc": 7, "code_v1_loc": 6, "code_v0_num_chars": 138, "code_v1_num_chars": 107, "code_v0_no_empty_lines": "import math\n\nn = int(input())\ncnt = 0\nfor i in range(1, n + 1):\n if math.floor(math.log10(i) + 1) % 2:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\ncnt = 0\nfor i in range(1, n + 1):\n if len(str(i)) % 2:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-import math", "-", "- if math.floor(math.log10(i) + 1) % 2:", "+ if len(str(i)) % 2:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3655955575, "measured_runtime_v1": 0.2850201683, "runtime_lift": 1.282700658, "key": ["s073920837", "s426081507"], "target_token_count_dream": 41, "target_token_bucket_dream": "<128"} +{"user_id": "u423966555", "problem_id": "p02773", "language": "python", "submission_id_v0": "s252908207", "submission_id_v1": "s096619437", "cpu_time_v0": 859, "cpu_time_v1": 768, "memory_v0": 46080, "memory_v1": 48888, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.59, "input": "from collections import defaultdict\n\nn = int(input())\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = input()\n\n d[key] += 1\n\n\n\ndict = sorted(list(d.items()), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nfor s in dict_li:\n\n print(s)\n", "target": "from collections import defaultdict\n\nn = int(input())\n\n\n\nd = defaultdict(int)\n\nfor _ in range(n):\n\n key = input()\n\n d[key] += 1\n\n\n\ndict = sorted(d.items(), key=lambda x:x[1], reverse=True)\n\nmax_v = max(d.values())\n\n\n\ndict_li = []\n\nfor a in dict:\n\n if a[1]==max_v:\n\n dict_li.append(a[0])\n\n\n\ndict_li.sort()\n\nprint(*dict_li, sep='\\n')\n", "code_v0_loc": 19, "code_v1_loc": 18, "code_v0_num_chars": 354, "code_v1_num_chars": 348, "code_v0_no_empty_lines": "from collections import defaultdict\n\nn = int(input())\nd = defaultdict(int)\nfor _ in range(n):\n key = input()\n d[key] += 1\ndict = sorted(list(d.items()), key=lambda x: x[1], reverse=True)\nmax_v = max(d.values())\ndict_li = []\nfor a in dict:\n if a[1] == max_v:\n dict_li.append(a[0])\ndict_li.sort()\nfor s in dict_li:\n print(s)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nn = int(input())\nd = defaultdict(int)\nfor _ in range(n):\n key = input()\n d[key] += 1\ndict = sorted(d.items(), key=lambda x: x[1], reverse=True)\nmax_v = max(d.values())\ndict_li = []\nfor a in dict:\n if a[1] == max_v:\n dict_li.append(a[0])\ndict_li.sort()\nprint(*dict_li, sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 5.2631578947, "diff": ["-n = int(input())", "+n = int(input())", "- key = input()", "+ key = input()", "-dict = sorted(list(d.items()), key=lambda x: x[1], reverse=True)", "+dict = sorted(d.items(), key=lambda x: x[1], reverse=True)", "-for s in dict_li:", "- print(s)", "+print(*dict_li, sep=\"\\n\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2625157752, "measured_runtime_v1": 0.2092528682, "runtime_lift": 1.2545384801, "key": ["s252908207", "s096619437"], "target_token_count_dream": 99, "target_token_bucket_dream": "<128"} +{"user_id": "u867826040", "problem_id": "p03721", "language": "python", "submission_id_v0": "s719602965", "submission_id_v1": "s173376033", "cpu_time_v0": 194, "cpu_time_v1": 151, "memory_v0": 76876, "memory_v1": 16524, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.16, "input": "n,k = list(map(int,input().split()))\n\nl = [0]*(10**5+1)\n\nfor i in range(n):\n\n ai,bi = list(map(int,input().split()))\n\n l[ai]+=bi\n\nfor index,i in enumerate(l):\n\n if i:\n\n k-=i\n\n if k<=0:\n\n break\n\nprint(index)", "target": "from collections import defaultdict\n\nfrom sys import stdin\n\ninput = stdin.readline\n\nd = defaultdict(int)\n\nn,k = list(map(int,input().split()))\n\nfor _ in range(n):\n\n a,b = list(map(int,input().split()))\n\n d[a]+=b\n\nfor key in sorted(d.keys()):\n\n v = d[key]\n\n k-=v\n\n if k <= 0:\n\n break\n\nprint(key)", "code_v0_loc": 11, "code_v1_loc": 14, "code_v0_num_chars": 228, "code_v1_num_chars": 304, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\nl = [0] * (10**5 + 1)\nfor i in range(n):\n ai, bi = list(map(int, input().split()))\n l[ai] += bi\nfor index, i in enumerate(l):\n if i:\n k -= i\n if k <= 0:\n break\nprint(index)\n", "code_v1_no_empty_lines": "from collections import defaultdict\nfrom sys import stdin\n\ninput = stdin.readline\nd = defaultdict(int)\nn, k = list(map(int, input().split()))\nfor _ in range(n):\n a, b = list(map(int, input().split()))\n d[a] += b\nfor key in sorted(d.keys()):\n v = d[key]\n k -= v\n if k <= 0:\n break\nprint(key)\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["+from collections import defaultdict", "+from sys import stdin", "+", "+input = stdin.readline", "+d = defaultdict(int)", "-l = [0] * (10**5 + 1)", "-for i in range(n):", "- ai, bi = list(map(int, input().split()))", "- l[ai] += bi", "-for index, i in enumerate(l):", "- if i:", "- k -= i", "- if k <= 0:", "- break", "-print(index)", "+for _ in range(n):", "+ a, b = list(map(int, input().split()))", "+ d[a] += b", "+for key in sorted(d.keys()):", "+ v = d[key]", "+ k -= v", "+ if k <= 0:", "+ break", "+print(key)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5501943195, "measured_runtime_v1": 0.4111647634, "runtime_lift": 1.3381358727, "key": ["s719602965", "s173376033"], "target_token_count_dream": 85, "target_token_bucket_dream": "<128"} +{"user_id": "u271934630", "problem_id": "p03416", "language": "python", "submission_id_v0": "s986292698", "submission_id_v1": "s820058882", "cpu_time_v0": 225, "cpu_time_v1": 186, "memory_v0": 40684, "memory_v1": 40300, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.33, "input": "A, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = list(str(i))\n\n\n\n if l == list(reversed(l)):\n\n cnt += 1\n\n\n\nprint(cnt)\n", "target": "A, B = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(A, B+1):\n\n l = str(i)\n\n if l == l[::-1]:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 155, "code_v1_num_chars": 137, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor i in range(A, B + 1):\n l = list(str(i))\n if l == list(reversed(l)):\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor i in range(A, B + 1):\n l = str(i)\n if l == l[::-1]:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- l = list(str(i))", "- if l == list(reversed(l)):", "+ l = str(i)", "+ if l == l[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3457211592, "measured_runtime_v1": 0.2683477015, "runtime_lift": 1.2883328503, "key": ["s986292698", "s820058882"], "target_token_count_dream": 50, "target_token_bucket_dream": "<128"} +{"user_id": "u680851063", "problem_id": "p03363", "language": "python", "submission_id_v0": "s954809041", "submission_id_v1": "s284059915", "cpu_time_v0": 905, "cpu_time_v1": 166, "memory_v0": 44692, "memory_v1": 44492, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.66, "input": "n = int(input())\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nfrom math import factorial\n\ndef combinations_count(n, r):\n\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += combinations_count(j,2)\n\n\n\nprint(ans)", "target": "n = int(input())\n\nary = list(map(int, input().split()))\n\n#print(n,ary)\n\n\n\nary_2 = [ary[0]]\n\nfor i in range(1, n):\n\n ary_2.append(ary[i] + ary_2[i-1])\n\nary_2 = [0] + ary_2\n\n#print(ary_2)\n\n\n\nfrom collections import Counter\n\nc = Counter(ary_2)\n\nv = (list(c.values()))\n\n#print(v)\n\n\n\nans = 0\n\nfor j in v:\n\n if j >1:\n\n ans += j * (j-1) // 2\n\n\n\nprint(ans)\n", "code_v0_loc": 25, "code_v1_loc": 21, "code_v0_num_chars": 487, "code_v1_num_chars": 356, "code_v0_no_empty_lines": "n = int(input())\nary = list(map(int, input().split()))\n# print(n,ary)\nary_2 = [ary[0]]\nfor i in range(1, n):\n ary_2.append(ary[i] + ary_2[i - 1])\nary_2 = [0] + ary_2\n# print(ary_2)\nfrom collections import Counter\n\nc = Counter(ary_2)\nv = list(c.values())\n# print(v)\nfrom math import factorial\n\n\ndef combinations_count(n, r):\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\nans = 0\nfor j in v:\n if j > 1:\n ans += combinations_count(j, 2)\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nary = list(map(int, input().split()))\n# print(n,ary)\nary_2 = [ary[0]]\nfor i in range(1, n):\n ary_2.append(ary[i] + ary_2[i - 1])\nary_2 = [0] + ary_2\n# print(ary_2)\nfrom collections import Counter\n\nc = Counter(ary_2)\nv = list(c.values())\n# print(v)\nans = 0\nfor j in v:\n if j > 1:\n ans += j * (j - 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 16.0, "diff": ["-from math import factorial", "-", "-", "-def combinations_count(n, r):", "- return factorial(n) // (factorial(n - r) * factorial(r))", "-", "-", "- ans += combinations_count(j, 2)", "+ ans += j * (j - 1) // 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2075043974, "measured_runtime_v1": 0.0060842175, "runtime_lift": 34.1053546165, "key": ["s954809041", "s284059915"], "target_token_count_dream": 129, "target_token_bucket_dream": "128-256"} +{"user_id": "u761320129", "problem_id": "p02792", "language": "python", "submission_id_v0": "s858070624", "submission_id_v1": "s144947075", "cpu_time_v0": 459, "cpu_time_v1": 184, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.91, "input": "N = int(input())\n\nmem = [[0]*10 for i in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)", "target": "N = int(input())\n\n\n\nd = [[0]*10 for i in range(10)]\n\nfor n in range(1,N+1):\n\n s = str(n)\n\n d[int(s[0])][int(s[-1])] += 1\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += d[i][j] * d[j][i]\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 264, "code_v1_num_chars": 227, "code_v0_no_empty_lines": "N = int(input())\nmem = [[0] * 10 for i in range(10)]\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n mem[a][b] += 1\nans = 0\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n ans += mem[b][a]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nd = [[0] * 10 for i in range(10)]\nfor n in range(1, N + 1):\n s = str(n)\n d[int(s[0])][int(s[-1])] += 1\nans = 0\nfor i in range(10):\n for j in range(10):\n ans += d[i][j] * d[j][i]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-mem = [[0] * 10 for i in range(10)]", "-for i in range(1, N + 1):", "- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- mem[a][b] += 1", "+d = [[0] * 10 for i in range(10)]", "+for n in range(1, N + 1):", "+ s = str(n)", "+ d[int(s[0])][int(s[-1])] += 1", "-for i in range(1, N + 1):", "- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- ans += mem[b][a]", "+for i in range(10):", "+ for j in range(10):", "+ ans += d[i][j] * d[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4986082915, "measured_runtime_v1": 0.3140420772, "runtime_lift": 1.5877117355, "key": ["s858070624", "s144947075"], "target_token_count_dream": 93, "target_token_bucket_dream": "<128"} +{"user_id": "u790012205", "problem_id": "p03796", "language": "python", "submission_id_v0": "s234232673", "submission_id_v1": "s468100683", "cpu_time_v0": 175, "cpu_time_v1": 49, "memory_v0": 38512, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.0, "input": "N = int(input())\n\np = 1\n\nfor i in range(N):\n\n p *= (i + 1)\n\n p %= (1e9 + 7)\n\nprint((int(p)))", "target": "N = int(input())\n\np = 1\n\nfor i in range(N):\n\n p = p * (i + 1) % (1e9 + 7)\n\nprint((int(p)))", "code_v0_loc": 6, "code_v1_loc": 5, "code_v0_num_chars": 96, "code_v1_num_chars": 91, "code_v0_no_empty_lines": "N = int(input())\np = 1\nfor i in range(N):\n p *= i + 1\n p %= 1e9 + 7\nprint((int(p)))\n", "code_v1_no_empty_lines": "N = int(input())\np = 1\nfor i in range(N):\n p = p * (i + 1) % (1e9 + 7)\nprint((int(p)))\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["- p *= i + 1", "- p %= 1e9 + 7", "+ p = p * (i + 1) % (1e9 + 7)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4166263335, "measured_runtime_v1": 0.2939343722, "runtime_lift": 1.4174127727, "key": ["s234232673", "s468100683"], "target_token_count_dream": 41, "target_token_bucket_dream": "<128"} +{"user_id": "u771634798", "problem_id": "p02725", "language": "python", "submission_id_v0": "s591694965", "submission_id_v1": "s705639429", "cpu_time_v0": 110, "cpu_time_v1": 85, "memory_v0": 32148, "memory_v1": 32380, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.73, "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\ndiff = []\n\n\n\nfor i in range(n - 1):\n\n diff.append(a[i + 1] - a[i])\n\ndiff.append(k - a[-1] + a[0])\n\n\n\nprint((k - max(diff)))\n", "target": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\na.append(k + a[0])\n\ndiff = [a1 - a0 for a0, a1 in zip(a, a[1:])]\n\n\n\nprint((k - max(diff)))\n", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 198, "code_v1_num_chars": 162, "code_v0_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\ndiff = []\nfor i in range(n - 1):\n diff.append(a[i + 1] - a[i])\ndiff.append(k - a[-1] + a[0])\nprint((k - max(diff)))\n", "code_v1_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(k + a[0])\ndiff = [a1 - a0 for a0, a1 in zip(a, a[1:])]\nprint((k - max(diff)))\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-diff = []", "-for i in range(n - 1):", "- diff.append(a[i + 1] - a[i])", "-diff.append(k - a[-1] + a[0])", "+a.append(k + a[0])", "+diff = [a1 - a0 for a0, a1 in zip(a, a[1:])]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3387992765, "measured_runtime_v1": 0.2554280306, "runtime_lift": 1.3263981864, "key": ["s591694965", "s705639429"], "target_token_count_dream": 61, "target_token_bucket_dream": "<128"} +{"user_id": "u562935282", "problem_id": "p03253", "language": "python", "submission_id_v0": "s242343005", "submission_id_v1": "s569938093", "cpu_time_v0": 72, "cpu_time_v1": 23, "memory_v0": 11380, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 68.06, "input": "class Calc:\n\n def __init__(self, max_value, mod):\n\n \"\"\"combination(max_value, all)\"\"\"\n\n fact = [-1] * (max_value + 1)\n\n fact[0] = 1\n\n fact[1] = 1\n\n for x in range(2, max_value + 1):\n\n fact[x] = x * fact[x - 1] % mod\n\n\n\n invs = [1] * (max_value + 1)\n\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n\n for x in range(max_value - 1, 0, -1):\n\n invs[x] = invs[x + 1] * (x + 1) % mod\n\n\n\n self.fact = fact\n\n self.invs = invs\n\n self.mod = mod\n\n\n\n def combination(self, n, r):\n\n if n - r < r:\n\n return self.combination(n, n - r)\n\n if r < 0:\n\n return 0\n\n if r == 0:\n\n return 1\n\n if r == 1:\n\n return n\n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\n\n\n\ndef gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n ma = d * d\n\n while ma <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n ma += d * 4 + 4\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n cal = Calc(max_value=N + 30, mod=MOD)\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def gen(n):\n\n x = n\n\n d = 2\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n\n\n d = 3\n\n while d * d <= n:\n\n cnt = 0\n\n while x % d == 0:\n\n x //= d\n\n cnt += 1\n\n yield cnt\n\n d += 2\n\n\n\n if x > 1:\n\n yield 1\n\n\n\n\n\ndef main():\n\n MOD = 10 ** 9 + 7\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n ans = 1\n\n for cnt in gen(M):\n\n for d in range(cnt):\n\n ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD\n\n \n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 69, "code_v1_loc": 37, "code_v0_num_chars": 1490, "code_v1_num_chars": 619, "code_v0_no_empty_lines": "class Calc:\n def __init__(self, max_value, mod):\n \"\"\"combination(max_value, all)\"\"\"\n fact = [-1] * (max_value + 1)\n fact[0] = 1\n fact[1] = 1\n for x in range(2, max_value + 1):\n fact[x] = x * fact[x - 1] % mod\n invs = [1] * (max_value + 1)\n invs[max_value] = pow(fact[max_value], mod - 2, mod)\n for x in range(max_value - 1, 0, -1):\n invs[x] = invs[x + 1] * (x + 1) % mod\n self.fact = fact\n self.invs = invs\n self.mod = mod\n\n def combination(self, n, r):\n if n - r < r:\n return self.combination(n, n - r)\n if r < 0:\n return 0\n if r == 0:\n return 1\n if r == 1:\n return n\n return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod\n\n\ndef gen(n):\n x = n\n d = 2\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n d = 3\n ma = d * d\n while ma <= n:\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n ma += d * 4 + 4\n d += 2\n if x > 1:\n yield 1\n\n\ndef main():\n MOD = 10**9 + 7\n N, M = list(map(int, input().split()))\n cal = Calc(max_value=N + 30, mod=MOD)\n ans = 1\n for cnt in gen(M):\n ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def gen(n):\n x = n\n d = 2\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n d = 3\n while d * d <= n:\n cnt = 0\n while x % d == 0:\n x //= d\n cnt += 1\n yield cnt\n d += 2\n if x > 1:\n yield 1\n\n\ndef main():\n MOD = 10**9 + 7\n N, M = list(map(int, input().split()))\n ans = 1\n for cnt in gen(M):\n for d in range(cnt):\n ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 46.3768115942, "diff": ["-class Calc:", "- def __init__(self, max_value, mod):", "- \"\"\"combination(max_value, all)\"\"\"", "- fact = [-1] * (max_value + 1)", "- fact[0] = 1", "- fact[1] = 1", "- for x in range(2, max_value + 1):", "- fact[x] = x * fact[x - 1] % mod", "- invs = [1] * (max_value + 1)", "- invs[max_value] = pow(fact[max_value], mod - 2, mod)", "- for x in range(max_value - 1, 0, -1):", "- invs[x] = invs[x + 1] * (x + 1) % mod", "- self.fact = fact", "- self.invs = invs", "- self.mod = mod", "-", "- def combination(self, n, r):", "- if n - r < r:", "- return self.combination(n, n - r)", "- if r < 0:", "- return 0", "- if r == 0:", "- return 1", "- if r == 1:", "- return n", "- return self.fact[n] * self.invs[r] * self.invs[n - r] % self.mod", "-", "-", "- ma = d * d", "- while ma <= n:", "+ while d * d <= n:", "- ma += d * 4 + 4", "- cal = Calc(max_value=N + 30, mod=MOD)", "- ans = (ans * cal.combination(N + cnt - 1, cnt)) % MOD", "+ for d in range(cnt):", "+ ans = (ans * (N - 1 + cnt - d) % MOD) * pow(d + 1, MOD - 2, MOD) % MOD"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5542220466, "measured_runtime_v1": 0.3755235486, "runtime_lift": 1.4758649588, "key": ["s242343005", "s569938093"], "target_token_count_dream": 210, "target_token_bucket_dream": "128-256"} +{"user_id": "u952708174", "problem_id": "p02983", "language": "python", "submission_id_v0": "s271837395", "submission_id_v1": "s778364451", "cpu_time_v0": 612, "cpu_time_v1": 51, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.67, "input": "def c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))", "target": "def c_remainder_minimization_2019(L, R):\n\n ans = float('inf')\n\n for i in range(L, min(R, L + 2019)):\n\n for j in range(i + 1, min(R + 1, L + 2020)):\n\n ans = min(ans, (i * j) % 2019)\n\n if ans == 0:\n\n return 0\n\n return ans\n\n\n\nL, R = [int(i) for i in input().split()]\n\nprint((c_remainder_minimization_2019(L, R)))", "code_v0_loc": 9, "code_v1_loc": 11, "code_v0_num_chars": 308, "code_v1_num_chars": 360, "code_v0_no_empty_lines": "def c_remainder_minimization_2019(L, R):\n ans = float(\"inf\")\n for i in range(L, min(R, L + 2019)):\n for j in range(i + 1, min(R + 1, L + 2020)):\n ans = min(ans, (i * j) % 2019)\n return ans\n\n\nL, R = [int(i) for i in input().split()]\nprint((c_remainder_minimization_2019(L, R)))\n", "code_v1_no_empty_lines": "def c_remainder_minimization_2019(L, R):\n ans = float(\"inf\")\n for i in range(L, min(R, L + 2019)):\n for j in range(i + 1, min(R + 1, L + 2020)):\n ans = min(ans, (i * j) % 2019)\n if ans == 0:\n return 0\n return ans\n\n\nL, R = [int(i) for i in input().split()]\nprint((c_remainder_minimization_2019(L, R)))\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["+ if ans == 0:", "+ return 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3551982943, "measured_runtime_v1": 0.2038855975, "runtime_lift": 1.7421450986, "key": ["s271837395", "s778364451"], "target_token_count_dream": 131, "target_token_bucket_dream": "128-256"} +{"user_id": "u562935282", "problem_id": "p03371", "language": "python", "submission_id_v0": "s950527789", "submission_id_v1": "s848046688", "cpu_time_v0": 119, "cpu_time_v1": 19, "memory_v0": 3060, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.03, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nval = float('inf')\n\nfor k in range(10 ** 5 + 1):\n\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\n\nprint(val)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = 0\n\nans += min(A + B, 2 * C) * min(X, Y)\n\nif X > Y:\n\n ans += min(A, 2 * C) * (X - Y)\n\nelif X < Y:\n\n ans += min(B, 2 * C) * (Y - X)\n\nprint(ans)\n", "code_v0_loc": 5, "code_v1_loc": 9, "code_v0_num_chars": 174, "code_v1_num_chars": 199, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nval = float(\"inf\")\nfor k in range(10**5 + 1):\n val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)\nprint(val)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = 0\nans += min(A + B, 2 * C) * min(X, Y)\nif X > Y:\n ans += min(A, 2 * C) * (X - Y)\nelif X < Y:\n ans += min(B, 2 * C) * (Y - X)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-a, b, c, x, y = list(map(int, input().split()))", "-val = float(\"inf\")", "-for k in range(10**5 + 1):", "- val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b)", "-print(val)", "+A, B, C, X, Y = list(map(int, input().split()))", "+ans = 0", "+ans += min(A + B, 2 * C) * min(X, Y)", "+if X > Y:", "+ ans += min(A, 2 * C) * (X - Y)", "+elif X < Y:", "+ ans += min(B, 2 * C) * (Y - X)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3470396991, "measured_runtime_v1": 0.2883047278, "runtime_lift": 4.6722775216, "key": ["s950527789", "s848046688"], "target_token_count_dream": 89, "target_token_bucket_dream": "<128"} +{"user_id": "u869919400", "problem_id": "p03796", "language": "python", "submission_id_v0": "s127994042", "submission_id_v1": "s163960956", "cpu_time_v0": 229, "cpu_time_v1": 37, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.84, "input": "from math import factorial as f\n\nn = int(input())\n\nprint((f(n) % (10 ** 9 + 7)))", "target": "n = int(input())\n\np = 1\n\nfor i in range(n):\n\n p = (p * (i+1)) % (10 ** 9 + 7)\n\nprint(p)", "code_v0_loc": 3, "code_v1_loc": 5, "code_v0_num_chars": 78, "code_v1_num_chars": 90, "code_v0_no_empty_lines": "from math import factorial as f\n\nn = int(input())\nprint((f(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\np = 1\nfor i in range(n):\n p = (p * (i + 1)) % (10**9 + 7)\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-from math import factorial as f", "-", "-print((f(n) % (10**9 + 7)))", "+p = 1", "+for i in range(n):", "+ p = (p * (i + 1)) % (10**9 + 7)", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8111317687, "measured_runtime_v1": 0.3589184887, "runtime_lift": 2.2599330882, "key": ["s127994042", "s163960956"], "target_token_count_dream": 41, "target_token_bucket_dream": "<128"} +{"user_id": "u227082700", "problem_id": "p03039", "language": "python", "submission_id_v0": "s481435936", "submission_id_v1": "s241948863", "cpu_time_v0": 1746, "cpu_time_v1": 149, "memory_v0": 11052, "memory_v1": 16752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.47, "input": "n,m,k=list(map(int,input().split()))\n\nmod=10**9+7\n\nf=[1]\n\nfor i in range(2*10**5+7):f+=[f[-1]*(i+1)%mod]\n\ndef comb(a,b):return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod\n\nans=0\n\nfor i in range(1,n):\n\n ans+=(i*(n-i)*m**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nfor i in range(1,m):\n\n ans+=(i*(m-i)*n**2)*(comb(n*m-2,k-2))\n\n ans%=mod\n\nprint(ans)", "target": "n,m,k=list(map(int,input().split()))\n\n\n\nmod = 10**9+7\n\nf = [1]\n\nfor i in range(n*m):\n\n f += [f[-1]*(i+1) % mod]\n\ndef comb(a, b):\n\n return f[a]*pow(f[b], mod-2, mod)*pow(f[a-b], mod-2, mod) % mod\n\n\n\nans=0\n\nfor dist in range(1,n):\n\n c=n-dist\n\n p=(c*m*m)%mod\n\n ans+=p*dist\n\nfor dist in range(1,m):\n\n c=m-dist\n\n p=(c*n*n)%mod\n\n ans+=p*dist\n\nans%=mod\n\nprint((ans*comb(n*m-2,k-2)%mod))", "code_v0_loc": 13, "code_v1_loc": 20, "code_v0_num_chars": 340, "code_v1_num_chars": 379, "code_v0_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nf = [1]\nfor i in range(2 * 10**5 + 7):\n f += [f[-1] * (i + 1) % mod]\n\n\ndef comb(a, b):\n return f[a] * pow(f[b], mod - 2, mod) * pow(f[a - b], mod - 2, mod) % mod\n\n\nans = 0\nfor i in range(1, n):\n ans += (i * (n - i) * m**2) * (comb(n * m - 2, k - 2))\n ans %= mod\nfor i in range(1, m):\n ans += (i * (m - i) * n**2) * (comb(n * m - 2, k - 2))\n ans %= mod\nprint(ans)\n", "code_v1_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 10**9 + 7\nf = [1]\nfor i in range(n * m):\n f += [f[-1] * (i + 1) % mod]\n\n\ndef comb(a, b):\n return f[a] * pow(f[b], mod - 2, mod) * pow(f[a - b], mod - 2, mod) % mod\n\n\nans = 0\nfor dist in range(1, n):\n c = n - dist\n p = (c * m * m) % mod\n ans += p * dist\nfor dist in range(1, m):\n c = m - dist\n p = (c * n * n) % mod\n ans += p * dist\nans %= mod\nprint((ans * comb(n * m - 2, k - 2) % mod))\n", "code_same": false, "relative_loc_diff_percent": 35.0, "diff": ["-for i in range(2 * 10**5 + 7):", "+for i in range(n * m):", "-for i in range(1, n):", "- ans += (i * (n - i) * m**2) * (comb(n * m - 2, k - 2))", "- ans %= mod", "-for i in range(1, m):", "- ans += (i * (m - i) * n**2) * (comb(n * m - 2, k - 2))", "- ans %= mod", "-print(ans)", "+for dist in range(1, n):", "+ c = n - dist", "+ p = (c * m * m) % mod", "+ ans += p * dist", "+for dist in range(1, m):", "+ c = m - dist", "+ p = (c * n * n) % mod", "+ ans += p * dist", "+ans %= mod", "+print((ans * comb(n * m - 2, k - 2) % mod))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.907170742, "measured_runtime_v1": 0.2339973826, "runtime_lift": 3.8768414063, "key": ["s481435936", "s241948863"], "target_token_count_dream": 164, "target_token_bucket_dream": "128-256"} +{"user_id": "u617203831", "problem_id": "p03796", "language": "python", "submission_id_v0": "s015060265", "submission_id_v1": "s192076282", "cpu_time_v0": 230, "cpu_time_v1": 40, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.61, "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "target": "ans=1\n\nn=int(input())\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 6, "code_v0_num_chars": 58, "code_v1_num_chars": 88, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nn = int(input())\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % (10**9 + 7)))", "+ans = 1", "+n = int(input())", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans = ans % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7955839839, "measured_runtime_v1": 0.4261377716, "runtime_lift": 1.866964247, "key": ["s015060265", "s192076282"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u844789719", "problem_id": "p03371", "language": "python", "submission_id_v0": "s272710522", "submission_id_v1": "s867287513", "cpu_time_v0": 94, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.91, "input": "A, B, C, X, Y = [int(_) for _ in input().split()]\n\nans = A * X + B * Y\n\nfor i in range(max(X, Y) + 1):\n\n cost = 2 * C * i\n\n if X > i:\n\n cost += A * (X - i)\n\n if Y > i:\n\n cost += B * (Y - i)\n\n ans = min(ans, cost)\n\nprint(ans)", "target": "A, B, C, X, Y = [int(_) for _ in input().split()]\n\nM = max(X, Y)\n\nprint((min(2 * C * M, 2 * C * (X + Y - M) + A *\n\n (M - Y) + B * (M - X), A * X + B * Y)))\n", "code_v0_loc": 10, "code_v1_loc": 4, "code_v0_num_chars": 250, "code_v1_num_chars": 163, "code_v0_no_empty_lines": "A, B, C, X, Y = [int(_) for _ in input().split()]\nans = A * X + B * Y\nfor i in range(max(X, Y) + 1):\n cost = 2 * C * i\n if X > i:\n cost += A * (X - i)\n if Y > i:\n cost += B * (Y - i)\n ans = min(ans, cost)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = [int(_) for _ in input().split()]\nM = max(X, Y)\nprint((min(2 * C * M, 2 * C * (X + Y - M) + A * (M - Y) + B * (M - X), A * X + B * Y)))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-ans = A * X + B * Y", "-for i in range(max(X, Y) + 1):", "- cost = 2 * C * i", "- if X > i:", "- cost += A * (X - i)", "- if Y > i:", "- cost += B * (Y - i)", "- ans = min(ans, cost)", "-print(ans)", "+M = max(X, Y)", "+print((min(2 * C * M, 2 * C * (X + Y - M) + A * (M - Y) + B * (M - X), A * X + B * Y)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5275072498, "measured_runtime_v1": 0.332789422, "runtime_lift": 1.5851082243, "key": ["s272710522", "s867287513"], "target_token_count_dream": 74, "target_token_bucket_dream": "<128"} +{"user_id": "u691018832", "problem_id": "p03945", "language": "python", "submission_id_v0": "s808413359", "submission_id_v1": "s766599872", "cpu_time_v0": 84, "cpu_time_v1": 46, "memory_v0": 3188, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.24, "input": "s = input()\n\nlen_s = len(s)\n\ncnt = [0, 0]\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n memo_1 = s[len_s - i]\n\n if s[i] != memo_0:\n\n cnt[0] += 1\n\n if s[len_s - i - 1] != memo_1:\n\n cnt[1] += 1\n\nprint((min(cnt)))\n", "target": "s = input()\n\nlen_s = len(s)\n\ncnt = 0\n\nfor i in range(1, len(s)):\n\n memo_0 = s[i - 1]\n\n if s[i] != memo_0:\n\n cnt += 1\n\nprint(cnt)\n", "code_v0_loc": 11, "code_v1_loc": 8, "code_v0_num_chars": 239, "code_v1_num_chars": 142, "code_v0_no_empty_lines": "s = input()\nlen_s = len(s)\ncnt = [0, 0]\nfor i in range(1, len(s)):\n memo_0 = s[i - 1]\n memo_1 = s[len_s - i]\n if s[i] != memo_0:\n cnt[0] += 1\n if s[len_s - i - 1] != memo_1:\n cnt[1] += 1\nprint((min(cnt)))\n", "code_v1_no_empty_lines": "s = input()\nlen_s = len(s)\ncnt = 0\nfor i in range(1, len(s)):\n memo_0 = s[i - 1]\n if s[i] != memo_0:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["-cnt = [0, 0]", "+cnt = 0", "- memo_1 = s[len_s - i]", "- cnt[0] += 1", "- if s[len_s - i - 1] != memo_1:", "- cnt[1] += 1", "-print((min(cnt)))", "+ cnt += 1", "+print(cnt)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3379861441, "measured_runtime_v1": 0.264947257, "runtime_lift": 1.2756733088, "key": ["s808413359", "s766599872"], "target_token_count_dream": 56, "target_token_bucket_dream": "<128"} +{"user_id": "u562016607", "problem_id": "p03558", "language": "python", "submission_id_v0": "s159640382", "submission_id_v1": "s651180421", "cpu_time_v0": 376, "cpu_time_v1": 167, "memory_v0": 8948, "memory_v1": 6060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.59, "input": "import heapq\n\nK=int(input())\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=[]\n\nheapq.heappush(q,(0,1))\n\nwhile (len(q)!=0):\n\n prc,src=heapq.heappop(q)\n\n if dist[src]dist[src]+1:\n\n dist[(src+1)%K]=dist[src]+1\n\n heapq.heappush(q,(dist[(src+1)%K],(src+1)%K))\n\n if dist[(10*src)%K]>dist[src]:\n\n dist[(10*src)%K]=dist[src]\n\n heapq.heappush(q,(dist[(src*10)%K],(src*10)%K))\n\nprint((dist[0]))\n", "target": "from collections import deque\n\nK=int(input())\n\ndist=[10**15 for i in range(K)]\n\ndist[1]=1\n\nq=deque([1])\n\nwhile(len(q)>0):\n\n r=q.popleft()\n\n s=(r+1)%K\n\n if dist[r]+1 dist[src] + 1:\n dist[(src + 1) % K] = dist[src] + 1\n heapq.heappush(q, (dist[(src + 1) % K], (src + 1) % K))\n if dist[(10 * src) % K] > dist[src]:\n dist[(10 * src) % K] = dist[src]\n heapq.heappush(q, (dist[(src * 10) % K], (src * 10) % K))\nprint((dist[0]))\n", "code_v1_no_empty_lines": "from collections import deque\n\nK = int(input())\ndist = [10**15 for i in range(K)]\ndist[1] = 1\nq = deque([1])\nwhile len(q) > 0:\n r = q.popleft()\n s = (r + 1) % K\n if dist[r] + 1 < dist[s]:\n dist[s] = dist[r] + 1\n q.append(s)\n t = (r * 10) % K\n if dist[r] < dist[t]:\n dist[t] = dist[r]\n q.appendleft(t)\nprint((dist[0]))\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-import heapq", "+from collections import deque", "-q = []", "-heapq.heappush(q, (0, 1))", "-while len(q) != 0:", "- prc, src = heapq.heappop(q)", "- if dist[src] < prc:", "- continue", "- if dist[(src + 1) % K] > dist[src] + 1:", "- dist[(src + 1) % K] = dist[src] + 1", "- heapq.heappush(q, (dist[(src + 1) % K], (src + 1) % K))", "- if dist[(10 * src) % K] > dist[src]:", "- dist[(10 * src) % K] = dist[src]", "- heapq.heappush(q, (dist[(src * 10) % K], (src * 10) % K))", "+q = deque([1])", "+while len(q) > 0:", "+ r = q.popleft()", "+ s = (r + 1) % K", "+ if dist[r] + 1 < dist[s]:", "+ dist[s] = dist[r] + 1", "+ q.append(s)", "+ t = (r * 10) % K", "+ if dist[r] < dist[t]:", "+ dist[t] = dist[r]", "+ q.appendleft(t)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4453229659, "measured_runtime_v1": 0.2901842129, "runtime_lift": 1.5346216162, "key": ["s159640382", "s651180421"], "target_token_count_dream": 116, "target_token_bucket_dream": "<128"} +{"user_id": "u287132915", "problem_id": "p02792", "language": "python", "submission_id_v0": "s161079550", "submission_id_v1": "s476355973", "cpu_time_v0": 369, "cpu_time_v1": 198, "memory_v0": 46468, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.34, "input": "n = int(input())\n\n\n\ncnt = 0\n\nfor i in range(1, n+1):\n\n i_str = str(i)\n\n if len(i_str) == 1:\n\n cnt += 1\n\n continue\n\n if len(i_str) == 2:\n\n if int(i_str[0]) == int(i_str[1]):\n\n cnt += 3\n\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 3:\n\n if int(i_str[0]) == int(i_str[2]):\n\n cnt += 4 + (2 * (int(i_str[1])+1) - 1)\n\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n\n cnt += 22\n\n elif int(i_str[0]) < int(i_str[2]):\n\n cnt += 2\n\n continue\n\n if len(i_str) == 4:\n\n if int(i_str[0]) == int(i_str[3]):\n\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2])+1) - 1\n\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n\n cnt += 222\n\n elif int(i_str[0]) < int(i_str[3]):\n\n cnt += 22\n\n continue\n\n if len(i_str) == 5:\n\n if int(i_str[0]) == int(i_str[4]):\n\n cnt += 224 + 200 * int(i_str[1]) + 20 * int(i_str[2]) + 2 * (int(i_str[3])+1) - 1\n\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n\n cnt += 2222\n\n elif int(i_str[0]) < int(i_str[4]):\n\n cnt += 222\n\n continue\n\n if len(i_str) == 6:\n\n if int(i_str[0]) == int(i_str[5]):\n\n cnt += 2224 + 2000 * int(i_str[1]) + 200 * int(i_str[2]) + 20 * int(i_str[3]) + 2 * (int(i_str[4])+1) - 1\n\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n\n cnt += 22222\n\n elif int(i_str[0]) < int(i_str[5]):\n\n cnt += 2222\n\n continue\n\n\n\nprint(cnt)", "target": "n = int(input())\n\n\n\nc = [[0 for _ in range(10)] for __ in range(10)]\n\nfor i in range(1, n+1):\n\n str_i = str(i)\n\n head = int(str_i[0])\n\n tail = int(str_i[-1])\n\n c[head][tail] += 1\n\n\n\ncnt = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n cnt += c[i][j] * c[j][i]\n\n\n\nprint(cnt)", "code_v0_loc": 48, "code_v1_loc": 15, "code_v0_num_chars": 1676, "code_v1_num_chars": 295, "code_v0_no_empty_lines": "n = int(input())\ncnt = 0\nfor i in range(1, n + 1):\n i_str = str(i)\n if len(i_str) == 1:\n cnt += 1\n continue\n if len(i_str) == 2:\n if int(i_str[0]) == int(i_str[1]):\n cnt += 3\n elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):\n cnt += 2\n continue\n if len(i_str) == 3:\n if int(i_str[0]) == int(i_str[2]):\n cnt += 4 + (2 * (int(i_str[1]) + 1) - 1)\n elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):\n cnt += 22\n elif int(i_str[0]) < int(i_str[2]):\n cnt += 2\n continue\n if len(i_str) == 4:\n if int(i_str[0]) == int(i_str[3]):\n cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2]) + 1) - 1\n elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):\n cnt += 222\n elif int(i_str[0]) < int(i_str[3]):\n cnt += 22\n continue\n if len(i_str) == 5:\n if int(i_str[0]) == int(i_str[4]):\n cnt += (\n 224\n + 200 * int(i_str[1])\n + 20 * int(i_str[2])\n + 2 * (int(i_str[3]) + 1)\n - 1\n )\n elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):\n cnt += 2222\n elif int(i_str[0]) < int(i_str[4]):\n cnt += 222\n continue\n if len(i_str) == 6:\n if int(i_str[0]) == int(i_str[5]):\n cnt += (\n 2224\n + 2000 * int(i_str[1])\n + 200 * int(i_str[2])\n + 20 * int(i_str[3])\n + 2 * (int(i_str[4]) + 1)\n - 1\n )\n elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):\n cnt += 22222\n elif int(i_str[0]) < int(i_str[5]):\n cnt += 2222\n continue\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\nc = [[0 for _ in range(10)] for __ in range(10)]\nfor i in range(1, n + 1):\n str_i = str(i)\n head = int(str_i[0])\n tail = int(str_i[-1])\n c[head][tail] += 1\ncnt = 0\nfor i in range(10):\n for j in range(10):\n cnt += c[i][j] * c[j][i]\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 68.75, "diff": ["+c = [[0 for _ in range(10)] for __ in range(10)]", "+for i in range(1, n + 1):", "+ str_i = str(i)", "+ head = int(str_i[0])", "+ tail = int(str_i[-1])", "+ c[head][tail] += 1", "-for i in range(1, n + 1):", "- i_str = str(i)", "- if len(i_str) == 1:", "- cnt += 1", "- continue", "- if len(i_str) == 2:", "- if int(i_str[0]) == int(i_str[1]):", "- cnt += 3", "- elif int(i_str[1]) != 0 and int(i_str[0]) > int(i_str[1]):", "- cnt += 2", "- continue", "- if len(i_str) == 3:", "- if int(i_str[0]) == int(i_str[2]):", "- cnt += 4 + (2 * (int(i_str[1]) + 1) - 1)", "- elif int(i_str[2]) != 0 and int(i_str[0]) > int(i_str[2]):", "- cnt += 22", "- elif int(i_str[0]) < int(i_str[2]):", "- cnt += 2", "- continue", "- if len(i_str) == 4:", "- if int(i_str[0]) == int(i_str[3]):", "- cnt += 24 + 20 * int(i_str[1]) + 2 * (int(i_str[2]) + 1) - 1", "- elif int(i_str[3]) != 0 and int(i_str[0]) > int(i_str[3]):", "- cnt += 222", "- elif int(i_str[0]) < int(i_str[3]):", "- cnt += 22", "- continue", "- if len(i_str) == 5:", "- if int(i_str[0]) == int(i_str[4]):", "- cnt += (", "- 224", "- + 200 * int(i_str[1])", "- + 20 * int(i_str[2])", "- + 2 * (int(i_str[3]) + 1)", "- - 1", "- )", "- elif int(i_str[4]) != 0 and int(i_str[0]) > int(i_str[4]):", "- cnt += 2222", "- elif int(i_str[0]) < int(i_str[4]):", "- cnt += 222", "- continue", "- if len(i_str) == 6:", "- if int(i_str[0]) == int(i_str[5]):", "- cnt += (", "- 2224", "- + 2000 * int(i_str[1])", "- + 200 * int(i_str[2])", "- + 20 * int(i_str[3])", "- + 2 * (int(i_str[4]) + 1)", "- - 1", "- )", "- elif int(i_str[5]) != 0 and int(i_str[0]) > int(i_str[5]):", "- cnt += 22222", "- elif int(i_str[0]) < int(i_str[5]):", "- cnt += 2222", "- continue", "+for i in range(10):", "+ for j in range(10):", "+ cnt += c[i][j] * c[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.528624272, "measured_runtime_v1": 0.3498814137, "runtime_lift": 1.5108669718, "key": ["s161079550", "s476355973"], "target_token_count_dream": 112, "target_token_bucket_dream": "<128"} +{"user_id": "u285681431", "problem_id": "p03796", "language": "python", "submission_id_v0": "s922366861", "submission_id_v1": "s031671477", "cpu_time_v0": 154, "cpu_time_v1": 82, "memory_v0": 9940, "memory_v1": 62860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.75, "input": "import math\n\n\n\nN = int(input())\n\nans = math.factorial(N) % (10**9 + 7)\n\nprint(ans)", "target": "N = int(input())\n\nmod = 10**9 + 7\n\nans = 1\n\nfor i in range(1, N + 1):\n\n ans *= i\n\n ans %= mod\n\nprint(ans)\n", "code_v0_loc": 5, "code_v1_loc": 7, "code_v0_num_chars": 82, "code_v1_num_chars": 112, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nmod = 10**9 + 7\nans = 1\nfor i in range(1, N + 1):\n ans *= i\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-import math", "-", "-ans = math.factorial(N) % (10**9 + 7)", "+mod = 10**9 + 7", "+ans = 1", "+for i in range(1, N + 1):", "+ ans *= i", "+ ans %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.599384095, "measured_runtime_v1": 0.2730524833, "runtime_lift": 2.1951241301, "key": ["s922366861", "s031671477"], "target_token_count_dream": 46, "target_token_bucket_dream": "<128"} +{"user_id": "u562935282", "problem_id": "p03038", "language": "python", "submission_id_v0": "s653342727", "submission_id_v1": "s579349204", "cpu_time_v0": 535, "cpu_time_v1": 476, "memory_v0": 31964, "memory_v1": 42656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.03, "input": "from heapq import heappop, heappush\n\n\n\nn, m = list(map(int, input().split()))\n\na = tuple(map(int, input().split()))\n\n\n\nhq = []\n\nfor aa in a:\n\n heappush(hq, (-aa, 1))\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(hq, (-c, b))\n\n\n\nrest = n\n\nans = 0\n\nwhile rest > 0:\n\n num, cnt = heappop(hq)\n\n\n\n num *= (-1)\n\n use = min(rest, cnt)\n\n ans += use * num\n\n rest -= use\n\n\n\nprint(ans)\n", "target": "def main():\n\n from collections import Counter\n\n from operator import itemgetter\n\n\n\n import sys\n\n input = sys.stdin.readline\n\n\n\n N, M = list(map(int, input().split()))\n\n a = list(map(int, input().split()))\n\n\n\n ctr = Counter(a)\n\n for _ in range(M):\n\n b, c = list(map(int, input().split()))\n\n ctr[c] += b\n\n\n\n ans = 0\n\n rest = N\n\n for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):\n\n take = min(rest, count)\n\n ans += take * integer\n\n rest -= take\n\n if not rest:\n\n break\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n# import sys\n\n# input = sys.stdin.readline\n\n# \n\n# sys.setrecursionlimit(10 ** 7)\n\n# \n\n# (int(x)-1 for x in input().split())\n\n# rstrip()\n", "code_v0_loc": 24, "code_v1_loc": 37, "code_v0_num_chars": 414, "code_v1_num_chars": 760, "code_v0_no_empty_lines": "from heapq import heappop, heappush\n\nn, m = list(map(int, input().split()))\na = tuple(map(int, input().split()))\nhq = []\nfor aa in a:\n heappush(hq, (-aa, 1))\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n heappush(hq, (-c, b))\nrest = n\nans = 0\nwhile rest > 0:\n num, cnt = heappop(hq)\n num *= -1\n use = min(rest, cnt)\n ans += use * num\n rest -= use\nprint(ans)\n", "code_v1_no_empty_lines": "def main():\n from collections import Counter\n from operator import itemgetter\n import sys\n\n input = sys.stdin.readline\n N, M = list(map(int, input().split()))\n a = list(map(int, input().split()))\n ctr = Counter(a)\n for _ in range(M):\n b, c = list(map(int, input().split()))\n ctr[c] += b\n ans = 0\n rest = N\n for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):\n take = min(rest, count)\n ans += take * integer\n rest -= take\n if not rest:\n break\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n# import sys\n# input = sys.stdin.readline\n#\n# sys.setrecursionlimit(10 ** 7)\n#\n# (int(x)-1 for x in input().split())\n# rstrip()\n", "code_same": false, "relative_loc_diff_percent": 35.1351351351, "diff": ["-from heapq import heappop, heappush", "+def main():", "+ from collections import Counter", "+ from operator import itemgetter", "+ import sys", "-n, m = list(map(int, input().split()))", "-a = tuple(map(int, input().split()))", "-hq = []", "-for aa in a:", "- heappush(hq, (-aa, 1))", "-for _ in range(m):", "- b, c = list(map(int, input().split()))", "- heappush(hq, (-c, b))", "-rest = n", "-ans = 0", "-while rest > 0:", "- num, cnt = heappop(hq)", "- num *= -1", "- use = min(rest, cnt)", "- ans += use * num", "- rest -= use", "-print(ans)", "+ input = sys.stdin.readline", "+ N, M = list(map(int, input().split()))", "+ a = list(map(int, input().split()))", "+ ctr = Counter(a)", "+ for _ in range(M):", "+ b, c = list(map(int, input().split()))", "+ ctr[c] += b", "+ ans = 0", "+ rest = N", "+ for integer, count in sorted(list(ctr.items()), key=itemgetter(0), reverse=True):", "+ take = min(rest, count)", "+ ans += take * integer", "+ rest -= take", "+ if not rest:", "+ break", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()", "+# import sys", "+# input = sys.stdin.readline", "+#", "+# sys.setrecursionlimit(10 ** 7)", "+#", "+# (int(x)-1 for x in input().split())", "+# rstrip()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3003652287, "measured_runtime_v1": 0.218658349, "runtime_lift": 1.3736737242, "key": ["s653342727", "s579349204"], "target_token_count_dream": 206, "target_token_bucket_dream": "128-256"} +{"user_id": "u170201762", "problem_id": "p03371", "language": "python", "submission_id_v0": "s850530798", "submission_id_v1": "s933367975", "cpu_time_v0": 94, "cpu_time_v1": 18, "memory_v0": 7096, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.85, "input": "A,B,C,X,Y = list(map(int,input().split()))\n\nl = []\n\nfor i in range(max(X,Y)+1):\n\n T = i * C * 2\n\n if i < X: \n\n T += (X-i)*A\n\n if i < Y:\n\n T += (Y-i)*B\n\n l.append(T)\n\nl.sort()\n\nprint((l[0]))", "target": "A,B,C,X,Y = list(map(int,input().split()))\n\nans = 0\n\nif 2*C <= A+B:\n\n Z = min(X,Y)\n\n ans = 2*C*Z\n\n X -= Z\n\n Y -= Z\n\nans += min(2*C*X,A*X)\n\nans += min(2*C*Y,B*Y)\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 207, "code_v1_num_chars": 178, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nl = []\nfor i in range(max(X, Y) + 1):\n T = i * C * 2\n if i < X:\n T += (X - i) * A\n if i < Y:\n T += (Y - i) * B\n l.append(T)\nl.sort()\nprint((l[0]))\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = 0\nif 2 * C <= A + B:\n Z = min(X, Y)\n ans = 2 * C * Z\n X -= Z\n Y -= Z\nans += min(2 * C * X, A * X)\nans += min(2 * C * Y, B * Y)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-l = []", "-for i in range(max(X, Y) + 1):", "- T = i * C * 2", "- if i < X:", "- T += (X - i) * A", "- if i < Y:", "- T += (Y - i) * B", "- l.append(T)", "-l.sort()", "-print((l[0]))", "+ans = 0", "+if 2 * C <= A + B:", "+ Z = min(X, Y)", "+ ans = 2 * C * Z", "+ X -= Z", "+ Y -= Z", "+ans += min(2 * C * X, A * X)", "+ans += min(2 * C * Y, B * Y)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.290536653, "measured_runtime_v1": 0.1943999538, "runtime_lift": 1.494530463, "key": ["s850530798", "s933367975"], "target_token_count_dream": 77, "target_token_bucket_dream": "<128"} +{"user_id": "u708211626", "problem_id": "p04012", "language": "python", "submission_id_v0": "s951351679", "submission_id_v1": "s246688975", "cpu_time_v0": 32, "cpu_time_v1": 26, "memory_v0": 9372, "memory_v1": 9000, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.75, "input": "import collections\n\nimport sys\n\na=input()\n\nb=[]\n\n\n\nfor i in a:\n\n b.append(i)\n\n \n\nb.sort()\n\nc=collections.Counter(b)\n\nc=list(c.values())\n\n\n\nfor i in range(len(c)):\n\n if int(c[i])%2==0:\n\n q=0\n\n else:\n\n q=1\n\n print('No')\n\n sys.exit()\n\n \n\nprint('Yes')\n", "target": "w = list(input())\n\ns = set(w)\n\nfor i in s:\n\n if w.count(i)%2 != 0:\n\n print(\"No\")\n\n break\n\nelse:\n\n print(\"Yes\")\n\n ", "code_v0_loc": 21, "code_v1_loc": 9, "code_v0_num_chars": 267, "code_v1_num_chars": 122, "code_v0_no_empty_lines": "import collections\nimport sys\n\na = input()\nb = []\nfor i in a:\n b.append(i)\nb.sort()\nc = collections.Counter(b)\nc = list(c.values())\nfor i in range(len(c)):\n if int(c[i]) % 2 == 0:\n q = 0\n else:\n q = 1\n print(\"No\")\n sys.exit()\nprint(\"Yes\")\n", "code_v1_no_empty_lines": "w = list(input())\ns = set(w)\nfor i in s:\n if w.count(i) % 2 != 0:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-import collections", "-import sys", "-", "-a = input()", "-b = []", "-for i in a:", "- b.append(i)", "-b.sort()", "-c = collections.Counter(b)", "-c = list(c.values())", "-for i in range(len(c)):", "- if int(c[i]) % 2 == 0:", "- q = 0", "- else:", "- q = 1", "+w = list(input())", "+s = set(w)", "+for i in s:", "+ if w.count(i) % 2 != 0:", "- sys.exit()", "-print(\"Yes\")", "+ break", "+else:", "+ print(\"Yes\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2393270415, "measured_runtime_v1": 0.1892163638, "runtime_lift": 1.2648326847, "key": ["s951351679", "s246688975"], "target_token_count_dream": 42, "target_token_bucket_dream": "<128"} +{"user_id": "u379959788", "problem_id": "p03835", "language": "python", "submission_id_v0": "s258964318", "submission_id_v1": "s303783261", "cpu_time_v0": 1751, "cpu_time_v1": 1557, "memory_v0": 2940, "memory_v1": 3444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.08, "input": "#ABC951B/Sum_of_Three_Integers\n\n\n\nK, S = list(map(int, input().split()))\n\nans = 0\n\nfor x in range(0, K+1):\n\n for y in range(0, K+1):\n\n z = S - x - y\n\n if 0 <= z and z <= K:\n\n ans += 1\n\nprint(ans)", "target": "K, S = list(map(int, input().split()))\n\nans = 0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z = S - X - Y\n\n if Z >= 0 and Z <= K:\n\n ans += 1\n\nprint(ans) ", "code_v0_loc": 10, "code_v1_loc": 8, "code_v0_num_chars": 217, "code_v1_num_chars": 184, "code_v0_no_empty_lines": "# ABC951B/Sum_of_Three_Integers\nK, S = list(map(int, input().split()))\nans = 0\nfor x in range(0, K + 1):\n for y in range(0, K + 1):\n z = S - x - y\n if 0 <= z and z <= K:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "K, S = list(map(int, input().split()))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if Z >= 0 and Z <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-# ABC951B/Sum_of_Three_Integers", "-for x in range(0, K + 1):", "- for y in range(0, K + 1):", "- z = S - x - y", "- if 0 <= z and z <= K:", "+for X in range(K + 1):", "+ for Y in range(K + 1):", "+ Z = S - X - Y", "+ if Z >= 0 and Z <= K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2646004359, "measured_runtime_v1": 0.0728798735, "runtime_lift": 3.6306379676, "key": ["s258964318", "s303783261"], "target_token_count_dream": 64, "target_token_bucket_dream": "<128"} +{"user_id": "u150984829", "problem_id": "p02276", "language": "python", "submission_id_v0": "s439916574", "submission_id_v1": "s927428389", "cpu_time_v0": 80, "cpu_time_v1": 60, "memory_v0": 16392, "memory_v1": 16388, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "n=int(input())-1\n\nA=list(map(int,input().split()))\n\ni=0\n\nfor j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\nA[i],A[n]=A[n],A[i]\n\nprint((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n", "target": "def s():\n\n n=int(input())-1\n\n A=list(map(int,input().split()))\n\n i=0\n\n for j in range(n):\n\n if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1\n\n A[i],A[n]=A[n],A[i]\n\n print((\" \".join(map(str,A[:i]))+\" [\"+str(A[i])+\"] \"+\" \".join(map(str,A[i+1:]))))\n\nif'__main__'==__name__:s()\n", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 219, "code_v1_num_chars": 264, "code_v0_no_empty_lines": "n = int(input()) - 1\nA = list(map(int, input().split()))\ni = 0\nfor j in range(n):\n if A[j] <= A[-1]:\n A[i], A[j] = A[j], A[i]\n i += 1\nA[i], A[n] = A[n], A[i]\nprint(\n (\n \" \".join(map(str, A[:i]))\n + \" [\"\n + str(A[i])\n + \"] \"\n + \" \".join(map(str, A[i + 1 :]))\n )\n)\n", "code_v1_no_empty_lines": "def s():\n n = int(input()) - 1\n A = list(map(int, input().split()))\n i = 0\n for j in range(n):\n if A[j] <= A[-1]:\n A[i], A[j] = A[j], A[i]\n i += 1\n A[i], A[n] = A[n], A[i]\n print(\n (\n \" \".join(map(str, A[:i]))\n + \" [\"\n + str(A[i])\n + \"] \"\n + \" \".join(map(str, A[i + 1 :]))\n )\n )\n\n\nif \"__main__\" == __name__:\n s()\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-n = int(input()) - 1", "-A = list(map(int, input().split()))", "-i = 0", "-for j in range(n):", "- if A[j] <= A[-1]:", "- A[i], A[j] = A[j], A[i]", "- i += 1", "-A[i], A[n] = A[n], A[i]", "-print(", "- (", "- \" \".join(map(str, A[:i]))", "- + \" [\"", "- + str(A[i])", "- + \"] \"", "- + \" \".join(map(str, A[i + 1 :]))", "+def s():", "+ n = int(input()) - 1", "+ A = list(map(int, input().split()))", "+ i = 0", "+ for j in range(n):", "+ if A[j] <= A[-1]:", "+ A[i], A[j] = A[j], A[i]", "+ i += 1", "+ A[i], A[n] = A[n], A[i]", "+ print(", "+ (", "+ \" \".join(map(str, A[:i]))", "+ + \" [\"", "+ + str(A[i])", "+ + \"] \"", "+ + \" \".join(map(str, A[i + 1 :]))", "+ )", "-)", "+", "+", "+if \"__main__\" == __name__:", "+ s()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2844968953, "measured_runtime_v1": 0.0927553341, "runtime_lift": 3.0671755746, "key": ["s439916574", "s927428389"], "target_token_count_dream": 107, "target_token_bucket_dream": "<128"} +{"user_id": "u580404776", "problem_id": "p02792", "language": "python", "submission_id_v0": "s545080507", "submission_id_v1": "s376438645", "cpu_time_v0": 492, "cpu_time_v1": 192, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.98, "input": "N = int(input())\n\nmem = [[0]*10 for _ in range(10)]\n\n\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n mem[a][b] += 1\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n a = int(str(i)[0])\n\n b = int(str(i)[-1])\n\n ans += mem[b][a]\n\nprint(ans)\n", "target": "N = int(input())\n\nmem=[[0] * 10 for _ in range(10)]\n\n\n\nfor i in range(1, N+1):\n\n s = str(i)\n\n mem[int(s[0])][int(s[-1])] += 1 \n\n \n\nans = 0\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += mem[i][j] * mem[j][i]\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 265, "code_v1_num_chars": 249, "code_v0_no_empty_lines": "N = int(input())\nmem = [[0] * 10 for _ in range(10)]\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n mem[a][b] += 1\nans = 0\nfor i in range(1, N + 1):\n a = int(str(i)[0])\n b = int(str(i)[-1])\n ans += mem[b][a]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nmem = [[0] * 10 for _ in range(10)]\nfor i in range(1, N + 1):\n s = str(i)\n mem[int(s[0])][int(s[-1])] += 1\nans = 0\nfor i in range(1, 10):\n for j in range(1, 10):\n ans += mem[i][j] * mem[j][i]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- mem[a][b] += 1", "+ s = str(i)", "+ mem[int(s[0])][int(s[-1])] += 1", "-for i in range(1, N + 1):", "- a = int(str(i)[0])", "- b = int(str(i)[-1])", "- ans += mem[b][a]", "+for i in range(1, 10):", "+ for j in range(1, 10):", "+ ans += mem[i][j] * mem[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4534644659, "measured_runtime_v1": 0.3052516449, "runtime_lift": 1.4855430706, "key": ["s545080507", "s376438645"], "target_token_count_dream": 102, "target_token_bucket_dream": "<128"} +{"user_id": "u107077660", "problem_id": "p04012", "language": "python", "submission_id_v0": "s204906128", "submission_id_v1": "s764910207", "cpu_time_v0": 38, "cpu_time_v1": 29, "memory_v0": 3064, "memory_v1": 3444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.68, "input": "w = input()\n\nfor l in w:\n\n\tif w.count(l) % 2 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")", "target": "from collections import Counter\n\ns = input()\n\nc = list(Counter(s).values())\n\nfor n in c:\n\n\tif n & 1 == 1:\n\n\t\tprint(\"No\")\n\n\t\tbreak\n\nelse:\n\n\tprint(\"Yes\")\n\n\n", "code_v0_loc": 7, "code_v1_loc": 10, "code_v0_num_chars": 96, "code_v1_num_chars": 148, "code_v0_no_empty_lines": "w = input()\nfor l in w:\n if w.count(l) % 2 == 1:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_v1_no_empty_lines": "from collections import Counter\n\ns = input()\nc = list(Counter(s).values())\nfor n in c:\n if n & 1 == 1:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-w = input()", "-for l in w:", "- if w.count(l) % 2 == 1:", "+from collections import Counter", "+", "+s = input()", "+c = list(Counter(s).values())", "+for n in c:", "+ if n & 1 == 1:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3070713311, "measured_runtime_v1": 0.212444066, "runtime_lift": 1.44542202, "key": ["s204906128", "s764910207"], "target_token_count_dream": 46, "target_token_bucket_dream": "<128"} +{"user_id": "u391875425", "problem_id": "p03416", "language": "python", "submission_id_v0": "s339057919", "submission_id_v1": "s254043060", "cpu_time_v0": 204, "cpu_time_v1": 57, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.06, "input": "a, b = list(map(int, input().split()))\n\ntmp=str(a)\n\nc=0\n\nfor i in range(a,b+1):\n\n tmp=str(i)\n\n tmp2=\"\"\n\n for s in range(len(tmp)):\n\n tmp2=tmp2+tmp[len(tmp)-1-s]\n\n if tmp==tmp2:\n\n c=c+1\n\nprint(c)", "target": "def main():\n\n #1. input\n\n a, b = list(map(int, input().split()))\n\n\n\n ans = 0\n\n\n\n #2. from A to B\n\n for i in range(a, b+1):\n\n #2.1. judge if the number is palindromic\n\n if (str(i)[0]==str(i)[4]) and (str(i)[1]==str(i)[3]):\n\n ans = ans+1\n\n\n\n #3. output\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 11, "code_v1_loc": 18, "code_v0_num_chars": 214, "code_v1_num_chars": 347, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ntmp = str(a)\nc = 0\nfor i in range(a, b + 1):\n tmp = str(i)\n tmp2 = \"\"\n for s in range(len(tmp)):\n tmp2 = tmp2 + tmp[len(tmp) - 1 - s]\n if tmp == tmp2:\n c = c + 1\nprint(c)\n", "code_v1_no_empty_lines": "def main():\n # 1. input\n a, b = list(map(int, input().split()))\n ans = 0\n # 2. from A to B\n for i in range(a, b + 1):\n # 2.1. judge if the number is palindromic\n if (str(i)[0] == str(i)[4]) and (str(i)[1] == str(i)[3]):\n ans = ans + 1\n # 3. output\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 38.8888888889, "diff": ["-a, b = list(map(int, input().split()))", "-tmp = str(a)", "-c = 0", "-for i in range(a, b + 1):", "- tmp = str(i)", "- tmp2 = \"\"", "- for s in range(len(tmp)):", "- tmp2 = tmp2 + tmp[len(tmp) - 1 - s]", "- if tmp == tmp2:", "- c = c + 1", "-print(c)", "+def main():", "+ # 1. input", "+ a, b = list(map(int, input().split()))", "+ ans = 0", "+ # 2. from A to B", "+ for i in range(a, b + 1):", "+ # 2.1. judge if the number is palindromic", "+ if (str(i)[0] == str(i)[4]) and (str(i)[1] == str(i)[3]):", "+ ans = ans + 1", "+ # 3. output", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5203332471, "measured_runtime_v1": 0.2634068646, "runtime_lift": 1.9753974444, "key": ["s339057919", "s254043060"], "target_token_count_dream": 120, "target_token_bucket_dream": "<128"} +{"user_id": "u505420467", "problem_id": "p03835", "language": "python", "submission_id_v0": "s014481361", "submission_id_v1": "s844546698", "cpu_time_v0": 1491, "cpu_time_v1": 1254, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.9, "input": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n z=s-i-j\n\n if 0<=z<=k:\n\n ans+=1\n\nprint(ans)\n", "target": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0<=s-i-j<=k:\n\n ans+=1\n\nprint(ans)\n", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 154, "code_v1_num_chars": 141, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n z = s - i - j\n if 0 <= z <= k:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- z = s - i - j", "- if 0 <= z <= k:", "+ if 0 <= s - i - j <= k:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2451675486, "measured_runtime_v1": 0.0064913454, "runtime_lift": 37.7683720217, "key": ["s014481361", "s844546698"], "target_token_count_dream": 49, "target_token_bucket_dream": "<128"} +{"user_id": "u285891772", "problem_id": "p03078", "language": "python", "submission_id_v0": "s323914382", "submission_id_v1": "s323368336", "cpu_time_v0": 910, "cpu_time_v1": 524, "memory_v0": 69644, "memory_v1": 18184, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.42, "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return map(int, input().split())\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nAB = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tAB.append(A[i]+B[j])\n\n\n\nAB.sort(reverse = True)\n\nAB = AB[:3000]\n\nABC = sorted([C[0]+AB[i] for i in range(min(3000, X*Y))], reverse = True)\n\n\n\nfor j in range(1, Z):\n\n\tABC_tmp = sorted([C[j]+AB[i] for i in range(min(3000, X*Y))])\n\n\tABC += ABC_tmp\n\n\tABC.sort(reverse = True)\n\n\tABC = ABC[:3000]\n\n\n\nprint(*ABC[:K], sep= \"\\n\")\n\n\n", "target": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nX, Y, Z, K = MAP()\n\nA = sorted(LIST(), reverse = True)\n\nB = sorted(LIST(), reverse = True)\n\nC = sorted(LIST(), reverse = True)\n\n\n\nans = []\n\nfor i in range(X):\n\n\tfor j in range(Y):\n\n\t\tfor k in range(Z):\n\n\t\t\tif (i+1)*(j+1)*(k+1) <= K:\n\n\t\t\t\tans.append(A[i]+B[j]+C[k])\n\n\t\t\telse:\n\n\t\t\t\tbreak\n\n\n\nfor a in sorted(ans)[::-1][:K]:\n\n\tprint(a)\n", "code_v0_loc": 46, "code_v1_loc": 40, "code_v0_num_chars": 1517, "code_v1_num_chars": 1344, "code_v0_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return map(int, input().split())\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return zip(*(MAP() for _ in range(n)))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nAB = []\nfor i in range(X):\n for j in range(Y):\n AB.append(A[i] + B[j])\nAB.sort(reverse=True)\nAB = AB[:3000]\nABC = sorted([C[0] + AB[i] for i in range(min(3000, X * Y))], reverse=True)\nfor j in range(1, Z):\n ABC_tmp = sorted([C[j] + AB[i] for i in range(min(3000, X * Y))])\n ABC += ABC_tmp\n ABC.sort(reverse=True)\n ABC = ABC[:3000]\nprint(*ABC[:K], sep=\"\\n\")\n", "code_v1_no_empty_lines": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nans = []\nfor i in range(X):\n for j in range(Y):\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) <= K:\n ans.append(A[i] + B[j] + C[k])\n else:\n break\nfor a in sorted(ans)[::-1][:K]:\n print(a)\n", "code_same": false, "relative_loc_diff_percent": 13.0434782609, "diff": ["- return int(input())", "+ return int(input())", "- return map(int, input().split())", "+ return list(map(int, input().split()))", "- return zip(*(MAP() for _ in range(n)))", "+ return list(zip(*(MAP() for _ in range(n))))", "-AB = []", "+ans = []", "- AB.append(A[i] + B[j])", "-AB.sort(reverse=True)", "-AB = AB[:3000]", "-ABC = sorted([C[0] + AB[i] for i in range(min(3000, X * Y))], reverse=True)", "-for j in range(1, Z):", "- ABC_tmp = sorted([C[j] + AB[i] for i in range(min(3000, X * Y))])", "- ABC += ABC_tmp", "- ABC.sort(reverse=True)", "- ABC = ABC[:3000]", "-print(*ABC[:K], sep=\"\\n\")", "+ for k in range(Z):", "+ if (i + 1) * (j + 1) * (k + 1) <= K:", "+ ans.append(A[i] + B[j] + C[k])", "+ else:", "+ break", "+for a in sorted(ans)[::-1][:K]:", "+ print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3039683881, "measured_runtime_v1": 0.2292593994, "runtime_lift": 1.3258709952, "key": ["s323914382", "s323368336"], "target_token_count_dream": 378, "target_token_bucket_dream": "256-512"} +{"user_id": "u759934006", "problem_id": "p00174", "language": "python", "submission_id_v0": "s437122774", "submission_id_v1": "s723923476", "cpu_time_v0": 20, "cpu_time_v1": 10, "memory_v0": 4228, "memory_v1": 4232, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "while True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n a = b = 0\n\n for i, s in enumerate(line):\n\n if i != 0:\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break", "target": "while True:\n\n try:\n\n for i in range(3):\n\n line = input().strip()\n\n if line == '0':\n\n raise Exception\n\n\n\n if line[0] == 'A':\n\n a = -1\n\n b = 0\n\n else:\n\n a = 0\n\n b = -1\n\n for i, s in enumerate(line):\n\n if s == 'A':\n\n a += 1\n\n else:\n\n b += 1\n\n if a > b:\n\n a += 1\n\n else:\n\n b += 1\n\n print(a, b)\n\n\n\n except:\n\n break", "code_v0_loc": 22, "code_v1_loc": 26, "code_v0_num_chars": 515, "code_v1_num_chars": 593, "code_v0_no_empty_lines": "while True:\n try:\n for i in range(3):\n line = input().strip()\n if line == \"0\":\n raise Exception\n a = b = 0\n for i, s in enumerate(line):\n if i != 0:\n if s == \"A\":\n a += 1\n else:\n b += 1\n if a > b:\n a += 1\n else:\n b += 1\n print(a, b)\n except:\n break\n", "code_v1_no_empty_lines": "while True:\n try:\n for i in range(3):\n line = input().strip()\n if line == \"0\":\n raise Exception\n if line[0] == \"A\":\n a = -1\n b = 0\n else:\n a = 0\n b = -1\n for i, s in enumerate(line):\n if s == \"A\":\n a += 1\n else:\n b += 1\n if a > b:\n a += 1\n else:\n b += 1\n print(a, b)\n except:\n break\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["- a = b = 0", "+ if line[0] == \"A\":", "+ a = -1", "+ b = 0", "+ else:", "+ a = 0", "+ b = -1", "- if i != 0:", "- if s == \"A\":", "- a += 1", "- else:", "- b += 1", "+ if s == \"A\":", "+ a += 1", "+ else:", "+ b += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1803158569, "measured_runtime_v1": 0.0065688469, "runtime_lift": 27.4501534712, "key": ["s437122774", "s723923476"], "target_token_count_dream": 132, "target_token_bucket_dream": "128-256"} +{"user_id": "u867848444", "problem_id": "p03559", "language": "python", "submission_id_v0": "s912886810", "submission_id_v1": "s338115037", "cpu_time_v0": 472, "cpu_time_v1": 254, "memory_v0": 106340, "memory_v1": 29384, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.19, "input": "from bisect import *\n\nn = int(input())\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na = sorted(a)\n\nc = sorted(c)\n\n\n\nrec = 0\n\nfor i in range(n):\n\n temp = b[i]\n\n l = bisect_left(a, temp)\n\n r = bisect_right(c, temp)\n\n rec += l * (n - r)\n\nprint(rec)", "target": "from bisect import *\n\nn = int(input())\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\nc = list(map(int,input().split()))\n\n\n\na.sort()\n\nc.sort()\n\nres = 0\n\nfor i in b:\n\n temp_a = bisect_left(a, i)\n\n temp_c = n - bisect_right(c, i)\n\n res += temp_a*temp_c\n\nprint(res)", "code_v0_loc": 16, "code_v1_loc": 14, "code_v0_num_chars": 323, "code_v1_num_chars": 297, "code_v0_no_empty_lines": "from bisect import *\n\nn = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na = sorted(a)\nc = sorted(c)\nrec = 0\nfor i in range(n):\n temp = b[i]\n l = bisect_left(a, temp)\n r = bisect_right(c, temp)\n rec += l * (n - r)\nprint(rec)\n", "code_v1_no_empty_lines": "from bisect import *\n\nn = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort()\nc.sort()\nres = 0\nfor i in b:\n temp_a = bisect_left(a, i)\n temp_c = n - bisect_right(c, i)\n res += temp_a * temp_c\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-a = sorted(a)", "-c = sorted(c)", "-rec = 0", "-for i in range(n):", "- temp = b[i]", "- l = bisect_left(a, temp)", "- r = bisect_right(c, temp)", "- rec += l * (n - r)", "-print(rec)", "+a.sort()", "+c.sort()", "+res = 0", "+for i in b:", "+ temp_a = bisect_left(a, i)", "+ temp_c = n - bisect_right(c, i)", "+ res += temp_a * temp_c", "+print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2357759671, "measured_runtime_v1": 0.1661899195, "runtime_lift": 1.4187140102, "key": ["s912886810", "s338115037"], "target_token_count_dream": 90, "target_token_bucket_dream": "<128"} +{"user_id": "u761320129", "problem_id": "p03592", "language": "python", "submission_id_v0": "s651607907", "submission_id_v1": "s022339691", "cpu_time_v0": 277, "cpu_time_v1": 242, "memory_v0": 9168, "memory_v1": 9152, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.64, "input": "N,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n t = i*M + j*N - i*j*2\n\n if t==K:\n\n print('Yes')\n\n exit()\n\nprint('No')", "target": "N,M,K = list(map(int,input().split()))\n\n\n\nfor i in range(N+1):\n\n for j in range(M+1):\n\n if i*(M-j) + j*(N-i) == K:\n\n print('Yes')\n\n exit()\n\nprint('No')", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 190, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "N, M, K = list(map(int, input().split()))\nfor i in range(N + 1):\n for j in range(M + 1):\n t = i * M + j * N - i * j * 2\n if t == K:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_v1_no_empty_lines": "N, M, K = list(map(int, input().split()))\nfor i in range(N + 1):\n for j in range(M + 1):\n if i * (M - j) + j * (N - i) == K:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- t = i * M + j * N - i * j * 2", "- if t == K:", "+ if i * (M - j) + j * (N - i) == K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2590724151, "measured_runtime_v1": 0.2069754691, "runtime_lift": 1.2517058964, "key": ["s651607907", "s022339691"], "target_token_count_dream": 57, "target_token_bucket_dream": "<128"} +{"user_id": "u078042885", "problem_id": "p00542", "language": "python", "submission_id_v0": "s237799080", "submission_id_v1": "s666902384", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7744, "memory_v1": 7736, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "a,b,c,d,e,f=[int(input()) for _ in range(6)]\n\nprint((sum([a,b,c,d,max(e,f)])-min([a,b,c,d])))", "target": "print((sum(sorted(int(input()) for _ in range(4))[1:])+max([int(input()) for _ in range(2)])))", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 91, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "a, b, c, d, e, f = [int(input()) for _ in range(6)]\nprint((sum([a, b, c, d, max(e, f)]) - min([a, b, c, d])))\n", "code_v1_no_empty_lines": "print(\n (\n sum(sorted(int(input()) for _ in range(4))[1:])\n + max([int(input()) for _ in range(2)])\n )\n)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-a, b, c, d, e, f = [int(input()) for _ in range(6)]", "-print((sum([a, b, c, d, max(e, f)]) - min([a, b, c, d])))", "+print(", "+ (", "+ sum(sorted(int(input()) for _ in range(4))[1:])", "+ + max([int(input()) for _ in range(2)])", "+ )", "+)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1785885925, "measured_runtime_v1": 0.1362432997, "runtime_lift": 1.3108064241, "key": ["s237799080", "s666902384"], "target_token_count_dream": 30, "target_token_bucket_dream": "<128"} +{"user_id": "u135454978", "problem_id": "p03371", "language": "python", "submission_id_v0": "s681762997", "submission_id_v1": "s948041496", "cpu_time_v0": 154, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 88.96, "input": "# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z / 2), 0)\n\n y = max(Y - int(z / 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n", "target": "# AtCoder Beginner Contest 095 C - Half and Half\n\nimport sys\n\n\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\n\n\n\"\"\"\n\nans = A * X + B * Y\n\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n\n x = max(X - int(z / 2), 0)\n\n y = max(Y - int(z / 2), 0)\n\n\n\n price = A * x + B * y + C * z\n\n ans = min(price, ans)\n\n\n\nprint(ans)\n\n\"\"\"\n\n\n\nprice1 = A * X + B * Y\n\nprice2 = C * 2 * X + B * max(Y - X, 0)\n\nprice3 = A * max(X - Y, 0) + C * 2 * Y\n\nprint((min(price1, price2, price3)))\n\n\n", "code_v0_loc": 14, "code_v1_loc": 22, "code_v0_num_chars": 332, "code_v1_num_chars": 486, "code_v0_no_empty_lines": "# AtCoder Beginner Contest 095 C - Half and Half\nimport sys\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\nans = A * X + B * Y\nfor z in range(2, 2 * 10**5 + 1, 2):\n x = max(X - int(z / 2), 0)\n y = max(Y - int(z / 2), 0)\n price = A * x + B * y + C * z\n ans = min(price, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "# AtCoder Beginner Contest 095 C - Half and Half\nimport sys\n\nA, B, C, X, Y = list(map(int, sys.stdin.readline().strip().split()))\n\"\"\"\nans = A * X + B * Y\nfor z in range(2, 2 * 10 ** 5 + 1, 2):\n x = max(X - int(z / 2), 0)\n y = max(Y - int(z / 2), 0)\n price = A * x + B * y + C * z\n ans = min(price, ans)\nprint(ans)\n\"\"\"\nprice1 = A * X + B * Y\nprice2 = C * 2 * X + B * max(Y - X, 0)\nprice3 = A * max(X - Y, 0) + C * 2 * Y\nprint((min(price1, price2, price3)))\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["+\"\"\"", "-for z in range(2, 2 * 10**5 + 1, 2):", "+for z in range(2, 2 * 10 ** 5 + 1, 2):", "+\"\"\"", "+price1 = A * X + B * Y", "+price2 = C * 2 * X + B * max(Y - X, 0)", "+price3 = A * max(X - Y, 0) + C * 2 * Y", "+print((min(price1, price2, price3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.7125969741, "measured_runtime_v1": 0.2827094927, "runtime_lift": 6.0577979106, "key": ["s681762997", "s948041496"], "target_token_count_dream": 197, "target_token_bucket_dream": "128-256"} +{"user_id": "u545368057", "problem_id": "p02773", "language": "python", "submission_id_v0": "s347160213", "submission_id_v1": "s313812634", "cpu_time_v0": 801, "cpu_time_v1": 714, "memory_v0": 32480, "memory_v1": 35572, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.86, "input": "from collections import defaultdict\n\nN = int(input())\n\nd = defaultdict(int)\n\n\n\nfor i in range(N):\n\n S = input()\n\n d[S] += 1\n\n\n\nm = 0\n\nfor k in list(d.keys()):\n\n m = max(d[k],m)\n\n\n\nli = []\n\nfor k in list(d.keys()):\n\n if d[k] == m:\n\n li.append(k)\n\n\n\nli.sort()\n\nfor l in li:\n\n print(l)", "target": "from collections import defaultdict\n\nN = int(input())\n\nSs = [input() for i in range(N)]\n\n\n\nd = defaultdict(int)\n\nfor S in Ss:\n\n d[S] += 1\n\n\n\nmx = max([d[k] for k in list(d.keys())])\n\n\n\nans = []\n\nfor k in list(d.keys()):\n\n if d[k] == mx:\n\n ans.append(k)\n\n \n\nfor a in sorted(ans):\n\n print(a)", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 292, "code_v1_num_chars": 298, "code_v0_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nd = defaultdict(int)\nfor i in range(N):\n S = input()\n d[S] += 1\nm = 0\nfor k in list(d.keys()):\n m = max(d[k], m)\nli = []\nfor k in list(d.keys()):\n if d[k] == m:\n li.append(k)\nli.sort()\nfor l in li:\n print(l)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nSs = [input() for i in range(N)]\nd = defaultdict(int)\nfor S in Ss:\n d[S] += 1\nmx = max([d[k] for k in list(d.keys())])\nans = []\nfor k in list(d.keys()):\n if d[k] == mx:\n ans.append(k)\nfor a in sorted(ans):\n print(a)\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["+Ss = [input() for i in range(N)]", "-for i in range(N):", "- S = input()", "+for S in Ss:", "-m = 0", "+mx = max([d[k] for k in list(d.keys())])", "+ans = []", "- m = max(d[k], m)", "-li = []", "-for k in list(d.keys()):", "- if d[k] == m:", "- li.append(k)", "-li.sort()", "-for l in li:", "- print(l)", "+ if d[k] == mx:", "+ ans.append(k)", "+for a in sorted(ans):", "+ print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1866922059, "measured_runtime_v1": 0.0060809708, "runtime_lift": 30.7010529798, "key": ["s347160213", "s313812634"], "target_token_count_dream": 93, "target_token_bucket_dream": "<128"} +{"user_id": "u600402037", "problem_id": "p03037", "language": "python", "submission_id_v0": "s181457641", "submission_id_v1": "s911516772", "cpu_time_v0": 300, "cpu_time_v1": 197, "memory_v0": 11012, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 34.33, "input": "N,M = list(map(int,input().split()))\n\nL,R = [],[]\n\nfor i in range(M):\n\n l,r = list(map(int,input().split()))\n\n L.append(l)\n\n R.append(r)\n\nans = min(R)-max(L)+1\n\nprint((ans if ans >= 0 else 0))", "target": "# coding: utf-8\n\nimport sys\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN, M = lr()\n\nL = 0; R = 10 ** 6\n\nfor _ in range(M):\n\n l, r = lr()\n\n if l > L:\n\n L = l\n\n if r < R:\n\n R = r\n\n\n\nanswer = max(0, R - L + 1)\n\nprint(answer)\n", "code_v0_loc": 8, "code_v1_loc": 18, "code_v0_num_chars": 187, "code_v1_num_chars": 318, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL, R = [], []\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\nans = min(R) - max(L) + 1\nprint((ans if ans >= 0 else 0))\n", "code_v1_no_empty_lines": "# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN, M = lr()\nL = 0\nR = 10**6\nfor _ in range(M):\n l, r = lr()\n if l > L:\n L = l\n if r < R:\n R = r\nanswer = max(0, R - L + 1)\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-N, M = list(map(int, input().split()))", "-L, R = [], []", "-for i in range(M):", "- l, r = list(map(int, input().split()))", "- L.append(l)", "- R.append(r)", "-ans = min(R) - max(L) + 1", "-print((ans if ans >= 0 else 0))", "+# coding: utf-8", "+import sys", "+", "+sr = lambda: sys.stdin.readline().rstrip()", "+ir = lambda: int(sr())", "+lr = lambda: list(map(int, sr().split()))", "+N, M = lr()", "+L = 0", "+R = 10**6", "+for _ in range(M):", "+ l, r = lr()", "+ if l > L:", "+ L = l", "+ if r < R:", "+ R = r", "+answer = max(0, R - L + 1)", "+print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2034662783, "measured_runtime_v1": 0.0060762894, "runtime_lift": 33.4852842041, "key": ["s181457641", "s911516772"], "target_token_count_dream": 111, "target_token_bucket_dream": "<128"} +{"user_id": "u175590965", "problem_id": "p02881", "language": "python", "submission_id_v0": "s837964487", "submission_id_v1": "s558772824", "cpu_time_v0": 232, "cpu_time_v1": 167, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.02, "input": "n = int(input())\n\nl = []\n\nfor i in range(1,1000001):\n\n a = n / i\n\n if a.is_integer():\n\n l.append(i+n/i)\n\nprint((int(min(l)-2)))", "target": "n = int(input())\n\na = 10**20\n\nfor i in range(1,int(n**0.5)+1):\n\n if n%i==0:\n\n a = min(a,i+n//i)\n\nprint((a-2))", "code_v0_loc": 7, "code_v1_loc": 6, "code_v0_num_chars": 138, "code_v1_num_chars": 117, "code_v0_no_empty_lines": "n = int(input())\nl = []\nfor i in range(1, 1000001):\n a = n / i\n if a.is_integer():\n l.append(i + n / i)\nprint((int(min(l) - 2)))\n", "code_v1_no_empty_lines": "n = int(input())\na = 10**20\nfor i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n a = min(a, i + n // i)\nprint((a - 2))\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-l = []", "-for i in range(1, 1000001):", "- a = n / i", "- if a.is_integer():", "- l.append(i + n / i)", "-print((int(min(l) - 2)))", "+a = 10**20", "+for i in range(1, int(n**0.5) + 1):", "+ if n % i == 0:", "+ a = min(a, i + n // i)", "+print((a - 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3549120984, "measured_runtime_v1": 0.219868273, "runtime_lift": 6.1623811373, "key": ["s837964487", "s558772824"], "target_token_count_dream": 52, "target_token_bucket_dream": "<128"} +{"user_id": "u186838327", "problem_id": "p02881", "language": "python", "submission_id_v0": "s806961932", "submission_id_v1": "s386327339", "cpu_time_v0": 218, "cpu_time_v1": 179, "memory_v0": 40428, "memory_v1": 39280, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.89, "input": "n = int(input())\n\nimport math\n\nm = int(math.sqrt(n))+1\n\nanss = []\n\nfor x in range(1, m+1):\n\n y = n//x\n\n z = n%x\n\n if z == 0:\n\n anss.append(abs(x-1)+abs(y-1))\n\nprint((min(anss)))\n", "target": "n = int(input())\n\ndef make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n // i:\n\n divisors.append(n//i)\n\n\n\n #divisors.sort(reverse=True)\n\n return divisors\n\n\n\nl = make_divisors(n)\n\nmin_ = float('inf')\n\nfor i in range(len(l)):\n\n min_ = min(min_, l[i]-1+n//l[i]-1)\n\nprint(min_)\n", "code_v0_loc": 10, "code_v1_loc": 17, "code_v0_num_chars": 182, "code_v1_num_chars": 402, "code_v0_no_empty_lines": "n = int(input())\nimport math\n\nm = int(math.sqrt(n)) + 1\nanss = []\nfor x in range(1, m + 1):\n y = n // x\n z = n % x\n if z == 0:\n anss.append(abs(x - 1) + abs(y - 1))\nprint((min(anss)))\n", "code_v1_no_empty_lines": "n = int(input())\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n // i)\n # divisors.sort(reverse=True)\n return divisors\n\n\nl = make_divisors(n)\nmin_ = float(\"inf\")\nfor i in range(len(l)):\n min_ = min(min_, l[i] - 1 + n // l[i] - 1)\nprint(min_)\n", "code_same": false, "relative_loc_diff_percent": 41.1764705882, "diff": ["-import math", "-m = int(math.sqrt(n)) + 1", "-anss = []", "-for x in range(1, m + 1):", "- y = n // x", "- z = n % x", "- if z == 0:", "- anss.append(abs(x - 1) + abs(y - 1))", "-print((min(anss)))", "+", "+def make_divisors(n):", "+ divisors = []", "+ for i in range(1, int(n**0.5) + 1):", "+ if n % i == 0:", "+ divisors.append(i)", "+ if i != n // i:", "+ divisors.append(n // i)", "+ # divisors.sort(reverse=True)", "+ return divisors", "+", "+", "+l = make_divisors(n)", "+min_ = float(\"inf\")", "+for i in range(len(l)):", "+ min_ = min(min_, l[i] - 1 + n // l[i] - 1)", "+print(min_)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3428507342, "measured_runtime_v1": 0.2632945333, "runtime_lift": 1.302156676, "key": ["s806961932", "s386327339"], "target_token_count_dream": 120, "target_token_bucket_dream": "<128"} +{"user_id": "u850516963", "problem_id": "p03455", "language": "python", "submission_id_v0": "s887829630", "submission_id_v1": "s071542109", "cpu_time_v0": 67, "cpu_time_v1": 30, "memory_v0": 61732, "memory_v1": 9060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.22, "input": "a, b = list(map(int, input().split()))\n\nif a*b%2 == 1:\n\n print(\"Odd\")\n\nelse:\n\n print(\"Even\")", "target": "a, b = list(map(int, input().split()))\n\nprint(('Odd'if a&b&1 else 'Even'))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 92, "code_v1_num_chars": 66, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nif a * b % 2 == 1:\n print(\"Odd\")\nelse:\n print(\"Even\")\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nprint((\"Odd\" if a & b & 1 else \"Even\"))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-if a * b % 2 == 1:", "- print(\"Odd\")", "-else:", "- print(\"Even\")", "+print((\"Odd\" if a & b & 1 else \"Even\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1895228839, "measured_runtime_v1": 0.0064490705, "runtime_lift": 29.3876276628, "key": ["s887829630", "s071542109"], "target_token_count_dream": 26, "target_token_bucket_dream": "<128"} +{"user_id": "u503228842", "problem_id": "p02555", "language": "python", "submission_id_v0": "s264986040", "submission_id_v1": "s936814116", "cpu_time_v0": 455, "cpu_time_v1": 29, "memory_v0": 9180, "memory_v1": 9188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 93.63, "input": "n = int(input())\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n for j in range(i - 2):\n\n ans[i] += ans[j]\n\n ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n", "target": "n = int(input())\n\nm = 10**9 + 7\n\n# ans = [0] * (n + 1)\n\nans = [0] * 2200\n\nans[0] = 1\n\n# ans[3] = 1\n\n# ans[4] = 1\n\n# ans[5] = 1\n\nfor i in range(3, n + 1):\n\n ans[i] = ans[i - 1] + ans[i - 3]\n\n ans[i] %= m\n\n # for j in range(i - 2):\n\n # ans[i] += ans[j]\n\n # ans[i] %= m\n\nprint((ans[n]))\n\n# print(ans[:10])\n", "code_v0_loc": 14, "code_v1_loc": 16, "code_v0_num_chars": 263, "code_v1_num_chars": 324, "code_v0_no_empty_lines": "n = int(input())\nm = 10**9 + 7\n# ans = [0] * (n + 1)\nans = [0] * 2200\nans[0] = 1\n# ans[3] = 1\n# ans[4] = 1\n# ans[5] = 1\nfor i in range(3, n + 1):\n for j in range(i - 2):\n ans[i] += ans[j]\n ans[i] %= m\nprint((ans[n]))\n# print(ans[:10])\n", "code_v1_no_empty_lines": "n = int(input())\nm = 10**9 + 7\n# ans = [0] * (n + 1)\nans = [0] * 2200\nans[0] = 1\n# ans[3] = 1\n# ans[4] = 1\n# ans[5] = 1\nfor i in range(3, n + 1):\n ans[i] = ans[i - 1] + ans[i - 3]\n ans[i] %= m\n # for j in range(i - 2):\n # ans[i] += ans[j]\n # ans[i] %= m\nprint((ans[n]))\n# print(ans[:10])\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["- for j in range(i - 2):", "- ans[i] += ans[j]", "- ans[i] %= m", "+ ans[i] = ans[i - 1] + ans[i - 3]", "+ ans[i] %= m", "+ # for j in range(i - 2):", "+ # ans[i] += ans[j]", "+ # ans[i] %= m"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6218082716, "measured_runtime_v1": 0.188438025, "runtime_lift": 3.2998025299, "key": ["s264986040", "s936814116"], "target_token_count_dream": 155, "target_token_bucket_dream": "128-256"} +{"user_id": "u754022296", "problem_id": "p04021", "language": "python", "submission_id_v0": "s724849949", "submission_id_v1": "s422278370", "cpu_time_v0": 219, "cpu_time_v1": 182, "memory_v0": 23552, "memory_v1": 23552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.89, "input": "import sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(input())\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n if (L[i][1]-i)%2:\n\n count += 1\n\nans = (count+1) // 2\n\nprint(ans)", "target": "import sys\n\ninput = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nn = int(input())\n\nA = list(map(int, read().split()))\n\nL = sorted([(j, i) for i, j in enumerate(A)])\n\ncount = 0\n\nfor i in range(n):\n\n count += (L[i][1]-i)%2\n\nans = (count+1) // 2\n\nprint(ans)\n", "code_v0_loc": 13, "code_v1_loc": 12, "code_v0_num_chars": 260, "code_v1_num_chars": 250, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nread = sys.stdin.read\nn = int(input())\nA = list(map(int, read().split()))\nL = sorted([(j, i) for i, j in enumerate(A)])\ncount = 0\nfor i in range(n):\n if (L[i][1] - i) % 2:\n count += 1\nans = (count + 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nread = sys.stdin.read\nn = int(input())\nA = list(map(int, read().split()))\nL = sorted([(j, i) for i, j in enumerate(A)])\ncount = 0\nfor i in range(n):\n count += (L[i][1] - i) % 2\nans = (count + 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["- if (L[i][1] - i) % 2:", "- count += 1", "+ count += (L[i][1] - i) % 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2933020202, "measured_runtime_v1": 0.2201511685, "runtime_lift": 1.3322755547, "key": ["s724849949", "s422278370"], "target_token_count_dream": 84, "target_token_bucket_dream": "<128"} +{"user_id": "u072053884", "problem_id": "p02378", "language": "python", "submission_id_v0": "s432486243", "submission_id_v1": "s242092393", "cpu_time_v0": 350, "cpu_time_v1": 120, "memory_v0": 8348, "memory_v1": 8420, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.71, "input": "# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if unvisited[v] and (r_capacity > 0):\n\n parent[v].append(u)\n\n queue.append(v)\n\n unvisited[v] = False\n\n return unvisited[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while not bfs(source, sink, parent):\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))", "target": "# Acceptance of input\n\n\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nX, Y, E = list(map(int, file_input.readline().split()))\n\n\n\nv_num = X + Y + 2\n\n\n\nadj_mat = [[0] * (v_num) for i in range(v_num)]\n\n\n\nfor line in file_input:\n\n x, y = list(map(int, line.split()))\n\n adj_mat[x][X + y] = 1\n\n\n\ns = X + Y\n\nt = s + 1\n\n\n\nfor i in range(X):\n\n adj_mat[s][i] = 1\n\n\n\nfor i in range(X, s):\n\n adj_mat[i][t] = 1\n\n\n\n# Dinic's algorithm\n\n\n\nimport collections\n\n\n\n# BFS for residual capacity network to construct level graph\n\ndef bfs(start, goal, parent):\n\n level = [v_num] * v_num\n\n unvisited = [True] * v_num\n\n queue = collections.deque()\n\n queue.append(start)\n\n level[start] = 0\n\n unvisited[start] = False\n\n while queue:\n\n u = queue.popleft()\n\n next_level = level[u] + 1\n\n for v, r_capacity in enumerate(adj_mat[u]):\n\n if (level[v] >= next_level) and (r_capacity > 0):\n\n level[v] = next_level\n\n parent[v].append(u)\n\n if unvisited[v]:\n\n queue.append(v)\n\n unvisited[v] = False\n\n return level[goal]\n\n\n\n# DFS for level graph and construct blocking flow\n\ndef dfs(goal, path, parent, blocking_flow):\n\n v = path[-1]\n\n if v == goal:\n\n aug_path_flow = 10000\n\n for x, y in zip(path[1:], path[:-1]):\n\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n\n for x, y in zip(path[1:], path[:-1]):\n\n adj_mat[x][y] -= aug_path_flow\n\n adj_mat[y][x] += aug_path_flow\n\n blocking_flow[0] += aug_path_flow\n\n else:\n\n for u in parent[v]:\n\n path.append(u)\n\n dfs(goal, path, parent, blocking_flow)\n\n path.pop()\n\n\n\ndef dinic(source, sink):\n\n max_flow = 0\n\n parent = [[] for i in range(v_num)]\n\n while bfs(source, sink, parent) != v_num:\n\n blocking_flow = [0]\n\n path = [sink]\n\n # search in reverse direction from sink\n\n dfs(source, path, parent, blocking_flow)\n\n max_flow += blocking_flow[0]\n\n parent = [[] for i in range(v_num)]\n\n return max_flow\n\n\n\n# output\n\nprint((dinic(s, t)))", "code_v0_loc": 75, "code_v1_loc": 80, "code_v0_num_chars": 1953, "code_v1_num_chars": 2133, "code_v0_no_empty_lines": "# Acceptance of input\nimport sys\n\nfile_input = sys.stdin\nX, Y, E = list(map(int, file_input.readline().split()))\nv_num = X + Y + 2\nadj_mat = [[0] * (v_num) for i in range(v_num)]\nfor line in file_input:\n x, y = list(map(int, line.split()))\n adj_mat[x][X + y] = 1\ns = X + Y\nt = s + 1\nfor i in range(X):\n adj_mat[s][i] = 1\nfor i in range(X, s):\n adj_mat[i][t] = 1\n# Dinic's algorithm\nimport collections\n\n# BFS for residual capacity network to construct level graph\ndef bfs(start, goal, parent):\n unvisited = [True] * v_num\n queue = collections.deque()\n queue.append(start)\n unvisited[start] = False\n while queue:\n u = queue.popleft()\n for v, r_capacity in enumerate(adj_mat[u]):\n if unvisited[v] and (r_capacity > 0):\n parent[v].append(u)\n queue.append(v)\n unvisited[v] = False\n return unvisited[goal]\n\n\n# DFS for level graph and construct blocking flow\ndef dfs(goal, path, parent, blocking_flow):\n v = path[-1]\n if v == goal:\n aug_path_flow = 10000\n for x, y in zip(path[1:], path[:-1]):\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n for x, y in zip(path[1:], path[:-1]):\n adj_mat[x][y] -= aug_path_flow\n adj_mat[y][x] += aug_path_flow\n blocking_flow[0] += aug_path_flow\n else:\n for u in parent[v]:\n path.append(u)\n dfs(goal, path, parent, blocking_flow)\n path.pop()\n\n\ndef dinic(source, sink):\n max_flow = 0\n parent = [[] for i in range(v_num)]\n while not bfs(source, sink, parent):\n blocking_flow = [0]\n path = [sink]\n # search in reverse direction from sink\n dfs(source, path, parent, blocking_flow)\n max_flow += blocking_flow[0]\n parent = [[] for i in range(v_num)]\n return max_flow\n\n\n# output\nprint((dinic(s, t)))\n", "code_v1_no_empty_lines": "# Acceptance of input\nimport sys\n\nfile_input = sys.stdin\nX, Y, E = list(map(int, file_input.readline().split()))\nv_num = X + Y + 2\nadj_mat = [[0] * (v_num) for i in range(v_num)]\nfor line in file_input:\n x, y = list(map(int, line.split()))\n adj_mat[x][X + y] = 1\ns = X + Y\nt = s + 1\nfor i in range(X):\n adj_mat[s][i] = 1\nfor i in range(X, s):\n adj_mat[i][t] = 1\n# Dinic's algorithm\nimport collections\n\n# BFS for residual capacity network to construct level graph\ndef bfs(start, goal, parent):\n level = [v_num] * v_num\n unvisited = [True] * v_num\n queue = collections.deque()\n queue.append(start)\n level[start] = 0\n unvisited[start] = False\n while queue:\n u = queue.popleft()\n next_level = level[u] + 1\n for v, r_capacity in enumerate(adj_mat[u]):\n if (level[v] >= next_level) and (r_capacity > 0):\n level[v] = next_level\n parent[v].append(u)\n if unvisited[v]:\n queue.append(v)\n unvisited[v] = False\n return level[goal]\n\n\n# DFS for level graph and construct blocking flow\ndef dfs(goal, path, parent, blocking_flow):\n v = path[-1]\n if v == goal:\n aug_path_flow = 10000\n for x, y in zip(path[1:], path[:-1]):\n aug_path_flow = min(aug_path_flow, adj_mat[x][y])\n for x, y in zip(path[1:], path[:-1]):\n adj_mat[x][y] -= aug_path_flow\n adj_mat[y][x] += aug_path_flow\n blocking_flow[0] += aug_path_flow\n else:\n for u in parent[v]:\n path.append(u)\n dfs(goal, path, parent, blocking_flow)\n path.pop()\n\n\ndef dinic(source, sink):\n max_flow = 0\n parent = [[] for i in range(v_num)]\n while bfs(source, sink, parent) != v_num:\n blocking_flow = [0]\n path = [sink]\n # search in reverse direction from sink\n dfs(source, path, parent, blocking_flow)\n max_flow += blocking_flow[0]\n parent = [[] for i in range(v_num)]\n return max_flow\n\n\n# output\nprint((dinic(s, t)))\n", "code_same": false, "relative_loc_diff_percent": 6.25, "diff": ["+ level = [v_num] * v_num", "+ level[start] = 0", "+ next_level = level[u] + 1", "- if unvisited[v] and (r_capacity > 0):", "+ if (level[v] >= next_level) and (r_capacity > 0):", "+ level[v] = next_level", "- queue.append(v)", "- unvisited[v] = False", "- return unvisited[goal]", "+ if unvisited[v]:", "+ queue.append(v)", "+ unvisited[v] = False", "+ return level[goal]", "- while not bfs(source, sink, parent):", "+ while bfs(source, sink, parent) != v_num:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2959556043, "measured_runtime_v1": 0.2352844019, "runtime_lift": 1.2578632579, "key": ["s432486243", "s242092393"], "target_token_count_dream": 579, "target_token_bucket_dream": "512-1024"} +{"user_id": "u285891772", "problem_id": "p02837", "language": "python", "submission_id_v0": "s234390283", "submission_id_v1": "s698943579", "cpu_time_v0": 281, "cpu_time_v1": 125, "memory_v0": 5204, "memory_v1": 5964, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.52, "input": "import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom math import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\nfrom decimal import Decimal\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\nfrom decimal import *\n\n\n\nN = INT()\n\nxy = []\n\n\n\nfor i in range(N):\n\n\tA = INT()\n\n\txy.append([LIST() for _ in range(A)])\n\n\n\nans = 0\n\nfor i in range(1<= K - 1:\n\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\n\n \n\nprint(ans)\n", "target": "from collections import defaultdict\n\n\n\nN, K, *A = list(map(int, open(0).read().split()))\n\n\n\nx = [0] * (N + 1)\n\nfor i in range(N):\n\n x[i + 1] = x[i] + A[i]\n\n \n\ny = [(x[i] - i) % K for i in range(N + 1)]\n\n\n\nctr = defaultdict(int)\n\nans = 0\n\nfor j in range(N + 1):\n\n ans += ctr[y[j]]\n\n ctr[y[j]] += 1\n\n if j - K + 1 >= 0:\n\n ctr[y[j - K + 1]] -= 1\n\nprint(ans)\n", "code_v0_loc": 18, "code_v1_loc": 18, "code_v0_num_chars": 357, "code_v1_num_chars": 371, "code_v0_no_empty_lines": "from collections import defaultdict\n\nN, K, *A = list(map(int, open(0).read().split()))\nS = [0] * (N + 1)\nfor i in range(N):\n S[i + 1] = S[i] + A[i]\nd = defaultdict(int)\nans = 0\nfor j in range(N + 1):\n v = (S[j] - j) % K\n ans += d[v]\n d[v] += 1\n if j >= K - 1:\n d[(S[j - K + 1] - (j - K + 1)) % K] -= 1\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nN, K, *A = list(map(int, open(0).read().split()))\nx = [0] * (N + 1)\nfor i in range(N):\n x[i + 1] = x[i] + A[i]\ny = [(x[i] - i) % K for i in range(N + 1)]\nctr = defaultdict(int)\nans = 0\nfor j in range(N + 1):\n ans += ctr[y[j]]\n ctr[y[j]] += 1\n if j - K + 1 >= 0:\n ctr[y[j - K + 1]] -= 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-S = [0] * (N + 1)", "+x = [0] * (N + 1)", "- S[i + 1] = S[i] + A[i]", "-d = defaultdict(int)", "+ x[i + 1] = x[i] + A[i]", "+y = [(x[i] - i) % K for i in range(N + 1)]", "+ctr = defaultdict(int)", "- v = (S[j] - j) % K", "- ans += d[v]", "- d[v] += 1", "- if j >= K - 1:", "- d[(S[j - K + 1] - (j - K + 1)) % K] -= 1", "+ ans += ctr[y[j]]", "+ ctr[y[j]] += 1", "+ if j - K + 1 >= 0:", "+ ctr[y[j - K + 1]] -= 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2436300242, "measured_runtime_v1": 0.1409657106, "runtime_lift": 1.7282928102, "key": ["s203769987", "s522861811"], "target_token_count_dream": 144, "target_token_bucket_dream": "128-256"} +{"user_id": "u576432509", "problem_id": "p02767", "language": "python", "submission_id_v0": "s320006452", "submission_id_v1": "s025352649", "cpu_time_v0": 403, "cpu_time_v1": 21, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 94.79, "input": "n=int(input())\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\nfor p in range(x[0],x[len(x)-1]+1):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\n pmin=psum \n\n for j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) ", "target": "n=int(input())\n\nx=list(map(int,input().split()))\n\n\n\nx.sort()\n\n\n\npsum=0\n\nfor i in range(len(x)):\n\n psum=psum+(x[0]-x[i])**2\n\n# print(psum)\n\npmin=psum \n\nfor j in range(x[0]+1,x[len(x)-1]):\n\n psum=0\n\n for i in range(len(x)):\n\n psum=psum+(j-x[i])**2\n\n# print(psum)\n\n if pmin>psum:\n\n pmin=psum\n\nprint(pmin) \n", "code_v0_loc": 19, "code_v1_loc": 18, "code_v0_num_chars": 421, "code_v1_num_chars": 353, "code_v0_no_empty_lines": "n = int(input())\nx = list(map(int, input().split()))\nx.sort()\nfor p in range(x[0], x[len(x) - 1] + 1):\n psum = 0\n for i in range(len(x)):\n psum = psum + (x[0] - x[i]) ** 2\n # print(psum)\n pmin = psum\n for j in range(x[0] + 1, x[len(x) - 1]):\n psum = 0\n for i in range(len(x)):\n psum = psum + (j - x[i]) ** 2\n # print(psum)\n if pmin > psum:\n pmin = psum\nprint(pmin)\n", "code_v1_no_empty_lines": "n = int(input())\nx = list(map(int, input().split()))\nx.sort()\npsum = 0\nfor i in range(len(x)):\n psum = psum + (x[0] - x[i]) ** 2\n# print(psum)\npmin = psum\nfor j in range(x[0] + 1, x[len(x) - 1]):\n psum = 0\n for i in range(len(x)):\n psum = psum + (j - x[i]) ** 2\n # print(psum)\n if pmin > psum:\n pmin = psum\nprint(pmin)\n", "code_same": false, "relative_loc_diff_percent": 5.2631578947, "diff": ["-for p in range(x[0], x[len(x) - 1] + 1):", "+psum = 0", "+for i in range(len(x)):", "+ psum = psum + (x[0] - x[i]) ** 2", "+# print(psum)", "+pmin = psum", "+for j in range(x[0] + 1, x[len(x) - 1]):", "- psum = psum + (x[0] - x[i]) ** 2", "- # print(psum)", "- pmin = psum", "- for j in range(x[0] + 1, x[len(x) - 1]):", "- psum = 0", "- for i in range(len(x)):", "- psum = psum + (j - x[i]) ** 2", "- # print(psum)", "- if pmin > psum:", "- pmin = psum", "+ psum = psum + (j - x[i]) ** 2", "+ # print(psum)", "+ if pmin > psum:", "+ pmin = psum"], "diff_only_import_comment": false, "measured_runtime_v0": 0.298344056, "measured_runtime_v1": 0.1876089347, "runtime_lift": 1.59024439, "key": ["s320006452", "s025352649"], "target_token_count_dream": 122, "target_token_bucket_dream": "<128"} +{"user_id": "u438662618", "problem_id": "p03086", "language": "python", "submission_id_v0": "s956521892", "submission_id_v1": "s325345686", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "import re\n\n\n\nS = input()\n\nmax = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i + 1, len(S) + 1) :\n\n pattern = re.compile(r'[A|T|C|G]{%d}' % int(j - i))\n\n subStr = S[i:j]\n\n\n\n if pattern.match(subStr) and j - i > max :\n\n max = j - i\n\n\n\nprint(max)\n", "target": "S = input()\n\n\n\nans = 0\n\n\n\nfor i in range(len(S)) :\n\n for j in range(i, len(S)) :\n\n if all('ACGT'.count(c) == 1 for c in S[i : j + 1]) :\n\n ans = max(ans, j - i + 1)\n\n\n\n\n\nprint(ans)\n", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 282, "code_v1_num_chars": 201, "code_v0_no_empty_lines": "import re\n\nS = input()\nmax = 0\nfor i in range(len(S)):\n for j in range(i + 1, len(S) + 1):\n pattern = re.compile(r\"[A|T|C|G]{%d}\" % int(j - i))\n subStr = S[i:j]\n if pattern.match(subStr) and j - i > max:\n max = j - i\nprint(max)\n", "code_v1_no_empty_lines": "S = input()\nans = 0\nfor i in range(len(S)):\n for j in range(i, len(S)):\n if all(\"ACGT\".count(c) == 1 for c in S[i : j + 1]):\n ans = max(ans, j - i + 1)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-import re", "-", "-max = 0", "+ans = 0", "- for j in range(i + 1, len(S) + 1):", "- pattern = re.compile(r\"[A|T|C|G]{%d}\" % int(j - i))", "- subStr = S[i:j]", "- if pattern.match(subStr) and j - i > max:", "- max = j - i", "-print(max)", "+ for j in range(i, len(S)):", "+ if all(\"ACGT\".count(c) == 1 for c in S[i : j + 1]):", "+ ans = max(ans, j - i + 1)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3271781678, "measured_runtime_v1": 0.2537176473, "runtime_lift": 1.2895365036, "key": ["s956521892", "s325345686"], "target_token_count_dream": 69, "target_token_bucket_dream": "<128"} +{"user_id": "u207097826", "problem_id": "p02792", "language": "python", "submission_id_v0": "s736173164", "submission_id_v1": "s628306332", "cpu_time_v0": 499, "cpu_time_v1": 86, "memory_v0": 3064, "memory_v1": 68180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.77, "input": "import itertools\n\nN = int(input())\n\nNketa = len(str(N))\n\n\n\nrange_count = [[0 for j in range(10)]for i in range(10)]\n\n\n\n\n\nfor p in range(1,N+1):\n\n mae = int(str(p)[0])\n\n ato = int(str(p)[-1])\n\n range_count[mae][ato] += 1\n\n\n\n \n\n\n\ncount = 0\n\nfor j in range(1,N+1):\n\n a_mae = int(str(j)[0])\n\n a_ato = int(str(j)[-1])\n\n \n\n b_mae = a_ato\n\n b_ato = a_mae\n\n \n\n if b_mae == 0:\n\n continue\n\n else:\n\n count += range_count[b_mae][b_ato]\n\nprint(count)\n\n ", "target": "n = int(input())\n\n\n\nall_count = 0\n\noptions = [str(i) for i in range(10)]\n\n\n\nmaeato = [[0 for i in range(10)] for j in range(10)]\n\n\n\nfor i in range(n+1):\n\n checking = str(i)\n\n maeato[int(checking[0])][int(checking[-1])]+=1\n\nall_count = 0\n\nfor i in range(1,10):\n\n for j in range(1,10):\n\n for k in range(1,10):\n\n for p in range(1,10):\n\n if i == p and j == k:\n\n all_count+=maeato[i][j]*maeato[k][p]\n\nprint(all_count)", "code_v0_loc": 28, "code_v1_loc": 18, "code_v0_num_chars": 491, "code_v1_num_chars": 473, "code_v0_no_empty_lines": "import itertools\n\nN = int(input())\nNketa = len(str(N))\nrange_count = [[0 for j in range(10)] for i in range(10)]\nfor p in range(1, N + 1):\n mae = int(str(p)[0])\n ato = int(str(p)[-1])\n range_count[mae][ato] += 1\ncount = 0\nfor j in range(1, N + 1):\n a_mae = int(str(j)[0])\n a_ato = int(str(j)[-1])\n b_mae = a_ato\n b_ato = a_mae\n if b_mae == 0:\n continue\n else:\n count += range_count[b_mae][b_ato]\nprint(count)\n", "code_v1_no_empty_lines": "n = int(input())\nall_count = 0\noptions = [str(i) for i in range(10)]\nmaeato = [[0 for i in range(10)] for j in range(10)]\nfor i in range(n + 1):\n checking = str(i)\n maeato[int(checking[0])][int(checking[-1])] += 1\nall_count = 0\nfor i in range(1, 10):\n for j in range(1, 10):\n for k in range(1, 10):\n for p in range(1, 10):\n if i == p and j == k:\n all_count += maeato[i][j] * maeato[k][p]\nprint(all_count)\n", "code_same": false, "relative_loc_diff_percent": 35.7142857143, "diff": ["-import itertools", "-", "-N = int(input())", "-Nketa = len(str(N))", "-range_count = [[0 for j in range(10)] for i in range(10)]", "-for p in range(1, N + 1):", "- mae = int(str(p)[0])", "- ato = int(str(p)[-1])", "- range_count[mae][ato] += 1", "-count = 0", "-for j in range(1, N + 1):", "- a_mae = int(str(j)[0])", "- a_ato = int(str(j)[-1])", "- b_mae = a_ato", "- b_ato = a_mae", "- if b_mae == 0:", "- continue", "- else:", "- count += range_count[b_mae][b_ato]", "-print(count)", "+n = int(input())", "+all_count = 0", "+options = [str(i) for i in range(10)]", "+maeato = [[0 for i in range(10)] for j in range(10)]", "+for i in range(n + 1):", "+ checking = str(i)", "+ maeato[int(checking[0])][int(checking[-1])] += 1", "+all_count = 0", "+for i in range(1, 10):", "+ for j in range(1, 10):", "+ for k in range(1, 10):", "+ for p in range(1, 10):", "+ if i == p and j == k:", "+ all_count += maeato[i][j] * maeato[k][p]", "+print(all_count)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5609512657, "measured_runtime_v1": 0.4347667047, "runtime_lift": 1.2902351069, "key": ["s736173164", "s628306332"], "target_token_count_dream": 165, "target_token_bucket_dream": "128-256"} +{"user_id": "u379136995", "problem_id": "p02921", "language": "python", "submission_id_v0": "s545345968", "submission_id_v1": "s346622706", "cpu_time_v0": 27, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.04, "input": "s=input()\n\nt=input()\n\nans=0\n\nif s[0]==t[0]:\n\n ans+=1\n\nif s[1]==t[1]:\n\n ans+=1\n\nif s[2]==t[2]:\n\n ans+=1\n\nprint(ans)\n", "target": "s=input()\n\nt=input()\n\nans=0\n\nfor i in range(0,3):\n\n if s[i]==t[i]:\n\n ans+=1\n\nprint(ans)\n", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 124, "code_v1_num_chars": 98, "code_v0_no_empty_lines": "s = input()\nt = input()\nans = 0\nif s[0] == t[0]:\n ans += 1\nif s[1] == t[1]:\n ans += 1\nif s[2] == t[2]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "s = input()\nt = input()\nans = 0\nfor i in range(0, 3):\n if s[i] == t[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-if s[0] == t[0]:", "- ans += 1", "-if s[1] == t[1]:", "- ans += 1", "-if s[2] == t[2]:", "- ans += 1", "+for i in range(0, 3):", "+ if s[i] == t[i]:", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3561623907, "measured_runtime_v1": 0.2681128595, "runtime_lift": 1.3284047299, "key": ["s545345968", "s346622706"], "target_token_count_dream": 35, "target_token_bucket_dream": "<128"} +{"user_id": "u263753244", "problem_id": "p03835", "language": "python", "submission_id_v0": "s871403539", "submission_id_v1": "s899034376", "cpu_time_v0": 1228, "cpu_time_v1": 261, "memory_v0": 2940, "memory_v1": 42092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.75, "input": "k,s=list(map(int,input().split()))\n\ncnt=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0 <= s-i-j <= k:\n\n cnt+=1\n\nprint(cnt)", "target": "k,s=list(map(int,input().split()))\n\na=0\n\nfor i in range(0,k+1):\n\n for j in range(0,k+1):\n\n if 0<=s-i-j<=k:\n\n a+=1\n\nprint(a)", "code_v0_loc": 7, "code_v1_loc": 7, "code_v0_num_chars": 144, "code_v1_num_chars": 138, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\na = 0\nfor i in range(0, k + 1):\n for j in range(0, k + 1):\n if 0 <= s - i - j <= k:\n a += 1\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-cnt = 0", "-for i in range(k + 1):", "- for j in range(k + 1):", "+a = 0", "+for i in range(0, k + 1):", "+ for j in range(0, k + 1):", "- cnt += 1", "-print(cnt)", "+ a += 1", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2440719529, "measured_runtime_v1": 0.12879462, "runtime_lift": 1.8950477354, "key": ["s871403539", "s899034376"], "target_token_count_dream": 53, "target_token_bucket_dream": "<128"} +{"user_id": "u457901067", "problem_id": "p02814", "language": "python", "submission_id_v0": "s285073705", "submission_id_v1": "s453740847", "cpu_time_v0": 523, "cpu_time_v1": 158, "memory_v0": 21860, "memory_v1": 97668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 69.79, "input": "from math import gcd\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a // 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x // pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b//gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M // x + 1) // 2))", "target": "N, M = list(map(int, input().split()))\n\nA = list([int(x) for x in input().split()])\n\n\n\ncnt = [0 for _ in range(N)]\n\nfor i in range(N):\n\n a = A[i]\n\n while a%2 == 0:\n\n a = a // 2\n\n cnt[i] += 1\n\n\n\nif max(cnt) > min(cnt):\n\n print((0))\n\n exit(0)\n\nC = max(cnt)\n\n\n\nA = list([x // pow(2,C) for x in A])\n\ndef gcd(a,b):\n\n if a 0:\n\n a,b = b,a%b\n\n return b\n\n\n\ndef lcm(a,b):\n\n return a*b//gcd(a,b)\n\n\n\nx = A[0]\n\nfor a in A[1:]:\n\n x = lcm(x,a)\n\nx = x * pow(2,C-1)\n\n\n\nprint(((M // x + 1) // 2))", "code_v0_loc": 33, "code_v1_loc": 32, "code_v0_num_chars": 560, "code_v1_num_chars": 533, "code_v0_no_empty_lines": "from math import gcd\n\nN, M = list(map(int, input().split()))\nA = list([int(x) for x in input().split()])\ncnt = [0 for _ in range(N)]\nfor i in range(N):\n a = A[i]\n while a % 2 == 0:\n a = a // 2\n cnt[i] += 1\nif max(cnt) > min(cnt):\n print((0))\n exit(0)\nC = max(cnt)\nA = list([x // pow(2, C) for x in A])\n\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n while a % b > 0:\n a, b = b, a % b\n return b\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\nx = A[0]\nfor a in A[1:]:\n x = lcm(x, a)\nx = x * pow(2, C - 1)\nprint(((M // x + 1) // 2))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nA = list([int(x) for x in input().split()])\ncnt = [0 for _ in range(N)]\nfor i in range(N):\n a = A[i]\n while a % 2 == 0:\n a = a // 2\n cnt[i] += 1\nif max(cnt) > min(cnt):\n print((0))\n exit(0)\nC = max(cnt)\nA = list([x // pow(2, C) for x in A])\n\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n while a % b > 0:\n a, b = b, a % b\n return b\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\nx = A[0]\nfor a in A[1:]:\n x = lcm(x, a)\nx = x * pow(2, C - 1)\nprint(((M // x + 1) // 2))\n", "code_same": false, "relative_loc_diff_percent": 3.0303030303, "diff": ["-from math import gcd", "-"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2484916873, "measured_runtime_v1": 0.192324806, "runtime_lift": 1.2920417937, "key": ["s285073705", "s453740847"], "target_token_count_dream": 212, "target_token_bucket_dream": "128-256"} +{"user_id": "u027685417", "problem_id": "p03038", "language": "python", "submission_id_v0": "s124992398", "submission_id_v1": "s099446399", "cpu_time_v0": 678, "cpu_time_v1": 544, "memory_v0": 33104, "memory_v1": 28888, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.76, "input": "from heapq import *\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nPAIRS = [[-a, -1] for a in map(int, input().split())]\n\nheapify(PAIRS)\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n heappush(PAIRS, [-c, -b])\n\n\n\nanswer = 0\n\nfor _ in range(n):\n\n pair = heappop(PAIRS)\n\n answer += -pair[0]\n\n pair[1] += 1\n\n if pair[1] != 0:\n\n heappush(PAIRS, pair)\n\n\n\nprint(answer)\n", "target": "n, m = list(map(int, input().split()))\n\nPAIRS = [(a, 1) for a in map(int, input().split())]\n\n\n\nfor _ in range(m):\n\n b, c = list(map(int, input().split()))\n\n PAIRS.append((c, b))\n\nPAIRS.sort(reverse = True)\n\n\n\nanswer, count = 0, 0\n\nfor pair in PAIRS:\n\n answer += pair[0] * pair[1]\n\n count += pair[1]\n\n if count > n:\n\n answer -= pair[0] * (count - n)\n\n break\n\n\n\nprint(answer)\n", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 393, "code_v1_num_chars": 391, "code_v0_no_empty_lines": "from heapq import *\n\nn, m = list(map(int, input().split()))\nPAIRS = [[-a, -1] for a in map(int, input().split())]\nheapify(PAIRS)\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n heappush(PAIRS, [-c, -b])\nanswer = 0\nfor _ in range(n):\n pair = heappop(PAIRS)\n answer += -pair[0]\n pair[1] += 1\n if pair[1] != 0:\n heappush(PAIRS, pair)\nprint(answer)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nPAIRS = [(a, 1) for a in map(int, input().split())]\nfor _ in range(m):\n b, c = list(map(int, input().split()))\n PAIRS.append((c, b))\nPAIRS.sort(reverse=True)\nanswer, count = 0, 0\nfor pair in PAIRS:\n answer += pair[0] * pair[1]\n count += pair[1]\n if count > n:\n answer -= pair[0] * (count - n)\n break\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["-from heapq import *", "-", "-PAIRS = [[-a, -1] for a in map(int, input().split())]", "-heapify(PAIRS)", "+PAIRS = [(a, 1) for a in map(int, input().split())]", "- heappush(PAIRS, [-c, -b])", "-answer = 0", "-for _ in range(n):", "- pair = heappop(PAIRS)", "- answer += -pair[0]", "- pair[1] += 1", "- if pair[1] != 0:", "- heappush(PAIRS, pair)", "+ PAIRS.append((c, b))", "+PAIRS.sort(reverse=True)", "+answer, count = 0, 0", "+for pair in PAIRS:", "+ answer += pair[0] * pair[1]", "+ count += pair[1]", "+ if count > n:", "+ answer -= pair[0] * (count - n)", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2969929054, "measured_runtime_v1": 0.0828762929, "runtime_lift": 3.5835688928, "key": ["s124992398", "s099446399"], "target_token_count_dream": 127, "target_token_bucket_dream": "<128"} +{"user_id": "u803617136", "problem_id": "p03796", "language": "python", "submission_id_v0": "s262574211", "submission_id_v1": "s998310124", "cpu_time_v0": 230, "cpu_time_v1": 37, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.91, "input": "import math\n\n\n\nn = int(input())\n\nans = math.factorial(n) % (pow(10, 9) + 7)\n\nprint(ans)", "target": "n = int(input())\n\nans = 1\n\nmod = 10 ** 9 + 7\n\nfor i in range(1, n + 1):\n\n ans = (ans * i % mod) % mod\n\nprint(ans)", "code_v0_loc": 5, "code_v1_loc": 6, "code_v0_num_chars": 87, "code_v1_num_chars": 116, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nans = math.factorial(n) % (pow(10, 9) + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nmod = 10**9 + 7\nfor i in range(1, n + 1):\n ans = (ans * i % mod) % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-import math", "-", "-ans = math.factorial(n) % (pow(10, 9) + 7)", "+ans = 1", "+mod = 10**9 + 7", "+for i in range(1, n + 1):", "+ ans = (ans * i % mod) % mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5572224624, "measured_runtime_v1": 0.2586410534, "runtime_lift": 2.154423882, "key": ["s262574211", "s998310124"], "target_token_count_dream": 50, "target_token_bucket_dream": "<128"} +{"user_id": "u991567869", "problem_id": "p02596", "language": "python", "submission_id_v0": "s146225899", "submission_id_v1": "s204753661", "cpu_time_v0": 292, "cpu_time_v1": 175, "memory_v0": 9152, "memory_v1": 9164, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.07, "input": "k = int(input())\n\nx = 1\n\n\n\nif k%7 != 0:\n\n mod = 9*k\n\nelse:\n\n mod = 9*k//7\n\n\n\nfor i in range(10**6):\n\n x = x*10%mod\n\n if x == 1:\n\n print((i + 1))\n\n exit()\n\n\n\nprint((-1))", "target": "k = int(input())\n\na = 0\n\n\n\nfor i in range(k + 10):\n\n a = (a*10 + 7)%k\n\n if a == 0:\n\n print((i + 1))\n\n exit()\n\nprint((-1))", "code_v0_loc": 15, "code_v1_loc": 9, "code_v0_num_chars": 190, "code_v1_num_chars": 137, "code_v0_no_empty_lines": "k = int(input())\nx = 1\nif k % 7 != 0:\n mod = 9 * k\nelse:\n mod = 9 * k // 7\nfor i in range(10**6):\n x = x * 10 % mod\n if x == 1:\n print((i + 1))\n exit()\nprint((-1))\n", "code_v1_no_empty_lines": "k = int(input())\na = 0\nfor i in range(k + 10):\n a = (a * 10 + 7) % k\n if a == 0:\n print((i + 1))\n exit()\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-x = 1", "-if k % 7 != 0:", "- mod = 9 * k", "-else:", "- mod = 9 * k // 7", "-for i in range(10**6):", "- x = x * 10 % mod", "- if x == 1:", "+a = 0", "+for i in range(k + 10):", "+ a = (a * 10 + 7) % k", "+ if a == 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5332653046, "measured_runtime_v1": 0.4200988929, "runtime_lift": 1.2693804091, "key": ["s146225899", "s204753661"], "target_token_count_dream": 56, "target_token_bucket_dream": "<128"} +{"user_id": "u562935282", "problem_id": "p03200", "language": "python", "submission_id_v0": "s639682353", "submission_id_v1": "s546135650", "cpu_time_v0": 48, "cpu_time_v1": 43, "memory_v0": 3500, "memory_v1": 3500, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.42, "input": "s = input()\n\n\n\ncnt = 0\n\nans = 0\n\nfor c in s:\n\n if c == 'B':\n\n cnt += 1\n\n elif c == 'W':\n\n ans += cnt\n\nprint(ans)\n", "target": "s = input()\n\n\n\nans = 0\n\nb = 0\n\nfor ss in s:\n\n if ss == 'W':\n\n ans += b\n\n else:\n\n b += 1\n\nprint(ans)\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 133, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "s = input()\ncnt = 0\nans = 0\nfor c in s:\n if c == \"B\":\n cnt += 1\n elif c == \"W\":\n ans += cnt\nprint(ans)\n", "code_v1_no_empty_lines": "s = input()\nans = 0\nb = 0\nfor ss in s:\n if ss == \"W\":\n ans += b\n else:\n b += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-cnt = 0", "-for c in s:", "- if c == \"B\":", "- cnt += 1", "- elif c == \"W\":", "- ans += cnt", "+b = 0", "+for ss in s:", "+ if ss == \"W\":", "+ ans += b", "+ else:", "+ b += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2094221431, "measured_runtime_v1": 0.1051600281, "runtime_lift": 1.9914614603, "key": ["s639682353", "s546135650"], "target_token_count_dream": 43, "target_token_bucket_dream": "<128"} +{"user_id": "u744114948", "problem_id": "p00053", "language": "python", "submission_id_v0": "s391855332", "submission_id_v1": "s612183692", "cpu_time_v0": 660, "cpu_time_v1": 70, "memory_v0": 7228, "memory_v1": 8024, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 89.39, "input": "import math\n\ndef pri(n):\n\n if n < 2:\n\n return False\n\n elif n == 2:\n\n return True\n\n elif n % 2 == 0:\n\n return False\n\n\n\n i = 3\n\n while i <= math.sqrt(n):\n\n if n % i == 0:\n\n return False\n\n i += 2\n\n return True\n\n\n\nl=[i for i in range(110000)if pri(i) ]\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0: break\n\n print((sum(l[:n])))", "target": "import math\n\ndef pri(n):\n\n l =[True] * n\n\n l[0] = l[1] = False\n\n for i in range(2,n):\n\n if l[i]:\n\n for j in range(i*2, n, i):\n\n l[j] = False\n\n return l\n\nn=105000\n\ns=pri(n)\n\nl=[i for i in range(n) if s[i]]\n\nwhile True:\n\n n = int(input())\n\n if n == 0: break\n\n print((sum(l[:n])))", "code_v0_loc": 22, "code_v1_loc": 16, "code_v0_num_chars": 394, "code_v1_num_chars": 329, "code_v0_no_empty_lines": "import math\n\n\ndef pri(n):\n if n < 2:\n return False\n elif n == 2:\n return True\n elif n % 2 == 0:\n return False\n i = 3\n while i <= math.sqrt(n):\n if n % i == 0:\n return False\n i += 2\n return True\n\n\nl = [i for i in range(110000) if pri(i)]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(l[:n])))\n", "code_v1_no_empty_lines": "import math\n\n\ndef pri(n):\n l = [True] * n\n l[0] = l[1] = False\n for i in range(2, n):\n if l[i]:\n for j in range(i * 2, n, i):\n l[j] = False\n return l\n\n\nn = 105000\ns = pri(n)\nl = [i for i in range(n) if s[i]]\nwhile True:\n n = int(input())\n if n == 0:\n break\n print((sum(l[:n])))\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["- if n < 2:", "- return False", "- elif n == 2:", "- return True", "- elif n % 2 == 0:", "- return False", "- i = 3", "- while i <= math.sqrt(n):", "- if n % i == 0:", "- return False", "- i += 2", "- return True", "+ l = [True] * n", "+ l[0] = l[1] = False", "+ for i in range(2, n):", "+ if l[i]:", "+ for j in range(i * 2, n, i):", "+ l[j] = False", "+ return l", "-l = [i for i in range(110000) if pri(i)]", "+n = 105000", "+s = pri(n)", "+l = [i for i in range(n) if s[i]]"], "diff_only_import_comment": false, "measured_runtime_v0": 2.8203961465, "measured_runtime_v1": 0.4705428715, "runtime_lift": 5.9939196138, "key": ["s391855332", "s612183692"], "target_token_count_dream": 119, "target_token_bucket_dream": "<128"} +{"user_id": "u133936772", "problem_id": "p02988", "language": "python", "submission_id_v0": "s657683547", "submission_id_v1": "s740427744", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "n = int(input())\n\nl = list(map(int, input().split()))\n\nprint((sum(l[i]l[i+1]>l[i+2] for i in range(n-2))))", "target": "n=int(input())\n\nl=list(map(int,input().split()))\n\na=0\n\nfor i in range(n-2):\n\n p,q,r=l[i:i+3]\n\n if p l[i + 1] > l[i + 2]\n for i in range(n - 2)\n )\n )\n)\n", "code_v1_no_empty_lines": "n = int(input())\nl = list(map(int, input().split()))\na = 0\nfor i in range(n - 2):\n p, q, r = l[i : i + 3]\n if p < q < r or r < q < p:\n a += 1\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-print(", "- (", "- sum(", "- l[i] < l[i + 1] < l[i + 2] or l[i] > l[i + 1] > l[i + 2]", "- for i in range(n - 2)", "- )", "- )", "-)", "+a = 0", "+for i in range(n - 2):", "+ p, q, r = l[i : i + 3]", "+ if p < q < r or r < q < p:", "+ a += 1", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1639216754, "measured_runtime_v1": 0.0058678908, "runtime_lift": 27.9353658749, "key": ["s657683547", "s740427744"], "target_token_count_dream": 53, "target_token_bucket_dream": "<128"} +{"user_id": "u813098295", "problem_id": "p03363", "language": "python", "submission_id_v0": "s373502740", "submission_id_v1": "s912924761", "cpu_time_v0": 217, "cpu_time_v1": 194, "memory_v0": 31620, "memory_v1": 45788, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.6, "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\n\n\nans, s = 0, 0\n\nd = {0:1}\n\n\n\nfor i in A:\n\n s += i\n\n ans += d.get(s, 0)\n\n d[s] = d.get(s, 0) + 1\n\n\n\nprint(ans)", "target": "#!/usr/bin/env python3\n\n\n\nfrom collections import defaultdict\n\n\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\n\n\nd = defaultdict(int)\n\nd[0] = 1\n\n\n\ns, ans = 0, 0\n\n\n\nfor a in A:\n\n s += a\n\n ans += d[s]\n\n d[s] += 1\n\n\n\nprint (ans)", "code_v0_loc": 12, "code_v1_loc": 18, "code_v0_num_chars": 175, "code_v1_num_chars": 237, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nans, s = 0, 0\nd = {0: 1}\nfor i in A:\n s += i\n ans += d.get(s, 0)\n d[s] = d.get(s, 0) + 1\nprint(ans)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nfrom collections import defaultdict\n\nN = int(input())\nA = list(map(int, input().split()))\nd = defaultdict(int)\nd[0] = 1\ns, ans = 0, 0\nfor a in A:\n s += a\n ans += d[s]\n d[s] += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-N = int(input())", "+#!/usr/bin/env python3", "+from collections import defaultdict", "+", "+N = int(input())", "-ans, s = 0, 0", "-d = {0: 1}", "-for i in A:", "- s += i", "- ans += d.get(s, 0)", "- d[s] = d.get(s, 0) + 1", "+d = defaultdict(int)", "+d[0] = 1", "+s, ans = 0, 0", "+for a in A:", "+ s += a", "+ ans += d[s]", "+ d[s] += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2992557037, "measured_runtime_v1": 0.2235582159, "runtime_lift": 1.3386030235, "key": ["s373502740", "s912924761"], "target_token_count_dream": 79, "target_token_bucket_dream": "<128"} +{"user_id": "u120865944", "problem_id": "p03162", "language": "python", "submission_id_v0": "s595235842", "submission_id_v1": "s886147212", "cpu_time_v0": 1019, "cpu_time_v1": 680, "memory_v0": 47328, "memory_v1": 59484, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.27, "input": "N = int(input())\n\nl = [list(map(int, input().split())) for _ in range(N)]\n\n\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\n\n\nfor i in range(1, N+1):\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k]+l[i-1][k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n\n\n", "target": "N = int(input())\n\ndp = [[0 for i in range(3)] for j in range(N+1)]\n\n\n\nfor i in range(1, N+1):\n\n hapiness = list(map(int, input().split()))\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k] + hapiness[k])\n\n\n\nprint((max(dp[N][0], dp[N][1], dp[N][2])))", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 341, "code_v1_num_chars": 329, "code_v0_no_empty_lines": "N = int(input())\nl = [list(map(int, input().split())) for _ in range(N)]\ndp = [[0 for i in range(3)] for j in range(N + 1)]\nfor i in range(1, N + 1):\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[i][j] = max(dp[i][j], dp[i - 1][k] + l[i - 1][k])\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n", "code_v1_no_empty_lines": "N = int(input())\ndp = [[0 for i in range(3)] for j in range(N + 1)]\nfor i in range(1, N + 1):\n hapiness = list(map(int, input().split()))\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[i][j] = max(dp[i][j], dp[i - 1][k] + hapiness[k])\nprint((max(dp[N][0], dp[N][1], dp[N][2])))\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-l = [list(map(int, input().split())) for _ in range(N)]", "+ hapiness = list(map(int, input().split()))", "- dp[i][j] = max(dp[i][j], dp[i - 1][k] + l[i - 1][k])", "+ dp[i][j] = max(dp[i][j], dp[i - 1][k] + hapiness[k])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.267745409, "measured_runtime_v1": 0.0801038151, "runtime_lift": 3.3424801143, "key": ["s595235842", "s886147212"], "target_token_count_dream": 114, "target_token_bucket_dream": "<128"} +{"user_id": "u394731058", "problem_id": "p02899", "language": "python", "submission_id_v0": "s948462743", "submission_id_v1": "s673167226", "cpu_time_v0": 210, "cpu_time_v1": 76, "memory_v0": 13304, "memory_v1": 17740, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 63.81, "input": "import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(input())\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n for i in range(len(l)):\n\n if i != len(l)-1:\n\n print(\"{} \".format(l[i]), end='')\n\n else:\n\n print(l[i])\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = 0\n\n n = int(input())\n\n o = list(map(int, input().split()))\n\n l = [0]*n\n\n for i in range(n):\n\n l[o[i]-1] = i+1\n\n print((\" \".join(map(str,l))))\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 19, "code_v1_loc": 14, "code_v0_num_chars": 381, "code_v1_num_chars": 268, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n ans = 0\n n = int(input())\n o = list(map(int, input().split()))\n l = [0] * n\n for i in range(n):\n l[o[i] - 1] = i + 1\n for i in range(len(l)):\n if i != len(l) - 1:\n print(\"{} \".format(l[i]), end=\"\")\n else:\n print(l[i])\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n ans = 0\n n = int(input())\n o = list(map(int, input().split()))\n l = [0] * n\n for i in range(n):\n l[o[i] - 1] = i + 1\n print((\" \".join(map(str, l))))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 26.3157894737, "diff": ["- n = int(input())", "+ n = int(input())", "- for i in range(len(l)):", "- if i != len(l) - 1:", "- print(\"{} \".format(l[i]), end=\"\")", "- else:", "- print(l[i])", "+ print((\" \".join(map(str, l))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3305146998, "measured_runtime_v1": 0.2638847903, "runtime_lift": 1.2524962104, "key": ["s948462743", "s673167226"], "target_token_count_dream": 83, "target_token_bucket_dream": "<128"} +{"user_id": "u531220228", "problem_id": "p02994", "language": "python", "submission_id_v0": "s512634929", "submission_id_v1": "s713379557", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "N,L = list(map(int, input().split()))\n\ntaste = [L+i-1 for i in range(1,N+1)]\n\nif taste[-1] < 0:\n\n print((sum(taste) + min([abs(x) for x in taste])))\n\nelse:\n\n print((sum(taste) - min([abs(x) for x in taste])))", "target": "N, L = list(map(int, input().split()))\n\n\n\ntaste = [L+i-1 for i in range(1, N+1)]\n\n\n\nif 0 in taste:\n\n select = 0\n\nelse:\n\n select_with_ind = min(enumerate(taste), key = lambda x: abs(x[1]))\n\n select = select_with_ind[1]\n\n \n\nprint((sum(taste) - select))", "code_v0_loc": 6, "code_v1_loc": 11, "code_v0_num_chars": 200, "code_v1_num_chars": 254, "code_v0_no_empty_lines": "N, L = list(map(int, input().split()))\ntaste = [L + i - 1 for i in range(1, N + 1)]\nif taste[-1] < 0:\n print((sum(taste) + min([abs(x) for x in taste])))\nelse:\n print((sum(taste) - min([abs(x) for x in taste])))\n", "code_v1_no_empty_lines": "N, L = list(map(int, input().split()))\ntaste = [L + i - 1 for i in range(1, N + 1)]\nif 0 in taste:\n select = 0\nelse:\n select_with_ind = min(enumerate(taste), key=lambda x: abs(x[1]))\n select = select_with_ind[1]\nprint((sum(taste) - select))\n", "code_same": false, "relative_loc_diff_percent": 45.4545454545, "diff": ["-if taste[-1] < 0:", "- print((sum(taste) + min([abs(x) for x in taste])))", "+if 0 in taste:", "+ select = 0", "- print((sum(taste) - min([abs(x) for x in taste])))", "+ select_with_ind = min(enumerate(taste), key=lambda x: abs(x[1]))", "+ select = select_with_ind[1]", "+print((sum(taste) - select))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3334629779, "measured_runtime_v1": 0.1486533701, "runtime_lift": 2.2432251455, "key": ["s512634929", "s713379557"], "target_token_count_dream": 87, "target_token_bucket_dream": "<128"} +{"user_id": "u077291787", "problem_id": "p03416", "language": "python", "submission_id_v0": "s642708796", "submission_id_v1": "s868202811", "cpu_time_v0": 245, "cpu_time_v1": 42, "memory_v0": 40940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.86, "input": "# ABC090B - Palindromic Numbers\n\na, b = list(map(int, input().rstrip().split()))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n lst = list(map(int, list(str(i))))\n\n if lst[0] == lst[4] and lst[1] == lst[3]:\n\n count += 1\n\nprint(count)", "target": "# ABC090B - Palindromic Numbers\n\ndef main():\n\n a, b = list(map(int, input().rstrip().split()))\n\n cnt = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n if s == s[::-1]:\n\n cnt += 1\n\n print(cnt)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 8, "code_v1_loc": 13, "code_v0_num_chars": 239, "code_v1_num_chars": 269, "code_v0_no_empty_lines": "# ABC090B - Palindromic Numbers\na, b = list(map(int, input().rstrip().split()))\ncount = 0\nfor i in range(a, b + 1):\n lst = list(map(int, list(str(i))))\n if lst[0] == lst[4] and lst[1] == lst[3]:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "# ABC090B - Palindromic Numbers\ndef main():\n a, b = list(map(int, input().rstrip().split()))\n cnt = 0\n for i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n cnt += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 38.4615384615, "diff": ["-a, b = list(map(int, input().rstrip().split()))", "-count = 0", "-for i in range(a, b + 1):", "- lst = list(map(int, list(str(i))))", "- if lst[0] == lst[4] and lst[1] == lst[3]:", "- count += 1", "-print(count)", "+def main():", "+ a, b = list(map(int, input().rstrip().split()))", "+ cnt = 0", "+ for i in range(a, b + 1):", "+ s = str(i)", "+ if s == s[::-1]:", "+ cnt += 1", "+ print(cnt)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3956292481, "measured_runtime_v1": 0.2484657222, "runtime_lift": 1.5922890477, "key": ["s642708796", "s868202811"], "target_token_count_dream": 85, "target_token_bucket_dream": "<128"} +{"user_id": "u977389981", "problem_id": "p03720", "language": "python", "submission_id_v0": "s310815601", "submission_id_v1": "s089084009", "cpu_time_v0": 25, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.0, "input": "n, m = list(map(int, input().split()))\n\ndp = [0] * n\n\nfor i in range(m):\n\n x, y = list(map(int, input().split()))\n\n dp[x - 1] += 1\n\n dp[y - 1] += 1\n\nfor i in range(n):\n\n print((dp[i]))", "target": "n, m = list(map(int, input().split()))\n\nA = [0] * n\n\nfor i in range(m):\n\n a, b = list(map(int, input().split()))\n\n A[a - 1] += 1\n\n A[b - 1] += 1\n\n \n\nfor i in range(n):\n\n print((A[i]))", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 182, "code_v1_num_chars": 184, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\ndp = [0] * n\nfor i in range(m):\n x, y = list(map(int, input().split()))\n dp[x - 1] += 1\n dp[y - 1] += 1\nfor i in range(n):\n print((dp[i]))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nA = [0] * n\nfor i in range(m):\n a, b = list(map(int, input().split()))\n A[a - 1] += 1\n A[b - 1] += 1\nfor i in range(n):\n print((A[i]))\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-dp = [0] * n", "+A = [0] * n", "- x, y = list(map(int, input().split()))", "- dp[x - 1] += 1", "- dp[y - 1] += 1", "+ a, b = list(map(int, input().split()))", "+ A[a - 1] += 1", "+ A[b - 1] += 1", "- print((dp[i]))", "+ print((A[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2766861832, "measured_runtime_v1": 0.17692909, "runtime_lift": 1.5638252769, "key": ["s310815601", "s089084009"], "target_token_count_dream": 74, "target_token_bucket_dream": "<128"} +{"user_id": "u440566786", "problem_id": "p03558", "language": "python", "submission_id_v0": "s333680155", "submission_id_v1": "s106353030", "cpu_time_v0": 260, "cpu_time_v1": 131, "memory_v0": 62004, "memory_v1": 79416, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 49.62, "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\n\n\nfrom collections import deque\n\ndef resolve():\n\n k=int(input())\n\n E=[[] for _ in range(k)]\n\n for i in range(k):\n\n E[i].append(((i+1)%k,1))\n\n E[i].append(((10*i)%k,0))\n\n\n\n # 0-1 BFS\n\n dist=[INF]*k\n\n dist[1]=0\n\n Q=deque([1])\n\n while(Q):\n\n v=Q.popleft()\n\n for nv,w in E[v]:\n\n if(dist[nv]<=dist[v]+w): continue\n\n dist[nv]=dist[v]+w\n\n if(w==0): Q.appendleft(nv)\n\n else: Q.append(nv)\n\n print((dist[0]+1))\n\nresolve()", "target": "import sys\n\nINF = 1 << 60\n\nMOD = 10**9 + 7 # 998244353\n\nsys.setrecursionlimit(2147483647)\n\ninput = lambda:sys.stdin.readline().rstrip()\n\nfrom collections import deque\n\ndef resolve():\n\n k = int(input())\n\n dist = [INF] * k\n\n dist[1] = 1\n\n queue = deque([1])\n\n\n\n while queue:\n\n v = queue.pop()\n\n if dist[10 * v % k] > dist[v]:\n\n dist[10 * v % k] = dist[v]\n\n queue.appendleft(10 * v % k)\n\n if dist[(v + 1) % k] > dist[v] + 1:\n\n dist[(v + 1) % k] = dist[v] + 1\n\n queue.append((v + 1) % k)\n\n\n\n print((dist[0]))\n\nresolve()", "code_v0_loc": 27, "code_v1_loc": 23, "code_v0_num_chars": 630, "code_v1_num_chars": 596, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nMOD = 10**9 + 7\ninput = lambda: sys.stdin.readline().rstrip()\nfrom collections import deque\n\n\ndef resolve():\n k = int(input())\n E = [[] for _ in range(k)]\n for i in range(k):\n E[i].append(((i + 1) % k, 1))\n E[i].append(((10 * i) % k, 0))\n # 0-1 BFS\n dist = [INF] * k\n dist[1] = 0\n Q = deque([1])\n while Q:\n v = Q.popleft()\n for nv, w in E[v]:\n if dist[nv] <= dist[v] + w:\n continue\n dist[nv] = dist[v] + w\n if w == 0:\n Q.appendleft(nv)\n else:\n Q.append(nv)\n print((dist[0] + 1))\n\n\nresolve()\n", "code_v1_no_empty_lines": "import sys\n\nINF = 1 << 60\nMOD = 10**9 + 7 # 998244353\nsys.setrecursionlimit(2147483647)\ninput = lambda: sys.stdin.readline().rstrip()\nfrom collections import deque\n\n\ndef resolve():\n k = int(input())\n dist = [INF] * k\n dist[1] = 1\n queue = deque([1])\n while queue:\n v = queue.pop()\n if dist[10 * v % k] > dist[v]:\n dist[10 * v % k] = dist[v]\n queue.appendleft(10 * v % k)\n if dist[(v + 1) % k] > dist[v] + 1:\n dist[(v + 1) % k] = dist[v] + 1\n queue.append((v + 1) % k)\n print((dist[0]))\n\n\nresolve()\n", "code_same": false, "relative_loc_diff_percent": 14.8148148148, "diff": ["+INF = 1 << 60", "+MOD = 10**9 + 7 # 998244353", "-INF = float(\"inf\")", "-MOD = 10**9 + 7", "- E = [[] for _ in range(k)]", "- for i in range(k):", "- E[i].append(((i + 1) % k, 1))", "- E[i].append(((10 * i) % k, 0))", "- # 0-1 BFS", "- dist[1] = 0", "- Q = deque([1])", "- while Q:", "- v = Q.popleft()", "- for nv, w in E[v]:", "- if dist[nv] <= dist[v] + w:", "- continue", "- dist[nv] = dist[v] + w", "- if w == 0:", "- Q.appendleft(nv)", "- else:", "- Q.append(nv)", "- print((dist[0] + 1))", "+ dist[1] = 1", "+ queue = deque([1])", "+ while queue:", "+ v = queue.pop()", "+ if dist[10 * v % k] > dist[v]:", "+ dist[10 * v % k] = dist[v]", "+ queue.appendleft(10 * v % k)", "+ if dist[(v + 1) % k] > dist[v] + 1:", "+ dist[(v + 1) % k] = dist[v] + 1", "+ queue.append((v + 1) % k)", "+ print((dist[0]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.412358222, "measured_runtime_v1": 0.3278088195, "runtime_lift": 1.2579229033, "key": ["s333680155", "s106353030"], "target_token_count_dream": 212, "target_token_bucket_dream": "128-256"} +{"user_id": "u171065106", "problem_id": "p03796", "language": "python", "submission_id_v0": "s258128729", "submission_id_v1": "s727911974", "cpu_time_v0": 230, "cpu_time_v1": 43, "memory_v0": 3976, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.3, "input": "import math\n\n\n\nn = int(input())\n\n\n\nprint((math.factorial(n) % (10**9 + 7)))\n", "target": "n = int(input())\n\n\n\nans = 1\n\n\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= 10**9 + 7\n\n\n\nprint(ans)\n", "code_v0_loc": 5, "code_v1_loc": 9, "code_v0_num_chars": 74, "code_v1_num_chars": 105, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= 10**9 + 7\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+ans = 1", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= 10**9 + 7", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6649877462, "measured_runtime_v1": 0.4034042664, "runtime_lift": 1.6484400431, "key": ["s258128729", "s727911974"], "target_token_count_dream": 42, "target_token_bucket_dream": "<128"} +{"user_id": "u761320129", "problem_id": "p03839", "language": "python", "submission_id_v0": "s934844992", "submission_id_v1": "s135860240", "cpu_time_v0": 205, "cpu_time_v1": 174, "memory_v0": 17404, "memory_v1": 17532, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.12, "input": "N,K = list(map(int,input().split()))\n\nsrc = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncump = [0]\n\nfor a in src:\n\n cums.append(cums[-1] + a)\n\n cump.append(cump[-1] + max(0,a))\n\n\n\nans = 0\n\nfor i in range(N-K+1):\n\n tmp = cump[i]\n\n tmp += max(0, cums[i+K] - cums[i])\n\n tmp += cump[N] - cump[i+K]\n\n ans = max(tmp, ans)\n\nprint(ans)\n", "target": "N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\n\n\ncums = [0]\n\ncums_p = [0]\n\nfor a in A:\n\n cums.append(cums[-1] + a)\n\n cums_p.append(cums_p[-1] + max(0,a))\n\n\n\nans = -float('inf')\n\nfor l in range(N-K+1):\n\n free = cums_p[l] + cums_p[-1] - cums_p[l+K]\n\n cont = cums[l+K] - cums[l]\n\n ans = max(ans, free, free+cont)\n\nprint(ans)", "code_v0_loc": 16, "code_v1_loc": 15, "code_v0_num_chars": 342, "code_v1_num_chars": 357, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nsrc = list(map(int, input().split()))\ncums = [0]\ncump = [0]\nfor a in src:\n cums.append(cums[-1] + a)\n cump.append(cump[-1] + max(0, a))\nans = 0\nfor i in range(N - K + 1):\n tmp = cump[i]\n tmp += max(0, cums[i + K] - cums[i])\n tmp += cump[N] - cump[i + K]\n ans = max(tmp, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\ncums = [0]\ncums_p = [0]\nfor a in A:\n cums.append(cums[-1] + a)\n cums_p.append(cums_p[-1] + max(0, a))\nans = -float(\"inf\")\nfor l in range(N - K + 1):\n free = cums_p[l] + cums_p[-1] - cums_p[l + K]\n cont = cums[l + K] - cums[l]\n ans = max(ans, free, free + cont)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 6.25, "diff": ["-src = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "-cump = [0]", "-for a in src:", "+cums_p = [0]", "+for a in A:", "- cump.append(cump[-1] + max(0, a))", "-ans = 0", "-for i in range(N - K + 1):", "- tmp = cump[i]", "- tmp += max(0, cums[i + K] - cums[i])", "- tmp += cump[N] - cump[i + K]", "- ans = max(tmp, ans)", "+ cums_p.append(cums_p[-1] + max(0, a))", "+ans = -float(\"inf\")", "+for l in range(N - K + 1):", "+ free = cums_p[l] + cums_p[-1] - cums_p[l + K]", "+ cont = cums[l + K] - cums[l]", "+ ans = max(ans, free, free + cont)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3907449563, "measured_runtime_v1": 0.3033102551, "runtime_lift": 1.2882681998, "key": ["s934844992", "s135860240"], "target_token_count_dream": 136, "target_token_bucket_dream": "128-256"} +{"user_id": "u488127128", "problem_id": "p03796", "language": "python", "submission_id_v0": "s637972642", "submission_id_v1": "s581563839", "cpu_time_v0": 32, "cpu_time_v1": 28, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.5, "input": "def factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r *= n\n\n power_r %= 10**9+7\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "target": "def factorial(N):\n\n power_r = 1\n\n for n in range(2,N+1):\n\n power_r = power_r*n % (10**9+7)\n\n return power_r\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "code_v0_loc": 10, "code_v1_loc": 9, "code_v0_num_chars": 209, "code_v1_num_chars": 200, "code_v0_no_empty_lines": "def factorial(N):\n power_r = 1\n for n in range(2, N + 1):\n power_r *= n\n power_r %= 10**9 + 7\n return power_r\n\n\nif __name__ == \"__main__\":\n N = int(input())\n print((factorial(N)))\n", "code_v1_no_empty_lines": "def factorial(N):\n power_r = 1\n for n in range(2, N + 1):\n power_r = power_r * n % (10**9 + 7)\n return power_r\n\n\nif __name__ == \"__main__\":\n N = int(input())\n print((factorial(N)))\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["- power_r *= n", "- power_r %= 10**9 + 7", "+ power_r = power_r * n % (10**9 + 7)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3227770622, "measured_runtime_v1": 0.2497183731, "runtime_lift": 1.2925643324, "key": ["s637972642", "s581563839"], "target_token_count_dream": 65, "target_token_bucket_dream": "<128"} +{"user_id": "u189479417", "problem_id": "p02596", "language": "python", "submission_id_v0": "s892012548", "submission_id_v1": "s295850055", "cpu_time_v0": 350, "cpu_time_v1": 211, "memory_v0": 9176, "memory_v1": 9188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.71, "input": "import sys\n\nK = int(input())\n\n\n\npower = 7\n\nSUM = 0\n\n\n\nfor i in range(1, 10 ** 6):\n\n SUM += power\n\n if SUM % K == 0:\n\n print(i)\n\n sys.exit()\n\n power *= 10\n\n power %= K\n\n\n\nprint((-1))", "target": "import sys\n\nK = int(input())\n\n\n\nL = 9 * K\n\n\n\nif K % 7 == 0:\n\n L //= 7\n\n\n\npower = 1\n\n\n\nfor i in range(1, 10 ** 6):\n\n power *= 10\n\n power %= L\n\n if power == 1:\n\n print(i)\n\n sys.exit()\n\n\n\nprint((-1))", "code_v0_loc": 15, "code_v1_loc": 18, "code_v0_num_chars": 205, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "import sys\n\nK = int(input())\npower = 7\nSUM = 0\nfor i in range(1, 10**6):\n SUM += power\n if SUM % K == 0:\n print(i)\n sys.exit()\n power *= 10\n power %= K\nprint((-1))\n", "code_v1_no_empty_lines": "import sys\n\nK = int(input())\nL = 9 * K\nif K % 7 == 0:\n L //= 7\npower = 1\nfor i in range(1, 10**6):\n power *= 10\n power %= L\n if power == 1:\n print(i)\n sys.exit()\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-power = 7", "-SUM = 0", "+L = 9 * K", "+if K % 7 == 0:", "+ L //= 7", "+power = 1", "- SUM += power", "- if SUM % K == 0:", "+ power *= 10", "+ power %= L", "+ if power == 1:", "- power *= 10", "- power %= K"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9885553987, "measured_runtime_v1": 0.6379526145, "runtime_lift": 1.5495749624, "key": ["s892012548", "s295850055"], "target_token_count_dream": 81, "target_token_bucket_dream": "<128"} +{"user_id": "u766684188", "problem_id": "p02821", "language": "python", "submission_id_v0": "s756543404", "submission_id_v1": "s283463453", "cpu_time_v0": 1684, "cpu_time_v1": 1054, "memory_v0": 58816, "memory_v1": 60104, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.41, "input": "#E\n\nfrom itertools import accumulate\n\nfrom bisect import bisect_left\n\ndef main():\n\n n,m=list(map(int,input().split()))\n\n A=list(map(int,input().split()))\n\n A.sort()\n\n \n\n def count(k):\n\n cnt=0\n\n for a in A:\n\n cnt+=bisect_left(A,k-a)\n\n return cnt\n\n \n\n ok=0\n\n ng=10**10+1\n\n while ng-ok>1:\n\n mid=(ok+ng)//2\n\n if count(mid)1:\n\n mid=(ok+ng)//2\n\n if count(mid) 1:\n mid = (ok + ng) // 2\n if count(mid) < n**2 - m:\n ok = mid\n else:\n ng = mid\n border = ok\n k = n**2 - count(border)\n Acc = [0] + list(accumulate(A))\n s = Acc[-1]\n ans = 0\n for a in A:\n idx = bisect_left(A, border - a)\n ans += a * (n - idx) + (s - Acc[idx])\n ans -= border * (k - m)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from itertools import accumulate\nfrom bisect import bisect_left\n\n\ndef main():\n n, m = list(map(int, input().split()))\n A = list(map(int, input().split()))\n A.sort()\n\n def count(k):\n cnt = 0\n for a in A:\n cnt += bisect_left(A, k - a)\n return cnt\n\n ok = 0\n ng = 2 * 10**5 + 1\n while ng - ok > 1:\n mid = (ok + ng) // 2\n if count(mid) < n**2 - m:\n ok = mid\n else:\n ng = mid\n border = ok\n k = n**2 - count(border)\n Acc = [0] + list(accumulate(A))\n s = Acc[-1]\n ans = 0\n for a in A:\n idx = bisect_left(A, border - a)\n ans += a * (n - idx) + (s - Acc[idx])\n ans -= border * (k - m)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 2.7777777778, "diff": ["-# E", "- ng = 10**10 + 1", "+ ng = 2 * 10**5 + 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.329581742, "measured_runtime_v1": 0.2004272747, "runtime_lift": 1.6443956668, "key": ["s756543404", "s283463453"], "target_token_count_dream": 219, "target_token_bucket_dream": "128-256"} +{"user_id": "u738898077", "problem_id": "p03634", "language": "python", "submission_id_v0": "s144783413", "submission_id_v1": "s080655040", "cpu_time_v0": 845, "cpu_time_v1": 724, "memory_v0": 48964, "memory_v1": 48916, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.32, "input": "import sys\n\ninput = sys.stdin.readline\n\nn = int(input())\n\nv = [[0]+[]*(n+1) for i in range(n+1)]\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\n\n\nq,k = list(map(int,input().split()))\n\nl = [k]\n\nwhile l:\n\n now = l.pop()\n\n for i in v[now][1:]:\n\n if v[i[0]][0] == 0:\n\n v[i[0]][0] = i[1]+v[now][0]\n\n l.append(i[0])\n\n\n\nfor i in range(q):\n\n x,y = list(map(int,input().split()))\n\n print((v[x][0]+v[y][0]))", "target": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n n = int(input())\n\n v = [[0]+[]*(n+1) for i in range(n+1)]\n\n for i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\n\n\n q,k = list(map(int,input().split()))\n\n l = [k]\n\n while l:\n\n now = l.pop()\n\n for i in v[now][1:]:\n\n if v[i[0]][0] == 0:\n\n v[i[0]][0] = i[1]+v[now][0]\n\n l.append(i[0])\n\n\n\n for i in range(q):\n\n x,y = list(map(int,input().split()))\n\n print((v[x][0]+v[y][0]))\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 21, "code_v1_loc": 25, "code_v0_num_chars": 486, "code_v1_num_chars": 613, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nn = int(input())\nv = [[0] + [] * (n + 1) for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n v[a].append([b, c])\n v[b].append([a, c])\nq, k = list(map(int, input().split()))\nl = [k]\nwhile l:\n now = l.pop()\n for i in v[now][1:]:\n if v[i[0]][0] == 0:\n v[i[0]][0] = i[1] + v[now][0]\n l.append(i[0])\nfor i in range(q):\n x, y = list(map(int, input().split()))\n print((v[x][0] + v[y][0]))\n", "code_v1_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n n = int(input())\n v = [[0] + [] * (n + 1) for i in range(n + 1)]\n for i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n v[a].append([b, c])\n v[b].append([a, c])\n q, k = list(map(int, input().split()))\n l = [k]\n while l:\n now = l.pop()\n for i in v[now][1:]:\n if v[i[0]][0] == 0:\n v[i[0]][0] = i[1] + v[now][0]\n l.append(i[0])\n for i in range(q):\n x, y = list(map(int, input().split()))\n print((v[x][0] + v[y][0]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 16.0, "diff": ["-input = sys.stdin.readline", "-n = int(input())", "-v = [[0] + [] * (n + 1) for i in range(n + 1)]", "-for i in range(n - 1):", "- a, b, c = list(map(int, input().split()))", "- v[a].append([b, c])", "- v[b].append([a, c])", "-q, k = list(map(int, input().split()))", "-l = [k]", "-while l:", "- now = l.pop()", "- for i in v[now][1:]:", "- if v[i[0]][0] == 0:", "- v[i[0]][0] = i[1] + v[now][0]", "- l.append(i[0])", "-for i in range(q):", "- x, y = list(map(int, input().split()))", "- print((v[x][0] + v[y][0]))", "+", "+def main():", "+ input = sys.stdin.readline", "+ n = int(input())", "+ v = [[0] + [] * (n + 1) for i in range(n + 1)]", "+ for i in range(n - 1):", "+ a, b, c = list(map(int, input().split()))", "+ v[a].append([b, c])", "+ v[b].append([a, c])", "+ q, k = list(map(int, input().split()))", "+ l = [k]", "+ while l:", "+ now = l.pop()", "+ for i in v[now][1:]:", "+ if v[i[0]][0] == 0:", "+ v[i[0]][0] = i[1] + v[now][0]", "+ l.append(i[0])", "+ for i in range(q):", "+ x, y = list(map(int, input().split()))", "+ print((v[x][0] + v[y][0]))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3066135428, "measured_runtime_v1": 0.2174853971, "runtime_lift": 1.4098120925, "key": ["s144783413", "s080655040"], "target_token_count_dream": 199, "target_token_bucket_dream": "128-256"} +{"user_id": "u497046426", "problem_id": "p03568", "language": "python", "submission_id_v0": "s711599117", "submission_id_v1": "s424536945", "cpu_time_v0": 181, "cpu_time_v1": 17, "memory_v0": 3572, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 90.61, "input": "from functools import reduce\n\nfrom itertools import product\n\n\n\nN = int(input())\n\n*A, = list(map(int, input().split()))\n\nans = 0\n\nfor t in product([-1, 0, 1], repeat=N):\n\n prod = reduce(lambda x, y: x*y, [a + t[i] for i, a in enumerate(A)])\n\n if prod % 2 == 0: ans += 1\n\nprint(ans)", "target": "N = int(input())\n\n*A, = list(map(int, input().split()))\n\nevens = 0\n\nfor a in A:\n\n if a % 2 == 0: evens += 1\n\nans = 3**N - 2**evens\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 280, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "from functools import reduce\nfrom itertools import product\n\nN = int(input())\n(*A,) = list(map(int, input().split()))\nans = 0\nfor t in product([-1, 0, 1], repeat=N):\n prod = reduce(lambda x, y: x * y, [a + t[i] for i, a in enumerate(A)])\n if prod % 2 == 0:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\n(*A,) = list(map(int, input().split()))\nevens = 0\nfor a in A:\n if a % 2 == 0:\n evens += 1\nans = 3**N - 2**evens\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-from functools import reduce", "-from itertools import product", "-", "-ans = 0", "-for t in product([-1, 0, 1], repeat=N):", "- prod = reduce(lambda x, y: x * y, [a + t[i] for i, a in enumerate(A)])", "- if prod % 2 == 0:", "- ans += 1", "+evens = 0", "+for a in A:", "+ if a % 2 == 0:", "+ evens += 1", "+ans = 3**N - 2**evens"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6547077734, "measured_runtime_v1": 0.2760411811, "runtime_lift": 2.3717757287, "key": ["s711599117", "s424536945"], "target_token_count_dream": 59, "target_token_bucket_dream": "<128"} +{"user_id": "u628707847", "problem_id": "p02748", "language": "python", "submission_id_v0": "s393648468", "submission_id_v1": "s394235092", "cpu_time_v0": 533, "cpu_time_v1": 471, "memory_v0": 30260, "memory_v1": 21668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.63, "input": "a, b, m = list(map(int,input().split()))\n\ndr = list(map(int,input().split()))\n\nwa = list(map(int,input().split()))\n\nxyc = [list(map(int,input().split())) for i in range(m)]\n\nlow = 200001\n\n\n\nfor i in range(m):\n\n f = xyc[i][0] - 1\n\n d = xyc[i][1] - 1\n\n if low >= dr[f]+wa[d]-xyc[i][2]:\n\n low = dr[f]+wa[d]-xyc[i][2]\n\n\n\ndr.sort()\n\nwa.sort()\n\n\n\nif low >= (dr[0] + wa[0]):\n\n print((dr[0] + wa[0]))\n\nelse:\n\n print(low)", "target": "a, b, m = list(map(int,input().split()))\n\nal = list(map(int,input().split()))\n\nbl = list(map(int,input().split()))\n\nlow = min(al)+min(bl)\n\nx = [0] * m\n\ny = [0] * m\n\nc = [0] * m\n\n\n\nfor i in range(m):\n\n x[i],y[i],c[i] = list(map(int, input().split()))\n\n x[i] -= 1\n\n y[i] -= 1\n\n \n\nfor i in range(m):\n\n low = min(low,al[x[i]]+bl[y[i]]-c[i])\n\n\n\nprint(low)", "code_v0_loc": 19, "code_v1_loc": 17, "code_v0_num_chars": 424, "code_v1_num_chars": 353, "code_v0_no_empty_lines": "a, b, m = list(map(int, input().split()))\ndr = list(map(int, input().split()))\nwa = list(map(int, input().split()))\nxyc = [list(map(int, input().split())) for i in range(m)]\nlow = 200001\nfor i in range(m):\n f = xyc[i][0] - 1\n d = xyc[i][1] - 1\n if low >= dr[f] + wa[d] - xyc[i][2]:\n low = dr[f] + wa[d] - xyc[i][2]\ndr.sort()\nwa.sort()\nif low >= (dr[0] + wa[0]):\n print((dr[0] + wa[0]))\nelse:\n print(low)\n", "code_v1_no_empty_lines": "a, b, m = list(map(int, input().split()))\nal = list(map(int, input().split()))\nbl = list(map(int, input().split()))\nlow = min(al) + min(bl)\nx = [0] * m\ny = [0] * m\nc = [0] * m\nfor i in range(m):\n x[i], y[i], c[i] = list(map(int, input().split()))\n x[i] -= 1\n y[i] -= 1\nfor i in range(m):\n low = min(low, al[x[i]] + bl[y[i]] - c[i])\nprint(low)\n", "code_same": false, "relative_loc_diff_percent": 10.5263157895, "diff": ["-dr = list(map(int, input().split()))", "-wa = list(map(int, input().split()))", "-xyc = [list(map(int, input().split())) for i in range(m)]", "-low = 200001", "+al = list(map(int, input().split()))", "+bl = list(map(int, input().split()))", "+low = min(al) + min(bl)", "+x = [0] * m", "+y = [0] * m", "+c = [0] * m", "- f = xyc[i][0] - 1", "- d = xyc[i][1] - 1", "- if low >= dr[f] + wa[d] - xyc[i][2]:", "- low = dr[f] + wa[d] - xyc[i][2]", "-dr.sort()", "-wa.sort()", "-if low >= (dr[0] + wa[0]):", "- print((dr[0] + wa[0]))", "-else:", "- print(low)", "+ x[i], y[i], c[i] = list(map(int, input().split()))", "+ x[i] -= 1", "+ y[i] -= 1", "+for i in range(m):", "+ low = min(low, al[x[i]] + bl[y[i]] - c[i])", "+print(low)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2055197518, "measured_runtime_v1": 0.0063774352, "runtime_lift": 32.2260822388, "key": ["s393648468", "s394235092"], "target_token_count_dream": 134, "target_token_bucket_dream": "128-256"} +{"user_id": "u306664745", "problem_id": "p02983", "language": "python", "submission_id_v0": "s965697641", "submission_id_v1": "s560038811", "cpu_time_v0": 68, "cpu_time_v1": 56, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.65, "input": "l, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (((i%2019)*(j%2019))%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)", "target": "l, r=list(map(int, input().split()))\n\nif r-l>672:\n\n\tp=0\n\nelse:\n\n\tp=2019\n\n\tfor i in range(l, r):\n\n\t\tfor j in range(i+1, r+1):\n\n\t\t\tp=min(p, (i*j%2019))\n\n\t\t\tif not p:\n\n\t\t\t\tbreak\n\n\t\tif not p:\n\n\t\t\tbreak\n\nprint(p)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 217, "code_v1_num_chars": 201, "code_v0_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 672:\n p = 0\nelse:\n p = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n p = min(p, (((i % 2019) * (j % 2019)) % 2019))\n if not p:\n break\n if not p:\n break\nprint(p)\n", "code_v1_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 672:\n p = 0\nelse:\n p = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n p = min(p, (i * j % 2019))\n if not p:\n break\n if not p:\n break\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- p = min(p, (((i % 2019) * (j % 2019)) % 2019))", "+ p = min(p, (i * j % 2019))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3854847456, "measured_runtime_v1": 0.191389215, "runtime_lift": 2.0141403766, "key": ["s965697641", "s560038811"], "target_token_count_dream": 86, "target_token_bucket_dream": "<128"} +{"user_id": "u046592970", "problem_id": "p03371", "language": "python", "submission_id_v0": "s911937877", "submission_id_v1": "s225349134", "cpu_time_v0": 121, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.95, "input": "a,b,c,x,y = list(map(int,input().split()))\n\nprice = 10**10\n\nfor k in range(10**5+1):\n\n re = 2*c*k + max(0,x-k)*a + max(0,y-k)*b\n\n price = min(re,price)\n\nprint(price)", "target": "a,b,c,x,y = list(map(int,input().split()))\n\na1 = a*x + b*y\n\na2 = max(x,y) * 2*c\n\nif y >= x:\n\n a3 = 2*c*x + (y-x)*b\n\nelse:\n\n a3 = 2*c*y + (x-y)*a\n\nprint((min(a1,a2,a3)))", "code_v0_loc": 6, "code_v1_loc": 8, "code_v0_num_chars": 165, "code_v1_num_chars": 166, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nprice = 10**10\nfor k in range(10**5 + 1):\n re = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b\n price = min(re, price)\nprint(price)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\na1 = a * x + b * y\na2 = max(x, y) * 2 * c\nif y >= x:\n a3 = 2 * c * x + (y - x) * b\nelse:\n a3 = 2 * c * y + (x - y) * a\nprint((min(a1, a2, a3)))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-price = 10**10", "-for k in range(10**5 + 1):", "- re = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b", "- price = min(re, price)", "-print(price)", "+a1 = a * x + b * y", "+a2 = max(x, y) * 2 * c", "+if y >= x:", "+ a3 = 2 * c * x + (y - x) * b", "+else:", "+ a3 = 2 * c * y + (x - y) * a", "+print((min(a1, a2, a3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4459569323, "measured_runtime_v1": 0.1564870899, "runtime_lift": 2.8498001506, "key": ["s911937877", "s225349134"], "target_token_count_dream": 81, "target_token_bucket_dream": "<128"} +{"user_id": "u597374218", "problem_id": "p03796", "language": "python", "submission_id_v0": "s873197292", "submission_id_v1": "s712740845", "cpu_time_v0": 231, "cpu_time_v1": 40, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.68, "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "target": "ans=1\n\nn=int(input())\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 6, "code_v0_num_chars": 58, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nn = int(input())\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % (10**9 + 7)))", "+ans = 1", "+n = int(input())", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans = ans % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5415332041, "measured_runtime_v1": 0.2632789848, "runtime_lift": 2.0568797183, "key": ["s873197292", "s712740845"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u222668979", "problem_id": "p02996", "language": "python", "submission_id_v0": "s000658921", "submission_id_v1": "s911267857", "cpu_time_v0": 791, "cpu_time_v1": 572, "memory_v0": 38028, "memory_v1": 117796, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.69, "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(input())\n\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\n\n\n\ncnt = 0\n\nfor b, a in ab:\n\n cnt += a\n\n if cnt > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n", "target": "n = int(input())\n\nab = [list(map(int, input().split())) for _ in range(n)]\n\nab = sorted(ab, key=lambda x: x[1])\n\n\n\nt = 0\n\nfor a, b in ab:\n\n t += a\n\n if t > b:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 251, "code_v1_num_chars": 226, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nn = int(input())\nab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])\ncnt = 0\nfor b, a in ab:\n cnt += a\n if cnt > b:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_v1_no_empty_lines": "n = int(input())\nab = [list(map(int, input().split())) for _ in range(n)]\nab = sorted(ab, key=lambda x: x[1])\nt = 0\nfor a, b in ab:\n t += a\n if t > b:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-ab = sorted([list(map(int, input().split()))[::-1] for _ in range(n)])", "-cnt = 0", "-for b, a in ab:", "- cnt += a", "- if cnt > b:", "+ab = [list(map(int, input().split())) for _ in range(n)]", "+ab = sorted(ab, key=lambda x: x[1])", "+t = 0", "+for a, b in ab:", "+ t += a", "+ if t > b:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2345721078, "measured_runtime_v1": 0.0064230425, "runtime_lift": 36.5204038616, "key": ["s000658921", "s911267857"], "target_token_count_dream": 74, "target_token_bucket_dream": "<128"} +{"user_id": "u281303342", "problem_id": "p03828", "language": "python", "submission_id_v0": "s909168869", "submission_id_v1": "s458659043", "cpu_time_v0": 68, "cpu_time_v1": 27, "memory_v0": 3316, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.29, "input": "from collections import Counter\n\nN = int(input())\n\ndiv = []\n\nfor i in range(2,N+1):\n\n while i != 1:\n\n for d in range(2,i+1):\n\n while i%d==0:\n\n i = i//d\n\n div.append(d)\n\nC = Counter(div).most_common()\n\nAns = 1\n\nfor k,v in C:\n\n Ans = Ans*(v+1) % (10**9+7)\n\n\n\nprint(Ans)\n", "target": "from collections import defaultdict\n\nN = int(input())\n\n\n\nF = [True]*(N+1)\n\nF[0]=F[1]=False\n\nP = []\n\n\n\nfor i in range(2,N+1):\n\n if F[i]==True:\n\n P.append(i)\n\n for j in range(i*2,N+1,i):\n\n F[j]=False\n\n\n\ndic = defaultdict(int)\n\nfor i in range(2,N+1):\n\n for p in P:\n\n while i%p==0:\n\n dic[p] += 1\n\n i = i//p\n\n if i==1:\n\n break\n\n\n\nans = 1\n\nmodulo = 10**9+7\n\nfor v in list(dic.values()):\n\n ans *= (v+1)\n\n ans %= modulo\n\n\n\nprint(ans)", "code_v0_loc": 15, "code_v1_loc": 29, "code_v0_num_chars": 322, "code_v1_num_chars": 503, "code_v0_no_empty_lines": "from collections import Counter\n\nN = int(input())\ndiv = []\nfor i in range(2, N + 1):\n while i != 1:\n for d in range(2, i + 1):\n while i % d == 0:\n i = i // d\n div.append(d)\nC = Counter(div).most_common()\nAns = 1\nfor k, v in C:\n Ans = Ans * (v + 1) % (10**9 + 7)\nprint(Ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nF = [True] * (N + 1)\nF[0] = F[1] = False\nP = []\nfor i in range(2, N + 1):\n if F[i] == True:\n P.append(i)\n for j in range(i * 2, N + 1, i):\n F[j] = False\ndic = defaultdict(int)\nfor i in range(2, N + 1):\n for p in P:\n while i % p == 0:\n dic[p] += 1\n i = i // p\n if i == 1:\n break\nans = 1\nmodulo = 10**9 + 7\nfor v in list(dic.values()):\n ans *= v + 1\n ans %= modulo\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 48.275862069, "diff": ["-from collections import Counter", "+from collections import defaultdict", "-div = []", "+F = [True] * (N + 1)", "+F[0] = F[1] = False", "+P = []", "- while i != 1:", "- for d in range(2, i + 1):", "- while i % d == 0:", "- i = i // d", "- div.append(d)", "-C = Counter(div).most_common()", "-Ans = 1", "-for k, v in C:", "- Ans = Ans * (v + 1) % (10**9 + 7)", "-print(Ans)", "+ if F[i] == True:", "+ P.append(i)", "+ for j in range(i * 2, N + 1, i):", "+ F[j] = False", "+dic = defaultdict(int)", "+for i in range(2, N + 1):", "+ for p in P:", "+ while i % p == 0:", "+ dic[p] += 1", "+ i = i // p", "+ if i == 1:", "+ break", "+ans = 1", "+modulo = 10**9 + 7", "+for v in list(dic.values()):", "+ ans *= v + 1", "+ ans %= modulo", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3373793194, "measured_runtime_v1": 0.2469508071, "runtime_lift": 1.3661802664, "key": ["s909168869", "s458659043"], "target_token_count_dream": 166, "target_token_bucket_dream": "128-256"} +{"user_id": "u426534722", "problem_id": "p02245", "language": "python", "submission_id_v0": "s804728708", "submission_id_v1": "s622088378", "cpu_time_v0": 760, "cpu_time_v1": 650, "memory_v0": 25996, "memory_v1": 31348, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.47, "input": "from collections import deque\n\nfrom copy import deepcopy, copy\n\ndy = [-1, 0, 0, 1]\n\ndx = [0, -1, 1, 0]\n\nN = 3\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef MAIN():\n\n m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n goal = ('1', '2', '3', '4', '5', '6', '7', '8', '0')\n\n goal = 123456780\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n print(cnt)\n\n break\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\nMAIN()\n\n\n", "target": "from collections import deque\n\nfrom copy import deepcopy, copy\n\nN = 3\n\ndef g(i, j, a):\n\n if i > j:\n\n i, j = j, i\n\n return a[:i] + a[j] + a[i + 1:j] + a[i] + a[j + 1:]\n\ndef MAIN():\n\n m = {8:{7, 5}, 7:{8, 6, 4}, 6:{7, 3}, 5:{8, 4, 2}, 4:{7, 5, 3, 1}, 3:{6, 4, 0}, 2:{5, 1}, 1:{4, 2, 0}, 0:{3, 1}}\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = MAP.find(\"0\")\n\n goal = \"123456780\"\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n print(cnt)\n\n break\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\nMAIN()\n\n\n", "code_v0_loc": 30, "code_v1_loc": 27, "code_v0_num_chars": 885, "code_v1_num_chars": 783, "code_v0_no_empty_lines": "from collections import deque\nfrom copy import deepcopy, copy\n\ndy = [-1, 0, 0, 1]\ndx = [0, -1, 1, 0]\nN = 3\n\n\ndef g(i, j, a):\n t = a // (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef MAIN():\n m = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n }\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = 8 - MAP.find(\"0\")\n MAP = int(MAP)\n goal = (\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"0\")\n goal = 123456780\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n print(cnt)\n break\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\nMAIN()\n", "code_v1_no_empty_lines": "from collections import deque\nfrom copy import deepcopy, copy\n\nN = 3\n\n\ndef g(i, j, a):\n if i > j:\n i, j = j, i\n return a[:i] + a[j] + a[i + 1 : j] + a[i] + a[j + 1 :]\n\n\ndef MAIN():\n m = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n }\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = MAP.find(\"0\")\n goal = \"123456780\"\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n print(cnt)\n break\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\nMAIN()\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-dy = [-1, 0, 0, 1]", "-dx = [0, -1, 1, 0]", "- t = a // (10**j) % 10", "- return a - t * (10**j) + t * (10**i)", "+ if i > j:", "+ i, j = j, i", "+ return a[:i] + a[j] + a[i + 1 : j] + a[i] + a[j + 1 :]", "- start = 8 - MAP.find(\"0\")", "- MAP = int(MAP)", "- goal = (\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"0\")", "- goal = 123456780", "+ start = MAP.find(\"0\")", "+ goal = \"123456780\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.3641724348, "measured_runtime_v1": 0.096000421, "runtime_lift": 3.7934462245, "key": ["s804728708", "s622088378"], "target_token_count_dream": 303, "target_token_bucket_dream": "256-512"} +{"user_id": "u556358547", "problem_id": "p03416", "language": "python", "submission_id_v0": "s971943319", "submission_id_v1": "s985131399", "cpu_time_v0": 94, "cpu_time_v1": 70, "memory_v0": 73744, "memory_v1": 64480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.53, "input": "# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n s = str(i)\n\n r = \"\".join(reversed(list(s)))\n\n if s == r:\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "# vim: fileencoding=utf-8\n\n\n\n\n\ndef main():\n\n a, b = list(map(int, input().split()))\n\n c = 0\n\n for i in range(a, b + 1):\n\n # s = str(i)\n\n # r = \"\".join(reversed(list(s)))\n\n # if s == r:\n\n # c += 1\n\n if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):\n\n c += 1\n\n print(c)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 281, "code_v1_num_chars": 407, "code_v0_no_empty_lines": "# vim: fileencoding=utf-8\ndef main():\n a, b = list(map(int, input().split()))\n c = 0\n for i in range(a, b + 1):\n s = str(i)\n r = \"\".join(reversed(list(s)))\n if s == r:\n c += 1\n print(c)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# vim: fileencoding=utf-8\ndef main():\n a, b = list(map(int, input().split()))\n c = 0\n for i in range(a, b + 1):\n # s = str(i)\n # r = \"\".join(reversed(list(s)))\n # if s == r:\n # c += 1\n if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):\n c += 1\n print(c)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["- s = str(i)", "- r = \"\".join(reversed(list(s)))", "- if s == r:", "+ # s = str(i)", "+ # r = \"\".join(reversed(list(s)))", "+ # if s == r:", "+ # c += 1", "+ if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.319033144, "measured_runtime_v1": 0.2127196875, "runtime_lift": 1.4997819327, "key": ["s971943319", "s985131399"], "target_token_count_dream": 151, "target_token_bucket_dream": "128-256"} +{"user_id": "u764401543", "problem_id": "p03371", "language": "python", "submission_id_v0": "s157366337", "submission_id_v1": "s208344914", "cpu_time_v0": 114, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.09, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float('inf')\n\n\n\nfor i in range(10 ** 5 + 1):\n\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n# ans = float('inf')\n\n\n\n# for i in range(10 ** 5 + 1):\n\n# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n\n# print(ans)\n\n\n\nmin_xy = min(X, Y)\n\nmax_xy = max(X, Y)\n\nans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)\n\nans2 = A * X + B * Y\n\nans3 = 2 * C * max_xy\n\nprint((min(ans1, ans2, ans3)))", "code_v0_loc": 7, "code_v1_loc": 14, "code_v0_num_chars": 178, "code_v1_num_chars": 364, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(10**5 + 1):\n ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\n# ans = float('inf')\n# for i in range(10 ** 5 + 1):\n# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)\n# print(ans)\nmin_xy = min(X, Y)\nmax_xy = max(X, Y)\nans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)\nans2 = A * X + B * Y\nans3 = 2 * C * max_xy\nprint((min(ans1, ans2, ans3)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-ans = float(\"inf\")", "-for i in range(10**5 + 1):", "- ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)", "-print(ans)", "+# ans = float('inf')", "+# for i in range(10 ** 5 + 1):", "+# ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i)", "+# print(ans)", "+min_xy = min(X, Y)", "+max_xy = max(X, Y)", "+ans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)", "+ans2 = A * X + B * Y", "+ans3 = 2 * C * max_xy", "+print((min(ans1, ans2, ans3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8766576855, "measured_runtime_v1": 0.1948450158, "runtime_lift": 4.4992564066, "key": ["s157366337", "s208344914"], "target_token_count_dream": 159, "target_token_bucket_dream": "128-256"} +{"user_id": "u896741788", "problem_id": "p03037", "language": "python", "submission_id_v0": "s129241236", "submission_id_v1": "s743438543", "cpu_time_v0": 355, "cpu_time_v1": 218, "memory_v0": 7832, "memory_v1": 15472, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 38.59, "input": "k,m=list(map(int,input().split()))\n\nl=[0 for i in range(k+1)]\n\nfor i in range(m):\n\n a,s=list(map(int,input().split()))\n\n l[a-1]+=1;l[s]-=1\n\nans=0\n\nf=0\n\nfor j in range(k):\n\n l[j]+=f\n\n f=l[j]\n\nprint((len([1 for i in l if i==m])))", "target": "n,m=list(map(int,input().split()))\n\ntable=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n table[l]+=1\n\n table[r+1]-=1\n\nfrom itertools import accumulate\n\nfrom collections import Counter as co\n\nvar=co((accumulate(table)))\n\n\n\nif m not in var:print((0))\n\nelse:print((var[m]))\n\n\n\n\n", "code_v0_loc": 11, "code_v1_loc": 14, "code_v0_num_chars": 217, "code_v1_num_chars": 290, "code_v0_no_empty_lines": "k, m = list(map(int, input().split()))\nl = [0 for i in range(k + 1)]\nfor i in range(m):\n a, s = list(map(int, input().split()))\n l[a - 1] += 1\n l[s] -= 1\nans = 0\nf = 0\nfor j in range(k):\n l[j] += f\n f = l[j]\nprint((len([1 for i in l if i == m])))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\ntable = [0] * (n + 2)\nfor i in range(m):\n l, r = list(map(int, input().split()))\n table[l] += 1\n table[r + 1] -= 1\nfrom itertools import accumulate\nfrom collections import Counter as co\n\nvar = co((accumulate(table)))\nif m not in var:\n print((0))\nelse:\n print((var[m]))\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-k, m = list(map(int, input().split()))", "-l = [0 for i in range(k + 1)]", "+n, m = list(map(int, input().split()))", "+table = [0] * (n + 2)", "- a, s = list(map(int, input().split()))", "- l[a - 1] += 1", "- l[s] -= 1", "-ans = 0", "-f = 0", "-for j in range(k):", "- l[j] += f", "- f = l[j]", "-print((len([1 for i in l if i == m])))", "+ l, r = list(map(int, input().split()))", "+ table[l] += 1", "+ table[r + 1] -= 1", "+from itertools import accumulate", "+from collections import Counter as co", "+", "+var = co((accumulate(table)))", "+if m not in var:", "+ print((0))", "+else:", "+ print((var[m]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4122046263, "measured_runtime_v1": 0.3202181025, "runtime_lift": 1.2872620978, "key": ["s129241236", "s743438543"], "target_token_count_dream": 86, "target_token_bucket_dream": "<128"} +{"user_id": "u025501820", "problem_id": "p02792", "language": "python", "submission_id_v0": "s746150122", "submission_id_v1": "s989284284", "cpu_time_v0": 318, "cpu_time_v1": 169, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.86, "input": "N = int(input())\n\ncount = [[0 for _ in range(9)] for _ in range(9)]\n\nfor i in range(1, N + 1):\n\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\n\nans = 0\n\nfor i in range(0, 9):\n\n for k in range(0, 9):\n\n ans += count[i][k] * count[k][i]\n\nprint(ans)", "target": "N = int(input())\n\nnums = [0 for i in range(100)]\n\nfor i in range(1, N + 1):\n\n i = str(i)\n\n nums[int(i[0] + i[-1])] += 1\n\nans = 0\n\nfor i in range(1, 10):\n\n for j in range(i, 10):\n\n i = str(i)\n\n j = str(j)\n\n if i != j:\n\n ans += nums[int(i + j)] * nums[int(j + i)] * 2\n\n else:\n\n n = nums[int(i + j)]\n\n ans += n * (n - 1)\n\n ans += n\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 17, "code_v0_num_chars": 316, "code_v1_num_chars": 421, "code_v0_no_empty_lines": "N = int(input())\ncount = [[0 for _ in range(9)] for _ in range(9)]\nfor i in range(1, N + 1):\n if str(i)[0] != \"0\" and str(i)[-1] != \"0\":\n count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1\nans = 0\nfor i in range(0, 9):\n for k in range(0, 9):\n ans += count[i][k] * count[k][i]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nnums = [0 for i in range(100)]\nfor i in range(1, N + 1):\n i = str(i)\n nums[int(i[0] + i[-1])] += 1\nans = 0\nfor i in range(1, 10):\n for j in range(i, 10):\n i = str(i)\n j = str(j)\n if i != j:\n ans += nums[int(i + j)] * nums[int(j + i)] * 2\n else:\n n = nums[int(i + j)]\n ans += n * (n - 1)\n ans += n\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.1764705882, "diff": ["-count = [[0 for _ in range(9)] for _ in range(9)]", "+nums = [0 for i in range(100)]", "- if str(i)[0] != \"0\" and str(i)[-1] != \"0\":", "- count[int(str(i)[0]) - 1][int(str(i)[-1]) - 1] += 1", "+ i = str(i)", "+ nums[int(i[0] + i[-1])] += 1", "-for i in range(0, 9):", "- for k in range(0, 9):", "- ans += count[i][k] * count[k][i]", "+for i in range(1, 10):", "+ for j in range(i, 10):", "+ i = str(i)", "+ j = str(j)", "+ if i != j:", "+ ans += nums[int(i + j)] * nums[int(j + i)] * 2", "+ else:", "+ n = nums[int(i + j)]", "+ ans += n * (n - 1)", "+ ans += n"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4702084679, "measured_runtime_v1": 0.3054097801, "runtime_lift": 1.5395985934, "key": ["s746150122", "s989284284"], "target_token_count_dream": 148, "target_token_bucket_dream": "128-256"} +{"user_id": "u588341295", "problem_id": "p03078", "language": "python", "submission_id_v0": "s622309249", "submission_id_v1": "s171509372", "cpu_time_v0": 118, "cpu_time_v1": 37, "memory_v0": 8728, "memory_v1": 4976, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 68.64, "input": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x // y))\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\nABC=[]\n\nfor i in range(X):\n\n for j in range(Y):\n\n if (i+1)*(j+1)>K:\n\n break\n\n for k in range(Z):\n\n if (i+1)*(j+1)*(k+1)>K:\n\n break\n\n ABC.append(A[i]+B[j]+C[k])\n\nABC.sort(reverse=True)\n\nfor i in range(K):\n\n print((ABC[i]))\n\n\n", "target": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\nfrom heapq import heappush, heappop\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x // y))\n\ndef INT(): return int(input())\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nX,Y,Z,K=MAP()\n\nA=sorted(LIST(), reverse=True)\n\nB=sorted(LIST(), reverse=True)\n\nC=sorted(LIST(), reverse=True)\n\n\n\n\n\nque=[]\n\nheappush(que, (-(A[0]+B[0]+C[0]), 0, 0, 0))\n\nS={(0,0,0)}\n\nfor i in range(K):\n\n ans=heappop(que)\n\n print((-ans[0]))\n\n a,b,c=ans[1:]\n\n if a+1 K:\n break\n for k in range(Z):\n if (i + 1) * (j + 1) * (k + 1) > K:\n break\n ABC.append(A[i] + B[j] + C[k])\nABC.sort(reverse=True)\nfor i in range(K):\n print((ABC[i]))\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\nfrom heapq import heappush, heappop\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x // y))\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nMOD = 10**9 + 7\nX, Y, Z, K = MAP()\nA = sorted(LIST(), reverse=True)\nB = sorted(LIST(), reverse=True)\nC = sorted(LIST(), reverse=True)\nque = []\nheappush(que, (-(A[0] + B[0] + C[0]), 0, 0, 0))\nS = {(0, 0, 0)}\nfor i in range(K):\n ans = heappop(que)\n print((-ans[0]))\n a, b, c = ans[1:]\n if a + 1 < X and (a + 1, b, c) not in S:\n heappush(que, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))\n S.add((a + 1, b, c))\n if b + 1 < Y and (a, b + 1, c) not in S:\n heappush(que, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))\n S.add((a, b + 1, c))\n if c + 1 < Z and (a, b, c + 1) not in S:\n heappush(que, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))\n S.add((a, b, c + 1))\n", "code_same": false, "relative_loc_diff_percent": 11.9047619048, "diff": ["+from heapq import heappush, heappop", "-ABC = []", "-for i in range(X):", "- for j in range(Y):", "- if (i + 1) * (j + 1) > K:", "- break", "- for k in range(Z):", "- if (i + 1) * (j + 1) * (k + 1) > K:", "- break", "- ABC.append(A[i] + B[j] + C[k])", "-ABC.sort(reverse=True)", "+que = []", "+heappush(que, (-(A[0] + B[0] + C[0]), 0, 0, 0))", "+S = {(0, 0, 0)}", "- print((ABC[i]))", "+ ans = heappop(que)", "+ print((-ans[0]))", "+ a, b, c = ans[1:]", "+ if a + 1 < X and (a + 1, b, c) not in S:", "+ heappush(que, (-(A[a + 1] + B[b] + C[c]), a + 1, b, c))", "+ S.add((a + 1, b, c))", "+ if b + 1 < Y and (a, b + 1, c) not in S:", "+ heappush(que, (-(A[a] + B[b + 1] + C[c]), a, b + 1, c))", "+ S.add((a, b + 1, c))", "+ if c + 1 < Z and (a, b, c + 1) not in S:", "+ heappush(que, (-(A[a] + B[b] + C[c + 1]), a, b, c + 1))", "+ S.add((a, b, c + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2840606916, "measured_runtime_v1": 0.2124910862, "runtime_lift": 1.3368122711, "key": ["s622309249", "s171509372"], "target_token_count_dream": 465, "target_token_bucket_dream": "256-512"} +{"user_id": "u216928054", "problem_id": "p02560", "language": "python", "submission_id_v0": "s978863609", "submission_id_v1": "s598945859", "cpu_time_v0": 297, "cpu_time_v1": 234, "memory_v0": 78412, "memory_v1": 70336, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.21, "input": "#!/usr/bin/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef floor_sum_1(n, m, a, b):\n\n ret = 0\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n\n return ret\n\n\n\n\n\ndef floor_sum(n, m, a, b):\n\n ret = 0\n\n while True:\n\n if a >= m:\n\n ret += (n - 1) * n * (a // m) // 2\n\n a %= m\n\n if b >= m:\n\n ret += n * (b // m)\n\n b %= m\n\n y_max = (a * n + b) // m\n\n x_max = y_max * m - b\n\n if y_max == 0:\n\n return ret\n\n ret += (n - (x_max + a - 1) // a) * y_max\n\n n = y_max\n\n m, a, b = a, m, (a - x_max % a) % a\n\n\n\n\n\ndef debug(*x):\n\n print(*x, file=sys.stderr)\n\n\n\n\n\ndef solve(SOLVE_PARAMS):\n\n pass\n\n\n\n\n\ndef main():\n\n # parse input\n\n T = int(input())\n\n for _t in range(T):\n\n N, M, A, B = map(int, input().split())\n\n print(floor_sum(N, M, A, B))\n\n\n\n\n\n# tests\n\nT1 = \"\"\"\n\n5\n\n4 10 6 3\n\n6 5 4 3\n\n1 1 0 0\n\n31415 92653 58979 32384\n\n1000000000 1000000000 999999999 999999999\n\n\"\"\"\n\nTEST_T1 = \"\"\"\n\n>>> as_input(T1)\n\n>>> main()\n\n3\n\n13\n\n0\n\n314095480\n\n499999999500000000\n\n\"\"\"\n\n\n\n\n\ndef _test():\n\n import doctest\n\n doctest.testmod()\n\n g = globals()\n\n for k in sorted(g):\n\n if k.startswith(\"TEST_\"):\n\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n f = io.StringIO(s.strip())\n\n g = globals()\n\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\n\n\n\ninput = sys.stdin.buffer.readline\n\nread = sys.stdin.buffer.read\n\n\n\nif sys.argv[-1] == \"-t\":\n\n print(\"testing\")\n\n _test()\n\n sys.exit()\n\n\n\nmain()\n", "code_v0_loc": 87, "code_v1_loc": 105, "code_v0_num_chars": 1613, "code_v1_num_chars": 2066, "code_v0_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\nsys.setrecursionlimit(10**6)\nINF = 10**9 + 1 # sys.maxsize # float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef floor_sum(n, m, a, b):\n ret = 0\n if a >= m:\n ret += (n - 1) * n * (a // m) // 2\n a %= m\n if b >= m:\n ret += n * (b // m)\n b %= m\n y_max = (a * n + b) // m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) // a) * y_max\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n return ret\n\n\ndef debug(*x):\n print(*x, file=sys.stderr)\n\n\ndef solve(SOLVE_PARAMS):\n pass\n\n\ndef main():\n # parse input\n T = int(input())\n for _t in range(T):\n N, M, A, B = map(int, input().split())\n print(floor_sum(N, M, A, B))\n\n\n# tests\nT1 = \"\"\"\n5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n\"\"\"\nTEST_T1 = \"\"\"\n>>> as_input(T1)\n>>> main()\n3\n13\n0\n314095480\n499999999500000000\n\"\"\"\n\n\ndef _test():\n import doctest\n\n doctest.testmod()\n g = globals()\n for k in sorted(g):\n if k.startswith(\"TEST_\"):\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\ndef as_input(s):\n \"use in test, use given string as input file\"\n import io\n\n f = io.StringIO(s.strip())\n g = globals()\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\ninput = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nif sys.argv[-1] == \"-t\":\n print(\"testing\")\n _test()\n sys.exit()\nmain()\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\nsys.setrecursionlimit(10**6)\nINF = 10**9 + 1 # sys.maxsize # float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef floor_sum_1(n, m, a, b):\n ret = 0\n if a >= m:\n ret += (n - 1) * n * (a // m) // 2\n a %= m\n if b >= m:\n ret += n * (b // m)\n b %= m\n y_max = (a * n + b) // m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) // a) * y_max\n ret += floor_sum(y_max, a, m, (a - x_max % a) % a)\n return ret\n\n\ndef floor_sum(n, m, a, b):\n ret = 0\n while True:\n if a >= m:\n ret += (n - 1) * n * (a // m) // 2\n a %= m\n if b >= m:\n ret += n * (b // m)\n b %= m\n y_max = (a * n + b) // m\n x_max = y_max * m - b\n if y_max == 0:\n return ret\n ret += (n - (x_max + a - 1) // a) * y_max\n n = y_max\n m, a, b = a, m, (a - x_max % a) % a\n\n\ndef debug(*x):\n print(*x, file=sys.stderr)\n\n\ndef solve(SOLVE_PARAMS):\n pass\n\n\ndef main():\n # parse input\n T = int(input())\n for _t in range(T):\n N, M, A, B = map(int, input().split())\n print(floor_sum(N, M, A, B))\n\n\n# tests\nT1 = \"\"\"\n5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n\"\"\"\nTEST_T1 = \"\"\"\n>>> as_input(T1)\n>>> main()\n3\n13\n0\n314095480\n499999999500000000\n\"\"\"\n\n\ndef _test():\n import doctest\n\n doctest.testmod()\n g = globals()\n for k in sorted(g):\n if k.startswith(\"TEST_\"):\n doctest.run_docstring_examples(g[k], g, name=k)\n\n\ndef as_input(s):\n \"use in test, use given string as input file\"\n import io\n\n f = io.StringIO(s.strip())\n g = globals()\n g[\"input\"] = lambda: bytes(f.readline(), \"ascii\")\n g[\"read\"] = lambda: bytes(f.read(), \"ascii\")\n\n\ninput = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nif sys.argv[-1] == \"-t\":\n print(\"testing\")\n _test()\n sys.exit()\nmain()\n", "code_same": false, "relative_loc_diff_percent": 17.1428571429, "diff": ["-def floor_sum(n, m, a, b):", "+def floor_sum_1(n, m, a, b):", "+", "+", "+def floor_sum(n, m, a, b):", "+ ret = 0", "+ while True:", "+ if a >= m:", "+ ret += (n - 1) * n * (a // m) // 2", "+ a %= m", "+ if b >= m:", "+ ret += n * (b // m)", "+ b %= m", "+ y_max = (a * n + b) // m", "+ x_max = y_max * m - b", "+ if y_max == 0:", "+ return ret", "+ ret += (n - (x_max + a - 1) // a) * y_max", "+ n = y_max", "+ m, a, b = a, m, (a - x_max % a) % a"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1788789105, "measured_runtime_v1": 0.0066359096, "runtime_lift": 26.9562007629, "key": ["s978863609", "s598945859"], "target_token_count_dream": 757, "target_token_bucket_dream": "512-1024"} +{"user_id": "u442877951", "problem_id": "p02881", "language": "python", "submission_id_v0": "s498895748", "submission_id_v1": "s605488454", "cpu_time_v0": 574, "cpu_time_v1": 295, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.61, "input": "import math\n\nN = int(input())\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = math.ceil(N/(i+1))\n\n if (1+i)*j == N:\n\n ans = min(i+j-1,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)", "target": "N = int(input())\n\nans = 10**12\n\nfor i in range(1,10**6+1):\n\n j = N//i\n\n if i*j == N:\n\n ans = min(i+j-2,ans)\n\n if i == 10**6 and ans == 10**12:\n\n ans = N-1\n\n break\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 217, "code_v1_num_chars": 186, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = 10**12\nfor i in range(1, 10**6 + 1):\n j = math.ceil(N / (i + 1))\n if (1 + i) * j == N:\n ans = min(i + j - 1, ans)\n if i == 10**6 and ans == 10**12:\n ans = N - 1\n break\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nans = 10**12\nfor i in range(1, 10**6 + 1):\n j = N // i\n if i * j == N:\n ans = min(i + j - 2, ans)\n if i == 10**6 and ans == 10**12:\n ans = N - 1\n break\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-import math", "-", "- j = math.ceil(N / (i + 1))", "- if (1 + i) * j == N:", "- ans = min(i + j - 1, ans)", "+ j = N // i", "+ if i * j == N:", "+ ans = min(i + j - 2, ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 3.3566168053, "measured_runtime_v1": 2.0076369724, "runtime_lift": 1.6719241832, "key": ["s498895748", "s605488454"], "target_token_count_dream": 85, "target_token_bucket_dream": "<128"} +{"user_id": "u864197622", "problem_id": "p02758", "language": "python", "submission_id_v0": "s598598719", "submission_id_v1": "s066197035", "cpu_time_v0": 1348, "cpu_time_v1": 954, "memory_v0": 102564, "memory_v1": 97192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.23, "input": "mod = 998244353\n\nN = int(input())\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\nmod = 998244353\n\nN = int(input())\n\nX = []\n\nfor _ in range(N):\n\n x, d = list(map(int, input().split()))\n\n X.append((x, x + d))\n\n\n\nX = sorted(X, key = lambda x: x[0])\n\nL = [(0, -(10**9+1), 10**9+1)]\n\nP = [-1] * (N+1)\n\nfor i, (x, y) in enumerate(X):\n\n while L[-1][2] <= y:\n\n if L[-1][2] > x and P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.pop()\n\n if P[i+1] < 0:\n\n P[i+1] = L[-1][0]\n\n L.append((i+1, x, y))\n\n\n\nC = [[] for _ in range(N+1)]\n\nfor i, p in enumerate(P):\n\n if p >= 0:\n\n C[p].append(i)\n\n\n\nY = [1] * (N+1)\n\nfor i in range(N+1)[::-1]:\n\n s = 1\n\n for j in C[i]:\n\n s = s * (Y[j] + 1) % mod\n\n Y[i] = s\n\n\n\nprint((Y[0]))", "code_v0_loc": 32, "code_v1_loc": 35, "code_v0_num_chars": 675, "code_v1_num_chars": 717, "code_v0_no_empty_lines": "mod = 998244353\nN = int(input())\nX = []\nfor _ in range(N):\n x, d = list(map(int, input().split()))\n X.append((x, x + d))\nX = sorted(X, key=lambda x: x[0])\nL = [(0, -(10**9 + 1), 10**9 + 1)]\nP = [-1] * (N + 1)\nfor i, (x, y) in enumerate(X):\n while L[-1][2] <= y:\n if L[-1][2] > x and P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.pop()\n if P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.append((i + 1, x, y))\nC = [[] for _ in range(N + 1)]\nfor i, p in enumerate(P):\n if p >= 0:\n C[p].append(i)\nY = [1] * (N + 1)\nfor i in range(N + 1)[::-1]:\n s = 1\n for j in C[i]:\n s = s * (Y[j] + 1) % mod\n Y[i] = s\nprint((Y[0]))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nmod = 998244353\nN = int(input())\nX = []\nfor _ in range(N):\n x, d = list(map(int, input().split()))\n X.append((x, x + d))\nX = sorted(X, key=lambda x: x[0])\nL = [(0, -(10**9 + 1), 10**9 + 1)]\nP = [-1] * (N + 1)\nfor i, (x, y) in enumerate(X):\n while L[-1][2] <= y:\n if L[-1][2] > x and P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.pop()\n if P[i + 1] < 0:\n P[i + 1] = L[-1][0]\n L.append((i + 1, x, y))\nC = [[] for _ in range(N + 1)]\nfor i, p in enumerate(P):\n if p >= 0:\n C[p].append(i)\nY = [1] * (N + 1)\nfor i in range(N + 1)[::-1]:\n s = 1\n for j in C[i]:\n s = s * (Y[j] + 1) % mod\n Y[i] = s\nprint((Y[0]))\n", "code_same": false, "relative_loc_diff_percent": 8.5714285714, "diff": ["+import sys", "+", "+input = sys.stdin.readline"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2547301891, "measured_runtime_v1": 0.0065454967, "runtime_lift": 38.9168615134, "key": ["s598598719", "s066197035"], "target_token_count_dream": 300, "target_token_bucket_dream": "256-512"} +{"user_id": "u539692012", "problem_id": "p02622", "language": "python", "submission_id_v0": "s511745855", "submission_id_v1": "s953276742", "cpu_time_v0": 78, "cpu_time_v1": 44, "memory_v0": 68212, "memory_v1": 9464, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.59, "input": "print((sum(si != ti for si, ti in zip(input(), input()))))\n", "target": "print((sum(a!=b for a,b in zip(*open(0)))))", "code_v0_loc": 1, "code_v1_loc": 1, "code_v0_num_chars": 57, "code_v1_num_chars": 41, "code_v0_no_empty_lines": "print((sum(si != ti for si, ti in zip(input(), input()))))\n", "code_v1_no_empty_lines": "print((sum(a != b for a, b in zip(*open(0)))))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-print((sum(si != ti for si, ti in zip(input(), input()))))", "+print((sum(a != b for a, b in zip(*open(0)))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3334237881, "measured_runtime_v1": 0.1220404458, "runtime_lift": 2.7320761232, "key": ["s511745855", "s953276742"], "target_token_count_dream": 17, "target_token_bucket_dream": "<128"} +{"user_id": "u540631540", "problem_id": "p02767", "language": "python", "submission_id_v0": "s304816826", "submission_id_v1": "s138180908", "cpu_time_v0": 22, "cpu_time_v1": 19, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.64, "input": "n = int(input())\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n # else:\n\n # break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)", "target": "n = int(input())\n\nx = [int(i) for i in input().split()]\n\np = 10000000\n\nfor i in range(100):\n\n pi = 0\n\n for j in range(n):\n\n pi += (x[j] - (i + 1))**2\n\n if pi < p:\n\n p = pi\n\n else:\n\n break\n\n # p[i] += (x[j]-(i+1))**2\n\nprint(p)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 269, "code_v1_num_chars": 265, "code_v0_no_empty_lines": "n = int(input())\nx = [int(i) for i in input().split()]\np = 10000000\nfor i in range(100):\n pi = 0\n for j in range(n):\n pi += (x[j] - (i + 1)) ** 2\n if pi < p:\n p = pi\n # else:\n # break\n # p[i] += (x[j]-(i+1))**2\nprint(p)\n", "code_v1_no_empty_lines": "n = int(input())\nx = [int(i) for i in input().split()]\np = 10000000\nfor i in range(100):\n pi = 0\n for j in range(n):\n pi += (x[j] - (i + 1)) ** 2\n if pi < p:\n p = pi\n else:\n break\n # p[i] += (x[j]-(i+1))**2\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- # else:", "- # break", "- # p[i] += (x[j]-(i+1))**2", "+ else:", "+ break", "+ # p[i] += (x[j]-(i+1))**2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.18753242, "measured_runtime_v1": 0.0060767163, "runtime_lift": 30.860815536, "key": ["s304816826", "s138180908"], "target_token_count_dream": 107, "target_token_bucket_dream": "<128"} +{"user_id": "u297574184", "problem_id": "p02792", "language": "python", "submission_id_v0": "s401307257", "submission_id_v1": "s179676165", "cpu_time_v0": 236, "cpu_time_v1": 18, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.37, "input": "def solve():\n\n N = int(input())\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, 5):\n\n for i in range(10**d):\n\n j = x*10**(d+1) + i*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n else:\n\n break\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for A in range(1, N+1):\n\n ss = str(A)\n\n ans += numss[int(ss[-1])][int(ss[0])]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n", "target": "def solve():\n\n strN = input()\n\n N = int(strN)\n\n\n\n maxD = len(strN)\n\n\n\n numss = [[0]*(10) for _ in range(10)]\n\n for x in range(1, 10):\n\n for y in range(1, 10):\n\n num = 0\n\n for d in range(1, maxD-2):\n\n num += 10**d\n\n if maxD-2 > 0:\n\n if x < int(strN[0]):\n\n num += 10**(maxD-2)\n\n elif x == int(strN[0]):\n\n num += int(strN[1:-1]) + 1\n\n if y > int(strN[-1]):\n\n num -= 1\n\n j = x*10 + y\n\n if 1 <= j <= N:\n\n num += 1\n\n if x == y:\n\n j = x\n\n if 1 <= j <= N:\n\n num += 1\n\n numss[x][y] = num\n\n\n\n ans = 0\n\n for i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += numss[i][j]*numss[j][i]\n\n\n\n print(ans)\n\n\n\n\n\nsolve()\n", "code_v0_loc": 32, "code_v1_loc": 37, "code_v0_num_chars": 778, "code_v1_num_chars": 917, "code_v0_no_empty_lines": "def solve():\n N = int(input())\n numss = [[0] * (10) for _ in range(10)]\n for x in range(1, 10):\n for y in range(1, 10):\n num = 0\n for d in range(1, 5):\n for i in range(10**d):\n j = x * 10 ** (d + 1) + i * 10 + y\n if 1 <= j <= N:\n num += 1\n else:\n break\n j = x * 10 + y\n if 1 <= j <= N:\n num += 1\n if x == y:\n j = x\n if 1 <= j <= N:\n num += 1\n numss[x][y] = num\n ans = 0\n for A in range(1, N + 1):\n ss = str(A)\n ans += numss[int(ss[-1])][int(ss[0])]\n print(ans)\n\n\nsolve()\n", "code_v1_no_empty_lines": "def solve():\n strN = input()\n N = int(strN)\n maxD = len(strN)\n numss = [[0] * (10) for _ in range(10)]\n for x in range(1, 10):\n for y in range(1, 10):\n num = 0\n for d in range(1, maxD - 2):\n num += 10**d\n if maxD - 2 > 0:\n if x < int(strN[0]):\n num += 10 ** (maxD - 2)\n elif x == int(strN[0]):\n num += int(strN[1:-1]) + 1\n if y > int(strN[-1]):\n num -= 1\n j = x * 10 + y\n if 1 <= j <= N:\n num += 1\n if x == y:\n j = x\n if 1 <= j <= N:\n num += 1\n numss[x][y] = num\n ans = 0\n for i in range(1, 10):\n for j in range(1, 10):\n ans += numss[i][j] * numss[j][i]\n print(ans)\n\n\nsolve()\n", "code_same": false, "relative_loc_diff_percent": 13.5135135135, "diff": ["- N = int(input())", "+ strN = input()", "+ N = int(strN)", "+ maxD = len(strN)", "- for d in range(1, 5):", "- for i in range(10**d):", "- j = x * 10 ** (d + 1) + i * 10 + y", "- if 1 <= j <= N:", "- num += 1", "- else:", "- break", "+ for d in range(1, maxD - 2):", "+ num += 10**d", "+ if maxD - 2 > 0:", "+ if x < int(strN[0]):", "+ num += 10 ** (maxD - 2)", "+ elif x == int(strN[0]):", "+ num += int(strN[1:-1]) + 1", "+ if y > int(strN[-1]):", "+ num -= 1", "- for A in range(1, N + 1):", "- ss = str(A)", "- ans += numss[int(ss[-1])][int(ss[0])]", "+ for i in range(1, 10):", "+ for j in range(1, 10):", "+ ans += numss[i][j] * numss[j][i]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3220527915, "measured_runtime_v1": 0.2179562147, "runtime_lift": 1.4776031599, "key": ["s401307257", "s179676165"], "target_token_count_dream": 282, "target_token_bucket_dream": "256-512"} +{"user_id": "u777923818", "problem_id": "p03086", "language": "python", "submission_id_v0": "s716593637", "submission_id_v1": "s955967436", "cpu_time_v0": 22, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.73, "input": "# -*- coding: utf-8 -*-\n\nfrom collections import deque\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nS = input()\n\nA = set(\"ATCG\")\n\nans = 0\n\nmode = 0\n\nfor i, s in enumerate(S):\n\n if s in A:\n\n if mode == 0:\n\n mode = 1\n\n start = i\n\n else:\n\n if mode == 1:\n\n ans = max(i - start, ans)\n\n mode = 0\n\nif mode == 1:\n\n ans = max(len(S) - start, ans)\n\nprint(ans)", "target": "def inpl(): return list(map(int, input().split()))\n\nS = input()\n\nC = set(\"ACGT\")\n\n\n\ntmp = 0\n\nans = 0\n\n\n\nfor s in S:\n\n if s in C:\n\n tmp += 1\n\n else:\n\n ans = max(ans, tmp)\n\n tmp = 0\n\nans = max(ans, tmp)\n\nprint(ans)", "code_v0_loc": 20, "code_v1_loc": 15, "code_v0_num_chars": 426, "code_v1_num_chars": 239, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nfrom collections import deque\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\nS = input()\nA = set(\"ATCG\")\nans = 0\nmode = 0\nfor i, s in enumerate(S):\n if s in A:\n if mode == 0:\n mode = 1\n start = i\n else:\n if mode == 1:\n ans = max(i - start, ans)\n mode = 0\nif mode == 1:\n ans = max(len(S) - start, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "def inpl():\n return list(map(int, input().split()))\n\n\nS = input()\nC = set(\"ACGT\")\ntmp = 0\nans = 0\nfor s in S:\n if s in C:\n tmp += 1\n else:\n ans = max(ans, tmp)\n tmp = 0\nans = max(ans, tmp)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-# -*- coding: utf-8 -*-", "-from collections import deque", "-", "-", "-A = set(\"ATCG\")", "+C = set(\"ACGT\")", "+tmp = 0", "-mode = 0", "-for i, s in enumerate(S):", "- if s in A:", "- if mode == 0:", "- mode = 1", "- start = i", "+for s in S:", "+ if s in C:", "+ tmp += 1", "- if mode == 1:", "- ans = max(i - start, ans)", "- mode = 0", "-if mode == 1:", "- ans = max(len(S) - start, ans)", "+ ans = max(ans, tmp)", "+ tmp = 0", "+ans = max(ans, tmp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1640799, "measured_runtime_v1": 0.006362747, "runtime_lift": 25.7875884356, "key": ["s716593637", "s955967436"], "target_token_count_dream": 79, "target_token_bucket_dream": "<128"} +{"user_id": "u854690176", "problem_id": "p02952", "language": "python", "submission_id_v0": "s720457111", "submission_id_v1": "s185706611", "cpu_time_v0": 60, "cpu_time_v1": 51, "memory_v0": 2940, "memory_v1": 6732, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N = int(input())\n\nans = 0\n\nfor i in range(1, N + 1):\n\n if len(str(i)) % 2 == 1:\n\n ans += 1\n\nprint(ans)", "target": "N = int(input())\n\nprint((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))", "code_v0_loc": 6, "code_v1_loc": 2, "code_v0_num_chars": 112, "code_v1_num_chars": 91, "code_v0_no_empty_lines": "N = int(input())\nans = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 == 1:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nprint((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-ans = 0", "-for i in range(1, N + 1):", "- if len(str(i)) % 2 == 1:", "- ans += 1", "-print(ans)", "+print((len(list([x for x in range(1, N + 1) if len(str(x)) % 2 == 1]))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1607959216, "measured_runtime_v1": 0.006350698, "runtime_lift": 25.3194092141, "key": ["s720457111", "s185706611"], "target_token_count_dream": 36, "target_token_bucket_dream": "<128"} +{"user_id": "u282228874", "problem_id": "p03353", "language": "python", "submission_id_v0": "s703764972", "submission_id_v1": "s575406884", "cpu_time_v0": 39, "cpu_time_v1": 34, "memory_v0": 4976, "memory_v1": 4592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.82, "input": "S = input()\n\nk = int(input())\n\nA = set()\n\nfor l in range(k+1):\n\n\tfor i in range(len(S)-l):\n\n\t\t\tA.add(S[i:i+l+1])\n\nA = sorted(list(A))\n\nprint((A[k-1]))", "target": "S = input()\n\nl = len(S)\n\nd = set()\n\nK = int(input())\n\nfor i in range(5):\n\n for j in range(l-i):\n\n d.add(S[j:j+i+1])\n\nD = sorted(list(d))\n\nprint((D[K-1]))", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 148, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "S = input()\nk = int(input())\nA = set()\nfor l in range(k + 1):\n for i in range(len(S) - l):\n A.add(S[i : i + l + 1])\nA = sorted(list(A))\nprint((A[k - 1]))\n", "code_v1_no_empty_lines": "S = input()\nl = len(S)\nd = set()\nK = int(input())\nfor i in range(5):\n for j in range(l - i):\n d.add(S[j : j + i + 1])\nD = sorted(list(d))\nprint((D[K - 1]))\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-k = int(input())", "-A = set()", "-for l in range(k + 1):", "- for i in range(len(S) - l):", "- A.add(S[i : i + l + 1])", "-A = sorted(list(A))", "-print((A[k - 1]))", "+l = len(S)", "+d = set()", "+K = int(input())", "+for i in range(5):", "+ for j in range(l - i):", "+ d.add(S[j : j + i + 1])", "+D = sorted(list(d))", "+print((D[K - 1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2549800012, "measured_runtime_v1": 0.1151928709, "runtime_lift": 2.2135050485, "key": ["s703764972", "s575406884"], "target_token_count_dream": 56, "target_token_bucket_dream": "<128"} +{"user_id": "u047796752", "problem_id": "p02693", "language": "python", "submission_id_v0": "s690438210", "submission_id_v1": "s726211396", "cpu_time_v0": 69, "cpu_time_v1": 61, "memory_v0": 64680, "memory_v1": 61880, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.59, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nK = int(input())\n\nA, B = list(map(int, input().split()))\n\n\n\nfor i in range(A, B+1):\n\n if i%K==0:\n\n print('OK')\n\n exit()\n\n \n\nprint('NG')", "target": "K = int(input())\n\nA, B = list(map(int, input().split()))\n\n\n\nif (A-1)//K!=B//K:\n\n print('OK')\n\nelse:\n\n print('NG')", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 218, "code_v1_num_chars": 113, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\nK = int(input())\nA, B = list(map(int, input().split()))\nfor i in range(A, B + 1):\n if i % K == 0:\n print(\"OK\")\n exit()\nprint(\"NG\")\n", "code_v1_no_empty_lines": "K = int(input())\nA, B = list(map(int, input().split()))\nif (A - 1) // K != B // K:\n print(\"OK\")\nelse:\n print(\"NG\")\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-from collections import *", "-", "-for i in range(A, B + 1):", "- if i % K == 0:", "- print(\"OK\")", "- exit()", "-print(\"NG\")", "+if (A - 1) // K != B // K:", "+ print(\"OK\")", "+else:", "+ print(\"NG\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2312573931, "measured_runtime_v1": 0.006134352, "runtime_lift": 37.6987486082, "key": ["s690438210", "s726211396"], "target_token_count_dream": 42, "target_token_bucket_dream": "<128"} +{"user_id": "u803848678", "problem_id": "p03558", "language": "python", "submission_id_v0": "s650935446", "submission_id_v1": "s013593877", "cpu_time_v0": 647, "cpu_time_v1": 206, "memory_v0": 80204, "memory_v1": 46940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 68.16, "input": "from heapq import heappush, heappop\n\nk = int(input())\n\n\n\nheap = [(1,1)]\n\ndist = [float(\"inf\")]*k\n\nwhile heap:\n\n cost, cur = heappop(heap)\n\n if dist[cur] <= cost:\n\n continue\n\n dist[cur] = cost\n\n # +1\n\n nxt = (cur+1)%k\n\n heappush(heap, (cost+1, nxt))\n\n # *10\n\n nxt = cur*10 % k\n\n heappush(heap, (cost, nxt))\n\n\n\nprint((dist[0]))", "target": "from collections import deque\n\nk = int(input())\n\n\n\nque = deque()\n\nque.append((1,1))\n\ndist = [float(\"inf\")]*k\n\nwhile que:\n\n cost, cur = que.popleft()\n\n if dist[cur] <= cost:\n\n continue\n\n dist[cur] = cost\n\n # +1\n\n nxt = (cur+1)%k\n\n que.append((cost+1,nxt))\n\n # *10\n\n nxt = cur*10 % k\n\n que.appendleft((cost, nxt))\n\nprint((dist[0]))", "code_v0_loc": 18, "code_v1_loc": 18, "code_v0_num_chars": 357, "code_v1_num_chars": 361, "code_v0_no_empty_lines": "from heapq import heappush, heappop\n\nk = int(input())\nheap = [(1, 1)]\ndist = [float(\"inf\")] * k\nwhile heap:\n cost, cur = heappop(heap)\n if dist[cur] <= cost:\n continue\n dist[cur] = cost\n # +1\n nxt = (cur + 1) % k\n heappush(heap, (cost + 1, nxt))\n # *10\n nxt = cur * 10 % k\n heappush(heap, (cost, nxt))\nprint((dist[0]))\n", "code_v1_no_empty_lines": "from collections import deque\n\nk = int(input())\nque = deque()\nque.append((1, 1))\ndist = [float(\"inf\")] * k\nwhile que:\n cost, cur = que.popleft()\n if dist[cur] <= cost:\n continue\n dist[cur] = cost\n # +1\n nxt = (cur + 1) % k\n que.append((cost + 1, nxt))\n # *10\n nxt = cur * 10 % k\n que.appendleft((cost, nxt))\nprint((dist[0]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-from heapq import heappush, heappop", "+from collections import deque", "-heap = [(1, 1)]", "+que = deque()", "+que.append((1, 1))", "-while heap:", "- cost, cur = heappop(heap)", "+while que:", "+ cost, cur = que.popleft()", "- heappush(heap, (cost + 1, nxt))", "+ que.append((cost + 1, nxt))", "- heappush(heap, (cost, nxt))", "+ que.appendleft((cost, nxt))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7778599041, "measured_runtime_v1": 0.4842932501, "runtime_lift": 1.6061753987, "key": ["s650935446", "s013593877"], "target_token_count_dream": 118, "target_token_bucket_dream": "<128"} +{"user_id": "u853010060", "problem_id": "p02921", "language": "python", "submission_id_v0": "s066833687", "submission_id_v1": "s453964878", "cpu_time_v0": 21, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.05, "input": "S = input()\n\nT = input()\n\n\n\nl = len(S)\n\nres = 0\n\nfor n in range(l):\n\n if S[n] == T[n]:\n\n res += 1\n\nprint(res)", "target": "S = input()\n\nT = input()\n\nl = len(S)\n\nans = 0\n\nfor n in range(l):\n\n if S[n] == T[n]:\n\n ans += 1\n\nprint(ans)\n", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 119, "code_v1_num_chars": 118, "code_v0_no_empty_lines": "S = input()\nT = input()\nl = len(S)\nres = 0\nfor n in range(l):\n if S[n] == T[n]:\n res += 1\nprint(res)\n", "code_v1_no_empty_lines": "S = input()\nT = input()\nl = len(S)\nans = 0\nfor n in range(l):\n if S[n] == T[n]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-res = 0", "+ans = 0", "- res += 1", "-print(res)", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3049550076, "measured_runtime_v1": 0.2412325363, "runtime_lift": 1.2641537174, "key": ["s066833687", "s453964878"], "target_token_count_dream": 42, "target_token_bucket_dream": "<128"} +{"user_id": "u884323674", "problem_id": "p03371", "language": "python", "submission_id_v0": "s486102959", "submission_id_v1": "s507293588", "cpu_time_v0": 228, "cpu_time_v1": 129, "memory_v0": 3064, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.42, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nmax_iter = max(X, Y) * 2\n\nans = float(\"inf\")\n\nfor i in range(max_iter):\n\n a = max(X - i, 0)\n\n b = max(Y - i, 0)\n\n price = 2*C * i + A * a + B * b\n\n ans = min(ans, price)\n\n\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\n\n\nans = float(\"inf\")\n\nfor i in range(max(X, Y)+1):\n\n x = max(X - i, 0)\n\n y = max(Y - i, 0)\n\n cost = 2*C * i + A * x + B * y\n\n ans = min(ans, cost)\n\n\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 240, "code_v1_num_chars": 215, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nmax_iter = max(X, Y) * 2\nans = float(\"inf\")\nfor i in range(max_iter):\n a = max(X - i, 0)\n b = max(Y - i, 0)\n price = 2 * C * i + A * a + B * b\n ans = min(ans, price)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(max(X, Y) + 1):\n x = max(X - i, 0)\n y = max(Y - i, 0)\n cost = 2 * C * i + A * x + B * y\n ans = min(ans, cost)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-max_iter = max(X, Y) * 2", "-for i in range(max_iter):", "- a = max(X - i, 0)", "- b = max(Y - i, 0)", "- price = 2 * C * i + A * a + B * b", "- ans = min(ans, price)", "+for i in range(max(X, Y) + 1):", "+ x = max(X - i, 0)", "+ y = max(Y - i, 0)", "+ cost = 2 * C * i + A * x + B * y", "+ ans = min(ans, cost)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4454369638, "measured_runtime_v1": 0.3371012073, "runtime_lift": 1.321374573, "key": ["s486102959", "s507293588"], "target_token_count_dream": 86, "target_token_bucket_dream": "<128"} +{"user_id": "u020390084", "problem_id": "p03309", "language": "python", "submission_id_v0": "s289814925", "submission_id_v1": "s781437429", "cpu_time_v0": 334, "cpu_time_v1": 258, "memory_v0": 27244, "memory_v1": 36640, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.75, "input": "import math\n\nimport statistics\n\nn = int(input())\n\na = list(map(int,input().split()))\n\na = [aa-i-1 for i, aa in enumerate(a)]\n\nanswer = n*10**20\n\nmedian_low = statistics.median_low(a)\n\nmedian_high = statistics.median_high(a)\n\n\n\nfor m in (median_low,median_high):\n\n ans=0\n\n for aa in a:\n\n ans += abs(aa-m)\n\n answer = min(ans,answer)\n\nprint(answer)\n", "target": "#!/usr/bin/env python3\n\nimport sys\n\n\n\n\n\ndef solve(N: int, A: \"List[int]\"):\n\n difA = [0]*N\n\n\n\n for i in range(N):\n\n difA[i] = A[i]-(i+1)\n\n\n\n difA.sort()\n\n if N%2 == 0:\n\n g1 = difA[N//2]\n\n g2 = difA[N//2-1]\n\n a1 = 0\n\n a2 = 0\n\n for i in range(N):\n\n a1 += abs(difA[i]-g1)\n\n a2 += abs(difA[i]-g2)\n\n print((min(a1,a2)))\n\n \n\n else:\n\n g = difA[N//2]\n\n a = 0\n\n for i in range(N):\n\n a += abs(difA[i]-g)\n\n print(a)\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, A)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 15, "code_v1_loc": 42, "code_v0_num_chars": 352, "code_v1_num_chars": 891, "code_v0_no_empty_lines": "import math\nimport statistics\n\nn = int(input())\na = list(map(int, input().split()))\na = [aa - i - 1 for i, aa in enumerate(a)]\nanswer = n * 10**20\nmedian_low = statistics.median_low(a)\nmedian_high = statistics.median_high(a)\nfor m in (median_low, median_high):\n ans = 0\n for aa in a:\n ans += abs(aa - m)\n answer = min(ans, answer)\nprint(answer)\n", "code_v1_no_empty_lines": "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int, A: \"List[int]\"):\n difA = [0] * N\n for i in range(N):\n difA[i] = A[i] - (i + 1)\n difA.sort()\n if N % 2 == 0:\n g1 = difA[N // 2]\n g2 = difA[N // 2 - 1]\n a1 = 0\n a2 = 0\n for i in range(N):\n a1 += abs(difA[i] - g1)\n a2 += abs(difA[i] - g2)\n print((min(a1, a2)))\n else:\n g = difA[N // 2]\n a = 0\n for i in range(N):\n a += abs(difA[i] - g)\n print(a)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, A)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 64.2857142857, "diff": ["-import math", "-import statistics", "+#!/usr/bin/env python3", "+import sys", "-n = int(input())", "-a = list(map(int, input().split()))", "-a = [aa - i - 1 for i, aa in enumerate(a)]", "-answer = n * 10**20", "-median_low = statistics.median_low(a)", "-median_high = statistics.median_high(a)", "-for m in (median_low, median_high):", "- ans = 0", "- for aa in a:", "- ans += abs(aa - m)", "- answer = min(ans, answer)", "-print(answer)", "+", "+def solve(N: int, A: \"List[int]\"):", "+ difA = [0] * N", "+ for i in range(N):", "+ difA[i] = A[i] - (i + 1)", "+ difA.sort()", "+ if N % 2 == 0:", "+ g1 = difA[N // 2]", "+ g2 = difA[N // 2 - 1]", "+ a1 = 0", "+ a2 = 0", "+ for i in range(N):", "+ a1 += abs(difA[i] - g1)", "+ a2 += abs(difA[i] - g2)", "+ print((min(a1, a2)))", "+ else:", "+ g = difA[N // 2]", "+ a = 0", "+ for i in range(N):", "+ a += abs(difA[i] - g)", "+ print(a)", "+ return", "+", "+", "+def main():", "+ def iterate_tokens():", "+ for line in sys.stdin:", "+ for word in line.split():", "+ yield word", "+", "+ tokens = iterate_tokens()", "+ N = int(next(tokens)) # type: int", "+ A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"", "+ solve(N, A)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2912476273, "measured_runtime_v1": 0.217194303, "runtime_lift": 1.3409542662, "key": ["s289814925", "s781437429"], "target_token_count_dream": 275, "target_token_bucket_dream": "256-512"} +{"user_id": "u982896977", "problem_id": "p03371", "language": "python", "submission_id_v0": "s299972417", "submission_id_v1": "s929413776", "cpu_time_v0": 102, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.33, "input": "a,b,c,x,y = list(map(int,input().split()))\n\nans = a*x + b*y\n\nfor i in range(max(x,y) + 1):\n\n\tmoney = max(0,(x-i)*a) + max(0,(y-i)*b) + 2*i*c\n\n\tif money <= ans:\n\n\t\tans = money\n\nprint(ans)", "target": "a,b,c,x,y = list(map(int,input().split()))\n\nif a + b >= 2*c:\n\n\tif x >= y:\n\n\t\tans = 2*y*c + (x-y)*min(a,2*c)\n\n\telse:\n\n\t\tans = 2*x*c + (y-x)*min(b,2*c)\n\nelse:\n\n\tans = (x*a + y*b)\n\nprint(ans)", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 180, "code_v1_num_chars": 182, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nfor i in range(max(x, y) + 1):\n money = max(0, (x - i) * a) + max(0, (y - i) * b) + 2 * i * c\n if money <= ans:\n ans = money\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nif a + b >= 2 * c:\n if x >= y:\n ans = 2 * y * c + (x - y) * min(a, 2 * c)\n else:\n ans = 2 * x * c + (y - x) * min(b, 2 * c)\nelse:\n ans = x * a + y * b\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-ans = a * x + b * y", "-for i in range(max(x, y) + 1):", "- money = max(0, (x - i) * a) + max(0, (y - i) * b) + 2 * i * c", "- if money <= ans:", "- ans = money", "+if a + b >= 2 * c:", "+ if x >= y:", "+ ans = 2 * y * c + (x - y) * min(a, 2 * c)", "+ else:", "+ ans = 2 * x * c + (y - x) * min(b, 2 * c)", "+else:", "+ ans = x * a + y * b"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3295188012, "measured_runtime_v1": 0.2310098734, "runtime_lift": 1.4264273486, "key": ["s299972417", "s929413776"], "target_token_count_dream": 79, "target_token_bucket_dream": "<128"} +{"user_id": "u340781749", "problem_id": "p02680", "language": "python", "submission_id_v0": "s341076610", "submission_id_v1": "s034276815", "cpu_time_v0": 2314, "cpu_time_v1": 1930, "memory_v0": 1000052, "memory_v1": 915508, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.59, "input": "import sys\n\n# from itertools import chain, accumulate\n\n\n\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\n\n\n\nver_lines = []\n\nhor_lines = []\n\nx_list = set()\n\ny_list = set()\n\nn3 = n * 3\n\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n\n y_list.add(a)\n\n y_list.add(b)\n\n x_list.add(c)\n\n ver_lines.append((a, b, c))\n\n\n\nfor d, e, f in zip(abcdef[n3 + 0::3], abcdef[n3 + 1::3], abcdef[n3 + 2::3]):\n\n y_list.add(d)\n\n x_list.add(e)\n\n x_list.add(f)\n\n hor_lines.append((d, e, f))\n\nx_list.add(0)\n\ny_list.add(0)\n\n\n\nx_list = sorted(x_list)\n\ny_list = sorted(y_list)\n\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\n\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\n\nrow_real = len(x_list)\n\ncol_real = len(y_list)\n\nrow = row_real + 2\n\ncol = col_real + 2\n\nbanned_up_ij = [[0] * row for _ in range(col)]\n\nbanned_down_ij = [[0] * row for _ in range(col)]\n\nbanned_left_ij = [[0] * col for _ in range(row)]\n\nbanned_right_ij = [[0] * col for _ in range(row)]\n\nfor a, b, c in ver_lines:\n\n if a > b:\n\n a, b = b, a\n\n ai = y_dict[a]\n\n bi = y_dict[b]\n\n j = x_dict[c]\n\n banned_left_ij[j][ai] += 1\n\n banned_left_ij[j][bi] -= 1\n\n banned_right_ij[j - 1][ai] += 1\n\n banned_right_ij[j - 1][bi] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n i = y_dict[d]\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up_ij[i][ej] += 1\n\n banned_up_ij[i][fj] -= 1\n\n banned_down_ij[i - 1][ej] += 1\n\n banned_down_ij[i - 1][fj] -= 1\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor i in range(col):\n\n ru = banned_up_ij[i]\n\n rd = banned_down_ij[i]\n\n ri = row * i\n\n banned_up[ri] = ru[0]\n\n banned_down[ri] = rd[0]\n\n for j in range(1, row):\n\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\n\nfor j in range(row):\n\n rl = banned_left_ij[j]\n\n rr = banned_right_ij[j]\n\n banned_left[j] = rl[0]\n\n banned_right[j] = rr[0]\n\n for i in range(1, col):\n\n ri0 = (i - 1) * row\n\n ri1 = i * row\n\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n", "target": "import sys\n\n\n\n# from itertools import chain, accumulate\n\n\n\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\n\n\n\nver_lines = []\n\nhor_lines = []\n\nx_list = set()\n\ny_list = set()\n\nn3 = n * 3\n\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n\n y_list.add(a)\n\n y_list.add(b)\n\n x_list.add(c)\n\n ver_lines.append((a, b, c))\n\n\n\nfor d, e, f in zip(abcdef[n3 + 0::3], abcdef[n3 + 1::3], abcdef[n3 + 2::3]):\n\n y_list.add(d)\n\n x_list.add(e)\n\n x_list.add(f)\n\n hor_lines.append((d, e, f))\n\nx_list.add(0)\n\ny_list.add(0)\n\n\n\nx_list = sorted(x_list)\n\ny_list = sorted(y_list)\n\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\n\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\n\nrow_real = len(x_list)\n\ncol_real = len(y_list)\n\nrow = row_real + 2\n\ncol = col_real + 2\n\n\n\nbanned_up = [0] * (row * col)\n\nbanned_down = [0] * (row * col)\n\nbanned_left = [0] * (row * col)\n\nbanned_right = [0] * (row * col)\n\nfor a, b, c in ver_lines:\n\n if a > b:\n\n a, b = b, a\n\n ai = y_dict[a] * row\n\n bi = y_dict[b] * row\n\n j = x_dict[c]\n\n banned_left[ai + j] += 1\n\n banned_left[bi + j] -= 1\n\n banned_right[ai + j - 1] += 1\n\n banned_right[bi + j - 1] -= 1\n\nfor d, e, f in hor_lines:\n\n if e > f:\n\n e, f = f, e\n\n ri = y_dict[d] * row\n\n ej = x_dict[e]\n\n fj = x_dict[f]\n\n banned_up[ri + ej] += 1\n\n banned_up[ri + fj] -= 1\n\n banned_down[ri - row + ej] += 1\n\n banned_down[ri - row + fj] -= 1\n\n\n\nfor i in range(1, col):\n\n ri0 = row * (i - 1)\n\n ri1 = row * i\n\n for j in range(1, row):\n\n banned_up[ri1 + j] += banned_up[ri1 + j - 1]\n\n banned_down[ri1 + j] += banned_down[ri1 + j - 1]\n\n banned_left[ri1 + j] += banned_left[ri0 + j]\n\n banned_right[ri1 + j] += banned_right[ri0 + j]\n\n\n\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n\n\n\n# for i in range(col):\n\n# print(walls[i * row:(i + 1) * row])\n\n\n\ns = row * y_dict[0] + x_dict[0]\n\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n\n\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\nq = [s]\n\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\n\nwhile q:\n\n c = q.pop()\n\n if enable[c] == 1:\n\n continue\n\n elif enable[c] == -1:\n\n print('INF')\n\n exit()\n\n enable[c] = 1\n\n for dc, banned in moves:\n\n if banned[c]:\n\n continue\n\n nc = c + dc\n\n if enable[nc] == 1:\n\n continue\n\n q.append(nc)\n\n# for i in range(col):\n\n# print(enable[i * row:(i + 1) * row])\n\n\n\n\n\nans = 0\n\nfor i in range(col):\n\n ri = i * row\n\n for j in range(row):\n\n if enable[ri + j] != 1:\n\n continue\n\n t = y_list[i - 1]\n\n b = y_list[i]\n\n l = x_list[j - 1]\n\n r = x_list[j]\n\n ans += (b - t) * (r - l)\n\nprint(ans)\n", "code_v0_loc": 128, "code_v1_loc": 115, "code_v0_num_chars": 3630, "code_v1_num_chars": 3124, "code_v0_no_empty_lines": "import sys\n\n# from itertools import chain, accumulate\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\nver_lines = []\nhor_lines = []\nx_list = set()\ny_list = set()\nn3 = n * 3\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n y_list.add(a)\n y_list.add(b)\n x_list.add(c)\n ver_lines.append((a, b, c))\nfor d, e, f in zip(abcdef[n3 + 0 :: 3], abcdef[n3 + 1 :: 3], abcdef[n3 + 2 :: 3]):\n y_list.add(d)\n x_list.add(e)\n x_list.add(f)\n hor_lines.append((d, e, f))\nx_list.add(0)\ny_list.add(0)\nx_list = sorted(x_list)\ny_list = sorted(y_list)\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\nrow_real = len(x_list)\ncol_real = len(y_list)\nrow = row_real + 2\ncol = col_real + 2\nbanned_up_ij = [[0] * row for _ in range(col)]\nbanned_down_ij = [[0] * row for _ in range(col)]\nbanned_left_ij = [[0] * col for _ in range(row)]\nbanned_right_ij = [[0] * col for _ in range(row)]\nfor a, b, c in ver_lines:\n if a > b:\n a, b = b, a\n ai = y_dict[a]\n bi = y_dict[b]\n j = x_dict[c]\n banned_left_ij[j][ai] += 1\n banned_left_ij[j][bi] -= 1\n banned_right_ij[j - 1][ai] += 1\n banned_right_ij[j - 1][bi] -= 1\nfor d, e, f in hor_lines:\n if e > f:\n e, f = f, e\n i = y_dict[d]\n ej = x_dict[e]\n fj = x_dict[f]\n banned_up_ij[i][ej] += 1\n banned_up_ij[i][fj] -= 1\n banned_down_ij[i - 1][ej] += 1\n banned_down_ij[i - 1][fj] -= 1\nbanned_up = [0] * (row * col)\nbanned_down = [0] * (row * col)\nbanned_left = [0] * (row * col)\nbanned_right = [0] * (row * col)\nfor i in range(col):\n ru = banned_up_ij[i]\n rd = banned_down_ij[i]\n ri = row * i\n banned_up[ri] = ru[0]\n banned_down[ri] = rd[0]\n for j in range(1, row):\n banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]\n banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]\nfor j in range(row):\n rl = banned_left_ij[j]\n rr = banned_right_ij[j]\n banned_left[j] = rl[0]\n banned_right[j] = rr[0]\n for i in range(1, col):\n ri0 = (i - 1) * row\n ri1 = i * row\n banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]\n banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n# for i in range(col):\n# print(walls[i * row:(i + 1) * row])\ns = row * y_dict[0] + x_dict[0]\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nq = [s]\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\nwhile q:\n c = q.pop()\n if enable[c] == 1:\n continue\n elif enable[c] == -1:\n print(\"INF\")\n exit()\n enable[c] = 1\n for dc, banned in moves:\n if banned[c]:\n continue\n nc = c + dc\n if enable[nc] == 1:\n continue\n q.append(nc)\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nans = 0\nfor i in range(col):\n ri = i * row\n for j in range(row):\n if enable[ri + j] != 1:\n continue\n t = y_list[i - 1]\n b = y_list[i]\n l = x_list[j - 1]\n r = x_list[j]\n ans += (b - t) * (r - l)\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\n# from itertools import chain, accumulate\nn, m, *abcdef = list(map(int, sys.stdin.buffer.read().split()))\nver_lines = []\nhor_lines = []\nx_list = set()\ny_list = set()\nn3 = n * 3\nfor a, b, c in zip(abcdef[0:n3:3], abcdef[1:n3:3], abcdef[2:n3:3]):\n y_list.add(a)\n y_list.add(b)\n x_list.add(c)\n ver_lines.append((a, b, c))\nfor d, e, f in zip(abcdef[n3 + 0 :: 3], abcdef[n3 + 1 :: 3], abcdef[n3 + 2 :: 3]):\n y_list.add(d)\n x_list.add(e)\n x_list.add(f)\n hor_lines.append((d, e, f))\nx_list.add(0)\ny_list.add(0)\nx_list = sorted(x_list)\ny_list = sorted(y_list)\nx_dict = {x: i for i, x in enumerate(x_list, start=1)}\ny_dict = {y: i for i, y in enumerate(y_list, start=1)}\nrow_real = len(x_list)\ncol_real = len(y_list)\nrow = row_real + 2\ncol = col_real + 2\nbanned_up = [0] * (row * col)\nbanned_down = [0] * (row * col)\nbanned_left = [0] * (row * col)\nbanned_right = [0] * (row * col)\nfor a, b, c in ver_lines:\n if a > b:\n a, b = b, a\n ai = y_dict[a] * row\n bi = y_dict[b] * row\n j = x_dict[c]\n banned_left[ai + j] += 1\n banned_left[bi + j] -= 1\n banned_right[ai + j - 1] += 1\n banned_right[bi + j - 1] -= 1\nfor d, e, f in hor_lines:\n if e > f:\n e, f = f, e\n ri = y_dict[d] * row\n ej = x_dict[e]\n fj = x_dict[f]\n banned_up[ri + ej] += 1\n banned_up[ri + fj] -= 1\n banned_down[ri - row + ej] += 1\n banned_down[ri - row + fj] -= 1\nfor i in range(1, col):\n ri0 = row * (i - 1)\n ri1 = row * i\n for j in range(1, row):\n banned_up[ri1 + j] += banned_up[ri1 + j - 1]\n banned_down[ri1 + j] += banned_down[ri1 + j - 1]\n banned_left[ri1 + j] += banned_left[ri0 + j]\n banned_right[ri1 + j] += banned_right[ri0 + j]\n# banned_up = list(chain.from_iterable(map(accumulate, banned_up_ij)))\n# banned_down = list(chain.from_iterable(map(accumulate, banned_down_ij)))\n# banned_left = list(chain.from_iterable(zip(*map(accumulate, banned_left_ij))))\n# banned_right = list(chain.from_iterable(zip(*map(accumulate, banned_right_ij))))\n# for i in range(col):\n# print(walls[i * row:(i + 1) * row])\ns = row * y_dict[0] + x_dict[0]\nenable = [-1] * row + ([-1] + [0] * (row - 2) + [-1]) * (col - 2) + [-1] * row\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nq = [s]\nmoves = [(-row, banned_up), (-1, banned_left), (1, banned_right), (row, banned_down)]\nwhile q:\n c = q.pop()\n if enable[c] == 1:\n continue\n elif enable[c] == -1:\n print(\"INF\")\n exit()\n enable[c] = 1\n for dc, banned in moves:\n if banned[c]:\n continue\n nc = c + dc\n if enable[nc] == 1:\n continue\n q.append(nc)\n# for i in range(col):\n# print(enable[i * row:(i + 1) * row])\nans = 0\nfor i in range(col):\n ri = i * row\n for j in range(row):\n if enable[ri + j] != 1:\n continue\n t = y_list[i - 1]\n b = y_list[i]\n l = x_list[j - 1]\n r = x_list[j]\n ans += (b - t) * (r - l)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 10.15625, "diff": ["-banned_up_ij = [[0] * row for _ in range(col)]", "-banned_down_ij = [[0] * row for _ in range(col)]", "-banned_left_ij = [[0] * col for _ in range(row)]", "-banned_right_ij = [[0] * col for _ in range(row)]", "-for a, b, c in ver_lines:", "- if a > b:", "- a, b = b, a", "- ai = y_dict[a]", "- bi = y_dict[b]", "- j = x_dict[c]", "- banned_left_ij[j][ai] += 1", "- banned_left_ij[j][bi] -= 1", "- banned_right_ij[j - 1][ai] += 1", "- banned_right_ij[j - 1][bi] -= 1", "-for d, e, f in hor_lines:", "- if e > f:", "- e, f = f, e", "- i = y_dict[d]", "- ej = x_dict[e]", "- fj = x_dict[f]", "- banned_up_ij[i][ej] += 1", "- banned_up_ij[i][fj] -= 1", "- banned_down_ij[i - 1][ej] += 1", "- banned_down_ij[i - 1][fj] -= 1", "-for i in range(col):", "- ru = banned_up_ij[i]", "- rd = banned_down_ij[i]", "- ri = row * i", "- banned_up[ri] = ru[0]", "- banned_down[ri] = rd[0]", "+for a, b, c in ver_lines:", "+ if a > b:", "+ a, b = b, a", "+ ai = y_dict[a] * row", "+ bi = y_dict[b] * row", "+ j = x_dict[c]", "+ banned_left[ai + j] += 1", "+ banned_left[bi + j] -= 1", "+ banned_right[ai + j - 1] += 1", "+ banned_right[bi + j - 1] -= 1", "+for d, e, f in hor_lines:", "+ if e > f:", "+ e, f = f, e", "+ ri = y_dict[d] * row", "+ ej = x_dict[e]", "+ fj = x_dict[f]", "+ banned_up[ri + ej] += 1", "+ banned_up[ri + fj] -= 1", "+ banned_down[ri - row + ej] += 1", "+ banned_down[ri - row + fj] -= 1", "+for i in range(1, col):", "+ ri0 = row * (i - 1)", "+ ri1 = row * i", "- banned_up[ri + j] = banned_up[ri + j - 1] + ru[j]", "- banned_down[ri + j] = banned_down[ri + j - 1] + rd[j]", "-for j in range(row):", "- rl = banned_left_ij[j]", "- rr = banned_right_ij[j]", "- banned_left[j] = rl[0]", "- banned_right[j] = rr[0]", "- for i in range(1, col):", "- ri0 = (i - 1) * row", "- ri1 = i * row", "- banned_left[ri1 + j] = banned_left[ri0 + j] + rl[i]", "- banned_right[ri1 + j] = banned_right[ri0 + j] + rr[i]", "+ banned_up[ri1 + j] += banned_up[ri1 + j - 1]", "+ banned_down[ri1 + j] += banned_down[ri1 + j - 1]", "+ banned_left[ri1 + j] += banned_left[ri0 + j]", "+ banned_right[ri1 + j] += banned_right[ri0 + j]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2846495706, "measured_runtime_v1": 0.092071644, "runtime_lift": 3.0916095148, "key": ["s341076610", "s034276815"], "target_token_count_dream": 1074, "target_token_bucket_dream": "1024-2048"} +{"user_id": "u476068053", "problem_id": "p02555", "language": "python", "submission_id_v0": "s269976358", "submission_id_v1": "s000228897", "cpu_time_v0": 91, "cpu_time_v1": 66, "memory_v0": 64552, "memory_v1": 62952, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.47, "input": "def main():\n\n s = int(input())\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n for i in range(1, s+1):\n\n for j in range(0, (i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "def main():\n\n s = int(input())\n\n mod = 10**9 + 7\n\n\n\n dp = [0] * (s+1)\n\n dp[0] = 1\n\n# for i in range(1, s+1):\n\n# for j in range(0, (i-3)+1):\n\n# dp[i] += dp[j]\n\n# dp[i] %= mod\n\n for i in range(1, s+1):\n\n if i < 3:\n\n dp[i] = 0\n\n else:\n\n dp[i] = dp[i-1] + dp[i-3]\n\n dp[i] %= mod\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 15, "code_v1_loc": 22, "code_v0_num_chars": 277, "code_v1_num_chars": 434, "code_v0_no_empty_lines": "def main():\n s = int(input())\n mod = 10**9 + 7\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(1, s + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n s = int(input())\n mod = 10**9 + 7\n dp = [0] * (s + 1)\n dp[0] = 1\n # for i in range(1, s+1):\n # for j in range(0, (i-3)+1):\n # dp[i] += dp[j]\n # dp[i] %= mod\n for i in range(1, s + 1):\n if i < 3:\n dp[i] = 0\n else:\n dp[i] = dp[i - 1] + dp[i - 3]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 31.8181818182, "diff": ["+ # for i in range(1, s+1):", "+ # for j in range(0, (i-3)+1):", "+ # dp[i] += dp[j]", "+ # dp[i] %= mod", "- for j in range(0, (i - 3) + 1):", "- dp[i] += dp[j]", "+ if i < 3:", "+ dp[i] = 0", "+ else:", "+ dp[i] = dp[i - 1] + dp[i - 3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5094247258, "measured_runtime_v1": 0.2087815866, "runtime_lift": 2.4399887649, "key": ["s269976358", "s000228897"], "target_token_count_dream": 161, "target_token_bucket_dream": "128-256"} +{"user_id": "u753803401", "problem_id": "p03078", "language": "python", "submission_id_v0": "s362357786", "submission_id_v1": "s175109634", "cpu_time_v0": 451, "cpu_time_v1": 323, "memory_v0": 62572, "memory_v1": 53208, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.38, "input": "def slove():\n\n import sys\n\n import heapq\n\n import collections\n\n input = sys.stdin.readline\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n b.sort(reverse=True)\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n c.sort(reverse=True)\n\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(q)\n\n fq = collections.defaultdict(list)\n\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n\n t = 0\n\n for _ in range(k):\n\n if len(q) != 0:\n\n p = heapq.heappop(q)\n\n t = p[0]\n\n aq = p[1]\n\n bq = p[2]\n\n cq = p[3]\n\n if aq + 1 < len(a):\n\n if (-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq])\n\n fq[(-(a[aq+1] + b[bq] + c[cq]), aq+1, bq, cq)] = 1\n\n if bq + 1 < len(b):\n\n if (-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq])\n\n fq[(-(a[aq] + b[bq+1] + c[cq]), aq, bq+1, cq)] = 1\n\n if cq + 1 < len(c):\n\n if (-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1) not in fq:\n\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1])\n\n fq[(-(a[aq] + b[bq] + c[cq+1]), aq, bq, cq+1)] = 1\n\n print((-t))\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n", "target": "import sys\n\nimport collections\n\nimport heapq\n\n\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n mod = 10 ** 9 + 7\n\n x, y, z, k = list(map(int, input().rstrip('\\n').split()))\n\n a = list(map(int, input().rstrip('\\n').split()))\n\n b = list(map(int, input().rstrip('\\n').split()))\n\n c = list(map(int, input().rstrip('\\n').split()))\n\n a.sort(reverse=True)\n\n b.sort(reverse=True)\n\n c.sort(reverse=True)\n\n ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n\n heapq.heapify(ql)\n\n fq = collections.defaultdict(int)\n\n fq[0, 0, 0]\n\n for i in range(k):\n\n s, ap, bp, cp = heapq.heappop(ql)\n\n for app, bpp, cpp in ([[ap+1, bp, cp], [ap, bp+1, cp], [ap, bp, cp+1]]):\n\n if app < x and bpp < y and cpp < z:\n\n if (app, bpp, cpp) not in fq:\n\n heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])\n\n fq[app, bpp, cpp]\n\n print((-s))\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n", "code_v0_loc": 41, "code_v1_loc": 31, "code_v0_num_chars": 1596, "code_v1_num_chars": 979, "code_v0_no_empty_lines": "def slove():\n import sys\n import heapq\n import collections\n\n input = sys.stdin.readline\n x, y, z, k = list(map(int, input().rstrip(\"\\n\").split()))\n a = list(map(int, input().rstrip(\"\\n\").split()))\n a.sort(reverse=True)\n b = list(map(int, input().rstrip(\"\\n\").split()))\n b.sort(reverse=True)\n c = list(map(int, input().rstrip(\"\\n\").split()))\n c.sort(reverse=True)\n q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n heapq.heapify(q)\n fq = collections.defaultdict(list)\n fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1\n t = 0\n for _ in range(k):\n if len(q) != 0:\n p = heapq.heappop(q)\n t = p[0]\n aq = p[1]\n bq = p[2]\n cq = p[3]\n if aq + 1 < len(a):\n if (-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq) not in fq:\n heapq.heappush(q, [-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq])\n fq[(-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq)] = 1\n if bq + 1 < len(b):\n if (-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq) not in fq:\n heapq.heappush(q, [-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq])\n fq[(-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq)] = 1\n if cq + 1 < len(c):\n if (-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1) not in fq:\n heapq.heappush(q, [-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1])\n fq[(-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1)] = 1\n print((-t))\n\n\nif __name__ == \"__main__\":\n slove()\n", "code_v1_no_empty_lines": "import sys\nimport collections\nimport heapq\n\n\ndef solve():\n input = sys.stdin.readline\n mod = 10**9 + 7\n x, y, z, k = list(map(int, input().rstrip(\"\\n\").split()))\n a = list(map(int, input().rstrip(\"\\n\").split()))\n b = list(map(int, input().rstrip(\"\\n\").split()))\n c = list(map(int, input().rstrip(\"\\n\").split()))\n a.sort(reverse=True)\n b.sort(reverse=True)\n c.sort(reverse=True)\n ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]\n heapq.heapify(ql)\n fq = collections.defaultdict(int)\n fq[0, 0, 0]\n for i in range(k):\n s, ap, bp, cp = heapq.heappop(ql)\n for app, bpp, cpp in [[ap + 1, bp, cp], [ap, bp + 1, cp], [ap, bp, cp + 1]]:\n if app < x and bpp < y and cpp < z:\n if (app, bpp, cpp) not in fq:\n heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])\n fq[app, bpp, cpp]\n print((-s))\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 24.3902439024, "diff": ["-def slove():", "- import sys", "- import heapq", "- import collections", "+import sys", "+import collections", "+import heapq", "+", "+def solve():", "+ mod = 10**9 + 7", "+ b = list(map(int, input().rstrip(\"\\n\").split()))", "+ c = list(map(int, input().rstrip(\"\\n\").split()))", "- b = list(map(int, input().rstrip(\"\\n\").split()))", "- c = list(map(int, input().rstrip(\"\\n\").split()))", "- q = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]", "- heapq.heapify(q)", "- fq = collections.defaultdict(list)", "- fq[(-(a[0] + b[0] + c[0]), 0, 0, 0), 1] = 1", "- t = 0", "- for _ in range(k):", "- if len(q) != 0:", "- p = heapq.heappop(q)", "- t = p[0]", "- aq = p[1]", "- bq = p[2]", "- cq = p[3]", "- if aq + 1 < len(a):", "- if (-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq) not in fq:", "- heapq.heappush(q, [-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq])", "- fq[(-(a[aq + 1] + b[bq] + c[cq]), aq + 1, bq, cq)] = 1", "- if bq + 1 < len(b):", "- if (-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq) not in fq:", "- heapq.heappush(q, [-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq])", "- fq[(-(a[aq] + b[bq + 1] + c[cq]), aq, bq + 1, cq)] = 1", "- if cq + 1 < len(c):", "- if (-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1) not in fq:", "- heapq.heappush(q, [-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1])", "- fq[(-(a[aq] + b[bq] + c[cq + 1]), aq, bq, cq + 1)] = 1", "- print((-t))", "+ ql = [[-(a[0] + b[0] + c[0]), 0, 0, 0]]", "+ heapq.heapify(ql)", "+ fq = collections.defaultdict(int)", "+ fq[0, 0, 0]", "+ for i in range(k):", "+ s, ap, bp, cp = heapq.heappop(ql)", "+ for app, bpp, cpp in [[ap + 1, bp, cp], [ap, bp + 1, cp], [ap, bp, cp + 1]]:", "+ if app < x and bpp < y and cpp < z:", "+ if (app, bpp, cpp) not in fq:", "+ heapq.heappush(ql, [-(a[app] + b[bpp] + c[cpp]), app, bpp, cpp])", "+ fq[app, bpp, cpp]", "+ print((-s))", "- slove()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3093440776, "measured_runtime_v1": 0.1565137908, "runtime_lift": 1.9764653063, "key": ["s362357786", "s175109634"], "target_token_count_dream": 313, "target_token_bucket_dream": "256-512"} +{"user_id": "u546285759", "problem_id": "p00500", "language": "python", "submission_id_v0": "s199562246", "submission_id_v1": "s512442556", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7644, "memory_v1": 7672, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "N = int(input())\n\nscore = [list(map(int, input().split())) for _ in range(N)]\n\nplayers = [0 for _ in range(N)]\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += p\n\nprint(*players, sep='\\n')\n", "target": "N = int(input())\n\nscore = [input().split() for _ in range(N)]\n\nplayers = [0]*N\n\nfor play in list(zip(*score)):\n\n for i, p in enumerate(play):\n\n if play.count(p) == 1:\n\n players[i] += int(p)\n\nprint(*players, sep='\\n')\n", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 264, "code_v1_num_chars": 237, "code_v0_no_empty_lines": "N = int(input())\nscore = [list(map(int, input().split())) for _ in range(N)]\nplayers = [0 for _ in range(N)]\nfor play in list(zip(*score)):\n for i, p in enumerate(play):\n if play.count(p) == 1:\n players[i] += p\nprint(*players, sep=\"\\n\")\n", "code_v1_no_empty_lines": "N = int(input())\nscore = [input().split() for _ in range(N)]\nplayers = [0] * N\nfor play in list(zip(*score)):\n for i, p in enumerate(play):\n if play.count(p) == 1:\n players[i] += int(p)\nprint(*players, sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-score = [list(map(int, input().split())) for _ in range(N)]", "-players = [0 for _ in range(N)]", "+score = [input().split() for _ in range(N)]", "+players = [0] * N", "- players[i] += p", "+ players[i] += int(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3026783457, "measured_runtime_v1": 0.2355215042, "runtime_lift": 1.2851410182, "key": ["s199562246", "s512442556"], "target_token_count_dream": 69, "target_token_bucket_dream": "<128"} +{"user_id": "u419963262", "problem_id": "p03170", "language": "python", "submission_id_v0": "s690193516", "submission_id_v1": "s176737022", "cpu_time_v0": 1807, "cpu_time_v1": 395, "memory_v0": 3828, "memory_v1": 43416, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.14, "input": "n,k = list(map(int,input().split()))\n\narr = list(map(int,input().split()))\n\n\n\ndp = [False]*(k+1)\n\n\n\nfor stones in range(k+1):\n\n for x in arr:\n\n if stones >= x and dp[stones-x] == False:\n\n dp[stones] = True\n\n\n\nif dp[k]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")\n", "target": "N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\n\n\ndp = [False]*(K+1)\n\n\n\nfor i in range(K+1):\n\n for j in range(N):\n\n if i-A[j]>=0 and dp[i-A[j]] == False:\n\n dp[i] = True\n\n\n\n \n\nif dp[K]:\n\n print(\"First\")\n\nelse:\n\n print(\"Second\")", "code_v0_loc": 14, "code_v1_loc": 15, "code_v0_num_chars": 282, "code_v1_num_chars": 280, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\narr = list(map(int, input().split()))\ndp = [False] * (k + 1)\nfor stones in range(k + 1):\n for x in arr:\n if stones >= x and dp[stones - x] == False:\n dp[stones] = True\nif dp[k]:\n print(\"First\")\nelse:\n print(\"Second\")\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\ndp = [False] * (K + 1)\nfor i in range(K + 1):\n for j in range(N):\n if i - A[j] >= 0 and dp[i - A[j]] == False:\n dp[i] = True\nif dp[K]:\n print(\"First\")\nelse:\n print(\"Second\")\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["-n, k = list(map(int, input().split()))", "-arr = list(map(int, input().split()))", "-dp = [False] * (k + 1)", "-for stones in range(k + 1):", "- for x in arr:", "- if stones >= x and dp[stones - x] == False:", "- dp[stones] = True", "-if dp[k]:", "+N, K = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "+dp = [False] * (K + 1)", "+for i in range(K + 1):", "+ for j in range(N):", "+ if i - A[j] >= 0 and dp[i - A[j]] == False:", "+ dp[i] = True", "+if dp[K]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2082244466, "measured_runtime_v1": 0.0065503952, "runtime_lift": 31.7880739295, "key": ["s690193516", "s176737022"], "target_token_count_dream": 84, "target_token_bucket_dream": "<128"} +{"user_id": "u579833671", "problem_id": "p02419", "language": "python", "submission_id_v0": "s913061371", "submission_id_v1": "s394956399", "cpu_time_v0": 20, "cpu_time_v1": 10, "memory_v0": 4220, "memory_v1": 4212, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "W = input().lower()\n\ns = []\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n s.append(T[i].lower())\n\nans = 0\n\nfor i in range(len(s)):\n\n if(s[i] == W):\n\n ans += 1\n\nprint(ans)", "target": "W = input().lower()\n\ns = []\n\nans = 0\n\nwhile True:\n\n T = list(map(str, input().split()))\n\n if(T[0] == \"END_OF_TEXT\"):\n\n break\n\n else:\n\n for i in range(len(T)):\n\n if(W == T[i].lower()):\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 294, "code_v1_num_chars": 257, "code_v0_no_empty_lines": "W = input().lower()\ns = []\nwhile True:\n T = list(map(str, input().split()))\n if T[0] == \"END_OF_TEXT\":\n break\n else:\n for i in range(len(T)):\n s.append(T[i].lower())\nans = 0\nfor i in range(len(s)):\n if s[i] == W:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "W = input().lower()\ns = []\nans = 0\nwhile True:\n T = list(map(str, input().split()))\n if T[0] == \"END_OF_TEXT\":\n break\n else:\n for i in range(len(T)):\n if W == T[i].lower():\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["+ans = 0", "- s.append(T[i].lower())", "-ans = 0", "-for i in range(len(s)):", "- if s[i] == W:", "- ans += 1", "+ if W == T[i].lower():", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1894613738, "measured_runtime_v1": 0.0060594826, "runtime_lift": 31.2669227389, "key": ["s913061371", "s394956399"], "target_token_count_dream": 75, "target_token_bucket_dream": "<128"} +{"user_id": "u919633157", "problem_id": "p03796", "language": "python", "submission_id_v0": "s593917202", "submission_id_v1": "s901232961", "cpu_time_v0": 230, "cpu_time_v1": 42, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.74, "input": "import math\n\nprint((math.factorial(int(input()))%(10**9+7)))", "target": "n=int(input())\n\nans=1\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans%=10**9+7\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 6, "code_v0_num_chars": 58, "code_v1_num_chars": 87, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= 10**9 + 7\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % (10**9 + 7)))", "+n = int(input())", "+ans = 1", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= 10**9 + 7", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9124054093, "measured_runtime_v1": 0.4053284261, "runtime_lift": 2.2510274398, "key": ["s593917202", "s901232961"], "target_token_count_dream": 36, "target_token_bucket_dream": "<128"} +{"user_id": "u414980766", "problem_id": "p02773", "language": "python", "submission_id_v0": "s498649498", "submission_id_v1": "s794455280", "cpu_time_v0": 480, "cpu_time_v1": 421, "memory_v0": 47872, "memory_v1": 43256, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.29, "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nS = sorted(S)\n\nls = [[] for i in range(N + 1)]\n\nmax_num = 0\n\nleft = 0\n\nright = 0\n\nwhile right < N:\n\n while right < N and S[left] == S[right]:\n\n right += 1\n\n if (right - left) >= max_num:\n\n ls[right - left].append(S[left].decode())\n\n max_num = right - left\n\n left = right\n\n \n\nprint(('\\n'.join(ls[max_num])))\n", "target": "from collections import Counter\n\n\n\nimport sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nN = int(readline())\n\nS = read().split()\n\n\n\nres = []\n\nc = Counter(S)\n\nmax_num = c.most_common(1)[0][1]\n\nfor i, j in list(c.items()):\n\n if j == max_num:\n\n res.append(i)\n\n \n\nres.sort()\n\n\n\n \n\nprint(('\\n'.join(list([x.decode() for x in res]))))\n", "code_v0_loc": 21, "code_v1_loc": 20, "code_v0_num_chars": 502, "code_v1_num_chars": 421, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nS = read().split()\nS = sorted(S)\nls = [[] for i in range(N + 1)]\nmax_num = 0\nleft = 0\nright = 0\nwhile right < N:\n while right < N and S[left] == S[right]:\n right += 1\n if (right - left) >= max_num:\n ls[right - left].append(S[left].decode())\n max_num = right - left\n left = right\nprint((\"\\n\".join(ls[max_num])))\n", "code_v1_no_empty_lines": "from collections import Counter\nimport sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nS = read().split()\nres = []\nc = Counter(S)\nmax_num = c.most_common(1)[0][1]\nfor i, j in list(c.items()):\n if j == max_num:\n res.append(i)\nres.sort()\nprint((\"\\n\".join(list([x.decode() for x in res]))))\n", "code_same": false, "relative_loc_diff_percent": 4.7619047619, "diff": ["+from collections import Counter", "-S = sorted(S)", "-ls = [[] for i in range(N + 1)]", "-max_num = 0", "-left = 0", "-right = 0", "-while right < N:", "- while right < N and S[left] == S[right]:", "- right += 1", "- if (right - left) >= max_num:", "- ls[right - left].append(S[left].decode())", "- max_num = right - left", "- left = right", "-print((\"\\n\".join(ls[max_num])))", "+res = []", "+c = Counter(S)", "+max_num = c.most_common(1)[0][1]", "+for i, j in list(c.items()):", "+ if j == max_num:", "+ res.append(i)", "+res.sort()", "+print((\"\\n\".join(list([x.decode() for x in res]))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2394288239, "measured_runtime_v1": 0.0062145643, "runtime_lift": 38.5270488971, "key": ["s498649498", "s794455280"], "target_token_count_dream": 109, "target_token_bucket_dream": "<128"} +{"user_id": "u077291787", "problem_id": "p03164", "language": "python", "submission_id_v0": "s644346369", "submission_id_v1": "s649660252", "cpu_time_v0": 472, "cpu_time_v1": 351, "memory_v0": 93244, "memory_v1": 70732, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.64, "input": "# temp\n\nn,w = list(map(int,input().split()))\n\nwv = [tuple(map(int,input().split())) for i in range(n)]\n\n\n\ndp = [0] + [float(\"inf\")]*(10**5)\n\nfor i in range(n):\n\n for j in range(10**5,wv[i][1]-1,-1):\n\n dp[j] = min(dp[j],dp[j-wv[i][1]]+wv[i][0])\n\n\n\nres = 0\n\nfor v,e in enumerate(dp):\n\n if e <= w:\n\n res = v\n\nprint(res)", "target": "# dpE - Knapsack 2\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, W = tuple(map(int, input().rstrip().split()))\n\n A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))\n\n _, v = list(zip(*A))\n\n lim = sum(v)\n\n dp = [0] + [float(\"inf\")] * lim\n\n for i in range(n):\n\n for j in range(lim, A[i][1] - 1, -1):\n\n dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])\n\n ans = max(v for v, w in enumerate(dp) if w <= W)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 14, "code_v1_loc": 19, "code_v0_num_chars": 330, "code_v1_num_chars": 522, "code_v0_no_empty_lines": "# temp\nn, w = list(map(int, input().split()))\nwv = [tuple(map(int, input().split())) for i in range(n)]\ndp = [0] + [float(\"inf\")] * (10**5)\nfor i in range(n):\n for j in range(10**5, wv[i][1] - 1, -1):\n dp[j] = min(dp[j], dp[j - wv[i][1]] + wv[i][0])\nres = 0\nfor v, e in enumerate(dp):\n if e <= w:\n res = v\nprint(res)\n", "code_v1_no_empty_lines": "# dpE - Knapsack 2\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, W = tuple(map(int, input().rstrip().split()))\n A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))\n _, v = list(zip(*A))\n lim = sum(v)\n dp = [0] + [float(\"inf\")] * lim\n for i in range(n):\n for j in range(lim, A[i][1] - 1, -1):\n dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])\n ans = max(v for v, w in enumerate(dp) if w <= W)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 26.3157894737, "diff": ["-# temp", "-n, w = list(map(int, input().split()))", "-wv = [tuple(map(int, input().split())) for i in range(n)]", "-dp = [0] + [float(\"inf\")] * (10**5)", "-for i in range(n):", "- for j in range(10**5, wv[i][1] - 1, -1):", "- dp[j] = min(dp[j], dp[j - wv[i][1]] + wv[i][0])", "-res = 0", "-for v, e in enumerate(dp):", "- if e <= w:", "- res = v", "-print(res)", "+# dpE - Knapsack 2", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def main():", "+ n, W = tuple(map(int, input().rstrip().split()))", "+ A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))", "+ _, v = list(zip(*A))", "+ lim = sum(v)", "+ dp = [0] + [float(\"inf\")] * lim", "+ for i in range(n):", "+ for j in range(lim, A[i][1] - 1, -1):", "+ dp[j] = min(dp[j], dp[j - A[i][1]] + A[i][0])", "+ ans = max(v for v, w in enumerate(dp) if w <= W)", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 1.6859776349, "measured_runtime_v1": 0.2345220137, "runtime_lift": 7.1889952184, "key": ["s644346369", "s649660252"], "target_token_count_dream": 171, "target_token_bucket_dream": "128-256"} +{"user_id": "u021548497", "problem_id": "p02555", "language": "python", "submission_id_v0": "s983449721", "submission_id_v1": "s321084928", "cpu_time_v0": 330, "cpu_time_v1": 30, "memory_v0": 9192, "memory_v1": 9108, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 90.91, "input": "def main():\n\n n = int(input())\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(n+1):\n\n for j in range(i-2):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "def main():\n\n n = int(input())\n\n \n\n dp = [0]*(n+1)\n\n dp[0] = 1\n\n mod = pow(10, 9) + 7\n\n for i in range(3, n+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n dp[i] %= mod\n\n \n\n print((dp[n]))\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 15, "code_v1_loc": 14, "code_v0_num_chars": 242, "code_v1_num_chars": 226, "code_v0_no_empty_lines": "def main():\n n = int(input())\n dp = [0] * (n + 1)\n dp[0] = 1\n mod = pow(10, 9) + 7\n for i in range(n + 1):\n for j in range(i - 2):\n dp[i] += dp[j]\n dp[i] %= mod\n print((dp[n]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n n = int(input())\n dp = [0] * (n + 1)\n dp[0] = 1\n mod = pow(10, 9) + 7\n for i in range(3, n + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n dp[i] %= mod\n print((dp[n]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["- for i in range(n + 1):", "- for j in range(i - 2):", "- dp[i] += dp[j]", "- dp[i] %= mod", "+ for i in range(3, n + 1):", "+ dp[i] = dp[i - 1] + dp[i - 3]", "+ dp[i] %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6721006331, "measured_runtime_v1": 0.344866425, "runtime_lift": 1.9488723295, "key": ["s983449721", "s321084928"], "target_token_count_dream": 99, "target_token_bucket_dream": "<128"} +{"user_id": "u881590806", "problem_id": "p02264", "language": "python", "submission_id_v0": "s309974156", "submission_id_v1": "s779537604", "cpu_time_v0": 780, "cpu_time_v1": 600, "memory_v0": 14072, "memory_v1": 28548, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.08, "input": "class Queue:\n\n def __init__(self,values):\n\n self.values = values\n\n\n\n def empty(self):\n\n if len(self.values) == 0:\n\n return True\n\n else:\n\n return False\n\n\n\n def enqueue(self,v):\n\n self.values.append(v)\n\n\n\n def dequeue(self):\n\n if len(self.values) <= 0:\n\n raise\n\n else:\n\n v = self.values[0]\n\n del self.values[0]\n\n return v\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nprocesses = []\n\nfor i in range(n):\n\n n,t = input().split(' ')\n\n processes.append((n,int(t)))\n\n\n\nqueue = Queue(processes)\n\n\n\nclock = 0\n\ndone = []\n\nwhile not queue.empty():\n\n p = queue.dequeue()\n\n n = p[0]\n\n t = p[1]\n\n if t <= q:\n\n clock+=t\n\n done.append((n,clock))\n\n else:\n\n queue.enqueue((n,t-q))\n\n clock+=q\n\n\n\nfor p in done:\n\n print(p[0],p[1])", "target": "class Queue:\n\n def __init__(self,l):\n\n self.values = []\n\n self.l = l\n\n for _ in range(l):\n\n self.values.append(None)\n\n self.head = 0\n\n self.tail = 0\n\n def inc(self,n):\n\n if n+1 >= self.l:\n\n return 0\n\n else:\n\n return n+1\n\n def enqueue(self,v):\n\n if self.inc(self.head) == self.tail:\n\n print('overflow')\n\n exit()\n\n self.values[self.head] = v\n\n self.head = self.inc(self.head)\n\n def dequeue(self):\n\n if self.head == self.tail:\n\n print('underflow')\n\n exit()\n\n v = self.values[self.tail]\n\n self.tail = self.inc(self.tail)\n\n return v\n\n def size(self):\n\n if self.head >= self.tail:\n\n return self.head-self.tail\n\n else:\n\n self.head + (self.l-self.tail)\n\n\n\nn,q = list(map(int,input().split(' ')))\n\nqueue = Queue(200000)\n\nfor _ in range(n):\n\n n,t = input().split(' ')\n\n t = int(t)\n\n queue.enqueue((n,t))\n\n\n\nc = 0\n\nwhile queue.size()>0:\n\n n,t = queue.dequeue()\n\n if t <= q:\n\n c += t\n\n print(n,c)\n\n else:\n\n queue.enqueue((n,t-q))\n\n c += q", "code_v0_loc": 44, "code_v1_loc": 48, "code_v0_num_chars": 881, "code_v1_num_chars": 1197, "code_v0_no_empty_lines": "class Queue:\n def __init__(self, values):\n self.values = values\n\n def empty(self):\n if len(self.values) == 0:\n return True\n else:\n return False\n\n def enqueue(self, v):\n self.values.append(v)\n\n def dequeue(self):\n if len(self.values) <= 0:\n raise\n else:\n v = self.values[0]\n del self.values[0]\n return v\n\n\nn, q = list(map(int, input().split(\" \")))\nprocesses = []\nfor i in range(n):\n n, t = input().split(\" \")\n processes.append((n, int(t)))\nqueue = Queue(processes)\nclock = 0\ndone = []\nwhile not queue.empty():\n p = queue.dequeue()\n n = p[0]\n t = p[1]\n if t <= q:\n clock += t\n done.append((n, clock))\n else:\n queue.enqueue((n, t - q))\n clock += q\nfor p in done:\n print(p[0], p[1])\n", "code_v1_no_empty_lines": "class Queue:\n def __init__(self, l):\n self.values = []\n self.l = l\n for _ in range(l):\n self.values.append(None)\n self.head = 0\n self.tail = 0\n\n def inc(self, n):\n if n + 1 >= self.l:\n return 0\n else:\n return n + 1\n\n def enqueue(self, v):\n if self.inc(self.head) == self.tail:\n print(\"overflow\")\n exit()\n self.values[self.head] = v\n self.head = self.inc(self.head)\n\n def dequeue(self):\n if self.head == self.tail:\n print(\"underflow\")\n exit()\n v = self.values[self.tail]\n self.tail = self.inc(self.tail)\n return v\n\n def size(self):\n if self.head >= self.tail:\n return self.head - self.tail\n else:\n self.head + (self.l - self.tail)\n\n\nn, q = list(map(int, input().split(\" \")))\nqueue = Queue(200000)\nfor _ in range(n):\n n, t = input().split(\" \")\n t = int(t)\n queue.enqueue((n, t))\nc = 0\nwhile queue.size() > 0:\n n, t = queue.dequeue()\n if t <= q:\n c += t\n print(n, c)\n else:\n queue.enqueue((n, t - q))\n c += q\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["- def __init__(self, values):", "- self.values = values", "+ def __init__(self, l):", "+ self.values = []", "+ self.l = l", "+ for _ in range(l):", "+ self.values.append(None)", "+ self.head = 0", "+ self.tail = 0", "- def empty(self):", "- if len(self.values) == 0:", "- return True", "+ def inc(self, n):", "+ if n + 1 >= self.l:", "+ return 0", "- return False", "+ return n + 1", "- self.values.append(v)", "+ if self.inc(self.head) == self.tail:", "+ print(\"overflow\")", "+ exit()", "+ self.values[self.head] = v", "+ self.head = self.inc(self.head)", "- if len(self.values) <= 0:", "- raise", "+ if self.head == self.tail:", "+ print(\"underflow\")", "+ exit()", "+ v = self.values[self.tail]", "+ self.tail = self.inc(self.tail)", "+ return v", "+", "+ def size(self):", "+ if self.head >= self.tail:", "+ return self.head - self.tail", "- v = self.values[0]", "- del self.values[0]", "- return v", "+ self.head + (self.l - self.tail)", "-processes = []", "-for i in range(n):", "+queue = Queue(200000)", "+for _ in range(n):", "- processes.append((n, int(t)))", "-queue = Queue(processes)", "-clock = 0", "-done = []", "-while not queue.empty():", "- p = queue.dequeue()", "- n = p[0]", "- t = p[1]", "+ t = int(t)", "+ queue.enqueue((n, t))", "+c = 0", "+while queue.size() > 0:", "+ n, t = queue.dequeue()", "- clock += t", "- done.append((n, clock))", "+ c += t", "+ print(n, c)", "- clock += q", "-for p in done:", "- print(p[0], p[1])", "+ c += q"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3044010155, "measured_runtime_v1": 0.1198908706, "runtime_lift": 2.5389841115, "key": ["s309974156", "s779537604"], "target_token_count_dream": 298, "target_token_bucket_dream": "256-512"} +{"user_id": "u672220554", "problem_id": "p02983", "language": "python", "submission_id_v0": "s554161170", "submission_id_v1": "s606893257", "cpu_time_v0": 990, "cpu_time_v1": 76, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.32, "input": "l,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n print(tres)\n", "target": "l,r = list(map(int,input().split()))\n\n\n\nif r - l > 2019:\n\n print((0))\n\nelse:\n\n tres = 2019\n\n for i in range(l,r):\n\n for j in range(i+1,r+1):\n\n mod = (i % 2019) * (j % 2019) % 2019\n\n tres = min(tres,mod)\n\n if tres == 0:\n\n break\n\n if tres == 0:\n\n break\n\n print(tres)\n", "code_v0_loc": 11, "code_v1_loc": 15, "code_v0_num_chars": 250, "code_v1_num_chars": 342, "code_v0_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 2019:\n print((0))\nelse:\n tres = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n mod = (i % 2019) * (j % 2019) % 2019\n tres = min(tres, mod)\n print(tres)\n", "code_v1_no_empty_lines": "l, r = list(map(int, input().split()))\nif r - l > 2019:\n print((0))\nelse:\n tres = 2019\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n mod = (i % 2019) * (j % 2019) % 2019\n tres = min(tres, mod)\n if tres == 0:\n break\n if tres == 0:\n break\n print(tres)\n", "code_same": false, "relative_loc_diff_percent": 26.6666666667, "diff": ["+ if tres == 0:", "+ break", "+ if tres == 0:", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2616734529, "measured_runtime_v1": 0.2086780975, "runtime_lift": 1.2539574397, "key": ["s554161170", "s606893257"], "target_token_count_dream": 121, "target_token_bucket_dream": "<128"} +{"user_id": "u254871849", "problem_id": "p03086", "language": "python", "submission_id_v0": "s827296868", "submission_id_v1": "s358574733", "cpu_time_v0": 604, "cpu_time_v1": 18, "memory_v0": 102680, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 97.02, "input": "# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\nimport itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n all_words = []\n\n for i in range(1, len(s) + 1):\n\n for letters in itertools.product('ATCG', repeat=i):\n\n word = ''.join(letters)\n\n all_words.append(word)\n\n \n\n for i in range(len(all_words)-1, 0-1, -1):\n\n if all_words[i] in s:\n\n print((len(all_words[i])))\n\n sys.exit()\n\n print((0))\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "# 2019-11-12 22:21:08(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# from scipy.misc import comb # float\n\n# import numpy as np \n\n\n\ndef main():\n\n s = sys.stdin.readline().rstrip()\n\n \n\n permitted = 'ACGT'\n\n continuous_count = []\n\n count = 0\n\n\n\n for i in range(len(s)):\n\n char = s[i]\n\n if char in permitted:\n\n count += 1\n\n else:\n\n continuous_count.append(count)\n\n count = 0\n\n if i == len(s) - 1:\n\n continuous_count.append(count)\n\n \n\n if not continuous_count:\n\n print((len(s)))\n\n else:\n\n print((max(continuous_count)))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 32, "code_v1_loc": 38, "code_v0_num_chars": 799, "code_v1_num_chars": 884, "code_v0_no_empty_lines": "# 2019-11-12 22:21:08(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\nimport itertools\n\n# from functools import reduce\n# import operator as op\n# from scipy.misc import comb # float\n# import numpy as np\ndef main():\n s = sys.stdin.readline().rstrip()\n all_words = []\n for i in range(1, len(s) + 1):\n for letters in itertools.product(\"ATCG\", repeat=i):\n word = \"\".join(letters)\n all_words.append(word)\n for i in range(len(all_words) - 1, 0 - 1, -1):\n if all_words[i] in s:\n print((len(all_words[i])))\n sys.exit()\n print((0))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# 2019-11-12 22:21:08(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# from scipy.misc import comb # float\n# import numpy as np\ndef main():\n s = sys.stdin.readline().rstrip()\n permitted = \"ACGT\"\n continuous_count = []\n count = 0\n for i in range(len(s)):\n char = s[i]\n if char in permitted:\n count += 1\n else:\n continuous_count.append(count)\n count = 0\n if i == len(s) - 1:\n continuous_count.append(count)\n if not continuous_count:\n print((len(s)))\n else:\n print((max(continuous_count)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.7894736842, "diff": ["-import itertools", "-", "+# import itertools", "- all_words = []", "- for i in range(1, len(s) + 1):", "- for letters in itertools.product(\"ATCG\", repeat=i):", "- word = \"\".join(letters)", "- all_words.append(word)", "- for i in range(len(all_words) - 1, 0 - 1, -1):", "- if all_words[i] in s:", "- print((len(all_words[i])))", "- sys.exit()", "- print((0))", "+ permitted = \"ACGT\"", "+ continuous_count = []", "+ count = 0", "+ for i in range(len(s)):", "+ char = s[i]", "+ if char in permitted:", "+ count += 1", "+ else:", "+ continuous_count.append(count)", "+ count = 0", "+ if i == len(s) - 1:", "+ continuous_count.append(count)", "+ if not continuous_count:", "+ print((len(s)))", "+ else:", "+ print((max(continuous_count)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4624249086, "measured_runtime_v1": 0.2736470122, "runtime_lift": 1.6898591541, "key": ["s827296868", "s358574733"], "target_token_count_dream": 225, "target_token_bucket_dream": "128-256"} +{"user_id": "u254871849", "problem_id": "p03309", "language": "python", "submission_id_v0": "s802702568", "submission_id_v1": "s939867576", "cpu_time_v0": 372, "cpu_time_v1": 200, "memory_v0": 27268, "memory_v1": 25180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.24, "input": "# author: kagemeka \n\n# created: 2019-11-08 14:51:29(JST)\n\n## internal modules\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\nimport statistics\n\n# import functools\n\n# import operator\n\n## external modules\n\n# import scipy.special # if use comb function on AtCoder, \n\n# import scipy.misc # select scipy.misc.comb (old version) \n\n\n\ndef main():\n\n n, *a = (int(x) for x in sys.stdin.read().split())\n\n \n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n\n\n if n % 2 != 0:\n\n b = statistics.median(a)\n\n else:\n\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n\n b = statistics.median_high(a)\n\n else:\n\n b = statistics.median_low(a)\n\n \n\n ans = sum([abs(a[i] - b) for i in range(n)])\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n\n\n\n\n", "target": "import sys\n\n\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\n\n\ndef main():\n\n for i in range(n):\n\n a[i] -= (i + 1)\n\n a.sort()\n\n b = a[n // 2]\n\n res = 0\n\n for i in range(n):\n\n res += abs(a[i] - b)\n\n \n\n return res\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 40, "code_v1_loc": 18, "code_v0_num_chars": 987, "code_v1_num_chars": 310, "code_v0_no_empty_lines": "# author: kagemeka\n# created: 2019-11-08 14:51:29(JST)\n## internal modules\nimport sys\n\n# import collections\n# import math\n# import string\n# import bisect\n# import re\n# import itertools\nimport statistics\n\n# import functools\n# import operator\n## external modules\n# import scipy.special # if use comb function on AtCoder,\n# import scipy.misc # select scipy.misc.comb (old version)\ndef main():\n n, *a = (int(x) for x in sys.stdin.read().split())\n for i in range(n):\n a[i] -= i + 1\n if n % 2 != 0:\n b = statistics.median(a)\n else:\n if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):\n b = statistics.median_high(a)\n else:\n b = statistics.median_low(a)\n ans = sum([abs(a[i] - b) for i in range(n)])\n print(ans)\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n", "code_v1_no_empty_lines": "import sys\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\n\ndef main():\n for i in range(n):\n a[i] -= i + 1\n a.sort()\n b = a[n // 2]\n res = 0\n for i in range(n):\n res += abs(a[i] - b)\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 55.0, "diff": ["-# author: kagemeka", "-# created: 2019-11-08 14:51:29(JST)", "-## internal modules", "-# import collections", "-# import math", "-# import string", "-# import bisect", "-# import re", "-# import itertools", "-import statistics", "+n, *a = list(map(int, sys.stdin.read().split()))", "-# import functools", "-# import operator", "-## external modules", "-# import scipy.special # if use comb function on AtCoder,", "-# import scipy.misc # select scipy.misc.comb (old version)", "+", "- n, *a = (int(x) for x in sys.stdin.read().split())", "- if n % 2 != 0:", "- b = statistics.median(a)", "- else:", "- if a.count(statistics.median_high(a)) >= a.count(statistics.median_low(a)):", "- b = statistics.median_high(a)", "- else:", "- b = statistics.median_low(a)", "- ans = sum([abs(a[i] - b) for i in range(n)])", "- print(ans)", "+ a.sort()", "+ b = a[n // 2]", "+ res = 0", "+ for i in range(n):", "+ res += abs(a[i] - b)", "+ return res", "- # execute only if run as a script", "- main()", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2726693273, "measured_runtime_v1": 0.2052652476, "runtime_lift": 1.3283755066, "key": ["s802702568", "s939867576"], "target_token_count_dream": 100, "target_token_bucket_dream": "<128"} +{"user_id": "u416758623", "problem_id": "p03416", "language": "python", "submission_id_v0": "s698254896", "submission_id_v1": "s209236188", "cpu_time_v0": 210, "cpu_time_v1": 54, "memory_v0": 3060, "memory_v1": 9152, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 74.29, "input": "def findSumDigit(num):\n\n global total\n\n total = \"\"\n\n while num > 0:\n\n total += str(num % 10)\n\n num //= 10\n\n return total\n\n\n\ndef main():\n\n a,b = list(map(int, input().split()))\n\n ans = 0\n\n for i in range(a,b+1):\n\n tmp = str(findSumDigit(i))\n\n if tmp == str(i):\n\n ans += 1\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "a, b = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor i in range(a,b+1):\n\n seki_gyaku = str(i)\n\n if seki_gyaku == seki_gyaku[::-1]:\n\n ans += 1\n\n\n\nprint(ans)\n", "code_v0_loc": 19, "code_v1_loc": 9, "code_v0_num_chars": 382, "code_v1_num_chars": 165, "code_v0_no_empty_lines": "def findSumDigit(num):\n global total\n total = \"\"\n while num > 0:\n total += str(num % 10)\n num //= 10\n return total\n\n\ndef main():\n a, b = list(map(int, input().split()))\n ans = 0\n for i in range(a, b + 1):\n tmp = str(findSumDigit(i))\n if tmp == str(i):\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n seki_gyaku = str(i)\n if seki_gyaku == seki_gyaku[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 52.6315789474, "diff": ["-def findSumDigit(num):", "- global total", "- total = \"\"", "- while num > 0:", "- total += str(num % 10)", "- num //= 10", "- return total", "-", "-", "-def main():", "- a, b = list(map(int, input().split()))", "- ans = 0", "- for i in range(a, b + 1):", "- tmp = str(findSumDigit(i))", "- if tmp == str(i):", "- ans += 1", "- print(ans)", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+a, b = list(map(int, input().split()))", "+ans = 0", "+for i in range(a, b + 1):", "+ seki_gyaku = str(i)", "+ if seki_gyaku == seki_gyaku[::-1]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.908202547, "measured_runtime_v1": 0.4125540495, "runtime_lift": 2.2014146949, "key": ["s698254896", "s209236188"], "target_token_count_dream": 61, "target_token_bucket_dream": "<128"} +{"user_id": "u759412327", "problem_id": "p03680", "language": "python", "submission_id_v0": "s086989807", "submission_id_v1": "s510724514", "cpu_time_v0": 397, "cpu_time_v1": 201, "memory_v0": 7084, "memory_v1": 13724, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 49.37, "input": "N = int(input())\n\na = [int(input()) for i in range(N)]\n\nnow = a[0]\n\ncount = 1\n\nc = 0\n\nfor i in range(10**6):\n\n if now != 2:\n\n count += 1\n\n now = a[now - 1]\n\n else:\n\n print(count)\n\n c = 1\n\n break\n\nif c == 0:\n\n print((-1))\n", "target": "N = int(input())\n\na = [0] + [int(input()) for _ in range(N)]\n\nx = 1\n\nvisited = set([1])\n\nanswer = 0\n\n\n\nwhile True:\n\n x = a[x]\n\n if x in visited:\n\n answer = -1\n\n break\n\n visited.add(x)\n\n answer += 1\n\n if x == 2:\n\n break\n\n \n\nprint(answer)\n", "code_v0_loc": 15, "code_v1_loc": 17, "code_v0_num_chars": 263, "code_v1_num_chars": 254, "code_v0_no_empty_lines": "N = int(input())\na = [int(input()) for i in range(N)]\nnow = a[0]\ncount = 1\nc = 0\nfor i in range(10**6):\n if now != 2:\n count += 1\n now = a[now - 1]\n else:\n print(count)\n c = 1\n break\nif c == 0:\n print((-1))\n", "code_v1_no_empty_lines": "N = int(input())\na = [0] + [int(input()) for _ in range(N)]\nx = 1\nvisited = set([1])\nanswer = 0\nwhile True:\n x = a[x]\n if x in visited:\n answer = -1\n break\n visited.add(x)\n answer += 1\n if x == 2:\n break\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 11.7647058824, "diff": ["-a = [int(input()) for i in range(N)]", "-now = a[0]", "-count = 1", "-c = 0", "-for i in range(10**6):", "- if now != 2:", "- count += 1", "- now = a[now - 1]", "- else:", "- print(count)", "- c = 1", "+a = [0] + [int(input()) for _ in range(N)]", "+x = 1", "+visited = set([1])", "+answer = 0", "+while True:", "+ x = a[x]", "+ if x in visited:", "+ answer = -1", "-if c == 0:", "- print((-1))", "+ visited.add(x)", "+ answer += 1", "+ if x == 2:", "+ break", "+print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8020722582, "measured_runtime_v1": 0.2096916373, "runtime_lift": 3.8250083246, "key": ["s086989807", "s510724514"], "target_token_count_dream": 86, "target_token_bucket_dream": "<128"} +{"user_id": "u150984829", "problem_id": "p02386", "language": "python", "submission_id_v0": "s352388599", "submission_id_v1": "s199670495", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 5616, "memory_v1": 5616, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "n=int(input())\n\na=[list(map(int,input().split()))for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n", "target": "n=int(input())\n\na=[[int(s)for s in input().split()]for _ in range(n)]\n\ndef f():\n\n for i in range(n-1):\n\n d=a[i][:];d[3],d[4]=d[4],d[3]\n\n for j in range(i+1,n):\n\n e=a[j][:];e[3],e[4]=e[4],e[3]\n\n for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):\n\n f=[d[k]for k in p]\n\n if f[0]==e[0]and f[5]==e[5]:\n\n f=f[1:5]*2\n\n for k in range(4):\n\n if f[k:k+4]==e[1:5]:return'No'\n\n return'Yes'\n\nprint((f()))\n", "code_v0_loc": 15, "code_v1_loc": 15, "code_v0_num_chars": 457, "code_v1_num_chars": 459, "code_v0_no_empty_lines": "n = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\n [0, 1, 2, 3, 4, 5],\n [1, 5, 2, 0, 4, 3],\n [2, 1, 5, 3, 0, 4],\n [3, 0, 2, 5, 4, 1],\n [4, 1, 0, 3, 5, 2],\n [5, 1, 4, 3, 2, 0],\n ):\n f = [d[k] for k in p]\n if f[0] == e[0] and f[5] == e[5]:\n f = f[1:5] * 2\n for k in range(4):\n if f[k : k + 4] == e[1:5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_v1_no_empty_lines": "n = int(input())\na = [[int(s) for s in input().split()] for _ in range(n)]\n\n\ndef f():\n for i in range(n - 1):\n d = a[i][:]\n d[3], d[4] = d[4], d[3]\n for j in range(i + 1, n):\n e = a[j][:]\n e[3], e[4] = e[4], e[3]\n for p in (\n [0, 1, 2, 3, 4, 5],\n [1, 5, 2, 0, 4, 3],\n [2, 1, 5, 3, 0, 4],\n [3, 0, 2, 5, 4, 1],\n [4, 1, 0, 3, 5, 2],\n [5, 1, 4, 3, 2, 0],\n ):\n f = [d[k] for k in p]\n if f[0] == e[0] and f[5] == e[5]:\n f = f[1:5] * 2\n for k in range(4):\n if f[k : k + 4] == e[1:5]:\n return \"No\"\n return \"Yes\"\n\n\nprint((f()))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-a = [list(map(int, input().split())) for _ in range(n)]", "+a = [[int(s) for s in input().split()] for _ in range(n)]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2724710764, "measured_runtime_v1": 0.2146971788, "runtime_lift": 1.2690948152, "key": ["s352388599", "s199670495"], "target_token_count_dream": 239, "target_token_bucket_dream": "128-256"} +{"user_id": "u860002137", "problem_id": "p02952", "language": "python", "submission_id_v0": "s726498671", "submission_id_v1": "s714071292", "cpu_time_v0": 61, "cpu_time_v1": 26, "memory_v0": 2940, "memory_v1": 9004, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.38, "input": "N = int(input())\n\n\n\nans = 0\n\n\n\nfor i in range(1, N+1):\n\n if len(str(i))%2==1:\n\n ans += 1\n\n\n\nprint(ans)", "target": "import sys\n\n\n\n\n\ndef rec(length):\n\n if length == 1:\n\n return 9\n\n else:\n\n return 9 * 10**(length - 1) + rec(length - 2)\n\n\n\n\n\nn = input()\n\nlength = len(n)\n\n\n\nif length == 1:\n\n print(n)\n\n sys.exit()\n\n\n\nif length % 2 == 0:\n\n ans = rec(length - 1)\n\nelse:\n\n ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1\n\n\n\nprint(ans)", "code_v0_loc": 9, "code_v1_loc": 23, "code_v0_num_chars": 112, "code_v1_num_chars": 363, "code_v0_no_empty_lines": "N = int(input())\nans = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 == 1:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\n\ndef rec(length):\n if length == 1:\n return 9\n else:\n return 9 * 10 ** (length - 1) + rec(length - 2)\n\n\nn = input()\nlength = len(n)\nif length == 1:\n print(n)\n sys.exit()\nif length % 2 == 0:\n ans = rec(length - 1)\nelse:\n ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 60.8695652174, "diff": ["-N = int(input())", "-ans = 0", "-for i in range(1, N + 1):", "- if len(str(i)) % 2 == 1:", "- ans += 1", "+import sys", "+", "+", "+def rec(length):", "+ if length == 1:", "+ return 9", "+ else:", "+ return 9 * 10 ** (length - 1) + rec(length - 2)", "+", "+", "+n = input()", "+length = len(n)", "+if length == 1:", "+ print(n)", "+ sys.exit()", "+if length % 2 == 0:", "+ ans = rec(length - 1)", "+else:", "+ ans = rec(length - 2) + int(n) - int(\"1\" + \"0\" * (length - 1)) + 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2155013096, "measured_runtime_v1": 0.1672313638, "runtime_lift": 1.2886417043, "key": ["s726498671", "s714071292"], "target_token_count_dream": 122, "target_token_bucket_dream": "<128"} +{"user_id": "u761320129", "problem_id": "p03425", "language": "python", "submission_id_v0": "s293375746", "submission_id_v1": "s279901441", "cpu_time_v0": 180, "cpu_time_v1": 149, "memory_v0": 10112, "memory_v1": 10876, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.22, "input": "import itertools\n\nfrom collections import Counter\n\nN = int(input())\n\nsrc = [input() for i in range(N)]\n\nctr = Counter()\n\nfor s in src:\n\n ctr[s[0]] += 1\n\n\n\nans = 0\n\nfor ptn in itertools.combinations('MARCH',3):\n\n a,b,c = ptn\n\n ans += ctr[a]*ctr[b]*ctr[c]\n\nprint(ans)", "target": "N = int(input())\n\nS = [input() for i in range(N)]\n\nfrom collections import Counter\n\nctr = Counter([s[0] for s in S])\n\n\n\nans = 0\n\nimport itertools\n\nfor ptn in itertools.combinations('MARCH', 3):\n\n t = 1\n\n for c in ptn:\n\n t *= ctr[c]\n\n ans += t\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 274, "code_v1_num_chars": 270, "code_v0_no_empty_lines": "import itertools\nfrom collections import Counter\n\nN = int(input())\nsrc = [input() for i in range(N)]\nctr = Counter()\nfor s in src:\n ctr[s[0]] += 1\nans = 0\nfor ptn in itertools.combinations(\"MARCH\", 3):\n a, b, c = ptn\n ans += ctr[a] * ctr[b] * ctr[c]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nS = [input() for i in range(N)]\nfrom collections import Counter\n\nctr = Counter([s[0] for s in S])\nans = 0\nimport itertools\n\nfor ptn in itertools.combinations(\"MARCH\", 3):\n t = 1\n for c in ptn:\n t *= ctr[c]\n ans += t\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-import itertools", "+N = int(input())", "+S = [input() for i in range(N)]", "-N = int(input())", "-src = [input() for i in range(N)]", "-ctr = Counter()", "-for s in src:", "- ctr[s[0]] += 1", "+ctr = Counter([s[0] for s in S])", "+import itertools", "+", "- a, b, c = ptn", "- ans += ctr[a] * ctr[b] * ctr[c]", "+ t = 1", "+ for c in ptn:", "+ t *= ctr[c]", "+ ans += t"], "diff_only_import_comment": false, "measured_runtime_v0": 0.206595207, "measured_runtime_v1": 0.1454657862, "runtime_lift": 1.420232292, "key": ["s293375746", "s279901441"], "target_token_count_dream": 84, "target_token_bucket_dream": "<128"} +{"user_id": "u047102107", "problem_id": "p02952", "language": "python", "submission_id_v0": "s855248831", "submission_id_v1": "s153783643", "cpu_time_v0": 193, "cpu_time_v1": 64, "memory_v0": 40812, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.84, "input": "N = int(input())\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n num_dig = 0\n\n ii = i\n\n while ii > 0:\n\n ii = int(ii / 10)\n\n num_dig += 1\n\n if num_dig % 2 != 0:\n\n count += 1\n\n\n\nprint(count)", "target": "N = int(input())\n\n\n\ncount = 0\n\nfor i in range(1, N + 1):\n\n if len(str(i)) % 2 != 0:\n\n count += 1\n\nprint(count)", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 215, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "N = int(input())\ncount = 0\nfor i in range(1, N + 1):\n num_dig = 0\n ii = i\n while ii > 0:\n ii = int(ii / 10)\n num_dig += 1\n if num_dig % 2 != 0:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "N = int(input())\ncount = 0\nfor i in range(1, N + 1):\n if len(str(i)) % 2 != 0:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["- num_dig = 0", "- ii = i", "- while ii > 0:", "- ii = int(ii / 10)", "- num_dig += 1", "- if num_dig % 2 != 0:", "+ if len(str(i)) % 2 != 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3673675511, "measured_runtime_v1": 0.2702338476, "runtime_lift": 1.3594431427, "key": ["s855248831", "s153783643"], "target_token_count_dream": 45, "target_token_bucket_dream": "<128"} +{"user_id": "u372550522", "problem_id": "p02801", "language": "python", "submission_id_v0": "s439687684", "submission_id_v1": "s397132828", "cpu_time_v0": 25, "cpu_time_v1": 17, "memory_v0": 3768, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.0, "input": "from string import ascii_lowercase as lower\n\nprint((lower[lower.find(input())+1]))", "target": "print((chr(ord(input())+1)))", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 80, "code_v1_num_chars": 26, "code_v0_no_empty_lines": "from string import ascii_lowercase as lower\n\nprint((lower[lower.find(input()) + 1]))\n", "code_v1_no_empty_lines": "print((chr(ord(input()) + 1)))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-from string import ascii_lowercase as lower", "-", "-print((lower[lower.find(input()) + 1]))", "+print((chr(ord(input()) + 1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3241319713, "measured_runtime_v1": 0.2361063808, "runtime_lift": 1.3728217348, "key": ["s439687684", "s397132828"], "target_token_count_dream": 9, "target_token_bucket_dream": "<128"} +{"user_id": "u585482323", "problem_id": "p03634", "language": "python", "submission_id_v0": "s798160758", "submission_id_v1": "s876456894", "cpu_time_v0": 777, "cpu_time_v1": 659, "memory_v0": 85552, "memory_v1": 85552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.19, "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]//g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.pop()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n", "target": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\n\"\"\"\n\ndef gcd(a,b):\n\n if a == 0:\n\n return b\n\n return gcd(b%a,a)\n\nn = I()\n\na = IR(n)\n\nl = a[0]\n\nfor i in range(1,n):\n\n g = gcd(l,a[i])\n\n l *= a[i]//g\n\nprint(l)\n\n\"\"\"\n\n\n\n#B\n\nn = I()\n\nv = [[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,b,c = LI()\n\n a -= 1\n\n b -= 1\n\n v[a].append([b,c])\n\n v[b].append([a,c])\n\nQ,k = LI()\n\nd = [-1 for i in range(n)]\n\nd[k-1] = 0\n\nq = deque()\n\nq.append(k-1)\n\nwhile q:\n\n x = q.popleft()\n\n for y,c in v[x]:\n\n if d[y] == -1:\n\n d[y] = d[x]+c\n\n q.append(y)\n\nfor i in range(Q):\n\n x,y = LI()\n\n x -= 1\n\n y -= 1\n\n print((d[x]+d[y]))\n\n#C\n\n\n\n#D\n\n\n\n#E\n\n\n\n#F\n\n\n\n#G\n\n\n\n#H\n\n\n\n#I\n\n\n\n#J\n\n\n\n#K\n\n\n\n#L\n\n\n\n#M\n\n\n\n#N\n\n\n\n#O\n\n\n\n#P\n\n\n\n#Q\n\n\n\n#R\n\n\n\n#S\n\n\n\n#T\n", "code_v0_loc": 105, "code_v1_loc": 105, "code_v0_num_chars": 1535, "code_v1_num_chars": 1539, "code_v0_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\n\"\"\"\ndef gcd(a,b):\n if a == 0:\n return b\n return gcd(b%a,a)\nn = I()\na = IR(n)\nl = a[0]\nfor i in range(1,n):\n g = gcd(l,a[i])\n l *= a[i]//g\nprint(l)\n\"\"\"\n# B\nn = I()\nv = [[] for i in range(n)]\nfor i in range(n - 1):\n a, b, c = LI()\n a -= 1\n b -= 1\n v[a].append([b, c])\n v[b].append([a, c])\nQ, k = LI()\nd = [-1 for i in range(n)]\nd[k - 1] = 0\nq = deque()\nq.append(k - 1)\nwhile q:\n x = q.pop()\n for y, c in v[x]:\n if d[y] == -1:\n d[y] = d[x] + c\n q.append(y)\nfor i in range(Q):\n x, y = LI()\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n# C\n# D\n# E\n# F\n# G\n# H\n# I\n# J\n# K\n# L\n# M\n# N\n# O\n# P\n# Q\n# R\n# S\n# T\n", "code_v1_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\n\"\"\"\ndef gcd(a,b):\n if a == 0:\n return b\n return gcd(b%a,a)\nn = I()\na = IR(n)\nl = a[0]\nfor i in range(1,n):\n g = gcd(l,a[i])\n l *= a[i]//g\nprint(l)\n\"\"\"\n# B\nn = I()\nv = [[] for i in range(n)]\nfor i in range(n - 1):\n a, b, c = LI()\n a -= 1\n b -= 1\n v[a].append([b, c])\n v[b].append([a, c])\nQ, k = LI()\nd = [-1 for i in range(n)]\nd[k - 1] = 0\nq = deque()\nq.append(k - 1)\nwhile q:\n x = q.popleft()\n for y, c in v[x]:\n if d[y] == -1:\n d[y] = d[x] + c\n q.append(y)\nfor i in range(Q):\n x, y = LI()\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n# C\n# D\n# E\n# F\n# G\n# H\n# I\n# J\n# K\n# L\n# M\n# N\n# O\n# P\n# Q\n# R\n# S\n# T\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- x = q.pop()", "+ x = q.popleft()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3495916958, "measured_runtime_v1": 0.1121557097, "runtime_lift": 3.1170209395, "key": ["s798160758", "s876456894"], "target_token_count_dream": 531, "target_token_bucket_dream": "512-1024"} +{"user_id": "u419874471", "problem_id": "p04012", "language": "python", "submission_id_v0": "s872816747", "submission_id_v1": "s223982270", "cpu_time_v0": 32, "cpu_time_v1": 17, "memory_v0": 3956, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.88, "input": "import string\n\nw = input()\n\nfor a in string.ascii_lowercase:\n\n cnt = 0\n\n for t in w:\n\n if t == a:\n\n cnt = cnt + 1\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")", "target": "w = input()\n\nm = [0] * 26\n\nfor t in w:\n\n m[ord(t) - ord('a')] += 1\n\n\n\nfor cnt in m:\n\n if cnt % 2 == 1:\n\n print(\"No\")\n\n exit()\n\n\n\nprint(\"Yes\")", "code_v0_loc": 12, "code_v1_loc": 11, "code_v0_num_chars": 212, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "import string\n\nw = input()\nfor a in string.ascii_lowercase:\n cnt = 0\n for t in w:\n if t == a:\n cnt = cnt + 1\n if cnt % 2 == 1:\n print(\"No\")\n exit()\nprint(\"Yes\")\n", "code_v1_no_empty_lines": "w = input()\nm = [0] * 26\nfor t in w:\n m[ord(t) - ord(\"a\")] += 1\nfor cnt in m:\n if cnt % 2 == 1:\n print(\"No\")\n exit()\nprint(\"Yes\")\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-import string", "-", "-for a in string.ascii_lowercase:", "- cnt = 0", "- for t in w:", "- if t == a:", "- cnt = cnt + 1", "+m = [0] * 26", "+for t in w:", "+ m[ord(t) - ord(\"a\")] += 1", "+for cnt in m:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2442542629, "measured_runtime_v1": 0.193693031, "runtime_lift": 1.2610379509, "key": ["s872816747", "s223982270"], "target_token_count_dream": 61, "target_token_bucket_dream": "<128"} +{"user_id": "u133936772", "problem_id": "p03013", "language": "python", "submission_id_v0": "s323963688", "submission_id_v1": "s220101257", "cpu_time_v0": 187, "cpu_time_v1": 70, "memory_v0": 3828, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 62.57, "input": "mod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(input())-1] = 1\n\n\n\ns = 0\n\nt = 1\n\n\n\nfor i in range(n):\n\n if l[i] > 0:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\nmod = 10**9+7\n\nn, m = list(map(int, input().split()))\n\nl = [0]*n\n\nfor _ in range(m):\n\n l[int(input())-1] = 1\n\n\n\nt, s = 1, 0\n\n\n\nfor i in range(n):\n\n if l[i]:\n\n t, s = 0, t\n\n else:\n\n t, s = (s+t)%mod, t\n\n\n\nprint(t)", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 220, "code_v1_num_chars": 257, "code_v0_no_empty_lines": "mod = 10**9 + 7\nn, m = list(map(int, input().split()))\nl = [0] * n\nfor _ in range(m):\n l[int(input()) - 1] = 1\ns = 0\nt = 1\nfor i in range(n):\n if l[i] > 0:\n t, s = 0, t\n else:\n t, s = (s + t) % mod, t\nprint(t)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nmod = 10**9 + 7\nn, m = list(map(int, input().split()))\nl = [0] * n\nfor _ in range(m):\n l[int(input()) - 1] = 1\nt, s = 1, 0\nfor i in range(n):\n if l[i]:\n t, s = 0, t\n else:\n t, s = (s + t) % mod, t\nprint(t)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["+import sys", "+", "+input = sys.stdin.readline", "-s = 0", "-t = 1", "+t, s = 1, 0", "- if l[i] > 0:", "+ if l[i]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3071881404, "measured_runtime_v1": 0.1884790037, "runtime_lift": 1.6298268475, "key": ["s323963688", "s220101257"], "target_token_count_dream": 106, "target_token_bucket_dream": "<128"} +{"user_id": "u911856499", "problem_id": "p03774", "language": "python", "submission_id_v0": "s205905114", "submission_id_v1": "s474977819", "cpu_time_v0": 31, "cpu_time_v1": 26, "memory_v0": 9140, "memory_v1": 9144, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.13, "input": "N,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 2*10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n", "target": "N,M = [int(c) for c in input().split()]\n\nab = [list(map(int,input().split())) for c in range(N)]\n\ncd = [list(map(int,input().split())) for c in range(M)]\n\nfor i in range(N):\n\n mi = 10**9\n\n for j in range(M):\n\n tmp = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n\n if mi > tmp:\n\n mi = tmp\n\n ans = j+1\n\n print(ans)\n", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 360, "code_v1_num_chars": 358, "code_v0_no_empty_lines": "N, M = [int(c) for c in input().split()]\nab = [list(map(int, input().split())) for c in range(N)]\ncd = [list(map(int, input().split())) for c in range(M)]\nfor i in range(N):\n mi = 2 * 10**9\n for j in range(M):\n tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n if mi > tmp:\n mi = tmp\n ans = j + 1\n print(ans)\n", "code_v1_no_empty_lines": "N, M = [int(c) for c in input().split()]\nab = [list(map(int, input().split())) for c in range(N)]\ncd = [list(map(int, input().split())) for c in range(M)]\nfor i in range(N):\n mi = 10**9\n for j in range(M):\n tmp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n if mi > tmp:\n mi = tmp\n ans = j + 1\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- mi = 2 * 10**9", "+ mi = 10**9"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2982070241, "measured_runtime_v1": 0.232865705, "runtime_lift": 1.2805965742, "key": ["s205905114", "s474977819"], "target_token_count_dream": 115, "target_token_bucket_dream": "<128"} +{"user_id": "u187857228", "problem_id": "p03416", "language": "python", "submission_id_v0": "s720217601", "submission_id_v1": "s964731712", "cpu_time_v0": 154, "cpu_time_v1": 57, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 62.99, "input": "def test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n j = list(map(int,list(str(i))))\n\n if j[0] == j[4] and j[1] == j[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n", "target": "def test():\n\n a,b = list(map(int,input().split()))\n\n count = 0\n\n for i in range(a,b+1):\n\n if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n test()\n", "code_v0_loc": 12, "code_v1_loc": 11, "code_v0_num_chars": 261, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "def test():\n a, b = list(map(int, input().split()))\n count = 0\n for i in range(a, b + 1):\n j = list(map(int, list(str(i))))\n if j[0] == j[4] and j[1] == j[3]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n test()\n", "code_v1_no_empty_lines": "def test():\n a, b = list(map(int, input().split()))\n count = 0\n for i in range(a, b + 1):\n if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n test()\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["- j = list(map(int, list(str(i))))", "- if j[0] == j[4] and j[1] == j[3]:", "+ if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4881631348, "measured_runtime_v1": 0.3868406759, "runtime_lift": 1.2619229704, "key": ["s720217601", "s964731712"], "target_token_count_dream": 77, "target_token_bucket_dream": "<128"} +{"user_id": "u906428167", "problem_id": "p02821", "language": "python", "submission_id_v0": "s228028161", "submission_id_v1": "s587768475", "cpu_time_v0": 305, "cpu_time_v1": 262, "memory_v0": 55448, "memory_v1": 54460, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.1, "input": "from bisect import bisect_left\n\nfrom bisect import bisect_right\n\n\n\nn,m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = sorted(a)\n\n\n\na_count = [0]*100010\n\na_sum = [0]*100010\n\n\n\nfor i in range(n):\n\n a_count[a[i]] += 1\n\n a_sum[a[i]] += a[i]\n\n\n\nfor i in range(100005,-1,-1):\n\n a_count[i] += a_count[i+1]\n\n a_sum[i] += a_sum[i+1]\n\n\n\ndef chk(x):\n\n case = 0\n\n for i in range(n):\n\n if 0<= x-a[i]<= 10**5+5:\n\n case += a_count[x-a[i]]\n\n elif x-a[i] < 0:\n\n case += n\n\n if case >= m:\n\n ch = True\n\n else:\n\n ch = False\n\n return ch\n\n\n\nl = 2*a[-1]+1 #NG\n\nr = 1 #OK\n\n\n\nwhile abs(r-l) > 1:\n\n kk = (r+l)//2\n\n if chk(kk):\n\n r = kk\n\n else:\n\n l = kk\n\n\n\nans = 0\n\nsm = sum(a)\n\n\n\nl = r\n\n\n\ncase = 0\n\nfor i in range(n):\n\n num = n-bisect_right(a,l-a[i]-1)\n\n case += num\n\n ans += num*a[i]*2\n\n\n\nans -= (case-m)*l\n\n\n\nprint(ans)", "target": "n, m = list(map(int, input().split()))\n\na = [int(x) for x in input().split()]\n\n\n\naa = [0]*(10**5+1)\n\naa_sum = [0]*(10**5+1)\n\n\n\nfor x in a:\n\n aa[x] += 1\n\n aa_sum[x] += x\n\n\n\nfor i in range(10**5)[::-1]:\n\n aa[i] = aa[i] + aa[i+1]\n\n aa_sum[i] = aa_sum[i] + aa_sum[i+1]\n\n\n\n\n\ndef count(x):\n\n cnt = 0\n\n sm = 0\n\n for i in range(n):\n\n if x-a[i] < 0:\n\n cnt += n\n\n sm += aa_sum[0]+n*a[i]\n\n elif x-a[i] > 10**5:\n\n continue\n\n else:\n\n cnt += aa[x-a[i]]\n\n sm += aa_sum[x-a[i]]+aa[x-a[i]]*a[i]\n\n\n\n return cnt, sm\n\n\n\n\n\nbottom = 0\n\ntop = 10**6\n\n\n\nwhile top - bottom > 1:\n\n mid = (top+bottom) // 2\n\n cnt, sm = count(mid)\n\n if cnt < m:\n\n top = mid\n\n else:\n\n bottom = mid\n\n\n\ncnt, sm = count(bottom)\n\nans = sm - (cnt-m)*bottom\n\n\n\nprint(ans)\n", "code_v0_loc": 55, "code_v1_loc": 46, "code_v0_num_chars": 930, "code_v1_num_chars": 839, "code_v0_no_empty_lines": "from bisect import bisect_left\nfrom bisect import bisect_right\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = sorted(a)\na_count = [0] * 100010\na_sum = [0] * 100010\nfor i in range(n):\n a_count[a[i]] += 1\n a_sum[a[i]] += a[i]\nfor i in range(100005, -1, -1):\n a_count[i] += a_count[i + 1]\n a_sum[i] += a_sum[i + 1]\n\n\ndef chk(x):\n case = 0\n for i in range(n):\n if 0 <= x - a[i] <= 10**5 + 5:\n case += a_count[x - a[i]]\n elif x - a[i] < 0:\n case += n\n if case >= m:\n ch = True\n else:\n ch = False\n return ch\n\n\nl = 2 * a[-1] + 1 # NG\nr = 1 # OK\nwhile abs(r - l) > 1:\n kk = (r + l) // 2\n if chk(kk):\n r = kk\n else:\n l = kk\nans = 0\nsm = sum(a)\nl = r\ncase = 0\nfor i in range(n):\n num = n - bisect_right(a, l - a[i] - 1)\n case += num\n ans += num * a[i] * 2\nans -= (case - m) * l\nprint(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\na = [int(x) for x in input().split()]\naa = [0] * (10**5 + 1)\naa_sum = [0] * (10**5 + 1)\nfor x in a:\n aa[x] += 1\n aa_sum[x] += x\nfor i in range(10**5)[::-1]:\n aa[i] = aa[i] + aa[i + 1]\n aa_sum[i] = aa_sum[i] + aa_sum[i + 1]\n\n\ndef count(x):\n cnt = 0\n sm = 0\n for i in range(n):\n if x - a[i] < 0:\n cnt += n\n sm += aa_sum[0] + n * a[i]\n elif x - a[i] > 10**5:\n continue\n else:\n cnt += aa[x - a[i]]\n sm += aa_sum[x - a[i]] + aa[x - a[i]] * a[i]\n return cnt, sm\n\n\nbottom = 0\ntop = 10**6\nwhile top - bottom > 1:\n mid = (top + bottom) // 2\n cnt, sm = count(mid)\n if cnt < m:\n top = mid\n else:\n bottom = mid\ncnt, sm = count(bottom)\nans = sm - (cnt - m) * bottom\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 16.3636363636, "diff": ["-from bisect import bisect_left", "-from bisect import bisect_right", "-", "-a = list(map(int, input().split()))", "-a = sorted(a)", "-a_count = [0] * 100010", "-a_sum = [0] * 100010", "-for i in range(n):", "- a_count[a[i]] += 1", "- a_sum[a[i]] += a[i]", "-for i in range(100005, -1, -1):", "- a_count[i] += a_count[i + 1]", "- a_sum[i] += a_sum[i + 1]", "+a = [int(x) for x in input().split()]", "+aa = [0] * (10**5 + 1)", "+aa_sum = [0] * (10**5 + 1)", "+for x in a:", "+ aa[x] += 1", "+ aa_sum[x] += x", "+for i in range(10**5)[::-1]:", "+ aa[i] = aa[i] + aa[i + 1]", "+ aa_sum[i] = aa_sum[i] + aa_sum[i + 1]", "-def chk(x):", "- case = 0", "+def count(x):", "+ cnt = 0", "+ sm = 0", "- if 0 <= x - a[i] <= 10**5 + 5:", "- case += a_count[x - a[i]]", "- elif x - a[i] < 0:", "- case += n", "- if case >= m:", "- ch = True", "- else:", "- ch = False", "- return ch", "+ if x - a[i] < 0:", "+ cnt += n", "+ sm += aa_sum[0] + n * a[i]", "+ elif x - a[i] > 10**5:", "+ continue", "+ else:", "+ cnt += aa[x - a[i]]", "+ sm += aa_sum[x - a[i]] + aa[x - a[i]] * a[i]", "+ return cnt, sm", "-l = 2 * a[-1] + 1 # NG", "-r = 1 # OK", "-while abs(r - l) > 1:", "- kk = (r + l) // 2", "- if chk(kk):", "- r = kk", "+bottom = 0", "+top = 10**6", "+while top - bottom > 1:", "+ mid = (top + bottom) // 2", "+ cnt, sm = count(mid)", "+ if cnt < m:", "+ top = mid", "- l = kk", "-ans = 0", "-sm = sum(a)", "-l = r", "-case = 0", "-for i in range(n):", "- num = n - bisect_right(a, l - a[i] - 1)", "- case += num", "- ans += num * a[i] * 2", "-ans -= (case - m) * l", "+ bottom = mid", "+cnt, sm = count(bottom)", "+ans = sm - (cnt - m) * bottom"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6311447213, "measured_runtime_v1": 0.3899716654, "runtime_lift": 1.6184373822, "key": ["s228028161", "s587768475"], "target_token_count_dream": 299, "target_token_bucket_dream": "256-512"} +{"user_id": "u624475441", "problem_id": "p03548", "language": "python", "submission_id_v0": "s161926153", "submission_id_v1": "s067842786", "cpu_time_v0": 36, "cpu_time_v1": 18, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "X, Y, Z = list(map(int, input().split()))\n\nfor n in range(10 ** 5, 0, -1):\n\n if X >= n * (Y + Z) + Z:\n\n break\n\nprint(n)", "target": "X, Y, Z = list(map(int, input().split()))\n\nprint(((X - Z) // (Y + Z)))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 123, "code_v1_num_chars": 62, "code_v0_no_empty_lines": "X, Y, Z = list(map(int, input().split()))\nfor n in range(10**5, 0, -1):\n if X >= n * (Y + Z) + Z:\n break\nprint(n)\n", "code_v1_no_empty_lines": "X, Y, Z = list(map(int, input().split()))\nprint(((X - Z) // (Y + Z)))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-for n in range(10**5, 0, -1):", "- if X >= n * (Y + Z) + Z:", "- break", "-print(n)", "+print(((X - Z) // (Y + Z)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4167550103, "measured_runtime_v1": 0.2488601058, "runtime_lift": 1.6746557624, "key": ["s161926153", "s067842786"], "target_token_count_dream": 26, "target_token_bucket_dream": "<128"} +{"user_id": "u465961647", "problem_id": "p02576", "language": "python", "submission_id_v0": "s578033438", "submission_id_v1": "s457299018", "cpu_time_v0": 28, "cpu_time_v1": 25, "memory_v0": 9032, "memory_v1": 9096, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.71, "input": "array = list(map(int, input().split()))\n\nif array[0] % array[1] > 0:\n\n print(((array[0] // array[1] + 1) * array[2]))\n\nelse:\n\n print(((array[0] // array[1]) * array[2]))", "target": "n, x, t = list(map(int, input().split()))\n\n\n\nprint((0--n//x*t))", "code_v0_loc": 5, "code_v1_loc": 3, "code_v0_num_chars": 171, "code_v1_num_chars": 55, "code_v0_no_empty_lines": "array = list(map(int, input().split()))\nif array[0] % array[1] > 0:\n print(((array[0] // array[1] + 1) * array[2]))\nelse:\n print(((array[0] // array[1]) * array[2]))\n", "code_v1_no_empty_lines": "n, x, t = list(map(int, input().split()))\nprint((0 - -n // x * t))\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-array = list(map(int, input().split()))", "-if array[0] % array[1] > 0:", "- print(((array[0] // array[1] + 1) * array[2]))", "-else:", "- print(((array[0] // array[1]) * array[2]))", "+n, x, t = list(map(int, input().split()))", "+print((0 - -n // x * t))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1827679622, "measured_runtime_v1": 0.0061908547, "runtime_lift": 29.5222502437, "key": ["s578033438", "s457299018"], "target_token_count_dream": 24, "target_token_bucket_dream": "<128"} +{"user_id": "u153665391", "problem_id": "p02268", "language": "python", "submission_id_v0": "s156684058", "submission_id_v1": "s820654012", "cpu_time_v0": 520, "cpu_time_v1": 390, "memory_v0": 16712, "memory_v1": 16712, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "N = int(input())\n\nS = list(map(int, input().split()))\n\nQ = int(input())\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n idx = int((head+tail)/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n if head == idx:\n\n return False\n\n return binary_search(target_num, head, idx-1)\n\n else:\n\n if tail == idx:\n\n return False\n\n return binary_search(target_num, idx+1, tail)\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n", "target": "N = int(input())\n\nS = list(map(int, input().split()))\n\nQ = int(input())\n\nT = list(map(int, input().split()))\n\n\n\ndef binary_search(target_num, head, tail):\n\n while head <= tail:\n\n idx = int((head+tail)/2)\n\n if target_num == S[idx]:\n\n return True\n\n elif target_num < S[idx]:\n\n tail = idx - 1\n\n else:\n\n head = idx + 1\n\n return False\n\n\n\n\n\nmatch_count = 0\n\nfor target_num in T:\n\n if binary_search(target_num, 0, len(S)-1):\n\n match_count += 1\n\n\n\nprint((str(match_count)))\n", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 634, "code_v1_num_chars": 541, "code_v0_no_empty_lines": "N = int(input())\nS = list(map(int, input().split()))\nQ = int(input())\nT = list(map(int, input().split()))\n\n\ndef binary_search(target_num, head, tail):\n idx = int((head + tail) / 2)\n if target_num == S[idx]:\n return True\n elif target_num < S[idx]:\n if head == idx:\n return False\n return binary_search(target_num, head, idx - 1)\n else:\n if tail == idx:\n return False\n return binary_search(target_num, idx + 1, tail)\n\n\nmatch_count = 0\nfor target_num in T:\n if binary_search(target_num, 0, len(S) - 1):\n match_count += 1\nprint((str(match_count)))\n", "code_v1_no_empty_lines": "N = int(input())\nS = list(map(int, input().split()))\nQ = int(input())\nT = list(map(int, input().split()))\n\n\ndef binary_search(target_num, head, tail):\n while head <= tail:\n idx = int((head + tail) / 2)\n if target_num == S[idx]:\n return True\n elif target_num < S[idx]:\n tail = idx - 1\n else:\n head = idx + 1\n return False\n\n\nmatch_count = 0\nfor target_num in T:\n if binary_search(target_num, 0, len(S) - 1):\n match_count += 1\nprint((str(match_count)))\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- idx = int((head + tail) / 2)", "- if target_num == S[idx]:", "- return True", "- elif target_num < S[idx]:", "- if head == idx:", "- return False", "- return binary_search(target_num, head, idx - 1)", "- else:", "- if tail == idx:", "- return False", "- return binary_search(target_num, idx + 1, tail)", "+ while head <= tail:", "+ idx = int((head + tail) / 2)", "+ if target_num == S[idx]:", "+ return True", "+ elif target_num < S[idx]:", "+ tail = idx - 1", "+ else:", "+ head = idx + 1", "+ return False"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3635195796, "measured_runtime_v1": 0.2206529045, "runtime_lift": 1.6474724429, "key": ["s156684058", "s820654012"], "target_token_count_dream": 141, "target_token_bucket_dream": "128-256"} +{"user_id": "u924353076", "problem_id": "p03796", "language": "python", "submission_id_v0": "s982585501", "submission_id_v1": "s413088188", "cpu_time_v0": 118, "cpu_time_v1": 40, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.1, "input": "n=input()\n\nn=int(n)\n\na=1\n\nfor i in range(n):\n\n a=a*(i+1)\n\n if a>=pow(10,9)+7:\n\n a=a%(pow(10,9)+7)\n\nprint(a)", "target": "n=int(input())\n\na=1\n\nfor i in range(1,n+1):\n\n a*=i\n\n a %= (10**9+7)\n\nprint(a)", "code_v0_loc": 8, "code_v1_loc": 6, "code_v0_num_chars": 120, "code_v1_num_chars": 83, "code_v0_no_empty_lines": "n = input()\nn = int(n)\na = 1\nfor i in range(n):\n a = a * (i + 1)\n if a >= pow(10, 9) + 7:\n a = a % (pow(10, 9) + 7)\nprint(a)\n", "code_v1_no_empty_lines": "n = int(input())\na = 1\nfor i in range(1, n + 1):\n a *= i\n a %= 10**9 + 7\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-n = input()", "-n = int(n)", "+n = int(input())", "-for i in range(n):", "- a = a * (i + 1)", "- if a >= pow(10, 9) + 7:", "- a = a % (pow(10, 9) + 7)", "+for i in range(1, n + 1):", "+ a *= i", "+ a %= 10**9 + 7"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4161043401, "measured_runtime_v1": 0.2489673834, "runtime_lift": 1.6713206943, "key": ["s982585501", "s413088188"], "target_token_count_dream": 37, "target_token_bucket_dream": "<128"} +{"user_id": "u935184340", "problem_id": "p00003", "language": "python", "submission_id_v0": "s695745765", "submission_id_v1": "s444816349", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 7832, "memory_v1": 7708, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "import sys\n\nr = []\n\nn = int(input())\n\nl = sys.stdin.readlines()\n\nfor i in l:\n\n x, y, z = sorted([x*x for x in list(map(int, i.split()))])\n\n if x + y == z:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")", "target": "import sys\n\n\n\nn = int(input())\n\nl = sys.stdin.readlines()\n\ns = \"\"\n\nfor i in l:\n\n x, y, z = sorted(map(lambda x:x*x,map(int, i.split())))\n\n if x + y == z:\n\n s += \"YES\\n\"\n\n else:\n\n s += \"NO\\n\"\n\n\n\nprint(s,end=\"\")\n", "code_v0_loc": 10, "code_v1_loc": 13, "code_v0_num_chars": 201, "code_v1_num_chars": 222, "code_v0_no_empty_lines": "import sys\n\nr = []\nn = int(input())\nl = sys.stdin.readlines()\nfor i in l:\n x, y, z = sorted([x * x for x in list(map(int, i.split()))])\n if x + y == z:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nn = int(input())\nl = sys.stdin.readlines()\ns = \"\"\nfor i in l:\n x, y, z = sorted(map(lambda x: x * x, map(int, i.split())))\n if x + y == z:\n s += \"YES\\n\"\n else:\n s += \"NO\\n\"\nprint(s, end=\"\")\n", "code_same": false, "relative_loc_diff_percent": 23.0769230769, "diff": ["-r = []", "-n = int(input())", "+n = int(input())", "+s = \"\"", "- x, y, z = sorted([x * x for x in list(map(int, i.split()))])", "+ x, y, z = sorted(map(lambda x: x * x, map(int, i.split())))", "- print(\"YES\")", "+ s += \"YES\\n\"", "- print(\"NO\")", "+ s += \"NO\\n\"", "+print(s, end=\"\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3577006006, "measured_runtime_v1": 0.2704619627, "runtime_lift": 1.3225541848, "key": ["s695745765", "s444816349"], "target_token_count_dream": 71, "target_token_bucket_dream": "<128"} +{"user_id": "u887207211", "problem_id": "p03086", "language": "python", "submission_id_v0": "s916999030", "submission_id_v1": "s575230730", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "import re\n\nptn = re.compile(r\"(A|C|G|T)*\")\n\n\n\nS = input()\n\n\n\nans = 0\n\nfor i in range(len(S)):\n\n for j in range(len(S)):\n\n x = ptn.match(S[i:i+j+1]).group(0)\n\n if(x):\n\n ans = max(ans, len(x))\n\nprint(ans)", "target": "import sys\n\n\n\nstdin = sys.stdin\n\n\n\nns = lambda : stdin.readline().rstrip()\n\nni = lambda : int(ns())\n\nna = lambda : list(map(int, stdin.readline().split()))\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef check(In):\n\n return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"\n\n\n\ndef main():\n\n s = ns()\n\n\n\n count = 0\n\n ans = 0\n\n for i in range(len(s)):\n\n if check(s[i]):\n\n count = 0\n\n else:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 12, "code_v1_loc": 27, "code_v0_num_chars": 214, "code_v1_num_chars": 537, "code_v0_no_empty_lines": "import re\n\nptn = re.compile(r\"(A|C|G|T)*\")\nS = input()\nans = 0\nfor i in range(len(S)):\n for j in range(len(S)):\n x = ptn.match(S[i : i + j + 1]).group(0)\n if x:\n ans = max(ans, len(x))\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nstdin = sys.stdin\nns = lambda: stdin.readline().rstrip()\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nsys.setrecursionlimit(10**7)\n\n\ndef check(In):\n return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"\n\n\ndef main():\n s = ns()\n count = 0\n ans = 0\n for i in range(len(s)):\n if check(s[i]):\n count = 0\n else:\n count += 1\n ans = max(ans, count)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-import re", "+import sys", "-ptn = re.compile(r\"(A|C|G|T)*\")", "-S = input()", "-ans = 0", "-for i in range(len(S)):", "- for j in range(len(S)):", "- x = ptn.match(S[i : i + j + 1]).group(0)", "- if x:", "- ans = max(ans, len(x))", "-print(ans)", "+stdin = sys.stdin", "+ns = lambda: stdin.readline().rstrip()", "+ni = lambda: int(ns())", "+na = lambda: list(map(int, stdin.readline().split()))", "+sys.setrecursionlimit(10**7)", "+", "+", "+def check(In):", "+ return In != \"A\" and In != \"C\" and In != \"G\" and In != \"T\"", "+", "+", "+def main():", "+ s = ns()", "+ count = 0", "+ ans = 0", "+ for i in range(len(s)):", "+ if check(s[i]):", "+ count = 0", "+ else:", "+ count += 1", "+ ans = max(ans, count)", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3654596429, "measured_runtime_v1": 0.2052364919, "runtime_lift": 1.7806757436, "key": ["s916999030", "s575230730"], "target_token_count_dream": 153, "target_token_bucket_dream": "128-256"} +{"user_id": "u489959379", "problem_id": "p03371", "language": "python", "submission_id_v0": "s775348159", "submission_id_v1": "s575049266", "cpu_time_v0": 62, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.58, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nab = c * 2\n\n\n\nres = float(\"inf\")\n\nif a + b <= ab:\n\n res = x * a + y * b\n\nelse:\n\n if x == y:\n\n res = x * ab\n\n elif x > y:\n\n for i in range(y, x + 1):\n\n cost = i * ab + (x - i) * a\n\n res = min(res, cost)\n\n else:\n\n for i in range(x, y + 1):\n\n cost = i * ab + (y - i) * b\n\n res = min(res, cost)\n\nprint(res)\n", "target": "import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\ninput = sys.stdin.readline\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n c *= 2\n\n if a + b > c:\n\n cost1 = max(x, y) * c\n\n cost2 = min(x, y) * c\n\n plus = ((y - x) * b) if x < y else (x - y) * a\n\n res = min(cost1, cost2 + plus)\n\n else:\n\n res = x * a + y * b\n\n print(res)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "code_v0_loc": 18, "code_v1_loc": 22, "code_v0_num_chars": 423, "code_v1_num_chars": 471, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nab = c * 2\nres = float(\"inf\")\nif a + b <= ab:\n res = x * a + y * b\nelse:\n if x == y:\n res = x * ab\n elif x > y:\n for i in range(y, x + 1):\n cost = i * ab + (x - i) * a\n res = min(res, cost)\n else:\n for i in range(x, y + 1):\n cost = i * ab + (y - i) * b\n res = min(res, cost)\nprint(res)\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef resolve():\n a, b, c, x, y = list(map(int, input().split()))\n c *= 2\n if a + b > c:\n cost1 = max(x, y) * c\n cost2 = min(x, y) * c\n plus = ((y - x) * b) if x < y else (x - y) * a\n res = min(cost1, cost2 + plus)\n else:\n res = x * a + y * b\n print(res)\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-a, b, c, x, y = list(map(int, input().split()))", "-ab = c * 2", "-res = float(\"inf\")", "-if a + b <= ab:", "- res = x * a + y * b", "-else:", "- if x == y:", "- res = x * ab", "- elif x > y:", "- for i in range(y, x + 1):", "- cost = i * ab + (x - i) * a", "- res = min(res, cost)", "+import sys", "+", "+sys.setrecursionlimit(10**7)", "+input = sys.stdin.readline", "+f_inf = float(\"inf\")", "+mod = 10**9 + 7", "+", "+", "+def resolve():", "+ a, b, c, x, y = list(map(int, input().split()))", "+ c *= 2", "+ if a + b > c:", "+ cost1 = max(x, y) * c", "+ cost2 = min(x, y) * c", "+ plus = ((y - x) * b) if x < y else (x - y) * a", "+ res = min(cost1, cost2 + plus)", "- for i in range(x, y + 1):", "- cost = i * ab + (y - i) * b", "- res = min(res, cost)", "-print(res)", "+ res = x * a + y * b", "+ print(res)", "+", "+", "+if __name__ == \"__main__\":", "+ resolve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3014842281, "measured_runtime_v1": 0.1645996099, "runtime_lift": 1.8316217662, "key": ["s775348159", "s575049266"], "target_token_count_dream": 166, "target_token_bucket_dream": "128-256"} +{"user_id": "u243699903", "problem_id": "p03371", "language": "python", "submission_id_v0": "s088381244", "submission_id_v1": "s357905210", "cpu_time_v0": 104, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.65, "input": "a,b,c,x,y=list(map(int,input().split()))\n\n\n\nans=a*x+b*y\n\nfor ci in range(max(x,y)+1):\n\n sumc = 2*ci*c\n\n sumc += (x-ci)*a if (x-ci)>0 else 0\n\n sumc += (y-ci)*b if (y-ci)>0 else 0\n\n ans=min(ans,sumc)\n\n\n\nprint(ans)", "target": "a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nif x==y:\n\n ans=min(ans,2*x*c)\n\nelif x>y:\n\n ans=min(ans,a*(x-y)+2*y*c)\n\n ans=min(ans,2*x*c)\n\nelse:\n\n ans=min(ans,b*(y-x)+2*x*c)\n\n ans=min(ans,2*y*c)\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 11, "code_v0_num_chars": 217, "code_v1_num_chars": 223, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nfor ci in range(max(x, y) + 1):\n sumc = 2 * ci * c\n sumc += (x - ci) * a if (x - ci) > 0 else 0\n sumc += (y - ci) * b if (y - ci) > 0 else 0\n ans = min(ans, sumc)\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nif x == y:\n ans = min(ans, 2 * x * c)\nelif x > y:\n ans = min(ans, a * (x - y) + 2 * y * c)\n ans = min(ans, 2 * x * c)\nelse:\n ans = min(ans, b * (y - x) + 2 * x * c)\n ans = min(ans, 2 * y * c)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-for ci in range(max(x, y) + 1):", "- sumc = 2 * ci * c", "- sumc += (x - ci) * a if (x - ci) > 0 else 0", "- sumc += (y - ci) * b if (y - ci) > 0 else 0", "- ans = min(ans, sumc)", "+if x == y:", "+ ans = min(ans, 2 * x * c)", "+elif x > y:", "+ ans = min(ans, a * (x - y) + 2 * y * c)", "+ ans = min(ans, 2 * x * c)", "+else:", "+ ans = min(ans, b * (y - x) + 2 * x * c)", "+ ans = min(ans, 2 * y * c)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2025436199, "measured_runtime_v1": 0.1559800074, "runtime_lift": 1.2985229532, "key": ["s088381244", "s357905210"], "target_token_count_dream": 85, "target_token_bucket_dream": "<128"} +{"user_id": "u260980560", "problem_id": "p01105", "language": "python", "submission_id_v0": "s936098014", "submission_id_v1": "s480075396", "cpu_time_v0": 50, "cpu_time_v1": 40, "memory_v0": 8604, "memory_v1": 8508, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.0, "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p ^ e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&%s\"%\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n", "target": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nQ = [(1, a), (1, b), (1, c), (1, d)]\n\nL = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}\n\nH = []\n\nget = L.get\n\npush = H.append\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < get(p ^ e, 17):\n\n L[p ^ e] = l+1\n\n l < 15 and heappush(Q, (l+1, p ^ e))\n\n if l < 13:\n\n li = 13-l; l3 = 3+l\n\n for q, r in H:\n\n if r <= li:\n\n k = p & q\n\n if r < get(k, 17)-l3:\n\n L[k] = l3+r\n\n r < li and heappush(Q, (l3+r, k))\n\n k = p ^ q\n\n if r < get(k, 17)-l3:\n\n L[k] = l3+r\n\n r < li and heappush(Q, (l3+r, k))\n\n else: break\n\n if l < 7: push((p, l))\n\nprint(*map(L.__getitem__, eval(\"e&\"+\",e&\".join(open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]))),sep='\\n')\n", "code_v0_loc": 26, "code_v1_loc": 28, "code_v0_num_chars": 917, "code_v1_num_chars": 953, "code_v0_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\nQ = [(1, el) for el in base]\nL = {el: 1 for el in base}\nH = []\nget = L.get\npush = H.append\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < get(p ^ e, 17):\n L[p ^ e] = l + 1\n if l + 1 < 16:\n heappush(Q, (l + 1, p ^ e))\n if l + 3 < 16:\n for q, r in H:\n if l + r + 3 <= 16:\n if l + r + 3 < get(p & q, 17):\n L[p & q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p & q))\n if l + r + 3 < get(p ^ q, 17):\n L[p ^ q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p ^ q))\n else:\n break\n if l < 7:\n push((p, l))\nprint(\n *map(\n L.__getitem__,\n eval(\n \"e&%s\"\n % \",e&\".join(\n open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]\n )\n ),\n ),\n sep=\"\\n\"\n)\n", "code_v1_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nQ = [(1, a), (1, b), (1, c), (1, d)]\nL = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}\nH = []\nget = L.get\npush = H.append\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < get(p ^ e, 17):\n L[p ^ e] = l + 1\n l < 15 and heappush(Q, (l + 1, p ^ e))\n if l < 13:\n li = 13 - l\n l3 = 3 + l\n for q, r in H:\n if r <= li:\n k = p & q\n if r < get(k, 17) - l3:\n L[k] = l3 + r\n r < li and heappush(Q, (l3 + r, k))\n k = p ^ q\n if r < get(k, 17) - l3:\n L[k] = l3 + r\n r < li and heappush(Q, (l3 + r, k))\n else:\n break\n if l < 7:\n push((p, l))\nprint(\n *map(\n L.__getitem__,\n eval(\n \"e&\"\n + \",e&\".join(\n open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]\n )\n ),\n ),\n sep=\"\\n\"\n)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-base = [a, b, c, d, e, 0]", "-Q = [(1, el) for el in base]", "-L = {el: 1 for el in base}", "+Q = [(1, a), (1, b), (1, c), (1, d)]", "+L = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}", "- if l + 1 < 16:", "- heappush(Q, (l + 1, p ^ e))", "- if l + 3 < 16:", "+ l < 15 and heappush(Q, (l + 1, p ^ e))", "+ if l < 13:", "+ li = 13 - l", "+ l3 = 3 + l", "- if l + r + 3 <= 16:", "- if l + r + 3 < get(p & q, 17):", "- L[p & q] = l + r + 3", "- if l + r + 3 < 16:", "- heappush(Q, (l + r + 3, p & q))", "- if l + r + 3 < get(p ^ q, 17):", "- L[p ^ q] = l + r + 3", "- if l + r + 3 < 16:", "- heappush(Q, (l + r + 3, p ^ q))", "+ if r <= li:", "+ k = p & q", "+ if r < get(k, 17) - l3:", "+ L[k] = l3 + r", "+ r < li and heappush(Q, (l3 + r, k))", "+ k = p ^ q", "+ if r < get(k, 17) - l3:", "+ L[k] = l3 + r", "+ r < li and heappush(Q, (l3 + r, k))", "- \"e&%s\"", "- % \",e&\".join(", "+ \"e&\"", "+ + \",e&\".join("], "diff_only_import_comment": false, "measured_runtime_v0": 0.4434673564, "measured_runtime_v1": 0.3305070457, "runtime_lift": 1.3417788278, "key": ["s936098014", "s480075396"], "target_token_count_dream": 393, "target_token_bucket_dream": "256-512"} +{"user_id": "u638795007", "problem_id": "p04020", "language": "python", "submission_id_v0": "s043977447", "submission_id_v1": "s372001933", "cpu_time_v0": 265, "cpu_time_v1": 111, "memory_v0": 44252, "memory_v1": 8004, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.11, "input": "def examB():\n\n N = I(); A = [I() for _ in range(N)]\n\n ans = 0; cur= 0\n\n for i in A:\n\n if i==0:\n\n ans += cur//2\n\n cur = 0\n\n else:\n\n cur += i\n\n ans += cur // 2\n\n print(ans)\n\n return\n\n\n\nimport sys,copy,bisect,itertools,heapq,math\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\n\n\nif __name__ == '__main__':\n\n examB()\n", "target": "def examA():\n\n S = SI()\n\n if \"W\" in S and not \"E\" in S:\n\n print(\"No\")\n\n elif \"E\" in S and not \"W\" in S:\n\n print(\"No\")\n\n elif \"N\" in S and not \"S\" in S:\n\n print(\"No\")\n\n elif \"S\" in S and not \"N\" in S:\n\n print(\"No\")\n\n else:\n\n print(\"Yes\")\n\n return\n\n\n\ndef examB():\n\n N = I()\n\n A = [I()for _ in range(N)]\n\n ans = 0\n\n for i in range(N-1):\n\n ans += A[i]//2\n\n if A[i]%2 and A[i+1]>=1:\n\n ans += 1\n\n A[i+1] -= 1\n\n ans += A[N-1]//2\n\n print(ans)\n\n return\n\n\n\ndef examC():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examD():\n\n N = I()\n\n S = [I()for _ in range(N)]\n\n\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examE():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\ndef examF():\n\n ans = 0\n\n print(ans)\n\n return\n\n\n\nimport sys,bisect,itertools,heapq,math,random\n\nfrom copy import deepcopy\n\nfrom heapq import heappop,heappush,heapify\n\nfrom collections import Counter,defaultdict,deque\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\n\ndef LS(): return sys.stdin.readline().split()\n\ndef SI(): return sys.stdin.readline().strip()\n\nglobal mod,mod2,inf,alphabet,_ep\n\nmod = 10**9 + 7\n\nmod2 = 998244353\n\ninf = 10**18\n\n_ep = 10**(-12)\n\nalphabet = [chr(ord('a') + i) for i in range(26)]\n\n\n\nsys.setrecursionlimit(10**6)\n\n\n\nif __name__ == '__main__':\n\n examB()\n\n\n\n\"\"\"\n\n\n\n\"\"\"", "code_v0_loc": 26, "code_v1_loc": 74, "code_v0_num_chars": 729, "code_v1_num_chars": 1504, "code_v0_no_empty_lines": "def examB():\n N = I()\n A = [I() for _ in range(N)]\n ans = 0\n cur = 0\n for i in A:\n if i == 0:\n ans += cur // 2\n cur = 0\n else:\n cur += i\n ans += cur // 2\n print(ans)\n return\n\n\nimport sys, copy, bisect, itertools, heapq, math\nfrom heapq import heappop, heappush, heapify\nfrom collections import Counter, defaultdict, deque\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LSI():\n return list(map(str, sys.stdin.readline().split()))\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef SI():\n return sys.stdin.readline().strip()\n\n\nmod = 10**9 + 7\ninf = float(\"inf\")\nif __name__ == \"__main__\":\n examB()\n", "code_v1_no_empty_lines": "def examA():\n S = SI()\n if \"W\" in S and not \"E\" in S:\n print(\"No\")\n elif \"E\" in S and not \"W\" in S:\n print(\"No\")\n elif \"N\" in S and not \"S\" in S:\n print(\"No\")\n elif \"S\" in S and not \"N\" in S:\n print(\"No\")\n else:\n print(\"Yes\")\n return\n\n\ndef examB():\n N = I()\n A = [I() for _ in range(N)]\n ans = 0\n for i in range(N - 1):\n ans += A[i] // 2\n if A[i] % 2 and A[i + 1] >= 1:\n ans += 1\n A[i + 1] -= 1\n ans += A[N - 1] // 2\n print(ans)\n return\n\n\ndef examC():\n ans = 0\n print(ans)\n return\n\n\ndef examD():\n N = I()\n S = [I() for _ in range(N)]\n ans = 0\n print(ans)\n return\n\n\ndef examE():\n ans = 0\n print(ans)\n return\n\n\ndef examF():\n ans = 0\n print(ans)\n return\n\n\nimport sys, bisect, itertools, heapq, math, random\nfrom copy import deepcopy\nfrom heapq import heappop, heappush, heapify\nfrom collections import Counter, defaultdict, deque\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef LSI():\n return list(map(str, sys.stdin.readline().split()))\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef SI():\n return sys.stdin.readline().strip()\n\n\nglobal mod, mod2, inf, alphabet, _ep\nmod = 10**9 + 7\nmod2 = 998244353\ninf = 10**18\n_ep = 10 ** (-12)\nalphabet = [chr(ord(\"a\") + i) for i in range(26)]\nsys.setrecursionlimit(10**6)\nif __name__ == \"__main__\":\n examB()\n\"\"\"\n\"\"\"\n", "code_same": false, "relative_loc_diff_percent": 64.8648648649, "diff": ["+def examA():", "+ S = SI()", "+ if \"W\" in S and not \"E\" in S:", "+ print(\"No\")", "+ elif \"E\" in S and not \"W\" in S:", "+ print(\"No\")", "+ elif \"N\" in S and not \"S\" in S:", "+ print(\"No\")", "+ elif \"S\" in S and not \"N\" in S:", "+ print(\"No\")", "+ else:", "+ print(\"Yes\")", "+ return", "+", "+", "- cur = 0", "- for i in A:", "- if i == 0:", "- ans += cur // 2", "- cur = 0", "- else:", "- cur += i", "- ans += cur // 2", "+ for i in range(N - 1):", "+ ans += A[i] // 2", "+ if A[i] % 2 and A[i + 1] >= 1:", "+ ans += 1", "+ A[i + 1] -= 1", "+ ans += A[N - 1] // 2", "-import sys, copy, bisect, itertools, heapq, math", "+def examC():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def examD():", "+ N = I()", "+ S = [I() for _ in range(N)]", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def examE():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def examF():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+import sys, bisect, itertools, heapq, math, random", "+from copy import deepcopy", "+global mod, mod2, inf, alphabet, _ep", "-inf = float(\"inf\")", "+mod2 = 998244353", "+inf = 10**18", "+_ep = 10 ** (-12)", "+alphabet = [chr(ord(\"a\") + i) for i in range(26)]", "+sys.setrecursionlimit(10**6)", "+\"\"\"", "+\"\"\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.1928541586, "measured_runtime_v1": 0.006450581, "runtime_lift": 29.8971764609, "key": ["s043977447", "s372001933"], "target_token_count_dream": 483, "target_token_bucket_dream": "256-512"} +{"user_id": "u193598069", "problem_id": "p03544", "language": "python", "submission_id_v0": "s403516424", "submission_id_v1": "s258691406", "cpu_time_v0": 27, "cpu_time_v1": 17, "memory_v0": 10740, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.04, "input": "N = int(input())\n\nL = [ 0 ] * 1000000\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n", "target": "N = int(input())\n\nL = [ 0 ] * (N+1)\n\n\n\nL[0] = 2\n\nL[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n L[i] = L[i-2] + L[i-1]\n\n\n\nprint((L[N]))\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 129, "code_v1_num_chars": 127, "code_v0_no_empty_lines": "N = int(input())\nL = [0] * 1000000\nL[0] = 2\nL[1] = 1\nfor i in range(2, N + 1):\n L[i] = L[i - 2] + L[i - 1]\nprint((L[N]))\n", "code_v1_no_empty_lines": "N = int(input())\nL = [0] * (N + 1)\nL[0] = 2\nL[1] = 1\nfor i in range(2, N + 1):\n L[i] = L[i - 2] + L[i - 1]\nprint((L[N]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-L = [0] * 1000000", "+L = [0] * (N + 1)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4811118691, "measured_runtime_v1": 0.3226976706, "runtime_lift": 1.4909059249, "key": ["s403516424", "s258691406"], "target_token_count_dream": 65, "target_token_bucket_dream": "<128"} +{"user_id": "u218834617", "problem_id": "p03013", "language": "python", "submission_id_v0": "s048931274", "submission_id_v1": "s960526895", "cpu_time_v0": 127, "cpu_time_v1": 59, "memory_v0": 17264, "memory_v1": 17228, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 53.54, "input": "import sys\n\nN,M=list(map(int,input().split()))\n\nS=set(map(int,sys.stdin))\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in S:\n\n a,b=b,0\n\n else:\n\n a,b=b,a+b\n\n\n\nprint((b%(10**9+7)))\n", "target": "import sys\n\n\n\nN,M=list(map(int,input().split()))\n\nbad=set(map(int,sys.stdin))\n\nMOD=10**9+7\n\n\n\na,b=0,1\n\nfor i in range(1,N+1):\n\n if i in bad:\n\n a,b=b,0\n\n if a==0:\n\n break\n\n else:\n\n a,b=b,(a+b)%MOD\n\n\n\nprint(b)\n", "code_v0_loc": 12, "code_v1_loc": 16, "code_v0_num_chars": 188, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "import sys\n\nN, M = list(map(int, input().split()))\nS = set(map(int, sys.stdin))\na, b = 0, 1\nfor i in range(1, N + 1):\n if i in S:\n a, b = b, 0\n else:\n a, b = b, a + b\nprint((b % (10**9 + 7)))\n", "code_v1_no_empty_lines": "import sys\n\nN, M = list(map(int, input().split()))\nbad = set(map(int, sys.stdin))\nMOD = 10**9 + 7\na, b = 0, 1\nfor i in range(1, N + 1):\n if i in bad:\n a, b = b, 0\n if a == 0:\n break\n else:\n a, b = b, (a + b) % MOD\nprint(b)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-S = set(map(int, sys.stdin))", "+bad = set(map(int, sys.stdin))", "+MOD = 10**9 + 7", "- if i in S:", "+ if i in bad:", "+ if a == 0:", "+ break", "- a, b = b, a + b", "-print((b % (10**9 + 7)))", "+ a, b = b, (a + b) % MOD", "+print(b)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3212681165, "measured_runtime_v1": 0.212405349, "runtime_lift": 1.5125236626, "key": ["s048931274", "s960526895"], "target_token_count_dream": 84, "target_token_bucket_dream": "<128"} +{"user_id": "u813384600", "problem_id": "p01138", "language": "python", "submission_id_v0": "s409826221", "submission_id_v1": "s148489336", "cpu_time_v0": 6790, "cpu_time_v1": 260, "memory_v0": 9596, "memory_v1": 7608, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 96.17, "input": "import re\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = [0] * (24*60*60+1)\n\n for _ in range(n):\n\n h1,m1,s1,h2,m2,s2 = list(map(int, re.split(':| ', input())))\n\n l[h1*60*60 + m1*60 + s1] += 1\n\n l[h2*60*60 + m2*60 + s2] -= 1\n\n r = 0\n\n for i in range(24*60*60):\n\n l[i+1] += l[i]\n\n r = max(r, l[i+1])\n\n print(r)", "target": "while True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n l = []\n\n for _ in range(n):\n\n hms1, hms2 = input().split()\n\n l.append((hms1, True))\n\n l.append((hms2, False))\n\n l.sort()\n\n r, t = 0, 0\n\n for i in range(len(l)):\n\n if l[i][1]:\n\n t += 1\n\n else:\n\n t -= 1\n\n r = max(r, t)\n\n print(r)", "code_v0_loc": 16, "code_v1_loc": 18, "code_v0_num_chars": 386, "code_v1_num_chars": 383, "code_v0_no_empty_lines": "import re\n\nwhile True:\n n = int(input())\n if n == 0:\n break\n l = [0] * (24 * 60 * 60 + 1)\n for _ in range(n):\n h1, m1, s1, h2, m2, s2 = list(map(int, re.split(\":| \", input())))\n l[h1 * 60 * 60 + m1 * 60 + s1] += 1\n l[h2 * 60 * 60 + m2 * 60 + s2] -= 1\n r = 0\n for i in range(24 * 60 * 60):\n l[i + 1] += l[i]\n r = max(r, l[i + 1])\n print(r)\n", "code_v1_no_empty_lines": "while True:\n n = int(input())\n if n == 0:\n break\n l = []\n for _ in range(n):\n hms1, hms2 = input().split()\n l.append((hms1, True))\n l.append((hms2, False))\n l.sort()\n r, t = 0, 0\n for i in range(len(l)):\n if l[i][1]:\n t += 1\n else:\n t -= 1\n r = max(r, t)\n print(r)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-import re", "-", "- l = [0] * (24 * 60 * 60 + 1)", "+ l = []", "- h1, m1, s1, h2, m2, s2 = list(map(int, re.split(\":| \", input())))", "- l[h1 * 60 * 60 + m1 * 60 + s1] += 1", "- l[h2 * 60 * 60 + m2 * 60 + s2] -= 1", "- r = 0", "- for i in range(24 * 60 * 60):", "- l[i + 1] += l[i]", "- r = max(r, l[i + 1])", "+ hms1, hms2 = input().split()", "+ l.append((hms1, True))", "+ l.append((hms2, False))", "+ l.sort()", "+ r, t = 0, 0", "+ for i in range(len(l)):", "+ if l[i][1]:", "+ t += 1", "+ else:", "+ t -= 1", "+ r = max(r, t)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.2066217821, "measured_runtime_v1": 0.2932185929, "runtime_lift": 4.1150930102, "key": ["s409826221", "s148489336"], "target_token_count_dream": 121, "target_token_bucket_dream": "<128"} +{"user_id": "u291766461", "problem_id": "p03074", "language": "python", "submission_id_v0": "s221518045", "submission_id_v1": "s305948108", "cpu_time_v0": 149, "cpu_time_v1": 123, "memory_v0": 4212, "memory_v1": 7884, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.45, "input": "N, K = list(map(int, input().split()))\n\nS = input()\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\nleft = 0\n\nright = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n\n\n next_left = i\n\n next_right = min(i + add, len(nums))\n\n\n\n while next_left > left:\n\n tmp -= nums[left]\n\n left += 1\n\n\n\n while next_right > right:\n\n tmp += nums[right]\n\n right += 1\n\n\n\n ans = max(ans, tmp)\n\nprint(ans)", "target": "N, K = list(map(int, input().split()))\n\nS = input()\n\nnums = []\n\nnow = 1\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == str(now):\n\n cnt += 1\n\n else:\n\n nums.append(cnt)\n\n now = 1 - now\n\n cnt = 1\n\nif cnt != 0:\n\n nums.append(cnt)\n\nif len(nums) % 2 == 0:\n\n nums.append(0)\n\n\n\ncsum = [0] * (len(nums) + 1)\n\nfor i in range(len(nums)):\n\n csum[i + 1] = csum[i] + nums[i]\n\n\n\nadd = 2 * K + 1\n\nans = 0\n\ntmp = 0\n\nfor i in range(0, len(nums), 2):\n\n left = i\n\n right = min(i + add, len(nums))\n\n tmp = csum[right] - csum[left]\n\n ans = max(ans, tmp)\n\nprint(ans)", "code_v0_loc": 37, "code_v1_loc": 30, "code_v0_num_chars": 647, "code_v1_num_chars": 587, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nS = input()\nnums = []\nnow = 1\ncnt = 0\nfor i in range(N):\n if S[i] == str(now):\n cnt += 1\n else:\n nums.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:\n nums.append(cnt)\nif len(nums) % 2 == 0:\n nums.append(0)\nadd = 2 * K + 1\nans = 0\nleft = 0\nright = 0\ntmp = 0\nfor i in range(0, len(nums), 2):\n next_left = i\n next_right = min(i + add, len(nums))\n while next_left > left:\n tmp -= nums[left]\n left += 1\n while next_right > right:\n tmp += nums[right]\n right += 1\n ans = max(ans, tmp)\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nS = input()\nnums = []\nnow = 1\ncnt = 0\nfor i in range(N):\n if S[i] == str(now):\n cnt += 1\n else:\n nums.append(cnt)\n now = 1 - now\n cnt = 1\nif cnt != 0:\n nums.append(cnt)\nif len(nums) % 2 == 0:\n nums.append(0)\ncsum = [0] * (len(nums) + 1)\nfor i in range(len(nums)):\n csum[i + 1] = csum[i] + nums[i]\nadd = 2 * K + 1\nans = 0\ntmp = 0\nfor i in range(0, len(nums), 2):\n left = i\n right = min(i + add, len(nums))\n tmp = csum[right] - csum[left]\n ans = max(ans, tmp)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 18.9189189189, "diff": ["+csum = [0] * (len(nums) + 1)", "+for i in range(len(nums)):", "+ csum[i + 1] = csum[i] + nums[i]", "-left = 0", "-right = 0", "- next_left = i", "- next_right = min(i + add, len(nums))", "- while next_left > left:", "- tmp -= nums[left]", "- left += 1", "- while next_right > right:", "- tmp += nums[right]", "- right += 1", "+ left = i", "+ right = min(i + add, len(nums))", "+ tmp = csum[right] - csum[left]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2166490428, "measured_runtime_v1": 0.0894378448, "runtime_lift": 2.422341945, "key": ["s221518045", "s305948108"], "target_token_count_dream": 212, "target_token_bucket_dream": "128-256"} +{"user_id": "u242518667", "problem_id": "p03424", "language": "python", "submission_id_v0": "s488879497", "submission_id_v1": "s152130126", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "n=int(input())\n\ns=list(map(str,input().split()))\n\ntotal=[]\n\nfor i in range(n):\n\n if s[i] not in total:\n\n total.append(s[i])\n\nprint(('Three' if len(total)==3 else 'Four'))", "target": "input()\n\nl=list(map(str,input().split()))\n\nprint(('Three' if len(set(l))==3 else 'Four'))", "code_v0_loc": 7, "code_v1_loc": 3, "code_v0_num_chars": 178, "code_v1_num_chars": 81, "code_v0_no_empty_lines": "n = int(input())\ns = list(map(str, input().split()))\ntotal = []\nfor i in range(n):\n if s[i] not in total:\n total.append(s[i])\nprint((\"Three\" if len(total) == 3 else \"Four\"))\n", "code_v1_no_empty_lines": "input()\nl = list(map(str, input().split()))\nprint((\"Three\" if len(set(l)) == 3 else \"Four\"))\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-n = int(input())", "-s = list(map(str, input().split()))", "-total = []", "-for i in range(n):", "- if s[i] not in total:", "- total.append(s[i])", "-print((\"Three\" if len(total) == 3 else \"Four\"))", "+input()", "+l = list(map(str, input().split()))", "+print((\"Three\" if len(set(l)) == 3 else \"Four\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3119253957, "measured_runtime_v1": 0.2361336248, "runtime_lift": 1.3209698364, "key": ["s488879497", "s152130126"], "target_token_count_dream": 24, "target_token_bucket_dream": "<128"} +{"user_id": "u607865971", "problem_id": "p03164", "language": "python", "submission_id_v0": "s900171177", "submission_id_v1": "s494365384", "cpu_time_v0": 1438, "cpu_time_v1": 1016, "memory_v0": 27184, "memory_v1": 19300, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.35, "input": "import sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = [float('inf')] * 1000 * 100*10\n\nvs = set()\n\nvs.add(0)\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n tmpDP = dp.copy()\n\n for vv in list(vs):\n\n if dp[vv + v] > dp[vv] + w:\n\n tmpDP[vv + v] = dp[vv] + w\n\n vs.add(vv + v)\n\n dp = tmpDP\n\n\n\n\n\nans = 0\n\nfor v in list(vs):\n\n if dp[v] <= W:\n\n ans = max(ans, v)\n\nprint(ans)\n", "target": "import sys\n\nfrom collections import Counter, deque, defaultdict\n\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\nfrom functools import reduce\n\nfrom math import ceil, floor, log10, log2, factorial\n\nfrom pprint import pprint\n\n\n\nsys.setrecursionlimit(1000000)\n\n# MOD = 10 ** 9 + 7\n\n# N = int(input())\n\n# A = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n\n\nN, W = [int(x) for x in input().split()]\n\n\n\ndp = defaultdict(lambda: float('inf'))\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n w, v = [int(x) for x in input().split()]\n\n\n\n add = defaultdict(lambda: float('inf'))\n\n for vv in list(dp.keys()):\n\n if dp[vv + v] > dp[vv] + w:\n\n add[vv + v] = dp[vv] + w\n\n dp.update(add)\n\n\n\nprint((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x:x[0])[0]))\n", "code_v0_loc": 37, "code_v1_loc": 29, "code_v0_num_chars": 908, "code_v1_num_chars": 876, "code_v0_no_empty_lines": "import sys\nfrom collections import Counter, deque, defaultdict\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\nfrom functools import reduce\nfrom math import ceil, floor, log10, log2, factorial\nfrom pprint import pprint\n\nsys.setrecursionlimit(1000000)\n# MOD = 10 ** 9 + 7\n# N = int(input())\n# A = [int(x) for x in input().split()]\n# V = [[0] * 100 for _ in range(100)]\n# A = [int(input()) for _ in range(N)]\nN, W = [int(x) for x in input().split()]\ndp = [float(\"inf\")] * 1000 * 100 * 10\nvs = set()\nvs.add(0)\ndp[0] = 0\nfor i in range(N):\n w, v = [int(x) for x in input().split()]\n tmpDP = dp.copy()\n for vv in list(vs):\n if dp[vv + v] > dp[vv] + w:\n tmpDP[vv + v] = dp[vv] + w\n vs.add(vv + v)\n dp = tmpDP\nans = 0\nfor v in list(vs):\n if dp[v] <= W:\n ans = max(ans, v)\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\nfrom collections import Counter, deque, defaultdict\nfrom itertools import accumulate, permutations, combinations, takewhile, compress, cycle\nfrom functools import reduce\nfrom math import ceil, floor, log10, log2, factorial\nfrom pprint import pprint\n\nsys.setrecursionlimit(1000000)\n# MOD = 10 ** 9 + 7\n# N = int(input())\n# A = [int(x) for x in input().split()]\n# V = [[0] * 100 for _ in range(100)]\n# A = [int(input()) for _ in range(N)]\nN, W = [int(x) for x in input().split()]\ndp = defaultdict(lambda: float(\"inf\"))\ndp[0] = 0\nfor i in range(N):\n w, v = [int(x) for x in input().split()]\n add = defaultdict(lambda: float(\"inf\"))\n for vv in list(dp.keys()):\n if dp[vv + v] > dp[vv] + w:\n add[vv + v] = dp[vv] + w\n dp.update(add)\nprint((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x: x[0])[0]))\n", "code_same": false, "relative_loc_diff_percent": 21.6216216216, "diff": ["-dp = [float(\"inf\")] * 1000 * 100 * 10", "-vs = set()", "-vs.add(0)", "+dp = defaultdict(lambda: float(\"inf\"))", "- tmpDP = dp.copy()", "- for vv in list(vs):", "+ add = defaultdict(lambda: float(\"inf\"))", "+ for vv in list(dp.keys()):", "- tmpDP[vv + v] = dp[vv] + w", "- vs.add(vv + v)", "- dp = tmpDP", "-ans = 0", "-for v in list(vs):", "- if dp[v] <= W:", "- ans = max(ans, v)", "-print(ans)", "+ add[vv + v] = dp[vv] + w", "+ dp.update(add)", "+print((max([i for i in list(dp.items()) if i[1] <= W], key=lambda x: x[0])[0]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5805827644, "measured_runtime_v1": 0.1952783756, "runtime_lift": 2.9731032046, "key": ["s900171177", "s494365384"], "target_token_count_dream": 277, "target_token_bucket_dream": "256-512"} +{"user_id": "u882209234", "problem_id": "p03796", "language": "python", "submission_id_v0": "s179415880", "submission_id_v1": "s895771571", "cpu_time_v0": 230, "cpu_time_v1": 42, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.74, "input": "from math import factorial\n\nN = int(input())\n\nprint((factorial(N) % (10**9 + 7)))", "target": "from math import factorial\n\nN = int(input())\n\nans = 1\n\nfor i in range(1,N+1):\n\n ans *= i % (10**9 + 7)\n\n ans %= 10**9 + 7\n\nprint(ans)", "code_v0_loc": 3, "code_v1_loc": 7, "code_v0_num_chars": 79, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "from math import factorial\n\nN = int(input())\nprint((factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "from math import factorial\n\nN = int(input())\nans = 1\nfor i in range(1, N + 1):\n ans *= i % (10**9 + 7)\n ans %= 10**9 + 7\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-print((factorial(N) % (10**9 + 7)))", "+ans = 1", "+for i in range(1, N + 1):", "+ ans *= i % (10**9 + 7)", "+ ans %= 10**9 + 7", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9434056597, "measured_runtime_v1": 0.3957924933, "runtime_lift": 2.3835865397, "key": ["s179415880", "s895771571"], "target_token_count_dream": 54, "target_token_bucket_dream": "<128"} +{"user_id": "u146816547", "problem_id": "p00005", "language": "python", "submission_id_v0": "s153581221", "submission_id_v1": "s486237781", "cpu_time_v0": 30, "cpu_time_v1": 10, "memory_v0": 5872, "memory_v1": 6452, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.67, "input": "import math\n\nwhile True:\n\n\ttry:\n\n\t\tx,y = list(map(int,input().split()))\n\n\t\tprint('%d %d' % (math.gcd(x,y),x/math.gcd(x,y)*y))\n\n\texcept EOFError:\n\n\t\tbreak", "target": "def gcd(x, y):\n\n if y == 0:\n\n return x\n\n else:\n\n return gcd(y, x%y)\n\n\n\n\n\ndef lcm(x,y):\n\n return x/gcd(x, y)*y\n\n\n\n\n\nwhile True:\n\n try:\n\n x, y = list(map(int, input().split()))\n\n except EOFError:\n\n break\n\n\n\n print(\"%d %d\" % (gcd(x, y), lcm(x, y)))", "code_v0_loc": 7, "code_v1_loc": 18, "code_v0_num_chars": 165, "code_v1_num_chars": 288, "code_v0_no_empty_lines": "import math\n\nwhile True:\n try:\n x, y = list(map(int, input().split()))\n print(\"%d %d\" % (math.gcd(x, y), x / math.gcd(x, y) * y))\n except EOFError:\n break\n", "code_v1_no_empty_lines": "def gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\n\ndef lcm(x, y):\n return x / gcd(x, y) * y\n\n\nwhile True:\n try:\n x, y = list(map(int, input().split()))\n except EOFError:\n break\n print(\"%d %d\" % (gcd(x, y), lcm(x, y)))\n", "code_same": false, "relative_loc_diff_percent": 61.1111111111, "diff": ["-import math", "+def gcd(x, y):", "+ if y == 0:", "+ return x", "+ else:", "+ return gcd(y, x % y)", "+", "+", "+def lcm(x, y):", "+ return x / gcd(x, y) * y", "+", "- print(\"%d %d\" % (math.gcd(x, y), x / math.gcd(x, y) * y))", "+ print(\"%d %d\" % (gcd(x, y), lcm(x, y)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2843708012, "measured_runtime_v1": 0.2133130357, "runtime_lift": 1.3331149699, "key": ["s153581221", "s486237781"], "target_token_count_dream": 91, "target_token_bucket_dream": "<128"} +{"user_id": "u111365362", "problem_id": "p02881", "language": "python", "submission_id_v0": "s326793866", "submission_id_v1": "s577051886", "cpu_time_v0": 202, "cpu_time_v1": 174, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.86, "input": "n = int(input())\n\nr = int(n**.5)\n\nfor i in range(r):\n\n if n % (r-i) == 0:\n\n print(( (r-i) + n//(r-i) - 2 ))\n\n break", "target": "n = int(input())\n\ns = int(n**.5)\n\nfor i in range(s):\n\n if n % (s-i) == 0:\n\n print(((s-i) + n // (s-i) - 2))\n\n break", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 120, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "n = int(input())\nr = int(n**0.5)\nfor i in range(r):\n if n % (r - i) == 0:\n print(((r - i) + n // (r - i) - 2))\n break\n", "code_v1_no_empty_lines": "n = int(input())\ns = int(n**0.5)\nfor i in range(s):\n if n % (s - i) == 0:\n print(((s - i) + n // (s - i) - 2))\n break\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-r = int(n**0.5)", "-for i in range(r):", "- if n % (r - i) == 0:", "- print(((r - i) + n // (r - i) - 2))", "+s = int(n**0.5)", "+for i in range(s):", "+ if n % (s - i) == 0:", "+ print(((s - i) + n // (s - i) - 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3217455449, "measured_runtime_v1": 0.1190871449, "runtime_lift": 2.7017655456, "key": ["s326793866", "s577051886"], "target_token_count_dream": 50, "target_token_bucket_dream": "<128"} +{"user_id": "u670180528", "problem_id": "p03253", "language": "python", "submission_id_v0": "s289323588", "submission_id_v1": "s397757622", "cpu_time_v0": 97, "cpu_time_v1": 24, "memory_v0": 11252, "memory_v1": 3564, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.26, "input": "from collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:\n\n\t\treturn [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn //= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:\n\n\t\tret.append(n)\n\n\treturn ret\n\n\n\nn,m = list(map(int,input().split()))\n\nmod = 10**9+7\n\nif m==1:\n\n\tprint((1));exit()\n\n\n\nfactors = Counter(factorization(m))\n\nmx = n+max(factors.values())\n\n\n\nfac = [1]*(mx+1)\n\ninv = [1]*(mx+1)\n\nfor i in range(1,mx+1):\n\n\tfac[i] = fac[i-1] * i % mod\n\ninv[-1] = pow(fac[-1], mod - 2, mod)\n\nfor i in range(mx-1, -1, -1):\n\n\tinv[i] = inv[i+1] * (i+1) % mod\n\ndef cmb(n,r):\n\n\tassert n >= r >= 0\n\n\treturn fac[n] * inv[n-r] * inv[r] % mod\n\n\t\n\nans=1\n\nfor v in list(factors.values()):\n\n\tans*=cmb(n+v-1,v)\n\n\tans%=mod\n\n\n\nprint(ans)", "target": "from collections import Counter\n\ndef factorization(n) -> list:\n\n\tif n==1:return [1]\n\n\tret = []\n\n\ti = 2\n\n\twhile i*i<=n:\n\n\t\twhile n%i==0:\n\n\t\t\tn //= i\n\n\t\t\tret.append(i)\n\n\t\ti += 1\n\n\tif n!=1:ret.append(n)\n\n\treturn ret\n\n\t\n\nfrom operator import mul\n\nfrom functools import reduce\n\ndef cmb(n,r):\n\n\tif n < r:return 0\n\n\tr = min(n-r,r)\n\n\tif r==0:return 1\n\n\tu = reduce(mul, list(range(n, n-r, -1)))\n\n\td = reduce(mul, list(range(1,r+1)))\n\n\treturn u//d\n\n\n\ndef main():\n\n\tn,m = list(map(int,input().split()))\n\n\tmod = 10**9+7\n\n\tif m==1:\n\n\t\tprint((1))\n\n\t\texit()\n\n\tans=1\n\n\tfor v in list(Counter(factorization(m)).values()):\n\n\t\tans*=cmb(n+v-1,v)\n\n\t\tans%=mod\n\n\tprint(ans)\n\n\t\n\nif __name__==\"__main__\":main()", "code_v0_loc": 40, "code_v1_loc": 36, "code_v0_num_chars": 723, "code_v1_num_chars": 658, "code_v0_no_empty_lines": "from collections import Counter\n\n\ndef factorization(n) -> list:\n if n == 1:\n return [1]\n ret = []\n i = 2\n while i * i <= n:\n while n % i == 0:\n n //= i\n ret.append(i)\n i += 1\n if n != 1:\n ret.append(n)\n return ret\n\n\nn, m = list(map(int, input().split()))\nmod = 10**9 + 7\nif m == 1:\n print((1))\n exit()\nfactors = Counter(factorization(m))\nmx = n + max(factors.values())\nfac = [1] * (mx + 1)\ninv = [1] * (mx + 1)\nfor i in range(1, mx + 1):\n fac[i] = fac[i - 1] * i % mod\ninv[-1] = pow(fac[-1], mod - 2, mod)\nfor i in range(mx - 1, -1, -1):\n inv[i] = inv[i + 1] * (i + 1) % mod\n\n\ndef cmb(n, r):\n assert n >= r >= 0\n return fac[n] * inv[n - r] * inv[r] % mod\n\n\nans = 1\nfor v in list(factors.values()):\n ans *= cmb(n + v - 1, v)\n ans %= mod\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import Counter\n\n\ndef factorization(n) -> list:\n if n == 1:\n return [1]\n ret = []\n i = 2\n while i * i <= n:\n while n % i == 0:\n n //= i\n ret.append(i)\n i += 1\n if n != 1:\n ret.append(n)\n return ret\n\n\nfrom operator import mul\nfrom functools import reduce\n\n\ndef cmb(n, r):\n if n < r:\n return 0\n r = min(n - r, r)\n if r == 0:\n return 1\n u = reduce(mul, list(range(n, n - r, -1)))\n d = reduce(mul, list(range(1, r + 1)))\n return u // d\n\n\ndef main():\n n, m = list(map(int, input().split()))\n mod = 10**9 + 7\n if m == 1:\n print((1))\n exit()\n ans = 1\n for v in list(Counter(factorization(m)).values()):\n ans *= cmb(n + v - 1, v)\n ans %= mod\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-n, m = list(map(int, input().split()))", "-mod = 10**9 + 7", "-if m == 1:", "- print((1))", "- exit()", "-factors = Counter(factorization(m))", "-mx = n + max(factors.values())", "-fac = [1] * (mx + 1)", "-inv = [1] * (mx + 1)", "-for i in range(1, mx + 1):", "- fac[i] = fac[i - 1] * i % mod", "-inv[-1] = pow(fac[-1], mod - 2, mod)", "-for i in range(mx - 1, -1, -1):", "- inv[i] = inv[i + 1] * (i + 1) % mod", "+from operator import mul", "+from functools import reduce", "- assert n >= r >= 0", "- return fac[n] * inv[n - r] * inv[r] % mod", "+ if n < r:", "+ return 0", "+ r = min(n - r, r)", "+ if r == 0:", "+ return 1", "+ u = reduce(mul, list(range(n, n - r, -1)))", "+ d = reduce(mul, list(range(1, r + 1)))", "+ return u // d", "-ans = 1", "-for v in list(factors.values()):", "- ans *= cmb(n + v - 1, v)", "- ans %= mod", "-print(ans)", "+def main():", "+ n, m = list(map(int, input().split()))", "+ mod = 10**9 + 7", "+ if m == 1:", "+ print((1))", "+ exit()", "+ ans = 1", "+ for v in list(Counter(factorization(m)).values()):", "+ ans *= cmb(n + v - 1, v)", "+ ans %= mod", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4340592513, "measured_runtime_v1": 0.2881658652, "runtime_lift": 1.5062826786, "key": ["s289323588", "s397757622"], "target_token_count_dream": 227, "target_token_bucket_dream": "128-256"} +{"user_id": "u346812984", "problem_id": "p02725", "language": "python", "submission_id_v0": "s133823600", "submission_id_v1": "s446849062", "cpu_time_v0": 124, "cpu_time_v1": 97, "memory_v0": 26420, "memory_v1": 26444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.77, "input": "K, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\ndiff = A[0] + K - A[-1]\n\nans = A[-1] - A[0]\n\nfor i in range(1, N):\n\n dist = K - A[i] + A[i - 1]\n\n if dist < ans:\n\n ans = dist\n\n\n\nprint(ans)\n", "target": "import sys\n\n\n\n\n\ndef input():\n\n return sys.stdin.readline().strip()\n\n\n\n\n\ndef main():\n\n K, N = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n\n\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n\n print((min(min(ans), A[-1] - A[0])))\n\n\n\n\n\nmain()\n", "code_v0_loc": 11, "code_v1_loc": 16, "code_v0_num_chars": 226, "code_v1_num_chars": 274, "code_v0_no_empty_lines": "K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\ndiff = A[0] + K - A[-1]\nans = A[-1] - A[0]\nfor i in range(1, N):\n dist = K - A[i] + A[i - 1]\n if dist < ans:\n ans = dist\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n K, N = list(map(int, input().split()))\n A = list(map(int, input().split()))\n ans = [K - A[i] + A[i - 1] for i in range(1, N)]\n print((min(min(ans), A[-1] - A[0])))\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 31.25, "diff": ["-K, N = list(map(int, input().split()))", "-A = list(map(int, input().split()))", "-diff = A[0] + K - A[-1]", "-ans = A[-1] - A[0]", "-for i in range(1, N):", "- dist = K - A[i] + A[i - 1]", "- if dist < ans:", "- ans = dist", "-print(ans)", "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "+def main():", "+ K, N = list(map(int, input().split()))", "+ A = list(map(int, input().split()))", "+ ans = [K - A[i] + A[i - 1] for i in range(1, N)]", "+ print((min(min(ans), A[-1] - A[0])))", "+", "+", "+main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2153115588, "measured_runtime_v1": 0.0063990955, "runtime_lift": 33.6471865365, "key": ["s133823600", "s446849062"], "target_token_count_dream": 87, "target_token_bucket_dream": "<128"} +{"user_id": "u648881683", "problem_id": "p03371", "language": "python", "submission_id_v0": "s115897723", "submission_id_v1": "s652896869", "cpu_time_v0": 101, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.18, "input": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = float('inf')\n\n for i in range(0, max(X, Y)*2+1, 2):\n\n ans = min(A*max(X-i//2, 0)+B*max(Y-i//2, 0)+C*i, ans)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "target": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip() \n\n\n\ndef resolve():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = 0\n\n if A+B > 2*C:\n\n ans = 2*C*min(X, Y)+min((A if X>Y else B)*abs(X-Y), 2*C*abs(X-Y))\n\n else:\n\n ans = A*X+B*Y\n\n \n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()\n", "code_v0_loc": 13, "code_v1_loc": 16, "code_v0_num_chars": 316, "code_v1_num_chars": 334, "code_v0_no_empty_lines": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = float(\"inf\")\n for i in range(0, max(X, Y) * 2 + 1, 2):\n ans = min(A * max(X - i // 2, 0) + B * max(Y - i // 2, 0) + C * i, ans)\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_v1_no_empty_lines": "import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = 0\n if A + B > 2 * C:\n ans = 2 * C * min(X, Y) + min(\n (A if X > Y else B) * abs(X - Y), 2 * C * abs(X - Y)\n )\n else:\n ans = A * X + B * Y\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 18.75, "diff": ["- ans = float(\"inf\")", "- for i in range(0, max(X, Y) * 2 + 1, 2):", "- ans = min(A * max(X - i // 2, 0) + B * max(Y - i // 2, 0) + C * i, ans)", "+ ans = 0", "+ if A + B > 2 * C:", "+ ans = 2 * C * min(X, Y) + min(", "+ (A if X > Y else B) * abs(X - Y), 2 * C * abs(X - Y)", "+ )", "+ else:", "+ ans = A * X + B * Y"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4475863097, "measured_runtime_v1": 0.2669118404, "runtime_lift": 1.6769069102, "key": ["s115897723", "s652896869"], "target_token_count_dream": 115, "target_token_bucket_dream": "<128"} +{"user_id": "u556589653", "problem_id": "p03416", "language": "python", "submission_id_v0": "s253072561", "submission_id_v1": "s839464643", "cpu_time_v0": 58, "cpu_time_v1": 50, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n i = str(i)\n\n if i[0] == i[4]:\n\n if i[1] == i[3]:\n\n ans += 1\n\n else:\n\n ans += 0\n\n else:\n\n ans += 0\n\nprint(ans)", "target": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1):\n\n k = str(i)\n\n if k[0] == k[4] and k[1] == k[3]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 7, "code_v0_num_chars": 227, "code_v1_num_chars": 148, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n i = str(i)\n if i[0] == i[4]:\n if i[1] == i[3]:\n ans += 1\n else:\n ans += 0\n else:\n ans += 0\nprint(ans)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n k = str(i)\n if k[0] == k[4] and k[1] == k[3]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.6666666667, "diff": ["- i = str(i)", "- if i[0] == i[4]:", "- if i[1] == i[3]:", "- ans += 1", "- else:", "- ans += 0", "- else:", "- ans += 0", "+ k = str(i)", "+ if k[0] == k[4] and k[1] == k[3]:", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1907642818, "measured_runtime_v1": 0.0059664835, "runtime_lift": 31.9726487264, "key": ["s253072561", "s839464643"], "target_token_count_dream": 60, "target_token_bucket_dream": "<128"} +{"user_id": "u312025627", "problem_id": "p03568", "language": "python", "submission_id_v0": "s088632051", "submission_id_v1": "s935108099", "cpu_time_v0": 196, "cpu_time_v1": 167, "memory_v0": 41068, "memory_v1": 38256, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.8, "input": "def main():\n\n N = int(input())\n\n A = [int(i) for i in input().split()]\n\n if N == 1:\n\n return print(1 if A[0] % 2 == 0 else 2)\n\n ans = 0\n\n d = (-1, 0, 1)\n\n from itertools import product\n\n for i in product(range(3), repeat=N):\n\n cur = 1\n\n for j in range(N):\n\n cur *= (A[j] + d[i[j]])\n\n if cur % 2 == 0:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n N = int(input())\n\n A = [int(i) for i in input().split()]\n\n ans = 3**N\n\n cnt = len([a for a in A if a % 2 == 0])\n\n ans -= 2**cnt\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 19, "code_v1_loc": 11, "code_v0_num_chars": 443, "code_v1_num_chars": 217, "code_v0_no_empty_lines": "def main():\n N = int(input())\n A = [int(i) for i in input().split()]\n if N == 1:\n return print(1 if A[0] % 2 == 0 else 2)\n ans = 0\n d = (-1, 0, 1)\n from itertools import product\n\n for i in product(range(3), repeat=N):\n cur = 1\n for j in range(N):\n cur *= A[j] + d[i[j]]\n if cur % 2 == 0:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n N = int(input())\n A = [int(i) for i in input().split()]\n ans = 3**N\n cnt = len([a for a in A if a % 2 == 0])\n ans -= 2**cnt\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 42.1052631579, "diff": ["- N = int(input())", "+ N = int(input())", "- if N == 1:", "- return print(1 if A[0] % 2 == 0 else 2)", "- ans = 0", "- d = (-1, 0, 1)", "- from itertools import product", "-", "- for i in product(range(3), repeat=N):", "- cur = 1", "- for j in range(N):", "- cur *= A[j] + d[i[j]]", "- if cur % 2 == 0:", "- ans += 1", "+ ans = 3**N", "+ cnt = len([a for a in A if a % 2 == 0])", "+ ans -= 2**cnt"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4432550566, "measured_runtime_v1": 0.2109588499, "runtime_lift": 2.1011446393, "key": ["s088632051", "s935108099"], "target_token_count_dream": 74, "target_token_bucket_dream": "<128"} +{"user_id": "u777923818", "problem_id": "p03425", "language": "python", "submission_id_v0": "s258539301", "submission_id_v1": "s541501179", "cpu_time_v0": 165, "cpu_time_v1": 142, "memory_v0": 3316, "memory_v1": 9336, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.94, "input": "# -*- coding: utf-8 -*-\n\nfrom collections import defaultdict\n\nfrom itertools import combinations\n\nN = int(input())\n\nC = [0, 0, 0, 0, 0, 0]\n\nD = defaultdict(int)\n\nfor i, m in enumerate(\"MARCH\", start=1):\n\n D[m] = i\n\n\n\nfor _ in range(N):\n\n C[D[input()[0]]] += 1\n\n\n\nans = 0\n\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n\n ans += C[a]*C[b]*C[c]\n\nprint(ans)", "target": "from collections import defaultdict\n\nfrom itertools import combinations\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nC = defaultdict(int)\n\nN = int(input())\n\nfor _ in range(N):\n\n C[input()[0]] += 1\n\n\n\nres = 0\n\nfor H in combinations(\"MARCH\", r=3):\n\n res += C[H[0]] * C[H[1]] * C[H[2]]\n\nprint(res)", "code_v0_loc": 16, "code_v1_loc": 13, "code_v0_num_chars": 363, "code_v1_num_chars": 310, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nfrom collections import defaultdict\nfrom itertools import combinations\n\nN = int(input())\nC = [0, 0, 0, 0, 0, 0]\nD = defaultdict(int)\nfor i, m in enumerate(\"MARCH\", start=1):\n D[m] = i\nfor _ in range(N):\n C[D[input()[0]]] += 1\nans = 0\nfor a, b, c in combinations(list(range(1, 6)), r=3):\n ans += C[a] * C[b] * C[c]\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\nfrom itertools import combinations\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\nC = defaultdict(int)\nN = int(input())\nfor _ in range(N):\n C[input()[0]] += 1\nres = 0\nfor H in combinations(\"MARCH\", r=3):\n res += C[H[0]] * C[H[1]] * C[H[2]]\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 18.75, "diff": ["-# -*- coding: utf-8 -*-", "+", "+def inpl():", "+ return list(map(int, input().split()))", "+", "+", "+C = defaultdict(int)", "-C = [0, 0, 0, 0, 0, 0]", "-D = defaultdict(int)", "-for i, m in enumerate(\"MARCH\", start=1):", "- D[m] = i", "- C[D[input()[0]]] += 1", "-ans = 0", "-for a, b, c in combinations(list(range(1, 6)), r=3):", "- ans += C[a] * C[b] * C[c]", "-print(ans)", "+ C[input()[0]] += 1", "+res = 0", "+for H in combinations(\"MARCH\", r=3):", "+ res += C[H[0]] * C[H[1]] * C[H[2]]", "+print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.388673193, "measured_runtime_v1": 0.2150466468, "runtime_lift": 1.8073901578, "key": ["s258539301", "s541501179"], "target_token_count_dream": 90, "target_token_bucket_dream": "<128"} +{"user_id": "u964904181", "problem_id": "p03796", "language": "python", "submission_id_v0": "s459904551", "submission_id_v1": "s685671735", "cpu_time_v0": 153, "cpu_time_v1": 46, "memory_v0": 9880, "memory_v1": 9092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 69.93, "input": "import math\n\n\n\nN = int(input())\n\n\n\nprint((math.factorial(N) % (1000000000 + 7)))\n", "target": "import math\n\n\n\nN = int(input())\n\n\n\np = 1\n\nfor i in range(2, N+1):\n\n p *= i\n\n p = p % (1000000000 + 7)\n\n \n\nprint(p)\n", "code_v0_loc": 5, "code_v1_loc": 10, "code_v0_num_chars": 79, "code_v1_num_chars": 118, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (1000000000 + 7)))\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\np = 1\nfor i in range(2, N + 1):\n p *= i\n p = p % (1000000000 + 7)\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-print((math.factorial(N) % (1000000000 + 7)))", "+p = 1", "+for i in range(2, N + 1):", "+ p *= i", "+ p = p % (1000000000 + 7)", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5259809067, "measured_runtime_v1": 0.2554857254, "runtime_lift": 2.0587487065, "key": ["s459904551", "s685671735"], "target_token_count_dream": 54, "target_token_bucket_dream": "<128"} +{"user_id": "u127499732", "problem_id": "p03309", "language": "python", "submission_id_v0": "s031191514", "submission_id_v1": "s488102802", "cpu_time_v0": 214, "cpu_time_v1": 169, "memory_v0": 27212, "memory_v1": 25180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.03, "input": "def main():\n\n from statistics import median\n\n\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n m = int(median(a))\n\n\n\n ans = sum([abs(x - m) for x in a])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n n, *a, = list(map(int, open(0).read().split()))\n\n a = [x - i for i, x in enumerate(a, 1)]\n\n a.sort()\n\n if n % 2 == 0:\n\n ans = sum(a[n // 2:]) - sum(a[:n // 2])\n\n else:\n\n ans = sum(a[n // 2 + 1:]) - sum(a[:n // 2])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 281, "code_v1_num_chars": 311, "code_v0_no_empty_lines": "def main():\n from statistics import median\n\n (\n n,\n *a,\n ) = list(map(int, open(0).read().split()))\n a = [x - i for i, x in enumerate(a, 1)]\n a.sort()\n m = int(median(a))\n ans = sum([abs(x - m) for x in a])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n (\n n,\n *a,\n ) = list(map(int, open(0).read().split()))\n a = [x - i for i, x in enumerate(a, 1)]\n a.sort()\n if n % 2 == 0:\n ans = sum(a[n // 2 :]) - sum(a[: n // 2])\n else:\n ans = sum(a[n // 2 + 1 :]) - sum(a[: n // 2])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["- from statistics import median", "-", "- m = int(median(a))", "- ans = sum([abs(x - m) for x in a])", "+ if n % 2 == 0:", "+ ans = sum(a[n // 2 :]) - sum(a[: n // 2])", "+ else:", "+ ans = sum(a[n // 2 + 1 :]) - sum(a[: n // 2])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2784859991, "measured_runtime_v1": 0.2092100859, "runtime_lift": 1.3311308484, "key": ["s031191514", "s488102802"], "target_token_count_dream": 114, "target_token_bucket_dream": "<128"} +{"user_id": "u159994501", "problem_id": "p03037", "language": "python", "submission_id_v0": "s060142514", "submission_id_v1": "s502871070", "cpu_time_v0": 326, "cpu_time_v1": 290, "memory_v0": 10996, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.04, "input": "N, M = list(map(int, input().split()))\n\nL, R = [], []\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n L.append(l)\n\n R.append(r)\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n", "target": "N, M = list(map(int, input().split()))\n\nlow = -float('INF')\n\nhigh = float('INF')\n\nfor i in range(M):\n\n l, r = list(map(int, input().split()))\n\n if l > low:\n\n low = l\n\n if r < high:\n\n high = r\n\nprint((max(0, high - low + 1)))\n", "code_v0_loc": 13, "code_v1_loc": 10, "code_v0_num_chars": 283, "code_v1_num_chars": 234, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nL, R = [], []\nlow = -float(\"INF\")\nhigh = float(\"INF\")\nfor i in range(M):\n l, r = list(map(int, input().split()))\n L.append(l)\n R.append(r)\n if l > low:\n low = l\n if r < high:\n high = r\nprint((max(0, high - low + 1)))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nlow = -float(\"INF\")\nhigh = float(\"INF\")\nfor i in range(M):\n l, r = list(map(int, input().split()))\n if l > low:\n low = l\n if r < high:\n high = r\nprint((max(0, high - low + 1)))\n", "code_same": false, "relative_loc_diff_percent": 23.0769230769, "diff": ["-L, R = [], []", "- L.append(l)", "- R.append(r)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2778050728, "measured_runtime_v1": 0.0913613791, "runtime_lift": 3.0407276614, "key": ["s060142514", "s502871070"], "target_token_count_dream": 79, "target_token_bucket_dream": "<128"} +{"user_id": "u729133443", "problem_id": "p02555", "language": "python", "submission_id_v0": "s039277419", "submission_id_v1": "s210669705", "cpu_time_v0": 66, "cpu_time_v1": 51, "memory_v0": 29052, "memory_v1": 22328, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.73, "input": "a,b,c=1,0,0\n\nexec('a,b,c=b,c,(a+c)%(10**9+7);'*(int(input())-2))\n\nprint(c)", "target": "a,b,c=1,0,0\n\nexec('a,b,c=b,c,a+c;'*(int(input())-2))\n\nprint((c%(10**9+7)))", "code_v0_loc": 3, "code_v1_loc": 3, "code_v0_num_chars": 74, "code_v1_num_chars": 72, "code_v0_no_empty_lines": "a, b, c = 1, 0, 0\nexec(\"a,b,c=b,c,(a+c)%(10**9+7);\" * (int(input()) - 2))\nprint(c)\n", "code_v1_no_empty_lines": "a, b, c = 1, 0, 0\nexec(\"a,b,c=b,c,a+c;\" * (int(input()) - 2))\nprint((c % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-exec(\"a,b,c=b,c,(a+c)%(10**9+7);\" * (int(input()) - 2))", "-print(c)", "+exec(\"a,b,c=b,c,a+c;\" * (int(input()) - 2))", "+print((c % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4045331192, "measured_runtime_v1": 0.1489405618, "runtime_lift": 2.7160708565, "key": ["s039277419", "s210669705"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u768896740", "problem_id": "p03371", "language": "python", "submission_id_v0": "s303630482", "submission_id_v1": "s785488691", "cpu_time_v0": 197, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 91.37, "input": "a, b, c, x, y = list(map(int, input().split()))\n\n\n\nz = max(x,y) * 2\n\nmin_sum = c * z\n\n\n\nfor i in range(z):\n\n r = max(0, y - i) * b\n\n t = max(0, x - i) * a\n\n sum = c * i * 2 + r + t\n\n if sum < min_sum:\n\n min_sum = sum\n\n\n\nprint(min_sum)", "target": "a,b,c,x,y = list(map(int, input().split()))\n\n\n\nplan_a = c * (2*x) + max(0, y-x) * b\n\nplan_b = c * (2*y) + max(0, x-y) * a\n\nplan_c = a * x + b * y\n\n\n\nprint((min(plan_a, plan_b, plan_c)))", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 247, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nz = max(x, y) * 2\nmin_sum = c * z\nfor i in range(z):\n r = max(0, y - i) * b\n t = max(0, x - i) * a\n sum = c * i * 2 + r + t\n if sum < min_sum:\n min_sum = sum\nprint(min_sum)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nplan_a = c * (2 * x) + max(0, y - x) * b\nplan_b = c * (2 * y) + max(0, x - y) * a\nplan_c = a * x + b * y\nprint((min(plan_a, plan_b, plan_c)))\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["-z = max(x, y) * 2", "-min_sum = c * z", "-for i in range(z):", "- r = max(0, y - i) * b", "- t = max(0, x - i) * a", "- sum = c * i * 2 + r + t", "- if sum < min_sum:", "- min_sum = sum", "-print(min_sum)", "+plan_a = c * (2 * x) + max(0, y - x) * b", "+plan_b = c * (2 * y) + max(0, x - y) * a", "+plan_c = a * x + b * y", "+print((min(plan_a, plan_b, plan_c)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7115524154, "measured_runtime_v1": 0.3421670091, "runtime_lift": 2.0795471112, "key": ["s303630482", "s785488691"], "target_token_count_dream": 78, "target_token_bucket_dream": "<128"} +{"user_id": "u488127128", "problem_id": "p03796", "language": "python", "submission_id_v0": "s349010345", "submission_id_v1": "s174569561", "cpu_time_v0": 35, "cpu_time_v1": 29, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.14, "input": "N = int(input())\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)", "target": "def factorial(N):\n\n a = 1\n\n for n in range(2,N+1):\n\n a = a*n % (10**9 + 7)\n\n return a\n\n\n\nif __name__ == '__main__':\n\n N = int(input())\n\n print((factorial(N)))", "code_v0_loc": 5, "code_v1_loc": 9, "code_v0_num_chars": 82, "code_v1_num_chars": 178, "code_v0_no_empty_lines": "N = int(input())\na = 1\nfor n in range(2, N + 1):\n a = a * n % (10**9 + 7)\nprint(a)\n", "code_v1_no_empty_lines": "def factorial(N):\n a = 1\n for n in range(2, N + 1):\n a = a * n % (10**9 + 7)\n return a\n\n\nif __name__ == \"__main__\":\n N = int(input())\n print((factorial(N)))\n", "code_same": false, "relative_loc_diff_percent": 44.4444444444, "diff": ["-N = int(input())", "-a = 1", "-for n in range(2, N + 1):", "- a = a * n % (10**9 + 7)", "-print(a)", "+def factorial(N):", "+ a = 1", "+ for n in range(2, N + 1):", "+ a = a * n % (10**9 + 7)", "+ return a", "+", "+", "+if __name__ == \"__main__\":", "+ N = int(input())", "+ print((factorial(N)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3416386657, "measured_runtime_v1": 0.2695478878, "runtime_lift": 1.2674507244, "key": ["s349010345", "s174569561"], "target_token_count_dream": 62, "target_token_bucket_dream": "<128"} +{"user_id": "u102461423", "problem_id": "p03170", "language": "python", "submission_id_v0": "s503646377", "submission_id_v1": "s803807514", "cpu_time_v0": 1298, "cpu_time_v1": 123, "memory_v0": 3684, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 90.52, "input": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom operator import xor\n\nfrom functools import reduce\n\n\n\nN,K,*A = list(map(int,read().split()))\n\n\n\na = reduce(xor,(1<K:\n\n break\n\n dp[n+a]=1\n\n\n\nanswer = 'First' if dp[-1] else 'Second'\n\nprint(answer)", "code_v0_loc": 19, "code_v1_loc": 17, "code_v0_num_chars": 396, "code_v1_num_chars": 369, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom operator import xor\nfrom functools import reduce\n\nN, K, *A = list(map(int, read().split()))\na = reduce(xor, (1 << a for a in A))\ndp = 0 # bitset\nfor n in range(K):\n if not (dp & (1 << n)):\n dp |= a << n\nanswer = \"First\" if dp & (1 << K) else \"Second\"\nprint(answer)\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN, K, *A = list(map(int, read().split()))\ndp = [0] * (K + 1) # bitset\nfor n in range(K):\n if not dp[n]:\n for a in A:\n if n + a > K:\n break\n dp[n + a] = 1\nanswer = \"First\" if dp[-1] else \"Second\"\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 10.5263157895, "diff": ["-from operator import xor", "-from functools import reduce", "-", "-a = reduce(xor, (1 << a for a in A))", "-dp = 0 # bitset", "+dp = [0] * (K + 1) # bitset", "- if not (dp & (1 << n)):", "- dp |= a << n", "-answer = \"First\" if dp & (1 << K) else \"Second\"", "+ if not dp[n]:", "+ for a in A:", "+ if n + a > K:", "+ break", "+ dp[n + a] = 1", "+answer = \"First\" if dp[-1] else \"Second\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.510753959, "measured_runtime_v1": 0.2748723721, "runtime_lift": 1.8581494935, "key": ["s503646377", "s803807514"], "target_token_count_dream": 104, "target_token_bucket_dream": "<128"} +{"user_id": "u102960641", "problem_id": "p02624", "language": "python", "submission_id_v0": "s523843051", "submission_id_v1": "s066295883", "cpu_time_v0": 36, "cpu_time_v1": 31, "memory_v0": 9312, "memory_v1": 9436, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.89, "input": "n = int(input())\n\nans = 0\n\nSQRT = int(n ** 0.5)\n\nfor m in range(1,SQRT + 1):\n\n b = int(n/m)\n\n ans += m * (m + b) * (b + 1 - m)\n\nans -= SQRT * (SQRT+1) * (2*SQRT+1) // 6\n\nprint(ans)", "target": "def main():\n\n n = int(input())\n\n ans = 0\n\n SQRT = int(n ** 0.5)\n\n for m in range(1,SQRT + 1):\n\n b = int(n/m)\n\n ans += m * (m + b) * (b + 1 - m)\n\n ans -= SQRT * (SQRT+1) * (2*SQRT+1) // 6\n\n print(ans)\n\nmain()\n", "code_v0_loc": 8, "code_v1_loc": 10, "code_v0_num_chars": 186, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "n = int(input())\nans = 0\nSQRT = int(n**0.5)\nfor m in range(1, SQRT + 1):\n b = int(n / m)\n ans += m * (m + b) * (b + 1 - m)\nans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6\nprint(ans)\n", "code_v1_no_empty_lines": "def main():\n n = int(input())\n ans = 0\n SQRT = int(n**0.5)\n for m in range(1, SQRT + 1):\n b = int(n / m)\n ans += m * (m + b) * (b + 1 - m)\n ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6\n print(ans)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-n = int(input())", "-ans = 0", "-SQRT = int(n**0.5)", "-for m in range(1, SQRT + 1):", "- b = int(n / m)", "- ans += m * (m + b) * (b + 1 - m)", "-ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6", "-print(ans)", "+def main():", "+ n = int(input())", "+ ans = 0", "+ SQRT = int(n**0.5)", "+ for m in range(1, SQRT + 1):", "+ b = int(n / m)", "+ ans += m * (m + b) * (b + 1 - m)", "+ ans -= SQRT * (SQRT + 1) * (2 * SQRT + 1) // 6", "+ print(ans)", "+", "+", "+main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3880330081, "measured_runtime_v1": 0.212660579, "runtime_lift": 1.8246588529, "key": ["s523843051", "s066295883"], "target_token_count_dream": 98, "target_token_bucket_dream": "<128"} +{"user_id": "u513081876", "problem_id": "p03828", "language": "python", "submission_id_v0": "s988350400", "submission_id_v1": "s443952708", "cpu_time_v0": 39, "cpu_time_v1": 35, "memory_v0": 3316, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.26, "input": "import math\n\nimport collections\n\n\n\nN = int(input())\n\na = math.factorial(N)\n\ncheck = []\n\nans = 1\n\ni = 2\n\n\n\nwhile a != 1:\n\n if a % i == 0:\n\n a //= i\n\n check.append(i)\n\n else:\n\n i += 1\n\n \n\ncheck = list(collections.Counter(check).values())\n\nfor i in check:\n\n ans *= (i+1)\n\n ans %= 10**9+7\n\nprint(ans)", "target": "from math import factorial\n\n\n\nN = factorial(int(input()))\n\n\n\ni = 2\n\ncheck = 1\n\nans = 1\n\nwhile N != 1:\n\n if N % i == 0:\n\n N //= i\n\n check += 1\n\n else:\n\n ans *= check\n\n check = 1\n\n i += 1\n\nprint(((ans*check)%(10**9+7)))", "code_v0_loc": 21, "code_v1_loc": 16, "code_v0_num_chars": 330, "code_v1_num_chars": 256, "code_v0_no_empty_lines": "import math\nimport collections\n\nN = int(input())\na = math.factorial(N)\ncheck = []\nans = 1\ni = 2\nwhile a != 1:\n if a % i == 0:\n a //= i\n check.append(i)\n else:\n i += 1\ncheck = list(collections.Counter(check).values())\nfor i in check:\n ans *= i + 1\n ans %= 10**9 + 7\nprint(ans)\n", "code_v1_no_empty_lines": "from math import factorial\n\nN = factorial(int(input()))\ni = 2\ncheck = 1\nans = 1\nwhile N != 1:\n if N % i == 0:\n N //= i\n check += 1\n else:\n ans *= check\n check = 1\n i += 1\nprint(((ans * check) % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 23.8095238095, "diff": ["-import math", "-import collections", "+from math import factorial", "-N = int(input())", "-a = math.factorial(N)", "-check = []", "+N = factorial(int(input()))", "+i = 2", "+check = 1", "-i = 2", "-while a != 1:", "- if a % i == 0:", "- a //= i", "- check.append(i)", "+while N != 1:", "+ if N % i == 0:", "+ N //= i", "+ check += 1", "+ ans *= check", "+ check = 1", "-check = list(collections.Counter(check).values())", "-for i in check:", "- ans *= i + 1", "- ans %= 10**9 + 7", "-print(ans)", "+print(((ans * check) % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1990540142, "measured_runtime_v1": 0.0063210642, "runtime_lift": 31.4905855295, "key": ["s988350400", "s443952708"], "target_token_count_dream": 87, "target_token_bucket_dream": "<128"} +{"user_id": "u693694535", "problem_id": "p03371", "language": "python", "submission_id_v0": "s328045307", "submission_id_v1": "s953197610", "cpu_time_v0": 105, "cpu_time_v1": 26, "memory_v0": 9176, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.24, "input": "A,B,C,X,Y=list(map(int,input().split()))\n\n\n\nK=10**9\n\nfor i in range(10**5+1):\n\n S=i*2*C+max(0,X-i)*A+max(0,Y-i)*B\n\n K=min(K,S)\n\nprint(K)", "target": "A,B,C,X,Y=list(map(int,input().split()))\n\n\n\na=min(X,Y)*min(A+B,2*C)\n\n\n\na+=max(0,X-Y)*min(A,2*C)\n\na+=max(0,Y-X)*min(B,2*C)\n\n\n\n\n\nprint(a)", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 136, "code_v1_num_chars": 129, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nK = 10**9\nfor i in range(10**5 + 1):\n S = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n K = min(K, S)\nprint(K)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\na = min(X, Y) * min(A + B, 2 * C)\na += max(0, X - Y) * min(A, 2 * C)\na += max(0, Y - X) * min(B, 2 * C)\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-K = 10**9", "-for i in range(10**5 + 1):", "- S = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B", "- K = min(K, S)", "-print(K)", "+a = min(X, Y) * min(A + B, 2 * C)", "+a += max(0, X - Y) * min(A, 2 * C)", "+a += max(0, Y - X) * min(B, 2 * C)", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3979784026, "measured_runtime_v1": 0.2418090019, "runtime_lift": 5.7813331656, "key": ["s328045307", "s953197610"], "target_token_count_dream": 56, "target_token_bucket_dream": "<128"} +{"user_id": "u365686736", "problem_id": "p02390", "language": "python", "submission_id_v0": "s143749551", "submission_id_v1": "s514847697", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7676, "memory_v1": 5584, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "S = int(input())\n\n\n\nif S >= 3600:\n\n h=S//3600\n\n m=S%3600//60\n\n s=S%60\n\nelif 3600 > S >= 60:\n\n h=0\n\n m=S//60\n\n s=S%60\n\nelse:\n\n h=m=0\n\n s=S\n\nprint(h, m, s, sep=\":\")\n", "target": "s = int(input())\n\nh = s // 3600\n\nm = (s - h * 3600) // 60\n\ns = s - h * 3600 - m * 60\n\nprint(h, m, s, sep=\":\")\n", "code_v0_loc": 14, "code_v1_loc": 5, "code_v0_num_chars": 186, "code_v1_num_chars": 110, "code_v0_no_empty_lines": "S = int(input())\nif S >= 3600:\n h = S // 3600\n m = S % 3600 // 60\n s = S % 60\nelif 3600 > S >= 60:\n h = 0\n m = S // 60\n s = S % 60\nelse:\n h = m = 0\n s = S\nprint(h, m, s, sep=\":\")\n", "code_v1_no_empty_lines": "s = int(input())\nh = s // 3600\nm = (s - h * 3600) // 60\ns = s - h * 3600 - m * 60\nprint(h, m, s, sep=\":\")\n", "code_same": false, "relative_loc_diff_percent": 64.2857142857, "diff": ["-S = int(input())", "-if S >= 3600:", "- h = S // 3600", "- m = S % 3600 // 60", "- s = S % 60", "-elif 3600 > S >= 60:", "- h = 0", "- m = S // 60", "- s = S % 60", "-else:", "- h = m = 0", "- s = S", "+s = int(input())", "+h = s // 3600", "+m = (s - h * 3600) // 60", "+s = s - h * 3600 - m * 60"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3295819011, "measured_runtime_v1": 0.255378567, "runtime_lift": 1.2905621053, "key": ["s143749551", "s514847697"], "target_token_count_dream": 62, "target_token_bucket_dream": "<128"} +{"user_id": "u670180528", "problem_id": "p03806", "language": "python", "submission_id_v0": "s355426542", "submission_id_v1": "s468498336", "cpu_time_v0": 1133, "cpu_time_v1": 172, "memory_v0": 4980, "memory_v1": 4980, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.82, "input": "def main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1<<30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(400, -1, -1):\n\n\t\t\tfor j in range(400, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\nif __name__==\"__main__\":\n\n\tmain()", "target": "def main():\n\n\tn, ma, mb, *L = list(map(int, open(0).read().split()))\n\n\tM = 1 << 30\n\n\tdp = [[M] * 420 for _ in range(420)]\n\n\tdp[0][0] = 0\n\n\tua = ub = 15\n\n\tfor a, b, c in zip(*[iter(L)] * 3):\n\n\t\tfor i in range(ua, -1, -1):\n\n\t\t\tfor j in range(ub, -1, -1):\n\n\t\t\t\tt = dp[i][j] + c\n\n\t\t\t\tif dp[i + a][j + b] > t:\n\n\t\t\t\t\tdp[i + a][j + b] = t\n\n\t\t\t\t\tif ua < i + a:\n\n\t\t\t\t\t\tua = i + a\n\n\t\t\t\t\tif ub < j + b:\n\n\t\t\t\t\t\tub = j + b\n\n\tans = M\n\n\t_ma, _mb = ma, mb\n\n\twhile _ma < 410 > _mb:\n\n\t\tans = min(ans, dp[_ma][_mb])\n\n\t\t_ma += ma\n\n\t\t_mb += mb\n\n\tprint((ans if ans < M else -1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()\n", "code_v0_loc": 21, "code_v1_loc": 27, "code_v0_num_chars": 492, "code_v1_num_chars": 590, "code_v0_no_empty_lines": "def main():\n n, ma, mb, *L = list(map(int, open(0).read().split()))\n M = 1 << 30\n dp = [[M] * 420 for _ in range(420)]\n dp[0][0] = 0\n for a, b, c in zip(*[iter(L)] * 3):\n for i in range(400, -1, -1):\n for j in range(400, -1, -1):\n t = dp[i][j] + c\n if dp[i + a][j + b] > t:\n dp[i + a][j + b] = t\n ans = M\n _ma, _mb = ma, mb\n while _ma < 410 > _mb:\n ans = min(ans, dp[_ma][_mb])\n _ma += ma\n _mb += mb\n print((ans if ans < M else -1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n n, ma, mb, *L = list(map(int, open(0).read().split()))\n M = 1 << 30\n dp = [[M] * 420 for _ in range(420)]\n dp[0][0] = 0\n ua = ub = 15\n for a, b, c in zip(*[iter(L)] * 3):\n for i in range(ua, -1, -1):\n for j in range(ub, -1, -1):\n t = dp[i][j] + c\n if dp[i + a][j + b] > t:\n dp[i + a][j + b] = t\n if ua < i + a:\n ua = i + a\n if ub < j + b:\n ub = j + b\n ans = M\n _ma, _mb = ma, mb\n while _ma < 410 > _mb:\n ans = min(ans, dp[_ma][_mb])\n _ma += ma\n _mb += mb\n print((ans if ans < M else -1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["+ ua = ub = 15", "- for i in range(400, -1, -1):", "- for j in range(400, -1, -1):", "+ for i in range(ua, -1, -1):", "+ for j in range(ub, -1, -1):", "+ if ua < i + a:", "+ ua = i + a", "+ if ub < j + b:", "+ ub = j + b"], "diff_only_import_comment": false, "measured_runtime_v0": 1.1710306553, "measured_runtime_v1": 0.275720624, "runtime_lift": 4.2471638081, "key": ["s355426542", "s468498336"], "target_token_count_dream": 259, "target_token_bucket_dream": "256-512"} +{"user_id": "u729133443", "problem_id": "p03434", "language": "python", "submission_id_v0": "s231475572", "submission_id_v1": "s619171000", "cpu_time_v0": 35, "cpu_time_v1": 30, "memory_v0": 9016, "memory_v1": 9012, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.29, "input": "_,s=open(c:=0)\n\nfor a in sorted(map(int,s.split())):c=a-c\n\nprint(c)", "target": "for a in sorted(map(int,[*open(c:=0)][1].split())):c=a-c\n\nprint(c)", "code_v0_loc": 3, "code_v1_loc": 2, "code_v0_num_chars": 67, "code_v1_num_chars": 66, "code_v0_no_empty_lines": "_, s = open(c := 0)\nfor a in sorted(map(int, s.split())):\n c = a - c\nprint(c)\n", "code_v1_no_empty_lines": "for a in sorted(map(int, [*open(c := 0)][1].split())):\n c = a - c\nprint(c)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-_, s = open(c := 0)", "-for a in sorted(map(int, s.split())):", "+for a in sorted(map(int, [*open(c := 0)][1].split())):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.269129122, "measured_runtime_v1": 0.112153646, "runtime_lift": 2.3996466598, "key": ["s231475572", "s619171000"], "target_token_count_dream": 25, "target_token_bucket_dream": "<128"} +{"user_id": "u738622346", "problem_id": "p03854", "language": "python", "submission_id_v0": "s146499990", "submission_id_v1": "s321967328", "cpu_time_v0": 123, "cpu_time_v1": 50, "memory_v0": 3316, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.35, "input": "s = input()\n\nt = \"\"\n\nwhile len(t) < len(s):\n\n target_len = len(s) - len(t)\n\n\n\n if s[len(t)] == 'd':\n\n if target_len == 5:\n\n t += \"dream\"\n\n elif target_len == 7:\n\n t += \"dreamer\"\n\n elif target_len > 7:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 7 + 1] != \"era\":\n\n t += \"dreamer\"\n\n else:\n\n t += \"dream\"\n\n else:\n\n break\n\n else:\n\n if target_len == 5:\n\n t += \"erase\"\n\n elif target_len == 6:\n\n t += \"eraser\"\n\n elif target_len > 6:\n\n if s[len(t) + 5] != 'd' and s[len(t) + 5:len(t) + 6 + 2] != \"era\":\n\n t += \"eraser\"\n\n else:\n\n t += \"erase\"\n\n else:\n\n break\n\n\n\n if s[0:len(t)] != t:\n\n break\n\n\n\nprint((\"YES\" if s == t else \"NO\"))\n", "target": "s = input()\n\ndiv = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\n\nrev = []\n\nt = \"\"\n\ns_rev = s[::-1]\n\nfor d in div:\n\n rev.append(d[::-1])\n\n\n\nresult = True\n\ni = 0\n\nwhile i < len(s):\n\n can_divide = False\n\n for d in rev:\n\n if len(s_rev) - i >= len(d) and s_rev[i:i + len(d)] == d:\n\n can_divide = True\n\n i += len(d)\n\n break\n\n if not can_divide:\n\n result = False\n\n break\n\n\n\nprint((\"YES\" if result else \"NO\"))\n", "code_v0_loc": 34, "code_v1_loc": 22, "code_v0_num_chars": 872, "code_v1_num_chars": 461, "code_v0_no_empty_lines": "s = input()\nt = \"\"\nwhile len(t) < len(s):\n target_len = len(s) - len(t)\n if s[len(t)] == \"d\":\n if target_len == 5:\n t += \"dream\"\n elif target_len == 7:\n t += \"dreamer\"\n elif target_len > 7:\n if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 7 + 1] != \"era\":\n t += \"dreamer\"\n else:\n t += \"dream\"\n else:\n break\n else:\n if target_len == 5:\n t += \"erase\"\n elif target_len == 6:\n t += \"eraser\"\n elif target_len > 6:\n if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 6 + 2] != \"era\":\n t += \"eraser\"\n else:\n t += \"erase\"\n else:\n break\n if s[0 : len(t)] != t:\n break\nprint((\"YES\" if s == t else \"NO\"))\n", "code_v1_no_empty_lines": "s = input()\ndiv = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nrev = []\nt = \"\"\ns_rev = s[::-1]\nfor d in div:\n rev.append(d[::-1])\nresult = True\ni = 0\nwhile i < len(s):\n can_divide = False\n for d in rev:\n if len(s_rev) - i >= len(d) and s_rev[i : i + len(d)] == d:\n can_divide = True\n i += len(d)\n break\n if not can_divide:\n result = False\n break\nprint((\"YES\" if result else \"NO\"))\n", "code_same": false, "relative_loc_diff_percent": 35.2941176471, "diff": ["+div = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]", "+rev = []", "-while len(t) < len(s):", "- target_len = len(s) - len(t)", "- if s[len(t)] == \"d\":", "- if target_len == 5:", "- t += \"dream\"", "- elif target_len == 7:", "- t += \"dreamer\"", "- elif target_len > 7:", "- if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 7 + 1] != \"era\":", "- t += \"dreamer\"", "- else:", "- t += \"dream\"", "- else:", "+s_rev = s[::-1]", "+for d in div:", "+ rev.append(d[::-1])", "+result = True", "+i = 0", "+while i < len(s):", "+ can_divide = False", "+ for d in rev:", "+ if len(s_rev) - i >= len(d) and s_rev[i : i + len(d)] == d:", "+ can_divide = True", "+ i += len(d)", "- else:", "- if target_len == 5:", "- t += \"erase\"", "- elif target_len == 6:", "- t += \"eraser\"", "- elif target_len > 6:", "- if s[len(t) + 5] != \"d\" and s[len(t) + 5 : len(t) + 6 + 2] != \"era\":", "- t += \"eraser\"", "- else:", "- t += \"erase\"", "- else:", "- break", "- if s[0 : len(t)] != t:", "+ if not can_divide:", "+ result = False", "-print((\"YES\" if s == t else \"NO\"))", "+print((\"YES\" if result else \"NO\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3984818382, "measured_runtime_v1": 0.3150180125, "runtime_lift": 1.2649493755, "key": ["s146499990", "s321967328"], "target_token_count_dream": 139, "target_token_bucket_dream": "128-256"} +{"user_id": "u808429775", "problem_id": "p00134", "language": "python", "submission_id_v0": "s571351483", "submission_id_v1": "s722552691", "cpu_time_v0": 100, "cpu_time_v1": 60, "memory_v0": 7404, "memory_v1": 5952, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.0, "input": "from statistics import mean\n\n\n\ninputCount = int(input())\n\nprices = [int(input()) for lp in range(inputCount)]\n\naverage = mean(prices)\n\nprint((int(average)))\n\n\n", "target": "inputCount = int(input())\n\nprices = [int(input()) for lp in range(inputCount)]\n\naverage = sum(prices) // inputCount\n\nprint(average)\n\n\n", "code_v0_loc": 7, "code_v1_loc": 5, "code_v0_num_chars": 157, "code_v1_num_chars": 134, "code_v0_no_empty_lines": "from statistics import mean\n\ninputCount = int(input())\nprices = [int(input()) for lp in range(inputCount)]\naverage = mean(prices)\nprint((int(average)))\n", "code_v1_no_empty_lines": "inputCount = int(input())\nprices = [int(input()) for lp in range(inputCount)]\naverage = sum(prices) // inputCount\nprint(average)\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-from statistics import mean", "-", "-average = mean(prices)", "-print((int(average)))", "+average = sum(prices) // inputCount", "+print(average)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.453101104, "measured_runtime_v1": 0.2992461076, "runtime_lift": 1.514142014, "key": ["s571351483", "s722552691"], "target_token_count_dream": 33, "target_token_bucket_dream": "<128"} +{"user_id": "u645250356", "problem_id": "p03559", "language": "python", "submission_id_v0": "s643210131", "submission_id_v1": "s973528764", "cpu_time_v0": 585, "cpu_time_v1": 431, "memory_v0": 124300, "memory_v1": 30272, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.32, "input": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\nA = sorted(inpl())\n\nB = sorted(inpl())\n\nC = sorted(inpl())\n\ncnt = [0] * n\n\nres = 0\n\nfor i,b in enumerate(B):\n\n c = bisect.bisect_left(C,b+1)\n\n cnt[i] = n-c\n\n\n\nacc = [0]\n\nfor x in cnt:\n\n acc += [acc[-1] + x]\n\nsu = sum(cnt) \n\nfor i,a in enumerate(A):\n\n c = bisect.bisect_left(B,a+1)\n\n res += su - acc[c]\n\nprint(res)", "target": "from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,math,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\na = inpl()\n\nb = inpl()\n\nc = inpl()\n\na.sort()\n\nb.sort()\n\nc.sort()\n\nlb = [0] * n\n\nres = 0\n\nfor i in range(n):\n\n tmp = bisect.bisect_right(b,a[i])\n\n if tmp == n: continue\n\n lb[tmp] += 1\n\nllb = list(itertools.accumulate(lb))\n\n# print(lb,llb)\n\nrr = [0] * n\n\nfor i in range(n):\n\n tmp = bisect.bisect_right(c,b[i])\n\n if tmp == n: continue\n\n rr[tmp] += llb[i]\n\nprint((sum(list(itertools.accumulate(rr)))))", "code_v0_loc": 27, "code_v1_loc": 30, "code_v0_num_chars": 662, "code_v1_num_chars": 747, "code_v0_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, math, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = inp()\nA = sorted(inpl())\nB = sorted(inpl())\nC = sorted(inpl())\ncnt = [0] * n\nres = 0\nfor i, b in enumerate(B):\n c = bisect.bisect_left(C, b + 1)\n cnt[i] = n - c\nacc = [0]\nfor x in cnt:\n acc += [acc[-1] + x]\nsu = sum(cnt)\nfor i, a in enumerate(A):\n c = bisect.bisect_left(B, a + 1)\n res += su - acc[c]\nprint(res)\n", "code_v1_no_empty_lines": "from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, math, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = inp()\na = inpl()\nb = inpl()\nc = inpl()\na.sort()\nb.sort()\nc.sort()\nlb = [0] * n\nres = 0\nfor i in range(n):\n tmp = bisect.bisect_right(b, a[i])\n if tmp == n:\n continue\n lb[tmp] += 1\nllb = list(itertools.accumulate(lb))\n# print(lb,llb)\nrr = [0] * n\nfor i in range(n):\n tmp = bisect.bisect_right(c, b[i])\n if tmp == n:\n continue\n rr[tmp] += llb[i]\nprint((sum(list(itertools.accumulate(rr)))))\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-A = sorted(inpl())", "-B = sorted(inpl())", "-C = sorted(inpl())", "-cnt = [0] * n", "+a = inpl()", "+b = inpl()", "+c = inpl()", "+a.sort()", "+b.sort()", "+c.sort()", "+lb = [0] * n", "-for i, b in enumerate(B):", "- c = bisect.bisect_left(C, b + 1)", "- cnt[i] = n - c", "-acc = [0]", "-for x in cnt:", "- acc += [acc[-1] + x]", "-su = sum(cnt)", "-for i, a in enumerate(A):", "- c = bisect.bisect_left(B, a + 1)", "- res += su - acc[c]", "-print(res)", "+for i in range(n):", "+ tmp = bisect.bisect_right(b, a[i])", "+ if tmp == n:", "+ continue", "+ lb[tmp] += 1", "+llb = list(itertools.accumulate(lb))", "+# print(lb,llb)", "+rr = [0] * n", "+for i in range(n):", "+ tmp = bisect.bisect_right(c, b[i])", "+ if tmp == n:", "+ continue", "+ rr[tmp] += llb[i]", "+print((sum(list(itertools.accumulate(rr)))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2585086877, "measured_runtime_v1": 0.0062210422, "runtime_lift": 41.5539198783, "key": ["s643210131", "s973528764"], "target_token_count_dream": 239, "target_token_bucket_dream": "128-256"} +{"user_id": "u145950990", "problem_id": "p02552", "language": "python", "submission_id_v0": "s431367942", "submission_id_v1": "s270499104", "cpu_time_v0": 32, "cpu_time_v1": 25, "memory_v0": 9148, "memory_v1": 9028, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.88, "input": "x = int(input())\n\nprint((0 if x==1 else 1))", "target": "s = input()\n\nif s == '0':\n\n print((1))\n\nelse:\n\n print((0))", "code_v0_loc": 2, "code_v1_loc": 5, "code_v0_num_chars": 41, "code_v1_num_chars": 56, "code_v0_no_empty_lines": "x = int(input())\nprint((0 if x == 1 else 1))\n", "code_v1_no_empty_lines": "s = input()\nif s == \"0\":\n print((1))\nelse:\n print((0))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-x = int(input())", "-print((0 if x == 1 else 1))", "+s = input()", "+if s == \"0\":", "+ print((1))", "+else:", "+ print((0))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2680207849, "measured_runtime_v1": 0.0548314691, "runtime_lift": 4.8880832377, "key": ["s431367942", "s270499104"], "target_token_count_dream": 22, "target_token_bucket_dream": "<128"} +{"user_id": "u600065151", "problem_id": "p02268", "language": "python", "submission_id_v0": "s783851867", "submission_id_v1": "s366216704", "cpu_time_v0": 50, "cpu_time_v1": 40, "memory_v0": 18684, "memory_v1": 20588, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.0, "input": "def binarySearch():\n\n n = int(input())\n\n S = set(map(int, input().split()))\n\n q = int(input())\n\n T = set(map(int, input().split()))\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()", "target": "def binarySearch():\n\n n = int(input())\n\n S = set(input().split())\n\n q = int(input())\n\n T = set(input().split())\n\n print((len(S.intersection(T))))\n\n \n\n\n\nbinarySearch()", "code_v0_loc": 9, "code_v1_loc": 9, "code_v0_num_chars": 202, "code_v1_num_chars": 182, "code_v0_no_empty_lines": "def binarySearch():\n n = int(input())\n S = set(map(int, input().split()))\n q = int(input())\n T = set(map(int, input().split()))\n print((len(S.intersection(T))))\n\n\nbinarySearch()\n", "code_v1_no_empty_lines": "def binarySearch():\n n = int(input())\n S = set(input().split())\n q = int(input())\n T = set(input().split())\n print((len(S.intersection(T))))\n\n\nbinarySearch()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- S = set(map(int, input().split()))", "+ S = set(input().split())", "- T = set(map(int, input().split()))", "+ T = set(input().split())"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3310329242, "measured_runtime_v1": 0.2247743328, "runtime_lift": 1.4727345427, "key": ["s783851867", "s366216704"], "target_token_count_dream": 45, "target_token_bucket_dream": "<128"} +{"user_id": "u996434204", "problem_id": "p03416", "language": "python", "submission_id_v0": "s285618885", "submission_id_v1": "s172989285", "cpu_time_v0": 114, "cpu_time_v1": 57, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "a,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])\n\n str1=buf[0:int(len(buf)/2)]\n\n str2=buf[int(len(buf)/2+1):]\n\n if str1[0]==str2[1] and str1[1]==str2[0]:\n\n ans+=1\n\n\n\nprint(ans)\n", "target": "a,b=list(map(int,input().split()))\n\n\n\nans=0\n\n\n\nfor i in range(a,b+1):\n\n buf=str(i)\n\n str1=buf[::-1]\n\n if buf==str1:\n\n ans+=1\n\n\n\nprint(ans)\n", "code_v0_loc": 13, "code_v1_loc": 11, "code_v0_num_chars": 284, "code_v1_num_chars": 149, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n buf = str(i)\n # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])\n str1 = buf[0 : int(len(buf) / 2)]\n str2 = buf[int(len(buf) / 2 + 1) :]\n if str1[0] == str2[1] and str1[1] == str2[0]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(a, b + 1):\n buf = str(i)\n str1 = buf[::-1]\n if buf == str1:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["- # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])", "- str1 = buf[0 : int(len(buf) / 2)]", "- str2 = buf[int(len(buf) / 2 + 1) :]", "- if str1[0] == str2[1] and str1[1] == str2[0]:", "+ str1 = buf[::-1]", "+ if buf == str1:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3597218115, "measured_runtime_v1": 0.2724662972, "runtime_lift": 1.3202433295, "key": ["s285618885", "s172989285"], "target_token_count_dream": 51, "target_token_bucket_dream": "<128"} +{"user_id": "u537976628", "problem_id": "p03720", "language": "python", "submission_id_v0": "s957846271", "submission_id_v1": "s235024999", "cpu_time_v0": 28, "cpu_time_v1": 25, "memory_v0": 9128, "memory_v1": 9136, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.71, "input": "n, m = list(map(int, input().split()))\n\nRD = list(list(map(int, input().split())) for _ in range(m))\n\nfor i in range(1, n + 1):\n\n ans = 0\n\n for j in RD:\n\n ans += j.count(i)\n\n print(ans)", "target": "n, m = list(map(int, input().split()))\n\nNRD = list(0 for i in range(n))\n\nfor i in range(m):\n\n r1, r2 = list(map(int, input().split()))\n\n NRD[r1 - 1] += 1\n\n NRD[r2 - 1] += 1\n\nfor i in range(n):\n\n print((NRD[i]))", "code_v0_loc": 7, "code_v1_loc": 8, "code_v0_num_chars": 195, "code_v1_num_chars": 208, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\nRD = list(list(map(int, input().split())) for _ in range(m))\nfor i in range(1, n + 1):\n ans = 0\n for j in RD:\n ans += j.count(i)\n print(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nNRD = list(0 for i in range(n))\nfor i in range(m):\n r1, r2 = list(map(int, input().split()))\n NRD[r1 - 1] += 1\n NRD[r2 - 1] += 1\nfor i in range(n):\n print((NRD[i]))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-RD = list(list(map(int, input().split())) for _ in range(m))", "-for i in range(1, n + 1):", "- ans = 0", "- for j in RD:", "- ans += j.count(i)", "- print(ans)", "+NRD = list(0 for i in range(n))", "+for i in range(m):", "+ r1, r2 = list(map(int, input().split()))", "+ NRD[r1 - 1] += 1", "+ NRD[r2 - 1] += 1", "+for i in range(n):", "+ print((NRD[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2888841586, "measured_runtime_v1": 0.0609361191, "runtime_lift": 4.7407705467, "key": ["s957846271", "s235024999"], "target_token_count_dream": 84, "target_token_bucket_dream": "<128"} +{"user_id": "u298297089", "problem_id": "p03325", "language": "python", "submission_id_v0": "s106132375", "submission_id_v1": "s827937559", "cpu_time_v0": 122, "cpu_time_v1": 72, "memory_v0": 4148, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.98, "input": "N = int(input())\n\nx = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in x:\n\n while i % 2 == 0:\n\n cnt += 1\n\n i /= 2\n\nprint(cnt)", "target": "n = int(input())\n\nans = 0\n\nfor i in map(int, input().split()):\n\n cnt = 0\n\n while i % 2 == 0:\n\n i >>= 1\n\n cnt += 1\n\n ans += cnt\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 134, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "N = int(input())\nx = list(map(int, input().split()))\ncnt = 0\nfor i in x:\n while i % 2 == 0:\n cnt += 1\n i /= 2\nprint(cnt)\n", "code_v1_no_empty_lines": "n = int(input())\nans = 0\nfor i in map(int, input().split()):\n cnt = 0\n while i % 2 == 0:\n i >>= 1\n cnt += 1\n ans += cnt\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-N = int(input())", "-x = list(map(int, input().split()))", "-cnt = 0", "-for i in x:", "+n = int(input())", "+ans = 0", "+for i in map(int, input().split()):", "+ cnt = 0", "+ i >>= 1", "- i /= 2", "-print(cnt)", "+ ans += cnt", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2336064763, "measured_runtime_v1": 0.0059840708, "runtime_lift": 39.0380536239, "key": ["s106132375", "s827937559"], "target_token_count_dream": 57, "target_token_bucket_dream": "<128"} +{"user_id": "u488401358", "problem_id": "p02649", "language": "python", "submission_id_v0": "s231020544", "submission_id_v1": "s831601953", "cpu_time_v0": 688, "cpu_time_v1": 413, "memory_v0": 76468, "memory_v1": 102912, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.97, "input": "def popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50 and j!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\nfor i in range(2**n):\n\n t=set([])\n\n for a in A:\n\n data[a&i]+=1\n\n t.add(a&i)\n\n temp=0\n\n for val in t:\n\n temp+=cmb[data[val]][min(K,data[val])]\n\n ans+=temp*(-1)**popcount(i)\n\n for val in t:\n\n data[val]=0\n\n\n\nprint(ans)\n", "target": "def popcount(x):\n\n x = x - ((x >> 1) & 0x55555555)\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x = x + (x >> 8)\n\n x = x + (x >> 16)\n\n return x & 0x0000007f\n\n\n\ncmb=[[0 for i in range(51)] for j in range(51)]\n\ncmb[0][0]=1\n\nfor i in range(51):\n\n for j in range(51):\n\n if i!=50:\n\n cmb[i+1][j]+=cmb[i][j]\n\n if j!=50 and i!=50:\n\n cmb[i+1][j+1]+=cmb[i][j]\n\n\n\n\n\nfor i in range(1,51):\n\n for j in range(2,51):\n\n cmb[i][j]+=cmb[i][j-1]\n\n\n\nimport random\n\nN,K,T,S=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\nmust0=[i for i in range(18) if S>>i &1==0]\n\nmust1=[i for i in range(18) if T>>i &1==1]\n\n\n\nA=[]\n\nfor val in a:\n\n check=True\n\n for j in must0:\n\n check=check&(val>>j &1==0)\n\n for j in must1:\n\n check=check&(val>>j &1==1)\n\n if check:\n\n A.append(val)\n\n\n\nif not A:\n\n print((0))\n\n exit()\n\n\n\nbit=[]\n\nfor i in range(18):\n\n if i not in must0 and i not in must1:\n\n bit.append(i)\n\n\n\nfor i in range(len(A)):\n\n temp=0\n\n for j in range(len(bit)):\n\n temp+=(A[i]>>bit[j] &1==1)*2**j\n\n A[i]=temp\n\n\n\nans=0\n\nn=len(bit)\n\ndata=[0]*(2**n)\n\npc=[popcount(i) for i in range(2**n)]\n\nfor i in range(2**n):\n\n for a in A:\n\n data[a&i]+=1\n\n for a in A:\n\n if data[a&i]:\n\n ans+=cmb[data[a&i]][min(K,data[a&i])]*(-1)**pc[i]\n\n data[a&i]=0\n\n\n\nprint(ans)", "code_v0_loc": 68, "code_v1_loc": 67, "code_v0_num_chars": 1445, "code_v1_num_chars": 1441, "code_v0_no_empty_lines": "def popcount(x):\n x = x - ((x >> 1) & 0x55555555)\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0F0F0F0F\n x = x + (x >> 8)\n x = x + (x >> 16)\n return x & 0x0000007F\n\n\ncmb = [[0 for i in range(51)] for j in range(51)]\ncmb[0][0] = 1\nfor i in range(51):\n for j in range(51):\n if i != 50 and j != 50:\n cmb[i + 1][j + 1] += cmb[i][j]\n if i != 50:\n cmb[i + 1][j] += cmb[i][j]\nfor i in range(1, 51):\n for j in range(2, 51):\n cmb[i][j] += cmb[i][j - 1]\nN, K, T, S = list(map(int, input().split()))\na = list(map(int, input().split()))\nmust0 = [i for i in range(18) if S >> i & 1 == 0]\nmust1 = [i for i in range(18) if T >> i & 1 == 1]\nA = []\nfor val in a:\n check = True\n for j in must0:\n check = check & (val >> j & 1 == 0)\n for j in must1:\n check = check & (val >> j & 1 == 1)\n if check:\n A.append(val)\nif not A:\n print((0))\n exit()\nbit = []\nfor i in range(18):\n if i not in must0 and i not in must1:\n bit.append(i)\nfor i in range(len(A)):\n temp = 0\n for j in range(len(bit)):\n temp += (A[i] >> bit[j] & 1 == 1) * 2**j\n A[i] = temp\nans = 0\nn = len(bit)\ndata = [0] * (2**n)\nfor i in range(2**n):\n t = set([])\n for a in A:\n data[a & i] += 1\n t.add(a & i)\n temp = 0\n for val in t:\n temp += cmb[data[val]][min(K, data[val])]\n ans += temp * (-1) ** popcount(i)\n for val in t:\n data[val] = 0\nprint(ans)\n", "code_v1_no_empty_lines": "def popcount(x):\n x = x - ((x >> 1) & 0x55555555)\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0F0F0F0F\n x = x + (x >> 8)\n x = x + (x >> 16)\n return x & 0x0000007F\n\n\ncmb = [[0 for i in range(51)] for j in range(51)]\ncmb[0][0] = 1\nfor i in range(51):\n for j in range(51):\n if i != 50:\n cmb[i + 1][j] += cmb[i][j]\n if j != 50 and i != 50:\n cmb[i + 1][j + 1] += cmb[i][j]\nfor i in range(1, 51):\n for j in range(2, 51):\n cmb[i][j] += cmb[i][j - 1]\nimport random\n\nN, K, T, S = list(map(int, input().split()))\na = list(map(int, input().split()))\nmust0 = [i for i in range(18) if S >> i & 1 == 0]\nmust1 = [i for i in range(18) if T >> i & 1 == 1]\nA = []\nfor val in a:\n check = True\n for j in must0:\n check = check & (val >> j & 1 == 0)\n for j in must1:\n check = check & (val >> j & 1 == 1)\n if check:\n A.append(val)\nif not A:\n print((0))\n exit()\nbit = []\nfor i in range(18):\n if i not in must0 and i not in must1:\n bit.append(i)\nfor i in range(len(A)):\n temp = 0\n for j in range(len(bit)):\n temp += (A[i] >> bit[j] & 1 == 1) * 2**j\n A[i] = temp\nans = 0\nn = len(bit)\ndata = [0] * (2**n)\npc = [popcount(i) for i in range(2**n)]\nfor i in range(2**n):\n for a in A:\n data[a & i] += 1\n for a in A:\n if data[a & i]:\n ans += cmb[data[a & i]][min(K, data[a & i])] * (-1) ** pc[i]\n data[a & i] = 0\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 1.4705882353, "diff": ["- if i != 50 and j != 50:", "- cmb[i + 1][j + 1] += cmb[i][j]", "+ if j != 50 and i != 50:", "+ cmb[i + 1][j + 1] += cmb[i][j]", "+import random", "+", "+pc = [popcount(i) for i in range(2**n)]", "- t = set([])", "- t.add(a & i)", "- temp = 0", "- for val in t:", "- temp += cmb[data[val]][min(K, data[val])]", "- ans += temp * (-1) ** popcount(i)", "- for val in t:", "- data[val] = 0", "+ for a in A:", "+ if data[a & i]:", "+ ans += cmb[data[a & i]][min(K, data[a & i])] * (-1) ** pc[i]", "+ data[a & i] = 0"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3163019059, "measured_runtime_v1": 0.2340069544, "runtime_lift": 1.3516773748, "key": ["s231020544", "s831601953"], "target_token_count_dream": 573, "target_token_bucket_dream": "512-1024"} +{"user_id": "u968166680", "problem_id": "p02814", "language": "python", "submission_id_v0": "s703991862", "submission_id_v1": "s702868581", "cpu_time_v0": 61, "cpu_time_v1": 44, "memory_v0": 13352, "memory_v1": 14092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.87, "input": "import sys\n\nfrom math import gcd\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef lcm(x, y):\n\n return x * y // gcd(x, y)\n\n\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n A = list(set(map(int, input().split(\" \"))))\n\n A = [a // 2 for a in A]\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a)\n\n if semi_lcm > M:\n\n print((0))\n\n return\n\n\n\n for a in A:\n\n if semi_lcm // a % 2 == 0:\n\n print((0))\n\n return\n\n\n\n print(((M // semi_lcm + 1) // 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n\n\n\n\ndef lcm(a, b):\n\n return a * b // gcd(a, b)\n\n\n\n\n\ndef main():\n\n N, M, *A = list(map(int, read().split()))\n\n A = list(set(A))\n\n B = A.copy()\n\n\n\n while not any(b % 2 for b in B):\n\n B = [b // 2 for b in B]\n\n\n\n if not all(b % 2 for b in B):\n\n print((0))\n\n return\n\n\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a // 2)\n\n\n\n print(((M // semi_lcm + 1) // 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 36, "code_v1_loc": 41, "code_v0_num_chars": 690, "code_v1_num_chars": 687, "code_v0_no_empty_lines": "import sys\nfrom math import gcd\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef lcm(x, y):\n return x * y // gcd(x, y)\n\n\ndef main():\n N, M = list(map(int, input().split()))\n A = list(set(map(int, input().split(\" \"))))\n A = [a // 2 for a in A]\n semi_lcm = 1\n for a in A:\n semi_lcm = lcm(semi_lcm, a)\n if semi_lcm > M:\n print((0))\n return\n for a in A:\n if semi_lcm // a % 2 == 0:\n print((0))\n return\n print(((M // semi_lcm + 1) // 2))\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return a * b // gcd(a, b)\n\n\ndef main():\n N, M, *A = list(map(int, read().split()))\n A = list(set(A))\n B = A.copy()\n while not any(b % 2 for b in B):\n B = [b // 2 for b in B]\n if not all(b % 2 for b in B):\n print((0))\n return\n semi_lcm = 1\n for a in A:\n semi_lcm = lcm(semi_lcm, a // 2)\n print(((M // semi_lcm + 1) // 2))\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 12.1951219512, "diff": ["-from math import gcd", "-def lcm(x, y):", "- return x * y // gcd(x, y)", "+def gcd(a, b):", "+ while b:", "+ a, b = b, a % b", "+ return a", "+", "+", "+def lcm(a, b):", "+ return a * b // gcd(a, b)", "- N, M = list(map(int, input().split()))", "- A = list(set(map(int, input().split(\" \"))))", "- A = [a // 2 for a in A]", "+ N, M, *A = list(map(int, read().split()))", "+ A = list(set(A))", "+ B = A.copy()", "+ while not any(b % 2 for b in B):", "+ B = [b // 2 for b in B]", "+ if not all(b % 2 for b in B):", "+ print((0))", "+ return", "- semi_lcm = lcm(semi_lcm, a)", "- if semi_lcm > M:", "- print((0))", "- return", "- for a in A:", "- if semi_lcm // a % 2 == 0:", "- print((0))", "- return", "+ semi_lcm = lcm(semi_lcm, a // 2)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.284781249, "measured_runtime_v1": 0.212113862, "runtime_lift": 1.3425866952, "key": ["s703991862", "s702868581"], "target_token_count_dream": 226, "target_token_bucket_dream": "128-256"} +{"user_id": "u761529120", "problem_id": "p03634", "language": "python", "submission_id_v0": "s135133436", "submission_id_v1": "s083939253", "cpu_time_v0": 1459, "cpu_time_v1": 754, "memory_v0": 135740, "memory_v1": 94752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.32, "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\ndef dfs(v,p,d):\n\n for i, j in tree[v]:\n\n if i != p:\n\n depth[i] = d + j\n\n dfs(i,v,d+j)\n\n\n\nN = int(input())\n\n\n\ntree = [[] for _ in range(N)]\n\n\n\nfor i in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n tree[a].append((b,c))\n\n tree[b].append((a,c))\n\n\n\nQ, K = list(map(int, input().split()))\n\n\n\ndepth = [0 for i in range(N)]\n\ndepth[K-1] = 0\n\n\n\ndfs(K-1,-1,0)\n\n\n\nfor _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n print((depth[x-1] + depth[y-1]))", "target": "import heapq\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef dijkstra(s, edge, N):\n\n d = [float('inf')] * N\n\n used = [True] * N\n\n d[s] = 0\n\n used[s] = False\n\n edgelist = []\n\n for a, b in edge[s]:\n\n heapq.heappush(edgelist, a * (10 ** 6) + b)\n\n while len(edgelist):\n\n minedge = heapq.heappop(edgelist)\n\n\n\n if not used[minedge%(10 ** 6)]:\n\n continue\n\n v = minedge % (10 ** 6)\n\n d[v] = minedge // (10 ** 6)\n\n used[v] = False\n\n for e in edge[v]:\n\n if used[e[1]]:\n\n heapq.heappush(edgelist, (e[0] + d[v]) * (10 ** 6) + e[1])\n\n return d\n\n\n\ndef main():\n\n N = int(input())\n\n edge = [[] for _ in range(N)]\n\n for _ in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n edge[a].append([c,b])\n\n edge[b].append([c,a])\n\n Q, K = list(map(int, input().split()))\n\n K -= 1\n\n d = dijkstra(K, edge, N)\n\n for _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n x -= 1\n\n y -= 1\n\n print((d[x] + d[y]))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 29, "code_v1_loc": 48, "code_v0_num_chars": 553, "code_v1_num_chars": 1130, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef dfs(v, p, d):\n for i, j in tree[v]:\n if i != p:\n depth[i] = d + j\n dfs(i, v, d + j)\n\n\nN = int(input())\ntree = [[] for _ in range(N)]\nfor i in range(N - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n tree[a].append((b, c))\n tree[b].append((a, c))\nQ, K = list(map(int, input().split()))\ndepth = [0 for i in range(N)]\ndepth[K - 1] = 0\ndfs(K - 1, -1, 0)\nfor _ in range(Q):\n x, y = list(map(int, input().split()))\n print((depth[x - 1] + depth[y - 1]))\n", "code_v1_no_empty_lines": "import heapq\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef dijkstra(s, edge, N):\n d = [float(\"inf\")] * N\n used = [True] * N\n d[s] = 0\n used[s] = False\n edgelist = []\n for a, b in edge[s]:\n heapq.heappush(edgelist, a * (10**6) + b)\n while len(edgelist):\n minedge = heapq.heappop(edgelist)\n if not used[minedge % (10**6)]:\n continue\n v = minedge % (10**6)\n d[v] = minedge // (10**6)\n used[v] = False\n for e in edge[v]:\n if used[e[1]]:\n heapq.heappush(edgelist, (e[0] + d[v]) * (10**6) + e[1])\n return d\n\n\ndef main():\n N = int(input())\n edge = [[] for _ in range(N)]\n for _ in range(N - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n edge[a].append([c, b])\n edge[b].append([c, a])\n Q, K = list(map(int, input().split()))\n K -= 1\n d = dijkstra(K, edge, N)\n for _ in range(Q):\n x, y = list(map(int, input().split()))\n x -= 1\n y -= 1\n print((d[x] + d[y]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 39.5833333333, "diff": ["+import heapq", "-sys.setrecursionlimit(10**6)", "+input = sys.stdin.readline", "-def dfs(v, p, d):", "- for i, j in tree[v]:", "- if i != p:", "- depth[i] = d + j", "- dfs(i, v, d + j)", "+def dijkstra(s, edge, N):", "+ d = [float(\"inf\")] * N", "+ used = [True] * N", "+ d[s] = 0", "+ used[s] = False", "+ edgelist = []", "+ for a, b in edge[s]:", "+ heapq.heappush(edgelist, a * (10**6) + b)", "+ while len(edgelist):", "+ minedge = heapq.heappop(edgelist)", "+ if not used[minedge % (10**6)]:", "+ continue", "+ v = minedge % (10**6)", "+ d[v] = minedge // (10**6)", "+ used[v] = False", "+ for e in edge[v]:", "+ if used[e[1]]:", "+ heapq.heappush(edgelist, (e[0] + d[v]) * (10**6) + e[1])", "+ return d", "-N = int(input())", "-tree = [[] for _ in range(N)]", "-for i in range(N - 1):", "- a, b, c = list(map(int, input().split()))", "- a -= 1", "- b -= 1", "- tree[a].append((b, c))", "- tree[b].append((a, c))", "-Q, K = list(map(int, input().split()))", "-depth = [0 for i in range(N)]", "-depth[K - 1] = 0", "-dfs(K - 1, -1, 0)", "-for _ in range(Q):", "- x, y = list(map(int, input().split()))", "- print((depth[x - 1] + depth[y - 1]))", "+def main():", "+ N = int(input())", "+ edge = [[] for _ in range(N)]", "+ for _ in range(N - 1):", "+ a, b, c = list(map(int, input().split()))", "+ a -= 1", "+ b -= 1", "+ edge[a].append([c, b])", "+ edge[b].append([c, a])", "+ Q, K = list(map(int, input().split()))", "+ K -= 1", "+ d = dijkstra(K, edge, N)", "+ for _ in range(Q):", "+ x, y = list(map(int, input().split()))", "+ x -= 1", "+ y -= 1", "+ print((d[x] + d[y]))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5217886055, "measured_runtime_v1": 0.3235212803, "runtime_lift": 1.6128416807, "key": ["s135133436", "s083939253"], "target_token_count_dream": 373, "target_token_bucket_dream": "256-512"} +{"user_id": "u230717961", "problem_id": "p03796", "language": "python", "submission_id_v0": "s450924156", "submission_id_v1": "s743009434", "cpu_time_v0": 229, "cpu_time_v1": 35, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.72, "input": "import math\n\nn = int(input())\n\n\n\npower = math.factorial(n)\n\n\n\nprint((power % (10**9 + 7)))\n", "target": "import math\n\nn = int(input())\n\n\n\npower = 1\n\n\n\nfor i in range(1, n+1):\n\n power = i * power % (10**9 + 7)\n\n\n\nprint(power)\n", "code_v0_loc": 6, "code_v1_loc": 9, "code_v0_num_chars": 89, "code_v1_num_chars": 123, "code_v0_no_empty_lines": "import math\n\nn = int(input())\npower = math.factorial(n)\nprint((power % (10**9 + 7)))\n", "code_v1_no_empty_lines": "import math\n\nn = int(input())\npower = 1\nfor i in range(1, n + 1):\n power = i * power % (10**9 + 7)\nprint(power)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-power = math.factorial(n)", "-print((power % (10**9 + 7)))", "+power = 1", "+for i in range(1, n + 1):", "+ power = i * power % (10**9 + 7)", "+print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5500237288, "measured_runtime_v1": 0.2133381867, "runtime_lift": 2.5781775744, "key": ["s450924156", "s743009434"], "target_token_count_dream": 44, "target_token_bucket_dream": "<128"} +{"user_id": "u077898957", "problem_id": "p03796", "language": "python", "submission_id_v0": "s080864979", "submission_id_v1": "s354066004", "cpu_time_v0": 230, "cpu_time_v1": 42, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.74, "input": "import math\n\nn = int(input())\n\nprint((math.factorial(n)%(10**9+7)))\n", "target": "n = int(input())\n\npw = 1\n\nfor i in range(n):\n\n pw *= (i+1)\n\n pw %= 10**9+7\n\nprint(pw)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 66, "code_v1_num_chars": 87, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\npw = 1\nfor i in range(n):\n pw *= i + 1\n pw %= 10**9 + 7\nprint(pw)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-print((math.factorial(n) % (10**9 + 7)))", "+pw = 1", "+for i in range(n):", "+ pw *= i + 1", "+ pw %= 10**9 + 7", "+print(pw)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.9190823469, "measured_runtime_v1": 0.4266894727, "runtime_lift": 2.1539841167, "key": ["s080864979", "s354066004"], "target_token_count_dream": 39, "target_token_bucket_dream": "<128"} +{"user_id": "u391731808", "problem_id": "p03634", "language": "python", "submission_id_v0": "s145761901", "submission_id_v1": "s949294302", "cpu_time_v0": 1740, "cpu_time_v1": 1056, "memory_v0": 98856, "memory_v1": 98636, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.31, "input": "import heapq\n\n\n\nN = int(input())\n\nabc = [list(map(int,input().split())) for _ in range(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nxy = [list(map(int,input().split())) for _ in range(Q)]\n\n\n\nconnect = [[] for _ in range(N)]\n\nINFTY = 10**15\n\nfor a,b,c in abc:\n\n connect[a-1].append([b-1,c])\n\n connect[b-1].append([a-1,c])\n\n\n\ncost = [[INFTY,False] for _ in range(N)]\n\ncost[K-1][0] = 0\n\nq = [(0,K-1)]\n\nwhile q:\n\n _,i = heapq.heappop(q)\n\n if cost[i][1]:\n\n continue\n\n cost[i][1] = True\n\n ci0 = cost[i][0]\n\n for j,c in connect[i]:\n\n if cost[j][1]:\n\n continue\n\n tmp_cost = ci0+c\n\n if tmp_cost < cost[j][0]:\n\n cost[j][0] = tmp_cost\n\n heapq.heappush(q,(tmp_cost,j))\n\n\n\nfor x,y in xy:\n\n print((cost[x-1][0] + cost[y-1][0]))", "target": "N = int(input())\n\nABC = [list(map(int,input().split())) for _ in [0]*(N-1)]\n\nQ,K = list(map(int,input().split()))\n\nXY = [list(map(int,input().split())) for _ in [0]*Q]\n\n\n\nE = [{} for _ in [0]*N]\n\nfor a,b,c in ABC:\n\n E[a-1][b-1] = c\n\n E[b-1][a-1] = c\n\n\n\ndef dist_dfs_tree(N,E,start):\n\n d = [-1]*N\n\n d[start] = 0\n\n q = [start]\n\n while q:\n\n i = q.pop()\n\n ci = d[i]\n\n for j,cj in list(E[i].items()):\n\n if d[j] !=-1:continue\n\n d[j] = ci+cj\n\n q.append(j)\n\n return d\n\n\n\nd = dist_dfs_tree(N,E,K-1)\n\nfor x,y in XY:\n\n print((d[x-1]+d[y-1]))", "code_v0_loc": 32, "code_v1_loc": 26, "code_v0_num_chars": 797, "code_v1_num_chars": 594, "code_v0_no_empty_lines": "import heapq\n\nN = int(input())\nabc = [list(map(int, input().split())) for _ in range(N - 1)]\nQ, K = list(map(int, input().split()))\nxy = [list(map(int, input().split())) for _ in range(Q)]\nconnect = [[] for _ in range(N)]\nINFTY = 10**15\nfor a, b, c in abc:\n connect[a - 1].append([b - 1, c])\n connect[b - 1].append([a - 1, c])\ncost = [[INFTY, False] for _ in range(N)]\ncost[K - 1][0] = 0\nq = [(0, K - 1)]\nwhile q:\n _, i = heapq.heappop(q)\n if cost[i][1]:\n continue\n cost[i][1] = True\n ci0 = cost[i][0]\n for j, c in connect[i]:\n if cost[j][1]:\n continue\n tmp_cost = ci0 + c\n if tmp_cost < cost[j][0]:\n cost[j][0] = tmp_cost\n heapq.heappush(q, (tmp_cost, j))\nfor x, y in xy:\n print((cost[x - 1][0] + cost[y - 1][0]))\n", "code_v1_no_empty_lines": "N = int(input())\nABC = [list(map(int, input().split())) for _ in [0] * (N - 1)]\nQ, K = list(map(int, input().split()))\nXY = [list(map(int, input().split())) for _ in [0] * Q]\nE = [{} for _ in [0] * N]\nfor a, b, c in ABC:\n E[a - 1][b - 1] = c\n E[b - 1][a - 1] = c\n\n\ndef dist_dfs_tree(N, E, start):\n d = [-1] * N\n d[start] = 0\n q = [start]\n while q:\n i = q.pop()\n ci = d[i]\n for j, cj in list(E[i].items()):\n if d[j] != -1:\n continue\n d[j] = ci + cj\n q.append(j)\n return d\n\n\nd = dist_dfs_tree(N, E, K - 1)\nfor x, y in XY:\n print((d[x - 1] + d[y - 1]))\n", "code_same": false, "relative_loc_diff_percent": 18.75, "diff": ["-import heapq", "+N = int(input())", "+ABC = [list(map(int, input().split())) for _ in [0] * (N - 1)]", "+Q, K = list(map(int, input().split()))", "+XY = [list(map(int, input().split())) for _ in [0] * Q]", "+E = [{} for _ in [0] * N]", "+for a, b, c in ABC:", "+ E[a - 1][b - 1] = c", "+ E[b - 1][a - 1] = c", "-N = int(input())", "-abc = [list(map(int, input().split())) for _ in range(N - 1)]", "-Q, K = list(map(int, input().split()))", "-xy = [list(map(int, input().split())) for _ in range(Q)]", "-connect = [[] for _ in range(N)]", "-INFTY = 10**15", "-for a, b, c in abc:", "- connect[a - 1].append([b - 1, c])", "- connect[b - 1].append([a - 1, c])", "-cost = [[INFTY, False] for _ in range(N)]", "-cost[K - 1][0] = 0", "-q = [(0, K - 1)]", "-while q:", "- _, i = heapq.heappop(q)", "- if cost[i][1]:", "- continue", "- cost[i][1] = True", "- ci0 = cost[i][0]", "- for j, c in connect[i]:", "- if cost[j][1]:", "- continue", "- tmp_cost = ci0 + c", "- if tmp_cost < cost[j][0]:", "- cost[j][0] = tmp_cost", "- heapq.heappush(q, (tmp_cost, j))", "-for x, y in xy:", "- print((cost[x - 1][0] + cost[y - 1][0]))", "+", "+def dist_dfs_tree(N, E, start):", "+ d = [-1] * N", "+ d[start] = 0", "+ q = [start]", "+ while q:", "+ i = q.pop()", "+ ci = d[i]", "+ for j, cj in list(E[i].items()):", "+ if d[j] != -1:", "+ continue", "+ d[j] = ci + cj", "+ q.append(j)", "+ return d", "+", "+", "+d = dist_dfs_tree(N, E, K - 1)", "+for x, y in XY:", "+ print((d[x - 1] + d[y - 1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2932223577, "measured_runtime_v1": 0.2194568303, "runtime_lift": 1.3361277359, "key": ["s145761901", "s949294302"], "target_token_count_dream": 218, "target_token_bucket_dream": "128-256"} +{"user_id": "u467041847", "problem_id": "p03416", "language": "python", "submission_id_v0": "s364629573", "submission_id_v1": "s490395080", "cpu_time_v0": 93, "cpu_time_v1": 62, "memory_v0": 3316, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "A,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(n):\n\n\tkey = 0\n\n\tfor i in range(1,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(B)-kaibun(A-1)))", "target": "A,B = list(map(int,input().split()))\n\n\n\n\n\ndef kaibun(m, n):\n\n\tkey = 0\n\n\tfor i in range(m,n+1):\n\n\t\tif str(i) == str(i)[::-1]:\n\n\t\t\tkey += 1\n\n\treturn key\n\n\n\nprint((kaibun(A,B)))", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 173, "code_v1_num_chars": 166, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\n\n\ndef kaibun(n):\n key = 0\n for i in range(1, n + 1):\n if str(i) == str(i)[::-1]:\n key += 1\n return key\n\n\nprint((kaibun(B) - kaibun(A - 1)))\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\n\n\ndef kaibun(m, n):\n key = 0\n for i in range(m, n + 1):\n if str(i) == str(i)[::-1]:\n key += 1\n return key\n\n\nprint((kaibun(A, B)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-def kaibun(n):", "+def kaibun(m, n):", "- for i in range(1, n + 1):", "+ for i in range(m, n + 1):", "-print((kaibun(B) - kaibun(A - 1)))", "+print((kaibun(A, B)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5900465159, "measured_runtime_v1": 0.3264039189, "runtime_lift": 1.8077188467, "key": ["s364629573", "s490395080"], "target_token_count_dream": 62, "target_token_bucket_dream": "<128"} +{"user_id": "u868628468", "problem_id": "p02555", "language": "python", "submission_id_v0": "s517832809", "submission_id_v1": "s490323912", "cpu_time_v0": 151, "cpu_time_v1": 62, "memory_v0": 73984, "memory_v1": 63380, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.94, "input": "from sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n for x in range(3,i+1):\n\n if x in [i-1,i-2]:\n\n continue\n\n dp[i] += dp[i-x]\n\n return dp[s]%mod\n\nprint((solve()))", "target": "from sys import stdin\n\ndef solve():\n\n s = int(stdin.readline())\n\n mod = 10**9+7\n\n if s < 3: return 0\n\n dp = [0]*(s+1)\n\n dp[0] = 1\n\n for i in range(3,s+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n return dp[s]%mod\n\nprint((solve()))", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 330, "code_v1_num_chars": 245, "code_v0_no_empty_lines": "from sys import stdin\n\n\ndef solve():\n s = int(stdin.readline())\n mod = 10**9 + 7\n if s < 3:\n return 0\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(3, s + 1):\n for x in range(3, i + 1):\n if x in [i - 1, i - 2]:\n continue\n dp[i] += dp[i - x]\n return dp[s] % mod\n\n\nprint((solve()))\n", "code_v1_no_empty_lines": "from sys import stdin\n\n\ndef solve():\n s = int(stdin.readline())\n mod = 10**9 + 7\n if s < 3:\n return 0\n dp = [0] * (s + 1)\n dp[0] = 1\n for i in range(3, s + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n return dp[s] % mod\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["- for x in range(3, i + 1):", "- if x in [i - 1, i - 2]:", "- continue", "- dp[i] += dp[i - x]", "+ dp[i] = dp[i - 1] + dp[i - 3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6190335753, "measured_runtime_v1": 0.2015811858, "runtime_lift": 3.0708896406, "key": ["s517832809", "s490323912"], "target_token_count_dream": 94, "target_token_bucket_dream": "<128"} +{"user_id": "u678167152", "problem_id": "p02773", "language": "python", "submission_id_v0": "s779115559", "submission_id_v1": "s953043553", "cpu_time_v0": 682, "cpu_time_v1": 392, "memory_v0": 32096, "memory_v1": 38716, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.52, "input": "N = int(input())\n\ns_list = {}\n\nfor i in range(N):\n\n S = input()\n\n if S in list(s_list.keys()):\n\n s_list[S] += 1\n\n else:\n\n s_list[S] = 0\n\nmax = 0\n\nmaxs = []\n\nfor s,c in list(s_list.items()):\n\n if c > max:\n\n maxs = [s]\n\n max = c\n\n elif c == max:\n\n maxs.append(s)\n\nmaxs.sort()\n\nfor m in maxs:\n\n print(m)", "target": "from collections import Counter\n\ndef solve():\n\n N = int(input())\n\n S = [input() for _ in range(N)]\n\n c = Counter(S)\n\n M = max(c.values())\n\n ans = []\n\n for k,v in c.items():\n\n if v==M:\n\n ans.append(k)\n\n ans.sort()\n\n return ans\n\nprint(*solve(),sep='\\n')\n", "code_v0_loc": 19, "code_v1_loc": 13, "code_v0_num_chars": 309, "code_v1_num_chars": 267, "code_v0_no_empty_lines": "N = int(input())\ns_list = {}\nfor i in range(N):\n S = input()\n if S in list(s_list.keys()):\n s_list[S] += 1\n else:\n s_list[S] = 0\nmax = 0\nmaxs = []\nfor s, c in list(s_list.items()):\n if c > max:\n maxs = [s]\n max = c\n elif c == max:\n maxs.append(s)\nmaxs.sort()\nfor m in maxs:\n print(m)\n", "code_v1_no_empty_lines": "from collections import Counter\n\n\ndef solve():\n N = int(input())\n S = [input() for _ in range(N)]\n c = Counter(S)\n M = max(c.values())\n ans = []\n for k, v in c.items():\n if v == M:\n ans.append(k)\n ans.sort()\n return ans\n\n\nprint(*solve(), sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 31.5789473684, "diff": ["-N = int(input())", "-s_list = {}", "-for i in range(N):", "- S = input()", "- if S in list(s_list.keys()):", "- s_list[S] += 1", "- else:", "- s_list[S] = 0", "-max = 0", "-maxs = []", "-for s, c in list(s_list.items()):", "- if c > max:", "- maxs = [s]", "- max = c", "- elif c == max:", "- maxs.append(s)", "-maxs.sort()", "-for m in maxs:", "- print(m)", "+from collections import Counter", "+", "+", "+def solve():", "+ N = int(input())", "+ S = [input() for _ in range(N)]", "+ c = Counter(S)", "+ M = max(c.values())", "+ ans = []", "+ for k, v in c.items():", "+ if v == M:", "+ ans.append(k)", "+ ans.sort()", "+ return ans", "+", "+", "+print(*solve(), sep=\"\\n\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1935686147, "measured_runtime_v1": 0.0062823365, "runtime_lift": 30.8115643329, "key": ["s779115559", "s953043553"], "target_token_count_dream": 78, "target_token_bucket_dream": "<128"} +{"user_id": "u018679195", "problem_id": "p03796", "language": "python", "submission_id_v0": "s992615685", "submission_id_v1": "s822858934", "cpu_time_v0": 232, "cpu_time_v1": 36, "memory_v0": 4024, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.48, "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))", "target": "M = 1000000007\n\nn=int(input())\n\nf = 1\n\nfor i in range(1, n + 1): \n\n f = (f * i) % M \n\nprint(f)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 69, "code_v1_num_chars": 98, "code_v0_no_empty_lines": "import math\n\nx = int(input())\nprint((math.factorial(x) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "M = 1000000007\nn = int(input())\nf = 1\nfor i in range(1, n + 1):\n f = (f * i) % M\nprint(f)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-x = int(input())", "-print((math.factorial(x) % (10**9 + 7)))", "+M = 1000000007", "+n = int(input())", "+f = 1", "+for i in range(1, n + 1):", "+ f = (f * i) % M", "+print(f)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5256081567, "measured_runtime_v1": 0.2486211307, "runtime_lift": 2.1140928576, "key": ["s992615685", "s822858934"], "target_token_count_dream": 50, "target_token_bucket_dream": "<128"} +{"user_id": "u926412290", "problem_id": "p02730", "language": "python", "submission_id_v0": "s449146060", "submission_id_v1": "s811980926", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "S = input()\n\nN = len(S)\n\nleft = S[:int(N/2)]\n\nright = S[int((N+2)/2):]\n\nS_reversed = \"\".join(reversed(list(S)))\n\nleft_reversed = \"\".join(reversed(list(left)))\n\nright_reversed = \"\".join(reversed(list(right)))\n\n\n\nif S == S_reversed and left == left_reversed and right == right_reversed:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "target": "S = input()\n\nN = len(S)\n\nleft = S[:int(N/2)]\n\nright = S[int((N+2)/2):]\n\n\n\nif S == S[::-1] and left == left[::-1] and right == right[::-1]:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "code_v0_loc": 12, "code_v1_loc": 9, "code_v0_num_chars": 326, "code_v1_num_chars": 180, "code_v0_no_empty_lines": "S = input()\nN = len(S)\nleft = S[: int(N / 2)]\nright = S[int((N + 2) / 2) :]\nS_reversed = \"\".join(reversed(list(S)))\nleft_reversed = \"\".join(reversed(list(left)))\nright_reversed = \"\".join(reversed(list(right)))\nif S == S_reversed and left == left_reversed and right == right_reversed:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "S = input()\nN = len(S)\nleft = S[: int(N / 2)]\nright = S[int((N + 2) / 2) :]\nif S == S[::-1] and left == left[::-1] and right == right[::-1]:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-S_reversed = \"\".join(reversed(list(S)))", "-left_reversed = \"\".join(reversed(list(left)))", "-right_reversed = \"\".join(reversed(list(right)))", "-if S == S_reversed and left == left_reversed and right == right_reversed:", "+if S == S[::-1] and left == left[::-1] and right == right[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2928721476, "measured_runtime_v1": 0.0555575957, "runtime_lift": 5.2715050689, "key": ["s449146060", "s811980926"], "target_token_count_dream": 63, "target_token_bucket_dream": "<128"} +{"user_id": "u896741788", "problem_id": "p03416", "language": "python", "submission_id_v0": "s606562684", "submission_id_v1": "s721402043", "cpu_time_v0": 284, "cpu_time_v1": 62, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.17, "input": "a,b=list(map(int,input().split()))\n\nans=0\n\nfor i in range(b+1)[a:]:\n\n if len(str(i))%2==0:\n\n p=list(str(i))[:len(str(i))//2]\n\n q=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if p==q:\n\n ans+=1\n\n else:\n\n s=list(str(i))[:len(str(i))//2+1]\n\n d=list(reversed(list(str(i))[len(str(i))//2:]))\n\n if s==d:\n\n ans += 1\n\nprint(ans)", "target": "a,s=list(map(int,input().split()))\n\nad=0\n\nfor i in range(a,s+1):\n\n if str(i)==str(i)[::-1]:ad+=1\n\nprint(ad)", "code_v0_loc": 14, "code_v1_loc": 5, "code_v0_num_chars": 346, "code_v1_num_chars": 102, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor i in range(b + 1)[a:]:\n if len(str(i)) % 2 == 0:\n p = list(str(i))[: len(str(i)) // 2]\n q = list(reversed(list(str(i))[len(str(i)) // 2 :]))\n if p == q:\n ans += 1\n else:\n s = list(str(i))[: len(str(i)) // 2 + 1]\n d = list(reversed(list(str(i))[len(str(i)) // 2 :]))\n if s == d:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "a, s = list(map(int, input().split()))\nad = 0\nfor i in range(a, s + 1):\n if str(i) == str(i)[::-1]:\n ad += 1\nprint(ad)\n", "code_same": false, "relative_loc_diff_percent": 64.2857142857, "diff": ["-a, b = list(map(int, input().split()))", "-ans = 0", "-for i in range(b + 1)[a:]:", "- if len(str(i)) % 2 == 0:", "- p = list(str(i))[: len(str(i)) // 2]", "- q = list(reversed(list(str(i))[len(str(i)) // 2 :]))", "- if p == q:", "- ans += 1", "- else:", "- s = list(str(i))[: len(str(i)) // 2 + 1]", "- d = list(reversed(list(str(i))[len(str(i)) // 2 :]))", "- if s == d:", "- ans += 1", "-print(ans)", "+a, s = list(map(int, input().split()))", "+ad = 0", "+for i in range(a, s + 1):", "+ if str(i) == str(i)[::-1]:", "+ ad += 1", "+print(ad)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6921946588, "measured_runtime_v1": 0.3831296915, "runtime_lift": 1.8066849794, "key": ["s606562684", "s721402043"], "target_token_count_dream": 40, "target_token_bucket_dream": "<128"} +{"user_id": "u036104576", "problem_id": "p02814", "language": "python", "submission_id_v0": "s934732087", "submission_id_v1": "s059526149", "cpu_time_v0": 249, "cpu_time_v1": 174, "memory_v0": 14544, "memory_v1": 90620, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.12, "input": "import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\n \n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nfrom collections import defaultdict\n\n \n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n \n\n \n\nfrom functools import reduce\n\n# from math import *\n\nfrom math import *\n\nN, M = list(map(int, readline().split()))\n\nA = list(sorted([int(x) // 2 for x in readline().split()]))\n\nmin_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)\n\n \n\n# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))\n\nif not all([(min_cm // x) % 2 == 1 for x in A]):\n\n print((0))\n\n exit(0)\n\nif min_cm > M:\n\n print((0))\n\n exit(0)\n\nans = (M // min_cm + 1) // 2\n\nprint(ans)", "target": "import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\nimport heapq\n\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nINF = 10 ** 9 + 7\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n# map(int, input().split())\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list([int(x) // 2 for x in input().split()])\n\n\n\ndef f(n):\n\n res = 0\n\n while n % 2 == 0:\n\n n //= 2\n\n res += 1\n\n return res\n\n\n\ndef gcd(a, b):\n\n if b == 0:\n\n return a\n\n return gcd(b, a % b)\n\n\n\nx = f(A[0])\n\nfor a in A:\n\n y = f(a)\n\n if y != x:\n\n print((0))\n\n exit()\n\n\n\nlcm = A[0]\n\nfor i in range(1, N):\n\n lcm = lcm * A[i] // gcd(lcm, A[i])\n\n\n\nprint(((M // lcm + 1) // 2))", "code_v0_loc": 31, "code_v1_loc": 43, "code_v0_num_chars": 729, "code_v1_num_chars": 789, "code_v0_no_empty_lines": "import sys\nimport itertools\n\n# import numpy as np\nimport time\nimport math\n\nsys.setrecursionlimit(10**7)\nfrom collections import defaultdict\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom functools import reduce\n\n# from math import *\nfrom math import *\n\nN, M = list(map(int, readline().split()))\nA = list(sorted([int(x) // 2 for x in readline().split()]))\nmin_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)\n# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))\nif not all([(min_cm // x) % 2 == 1 for x in A]):\n print((0))\n exit(0)\nif min_cm > M:\n print((0))\n exit(0)\nans = (M // min_cm + 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\nimport itertools\n\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**7)\nINF = 10**9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n# map(int, input().split())\nN, M = list(map(int, input().split()))\nA = list([int(x) // 2 for x in input().split()])\n\n\ndef f(n):\n res = 0\n while n % 2 == 0:\n n //= 2\n res += 1\n return res\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\nx = f(A[0])\nfor a in A:\n y = f(a)\n if y != x:\n print((0))\n exit()\nlcm = A[0]\nfor i in range(1, N):\n lcm = lcm * A[i] // gcd(lcm, A[i])\nprint(((M // lcm + 1) // 2))\n", "code_same": false, "relative_loc_diff_percent": 27.9069767442, "diff": ["+import heapq", "+from collections import defaultdict", "-from collections import defaultdict", "-", "+INF = 10**9 + 7", "-from functools import reduce", "+# map(int, input().split())", "+N, M = list(map(int, input().split()))", "+A = list([int(x) // 2 for x in input().split()])", "-# from math import *", "-from math import *", "-N, M = list(map(int, readline().split()))", "-A = list(sorted([int(x) // 2 for x in readline().split()]))", "-min_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)", "-# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))", "-if not all([(min_cm // x) % 2 == 1 for x in A]):", "- print((0))", "- exit(0)", "-if min_cm > M:", "- print((0))", "- exit(0)", "-ans = (M // min_cm + 1) // 2", "-print(ans)", "+def f(n):", "+ res = 0", "+ while n % 2 == 0:", "+ n //= 2", "+ res += 1", "+ return res", "+", "+", "+def gcd(a, b):", "+ if b == 0:", "+ return a", "+ return gcd(b, a % b)", "+", "+", "+x = f(A[0])", "+for a in A:", "+ y = f(a)", "+ if y != x:", "+ print((0))", "+ exit()", "+lcm = A[0]", "+for i in range(1, N):", "+ lcm = lcm * A[i] // gcd(lcm, A[i])", "+print(((M // lcm + 1) // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.414138025, "measured_runtime_v1": 0.277947119, "runtime_lift": 1.4899885508, "key": ["s934732087", "s059526149"], "target_token_count_dream": 255, "target_token_bucket_dream": "128-256"} +{"user_id": "u590871958", "problem_id": "p01093", "language": "python", "submission_id_v0": "s330226420", "submission_id_v1": "s459093378", "cpu_time_v0": 50, "cpu_time_v1": 40, "memory_v0": 7684, "memory_v1": 7704, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.0, "input": "while int(input()) > 0:\n\n s = sorted(map(int, input().split()))\n\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))", "target": "while True:\n\n if int(input()) == 0:\n\n break\n\n s = sorted(map(int, input().split()))\n\n r = min(abs(x - y) for (x, y) in zip(s, s[1:]))\n\n print(r)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 122, "code_v1_num_chars": 163, "code_v0_no_empty_lines": "while int(input()) > 0:\n s = sorted(map(int, input().split()))\n print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))\n", "code_v1_no_empty_lines": "while True:\n if int(input()) == 0:\n break\n s = sorted(map(int, input().split()))\n r = min(abs(x - y) for (x, y) in zip(s, s[1:]))\n print(r)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-while int(input()) > 0:", "+while True:", "+ if int(input()) == 0:", "+ break", "- print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))", "+ r = min(abs(x - y) for (x, y) in zip(s, s[1:]))", "+ print(r)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2760278752, "measured_runtime_v1": 0.2140542445, "runtime_lift": 1.2895230169, "key": ["s330226420", "s459093378"], "target_token_count_dream": 54, "target_token_bucket_dream": "<128"} +{"user_id": "u970197315", "problem_id": "p02814", "language": "python", "submission_id_v0": "s991587805", "submission_id_v1": "s856136819", "cpu_time_v0": 253, "cpu_time_v1": 206, "memory_v0": 16276, "memory_v1": 20232, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.58, "input": "# ABC150 D\n\nsi = lambda: input()\n\nni = lambda: int(input())\n\nnm = lambda: list(map(int, input().split()))\n\nnl = lambda: list(map(int, input().split()))\n\nfrom math import gcd\n\nfrom math import ceil\n\ndef lcm(x, y):\n\n return (x * y) // gcd(x, y)\n\nn,m=nm()\n\na=nl()\n\nans=0\n\na=[x//2 for x in a] \n\n\n\nlcm_v=a[0]\n\nfor i in range(n):\n\n lcm_v=lcm(lcm_v,a[i])\n\nok_flg=[(lcm_v//i)%2==1 for i in a]\n\nif all(ok_flg):\n\n ans=((m//lcm_v)+1)//2\n\nprint(ans)\n\n\n", "target": "from math import gcd, ceil\n\n\n\n\n\ndef lcm(a, b):\n\n return (a*b)//gcd(a, b)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\nfor i in range(n):\n\n a[i] = a[i]//2\n\n\n\nlcm_v = a[0]\n\nfor i in range(1, n):\n\n lcm_v = lcm(lcm_v, a[i])\n\n\n\nok = True\n\nfor aa in a:\n\n if (lcm_v//aa) % 2 != 1:\n\n ok = False\n\n break\n\nans = 0\n\nif ok:\n\n ans = ((m//lcm_v)+1)//2\n\nprint(ans)\n", "code_v0_loc": 22, "code_v1_loc": 26, "code_v0_num_chars": 448, "code_v1_num_chars": 412, "code_v0_no_empty_lines": "# ABC150 D\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: list(map(int, input().split()))\nnl = lambda: list(map(int, input().split()))\nfrom math import gcd\nfrom math import ceil\n\n\ndef lcm(x, y):\n return (x * y) // gcd(x, y)\n\n\nn, m = nm()\na = nl()\nans = 0\na = [x // 2 for x in a]\nlcm_v = a[0]\nfor i in range(n):\n lcm_v = lcm(lcm_v, a[i])\nok_flg = [(lcm_v // i) % 2 == 1 for i in a]\nif all(ok_flg):\n ans = ((m // lcm_v) + 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "from math import gcd, ceil\n\n\ndef lcm(a, b):\n return (a * b) // gcd(a, b)\n\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nfor i in range(n):\n a[i] = a[i] // 2\nlcm_v = a[0]\nfor i in range(1, n):\n lcm_v = lcm(lcm_v, a[i])\nok = True\nfor aa in a:\n if (lcm_v // aa) % 2 != 1:\n ok = False\n break\nans = 0\nif ok:\n ans = ((m // lcm_v) + 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.3846153846, "diff": ["-# ABC150 D", "-si = lambda: input()", "-ni = lambda: int(input())", "-nm = lambda: list(map(int, input().split()))", "-nl = lambda: list(map(int, input().split()))", "-from math import gcd", "-from math import ceil", "+from math import gcd, ceil", "-def lcm(x, y):", "- return (x * y) // gcd(x, y)", "+def lcm(a, b):", "+ return (a * b) // gcd(a, b)", "-n, m = nm()", "-a = nl()", "+n, m = list(map(int, input().split()))", "+a = list(map(int, input().split()))", "+for i in range(n):", "+ a[i] = a[i] // 2", "+lcm_v = a[0]", "+for i in range(1, n):", "+ lcm_v = lcm(lcm_v, a[i])", "+ok = True", "+for aa in a:", "+ if (lcm_v // aa) % 2 != 1:", "+ ok = False", "+ break", "-a = [x // 2 for x in a]", "-lcm_v = a[0]", "-for i in range(n):", "- lcm_v = lcm(lcm_v, a[i])", "-ok_flg = [(lcm_v // i) % 2 == 1 for i in a]", "-if all(ok_flg):", "+if ok:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4063324592, "measured_runtime_v1": 0.2545481203, "runtime_lift": 1.5962893726, "key": ["s991587805", "s856136819"], "target_token_count_dream": 152, "target_token_bucket_dream": "128-256"} +{"user_id": "u400765446", "problem_id": "p02412", "language": "python", "submission_id_v0": "s921182397", "submission_id_v1": "s148735991", "cpu_time_v0": 320, "cpu_time_v1": 20, "memory_v0": 5600, "memory_v1": 5600, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 93.75, "input": "def main():\n\n\n\n while True:\n\n n, x = tuple(map(int, input().split()))\n\n pattern = 0\n\n\n\n if n == x == 0:\n\n break\n\n else:\n\n for a in range(1, n+1):\n\n for b in range(1, a):\n\n for c in range(1, b):\n\n pattern += 1 if a + b + c == x and a > b > c else 0\n\n print(pattern)\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def divide_two(c, z):\n\n min_b = z // 2 + 1\n\n max_b = min(c-1, z-1)\n\n return max(max_b-min_b+1, 0)\n\n \n\n\n\nnum_set = []\n\ncnt = 0\n\nwhile True:\n\n n, x = list(map(int, input().split()))\n\n if (n, x) == (0, 0):\n\n break\n\n else:\n\n num_set.append((n, x))\n\n cnt += 1\n\n\n\nfor i in range(cnt):\n\n num_count = 0\n\n (n, x) = num_set[i]\n\n for c in range(x//3, n+1):\n\n num_count += divide_two(c, x-c)\n\n print(num_count)\n", "code_v0_loc": 18, "code_v1_loc": 22, "code_v0_num_chars": 458, "code_v1_num_chars": 454, "code_v0_no_empty_lines": "def main():\n while True:\n n, x = tuple(map(int, input().split()))\n pattern = 0\n if n == x == 0:\n break\n else:\n for a in range(1, n + 1):\n for b in range(1, a):\n for c in range(1, b):\n pattern += 1 if a + b + c == x and a > b > c else 0\n print(pattern)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def divide_two(c, z):\n min_b = z // 2 + 1\n max_b = min(c - 1, z - 1)\n return max(max_b - min_b + 1, 0)\n\n\nnum_set = []\ncnt = 0\nwhile True:\n n, x = list(map(int, input().split()))\n if (n, x) == (0, 0):\n break\n else:\n num_set.append((n, x))\n cnt += 1\nfor i in range(cnt):\n num_count = 0\n (n, x) = num_set[i]\n for c in range(x // 3, n + 1):\n num_count += divide_two(c, x - c)\n print(num_count)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-def main():", "- while True:", "- n, x = tuple(map(int, input().split()))", "- pattern = 0", "- if n == x == 0:", "- break", "- else:", "- for a in range(1, n + 1):", "- for b in range(1, a):", "- for c in range(1, b):", "- pattern += 1 if a + b + c == x and a > b > c else 0", "- print(pattern)", "+def divide_two(c, z):", "+ min_b = z // 2 + 1", "+ max_b = min(c - 1, z - 1)", "+ return max(max_b - min_b + 1, 0)", "-if __name__ == \"__main__\":", "- main()", "+num_set = []", "+cnt = 0", "+while True:", "+ n, x = list(map(int, input().split()))", "+ if (n, x) == (0, 0):", "+ break", "+ else:", "+ num_set.append((n, x))", "+ cnt += 1", "+for i in range(cnt):", "+ num_count = 0", "+ (n, x) = num_set[i]", "+ for c in range(x // 3, n + 1):", "+ num_count += divide_two(c, x - c)", "+ print(num_count)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2920441294, "measured_runtime_v1": 0.2327923727, "runtime_lift": 1.2545261942, "key": ["s921182397", "s148735991"], "target_token_count_dream": 160, "target_token_bucket_dream": "128-256"} +{"user_id": "u392029857", "problem_id": "p03416", "language": "python", "submission_id_v0": "s263636434", "submission_id_v1": "s255168613", "cpu_time_v0": 110, "cpu_time_v1": 20, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 81.82, "input": "A, B = list(map(int, input().split()))\n\nnumbers = list(range(A, B+1))\n\ncount = 0\n\nfor i in numbers:\n\n m = str(i)\n\n rm = ''.join(list(reversed(m)))\n\n if m == rm:\n\n count += 1\n\nprint(count)", "target": "A, B = list(map(int, input().split()))\n\nx = list(range(1,10))\n\ny = list(range(10))\n\ncount = 0\n\nfor p in x:\n\n for q in y:\n\n for r in y:\n\n sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))\n\n if A <= sakasama <= B:\n\n count += 1\n\nprint(count)", "code_v0_loc": 9, "code_v1_loc": 11, "code_v0_num_chars": 191, "code_v1_num_chars": 268, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\nnumbers = list(range(A, B + 1))\ncount = 0\nfor i in numbers:\n m = str(i)\n rm = \"\".join(list(reversed(m)))\n if m == rm:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nx = list(range(1, 10))\ny = list(range(10))\ncount = 0\nfor p in x:\n for q in y:\n for r in y:\n sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))\n if A <= sakasama <= B:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-numbers = list(range(A, B + 1))", "+x = list(range(1, 10))", "+y = list(range(10))", "-for i in numbers:", "- m = str(i)", "- rm = \"\".join(list(reversed(m)))", "- if m == rm:", "- count += 1", "+for p in x:", "+ for q in y:", "+ for r in y:", "+ sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))", "+ if A <= sakasama <= B:", "+ count += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3536295901, "measured_runtime_v1": 0.1996227459, "runtime_lift": 1.7714894587, "key": ["s263636434", "s255168613"], "target_token_count_dream": 92, "target_token_bucket_dream": "<128"} +{"user_id": "u634461820", "problem_id": "p02863", "language": "python", "submission_id_v0": "s061535189", "submission_id_v1": "s586045080", "cpu_time_v0": 1058, "cpu_time_v1": 461, "memory_v0": 183896, "memory_v1": 117976, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 56.43, "input": "import sys\n\nfrom operator import itemgetter\n\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return input()\n\n\n\nN, T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort(key=itemgetter(0))\n\n#print(ab)\n\n\n\ndp = [[0]*(T+1+3000+1) for _ in range(N+1)]\n\nans = 0\n\nfor i in range(N):\n\n for j in range(T+1+3000+1):\n\n time, deli = ab[i]\n\n if 0 <= j-time < T:\n\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n\n else:\n\n dp[i + 1][j] = dp[i][j]\n\n ans = max(ans, dp[i + 1][j])\n\nprint(ans)\n\n\n\n#print(dp)\n", "target": "import sys\n\nfrom collections import deque\n\nMAX_INT = int(10e10)\n\nMIN_INT = -MAX_INT\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\ndef IL(): return list(map(int,input().split()))\n\ndef SL(): return input().split()\n\ndef I(): return int(sys.stdin.readline())\n\ndef S(): return input()\n\n\n\nN,T = IL()\n\nab = [IL() for i in range(N)]\n\nab.sort()\n\n\n\nans = 0\n\ndp = [[0]*T for i in range(N+1)]\n\nfor i in range(1,N+1):\n\n a,b = ab[i-1]\n\n for j in range(T):\n\n if 0 <= j-a < T:\n\n dp[i][j] = max(dp[i-1][j], dp[i-1][j-a] + b)\n\n else:\n\n dp[i][j] = dp[i-1][j]\n\n else:\n\n ans = max(ans, dp[i-1][-1] + b)\n\nprint(ans)", "code_v0_loc": 30, "code_v1_loc": 27, "code_v0_num_chars": 737, "code_v1_num_chars": 620, "code_v0_no_empty_lines": "import sys\nfrom operator import itemgetter\nfrom heapq import heapify, heappop, heappush\n\nMAX_INT = int(10e15)\nMIN_INT = -MAX_INT\nmod = 1000000007\nsys.setrecursionlimit(1000000)\n\n\ndef IL():\n return list(map(int, input().split()))\n\n\ndef SL():\n return input().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\nN, T = IL()\nab = [IL() for i in range(N)]\nab.sort(key=itemgetter(0))\n# print(ab)\ndp = [[0] * (T + 1 + 3000 + 1) for _ in range(N + 1)]\nans = 0\nfor i in range(N):\n for j in range(T + 1 + 3000 + 1):\n time, deli = ab[i]\n if 0 <= j - time < T:\n dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)\n else:\n dp[i + 1][j] = dp[i][j]\n ans = max(ans, dp[i + 1][j])\nprint(ans)\n# print(dp)\n", "code_v1_no_empty_lines": "import sys\nfrom collections import deque\n\nMAX_INT = int(10e10)\nMIN_INT = -MAX_INT\nmod = 1000000007\nsys.setrecursionlimit(1000000)\n\n\ndef IL():\n return list(map(int, input().split()))\n\n\ndef SL():\n return input().split()\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef S():\n return input()\n\n\nN, T = IL()\nab = [IL() for i in range(N)]\nab.sort()\nans = 0\ndp = [[0] * T for i in range(N + 1)]\nfor i in range(1, N + 1):\n a, b = ab[i - 1]\n for j in range(T):\n if 0 <= j - a < T:\n dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a] + b)\n else:\n dp[i][j] = dp[i - 1][j]\n else:\n ans = max(ans, dp[i - 1][-1] + b)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-from operator import itemgetter", "-from heapq import heapify, heappop, heappush", "+from collections import deque", "-MAX_INT = int(10e15)", "+MAX_INT = int(10e10)", "-ab.sort(key=itemgetter(0))", "-# print(ab)", "-dp = [[0] * (T + 1 + 3000 + 1) for _ in range(N + 1)]", "+ab.sort()", "-for i in range(N):", "- for j in range(T + 1 + 3000 + 1):", "- time, deli = ab[i]", "- if 0 <= j - time < T:", "- dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)", "+dp = [[0] * T for i in range(N + 1)]", "+for i in range(1, N + 1):", "+ a, b = ab[i - 1]", "+ for j in range(T):", "+ if 0 <= j - a < T:", "+ dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a] + b)", "- dp[i + 1][j] = dp[i][j]", "- ans = max(ans, dp[i + 1][j])", "+ dp[i][j] = dp[i - 1][j]", "+ else:", "+ ans = max(ans, dp[i - 1][-1] + b)", "-# print(dp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4860900669, "measured_runtime_v1": 0.3545958745, "runtime_lift": 1.3708283197, "key": ["s061535189", "s586045080"], "target_token_count_dream": 227, "target_token_bucket_dream": "128-256"} +{"user_id": "u968166680", "problem_id": "p02599", "language": "python", "submission_id_v0": "s648865207", "submission_id_v1": "s892817156", "cpu_time_v0": 1665, "cpu_time_v1": 1042, "memory_v0": 247668, "memory_v1": 267648, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.42, "input": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/\n\n# Python3 code to find number of\n\n# distinct numbers in a subarray\n\nMAX = 1000001\n\n\n\n# structure to store queries\n\nclass Query:\n\n def __init__(self, l, r, idx):\n\n self.l = l\n\n self.r = r\n\n self.idx = idx\n\n\n\n\n\n# updating the bit array\n\ndef update(idx, val, bit, n):\n\n while idx <= n:\n\n bit[idx] += val\n\n idx += idx & -idx\n\n\n\n\n\n# querying the bit array\n\ndef query(idx, bit, n):\n\n summ = 0\n\n while idx:\n\n summ += bit[idx]\n\n idx -= idx & -idx\n\n return summ\n\n\n\n\n\ndef answeringQueries(arr, n, queries, q):\n\n\n\n # initialising bit array\n\n bit = [0] * (n + 1)\n\n\n\n # holds the rightmost index of\n\n # any number as numbers of a[i]\n\n # are less than or equal to 10^6\n\n last_visit = [-1] * MAX\n\n\n\n # answer for each query\n\n ans = [0] * q\n\n\n\n query_counter = 0\n\n for i in range(n):\n\n\n\n # If last visit is not -1 update -1 at the\n\n # idx equal to last_visit[arr[i]]\n\n if last_visit[arr[i]] != -1:\n\n update(last_visit[arr[i]] + 1, -1, bit, n)\n\n\n\n # Setting last_visit[arr[i]] as i and\n\n # updating the bit array accordingly\n\n last_visit[arr[i]] = i\n\n update(i + 1, 1, bit, n)\n\n\n\n # If i is equal to r of any query store answer\n\n # for that query in ans[]\n\n while query_counter < q and queries[query_counter].r == i:\n\n ans[queries[query_counter].idx] = query(queries[query_counter].r + 1, bit, n) - query(\n\n queries[query_counter].l, bit, n\n\n )\n\n query_counter += 1\n\n\n\n # print answer for each query\n\n for i in range(q):\n\n print((ans[i]))\n\n\n\n\n\n# This code is contributed by\n\n# sanjeev2552\n\n\n\n\n\ndef main():\n\n N, Q = list(map(int, readline().split()))\n\n C = list(map(int, readline().split()))\n\n (*LR,) = list(map(int, read().split()))\n\n\n\n queries = [0] * Q\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n queries[i] = Query(l - 1, r - 1, i)\n\n\n\n queries.sort(key=lambda x: x.r)\n\n answeringQueries(C, N, queries, Q)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n", "target": "import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n\n\nclass BIT:\n\n def __init__(self, n):\n\n self.n = n\n\n self.data = [0] * (n + 1)\n\n\n\n def add(self, i, x=1):\n\n i += 1\n\n while i <= self.n:\n\n self.data[i] += x\n\n i += i & -i\n\n\n\n def get_sum(self, i):\n\n i += 1\n\n x = 0\n\n while i > 0:\n\n x += self.data[i]\n\n i -= i & -i\n\n return x\n\n\n\n # Return sum for [l, r)\n\n def get_sum_range(self, l, r):\n\n return self.get_sum(r - 1) - self.get_sum(l - 1)\n\n\n\n\n\ndef main():\n\n N, Q = map(int, readline().split())\n\n C = list(map(int, readline().split()))\n\n LR = map(int, read().split())\n\n\n\n prev = [-1] * (N + 1)\n\n ps = [[] for _ in range(N)]\n\n for i, c in enumerate(C):\n\n if prev[c] != -1:\n\n ps[prev[c]].append(i)\n\n prev[c] = i\n\n\n\n qs = [[] for _ in range(N + 1)]\n\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n\n l -= 1\n\n r -= 1\n\n qs[l].append((r, i))\n\n\n\n ans = [0] * Q\n\n bit = BIT(N)\n\n\n\n for l in range(N - 1, -1, -1):\n\n for r in ps[l]:\n\n bit.add(r)\n\n for r, i in qs[l]:\n\n ans[i] = (r - l + 1) - bit.get_sum(r)\n\n\n\n print(*ans, sep='\\n')\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 99, "code_v1_loc": 68, "code_v0_num_chars": 2366, "code_v1_num_chars": 1436, "code_v0_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/\n# Python3 code to find number of\n# distinct numbers in a subarray\nMAX = 1000001\n# structure to store queries\nclass Query:\n def __init__(self, l, r, idx):\n self.l = l\n self.r = r\n self.idx = idx\n\n\n# updating the bit array\ndef update(idx, val, bit, n):\n while idx <= n:\n bit[idx] += val\n idx += idx & -idx\n\n\n# querying the bit array\ndef query(idx, bit, n):\n summ = 0\n while idx:\n summ += bit[idx]\n idx -= idx & -idx\n return summ\n\n\ndef answeringQueries(arr, n, queries, q):\n # initialising bit array\n bit = [0] * (n + 1)\n # holds the rightmost index of\n # any number as numbers of a[i]\n # are less than or equal to 10^6\n last_visit = [-1] * MAX\n # answer for each query\n ans = [0] * q\n query_counter = 0\n for i in range(n):\n # If last visit is not -1 update -1 at the\n # idx equal to last_visit[arr[i]]\n if last_visit[arr[i]] != -1:\n update(last_visit[arr[i]] + 1, -1, bit, n)\n # Setting last_visit[arr[i]] as i and\n # updating the bit array accordingly\n last_visit[arr[i]] = i\n update(i + 1, 1, bit, n)\n # If i is equal to r of any query store answer\n # for that query in ans[]\n while query_counter < q and queries[query_counter].r == i:\n ans[queries[query_counter].idx] = query(\n queries[query_counter].r + 1, bit, n\n ) - query(queries[query_counter].l, bit, n)\n query_counter += 1\n # print answer for each query\n for i in range(q):\n print((ans[i]))\n\n\n# This code is contributed by\n# sanjeev2552\ndef main():\n N, Q = list(map(int, readline().split()))\n C = list(map(int, readline().split()))\n (*LR,) = list(map(int, read().split()))\n queries = [0] * Q\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n queries[i] = Query(l - 1, r - 1, i)\n queries.sort(key=lambda x: x.r)\n answeringQueries(C, N, queries, Q)\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n\n\nclass BIT:\n def __init__(self, n):\n self.n = n\n self.data = [0] * (n + 1)\n\n def add(self, i, x=1):\n i += 1\n while i <= self.n:\n self.data[i] += x\n i += i & -i\n\n def get_sum(self, i):\n i += 1\n x = 0\n while i > 0:\n x += self.data[i]\n i -= i & -i\n return x\n\n # Return sum for [l, r)\n def get_sum_range(self, l, r):\n return self.get_sum(r - 1) - self.get_sum(l - 1)\n\n\ndef main():\n N, Q = map(int, readline().split())\n C = list(map(int, readline().split()))\n LR = map(int, read().split())\n prev = [-1] * (N + 1)\n ps = [[] for _ in range(N)]\n for i, c in enumerate(C):\n if prev[c] != -1:\n ps[prev[c]].append(i)\n prev[c] = i\n qs = [[] for _ in range(N + 1)]\n for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):\n l -= 1\n r -= 1\n qs[l].append((r, i))\n ans = [0] * Q\n bit = BIT(N)\n for l in range(N - 1, -1, -1):\n for r in ps[l]:\n bit.add(r)\n for r, i in qs[l]:\n ans[i] = (r - l + 1) - bit.get_sum(r)\n print(*ans, sep=\"\\n\")\n return\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 31.3131313131, "diff": ["-# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/", "-# Python3 code to find number of", "-# distinct numbers in a subarray", "-MAX = 1000001", "-# structure to store queries", "-class Query:", "- def __init__(self, l, r, idx):", "- self.l = l", "- self.r = r", "- self.idx = idx", "-# updating the bit array", "-def update(idx, val, bit, n):", "- while idx <= n:", "- bit[idx] += val", "- idx += idx & -idx", "+class BIT:", "+ def __init__(self, n):", "+ self.n = n", "+ self.data = [0] * (n + 1)", "+", "+ def add(self, i, x=1):", "+ i += 1", "+ while i <= self.n:", "+ self.data[i] += x", "+ i += i & -i", "+", "+ def get_sum(self, i):", "+ i += 1", "+ x = 0", "+ while i > 0:", "+ x += self.data[i]", "+ i -= i & -i", "+ return x", "+", "+ # Return sum for [l, r)", "+ def get_sum_range(self, l, r):", "+ return self.get_sum(r - 1) - self.get_sum(l - 1)", "-# querying the bit array", "-def query(idx, bit, n):", "- summ = 0", "- while idx:", "- summ += bit[idx]", "- idx -= idx & -idx", "- return summ", "-", "-", "-def answeringQueries(arr, n, queries, q):", "- # initialising bit array", "- bit = [0] * (n + 1)", "- # holds the rightmost index of", "- # any number as numbers of a[i]", "- # are less than or equal to 10^6", "- last_visit = [-1] * MAX", "- # answer for each query", "- ans = [0] * q", "- query_counter = 0", "- for i in range(n):", "- # If last visit is not -1 update -1 at the", "- # idx equal to last_visit[arr[i]]", "- if last_visit[arr[i]] != -1:", "- update(last_visit[arr[i]] + 1, -1, bit, n)", "- # Setting last_visit[arr[i]] as i and", "- # updating the bit array accordingly", "- last_visit[arr[i]] = i", "- update(i + 1, 1, bit, n)", "- # If i is equal to r of any query store answer", "- # for that query in ans[]", "- while query_counter < q and queries[query_counter].r == i:", "- ans[queries[query_counter].idx] = query(", "- queries[query_counter].r + 1, bit, n", "- ) - query(queries[query_counter].l, bit, n)", "- query_counter += 1", "- # print answer for each query", "- for i in range(q):", "- print((ans[i]))", "-", "-", "-# This code is contributed by", "-# sanjeev2552", "- N, Q = list(map(int, readline().split()))", "+ N, Q = map(int, readline().split())", "- (*LR,) = list(map(int, read().split()))", "- queries = [0] * Q", "+ LR = map(int, read().split())", "+ prev = [-1] * (N + 1)", "+ ps = [[] for _ in range(N)]", "+ for i, c in enumerate(C):", "+ if prev[c] != -1:", "+ ps[prev[c]].append(i)", "+ prev[c] = i", "+ qs = [[] for _ in range(N + 1)]", "- queries[i] = Query(l - 1, r - 1, i)", "- queries.sort(key=lambda x: x.r)", "- answeringQueries(C, N, queries, Q)", "+ l -= 1", "+ r -= 1", "+ qs[l].append((r, i))", "+ ans = [0] * Q", "+ bit = BIT(N)", "+ for l in range(N - 1, -1, -1):", "+ for r in ps[l]:", "+ bit.add(r)", "+ for r, i in qs[l]:", "+ ans[i] = (r - l + 1) - bit.get_sum(r)", "+ print(*ans, sep=\"\\n\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.264044944, "measured_runtime_v1": 0.2106282006, "runtime_lift": 1.2536067971, "key": ["s648865207", "s892817156"], "target_token_count_dream": 464, "target_token_bucket_dream": "256-512"} +{"user_id": "u855831834", "problem_id": "p02596", "language": "python", "submission_id_v0": "s777833838", "submission_id_v1": "s349314776", "cpu_time_v0": 179, "cpu_time_v1": 88, "memory_v0": 9072, "memory_v1": 63520, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.84, "input": "k = int(input())\n\nnum = 0\n\nif not k%2:\n\n print((-1))\n\nelse:\n\n for i in range(k):\n\n num = (num*10+7)%k\n\n if num == 0:\n\n print((i+1))\n\n break\n\n else:\n\n print((-1))", "target": "K = int(input())\n\n\n\nans = 1\n\nnum = 0\n\nseven = 7\n\n\n\nif not K%2:\n\n print((-1))\n\nelse:\n\n for i in range(K):\n\n num = num + seven\n\n seven = seven*10%K\n\n num = num%K\n\n if num == 0:\n\n print(ans)\n\n break\n\n ans += 1\n\n else:\n\n print((-1))", "code_v0_loc": 12, "code_v1_loc": 19, "code_v0_num_chars": 207, "code_v1_num_chars": 297, "code_v0_no_empty_lines": "k = int(input())\nnum = 0\nif not k % 2:\n print((-1))\nelse:\n for i in range(k):\n num = (num * 10 + 7) % k\n if num == 0:\n print((i + 1))\n break\n else:\n print((-1))\n", "code_v1_no_empty_lines": "K = int(input())\nans = 1\nnum = 0\nseven = 7\nif not K % 2:\n print((-1))\nelse:\n for i in range(K):\n num = num + seven\n seven = seven * 10 % K\n num = num % K\n if num == 0:\n print(ans)\n break\n ans += 1\n else:\n print((-1))\n", "code_same": false, "relative_loc_diff_percent": 36.8421052632, "diff": ["-k = int(input())", "+K = int(input())", "+ans = 1", "-if not k % 2:", "+seven = 7", "+if not K % 2:", "- for i in range(k):", "- num = (num * 10 + 7) % k", "+ for i in range(K):", "+ num = num + seven", "+ seven = seven * 10 % K", "+ num = num % K", "- print((i + 1))", "+ print(ans)", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.513984643, "measured_runtime_v1": 0.3340408325, "runtime_lift": 1.5386880672, "key": ["s777833838", "s349314776"], "target_token_count_dream": 93, "target_token_bucket_dream": "<128"} +{"user_id": "u444560129", "problem_id": "p02596", "language": "python", "submission_id_v0": "s838540391", "submission_id_v1": "s786083962", "cpu_time_v0": 192, "cpu_time_v1": 156, "memory_v0": 9088, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.75, "input": "k = int(input())\n\ncount = 1\n\nn = 0\n\nif k % 2 == 0 or k % 5 == 0:\n\n print((-1))\n\nelse:\n\n while 1:\n\n n = (n * 10 + 7) % k \n\n if n == 0:\n\n break \n\n count += 1\n\n print(count)", "target": "def main(h):\n\n count = 1\n\n n = 0\n\n for i in range (k):\n\n n = (n * 10 + 7) % k \n\n if n == 0: \n\n print(count)\n\n return 0\n\n count += 1\n\n print((-1))\n\n \n\nif __name__ == '__main__':\n\n k = int(input())\n\n main(k)", "code_v0_loc": 12, "code_v1_loc": 14, "code_v0_num_chars": 196, "code_v1_num_chars": 230, "code_v0_no_empty_lines": "k = int(input())\ncount = 1\nn = 0\nif k % 2 == 0 or k % 5 == 0:\n print((-1))\nelse:\n while 1:\n n = (n * 10 + 7) % k\n if n == 0:\n break\n count += 1\n print(count)\n", "code_v1_no_empty_lines": "def main(h):\n count = 1\n n = 0\n for i in range(k):\n n = (n * 10 + 7) % k\n if n == 0:\n print(count)\n return 0\n count += 1\n print((-1))\n\n\nif __name__ == \"__main__\":\n k = int(input())\n main(k)\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-k = int(input())", "-count = 1", "-n = 0", "-if k % 2 == 0 or k % 5 == 0:", "- print((-1))", "-else:", "- while 1:", "+def main(h):", "+ count = 1", "+ n = 0", "+ for i in range(k):", "- break", "+ print(count)", "+ return 0", "- print(count)", "+ print((-1))", "+", "+", "+if __name__ == \"__main__\":", "+ k = int(input())", "+ main(k)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.359774395, "measured_runtime_v1": 0.0061541715, "runtime_lift": 58.4602486856, "key": ["s838540391", "s786083962"], "target_token_count_dream": 88, "target_token_bucket_dream": "<128"} +{"user_id": "u089376182", "problem_id": "p03250", "language": "python", "submission_id_v0": "s131709017", "submission_id_v1": "s244884559", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "a, b, c = sorted(map(int, input().split()))\n\n\n\nprint((c*10 + b + a))", "target": "a, b, c = list(map(int, input().split()))\n\n\n\nprint((max(a, b, c)*9 + (a + b + c)))", "code_v0_loc": 3, "code_v1_loc": 3, "code_v0_num_chars": 66, "code_v1_num_chars": 74, "code_v0_no_empty_lines": "a, b, c = sorted(map(int, input().split()))\nprint((c * 10 + b + a))\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nprint((max(a, b, c) * 9 + (a + b + c)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-a, b, c = sorted(map(int, input().split()))", "-print((c * 10 + b + a))", "+a, b, c = list(map(int, input().split()))", "+print((max(a, b, c) * 9 + (a + b + c)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2633334219, "measured_runtime_v1": 0.0501041813, "runtime_lift": 5.2557174893, "key": ["s131709017", "s244884559"], "target_token_count_dream": 33, "target_token_bucket_dream": "<128"} +{"user_id": "u813098295", "problem_id": "p03371", "language": "python", "submission_id_v0": "s229566237", "submission_id_v1": "s072536815", "cpu_time_v0": 222, "cpu_time_v1": 129, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 41.89, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(200005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)", "target": "a, b, c, x, y = list(map(int, input().split()))\n\nans = float('inf')\n\n\n\nfor i in range(100005):\n\n tmp = i * 2 * c\n\n tmp += max(0, x-i) * a\n\n tmp += max(0, y-i) * b\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 204, "code_v1_num_chars": 204, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(200005):\n tmp = i * 2 * c\n tmp += max(0, x - i) * a\n tmp += max(0, y - i) * b\n ans = min(ans, tmp)\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(100005):\n tmp = i * 2 * c\n tmp += max(0, x - i) * a\n tmp += max(0, y - i) * b\n ans = min(ans, tmp)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-for i in range(200005):", "+for i in range(100005):"], "diff_only_import_comment": false, "measured_runtime_v0": 2.0992211397, "measured_runtime_v1": 1.3130319312, "runtime_lift": 1.5987586363, "key": ["s229566237", "s072536815"], "target_token_count_dream": 83, "target_token_bucket_dream": "<128"} +{"user_id": "u576434377", "problem_id": "p03568", "language": "python", "submission_id_v0": "s245503579", "submission_id_v1": "s305475228", "cpu_time_v0": 101, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.17, "input": "N = int(input())\n\nAs = list(map(int,input().split()))\n\n\n\n\n\ndef dfs(A_s, index,Bss):\n\n if index == N:\n\n tmp = 1\n\n for b in Bss:\n\n tmp *= b\n\n return 1 if tmp % 2 == 0 else 0\n\n b_mi = Bss.copy()\n\n b_mi.append(A_s[index] - 1)\n\n\n\n b = Bss.copy()\n\n b.append(A_s[index])\n\n\n\n b_pl = Bss.copy()\n\n b_pl.append(A_s[index] + 1)\n\n return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)\n\n\n\n\n\nprint((dfs(As,0,[])))\n", "target": "N = int(input())\n\nAs = list(map(int,input().split()))\n\n\n\ntmp = 1\n\nfor i in range(N):\n\n if As[i] % 2 == 0:\n\n tmp *= 2\n\n\n\nprint((3 ** N - tmp))", "code_v0_loc": 22, "code_v1_loc": 9, "code_v0_num_chars": 480, "code_v1_num_chars": 148, "code_v0_no_empty_lines": "N = int(input())\nAs = list(map(int, input().split()))\n\n\ndef dfs(A_s, index, Bss):\n if index == N:\n tmp = 1\n for b in Bss:\n tmp *= b\n return 1 if tmp % 2 == 0 else 0\n b_mi = Bss.copy()\n b_mi.append(A_s[index] - 1)\n b = Bss.copy()\n b.append(A_s[index])\n b_pl = Bss.copy()\n b_pl.append(A_s[index] + 1)\n return (\n dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)\n )\n\n\nprint((dfs(As, 0, [])))\n", "code_v1_no_empty_lines": "N = int(input())\nAs = list(map(int, input().split()))\ntmp = 1\nfor i in range(N):\n if As[i] % 2 == 0:\n tmp *= 2\nprint((3**N - tmp))\n", "code_same": false, "relative_loc_diff_percent": 59.0909090909, "diff": ["-", "-", "-def dfs(A_s, index, Bss):", "- if index == N:", "- tmp = 1", "- for b in Bss:", "- tmp *= b", "- return 1 if tmp % 2 == 0 else 0", "- b_mi = Bss.copy()", "- b_mi.append(A_s[index] - 1)", "- b = Bss.copy()", "- b.append(A_s[index])", "- b_pl = Bss.copy()", "- b_pl.append(A_s[index] + 1)", "- return (", "- dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)", "- )", "-", "-", "-print((dfs(As, 0, [])))", "+tmp = 1", "+for i in range(N):", "+ if As[i] % 2 == 0:", "+ tmp *= 2", "+print((3**N - tmp))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4574659042, "measured_runtime_v1": 0.2742938831, "runtime_lift": 1.6677947721, "key": ["s245503579", "s305475228"], "target_token_count_dream": 52, "target_token_bucket_dream": "<128"} +{"user_id": "u414877092", "problem_id": "p03796", "language": "python", "submission_id_v0": "s477602976", "submission_id_v1": "s500304823", "cpu_time_v0": 230, "cpu_time_v1": 31, "memory_v0": 4024, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 86.52, "input": "import math\n\nn=int(input())\n\nprint((math.factorial(n)%(10**9+7)))", "target": "N=int(input())\n\ndef fact(n):\n\n val=1\n\n for i in range(2,n+1):\n\n val*=i\n\n val%=1000000007\n\n return val\n\nprint((fact(N)))", "code_v0_loc": 3, "code_v1_loc": 8, "code_v0_num_chars": 63, "code_v1_num_chars": 140, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint((math.factorial(n) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "N = int(input())\n\n\ndef fact(n):\n val = 1\n for i in range(2, n + 1):\n val *= i\n val %= 1000000007\n return val\n\n\nprint((fact(N)))\n", "code_same": false, "relative_loc_diff_percent": 62.5, "diff": ["-import math", "+N = int(input())", "-n = int(input())", "-print((math.factorial(n) % (10**9 + 7)))", "+", "+def fact(n):", "+ val = 1", "+ for i in range(2, n + 1):", "+ val *= i", "+ val %= 1000000007", "+ return val", "+", "+", "+print((fact(N)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5394072673, "measured_runtime_v1": 0.259771318, "runtime_lift": 2.0764696871, "key": ["s477602976", "s500304823"], "target_token_count_dream": 52, "target_token_bucket_dream": "<128"} +{"user_id": "u893063840", "problem_id": "p03801", "language": "python", "submission_id_v0": "s790222372", "submission_id_v1": "s964537161", "cpu_time_v0": 316, "cpu_time_v1": 278, "memory_v0": 40396, "memory_v1": 31800, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.03, "input": "n = int(input())\n\na = list(map(int, input().split()))\n\n\n\ntmp = [[e, n - i] for i, e in enumerate(a)]\n\ntmp.sort(reverse=True)\n\n\n\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\n\n\n\nv_prev, i_prev = aa[0]\n\ni = 0\n\nans = [0] * n\n\nsm = 0\n\nwhile i < n:\n\n while aa[i][1] >= i_prev:\n\n sm += aa[i][0]\n\n i += 1\n\n\n\n ans[i_prev] += sm - aa[i][0] * i\n\n sm = aa[i][0] * i\n\n v_prev, i_prev = aa[i]\n\n\n\nprint(*ans, sep=\"\\n\")\n", "target": "from bisect import bisect_right\n\n\n\nn = int(input())\n\na = list(map(int, input().split()))\n\n\n\nli = [[0, -1]]\n\nfor i, e in enumerate(a):\n\n if e > li[-1][0]:\n\n li.append([e, i])\n\n\n\nli = li[::-1]\n\n\n\na.sort()\n\nacc = [0] * (n + 1)\n\nfor i in range(n - 1, -1, -1):\n\n acc[i] = acc[i+1] + a[i]\n\n\n\nans = [0] * n\n\nsub = 0\n\nans_prev = 0\n\nfor (ep, ip), (e, i) in zip(li, li[1:]):\n\n j = bisect_right(a, e)\n\n ans[ip] = acc[j] - e * (n - j)\n\n\n\ni_prev = 0\n\nfor i in range(1, n):\n\n if ans[i]:\n\n ans[i_prev] -= ans[i]\n\n i_prev = i\n\n\n\nprint(*ans, sep=\"\\n\")\n", "code_v0_loc": 22, "code_v1_loc": 31, "code_v0_num_chars": 431, "code_v1_num_chars": 571, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\ntmp = [[e, n - i] for i, e in enumerate(a)]\ntmp.sort(reverse=True)\naa = [[e, n - i] for e, i in tmp] + [[0, -1]]\nv_prev, i_prev = aa[0]\ni = 0\nans = [0] * n\nsm = 0\nwhile i < n:\n while aa[i][1] >= i_prev:\n sm += aa[i][0]\n i += 1\n ans[i_prev] += sm - aa[i][0] * i\n sm = aa[i][0] * i\n v_prev, i_prev = aa[i]\nprint(*ans, sep=\"\\n\")\n", "code_v1_no_empty_lines": "from bisect import bisect_right\n\nn = int(input())\na = list(map(int, input().split()))\nli = [[0, -1]]\nfor i, e in enumerate(a):\n if e > li[-1][0]:\n li.append([e, i])\nli = li[::-1]\na.sort()\nacc = [0] * (n + 1)\nfor i in range(n - 1, -1, -1):\n acc[i] = acc[i + 1] + a[i]\nans = [0] * n\nsub = 0\nans_prev = 0\nfor (ep, ip), (e, i) in zip(li, li[1:]):\n j = bisect_right(a, e)\n ans[ip] = acc[j] - e * (n - j)\ni_prev = 0\nfor i in range(1, n):\n if ans[i]:\n ans[i_prev] -= ans[i]\n i_prev = i\nprint(*ans, sep=\"\\n\")\n", "code_same": false, "relative_loc_diff_percent": 29.0322580645, "diff": ["+from bisect import bisect_right", "+", "-tmp = [[e, n - i] for i, e in enumerate(a)]", "-tmp.sort(reverse=True)", "-aa = [[e, n - i] for e, i in tmp] + [[0, -1]]", "-v_prev, i_prev = aa[0]", "-i = 0", "+li = [[0, -1]]", "+for i, e in enumerate(a):", "+ if e > li[-1][0]:", "+ li.append([e, i])", "+li = li[::-1]", "+a.sort()", "+acc = [0] * (n + 1)", "+for i in range(n - 1, -1, -1):", "+ acc[i] = acc[i + 1] + a[i]", "-sm = 0", "-while i < n:", "- while aa[i][1] >= i_prev:", "- sm += aa[i][0]", "- i += 1", "- ans[i_prev] += sm - aa[i][0] * i", "- sm = aa[i][0] * i", "- v_prev, i_prev = aa[i]", "+sub = 0", "+ans_prev = 0", "+for (ep, ip), (e, i) in zip(li, li[1:]):", "+ j = bisect_right(a, e)", "+ ans[ip] = acc[j] - e * (n - j)", "+i_prev = 0", "+for i in range(1, n):", "+ if ans[i]:", "+ ans[i_prev] -= ans[i]", "+ i_prev = i"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2510323788, "measured_runtime_v1": 0.1409289612, "runtime_lift": 1.7812689216, "key": ["s790222372", "s964537161"], "target_token_count_dream": 217, "target_token_bucket_dream": "128-256"} +{"user_id": "u970197315", "problem_id": "p03013", "language": "python", "submission_id_v0": "s479618893", "submission_id_v1": "s899240371", "cpu_time_v0": 212, "cpu_time_v1": 187, "memory_v0": 9612, "memory_v1": 7848, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.79, "input": "N, M = list(map(int, input().split()))\n\nA_ = [int(input()) for _ in range(M)]\n\nA = [0] * (N+3)\n\nfor a in A_:\n\n A[a] = 1\n\ndp = [0] * (N+3)\n\ndp[0] = 1\n\n\n\nmod = 10**9+7\n\n\n\nfor i in range(1, N+1):\n\n if A[i-1] == 0:\n\n dp[i] += dp[i-1]\n\n if A[i-2] == 0:\n\n dp[i] += dp[i-2]\n\n dp[i] %= mod\n\nprint((dp[N]))", "target": "n,m=list(map(int,input().split()))\n\ndp=[0]*(n+3)\n\na=[int(input()) for i in range(m)]\n\nmod=10**9+7\n\nfor i in range(m):\n\n dp[a[i]]=-1\n\n\n\ndp[0]=1\n\nif dp[1]!=-1:\n\n dp[1]+=dp[0]\n\n\n\nfor i in range(n+1):\n\n if dp[i+2]==-1:\n\n continue\n\n if dp[i]!=-1:\n\n dp[i+2]+=dp[i]\n\n if dp[i+1]!=-1:\n\n dp[i+2]+=dp[i+1]\n\n dp[i+2]%=mod\n\nprint((dp[n]%mod))", "code_v0_loc": 17, "code_v1_loc": 20, "code_v0_num_chars": 315, "code_v1_num_chars": 361, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nA_ = [int(input()) for _ in range(M)]\nA = [0] * (N + 3)\nfor a in A_:\n A[a] = 1\ndp = [0] * (N + 3)\ndp[0] = 1\nmod = 10**9 + 7\nfor i in range(1, N + 1):\n if A[i - 1] == 0:\n dp[i] += dp[i - 1]\n if A[i - 2] == 0:\n dp[i] += dp[i - 2]\n dp[i] %= mod\nprint((dp[N]))\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\ndp = [0] * (n + 3)\na = [int(input()) for i in range(m)]\nmod = 10**9 + 7\nfor i in range(m):\n dp[a[i]] = -1\ndp[0] = 1\nif dp[1] != -1:\n dp[1] += dp[0]\nfor i in range(n + 1):\n if dp[i + 2] == -1:\n continue\n if dp[i] != -1:\n dp[i + 2] += dp[i]\n if dp[i + 1] != -1:\n dp[i + 2] += dp[i + 1]\n dp[i + 2] %= mod\nprint((dp[n] % mod))\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["-N, M = list(map(int, input().split()))", "-A_ = [int(input()) for _ in range(M)]", "-A = [0] * (N + 3)", "-for a in A_:", "- A[a] = 1", "-dp = [0] * (N + 3)", "+n, m = list(map(int, input().split()))", "+dp = [0] * (n + 3)", "+a = [int(input()) for i in range(m)]", "+mod = 10**9 + 7", "+for i in range(m):", "+ dp[a[i]] = -1", "-mod = 10**9 + 7", "-for i in range(1, N + 1):", "- if A[i - 1] == 0:", "- dp[i] += dp[i - 1]", "- if A[i - 2] == 0:", "- dp[i] += dp[i - 2]", "- dp[i] %= mod", "-print((dp[N]))", "+if dp[1] != -1:", "+ dp[1] += dp[0]", "+for i in range(n + 1):", "+ if dp[i + 2] == -1:", "+ continue", "+ if dp[i] != -1:", "+ dp[i + 2] += dp[i]", "+ if dp[i + 1] != -1:", "+ dp[i + 2] += dp[i + 1]", "+ dp[i + 2] %= mod", "+print((dp[n] % mod))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2706730585, "measured_runtime_v1": 0.2065423949, "runtime_lift": 1.3104963688, "key": ["s479618893", "s899240371"], "target_token_count_dream": 149, "target_token_bucket_dream": "128-256"} +{"user_id": "u573754721", "problem_id": "p02792", "language": "python", "submission_id_v0": "s001079757", "submission_id_v1": "s791261959", "cpu_time_v0": 461, "cpu_time_v1": 326, "memory_v0": 40684, "memory_v1": 40428, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.28, "input": "n=int(input())\n\nD={}\n\nDD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n t=(str(i)[-1],str(i)[0])\n\n if s not in D:\n\n D[s]=1\n\n else:\n\n D[s]+=1\n\n if t not in DD:\n\n DD[t]=1\n\n else:\n\n DD[t]+=1\n\nans=0\n\nfor i in D:\n\n if i in DD:\n\n ans+=D[i]*DD[i]\n\nprint(ans)\n\n ", "target": "n=int(input())\n\nD={}\n\nfor i in range(1,n+1):\n\n s=(str(i)[0],str(i)[-1])\n\n if s in D:\n\n D[s]+=1\n\n else:\n\n D[s]=1\n\n\n\nans=0\n\nfor aj,bj in D:\n\n if (bj,aj) in D:\n\n ans+=D[(aj,bj)]*D[(bj,aj)]\n\nprint(ans)", "code_v0_loc": 20, "code_v1_loc": 14, "code_v0_num_chars": 307, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "n = int(input())\nD = {}\nDD = {}\nfor i in range(1, n + 1):\n s = (str(i)[0], str(i)[-1])\n t = (str(i)[-1], str(i)[0])\n if s not in D:\n D[s] = 1\n else:\n D[s] += 1\n if t not in DD:\n DD[t] = 1\n else:\n DD[t] += 1\nans = 0\nfor i in D:\n if i in DD:\n ans += D[i] * DD[i]\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nD = {}\nfor i in range(1, n + 1):\n s = (str(i)[0], str(i)[-1])\n if s in D:\n D[s] += 1\n else:\n D[s] = 1\nans = 0\nfor aj, bj in D:\n if (bj, aj) in D:\n ans += D[(aj, bj)] * D[(bj, aj)]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-DD = {}", "- t = (str(i)[-1], str(i)[0])", "- if s not in D:", "+ if s in D:", "+ D[s] += 1", "+ else:", "- else:", "- D[s] += 1", "- if t not in DD:", "- DD[t] = 1", "- else:", "- DD[t] += 1", "-for i in D:", "- if i in DD:", "- ans += D[i] * DD[i]", "+for aj, bj in D:", "+ if (bj, aj) in D:", "+ ans += D[(aj, bj)] * D[(bj, aj)]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4521915812, "measured_runtime_v1": 0.3498246684, "runtime_lift": 1.2926234825, "key": ["s001079757", "s791261959"], "target_token_count_dream": 91, "target_token_bucket_dream": "<128"} +{"user_id": "u486297080", "problem_id": "p03796", "language": "python", "submission_id_v0": "s015826115", "submission_id_v1": "s256698183", "cpu_time_v0": 231, "cpu_time_v1": 37, "memory_v0": 4020, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.98, "input": "import math\n\n\n\nN = int(input())\n\nans = 0\n\n\n\nans =math.factorial(N) % (10**9 +7)\n\n\n\nprint(ans)", "target": "N = int(input())\n\npower = 1\n\n\n\nfor i in range(N):\n\n power = ((i+1) * power) % 1000000007\n\n\n\nprint(power)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 93, "code_v1_num_chars": 107, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = 0\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\npower = 1\nfor i in range(N):\n power = ((i + 1) * power) % 1000000007\nprint(power)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-import math", "-", "-ans = 0", "-ans = math.factorial(N) % (10**9 + 7)", "-print(ans)", "+power = 1", "+for i in range(N):", "+ power = ((i + 1) * power) % 1000000007", "+print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5450858786, "measured_runtime_v1": 0.2547745125, "runtime_lift": 2.1394835503, "key": ["s015826115", "s256698183"], "target_token_count_dream": 43, "target_token_bucket_dream": "<128"} +{"user_id": "u023958502", "problem_id": "p03078", "language": "python", "submission_id_v0": "s928848207", "submission_id_v1": "s406476908", "cpu_time_v0": 1927, "cpu_time_v1": 827, "memory_v0": 4720, "memory_v1": 4592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.08, "input": "X,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nalready = [[0,0,0]]\n\nx,y,z = 0,0,0\n\nplace_sum = []\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n place_sum.append([x + 1,y,z])\n\n check.append(asort[x + 1] + bsort[y] + csort[z])\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n place_sum.append([x,y + 1,z])\n\n check.append(asort[x] + bsort[y + 1] + csort[z])\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n place_sum.append([x,y,z + 1])\n\n check.append(asort[x] + bsort[y] + csort[z + 1])\n\n print((max(check)))\n\n x,y,z = place_sum[check.index(max(check))][0],place_sum[check.index(max(check))][1],place_sum[check.index(max(check))][2]\n\n place_sum.pop(check.index(max(check)))\n\n check.remove(max(check))", "target": "import heapq\n\nX,Y,Z,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\nasort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)\n\nalready = [[0,0,0]]\n\nprint((asort[0] + bsort[0] + csort[0]))\n\nx,y,z = 0,0,0\n\ncheck = []\n\nfor k in range(K - 1):\n\n if [x + 1,y,z] not in already and x + 1 < X:\n\n already.append([x + 1,y,z])\n\n heapq.heappush(check,(-(asort[x + 1] + bsort[y] + csort[z]),x + 1,y,z))\n\n if [x,y + 1,z] not in already and y + 1 < Y:\n\n already.append([x,y + 1,z])\n\n heapq.heappush(check,(-(asort[x] + bsort[y + 1] + csort[z]),x,y + 1,z))\n\n if [x,y,z + 1] not in already and z + 1 < Z:\n\n already.append([x,y,z + 1])\n\n heapq.heappush(check,(-(asort[x] + bsort[y] + csort[z + 1]),x,y,z + 1))\n\n maxsum = heapq.heappop(check)\n\n print((-maxsum[0]))\n\n x,y,z = maxsum[1],maxsum[2],maxsum[3]", "code_v0_loc": 27, "code_v1_loc": 23, "code_v0_num_chars": 1135, "code_v1_num_chars": 962, "code_v0_no_empty_lines": "X, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nasort, bsort, csort = (\n sorted(A, reverse=True),\n sorted(B, reverse=True),\n sorted(C, reverse=True),\n)\nprint((asort[0] + bsort[0] + csort[0]))\nalready = [[0, 0, 0]]\nx, y, z = 0, 0, 0\nplace_sum = []\ncheck = []\nfor k in range(K - 1):\n if [x + 1, y, z] not in already and x + 1 < X:\n already.append([x + 1, y, z])\n place_sum.append([x + 1, y, z])\n check.append(asort[x + 1] + bsort[y] + csort[z])\n if [x, y + 1, z] not in already and y + 1 < Y:\n already.append([x, y + 1, z])\n place_sum.append([x, y + 1, z])\n check.append(asort[x] + bsort[y + 1] + csort[z])\n if [x, y, z + 1] not in already and z + 1 < Z:\n already.append([x, y, z + 1])\n place_sum.append([x, y, z + 1])\n check.append(asort[x] + bsort[y] + csort[z + 1])\n print((max(check)))\n x, y, z = (\n place_sum[check.index(max(check))][0],\n place_sum[check.index(max(check))][1],\n place_sum[check.index(max(check))][2],\n )\n place_sum.pop(check.index(max(check)))\n check.remove(max(check))\n", "code_v1_no_empty_lines": "import heapq\n\nX, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nasort, bsort, csort = (\n sorted(A, reverse=True),\n sorted(B, reverse=True),\n sorted(C, reverse=True),\n)\nalready = [[0, 0, 0]]\nprint((asort[0] + bsort[0] + csort[0]))\nx, y, z = 0, 0, 0\ncheck = []\nfor k in range(K - 1):\n if [x + 1, y, z] not in already and x + 1 < X:\n already.append([x + 1, y, z])\n heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))\n if [x, y + 1, z] not in already and y + 1 < Y:\n already.append([x, y + 1, z])\n heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))\n if [x, y, z + 1] not in already and z + 1 < Z:\n already.append([x, y, z + 1])\n heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))\n maxsum = heapq.heappop(check)\n print((-maxsum[0]))\n x, y, z = maxsum[1], maxsum[2], maxsum[3]\n", "code_same": false, "relative_loc_diff_percent": 14.8148148148, "diff": ["+import heapq", "+", "+already = [[0, 0, 0]]", "-already = [[0, 0, 0]]", "-place_sum = []", "- place_sum.append([x + 1, y, z])", "- check.append(asort[x + 1] + bsort[y] + csort[z])", "+ heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))", "- place_sum.append([x, y + 1, z])", "- check.append(asort[x] + bsort[y + 1] + csort[z])", "+ heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))", "- place_sum.append([x, y, z + 1])", "- check.append(asort[x] + bsort[y] + csort[z + 1])", "- print((max(check)))", "- x, y, z = (", "- place_sum[check.index(max(check))][0],", "- place_sum[check.index(max(check))][1],", "- place_sum[check.index(max(check))][2],", "- )", "- place_sum.pop(check.index(max(check)))", "- check.remove(max(check))", "+ heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))", "+ maxsum = heapq.heappop(check)", "+ print((-maxsum[0]))", "+ x, y, z = maxsum[1], maxsum[2], maxsum[3]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2974797392, "measured_runtime_v1": 0.2210724421, "runtime_lift": 1.3456210843, "key": ["s928848207", "s406476908"], "target_token_count_dream": 350, "target_token_bucket_dream": "256-512"} +{"user_id": "u969190727", "problem_id": "p03371", "language": "python", "submission_id_v0": "s944521020", "submission_id_v1": "s713825460", "cpu_time_v0": 121, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.95, "input": "a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nn=max(x,y)\n\nfor i in range(1,n+1):\n\n ans=min(ans,2*i*c+a*max(0,x-i)+b*max(0,y-i))\n\nprint(ans)\n\n\n\n\n", "target": "a,b,c,x,y=list(map(int,input().split()))\n\nans1=a*x+b*y\n\nans2=2*c*max(x,y)\n\nans3=2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y))\n\nprint((min(ans1,ans2,ans3)))", "code_v0_loc": 8, "code_v1_loc": 5, "code_v0_num_chars": 148, "code_v1_num_chars": 144, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nn = max(x, y)\nfor i in range(1, n + 1):\n ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans1 = a * x + b * y\nans2 = 2 * c * max(x, y)\nans3 = 2 * c * min(x, y) + a * (x - min(x, y)) + b * (y - min(x, y))\nprint((min(ans1, ans2, ans3)))\n", "code_same": false, "relative_loc_diff_percent": 37.5, "diff": ["-ans = a * x + b * y", "-n = max(x, y)", "-for i in range(1, n + 1):", "- ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - i))", "-print(ans)", "+ans1 = a * x + b * y", "+ans2 = 2 * c * max(x, y)", "+ans3 = 2 * c * min(x, y) + a * (x - min(x, y)) + b * (y - min(x, y))", "+print((min(ans1, ans2, ans3)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.247306282, "measured_runtime_v1": 0.1774894836, "runtime_lift": 1.3933573811, "key": ["s944521020", "s713825460"], "target_token_count_dream": 65, "target_token_bucket_dream": "<128"} +{"user_id": "u879870653", "problem_id": "p03325", "language": "python", "submission_id_v0": "s933212033", "submission_id_v1": "s130104970", "cpu_time_v0": 143, "cpu_time_v1": 121, "memory_v0": 4148, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.38, "input": "answer = 0\n\nN = int(input())\n\nA = list(map(int,input().split()))\n\nfor i in range(N) :\n\n while A[i] % 2 == 0 :\n\n A[i] = A[i] / 2\n\n answer += 1\n\nprint(answer)\n\n\n", "target": "N = int(input())\n\nL = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor i in range(N) :\n\n flag = 0\n\n while flag == 0 :\n\n if (L[i] % 2) == 0 :\n\n ans += 1\n\n L[i] = L[i]//2\n\n else :\n\n flag = 1\n\nprint(ans)\n", "code_v0_loc": 9, "code_v1_loc": 13, "code_v0_num_chars": 176, "code_v1_num_chars": 252, "code_v0_no_empty_lines": "answer = 0\nN = int(input())\nA = list(map(int, input().split()))\nfor i in range(N):\n while A[i] % 2 == 0:\n A[i] = A[i] / 2\n answer += 1\nprint(answer)\n", "code_v1_no_empty_lines": "N = int(input())\nL = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n flag = 0\n while flag == 0:\n if (L[i] % 2) == 0:\n ans += 1\n L[i] = L[i] // 2\n else:\n flag = 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 30.7692307692, "diff": ["-answer = 0", "-A = list(map(int, input().split()))", "+L = list(map(int, input().split()))", "+ans = 0", "- while A[i] % 2 == 0:", "- A[i] = A[i] / 2", "- answer += 1", "-print(answer)", "+ flag = 0", "+ while flag == 0:", "+ if (L[i] % 2) == 0:", "+ ans += 1", "+ L[i] = L[i] // 2", "+ else:", "+ flag = 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2890260706, "measured_runtime_v1": 0.1461268132, "runtime_lift": 1.9779126383, "key": ["s933212033", "s130104970"], "target_token_count_dream": 83, "target_token_bucket_dream": "<128"} +{"user_id": "u619458041", "problem_id": "p03034", "language": "python", "submission_id_v0": "s001695168", "submission_id_v1": "s404140535", "cpu_time_v0": 1002, "cpu_time_v1": 783, "memory_v0": 17360, "memory_v1": 14388, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.86, "input": "import sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n for C in range(1, N//2):\n\n n = N // C\n\n point = 0\n\n used = set([0])\n\n for k in range(1, n):\n\n A = N - 1 - k*C\n\n\n\n if A in used or k*C in used or A == k*C:\n\n break\n\n used.add(A)\n\n used.add(k*C)\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n", "target": "import sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n # C = A - B\n\n for C in range(1, N//2):\n\n n = (N-1) // C\n\n point = 0\n\n for k in range(1, n):\n\n A = N-1 - k*C\n\n\n\n # Check A and B are positive integer, and S_i is not used twice.\n\n #\n\n # B = A - C and B >= 0, so A must be over C (A > C).\n\n #\n\n # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1\n\n # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than\n\n # or equal kC, the A's value is already used by kC.\n\n if A < C or ((N-1) % C == 0 and A <= k*C):\n\n break\n\n\n\n point += S[A] + S[k*C]\n\n ans = max(ans, point)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n", "code_v0_loc": 28, "code_v1_loc": 33, "code_v0_num_chars": 563, "code_v1_num_chars": 905, "code_v0_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n S = list(map(int, input().split()))\n ans = 0\n for C in range(1, N // 2):\n n = N // C\n point = 0\n used = set([0])\n for k in range(1, n):\n A = N - 1 - k * C\n if A in used or k * C in used or A == k * C:\n break\n used.add(A)\n used.add(k * C)\n point += S[A] + S[k * C]\n ans = max(ans, point)\n return ans\n\n\nif __name__ == \"__main__\":\n print((main()))\n", "code_v1_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n S = list(map(int, input().split()))\n ans = 0\n # C = A - B\n for C in range(1, N // 2):\n n = (N - 1) // C\n point = 0\n for k in range(1, n):\n A = N - 1 - k * C\n # Check A and B are positive integer, and S_i is not used twice.\n #\n # B = A - C and B >= 0, so A must be over C (A > C).\n #\n # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1\n # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than\n # or equal kC, the A's value is already used by kC.\n if A < C or ((N - 1) % C == 0 and A <= k * C):\n break\n point += S[A] + S[k * C]\n ans = max(ans, point)\n return ans\n\n\nif __name__ == \"__main__\":\n print((main()))\n", "code_same": false, "relative_loc_diff_percent": 15.1515151515, "diff": ["+ # C = A - B", "- n = N // C", "+ n = (N - 1) // C", "- used = set([0])", "- if A in used or k * C in used or A == k * C:", "+ # Check A and B are positive integer, and S_i is not used twice.", "+ #", "+ # B = A - C and B >= 0, so A must be over C (A > C).", "+ #", "+ # If C is aliquot of N-1 (N-1 % C = 0), A is also aliquot of N-1", "+ # (N-1 % A = 0) because A + kC = N-1. Therefore when A is less than", "+ # or equal kC, the A's value is already used by kC.", "+ if A < C or ((N - 1) % C == 0 and A <= k * C):", "- used.add(A)", "- used.add(k * C)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3095349545, "measured_runtime_v1": 0.0814658375, "runtime_lift": 3.7995675745, "key": ["s001695168", "s404140535"], "target_token_count_dream": 280, "target_token_bucket_dream": "256-512"} +{"user_id": "u498487134", "problem_id": "p03038", "language": "python", "submission_id_v0": "s547925628", "submission_id_v1": "s764313725", "cpu_time_v0": 649, "cpu_time_v1": 471, "memory_v0": 68588, "memory_v1": 102672, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.43, "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(input())\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N,M=MI()\n\n A=LI()\n\n CB=[[0,0]for _ in range(M)]\n\n A.sort()\n\n for i in range(M):\n\n CB[i][1],CB[i][0]=MI()\n\n \n\n CB.sort(reverse=True)\n\n now=0\n\n \n\n for i in range(N):\n\n if CB[now][1]<=0:\n\n now+=1\n\n \n\n if now>=M:\n\n break \n\n \n\n ch=CB[now][0]\n\n if A[i]=c:\n\n heapq.heappush(A,a)\n\n break\n\n else:\n\n heapq.heappush(A,c)\n\n \n\n ans=0\n\n for i in range(N):\n\n a=heapq.heappop(A)\n\n ans+=a\n\n \n\n print(ans)\n\n\n\nmain()\n", "code_v0_loc": 37, "code_v1_loc": 42, "code_v0_num_chars": 685, "code_v1_num_chars": 804, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, M = MI()\n A = LI()\n CB = [[0, 0] for _ in range(M)]\n A.sort()\n for i in range(M):\n CB[i][1], CB[i][0] = MI()\n CB.sort(reverse=True)\n now = 0\n for i in range(N):\n if CB[now][1] <= 0:\n now += 1\n if now >= M:\n break\n ch = CB[now][0]\n if A[i] < ch:\n A[i] = ch\n CB[now][1] -= 1\n else:\n break\n print((sum(A)))\n\n\nmain()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, M = MI()\n A = LI()\n B = [0] * M\n C = [0] * M\n for i in range(M):\n B[i], C[i] = MI()\n C, B = list(zip(*sorted(zip(C, B))))\n B = B[::-1]\n C = C[::-1]\n import heapq\n\n heapq.heapify(A)\n for i in range(M):\n b = B[i]\n c = C[i]\n for _ in range(b):\n a = heapq.heappop(A)\n if a >= c:\n heapq.heappush(A, a)\n break\n else:\n heapq.heappush(A, c)\n ans = 0\n for i in range(N):\n a = heapq.heappop(A)\n ans += a\n print(ans)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 11.9047619048, "diff": ["- CB = [[0, 0] for _ in range(M)]", "- A.sort()", "+ B = [0] * M", "+ C = [0] * M", "- CB[i][1], CB[i][0] = MI()", "- CB.sort(reverse=True)", "- now = 0", "+ B[i], C[i] = MI()", "+ C, B = list(zip(*sorted(zip(C, B))))", "+ B = B[::-1]", "+ C = C[::-1]", "+ import heapq", "+", "+ heapq.heapify(A)", "+ for i in range(M):", "+ b = B[i]", "+ c = C[i]", "+ for _ in range(b):", "+ a = heapq.heappop(A)", "+ if a >= c:", "+ heapq.heappush(A, a)", "+ break", "+ else:", "+ heapq.heappush(A, c)", "+ ans = 0", "- if CB[now][1] <= 0:", "- now += 1", "- if now >= M:", "- break", "- ch = CB[now][0]", "- if A[i] < ch:", "- A[i] = ch", "- CB[now][1] -= 1", "- else:", "- break", "- print((sum(A)))", "+ a = heapq.heappop(A)", "+ ans += a", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2322117374, "measured_runtime_v1": 0.1336252203, "runtime_lift": 1.7377837571, "key": ["s547925628", "s764313725"], "target_token_count_dream": 228, "target_token_bucket_dream": "128-256"} +{"user_id": "u396211450", "problem_id": "p03828", "language": "python", "submission_id_v0": "s749493108", "submission_id_v1": "s831049300", "cpu_time_v0": 39, "cpu_time_v1": 31, "memory_v0": 9360, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.51, "input": "from math import factorial\n\n\n\nn = int(input())\n\nf = factorial(n)\n\n\n\nmod = 10 ** 9 + 7\n\n\n\ndef primes(n):\n\n is_prime = [True] * (n + 1)\n\n is_prime[0] = False\n\n is_prime[1] = False\n\n for i in range(2, int(n ** 0.5) + 1):\n\n if not is_prime[i]:\n\n continue\n\n for j in range(i * 2, n + 1, i):\n\n is_prime[j] = False\n\n return [i for i in range(n + 1) if is_prime[i]]\n\n\n\nans = 1\n\nfor p in primes(n):\n\n temp = 1\n\n while f % p == 0:\n\n temp += 1\n\n f //= p\n\n ans = (ans * temp) % mod\n\nprint(ans)\n", "target": "n=int(input())\n\nm=10**9+7\n\np=[1 for i in range(10000)]\n\np[0]=0\n\np[1]=0\n\nfor i in range(2,n+1):\n\n if p[i]==1:\n\n for j in range(i*i,n+1,i):\n\n p[j]=0\n\nans=1\n\nfor i in range(2,n+1):\n\n if p[i]:\n\n c=0\n\n k=i\n\n while n//k>0:\n\n c=c+(n//k)%m\n\n k=k*i\n\n ans=(ans*((c+1)%m))%m\n\nprint((ans%m))\n\n \n\n \n\n \n\n \n", "code_v0_loc": 26, "code_v1_loc": 23, "code_v0_num_chars": 556, "code_v1_num_chars": 340, "code_v0_no_empty_lines": "from math import factorial\n\nn = int(input())\nf = factorial(n)\nmod = 10**9 + 7\n\n\ndef primes(n):\n is_prime = [True] * (n + 1)\n is_prime[0] = False\n is_prime[1] = False\n for i in range(2, int(n**0.5) + 1):\n if not is_prime[i]:\n continue\n for j in range(i * 2, n + 1, i):\n is_prime[j] = False\n return [i for i in range(n + 1) if is_prime[i]]\n\n\nans = 1\nfor p in primes(n):\n temp = 1\n while f % p == 0:\n temp += 1\n f //= p\n ans = (ans * temp) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nm = 10**9 + 7\np = [1 for i in range(10000)]\np[0] = 0\np[1] = 0\nfor i in range(2, n + 1):\n if p[i] == 1:\n for j in range(i * i, n + 1, i):\n p[j] = 0\nans = 1\nfor i in range(2, n + 1):\n if p[i]:\n c = 0\n k = i\n while n // k > 0:\n c = c + (n // k) % m\n k = k * i\n ans = (ans * ((c + 1) % m)) % m\nprint((ans % m))\n", "code_same": false, "relative_loc_diff_percent": 11.5384615385, "diff": ["-from math import factorial", "-", "-f = factorial(n)", "-mod = 10**9 + 7", "-", "-", "-def primes(n):", "- is_prime = [True] * (n + 1)", "- is_prime[0] = False", "- is_prime[1] = False", "- for i in range(2, int(n**0.5) + 1):", "- if not is_prime[i]:", "- continue", "- for j in range(i * 2, n + 1, i):", "- is_prime[j] = False", "- return [i for i in range(n + 1) if is_prime[i]]", "-", "-", "+m = 10**9 + 7", "+p = [1 for i in range(10000)]", "+p[0] = 0", "+p[1] = 0", "+for i in range(2, n + 1):", "+ if p[i] == 1:", "+ for j in range(i * i, n + 1, i):", "+ p[j] = 0", "-for p in primes(n):", "- temp = 1", "- while f % p == 0:", "- temp += 1", "- f //= p", "- ans = (ans * temp) % mod", "-print(ans)", "+for i in range(2, n + 1):", "+ if p[i]:", "+ c = 0", "+ k = i", "+ while n // k > 0:", "+ c = c + (n // k) % m", "+ k = k * i", "+ ans = (ans * ((c + 1) % m)) % m", "+print((ans % m))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2370509479, "measured_runtime_v1": 0.0064624088, "runtime_lift": 36.6815154487, "key": ["s749493108", "s831049300"], "target_token_count_dream": 148, "target_token_bucket_dream": "128-256"} +{"user_id": "u670180528", "problem_id": "p02937", "language": "python", "submission_id_v0": "s126195271", "submission_id_v1": "s641311638", "cpu_time_v0": 161, "cpu_time_v1": 122, "memory_v0": 12200, "memory_v1": 12072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 24.22, "input": "from collections import defaultdict\n\nfrom bisect import bisect_left\n\n\n\ns = input()\n\nn = len(s)\n\ns = s + s\n\nt = input()\n\nif set(t) - set(s):\n\n\tprint((-1))\n\n\texit()\n\nd = defaultdict(list)\n\nfor i in range(2 * n):\n\n\td[s[i]] += [i]\n\ncur = tot = 0\n\nfor c in t:\n\n\tx = d[c][bisect_left(d[c], cur)]\n\n\tif x < n:\n\n\t\tcur = x + 1\n\n\telse:\n\n\t\tcur = x - n + 1\n\n\t\ttot += n\n\ntot += cur\n\nprint(tot)\n", "target": "from collections import defaultdict\n\nfrom bisect import bisect_left\n\n\n\n\n\ndef main():\n\n\ts = input()\n\n\tn = len(s)\n\n\ts = s + s\n\n\tt = input()\n\n\tif set(t) - set(s):\n\n\t\tprint((-1))\n\n\t\texit()\n\n\td = defaultdict(list)\n\n\tfor i in range(2 * n):\n\n\t\td[s[i]] += [i]\n\n\tcur = ncnt = 0\n\n\n\n\tfor c in t:\n\n\t\tx = d[c][bisect_left(d[c], cur)]\n\n\t\tif x < n:\n\n\t\t\tcur = x + 1\n\n\t\telse:\n\n\t\t\tcur = x - n + 1\n\n\t\t\tncnt += 1\n\n\tprint((ncnt*n + cur))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "code_v0_loc": 23, "code_v1_loc": 29, "code_v0_num_chars": 378, "code_v1_num_chars": 453, "code_v0_no_empty_lines": "from collections import defaultdict\nfrom bisect import bisect_left\n\ns = input()\nn = len(s)\ns = s + s\nt = input()\nif set(t) - set(s):\n print((-1))\n exit()\nd = defaultdict(list)\nfor i in range(2 * n):\n d[s[i]] += [i]\ncur = tot = 0\nfor c in t:\n x = d[c][bisect_left(d[c], cur)]\n if x < n:\n cur = x + 1\n else:\n cur = x - n + 1\n tot += n\ntot += cur\nprint(tot)\n", "code_v1_no_empty_lines": "from collections import defaultdict\nfrom bisect import bisect_left\n\n\ndef main():\n s = input()\n n = len(s)\n s = s + s\n t = input()\n if set(t) - set(s):\n print((-1))\n exit()\n d = defaultdict(list)\n for i in range(2 * n):\n d[s[i]] += [i]\n cur = ncnt = 0\n for c in t:\n x = d[c][bisect_left(d[c], cur)]\n if x < n:\n cur = x + 1\n else:\n cur = x - n + 1\n ncnt += 1\n print((ncnt * n + cur))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 20.6896551724, "diff": ["-s = input()", "-n = len(s)", "-s = s + s", "-t = input()", "-if set(t) - set(s):", "- print((-1))", "- exit()", "-d = defaultdict(list)", "-for i in range(2 * n):", "- d[s[i]] += [i]", "-cur = tot = 0", "-for c in t:", "- x = d[c][bisect_left(d[c], cur)]", "- if x < n:", "- cur = x + 1", "- else:", "- cur = x - n + 1", "- tot += n", "-tot += cur", "-print(tot)", "+", "+def main():", "+ s = input()", "+ n = len(s)", "+ s = s + s", "+ t = input()", "+ if set(t) - set(s):", "+ print((-1))", "+ exit()", "+ d = defaultdict(list)", "+ for i in range(2 * n):", "+ d[s[i]] += [i]", "+ cur = ncnt = 0", "+ for c in t:", "+ x = d[c][bisect_left(d[c], cur)]", "+ if x < n:", "+ cur = x + 1", "+ else:", "+ cur = x - n + 1", "+ ncnt += 1", "+ print((ncnt * n + cur))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2683695219, "measured_runtime_v1": 0.0063027716, "runtime_lift": 42.5796046267, "key": ["s126195271", "s641311638"], "target_token_count_dream": 156, "target_token_bucket_dream": "128-256"} +{"user_id": "u631277801", "problem_id": "p02996", "language": "python", "submission_id_v0": "s825135097", "submission_id_v1": "s901008925", "cpu_time_v0": 649, "cpu_time_v1": 495, "memory_v0": 54192, "memory_v1": 31936, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.73, "input": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\nab = [list(li()) for _ in range(n)]\n\n\n\nab.sort(key=lambda x: x[1])\n\n\n\ncur = 0\n\n\n\nans = True\n\n\n\nfor ai, bi in ab:\n\n cur += ai\n\n if cur > bi:\n\n ans = False\n\n\n\nprint((\"Yes\" if ans else \"No\"))", "target": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nn = ni()\n\nab = [tuple(li()) for _ in range(n)]\n\n\n\nab.sort(key=lambda x: x[1])\n\ncur = 0\n\nok = True\n\n\n\nfor ai, bi in ab:\n\n cur += ai\n\n if cur > bi:\n\n ok = False\n\n break\n\n\n\nprint((\"Yes\" if ok else \"No\"))\n", "code_v0_loc": 29, "code_v1_loc": 28, "code_v0_num_chars": 655, "code_v1_num_chars": 665, "code_v0_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nab = [list(li()) for _ in range(n)]\nab.sort(key=lambda x: x[1])\ncur = 0\nans = True\nfor ai, bi in ab:\n cur += ai\n if cur > bi:\n ans = False\nprint((\"Yes\" if ans else \"No\"))\n", "code_v1_no_empty_lines": "import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nn = ni()\nab = [tuple(li()) for _ in range(n)]\nab.sort(key=lambda x: x[1])\ncur = 0\nok = True\nfor ai, bi in ab:\n cur += ai\n if cur > bi:\n ok = False\n break\nprint((\"Yes\" if ok else \"No\"))\n", "code_same": false, "relative_loc_diff_percent": 3.4482758621, "diff": ["-ab = [list(li()) for _ in range(n)]", "+ab = [tuple(li()) for _ in range(n)]", "-ans = True", "+ok = True", "- ans = False", "-print((\"Yes\" if ans else \"No\"))", "+ ok = False", "+ break", "+print((\"Yes\" if ok else \"No\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2910801413, "measured_runtime_v1": 0.1842719517, "runtime_lift": 1.5796226102, "key": ["s825135097", "s901008925"], "target_token_count_dream": 180, "target_token_bucket_dream": "128-256"} +{"user_id": "u728498511", "problem_id": "p03416", "language": "python", "submission_id_v0": "s773095214", "submission_id_v1": "s841162290", "cpu_time_v0": 111, "cpu_time_v1": 67, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.64, "input": "n, m = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n, m+1):\n\n if str(i)[0]+str(i)[1] == str(i)[-1]+str(i)[-2]: ans += 1\n\nprint(ans)", "target": "a, b = list(map(int, input().split()))\n\nans = 0\n\nfor n in range(a, b+1):\n\n if str(n) == str(n)[::-1]: ans += 1\n\nprint(ans)", "code_v0_loc": 5, "code_v1_loc": 5, "code_v0_num_chars": 141, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\nans = 0\nfor i in range(n, m + 1):\n if str(i)[0] + str(i)[1] == str(i)[-1] + str(i)[-2]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nans = 0\nfor n in range(a, b + 1):\n if str(n) == str(n)[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-n, m = list(map(int, input().split()))", "+a, b = list(map(int, input().split()))", "-for i in range(n, m + 1):", "- if str(i)[0] + str(i)[1] == str(i)[-1] + str(i)[-2]:", "+for n in range(a, b + 1):", "+ if str(n) == str(n)[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6137721554, "measured_runtime_v1": 0.3378130706, "runtime_lift": 1.8168987785, "key": ["s773095214", "s841162290"], "target_token_count_dream": 47, "target_token_bucket_dream": "<128"} +{"user_id": "u498511622", "problem_id": "p00001", "language": "python", "submission_id_v0": "s534000808", "submission_id_v1": "s891056906", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7536, "memory_v1": 7656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "ans=[]\n\nfor i in range (0,10):\n\n ans.append(int(input()))\n\nans.sort(reverse=True)\n\nfor i in range (0,3):\n\n print((ans[i]))", "target": "mountain=[]\n\nfor s in range(0,10):\n\n mountain.append(int(input()))\n\nmountain.sort(reverse=True)\n\nfor s in range(0,3):\n\n print((mountain[s]))", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 126, "code_v1_num_chars": 141, "code_v0_no_empty_lines": "ans = []\nfor i in range(0, 10):\n ans.append(int(input()))\nans.sort(reverse=True)\nfor i in range(0, 3):\n print((ans[i]))\n", "code_v1_no_empty_lines": "mountain = []\nfor s in range(0, 10):\n mountain.append(int(input()))\nmountain.sort(reverse=True)\nfor s in range(0, 3):\n print((mountain[s]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-ans = []", "-for i in range(0, 10):", "- ans.append(int(input()))", "-ans.sort(reverse=True)", "-for i in range(0, 3):", "- print((ans[i]))", "+mountain = []", "+for s in range(0, 10):", "+ mountain.append(int(input()))", "+mountain.sort(reverse=True)", "+for s in range(0, 3):", "+ print((mountain[s]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3030959003, "measured_runtime_v1": 0.0643225815, "runtime_lift": 4.7121227575, "key": ["s534000808", "s891056906"], "target_token_count_dream": 41, "target_token_bucket_dream": "<128"} +{"user_id": "u530383736", "problem_id": "p02555", "language": "python", "submission_id_v0": "s720124366", "submission_id_v1": "s340965185", "cpu_time_v0": 275, "cpu_time_v1": 33, "memory_v0": 9116, "memory_v1": 9000, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 88.0, "input": "# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n cnt = 0\n\n\n\n for j in range(3, i+1):\n\n cnt += dp[i-j]\n\n cnt %= mod\n\n \n\n dp[i] = cnt\n\n\n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "# -*- coding: utf-8 -*-\n\nimport sys\n\n\n\n\n\ndef main():\n\n S = int( sys.stdin.readline() )\n\n\n\n dp = [0]*(S+1)\n\n dp[0] = 1\n\n mod = 10**9 + 7\n\n\n\n for i in range(3, S+1):\n\n dp[i] = dp[i-3] + dp[i-1]\n\n dp[i] %= mod\n\n \n\n\n\n print((dp[-1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 26, "code_v1_loc": 21, "code_v0_num_chars": 381, "code_v1_num_chars": 307, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\n\n\ndef main():\n S = int(sys.stdin.readline())\n dp = [0] * (S + 1)\n dp[0] = 1\n mod = 10**9 + 7\n for i in range(3, S + 1):\n cnt = 0\n for j in range(3, i + 1):\n cnt += dp[i - j]\n cnt %= mod\n dp[i] = cnt\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\n\n\ndef main():\n S = int(sys.stdin.readline())\n dp = [0] * (S + 1)\n dp[0] = 1\n mod = 10**9 + 7\n for i in range(3, S + 1):\n dp[i] = dp[i - 3] + dp[i - 1]\n dp[i] %= mod\n print((dp[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 19.2307692308, "diff": ["- cnt = 0", "- for j in range(3, i + 1):", "- cnt += dp[i - j]", "- cnt %= mod", "- dp[i] = cnt", "+ dp[i] = dp[i - 3] + dp[i - 1]", "+ dp[i] %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4620170944, "measured_runtime_v1": 0.1881556332, "runtime_lift": 2.4555049799, "key": ["s720124366", "s340965185"], "target_token_count_dream": 113, "target_token_bucket_dream": "<128"} +{"user_id": "u678167152", "problem_id": "p02785", "language": "python", "submission_id_v0": "s271865493", "submission_id_v1": "s007549888", "cpu_time_v0": 145, "cpu_time_v1": 112, "memory_v0": 104796, "memory_v1": 31552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 22.76, "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n if K>=N:\n\n return 0\n\n H.sort()\n\n ans = sum(H[:N-K])\n\n return ans\n\nprint((solve()))", "target": "def solve():\n\n N, K = list(map(int, input().split()))\n\n H = list(map(int, input().split()))\n\n H.sort()\n\n ans = sum(H[:max(N-K,0)])\n\n return ans\n\nprint((solve()))", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 177, "code_v1_num_chars": 158, "code_v0_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n H = list(map(int, input().split()))\n if K >= N:\n return 0\n H.sort()\n ans = sum(H[: N - K])\n return ans\n\n\nprint((solve()))\n", "code_v1_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n H = list(map(int, input().split()))\n H.sort()\n ans = sum(H[: max(N - K, 0)])\n return ans\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["- if K >= N:", "- return 0", "- ans = sum(H[: N - K])", "+ ans = sum(H[: max(N - K, 0)])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1896718335, "measured_runtime_v1": 0.0060620093, "runtime_lift": 31.2886079077, "key": ["s271865493", "s007549888"], "target_token_count_dream": 51, "target_token_bucket_dream": "<128"} +{"user_id": "u583507988", "problem_id": "p03835", "language": "python", "submission_id_v0": "s254920914", "submission_id_v1": "s788748142", "cpu_time_v0": 1001, "cpu_time_v1": 785, "memory_v0": 9104, "memory_v1": 9072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.58, "input": "k, s = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n if 0<=s-x-y<=k:\n\n ans += 1\n\n \n\nprint(ans)", "target": "k,s=list(map(int,input().split()))\n\nans=0\n\nfor i in range(k+1):\n\n num=s-i\n\n for j in range(min(num+1,k+1)):\n\n if 0<=num-j<=k:\n\n ans+=1\n\nprint(ans)", "code_v0_loc": 9, "code_v1_loc": 8, "code_v0_num_chars": 146, "code_v1_num_chars": 150, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor x in range(k + 1):\n for y in range(k + 1):\n if 0 <= s - x - y <= k:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nfor i in range(k + 1):\n num = s - i\n for j in range(min(num + 1, k + 1)):\n if 0 <= num - j <= k:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-for x in range(k + 1):", "- for y in range(k + 1):", "- if 0 <= s - x - y <= k:", "+for i in range(k + 1):", "+ num = s - i", "+ for j in range(min(num + 1, k + 1)):", "+ if 0 <= num - j <= k:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2276177601, "measured_runtime_v1": 0.0063076721, "runtime_lift": 36.0858579862, "key": ["s254920914", "s788748142"], "target_token_count_dream": 58, "target_token_bucket_dream": "<128"} +{"user_id": "u528470578", "problem_id": "p03680", "language": "python", "submission_id_v0": "s142356798", "submission_id_v1": "s532531190", "cpu_time_v0": 547, "cpu_time_v1": 248, "memory_v0": 7084, "memory_v1": 7084, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.66, "input": "import sys\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(1e6):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))", "target": "import sys\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nl = 1\n\np = a[0] - 1\n\n\n\nif a[0] == 2:\n\n print(l)\n\n sys.exit()\n\n\n\nwhile l < int(2e5):\n\n l += 1\n\n if a[p] == 2:\n\n print(l)\n\n break\n\n else:\n\n p = a[p] - 1\n\nelse:\n\n print((-1))", "code_v0_loc": 21, "code_v1_loc": 21, "code_v0_num_chars": 280, "code_v1_num_chars": 280, "code_v0_no_empty_lines": "import sys\n\nN = int(input())\na = [int(input()) for _ in range(N)]\nl = 1\np = a[0] - 1\nif a[0] == 2:\n print(l)\n sys.exit()\nwhile l < int(1e6):\n l += 1\n if a[p] == 2:\n print(l)\n break\n else:\n p = a[p] - 1\nelse:\n print((-1))\n", "code_v1_no_empty_lines": "import sys\n\nN = int(input())\na = [int(input()) for _ in range(N)]\nl = 1\np = a[0] - 1\nif a[0] == 2:\n print(l)\n sys.exit()\nwhile l < int(2e5):\n l += 1\n if a[p] == 2:\n print(l)\n break\n else:\n p = a[p] - 1\nelse:\n print((-1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-while l < int(1e6):", "+while l < int(2e5):"], "diff_only_import_comment": false, "measured_runtime_v0": 1.1321929171, "measured_runtime_v1": 0.4105077217, "runtime_lift": 2.7580307442, "key": ["s142356798", "s532531190"], "target_token_count_dream": 104, "target_token_bucket_dream": "<128"} +{"user_id": "u359358631", "problem_id": "p03796", "language": "python", "submission_id_v0": "s916466489", "submission_id_v1": "s520315696", "cpu_time_v0": 158, "cpu_time_v1": 44, "memory_v0": 10172, "memory_v1": 8932, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.15, "input": "import math\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n power = math.factorial(N)\n\n print((power % (10 ** 9 + 7)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "def main():\n\n N = int(input())\n\n power = 1\n\n for i in range(1, N + 1):\n\n power *= i\n\n power %= 10 ** 9 + 7\n\n print(power)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 160, "code_v1_num_chars": 192, "code_v0_no_empty_lines": "import math\n\n\ndef main():\n N = int(input())\n power = math.factorial(N)\n print((power % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n N = int(input())\n power = 1\n for i in range(1, N + 1):\n power *= i\n power %= 10**9 + 7\n print(power)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-import math", "-", "-", "- power = math.factorial(N)", "- print((power % (10**9 + 7)))", "+ power = 1", "+ for i in range(1, N + 1):", "+ power *= i", "+ power %= 10**9 + 7", "+ print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7842813587, "measured_runtime_v1": 0.3569579227, "runtime_lift": 2.1971255121, "key": ["s916466489", "s520315696"], "target_token_count_dream": 62, "target_token_bucket_dream": "<128"} +{"user_id": "u167751176", "problem_id": "p03078", "language": "python", "submission_id_v0": "s149883415", "submission_id_v1": "s931960732", "cpu_time_v0": 641, "cpu_time_v1": 91, "memory_v0": 97660, "memory_v1": 8708, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.8, "input": "def main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\td = [0]*x*y\n\n\tfor i in range(x):\n\n\t\tfor j in range(y):\n\n\t\t\td[i*y+j] = a[i]+b[j]\n\n\td.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\n\n\tc_len = min(k, z)\n\n\td_len = min(k, x*y)\n\n\te = [0]*d_len*c_len\n\n\tfor i in range(d_len):\n\n\t\tfor j in range(c_len):\n\n\t\t\te[i*c_len+j] = d[i] + c[j]\n\n\te.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((e[i]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "def main():\n\n\tx, y, z, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\tb = list(map(int, input().split()))\n\n\tc = list(map(int, input().split()))\n\n\n\n\tsolve(a, b, c, x, y, z, k)\n\n\n\ndef solve(a, b, c, x, y, z, k):\n\n\ta.sort(reverse=True)\n\n\tb.sort(reverse=True)\n\n\tc.sort(reverse=True)\n\n\tstack = list()\n\n\tfor p in range(x):\n\n\t\tfor q in range(y):\n\n\t\t\tif (p+1)*(q+1) > k:\n\n\t\t\t\tbreak\n\n\t\t\tfor r in range(z):\n\n\t\t\t\tif (p+1)*(q+1)*(r+1) > k:\n\n\t\t\t\t\tbreak\n\n\t\t\t\tstack.append(a[p]+b[q]+c[r])\n\n\tstack.sort(reverse=True)\n\n\tfor i in range(k):\n\n\t\tprint((stack[i]))\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 25, "code_v1_loc": 27, "code_v0_num_chars": 545, "code_v1_num_chars": 605, "code_v0_no_empty_lines": "def main():\n x, y, z, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n d = [0] * x * y\n for i in range(x):\n for j in range(y):\n d[i * y + j] = a[i] + b[j]\n d.sort(reverse=True)\n c.sort(reverse=True)\n c_len = min(k, z)\n d_len = min(k, x * y)\n e = [0] * d_len * c_len\n for i in range(d_len):\n for j in range(c_len):\n e[i * c_len + j] = d[i] + c[j]\n e.sort(reverse=True)\n for i in range(k):\n print((e[i]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n x, y, z, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n solve(a, b, c, x, y, z, k)\n\n\ndef solve(a, b, c, x, y, z, k):\n a.sort(reverse=True)\n b.sort(reverse=True)\n c.sort(reverse=True)\n stack = list()\n for p in range(x):\n for q in range(y):\n if (p + 1) * (q + 1) > k:\n break\n for r in range(z):\n if (p + 1) * (q + 1) * (r + 1) > k:\n break\n stack.append(a[p] + b[q] + c[r])\n stack.sort(reverse=True)\n for i in range(k):\n print((stack[i]))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 7.4074074074, "diff": ["- d = [0] * x * y", "- for i in range(x):", "- for j in range(y):", "- d[i * y + j] = a[i] + b[j]", "- d.sort(reverse=True)", "+ solve(a, b, c, x, y, z, k)", "+", "+", "+def solve(a, b, c, x, y, z, k):", "+ a.sort(reverse=True)", "+ b.sort(reverse=True)", "- c_len = min(k, z)", "- d_len = min(k, x * y)", "- e = [0] * d_len * c_len", "- for i in range(d_len):", "- for j in range(c_len):", "- e[i * c_len + j] = d[i] + c[j]", "- e.sort(reverse=True)", "+ stack = list()", "+ for p in range(x):", "+ for q in range(y):", "+ if (p + 1) * (q + 1) > k:", "+ break", "+ for r in range(z):", "+ if (p + 1) * (q + 1) * (r + 1) > k:", "+ break", "+ stack.append(a[p] + b[q] + c[r])", "+ stack.sort(reverse=True)", "- print((e[i]))", "+ print((stack[i]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3135767848, "measured_runtime_v1": 0.0401056306, "runtime_lift": 7.8187720726, "key": ["s149883415", "s931960732"], "target_token_count_dream": 201, "target_token_bucket_dream": "128-256"} +{"user_id": "u260980560", "problem_id": "p00713", "language": "python", "submission_id_v0": "s376249504", "submission_id_v1": "s496295641", "cpu_time_v0": 32130, "cpu_time_v1": 27750, "memory_v0": 6520, "memory_v1": 6552, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.63, "input": "from math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) / d) / 2.0\n\n xc = (x1 + x2) / 2.0\n\n yc = (y1 + y2) / 2.0\n\n return [[xc - k*yd, yc + k*xd], [xc + k*yd, yc - k*xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = [list(map(float, input().split())) for i in range(n)]\n\n p.sort()\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - bx >= 2.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)", "target": "from math import sqrt\n\nfrom bisect import bisect_left\n\ndef circle_center(x1, y1, x2, y2):\n\n xd = x2 - x1; yd = y2 - y1\n\n d = xd**2 + yd**2\n\n k = sqrt((4.0 - d) / d) / 2.0\n\n xc = (x1 + x2) / 2.0; yc = (y1 + y2) / 2.0\n\n xd *= k; yd *= k\n\n return [[xc - yd, yc + xd], [xc + yd, yc - xd]]\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n p = sorted(list(map(float, input().split())) for i in range(n))\n\n prev = 0\n\n ans = 1\n\n for i in range(n):\n\n bx, by = p[i]\n\n while bx - p[prev][0] >= 2.0: prev += 1\n\n for j in range(i+1, n):\n\n cx, cy = p[j]\n\n if cx - bx >= 2.0: break\n\n if (bx - cx)**2 + (by - cy)**2 <= 4.0:\n\n for ex, ey in circle_center(bx, by, cx, cy):\n\n count = 2\n\n for k in range(prev, n):\n\n if k==i or k==j: continue\n\n dx, dy = p[k]\n\n if dx - ex >= 1.0: break\n\n if (ex - dx)**2 + (ey - dy)**2 <= 1.0:\n\n count += 1\n\n ans = max(ans, count)\n\n print(ans)", "code_v0_loc": 33, "code_v1_loc": 32, "code_v0_num_chars": 1141, "code_v1_num_chars": 1143, "code_v0_no_empty_lines": "from math import sqrt\nfrom bisect import bisect_left\n\n\ndef circle_center(x1, y1, x2, y2):\n xd = x2 - x1\n yd = y2 - y1\n d = xd**2 + yd**2\n k = sqrt((4.0 - d) / d) / 2.0\n xc = (x1 + x2) / 2.0\n yc = (y1 + y2) / 2.0\n return [[xc - k * yd, yc + k * xd], [xc + k * yd, yc - k * xd]]\n\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n p = [list(map(float, input().split())) for i in range(n)]\n p.sort()\n prev = 0\n ans = 1\n for i in range(n):\n bx, by = p[i]\n while bx - p[prev][0] >= 2.0:\n prev += 1\n for j in range(i + 1, n):\n cx, cy = p[j]\n if cx - bx >= 2.0:\n break\n if (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0:\n for ex, ey in circle_center(bx, by, cx, cy):\n count = 2\n for k in range(prev, n):\n if k == i or k == j:\n continue\n dx, dy = p[k]\n if dx - bx >= 2.0:\n break\n if (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0:\n count += 1\n ans = max(ans, count)\n print(ans)\n", "code_v1_no_empty_lines": "from math import sqrt\nfrom bisect import bisect_left\n\n\ndef circle_center(x1, y1, x2, y2):\n xd = x2 - x1\n yd = y2 - y1\n d = xd**2 + yd**2\n k = sqrt((4.0 - d) / d) / 2.0\n xc = (x1 + x2) / 2.0\n yc = (y1 + y2) / 2.0\n xd *= k\n yd *= k\n return [[xc - yd, yc + xd], [xc + yd, yc - xd]]\n\n\nwhile 1:\n n = int(input())\n if n == 0:\n break\n p = sorted(list(map(float, input().split())) for i in range(n))\n prev = 0\n ans = 1\n for i in range(n):\n bx, by = p[i]\n while bx - p[prev][0] >= 2.0:\n prev += 1\n for j in range(i + 1, n):\n cx, cy = p[j]\n if cx - bx >= 2.0:\n break\n if (bx - cx) ** 2 + (by - cy) ** 2 <= 4.0:\n for ex, ey in circle_center(bx, by, cx, cy):\n count = 2\n for k in range(prev, n):\n if k == i or k == j:\n continue\n dx, dy = p[k]\n if dx - ex >= 1.0:\n break\n if (ex - dx) ** 2 + (ey - dy) ** 2 <= 1.0:\n count += 1\n ans = max(ans, count)\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 3.0303030303, "diff": ["- return [[xc - k * yd, yc + k * xd], [xc + k * yd, yc - k * xd]]", "+ xd *= k", "+ yd *= k", "+ return [[xc - yd, yc + xd], [xc + yd, yc - xd]]", "- p = [list(map(float, input().split())) for i in range(n)]", "- p.sort()", "+ p = sorted(list(map(float, input().split())) for i in range(n))", "- if dx - bx >= 2.0:", "+ if dx - ex >= 1.0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3026192219, "measured_runtime_v1": 0.1054183228, "runtime_lift": 2.8706510771, "key": ["s376249504", "s496295641"], "target_token_count_dream": 382, "target_token_bucket_dream": "256-512"} +{"user_id": "u286955577", "problem_id": "p03074", "language": "python", "submission_id_v0": "s853547546", "submission_id_v1": "s138697044", "cpu_time_v0": 74, "cpu_time_v1": 66, "memory_v0": 4596, "memory_v1": 4596, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.81, "input": "def solve():\n\n N, K = list(map(int, input().split()))\n\n _S = input()\n\n S = []\n\n b = _S[0]\n\n s = 0\n\n if b == '0': S.append(0)\n\n for _s in _S:\n\n if b == _s:\n\n s = s + 1\n\n else:\n\n b = _s\n\n S.append(s)\n\n s = 1\n\n S.append(s)\n\n if b == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n\n n = sum(S[0:num])\n\n m = n\n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n\n for i in range(0, len(S) - num, 2):\n\n n = n - sum(S[i:i+2])\n\n n = n + sum(S[i + num:i + num + 2])\n\n m = max(m, n)\n\n\n\n return m\n\n\n\nprint((solve()))", "target": "def solve():\n\n N, K = list(map(int, input().split()))\n\n s = input()\n\n S = []\n\n b = s[0]\n\n cnt = 0\n\n\n\n if s[0] == '0': S.append(0)\n\n for c in s:\n\n if b == c: cnt = cnt + 1\n\n else:\n\n b = c\n\n S.append(cnt)\n\n cnt = 1\n\n S.append(cnt)\n\n if s[-1] == '0': S.append(0)\n\n\n\n num = min(len(S), 2 * K + 1)\n\n part = sum(S[0:num])\n\n ans = part\n\n\n\n for i in range(0, len(S) - num, 2):\n\n part = part - sum(S[i:i+2]) + sum(S[i + num:i + num + 2])\n\n ans = max(ans, part)\n\n\n\n return ans\n\n\n\nprint((solve()))\n", "code_v0_loc": 30, "code_v1_loc": 28, "code_v0_num_chars": 616, "code_v1_num_chars": 520, "code_v0_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n _S = input()\n S = []\n b = _S[0]\n s = 0\n if b == \"0\":\n S.append(0)\n for _s in _S:\n if b == _s:\n s = s + 1\n else:\n b = _s\n S.append(s)\n s = 1\n S.append(s)\n if b == \"0\":\n S.append(0)\n num = min(len(S), 2 * K + 1)\n # n = sum(S[0:num if _S[0] == '1' else (num - 1)])\n n = sum(S[0:num])\n m = n\n # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):\n for i in range(0, len(S) - num, 2):\n n = n - sum(S[i : i + 2])\n n = n + sum(S[i + num : i + num + 2])\n m = max(m, n)\n return m\n\n\nprint((solve()))\n", "code_v1_no_empty_lines": "def solve():\n N, K = list(map(int, input().split()))\n s = input()\n S = []\n b = s[0]\n cnt = 0\n if s[0] == \"0\":\n S.append(0)\n for c in s:\n if b == c:\n cnt = cnt + 1\n else:\n b = c\n S.append(cnt)\n cnt = 1\n S.append(cnt)\n if s[-1] == \"0\":\n S.append(0)\n num = min(len(S), 2 * K + 1)\n part = sum(S[0:num])\n ans = part\n for i in range(0, len(S) - num, 2):\n part = part - sum(S[i : i + 2]) + sum(S[i + num : i + num + 2])\n ans = max(ans, part)\n return ans\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["- _S = input()", "+ s = input()", "- b = _S[0]", "- s = 0", "- if b == \"0\":", "+ b = s[0]", "+ cnt = 0", "+ if s[0] == \"0\":", "- for _s in _S:", "- if b == _s:", "- s = s + 1", "+ for c in s:", "+ if b == c:", "+ cnt = cnt + 1", "- b = _s", "- S.append(s)", "- s = 1", "- S.append(s)", "- if b == \"0\":", "+ b = c", "+ S.append(cnt)", "+ cnt = 1", "+ S.append(cnt)", "+ if s[-1] == \"0\":", "- # n = sum(S[0:num if _S[0] == '1' else (num - 1)])", "- n = sum(S[0:num])", "- m = n", "- # for i in range(0 if _S[0] == '1' else -1, len(S) - num, 2):", "+ part = sum(S[0:num])", "+ ans = part", "- n = n - sum(S[i : i + 2])", "- n = n + sum(S[i + num : i + num + 2])", "- m = max(m, n)", "- return m", "+ part = part - sum(S[i : i + 2]) + sum(S[i + num : i + num + 2])", "+ ans = max(ans, part)", "+ return ans"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3473945413, "measured_runtime_v1": 0.2136866565, "runtime_lift": 1.625719392, "key": ["s853547546", "s138697044"], "target_token_count_dream": 198, "target_token_bucket_dream": "128-256"} +{"user_id": "u259738923", "problem_id": "p03796", "language": "python", "submission_id_v0": "s911512169", "submission_id_v1": "s353747803", "cpu_time_v0": 231, "cpu_time_v1": 41, "memory_v0": 3972, "memory_v1": 7396, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.25, "input": "import math\n\nN = int(input())\n\nans = math.factorial(N) % (10 ** 9 + 7)\n\nprint(ans)", "target": "n = int(input())\n\nfrom functools import reduce\n\nprint((reduce(lambda x,y:x*y%1000000007,list(range(1,n+1)))))", "code_v0_loc": 4, "code_v1_loc": 3, "code_v0_num_chars": 82, "code_v1_num_chars": 107, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = math.factorial(N) % (10**9 + 7)\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\nfrom functools import reduce\n\nprint((reduce(lambda x, y: x * y % 1000000007, list(range(1, n + 1)))))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-import math", "+n = int(input())", "+from functools import reduce", "-N = int(input())", "-ans = math.factorial(N) % (10**9 + 7)", "-print(ans)", "+print((reduce(lambda x, y: x * y % 1000000007, list(range(1, n + 1)))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5315986769, "measured_runtime_v1": 0.2369310765, "runtime_lift": 2.2436848922, "key": ["s911512169", "s353747803"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u775681539", "problem_id": "p03371", "language": "python", "submission_id_v0": "s986639109", "submission_id_v1": "s095330807", "cpu_time_v0": 186, "cpu_time_v1": 89, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.15, "input": "#python3\n\nINF = int(1e9)\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF\n\n for i in range(2*10**5+100):\n\n t = 2*c*i + max(x-i, 0) * a + max(y-i, 0) * b\n\n ans = min(ans, t)\n\n print(ans)\n\nmain()", "target": "INF = int(1e5)+5\n\n\n\ndef main():\n\n a, b, c, x, y = list(map(int, input().split()))\n\n ans = INF*INF\n\n for i in range(INF):\n\n tmp = 2*i*c + a*max(x-i, 0) + b*max(y-i, 0) \n\n ans = min(tmp, ans)\n\n print(ans)\n\nmain()\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 239, "code_v1_num_chars": 231, "code_v0_no_empty_lines": "# python3\nINF = int(1e9)\n\n\ndef main():\n a, b, c, x, y = list(map(int, input().split()))\n ans = INF\n for i in range(2 * 10**5 + 100):\n t = 2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b\n ans = min(ans, t)\n print(ans)\n\n\nmain()\n", "code_v1_no_empty_lines": "INF = int(1e5) + 5\n\n\ndef main():\n a, b, c, x, y = list(map(int, input().split()))\n ans = INF * INF\n for i in range(INF):\n tmp = 2 * i * c + a * max(x - i, 0) + b * max(y - i, 0)\n ans = min(tmp, ans)\n print(ans)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-# python3", "-INF = int(1e9)", "+INF = int(1e5) + 5", "- ans = INF", "- for i in range(2 * 10**5 + 100):", "- t = 2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b", "- ans = min(ans, t)", "+ ans = INF * INF", "+ for i in range(INF):", "+ tmp = 2 * i * c + a * max(x - i, 0) + b * max(y - i, 0)", "+ ans = min(tmp, ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3276309614, "measured_runtime_v1": 0.7168484554, "runtime_lift": 1.8520385325, "key": ["s986639109", "s095330807"], "target_token_count_dream": 89, "target_token_bucket_dream": "<128"} +{"user_id": "u575431498", "problem_id": "p03828", "language": "python", "submission_id_v0": "s058426510", "submission_id_v1": "s587454237", "cpu_time_v0": 73, "cpu_time_v1": 18, "memory_v0": 3572, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 75.34, "input": "from functools import reduce\n\nN = int(input())\n\n\n\nprime_table = [1] * (N+1)\n\n\n\nfor x in range(2, N+1):\n\n for t in range(2, x+1):\n\n while x % t == 0:\n\n prime_table[t] += 1\n\n x //= t\n\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))", "target": "def prime_factorize(n):\n\n while n % 2 == 0:\n\n a[2] += 1\n\n n //= 2\n\n f = 3\n\n while f * f <= n:\n\n if n % f == 0:\n\n a[f] += 1\n\n n //= f\n\n else:\n\n f += 2\n\n if n != 1:\n\n a[n] += 1\n\n\n\nN = int(input())\n\na = [0]*(N+1)\n\nfor i in range(2, N+1):\n\n prime_factorize(i)\n\nans = 1\n\nfor i in a:\n\n if i > 0:\n\n ans *= (i+1)\n\nbig = 10**9 + 7\n\nprint((ans % big))", "code_v0_loc": 11, "code_v1_loc": 24, "code_v0_num_chars": 277, "code_v1_num_chars": 432, "code_v0_no_empty_lines": "from functools import reduce\n\nN = int(input())\nprime_table = [1] * (N + 1)\nfor x in range(2, N + 1):\n for t in range(2, x + 1):\n while x % t == 0:\n prime_table[t] += 1\n x //= t\nprint((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))\n", "code_v1_no_empty_lines": "def prime_factorize(n):\n while n % 2 == 0:\n a[2] += 1\n n //= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n a[f] += 1\n n //= f\n else:\n f += 2\n if n != 1:\n a[n] += 1\n\n\nN = int(input())\na = [0] * (N + 1)\nfor i in range(2, N + 1):\n prime_factorize(i)\nans = 1\nfor i in a:\n if i > 0:\n ans *= i + 1\nbig = 10**9 + 7\nprint((ans % big))\n", "code_same": false, "relative_loc_diff_percent": 54.1666666667, "diff": ["-from functools import reduce", "+def prime_factorize(n):", "+ while n % 2 == 0:", "+ a[2] += 1", "+ n //= 2", "+ f = 3", "+ while f * f <= n:", "+ if n % f == 0:", "+ a[f] += 1", "+ n //= f", "+ else:", "+ f += 2", "+ if n != 1:", "+ a[n] += 1", "+", "-prime_table = [1] * (N + 1)", "-for x in range(2, N + 1):", "- for t in range(2, x + 1):", "- while x % t == 0:", "- prime_table[t] += 1", "- x //= t", "-print((reduce(lambda x, y: x * y % (int(1e9) + 7), prime_table)))", "+a = [0] * (N + 1)", "+for i in range(2, N + 1):", "+ prime_factorize(i)", "+ans = 1", "+for i in a:", "+ if i > 0:", "+ ans *= i + 1", "+big = 10**9 + 7", "+print((ans % big))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2580870204, "measured_runtime_v1": 0.1952191839, "runtime_lift": 1.3220371851, "key": ["s058426510", "s587454237"], "target_token_count_dream": 164, "target_token_bucket_dream": "128-256"} +{"user_id": "u925364229", "problem_id": "p03835", "language": "python", "submission_id_v0": "s889927917", "submission_id_v1": "s987244986", "cpu_time_v0": 1777, "cpu_time_v1": 266, "memory_v0": 2940, "memory_v1": 42092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.03, "input": "K,S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor i in range(K+1):\n\n\tfor j in range(K+1):\n\n\t\tif (S - i - j) <= K and (S-i-j) >= 0:\n\n\t\t\tans += 1\n\n\n\nprint(ans)\n", "target": "K, S = list(map(int,input().split(\" \")))\n\nans = 0\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n if 0 <= (S - X - Y) <= K:\n\n ans += 1\n\n\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 156, "code_v1_num_chars": 162, "code_v0_no_empty_lines": "K, S = list(map(int, input().split(\" \")))\nans = 0\nfor i in range(K + 1):\n for j in range(K + 1):\n if (S - i - j) <= K and (S - i - j) >= 0:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "K, S = list(map(int, input().split(\" \")))\nans = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n if 0 <= (S - X - Y) <= K:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-for i in range(K + 1):", "- for j in range(K + 1):", "- if (S - i - j) <= K and (S - i - j) >= 0:", "+for X in range(K + 1):", "+ for Y in range(K + 1):", "+ if 0 <= (S - X - Y) <= K:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.441297763, "measured_runtime_v1": 0.3279348275, "runtime_lift": 1.3456873926, "key": ["s889927917", "s987244986"], "target_token_count_dream": 59, "target_token_bucket_dream": "<128"} +{"user_id": "u140201022", "problem_id": "p02412", "language": "python", "submission_id_v0": "s179146540", "submission_id_v1": "s419434066", "cpu_time_v0": 420, "cpu_time_v1": 30, "memory_v0": 4208, "memory_v1": 4204, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.86, "input": "while 1:\n\n ans=0\n\n n,x=list(map(int,input().split()))\n\n if n:\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n for k in range(j+1,n+1):\n\n if i+j+k==x:ans+=1\n\n else:break\n\n print(ans)", "target": "while 1:\n\n a=0\n\n n,x=list(map(int,input().split()))\n\n if n==0:break\n\n for i in range(1,n-1):\n\n for j in range(i+1,n):\n\n c=x-i-j\n\n if c>j and c<=n:a+=1\n\n print(a)", "code_v0_loc": 10, "code_v1_loc": 9, "code_v0_num_chars": 249, "code_v1_num_chars": 202, "code_v0_no_empty_lines": "while 1:\n ans = 0\n n, x = list(map(int, input().split()))\n if n:\n for i in range(1, n - 1):\n for j in range(i + 1, n):\n for k in range(j + 1, n + 1):\n if i + j + k == x:\n ans += 1\n else:\n break\n print(ans)\n", "code_v1_no_empty_lines": "while 1:\n a = 0\n n, x = list(map(int, input().split()))\n if n == 0:\n break\n for i in range(1, n - 1):\n for j in range(i + 1, n):\n c = x - i - j\n if c > j and c <= n:\n a += 1\n print(a)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["- ans = 0", "+ a = 0", "- if n:", "- for i in range(1, n - 1):", "- for j in range(i + 1, n):", "- for k in range(j + 1, n + 1):", "- if i + j + k == x:", "- ans += 1", "- else:", "+ if n == 0:", "- print(ans)", "+ for i in range(1, n - 1):", "+ for j in range(i + 1, n):", "+ c = x - i - j", "+ if c > j and c <= n:", "+ a += 1", "+ print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3642889087, "measured_runtime_v1": 0.2896689522, "runtime_lift": 1.2576042614, "key": ["s179146540", "s419434066"], "target_token_count_dream": 70, "target_token_bucket_dream": "<128"} +{"user_id": "u072717685", "problem_id": "p02767", "language": "python", "submission_id_v0": "s067063811", "submission_id_v1": "s910505357", "cpu_time_v0": 35, "cpu_time_v1": 31, "memory_v0": 5084, "memory_v1": 9036, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.43, "input": "def main():\n\n from statistics import mean\n\n from math import floor,ceil\n\n\n\n n = int(input())\n\n x = list(map(int, input().split()))\n\n x_mean = mean(x) \n\n if x_mean == 0.5:\n\n greater_than_x = len([i for i in x if i > x_mean])\n\n if greater_than_x * 2 >= n:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n elif x_mean % 1 > 0.5:\n\n x_mean = ceil(x_mean)\n\n else:\n\n x_mean = floor(x_mean)\n\n x2 = [(num - x_mean)**2 for num in x]\n\n print((sum(x2)))\n\n\n\nmain()", "target": "import sys\n\nread = sys.stdin.read\n\ndef main():\n\n n, *x = list(map(int, read().split()))\n\n r = float('inf')\n\n for i1 in range(1, 101):\n\n rt = 0\n\n for xe in x:\n\n rt += (xe - i1)**2\n\n r = min(r, rt)\n\n print(r)\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 21, "code_v1_loc": 14, "code_v0_num_chars": 512, "code_v1_num_chars": 287, "code_v0_no_empty_lines": "def main():\n from statistics import mean\n from math import floor, ceil\n\n n = int(input())\n x = list(map(int, input().split()))\n x_mean = mean(x)\n if x_mean == 0.5:\n greater_than_x = len([i for i in x if i > x_mean])\n if greater_than_x * 2 >= n:\n x_mean = ceil(x_mean)\n else:\n x_mean = floor(x_mean)\n elif x_mean % 1 > 0.5:\n x_mean = ceil(x_mean)\n else:\n x_mean = floor(x_mean)\n x2 = [(num - x_mean) ** 2 for num in x]\n print((sum(x2)))\n\n\nmain()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.read\n\n\ndef main():\n n, *x = list(map(int, read().split()))\n r = float(\"inf\")\n for i1 in range(1, 101):\n rt = 0\n for xe in x:\n rt += (xe - i1) ** 2\n r = min(r, rt)\n print(r)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-def main():", "- from statistics import mean", "- from math import floor, ceil", "+import sys", "- n = int(input())", "- x = list(map(int, input().split()))", "- x_mean = mean(x)", "- if x_mean == 0.5:", "- greater_than_x = len([i for i in x if i > x_mean])", "- if greater_than_x * 2 >= n:", "- x_mean = ceil(x_mean)", "- else:", "- x_mean = floor(x_mean)", "- elif x_mean % 1 > 0.5:", "- x_mean = ceil(x_mean)", "- else:", "- x_mean = floor(x_mean)", "- x2 = [(num - x_mean) ** 2 for num in x]", "- print((sum(x2)))", "+read = sys.stdin.read", "-main()", "+def main():", "+ n, *x = list(map(int, read().split()))", "+ r = float(\"inf\")", "+ for i1 in range(1, 101):", "+ rt = 0", "+ for xe in x:", "+ rt += (xe - i1) ** 2", "+ r = min(r, rt)", "+ print(r)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3305953437, "measured_runtime_v1": 0.2443374534, "runtime_lift": 1.3530277041, "key": ["s067063811", "s910505357"], "target_token_count_dream": 94, "target_token_bucket_dream": "<128"} +{"user_id": "u190086340", "problem_id": "p03854", "language": "python", "submission_id_v0": "s952373499", "submission_id_v1": "s487524594", "cpu_time_v0": 320, "cpu_time_v1": 262, "memory_v0": 79600, "memory_v1": 58480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.12, "input": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef solve():\n\n S = input()\n\n # print(S, len(S))\n\n\n\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n\n\n\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n\n\n def recur(i, w):\n\n if not TABLE[w][i] == -1:\n\n return TABLE[w][i]\n\n\n\n if i >= len(S):\n\n # print(\"jey\", log)\n\n return True\n\n\n\n r1, r2, r3, r4 = False, False, False, False\n\n if S[i:i + 5] == words[0]:\n\n r1 = recur(i + 5, 0)\n\n if S[i:i + 7] == words[1]:\n\n r2 = recur(i + 7, 1)\n\n if S[i:i + 5] == words[2]:\n\n r3 = recur(i + 5, 2)\n\n if S[i:i + 6] == words[3]:\n\n r4 = recur(i + 6, 3)\n\n\n\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n\n\n\n return TABLE[w][i]\n\n\n\n ans = recur(0, 0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n", "target": "import sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\ndef solve():\n\n S = input()\n\n # print(S, len(S))\n\n\n\n S = S[::-1]\n\n words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])\n\n\n\n def recur(i):\n\n if i >= len(S):\n\n return True\n\n\n\n for word in words:\n\n if S[i:i + len(word)] == word:\n\n if recur(i + len(word)):\n\n return True\n\n return False\n\n\n\n ans = recur(0)\n\n\n\n return ans\n\n\n\n\n\nif __name__ == '__main__':\n\n res = solve()\n\n if res:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n", "code_v0_loc": 45, "code_v1_loc": 31, "code_v0_num_chars": 1006, "code_v1_num_chars": 596, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef solve():\n S = input()\n # print(S, len(S))\n words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}\n TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]\n\n def recur(i, w):\n if not TABLE[w][i] == -1:\n return TABLE[w][i]\n if i >= len(S):\n # print(\"jey\", log)\n return True\n r1, r2, r3, r4 = False, False, False, False\n if S[i : i + 5] == words[0]:\n r1 = recur(i + 5, 0)\n if S[i : i + 7] == words[1]:\n r2 = recur(i + 7, 1)\n if S[i : i + 5] == words[2]:\n r3 = recur(i + 5, 2)\n if S[i : i + 6] == words[3]:\n r4 = recur(i + 6, 3)\n TABLE[w][i] = r1 or r2 or r3 or r4 or False\n return TABLE[w][i]\n\n ans = recur(0, 0)\n return ans\n\n\nif __name__ == \"__main__\":\n res = solve()\n if res:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef solve():\n S = input()\n # print(S, len(S))\n S = S[::-1]\n words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])\n\n def recur(i):\n if i >= len(S):\n return True\n for word in words:\n if S[i : i + len(word)] == word:\n if recur(i + len(word)):\n return True\n return False\n\n ans = recur(0)\n return ans\n\n\nif __name__ == \"__main__\":\n res = solve()\n if res:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 31.1111111111, "diff": ["- words = {0: \"dream\", 1: \"dreamer\", 2: \"erase\", 3: \"eraser\"}", "- TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]", "+ S = S[::-1]", "+ words = (\"dream\"[::-1], \"dreamer\"[::-1], \"erase\"[::-1], \"eraser\"[::-1])", "- def recur(i, w):", "- if not TABLE[w][i] == -1:", "- return TABLE[w][i]", "+ def recur(i):", "- # print(\"jey\", log)", "- r1, r2, r3, r4 = False, False, False, False", "- if S[i : i + 5] == words[0]:", "- r1 = recur(i + 5, 0)", "- if S[i : i + 7] == words[1]:", "- r2 = recur(i + 7, 1)", "- if S[i : i + 5] == words[2]:", "- r3 = recur(i + 5, 2)", "- if S[i : i + 6] == words[3]:", "- r4 = recur(i + 6, 3)", "- TABLE[w][i] = r1 or r2 or r3 or r4 or False", "- return TABLE[w][i]", "+ for word in words:", "+ if S[i : i + len(word)] == word:", "+ if recur(i + len(word)):", "+ return True", "+ return False", "- ans = recur(0, 0)", "+ ans = recur(0)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3275957136, "measured_runtime_v1": 0.2137343092, "runtime_lift": 1.5327240387, "key": ["s952373499", "s487524594"], "target_token_count_dream": 162, "target_token_bucket_dream": "128-256"} +{"user_id": "u112317104", "problem_id": "p02773", "language": "python", "submission_id_v0": "s565064219", "submission_id_v1": "s656135042", "cpu_time_v0": 1126, "cpu_time_v1": 742, "memory_v0": 46132, "memory_v1": 32480, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 34.1, "input": "from collections import defaultdict\n\n\n\nN = int(input())\n\nA = [input() for _ in range(N)]\n\nA.sort()\n\nd = defaultdict(int)\n\nfor a in A:\n\n d[a] += 1\n\n\n\nl = sorted(d.items())\n\nmax_v = 0\n\n\n\nfor _, v in l:\n\n if v > max_v:\n\n max_v = v\n\n \n\nfor k, v in l:\n\n if v == max_v:\n\n print(k)\n\n else:\n\n continue\n", "target": "from collections import defaultdict\n\n\n\ndef solve():\n\n N = int(input())\n\n d = defaultdict(int)\n\n for _ in range(N):\n\n a = input()\n\n d[a] += 1\n\n\n\n m = 0\n\n for k, v in list(d.items()):\n\n m = max(m, v)\n\n \n\n l = []\n\n for k, v in list(d.items()):\n\n if m == v:\n\n l.append(k)\n\n l.sort()\n\n for ans in l:\n\n print(ans)\n\n \n\nsolve()", "code_v0_loc": 21, "code_v1_loc": 22, "code_v0_num_chars": 330, "code_v1_num_chars": 386, "code_v0_no_empty_lines": "from collections import defaultdict\n\nN = int(input())\nA = [input() for _ in range(N)]\nA.sort()\nd = defaultdict(int)\nfor a in A:\n d[a] += 1\nl = sorted(d.items())\nmax_v = 0\nfor _, v in l:\n if v > max_v:\n max_v = v\nfor k, v in l:\n if v == max_v:\n print(k)\n else:\n continue\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\n\ndef solve():\n N = int(input())\n d = defaultdict(int)\n for _ in range(N):\n a = input()\n d[a] += 1\n m = 0\n for k, v in list(d.items()):\n m = max(m, v)\n l = []\n for k, v in list(d.items()):\n if m == v:\n l.append(k)\n l.sort()\n for ans in l:\n print(ans)\n\n\nsolve()\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["-N = int(input())", "-A = [input() for _ in range(N)]", "-A.sort()", "-d = defaultdict(int)", "-for a in A:", "- d[a] += 1", "-l = sorted(d.items())", "-max_v = 0", "-for _, v in l:", "- if v > max_v:", "- max_v = v", "-for k, v in l:", "- if v == max_v:", "- print(k)", "- else:", "- continue", "+", "+def solve():", "+ N = int(input())", "+ d = defaultdict(int)", "+ for _ in range(N):", "+ a = input()", "+ d[a] += 1", "+ m = 0", "+ for k, v in list(d.items()):", "+ m = max(m, v)", "+ l = []", "+ for k, v in list(d.items()):", "+ if m == v:", "+ l.append(k)", "+ l.sort()", "+ for ans in l:", "+ print(ans)", "+", "+", "+solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2730668259, "measured_runtime_v1": 0.1417047331, "runtime_lift": 1.9270127385, "key": ["s565064219", "s656135042"], "target_token_count_dream": 109, "target_token_bucket_dream": "<128"} +{"user_id": "u038408819", "problem_id": "p02691", "language": "python", "submission_id_v0": "s116716284", "submission_id_v1": "s825945845", "cpu_time_v0": 328, "cpu_time_v1": 178, "memory_v0": 73948, "memory_v1": 132600, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.73, "input": "n = int(input())\n\na = list(map(int, input().split()))\n\na_index = []\n\nfor i in range(n):\n\n a_index.append((i, a[i]))\n\ndic1 = {}\n\ndic2 = {}\n\nfor i in range(n):\n\n one = a_index[i][0] + a_index[i][1]\n\n two = a_index[i][0] - a_index[i][1]\n\n if one not in dic1:\n\n dic1[one] = 1\n\n else:\n\n dic1[one] += 1\n\n if two not in dic2:\n\n dic2[two] = 1\n\n else:\n\n dic2[two] += 1\n\nans = 0\n\nfor i in list(dic1.keys()):\n\n if i in dic2:\n\n ans += dic2[i] * dic1[i]\n\nfor i in list(dic2.keys()):\n\n if i in dic1:\n\n ans += dic1[i] * dic2[i]\n\n #print(i)\n\nprint((ans // 2))\n", "target": "n = int(input())\n\na = list(map(int, input().split()))\n\nimport collections\n\nans = 0\n\ndic = collections.defaultdict(int)\n\nfor i in range(1, n + 1):\n\n ans += dic[i - a[i - 1]]\n\n dic[i + a[i - 1]] += 1\n\nprint(ans)", "code_v0_loc": 27, "code_v1_loc": 9, "code_v0_num_chars": 606, "code_v1_num_chars": 215, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\na_index = []\nfor i in range(n):\n a_index.append((i, a[i]))\ndic1 = {}\ndic2 = {}\nfor i in range(n):\n one = a_index[i][0] + a_index[i][1]\n two = a_index[i][0] - a_index[i][1]\n if one not in dic1:\n dic1[one] = 1\n else:\n dic1[one] += 1\n if two not in dic2:\n dic2[two] = 1\n else:\n dic2[two] += 1\nans = 0\nfor i in list(dic1.keys()):\n if i in dic2:\n ans += dic2[i] * dic1[i]\nfor i in list(dic2.keys()):\n if i in dic1:\n ans += dic1[i] * dic2[i]\n # print(i)\nprint((ans // 2))\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nimport collections\n\nans = 0\ndic = collections.defaultdict(int)\nfor i in range(1, n + 1):\n ans += dic[i - a[i - 1]]\n dic[i + a[i - 1]] += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-a_index = []", "-for i in range(n):", "- a_index.append((i, a[i]))", "-dic1 = {}", "-dic2 = {}", "-for i in range(n):", "- one = a_index[i][0] + a_index[i][1]", "- two = a_index[i][0] - a_index[i][1]", "- if one not in dic1:", "- dic1[one] = 1", "- else:", "- dic1[one] += 1", "- if two not in dic2:", "- dic2[two] = 1", "- else:", "- dic2[two] += 1", "+import collections", "+", "-for i in list(dic1.keys()):", "- if i in dic2:", "- ans += dic2[i] * dic1[i]", "-for i in list(dic2.keys()):", "- if i in dic1:", "- ans += dic1[i] * dic2[i]", "- # print(i)", "-print((ans // 2))", "+dic = collections.defaultdict(int)", "+for i in range(1, n + 1):", "+ ans += dic[i - a[i - 1]]", "+ dic[i + a[i - 1]] += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3792731187, "measured_runtime_v1": 0.2976846831, "runtime_lift": 1.2740767002, "key": ["s116716284", "s825945845"], "target_token_count_dream": 71, "target_token_bucket_dream": "<128"} +{"user_id": "u123756661", "problem_id": "p03835", "language": "python", "submission_id_v0": "s113088304", "submission_id_v1": "s025062934", "cpu_time_v0": 1218, "cpu_time_v1": 258, "memory_v0": 2940, "memory_v1": 41580, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 78.82, "input": "k,s=list(map(int,input().split()))\n\nans=chk=0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if (0<=s-i-j<=k): ans+=1\n\nprint(ans)", "target": "k,s=list(map(int,input().split()))\n\nans=0\n\nx=min(k+1,s+1)\n\ny=max(0,s-k-k)\n\nfor i in range(y,x):\n\n for j in range(y,x):\n\n if i+j>s: break\n\n if 0<=s-i-j<=k:\n\n ans+=1\n\nprint(ans)", "code_v0_loc": 6, "code_v1_loc": 10, "code_v0_num_chars": 133, "code_v1_num_chars": 197, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\nans = chk = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\nans = 0\nx = min(k + 1, s + 1)\ny = max(0, s - k - k)\nfor i in range(y, x):\n for j in range(y, x):\n if i + j > s:\n break\n if 0 <= s - i - j <= k:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-ans = chk = 0", "-for i in range(k + 1):", "- for j in range(k + 1):", "+ans = 0", "+x = min(k + 1, s + 1)", "+y = max(0, s - k - k)", "+for i in range(y, x):", "+ for j in range(y, x):", "+ if i + j > s:", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3946401063, "measured_runtime_v1": 0.3009130723, "runtime_lift": 1.3114754477, "key": ["s113088304", "s025062934"], "target_token_count_dream": 72, "target_token_bucket_dream": "<128"} +{"user_id": "u761320129", "problem_id": "p03564", "language": "python", "submission_id_v0": "s515134391", "submission_id_v1": "s980600609", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N,K = int(input()), int(input())\n\nnow = 1\n\nfor i in range(N):\n\n if now*2 < now + K:\n\n now *= 2\n\n else:\n\n now += K\n\nprint(now)\n", "target": "N = int(input())\n\nK = int(input())\n\nans = 1\n\nfor i in range(N):\n\n if ans < K:\n\n ans *= 2\n\n else:\n\n ans += K\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 9, "code_v0_num_chars": 146, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "N, K = int(input()), int(input())\nnow = 1\nfor i in range(N):\n if now * 2 < now + K:\n now *= 2\n else:\n now += K\nprint(now)\n", "code_v1_no_empty_lines": "N = int(input())\nK = int(input())\nans = 1\nfor i in range(N):\n if ans < K:\n ans *= 2\n else:\n ans += K\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 11.1111111111, "diff": ["-N, K = int(input()), int(input())", "-now = 1", "+N = int(input())", "+K = int(input())", "+ans = 1", "- if now * 2 < now + K:", "- now *= 2", "+ if ans < K:", "+ ans *= 2", "- now += K", "-print(now)", "+ ans += K", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2990638907, "measured_runtime_v1": 0.1086408798, "runtime_lift": 2.7527749338, "key": ["s515134391", "s980600609"], "target_token_count_dream": 44, "target_token_bucket_dream": "<128"} +{"user_id": "u177388368", "problem_id": "p02881", "language": "python", "submission_id_v0": "s386884404", "submission_id_v1": "s516418112", "cpu_time_v0": 474, "cpu_time_v1": 256, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.99, "input": "import math\n\nn=int(input())\n\nans=n\n\ni=1\n\nwhile(i<=math.sqrt(n)):\n\n if n%i==0:\n\n d=i+n/i-2\n\n ans=min(ans,d)\n\n i+=1\n\nprint((int(ans)))", "target": "from math import floor\n\nfrom math import sqrt\n\nn=int(input())\n\nnn=floor(sqrt(n))\n\nrest=n%nn\n\nwhile rest!=0:\n\n nn-=1\n\n rest=n%nn\n\nnnn=n/nn\n\nprint((int(nn+nnn-2)))", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 150, "code_v1_num_chars": 165, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nans = n\ni = 1\nwhile i <= math.sqrt(n):\n if n % i == 0:\n d = i + n / i - 2\n ans = min(ans, d)\n i += 1\nprint((int(ans)))\n", "code_v1_no_empty_lines": "from math import floor\nfrom math import sqrt\n\nn = int(input())\nnn = floor(sqrt(n))\nrest = n % nn\nwhile rest != 0:\n nn -= 1\n rest = n % nn\nnnn = n / nn\nprint((int(nn + nnn - 2)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-import math", "+from math import floor", "+from math import sqrt", "-ans = n", "-i = 1", "-while i <= math.sqrt(n):", "- if n % i == 0:", "- d = i + n / i - 2", "- ans = min(ans, d)", "- i += 1", "-print((int(ans)))", "+nn = floor(sqrt(n))", "+rest = n % nn", "+while rest != 0:", "+ nn -= 1", "+ rest = n % nn", "+nnn = n / nn", "+print((int(nn + nnn - 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3770523396, "measured_runtime_v1": 0.2395324836, "runtime_lift": 1.5741177727, "key": ["s386884404", "s516418112"], "target_token_count_dream": 57, "target_token_bucket_dream": "<128"} +{"user_id": "u275934251", "problem_id": "p03796", "language": "python", "submission_id_v0": "s111144925", "submission_id_v1": "s028336395", "cpu_time_v0": 229, "cpu_time_v1": 37, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.84, "input": "import math\n\n\n\nN = int(input())\n\n\n\npower = math.factorial(N)\n\n\n\nprint((power % 1000000007))\n\n\n", "target": "n=int(input())\n\nans=1\n\nfor i in range(n):\n\n ans=(ans*(i+1))%(10**9+7)\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 5, "code_v0_num_chars": 92, "code_v1_num_chars": 84, "code_v0_no_empty_lines": "import math\n\nN = int(input())\npower = math.factorial(N)\nprint((power % 1000000007))\n", "code_v1_no_empty_lines": "n = int(input())\nans = 1\nfor i in range(n):\n ans = (ans * (i + 1)) % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 37.5, "diff": ["-import math", "-", "-N = int(input())", "-power = math.factorial(N)", "-print((power % 1000000007))", "+n = int(input())", "+ans = 1", "+for i in range(n):", "+ ans = (ans * (i + 1)) % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7185150633, "measured_runtime_v1": 0.3322105608, "runtime_lift": 2.1628302891, "key": ["s111144925", "s028336395"], "target_token_count_dream": 34, "target_token_bucket_dream": "<128"} +{"user_id": "u353797797", "problem_id": "p03170", "language": "python", "submission_id_v0": "s365373544", "submission_id_v1": "s835744397", "cpu_time_v0": 126, "cpu_time_v1": 112, "memory_v0": 3828, "memory_v1": 3828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.11, "input": "n, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii <= k:\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n", "target": "n, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\ndp = [\"Second\"] * (k + 1)\n\nfor i in range(k + 1):\n\n if dp[i] == \"Second\":\n\n for a in a_s:\n\n ii = i + a\n\n if ii > k:break\n\n dp[ii] = \"First\"\n\nprint((dp[-1]))\n", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 271, "code_v1_num_chars": 271, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\na_s = list(map(int, input().split()))\ndp = [\"Second\"] * (k + 1)\nfor i in range(k + 1):\n if dp[i] == \"Second\":\n for a in a_s:\n ii = i + a\n if ii <= k:\n dp[ii] = \"First\"\nprint((dp[-1]))\n", "code_v1_no_empty_lines": "n, k = list(map(int, input().split()))\na_s = list(map(int, input().split()))\ndp = [\"Second\"] * (k + 1)\nfor i in range(k + 1):\n if dp[i] == \"Second\":\n for a in a_s:\n ii = i + a\n if ii > k:\n break\n dp[ii] = \"First\"\nprint((dp[-1]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if ii <= k:", "- dp[ii] = \"First\"", "+ if ii > k:", "+ break", "+ dp[ii] = \"First\""], "diff_only_import_comment": false, "measured_runtime_v0": 0.3611531999, "measured_runtime_v1": 0.2298232606, "runtime_lift": 1.5714388476, "key": ["s365373544", "s835744397"], "target_token_count_dream": 89, "target_token_bucket_dream": "<128"} +{"user_id": "u604839890", "problem_id": "p02622", "language": "python", "submission_id_v0": "s830524393", "submission_id_v1": "s723518358", "cpu_time_v0": 83, "cpu_time_v1": 70, "memory_v0": 85616, "memory_v1": 73748, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.66, "input": "S, T = [list(input()) for _ in range(2)]\n\ncnt = 0\n\nfor i in range(len(S)):\n\n if S[i] != T[i]:\n\n cnt += 1\n\nprint(cnt)\n", "target": "s, t = [input() for i in range(2)]\n\nans = 0\n\nfor i in range(len(s)):\n\n if s[i] != t[i]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 6, "code_v1_loc": 6, "code_v0_num_chars": 127, "code_v1_num_chars": 114, "code_v0_no_empty_lines": "S, T = [list(input()) for _ in range(2)]\ncnt = 0\nfor i in range(len(S)):\n if S[i] != T[i]:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "s, t = [input() for i in range(2)]\nans = 0\nfor i in range(len(s)):\n if s[i] != t[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-S, T = [list(input()) for _ in range(2)]", "-cnt = 0", "-for i in range(len(S)):", "- if S[i] != T[i]:", "- cnt += 1", "-print(cnt)", "+s, t = [input() for i in range(2)]", "+ans = 0", "+for i in range(len(s)):", "+ if s[i] != t[i]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2683959379, "measured_runtime_v1": 0.2054475396, "runtime_lift": 1.3063964576, "key": ["s830524393", "s723518358"], "target_token_count_dream": 45, "target_token_bucket_dream": "<128"} +{"user_id": "u644907318", "problem_id": "p02886", "language": "python", "submission_id_v0": "s745140004", "submission_id_v1": "s021490246", "cpu_time_v0": 167, "cpu_time_v1": 89, "memory_v0": 38512, "memory_v1": 61656, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.71, "input": "N = int(input())\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N-1):\n\n for j in range(i+1,N):\n\n cnt += D[i]*D[j]\n\nprint(cnt)", "target": "N = int(input())\n\nD = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += D[i]**2\n\ntot = 0\n\nfor i in range(N):\n\n tot += D[i]\n\ntot = tot**2\n\ntot -= cnt\n\nprint((tot//2))", "code_v0_loc": 7, "code_v1_loc": 11, "code_v0_num_chars": 149, "code_v1_num_chars": 188, "code_v0_no_empty_lines": "N = int(input())\nD = list(map(int, input().split()))\ncnt = 0\nfor i in range(N - 1):\n for j in range(i + 1, N):\n cnt += D[i] * D[j]\nprint(cnt)\n", "code_v1_no_empty_lines": "N = int(input())\nD = list(map(int, input().split()))\ncnt = 0\nfor i in range(N):\n cnt += D[i] ** 2\ntot = 0\nfor i in range(N):\n tot += D[i]\ntot = tot**2\ntot -= cnt\nprint((tot // 2))\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-for i in range(N - 1):", "- for j in range(i + 1, N):", "- cnt += D[i] * D[j]", "-print(cnt)", "+for i in range(N):", "+ cnt += D[i] ** 2", "+tot = 0", "+for i in range(N):", "+ tot += D[i]", "+tot = tot**2", "+tot -= cnt", "+print((tot // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2884610276, "measured_runtime_v1": 0.2260356005, "runtime_lift": 1.2761751997, "key": ["s745140004", "s021490246"], "target_token_count_dream": 66, "target_token_bucket_dream": "<128"} +{"user_id": "u258073778", "problem_id": "p03370", "language": "python", "submission_id_v0": "s864579791", "submission_id_v1": "s018766024", "cpu_time_v0": 712, "cpu_time_v1": 525, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 26.26, "input": "N, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(input())\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x // min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n if x >= min(mn):\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)", "target": "N, X = list(map(int, input().split()))\n\n\n\nmn = [0]*N\n\nfor i in range(N):\n\n mn[i] = int(input())\n\n \n\nans = N\n\nx = X - sum(mn)\n\n\n\nwhile(x >= min(mn)):\n\n if x // min(mn) == 0:\n\n mn[mn.index(min(mn))] = 1000000\n\n else:\n\n x -= min(mn)\n\n ans += 1\n\n \n\nprint(ans)", "code_v0_loc": 18, "code_v1_loc": 17, "code_v0_num_chars": 293, "code_v1_num_chars": 267, "code_v0_no_empty_lines": "N, X = list(map(int, input().split()))\nmn = [0] * N\nfor i in range(N):\n mn[i] = int(input())\nans = N\nx = X - sum(mn)\nwhile x >= min(mn):\n if x // min(mn) == 0:\n mn[mn.index(min(mn))] = 1000000\n else:\n if x >= min(mn):\n x -= min(mn)\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N, X = list(map(int, input().split()))\nmn = [0] * N\nfor i in range(N):\n mn[i] = int(input())\nans = N\nx = X - sum(mn)\nwhile x >= min(mn):\n if x // min(mn) == 0:\n mn[mn.index(min(mn))] = 1000000\n else:\n x -= min(mn)\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 5.5555555556, "diff": ["- if x >= min(mn):", "- x -= min(mn)", "- ans += 1", "+ x -= min(mn)", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2841449485, "measured_runtime_v1": 0.2087575016, "runtime_lift": 1.3611244927, "key": ["s864579791", "s018766024"], "target_token_count_dream": 106, "target_token_bucket_dream": "<128"} +{"user_id": "u961683878", "problem_id": "p02596", "language": "python", "submission_id_v0": "s650878996", "submission_id_v1": "s172963527", "cpu_time_v0": 1976, "cpu_time_v1": 198, "memory_v0": 165028, "memory_v1": 9244, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 89.98, "input": "#! /usr/bin/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\n\n\ndef isMultiple(s, m):\n\n tmp = 0\n\n for i in range(len(s)):\n\n tmp = (tmp * 10 + int(s[i])) % m\n\n if tmp == 0:\n\n return i\n\n return -1\n\n\n\n\n\nk = int(readline())\n\nacc = \"7\" * 50000000\n\nif k % 2 == 0:\n\n ans = -1\n\nelse:\n\n\n\n ans = isMultiple(acc, k)\n\n if ans != -1:\n\n ans += 1\n\n\n\nprint(ans)\n", "target": "#! /usr/bin/env python3\n\n\n\nimport sys\n\nint1 = lambda x: int(x) - 1\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(500000)\n\n\n\nk = int(readline())\n\n\n\nans = -1\n\nacc = 7 % k\n\nfor n in range(1, k + 10):\n\n if acc == 0:\n\n ans = n\n\n break\n\n acc = (10 * acc + 7) % k\n\n\n\nprint(ans)\n", "code_v0_loc": 30, "code_v1_loc": 20, "code_v0_num_chars": 543, "code_v1_num_chars": 376, "code_v0_no_empty_lines": "#! /usr/bin/env python3\nimport sys\n\nint1 = lambda x: int(x) - 1\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(500000)\n\n\ndef isMultiple(s, m):\n tmp = 0\n for i in range(len(s)):\n tmp = (tmp * 10 + int(s[i])) % m\n if tmp == 0:\n return i\n return -1\n\n\nk = int(readline())\nacc = \"7\" * 50000000\nif k % 2 == 0:\n ans = -1\nelse:\n ans = isMultiple(acc, k)\n if ans != -1:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "#! /usr/bin/env python3\nimport sys\n\nint1 = lambda x: int(x) - 1\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(500000)\nk = int(readline())\nans = -1\nacc = 7 % k\nfor n in range(1, k + 10):\n if acc == 0:\n ans = n\n break\n acc = (10 * acc + 7) % k\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-", "-", "-def isMultiple(s, m):", "- tmp = 0", "- for i in range(len(s)):", "- tmp = (tmp * 10 + int(s[i])) % m", "- if tmp == 0:", "- return i", "- return -1", "-", "-", "-acc = \"7\" * 50000000", "-if k % 2 == 0:", "- ans = -1", "-else:", "- ans = isMultiple(acc, k)", "- if ans != -1:", "- ans += 1", "+ans = -1", "+acc = 7 % k", "+for n in range(1, k + 10):", "+ if acc == 0:", "+ ans = n", "+ break", "+ acc = (10 * acc + 7) % k"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8533027549, "measured_runtime_v1": 0.4769769247, "runtime_lift": 1.788981208, "key": ["s650878996", "s172963527"], "target_token_count_dream": 125, "target_token_bucket_dream": "<128"} +{"user_id": "u133936772", "problem_id": "p02615", "language": "python", "submission_id_v0": "s324254523", "submission_id_v1": "s548223725", "cpu_time_v0": 146, "cpu_time_v1": 118, "memory_v0": 31756, "memory_v1": 31752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.18, "input": "n,*l=list(map(int,open(0).read().split()));print((sum(sorted(l*2)[-2:~n:-1])))", "target": "n,*l=list(map(int,open(0).read().split()))\n\nl.sort(reverse=1)\n\nprint((sum(l[i//2] for i in range(1,n))))", "code_v0_loc": 1, "code_v1_loc": 3, "code_v0_num_chars": 70, "code_v1_num_chars": 96, "code_v0_no_empty_lines": "n, *l = list(map(int, open(0).read().split()))\nprint((sum(sorted(l * 2)[-2:~n:-1])))\n", "code_v1_no_empty_lines": "n, *l = list(map(int, open(0).read().split()))\nl.sort(reverse=1)\nprint((sum(l[i // 2] for i in range(1, n))))\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-print((sum(sorted(l * 2)[-2:~n:-1])))", "+l.sort(reverse=1)", "+print((sum(l[i // 2] for i in range(1, n))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2901719676, "measured_runtime_v1": 0.1990829677, "runtime_lift": 1.4575429076, "key": ["s324254523", "s548223725"], "target_token_count_dream": 37, "target_token_bucket_dream": "<128"} +{"user_id": "u727072969", "problem_id": "p02881", "language": "python", "submission_id_v0": "s064089444", "submission_id_v1": "s044740610", "cpu_time_v0": 519, "cpu_time_v1": 181, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.13, "input": "import math\n\nN = int(input())\n\nfor i in range(int(math.sqrt(N))):\n\n if N % (int(math.sqrt(N))-i) == 0:\n\n print((int(N/(int(math.sqrt(N))-i)+int(math.sqrt(N))-i-2)))\n\n break", "target": "import math\n\nN = int(input())\n\nM = int(math.sqrt(N))\n\nfor i in range(M):\n\n if N % (M-i) == 0:\n\n print((int(N/(M-i)+M-i-2)))\n\n break\n", "code_v0_loc": 6, "code_v1_loc": 7, "code_v0_num_chars": 187, "code_v1_num_chars": 147, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nfor i in range(int(math.sqrt(N))):\n if N % (int(math.sqrt(N)) - i) == 0:\n print((int(N / (int(math.sqrt(N)) - i) + int(math.sqrt(N)) - i - 2)))\n break\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\nM = int(math.sqrt(N))\nfor i in range(M):\n if N % (M - i) == 0:\n print((int(N / (M - i) + M - i - 2)))\n break\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-for i in range(int(math.sqrt(N))):", "- if N % (int(math.sqrt(N)) - i) == 0:", "- print((int(N / (int(math.sqrt(N)) - i) + int(math.sqrt(N)) - i - 2)))", "+M = int(math.sqrt(N))", "+for i in range(M):", "+ if N % (M - i) == 0:", "+ print((int(N / (M - i) + M - i - 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3627885733, "measured_runtime_v1": 0.269237565, "runtime_lift": 1.3474664028, "key": ["s064089444", "s044740610"], "target_token_count_dream": 50, "target_token_bucket_dream": "<128"} +{"user_id": "u753589982", "problem_id": "p02994", "language": "python", "submission_id_v0": "s918408995", "submission_id_v1": "s703264591", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "N, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple():\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)//2 - eat_apple()))", "target": "N, L = [int(i) for i in input().split()]\n\n\n\nmin_ = L\n\nmax_ = L + N -1\n\n\n\ndef eat_apple(N, L, max_):\n\n if max_<0:\n\n return max_ \n\n if L < 0:\n\n return 0\n\n return L\n\n\n\nprint(((min_+max_)*(max_-min_+1)//2 - eat_apple(N, L, max_)))", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 227, "code_v1_num_chars": 247, "code_v0_no_empty_lines": "N, L = [int(i) for i in input().split()]\nmin_ = L\nmax_ = L + N - 1\n\n\ndef eat_apple():\n if max_ < 0:\n return max_\n if L < 0:\n return 0\n return L\n\n\nprint(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple()))\n", "code_v1_no_empty_lines": "N, L = [int(i) for i in input().split()]\nmin_ = L\nmax_ = L + N - 1\n\n\ndef eat_apple(N, L, max_):\n if max_ < 0:\n return max_\n if L < 0:\n return 0\n return L\n\n\nprint(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple(N, L, max_)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-def eat_apple():", "+def eat_apple(N, L, max_):", "-print(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple()))", "+print(((min_ + max_) * (max_ - min_ + 1) // 2 - eat_apple(N, L, max_)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2025646191, "measured_runtime_v1": 0.0060813091, "runtime_lift": 33.309377317, "key": ["s918408995", "s703264591"], "target_token_count_dream": 95, "target_token_bucket_dream": "<128"} +{"user_id": "u787562674", "problem_id": "p03363", "language": "python", "submission_id_v0": "s520227607", "submission_id_v1": "s241017574", "cpu_time_v0": 271, "cpu_time_v1": 224, "memory_v0": 41880, "memory_v1": 41472, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.34, "input": "from collections import Counter\n\n\n\nN = int(input())\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\nruisekiwa = [0] * (N+1)\n\n\n\nfor i in range(N):\n\n ruisekiwa[i+1] = ruisekiwa[i] + inputs[i]\n\n\n\nruisekiwa = ruisekiwa[1:]\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n", "target": "from collections import Counter\n\nfrom itertools import accumulate\n\n\n\nN = int(input())\n\ninputs = [int(i) for i in input().split()]\n\n\n\nans = 0\n\n\n\nruisekiwa = list(accumulate(inputs))\n\nruisekiwa.sort()\n\ncounter_ruiseki = Counter(ruisekiwa)\n\n\n\nfor key, value in list(counter_ruiseki.items()):\n\n if key == 0 and value == 1:\n\n ans += value\n\n continue\n\n elif key == 0 and value > 1:\n\n ans += value\n\n if value > 1:\n\n ans += sum(list(range(value)))\n\n\n\nprint(ans)\n", "code_v0_loc": 25, "code_v1_loc": 22, "code_v0_num_chars": 534, "code_v1_num_chars": 485, "code_v0_no_empty_lines": "from collections import Counter\n\nN = int(input())\ninputs = [int(i) for i in input().split()]\nans = 0\nruisekiwa = [0] * (N + 1)\nfor i in range(N):\n ruisekiwa[i + 1] = ruisekiwa[i] + inputs[i]\nruisekiwa = ruisekiwa[1:]\nruisekiwa.sort()\ncounter_ruiseki = Counter(ruisekiwa)\nfor key, value in list(counter_ruiseki.items()):\n if key == 0 and value == 1:\n ans += value\n continue\n elif key == 0 and value > 1:\n ans += value\n if value > 1:\n ans += sum(list(range(value)))\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import Counter\nfrom itertools import accumulate\n\nN = int(input())\ninputs = [int(i) for i in input().split()]\nans = 0\nruisekiwa = list(accumulate(inputs))\nruisekiwa.sort()\ncounter_ruiseki = Counter(ruisekiwa)\nfor key, value in list(counter_ruiseki.items()):\n if key == 0 and value == 1:\n ans += value\n continue\n elif key == 0 and value > 1:\n ans += value\n if value > 1:\n ans += sum(list(range(value)))\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 12.0, "diff": ["+from itertools import accumulate", "-ruisekiwa = [0] * (N + 1)", "-for i in range(N):", "- ruisekiwa[i + 1] = ruisekiwa[i] + inputs[i]", "-ruisekiwa = ruisekiwa[1:]", "+ruisekiwa = list(accumulate(inputs))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.19887093, "measured_runtime_v1": 0.1327844608, "runtime_lift": 1.4976973116, "key": ["s520227607", "s241017574"], "target_token_count_dream": 129, "target_token_bucket_dream": "128-256"} +{"user_id": "u868701750", "problem_id": "p03457", "language": "python", "submission_id_v0": "s991338937", "submission_id_v1": "s211926413", "cpu_time_v0": 209, "cpu_time_v1": 173, "memory_v0": 27480, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.22, "input": "import sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n T = [list(map(int, _input().split())) for _ in range(N)]\n\n t, x, y = 0, 0, 0\n\n for next_t, next_x, next_y in T:\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()", "target": "import sys\n\n_input = sys.stdin.readline\n\n\n\n\n\ndef resolve():\n\n N = int(_input())\n\n t, x, y = 0, 0, 0\n\n for _ in range(N):\n\n next_t, next_x, next_y = list(map(int, _input().split()))\n\n diff_xy = abs(x - next_x) + abs(y - next_y)\n\n diff_t = next_t - t\n\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n\n print('No')\n\n exit(0)\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()", "code_v0_loc": 19, "code_v1_loc": 19, "code_v0_num_chars": 459, "code_v1_num_chars": 444, "code_v0_no_empty_lines": "import sys\n\n_input = sys.stdin.readline\n\n\ndef resolve():\n N = int(_input())\n T = [list(map(int, _input().split())) for _ in range(N)]\n t, x, y = 0, 0, 0\n for next_t, next_x, next_y in T:\n diff_xy = abs(x - next_x) + abs(y - next_y)\n diff_t = next_t - t\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n print(\"No\")\n exit(0)\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_v1_no_empty_lines": "import sys\n\n_input = sys.stdin.readline\n\n\ndef resolve():\n N = int(_input())\n t, x, y = 0, 0, 0\n for _ in range(N):\n next_t, next_x, next_y = list(map(int, _input().split()))\n diff_xy = abs(x - next_x) + abs(y - next_y)\n diff_t = next_t - t\n if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):\n print(\"No\")\n exit(0)\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- T = [list(map(int, _input().split())) for _ in range(N)]", "- for next_t, next_x, next_y in T:", "+ for _ in range(N):", "+ next_t, next_x, next_y = list(map(int, _input().split()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2834033267, "measured_runtime_v1": 0.1166054926, "runtime_lift": 2.4304457743, "key": ["s991338937", "s211926413"], "target_token_count_dream": 136, "target_token_bucket_dream": "128-256"} +{"user_id": "u280978334", "problem_id": "p03107", "language": "python", "submission_id_v0": "s353947972", "submission_id_v1": "s266533401", "cpu_time_v0": 65, "cpu_time_v1": 18, "memory_v0": 5400, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.31, "input": "S = [int(_) for _ in input()]\n\nlength = len(S)\n\ntemp = [S[0]]\n\nfor x in S[1:]:\n\n if(len(temp) == 0):\n\n temp.append(x)\n\n elif( temp[-1] == x):\n\n temp.append(x)\n\n else:\n\n temp.pop(-1)\n\nprint((length-len(temp)))\n\n ", "target": "def main():\n\n A = input()\n\n print((2*min(A.count(\"0\"),A.count(\"1\"))))\n\n \n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 12, "code_v1_loc": 6, "code_v0_num_chars": 246, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "S = [int(_) for _ in input()]\nlength = len(S)\ntemp = [S[0]]\nfor x in S[1:]:\n if len(temp) == 0:\n temp.append(x)\n elif temp[-1] == x:\n temp.append(x)\n else:\n temp.pop(-1)\nprint((length - len(temp)))\n", "code_v1_no_empty_lines": "def main():\n A = input()\n print((2 * min(A.count(\"0\"), A.count(\"1\"))))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-S = [int(_) for _ in input()]", "-length = len(S)", "-temp = [S[0]]", "-for x in S[1:]:", "- if len(temp) == 0:", "- temp.append(x)", "- elif temp[-1] == x:", "- temp.append(x)", "- else:", "- temp.pop(-1)", "-print((length - len(temp)))", "+def main():", "+ A = input()", "+ print((2 * min(A.count(\"0\"), A.count(\"1\"))))", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2279973624, "measured_runtime_v1": 0.00614361, "runtime_lift": 37.1113013328, "key": ["s353947972", "s266533401"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u423966555", "problem_id": "p02596", "language": "python", "submission_id_v0": "s734835984", "submission_id_v1": "s256781932", "cpu_time_v0": 338, "cpu_time_v1": 178, "memory_v0": 16560, "memory_v1": 9056, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 47.34, "input": "K = int(input())\n\n\n\nflg = [False]*K\n\n\n\ntmp = 7 % K\n\ncnt = 1\n\nif tmp == 0:\n\n print(cnt)\n\n exit()\n\nwhile True:\n\n tmp = (tmp*10+7)%K\n\n if flg[tmp]:\n\n print((-1))\n\n break\n\n else:\n\n cnt += 1\n\n if tmp == 0:\n\n print(cnt)\n\n break\n\n flg[tmp] = True\n", "target": "K = int(input())\n\nt = 7\n\nt %= K\n\n\n\nfor i in range(K+1):\n\n if t == 0:\n\n print((i+1))\n\n exit()\n\n t = (t*10+7)%K\n\nprint((-1))\n", "code_v0_loc": 20, "code_v1_loc": 10, "code_v0_num_chars": 310, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "K = int(input())\nflg = [False] * K\ntmp = 7 % K\ncnt = 1\nif tmp == 0:\n print(cnt)\n exit()\nwhile True:\n tmp = (tmp * 10 + 7) % K\n if flg[tmp]:\n print((-1))\n break\n else:\n cnt += 1\n if tmp == 0:\n print(cnt)\n break\n flg[tmp] = True\n", "code_v1_no_empty_lines": "K = int(input())\nt = 7\nt %= K\nfor i in range(K + 1):\n if t == 0:\n print((i + 1))\n exit()\n t = (t * 10 + 7) % K\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-flg = [False] * K", "-tmp = 7 % K", "-cnt = 1", "-if tmp == 0:", "- print(cnt)", "- exit()", "-while True:", "- tmp = (tmp * 10 + 7) % K", "- if flg[tmp]:", "- print((-1))", "- break", "- else:", "- cnt += 1", "- if tmp == 0:", "- print(cnt)", "- break", "- flg[tmp] = True", "+t = 7", "+t %= K", "+for i in range(K + 1):", "+ if t == 0:", "+ print((i + 1))", "+ exit()", "+ t = (t * 10 + 7) % K", "+print((-1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6767371264, "measured_runtime_v1": 0.4369205115, "runtime_lift": 1.5488792779, "key": ["s734835984", "s256781932"], "target_token_count_dream": 56, "target_token_bucket_dream": "<128"} +{"user_id": "u239981649", "problem_id": "p03796", "language": "python", "submission_id_v0": "s383796227", "submission_id_v1": "s138334572", "cpu_time_v0": 232, "cpu_time_v1": 34, "memory_v0": 3972, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.34, "input": "from math import factorial\n\nprint((factorial(int(input())) % (10**9+7)))", "target": "ans = 1\n\nfor k in range(1, int(input())+1):\n\n ans = ans*k % (10**9+7)\n\nprint(ans)", "code_v0_loc": 2, "code_v1_loc": 4, "code_v0_num_chars": 70, "code_v1_num_chars": 84, "code_v0_no_empty_lines": "from math import factorial\n\nprint((factorial(int(input())) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nfor k in range(1, int(input()) + 1):\n ans = ans * k % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-from math import factorial", "-", "-print((factorial(int(input())) % (10**9 + 7)))", "+ans = 1", "+for k in range(1, int(input()) + 1):", "+ ans = ans * k % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3382144179, "measured_runtime_v1": 0.1644267938, "runtime_lift": 2.0569300785, "key": ["s383796227", "s138334572"], "target_token_count_dream": 35, "target_token_bucket_dream": "<128"} +{"user_id": "u761320129", "problem_id": "p03822", "language": "python", "submission_id_v0": "s508015569", "submission_id_v1": "s203932637", "cpu_time_v0": 763, "cpu_time_v1": 637, "memory_v0": 227992, "memory_v1": 123792, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.51, "input": "import sys\n\nsys.setrecursionlimit(202020)\n\n\n\nN = int(input())\n\nwon = [[] for i in range(N)]\n\nfor i in range(1,N):\n\n a = int(input()) - 1\n\n won[a].append(i)\n\n\n\ndef height(v):\n\n if not won[v]: return 0\n\n hs = [height(op) for op in won[v]]\n\n ret = 0\n\n for i,h in enumerate(sorted(hs)):\n\n ret = max(ret, h + len(hs) - i)\n\n return ret\n\n\n\nprint((height(0)))", "target": "import sys\n\nsys.setrecursionlimit(10**8)\n\nN = int(input())\n\nA = [int(input())-1 for i in range(N-1)]\n\nwins = [[] for _ in range(N)]\n\n\n\nfor i,a in enumerate(A):\n\n wins[a].append(i+1)\n\n\n\ndepth = [-1] * N\n\ndef dep(v):\n\n if len(wins[v])==0: return 0\n\n if depth[v] >= 0:\n\n return depth[v]\n\n ds = []\n\n for w in wins[v]:\n\n ds.append(dep(w))\n\n ds.sort(reverse=True)\n\n ret = 0\n\n for i,d in enumerate(ds):\n\n ret = max(ret, i+d+1)\n\n depth[v] = ret\n\n return ret\n\nprint((dep(0)))", "code_v0_loc": 18, "code_v1_loc": 24, "code_v0_num_chars": 377, "code_v1_num_chars": 515, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(202020)\nN = int(input())\nwon = [[] for i in range(N)]\nfor i in range(1, N):\n a = int(input()) - 1\n won[a].append(i)\n\n\ndef height(v):\n if not won[v]:\n return 0\n hs = [height(op) for op in won[v]]\n ret = 0\n for i, h in enumerate(sorted(hs)):\n ret = max(ret, h + len(hs) - i)\n return ret\n\n\nprint((height(0)))\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**8)\nN = int(input())\nA = [int(input()) - 1 for i in range(N - 1)]\nwins = [[] for _ in range(N)]\nfor i, a in enumerate(A):\n wins[a].append(i + 1)\ndepth = [-1] * N\n\n\ndef dep(v):\n if len(wins[v]) == 0:\n return 0\n if depth[v] >= 0:\n return depth[v]\n ds = []\n for w in wins[v]:\n ds.append(dep(w))\n ds.sort(reverse=True)\n ret = 0\n for i, d in enumerate(ds):\n ret = max(ret, i + d + 1)\n depth[v] = ret\n return ret\n\n\nprint((dep(0)))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-sys.setrecursionlimit(202020)", "+sys.setrecursionlimit(10**8)", "-won = [[] for i in range(N)]", "-for i in range(1, N):", "- a = int(input()) - 1", "- won[a].append(i)", "+A = [int(input()) - 1 for i in range(N - 1)]", "+wins = [[] for _ in range(N)]", "+for i, a in enumerate(A):", "+ wins[a].append(i + 1)", "+depth = [-1] * N", "-def height(v):", "- if not won[v]:", "+def dep(v):", "+ if len(wins[v]) == 0:", "- hs = [height(op) for op in won[v]]", "+ if depth[v] >= 0:", "+ return depth[v]", "+ ds = []", "+ for w in wins[v]:", "+ ds.append(dep(w))", "+ ds.sort(reverse=True)", "- for i, h in enumerate(sorted(hs)):", "- ret = max(ret, h + len(hs) - i)", "+ for i, d in enumerate(ds):", "+ ret = max(ret, i + d + 1)", "+ depth[v] = ret", "-print((height(0)))", "+print((dep(0)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3026691139, "measured_runtime_v1": 0.2050500124, "runtime_lift": 1.4760745946, "key": ["s508015569", "s203932637"], "target_token_count_dream": 165, "target_token_bucket_dream": "128-256"} +{"user_id": "u263737105", "problem_id": "p02595", "language": "python", "submission_id_v0": "s947121829", "submission_id_v1": "s479170385", "cpu_time_v0": 481, "cpu_time_v1": 391, "memory_v0": 9072, "memory_v1": 9124, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.71, "input": "N, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a**2 + b**2) <= D**2:\n\n count += 1\n\nprint(count)\n", "target": "N, D = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n if (a*a + b*b) <= D*D:\n\n count += 1\n\nprint(count)\n", "code_v0_loc": 7, "code_v1_loc": 7, "code_v0_num_chars": 167, "code_v1_num_chars": 164, "code_v0_no_empty_lines": "N, D = list(map(int, input().split()))\ncount = 0\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if (a**2 + b**2) <= D**2:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "N, D = list(map(int, input().split()))\ncount = 0\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if (a * a + b * b) <= D * D:\n count += 1\nprint(count)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if (a**2 + b**2) <= D**2:", "+ if (a * a + b * b) <= D * D:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2832637064, "measured_runtime_v1": 0.1751975398, "runtime_lift": 1.6168246811, "key": ["s947121829", "s479170385"], "target_token_count_dream": 58, "target_token_bucket_dream": "<128"} +{"user_id": "u077291787", "problem_id": "p03309", "language": "python", "submission_id_v0": "s828043733", "submission_id_v1": "s360156642", "cpu_time_v0": 210, "cpu_time_v1": 183, "memory_v0": 27472, "memory_v1": 25324, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.86, "input": "# ABC102C - Linear Approximation (ARC100C)\n\nfrom statistics import median\n\n\n\n\n\ndef main():\n\n n = int(input())\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = tuple(j - i for i, j in enumerate(A, start=1))\n\n b = median(A)\n\n ans = sum(abs(a - b) for a in A)\n\n print((int(ans)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "# ABC102C - Linear Approximation (ARC100C)\n\ndef main():\n\n n = int(input())\n\n A = tuple(map(int, input().rstrip().split()))\n\n A = sorted(j - i for i, j in enumerate(A, start=1))\n\n b = A[n // 2]\n\n ans = sum(abs(a - b) for a in A)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 15, "code_v1_loc": 12, "code_v0_num_chars": 341, "code_v1_num_chars": 302, "code_v0_no_empty_lines": "# ABC102C - Linear Approximation (ARC100C)\nfrom statistics import median\n\n\ndef main():\n n = int(input())\n A = tuple(map(int, input().rstrip().split()))\n A = tuple(j - i for i, j in enumerate(A, start=1))\n b = median(A)\n ans = sum(abs(a - b) for a in A)\n print((int(ans)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# ABC102C - Linear Approximation (ARC100C)\ndef main():\n n = int(input())\n A = tuple(map(int, input().rstrip().split()))\n A = sorted(j - i for i, j in enumerate(A, start=1))\n b = A[n // 2]\n ans = sum(abs(a - b) for a in A)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-from statistics import median", "-", "-", "- A = tuple(j - i for i, j in enumerate(A, start=1))", "- b = median(A)", "+ A = sorted(j - i for i, j in enumerate(A, start=1))", "+ b = A[n // 2]", "- print((int(ans)))", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2185840318, "measured_runtime_v1": 0.1650515537, "runtime_lift": 1.3243379227, "key": ["s828043733", "s360156642"], "target_token_count_dream": 97, "target_token_bucket_dream": "<128"} +{"user_id": "u260980560", "problem_id": "p01105", "language": "python", "submission_id_v0": "s457180384", "submission_id_v1": "s699385465", "cpu_time_v0": 130, "cpu_time_v1": 50, "memory_v0": 7848, "memory_v1": 7824, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.54, "input": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nL = {el: 1 for el in [a, b, c, d, e, 0]}\n\nfor i in range(6):\n\n R = sorted(L.items(), key=lambda x: x[1])\n\n for p, l in R:\n\n if l < 16:\n\n L[p ^ e] = min(L.get(p ^ e, 16), l+1)\n\n if l+3 < 16:\n\n for q, r in R:\n\n if l+r+3 <= 16:\n\n L[p & q] = min(L.get(p & q, 16), l+r+3)\n\n L[p ^ q] = min(L.get(p ^ q, 16), l+r+3)\n\n else: break\n\n else: break\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n", "target": "a=65280; b=61680; c=52428; d=43690; e=65535\n\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\n\nQ = [(1, el) for el in base]\n\nL = {el: 1 for el in base}\n\nH = []\n\nwhile Q:\n\n l, p = heappop(Q)\n\n if L[p] < l: continue\n\n if l+1 < L.get(p ^ e, 17):\n\n L[p^e] = l+1\n\n if l+1 < 16: heappush(Q, (l+1, p^e))\n\n if l+3 < 16:\n\n for q, r in H:\n\n if l+r+3 <= 16:\n\n if l+r+3 < L.get(p & q, 17):\n\n L[p & q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p & q))\n\n if l+r+3 < L.get(p ^ q, 17):\n\n L[p ^ q] = l+r+3\n\n if l+r+3 < 16: heappush(Q, (l+r+3, p ^ q))\n\n else: break\n\n if l < 7: H.append((p, l))\n\nprint(*(L[e & eval(s)] for s in open(0).read().replace(*\"-~\").replace(*\"*&\").replace(*\"1e\").split()[:-1]),sep='\\n')\n", "code_v0_loc": 15, "code_v1_loc": 24, "code_v0_num_chars": 639, "code_v1_num_chars": 874, "code_v0_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nL = {el: 1 for el in [a, b, c, d, e, 0]}\nfor i in range(6):\n R = sorted(L.items(), key=lambda x: x[1])\n for p, l in R:\n if l < 16:\n L[p ^ e] = min(L.get(p ^ e, 16), l + 1)\n if l + 3 < 16:\n for q, r in R:\n if l + r + 3 <= 16:\n L[p & q] = min(L.get(p & q, 16), l + r + 3)\n L[p ^ q] = min(L.get(p ^ q, 16), l + r + 3)\n else:\n break\n else:\n break\nprint(\n *(\n L[e & eval(s)]\n for s in open(0)\n .read()\n .replace(*\"-~\")\n .replace(*\"*&\")\n .replace(*\"1e\")\n .split()[:-1]\n ),\n sep=\"\\n\"\n)\n", "code_v1_no_empty_lines": "a = 65280\nb = 61680\nc = 52428\nd = 43690\ne = 65535\nfrom heapq import heappush, heappop\n\nbase = [a, b, c, d, e, 0]\nQ = [(1, el) for el in base]\nL = {el: 1 for el in base}\nH = []\nwhile Q:\n l, p = heappop(Q)\n if L[p] < l:\n continue\n if l + 1 < L.get(p ^ e, 17):\n L[p ^ e] = l + 1\n if l + 1 < 16:\n heappush(Q, (l + 1, p ^ e))\n if l + 3 < 16:\n for q, r in H:\n if l + r + 3 <= 16:\n if l + r + 3 < L.get(p & q, 17):\n L[p & q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p & q))\n if l + r + 3 < L.get(p ^ q, 17):\n L[p ^ q] = l + r + 3\n if l + r + 3 < 16:\n heappush(Q, (l + r + 3, p ^ q))\n else:\n break\n if l < 7:\n H.append((p, l))\nprint(\n *(\n L[e & eval(s)]\n for s in open(0)\n .read()\n .replace(*\"-~\")\n .replace(*\"*&\")\n .replace(*\"1e\")\n .split()[:-1]\n ),\n sep=\"\\n\"\n)\n", "code_same": false, "relative_loc_diff_percent": 37.5, "diff": ["-L = {el: 1 for el in [a, b, c, d, e, 0]}", "-for i in range(6):", "- R = sorted(L.items(), key=lambda x: x[1])", "- for p, l in R:", "- if l < 16:", "- L[p ^ e] = min(L.get(p ^ e, 16), l + 1)", "- if l + 3 < 16:", "- for q, r in R:", "- if l + r + 3 <= 16:", "- L[p & q] = min(L.get(p & q, 16), l + r + 3)", "- L[p ^ q] = min(L.get(p ^ q, 16), l + r + 3)", "- else:", "- break", "- else:", "- break", "+from heapq import heappush, heappop", "+", "+base = [a, b, c, d, e, 0]", "+Q = [(1, el) for el in base]", "+L = {el: 1 for el in base}", "+H = []", "+while Q:", "+ l, p = heappop(Q)", "+ if L[p] < l:", "+ continue", "+ if l + 1 < L.get(p ^ e, 17):", "+ L[p ^ e] = l + 1", "+ if l + 1 < 16:", "+ heappush(Q, (l + 1, p ^ e))", "+ if l + 3 < 16:", "+ for q, r in H:", "+ if l + r + 3 <= 16:", "+ if l + r + 3 < L.get(p & q, 17):", "+ L[p & q] = l + r + 3", "+ if l + r + 3 < 16:", "+ heappush(Q, (l + r + 3, p & q))", "+ if l + r + 3 < L.get(p ^ q, 17):", "+ L[p ^ q] = l + r + 3", "+ if l + r + 3 < 16:", "+ heappush(Q, (l + r + 3, p ^ q))", "+ else:", "+ break", "+ if l < 7:", "+ H.append((p, l))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.012686343, "measured_runtime_v1": 0.2560091887, "runtime_lift": 3.9556640457, "key": ["s457180384", "s699385465"], "target_token_count_dream": 368, "target_token_bucket_dream": "256-512"} +{"user_id": "u775681539", "problem_id": "p02792", "language": "python", "submission_id_v0": "s313172456", "submission_id_v1": "s731114638", "cpu_time_v0": 533, "cpu_time_v1": 247, "memory_v0": 3444, "memory_v1": 40556, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 53.66, "input": "#python3\n\nfrom collections import defaultdict\n\nfrom collections import namedtuple\n\n\n\nP = namedtuple('P', ['front', 'end'])\n\n\n\ndef f(x):\n\n return P(str(x)[0], str(x)[-1]) \n\n\n\ndef main():\n\n\n\n n = int(input())\n\n freq = defaultdict(int)\n\n\n\n for i in range(1, n+1):\n\n p = f(i)\n\n freq[p]+=1\n\n\n\n\n\n ans = 0\n\n for i in range(1, n + 1):\n\n p = f(i)\n\n q = (p.end, p.front)\n\n ans += freq[q]\n\n\n\n print(ans)\n\n\n\nmain()", "target": "import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom collections import defaultdict\n\n\n\ndef f(x):\n\n return (int(str(x)[0]), int(str(x)[-1])) \n\ndef main():\n\n N = int(readline())\n\n df = defaultdict(int)\n\n for i in range(1, N+1):\n\n df[f(i)] += 1\n\n ans = 0\n\n for i in range(1, 10):\n\n for j in range(1, 10):\n\n ans += df[(i, j)]*df[(j, i)]\n\n print(ans)\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 28, "code_v1_loc": 21, "code_v0_num_chars": 458, "code_v1_num_chars": 507, "code_v0_no_empty_lines": "# python3\nfrom collections import defaultdict\nfrom collections import namedtuple\n\nP = namedtuple(\"P\", [\"front\", \"end\"])\n\n\ndef f(x):\n return P(str(x)[0], str(x)[-1])\n\n\ndef main():\n n = int(input())\n freq = defaultdict(int)\n for i in range(1, n + 1):\n p = f(i)\n freq[p] += 1\n ans = 0\n for i in range(1, n + 1):\n p = f(i)\n q = (p.end, p.front)\n ans += freq[q]\n print(ans)\n\n\nmain()\n", "code_v1_no_empty_lines": "import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom collections import defaultdict\n\n\ndef f(x):\n return (int(str(x)[0]), int(str(x)[-1]))\n\n\ndef main():\n N = int(readline())\n df = defaultdict(int)\n for i in range(1, N + 1):\n df[f(i)] += 1\n ans = 0\n for i in range(1, 10):\n for j in range(1, 10):\n ans += df[(i, j)] * df[(j, i)]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-# python3", "+import sys", "+", "+read = sys.stdin.buffer.read", "+readline = sys.stdin.buffer.readline", "+readlines = sys.stdin.buffer.readlines", "-from collections import namedtuple", "-", "-P = namedtuple(\"P\", [\"front\", \"end\"])", "- return P(str(x)[0], str(x)[-1])", "+ return (int(str(x)[0]), int(str(x)[-1]))", "- n = int(input())", "- freq = defaultdict(int)", "- for i in range(1, n + 1):", "- p = f(i)", "- freq[p] += 1", "+ N = int(readline())", "+ df = defaultdict(int)", "+ for i in range(1, N + 1):", "+ df[f(i)] += 1", "- for i in range(1, n + 1):", "- p = f(i)", "- q = (p.end, p.front)", "- ans += freq[q]", "+ for i in range(1, 10):", "+ for j in range(1, 10):", "+ ans += df[(i, j)] * df[(j, i)]", "-main()", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4672443939, "measured_runtime_v1": 0.3355342689, "runtime_lift": 1.3925385189, "key": ["s313172456", "s731114638"], "target_token_count_dream": 151, "target_token_bucket_dream": "128-256"} +{"user_id": "u893063840", "problem_id": "p03038", "language": "python", "submission_id_v0": "s696312664", "submission_id_v1": "s914180377", "cpu_time_v0": 588, "cpu_time_v1": 493, "memory_v0": 32888, "memory_v1": 36036, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.16, "input": "n, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(key=lambda x: x[1], reverse=True)\n\na.sort()\n\n\n\ni = 0\n\nfor b, c in bc:\n\n for _ in range(b):\n\n if i < n and a[i] < c:\n\n a[i] = c\n\n i += 1\n\n else:\n\n break\n\n\n\nans = sum(a)\n\nprint(ans)\n", "target": "n, m = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nbc = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nbc.sort(reverse=True, key=lambda x: x[1])\n\n\n\nli = []\n\nl = 0\n\ni = 0\n\nwhile i < m and l < n:\n\n b, c = bc[i]\n\n li += [c] * b\n\n i += 1\n\n l += b\n\n\n\na += li\n\na.sort(reverse=True)\n\nans = sum(a[:n])\n\nprint(ans)\n", "code_v0_loc": 18, "code_v1_loc": 19, "code_v0_num_chars": 369, "code_v1_num_chars": 346, "code_v0_no_empty_lines": "n, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = [list(map(int, input().split())) for _ in range(m)]\nbc.sort(key=lambda x: x[1], reverse=True)\na.sort()\ni = 0\nfor b, c in bc:\n for _ in range(b):\n if i < n and a[i] < c:\n a[i] = c\n i += 1\n else:\n break\nans = sum(a)\nprint(ans)\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = [list(map(int, input().split())) for _ in range(m)]\nbc.sort(reverse=True, key=lambda x: x[1])\nli = []\nl = 0\ni = 0\nwhile i < m and l < n:\n b, c = bc[i]\n li += [c] * b\n i += 1\n l += b\na += li\na.sort(reverse=True)\nans = sum(a[:n])\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 5.2631578947, "diff": ["-bc.sort(key=lambda x: x[1], reverse=True)", "-a.sort()", "+bc.sort(reverse=True, key=lambda x: x[1])", "+li = []", "+l = 0", "-for b, c in bc:", "- for _ in range(b):", "- if i < n and a[i] < c:", "- a[i] = c", "- i += 1", "- else:", "- break", "-ans = sum(a)", "+while i < m and l < n:", "+ b, c = bc[i]", "+ li += [c] * b", "+ i += 1", "+ l += b", "+a += li", "+a.sort(reverse=True)", "+ans = sum(a[:n])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2346956289, "measured_runtime_v1": 0.006594183, "runtime_lift": 35.5913127767, "key": ["s696312664", "s914180377"], "target_token_count_dream": 123, "target_token_bucket_dream": "<128"} +{"user_id": "u078042885", "problem_id": "p01138", "language": "python", "submission_id_v0": "s367659771", "submission_id_v1": "s546819347", "cpu_time_v0": 8280, "cpu_time_v1": 5620, "memory_v0": 11712, "memory_v1": 11664, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.13, "input": "def f(s):\n\n s=list(map(int,s.split(':')))\n\n return (s[0]*60+s[1])*60+s[2]\n\na=86401\n\nwhile 1:\n\n t=[0]*a\n\n n=int(input())\n\n if n==0:break\n\n for _ in range(n):\n\n b,c=input().split()\n\n t[f(b)]+=1;t[f(c)]-=1\n\n d=0\n\n for i in range(1,a):\n\n t[i]+=t[i-1]\n\n d=max(d,t[i])\n\n print(d)", "target": "def f(s):\n\n return (s[0]*60+s[1])*60+s[2]\n\na=86400\n\nwhile 1:\n\n t=[0]*a\n\n n=int(input())\n\n if n==0:break\n\n for _ in range(n):\n\n b,c = [list(map(int,x.split(':'))) for x in input().split()]\n\n t[f(b)]+=1;t[f(c)]-=1\n\n d=0\n\n for i in range(1,a):\n\n t[i]+=t[i-1]\n\n if d dp[j] + a:\n\n dp[j | key] = dp[j] + a\n\n\n\nif dp[-1] == INF:\n\n print((-1))\n\nelse:\n\n print((dp[-1]))", "code_v0_loc": 25, "code_v1_loc": 26, "code_v0_num_chars": 505, "code_v1_num_chars": 522, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nN, M = list(map(int, readline().split()))\nINF = 10**10\ndp = [INF] * (2**N)\ndp[0] = 0\nfor i in range(M):\n a, b = list(map(int, readline().split()))\n c = list(map(int, readline().split()))\n key = 0\n for j in range(len(c)):\n key += 1 << (c[j] - 1)\n for j in range(len(dp)):\n if dp[j] == INF:\n continue\n if j | key == j:\n continue\n dp[j | key] = min(dp[j | key], dp[j] + a)\nif dp[-1] == INF:\n print((-1))\nelse:\n print((dp[-1]))\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nN, M = list(map(int, readline().split()))\nINF = 10**10\ndp = [INF] * (2**N)\ndp[0] = 0\nfor i in range(M):\n a, b = list(map(int, readline().split()))\n c = list(map(int, readline().split()))\n key = 0\n for j in range(len(c)):\n key += 1 << (c[j] - 1)\n for j in range(len(dp)):\n if dp[j] == INF:\n continue\n if j | key == j:\n continue\n if dp[j | key] > dp[j] + a:\n dp[j | key] = dp[j] + a\nif dp[-1] == INF:\n print((-1))\nelse:\n print((dp[-1]))\n", "code_same": false, "relative_loc_diff_percent": 3.8461538462, "diff": ["- dp[j | key] = min(dp[j | key], dp[j] + a)", "+ if dp[j | key] > dp[j] + a:", "+ dp[j | key] = dp[j] + a"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2747366824, "measured_runtime_v1": 0.0058527424, "runtime_lift": 46.941529559, "key": ["s462370890", "s446448975"], "target_token_count_dream": 191, "target_token_bucket_dream": "128-256"} +{"user_id": "u837673618", "problem_id": "p02721", "language": "python", "submission_id_v0": "s949081681", "submission_id_v1": "s434725940", "cpu_time_v0": 326, "cpu_time_v1": 177, "memory_v0": 12688, "memory_v1": 12576, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 45.71, "input": "N, K, C = list(map(int, input().split()))\n\nS = input()\n\n\n\nlatest = [None]*K\n\ni = len(S)+C\n\nfor j in range(K-1, -1, -1):\n\n i = S.rindex(\"o\", 0, i-C)\n\n latest[j] = i\n\n\n\nif i<=C or \"o\" not in S[:i-C]:\n\n i = -C-1\n\n for j in latest:\n\n i = S.index(\"o\", i+C+1)\n\n if i == j:\n\n print((i+1))\n", "target": "def solve():\n\n N, K, C = list(map(int, input().split()))\n\n workable = [i for i, s in enumerate(input()) if s==\"o\"]\n\n if len(workable) == K:\n\n return workable\n\n \n\n prev = workable[-1]\n\n latest = {prev}\n\n i = len(workable)-1\n\n while i > 0:\n\n i -= 1\n\n if prev - workable[i] > C:\n\n latest.add(workable[i])\n\n prev = workable[i]\n\n if len(latest) > K:\n\n return []\n\n must = []\n\n i = -1\n\n prev = -C-1\n\n while i < len(workable)-1:\n\n i += 1\n\n if workable[i] - prev > C:\n\n if workable[i] in latest:\n\n must.append(workable[i])\n\n prev = workable[i]\n\n return must\n\n\n\nfor i in solve():\n\n print((i+1))", "code_v0_loc": 15, "code_v1_loc": 29, "code_v0_num_chars": 289, "code_v1_num_chars": 646, "code_v0_no_empty_lines": "N, K, C = list(map(int, input().split()))\nS = input()\nlatest = [None] * K\ni = len(S) + C\nfor j in range(K - 1, -1, -1):\n i = S.rindex(\"o\", 0, i - C)\n latest[j] = i\nif i <= C or \"o\" not in S[: i - C]:\n i = -C - 1\n for j in latest:\n i = S.index(\"o\", i + C + 1)\n if i == j:\n print((i + 1))\n", "code_v1_no_empty_lines": "def solve():\n N, K, C = list(map(int, input().split()))\n workable = [i for i, s in enumerate(input()) if s == \"o\"]\n if len(workable) == K:\n return workable\n prev = workable[-1]\n latest = {prev}\n i = len(workable) - 1\n while i > 0:\n i -= 1\n if prev - workable[i] > C:\n latest.add(workable[i])\n prev = workable[i]\n if len(latest) > K:\n return []\n must = []\n i = -1\n prev = -C - 1\n while i < len(workable) - 1:\n i += 1\n if workable[i] - prev > C:\n if workable[i] in latest:\n must.append(workable[i])\n prev = workable[i]\n return must\n\n\nfor i in solve():\n print((i + 1))\n", "code_same": false, "relative_loc_diff_percent": 48.275862069, "diff": ["-N, K, C = list(map(int, input().split()))", "-S = input()", "-latest = [None] * K", "-i = len(S) + C", "-for j in range(K - 1, -1, -1):", "- i = S.rindex(\"o\", 0, i - C)", "- latest[j] = i", "-if i <= C or \"o\" not in S[: i - C]:", "- i = -C - 1", "- for j in latest:", "- i = S.index(\"o\", i + C + 1)", "- if i == j:", "- print((i + 1))", "+def solve():", "+ N, K, C = list(map(int, input().split()))", "+ workable = [i for i, s in enumerate(input()) if s == \"o\"]", "+ if len(workable) == K:", "+ return workable", "+ prev = workable[-1]", "+ latest = {prev}", "+ i = len(workable) - 1", "+ while i > 0:", "+ i -= 1", "+ if prev - workable[i] > C:", "+ latest.add(workable[i])", "+ prev = workable[i]", "+ if len(latest) > K:", "+ return []", "+ must = []", "+ i = -1", "+ prev = -C - 1", "+ while i < len(workable) - 1:", "+ i += 1", "+ if workable[i] - prev > C:", "+ if workable[i] in latest:", "+ must.append(workable[i])", "+ prev = workable[i]", "+ return must", "+", "+", "+for i in solve():", "+ print((i + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3840038183, "measured_runtime_v1": 0.2943901448, "runtime_lift": 1.3044044613, "key": ["s949081681", "s434725940"], "target_token_count_dream": 209, "target_token_bucket_dream": "128-256"} +{"user_id": "u628794221", "problem_id": "p02688", "language": "python", "submission_id_v0": "s048784054", "submission_id_v1": "s441243732", "cpu_time_v0": 24, "cpu_time_v1": 20, "memory_v0": 9192, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.67, "input": "N, K = list(map(int, input().split()))\n\nsunuke = [True]*N\n\nfor i in range(K):\n\n d = int(input())\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n sunuke[a-1] = False\n\n\n\nans = 0\n\nfor i in range(N):\n\n if sunuke[i]:\n\n ans += 1\n\nprint(ans)", "target": "N, K = list(map(int, input().split()))\n\nflag = [True]*N\n\nfor i in range(K):\n\n d = int(input())\n\n A = list(map(int, input().split()))\n\n for a in A:\n\n flag[a-1] = False\n\nans = 0\n\nfor i in range(N):\n\n if flag[i]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 12, "code_v0_num_chars": 260, "code_v1_num_chars": 252, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\nsunuke = [True] * N\nfor i in range(K):\n d = int(input())\n A = list(map(int, input().split()))\n for a in A:\n sunuke[a - 1] = False\nans = 0\nfor i in range(N):\n if sunuke[i]:\n ans += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\nflag = [True] * N\nfor i in range(K):\n d = int(input())\n A = list(map(int, input().split()))\n for a in A:\n flag[a - 1] = False\nans = 0\nfor i in range(N):\n if flag[i]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["-sunuke = [True] * N", "+flag = [True] * N", "- sunuke[a - 1] = False", "+ flag[a - 1] = False", "- if sunuke[i]:", "+ if flag[i]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3757941551, "measured_runtime_v1": 0.2950303654, "runtime_lift": 1.2737473806, "key": ["s048784054", "s441243732"], "target_token_count_dream": 82, "target_token_bucket_dream": "<128"} +{"user_id": "u057964173", "problem_id": "p03796", "language": "python", "submission_id_v0": "s018166938", "submission_id_v1": "s633160279", "cpu_time_v0": 298, "cpu_time_v1": 42, "memory_v0": 42992, "memory_v1": 28396, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 85.91, "input": "import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n import math\n\n n=int(input())\n\n print((math.factorial(n)%(10**9+7)))\n\nresolve()", "target": "import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n answer=1\n\n n=int(input())\n\n for i in range(1,n+1):\n\n answer*=i\n\n answer%=10**9+7\n\n print(answer)\n\nresolve()", "code_v0_loc": 8, "code_v1_loc": 11, "code_v0_num_chars": 166, "code_v1_num_chars": 214, "code_v0_no_empty_lines": "import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n import math\n\n n = int(input())\n print((math.factorial(n) % (10**9 + 7)))\n\n\nresolve()\n", "code_v1_no_empty_lines": "import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n answer = 1\n n = int(input())\n for i in range(1, n + 1):\n answer *= i\n answer %= 10**9 + 7\n print(answer)\n\n\nresolve()\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["- import math", "-", "+ answer = 1", "- print((math.factorial(n) % (10**9 + 7)))", "+ for i in range(1, n + 1):", "+ answer *= i", "+ answer %= 10**9 + 7", "+ print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5731575236, "measured_runtime_v1": 0.2333363581, "runtime_lift": 2.4563575447, "key": ["s018166938", "s633160279"], "target_token_count_dream": 58, "target_token_bucket_dream": "<128"} +{"user_id": "u983918956", "problem_id": "p03416", "language": "python", "submission_id_v0": "s018952102", "submission_id_v1": "s778219351", "cpu_time_v0": 118, "cpu_time_v1": 60, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 49.15, "input": "A,B = list(map(int,input().split()))\n\nj = 0\n\nfor i in range(A,B+1):\n\n l = list(str(i))\n\n l_reverse = list(reversed(l))\n\n if l == l_reverse:\n\n j += 1\n\nprint(j)", "target": "A, B = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor n in range(A, B+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 158, "code_v1_num_chars": 135, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\nj = 0\nfor i in range(A, B + 1):\n l = list(str(i))\n l_reverse = list(reversed(l))\n if l == l_reverse:\n j += 1\nprint(j)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor n in range(A, B + 1):\n n = str(n)\n if n == n[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-j = 0", "-for i in range(A, B + 1):", "- l = list(str(i))", "- l_reverse = list(reversed(l))", "- if l == l_reverse:", "- j += 1", "-print(j)", "+ans = 0", "+for n in range(A, B + 1):", "+ n = str(n)", "+ if n == n[::-1]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4538340874, "measured_runtime_v1": 0.3384370139, "runtime_lift": 1.340970605, "key": ["s018952102", "s778219351"], "target_token_count_dream": 50, "target_token_bucket_dream": "<128"} +{"user_id": "u811841526", "problem_id": "p02390", "language": "python", "submission_id_v0": "s941329471", "submission_id_v1": "s549187322", "cpu_time_v0": 40, "cpu_time_v1": 20, "memory_v0": 7664, "memory_v1": 5592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "s = int(input())\n\nm, s = s // 60, s % 60\n\nh, m = m // 60, m % 60\n\nprint((':'.join(map(str, [h,m,s]))))", "target": "s = int(input())\n\n\n\nsecond = s % 60\n\ns = s // 60\n\nmin = s % 60\n\nhour = s // 60\n\n\n\nprint(f'{hour}:{min}:{second}')\n", "code_v0_loc": 4, "code_v1_loc": 8, "code_v0_num_chars": 100, "code_v1_num_chars": 114, "code_v0_no_empty_lines": "s = int(input())\nm, s = s // 60, s % 60\nh, m = m // 60, m % 60\nprint((\":\".join(map(str, [h, m, s]))))\n", "code_v1_no_empty_lines": "s = int(input())\nsecond = s % 60\ns = s // 60\nmin = s % 60\nhour = s // 60\nprint(f\"{hour}:{min}:{second}\")\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-m, s = s // 60, s % 60", "-h, m = m // 60, m % 60", "-print((\":\".join(map(str, [h, m, s]))))", "+second = s % 60", "+s = s // 60", "+min = s % 60", "+hour = s // 60", "+print(f\"{hour}:{min}:{second}\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1672595444, "measured_runtime_v1": 0.0066597962, "runtime_lift": 25.1148140492, "key": ["s941329471", "s549187322"], "target_token_count_dream": 47, "target_token_bucket_dream": "<128"} +{"user_id": "u488127128", "problem_id": "p03796", "language": "python", "submission_id_v0": "s848409194", "submission_id_v1": "s870468874", "cpu_time_v0": 231, "cpu_time_v1": 35, "memory_v0": 4020, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.85, "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "target": "import math\n\nN = int(input())\n\na = 1\n\nfor n in range(2,N+1):\n\n a = a*n % (10**9+7)\n\nprint(a)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 65, "code_v1_num_chars": 95, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "import math\n\nN = int(input())\na = 1\nfor n in range(2, N + 1):\n a = a * n % (10**9 + 7)\nprint(a)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-print((math.factorial(N) % (10**9 + 7)))", "+a = 1", "+for n in range(2, N + 1):", "+ a = a * n % (10**9 + 7)", "+print(a)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8454835632, "measured_runtime_v1": 0.3383059211, "runtime_lift": 2.4991686828, "key": ["s848409194", "s870468874"], "target_token_count_dream": 40, "target_token_bucket_dream": "<128"} +{"user_id": "u754022296", "problem_id": "p03819", "language": "python", "submission_id_v0": "s951638556", "submission_id_v1": "s089571448", "cpu_time_v0": 1762, "cpu_time_v1": 852, "memory_v0": 127784, "memory_v1": 82324, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 51.65, "input": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = map(int, input().split())\n\n LR = [list(map(int, input().split())) for _ in range(n)]\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n \n\n S = sorted([(r-l+1, l, r) for l, r in LR], reverse=True)\n\n cnt = n\n\n L = []\n\n for i in range(1, m+1):\n\n while S and S[-1][0] == i:\n\n c, l, r = S.pop()\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n L.append(res)\n\n print(*L, sep=\"\\n\")\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = list(map(int, input().split()))\n\n S = [[] for _ in range(m+1)]\n\n for _ in range(n):\n\n l, r = list(map(int, input().split()))\n\n S[r-l+1].append((l, r))\n\n \n\n BIT = [0]*(m+2)\n\n def add(i, a):\n\n while i <= m+1:\n\n BIT[i] += a\n\n i += i&(-i)\n\n def bit_sum(i):\n\n res = 0\n\n while i > 0:\n\n res += BIT[i]\n\n i -= i&(-i)\n\n return res\n\n cnt = n\n\n for i in range(1, m+1):\n\n for l, r in S[i]:\n\n cnt -= 1\n\n add(l, 1)\n\n add(r+1, -1)\n\n res = cnt\n\n for j in range(0, m+1, i):\n\n res += bit_sum(j)\n\n print(res)\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 36, "code_v1_loc": 34, "code_v0_num_chars": 731, "code_v1_num_chars": 658, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, m = map(int, input().split())\n LR = [list(map(int, input().split())) for _ in range(n)]\n BIT = [0] * (m + 2)\n\n def add(i, a):\n while i <= m + 1:\n BIT[i] += a\n i += i & (-i)\n\n def bit_sum(i):\n res = 0\n while i > 0:\n res += BIT[i]\n i -= i & (-i)\n return res\n\n S = sorted([(r - l + 1, l, r) for l, r in LR], reverse=True)\n cnt = n\n L = []\n for i in range(1, m + 1):\n while S and S[-1][0] == i:\n c, l, r = S.pop()\n cnt -= 1\n add(l, 1)\n add(r + 1, -1)\n res = cnt\n for j in range(0, m + 1, i):\n res += bit_sum(j)\n L.append(res)\n print(*L, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, m = list(map(int, input().split()))\n S = [[] for _ in range(m + 1)]\n for _ in range(n):\n l, r = list(map(int, input().split()))\n S[r - l + 1].append((l, r))\n BIT = [0] * (m + 2)\n\n def add(i, a):\n while i <= m + 1:\n BIT[i] += a\n i += i & (-i)\n\n def bit_sum(i):\n res = 0\n while i > 0:\n res += BIT[i]\n i -= i & (-i)\n return res\n\n cnt = n\n for i in range(1, m + 1):\n for l, r in S[i]:\n cnt -= 1\n add(l, 1)\n add(r + 1, -1)\n res = cnt\n for j in range(0, m + 1, i):\n res += bit_sum(j)\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 5.5555555556, "diff": ["- n, m = map(int, input().split())", "- LR = [list(map(int, input().split())) for _ in range(n)]", "+ n, m = list(map(int, input().split()))", "+ S = [[] for _ in range(m + 1)]", "+ for _ in range(n):", "+ l, r = list(map(int, input().split()))", "+ S[r - l + 1].append((l, r))", "- S = sorted([(r - l + 1, l, r) for l, r in LR], reverse=True)", "- L = []", "- while S and S[-1][0] == i:", "- c, l, r = S.pop()", "+ for l, r in S[i]:", "- L.append(res)", "- print(*L, sep=\"\\n\")", "+ print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3067650649, "measured_runtime_v1": 0.0989195189, "runtime_lift": 3.1011580763, "key": ["s951638556", "s089571448"], "target_token_count_dream": 238, "target_token_bucket_dream": "128-256"} +{"user_id": "u550574002", "problem_id": "p03126", "language": "python", "submission_id_v0": "s757696098", "submission_id_v1": "s038854174", "cpu_time_v0": 23, "cpu_time_v1": 19, "memory_v0": 3572, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.39, "input": "import functools\n\nprint((len(functools.reduce(lambda x, y: x&y,[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))", "target": "print((len(set.intersection(*[set(input().split()[1:]) for _ in [0]*int(input().split()[0])]))))", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 128, "code_v1_num_chars": 94, "code_v0_no_empty_lines": "import functools\n\nprint(\n (\n len(\n functools.reduce(\n lambda x, y: x & y,\n [set(input().split()[1:]) for _ in [0] * int(input().split()[0])],\n )\n )\n )\n)\n", "code_v1_no_empty_lines": "print(\n (\n len(\n set.intersection(\n *[set(input().split()[1:]) for _ in [0] * int(input().split()[0])]\n )\n )\n )\n)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import functools", "-", "- functools.reduce(", "- lambda x, y: x & y,", "- [set(input().split()[1:]) for _ in [0] * int(input().split()[0])],", "+ set.intersection(", "+ *[set(input().split()[1:]) for _ in [0] * int(input().split()[0])]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2541026509, "measured_runtime_v1": 0.0938221338, "runtime_lift": 2.7083444025, "key": ["s757696098", "s038854174"], "target_token_count_dream": 29, "target_token_bucket_dream": "<128"} +{"user_id": "u046187684", "problem_id": "p03480", "language": "python", "submission_id_v0": "s964601714", "submission_id_v1": "s413566853", "cpu_time_v0": 40, "cpu_time_v1": 33, "memory_v0": 6244, "memory_v1": 6388, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.5, "input": "#!/usr/bin/env python3\n\n# coding=utf-8\n\n\n\nimport sys\n\n\n\ns = sys.stdin.readline().strip()\n\nl = [_s is \"1\" for _s in list(s)]\n\nl_r = l[::-1]\n\nindex = 0\n\nfor i, (c, n, c_r, n_r) in enumerate(\n\n zip(l[:len(s) // 2], l[1:len(s) // 2 + 1], l_r[:len(s) // 2], l_r[1:len(s) // 2 + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\nprint((len(s) - index))", "target": "def solve(string):\n\n l = [s == \"1\" for s in string]\n\n l_r = l[::-1]\n\n index = 0\n\n h = len(string) // 2\n\n for i, (c, n, c_r, n_r) in enumerate(zip(l[:h], l[1:h + 1], l_r[:h], l_r[1:h + 1])):\n\n if c ^ n or c_r ^ n_r:\n\n index = i + 1\n\n return str(len(string) - index)\n\n\n\n\n\nif __name__ == '__main__':\n\n print((solve(input())))\n", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 359, "code_v1_num_chars": 360, "code_v0_no_empty_lines": "#!/usr/bin/env python3\n# coding=utf-8\nimport sys\n\ns = sys.stdin.readline().strip()\nl = [_s is \"1\" for _s in list(s)]\nl_r = l[::-1]\nindex = 0\nfor i, (c, n, c_r, n_r) in enumerate(\n zip(\n l[: len(s) // 2],\n l[1 : len(s) // 2 + 1],\n l_r[: len(s) // 2],\n l_r[1 : len(s) // 2 + 1],\n )\n):\n if c ^ n or c_r ^ n_r:\n index = i + 1\nprint((len(s) - index))\n", "code_v1_no_empty_lines": "def solve(string):\n l = [s == \"1\" for s in string]\n l_r = l[::-1]\n index = 0\n h = len(string) // 2\n for i, (c, n, c_r, n_r) in enumerate(\n zip(l[:h], l[1 : h + 1], l_r[:h], l_r[1 : h + 1])\n ):\n if c ^ n or c_r ^ n_r:\n index = i + 1\n return str(len(string) - index)\n\n\nif __name__ == \"__main__\":\n print((solve(input())))\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-#!/usr/bin/env python3", "-# coding=utf-8", "-import sys", "+def solve(string):", "+ l = [s == \"1\" for s in string]", "+ l_r = l[::-1]", "+ index = 0", "+ h = len(string) // 2", "+ for i, (c, n, c_r, n_r) in enumerate(", "+ zip(l[:h], l[1 : h + 1], l_r[:h], l_r[1 : h + 1])", "+ ):", "+ if c ^ n or c_r ^ n_r:", "+ index = i + 1", "+ return str(len(string) - index)", "-s = sys.stdin.readline().strip()", "-l = [_s is \"1\" for _s in list(s)]", "-l_r = l[::-1]", "-index = 0", "-for i, (c, n, c_r, n_r) in enumerate(", "- zip(", "- l[: len(s) // 2],", "- l[1 : len(s) // 2 + 1],", "- l_r[: len(s) // 2],", "- l_r[1 : len(s) // 2 + 1],", "- )", "-):", "- if c ^ n or c_r ^ n_r:", "- index = i + 1", "-print((len(s) - index))", "+", "+if __name__ == \"__main__\":", "+ print((solve(input())))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3417459049, "measured_runtime_v1": 0.2085829885, "runtime_lift": 1.6384169551, "key": ["s964601714", "s413566853"], "target_token_count_dream": 131, "target_token_bucket_dream": "128-256"} +{"user_id": "u801359367", "problem_id": "p03325", "language": "python", "submission_id_v0": "s586527827", "submission_id_v1": "s564078636", "cpu_time_v0": 89, "cpu_time_v1": 80, "memory_v0": 4148, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.11, "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\n\n\nSUM = 0\n\nfor i in A:\n\n count = 0\n\n while i%2 == 0:\n\n i//=2\n\n count += 1\n\n SUM+=count\n\nprint(SUM)", "target": "N = int(input())\n\nA = list(map(int,input().split()))\n\nSUM = 0\n\nfor i in A:\n\n while i%2 == 0:\n\n i//=2\n\n SUM += 1\n\nprint(SUM)", "code_v0_loc": 11, "code_v1_loc": 8, "code_v0_num_chars": 175, "code_v1_num_chars": 140, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nSUM = 0\nfor i in A:\n count = 0\n while i % 2 == 0:\n i //= 2\n count += 1\n SUM += count\nprint(SUM)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nSUM = 0\nfor i in A:\n while i % 2 == 0:\n i //= 2\n SUM += 1\nprint(SUM)\n", "code_same": false, "relative_loc_diff_percent": 27.2727272727, "diff": ["- count = 0", "- count += 1", "- SUM += count", "+ SUM += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3107097435, "measured_runtime_v1": 0.2124449382, "runtime_lift": 1.4625424646, "key": ["s586527827", "s564078636"], "target_token_count_dream": 48, "target_token_bucket_dream": "<128"} +{"user_id": "u253681061", "problem_id": "p03796", "language": "python", "submission_id_v0": "s618901729", "submission_id_v1": "s057938516", "cpu_time_v0": 49, "cpu_time_v1": 34, "memory_v0": 6900, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.61, "input": "n = int(input())\n\n\n\nINF = 10**9 + 7\n\n\n\nans = [0] * (10**5 + 1)\n\nans[0] = 1\n\n\n\nfor i in range(1,10**5 + 1):\n\n ans[i] = ans[i-1] * i % INF\n\n\n\nprint((ans[n]))\n", "target": "n = int(input())\n\nmod = 10**9 + 7\n\n\n\nans = 1\n\n\n\nfor i in range(1,n+1):\n\n ans = ans * i % mod\n\n\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 9, "code_v0_num_chars": 157, "code_v1_num_chars": 109, "code_v0_no_empty_lines": "n = int(input())\nINF = 10**9 + 7\nans = [0] * (10**5 + 1)\nans[0] = 1\nfor i in range(1, 10**5 + 1):\n ans[i] = ans[i - 1] * i % INF\nprint((ans[n]))\n", "code_v1_no_empty_lines": "n = int(input())\nmod = 10**9 + 7\nans = 1\nfor i in range(1, n + 1):\n ans = ans * i % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-INF = 10**9 + 7", "-ans = [0] * (10**5 + 1)", "-ans[0] = 1", "-for i in range(1, 10**5 + 1):", "- ans[i] = ans[i - 1] * i % INF", "-print((ans[n]))", "+mod = 10**9 + 7", "+ans = 1", "+for i in range(1, n + 1):", "+ ans = ans * i % mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8708683834, "measured_runtime_v1": 0.4576160941, "runtime_lift": 1.9030545354, "key": ["s618901729", "s057938516"], "target_token_count_dream": 43, "target_token_bucket_dream": "<128"} +{"user_id": "u813450984", "problem_id": "p03371", "language": "python", "submission_id_v0": "s722861535", "submission_id_v1": "s015018251", "cpu_time_v0": 77, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 77.92, "input": "a, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nm = max(x, y)\n\nfor i in range(1, m+1):\n\n x -= 1\n\n y -= 1\n\n if x < 0:\n\n x = 0\n\n if y < 0:\n\n y = 0\n\n temp = c*(i*2) + x*a + y*b\n\n if temp < ans:\n\n ans = temp\n\n\n\nprint(ans)\n", "target": "a, b, c, x, y = list(map(int, input().split()))\n\nans = a * x + b * y\n\nans = min(c * max(x, y) * 2, ans)\n\nif x < y:\n\n ans = min(c * x * 2 + (y - x) * b, ans)\n\nelse:\n\n ans = min(c * y * 2 + (x - y) * a, ans)\n\n\n\nprint(ans)", "code_v0_loc": 15, "code_v1_loc": 9, "code_v0_num_chars": 249, "code_v1_num_chars": 219, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nm = max(x, y)\nfor i in range(1, m + 1):\n x -= 1\n y -= 1\n if x < 0:\n x = 0\n if y < 0:\n y = 0\n temp = c * (i * 2) + x * a + y * b\n if temp < ans:\n ans = temp\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nans = min(c * max(x, y) * 2, ans)\nif x < y:\n ans = min(c * x * 2 + (y - x) * b, ans)\nelse:\n ans = min(c * y * 2 + (x - y) * a, ans)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-m = max(x, y)", "-for i in range(1, m + 1):", "- x -= 1", "- y -= 1", "- if x < 0:", "- x = 0", "- if y < 0:", "- y = 0", "- temp = c * (i * 2) + x * a + y * b", "- if temp < ans:", "- ans = temp", "+ans = min(c * max(x, y) * 2, ans)", "+if x < y:", "+ ans = min(c * x * 2 + (y - x) * b, ans)", "+else:", "+ ans = min(c * y * 2 + (x - y) * a, ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2966257923, "measured_runtime_v1": 0.2002350025, "runtime_lift": 1.4813883113, "key": ["s722861535", "s015018251"], "target_token_count_dream": 96, "target_token_bucket_dream": "<128"} +{"user_id": "u989345508", "problem_id": "p03798", "language": "python", "submission_id_v0": "s244589711", "submission_id_v1": "s160001244", "cpu_time_v0": 1408, "cpu_time_v1": 1267, "memory_v0": 3892, "memory_v1": 3880, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.01, "input": "n=int(input())\n\ns=input()\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\n\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if s[j+1]==\"o\":\n\n if x[i][j]==\"S\":\n\n x[i]+=\"W\"\n\n else:\n\n x[i]+=\"S\"\n\n else:\n\n if x[i][j]==\"S\":\n\n x[i]+=\"S\"\n\n else:\n\n x[i]+=\"W\"\n\n #print(x[i])\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n", "target": "n=int(input())\n\ns=input()\n\nx=[\"SS\",\"SW\",\"WS\",\"WW\"]\n\n\n\ndef check0(i):\n\n if x[i][0]==\"S\":\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if s[0]==\"o\":\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"W\"\n\n else:\n\n return x[i][1]==\"S\"\n\n else:\n\n if x[i][-1]==\"S\":\n\n return x[i][1]==\"S\"\n\n else:\n\n return x[i][1]==\"W\"\n\ndef check1(i):\n\n if x[i][n-1]==\"S\":\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if s[n-1]==\"o\":\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"W\"\n\n else:\n\n return x[i][0]==\"S\"\n\n else:\n\n if x[i][n-2]==\"S\":\n\n return x[i][0]==\"S\"\n\n else:\n\n return x[i][0]==\"W\"\n\n\n\na=[\"S\",\"W\"]\n\nfor i in range(4):\n\n for j in range(n-2):\n\n if x[i][j+1]==\"S\":\n\n if s[j+1]==\"o\":\n\n x[i]+=a[x[i][j]!=\"S\"]\n\n else:\n\n x[i]+=a[x[i][j]==\"S\"]\n\n else:\n\n if s[j+1]==\"o\":\n\n x[i]+=a[x[i][j]==\"S\"]\n\n else:\n\n x[i]+=a[x[i][j]!=\"S\"]\n\n if check0(i) and check1(i):\n\n print((x[i]))\n\n break\n\nelse:\n\n print((-1))\n", "code_v0_loc": 82, "code_v1_loc": 69, "code_v0_num_chars": 2079, "code_v1_num_chars": 1752, "code_v0_no_empty_lines": "n = int(input())\ns = input()\nx = [\"SS\", \"SW\", \"WS\", \"WW\"]\n\n\ndef check0(i):\n if x[i][0] == \"S\":\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n\n\ndef check1(i):\n if x[i][n - 1] == \"S\":\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n\n\nfor i in range(4):\n for j in range(n - 2):\n if x[i][j + 1] == \"S\":\n if s[j + 1] == \"o\":\n if x[i][j] == \"S\":\n x[i] += \"S\"\n else:\n x[i] += \"W\"\n else:\n if x[i][j] == \"S\":\n x[i] += \"W\"\n else:\n x[i] += \"S\"\n else:\n if s[j + 1] == \"o\":\n if x[i][j] == \"S\":\n x[i] += \"W\"\n else:\n x[i] += \"S\"\n else:\n if x[i][j] == \"S\":\n x[i] += \"S\"\n else:\n x[i] += \"W\"\n # print(x[i])\n if check0(i) and check1(i):\n print((x[i]))\n break\nelse:\n print((-1))\n", "code_v1_no_empty_lines": "n = int(input())\ns = input()\nx = [\"SS\", \"SW\", \"WS\", \"WW\"]\n\n\ndef check0(i):\n if x[i][0] == \"S\":\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if s[0] == \"o\":\n if x[i][-1] == \"S\":\n return x[i][1] == \"W\"\n else:\n return x[i][1] == \"S\"\n else:\n if x[i][-1] == \"S\":\n return x[i][1] == \"S\"\n else:\n return x[i][1] == \"W\"\n\n\ndef check1(i):\n if x[i][n - 1] == \"S\":\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if s[n - 1] == \"o\":\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"W\"\n else:\n return x[i][0] == \"S\"\n else:\n if x[i][n - 2] == \"S\":\n return x[i][0] == \"S\"\n else:\n return x[i][0] == \"W\"\n\n\na = [\"S\", \"W\"]\nfor i in range(4):\n for j in range(n - 2):\n if x[i][j + 1] == \"S\":\n if s[j + 1] == \"o\":\n x[i] += a[x[i][j] != \"S\"]\n else:\n x[i] += a[x[i][j] == \"S\"]\n else:\n if s[j + 1] == \"o\":\n x[i] += a[x[i][j] == \"S\"]\n else:\n x[i] += a[x[i][j] != \"S\"]\n if check0(i) and check1(i):\n print((x[i]))\n break\nelse:\n print((-1))\n", "code_same": false, "relative_loc_diff_percent": 15.8536585366, "diff": ["+a = [\"S\", \"W\"]", "- if x[i][j] == \"S\":", "- x[i] += \"S\"", "- else:", "- x[i] += \"W\"", "+ x[i] += a[x[i][j] != \"S\"]", "- if x[i][j] == \"S\":", "- x[i] += \"W\"", "- else:", "- x[i] += \"S\"", "+ x[i] += a[x[i][j] == \"S\"]", "- if x[i][j] == \"S\":", "- x[i] += \"W\"", "- else:", "- x[i] += \"S\"", "+ x[i] += a[x[i][j] == \"S\"]", "- if x[i][j] == \"S\":", "- x[i] += \"S\"", "- else:", "- x[i] += \"W\"", "- # print(x[i])", "+ x[i] += a[x[i][j] != \"S\"]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.206637172, "measured_runtime_v1": 0.0056119666, "runtime_lift": 36.8208127342, "key": ["s244589711", "s160001244"], "target_token_count_dream": 485, "target_token_bucket_dream": "256-512"} +{"user_id": "u318414416", "problem_id": "p03162", "language": "python", "submission_id_v0": "s337419843", "submission_id_v1": "s763303888", "cpu_time_v0": 672, "cpu_time_v1": 308, "memory_v0": 47336, "memory_v1": 30580, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.17, "input": "# coding: utf-8\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [[0] * 3 for _ in range(n + 1)]\n\n for i in range(1, n + 1):\n\n for j in range(3):\n\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] \\\n\n for k in range(3) if k != j)\n\n return(max(dp[n]))\n\n\n\nn = int(input()) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n", "target": "# coding: utf-8\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef f(n, abc):\n\n dp = [0] * 3\n\n for i in range(1, n + 1):\n\n a, b, c = abc[i - 1]\n\n dp = [ max(dp[1] + a, dp[2] + a), \\\n\n max(dp[0] + b, dp[2] + b), \\\n\n max(dp[0] + c, dp[1] + c) ]\n\n return(max(dp))\n\n\n\nn = int(input()) # 1 <= n <= 10^5\n\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\n\n\n\nprint((f(n, abc)))\n", "code_v0_loc": 17, "code_v1_loc": 17, "code_v0_num_chars": 434, "code_v1_num_chars": 436, "code_v0_no_empty_lines": "# coding: utf-8\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef f(n, abc):\n dp = [[0] * 3 for _ in range(n + 1)]\n for i in range(1, n + 1):\n for j in range(3):\n dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)\n return max(dp[n])\n\n\nn = int(input()) # 1 <= n <= 10^5\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\nprint((f(n, abc)))\n", "code_v1_no_empty_lines": "# coding: utf-8\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef f(n, abc):\n dp = [0] * 3\n for i in range(1, n + 1):\n a, b, c = abc[i - 1]\n dp = [\n max(dp[1] + a, dp[2] + a),\n max(dp[0] + b, dp[2] + b),\n max(dp[0] + c, dp[1] + c),\n ]\n return max(dp)\n\n\nn = int(input()) # 1 <= n <= 10^5\nabc = [list(map(int, input().rstrip().split())) for _ in range(n)]\nprint((f(n, abc)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- dp = [[0] * 3 for _ in range(n + 1)]", "+ dp = [0] * 3", "- for j in range(3):", "- dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)", "- return max(dp[n])", "+ a, b, c = abc[i - 1]", "+ dp = [", "+ max(dp[1] + a, dp[2] + a),", "+ max(dp[0] + b, dp[2] + b),", "+ max(dp[0] + c, dp[1] + c),", "+ ]", "+ return max(dp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2527067475, "measured_runtime_v1": 0.1473037755, "runtime_lift": 1.7155483393, "key": ["s337419843", "s763303888"], "target_token_count_dream": 163, "target_token_bucket_dream": "128-256"} +{"user_id": "u945199633", "problem_id": "p02595", "language": "python", "submission_id_v0": "s028374925", "submission_id_v1": "s480019615", "cpu_time_v0": 580, "cpu_time_v1": 443, "memory_v0": 45308, "memory_v1": 9156, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.62, "input": "N, D = list(map(int, input().split()))\n\npoint = []\n\nfor i in range(N):\n\n point.append(list(map(int, input().split())))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in point:\n\n if (i[0]**2 + i[1]**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)", "target": "N, D = list(map(int, input().split()))\n\n\n\nct = 0\n\nD2 = D * D\n\nfor i in range(N):\n\n X, Y = list(map(int, input().split()))\n\n if (X**2 + Y**2) <= D2:\n\n ct += 1\n\n\n\nprint(ct)", "code_v0_loc": 12, "code_v1_loc": 10, "code_v0_num_chars": 219, "code_v1_num_chars": 171, "code_v0_no_empty_lines": "N, D = list(map(int, input().split()))\npoint = []\nfor i in range(N):\n point.append(list(map(int, input().split())))\nct = 0\nD2 = D * D\nfor i in point:\n if (i[0] ** 2 + i[1] ** 2) <= D2:\n ct += 1\nprint(ct)\n", "code_v1_no_empty_lines": "N, D = list(map(int, input().split()))\nct = 0\nD2 = D * D\nfor i in range(N):\n X, Y = list(map(int, input().split()))\n if (X**2 + Y**2) <= D2:\n ct += 1\nprint(ct)\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-point = []", "-for i in range(N):", "- point.append(list(map(int, input().split())))", "-for i in point:", "- if (i[0] ** 2 + i[1] ** 2) <= D2:", "+for i in range(N):", "+ X, Y = list(map(int, input().split()))", "+ if (X**2 + Y**2) <= D2:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.399467237, "measured_runtime_v1": 0.2084539161, "runtime_lift": 1.9163335691, "key": ["s028374925", "s480019615"], "target_token_count_dream": 68, "target_token_bucket_dream": "<128"} +{"user_id": "u624689667", "problem_id": "p03796", "language": "python", "submission_id_v0": "s800016333", "submission_id_v1": "s112879561", "cpu_time_v0": 271, "cpu_time_v1": 164, "memory_v0": 42736, "memory_v1": 38512, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.48, "input": "from math import factorial\n\n\n\nmod = 10**9 + 7\n\nn = int(input())\n\n\n\nans = factorial(n) % mod\n\nprint(ans)", "target": "N = int(input())\n\nMOD = 10**9 + 7\n\nans = 1\n\nfor i in range(2, N+1):\n\n ans *= i\n\n ans %= MOD\n\nprint(ans)\n", "code_v0_loc": 7, "code_v1_loc": 7, "code_v0_num_chars": 103, "code_v1_num_chars": 110, "code_v0_no_empty_lines": "from math import factorial\n\nmod = 10**9 + 7\nn = int(input())\nans = factorial(n) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nMOD = 10**9 + 7\nans = 1\nfor i in range(2, N + 1):\n ans *= i\n ans %= MOD\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-from math import factorial", "-", "-mod = 10**9 + 7", "-n = int(input())", "-ans = factorial(n) % mod", "+N = int(input())", "+MOD = 10**9 + 7", "+ans = 1", "+for i in range(2, N + 1):", "+ ans *= i", "+ ans %= MOD"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5071064572, "measured_runtime_v1": 0.006458343, "runtime_lift": 78.5195915066, "key": ["s800016333", "s112879561"], "target_token_count_dream": 45, "target_token_bucket_dream": "<128"} +{"user_id": "u816872429", "problem_id": "p03078", "language": "python", "submission_id_v0": "s052587697", "submission_id_v1": "s157699880", "cpu_time_v0": 41, "cpu_time_v1": 28, "memory_v0": 4096, "memory_v1": 4460, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 31.71, "input": "import heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\ndef diff(l):\n\n m = max(l)\n\n return sorted(m - v for v in l)[1:]\n\n\n\ns = sum(map(max, [a, b, c]))\n\nsa, sb, sc = list(map(diff, [a, b, c]))\n\nda, db, dc = [0], [0], [0]\n\nq = [0]\n\nwhile k > 0:\n\n while True:\n\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n\n heapq.heappush(q, v)\n\n da.append(sa[0])\n\n sa = sa[1:]\n\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n\n heapq.heappush(q, v)\n\n db.append(sb[0])\n\n sb = sb[1:]\n\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n\n heapq.heappush(q, v)\n\n dc.append(sc[0])\n\n sc = sc[1:]\n\n else:\n\n break\n\n v = heapq.heappop(q)\n\n print(s - v)\n\n k -= 1\n", "target": "import heapq\n\n\n\nx, y, z, k = list(map(int, input().split()))\n\na = sorted(map(int, input().split()))\n\nb = sorted(map(int, input().split()))\n\nc = sorted(map(int, input().split()))\n\n\n\nq = []\n\nmemo = set()\n\ndef qpush(q, ai, bi, ci):\n\n t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)\n\n if not t in memo:\n\n memo.add(t)\n\n heapq.heappush(q, t)\n\n\n\nqpush(q, len(a) - 1, len(b) - 1, len(c) - 1)\n\nfor _ in range(k):\n\n s, ai, bi, ci = heapq.heappop(q)\n\n if ai > 0:\n\n qpush(q, ai - 1, bi, ci)\n\n if bi > 0:\n\n qpush(q, ai, bi - 1, ci)\n\n if ci > 0:\n\n qpush(q, ai, bi, ci - 1)\n\n print(-s)\n", "code_v0_loc": 37, "code_v1_loc": 25, "code_v0_num_chars": 1122, "code_v1_num_chars": 631, "code_v0_no_empty_lines": "import heapq\n\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\n\ndef diff(l):\n m = max(l)\n return sorted(m - v for v in l)[1:]\n\n\ns = sum(map(max, [a, b, c]))\nsa, sb, sc = list(map(diff, [a, b, c]))\nda, db, dc = [0], [0], [0]\nq = [0]\nwhile k > 0:\n while True:\n if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):\n for v in [sa[0] + bb + cc for bb in db for cc in dc]:\n heapq.heappush(q, v)\n da.append(sa[0])\n sa = sa[1:]\n elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):\n for v in [sb[0] + aa + cc for aa in da for cc in dc]:\n heapq.heappush(q, v)\n db.append(sb[0])\n sb = sb[1:]\n elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):\n for v in [sc[0] + aa + bb for aa in da for bb in db]:\n heapq.heappush(q, v)\n dc.append(sc[0])\n sc = sc[1:]\n else:\n break\n v = heapq.heappop(q)\n print(s - v)\n k -= 1\n", "code_v1_no_empty_lines": "import heapq\n\nx, y, z, k = list(map(int, input().split()))\na = sorted(map(int, input().split()))\nb = sorted(map(int, input().split()))\nc = sorted(map(int, input().split()))\nq = []\nmemo = set()\n\n\ndef qpush(q, ai, bi, ci):\n t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)\n if not t in memo:\n memo.add(t)\n heapq.heappush(q, t)\n\n\nqpush(q, len(a) - 1, len(b) - 1, len(c) - 1)\nfor _ in range(k):\n s, ai, bi, ci = heapq.heappop(q)\n if ai > 0:\n qpush(q, ai - 1, bi, ci)\n if bi > 0:\n qpush(q, ai, bi - 1, ci)\n if ci > 0:\n qpush(q, ai, bi, ci - 1)\n print(-s)\n", "code_same": false, "relative_loc_diff_percent": 32.4324324324, "diff": ["-a = list(map(int, input().split()))", "-b = list(map(int, input().split()))", "-c = list(map(int, input().split()))", "+a = sorted(map(int, input().split()))", "+b = sorted(map(int, input().split()))", "+c = sorted(map(int, input().split()))", "+q = []", "+memo = set()", "-def diff(l):", "- m = max(l)", "- return sorted(m - v for v in l)[1:]", "+def qpush(q, ai, bi, ci):", "+ t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)", "+ if not t in memo:", "+ memo.add(t)", "+ heapq.heappush(q, t)", "-s = sum(map(max, [a, b, c]))", "-sa, sb, sc = list(map(diff, [a, b, c]))", "-da, db, dc = [0], [0], [0]", "-q = [0]", "-while k > 0:", "- while True:", "- if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):", "- for v in [sa[0] + bb + cc for bb in db for cc in dc]:", "- heapq.heappush(q, v)", "- da.append(sa[0])", "- sa = sa[1:]", "- elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):", "- for v in [sb[0] + aa + cc for aa in da for cc in dc]:", "- heapq.heappush(q, v)", "- db.append(sb[0])", "- sb = sb[1:]", "- elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):", "- for v in [sc[0] + aa + bb for aa in da for bb in db]:", "- heapq.heappush(q, v)", "- dc.append(sc[0])", "- sc = sc[1:]", "- else:", "- break", "- v = heapq.heappop(q)", "- print(s - v)", "- k -= 1", "+qpush(q, len(a) - 1, len(b) - 1, len(c) - 1)", "+for _ in range(k):", "+ s, ai, bi, ci = heapq.heappop(q)", "+ if ai > 0:", "+ qpush(q, ai - 1, bi, ci)", "+ if bi > 0:", "+ qpush(q, ai, bi - 1, ci)", "+ if ci > 0:", "+ qpush(q, ai, bi, ci - 1)", "+ print(-s)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2304672, "measured_runtime_v1": 0.0062596636, "runtime_lift": 36.8178252168, "key": ["s052587697", "s157699880"], "target_token_count_dream": 228, "target_token_bucket_dream": "128-256"} +{"user_id": "u924691798", "problem_id": "p02837", "language": "python", "submission_id_v0": "s473277676", "submission_id_v1": "s669766257", "cpu_time_v0": 175, "cpu_time_v1": 139, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.57, "input": "N = int(input())\n\nA = [0]*N\n\nX = []\n\nY = []\n\nfor i in range(N):\n\n A[i] = int(input())\n\n X.append([])\n\n Y.append([])\n\n for j in range(A[i]):\n\n x, y = list(map(int, input().split()))\n\n X[i].append(x-1)\n\n Y[i].append(y)\n\nans = 0\n\nfor bit in range(1<= k:\n\n print(a)\n\n exit()\n\n\n", "target": "n,k = list(map(int,input().split()))\n\ncnt = 0\n\nnum = []\n\nfor i in range(n):\n\n a,b = list(map(int,input().split()))\n\n num.append((a,b))\n\nnum.sort()\n\nfor i in range(n):\n\n cnt += num[i][1]\n\n if cnt >= k:\n\n print((num[i][0]))\n\n exit()", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 252, "code_v1_num_chars": 242, "code_v0_no_empty_lines": "n, k = list(map(int, input().split()))\nnum = 0\nq = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n q.append((a, b))\nq.sort()\nfor i in range(n):\n a, b = q[i][0], q[i][1]\n num += b\n if num >= k:\n print(a)\n exit()\n", "code_v1_no_empty_lines": "n, k = list(map(int, input().split()))\ncnt = 0\nnum = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n num.append((a, b))\nnum.sort()\nfor i in range(n):\n cnt += num[i][1]\n if cnt >= k:\n print((num[i][0]))\n exit()\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-num = 0", "-q = []", "+cnt = 0", "+num = []", "- q.append((a, b))", "-q.sort()", "+ num.append((a, b))", "+num.sort()", "- a, b = q[i][0], q[i][1]", "- num += b", "- if num >= k:", "- print(a)", "+ cnt += num[i][1]", "+ if cnt >= k:", "+ print((num[i][0]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3024329725, "measured_runtime_v1": 0.2289340452, "runtime_lift": 1.3210484801, "key": ["s168629717", "s331365181"], "target_token_count_dream": 76, "target_token_bucket_dream": "<128"} +{"user_id": "u047796752", "problem_id": "p03197", "language": "python", "submission_id_v0": "s531607176", "submission_id_v1": "s450058032", "cpu_time_v0": 356, "cpu_time_v1": 241, "memory_v0": 49496, "memory_v1": 43868, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 32.3, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\ndef dfs(x, y):\n\n if x==0 and y==0:\n\n t[x][y] = False\n\n return False\n\n \n\n if x>=1:\n\n t[x][y] |= not dfs(x-1, y)\n\n \n\n if y>=1:\n\n t[x][y] |= not dfs(x, y-1)\n\n \n\n if min(x, y)>=1:\n\n t[x][y] |= not dfs(x-1, y-1)\n\n \n\n return t[x][y]\n\n \n\nt = [[False]*7 for _ in range(7)]\n\n\n\nfor i in range(7):\n\n for j in range(7):\n\n dfs(i, j)\n\n\n\n\"\"\"\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(input())\n\nflag = True\n\n\n\nfor _ in range(N):\n\n a = int(input())\n\n \n\n if a%2==1:\n\n flag = False\n\n \n\nif flag:\n\n print('second')\n\nelse:\n\n print('first')", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\n\"\"\"\n\ndef dfs(x, y):\n\n if x==0 and y==0:\n\n return False\n\n \n\n res = False\n\n \n\n if x>0:\n\n res |= not dfs(x-1, y)\n\n \n\n if y>0:\n\n res |= not dfs(x, y-1)\n\n \n\n if min(x, y)>0:\n\n res |= not dfs(x-1, y-1)\n\n \n\n return res\n\n \n\nt = [[False]*5 for _ in range(5)]\n\n\n\nfor i in range(5):\n\n for j in range(5):\n\n t[i][j] = dfs(i, j)\n\n\n\nfor ti in t:\n\n print(*ti)\n\n\"\"\"\n\n\n\nN = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\nfor ai in a:\n\n if ai%2==1:\n\n print('first')\n\n exit()\n\n\n\nprint('second')", "code_v0_loc": 44, "code_v1_loc": 40, "code_v0_num_chars": 701, "code_v1_num_chars": 621, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\n\ndef dfs(x, y):\n if x == 0 and y == 0:\n t[x][y] = False\n return False\n if x >= 1:\n t[x][y] |= not dfs(x - 1, y)\n if y >= 1:\n t[x][y] |= not dfs(x, y - 1)\n if min(x, y) >= 1:\n t[x][y] |= not dfs(x - 1, y - 1)\n return t[x][y]\n\n\nt = [[False] * 7 for _ in range(7)]\nfor i in range(7):\n for j in range(7):\n dfs(i, j)\n\"\"\"\nfor ti in t:\n print(*ti)\n\"\"\"\nN = int(input())\nflag = True\nfor _ in range(N):\n a = int(input())\n if a % 2 == 1:\n flag = False\nif flag:\n print(\"second\")\nelse:\n print(\"first\")\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\n\"\"\"\ndef dfs(x, y):\n if x==0 and y==0:\n return False\n res = False\n if x>0:\n res |= not dfs(x-1, y)\n if y>0:\n res |= not dfs(x, y-1)\n if min(x, y)>0:\n res |= not dfs(x-1, y-1)\n return res\nt = [[False]*5 for _ in range(5)]\nfor i in range(5):\n for j in range(5):\n t[i][j] = dfs(i, j)\nfor ti in t:\n print(*ti)\n\"\"\"\nN = int(input())\na = [int(input()) for _ in range(N)]\nfor ai in a:\n if ai % 2 == 1:\n print(\"first\")\n exit()\nprint(\"second\")\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-from collections import *", "-", "-", "+\"\"\"", "- if x == 0 and y == 0:", "- t[x][y] = False", "+ if x==0 and y==0:", "- if x >= 1:", "- t[x][y] |= not dfs(x - 1, y)", "- if y >= 1:", "- t[x][y] |= not dfs(x, y - 1)", "- if min(x, y) >= 1:", "- t[x][y] |= not dfs(x - 1, y - 1)", "- return t[x][y]", "-", "-", "-t = [[False] * 7 for _ in range(7)]", "-for i in range(7):", "- for j in range(7):", "- dfs(i, j)", "-\"\"\"", "+ res = False", "+ if x>0:", "+ res |= not dfs(x-1, y)", "+ if y>0:", "+ res |= not dfs(x, y-1)", "+ if min(x, y)>0:", "+ res |= not dfs(x-1, y-1)", "+ return res", "+t = [[False]*5 for _ in range(5)]", "+for i in range(5):", "+ for j in range(5):", "+ t[i][j] = dfs(i, j)", "-flag = True", "-for _ in range(N):", "- a = int(input())", "- if a % 2 == 1:", "- flag = False", "-if flag:", "- print(\"second\")", "-else:", "- print(\"first\")", "+a = [int(input()) for _ in range(N)]", "+for ai in a:", "+ if ai % 2 == 1:", "+ print(\"first\")", "+ exit()", "+print(\"second\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4127988609, "measured_runtime_v1": 0.1956315268, "runtime_lift": 2.1100835213, "key": ["s531607176", "s450058032"], "target_token_count_dream": 197, "target_token_bucket_dream": "128-256"} +{"user_id": "u094191970", "problem_id": "p03416", "language": "python", "submission_id_v0": "s196951264", "submission_id_v1": "s755826464", "cpu_time_v0": 127, "cpu_time_v1": 57, "memory_v0": 2940, "memory_v1": 9184, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.12, "input": "a,b=list(map(int, input().split()))\n\ncnt=0\n\nfor i in range(a,b+1):\n\n n=list(str(i))\n\n if n==list(reversed(n)):\n\n cnt+=1\n\nprint(cnt)", "target": "from sys import stdin\n\nnii=lambda:list(map(int,stdin.readline().split()))\n\nlnii=lambda:list(map(int,stdin.readline().split()))\n\n\n\na,b=nii()\n\nans=0\n\nfor i in range(a,b+1):\n\n s=str(i)\n\n if s==s[::-1]:\n\n ans+=1\n\n\n\nprint(ans)", "code_v0_loc": 7, "code_v1_loc": 12, "code_v0_num_chars": 138, "code_v1_num_chars": 220, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(a, b + 1):\n n = list(str(i))\n if n == list(reversed(n)):\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "from sys import stdin\n\nnii = lambda: list(map(int, stdin.readline().split()))\nlnii = lambda: list(map(int, stdin.readline().split()))\na, b = nii()\nans = 0\nfor i in range(a, b + 1):\n s = str(i)\n if s == s[::-1]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 41.6666666667, "diff": ["-a, b = list(map(int, input().split()))", "-cnt = 0", "+from sys import stdin", "+", "+nii = lambda: list(map(int, stdin.readline().split()))", "+lnii = lambda: list(map(int, stdin.readline().split()))", "+a, b = nii()", "+ans = 0", "- n = list(str(i))", "- if n == list(reversed(n)):", "- cnt += 1", "-print(cnt)", "+ s = str(i)", "+ if s == s[::-1]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4537812017, "measured_runtime_v1": 0.1270140123, "runtime_lift": 3.5726861437, "key": ["s196951264", "s755826464"], "target_token_count_dream": 69, "target_token_bucket_dream": "<128"} +{"user_id": "u046187684", "problem_id": "p03416", "language": "python", "submission_id_v0": "s340270167", "submission_id_v1": "s097893502", "cpu_time_v0": 67, "cpu_time_v1": 60, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.45, "input": "a, b = list(map(int, input().strip().split(\" \")))\n\ncount = 0\n\nfor i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\nprint(count)\n", "target": "def solve(string):\n\n a, b = list(map(int, string.split()))\n\n count = 0\n\n for i in range(a, b + 1):\n\n if str(i) == str(i)[::-1]:\n\n count += 1\n\n return str(count)\n\n\n\n\n\nif __name__ == '__main__':\n\n print((solve(input())))\n", "code_v0_loc": 6, "code_v1_loc": 11, "code_v0_num_chars": 148, "code_v1_num_chars": 244, "code_v0_no_empty_lines": "a, b = list(map(int, input().strip().split(\" \")))\ncount = 0\nfor i in range(a, b + 1):\n if str(i) == str(i)[::-1]:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "def solve(string):\n a, b = list(map(int, string.split()))\n count = 0\n for i in range(a, b + 1):\n if str(i) == str(i)[::-1]:\n count += 1\n return str(count)\n\n\nif __name__ == \"__main__\":\n print((solve(input())))\n", "code_same": false, "relative_loc_diff_percent": 45.4545454545, "diff": ["-a, b = list(map(int, input().strip().split(\" \")))", "-count = 0", "-for i in range(a, b + 1):", "- if str(i) == str(i)[::-1]:", "- count += 1", "-print(count)", "+def solve(string):", "+ a, b = list(map(int, string.split()))", "+ count = 0", "+ for i in range(a, b + 1):", "+ if str(i) == str(i)[::-1]:", "+ count += 1", "+ return str(count)", "+", "+", "+if __name__ == \"__main__\":", "+ print((solve(input())))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2889559059, "measured_runtime_v1": 0.2039610577, "runtime_lift": 1.4167209624, "key": ["s340270167", "s097893502"], "target_token_count_dream": 72, "target_token_bucket_dream": "<128"} +{"user_id": "u257974487", "problem_id": "p03796", "language": "python", "submission_id_v0": "s235320519", "submission_id_v1": "s032021754", "cpu_time_v0": 230, "cpu_time_v1": 40, "memory_v0": 3980, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.61, "input": "import math\n\nN = int(input())\n\np = math.factorial(N)\n\nprint((p % 1000000007))", "target": "N = int(input())\n\np = 1\n\nfor i in range(1,N+1):\n\n p *= i\n\n p %= 1000000007\n\nprint(p)\n", "code_v0_loc": 4, "code_v1_loc": 6, "code_v0_num_chars": 75, "code_v1_num_chars": 91, "code_v0_no_empty_lines": "import math\n\nN = int(input())\np = math.factorial(N)\nprint((p % 1000000007))\n", "code_v1_no_empty_lines": "N = int(input())\np = 1\nfor i in range(1, N + 1):\n p *= i\n p %= 1000000007\nprint(p)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-import math", "-", "-p = math.factorial(N)", "-print((p % 1000000007))", "+p = 1", "+for i in range(1, N + 1):", "+ p *= i", "+ p %= 1000000007", "+print(p)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.768677109, "measured_runtime_v1": 0.410683428, "runtime_lift": 1.8717022808, "key": ["s235320519", "s032021754"], "target_token_count_dream": 43, "target_token_bucket_dream": "<128"} +{"user_id": "u381572531", "problem_id": "p02891", "language": "python", "submission_id_v0": "s581989830", "submission_id_v1": "s729822755", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "import sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(input())\n\n \n\ndef check_count(s):\n\n cnt_list = [1]\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt_list[-1] += 1\n\n else:\n\n cnt_list.append(1)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c//2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k//2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)//2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)", "target": "import sys\n\ninput = sys.stdin.readline\n\n \n\ns = input().rstrip()\n\nk = int(input())\n\n\n\ndef check_count(s):\n\n cnt_list = []\n\n cnt = 1\n\n for i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n cnt += 1\n\n else:\n\n cnt_list.append(cnt)\n\n cnt = 1\n\n if cnt>1:\n\n cnt_list.append(cnt)\n\n return cnt_list\n\n\n\ndef calc_ans(cnt_list, k):\n\n _ans = 0\n\n for c in cnt_list:\n\n _ans += c//2\n\n return(_ans * k)\n\n\n\nif len(s)==1:\n\n ans = k//2\n\nelse:\n\n cnt_list = check_count(s)\n\n if len(cnt_list)==1:\n\n ans = (len(s)*k)//2\n\n else:\n\n ans = calc_ans(cnt_list, k)\n\n if s[0]==s[-1]:\n\n if cnt_list[0]%2==1 and cnt_list[-1]%2==1:\n\n ans += k - 1\n\n\n\nprint(ans)", "code_v0_loc": 35, "code_v1_loc": 38, "code_v0_num_chars": 711, "code_v1_num_chars": 765, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\ns = input().rstrip()\nk = int(input())\n\n\ndef check_count(s):\n cnt_list = [1]\n cnt = 1\n for i in range(1, len(s)):\n if s[i - 1] == s[i]:\n cnt_list[-1] += 1\n else:\n cnt_list.append(1)\n return cnt_list\n\n\ndef calc_ans(cnt_list, k):\n _ans = 0\n for c in cnt_list:\n _ans += c // 2\n return _ans * k\n\n\nif len(s) == 1:\n ans = k // 2\nelse:\n cnt_list = check_count(s)\n if len(cnt_list) == 1:\n ans = (len(s) * k) // 2\n else:\n ans = calc_ans(cnt_list, k)\n if s[0] == s[-1]:\n if cnt_list[0] % 2 == 1 and cnt_list[-1] % 2 == 1:\n ans += k - 1\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\ns = input().rstrip()\nk = int(input())\n\n\ndef check_count(s):\n cnt_list = []\n cnt = 1\n for i in range(1, len(s)):\n if s[i - 1] == s[i]:\n cnt += 1\n else:\n cnt_list.append(cnt)\n cnt = 1\n if cnt > 1:\n cnt_list.append(cnt)\n return cnt_list\n\n\ndef calc_ans(cnt_list, k):\n _ans = 0\n for c in cnt_list:\n _ans += c // 2\n return _ans * k\n\n\nif len(s) == 1:\n ans = k // 2\nelse:\n cnt_list = check_count(s)\n if len(cnt_list) == 1:\n ans = (len(s) * k) // 2\n else:\n ans = calc_ans(cnt_list, k)\n if s[0] == s[-1]:\n if cnt_list[0] % 2 == 1 and cnt_list[-1] % 2 == 1:\n ans += k - 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.8947368421, "diff": ["- cnt_list = [1]", "+ cnt_list = []", "- cnt_list[-1] += 1", "+ cnt += 1", "- cnt_list.append(1)", "+ cnt_list.append(cnt)", "+ cnt = 1", "+ if cnt > 1:", "+ cnt_list.append(cnt)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3312115214, "measured_runtime_v1": 0.249056649, "runtime_lift": 1.3298642006, "key": ["s581989830", "s729822755"], "target_token_count_dream": 232, "target_token_bucket_dream": "128-256"} +{"user_id": "u706929073", "problem_id": "p02881", "language": "python", "submission_id_v0": "s504662720", "submission_id_v1": "s470778572", "cpu_time_v0": 504, "cpu_time_v1": 137, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 72.82, "input": "N = int(input())\n\n\n\n\n\ndef dist(i, j):\n\n return i + j - 2\n\n\n\n\n\nmin = 10 ** 24\n\ni = 1\n\nwhile (i ** 2) <= N:\n\n if 0 == N % i:\n\n j = N // i\n\n d = dist(i, j)\n\n if min > d:\n\n min = d\n\n i += 1\n\nprint(d)\n", "target": "import math\n\nn = int(input())\n\n\n\nans = 0\n\nfor i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:\n\n if 0 == n % i:\n\n ans = i\n\n break\n\nans_partner = n // ans\n\nprint((ans + ans_partner - 2))\n", "code_v0_loc": 17, "code_v1_loc": 10, "code_v0_num_chars": 237, "code_v1_num_chars": 200, "code_v0_no_empty_lines": "N = int(input())\n\n\ndef dist(i, j):\n return i + j - 2\n\n\nmin = 10**24\ni = 1\nwhile (i**2) <= N:\n if 0 == N % i:\n j = N // i\n d = dist(i, j)\n if min > d:\n min = d\n i += 1\nprint(d)\n", "code_v1_no_empty_lines": "import math\n\nn = int(input())\nans = 0\nfor i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:\n if 0 == n % i:\n ans = i\n break\nans_partner = n // ans\nprint((ans + ans_partner - 2))\n", "code_same": false, "relative_loc_diff_percent": 41.1764705882, "diff": ["-N = int(input())", "+import math", "-", "-def dist(i, j):", "- return i + j - 2", "-", "-", "-min = 10**24", "-i = 1", "-while (i**2) <= N:", "- if 0 == N % i:", "- j = N // i", "- d = dist(i, j)", "- if min > d:", "- min = d", "- i += 1", "-print(d)", "+n = int(input())", "+ans = 0", "+for i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:", "+ if 0 == n % i:", "+ ans = i", "+ break", "+ans_partner = n // ans", "+print((ans + ans_partner - 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.327980933, "measured_runtime_v1": 0.2062122526, "runtime_lift": 1.5905016738, "key": ["s504662720", "s470778572"], "target_token_count_dream": 67, "target_token_bucket_dream": "<128"} +{"user_id": "u222668979", "problem_id": "p02552", "language": "python", "submission_id_v0": "s235847366", "submission_id_v1": "s896909207", "cpu_time_v0": 81, "cpu_time_v1": 70, "memory_v0": 61596, "memory_v1": 61788, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.58, "input": "n = int(input())\n\nprint((1 if n == 0 else 0))\n", "target": "n = int(input())\n\nprint((0 if n else 1))\n", "code_v0_loc": 2, "code_v1_loc": 2, "code_v0_num_chars": 44, "code_v1_num_chars": 39, "code_v0_no_empty_lines": "n = int(input())\nprint((1 if n == 0 else 0))\n", "code_v1_no_empty_lines": "n = int(input())\nprint((0 if n else 1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-print((1 if n == 0 else 0))", "+print((0 if n else 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.340472885, "measured_runtime_v1": 0.2658090671, "runtime_lift": 1.2808926674, "key": ["s235847366", "s896909207"], "target_token_count_dream": 14, "target_token_bucket_dream": "<128"} +{"user_id": "u747602774", "problem_id": "p03039", "language": "python", "submission_id_v0": "s108635717", "submission_id_v1": "s387237372", "cpu_time_v0": 543, "cpu_time_v1": 230, "memory_v0": 9432, "memory_v1": 9412, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.64, "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n ans += f1(x,y,n,m)+f1(1,1,x,y)+f1(1,y,x,m)+f1(x,1,n,y)\n\n ans -= f2(x,n) + f2(1,x) + f2(1,y) + f2(y,m)\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n", "target": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)//2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "code_v0_loc": 38, "code_v1_loc": 42, "code_v0_num_chars": 796, "code_v1_num_chars": 809, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) // 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n ans += f1(x, y, n, m) + f1(1, 1, x, y) + f1(1, y, x, m) + f1(x, 1, n, y)\n ans -= f2(x, n) + f2(1, x) + f2(1, y) + f2(y, m)\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) // 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n a = n - x + 1\n b = m - y + 1\n c = m * (a * (a - 1) + x * (x - 1))\n d = n * (b * (b - 1) + y * (y - 1))\n ans += (c + d) // 2\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 9.5238095238, "diff": ["- ans += f1(x, y, n, m) + f1(1, 1, x, y) + f1(1, y, x, m) + f1(x, 1, n, y)", "- ans -= f2(x, n) + f2(1, x) + f2(1, y) + f2(y, m)", "+ a = n - x + 1", "+ b = m - y + 1", "+ c = m * (a * (a - 1) + x * (x - 1))", "+ d = n * (b * (b - 1) + y * (y - 1))", "+ ans += (c + d) // 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4582999928, "measured_runtime_v1": 0.3618569455, "runtime_lift": 1.2665225816, "key": ["s108635717", "s387237372"], "target_token_count_dream": 339, "target_token_bucket_dream": "256-512"} +{"user_id": "u827885761", "problem_id": "p03013", "language": "python", "submission_id_v0": "s193052587", "submission_id_v1": "s829443238", "cpu_time_v0": 509, "cpu_time_v1": 195, "memory_v0": 46168, "memory_v1": 7668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.69, "input": "import sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\n\n\nl = [0] * (n+1)\n\nl[0] = 1\n\n\n\na = 0\n\nif m != 0:\n\n a = int(input())\n\nk = 1\n\nfor i in range(n+1):\n\n\n\n if i != a:\n\n if i == 1:\n\n l[i] = 1\n\n elif i >= 2:\n\n l[i] = l[i-1] + l[i-2]\n\n l[i] %= 1000000007\n\n else:\n\n k += 1\n\n if k <= m:\n\n a = int(input())\n\n\n\n\n\n\n\n#print(l)\n\nprint((l[n] % 1000000007))\n", "target": "import sys\n\nsys.setrecursionlimit(10**7)\n\ndef lmi(): return list(map(int, input().split()))\n\n\n\nn, m = lmi()\n\na = [1] * (n+1)\n\nfor i in range(m):\n\n a[int(input())] = 0\n\nk = [0] * (n+1)\n\nk[0] = 1\n\nfor i in range(1,n+1):\n\n if i == 1 and a[1]:\n\n k[1] = 1\n\n elif i >= 2 and a[i]:\n\n k[i] = k[i-1] + k[i-2]\n\n k[i] %= 10 ** 9 + 7\n\n\n\nprint((k[n]))\n", "code_v0_loc": 30, "code_v1_loc": 18, "code_v0_num_chars": 479, "code_v1_num_chars": 367, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef lmi():\n return list(map(int, input().split()))\n\n\nn, m = lmi()\nl = [0] * (n + 1)\nl[0] = 1\na = 0\nif m != 0:\n a = int(input())\nk = 1\nfor i in range(n + 1):\n if i != a:\n if i == 1:\n l[i] = 1\n elif i >= 2:\n l[i] = l[i - 1] + l[i - 2]\n l[i] %= 1000000007\n else:\n k += 1\n if k <= m:\n a = int(input())\n# print(l)\nprint((l[n] % 1000000007))\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef lmi():\n return list(map(int, input().split()))\n\n\nn, m = lmi()\na = [1] * (n + 1)\nfor i in range(m):\n a[int(input())] = 0\nk = [0] * (n + 1)\nk[0] = 1\nfor i in range(1, n + 1):\n if i == 1 and a[1]:\n k[1] = 1\n elif i >= 2 and a[i]:\n k[i] = k[i - 1] + k[i - 2]\n k[i] %= 10**9 + 7\nprint((k[n]))\n", "code_same": false, "relative_loc_diff_percent": 40.0, "diff": ["-l = [0] * (n + 1)", "-l[0] = 1", "-a = 0", "-if m != 0:", "- a = int(input())", "-k = 1", "-for i in range(n + 1):", "- if i != a:", "- if i == 1:", "- l[i] = 1", "- elif i >= 2:", "- l[i] = l[i - 1] + l[i - 2]", "- l[i] %= 1000000007", "- else:", "- k += 1", "- if k <= m:", "- a = int(input())", "-# print(l)", "-print((l[n] % 1000000007))", "+a = [1] * (n + 1)", "+for i in range(m):", "+ a[int(input())] = 0", "+k = [0] * (n + 1)", "+k[0] = 1", "+for i in range(1, n + 1):", "+ if i == 1 and a[1]:", "+ k[1] = 1", "+ elif i >= 2 and a[i]:", "+ k[i] = k[i - 1] + k[i - 2]", "+ k[i] %= 10**9 + 7", "+print((k[n]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3120539634, "measured_runtime_v1": 0.1110639279, "runtime_lift": 2.8096787978, "key": ["s193052587", "s829443238"], "target_token_count_dream": 157, "target_token_bucket_dream": "128-256"} +{"user_id": "u282228874", "problem_id": "p03013", "language": "python", "submission_id_v0": "s600331807", "submission_id_v1": "s809304917", "cpu_time_v0": 241, "cpu_time_v1": 180, "memory_v0": 9592, "memory_v1": 13192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.31, "input": "N,M = list(map(int,input().split()))\n\nMOD = 10**9+7\n\ndp = [0]*(N+1)\n\ndp[0]=1\n\nA = [int(input()) for i in range(M)]\n\nban = [1]*(N+1)\n\nfor a in A:\n\n ban[a]=0\n\nfor i in range(N):\n\n if i-1>=0:\n\n dp[i+1]=dp[i]*ban[i]+dp[i-1]*ban[i-1]\n\n else:\n\n dp[i+1]=dp[i]*ban[i]\n\n dp[i+1] %= MOD \n\nprint((dp[N]))", "target": "N,M = list(map(int,input().split()))\n\nA = [int(input()) for i in range(M)]\n\nMOD = 10**9+7\n\nA = set(A)\n\ndp = [0]*(N+1)\n\ndp[0] = 1\n\nfor i in range(1,N+1):\n\n if i in A:\n\n continue\n\n if i == 1:\n\n dp[1] = dp[0]\n\n else:\n\n dp[i] = (dp[i-1]+dp[i-2])%MOD\n\nprint((dp[N]))", "code_v0_loc": 15, "code_v1_loc": 14, "code_v0_num_chars": 311, "code_v1_num_chars": 283, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nMOD = 10**9 + 7\ndp = [0] * (N + 1)\ndp[0] = 1\nA = [int(input()) for i in range(M)]\nban = [1] * (N + 1)\nfor a in A:\n ban[a] = 0\nfor i in range(N):\n if i - 1 >= 0:\n dp[i + 1] = dp[i] * ban[i] + dp[i - 1] * ban[i - 1]\n else:\n dp[i + 1] = dp[i] * ban[i]\n dp[i + 1] %= MOD\nprint((dp[N]))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nA = [int(input()) for i in range(M)]\nMOD = 10**9 + 7\nA = set(A)\ndp = [0] * (N + 1)\ndp[0] = 1\nfor i in range(1, N + 1):\n if i in A:\n continue\n if i == 1:\n dp[1] = dp[0]\n else:\n dp[i] = (dp[i - 1] + dp[i - 2]) % MOD\nprint((dp[N]))\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["+A = [int(input()) for i in range(M)]", "+A = set(A)", "-A = [int(input()) for i in range(M)]", "-ban = [1] * (N + 1)", "-for a in A:", "- ban[a] = 0", "-for i in range(N):", "- if i - 1 >= 0:", "- dp[i + 1] = dp[i] * ban[i] + dp[i - 1] * ban[i - 1]", "+for i in range(1, N + 1):", "+ if i in A:", "+ continue", "+ if i == 1:", "+ dp[1] = dp[0]", "- dp[i + 1] = dp[i] * ban[i]", "- dp[i + 1] %= MOD", "+ dp[i] = (dp[i - 1] + dp[i - 2]) % MOD"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2076114528, "measured_runtime_v1": 0.0063931749, "runtime_lift": 32.4739204186, "key": ["s600331807", "s809304917"], "target_token_count_dream": 117, "target_token_bucket_dream": "<128"} +{"user_id": "u562935282", "problem_id": "p03371", "language": "python", "submission_id_v0": "s471284270", "submission_id_v1": "s058926350", "cpu_time_v0": 98, "cpu_time_v1": 81, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.35, "input": "def main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n A, B, C, X, Y = list(map(int, input().split()))\n\n\n\n ans = 1 << 30\n\n c = 0 # even\n\n while True:\n\n j = c // 2\n\n t = A * max(0, X - j) + B * max(0, Y - j) + C * c\n\n if ans <= t: break\n\n ans = t\n\n c += 2\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 353, "code_v1_num_chars": 318, "code_v0_no_empty_lines": "def main():\n A, B, AB, X, Y = list(map(int, input().split()))\n M = max(X, Y)\n k = 0\n ans = A * X + B * Y\n while True:\n ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)\n if k >= M:\n break\n k += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n A, B, C, X, Y = list(map(int, input().split()))\n ans = 1 << 30\n c = 0 # even\n while True:\n j = c // 2\n t = A * max(0, X - j) + B * max(0, Y - j) + C * c\n if ans <= t:\n break\n ans = t\n c += 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["- A, B, AB, X, Y = list(map(int, input().split()))", "- M = max(X, Y)", "- k = 0", "- ans = A * X + B * Y", "+ A, B, C, X, Y = list(map(int, input().split()))", "+ ans = 1 << 30", "+ c = 0 # even", "- ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)", "- if k >= M:", "+ j = c // 2", "+ t = A * max(0, X - j) + B * max(0, Y - j) + C * c", "+ if ans <= t:", "- k += 1", "+ ans = t", "+ c += 2"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3021148317, "measured_runtime_v1": 0.1545656888, "runtime_lift": 1.9546047633, "key": ["s471284270", "s058926350"], "target_token_count_dream": 118, "target_token_bucket_dream": "<128"} +{"user_id": "u072053884", "problem_id": "p02245", "language": "python", "submission_id_v0": "s696240934", "submission_id_v1": "s480327836", "cpu_time_v0": 120, "cpu_time_v1": 60, "memory_v0": 10724, "memory_v1": 13476, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "import sys\n\n\n\ninit = ''.join(sys.stdin.read().split())\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start, goal):\n\n if start == goal:\n\n return 0\n\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n\n step = {start: 0, goal: 0}\n\n s = 0\n\n c_d = [(start, 0), (goal, 1)] # configure and direction\n\n while True:\n\n q = iter(c_d)\n\n c_d = []\n\n s += 1\n\n for c, d in q:\n\n i = c.find('0')\n\n if 0 <= i <= 5:\n\n t = str.maketrans('0' + c[i+3], c[i+3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i >= 3:\n\n t = str.maketrans('0' + c[i-3], c[i-3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n\n t = str.maketrans('0' + c[i+1], c[i+1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n\n t = str.maketrans('0' + c[i-1], c[i-1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n\n\nprint((solve(init, '123456780')))", "target": "adjacent = (\n\n (1, 3), # 0\n\n (0, 2, 4), # 1\n\n (1, 5), # 2\n\n (0, 4, 6), # 3\n\n (1, 3, 5, 7), # 4\n\n (2, 4, 8), # 5\n\n (3, 7), # 6\n\n (4, 6, 8), # 7\n\n (5, 7) # 8\n\n)\n\n\n\nimport collections\n\n\n\nGOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start):\n\n if start == GOAL:\n\n return 0\n\n # 0: forward, 1: backward\n\n generated_state = {tuple(start): 0, tuple(GOAL): 1}\n\n step = {tuple(start): 0, tuple(GOAL): 0}\n\n s = 0\n\n state1 = [(start, 0), (GOAL, 1)]\n\n while state1:\n\n state2 = state1[:]\n\n state1 = []\n\n s += 1\n\n for s2, d in state2:\n\n i = s2.index(0)\n\n for p in adjacent[i]:\n\n s1 = s2[:]\n\n s1[i], s1[p] = s1[p], 0\n\n key = tuple(s1)\n\n if key in generated_state:\n\n if generated_state[key] != d:\n\n return s + step[key]\n\n continue\n\n state1.append((s1, d))\n\n generated_state[key] = d\n\n step[key] = s\n\n\n\nimport sys\n\n\n\nstart = list(map(int, sys.stdin.read().split()))\n\n\n\nprint((solve(start)))", "code_v0_loc": 60, "code_v1_loc": 48, "code_v0_num_chars": 2264, "code_v1_num_chars": 1231, "code_v0_no_empty_lines": "import sys\n\ninit = \"\".join(sys.stdin.read().split())\n# Bidirectional search using breadth-first search\ndef solve(start, goal):\n if start == goal:\n return 0\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n step = {start: 0, goal: 0}\n s = 0\n c_d = [(start, 0), (goal, 1)] # configure and direction\n while True:\n q = iter(c_d)\n c_d = []\n s += 1\n for c, d in q:\n i = c.find(\"0\")\n if 0 <= i <= 5:\n t = str.maketrans(\"0\" + c[i + 3], c[i + 3] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i >= 3:\n t = str.maketrans(\"0\" + c[i - 3], c[i - 3] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n t = str.maketrans(\"0\" + c[i + 1], c[i + 1] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n t = str.maketrans(\"0\" + c[i - 1], c[i - 1] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n\n\nprint((solve(init, \"123456780\")))\n", "code_v1_no_empty_lines": "adjacent = (\n (1, 3), # 0\n (0, 2, 4), # 1\n (1, 5), # 2\n (0, 4, 6), # 3\n (1, 3, 5, 7), # 4\n (2, 4, 8), # 5\n (3, 7), # 6\n (4, 6, 8), # 7\n (5, 7), # 8\n)\nimport collections\n\nGOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]\n# Bidirectional search using breadth-first search\ndef solve(start):\n if start == GOAL:\n return 0\n # 0: forward, 1: backward\n generated_state = {tuple(start): 0, tuple(GOAL): 1}\n step = {tuple(start): 0, tuple(GOAL): 0}\n s = 0\n state1 = [(start, 0), (GOAL, 1)]\n while state1:\n state2 = state1[:]\n state1 = []\n s += 1\n for s2, d in state2:\n i = s2.index(0)\n for p in adjacent[i]:\n s1 = s2[:]\n s1[i], s1[p] = s1[p], 0\n key = tuple(s1)\n if key in generated_state:\n if generated_state[key] != d:\n return s + step[key]\n continue\n state1.append((s1, d))\n generated_state[key] = d\n step[key] = s\n\n\nimport sys\n\nstart = list(map(int, sys.stdin.read().split()))\nprint((solve(start)))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["+adjacent = (", "+ (1, 3), # 0", "+ (0, 2, 4), # 1", "+ (1, 5), # 2", "+ (0, 4, 6), # 3", "+ (1, 3, 5, 7), # 4", "+ (2, 4, 8), # 5", "+ (3, 7), # 6", "+ (4, 6, 8), # 7", "+ (5, 7), # 8", "+)", "+import collections", "+", "+GOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]", "+# Bidirectional search using breadth-first search", "+def solve(start):", "+ if start == GOAL:", "+ return 0", "+ # 0: forward, 1: backward", "+ generated_state = {tuple(start): 0, tuple(GOAL): 1}", "+ step = {tuple(start): 0, tuple(GOAL): 0}", "+ s = 0", "+ state1 = [(start, 0), (GOAL, 1)]", "+ while state1:", "+ state2 = state1[:]", "+ state1 = []", "+ s += 1", "+ for s2, d in state2:", "+ i = s2.index(0)", "+ for p in adjacent[i]:", "+ s1 = s2[:]", "+ s1[i], s1[p] = s1[p], 0", "+ key = tuple(s1)", "+ if key in generated_state:", "+ if generated_state[key] != d:", "+ return s + step[key]", "+ continue", "+ state1.append((s1, d))", "+ generated_state[key] = d", "+ step[key] = s", "+", "+", "-init = \"\".join(sys.stdin.read().split())", "-# Bidirectional search using breadth-first search", "-def solve(start, goal):", "- if start == goal:", "- return 0", "- generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward", "- step = {start: 0, goal: 0}", "- s = 0", "- c_d = [(start, 0), (goal, 1)] # configure and direction", "- while True:", "- q = iter(c_d)", "- c_d = []", "- s += 1", "- for c, d in q:", "- i = c.find(\"0\")", "- if 0 <= i <= 5:", "- t = str.maketrans(\"0\" + c[i + 3], c[i + 3] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "- if i >= 3:", "- t = str.maketrans(\"0\" + c[i - 3], c[i - 3] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "- if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:", "- t = str.maketrans(\"0\" + c[i + 1], c[i + 1] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "- if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:", "- t = str.maketrans(\"0\" + c[i - 1], c[i - 1] + \"0\")", "- t_c = c.translate(t)", "- if t_c in generated_state:", "- if generated_state[t_c] != d:", "- return s + step[t_c]", "- else:", "- generated_state[t_c] = d", "- step[t_c] = s", "- c_d.append((t_c, d))", "-", "-", "-print((solve(init, \"123456780\")))", "+start = list(map(int, sys.stdin.read().split()))", "+print((solve(start)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3218115091, "measured_runtime_v1": 0.2098443508, "runtime_lift": 1.533572421, "key": ["s696240934", "s480327836"], "target_token_count_dream": 414, "target_token_bucket_dream": "256-512"} +{"user_id": "u021019433", "problem_id": "p02837", "language": "python", "submission_id_v0": "s456284110", "submission_id_v1": "s644980365", "cpu_time_v0": 95, "cpu_time_v1": 55, "memory_v0": 6500, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.11, "input": "def popcount(x):\n\n r, q = 0, x\n\n while x:\n\n r += 1\n\n x &= x - 1\n\n return r, q\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [[0, 0] for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y] |= 1 << (x - 1)\n\nl = (1 << n) - 1 \n\nb = sorted(map(popcount, list(range(1, l + 1))))\n\nans = next((i for i, x in reversed(b)\n\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)), 0)\n\nprint(ans)\n", "target": "from itertools import combinations, count\n\n \n\nn = int(input())\n\nr = list(range(n))\n\na = [(set(), set()) for _ in r]\n\nfor i in r:\n\n for _ in range(int(input())):\n\n x, y = list(map(int, input().split()))\n\n a[i][y].add(x - 1)\n\nr = next(i for i in count(n, - 1) for x in map(set, combinations(r, i))\n\n if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x))\n\nprint(r)\n", "code_v0_loc": 19, "code_v1_loc": 12, "code_v0_num_chars": 460, "code_v1_num_chars": 369, "code_v0_no_empty_lines": "def popcount(x):\n r, q = 0, x\n while x:\n r += 1\n x &= x - 1\n return r, q\n\n\nn = int(input())\nr = list(range(n))\na = [[0, 0] for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y] |= 1 << (x - 1)\nl = (1 << n) - 1\nb = sorted(map(popcount, list(range(1, l + 1))))\nans = next(\n (\n i\n for i, x in reversed(b)\n if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)\n ),\n 0,\n)\nprint(ans)\n", "code_v1_no_empty_lines": "from itertools import combinations, count\n\nn = int(input())\nr = list(range(n))\na = [(set(), set()) for _ in r]\nfor i in r:\n for _ in range(int(input())):\n x, y = list(map(int, input().split()))\n a[i][y].add(x - 1)\nr = next(\n i\n for i in count(n, -1)\n for x in map(set, combinations(r, i))\n if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x)\n)\nprint(r)\n", "code_same": false, "relative_loc_diff_percent": 36.8421052632, "diff": ["-def popcount(x):", "- r, q = 0, x", "- while x:", "- r += 1", "- x &= x - 1", "- return r, q", "-", "+from itertools import combinations, count", "-a = [[0, 0] for _ in r]", "+a = [(set(), set()) for _ in r]", "- a[i][y] |= 1 << (x - 1)", "-l = (1 << n) - 1", "-b = sorted(map(popcount, list(range(1, l + 1))))", "-ans = next(", "- (", "- i", "- for i, x in reversed(b)", "- if all(a[j][0] & x == a[j][1] & l - x == 0 for j in r if x >> j & 1)", "- ),", "- 0,", "+ a[i][y].add(x - 1)", "+r = next(", "+ i", "+ for i in count(n, -1)", "+ for x in map(set, combinations(r, i))", "+ if all(a[j][0].isdisjoint(x) and a[j][1] < x for j in x)", "-print(ans)", "+print(r)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3135637941, "measured_runtime_v1": 0.2051509681, "runtime_lift": 1.5284538848, "key": ["s456284110", "s644980365"], "target_token_count_dream": 124, "target_token_bucket_dream": "<128"} +{"user_id": "u228223940", "problem_id": "p03634", "language": "python", "submission_id_v0": "s279386500", "submission_id_v1": "s990337521", "cpu_time_v0": 1565, "cpu_time_v1": 1313, "memory_v0": 113180, "memory_v1": 156176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.1, "input": "import queue\n\nn = int(input())\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\nwhile not q.empty():\n\n tmp = q.get()\n\n for i in range(len(abc[tmp])):\n\n #print(abc[tmp])\n\n #exit()\n\n num = abc[tmp][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[tmp] + abc[tmp][i][1]\n\n q.put(num)\n\n \n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))", "target": "import queue\n\nimport sys\n\nsys.setrecursionlimit(10**7)\n\nn = int(input())\n\n\n\nabc = [[] for i in range(n+1)]\n\n\n\nfor i in range(n-1):\n\n a,b,c = list(map(int,input().split()))\n\n abc[a].append([b,c])\n\n abc[b].append([a,c])\n\n\n\nQ,k = list(map(int,input().split()))\n\nxy = [[int(i) for i in input().split()] for j in range(Q)]\n\n\n\nq = queue.Queue()\n\n\n\nq.put(k)\n\n\n\npath = [-1]*(n+1)\n\npath[k] = 0\n\n\n\ndef dfs(p):\n\n for i in range(len(abc[p])):\n\n num = abc[p][i][0]\n\n if path[num] != -1:\n\n continue\n\n else:\n\n path[num] = path[p] + abc[p][i][1]\n\n dfs(num)\n\n\n\ndfs(k)\n\n\n\nfor i in range(Q):\n\n print((path[xy[i][0]]+path[xy[i][1]]))", "code_v0_loc": 34, "code_v1_loc": 35, "code_v0_num_chars": 709, "code_v1_num_chars": 668, "code_v0_no_empty_lines": "import queue\n\nn = int(input())\nabc = [[] for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n abc[a].append([b, c])\n abc[b].append([a, c])\nQ, k = list(map(int, input().split()))\nxy = [[int(i) for i in input().split()] for j in range(Q)]\nq = queue.Queue()\nq.put(k)\npath = [-1] * (n + 1)\npath[k] = 0\nwhile not q.empty():\n tmp = q.get()\n for i in range(len(abc[tmp])):\n # print(abc[tmp])\n # exit()\n num = abc[tmp][i][0]\n if path[num] != -1:\n continue\n else:\n path[num] = path[tmp] + abc[tmp][i][1]\n q.put(num)\nfor i in range(Q):\n print((path[xy[i][0]] + path[xy[i][1]]))\n", "code_v1_no_empty_lines": "import queue\nimport sys\n\nsys.setrecursionlimit(10**7)\nn = int(input())\nabc = [[] for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n abc[a].append([b, c])\n abc[b].append([a, c])\nQ, k = list(map(int, input().split()))\nxy = [[int(i) for i in input().split()] for j in range(Q)]\nq = queue.Queue()\nq.put(k)\npath = [-1] * (n + 1)\npath[k] = 0\n\n\ndef dfs(p):\n for i in range(len(abc[p])):\n num = abc[p][i][0]\n if path[num] != -1:\n continue\n else:\n path[num] = path[p] + abc[p][i][1]\n dfs(num)\n\n\ndfs(k)\nfor i in range(Q):\n print((path[xy[i][0]] + path[xy[i][1]]))\n", "code_same": false, "relative_loc_diff_percent": 2.8571428571, "diff": ["+import sys", "+sys.setrecursionlimit(10**7)", "-while not q.empty():", "- tmp = q.get()", "- for i in range(len(abc[tmp])):", "- # print(abc[tmp])", "- # exit()", "- num = abc[tmp][i][0]", "+", "+", "+def dfs(p):", "+ for i in range(len(abc[p])):", "+ num = abc[p][i][0]", "- path[num] = path[tmp] + abc[tmp][i][1]", "- q.put(num)", "+ path[num] = path[p] + abc[p][i][1]", "+ dfs(num)", "+", "+", "+dfs(k)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3961623552, "measured_runtime_v1": 0.2607869017, "runtime_lift": 1.5191037302, "key": ["s279386500", "s990337521"], "target_token_count_dream": 217, "target_token_bucket_dream": "128-256"} +{"user_id": "u227438830", "problem_id": "p02394", "language": "python", "submission_id_v0": "s015330345", "submission_id_v1": "s144446421", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7644, "memory_v1": 5592, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "W,H,x,y,r = [int(i) for i in input().split()]\n\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "target": "W, H, x, y, r = list(map(int, input().split()))\n\nif r <= x <= W-r and r <= y <= H-r:\n\n print('Yes')\n\nelse:\n\n print('No')\n", "code_v0_loc": 5, "code_v1_loc": 5, "code_v0_num_chars": 148, "code_v1_num_chars": 121, "code_v0_no_empty_lines": "W, H, x, y, r = [int(i) for i in input().split()]\nif x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "W, H, x, y, r = list(map(int, input().split()))\nif r <= x <= W - r and r <= y <= H - r:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-W, H, x, y, r = [int(i) for i in input().split()]", "-if x - r >= 0 and x + r <= W and y - r >= 0 and y + r <= H:", "+W, H, x, y, r = list(map(int, input().split()))", "+if r <= x <= W - r and r <= y <= H - r:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1765992579, "measured_runtime_v1": 0.0064357525, "runtime_lift": 27.44034336, "key": ["s015330345", "s144446421"], "target_token_count_dream": 45, "target_token_bucket_dream": "<128"} +{"user_id": "u353895424", "problem_id": "p03325", "language": "python", "submission_id_v0": "s954474488", "submission_id_v1": "s311308759", "cpu_time_v0": 81, "cpu_time_v1": 56, "memory_v0": 4148, "memory_v1": 10088, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.86, "input": "from math import log2\n\nn = int(input())\n\na = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor _a in a:\n\n if _a%2 == 0:\n\n cnt =0\n\n while _a%2 == 0:\n\n _a //= 2\n\n cnt += 1\n\n ans += cnt\n\n\n\nprint((int(ans)))", "target": "def f(k):\n\n cnt = 0\n\n while k%2 == 0:\n\n k //= 2\n\n cnt += 1\n\n # print(k)\n\n # print(\"-----\")\n\n return cnt\n\n\n\nn = int(input())\n\nA = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor a in A:\n\n if a%2 == 0:\n\n ans += f(a)\n\nprint(ans)", "code_v0_loc": 14, "code_v1_loc": 17, "code_v0_num_chars": 245, "code_v1_num_chars": 272, "code_v0_no_empty_lines": "from math import log2\n\nn = int(input())\na = list(map(int, input().split()))\nans = 0\nfor _a in a:\n if _a % 2 == 0:\n cnt = 0\n while _a % 2 == 0:\n _a //= 2\n cnt += 1\n ans += cnt\nprint((int(ans)))\n", "code_v1_no_empty_lines": "def f(k):\n cnt = 0\n while k % 2 == 0:\n k //= 2\n cnt += 1\n # print(k)\n # print(\"-----\")\n return cnt\n\n\nn = int(input())\nA = list(map(int, input().split()))\nans = 0\nfor a in A:\n if a % 2 == 0:\n ans += f(a)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["-from math import log2", "+def f(k):", "+ cnt = 0", "+ while k % 2 == 0:", "+ k //= 2", "+ cnt += 1", "+ # print(k)", "+ return cnt", "+", "-a = list(map(int, input().split()))", "+A = list(map(int, input().split()))", "-for _a in a:", "- if _a % 2 == 0:", "- cnt = 0", "- while _a % 2 == 0:", "- _a //= 2", "- cnt += 1", "- ans += cnt", "-print((int(ans)))", "+for a in A:", "+ if a % 2 == 0:", "+ ans += f(a)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3309142907, "measured_runtime_v1": 0.2479304838, "runtime_lift": 1.3347059448, "key": ["s954474488", "s311308759"], "target_token_count_dream": 89, "target_token_bucket_dream": "<128"} +{"user_id": "u164727245", "problem_id": "p02685", "language": "python", "submission_id_v0": "s549338354", "submission_id_v1": "s173586541", "cpu_time_v0": 842, "cpu_time_v1": 187, "memory_v0": 9192, "memory_v1": 16648, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 77.79, "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n ret = p\n\n inv = pow(m-1, mod-2, mod)\n\n for i in range(1, k+1):\n\n ncr = (ncr * (n-i)*pow(i, mod-2, mod)) % mod\n\n p = (p*inv) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "target": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n, m, k = list(map(int, args[0].split()))\n\n mod = 998244353\n\n\n\n if m == 1 and n-1 == k:\n\n return str(1)\n\n\n\n ncr = 1\n\n p = m*pow(m-1, n-1, mod) % mod\n\n\n\n ret = p\n\n iR = [1]*(k+1)\n\n im = pow(m-1, mod-2, mod)\n\n\n\n for i in range(1, k+1):\n\n iR[i] = max(1, (-(mod//i) * iR[mod % i]) % mod)\n\n ncr = (ncr * (n-i)*iR[i]) % mod\n\n p = (p*im) % mod\n\n ret += p*ncr % mod\n\n\n\n return str(ret % mod)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "code_v0_loc": 24, "code_v1_loc": 28, "code_v0_num_chars": 512, "code_v1_num_chars": 578, "code_v0_no_empty_lines": "# coding: utf-8\ndef solve(*args: str) -> str:\n n, m, k = list(map(int, args[0].split()))\n mod = 998244353\n if m == 1 and n - 1 == k:\n return str(1)\n ncr = 1\n p = m * pow(m - 1, n - 1, mod) % mod\n ret = p\n inv = pow(m - 1, mod - 2, mod)\n for i in range(1, k + 1):\n ncr = (ncr * (n - i) * pow(i, mod - 2, mod)) % mod\n p = (p * inv) % mod\n ret += p * ncr % mod\n return str(ret % mod)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_v1_no_empty_lines": "# coding: utf-8\ndef solve(*args: str) -> str:\n n, m, k = list(map(int, args[0].split()))\n mod = 998244353\n if m == 1 and n - 1 == k:\n return str(1)\n ncr = 1\n p = m * pow(m - 1, n - 1, mod) % mod\n ret = p\n iR = [1] * (k + 1)\n im = pow(m - 1, mod - 2, mod)\n for i in range(1, k + 1):\n iR[i] = max(1, (-(mod // i) * iR[mod % i]) % mod)\n ncr = (ncr * (n - i) * iR[i]) % mod\n p = (p * im) % mod\n ret += p * ncr % mod\n return str(ret % mod)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["- inv = pow(m - 1, mod - 2, mod)", "+ iR = [1] * (k + 1)", "+ im = pow(m - 1, mod - 2, mod)", "- ncr = (ncr * (n - i) * pow(i, mod - 2, mod)) % mod", "- p = (p * inv) % mod", "+ iR[i] = max(1, (-(mod // i) * iR[mod % i]) % mod)", "+ ncr = (ncr * (n - i) * iR[i]) % mod", "+ p = (p * im) % mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4946005352, "measured_runtime_v1": 0.3604053538, "runtime_lift": 1.3723451385, "key": ["s549338354", "s173586541"], "target_token_count_dream": 232, "target_token_bucket_dream": "128-256"} +{"user_id": "u054556734", "problem_id": "p03828", "language": "python", "submission_id_v0": "s442927172", "submission_id_v1": "s952876179", "cpu_time_v0": 83, "cpu_time_v1": 25, "memory_v0": 3316, "memory_v1": 3316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 69.88, "input": "import collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,n+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num //= i ; ans.append(i)\n\n return ans\n\n\n\nn = int(input())\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n", "target": "import collections as col\n\n\n\ndef prime(n):\n\n ans = []\n\n num = n\n\n for i in range(2,int(n**0.5)+1):\n\n if i%2==0 and i!=2: continue\n\n while num%i == 0: num //= i ; ans.append(i)\n\n if num != 1: ans.append(num)\n\n return ans\n\n\n\nn = int(input())\n\nmod = 10**9 + 7\n\n\n\nprimes = []\n\nfor i in range(2,n+1): primes += prime(i)\n\n\n\ncnt = col.Counter(primes)\n\nans = 1\n\nfor key,val in list(cnt.items()): ans *= (val + 1) ; ans %= mod\n\nprint(ans)\n", "code_v0_loc": 20, "code_v1_loc": 21, "code_v0_num_chars": 409, "code_v1_num_chars": 453, "code_v0_no_empty_lines": "import collections as col\n\n\ndef prime(n):\n ans = []\n num = n\n for i in range(2, n + 1):\n if i % 2 == 0 and i != 2:\n continue\n while num % i == 0:\n num //= i\n ans.append(i)\n return ans\n\n\nn = int(input())\nmod = 10**9 + 7\nprimes = []\nfor i in range(2, n + 1):\n primes += prime(i)\ncnt = col.Counter(primes)\nans = 1\nfor key, val in list(cnt.items()):\n ans *= val + 1\n ans %= mod\nprint(ans)\n", "code_v1_no_empty_lines": "import collections as col\n\n\ndef prime(n):\n ans = []\n num = n\n for i in range(2, int(n**0.5) + 1):\n if i % 2 == 0 and i != 2:\n continue\n while num % i == 0:\n num //= i\n ans.append(i)\n if num != 1:\n ans.append(num)\n return ans\n\n\nn = int(input())\nmod = 10**9 + 7\nprimes = []\nfor i in range(2, n + 1):\n primes += prime(i)\ncnt = col.Counter(primes)\nans = 1\nfor key, val in list(cnt.items()):\n ans *= val + 1\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.7619047619, "diff": ["- for i in range(2, n + 1):", "+ for i in range(2, int(n**0.5) + 1):", "+ if num != 1:", "+ ans.append(num)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3365422637, "measured_runtime_v1": 0.2564944384, "runtime_lift": 1.3120840585, "key": ["s442927172", "s952876179"], "target_token_count_dream": 150, "target_token_bucket_dream": "128-256"} +{"user_id": "u852690916", "problem_id": "p02794", "language": "python", "submission_id_v0": "s356881403", "submission_id_v1": "s623982203", "cpu_time_v0": 2735, "cpu_time_v1": 2229, "memory_v0": 44580, "memory_v1": 43936, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.5, "input": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(input())\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(input())\n\n E = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n E[a].append((b,i))\n\n E[b].append((a,i))\n\n \n\n def dfs(s, g):\n\n par = [(-1,-1)] * N\n\n par[s] = (s,-1)\n\n stack = [s]\n\n while stack:\n\n v = stack.pop()\n\n for to, i in E[v]:\n\n if par[to][0] >= 0: continue\n\n par[to] = (v, i)\n\n if to == g: break\n\n stack.append(to)\n\n r = set()\n\n v = g\n\n while v != s:\n\n v, i = par[v]\n\n r.add(i)\n\n return r\n\n \n\n M = int(input())\n\n path = [None] * M\n\n for i in range(M):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n path[i] = dfs(u, v)\n\n\n\n def calc(s): return 1<<(N-1-len(s))\n\n\n\n i_ans = 0\n\n for p in range(1, 1<>= 1\n\n if is_odd: i_ans += calc(s)\n\n else: i_ans -= calc(s)\n\n\n\n print(((1<<(N-1)) - i_ans))\n\n\n\nif __name__ == '__main__':\n\n main()", "code_v0_loc": 52, "code_v1_loc": 54, "code_v0_num_chars": 1262, "code_v1_num_chars": 1288, "code_v0_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n E = [[] for _ in range(N)]\n for i in range(N - 1):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n E[a].append((b, i))\n E[b].append((a, i))\n\n def dfs(s, g):\n par = [(-1, -1)] * N\n par[s] = (s, -1)\n stack = [s]\n while stack:\n v = stack.pop()\n for to, i in E[v]:\n if par[to][0] >= 0:\n continue\n par[to] = (v, i)\n if to == g:\n break\n stack.append(to)\n r = set()\n v = g\n while v != s:\n v, i = par[v]\n r.add(i)\n return r\n\n M = int(input())\n path = [None] * M\n for i in range(M):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n path[i] = dfs(u, v)\n\n def calc(s):\n return 1 << (N - 1 - len(s))\n\n i_ans = 0\n for p in range(1, 1 << M):\n is_odd = bin(p).count(\"1\") & 1\n s = set()\n for i in range(M):\n if p & 1:\n s |= path[i]\n p >>= 1\n if is_odd:\n i_ans += calc(s)\n else:\n i_ans -= calc(s)\n print(((1 << (N - 1)) - i_ans))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n E = [[] for _ in range(N)]\n for i in range(N - 1):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n E[a].append((b, i))\n E[b].append((a, i))\n\n def dfs(s, g):\n par = [(-1, -1)] * N\n par[s] = (s, -1)\n stack = [s]\n while stack:\n v = stack.pop()\n for to, i in E[v]:\n if par[to][0] >= 0:\n continue\n par[to] = (v, i)\n if to == g:\n break\n stack.append(to)\n r = set()\n v = g\n while v != s:\n v, i = par[v]\n r.add(i)\n return r\n\n M = int(input())\n path = [None] * M\n for i in range(M):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n path[i] = dfs(u, v)\n\n def calc(s):\n return 1 << (N - 1 - len(s))\n\n i_ans = 0\n for p in range(1, 1 << M):\n is_odd = 0\n s = set()\n for i in range(M):\n if p & 1:\n s |= path[i]\n is_odd ^= 1\n p >>= 1\n if is_odd:\n i_ans += calc(s)\n else:\n i_ans -= calc(s)\n print(((1 << (N - 1)) - i_ans))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 3.7037037037, "diff": ["- is_odd = bin(p).count(\"1\") & 1", "+ is_odd = 0", "+ is_odd ^= 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3895377469, "measured_runtime_v1": 0.2566085732, "runtime_lift": 1.5180231199, "key": ["s356881403", "s623982203"], "target_token_count_dream": 391, "target_token_bucket_dream": "256-512"} +{"user_id": "u295361373", "problem_id": "p02612", "language": "python", "submission_id_v0": "s197156959", "submission_id_v1": "s836901225", "cpu_time_v0": 226, "cpu_time_v1": 180, "memory_v0": 68124, "memory_v1": 68072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.35, "input": "'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(input())\n\ndef si():return input()\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n#mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile = 0\n\n\n\ndef solve():\n\n \n\n\n\n\n\n\n\n # for _ in range(ii()):\n\n\n\n n=ii()\n\n n%=1000\n\n if n!=0:\n\n n=1000-n\n\n print(n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()", "target": "'''\n\n Auther: ghoshashis545 Ashis Ghosh\n\n College: jalpaiguri Govt Enggineering College\n\n\n\n'''\n\nfrom os import path\n\nimport sys\n\nfrom heapq import heappush,heappop\n\nfrom functools import cmp_to_key as ctk\n\nfrom collections import deque,defaultdict as dd \n\nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n\nfrom itertools import permutations\n\nfrom datetime import datetime\n\nfrom math import ceil,sqrt,log,gcd\n\ndef ii():return int(input())\n\ndef si():return input()\n\ndef mi():return list(map(int,input().split()))\n\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\nmod=1000000007\n\n# mod=998244353\n\ninf = float(\"inf\")\n\nvow=['a','e','i','o','u']\n\ndx,dy=[-1,1,0,0],[0,0,1,-1]\n\n\n\ndef bo(i):\n\n return ord(i)-ord('a')\n\n\n\nfile=0\n\n\n\n\n\n\n\n\n\n\n\ndef solve():\n\n\n\n\n\n # for _ in range(ii()):\n\n \n\n \n\n\n\n n=ii()\n\n n%=1000\n\n if(n!=0):\n\n n=1000-n\n\n print(n)\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\nif __name__ ==\"__main__\":\n\n\n\n if(file):\n\n\n\n if path.exists('input1.txt'):\n\n sys.stdin=open('input1.txt', 'r')\n\n sys.stdout=open('output1.txt','w')\n\n else:\n\n input=sys.stdin.readline\n\n solve()\n", "code_v0_loc": 77, "code_v1_loc": 66, "code_v0_num_chars": 1162, "code_v1_num_chars": 1190, "code_v0_no_empty_lines": "\"\"\"\n Auther: ghoshashis545 Ashis Ghosh\n College: jalpaiguri Govt Enggineering College\n\"\"\"\nfrom os import path\nimport sys\nfrom functools import cmp_to_key as ctk\nfrom collections import deque, defaultdict as dd\nfrom bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right\nfrom itertools import permutations\nfrom datetime import datetime\nfrom math import ceil, sqrt, log, gcd\n\n\ndef ii():\n return int(input())\n\n\ndef si():\n return input()\n\n\ndef mi():\n return list(map(int, input().split()))\n\n\ndef li():\n return list(mi())\n\n\nabc = \"abcdefghijklmnopqrstuvwxyz\"\nmod = 1000000007\n# mod=998244353\ninf = float(\"inf\")\nvow = [\"a\", \"e\", \"i\", \"o\", \"u\"]\ndx, dy = [-1, 1, 0, 0], [0, 0, 1, -1]\n\n\ndef bo(i):\n return ord(i) - ord(\"a\")\n\n\nfile = 0\n\n\ndef solve():\n # for _ in range(ii()):\n n = ii()\n n %= 1000\n if n != 0:\n n = 1000 - n\n print(n)\n\n\nif __name__ == \"__main__\":\n if file:\n if path.exists(\"input1.txt\"):\n sys.stdin = open(\"input1.txt\", \"r\")\n sys.stdout = open(\"output1.txt\", \"w\")\n else:\n input = sys.stdin.readline\n solve()\n", "code_v1_no_empty_lines": "\"\"\"\n Auther: ghoshashis545 Ashis Ghosh\n College: jalpaiguri Govt Enggineering College\n\"\"\"\nfrom os import path\nimport sys\nfrom heapq import heappush, heappop\nfrom functools import cmp_to_key as ctk\nfrom collections import deque, defaultdict as dd\nfrom bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right\nfrom itertools import permutations\nfrom datetime import datetime\nfrom math import ceil, sqrt, log, gcd\n\n\ndef ii():\n return int(input())\n\n\ndef si():\n return input()\n\n\ndef mi():\n return list(map(int, input().split()))\n\n\ndef li():\n return list(mi())\n\n\nabc = \"abcdefghijklmnopqrstuvwxyz\"\nmod = 1000000007\n# mod=998244353\ninf = float(\"inf\")\nvow = [\"a\", \"e\", \"i\", \"o\", \"u\"]\ndx, dy = [-1, 1, 0, 0], [0, 0, 1, -1]\n\n\ndef bo(i):\n return ord(i) - ord(\"a\")\n\n\nfile = 0\n\n\ndef solve():\n # for _ in range(ii()):\n n = ii()\n n %= 1000\n if n != 0:\n n = 1000 - n\n print(n)\n\n\nif __name__ == \"__main__\":\n if file:\n if path.exists(\"input1.txt\"):\n sys.stdin = open(\"input1.txt\", \"r\")\n sys.stdout = open(\"output1.txt\", \"w\")\n else:\n input = sys.stdin.readline\n solve()\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["+from heapq import heappush, heappop"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3258618799, "measured_runtime_v1": 0.2078528001, "runtime_lift": 1.5677531392, "key": ["s197156959", "s836901225"], "target_token_count_dream": 348, "target_token_bucket_dream": "256-512"} +{"user_id": "u133936772", "problem_id": "p02685", "language": "python", "submission_id_v0": "s693454638", "submission_id_v1": "s088786085", "cpu_time_v0": 1252, "cpu_time_v1": 782, "memory_v0": 9184, "memory_v1": 9192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.54, "input": "M=998244353\n\nn,m,k=list(map(int,input().split()))\n\na=0\n\nc=1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n-i-1,M)\n\n c=c*(n-i-1)*pow(i+1,M-2,M)%M\n\nprint((a%M))", "target": "M=998244353\n\nn,m,k=list(map(int,input().split()))\n\na,c=0,1\n\nfor i in range(k+1):\n\n a+=c*m*pow(m-1,n+~i,M)\n\n c=c*(n+~i)*pow(i+1,-1,M)%M\n\nprint((a%M))", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 146, "code_v1_num_chars": 142, "code_v0_no_empty_lines": "M = 998244353\nn, m, k = list(map(int, input().split()))\na = 0\nc = 1\nfor i in range(k + 1):\n a += c * m * pow(m - 1, n - i - 1, M)\n c = c * (n - i - 1) * pow(i + 1, M - 2, M) % M\nprint((a % M))\n", "code_v1_no_empty_lines": "M = 998244353\nn, m, k = list(map(int, input().split()))\na, c = 0, 1\nfor i in range(k + 1):\n a += c * m * pow(m - 1, n + ~i, M)\n c = c * (n + ~i) * pow(i + 1, -1, M) % M\nprint((a % M))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-a = 0", "-c = 1", "+a, c = 0, 1", "- a += c * m * pow(m - 1, n - i - 1, M)", "- c = c * (n - i - 1) * pow(i + 1, M - 2, M) % M", "+ a += c * m * pow(m - 1, n + ~i, M)", "+ c = c * (n + ~i) * pow(i + 1, -1, M) % M"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5053028598, "measured_runtime_v1": 0.3381624324, "runtime_lift": 1.4942607792, "key": ["s693454638", "s088786085"], "target_token_count_dream": 76, "target_token_bucket_dream": "<128"} +{"user_id": "u038408819", "problem_id": "p03680", "language": "python", "submission_id_v0": "s808331415", "submission_id_v1": "s267927939", "cpu_time_v0": 450, "cpu_time_v1": 202, "memory_v0": 7084, "memory_v1": 7084, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.11, "input": "N = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(10 ** 6):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))", "target": "N = int(input())\n\na = [int(input()) for _ in range(N)]\n\n\n\ncnt, i = 0, 0\n\nfor j in range(len(a)):\n\n cnt += 1\n\n if a[i] == 2:\n\n print(cnt)\n\n #break\n\n quit()\n\n else:\n\n i = a[i] - 1\n\nprint((-1))", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 226, "code_v1_num_chars": 225, "code_v0_no_empty_lines": "N = int(input())\na = [int(input()) for _ in range(N)]\ncnt, i = 0, 0\nfor j in range(10**6):\n cnt += 1\n if a[i] == 2:\n print(cnt)\n # break\n quit()\n else:\n i = a[i] - 1\nprint((-1))\n", "code_v1_no_empty_lines": "N = int(input())\na = [int(input()) for _ in range(N)]\ncnt, i = 0, 0\nfor j in range(len(a)):\n cnt += 1\n if a[i] == 2:\n print(cnt)\n # break\n quit()\n else:\n i = a[i] - 1\nprint((-1))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-for j in range(10**6):", "+for j in range(len(a)):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6719723573, "measured_runtime_v1": 0.1459480231, "runtime_lift": 4.6041895124, "key": ["s808331415", "s267927939"], "target_token_count_dream": 79, "target_token_bucket_dream": "<128"} +{"user_id": "u581511366", "problem_id": "p02555", "language": "python", "submission_id_v0": "s399411060", "submission_id_v1": "s856192378", "cpu_time_v0": 183, "cpu_time_v1": 64, "memory_v0": 72444, "memory_v1": 63820, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.03, "input": "import math\n\n\n\n\n\ndef combinations_count(n, r):\n\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\n\n\n\ndef combinations_with_replacement_count(n, r):\n\n return combinations_count(n + r - 1, r)\n\n\n\n\n\ndef main():\n\n s = int(input())\n\n ans = 0\n\n n = s // 3\n\n\n\n for i in range(1, n + 1):\n\n ans += combinations_with_replacement_count(i, 3*(n-i)+s % 3)\n\n\n\n print((ans % (10**9 + 7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "def main():\n\n s = int(input())\n\n dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]\n\n\n\n for i in range(6, s+1):\n\n dp[i] = dp[i-1] + dp[i-3]\n\n\n\n print((dp[s] % (10**9+7)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 24, "code_v1_loc": 12, "code_v0_num_chars": 468, "code_v1_num_chars": 228, "code_v0_no_empty_lines": "import math\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\ndef combinations_with_replacement_count(n, r):\n return combinations_count(n + r - 1, r)\n\n\ndef main():\n s = int(input())\n ans = 0\n n = s // 3\n for i in range(1, n + 1):\n ans += combinations_with_replacement_count(i, 3 * (n - i) + s % 3)\n print((ans % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n s = int(input())\n dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]\n for i in range(6, s + 1):\n dp[i] = dp[i - 1] + dp[i - 3]\n print((dp[s] % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-", "-def combinations_count(n, r):", "- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))", "-", "-", "-def combinations_with_replacement_count(n, r):", "- return combinations_count(n + r - 1, r)", "-", "-", "- ans = 0", "- n = s // 3", "- for i in range(1, n + 1):", "- ans += combinations_with_replacement_count(i, 3 * (n - i) + s % 3)", "- print((ans % (10**9 + 7)))", "+ dp = [0] * 3 + [1] * 3 + [0 for _ in range(s)]", "+ for i in range(6, s + 1):", "+ dp[i] = dp[i - 1] + dp[i - 3]", "+ print((dp[s] % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2865847409, "measured_runtime_v1": 0.2083418293, "runtime_lift": 1.3755506603, "key": ["s399411060", "s856192378"], "target_token_count_dream": 91, "target_token_bucket_dream": "<128"} +{"user_id": "u001024152", "problem_id": "p03806", "language": "python", "submission_id_v0": "s636298531", "submission_id_v1": "s857325561", "cpu_time_v0": 1682, "cpu_time_v1": 292, "memory_v0": 59496, "memory_v1": 48860, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.64, "input": "G_MAX = 40*10\n\nN_MAX = 40\n\nINF = float('inf')\n\n\n\ndp = [[[INF]*(G_MAX+1) for _ in range(G_MAX+1)] \n\n for _ in range(N_MAX+1)]\n\nN,Ma,Mb = list(map(int, input().split()))\n\na,b,c = [],[],[]\n\nfor _ in range(N):\n\n ai,bi,ci = list(map(int, input().split()))\n\n a.append(ai)\n\n b.append(bi)\n\n c.append(ci)\n\n\n\ndp[0][0][0] = 0\n\nfrom math import isinf\n\nfor i in range(N):\n\n for ca in range(G_MAX+1):\n\n for cb in range(G_MAX+1):\n\n if isinf(dp[i][ca][cb]): continue\n\n dp[i+1][ca][cb] = min(dp[i+1][ca][cb],\n\n dp[i][ca][cb])\n\n dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]],\n\n dp[i][ca][cb]+c[i])\n\n \n\n \n\nans = INF\n\nfor ca in range(1,G_MAX+1):\n\n for cb in range(1,G_MAX+1):\n\n if ca*Mb==cb*Ma:\n\n ans = min(ans, dp[N][ca][cb])\n\n \n\nif isinf(ans): ans = -1\n\nprint(ans)", "target": "from math import isinf\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\na = [0]*N\n\nb = [0]*N\n\nc = [0]*N\n\nfor i in range(N):\n\n a[i],b[i],c[i] = list(map(int, input().split()))\n\n\n\nW_MAX = 40*10\n\ndp = [[float('inf')]*(W_MAX+1) for _ in range(W_MAX+1)]\n\ndp[0][0] = 0\n\n\n\nfor i in range(N):\n\n for wa in reversed(list(range(W_MAX+1))):\n\n for wb in reversed(list(range(W_MAX+1))):\n\n if isinf(dp[wa][wb]): continue\n\n if wa+a[i]<=W_MAX and wb+b[i]<=W_MAX:\n\n dp[wa+a[i]][wb+b[i]] = min(dp[wa+a[i]][wb+b[i]],\n\n dp[wa][wb]+c[i])\n\n\n\nans = float('inf')\n\nfor wa in range(1, W_MAX+1):\n\n for wb in range(1, W_MAX+1):\n\n if wa*Mb == wb*Ma:\n\n ans = min(ans, dp[wa][wb])\n\n\n\nif isinf(ans): ans = -1\n\nprint(ans)", "code_v0_loc": 34, "code_v1_loc": 29, "code_v0_num_chars": 926, "code_v1_num_chars": 775, "code_v0_no_empty_lines": "G_MAX = 40 * 10\nN_MAX = 40\nINF = float(\"inf\")\ndp = [[[INF] * (G_MAX + 1) for _ in range(G_MAX + 1)] for _ in range(N_MAX + 1)]\nN, Ma, Mb = list(map(int, input().split()))\na, b, c = [], [], []\nfor _ in range(N):\n ai, bi, ci = list(map(int, input().split()))\n a.append(ai)\n b.append(bi)\n c.append(ci)\ndp[0][0][0] = 0\nfrom math import isinf\n\nfor i in range(N):\n for ca in range(G_MAX + 1):\n for cb in range(G_MAX + 1):\n if isinf(dp[i][ca][cb]):\n continue\n dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb])\n dp[i + 1][ca + a[i]][cb + b[i]] = min(\n dp[i + 1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]\n )\nans = INF\nfor ca in range(1, G_MAX + 1):\n for cb in range(1, G_MAX + 1):\n if ca * Mb == cb * Ma:\n ans = min(ans, dp[N][ca][cb])\nif isinf(ans):\n ans = -1\nprint(ans)\n", "code_v1_no_empty_lines": "from math import isinf\n\nN, Ma, Mb = list(map(int, input().split()))\na = [0] * N\nb = [0] * N\nc = [0] * N\nfor i in range(N):\n a[i], b[i], c[i] = list(map(int, input().split()))\nW_MAX = 40 * 10\ndp = [[float(\"inf\")] * (W_MAX + 1) for _ in range(W_MAX + 1)]\ndp[0][0] = 0\nfor i in range(N):\n for wa in reversed(list(range(W_MAX + 1))):\n for wb in reversed(list(range(W_MAX + 1))):\n if isinf(dp[wa][wb]):\n continue\n if wa + a[i] <= W_MAX and wb + b[i] <= W_MAX:\n dp[wa + a[i]][wb + b[i]] = min(\n dp[wa + a[i]][wb + b[i]], dp[wa][wb] + c[i]\n )\nans = float(\"inf\")\nfor wa in range(1, W_MAX + 1):\n for wb in range(1, W_MAX + 1):\n if wa * Mb == wb * Ma:\n ans = min(ans, dp[wa][wb])\nif isinf(ans):\n ans = -1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 14.7058823529, "diff": ["-G_MAX = 40 * 10", "-N_MAX = 40", "-INF = float(\"inf\")", "-dp = [[[INF] * (G_MAX + 1) for _ in range(G_MAX + 1)] for _ in range(N_MAX + 1)]", "-N, Ma, Mb = list(map(int, input().split()))", "-a, b, c = [], [], []", "-for _ in range(N):", "- ai, bi, ci = list(map(int, input().split()))", "- a.append(ai)", "- b.append(bi)", "- c.append(ci)", "-dp[0][0][0] = 0", "+N, Ma, Mb = list(map(int, input().split()))", "+a = [0] * N", "+b = [0] * N", "+c = [0] * N", "- for ca in range(G_MAX + 1):", "- for cb in range(G_MAX + 1):", "- if isinf(dp[i][ca][cb]):", "+ a[i], b[i], c[i] = list(map(int, input().split()))", "+W_MAX = 40 * 10", "+dp = [[float(\"inf\")] * (W_MAX + 1) for _ in range(W_MAX + 1)]", "+dp[0][0] = 0", "+for i in range(N):", "+ for wa in reversed(list(range(W_MAX + 1))):", "+ for wb in reversed(list(range(W_MAX + 1))):", "+ if isinf(dp[wa][wb]):", "- dp[i + 1][ca][cb] = min(dp[i + 1][ca][cb], dp[i][ca][cb])", "- dp[i + 1][ca + a[i]][cb + b[i]] = min(", "- dp[i + 1][ca + a[i]][cb + b[i]], dp[i][ca][cb] + c[i]", "- )", "-ans = INF", "-for ca in range(1, G_MAX + 1):", "- for cb in range(1, G_MAX + 1):", "- if ca * Mb == cb * Ma:", "- ans = min(ans, dp[N][ca][cb])", "+ if wa + a[i] <= W_MAX and wb + b[i] <= W_MAX:", "+ dp[wa + a[i]][wb + b[i]] = min(", "+ dp[wa + a[i]][wb + b[i]], dp[wa][wb] + c[i]", "+ )", "+ans = float(\"inf\")", "+for wa in range(1, W_MAX + 1):", "+ for wb in range(1, W_MAX + 1):", "+ if wa * Mb == wb * Ma:", "+ ans = min(ans, dp[wa][wb])"], "diff_only_import_comment": false, "measured_runtime_v0": 2.4082550259, "measured_runtime_v1": 0.8679478877, "runtime_lift": 2.7746539396, "key": ["s636298531", "s857325561"], "target_token_count_dream": 271, "target_token_bucket_dream": "256-512"} +{"user_id": "u170183831", "problem_id": "p03568", "language": "python", "submission_id_v0": "s971455595", "submission_id_v1": "s272804435", "cpu_time_v0": 148, "cpu_time_v1": 29, "memory_v0": 9116, "memory_v1": 9072, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.41, "input": "from itertools import product\n\n\n\nn = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ncount = 0\n\nfor C in product((-1, 0, 1), repeat=n):\n\n total = 1\n\n for a, c in zip(A, C):\n\n total *= (a + c)\n\n if total % 2 == 0:\n\n count += 1\n\nprint(count)", "target": "n = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ncount = 1\n\nfor a in A:\n\n count *= 2 if a % 2 == 0 else 1\n\nprint((3 ** n - count))", "code_v0_loc": 13, "code_v1_loc": 7, "code_v0_num_chars": 253, "code_v1_num_chars": 137, "code_v0_no_empty_lines": "from itertools import product\n\nn = int(input())\nA = list(map(int, input().split()))\ncount = 0\nfor C in product((-1, 0, 1), repeat=n):\n total = 1\n for a, c in zip(A, C):\n total *= a + c\n if total % 2 == 0:\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "n = int(input())\nA = list(map(int, input().split()))\ncount = 1\nfor a in A:\n count *= 2 if a % 2 == 0 else 1\nprint((3**n - count))\n", "code_same": false, "relative_loc_diff_percent": 46.1538461538, "diff": ["-from itertools import product", "-", "-count = 0", "-for C in product((-1, 0, 1), repeat=n):", "- total = 1", "- for a, c in zip(A, C):", "- total *= a + c", "- if total % 2 == 0:", "- count += 1", "-print(count)", "+count = 1", "+for a in A:", "+ count *= 2 if a % 2 == 0 else 1", "+print((3**n - count))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2956474931, "measured_runtime_v1": 0.0067464924, "runtime_lift": 43.8224007049, "key": ["s971455595", "s272804435"], "target_token_count_dream": 51, "target_token_bucket_dream": "<128"} +{"user_id": "u440566786", "problem_id": "p03164", "language": "python", "submission_id_v0": "s415436180", "submission_id_v1": "s201445864", "cpu_time_v0": 345, "cpu_time_v1": 221, "memory_v0": 70988, "memory_v1": 40176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 35.94, "input": "import sys\n\nsys.setrecursionlimit(2147483647)\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\ninput=lambda :sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n,W=list(map(int,input().split()))\n\n WV=[tuple(map(int,input().split())) for _ in range(n)]\n\n\n\n V=100000\n\n dp=[INF]*(V+1)\n\n dp[0]=0\n\n\n\n for w,v in WV:\n\n for x in range(V,-1,-1):\n\n if(x+v<=V):\n\n dp[x+v]=min(dp[x+v],dp[x]+w)\n\n\n\n for x in range(V,-1,-1):\n\n if(dp[x]<=W):\n\n print(x)\n\n return\n\nresolve()", "target": "import sys\n\nINF = 1 << 60\n\nMOD = 10**9 + 7 # 998244353\n\nsys.setrecursionlimit(2147483647)\n\ninput = lambda:sys.stdin.readline().rstrip()\n\ndef resolve():\n\n n, W = list(map(int, input().split()))\n\n dp = [INF] * (n * 1001 + 1)\n\n dp[0] = 0\n\n for _ in range(n):\n\n w, v = list(map(int, input().split()))\n\n for v0 in range(n * 1001, -1, -1):\n\n if dp[v0] == INF:\n\n continue\n\n if v + v0 <= n * 1001:\n\n dp[v + v0] = min(dp[v + v0], dp[v0] + w)\n\n for v in range(n * 1001, -1, -1):\n\n if dp[v] <= W:\n\n print(v)\n\n return\n\nresolve()", "code_v0_loc": 23, "code_v1_loc": 21, "code_v0_num_chars": 515, "code_v1_num_chars": 614, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nMOD = 10**9 + 7\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n n, W = list(map(int, input().split()))\n WV = [tuple(map(int, input().split())) for _ in range(n)]\n V = 100000\n dp = [INF] * (V + 1)\n dp[0] = 0\n for w, v in WV:\n for x in range(V, -1, -1):\n if x + v <= V:\n dp[x + v] = min(dp[x + v], dp[x] + w)\n for x in range(V, -1, -1):\n if dp[x] <= W:\n print(x)\n return\n\n\nresolve()\n", "code_v1_no_empty_lines": "import sys\n\nINF = 1 << 60\nMOD = 10**9 + 7 # 998244353\nsys.setrecursionlimit(2147483647)\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef resolve():\n n, W = list(map(int, input().split()))\n dp = [INF] * (n * 1001 + 1)\n dp[0] = 0\n for _ in range(n):\n w, v = list(map(int, input().split()))\n for v0 in range(n * 1001, -1, -1):\n if dp[v0] == INF:\n continue\n if v + v0 <= n * 1001:\n dp[v + v0] = min(dp[v + v0], dp[v0] + w)\n for v in range(n * 1001, -1, -1):\n if dp[v] <= W:\n print(v)\n return\n\n\nresolve()\n", "code_same": false, "relative_loc_diff_percent": 8.6956521739, "diff": ["+INF = 1 << 60", "+MOD = 10**9 + 7 # 998244353", "-INF = float(\"inf\")", "-MOD = 10**9 + 7", "- WV = [tuple(map(int, input().split())) for _ in range(n)]", "- V = 100000", "- dp = [INF] * (V + 1)", "+ dp = [INF] * (n * 1001 + 1)", "- for w, v in WV:", "- for x in range(V, -1, -1):", "- if x + v <= V:", "- dp[x + v] = min(dp[x + v], dp[x] + w)", "- for x in range(V, -1, -1):", "- if dp[x] <= W:", "- print(x)", "+ for _ in range(n):", "+ w, v = list(map(int, input().split()))", "+ for v0 in range(n * 1001, -1, -1):", "+ if dp[v0] == INF:", "+ continue", "+ if v + v0 <= n * 1001:", "+ dp[v + v0] = min(dp[v + v0], dp[v0] + w)", "+ for v in range(n * 1001, -1, -1):", "+ if dp[v] <= W:", "+ print(v)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.2692114379, "measured_runtime_v1": 0.2021781888, "runtime_lift": 6.2776872491, "key": ["s415436180", "s201445864"], "target_token_count_dream": 230, "target_token_bucket_dream": "128-256"} +{"user_id": "u764956288", "problem_id": "p02691", "language": "python", "submission_id_v0": "s430506044", "submission_id_v1": "s372862352", "cpu_time_v0": 215, "cpu_time_v1": 188, "memory_v0": 57704, "memory_v1": 36612, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.56, "input": "from collections import defaultdict\n\n\n\n\n\ndef main():\n\n _ = int(input())\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n L[i + height] += 1\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "from collections import defaultdict\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n heights = list(map(int, input().split()))\n\n\n\n \"\"\"\n\n for j>i, j-i = Ai + Aj\n\n i + Ai = j -Aj\n\n \"\"\"\n\n\n\n L = defaultdict(int)\n\n R = defaultdict(int)\n\n\n\n for i, height in enumerate(heights):\n\n if i + height < N:\n\n L[i + height] += 1\n\n \n\n if i - height > 0:\n\n R[i - height] += 1\n\n\n\n total_count = 0\n\n for x, count_l in list(L.items()):\n\n if x in R:\n\n count_r = R[x]\n\n total_count += count_l * count_r\n\n\n\n print(total_count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 30, "code_v1_loc": 33, "code_v0_num_chars": 565, "code_v1_num_chars": 639, "code_v0_no_empty_lines": "from collections import defaultdict\n\n\ndef main():\n _ = int(input())\n heights = list(map(int, input().split()))\n \"\"\"\n for j>i, j-i = Ai + Aj\n i + Ai = j -Aj\n \"\"\"\n L = defaultdict(int)\n R = defaultdict(int)\n for i, height in enumerate(heights):\n L[i + height] += 1\n R[i - height] += 1\n total_count = 0\n for x, count_l in list(L.items()):\n if x in R:\n count_r = R[x]\n total_count += count_l * count_r\n print(total_count)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\n\ndef main():\n N = int(input())\n heights = list(map(int, input().split()))\n \"\"\"\n for j>i, j-i = Ai + Aj\n i + Ai = j -Aj\n \"\"\"\n L = defaultdict(int)\n R = defaultdict(int)\n for i, height in enumerate(heights):\n if i + height < N:\n L[i + height] += 1\n if i - height > 0:\n R[i - height] += 1\n total_count = 0\n for x, count_l in list(L.items()):\n if x in R:\n count_r = R[x]\n total_count += count_l * count_r\n print(total_count)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["- _ = int(input())", "+ N = int(input())", "- L[i + height] += 1", "- R[i - height] += 1", "+ if i + height < N:", "+ L[i + height] += 1", "+ if i - height > 0:", "+ R[i - height] += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3616042199, "measured_runtime_v1": 0.2114392846, "runtime_lift": 1.7102035728, "key": ["s430506044", "s372862352"], "target_token_count_dream": 171, "target_token_bucket_dream": "128-256"} +{"user_id": "u747602774", "problem_id": "p03039", "language": "python", "submission_id_v0": "s387237372", "submission_id_v1": "s322645394", "cpu_time_v0": 230, "cpu_time_v1": 47, "memory_v0": 9412, "memory_v1": 9476, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 79.57, "input": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\ndef f1(x,y,a,b):\n\n return (a+b-x-y)*(a-x+1)*(b-y+1)//2\n\n\n\ndef f2(x,a):\n\n return (a-x)*(a-x+1)//2\n\n\n\nans = 0\n\n\n\nfor x in range(1,n+1):\n\n for y in range(1,m+1):\n\n a = n-x+1\n\n b = m-y+1\n\n c = m*(a*(a-1)+x*(x-1))\n\n d = n*(b*(b-1)+y*(y-1))\n\n ans += (c+d)//2\n\n ans %= mod\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "target": "import sys\n\nreadline = sys.stdin.readline\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\n#mod = 998244353\n\nINF = 10**18\n\neps = 10**-7\n\n\n\nm,n,k = list(map(int,readline().split()))\n\n\n\ndef comb(n, r, mod):\n\n r = min(r, n-r)\n\n mol = 1\n\n deno = 1\n\n for i in range(1, r+1):\n\n mol = mol * (n-r+i) % mod\n\n deno = deno * i % mod\n\n ret = mol * pow(deno, mod-2, mod) % mod\n\n return ret\n\n\n\nans = m*n*(m+n)*(m*n-1)//3\n\n\n\nans = (ans * comb(m*n-2,k-2,mod))%mod\n\nans = ans*pow(2,mod-2,mod)%mod\n\n\n\nprint(ans)\n\n\n", "code_v0_loc": 42, "code_v1_loc": 27, "code_v0_num_chars": 809, "code_v1_num_chars": 519, "code_v0_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\ndef f1(x, y, a, b):\n return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2\n\n\ndef f2(x, a):\n return (a - x) * (a - x + 1) // 2\n\n\nans = 0\nfor x in range(1, n + 1):\n for y in range(1, m + 1):\n a = n - x + 1\n b = m - y + 1\n c = m * (a * (a - 1) + x * (x - 1))\n d = n * (b * (b - 1) + y * (y - 1))\n ans += (c + d) // 2\n ans %= mod\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n# mod = 998244353\nINF = 10**18\neps = 10**-7\nm, n, k = list(map(int, readline().split()))\n\n\ndef comb(n, r, mod):\n r = min(r, n - r)\n mol = 1\n deno = 1\n for i in range(1, r + 1):\n mol = mol * (n - r + i) % mod\n deno = deno * i % mod\n ret = mol * pow(deno, mod - 2, mod) % mod\n return ret\n\n\nans = m * n * (m + n) * (m * n - 1) // 3\nans = (ans * comb(m * n - 2, k - 2, mod)) % mod\nans = ans * pow(2, mod - 2, mod) % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 35.7142857143, "diff": ["-def f1(x, y, a, b):", "- return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2", "-", "-", "-def f2(x, a):", "- return (a - x) * (a - x + 1) // 2", "-", "-", "-ans = 0", "-for x in range(1, n + 1):", "- for y in range(1, m + 1):", "- a = n - x + 1", "- b = m - y + 1", "- c = m * (a * (a - 1) + x * (x - 1))", "- d = n * (b * (b - 1) + y * (y - 1))", "- ans += (c + d) // 2", "- ans %= mod", "+ans = m * n * (m + n) * (m * n - 1) // 3"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3618569455, "measured_runtime_v1": 0.2781652772, "runtime_lift": 1.3008702923, "key": ["s387237372", "s322645394"], "target_token_count_dream": 217, "target_token_bucket_dream": "128-256"} +{"user_id": "u800396927", "problem_id": "p03253", "language": "python", "submission_id_v0": "s723979708", "submission_id_v1": "s327831897", "cpu_time_v0": 110, "cpu_time_v1": 67, "memory_v0": 10868, "memory_v1": 66752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.09, "input": "N,M = list(map(int,input().split()))\n\ndiv =[]\n\nfor i in range(2,int(M**(1/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M = M//i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1: div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum = len(frac)\n\nfor i in range(len(frac)-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1] * (N+50)\n\nfinv[-1] = pow(frac[-1], mod-2, mod)\n\nfor i in range(1, num):\n\n finv[num-1-i] = finv[num-i] * (num-i) % mod\n\nans = 1\n\nfor i in div:\n\n ans = ans * frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)", "target": "N,M = list(map(int,input().split()))\n\ndiv = []\n\nfor i in range(2,int(M**(1/2))+2):\n\n cur = 0\n\n while M%i==0:\n\n M//=i\n\n cur += 1\n\n if cur >=1:\n\n div.append(cur)\n\nif M>1:div.append(1)\n\ndiv.sort()\n\nmod = 10**9+7\n\nfrac = [1]*(N+50)\n\nnum=len(frac)\n\nfor i in range(num-1):\n\n frac[i+1] = frac[i]*(i+1)%mod\n\nfinv = [1]*(N+50)\n\nfinv[-1] = pow(frac[-1],mod-2,mod)\n\nans = 1\n\nfor i in range(1,num):\n\n finv[num-1-i] = finv[num-i]*(num-i)%mod\n\nfor i in div:\n\n ans =ans*frac[N+i-1]*finv[N-1]*finv[i]%mod\n\nprint(ans)", "code_v0_loc": 24, "code_v1_loc": 24, "code_v0_num_chars": 554, "code_v1_num_chars": 534, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\ndiv = []\nfor i in range(2, int(M ** (1 / 2)) + 2):\n cur = 0\n while M % i == 0:\n M = M // i\n cur += 1\n if cur >= 1:\n div.append(cur)\nif M > 1:\n div.append(1)\ndiv.sort()\nmod = 10**9 + 7\nfrac = [1] * (N + 50)\nnum = len(frac)\nfor i in range(len(frac) - 1):\n frac[i + 1] = frac[i] * (i + 1) % mod\nfinv = [1] * (N + 50)\nfinv[-1] = pow(frac[-1], mod - 2, mod)\nfor i in range(1, num):\n finv[num - 1 - i] = finv[num - i] * (num - i) % mod\nans = 1\nfor i in div:\n ans = ans * frac[N + i - 1] * finv[N - 1] * finv[i] % mod\nprint(ans)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\ndiv = []\nfor i in range(2, int(M ** (1 / 2)) + 2):\n cur = 0\n while M % i == 0:\n M //= i\n cur += 1\n if cur >= 1:\n div.append(cur)\nif M > 1:\n div.append(1)\ndiv.sort()\nmod = 10**9 + 7\nfrac = [1] * (N + 50)\nnum = len(frac)\nfor i in range(num - 1):\n frac[i + 1] = frac[i] * (i + 1) % mod\nfinv = [1] * (N + 50)\nfinv[-1] = pow(frac[-1], mod - 2, mod)\nans = 1\nfor i in range(1, num):\n finv[num - 1 - i] = finv[num - i] * (num - i) % mod\nfor i in div:\n ans = ans * frac[N + i - 1] * finv[N - 1] * finv[i] % mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- M = M // i", "+ M //= i", "-for i in range(len(frac) - 1):", "+for i in range(num - 1):", "+ans = 1", "-ans = 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.47082161, "measured_runtime_v1": 0.3749034932, "runtime_lift": 1.2558474875, "key": ["s723979708", "s327831897"], "target_token_count_dream": 218, "target_token_bucket_dream": "128-256"} +{"user_id": "u290563917", "problem_id": "p03371", "language": "python", "submission_id_v0": "s511736682", "submission_id_v1": "s377839923", "cpu_time_v0": 188, "cpu_time_v1": 64, "memory_v0": 40940, "memory_v1": 65396, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.96, "input": "a, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(c_max+1):\n\n ac = x - (cc // 2)\n\n bc = y - (cc // 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)", "target": "a, b, c, x, y = list(map(int, input().split()))\n\n# print(a, b, c, x, y)\n\n\n\nans = 10000 * (10 **5) + 7\n\nc_max = 0\n\nif x > y:\n\n c_max = x * 2\n\nelse:\n\n c_max = y * 2\n\n\n\nfor cc in range(0, c_max+1, 2):\n\n ac = x - (cc // 2)\n\n bc = y - (cc // 2)\n\n \n\n if ac < 0:\n\n ac = 0\n\n if bc < 0:\n\n bc = 0\n\n price = ac * a + bc * b + cc * c\n\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n\n ans = min(ans, price)\n\n\n\nprint(ans)\n\n ", "code_v0_loc": 23, "code_v1_loc": 24, "code_v0_num_chars": 436, "code_v1_num_chars": 446, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\n# print(a, b, c, x, y)\nans = 10000 * (10**5) + 7\nc_max = 0\nif x > y:\n c_max = x * 2\nelse:\n c_max = y * 2\nfor cc in range(c_max + 1):\n ac = x - (cc // 2)\n bc = y - (cc // 2)\n if ac < 0:\n ac = 0\n if bc < 0:\n bc = 0\n price = ac * a + bc * b + cc * c\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n ans = min(ans, price)\nprint(ans)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\n# print(a, b, c, x, y)\nans = 10000 * (10**5) + 7\nc_max = 0\nif x > y:\n c_max = x * 2\nelse:\n c_max = y * 2\nfor cc in range(0, c_max + 1, 2):\n ac = x - (cc // 2)\n bc = y - (cc // 2)\n if ac < 0:\n ac = 0\n if bc < 0:\n bc = 0\n price = ac * a + bc * b + cc * c\n # print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))\n ans = min(ans, price)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 4.1666666667, "diff": ["-for cc in range(c_max + 1):", "+for cc in range(0, c_max + 1, 2):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4004499781, "measured_runtime_v1": 0.3093135242, "runtime_lift": 1.2946410251, "key": ["s511736682", "s377839923"], "target_token_count_dream": 196, "target_token_bucket_dream": "128-256"} +{"user_id": "u887207211", "problem_id": "p03425", "language": "python", "submission_id_v0": "s819679830", "submission_id_v1": "s546088432", "cpu_time_v0": 172, "cpu_time_v1": 153, "memory_v0": 3064, "memory_v1": 9752, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.05, "input": "N = int(input())\n\nname = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor _ in range(N):\n\n S = input()\n\n if(S[0] in name):\n\n name[S[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += name[march[i]] * name[march[j]] * name[march[k]]\n\nprint(ans)", "target": "N = int(input())\n\nS = [input() for _ in range(N)]\n\n\n\nhead = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}\n\nmarch = \"MARCH\"\n\nfor s in S:\n\n if(s[0] in head):\n\n head[s[0]] += 1\n\nans = 0\n\nfor i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n ans += head[march[i]] * head[march[j]] * head[march[k]]\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 14, "code_v0_num_chars": 312, "code_v1_num_chars": 325, "code_v0_no_empty_lines": "N = int(input())\nname = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}\nmarch = \"MARCH\"\nfor _ in range(N):\n S = input()\n if S[0] in name:\n name[S[0]] += 1\nans = 0\nfor i in range(3):\n for j in range(i + 1, 4):\n for k in range(j + 1, 5):\n ans += name[march[i]] * name[march[j]] * name[march[k]]\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nS = [input() for _ in range(N)]\nhead = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}\nmarch = \"MARCH\"\nfor s in S:\n if s[0] in head:\n head[s[0]] += 1\nans = 0\nfor i in range(3):\n for j in range(i + 1, 4):\n for k in range(j + 1, 5):\n ans += head[march[i]] * head[march[j]] * head[march[k]]\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-name = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "+S = [input() for _ in range(N)]", "+head = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "-for _ in range(N):", "- S = input()", "- if S[0] in name:", "- name[S[0]] += 1", "+for s in S:", "+ if s[0] in head:", "+ head[s[0]] += 1", "- ans += name[march[i]] * name[march[j]] * name[march[k]]", "+ ans += head[march[i]] * head[march[j]] * head[march[k]]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4009393435, "measured_runtime_v1": 0.3106073449, "runtime_lift": 1.2908237686, "key": ["s819679830", "s546088432"], "target_token_count_dream": 132, "target_token_bucket_dream": "128-256"} +{"user_id": "u023958502", "problem_id": "p02899", "language": "python", "submission_id_v0": "s601919152", "submission_id_v1": "s937084523", "cpu_time_v0": 140, "cpu_time_v1": 86, "memory_v0": 19300, "memory_v1": 15588, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 38.57, "input": "n = int(input())\n\na = list(map(int,input().split()))\n\nans = [i for i in range(n)]\n\na1 = sorted(a)\n\nfor i in range(n):\n\n num = a[i]\n\n ans[num - 1] = str(i + 1)\n\n \n\nprint((' '.join(ans)))", "target": "n = int(input())\n\n# n,k = map(int,input().split())\n\na = list(map(int,input().split()))\n\nans = [0 for _ in range(n)]\n\nfor i in range(n):\n\n ans[a[i] - 1] = str(i + 1)\n\nprint((\" \".join(ans)))", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 192, "code_v1_num_chars": 187, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nans = [i for i in range(n)]\na1 = sorted(a)\nfor i in range(n):\n num = a[i]\n ans[num - 1] = str(i + 1)\nprint((\" \".join(ans)))\n", "code_v1_no_empty_lines": "n = int(input())\n# n,k = map(int,input().split())\na = list(map(int, input().split()))\nans = [0 for _ in range(n)]\nfor i in range(n):\n ans[a[i] - 1] = str(i + 1)\nprint((\" \".join(ans)))\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["+# n,k = map(int,input().split())", "-ans = [i for i in range(n)]", "-a1 = sorted(a)", "+ans = [0 for _ in range(n)]", "- num = a[i]", "- ans[num - 1] = str(i + 1)", "+ ans[a[i] - 1] = str(i + 1)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2984062884, "measured_runtime_v1": 0.2260574257, "runtime_lift": 1.3200463887, "key": ["s601919152", "s937084523"], "target_token_count_dream": 62, "target_token_bucket_dream": "<128"} +{"user_id": "u312025627", "problem_id": "p02901", "language": "python", "submission_id_v0": "s827366183", "submission_id_v1": "s086626630", "cpu_time_v0": 364, "cpu_time_v1": 311, "memory_v0": 78552, "memory_v1": 75116, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.56, "input": "INF = 2*10**7\n\n\n\n\n\ndef main():\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "INF = 2*10**7\n\n\n\n\n\ndef main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 34, "code_v1_loc": 36, "code_v0_num_chars": 827, "code_v1_num_chars": 882, "code_v0_no_empty_lines": "INF = 2 * 10**7\n\n\ndef main():\n N, M = (int(i) for i in input().split())\n A = []\n B = []\n C = []\n for _ in range(M):\n a, b = (int(i) for i in input().split())\n A.append(a)\n B.append(b)\n bit = 0\n for i in input().split():\n bit |= 1 << (int(i) - 1)\n C.append(bit)\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n if dp[i][j] != INF:\n next_bit = j | C[i]\n dp[i + 1][next_bit] = min(dp[i + 1][next_bit], dp[i][j] + A[i])\n ans = dp[-1][-1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n # print(*dp, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "INF = 2 * 10**7\n\n\ndef main():\n import sys\n\n input = sys.stdin.buffer.readline\n N, M = (int(i) for i in input().split())\n A = []\n B = []\n C = []\n for _ in range(M):\n a, b = (int(i) for i in input().split())\n A.append(a)\n B.append(b)\n bit = 0\n for i in input().split():\n bit |= 1 << (int(i) - 1)\n C.append(bit)\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n if dp[i][j] != INF:\n next_bit = j | C[i]\n dp[i + 1][next_bit] = min(dp[i + 1][next_bit], dp[i][j] + A[i])\n ans = dp[-1][-1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n # print(*dp, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 5.5555555556, "diff": ["+ import sys", "+", "+ input = sys.stdin.buffer.readline"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4147989278, "measured_runtime_v1": 0.289175185, "runtime_lift": 1.4344208955, "key": ["s827366183", "s086626630"], "target_token_count_dream": 282, "target_token_bucket_dream": "256-512"} +{"user_id": "u427344224", "problem_id": "p03253", "language": "python", "submission_id_v0": "s043094515", "submission_id_v1": "s952701444", "cpu_time_v0": 1290, "cpu_time_v1": 20, "memory_v0": 5164, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 98.45, "input": "def prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num //= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\nfrom math import factorial\n\n\n\n\n\ndef comb(n, r, R):\n\n if n not in R:\n\n a = factorial(n)\n\n R[n] = a\n\n else:\n\n a = R[n]\n\n\n\n if n - r not in R:\n\n b = factorial(n - r)\n\n R[n - r] = b\n\n else:\n\n b = R[n - r]\n\n\n\n if r not in R:\n\n c = factorial(r)\n\n R[r] = c\n\n else:\n\n c = R[r]\n\n return a // (b * c)\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nR = dict()\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= comb(v + n - 1, v, R)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n", "target": "def prime_factorize(num):\n\n \"\"\"\n\n This function performs prime factorization on the input natural number.\n\n The result is returned in the form of a dictionary with the prime number as the key\n\n and its number as the value.\n\n :param num:\n\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n\n \"\"\"\n\n prime_factor = {}\n\n i = 2\n\n while i ** 2 <= num:\n\n while num % i == 0:\n\n num //= i\n\n if i in list(prime_factor.keys()):\n\n prime_factor[i] += 1\n\n else:\n\n prime_factor[i] = 1\n\n i += 1\n\n if num > 1:\n\n prime_factor[num] = 1\n\n return prime_factor\n\n\n\n\n\n\n\ndef combination(n, r):\n\n r = min(n-r, r)\n\n result = 1\n\n for i in range(n, n-r, -1):\n\n result *= i\n\n for i in range(1, r+1):\n\n result //= i\n\n return result\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nr = 1\n\n\n\nprime_fac = prime_factorize(m)\n\nfor v in list(prime_fac.values()):\n\n r *= combination(v + n - 1, v)\n\nmod = 1000000000 + 7\n\nprint((r % mod))\n", "code_v0_loc": 56, "code_v1_loc": 42, "code_v0_num_chars": 1269, "code_v1_num_chars": 1072, "code_v0_no_empty_lines": "def prime_factorize(num):\n \"\"\"\n This function performs prime factorization on the input natural number.\n The result is returned in the form of a dictionary with the prime number as the key\n and its number as the value.\n :param num:\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n \"\"\"\n prime_factor = {}\n i = 2\n while i**2 <= num:\n while num % i == 0:\n num //= i\n if i in list(prime_factor.keys()):\n prime_factor[i] += 1\n else:\n prime_factor[i] = 1\n i += 1\n if num > 1:\n prime_factor[num] = 1\n return prime_factor\n\n\nfrom math import factorial\n\n\ndef comb(n, r, R):\n if n not in R:\n a = factorial(n)\n R[n] = a\n else:\n a = R[n]\n if n - r not in R:\n b = factorial(n - r)\n R[n - r] = b\n else:\n b = R[n - r]\n if r not in R:\n c = factorial(r)\n R[r] = c\n else:\n c = R[r]\n return a // (b * c)\n\n\nn, m = list(map(int, input().split()))\nr = 1\nR = dict()\nprime_fac = prime_factorize(m)\nfor v in list(prime_fac.values()):\n r *= comb(v + n - 1, v, R)\nmod = 1000000000 + 7\nprint((r % mod))\n", "code_v1_no_empty_lines": "def prime_factorize(num):\n \"\"\"\n This function performs prime factorization on the input natural number.\n The result is returned in the form of a dictionary with the prime number as the key\n and its number as the value.\n :param num:\n :return prime_factor: Dictionary with the prime number as the key and its number as the value.\n \"\"\"\n prime_factor = {}\n i = 2\n while i**2 <= num:\n while num % i == 0:\n num //= i\n if i in list(prime_factor.keys()):\n prime_factor[i] += 1\n else:\n prime_factor[i] = 1\n i += 1\n if num > 1:\n prime_factor[num] = 1\n return prime_factor\n\n\ndef combination(n, r):\n r = min(n - r, r)\n result = 1\n for i in range(n, n - r, -1):\n result *= i\n for i in range(1, r + 1):\n result //= i\n return result\n\n\nn, m = list(map(int, input().split()))\nr = 1\nprime_fac = prime_factorize(m)\nfor v in list(prime_fac.values()):\n r *= combination(v + n - 1, v)\nmod = 1000000000 + 7\nprint((r % mod))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-from math import factorial", "-", "-", "-def comb(n, r, R):", "- if n not in R:", "- a = factorial(n)", "- R[n] = a", "- else:", "- a = R[n]", "- if n - r not in R:", "- b = factorial(n - r)", "- R[n - r] = b", "- else:", "- b = R[n - r]", "- if r not in R:", "- c = factorial(r)", "- R[r] = c", "- else:", "- c = R[r]", "- return a // (b * c)", "+def combination(n, r):", "+ r = min(n - r, r)", "+ result = 1", "+ for i in range(n, n - r, -1):", "+ result *= i", "+ for i in range(1, r + 1):", "+ result //= i", "+ return result", "-R = dict()", "- r *= comb(v + n - 1, v, R)", "+ r *= combination(v + n - 1, v)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4743831277, "measured_runtime_v1": 0.1920195122, "runtime_lift": 2.4704943903, "key": ["s043094515", "s952701444"], "target_token_count_dream": 300, "target_token_bucket_dream": "256-512"} +{"user_id": "u768896740", "problem_id": "p02951", "language": "python", "submission_id_v0": "s688063139", "submission_id_v1": "s870650241", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif a < b + c:\n\n print((b+c-a))\n\nelse:\n\n print((0))", "target": "a,b,c = list(map(int, input().split()))\n\n\n\nprint((max(0, c-(a-b))))", "code_v0_loc": 6, "code_v1_loc": 3, "code_v0_num_chars": 91, "code_v1_num_chars": 59, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif a < b + c:\n print((b + c - a))\nelse:\n print((0))\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nprint((max(0, c - (a - b))))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-if a < b + c:", "- print((b + c - a))", "-else:", "- print((0))", "+print((max(0, c - (a - b))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2555535069, "measured_runtime_v1": 0.0829026203, "runtime_lift": 3.0825745416, "key": ["s688063139", "s870650241"], "target_token_count_dream": 24, "target_token_bucket_dream": "<128"} +{"user_id": "u075012704", "problem_id": "p03038", "language": "python", "submission_id_v0": "s846597544", "submission_id_v1": "s758849446", "cpu_time_v0": 756, "cpu_time_v1": 520, "memory_v0": 43296, "memory_v1": 25512, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 31.22, "input": "from collections import Counter\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\nX = Counter(A)\n\nfor i in range(M):\n\n B, C = list(map(int, input().split()))\n\n X[C] += B\n\n\n\nZ = []\n\nfor key, value in list(X.items()):\n\n Z.append((key, value))\n\n\n\nZ.sort(key=lambda x: x[0], reverse=True)\n\n\n\nans = 0\n\ncnt = 0\n\n\n\nfor value, key in Z:\n\n if cnt + key <= N:\n\n ans += key * value\n\n cnt += key\n\n else:\n\n ans += (N - cnt) * value\n\n break\n\n\n\nprint(ans)\n", "target": "N, M = list(map(int, input().split()))\n\nA = sorted(list(map(int, input().split())))\n\nquery = []\n\nfor i in range(M):\n\n b, c = list(map(int, input().split()))\n\n query.append([b, c])\n\nquery.sort(key=lambda q: q[1], reverse=True)\n\n\n\n\n\ni = 0\n\nfor b, c in query:\n\n while i < N and b > 0:\n\n if A[i] < c:\n\n A[i] = c\n\n b -= 1\n\n i += 1\n\n\n\nprint((sum(A)))\n", "code_v0_loc": 27, "code_v1_loc": 18, "code_v0_num_chars": 496, "code_v1_num_chars": 376, "code_v0_no_empty_lines": "from collections import Counter\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nX = Counter(A)\nfor i in range(M):\n B, C = list(map(int, input().split()))\n X[C] += B\nZ = []\nfor key, value in list(X.items()):\n Z.append((key, value))\nZ.sort(key=lambda x: x[0], reverse=True)\nans = 0\ncnt = 0\nfor value, key in Z:\n if cnt + key <= N:\n ans += key * value\n cnt += key\n else:\n ans += (N - cnt) * value\n break\nprint(ans)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())))\nquery = []\nfor i in range(M):\n b, c = list(map(int, input().split()))\n query.append([b, c])\nquery.sort(key=lambda q: q[1], reverse=True)\ni = 0\nfor b, c in query:\n while i < N and b > 0:\n if A[i] < c:\n A[i] = c\n b -= 1\n i += 1\nprint((sum(A)))\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-from collections import Counter", "-", "-A = list(map(int, input().split()))", "-X = Counter(A)", "+A = sorted(list(map(int, input().split())))", "+query = []", "- B, C = list(map(int, input().split()))", "- X[C] += B", "-Z = []", "-for key, value in list(X.items()):", "- Z.append((key, value))", "-Z.sort(key=lambda x: x[0], reverse=True)", "-ans = 0", "-cnt = 0", "-for value, key in Z:", "- if cnt + key <= N:", "- ans += key * value", "- cnt += key", "- else:", "- ans += (N - cnt) * value", "- break", "-print(ans)", "+ b, c = list(map(int, input().split()))", "+ query.append([b, c])", "+query.sort(key=lambda q: q[1], reverse=True)", "+i = 0", "+for b, c in query:", "+ while i < N and b > 0:", "+ if A[i] < c:", "+ A[i] = c", "+ b -= 1", "+ i += 1", "+print((sum(A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.254084451, "measured_runtime_v1": 0.0066267376, "runtime_lift": 38.3423135365, "key": ["s846597544", "s758849446"], "target_token_count_dream": 122, "target_token_bucket_dream": "<128"} +{"user_id": "u576335153", "problem_id": "p03723", "language": "python", "submission_id_v0": "s032726803", "submission_id_v1": "s012708150", "cpu_time_v0": 58, "cpu_time_v1": 26, "memory_v0": 32492, "memory_v1": 9200, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.17, "input": "a, b, c = list(map(int, input().split()))\n\n\n\nif any(i % 2 != 0 for i in [a, b, c]):\n\n print((0))\n\n exit()\n\n\n\nif a == b and b == c:\n\n print((-1))\n\n exit()\n\n\n\ncnt = 0\n\na_list = [0]*(1001001)\n\nb_list = [0]*(1001001)\n\nc_list = [0]*(1001001)\n\na_list[0] = a\n\nb_list[0] = b\n\nc_list[0] = c\n\n\n\nfor i in range(1, 1001001):\n\n a_list[i] = (b_list[i-1] + c_list[i-1]) // 2\n\n b_list[i] = (c_list[i-1] + a_list[i-1]) // 2\n\n c_list[i] = (a_list[i-1] + b_list[i-1]) // 2\n\n cnt += 1\n\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n\n break\n\n\n\nprint(cnt)\n", "target": "def solve(a, b, c):\n\n if any(i % 2 == 1 for i in [a, b, c]):\n\n return 0\n\n if a == b == c:\n\n return -1\n\n a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2\n\n return solve(a, b, c) + 1\n\n\n\na, b, c = list(map(int, input().split()))\n\n\n\nprint((solve(a, b, c)))", "code_v0_loc": 27, "code_v1_loc": 11, "code_v0_num_chars": 580, "code_v1_num_chars": 272, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif any(i % 2 != 0 for i in [a, b, c]):\n print((0))\n exit()\nif a == b and b == c:\n print((-1))\n exit()\ncnt = 0\na_list = [0] * (1001001)\nb_list = [0] * (1001001)\nc_list = [0] * (1001001)\na_list[0] = a\nb_list[0] = b\nc_list[0] = c\nfor i in range(1, 1001001):\n a_list[i] = (b_list[i - 1] + c_list[i - 1]) // 2\n b_list[i] = (c_list[i - 1] + a_list[i - 1]) // 2\n c_list[i] = (a_list[i - 1] + b_list[i - 1]) // 2\n cnt += 1\n if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:\n break\nprint(cnt)\n", "code_v1_no_empty_lines": "def solve(a, b, c):\n if any(i % 2 == 1 for i in [a, b, c]):\n return 0\n if a == b == c:\n return -1\n a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2\n return solve(a, b, c) + 1\n\n\na, b, c = list(map(int, input().split()))\nprint((solve(a, b, c)))\n", "code_same": false, "relative_loc_diff_percent": 59.2592592593, "diff": ["+def solve(a, b, c):", "+ if any(i % 2 == 1 for i in [a, b, c]):", "+ return 0", "+ if a == b == c:", "+ return -1", "+ a, b, c = (b + c) // 2, (c + a) // 2, (a + b) // 2", "+ return solve(a, b, c) + 1", "+", "+", "-if any(i % 2 != 0 for i in [a, b, c]):", "- print((0))", "- exit()", "-if a == b and b == c:", "- print((-1))", "- exit()", "-cnt = 0", "-a_list = [0] * (1001001)", "-b_list = [0] * (1001001)", "-c_list = [0] * (1001001)", "-a_list[0] = a", "-b_list[0] = b", "-c_list[0] = c", "-for i in range(1, 1001001):", "- a_list[i] = (b_list[i - 1] + c_list[i - 1]) // 2", "- b_list[i] = (c_list[i - 1] + a_list[i - 1]) // 2", "- c_list[i] = (a_list[i - 1] + b_list[i - 1]) // 2", "- cnt += 1", "- if a_list[i] % 2 != 0 or b_list[i] % 2 != 0 or c_list[i] % 2 != 0:", "- break", "-print(cnt)", "+print((solve(a, b, c)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6101216149, "measured_runtime_v1": 0.3266951015, "runtime_lift": 1.8675566671, "key": ["s032726803", "s012708150"], "target_token_count_dream": 118, "target_token_bucket_dream": "<128"} +{"user_id": "u463655976", "problem_id": "p03013", "language": "python", "submission_id_v0": "s227334045", "submission_id_v1": "s524241188", "cpu_time_v0": 285, "cpu_time_v1": 189, "memory_v0": 22940, "memory_v1": 7836, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.68, "input": "from functools import lru_cache\n\nimport sys\n\nsys.setrecursionlimit(30000)\n\n\n\nN, M = list(map(int, input().split()))\n\na = list(int(input()) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nisOk = True\n\nfor i in range(M-1):\n\n if a[i] + 1 == a[i+1]:\n\n isOk = False\n\n \n\nfuncb = [-1] * 100001\n\ndef func(n):\n\n if n <= 0:\n\n return 1\n\n cnt = funcb[n]\n\n if cnt > 0:\n\n return cnt\n\n cnt = 0\n\n if n >= 2:\n\n cnt += func(n-2)\n\n if n >= 1:\n\n cnt += func(n-1)\n\n funcb[n] = cnt % MOD\n\n return funcb[n]\n\n\n\nfunc(30000)\n\nfunc(50000)\n\nfunc(80000)\n\nfunc(100000)\n\n\n\nif not isOk:\n\n print((0))\n\nelse:\n\n ans = 1\n\n s = 0\n\n for i in range(M+1):\n\n if i >= M:\n\n e = N\n\n else:\n\n e = a[i] - 1\n\n\n\n ans = ans * func(e-s) % MOD\n\n\n\n if i >= M:\n\n break\n\n\n\n s = a[i] + 1\n\n\n\n print(ans)\n", "target": "N, M = list(map(int, input().split()))\n\na = list(int(input()) for _ in range(M))\n\n\n\nMOD = pow(10, 9) + 7\n\n\n\nMAP = [0] * (N + 1)\n\n\n\nfor x in a:\n\n MAP[x] = -1\n\n\n\nMAP[0] = 1 \n\nfor i in range(N):\n\n if MAP[i] < 0:\n\n continue\n\n\n\n MAP[i] %= MOD\n\n if i + 1 <= N and MAP[i+1] >= 0:\n\n MAP[i+1] += MAP[i]\n\n if i + 2 <= N and MAP[i+2] >= 0:\n\n MAP[i+2] += MAP[i]\n\n\n\nprint((MAP[N] % MOD))\n", "code_v0_loc": 53, "code_v1_loc": 22, "code_v0_num_chars": 885, "code_v1_num_chars": 403, "code_v0_no_empty_lines": "from functools import lru_cache\nimport sys\n\nsys.setrecursionlimit(30000)\nN, M = list(map(int, input().split()))\na = list(int(input()) for _ in range(M))\nMOD = pow(10, 9) + 7\nisOk = True\nfor i in range(M - 1):\n if a[i] + 1 == a[i + 1]:\n isOk = False\nfuncb = [-1] * 100001\n\n\ndef func(n):\n if n <= 0:\n return 1\n cnt = funcb[n]\n if cnt > 0:\n return cnt\n cnt = 0\n if n >= 2:\n cnt += func(n - 2)\n if n >= 1:\n cnt += func(n - 1)\n funcb[n] = cnt % MOD\n return funcb[n]\n\n\nfunc(30000)\nfunc(50000)\nfunc(80000)\nfunc(100000)\nif not isOk:\n print((0))\nelse:\n ans = 1\n s = 0\n for i in range(M + 1):\n if i >= M:\n e = N\n else:\n e = a[i] - 1\n ans = ans * func(e - s) % MOD\n if i >= M:\n break\n s = a[i] + 1\n print(ans)\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\na = list(int(input()) for _ in range(M))\nMOD = pow(10, 9) + 7\nMAP = [0] * (N + 1)\nfor x in a:\n MAP[x] = -1\nMAP[0] = 1\nfor i in range(N):\n if MAP[i] < 0:\n continue\n MAP[i] %= MOD\n if i + 1 <= N and MAP[i + 1] >= 0:\n MAP[i + 1] += MAP[i]\n if i + 2 <= N and MAP[i + 2] >= 0:\n MAP[i + 2] += MAP[i]\nprint((MAP[N] % MOD))\n", "code_same": false, "relative_loc_diff_percent": 58.4905660377, "diff": ["-from functools import lru_cache", "-import sys", "-", "-sys.setrecursionlimit(30000)", "-isOk = True", "-for i in range(M - 1):", "- if a[i] + 1 == a[i + 1]:", "- isOk = False", "-funcb = [-1] * 100001", "-", "-", "-def func(n):", "- if n <= 0:", "- return 1", "- cnt = funcb[n]", "- if cnt > 0:", "- return cnt", "- cnt = 0", "- if n >= 2:", "- cnt += func(n - 2)", "- if n >= 1:", "- cnt += func(n - 1)", "- funcb[n] = cnt % MOD", "- return funcb[n]", "-", "-", "-func(30000)", "-func(50000)", "-func(80000)", "-func(100000)", "-if not isOk:", "- print((0))", "-else:", "- ans = 1", "- s = 0", "- for i in range(M + 1):", "- if i >= M:", "- e = N", "- else:", "- e = a[i] - 1", "- ans = ans * func(e - s) % MOD", "- if i >= M:", "- break", "- s = a[i] + 1", "- print(ans)", "+MAP = [0] * (N + 1)", "+for x in a:", "+ MAP[x] = -1", "+MAP[0] = 1", "+for i in range(N):", "+ if MAP[i] < 0:", "+ continue", "+ MAP[i] %= MOD", "+ if i + 1 <= N and MAP[i + 1] >= 0:", "+ MAP[i + 1] += MAP[i]", "+ if i + 2 <= N and MAP[i + 2] >= 0:", "+ MAP[i + 2] += MAP[i]", "+print((MAP[N] % MOD))"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0640589638, "measured_runtime_v1": 0.2648930094, "runtime_lift": 4.0169386351, "key": ["s227334045", "s524241188"], "target_token_count_dream": 161, "target_token_bucket_dream": "128-256"} +{"user_id": "u254871849", "problem_id": "p02921", "language": "python", "submission_id_v0": "s533958811", "submission_id_v1": "s140590362", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "# 2019-11-17 20:44:23(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# import re\n\n# import heapq\n\n# import array\n\n# from scipy.misc import comb # (default: exact=False)\n\n# import numpy as np \n\n\n\n\n\ndef main():\n\n s, t = sys.stdin.read().split()\n\n\n\n count = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n count += 1\n\n print(count)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n", "target": "import sys\n\n\n\ns, t = sys.stdin.read().split()\n\n\n\ndef main():\n\n cnt = 0\n\n for i in range(3):\n\n if s[i] == t[i]:\n\n cnt += 1\n\n return cnt\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 28, "code_v1_loc": 14, "code_v0_num_chars": 611, "code_v1_num_chars": 229, "code_v0_no_empty_lines": "# 2019-11-17 20:44:23(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# import re\n# import heapq\n# import array\n# from scipy.misc import comb # (default: exact=False)\n# import numpy as np\ndef main():\n s, t = sys.stdin.read().split()\n count = 0\n for i in range(3):\n if s[i] == t[i]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ns, t = sys.stdin.read().split()\n\n\ndef main():\n cnt = 0\n for i in range(3):\n if s[i] == t[i]:\n cnt += 1\n return cnt\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-# 2019-11-17 20:44:23(JST)", "-# import collections", "-# import math", "-# from string import ascii_lowercase, ascii_uppercase, digits", "-# from bisect import bisect_left as bi_l, bisect_right as bi_r", "-# import itertools", "-# from functools import reduce", "-# import operator as op", "-# import re", "-# import heapq", "-# import array", "-# from scipy.misc import comb # (default: exact=False)", "-# import numpy as np", "+s, t = sys.stdin.read().split()", "+", "+", "- s, t = sys.stdin.read().split()", "- count = 0", "+ cnt = 0", "- count += 1", "- print(count)", "+ cnt += 1", "+ return cnt", "- main()", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2871051877, "measured_runtime_v1": 0.085240711, "runtime_lift": 3.3681697905, "key": ["s533958811", "s140590362"], "target_token_count_dream": 68, "target_token_bucket_dream": "<128"} +{"user_id": "u254871849", "problem_id": "p03416", "language": "python", "submission_id_v0": "s286428945", "submission_id_v1": "s838954646", "cpu_time_v0": 41, "cpu_time_v1": 20, "memory_v0": 2940, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 51.22, "input": "# author: kagemeka \n\n# created: 2019-11-06 21:30:22(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\n# import statistics\n\n# import functools\n\n# import operator\n\n\n\ndef main():\n\n a, b = (int(x) for x in sys.stdin.read().split())\n\n\n\n count = 0\n\n for n in range(a, b+1):\n\n n = str(n)\n\n if n == n[::-1]:\n\n count += 1\n\n\n\n print(count) \n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n", "target": "import sys\n\nfrom bisect import bisect_left as bi_l, bisect_right as bi_r\n\n\n\na, b = list(map(int, sys.stdin.readline().split()))\n\n\n\ndef main():\n\n palindromic_nums = []\n\n for i in range(1, 10):\n\n for j in range(10):\n\n for k in range(10):\n\n x = [i, j, k, j, i]\n\n palindromic_nums.append(int(''.join(list(map(str, x)))))\n\n\n\n return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 27, "code_v1_loc": 18, "code_v0_num_chars": 576, "code_v1_num_chars": 512, "code_v0_no_empty_lines": "# author: kagemeka\n# created: 2019-11-06 21:30:22(JST)\nimport sys\n\n# import collections\n# import math\n# import string\n# import bisect\n# import re\n# import itertools\n# import statistics\n# import functools\n# import operator\ndef main():\n a, b = (int(x) for x in sys.stdin.read().split())\n count = 0\n for n in range(a, b + 1):\n n = str(n)\n if n == n[::-1]:\n count += 1\n print(count)\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n", "code_v1_no_empty_lines": "import sys\nfrom bisect import bisect_left as bi_l, bisect_right as bi_r\n\na, b = list(map(int, sys.stdin.readline().split()))\n\n\ndef main():\n palindromic_nums = []\n for i in range(1, 10):\n for j in range(10):\n for k in range(10):\n x = [i, j, k, j, i]\n palindromic_nums.append(int(\"\".join(list(map(str, x)))))\n return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-# author: kagemeka", "-# created: 2019-11-06 21:30:22(JST)", "+from bisect import bisect_left as bi_l, bisect_right as bi_r", "-# import collections", "-# import math", "-# import string", "-# import bisect", "-# import re", "-# import itertools", "-# import statistics", "-# import functools", "-# import operator", "+a, b = list(map(int, sys.stdin.readline().split()))", "+", "+", "- a, b = (int(x) for x in sys.stdin.read().split())", "- count = 0", "- for n in range(a, b + 1):", "- n = str(n)", "- if n == n[::-1]:", "- count += 1", "- print(count)", "+ palindromic_nums = []", "+ for i in range(1, 10):", "+ for j in range(10):", "+ for k in range(10):", "+ x = [i, j, k, j, i]", "+ palindromic_nums.append(int(\"\".join(list(map(str, x)))))", "+ return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)", "- # execute only if run as a script", "- main()", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2528932301, "measured_runtime_v1": 0.1923888798, "runtime_lift": 1.314489852, "key": ["s286428945", "s838954646"], "target_token_count_dream": 153, "target_token_bucket_dream": "128-256"} +{"user_id": "u729939940", "problem_id": "p02767", "language": "python", "submission_id_v0": "s286517602", "submission_id_v1": "s316820501", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "N = int(input())\n\nX = list(map(int, input().split()))\n\nX = list(sorted(X))\n\nif N == 1:\n\n print((0))\n\n exit()\n\nans = float('inf')\n\nfor p in range(X[0], X[N - 1] + 1):\n\n sum = 0\n\n for x in X:\n\n sum += (x - p) ** 2\n\n ans = min(sum, ans)\n\nprint(ans)", "target": "N = int(input())\n\nX = list(map(int, input().split()))\n\navg = round(sum(X) / N)\n\nprint((sum([(x - avg) ** 2 for x in X])))", "code_v0_loc": 13, "code_v1_loc": 4, "code_v0_num_chars": 251, "code_v1_num_chars": 119, "code_v0_no_empty_lines": "N = int(input())\nX = list(map(int, input().split()))\nX = list(sorted(X))\nif N == 1:\n print((0))\n exit()\nans = float(\"inf\")\nfor p in range(X[0], X[N - 1] + 1):\n sum = 0\n for x in X:\n sum += (x - p) ** 2\n ans = min(sum, ans)\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nX = list(map(int, input().split()))\navg = round(sum(X) / N)\nprint((sum([(x - avg) ** 2 for x in X])))\n", "code_same": false, "relative_loc_diff_percent": 69.2307692308, "diff": ["-X = list(sorted(X))", "-if N == 1:", "- print((0))", "- exit()", "-ans = float(\"inf\")", "-for p in range(X[0], X[N - 1] + 1):", "- sum = 0", "- for x in X:", "- sum += (x - p) ** 2", "- ans = min(sum, ans)", "-print(ans)", "+avg = round(sum(X) / N)", "+print((sum([(x - avg) ** 2 for x in X])))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2590025333, "measured_runtime_v1": 0.1089487125, "runtime_lift": 2.3772886094, "key": ["s286517602", "s316820501"], "target_token_count_dream": 40, "target_token_bucket_dream": "<128"} +{"user_id": "u628335443", "problem_id": "p02725", "language": "python", "submission_id_v0": "s320196234", "submission_id_v1": "s733866625", "cpu_time_v0": 189, "cpu_time_v1": 163, "memory_v0": 26444, "memory_v1": 26444, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.76, "input": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd = [0] * n\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d[i] = a[i + 1] - a[i]\n\n d_max = max(d_max, d[i])\n\n\n\nd[-1] = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d[-1])\n\n\n\nprint((k - d_max))\n", "target": "k, n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd_max = 0\n\n\n\nfor i in range(n - 1):\n\n d = a[i + 1] - a[i]\n\n d_max = max(d_max, d)\n\n\n\nd = (k - a[-1]) + a[0]\n\nd_max = max(d_max, d)\n\n\n\nprint((k - d_max))\n", "code_v0_loc": 13, "code_v1_loc": 12, "code_v0_num_chars": 255, "code_v1_num_chars": 228, "code_v0_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nd = [0] * n\nd_max = 0\nfor i in range(n - 1):\n d[i] = a[i + 1] - a[i]\n d_max = max(d_max, d[i])\nd[-1] = (k - a[-1]) + a[0]\nd_max = max(d_max, d[-1])\nprint((k - d_max))\n", "code_v1_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nd_max = 0\nfor i in range(n - 1):\n d = a[i + 1] - a[i]\n d_max = max(d_max, d)\nd = (k - a[-1]) + a[0]\nd_max = max(d_max, d)\nprint((k - d_max))\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["-d = [0] * n", "- d[i] = a[i + 1] - a[i]", "- d_max = max(d_max, d[i])", "-d[-1] = (k - a[-1]) + a[0]", "-d_max = max(d_max, d[-1])", "+ d = a[i + 1] - a[i]", "+ d_max = max(d_max, d)", "+d = (k - a[-1]) + a[0]", "+d_max = max(d_max, d)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3049341288, "measured_runtime_v1": 0.200526454, "runtime_lift": 1.5206678356, "key": ["s320196234", "s733866625"], "target_token_count_dream": 90, "target_token_bucket_dream": "<128"} +{"user_id": "u864197622", "problem_id": "p02822", "language": "python", "submission_id_v0": "s981663077", "submission_id_v1": "s820806781", "cpu_time_v0": 1240, "cpu_time_v1": 890, "memory_v0": 93784, "memory_v1": 100756, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.23, "input": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\ninv2 = (mod + 1) // 2\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n\n for j in X[i]:\n\n s = (s * pow(inv2, A[j], mod)) % mod\n\n t = (t + (1-pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))", "target": "import sys\n\ninput = sys.stdin.readline\n\nfrom collections import deque\n\nN = int(input())\n\nX = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n x, y = list(map(int, input().split()))\n\n X[x-1].append(y-1)\n\n X[y-1].append(x-1)\n\ni0 = min([i for i in range(N) if len(X[i]) == 1])\n\n\n\nP = [-1] * N\n\nQ = deque([i0])\n\nR = []\n\nwhile Q:\n\n i = deque.popleft(Q)\n\n R.append(i)\n\n for a in X[i]:\n\n if a != P[i]:\n\n P[a] = i\n\n X[a].remove(i)\n\n deque.append(Q, a)\n\n\n\nmod = 10 ** 9 + 7\n\npow2 = [1]\n\nfor i in range(N + 10):\n\n pow2.append(pow2[-1] * 2 % mod)\n\ninv2 = (mod + 1) // 2\n\n\n\ninvpow2 = [pow(pow2[-1], mod-2, mod)]\n\nfor i in range(N + 10)[::-1]:\n\n invpow2.append(invpow2[-1] * 2 % mod)\n\ninvpow2 = invpow2[::-1]\n\n\n\nA = [1] * N\n\nfor i in R[::-1]:\n\n s = 0\n\n for j in X[i]:\n\n A[i] += A[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n s = pow(inv2, N - A[i], mod)\n\n t = 1 + (1-invpow2[N-A[i]]) * pow2[N-A[i]]\n\n for j in X[i]:\n\n s = (s * invpow2[A[j]]) % mod\n\n t = (t + (1-invpow2[A[j]]) * pow2[A[j]]) % mod\n\n ans = (ans + 1 - s * t) % mod\n\n\n\nprint((ans * inv2 % mod))", "code_v0_loc": 41, "code_v1_loc": 50, "code_v0_num_chars": 951, "code_v1_num_chars": 1128, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import deque\n\nN = int(input())\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\ni0 = min([i for i in range(N) if len(X[i]) == 1])\nP = [-1] * N\nQ = deque([i0])\nR = []\nwhile Q:\n i = deque.popleft(Q)\n R.append(i)\n for a in X[i]:\n if a != P[i]:\n P[a] = i\n X[a].remove(i)\n deque.append(Q, a)\nmod = 10**9 + 7\ninv2 = (mod + 1) // 2\nA = [1] * N\nfor i in R[::-1]:\n s = 0\n for j in X[i]:\n A[i] += A[j]\nans = 0\nfor i in range(N):\n s = pow(inv2, N - A[i], mod)\n t = 1 + (1 - pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)\n for j in X[i]:\n s = (s * pow(inv2, A[j], mod)) % mod\n t = (t + (1 - pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod\n ans = (ans + 1 - s * t) % mod\nprint((ans * inv2 % mod))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nfrom collections import deque\n\nN = int(input())\nX = [[] for i in range(N)]\nfor i in range(N - 1):\n x, y = list(map(int, input().split()))\n X[x - 1].append(y - 1)\n X[y - 1].append(x - 1)\ni0 = min([i for i in range(N) if len(X[i]) == 1])\nP = [-1] * N\nQ = deque([i0])\nR = []\nwhile Q:\n i = deque.popleft(Q)\n R.append(i)\n for a in X[i]:\n if a != P[i]:\n P[a] = i\n X[a].remove(i)\n deque.append(Q, a)\nmod = 10**9 + 7\npow2 = [1]\nfor i in range(N + 10):\n pow2.append(pow2[-1] * 2 % mod)\ninv2 = (mod + 1) // 2\ninvpow2 = [pow(pow2[-1], mod - 2, mod)]\nfor i in range(N + 10)[::-1]:\n invpow2.append(invpow2[-1] * 2 % mod)\ninvpow2 = invpow2[::-1]\nA = [1] * N\nfor i in R[::-1]:\n s = 0\n for j in X[i]:\n A[i] += A[j]\nans = 0\nfor i in range(N):\n s = pow(inv2, N - A[i], mod)\n t = 1 + (1 - invpow2[N - A[i]]) * pow2[N - A[i]]\n for j in X[i]:\n s = (s * invpow2[A[j]]) % mod\n t = (t + (1 - invpow2[A[j]]) * pow2[A[j]]) % mod\n ans = (ans + 1 - s * t) % mod\nprint((ans * inv2 % mod))\n", "code_same": false, "relative_loc_diff_percent": 18.0, "diff": ["+pow2 = [1]", "+for i in range(N + 10):", "+ pow2.append(pow2[-1] * 2 % mod)", "+invpow2 = [pow(pow2[-1], mod - 2, mod)]", "+for i in range(N + 10)[::-1]:", "+ invpow2.append(invpow2[-1] * 2 % mod)", "+invpow2 = invpow2[::-1]", "- t = 1 + (1 - pow(inv2, N - A[i], mod)) * pow(2, N - A[i], mod)", "+ t = 1 + (1 - invpow2[N - A[i]]) * pow2[N - A[i]]", "- s = (s * pow(inv2, A[j], mod)) % mod", "- t = (t + (1 - pow(inv2, A[j], mod)) * pow(2, A[j], mod)) % mod", "+ s = (s * invpow2[A[j]]) % mod", "+ t = (t + (1 - invpow2[A[j]]) * pow2[A[j]]) % mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2550587091, "measured_runtime_v1": 0.1362446928, "runtime_lift": 1.8720634461, "key": ["s981663077", "s820806781"], "target_token_count_dream": 431, "target_token_bucket_dream": "256-512"} +{"user_id": "u301624971", "problem_id": "p03796", "language": "python", "submission_id_v0": "s825153134", "submission_id_v1": "s210395809", "cpu_time_v0": 230, "cpu_time_v1": 29, "memory_v0": 3972, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.39, "input": "from math import factorial\n\ndef myAnswer(N:int) ->int:\n\n ans =factorial(N)\n\n return ans % (10**9 + 7)\n\n\n\ndef modelAnswer():\n\n tmp=1\n\ndef main():\n\n N = int(input())\n\n print((myAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()", "target": "def modelAnswer(N:int) -> int:\n\n ans = 1\n\n for i in range(1,N+1):\n\n ans = (ans*i) % (10**9 + 7)\n\n return ans \n\ndef main():\n\n N = int(input())\n\n print((modelAnswer(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 14, "code_v1_loc": 12, "code_v0_num_chars": 237, "code_v1_num_chars": 224, "code_v0_no_empty_lines": "from math import factorial\n\n\ndef myAnswer(N: int) -> int:\n ans = factorial(N)\n return ans % (10**9 + 7)\n\n\ndef modelAnswer():\n tmp = 1\n\n\ndef main():\n N = int(input())\n print((myAnswer(N)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def modelAnswer(N: int) -> int:\n ans = 1\n for i in range(1, N + 1):\n ans = (ans * i) % (10**9 + 7)\n return ans\n\n\ndef main():\n N = int(input())\n print((modelAnswer(N)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 14.2857142857, "diff": ["-from math import factorial", "-", "-", "-def myAnswer(N: int) -> int:", "- ans = factorial(N)", "- return ans % (10**9 + 7)", "-", "-", "-def modelAnswer():", "- tmp = 1", "+def modelAnswer(N: int) -> int:", "+ ans = 1", "+ for i in range(1, N + 1):", "+ ans = (ans * i) % (10**9 + 7)", "+ return ans", "- print((myAnswer(N)))", "+ print((modelAnswer(N)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7093277271, "measured_runtime_v1": 0.3704600389, "runtime_lift": 1.9147212994, "key": ["s825153134", "s210395809"], "target_token_count_dream": 76, "target_token_bucket_dream": "<128"} +{"user_id": "u991567869", "problem_id": "p03854", "language": "python", "submission_id_v0": "s135519212", "submission_id_v1": "s896370774", "cpu_time_v0": 59, "cpu_time_v1": 42, "memory_v0": 9264, "memory_v1": 12828, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.81, "input": "s = input()[::-1]\n\n\n\nwhile True:\n\n if len(s) == 0:\n\n break\n\n if s[:7] == \"remaerd\":\n\n s = s[7:]\n\n elif s[:6] == \"resare\":\n\n s = s[6:]\n\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n\n s = s[5:]\n\n else:\n\n print(\"NO\")\n\n exit()\n\n\n\nprint(\"YES\")", "target": "import re\n\n\n\ns = input()\n\n\n\nif re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "code_v0_loc": 16, "code_v1_loc": 8, "code_v0_num_chars": 294, "code_v1_num_chars": 123, "code_v0_no_empty_lines": "s = input()[::-1]\nwhile True:\n if len(s) == 0:\n break\n if s[:7] == \"remaerd\":\n s = s[7:]\n elif s[:6] == \"resare\":\n s = s[6:]\n elif s[:5] == \"maerd\" or s[:5] == \"esare\":\n s = s[5:]\n else:\n print(\"NO\")\n exit()\nprint(\"YES\")\n", "code_v1_no_empty_lines": "import re\n\ns = input()\nif re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-s = input()[::-1]", "-while True:", "- if len(s) == 0:", "- break", "- if s[:7] == \"remaerd\":", "- s = s[7:]", "- elif s[:6] == \"resare\":", "- s = s[6:]", "- elif s[:5] == \"maerd\" or s[:5] == \"esare\":", "- s = s[5:]", "- else:", "- print(\"NO\")", "- exit()", "-print(\"YES\")", "+import re", "+", "+s = input()", "+if re.fullmatch(r\"(dream|dreamer|erase|eraser)+\", s):", "+ print(\"YES\")", "+else:", "+ print(\"NO\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1782437842, "measured_runtime_v1": 0.0065195048, "runtime_lift": 27.340080233, "key": ["s135519212", "s896370774"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u687343821", "problem_id": "p03074", "language": "python", "submission_id_v0": "s599311447", "submission_id_v1": "s168736691", "cpu_time_v0": 62, "cpu_time_v1": 44, "memory_v0": 5568, "memory_v1": 4596, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.03, "input": "import sys\n\nstdin = sys.stdin \n\nni = lambda: int(ns())\n\nna = lambda: list(map(int, stdin.readline().split()))\n\nns = lambda: stdin.readline()\n\n\n\ndef Solve():\n\n N,K=na()\n\n S=[int(d) for d in input()]\n\n l=[]\n\n N=len(S)\n\n if(S[0]==0):\n\n l.append(0)\n\n b=S[0]\n\n ct=1\n\n for i in S[1:]:\n\n if(b!=i):\n\n l.append(ct)\n\n ct=1\n\n b=i\n\n else:\n\n ct+=1\n\n l.append(ct)\n\n len_l=len(l)\n\n if(len_l//2 <= K):\n\n return sum(l)\n\n ans = res = sum(l[:2*K+1])\n\n \n\n if(len_l%2==0):\n\n l.append(0)\n\n len_l+=1\n\n g = K * 2 + 1\n\n for i in range(K*2+1,len_l-1,2):\n\n ans -= l[i-g] + l[i-g+1]\n\n ans += l[i] + l[1+i]\n\n if(resb>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile a>b>c:\n\n\t\t\tif a>b>c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1\n\n\t\t\t", "target": "while True:\n\n\tk=list(map(int,input().split(\" \")))\n\n\tif k[0]==k[1]==0:\n\n\t\tbreak\n\n\tct=0\n\n\ta=0\n\n\tb=0\n\n\tc=0\t\n\n\tmax=k[0]\n\n\tsum=k[1]\n\n\ta=max+1\n\n\twhile True:\n\n\t\ta-=1\n\n\t\tb=a-1\n\n\t\tc=sum-a-b\n\n\t\tif not a>c:\n\n\t\t\tprint(ct)\n\n\t\t\tbreak\n\n\t\twhile b>c:\n\n\t\t\tif c>0:\n\n\t\t\t\tct+=1\n\n\t\t\tb-=1\n\n\t\t\tc+=1", "code_v0_loc": 25, "code_v1_loc": 23, "code_v0_num_chars": 287, "code_v1_num_chars": 271, "code_v0_no_empty_lines": "while True:\n k = list(map(int, input().split(\" \")))\n if k[0] == k[1] == 0:\n break\n ct = 0\n a = 0\n b = 0\n c = 0\n max = k[0]\n sum = k[1]\n a = max + 1\n while True:\n a -= 1\n b = a - 1\n c = sum - a - b\n if not a > b > c:\n print(ct)\n break\n while a > b > c:\n if a > b > c > 0:\n ct += 1\n b -= 1\n c += 1\n", "code_v1_no_empty_lines": "while True:\n k = list(map(int, input().split(\" \")))\n if k[0] == k[1] == 0:\n break\n ct = 0\n a = 0\n b = 0\n c = 0\n max = k[0]\n sum = k[1]\n a = max + 1\n while True:\n a -= 1\n b = a - 1\n c = sum - a - b\n if not a > c:\n print(ct)\n break\n while b > c:\n if c > 0:\n ct += 1\n b -= 1\n c += 1\n", "code_same": false, "relative_loc_diff_percent": 8.0, "diff": ["- if not a > b > c:", "+ if not a > c:", "- while a > b > c:", "- if a > b > c > 0:", "+ while b > c:", "+ if c > 0:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2289849162, "measured_runtime_v1": 0.1798006518, "runtime_lift": 1.273548866, "key": ["s470319892", "s042746843"], "target_token_count_dream": 116, "target_token_bucket_dream": "<128"} +{"user_id": "u536034761", "problem_id": "p04044", "language": "python", "submission_id_v0": "s161300550", "submission_id_v1": "s718856768", "cpu_time_v0": 29, "cpu_time_v1": 24, "memory_v0": 9032, "memory_v1": 9016, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 17.24, "input": "n, l = list(map(int, input().split()))\n\nS = [input() for i in range(n)]\n\nS.sort()\n\nprint((\"\".join(S)))", "target": "n, l = list(map(int, input().split()))\n\nA = [input() for _ in range(n)]\n\nA.sort()\n\nprint((\"\".join(A)))\n", "code_v0_loc": 4, "code_v1_loc": 4, "code_v0_num_chars": 94, "code_v1_num_chars": 95, "code_v0_no_empty_lines": "n, l = list(map(int, input().split()))\nS = [input() for i in range(n)]\nS.sort()\nprint((\"\".join(S)))\n", "code_v1_no_empty_lines": "n, l = list(map(int, input().split()))\nA = [input() for _ in range(n)]\nA.sort()\nprint((\"\".join(A)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-S = [input() for i in range(n)]", "-S.sort()", "-print((\"\".join(S)))", "+A = [input() for _ in range(n)]", "+A.sort()", "+print((\"\".join(A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3658422339, "measured_runtime_v1": 0.2564776862, "runtime_lift": 1.4264096006, "key": ["s161300550", "s718856768"], "target_token_count_dream": 32, "target_token_bucket_dream": "<128"} +{"user_id": "u996564551", "problem_id": "p03644", "language": "python", "submission_id_v0": "s317462383", "submission_id_v1": "s803396146", "cpu_time_v0": 32, "cpu_time_v1": 25, "memory_v0": 9180, "memory_v1": 9176, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.88, "input": "N = int(input())\n\nif N < 2:\n\n print(N)\n\nelif 2<=N<4:\n\n print((2))\n\nelif 4<=N<8:\n\n print((4))\n\nelif 8<=N<16:\n\n print((8))\n\nelif 16<=N<32:\n\n print((16))\n\nelif 32<=N<64:\n\n print((32))\n\nelif 64<=N:\n\n print((64))", "target": "N = int(input())\n\nNum = [int(2**i) for i in range(7)]\n\nif N in Num:\n\n print(N)\n\nelse:\n\n Num.append(N)\n\n Num = sorted(Num)\n\n print((2 ** (Num.index(N) - 1)))", "code_v0_loc": 15, "code_v1_loc": 8, "code_v0_num_chars": 202, "code_v1_num_chars": 158, "code_v0_no_empty_lines": "N = int(input())\nif N < 2:\n print(N)\nelif 2 <= N < 4:\n print((2))\nelif 4 <= N < 8:\n print((4))\nelif 8 <= N < 16:\n print((8))\nelif 16 <= N < 32:\n print((16))\nelif 32 <= N < 64:\n print((32))\nelif 64 <= N:\n print((64))\n", "code_v1_no_empty_lines": "N = int(input())\nNum = [int(2**i) for i in range(7)]\nif N in Num:\n print(N)\nelse:\n Num.append(N)\n Num = sorted(Num)\n print((2 ** (Num.index(N) - 1)))\n", "code_same": false, "relative_loc_diff_percent": 46.6666666667, "diff": ["-if N < 2:", "+Num = [int(2**i) for i in range(7)]", "+if N in Num:", "-elif 2 <= N < 4:", "- print((2))", "-elif 4 <= N < 8:", "- print((4))", "-elif 8 <= N < 16:", "- print((8))", "-elif 16 <= N < 32:", "- print((16))", "-elif 32 <= N < 64:", "- print((32))", "-elif 64 <= N:", "- print((64))", "+else:", "+ Num.append(N)", "+ Num = sorted(Num)", "+ print((2 ** (Num.index(N) - 1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3866926632, "measured_runtime_v1": 0.2723876703, "runtime_lift": 1.4196408479, "key": ["s317462383", "s803396146"], "target_token_count_dream": 58, "target_token_bucket_dream": "<128"} +{"user_id": "u815878613", "problem_id": "p03037", "language": "python", "submission_id_v0": "s043802358", "submission_id_v1": "s120994164", "cpu_time_v0": 220, "cpu_time_v1": 195, "memory_v0": 27220, "memory_v1": 9100, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.36, "input": "N, M = list(map(int, input().split()))\n\nLR = [list(map(int, input().split())) for _ in range(M)]\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor l, r in LR:\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n", "target": "N, M = list(map(int, input().split()))\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor _ in range(M):\n\n l, r = list(map(int, input().split()))\n\n\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n", "code_v0_loc": 15, "code_v1_loc": 16, "code_v0_num_chars": 266, "code_v1_num_chars": 251, "code_v0_no_empty_lines": "N, M = list(map(int, input().split()))\nLR = [list(map(int, input().split())) for _ in range(M)]\nleft = 1\nright = N\nfor l, r in LR:\n if left < l:\n left = l\n if right > r:\n right = r\nans = right - left\nprint((ans + 1 if ans >= 0 else 0))\n", "code_v1_no_empty_lines": "N, M = list(map(int, input().split()))\nleft = 1\nright = N\nfor _ in range(M):\n l, r = list(map(int, input().split()))\n if left < l:\n left = l\n if right > r:\n right = r\nans = right - left\nprint((ans + 1 if ans >= 0 else 0))\n", "code_same": false, "relative_loc_diff_percent": 6.25, "diff": ["-LR = [list(map(int, input().split())) for _ in range(M)]", "-for l, r in LR:", "+for _ in range(M):", "+ l, r = list(map(int, input().split()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2458969798, "measured_runtime_v1": 0.1910107524, "runtime_lift": 1.2873462706, "key": ["s043802358", "s120994164"], "target_token_count_dream": 85, "target_token_bucket_dream": "<128"} +{"user_id": "u282228874", "problem_id": "p03293", "language": "python", "submission_id_v0": "s664706993", "submission_id_v1": "s616247709", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "s = input()\n\nt = input()\n\nfor i in range(len(s)):\n\n if s[i:]+s[:i]==t:\n\n print('Yes')\n\n exit()\n\nprint('No')", "target": "s = input()\n\nt = input()\n\n\n\nfor i in range(len(s)):\n\n s = s[1:] + s[0]\n\n if s == t:\n\n print(\"Yes\")\n\n exit()\n\nprint(\"No\")", "code_v0_loc": 7, "code_v1_loc": 9, "code_v0_num_chars": 144, "code_v1_num_chars": 140, "code_v0_no_empty_lines": "s = input()\nt = input()\nfor i in range(len(s)):\n if s[i:] + s[:i] == t:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_v1_no_empty_lines": "s = input()\nt = input()\nfor i in range(len(s)):\n s = s[1:] + s[0]\n if s == t:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["- if s[i:] + s[:i] == t:", "+ s = s[1:] + s[0]", "+ if s == t:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1894659722, "measured_runtime_v1": 0.0060859642, "runtime_lift": 31.1316277188, "key": ["s664706993", "s616247709"], "target_token_count_dream": 46, "target_token_bucket_dream": "<128"} +{"user_id": "u285121325", "problem_id": "p03060", "language": "python", "submission_id_v0": "s176163369", "submission_id_v1": "s307096938", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "n = int(input())\n\nv = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\nresult = 0\n\nfor i in range(n):\n\n if v[i] > c[i]:\n\n result += v[i] - c[i]\n\nprint(result)", "target": "N = int(input())\n\nV = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\nprint((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))\n", "code_v0_loc": 8, "code_v1_loc": 4, "code_v0_num_chars": 183, "code_v1_num_chars": 151, "code_v0_no_empty_lines": "n = int(input())\nv = list(map(int, input().split()))\nc = list(map(int, input().split()))\nresult = 0\nfor i in range(n):\n if v[i] > c[i]:\n result += v[i] - c[i]\nprint(result)\n", "code_v1_no_empty_lines": "N = int(input())\nV = list(map(int, input().split()))\nC = list(map(int, input().split()))\nprint((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-n = int(input())", "-v = list(map(int, input().split()))", "-c = list(map(int, input().split()))", "-result = 0", "-for i in range(n):", "- if v[i] > c[i]:", "- result += v[i] - c[i]", "-print(result)", "+N = int(input())", "+V = list(map(int, input().split()))", "+C = list(map(int, input().split()))", "+print((sum([V[i] - C[i] for i in range(N) if V[i] > C[i]])))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1697382522, "measured_runtime_v1": 0.0057968805, "runtime_lift": 29.2809645377, "key": ["s176163369", "s307096938"], "target_token_count_dream": 51, "target_token_bucket_dream": "<128"} +{"user_id": "u879870653", "problem_id": "p03416", "language": "python", "submission_id_v0": "s279175230", "submission_id_v1": "s789865740", "cpu_time_v0": 111, "cpu_time_v1": 45, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.46, "input": "a,b = list(map(int,input().split()))\n\nanswer = 0\n\nfor i in range(a,b+1) :\n\n j = str(i)\n\n p1 = j[4]\n\n p2 = j[3]\n\n p3 = j[2]\n\n p4 = j[1]\n\n p5 = j[0]\n\n k = int(p1+p2+p3+p4+p5)\n\n if i == k :\n\n answer += 1\n\nprint(answer)\n\n\n", "target": "A,B = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(A,B+1) :\n\n l = str(i)\n\n if l[0] == l[4] and l[1] == l[3] :\n\n ans += 1\n\nprint(ans)\n", "code_v0_loc": 14, "code_v1_loc": 7, "code_v0_num_chars": 243, "code_v1_num_chars": 151, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nanswer = 0\nfor i in range(a, b + 1):\n j = str(i)\n p1 = j[4]\n p2 = j[3]\n p3 = j[2]\n p4 = j[1]\n p5 = j[0]\n k = int(p1 + p2 + p3 + p4 + p5)\n if i == k:\n answer += 1\nprint(answer)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\nans = 0\nfor i in range(A, B + 1):\n l = str(i)\n if l[0] == l[4] and l[1] == l[3]:\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-a, b = list(map(int, input().split()))", "-answer = 0", "-for i in range(a, b + 1):", "- j = str(i)", "- p1 = j[4]", "- p2 = j[3]", "- p3 = j[2]", "- p4 = j[1]", "- p5 = j[0]", "- k = int(p1 + p2 + p3 + p4 + p5)", "- if i == k:", "- answer += 1", "-print(answer)", "+A, B = list(map(int, input().split()))", "+ans = 0", "+for i in range(A, B + 1):", "+ l = str(i)", "+ if l[0] == l[4] and l[1] == l[3]:", "+ ans += 1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5475045266, "measured_runtime_v1": 0.378210106, "runtime_lift": 1.4476200343, "key": ["s279175230", "s789865740"], "target_token_count_dream": 62, "target_token_bucket_dream": "<128"} +{"user_id": "u936985471", "problem_id": "p03721", "language": "python", "submission_id_v0": "s865752287", "submission_id_v1": "s921873406", "cpu_time_v0": 343, "cpu_time_v1": 288, "memory_v0": 15072, "memory_v1": 29824, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.03, "input": "N,K=list(map(int,input().split()))\n\ndic={}\n\nfor i in range(N):\n\n a,b=list(map(int,input().split()))\n\n if a in dic:\n\n dic[a]+=b\n\n else:\n\n dic[a]=b\n\n \n\ndic=sorted(list(dic.items()),key=lambda x:x[0])\n\nfor d in range(len(dic)):\n\n amount=dic[d][1]\n\n if amount>=K:\n\n print((dic[d][0]))\n\n exit(0)\n\n else:\n\n K-=amount\n\n ", "target": "import sys\n\nreadline = sys.stdin.readline\n\n\n\nN,K = list(map(int,readline().split()))\n\n\n\nAB = [list(map(int,readline().split())) for i in range(N)]\n\n\n\nAB = sorted(AB, key = lambda x:x[0])\n\namount = 0\n\nfor a,b in AB:\n\n amount += b\n\n if amount >= K:\n\n print(a)\n\n break\n", "code_v0_loc": 18, "code_v1_loc": 14, "code_v0_num_chars": 318, "code_v1_num_chars": 268, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\ndic = {}\nfor i in range(N):\n a, b = list(map(int, input().split()))\n if a in dic:\n dic[a] += b\n else:\n dic[a] = b\ndic = sorted(list(dic.items()), key=lambda x: x[0])\nfor d in range(len(dic)):\n amount = dic[d][1]\n if amount >= K:\n print((dic[d][0]))\n exit(0)\n else:\n K -= amount\n", "code_v1_no_empty_lines": "import sys\n\nreadline = sys.stdin.readline\nN, K = list(map(int, readline().split()))\nAB = [list(map(int, readline().split())) for i in range(N)]\nAB = sorted(AB, key=lambda x: x[0])\namount = 0\nfor a, b in AB:\n amount += b\n if amount >= K:\n print(a)\n break\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["-N, K = list(map(int, input().split()))", "-dic = {}", "-for i in range(N):", "- a, b = list(map(int, input().split()))", "- if a in dic:", "- dic[a] += b", "- else:", "- dic[a] = b", "-dic = sorted(list(dic.items()), key=lambda x: x[0])", "-for d in range(len(dic)):", "- amount = dic[d][1]", "+import sys", "+", "+readline = sys.stdin.readline", "+N, K = list(map(int, readline().split()))", "+AB = [list(map(int, readline().split())) for i in range(N)]", "+AB = sorted(AB, key=lambda x: x[0])", "+amount = 0", "+for a, b in AB:", "+ amount += b", "- print((dic[d][0]))", "- exit(0)", "- else:", "- K -= amount", "+ print(a)", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3684674098, "measured_runtime_v1": 0.2810288085, "runtime_lift": 1.3111375012, "key": ["s865752287", "s921873406"], "target_token_count_dream": 85, "target_token_bucket_dream": "<128"} +{"user_id": "u197300260", "problem_id": "p03814", "language": "python", "submission_id_v0": "s932284243", "submission_id_v1": "s708109984", "cpu_time_v0": 36, "cpu_time_v1": 29, "memory_v0": 4012, "memory_v1": 3516, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.44, "input": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n\n# Python 1st Try\n\nimport copy\n\n\n\n\n\nclass Problem:\n\n def __init__(self, stringdata):\n\n self.stringdata = stringdata\n\n\n\n def solver(self):\n\n strcont = copy.copy(self.stringdata)\n\n result = 0\n\n rightposition = 0\n\n leftposition = len(strcont)\n\n j = 0\n\n while True:\n\n if strcont[j] == 'A':\n\n rightposition = j\n\n break\n\n else:\n\n j = j + 1\n\n j = leftposition - 1\n\n while True:\n\n if strcont[j] == 'Z':\n\n leftposition = j\n\n break\n\n else:\n\n j = j - 1\n\n\n\n result = leftposition - rightposition + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = input()\n\n print((\"{}\".format(Problem(s).solver())))\n", "target": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n\n# Python 2nd Try\n\n\n\n\n\ndef solver(string):\n\n result = 200000\n\n aposi = 0\n\n zposi = len(string)\n\n for j in range(0, len(string), 1):\n\n if string[j] == 'A':\n\n aposi = j\n\n break\n\n for j in range(len(string)-1, -1, -1):\n\n if string[j] == 'Z':\n\n zposi = j\n\n break\n\n result = zposi - aposi + 1\n\n return result\n\n\n\n\n\nif __name__ == \"__main__\":\n\n s = input()\n\n print(('{}'.format(solver(s))))\n", "code_v0_loc": 36, "code_v1_loc": 23, "code_v0_num_chars": 875, "code_v1_num_chars": 527, "code_v0_no_empty_lines": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n# Python 1st Try\nimport copy\n\n\nclass Problem:\n def __init__(self, stringdata):\n self.stringdata = stringdata\n\n def solver(self):\n strcont = copy.copy(self.stringdata)\n result = 0\n rightposition = 0\n leftposition = len(strcont)\n j = 0\n while True:\n if strcont[j] == \"A\":\n rightposition = j\n break\n else:\n j = j + 1\n j = leftposition - 1\n while True:\n if strcont[j] == \"Z\":\n leftposition = j\n break\n else:\n j = j - 1\n result = leftposition - rightposition + 1\n return result\n\n\nif __name__ == \"__main__\":\n s = input()\n print((\"{}\".format(Problem(s).solver())))\n", "code_v1_no_empty_lines": "# Problem https://atcoder.jp/contests/abc053/tasks/abc053_b\n# Python 2nd Try\ndef solver(string):\n result = 200000\n aposi = 0\n zposi = len(string)\n for j in range(0, len(string), 1):\n if string[j] == \"A\":\n aposi = j\n break\n for j in range(len(string) - 1, -1, -1):\n if string[j] == \"Z\":\n zposi = j\n break\n result = zposi - aposi + 1\n return result\n\n\nif __name__ == \"__main__\":\n s = input()\n print((\"{}\".format(solver(s))))\n", "code_same": false, "relative_loc_diff_percent": 36.1111111111, "diff": ["-# Python 1st Try", "-import copy", "-", "-", "-class Problem:", "- def __init__(self, stringdata):", "- self.stringdata = stringdata", "-", "- def solver(self):", "- strcont = copy.copy(self.stringdata)", "- result = 0", "- rightposition = 0", "- leftposition = len(strcont)", "- j = 0", "- while True:", "- if strcont[j] == \"A\":", "- rightposition = j", "- break", "- else:", "- j = j + 1", "- j = leftposition - 1", "- while True:", "- if strcont[j] == \"Z\":", "- leftposition = j", "- break", "- else:", "- j = j - 1", "- result = leftposition - rightposition + 1", "- return result", "+# Python 2nd Try", "+def solver(string):", "+ result = 200000", "+ aposi = 0", "+ zposi = len(string)", "+ for j in range(0, len(string), 1):", "+ if string[j] == \"A\":", "+ aposi = j", "+ break", "+ for j in range(len(string) - 1, -1, -1):", "+ if string[j] == \"Z\":", "+ zposi = j", "+ break", "+ result = zposi - aposi + 1", "+ return result", "- print((\"{}\".format(Problem(s).solver())))", "+ print((\"{}\".format(solver(s))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2169195101, "measured_runtime_v1": 0.1208960545, "runtime_lift": 1.7942645936, "key": ["s932284243", "s708109984"], "target_token_count_dream": 170, "target_token_bucket_dream": "128-256"} +{"user_id": "u821588465", "problem_id": "p03000", "language": "python", "submission_id_v0": "s259788442", "submission_id_v1": "s163625054", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9172, "memory_v1": 8984, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "from itertools import accumulate\n\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\n\nL = list(tuple(map(int, input().split())))\n\n\n\nacc = sorted(list(accumulate(L)) + [0])\n\n\n\nn = bisect_right(acc,X)\n\nprint(n)\n\n\n", "target": "N,X = list(map(int,input().split()))\n\nL = list(map(int,input().split()))\n\nList = [0]*(N+1)\n\nfor i in range(1,N+1):\n\n List[i] = List[i-1] + L[i-1]\n\nA = [i for i in List if i <=X]\n\nprint((len(A)))", "code_v0_loc": 10, "code_v1_loc": 7, "code_v0_num_chars": 215, "code_v1_num_chars": 189, "code_v0_no_empty_lines": "from itertools import accumulate\nfrom bisect import *\n\nN, X = list(map(int, input().split()))\nL = list(tuple(map(int, input().split())))\nacc = sorted(list(accumulate(L)) + [0])\nn = bisect_right(acc, X)\nprint(n)\n", "code_v1_no_empty_lines": "N, X = list(map(int, input().split()))\nL = list(map(int, input().split()))\nList = [0] * (N + 1)\nfor i in range(1, N + 1):\n List[i] = List[i - 1] + L[i - 1]\nA = [i for i in List if i <= X]\nprint((len(A)))\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-from itertools import accumulate", "-from bisect import *", "-", "-L = list(tuple(map(int, input().split())))", "-acc = sorted(list(accumulate(L)) + [0])", "-n = bisect_right(acc, X)", "-print(n)", "+L = list(map(int, input().split()))", "+List = [0] * (N + 1)", "+for i in range(1, N + 1):", "+ List[i] = List[i - 1] + L[i - 1]", "+A = [i for i in List if i <= X]", "+print((len(A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2199657279, "measured_runtime_v1": 0.1756561113, "runtime_lift": 1.2522520635, "key": ["s259788442", "s163625054"], "target_token_count_dream": 72, "target_token_bucket_dream": "<128"} +{"user_id": "u460245024", "problem_id": "p03416", "language": "python", "submission_id_v0": "s770002751", "submission_id_v1": "s323286862", "cpu_time_v0": 51, "cpu_time_v1": 32, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 37.25, "input": "A, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n n_s = str(n)\n\n n_s_rvs = n_s[::-1]\n\n if n_s == n_s_rvs:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "target": "A, B = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor n in range(A, B+1):\n\n if n//10000 == n%10 and (n//1000)%10 == (n//10)%10:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "code_v0_loc": 10, "code_v1_loc": 8, "code_v0_num_chars": 168, "code_v1_num_chars": 158, "code_v0_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor n in range(A, B + 1):\n n_s = str(n)\n n_s_rvs = n_s[::-1]\n if n_s == n_s_rvs:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "A, B = list(map(int, input().split()))\ncnt = 0\nfor n in range(A, B + 1):\n if n // 10000 == n % 10 and (n // 1000) % 10 == (n // 10) % 10:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["- n_s = str(n)", "- n_s_rvs = n_s[::-1]", "- if n_s == n_s_rvs:", "+ if n // 10000 == n % 10 and (n // 1000) % 10 == (n // 10) % 10:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3429904201, "measured_runtime_v1": 0.2179555298, "runtime_lift": 1.5736715671, "key": ["s770002751", "s323286862"], "target_token_count_dream": 72, "target_token_bucket_dream": "<128"} +{"user_id": "u597374218", "problem_id": "p03796", "language": "python", "submission_id_v0": "s636787028", "submission_id_v1": "s575140392", "cpu_time_v0": 154, "cpu_time_v1": 44, "memory_v0": 10168, "memory_v1": 9028, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 71.43, "input": "import math\n\nN=int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "target": "N=int(input())\n\npower=1\n\nfor i in range(1,N+1):\n\n power*=i\n\n power%=10**9+7\n\nprint(power)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 63, "code_v1_num_chars": 95, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "N = int(input())\npower = 1\nfor i in range(1, N + 1):\n power *= i\n power %= 10**9 + 7\nprint(power)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-print((math.factorial(N) % (10**9 + 7)))", "+power = 1", "+for i in range(1, N + 1):", "+ power *= i", "+ power %= 10**9 + 7", "+print(power)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6653705416, "measured_runtime_v1": 0.3042658694, "runtime_lift": 2.1868063707, "key": ["s636787028", "s575140392"], "target_token_count_dream": 36, "target_token_bucket_dream": "<128"} +{"user_id": "u970197315", "problem_id": "p03371", "language": "python", "submission_id_v0": "s588181559", "submission_id_v1": "s154731902", "cpu_time_v0": 63, "cpu_time_v1": 17, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 73.02, "input": "# ABC95 C -Half and Half\n\na,b,c,x,y = list(map(float,input().split()))\n\nans = 0\n\nif a+b > 2*c:\n\n while x != 0.0 and y != 0.0:\n\n ans += 2*c\n\n x -= 1.0\n\n y -= 1.0\n\n if y == 0.0:\n\n while x != 0.0:\n\n if a > 2*c:\n\n ans += 2*c\n\n x -= 1.0\n\n else:\n\n ans += a\n\n x -= 1.0\n\n if x == 0.0:\n\n while y != 0.0:\n\n if b > 2*c:\n\n ans += 2*c\n\n y -= 1.0\n\n else:\n\n ans += b\n\n y -= 1.0\n\nelse:\n\n ans += a*x + b*y\n\nprint((int(ans)))\n\n\n\n ", "target": "a,b,c,x,y=list(map(int,input().split()))\n\nans=0\n\nans1=0\n\n\n\ne=max(x,y)\n\nans1=e*(2*c)\n\nif 2*c 2 * c:\n while x != 0.0 and y != 0.0:\n ans += 2 * c\n x -= 1.0\n y -= 1.0\n if y == 0.0:\n while x != 0.0:\n if a > 2 * c:\n ans += 2 * c\n x -= 1.0\n else:\n ans += a\n x -= 1.0\n if x == 0.0:\n while y != 0.0:\n if b > 2 * c:\n ans += 2 * c\n y -= 1.0\n else:\n ans += b\n y -= 1.0\nelse:\n ans += a * x + b * y\nprint((int(ans)))\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nans = 0\nans1 = 0\ne = max(x, y)\nans1 = e * (2 * c)\nif 2 * c < a + b:\n d = min(x, y)\n ans += c * (2 * d)\n x -= d\n y -= d\nelse:\n ans = a * x + b * y\n x -= x\n y -= y\nans += x * a\nans += y * b\nprint((min(ans, ans1)))\n", "code_same": false, "relative_loc_diff_percent": 37.9310344828, "diff": ["-# ABC95 C -Half and Half", "-a, b, c, x, y = list(map(float, input().split()))", "+a, b, c, x, y = list(map(int, input().split()))", "-if a + b > 2 * c:", "- while x != 0.0 and y != 0.0:", "- ans += 2 * c", "- x -= 1.0", "- y -= 1.0", "- if y == 0.0:", "- while x != 0.0:", "- if a > 2 * c:", "- ans += 2 * c", "- x -= 1.0", "- else:", "- ans += a", "- x -= 1.0", "- if x == 0.0:", "- while y != 0.0:", "- if b > 2 * c:", "- ans += 2 * c", "- y -= 1.0", "- else:", "- ans += b", "- y -= 1.0", "+ans1 = 0", "+e = max(x, y)", "+ans1 = e * (2 * c)", "+if 2 * c < a + b:", "+ d = min(x, y)", "+ ans += c * (2 * d)", "+ x -= d", "+ y -= d", "- ans += a * x + b * y", "-print((int(ans)))", "+ ans = a * x + b * y", "+ x -= x", "+ y -= y", "+ans += x * a", "+ans += y * b", "+print((min(ans, ans1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3221288462, "measured_runtime_v1": 0.2473681471, "runtime_lift": 1.3022244371, "key": ["s588181559", "s154731902"], "target_token_count_dream": 101, "target_token_bucket_dream": "<128"} +{"user_id": "u632413369", "problem_id": "p02595", "language": "python", "submission_id_v0": "s512106161", "submission_id_v1": "s251902862", "cpu_time_v0": 491, "cpu_time_v1": 390, "memory_v0": 9080, "memory_v1": 9188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.57, "input": "N, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x ** 2 + y ** 2 <= D ** 2:\n\n cnt += 1\n\n \n\nprint(cnt)", "target": "N, D = list(map(int, input().split()))\n\ncnt = 0\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n if x * x + y * y <= D * D:\n\n cnt += 1\n\n \n\nprint(cnt)", "code_v0_loc": 8, "code_v1_loc": 8, "code_v0_num_chars": 174, "code_v1_num_chars": 171, "code_v0_no_empty_lines": "N, D = list(map(int, input().split()))\ncnt = 0\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if x**2 + y**2 <= D**2:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "N, D = list(map(int, input().split()))\ncnt = 0\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if x * x + y * y <= D * D:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- if x**2 + y**2 <= D**2:", "+ if x * x + y * y <= D * D:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1756704731, "measured_runtime_v1": 0.0073727348, "runtime_lift": 23.8270435573, "key": ["s512106161", "s251902862"], "target_token_count_dream": 60, "target_token_bucket_dream": "<128"} +{"user_id": "u617515020", "problem_id": "p02814", "language": "python", "submission_id_v0": "s956521329", "submission_id_v1": "s164820491", "cpu_time_v0": 67, "cpu_time_v1": 51, "memory_v0": 16316, "memory_v1": 20372, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.88, "input": "from math import gcd\n\n\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\n\n\na=list([x//2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) // gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\n\n\nif (lcma//a[0])%2==0:\n\n print((0))\n\nelse:\n\n flg=0\n\n for i in range(1,len(a)):\n\n if (lcma//a[i])%2==0:\n\n print((0))\n\n flg=1\n\n break\n\n if flg==0:\n\n temp=m//lcma\n\n print((temp//2 if temp%2==0 else temp//2+1))", "target": "from math import gcd\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=list(set(a))\n\na=list([x//2 for x in a])\n\n\n\ndef lcm(q):\n\n x = q[0]\n\n for i in range(1, len(q)):\n\n x = (x * q[i]) // gcd(x, q[i])\n\n return x\n\n\n\nlcma=lcm(a)\n\nfor i in range(len(a)):\n\n if (lcma//a[i])%2==0:\n\n print((0))\n\n exit()\n\ntemp=m//lcma\n\nprint((temp//2 if temp%2==0 else temp//2+1))", "code_v0_loc": 28, "code_v1_loc": 19, "code_v0_num_chars": 492, "code_v1_num_chars": 386, "code_v0_no_empty_lines": "from math import gcd\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = list(set(a))\na = list([x // 2 for x in a])\n\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) // gcd(x, q[i])\n return x\n\n\nlcma = lcm(a)\nif (lcma // a[0]) % 2 == 0:\n print((0))\nelse:\n flg = 0\n for i in range(1, len(a)):\n if (lcma // a[i]) % 2 == 0:\n print((0))\n flg = 1\n break\n if flg == 0:\n temp = m // lcma\n print((temp // 2 if temp % 2 == 0 else temp // 2 + 1))\n", "code_v1_no_empty_lines": "from math import gcd\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na = list(set(a))\na = list([x // 2 for x in a])\n\n\ndef lcm(q):\n x = q[0]\n for i in range(1, len(q)):\n x = (x * q[i]) // gcd(x, q[i])\n return x\n\n\nlcma = lcm(a)\nfor i in range(len(a)):\n if (lcma // a[i]) % 2 == 0:\n print((0))\n exit()\ntemp = m // lcma\nprint((temp // 2 if temp % 2 == 0 else temp // 2 + 1))\n", "code_same": false, "relative_loc_diff_percent": 32.1428571429, "diff": ["-from math import gcd", "+from math import gcd", "-if (lcma // a[0]) % 2 == 0:", "- print((0))", "-else:", "- flg = 0", "- for i in range(1, len(a)):", "- if (lcma // a[i]) % 2 == 0:", "- print((0))", "- flg = 1", "- break", "- if flg == 0:", "- temp = m // lcma", "- print((temp // 2 if temp % 2 == 0 else temp // 2 + 1))", "+for i in range(len(a)):", "+ if (lcma // a[i]) % 2 == 0:", "+ print((0))", "+ exit()", "+temp = m // lcma", "+print((temp // 2 if temp % 2 == 0 else temp // 2 + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2803374403, "measured_runtime_v1": 0.2137892873, "runtime_lift": 1.3112791747, "key": ["s956521329", "s164820491"], "target_token_count_dream": 142, "target_token_bucket_dream": "128-256"} +{"user_id": "u209275335", "problem_id": "p02693", "language": "python", "submission_id_v0": "s337733409", "submission_id_v1": "s217218479", "cpu_time_v0": 61, "cpu_time_v1": 22, "memory_v0": 61660, "memory_v1": 9172, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 63.93, "input": "S = int(input())\n\na = 0\n\ncount = 0\n\nn,m = list(map(int,input().split()))\n\nwhile count == 0:\n\n a += S\n\n if n <= a and m >= a:\n\n count = 1\n\n if a >= 1000:\n\n break\n\nif count == 0:\n\n print(\"NG\")\n\nelse:\n\n print(\"OK\")", "target": "k = int(input())\n\nn = 0\n\na,b = list(map(int,input().split()))\n\nwhile True:\n\n n += k\n\n if n >= a and n <= b:\n\n print(\"OK\")\n\n break\n\n if n > b:\n\n print(\"NG\")\n\n break", "code_v0_loc": 14, "code_v1_loc": 11, "code_v0_num_chars": 234, "code_v1_num_chars": 194, "code_v0_no_empty_lines": "S = int(input())\na = 0\ncount = 0\nn, m = list(map(int, input().split()))\nwhile count == 0:\n a += S\n if n <= a and m >= a:\n count = 1\n if a >= 1000:\n break\nif count == 0:\n print(\"NG\")\nelse:\n print(\"OK\")\n", "code_v1_no_empty_lines": "k = int(input())\nn = 0\na, b = list(map(int, input().split()))\nwhile True:\n n += k\n if n >= a and n <= b:\n print(\"OK\")\n break\n if n > b:\n print(\"NG\")\n break\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-S = int(input())", "-a = 0", "-count = 0", "-n, m = list(map(int, input().split()))", "-while count == 0:", "- a += S", "- if n <= a and m >= a:", "- count = 1", "- if a >= 1000:", "+k = int(input())", "+n = 0", "+a, b = list(map(int, input().split()))", "+while True:", "+ n += k", "+ if n >= a and n <= b:", "+ print(\"OK\")", "-if count == 0:", "- print(\"NG\")", "-else:", "- print(\"OK\")", "+ if n > b:", "+ print(\"NG\")", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2075882792, "measured_runtime_v1": 0.0060749435, "runtime_lift": 34.1712276754, "key": ["s337733409", "s217218479"], "target_token_count_dream": 59, "target_token_bucket_dream": "<128"} +{"user_id": "u038021590", "problem_id": "p03171", "language": "python", "submission_id_v0": "s330952971", "submission_id_v1": "s165498833", "cpu_time_v0": 615, "cpu_time_v1": 234, "memory_v0": 115036, "memory_v1": 135316, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.95, "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nn = N % 2\n\n\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor w in range(1, N+1):\n\n for i in range(N):\n\n j = i + w\n\n if j > N:\n\n continue\n\n if (w+n) % 2 == 1:\n\n DP[i][j] = min(DP[i+1][j] - A[i], DP[i][j-1] - A[j-1])\n\n else:\n\n DP[i][j] = max(DP[i+1][j] + A[i], DP[i][j-1] + A[j-1])\n\n\n\nprint((DP[0][N]))\n", "target": "N = int(input())\n\nA = list(map(int, input().split()))\n\nDP = [[0] * (N+1) for _ in range(N+1)]\n\n\n\nfor num in range(1, N + 1):\n\n for start in range(N):\n\n end = start + num\n\n if end > N:\n\n break\n\n if num == 1:\n\n DP[start][end] = A[start]\n\n else:\n\n DP[start][end] = max(A[start] - DP[start+1][end], A[end - 1] - DP[start][end - 1])\n\nprint((DP[0][N]))\n", "code_v0_loc": 17, "code_v1_loc": 14, "code_v0_num_chars": 416, "code_v1_num_chars": 409, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nn = N % 2\nDP = [[0] * (N + 1) for _ in range(N + 1)]\nfor w in range(1, N + 1):\n for i in range(N):\n j = i + w\n if j > N:\n continue\n if (w + n) % 2 == 1:\n DP[i][j] = min(DP[i + 1][j] - A[i], DP[i][j - 1] - A[j - 1])\n else:\n DP[i][j] = max(DP[i + 1][j] + A[i], DP[i][j - 1] + A[j - 1])\nprint((DP[0][N]))\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nDP = [[0] * (N + 1) for _ in range(N + 1)]\nfor num in range(1, N + 1):\n for start in range(N):\n end = start + num\n if end > N:\n break\n if num == 1:\n DP[start][end] = A[start]\n else:\n DP[start][end] = max(\n A[start] - DP[start + 1][end], A[end - 1] - DP[start][end - 1]\n )\nprint((DP[0][N]))\n", "code_same": false, "relative_loc_diff_percent": 17.6470588235, "diff": ["-n = N % 2", "-for w in range(1, N + 1):", "- for i in range(N):", "- j = i + w", "- if j > N:", "- continue", "- if (w + n) % 2 == 1:", "- DP[i][j] = min(DP[i + 1][j] - A[i], DP[i][j - 1] - A[j - 1])", "+for num in range(1, N + 1):", "+ for start in range(N):", "+ end = start + num", "+ if end > N:", "+ break", "+ if num == 1:", "+ DP[start][end] = A[start]", "- DP[i][j] = max(DP[i + 1][j] + A[i], DP[i][j - 1] + A[j - 1])", "+ DP[start][end] = max(", "+ A[start] - DP[start + 1][end], A[end - 1] - DP[start][end - 1]", "+ )"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1878290408, "measured_runtime_v1": 0.0068282696, "runtime_lift": 27.5075605354, "key": ["s330952971", "s165498833"], "target_token_count_dream": 132, "target_token_bucket_dream": "128-256"} +{"user_id": "u754022296", "problem_id": "p03796", "language": "python", "submission_id_v0": "s893557911", "submission_id_v1": "s686331748", "cpu_time_v0": 230, "cpu_time_v1": 48, "memory_v0": 3984, "memory_v1": 9008, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 79.13, "input": "from math import factorial as fc\n\na = int(input())\n\nprint((fc(a)%(10**9+7)))", "target": "n = int(input())\n\nm = 10**9+7\n\nans = 1\n\nfor i in range(1, n+1):\n\n ans *= i\n\n ans %= m\n\nprint(ans)", "code_v0_loc": 3, "code_v1_loc": 7, "code_v0_num_chars": 74, "code_v1_num_chars": 99, "code_v0_no_empty_lines": "from math import factorial as fc\n\na = int(input())\nprint((fc(a) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nm = 10**9 + 7\nans = 1\nfor i in range(1, n + 1):\n ans *= i\n ans %= m\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-from math import factorial as fc", "-", "-a = int(input())", "-print((fc(a) % (10**9 + 7)))", "+n = int(input())", "+m = 10**9 + 7", "+ans = 1", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans %= m", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4826196883, "measured_runtime_v1": 0.2178869207, "runtime_lift": 2.2150007294, "key": ["s893557911", "s686331748"], "target_token_count_dream": 44, "target_token_bucket_dream": "<128"} +{"user_id": "u957843607", "problem_id": "p02574", "language": "python", "submission_id_v0": "s835620267", "submission_id_v1": "s021486096", "cpu_time_v0": 703, "cpu_time_v1": 584, "memory_v0": 134500, "memory_v1": 134400, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.93, "input": "from math import gcd\n\n\n\nN = int(input())\n\nnum_lis = list(map(int, input().split()))\n\nc = True\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(10**6+10)\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num //= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n c = False\n\n break\n\n else:\n\n tmp.add(j)\n\n else:\n\n continue\n\n break\n\n\n\nif c:\n\n print(\"pairwise coprime\")\n\nelse:\n\n print(\"setwise coprime\")", "target": "from math import gcd\n\n\n\nN = int(input())\n\nnum_lis = list(map(int, input().split()))\n\n\n\ndef osa_k(max_num):\n\n lis = [i for i in range(max_num+1)]\n\n p = 2\n\n while p**2 <= max_num:\n\n if lis[p] == p:\n\n for q in range(2*p, max_num+1, p):\n\n if lis[q] == q:\n\n lis[q] = p\n\n p += 1\n\n return lis\n\n\n\nhoge = 0\n\nfor i in num_lis:\n\n hoge = gcd(hoge, i)\n\nif hoge > 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nd_lis = osa_k(max(num_lis))\n\ntmp = set()\n\nfor i in num_lis:\n\n num = i\n\n new_tmp = set()\n\n while num > 1:\n\n d = d_lis[num]\n\n new_tmp.add(d)\n\n num //= d\n\n for j in new_tmp:\n\n if j in tmp:\n\n print(\"setwise coprime\")\n\n exit()\n\n else:\n\n tmp.add(j)\n\nprint(\"pairwise coprime\")", "code_v0_loc": 47, "code_v1_loc": 39, "code_v0_num_chars": 793, "code_v1_num_chars": 725, "code_v0_no_empty_lines": "from math import gcd\n\nN = int(input())\nnum_lis = list(map(int, input().split()))\nc = True\n\n\ndef osa_k(max_num):\n lis = [i for i in range(max_num + 1)]\n p = 2\n while p**2 <= max_num:\n if lis[p] == p:\n for q in range(2 * p, max_num + 1, p):\n if lis[q] == q:\n lis[q] = p\n p += 1\n return lis\n\n\nhoge = 0\nfor i in num_lis:\n hoge = gcd(hoge, i)\nif hoge > 1:\n print(\"not coprime\")\n exit()\nd_lis = osa_k(10**6 + 10)\ntmp = set()\nfor i in num_lis:\n num = i\n new_tmp = set()\n while num > 1:\n d = d_lis[num]\n new_tmp.add(d)\n num //= d\n for j in new_tmp:\n if j in tmp:\n c = False\n break\n else:\n tmp.add(j)\n else:\n continue\n break\nif c:\n print(\"pairwise coprime\")\nelse:\n print(\"setwise coprime\")\n", "code_v1_no_empty_lines": "from math import gcd\n\nN = int(input())\nnum_lis = list(map(int, input().split()))\n\n\ndef osa_k(max_num):\n lis = [i for i in range(max_num + 1)]\n p = 2\n while p**2 <= max_num:\n if lis[p] == p:\n for q in range(2 * p, max_num + 1, p):\n if lis[q] == q:\n lis[q] = p\n p += 1\n return lis\n\n\nhoge = 0\nfor i in num_lis:\n hoge = gcd(hoge, i)\nif hoge > 1:\n print(\"not coprime\")\n exit()\nd_lis = osa_k(max(num_lis))\ntmp = set()\nfor i in num_lis:\n num = i\n new_tmp = set()\n while num > 1:\n d = d_lis[num]\n new_tmp.add(d)\n num //= d\n for j in new_tmp:\n if j in tmp:\n print(\"setwise coprime\")\n exit()\n else:\n tmp.add(j)\nprint(\"pairwise coprime\")\n", "code_same": false, "relative_loc_diff_percent": 17.0212765957, "diff": ["-c = True", "-d_lis = osa_k(10**6 + 10)", "+d_lis = osa_k(max(num_lis))", "- c = False", "- break", "+ print(\"setwise coprime\")", "+ exit()", "- else:", "- continue", "- break", "-if c:", "- print(\"pairwise coprime\")", "-else:", "- print(\"setwise coprime\")", "+print(\"pairwise coprime\")"], "diff_only_import_comment": false, "measured_runtime_v0": 2.272307416, "measured_runtime_v1": 0.2046107306, "runtime_lift": 11.1055144012, "key": ["s835620267", "s021486096"], "target_token_count_dream": 250, "target_token_bucket_dream": "128-256"} +{"user_id": "u380524497", "problem_id": "p02850", "language": "python", "submission_id_v0": "s943818401", "submission_id_v1": "s978957689", "cpu_time_v0": 583, "cpu_time_v1": 446, "memory_v0": 25092, "memory_v1": 25184, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 23.5, "input": "n = int(input())\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n", "target": "import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(input())\n\nedges = []\n\n\n\nfor id in range(n-1):\n\n a, b = list(map(int, input().split()))\n\n edges.append([a-1, b-1, id])\n\n\n\nedges.sort()\n\n\n\nused = [0]*(n)\n\nans = [0]*(n-1)\n\nnum = 1\n\nprev = 0\n\nfor edge in edges:\n\n _from, to, id = edge\n\n if _from != prev:\n\n num = 1\n\n if used[_from] == num:\n\n num += 1\n\n ans[id] = num\n\n used[to] = num\n\n num += 1\n\n prev = _from\n\n\n\nprint((max(ans)))\n\nfor color in ans:\n\n print(color)\n", "code_v0_loc": 27, "code_v1_loc": 30, "code_v0_num_chars": 455, "code_v1_num_chars": 497, "code_v0_no_empty_lines": "n = int(input())\nedges = []\nfor id in range(n - 1):\n a, b = list(map(int, input().split()))\n edges.append([a - 1, b - 1, id])\nedges.sort()\nused = [0] * (n)\nans = [0] * (n - 1)\nnum = 1\nprev = 0\nfor edge in edges:\n _from, to, id = edge\n if _from != prev:\n num = 1\n if used[_from] == num:\n num += 1\n ans[id] = num\n used[to] = num\n num += 1\n prev = _from\nprint((max(ans)))\nfor color in ans:\n print(color)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nn = int(input())\nedges = []\nfor id in range(n - 1):\n a, b = list(map(int, input().split()))\n edges.append([a - 1, b - 1, id])\nedges.sort()\nused = [0] * (n)\nans = [0] * (n - 1)\nnum = 1\nprev = 0\nfor edge in edges:\n _from, to, id = edge\n if _from != prev:\n num = 1\n if used[_from] == num:\n num += 1\n ans[id] = num\n used[to] = num\n num += 1\n prev = _from\nprint((max(ans)))\nfor color in ans:\n print(color)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["+import sys", "+", "+input = sys.stdin.readline"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2558188839, "measured_runtime_v1": 0.0060829046, "runtime_lift": 42.0553832838, "key": ["s943818401", "s978957689"], "target_token_count_dream": 166, "target_token_bucket_dream": "128-256"} +{"user_id": "u234052535", "problem_id": "p00003", "language": "python", "submission_id_v0": "s822995507", "submission_id_v1": "s034189952", "cpu_time_v0": 50, "cpu_time_v1": 30, "memory_v0": 7724, "memory_v1": 7764, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.0, "input": "for i in range(0, int(input())):\n\n sidelen = [int(j) for j in input().split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")", "target": "import sys\n\nfor i in sys.stdin:\n\n try:\n\n sidelen = [int(j) for j in i.split(\" \")]\n\n sidelen.sort(reverse=True)\n\n if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2):\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n except:\n\n continue", "code_v0_loc": 7, "code_v1_loc": 11, "code_v0_num_chars": 227, "code_v1_num_chars": 285, "code_v0_no_empty_lines": "for i in range(0, int(input())):\n sidelen = [int(j) for j in input().split(\" \")]\n sidelen.sort(reverse=True)\n if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:\n print(\"YES\")\n else:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nfor i in sys.stdin:\n try:\n sidelen = [int(j) for j in i.split(\" \")]\n sidelen.sort(reverse=True)\n if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:\n print(\"YES\")\n else:\n print(\"NO\")\n except:\n continue\n", "code_same": false, "relative_loc_diff_percent": 36.3636363636, "diff": ["-for i in range(0, int(input())):", "- sidelen = [int(j) for j in input().split(\" \")]", "- sidelen.sort(reverse=True)", "- if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:", "- print(\"YES\")", "- else:", "- print(\"NO\")", "+import sys", "+", "+for i in sys.stdin:", "+ try:", "+ sidelen = [int(j) for j in i.split(\" \")]", "+ sidelen.sort(reverse=True)", "+ if sidelen[0] ** 2 == sidelen[1] ** 2 + sidelen[2] ** 2:", "+ print(\"YES\")", "+ else:", "+ print(\"NO\")", "+ except:", "+ continue"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3279889946, "measured_runtime_v1": 0.2582271154, "runtime_lift": 1.2701570634, "key": ["s822995507", "s034189952"], "target_token_count_dream": 76, "target_token_bucket_dream": "<128"} +{"user_id": "u341543478", "problem_id": "p03424", "language": "python", "submission_id_v0": "s841365629", "submission_id_v1": "s932855105", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9156, "memory_v1": 8908, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "n = int(input())\n\ns = input().split()\n\ns = set(s)\n\nprint(('Four' if len(s) == 4 else 'Three'))", "target": "n = int(input())\n\ns = input().split()\n\nprint(('Four' if len(set(s)) == 4 else 'Three'))", "code_v0_loc": 4, "code_v1_loc": 3, "code_v0_num_chars": 92, "code_v1_num_chars": 85, "code_v0_no_empty_lines": "n = int(input())\ns = input().split()\ns = set(s)\nprint((\"Four\" if len(s) == 4 else \"Three\"))\n", "code_v1_no_empty_lines": "n = int(input())\ns = input().split()\nprint((\"Four\" if len(set(s)) == 4 else \"Three\"))\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-s = set(s)", "-print((\"Four\" if len(s) == 4 else \"Three\"))", "+print((\"Four\" if len(set(s)) == 4 else \"Three\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2928216946, "measured_runtime_v1": 0.09356422, "runtime_lift": 3.1296332587, "key": ["s841365629", "s932855105"], "target_token_count_dream": 27, "target_token_bucket_dream": "<128"} +{"user_id": "u633068244", "problem_id": "p00122", "language": "python", "submission_id_v0": "s871701752", "submission_id_v1": "s889694954", "cpu_time_v0": 20, "cpu_time_v1": 10, "memory_v0": 4272, "memory_v1": 4268, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 50.0, "input": "dX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return \"OK\"\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = input()\n\n\txy = list(map(int,input().split()))\n\n\tans = solve(x,y,xy)\n\n\tprint(ans if ans else \"NA\")", "target": "dX = [2,2,2,1,0,-1,-2,-2,-2,-1,0,1]\n\ndY = [-1,0,1,2,2,2,1,0,-1,-2,-2,-2]\n\ndef solve(x,y,XY):\n\n\txy = XY[:]\n\n\tif len(xy) == 0: return True\n\n\tsx,sy = xy.pop(0),xy.pop(0)\n\n\tfor dx,dy in zip(dX,dY):\n\n\t\tif doa(x+dx,y+dy,sx,sy): \n\n\t\t\tr = solve(x+dx,y+dy,xy)\n\n\t\t\tif r: return r\n\n\n\ndef doa(x,y,sx,sy):\n\n\tif not (0 <= x <= 9 and 0 <= y <= 9): return False\n\n\treturn True if abs(x-sx) < 2 and abs(y-sy) < 2 else False\n\n\n\nwhile 1:\n\n\tx,y = list(map(int,input().split()))\n\n\tif x == y == 0: break\n\n\tn = input()\n\n\txy = list(map(int,input().split()))\n\n\tprint(\"OK\" if solve(x,y,xy) else \"NA\")", "code_v0_loc": 22, "code_v1_loc": 21, "code_v0_num_chars": 579, "code_v1_num_chars": 568, "code_v0_no_empty_lines": "dX = [2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1]\ndY = [-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2]\n\n\ndef solve(x, y, XY):\n xy = XY[:]\n if len(xy) == 0:\n return \"OK\"\n sx, sy = xy.pop(0), xy.pop(0)\n for dx, dy in zip(dX, dY):\n if doa(x + dx, y + dy, sx, sy):\n r = solve(x + dx, y + dy, xy)\n if r:\n return r\n\n\ndef doa(x, y, sx, sy):\n if not (0 <= x <= 9 and 0 <= y <= 9):\n return False\n return True if abs(x - sx) < 2 and abs(y - sy) < 2 else False\n\n\nwhile 1:\n x, y = list(map(int, input().split()))\n if x == y == 0:\n break\n n = input()\n xy = list(map(int, input().split()))\n ans = solve(x, y, xy)\n print(ans if ans else \"NA\")\n", "code_v1_no_empty_lines": "dX = [2, 2, 2, 1, 0, -1, -2, -2, -2, -1, 0, 1]\ndY = [-1, 0, 1, 2, 2, 2, 1, 0, -1, -2, -2, -2]\n\n\ndef solve(x, y, XY):\n xy = XY[:]\n if len(xy) == 0:\n return True\n sx, sy = xy.pop(0), xy.pop(0)\n for dx, dy in zip(dX, dY):\n if doa(x + dx, y + dy, sx, sy):\n r = solve(x + dx, y + dy, xy)\n if r:\n return r\n\n\ndef doa(x, y, sx, sy):\n if not (0 <= x <= 9 and 0 <= y <= 9):\n return False\n return True if abs(x - sx) < 2 and abs(y - sy) < 2 else False\n\n\nwhile 1:\n x, y = list(map(int, input().split()))\n if x == y == 0:\n break\n n = input()\n xy = list(map(int, input().split()))\n print(\"OK\" if solve(x, y, xy) else \"NA\")\n", "code_same": false, "relative_loc_diff_percent": 4.5454545455, "diff": ["- return \"OK\"", "+ return True", "- ans = solve(x, y, xy)", "- print(ans if ans else \"NA\")", "+ print(\"OK\" if solve(x, y, xy) else \"NA\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2335389843, "measured_runtime_v1": 0.183096947, "runtime_lift": 1.2754936015, "key": ["s871701752", "s889694954"], "target_token_count_dream": 249, "target_token_bucket_dream": "128-256"} +{"user_id": "u827202523", "problem_id": "p03988", "language": "python", "submission_id_v0": "s661300903", "submission_id_v1": "s790648502", "cpu_time_v0": 180, "cpu_time_v1": 75, "memory_v0": 38384, "memory_v1": 69368, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 58.33, "input": "import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(1000000)\n\nfrom collections import deque\n\ndef getN():\n\n return int(input())\n\ndef getList():\n\n return list(map(int, input().split()))\n\nimport math\n\n\n\nn = getN()\n\nnums = getList()\n\n\n\n# nums.sort(reverse=True)\n\nmx = max(nums)\n\nmn = (mx+1) // 2\n\nmndx = (mx % 2) + 1\n\n\n\nfrom collections import Counter\n\n\n\ncnt = Counter(nums)\n\n\n\nfor i in range(mn+1, mx+1):\n\n if cnt[i] < 2:\n\n print(\"Impossible\")\n\n sys.exit()\n\n\n\nif cnt[mn] != mndx:\n\n print(\"Impossible\")\n\nelse:\n\n print(\"Possible\")", "target": "import sys\n\nimport math\n\nimport copy\n\nfrom heapq import heappush, heappop, heapify\n\nfrom functools import cmp_to_key\n\nfrom bisect import bisect_left, bisect_right\n\nfrom collections import defaultdict, deque, Counter\n\n# sys.setrecursionlimit(1000000)\n\n\n\n# input aliases\n\ninput = sys.stdin.readline\n\ngetS = lambda: input().strip()\n\ngetN = lambda: int(input())\n\ngetList = lambda: list(map(int, input().split()))\n\ngetZList = lambda: [int(x) - 1 for x in input().split()]\n\n\n\nINF = float(\"inf\")\n\nMOD = 10**9 + 7\n\ndivide = lambda x: pow(x, MOD-2, MOD)\n\n\n\ndef pim():\n\n print(\"Impossible\")\n\n sys.exit()\n\ndef pp():\n\n print(\"Possible\")\n\n sys.exit()\n\ndef solve():\n\n n = getN()\n\n nums = getList()\n\n cnt = Counter(nums)\n\n mx = max(nums)\n\n mn = min(nums)\n\n\n\n if cnt[mx] < 2:\n\n pim()\n\n if mn < (mx + 1) // 2:\n\n pim()\n\n\n\n if mx % 2 == 0:\n\n if cnt[mx//2] != 1:\n\n pim()\n\n else:\n\n if cnt[(mx+1) // 2] != 2:\n\n pim()\n\n\n\n for i in range((mx + 1) // 2 + 1, mx+1):\n\n if cnt[i] < 2:\n\n pim()\n\n\n\n pp()\n\n\n\n\n\ndef main():\n\n n = getN()\n\n for _ in range(n):\n\n solve()\n\n\n\n return\n\nif __name__ == \"__main__\":\n\n # main()\n\n solve()\n\n\n\n\n\n\n\n\n\n\n", "code_v0_loc": 31, "code_v1_loc": 66, "code_v0_num_chars": 564, "code_v1_num_chars": 1240, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(1000000)\nfrom collections import deque\n\n\ndef getN():\n return int(input())\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\nimport math\n\nn = getN()\nnums = getList()\n# nums.sort(reverse=True)\nmx = max(nums)\nmn = (mx + 1) // 2\nmndx = (mx % 2) + 1\nfrom collections import Counter\n\ncnt = Counter(nums)\nfor i in range(mn + 1, mx + 1):\n if cnt[i] < 2:\n print(\"Impossible\")\n sys.exit()\nif cnt[mn] != mndx:\n print(\"Impossible\")\nelse:\n print(\"Possible\")\n", "code_v1_no_empty_lines": "import sys\nimport math\nimport copy\nfrom heapq import heappush, heappop, heapify\nfrom functools import cmp_to_key\nfrom bisect import bisect_left, bisect_right\nfrom collections import defaultdict, deque, Counter\n\n# sys.setrecursionlimit(1000000)\n# input aliases\ninput = sys.stdin.readline\ngetS = lambda: input().strip()\ngetN = lambda: int(input())\ngetList = lambda: list(map(int, input().split()))\ngetZList = lambda: [int(x) - 1 for x in input().split()]\nINF = float(\"inf\")\nMOD = 10**9 + 7\ndivide = lambda x: pow(x, MOD - 2, MOD)\n\n\ndef pim():\n print(\"Impossible\")\n sys.exit()\n\n\ndef pp():\n print(\"Possible\")\n sys.exit()\n\n\ndef solve():\n n = getN()\n nums = getList()\n cnt = Counter(nums)\n mx = max(nums)\n mn = min(nums)\n if cnt[mx] < 2:\n pim()\n if mn < (mx + 1) // 2:\n pim()\n if mx % 2 == 0:\n if cnt[mx // 2] != 1:\n pim()\n else:\n if cnt[(mx + 1) // 2] != 2:\n pim()\n for i in range((mx + 1) // 2 + 1, mx + 1):\n if cnt[i] < 2:\n pim()\n pp()\n\n\ndef main():\n n = getN()\n for _ in range(n):\n solve()\n return\n\n\nif __name__ == \"__main__\":\n # main()\n solve()\n", "code_same": false, "relative_loc_diff_percent": 53.0303030303, "diff": ["+import math", "+import copy", "+from heapq import heappush, heappop, heapify", "+from functools import cmp_to_key", "+from bisect import bisect_left, bisect_right", "+from collections import defaultdict, deque, Counter", "+# sys.setrecursionlimit(1000000)", "+# input aliases", "-sys.setrecursionlimit(1000000)", "-from collections import deque", "+getS = lambda: input().strip()", "+getN = lambda: int(input())", "+getList = lambda: list(map(int, input().split()))", "+getZList = lambda: [int(x) - 1 for x in input().split()]", "+INF = float(\"inf\")", "+MOD = 10**9 + 7", "+divide = lambda x: pow(x, MOD - 2, MOD)", "-def getN():", "- return int(input())", "+def pim():", "+ print(\"Impossible\")", "+ sys.exit()", "-def getList():", "- return list(map(int, input().split()))", "+def pp():", "+ print(\"Possible\")", "+ sys.exit()", "-import math", "+def solve():", "+ n = getN()", "+ nums = getList()", "+ cnt = Counter(nums)", "+ mx = max(nums)", "+ mn = min(nums)", "+ if cnt[mx] < 2:", "+ pim()", "+ if mn < (mx + 1) // 2:", "+ pim()", "+ if mx % 2 == 0:", "+ if cnt[mx // 2] != 1:", "+ pim()", "+ else:", "+ if cnt[(mx + 1) // 2] != 2:", "+ pim()", "+ for i in range((mx + 1) // 2 + 1, mx + 1):", "+ if cnt[i] < 2:", "+ pim()", "+ pp()", "-n = getN()", "-nums = getList()", "-# nums.sort(reverse=True)", "-mx = max(nums)", "-mn = (mx + 1) // 2", "-mndx = (mx % 2) + 1", "-from collections import Counter", "-cnt = Counter(nums)", "-for i in range(mn + 1, mx + 1):", "- if cnt[i] < 2:", "- print(\"Impossible\")", "- sys.exit()", "-if cnt[mn] != mndx:", "- print(\"Impossible\")", "-else:", "- print(\"Possible\")", "+def main():", "+ n = getN()", "+ for _ in range(n):", "+ solve()", "+ return", "+", "+", "+if __name__ == \"__main__\":", "+ # main()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.200920903, "measured_runtime_v1": 0.0064778831, "runtime_lift": 31.0164448269, "key": ["s661300903", "s790648502"], "target_token_count_dream": 373, "target_token_bucket_dream": "256-512"} +{"user_id": "u990900604", "problem_id": "p02390", "language": "python", "submission_id_v0": "s359089221", "submission_id_v1": "s084524983", "cpu_time_v0": 50, "cpu_time_v1": 10, "memory_v0": 9852, "memory_v1": 4632, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.0, "input": "import sys\n\n\n\nif __name__ == '__main__':\n\n import doctest\n\n doctest.testmod()\n\n S = int(sys.stdin.read())\n\n h = S / 3600\n\n m = (S % 3600) / 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n", "target": "#!/usr/bin/env python\n\n#-*- coding: utf-8 -*-\n\n\n\n# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D\n\n\n\nif __name__ == '__main__':\n\n S = int(input())\n\n h = S / 3600\n\n m = (S % 3600) / 60\n\n s = S % 60\n\n print(\"%d:%d:%d\" % (h, m, s))\n", "code_v0_loc": 10, "code_v1_loc": 11, "code_v0_num_chars": 208, "code_v1_num_chars": 266, "code_v0_no_empty_lines": "import sys\n\nif __name__ == \"__main__\":\n import doctest\n\n doctest.testmod()\n S = int(sys.stdin.read())\n h = S / 3600\n m = (S % 3600) / 60\n s = S % 60\n print(\"%d:%d:%d\" % (h, m, s))\n", "code_v1_no_empty_lines": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D\nif __name__ == \"__main__\":\n S = int(input())\n h = S / 3600\n m = (S % 3600) / 60\n s = S % 60\n print(\"%d:%d:%d\" % (h, m, s))\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-import sys", "-", "+#!/usr/bin/env python", "+# -*- coding: utf-8 -*-", "+# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_D", "- import doctest", "-", "- doctest.testmod()", "- S = int(sys.stdin.read())", "+ S = int(input())"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7406475422, "measured_runtime_v1": 0.2172099149, "runtime_lift": 3.4098238217, "key": ["s359089221", "s084524983"], "target_token_count_dream": 108, "target_token_bucket_dream": "<128"} +{"user_id": "u780698286", "problem_id": "p02880", "language": "python", "submission_id_v0": "s530137772", "submission_id_v1": "s289678775", "cpu_time_v0": 31, "cpu_time_v1": 26, "memory_v0": 9160, "memory_v1": 9096, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.13, "input": "n = int(input())\n\ns = []\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n s.append(i*j)\n\nif n in s:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")", "target": "import sys\n\n\n\nn = int(input())\n\nfor i in range(1, 10):\n\n for j in range(1, 10):\n\n if i*j == n:\n\n print(\"Yes\")\n\n sys.exit()\n\nprint(\"No\")\n", "code_v0_loc": 9, "code_v1_loc": 9, "code_v0_num_chars": 143, "code_v1_num_chars": 150, "code_v0_no_empty_lines": "n = int(input())\ns = []\nfor i in range(1, 10):\n for j in range(1, 10):\n s.append(i * j)\nif n in s:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "code_v1_no_empty_lines": "import sys\n\nn = int(input())\nfor i in range(1, 10):\n for j in range(1, 10):\n if i * j == n:\n print(\"Yes\")\n sys.exit()\nprint(\"No\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+import sys", "+", "-s = []", "- s.append(i * j)", "-if n in s:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+ if i * j == n:", "+ print(\"Yes\")", "+ sys.exit()", "+print(\"No\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2618995297, "measured_runtime_v1": 0.0062340605, "runtime_lift": 42.0110661723, "key": ["s530137772", "s289678775"], "target_token_count_dream": 51, "target_token_bucket_dream": "<128"} +{"user_id": "u814986259", "problem_id": "p03796", "language": "python", "submission_id_v0": "s294020052", "submission_id_v1": "s579876547", "cpu_time_v0": 229, "cpu_time_v1": 40, "memory_v0": 3968, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.53, "input": "import math\n\nN=int(input())\n\nans=math.factorial(N)\n\nprint((ans%(10**9 +7)))", "target": "mod=10**9+7\n\nN=int(input())\n\nans=1\n\nfor i in range(1,N+1):\n\n ans*=i\n\n ans%=mod\n\nprint(ans)", "code_v0_loc": 4, "code_v1_loc": 7, "code_v0_num_chars": 73, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nans = math.factorial(N)\nprint((ans % (10**9 + 7)))\n", "code_v1_no_empty_lines": "mod = 10**9 + 7\nN = int(input())\nans = 1\nfor i in range(1, N + 1):\n ans *= i\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-import math", "-", "+mod = 10**9 + 7", "-ans = math.factorial(N)", "-print((ans % (10**9 + 7)))", "+ans = 1", "+for i in range(1, N + 1):", "+ ans *= i", "+ ans %= mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3063099709, "measured_runtime_v1": 0.2071282012, "runtime_lift": 1.4788424222, "key": ["s294020052", "s579876547"], "target_token_count_dream": 40, "target_token_bucket_dream": "<128"} +{"user_id": "u670180528", "problem_id": "p03634", "language": "python", "submission_id_v0": "s592706363", "submission_id_v1": "s081294326", "cpu_time_v0": 718, "cpu_time_v1": 476, "memory_v0": 63540, "memory_v1": 64180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.7, "input": "from collections import deque\n\nn,*t=list(map(int,open(0).read().split()))\n\ncon=[[] for _ in range(n)]\n\ndist_f_k=[0]*n\n\n\n\nfor a,b,c in zip(t[:3*n-3:3],t[1::3],t[2::3]):\n\n\tcon[a-1].append((b-1,c))\n\n\tcon[b-1].append((a-1,c))\n\n\n\nk=t[3*n-2]\n\nque=deque([k-1])\n\nwhile que:\n\n\tcur=que.popleft()\n\n\tfor nxt,dd in con[cur]:\n\n\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\tque.append(nxt)\n\n\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\nfor x,y in zip(t[3*n-1::2],t[3*n::2]):\n\n\tprint((dist_f_k[x-1]+dist_f_k[y-1]))", "target": "def solve():\n\n\tfrom collections import deque\n\n\tn,*t=list(map(int,open(0).read().split()))\n\n\tcon=[[] for _ in range(n)]\n\n\tdist_f_k=[0]*n\n\n\tl1,l2=t[:3*n-3],t[3*n-1:]\n\n\n\n\tfor a,b,c in zip(*[iter(l1)]*3):\n\n\t\tcon[a-1].append((b-1,c))\n\n\t\tcon[b-1].append((a-1,c))\n\n\n\n\tk=t[3*n-2]\n\n\tque=deque([k-1])\n\n\twhile que:\n\n\t\tcur=que.popleft()\n\n\t\tfor nxt,dd in con[cur]:\n\n\t\t\tif dist_f_k[nxt]==0 and nxt!=k-1:\n\n\t\t\t\tque.append(nxt)\n\n\t\t\t\tdist_f_k[nxt]=dist_f_k[cur]+dd\n\n\n\n\tfor x,y in zip(*[iter(l2)]*2):\n\n\t\tprint((dist_f_k[x-1]+dist_f_k[y-1]))\n\n\t\t\n\nif __name__==\"__main__\":\n\n\tsolve()", "code_v0_loc": 20, "code_v1_loc": 25, "code_v0_num_chars": 476, "code_v1_num_chars": 553, "code_v0_no_empty_lines": "from collections import deque\n\nn, *t = list(map(int, open(0).read().split()))\ncon = [[] for _ in range(n)]\ndist_f_k = [0] * n\nfor a, b, c in zip(t[: 3 * n - 3 : 3], t[1::3], t[2::3]):\n con[a - 1].append((b - 1, c))\n con[b - 1].append((a - 1, c))\nk = t[3 * n - 2]\nque = deque([k - 1])\nwhile que:\n cur = que.popleft()\n for nxt, dd in con[cur]:\n if dist_f_k[nxt] == 0 and nxt != k - 1:\n que.append(nxt)\n dist_f_k[nxt] = dist_f_k[cur] + dd\nfor x, y in zip(t[3 * n - 1 :: 2], t[3 * n :: 2]):\n print((dist_f_k[x - 1] + dist_f_k[y - 1]))\n", "code_v1_no_empty_lines": "def solve():\n from collections import deque\n\n n, *t = list(map(int, open(0).read().split()))\n con = [[] for _ in range(n)]\n dist_f_k = [0] * n\n l1, l2 = t[: 3 * n - 3], t[3 * n - 1 :]\n for a, b, c in zip(*[iter(l1)] * 3):\n con[a - 1].append((b - 1, c))\n con[b - 1].append((a - 1, c))\n k = t[3 * n - 2]\n que = deque([k - 1])\n while que:\n cur = que.popleft()\n for nxt, dd in con[cur]:\n if dist_f_k[nxt] == 0 and nxt != k - 1:\n que.append(nxt)\n dist_f_k[nxt] = dist_f_k[cur] + dd\n for x, y in zip(*[iter(l2)] * 2):\n print((dist_f_k[x - 1] + dist_f_k[y - 1]))\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-from collections import deque", "+def solve():", "+ from collections import deque", "-n, *t = list(map(int, open(0).read().split()))", "-con = [[] for _ in range(n)]", "-dist_f_k = [0] * n", "-for a, b, c in zip(t[: 3 * n - 3 : 3], t[1::3], t[2::3]):", "- con[a - 1].append((b - 1, c))", "- con[b - 1].append((a - 1, c))", "-k = t[3 * n - 2]", "-que = deque([k - 1])", "-while que:", "- cur = que.popleft()", "- for nxt, dd in con[cur]:", "- if dist_f_k[nxt] == 0 and nxt != k - 1:", "- que.append(nxt)", "- dist_f_k[nxt] = dist_f_k[cur] + dd", "-for x, y in zip(t[3 * n - 1 :: 2], t[3 * n :: 2]):", "- print((dist_f_k[x - 1] + dist_f_k[y - 1]))", "+ n, *t = list(map(int, open(0).read().split()))", "+ con = [[] for _ in range(n)]", "+ dist_f_k = [0] * n", "+ l1, l2 = t[: 3 * n - 3], t[3 * n - 1 :]", "+ for a, b, c in zip(*[iter(l1)] * 3):", "+ con[a - 1].append((b - 1, c))", "+ con[b - 1].append((a - 1, c))", "+ k = t[3 * n - 2]", "+ que = deque([k - 1])", "+ while que:", "+ cur = que.popleft()", "+ for nxt, dd in con[cur]:", "+ if dist_f_k[nxt] == 0 and nxt != k - 1:", "+ que.append(nxt)", "+ dist_f_k[nxt] = dist_f_k[cur] + dd", "+ for x, y in zip(*[iter(l2)] * 2):", "+ print((dist_f_k[x - 1] + dist_f_k[y - 1]))", "+", "+", "+if __name__ == \"__main__\":", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.331901531, "measured_runtime_v1": 0.2149364519, "runtime_lift": 1.5441844695, "key": ["s592706363", "s081294326"], "target_token_count_dream": 218, "target_token_bucket_dream": "128-256"} +{"user_id": "u724687935", "problem_id": "p02622", "language": "python", "submission_id_v0": "s346270661", "submission_id_v1": "s299240564", "cpu_time_v0": 67, "cpu_time_v1": 60, "memory_v0": 9408, "memory_v1": 9320, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.45, "input": "S = input()\n\nT = input()\n\nN = len(S)\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)\n", "target": "S = input()\n\nT = input()\n\ncnt = 0\n\nfor i in range(len(S)):\n\n cnt += (S[i] != T[i])\n\n\n\nprint(cnt)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 107, "code_v1_num_chars": 99, "code_v0_no_empty_lines": "S = input()\nT = input()\nN = len(S)\ncnt = 0\nfor i in range(N):\n cnt += S[i] != T[i]\nprint(cnt)\n", "code_v1_no_empty_lines": "S = input()\nT = input()\ncnt = 0\nfor i in range(len(S)):\n cnt += S[i] != T[i]\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-N = len(S)", "-for i in range(N):", "+for i in range(len(S)):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3924936354, "measured_runtime_v1": 0.2147260756, "runtime_lift": 1.8278806345, "key": ["s346270661", "s299240564"], "target_token_count_dream": 36, "target_token_bucket_dream": "<128"} +{"user_id": "u604774382", "problem_id": "p02264", "language": "python", "submission_id_v0": "s685908626", "submission_id_v1": "s418135932", "cpu_time_v0": 1410, "cpu_time_v1": 1260, "memory_v0": 17580, "memory_v1": 11516, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.64, "input": "n, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n\tps[i], t[i] = input( ).split( \" \" )\n\n\n\n\n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n\tpsi = ps.pop( 0 )\n\n\tti = int( t.pop( 0 ) )\n\n\tif ti <= q:\n\n\t\tqsum += ti\t\n\n\t\toutput.append( psi+\" \"+str( qsum ) )\n\n\telse:\n\n\t\tt.append( ti - q )\n\n\t\tps.append( psi )\n\n\t\tqsum += q\n\n\n\nprint(( \"\\n\".join( output ) ))", "target": "n, q = [ int( val ) for val in input( ).split( \" \" ) ]\n\nps = [0]*n\n\nt = [0]*n\n\nfor i in range( n ):\n\n ps[i], t[i] = input( ).split( \" \" )\n\n \n\n \n\noutput = []\n\nqsum = 0\n\nwhile t:\n\n psi = ps.pop( 0 )\n\n ti = int( t.pop( 0 ) )\n\n if ti <= q:\n\n qsum += ti\n\n output.append( \"\".join( ( psi, \" \", str( qsum ) ) ) )\n\n else:\n\n t.append( ti - q )\n\n ps.append( psi )\n\n qsum += q\n\n \n\nprint(( \"\\n\".join( output ) ))", "code_v0_loc": 21, "code_v1_loc": 21, "code_v0_num_chars": 383, "code_v1_num_chars": 455, "code_v0_no_empty_lines": "n, q = [int(val) for val in input().split(\" \")]\nps = [0] * n\nt = [0] * n\nfor i in range(n):\n ps[i], t[i] = input().split(\" \")\noutput = []\nqsum = 0\nwhile t:\n psi = ps.pop(0)\n ti = int(t.pop(0))\n if ti <= q:\n qsum += ti\n output.append(psi + \" \" + str(qsum))\n else:\n t.append(ti - q)\n ps.append(psi)\n qsum += q\nprint((\"\\n\".join(output)))\n", "code_v1_no_empty_lines": "n, q = [int(val) for val in input().split(\" \")]\nps = [0] * n\nt = [0] * n\nfor i in range(n):\n ps[i], t[i] = input().split(\" \")\noutput = []\nqsum = 0\nwhile t:\n psi = ps.pop(0)\n ti = int(t.pop(0))\n if ti <= q:\n qsum += ti\n output.append(\"\".join((psi, \" \", str(qsum))))\n else:\n t.append(ti - q)\n ps.append(psi)\n qsum += q\nprint((\"\\n\".join(output)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- output.append(psi + \" \" + str(qsum))", "+ output.append(\"\".join((psi, \" \", str(qsum))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2516228666, "measured_runtime_v1": 0.0710392208, "runtime_lift": 3.5420274002, "key": ["s685908626", "s418135932"], "target_token_count_dream": 159, "target_token_bucket_dream": "128-256"} +{"user_id": "u629538480", "problem_id": "p02688", "language": "python", "submission_id_v0": "s093466568", "submission_id_v1": "s996398988", "cpu_time_v0": 24, "cpu_time_v1": 21, "memory_v0": 9192, "memory_v1": 8948, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.5, "input": "N,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(input())\n\n b=input().split(' ')\n\n for j in range(count):\n\n if int(b[j]) in a:\n\n a.remove(int(b[j]))\n\nprint((len(a)))", "target": "N,K = list(map(int, input().split(' ')))\n\na=list(range(1,N+1))\n\nfor i in range(K):\n\n count=int(input())\n\n b=[int(x.strip()) for x in input().split(' ')]\n\n for j in range(count):\n\n if b[j] in a:\n\n a.remove(b[j])\n\nprint((len(a)))", "code_v0_loc": 9, "code_v1_loc": 9, "code_v0_num_chars": 214, "code_v1_num_chars": 230, "code_v0_no_empty_lines": "N, K = list(map(int, input().split(\" \")))\na = list(range(1, N + 1))\nfor i in range(K):\n count = int(input())\n b = input().split(\" \")\n for j in range(count):\n if int(b[j]) in a:\n a.remove(int(b[j]))\nprint((len(a)))\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split(\" \")))\na = list(range(1, N + 1))\nfor i in range(K):\n count = int(input())\n b = [int(x.strip()) for x in input().split(\" \")]\n for j in range(count):\n if b[j] in a:\n a.remove(b[j])\nprint((len(a)))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- b = input().split(\" \")", "+ b = [int(x.strip()) for x in input().split(\" \")]", "- if int(b[j]) in a:", "- a.remove(int(b[j]))", "+ if b[j] in a:", "+ a.remove(b[j])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2616522854, "measured_runtime_v1": 0.1381282375, "runtime_lift": 1.8942707889, "key": ["s093466568", "s996398988"], "target_token_count_dream": 75, "target_token_bucket_dream": "<128"} +{"user_id": "u780342333", "problem_id": "p02416", "language": "python", "submission_id_v0": "s248122741", "submission_id_v1": "s360997133", "cpu_time_v0": 30, "cpu_time_v1": 20, "memory_v0": 7732, "memory_v1": 5624, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "res = []\n\nwhile True:\n\n s = input()\n\n if s == '0':\n\n break\n\n\n\n res.append(sum([int(x) for x in s]))\n\n\n\nfor e in res:\n\n print(e)", "target": "def sum_of_numbers(n):\n\n '''\n\n (* int -> int *)\n\n '''\n\n res = [int(n) for n in list(str(n))]\n\n \n\n return sum(res)\n\n\n\nif __name__ == \"__main__\":\n\n while True:\n\n n = input()\n\n if n == '0':\n\n break\n\n print((sum_of_numbers(n)))\n", "code_v0_loc": 10, "code_v1_loc": 14, "code_v0_num_chars": 146, "code_v1_num_chars": 275, "code_v0_no_empty_lines": "res = []\nwhile True:\n s = input()\n if s == \"0\":\n break\n res.append(sum([int(x) for x in s]))\nfor e in res:\n print(e)\n", "code_v1_no_empty_lines": "def sum_of_numbers(n):\n \"\"\"\n (* int -> int *)\n \"\"\"\n res = [int(n) for n in list(str(n))]\n return sum(res)\n\n\nif __name__ == \"__main__\":\n while True:\n n = input()\n if n == \"0\":\n break\n print((sum_of_numbers(n)))\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-res = []", "-while True:", "- s = input()", "- if s == \"0\":", "- break", "- res.append(sum([int(x) for x in s]))", "-for e in res:", "- print(e)", "+def sum_of_numbers(n):", "+ \"\"\"", "+ (* int -> int *)", "+ \"\"\"", "+ res = [int(n) for n in list(str(n))]", "+ return sum(res)", "+", "+", "+if __name__ == \"__main__\":", "+ while True:", "+ n = input()", "+ if n == \"0\":", "+ break", "+ print((sum_of_numbers(n)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2668570542, "measured_runtime_v1": 0.0949980106, "runtime_lift": 2.8090804473, "key": ["s248122741", "s360997133"], "target_token_count_dream": 73, "target_token_bucket_dream": "<128"} +{"user_id": "u729133443", "problem_id": "p03086", "language": "python", "submission_id_v0": "s780520490", "submission_id_v1": "s016683067", "cpu_time_v0": 19, "cpu_time_v1": 17, "memory_v0": 3188, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.53, "input": "import re;print((max(list(map(len,re.split('[^ACGT]',input()))))))", "target": "p=m=0\n\nfor c in input():p=-~p*(c in'ATGC');m=max(m,p)\n\nprint(m)", "code_v0_loc": 1, "code_v1_loc": 3, "code_v0_num_chars": 58, "code_v1_num_chars": 63, "code_v0_no_empty_lines": "import re\n\nprint((max(list(map(len, re.split(\"[^ACGT]\", input()))))))\n", "code_v1_no_empty_lines": "p = m = 0\nfor c in input():\n p = -~p * (c in \"ATGC\")\n m = max(m, p)\nprint(m)\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import re", "-", "-print((max(list(map(len, re.split(\"[^ACGT]\", input()))))))", "+p = m = 0", "+for c in input():", "+ p = -~p * (c in \"ATGC\")", "+ m = max(m, p)", "+print(m)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2963340635, "measured_runtime_v1": 0.1579363909, "runtime_lift": 1.8762874209, "key": ["s780520490", "s016683067"], "target_token_count_dream": 29, "target_token_bucket_dream": "<128"} +{"user_id": "u654470292", "problem_id": "p03828", "language": "python", "submission_id_v0": "s594973511", "submission_id_v1": "s914422541", "cpu_time_v0": 386, "cpu_time_v1": 305, "memory_v0": 54360, "memory_v1": 67304, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.98, "input": "import math\n\nn=int(input())\n\nwaru=10**9+7\n\n\n\nli=[]\n\nli2=[]\n\n\n\nfor i in range(2,n+1):\n\n tmp=math.factorial(n)\n\n flag=1\n\n for j in range(len(li)):\n\n if i%li[j]==0:\n\n flag=0\n\n break\n\n if flag==1:\n\n li.append(i)\n\n li2.append(0)\n\n while tmp%i==0:\n\n li2[len(li)-1]+=1\n\n tmp=tmp//i\n\nans=1\n\n# print(li)\n\n# print(li2)\n\nfor i in range(len(li2)):\n\n ans*=li2[i]+1\n\nprint((ans%waru))", "target": "import sys\n\nfrom collections import *\n\nimport heapq\n\nimport math\n\nimport bisect\n\nfrom itertools import permutations,accumulate,combinations,product\n\nfrom math import gcd\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\ndef ruiseki(lst):\n\n return [0]+list(accumulate(lst))\n\nmod=pow(10,9)+7\n\nal=[chr(ord('a') + i) for i in range(26)]\n\n\n\ndef factorization(n):\n\n arr = []\n\n temp = n\n\n for i in range(2, int(-(-n**0.5//1))+1):\n\n if temp%i==0:\n\n cnt=0\n\n while temp%i==0:\n\n cnt+=1\n\n temp //= i\n\n arr.append([i, cnt])\n\n if temp!=1:\n\n arr.append([temp, 1])\n\n if arr==[]:\n\n arr.append([n, 1])\n\n return arr\n\n\n\nn=int(input())\n\nif n==1:\n\n print((1))\n\n exit()\n\nd=defaultdict(int)\n\nfor i in range(2,n+1):\n\n tmp=factorization(i)\n\n for j in tmp:\n\n yaku,ko=j\n\n d[yaku]+=ko\n\n# print(d)\n\nans=1\n\nfor i in list(d.values()):\n\n ans*=i+1\n\n ans%=mod\n\nprint(ans)", "code_v0_loc": 26, "code_v1_loc": 46, "code_v0_num_chars": 455, "code_v1_num_chars": 973, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nwaru = 10**9 + 7\nli = []\nli2 = []\nfor i in range(2, n + 1):\n tmp = math.factorial(n)\n flag = 1\n for j in range(len(li)):\n if i % li[j] == 0:\n flag = 0\n break\n if flag == 1:\n li.append(i)\n li2.append(0)\n while tmp % i == 0:\n li2[len(li) - 1] += 1\n tmp = tmp // i\nans = 1\n# print(li)\n# print(li2)\nfor i in range(len(li2)):\n ans *= li2[i] + 1\nprint((ans % waru))\n", "code_v1_no_empty_lines": "import sys\nfrom collections import *\nimport heapq\nimport math\nimport bisect\nfrom itertools import permutations, accumulate, combinations, product\nfrom math import gcd\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\ndef ruiseki(lst):\n return [0] + list(accumulate(lst))\n\n\nmod = pow(10, 9) + 7\nal = [chr(ord(\"a\") + i) for i in range(26)]\n\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-(n**0.5) // 1)) + 1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append([i, cnt])\n if temp != 1:\n arr.append([temp, 1])\n if arr == []:\n arr.append([n, 1])\n return arr\n\n\nn = int(input())\nif n == 1:\n print((1))\n exit()\nd = defaultdict(int)\nfor i in range(2, n + 1):\n tmp = factorization(i)\n for j in tmp:\n yaku, ko = j\n d[yaku] += ko\n# print(d)\nans = 1\nfor i in list(d.values()):\n ans *= i + 1\n ans %= mod\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 43.4782608696, "diff": ["+import sys", "+from collections import *", "+import heapq", "+import bisect", "+from itertools import permutations, accumulate, combinations, product", "+from math import gcd", "+", "+", "+def input():", "+ return sys.stdin.readline()[:-1]", "+", "+", "+def ruiseki(lst):", "+ return [0] + list(accumulate(lst))", "+", "+", "+mod = pow(10, 9) + 7", "+al = [chr(ord(\"a\") + i) for i in range(26)]", "+", "+", "+def factorization(n):", "+ arr = []", "+ temp = n", "+ for i in range(2, int(-(-(n**0.5) // 1)) + 1):", "+ if temp % i == 0:", "+ cnt = 0", "+ while temp % i == 0:", "+ cnt += 1", "+ temp //= i", "+ arr.append([i, cnt])", "+ if temp != 1:", "+ arr.append([temp, 1])", "+ if arr == []:", "+ arr.append([n, 1])", "+ return arr", "+", "-waru = 10**9 + 7", "-li = []", "-li2 = []", "+if n == 1:", "+ print((1))", "+ exit()", "+d = defaultdict(int)", "- tmp = math.factorial(n)", "- flag = 1", "- for j in range(len(li)):", "- if i % li[j] == 0:", "- flag = 0", "- break", "- if flag == 1:", "- li.append(i)", "- li2.append(0)", "- while tmp % i == 0:", "- li2[len(li) - 1] += 1", "- tmp = tmp // i", "+ tmp = factorization(i)", "+ for j in tmp:", "+ yaku, ko = j", "+ d[yaku] += ko", "+# print(d)", "-# print(li)", "-# print(li2)", "-for i in range(len(li2)):", "- ans *= li2[i] + 1", "-print((ans % waru))", "+for i in list(d.values()):", "+ ans *= i + 1", "+ ans %= mod", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4593854201, "measured_runtime_v1": 0.0895126674, "runtime_lift": 5.1320716194, "key": ["s594973511", "s914422541"], "target_token_count_dream": 288, "target_token_bucket_dream": "256-512"} +{"user_id": "u513081876", "problem_id": "p03325", "language": "python", "submission_id_v0": "s352799823", "submission_id_v1": "s651648403", "cpu_time_v0": 118, "cpu_time_v1": 82, "memory_v0": 4148, "memory_v1": 4148, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.51, "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nans = 0\n\ncheck = [0]*30\n\nfor i in range(1, 31):\n\n check[i-1] = 2**i\n\n\n\nfor i in A:\n\n if i % 2 == 0:\n\n j = 0\n\n while check[j] <= i:\n\n if i % check[j] == 0:\n\n add = check[j]\n\n else:\n\n break\n\n \n\n j += 1\n\n ans += j\n\n \n\nprint(ans)", "target": "N = int(input())\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in a:\n\n while i % 2 == 0:\n\n i //= 2\n\n ans += 1\n\nprint(ans)", "code_v0_loc": 20, "code_v1_loc": 9, "code_v0_num_chars": 394, "code_v1_num_chars": 149, "code_v0_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nans = 0\ncheck = [0] * 30\nfor i in range(1, 31):\n check[i - 1] = 2**i\nfor i in A:\n if i % 2 == 0:\n j = 0\n while check[j] <= i:\n if i % check[j] == 0:\n add = check[j]\n else:\n break\n j += 1\n ans += j\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\na = [int(i) for i in input().split()]\nans = 0\nfor i in a:\n while i % 2 == 0:\n i //= 2\n ans += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 55.0, "diff": ["-A = [int(i) for i in input().split()]", "+a = [int(i) for i in input().split()]", "-check = [0] * 30", "-for i in range(1, 31):", "- check[i - 1] = 2**i", "-for i in A:", "- if i % 2 == 0:", "- j = 0", "- while check[j] <= i:", "- if i % check[j] == 0:", "- add = check[j]", "- else:", "- break", "- j += 1", "- ans += j", "+for i in a:", "+ while i % 2 == 0:", "+ i //= 2", "+ ans += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3522037606, "measured_runtime_v1": 0.279608284, "runtime_lift": 1.2596327819, "key": ["s352799823", "s651648403"], "target_token_count_dream": 53, "target_token_bucket_dream": "<128"} +{"user_id": "u513081876", "problem_id": "p03845", "language": "python", "submission_id_v0": "s710663686", "submission_id_v1": "s021252857", "cpu_time_v0": 28, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.29, "input": "N = int(input())\n\nT = list(map(int, input().split()))\n\nM = int(input())\n\np = []\n\nx = []\n\nans = []\n\nfor i in range(M):\n\n p, x = list(map(int, input().split()))\n\n ans.append(sum(T[:p-1])+x+sum(T[p:]))\n\n\n\nfor _ in ans:\n\n print(_)", "target": "N = int(input())\n\nT = list(map(int, input().split()))\n\nM = int(input())\n\nP, X, ans = [0]*M, [0]*M, []\n\nbase = sum(T)\n\n\n\nfor i in range(M):\n\n P, X = list(map(int, input().split()))\n\n ans.append(base-T[P-1]+X)\n\n\n\nfor i in ans:\n\n print(i)", "code_v0_loc": 12, "code_v1_loc": 12, "code_v0_num_chars": 229, "code_v1_num_chars": 238, "code_v0_no_empty_lines": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\np = []\nx = []\nans = []\nfor i in range(M):\n p, x = list(map(int, input().split()))\n ans.append(sum(T[: p - 1]) + x + sum(T[p:]))\nfor _ in ans:\n print(_)\n", "code_v1_no_empty_lines": "N = int(input())\nT = list(map(int, input().split()))\nM = int(input())\nP, X, ans = [0] * M, [0] * M, []\nbase = sum(T)\nfor i in range(M):\n P, X = list(map(int, input().split()))\n ans.append(base - T[P - 1] + X)\nfor i in ans:\n print(i)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-p = []", "-x = []", "-ans = []", "+P, X, ans = [0] * M, [0] * M, []", "+base = sum(T)", "- p, x = list(map(int, input().split()))", "- ans.append(sum(T[: p - 1]) + x + sum(T[p:]))", "-for _ in ans:", "- print(_)", "+ P, X = list(map(int, input().split()))", "+ ans.append(base - T[P - 1] + X)", "+for i in ans:", "+ print(i)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2214040067, "measured_runtime_v1": 0.1726463588, "runtime_lift": 1.2824134157, "key": ["s710663686", "s021252857"], "target_token_count_dream": 81, "target_token_bucket_dream": "<128"} +{"user_id": "u581603131", "problem_id": "p03796", "language": "python", "submission_id_v0": "s669812244", "submission_id_v1": "s638032890", "cpu_time_v0": 230, "cpu_time_v1": 41, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.17, "input": "import math\n\nN = int(input())\n\nprint((math.factorial(N)%(10**9+7)))", "target": "ans=1\n\nn=int(input())\n\nfor i in range(1,n+1):\n\n ans*=i\n\n ans=ans%(10**9+7)\n\nprint(ans)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 65, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "import math\n\nN = int(input())\nprint((math.factorial(N) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "ans = 1\nn = int(input())\nfor i in range(1, n + 1):\n ans *= i\n ans = ans % (10**9 + 7)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-N = int(input())", "-print((math.factorial(N) % (10**9 + 7)))", "+ans = 1", "+n = int(input())", "+for i in range(1, n + 1):", "+ ans *= i", "+ ans = ans % (10**9 + 7)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8658925366, "measured_runtime_v1": 0.3537542467, "runtime_lift": 2.4477233692, "key": ["s669812244", "s638032890"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u197300773", "problem_id": "p02901", "language": "python", "submission_id_v0": "s172477662", "submission_id_v1": "s096488733", "cpu_time_v0": 1463, "cpu_time_v1": 1316, "memory_v0": 36468, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.05, "input": "def main():\n\n import math\n\n N,M=list(map(int,input().split()))\n\n a=[]\n\n for i in range(M):\n\n tmp=list(map(int,input().split()))\n\n tmpc=list(map(int,input().split()))\n\n c=0\n\n for j in range(len(tmpc)):\n\n c+=2**(tmpc[j]-1)\n\n tmp[1]=c\n\n a+=[tmp]\n\n\n\n\n\n dp=[[10**10 for j in range(2**N)] for i in range(M)]\n\n dp[0][0]=0\n\n dp[0][a[0][1]]=a[0][0]\n\n\n\n\n\n for i in range(1,M):\n\n dp[i]=dp[i-1]\n\n for j in range(2**N):\n\n z,p=a[i][0],a[i][1]\n\n q=j|p\n\n x=dp[i-1][j]+z\n\n if dp[i][q]>x: dp[i][q]=x\n\n\n\n ans=dp[M-1][2**N-1]\n\n print((ans if ans<10**10 else -1))\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "n,m=list(map(int,input().split()))\n\nL=2**n\n\ncost=[0]+[10**8 for i in range(L-1)]\n\n\n\nfor i in range(m):\n\n a,b=list(map(int,input().split()))\n\n c=sum([2**(int(i)-1) for i in input().split()])\n\n for j in range(L):\n\n q=j|c\n\n x=cost[j]+a\n\n if cost[q]>x:\n\n cost[q]=x\n\nprint((cost[L-1] if cost[L-1]<10**8 else -1))", "code_v0_loc": 32, "code_v1_loc": 13, "code_v0_num_chars": 718, "code_v1_num_chars": 334, "code_v0_no_empty_lines": "def main():\n import math\n\n N, M = list(map(int, input().split()))\n a = []\n for i in range(M):\n tmp = list(map(int, input().split()))\n tmpc = list(map(int, input().split()))\n c = 0\n for j in range(len(tmpc)):\n c += 2 ** (tmpc[j] - 1)\n tmp[1] = c\n a += [tmp]\n dp = [[10**10 for j in range(2**N)] for i in range(M)]\n dp[0][0] = 0\n dp[0][a[0][1]] = a[0][0]\n for i in range(1, M):\n dp[i] = dp[i - 1]\n for j in range(2**N):\n z, p = a[i][0], a[i][1]\n q = j | p\n x = dp[i - 1][j] + z\n if dp[i][q] > x:\n dp[i][q] = x\n ans = dp[M - 1][2**N - 1]\n print((ans if ans < 10**10 else -1))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "n, m = list(map(int, input().split()))\nL = 2**n\ncost = [0] + [10**8 for i in range(L - 1)]\nfor i in range(m):\n a, b = list(map(int, input().split()))\n c = sum([2 ** (int(i) - 1) for i in input().split()])\n for j in range(L):\n q = j | c\n x = cost[j] + a\n if cost[q] > x:\n cost[q] = x\nprint((cost[L - 1] if cost[L - 1] < 10**8 else -1))\n", "code_same": false, "relative_loc_diff_percent": 59.375, "diff": ["-def main():", "- import math", "-", "- N, M = list(map(int, input().split()))", "- a = []", "- for i in range(M):", "- tmp = list(map(int, input().split()))", "- tmpc = list(map(int, input().split()))", "- c = 0", "- for j in range(len(tmpc)):", "- c += 2 ** (tmpc[j] - 1)", "- tmp[1] = c", "- a += [tmp]", "- dp = [[10**10 for j in range(2**N)] for i in range(M)]", "- dp[0][0] = 0", "- dp[0][a[0][1]] = a[0][0]", "- for i in range(1, M):", "- dp[i] = dp[i - 1]", "- for j in range(2**N):", "- z, p = a[i][0], a[i][1]", "- q = j | p", "- x = dp[i - 1][j] + z", "- if dp[i][q] > x:", "- dp[i][q] = x", "- ans = dp[M - 1][2**N - 1]", "- print((ans if ans < 10**10 else -1))", "-", "-", "-if __name__ == \"__main__\":", "- main()", "+n, m = list(map(int, input().split()))", "+L = 2**n", "+cost = [0] + [10**8 for i in range(L - 1)]", "+for i in range(m):", "+ a, b = list(map(int, input().split()))", "+ c = sum([2 ** (int(i) - 1) for i in input().split()])", "+ for j in range(L):", "+ q = j | c", "+ x = cost[j] + a", "+ if cost[q] > x:", "+ cost[q] = x", "+print((cost[L - 1] if cost[L - 1] < 10**8 else -1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3366471643, "measured_runtime_v1": 0.2183672116, "runtime_lift": 1.5416561941, "key": ["s172477662", "s096488733"], "target_token_count_dream": 123, "target_token_bucket_dream": "<128"} +{"user_id": "u829796346", "problem_id": "p02574", "language": "python", "submission_id_v0": "s911286307", "submission_id_v1": "s843819881", "cpu_time_v0": 997, "cpu_time_v1": 462, "memory_v0": 203940, "memory_v1": 203640, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 53.66, "input": "#!/usr/bin/env pypy3\n\n# N,M = map(int,sys.stdin.readline().split())\n\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n\n# s = sys.stdin.readline().rstrip()\n\n# N = int(sys.stdin.readline())\n\n# INF = float(\"inf\")\n\nimport math,sys\n\n\n\nn = int(sys.stdin.readline())\n\na = tuple(map(int,sys.stdin.readline().split()))\n\n#n = int(input())\n\n#a = list(map(int,input().split()))\n\ng = math.gcd(a[0],a[1])\n\nfor i in range(2,n):\n\n g = math.gcd(g,a[i])\n\nM = max(a)\n\nacc = a[0]\n\nfor i in range(n):\n\n acc = math.gcd(acc,a[i])\n\nif acc != 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nLIMIT=max(a)\n\nminPrime = [0]*(LIMIT+1)\n\nminPrime[1] = 1\n\ndef make():\n\n for i in range(2,LIMIT+1):\n\n if minPrime[i] == 0:\n\n minPrime[i] = i\n\n #print(i)\n\n for j in range(i+i,LIMIT+1,i):\n\n #print(i,j)\n\n if minPrime[j] == 0:\n\n minPrime[j] = i\n\nmake()\n\ndef factrial(N):\n\n ret = []\n\n while minPrime[N] != N:\n\n ret.append(minPrime[N])\n\n N = N//minPrime[N]\n\n if N != 1:\n\n ret.append(N)\n\n return ret\n\n\n\njudge = set([])\n\npc = True\n\n\n\npairwise = True\n\np = set() #all prime\n\n\n\nfor e in a:\n\n if not pairwise:\n\n break\n\n asf = set(factrial(e))\n\n if judge & asf != set():\n\n pc = False\n\n # #pairwise = False\n\n # print(\"setwise coprime\")\n\n # exit(0)\n\n judge |= asf\n\n# for i in a:\n\n# if not pc:\n\n# break\n\n# asf = set(factrial(i))\n\n\n\n# if judge & asf != set():\n\n# pc = False\n\n# judge |= asf\n\nif pc:\n\n print(\"pairwise coprime\")\n\nelif g == 1:\n\n print(\"setwise coprime\")\n\nelse:\n\n print(\"not coprime\")\n", "target": "#!/usr/bin/env pypy3\n\n# N,M = map(int,sys.stdin.readline().split())\n\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n\n# s = sys.stdin.readline().rstrip()\n\n# N = int(sys.stdin.readline())\n\n# INF = float(\"inf\")\n\nimport math,sys\n\n\n\nn = int(sys.stdin.readline())\n\na = tuple(map(int,sys.stdin.readline().split()))\n\n#n = int(input())\n\n#a = list(map(int,input().split()))\n\ng = math.gcd(a[0],a[1])\n\nfor i in range(2,n):\n\n g = math.gcd(g,a[i])\n\nM = max(a)\n\nacc = a[0]\n\nfor i in range(n):\n\n acc = math.gcd(acc,a[i])\n\nif acc != 1:\n\n print(\"not coprime\")\n\n exit()\n\n\n\nLIMIT=max(a)\n\nminPrime = [0]*(LIMIT+1)\n\nminPrime[1] = 1\n\ndef make():\n\n for i in range(2,LIMIT+1):\n\n if minPrime[i] == 0:\n\n minPrime[i] = i\n\n #print(i)\n\n for j in range(i+i,LIMIT+1,i):\n\n #print(i,j)\n\n if minPrime[j] == 0:\n\n minPrime[j] = i\n\nmake()\n\ndef factrial(N):\n\n ret = []\n\n while minPrime[N] != N:\n\n ret.append(minPrime[N])\n\n N = N//minPrime[N]\n\n if N != 1:\n\n ret.append(N)\n\n return ret\n\n\n\njudge = set([])\n\n\n\nfor e in a:\n\n asf = set(factrial(e))\n\n if judge & asf != set():\n\n print(\"setwise coprime\")\n\n exit()\n\n judge |= asf\n\n #judge = judge | asf #too slow\n\nprint(\"pairwise coprime\")\n", "code_v0_loc": 77, "code_v1_loc": 57, "code_v0_num_chars": 1904, "code_v1_num_chars": 1552, "code_v0_no_empty_lines": "#!/usr/bin/env pypy3\n# N,M = map(int,sys.stdin.readline().split())\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n# s = sys.stdin.readline().rstrip()\n# N = int(sys.stdin.readline())\n# INF = float(\"inf\")\nimport math, sys\n\nn = int(sys.stdin.readline())\na = tuple(map(int, sys.stdin.readline().split()))\n# n = int(input())\n# a = list(map(int,input().split()))\ng = math.gcd(a[0], a[1])\nfor i in range(2, n):\n g = math.gcd(g, a[i])\nM = max(a)\nacc = a[0]\nfor i in range(n):\n acc = math.gcd(acc, a[i])\nif acc != 1:\n print(\"not coprime\")\n exit()\nLIMIT = max(a)\nminPrime = [0] * (LIMIT + 1)\nminPrime[1] = 1\n\n\ndef make():\n for i in range(2, LIMIT + 1):\n if minPrime[i] == 0:\n minPrime[i] = i\n # print(i)\n for j in range(i + i, LIMIT + 1, i):\n # print(i,j)\n if minPrime[j] == 0:\n minPrime[j] = i\n\n\nmake()\n\n\ndef factrial(N):\n ret = []\n while minPrime[N] != N:\n ret.append(minPrime[N])\n N = N // minPrime[N]\n if N != 1:\n ret.append(N)\n return ret\n\n\njudge = set([])\npc = True\npairwise = True\np = set() # all prime\nfor e in a:\n if not pairwise:\n break\n asf = set(factrial(e))\n if judge & asf != set():\n pc = False\n # #pairwise = False\n # print(\"setwise coprime\")\n # exit(0)\n judge |= asf\n# for i in a:\n# if not pc:\n# break\n# asf = set(factrial(i))\n# if judge & asf != set():\n# pc = False\n# judge |= asf\nif pc:\n print(\"pairwise coprime\")\nelif g == 1:\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n", "code_v1_no_empty_lines": "#!/usr/bin/env pypy3\n# N,M = map(int,sys.stdin.readline().split())\n# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param\n# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param\n# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param\n# s = sys.stdin.readline().rstrip()\n# N = int(sys.stdin.readline())\n# INF = float(\"inf\")\nimport math, sys\n\nn = int(sys.stdin.readline())\na = tuple(map(int, sys.stdin.readline().split()))\n# n = int(input())\n# a = list(map(int,input().split()))\ng = math.gcd(a[0], a[1])\nfor i in range(2, n):\n g = math.gcd(g, a[i])\nM = max(a)\nacc = a[0]\nfor i in range(n):\n acc = math.gcd(acc, a[i])\nif acc != 1:\n print(\"not coprime\")\n exit()\nLIMIT = max(a)\nminPrime = [0] * (LIMIT + 1)\nminPrime[1] = 1\n\n\ndef make():\n for i in range(2, LIMIT + 1):\n if minPrime[i] == 0:\n minPrime[i] = i\n # print(i)\n for j in range(i + i, LIMIT + 1, i):\n # print(i,j)\n if minPrime[j] == 0:\n minPrime[j] = i\n\n\nmake()\n\n\ndef factrial(N):\n ret = []\n while minPrime[N] != N:\n ret.append(minPrime[N])\n N = N // minPrime[N]\n if N != 1:\n ret.append(N)\n return ret\n\n\njudge = set([])\nfor e in a:\n asf = set(factrial(e))\n if judge & asf != set():\n print(\"setwise coprime\")\n exit()\n judge |= asf\n # judge = judge | asf #too slow\nprint(\"pairwise coprime\")\n", "code_same": false, "relative_loc_diff_percent": 25.974025974, "diff": ["-pc = True", "-pairwise = True", "-p = set() # all prime", "- if not pairwise:", "- break", "- pc = False", "- # #pairwise = False", "- # print(\"setwise coprime\")", "- # exit(0)", "+ print(\"setwise coprime\")", "+ exit()", "-# for i in a:", "-# if not pc:", "-# break", "-# asf = set(factrial(i))", "-# if judge & asf != set():", "-# pc = False", "-# judge |= asf", "-if pc:", "- print(\"pairwise coprime\")", "-elif g == 1:", "- print(\"setwise coprime\")", "-else:", "- print(\"not coprime\")", "+ # judge = judge | asf #too slow", "+print(\"pairwise coprime\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1574707303, "measured_runtime_v1": 0.0059050472, "runtime_lift": 26.6671417322, "key": ["s911286307", "s843819881"], "target_token_count_dream": 447, "target_token_bucket_dream": "256-512"} +{"user_id": "u987846648", "problem_id": "p02627", "language": "python", "submission_id_v0": "s793826721", "submission_id_v1": "s875451520", "cpu_time_v0": 75, "cpu_time_v1": 67, "memory_v0": 61796, "memory_v1": 61608, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.67, "input": "alph = input()\n\nif alph.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")\n", "target": "a = input()\n\n\n\nif a.isupper():\n\n print(\"A\")\n\nelse:\n\n print(\"a\")", "code_v0_loc": 5, "code_v1_loc": 6, "code_v0_num_chars": 74, "code_v1_num_chars": 69, "code_v0_no_empty_lines": "alph = input()\nif alph.isupper():\n print(\"A\")\nelse:\n print(\"a\")\n", "code_v1_no_empty_lines": "a = input()\nif a.isupper():\n print(\"A\")\nelse:\n print(\"a\")\n", "code_same": false, "relative_loc_diff_percent": 16.6666666667, "diff": ["-alph = input()", "-if alph.isupper():", "+a = input()", "+if a.isupper():"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1834881261, "measured_runtime_v1": 0.0064039894, "runtime_lift": 28.6521595413, "key": ["s793826721", "s875451520"], "target_token_count_dream": 21, "target_token_bucket_dream": "<128"} +{"user_id": "u816872429", "problem_id": "p03039", "language": "python", "submission_id_v0": "s871362008", "submission_id_v1": "s362897835", "cpu_time_v0": 1991, "cpu_time_v1": 98, "memory_v0": 18912, "memory_v1": 11052, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 95.08, "input": "n, m, k = list(map(int, input().split()))\n\n\n\nmod = 1000000007\n\ndef pow(x, n):\n\n ret = 1\n\n while n > 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\nfac = [1]\n\ninv = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n inv.append(pow(fac[i], mod - 2))\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\n\ndef doit(n, m, k):\n\n ret = 0\n\n for d in range(m):\n\n ret = (ret + d * (m - d)) % mod\n\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))", "target": "n, m, k = list(map(int, input().split()))\n\n\n\nmod = 1000000007\n\nfac = [1]\n\nfor i in range(1, n * m + 1):\n\n fac.append((fac[-1] * i) % mod)\n\n\n\ndef pow(x, n):\n\n ret = 1\n\n while n > 0:\n\n if (n & 1) == 1:\n\n ret = (ret * x) % mod\n\n x = (x * x) % mod\n\n n >>= 1\n\n return ret\n\n\n\ndef inv(i):\n\n return pow(fac[i], mod - 2)\n\n\n\ndef cmb(n, k):\n\n return (fac[n] * inv(k) * inv(n - k)) % mod\n\n\n\nx = sum(d * (m - d) for d in range(m)) % mod\n\ny = sum(d * (n - d) for d in range(n)) % mod\n\n\n\nc = cmb(n * m - 2, k - 2)\n\nx = (x * n * n * c) % mod\n\ny = (y * m * m * c) % mod\n\n\n\nprint(((x + y) % mod))", "code_v0_loc": 28, "code_v1_loc": 30, "code_v0_num_chars": 624, "code_v1_num_chars": 620, "code_v0_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 1000000007\n\n\ndef pow(x, n):\n ret = 1\n while n > 0:\n if (n & 1) == 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n n >>= 1\n return ret\n\n\nfac = [1]\ninv = [1]\nfor i in range(1, n * m + 1):\n fac.append((fac[-1] * i) % mod)\n inv.append(pow(fac[i], mod - 2))\n\n\ndef cmb(n, k):\n return (fac[n] * inv[k] * inv[n - k]) % mod\n\n\ndef doit(n, m, k):\n ret = 0\n for d in range(m):\n ret = (ret + d * (m - d)) % mod\n return (ret * n * n * cmb(n * m - 2, k - 2)) % mod\n\n\nprint(((doit(n, m, k) + doit(m, n, k)) % mod))\n", "code_v1_no_empty_lines": "n, m, k = list(map(int, input().split()))\nmod = 1000000007\nfac = [1]\nfor i in range(1, n * m + 1):\n fac.append((fac[-1] * i) % mod)\n\n\ndef pow(x, n):\n ret = 1\n while n > 0:\n if (n & 1) == 1:\n ret = (ret * x) % mod\n x = (x * x) % mod\n n >>= 1\n return ret\n\n\ndef inv(i):\n return pow(fac[i], mod - 2)\n\n\ndef cmb(n, k):\n return (fac[n] * inv(k) * inv(n - k)) % mod\n\n\nx = sum(d * (m - d) for d in range(m)) % mod\ny = sum(d * (n - d) for d in range(n)) % mod\nc = cmb(n * m - 2, k - 2)\nx = (x * n * n * c) % mod\ny = (y * m * m * c) % mod\nprint(((x + y) % mod))\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["+fac = [1]", "+for i in range(1, n * m + 1):", "+ fac.append((fac[-1] * i) % mod)", "-fac = [1]", "-inv = [1]", "-for i in range(1, n * m + 1):", "- fac.append((fac[-1] * i) % mod)", "- inv.append(pow(fac[i], mod - 2))", "+def inv(i):", "+ return pow(fac[i], mod - 2)", "- return (fac[n] * inv[k] * inv[n - k]) % mod", "+ return (fac[n] * inv(k) * inv(n - k)) % mod", "-def doit(n, m, k):", "- ret = 0", "- for d in range(m):", "- ret = (ret + d * (m - d)) % mod", "- return (ret * n * n * cmb(n * m - 2, k - 2)) % mod", "-", "-", "-print(((doit(n, m, k) + doit(m, n, k)) % mod))", "+x = sum(d * (m - d) for d in range(m)) % mod", "+y = sum(d * (n - d) for d in range(n)) % mod", "+c = cmb(n * m - 2, k - 2)", "+x = (x * n * n * c) % mod", "+y = (y * m * m * c) % mod", "+print(((x + y) % mod))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7987827396, "measured_runtime_v1": 0.3213389852, "runtime_lift": 2.4857946791, "key": ["s871362008", "s362897835"], "target_token_count_dream": 256, "target_token_bucket_dream": "256-512"} +{"user_id": "u806976856", "problem_id": "p02555", "language": "python", "submission_id_v0": "s550500681", "submission_id_v1": "s439989437", "cpu_time_v0": 123, "cpu_time_v1": 70, "memory_v0": 9160, "memory_v1": 64844, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 43.09, "input": "s=int(input())\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s//3\n\nans=0\n\ndef f(n,k,p):\n\n if k==0:\n\n return 1\n\n elif k%2==0:\n\n return (f(n,k//2,p)**2)%p\n\n else:\n\n return (n*f(n,k-1,p))%p\n\n\n\nfor k in range(1,n+1):\n\n a=1\n\n b=1\n\n for j in range(k-1):\n\n a=(a*(s-3*k+1+j))%p\n\n b=(b*(j+1))%p\n\n ans=(ans+a*f(b,p-2,p))%p\n\n\n\nprint((ans%p))\n\n\n", "target": "s=int(input())\n\np=10**9+7\n\nif s<=2:\n\n print((0))\n\n exit()\n\nn=s//3\n\nans=0\n\nx=[0]*(s+1)\n\nx[0]=1\n\nx[1]=1\n\ny=[0]*(s+1)\n\n\n\nfor i in range(2,s+1):\n\n x[i]=x[i-1]*i%p\n\n\n\ny[s]=pow(x[s],p-2,p)\n\nfor i in range(s):\n\n y[s-1-i]=y[s-i]*(s-i)%p\n\n\n\nfor k in range(1,n+1):\n\n ans+=x[s-2*k-1]*y[k-1]*y[s-3*k]%p\n\n\n\nprint((ans%p))\n\n\n", "code_v0_loc": 25, "code_v1_loc": 24, "code_v0_num_chars": 391, "code_v1_num_chars": 322, "code_v0_no_empty_lines": "s = int(input())\np = 10**9 + 7\nif s <= 2:\n print((0))\n exit()\nn = s // 3\nans = 0\n\n\ndef f(n, k, p):\n if k == 0:\n return 1\n elif k % 2 == 0:\n return (f(n, k // 2, p) ** 2) % p\n else:\n return (n * f(n, k - 1, p)) % p\n\n\nfor k in range(1, n + 1):\n a = 1\n b = 1\n for j in range(k - 1):\n a = (a * (s - 3 * k + 1 + j)) % p\n b = (b * (j + 1)) % p\n ans = (ans + a * f(b, p - 2, p)) % p\nprint((ans % p))\n", "code_v1_no_empty_lines": "s = int(input())\np = 10**9 + 7\nif s <= 2:\n print((0))\n exit()\nn = s // 3\nans = 0\nx = [0] * (s + 1)\nx[0] = 1\nx[1] = 1\ny = [0] * (s + 1)\nfor i in range(2, s + 1):\n x[i] = x[i - 1] * i % p\ny[s] = pow(x[s], p - 2, p)\nfor i in range(s):\n y[s - 1 - i] = y[s - i] * (s - i) % p\nfor k in range(1, n + 1):\n ans += x[s - 2 * k - 1] * y[k - 1] * y[s - 3 * k] % p\nprint((ans % p))\n", "code_same": false, "relative_loc_diff_percent": 4.0, "diff": ["-", "-", "-def f(n, k, p):", "- if k == 0:", "- return 1", "- elif k % 2 == 0:", "- return (f(n, k // 2, p) ** 2) % p", "- else:", "- return (n * f(n, k - 1, p)) % p", "-", "-", "+x = [0] * (s + 1)", "+x[0] = 1", "+x[1] = 1", "+y = [0] * (s + 1)", "+for i in range(2, s + 1):", "+ x[i] = x[i - 1] * i % p", "+y[s] = pow(x[s], p - 2, p)", "+for i in range(s):", "+ y[s - 1 - i] = y[s - i] * (s - i) % p", "- a = 1", "- b = 1", "- for j in range(k - 1):", "- a = (a * (s - 3 * k + 1 + j)) % p", "- b = (b * (j + 1)) % p", "- ans = (ans + a * f(b, p - 2, p)) % p", "+ ans += x[s - 2 * k - 1] * y[k - 1] * y[s - 3 * k] % p"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3091425891, "measured_runtime_v1": 0.216736346, "runtime_lift": 1.4263532387, "key": ["s550500681", "s439989437"], "target_token_count_dream": 158, "target_token_bucket_dream": "128-256"} +{"user_id": "u729133443", "problem_id": "p03371", "language": "python", "submission_id_v0": "s416055764", "submission_id_v1": "s218640380", "cpu_time_v0": 227, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 92.51, "input": "a,b,c,x,y=list(map(int,input().split()));print((min(k*c*2+a*max(x-k,0)+b*max(y-k,0)for k in range(max(x,y)*3))))", "target": "a,b,c,x,y=list(map(int,input().split()));print((min(x*a+y*b,2*x*c+b*max(0,y-x),2*y*c+a*max(0,x-y))))", "code_v0_loc": 1, "code_v1_loc": 1, "code_v0_num_chars": 104, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nprint(\n (\n min(\n k * c * 2 + a * max(x - k, 0) + b * max(y - k, 0)\n for k in range(max(x, y) * 3)\n )\n )\n)\n", "code_v1_no_empty_lines": "a, b, c, x, y = list(map(int, input().split()))\nprint(\n (min(x * a + y * b, 2 * x * c + b * max(0, y - x), 2 * y * c + a * max(0, x - y)))\n)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- (", "- min(", "- k * c * 2 + a * max(x - k, 0) + b * max(y - k, 0)", "- for k in range(max(x, y) * 3)", "- )", "- )", "+ (min(x * a + y * b, 2 * x * c + b * max(0, y - x), 2 * y * c + a * max(0, x - y)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4340552337, "measured_runtime_v1": 0.2001633718, "runtime_lift": 2.1685048058, "key": ["s416055764", "s218640380"], "target_token_count_dream": 42, "target_token_bucket_dream": "<128"} +{"user_id": "u064408584", "problem_id": "p03723", "language": "python", "submission_id_v0": "s414644536", "submission_id_v1": "s610159769", "cpu_time_v0": 146, "cpu_time_v1": 26, "memory_v0": 2940, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.19, "input": "a,b,c=list(map(int, input().split()))\n\nd=0\n\nwhile d<10**5:\n\n if a%2==1 or b%2==1 or c%2==1:break\n\n a,b,c=b/2+c/2,a/2+c/2,a/2+b/2\n\n d+=1\n\nelse:d=-1\n\nprint(d)", "target": "a,b,c=list(map(int, input().split()))\n\nans=0\n\nwhile a%2==0 and b%2==0 and c%2==0 and ans<10000:\n\n a,b,c=b//2+c//2,a//2+c//2,a//2+b//2\n\n ans+=1\n\nif ans==10000:ans=-1\n\nprint(ans)", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 159, "code_v1_num_chars": 176, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nd = 0\nwhile d < 10**5:\n if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:\n break\n a, b, c = b / 2 + c / 2, a / 2 + c / 2, a / 2 + b / 2\n d += 1\nelse:\n d = -1\nprint(d)\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nans = 0\nwhile a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and ans < 10000:\n a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2\n ans += 1\nif ans == 10000:\n ans = -1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-d = 0", "-while d < 10**5:", "- if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:", "- break", "- a, b, c = b / 2 + c / 2, a / 2 + c / 2, a / 2 + b / 2", "- d += 1", "-else:", "- d = -1", "-print(d)", "+ans = 0", "+while a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and ans < 10000:", "+ a, b, c = b // 2 + c // 2, a // 2 + c // 2, a // 2 + b // 2", "+ ans += 1", "+if ans == 10000:", "+ ans = -1", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5153860836, "measured_runtime_v1": 0.3941329796, "runtime_lift": 1.307645161, "key": ["s414644536", "s610159769"], "target_token_count_dream": 86, "target_token_bucket_dream": "<128"} +{"user_id": "u285443936", "problem_id": "p03309", "language": "python", "submission_id_v0": "s057200482", "submission_id_v1": "s045600813", "cpu_time_v0": 246, "cpu_time_v1": 216, "memory_v0": 27232, "memory_v1": 25200, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 12.2, "input": "import statistics\n\nN = int(input())\n\na = [int(i) for i in input().split()]\n\nans = 0\n\n\n\nfor i in range(1,N+1):\n\n a[i-1] -= i\n\n\n\nb = statistics.median(a)\n\nfor i in range(N):\n\n ans += abs(a[i]-b)\n\nprint((int(ans)))", "target": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nC = [A[i]-i for i in range(N)]\n\nC.sort()\n\nans = 0\n\nmed = C[N//2]\n\nfor i in range(N):\n\n ans += abs(C[i]-med)\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 9, "code_v0_num_chars": 211, "code_v1_num_chars": 177, "code_v0_no_empty_lines": "import statistics\n\nN = int(input())\na = [int(i) for i in input().split()]\nans = 0\nfor i in range(1, N + 1):\n a[i - 1] -= i\nb = statistics.median(a)\nfor i in range(N):\n ans += abs(a[i] - b)\nprint((int(ans)))\n", "code_v1_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nC = [A[i] - i for i in range(N)]\nC.sort()\nans = 0\nmed = C[N // 2]\nfor i in range(N):\n ans += abs(C[i] - med)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-import statistics", "-", "-a = [int(i) for i in input().split()]", "+A = [int(i) for i in input().split()]", "+C = [A[i] - i for i in range(N)]", "+C.sort()", "-for i in range(1, N + 1):", "- a[i - 1] -= i", "-b = statistics.median(a)", "+med = C[N // 2]", "- ans += abs(a[i] - b)", "-print((int(ans)))", "+ ans += abs(C[i] - med)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2933883266, "measured_runtime_v1": 0.2086455548, "runtime_lift": 1.406156613, "key": ["s057200482", "s045600813"], "target_token_count_dream": 64, "target_token_bucket_dream": "<128"} +{"user_id": "u479719434", "problem_id": "p02665", "language": "python", "submission_id_v0": "s890279539", "submission_id_v1": "s923250526", "cpu_time_v0": 175, "cpu_time_v1": 149, "memory_v0": 26380, "memory_v1": 22304, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.86, "input": "n = int(input())\n\nleaves = list(map(int, input().split()))\n\n\n\nans = 0\n\nnodes_min = [0] * (n + 1)\n\nnodes_max = [0] * (n + 1)\n\nnodes_min[n] = leaves[n]\n\nnodes_max[n] = leaves[n]\n\n\n\nfor depth in range(n, 0, -1):\n\n root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2\n\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n\n root_max = nodes_max[depth]\n\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\n\nnodes = [0] * (n + 1)\n\nnodes[0] = 1\n\nif nodes[0] < nodes_min[0]:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n roots = nodes[depth]-leaves[depth]\n\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n\n if nodes[depth+1] < nodes_min[depth+1]:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(nodes)))\n", "target": "n = int(input())\n\nleaves = list(map(int, input().split()))\n\n\n\nsum_leaves = [0]*(n+1)\n\nsum_leaves[0] = leaves[0]\n\nfor depth in range(n):\n\n sum_leaves[depth+1] = sum_leaves[depth] + leaves[depth+1]\n\n\n\nans = 0\n\n\n\nroot = [None] * (n + 1)\n\nif n == 0:\n\n root[0] = 0\n\nelse:\n\n root[0] = 1\n\nif root[0] + leaves[0] != 1:\n\n print((-1))\n\nelse:\n\n for depth in range(n):\n\n root[depth+1] = min(2*root[depth]-leaves[depth+1],\n\n sum_leaves[n]-sum_leaves[depth+1])\n\n if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth+1] < 0:\n\n print((-1))\n\n break\n\n else:\n\n print((sum(root)+sum(leaves)))\n", "code_v0_loc": 27, "code_v1_loc": 26, "code_v0_num_chars": 771, "code_v1_num_chars": 669, "code_v0_no_empty_lines": "n = int(input())\nleaves = list(map(int, input().split()))\nans = 0\nnodes_min = [0] * (n + 1)\nnodes_max = [0] * (n + 1)\nnodes_min[n] = leaves[n]\nnodes_max[n] = leaves[n]\nfor depth in range(n, 0, -1):\n root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2\n nodes_min[depth - 1] = leaves[depth - 1] + root_min\n root_max = nodes_max[depth]\n nodes_max[depth - 1] = leaves[depth - 1] + root_max\nnodes = [0] * (n + 1)\nnodes[0] = 1\nif nodes[0] < nodes_min[0]:\n print((-1))\nelse:\n for depth in range(n):\n roots = nodes[depth] - leaves[depth]\n nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])\n if nodes[depth + 1] < nodes_min[depth + 1]:\n print((-1))\n break\n else:\n print((sum(nodes)))\n", "code_v1_no_empty_lines": "n = int(input())\nleaves = list(map(int, input().split()))\nsum_leaves = [0] * (n + 1)\nsum_leaves[0] = leaves[0]\nfor depth in range(n):\n sum_leaves[depth + 1] = sum_leaves[depth] + leaves[depth + 1]\nans = 0\nroot = [None] * (n + 1)\nif n == 0:\n root[0] = 0\nelse:\n root[0] = 1\nif root[0] + leaves[0] != 1:\n print((-1))\nelse:\n for depth in range(n):\n root[depth + 1] = min(\n 2 * root[depth] - leaves[depth + 1], sum_leaves[n] - sum_leaves[depth + 1]\n )\n if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth + 1] < 0:\n print((-1))\n break\n else:\n print((sum(root) + sum(leaves)))\n", "code_same": false, "relative_loc_diff_percent": 3.7037037037, "diff": ["+sum_leaves = [0] * (n + 1)", "+sum_leaves[0] = leaves[0]", "+for depth in range(n):", "+ sum_leaves[depth + 1] = sum_leaves[depth] + leaves[depth + 1]", "-nodes_min = [0] * (n + 1)", "-nodes_max = [0] * (n + 1)", "-nodes_min[n] = leaves[n]", "-nodes_max[n] = leaves[n]", "-for depth in range(n, 0, -1):", "- root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2", "- nodes_min[depth - 1] = leaves[depth - 1] + root_min", "- root_max = nodes_max[depth]", "- nodes_max[depth - 1] = leaves[depth - 1] + root_max", "-nodes = [0] * (n + 1)", "-nodes[0] = 1", "-if nodes[0] < nodes_min[0]:", "+root = [None] * (n + 1)", "+if n == 0:", "+ root[0] = 0", "+else:", "+ root[0] = 1", "+if root[0] + leaves[0] != 1:", "- roots = nodes[depth] - leaves[depth]", "- nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])", "- if nodes[depth + 1] < nodes_min[depth + 1]:", "+ root[depth + 1] = min(", "+ 2 * root[depth] - leaves[depth + 1], sum_leaves[n] - sum_leaves[depth + 1]", "+ )", "+ if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth + 1] < 0:", "- print((sum(nodes)))", "+ print((sum(root) + sum(leaves)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.455775662, "measured_runtime_v1": 0.2425963848, "runtime_lift": 1.8787405363, "key": ["s890279539", "s923250526"], "target_token_count_dream": 230, "target_token_bucket_dream": "128-256"} +{"user_id": "u060896757", "problem_id": "p02691", "language": "python", "submission_id_v0": "s720467562", "submission_id_v1": "s807450341", "cpu_time_v0": 266, "cpu_time_v1": 106, "memory_v0": 97968, "memory_v1": 92728, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 60.15, "input": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\ndp = [0] * 10 ** 7\n\nans = 0\n\nfor i in range(N):\n\n x = i + 1 - A[i]\n\n if x >= 0:\n\n ans += dp[x]\n\n y = i + 1 + A[i]\n\n if y < 10 ** 7:\n\n dp[y] += 1\n\n\n\nprint(ans)\n", "target": "N = int(input())\n\nA = [int(i) for i in input().split()]\n\nINF = 2 * 10 ** 5\n\ndp = [0] * INF\n\nans = 0\n\nfor i in range(N):\n\n i_i_ = i + 1 - A[i]\n\n if 0 < i_i_ < INF:\n\n ans += dp[i_i_]\n\n i_ = i + 1 + A[i]\n\n if 0 < i_ < INF:\n\n dp[i_] += 1\n\n\n\nprint(ans)", "code_v0_loc": 13, "code_v1_loc": 14, "code_v0_num_chars": 242, "code_v1_num_chars": 273, "code_v0_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\ndp = [0] * 10**7\nans = 0\nfor i in range(N):\n x = i + 1 - A[i]\n if x >= 0:\n ans += dp[x]\n y = i + 1 + A[i]\n if y < 10**7:\n dp[y] += 1\nprint(ans)\n", "code_v1_no_empty_lines": "N = int(input())\nA = [int(i) for i in input().split()]\nINF = 2 * 10**5\ndp = [0] * INF\nans = 0\nfor i in range(N):\n i_i_ = i + 1 - A[i]\n if 0 < i_i_ < INF:\n ans += dp[i_i_]\n i_ = i + 1 + A[i]\n if 0 < i_ < INF:\n dp[i_] += 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-dp = [0] * 10**7", "+INF = 2 * 10**5", "+dp = [0] * INF", "- x = i + 1 - A[i]", "- if x >= 0:", "- ans += dp[x]", "- y = i + 1 + A[i]", "- if y < 10**7:", "- dp[y] += 1", "+ i_i_ = i + 1 - A[i]", "+ if 0 < i_i_ < INF:", "+ ans += dp[i_i_]", "+ i_ = i + 1 + A[i]", "+ if 0 < i_ < INF:", "+ dp[i_] += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 1.4942608066, "measured_runtime_v1": 0.2557353399, "runtime_lift": 5.8429969327, "key": ["s720467562", "s807450341"], "target_token_count_dream": 114, "target_token_bucket_dream": "<128"} +{"user_id": "u880730787", "problem_id": "p02555", "language": "python", "submission_id_v0": "s669686668", "submission_id_v1": "s427616795", "cpu_time_v0": 487, "cpu_time_v1": 297, "memory_v0": 9116, "memory_v1": 9128, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 39.01, "input": "S = int(input())\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))", "target": "S = int(input())\n\nmod = 10**9+7\n\n\n\ndp = [0]*(S+1)\n\ndp[0] = 1\n\nfor i in range(1,S+1):\n\n for j in range(0,(i-3)+1):\n\n dp[i] += dp[j]\n\n dp[i] %= mod\n\nprint((dp[S]))", "code_v0_loc": 10, "code_v1_loc": 10, "code_v0_num_chars": 176, "code_v1_num_chars": 172, "code_v0_no_empty_lines": "S = int(input())\nmod = 10**9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\nfor i in range(1, S + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\nprint((dp[S]))\n", "code_v1_no_empty_lines": "S = int(input())\nmod = 10**9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\nfor i in range(1, S + 1):\n for j in range(0, (i - 3) + 1):\n dp[i] += dp[j]\n dp[i] %= mod\nprint((dp[S]))\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- dp[i] %= mod", "+ dp[i] %= mod"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6781705019, "measured_runtime_v1": 0.481741133, "runtime_lift": 1.4077488002, "key": ["s669686668", "s427616795"], "target_token_count_dream": 76, "target_token_bucket_dream": "<128"} +{"user_id": "u733814820", "problem_id": "p03107", "language": "python", "submission_id_v0": "s607050481", "submission_id_v1": "s627055692", "cpu_time_v0": 41, "cpu_time_v1": 35, "memory_v0": 3316, "memory_v1": 3956, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.63, "input": "# ABC 120 C\n\n\n\nimport re\n\n\n\nS = input()\n\n\n\nl0 = 0\n\nl1 = 0\n\n\n\nfor i in range(len(S)):\n\n if S[i] == '0':\n\n l0 += 1\n\n elif S[i] == '1':\n\n l1 += 1\n\n\n\nprint((min(l0, l1) * 2))\n", "target": "def resolve():\n\n S = input()\n\n arr = []\n\n for s in S:\n\n if len(arr) != 0 and arr[-1] != s:\n\n arr.pop()\n\n else:\n\n arr.append(s)\n\n\n\n print((len(S) - len(arr)))\n\n return\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n", "code_v0_loc": 16, "code_v1_loc": 14, "code_v0_num_chars": 189, "code_v1_num_chars": 229, "code_v0_no_empty_lines": "# ABC 120 C\nimport re\n\nS = input()\nl0 = 0\nl1 = 0\nfor i in range(len(S)):\n if S[i] == \"0\":\n l0 += 1\n elif S[i] == \"1\":\n l1 += 1\nprint((min(l0, l1) * 2))\n", "code_v1_no_empty_lines": "def resolve():\n S = input()\n arr = []\n for s in S:\n if len(arr) != 0 and arr[-1] != s:\n arr.pop()\n else:\n arr.append(s)\n print((len(S) - len(arr)))\n return\n\n\nif __name__ == \"__main__\":\n resolve()\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-# ABC 120 C", "-import re", "+def resolve():", "+ S = input()", "+ arr = []", "+ for s in S:", "+ if len(arr) != 0 and arr[-1] != s:", "+ arr.pop()", "+ else:", "+ arr.append(s)", "+ print((len(S) - len(arr)))", "+ return", "-S = input()", "-l0 = 0", "-l1 = 0", "-for i in range(len(S)):", "- if S[i] == \"0\":", "- l0 += 1", "- elif S[i] == \"1\":", "- l1 += 1", "-print((min(l0, l1) * 2))", "+", "+if __name__ == \"__main__\":", "+ resolve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4207458491, "measured_runtime_v1": 0.3073607309, "runtime_lift": 1.3688991691, "key": ["s607050481", "s627055692"], "target_token_count_dream": 71, "target_token_bucket_dream": "<128"} +{"user_id": "u075304271", "problem_id": "p02657", "language": "python", "submission_id_v0": "s027336468", "submission_id_v1": "s218994202", "cpu_time_v0": 65, "cpu_time_v1": 22, "memory_v0": 61680, "memory_v1": 9168, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 66.15, "input": "def iput(): return int(input())\n\ndef mput(): return list(map(int, input().split()))\n\ndef lput(): return list(map(int, input().split()))\n\n\n\ndef solve():\n\n a, b = mput()\n\n print((a*b))\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()", "target": "import math\n\ndef solve():\n\n a, b = input().split()\n\n a = int(a)\n\n b = float(b)\n\n print((int(a*b)))\n\n return 0\n\n \n\nif __name__ == \"__main__\":\n\n solve()", "code_v0_loc": 11, "code_v1_loc": 10, "code_v0_num_chars": 237, "code_v1_num_chars": 166, "code_v0_no_empty_lines": "def iput():\n return int(input())\n\n\ndef mput():\n return list(map(int, input().split()))\n\n\ndef lput():\n return list(map(int, input().split()))\n\n\ndef solve():\n a, b = mput()\n print((a * b))\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_v1_no_empty_lines": "import math\n\n\ndef solve():\n a, b = input().split()\n a = int(a)\n b = float(b)\n print((int(a * b)))\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 9.0909090909, "diff": ["-def iput():", "- return int(input())", "-", "-", "-def mput():", "- return list(map(int, input().split()))", "-", "-", "-def lput():", "- return list(map(int, input().split()))", "+import math", "- a, b = mput()", "- print((a * b))", "+ a, b = input().split()", "+ a = int(a)", "+ b = float(b)", "+ print((int(a * b)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2298483524, "measured_runtime_v1": 0.0062991838, "runtime_lift": 36.4885924311, "key": ["s027336468", "s218994202"], "target_token_count_dream": 52, "target_token_bucket_dream": "<128"} +{"user_id": "u762420987", "problem_id": "p03759", "language": "python", "submission_id_v0": "s246152829", "submission_id_v1": "s501080791", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "a, b, c = list(map(int, input().split()))\n\nif (b - a) == (c - b):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "target": "a, b, c = list(map(int, input().split()))\n\nif b - a == c - b:\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")", "code_v0_loc": 5, "code_v1_loc": 5, "code_v0_num_chars": 101, "code_v1_num_chars": 97, "code_v0_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif (b - a) == (c - b):\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_v1_no_empty_lines": "a, b, c = list(map(int, input().split()))\nif b - a == c - b:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-if (b - a) == (c - b):", "+if b - a == c - b:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.1914725397, "measured_runtime_v1": 0.0060755644, "runtime_lift": 31.5151856242, "key": ["s246152829", "s501080791"], "target_token_count_dream": 35, "target_token_bucket_dream": "<128"} +{"user_id": "u033606236", "problem_id": "p03796", "language": "python", "submission_id_v0": "s645296559", "submission_id_v1": "s055332014", "cpu_time_v0": 229, "cpu_time_v1": 39, "memory_v0": 4020, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 82.97, "input": "import math\n\nprint((math.factorial(int(input()))%1000000007))", "target": "num = int(input())\n\nresult = 1\n\nfor i in range(1,num+1):\n\n result = result *i % 1000000007\n\nprint(result)", "code_v0_loc": 2, "code_v1_loc": 5, "code_v0_num_chars": 59, "code_v1_num_chars": 108, "code_v0_no_empty_lines": "import math\n\nprint((math.factorial(int(input())) % 1000000007))\n", "code_v1_no_empty_lines": "num = int(input())\nresult = 1\nfor i in range(1, num + 1):\n result = result * i % 1000000007\nprint(result)\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-import math", "-", "-print((math.factorial(int(input())) % 1000000007))", "+num = int(input())", "+result = 1", "+for i in range(1, num + 1):", "+ result = result * i % 1000000007", "+print(result)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7005937328, "measured_runtime_v1": 0.3298725822, "runtime_lift": 2.1238313537, "key": ["s645296559", "s055332014"], "target_token_count_dream": 42, "target_token_bucket_dream": "<128"} +{"user_id": "u488127128", "problem_id": "p03416", "language": "python", "submission_id_v0": "s570028181", "submission_id_v1": "s434791726", "cpu_time_v0": 103, "cpu_time_v1": 46, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 55.34, "input": "a,b = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(a,b+1):\n\n j = str(i)\n\n if j==''.join(reversed(j)):\n\n count += 1\n\nprint(count)", "target": "a,b = list(map(int, input().split()))\n\nn = [i for i in map(str, list(range(a,b+1))) if i==i[::-1]]\n\nprint((len(n)))", "code_v0_loc": 7, "code_v1_loc": 3, "code_v0_num_chars": 149, "code_v1_num_chars": 101, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n j = str(i)\n if j == \"\".join(reversed(j)):\n count += 1\nprint(count)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nn = [i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]\nprint((len(n)))\n", "code_same": false, "relative_loc_diff_percent": 57.1428571429, "diff": ["-count = 0", "-for i in range(a, b + 1):", "- j = str(i)", "- if j == \"\".join(reversed(j)):", "- count += 1", "-print(count)", "+n = [i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]", "+print((len(n)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4183517286, "measured_runtime_v1": 0.2983190859, "runtime_lift": 1.4023632692, "key": ["s570028181", "s434791726"], "target_token_count_dream": 40, "target_token_bucket_dream": "<128"} +{"user_id": "u642883360", "problem_id": "p03796", "language": "python", "submission_id_v0": "s671319819", "submission_id_v1": "s345697128", "cpu_time_v0": 230, "cpu_time_v1": 167, "memory_v0": 3984, "memory_v1": 38512, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 27.39, "input": "#!/usr/bin/env pypy3\n\n\n\nimport math\n\nprint((math.factorial(int(input())) % 1000000007))", "target": "n = int(input())\n\nfor i in range(n - 1, 1, -1):\n\n\tn *= i\n\n\tn %= 10**9 + 7\n\nprint(n)", "code_v0_loc": 4, "code_v1_loc": 5, "code_v0_num_chars": 85, "code_v1_num_chars": 83, "code_v0_no_empty_lines": "#!/usr/bin/env pypy3\nimport math\n\nprint((math.factorial(int(input())) % 1000000007))\n", "code_v1_no_empty_lines": "n = int(input())\nfor i in range(n - 1, 1, -1):\n n *= i\n n %= 10**9 + 7\nprint(n)\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-#!/usr/bin/env pypy3", "-import math", "-", "-print((math.factorial(int(input())) % 1000000007))", "+n = int(input())", "+for i in range(n - 1, 1, -1):", "+ n *= i", "+ n %= 10**9 + 7", "+print(n)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5574923191, "measured_runtime_v1": 0.2242465372, "runtime_lift": 2.4860687974, "key": ["s671319819", "s345697128"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u888092736", "problem_id": "p03721", "language": "python", "submission_id_v0": "s705162733", "submission_id_v1": "s360654843", "cpu_time_v0": 281, "cpu_time_v1": 145, "memory_v0": 28552, "memory_v1": 31636, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 48.4, "input": "(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\n\nfor a, b in sorted(AB):\n\n K -= b\n\n if K <= 0:\n\n print(a)\n\n break\n", "target": "N, K, *AB = list(map(int, open(0).read().split()))\n\nli = [(a, b) for a, b in zip(*[iter(AB)] * 2)]\n\nli.sort()\n\nfor a, b in li:\n\n if K > b:\n\n K -= b\n\n else:\n\n print(a)\n\n break\n", "code_v0_loc": 6, "code_v1_loc": 9, "code_v0_num_chars": 145, "code_v1_num_chars": 196, "code_v0_no_empty_lines": "(N, K), *AB = [list(map(int, s.split())) for s in open(0)]\nfor a, b in sorted(AB):\n K -= b\n if K <= 0:\n print(a)\n break\n", "code_v1_no_empty_lines": "N, K, *AB = list(map(int, open(0).read().split()))\nli = [(a, b) for a, b in zip(*[iter(AB)] * 2)]\nli.sort()\nfor a, b in li:\n if K > b:\n K -= b\n else:\n print(a)\n break\n", "code_same": false, "relative_loc_diff_percent": 33.3333333333, "diff": ["-(N, K), *AB = [list(map(int, s.split())) for s in open(0)]", "-for a, b in sorted(AB):", "- K -= b", "- if K <= 0:", "+N, K, *AB = list(map(int, open(0).read().split()))", "+li = [(a, b) for a, b in zip(*[iter(AB)] * 2)]", "+li.sort()", "+for a, b in li:", "+ if K > b:", "+ K -= b", "+ else:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2949739402, "measured_runtime_v1": 0.0817868489, "runtime_lift": 3.6066182276, "key": ["s705162733", "s360654843"], "target_token_count_dream": 73, "target_token_bucket_dream": "<128"} +{"user_id": "u254871849", "problem_id": "p03796", "language": "python", "submission_id_v0": "s710953077", "submission_id_v1": "s484408635", "cpu_time_v0": 36, "cpu_time_v1": 32, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.11, "input": "mod = int(1e9+7)\n\nn = int(input())\n\n\n\npower = 1\n\nfor i in range(1, n+1):\n\n power = power * i % mod\n\nprint(power)", "target": "import sys\n\n\n\nMOD = 10 ** 9 + 7\n\nn = int(sys.stdin.readline().rstrip())\n\n\n\ndef main():\n\n res = 1\n\n for i in range(1, n+1):\n\n res *= i\n\n res %= MOD\n\n\n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)", "code_v0_loc": 7, "code_v1_loc": 16, "code_v0_num_chars": 115, "code_v1_num_chars": 248, "code_v0_no_empty_lines": "mod = int(1e9 + 7)\nn = int(input())\npower = 1\nfor i in range(1, n + 1):\n power = power * i % mod\nprint(power)\n", "code_v1_no_empty_lines": "import sys\n\nMOD = 10**9 + 7\nn = int(sys.stdin.readline().rstrip())\n\n\ndef main():\n res = 1\n for i in range(1, n + 1):\n res *= i\n res %= MOD\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n", "code_same": false, "relative_loc_diff_percent": 56.25, "diff": ["-mod = int(1e9 + 7)", "-n = int(input())", "-power = 1", "-for i in range(1, n + 1):", "- power = power * i % mod", "-print(power)", "+import sys", "+", "+MOD = 10**9 + 7", "+n = int(sys.stdin.readline().rstrip())", "+", "+", "+def main():", "+ res = 1", "+ for i in range(1, n + 1):", "+ res *= i", "+ res %= MOD", "+ return res", "+", "+", "+if __name__ == \"__main__\":", "+ ans = main()", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3650334806, "measured_runtime_v1": 0.2122802832, "runtime_lift": 1.7195825967, "key": ["s710953077", "s484408635"], "target_token_count_dream": 78, "target_token_bucket_dream": "<128"} +{"user_id": "u492605584", "problem_id": "p03164", "language": "python", "submission_id_v0": "s292196170", "submission_id_v1": "s917581247", "cpu_time_v0": 446, "cpu_time_v1": 321, "memory_v0": 119916, "memory_v1": 41964, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.03, "input": "N, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [[10**9+1] * (V + 1) for i in range(N+1)]\n\ndp[0][0] = 0\n\nfor i in range(N):\n\n for j in range(V+1):\n\n if j - L[i][1] >= 0:\n\n dp[i+1][j] = min(dp[i][j], dp[i][j-L[i][1]] + L[i][0])\n\n else:\n\n dp[i+1][j] = dp[i][j]\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[-1][j]:\n\n ans = max(ans, j)\n\nprint(ans)", "target": "N, W = list(map(int, input().split()))\n\nL = [list(map(int, input().split())) for i in range(N)]\n\nV = 0\n\nfor i in range(N):\n\n V += L[i][1]\n\n\n\ndp = [10**9+1] * (V + 1)\n\ndp[0] = 0\n\nfor i in range(N):\n\n for j in range(V, -1, -1):\n\n dp[j] = min(dp[j], dp[j-L[i][1]] + L[i][0])\n\nans = 0\n\nfor j in range(V+1):\n\n if W >= dp[j]:\n\n ans = max(ans, j)\n\nprint(ans)", "code_v0_loc": 19, "code_v1_loc": 16, "code_v0_num_chars": 481, "code_v1_num_chars": 367, "code_v0_no_empty_lines": "N, W = list(map(int, input().split()))\nL = [list(map(int, input().split())) for i in range(N)]\nV = 0\nfor i in range(N):\n V += L[i][1]\ndp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]\ndp[0][0] = 0\nfor i in range(N):\n for j in range(V + 1):\n if j - L[i][1] >= 0:\n dp[i + 1][j] = min(dp[i][j], dp[i][j - L[i][1]] + L[i][0])\n else:\n dp[i + 1][j] = dp[i][j]\nans = 0\nfor j in range(V + 1):\n if W >= dp[-1][j]:\n ans = max(ans, j)\nprint(ans)\n", "code_v1_no_empty_lines": "N, W = list(map(int, input().split()))\nL = [list(map(int, input().split())) for i in range(N)]\nV = 0\nfor i in range(N):\n V += L[i][1]\ndp = [10**9 + 1] * (V + 1)\ndp[0] = 0\nfor i in range(N):\n for j in range(V, -1, -1):\n dp[j] = min(dp[j], dp[j - L[i][1]] + L[i][0])\nans = 0\nfor j in range(V + 1):\n if W >= dp[j]:\n ans = max(ans, j)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 15.7894736842, "diff": ["-dp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]", "-dp[0][0] = 0", "+dp = [10**9 + 1] * (V + 1)", "+dp[0] = 0", "- for j in range(V + 1):", "- if j - L[i][1] >= 0:", "- dp[i + 1][j] = min(dp[i][j], dp[i][j - L[i][1]] + L[i][0])", "- else:", "- dp[i + 1][j] = dp[i][j]", "+ for j in range(V, -1, -1):", "+ dp[j] = min(dp[j], dp[j - L[i][1]] + L[i][0])", "- if W >= dp[-1][j]:", "+ if W >= dp[j]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3010064836, "measured_runtime_v1": 0.1980076838, "runtime_lift": 1.5201757721, "key": ["s292196170", "s917581247"], "target_token_count_dream": 146, "target_token_bucket_dream": "128-256"} +{"user_id": "u494927057", "problem_id": "p03814", "language": "python", "submission_id_v0": "s883482084", "submission_id_v1": "s072538424", "cpu_time_v0": 59, "cpu_time_v1": 35, "memory_v0": 3516, "memory_v1": 3516, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 40.68, "input": "s = input()\n\n\n\nstart = -1\n\nend = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A' and start < 0:\n\n start = i\n\n elif s[i] == 'Z':\n\n end = i\n\nprint((end - start + 1))\n", "target": "s = input()\n\n\n\nstart = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'A':\n\n start = i\n\n break\n\n\n\nend = 0\n\nfor i in reversed(list(range(len(s)))):\n\n if s[i] == 'Z':\n\n end = i\n\n break\n\nprint((end - start + 1))\n", "code_v0_loc": 10, "code_v1_loc": 14, "code_v0_num_chars": 178, "code_v1_num_chars": 228, "code_v0_no_empty_lines": "s = input()\nstart = -1\nend = 0\nfor i in range(len(s)):\n if s[i] == \"A\" and start < 0:\n start = i\n elif s[i] == \"Z\":\n end = i\nprint((end - start + 1))\n", "code_v1_no_empty_lines": "s = input()\nstart = 0\nfor i in range(len(s)):\n if s[i] == \"A\":\n start = i\n break\nend = 0\nfor i in reversed(list(range(len(s)))):\n if s[i] == \"Z\":\n end = i\n break\nprint((end - start + 1))\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-start = -1", "+start = 0", "+for i in range(len(s)):", "+ if s[i] == \"A\":", "+ start = i", "+ break", "-for i in range(len(s)):", "- if s[i] == \"A\" and start < 0:", "- start = i", "- elif s[i] == \"Z\":", "+for i in reversed(list(range(len(s)))):", "+ if s[i] == \"Z\":", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2661928608, "measured_runtime_v1": 0.1145644054, "runtime_lift": 2.3235215143, "key": ["s883482084", "s072538424"], "target_token_count_dream": 75, "target_token_bucket_dream": "<128"} +{"user_id": "u150984829", "problem_id": "p02412", "language": "python", "submission_id_v0": "s777094380", "submission_id_v1": "s391711407", "cpu_time_v0": 40, "cpu_time_v1": 30, "memory_v0": 5608, "memory_v1": 5612, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.0, "input": "while 1:\n\n n,x=list(map(int,input().split()))\n\n if n+x==0:break\n\n print((len([1 for i in range(3,n+1)for j in range(2,x-i)if x-i-j d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n", "target": "def main():\n\n from sys import stdin\n\n input = stdin.readline\n\n\n\n n, m, r = list(map(int, input().split()))\n\n l = list(map(int, input().split()))\n\n for i in range(r):\n\n l[i] -= 1\n\n d = [[10**8] * n for _ in range(n)]\n\n for _ in range(m):\n\n i, j, k = list(map(int, input().split()))\n\n d[i-1][j-1] = k\n\n d[j-1][i-1] = k\n\n\n\n # Warshall-Floyd algorithm\n\n for k in range(n):\n\n for i in range(n-1):\n\n for j in range(i+1, n):\n\n if d[i][j] > d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n d[j][i] = d[i][j]\n\n\n\n # full search\n\n # 8! = 40320\n\n from itertools import permutations\n\n\n\n answer = 10**8\n\n for i in permutations(l):\n\n ans = 0\n\n for j in range(r-1):\n\n ans += d[i[j]][i[j+1]]\n\n if ans < answer:\n\n answer = ans\n\n\n\n print(answer)\n\n\n\nmain()\n", "code_v0_loc": 36, "code_v1_loc": 37, "code_v0_num_chars": 868, "code_v1_num_chars": 914, "code_v0_no_empty_lines": "def main():\n from sys import stdin\n\n input = stdin.readline\n n, m, r = list(map(int, input().split()))\n l = list(map(int, input().split()))\n for i in range(r):\n l[i] -= 1\n d = [[10**8] * n for _ in range(n)]\n for _ in range(m):\n i, j, k = list(map(int, input().split()))\n d[i - 1][j - 1] = k\n d[j - 1][i - 1] = k\n # Warshall-Floyd algorithm\n for k in range(n):\n for i in range(n):\n for j in range(n):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\n # full search\n # 8! = 40320\n from itertools import permutations\n\n answer = 10**8\n for i in permutations(l):\n ans = 0\n for j in range(r - 1):\n ans += d[i[j]][i[j + 1]]\n if ans < answer:\n answer = ans\n print(answer)\n\n\nmain()\n", "code_v1_no_empty_lines": "def main():\n from sys import stdin\n\n input = stdin.readline\n n, m, r = list(map(int, input().split()))\n l = list(map(int, input().split()))\n for i in range(r):\n l[i] -= 1\n d = [[10**8] * n for _ in range(n)]\n for _ in range(m):\n i, j, k = list(map(int, input().split()))\n d[i - 1][j - 1] = k\n d[j - 1][i - 1] = k\n # Warshall-Floyd algorithm\n for k in range(n):\n for i in range(n - 1):\n for j in range(i + 1, n):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\n d[j][i] = d[i][j]\n # full search\n # 8! = 40320\n from itertools import permutations\n\n answer = 10**8\n for i in permutations(l):\n ans = 0\n for j in range(r - 1):\n ans += d[i[j]][i[j + 1]]\n if ans < answer:\n answer = ans\n print(answer)\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 2.7027027027, "diff": ["- for i in range(n):", "- for j in range(n):", "+ for i in range(n - 1):", "+ for j in range(i + 1, n):", "+ d[j][i] = d[i][j]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2599997888, "measured_runtime_v1": 0.1532082543, "runtime_lift": 1.697035123, "key": ["s030633020", "s301564470"], "target_token_count_dream": 289, "target_token_bucket_dream": "256-512"} +{"user_id": "u994988729", "problem_id": "p02702", "language": "python", "submission_id_v0": "s376874744", "submission_id_v1": "s887269917", "cpu_time_v0": 337, "cpu_time_v1": 135, "memory_v0": 16640, "memory_v1": 9800, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.94, "input": "from collections import Counter\n\nS = input()[::-1]\n\n\n\nmemo = [0]\n\nd = 0\n\nmod = 2019\n\n\n\nfor s in S:\n\n tmp = int(s) * pow(10, d, mod) % mod\n\n tmp = memo[-1] + tmp\n\n memo.append(tmp % mod)\n\n d += 1\n\n\n\nc = Counter(memo)\n\nans = sum(v * (v - 1) // 2 for v in list(c.values()))\n\nprint(ans)", "target": "from collections import defaultdict\n\nS = input()\n\nN = len(S)\n\n\n\nmemo = defaultdict(int)\n\nmemo[0] += 1\n\n\n\nmod = 2019\n\nd = 1\n\nval = 0\n\n\n\nfor s in S[::-1]:\n\n s = int(s)\n\n val += s * d\n\n val %= mod\n\n memo[val] += 1\n\n d *= 10\n\n d %= mod\n\n\n\nprint((sum(v * (v - 1) // 2 for v in list(memo.values()))))", "code_v0_loc": 16, "code_v1_loc": 20, "code_v0_num_chars": 288, "code_v1_num_chars": 304, "code_v0_no_empty_lines": "from collections import Counter\n\nS = input()[::-1]\nmemo = [0]\nd = 0\nmod = 2019\nfor s in S:\n tmp = int(s) * pow(10, d, mod) % mod\n tmp = memo[-1] + tmp\n memo.append(tmp % mod)\n d += 1\nc = Counter(memo)\nans = sum(v * (v - 1) // 2 for v in list(c.values()))\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import defaultdict\n\nS = input()\nN = len(S)\nmemo = defaultdict(int)\nmemo[0] += 1\nmod = 2019\nd = 1\nval = 0\nfor s in S[::-1]:\n s = int(s)\n val += s * d\n val %= mod\n memo[val] += 1\n d *= 10\n d %= mod\nprint((sum(v * (v - 1) // 2 for v in list(memo.values()))))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-from collections import Counter", "+from collections import defaultdict", "-S = input()[::-1]", "-memo = [0]", "-d = 0", "+S = input()", "+N = len(S)", "+memo = defaultdict(int)", "+memo[0] += 1", "-for s in S:", "- tmp = int(s) * pow(10, d, mod) % mod", "- tmp = memo[-1] + tmp", "- memo.append(tmp % mod)", "- d += 1", "-c = Counter(memo)", "-ans = sum(v * (v - 1) // 2 for v in list(c.values()))", "-print(ans)", "+d = 1", "+val = 0", "+for s in S[::-1]:", "+ s = int(s)", "+ val += s * d", "+ val %= mod", "+ memo[val] += 1", "+ d *= 10", "+ d %= mod", "+print((sum(v * (v - 1) // 2 for v in list(memo.values()))))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2615414739, "measured_runtime_v1": 0.0063235409, "runtime_lift": 41.3599716541, "key": ["s376874744", "s887269917"], "target_token_count_dream": 113, "target_token_bucket_dream": "<128"} +{"user_id": "u790710233", "problem_id": "p02627", "language": "python", "submission_id_v0": "s724454634", "submission_id_v1": "s209300808", "cpu_time_v0": 29, "cpu_time_v1": 25, "memory_v0": 9064, "memory_v1": 9076, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.79, "input": "a = input()\n\nprint(('A' if not a.islower() else 'a'))\n", "target": "print(('A' if input().isupper() else 'a'))\n", "code_v0_loc": 2, "code_v1_loc": 1, "code_v0_num_chars": 52, "code_v1_num_chars": 41, "code_v0_no_empty_lines": "a = input()\nprint((\"A\" if not a.islower() else \"a\"))\n", "code_v1_no_empty_lines": "print((\"A\" if input().isupper() else \"a\"))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-a = input()", "-print((\"A\" if not a.islower() else \"a\"))", "+print((\"A\" if input().isupper() else \"a\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3926431958, "measured_runtime_v1": 0.2988653038, "runtime_lift": 1.3137797892, "key": ["s724454634", "s209300808"], "target_token_count_dream": 14, "target_token_bucket_dream": "<128"} +{"user_id": "u296518383", "problem_id": "p03325", "language": "python", "submission_id_v0": "s558724347", "submission_id_v1": "s377057284", "cpu_time_v0": 137, "cpu_time_v1": 60, "memory_v0": 4148, "memory_v1": 3956, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 56.2, "input": "N=int(input())\n\na=list(map(int,input().split()))\n\nfor i in range(N):\n\n for j in range(1,31):\n\n if a[i]%(2**j)!=0:\n\n a[i]=j-1\n\n break\n\nprint((sum(a)))", "target": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\n\n\ndef f(n):\n\n res = 0\n\n while n % 2 == 0:\n\n n //= 2\n\n res += 1\n\n return res\n\n\n\nanswer = 0\n\nfor a in A:\n\n answer += f(a)\n\n\n\nprint(answer)", "code_v0_loc": 8, "code_v1_loc": 18, "code_v0_num_chars": 161, "code_v1_num_chars": 250, "code_v0_no_empty_lines": "N = int(input())\na = list(map(int, input().split()))\nfor i in range(N):\n for j in range(1, 31):\n if a[i] % (2**j) != 0:\n a[i] = j - 1\n break\nprint((sum(a)))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nN = int(input())\nA = list(map(int, input().split()))\n\n\ndef f(n):\n res = 0\n while n % 2 == 0:\n n //= 2\n res += 1\n return res\n\n\nanswer = 0\nfor a in A:\n answer += f(a)\nprint(answer)\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["+import sys", "+", "+input = sys.stdin.buffer.readline", "-a = list(map(int, input().split()))", "-for i in range(N):", "- for j in range(1, 31):", "- if a[i] % (2**j) != 0:", "- a[i] = j - 1", "- break", "-print((sum(a)))", "+A = list(map(int, input().split()))", "+", "+", "+def f(n):", "+ res = 0", "+ while n % 2 == 0:", "+ n //= 2", "+ res += 1", "+ return res", "+", "+", "+answer = 0", "+for a in A:", "+ answer += f(a)", "+print(answer)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4158020542, "measured_runtime_v1": 0.3166491349, "runtime_lift": 1.313131818, "key": ["s558724347", "s377057284"], "target_token_count_dream": 81, "target_token_bucket_dream": "<128"} +{"user_id": "u280552586", "problem_id": "p03416", "language": "python", "submission_id_v0": "s181217545", "submission_id_v1": "s674939126", "cpu_time_v0": 47, "cpu_time_v1": 18, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 61.7, "input": "a, b = list(map(int, input().split()))\n\ncnt = 0\n\n\n\nfor i in range(a, b+1):\n\n i = str(i)\n\n if i[0] == i[-1] and i[1] == i[-2]:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "target": "a, b = list(map(int, input().split()))\n\ncnt = 0\n\n\n\nfor i in range(10):\n\n for j in range(10):\n\n for k in range(10):\n\n c = 10000*i+1000*j+100*k+10*j+i\n\n if a <= c <= b:\n\n cnt += 1\n\n\n\nprint(cnt)\n", "code_v0_loc": 9, "code_v1_loc": 11, "code_v0_num_chars": 158, "code_v1_num_chars": 233, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(a, b + 1):\n i = str(i)\n if i[0] == i[-1] and i[1] == i[-2]:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\ncnt = 0\nfor i in range(10):\n for j in range(10):\n for k in range(10):\n c = 10000 * i + 1000 * j + 100 * k + 10 * j + i\n if a <= c <= b:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 18.1818181818, "diff": ["-for i in range(a, b + 1):", "- i = str(i)", "- if i[0] == i[-1] and i[1] == i[-2]:", "- cnt += 1", "+for i in range(10):", "+ for j in range(10):", "+ for k in range(10):", "+ c = 10000 * i + 1000 * j + 100 * k + 10 * j + i", "+ if a <= c <= b:", "+ cnt += 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3654750098, "measured_runtime_v1": 0.273478784, "runtime_lift": 1.3363925508, "key": ["s181217545", "s674939126"], "target_token_count_dream": 87, "target_token_bucket_dream": "<128"} +{"user_id": "u753803401", "problem_id": "p03835", "language": "python", "submission_id_v0": "s742815481", "submission_id_v1": "s376437490", "cpu_time_v0": 1589, "cpu_time_v1": 1250, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.33, "input": "k, s = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if i + j > s:\n\n break\n\n elif s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n", "target": "k, s = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if 0 <= s - i - j <= k:\n\n cnt += 1\n\nprint(cnt)\n", "code_v0_loc": 9, "code_v1_loc": 7, "code_v0_num_chars": 200, "code_v1_num_chars": 161, "code_v0_no_empty_lines": "k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if i + j > s:\n break\n elif s - i - j <= k:\n cnt += 1\nprint(cnt)\n", "code_v1_no_empty_lines": "k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n cnt += 1\nprint(cnt)\n", "code_same": false, "relative_loc_diff_percent": 22.2222222222, "diff": ["- if i + j > s:", "- break", "- elif s - i - j <= k:", "+ if 0 <= s - i - j <= k:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3744940901, "measured_runtime_v1": 0.2492418245, "runtime_lift": 1.5025330956, "key": ["s742815481", "s376437490"], "target_token_count_dream": 58, "target_token_bucket_dream": "<128"} +{"user_id": "u893063840", "problem_id": "p02702", "language": "python", "submission_id_v0": "s375368375", "submission_id_v1": "s846087139", "cpu_time_v0": 644, "cpu_time_v1": 545, "memory_v0": 26036, "memory_v1": 24420, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.37, "input": "from collections import Counter\n\n\n\ns = input()\n\nmod1 = 673\n\nmod2 = 3\n\n\n\nnum1 = 0\n\nnum2 = 0\n\nli1 = []\n\nli2 = []\n\npw1 = 10\n\npw2 = 10\n\nfor i, e in enumerate(s, 1):\n\n num1 *= 10\n\n num1 += int(e)\n\n num1 %= mod1\n\n inv = pow(pw1, mod1 - 2, mod1)\n\n li1.append(num1 * inv % mod1)\n\n\n\n num2 *= 10\n\n num2 += int(e)\n\n num2 %= mod2\n\n inv = pow(pw2, mod2 - 2, mod2)\n\n li2.append(num2 * inv % mod2)\n\n\n\n pw1 *= 10\n\n pw1 %= mod1\n\n pw2 *= 10\n\n pw2 %= mod2\n\n\n\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\n\nc = Counter(li)\n\n\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) // 2\n\n\n\nprint(ans)\n", "target": "from collections import Counter\n\n\n\n\n\ndef f(mod):\n\n ret = [0]\n\n power = 1\n\n num = 0\n\n for i, e in enumerate(s, 1):\n\n num *= 10\n\n num += int(e)\n\n num %= mod\n\n\n\n power *= 10\n\n power %= mod\n\n inv = pow(power, mod - 2, mod)\n\n\n\n ret.append(num * inv % mod)\n\n\n\n return ret\n\n\n\n\n\ns = input()\n\n\n\nmod3 = f(3)\n\nmod673 = f(673)\n\n\n\nli = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]\n\n\n\nc = Counter(li)\n\nans = 0\n\nfor v in list(c.values()):\n\n ans += v * (v - 1) // 2\n\nprint(ans)\n", "code_v0_loc": 38, "code_v1_loc": 33, "code_v0_num_chars": 629, "code_v1_num_chars": 529, "code_v0_no_empty_lines": "from collections import Counter\n\ns = input()\nmod1 = 673\nmod2 = 3\nnum1 = 0\nnum2 = 0\nli1 = []\nli2 = []\npw1 = 10\npw2 = 10\nfor i, e in enumerate(s, 1):\n num1 *= 10\n num1 += int(e)\n num1 %= mod1\n inv = pow(pw1, mod1 - 2, mod1)\n li1.append(num1 * inv % mod1)\n num2 *= 10\n num2 += int(e)\n num2 %= mod2\n inv = pow(pw2, mod2 - 2, mod2)\n li2.append(num2 * inv % mod2)\n pw1 *= 10\n pw1 %= mod1\n pw2 *= 10\n pw2 %= mod2\nli = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]\nc = Counter(li)\nans = 0\nfor v in list(c.values()):\n ans += v * (v - 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "from collections import Counter\n\n\ndef f(mod):\n ret = [0]\n power = 1\n num = 0\n for i, e in enumerate(s, 1):\n num *= 10\n num += int(e)\n num %= mod\n power *= 10\n power %= mod\n inv = pow(power, mod - 2, mod)\n ret.append(num * inv % mod)\n return ret\n\n\ns = input()\nmod3 = f(3)\nmod673 = f(673)\nli = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]\nc = Counter(li)\nans = 0\nfor v in list(c.values()):\n ans += v * (v - 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 13.1578947368, "diff": ["+", "+def f(mod):", "+ ret = [0]", "+ power = 1", "+ num = 0", "+ for i, e in enumerate(s, 1):", "+ num *= 10", "+ num += int(e)", "+ num %= mod", "+ power *= 10", "+ power %= mod", "+ inv = pow(power, mod - 2, mod)", "+ ret.append(num * inv % mod)", "+ return ret", "+", "+", "-mod1 = 673", "-mod2 = 3", "-num1 = 0", "-num2 = 0", "-li1 = []", "-li2 = []", "-pw1 = 10", "-pw2 = 10", "-for i, e in enumerate(s, 1):", "- num1 *= 10", "- num1 += int(e)", "- num1 %= mod1", "- inv = pow(pw1, mod1 - 2, mod1)", "- li1.append(num1 * inv % mod1)", "- num2 *= 10", "- num2 += int(e)", "- num2 %= mod2", "- inv = pow(pw2, mod2 - 2, mod2)", "- li2.append(num2 * inv % mod2)", "- pw1 *= 10", "- pw1 %= mod1", "- pw2 *= 10", "- pw2 %= mod2", "-li = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]", "+mod3 = f(3)", "+mod673 = f(673)", "+li = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4600284932, "measured_runtime_v1": 0.2683121743, "runtime_lift": 1.7145270963, "key": ["s375368375", "s846087139"], "target_token_count_dream": 185, "target_token_bucket_dream": "128-256"} +{"user_id": "u882564128", "problem_id": "p03371", "language": "python", "submission_id_v0": "s136733954", "submission_id_v1": "s827725289", "cpu_time_v0": 100, "cpu_time_v1": 70, "memory_v0": 9180, "memory_v1": 9068, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.0, "input": "a, b, c, x, y = list(map(int, input().split(' ')))\n\n\n\nc = int(c*2)\n\nm = float('inf')\n\nfor i in range(10**5+1):\n\n m = min(m, a*max(0, x-i)+b*max(0,y-i)+c*i)\n\nprint(m)", "target": "import math\n\na, b, c, x, y = list(map(int, input().split(' ')))\n\nans = float('inf')\n\nc = c*2\n\nfor i in range(max(x, y)+1):\n\n if i > x:\n\n price = b*(y-i) + c*i\n\n elif i > y:\n\n price = a*(x-i) + c*i\n\n else:\n\n price = a*(x-i) + b*(y-i) + c*i\n\n\n\n if ans > price:\n\n ans = price\n\nprint(ans)", "code_v0_loc": 7, "code_v1_loc": 15, "code_v0_num_chars": 162, "code_v1_num_chars": 318, "code_v0_no_empty_lines": "a, b, c, x, y = list(map(int, input().split(\" \")))\nc = int(c * 2)\nm = float(\"inf\")\nfor i in range(10**5 + 1):\n m = min(m, a * max(0, x - i) + b * max(0, y - i) + c * i)\nprint(m)\n", "code_v1_no_empty_lines": "import math\n\na, b, c, x, y = list(map(int, input().split(\" \")))\nans = float(\"inf\")\nc = c * 2\nfor i in range(max(x, y) + 1):\n if i > x:\n price = b * (y - i) + c * i\n elif i > y:\n price = a * (x - i) + c * i\n else:\n price = a * (x - i) + b * (y - i) + c * i\n if ans > price:\n ans = price\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 53.3333333333, "diff": ["+import math", "+", "-c = int(c * 2)", "-m = float(\"inf\")", "-for i in range(10**5 + 1):", "- m = min(m, a * max(0, x - i) + b * max(0, y - i) + c * i)", "-print(m)", "+ans = float(\"inf\")", "+c = c * 2", "+for i in range(max(x, y) + 1):", "+ if i > x:", "+ price = b * (y - i) + c * i", "+ elif i > y:", "+ price = a * (x - i) + c * i", "+ else:", "+ price = a * (x - i) + b * (y - i) + c * i", "+ if ans > price:", "+ ans = price", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0457227323, "measured_runtime_v1": 0.348341011, "runtime_lift": 3.0020086614, "key": ["s136733954", "s827725289"], "target_token_count_dream": 117, "target_token_bucket_dream": "<128"} +{"user_id": "u729133443", "problem_id": "p02983", "language": "python", "submission_id_v0": "s140577970", "submission_id_v1": "s371672772", "cpu_time_v0": 591, "cpu_time_v1": 74, "memory_v0": 40556, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.48, "input": "l,r=list(map(int,input().split()))\n\ns=list(range(l,r+1))[:2019]\n\nprint((min(i*j%2019for i in s for j in s if i> i & 1:\n\n a = dp[i][a]\n\n return a >= b\n\ndef solve(a, b):\n\n if a > b:\n\n a, b = b, a\n\n ng = 0\n\n ok = n-1\n\n while ok - ng > 1:\n\n mid = (ng + ok) // 2\n\n if test(mid, a, b):\n\n ok = mid\n\n else:\n\n ng = mid\n\n print(ok)\n\nq = int(input())\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n solve(a, b)", "target": "import sys\n\ninput = sys.stdin.readline\n\nimport bisect\n\n\n\nn = int(input())\n\nX = list(map(int, input().split()))\n\nl = int(input())\n\nU = 17\n\ndp = [[0]*n for _ in range(U+1)]\n\nfor i, x in enumerate(X):\n\n t = bisect.bisect_left(X, x+l)\n\n dp[0][i] = bisect.bisect_right(X, x+l) - 1\n\nfor k in range(U):\n\n for i in range(n):\n\n dp[k+1][i] = dp[k][dp[k][i]]\n\nq = int(input())\n\nfor _ in range(q):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n if a > b:\n\n a, b = b, a\n\n res = 1\n\n for k in range(U, -1, -1):\n\n if dp[k][a] < b:\n\n a = dp[k][a]\n\n res += (1<> i & 1:\n a = dp[i][a]\n return a >= b\n\n\ndef solve(a, b):\n if a > b:\n a, b = b, a\n ng = 0\n ok = n - 1\n while ok - ng > 1:\n mid = (ng + ok) // 2\n if test(mid, a, b):\n ok = mid\n else:\n ng = mid\n print(ok)\n\n\nq = int(input())\nfor _ in range(q):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n solve(a, b)\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nimport bisect\n\nn = int(input())\nX = list(map(int, input().split()))\nl = int(input())\nU = 17\ndp = [[0] * n for _ in range(U + 1)]\nfor i, x in enumerate(X):\n t = bisect.bisect_left(X, x + l)\n dp[0][i] = bisect.bisect_right(X, x + l) - 1\nfor k in range(U):\n for i in range(n):\n dp[k + 1][i] = dp[k][dp[k][i]]\nq = int(input())\nfor _ in range(q):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n if a > b:\n a, b = b, a\n res = 1\n for k in range(U, -1, -1):\n if dp[k][a] < b:\n a = dp[k][a]\n res += 1 << k\n if a == b:\n break\n print(res)\n", "code_same": false, "relative_loc_diff_percent": 21.0526315789, "diff": ["-", "-", "-def test(x, a, b):", "- for i in range(U, -1, -1):", "- if x >> i & 1:", "- a = dp[i][a]", "- return a >= b", "-", "-", "-def solve(a, b):", "- if a > b:", "- a, b = b, a", "- ng = 0", "- ok = n - 1", "- while ok - ng > 1:", "- mid = (ng + ok) // 2", "- if test(mid, a, b):", "- ok = mid", "- else:", "- ng = mid", "- print(ok)", "-", "-", "- solve(a, b)", "+ if a > b:", "+ a, b = b, a", "+ res = 1", "+ for k in range(U, -1, -1):", "+ if dp[k][a] < b:", "+ a = dp[k][a]", "+ res += 1 << k", "+ if a == b:", "+ break", "+ print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.33038889, "measured_runtime_v1": 0.2620919657, "runtime_lift": 1.2605838152, "key": ["s083196734", "s862767700"], "target_token_count_dream": 237, "target_token_bucket_dream": "128-256"} +{"user_id": "u844005364", "problem_id": "p02994", "language": "python", "submission_id_v0": "s135697405", "submission_id_v1": "s243236458", "cpu_time_v0": 20, "cpu_time_v1": 17, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.0, "input": "n, like = list(map(int, input().split()))\n\n\n\narr = [like + i for i in range(n)]\n\n\n\narr.sort(key=lambda x:abs(x))\n\n\n\nprint((sum(arr[1:])))\n", "target": "n, like = list(map(int, input().split()))\n\narr = [like + i for i in range(n)]\n\narr.sort(key=abs)\n\nprint((sum(arr[1:])))\n", "code_v0_loc": 7, "code_v1_loc": 4, "code_v0_num_chars": 130, "code_v1_num_chars": 112, "code_v0_no_empty_lines": "n, like = list(map(int, input().split()))\narr = [like + i for i in range(n)]\narr.sort(key=lambda x: abs(x))\nprint((sum(arr[1:])))\n", "code_v1_no_empty_lines": "n, like = list(map(int, input().split()))\narr = [like + i for i in range(n)]\narr.sort(key=abs)\nprint((sum(arr[1:])))\n", "code_same": false, "relative_loc_diff_percent": 42.8571428571, "diff": ["-arr.sort(key=lambda x: abs(x))", "+arr.sort(key=abs)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2677221475, "measured_runtime_v1": 0.0993615375, "runtime_lift": 2.6944243647, "key": ["s135697405", "s243236458"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u325282913", "problem_id": "p03371", "language": "python", "submission_id_v0": "s614340278", "submission_id_v1": "s677161923", "cpu_time_v0": 117, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 84.62, "input": "A, B, C, X, Y = list(map(int, input().split()))\n\nans = float('inf')\n\nfor i in range(max(X,Y)+1):\n\n cost = 2 * C * i + max(0,X-i)*A +max(0,Y-i)*B\n\n ans = min(ans,cost)\n\nprint(ans)", "target": "A, B, C, X, Y = list(map(int, input().split()))\n\ntmp = A*X + B*Y\n\nif X >= Y:\n\n tmp = min(tmp,2*Y*C+(X-Y)*A)\n\nelse:\n\n tmp = min(tmp,2*X*C+(Y-X)*B)\n\ntmp = min(tmp,max(X,Y)*2*C)\n\nprint(tmp)", "code_v0_loc": 6, "code_v1_loc": 8, "code_v0_num_chars": 178, "code_v1_num_chars": 186, "code_v0_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in range(max(X, Y) + 1):\n cost = 2 * C * i + max(0, X - i) * A + max(0, Y - i) * B\n ans = min(ans, cost)\nprint(ans)\n", "code_v1_no_empty_lines": "A, B, C, X, Y = list(map(int, input().split()))\ntmp = A * X + B * Y\nif X >= Y:\n tmp = min(tmp, 2 * Y * C + (X - Y) * A)\nelse:\n tmp = min(tmp, 2 * X * C + (Y - X) * B)\ntmp = min(tmp, max(X, Y) * 2 * C)\nprint(tmp)\n", "code_same": false, "relative_loc_diff_percent": 25.0, "diff": ["-ans = float(\"inf\")", "-for i in range(max(X, Y) + 1):", "- cost = 2 * C * i + max(0, X - i) * A + max(0, Y - i) * B", "- ans = min(ans, cost)", "-print(ans)", "+tmp = A * X + B * Y", "+if X >= Y:", "+ tmp = min(tmp, 2 * Y * C + (X - Y) * A)", "+else:", "+ tmp = min(tmp, 2 * X * C + (Y - X) * B)", "+tmp = min(tmp, max(X, Y) * 2 * C)", "+print(tmp)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.571060118, "measured_runtime_v1": 0.3373241339, "runtime_lift": 1.6929121299, "key": ["s614340278", "s677161923"], "target_token_count_dream": 79, "target_token_bucket_dream": "<128"} +{"user_id": "u873917047", "problem_id": "p03828", "language": "python", "submission_id_v0": "s924740576", "submission_id_v1": "s078000611", "cpu_time_v0": 523, "cpu_time_v1": 182, "memory_v0": 3188, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 65.2, "input": "#coding: UTF-8\n\nimport math\n\nN=int(input())\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N):\n\n plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k/(i+1)\n\n lis[i]=n\n\n return lis\n\nout_lis=[0]*N\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\nprint((out%1000000007))", "target": "#coding: UTF-8\n\nimport math\n\nN=int(input())\n\ndef prime_list(k):\n\n lis=[True for i in range(1,k+1)]\n\n lis[0]=False\n\n for i in range(2,k+1):\n\n j=2\n\n while j*j<=i:\n\n if i%j==0:\n\n lis[i-1]=False\n\n break\n\n else:\n\n j+=1\n\n return lis\n\n# print(lis)\n\ndef p_fact(k,N,plist):\n\n# plist=prime_list(k)\n\n lis=[0]*N\n\n for i in range(0,k):\n\n n=0\n\n if plist[i]:\n\n while k%(i+1)==0:\n\n n+=1\n\n k=k/(i+1)\n\n lis[i]=n\n\n return lis\n\n# print(lis)\n\nout_lis=[0]*N\n\nplist=prime_list(N)\n\nfor i in range(1,N+1):\n\n input_lis=p_fact(i,N,plist)\n\n out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]\n\n#print(out_lis)\n\nout=1\n\nfor i in range(0,N):\n\n out=out*(out_lis[i]+1)\n\n#print(out%1000000007)\n\nprint((out%(10**9+7)))", "code_v0_loc": 36, "code_v1_loc": 39, "code_v0_num_chars": 791, "code_v1_num_chars": 865, "code_v0_no_empty_lines": "# coding: UTF-8\nimport math\n\nN = int(input())\n\n\ndef prime_list(k):\n lis = [True for i in range(1, k + 1)]\n lis[0] = False\n for i in range(2, k + 1):\n j = 2\n while j * j <= i:\n if i % j == 0:\n lis[i - 1] = False\n break\n else:\n j += 1\n return lis\n\n\n# print(lis)\ndef p_fact(k, N):\n plist = prime_list(k)\n lis = [0] * N\n for i in range(0, k):\n n = 0\n if plist[i]:\n while k % (i + 1) == 0:\n n += 1\n k = k / (i + 1)\n lis[i] = n\n return lis\n\n\nout_lis = [0] * N\nfor i in range(1, N + 1):\n input_lis = p_fact(i, N)\n out_lis = [out_lis[j] + input_lis[j] for j in range(0, N)]\n# print(out_lis)\nout = 1\nfor i in range(0, N):\n out = out * (out_lis[i] + 1)\nprint((out % 1000000007))\n", "code_v1_no_empty_lines": "# coding: UTF-8\nimport math\n\nN = int(input())\n\n\ndef prime_list(k):\n lis = [True for i in range(1, k + 1)]\n lis[0] = False\n for i in range(2, k + 1):\n j = 2\n while j * j <= i:\n if i % j == 0:\n lis[i - 1] = False\n break\n else:\n j += 1\n return lis\n\n\n# print(lis)\ndef p_fact(k, N, plist):\n # plist=prime_list(k)\n lis = [0] * N\n for i in range(0, k):\n n = 0\n if plist[i]:\n while k % (i + 1) == 0:\n n += 1\n k = k / (i + 1)\n lis[i] = n\n return lis\n\n\n# print(lis)\nout_lis = [0] * N\nplist = prime_list(N)\nfor i in range(1, N + 1):\n input_lis = p_fact(i, N, plist)\n out_lis = [out_lis[j] + input_lis[j] for j in range(0, N)]\n# print(out_lis)\nout = 1\nfor i in range(0, N):\n out = out * (out_lis[i] + 1)\n# print(out%1000000007)\nprint((out % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 7.6923076923, "diff": ["-def p_fact(k, N):", "- plist = prime_list(k)", "+def p_fact(k, N, plist):", "+ # plist=prime_list(k)", "+# print(lis)", "+plist = prime_list(N)", "- input_lis = p_fact(i, N)", "+ input_lis = p_fact(i, N, plist)", "-print((out % 1000000007))", "+# print(out%1000000007)", "+print((out % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6020502172, "measured_runtime_v1": 0.3540123932, "runtime_lift": 1.7006472899, "key": ["s924740576", "s078000611"], "target_token_count_dream": 292, "target_token_bucket_dream": "256-512"} +{"user_id": "u800534567", "problem_id": "p02245", "language": "python", "submission_id_v0": "s424620538", "submission_id_v1": "s007973982", "cpu_time_v0": 3310, "cpu_time_v1": 2340, "memory_v0": 34416, "memory_v1": 34452, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 29.31, "input": "import sys\n\nimport queue\n\n\n\nN = 3\n\nf= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\nf+= ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = queue.Queue()\n\nV = dict()\n\n\n\nQ.put([f,f.index('0'),0])\n\nV[f] = True\n\n\n\nwhile not Q.empty():\n\n u = Q.get()\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]//N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 \n\n Q.put(v)\n\n\n\nprint((u[2]))\n", "target": "import sys\n\nimport queue\n\n\n\nN = 3\n\n\n\nf = ''.join(sys.stdin.readline().split())\n\nf += ''.join(sys.stdin.readline().split())\n\nf += ''.join(sys.stdin.readline().split())\n\n\n\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\n\n\n\nQ = [[f,f.index('0'),0]]\n\nV = { f: True }\n\n\n\nwhile len(Q)>0:\n\n u = Q.pop(0)\n\n if u[0] == '123456780': break\n\n sx, sy = u[1]//N, u[1]%N\n\n for dx, dy in dd:\n\n tx, ty = sx+dx, sy+dy\n\n if tx<0 or ty<0 or tx>=N or ty>=N: continue\n\n v = u[:]\n\n n1, n2 = u[1], tx*N+ty\n\n v[1] = n2\n\n if n1>n2: n1, n2 = n2, n1\n\n v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]\n\n if not V.get(v[0], False):\n\n V[v[0]] = True\n\n v[2] += 1 # dir[r] \n\n Q.append(v)\n\n\n\nprint((u[2]))\n", "code_v0_loc": 34, "code_v1_loc": 32, "code_v0_num_chars": 845, "code_v1_num_chars": 831, "code_v0_no_empty_lines": "import sys\nimport queue\n\nN = 3\nf = \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\nQ = queue.Queue()\nV = dict()\nQ.put([f, f.index(\"0\"), 0])\nV[f] = True\nwhile not Q.empty():\n u = Q.get()\n if u[0] == \"123456780\":\n break\n sx, sy = u[1] // N, u[1] % N\n for dx, dy in dd:\n tx, ty = sx + dx, sy + dy\n if tx < 0 or ty < 0 or tx >= N or ty >= N:\n continue\n v = u[:]\n n1, n2 = u[1], tx * N + ty\n v[1] = n2\n if n1 > n2:\n n1, n2 = n2, n1\n v[0] = v[0][0:n1] + v[0][n2] + v[0][n1 + 1 : n2] + v[0][n1] + v[0][n2 + 1 :]\n if not V.get(v[0], False):\n V[v[0]] = True\n v[2] += 1\n Q.put(v)\nprint((u[2]))\n", "code_v1_no_empty_lines": "import sys\nimport queue\n\nN = 3\nf = \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\nf += \"\".join(sys.stdin.readline().split())\ndd = [[-1, 0], [0, -1], [1, 0], [0, 1]]\nQ = [[f, f.index(\"0\"), 0]]\nV = {f: True}\nwhile len(Q) > 0:\n u = Q.pop(0)\n if u[0] == \"123456780\":\n break\n sx, sy = u[1] // N, u[1] % N\n for dx, dy in dd:\n tx, ty = sx + dx, sy + dy\n if tx < 0 or ty < 0 or tx >= N or ty >= N:\n continue\n v = u[:]\n n1, n2 = u[1], tx * N + ty\n v[1] = n2\n if n1 > n2:\n n1, n2 = n2, n1\n v[0] = v[0][0:n1] + v[0][n2] + v[0][n1 + 1 : n2] + v[0][n1] + v[0][n2 + 1 :]\n if not V.get(v[0], False):\n V[v[0]] = True\n v[2] += 1 # dir[r]\n Q.append(v)\nprint((u[2]))\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-Q = queue.Queue()", "-V = dict()", "-Q.put([f, f.index(\"0\"), 0])", "-V[f] = True", "-while not Q.empty():", "- u = Q.get()", "+Q = [[f, f.index(\"0\"), 0]]", "+V = {f: True}", "+while len(Q) > 0:", "+ u = Q.pop(0)", "- v[2] += 1", "- Q.put(v)", "+ v[2] += 1 # dir[r]", "+ Q.append(v)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5507428885, "measured_runtime_v1": 0.3782181978, "runtime_lift": 1.4561512154, "key": ["s424620538", "s007973982"], "target_token_count_dream": 325, "target_token_bucket_dream": "256-512"} +{"user_id": "u002459665", "problem_id": "p03854", "language": "python", "submission_id_v0": "s451133157", "submission_id_v1": "s498631928", "cpu_time_v0": 759, "cpu_time_v1": 146, "memory_v0": 3936, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.76, "input": "def main():\n\n S = input()\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n # print(w1,w2,w3,w4)\n\n S = S[::-1]\n\n # print(S)\n\n\n\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n\n words = [w1, w2, w3, w4]\n\n T = ''\n\n while S != T:\n\n cand = []\n\n for w in words:\n\n new_t = T + w\n\n cand.append(new_t) \n\n # print('cand', cand)\n\n ans = False\n\n for c in cand:\n\n if c == S[:len(c)]:\n\n T = c\n\n ans = True\n\n\n\n if not ans:\n\n break\n\n\n\n if S == T:\n\n print('YES')\n\n else:\n\n print(\"NO\")\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "def main():\n\n S = input()\n\n w1 = 'dream'[::-1]\n\n w2 = 'dreamer'[::-1]\n\n w3 = 'erase'[::-1]\n\n w4 = 'eraser'[::-1]\n\n S = S[::-1]\n\n words = [w1, w2, w3, w4]\n\n\n\n flag = False\n\n i = 0\n\n while i < len(S):\n\n for w in words:\n\n if S[i:].startswith(w):\n\n i += len(w)\n\n flag = True\n\n break\n\n\n\n if not flag:\n\n print(\"NO\")\n\n exit()\n\n flag = False\n\n\n\n print(\"YES\")\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 35, "code_v1_loc": 29, "code_v0_num_chars": 724, "code_v1_num_chars": 528, "code_v0_no_empty_lines": "def main():\n S = input()\n w1 = \"dream\"[::-1]\n w2 = \"dreamer\"[::-1]\n w3 = \"erase\"[::-1]\n w4 = \"eraser\"[::-1]\n # print(w1,w2,w3,w4)\n S = S[::-1]\n # print(S)\n # words = ['dream', 'dreamer', 'erase', 'eraser']\n words = [w1, w2, w3, w4]\n T = \"\"\n while S != T:\n cand = []\n for w in words:\n new_t = T + w\n cand.append(new_t)\n # print('cand', cand)\n ans = False\n for c in cand:\n if c == S[: len(c)]:\n T = c\n ans = True\n if not ans:\n break\n if S == T:\n print(\"YES\")\n else:\n print(\"NO\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "def main():\n S = input()\n w1 = \"dream\"[::-1]\n w2 = \"dreamer\"[::-1]\n w3 = \"erase\"[::-1]\n w4 = \"eraser\"[::-1]\n S = S[::-1]\n words = [w1, w2, w3, w4]\n flag = False\n i = 0\n while i < len(S):\n for w in words:\n if S[i:].startswith(w):\n i += len(w)\n flag = True\n break\n if not flag:\n print(\"NO\")\n exit()\n flag = False\n print(\"YES\")\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 17.1428571429, "diff": ["- # print(w1,w2,w3,w4)", "- # print(S)", "- # words = ['dream', 'dreamer', 'erase', 'eraser']", "- T = \"\"", "- while S != T:", "- cand = []", "+ flag = False", "+ i = 0", "+ while i < len(S):", "- new_t = T + w", "- cand.append(new_t)", "- # print('cand', cand)", "- ans = False", "- for c in cand:", "- if c == S[: len(c)]:", "- T = c", "- ans = True", "- if not ans:", "- break", "- if S == T:", "- print(\"YES\")", "- else:", "- print(\"NO\")", "+ if S[i:].startswith(w):", "+ i += len(w)", "+ flag = True", "+ break", "+ if not flag:", "+ print(\"NO\")", "+ exit()", "+ flag = False", "+ print(\"YES\")"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3388795207, "measured_runtime_v1": 0.2570693116, "runtime_lift": 1.3182418333, "key": ["s451133157", "s498631928"], "target_token_count_dream": 155, "target_token_bucket_dream": "128-256"} +{"user_id": "u761320129", "problem_id": "p03806", "language": "python", "submission_id_v0": "s128261336", "submission_id_v1": "s895482909", "cpu_time_v0": 493, "cpu_time_v1": 263, "memory_v0": 4852, "memory_v1": 4852, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 46.65, "input": "N,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\nmaxa = maxb = 0\n\nfor a,b,c in src:\n\n for ai in range(maxa,-1,-1):\n\n for bi in range(maxb,-1,-1):\n\n dp[ai+a][bi+b] = min(dp[ai+a][bi+b], dp[ai][bi] + c)\n\n maxa += a\n\n maxb += b\n\n\n\nans = INF\n\nfor i in range(1,401):\n\n if MA*i > 400 or MB*i > 400: break\n\n ans = min(ans, dp[MA*i][MB*i])\n\nprint((-1 if ans == INF else ans))", "target": "N,MA,MB = list(map(int,input().split()))\n\nsrc = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nINF = 10**9\n\nMAX = 401\n\ndp = [[INF] * MAX for i in range(MAX)]\n\ndp[0][0] = 0\n\namax = bmax = 0\n\nfor a,b,n in src:\n\n for i in reversed(list(range(bmax+1))):\n\n for j in range(amax+1):\n\n if dp[i][j] == INF: continue\n\n dp[i+b][j+a] = min(dp[i+b][j+a], dp[i][j] + n)\n\n amax += a\n\n bmax += b\n\n\n\nans = INF\n\nfor i in range(1,MAX):\n\n if i*MA >= MAX or i*MB >= MAX: break\n\n ans = min(ans, dp[i*MB][i*MA])\n\nprint((-1 if ans == INF else ans))", "code_v0_loc": 19, "code_v1_loc": 21, "code_v0_num_chars": 527, "code_v1_num_chars": 562, "code_v0_no_empty_lines": "N, MA, MB = list(map(int, input().split()))\nsrc = [tuple(map(int, input().split())) for i in range(N)]\nINF = 10**9\ndp = [[INF for j in range(401)] for i in range(401)]\ndp[0][0] = 0\nmaxa = maxb = 0\nfor a, b, c in src:\n for ai in range(maxa, -1, -1):\n for bi in range(maxb, -1, -1):\n dp[ai + a][bi + b] = min(dp[ai + a][bi + b], dp[ai][bi] + c)\n maxa += a\n maxb += b\nans = INF\nfor i in range(1, 401):\n if MA * i > 400 or MB * i > 400:\n break\n ans = min(ans, dp[MA * i][MB * i])\nprint((-1 if ans == INF else ans))\n", "code_v1_no_empty_lines": "N, MA, MB = list(map(int, input().split()))\nsrc = [tuple(map(int, input().split())) for i in range(N)]\nINF = 10**9\nMAX = 401\ndp = [[INF] * MAX for i in range(MAX)]\ndp[0][0] = 0\namax = bmax = 0\nfor a, b, n in src:\n for i in reversed(list(range(bmax + 1))):\n for j in range(amax + 1):\n if dp[i][j] == INF:\n continue\n dp[i + b][j + a] = min(dp[i + b][j + a], dp[i][j] + n)\n amax += a\n bmax += b\nans = INF\nfor i in range(1, MAX):\n if i * MA >= MAX or i * MB >= MAX:\n break\n ans = min(ans, dp[i * MB][i * MA])\nprint((-1 if ans == INF else ans))\n", "code_same": false, "relative_loc_diff_percent": 9.5238095238, "diff": ["-dp = [[INF for j in range(401)] for i in range(401)]", "+MAX = 401", "+dp = [[INF] * MAX for i in range(MAX)]", "-maxa = maxb = 0", "-for a, b, c in src:", "- for ai in range(maxa, -1, -1):", "- for bi in range(maxb, -1, -1):", "- dp[ai + a][bi + b] = min(dp[ai + a][bi + b], dp[ai][bi] + c)", "- maxa += a", "- maxb += b", "+amax = bmax = 0", "+for a, b, n in src:", "+ for i in reversed(list(range(bmax + 1))):", "+ for j in range(amax + 1):", "+ if dp[i][j] == INF:", "+ continue", "+ dp[i + b][j + a] = min(dp[i + b][j + a], dp[i][j] + n)", "+ amax += a", "+ bmax += b", "-for i in range(1, 401):", "- if MA * i > 400 or MB * i > 400:", "+for i in range(1, MAX):", "+ if i * MA >= MAX or i * MB >= MAX:", "- ans = min(ans, dp[MA * i][MB * i])", "+ ans = min(ans, dp[i * MB][i * MA])"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4613628248, "measured_runtime_v1": 0.3376750898, "runtime_lift": 1.3662921511, "key": ["s128261336", "s895482909"], "target_token_count_dream": 209, "target_token_bucket_dream": "128-256"} +{"user_id": "u678167152", "problem_id": "p03814", "language": "python", "submission_id_v0": "s292011694", "submission_id_v1": "s577750700", "cpu_time_v0": 173, "cpu_time_v1": 33, "memory_v0": 41456, "memory_v1": 9328, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.92, "input": "s = input()\n\na = s.find('A')\n\nz = s[::-1].find('Z')\n\nans = len(s)-a-z\n\n\n\nprint(ans)\n\n\n\n#print(*ans, sep='\\n')", "target": "def solve():\n\n S = input()\n\n a = S.find('A')\n\n z = S[::-1].find('Z')\n\n ans = len(S)-a-z\n\n return ans\n\nprint((solve()))", "code_v0_loc": 8, "code_v1_loc": 7, "code_v0_num_chars": 109, "code_v1_num_chars": 121, "code_v0_no_empty_lines": "s = input()\na = s.find(\"A\")\nz = s[::-1].find(\"Z\")\nans = len(s) - a - z\nprint(ans)\n# print(*ans, sep='\\n')\n", "code_v1_no_empty_lines": "def solve():\n S = input()\n a = S.find(\"A\")\n z = S[::-1].find(\"Z\")\n ans = len(S) - a - z\n return ans\n\n\nprint((solve()))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-s = input()", "-a = s.find(\"A\")", "-z = s[::-1].find(\"Z\")", "-ans = len(s) - a - z", "-print(ans)", "-# print(*ans, sep='\\n')", "+def solve():", "+ S = input()", "+ a = S.find(\"A\")", "+ z = S[::-1].find(\"Z\")", "+ ans = len(S) - a - z", "+ return ans", "+", "+", "+print((solve()))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3115016568, "measured_runtime_v1": 0.2242342863, "runtime_lift": 1.3891794243, "key": ["s292011694", "s577750700"], "target_token_count_dream": 44, "target_token_bucket_dream": "<128"} +{"user_id": "u729133443", "problem_id": "p03494", "language": "python", "submission_id_v0": "s130510697", "submission_id_v1": "s993121873", "cpu_time_v0": 166, "cpu_time_v1": 32, "memory_v0": 38256, "memory_v1": 9048, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 80.72, "input": "_,t=open(0);n=eval(t.replace(' ','|'));print((len(bin(n&-n))-3))", "target": "n=eval([*open(0)][1].replace(*' |'))\n\nprint((len(bin(n&-n))-3))", "code_v0_loc": 1, "code_v1_loc": 2, "code_v0_num_chars": 62, "code_v1_num_chars": 61, "code_v0_no_empty_lines": "_, t = open(0)\nn = eval(t.replace(\" \", \"|\"))\nprint((len(bin(n & -n)) - 3))\n", "code_v1_no_empty_lines": "n = eval([*open(0)][1].replace(*\" |\"))\nprint((len(bin(n & -n)) - 3))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-_, t = open(0)", "-n = eval(t.replace(\" \", \"|\"))", "+n = eval([*open(0)][1].replace(*\" |\"))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2380404282, "measured_runtime_v1": 0.1070810323, "runtime_lift": 2.2229934012, "key": ["s130510697", "s993121873"], "target_token_count_dream": 27, "target_token_bucket_dream": "<128"} +{"user_id": "u923662841", "problem_id": "p03309", "language": "python", "submission_id_v0": "s990999147", "submission_id_v1": "s307361938", "cpu_time_v0": 211, "cpu_time_v1": 159, "memory_v0": 34024, "memory_v1": 31160, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 24.64, "input": "import statistics\n\nN = int(input())\n\nA = [int(a)-i-1 for i,a in enumerate(input().split(),1)]\n\nb = statistics.median_low(A)\n\nc = statistics.median_high(A)\n\nd = sum([abs(x-b) for x in A])\n\ne = sum([abs(x-c) for x in A])\n\nprint((min(d,e)))", "target": "N=int(input())\n\nA=sorted(a-i-1 for i,a in enumerate(map(int,input().split())))\n\nprint((sum(abs(a-A[N//2]) for a in A)))", "code_v0_loc": 8, "code_v1_loc": 3, "code_v0_num_chars": 241, "code_v1_num_chars": 117, "code_v0_no_empty_lines": "import statistics\n\nN = int(input())\nA = [int(a) - i - 1 for i, a in enumerate(input().split(), 1)]\nb = statistics.median_low(A)\nc = statistics.median_high(A)\nd = sum([abs(x - b) for x in A])\ne = sum([abs(x - c) for x in A])\nprint((min(d, e)))\n", "code_v1_no_empty_lines": "N = int(input())\nA = sorted(a - i - 1 for i, a in enumerate(map(int, input().split())))\nprint((sum(abs(a - A[N // 2]) for a in A)))\n", "code_same": false, "relative_loc_diff_percent": 62.5, "diff": ["-import statistics", "-", "-A = [int(a) - i - 1 for i, a in enumerate(input().split(), 1)]", "-b = statistics.median_low(A)", "-c = statistics.median_high(A)", "-d = sum([abs(x - b) for x in A])", "-e = sum([abs(x - c) for x in A])", "-print((min(d, e)))", "+A = sorted(a - i - 1 for i, a in enumerate(map(int, input().split())))", "+print((sum(abs(a - A[N // 2]) for a in A)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3014758439, "measured_runtime_v1": 0.2369829128, "runtime_lift": 1.2721416931, "key": ["s990999147", "s307361938"], "target_token_count_dream": 38, "target_token_bucket_dream": "<128"} +{"user_id": "u294385082", "problem_id": "p03416", "language": "python", "submission_id_v0": "s823919342", "submission_id_v1": "s499216276", "cpu_time_v0": 175, "cpu_time_v1": 125, "memory_v0": 2940, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.57, "input": "a,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n new = list(reversed(list(str(i))))\n\n if new == list(str(i)):\n\n c += 1\n\n \n\n \n\nprint(c)", "target": "a,b = list(map(int,input().split()))\n\nc = 0\n\n\n\nfor i in range(a,b+1):\n\n if list(str(i)) == list(str(i))[::-1]:\n\n c += 1\n\n \n\n \n\nprint(c)", "code_v0_loc": 10, "code_v1_loc": 9, "code_v0_num_chars": 162, "code_v1_num_chars": 139, "code_v0_no_empty_lines": "a, b = list(map(int, input().split()))\nc = 0\nfor i in range(a, b + 1):\n new = list(reversed(list(str(i))))\n if new == list(str(i)):\n c += 1\nprint(c)\n", "code_v1_no_empty_lines": "a, b = list(map(int, input().split()))\nc = 0\nfor i in range(a, b + 1):\n if list(str(i)) == list(str(i))[::-1]:\n c += 1\nprint(c)\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["- new = list(reversed(list(str(i))))", "- if new == list(str(i)):", "+ if list(str(i)) == list(str(i))[::-1]:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7237584333, "measured_runtime_v1": 0.3522657444, "runtime_lift": 2.0545807954, "key": ["s823919342", "s499216276"], "target_token_count_dream": 49, "target_token_bucket_dream": "<128"} +{"user_id": "u325282913", "problem_id": "p03013", "language": "python", "submission_id_v0": "s961535130", "submission_id_v1": "s147927462", "cpu_time_v0": 230, "cpu_time_v1": 192, "memory_v0": 40940, "memory_v1": 7668, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.52, "input": "import sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int,input().split()))\n\nhole = [0] * (N+1)\n\nfor i in range(M):\n\n hole[int(input())] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nif N == 2:\n\n if hole[1] == 1:\n\n print((1))\n\n exit()\n\n if hole[1] == 0:\n\n print((2))\n\n exit()\n\nflg_one = False\n\nflg_two = False\n\nfirst = 1\n\nsecond = 2\n\nif hole[1] == 1:\n\n first = 0\n\n second = 1\n\n flg_one = True\n\nif hole[2] == 1:\n\n first = 1\n\n second = 0\n\n flg_two = True\n\nif flg_one and flg_two:\n\n print((0))\n\n exit()\n\n\n\nfor i in range(3,N):\n\n if hole[i] == 1:\n\n first = second\n\n second = 0\n\n continue\n\n tmp = first + second\n\n tmp %= 1000000007\n\n first = second\n\n second = tmp\n\ntmp = first + second\n\ntmp %= 1000000007\n\nprint(tmp)", "target": "MOD = 10**9 + 7\n\nN, M = list(map(int, input().split()))\n\nstairs = [0]*(N+1)\n\nfor _ in range(M):\n\n stairs[int(input())] = 1\n\nif N == 1:\n\n print((1))\n\n exit()\n\nans = [0]*(N+1)\n\nans[1] = 1 if stairs[1] == 0 else 0\n\nans[2] = 1 + ans[1] if stairs[2] == 0 else 0\n\nfor i in range(3,N+1):\n\n if stairs[i] == 1:\n\n ans[i] = 0\n\n continue\n\n ans[i] = (ans[i-1] + ans[i-2]) % MOD\n\nprint((ans[N]))", "code_v0_loc": 44, "code_v1_loc": 17, "code_v0_num_chars": 795, "code_v1_num_chars": 400, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nhole = [0] * (N + 1)\nfor i in range(M):\n hole[int(input())] = 1\nif N == 1:\n print((1))\n exit()\nif N == 2:\n if hole[1] == 1:\n print((1))\n exit()\n if hole[1] == 0:\n print((2))\n exit()\nflg_one = False\nflg_two = False\nfirst = 1\nsecond = 2\nif hole[1] == 1:\n first = 0\n second = 1\n flg_one = True\nif hole[2] == 1:\n first = 1\n second = 0\n flg_two = True\nif flg_one and flg_two:\n print((0))\n exit()\nfor i in range(3, N):\n if hole[i] == 1:\n first = second\n second = 0\n continue\n tmp = first + second\n tmp %= 1000000007\n first = second\n second = tmp\ntmp = first + second\ntmp %= 1000000007\nprint(tmp)\n", "code_v1_no_empty_lines": "MOD = 10**9 + 7\nN, M = list(map(int, input().split()))\nstairs = [0] * (N + 1)\nfor _ in range(M):\n stairs[int(input())] = 1\nif N == 1:\n print((1))\n exit()\nans = [0] * (N + 1)\nans[1] = 1 if stairs[1] == 0 else 0\nans[2] = 1 + ans[1] if stairs[2] == 0 else 0\nfor i in range(3, N + 1):\n if stairs[i] == 1:\n ans[i] = 0\n continue\n ans[i] = (ans[i - 1] + ans[i - 2]) % MOD\nprint((ans[N]))\n", "code_same": false, "relative_loc_diff_percent": 61.3636363636, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "+MOD = 10**9 + 7", "-hole = [0] * (N + 1)", "-for i in range(M):", "- hole[int(input())] = 1", "+stairs = [0] * (N + 1)", "+for _ in range(M):", "+ stairs[int(input())] = 1", "-if N == 2:", "- if hole[1] == 1:", "- print((1))", "- exit()", "- if hole[1] == 0:", "- print((2))", "- exit()", "-flg_one = False", "-flg_two = False", "-first = 1", "-second = 2", "-if hole[1] == 1:", "- first = 0", "- second = 1", "- flg_one = True", "-if hole[2] == 1:", "- first = 1", "- second = 0", "- flg_two = True", "-if flg_one and flg_two:", "- print((0))", "- exit()", "-for i in range(3, N):", "- if hole[i] == 1:", "- first = second", "- second = 0", "+ans = [0] * (N + 1)", "+ans[1] = 1 if stairs[1] == 0 else 0", "+ans[2] = 1 + ans[1] if stairs[2] == 0 else 0", "+for i in range(3, N + 1):", "+ if stairs[i] == 1:", "+ ans[i] = 0", "- tmp = first + second", "- tmp %= 1000000007", "- first = second", "- second = tmp", "-tmp = first + second", "-tmp %= 1000000007", "-print(tmp)", "+ ans[i] = (ans[i - 1] + ans[i - 2]) % MOD", "+print((ans[N]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3368466201, "measured_runtime_v1": 0.2647972648, "runtime_lift": 1.2720925207, "key": ["s961535130", "s147927462"], "target_token_count_dream": 169, "target_token_bucket_dream": "128-256"} +{"user_id": "u585482323", "problem_id": "p03558", "language": "python", "submission_id_v0": "s378178699", "submission_id_v1": "s370816259", "cpu_time_v0": 982, "cpu_time_v1": 230, "memory_v0": 88880, "memory_v1": 47180, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 76.58, "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n s = S()\n\n t = S()\n\n if s+t == t[::-1]+s[::-1]:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n\n\n#B\n\ndef B():\n\n n = I()\n\n for i in range(int(n**0.5)+2)[::-1]:\n\n if i*i <= n:\n\n print((i*i))\n\n quit()\n\n#C\n\ndef C():\n\n n = I()\n\n a = LI()\n\n b = LI()\n\n c = LI()\n\n q = [0 for i in range(n)]\n\n ans = 0\n\n a.sort()\n\n b.sort()\n\n c.sort()\n\n for i in range(n):\n\n j = bisect.bisect_left(a,b[i])\n\n q[i] = j\n\n for i in range(n-1):\n\n q[i+1] += q[i]\n\n q.insert(0,0)\n\n for i in range(n):\n\n j = bisect.bisect_left(b,c[i])\n\n ans += q[j]\n\n print(ans)\n\n#D\n\ndef D():\n\n def dijkstra():\n\n d = [float(\"inf\") for i in range(k)]\n\n q = [[0,1]]\n\n d[1] = 0\n\n while q:\n\n dx,x = heappop(q)\n\n for y,dy in v[x]:\n\n if d[y] > dx+dy:\n\n d[y] = dx+dy\n\n heappush(q,[d[y],y])\n\n print((d[0]+1))\n\n k = I()\n\n if k == 1:\n\n print((1))\n\n quit()\n\n v = [[] for i in range(k)]\n\n for i in range(1,k):\n\n v[i].append([(i+1)%k,1])\n\n v[i].append([i*10%k,0])\n\n dijkstra()\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n return\n\n\n\n#G\n\ndef G():\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n D()\n", "target": "#!usr/bin/env python3\n\nfrom collections import defaultdict,deque\n\nfrom heapq import heappush, heappop\n\nfrom itertools import permutations\n\nimport sys\n\nimport math\n\nimport bisect\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\n\ndef S():\n\n res = list(sys.stdin.readline())\n\n if res[-1] == \"\\n\":\n\n return res[:-1]\n\n return res\n\ndef IR(n):\n\n return [I() for i in range(n)]\n\ndef LIR(n):\n\n return [LI() for i in range(n)]\n\ndef SR(n):\n\n return [S() for i in range(n)]\n\ndef LSR(n):\n\n return [LS() for i in range(n)]\n\n\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\ndef solve():\n\n def v(n):\n\n return [n*10%k, (n+1)%k]\n\n k = I()\n\n d = [float(\"inf\")]*k\n\n d[1] = 1\n\n q = deque([1])\n\n while q:\n\n x = q.popleft()\n\n vx = v(x)\n\n dx = d[x]\n\n for c in range(2):\n\n nd = dx+c\n\n y = vx[c]\n\n if nd < d[y]:\n\n d[y] = nd\n\n if c:\n\n q.append(y)\n\n else:\n\n q.appendleft(y)\n\n print((d[0]))\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n solve()\n", "code_v0_loc": 108, "code_v1_loc": 53, "code_v0_num_chars": 2164, "code_v1_num_chars": 1252, "code_v0_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\ndef A():\n s = S()\n t = S()\n if s + t == t[::-1] + s[::-1]:\n print(\"YES\")\n else:\n print(\"NO\")\n\n\n# B\ndef B():\n n = I()\n for i in range(int(n**0.5) + 2)[::-1]:\n if i * i <= n:\n print((i * i))\n quit()\n\n\n# C\ndef C():\n n = I()\n a = LI()\n b = LI()\n c = LI()\n q = [0 for i in range(n)]\n ans = 0\n a.sort()\n b.sort()\n c.sort()\n for i in range(n):\n j = bisect.bisect_left(a, b[i])\n q[i] = j\n for i in range(n - 1):\n q[i + 1] += q[i]\n q.insert(0, 0)\n for i in range(n):\n j = bisect.bisect_left(b, c[i])\n ans += q[j]\n print(ans)\n\n\n# D\ndef D():\n def dijkstra():\n d = [float(\"inf\") for i in range(k)]\n q = [[0, 1]]\n d[1] = 0\n while q:\n dx, x = heappop(q)\n for y, dy in v[x]:\n if d[y] > dx + dy:\n d[y] = dx + dy\n heappush(q, [d[y], y])\n print((d[0] + 1))\n\n k = I()\n if k == 1:\n print((1))\n quit()\n v = [[] for i in range(k)]\n for i in range(1, k):\n v[i].append([(i + 1) % k, 1])\n v[i].append([i * 10 % k, 0])\n dijkstra()\n\n\n# E\ndef E():\n return\n\n\n# F\ndef F():\n return\n\n\n# G\ndef G():\n return\n\n\n# H\ndef H():\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n D()\n", "code_v1_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations\nimport sys\nimport math\nimport bisect\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == \"\\n\":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n\n\ndef solve():\n def v(n):\n return [n * 10 % k, (n + 1) % k]\n\n k = I()\n d = [float(\"inf\")] * k\n d[1] = 1\n q = deque([1])\n while q:\n x = q.popleft()\n vx = v(x)\n dx = d[x]\n for c in range(2):\n nd = dx + c\n y = vx[c]\n if nd < d[y]:\n d[y] = nd\n if c:\n q.append(y)\n else:\n q.appendleft(y)\n print((d[0]))\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 50.9259259259, "diff": ["-from collections import defaultdict", "-from collections import deque", "+from collections import defaultdict, deque", "+from itertools import permutations", "-import random", "- return list(map(int, sys.stdin.readline().split()))", "+ return [int(x) for x in sys.stdin.readline().split()]", "- return list(map(list, sys.stdin.readline().split()))", "+ return [list(x) for x in sys.stdin.readline().split()]", "- return list(sys.stdin.readline())[:-1]", "+ res = list(sys.stdin.readline())", "+ if res[-1] == \"\\n\":", "+ return res[:-1]", "+ return res", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = I()", "- return l", "+ return [I() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = LI()", "- return l", "+ return [LI() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = S()", "- return l", "+ return [S() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = SR()", "- return l", "+ return [LS() for i in range(n)]", "+sys.setrecursionlimit(1000000)", "-# A", "-def A():", "- s = S()", "- t = S()", "- if s + t == t[::-1] + s[::-1]:", "- print(\"YES\")", "- else:", "- print(\"NO\")", "-# B", "-def B():", "- n = I()", "- for i in range(int(n**0.5) + 2)[::-1]:", "- if i * i <= n:", "- print((i * i))", "- quit()", "-", "-", "-# C", "-def C():", "- n = I()", "- a = LI()", "- b = LI()", "- c = LI()", "- q = [0 for i in range(n)]", "- ans = 0", "- a.sort()", "- b.sort()", "- c.sort()", "- for i in range(n):", "- j = bisect.bisect_left(a, b[i])", "- q[i] = j", "- for i in range(n - 1):", "- q[i + 1] += q[i]", "- q.insert(0, 0)", "- for i in range(n):", "- j = bisect.bisect_left(b, c[i])", "- ans += q[j]", "- print(ans)", "-", "-", "-# D", "-def D():", "- def dijkstra():", "- d = [float(\"inf\") for i in range(k)]", "- q = [[0, 1]]", "- d[1] = 0", "- while q:", "- dx, x = heappop(q)", "- for y, dy in v[x]:", "- if d[y] > dx + dy:", "- d[y] = dx + dy", "- heappush(q, [d[y], y])", "- print((d[0] + 1))", "+def solve():", "+ def v(n):", "+ return [n * 10 % k, (n + 1) % k]", "- if k == 1:", "- print((1))", "- quit()", "- v = [[] for i in range(k)]", "- for i in range(1, k):", "- v[i].append([(i + 1) % k, 1])", "- v[i].append([i * 10 % k, 0])", "- dijkstra()", "-", "-", "-# E", "-def E():", "- return", "-", "-", "-# F", "-def F():", "- return", "-", "-", "-# G", "-def G():", "- return", "-", "-", "-# H", "-def H():", "+ d = [float(\"inf\")] * k", "+ d[1] = 1", "+ q = deque([1])", "+ while q:", "+ x = q.popleft()", "+ vx = v(x)", "+ dx = d[x]", "+ for c in range(2):", "+ nd = dx + c", "+ y = vx[c]", "+ if nd < d[y]:", "+ d[y] = nd", "+ if c:", "+ q.append(y)", "+ else:", "+ q.appendleft(y)", "+ print((d[0]))", "- D()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.6112481251, "measured_runtime_v1": 0.2866115916, "runtime_lift": 2.1326706352, "key": ["s378178699", "s370816259"], "target_token_count_dream": 363, "target_token_bucket_dream": "256-512"} +{"user_id": "u089230684", "problem_id": "p03796", "language": "python", "submission_id_v0": "s560811979", "submission_id_v1": "s868944422", "cpu_time_v0": 230, "cpu_time_v1": 37, "memory_v0": 3984, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 83.91, "input": "import math\n\nx = int(input())\n\nprint((math.factorial(x) % (10**9 + 7)))", "target": "n = int(input())\n\nfact = 1\n\nfor i in range(1,n+1):\n\n fact = fact * i % (10**9 +7)\n\nres = fact % (10**9 + 7)\n\nprint(res)", "code_v0_loc": 3, "code_v1_loc": 6, "code_v0_num_chars": 69, "code_v1_num_chars": 120, "code_v0_no_empty_lines": "import math\n\nx = int(input())\nprint((math.factorial(x) % (10**9 + 7)))\n", "code_v1_no_empty_lines": "n = int(input())\nfact = 1\nfor i in range(1, n + 1):\n fact = fact * i % (10**9 + 7)\nres = fact % (10**9 + 7)\nprint(res)\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-import math", "-", "-x = int(input())", "-print((math.factorial(x) % (10**9 + 7)))", "+n = int(input())", "+fact = 1", "+for i in range(1, n + 1):", "+ fact = fact * i % (10**9 + 7)", "+res = fact % (10**9 + 7)", "+print(res)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5532854562, "measured_runtime_v1": 0.2473686228, "runtime_lift": 2.2366840626, "key": ["s560811979", "s868944422"], "target_token_count_dream": 51, "target_token_bucket_dream": "<128"} +{"user_id": "u164727245", "problem_id": "p02596", "language": "python", "submission_id_v0": "s121951272", "submission_id_v1": "s390007993", "cpu_time_v0": 131, "cpu_time_v1": 33, "memory_v0": 9476, "memory_v1": 9244, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 74.81, "input": "# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k//7 if k % 7 == 0 else k)\n\n if l % 2 == 0 or l % 5 == 0:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(-pow(l, 1/2))):\n\n if r % i == 0:\n\n phi = phi//i*(i-1)\n\n while r % i:\n\n r //= i\n\n\n\n a = 10 % l\n\n ret = 1\n\n while(a != 1):\n\n a = a*10 % l\n\n ret += 1\n\n if phi < ret:\n\n ret = -1\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "target": "# coding: utf-8\n\nfrom math import sqrt\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k//7 if 0 == k % 7 else k)\n\n if 0 == l % 2 or 0 == l % 5:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(sqrt(l)+1)):\n\n if 0 == r % i:\n\n phi = phi*(i-1)//i\n\n while 0 == r % i:\n\n r //= i\n\n if 1 < r:\n\n phi = phi*(r-1)//r\n\n\n\n D = set()\n\n for d in range(1, int(sqrt(phi)+1)):\n\n if 0 == phi % d:\n\n D.add(d)\n\n D.add(phi//d)\n\n\n\n ret = -1\n\n for m in sorted(D):\n\n if 1 == pow(10, m, l):\n\n ret = m\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n", "code_v0_loc": 31, "code_v1_loc": 37, "code_v0_num_chars": 598, "code_v1_num_chars": 758, "code_v0_no_empty_lines": "# coding: utf-8\ndef solve(*args: str) -> str:\n k = int(args[0])\n l = 9 * (k // 7 if k % 7 == 0 else k)\n if l % 2 == 0 or l % 5 == 0:\n return \"-1\"\n r = phi = l\n for i in range(2, int(-pow(l, 1 / 2))):\n if r % i == 0:\n phi = phi // i * (i - 1)\n while r % i:\n r //= i\n a = 10 % l\n ret = 1\n while a != 1:\n a = a * 10 % l\n ret += 1\n if phi < ret:\n ret = -1\n break\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_v1_no_empty_lines": "# coding: utf-8\nfrom math import sqrt\n\n\ndef solve(*args: str) -> str:\n k = int(args[0])\n l = 9 * (k // 7 if 0 == k % 7 else k)\n if 0 == l % 2 or 0 == l % 5:\n return \"-1\"\n r = phi = l\n for i in range(2, int(sqrt(l) + 1)):\n if 0 == r % i:\n phi = phi * (i - 1) // i\n while 0 == r % i:\n r //= i\n if 1 < r:\n phi = phi * (r - 1) // r\n D = set()\n for d in range(1, int(sqrt(phi) + 1)):\n if 0 == phi % d:\n D.add(d)\n D.add(phi // d)\n ret = -1\n for m in sorted(D):\n if 1 == pow(10, m, l):\n ret = m\n break\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n", "code_same": false, "relative_loc_diff_percent": 16.2162162162, "diff": ["+from math import sqrt", "+", "+", "- l = 9 * (k // 7 if k % 7 == 0 else k)", "- if l % 2 == 0 or l % 5 == 0:", "+ l = 9 * (k // 7 if 0 == k % 7 else k)", "+ if 0 == l % 2 or 0 == l % 5:", "- for i in range(2, int(-pow(l, 1 / 2))):", "- if r % i == 0:", "- phi = phi // i * (i - 1)", "- while r % i:", "+ for i in range(2, int(sqrt(l) + 1)):", "+ if 0 == r % i:", "+ phi = phi * (i - 1) // i", "+ while 0 == r % i:", "- a = 10 % l", "- ret = 1", "- while a != 1:", "- a = a * 10 % l", "- ret += 1", "- if phi < ret:", "- ret = -1", "+ if 1 < r:", "+ phi = phi * (r - 1) // r", "+ D = set()", "+ for d in range(1, int(sqrt(phi) + 1)):", "+ if 0 == phi % d:", "+ D.add(d)", "+ D.add(phi // d)", "+ ret = -1", "+ for m in sorted(D):", "+ if 1 == pow(10, m, l):", "+ ret = m"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4349818358, "measured_runtime_v1": 0.2757263954, "runtime_lift": 1.5775850377, "key": ["s121951272", "s390007993"], "target_token_count_dream": 253, "target_token_bucket_dream": "128-256"} +{"user_id": "u618107373", "problem_id": "p03013", "language": "python", "submission_id_v0": "s205446737", "submission_id_v1": "s887904874", "cpu_time_v0": 450, "cpu_time_v1": 113, "memory_v0": 473344, "memory_v1": 11884, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 74.89, "input": "import sys\n\nsys.setrecursionlimit(100000)\n\n\n\ndef intinput(): return list(map(int,sys.stdin.readline().split()))\n\n\n\nfib={0:0,1:1,2:1}\n\nfor i in range(3,100003):\n\n fib[i]=fib[i-1]+fib[i-2]\n\n # fib.append(fib[i-1]+fib[i-2])\n\n\n\nn,m=intinput()\n\nmod=10**9+7\n\na=[int(sys.stdin.readline()) for _ in range(m)]\n\nif m!=0:\n\n l=[a[0]]\n\n for i in range(len(a)-1):\n\n l.append(a[i+1]-a[i]-1)\n\n l.append(n-a[-1])\n\n k=1\n\n for i in l:\n\n k=fib[i]*k%mod\n\n print((k%mod))\n\nelse:\n\n print((fib[n+1]%mod))", "target": "import sys\n\nsys.setrecursionlimit(100000)\n\n\n\ndef intinput(): return list(map(int,sys.stdin.readline().split()))\n\n\n\n\n\nn, m = intinput()\n\na = {int(sys.stdin.readline()) for _ in range(m)}\n\nmemo = [0 for x in range(n + 4)]\n\nmemo[0] = 1\n\nmod = 10 ** 9 + 7\n\nfor i in range(n):\n\n if i + 1 not in a:\n\n memo[i + 1] = (memo[i + 1] + memo[i]) % mod\n\n if i + 2 not in a:\n\n memo[i + 2] = (memo[i + 2] + memo[i]) % mod\n\nprint((memo[n]))", "code_v0_loc": 24, "code_v1_loc": 17, "code_v0_num_chars": 510, "code_v1_num_chars": 435, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(100000)\n\n\ndef intinput():\n return list(map(int, sys.stdin.readline().split()))\n\n\nfib = {0: 0, 1: 1, 2: 1}\nfor i in range(3, 100003):\n fib[i] = fib[i - 1] + fib[i - 2]\n# fib.append(fib[i-1]+fib[i-2])\nn, m = intinput()\nmod = 10**9 + 7\na = [int(sys.stdin.readline()) for _ in range(m)]\nif m != 0:\n l = [a[0]]\n for i in range(len(a) - 1):\n l.append(a[i + 1] - a[i] - 1)\n l.append(n - a[-1])\n k = 1\n for i in l:\n k = fib[i] * k % mod\n print((k % mod))\nelse:\n print((fib[n + 1] % mod))\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(100000)\n\n\ndef intinput():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn, m = intinput()\na = {int(sys.stdin.readline()) for _ in range(m)}\nmemo = [0 for x in range(n + 4)]\nmemo[0] = 1\nmod = 10**9 + 7\nfor i in range(n):\n if i + 1 not in a:\n memo[i + 1] = (memo[i + 1] + memo[i]) % mod\n if i + 2 not in a:\n memo[i + 2] = (memo[i + 2] + memo[i]) % mod\nprint((memo[n]))\n", "code_same": false, "relative_loc_diff_percent": 29.1666666667, "diff": ["-fib = {0: 0, 1: 1, 2: 1}", "-for i in range(3, 100003):", "- fib[i] = fib[i - 1] + fib[i - 2]", "-# fib.append(fib[i-1]+fib[i-2])", "+a = {int(sys.stdin.readline()) for _ in range(m)}", "+memo = [0 for x in range(n + 4)]", "+memo[0] = 1", "-a = [int(sys.stdin.readline()) for _ in range(m)]", "-if m != 0:", "- l = [a[0]]", "- for i in range(len(a) - 1):", "- l.append(a[i + 1] - a[i] - 1)", "- l.append(n - a[-1])", "- k = 1", "- for i in l:", "- k = fib[i] * k % mod", "- print((k % mod))", "-else:", "- print((fib[n + 1] % mod))", "+for i in range(n):", "+ if i + 1 not in a:", "+ memo[i + 1] = (memo[i + 1] + memo[i]) % mod", "+ if i + 2 not in a:", "+ memo[i + 2] = (memo[i + 2] + memo[i]) % mod", "+print((memo[n]))"], "diff_only_import_comment": false, "measured_runtime_v0": 3.8133613999, "measured_runtime_v1": 0.2074506006, "runtime_lift": 18.3820214944, "key": ["s205446737", "s887904874"], "target_token_count_dream": 161, "target_token_bucket_dream": "128-256"} +{"user_id": "u732061897", "problem_id": "p02767", "language": "python", "submission_id_v0": "s699773211", "submission_id_v1": "s064206410", "cpu_time_v0": 21, "cpu_time_v1": 18, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.29, "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nanswer = 10 ** 9\n\nfor i in range(1,101):\n\n tmp = 0\n\n for a in A:\n\n tmp += abs(a-i) ** 2\n\n answer = min(answer,tmp)\n\nprint(answer)", "target": "N = int(input())\n\nA = list(map(int, input().split()))\n\nchushin = sum(A)//N\n\nchushin_1 = sum(A)//N +1\n\nanswer = 0\n\nanswer_1 = 0\n\nfor a in A:\n\n answer += abs(a-chushin) ** 2\n\n answer_1 += abs(a-chushin_1) ** 2\n\nprint((min(answer,answer_1)))", "code_v0_loc": 9, "code_v1_loc": 10, "code_v0_num_chars": 200, "code_v1_num_chars": 242, "code_v0_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nanswer = 10**9\nfor i in range(1, 101):\n tmp = 0\n for a in A:\n tmp += abs(a - i) ** 2\n answer = min(answer, tmp)\nprint(answer)\n", "code_v1_no_empty_lines": "N = int(input())\nA = list(map(int, input().split()))\nchushin = sum(A) // N\nchushin_1 = sum(A) // N + 1\nanswer = 0\nanswer_1 = 0\nfor a in A:\n answer += abs(a - chushin) ** 2\n answer_1 += abs(a - chushin_1) ** 2\nprint((min(answer, answer_1)))\n", "code_same": false, "relative_loc_diff_percent": 10.0, "diff": ["-answer = 10**9", "-for i in range(1, 101):", "- tmp = 0", "- for a in A:", "- tmp += abs(a - i) ** 2", "- answer = min(answer, tmp)", "-print(answer)", "+chushin = sum(A) // N", "+chushin_1 = sum(A) // N + 1", "+answer = 0", "+answer_1 = 0", "+for a in A:", "+ answer += abs(a - chushin) ** 2", "+ answer_1 += abs(a - chushin_1) ** 2", "+print((min(answer, answer_1)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3756797752, "measured_runtime_v1": 0.2943871524, "runtime_lift": 1.2761418836, "key": ["s699773211", "s064206410"], "target_token_count_dream": 93, "target_token_bucket_dream": "<128"} +{"user_id": "u606045429", "problem_id": "p02850", "language": "python", "submission_id_v0": "s780367922", "submission_id_v1": "s062691036", "cpu_time_v0": 222, "cpu_time_v1": 198, "memory_v0": 25900, "memory_v1": 25900, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.81, "input": "\"\"\"\n\nchallenge case\n\n\n\nin:\n\n3\n\n1 3\n\n2 3\n\n\n\nout:\n\n1\n\n1\n\n1\n\n\"\"\"\n\n\n\nfrom collections import deque\n\n\n\ndef main():\n\n\tN, *AB = list(map(int, open(0).read().split()))\n\n\tB = AB[1::2]\n\n\n\n\tE = [[] for _ in range(N + 1)]\n\n\tfor a, b in zip(*[iter(AB)] * 2):\n\n\t\tE[a] += b,\n\n\n\n\tQ = deque([1])\n\n\tC = [0] * (N + 1)\n\n\twhile Q:\n\n\t\tv = Q.popleft()\n\n\t\tc = 0\n\n\t\tfor u in E[v]:\n\n\t\t\tc += 1 + (c + 1 == C[v])\n\n\t\t\tC[u] = c\n\n\t\t\tQ += u,\n\n\n\n\tprint((max(C)))\n\n\tfor b in B:\n\n\t\tprint((C[b]))\n\n\n\nmain()", "target": "\"\"\"\n\nchallenge case\n\n\n\nin:\n\n3\n\n1 3\n\n2 3\n\n\n\nout:\n\n1\n\n1\n\n1\n\n\"\"\"\n\n\n\nfrom collections import deque\n\n\n\ndef main():\n\n\tN, *AB = list(map(int, open(0).read().split()))\n\n\tB = AB[1::2]\n\n\n\n\tE = [[] for _ in range(N + 1)]\n\n\tfor a, b in zip(*[iter(AB)] * 2):\n\n\t\tE[a].append(b)\n\n\n\n\tQ = deque([1])\n\n\tC = [0] * (N + 1)\n\n\twhile Q:\n\n\t\tv = Q.popleft()\n\n\t\tc = 0\n\n\t\tfor u in E[v]:\n\n\t\t\tc += 1 + (c + 1 == C[v])\n\n\t\t\tC[u] = c\n\n\t\t\tQ.append(u)\n\n\n\n\tprint((max(C)))\n\n\tfor b in B:\n\n\t\tprint((C[b]))\n\n\n\nmain()", "code_v0_loc": 39, "code_v1_loc": 39, "code_v0_num_chars": 460, "code_v1_num_chars": 468, "code_v0_no_empty_lines": "\"\"\"\nchallenge case\nin:\n3\n1 3\n2 3\nout:\n1\n1\n1\n\"\"\"\nfrom collections import deque\n\n\ndef main():\n N, *AB = list(map(int, open(0).read().split()))\n B = AB[1::2]\n E = [[] for _ in range(N + 1)]\n for a, b in zip(*[iter(AB)] * 2):\n E[a] += (b,)\n Q = deque([1])\n C = [0] * (N + 1)\n while Q:\n v = Q.popleft()\n c = 0\n for u in E[v]:\n c += 1 + (c + 1 == C[v])\n C[u] = c\n Q += (u,)\n print((max(C)))\n for b in B:\n print((C[b]))\n\n\nmain()\n", "code_v1_no_empty_lines": "\"\"\"\nchallenge case\nin:\n3\n1 3\n2 3\nout:\n1\n1\n1\n\"\"\"\nfrom collections import deque\n\n\ndef main():\n N, *AB = list(map(int, open(0).read().split()))\n B = AB[1::2]\n E = [[] for _ in range(N + 1)]\n for a, b in zip(*[iter(AB)] * 2):\n E[a].append(b)\n Q = deque([1])\n C = [0] * (N + 1)\n while Q:\n v = Q.popleft()\n c = 0\n for u in E[v]:\n c += 1 + (c + 1 == C[v])\n C[u] = c\n Q.append(u)\n print((max(C)))\n for b in B:\n print((C[b]))\n\n\nmain()\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["- E[a] += (b,)", "+ E[a].append(b)", "- Q += (u,)", "+ Q.append(u)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2432860727, "measured_runtime_v1": 0.1842362597, "runtime_lift": 1.3205113538, "key": ["s780367922", "s062691036"], "target_token_count_dream": 181, "target_token_bucket_dream": "128-256"} +{"user_id": "u648212584", "problem_id": "p03253", "language": "python", "submission_id_v0": "s901379470", "submission_id_v1": "s767594103", "cpu_time_v0": 251, "cpu_time_v1": 204, "memory_v0": 16168, "memory_v1": 45680, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.73, "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\nfrom collections import defaultdict\n\nimport copy\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n d = defaultdict(int)\n\n MOD = 10**9+7\n\n R = 10**5+100\n\n fac = [0 for _ in range(R+1)]\n\n fac[0],fac[1] = 1,1\n\n inv = copy.deepcopy(fac)\n\n invfac = copy.deepcopy(fac)\n\n \n\n for i in range(2,R+1):\n\n fac[i] = (fac[i-1]*i)%MOD\n\n inv[i] = MOD-(MOD//i)*inv[MOD%i]%MOD\n\n invfac[i] = (invfac[i-1]*inv[i])%MOD\n\n \n\n def coef(x,y):\n\n num = (((fac[x+y]*invfac[y])%MOD)*invfac[x]%MOD)\n\n return num\n\n\n\n while M%2 == 0:\n\n d[2] += 1\n\n M //= 2\n\n f = 3\n\n while f ** 2 <= M:\n\n if M % f == 0:\n\n d[f] += 1\n\n M //= f\n\n else:\n\n f += 2\n\n if M != 1:\n\n d[M] += 1\n\n \n\n l = list(d.values())\n\n ans = 1\n\n for num in l:\n\n ans *= coef(num,N-1)\n\n ans %= MOD\n\n \n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()", "target": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n MOD = 10**9+7\n\n \n\n def factorization(n):\n\n arr = []\n\n temp = n\n\n for i in range(2, int(-(-n**0.5//1))+1):\n\n if temp%i==0:\n\n cnt=0\n\n while temp%i==0:\n\n cnt+=1\n\n temp //= i\n\n arr.append([i, cnt])\n\n\n\n if temp!=1:\n\n arr.append([temp, 1])\n\n\n\n return arr\n\n \n\n cl = factorization(M)\n\n \n\n def combinations(x,y,N):\n\n fac = [0]*(N+1)\n\n fac[0],fac[1] = 1,1\n\n \n\n for i in range(2,N+1):\n\n fac[i] = (fac[i-1]*i)%MOD\n\n \n\n return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD\n\n \n\n ans = 1\n\n for pr,num in cl:\n\n ans *= combinations(N-1,num,N+num)\n\n ans %= MOD\n\n \n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()\n", "code_v0_loc": 47, "code_v1_loc": 43, "code_v0_num_chars": 1020, "code_v1_num_chars": 972, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nfrom collections import defaultdict\nimport copy\n\n\ndef main():\n N, M = list(map(int, input().split()))\n d = defaultdict(int)\n MOD = 10**9 + 7\n R = 10**5 + 100\n fac = [0 for _ in range(R + 1)]\n fac[0], fac[1] = 1, 1\n inv = copy.deepcopy(fac)\n invfac = copy.deepcopy(fac)\n for i in range(2, R + 1):\n fac[i] = (fac[i - 1] * i) % MOD\n inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD\n invfac[i] = (invfac[i - 1] * inv[i]) % MOD\n\n def coef(x, y):\n num = ((fac[x + y] * invfac[y]) % MOD) * invfac[x] % MOD\n return num\n\n while M % 2 == 0:\n d[2] += 1\n M //= 2\n f = 3\n while f**2 <= M:\n if M % f == 0:\n d[f] += 1\n M //= f\n else:\n f += 2\n if M != 1:\n d[M] += 1\n l = list(d.values())\n ans = 1\n for num in l:\n ans *= coef(num, N - 1)\n ans %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\ndef main():\n N, M = list(map(int, input().split()))\n MOD = 10**9 + 7\n\n def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-(n**0.5) // 1)) + 1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp //= i\n arr.append([i, cnt])\n if temp != 1:\n arr.append([temp, 1])\n return arr\n\n cl = factorization(M)\n\n def combinations(x, y, N):\n fac = [0] * (N + 1)\n fac[0], fac[1] = 1, 1\n for i in range(2, N + 1):\n fac[i] = (fac[i - 1] * i) % MOD\n return (\n fac[x + y] * pow(fac[x], MOD - 2, MOD) * pow(fac[y], MOD - 2, MOD)\n ) % MOD\n\n ans = 1\n for pr, num in cl:\n ans *= combinations(N - 1, num, N + num)\n ans %= MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 8.5106382979, "diff": ["-from collections import defaultdict", "-import copy", "- d = defaultdict(int)", "- R = 10**5 + 100", "- fac = [0 for _ in range(R + 1)]", "- fac[0], fac[1] = 1, 1", "- inv = copy.deepcopy(fac)", "- invfac = copy.deepcopy(fac)", "- for i in range(2, R + 1):", "- fac[i] = (fac[i - 1] * i) % MOD", "- inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD", "- invfac[i] = (invfac[i - 1] * inv[i]) % MOD", "- def coef(x, y):", "- num = ((fac[x + y] * invfac[y]) % MOD) * invfac[x] % MOD", "- return num", "+ def factorization(n):", "+ arr = []", "+ temp = n", "+ for i in range(2, int(-(-(n**0.5) // 1)) + 1):", "+ if temp % i == 0:", "+ cnt = 0", "+ while temp % i == 0:", "+ cnt += 1", "+ temp //= i", "+ arr.append([i, cnt])", "+ if temp != 1:", "+ arr.append([temp, 1])", "+ return arr", "- while M % 2 == 0:", "- d[2] += 1", "- M //= 2", "- f = 3", "- while f**2 <= M:", "- if M % f == 0:", "- d[f] += 1", "- M //= f", "- else:", "- f += 2", "- if M != 1:", "- d[M] += 1", "- l = list(d.values())", "+ cl = factorization(M)", "+", "+ def combinations(x, y, N):", "+ fac = [0] * (N + 1)", "+ fac[0], fac[1] = 1, 1", "+ for i in range(2, N + 1):", "+ fac[i] = (fac[i - 1] * i) % MOD", "+ return (", "+ fac[x + y] * pow(fac[x], MOD - 2, MOD) * pow(fac[y], MOD - 2, MOD)", "+ ) % MOD", "+", "- for num in l:", "- ans *= coef(num, N - 1)", "+ for pr, num in cl:", "+ ans *= combinations(N - 1, num, N + num)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.7565106795, "measured_runtime_v1": 0.2943952236, "runtime_lift": 5.9665053592, "key": ["s901379470", "s767594103"], "target_token_count_dream": 280, "target_token_bucket_dream": "256-512"} +{"user_id": "u440161695", "problem_id": "p03107", "language": "python", "submission_id_v0": "s703980325", "submission_id_v1": "s025529722", "cpu_time_v0": 26, "cpu_time_v1": 18, "memory_v0": 3444, "memory_v1": 3188, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 30.77, "input": "from collections import Counter\n\nd={chr(i):0 for i in range(2)}\n\ns=Counter(input())\n\nd=d.update(s)\n\nprint((min(s[\"0\"],s[\"1\"])*2))", "target": "s=input()\n\nprint((min(s.count(\"0\"),s.count(\"1\"))*2))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 127, "code_v1_num_chars": 50, "code_v0_no_empty_lines": "from collections import Counter\n\nd = {chr(i): 0 for i in range(2)}\ns = Counter(input())\nd = d.update(s)\nprint((min(s[\"0\"], s[\"1\"]) * 2))\n", "code_v1_no_empty_lines": "s = input()\nprint((min(s.count(\"0\"), s.count(\"1\")) * 2))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-from collections import Counter", "-", "-d = {chr(i): 0 for i in range(2)}", "-s = Counter(input())", "-d = d.update(s)", "-print((min(s[\"0\"], s[\"1\"]) * 2))", "+s = input()", "+print((min(s.count(\"0\"), s.count(\"1\")) * 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5096813786, "measured_runtime_v1": 0.1983500416, "runtime_lift": 2.5696056043, "key": ["s703980325", "s025529722"], "target_token_count_dream": 19, "target_token_bucket_dream": "<128"} +{"user_id": "u912237403", "problem_id": "p00145", "language": "python", "submission_id_v0": "s120507501", "submission_id_v1": "s768605614", "cpu_time_v0": 160, "cpu_time_v1": 130, "memory_v0": 4524, "memory_v1": 4520, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 18.75, "input": "from functools import reduce\ndef f(a,b): return [Card[a][0], Card[b][1]]\n\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, f(j, k) + f(k+1, a)) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])", "target": "from functools import reduce\nn = int(input())\n\nCard = [[] for _ in [0]*n]\n\nCost = {}\n\nfor i in range(n):\n\n Card[i] = list(map(int, input().split()))\n\n Cost[(i, i)] = 0\n\nfor i in range(1, n):\n\n for j in range(0, n-i):\n\n a = j+i\n\n Cost[(j, a)] = min([reduce(lambda a,b: a*b, [Card[j][0],Card[k][1],Card[k+1][0],Card[a][1]]) + Cost[(j, k)] + Cost[(k+1, a)] for k in range(j, j+i)])\n\nprint(Cost[0, n-1])", "code_v0_loc": 12, "code_v1_loc": 11, "code_v0_num_chars": 397, "code_v1_num_chars": 380, "code_v0_no_empty_lines": "from functools import reduce\n\n\ndef f(a, b):\n return [Card[a][0], Card[b][1]]\n\n\nn = int(input())\nCard = [[] for _ in [0] * n]\nCost = {}\nfor i in range(n):\n Card[i] = list(map(int, input().split()))\n Cost[(i, i)] = 0\nfor i in range(1, n):\n for j in range(0, n - i):\n a = j + i\n Cost[(j, a)] = min(\n [\n reduce(lambda a, b: a * b, f(j, k) + f(k + 1, a))\n + Cost[(j, k)]\n + Cost[(k + 1, a)]\n for k in range(j, j + i)\n ]\n )\nprint(Cost[0, n - 1])\n", "code_v1_no_empty_lines": "from functools import reduce\n\nn = int(input())\nCard = [[] for _ in [0] * n]\nCost = {}\nfor i in range(n):\n Card[i] = list(map(int, input().split()))\n Cost[(i, i)] = 0\nfor i in range(1, n):\n for j in range(0, n - i):\n a = j + i\n Cost[(j, a)] = min(\n [\n reduce(\n lambda a, b: a * b,\n [Card[j][0], Card[k][1], Card[k + 1][0], Card[a][1]],\n )\n + Cost[(j, k)]\n + Cost[(k + 1, a)]\n for k in range(j, j + i)\n ]\n )\nprint(Cost[0, n - 1])\n", "code_same": false, "relative_loc_diff_percent": 8.3333333333, "diff": ["-", "-", "-def f(a, b):", "- return [Card[a][0], Card[b][1]]", "-", "- reduce(lambda a, b: a * b, f(j, k) + f(k + 1, a))", "+ reduce(", "+ lambda a, b: a * b,", "+ [Card[j][0], Card[k][1], Card[k + 1][0], Card[a][1]],", "+ )"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2898506114, "measured_runtime_v1": 0.2096236434, "runtime_lift": 1.3827190804, "key": ["s120507501", "s768605614"], "target_token_count_dream": 156, "target_token_bucket_dream": "128-256"} +{"user_id": "u532966492", "problem_id": "p03039", "language": "python", "submission_id_v0": "s814969347", "submission_id_v1": "s884180243", "cpu_time_v0": 555, "cpu_time_v1": 399, "memory_v0": 27096, "memory_v1": 3192, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 28.11, "input": "def cmb(n, r, mod):\n\n if ( r<0 or r>n ):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\nA=2*10**5\n\nmod = 10**9+7\n\ng1 = [1, 1]\n\ng2 = [1, 1]\n\ninverse = [0, 1]\n\n\n\nfor i in range( 2, A + 1 ):\n\n g1.append( ( g1[-1] * i ) % mod )\n\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=cmb(N*M-2,K-2,mod)\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nprint(((keisuu * (sum_//2))%mod))", "target": "def power_mod(a,b,mod=10**9+7):\n\n i,temp,box=0,b,[]\n\n while(2**i<=b):\n\n i+=1\n\n for j in range(i-1,-1,-1):\n\n box=[[j,temp//2**j]]+box\n\n temp-=2**j*(temp//2**j)\n\n box[0].append(a)\n\n ans=box[0][1]*a%mod\n\n for j in range(1,i):\n\n box[j].append(box[j-1][2]**2%mod)\n\n if box[j][1]==1:\n\n ans=(ans*box[j][2])%mod\n\n return ans\n\ndef n_func(n,mod=10**9+7):\n\n ans=1\n\n for i in range(1,n+1):\n\n ans=(ans*i)%mod\n\n return ans\n\ndef nPr(n,r,mod=10**9+7):\n\n ans=n_func(n-r,mod)\n\n ans=power_mod(ans,mod-2,mod)\n\n return ans*n_func(n,mod)%mod\n\ndef nCr(n,r,mod=10**9+7):\n\n ans=n_func(n-r,mod)*n_func(r,mod)%mod\n\n ans=power_mod(ans,mod-2,mod)\n\n return ans*n_func(n,mod)%mod\n\n\n\nN,M,K=list(map(int,input().split()))\n\nkeisuu=nCr(N*M-2,K-2)\n\nmod=10**9+7\n\n\n\nsum_=0\n\nfor i in range(N):\n\n a=min(abs(i),abs(N-i-1))\n\n b=max(abs(i),abs(N-i-1))\n\n sum_+=(M**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nfor i in range(M):\n\n a=min(abs(i),abs(M-i-1))\n\n b=max(abs(i),abs(M-i-1))\n\n sum_+=(N**2)*((a*(a+1)//2)+(b*(b+1)//2))\n\nprint(((keisuu * (sum_//2))%mod))", "code_v0_loc": 30, "code_v1_loc": 42, "code_v0_num_chars": 731, "code_v1_num_chars": 1114, "code_v0_no_empty_lines": "def cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\nA = 2 * 10**5\nmod = 10**9 + 7\ng1 = [1, 1]\ng2 = [1, 1]\ninverse = [0, 1]\nfor i in range(2, A + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod // i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\nN, M, K = list(map(int, input().split()))\nkeisuu = cmb(N * M - 2, K - 2, mod)\nsum_ = 0\nfor i in range(N):\n a = min(abs(i), abs(N - i - 1))\n b = max(abs(i), abs(N - i - 1))\n sum_ += (M**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nfor i in range(M):\n a = min(abs(i), abs(M - i - 1))\n b = max(abs(i), abs(M - i - 1))\n sum_ += (N**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nprint(((keisuu * (sum_ // 2)) % mod))\n", "code_v1_no_empty_lines": "def power_mod(a, b, mod=10**9 + 7):\n i, temp, box = 0, b, []\n while 2**i <= b:\n i += 1\n for j in range(i - 1, -1, -1):\n box = [[j, temp // 2**j]] + box\n temp -= 2**j * (temp // 2**j)\n box[0].append(a)\n ans = box[0][1] * a % mod\n for j in range(1, i):\n box[j].append(box[j - 1][2] ** 2 % mod)\n if box[j][1] == 1:\n ans = (ans * box[j][2]) % mod\n return ans\n\n\ndef n_func(n, mod=10**9 + 7):\n ans = 1\n for i in range(1, n + 1):\n ans = (ans * i) % mod\n return ans\n\n\ndef nPr(n, r, mod=10**9 + 7):\n ans = n_func(n - r, mod)\n ans = power_mod(ans, mod - 2, mod)\n return ans * n_func(n, mod) % mod\n\n\ndef nCr(n, r, mod=10**9 + 7):\n ans = n_func(n - r, mod) * n_func(r, mod) % mod\n ans = power_mod(ans, mod - 2, mod)\n return ans * n_func(n, mod) % mod\n\n\nN, M, K = list(map(int, input().split()))\nkeisuu = nCr(N * M - 2, K - 2)\nmod = 10**9 + 7\nsum_ = 0\nfor i in range(N):\n a = min(abs(i), abs(N - i - 1))\n b = max(abs(i), abs(N - i - 1))\n sum_ += (M**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nfor i in range(M):\n a = min(abs(i), abs(M - i - 1))\n b = max(abs(i), abs(M - i - 1))\n sum_ += (N**2) * ((a * (a + 1) // 2) + (b * (b + 1) // 2))\nprint(((keisuu * (sum_ // 2)) % mod))\n", "code_same": false, "relative_loc_diff_percent": 28.5714285714, "diff": ["-def cmb(n, r, mod):", "- if r < 0 or r > n:", "- return 0", "- r = min(r, n - r)", "- return g1[n] * g2[r] * g2[n - r] % mod", "+def power_mod(a, b, mod=10**9 + 7):", "+ i, temp, box = 0, b, []", "+ while 2**i <= b:", "+ i += 1", "+ for j in range(i - 1, -1, -1):", "+ box = [[j, temp // 2**j]] + box", "+ temp -= 2**j * (temp // 2**j)", "+ box[0].append(a)", "+ ans = box[0][1] * a % mod", "+ for j in range(1, i):", "+ box[j].append(box[j - 1][2] ** 2 % mod)", "+ if box[j][1] == 1:", "+ ans = (ans * box[j][2]) % mod", "+ return ans", "-A = 2 * 10**5", "+def n_func(n, mod=10**9 + 7):", "+ ans = 1", "+ for i in range(1, n + 1):", "+ ans = (ans * i) % mod", "+ return ans", "+", "+", "+def nPr(n, r, mod=10**9 + 7):", "+ ans = n_func(n - r, mod)", "+ ans = power_mod(ans, mod - 2, mod)", "+ return ans * n_func(n, mod) % mod", "+", "+", "+def nCr(n, r, mod=10**9 + 7):", "+ ans = n_func(n - r, mod) * n_func(r, mod) % mod", "+ ans = power_mod(ans, mod - 2, mod)", "+ return ans * n_func(n, mod) % mod", "+", "+", "+N, M, K = list(map(int, input().split()))", "+keisuu = nCr(N * M - 2, K - 2)", "-g1 = [1, 1]", "-g2 = [1, 1]", "-inverse = [0, 1]", "-for i in range(2, A + 1):", "- g1.append((g1[-1] * i) % mod)", "- inverse.append((-inverse[mod % i] * (mod // i)) % mod)", "- g2.append((g2[-1] * inverse[-1]) % mod)", "-N, M, K = list(map(int, input().split()))", "-keisuu = cmb(N * M - 2, K - 2, mod)"], "diff_only_import_comment": false, "measured_runtime_v0": 2.5172936699, "measured_runtime_v1": 0.2314554, "runtime_lift": 10.8759340674, "key": ["s814969347", "s884180243"], "target_token_count_dream": 458, "target_token_bucket_dream": "256-512"} +{"user_id": "u238940874", "problem_id": "p02725", "language": "python", "submission_id_v0": "s425361145", "submission_id_v1": "s820245641", "cpu_time_v0": 183, "cpu_time_v1": 162, "memory_v0": 25840, "memory_v1": 25840, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.48, "input": "k,n = list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\nlongd=0\n\nfor i in range(n):\n\n tmp=abs(a[i+1]-a[i])\n\n longd=max(longd,tmp)\n\nprint((k-longd))", "target": "k,n=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.append(a[0]+k)\n\n\n\nx=0\n\nfor i in range(len(a)-1):\n\n dis=abs(a[i+1]-a[i])\n\n x=max(x,dis)\n\n\n\nprint((k-x))", "code_v0_loc": 8, "code_v1_loc": 10, "code_v0_num_chars": 179, "code_v1_num_chars": 172, "code_v0_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(a[0] + k)\nlongd = 0\nfor i in range(n):\n tmp = abs(a[i + 1] - a[i])\n longd = max(longd, tmp)\nprint((k - longd))\n", "code_v1_no_empty_lines": "k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na.append(a[0] + k)\nx = 0\nfor i in range(len(a) - 1):\n dis = abs(a[i + 1] - a[i])\n x = max(x, dis)\nprint((k - x))\n", "code_same": false, "relative_loc_diff_percent": 20.0, "diff": ["-longd = 0", "-for i in range(n):", "- tmp = abs(a[i + 1] - a[i])", "- longd = max(longd, tmp)", "-print((k - longd))", "+x = 0", "+for i in range(len(a) - 1):", "+ dis = abs(a[i + 1] - a[i])", "+ x = max(x, dis)", "+print((k - x))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2313908032, "measured_runtime_v1": 0.1406400898, "runtime_lift": 1.645269165, "key": ["s425361145", "s820245641"], "target_token_count_dream": 62, "target_token_bucket_dream": "<128"} +{"user_id": "u021916304", "problem_id": "p02886", "language": "python", "submission_id_v0": "s631255245", "submission_id_v1": "s295881998", "cpu_time_v0": 21, "cpu_time_v1": 17, "memory_v0": 3316, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 19.05, "input": "def ii():return int(input())\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nans = 0\n\nfor i in range(n):\n\n for j in range(i+1,n):\n\n# print(i,j)\n\n ans += D[i]*D[j] \n\nprint(ans)", "target": "def ii():return int(input())\n\ndef iim():return list(map(int,input().split()))\n\ndef iil():return list(map(int,input().split()))\n\ndef ism():return list(map(str,input().split()))\n\ndef isl():return list(map(str,input().split()))\n\n\n\nn = ii()\n\nD = iil()\n\nsumD = sum(D)\n\nans = 0\n\nfor i in range(n):\n\n ans += D[i]*(sum(D)-D[i])\n\nprint((ans//2))", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 352, "code_v1_num_chars": 325, "code_v0_no_empty_lines": "def ii():\n return int(input())\n\n\ndef iim():\n return list(map(int, input().split()))\n\n\ndef iil():\n return list(map(int, input().split()))\n\n\ndef ism():\n return list(map(str, input().split()))\n\n\ndef isl():\n return list(map(str, input().split()))\n\n\nn = ii()\nD = iil()\nans = 0\nfor i in range(n):\n for j in range(i + 1, n):\n # print(i,j)\n ans += D[i] * D[j]\nprint(ans)\n", "code_v1_no_empty_lines": "def ii():\n return int(input())\n\n\ndef iim():\n return list(map(int, input().split()))\n\n\ndef iil():\n return list(map(int, input().split()))\n\n\ndef ism():\n return list(map(str, input().split()))\n\n\ndef isl():\n return list(map(str, input().split()))\n\n\nn = ii()\nD = iil()\nsumD = sum(D)\nans = 0\nfor i in range(n):\n ans += D[i] * (sum(D) - D[i])\nprint((ans // 2))\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["+sumD = sum(D)", "- for j in range(i + 1, n):", "- # print(i,j)", "- ans += D[i] * D[j]", "-print(ans)", "+ ans += D[i] * (sum(D) - D[i])", "+print((ans // 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2355280421, "measured_runtime_v1": 0.0063002633, "runtime_lift": 37.3838408874, "key": ["s631255245", "s295881998"], "target_token_count_dream": 99, "target_token_bucket_dream": "<128"} +{"user_id": "u175034939", "problem_id": "p03353", "language": "python", "submission_id_v0": "s387813464", "submission_id_v1": "s460839958", "cpu_time_v0": 62, "cpu_time_v1": 40, "memory_v0": 5068, "memory_v1": 5068, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 35.48, "input": "S = input()\n\nK = int(input())\n\na = list(set(S))\n\na.sort()\n\n\n\nk = []\n\nl = 0\n\nwhile l < len(a):\n\n for i in range(len(S)):\n\n if S[i] == a[l]:\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n k.append(S[i:i+j])\n\n else:\n\n break\n\n l += 1\n\n\n\nk = list(set(k))\n\nk.sort()\n\nprint((k[K-1]))", "target": "S = input()\n\nK = int(input())\n\na = []\n\nfor i in range(len(S)+1):\n\n for j in range(1,6):\n\n if i+j <= len(S):\n\n a.append(S[i:i+j])\n\n else:\n\n break\n\n \n\na = list(set(a))\n\na.sort()\n\nprint((a[K-1]))", "code_v0_loc": 20, "code_v1_loc": 13, "code_v0_num_chars": 364, "code_v1_num_chars": 240, "code_v0_no_empty_lines": "S = input()\nK = int(input())\na = list(set(S))\na.sort()\nk = []\nl = 0\nwhile l < len(a):\n for i in range(len(S)):\n if S[i] == a[l]:\n for j in range(1, 6):\n if i + j <= len(S):\n k.append(S[i : i + j])\n else:\n break\n l += 1\nk = list(set(k))\nk.sort()\nprint((k[K - 1]))\n", "code_v1_no_empty_lines": "S = input()\nK = int(input())\na = []\nfor i in range(len(S) + 1):\n for j in range(1, 6):\n if i + j <= len(S):\n a.append(S[i : i + j])\n else:\n break\na = list(set(a))\na.sort()\nprint((a[K - 1]))\n", "code_same": false, "relative_loc_diff_percent": 35.0, "diff": ["-a = list(set(S))", "+a = []", "+for i in range(len(S) + 1):", "+ for j in range(1, 6):", "+ if i + j <= len(S):", "+ a.append(S[i : i + j])", "+ else:", "+ break", "+a = list(set(a))", "-k = []", "-l = 0", "-while l < len(a):", "- for i in range(len(S)):", "- if S[i] == a[l]:", "- for j in range(1, 6):", "- if i + j <= len(S):", "- k.append(S[i : i + j])", "- else:", "- break", "- l += 1", "-k = list(set(k))", "-k.sort()", "-print((k[K - 1]))", "+print((a[K - 1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3274912031, "measured_runtime_v1": 0.2526222069, "runtime_lift": 1.2963674375, "key": ["s387813464", "s460839958"], "target_token_count_dream": 70, "target_token_bucket_dream": "<128"} +{"user_id": "u653837719", "problem_id": "p02702", "language": "python", "submission_id_v0": "s121665958", "submission_id_v1": "s794197403", "cpu_time_v0": 113, "cpu_time_v1": 101, "memory_v0": 9288, "memory_v1": 9236, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 10.62, "input": "s = input()[::-1]\n\nl = len(s)\n\nc = [0] * 2019\n\nc[0] = 1\n\nten = 1\n\nmod = 0\n\nans = 0\n\n\n\nfor i in range(l):\n\n mod = (mod + int(s[i]) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) // 2\n\n\n\nprint(ans)", "target": "s = input()[::-1]\n\nc = [0] * 2019\n\nc[0] = 1\n\nmod = 0\n\nten = 1\n\nans = 0\n\n\n\nfor i in s:\n\n mod = (mod + int(i) * ten) % 2019\n\n ten = ten * 10 % 2019\n\n c[mod] += 1\n\n\n\nfor i in c:\n\n ans += i * (i - 1) // 2\n\n\n\nprint(ans)", "code_v0_loc": 17, "code_v1_loc": 16, "code_v0_num_chars": 248, "code_v1_num_chars": 226, "code_v0_no_empty_lines": "s = input()[::-1]\nl = len(s)\nc = [0] * 2019\nc[0] = 1\nten = 1\nmod = 0\nans = 0\nfor i in range(l):\n mod = (mod + int(s[i]) * ten) % 2019\n ten = ten * 10 % 2019\n c[mod] += 1\nfor i in c:\n ans += i * (i - 1) // 2\nprint(ans)\n", "code_v1_no_empty_lines": "s = input()[::-1]\nc = [0] * 2019\nc[0] = 1\nmod = 0\nten = 1\nans = 0\nfor i in s:\n mod = (mod + int(i) * ten) % 2019\n ten = ten * 10 % 2019\n c[mod] += 1\nfor i in c:\n ans += i * (i - 1) // 2\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-l = len(s)", "+mod = 0", "-mod = 0", "-for i in range(l):", "- mod = (mod + int(s[i]) * ten) % 2019", "+for i in s:", "+ mod = (mod + int(i) * ten) % 2019"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2661841769, "measured_runtime_v1": 0.1600983288, "runtime_lift": 1.6626293282, "key": ["s121665958", "s794197403"], "target_token_count_dream": 113, "target_token_bucket_dream": "<128"} +{"user_id": "u045939752", "problem_id": "p03814", "language": "python", "submission_id_v0": "s574890983", "submission_id_v1": "s839527046", "cpu_time_v0": 23, "cpu_time_v1": 18, "memory_v0": 3516, "memory_v1": 3500, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.74, "input": "S=input()\n\nprint((S.rfind('Z')-S.find('A')+1))", "target": "s=input().strip()\n\na = s.find('A')\n\nz = s.rfind('Z')\n\nprint((z-a+1))\n", "code_v0_loc": 2, "code_v1_loc": 4, "code_v0_num_chars": 44, "code_v1_num_chars": 67, "code_v0_no_empty_lines": "S = input()\nprint((S.rfind(\"Z\") - S.find(\"A\") + 1))\n", "code_v1_no_empty_lines": "s = input().strip()\na = s.find(\"A\")\nz = s.rfind(\"Z\")\nprint((z - a + 1))\n", "code_same": false, "relative_loc_diff_percent": 50.0, "diff": ["-S = input()", "-print((S.rfind(\"Z\") - S.find(\"A\") + 1))", "+s = input().strip()", "+a = s.find(\"A\")", "+z = s.rfind(\"Z\")", "+print((z - a + 1))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.286565238, "measured_runtime_v1": 0.2292430663, "runtime_lift": 1.2500497511, "key": ["s574890983", "s839527046"], "target_token_count_dream": 27, "target_token_bucket_dream": "<128"} +{"user_id": "u585482323", "problem_id": "p03371", "language": "python", "submission_id_v0": "s026349855", "submission_id_v1": "s676818074", "cpu_time_v0": 206, "cpu_time_v1": 183, "memory_v0": 40944, "memory_v1": 39408, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.17, "input": "#!usr/bin/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LS()\n\n return l\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n return\n\n\n\n#B\n\ndef B():\n\n return\n\n\n\n#C\n\ndef C():\n\n return\n\n\n\n#D\n\ndef D():\n\n return\n\n\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n a,b,c,X,Y = LI()\n\n ans = float(\"inf\")\n\n for z in range(300001):\n\n if z%2 == 0:\n\n m = c*z\n\n x = z//2\n\n y = z//2\n\n m += a*max(0,X-x)\n\n m += b*max(0,Y-y)\n\n if m < ans:\n\n ans = m\n\n print(ans)\n\n return\n\n\n\n#G\n\ndef G():\n\n n = I()\n\n x = LI()\n\n f = [(i,x[i]) for i in range(n)]\n\n f.sort(key = lambda x:x[1])\n\n g = [(f[i][0],i) for i in range(n)]\n\n g.sort(key = lambda x:x[0])\n\n for i in range(n):\n\n if g[i][1] < n//2:\n\n print((f[n//2][1]))\n\n else:\n\n print((f[n//2-1][1]))\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#I\n\ndef I_():\n\n return\n\n\n\n#J\n\ndef J():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n F()\n", "target": "#!usr/bin/env python3\n\nfrom collections import defaultdict,deque\n\nfrom heapq import heappush, heappop\n\nfrom itertools import permutations\n\nimport sys\n\nimport math\n\nimport bisect\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\n\ndef S():\n\n res = list(sys.stdin.readline())\n\n if res[-1] == \"\\n\":\n\n return res[:-1]\n\n return res\n\ndef IR(n):\n\n return [I() for i in range(n)]\n\ndef LIR(n):\n\n return [LI() for i in range(n)]\n\ndef SR(n):\n\n return [S() for i in range(n)]\n\ndef LSR(n):\n\n return [LS() for i in range(n)]\n\n\n\nsys.setrecursionlimit(1000000)\n\nmod = 1000000007\n\n\n\ndef solve():\n\n A,B,C,x,y = LI()\n\n ans = float(\"inf\")\n\n for c in range(200001)[::2]:\n\n a = b = c >> 1\n\n a = max(0,x-a)\n\n b = max(0,y-b)\n\n s = A*a+B*b+C*c\n\n if s < ans:\n\n ans = s\n\n print(ans)\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n solve()\n", "code_v0_loc": 97, "code_v1_loc": 43, "code_v0_num_chars": 1751, "code_v1_num_chars": 1027, "code_v0_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LS()\n return l\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n# A\ndef A():\n return\n\n\n# B\ndef B():\n return\n\n\n# C\ndef C():\n return\n\n\n# D\ndef D():\n return\n\n\n# E\ndef E():\n return\n\n\n# F\ndef F():\n a, b, c, X, Y = LI()\n ans = float(\"inf\")\n for z in range(300001):\n if z % 2 == 0:\n m = c * z\n x = z // 2\n y = z // 2\n m += a * max(0, X - x)\n m += b * max(0, Y - y)\n if m < ans:\n ans = m\n print(ans)\n return\n\n\n# G\ndef G():\n n = I()\n x = LI()\n f = [(i, x[i]) for i in range(n)]\n f.sort(key=lambda x: x[1])\n g = [(f[i][0], i) for i in range(n)]\n g.sort(key=lambda x: x[0])\n for i in range(n):\n if g[i][1] < n // 2:\n print((f[n // 2][1]))\n else:\n print((f[n // 2 - 1][1]))\n return\n\n\n# H\ndef H():\n return\n\n\n# I\ndef I_():\n return\n\n\n# J\ndef J():\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n F()\n", "code_v1_no_empty_lines": "#!usr/bin/env python3\nfrom collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations\nimport sys\nimport math\nimport bisect\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return [list(x) for x in sys.stdin.readline().split()]\n\n\ndef S():\n res = list(sys.stdin.readline())\n if res[-1] == \"\\n\":\n return res[:-1]\n return res\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n\n\ndef solve():\n A, B, C, x, y = LI()\n ans = float(\"inf\")\n for c in range(200001)[::2]:\n a = b = c >> 1\n a = max(0, x - a)\n b = max(0, y - b)\n s = A * a + B * b + C * c\n if s < ans:\n ans = s\n print(ans)\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n solve()\n", "code_same": false, "relative_loc_diff_percent": 55.6701030928, "diff": ["-from collections import defaultdict", "-from collections import deque", "+from collections import defaultdict, deque", "+from itertools import permutations", "-import random", "- return list(map(int, sys.stdin.readline().split()))", "+ return [int(x) for x in sys.stdin.readline().split()]", "- return list(map(list, sys.stdin.readline().split()))", "+ return [list(x) for x in sys.stdin.readline().split()]", "- return list(sys.stdin.readline())[:-1]", "+ res = list(sys.stdin.readline())", "+ if res[-1] == \"\\n\":", "+ return res[:-1]", "+ return res", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = I()", "- return l", "+ return [I() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = LI()", "- return l", "+ return [LI() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = S()", "- return l", "+ return [S() for i in range(n)]", "- l = [None for i in range(n)]", "- for i in range(n):", "- l[i] = LS()", "- return l", "+ return [LS() for i in range(n)]", "-# A", "-def A():", "- return", "-# B", "-def B():", "- return", "-", "-", "-# C", "-def C():", "- return", "-", "-", "-# D", "-def D():", "- return", "-", "-", "-# E", "-def E():", "- return", "-", "-", "-# F", "-def F():", "- a, b, c, X, Y = LI()", "+def solve():", "+ A, B, C, x, y = LI()", "- for z in range(300001):", "- if z % 2 == 0:", "- m = c * z", "- x = z // 2", "- y = z // 2", "- m += a * max(0, X - x)", "- m += b * max(0, Y - y)", "- if m < ans:", "- ans = m", "+ for c in range(200001)[::2]:", "+ a = b = c >> 1", "+ a = max(0, x - a)", "+ b = max(0, y - b)", "+ s = A * a + B * b + C * c", "+ if s < ans:", "+ ans = s", "- return", "-", "-", "-# G", "-def G():", "- n = I()", "- x = LI()", "- f = [(i, x[i]) for i in range(n)]", "- f.sort(key=lambda x: x[1])", "- g = [(f[i][0], i) for i in range(n)]", "- g.sort(key=lambda x: x[0])", "- for i in range(n):", "- if g[i][1] < n // 2:", "- print((f[n // 2][1]))", "- else:", "- print((f[n // 2 - 1][1]))", "- return", "-", "-", "-# H", "-def H():", "- return", "-", "-", "-# I", "-def I_():", "- return", "-", "-", "-# J", "-def J():", "- F()", "+ solve()"], "diff_only_import_comment": false, "measured_runtime_v0": 1.3533082061, "measured_runtime_v1": 0.0063346879, "runtime_lift": 213.6345491689, "key": ["s026349855", "s676818074"], "target_token_count_dream": 312, "target_token_bucket_dream": "256-512"} +{"user_id": "u183422236", "problem_id": "p02612", "language": "python", "submission_id_v0": "s828418851", "submission_id_v1": "s809335980", "cpu_time_v0": 81, "cpu_time_v1": 70, "memory_v0": 61540, "memory_v1": 61736, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.58, "input": "n = int(input()) % 1000\n\nif n == 0:\n\n print((0))\n\nelse:\n\n print((1000 - n))", "target": "n = int(input())\n\nprint(((1000 - n % 1000) % 1000))", "code_v0_loc": 5, "code_v1_loc": 2, "code_v0_num_chars": 77, "code_v1_num_chars": 49, "code_v0_no_empty_lines": "n = int(input()) % 1000\nif n == 0:\n print((0))\nelse:\n print((1000 - n))\n", "code_v1_no_empty_lines": "n = int(input())\nprint(((1000 - n % 1000) % 1000))\n", "code_same": false, "relative_loc_diff_percent": 60.0, "diff": ["-n = int(input()) % 1000", "-if n == 0:", "- print((0))", "-else:", "- print((1000 - n))", "+n = int(input())", "+print(((1000 - n % 1000) % 1000))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2545247498, "measured_runtime_v1": 0.1889497155, "runtime_lift": 1.3470501881, "key": ["s828418851", "s809335980"], "target_token_count_dream": 27, "target_token_bucket_dream": "<128"} +{"user_id": "u912650255", "problem_id": "p02983", "language": "python", "submission_id_v0": "s074902378", "submission_id_v1": "s358904585", "cpu_time_v0": 618, "cpu_time_v1": 67, "memory_v0": 75568, "memory_v1": 6888, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 89.16, "input": "L ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nif R - L <= 2019:\n\n for i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n\n\nelse:\n\n for i in range(R-L-1010,R-L+1010):\n\n for j in range(i,R-L+1010):\n\n ans.append(i*j%2019)\n\n\n\nprint((min(ans)))\n", "target": "L ,R = list(map(int,input().split()))\n\n\n\nans =[]\n\nfor i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n ans.append(i*j%2019)\n\n if (i * j % 2019) == 0:\n\n break\n\n else:\n\n continue\n\n break\n\n\n\nprint((min(ans)))", "code_v0_loc": 14, "code_v1_loc": 13, "code_v0_num_chars": 297, "code_v1_num_chars": 237, "code_v0_no_empty_lines": "L, R = list(map(int, input().split()))\nans = []\nif R - L <= 2019:\n for i in range(L, R + 1):\n for j in range(i + 1, R + 1):\n ans.append(i * j % 2019)\nelse:\n for i in range(R - L - 1010, R - L + 1010):\n for j in range(i, R - L + 1010):\n ans.append(i * j % 2019)\nprint((min(ans)))\n", "code_v1_no_empty_lines": "L, R = list(map(int, input().split()))\nans = []\nfor i in range(L, R + 1):\n for j in range(i + 1, R + 1):\n ans.append(i * j % 2019)\n if (i * j % 2019) == 0:\n break\n else:\n continue\n break\nprint((min(ans)))\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["-if R - L <= 2019:", "- for i in range(L, R + 1):", "- for j in range(i + 1, R + 1):", "- ans.append(i * j % 2019)", "-else:", "- for i in range(R - L - 1010, R - L + 1010):", "- for j in range(i, R - L + 1010):", "- ans.append(i * j % 2019)", "+for i in range(L, R + 1):", "+ for j in range(i + 1, R + 1):", "+ ans.append(i * j % 2019)", "+ if (i * j % 2019) == 0:", "+ break", "+ else:", "+ continue", "+ break"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3668963638, "measured_runtime_v1": 0.2102679547, "runtime_lift": 1.7448990943, "key": ["s074902378", "s358904585"], "target_token_count_dream": 82, "target_token_bucket_dream": "<128"} +{"user_id": "u622570247", "problem_id": "p02773", "language": "python", "submission_id_v0": "s074380513", "submission_id_v1": "s228830644", "cpu_time_v0": 1054, "cpu_time_v1": 898, "memory_v0": 45492, "memory_v1": 47732, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 14.8, "input": "from collections import Counter\n\nimport heapq\n\n\n\nn = int(input())\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\nheap = [(-v, k) for k, v in list(ctr.items())]\n\nheapq.heapify(heap)\n\nmaxv = heap[0][0]\n\nwhile heap:\n\n c = heapq.heappop(heap)\n\n if c[0] != maxv:\n\n break\n\n print((c[1]))\n", "target": "from collections import Counter\n\n\n\nn = int(input())\n\nss = []\n\nfor _ in range(n):\n\n ss.append(input().rstrip())\n\nctr = Counter(ss)\n\n\n\na = sorted([(-v, k) for k, v in list(ctr.items())])\n\nmaxv = a[0][0]\n\nfor i in range(len(a)):\n\n if a[i][0] != maxv:\n\n break\n\n print((a[i][1]))", "code_v0_loc": 16, "code_v1_loc": 14, "code_v0_num_chars": 325, "code_v1_num_chars": 282, "code_v0_no_empty_lines": "from collections import Counter\nimport heapq\n\nn = int(input())\nss = []\nfor _ in range(n):\n ss.append(input().rstrip())\nctr = Counter(ss)\nheap = [(-v, k) for k, v in list(ctr.items())]\nheapq.heapify(heap)\nmaxv = heap[0][0]\nwhile heap:\n c = heapq.heappop(heap)\n if c[0] != maxv:\n break\n print((c[1]))\n", "code_v1_no_empty_lines": "from collections import Counter\n\nn = int(input())\nss = []\nfor _ in range(n):\n ss.append(input().rstrip())\nctr = Counter(ss)\na = sorted([(-v, k) for k, v in list(ctr.items())])\nmaxv = a[0][0]\nfor i in range(len(a)):\n if a[i][0] != maxv:\n break\n print((a[i][1]))\n", "code_same": false, "relative_loc_diff_percent": 12.5, "diff": ["-import heapq", "-heap = [(-v, k) for k, v in list(ctr.items())]", "-heapq.heapify(heap)", "-maxv = heap[0][0]", "-while heap:", "- c = heapq.heappop(heap)", "- if c[0] != maxv:", "+a = sorted([(-v, k) for k, v in list(ctr.items())])", "+maxv = a[0][0]", "+for i in range(len(a)):", "+ if a[i][0] != maxv:", "- print((c[1]))", "+ print((a[i][1]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3121475418, "measured_runtime_v1": 0.0064239368, "runtime_lift": 48.5913153977, "key": ["s074380513", "s228830644"], "target_token_count_dream": 90, "target_token_bucket_dream": "<128"} +{"user_id": "u428397309", "problem_id": "p03037", "language": "python", "submission_id_v0": "s058389905", "submission_id_v1": "s302443687", "cpu_time_v0": 285, "cpu_time_v1": 131, "memory_v0": 10868, "memory_v1": 10868, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.04, "input": "# -*- coding: utf-8 -*-\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nl = max(L)\n\nr = min(R)\n\n\n\nans = max(r - l + 1, 0)\n\n\n\nprint(ans)\n", "target": "# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN, M = list(map(int, input().split()))\n\nL, R = [None] * M, [None] * M\n\nfor i in range(M):\n\n L[i], R[i] = list(map(int, input().split()))\n\n\n\nans = max(min(R) - max(L) + 1, 0)\n\n\n\nprint(ans)\n", "code_v0_loc": 13, "code_v1_loc": 13, "code_v0_num_chars": 222, "code_v1_num_chars": 248, "code_v0_no_empty_lines": "# -*- coding: utf-8 -*-\nN, M = list(map(int, input().split()))\nL, R = [None] * M, [None] * M\nfor i in range(M):\n L[i], R[i] = list(map(int, input().split()))\nl = max(L)\nr = min(R)\nans = max(r - l + 1, 0)\nprint(ans)\n", "code_v1_no_empty_lines": "# -*- coding: utf-8 -*-\nimport sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nL, R = [None] * M, [None] * M\nfor i in range(M):\n L[i], R[i] = list(map(int, input().split()))\nans = max(min(R) - max(L) + 1, 0)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["+import sys", "+", "+input = sys.stdin.readline", "-l = max(L)", "-r = min(R)", "-ans = max(r - l + 1, 0)", "+ans = max(min(R) - max(L) + 1, 0)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2363609416, "measured_runtime_v1": 0.0060358713, "runtime_lift": 39.1593741465, "key": ["s058389905", "s302443687"], "target_token_count_dream": 89, "target_token_bucket_dream": "<128"} +{"user_id": "u756270013", "problem_id": "p02881", "language": "python", "submission_id_v0": "s868775809", "submission_id_v1": "s345973481", "cpu_time_v0": 439, "cpu_time_v1": 210, "memory_v0": 3060, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 52.16, "input": "import math\n\ninput_num = int(input())\n\nnum_sqrt = int(math.sqrt(input_num))\n\n\n\nminimam = input_num\n\nfor i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n distance = q + i -2\n\n if mod == 0 and minimam > distance:\n\n minimam = distance\n\nprint(minimam)", "target": "import math\n\ndef main1():\n\n input_num = int(input())\n\n num_sqrt = int(math.sqrt(input_num))\n\n\n\n minimam = input_num\n\n for i in range(num_sqrt+1,0,-1):\n\n q, mod = divmod(input_num, i)\n\n if mod == 0:\n\n distance = q + i -2\n\n if minimam > distance:\n\n minimam = distance\n\n print(minimam)\n\nmain1()", "code_v0_loc": 11, "code_v1_loc": 14, "code_v0_num_chars": 277, "code_v1_num_chars": 357, "code_v0_no_empty_lines": "import math\n\ninput_num = int(input())\nnum_sqrt = int(math.sqrt(input_num))\nminimam = input_num\nfor i in range(num_sqrt + 1, 0, -1):\n q, mod = divmod(input_num, i)\n distance = q + i - 2\n if mod == 0 and minimam > distance:\n minimam = distance\nprint(minimam)\n", "code_v1_no_empty_lines": "import math\n\n\ndef main1():\n input_num = int(input())\n num_sqrt = int(math.sqrt(input_num))\n minimam = input_num\n for i in range(num_sqrt + 1, 0, -1):\n q, mod = divmod(input_num, i)\n if mod == 0:\n distance = q + i - 2\n if minimam > distance:\n minimam = distance\n print(minimam)\n\n\nmain1()\n", "code_same": false, "relative_loc_diff_percent": 21.4285714286, "diff": ["-input_num = int(input())", "-num_sqrt = int(math.sqrt(input_num))", "-minimam = input_num", "-for i in range(num_sqrt + 1, 0, -1):", "- q, mod = divmod(input_num, i)", "- distance = q + i - 2", "- if mod == 0 and minimam > distance:", "- minimam = distance", "-print(minimam)", "+", "+def main1():", "+ input_num = int(input())", "+ num_sqrt = int(math.sqrt(input_num))", "+ minimam = input_num", "+ for i in range(num_sqrt + 1, 0, -1):", "+ q, mod = divmod(input_num, i)", "+ if mod == 0:", "+ distance = q + i - 2", "+ if minimam > distance:", "+ minimam = distance", "+ print(minimam)", "+", "+", "+main1()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.27158184, "measured_runtime_v1": 0.2170004892, "runtime_lift": 1.2515263951, "key": ["s868775809", "s345973481"], "target_token_count_dream": 96, "target_token_bucket_dream": "<128"} +{"user_id": "u802963389", "problem_id": "p02881", "language": "python", "submission_id_v0": "s879601223", "submission_id_v1": "s706921267", "cpu_time_v0": 178, "cpu_time_v1": 148, "memory_v0": 3060, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 16.85, "input": "# C - Walk on Multiplication Table\n\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\n\n\n\nn = int(input())\n\n\n\nans = 10 ** 12\n\nfor i in range(1, 10 ** 6 + 1):\n\n if n % i == 0:\n\n ans = min(ans, n // i + i)\n\n\n\nprint((ans - 2))", "target": "# C - Walk on Multiplication Table\n\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\n\n\n\nn = int(input())\n\n\n\nans = n\n\nfor i in range(1, int(n**.5) + 2):\n\n if n % i == 0:\n\n ans = min(ans, n // i + i - 2)\n\n\n\nprint(ans)", "code_v0_loc": 11, "code_v1_loc": 11, "code_v0_num_chars": 226, "code_v1_num_chars": 222, "code_v0_no_empty_lines": "# C - Walk on Multiplication Table\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\nn = int(input())\nans = 10**12\nfor i in range(1, 10**6 + 1):\n if n % i == 0:\n ans = min(ans, n // i + i)\nprint((ans - 2))\n", "code_v1_no_empty_lines": "# C - Walk on Multiplication Table\n# https://atcoder.jp/contests/abc144/tasks/abc144_c\nn = int(input())\nans = n\nfor i in range(1, int(n**0.5) + 2):\n if n % i == 0:\n ans = min(ans, n // i + i - 2)\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-ans = 10**12", "-for i in range(1, 10**6 + 1):", "+ans = n", "+for i in range(1, int(n**0.5) + 2):", "- ans = min(ans, n // i + i)", "-print((ans - 2))", "+ ans = min(ans, n // i + i - 2)", "+print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 1.0824642203, "measured_runtime_v1": 0.2210092547, "runtime_lift": 4.8978230425, "key": ["s879601223", "s706921267"], "target_token_count_dream": 85, "target_token_bucket_dream": "<128"} +{"user_id": "u077291787", "problem_id": "p04020", "language": "python", "submission_id_v0": "s648607888", "submission_id_v1": "s112859245", "cpu_time_v0": 58, "cpu_time_v1": 46, "memory_v0": 14252, "memory_v1": 14092, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.69, "input": "# AGC003B - Simplified mahjong\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur // 2\n\n N = int(input())\n\n A = list(map(int, [input() for _ in range(N)])) + [0]\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur // 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "target": "# AGC003B - Simplified mahjong\n\ndef main():\n\n # split in subsequences when 0 appears -> sum up cur // 2\n\n N, *A = list(map(int, open(0).read().split()))\n\n A.append(0)\n\n ans, cur = 0, 0\n\n for i in A:\n\n if i:\n\n cur += i\n\n else:\n\n ans += cur // 2\n\n cur = 0\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()", "code_v0_loc": 20, "code_v1_loc": 17, "code_v0_num_chars": 429, "code_v1_num_chars": 369, "code_v0_no_empty_lines": "# AGC003B - Simplified mahjong\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n # split in subsequences when 0 appears -> sum up cur // 2\n N = int(input())\n A = list(map(int, [input() for _ in range(N)])) + [0]\n ans, cur = 0, 0\n for i in A:\n if i:\n cur += i\n else:\n ans += cur // 2\n cur = 0\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "# AGC003B - Simplified mahjong\ndef main():\n # split in subsequences when 0 appears -> sum up cur // 2\n N, *A = list(map(int, open(0).read().split()))\n A.append(0)\n ans, cur = 0, 0\n for i in A:\n if i:\n cur += i\n else:\n ans += cur // 2\n cur = 0\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 15.0, "diff": ["-import sys", "-", "-input = sys.stdin.readline", "-", "-", "- N = int(input())", "- A = list(map(int, [input() for _ in range(N)])) + [0]", "+ N, *A = list(map(int, open(0).read().split()))", "+ A.append(0)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.282343082, "measured_runtime_v1": 0.1984000847, "runtime_lift": 1.4230996042, "key": ["s648607888", "s112859245"], "target_token_count_dream": 117, "target_token_bucket_dream": "<128"} +{"user_id": "u131984977", "problem_id": "p02412", "language": "python", "submission_id_v0": "s229334190", "submission_id_v1": "s721700065", "cpu_time_v0": 1150, "cpu_time_v1": 900, "memory_v0": 6724, "memory_v1": 6720, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 21.74, "input": "while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for a in range(1, n + 1):\n\n for b in range(a + 1, n + 1):\n\n for c in range(b + 1, n + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)", "target": "while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n limit = n if n < x else x\n\n for a in range(1, limit + 1):\n\n for b in range(a + 1, limit + 1):\n\n for c in range(b + 1, limit + 1):\n\n if sum([a,b,c]) == x:\n\n count += 1\n\n\n\n print(count)", "code_v0_loc": 13, "code_v1_loc": 14, "code_v0_num_chars": 316, "code_v1_num_chars": 359, "code_v0_no_empty_lines": "while True:\n (n, x) = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for a in range(1, n + 1):\n for b in range(a + 1, n + 1):\n for c in range(b + 1, n + 1):\n if sum([a, b, c]) == x:\n count += 1\n print(count)\n", "code_v1_no_empty_lines": "while True:\n (n, x) = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n limit = n if n < x else x\n for a in range(1, limit + 1):\n for b in range(a + 1, limit + 1):\n for c in range(b + 1, limit + 1):\n if sum([a, b, c]) == x:\n count += 1\n print(count)\n", "code_same": false, "relative_loc_diff_percent": 7.1428571429, "diff": ["- for a in range(1, n + 1):", "- for b in range(a + 1, n + 1):", "- for c in range(b + 1, n + 1):", "+ limit = n if n < x else x", "+ for a in range(1, limit + 1):", "+ for b in range(a + 1, limit + 1):", "+ for c in range(b + 1, limit + 1):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2860648324, "measured_runtime_v1": 0.2158536868, "runtime_lift": 1.3252719315, "key": ["s229334190", "s721700065"], "target_token_count_dream": 114, "target_token_bucket_dream": "<128"} +{"user_id": "u426534722", "problem_id": "p02245", "language": "python", "submission_id_v0": "s237914915", "submission_id_v1": "s694650984", "cpu_time_v0": 730, "cpu_time_v1": 50, "memory_v0": 25688, "memory_v1": 8488, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 93.15, "input": "from collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n start = 8 - MAP.find(\"0\")\n\n MAP = int(MAP)\n\n if MAP == goal:\n\n return 0\n\n dp = deque([(0, start, MAP)])\n\n LOG = {MAP}\n\n while dp:\n\n cnt, yx, M = dp.popleft()\n\n if M == goal:\n\n return cnt\n\n cnt += 1\n\n for nyx in m[yx]:\n\n CM = g(yx, nyx, M)\n\n if not CM in LOG:\n\n dp.append((cnt, nyx, CM))\n\n LOG.add(CM)\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n", "target": "from collections import deque\n\nN = 3\n\nm = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},\n\n 0: {3, 1}}\n\ngoal = 123456780\n\ndef g(i, j, a):\n\n t = a // (10 ** j) % 10\n\n return a - t * (10 ** j) + t * (10 ** i)\n\ndef solve():\n\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n\n zero = 8 - MAP.find(\"0\")\n\n start = int(MAP)\n\n if start == goal:\n\n return 0\n\n dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])\n\n TABLE = {start: (1, 0), goal: (0, 0)}\n\n while dp:\n\n cnt, M, yx, flg = dp.popleft()\n\n cnt += 1\n\n for nyx in m[yx]:\n\n key = g(yx, nyx, M)\n\n if key in TABLE:\n\n if TABLE[key][0] != flg:\n\n return TABLE[key][1] + cnt\n\n continue\n\n TABLE[key] = (flg, cnt)\n\n dp.append((cnt, key, nyx, flg))\n\ndef MAIN():\n\n print((solve()))\n\nMAIN()\n\n\n", "code_v0_loc": 30, "code_v1_loc": 31, "code_v0_num_chars": 815, "code_v1_num_chars": 949, "code_v0_no_empty_lines": "from collections import deque\n\nN = 3\nm = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n}\ngoal = 123456780\n\n\ndef g(i, j, a):\n t = a // (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef solve():\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n start = 8 - MAP.find(\"0\")\n MAP = int(MAP)\n if MAP == goal:\n return 0\n dp = deque([(0, start, MAP)])\n LOG = {MAP}\n while dp:\n cnt, yx, M = dp.popleft()\n if M == goal:\n return cnt\n cnt += 1\n for nyx in m[yx]:\n CM = g(yx, nyx, M)\n if not CM in LOG:\n dp.append((cnt, nyx, CM))\n LOG.add(CM)\n\n\ndef MAIN():\n print((solve()))\n\n\nMAIN()\n", "code_v1_no_empty_lines": "from collections import deque\n\nN = 3\nm = {\n 8: {7, 5},\n 7: {8, 6, 4},\n 6: {7, 3},\n 5: {8, 4, 2},\n 4: {7, 5, 3, 1},\n 3: {6, 4, 0},\n 2: {5, 1},\n 1: {4, 2, 0},\n 0: {3, 1},\n}\ngoal = 123456780\n\n\ndef g(i, j, a):\n t = a // (10**j) % 10\n return a - t * (10**j) + t * (10**i)\n\n\ndef solve():\n MAP = \"\".join(input().replace(\" \", \"\") for _ in range(N))\n zero = 8 - MAP.find(\"0\")\n start = int(MAP)\n if start == goal:\n return 0\n dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])\n TABLE = {start: (1, 0), goal: (0, 0)}\n while dp:\n cnt, M, yx, flg = dp.popleft()\n cnt += 1\n for nyx in m[yx]:\n key = g(yx, nyx, M)\n if key in TABLE:\n if TABLE[key][0] != flg:\n return TABLE[key][1] + cnt\n continue\n TABLE[key] = (flg, cnt)\n dp.append((cnt, key, nyx, flg))\n\n\ndef MAIN():\n print((solve()))\n\n\nMAIN()\n", "code_same": false, "relative_loc_diff_percent": 3.2258064516, "diff": ["- start = 8 - MAP.find(\"0\")", "- MAP = int(MAP)", "- if MAP == goal:", "+ zero = 8 - MAP.find(\"0\")", "+ start = int(MAP)", "+ if start == goal:", "- dp = deque([(0, start, MAP)])", "- LOG = {MAP}", "+ dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])", "+ TABLE = {start: (1, 0), goal: (0, 0)}", "- cnt, yx, M = dp.popleft()", "- if M == goal:", "- return cnt", "+ cnt, M, yx, flg = dp.popleft()", "- CM = g(yx, nyx, M)", "- if not CM in LOG:", "- dp.append((cnt, nyx, CM))", "- LOG.add(CM)", "+ key = g(yx, nyx, M)", "+ if key in TABLE:", "+ if TABLE[key][0] != flg:", "+ return TABLE[key][1] + cnt", "+ continue", "+ TABLE[key] = (flg, cnt)", "+ dp.append((cnt, key, nyx, flg))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2854871392, "measured_runtime_v1": 0.2155938864, "runtime_lift": 1.3241894008, "key": ["s237914915", "s694650984"], "target_token_count_dream": 375, "target_token_bucket_dream": "256-512"} +{"user_id": "u562935282", "problem_id": "p03371", "language": "python", "submission_id_v0": "s168362535", "submission_id_v1": "s471284270", "cpu_time_v0": 242, "cpu_time_v1": 98, "memory_v0": 3060, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 59.5, "input": "inf = (5000 * 10 ** 5) * 3\n\n\n\na, b, c, x, y = list(map(int, input().split()))\n\n\n\nret = inf\n\nfor cnt_ab in range(max(x, y) * 2 + 1):\n\n d = cnt_ab // 2\n\n\n\n cnt_a = max(0, x - d)\n\n cnt_b = max(0, y - d)\n\n\n\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n\n ret = min(ret, t)\n\nprint(ret)\n", "target": "def main():\n\n A, B, AB, X, Y = list(map(int, input().split()))\n\n M = max(X, Y)\n\n\n\n k = 0\n\n ans = A * X + B * Y\n\n while True:\n\n ans = min(\n\n ans,\n\n AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B\n\n )\n\n\n\n if k >= M: break\n\n k += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 14, "code_v1_loc": 20, "code_v0_num_chars": 284, "code_v1_num_chars": 353, "code_v0_no_empty_lines": "inf = (5000 * 10**5) * 3\na, b, c, x, y = list(map(int, input().split()))\nret = inf\nfor cnt_ab in range(max(x, y) * 2 + 1):\n d = cnt_ab // 2\n cnt_a = max(0, x - d)\n cnt_b = max(0, y - d)\n t = cnt_ab * c + cnt_a * a + cnt_b * b\n ret = min(ret, t)\nprint(ret)\n", "code_v1_no_empty_lines": "def main():\n A, B, AB, X, Y = list(map(int, input().split()))\n M = max(X, Y)\n k = 0\n ans = A * X + B * Y\n while True:\n ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)\n if k >= M:\n break\n k += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 30.0, "diff": ["-inf = (5000 * 10**5) * 3", "-a, b, c, x, y = list(map(int, input().split()))", "-ret = inf", "-for cnt_ab in range(max(x, y) * 2 + 1):", "- d = cnt_ab // 2", "- cnt_a = max(0, x - d)", "- cnt_b = max(0, y - d)", "- t = cnt_ab * c + cnt_a * a + cnt_b * b", "- ret = min(ret, t)", "-print(ret)", "+def main():", "+ A, B, AB, X, Y = list(map(int, input().split()))", "+ M = max(X, Y)", "+ k = 0", "+ ans = A * X + B * Y", "+ while True:", "+ ans = min(ans, AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B)", "+ if k >= M:", "+ break", "+ k += 1", "+ print(ans)", "+", "+", "+if __name__ == \"__main__\":", "+ main()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4937371187, "measured_runtime_v1": 0.3021148317, "runtime_lift": 1.6342697111, "key": ["s168362535", "s471284270"], "target_token_count_dream": 122, "target_token_bucket_dream": "<128"} +{"user_id": "u349449706", "problem_id": "p02555", "language": "python", "submission_id_v0": "s796837031", "submission_id_v1": "s077713004", "cpu_time_v0": 96, "cpu_time_v1": 64, "memory_v0": 68168, "memory_v1": 63448, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 33.33, "input": "S = int(input())\n\nf = [0]*(S+1)\n\nf[0] = 1\n\nif S >= 3: f[3] = 1\n\nif S >= 4: f[4] = 1\n\nif S >= 5: f[5] = 1\n\nfor i in range(6, S+1):\n\n f[i] = sum(f[i-j] for j in range(3, i+1))%(10**9+7)\n\nprint((f[S]))\n", "target": "S=int(input())\n\nf=[1,0,0]\n\nfor i in range(S-2):f.append(f[i]+f[i+2])\n\nprint((f[S]%(10**9+7)))\n", "code_v0_loc": 9, "code_v1_loc": 4, "code_v0_num_chars": 200, "code_v1_num_chars": 92, "code_v0_no_empty_lines": "S = int(input())\nf = [0] * (S + 1)\nf[0] = 1\nif S >= 3:\n f[3] = 1\nif S >= 4:\n f[4] = 1\nif S >= 5:\n f[5] = 1\nfor i in range(6, S + 1):\n f[i] = sum(f[i - j] for j in range(3, i + 1)) % (10**9 + 7)\nprint((f[S]))\n", "code_v1_no_empty_lines": "S = int(input())\nf = [1, 0, 0]\nfor i in range(S - 2):\n f.append(f[i] + f[i + 2])\nprint((f[S] % (10**9 + 7)))\n", "code_same": false, "relative_loc_diff_percent": 55.5555555556, "diff": ["-f = [0] * (S + 1)", "-f[0] = 1", "-if S >= 3:", "- f[3] = 1", "-if S >= 4:", "- f[4] = 1", "-if S >= 5:", "- f[5] = 1", "-for i in range(6, S + 1):", "- f[i] = sum(f[i - j] for j in range(3, i + 1)) % (10**9 + 7)", "-print((f[S]))", "+f = [1, 0, 0]", "+for i in range(S - 2):", "+ f.append(f[i] + f[i + 2])", "+print((f[S] % (10**9 + 7)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5486869376, "measured_runtime_v1": 0.341561399, "runtime_lift": 1.6064079231, "key": ["s796837031", "s077713004"], "target_token_count_dream": 43, "target_token_bucket_dream": "<128"} +{"user_id": "u296518383", "problem_id": "p03806", "language": "python", "submission_id_v0": "s823150149", "submission_id_v1": "s174409855", "cpu_time_v0": 255, "cpu_time_v1": 220, "memory_v0": 44124, "memory_v1": 43356, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 13.73, "input": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(401)] for i in range(401)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(400, -1, -1):\n\n for j in range(400, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, 401):\n\n for j in range(1, 401):\n\n if dp[i][j] != INF and i / j == Ma / Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))", "target": "import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nsumA = sum([ABC[i][0] for i in range(N)])\n\nsumB = sum([ABC[i][1] for i in range(N)])\n\n\n\nINF = 10 ** 15\n\ndp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]\n\ndp[0][0] = 0\n\n\n\nfor a, b, c in ABC:\n\n for i in range(sumA, -1, -1):\n\n for j in range(sumB, -1, -1):\n\n if dp[i][j] != INF:\n\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\n\n\n\nanswer = INF\n\nfor i in range(1, sumA + 1):\n\n for j in range(1, sumB + 1):\n\n if dp[i][j] != INF and i / j == Ma / Mb:\n\n answer = min(answer, dp[i][j])\n\n \n\nprint((answer if answer != INF else -1))", "code_v0_loc": 23, "code_v1_loc": 26, "code_v0_num_chars": 611, "code_v1_num_chars": 721, "code_v0_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nN, Ma, Mb = list(map(int, input().split()))\nABC = [list(map(int, input().split())) for _ in range(N)]\nINF = 10**15\ndp = [[INF for j in range(401)] for i in range(401)]\ndp[0][0] = 0\nfor a, b, c in ABC:\n for i in range(400, -1, -1):\n for j in range(400, -1, -1):\n if dp[i][j] != INF:\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\nanswer = INF\nfor i in range(1, 401):\n for j in range(1, 401):\n if dp[i][j] != INF and i / j == Ma / Mb:\n answer = min(answer, dp[i][j])\nprint((answer if answer != INF else -1))\n", "code_v1_no_empty_lines": "import sys\n\ninput = sys.stdin.buffer.readline\nN, Ma, Mb = list(map(int, input().split()))\nABC = [list(map(int, input().split())) for _ in range(N)]\nsumA = sum([ABC[i][0] for i in range(N)])\nsumB = sum([ABC[i][1] for i in range(N)])\nINF = 10**15\ndp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]\ndp[0][0] = 0\nfor a, b, c in ABC:\n for i in range(sumA, -1, -1):\n for j in range(sumB, -1, -1):\n if dp[i][j] != INF:\n dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)\nanswer = INF\nfor i in range(1, sumA + 1):\n for j in range(1, sumB + 1):\n if dp[i][j] != INF and i / j == Ma / Mb:\n answer = min(answer, dp[i][j])\nprint((answer if answer != INF else -1))\n", "code_same": false, "relative_loc_diff_percent": 11.5384615385, "diff": ["+sumA = sum([ABC[i][0] for i in range(N)])", "+sumB = sum([ABC[i][1] for i in range(N)])", "-dp = [[INF for j in range(401)] for i in range(401)]", "+dp = [[INF for j in range(sumB + 1)] for i in range(sumA + 1)]", "- for i in range(400, -1, -1):", "- for j in range(400, -1, -1):", "+ for i in range(sumA, -1, -1):", "+ for j in range(sumB, -1, -1):", "-for i in range(1, 401):", "- for j in range(1, 401):", "+for i in range(1, sumA + 1):", "+ for j in range(1, sumB + 1):"], "diff_only_import_comment": false, "measured_runtime_v0": 0.8101779278, "measured_runtime_v1": 0.2126889092, "runtime_lift": 3.8092156792, "key": ["s823150149", "s174409855"], "target_token_count_dream": 267, "target_token_bucket_dream": "256-512"} +{"user_id": "u064505481", "problem_id": "p02555", "language": "python", "submission_id_v0": "s988049268", "submission_id_v1": "s031685542", "cpu_time_v0": 173, "cpu_time_v1": 74, "memory_v0": 76464, "memory_v1": 70408, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 57.23, "input": "from sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\nsetrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\t@lru_cache(None)\n\n\tdef dp(currsum):\n\n\t\tif currsum == s: return 1\n\n\t\tcnt = 0\n\n\t\tfor d in range(3, 2001):\n\n\t\t\tif currsum + d <= s:\n\n\t\t\t\tcnt += dp(currsum + d)\n\n\t\t\t\tcnt %= MOD \n\n\t\treturn cnt\n\n\tprint((dp(0)))\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "target": "from sys import stdin, stdout, setrecursionlimit\n\nfrom collections import deque, defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nfrom functools import lru_cache\n\nimport math\n\n\n\n#setrecursionlimit(10**6)\n\nrl = lambda: stdin.readline()\n\nrll = lambda: stdin.readline().split()\n\nrli = lambda: list(map(int, stdin.readline().split()))\n\nrlf = lambda: list(map(float, stdin.readline().split()))\n\n\n\nINF, NINF = float('inf'), float('-inf')\n\nMOD = 10**9 + 7\n\n\n\ndef main():\n\n\ts = int(rl())\n\n\n\n\tdef binom_tables(n, q):\n\n\t\tfact = [1 for _ in range(n + 1)]\n\n\t\tinv = [1 for _ in range(n + 1)]\n\n\t\tfor i in range(1, n+1):\n\n\t\t\tfact[i] = (fact[i-1] * i) % q\n\n\t\t\tinv[i] = pow(fact[i], q-2, q)\n\n\t\treturn fact, inv\n\n\n\n\tF, I = binom_tables(s + 700, MOD)\n\n\n\n\tdef binom(n, k, q):\n\n\t\treturn (F[n]*((I[k]*I[n-k])%q))%q\n\n\n\n\tans = 0\n\n\tfor r in range(1, 700):\n\n\t\tobjects = s - 3*r\n\n\t\tif objects + r - 1 < objects or objects < 0: \n\n\t\t\tbreak\n\n\t\tx = binom(objects + r - 1, objects, MOD)\n\n\t\tans += x\n\n\t\tans %= MOD \n\n\n\n\tprint(ans)\n\n\tstdout.close()\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()", "code_v0_loc": 32, "code_v1_loc": 45, "code_v0_num_chars": 739, "code_v1_num_chars": 1050, "code_v0_no_empty_lines": "from sys import stdin, stdout, setrecursionlimit\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\nfrom functools import lru_cache\nimport math\n\nsetrecursionlimit(10**6)\nrl = lambda: stdin.readline()\nrll = lambda: stdin.readline().split()\nrli = lambda: list(map(int, stdin.readline().split()))\nrlf = lambda: list(map(float, stdin.readline().split()))\nINF, NINF = float(\"inf\"), float(\"-inf\")\nMOD = 10**9 + 7\n\n\ndef main():\n s = int(rl())\n\n @lru_cache(None)\n def dp(currsum):\n if currsum == s:\n return 1\n cnt = 0\n for d in range(3, 2001):\n if currsum + d <= s:\n cnt += dp(currsum + d)\n cnt %= MOD\n return cnt\n\n print((dp(0)))\n stdout.close()\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "from sys import stdin, stdout, setrecursionlimit\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\nfrom functools import lru_cache\nimport math\n\n# setrecursionlimit(10**6)\nrl = lambda: stdin.readline()\nrll = lambda: stdin.readline().split()\nrli = lambda: list(map(int, stdin.readline().split()))\nrlf = lambda: list(map(float, stdin.readline().split()))\nINF, NINF = float(\"inf\"), float(\"-inf\")\nMOD = 10**9 + 7\n\n\ndef main():\n s = int(rl())\n\n def binom_tables(n, q):\n fact = [1 for _ in range(n + 1)]\n inv = [1 for _ in range(n + 1)]\n for i in range(1, n + 1):\n fact[i] = (fact[i - 1] * i) % q\n inv[i] = pow(fact[i], q - 2, q)\n return fact, inv\n\n F, I = binom_tables(s + 700, MOD)\n\n def binom(n, k, q):\n return (F[n] * ((I[k] * I[n - k]) % q)) % q\n\n ans = 0\n for r in range(1, 700):\n objects = s - 3 * r\n if objects + r - 1 < objects or objects < 0:\n break\n x = binom(objects + r - 1, objects, MOD)\n ans += x\n ans %= MOD\n print(ans)\n stdout.close()\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 28.8888888889, "diff": ["-setrecursionlimit(10**6)", "+# setrecursionlimit(10**6)", "- @lru_cache(None)", "- def dp(currsum):", "- if currsum == s:", "- return 1", "- cnt = 0", "- for d in range(3, 2001):", "- if currsum + d <= s:", "- cnt += dp(currsum + d)", "- cnt %= MOD", "- return cnt", "+ def binom_tables(n, q):", "+ fact = [1 for _ in range(n + 1)]", "+ inv = [1 for _ in range(n + 1)]", "+ for i in range(1, n + 1):", "+ fact[i] = (fact[i - 1] * i) % q", "+ inv[i] = pow(fact[i], q - 2, q)", "+ return fact, inv", "- print((dp(0)))", "+ F, I = binom_tables(s + 700, MOD)", "+", "+ def binom(n, k, q):", "+ return (F[n] * ((I[k] * I[n - k]) % q)) % q", "+", "+ ans = 0", "+ for r in range(1, 700):", "+ objects = s - 3 * r", "+ if objects + r - 1 < objects or objects < 0:", "+ break", "+ x = binom(objects + r - 1, objects, MOD)", "+ ans += x", "+ ans %= MOD", "+ print(ans)"], "diff_only_import_comment": false, "measured_runtime_v0": 0.7214400458, "measured_runtime_v1": 0.2090635548, "runtime_lift": 3.4508168897, "key": ["s988049268", "s031685542"], "target_token_count_dream": 360, "target_token_bucket_dream": "256-512"} +{"user_id": "u752898745", "problem_id": "p03307", "language": "python", "submission_id_v0": "s632972821", "submission_id_v1": "s560495025", "cpu_time_v0": 37, "cpu_time_v1": 17, "memory_v0": 5304, "memory_v1": 2940, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 54.05, "input": "import math\n\nn=int(input())\n\nprint(((2*n)//math.gcd(2,n)))", "target": "N=int(input());print((N if N%2==0 else N*2))", "code_v0_loc": 3, "code_v1_loc": 1, "code_v0_num_chars": 66, "code_v1_num_chars": 42, "code_v0_no_empty_lines": "import math\n\nn = int(input())\nprint(((2 * n) // math.gcd(2, n)))\n", "code_v1_no_empty_lines": "N = int(input())\nprint((N if N % 2 == 0 else N * 2))\n", "code_same": false, "relative_loc_diff_percent": 66.6666666667, "diff": ["-import math", "-", "-n = int(input())", "-print(((2 * n) // math.gcd(2, n)))", "+N = int(input())", "+print((N if N % 2 == 0 else N * 2))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.4506682441, "measured_runtime_v1": 0.3598311198, "runtime_lift": 1.2524437697, "key": ["s632972821", "s560495025"], "target_token_count_dream": 18, "target_token_bucket_dream": "<128"} +{"user_id": "u347640436", "problem_id": "p03854", "language": "python", "submission_id_v0": "s259161069", "submission_id_v1": "s688102427", "cpu_time_v0": 1216, "cpu_time_v1": 697, "memory_v0": 3420, "memory_v1": 3992, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 42.68, "input": "import sys\n\ns = input()\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n if s == t + w:\n\n print('YES')\n\n sys.exit()\n\n if s.startswith(t + w):\n\n nts.append(t + w)\n\n if len(nts) == 0:\n\n print('NO')\n\n sys.exit()\n\n ts = nts\n", "target": "from sys import exit\n\ns = input()\n\nts = ['']\n\nwhile True:\n\n nts= []\n\n for t in ts:\n\n for w in ['dreamer', 'eraser', 'dream', 'erase']:\n\n tw = t + w\n\n if s == tw:\n\n print('YES')\n\n exit()\n\n if s.startswith(tw):\n\n nts.append(tw)\n\n if len(nts) == 0:\n\n print('NO')\n\n exit()\n\n ts = nts\n", "code_v0_loc": 16, "code_v1_loc": 17, "code_v0_num_chars": 320, "code_v1_num_chars": 329, "code_v0_no_empty_lines": "import sys\n\ns = input()\nts = [\"\"]\nwhile True:\n nts = []\n for t in ts:\n for w in [\"dreamer\", \"eraser\", \"dream\", \"erase\"]:\n if s == t + w:\n print(\"YES\")\n sys.exit()\n if s.startswith(t + w):\n nts.append(t + w)\n if len(nts) == 0:\n print(\"NO\")\n sys.exit()\n ts = nts\n", "code_v1_no_empty_lines": "from sys import exit\n\ns = input()\nts = [\"\"]\nwhile True:\n nts = []\n for t in ts:\n for w in [\"dreamer\", \"eraser\", \"dream\", \"erase\"]:\n tw = t + w\n if s == tw:\n print(\"YES\")\n exit()\n if s.startswith(tw):\n nts.append(tw)\n if len(nts) == 0:\n print(\"NO\")\n exit()\n ts = nts\n", "code_same": false, "relative_loc_diff_percent": 5.8823529412, "diff": ["-import sys", "+from sys import exit", "-s = input()", "+s = input()", "- if s == t + w:", "+ tw = t + w", "+ if s == tw:", "- sys.exit()", "- if s.startswith(t + w):", "- nts.append(t + w)", "+ exit()", "+ if s.startswith(tw):", "+ nts.append(tw)", "- sys.exit()", "+ exit()"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2929967599, "measured_runtime_v1": 0.1979754126, "runtime_lift": 1.4799653958, "key": ["s259161069", "s688102427"], "target_token_count_dream": 105, "target_token_bucket_dream": "<128"} +{"user_id": "u584658281", "problem_id": "p02688", "language": "python", "submission_id_v0": "s600438109", "submission_id_v1": "s928531547", "cpu_time_v0": 27, "cpu_time_v1": 24, "memory_v0": 9216, "memory_v1": 9264, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 11.11, "input": "N,K=list(map(int,input().split()))\n\na = [[0]*N]*K\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(input())\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)", "target": "N,K=list(map(int,input().split()))\n\na = [[0 for n in range(N)] for k in range(K)]\n\n\n\nfor k in range(K):\n\n d=int(input())\n\n have_k=list(map(int,input().split()))\n\n for h in have_k:\n\n a[k][h-1]=1\n\n\n\nan=[0]*N\n\nfor k in range(K):\n\n for n in range(N):\n\n an[n] = an[n]+a[k][n]\n\n\n\nresult=0\n\nfor i in an:\n\n if i == 0:\n\n result+=1\n\n\n\nprint(result)", "code_v0_loc": 21, "code_v1_loc": 20, "code_v0_num_chars": 365, "code_v1_num_chars": 350, "code_v0_no_empty_lines": "N, K = list(map(int, input().split()))\na = [[0] * N] * K\na = [[0 for n in range(N)] for k in range(K)]\nfor k in range(K):\n d = int(input())\n have_k = list(map(int, input().split()))\n for h in have_k:\n a[k][h - 1] = 1\nan = [0] * N\nfor k in range(K):\n for n in range(N):\n an[n] = an[n] + a[k][n]\nresult = 0\nfor i in an:\n if i == 0:\n result += 1\nprint(result)\n", "code_v1_no_empty_lines": "N, K = list(map(int, input().split()))\na = [[0 for n in range(N)] for k in range(K)]\nfor k in range(K):\n d = int(input())\n have_k = list(map(int, input().split()))\n for h in have_k:\n a[k][h - 1] = 1\nan = [0] * N\nfor k in range(K):\n for n in range(N):\n an[n] = an[n] + a[k][n]\nresult = 0\nfor i in an:\n if i == 0:\n result += 1\nprint(result)\n", "code_same": false, "relative_loc_diff_percent": 4.7619047619, "diff": ["-a = [[0] * N] * K"], "diff_only_import_comment": false, "measured_runtime_v0": 0.33595281, "measured_runtime_v1": 0.2656919487, "runtime_lift": 1.264444827, "key": ["s600438109", "s928531547"], "target_token_count_dream": 120, "target_token_bucket_dream": "<128"} +{"user_id": "u156896646", "problem_id": "p03854", "language": "python", "submission_id_v0": "s725954700", "submission_id_v1": "s400985362", "cpu_time_v0": 76, "cpu_time_v1": 64, "memory_v0": 21348, "memory_v1": 21348, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 15.79, "input": "import sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = input()\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isDream #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n #print('d:', d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #; print(d, pout)\n\n if pout == len(S): \n\n isDream = True #; print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisDream = False\n\ndayDream(0)\n\nif isDream:\n\n print('YES')\n\nelse:\n\n print('NO')", "target": "import sys\n\nsys.setrecursionlimit(1000000)\n\n\n\nS = input()\n\n\n\nT = ['dream', 'dreamer', 'erase', 'eraser']\n\nlenT = [len(i) for i in T]\n\n\n\ndef dayDream(pin):\n\n global isGoal #;print('dayDream: ', pin, S[pin:])\n\n for i, d in enumerate(T):\n\n if isGoal:\n\n return\n\n #print('i, d:', i, d)\n\n if S[pin:pin+lenT[i]] == d: \n\n pout = pin + lenT[i] #;print(d, pout)\n\n if pout == len(S): \n\n isGoal = True #;print('YES')\n\n return \n\n else:\n\n dayDream(pout)\n\n #print('dayDream return', pin)\n\n return\n\n \n\nisGoal = False\n\ndayDream(0)\n\nif isGoal:\n\n print('YES')\n\nelse:\n\n print('NO')", "code_v0_loc": 28, "code_v1_loc": 30, "code_v0_num_chars": 694, "code_v1_num_chars": 735, "code_v0_no_empty_lines": "import sys\n\nsys.setrecursionlimit(1000000)\nS = input()\nT = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nlenT = [len(i) for i in T]\n\n\ndef dayDream(pin):\n global isDream # ;print('dayDream: ', pin, S[pin:])\n for i, d in enumerate(T):\n # print('d:', d)\n if S[pin : pin + lenT[i]] == d:\n pout = pin + lenT[i] # ; print(d, pout)\n if pout == len(S):\n isDream = True # ; print('YES')\n return\n else:\n dayDream(pout)\n # print('dayDream return', pin)\n return\n\n\nisDream = False\ndayDream(0)\nif isDream:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_v1_no_empty_lines": "import sys\n\nsys.setrecursionlimit(1000000)\nS = input()\nT = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\nlenT = [len(i) for i in T]\n\n\ndef dayDream(pin):\n global isGoal # ;print('dayDream: ', pin, S[pin:])\n for i, d in enumerate(T):\n if isGoal:\n return\n # print('i, d:', i, d)\n if S[pin : pin + lenT[i]] == d:\n pout = pin + lenT[i] # ;print(d, pout)\n if pout == len(S):\n isGoal = True # ;print('YES')\n return\n else:\n dayDream(pout)\n # print('dayDream return', pin)\n return\n\n\nisGoal = False\ndayDream(0)\nif isGoal:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "code_same": false, "relative_loc_diff_percent": 6.6666666667, "diff": ["- global isDream # ;print('dayDream: ', pin, S[pin:])", "+ global isGoal # ;print('dayDream: ', pin, S[pin:])", "- # print('d:', d)", "+ if isGoal:", "+ return", "+ # print('i, d:', i, d)", "- pout = pin + lenT[i] # ; print(d, pout)", "+ pout = pin + lenT[i] # ;print(d, pout)", "- isDream = True # ; print('YES')", "+ isGoal = True # ;print('YES')", "-isDream = False", "+isGoal = False", "-if isDream:", "+if isGoal:"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3036904747, "measured_runtime_v1": 0.2140211895, "runtime_lift": 1.4189738666, "key": ["s725954700", "s400985362"], "target_token_count_dream": 209, "target_token_bucket_dream": "128-256"} +{"user_id": "u163320134", "problem_id": "p03037", "language": "python", "submission_id_v0": "s012458960", "submission_id_v1": "s740832114", "cpu_time_v0": 351, "cpu_time_v1": 278, "memory_v0": 6900, "memory_v1": 3060, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 20.8, "input": "n,m=list(map(int,input().split()))\n\nc=[0]*(n+2)\n\nfor i in range(m):\n\n l,r=list(map(int,input().split()))\n\n c[l-1]+=1\n\n c[r]-=1\n\nfor i in range(1,n+2):\n\n c[i]=c[i]+c[i-1]\n\nans=0\n\nfor i in range(n+2):\n\n if c[i]==m:\n\n ans+=1\n\nprint(ans)", "target": "n,m=list(map(int,input().split()))\n\nl,r=list(map(int,input().split()))\n\nfor i in range(m-1):\n\n tl,tr=list(map(int,input().split()))\n\n if l=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]][0]))", "target": "n=int(input())\n\nedges=[]\n\nrelations={}\n\nnodes=[0,0]\n\nfor i in range(n-1):\n\n a,b=list(map(int,input().split(\" \")))\n\n edges.append([a,b])\n\n relations.setdefault(a,[]).append(b)\n\n nodes.append(0)\n\n\n\nmax_color=0\n\nfor start in range(1,n+1):\n\n targets=relations.get(start,[])\n\n color=1\n\n for target in targets:\n\n if color == nodes[start]:\n\n color+=1\n\n else:\n\n pass\n\n nodes[target]=color\n\n if color>=max_color:\n\n max_color=color\n\n color+=1\n\n\n\nprint(max_color)\n\nfor edge in edges:\n\n print((nodes[edge[1]]))", "code_v0_loc": 32, "code_v1_loc": 27, "code_v0_num_chars": 684, "code_v1_num_chars": 582, "code_v0_no_empty_lines": "import copy\n\nn = int(input())\norg_set = set([i for i in range(1, 10**5)])\nedges = []\nrelations = {}\nnodes = []\nfor i in range(n - 1):\n a, b = list(map(int, input().split(\" \")))\n edges.append([a, b])\n relations.setdefault(a, []).append(b)\n nodes.append([])\nnodes.append([])\nnodes.append([])\nmax_color = 0\nfor start in range(1, n + 1):\n targets = relations.get(start, [])\n color = 1\n for target in targets:\n if color in nodes[start]:\n color += 1\n else:\n pass\n nodes[target].append(color)\n if color >= max_color:\n max_color = color\n color += 1\nprint(max_color)\nfor edge in edges:\n print((nodes[edge[1]][0]))\n", "code_v1_no_empty_lines": "n = int(input())\nedges = []\nrelations = {}\nnodes = [0, 0]\nfor i in range(n - 1):\n a, b = list(map(int, input().split(\" \")))\n edges.append([a, b])\n relations.setdefault(a, []).append(b)\n nodes.append(0)\nmax_color = 0\nfor start in range(1, n + 1):\n targets = relations.get(start, [])\n color = 1\n for target in targets:\n if color == nodes[start]:\n color += 1\n else:\n pass\n nodes[target] = color\n if color >= max_color:\n max_color = color\n color += 1\nprint(max_color)\nfor edge in edges:\n print((nodes[edge[1]]))\n", "code_same": false, "relative_loc_diff_percent": 15.625, "diff": ["-import copy", "-", "-org_set = set([i for i in range(1, 10**5)])", "-nodes = []", "+nodes = [0, 0]", "- nodes.append([])", "-nodes.append([])", "-nodes.append([])", "+ nodes.append(0)", "- if color in nodes[start]:", "+ if color == nodes[start]:", "- nodes[target].append(color)", "+ nodes[target] = color", "- print((nodes[edge[1]][0]))", "+ print((nodes[edge[1]]))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.2673016732, "measured_runtime_v1": 0.1941296165, "runtime_lift": 1.3769237172, "key": ["s596506481", "s115492739"], "target_token_count_dream": 153, "target_token_bucket_dream": "128-256"} +{"user_id": "u046158516", "problem_id": "p02691", "language": "python", "submission_id_v0": "s021965299", "submission_id_v1": "s412762136", "cpu_time_v0": 193, "cpu_time_v1": 144, "memory_v0": 32248, "memory_v1": 111628, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 25.39, "input": "n=int(input())\n\na=list(map(int,input().split()))\n\nk=[]\n\nans=0\n\nfor i in range(400005):\n\n k.append(0)\n\nfor i in range(n):\n\n if i-a[i]>=0:\n\n ans+=k[i-a[i]]\n\n if a[i]+i<400005:\n\n k[a[i]+i]+=1\n\nprint(ans)", "target": "n=int(input())\n\na=list(map(int,input().split()))\n\nthing={}\n\nans=0\n\nfor i in range(n):\n\n if i-a[i] in thing:\n\n ans+=thing[i-a[i]]\n\n if i+a[i] in thing:\n\n thing[i+a[i]]+=1\n\n else:\n\n thing[i+a[i]]=1\n\nprint(ans)", "code_v0_loc": 12, "code_v1_loc": 12, "code_v0_num_chars": 209, "code_v1_num_chars": 219, "code_v0_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nk = []\nans = 0\nfor i in range(400005):\n k.append(0)\nfor i in range(n):\n if i - a[i] >= 0:\n ans += k[i - a[i]]\n if a[i] + i < 400005:\n k[a[i] + i] += 1\nprint(ans)\n", "code_v1_no_empty_lines": "n = int(input())\na = list(map(int, input().split()))\nthing = {}\nans = 0\nfor i in range(n):\n if i - a[i] in thing:\n ans += thing[i - a[i]]\n if i + a[i] in thing:\n thing[i + a[i]] += 1\n else:\n thing[i + a[i]] = 1\nprint(ans)\n", "code_same": false, "relative_loc_diff_percent": 0.0, "diff": ["-k = []", "+thing = {}", "-for i in range(400005):", "- k.append(0)", "- if i - a[i] >= 0:", "- ans += k[i - a[i]]", "- if a[i] + i < 400005:", "- k[a[i] + i] += 1", "+ if i - a[i] in thing:", "+ ans += thing[i - a[i]]", "+ if i + a[i] in thing:", "+ thing[i + a[i]] += 1", "+ else:", "+ thing[i + a[i]] = 1"], "diff_only_import_comment": false, "measured_runtime_v0": 0.5354380305, "measured_runtime_v1": 0.0057934456, "runtime_lift": 92.4213443454, "key": ["s021965299", "s412762136"], "target_token_count_dream": 74, "target_token_bucket_dream": "<128"} +{"user_id": "u634079249", "problem_id": "p02881", "language": "python", "submission_id_v0": "s671057519", "submission_id_v1": "s116621872", "cpu_time_v0": 992, "cpu_time_v1": 126, "memory_v0": 3064, "memory_v1": 3064, "status_v0": "Accepted", "status_v1": "Accepted", "improvement_frac": 87.3, "input": "import sys\n\nimport os\n\nimport math\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n ret = float('inf')\n\n I = int(math.sqrt(N)) * 10\n\n for i in range(1, I):\n\n if N%i == 0:\n\n j = N//i\n\n ret = min(ret, j + i - 2)\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "target": "import sys\n\nimport os\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n m = int(N ** .5)\n\n while N % m != 0:\n\n m -= 1\n\n else:\n\n print((int(N / m + m - 2)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n", "code_v0_loc": 29, "code_v1_loc": 25, "code_v0_num_chars": 717, "code_v1_num_chars": 627, "code_v0_no_empty_lines": "import sys\nimport os\nimport math\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = ii()\n ret = float(\"inf\")\n I = int(math.sqrt(N)) * 10\n for i in range(1, I):\n if N % i == 0:\n j = N // i\n ret = min(ret, j + i - 2)\n print(ret)\n\n\nif __name__ == \"__main__\":\n main()\n", "code_v1_no_empty_lines": "import sys\nimport os\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = ii()\n m = int(N**0.5)\n while N % m != 0:\n m -= 1\n else:\n print((int(N / m + m - 2)))\n\n\nif __name__ == \"__main__\":\n main()\n", "code_same": false, "relative_loc_diff_percent": 13.7931034483, "diff": ["-import math", "- ret = float(\"inf\")", "- I = int(math.sqrt(N)) * 10", "- for i in range(1, I):", "- if N % i == 0:", "- j = N // i", "- ret = min(ret, j + i - 2)", "- print(ret)", "+ m = int(N**0.5)", "+ while N % m != 0:", "+ m -= 1", "+ else:", "+ print((int(N / m + m - 2)))"], "diff_only_import_comment": false, "measured_runtime_v0": 0.3067429993, "measured_runtime_v1": 0.2119246759, "runtime_lift": 1.4474152099, "key": ["s671057519", "s116621872"], "target_token_count_dream": 173, "target_token_bucket_dream": "128-256"} diff --git a/python_splits/train_valtest.jsonl b/python_splits/train_valtest.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..756a7f292d928e5215880e60b2f659efbf5bdd0d --- /dev/null +++ b/python_splits/train_valtest.jsonl @@ -0,0 +1,100 @@ +{"problem_id": "p03657", "input": "print(((eval(input().replace(*' *'))%3%2*'Imp'or'P')+'ossible'))"} +{"problem_id": "p03556", "input": "n = int(input())\n\nfor i in range(n,0,-1):\n\n if i**0.5 == int(i**0.5):\n\n ans = i\n\n break\n\nprint(ans)"} +{"problem_id": "p02315", "input": "N,W=list(map(int,input().split()))\n\nI=[[*list(map(int,input().split()))]for _ in[0]*N]\n\nC=[0]*-~W\n\nfor i in range(1,N+1):\n\n v,w=I[~-i]\n\n for j in range(W,w-1,-1):\n\n t=v+C[j-w]\n\n if t>C[j]:C[j]=t\n\nprint((C[W]))\n"} +{"problem_id": "p03290", "input": "D,G = list(map(int,input().split()))\n\nP = []\n\nnum_p = 0\n\nfor i in range(1,D+1):\n\n p,c = list(map(int,input().split()))\n\n num_p += p\n\n for j in range(1,p+1):\n\n P += [(j,i*100*j+c*(j==p))]\n\ndp = [0]*(num_p+1)\n\nfor k,pt in P:\n\n if k==1:\n\n t_dp = dp[:]\n\n for cur in range(1,num_p+1):\n\n if cur>=k:\n\n dp[cur] = max(dp[cur], t_dp[cur-k]+pt)\n\nfor i in range(num_p+1):\n\n if dp[i]>=G:\n\n print(i)\n\n break"} +{"problem_id": "p02713", "input": "import math\n\nfrom functools import reduce\n\n\n\ndef gcd(*numbers):\n\n return reduce(math.gcd, numbers)\n\nK=int(input())\n\nans=[]\n\nfor i in range(1,K+1):\n\n for j in range(1,K+1):\n\n for k in range(1,K+1):\n\n ans.append(gcd(i,j,k))\n\nprint((sum(ans))) "} +{"problem_id": "p02913", "input": "N = int(input())\n\nS = input()\n\nr = 0\n\nans = 0\n\nfor i in range(N):\n\n while True:\n\n if S.rfind(S[i : r + 1]) >= r + 1:\n\n r += 1\n\n ans = max(ans, r - i)\n\n else:\n\n break\n\nprint(ans)"} +{"problem_id": "p02571", "input": "S = input().strip()\n\nT = input().strip()\n\nk = len(T)\n\ndmin = len(S)\n\nfor i in range(len(S)-k+1):\n\n cnt = 0\n\n for j in range(k):\n\n if S[i+j]!=T[j]:\n\n cnt += 1\n\n dmin = min(dmin,cnt)\n\nprint(dmin)"} +{"problem_id": "p03971", "input": "n, a, b = list(map(int, input().split()))\n\ns = input()\n\n\n\nA = 0\n\nB = 0\n\nfor i in s:\n\n if A + B < a + b:\n\n if i == \"a\":\n\n A += 1\n\n print(\"Yes\")\n\n elif i == \"b\" and B < b:\n\n B += 1\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")\n\n else:\n\n print(\"No\")\n"} +{"problem_id": "p03860", "input": "print((\"A%sC\"%input()[8]))"} +{"problem_id": "p03161", "input": "N, K = list(map(int,input().split()))\n\nh = list(map(int,input().split()))\n\n\n\ndp = [float(\"inf\")] * N\n\ndp[0] = 0\n\ndp[1] = abs(h[1] - h[0])\n\n\n\nfor i in range(2,N):\n\n for j in range(1,K+1):\n\n dp[i] = min(dp[i],dp[i-j] + abs(h[i] - h[i-j]))\n\n\n\nprint((dp[-1]))"} +{"problem_id": "p03644", "input": "N=int(input())\n\nn=1\n\n\n\nwhile(2*n<=N):\n\n n*=2\n\n\n\nprint(n)"} +{"problem_id": "p02862", "input": "MOD=10**9+7\n\nx , y = list(map(int, input().split()))\n\na=(2*x-y)//3\n\nb=(2*y-x)//3\n\nif 2*a+b!=x:\n\n print((0))\n\n exit()\n\n\n\nfactorial = [1]\n\ninverse = [1]\n\n\n\nn=a+b\n\nr=a\n\n\n\nfor i in range(1, n+2):\n\n factorial.append(factorial[-1] * i % MOD)\n\n inverse.append(pow(factorial[-1], MOD - 2, MOD))\n\n\n\ndef combi(n, r):\n\n if n < r or r < 0:\n\n return 0\n\n elif r == 0:\n\n return 1\n\n return factorial[n] * inverse[r] * inverse[n - r] % MOD\n\n\n\nans = combi(n,r)\n\nprint(ans)\n"} +{"problem_id": "p03775", "input": "n=int(input())\n\nfor i in range(int((n**0.5+1)//1),0,-1):\n\n if n/i%1==0:\n\n f=max(len(str(i)),len(str(n//i)))\n\n break\n\nprint(f)\n\n "} +{"problem_id": "p03127", "input": "def gcd(a,b):\n\n if b==0:\n\n return a\n\n else:\n\n return gcd(b,a%b)\n\n\n\nN=int(input())\n\nA=list(map(int,input().split()))\n\ng=A[0]\n\n\n\nfor i in range(1,N):\n\n g=gcd(g,A[i])\n\n\n\nprint(g)"} +{"problem_id": "p03329", "input": "def nbasesum(value,n):\n\n nbasevalue = 0\n\n while value > 0:\n\n nbasevalue += value%n\n\n value //= n\n\n return nbasevalue\n\n\n\nN = int(input())\n\nans = nbasesum(N,9)\n\n\n\nfor i in range(N+1):\n\n c6 = i\n\n c9 = N-i\n\n ans = min(ans, nbasesum(c9,9)+nbasesum(c6,6))\n\n\n\nprint(ans)\n"} +{"problem_id": "p02866", "input": "from collections import Counter\n\n\n\nn=int(input())\n\nd=list(map(int,input().split()))\n\nif d[0]!=0:\n\n print((0))\n\n exit()\n\nc=Counter(d)\n\nc=sorted(list(c.items()),key=lambda x:x[0])\n\nif c[0]!=(0,1):\n\n print((0))\n\n exit()\n\nans=1\n\ncheck=1\n\nfor i in range(1,len(c)):\n\n if c[i][0]!=check:\n\n print((0))\n\n exit()\n\n check+=1\n\n ans*=c[i-1][1]**c[i][1]\n\n ans%=998244353\n\nprint((ans%998244353))"} +{"problem_id": "p03145", "input": "ab,bc,ca = (int(i) for i in input().split())\n\nprint((ab*bc//2))"} +{"problem_id": "p03779", "input": "X = int(input())\n\n\n\nfor i in range(1,X+1):\n\n if((i*(i+1))/2 >= X):\n\n print(i)\n\n break"} +{"problem_id": "p02116", "input": "n = int(input())\n\nprint(((n+1) &- (n+1)))"} +{"problem_id": "p03329", "input": "import sys\n\nfrom math import log, floor\n\n\n\nn = int(sys.stdin.readline().rstrip())\n\n\n\ndef main():\n\n cand = set()\n\n for i in range(floor(log(n, 6)) + 1):\n\n if 6 ** i <= n:\n\n cand.add(6 ** i)\n\n if 9 ** i <= n:\n\n cand.add(9 ** i)\n\n cand = sorted(cand)\n\n\n\n res = set([0])\n\n cnt = 0\n\n while True:\n\n nex = set()\n\n for val in res:\n\n for c in cand:\n\n if val + c <= n:\n\n nex.add(val + c)\n\n else:\n\n break\n\n cnt += 1\n\n if n in nex:\n\n return cnt\n\n res = nex\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)"} +{"problem_id": "p03352", "input": "x=int(input())\n\na=set()\n\nfor i in range(1,1001):\n\n for j in range(2,34):\n\n t=i**j\n\n if t<=x:\n\n a.add(i**j)\n\na=list(a)\n\na.sort()\n\nprint((a[-1]))"} +{"problem_id": "p03608", "input": "# ABC073D - joisino's travel (218ms)\n\nfrom heapq import heapify, heappop, heappush\n\nfrom itertools import permutations\n\n\n\n\n\ndef dijkstra(G: \"Array[Array[int]]\", size: int, start: int) -> list:\n\n dist = [float(\"inf\")] * size\n\n queue = [(0, start)]\n\n heapify(queue)\n\n while queue:\n\n cost, v = heappop(queue)\n\n if cost > dist[v]:\n\n continue\n\n dist[v] = cost\n\n for next_cost, u in G[v]:\n\n if cost + next_cost < dist[u]:\n\n heappush(queue, (cost + next_cost, u))\n\n return dist\n\n\n\n\n\ndef main():\n\n global G, N\n\n N, M, R, *RABC = list(map(int, open(0).read().split()))\n\n visit, ABC = RABC[:R], RABC[R:]\n\n G = [[] for _ in range(N + 1)]\n\n for v, u, cost in zip(*[iter(ABC)] * 3):\n\n G[v].append((cost, u)), G[u].append((cost, v))\n\n dist = {v: dijkstra(G, N + 1, v) for v in visit}\n\n ans = float(\"inf\")\n\n for perm in permutations(visit):\n\n cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))\n\n ans = min(ans, cur)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()"} +{"problem_id": "p03241", "input": "import math\n\nN, M = list(map(int,input().split()))\n\n\n\nP = []\n\nfor k in range(1,math.floor(math.sqrt(M))+1):\n\n if M % k == 0:\n\n P.append(k)\n\n P.append(M//k)\n\nans = 1\n\nfor e in P:\n\n if e*N <= M:\n\n ans = max(ans,e)\n\nprint(ans)\n"} +{"problem_id": "p03745", "input": "N = int(input())\n\nsub = 0\n\ncount = 1\n\nA = [int(i) for i in input().split()]\n\nif N > 1:\n\n\tpre_num = A[1]\n\n\tpre_sub = A[1] - A[0]\n\nfor num in A[2:]:\n\n if not pre_num == num:\n\n if pre_sub * (num - pre_num) < 0:\n\n count += 1\n\n pre_sub = 0\n\n else:\n\n \tpre_sub = num - pre_num\n\n pre_num = num\n\nprint(count)"} +{"problem_id": "p03371", "input": "def main():\n\n a, b, c, x, y = (int(i) for i in input().split())\n\n ans = a*x + b*y\n\n ans = min(ans, 2*c*max(x, y))\n\n if x < y:\n\n d = y - x\n\n d *= b\n\n else:\n\n d = x - y\n\n d *= a\n\n ans = min(ans, 2*c*min(x, y)+d)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n"} +{"problem_id": "p02596", "input": "import sys\n\nimport math\n\nimport time\n\nsys.setrecursionlimit(int(1e6))\n\nif False:\n\n dprint = print\n\nelse:\n\n def dprint(*args):\n\n pass\n\n\n\nk = list(map(int, input().split()))[0]\n\n\n\nam = 7 % k\n\ni = 1\n\n\n\nfor i in range(k):\n\n if am==0:\n\n print(i+1)\n\n exit()\n\n else:\n\n i+=1\n\n am=(am*10+7)%k\n\n \n\nprint('-1')\n"} +{"problem_id": "p03401", "input": "N=int(input())\n\nalist=list(map(int,input().split()))\n\na2list=[0]+alist+[0]\n\n#print(a2list)\n\n\n\nalldist=0\n\nfor i in range(1,N+2):\n\n alldist+=abs(a2list[i]-a2list[i-1])\n\n#print(alldist)\n\n\n\nfor i in range(N):\n\n if a2list[i+1]-a2list[i]>=0 and a2list[i+2]-a2list[i+1]>=0:\n\n print(alldist)\n\n elif a2list[i+1]-a2list[i]<=0 and a2list[i+2]-a2list[i+1]<=0:\n\n print(alldist)\n\n else:\n\n dist=alldist-abs(a2list[i+1]-a2list[i])-abs(a2list[i+2]-a2list[i+1])+abs(a2list[i+2]-a2list[i])\n\n print(dist)"} +{"problem_id": "p03846", "input": "n = int(input())\n\na = list(map(int, input().split()))\n\nans = 0\n\nif n%2==1:\n\n dummy = [0]\n\n for i in range(1, 1+(len(a)-1)//2):\n\n dummy.append(2*i)\n\n dummy.append(2*i)\n\n if sorted(a) == dummy:\n\n ans = 2**((len(a)-1)//2)\n\nelse:\n\n dummy = []\n\n for i in range(1, 1+(len(a))//2):\n\n dummy.append(2*i - 1)\n\n dummy.append(2*i - 1)\n\n if sorted(a) == dummy:\n\n ans = 2**((len(a))//2)\n\nprint((ans%(10**9 + 7)))"} +{"problem_id": "p03425", "input": "from itertools import combinations\n\n\n\nn = int(input())\n\ns = [input() for _ in range(n)]\n\ns.sort()\n\nmarch = [0, 0, 0, 0, 0]\n\nst = ['M', 'A', 'R', 'C', 'H']\n\nfor i in range(n):\n\n for j in range(5):\n\n if s[i][0] == st[j]:\n\n march[j] += 1\n\n#print(march)\n\nif sum(march) == 0:\n\n print((0))\n\n exit()\n\n\n\nans = 0\n\n\n\na = list(combinations(list(range(5)), 3))\n\nfor i in range(len(a)):\n\n tmp = 1\n\n for j in a[i]:\n\n tmp *= march[j]\n\n ans += tmp\n\n\n\nprint(ans)"} +{"problem_id": "p02708", "input": "n, k = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\n\n\nans = 0\n\nfor t in range(k, n+2):\n\n mini = t * (t-1) // 2 % mod\n\n residue = n - t + 1\n\n maxim = mini + t * residue\n\n maxim %= mod\n\n count = maxim - mini + 1\n\n count %= mod\n\n ans += count\n\n ans %= mod\n\n\n\nprint(ans)\n"} +{"problem_id": "p03401", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nA.insert(0, 0)\n\nA.append(0)\n\na = 0\n\ncost = 0\n\nfor i in A:\n\n b = i\n\n cost += abs(a-b)\n\n a = b\n\ncost += abs(A[-1])\n\n\n\nori = cost\n\nfor i in range(1, len(A)-1):\n\n cost += abs(A[i-1]-A[i+1])\n\n cost -= abs(A[i-1]-A[i])+abs(A[i+1]-A[i])\n\n print(cost)\n\n cost = ori"} +{"problem_id": "p03294", "input": "N = int(input())\n\nA = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor i in range(N):\n\n ans += A[i] - 1\n\n \n\nprint(ans)"} +{"problem_id": "p03210", "input": "import sys\n\n\n\ncand = [7, 5, 3]\n\n\n\nx = int(sys.stdin.readline().rstrip())\n\n\n\ndef main():\n\n return 'YES' if x in cand else 'NO'\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)"} +{"problem_id": "p03608", "input": "# ABC073D - joisino's travel (210ms)\n\nfrom heapq import heapify, heappop, heappush\n\nfrom itertools import permutations\n\n\n\n\n\ndef dijkstra(source: int) -> list:\n\n dist = [float(\"inf\")] * (N + 1)\n\n undetermined = N # vertex_0 won't appear in 1-idx graph\n\n queue = [(0, source)]\n\n heapify(queue)\n\n while queue:\n\n cost, v = heappop(queue)\n\n if cost > dist[v]:\n\n continue\n\n dist[v] = cost\n\n for next_cost, u in G[v]:\n\n if cost + next_cost < dist[u]:\n\n heappush(queue, (cost + next_cost, u))\n\n undetermined -= 1\n\n if not undetermined:\n\n return dist\n\n\n\n\n\ndef main():\n\n global G, N\n\n N, M, R, *RABC = list(map(int, open(0).read().split()))\n\n visit, ABC = RABC[:R], RABC[R:]\n\n G = [[] for _ in range(N + 1)]\n\n for v, u, cost in zip(*[iter(ABC)] * 3):\n\n G[v].append((cost, u)), G[u].append((cost, v))\n\n dist = {v: dijkstra(v) for v in visit}\n\n ans = float(\"inf\")\n\n for perm in permutations(visit):\n\n cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))\n\n ans = min(ans, cur)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()"} +{"problem_id": "p03494", "input": "n=int(input())\n\nlist=[int(i) for i in input().split()]\n\n\n\nc_list=[]\n\nfor i in list:\n\n count=0\n\n while True:\n\n \n\n if i%2==0:\n\n i=i/2\n\n count+=1\n\n else:\n\n break\n\n c_list.append(count)\n\n\n\n \n\nprint((min(c_list)))\n\n "} +{"problem_id": "p03077", "input": "n=int(input())\n\nl=[int(input())for i in range(5)]\n\nprint(((n+min(l)-1)//min(l)+4))"} +{"problem_id": "p02996", "input": "N = int(input())\n\nli = []\n\nfor _ in range(N):\n\n a, b = list(map(int,input().split()))\n\n li.append([b,a,b])\n\n\n\nflag = True\n\nnow = 0\n\nli = sorted(li)\n\n\n\nfor a, b, c in li:\n\n now += b\n\n if now > c:\n\n print(\"No\")\n\n flag = False\n\n break\n\n \n\nif flag:\n\n print(\"Yes\")"} +{"problem_id": "p03293", "input": "s = input()\n\nt = input()\n\nfor _ in range(len(s)):\n\n s = s[-1]+s[:-1]\n\n #print(s)\n\n if s == t:\n\n print(\"Yes\")\n\n exit()\n\nprint(\"No\")"} +{"problem_id": "p02552", "input": "print((1-int(input())))"} +{"problem_id": "p03126", "input": "from collections import defaultdict\n\nn, m = list(map(int, input().split()))\n\ns = []\n\nfor _ in range(n):\n\n k, *a = list(map(int, input().split()))\n\n s.append(a)\n\ndd = defaultdict(int)\n\nfor l in s:\n\n for k in l:\n\n dd[k] += 1\n\n\n\nprint((sum(1 if v == n else 0 for k, v in list(dd.items()))))\n"} +{"problem_id": "p02784", "input": "h, n = list(map(int, input().split()))\n\na = [int(i) for i in input().split()]\n\n\n\nsum = 0\n\nfor i in range(n):\n\n\tsum += a[i]\n\n\n\nprint((\"Yes\" if h <= sum else \"No\"))"} +{"problem_id": "p02933", "input": "a=int(input())\n\ns=input()\n\nif a>=3200:\n\n print(s)\n\nelse:\n\n print('red')"} +{"problem_id": "p02865", "input": "N = int(input())\n\nprint(((N - 1) // 2))"} +{"problem_id": "p03971", "input": "n, a, b = list(map(int, input().split()))\n\ns = input()\n\ntuka = 0\n\nbr = 0\n\nfor i in range(n):\n\n if s[i] == 'a':\n\n if tuka < a+b:\n\n print('Yes')\n\n tuka += 1\n\n else:\n\n print('No')\n\n elif s[i] == 'b':\n\n if tuka < a+b and br < b:\n\n print('Yes')\n\n tuka += 1\n\n br += 1\n\n else:\n\n print('No')\n\n br += 1\n\n else:\n\n print('No')"} +{"problem_id": "p03363", "input": "from itertools import accumulate\n\nfrom collections import Counter\n\n\n\nn = int(input())\n\nA = list(map(int, input().split()))\n\nL = [0] + list(accumulate(A))\n\nC = Counter(L)\n\nans = 0\n\nfor i in list(C.values()):\n\n ans += i*(i-1)//2\n\nprint(ans)"} +{"problem_id": "p03073", "input": "S = input()\n\nA = []\n\nans = 0\n\nfor i in range(len(S)):\n\n if i % 2 == 0:\n\n A.append(1)\n\n else:\n\n A.append(0)\n\nfor i in range(len(S)):\n\n if int(S[i]) != int(A[i]):\n\n ans += 1\n\nprint((min(ans, len(S) - ans)))"} +{"problem_id": "p03215", "input": "import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10**5)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x)-1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nfrom itertools import accumulate\n\n\n\nn,k = li()\n\na = list(li())\n\n\n\na_cum = [0] + list(accumulate(a))\n\nsm_lst = []\n\nfor i in range(n+1):\n\n for j in range(i+1,n+1):\n\n sm_lst.append(a_cum[j] - a_cum[i])\n\n \n\npop = sm_lst\n\nans = 0\n\nfor bit in range(40,-1,-1):\n\n yes=[]\n\n no=[]\n\n \n\n for s in pop:\n\n if s & (1<= k:\n\n ans += (1<1:\n\n mid=(ok+ng)//2\n\n if L[mid]1:\n\n mid=(ok+ng)//2\n\n if L[mid]>target:\n\n ok=mid\n\n else:\n\n ng=mid\n\n return len(L)-ok\n\n \n\nans=0\n\nfor i in range(len(B)):\n\n data=B[i]\n\n ans+=(countA(data,A)*countC(data,C))\n\n \n\nprint(ans)"} +{"problem_id": "p02779", "input": "n, *a = list(map(int, open(0).read().split()))\n\nprint((\"YNEOS\"[len(set(a))!=len(a)::2]))"} +{"problem_id": "p03131", "input": "import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n k, a, b = list(map(int, input().split()))\n\n\n\n if b - a < 2:\n\n print((k + 1))\n\n else:\n\n n = k - a + 1\n\n res = a + n // 2 * (b - a)\n\n res += 1 if n % 2 != 0 else 0\n\n print(res)\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n"} +{"problem_id": "p02696", "input": "from sys import stdin\n\nimport sys\n\n \n\nA, B, N = [int(x) for x in stdin.readline().rstrip().split()]\n\n# N, M = [int(x) for x in stdin.readline().rstrip().split()]\n\n# U = input().split()\n\nans = int((A*N)/B)-A*int(N/B)\n\nans2=0\n\nif B-1= 0:\n\n break\n\n heappop(hand)\n\n S = max(sum(hand), S)\n\nprint(S)\n\n\n"} +{"problem_id": "p02658", "input": "N = int(input())\n\nA = list(map(int, input().split()))\n\nA.sort()\n\nans = 1\n\nmax_limit = 10 ** 18\n\nfor i in range(N):\n\n ans *= A[i]\n\n if ans > max_limit:\n\n ans = -1\n\n break\n\n\n\nif ans > max_limit:\n\n print((str(-1)))\n\nelse:\n\n print((str(ans)))"} +{"problem_id": "p04001", "input": "import itertools\n\ns = input()\n\nn = len(s)\n\nans=0\n\nfor op in itertools.product([\"+\",\"\"],repeat=n-1):\n\n tmp=\"\"\n\n for i in range(n-1):\n\n tmp+=s[i]+op[i]\n\n ans+=eval(tmp+s[-1])\n\nprint(ans)"} +{"problem_id": "p03103", "input": "List = []\n\nN, M = (int(x) for x in input().split())\n\nfor i in range(N):\n\n a, b = (int(x) for x in input().split())\n\n List.append([a, b])\n\n\n\nnum_of_drink, total_fee = 0, 0\n\nList = sorted(List, key=lambda x:x[0])\n\n\n\ntemp_M = M\n\nlist_of_num = []\n\nfor i in range(N):\n\n if temp_M <= List[i][1]:\n\n list_of_num.append(temp_M)\n\n break\n\n else:\n\n list_of_num.append(List[i][1])\n\n temp_M += -List[i][1]\n\nindex = 0\n\nfor x in list_of_num:\n\n total_fee += List[index][0] * x\n\n index += 1\n\nprint(total_fee)"} +{"problem_id": "p03610", "input": "s = str(input())\n\nl = []\n\nfor i in range(0,len(s),2):\n\n l.append(s[i])\n\nprint((\"\".join(l)))"} +{"problem_id": "p03241", "input": "# AGC112 D - Partition\n\nfrom math import floor\n\ndef divisor(n): \n\n i = 1\n\n table = []\n\n while i * i <= n:\n\n if n%i == 0:\n\n table.append(i)\n\n table.append(n//i)\n\n i += 1\n\n table = list(set(table))\n\n return table\n\n\n\n\n\nn,m=list(map(int,input().split()))\n\n\n\nn_max=floor(m/n)\n\ndiv_m=divisor(m)\n\ndiv_m.sort(reverse=True)\n\nans=0\n\nfor i in div_m:\n\n if i<=n_max:\n\n print(i)\n\n exit()\n"} +{"problem_id": "p02601", "input": "def main():\n\n import sys\n\n A,B,C=list(map(int,sys.stdin.readline().split()))\n\n K=int(sys.stdin.readline())\n\n for i in range(K+1):\n\n if B<=A:\n\n B*=2\n\n elif C<=B:\n\n C*=2\n\n else:\n\n print('Yes')\n\n return\n\n\n\n print('No')\n\n\n\nmain()"} +{"problem_id": "p03495", "input": "from collections import Counter\n\nn,k = list(map(int,input().split()))\n\ndic = Counter(list(map(int,input().split())))\n\nx = len(dic) - k\n\nlis = sorted(list(dic.items()), key = lambda z:z[1])\n\nans = 0\n\nfor i in range(x):\n\n ans += lis[i][1]\n\nprint(ans)"} +{"problem_id": "p03137", "input": "import heapq\n\nn,m = list(map(int, input().split(' ')))\n\n\n\n# I am given n pieces\n\nif n >= m:\n\n\tprint(0)\n\nelse:\n\n\txis = list(map(int, input().split()))\n\n\txis.sort()\n\n\n\n\n\n\tdistances = [v- u for u,v in zip(xis,xis[1:])]\n\n\tdistances.sort(key = lambda x:-x)\n\n\tprint(sum(distances[n-1:] or [0]))"} +{"problem_id": "p02256", "input": "from math import gcd\n\nx, y = list(map(int, input().split()))\n\nprint((gcd(x, y)))"} +{"problem_id": "p03252", "input": "input = open(0).read\n\nS, T = input().split()\n\n\n\n\n\ndef main():\n\n C1 = [None] * (ord('z') - ord('a') + 1)\n\n C2 = [None] * (ord('z') - ord('a') + 1)\n\n\n\n flg = True\n\n\n\n for i in range(len(S)):\n\n c1 = ord(S[i]) - ord('a')\n\n c2 = ord(T[i]) - ord('a')\n\n\n\n if C1[c1] or C2[c2]:\n\n if c1 != C2[c2] or c2 != C1[c1]:\n\n flg = False\n\n break\n\n\n\n C1[c1] = c2\n\n C2[c2] = c1\n\n\n\n print((\"Yes\" if flg else \"No\"))\n\n return\n\n\n\n\n\nmain()\n"} +{"problem_id": "p03126", "input": "N, M = list(map(int, input().split()))\n\nA = [list(map(int, input().split())) for _ in range(N)]\n\nK = []\n\nfor i in range(N):\n\n K.append(A[i][0])\n\n del A[i][0]\n\n \n\nans = A[0]\n\nfor i in range(N-1):\n\n ans = set(ans) & set(A[i+1])\n\n\n\nprint((len(ans)))\n"} +{"problem_id": "p03073", "input": "s = list(input())\n\n\n\nans = 0\n\nfor i in range(1, len(s)):\n\n if s[i-1] == s[i]:\n\n ans += 1\n\n s[i] = \"1\" if s[i-1] == \"0\" else \"0\"\n\n\n\nprint(ans)\n"} +{"problem_id": "p03478", "input": "N, A, B = list(map(int, input().split()))\n\n\n\nprint((sum(i for i in range(1, N+1) if A <= sum(int(c) for c in str(i)) <= B)))\n"} +{"problem_id": "p03137", "input": "n, m = list(map(int,input().split()))\n\nx = list(map(int,input().split()))\n\nx.sort()\n\ndis = []\n\nif n >= m:\n\n print((0))\n\nelse: \n\n for i in range(m-1):\n\n dis.append(abs(x[i+1]-x[i]))\n\n dis.sort(reverse=True)\n\n for i in range(n-1):\n\n dis.pop(0)\n\n ans = sum(dis)\n\n print(ans)"} +{"problem_id": "p02720", "input": "K = int(input())\n\n\n\nV = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\n\n\nfor i in range (0, 100000):\n\n\tif V[i]%10 == 0:\n\n\t\tV.append(10*V[i]+0)\n\n\t\tV.append(10*V[i]+1)\n\n\telif V[i]%10 == 9:\n\n\t\tV.append(10*V[i]+8)\n\n\t\tV.append(10*V[i]+9)\n\n\telse:\n\n\t\tV.append(10*V[i]+V[i]%10-1)\n\n\t\tV.append(10*V[i]+V[i]%10)\n\n\t\tV.append(10*V[i]+V[i]%10+1)\n\n\n\nprint((V[K-1]))"} +{"problem_id": "p04019", "input": "#!/usr/bin/env python3\n\nimport sys, math, itertools, collections, bisect\n\ninput = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')\n\ninf = float('inf') ;mod = 10**9+7\n\nmans = inf ;ans = 0 ;count = 0 ;pro = 1\n\n\n\ns=input()\n\nC=collections.Counter(s)\n\nif ((C[\"N\"] or C[\"S\"]) and C[\"N\"]*C[\"S\"] == 0):\n\n print(\"No\")\n\nelif ((C[\"W\"] or C[\"E\"]) and C[\"W\"]*C[\"E\"] == 0):\n\n print(\"No\")\n\nelse:\n\n print(\"Yes\")"} +{"problem_id": "p02715", "input": "n, k = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\n\n\ncnt = [0] * (k + 1)\n\n\n\nfor i in range(k, 0, -1):\n\n c = pow(k // i, n, mod)\n\n for j in range(2, k + 1):\n\n if i * j > k:\n\n break\n\n c -= cnt[i * j]\n\n c %= mod\n\n\n\n cnt[i] = c\n\n\n\nans = 0\n\nfor i in range(1, k + 1):\n\n ans += i * cnt[i]\n\n ans %= mod\n\n\n\nprint(ans)\n"} +{"problem_id": "p03673", "input": "# coding: utf-8\n\nn=int(input())\n\nA=list(map(int,input().split()))\n\nB=[0]*n\n\nl=n//2\n\nif n%2==0:\n\n for i in range(n):\n\n if i%2==0:\n\n B[l+i]=str(A[i])\n\n l=l+i\n\n else:\n\n B[l-i]=str(A[i])\n\n l=l-i\n\nelse:\n\n for i in range(n):\n\n if i%2==0:\n\n B[l-i]=str(A[i])\n\n l=l-i\n\n else:\n\n B[l+i]=str(A[i])\n\n l=l+i\n\nprint((' '.join(B)))"} +{"problem_id": "p02837", "input": "import itertools\n\nn = int(input())\n\ndata = {}\n\nfor x in range(n):\n\n data[x] = []\n\n for y in range(int(input())):\n\n k, l = list(map(int, input().split()))\n\n data[x].append((k - 1, l))\n\n\n\nans = 0\n\nfor i in itertools.product([1,0], repeat=n):\n\n h = True\n\n for x in range(n):\n\n if i[x] == 1:\n\n for g in data[x]:\n\n if i[g[0]] != g[1]:\n\n h = False\n\n if h == False:\n\n break\n\n if h == True:\n\n ans = max(ans, sum(list(i)))\n\nprint(ans)"} +{"problem_id": "p03295", "input": "from operator import itemgetter\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n ab = [tuple(map(int, input().split())) for _ in range(M)]\n\n ab.sort(key=itemgetter(1))\n\n east_island = ab[0][1]\n\n answer = 1\n\n\n\n for i, j in ab:\n\n if i >= east_island:\n\n answer += 1\n\n east_island = j\n\n\n\n print(answer)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()"} +{"problem_id": "p03145", "input": "ab,bc,ca=input().split()\n\nab,bc,ca=int(ab),int(bc),int(ca)\n\n\n\nprint((ab*bc//2))\n"} +{"problem_id": "p03160", "input": "N = int(input())\n\nH = list(map(int, input().split()))\n\n\n\ndp = [0]*N\n\n\n\nfor i, x in enumerate(H):\n\n if i == 0:\n\n continue\n\n elif i == 1:\n\n dp[i] = abs(H[i]-H[i-1])\n\n else:\n\n dp[i] = min( dp[i-2] + abs(H[i] - H[i-2]) , dp[i-1] + abs( H[i] - H[i-1] ))\n\n\n\nprint((dp[-1]))"} +{"problem_id": "p03163", "input": "N, W = list(map(int, input().split()))\n\nBs = []\n\nfor i in range(N):\n\n Bs.append(tuple(map(int, input().split())))\n\n\n\ndp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]\n\nfor i in range(N - 1, -1, -1):\n\n for j in range(W + 1):\n\n dp[i][j] = max(dp[i + 1][j], (dp[i + 1][j - Bs[i][0]] + Bs[i][1]) if j >= Bs[i][0] else 0)\n\n\n\nprint((dp[0][W]))"} +{"problem_id": "p02629", "input": "import sys\n\nsys.setrecursionlimit(10**6)\n\n\n\nn = int(input())\n\n\n\nd = {(i-97+1):chr(i) for i in range(97,97+26)}\n\nd[0] = 'z'\n\n\n\nl = []\n\n\n\nwhile n > 0:\n\n tmp = n%26\n\n l.append(tmp)\n\n if tmp == 0:\n\n n = n//26-1\n\n else:\n\n n //= 26\n\n\n\nans = ''\n\n\n\nfor i in l[::-1]:\n\n ans += d[i]\n\n \n\nprint(ans)"} +{"problem_id": "p03295", "input": "a,b=list(map(int,input().split()))\n\nList=[]\n\nfor i in range(b):\n\n p,q=list(map(int,input().split()))\n\n List.append([p,q])\n\nList=sorted(List,key=lambda x:x[1])\n\nans=0\n\nl=1\n\nfor i in range(b):\n\n if List[i][0]>=l:\n\n ans+=1\n\n l=List[i][1]\n\nprint(ans)"} +{"problem_id": "p02767", "input": "import sys\n\nreadline = sys.stdin.readline\n\nN = int(readline())\n\nX = list(map(int, readline().split()))\n\nX.sort()\n\n\n\nINF = 10**9+7\n\nans = INF\n\nfor p in range(0, 102):\n\n res = 0\n\n for x in X:\n\n res += (p-x)**2\n\n ans = min(ans, res)\n\nprint(ans)\n"} +{"problem_id": "p02755", "input": "import math\n\na, b= list(map(int, input().split()))\n\nfor n in range(1, 20000):\n\n if math.floor(n*0.08) == a and math.floor(n*0.1) == b:\n\n break\n\n \n\nif n != 19999:\n\n print(n)\n\nelse:\n\n print((-1))"} +{"problem_id": "p02547", "input": "n=int(input()) \n\nidx=[] \n\nc=0 \n\nfor i in range(n):\n\n\tx,y=list(map(int,input().split())) \n\n\tif x==y:\n\n\t\tidx.append(c) \n\n\tc+=1 \n\nif len(idx)<3:\n\n\tprint('No') \n\nelse:\n\n\tflag=False \n\n\t#print(idx)\n\n\tfor i in range(len(idx)-2): \n\n\t\tif idx[i]-idx[i+1]==-1 and idx[i+1]-idx[i+2]==-1:\n\n\t\t\tflag=True \n\n\t\t\tbreak \n\n\tdd={False:'No',True:'Yes'}\n\n\tprint((dd[flag]))\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"} +{"problem_id": "p03078", "input": "X, Y, Z, K = list(map(int, input().split()))\n\n\n\nA = sorted(map(int, input().split()), reverse=True)\n\nB = sorted(map(int, input().split()), reverse=True)\n\nC = sorted(map(int, input().split()), reverse=True)\n\n\n\nAB = []\n\nfor i in range(X):\n\n for j in range(Y):\n\n AB.append(A[i] + B[j])\n\n\n\nAB.sort(reverse=True)\n\n\n\nABC = []\n\nfor i in range(min(K, len(AB))):\n\n for j in range(Z):\n\n ABC.append(AB[i] + C[j])\n\n\n\nABC.sort(reverse=True)\n\nfor i in range(K):\n\n print((ABC[i]))\n"} +{"problem_id": "p02718", "input": "def resolve():\n\n N, M = list(map(int, input().split()))\n\n vote = list(map(int, input().split()))\n\n bot = sorted(vote)\n\n print((\"Yes\" if bot[M*-1] >= sum(vote)/(4*M) else \"No\"))\n\nresolve()"} +{"problem_id": "p03553", "input": "from copy import deepcopy\n\nN = int(input())\n\na0 = list(map(int, input().split()))\n\n\n\nfor i in range(N, 0, -1):\n\n if a0[i - 1] < 0:\n\n tmp = 0\n\n b = []\n\n for j in range(1, 101):\n\n if i * j - 1 >= N:\n\n break\n\n tmp += a0[i * j - 1]\n\n b.append(i * j - 1)\n\n if tmp < 0:\n\n for j in b:\n\n a0[j] = 0\n\n\n\nfor k1 in range(N, 0, -1):\n\n for k2 in range(k1-1, 0, -1):\n\n a = deepcopy(a0)\n\n for j in range(1, 101):\n\n if k1*j-1 >= N:\n\n break\n\n a[k1*j-1] = 0\n\n for j in range(1, 101):\n\n if k2*j-1 >= N:\n\n break\n\n a[k2*j-1] = 0\n\n for i in range(N, 0, -1):\n\n if a[i - 1] < 0:\n\n tmp = 0\n\n b = []\n\n for j in range(1, 101):\n\n if i * j - 1 >= N:\n\n break\n\n tmp += a[i * j - 1]\n\n b.append(i * j - 1)\n\n if tmp < 0:\n\n for j in b:\n\n a[j] = 0\n\n\n\n for i in range(N, 0, -1):\n\n if a0[i - 1] < 0:\n\n tmp = 0\n\n b = []\n\n for j in range(1, 101):\n\n if i * j - 1 >= N:\n\n break\n\n tmp += a0[i * j - 1]\n\n b.append(i * j - 1)\n\n if tmp < 0:\n\n for j in b:\n\n a0[j] = 0\n\n\n\n if sum(a) > sum(a0):\n\n a0 = a\n\n\n\nprint((sum(a0)))\n"} +{"problem_id": "p02756", "input": "s = str(input())\n\nq = int(input())\n\n\n\nfront_s = ''\n\nback_s = ''\n\nrev_flg = False\n\n\n\nfor i in range(q):\n\n query = list(map(str, input().split())) \n\n if query[0] == '1':\n\n rev_flg = not rev_flg\n\n else:\n\n if not rev_flg:\n\n if query[1] == '1':\n\n front_s += query[2]\n\n else:\n\n back_s += query[2]\n\n else:\n\n if query[1] == '1':\n\n back_s += query[2]\n\n else:\n\n front_s += query[2]\n\n \n\nres = front_s[::-1] + s + back_s\n\nif rev_flg: res = res[::-1]\n\nprint(res) "} +{"problem_id": "p02388", "input": "x = int(input())\n\nprint((x ** 3))"} +{"problem_id": "p02317", "input": "import sys\n\nimport bisect\n\n\n\ninf = float('inf')\n\n\n\ndef solve():\n\n n = int(input())\n\n A = [int(input()) for i in range(n)]\n\n dp = [inf] * n\n\n max_ = 1\n\n\n\n for a in A:\n\n j = bisect.bisect_left(dp, a, lo=0, hi=max_)\n\n max_ = max(max_, j + 1)\n\n dp[j] = a\n\n\n\n # print(dp)\n\n ans = max_\n\n print(ans)\n\n\n\n\n\ndef debug(x, table):\n\n for name, val in table.items():\n\n if x is val:\n\n print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)\n\n return None\n\n\n\nif __name__ == '__main__':\n\n solve()\n"} +{"problem_id": "p02577", "input": "n=int(input())\n\nif n%9==0:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")"} +{"problem_id": "p02923", "input": "N, *H = list(map(int, open(0).read().split()))\n\ndiff = [H[i + 1] - H[i] <= 0 for i in range(N - 1)]\n\n\n\nans = 0\n\ntmp = 0\n\nfor v in diff:\n\n if v:\n\n tmp += 1\n\n else:\n\n ans = max(ans, tmp)\n\n tmp = 0\n\n \n\n\n\nprint((max(ans, tmp)))\n"} +{"problem_id": "p03339", "input": "def main():\n\n N = int(input())\n\n S = input()\n\n ec = S.count('E')\n\n tec = ec\n\n for k in S:\n\n if k == 'E':\n\n tec -= 1\n\n else:\n\n tec += 1\n\n ec = min(ec, tec)\n\n print(ec)\n\n\n\nif __name__ == '__main__':\n\n main()"} +{"problem_id": "p03623", "input": "Sunuke, A ,B = list(map(int,input().split()))\n\nif abs(Sunuke-A) < abs(Sunuke-B):\n\n print(\"A\")\n\nelse:\n\n print(\"B\")"} +{"problem_id": "p03175", "input": "# @author \n\n\n\nimport sys\n\n\n\n\n\nclass PIndependentSet:\n\n def solve(self):\n\n from collections import defaultdict\n\n import sys\n\n sys.setrecursionlimit(10 ** 5 + 5)\n\n MOD = 10 ** 9 + 7\n\n\n\n def dfs(s):\n\n done[s] = 1\n\n dp[s][0] = 1\n\n dp[s][1] = 1\n\n for x in adj[s]:\n\n if done[x]:\n\n continue\n\n dfs(x)\n\n dp[s][0] = (dp[s][0] * dp[x][1]) % MOD\n\n dp[s][1] = (dp[s][1] * (dp[x][0] + dp[x][1])) % MOD\n\n\n\n n = int(input())\n\n adj = defaultdict(list)\n\n\n\n for i in range(n - 1):\n\n x, y = [int(_) for _ in input().split()]\n\n x -= 1\n\n y -= 1\n\n adj[x].append(y)\n\n adj[y].append(x)\n\n\n\n dp = [[0, 0] for _ in range(n)]\n\n done = [0] * n\n\n dfs(0)\n\n\n\n print(((dp[0][0] + dp[0][1]) % MOD))\n\n\n\nsolver = PIndependentSet()\n\ninput = sys.stdin.readline\n\n\n\nsolver.solve()\n"} +{"problem_id": "p02682", "input": "def main():\n\n\n\n A, B, C, K = list(map(int, input().split()))\n\n v = 0\n\n if K <= A:\n\n return K\n\n elif K <= A+B:\n\n return A\n\n else:\n\n return A - (K-A-B)\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n"} +{"problem_id": "p03343", "input": "def add_list(buf, new_lists, removals):\n\n l = len(buf)\n\n if l >= k:\n\n sbf = sorted(buf)\n\n removals.extend(sbf[:l - k + 1])\n\n new_lists.append(buf)\n\n\n\n\n\nn, k, q = list(map(int, input().split()))\n\naaa = list(map(int, input().split()))\n\nsrt = sorted(set(aaa))\n\nlists = [aaa]\n\nans = float('inf')\n\nfor a in srt:\n\n new_lists = []\n\n removals = []\n\n for lst in lists:\n\n buf = []\n\n for b in lst:\n\n if a > b:\n\n add_list(buf, new_lists, removals)\n\n buf = []\n\n else:\n\n buf.append(b)\n\n add_list(buf, new_lists, removals)\n\n if len(removals) < q:\n\n break\n\n removals.sort()\n\n ans = min(ans, removals[q - 1] - a)\n\n\n\nprint(ans)\n"} +{"problem_id": "p02779", "input": "from collections import Counter\n\nN=int(input())\n\nA=list(map(int,input().split()))\n\n\n\nc = Counter(A).most_common()\n\n\n\nfor i in range(len(c)):\n\n if c[i][1]>1:\n\n print(\"NO\")\n\n exit()\n\n\n\nprint(\"YES\")\n\n "} +{"problem_id": "p03730", "input": "A, B, C = list(map(int, input().split()))\n\nlis = list(range(1, 100000))\n\nAA =0\n\nfor i in lis:\n\n AA = A*i\n\n if AA%B == C:\n\n print('YES')\n\n break\n\nelse:\n\n print('NO')"} +{"problem_id": "p03607", "input": "import collections\n\nN = int(input())\n\nx = [0] * N\n\nfor i in range(N):\n\n x[i] = int(input())\n\n \n\nq = collections.Counter(x)\n\nvalue = list(q.values())\n\n\n\ncount = 0\n\nfor i in value:\n\n if i % 2 == 1:\n\n count += 1\n\n\n\nprint(count)\n"} diff --git a/python_splits/train_verified.jsonl b/python_splits/train_verified.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..5a15351ea3ec3a763cdd9e1ea7e969c71ff1dc72 --- /dev/null +++ b/python_splits/train_verified.jsonl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e5e637cfef9937fb74a1dc2abf5985c1fc4356778533ee8543c21a9bd79dc6f +size 78159297 diff --git a/python_splits/train_verified_with_cfg_weights.jsonl b/python_splits/train_verified_with_cfg_weights.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..f73895621f1869a6e717e8b30b2d8423235d3d06 --- /dev/null +++ b/python_splits/train_verified_with_cfg_weights.jsonl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3b192bf2152656801f66479f5d06d99b2e66c89ea6c4c2fcfd63eaa40d00255 +size 302258945 diff --git a/python_splits/train_verified_with_weights.jsonl b/python_splits/train_verified_with_weights.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..a1ae8ce0327adb8b2d282c6f371376096c2240bc --- /dev/null +++ b/python_splits/train_verified_with_weights.jsonl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00d94e7e87e8d50505284c70953b95bda25b54e472d1d5cc61290731c04c6aa2 +size 306551395 diff --git a/python_splits/val.jsonl b/python_splits/val.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..c7181d158c73ff1b53ac7340736b6bb6f56dc604 --- /dev/null +++ b/python_splits/val.jsonl @@ -0,0 +1,1940 @@ +{"user_id":"u350248178","problem_id":"p02838","language":"python","submission_id_v0":"s809014384","submission_id_v1":"s198994885","cpu_time_v0":1101,"cpu_time_v1":340,"memory_v0":125624,"memory_v1":48756,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.12,"input":"n=int(eval(input()))\n\na=[int(j) for j in input().split()]\n\nmod=10**9+7\n\nm=len(bin(max(a)))-2\n\nl=[[0,0] for i in range(m)]\n\nfor i in a:\n\n b=bin(i)[2:].rjust(m,\"0\")[::-1]\n\n for j in range(m):\n\n if b[j]==\"0\":\n\n l[j][0]+=1\n\n else:\n\n l[j][1]+=1\n\n\n\nans=0\n\nfor i in range(m):\n\n ans+=l[i][0]*l[i][1]*pow(2,i,mod)\n\n ans=ans%mod\n\nprint(ans)\n\n\n\n\n\n\n\n\n\n\n","target":"import sys\n\ninput=sys.stdin.readline\n\nimport numpy as np\n\nn=int(eval(input()))\n\na=np.array([int(j) for j in input().split()],dtype=np.int64)\n\nans=0\n\nmod=10**9+7\n\nfor i in range(61):\n\n b=(a>>i)&1\n\n c=np.count_nonzero(b)\n\n ans+=(2**i)*c*(n-c)\n\n ans%=mod\n\nprint(ans)","code_v0_loc":23,"code_v1_loc":13,"code_v0_num_chars":383,"code_v1_num_chars":269,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [int(j) for j in input().split()]\nmod = 10**9 + 7\nm = len(bin(max(a))) - 2\nl = [[0, 0] for i in range(m)]\nfor i in a:\n b = bin(i)[2:].rjust(m, \"0\")[::-1]\n for j in range(m):\n if b[j] == \"0\":\n l[j][0] += 1\n else:\n l[j][1] += 1\nans = 0\nfor i in range(m):\n ans += l[i][0] * l[i][1] * pow(2, i, mod)\n ans = ans % mod\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nimport numpy as np\n\nn = int(eval(input()))\na = np.array([int(j) for j in input().split()], dtype=np.int64)\nans = 0\nmod = 10**9 + 7\nfor i in range(61):\n b = (a >> i) & 1\n c = np.count_nonzero(b)\n ans += (2**i) * c * (n - c)\n ans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":43.4782608696,"diff":["+import sys","+","+input = sys.stdin.readline","+import numpy as np","+","-a = [int(j) for j in input().split()]","+a = np.array([int(j) for j in input().split()], dtype=np.int64)","+ans = 0","-m = len(bin(max(a))) - 2","-l = [[0, 0] for i in range(m)]","-for i in a:","- b = bin(i)[2:].rjust(m, \"0\")[::-1]","- for j in range(m):","- if b[j] == \"0\":","- l[j][0] += 1","- else:","- l[j][1] += 1","-ans = 0","-for i in range(m):","- ans += l[i][0] * l[i][1] * pow(2, i, mod)","- ans = ans % mod","+for i in range(61):","+ b = (a >> i) & 1","+ c = np.count_nonzero(b)","+ ans += (2**i) * c * (n - c)","+ ans %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.037768647,"measured_runtime_v1":0.3581074295,"runtime_lift":0.1054673649,"key":["s809014384","s198994885"]} +{"user_id":"u863370423","problem_id":"p03455","language":"python","submission_id_v0":"s283411504","submission_id_v1":"s331935460","cpu_time_v0":17,"cpu_time_v1":10,"memory_v0":2940,"memory_v1":2568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.18,"input":"string = input().split(' ')\n\nfirst = string[0]\n\nsecond = string[1]\n\nif int(first)*int(second)%2 == 0:\n\n print(\"Even\")\n\nelse:\n\n print(\"Odd\")","target":"s = input().split(\" \")\n\n\n\na = int(s[0])\n\nb = int(s[1])\n\nif (a*b)%2 == 0:\n\n print(\"Even\")\n\nelse:\n\n print(\"Odd\")","code_v0_loc":7,"code_v1_loc":8,"code_v0_num_chars":145,"code_v1_num_chars":112,"code_v0_no_empty_lines":"string = input().split(\" \")\nfirst = string[0]\nsecond = string[1]\nif int(first) * int(second) % 2 == 0:\n print(\"Even\")\nelse:\n print(\"Odd\")\n","code_v1_no_empty_lines":"s = input().split(\" \")\na = int(s[0])\nb = int(s[1])\nif (a * b) % 2 == 0:\n print(\"Even\")\nelse:\n print(\"Odd\")\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-string = input().split(\" \")","-first = string[0]","-second = string[1]","-if int(first) * int(second) % 2 == 0:","+s = input().split(\" \")","+a = int(s[0])","+b = int(s[1])","+if (a * b) % 2 == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0075297762,"measured_runtime_v1":0.0327059426,"runtime_lift":0.230226545,"key":["s283411504","s331935460"]} +{"user_id":"u480138356","problem_id":"p02792","language":"python","submission_id_v0":"s039893026","submission_id_v1":"s046894743","cpu_time_v0":213,"cpu_time_v1":185,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.15,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n dic = {}\n\n for i in range(1, N+1):\n\n tmp = str(i)\n\n s, e = int(tmp[0]), int(tmp[-1])\n\n if (s, e) in dic:\n\n dic[(s, e)] += 1\n\n else:\n\n dic[(s, e)] = 1\n\n \n\n ans = 0\n\n for (i, j), count in list(dic.items()):\n\n tmp = 0\n\n if i == j:\n\n tmp = count**2\n\n else:\n\n if (j, i) in dic:\n\n tmp = count * dic[(j, i)]\n\n ans += tmp\n\n # print(i, j, count)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n dic = {}\n\n for i in range(10):\n\n for j in range(10):\n\n dic[(i, j)] = 0\n\n for i in range(1, N+1):\n\n tmp = str(i)\n\n s, e = int(tmp[0]), int(tmp[-1])\n\n dic[(s, e)] += 1\n\n ans = 0\n\n for i in range(10):\n\n for j in range(10):\n\n ans += dic[(i, j)] * dic[(j, i)]\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":29,"code_v1_loc":21,"code_v0_num_chars":605,"code_v1_num_chars":462,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(eval(input()))\n dic = {}\n for i in range(1, N + 1):\n tmp = str(i)\n s, e = int(tmp[0]), int(tmp[-1])\n if (s, e) in dic:\n dic[(s, e)] += 1\n else:\n dic[(s, e)] = 1\n ans = 0\n for (i, j), count in list(dic.items()):\n tmp = 0\n if i == j:\n tmp = count**2\n else:\n if (j, i) in dic:\n tmp = count * dic[(j, i)]\n ans += tmp\n # print(i, j, count)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(eval(input()))\n dic = {}\n for i in range(10):\n for j in range(10):\n dic[(i, j)] = 0\n for i in range(1, N + 1):\n tmp = str(i)\n s, e = int(tmp[0]), int(tmp[-1])\n dic[(s, e)] += 1\n ans = 0\n for i in range(10):\n for j in range(10):\n ans += dic[(i, j)] * dic[(j, i)]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":27.5862068966,"diff":["+ for i in range(10):","+ for j in range(10):","+ dic[(i, j)] = 0","- if (s, e) in dic:","- dic[(s, e)] += 1","- else:","- dic[(s, e)] = 1","+ dic[(s, e)] += 1","- for (i, j), count in list(dic.items()):","- tmp = 0","- if i == j:","- tmp = count**2","- else:","- if (j, i) in dic:","- tmp = count * dic[(j, i)]","- ans += tmp","- # print(i, j, count)","+ for i in range(10):","+ for j in range(10):","+ ans += dic[(i, j)] * dic[(j, i)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0474423882,"measured_runtime_v1":0.0526719858,"runtime_lift":0.900713871,"key":["s039893026","s046894743"]} +{"user_id":"u746419473","problem_id":"p03556","language":"python","submission_id_v0":"s263029428","submission_id_v1":"s873625180","cpu_time_v0":34,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"import math\n\nn = int(eval(input()))\n\n\n\nfor i in range(n, 0, -1):\n\n if math.sqrt(i).is_integer():\n\n print(i)\n\n break\n","target":"n = int(eval(input()))\n\n\n\nfor i in reversed(list(range(1, int(n**0.5)+1))):\n\n if i**2 <= n:\n\n print((i**2))\n\n break\n","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":127,"code_v1_num_chars":119,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nfor i in range(n, 0, -1):\n if math.sqrt(i).is_integer():\n print(i)\n break\n","code_v1_no_empty_lines":"n = int(eval(input()))\nfor i in reversed(list(range(1, int(n**0.5) + 1))):\n if i**2 <= n:\n print((i**2))\n break\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-import math","-","-for i in range(n, 0, -1):","- if math.sqrt(i).is_integer():","- print(i)","+for i in reversed(list(range(1, int(n**0.5) + 1))):","+ if i**2 <= n:","+ print((i**2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.037041271,"measured_runtime_v1":0.0323904672,"runtime_lift":1.1435855732,"key":["s263029428","s873625180"]} +{"user_id":"u764401543","problem_id":"p02861","language":"python","submission_id_v0":"s819831648","submission_id_v1":"s312390303","cpu_time_v0":510,"cpu_time_v1":151,"memory_v0":17208,"memory_v1":12516,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.39,"input":"import math\n\nimport itertools\n\n\n\nN = int(eval(input()))\n\n\n\nlst = []\n\nfor i in range(N):\n\n lst.append(list(map(int, input().split())))\n\n\n\nroutes = list(itertools.permutations(lst))\n\n\n\ndef distance(a, b):\n\n return (((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)) ** 0.5\n\n\n\nroutes = [i for i in routes]\n\ndistancies = []\n\nfor i, r in enumerate(routes):\n\n for j, a in enumerate(r):\n\n if j >= len(r) - 1: break\n\n b = r[j + 1]\n\n ab_dist = distance(a, b)\n\n distancies.append(ab_dist)\n\n\n\nprint((sum(distancies) \/ len(routes)))","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n \n\nimport numpy as np\n\n \n\nN = int(readline())\n\nXY = np.array(read().split(),np.int64)\n\n \n\nX = XY[::2]; Y = XY[1::2]\n\n \n\ndx = X[:,None] - X[None,:]\n\ndy = Y[:,None] - Y[None,:]\n\n \n\ndist_mat = (dx * dx + dy * dy) ** .5\n\n \n\nanswer = dist_mat.sum() \/ N\n\nprint(answer)","code_v0_loc":24,"code_v1_loc":19,"code_v0_num_chars":541,"code_v1_num_chars":382,"code_v0_no_empty_lines":"import math\nimport itertools\n\nN = int(eval(input()))\nlst = []\nfor i in range(N):\n lst.append(list(map(int, input().split())))\nroutes = list(itertools.permutations(lst))\n\n\ndef distance(a, b):\n return (((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)) ** 0.5\n\n\nroutes = [i for i in routes]\ndistancies = []\nfor i, r in enumerate(routes):\n for j, a in enumerate(r):\n if j >= len(r) - 1:\n break\n b = r[j + 1]\n ab_dist = distance(a, b)\n distancies.append(ab_dist)\nprint((sum(distancies) \/ len(routes)))\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport numpy as np\n\nN = int(readline())\nXY = np.array(read().split(), np.int64)\nX = XY[::2]\nY = XY[1::2]\ndx = X[:, None] - X[None, :]\ndy = Y[:, None] - Y[None, :]\ndist_mat = (dx * dx + dy * dy) ** 0.5\nanswer = dist_mat.sum() \/ N\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":20.8333333333,"diff":["-import math","-import itertools","+import sys","-N = int(eval(input()))","-lst = []","-for i in range(N):","- lst.append(list(map(int, input().split())))","-routes = list(itertools.permutations(lst))","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+import numpy as np","-","-def distance(a, b):","- return (((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)) ** 0.5","-","-","-routes = [i for i in routes]","-distancies = []","-for i, r in enumerate(routes):","- for j, a in enumerate(r):","- if j >= len(r) - 1:","- break","- b = r[j + 1]","- ab_dist = distance(a, b)","- distancies.append(ab_dist)","-print((sum(distancies) \/ len(routes)))","+N = int(readline())","+XY = np.array(read().split(), np.int64)","+X = XY[::2]","+Y = XY[1::2]","+dx = X[:, None] - X[None, :]","+dy = Y[:, None] - Y[None, :]","+dist_mat = (dx * dx + dy * dy) ** 0.5","+answer = dist_mat.sum() \/ N","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0477332115,"measured_runtime_v1":0.2442829609,"runtime_lift":0.1954013139,"key":["s819831648","s312390303"]} +{"user_id":"u746849814","problem_id":"p03557","language":"python","submission_id_v0":"s253551762","submission_id_v1":"s983849979","cpu_time_v0":385,"cpu_time_v1":313,"memory_v0":25588,"memory_v1":23240,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.7,"input":"import bisect, itertools\n\n\n\nn = int(eval(input()))\n\nA = sorted(list(map(int, input().split())))\n\nB = sorted(list(map(int, input().split())))\n\nC = sorted(list(map(int, input().split())))\n\n\n\nc_num = [0]*n\n\nfor i in range(n):\n\n c_num[i] = n - bisect.bisect_right(C, B[i])\n\nc_accum = [0] + list(itertools.accumulate(c_num))\n\n\n\nans = 0\n\nfor i in range(n):\n\n b_index = bisect.bisect_right(B, A[i])\n\n ans += (c_accum[-1] - c_accum[b_index])\n\nprint(ans)","target":"import bisect\n\n\n\nn=int(eval(input()))\n\nA=sorted(list(map(int, input().split())))\n\nB=sorted(list(map(int, input().split())))\n\nC=sorted(list(map(int, input().split())))\n\n\n\nans = 0\n\nfor b in B:\n\n ans += bisect.bisect_left(A,b) * (n - bisect.bisect_right(C,b))\n\n\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":12,"code_v0_num_chars":448,"code_v1_num_chars":267,"code_v0_no_empty_lines":"import bisect, itertools\n\nn = int(eval(input()))\nA = sorted(list(map(int, input().split())))\nB = sorted(list(map(int, input().split())))\nC = sorted(list(map(int, input().split())))\nc_num = [0] * n\nfor i in range(n):\n c_num[i] = n - bisect.bisect_right(C, B[i])\nc_accum = [0] + list(itertools.accumulate(c_num))\nans = 0\nfor i in range(n):\n b_index = bisect.bisect_right(B, A[i])\n ans += c_accum[-1] - c_accum[b_index]\nprint(ans)\n","code_v1_no_empty_lines":"import bisect\n\nn = int(eval(input()))\nA = sorted(list(map(int, input().split())))\nB = sorted(list(map(int, input().split())))\nC = sorted(list(map(int, input().split())))\nans = 0\nfor b in B:\n ans += bisect.bisect_left(A, b) * (n - bisect.bisect_right(C, b))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["-import bisect, itertools","+import bisect","-c_num = [0] * n","-for i in range(n):","- c_num[i] = n - bisect.bisect_right(C, B[i])","-c_accum = [0] + list(itertools.accumulate(c_num))","-for i in range(n):","- b_index = bisect.bisect_right(B, A[i])","- ans += c_accum[-1] - c_accum[b_index]","+for b in B:","+ ans += bisect.bisect_left(A, b) * (n - bisect.bisect_right(C, b))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0472125053,"measured_runtime_v1":0.0471676826,"runtime_lift":1.0009502838,"key":["s253551762","s983849979"]} +{"user_id":"u054514819","problem_id":"p02960","language":"python","submission_id_v0":"s949188797","submission_id_v1":"s206022087","cpu_time_v0":1200,"cpu_time_v1":505,"memory_v0":61788,"memory_v1":79328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.92,"input":"S = eval(input())\n\nN = len(S)\n\ndp = [[0]*(13) for _ in range(N+1)]\n\ndp[0][0] = 1\n\nmod = 10**9+7\n\nfor n in range(N):\n\n s = S[n]\n\n if s!='?':\n\n s = int(s)*pow(10, (N-n-1), 13)%13\n\n for i in range(13):\n\n idx = (s+i)%13\n\n dp[n+1][idx] = dp[n][i]%mod\n\n else:\n\n for i in range(10):\n\n s = i*pow(10, (N-n-1), 13)%13\n\n for j in range(13):\n\n idx = (s+j)%13\n\n dp[n+1][idx] += dp[n][j]%mod\n\n\n\nprint((dp[-1][5]%mod))","target":"import sys\n\ndef input(): return sys.stdin.readline().strip()\n\ndef mapint(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10**9)\n\n\n\nS = list(eval(input()))[::-1]\n\nleng = len(S)\n\nmod = 10**9+7\n\n\n\nold_dp = [0]*13\n\nold_dp[0] = 1\n\n\n\nfor i in range(leng):\n\n dp = [0]*13\n\n if S[i]!='?':\n\n d = int(S[i])\n\n d = d*pow(10, i, 13)\n\n for j in range(13):\n\n dp[j] += old_dp[(j-d)%13]\n\n dp[j] %= mod\n\n else:\n\n for d in range(10):\n\n d = d*pow(10, i, 13)\n\n for j in range(13):\n\n dp[j] += old_dp[(j-d)%13]\n\n dp[j] %= mod\n\n old_dp = dp\n\n\n\nprint((dp[5]))","code_v0_loc":20,"code_v1_loc":29,"code_v0_num_chars":499,"code_v1_num_chars":650,"code_v0_no_empty_lines":"S = eval(input())\nN = len(S)\ndp = [[0] * (13) for _ in range(N + 1)]\ndp[0][0] = 1\nmod = 10**9 + 7\nfor n in range(N):\n s = S[n]\n if s != \"?\":\n s = int(s) * pow(10, (N - n - 1), 13) % 13\n for i in range(13):\n idx = (s + i) % 13\n dp[n + 1][idx] = dp[n][i] % mod\n else:\n for i in range(10):\n s = i * pow(10, (N - n - 1), 13) % 13\n for j in range(13):\n idx = (s + j) % 13\n dp[n + 1][idx] += dp[n][j] % mod\nprint((dp[-1][5] % mod))\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef mapint():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nS = list(eval(input()))[::-1]\nleng = len(S)\nmod = 10**9 + 7\nold_dp = [0] * 13\nold_dp[0] = 1\nfor i in range(leng):\n dp = [0] * 13\n if S[i] != \"?\":\n d = int(S[i])\n d = d * pow(10, i, 13)\n for j in range(13):\n dp[j] += old_dp[(j - d) % 13]\n dp[j] %= mod\n else:\n for d in range(10):\n d = d * pow(10, i, 13)\n for j in range(13):\n dp[j] += old_dp[(j - d) % 13]\n dp[j] %= mod\n old_dp = dp\nprint((dp[5]))\n","code_same":false,"relative_loc_diff_percent":31.0344827586,"diff":["-S = eval(input())","-N = len(S)","-dp = [[0] * (13) for _ in range(N + 1)]","-dp[0][0] = 1","+import sys","+","+","+def input():","+ return sys.stdin.readline().strip()","+","+","+def mapint():","+ return list(map(int, input().split()))","+","+","+sys.setrecursionlimit(10**9)","+S = list(eval(input()))[::-1]","+leng = len(S)","-for n in range(N):","- s = S[n]","- if s != \"?\":","- s = int(s) * pow(10, (N - n - 1), 13) % 13","- for i in range(13):","- idx = (s + i) % 13","- dp[n + 1][idx] = dp[n][i] % mod","+old_dp = [0] * 13","+old_dp[0] = 1","+for i in range(leng):","+ dp = [0] * 13","+ if S[i] != \"?\":","+ d = int(S[i])","+ d = d * pow(10, i, 13)","+ for j in range(13):","+ dp[j] += old_dp[(j - d) % 13]","+ dp[j] %= mod","- for i in range(10):","- s = i * pow(10, (N - n - 1), 13) % 13","+ for d in range(10):","+ d = d * pow(10, i, 13)","- idx = (s + j) % 13","- dp[n + 1][idx] += dp[n][j] % mod","-print((dp[-1][5] % mod))","+ dp[j] += old_dp[(j - d) % 13]","+ dp[j] %= mod","+ old_dp = dp","+print((dp[5]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.12505793,"measured_runtime_v1":0.0476511912,"runtime_lift":2.6244449871,"key":["s949188797","s206022087"]} +{"user_id":"u272557899","problem_id":"p03157","language":"python","submission_id_v0":"s279638621","submission_id_v1":"s098041763","cpu_time_v0":569,"cpu_time_v1":333,"memory_v0":14792,"memory_v1":52700,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.48,"input":"import sys\n\n# import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random\n\nfrom collections import deque, defaultdict, Counter; from heapq import heappush, heappop\n\n# from itertools import permutations, combinations, product, accumulate, groupby\n\n# from bisect import bisect_left, bisect_right, insort_left, insort_right\n\n# from operator import itemgetter as ig\n\nsys.setrecursionlimit(10 ** 7)\n\ninf = 10 ** 20; INF = float(\"INF\"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []; mod = 10 ** 9 + 7\n\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]\n\n\"\"\"for dx, dy in dd:\n\n nx = j + dx; ny = i + dy\n\n if 0 <= nx < w and 0 <= ny < h:\"\"\"\n\ndef wi(): return list(map(int, sys.stdin.readline().split()))\n\ndef wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint\n\ndef ws(): return sys.stdin.readline().split()\n\ndef i(): return int(sys.stdin.readline())\n\ndef s(): return eval(input())\n\ndef hi(n): return [i() for _ in range(n)]\n\ndef hs(n): return [s() for _ in range(n)]#HeightString\n\ndef mi(n): return [wi() for _ in range(n)]#MatrixInt\n\ndef mip(n): return [wip() for _ in range(n)]\n\ndef ms(n): return [ws() for _ in range(n)]\n\n\n\n\n\n#if __name__ == '__main__':\n\nh, w = wi()\n\ns = hs(h)\n\nflagli = [[0] * w for i in range(h)]\n\nstack = deque()\n\nblack = 0\n\nwhite = 0\n\nfor i in range(h):\n\n for j in range(w):\n\n if flagli[i][j] == 0:\n\n flagli[i][j] = 1\n\n white = 1 if s[i][j] == \".\" else 0\n\n black = 1 if s[i][j] == \"#\" else 0\n\n stack.append([i, j])\n\n while stack != deque():\n\n p, q = stack.pop()\n\n k = 0 if s[p][q] == \".\" else 1\n\n for dx, dy in dd:\n\n nx = q + dx;\n\n ny = p + dy\n\n if 0 <= nx < w and 0 <= ny < h:\n\n if flagli[ny][nx] == 0:\n\n if k == 0 and s[ny][nx] == \"#\":\n\n flagli[ny][nx] = 1\n\n stack.append([ny, nx])\n\n black += 1\n\n elif k == 1 and s[ny][nx] == \".\":\n\n flagli[ny][nx] = 1\n\n stack.append([ny, nx])\n\n white += 1\n\n ans += black * white\n\n black = 0\n\n white = 0\n\nprint(ans)","target":"import sys\n\n# import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random\n\nfrom collections import deque, defaultdict, Counter; from heapq import heappush, heappop\n\n# from itertools import permutations, combinations, product, accumulate, groupby\n\n# from bisect import bisect_left, bisect_right, insort_left, insort_right\n\n# from operator import itemgetter as ig\n\nsys.setrecursionlimit(10 ** 7)\n\ninf = 10 ** 20; INF = float(\"INF\"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []; mod = 10 ** 9 + 7\n\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]\n\n\"\"\"for dx, dy in dd:\n\n nx = j + dx; ny = i + dy\n\n if 0 <= nx < w and 0 <= ny < h:\"\"\"\n\ndef wi(): return list(map(int, sys.stdin.readline().split()))\n\ndef wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint\n\ndef ws(): return sys.stdin.readline().split()\n\ndef i(): return int(sys.stdin.readline())\n\ndef s(): return eval(input())\n\ndef hi(n): return [i() for _ in range(n)]\n\ndef hs(n): return [s() for _ in range(n)]#HeightString\n\ndef mi(n): return [wi() for _ in range(n)]#MatrixInt\n\ndef mip(n): return [wip() for _ in range(n)]\n\ndef ms(n): return [ws() for _ in range(n)]\n\n\n\n\n\nif __name__ == '__main__':\n\n h, w = wi()\n\n s = hs(h)\n\n flagli = [[0] * w for i in range(h)]\n\n stack = deque()\n\n black = 0\n\n white = 0\n\n for i in range(h):\n\n for j in range(w):\n\n if flagli[i][j] == 0:\n\n flagli[i][j] = 1\n\n white = 1 if s[i][j] == \".\" else 0\n\n black = 1 if s[i][j] == \"#\" else 0\n\n stack.append([i, j])\n\n while stack != deque():\n\n p, q = stack.pop()\n\n k = 0 if s[p][q] == \".\" else 1\n\n for dx, dy in dd:\n\n nx = q + dx;\n\n ny = p + dy\n\n if 0 <= nx < w and 0 <= ny < h:\n\n if flagli[ny][nx] == 0:\n\n if k == 0 and s[ny][nx] == \"#\":\n\n flagli[ny][nx] = 1\n\n stack.append([ny, nx])\n\n black += 1\n\n elif k == 1 and s[ny][nx] == \".\":\n\n flagli[ny][nx] = 1\n\n stack.append([ny, nx])\n\n white += 1\n\n ans += black * white\n\n black = 0\n\n white = 0\n\n print(ans)","code_v0_loc":58,"code_v1_loc":58,"code_v0_num_chars":2485,"code_v1_num_chars":2616,"code_v0_no_empty_lines":"import sys\n\n# import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\n\n# from itertools import permutations, combinations, product, accumulate, groupby\n# from bisect import bisect_left, bisect_right, insort_left, insort_right\n# from operator import itemgetter as ig\nsys.setrecursionlimit(10**7)\ninf = 10**20\nINF = float(\"INF\")\nans = 0\ntmp = 0\nansli = []\ntmpli = []\ncandili = []\nmod = 10**9 + 7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]\nddn9 = ddn + [(0, 0)]\n\"\"\"for dx, dy in dd:\n nx = j + dx; ny = i + dy\n if 0 <= nx < w and 0 <= ny < h:\"\"\"\n\n\ndef wi():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef wip():\n return [int(x) - 1 for x in sys.stdin.readline().split()] # WideIntPoint\n\n\ndef ws():\n return sys.stdin.readline().split()\n\n\ndef i():\n return int(sys.stdin.readline())\n\n\ndef s():\n return eval(input())\n\n\ndef hi(n):\n return [i() for _ in range(n)]\n\n\ndef hs(n):\n return [s() for _ in range(n)] # HeightString\n\n\ndef mi(n):\n return [wi() for _ in range(n)] # MatrixInt\n\n\ndef mip(n):\n return [wip() for _ in range(n)]\n\n\ndef ms(n):\n return [ws() for _ in range(n)]\n\n\n# if __name__ == '__main__':\nh, w = wi()\ns = hs(h)\nflagli = [[0] * w for i in range(h)]\nstack = deque()\nblack = 0\nwhite = 0\nfor i in range(h):\n for j in range(w):\n if flagli[i][j] == 0:\n flagli[i][j] = 1\n white = 1 if s[i][j] == \".\" else 0\n black = 1 if s[i][j] == \"#\" else 0\n stack.append([i, j])\n while stack != deque():\n p, q = stack.pop()\n k = 0 if s[p][q] == \".\" else 1\n for dx, dy in dd:\n nx = q + dx\n ny = p + dy\n if 0 <= nx < w and 0 <= ny < h:\n if flagli[ny][nx] == 0:\n if k == 0 and s[ny][nx] == \"#\":\n flagli[ny][nx] = 1\n stack.append([ny, nx])\n black += 1\n elif k == 1 and s[ny][nx] == \".\":\n flagli[ny][nx] = 1\n stack.append([ny, nx])\n white += 1\n ans += black * white\n black = 0\n white = 0\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\n# import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\n\n# from itertools import permutations, combinations, product, accumulate, groupby\n# from bisect import bisect_left, bisect_right, insort_left, insort_right\n# from operator import itemgetter as ig\nsys.setrecursionlimit(10**7)\ninf = 10**20\nINF = float(\"INF\")\nans = 0\ntmp = 0\nansli = []\ntmpli = []\ncandili = []\nmod = 10**9 + 7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]\nddn9 = ddn + [(0, 0)]\n\"\"\"for dx, dy in dd:\n nx = j + dx; ny = i + dy\n if 0 <= nx < w and 0 <= ny < h:\"\"\"\n\n\ndef wi():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef wip():\n return [int(x) - 1 for x in sys.stdin.readline().split()] # WideIntPoint\n\n\ndef ws():\n return sys.stdin.readline().split()\n\n\ndef i():\n return int(sys.stdin.readline())\n\n\ndef s():\n return eval(input())\n\n\ndef hi(n):\n return [i() for _ in range(n)]\n\n\ndef hs(n):\n return [s() for _ in range(n)] # HeightString\n\n\ndef mi(n):\n return [wi() for _ in range(n)] # MatrixInt\n\n\ndef mip(n):\n return [wip() for _ in range(n)]\n\n\ndef ms(n):\n return [ws() for _ in range(n)]\n\n\nif __name__ == \"__main__\":\n h, w = wi()\n s = hs(h)\n flagli = [[0] * w for i in range(h)]\n stack = deque()\n black = 0\n white = 0\n for i in range(h):\n for j in range(w):\n if flagli[i][j] == 0:\n flagli[i][j] = 1\n white = 1 if s[i][j] == \".\" else 0\n black = 1 if s[i][j] == \"#\" else 0\n stack.append([i, j])\n while stack != deque():\n p, q = stack.pop()\n k = 0 if s[p][q] == \".\" else 1\n for dx, dy in dd:\n nx = q + dx\n ny = p + dy\n if 0 <= nx < w and 0 <= ny < h:\n if flagli[ny][nx] == 0:\n if k == 0 and s[ny][nx] == \"#\":\n flagli[ny][nx] = 1\n stack.append([ny, nx])\n black += 1\n elif k == 1 and s[ny][nx] == \".\":\n flagli[ny][nx] = 1\n stack.append([ny, nx])\n white += 1\n ans += black * white\n black = 0\n white = 0\n print(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-# if __name__ == '__main__':","-h, w = wi()","-s = hs(h)","-flagli = [[0] * w for i in range(h)]","-stack = deque()","-black = 0","-white = 0","-for i in range(h):","- for j in range(w):","- if flagli[i][j] == 0:","- flagli[i][j] = 1","- white = 1 if s[i][j] == \".\" else 0","- black = 1 if s[i][j] == \"#\" else 0","- stack.append([i, j])","- while stack != deque():","- p, q = stack.pop()","- k = 0 if s[p][q] == \".\" else 1","- for dx, dy in dd:","- nx = q + dx","- ny = p + dy","- if 0 <= nx < w and 0 <= ny < h:","- if flagli[ny][nx] == 0:","- if k == 0 and s[ny][nx] == \"#\":","- flagli[ny][nx] = 1","- stack.append([ny, nx])","- black += 1","- elif k == 1 and s[ny][nx] == \".\":","- flagli[ny][nx] = 1","- stack.append([ny, nx])","- white += 1","- ans += black * white","- black = 0","- white = 0","-print(ans)","+if __name__ == \"__main__\":","+ h, w = wi()","+ s = hs(h)","+ flagli = [[0] * w for i in range(h)]","+ stack = deque()","+ black = 0","+ white = 0","+ for i in range(h):","+ for j in range(w):","+ if flagli[i][j] == 0:","+ flagli[i][j] = 1","+ white = 1 if s[i][j] == \".\" else 0","+ black = 1 if s[i][j] == \"#\" else 0","+ stack.append([i, j])","+ while stack != deque():","+ p, q = stack.pop()","+ k = 0 if s[p][q] == \".\" else 1","+ for dx, dy in dd:","+ nx = q + dx","+ ny = p + dy","+ if 0 <= nx < w and 0 <= ny < h:","+ if flagli[ny][nx] == 0:","+ if k == 0 and s[ny][nx] == \"#\":","+ flagli[ny][nx] = 1","+ stack.append([ny, nx])","+ black += 1","+ elif k == 1 and s[ny][nx] == \".\":","+ flagli[ny][nx] = 1","+ stack.append([ny, nx])","+ white += 1","+ ans += black * white","+ black = 0","+ white = 0","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0413302727,"measured_runtime_v1":0.045741164,"runtime_lift":0.9035684508,"key":["s279638621","s098041763"]} +{"user_id":"u393253137","problem_id":"p02861","language":"python","submission_id_v0":"s678708963","submission_id_v1":"s503140213","cpu_time_v0":400,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.75,"input":"import itertools\n\nimport math\n\ndef dis(X,Y):\n\n return ((X[0]-Y[0])**2+(X[1]-Y[1])**2)**.5\n\ndef main():\n\n n=int(eval(input()))\n\n L=[list(map(int,input().split())) for _ in range(n)]\n\n S=itertools.permutations([i for i in range(1,n+1)])\n\n ans=0\n\n for s in S:\n\n for i in range(n-1):\n\n a = s[i] - 1\n\n b = s[i+1] - 1\n\n ans += dis(L[a],L[b])\n\n ans \/= math.factorial(n)\n\n print(ans)\n\nmain()","target":"n = int(eval(input()))\n\nL = [list(map(int, input().split())) for _ in range(n)]\n\nans = 0\n\n# (edges\u306e\u9577\u3055\u306e\u7dcf\u548c)\/(edge\u306e\u672c\u6570)*(1\u3064\u306epath\u3092\u69cb\u6210\u3059\u308bedges\u306e\u6570)\n\n# = (edges\u306e\u9577\u3055\u306e\u7dcf\u548c)\/ (n*(n-1)) * (n-1)\n\nfor x1, y1 in L:\n\n for x2, y2 in L:\n\n ans += ((x1 - x2)**2 + (y1 - y2)**2)**.5\n\nprint((ans\/n))","code_v0_loc":17,"code_v1_loc":9,"code_v0_num_chars":441,"code_v1_num_chars":273,"code_v0_no_empty_lines":"import itertools\nimport math\n\n\ndef dis(X, Y):\n return ((X[0] - Y[0]) ** 2 + (X[1] - Y[1]) ** 2) ** 0.5\n\n\ndef main():\n n = int(eval(input()))\n L = [list(map(int, input().split())) for _ in range(n)]\n S = itertools.permutations([i for i in range(1, n + 1)])\n ans = 0\n for s in S:\n for i in range(n - 1):\n a = s[i] - 1\n b = s[i + 1] - 1\n ans += dis(L[a], L[b])\n ans \/= math.factorial(n)\n print(ans)\n\n\nmain()\n","code_v1_no_empty_lines":"n = int(eval(input()))\nL = [list(map(int, input().split())) for _ in range(n)]\nans = 0\n# (edges\u306e\u9577\u3055\u306e\u7dcf\u548c)\/(edge\u306e\u672c\u6570)*(1\u3064\u306epath\u3092\u69cb\u6210\u3059\u308bedges\u306e\u6570)\n# = (edges\u306e\u9577\u3055\u306e\u7dcf\u548c)\/ (n*(n-1)) * (n-1)\nfor x1, y1 in L:\n for x2, y2 in L:\n ans += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5\nprint((ans \/ n))\n","code_same":false,"relative_loc_diff_percent":47.0588235294,"diff":["-import itertools","-import math","-","-","-def dis(X, Y):","- return ((X[0] - Y[0]) ** 2 + (X[1] - Y[1]) ** 2) ** 0.5","-","-","-def main():","- n = int(eval(input()))","- L = [list(map(int, input().split())) for _ in range(n)]","- S = itertools.permutations([i for i in range(1, n + 1)])","- ans = 0","- for s in S:","- for i in range(n - 1):","- a = s[i] - 1","- b = s[i + 1] - 1","- ans += dis(L[a], L[b])","- ans \/= math.factorial(n)","- print(ans)","-","-","-main()","+n = int(eval(input()))","+L = [list(map(int, input().split())) for _ in range(n)]","+ans = 0","+# (edges\u306e\u9577\u3055\u306e\u7dcf\u548c)\/(edge\u306e\u672c\u6570)*(1\u3064\u306epath\u3092\u69cb\u6210\u3059\u308bedges\u306e\u6570)","+# = (edges\u306e\u9577\u3055\u306e\u7dcf\u548c)\/ (n*(n-1)) * (n-1)","+for x1, y1 in L:","+ for x2, y2 in L:","+ ans += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5","+print((ans \/ n))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0892123699,"measured_runtime_v1":0.0492338657,"runtime_lift":1.812012292,"key":["s678708963","s503140213"]} +{"user_id":"u948524308","problem_id":"p03556","language":"python","submission_id_v0":"s867274892","submission_id_v1":"s699407828","cpu_time_v0":69,"cpu_time_v1":22,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.12,"input":"N = int(eval(input()))\n\n\n\nfor i in range(N, 0, -1):\n\n if i ** 0.5 == int(i ** 0.5):\n\n print(i)\n\n exit()\n","target":"N = int(eval(input()))\n\ni = 1\n\nwhile i * i <= N:\n\n i += 1\n\n\n\nprint(((i - 1) ** 2))\n","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":115,"code_v1_num_chars":78,"code_v0_no_empty_lines":"N = int(eval(input()))\nfor i in range(N, 0, -1):\n if i**0.5 == int(i**0.5):\n print(i)\n exit()\n","code_v1_no_empty_lines":"N = int(eval(input()))\ni = 1\nwhile i * i <= N:\n i += 1\nprint(((i - 1) ** 2))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(N, 0, -1):","- if i**0.5 == int(i**0.5):","- print(i)","- exit()","+i = 1","+while i * i <= N:","+ i += 1","+print(((i - 1) ** 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.084114507,"measured_runtime_v1":0.0736164861,"runtime_lift":1.1426042105,"key":["s867274892","s699407828"]} +{"user_id":"u966207392","problem_id":"p02571","language":"python","submission_id_v0":"s352928054","submission_id_v1":"s831222161","cpu_time_v0":66,"cpu_time_v1":61,"memory_v0":9092,"memory_v1":9024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.58,"input":"S = eval(input())\n\nT = eval(input())\n\ncnt = len(S)-len(T)+1\n\nres = []\n\nfor i in range(cnt):\n\n res2 = 0\n\n for j in range(len(T)):\n\n if S[i+j] != T[j]:\n\n res2 += 1\n\n res.append(res2)\n\nprint((min(res))) ","target":"S = eval(input())\n\nT = eval(input())\n\ncnt = []\n\nfor i in range(len(S)-len(T)+1):\n\n cnt2 = 0\n\n for j in range(len(T)):\n\n if S[i+j] != T[j]:\n\n cnt2 += 1\n\n cnt.append(cnt2)\n\nprint((min(cnt)))\n","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":213,"code_v1_num_chars":202,"code_v0_no_empty_lines":"S = eval(input())\nT = eval(input())\ncnt = len(S) - len(T) + 1\nres = []\nfor i in range(cnt):\n res2 = 0\n for j in range(len(T)):\n if S[i + j] != T[j]:\n res2 += 1\n res.append(res2)\nprint((min(res)))\n","code_v1_no_empty_lines":"S = eval(input())\nT = eval(input())\ncnt = []\nfor i in range(len(S) - len(T) + 1):\n cnt2 = 0\n for j in range(len(T)):\n if S[i + j] != T[j]:\n cnt2 += 1\n cnt.append(cnt2)\nprint((min(cnt)))\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-cnt = len(S) - len(T) + 1","-res = []","-for i in range(cnt):","- res2 = 0","+cnt = []","+for i in range(len(S) - len(T) + 1):","+ cnt2 = 0","- res2 += 1","- res.append(res2)","-print((min(res)))","+ cnt2 += 1","+ cnt.append(cnt2)","+print((min(cnt)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0375241988,"measured_runtime_v1":0.0381022259,"runtime_lift":0.9848295734,"key":["s352928054","s831222161"]} +{"user_id":"u519939795","problem_id":"p02835","language":"python","submission_id_v0":"s611225303","submission_id_v1":"s311545361","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"a,b,c=list(map(int,input().split()))\n\nprint(('bust' if a+b+c>=22 else 'win'))","target":"A = list(map(int, input().split()))\n\nprint((\"bust\" if sum(A) >= 22 else \"win\"))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":69,"code_v1_num_chars":71,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nprint((\"bust\" if a + b + c >= 22 else \"win\"))\n","code_v1_no_empty_lines":"A = list(map(int, input().split()))\nprint((\"bust\" if sum(A) >= 22 else \"win\"))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a, b, c = list(map(int, input().split()))","-print((\"bust\" if a + b + c >= 22 else \"win\"))","+A = list(map(int, input().split()))","+print((\"bust\" if sum(A) >= 22 else \"win\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0436600038,"measured_runtime_v1":0.0425639296,"runtime_lift":1.0257512468,"key":["s611225303","s311545361"]} +{"user_id":"u673173160","problem_id":"p03730","language":"python","submission_id_v0":"s855778723","submission_id_v1":"s920023663","cpu_time_v0":42,"cpu_time_v1":28,"memory_v0":9084,"memory_v1":9112,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"a, b, c = list(map(int, input().split()))\n\nfor i in range(1, 100000):\n\n if a*i % b == c:\n\n print(\"YES\")\n\n exit()\n\nprint(\"NO\")","target":"a, b, c = list(map(int, input().split()))\n\nfor i in range(1, 100):\n\n if a*i % b == c:\n\n print(\"YES\")\n\n exit()\n\nprint(\"NO\")","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":136,"code_v1_num_chars":133,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nfor i in range(1, 100000):\n if a * i % b == c:\n print(\"YES\")\n exit()\nprint(\"NO\")\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nfor i in range(1, 100):\n if a * i % b == c:\n print(\"YES\")\n exit()\nprint(\"NO\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(1, 100000):","+for i in range(1, 100):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0777284416,"measured_runtime_v1":0.0665769821,"runtime_lift":1.1674972204,"key":["s855778723","s920023663"]} +{"user_id":"u647522078","problem_id":"p02951","language":"python","submission_id_v0":"s964180661","submission_id_v1":"s914276520","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"a,b,c=list(map(int, input().split()))\n\nprint((max(c-(a-b),0)))","target":"a, b, c = list(map(int, input().split()))\n\nprint((max(0,c-(a-b))))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":54,"code_v1_num_chars":58,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nprint((max(c - (a - b), 0)))\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nprint((max(0, c - (a - b))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((max(c - (a - b), 0)))","+print((max(0, c - (a - b))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0439560552,"measured_runtime_v1":0.0451694686,"runtime_lift":0.9731364233,"key":["s964180661","s914276520"]} +{"user_id":"u729133443","problem_id":"p03973","language":"python","submission_id_v0":"s281484334","submission_id_v1":"s498033637","cpu_time_v0":239,"cpu_time_v1":91,"memory_v0":47580,"memory_v1":7108,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.92,"input":"n,*a=list(map(int,open(0)))\n\nb,c=1,0\n\nfor i in a:\n\n if i>b:\n\n c+=(i-1)\/\/b\n\n b+=b<2\n\n elif i==b:\n\n b+=1\n\nprint(c)","target":"n,*a=list(map(int,open(0)))\n\nb,c=1,0\n\nfor i in a:\n\n c+=~-i\/\/b*(i>b)\n\n b+=b<2or i==b\n\nprint(c)","code_v0_loc":9,"code_v1_loc":6,"code_v0_num_chars":117,"code_v1_num_chars":89,"code_v0_no_empty_lines":"n, *a = list(map(int, open(0)))\nb, c = 1, 0\nfor i in a:\n if i > b:\n c += (i - 1) \/\/ b\n b += b < 2\n elif i == b:\n b += 1\nprint(c)\n","code_v1_no_empty_lines":"n, *a = list(map(int, open(0)))\nb, c = 1, 0\nfor i in a:\n c += ~-i \/\/ b * (i > b)\n b += b < 2 or i == b\nprint(c)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["- if i > b:","- c += (i - 1) \/\/ b","- b += b < 2","- elif i == b:","- b += 1","+ c += ~-i \/\/ b * (i > b)","+ b += b < 2 or i == b"],"diff_only_import_comment":false,"measured_runtime_v0":0.0364220027,"measured_runtime_v1":0.0402655063,"runtime_lift":0.904546,"key":["s281484334","s498033637"]} +{"user_id":"u560867850","problem_id":"p02854","language":"python","submission_id_v0":"s786781095","submission_id_v1":"s992642748","cpu_time_v0":97,"cpu_time_v1":85,"memory_v0":26764,"memory_v1":26216,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.37,"input":"n = int(eval(input()))\n\n\n\nstick = list(map(int, input().split()))\n\n\n\ntotal = sum(stick)\n\nmid = total \/\/ 2\n\n\n\ncum = 0\n\nmidi = 0\n\nfor i, block in enumerate(stick):\n\n cum += block\n\n if cum >= mid:\n\n midi = i\n\n break\n\n\n\nl1 = sum(stick[:midi])\n\nr1 = sum(stick[midi:])\n\ndiff1 = abs(l1 - r1)\n\n \n\nl2 = l1 + stick[midi]\n\nr2 = r1 - stick[midi]\n\ndiff2 = abs(l2 - r2)\n\n \n\nprint((min(diff1, diff2)))","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n\n\n stick = list(map(int, input().split()))\n\n\n\n total = sum(stick)\n\n mid = total \/\/ 2\n\n\n\n cum = 0\n\n midi = 0\n\n for i, block in enumerate(stick):\n\n cum += block\n\n if cum >= mid:\n\n midi = i\n\n break\n\n\n\n l1 = sum(stick[:midi])\n\n r1 = sum(stick[midi:])\n\n diff1 = abs(l1 - r1)\n\n \n\n l2 = l1 + stick[midi]\n\n r2 = r1 - stick[midi]\n\n diff2 = abs(l2 - r2)\n\n \n\n print((min(diff1, diff2)))\n\n\n\nmain()","code_v0_loc":24,"code_v1_loc":30,"code_v0_num_chars":398,"code_v1_num_chars":541,"code_v0_no_empty_lines":"n = int(eval(input()))\nstick = list(map(int, input().split()))\ntotal = sum(stick)\nmid = total \/\/ 2\ncum = 0\nmidi = 0\nfor i, block in enumerate(stick):\n cum += block\n if cum >= mid:\n midi = i\n break\nl1 = sum(stick[:midi])\nr1 = sum(stick[midi:])\ndiff1 = abs(l1 - r1)\nl2 = l1 + stick[midi]\nr2 = r1 - stick[midi]\ndiff2 = abs(l2 - r2)\nprint((min(diff1, diff2)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(eval(input()))\n stick = list(map(int, input().split()))\n total = sum(stick)\n mid = total \/\/ 2\n cum = 0\n midi = 0\n for i, block in enumerate(stick):\n cum += block\n if cum >= mid:\n midi = i\n break\n l1 = sum(stick[:midi])\n r1 = sum(stick[midi:])\n diff1 = abs(l1 - r1)\n l2 = l1 + stick[midi]\n r2 = r1 - stick[midi]\n diff2 = abs(l2 - r2)\n print((min(diff1, diff2)))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-n = int(eval(input()))","-stick = list(map(int, input().split()))","-total = sum(stick)","-mid = total \/\/ 2","-cum = 0","-midi = 0","-for i, block in enumerate(stick):","- cum += block","- if cum >= mid:","- midi = i","- break","-l1 = sum(stick[:midi])","-r1 = sum(stick[midi:])","-diff1 = abs(l1 - r1)","-l2 = l1 + stick[midi]","-r2 = r1 - stick[midi]","-diff2 = abs(l2 - r2)","-print((min(diff1, diff2)))","+import sys","+","+input = sys.stdin.readline","+","+","+def main():","+ n = int(eval(input()))","+ stick = list(map(int, input().split()))","+ total = sum(stick)","+ mid = total \/\/ 2","+ cum = 0","+ midi = 0","+ for i, block in enumerate(stick):","+ cum += block","+ if cum >= mid:","+ midi = i","+ break","+ l1 = sum(stick[:midi])","+ r1 = sum(stick[midi:])","+ diff1 = abs(l1 - r1)","+ l2 = l1 + stick[midi]","+ r2 = r1 - stick[midi]","+ diff2 = abs(l2 - r2)","+ print((min(diff1, diff2)))","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.1079736249,"measured_runtime_v1":0.0995260541,"runtime_lift":1.0848779845,"key":["s786781095","s992642748"]} +{"user_id":"u989345508","problem_id":"p02659","language":"python","submission_id_v0":"s816911892","submission_id_v1":"s577038802","cpu_time_v0":23,"cpu_time_v1":20,"memory_v0":9100,"memory_v1":9144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.04,"input":"a,b=input().split();print((int(a)*int(b[:-3]+b[-2:])\/\/100))","target":"a,b=input().split()\n\na=int(a)\n\nb=int(\"\".join(b.split(\".\")))\n\nprint(((a*b)\/\/100))\n","code_v0_loc":1,"code_v1_loc":4,"code_v0_num_chars":57,"code_v1_num_chars":79,"code_v0_no_empty_lines":"a, b = input().split()\nprint((int(a) * int(b[:-3] + b[-2:]) \/\/ 100))\n","code_v1_no_empty_lines":"a, b = input().split()\na = int(a)\nb = int(\"\".join(b.split(\".\")))\nprint(((a * b) \/\/ 100))\n","code_same":false,"relative_loc_diff_percent":75.0,"diff":["-print((int(a) * int(b[:-3] + b[-2:]) \/\/ 100))","+a = int(a)","+b = int(\"\".join(b.split(\".\")))","+print(((a * b) \/\/ 100))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0410105717,"measured_runtime_v1":0.0417252917,"runtime_lift":0.9828708203,"key":["s816911892","s577038802"]} +{"user_id":"u627803856","problem_id":"p03363","language":"python","submission_id_v0":"s239961616","submission_id_v1":"s831747237","cpu_time_v0":152,"cpu_time_v1":139,"memory_v0":119888,"memory_v1":125688,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.55,"input":"n = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nacc = [0] * (n + 1)\n\nfor i in range(n):\n\n acc[i + 1] = acc[i] + A[i]\n\n\n\nacc.sort()\n\n\n\nfrom collections import Counter\n\n\n\ncnt = 0\n\ncacc = Counter(acc)\n\nfor k, v in list(cacc.items()):\n\n if v > 1:\n\n cnt += v * (v - 1) \/\/ 2\n\nprint(cnt)","target":"n = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nacc = [0] * (n + 1)\n\nfor i in range(n):\n\n acc[i + 1] = acc[i] + A[i]\n\n\n\nfrom collections import Counter\n\n\n\ncnt = 0\n\ncacc = Counter(acc)\n\nfor k, v in list(cacc.items()):\n\n if v > 1:\n\n cnt += v * (v - 1) \/\/ 2\n\nprint(cnt)","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":294,"code_v1_num_chars":280,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nacc = [0] * (n + 1)\nfor i in range(n):\n acc[i + 1] = acc[i] + A[i]\nacc.sort()\nfrom collections import Counter\n\ncnt = 0\ncacc = Counter(acc)\nfor k, v in list(cacc.items()):\n if v > 1:\n cnt += v * (v - 1) \/\/ 2\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nacc = [0] * (n + 1)\nfor i in range(n):\n acc[i + 1] = acc[i] + A[i]\nfrom collections import Counter\n\ncnt = 0\ncacc = Counter(acc)\nfor k, v in list(cacc.items()):\n if v > 1:\n cnt += v * (v - 1) \/\/ 2\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-acc.sort()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0391205707,"measured_runtime_v1":0.0886621757,"runtime_lift":0.4412317921,"key":["s239961616","s831747237"]} +{"user_id":"u168578024","problem_id":"p03061","language":"python","submission_id_v0":"s408270365","submission_id_v1":"s970631546","cpu_time_v0":544,"cpu_time_v1":467,"memory_v0":58224,"memory_v1":60528,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.15,"input":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\n\n\nclass SegmentTree:\n\n def __init__(self, N, func, I):\n\n self.func = func\n\n self.I = I\n\n self.N = N\n\n self.sz = 2**(N-1).bit_length()\n\n self.seg = [I] * (self.sz * 2)\n\n \n\n def assign(self, k, x):\n\n self.seg[k + self.sz] = x\n\n \n\n def build(self):\n\n for i in reversed(list(range(1,self.sz))):\n\n self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])\n\n \n\n def update(self, k, x):\n\n k += self.sz\n\n self.seg[k] = x\n\n while k > 1:\n\n k >>= 1\n\n self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])\n\n\n\n def query(self, a, b):\n\n L = self.I\n\n R = self.I\n\n a += self.sz\n\n b += self.sz\n\n while a < b:\n\n if a & 1:\n\n L = self.func(L, self.seg[a])\n\n a += 1\n\n if b & 1:\n\n b -= 1\n\n R = self.func(self.seg[b], R)\n\n a >>= 1\n\n b >>= 1\n\n return self.func(L, R)\n\n\n\ndef main():\n\n def gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n N = int(readline())\n\n L = list(map(int,readline().split()))\n\n seg = SegmentTree(N , gcd , 0)\n\n for i,n in enumerate(L):\n\n seg.assign(i , n)\n\n seg.build()\n\n ans = 1\n\n for i in range(N):\n\n ans = max(ans,gcd(seg.query(0,i) , seg.query(i+1,N)))\n\n print(ans)\n\n\n\nmain()\n","target":"import sys\n\nreadline = sys.stdin.buffer.readline\n\n\n\n\n\nclass SegmentTree:\n\n def __init__(self, N, func, I):\n\n self.N = N\n\n self.sz = 2**(N-1).bit_length()\n\n self.func = func\n\n self.I = I\n\n self.seg = [I] * (self.sz * 2)\n\n\n\n def assign(self, k, x):\n\n self.seg[k + self.sz] = x\n\n\n\n def build(self):\n\n for i in reversed(list(range(1, self.sz))):\n\n self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])\n\n\n\n def update(self, k, x):\n\n k += self.sz\n\n self.seg[k] = x\n\n while k > 1:\n\n k >>= 1\n\n self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])\n\n\n\n def query(self, a, b):\n\n L = self.I\n\n R = self.I\n\n a += self.sz\n\n if b == self.N:\n\n b = self.sz\n\n b += self.sz\n\n while a < b:\n\n if a & 1:\n\n L = self.func(L, self.seg[a])\n\n a += 1\n\n if b & 1:\n\n b -= 1\n\n R = self.func(self.seg[b], R)\n\n a >>= 1\n\n b >>= 1\n\n return self.func(L, R)\n\n\n\n\n\ndef main():\n\n def gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n N = int(readline())\n\n L = list(map(int, readline().split()))\n\n seg = SegmentTree(N, gcd, 0)\n\n for i, n in enumerate(L):\n\n seg.assign(i, n)\n\n seg.build()\n\n ans = 1\n\n for i in range(N):\n\n ans = max(ans, gcd(seg.query(0, i), seg.query(i+1, N)))\n\n print(ans)\n\n\n\n\n\nmain()","code_v0_loc":59,"code_v1_loc":63,"code_v0_num_chars":1497,"code_v1_num_chars":1515,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\n\n\nclass SegmentTree:\n def __init__(self, N, func, I):\n self.func = func\n self.I = I\n self.N = N\n self.sz = 2 ** (N - 1).bit_length()\n self.seg = [I] * (self.sz * 2)\n\n def assign(self, k, x):\n self.seg[k + self.sz] = x\n\n def build(self):\n for i in reversed(list(range(1, self.sz))):\n self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])\n\n def update(self, k, x):\n k += self.sz\n self.seg[k] = x\n while k > 1:\n k >>= 1\n self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])\n\n def query(self, a, b):\n L = self.I\n R = self.I\n a += self.sz\n b += self.sz\n while a < b:\n if a & 1:\n L = self.func(L, self.seg[a])\n a += 1\n if b & 1:\n b -= 1\n R = self.func(self.seg[b], R)\n a >>= 1\n b >>= 1\n return self.func(L, R)\n\n\ndef main():\n def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n N = int(readline())\n L = list(map(int, readline().split()))\n seg = SegmentTree(N, gcd, 0)\n for i, n in enumerate(L):\n seg.assign(i, n)\n seg.build()\n ans = 1\n for i in range(N):\n ans = max(ans, gcd(seg.query(0, i), seg.query(i + 1, N)))\n print(ans)\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.buffer.readline\n\n\nclass SegmentTree:\n def __init__(self, N, func, I):\n self.N = N\n self.sz = 2 ** (N - 1).bit_length()\n self.func = func\n self.I = I\n self.seg = [I] * (self.sz * 2)\n\n def assign(self, k, x):\n self.seg[k + self.sz] = x\n\n def build(self):\n for i in reversed(list(range(1, self.sz))):\n self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])\n\n def update(self, k, x):\n k += self.sz\n self.seg[k] = x\n while k > 1:\n k >>= 1\n self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])\n\n def query(self, a, b):\n L = self.I\n R = self.I\n a += self.sz\n if b == self.N:\n b = self.sz\n b += self.sz\n while a < b:\n if a & 1:\n L = self.func(L, self.seg[a])\n a += 1\n if b & 1:\n b -= 1\n R = self.func(self.seg[b], R)\n a >>= 1\n b >>= 1\n return self.func(L, R)\n\n\ndef main():\n def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n N = int(readline())\n L = list(map(int, readline().split()))\n seg = SegmentTree(N, gcd, 0)\n for i, n in enumerate(L):\n seg.assign(i, n)\n seg.build()\n ans = 1\n for i in range(N):\n ans = max(ans, gcd(seg.query(0, i), seg.query(i + 1, N)))\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":6.3492063492,"diff":["-read = sys.stdin.buffer.read","+ self.N = N","+ self.sz = 2 ** (N - 1).bit_length()","- self.N = N","- self.sz = 2 ** (N - 1).bit_length()","+ if b == self.N:","+ b = self.sz"],"diff_only_import_comment":false,"measured_runtime_v0":0.0928192172,"measured_runtime_v1":0.0776195223,"runtime_lift":1.195823092,"key":["s408270365","s970631546"]} +{"user_id":"u353919145","problem_id":"p03848","language":"python","submission_id_v0":"s381344888","submission_id_v1":"s064623776","cpu_time_v0":374,"cpu_time_v1":61,"memory_v0":23016,"memory_v1":13880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.69,"input":"import sys\n\nfrom numpy import *\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\na = int_(bincount(a, [1] * n, n))\n\nprint((pow(2, n \/\/ 2, 10 ** 9 + 7) if not a[0] > (n & 1) and all([x == 2 or x == 0 for x in a[1:]]) else 0))\n","target":"mod = int(1e9) + 7\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\nlis = [0] * n\n\nfor i in a:\n\n lis[i] += 1\n\nfor i in range(1,n):\n\n if lis[i] % 2 == 1:\n\n print((0))\n\n exit()\n\n\n\nprint((pow(2, n\/\/2, mod))) \n","code_v0_loc":5,"code_v1_loc":12,"code_v0_num_chars":219,"code_v1_num_chars":229,"code_v0_no_empty_lines":"import sys\nfrom numpy import *\n\nn, *a = list(map(int, sys.stdin.read().split()))\na = int_(bincount(a, [1] * n, n))\nprint(\n (\n pow(2, n \/\/ 2, 10**9 + 7)\n if not a[0] > (n & 1) and all([x == 2 or x == 0 for x in a[1:]])\n else 0\n )\n)\n","code_v1_no_empty_lines":"mod = int(1e9) + 7\nn = int(eval(input()))\na = list(map(int, input().split()))\nlis = [0] * n\nfor i in a:\n lis[i] += 1\nfor i in range(1, n):\n if lis[i] % 2 == 1:\n print((0))\n exit()\nprint((pow(2, n \/\/ 2, mod)))\n","code_same":false,"relative_loc_diff_percent":58.3333333333,"diff":["-import sys","-from numpy import *","-","-n, *a = list(map(int, sys.stdin.read().split()))","-a = int_(bincount(a, [1] * n, n))","-print(","- (","- pow(2, n \/\/ 2, 10**9 + 7)","- if not a[0] > (n & 1) and all([x == 2 or x == 0 for x in a[1:]])","- else 0","- )","-)","+mod = int(1e9) + 7","+n = int(eval(input()))","+a = list(map(int, input().split()))","+lis = [0] * n","+for i in a:","+ lis[i] += 1","+for i in range(1, n):","+ if lis[i] % 2 == 1:","+ print((0))","+ exit()","+print((pow(2, n \/\/ 2, mod)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4589071274,"measured_runtime_v1":0.0452711582,"runtime_lift":10.1368541327,"key":["s381344888","s064623776"]} +{"user_id":"u794173881","problem_id":"p03855","language":"python","submission_id_v0":"s192661690","submission_id_v1":"s155666652","cpu_time_v0":1823,"cpu_time_v1":1604,"memory_v0":50416,"memory_v1":137472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.01,"input":"#UnionFind\u30af\u30e9\u30b9\n\nclass UnionFind(object):\n\n\n\n def __init__(self, n=1):\n\n self.par = [i for i in range(n)]\n\n self.rank = [0 for _ in range(n)]\n\n\n\n def find(self, x):\n\n if self.par[x] == x:\n\n return x\n\n else:\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n \n\n # x\u3068y\u306e\u6839\u3092\u7d50\u5408\u3055\u305b\u308b\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x != y:\n\n if self.rank[x] < self.rank[y]:\n\n x, y = y, x\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n self.par[y] = x\n\n \n\n # x,y\u306e\u6839\u304c\u540c\u3058\u304b\u3069\u3046\u304b\u3092\u8fd4\u3059\uff08\u6839\u304c\u540c\u3058:True\u3001\u6839\u304c\u7570\u306a\u308b:False\uff09\n\n def is_same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\nn,k,l = list(map(int,input().split()))\n\n \n\nuf_road = UnionFind(n)\n\nuf_rail = UnionFind(n)\n\nfor i in range(k):\n\n tmp1,tmp2 = list(map(int,input().split()))\n\n uf_road.union(tmp1-1,tmp2-1)\n\n \n\nfor i in range(l):\n\n tmp1,tmp2 = list(map(int,input().split()))\n\n uf_rail.union(tmp1-1,tmp2-1)\n\n\n\nmemo = {}\n\nfor i in range(n):\n\n if str(uf_rail.find(i))+\" \"+str(uf_road.find(i)) not in memo:\n\n memo[str(uf_rail.find(i))+\" \"+str(uf_road.find(i))] = 1\n\n else:\n\n memo[str(uf_rail.find(i))+\" \"+str(uf_road.find(i))] += 1\n\n\n\nfor i in range(n):\n\n print((memo[str(uf_rail.find(i))+\" \"+str(uf_road.find(i))]))","target":"class UnionFind:\n\n \"\"\"\u7d20\u96c6\u5408\u3092\u6728\u69cb\u9020\u3068\u3057\u3066\u7ba1\u7406\u3059\u308b\"\"\"\n\n def __init__(self, n):\n\n self.parent = [-1] * n\n\n self.cnt = n\n\n\n\n def root(self, x):\n\n \"\"\"\u8981\u7d20x\u306e\u6839\u3092\u6c42\u3081\u308b\"\"\"\n\n if self.parent[x] < 0:\n\n return x\n\n else:\n\n self.parent[x] = self.root(self.parent[x])\n\n return self.parent[x]\n\n\n\n def merge(self, x, y):\n\n \"\"\"\u8981\u7d20x\u3092\u542b\u3080\u96c6\u5408\u3068\u8981\u7d20y\u3092\u542b\u3080\u96c6\u5408\u3092\u7d71\u5408\u3059\u308b\"\"\"\n\n x = self.root(x)\n\n y = self.root(y)\n\n if x == y:\n\n return\n\n if self.parent[x] > self.parent[y]:\n\n x, y = y, x\n\n self.parent[x] += self.parent[y]\n\n self.parent[y] = x\n\n self.cnt -= 1\n\n\n\n def is_same(self, x, y):\n\n \"\"\"\u8981\u7d20x, y\u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u6c42\u3081\u308b\"\"\"\n\n return self.root(x) == self.root(y)\n\n\n\n def get_size(self, x):\n\n \"\"\"\u8981\u7d20x\u3092\u542b\u3080\u96c6\u5408\u306e\u8981\u7d20\u6570\u3092\u6c42\u3081\u308b\"\"\"\n\n return -self.parent[self.root(x)]\n\n\n\n\n\nn, k, l = list(map(int, input().split()))\n\ninfo_k = [list(map(int, input().split())) for i in range(k)]\n\ninfo_l = [list(map(int, input().split())) for i in range(l)]\n\n\n\nufk = UnionFind(n)\n\nufl = UnionFind(n)\n\nuf_total = UnionFind(n)\n\n\n\nfor a, b in info_k:\n\n a -= 1\n\n b -= 1\n\n ufk.merge(a, b)\n\n\n\nfor a, b in info_l:\n\n a -= 1\n\n b -= 1\n\n ufl.merge(a, b)\n\n\n\npair_cnt = {}\n\nfor i in range(n):\n\n if (ufk.root(i), ufl.root(i)) not in pair_cnt:\n\n pair_cnt[ufk.root(i), ufl.root(i)] = 1\n\n else:\n\n pair_cnt[ufk.root(i), ufl.root(i)] += 1\n\n\n\nans = [pair_cnt[ufk.root(i), ufl.root(i)] for i in range(n)]\n\nprint((*ans))","code_v0_loc":50,"code_v1_loc":62,"code_v0_num_chars":1285,"code_v1_num_chars":1521,"code_v0_no_empty_lines":"# UnionFind\u30af\u30e9\u30b9\nclass UnionFind(object):\n def __init__(self, n=1):\n self.par = [i for i in range(n)]\n self.rank = [0 for _ in range(n)]\n\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n # x\u3068y\u306e\u6839\u3092\u7d50\u5408\u3055\u305b\u308b\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x != y:\n if self.rank[x] < self.rank[y]:\n x, y = y, x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n self.par[y] = x\n\n # x,y\u306e\u6839\u304c\u540c\u3058\u304b\u3069\u3046\u304b\u3092\u8fd4\u3059\uff08\u6839\u304c\u540c\u3058:True\u3001\u6839\u304c\u7570\u306a\u308b:False\uff09\n def is_same(self, x, y):\n return self.find(x) == self.find(y)\n\n\nn, k, l = list(map(int, input().split()))\nuf_road = UnionFind(n)\nuf_rail = UnionFind(n)\nfor i in range(k):\n tmp1, tmp2 = list(map(int, input().split()))\n uf_road.union(tmp1 - 1, tmp2 - 1)\nfor i in range(l):\n tmp1, tmp2 = list(map(int, input().split()))\n uf_rail.union(tmp1 - 1, tmp2 - 1)\nmemo = {}\nfor i in range(n):\n if str(uf_rail.find(i)) + \" \" + str(uf_road.find(i)) not in memo:\n memo[str(uf_rail.find(i)) + \" \" + str(uf_road.find(i))] = 1\n else:\n memo[str(uf_rail.find(i)) + \" \" + str(uf_road.find(i))] += 1\nfor i in range(n):\n print((memo[str(uf_rail.find(i)) + \" \" + str(uf_road.find(i))]))\n","code_v1_no_empty_lines":"class UnionFind:\n \"\"\"\u7d20\u96c6\u5408\u3092\u6728\u69cb\u9020\u3068\u3057\u3066\u7ba1\u7406\u3059\u308b\"\"\"\n\n def __init__(self, n):\n self.parent = [-1] * n\n self.cnt = n\n\n def root(self, x):\n \"\"\"\u8981\u7d20x\u306e\u6839\u3092\u6c42\u3081\u308b\"\"\"\n if self.parent[x] < 0:\n return x\n else:\n self.parent[x] = self.root(self.parent[x])\n return self.parent[x]\n\n def merge(self, x, y):\n \"\"\"\u8981\u7d20x\u3092\u542b\u3080\u96c6\u5408\u3068\u8981\u7d20y\u3092\u542b\u3080\u96c6\u5408\u3092\u7d71\u5408\u3059\u308b\"\"\"\n x = self.root(x)\n y = self.root(y)\n if x == y:\n return\n if self.parent[x] > self.parent[y]:\n x, y = y, x\n self.parent[x] += self.parent[y]\n self.parent[y] = x\n self.cnt -= 1\n\n def is_same(self, x, y):\n \"\"\"\u8981\u7d20x, y\u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u6c42\u3081\u308b\"\"\"\n return self.root(x) == self.root(y)\n\n def get_size(self, x):\n \"\"\"\u8981\u7d20x\u3092\u542b\u3080\u96c6\u5408\u306e\u8981\u7d20\u6570\u3092\u6c42\u3081\u308b\"\"\"\n return -self.parent[self.root(x)]\n\n\nn, k, l = list(map(int, input().split()))\ninfo_k = [list(map(int, input().split())) for i in range(k)]\ninfo_l = [list(map(int, input().split())) for i in range(l)]\nufk = UnionFind(n)\nufl = UnionFind(n)\nuf_total = UnionFind(n)\nfor a, b in info_k:\n a -= 1\n b -= 1\n ufk.merge(a, b)\nfor a, b in info_l:\n a -= 1\n b -= 1\n ufl.merge(a, b)\npair_cnt = {}\nfor i in range(n):\n if (ufk.root(i), ufl.root(i)) not in pair_cnt:\n pair_cnt[ufk.root(i), ufl.root(i)] = 1\n else:\n pair_cnt[ufk.root(i), ufl.root(i)] += 1\nans = [pair_cnt[ufk.root(i), ufl.root(i)] for i in range(n)]\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":19.3548387097,"diff":["-# UnionFind\u30af\u30e9\u30b9","-class UnionFind(object):","- def __init__(self, n=1):","- self.par = [i for i in range(n)]","- self.rank = [0 for _ in range(n)]","+class UnionFind:","+ \"\"\"\u7d20\u96c6\u5408\u3092\u6728\u69cb\u9020\u3068\u3057\u3066\u7ba1\u7406\u3059\u308b\"\"\"","- def find(self, x):","- if self.par[x] == x:","+ def __init__(self, n):","+ self.parent = [-1] * n","+ self.cnt = n","+","+ def root(self, x):","+ \"\"\"\u8981\u7d20x\u306e\u6839\u3092\u6c42\u3081\u308b\"\"\"","+ if self.parent[x] < 0:","- self.par[x] = self.find(self.par[x])","- return self.par[x]","+ self.parent[x] = self.root(self.parent[x])","+ return self.parent[x]","- # x\u3068y\u306e\u6839\u3092\u7d50\u5408\u3055\u305b\u308b","- def union(self, x, y):","- x = self.find(x)","- y = self.find(y)","- if x != y:","- if self.rank[x] < self.rank[y]:","- x, y = y, x","- if self.rank[x] == self.rank[y]:","- self.rank[x] += 1","- self.par[y] = x","+ def merge(self, x, y):","+ \"\"\"\u8981\u7d20x\u3092\u542b\u3080\u96c6\u5408\u3068\u8981\u7d20y\u3092\u542b\u3080\u96c6\u5408\u3092\u7d71\u5408\u3059\u308b\"\"\"","+ x = self.root(x)","+ y = self.root(y)","+ if x == y:","+ return","+ if self.parent[x] > self.parent[y]:","+ x, y = y, x","+ self.parent[x] += self.parent[y]","+ self.parent[y] = x","+ self.cnt -= 1","- # x,y\u306e\u6839\u304c\u540c\u3058\u304b\u3069\u3046\u304b\u3092\u8fd4\u3059\uff08\u6839\u304c\u540c\u3058:True\u3001\u6839\u304c\u7570\u306a\u308b:False\uff09","- return self.find(x) == self.find(y)","+ \"\"\"\u8981\u7d20x, y\u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u6c42\u3081\u308b\"\"\"","+ return self.root(x) == self.root(y)","+","+ def get_size(self, x):","+ \"\"\"\u8981\u7d20x\u3092\u542b\u3080\u96c6\u5408\u306e\u8981\u7d20\u6570\u3092\u6c42\u3081\u308b\"\"\"","+ return -self.parent[self.root(x)]","-uf_road = UnionFind(n)","-uf_rail = UnionFind(n)","-for i in range(k):","- tmp1, tmp2 = list(map(int, input().split()))","- uf_road.union(tmp1 - 1, tmp2 - 1)","-for i in range(l):","- tmp1, tmp2 = list(map(int, input().split()))","- uf_rail.union(tmp1 - 1, tmp2 - 1)","-memo = {}","+info_k = [list(map(int, input().split())) for i in range(k)]","+info_l = [list(map(int, input().split())) for i in range(l)]","+ufk = UnionFind(n)","+ufl = UnionFind(n)","+uf_total = UnionFind(n)","+for a, b in info_k:","+ a -= 1","+ b -= 1","+ ufk.merge(a, b)","+for a, b in info_l:","+ a -= 1","+ b -= 1","+ ufl.merge(a, b)","+pair_cnt = {}","- if str(uf_rail.find(i)) + \" \" + str(uf_road.find(i)) not in memo:","- memo[str(uf_rail.find(i)) + \" \" + str(uf_road.find(i))] = 1","+ if (ufk.root(i), ufl.root(i)) not in pair_cnt:","+ pair_cnt[ufk.root(i), ufl.root(i)] = 1","- memo[str(uf_rail.find(i)) + \" \" + str(uf_road.find(i))] += 1","-for i in range(n):","- print((memo[str(uf_rail.find(i)) + \" \" + str(uf_road.find(i))]))","+ pair_cnt[ufk.root(i), ufl.root(i)] += 1","+ans = [pair_cnt[ufk.root(i), ufl.root(i)] for i in range(n)]","+print((*ans))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422541142,"measured_runtime_v1":0.1438153267,"runtime_lift":0.2938081435,"key":["s192661690","s155666652"]} +{"user_id":"u391731808","problem_id":"p03326","language":"python","submission_id_v0":"s897324453","submission_id_v1":"s877257178","cpu_time_v0":32,"cpu_time_v1":22,"memory_v0":3672,"memory_v1":3444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.25,"input":"N,M = list(map(int,input().split()))\n\nxyz = [list(map(int,input().split())) for _ in range(N)]\n\nans = [[] for _ in range(8)]\n\nfor x,y,z in xyz:\n\n for i in range(8):\n\n ans[i].append(x*((-1)**i)+y*((-1)**(i\/\/2))+z*((-1)**(i\/\/4)))\n\nout = []\n\nfor i in range(8):\n\n ans[i].sort(reverse=True)\n\n out.append(sum(ans[i][:M]))\n\nprint((max(out)))","target":"N,M = list(map(int,input().split()))\n\nXYZ = [list(map(int,input().split())) for _ in [0]*N]\n\nW = [[0]*N for _ in [0]*4]\n\nfor i,xyz in enumerate(XYZ):\n\n x,y,z = xyz\n\n W[0][i] = x+y+z\n\n W[1][i] = x+y-z\n\n W[2][i] = x-y+z\n\n W[3][i] = x-y-z\n\nans = 0\n\nfor i in range(4):\n\n W[i].sort()\n\n ans = max(ans,\n\n abs(sum(W[i][:M])),\n\n abs(sum(W[i][-M:])))\n\nif M==0:ans=0\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":17,"code_v0_num_chars":342,"code_v1_num_chars":406,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nxyz = [list(map(int, input().split())) for _ in range(N)]\nans = [[] for _ in range(8)]\nfor x, y, z in xyz:\n for i in range(8):\n ans[i].append(x * ((-1) ** i) + y * ((-1) ** (i \/\/ 2)) + z * ((-1) ** (i \/\/ 4)))\nout = []\nfor i in range(8):\n ans[i].sort(reverse=True)\n out.append(sum(ans[i][:M]))\nprint((max(out)))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nXYZ = [list(map(int, input().split())) for _ in [0] * N]\nW = [[0] * N for _ in [0] * 4]\nfor i, xyz in enumerate(XYZ):\n x, y, z = xyz\n W[0][i] = x + y + z\n W[1][i] = x + y - z\n W[2][i] = x - y + z\n W[3][i] = x - y - z\nans = 0\nfor i in range(4):\n W[i].sort()\n ans = max(ans, abs(sum(W[i][:M])), abs(sum(W[i][-M:])))\nif M == 0:\n ans = 0\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":35.2941176471,"diff":["-xyz = [list(map(int, input().split())) for _ in range(N)]","-ans = [[] for _ in range(8)]","-for x, y, z in xyz:","- for i in range(8):","- ans[i].append(x * ((-1) ** i) + y * ((-1) ** (i \/\/ 2)) + z * ((-1) ** (i \/\/ 4)))","-out = []","-for i in range(8):","- ans[i].sort(reverse=True)","- out.append(sum(ans[i][:M]))","-print((max(out)))","+XYZ = [list(map(int, input().split())) for _ in [0] * N]","+W = [[0] * N for _ in [0] * 4]","+for i, xyz in enumerate(XYZ):","+ x, y, z = xyz","+ W[0][i] = x + y + z","+ W[1][i] = x + y - z","+ W[2][i] = x - y + z","+ W[3][i] = x - y - z","+ans = 0","+for i in range(4):","+ W[i].sort()","+ ans = max(ans, abs(sum(W[i][:M])), abs(sum(W[i][-M:])))","+if M == 0:","+ ans = 0","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0586713524,"measured_runtime_v1":0.0593594992,"runtime_lift":0.988407132,"key":["s897324453","s877257178"]} +{"user_id":"u989345508","problem_id":"p03814","language":"python","submission_id_v0":"s078189816","submission_id_v1":"s227039406","cpu_time_v0":44,"cpu_time_v1":34,"memory_v0":3512,"memory_v1":3512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.73,"input":"s=eval(input())\n\nfor i in range(len(s)):\n\n if s[i]==\"A\":\n\n a=i\n\n break\n\nfor i in range(len(s)):\n\n if s[-i-1]==\"Z\":\n\n print((len(s)-i-a))\n\n break\n","target":"s=eval(input())\n\nl=len(s)\n\na,b=0,l-1\n\nfor i in range(l):\n\n if s[i]==\"A\":\n\n a=i\n\n break\n\nfor i in range(l-1,-1,-1):\n\n if s[i]==\"Z\":\n\n b=i\n\n break\n\nprint((b-a+1))\n","code_v0_loc":9,"code_v1_loc":12,"code_v0_num_chars":171,"code_v1_num_chars":187,"code_v0_no_empty_lines":"s = eval(input())\nfor i in range(len(s)):\n if s[i] == \"A\":\n a = i\n break\nfor i in range(len(s)):\n if s[-i - 1] == \"Z\":\n print((len(s) - i - a))\n break\n","code_v1_no_empty_lines":"s = eval(input())\nl = len(s)\na, b = 0, l - 1\nfor i in range(l):\n if s[i] == \"A\":\n a = i\n break\nfor i in range(l - 1, -1, -1):\n if s[i] == \"Z\":\n b = i\n break\nprint((b - a + 1))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-for i in range(len(s)):","+l = len(s)","+a, b = 0, l - 1","+for i in range(l):","-for i in range(len(s)):","- if s[-i - 1] == \"Z\":","- print((len(s) - i - a))","+for i in range(l - 1, -1, -1):","+ if s[i] == \"Z\":","+ b = i","+print((b - a + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0332761822,"measured_runtime_v1":0.0372160616,"runtime_lift":0.8941349714,"key":["s078189816","s227039406"]} +{"user_id":"u519939795","problem_id":"p03695","language":"python","submission_id_v0":"s863626034","submission_id_v1":"s269280023","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3316,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"import sys\n\nn=int(eval(input()))\n\na=list(map(int,input().split()))\n\nl=[]\n\nfree=0\n\nfor i in range(n):\n\n if 1<=a[i]<=399:\n\n l.append(1)\n\n elif 400<=a[i]<=799:\n\n l.append(2)\n\n elif 800<=a[i]<=1199:\n\n l.append(3)\n\n elif 1200<=a[i]<=1599:\n\n l.append(4)\n\n elif 1600<=a[i]<=1999:\n\n l.append(5)\n\n elif 2000<=a[i]<=2399:\n\n l.append(6)\n\n elif 2400<=a[i]<=2799:\n\n l.append(7)\n\n elif 2800<=a[i]<=3199:\n\n l.append(8)\n\n else:\n\n free+=1\n\n \n\nif len(set(l))==0:\n\n print((1,free))\n\n sys.exit()\n\nprint((len(set(l)),len(set(l))+free))","target":"n=int(eval(input()))\n\nA=list(map(int,input().split()))\n\nB=[]\n\nC=[]\n\nfor i in range(n):\n\n for j in range(8):\n\n if (j*400)<=A[i]<((j+1)*400):\n\n B.append(j)\n\n if 3200<=A[i]:\n\n C.append(i)\n\nprint((max(len(set(B)),1),len(set(B))+len(C)))\n","code_v0_loc":29,"code_v1_loc":11,"code_v0_num_chars":603,"code_v1_num_chars":256,"code_v0_no_empty_lines":"import sys\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nl = []\nfree = 0\nfor i in range(n):\n if 1 <= a[i] <= 399:\n l.append(1)\n elif 400 <= a[i] <= 799:\n l.append(2)\n elif 800 <= a[i] <= 1199:\n l.append(3)\n elif 1200 <= a[i] <= 1599:\n l.append(4)\n elif 1600 <= a[i] <= 1999:\n l.append(5)\n elif 2000 <= a[i] <= 2399:\n l.append(6)\n elif 2400 <= a[i] <= 2799:\n l.append(7)\n elif 2800 <= a[i] <= 3199:\n l.append(8)\n else:\n free += 1\nif len(set(l)) == 0:\n print((1, free))\n sys.exit()\nprint((len(set(l)), len(set(l)) + free))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nB = []\nC = []\nfor i in range(n):\n for j in range(8):\n if (j * 400) <= A[i] < ((j + 1) * 400):\n B.append(j)\n if 3200 <= A[i]:\n C.append(i)\nprint((max(len(set(B)), 1), len(set(B)) + len(C)))\n","code_same":false,"relative_loc_diff_percent":62.0689655172,"diff":["-import sys","-","-a = list(map(int, input().split()))","-l = []","-free = 0","+A = list(map(int, input().split()))","+B = []","+C = []","- if 1 <= a[i] <= 399:","- l.append(1)","- elif 400 <= a[i] <= 799:","- l.append(2)","- elif 800 <= a[i] <= 1199:","- l.append(3)","- elif 1200 <= a[i] <= 1599:","- l.append(4)","- elif 1600 <= a[i] <= 1999:","- l.append(5)","- elif 2000 <= a[i] <= 2399:","- l.append(6)","- elif 2400 <= a[i] <= 2799:","- l.append(7)","- elif 2800 <= a[i] <= 3199:","- l.append(8)","- else:","- free += 1","-if len(set(l)) == 0:","- print((1, free))","- sys.exit()","-print((len(set(l)), len(set(l)) + free))","+ for j in range(8):","+ if (j * 400) <= A[i] < ((j + 1) * 400):","+ B.append(j)","+ if 3200 <= A[i]:","+ C.append(i)","+print((max(len(set(B)), 1), len(set(B)) + len(C)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0359927628,"measured_runtime_v1":0.0363721106,"runtime_lift":0.9895703657,"key":["s863626034","s269280023"]} +{"user_id":"u984276646","problem_id":"p03835","language":"python","submission_id_v0":"s386820828","submission_id_v1":"s014791627","cpu_time_v0":783,"cpu_time_v1":16,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":97.96,"input":"K, S = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(K+1):\n\n for j in range(i, K+1):\n\n if 0 <= S - i - j <= K:\n\n if i == j:\n\n cnt += 1\n\n else:\n\n cnt += 2\n\nprint(cnt)","target":"K, S = list(map(int, input().split()))\n\nX = (S + 2) * (S + 1)\n\nif S - K - 1 >= 0:\n\n X -= 3 * (S - K + 1) * (S - K)\n\nif S - 2 * K - 2 >= 0:\n\n X += 3 * (S - 2 * K) * (S - 2 * K - 1)\n\n\n\nprint((X \/\/ 2))","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":198,"code_v1_num_chars":192,"code_v0_no_empty_lines":"K, S = list(map(int, input().split()))\ncnt = 0\nfor i in range(K + 1):\n for j in range(i, K + 1):\n if 0 <= S - i - j <= K:\n if i == j:\n cnt += 1\n else:\n cnt += 2\nprint(cnt)\n","code_v1_no_empty_lines":"K, S = list(map(int, input().split()))\nX = (S + 2) * (S + 1)\nif S - K - 1 >= 0:\n X -= 3 * (S - K + 1) * (S - K)\nif S - 2 * K - 2 >= 0:\n X += 3 * (S - 2 * K) * (S - 2 * K - 1)\nprint((X \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-cnt = 0","-for i in range(K + 1):","- for j in range(i, K + 1):","- if 0 <= S - i - j <= K:","- if i == j:","- cnt += 1","- else:","- cnt += 2","-print(cnt)","+X = (S + 2) * (S + 1)","+if S - K - 1 >= 0:","+ X -= 3 * (S - K + 1) * (S - K)","+if S - 2 * K - 2 >= 0:","+ X += 3 * (S - 2 * K) * (S - 2 * K - 1)","+print((X \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0459131862,"measured_runtime_v1":0.0075944932,"runtime_lift":6.045589179,"key":["s386820828","s014791627"]} +{"user_id":"u934442292","problem_id":"p03274","language":"python","submission_id_v0":"s963731524","submission_id_v1":"s021648775","cpu_time_v0":93,"cpu_time_v1":75,"memory_v0":20024,"memory_v1":20260,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.35,"input":"import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef main():\n\n N, K = list(map(int, input().split()))\n\n X = list(map(int, input().split()))\n\n\n\n INF = float(\"inf\")\n\n M = [INF] * N\n\n P = [INF] * N\n\n i_m, i_p = 0, 0\n\n for x in X:\n\n if x == 0:\n\n K -= 1\n\n elif x > 0:\n\n P[i_p] = x\n\n i_p += 1\n\n else:\n\n M[i_m] = -x\n\n i_m += 1\n\n\n\n if K <= 0:\n\n print((0))\n\n exit()\n\n\n\n M.sort()\n\n P.sort()\n\n ans = min(M[K - 1], P[K - 1])\n\n for n_M in range(1, K + 1):\n\n dist = 2 * M[n_M - 1] + P[K - n_M - 1]\n\n if ans > dist:\n\n ans = dist\n\n for n_P in range(1, K + 1):\n\n dist = 2 * P[n_P - 1] + M[K - n_P - 1]\n\n if ans > dist:\n\n ans = dist\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef main():\n\n N, K = list(map(int, input().split()))\n\n X = list(map(int, input().split()))\n\n\n\n X.sort()\n\n ans = float(\"inf\")\n\n for l in range(N - K + 1):\n\n r = l + K - 1\n\n l2r = abs(X[l]) + abs(X[l] - X[r])\n\n r2l = abs(X[r]) + abs(X[r] - X[l])\n\n ans = min(ans, l2r, r2l)\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":44,"code_v1_loc":22,"code_v0_num_chars":845,"code_v1_num_chars":416,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N, K = list(map(int, input().split()))\n X = list(map(int, input().split()))\n INF = float(\"inf\")\n M = [INF] * N\n P = [INF] * N\n i_m, i_p = 0, 0\n for x in X:\n if x == 0:\n K -= 1\n elif x > 0:\n P[i_p] = x\n i_p += 1\n else:\n M[i_m] = -x\n i_m += 1\n if K <= 0:\n print((0))\n exit()\n M.sort()\n P.sort()\n ans = min(M[K - 1], P[K - 1])\n for n_M in range(1, K + 1):\n dist = 2 * M[n_M - 1] + P[K - n_M - 1]\n if ans > dist:\n ans = dist\n for n_P in range(1, K + 1):\n dist = 2 * P[n_P - 1] + M[K - n_P - 1]\n if ans > dist:\n ans = dist\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N, K = list(map(int, input().split()))\n X = list(map(int, input().split()))\n X.sort()\n ans = float(\"inf\")\n for l in range(N - K + 1):\n r = l + K - 1\n l2r = abs(X[l]) + abs(X[l] - X[r])\n r2l = abs(X[r]) + abs(X[r] - X[l])\n ans = min(ans, l2r, r2l)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["- INF = float(\"inf\")","- M = [INF] * N","- P = [INF] * N","- i_m, i_p = 0, 0","- for x in X:","- if x == 0:","- K -= 1","- elif x > 0:","- P[i_p] = x","- i_p += 1","- else:","- M[i_m] = -x","- i_m += 1","- if K <= 0:","- print((0))","- exit()","- M.sort()","- P.sort()","- ans = min(M[K - 1], P[K - 1])","- for n_M in range(1, K + 1):","- dist = 2 * M[n_M - 1] + P[K - n_M - 1]","- if ans > dist:","- ans = dist","- for n_P in range(1, K + 1):","- dist = 2 * P[n_P - 1] + M[K - n_P - 1]","- if ans > dist:","- ans = dist","+ X.sort()","+ ans = float(\"inf\")","+ for l in range(N - K + 1):","+ r = l + K - 1","+ l2r = abs(X[l]) + abs(X[l] - X[r])","+ r2l = abs(X[r]) + abs(X[r] - X[l])","+ ans = min(ans, l2r, r2l)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0464517288,"measured_runtime_v1":0.044719794,"runtime_lift":1.0387285946,"key":["s963731524","s021648775"]} +{"user_id":"u561083515","problem_id":"p02796","language":"python","submission_id_v0":"s595287470","submission_id_v1":"s590073630","cpu_time_v0":409,"cpu_time_v1":257,"memory_v0":37160,"memory_v1":37288,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.16,"input":"N = int(eval(input()))\n\nLR = [[int(i) for i in input().split()] for _ in range(N)]\n\n\n\n# \u533a\u9593\u3092\u53f3\u7aef\u306e\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8\n\nLR = sorted([(x-l, x+l) for x,l in LR],key=lambda x: x[1])\n\n\n\nans = 0\n\n# \u73fe\u5728\u9078\u3093\u3067\u3044\u308b\u533a\u9593\u306e\u5185\u3001\u6700\u3082\u53f3\u306b\u3042\u308b\u533a\u9593\u306e\u53f3\u7aef\n\ncur_R = -float(\"inf\")\n\n\n\nfor i in range(N):\n\n # \u533a\u9593\u304c\u88ab\u308b\u3068\u304d\n\n if cur_R > LR[i][0]:\n\n continue\n\n ans += 1\n\n cur_R = LR[i][1]\n\n\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n LR = [[int(i) for i in input().split()] for _ in range(N)]\n\n\n\n # \u533a\u9593\u3092\u53f3\u7aef\u306e\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8\n\n LR = sorted([(x-l, x+l) for x,l in LR],key=lambda x: x[1])\n\n\n\n ans = 0\n\n # \u73fe\u5728\u9078\u3093\u3067\u3044\u308b\u533a\u9593\u306e\u5185\u3001\u6700\u3082\u53f3\u306b\u3042\u308b\u533a\u9593\u306e\u53f3\u7aef\n\n cur_R = -float(\"inf\")\n\n\n\n for i in range(N):\n\n # \u533a\u9593\u304c\u88ab\u308b\u3068\u304d\n\n if cur_R > LR[i][0]:\n\n continue\n\n ans += 1\n\n cur_R = LR[i][1]\n\n\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":18,"code_v1_loc":25,"code_v0_num_chars":348,"code_v1_num_chars":501,"code_v0_no_empty_lines":"N = int(eval(input()))\nLR = [[int(i) for i in input().split()] for _ in range(N)]\n# \u533a\u9593\u3092\u53f3\u7aef\u306e\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8\nLR = sorted([(x - l, x + l) for x, l in LR], key=lambda x: x[1])\nans = 0\n# \u73fe\u5728\u9078\u3093\u3067\u3044\u308b\u533a\u9593\u306e\u5185\u3001\u6700\u3082\u53f3\u306b\u3042\u308b\u533a\u9593\u306e\u53f3\u7aef\ncur_R = -float(\"inf\")\nfor i in range(N):\n # \u533a\u9593\u304c\u88ab\u308b\u3068\u304d\n if cur_R > LR[i][0]:\n continue\n ans += 1\n cur_R = LR[i][1]\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(eval(input()))\n LR = [[int(i) for i in input().split()] for _ in range(N)]\n # \u533a\u9593\u3092\u53f3\u7aef\u306e\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8\n LR = sorted([(x - l, x + l) for x, l in LR], key=lambda x: x[1])\n ans = 0\n # \u73fe\u5728\u9078\u3093\u3067\u3044\u308b\u533a\u9593\u306e\u5185\u3001\u6700\u3082\u53f3\u306b\u3042\u308b\u533a\u9593\u306e\u53f3\u7aef\n cur_R = -float(\"inf\")\n for i in range(N):\n # \u533a\u9593\u304c\u88ab\u308b\u3068\u304d\n if cur_R > LR[i][0]:\n continue\n ans += 1\n cur_R = LR[i][1]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":28.0,"diff":["-N = int(eval(input()))","-LR = [[int(i) for i in input().split()] for _ in range(N)]","-# \u533a\u9593\u3092\u53f3\u7aef\u306e\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8","-LR = sorted([(x - l, x + l) for x, l in LR], key=lambda x: x[1])","-ans = 0","-# \u73fe\u5728\u9078\u3093\u3067\u3044\u308b\u533a\u9593\u306e\u5185\u3001\u6700\u3082\u53f3\u306b\u3042\u308b\u533a\u9593\u306e\u53f3\u7aef","-cur_R = -float(\"inf\")","-for i in range(N):","- # \u533a\u9593\u304c\u88ab\u308b\u3068\u304d","- if cur_R > LR[i][0]:","- continue","- ans += 1","- cur_R = LR[i][1]","-print(ans)","+import sys","+","+input = sys.stdin.readline","+","+","+def main():","+ N = int(eval(input()))","+ LR = [[int(i) for i in input().split()] for _ in range(N)]","+ # \u533a\u9593\u3092\u53f3\u7aef\u306e\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8","+ LR = sorted([(x - l, x + l) for x, l in LR], key=lambda x: x[1])","+ ans = 0","+ # \u73fe\u5728\u9078\u3093\u3067\u3044\u308b\u533a\u9593\u306e\u5185\u3001\u6700\u3082\u53f3\u306b\u3042\u308b\u533a\u9593\u306e\u53f3\u7aef","+ cur_R = -float(\"inf\")","+ for i in range(N):","+ # \u533a\u9593\u304c\u88ab\u308b\u3068\u304d","+ if cur_R > LR[i][0]:","+ continue","+ ans += 1","+ cur_R = LR[i][1]","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0417336597,"measured_runtime_v1":0.0383592775,"runtime_lift":1.087967826,"key":["s595287470","s590073630"]} +{"user_id":"u470286613","problem_id":"p02983","language":"python","submission_id_v0":"s579376150","submission_id_v1":"s380052641","cpu_time_v0":1589,"cpu_time_v1":750,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.8,"input":"L,R=list(map(int,input().split()))\n\nr=2018\n\nfor i in range(L,min(R,L+2019)):\n\n for j in range(L+1,min(R+1,L+2020)):\n\n r=min(r,(i*j)%2019)\n\nprint(r)","target":"L,R=list(map(int,input().split()))\n\nif R-L>2018:\n\n print((0))\n\nelse:\n\n r=2018\n\n for i in range(L,min(R,L+2019)):\n\n for j in range(i+1,min(R+1,L+2020)):\n\n r=min(r,(i*j)%2019)\n\n print(r)","code_v0_loc":6,"code_v1_loc":9,"code_v0_num_chars":151,"code_v1_num_chars":206,"code_v0_no_empty_lines":"L, R = list(map(int, input().split()))\nr = 2018\nfor i in range(L, min(R, L + 2019)):\n for j in range(L + 1, min(R + 1, L + 2020)):\n r = min(r, (i * j) % 2019)\nprint(r)\n","code_v1_no_empty_lines":"L, R = list(map(int, input().split()))\nif R - L > 2018:\n print((0))\nelse:\n r = 2018\n for i in range(L, min(R, L + 2019)):\n for j in range(i + 1, min(R + 1, L + 2020)):\n r = min(r, (i * j) % 2019)\n print(r)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-r = 2018","-for i in range(L, min(R, L + 2019)):","- for j in range(L + 1, min(R + 1, L + 2020)):","- r = min(r, (i * j) % 2019)","-print(r)","+if R - L > 2018:","+ print((0))","+else:","+ r = 2018","+ for i in range(L, min(R, L + 2019)):","+ for j in range(i + 1, min(R + 1, L + 2020)):","+ r = min(r, (i * j) % 2019)","+ print(r)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0827362061,"measured_runtime_v1":0.1418238147,"runtime_lift":0.5833731536,"key":["s579376150","s380052641"]} +{"user_id":"u047796752","problem_id":"p02956","language":"python","submission_id_v0":"s042984515","submission_id_v1":"s064558999","cpu_time_v0":1899,"cpu_time_v1":1236,"memory_v0":192836,"memory_v1":192836,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.91,"input":"import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\ndef compress(l):\n\n l = list(set(l))\n\n l.sort()\n\n idx = defaultdict(int)\n\n\n\n for i in range(len(l)):\n\n idx[l[i]] = i\n\n \n\n return idx\n\n \n\nclass BIT:\n\n def __init__(self, n):\n\n self.n = n\n\n self.bit = [0]*(n+1)\n\n \n\n def add(self, i, x):\n\n i += 1\n\n \n\n while i<=self.n:\n\n self.bit[i] += x\n\n i += i&(-i)\n\n\n\n def acc(self, i):\n\n s = 0\n\n \n\n while i>0:\n\n s += self.bit[i]\n\n i -= i&(-i)\n\n \n\n return s\n\n\n\nN = int(eval(input()))\n\nxy = [tuple(map(int, input().split())) for _ in range(N)]\n\nxy.sort(key=lambda t: t[0])\n\nidx = compress([xy_i[1] for xy_i in xy])\n\nlbit = BIT(N)\n\nrbit = BIT(N)\n\n\n\nfor i in range(N):\n\n rbit.add(i, 1)\n\n \n\nans = 0\n\nMOD = 998244353\n\n\n\nfor i in range(N):\n\n y = xy[i][1]\n\n rbit.add(idx[y], -1)\n\n a = i-lbit.acc(idx[y])\n\n b = lbit.acc(idx[y])\n\n c = rbit.acc(idx[y])\n\n d = N-1-i-rbit.acc(idx[y])\n\n add = 2*pow(2, N-1, MOD)-1\n\n add = (add-(pow(2, a, MOD)-1))%MOD\n\n add = (add-(pow(2, b, MOD)-1))%MOD\n\n add = (add-(pow(2, c, MOD)-1))%MOD\n\n add = (add-(pow(2, d, MOD)-1))%MOD\n\n add = (add-(pow(2, a+b, MOD)-pow(2, a, MOD)-pow(2, b, MOD)+1))%MOD\n\n add = (add-(pow(2, b+c, MOD)-pow(2, b, MOD)-pow(2, c, MOD)+1))%MOD\n\n add = (add-(pow(2, c+d, MOD)-pow(2, c, MOD)-pow(2, d, MOD)+1))%MOD\n\n add = (add-(pow(2, d+a, MOD)-pow(2, d, MOD)-pow(2, a, MOD)+1))%MOD\n\n ans += add\n\n ans %= MOD\n\n lbit.add(idx[y], 1)\n\n\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\ndef compress(l):\n\n l = list(set(l))\n\n l.sort()\n\n idx = defaultdict(int)\n\n\n\n for i in range(len(l)):\n\n idx[l[i]] = i\n\n \n\n return idx\n\n \n\nclass BIT:\n\n def __init__(self, n):\n\n self.n = n\n\n self.bit = [0]*(n+1)\n\n \n\n def add(self, i, x):\n\n i += 1\n\n \n\n while i<=self.n:\n\n self.bit[i] += x\n\n i += i&(-i)\n\n\n\n def acc(self, i):\n\n s = 0\n\n \n\n while i>0:\n\n s += self.bit[i]\n\n i -= i&(-i)\n\n \n\n return s\n\n\n\nN = int(eval(input()))\n\nxy = [tuple(map(int, input().split())) for _ in range(N)]\n\nxy.sort(key=lambda t: t[0])\n\nidx = compress([xy_i[1] for xy_i in xy])\n\nlbit = BIT(N)\n\nrbit = BIT(N)\n\n\n\nfor i in range(N):\n\n rbit.add(i, 1)\n\n \n\nans = 0\n\nMOD = 998244353\n\n\n\nfor i in range(N):\n\n y = xy[i][1]\n\n rbit.add(idx[y], -1)\n\n a = i-lbit.acc(idx[y])\n\n b = lbit.acc(idx[y])\n\n c = rbit.acc(idx[y])\n\n d = N-1-i-rbit.acc(idx[y])\n\n add = 2*pow(2, N-1, MOD)-1\n\n pa = pow(2, a, MOD)\n\n pb = pow(2, b, MOD)\n\n pc = pow(2, c, MOD)\n\n pd = pow(2, d, MOD)\n\n add = (add-(pa-1))%MOD\n\n add = (add-(pb-1))%MOD\n\n add = (add-(pc-1))%MOD\n\n add = (add-(pd-1))%MOD\n\n add = (add-(pa*pb-pa-pb+1))%MOD\n\n add = (add-(pb*pc-pb-pc+1))%MOD\n\n add = (add-(pc*pd-pc-pd+1))%MOD\n\n add = (add-(pd*pa-pd-pa+1))%MOD\n\n ans += add\n\n ans %= MOD\n\n lbit.add(idx[y], 1)\n\n\n\nprint(ans)","code_v0_loc":69,"code_v1_loc":73,"code_v0_num_chars":1596,"code_v1_num_chars":1508,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\n\ndef compress(l):\n l = list(set(l))\n l.sort()\n idx = defaultdict(int)\n for i in range(len(l)):\n idx[l[i]] = i\n return idx\n\n\nclass BIT:\n def __init__(self, n):\n self.n = n\n self.bit = [0] * (n + 1)\n\n def add(self, i, x):\n i += 1\n while i <= self.n:\n self.bit[i] += x\n i += i & (-i)\n\n def acc(self, i):\n s = 0\n while i > 0:\n s += self.bit[i]\n i -= i & (-i)\n return s\n\n\nN = int(eval(input()))\nxy = [tuple(map(int, input().split())) for _ in range(N)]\nxy.sort(key=lambda t: t[0])\nidx = compress([xy_i[1] for xy_i in xy])\nlbit = BIT(N)\nrbit = BIT(N)\nfor i in range(N):\n rbit.add(i, 1)\nans = 0\nMOD = 998244353\nfor i in range(N):\n y = xy[i][1]\n rbit.add(idx[y], -1)\n a = i - lbit.acc(idx[y])\n b = lbit.acc(idx[y])\n c = rbit.acc(idx[y])\n d = N - 1 - i - rbit.acc(idx[y])\n add = 2 * pow(2, N - 1, MOD) - 1\n add = (add - (pow(2, a, MOD) - 1)) % MOD\n add = (add - (pow(2, b, MOD) - 1)) % MOD\n add = (add - (pow(2, c, MOD) - 1)) % MOD\n add = (add - (pow(2, d, MOD) - 1)) % MOD\n add = (add - (pow(2, a + b, MOD) - pow(2, a, MOD) - pow(2, b, MOD) + 1)) % MOD\n add = (add - (pow(2, b + c, MOD) - pow(2, b, MOD) - pow(2, c, MOD) + 1)) % MOD\n add = (add - (pow(2, c + d, MOD) - pow(2, c, MOD) - pow(2, d, MOD) + 1)) % MOD\n add = (add - (pow(2, d + a, MOD) - pow(2, d, MOD) - pow(2, a, MOD) + 1)) % MOD\n ans += add\n ans %= MOD\n lbit.add(idx[y], 1)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\n\ndef compress(l):\n l = list(set(l))\n l.sort()\n idx = defaultdict(int)\n for i in range(len(l)):\n idx[l[i]] = i\n return idx\n\n\nclass BIT:\n def __init__(self, n):\n self.n = n\n self.bit = [0] * (n + 1)\n\n def add(self, i, x):\n i += 1\n while i <= self.n:\n self.bit[i] += x\n i += i & (-i)\n\n def acc(self, i):\n s = 0\n while i > 0:\n s += self.bit[i]\n i -= i & (-i)\n return s\n\n\nN = int(eval(input()))\nxy = [tuple(map(int, input().split())) for _ in range(N)]\nxy.sort(key=lambda t: t[0])\nidx = compress([xy_i[1] for xy_i in xy])\nlbit = BIT(N)\nrbit = BIT(N)\nfor i in range(N):\n rbit.add(i, 1)\nans = 0\nMOD = 998244353\nfor i in range(N):\n y = xy[i][1]\n rbit.add(idx[y], -1)\n a = i - lbit.acc(idx[y])\n b = lbit.acc(idx[y])\n c = rbit.acc(idx[y])\n d = N - 1 - i - rbit.acc(idx[y])\n add = 2 * pow(2, N - 1, MOD) - 1\n pa = pow(2, a, MOD)\n pb = pow(2, b, MOD)\n pc = pow(2, c, MOD)\n pd = pow(2, d, MOD)\n add = (add - (pa - 1)) % MOD\n add = (add - (pb - 1)) % MOD\n add = (add - (pc - 1)) % MOD\n add = (add - (pd - 1)) % MOD\n add = (add - (pa * pb - pa - pb + 1)) % MOD\n add = (add - (pb * pc - pb - pc + 1)) % MOD\n add = (add - (pc * pd - pc - pd + 1)) % MOD\n add = (add - (pd * pa - pd - pa + 1)) % MOD\n ans += add\n ans %= MOD\n lbit.add(idx[y], 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.4794520548,"diff":["- add = (add - (pow(2, a, MOD) - 1)) % MOD","- add = (add - (pow(2, b, MOD) - 1)) % MOD","- add = (add - (pow(2, c, MOD) - 1)) % MOD","- add = (add - (pow(2, d, MOD) - 1)) % MOD","- add = (add - (pow(2, a + b, MOD) - pow(2, a, MOD) - pow(2, b, MOD) + 1)) % MOD","- add = (add - (pow(2, b + c, MOD) - pow(2, b, MOD) - pow(2, c, MOD) + 1)) % MOD","- add = (add - (pow(2, c + d, MOD) - pow(2, c, MOD) - pow(2, d, MOD) + 1)) % MOD","- add = (add - (pow(2, d + a, MOD) - pow(2, d, MOD) - pow(2, a, MOD) + 1)) % MOD","+ pa = pow(2, a, MOD)","+ pb = pow(2, b, MOD)","+ pc = pow(2, c, MOD)","+ pd = pow(2, d, MOD)","+ add = (add - (pa - 1)) % MOD","+ add = (add - (pb - 1)) % MOD","+ add = (add - (pc - 1)) % MOD","+ add = (add - (pd - 1)) % MOD","+ add = (add - (pa * pb - pa - pb + 1)) % MOD","+ add = (add - (pb * pc - pb - pc + 1)) % MOD","+ add = (add - (pc * pd - pc - pd + 1)) % MOD","+ add = (add - (pd * pa - pd - pa + 1)) % MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.036600132,"measured_runtime_v1":0.0425868363,"runtime_lift":0.8594235949,"key":["s042984515","s064558999"]} +{"user_id":"u297574184","problem_id":"p02972","language":"python","submission_id_v0":"s515550706","submission_id_v1":"s153136804","cpu_time_v0":532,"cpu_time_v1":215,"memory_v0":19900,"memory_v1":19892,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.59,"input":"N = int(eval(input()))\n\nAs = list(map(int, input().split()))\n\n\n\nisBalls = [0] * (N+1)\n\nfor k in reversed(list(range(1, N+1))):\n\n num = sum([isBalls[k*i] for i in range(1, N\/\/k+1)])\n\n if num % 2 != As[k-1]:\n\n isBalls[k] = 1\n\n\n\nM = sum(isBalls)\n\nanss = [i for i in range(1, N+1) if isBalls[i] > 0]\n\n\n\nprint(M)\n\nprint((' '.join(map(str, anss))))\n","target":"N = int(eval(input()))\n\nAs = list(map(int, input().split()))\n\n\n\nBs = [0] * (N+1)\n\nfor i in reversed(list(range(1, N+1))):\n\n parity = sum(Bs[i::i]) % 2\n\n if parity != As[i-1]:\n\n Bs[i] = 1\n\n\n\nanss = [i for i in range(1, N+1) if Bs[i]]\n\n\n\nprint((len(anss)))\n\nif anss:\n\n print((' '.join(map(str, anss))))\n","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":342,"code_v1_num_chars":301,"code_v0_no_empty_lines":"N = int(eval(input()))\nAs = list(map(int, input().split()))\nisBalls = [0] * (N + 1)\nfor k in reversed(list(range(1, N + 1))):\n num = sum([isBalls[k * i] for i in range(1, N \/\/ k + 1)])\n if num % 2 != As[k - 1]:\n isBalls[k] = 1\nM = sum(isBalls)\nanss = [i for i in range(1, N + 1) if isBalls[i] > 0]\nprint(M)\nprint((\" \".join(map(str, anss))))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nAs = list(map(int, input().split()))\nBs = [0] * (N + 1)\nfor i in reversed(list(range(1, N + 1))):\n parity = sum(Bs[i::i]) % 2\n if parity != As[i - 1]:\n Bs[i] = 1\nanss = [i for i in range(1, N + 1) if Bs[i]]\nprint((len(anss)))\nif anss:\n print((\" \".join(map(str, anss))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-isBalls = [0] * (N + 1)","-for k in reversed(list(range(1, N + 1))):","- num = sum([isBalls[k * i] for i in range(1, N \/\/ k + 1)])","- if num % 2 != As[k - 1]:","- isBalls[k] = 1","-M = sum(isBalls)","-anss = [i for i in range(1, N + 1) if isBalls[i] > 0]","-print(M)","-print((\" \".join(map(str, anss))))","+Bs = [0] * (N + 1)","+for i in reversed(list(range(1, N + 1))):","+ parity = sum(Bs[i::i]) % 2","+ if parity != As[i - 1]:","+ Bs[i] = 1","+anss = [i for i in range(1, N + 1) if Bs[i]]","+print((len(anss)))","+if anss:","+ print((\" \".join(map(str, anss))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0769467433,"measured_runtime_v1":0.0771770388,"runtime_lift":0.9970160106,"key":["s515550706","s153136804"]} +{"user_id":"u325227960","problem_id":"p02889","language":"python","submission_id_v0":"s214671182","submission_id_v1":"s608653449","cpu_time_v0":1282,"cpu_time_v1":1117,"memory_v0":43932,"memory_v1":43916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.87,"input":"n,m,l = list(map(int,input().split()))\n\nA = [list(map(int,input().split())) for i in range(m)]\n\nq = int(eval(input()))\n\nS = [list(map(int,input().split())) for i in range(q)]\n\n\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\nfor i in range(m): # \u30ce\u30fc\u30c9\u756a\u53f7\u304c1\u59cb\u307e\u308a\u3067\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u5834\u5408\n\n for j in range(2):\n\n A[i][j] -= 1\n\n\n\nfor i in range(q): # \u30ce\u30fc\u30c9\u756a\u53f7\u304c1\u59cb\u307e\u308a\u3067\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u5834\u5408\n\n for j in range(2):\n\n S[i][j] -= 1\n\n\n\nM = [[float(\"inf\")] * n for i in range(n)]\n\n\n\nfor i in range(n):\n\n M[i][i] = 0\n\n\n\nfor i in range(m):\n\n M[A[i][0]][A[i][1]] = A[i][2]\n\n M[A[i][1]][A[i][0]] = A[i][2]\n\n\n\n# for k in range(n):\n\n# for i in range(n):\n\n# for j in range(n):\n\n# M[i][j] = min(M[i][j], M[i][k] + M[k][j])\n\n\n\nM = floyd_warshall(M)\n\n\n\nfor i in range(n):\n\n for j in range(n):\n\n M[i][j] = 1 if M[i][j] <= l else float(\"inf\")\n\n\n\nfor i in range(n):\n\n M[i][i] = 0\n\n\n\n# for k in range(n):\n\n# for i in range(n):\n\n# for j in range(n):\n\n# M[i][j] = min(M[i][j], M[i][k] + M[k][j])\n\n\n\nM = floyd_warshall(M)\n\n\n\nfor i in range(q):\n\n ans = M[S[i][0]][S[i][1]]-1\n\n if ans == float(\"inf\"):\n\n ans = -1\n\n print((int(ans)))","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nn,m,l = list(map(int,input().split()))\n\nA = [list(map(int,input().split())) for i in range(m)]\n\nq = int(eval(input()))\n\nS = [list(map(int,input().split())) for i in range(q)]\n\n\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\nfor i in range(m): # \u30ce\u30fc\u30c9\u756a\u53f7\u304c1\u59cb\u307e\u308a\u3067\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u5834\u5408\n\n for j in range(2):\n\n A[i][j] -= 1\n\n\n\nfor i in range(q): # \u30ce\u30fc\u30c9\u756a\u53f7\u304c1\u59cb\u307e\u308a\u3067\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u5834\u5408\n\n for j in range(2):\n\n S[i][j] -= 1\n\n\n\nM = [[float(\"inf\")] * n for i in range(n)]\n\n\n\nfor i in range(n):\n\n M[i][i] = 0\n\n\n\nfor i in range(m):\n\n M[A[i][0]][A[i][1]] = A[i][2]\n\n M[A[i][1]][A[i][0]] = A[i][2]\n\n\n\n# for k in range(n):\n\n# for i in range(n):\n\n# for j in range(n):\n\n# M[i][j] = min(M[i][j], M[i][k] + M[k][j])\n\n\n\nM = floyd_warshall(M)\n\n\n\nfor i in range(n):\n\n for j in range(n):\n\n M[i][j] = 1 if M[i][j] <= l else float(\"inf\")\n\n\n\nfor i in range(n):\n\n M[i][i] = 0\n\n\n\n# for k in range(n):\n\n# for i in range(n):\n\n# for j in range(n):\n\n# M[i][j] = min(M[i][j], M[i][k] + M[k][j])\n\n\n\nM = floyd_warshall(M)\n\n\n\nfor i in range(q):\n\n ans = M[S[i][0]][S[i][1]]-1\n\n if ans == float(\"inf\"):\n\n ans = -1\n\n print((int(ans)))","code_v0_loc":50,"code_v1_loc":53,"code_v0_num_chars":1161,"code_v1_num_chars":1203,"code_v0_no_empty_lines":"n, m, l = list(map(int, input().split()))\nA = [list(map(int, input().split())) for i in range(m)]\nq = int(eval(input()))\nS = [list(map(int, input().split())) for i in range(q)]\nfrom scipy.sparse.csgraph import floyd_warshall\n\nfor i in range(m): # \u30ce\u30fc\u30c9\u756a\u53f7\u304c1\u59cb\u307e\u308a\u3067\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u5834\u5408\n for j in range(2):\n A[i][j] -= 1\nfor i in range(q): # \u30ce\u30fc\u30c9\u756a\u53f7\u304c1\u59cb\u307e\u308a\u3067\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u5834\u5408\n for j in range(2):\n S[i][j] -= 1\nM = [[float(\"inf\")] * n for i in range(n)]\nfor i in range(n):\n M[i][i] = 0\nfor i in range(m):\n M[A[i][0]][A[i][1]] = A[i][2]\n M[A[i][1]][A[i][0]] = A[i][2]\n# for k in range(n):\n# for i in range(n):\n# for j in range(n):\n# M[i][j] = min(M[i][j], M[i][k] + M[k][j])\nM = floyd_warshall(M)\nfor i in range(n):\n for j in range(n):\n M[i][j] = 1 if M[i][j] <= l else float(\"inf\")\nfor i in range(n):\n M[i][i] = 0\n# for k in range(n):\n# for i in range(n):\n# for j in range(n):\n# M[i][j] = min(M[i][j], M[i][k] + M[k][j])\nM = floyd_warshall(M)\nfor i in range(q):\n ans = M[S[i][0]][S[i][1]] - 1\n if ans == float(\"inf\"):\n ans = -1\n print((int(ans)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, m, l = list(map(int, input().split()))\nA = [list(map(int, input().split())) for i in range(m)]\nq = int(eval(input()))\nS = [list(map(int, input().split())) for i in range(q)]\nfrom scipy.sparse.csgraph import floyd_warshall\n\nfor i in range(m): # \u30ce\u30fc\u30c9\u756a\u53f7\u304c1\u59cb\u307e\u308a\u3067\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u5834\u5408\n for j in range(2):\n A[i][j] -= 1\nfor i in range(q): # \u30ce\u30fc\u30c9\u756a\u53f7\u304c1\u59cb\u307e\u308a\u3067\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u5834\u5408\n for j in range(2):\n S[i][j] -= 1\nM = [[float(\"inf\")] * n for i in range(n)]\nfor i in range(n):\n M[i][i] = 0\nfor i in range(m):\n M[A[i][0]][A[i][1]] = A[i][2]\n M[A[i][1]][A[i][0]] = A[i][2]\n# for k in range(n):\n# for i in range(n):\n# for j in range(n):\n# M[i][j] = min(M[i][j], M[i][k] + M[k][j])\nM = floyd_warshall(M)\nfor i in range(n):\n for j in range(n):\n M[i][j] = 1 if M[i][j] <= l else float(\"inf\")\nfor i in range(n):\n M[i][i] = 0\n# for k in range(n):\n# for i in range(n):\n# for j in range(n):\n# M[i][j] = min(M[i][j], M[i][k] + M[k][j])\nM = floyd_warshall(M)\nfor i in range(q):\n ans = M[S[i][0]][S[i][1]] - 1\n if ans == float(\"inf\"):\n ans = -1\n print((int(ans)))\n","code_same":false,"relative_loc_diff_percent":5.6603773585,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.4043256834,"measured_runtime_v1":0.7465472934,"runtime_lift":0.5415941989,"key":["s214671182","s608653449"]} +{"user_id":"u764600134","problem_id":"p03078","language":"python","submission_id_v0":"s332416521","submission_id_v1":"s201243148","cpu_time_v0":1463,"cpu_time_v1":879,"memory_v0":143200,"memory_v1":9564,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.92,"input":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nD - Cake 123\n\nhttps:\/\/atcoder.jp\/contests\/abc123\/tasks\/abc123_d\n\n\n\n\"\"\"\n\nimport sys\n\n\n\n\n\nfrom itertools import product\n\n\n\ndef solve(X, Y, Z, K, A, B, C):\n\n # TLE\n\n res_AB = sorted([sum(p) for p in product(A, B)], reverse=True)[:K]\n\n return sorted([sum(p) for p in product(res_AB, C)], reverse=True)[:K]\n\n\n\n\n\ndef main(args):\n\n X, Y, Z, K = map(int, input().split())\n\n A = [int(a) for a in input().split()]\n\n B = [int(b) for b in input().split()]\n\n C = [int(c) for c in input().split()]\n\n ans = solve(X, Y, Z, K, A, B, C)\n\n print(*ans, sep='\\n')\n\n\n\n\n\nif __name__ == '__main__':\n\n main(sys.argv[1:])\n","target":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nD - Cake 123\n\nhttps:\/\/atcoder.jp\/contests\/abc123\/tasks\/abc123_d\n\nAC\n\n\"\"\"\n\nimport sys\n\n\n\n\n\nfrom itertools import product\n\n\n\ndef solve(X, Y, Z, K, A, B, C):\n\n # \u89e3\u8aac\u306e\u89e3\u6cd5#2\n\n A.sort(reverse=True)\n\n B.sort(reverse=True)\n\n C.sort(reverse=True)\n\n res = []\n\n for i, a in enumerate(A, start=1):\n\n for j, b in enumerate(B, start=1):\n\n for k, c in enumerate(C, start=1):\n\n if i*j*k > K:\n\n break\n\n res.append(a+b+c)\n\n return sorted(res, reverse=True)[:K]\n\n\n\n\n\ndef main(args):\n\n X, Y, Z, K = map(int, input().split())\n\n A = [int(a) for a in input().split()]\n\n B = [int(b) for b in input().split()]\n\n C = [int(c) for c in input().split()]\n\n ans = solve(X, Y, Z, K, A, B, C)\n\n print(*ans, sep='\\n')\n\n\n\n\n\nif __name__ == '__main__':\n\n main(sys.argv[1:])\n","code_v0_loc":28,"code_v1_loc":37,"code_v0_num_chars":656,"code_v1_num_chars":874,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nD - Cake 123\nhttps:\/\/atcoder.jp\/contests\/abc123\/tasks\/abc123_d\n\"\"\"\nimport sys\nfrom itertools import product\n\n\ndef solve(X, Y, Z, K, A, B, C):\n # TLE\n res_AB = sorted([sum(p) for p in product(A, B)], reverse=True)[:K]\n return sorted([sum(p) for p in product(res_AB, C)], reverse=True)[:K]\n\n\ndef main(args):\n X, Y, Z, K = map(int, input().split())\n A = [int(a) for a in input().split()]\n B = [int(b) for b in input().split()]\n C = [int(c) for c in input().split()]\n ans = solve(X, Y, Z, K, A, B, C)\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main(sys.argv[1:])\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nD - Cake 123\nhttps:\/\/atcoder.jp\/contests\/abc123\/tasks\/abc123_d\nAC\n\"\"\"\nimport sys\nfrom itertools import product\n\n\ndef solve(X, Y, Z, K, A, B, C):\n # \u89e3\u8aac\u306e\u89e3\u6cd5#2\n A.sort(reverse=True)\n B.sort(reverse=True)\n C.sort(reverse=True)\n res = []\n for i, a in enumerate(A, start=1):\n for j, b in enumerate(B, start=1):\n for k, c in enumerate(C, start=1):\n if i * j * k > K:\n break\n res.append(a + b + c)\n return sorted(res, reverse=True)[:K]\n\n\ndef main(args):\n X, Y, Z, K = map(int, input().split())\n A = [int(a) for a in input().split()]\n B = [int(b) for b in input().split()]\n C = [int(c) for c in input().split()]\n ans = solve(X, Y, Z, K, A, B, C)\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main(sys.argv[1:])\n","code_same":false,"relative_loc_diff_percent":24.3243243243,"diff":["+AC","- # TLE","- res_AB = sorted([sum(p) for p in product(A, B)], reverse=True)[:K]","- return sorted([sum(p) for p in product(res_AB, C)], reverse=True)[:K]","+ # \u89e3\u8aac\u306e\u89e3\u6cd5#2","+ A.sort(reverse=True)","+ B.sort(reverse=True)","+ C.sort(reverse=True)","+ res = []","+ for i, a in enumerate(A, start=1):","+ for j, b in enumerate(B, start=1):","+ for k, c in enumerate(C, start=1):","+ if i * j * k > K:","+ break","+ res.append(a + b + c)","+ return sorted(res, reverse=True)[:K]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0447428637,"measured_runtime_v1":0.0526881952,"runtime_lift":0.8492009159,"key":["s332416521","s201243148"]} +{"user_id":"u377989038","problem_id":"p03339","language":"python","submission_id_v0":"s917120695","submission_id_v1":"s718293711","cpu_time_v0":312,"cpu_time_v1":267,"memory_v0":19988,"memory_v1":17644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.42,"input":"n = int(eval(input()))\n\ns = eval(input())\n\nw = [0] + []\n\ne = [] + [0]\n\nw_cnt = 0\n\ne_cnt = 0\n\nfor i in range(n):\n\n if s[i] == \"W\":\n\n w_cnt += 1\n\n if s[n - i - 1] == \"E\":\n\n e_cnt += 1\n\n w.append(w_cnt)\n\n e.append(e_cnt)\n\ne = e[::-1]\n\nans = 10 ** 9\n\nfor i in range(n):\n\n ans = min(ans, w[i]+e[i+1])\n\nprint(ans)\n","target":"n = int(eval(input()))\n\ns = eval(input())\n\n\n\nw = [0]\n\ne = [0]\n\nw_cnt = 0\n\ne_cnt = 0\n\nfor i in range(n):\n\n if s[i] == \"W\":\n\n w_cnt += 1\n\n else:\n\n e_cnt += 1\n\n w.append(w_cnt)\n\n e.append(e_cnt)\n\n\n\nans = 10 ** 9\n\nfor i in range(n):\n\n ans = min(ans, w[i]+(e[-1] - e[i+1]))\n\nprint(ans)","code_v0_loc":18,"code_v1_loc":19,"code_v0_num_chars":325,"code_v1_num_chars":297,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\nw = [0] + []\ne = [] + [0]\nw_cnt = 0\ne_cnt = 0\nfor i in range(n):\n if s[i] == \"W\":\n w_cnt += 1\n if s[n - i - 1] == \"E\":\n e_cnt += 1\n w.append(w_cnt)\n e.append(e_cnt)\ne = e[::-1]\nans = 10**9\nfor i in range(n):\n ans = min(ans, w[i] + e[i + 1])\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\nw = [0]\ne = [0]\nw_cnt = 0\ne_cnt = 0\nfor i in range(n):\n if s[i] == \"W\":\n w_cnt += 1\n else:\n e_cnt += 1\n w.append(w_cnt)\n e.append(e_cnt)\nans = 10**9\nfor i in range(n):\n ans = min(ans, w[i] + (e[-1] - e[i + 1]))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-w = [0] + []","-e = [] + [0]","+w = [0]","+e = [0]","- if s[n - i - 1] == \"E\":","+ else:","-e = e[::-1]","- ans = min(ans, w[i] + e[i + 1])","+ ans = min(ans, w[i] + (e[-1] - e[i + 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.048126173,"measured_runtime_v1":0.1420284271,"runtime_lift":0.3388488769,"key":["s917120695","s718293711"]} +{"user_id":"u361826811","problem_id":"p03502","language":"python","submission_id_v0":"s657311536","submission_id_v1":"s331566323","cpu_time_v0":150,"cpu_time_v1":17,"memory_v0":12472,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.67,"input":"\"\"\"\n\nauthor : halo2halo\n\ndate : 29, Jan, 2020\n\n\"\"\"\n\n\n\nimport sys\n\n\n\n# import itertools\n\nimport numpy as np\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\n\n\ndef Hershad(n):\n\n if n == 0:\n\n return 0\n\n return n % 10 + Hershad(n \/\/ 10)\n\n\n\n\n\nN = int(readline())\n\nprint(('Yes' if N % Hershad(N) == 0 else 'No'))\n","target":"\"\"\"\n\nauthor : halo2halo\n\ndate : 29, Jan, 2020\n\n\"\"\"\n\n\n\nimport sys\n\n\n\n# import itertools\n\n# import numpy as np\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\n\n\ndef Hershad(n):\n\n if n == 0:\n\n return 0\n\n return n % 10 + Hershad(n \/\/ 10)\n\n\n\n\n\nN = int(readline())\n\nprint(('Yes' if N % Hershad(N) == 0 else 'No'))\n","code_v0_loc":24,"code_v1_loc":24,"code_v0_num_chars":414,"code_v1_num_chars":416,"code_v0_no_empty_lines":"\"\"\"\nauthor : halo2halo\ndate : 29, Jan, 2020\n\"\"\"\nimport sys\n\n# import itertools\nimport numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**7)\n\n\ndef Hershad(n):\n if n == 0:\n return 0\n return n % 10 + Hershad(n \/\/ 10)\n\n\nN = int(readline())\nprint((\"Yes\" if N % Hershad(N) == 0 else \"No\"))\n","code_v1_no_empty_lines":"\"\"\"\nauthor : halo2halo\ndate : 29, Jan, 2020\n\"\"\"\nimport sys\n\n# import itertools\n# import numpy as np\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**7)\n\n\ndef Hershad(n):\n if n == 0:\n return 0\n return n % 10 + Hershad(n \/\/ 10)\n\n\nN = int(readline())\nprint((\"Yes\" if N % Hershad(N) == 0 else \"No\"))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","-","+# import numpy as np"],"diff_only_import_comment":false,"measured_runtime_v0":0.0622256532,"measured_runtime_v1":0.0350635028,"runtime_lift":1.7746559301,"key":["s657311536","s331566323"]} +{"user_id":"u877415670","problem_id":"p03212","language":"python","submission_id_v0":"s724500593","submission_id_v1":"s197880107","cpu_time_v0":143,"cpu_time_v1":58,"memory_v0":7028,"memory_v1":10192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.44,"input":"import itertools\n\n\n\nn=eval(input())\n\n\n\nc=[]\n\nfor i in range(3,len(n)+1):\n\n c += list(itertools.product([3,5,7], repeat=i))\n\n\n\nm=int(n)\n\nans=0\n\nfor i in range(len(c)):\n\n if 3 in c[i] and 5 in c[i] and 7 in c[i]:\n\n search=\"\"\n\n for g in range(len(c[i])):\n\n search+=str(c[i][g])\n\n if m>=int(search):\n\n ans+=1\n\nprint(ans)\n","target":"import bisect\n\ndef dfs(cnt, s, three, five, seven):\n\n if cnt == 10:\n\n return\n\n if s != \"\" and min(three, five, seven) > 0:\n\n v.append(int(s))\n\n dfs(cnt+1, \"3\"+s, three+1, five, seven)\n\n dfs(cnt+1, \"5\"+s, three, five+1, seven)\n\n dfs(cnt+1, \"7\"+s, three, five, seven+1)\n\n\n\n\n\nv = []\n\ndfs(0, \"\", 0, 0, 0)\n\nv.sort()\n\n\n\nn = int(eval(input()))\n\nprint((bisect.bisect_right(v, n)))","code_v0_loc":18,"code_v1_loc":17,"code_v0_num_chars":360,"code_v1_num_chars":393,"code_v0_no_empty_lines":"import itertools\n\nn = eval(input())\nc = []\nfor i in range(3, len(n) + 1):\n c += list(itertools.product([3, 5, 7], repeat=i))\nm = int(n)\nans = 0\nfor i in range(len(c)):\n if 3 in c[i] and 5 in c[i] and 7 in c[i]:\n search = \"\"\n for g in range(len(c[i])):\n search += str(c[i][g])\n if m >= int(search):\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"import bisect\n\n\ndef dfs(cnt, s, three, five, seven):\n if cnt == 10:\n return\n if s != \"\" and min(three, five, seven) > 0:\n v.append(int(s))\n dfs(cnt + 1, \"3\" + s, three + 1, five, seven)\n dfs(cnt + 1, \"5\" + s, three, five + 1, seven)\n dfs(cnt + 1, \"7\" + s, three, five, seven + 1)\n\n\nv = []\ndfs(0, \"\", 0, 0, 0)\nv.sort()\nn = int(eval(input()))\nprint((bisect.bisect_right(v, n)))\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["-import itertools","+import bisect","-n = eval(input())","-c = []","-for i in range(3, len(n) + 1):","- c += list(itertools.product([3, 5, 7], repeat=i))","-m = int(n)","-ans = 0","-for i in range(len(c)):","- if 3 in c[i] and 5 in c[i] and 7 in c[i]:","- search = \"\"","- for g in range(len(c[i])):","- search += str(c[i][g])","- if m >= int(search):","- ans += 1","-print(ans)","+","+def dfs(cnt, s, three, five, seven):","+ if cnt == 10:","+ return","+ if s != \"\" and min(three, five, seven) > 0:","+ v.append(int(s))","+ dfs(cnt + 1, \"3\" + s, three + 1, five, seven)","+ dfs(cnt + 1, \"5\" + s, three, five + 1, seven)","+ dfs(cnt + 1, \"7\" + s, three, five, seven + 1)","+","+","+v = []","+dfs(0, \"\", 0, 0, 0)","+v.sort()","+n = int(eval(input()))","+print((bisect.bisect_right(v, n)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.130489078,"measured_runtime_v1":0.1113429222,"runtime_lift":1.1719566493,"key":["s724500593","s197880107"]} +{"user_id":"u102126195","problem_id":"p02722","language":"python","submission_id_v0":"s453162682","submission_id_v1":"s932203532","cpu_time_v0":232,"cpu_time_v1":194,"memory_v0":40428,"memory_v1":39152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.38,"input":"def make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n \/\/ i:\n\n divisors.append(n\/\/i)\n\n\n\n # divisors.sort()\n\n return divisors\n\n\n\nn = int(eval(input()))\n\ni = 2\n\ncnt = 1\n\ncheck = 0\n\n\n\n# for i in range(2, n + 1):\n\n# m = n\n\n# while m % i == 0:\n\n# m \/\/= i\n\n# m %= i\n\n# if m == 1:\n\n# print(i)\n\n# cnt += 1\n\n# print(cnt)\n\n# print()\n\n# print()\n\n\n\nout = [n]\n\nwhile i < n: #\u5272\u3063\u3066\u3072\u304f\n\n m = n\n\n if i - m \/ i > 2:\n\n break\n\n while m % i == 0:\n\n check = 1\n\n m \/\/= i\n\n\n\n if (m % i == 1 and check):\n\n out.append(i)\n\n cnt += 1\n\n i += 1\n\n\n\ni = 2\n\nwhile i * i <= n: #\u5272\u3063\u3066\u3072\u304f\n\n m = n\n\n while m % i == 0:\n\n m \/\/= i\n\n if m == 1:\n\n out.append(i)\n\n i += 1\n\n\n\nout += make_divisors(n - 1)\n\nprint((len(set(out)) - 1))","target":"def make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n \/\/ i:\n\n divisors.append(n\/\/i)\n\n\n\n # divisors.sort()\n\n return divisors\n\n\n\nn = int(eval(input()))\n\nout = make_divisors(n)\n\nans = []\n\nfor i in out:\n\n if i == 1:\n\n continue\n\n m = n\n\n while m % i == 0:\n\n m \/\/= i\n\n if m == 1 or m % i == 1:\n\n ans.append(i)\n\nans += make_divisors(n - 1)\n\n# print(set(out))\n\nprint((len(set(ans)) - 1))","code_v0_loc":53,"code_v1_loc":25,"code_v0_num_chars":915,"code_v1_num_chars":530,"code_v0_no_empty_lines":"def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n \/\/ i:\n divisors.append(n \/\/ i)\n # divisors.sort()\n return divisors\n\n\nn = int(eval(input()))\ni = 2\ncnt = 1\ncheck = 0\n# for i in range(2, n + 1):\n# m = n\n# while m % i == 0:\n# m \/\/= i\n# m %= i\n# if m == 1:\n# print(i)\n# cnt += 1\n# print(cnt)\n# print()\n# print()\nout = [n]\nwhile i < n: # \u5272\u3063\u3066\u3072\u304f\n m = n\n if i - m \/ i > 2:\n break\n while m % i == 0:\n check = 1\n m \/\/= i\n if m % i == 1 and check:\n out.append(i)\n cnt += 1\n i += 1\ni = 2\nwhile i * i <= n: # \u5272\u3063\u3066\u3072\u304f\n m = n\n while m % i == 0:\n m \/\/= i\n if m == 1:\n out.append(i)\n i += 1\nout += make_divisors(n - 1)\nprint((len(set(out)) - 1))\n","code_v1_no_empty_lines":"def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n \/\/ i:\n divisors.append(n \/\/ i)\n # divisors.sort()\n return divisors\n\n\nn = int(eval(input()))\nout = make_divisors(n)\nans = []\nfor i in out:\n if i == 1:\n continue\n m = n\n while m % i == 0:\n m \/\/= i\n if m == 1 or m % i == 1:\n ans.append(i)\nans += make_divisors(n - 1)\n# print(set(out))\nprint((len(set(ans)) - 1))\n","code_same":false,"relative_loc_diff_percent":52.8301886792,"diff":["-i = 2","-cnt = 1","-check = 0","-# for i in range(2, n + 1):","-# m = n","-# while m % i == 0:","-# m \/\/= i","-# m %= i","-# if m == 1:","-# print(i)","-# cnt += 1","-# print(cnt)","-# print()","-# print()","-out = [n]","-while i < n: # \u5272\u3063\u3066\u3072\u304f","- m = n","- if i - m \/ i > 2:","- break","- while m % i == 0:","- check = 1","- m \/\/= i","- if m % i == 1 and check:","- out.append(i)","- cnt += 1","- i += 1","-i = 2","-while i * i <= n: # \u5272\u3063\u3066\u3072\u304f","+out = make_divisors(n)","+ans = []","+for i in out:","+ if i == 1:","+ continue","- if m == 1:","- out.append(i)","- i += 1","-out += make_divisors(n - 1)","-print((len(set(out)) - 1))","+ if m == 1 or m % i == 1:","+ ans.append(i)","+ans += make_divisors(n - 1)","+# print(set(out))","+print((len(set(ans)) - 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.115550658,"measured_runtime_v1":0.0534025784,"runtime_lift":2.1637655246,"key":["s453162682","s932203532"]} +{"user_id":"u010777300","problem_id":"p03407","language":"python","submission_id_v0":"s187461592","submission_id_v1":"s760875404","cpu_time_v0":33,"cpu_time_v1":23,"memory_v0":9080,"memory_v1":8888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.3,"input":"a, b, c = list(map(int, input().split()))\n\nif a + b < c:\n\n print(\"No\")\n\nelse:\n\n print(\"Yes\")\n","target":"a, b, c = list(map(int, input().split()))\n\nprint((\"No\" if a + b < c else \"Yes\"))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":89,"code_v1_num_chars":72,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nif a + b < c:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nprint((\"No\" if a + b < c else \"Yes\"))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-if a + b < c:","- print(\"No\")","-else:","- print(\"Yes\")","+print((\"No\" if a + b < c else \"Yes\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1919669597,"measured_runtime_v1":0.1843230736,"runtime_lift":1.0414700446,"key":["s187461592","s760875404"]} +{"user_id":"u814781830","problem_id":"p03164","language":"python","submission_id_v0":"s342573664","submission_id_v1":"s574201230","cpu_time_v0":574,"cpu_time_v1":279,"memory_v0":171780,"memory_v1":45040,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.39,"input":"N, W = list(map(int, input().split()))\n\n\n\nMAX_V = N * (10 ** 3)\n\nw, v = [], []\n\nfor _ in range(N):\n\n a, b = list(map(int, input().split()))\n\n w.append(a)\n\n v.append(b)\n\n\n\ndp = [[10**9+7 for _ in range(MAX_V + 1)] for _ in range(N + 1)]\n\ndp[0][0] = 0\n\n\n\nfor i in range(N):\n\n for j in range(MAX_V + 1):\n\n if j - v[i] >= 0:\n\n dp[i + 1][j] = min(dp[i][j],dp[i][j - v[i]] + w[i])\n\n else:\n\n dp[i + 1][j] = dp[i][j]\n\n\n\nmv = 0\n\nfor i in range(MAX_V + 1):\n\n if dp[N][i] <= W:\n\n mv = i\n\nprint(mv)\n","target":"N, W = list(map(int, input().split()))\n\n\n\nMAX_V = N * (10 ** 3)\n\nw, v = [], []\n\nfor _ in range(N):\n\n a, b = list(map(int, input().split()))\n\n w.append(a)\n\n v.append(b)\n\n\n\ndp = [10**9+7 for _ in range(MAX_V + 1)]\n\ndp[0] = 0\n\n\n\nfor i in range(N):\n\n for j in range(MAX_V, -1, -1):\n\n if j - v[i] >= 0:\n\n dp[j] = min(dp[j],dp[j - v[i]] + w[i])\n\n else:\n\n dp[j] = dp[j]\n\n\n\nmv = 0\n\nfor i in range(MAX_V + 1):\n\n if dp[i] <= W:\n\n mv = i\n\n\n\nprint(mv)\n","code_v0_loc":24,"code_v1_loc":25,"code_v0_num_chars":533,"code_v1_num_chars":486,"code_v0_no_empty_lines":"N, W = list(map(int, input().split()))\nMAX_V = N * (10**3)\nw, v = [], []\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n w.append(a)\n v.append(b)\ndp = [[10**9 + 7 for _ in range(MAX_V + 1)] for _ in range(N + 1)]\ndp[0][0] = 0\nfor i in range(N):\n for j in range(MAX_V + 1):\n if j - v[i] >= 0:\n dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])\n else:\n dp[i + 1][j] = dp[i][j]\nmv = 0\nfor i in range(MAX_V + 1):\n if dp[N][i] <= W:\n mv = i\nprint(mv)\n","code_v1_no_empty_lines":"N, W = list(map(int, input().split()))\nMAX_V = N * (10**3)\nw, v = [], []\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n w.append(a)\n v.append(b)\ndp = [10**9 + 7 for _ in range(MAX_V + 1)]\ndp[0] = 0\nfor i in range(N):\n for j in range(MAX_V, -1, -1):\n if j - v[i] >= 0:\n dp[j] = min(dp[j], dp[j - v[i]] + w[i])\n else:\n dp[j] = dp[j]\nmv = 0\nfor i in range(MAX_V + 1):\n if dp[i] <= W:\n mv = i\nprint(mv)\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["-dp = [[10**9 + 7 for _ in range(MAX_V + 1)] for _ in range(N + 1)]","-dp[0][0] = 0","+dp = [10**9 + 7 for _ in range(MAX_V + 1)]","+dp[0] = 0","- for j in range(MAX_V + 1):","+ for j in range(MAX_V, -1, -1):","- dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])","+ dp[j] = min(dp[j], dp[j - v[i]] + w[i])","- dp[i + 1][j] = dp[i][j]","+ dp[j] = dp[j]","- if dp[N][i] <= W:","+ if dp[i] <= W:"],"diff_only_import_comment":false,"measured_runtime_v0":0.062999568,"measured_runtime_v1":0.0521020379,"runtime_lift":1.209157463,"key":["s342573664","s574201230"]} +{"user_id":"u741397536","problem_id":"p02868","language":"python","submission_id_v0":"s279170202","submission_id_v1":"s613285078","cpu_time_v0":1820,"cpu_time_v1":1536,"memory_v0":123868,"memory_v1":105692,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.6,"input":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nN, M = list(map(int, input().split()))\n\nE = []\n\nfor i in range(M):\n\n L, R, C = list(map(int, input().split()))\n\n E.append([L-1, R-1, C])\n\n\n\nE = sorted(E, key=lambda X: X[1])\n\n\n\n# N_\u306fN\u4ee5\u4e0a\u306e2\u3079\u304d\u6570\n\nN_ = 2**(len(bin(N))-2)\n\nINF = 10**15 # 10**10 \n\nseg = [INF] * (2*N_-1)\n\n\n\n# k\u756a\u76ee(0index)\u3092a\u306b\u66f4\u65b0\n\ndef update(k, a):\n\n k += N_-1\n\n seg[k] = a\n\n\n\n while k > 0:\n\n k = (k-1)\/\/2\n\n seg[k] = min(seg[k*2+1], seg[k*2+2])\n\n\n\n# \u958b\u533a\u9593\uff01\uff01\uff01[a, b)\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\n\ndef query(a, b, k, l, r):\n\n if r <= a or b <= l:\n\n return INF\n\n if a <= l and r <= b:\n\n return seg[k]\n\n else:\n\n vl = query(a, b, k*2+1, l, (l+r)\/\/2)\n\n vr = query(a, b, k*2+2, (l+r)\/\/2, r)\n\n return min(vl, vr)\n\n\n\n\n\n\n\n# \u521d\u671f\u5316\n\nupdate(0, 0)\n\n\n\nfor i in range(M):\n\n new = query(E[i][0], E[i][1], 0, 0, N_) + E[i][2]\n\n if new < seg[E[i][1] + N_-1]:\n\n update(E[i][1], new)\n\n\n\nif seg[N-1+N_-1] == INF:\n\n print((-1))\n\nelse:\n\n print((seg[N-1+N_-1]))","target":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nN, M = list(map(int, input().split()))\n\nE = []\n\nfor i in range(M):\n\n L, R, C = list(map(int, input().split()))\n\n E.append([L-1, R-1, C])\n\n\n\nE = sorted(E)\n\n\n\n# N_\u306fN\u4ee5\u4e0a\u306e2\u3079\u304d\u6570\n\nN_ = 2**(len(bin(N))-2)\n\nINF = 10**15 # 10**10 \n\nseg = [INF] * (2*N_-1)\n\n\n\n# k\u756a\u76ee(0index)\u3092a\u306b\u66f4\u65b0\n\ndef update(k, a):\n\n k += N_-1\n\n seg[k] = a\n\n\n\n while k > 0:\n\n k = (k-1)\/\/2\n\n seg[k] = min(seg[k*2+1], seg[k*2+2])\n\n\n\n# \u958b\u533a\u9593\uff01\uff01\uff01[a, b)\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\n\ndef query(a, b, k, l, r):\n\n if r <= a or b <= l:\n\n return INF\n\n if a <= l and r <= b:\n\n return seg[k]\n\n else:\n\n vl = query(a, b, k*2+1, l, (l+r)\/\/2)\n\n vr = query(a, b, k*2+2, (l+r)\/\/2, r)\n\n return min(vl, vr)\n\n\n\n\n\n\n\n# \u521d\u671f\u5316\n\nupdate(0, 0)\n\n\n\nfor i in range(M):\n\n new = query(E[i][0], E[i][1], 0, 0, N_) + E[i][2]\n\n if new < seg[E[i][1] + N_-1]:\n\n update(E[i][1], new)\n\n\n\nif seg[N-1+N_-1] == INF:\n\n print((-1))\n\nelse:\n\n print((seg[N-1+N_-1]))","code_v0_loc":51,"code_v1_loc":51,"code_v0_num_chars":1016,"code_v1_num_chars":996,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nN, M = list(map(int, input().split()))\nE = []\nfor i in range(M):\n L, R, C = list(map(int, input().split()))\n E.append([L - 1, R - 1, C])\nE = sorted(E, key=lambda X: X[1])\n# N_\u306fN\u4ee5\u4e0a\u306e2\u3079\u304d\u6570\nN_ = 2 ** (len(bin(N)) - 2)\nINF = 10**15 # 10**10\nseg = [INF] * (2 * N_ - 1)\n# k\u756a\u76ee(0index)\u3092a\u306b\u66f4\u65b0\ndef update(k, a):\n k += N_ - 1\n seg[k] = a\n while k > 0:\n k = (k - 1) \/\/ 2\n seg[k] = min(seg[k * 2 + 1], seg[k * 2 + 2])\n\n\n# \u958b\u533a\u9593\uff01\uff01\uff01[a, b)\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\ndef query(a, b, k, l, r):\n if r <= a or b <= l:\n return INF\n if a <= l and r <= b:\n return seg[k]\n else:\n vl = query(a, b, k * 2 + 1, l, (l + r) \/\/ 2)\n vr = query(a, b, k * 2 + 2, (l + r) \/\/ 2, r)\n return min(vl, vr)\n\n\n# \u521d\u671f\u5316\nupdate(0, 0)\nfor i in range(M):\n new = query(E[i][0], E[i][1], 0, 0, N_) + E[i][2]\n if new < seg[E[i][1] + N_ - 1]:\n update(E[i][1], new)\nif seg[N - 1 + N_ - 1] == INF:\n print((-1))\nelse:\n print((seg[N - 1 + N_ - 1]))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nN, M = list(map(int, input().split()))\nE = []\nfor i in range(M):\n L, R, C = list(map(int, input().split()))\n E.append([L - 1, R - 1, C])\nE = sorted(E)\n# N_\u306fN\u4ee5\u4e0a\u306e2\u3079\u304d\u6570\nN_ = 2 ** (len(bin(N)) - 2)\nINF = 10**15 # 10**10\nseg = [INF] * (2 * N_ - 1)\n# k\u756a\u76ee(0index)\u3092a\u306b\u66f4\u65b0\ndef update(k, a):\n k += N_ - 1\n seg[k] = a\n while k > 0:\n k = (k - 1) \/\/ 2\n seg[k] = min(seg[k * 2 + 1], seg[k * 2 + 2])\n\n\n# \u958b\u533a\u9593\uff01\uff01\uff01[a, b)\u306e\u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\ndef query(a, b, k, l, r):\n if r <= a or b <= l:\n return INF\n if a <= l and r <= b:\n return seg[k]\n else:\n vl = query(a, b, k * 2 + 1, l, (l + r) \/\/ 2)\n vr = query(a, b, k * 2 + 2, (l + r) \/\/ 2, r)\n return min(vl, vr)\n\n\n# \u521d\u671f\u5316\nupdate(0, 0)\nfor i in range(M):\n new = query(E[i][0], E[i][1], 0, 0, N_) + E[i][2]\n if new < seg[E[i][1] + N_ - 1]:\n update(E[i][1], new)\nif seg[N - 1 + N_ - 1] == INF:\n print((-1))\nelse:\n print((seg[N - 1 + N_ - 1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-E = sorted(E, key=lambda X: X[1])","+E = sorted(E)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0754627221,"measured_runtime_v1":0.119416219,"runtime_lift":0.6319302578,"key":["s279170202","s613285078"]} +{"user_id":"u813534019","problem_id":"p00001","language":"python","submission_id_v0":"s841831490","submission_id_v1":"s987563043","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":6352,"memory_v1":6424,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"heights = sorted([int(eval(input())) for n in range(10)])\n\nfor idx in range(-1, -4, -1):\n\n print(heights[idx])","target":"l = sorted([eval(input()) for x in range(10)], reverse=True)\n\nfor h in l[:3]:\n\n print(h)","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":107,"code_v1_num_chars":85,"code_v0_no_empty_lines":"heights = sorted([int(eval(input())) for n in range(10)])\nfor idx in range(-1, -4, -1):\n print(heights[idx])\n","code_v1_no_empty_lines":"l = sorted([eval(input()) for x in range(10)], reverse=True)\nfor h in l[:3]:\n print(h)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-heights = sorted([int(eval(input())) for n in range(10)])","-for idx in range(-1, -4, -1):","- print(heights[idx])","+l = sorted([eval(input()) for x in range(10)], reverse=True)","+for h in l[:3]:","+ print(h)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0395540214,"measured_runtime_v1":0.0398699,"runtime_lift":0.9920772673,"key":["s841831490","s987563043"]} +{"user_id":"u657901243","problem_id":"p02681","language":"python","submission_id_v0":"s892736046","submission_id_v1":"s310138616","cpu_time_v0":24,"cpu_time_v1":22,"memory_v0":9024,"memory_v1":9020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.33,"input":"s = eval(input())\n\nt = input()[:-1]\n\nif s == t:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n","target":"S = eval(input())\n\nT = eval(input())\n\nif S == T[:-1]:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":84,"code_v1_num_chars":84,"code_v0_no_empty_lines":"s = eval(input())\nt = input()[:-1]\nif s == t:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"S = eval(input())\nT = eval(input())\nif S == T[:-1]:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-s = eval(input())","-t = input()[:-1]","-if s == t:","+S = eval(input())","+T = eval(input())","+if S == T[:-1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1040834949,"measured_runtime_v1":0.047274945,"runtime_lift":2.2016629492,"key":["s892736046","s310138616"]} +{"user_id":"u227082700","problem_id":"p03160","language":"python","submission_id_v0":"s823258211","submission_id_v1":"s150039769","cpu_time_v0":132,"cpu_time_v1":121,"memory_v0":13928,"memory_v1":13928,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.33,"input":"n,h=int(eval(input())),list(map(int,input().split()))\n\ndp=[0,abs(h[1]-h[0])]+[0]*(n-2)\n\nfor i in range(2,n):dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))\n\nprint((dp[n-1]))","target":"n,h=int(eval(input())),list(map(int,input().split()))\n\ndp=[0]*n\n\ndp[1]=abs(h[1]-h[0])\n\nfor i in range(2,n):dp[i]=min(dp[i-2]+abs(h[i-2]-h[i]),dp[i-1]+abs(h[i-1]-h[i]))\n\nprint((dp[n-1]))","code_v0_loc":4,"code_v1_loc":5,"code_v0_num_chars":178,"code_v1_num_chars":177,"code_v0_no_empty_lines":"n, h = int(eval(input())), list(map(int, input().split()))\ndp = [0, abs(h[1] - h[0])] + [0] * (n - 2)\nfor i in range(2, n):\n dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))\nprint((dp[n - 1]))\n","code_v1_no_empty_lines":"n, h = int(eval(input())), list(map(int, input().split()))\ndp = [0] * n\ndp[1] = abs(h[1] - h[0])\nfor i in range(2, n):\n dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]))\nprint((dp[n - 1]))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-dp = [0, abs(h[1] - h[0])] + [0] * (n - 2)","+dp = [0] * n","+dp[1] = abs(h[1] - h[0])","- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))","+ dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0360701041,"measured_runtime_v1":0.0353780508,"runtime_lift":1.0195616574,"key":["s823258211","s150039769"]} +{"user_id":"u943057856","problem_id":"p03037","language":"python","submission_id_v0":"s103101847","submission_id_v1":"s360867707","cpu_time_v0":376,"cpu_time_v1":330,"memory_v0":27328,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.23,"input":"n,m=list(map(int,input().split()))\n\nl=[list(map(int,input().split())) for _ in range(m)]\n\na=0\n\nz=10**5\n\nfor i in range(m):\n\n a=max(a,l[i][0])\n\n z=min(z,l[i][1])\n\nif a<=z:\n\n print((z-a+1))\n\nelse:\n\n print((0))","target":"n,m=list(map(int,input().split()))\n\na=1\n\nz=n\n\nfor _ in range(m):\n\n l,m=list(map(int,input().split()))\n\n a=max(a,l)\n\n z=min(z,m)\n\nprint((max(0,z-a+1))) ","code_v0_loc":11,"code_v1_loc":8,"code_v0_num_chars":209,"code_v1_num_chars":149,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nl = [list(map(int, input().split())) for _ in range(m)]\na = 0\nz = 10**5\nfor i in range(m):\n a = max(a, l[i][0])\n z = min(z, l[i][1])\nif a <= z:\n print((z - a + 1))\nelse:\n print((0))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\na = 1\nz = n\nfor _ in range(m):\n l, m = list(map(int, input().split()))\n a = max(a, l)\n z = min(z, m)\nprint((max(0, z - a + 1)))\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-l = [list(map(int, input().split())) for _ in range(m)]","-a = 0","-z = 10**5","-for i in range(m):","- a = max(a, l[i][0])","- z = min(z, l[i][1])","-if a <= z:","- print((z - a + 1))","-else:","- print((0))","+a = 1","+z = n","+for _ in range(m):","+ l, m = list(map(int, input().split()))","+ a = max(a, l)","+ z = min(z, m)","+print((max(0, z - a + 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0844450164,"measured_runtime_v1":0.0407491131,"runtime_lift":2.0723154438,"key":["s103101847","s360867707"]} +{"user_id":"u200887663","problem_id":"p02953","language":"python","submission_id_v0":"s881807675","submission_id_v1":"s746791941","cpu_time_v0":82,"cpu_time_v1":73,"memory_v0":14252,"memory_v1":20696,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.98,"input":"n=int(eval(input()))\n\n#n,p=map(int,input().split())\n\nhl=list(map(int,input().split()))\n\n#l=[list(map(int,input().split())) for i in range(n)]\n\n#\u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u7d50\u679c\u30922\u6b21\u5143\u914d\u5217\u306b\u3057\u3066\u8fd4\u3059\n\nmx=hl[0]\n\nans=\"Yes\"\n\nfor i in range(n):\n\n mx=max(mx,hl[i])\n\n if hl[i]>=mx-1:\n\n pass\n\n else:\n\n ans=\"No\"\n\n break\n\nprint(ans)\n","target":"n=int(eval(input()))\n\n#n,m=map(int,input().split())\n\n#t=int(input())\n\nhl=list(map(int,input().split()))\n\n#l=[list(map(int,input().split())) for i in range(n)]\n\n\n\nflag=\"Yes\"\n\n\n\nfor i in range(n-2,-1,-1):\n\n righth=hl[i+1]\n\n cur=hl[i]\n\n if cur<=righth:\n\n pass\n\n elif cur==righth+1:\n\n hl[i]=cur-1\n\n else:\n\n flag=\"No\"\n\n break\n\n\n\nprint(flag)\n\n\n\n\n","code_v0_loc":15,"code_v1_loc":22,"code_v0_num_chars":313,"code_v1_num_chars":377,"code_v0_no_empty_lines":"n = int(eval(input()))\n# n,p=map(int,input().split())\nhl = list(map(int, input().split()))\n# l=[list(map(int,input().split())) for i in range(n)]\n# \u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u7d50\u679c\u30922\u6b21\u5143\u914d\u5217\u306b\u3057\u3066\u8fd4\u3059\nmx = hl[0]\nans = \"Yes\"\nfor i in range(n):\n mx = max(mx, hl[i])\n if hl[i] >= mx - 1:\n pass\n else:\n ans = \"No\"\n break\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\n# n,m=map(int,input().split())\n# t=int(input())\nhl = list(map(int, input().split()))\n# l=[list(map(int,input().split())) for i in range(n)]\nflag = \"Yes\"\nfor i in range(n - 2, -1, -1):\n righth = hl[i + 1]\n cur = hl[i]\n if cur <= righth:\n pass\n elif cur == righth + 1:\n hl[i] = cur - 1\n else:\n flag = \"No\"\n break\nprint(flag)\n","code_same":false,"relative_loc_diff_percent":31.8181818182,"diff":["-# n,p=map(int,input().split())","+# n,m=map(int,input().split())","+# t=int(input())","-# \u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u7d50\u679c\u30922\u6b21\u5143\u914d\u5217\u306b\u3057\u3066\u8fd4\u3059","-mx = hl[0]","-ans = \"Yes\"","-for i in range(n):","- mx = max(mx, hl[i])","- if hl[i] >= mx - 1:","+flag = \"Yes\"","+for i in range(n - 2, -1, -1):","+ righth = hl[i + 1]","+ cur = hl[i]","+ if cur <= righth:","+ elif cur == righth + 1:","+ hl[i] = cur - 1","- ans = \"No\"","+ flag = \"No\"","-print(ans)","+print(flag)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0452715743,"measured_runtime_v1":0.1002835431,"runtime_lift":0.4514357276,"key":["s881807675","s746791941"]} +{"user_id":"u562935282","problem_id":"p03488","language":"python","submission_id_v0":"s609200129","submission_id_v1":"s585285912","cpu_time_v0":299,"cpu_time_v1":37,"memory_v0":47836,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.63,"input":"# https:\/\/ikatakos.com\/pot\/programming_algorithm\/contest_history\/atcoder\/2017\/1216_arc087\n\n# https:\/\/pitsbuffersolution.com\/compro\/atcoder\/arc087d.php\n\n\n\n# \u6700\u521d\u306e\u79fb\u52d5\u4ee5\u5916\u306f\u3001\u3069\u3093\u306a\u64cd\u4f5c\u624b\u9806\u5f8c\u3067\u3042\u3063\u3066\u3082\u3001\u6b63\u8ca0\u3044\u305a\u308c\u306e\u65b9\u5411\u306b\u3082\u52d5\u3051\u308b\u306e\u304c\u30df\u30bd\n\n\n\ndef solve(s, x, y):\n\n X = 0\n\n Y = 1\n\n\n\n def update(move):\n\n st = set()\n\n for p in reachable[st_ind]:\n\n st.add(p + move)\n\n st.add(abs(p - move))\n\n reachable[st_ind] = st\n\n # \u7d76\u5bfe\u5024\u306e\u7b49\u3057\u3044\u6b63\u8ca0\u306e\u5024\u3092\u53d6\u308a\u3046\u308b\u306e\u3067\u3001\u6b63\u3060\u3051\u6271\u3046\n\n\n\n n = len(s)\n\n spl = list(map(len, s.split('T')))\n\n x -= next(spl)\n\n # \u3053\u3053\u3067x\u3092\u6e1b\u3089\u3059\u3068\u3001\n\n # \u500b\u3005\u306emove\u5f8c\u306ex,y\u306f\u3001\u539f\u70b9\u5bfe\u8c61\u306b\u306a\u308b\u306e\u3067\u3001\u6b63\u306e\u5ea7\u6a19\u306e\u5230\u9054\u70b9\u3060\u3051\u6271\u3048\u3070\u3088\u304f\u306a\u308b\n\n\n\n reachable = [{0}, {0}]\n\n st_ind = 1\n\n for move in spl:\n\n update(move)\n\n st_ind ^= 1\n\n\n\n return (abs(x) in reachable[X]) and (abs(y) in reachable[Y])\n\n # x,y\u304c\u8ca0\u3067\u3042\u3063\u3066\u3082\u3001\u305d\u308c\u306b\u5bfe\u5fdc\u3057\u305f\u6b63\u306e\u5024\u304c\u96c6\u5408\u306b\u542b\u307e\u308c\u3066\u3044\u308c\u3070\u3001\u5230\u9054\u53ef\u80fd\n\n\n\n\n\nif __name__ == '__main__':\n\n s = eval(input())\n\n x, y = list(map(int, input().split()))\n\n print(('Yes' if solve(s, x, y) else 'No'))\n","target":"def main():\n\n SFT = 8000\n\n\n\n CMDs = list(map(len, input().split('T')))\n\n X, Y = list(map(int, input().split()))\n\n\n\n # [-SFT,SFT] -> [0,SFT*2]\n\n axis = 0\n\n curr = [1 << (next(CMDs) + SFT), 1 << SFT]\n\n for d in CMDs:\n\n axis ^= 1\n\n curr[axis] = (curr[axis] >> d) | (curr[axis] << d)\n\n\n\n cond = (curr[0] >> (SFT + X)) & 1 and (curr[1] >> (SFT + Y)) & 1\n\n print(('Yes' if cond else 'No'))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":37,"code_v1_loc":19,"code_v0_num_chars":953,"code_v1_num_chars":455,"code_v0_no_empty_lines":"# https:\/\/ikatakos.com\/pot\/programming_algorithm\/contest_history\/atcoder\/2017\/1216_arc087\n# https:\/\/pitsbuffersolution.com\/compro\/atcoder\/arc087d.php\n# \u6700\u521d\u306e\u79fb\u52d5\u4ee5\u5916\u306f\u3001\u3069\u3093\u306a\u64cd\u4f5c\u624b\u9806\u5f8c\u3067\u3042\u3063\u3066\u3082\u3001\u6b63\u8ca0\u3044\u305a\u308c\u306e\u65b9\u5411\u306b\u3082\u52d5\u3051\u308b\u306e\u304c\u30df\u30bd\ndef solve(s, x, y):\n X = 0\n Y = 1\n\n def update(move):\n st = set()\n for p in reachable[st_ind]:\n st.add(p + move)\n st.add(abs(p - move))\n reachable[st_ind] = st\n # \u7d76\u5bfe\u5024\u306e\u7b49\u3057\u3044\u6b63\u8ca0\u306e\u5024\u3092\u53d6\u308a\u3046\u308b\u306e\u3067\u3001\u6b63\u3060\u3051\u6271\u3046\n\n n = len(s)\n spl = list(map(len, s.split(\"T\")))\n x -= next(spl)\n # \u3053\u3053\u3067x\u3092\u6e1b\u3089\u3059\u3068\u3001\n # \u500b\u3005\u306emove\u5f8c\u306ex,y\u306f\u3001\u539f\u70b9\u5bfe\u8c61\u306b\u306a\u308b\u306e\u3067\u3001\u6b63\u306e\u5ea7\u6a19\u306e\u5230\u9054\u70b9\u3060\u3051\u6271\u3048\u3070\u3088\u304f\u306a\u308b\n reachable = [{0}, {0}]\n st_ind = 1\n for move in spl:\n update(move)\n st_ind ^= 1\n return (abs(x) in reachable[X]) and (abs(y) in reachable[Y])\n # x,y\u304c\u8ca0\u3067\u3042\u3063\u3066\u3082\u3001\u305d\u308c\u306b\u5bfe\u5fdc\u3057\u305f\u6b63\u306e\u5024\u304c\u96c6\u5408\u306b\u542b\u307e\u308c\u3066\u3044\u308c\u3070\u3001\u5230\u9054\u53ef\u80fd\n\n\nif __name__ == \"__main__\":\n s = eval(input())\n x, y = list(map(int, input().split()))\n print((\"Yes\" if solve(s, x, y) else \"No\"))\n","code_v1_no_empty_lines":"def main():\n SFT = 8000\n CMDs = list(map(len, input().split(\"T\")))\n X, Y = list(map(int, input().split()))\n # [-SFT,SFT] -> [0,SFT*2]\n axis = 0\n curr = [1 << (next(CMDs) + SFT), 1 << SFT]\n for d in CMDs:\n axis ^= 1\n curr[axis] = (curr[axis] >> d) | (curr[axis] << d)\n cond = (curr[0] >> (SFT + X)) & 1 and (curr[1] >> (SFT + Y)) & 1\n print((\"Yes\" if cond else \"No\"))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":48.6486486486,"diff":["-# https:\/\/ikatakos.com\/pot\/programming_algorithm\/contest_history\/atcoder\/2017\/1216_arc087","-# https:\/\/pitsbuffersolution.com\/compro\/atcoder\/arc087d.php","-# \u6700\u521d\u306e\u79fb\u52d5\u4ee5\u5916\u306f\u3001\u3069\u3093\u306a\u64cd\u4f5c\u624b\u9806\u5f8c\u3067\u3042\u3063\u3066\u3082\u3001\u6b63\u8ca0\u3044\u305a\u308c\u306e\u65b9\u5411\u306b\u3082\u52d5\u3051\u308b\u306e\u304c\u30df\u30bd","-def solve(s, x, y):","- X = 0","- Y = 1","-","- def update(move):","- st = set()","- for p in reachable[st_ind]:","- st.add(p + move)","- st.add(abs(p - move))","- reachable[st_ind] = st","- # \u7d76\u5bfe\u5024\u306e\u7b49\u3057\u3044\u6b63\u8ca0\u306e\u5024\u3092\u53d6\u308a\u3046\u308b\u306e\u3067\u3001\u6b63\u3060\u3051\u6271\u3046","-","- n = len(s)","- spl = list(map(len, s.split(\"T\")))","- x -= next(spl)","- # \u3053\u3053\u3067x\u3092\u6e1b\u3089\u3059\u3068\u3001","- # \u500b\u3005\u306emove\u5f8c\u306ex,y\u306f\u3001\u539f\u70b9\u5bfe\u8c61\u306b\u306a\u308b\u306e\u3067\u3001\u6b63\u306e\u5ea7\u6a19\u306e\u5230\u9054\u70b9\u3060\u3051\u6271\u3048\u3070\u3088\u304f\u306a\u308b","- reachable = [{0}, {0}]","- st_ind = 1","- for move in spl:","- update(move)","- st_ind ^= 1","- return (abs(x) in reachable[X]) and (abs(y) in reachable[Y])","- # x,y\u304c\u8ca0\u3067\u3042\u3063\u3066\u3082\u3001\u305d\u308c\u306b\u5bfe\u5fdc\u3057\u305f\u6b63\u306e\u5024\u304c\u96c6\u5408\u306b\u542b\u307e\u308c\u3066\u3044\u308c\u3070\u3001\u5230\u9054\u53ef\u80fd","+def main():","+ SFT = 8000","+ CMDs = list(map(len, input().split(\"T\")))","+ X, Y = list(map(int, input().split()))","+ # [-SFT,SFT] -> [0,SFT*2]","+ axis = 0","+ curr = [1 << (next(CMDs) + SFT), 1 << SFT]","+ for d in CMDs:","+ axis ^= 1","+ curr[axis] = (curr[axis] >> d) | (curr[axis] << d)","+ cond = (curr[0] >> (SFT + X)) & 1 and (curr[1] >> (SFT + Y)) & 1","+ print((\"Yes\" if cond else \"No\"))","- s = eval(input())","- x, y = list(map(int, input().split()))","- print((\"Yes\" if solve(s, x, y) else \"No\"))","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0829436779,"measured_runtime_v1":0.0464805603,"runtime_lift":1.7844810248,"key":["s609200129","s585285912"]} +{"user_id":"u687135117","problem_id":"p02783","language":"python","submission_id_v0":"s729805146","submission_id_v1":"s394637732","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"import collections\n\nimport itertools as it\n\nimport math\n\n#import numpy as np\n\n \n\n# = input()\n\n# = int(input())\n\nh, a = list(map(int, input().split()))\n\n# = list(map(int, input().split()))\n\n# = [int(input()) for i in range(N)]\n\n#\n\n# c = collections.Counter()\n\nif h%a==0:\n\n\tprint((int(h\/a)))\n\nelse:\n\n \tprint((h\/\/a+1))","target":"#import collections\n\n#import itertools as it\n\n#import math\n\n#import numpy as np\n\n#import sys \n\n#sys.exit()\n\n\n\n# = input()\n\n# = int(input())\n\nh, a = list(map(int, input().split()))\n\n'''\n\n# = list(map(int, input().split()))\n\n'''\n\n'''\n\nn = input()\n\na = [int(input()) for i in range(n)]\n\n'''\n\n'''\n\nn,m = map(int, input().split())\n\na = [list(map(int, input().split())) for _ in range(m)]\n\n'''\n\n# c = collections.Counter()\n\n#-------------------------------#\n\n\n\nif h%a==0:\n\n\tprint((int(h\/a)))\n\nelse:\n\n \tprint((h\/\/a+1))","code_v0_loc":16,"code_v1_loc":28,"code_v0_num_chars":311,"code_v1_num_chars":506,"code_v0_no_empty_lines":"import collections\nimport itertools as it\nimport math\n\n# import numpy as np\n# = input()\n# = int(input())\nh, a = list(map(int, input().split()))\n# = list(map(int, input().split()))\n# = [int(input()) for i in range(N)]\n#\n# c = collections.Counter()\nif h % a == 0:\n print((int(h \/ a)))\nelse:\n print((h \/\/ a + 1))\n","code_v1_no_empty_lines":"# import collections\n# import itertools as it\n# import math\n# import numpy as np\n# import sys\n# sys.exit()\n# = input()\n# = int(input())\nh, a = list(map(int, input().split()))\n\"\"\"\n# = list(map(int, input().split()))\n\"\"\"\n\"\"\"\nn = input()\na = [int(input()) for i in range(n)]\n\"\"\"\n\"\"\"\nn,m = map(int, input().split())\na = [list(map(int, input().split())) for _ in range(m)]\n\"\"\"\n# c = collections.Counter()\n# -------------------------------#\nif h % a == 0:\n print((int(h \/ a)))\nelse:\n print((h \/\/ a + 1))\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-import collections","-import itertools as it","-import math","-","+# import collections","+# import itertools as it","+# import math","+# import sys","+# sys.exit()","+\"\"\"","-# = [int(input()) for i in range(N)]","-#","+\"\"\"","+\"\"\"","+n = input()","+a = [int(input()) for i in range(n)]","+\"\"\"","+\"\"\"","+n,m = map(int, input().split())","+a = [list(map(int, input().split())) for _ in range(m)]","+\"\"\""],"diff_only_import_comment":false,"measured_runtime_v0":0.1103423336,"measured_runtime_v1":0.0607000239,"runtime_lift":1.8178301501,"key":["s729805146","s394637732"]} +{"user_id":"u254871849","problem_id":"p03290","language":"python","submission_id_v0":"s040068495","submission_id_v1":"s174609219","cpu_time_v0":189,"cpu_time_v1":19,"memory_v0":14548,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.95,"input":"import sys\n\nimport numpy as np\n\n\n\nI = np.array(sys.stdin.read().split(), dtype=np.int64)\n\nn, G = I[:2]\n\nG \/\/= 100\n\np, c = I[2:].reshape(-1, 2).T\n\nc \/\/= 100\n\n\n\ndef main():\n\n v = np.arange(1, n+1)\n\n t = v * p + c\n\n combs = np.arange(2 ** n - 1)[:, None] >> np.arange(n) & 1\n\n res = p.sum()\n\n for comb in combs:\n\n s = t[comb == 1].sum()\n\n cnt = p[comb == 1].sum()\n\n if s - G < 0:\n\n m = np.amax(v[comb == 0])\n\n tmp = (G - s + m - 1) \/\/ m\n\n if tmp < p[m-1]:\n\n cnt += tmp\n\n else:\n\n continue\n\n res = min(res, cnt)\n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","target":"import sys\n\n\n\nn, G = list(map(int, sys.stdin.readline().split()))\n\nG \/\/= 100\n\np = []\n\nt = []\n\nfor i in range(1, n+1):\n\n pi, ci = list(map(int, sys.stdin.readline().split()))\n\n p.append(pi)\n\n t.append(i * pi + ci \/\/ 100)\n\n\n\ndef main():\n\n res = sum(p)\n\n for i in range(2 ** n - 1):\n\n s = 0\n\n cnt = 0\n\n for j in range(n):\n\n if i >> j & 1:\n\n s += t[j]\n\n cnt += p[j]\n\n else:\n\n m = j + 1\n\n if s < G:\n\n tmp = (G - s + m - 1) \/\/ m\n\n if tmp < p[m-1]:\n\n cnt += tmp\n\n else:\n\n continue\n\n res = min(res, cnt)\n\n \n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":30,"code_v1_loc":35,"code_v0_num_chars":703,"code_v1_num_chars":749,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nI = np.array(sys.stdin.read().split(), dtype=np.int64)\nn, G = I[:2]\nG \/\/= 100\np, c = I[2:].reshape(-1, 2).T\nc \/\/= 100\n\n\ndef main():\n v = np.arange(1, n + 1)\n t = v * p + c\n combs = np.arange(2**n - 1)[:, None] >> np.arange(n) & 1\n res = p.sum()\n for comb in combs:\n s = t[comb == 1].sum()\n cnt = p[comb == 1].sum()\n if s - G < 0:\n m = np.amax(v[comb == 0])\n tmp = (G - s + m - 1) \/\/ m\n if tmp < p[m - 1]:\n cnt += tmp\n else:\n continue\n res = min(res, cnt)\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_v1_no_empty_lines":"import sys\n\nn, G = list(map(int, sys.stdin.readline().split()))\nG \/\/= 100\np = []\nt = []\nfor i in range(1, n + 1):\n pi, ci = list(map(int, sys.stdin.readline().split()))\n p.append(pi)\n t.append(i * pi + ci \/\/ 100)\n\n\ndef main():\n res = sum(p)\n for i in range(2**n - 1):\n s = 0\n cnt = 0\n for j in range(n):\n if i >> j & 1:\n s += t[j]\n cnt += p[j]\n else:\n m = j + 1\n if s < G:\n tmp = (G - s + m - 1) \/\/ m\n if tmp < p[m - 1]:\n cnt += tmp\n else:\n continue\n res = min(res, cnt)\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-import numpy as np","-I = np.array(sys.stdin.read().split(), dtype=np.int64)","-n, G = I[:2]","+n, G = list(map(int, sys.stdin.readline().split()))","-p, c = I[2:].reshape(-1, 2).T","-c \/\/= 100","+p = []","+t = []","+for i in range(1, n + 1):","+ pi, ci = list(map(int, sys.stdin.readline().split()))","+ p.append(pi)","+ t.append(i * pi + ci \/\/ 100)","- v = np.arange(1, n + 1)","- t = v * p + c","- combs = np.arange(2**n - 1)[:, None] >> np.arange(n) & 1","- res = p.sum()","- for comb in combs:","- s = t[comb == 1].sum()","- cnt = p[comb == 1].sum()","- if s - G < 0:","- m = np.amax(v[comb == 0])","+ res = sum(p)","+ for i in range(2**n - 1):","+ s = 0","+ cnt = 0","+ for j in range(n):","+ if i >> j & 1:","+ s += t[j]","+ cnt += p[j]","+ else:","+ m = j + 1","+ if s < G:"],"diff_only_import_comment":false,"measured_runtime_v0":0.4405550196,"measured_runtime_v1":0.0357066803,"runtime_lift":12.3381679792,"key":["s040068495","s174609219"]} +{"user_id":"u606045429","problem_id":"p02796","language":"python","submission_id_v0":"s795062521","submission_id_v1":"s653930351","cpu_time_v0":209,"cpu_time_v1":185,"memory_v0":25876,"memory_v1":26084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.48,"input":"N, *XL = list(map(int, open(0).read().split()))\n\n\n\nA = sorted((x + l, x - l) for x, l in zip(*[iter(XL)] * 2))\n\n\n\nans = 0\n\ncur = -10 ** 9\n\nfor t, s in A:\n\n if cur <= s:\n\n cur = t\n\n ans += 1\n\n\n\nprint(ans)","target":"N, *XL = list(map(int, open(0).read().split()))\n\n\n\nA = sorted(((x + l, x - l) for x, l in zip(*[iter(XL)] * 2)), key=lambda x: x[0])\n\n\n\nans = 0\n\ncur = -10 ** 9\n\nfor t, s in A:\n\n if cur <= s:\n\n cur = t\n\n ans += 1\n\n\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":214,"code_v1_num_chars":236,"code_v0_no_empty_lines":"N, *XL = list(map(int, open(0).read().split()))\nA = sorted((x + l, x - l) for x, l in zip(*[iter(XL)] * 2))\nans = 0\ncur = -(10**9)\nfor t, s in A:\n if cur <= s:\n cur = t\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N, *XL = list(map(int, open(0).read().split()))\nA = sorted(((x + l, x - l) for x, l in zip(*[iter(XL)] * 2)), key=lambda x: x[0])\nans = 0\ncur = -(10**9)\nfor t, s in A:\n if cur <= s:\n cur = t\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-A = sorted((x + l, x - l) for x, l in zip(*[iter(XL)] * 2))","+A = sorted(((x + l, x - l) for x, l in zip(*[iter(XL)] * 2)), key=lambda x: x[0])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0417741153,"measured_runtime_v1":0.0330475798,"runtime_lift":1.2640597468,"key":["s795062521","s653930351"]} +{"user_id":"u279605379","problem_id":"p02297","language":"python","submission_id_v0":"s457861289","submission_id_v1":"s710130945","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7660,"memory_v1":7708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"n = int(eval(input()))\n\nP =[]\n\ns = 0\n\nfor i in range(n):P.append(input().split())\n\nP.append(P[0])\n\nfor i in range(n):s += int(P[i][0])*int(P[i+1][1]) - int(P[i][1])*int(P[i+1][0])\n\nprint((abs(s)*0.5))","target":"n = int(eval(input()))\n\nP =[]\n\ns = 0\n\nfor i in range(n):P.append([int(i) for i in input().split()])\n\nP.append(P[0])\n\nfor i in range(n):s += (P[i][0]*P[i+1][1] - P[i][1]*P[i+1][0])\n\nprint((abs(s)*0.5))","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":192,"code_v1_num_chars":192,"code_v0_no_empty_lines":"n = int(eval(input()))\nP = []\ns = 0\nfor i in range(n):\n P.append(input().split())\nP.append(P[0])\nfor i in range(n):\n s += int(P[i][0]) * int(P[i + 1][1]) - int(P[i][1]) * int(P[i + 1][0])\nprint((abs(s) * 0.5))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nP = []\ns = 0\nfor i in range(n):\n P.append([int(i) for i in input().split()])\nP.append(P[0])\nfor i in range(n):\n s += P[i][0] * P[i + 1][1] - P[i][1] * P[i + 1][0]\nprint((abs(s) * 0.5))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- P.append(input().split())","+ P.append([int(i) for i in input().split()])","- s += int(P[i][0]) * int(P[i + 1][1]) - int(P[i][1]) * int(P[i + 1][0])","+ s += P[i][0] * P[i + 1][1] - P[i][1] * P[i + 1][0]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0397337503,"measured_runtime_v1":0.0401091601,"runtime_lift":0.9906402984,"key":["s457861289","s710130945"]} +{"user_id":"u256351611","problem_id":"p02659","language":"python","submission_id_v0":"s190922974","submission_id_v1":"s104754354","cpu_time_v0":27,"cpu_time_v1":23,"memory_v0":10068,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.81,"input":"from decimal import Decimal\n\nimport math\n\n\n\na,b=list(map(str,input().split()))\n\na=int(a)\n\nb=Decimal(b)\n\nx = math.floor(a*b)\n\nprint((int(x)))","target":"a,b=list(map(str,input().split()))\n\na=int(a)\n\nb=int(float(b)*1000)\n\nprint((a*b\/\/1000))","code_v0_loc":8,"code_v1_loc":4,"code_v0_num_chars":132,"code_v1_num_chars":78,"code_v0_no_empty_lines":"from decimal import Decimal\nimport math\n\na, b = list(map(str, input().split()))\na = int(a)\nb = Decimal(b)\nx = math.floor(a * b)\nprint((int(x)))\n","code_v1_no_empty_lines":"a, b = list(map(str, input().split()))\na = int(a)\nb = int(float(b) * 1000)\nprint((a * b \/\/ 1000))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-from decimal import Decimal","-import math","-","-b = Decimal(b)","-x = math.floor(a * b)","-print((int(x)))","+b = int(float(b) * 1000)","+print((a * b \/\/ 1000))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0547065136,"measured_runtime_v1":0.0494600065,"runtime_lift":1.1060757475,"key":["s190922974","s104754354"]} +{"user_id":"u086503932","problem_id":"p03127","language":"python","submission_id_v0":"s885504699","submission_id_v1":"s806375678","cpu_time_v0":187,"cpu_time_v1":95,"memory_v0":14252,"memory_v1":16300,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.2,"input":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nwhile len(A) > 1:\n\n A.sort()\n\n #print(A)\n\n for i in range(1,len(A)):\n\n #print(A[i],A[0])\n\n A[i] = A[i] % A[0]\n\n A = list([x for x in A if x != 0])\n\n\n\nprint((A[0]))","target":"# GCD: greatest common divisor\n\nfrom fractions import gcd\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nans = gcd(A[0],A[1])\n\nfor i in range(1,N-1):\n\n ans = gcd(ans,A[i+1])\n\n \n\nprint(ans)","code_v0_loc":12,"code_v1_loc":10,"code_v0_num_chars":230,"code_v1_num_chars":201,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nwhile len(A) > 1:\n A.sort()\n # print(A)\n for i in range(1, len(A)):\n # print(A[i],A[0])\n A[i] = A[i] % A[0]\n A = list([x for x in A if x != 0])\nprint((A[0]))\n","code_v1_no_empty_lines":"# GCD: greatest common divisor\nfrom fractions import gcd\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nans = gcd(A[0], A[1])\nfor i in range(1, N - 1):\n ans = gcd(ans, A[i + 1])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["+# GCD: greatest common divisor","+from fractions import gcd","+","-while len(A) > 1:","- A.sort()","- # print(A)","- for i in range(1, len(A)):","- # print(A[i],A[0])","- A[i] = A[i] % A[0]","- A = list([x for x in A if x != 0])","-print((A[0]))","+ans = gcd(A[0], A[1])","+for i in range(1, N - 1):","+ ans = gcd(ans, A[i + 1])","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0508332729,"measured_runtime_v1":0.0413797357,"runtime_lift":1.2284581342,"key":["s885504699","s806375678"]} +{"user_id":"u737758066","problem_id":"p02835","language":"python","submission_id_v0":"s981608311","submission_id_v1":"s040280206","cpu_time_v0":185,"cpu_time_v1":166,"memory_v0":38384,"memory_v1":38256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.27,"input":"a = list(map(int, input().split()))\n\nif sum(a) >= 22:\n\n print('bust')\n\nelse:\n\n print('win')\n","target":"a1, a2, a3 = list(map(int, input().split()))\n\nif a1+a2+a3 >= 22:\n\n print('bust')\n\nelse:\n\n print('win')\n","code_v0_loc":5,"code_v1_loc":5,"code_v0_num_chars":98,"code_v1_num_chars":103,"code_v0_no_empty_lines":"a = list(map(int, input().split()))\nif sum(a) >= 22:\n print(\"bust\")\nelse:\n print(\"win\")\n","code_v1_no_empty_lines":"a1, a2, a3 = list(map(int, input().split()))\nif a1 + a2 + a3 >= 22:\n print(\"bust\")\nelse:\n print(\"win\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a = list(map(int, input().split()))","-if sum(a) >= 22:","+a1, a2, a3 = list(map(int, input().split()))","+if a1 + a2 + a3 >= 22:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1979864221,"measured_runtime_v1":0.126003975,"runtime_lift":1.5712712401,"key":["s981608311","s040280206"]} +{"user_id":"u507613674","problem_id":"p03103","language":"python","submission_id_v0":"s624724738","submission_id_v1":"s393485317","cpu_time_v0":317,"cpu_time_v1":292,"memory_v0":21924,"memory_v1":23172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.89,"input":"# from collections import defaultdict\n\n# N,M = list(map(int,input().split()))\n\n# price_howmany = defaultdict(int)\n\nimport sys\n\n\n\nstdin = sys.stdin\n\n\n\nread_int = lambda : list(map(int,stdin.readline().split()))\n\n\n\nN,M = read_int()\n\nprice_howmany = {}\n\n# price_list = []\n\n\n\nprice_set = set()\n\nfor _ in range(N):\n\n tmp = read_int()\n\n # if tmp[0] not in price_set:\n\n # price_list.append(tmp[0])\n\n price_set.add(tmp[0])\n\n if tmp[0] in price_howmany:\n\n price_howmany[tmp[0]] += tmp[1]\n\n else:\n\n price_howmany[tmp[0]] = tmp[1]\n\n# price_list.sort(reverse=True)\n\nprice_list = sorted(list(price_set))\n\n\n\n# price_howmany = dict(price_howmany)\n\n\n\ndef solve():\n\n price = 0\n\n global M\n\n # while M > 0:\n\n # low_price = min(price_howmany.keys())\n\n # low_price = price_list.pop()\n\n # many = min(M,price_howmany.pop(low_price))\n\n # price += many * low_price\n\n # M -= many\n\n for low_price in price_list:\n\n many = min(M,price_howmany.pop(low_price))\n\n price += many * low_price\n\n M -= many\n\n if M == 0: break\n\n print(price)\n\n\n\nif __name__ == \"__main__\":\n\n solve()","target":"# from collections import defaultdict\n\n# N,M = list(map(int,input().split()))\n\n# price_howmany = defaultdict(int)\n\nimport sys\n\n\n\nstdin = sys.stdin\n\n\n\nread_int = lambda : list(map(int,stdin.readline().split()))\n\n\n\nN,M = read_int()\n\nprice_howmany = {}\n\nprice_list = []\n\n\n\nfor _ in range(N):\n\n tmp = read_int()\n\n price_list.append(tmp[0])\n\n if tmp[0] in price_howmany:\n\n price_howmany[tmp[0]] += tmp[1]\n\n else:\n\n price_howmany[tmp[0]] = tmp[1]\n\nprice_list = list(set(price_list))\n\nprice_list.sort()\n\n\n\ndef solve():\n\n price = 0\n\n global M\n\n for low_price in price_list:\n\n many = min(M,price_howmany.pop(low_price))\n\n price += many * low_price\n\n M -= many\n\n if M == 0: break\n\n print(price)\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":46,"code_v1_loc":35,"code_v0_num_chars":1160,"code_v1_num_chars":793,"code_v0_no_empty_lines":"# from collections import defaultdict\n# N,M = list(map(int,input().split()))\n# price_howmany = defaultdict(int)\nimport sys\n\nstdin = sys.stdin\nread_int = lambda: list(map(int, stdin.readline().split()))\nN, M = read_int()\nprice_howmany = {}\n# price_list = []\nprice_set = set()\nfor _ in range(N):\n tmp = read_int()\n # if tmp[0] not in price_set:\n # price_list.append(tmp[0])\n price_set.add(tmp[0])\n if tmp[0] in price_howmany:\n price_howmany[tmp[0]] += tmp[1]\n else:\n price_howmany[tmp[0]] = tmp[1]\n# price_list.sort(reverse=True)\nprice_list = sorted(list(price_set))\n# price_howmany = dict(price_howmany)\ndef solve():\n price = 0\n global M\n # while M > 0:\n # low_price = min(price_howmany.keys())\n # low_price = price_list.pop()\n # many = min(M,price_howmany.pop(low_price))\n # price += many * low_price\n # M -= many\n for low_price in price_list:\n many = min(M, price_howmany.pop(low_price))\n price += many * low_price\n M -= many\n if M == 0:\n break\n print(price)\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"# from collections import defaultdict\n# N,M = list(map(int,input().split()))\n# price_howmany = defaultdict(int)\nimport sys\n\nstdin = sys.stdin\nread_int = lambda: list(map(int, stdin.readline().split()))\nN, M = read_int()\nprice_howmany = {}\nprice_list = []\nfor _ in range(N):\n tmp = read_int()\n price_list.append(tmp[0])\n if tmp[0] in price_howmany:\n price_howmany[tmp[0]] += tmp[1]\n else:\n price_howmany[tmp[0]] = tmp[1]\nprice_list = list(set(price_list))\nprice_list.sort()\n\n\ndef solve():\n price = 0\n global M\n for low_price in price_list:\n many = min(M, price_howmany.pop(low_price))\n price += many * low_price\n M -= many\n if M == 0:\n break\n print(price)\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":23.9130434783,"diff":["-# price_list = []","-price_set = set()","+price_list = []","- # if tmp[0] not in price_set:","- # price_list.append(tmp[0])","- price_set.add(tmp[0])","+ price_list.append(tmp[0])","-# price_list.sort(reverse=True)","-price_list = sorted(list(price_set))","-# price_howmany = dict(price_howmany)","+price_list = list(set(price_list))","+price_list.sort()","+","+","- # while M > 0:","- # low_price = min(price_howmany.keys())","- # low_price = price_list.pop()","- # many = min(M,price_howmany.pop(low_price))","- # price += many * low_price","- # M -= many"],"diff_only_import_comment":false,"measured_runtime_v0":0.0410390124,"measured_runtime_v1":0.0427370591,"runtime_lift":0.9602675821,"key":["s624724738","s393485317"]} +{"user_id":"u806976856","problem_id":"p02573","language":"python","submission_id_v0":"s715082523","submission_id_v1":"s852198539","cpu_time_v0":531,"cpu_time_v1":485,"memory_v0":96456,"memory_v1":96180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.66,"input":"import sys\n\nsys.setrecursionlimit(10**9)\n\nn,m=list(map(int,input().split()))\n\nroot=[-1]*n\n\ndef r(x):\n\n if root[x]<0:\n\n return x\n\n else:\n\n root[x]=r(root[x])\n\n return root[x]\n\ndef unite(x,y):\n\n x=r(x)\n\n y=r(y)\n\n if x==y:\n\n return\n\n root[x]+=root[y]\n\n root[y]=x\n\ndef size(x):\n\n x=r(x)\n\n return -root[x]\n\nfor i in range(m):\n\n x,y=list(map(int,input().split()))\n\n x-=1\n\n y-=1\n\n unite(x,y)\n\nans=0\n\nfor i in range(n):\n\n ans=max(ans,size(i))\n\nprint(ans)\n\n\n\n\n\n\n","target":"import sys\n\nsys.setrecursionlimit(10**9)\n\nn,m=list(map(int,input().split()))\n\nroot=[-1]*(n+1)\n\ndef r(x):\n\n if root[x]<0:\n\n return x\n\n else:\n\n root[x]=r(root[x])\n\n return root[x]\n\ndef unite(x,y):\n\n x=r(x)\n\n y=r(y)\n\n if x==y:\n\n return\n\n root[x]+=root[y]\n\n root[y]=x\n\ndef size(x):\n\n x=r(x)\n\n return -root[x]\n\nfor i in range(m):\n\n x,y=list(map(int,input().split()))\n\n\n\n unite(x,y)\n\nans=0\n\nfor i in range(n):\n\n ans=max(ans,size(i+1))\n\nprint(ans)\n\n\n","code_v0_loc":32,"code_v1_loc":29,"code_v0_num_chars":511,"code_v1_num_chars":495,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nn, m = list(map(int, input().split()))\nroot = [-1] * n\n\n\ndef r(x):\n if root[x] < 0:\n return x\n else:\n root[x] = r(root[x])\n return root[x]\n\n\ndef unite(x, y):\n x = r(x)\n y = r(y)\n if x == y:\n return\n root[x] += root[y]\n root[y] = x\n\n\ndef size(x):\n x = r(x)\n return -root[x]\n\n\nfor i in range(m):\n x, y = list(map(int, input().split()))\n x -= 1\n y -= 1\n unite(x, y)\nans = 0\nfor i in range(n):\n ans = max(ans, size(i))\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nn, m = list(map(int, input().split()))\nroot = [-1] * (n + 1)\n\n\ndef r(x):\n if root[x] < 0:\n return x\n else:\n root[x] = r(root[x])\n return root[x]\n\n\ndef unite(x, y):\n x = r(x)\n y = r(y)\n if x == y:\n return\n root[x] += root[y]\n root[y] = x\n\n\ndef size(x):\n x = r(x)\n return -root[x]\n\n\nfor i in range(m):\n x, y = list(map(int, input().split()))\n unite(x, y)\nans = 0\nfor i in range(n):\n ans = max(ans, size(i + 1))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.375,"diff":["-root = [-1] * n","+root = [-1] * (n + 1)","- x -= 1","- y -= 1","- ans = max(ans, size(i))","+ ans = max(ans, size(i + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0813221214,"measured_runtime_v1":0.0459178216,"runtime_lift":1.7710361348,"key":["s715082523","s852198539"]} +{"user_id":"u065079240","problem_id":"p02584","language":"python","submission_id_v0":"s753490057","submission_id_v1":"s133136316","cpu_time_v0":32,"cpu_time_v1":29,"memory_v0":9184,"memory_v1":9104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.38,"input":"X, K, D = list(map(int, input().split()))\n\nif X + K * D <= 0:\n\n print((-X - K * D))\n\nelif X - K * D >= 0:\n\n print((X - K * D))\n\nelse:\n\n div = X \/\/ D\n\n mod = X % D\n\n if (K-div) % 2 == 0:\n\n print(mod)\n\n else:\n\n print((abs(mod-D)))\n","target":"X, K, D = list(map(int, input().split()))\n\nif X + K * D <= 0:\n\n print((-X - K * D))\n\nelif X - K * D >= 0:\n\n print((X - K * D))\n\nelse:\n\n div = abs(X) \/\/ D\n\n if (K-div) % 2 == 0:\n\n print((abs(X) - D * div))\n\n else:\n\n print((abs(abs(X) - D * (div + 1))))\n","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":249,"code_v1_num_chars":267,"code_v0_no_empty_lines":"X, K, D = list(map(int, input().split()))\nif X + K * D <= 0:\n print((-X - K * D))\nelif X - K * D >= 0:\n print((X - K * D))\nelse:\n div = X \/\/ D\n mod = X % D\n if (K - div) % 2 == 0:\n print(mod)\n else:\n print((abs(mod - D)))\n","code_v1_no_empty_lines":"X, K, D = list(map(int, input().split()))\nif X + K * D <= 0:\n print((-X - K * D))\nelif X - K * D >= 0:\n print((X - K * D))\nelse:\n div = abs(X) \/\/ D\n if (K - div) % 2 == 0:\n print((abs(X) - D * div))\n else:\n print((abs(abs(X) - D * (div + 1))))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["- div = X \/\/ D","- mod = X % D","+ div = abs(X) \/\/ D","- print(mod)","+ print((abs(X) - D * div))","- print((abs(mod - D)))","+ print((abs(abs(X) - D * (div + 1))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0347697558,"measured_runtime_v1":0.036072253,"runtime_lift":0.9638919931,"key":["s753490057","s133136316"]} +{"user_id":"u163320134","problem_id":"p02579","language":"python","submission_id_v0":"s187982524","submission_id_v1":"s381444482","cpu_time_v0":883,"cpu_time_v1":724,"memory_v0":133876,"memory_v1":130204,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.01,"input":"#!\/usr\/bin\/env python3\n\n\n\nimport collections\n\nimport sys\n\ninput=sys.stdin.readline\n\n\n\nh,w=list(map(int,input().split()))\n\nsy,sx=list(map(int,input().split()))\n\ngy,gx=list(map(int,input().split()))\n\nboard=[['#']*(w+2)]+[list('#'+input().replace('\\n','')+'#') for _ in range(h)]+[['#']*(w+2)]\n\nscores=[[10**18]*(w+2) for _ in range(h+2)]\n\nscores[sy][sx]=0\n\nq=collections.deque()\n\nq.append((sy,sx))\n\ncount=0\n\nwhile len(q)!=0:\n\n y,x=q.popleft()\n\n for dx,dy in [[-1,0],[1,0],[0,-1],[0,1]]:\n\n if 1<=x+dx<=w and 1<=y+dy<=h and board[y+dy][x+dx]!='#' and scores[y+dy][x+dx]>scores[y][x]:\n\n scores[y+dy][x+dx]=scores[y][x]\n\n q.appendleft((y+dy,x+dx))\n\n for dy in range(-2,3):\n\n for dx in range(-2,3):\n\n if dx==0 and dy==0:\n\n continue\n\n if 1<=x+dx<=w and 1<=y+dy<=h and board[y+dy][x+dx]!='#' and scores[y+dy][x+dx]>scores[y][x]+1:\n\n scores[y+dy][x+dx]=scores[y][x]+1\n\n q.append((y+dy,x+dx))\n\nif scores[gy][gx]==10**18:\n\n print((-1))\n\nelse:\n\n print((scores[gy][gx]))","target":"#!\/usr\/bin\/env python3\n\n\n\nimport collections\n\n\n\nh,w=list(map(int,input().split()))\n\nsy,sx=list(map(int,input().split()))\n\ngy,gx=list(map(int,input().split()))\n\nboard=[['#']*(w+2)]+[list('#'+eval(input())+'#') for _ in range(h)]+[['#']*(w+2)]\n\nchecked=[[False]*(w+1) for _ in range(h+1)]\n\nchecked[sy][sx]=True\n\nq=collections.deque()\n\nq.append((sy,sx))\n\nans=0\n\nwhile 1:\n\n cur_pos=[]\n\n while len(q)!=0:\n\n y,x=q.popleft()\n\n cur_pos.append((y,x))\n\n for dy,dx in [[-1,0],[1,0],[0,-1],[0,1]]:\n\n if 1<=y+dy<=h and 1<=x+dx<=w and board[y+dy][x+dx]=='.' and checked[y+dy][x+dx]==False:\n\n checked[y+dy][x+dx]=True\n\n q.append((y+dy,x+dx))\n\n if checked[gy][gx]==True:\n\n print(ans)\n\n exit()\n\n if len(cur_pos)==0:\n\n print((-1))\n\n exit()\n\n ans+=1\n\n for y,x in cur_pos:\n\n for dy in range(-2,3):\n\n for dx in range(-2,3):\n\n if dy==0 and dx==0:\n\n continue\n\n if 1<=y+dy<=h and 1<=x+dx<=w and board[y+dy][x+dx]=='.' and checked[y+dy][x+dx]==False:\n\n checked[y+dy][x+dx]=True\n\n q.append((y+dy,x+dx))","code_v0_loc":32,"code_v1_loc":37,"code_v0_num_chars":990,"code_v1_num_chars":1045,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport collections\nimport sys\n\ninput = sys.stdin.readline\nh, w = list(map(int, input().split()))\nsy, sx = list(map(int, input().split()))\ngy, gx = list(map(int, input().split()))\nboard = (\n [[\"#\"] * (w + 2)]\n + [list(\"#\" + input().replace(\"\\n\", \"\") + \"#\") for _ in range(h)]\n + [[\"#\"] * (w + 2)]\n)\nscores = [[10**18] * (w + 2) for _ in range(h + 2)]\nscores[sy][sx] = 0\nq = collections.deque()\nq.append((sy, sx))\ncount = 0\nwhile len(q) != 0:\n y, x = q.popleft()\n for dx, dy in [[-1, 0], [1, 0], [0, -1], [0, 1]]:\n if (\n 1 <= x + dx <= w\n and 1 <= y + dy <= h\n and board[y + dy][x + dx] != \"#\"\n and scores[y + dy][x + dx] > scores[y][x]\n ):\n scores[y + dy][x + dx] = scores[y][x]\n q.appendleft((y + dy, x + dx))\n for dy in range(-2, 3):\n for dx in range(-2, 3):\n if dx == 0 and dy == 0:\n continue\n if (\n 1 <= x + dx <= w\n and 1 <= y + dy <= h\n and board[y + dy][x + dx] != \"#\"\n and scores[y + dy][x + dx] > scores[y][x] + 1\n ):\n scores[y + dy][x + dx] = scores[y][x] + 1\n q.append((y + dy, x + dx))\nif scores[gy][gx] == 10**18:\n print((-1))\nelse:\n print((scores[gy][gx]))\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport collections\n\nh, w = list(map(int, input().split()))\nsy, sx = list(map(int, input().split()))\ngy, gx = list(map(int, input().split()))\nboard = (\n [[\"#\"] * (w + 2)]\n + [list(\"#\" + eval(input()) + \"#\") for _ in range(h)]\n + [[\"#\"] * (w + 2)]\n)\nchecked = [[False] * (w + 1) for _ in range(h + 1)]\nchecked[sy][sx] = True\nq = collections.deque()\nq.append((sy, sx))\nans = 0\nwhile 1:\n cur_pos = []\n while len(q) != 0:\n y, x = q.popleft()\n cur_pos.append((y, x))\n for dy, dx in [[-1, 0], [1, 0], [0, -1], [0, 1]]:\n if (\n 1 <= y + dy <= h\n and 1 <= x + dx <= w\n and board[y + dy][x + dx] == \".\"\n and checked[y + dy][x + dx] == False\n ):\n checked[y + dy][x + dx] = True\n q.append((y + dy, x + dx))\n if checked[gy][gx] == True:\n print(ans)\n exit()\n if len(cur_pos) == 0:\n print((-1))\n exit()\n ans += 1\n for y, x in cur_pos:\n for dy in range(-2, 3):\n for dx in range(-2, 3):\n if dy == 0 and dx == 0:\n continue\n if (\n 1 <= y + dy <= h\n and 1 <= x + dx <= w\n and board[y + dy][x + dx] == \".\"\n and checked[y + dy][x + dx] == False\n ):\n checked[y + dy][x + dx] = True\n q.append((y + dy, x + dx))\n","code_same":false,"relative_loc_diff_percent":13.5135135135,"diff":["-import sys","-input = sys.stdin.readline","- + [list(\"#\" + input().replace(\"\\n\", \"\") + \"#\") for _ in range(h)]","+ + [list(\"#\" + eval(input()) + \"#\") for _ in range(h)]","-scores = [[10**18] * (w + 2) for _ in range(h + 2)]","-scores[sy][sx] = 0","+checked = [[False] * (w + 1) for _ in range(h + 1)]","+checked[sy][sx] = True","-count = 0","-while len(q) != 0:","- y, x = q.popleft()","- for dx, dy in [[-1, 0], [1, 0], [0, -1], [0, 1]]:","- if (","- 1 <= x + dx <= w","- and 1 <= y + dy <= h","- and board[y + dy][x + dx] != \"#\"","- and scores[y + dy][x + dx] > scores[y][x]","- ):","- scores[y + dy][x + dx] = scores[y][x]","- q.appendleft((y + dy, x + dx))","- for dy in range(-2, 3):","- for dx in range(-2, 3):","- if dx == 0 and dy == 0:","- continue","+ans = 0","+while 1:","+ cur_pos = []","+ while len(q) != 0:","+ y, x = q.popleft()","+ cur_pos.append((y, x))","+ for dy, dx in [[-1, 0], [1, 0], [0, -1], [0, 1]]:","- 1 <= x + dx <= w","- and 1 <= y + dy <= h","- and board[y + dy][x + dx] != \"#\"","- and scores[y + dy][x + dx] > scores[y][x] + 1","+ 1 <= y + dy <= h","+ and 1 <= x + dx <= w","+ and board[y + dy][x + dx] == \".\"","+ and checked[y + dy][x + dx] == False","- scores[y + dy][x + dx] = scores[y][x] + 1","+ checked[y + dy][x + dx] = True","-if scores[gy][gx] == 10**18:","- print((-1))","-else:","- print((scores[gy][gx]))","+ if checked[gy][gx] == True:","+ print(ans)","+ exit()","+ if len(cur_pos) == 0:","+ print((-1))","+ exit()","+ ans += 1","+ for y, x in cur_pos:","+ for dy in range(-2, 3):","+ for dx in range(-2, 3):","+ if dy == 0 and dx == 0:","+ continue","+ if (","+ 1 <= y + dy <= h","+ and 1 <= x + dx <= w","+ and board[y + dy][x + dx] == \".\"","+ and checked[y + dy][x + dx] == False","+ ):","+ checked[y + dy][x + dx] = True","+ q.append((y + dy, x + dx))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0365286093,"measured_runtime_v1":0.0353282843,"runtime_lift":1.0339763175,"key":["s187982524","s381444482"]} +{"user_id":"u742013327","problem_id":"p02256","language":"python","submission_id_v0":"s640589637","submission_id_v1":"s974680292","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7744,"memory_v1":7716,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"#http:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=ALDS1_1_B&lang=jp\n\n#??????????????????????????????\n\n#?????\u00a7??\u00ac?\u00b4???\u00b0???????????????????????????????????\u00a8????????\u00a8?\u00a8????????????????\n\ndef gcd(x,y):\n\n tmp = y\n\n \n\n if y > x:\n\n y = x\n\n x = tmp\n\n\n\n while not y == 0:\n\n y = x % y\n\n x = tmp\n\n tmp = y\n\n\n\n return x\n\ndef main():\n\n target = [int(a) for a in input().split()]\n\n print((gcd(target[0], target[1])))\n\n \n\nif __name__ == \"__main__\":\n\n main()","target":"#http:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=ALDS1_1_B&lang=jp\n\n#??????????????????????????????\n\n#?????\u00a7??\u00ac?\u00b4???\u00b0???????????????????????????????????\u00a8????????\u00a8?\u00a8????????????????\n\ndef gcd(x,y):\n\n \n\n if y > x:\n\n x, y = y, x\n\n\n\n while not y == 0:\n\n x, y = y, x % y\n\n \n\n return x\n\ndef main():\n\n target = [int(a) for a in input().split()]\n\n print((gcd(target[0], target[1])))\n\n \n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":22,"code_v1_loc":18,"code_v0_num_chars":509,"code_v1_num_chars":461,"code_v0_no_empty_lines":"# http:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=ALDS1_1_B&lang=jp\n# ??????????????????????????????\n# ?????\u00a7??\u00ac?\u00b4???\u00b0???????????????????????????????????\u00a8????????\u00a8?\u00a8????????????????\ndef gcd(x, y):\n tmp = y\n if y > x:\n y = x\n x = tmp\n while not y == 0:\n y = x % y\n x = tmp\n tmp = y\n return x\n\n\ndef main():\n target = [int(a) for a in input().split()]\n print((gcd(target[0], target[1])))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# http:\/\/judge.u-aizu.ac.jp\/onlinejudge\/description.jsp?id=ALDS1_1_B&lang=jp\n# ??????????????????????????????\n# ?????\u00a7??\u00ac?\u00b4???\u00b0???????????????????????????????????\u00a8????????\u00a8?\u00a8????????????????\ndef gcd(x, y):\n if y > x:\n x, y = y, x\n while not y == 0:\n x, y = y, x % y\n return x\n\n\ndef main():\n target = [int(a) for a in input().split()]\n print((gcd(target[0], target[1])))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["- tmp = y","- y = x","- x = tmp","+ x, y = y, x","- y = x % y","- x = tmp","- tmp = y","+ x, y = y, x % y"],"diff_only_import_comment":false,"measured_runtime_v0":0.0723901645,"measured_runtime_v1":0.0714682432,"runtime_lift":1.0128997339,"key":["s640589637","s974680292"]} +{"user_id":"u606045429","problem_id":"p03791","language":"python","submission_id_v0":"s062938850","submission_id_v1":"s616450944","cpu_time_v0":96,"cpu_time_v1":81,"memory_v0":14028,"memory_v1":14028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.62,"input":"mod = 10 ** 9 + 7\n\n\n\nN, *X = list(map(int, open(0).read().split()))\n\n\n\nstack = []\n\nans = 1\n\nfor x in X:\n\n stack.append(x)\n\n if x < 2 * len(stack) - 1:\n\n ans = (ans * len(stack)) % mod\n\n stack.pop()\n\n else:\n\n ans = (ans * len(stack)) % mod\n\n\n\nprint(ans)\n","target":"mod = 10 ** 9 + 7\n\n\n\nN, *X = list(map(int, open(0).read().split()))\n\n\n\ns = 0\n\nans = 1\n\nfor x in X:\n\n if x < 2 * s + 1:\n\n ans *= (s + 1)\n\n else:\n\n s += 1\n\n ans *= s\n\n ans %= mod\n\n\n\nprint(ans)","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":277,"code_v1_num_chars":214,"code_v0_no_empty_lines":"mod = 10**9 + 7\nN, *X = list(map(int, open(0).read().split()))\nstack = []\nans = 1\nfor x in X:\n stack.append(x)\n if x < 2 * len(stack) - 1:\n ans = (ans * len(stack)) % mod\n stack.pop()\n else:\n ans = (ans * len(stack)) % mod\nprint(ans)\n","code_v1_no_empty_lines":"mod = 10**9 + 7\nN, *X = list(map(int, open(0).read().split()))\ns = 0\nans = 1\nfor x in X:\n if x < 2 * s + 1:\n ans *= s + 1\n else:\n s += 1\n ans *= s\n ans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-stack = []","+s = 0","- stack.append(x)","- if x < 2 * len(stack) - 1:","- ans = (ans * len(stack)) % mod","- stack.pop()","+ if x < 2 * s + 1:","+ ans *= s + 1","- ans = (ans * len(stack)) % mod","+ s += 1","+ ans *= s","+ ans %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.1548694127,"measured_runtime_v1":0.1083701477,"runtime_lift":1.4290781726,"key":["s062938850","s616450944"]} +{"user_id":"u054514819","problem_id":"p02725","language":"python","submission_id_v0":"s272810414","submission_id_v1":"s050412847","cpu_time_v0":132,"cpu_time_v1":108,"memory_v0":26444,"memory_v1":102360,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"K, N = list(map(int, input().split()))\n\nAs = list(map(int, input().split()))\n\nDs = []\n\npast = 0\n\nfor i, a in enumerate(As):\n\n if not i==0:\n\n Ds.append(a-past)\n\n past = a\n\nDs.append(As[0]+K-As[-1])\n\nprint((K-max(Ds)))","target":"import sys\n\ndef input(): return sys.stdin.readline().strip()\n\ndef mapint(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10**9)\n\n\n\nK, N = mapint()\n\nAs = list(mapint())\n\n\n\nlis = []\n\nfor i in range(1, N):\n\n lis.append(As[i]-As[i-1])\n\nlis.append(As[0]+(K-As[-1]))\n\nprint((K-max(lis)))","code_v0_loc":10,"code_v1_loc":13,"code_v0_num_chars":221,"code_v1_num_chars":293,"code_v0_no_empty_lines":"K, N = list(map(int, input().split()))\nAs = list(map(int, input().split()))\nDs = []\npast = 0\nfor i, a in enumerate(As):\n if not i == 0:\n Ds.append(a - past)\n past = a\nDs.append(As[0] + K - As[-1])\nprint((K - max(Ds)))\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef mapint():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nK, N = mapint()\nAs = list(mapint())\nlis = []\nfor i in range(1, N):\n lis.append(As[i] - As[i - 1])\nlis.append(As[0] + (K - As[-1]))\nprint((K - max(lis)))\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-K, N = list(map(int, input().split()))","-As = list(map(int, input().split()))","-Ds = []","-past = 0","-for i, a in enumerate(As):","- if not i == 0:","- Ds.append(a - past)","- past = a","-Ds.append(As[0] + K - As[-1])","-print((K - max(Ds)))","+import sys","+","+","+def input():","+ return sys.stdin.readline().strip()","+","+","+def mapint():","+ return list(map(int, input().split()))","+","+","+sys.setrecursionlimit(10**9)","+K, N = mapint()","+As = list(mapint())","+lis = []","+for i in range(1, N):","+ lis.append(As[i] - As[i - 1])","+lis.append(As[0] + (K - As[-1]))","+print((K - max(lis)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0449382691,"measured_runtime_v1":0.0459539179,"runtime_lift":0.9778985362,"key":["s272810414","s050412847"]} +{"user_id":"u348285568","problem_id":"p03325","language":"python","submission_id_v0":"s247492201","submission_id_v1":"s549183223","cpu_time_v0":145,"cpu_time_v1":116,"memory_v0":4148,"memory_v1":4148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"n = int(eval(input()))\n\nlist=list(map(int,input().split()))\n\ncount=0\n\nfor i in range(n):\n\n while list[i]%2==0:\n\n list[i]=list[i]\/2\n\n count+=1\n\nprint(count)","target":"n = int(eval(input()))\n\nlist=list(map(int,input().split()))\n\ncount=0\n\nfor i in range(n):\n\n while list[i]%2==0:\n\n list[i]=list[i]\/\/2\n\n count+=1\n\nprint(count)","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":166,"code_v1_num_chars":167,"code_v0_no_empty_lines":"n = int(eval(input()))\nlist = list(map(int, input().split()))\ncount = 0\nfor i in range(n):\n while list[i] % 2 == 0:\n list[i] = list[i] \/ 2\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nlist = list(map(int, input().split()))\ncount = 0\nfor i in range(n):\n while list[i] % 2 == 0:\n list[i] = list[i] \/\/ 2\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- list[i] = list[i] \/ 2","+ list[i] = list[i] \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.1418888342,"measured_runtime_v1":0.1046222835,"runtime_lift":1.3562008927,"key":["s247492201","s549183223"]} +{"user_id":"u969190727","problem_id":"p03738","language":"python","submission_id_v0":"s433588495","submission_id_v1":"s868880666","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"a=int(eval(input()))\n\nb=int(eval(input()))\n\nprint((\"GREATER\" if a>b else \"LESS\" if b>a else \"EQUAL\"))\n","target":"a=int(eval(input()))\n\nb=int(eval(input()))\n\nif a>b:\n\n print(\"GREATER\")\n\nelif b>a:\n\n print(\"LESS\")\n\nelse:\n\n print(\"EQUAL\")","code_v0_loc":3,"code_v1_loc":8,"code_v0_num_chars":88,"code_v1_num_chars":112,"code_v0_no_empty_lines":"a = int(eval(input()))\nb = int(eval(input()))\nprint((\"GREATER\" if a > b else \"LESS\" if b > a else \"EQUAL\"))\n","code_v1_no_empty_lines":"a = int(eval(input()))\nb = int(eval(input()))\nif a > b:\n print(\"GREATER\")\nelif b > a:\n print(\"LESS\")\nelse:\n print(\"EQUAL\")\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-print((\"GREATER\" if a > b else \"LESS\" if b > a else \"EQUAL\"))","+if a > b:","+ print(\"GREATER\")","+elif b > a:","+ print(\"LESS\")","+else:","+ print(\"EQUAL\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450944898,"measured_runtime_v1":0.0450772858,"runtime_lift":1.0003816564,"key":["s433588495","s868880666"]} +{"user_id":"u286589639","problem_id":"p02259","language":"python","submission_id_v0":"s251382242","submission_id_v1":"s629824943","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7696,"memory_v1":5600,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"def bubble_sort(A):\n\n count = 0\n\n for i in reversed(list(range(len(A)))):\n\n for j in range(i):\n\n if A[j] > A[j+1]:\n\n temp = A[j]\n\n A[j] = A[j+1]\n\n A[j+1] = temp\n\n count += 1\n\n return count\n\n\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\ncount = bubble_sort(A)\n\nprint((\" \".join(map(str,A))))\n\nprint(count)","target":"def bubble_sort(A, N):\n\n\tcount = 0\n\n\tflag = 1\n\n\twhile flag:\n\n\t\tflag = 0\n\n\t\tfor i in range(N-1, 0, -1):\n\n\t\t\tif A[i] < A[i-1]:\n\n\t\t\t\ttemp = A[i]\n\n\t\t\t\tA[i] = A[i-1]\n\n\t\t\t\tA[i-1] = temp\n\n\t\t\t\tcount += 1\n\n\t\t\t\tflag = 1\n\n\n\n\treturn A, count\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nA, count = bubble_sort(A, N)\n\nprint((' '.join(map(str, A))))\n\nprint(count)\n","code_v0_loc":17,"code_v1_loc":21,"code_v0_num_chars":394,"code_v1_num_chars":363,"code_v0_no_empty_lines":"def bubble_sort(A):\n count = 0\n for i in reversed(list(range(len(A)))):\n for j in range(i):\n if A[j] > A[j + 1]:\n temp = A[j]\n A[j] = A[j + 1]\n A[j + 1] = temp\n count += 1\n return count\n\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\ncount = bubble_sort(A)\nprint((\" \".join(map(str, A))))\nprint(count)\n","code_v1_no_empty_lines":"def bubble_sort(A, N):\n count = 0\n flag = 1\n while flag:\n flag = 0\n for i in range(N - 1, 0, -1):\n if A[i] < A[i - 1]:\n temp = A[i]\n A[i] = A[i - 1]\n A[i - 1] = temp\n count += 1\n flag = 1\n return A, count\n\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nA, count = bubble_sort(A, N)\nprint((\" \".join(map(str, A))))\nprint(count)\n","code_same":false,"relative_loc_diff_percent":19.0476190476,"diff":["-def bubble_sort(A):","+def bubble_sort(A, N):","- for i in reversed(list(range(len(A)))):","- for j in range(i):","- if A[j] > A[j + 1]:","- temp = A[j]","- A[j] = A[j + 1]","- A[j + 1] = temp","+ flag = 1","+ while flag:","+ flag = 0","+ for i in range(N - 1, 0, -1):","+ if A[i] < A[i - 1]:","+ temp = A[i]","+ A[i] = A[i - 1]","+ A[i - 1] = temp","- return count","+ flag = 1","+ return A, count","-count = bubble_sort(A)","+A, count = bubble_sort(A, N)"],"diff_only_import_comment":false,"measured_runtime_v0":0.052343758,"measured_runtime_v1":0.0524004458,"runtime_lift":0.9989181817,"key":["s251382242","s629824943"]} +{"user_id":"u761320129","problem_id":"p03090","language":"python","submission_id_v0":"s991424544","submission_id_v1":"s117946518","cpu_time_v0":25,"cpu_time_v1":23,"memory_v0":3956,"memory_v1":3716,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.0,"input":"N = int(eval(input()))\n\nban = N if N%2 else N+1\n\nans = []\n\nfor i in range(1,N):\n\n for j in range(i+1,N+1):\n\n if i+j == ban: continue\n\n ans.append((i,j))\n\n\n\nprint((len(ans)))\n\nfor a,b in ans:\n\n print((a,b))","target":"N = int(input())\n\nban = N if N%2 else N+1\n\n\n\nans = []\n\nfor i in range(1,N):\n\n for j in range(i+1,N+1):\n\n if i+j == ban: continue\n\n ans.append(str(i) + ' ' + str(j))\n\n\n\nprint(len(ans))\n\nprint(*ans, sep='\\n')\n","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":215,"code_v1_num_chars":223,"code_v0_no_empty_lines":"N = int(eval(input()))\nban = N if N % 2 else N + 1\nans = []\nfor i in range(1, N):\n for j in range(i + 1, N + 1):\n if i + j == ban:\n continue\n ans.append((i, j))\nprint((len(ans)))\nfor a, b in ans:\n print((a, b))\n","code_v1_no_empty_lines":"N = int(input())\nban = N if N % 2 else N + 1\nans = []\nfor i in range(1, N):\n for j in range(i + 1, N + 1):\n if i + j == ban:\n continue\n ans.append(str(i) + \" \" + str(j))\nprint(len(ans))\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-N = int(eval(input()))","+N = int(input())","- ans.append((i, j))","-print((len(ans)))","-for a, b in ans:","- print((a, b))","+ ans.append(str(i) + \" \" + str(j))","+print(len(ans))","+print(*ans, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0568748415,"measured_runtime_v1":0.0360864421,"runtime_lift":1.5760722911,"key":["s991424544","s117946518"]} +{"user_id":"u968404618","problem_id":"p02760","language":"python","submission_id_v0":"s602957420","submission_id_v1":"s013347015","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"x = [0] * 3\n\ny = [0] * 3\n\nz = [0] * 3\n\nfor i in range(3):\n\n x[i], y[i], z[i] = list(map(int, input().split()))\n\n\n\nn = int(eval(input()))\n\nb = [int(eval(input())) for _ in range(n)]\n\nans = [x, y, z]\n\n\n\nfor i in range(3):\n\n ans.append([x[i], y[i], z[i]])\n\n\n\nans.append([x[0], y[1], z[2]])\n\nans.append([x[2], y[1], z[0]])\n\n\n\ncnt_list = []\n\nfor i in range(len(ans)):\n\n cnt = 0\n\n for j in list(set(x + y + z) & set(b)):\n\n if j in ans[i]:\n\n cnt += 1\n\n cnt_list.append(cnt)\n\n\n\nfor cnt in cnt_list:\n\n if cnt >= 3:\n\n print('Yes')\n\n exit()\n\n \n\nprint('No')","target":"a=[list(map(int,list(input().split()))) for _ in range(3)]\n\nb=[[0]*3 for _ in range(3)] \n\nn = int(eval(input()))\n\n##################\n\nfor ni in range(n):\n\n x = int(eval(input()))\n\n for i in range(3):\n\n for j in range(3):\n\n if a[i][j] == x:\n\n b[i][j] = 1\n\n##################\n\nans = False\n\n##################\n\nfor i in range(3):\n\n cnt = 0\n\n for j in range(3):\n\n cnt += b[i][j]\n\n if cnt == 3:\n\n ans = True\n\n##################\n\nfor i in range(3):\n\n cnt = 0\n\n for j in range(3):\n\n cnt += b[j][i]\n\n if cnt == 3:\n\n ans = True\n\n##################\n\ncnt = 0\n\nfor j in range(3):\n\n cnt += b[j][j]\n\n if cnt == 3:\n\n ans = True\n\n##################\n\ncnt = 0\n\nfor j in range(3):\n\n cnt += b[j][2-j]\n\n if cnt == 3:\n\n ans = True\n\n##################\n\nif ans == True:\n\n print('Yes')\n\nelse:\n\n print('No')\n","code_v0_loc":30,"code_v1_loc":43,"code_v0_num_chars":567,"code_v1_num_chars":825,"code_v0_no_empty_lines":"x = [0] * 3\ny = [0] * 3\nz = [0] * 3\nfor i in range(3):\n x[i], y[i], z[i] = list(map(int, input().split()))\nn = int(eval(input()))\nb = [int(eval(input())) for _ in range(n)]\nans = [x, y, z]\nfor i in range(3):\n ans.append([x[i], y[i], z[i]])\nans.append([x[0], y[1], z[2]])\nans.append([x[2], y[1], z[0]])\ncnt_list = []\nfor i in range(len(ans)):\n cnt = 0\n for j in list(set(x + y + z) & set(b)):\n if j in ans[i]:\n cnt += 1\n cnt_list.append(cnt)\nfor cnt in cnt_list:\n if cnt >= 3:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_v1_no_empty_lines":"a = [list(map(int, list(input().split()))) for _ in range(3)]\nb = [[0] * 3 for _ in range(3)]\nn = int(eval(input()))\n##################\nfor ni in range(n):\n x = int(eval(input()))\n for i in range(3):\n for j in range(3):\n if a[i][j] == x:\n b[i][j] = 1\n##################\nans = False\n##################\nfor i in range(3):\n cnt = 0\n for j in range(3):\n cnt += b[i][j]\n if cnt == 3:\n ans = True\n##################\nfor i in range(3):\n cnt = 0\n for j in range(3):\n cnt += b[j][i]\n if cnt == 3:\n ans = True\n##################\ncnt = 0\nfor j in range(3):\n cnt += b[j][j]\n if cnt == 3:\n ans = True\n##################\ncnt = 0\nfor j in range(3):\n cnt += b[j][2 - j]\n if cnt == 3:\n ans = True\n##################\nif ans == True:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":30.2325581395,"diff":["-x = [0] * 3","-y = [0] * 3","-z = [0] * 3","+a = [list(map(int, list(input().split()))) for _ in range(3)]","+b = [[0] * 3 for _ in range(3)]","+n = int(eval(input()))","+##################","+for ni in range(n):","+ x = int(eval(input()))","+ for i in range(3):","+ for j in range(3):","+ if a[i][j] == x:","+ b[i][j] = 1","+##################","+ans = False","+##################","- x[i], y[i], z[i] = list(map(int, input().split()))","-n = int(eval(input()))","-b = [int(eval(input())) for _ in range(n)]","-ans = [x, y, z]","+ cnt = 0","+ for j in range(3):","+ cnt += b[i][j]","+ if cnt == 3:","+ ans = True","+##################","- ans.append([x[i], y[i], z[i]])","-ans.append([x[0], y[1], z[2]])","-ans.append([x[2], y[1], z[0]])","-cnt_list = []","-for i in range(len(ans)):","- for j in list(set(x + y + z) & set(b)):","- if j in ans[i]:","- cnt += 1","- cnt_list.append(cnt)","-for cnt in cnt_list:","- if cnt >= 3:","- print(\"Yes\")","- exit()","-print(\"No\")","+ for j in range(3):","+ cnt += b[j][i]","+ if cnt == 3:","+ ans = True","+##################","+cnt = 0","+for j in range(3):","+ cnt += b[j][j]","+ if cnt == 3:","+ ans = True","+##################","+cnt = 0","+for j in range(3):","+ cnt += b[j][2 - j]","+ if cnt == 3:","+ ans = True","+##################","+if ans == True:","+ print(\"Yes\")","+else:","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0492328446,"measured_runtime_v1":0.0495170555,"runtime_lift":0.9942603427,"key":["s602957420","s013347015"]} +{"user_id":"u077291787","problem_id":"p03476","language":"python","submission_id_v0":"s458603754","submission_id_v1":"s149121009","cpu_time_v0":182,"cpu_time_v1":122,"memory_v0":25332,"memory_v1":25588,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.97,"input":"# ABC084D - 2017-like Number\n\nfrom bisect import bisect_left as bsl, bisect_right as bsr\n\n\n\n\n\ndef get_primes(n: int) -> list:\n\n # return a list of primes <= n\n\n sieve = [1] * n\n\n for i in range(3, int(n ** 0.5) + 1, 2):\n\n if sieve[i]:\n\n sieve[i * i :: 2 * i] = [0] * ((n - i * i - 1) \/\/ (2 * i) + 1)\n\n return [2] + [i for i in range(3, n, 2) if sieve[i]]\n\n\n\n\n\ndef main():\n\n Q, *LR = map(int, open(0).read().split())\n\n P = get_primes(10 ** 5 + 1)\n\n S = set(P)\n\n sel = [p for p in P if (p + 1) \/\/ 2 in S] # 2017-like primes (selected P)\n\n # the number of 2017-like primes b\/w l, r -> bisect[r] - bisect[l]\n\n ans = [bsr(sel, r) - bsl(sel, l) for l, r in zip(*[iter(LR)] * 2)]\n\n print(*ans, sep=\"\\n\")\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"# D - 2017-like Number\n\nfrom itertools import accumulate\n\nfrom math import sqrt\n\n\n\n\n\ndef get_primes(n: int) -> set:\n\n \"\"\"Return a list of prime numbers < n in O(N).\"\"\"\n\n if n < 2:\n\n return set()\n\n\n\n sieve = [1] * n\n\n for i in range(3, int(sqrt(n)) + 1, 2):\n\n if sieve[i]:\n\n sieve[i * i:: 2 * i] = [0] * ((n - i ** 2 - 1) \/\/ (2 * i) + 1)\n\n return {2} | {i for i in range(3, n, 2) if sieve[i]}\n\n\n\n\n\ndef main():\n\n Q, *LR = list(map(int, open(0).read().split()))\n\n primes = get_primes(10 ** 5 + 1)\n\n is_2017_like = [1 if i in primes and (i + 1) \/\/ 2 in primes else 0 for i in range(10 ** 5 + 1)]\n\n cumsum = tuple(accumulate(is_2017_like))\n\n ans = []\n\n for l, r in zip(*[iter(LR)] * 2):\n\n ans.append(cumsum[r] - cumsum[l - 1])\n\n print((\"\\n\".join(map(str, ans))))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":25,"code_v1_loc":30,"code_v0_num_chars":792,"code_v1_num_chars":862,"code_v0_no_empty_lines":"# ABC084D - 2017-like Number\nfrom bisect import bisect_left as bsl, bisect_right as bsr\n\n\ndef get_primes(n: int) -> list:\n # return a list of primes <= n\n sieve = [1] * n\n for i in range(3, int(n**0.5) + 1, 2):\n if sieve[i]:\n sieve[i * i :: 2 * i] = [0] * ((n - i * i - 1) \/\/ (2 * i) + 1)\n return [2] + [i for i in range(3, n, 2) if sieve[i]]\n\n\ndef main():\n Q, *LR = map(int, open(0).read().split())\n P = get_primes(10**5 + 1)\n S = set(P)\n sel = [p for p in P if (p + 1) \/\/ 2 in S] # 2017-like primes (selected P)\n # the number of 2017-like primes b\/w l, r -> bisect[r] - bisect[l]\n ans = [bsr(sel, r) - bsl(sel, l) for l, r in zip(*[iter(LR)] * 2)]\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# D - 2017-like Number\nfrom itertools import accumulate\nfrom math import sqrt\n\n\ndef get_primes(n: int) -> set:\n \"\"\"Return a list of prime numbers < n in O(N).\"\"\"\n if n < 2:\n return set()\n sieve = [1] * n\n for i in range(3, int(sqrt(n)) + 1, 2):\n if sieve[i]:\n sieve[i * i :: 2 * i] = [0] * ((n - i**2 - 1) \/\/ (2 * i) + 1)\n return {2} | {i for i in range(3, n, 2) if sieve[i]}\n\n\ndef main():\n Q, *LR = list(map(int, open(0).read().split()))\n primes = get_primes(10**5 + 1)\n is_2017_like = [\n 1 if i in primes and (i + 1) \/\/ 2 in primes else 0 for i in range(10**5 + 1)\n ]\n cumsum = tuple(accumulate(is_2017_like))\n ans = []\n for l, r in zip(*[iter(LR)] * 2):\n ans.append(cumsum[r] - cumsum[l - 1])\n print((\"\\n\".join(map(str, ans))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-# ABC084D - 2017-like Number","-from bisect import bisect_left as bsl, bisect_right as bsr","+# D - 2017-like Number","+from itertools import accumulate","+from math import sqrt","-def get_primes(n: int) -> list:","- # return a list of primes <= n","+def get_primes(n: int) -> set:","+ \"\"\"Return a list of prime numbers < n in O(N).\"\"\"","+ if n < 2:","+ return set()","- for i in range(3, int(n**0.5) + 1, 2):","+ for i in range(3, int(sqrt(n)) + 1, 2):","- sieve[i * i :: 2 * i] = [0] * ((n - i * i - 1) \/\/ (2 * i) + 1)","- return [2] + [i for i in range(3, n, 2) if sieve[i]]","+ sieve[i * i :: 2 * i] = [0] * ((n - i**2 - 1) \/\/ (2 * i) + 1)","+ return {2} | {i for i in range(3, n, 2) if sieve[i]}","- Q, *LR = map(int, open(0).read().split())","- P = get_primes(10**5 + 1)","- S = set(P)","- sel = [p for p in P if (p + 1) \/\/ 2 in S] # 2017-like primes (selected P)","- # the number of 2017-like primes b\/w l, r -> bisect[r] - bisect[l]","- ans = [bsr(sel, r) - bsl(sel, l) for l, r in zip(*[iter(LR)] * 2)]","- print(*ans, sep=\"\\n\")","+ Q, *LR = list(map(int, open(0).read().split()))","+ primes = get_primes(10**5 + 1)","+ is_2017_like = [","+ 1 if i in primes and (i + 1) \/\/ 2 in primes else 0 for i in range(10**5 + 1)","+ ]","+ cumsum = tuple(accumulate(is_2017_like))","+ ans = []","+ for l, r in zip(*[iter(LR)] * 2):","+ ans.append(cumsum[r] - cumsum[l - 1])","+ print((\"\\n\".join(map(str, ans))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.044755621,"measured_runtime_v1":0.1774178917,"runtime_lift":0.2522610348,"key":["s458603754","s149121009"]} +{"user_id":"u811841526","problem_id":"p02413","language":"python","submission_id_v0":"s844858461","submission_id_v1":"s016602733","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7784,"memory_v1":5684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"r, c = map(int, input().split())\n\n\n\ntable = []\n\nfor _ in range(r):\n\n table.append(list(map(int, input().split())))\n\n\n\nfor i in range(r):\n\n print(' '.join(map(str, table[i])), end='')\n\n print(' {}'.format(sum(table[i])))\n\n\n\ntotal = 0\n\nfor j in range(c):\n\n column_sum = 0\n\n column_sum = sum([row[j] for row in table])\n\n print('{} '.format(column_sum), end='')\n\n total += column_sum\n\nprint(total)\n","target":"r, c = list(map(int, input().split()))\n\ntable = []\n\nfor i in range(r):\n\n row = list(map(int, input().split()))\n\n row.append(sum(row))\n\n table.append(row)\n\n\n\ntotal_row = []\n\nfor col in range(c+1):\n\n column_sum = 0\n\n for row in range(r):\n\n column_sum += table[row][col]\n\n total_row.append(column_sum)\n\ntable.append(total_row)\n\n\n\nfor i in range(r+1):\n\n print((' '.join(map(str, table[i]))))\n\n\n","code_v0_loc":17,"code_v1_loc":18,"code_v0_num_chars":414,"code_v1_num_chars":410,"code_v0_no_empty_lines":"r, c = map(int, input().split())\ntable = []\nfor _ in range(r):\n table.append(list(map(int, input().split())))\nfor i in range(r):\n print(\" \".join(map(str, table[i])), end=\"\")\n print(\" {}\".format(sum(table[i])))\ntotal = 0\nfor j in range(c):\n column_sum = 0\n column_sum = sum([row[j] for row in table])\n print(\"{} \".format(column_sum), end=\"\")\n total += column_sum\nprint(total)\n","code_v1_no_empty_lines":"r, c = list(map(int, input().split()))\ntable = []\nfor i in range(r):\n row = list(map(int, input().split()))\n row.append(sum(row))\n table.append(row)\ntotal_row = []\nfor col in range(c + 1):\n column_sum = 0\n for row in range(r):\n column_sum += table[row][col]\n total_row.append(column_sum)\ntable.append(total_row)\nfor i in range(r + 1):\n print((\" \".join(map(str, table[i]))))\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["-r, c = map(int, input().split())","+r, c = list(map(int, input().split()))","-for _ in range(r):","- table.append(list(map(int, input().split())))","- print(\" \".join(map(str, table[i])), end=\"\")","- print(\" {}\".format(sum(table[i])))","-total = 0","-for j in range(c):","+ row = list(map(int, input().split()))","+ row.append(sum(row))","+ table.append(row)","+total_row = []","+for col in range(c + 1):","- column_sum = sum([row[j] for row in table])","- print(\"{} \".format(column_sum), end=\"\")","- total += column_sum","-print(total)","+ for row in range(r):","+ column_sum += table[row][col]","+ total_row.append(column_sum)","+table.append(total_row)","+for i in range(r + 1):","+ print((\" \".join(map(str, table[i]))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0693582685,"measured_runtime_v1":0.0461495619,"runtime_lift":1.502901992,"key":["s844858461","s016602733"]} +{"user_id":"u602740328","problem_id":"p03380","language":"python","submission_id_v0":"s403116164","submission_id_v1":"s655980931","cpu_time_v0":103,"cpu_time_v1":70,"memory_v0":14056,"memory_v1":14060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.04,"input":"n = int(eval(input()))\n\nA = sorted([int(i) for i in input().split()])\n\nA_max = A.pop()\n\nprint((A_max, min(A, key=lambda x:abs(A_max-x*2))))","target":"n = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nA_max = max(A)\n\nA.remove(A_max)\n\nprint((A_max, min(A, key=lambda x:abs(A_max-x*2))))","code_v0_loc":4,"code_v1_loc":5,"code_v0_num_chars":131,"code_v1_num_chars":139,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = sorted([int(i) for i in input().split()])\nA_max = A.pop()\nprint((A_max, min(A, key=lambda x: abs(A_max - x * 2))))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = [int(i) for i in input().split()]\nA_max = max(A)\nA.remove(A_max)\nprint((A_max, min(A, key=lambda x: abs(A_max - x * 2))))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-A = sorted([int(i) for i in input().split()])","-A_max = A.pop()","+A = [int(i) for i in input().split()]","+A_max = max(A)","+A.remove(A_max)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0325282604,"measured_runtime_v1":0.0620579071,"runtime_lift":0.5241598034,"key":["s403116164","s655980931"]} +{"user_id":"u652569315","problem_id":"p02683","language":"python","submission_id_v0":"s859064998","submission_id_v1":"s184545937","cpu_time_v0":283,"cpu_time_v1":137,"memory_v0":27104,"memory_v1":27224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.59,"input":"import numpy as np\n\nn,m,x=list(map(int,input().split()))\n\nca=[list(map(int,input().split())) for _ in range(n)]\n\na=[np.array(i[1:]) for i in ca]\n\nc=[i[0] for i in ca]\n\nxx=np.array([x]*m)\n\nans=pow(10,9)\n\n\n\nfor i in range(2**n):\n\n count=0\n\n aa=np.array([0]*m)\n\n for j in range(n):\n\n if ((i >> j) & 1):\n\n aa+=a[j]\n\n count+=c[j] \n\n if all(i>=x for i in aa):\n\n ans=min(ans,count)\n\nprint((ans if ans=x):\n\n s=np.dot(i,c)\n\n ans=s if s> j) & 1:\n aa += a[j]\n count += c[j]\n if all(i >= x for i in aa):\n ans = min(ans, count)\nprint((ans if ans < pow(10, 9) else -1))\n","code_v1_no_empty_lines":"from itertools import product\nimport numpy as np\n\nn, m, x = list(map(int, input().split()))\nca = [list(map(int, input().split())) for _ in range(n)]\na, c = np.array([i[1:] for i in ca]).T, np.array([i[0] for i in ca])\nans = pow(10, 9)\nfor i in product([0, 1], repeat=n):\n i = np.array(i)\n if all(np.dot(a, i) >= x):\n s = np.dot(i, c)\n ans = s if s < ans else ans\nprint((ans if ans < pow(10, 9) else -1))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["+from itertools import product","-a = [np.array(i[1:]) for i in ca]","-c = [i[0] for i in ca]","-xx = np.array([x] * m)","+a, c = np.array([i[1:] for i in ca]).T, np.array([i[0] for i in ca])","-for i in range(2**n):","- count = 0","- aa = np.array([0] * m)","- for j in range(n):","- if (i >> j) & 1:","- aa += a[j]","- count += c[j]","- if all(i >= x for i in aa):","- ans = min(ans, count)","+for i in product([0, 1], repeat=n):","+ i = np.array(i)","+ if all(np.dot(a, i) >= x):","+ s = np.dot(i, c)","+ ans = s if s < ans else ans"],"diff_only_import_comment":false,"measured_runtime_v0":0.5018874013,"measured_runtime_v1":0.196199002,"runtime_lift":2.5580527736,"key":["s859064998","s184545937"]} +{"user_id":"u780025254","problem_id":"p02398","language":"python","submission_id_v0":"s814626439","submission_id_v1":"s190514862","cpu_time_v0":60,"cpu_time_v1":30,"memory_v0":7704,"memory_v1":5600,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"a, b, c = list(map(int, input().split()))\n\n\n\ncount = 0\n\nfor i in range(a, b+1):\n\n if c % i == 0:\n\n count += 1\n\n\n\nprint(count)","target":"a, b, c = list(map(int, input().split()))\n\nresult = []\n\nfor i in range(a, b+1):\n\n if c % i == 0:\n\n result.append(i)\n\nprint((len(result)))\n","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":129,"code_v1_num_chars":140,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\ncount = 0\nfor i in range(a, b + 1):\n if c % i == 0:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nresult = []\nfor i in range(a, b + 1):\n if c % i == 0:\n result.append(i)\nprint((len(result)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-count = 0","+result = []","- count += 1","-print(count)","+ result.append(i)","+print((len(result)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0489433072,"measured_runtime_v1":0.0458061762,"runtime_lift":1.0684870737,"key":["s814626439","s190514862"]} +{"user_id":"u247554097","problem_id":"p03681","language":"python","submission_id_v0":"s831345334","submission_id_v1":"s234317509","cpu_time_v0":169,"cpu_time_v1":66,"memory_v0":38512,"memory_v1":9140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.95,"input":"# \u5dee\u304c1\u304b0\u306e\u307f\u96a3\u308a\u5408\u308f\u306a\u3044 \u9069\u5f53\u306b\u6bce\u56de\u5272\u308b\u518d\u5e30\n\n\n\nn, m = list(map(int, input().split()))\n\nif abs(n - m) > 1:\n\n print((0))\n\nelif n == m:\n\n ans = 1\n\n while n > 0:\n\n ans *= n\n\n n -= 1\n\n ans %= (10 ** 9 + 7)\n\n ans = (ans * ans * 2) % (10 ** 9 + 7)\n\n print(ans)\n\nelse:\n\n ans = max(n, m)\n\n t = 1\n\n x = min(n, m)\n\n while x > 0:\n\n t *= x\n\n x -= 1\n\n t %= (10 ** 9 + 7)\n\n ans = (ans * t * t) % (10 ** 9 + 7)\n\n print(ans)\n","target":"n, m = list(map(int, input().split()))\n\nMOD = 10**9 + 7\n\n\n\nif abs(n - m) > 1:\n\n print((0))\n\nelif n == m:\n\n ans = 1\n\n for i in range(2, n + 1):\n\n ans *= i\n\n ans %= MOD\n\n # xoxoxo... \u3068oxoxox... \u3001\u3069\u3063\u3061\u3092\u5148\u306b\u3059\u308b\u304b\u30672\u7a2e\u985e\n\n print((2 * ans * ans % MOD))\n\nelse:\n\n ans = 1\n\n for i in range(2, n + 1):\n\n ans *= i\n\n ans %= MOD\n\n for i in range(2, m + 1):\n\n ans *= i\n\n ans %= MOD\n\n print(ans)\n","code_v0_loc":23,"code_v1_loc":21,"code_v0_num_chars":457,"code_v1_num_chars":431,"code_v0_no_empty_lines":"# \u5dee\u304c1\u304b0\u306e\u307f\u96a3\u308a\u5408\u308f\u306a\u3044 \u9069\u5f53\u306b\u6bce\u56de\u5272\u308b\u518d\u5e30\nn, m = list(map(int, input().split()))\nif abs(n - m) > 1:\n print((0))\nelif n == m:\n ans = 1\n while n > 0:\n ans *= n\n n -= 1\n ans %= 10**9 + 7\n ans = (ans * ans * 2) % (10**9 + 7)\n print(ans)\nelse:\n ans = max(n, m)\n t = 1\n x = min(n, m)\n while x > 0:\n t *= x\n x -= 1\n t %= 10**9 + 7\n ans = (ans * t * t) % (10**9 + 7)\n print(ans)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nMOD = 10**9 + 7\nif abs(n - m) > 1:\n print((0))\nelif n == m:\n ans = 1\n for i in range(2, n + 1):\n ans *= i\n ans %= MOD\n # xoxoxo... \u3068oxoxox... \u3001\u3069\u3063\u3061\u3092\u5148\u306b\u3059\u308b\u304b\u30672\u7a2e\u985e\n print((2 * ans * ans % MOD))\nelse:\n ans = 1\n for i in range(2, n + 1):\n ans *= i\n ans %= MOD\n for i in range(2, m + 1):\n ans *= i\n ans %= MOD\n print(ans)\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["-# \u5dee\u304c1\u304b0\u306e\u307f\u96a3\u308a\u5408\u308f\u306a\u3044 \u9069\u5f53\u306b\u6bce\u56de\u5272\u308b\u518d\u5e30","+MOD = 10**9 + 7","- while n > 0:","- ans *= n","- n -= 1","- ans %= 10**9 + 7","- ans = (ans * ans * 2) % (10**9 + 7)","+ for i in range(2, n + 1):","+ ans *= i","+ ans %= MOD","+ # xoxoxo... \u3068oxoxox... \u3001\u3069\u3063\u3061\u3092\u5148\u306b\u3059\u308b\u304b\u30672\u7a2e\u985e","+ print((2 * ans * ans % MOD))","+else:","+ ans = 1","+ for i in range(2, n + 1):","+ ans *= i","+ ans %= MOD","+ for i in range(2, m + 1):","+ ans *= i","+ ans %= MOD","-else:","- ans = max(n, m)","- t = 1","- x = min(n, m)","- while x > 0:","- t *= x","- x -= 1","- t %= 10**9 + 7","- ans = (ans * t * t) % (10**9 + 7)","- print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422683239,"measured_runtime_v1":0.0390967369,"runtime_lift":1.0811215265,"key":["s831345334","s234317509"]} +{"user_id":"u620084012","problem_id":"p03479","language":"python","submission_id_v0":"s199413919","submission_id_v1":"s875875643","cpu_time_v0":162,"cpu_time_v1":18,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.89,"input":"X, Y = list(map(int, input().split()))\n\nt = X\n\nans = 0\n\nwhile t <= Y:\n\n t *= 2\n\n ans += 1\n\nprint(ans)","target":"X, Y = list(map(int,input().split()))\n\n\n\nans = 0\n\nwhile X <= Y:\n\n X *= 2\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":101,"code_v1_num_chars":96,"code_v0_no_empty_lines":"X, Y = list(map(int, input().split()))\nt = X\nans = 0\nwhile t <= Y:\n t *= 2\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"X, Y = list(map(int, input().split()))\nans = 0\nwhile X <= Y:\n X *= 2\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-t = X","-while t <= Y:","- t *= 2","+while X <= Y:","+ X *= 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0454217522,"measured_runtime_v1":0.1521923788,"runtime_lift":0.2984495845,"key":["s199413919","s875875643"]} +{"user_id":"u864197622","problem_id":"p03428","language":"python","submission_id_v0":"s131668332","submission_id_v1":"s629449093","cpu_time_v0":41,"cpu_time_v1":37,"memory_v0":3188,"memory_v1":3444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.76,"input":"import math\n\npi = math.atan(1)*4\n\n\n\ndef andrange(a, b):\n\n if a == (0, 0) or b == (0, 0): return (0, 0)\n\n if a == (0, 1): return b\n\n if b == (0, 1): return a\n\n if a[0] > b[0]: a, b = b, a\n\n if b[1] < a[1]:\n\n return b\n\n if b[0] < a[1] and b[1] >= a[1]:\n\n return (b[0], a[1])\n\n if b[0] >= a[1] and b[1] < a[0] + 1:\n\n return (0, 0)\n\n if b[1] >= a[0] + 1 and b[1] < a[1] + 1:\n\n return (a[0], b[1] - 1)\n\n if b[1] >= a[0] + 1 and b[1] >= a[1] + 1:\n\n return a\n\n\n\ndef calcrange(P, Q):\n\n c = calc(P, Q)\n\n if c > 0:\n\n return (c, c+0.5)\n\n else:\n\n return (c+1, c+1.5)\n\n\n\ndef calc(P, Q):\n\n x = P[0] - Q[0]\n\n y = P[1] - Q[1]\n\n if x == 0:\n\n return 0.25 if y > 0 else -0.25\n\n t = math.atan(y\/x)\n\n return t\/(2*pi) if x > 0 else (t\/(2*pi) % 1) - 0.5\n\n\n\nN = int(eval(input()))\n\nX = []\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n X.append((x, y))\n\n\n\nA = [(0, 1) for _ in range(N)]\n\n\n\nfor i in range(N):\n\n for j in range(N):\n\n if i != j:\n\n A[i] = andrange(A[i], calcrange(X[i], X[j]))\n\n\n\nfor a in A:\n\n print((\"{:.20f}\".format(a[1] - a[0])))\n","target":"from math import pi, atan2\n\n\n\ndef andrange(a, b):\n\n if a == (0, 0) or b == (0, 0): return (0, 0)\n\n if a == (0, 1): return b\n\n if b == (0, 1): return a\n\n if a[0] > b[0]: a, b = b, a\n\n if b[1] < a[1]: return b\n\n if b[0] < a[1]: return (b[0], a[1])\n\n if b[1] < a[0] + 1: return (0, 0)\n\n if b[1] < a[1] + 1: return (a[0], b[1] - 1)\n\n return a\n\n\n\ndef calcrange(P, Q):\n\n c = atan2(P[1]-Q[1], P[0]-Q[0]) \/ (2*pi)\n\n if c > 0: return (c, c+0.5)\n\n else: return (c+1, c+1.5)\n\n\n\nN = int(eval(input()))\n\nX = []\n\nfor _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n X.append((x, y))\n\n\n\nA = [(0, 1) for _ in range(N)]\n\n\n\nfor i in range(N):\n\n for j in range(N):\n\n if i != j:\n\n A[i] = andrange(A[i], calcrange(X[i], X[j]))\n\n\n\nfor a in A:\n\n print((\"{:.15f}\".format(a[1] - a[0])))","code_v0_loc":49,"code_v1_loc":33,"code_v0_num_chars":1161,"code_v1_num_chars":822,"code_v0_no_empty_lines":"import math\n\npi = math.atan(1) * 4\n\n\ndef andrange(a, b):\n if a == (0, 0) or b == (0, 0):\n return (0, 0)\n if a == (0, 1):\n return b\n if b == (0, 1):\n return a\n if a[0] > b[0]:\n a, b = b, a\n if b[1] < a[1]:\n return b\n if b[0] < a[1] and b[1] >= a[1]:\n return (b[0], a[1])\n if b[0] >= a[1] and b[1] < a[0] + 1:\n return (0, 0)\n if b[1] >= a[0] + 1 and b[1] < a[1] + 1:\n return (a[0], b[1] - 1)\n if b[1] >= a[0] + 1 and b[1] >= a[1] + 1:\n return a\n\n\ndef calcrange(P, Q):\n c = calc(P, Q)\n if c > 0:\n return (c, c + 0.5)\n else:\n return (c + 1, c + 1.5)\n\n\ndef calc(P, Q):\n x = P[0] - Q[0]\n y = P[1] - Q[1]\n if x == 0:\n return 0.25 if y > 0 else -0.25\n t = math.atan(y \/ x)\n return t \/ (2 * pi) if x > 0 else (t \/ (2 * pi) % 1) - 0.5\n\n\nN = int(eval(input()))\nX = []\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n X.append((x, y))\nA = [(0, 1) for _ in range(N)]\nfor i in range(N):\n for j in range(N):\n if i != j:\n A[i] = andrange(A[i], calcrange(X[i], X[j]))\nfor a in A:\n print((\"{:.20f}\".format(a[1] - a[0])))\n","code_v1_no_empty_lines":"from math import pi, atan2\n\n\ndef andrange(a, b):\n if a == (0, 0) or b == (0, 0):\n return (0, 0)\n if a == (0, 1):\n return b\n if b == (0, 1):\n return a\n if a[0] > b[0]:\n a, b = b, a\n if b[1] < a[1]:\n return b\n if b[0] < a[1]:\n return (b[0], a[1])\n if b[1] < a[0] + 1:\n return (0, 0)\n if b[1] < a[1] + 1:\n return (a[0], b[1] - 1)\n return a\n\n\ndef calcrange(P, Q):\n c = atan2(P[1] - Q[1], P[0] - Q[0]) \/ (2 * pi)\n if c > 0:\n return (c, c + 0.5)\n else:\n return (c + 1, c + 1.5)\n\n\nN = int(eval(input()))\nX = []\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n X.append((x, y))\nA = [(0, 1) for _ in range(N)]\nfor i in range(N):\n for j in range(N):\n if i != j:\n A[i] = andrange(A[i], calcrange(X[i], X[j]))\nfor a in A:\n print((\"{:.15f}\".format(a[1] - a[0])))\n","code_same":false,"relative_loc_diff_percent":32.6530612245,"diff":["-import math","-","-pi = math.atan(1) * 4","+from math import pi, atan2","- if b[0] < a[1] and b[1] >= a[1]:","+ if b[0] < a[1]:","- if b[0] >= a[1] and b[1] < a[0] + 1:","+ if b[1] < a[0] + 1:","- if b[1] >= a[0] + 1 and b[1] < a[1] + 1:","+ if b[1] < a[1] + 1:","- if b[1] >= a[0] + 1 and b[1] >= a[1] + 1:","- return a","+ return a","- c = calc(P, Q)","+ c = atan2(P[1] - Q[1], P[0] - Q[0]) \/ (2 * pi)","-","-","-def calc(P, Q):","- x = P[0] - Q[0]","- y = P[1] - Q[1]","- if x == 0:","- return 0.25 if y > 0 else -0.25","- t = math.atan(y \/ x)","- return t \/ (2 * pi) if x > 0 else (t \/ (2 * pi) % 1) - 0.5","- print((\"{:.20f}\".format(a[1] - a[0])))","+ print((\"{:.15f}\".format(a[1] - a[0])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0491395781,"measured_runtime_v1":0.0497271587,"runtime_lift":0.9881839094,"key":["s131668332","s629449093"]} +{"user_id":"u853185302","problem_id":"p03470","language":"python","submission_id_v0":"s177431273","submission_id_v1":"s861698388","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"N = int(eval(input()))\n\nd = set(sorted([int(eval(input())) for _ in range(N)]))\n\nprint((len(d)))\n\n\n","target":"n = int(eval(input()))\n\nd = [int(eval(input())) for _ in range(n)]\n\nd = sorted(list(set(d)))\n\nprint((len(d)))\n\n\n","code_v0_loc":4,"code_v1_loc":5,"code_v0_num_chars":85,"code_v1_num_chars":98,"code_v0_no_empty_lines":"N = int(eval(input()))\nd = set(sorted([int(eval(input())) for _ in range(N)]))\nprint((len(d)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nd = [int(eval(input())) for _ in range(n)]\nd = sorted(list(set(d)))\nprint((len(d)))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-N = int(eval(input()))","-d = set(sorted([int(eval(input())) for _ in range(N)]))","+n = int(eval(input()))","+d = [int(eval(input())) for _ in range(n)]","+d = sorted(list(set(d)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0728731749,"measured_runtime_v1":0.0736759243,"runtime_lift":0.9891043185,"key":["s177431273","s861698388"]} +{"user_id":"u966695411","problem_id":"p03986","language":"python","submission_id_v0":"s398078899","submission_id_v1":"s363029531","cpu_time_v0":58,"cpu_time_v1":45,"memory_v0":5352,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.41,"input":"s = ''.join(input().split('ST'))\n\ncnts = 0\n\ncnt = 0\n\nfor i in s:\n\n if i == 'S' :\n\n cnts += 1\n\n elif cnts > 0:\n\n cnts -= 1\n\n cnt += 1\n\nprint((len(s)-cnt*2))","target":"def main():\n\n s = input().replace('ST', '')\n\n cnts = 0\n\n cnt = 0\n\n for i in s:\n\n if i == 'S':\n\n cnts += 1\n\n elif cnts > 0:\n\n cnts -= 1\n\n cnt += 1\n\n print((len(s)-cnt*2))\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":10,"code_v1_loc":13,"code_v0_num_chars":180,"code_v1_num_chars":269,"code_v0_no_empty_lines":"s = \"\".join(input().split(\"ST\"))\ncnts = 0\ncnt = 0\nfor i in s:\n if i == \"S\":\n cnts += 1\n elif cnts > 0:\n cnts -= 1\n cnt += 1\nprint((len(s) - cnt * 2))\n","code_v1_no_empty_lines":"def main():\n s = input().replace(\"ST\", \"\")\n cnts = 0\n cnt = 0\n for i in s:\n if i == \"S\":\n cnts += 1\n elif cnts > 0:\n cnts -= 1\n cnt += 1\n print((len(s) - cnt * 2))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-s = \"\".join(input().split(\"ST\"))","-cnts = 0","-cnt = 0","-for i in s:","- if i == \"S\":","- cnts += 1","- elif cnts > 0:","- cnts -= 1","- cnt += 1","-print((len(s) - cnt * 2))","+def main():","+ s = input().replace(\"ST\", \"\")","+ cnts = 0","+ cnt = 0","+ for i in s:","+ if i == \"S\":","+ cnts += 1","+ elif cnts > 0:","+ cnts -= 1","+ cnt += 1","+ print((len(s) - cnt * 2))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0332540681,"measured_runtime_v1":0.0427794847,"runtime_lift":0.7773368081,"key":["s398078899","s363029531"]} +{"user_id":"u401686269","problem_id":"p02564","language":"python","submission_id_v0":"s702190511","submission_id_v1":"s986752492","cpu_time_v0":3706,"cpu_time_v1":2106,"memory_v0":219336,"memory_v1":232232,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.17,"input":"class SCC:\n\n '''\n\n SCC class with non-recursive DFS.\n\n '''\n\n def __init__(self,N):\n\n self.N = N\n\n self.G1 = [[] for _ in range(N)]\n\n self.G2 = [[] for _ in range(N)]\n\n \n\n def add_edge(self,a,b):\n\n self.G1[a].append(b)\n\n self.G2[b].append(a)\n\n \n\n def scc(self):\n\n self.seen = [0]*self.N\n\n self.postorder=[-1]*self.N\n\n self.order = 0\n\n for i in range(self.N):\n\n if self.seen[i]:continue\n\n self._dfs(i)\n\n\n\n self.seen = [0]*self.N\n\n scclist = []\n\n for i in self._argsort(self.postorder,reverse=True):\n\n if self.seen[i]:continue\n\n cc = self._dfs2(i)\n\n scclist.append(cc)\n\n \n\n return scclist\n\n \n\n def _argsort(self,arr,reverse=False):\n\n shift = self.N.bit_length()+2\n\n tmp = sorted([arr[i]<= 0:\n\n self.seen[v] = 1\n\n for next_v in self.G1[v]:\n\n if self.seen[next_v]: continue\n\n todo.append(~next_v)\n\n todo.append(next_v)\n\n else:\n\n if self.postorder[~v] == -1:\n\n self.postorder[~v] = self.order\n\n self.order += 1\n\n return\n\n \n\n def _dfs2(self,v):\n\n todo = [v]\n\n self.seen[v] = 1\n\n cc = [v]\n\n while todo:\n\n v = todo.pop()\n\n for next_v in self.G2[v]:\n\n if self.seen[next_v]: continue\n\n self.seen[next_v] = 1\n\n todo.append(next_v)\n\n cc.append(next_v)\n\n return cc\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n sc = SCC(N)\n\n for i in range(M):\n\n a,b=list(map(int,input().split()))\n\n sc.add_edge(a,b)\n\n scclist = sc.scc()\n\n print((len(scclist)))\n\n for cc in scclist:\n\n print((len(cc),*cc))\n\n \n\nif __name__==\"__main__\":\n\n main()","target":"class SCC:\n\n '''\n\n SCC class with non-recursive DFS.\n\n '''\n\n def __init__(self,N):\n\n self.N = N\n\n self.G1 = [[] for _ in range(N)]\n\n self.G2 = [[] for _ in range(N)]\n\n \n\n def add_edge(self,a,b):\n\n self.G1[a].append(b)\n\n self.G2[b].append(a)\n\n \n\n def scc(self):\n\n self.seen = [0]*self.N\n\n self.postorder=[-1]*self.N\n\n self.order = 0\n\n for i in range(self.N):\n\n if self.seen[i]:continue\n\n self._dfs(i)\n\n\n\n self.seen = [0]*self.N\n\n scclist = []\n\n for i in self._argsort(self.postorder,reverse=True):\n\n if self.seen[i]:continue\n\n cc = self._dfs2(i)\n\n scclist.append(cc)\n\n \n\n return scclist\n\n \n\n def _argsort(self,arr,reverse=False):\n\n shift = self.N.bit_length()+2\n\n tmp = sorted([arr[i]<= 0:\n\n self.seen[v] = 1\n\n for next_v in self.G1[v]:\n\n if self.seen[next_v]: continue\n\n todo.append(~next_v)\n\n todo.append(next_v)\n\n else:\n\n if self.postorder[~v] == -1:\n\n self.postorder[~v] = self.order\n\n self.order += 1\n\n return\n\n \n\n def _dfs2(self,v):\n\n todo = [v]\n\n self.seen[v] = 1\n\n cc = [v]\n\n while todo:\n\n v = todo.pop()\n\n for next_v in self.G2[v]:\n\n if self.seen[next_v]: continue\n\n self.seen[next_v] = 1\n\n todo.append(next_v)\n\n cc.append(next_v)\n\n return cc\n\n\n\ndef main():\n\n N,M = list(map(int,input().split()))\n\n scc = SCC(N)\n\n for i in range(M):\n\n a,b=list(map(int,input().split()))\n\n scc.add_edge(a,b)\n\n scclist = scc.scc()\n\n print((len(scclist)))\n\n for cc in scclist:\n\n print((len(cc),*cc))\n\n \n\nif __name__==\"__main__\":\n\n main()","code_v0_loc":78,"code_v1_loc":78,"code_v0_num_chars":1875,"code_v1_num_chars":1878,"code_v0_no_empty_lines":"class SCC:\n \"\"\"\n SCC class with non-recursive DFS.\n \"\"\"\n\n def __init__(self, N):\n self.N = N\n self.G1 = [[] for _ in range(N)]\n self.G2 = [[] for _ in range(N)]\n\n def add_edge(self, a, b):\n self.G1[a].append(b)\n self.G2[b].append(a)\n\n def scc(self):\n self.seen = [0] * self.N\n self.postorder = [-1] * self.N\n self.order = 0\n for i in range(self.N):\n if self.seen[i]:\n continue\n self._dfs(i)\n self.seen = [0] * self.N\n scclist = []\n for i in self._argsort(self.postorder, reverse=True):\n if self.seen[i]:\n continue\n cc = self._dfs2(i)\n scclist.append(cc)\n return scclist\n\n def _argsort(self, arr, reverse=False):\n shift = self.N.bit_length() + 2\n tmp = sorted([arr[i] << shift | i for i in range(len(arr))], reverse=reverse)\n mask = (1 << shift) - 1\n return [tmp[i] & mask for i in range(len(arr))]\n\n def _dfs(self, v0):\n todo = [~v0, v0]\n while todo:\n v = todo.pop()\n if v >= 0:\n self.seen[v] = 1\n for next_v in self.G1[v]:\n if self.seen[next_v]:\n continue\n todo.append(~next_v)\n todo.append(next_v)\n else:\n if self.postorder[~v] == -1:\n self.postorder[~v] = self.order\n self.order += 1\n return\n\n def _dfs2(self, v):\n todo = [v]\n self.seen[v] = 1\n cc = [v]\n while todo:\n v = todo.pop()\n for next_v in self.G2[v]:\n if self.seen[next_v]:\n continue\n self.seen[next_v] = 1\n todo.append(next_v)\n cc.append(next_v)\n return cc\n\n\ndef main():\n N, M = list(map(int, input().split()))\n sc = SCC(N)\n for i in range(M):\n a, b = list(map(int, input().split()))\n sc.add_edge(a, b)\n scclist = sc.scc()\n print((len(scclist)))\n for cc in scclist:\n print((len(cc), *cc))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"class SCC:\n \"\"\"\n SCC class with non-recursive DFS.\n \"\"\"\n\n def __init__(self, N):\n self.N = N\n self.G1 = [[] for _ in range(N)]\n self.G2 = [[] for _ in range(N)]\n\n def add_edge(self, a, b):\n self.G1[a].append(b)\n self.G2[b].append(a)\n\n def scc(self):\n self.seen = [0] * self.N\n self.postorder = [-1] * self.N\n self.order = 0\n for i in range(self.N):\n if self.seen[i]:\n continue\n self._dfs(i)\n self.seen = [0] * self.N\n scclist = []\n for i in self._argsort(self.postorder, reverse=True):\n if self.seen[i]:\n continue\n cc = self._dfs2(i)\n scclist.append(cc)\n return scclist\n\n def _argsort(self, arr, reverse=False):\n shift = self.N.bit_length() + 2\n tmp = sorted([arr[i] << shift | i for i in range(len(arr))], reverse=reverse)\n mask = (1 << shift) - 1\n return [tmp[i] & mask for i in range(len(arr))]\n\n def _dfs(self, v0):\n todo = [~v0, v0]\n while todo:\n v = todo.pop()\n if v >= 0:\n self.seen[v] = 1\n for next_v in self.G1[v]:\n if self.seen[next_v]:\n continue\n todo.append(~next_v)\n todo.append(next_v)\n else:\n if self.postorder[~v] == -1:\n self.postorder[~v] = self.order\n self.order += 1\n return\n\n def _dfs2(self, v):\n todo = [v]\n self.seen[v] = 1\n cc = [v]\n while todo:\n v = todo.pop()\n for next_v in self.G2[v]:\n if self.seen[next_v]:\n continue\n self.seen[next_v] = 1\n todo.append(next_v)\n cc.append(next_v)\n return cc\n\n\ndef main():\n N, M = list(map(int, input().split()))\n scc = SCC(N)\n for i in range(M):\n a, b = list(map(int, input().split()))\n scc.add_edge(a, b)\n scclist = scc.scc()\n print((len(scclist)))\n for cc in scclist:\n print((len(cc), *cc))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- sc = SCC(N)","+ scc = SCC(N)","- sc.add_edge(a, b)","- scclist = sc.scc()","+ scc.add_edge(a, b)","+ scclist = scc.scc()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0413082557,"measured_runtime_v1":0.0373073711,"runtime_lift":1.1072411269,"key":["s702190511","s986752492"]} +{"user_id":"u987164499","problem_id":"p03835","language":"python","submission_id_v0":"s976972806","submission_id_v1":"s613518918","cpu_time_v0":1734,"cpu_time_v1":1394,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.61,"input":"from sys import stdin\n\nk,s = list(map(int,stdin.readline().rstrip().split()))\n\npoint = 0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if i+j > s:\n\n continue\n\n elif s-(i+j) <= k:\n\n point += 1\n\nprint(point)","target":"from sys import stdin\n\nk,s = list(map(int,stdin.readline().rstrip().split()))\n\npoint = 0\n\nfor i in range(k+1):\n\n for j in range(k+1):\n\n if 0 <= s-(i+j) <= k:\n\n point += 1\n\nprint(point)","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":239,"code_v1_num_chars":199,"code_v0_no_empty_lines":"from sys import stdin\n\nk, s = list(map(int, stdin.readline().rstrip().split()))\npoint = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if i + j > s:\n continue\n elif s - (i + j) <= k:\n point += 1\nprint(point)\n","code_v1_no_empty_lines":"from sys import stdin\n\nk, s = list(map(int, stdin.readline().rstrip().split()))\npoint = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - (i + j) <= k:\n point += 1\nprint(point)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["- if i + j > s:","- continue","- elif s - (i + j) <= k:","+ if 0 <= s - (i + j) <= k:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0464507447,"measured_runtime_v1":0.0362803373,"runtime_lift":1.28032836,"key":["s976972806","s613518918"]} +{"user_id":"u165429863","problem_id":"p02661","language":"python","submission_id_v0":"s964673690","submission_id_v1":"s626591519","cpu_time_v0":605,"cpu_time_v1":216,"memory_v0":49184,"memory_v1":55244,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.3,"input":"def calc_median(X):\n\n #\u4e2d\u592e\u5024\u8a08\u7b97\n\n Xl = len(X)\n\n if Xl % 2:\n\n ret = X[(Xl + 1) \/\/ 2 - 1]\n\n else:\n\n ret = (X[Xl \/\/ 2 - 1] + X[Xl \/\/ 2]) \/ 2\n\n\n\n return ret\n\n\n\n\n\nN = int(eval(input()))\n\nAB = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nA = [AB[i][0] for i in range(N)]\n\nB = [AB[i][1] for i in range(N)]\n\n\n\nA.sort()\n\nB.sort()\n\n\n\nAM = calc_median(A)\n\nBM = calc_median(B)\n\n\n\nif N % 2:\n\n ans = BM - AM + 1\n\nelse:\n\n ans = int((BM - AM) * 2 + 1)\n\n\n\nprint(ans)\n","target":"def calc_median(X):\n\n #\u4e2d\u592e\u5024\u8a08\u7b97\n\n Xl = len(X)\n\n if Xl % 2:\n\n ret = X[(Xl + 1) \/\/ 2 - 1]\n\n else:\n\n ret = (X[Xl \/\/ 2 - 1] + X[Xl \/\/ 2]) \/ 2\n\n\n\n return ret\n\n\n\n\n\nN, *AB = list(map(int, open(0).read().split()))\n\n\n\nA = sorted(AB[::2])\n\nB = sorted(AB[1::2])\n\n\n\nAM = calc_median(A)\n\nBM = calc_median(B)\n\n\n\nif N % 2:\n\n ans = BM - AM + 1\n\nelse:\n\n ans = int((BM - AM) * 2 + 1)\n\n\n\nprint(ans)\n","code_v0_loc":29,"code_v1_loc":25,"code_v0_num_chars":486,"code_v1_num_chars":406,"code_v0_no_empty_lines":"def calc_median(X):\n # \u4e2d\u592e\u5024\u8a08\u7b97\n Xl = len(X)\n if Xl % 2:\n ret = X[(Xl + 1) \/\/ 2 - 1]\n else:\n ret = (X[Xl \/\/ 2 - 1] + X[Xl \/\/ 2]) \/ 2\n return ret\n\n\nN = int(eval(input()))\nAB = [list(map(int, input().split())) for _ in range(N)]\nA = [AB[i][0] for i in range(N)]\nB = [AB[i][1] for i in range(N)]\nA.sort()\nB.sort()\nAM = calc_median(A)\nBM = calc_median(B)\nif N % 2:\n ans = BM - AM + 1\nelse:\n ans = int((BM - AM) * 2 + 1)\nprint(ans)\n","code_v1_no_empty_lines":"def calc_median(X):\n # \u4e2d\u592e\u5024\u8a08\u7b97\n Xl = len(X)\n if Xl % 2:\n ret = X[(Xl + 1) \/\/ 2 - 1]\n else:\n ret = (X[Xl \/\/ 2 - 1] + X[Xl \/\/ 2]) \/ 2\n return ret\n\n\nN, *AB = list(map(int, open(0).read().split()))\nA = sorted(AB[::2])\nB = sorted(AB[1::2])\nAM = calc_median(A)\nBM = calc_median(B)\nif N % 2:\n ans = BM - AM + 1\nelse:\n ans = int((BM - AM) * 2 + 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":13.7931034483,"diff":["-N = int(eval(input()))","-AB = [list(map(int, input().split())) for _ in range(N)]","-A = [AB[i][0] for i in range(N)]","-B = [AB[i][1] for i in range(N)]","-A.sort()","-B.sort()","+N, *AB = list(map(int, open(0).read().split()))","+A = sorted(AB[::2])","+B = sorted(AB[1::2])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450822247,"measured_runtime_v1":0.0447623583,"runtime_lift":1.0071458793,"key":["s964673690","s626591519"]} +{"user_id":"u814265211","problem_id":"p03631","language":"python","submission_id_v0":"s825259730","submission_id_v1":"s098591539","cpu_time_v0":27,"cpu_time_v1":24,"memory_v0":9036,"memory_v1":8968,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"def is_palindrome(s: str) -> bool:\n\n return s[:len(s) \/\/ 2] == s[-1 * (len(s) \/\/ 2):][::-1]\n\n\n\nN = eval(input())\n\nprint(('Yes' if is_palindrome(N) else 'No'))","target":"def is_palindrome(s: str) -> bool:\n\n return s == s[::-1]\n\n\n\nN = eval(input())\n\nprint(('Yes' if is_palindrome(N) else 'No'))","code_v0_loc":5,"code_v1_loc":5,"code_v0_num_chars":153,"code_v1_num_chars":118,"code_v0_no_empty_lines":"def is_palindrome(s: str) -> bool:\n return s[: len(s) \/\/ 2] == s[-1 * (len(s) \/\/ 2) :][::-1]\n\n\nN = eval(input())\nprint((\"Yes\" if is_palindrome(N) else \"No\"))\n","code_v1_no_empty_lines":"def is_palindrome(s: str) -> bool:\n return s == s[::-1]\n\n\nN = eval(input())\nprint((\"Yes\" if is_palindrome(N) else \"No\"))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- return s[: len(s) \/\/ 2] == s[-1 * (len(s) \/\/ 2) :][::-1]","+ return s == s[::-1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0406505961,"measured_runtime_v1":0.0465295358,"runtime_lift":0.8736514444,"key":["s825259730","s098591539"]} +{"user_id":"u753803401","problem_id":"p03860","language":"python","submission_id_v0":"s716006928","submission_id_v1":"s631215180","cpu_time_v0":182,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.66,"input":"a, b, c = list(map(str, input().split()))\n\nprint((a[0] + b[0] + c[0]))\n","target":"a, b, c = list(map(str, input().split()))\n\nprint((a[0].upper() + b[0].upper() + c[0].upper()))\n","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":63,"code_v1_num_chars":87,"code_v0_no_empty_lines":"a, b, c = list(map(str, input().split()))\nprint((a[0] + b[0] + c[0]))\n","code_v1_no_empty_lines":"a, b, c = list(map(str, input().split()))\nprint((a[0].upper() + b[0].upper() + c[0].upper()))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((a[0] + b[0] + c[0]))","+print((a[0].upper() + b[0].upper() + c[0].upper()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1260816104,"measured_runtime_v1":0.0380964053,"runtime_lift":3.3095408746,"key":["s716006928","s631215180"]} +{"user_id":"u657361950","problem_id":"p02316","language":"python","submission_id_v0":"s983694734","submission_id_v1":"s823139310","cpu_time_v0":1050,"cpu_time_v1":920,"memory_v0":16124,"memory_v1":16120,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.38,"input":"def solve_knapsack(s, n, v, w):\n\n\tdp = [[0 for x in range(s+1)] for x in range(n+1)]\t\n\n\tfor i in range(n):\n\n\t\tfor j in range(1, s+1):\n\n\t\t\tif w[i] > j:\n\n\t\t\t\tdp[i+1][j] = dp[i][j]\n\n\t\t\telse:\n\n\t\t\t\tdp[i+1][j] = max(dp[i][j], max(dp[i+1][j-w[i]]+v[i], dp[i][j-w[i]]+v[i]))\n\n\treturn dp[n][s]\n\n\t\n\nn, s = list(map(int, input().split()))\n\nv = [0]*n\n\nw = [0]*n\n\nfor i in range(n):\n\n\tv[i], w[i] = list(map(int, input().split()))\n\nprint((solve_knapsack(s, n, v, w)))\n\n\n","target":"\n\ndef knapsack(n,W,v,w):\n\n\tdp=[[0 for x in range(W+1)] for x in range(n+1)]\n\n\tfor i in range(n):\n\n\t\tvl = v[i]\n\n\t\twt = w[i]\n\n\t\tfor j in range(W+1):\n\n\t\t\tif j < w[i]:\n\n\t\t\t\tdp[i+1][j]=dp[i][j]\n\n\t\t\telse:\n\n\t\t\t\tdp[i+1][j]=max(dp[i][j],max(dp[i][j-wt]+vl,dp[i+1][j-wt]+vl))\n\n\treturn dp[n][W]\n\n\n\nn,W = list(map(int,input().split()))\n\nv = [0]*n\n\nw = [0]*n\n\nfor i in range(n):\n\n\tv[i],w[i] = list(map(int,input().split()))\n\nprint((knapsack(n,W,v,w)))\n\n\n","code_v0_loc":17,"code_v1_loc":20,"code_v0_num_chars":442,"code_v1_num_chars":427,"code_v0_no_empty_lines":"def solve_knapsack(s, n, v, w):\n dp = [[0 for x in range(s + 1)] for x in range(n + 1)]\n for i in range(n):\n for j in range(1, s + 1):\n if w[i] > j:\n dp[i + 1][j] = dp[i][j]\n else:\n dp[i + 1][j] = max(\n dp[i][j], max(dp[i + 1][j - w[i]] + v[i], dp[i][j - w[i]] + v[i])\n )\n return dp[n][s]\n\n\nn, s = list(map(int, input().split()))\nv = [0] * n\nw = [0] * n\nfor i in range(n):\n v[i], w[i] = list(map(int, input().split()))\nprint((solve_knapsack(s, n, v, w)))\n","code_v1_no_empty_lines":"def knapsack(n, W, v, w):\n dp = [[0 for x in range(W + 1)] for x in range(n + 1)]\n for i in range(n):\n vl = v[i]\n wt = w[i]\n for j in range(W + 1):\n if j < w[i]:\n dp[i + 1][j] = dp[i][j]\n else:\n dp[i + 1][j] = max(\n dp[i][j], max(dp[i][j - wt] + vl, dp[i + 1][j - wt] + vl)\n )\n return dp[n][W]\n\n\nn, W = list(map(int, input().split()))\nv = [0] * n\nw = [0] * n\nfor i in range(n):\n v[i], w[i] = list(map(int, input().split()))\nprint((knapsack(n, W, v, w)))\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-def solve_knapsack(s, n, v, w):","- dp = [[0 for x in range(s + 1)] for x in range(n + 1)]","+def knapsack(n, W, v, w):","+ dp = [[0 for x in range(W + 1)] for x in range(n + 1)]","- for j in range(1, s + 1):","- if w[i] > j:","+ vl = v[i]","+ wt = w[i]","+ for j in range(W + 1):","+ if j < w[i]:","- dp[i][j], max(dp[i + 1][j - w[i]] + v[i], dp[i][j - w[i]] + v[i])","+ dp[i][j], max(dp[i][j - wt] + vl, dp[i + 1][j - wt] + vl)","- return dp[n][s]","+ return dp[n][W]","-n, s = list(map(int, input().split()))","+n, W = list(map(int, input().split()))","-print((solve_knapsack(s, n, v, w)))","+print((knapsack(n, W, v, w)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0416551113,"measured_runtime_v1":0.048291254,"runtime_lift":0.8625808571,"key":["s983694734","s823139310"]} +{"user_id":"u328510800","problem_id":"p03103","language":"python","submission_id_v0":"s285014975","submission_id_v1":"s120360917","cpu_time_v0":477,"cpu_time_v1":325,"memory_v0":28968,"memory_v1":27892,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.87,"input":"from operator import itemgetter\n\n\n\nn, m = list(map(int, input().split()))\n\nab = [list(map(int, input().split())) for _ in range(n)]\n\n\n\nab.sort(key=itemgetter(0))\n\n\n\nresult = 0\n\nfor e in ab:\n\n count = min(m, e[1])\n\n result += e[0] * count\n\n m = max(m-count, 0)\n\nprint(result)","target":"n, m = [int(x) for x in input().split()]\n\n\n\na = sorted([[int(x) for x in input().split()] for _ in range(n)], key=lambda x: x[0])\n\n\n\nresult = 0\n\nfor x in a:\n\n cnt = min(m, x[1])\n\n result += x[0] * cnt\n\n m -= cnt\n\nprint(result)","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":271,"code_v1_num_chars":229,"code_v0_no_empty_lines":"from operator import itemgetter\n\nn, m = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(n)]\nab.sort(key=itemgetter(0))\nresult = 0\nfor e in ab:\n count = min(m, e[1])\n result += e[0] * count\n m = max(m - count, 0)\nprint(result)\n","code_v1_no_empty_lines":"n, m = [int(x) for x in input().split()]\na = sorted([[int(x) for x in input().split()] for _ in range(n)], key=lambda x: x[0])\nresult = 0\nfor x in a:\n cnt = min(m, x[1])\n result += x[0] * cnt\n m -= cnt\nprint(result)\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-from operator import itemgetter","-","-n, m = list(map(int, input().split()))","-ab = [list(map(int, input().split())) for _ in range(n)]","-ab.sort(key=itemgetter(0))","+n, m = [int(x) for x in input().split()]","+a = sorted([[int(x) for x in input().split()] for _ in range(n)], key=lambda x: x[0])","-for e in ab:","- count = min(m, e[1])","- result += e[0] * count","- m = max(m - count, 0)","+for x in a:","+ cnt = min(m, x[1])","+ result += x[0] * cnt","+ m -= cnt"],"diff_only_import_comment":false,"measured_runtime_v0":0.0978705733,"measured_runtime_v1":0.0372033055,"runtime_lift":2.6306956327,"key":["s285014975","s120360917"]} +{"user_id":"u270467412","problem_id":"p02756","language":"python","submission_id_v0":"s859195733","submission_id_v1":"s801388572","cpu_time_v0":1828,"cpu_time_v1":706,"memory_v0":4468,"memory_v1":4432,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.38,"input":"S = str(eval(input()))\n\nQ = int(eval(input()))\n\n\n\nhanten = 0\n\nfront = \"\"\n\nend = \"\"\n\n\n\nfor i in range(Q):\n\n query = list(map(str, input().split()))\n\n if query[0] == \"1\":\n\n hanten += 1\n\n hanten = hanten % 2\n\n else:\n\n if query[1] == \"1\":\n\n if hanten == 0:\n\n front = query[2] + front\n\n else:\n\n end = end + query[2]\n\n else:\n\n if hanten == 0:\n\n end = end + query[2]\n\n else:\n\n front = query[2] + front\n\n\n\nans = front + S + end\n\nif hanten == 1:\n\n ans = ans[::-1]\n\nprint(ans)","target":"S = str(eval(input()))\n\nQ = int(eval(input()))\n\n\n\nhanten = 0\n\nfront = \"\"\n\nend = \"\"\n\n\n\nfor i in range(Q):\n\n query = list(map(str, input().split()))\n\n if query[0] == \"1\":\n\n hanten += 1\n\n hanten = hanten % 2\n\n else:\n\n if query[1] == \"1\":\n\n if hanten == 0:\n\n front = front + query[2]\n\n else:\n\n end = end + query[2]\n\n else:\n\n if hanten == 0:\n\n end = end + query[2]\n\n else:\n\n front = front + query[2]\n\n\n\nfront = front[::-1]\n\nans = front + S + end\n\nif hanten == 1:\n\n ans = ans[::-1]\n\nprint(ans)","code_v0_loc":28,"code_v1_loc":29,"code_v0_num_chars":518,"code_v1_num_chars":539,"code_v0_no_empty_lines":"S = str(eval(input()))\nQ = int(eval(input()))\nhanten = 0\nfront = \"\"\nend = \"\"\nfor i in range(Q):\n query = list(map(str, input().split()))\n if query[0] == \"1\":\n hanten += 1\n hanten = hanten % 2\n else:\n if query[1] == \"1\":\n if hanten == 0:\n front = query[2] + front\n else:\n end = end + query[2]\n else:\n if hanten == 0:\n end = end + query[2]\n else:\n front = query[2] + front\nans = front + S + end\nif hanten == 1:\n ans = ans[::-1]\nprint(ans)\n","code_v1_no_empty_lines":"S = str(eval(input()))\nQ = int(eval(input()))\nhanten = 0\nfront = \"\"\nend = \"\"\nfor i in range(Q):\n query = list(map(str, input().split()))\n if query[0] == \"1\":\n hanten += 1\n hanten = hanten % 2\n else:\n if query[1] == \"1\":\n if hanten == 0:\n front = front + query[2]\n else:\n end = end + query[2]\n else:\n if hanten == 0:\n end = end + query[2]\n else:\n front = front + query[2]\nfront = front[::-1]\nans = front + S + end\nif hanten == 1:\n ans = ans[::-1]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":3.4482758621,"diff":["- front = query[2] + front","+ front = front + query[2]","- front = query[2] + front","+ front = front + query[2]","+front = front[::-1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0679748502,"measured_runtime_v1":0.069552186,"runtime_lift":0.977321549,"key":["s859195733","s801388572"]} +{"user_id":"u713492631","problem_id":"p02900","language":"python","submission_id_v0":"s389276921","submission_id_v1":"s820720518","cpu_time_v0":256,"cpu_time_v1":215,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.02,"input":"from math import sqrt, ceil\n\n\n\na, b = list(map(int, input().split()))\n\n\n\nc_a = set()\n\nc_b = set()\n\n\n\nfor i in range(1, ceil(sqrt(a))+1):\n\n if a % i == 0:\n\n c_a.add(i)\n\n if i > 1:\n\n while a % i == 0:\n\n a = a \/\/ i\n\nif a != 1:\n\n c_a.add(a)\n\n\n\nfor j in range(1, ceil(sqrt(b))+1):\n\n if b % j == 0:\n\n c_b.add(j)\n\n if j > 1:\n\n while b % j == 0:\n\n b = b \/\/ j\n\nif b != 1:\n\n c_b.add(b)\n\n\n\nans = c_a.intersection(c_b)\n\n\n\nprint((len(ans)))\n","target":"from math import sqrt, ceil\n\n\n\na, b = list(map(int, input().split()))\n\n\n\ndef gcd(a, b):\n\n x, y = (a, b) if a > b else (b, a)\n\n while y > 0:\n\n x, y = y, x % y\n\n return x\n\n\n\nd = gcd(a, b)\n\nans = 1\n\nfor i in range(2, ceil(sqrt(d))+1):\n\n if d % i == 0:\n\n ans += 1\n\n while(d % i == 0):\n\n d = d \/ i\n\nif d != 1:\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":28,"code_v1_loc":20,"code_v0_num_chars":476,"code_v1_num_chars":343,"code_v0_no_empty_lines":"from math import sqrt, ceil\n\na, b = list(map(int, input().split()))\nc_a = set()\nc_b = set()\nfor i in range(1, ceil(sqrt(a)) + 1):\n if a % i == 0:\n c_a.add(i)\n if i > 1:\n while a % i == 0:\n a = a \/\/ i\nif a != 1:\n c_a.add(a)\nfor j in range(1, ceil(sqrt(b)) + 1):\n if b % j == 0:\n c_b.add(j)\n if j > 1:\n while b % j == 0:\n b = b \/\/ j\nif b != 1:\n c_b.add(b)\nans = c_a.intersection(c_b)\nprint((len(ans)))\n","code_v1_no_empty_lines":"from math import sqrt, ceil\n\na, b = list(map(int, input().split()))\n\n\ndef gcd(a, b):\n x, y = (a, b) if a > b else (b, a)\n while y > 0:\n x, y = y, x % y\n return x\n\n\nd = gcd(a, b)\nans = 1\nfor i in range(2, ceil(sqrt(d)) + 1):\n if d % i == 0:\n ans += 1\n while d % i == 0:\n d = d \/ i\nif d != 1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-c_a = set()","-c_b = set()","-for i in range(1, ceil(sqrt(a)) + 1):","- if a % i == 0:","- c_a.add(i)","- if i > 1:","- while a % i == 0:","- a = a \/\/ i","-if a != 1:","- c_a.add(a)","-for j in range(1, ceil(sqrt(b)) + 1):","- if b % j == 0:","- c_b.add(j)","- if j > 1:","- while b % j == 0:","- b = b \/\/ j","-if b != 1:","- c_b.add(b)","-ans = c_a.intersection(c_b)","-print((len(ans)))","+","+","+def gcd(a, b):","+ x, y = (a, b) if a > b else (b, a)","+ while y > 0:","+ x, y = y, x % y","+ return x","+","+","+d = gcd(a, b)","+ans = 1","+for i in range(2, ceil(sqrt(d)) + 1):","+ if d % i == 0:","+ ans += 1","+ while d % i == 0:","+ d = d \/ i","+if d != 1:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1668778446,"measured_runtime_v1":0.0879677436,"runtime_lift":1.8970344999,"key":["s389276921","s820720518"]} +{"user_id":"u392319141","problem_id":"p02937","language":"python","submission_id_v0":"s436429057","submission_id_v1":"s884864895","cpu_time_v0":385,"cpu_time_v1":124,"memory_v0":68936,"memory_v1":7780,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.79,"input":"from collections import defaultdict\n\nfrom bisect import bisect_right\n\n\n\ndef sol():\n\n S = eval(input())\n\n T = eval(input())\n\n\n\n setS = set(S)\n\n setT = set(T)\n\n for t in setT:\n\n if not t in setS:\n\n print('-1')\n\n return\n\n\n\n posS = defaultdict(list)\n\n\n\n for i, s in enumerate(S):\n\n posS[s].append(i)\n\n\n\n for s in enumerate(S):\n\n posS[s].sort()\n\n\n\n prev = -1\n\n ans = 0\n\n N = len(S)\n\n\n\n for t in T:\n\n next = bisect_right(posS[t], prev)\n\n if next >= len(posS[t]):\n\n ans += N - prev\n\n ans += posS[t][0]\n\n prev = posS[t][0]\n\n else:\n\n ans += posS[t][next] - prev\n\n prev = posS[t][next]\n\n\n\n print(ans)\n\n\n\nsol()\n","target":"from bisect import bisect_left\n\n\n\nS = eval(input())\n\nT = eval(input())\n\n\n\nif not set(list(T)) <= set(list(S)):\n\n print((-1))\n\n exit()\n\n\n\nsToI = {s: [] for s in set(list(S))}\n\nfor i, s in enumerate(S):\n\n sToI[s].append(i)\n\n\n\nnow = 0\n\nR = 0\n\nfor t in T:\n\n I = sToI[t]\n\n nx = bisect_left(I, now)\n\n\n\n if nx == len(I):\n\n nx = 0\n\n R += 1\n\n\n\n now = I[nx] + 1\n\n\n\nprint((now + R * len(S)))\n","code_v0_loc":39,"code_v1_loc":26,"code_v0_num_chars":746,"code_v1_num_chars":400,"code_v0_no_empty_lines":"from collections import defaultdict\nfrom bisect import bisect_right\n\n\ndef sol():\n S = eval(input())\n T = eval(input())\n setS = set(S)\n setT = set(T)\n for t in setT:\n if not t in setS:\n print(\"-1\")\n return\n posS = defaultdict(list)\n for i, s in enumerate(S):\n posS[s].append(i)\n for s in enumerate(S):\n posS[s].sort()\n prev = -1\n ans = 0\n N = len(S)\n for t in T:\n next = bisect_right(posS[t], prev)\n if next >= len(posS[t]):\n ans += N - prev\n ans += posS[t][0]\n prev = posS[t][0]\n else:\n ans += posS[t][next] - prev\n prev = posS[t][next]\n print(ans)\n\n\nsol()\n","code_v1_no_empty_lines":"from bisect import bisect_left\n\nS = eval(input())\nT = eval(input())\nif not set(list(T)) <= set(list(S)):\n print((-1))\n exit()\nsToI = {s: [] for s in set(list(S))}\nfor i, s in enumerate(S):\n sToI[s].append(i)\nnow = 0\nR = 0\nfor t in T:\n I = sToI[t]\n nx = bisect_left(I, now)\n if nx == len(I):\n nx = 0\n R += 1\n now = I[nx] + 1\nprint((now + R * len(S)))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-from collections import defaultdict","-from bisect import bisect_right","+from bisect import bisect_left","-","-def sol():","- S = eval(input())","- T = eval(input())","- setS = set(S)","- setT = set(T)","- for t in setT:","- if not t in setS:","- print(\"-1\")","- return","- posS = defaultdict(list)","- for i, s in enumerate(S):","- posS[s].append(i)","- for s in enumerate(S):","- posS[s].sort()","- prev = -1","- ans = 0","- N = len(S)","- for t in T:","- next = bisect_right(posS[t], prev)","- if next >= len(posS[t]):","- ans += N - prev","- ans += posS[t][0]","- prev = posS[t][0]","- else:","- ans += posS[t][next] - prev","- prev = posS[t][next]","- print(ans)","-","-","-sol()","+S = eval(input())","+T = eval(input())","+if not set(list(T)) <= set(list(S)):","+ print((-1))","+ exit()","+sToI = {s: [] for s in set(list(S))}","+for i, s in enumerate(S):","+ sToI[s].append(i)","+now = 0","+R = 0","+for t in T:","+ I = sToI[t]","+ nx = bisect_left(I, now)","+ if nx == len(I):","+ nx = 0","+ R += 1","+ now = I[nx] + 1","+print((now + R * len(S)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0479757004,"measured_runtime_v1":0.0370811412,"runtime_lift":1.2938032318,"key":["s436429057","s884864895"]} +{"user_id":"u119148115","problem_id":"p02555","language":"python","submission_id_v0":"s222082223","submission_id_v1":"s132353725","cpu_time_v0":90,"cpu_time_v1":75,"memory_v0":67752,"memory_v1":67720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"import sys\n\n\n\nsys.setrecursionlimit(10**7)\n\ndef I(): return int(sys.stdin.readline().rstrip())\n\ndef MI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #\u7a7a\u767d\u3042\u308a\n\ndef LI2(): return list(map(int,sys.stdin.readline().rstrip())) #\u7a7a\u767d\u306a\u3057\n\ndef S(): return sys.stdin.readline().rstrip()\n\ndef LS(): return list(sys.stdin.readline().rstrip().split()) #\u7a7a\u767d\u3042\u308a\n\ndef LS2(): return list(sys.stdin.readline().rstrip()) #\u7a7a\u767d\u306a\u3057\n\n\n\n\n\nS = I()\n\nmod = 10**9+7\n\n\n\nkaijou = [1]\n\nfor i in range(1,S):\n\n kaijou.append((kaijou[-1]*i) % mod)\n\n\n\ninv = [1]\n\nfor i in range(1,S):\n\n inv.append(pow(kaijou[i],mod-2,mod))\n\n\n\n\n\ndef nCr(n,r):\n\n if n < r:\n\n return 0\n\n return (kaijou[n]*inv[r]*inv[n-r]) % mod\n\n\n\n\n\nans = 0\n\nfor i in range(1,S\/\/3+1):\n\n if S-3*i >= 0:\n\n ans += nCr(S-1-2*i,i-1)\n\n ans %= mod\n\n\n\nprint(ans)\n","target":"import sys\n\ndef I(): return int(sys.stdin.readline().rstrip())\n\n\n\n\n\nS = I()\n\nmod = 10**9+7\n\n\n\nkaijou = [1]\n\nfor i in range(1,S):\n\n kaijou.append((kaijou[-1]*i) % mod)\n\n\n\ninv = [1]\n\nfor i in range(1,S):\n\n inv.append(pow(kaijou[i],mod-2,mod))\n\n\n\n\n\ndef nCr(n,r):\n\n if n < r:\n\n return 0\n\n return (kaijou[n]*inv[r]*inv[n-r]) % mod\n\n\n\n\n\nans = 0\n\nfor i in range(1,S\/\/3+1):\n\n ans += nCr(S-1-2*i,i-1)\n\n ans %= mod\n\n\n\nprint(ans)\n","code_v0_loc":37,"code_v1_loc":28,"code_v0_num_chars":896,"code_v1_num_chars":444,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef I():\n return int(sys.stdin.readline().rstrip())\n\n\ndef MI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().rstrip().split())) # \u7a7a\u767d\u3042\u308a\n\n\ndef LI2():\n return list(map(int, sys.stdin.readline().rstrip())) # \u7a7a\u767d\u306a\u3057\n\n\ndef S():\n return sys.stdin.readline().rstrip()\n\n\ndef LS():\n return list(sys.stdin.readline().rstrip().split()) # \u7a7a\u767d\u3042\u308a\n\n\ndef LS2():\n return list(sys.stdin.readline().rstrip()) # \u7a7a\u767d\u306a\u3057\n\n\nS = I()\nmod = 10**9 + 7\nkaijou = [1]\nfor i in range(1, S):\n kaijou.append((kaijou[-1] * i) % mod)\ninv = [1]\nfor i in range(1, S):\n inv.append(pow(kaijou[i], mod - 2, mod))\n\n\ndef nCr(n, r):\n if n < r:\n return 0\n return (kaijou[n] * inv[r] * inv[n - r]) % mod\n\n\nans = 0\nfor i in range(1, S \/\/ 3 + 1):\n if S - 3 * i >= 0:\n ans += nCr(S - 1 - 2 * i, i - 1)\n ans %= mod\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\n\ndef I():\n return int(sys.stdin.readline().rstrip())\n\n\nS = I()\nmod = 10**9 + 7\nkaijou = [1]\nfor i in range(1, S):\n kaijou.append((kaijou[-1] * i) % mod)\ninv = [1]\nfor i in range(1, S):\n inv.append(pow(kaijou[i], mod - 2, mod))\n\n\ndef nCr(n, r):\n if n < r:\n return 0\n return (kaijou[n] * inv[r] * inv[n - r]) % mod\n\n\nans = 0\nfor i in range(1, S \/\/ 3 + 1):\n ans += nCr(S - 1 - 2 * i, i - 1)\n ans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":24.3243243243,"diff":["-","-sys.setrecursionlimit(10**7)","-","-","-def MI():","- return list(map(int, sys.stdin.readline().rstrip().split()))","-","-","-def LI():","- return list(map(int, sys.stdin.readline().rstrip().split())) # \u7a7a\u767d\u3042\u308a","-","-","-def LI2():","- return list(map(int, sys.stdin.readline().rstrip())) # \u7a7a\u767d\u306a\u3057","-","-","-def S():","- return sys.stdin.readline().rstrip()","-","-","-def LS():","- return list(sys.stdin.readline().rstrip().split()) # \u7a7a\u767d\u3042\u308a","-","-","-def LS2():","- return list(sys.stdin.readline().rstrip()) # \u7a7a\u767d\u306a\u3057","- if S - 3 * i >= 0:","- ans += nCr(S - 1 - 2 * i, i - 1)","- ans %= mod","+ ans += nCr(S - 1 - 2 * i, i - 1)","+ ans %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.0471292315,"measured_runtime_v1":0.0397179849,"runtime_lift":1.1865967405,"key":["s222082223","s132353725"]} +{"user_id":"u680851063","problem_id":"p02802","language":"python","submission_id_v0":"s889990859","submission_id_v1":"s783223020","cpu_time_v0":382,"cpu_time_v1":322,"memory_v0":33008,"memory_v1":20376,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.71,"input":"n, m = list(map(int, input().split()))\n\nl = [tuple(input().split()) for _ in range(m)]\n\nsubs = [[] for _ in range(n)]\n\n\n\nfor i in range(m):\n\n subs[int(l[i][0])-1].append(l[i][1])\n\n\n\nac, p = 0, 0\n\n\n\nfor j in range(n):\n\n if 'AC' in subs[j]:\n\n ac += 1\n\n for k in range(len(subs[j])):\n\n if subs[j][k] == 'WA':\n\n p += 1\n\n else:\n\n break\n\n\n\nprint((ac, p))","target":"n, m = list(map(int, input().split()))\n\n\n\nrslts = [[] for _ in range(n)]\n\nfor i in range(m):\n\n x, y = input().split()\n\n rslts[int(x) - 1].append(y)\n\n#print(rslts)\n\n\n\nac, p = 0, 0\n\nfor j in range(n):\n\n seq = rslts[j]\n\n if 'AC' in seq:\n\n ac += 1\n\n for k in seq:\n\n if k == 'WA':\n\n p += 1\n\n else:\n\n break\n\n\n\nprint((ac, p))","code_v0_loc":19,"code_v1_loc":20,"code_v0_num_chars":428,"code_v1_num_chars":388,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nl = [tuple(input().split()) for _ in range(m)]\nsubs = [[] for _ in range(n)]\nfor i in range(m):\n subs[int(l[i][0]) - 1].append(l[i][1])\nac, p = 0, 0\nfor j in range(n):\n if \"AC\" in subs[j]:\n ac += 1\n for k in range(len(subs[j])):\n if subs[j][k] == \"WA\":\n p += 1\n else:\n break\nprint((ac, p))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nrslts = [[] for _ in range(n)]\nfor i in range(m):\n x, y = input().split()\n rslts[int(x) - 1].append(y)\n# print(rslts)\nac, p = 0, 0\nfor j in range(n):\n seq = rslts[j]\n if \"AC\" in seq:\n ac += 1\n for k in seq:\n if k == \"WA\":\n p += 1\n else:\n break\nprint((ac, p))\n","code_same":false,"relative_loc_diff_percent":5.0,"diff":["-l = [tuple(input().split()) for _ in range(m)]","-subs = [[] for _ in range(n)]","+rslts = [[] for _ in range(n)]","- subs[int(l[i][0]) - 1].append(l[i][1])","+ x, y = input().split()","+ rslts[int(x) - 1].append(y)","+# print(rslts)","- if \"AC\" in subs[j]:","+ seq = rslts[j]","+ if \"AC\" in seq:","- for k in range(len(subs[j])):","- if subs[j][k] == \"WA\":","+ for k in seq:","+ if k == \"WA\":"],"diff_only_import_comment":false,"measured_runtime_v0":0.0414822564,"measured_runtime_v1":0.0408909235,"runtime_lift":1.0144612264,"key":["s889990859","s783223020"]} +{"user_id":"u475503988","problem_id":"p02781","language":"python","submission_id_v0":"s129939232","submission_id_v1":"s143427654","cpu_time_v0":26,"cpu_time_v1":23,"memory_v0":3940,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.54,"input":"from functools import lru_cache\n\nN = int(eval(input()))\n\nK = int(eval(input()))\n\n\n\n@lru_cache(None)\n\ndef f(N, K):\n\n if K == 0: return 1\n\n if N < 10:\n\n if K == 1: return N\n\n return 0\n\n q, r = divmod(N, 10)\n\n ret = 0\n\n ret += f(q, K-1) * r\n\n ret += f(q-1, K-1) * (9-r)\n\n ret += f(q, K)\n\n return ret\n\n\n\nprint((f(N, K))) ","target":"S = eval(input())\n\nn = len(S)\n\nK = int(eval(input()))\n\ndp = [[[0]*2 for _ in range(K+1)] for _ in range(n+1)]\n\ndp[0][0][0] = 1\n\nfor i in range(n): # i:\u6841\n\n for j in range(K+1): # j:\u975e0\u306e\u6570\n\n for k in range(2): # k:0->n\u3068\u540c\u3058\u6570,1->n\u3088\u308a\u5c0f\u3055\u3044\u6570\n\n nd = int(S[i]) #nd:n\u306ei\u6841\n\n for d in range(10):\n\n ni, nj, nk = i+1, j, k\n\n if d != 0: nj += 1 # \u975e0\u306e\u6570\u304c\u5897\u3048\u308b\n\n if nj > K: continue # \u975e0\u306e\u6570\u304cK\u3092\u8d85\u3048\u305f\u3089\u8a08\u7b97\u4e0d\u8981\n\n if k == 0: # \u3053\u3053\u307e\u3067n\u3068\u540c\u3058\u5834\u5408\n\n if d > nd: continue # n\u3088\u308a\u5927\u304d\u304f\u306a\u308b\u306e\u3067\u30c0\u30e1\n\n if d < nd: nk = 1 # n\u3088\u308a\u5c0f\u3055\u304f\u306a\u308b\u306e\u3067k\u306f1\u306b\n\n dp[ni][nj][nk] += dp[i][j][k]\n\nans = dp[n][K][0] + dp[n][K][1]\n\nprint(ans)\n","code_v0_loc":18,"code_v1_loc":19,"code_v0_num_chars":342,"code_v1_num_chars":723,"code_v0_no_empty_lines":"from functools import lru_cache\n\nN = int(eval(input()))\nK = int(eval(input()))\n\n\n@lru_cache(None)\ndef f(N, K):\n if K == 0:\n return 1\n if N < 10:\n if K == 1:\n return N\n return 0\n q, r = divmod(N, 10)\n ret = 0\n ret += f(q, K - 1) * r\n ret += f(q - 1, K - 1) * (9 - r)\n ret += f(q, K)\n return ret\n\n\nprint((f(N, K)))\n","code_v1_no_empty_lines":"S = eval(input())\nn = len(S)\nK = int(eval(input()))\ndp = [[[0] * 2 for _ in range(K + 1)] for _ in range(n + 1)]\ndp[0][0][0] = 1\nfor i in range(n): # i:\u6841\n for j in range(K + 1): # j:\u975e0\u306e\u6570\n for k in range(2): # k:0->n\u3068\u540c\u3058\u6570,1->n\u3088\u308a\u5c0f\u3055\u3044\u6570\n nd = int(S[i]) # nd:n\u306ei\u6841\n for d in range(10):\n ni, nj, nk = i + 1, j, k\n if d != 0:\n nj += 1 # \u975e0\u306e\u6570\u304c\u5897\u3048\u308b\n if nj > K:\n continue # \u975e0\u306e\u6570\u304cK\u3092\u8d85\u3048\u305f\u3089\u8a08\u7b97\u4e0d\u8981\n if k == 0: # \u3053\u3053\u307e\u3067n\u3068\u540c\u3058\u5834\u5408\n if d > nd:\n continue # n\u3088\u308a\u5927\u304d\u304f\u306a\u308b\u306e\u3067\u30c0\u30e1\n if d < nd:\n nk = 1 # n\u3088\u308a\u5c0f\u3055\u304f\u306a\u308b\u306e\u3067k\u306f1\u306b\n dp[ni][nj][nk] += dp[i][j][k]\nans = dp[n][K][0] + dp[n][K][1]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-from functools import lru_cache","-","-N = int(eval(input()))","+S = eval(input())","+n = len(S)","-","-","-@lru_cache(None)","-def f(N, K):","- if K == 0:","- return 1","- if N < 10:","- if K == 1:","- return N","- return 0","- q, r = divmod(N, 10)","- ret = 0","- ret += f(q, K - 1) * r","- ret += f(q - 1, K - 1) * (9 - r)","- ret += f(q, K)","- return ret","-","-","-print((f(N, K)))","+dp = [[[0] * 2 for _ in range(K + 1)] for _ in range(n + 1)]","+dp[0][0][0] = 1","+for i in range(n): # i:\u6841","+ for j in range(K + 1): # j:\u975e0\u306e\u6570","+ for k in range(2): # k:0->n\u3068\u540c\u3058\u6570,1->n\u3088\u308a\u5c0f\u3055\u3044\u6570","+ nd = int(S[i]) # nd:n\u306ei\u6841","+ for d in range(10):","+ ni, nj, nk = i + 1, j, k","+ if d != 0:","+ nj += 1 # \u975e0\u306e\u6570\u304c\u5897\u3048\u308b","+ if nj > K:","+ continue # \u975e0\u306e\u6570\u304cK\u3092\u8d85\u3048\u305f\u3089\u8a08\u7b97\u4e0d\u8981","+ if k == 0: # \u3053\u3053\u307e\u3067n\u3068\u540c\u3058\u5834\u5408","+ if d > nd:","+ continue # n\u3088\u308a\u5927\u304d\u304f\u306a\u308b\u306e\u3067\u30c0\u30e1","+ if d < nd:","+ nk = 1 # n\u3088\u308a\u5c0f\u3055\u304f\u306a\u308b\u306e\u3067k\u306f1\u306b","+ dp[ni][nj][nk] += dp[i][j][k]","+ans = dp[n][K][0] + dp[n][K][1]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0440536764,"measured_runtime_v1":0.0441834452,"runtime_lift":0.9970629529,"key":["s129939232","s143427654"]} +{"user_id":"u045830275","problem_id":"p02394","language":"python","submission_id_v0":"s079207862","submission_id_v1":"s602660919","cpu_time_v0":60,"cpu_time_v1":50,"memory_v0":7780,"memory_v1":7764,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"def main() :\n\n W, H, x, y, r = [int(i) for i in input().split()]\n\n \n\n if ((x-r)>=0) and ((x+r)<=W) and ((y-r)>=0) and ((y+r)<=H) :\n\n print(\"Yes\")\n\n else :\n\n print(\"No\")\n\n\n\nif __name__ == '__main__' :\n\n main()","target":"def main() :\n\n W, H, x, y, r = [int(i) for i in input().split()]\n\n\n\n if (r <= x <= W-r) and (r <= y <= H-r) :\n\n print(\"Yes\")\n\n else :\n\n print(\"No\")\n\n\n\nif __name__ == '__main__' :\n\n main()","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":237,"code_v1_num_chars":213,"code_v0_no_empty_lines":"def main():\n W, H, x, y, r = [int(i) for i in input().split()]\n if ((x - r) >= 0) and ((x + r) <= W) and ((y - r) >= 0) and ((y + r) <= H):\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n W, H, x, y, r = [int(i) for i in input().split()]\n if (r <= x <= W - r) and (r <= y <= H - r):\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if ((x - r) >= 0) and ((x + r) <= W) and ((y - r) >= 0) and ((y + r) <= H):","+ if (r <= x <= W - r) and (r <= y <= H - r):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0762521371,"measured_runtime_v1":0.0873191968,"runtime_lift":0.8732574269,"key":["s079207862","s602660919"]} +{"user_id":"u566428756","problem_id":"p02584","language":"python","submission_id_v0":"s808385830","submission_id_v1":"s841042040","cpu_time_v0":37,"cpu_time_v1":29,"memory_v0":9168,"memory_v1":9192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.62,"input":"X,K,D=list(map(int,input().split()))\n\n \n\nx=min(K,abs(X)\/\/D)\n\n \n\nif X>0:\n\n X_=X-(D*x)\n\nelse:\n\n X_=X+(D*x)\n\n \n\nk=K-x\n\nif k%2!=0:\n\n ans=min(abs(X_-D),abs(X_+D))\n\nelse:\n\n ans=abs(X_)\n\nprint(ans)","target":"X,K,D=list(map(int,input().split()))\n\n\n\nX=abs(X)\n\nk=min(K,X\/\/D)\n\nX_=X-(k*D)\n\nK_=K-k\n\n\n\nif K_%2!=0:\n\n ans=min(abs(X_-D),abs(X_+D))\n\nelse:\n\n ans=abs(X_)\n\n\n\nprint(ans)","code_v0_loc":15,"code_v1_loc":13,"code_v0_num_chars":196,"code_v1_num_chars":164,"code_v0_no_empty_lines":"X, K, D = list(map(int, input().split()))\nx = min(K, abs(X) \/\/ D)\nif X > 0:\n X_ = X - (D * x)\nelse:\n X_ = X + (D * x)\nk = K - x\nif k % 2 != 0:\n ans = min(abs(X_ - D), abs(X_ + D))\nelse:\n ans = abs(X_)\nprint(ans)\n","code_v1_no_empty_lines":"X, K, D = list(map(int, input().split()))\nX = abs(X)\nk = min(K, X \/\/ D)\nX_ = X - (k * D)\nK_ = K - k\nif K_ % 2 != 0:\n ans = min(abs(X_ - D), abs(X_ + D))\nelse:\n ans = abs(X_)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-x = min(K, abs(X) \/\/ D)","-if X > 0:","- X_ = X - (D * x)","-else:","- X_ = X + (D * x)","-k = K - x","-if k % 2 != 0:","+X = abs(X)","+k = min(K, X \/\/ D)","+X_ = X - (k * D)","+K_ = K - k","+if K_ % 2 != 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0452863958,"measured_runtime_v1":0.0904204202,"runtime_lift":0.5008425718,"key":["s808385830","s841042040"]} +{"user_id":"u905203728","problem_id":"p03418","language":"python","submission_id_v0":"s304250810","submission_id_v1":"s387365526","cpu_time_v0":175,"cpu_time_v1":118,"memory_v0":39408,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.57,"input":"N, K = list(map(int, input().split()))\n\nif K == 0:\n\n print((N * N))\n\n exit()\n\nans = 0\n\nfor b in range(K + 1, N + 1):\n\n p = N \/\/ b\n\n ans += p * max(0,b - K) + max(0, N - p * b - K + 1)\n\nprint(ans)","target":"n,k=list(map(int,input().split()))\n\nif k==0:\n\n print((n**2))\n\n exit()\n\nans=0\n\nfor i in range(k+1,n+1):\n\n p=n\/\/i\n\n q=n%i\n\n ans +=p*max(0,i-k)+max(0,q-k+1)\n\nprint(ans)","code_v0_loc":9,"code_v1_loc":10,"code_v0_num_chars":199,"code_v1_num_chars":172,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nif K == 0:\n print((N * N))\n exit()\nans = 0\nfor b in range(K + 1, N + 1):\n p = N \/\/ b\n ans += p * max(0, b - K) + max(0, N - p * b - K + 1)\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nif k == 0:\n print((n**2))\n exit()\nans = 0\nfor i in range(k + 1, n + 1):\n p = n \/\/ i\n q = n % i\n ans += p * max(0, i - k) + max(0, q - k + 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-N, K = list(map(int, input().split()))","-if K == 0:","- print((N * N))","+n, k = list(map(int, input().split()))","+if k == 0:","+ print((n**2))","-for b in range(K + 1, N + 1):","- p = N \/\/ b","- ans += p * max(0, b - K) + max(0, N - p * b - K + 1)","+for i in range(k + 1, n + 1):","+ p = n \/\/ i","+ q = n % i","+ ans += p * max(0, i - k) + max(0, q - k + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0904123783,"measured_runtime_v1":0.0425514698,"runtime_lift":2.1247768575,"key":["s304250810","s387365526"]} +{"user_id":"u794173881","problem_id":"p03003","language":"python","submission_id_v0":"s463701726","submission_id_v1":"s239952205","cpu_time_v0":327,"cpu_time_v1":195,"memory_v0":72668,"memory_v1":94220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.37,"input":"n, m = list(map(int, input().split()))\n\ns = list(map(int, input().split()))\n\nt = list(map(int, input().split()))\n\nMOD = 10**9 + 7\n\n\n\ndp = [[0]*(m+1) for i in range(n+1)]\n\nfor si in range(n+1):\n\n dp[si][0] = 1\n\nfor ti in range(m+1):\n\n dp[0][ti] = 1\n\n\n\nfor si in range(n):\n\n for ti in range(m):\n\n if s[si] == t[ti]:\n\n dp[si+1][ti+1] = dp[si][ti+1] + dp[si+1][ti]\n\n dp[si+1][ti+1] %= MOD \n\n else:\n\n dp[si+1][ti+1] = dp[si][ti+1] + dp[si+1][ti] - dp[si][ti] \n\n dp[si+1][ti+1] %= MOD\n\n\n\nprint((dp[-1][-1] % MOD))","target":"def count_cs(str1, str2, MOD):\n\n \"\"\"\u6587\u5b57\u5217str1, str2\u306e\u5171\u901a\u90e8\u5206\u5217(Common Subsequence, CS)\u3092\u6570\u3048\u4e0a\u3052\u308b\u3002\n\n \u6dfb\u5b57\u304c\u7570\u306a\u308b\u5834\u5408\u306f\u7570\u306a\u308b\u90e8\u5206\u5217\u3068\u3057\u3066\u8003\u3048\u308b\u3002\n\n \u8a08\u7b97\u91cf O(|str1||str2|)\n\n \"\"\"\n\n dp = [[0] * (len(str2) + 1) for _ in range(len(str1) + 1)]\n\n for i in range(len(str1)):\n\n for j in range(len(str2)):\n\n if str1[i] == str2[j]:\n\n dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] + 1\n\n else:\n\n dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] - dp[i][j]\n\n dp[i + 1][j + 1] %= MOD\n\n return (dp[len(str1)][len(str2)] + 1) % MOD\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\ns = list(map(int, input().split()))\n\nt = list(map(int, input().split()))\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\nprint((count_cs(s, t, MOD)))","code_v0_loc":21,"code_v1_loc":23,"code_v0_num_chars":566,"code_v1_num_chars":730,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\ns = list(map(int, input().split()))\nt = list(map(int, input().split()))\nMOD = 10**9 + 7\ndp = [[0] * (m + 1) for i in range(n + 1)]\nfor si in range(n + 1):\n dp[si][0] = 1\nfor ti in range(m + 1):\n dp[0][ti] = 1\nfor si in range(n):\n for ti in range(m):\n if s[si] == t[ti]:\n dp[si + 1][ti + 1] = dp[si][ti + 1] + dp[si + 1][ti]\n dp[si + 1][ti + 1] %= MOD\n else:\n dp[si + 1][ti + 1] = dp[si][ti + 1] + dp[si + 1][ti] - dp[si][ti]\n dp[si + 1][ti + 1] %= MOD\nprint((dp[-1][-1] % MOD))\n","code_v1_no_empty_lines":"def count_cs(str1, str2, MOD):\n \"\"\"\u6587\u5b57\u5217str1, str2\u306e\u5171\u901a\u90e8\u5206\u5217(Common Subsequence, CS)\u3092\u6570\u3048\u4e0a\u3052\u308b\u3002\n \u6dfb\u5b57\u304c\u7570\u306a\u308b\u5834\u5408\u306f\u7570\u306a\u308b\u90e8\u5206\u5217\u3068\u3057\u3066\u8003\u3048\u308b\u3002\n \u8a08\u7b97\u91cf O(|str1||str2|)\n \"\"\"\n dp = [[0] * (len(str2) + 1) for _ in range(len(str1) + 1)]\n for i in range(len(str1)):\n for j in range(len(str2)):\n if str1[i] == str2[j]:\n dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] + 1\n else:\n dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] - dp[i][j]\n dp[i + 1][j + 1] %= MOD\n return (dp[len(str1)][len(str2)] + 1) % MOD\n\n\nn, m = list(map(int, input().split()))\ns = list(map(int, input().split()))\nt = list(map(int, input().split()))\nMOD = 10**9 + 7\nprint((count_cs(s, t, MOD)))\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["+def count_cs(str1, str2, MOD):","+ \"\"\"\u6587\u5b57\u5217str1, str2\u306e\u5171\u901a\u90e8\u5206\u5217(Common Subsequence, CS)\u3092\u6570\u3048\u4e0a\u3052\u308b\u3002","+ \u6dfb\u5b57\u304c\u7570\u306a\u308b\u5834\u5408\u306f\u7570\u306a\u308b\u90e8\u5206\u5217\u3068\u3057\u3066\u8003\u3048\u308b\u3002","+ \u8a08\u7b97\u91cf O(|str1||str2|)","+ \"\"\"","+ dp = [[0] * (len(str2) + 1) for _ in range(len(str1) + 1)]","+ for i in range(len(str1)):","+ for j in range(len(str2)):","+ if str1[i] == str2[j]:","+ dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] + 1","+ else:","+ dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] - dp[i][j]","+ dp[i + 1][j + 1] %= MOD","+ return (dp[len(str1)][len(str2)] + 1) % MOD","+","+","-dp = [[0] * (m + 1) for i in range(n + 1)]","-for si in range(n + 1):","- dp[si][0] = 1","-for ti in range(m + 1):","- dp[0][ti] = 1","-for si in range(n):","- for ti in range(m):","- if s[si] == t[ti]:","- dp[si + 1][ti + 1] = dp[si][ti + 1] + dp[si + 1][ti]","- dp[si + 1][ti + 1] %= MOD","- else:","- dp[si + 1][ti + 1] = dp[si][ti + 1] + dp[si + 1][ti] - dp[si][ti]","- dp[si + 1][ti + 1] %= MOD","-print((dp[-1][-1] % MOD))","+print((count_cs(s, t, MOD)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1122694619,"measured_runtime_v1":0.0978784941,"runtime_lift":1.1470289052,"key":["s463701726","s239952205"]} +{"user_id":"u216015528","problem_id":"p02596","language":"python","submission_id_v0":"s455833609","submission_id_v1":"s543303957","cpu_time_v0":497,"cpu_time_v1":127,"memory_v0":91816,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.45,"input":"#!\/usr\/bin\/env python3\n\n\"\"\"\n\n\u6570\u5217777...\u306f\u5947\u6570\u6545\uff0cK\u304c\u5076\u6570\u3060\u3063\u305f\u3089\u00d7\n\n\n\n\"\"\"\n\nfrom numba import njit\n\n\n\n\n\n@njit(cache=True)\n\ndef func(a, b):\n\n return a * b\n\n\n\n\n\ndef main():\n\n import sys\n\n input = sys.stdin.readline\n\n\n\n K = int(eval(input()))\n\n\n\n # mod K\u3092\u8003\u3048\u308b(mod=module(\u5270\u4f59))\n\n x = 7 % K\n\n for i in range(1, K + 1):\n\n if x == 0:\n\n print(i)\n\n return\n\n x = (x * 10 + 7) % K\n\n print((-1))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"# abc173a\n\ndef main():\n\n import sys\n\n\n\n input = sys.stdin.readline\n\n\n\n K = int(eval(input()))\n\n\n\n x = 7 % K\n\n for i in range(1, K + 1):\n\n if x == 0:\n\n print(i)\n\n return\n\n x = (x * 10 + 7) % K\n\n print((-1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":31,"code_v1_loc":19,"code_v0_num_chars":462,"code_v1_num_chars":296,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\n\"\"\"\n\u6570\u5217777...\u306f\u5947\u6570\u6545\uff0cK\u304c\u5076\u6570\u3060\u3063\u305f\u3089\u00d7\n\"\"\"\nfrom numba import njit\n\n\n@njit(cache=True)\ndef func(a, b):\n return a * b\n\n\ndef main():\n import sys\n\n input = sys.stdin.readline\n K = int(eval(input()))\n # mod K\u3092\u8003\u3048\u308b(mod=module(\u5270\u4f59))\n x = 7 % K\n for i in range(1, K + 1):\n if x == 0:\n print(i)\n return\n x = (x * 10 + 7) % K\n print((-1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# abc173a\ndef main():\n import sys\n\n input = sys.stdin.readline\n K = int(eval(input()))\n x = 7 % K\n for i in range(1, K + 1):\n if x == 0:\n print(i)\n return\n x = (x * 10 + 7) % K\n print((-1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":38.7096774194,"diff":["-#!\/usr\/bin\/env python3","-\"\"\"","-\u6570\u5217777...\u306f\u5947\u6570\u6545\uff0cK\u304c\u5076\u6570\u3060\u3063\u305f\u3089\u00d7","-\"\"\"","-from numba import njit","-","-","-@njit(cache=True)","-def func(a, b):","- return a * b","-","-","+# abc173a","- # mod K\u3092\u8003\u3048\u308b(mod=module(\u5270\u4f59))"],"diff_only_import_comment":false,"measured_runtime_v0":0.03762448,"measured_runtime_v1":0.1060629404,"runtime_lift":0.3547372897,"key":["s455833609","s543303957"]} +{"user_id":"u312025627","problem_id":"p02753","language":"python","submission_id_v0":"s939701610","submission_id_v1":"s986686952","cpu_time_v0":197,"cpu_time_v1":168,"memory_v0":38384,"memory_v1":38384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.72,"input":"def main():\n\n S = eval(input())\n\n S = set(S)\n\n if len(S) == 1:\n\n print(\"No\")\n\n else:\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n S = eval(input())\n\n if len(set(s for s in S)) == 1:\n\n print(\"No\")\n\n else:\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":164,"code_v1_num_chars":164,"code_v0_no_empty_lines":"def main():\n S = eval(input())\n S = set(S)\n if len(S) == 1:\n print(\"No\")\n else:\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n S = eval(input())\n if len(set(s for s in S)) == 1:\n print(\"No\")\n else:\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["- S = set(S)","- if len(S) == 1:","+ if len(set(s for s in S)) == 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0489283288,"measured_runtime_v1":0.0492626262,"runtime_lift":0.9932139747,"key":["s939701610","s986686952"]} +{"user_id":"u148551245","problem_id":"p03385","language":"python","submission_id_v0":"s978765774","submission_id_v1":"s372837155","cpu_time_v0":162,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.51,"input":"s = list(eval(input()))\n\na = s.count(\"a\")\n\nb = s.count(\"b\")\n\nc = s.count(\"c\")\n\nif a == 1 and b == 1 and c == 1:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","target":"s = eval(input())\n\nif s.count('a') == 1 and s.count('b') == 1 and s.count('c'):\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":8,"code_v1_loc":5,"code_v0_num_chars":147,"code_v1_num_chars":115,"code_v0_no_empty_lines":"s = list(eval(input()))\na = s.count(\"a\")\nb = s.count(\"b\")\nc = s.count(\"c\")\nif a == 1 and b == 1 and c == 1:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"s = eval(input())\nif s.count(\"a\") == 1 and s.count(\"b\") == 1 and s.count(\"c\"):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-s = list(eval(input()))","-a = s.count(\"a\")","-b = s.count(\"b\")","-c = s.count(\"c\")","-if a == 1 and b == 1 and c == 1:","+s = eval(input())","+if s.count(\"a\") == 1 and s.count(\"b\") == 1 and s.count(\"c\"):"],"diff_only_import_comment":false,"measured_runtime_v0":0.1052877378,"measured_runtime_v1":0.035017266,"runtime_lift":3.0067378107,"key":["s978765774","s372837155"]} +{"user_id":"u644907318","problem_id":"p02719","language":"python","submission_id_v0":"s579271448","submission_id_v1":"s994073840","cpu_time_v0":172,"cpu_time_v1":26,"memory_v0":38384,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.88,"input":"N,K = list(map(int,input().split()))\n\nr = N%K\n\nprint((min(r,K-r)))","target":"N,K = list(map(int,input().split()))\n\nn = N%K\n\nprint((min(n,K-n)))","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":58,"code_v1_num_chars":58,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nr = N % K\nprint((min(r, K - r)))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nn = N % K\nprint((min(n, K - n)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-r = N % K","-print((min(r, K - r)))","+n = N % K","+print((min(n, K - n)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0417612448,"measured_runtime_v1":0.036719322,"runtime_lift":1.1373098011,"key":["s579271448","s994073840"]} +{"user_id":"u727760796","problem_id":"p03448","language":"python","submission_id_v0":"s230692077","submission_id_v1":"s115979902","cpu_time_v0":50,"cpu_time_v1":35,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.0,"input":"max_n500 = int(eval(input()))\n\nmax_n100 = int(eval(input()))\n\nmax_n50 = int(eval(input()))\n\namount = int(eval(input()))\n\n\n\ncount = 0\n\nfor n500 in range(max_n500 + 1):\n\n for n100 in range(max_n100 + 1):\n\n for n50 in range(max_n50 + 1):\n\n if n500 * 500 + n100 * 100 + n50 * 50 == amount:\n\n count += 1\n\nprint(count)\n","target":"max_n500 = int(eval(input()))\n\nmax_n100 = int(eval(input()))\n\nmax_n50 = int(eval(input()))\n\ntarget_amount = int(eval(input()))\n\n\n\ncount = 0\n\nfor n500 in range(max_n500 + 1):\n\n amount_500 = n500 * 500\n\n if amount_500 > target_amount:\n\n break\n\n for n100 in range(max_n100 + 1):\n\n amount_100 = n100 * 100\n\n amount_500_100 = amount_500 + amount_100\n\n if amount_500_100 > target_amount:\n\n break\n\n for n50 in range(max_n50 + 1):\n\n amount_50 = n50 * 50\n\n current_amount = amount_500_100 + amount_50\n\n if current_amount == target_amount:\n\n count += 1\n\nprint(count)\n","code_v0_loc":12,"code_v1_loc":21,"code_v0_num_chars":325,"code_v1_num_chars":636,"code_v0_no_empty_lines":"max_n500 = int(eval(input()))\nmax_n100 = int(eval(input()))\nmax_n50 = int(eval(input()))\namount = int(eval(input()))\ncount = 0\nfor n500 in range(max_n500 + 1):\n for n100 in range(max_n100 + 1):\n for n50 in range(max_n50 + 1):\n if n500 * 500 + n100 * 100 + n50 * 50 == amount:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"max_n500 = int(eval(input()))\nmax_n100 = int(eval(input()))\nmax_n50 = int(eval(input()))\ntarget_amount = int(eval(input()))\ncount = 0\nfor n500 in range(max_n500 + 1):\n amount_500 = n500 * 500\n if amount_500 > target_amount:\n break\n for n100 in range(max_n100 + 1):\n amount_100 = n100 * 100\n amount_500_100 = amount_500 + amount_100\n if amount_500_100 > target_amount:\n break\n for n50 in range(max_n50 + 1):\n amount_50 = n50 * 50\n current_amount = amount_500_100 + amount_50\n if current_amount == target_amount:\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-amount = int(eval(input()))","+target_amount = int(eval(input()))","+ amount_500 = n500 * 500","+ if amount_500 > target_amount:","+ break","+ amount_100 = n100 * 100","+ amount_500_100 = amount_500 + amount_100","+ if amount_500_100 > target_amount:","+ break","- if n500 * 500 + n100 * 100 + n50 * 50 == amount:","+ amount_50 = n50 * 50","+ current_amount = amount_500_100 + amount_50","+ if current_amount == target_amount:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1300089676,"measured_runtime_v1":0.0416024563,"runtime_lift":3.1250310456,"key":["s230692077","s115979902"]} +{"user_id":"u314050667","problem_id":"p04001","language":"python","submission_id_v0":"s564838276","submission_id_v1":"s103599745","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"def Base_10_to_n(X, n):\n\n X_dumy = X\n\n out = ''\n\n while X_dumy>0:\n\n out = str(X_dumy%n)+out\n\n X_dumy = int(X_dumy\/n)\n\n return out\n\n\n\nS = eval(input())\n\nN = len(S)-1\n\nans = 0\n\nfor n in range(2**N):\n\n\tb = Base_10_to_n(n,2).rjust(N,'0')\n\n\ttmp = []\n\n\tind = 0\n\n\tfor i in range(N):\n\n\t\tif b[i] == '1':\n\n\t\t\ttmp.append(int(S[ind:i+1]))\n\n\t\t\tind = i+1\n\n\ttmp.append(int(S[ind:]))\n\n\tans += sum(tmp)\n\n\n\nprint(ans)","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nS = readline().rstrip().decode('utf_8')\n\n\n\ndef F(S):\n\n\tyield int(S)\n\n\tfor i in range(len(S)-1):\n\n\t\tleft = S[:i+1]\n\n\t\tright = S[i+1:]\n\n\t\tx = int(left)\n\n\t\tfor y in F(right):\n\n\t\t\tyield x+y\n\n\n\nprint((sum(F(S))))","code_v0_loc":23,"code_v1_loc":17,"code_v0_num_chars":419,"code_v1_num_chars":327,"code_v0_no_empty_lines":"def Base_10_to_n(X, n):\n X_dumy = X\n out = \"\"\n while X_dumy > 0:\n out = str(X_dumy % n) + out\n X_dumy = int(X_dumy \/ n)\n return out\n\n\nS = eval(input())\nN = len(S) - 1\nans = 0\nfor n in range(2**N):\n b = Base_10_to_n(n, 2).rjust(N, \"0\")\n tmp = []\n ind = 0\n for i in range(N):\n if b[i] == \"1\":\n tmp.append(int(S[ind : i + 1]))\n ind = i + 1\n tmp.append(int(S[ind:]))\n ans += sum(tmp)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nS = readline().rstrip().decode(\"utf_8\")\n\n\ndef F(S):\n yield int(S)\n for i in range(len(S) - 1):\n left = S[: i + 1]\n right = S[i + 1 :]\n x = int(left)\n for y in F(right):\n yield x + y\n\n\nprint((sum(F(S))))\n","code_same":false,"relative_loc_diff_percent":26.0869565217,"diff":["-def Base_10_to_n(X, n):","- X_dumy = X","- out = \"\"","- while X_dumy > 0:","- out = str(X_dumy % n) + out","- X_dumy = int(X_dumy \/ n)","- return out","+import sys","+","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+S = readline().rstrip().decode(\"utf_8\")","-S = eval(input())","-N = len(S) - 1","-ans = 0","-for n in range(2**N):","- b = Base_10_to_n(n, 2).rjust(N, \"0\")","- tmp = []","- ind = 0","- for i in range(N):","- if b[i] == \"1\":","- tmp.append(int(S[ind : i + 1]))","- ind = i + 1","- tmp.append(int(S[ind:]))","- ans += sum(tmp)","-print(ans)","+def F(S):","+ yield int(S)","+ for i in range(len(S) - 1):","+ left = S[: i + 1]","+ right = S[i + 1 :]","+ x = int(left)","+ for y in F(right):","+ yield x + y","+","+","+print((sum(F(S))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422370434,"measured_runtime_v1":0.0416826725,"runtime_lift":1.0132997919,"key":["s564838276","s103599745"]} +{"user_id":"u394731058","problem_id":"p02911","language":"python","submission_id_v0":"s221427108","submission_id_v1":"s918446718","cpu_time_v0":125,"cpu_time_v1":88,"memory_v0":6620,"memory_v1":6996,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.6,"input":"import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n N, K, Q = list(map(int, input().split()))\n\n a = [K-Q]*N\n\n for _ in range(Q):\n\n a[int(eval(input()))-1] += 1\n\n for i in range(N):\n\n if a[i] > 0:\n\n print('Yes')\n\n else:\n\n print('No')\n\n\n\nif __name__ == '__main__':\n\n main()","target":"import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n ans = ''\n\n N, K, Q = list(map(int, input().split()))\n\n a = [K-Q]*N\n\n for _ in range(Q):\n\n a[int(eval(input()))-1] += 1\n\n for i in a:\n\n if i > 0:\n\n ans += 'Yes'\n\n else:\n\n ans += 'No'\n\n ans += '\\n'\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":17,"code_v1_loc":20,"code_v0_num_chars":323,"code_v1_num_chars":360,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N, K, Q = list(map(int, input().split()))\n a = [K - Q] * N\n for _ in range(Q):\n a[int(eval(input())) - 1] += 1\n for i in range(N):\n if a[i] > 0:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n ans = \"\"\n N, K, Q = list(map(int, input().split()))\n a = [K - Q] * N\n for _ in range(Q):\n a[int(eval(input())) - 1] += 1\n for i in a:\n if i > 0:\n ans += \"Yes\"\n else:\n ans += \"No\"\n ans += \"\\n\"\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["+ ans = \"\"","- for i in range(N):","- if a[i] > 0:","- print(\"Yes\")","+ for i in a:","+ if i > 0:","+ ans += \"Yes\"","- print(\"No\")","+ ans += \"No\"","+ ans += \"\\n\"","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0408627365,"measured_runtime_v1":0.0366460361,"runtime_lift":1.1150656591,"key":["s221427108","s918446718"]} +{"user_id":"u497596438","problem_id":"p03479","language":"python","submission_id_v0":"s195541955","submission_id_v1":"s903262670","cpu_time_v0":182,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.66,"input":"X,Y=list(map(int,input().split()))\n\nnow=X\n\nnum=1\n\nwhile(now<=Y):\n\n if now*2>Y:\n\n break\n\n now=now*2\n\n num+=1\n\nprint(num)","target":"X,Y=list(map(int,input().split()))\n\nans=1\n\nwhile(2*X<=Y):\n\n X*=2\n\n ans+=1\n\nprint(ans)\n","code_v0_loc":9,"code_v1_loc":6,"code_v0_num_chars":129,"code_v1_num_chars":86,"code_v0_no_empty_lines":"X, Y = list(map(int, input().split()))\nnow = X\nnum = 1\nwhile now <= Y:\n if now * 2 > Y:\n break\n now = now * 2\n num += 1\nprint(num)\n","code_v1_no_empty_lines":"X, Y = list(map(int, input().split()))\nans = 1\nwhile 2 * X <= Y:\n X *= 2\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-now = X","-num = 1","-while now <= Y:","- if now * 2 > Y:","- break","- now = now * 2","- num += 1","-print(num)","+ans = 1","+while 2 * X <= Y:","+ X *= 2","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.100601675,"measured_runtime_v1":0.0473226833,"runtime_lift":2.12586582,"key":["s195541955","s903262670"]} +{"user_id":"u796942881","problem_id":"p03240","language":"python","submission_id_v0":"s737840921","submission_id_v1":"s785063118","cpu_time_v0":177,"cpu_time_v1":92,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.02,"input":"N = int(eval(input()))\n\n\n\nxn = [0] * N\n\nyn = [0] * N\n\nhn = [0] * N\n\n\n\nxyh = [[int(j) for j in input().split()] for i in range(N)]\n\n\n\ndiv = 0\n\n\n\nfor Cx in range(101):\n\n for Cy in range(101):\n\n for i in range(N):\n\n\n\n xi, yi, hi = xyh[i]\n\n\n\n if 0 < hi:\n\n h = abs(xi - Cx) + abs(yi - Cy) + hi\n\n if div in [0, 2]:\n\n H = h\n\n div = 1\n\n else:\n\n if (H != h):\n\n div = 2\n\n break\n\n\n\n if div == 2:\n\n continue\n\n\n\n for i in range(N):\n\n xi, yi, hi = xyh[i]\n\n\n\n if 0 == hi:\n\n h = abs(xi - Cx) + abs(yi - Cy)\n\n if h < H:\n\n div = 2\n\n break\n\n\n\n if div == 2:\n\n continue\n\n\n\n print((Cx, Cy, H))\n\n break\n\n\n\n if div == 1:\n\n break\n","target":"def solve():\n\n for Cx in range(101):\n\n for Cy in range(101):\n\n div = 0\n\n for i in range(N):\n\n\n\n xi, yi, hi = xyh[i]\n\n\n\n if 0 < hi:\n\n h = abs(xi - Cx) + abs(yi - Cy) + hi\n\n if div in [0, 2]:\n\n H = h\n\n div = 1\n\n else:\n\n if (H != h):\n\n div = 2\n\n break\n\n\n\n if div == 2:\n\n continue\n\n\n\n for i in range(N):\n\n xi, yi, hi = xyh[i]\n\n\n\n if 0 == hi:\n\n h = abs(xi - Cx) + abs(yi - Cy)\n\n if h < H:\n\n div = 2\n\n break\n\n\n\n if div == 2:\n\n continue\n\n\n\n return Cx, Cy, H\n\n\n\n\n\nN = int(eval(input()))\n\n\n\nxn = [0] * N\n\nyn = [0] * N\n\nhn = [0] * N\n\n\n\nxyh = [[int(j) for j in input().split()] for i in range(N)]\n\n\n\nCx, Cy, H = solve()\n\n\n\nprint((Cx, Cy, H))\n","code_v0_loc":46,"code_v1_loc":47,"code_v0_num_chars":934,"code_v1_num_chars":1053,"code_v0_no_empty_lines":"N = int(eval(input()))\nxn = [0] * N\nyn = [0] * N\nhn = [0] * N\nxyh = [[int(j) for j in input().split()] for i in range(N)]\ndiv = 0\nfor Cx in range(101):\n for Cy in range(101):\n for i in range(N):\n xi, yi, hi = xyh[i]\n if 0 < hi:\n h = abs(xi - Cx) + abs(yi - Cy) + hi\n if div in [0, 2]:\n H = h\n div = 1\n else:\n if H != h:\n div = 2\n break\n if div == 2:\n continue\n for i in range(N):\n xi, yi, hi = xyh[i]\n if 0 == hi:\n h = abs(xi - Cx) + abs(yi - Cy)\n if h < H:\n div = 2\n break\n if div == 2:\n continue\n print((Cx, Cy, H))\n break\n if div == 1:\n break\n","code_v1_no_empty_lines":"def solve():\n for Cx in range(101):\n for Cy in range(101):\n div = 0\n for i in range(N):\n xi, yi, hi = xyh[i]\n if 0 < hi:\n h = abs(xi - Cx) + abs(yi - Cy) + hi\n if div in [0, 2]:\n H = h\n div = 1\n else:\n if H != h:\n div = 2\n break\n if div == 2:\n continue\n for i in range(N):\n xi, yi, hi = xyh[i]\n if 0 == hi:\n h = abs(xi - Cx) + abs(yi - Cy)\n if h < H:\n div = 2\n break\n if div == 2:\n continue\n return Cx, Cy, H\n\n\nN = int(eval(input()))\nxn = [0] * N\nyn = [0] * N\nhn = [0] * N\nxyh = [[int(j) for j in input().split()] for i in range(N)]\nCx, Cy, H = solve()\nprint((Cx, Cy, H))\n","code_same":false,"relative_loc_diff_percent":2.1276595745,"diff":["+def solve():","+ for Cx in range(101):","+ for Cy in range(101):","+ div = 0","+ for i in range(N):","+ xi, yi, hi = xyh[i]","+ if 0 < hi:","+ h = abs(xi - Cx) + abs(yi - Cy) + hi","+ if div in [0, 2]:","+ H = h","+ div = 1","+ else:","+ if H != h:","+ div = 2","+ break","+ if div == 2:","+ continue","+ for i in range(N):","+ xi, yi, hi = xyh[i]","+ if 0 == hi:","+ h = abs(xi - Cx) + abs(yi - Cy)","+ if h < H:","+ div = 2","+ break","+ if div == 2:","+ continue","+ return Cx, Cy, H","+","+","-div = 0","-for Cx in range(101):","- for Cy in range(101):","- for i in range(N):","- xi, yi, hi = xyh[i]","- if 0 < hi:","- h = abs(xi - Cx) + abs(yi - Cy) + hi","- if div in [0, 2]:","- H = h","- div = 1","- else:","- if H != h:","- div = 2","- break","- if div == 2:","- continue","- for i in range(N):","- xi, yi, hi = xyh[i]","- if 0 == hi:","- h = abs(xi - Cx) + abs(yi - Cy)","- if h < H:","- div = 2","- break","- if div == 2:","- continue","- print((Cx, Cy, H))","- break","- if div == 1:","- break","+Cx, Cy, H = solve()","+print((Cx, Cy, H))"],"diff_only_import_comment":false,"measured_runtime_v0":0.100743844,"measured_runtime_v1":0.0408559768,"runtime_lift":2.465828793,"key":["s737840921","s785063118"]} +{"user_id":"u827202523","problem_id":"p02660","language":"python","submission_id_v0":"s923256498","submission_id_v1":"s727948711","cpu_time_v0":514,"cpu_time_v1":198,"memory_v0":72780,"memory_v1":148820,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.48,"input":"def getN():\n\n return int(eval(input()))\n\ndef getNM():\n\n return list(map(int, input().split()))\n\ndef getList():\n\n return list(map(int, input().split()))\n\n\n\nfrom collections import defaultdict, deque\n\nfrom sys import exit\n\nimport math\n\nimport copy\n\nfrom bisect import bisect_left, bisect_right\n\nfrom heapq import *\n\nimport sys\n\n# sys.setrecursionlimit(1000000)\n\nINF = 10 ** 17\n\nMOD = 1000000007\n\n\n\nfrom fractions import *\n\ndef inverse(f):\n\n # return Fraction(f.denominator,f.numerator)\n\n return 1\/f\n\n\n\n\n\ndef combmod(n, k, mod=MOD):\n\n ret = 1\n\n for i in range(n - k + 1, n + 1):\n\n ret *= i\n\n ret %= mod\n\n\n\n for i in range(1, k + 1):\n\n ret *= pow(i, mod - 2, mod)\n\n ret %= mod\n\n\n\n return ret\n\ndef bunsu(n):\n\n ret = []\n\n for i in range(2, int(math.sqrt(n)) + 1):\n\n if n % i == 0:\n\n tmp = 0\n\n while(True):\n\n if n % i == 0:\n\n tmp += 1\n\n n \/\/= i\n\n else:\n\n break\n\n ret.append((i, tmp))\n\n\n\n ret.append((n, 1))\n\n return ret\n\n\n\ndef solve():\n\n n = getN()\n\n bun = bunsu(n)\n\n # print(bun)\n\n acc = []\n\n tmp = 0\n\n for i in range(10000):\n\n tmp += i\n\n acc.append(tmp)\n\n ans = 0\n\n for b, cnt in bun:\n\n if b == 1:\n\n continue\n\n ans += bisect_right(acc, cnt) - 1\n\n print(ans)\n\ndef main():\n\n # n = getN()\n\n # for _ in range(n):\n\n solve()\n\nif __name__ == \"__main__\":\n\n solve()\n","target":"def getN():\n\n return int(eval(input()))\n\n\n\n\n\ndef getNM():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef getList():\n\n return list(map(int, input().split()))\n\n\n\n\n\nfrom collections import defaultdict, deque, Counter\n\nfrom sys import exit\n\nimport math\n\nimport copy\n\nfrom bisect import bisect_left, bisect_right\n\nfrom heapq import *\n\nimport sys\n\n\n\n# sys.setrecursionlimit(1000000)\n\nINF = 10 ** 17\n\nMOD = 1000000007\n\n\n\nfrom fractions import *\n\n\n\n\n\ndef inverse(f):\n\n # return Fraction(f.denominator,f.numerator)\n\n return 1 \/ f\n\n\n\n\n\ndef combmod(n, k, mod=MOD):\n\n ret = 1\n\n for i in range(n - k + 1, n + 1):\n\n ret *= i\n\n ret %= mod\n\n\n\n for i in range(1, k + 1):\n\n ret *= pow(i, mod - 2, mod)\n\n ret %= mod\n\n\n\n return ret\n\n\n\nMOD = 10 ** 9 + 7\n\n\n\ndef yaku(n):\n\n res = []\n\n for i in range(2, int(math.sqrt(n)) + 2):\n\n tmp = 0\n\n while(True):\n\n if n % i == 0:\n\n tmp += 1\n\n n \/\/= i\n\n else:\n\n break\n\n if tmp != 0:\n\n res.append((tmp, i))\n\n if n != 1:\n\n res.append((1, n))\n\n return res\n\n\n\ndef solve():\n\n n = getN()\n\n acc = [0]\n\n tmp = 0\n\n for i in range(1, 10**6):\n\n tmp += i\n\n acc.append(tmp)\n\n\n\n res = yaku(n)\n\n ans = 0\n\n for y in res:\n\n ans += bisect_right(acc, y[0]) - 1\n\n # print(res)\n\n print(ans)\n\n\n\ndef main():\n\n n = getN()\n\n for _ in range(n):\n\n solve()\n\n\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":72,"code_v1_loc":85,"code_v0_num_chars":1512,"code_v1_num_chars":1513,"code_v0_no_empty_lines":"def getN():\n return int(eval(input()))\n\n\ndef getNM():\n return list(map(int, input().split()))\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\nfrom collections import defaultdict, deque\nfrom sys import exit\nimport math\nimport copy\nfrom bisect import bisect_left, bisect_right\nfrom heapq import *\nimport sys\n\n# sys.setrecursionlimit(1000000)\nINF = 10**17\nMOD = 1000000007\nfrom fractions import *\n\n\ndef inverse(f):\n # return Fraction(f.denominator,f.numerator)\n return 1 \/ f\n\n\ndef combmod(n, k, mod=MOD):\n ret = 1\n for i in range(n - k + 1, n + 1):\n ret *= i\n ret %= mod\n for i in range(1, k + 1):\n ret *= pow(i, mod - 2, mod)\n ret %= mod\n return ret\n\n\ndef bunsu(n):\n ret = []\n for i in range(2, int(math.sqrt(n)) + 1):\n if n % i == 0:\n tmp = 0\n while True:\n if n % i == 0:\n tmp += 1\n n \/\/= i\n else:\n break\n ret.append((i, tmp))\n ret.append((n, 1))\n return ret\n\n\ndef solve():\n n = getN()\n bun = bunsu(n)\n # print(bun)\n acc = []\n tmp = 0\n for i in range(10000):\n tmp += i\n acc.append(tmp)\n ans = 0\n for b, cnt in bun:\n if b == 1:\n continue\n ans += bisect_right(acc, cnt) - 1\n print(ans)\n\n\ndef main():\n # n = getN()\n # for _ in range(n):\n solve()\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"def getN():\n return int(eval(input()))\n\n\ndef getNM():\n return list(map(int, input().split()))\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\nfrom collections import defaultdict, deque, Counter\nfrom sys import exit\nimport math\nimport copy\nfrom bisect import bisect_left, bisect_right\nfrom heapq import *\nimport sys\n\n# sys.setrecursionlimit(1000000)\nINF = 10**17\nMOD = 1000000007\nfrom fractions import *\n\n\ndef inverse(f):\n # return Fraction(f.denominator,f.numerator)\n return 1 \/ f\n\n\ndef combmod(n, k, mod=MOD):\n ret = 1\n for i in range(n - k + 1, n + 1):\n ret *= i\n ret %= mod\n for i in range(1, k + 1):\n ret *= pow(i, mod - 2, mod)\n ret %= mod\n return ret\n\n\nMOD = 10**9 + 7\n\n\ndef yaku(n):\n res = []\n for i in range(2, int(math.sqrt(n)) + 2):\n tmp = 0\n while True:\n if n % i == 0:\n tmp += 1\n n \/\/= i\n else:\n break\n if tmp != 0:\n res.append((tmp, i))\n if n != 1:\n res.append((1, n))\n return res\n\n\ndef solve():\n n = getN()\n acc = [0]\n tmp = 0\n for i in range(1, 10**6):\n tmp += i\n acc.append(tmp)\n res = yaku(n)\n ans = 0\n for y in res:\n ans += bisect_right(acc, y[0]) - 1\n # print(res)\n print(ans)\n\n\ndef main():\n n = getN()\n for _ in range(n):\n solve()\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":15.2941176471,"diff":["-from collections import defaultdict, deque","+from collections import defaultdict, deque, Counter","-def bunsu(n):","- ret = []","- for i in range(2, int(math.sqrt(n)) + 1):","- if n % i == 0:","- tmp = 0","- while True:","- if n % i == 0:","- tmp += 1","- n \/\/= i","- else:","- break","- ret.append((i, tmp))","- ret.append((n, 1))","- return ret","+MOD = 10**9 + 7","+","+","+def yaku(n):","+ res = []","+ for i in range(2, int(math.sqrt(n)) + 2):","+ tmp = 0","+ while True:","+ if n % i == 0:","+ tmp += 1","+ n \/\/= i","+ else:","+ break","+ if tmp != 0:","+ res.append((tmp, i))","+ if n != 1:","+ res.append((1, n))","+ return res","- bun = bunsu(n)","- # print(bun)","- acc = []","+ acc = [0]","- for i in range(10000):","+ for i in range(1, 10**6):","+ res = yaku(n)","- for b, cnt in bun:","- if b == 1:","- continue","- ans += bisect_right(acc, cnt) - 1","+ for y in res:","+ ans += bisect_right(acc, y[0]) - 1","+ # print(res)","- # n = getN()","- # for _ in range(n):","- solve()","+ n = getN()","+ for _ in range(n):","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0681701602,"measured_runtime_v1":0.5343420379,"runtime_lift":0.1275777599,"key":["s923256498","s727948711"]} +{"user_id":"u065446124","problem_id":"p02599","language":"python","submission_id_v0":"s579105869","submission_id_v1":"s586742298","cpu_time_v0":1911,"cpu_time_v1":1747,"memory_v0":222140,"memory_v1":268428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.58,"input":"import sys\n\ndef input():return sys.stdin.readline()[:-1]\n\ndef N(): return int(eval(input()))\n\ndef NM():return list(map(int,input().split()))\n\ndef L():return list(NM())\n\nn,q=NM()\n\nc=[0]+L()\n\nQ=[L()+[i] for i in range(q)]\n\nQ.sort(key=lambda x:x[1])\n\nans=[0]*(q)\n\nlastapp=[0 for i in range(n+1)]\n\n\n\nNo=2\n\nwhile No<=n:\n\n No*=2\n\ntree=[0]*(2*No)\n\n\n\ndef update(k,x):\n\n k+=No-1\n\n tree[k]=x\n\n while k>0:\n\n k=(k-1)\/\/2\n\n tree[k]=tree[k*2+1]+tree[k*2+2]\n\n\n\ndef add(k,x):\n\n k+=No-1\n\n while k>=0:\n\n tree[k]+=x\n\n k=(k-1)\/\/2\n\n\n\ndef query(l,r):\n\n L=l+No-1\n\n R=r+No-1\n\n s=0\n\n while L<=R:\n\n if R&1:\n\n s+=tree[R]\n\n R-=2\n\n else:\n\n R-=1\n\n if L&1:\n\n L-=1\n\n else:\n\n s+=tree[L]\n\n L>>=1;R>>=1\n\n return s\n\nj=1\n\nfor l,r,i in Q:\n\n while j<=r:\n\n t=c[j]\n\n add(lastapp[t],-1)\n\n add(j,1)\n\n lastapp[t]=j\n\n j+=1\n\n ans[i]=query(l,r)\n\nfor i in ans:\n\n print(i)","target":"import sys\n\ndef input():return sys.stdin.readline()[:-1]\n\ndef N(): return int(eval(input()))\n\ndef NM():return list(map(int,input().split()))\n\ndef L():return list(NM())\n\nn,q=NM()\n\nc=[0]+L()\n\nQ=[L()+[i] for i in range(q)]\n\nQ.sort(key=lambda x:x[1])\n\nans=[0]*(q)\n\nlastapp=[0 for i in range(n+1)]\n\n\n\nNo=2\n\nwhile No<=n:\n\n No*=2\n\nBIT=[0]*(No+1)\n\ndef addbit(i,x):\n\n while i<=No:\n\n BIT[i]+=x\n\n i+= i&-i\n\ndef getsum(i):\n\n s=0\n\n while i:\n\n s+=BIT[i]\n\n i-= i&-i\n\n return s\n\ndef sumbit(l,r):\n\n return getsum(r)-getsum(l-1)\n\n\n\nj=1\n\nfor l,r,i in Q:\n\n while j<=r:\n\n t=c[j]\n\n if lastapp[t]:\n\n addbit(lastapp[t],-1)\n\n addbit(j,1)\n\n lastapp[t]=j\n\n j+=1\n\n ans[i]=sumbit(l,r)\n\nfor i in ans:\n\n print(i)","code_v0_loc":57,"code_v1_loc":41,"code_v0_num_chars":1005,"code_v1_num_chars":770,"code_v0_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\ndef N():\n return int(eval(input()))\n\n\ndef NM():\n return list(map(int, input().split()))\n\n\ndef L():\n return list(NM())\n\n\nn, q = NM()\nc = [0] + L()\nQ = [L() + [i] for i in range(q)]\nQ.sort(key=lambda x: x[1])\nans = [0] * (q)\nlastapp = [0 for i in range(n + 1)]\nNo = 2\nwhile No <= n:\n No *= 2\ntree = [0] * (2 * No)\n\n\ndef update(k, x):\n k += No - 1\n tree[k] = x\n while k > 0:\n k = (k - 1) \/\/ 2\n tree[k] = tree[k * 2 + 1] + tree[k * 2 + 2]\n\n\ndef add(k, x):\n k += No - 1\n while k >= 0:\n tree[k] += x\n k = (k - 1) \/\/ 2\n\n\ndef query(l, r):\n L = l + No - 1\n R = r + No - 1\n s = 0\n while L <= R:\n if R & 1:\n s += tree[R]\n R -= 2\n else:\n R -= 1\n if L & 1:\n L -= 1\n else:\n s += tree[L]\n L >>= 1\n R >>= 1\n return s\n\n\nj = 1\nfor l, r, i in Q:\n while j <= r:\n t = c[j]\n add(lastapp[t], -1)\n add(j, 1)\n lastapp[t] = j\n j += 1\n ans[i] = query(l, r)\nfor i in ans:\n print(i)\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\ndef N():\n return int(eval(input()))\n\n\ndef NM():\n return list(map(int, input().split()))\n\n\ndef L():\n return list(NM())\n\n\nn, q = NM()\nc = [0] + L()\nQ = [L() + [i] for i in range(q)]\nQ.sort(key=lambda x: x[1])\nans = [0] * (q)\nlastapp = [0 for i in range(n + 1)]\nNo = 2\nwhile No <= n:\n No *= 2\nBIT = [0] * (No + 1)\n\n\ndef addbit(i, x):\n while i <= No:\n BIT[i] += x\n i += i & -i\n\n\ndef getsum(i):\n s = 0\n while i:\n s += BIT[i]\n i -= i & -i\n return s\n\n\ndef sumbit(l, r):\n return getsum(r) - getsum(l - 1)\n\n\nj = 1\nfor l, r, i in Q:\n while j <= r:\n t = c[j]\n if lastapp[t]:\n addbit(lastapp[t], -1)\n addbit(j, 1)\n lastapp[t] = j\n j += 1\n ans[i] = sumbit(l, r)\nfor i in ans:\n print(i)\n","code_same":false,"relative_loc_diff_percent":28.0701754386,"diff":["-tree = [0] * (2 * No)","+BIT = [0] * (No + 1)","-def update(k, x):","- k += No - 1","- tree[k] = x","- while k > 0:","- k = (k - 1) \/\/ 2","- tree[k] = tree[k * 2 + 1] + tree[k * 2 + 2]","+def addbit(i, x):","+ while i <= No:","+ BIT[i] += x","+ i += i & -i","-def add(k, x):","- k += No - 1","- while k >= 0:","- tree[k] += x","- k = (k - 1) \/\/ 2","+def getsum(i):","+ s = 0","+ while i:","+ s += BIT[i]","+ i -= i & -i","+ return s","-def query(l, r):","- L = l + No - 1","- R = r + No - 1","- s = 0","- while L <= R:","- if R & 1:","- s += tree[R]","- R -= 2","- else:","- R -= 1","- if L & 1:","- L -= 1","- else:","- s += tree[L]","- L >>= 1","- R >>= 1","- return s","+def sumbit(l, r):","+ return getsum(r) - getsum(l - 1)","- add(lastapp[t], -1)","- add(j, 1)","+ if lastapp[t]:","+ addbit(lastapp[t], -1)","+ addbit(j, 1)","- ans[i] = query(l, r)","+ ans[i] = sumbit(l, r)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1168681503,"measured_runtime_v1":0.1162624772,"runtime_lift":1.0052095324,"key":["s579105869","s586742298"]} +{"user_id":"u188827677","problem_id":"p02784","language":"python","submission_id_v0":"s706702880","submission_id_v1":"s870000895","cpu_time_v0":51,"cpu_time_v1":42,"memory_v0":10132,"memory_v1":14092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.65,"input":"# -*- coding:utf-8 -*-\n\nh,n = list(map(int, input().split()))\n\n\n\nfor i in map(int, input().split()):\n\n h -= i\n\nif h <= 0 :\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n ","target":"h,n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\nb = sum(a)\n\n\n\nif h <= b:\n\n print('Yes')\n\nelse:\n\n print('No')","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":159,"code_v1_num_chars":134,"code_v0_no_empty_lines":"# -*- coding:utf-8 -*-\nh, n = list(map(int, input().split()))\nfor i in map(int, input().split()):\n h -= i\nif h <= 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"h, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = sum(a)\nif h <= b:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-# -*- coding:utf-8 -*-","-for i in map(int, input().split()):","- h -= i","-if h <= 0:","+a = list(map(int, input().split()))","+b = sum(a)","+if h <= b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0397366347,"measured_runtime_v1":0.0459563618,"runtime_lift":0.8646601513,"key":["s706702880","s870000895"]} +{"user_id":"u191874006","problem_id":"p02949","language":"python","submission_id_v0":"s444492682","submission_id_v1":"s340305243","cpu_time_v0":1844,"cpu_time_v1":610,"memory_v0":53596,"memory_v1":77140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.92,"input":"#!\/usr\/bin\/env python3\n\n#ABC137 E\n\n\n\nimport sys\n\nimport math\n\nimport bisect\n\nsys.setrecursionlimit(1000000000)\n\nfrom heapq import heappush, heappop\n\nfrom collections import defaultdict\n\nfrom itertools import accumulate\n\nfrom collections import Counter\n\nfrom collections import deque\n\nfrom operator import itemgetter\n\nfrom itertools import permutations\n\nmod = 10**9 + 7\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\n\n\ndef Bellman_Ford(edges,num_v, start):\n\n #start \u2192 i\u306e\u6700\u77ed\u8ddd\u96e2\n\n #start:\u59cb\u70b9, num_v:\u9802\u70b9\u6570, edges:[\u8fba\u306e\u59cb\u70b9, \u8fba\u306e\u7d42\u70b9, \u8fba\u306e\u30b3\u30b9\u30c8]\n\n dist = [-float('inf') for _ in range(num_v)]\n\n #dist[i] := s\u2192i\u306e\u6700\u77ed\u8ddd\u96e2\n\n dist[start] = 0\n\n flg = 0\n\n for i in range(num_v):\n\n update = False\n\n for edge in edges:\n\n e_from, e_to, e_cost = edge\n\n if e_from != -float('inf') and visited[e_to] and dist[e_to] < dist[e_from] + e_cost:\n\n dist[e_to] = dist[e_from] + e_cost\n\n update = True\n\n if not update:\n\n flg = 1\n\n break\n\n return dist, flg\n\n\n\nn,m,p = LI()\n\nedge = []\n\nf = defaultdict(dict)\n\nfor _ in range(m):\n\n a,b,c = LI()\n\n edge.append([a-1,b-1,c-p])\n\n f[b-1][a-1] = 1\n\nvisited = [False]*n\n\ndef dfs(x):\n\n visited[x] = True\n\n for t in list(f[x].keys()):\n\n if not visited[t]:\n\n dfs(t)\n\ndfs(n-1)\n\nd,f = Bellman_Ford(edge,n,0)\n\nif not f:\n\n print((-1))\n\nelse:\n\n print((max(0,d[-1])))\n","target":"#!\/usr\/bin\/env python3\n\n\n\nimport sys\n\nimport math\n\nfrom bisect import bisect_right as br\n\nfrom bisect import bisect_left as bl\n\nsys.setrecursionlimit(2147483647)\n\nfrom heapq import heappush, heappop,heappushpop\n\nfrom collections import defaultdict\n\nfrom itertools import accumulate\n\nfrom collections import Counter\n\nfrom collections import deque\n\nfrom operator import itemgetter\n\nfrom itertools import permutations\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\n\n\nn, m, p = LI()\n\nabc = [LI() for _ in range(m)]\n\nedges = [[] for _ in range(n)]\n\ninv_edges = [[] for _ in range(n)]\n\nfor a, b, c in abc:\n\n edges[a-1].append((b-1, c))\n\n inv_edges[b-1].append(a-1)\n\n\n\nvisited = [False] * n\n\nstack = [n-1]\n\nwhile stack:\n\n v = stack.pop()\n\n visited[v] = True\n\n for u in inv_edges[v]:\n\n if visited[u]:\n\n continue\n\n stack.append(u)\n\n\n\ndp = [-float('inf')] * n\n\ndp[0] = 0\n\ntmp = -1\n\nfor _ in range(n+1):\n\n flag = False\n\n for v in range(n):\n\n score = dp[v]\n\n for u, c in edges[v]:\n\n if dp[u] < score + c - p and visited[u]:\n\n dp[u] = score + c - p\n\n flag = True\n\nif flag:\n\n print((-1))\n\nelse:\n\n print((max(0, dp[n-1])))","code_v0_loc":56,"code_v1_loc":52,"code_v0_num_chars":1458,"code_v1_num_chars":1306,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\n# ABC137 E\nimport sys\nimport math\nimport bisect\n\nsys.setrecursionlimit(1000000000)\nfrom heapq import heappush, heappop\nfrom collections import defaultdict\nfrom itertools import accumulate\nfrom collections import Counter\nfrom collections import deque\nfrom operator import itemgetter\nfrom itertools import permutations\n\nmod = 10**9 + 7\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef Bellman_Ford(edges, num_v, start):\n # start \u2192 i\u306e\u6700\u77ed\u8ddd\u96e2\n # start:\u59cb\u70b9, num_v:\u9802\u70b9\u6570, edges:[\u8fba\u306e\u59cb\u70b9, \u8fba\u306e\u7d42\u70b9, \u8fba\u306e\u30b3\u30b9\u30c8]\n dist = [-float(\"inf\") for _ in range(num_v)]\n # dist[i] := s\u2192i\u306e\u6700\u77ed\u8ddd\u96e2\n dist[start] = 0\n flg = 0\n for i in range(num_v):\n update = False\n for edge in edges:\n e_from, e_to, e_cost = edge\n if (\n e_from != -float(\"inf\")\n and visited[e_to]\n and dist[e_to] < dist[e_from] + e_cost\n ):\n dist[e_to] = dist[e_from] + e_cost\n update = True\n if not update:\n flg = 1\n break\n return dist, flg\n\n\nn, m, p = LI()\nedge = []\nf = defaultdict(dict)\nfor _ in range(m):\n a, b, c = LI()\n edge.append([a - 1, b - 1, c - p])\n f[b - 1][a - 1] = 1\nvisited = [False] * n\n\n\ndef dfs(x):\n visited[x] = True\n for t in list(f[x].keys()):\n if not visited[t]:\n dfs(t)\n\n\ndfs(n - 1)\nd, f = Bellman_Ford(edge, n, 0)\nif not f:\n print((-1))\nelse:\n print((max(0, d[-1])))\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nimport math\nfrom bisect import bisect_right as br\nfrom bisect import bisect_left as bl\n\nsys.setrecursionlimit(2147483647)\nfrom heapq import heappush, heappop, heappushpop\nfrom collections import defaultdict\nfrom itertools import accumulate\nfrom collections import Counter\nfrom collections import deque\nfrom operator import itemgetter\nfrom itertools import permutations\n\nmod = 10**9 + 7\ninf = float(\"inf\")\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn, m, p = LI()\nabc = [LI() for _ in range(m)]\nedges = [[] for _ in range(n)]\ninv_edges = [[] for _ in range(n)]\nfor a, b, c in abc:\n edges[a - 1].append((b - 1, c))\n inv_edges[b - 1].append(a - 1)\nvisited = [False] * n\nstack = [n - 1]\nwhile stack:\n v = stack.pop()\n visited[v] = True\n for u in inv_edges[v]:\n if visited[u]:\n continue\n stack.append(u)\ndp = [-float(\"inf\")] * n\ndp[0] = 0\ntmp = -1\nfor _ in range(n + 1):\n flag = False\n for v in range(n):\n score = dp[v]\n for u, c in edges[v]:\n if dp[u] < score + c - p and visited[u]:\n dp[u] = score + c - p\n flag = True\nif flag:\n print((-1))\nelse:\n print((max(0, dp[n - 1])))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-# ABC137 E","-import bisect","+from bisect import bisect_right as br","+from bisect import bisect_left as bl","-sys.setrecursionlimit(1000000000)","-from heapq import heappush, heappop","+sys.setrecursionlimit(2147483647)","+from heapq import heappush, heappop, heappushpop","+inf = float(\"inf\")","-def Bellman_Ford(edges, num_v, start):","- # start \u2192 i\u306e\u6700\u77ed\u8ddd\u96e2","- # start:\u59cb\u70b9, num_v:\u9802\u70b9\u6570, edges:[\u8fba\u306e\u59cb\u70b9, \u8fba\u306e\u7d42\u70b9, \u8fba\u306e\u30b3\u30b9\u30c8]","- dist = [-float(\"inf\") for _ in range(num_v)]","- # dist[i] := s\u2192i\u306e\u6700\u77ed\u8ddd\u96e2","- dist[start] = 0","- flg = 0","- for i in range(num_v):","- update = False","- for edge in edges:","- e_from, e_to, e_cost = edge","- if (","- e_from != -float(\"inf\")","- and visited[e_to]","- and dist[e_to] < dist[e_from] + e_cost","- ):","- dist[e_to] = dist[e_from] + e_cost","- update = True","- if not update:","- flg = 1","- break","- return dist, flg","-","-","-edge = []","-f = defaultdict(dict)","-for _ in range(m):","- a, b, c = LI()","- edge.append([a - 1, b - 1, c - p])","- f[b - 1][a - 1] = 1","+abc = [LI() for _ in range(m)]","+edges = [[] for _ in range(n)]","+inv_edges = [[] for _ in range(n)]","+for a, b, c in abc:","+ edges[a - 1].append((b - 1, c))","+ inv_edges[b - 1].append(a - 1)","-","-","-def dfs(x):","- visited[x] = True","- for t in list(f[x].keys()):","- if not visited[t]:","- dfs(t)","-","-","-dfs(n - 1)","-d, f = Bellman_Ford(edge, n, 0)","-if not f:","+stack = [n - 1]","+while stack:","+ v = stack.pop()","+ visited[v] = True","+ for u in inv_edges[v]:","+ if visited[u]:","+ continue","+ stack.append(u)","+dp = [-float(\"inf\")] * n","+dp[0] = 0","+tmp = -1","+for _ in range(n + 1):","+ flag = False","+ for v in range(n):","+ score = dp[v]","+ for u, c in edges[v]:","+ if dp[u] < score + c - p and visited[u]:","+ dp[u] = score + c - p","+ flag = True","+if flag:","- print((max(0, d[-1])))","+ print((max(0, dp[n - 1])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1133301637,"measured_runtime_v1":0.0978484454,"runtime_lift":1.1582214027,"key":["s444492682","s340305243"]} +{"user_id":"u514118270","problem_id":"p02659","language":"python","submission_id_v0":"s220641662","submission_id_v1":"s759550177","cpu_time_v0":29,"cpu_time_v1":24,"memory_v0":10076,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.24,"input":"import math\n\nfrom decimal import Decimal\n\nA,B = list(map(Decimal,input().split()))\n\nprint((math.floor(A*B)))","target":"A,B = input().split()\n\nA = int(A)\n\nB1,B2 = list(map(int,B.split('.')))\n\nans = A*(B1*100+B2)\n\nprint((int(ans\/\/100)))","code_v0_loc":4,"code_v1_loc":5,"code_v0_num_chars":100,"code_v1_num_chars":107,"code_v0_no_empty_lines":"import math\nfrom decimal import Decimal\n\nA, B = list(map(Decimal, input().split()))\nprint((math.floor(A * B)))\n","code_v1_no_empty_lines":"A, B = input().split()\nA = int(A)\nB1, B2 = list(map(int, B.split(\".\")))\nans = A * (B1 * 100 + B2)\nprint((int(ans \/\/ 100)))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import math","-from decimal import Decimal","-","-A, B = list(map(Decimal, input().split()))","-print((math.floor(A * B)))","+A, B = input().split()","+A = int(A)","+B1, B2 = list(map(int, B.split(\".\")))","+ans = A * (B1 * 100 + B2)","+print((int(ans \/\/ 100)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.038117774,"measured_runtime_v1":0.1248708298,"runtime_lift":0.3052576335,"key":["s220641662","s759550177"]} +{"user_id":"u192154323","problem_id":"p03476","language":"python","submission_id_v0":"s273042024","submission_id_v1":"s550896565","cpu_time_v0":403,"cpu_time_v1":225,"memory_v0":9352,"memory_v1":79424,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.17,"input":"q = int(eval(input()))\n\n\n\ndef primes(n):\n\n is_prime = [True] * (n+1)\n\n is_prime[0] = False\n\n is_prime[1] = False\n\n for i in range(2,int(n**0.5) + 1):\n\n # \u65e2\u306bfalse\u306b\u306a\u3063\u3066\u305f\u3089\u30b9\u30ad\u30c3\u30d7\n\n if not is_prime[i]:\n\n continue\n\n for j in range(i*2, n+1, i):\n\n is_prime[j] = False\n\n return is_prime\n\nprime_ls = primes(10**5)\n\n\n\ncsum = [0] * (10**5)\n\nfor i in range(1,10**5):\n\n if prime_ls[i]:\n\n if prime_ls[(i+1) \/\/ 2]:\n\n csum[i] = csum[i-1] + 1\n\n else:\n\n csum[i] = csum[i-1]\n\n else:\n\n csum[i] = csum[i-1]\n\n\n\nans_ls = [0] * q\n\nfor i in range(q):\n\n l,r = list(map(int,input().split()))\n\n ans_ls[i] = csum[r] - csum[l-1]\n\nfor ans in ans_ls:\n\n print(ans)","target":"q = int(eval(input()))\n\nQ = 10**5+1\n\nis_prime = [1] * (Q+1)\n\nis_prime[0],is_prime[1] = 0,0\n\nfor i in range(2,int(Q*0.5)+1):\n\n if is_prime[i]:\n\n product = i*2\n\n while product <= Q:\n\n is_prime[product] = 0\n\n product += i\n\nis_2017_like = [0] * (Q+1)\n\nis_2017_like_csum = [0] * (Q+1)\n\nnow = 0\n\nfor i in range(2,Q+1):\n\n if is_prime[i] and is_prime[(i+1)\/\/2]:\n\n is_2017_like[i] = 1\n\n now += 1\n\n is_2017_like_csum[i] = now\n\nans_ls = [0] * q\n\nfor i in range(q):\n\n l,r = list(map(int,input().split()))\n\n if l >= 1:\n\n ans_ls[i] = is_2017_like_csum[r] - is_2017_like_csum[l-1]\n\n else:\n\n ans_ls[i] = is_2017_like_csum[r]\n\nfor i in range(q):\n\n print((ans_ls[i]))\n","code_v0_loc":31,"code_v1_loc":27,"code_v0_num_chars":732,"code_v1_num_chars":721,"code_v0_no_empty_lines":"q = int(eval(input()))\n\n\ndef primes(n):\n is_prime = [True] * (n + 1)\n is_prime[0] = False\n is_prime[1] = False\n for i in range(2, int(n**0.5) + 1):\n # \u65e2\u306bfalse\u306b\u306a\u3063\u3066\u305f\u3089\u30b9\u30ad\u30c3\u30d7\n if not is_prime[i]:\n continue\n for j in range(i * 2, n + 1, i):\n is_prime[j] = False\n return is_prime\n\n\nprime_ls = primes(10**5)\ncsum = [0] * (10**5)\nfor i in range(1, 10**5):\n if prime_ls[i]:\n if prime_ls[(i + 1) \/\/ 2]:\n csum[i] = csum[i - 1] + 1\n else:\n csum[i] = csum[i - 1]\n else:\n csum[i] = csum[i - 1]\nans_ls = [0] * q\nfor i in range(q):\n l, r = list(map(int, input().split()))\n ans_ls[i] = csum[r] - csum[l - 1]\nfor ans in ans_ls:\n print(ans)\n","code_v1_no_empty_lines":"q = int(eval(input()))\nQ = 10**5 + 1\nis_prime = [1] * (Q + 1)\nis_prime[0], is_prime[1] = 0, 0\nfor i in range(2, int(Q * 0.5) + 1):\n if is_prime[i]:\n product = i * 2\n while product <= Q:\n is_prime[product] = 0\n product += i\nis_2017_like = [0] * (Q + 1)\nis_2017_like_csum = [0] * (Q + 1)\nnow = 0\nfor i in range(2, Q + 1):\n if is_prime[i] and is_prime[(i + 1) \/\/ 2]:\n is_2017_like[i] = 1\n now += 1\n is_2017_like_csum[i] = now\nans_ls = [0] * q\nfor i in range(q):\n l, r = list(map(int, input().split()))\n if l >= 1:\n ans_ls[i] = is_2017_like_csum[r] - is_2017_like_csum[l - 1]\n else:\n ans_ls[i] = is_2017_like_csum[r]\nfor i in range(q):\n print((ans_ls[i]))\n","code_same":false,"relative_loc_diff_percent":12.9032258065,"diff":["-","-","-def primes(n):","- is_prime = [True] * (n + 1)","- is_prime[0] = False","- is_prime[1] = False","- for i in range(2, int(n**0.5) + 1):","- # \u65e2\u306bfalse\u306b\u306a\u3063\u3066\u305f\u3089\u30b9\u30ad\u30c3\u30d7","- if not is_prime[i]:","- continue","- for j in range(i * 2, n + 1, i):","- is_prime[j] = False","- return is_prime","-","-","-prime_ls = primes(10**5)","-csum = [0] * (10**5)","-for i in range(1, 10**5):","- if prime_ls[i]:","- if prime_ls[(i + 1) \/\/ 2]:","- csum[i] = csum[i - 1] + 1","- else:","- csum[i] = csum[i - 1]","- else:","- csum[i] = csum[i - 1]","+Q = 10**5 + 1","+is_prime = [1] * (Q + 1)","+is_prime[0], is_prime[1] = 0, 0","+for i in range(2, int(Q * 0.5) + 1):","+ if is_prime[i]:","+ product = i * 2","+ while product <= Q:","+ is_prime[product] = 0","+ product += i","+is_2017_like = [0] * (Q + 1)","+is_2017_like_csum = [0] * (Q + 1)","+now = 0","+for i in range(2, Q + 1):","+ if is_prime[i] and is_prime[(i + 1) \/\/ 2]:","+ is_2017_like[i] = 1","+ now += 1","+ is_2017_like_csum[i] = now","- ans_ls[i] = csum[r] - csum[l - 1]","-for ans in ans_ls:","- print(ans)","+ if l >= 1:","+ ans_ls[i] = is_2017_like_csum[r] - is_2017_like_csum[l - 1]","+ else:","+ ans_ls[i] = is_2017_like_csum[r]","+for i in range(q):","+ print((ans_ls[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0852697117,"measured_runtime_v1":0.1355852187,"runtime_lift":0.6289012369,"key":["s273042024","s550896565"]} +{"user_id":"u724687935","problem_id":"p02833","language":"python","submission_id_v0":"s444990700","submission_id_v1":"s955968857","cpu_time_v0":189,"cpu_time_v1":165,"memory_v0":38256,"memory_v1":38256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.7,"input":"N = int(eval(input()))\n\nif N % 2 == 1:\n\n print((0))\n\n exit()\n\n\n\nans = 0\n\nmod = 10\n\n\n\nwhile (mod <= N):\n\n ans += N \/\/ mod\n\n mod *= 5\n\n\n\nprint(ans)\n","target":"N = int(eval(input()))\n\n\n\nans = 0\n\n\n\nif N % 2 == 0:\n\n mod = 10\n\n while N >= mod:\n\n ans += N \/\/ mod\n\n mod *= 5\n\n\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":150,"code_v1_num_chars":138,"code_v0_no_empty_lines":"N = int(eval(input()))\nif N % 2 == 1:\n print((0))\n exit()\nans = 0\nmod = 10\nwhile mod <= N:\n ans += N \/\/ mod\n mod *= 5\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nans = 0\nif N % 2 == 0:\n mod = 10\n while N >= mod:\n ans += N \/\/ mod\n mod *= 5\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-if N % 2 == 1:","- print((0))","- exit()","-mod = 10","-while mod <= N:","- ans += N \/\/ mod","- mod *= 5","+if N % 2 == 0:","+ mod = 10","+ while N >= mod:","+ ans += N \/\/ mod","+ mod *= 5"],"diff_only_import_comment":false,"measured_runtime_v0":0.1194509418,"measured_runtime_v1":0.0361959372,"runtime_lift":3.3001201558,"key":["s444990700","s955968857"]} +{"user_id":"u535659144","problem_id":"p03212","language":"python","submission_id_v0":"s780993643","submission_id_v1":"s099944456","cpu_time_v0":339,"cpu_time_v1":79,"memory_v0":5924,"memory_v1":6132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.7,"input":"lista=[3,5,7]\n\ncount=0\n\nlim=int(eval(input()))\n\nwhile True:\n\n t=lista.pop(0)\n\n if t>lim:\n\n break\n\n c=list(str(t))\n\n if c.count(\"3\") and c.count(\"5\") and c.count(\"7\"):\n\n count+=1\n\n lista.append(10*t+3)\n\n lista.append(10*t+5)\n\n lista.append(10*t+7)\n\nprint(count)","target":"from collections import deque\n\nlista=deque([3,5,7])\n\ncount=0\n\nlim=int(eval(input()))\n\nwhile True:\n\n t=lista.popleft()\n\n if t>lim:\n\n break\n\n c=list(str(t))\n\n if c.count(\"3\") and c.count(\"5\") and c.count(\"7\"):\n\n count+=1\n\n lista.append(10*t+3)\n\n lista.append(10*t+5)\n\n lista.append(10*t+7)\n\nprint(count)","code_v0_loc":14,"code_v1_loc":15,"code_v0_num_chars":289,"code_v1_num_chars":330,"code_v0_no_empty_lines":"lista = [3, 5, 7]\ncount = 0\nlim = int(eval(input()))\nwhile True:\n t = lista.pop(0)\n if t > lim:\n break\n c = list(str(t))\n if c.count(\"3\") and c.count(\"5\") and c.count(\"7\"):\n count += 1\n lista.append(10 * t + 3)\n lista.append(10 * t + 5)\n lista.append(10 * t + 7)\nprint(count)\n","code_v1_no_empty_lines":"from collections import deque\n\nlista = deque([3, 5, 7])\ncount = 0\nlim = int(eval(input()))\nwhile True:\n t = lista.popleft()\n if t > lim:\n break\n c = list(str(t))\n if c.count(\"3\") and c.count(\"5\") and c.count(\"7\"):\n count += 1\n lista.append(10 * t + 3)\n lista.append(10 * t + 5)\n lista.append(10 * t + 7)\nprint(count)\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["-lista = [3, 5, 7]","+from collections import deque","+","+lista = deque([3, 5, 7])","- t = lista.pop(0)","+ t = lista.popleft()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2387887948,"measured_runtime_v1":0.0657256444,"runtime_lift":3.6331145488,"key":["s780993643","s099944456"]} +{"user_id":"u753803401","problem_id":"p03723","language":"python","submission_id_v0":"s979145790","submission_id_v1":"s077380719","cpu_time_v0":183,"cpu_time_v1":165,"memory_v0":38384,"memory_v1":38256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.84,"input":"import sys\n\n\n\n\n\ndef solve():\n\n readline = sys.stdin.buffer.readline\n\n mod = 10 ** 9 + 7\n\n a, b, c = list(map(int, readline().split()))\n\n if a == b == c:\n\n if a == b == c == 1:\n\n print((0))\n\n else:\n\n print((-1))\n\n else:\n\n cnt = 0\n\n while True:\n\n if a % 2 == b % 2 == c % 2 == 0:\n\n cnt += 1\n\n a, b, c = (b + c) \/\/ 2, (a + c) \/\/ 2, (a + b) \/\/ 2\n\n else:\n\n print(cnt)\n\n exit()\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","target":"import sys\n\n\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n mod = 10 ** 9 + 7\n\n a, b, c = list(map(int, input().rstrip('\\n').split()))\n\n if a == b == c:\n\n if a == b == c == 1:\n\n print((0))\n\n else:\n\n print((-1))\n\n else:\n\n if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:\n\n cnt = 0\n\n while True:\n\n if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:\n\n cnt += 1\n\n a, b, c = (b + c) \/\/ 2, (a + c) \/\/ 2, (a + b) \/\/ 2\n\n else:\n\n break\n\n print(cnt)\n\n else:\n\n print((0))\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","code_v0_loc":25,"code_v1_loc":28,"code_v0_num_chars":560,"code_v1_num_chars":686,"code_v0_no_empty_lines":"import sys\n\n\ndef solve():\n readline = sys.stdin.buffer.readline\n mod = 10**9 + 7\n a, b, c = list(map(int, readline().split()))\n if a == b == c:\n if a == b == c == 1:\n print((0))\n else:\n print((-1))\n else:\n cnt = 0\n while True:\n if a % 2 == b % 2 == c % 2 == 0:\n cnt += 1\n a, b, c = (b + c) \/\/ 2, (a + c) \/\/ 2, (a + b) \/\/ 2\n else:\n print(cnt)\n exit()\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys\n\n\ndef solve():\n input = sys.stdin.readline\n mod = 10**9 + 7\n a, b, c = list(map(int, input().rstrip(\"\\n\").split()))\n if a == b == c:\n if a == b == c == 1:\n print((0))\n else:\n print((-1))\n else:\n if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:\n cnt = 0\n while True:\n if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:\n cnt += 1\n a, b, c = (b + c) \/\/ 2, (a + c) \/\/ 2, (a + b) \/\/ 2\n else:\n break\n print(cnt)\n else:\n print((0))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":10.7142857143,"diff":["- readline = sys.stdin.buffer.readline","+ input = sys.stdin.readline","- a, b, c = list(map(int, readline().split()))","+ a, b, c = list(map(int, input().rstrip(\"\\n\").split()))","- cnt = 0","- while True:","- if a % 2 == b % 2 == c % 2 == 0:","- cnt += 1","- a, b, c = (b + c) \/\/ 2, (a + c) \/\/ 2, (a + b) \/\/ 2","- else:","- print(cnt)","- exit()","+ if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:","+ cnt = 0","+ while True:","+ if a % 2 == 0 and b % 2 == 0 and c % 2 == 0:","+ cnt += 1","+ a, b, c = (b + c) \/\/ 2, (a + c) \/\/ 2, (a + b) \/\/ 2","+ else:","+ break","+ print(cnt)","+ else:","+ print((0))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0425280616,"measured_runtime_v1":0.1383013852,"runtime_lift":0.3075027887,"key":["s979145790","s077380719"]} +{"user_id":"u716530146","problem_id":"p02993","language":"python","submission_id_v0":"s285854162","submission_id_v1":"s165725267","cpu_time_v0":169,"cpu_time_v1":21,"memory_v0":38384,"memory_v1":3420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.57,"input":"#!\/usr\/bin\/env python3\n\nimport sys, math\n\ninput = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')\n\nsys.setrecursionlimit(10**8)\n\ninf = float('inf')\n\nans=count=0\n\n\n\nS=eval(input())\n\nfor i in range(3):\n\n if S[i]==S[i+1]:\n\n print(\"Bad\")\n\n exit()\n\nprint(\"Good\")\n","target":"#!\/usr\/bin\/env python3\n\nimport sys, math, itertools, heapq, collections, bisect\n\ninput = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')\n\nsys.setrecursionlimit(10**8)\n\ninf = float('inf')\n\nans = count = 0\n\n\n\ns=eval(input())\n\nfor i in range(3):\n\n if s[i]==s[i+1]:\n\n print(\"Bad\")\n\n exit()\n\nprint(\"Good\")","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":282,"code_v1_num_chars":324,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys, math\n\ninput = lambda: sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")\nsys.setrecursionlimit(10**8)\ninf = float(\"inf\")\nans = count = 0\nS = eval(input())\nfor i in range(3):\n if S[i] == S[i + 1]:\n print(\"Bad\")\n exit()\nprint(\"Good\")\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys, math, itertools, heapq, collections, bisect\n\ninput = lambda: sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")\nsys.setrecursionlimit(10**8)\ninf = float(\"inf\")\nans = count = 0\ns = eval(input())\nfor i in range(3):\n if s[i] == s[i + 1]:\n print(\"Bad\")\n exit()\nprint(\"Good\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import sys, math","+import sys, math, itertools, heapq, collections, bisect","-S = eval(input())","+s = eval(input())","- if S[i] == S[i + 1]:","+ if s[i] == s[i + 1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1475941799,"measured_runtime_v1":0.0366635046,"runtime_lift":4.0256429776,"key":["s285854162","s165725267"]} +{"user_id":"u780342333","problem_id":"p02386","language":"python","submission_id_v0":"s504080258","submission_id_v1":"s261012715","cpu_time_v0":340,"cpu_time_v1":50,"memory_v0":7824,"memory_v1":5632,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.29,"input":"class Dice:\n\n def __init__(self):\n\n self.faces=[]\n\n\n\n def rotate(self, direction):\n\n tmp = self.faces.copy()\n\n\n\n if direction ==\"N\":\n\n self.faces[5-1] = tmp[1-1]\n\n self.faces[1-1] = tmp[2-1]\n\n self.faces[2-1] = tmp[6-1]\n\n self.faces[6-1] = tmp[5-1]\n\n if direction ==\"S\":\n\n self.faces[5-1] = tmp[6-1]\n\n self.faces[1-1] = tmp[5-1]\n\n self.faces[2-1] = tmp[1-1]\n\n self.faces[6-1] = tmp[2-1]\n\n if direction ==\"W\":\n\n self.faces[4-1] = tmp[1-1]\n\n self.faces[1-1] = tmp[3-1]\n\n self.faces[3-1] = tmp[6-1]\n\n self.faces[6-1] = tmp[4-1]\n\n if direction ==\"E\":\n\n self.faces[3-1] = tmp[1-1]\n\n self.faces[1-1] = tmp[4-1]\n\n self.faces[4-1] = tmp[6-1]\n\n self.faces[6-1] = tmp[3-1]\n\n return 0\n\n\n\n def spin(self):\n\n self.faces[4-1], self.faces[2-1],self.faces[5-1],self.faces[3-1] =\\\n\n self.faces[2-1], self.faces[3-1],self.faces[4-1],self.faces[5-1]\n\n\n\n return 0\n\n\n\ndices = []\n\nlines = int(input())\n\nfor i in range(lines):\n\n dices.append(Dice())\n\n dices[i].faces=[int(x) for x in input().split(\" \")]\n\n\n\nfor i, d1 in enumerate(dices):\n\n for d2 in dices[i+1 :]:\n\n for _ in range(3):\n\n for _ in range(4):\n\n for ___ in range(4):\n\n #print(\"d1: {}\".format(d1.faces))\n\n #print(\"d2: {}\".format(d2.faces))\n\n if d1.faces == d2.faces:\n\n print(\"No\")\n\n exit()\n\n d2.spin()\n\n d2.rotate(\"W\")\n\n d2.rotate(\"N\")\n\n\n\nprint(\"Yes\")\n","target":"def roll(l, command):\n\n '''\n\n return rolled list\n\n\n\n l : string list\n\n command: string\n\n '''\n\n res = []\n\n i = -1\n\n if command =='N':\n\n res = [l[i+2], l[i+6], l[i+3], l[i+4], l[i+1], l[i+5]]\n\n if command =='S':\n\n res = [l[i+5], l[i+1], l[i+3], l[i+4], l[i+6], l[i+2]]\n\n if command =='E':\n\n res = [l[i+4], l[i+2], l[i+1], l[i+6], l[i+5], l[i+3]]\n\n if command =='W':\n\n res = [l[i+3], l[i+2], l[i+6], l[i+1], l[i+5], l[i+4]]\n\n\n\n return res\n\n\n\ndef spin(l):\n\n '''\n\n return right sppined list\n\n\n\n l : string list\n\n '''\n\n\n\n i = -1\n\n res = [l[i+1], l[i+3], l[i+5], l[i+2], l[i+4], l[i+6]]\n\n\n\n return res\n\ndef has_same_faces(a, b):\n\n '''\n\n check if all elements of a are equel to those of b.\n\n a : string list\n\n b : string list\n\n '''\n\n return set(a) == set(b)\n\n\n\ndef is_identical_lists(a, b):\n\n for x, y in zip(a, b):\n\n if x != y:\n\n return False\n\n\n\n return True\n\n\n\ndef check_two_dice(a, b):\n\n if not has_same_faces(a, b):\n\n return False\n\n \n\n orig_a = a[:]\n\n\n\n #roll and spin to check\n\n for i in range(6):\n\n if 1 <= i <= 3:\n\n a = roll(a, \"N\")\n\n elif i == 4:\n\n pass\n\n a = orig_a[:]\n\n a = roll(a, \"W\")\n\n elif i == 5:\n\n a = orig_a[:]\n\n a = roll(a, \"E\")\n\n\n\n # spin 4 times\n\n for _ in range(4): #spin 3 times\n\n a = spin(a)\n\n if is_identical_lists(a, b):\n\n return True\n\n \n\n return False\n\n\n\ndef check_all_different(dice):\n\n '''\n\n if all dice are different, return True\n\n\n\n dice : string list\n\n\n\n '''\n\n for i in range(len(dice)):\n\n if i == 0:\n\n continue\n\n for j in range(i):\n\n res = check_two_dice(dice[i], dice[j])\n\n\n\n if res:\n\n return False\n\n \n\n return True\n\n\n\n\n\nif __name__ == \"__main__\":\n\n res = False\n\n n = int(input())\n\n dice = []\n\n for _ in range(n): \n\n dice.append(input().split())\n\n\n\n res = check_all_different(dice)\n\n\n\n print(\"Yes\") if res else print(\"No\")\n\n\n\n\n\n\n","code_v0_loc":56,"code_v1_loc":104,"code_v0_num_chars":1734,"code_v1_num_chars":2159,"code_v0_no_empty_lines":"class Dice:\n def __init__(self):\n self.faces = []\n\n def rotate(self, direction):\n tmp = self.faces.copy()\n if direction == \"N\":\n self.faces[5 - 1] = tmp[1 - 1]\n self.faces[1 - 1] = tmp[2 - 1]\n self.faces[2 - 1] = tmp[6 - 1]\n self.faces[6 - 1] = tmp[5 - 1]\n if direction == \"S\":\n self.faces[5 - 1] = tmp[6 - 1]\n self.faces[1 - 1] = tmp[5 - 1]\n self.faces[2 - 1] = tmp[1 - 1]\n self.faces[6 - 1] = tmp[2 - 1]\n if direction == \"W\":\n self.faces[4 - 1] = tmp[1 - 1]\n self.faces[1 - 1] = tmp[3 - 1]\n self.faces[3 - 1] = tmp[6 - 1]\n self.faces[6 - 1] = tmp[4 - 1]\n if direction == \"E\":\n self.faces[3 - 1] = tmp[1 - 1]\n self.faces[1 - 1] = tmp[4 - 1]\n self.faces[4 - 1] = tmp[6 - 1]\n self.faces[6 - 1] = tmp[3 - 1]\n return 0\n\n def spin(self):\n self.faces[4 - 1], self.faces[2 - 1], self.faces[5 - 1], self.faces[3 - 1] = (\n self.faces[2 - 1],\n self.faces[3 - 1],\n self.faces[4 - 1],\n self.faces[5 - 1],\n )\n return 0\n\n\ndices = []\nlines = int(input())\nfor i in range(lines):\n dices.append(Dice())\n dices[i].faces = [int(x) for x in input().split(\" \")]\nfor i, d1 in enumerate(dices):\n for d2 in dices[i + 1 :]:\n for _ in range(3):\n for _ in range(4):\n for ___ in range(4):\n # print(\"d1: {}\".format(d1.faces))\n # print(\"d2: {}\".format(d2.faces))\n if d1.faces == d2.faces:\n print(\"No\")\n exit()\n d2.spin()\n d2.rotate(\"W\")\n d2.rotate(\"N\")\nprint(\"Yes\")\n","code_v1_no_empty_lines":"def roll(l, command):\n \"\"\"\n return rolled list\n l : string list\n command: string\n \"\"\"\n res = []\n i = -1\n if command == \"N\":\n res = [l[i + 2], l[i + 6], l[i + 3], l[i + 4], l[i + 1], l[i + 5]]\n if command == \"S\":\n res = [l[i + 5], l[i + 1], l[i + 3], l[i + 4], l[i + 6], l[i + 2]]\n if command == \"E\":\n res = [l[i + 4], l[i + 2], l[i + 1], l[i + 6], l[i + 5], l[i + 3]]\n if command == \"W\":\n res = [l[i + 3], l[i + 2], l[i + 6], l[i + 1], l[i + 5], l[i + 4]]\n return res\n\n\ndef spin(l):\n \"\"\"\n return right sppined list\n l : string list\n \"\"\"\n i = -1\n res = [l[i + 1], l[i + 3], l[i + 5], l[i + 2], l[i + 4], l[i + 6]]\n return res\n\n\ndef has_same_faces(a, b):\n \"\"\"\n check if all elements of a are equel to those of b.\n a : string list\n b : string list\n \"\"\"\n return set(a) == set(b)\n\n\ndef is_identical_lists(a, b):\n for x, y in zip(a, b):\n if x != y:\n return False\n return True\n\n\ndef check_two_dice(a, b):\n if not has_same_faces(a, b):\n return False\n orig_a = a[:]\n # roll and spin to check\n for i in range(6):\n if 1 <= i <= 3:\n a = roll(a, \"N\")\n elif i == 4:\n pass\n a = orig_a[:]\n a = roll(a, \"W\")\n elif i == 5:\n a = orig_a[:]\n a = roll(a, \"E\")\n # spin 4 times\n for _ in range(4): # spin 3 times\n a = spin(a)\n if is_identical_lists(a, b):\n return True\n return False\n\n\ndef check_all_different(dice):\n \"\"\"\n if all dice are different, return True\n dice : string list\n \"\"\"\n for i in range(len(dice)):\n if i == 0:\n continue\n for j in range(i):\n res = check_two_dice(dice[i], dice[j])\n if res:\n return False\n return True\n\n\nif __name__ == \"__main__\":\n res = False\n n = int(input())\n dice = []\n for _ in range(n):\n dice.append(input().split())\n res = check_all_different(dice)\n print(\"Yes\") if res else print(\"No\")\n","code_same":false,"relative_loc_diff_percent":46.1538461538,"diff":["-class Dice:","- def __init__(self):","- self.faces = []","-","- def rotate(self, direction):","- tmp = self.faces.copy()","- if direction == \"N\":","- self.faces[5 - 1] = tmp[1 - 1]","- self.faces[1 - 1] = tmp[2 - 1]","- self.faces[2 - 1] = tmp[6 - 1]","- self.faces[6 - 1] = tmp[5 - 1]","- if direction == \"S\":","- self.faces[5 - 1] = tmp[6 - 1]","- self.faces[1 - 1] = tmp[5 - 1]","- self.faces[2 - 1] = tmp[1 - 1]","- self.faces[6 - 1] = tmp[2 - 1]","- if direction == \"W\":","- self.faces[4 - 1] = tmp[1 - 1]","- self.faces[1 - 1] = tmp[3 - 1]","- self.faces[3 - 1] = tmp[6 - 1]","- self.faces[6 - 1] = tmp[4 - 1]","- if direction == \"E\":","- self.faces[3 - 1] = tmp[1 - 1]","- self.faces[1 - 1] = tmp[4 - 1]","- self.faces[4 - 1] = tmp[6 - 1]","- self.faces[6 - 1] = tmp[3 - 1]","- return 0","-","- def spin(self):","- self.faces[4 - 1], self.faces[2 - 1], self.faces[5 - 1], self.faces[3 - 1] = (","- self.faces[2 - 1],","- self.faces[3 - 1],","- self.faces[4 - 1],","- self.faces[5 - 1],","- )","- return 0","+def roll(l, command):","+ \"\"\"","+ return rolled list","+ l : string list","+ command: string","+ \"\"\"","+ res = []","+ i = -1","+ if command == \"N\":","+ res = [l[i + 2], l[i + 6], l[i + 3], l[i + 4], l[i + 1], l[i + 5]]","+ if command == \"S\":","+ res = [l[i + 5], l[i + 1], l[i + 3], l[i + 4], l[i + 6], l[i + 2]]","+ if command == \"E\":","+ res = [l[i + 4], l[i + 2], l[i + 1], l[i + 6], l[i + 5], l[i + 3]]","+ if command == \"W\":","+ res = [l[i + 3], l[i + 2], l[i + 6], l[i + 1], l[i + 5], l[i + 4]]","+ return res","-dices = []","-lines = int(input())","-for i in range(lines):","- dices.append(Dice())","- dices[i].faces = [int(x) for x in input().split(\" \")]","-for i, d1 in enumerate(dices):","- for d2 in dices[i + 1 :]:","- for _ in range(3):","- for _ in range(4):","- for ___ in range(4):","- # print(\"d1: {}\".format(d1.faces))","- # print(\"d2: {}\".format(d2.faces))","- if d1.faces == d2.faces:","- print(\"No\")","- exit()","- d2.spin()","- d2.rotate(\"W\")","- d2.rotate(\"N\")","-print(\"Yes\")","+def spin(l):","+ \"\"\"","+ return right sppined list","+ l : string list","+ \"\"\"","+ i = -1","+ res = [l[i + 1], l[i + 3], l[i + 5], l[i + 2], l[i + 4], l[i + 6]]","+ return res","+","+","+def has_same_faces(a, b):","+ \"\"\"","+ check if all elements of a are equel to those of b.","+ a : string list","+ b : string list","+ \"\"\"","+ return set(a) == set(b)","+","+","+def is_identical_lists(a, b):","+ for x, y in zip(a, b):","+ if x != y:","+ return False","+ return True","+","+","+def check_two_dice(a, b):","+ if not has_same_faces(a, b):","+ return False","+ orig_a = a[:]","+ # roll and spin to check","+ for i in range(6):","+ if 1 <= i <= 3:","+ a = roll(a, \"N\")","+ elif i == 4:","+ pass","+ a = orig_a[:]","+ a = roll(a, \"W\")","+ elif i == 5:","+ a = orig_a[:]","+ a = roll(a, \"E\")","+ # spin 4 times","+ for _ in range(4): # spin 3 times","+ a = spin(a)","+ if is_identical_lists(a, b):","+ return True","+ return False","+","+","+def check_all_different(dice):","+ \"\"\"","+ if all dice are different, return True","+ dice : string list","+ \"\"\"","+ for i in range(len(dice)):","+ if i == 0:","+ continue","+ for j in range(i):","+ res = check_two_dice(dice[i], dice[j])","+ if res:","+ return False","+ return True","+","+","+if __name__ == \"__main__\":","+ res = False","+ n = int(input())","+ dice = []","+ for _ in range(n):","+ dice.append(input().split())","+ res = check_all_different(dice)","+ print(\"Yes\") if res else print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0393449666,"measured_runtime_v1":0.072490661,"runtime_lift":0.542759109,"key":["s504080258","s261012715"]} +{"user_id":"u116038906","problem_id":"p02756","language":"python","submission_id_v0":"s541289755","submission_id_v1":"s463207384","cpu_time_v0":363,"cpu_time_v1":308,"memory_v0":63260,"memory_v1":62236,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.15,"input":"#\u524d\u30fb\u5de6\u306b\u3064\u3051\u308b\u5909\u6570\u3001\u5f8c\u308d\u30fb\u53f3\u306b\u3064\u3051\u308b\u5909\u6570\u3092\u7528\u610f\u3057\u3066\u6700\u5f8c\u306b\u8db3\u3059\n\n#\u524d\u30fb\u5de6\u306f\u6700\u5f8c\u306b\u3072\u3063\u304f\u308a\u8fd4\u3059\uff08abc \u21d2cba)\n\n\n\n#\u521d\u671f\u5165\u529b\n\nimport sys\n\ninput = sys.stdin.readline\n\nS = input()\n\nS=S.strip(\"\\n\")\n\nQ = int(input())\n\nFQ_dic={}\n\nfor i in range(Q):\n\n FQ_dic[i] =input().split()\n\n\n\nrev =0\n\nfront =\"\"\n\nback =\"\"\n\n\n\nfor i in range(Q):\n\n # print(S) \n\n\n\n if FQ_dic[i][0] ==\"1\": #\u9006\u8ee2\u3059\u308b\n\n rev +=1\n\n else: #\u9006\u8ee2\u306a\u3057 \n\n if FQ_dic[i][1]==\"1\": #\u524d=\u5de6\u306b\u3064\u3051\u308b \n\n if rev %2 ==0:\n\n front += FQ_dic[i][2]\n\n else:\n\n back += FQ_dic[i][2] \n\n else: # #\u5f8c\u308d=\u53f3\u306b\u3064\u3051\u308b\n\n if rev %2 ==0:\n\n back += FQ_dic[i][2] \n\n else: \n\n front += FQ_dic[i][2]\n\nfront =front[::-1]\n\nS =front + S + back\n\n\n\nif rev %2 ==0:\n\n print(*S,sep=\"\")\n\nelse:\n\n print(*S[::-1],sep=\"\")\n","target":"# deque \u3067\u9ad8\u901f\u306b\u6587\u5b57\u3092\u5148\u982d\u3067\u3082\u305f\u305b\u308b\n\n\n\n#\u521d\u671f\u5165\u529b\n\nfrom collections import deque\n\nimport sys\n\ninput = sys.stdin.readline\n\nS = input().strip()\n\nQ = int(eval(input()))\n\nFQ_dic={}\n\nfor i in range(Q):\n\n FQ_dic[i] =input().split()\n\n\n\nrev =0 #\u53cd\u8ee2Flag\n\ndq =deque(S)\n\nfor i in range(Q):\n\n if FQ_dic[i][0] ==\"1\":\n\n rev +=1\n\n else:\n\n a,b,c =FQ_dic[i]\n\n if rev %2 ==0 and b ==\"1\" :\n\n dq.appendleft(c)\n\n elif rev %2 ==0 and b ==\"2\":\n\n dq.append(c)\n\n elif rev %2 ==1 and b ==\"1\":\n\n dq.append(c)\n\n elif rev %2 ==1 and b ==\"2\":\n\n dq.appendleft(c)\n\nif rev %2 ==1:\n\n dq.reverse()\n\nans =\"\".join(dq)\n\nprint(ans)","code_v0_loc":40,"code_v1_loc":31,"code_v0_num_chars":855,"code_v1_num_chars":666,"code_v0_no_empty_lines":"# \u524d\u30fb\u5de6\u306b\u3064\u3051\u308b\u5909\u6570\u3001\u5f8c\u308d\u30fb\u53f3\u306b\u3064\u3051\u308b\u5909\u6570\u3092\u7528\u610f\u3057\u3066\u6700\u5f8c\u306b\u8db3\u3059\n# \u524d\u30fb\u5de6\u306f\u6700\u5f8c\u306b\u3072\u3063\u304f\u308a\u8fd4\u3059\uff08abc \u21d2cba)\n# \u521d\u671f\u5165\u529b\nimport sys\n\ninput = sys.stdin.readline\nS = input()\nS = S.strip(\"\\n\")\nQ = int(input())\nFQ_dic = {}\nfor i in range(Q):\n FQ_dic[i] = input().split()\nrev = 0\nfront = \"\"\nback = \"\"\nfor i in range(Q):\n # print(S)\n if FQ_dic[i][0] == \"1\": # \u9006\u8ee2\u3059\u308b\n rev += 1\n else: # \u9006\u8ee2\u306a\u3057\n if FQ_dic[i][1] == \"1\": # \u524d=\u5de6\u306b\u3064\u3051\u308b\n if rev % 2 == 0:\n front += FQ_dic[i][2]\n else:\n back += FQ_dic[i][2]\n else: # #\u5f8c\u308d=\u53f3\u306b\u3064\u3051\u308b\n if rev % 2 == 0:\n back += FQ_dic[i][2]\n else:\n front += FQ_dic[i][2]\nfront = front[::-1]\nS = front + S + back\nif rev % 2 == 0:\n print(*S, sep=\"\")\nelse:\n print(*S[::-1], sep=\"\")\n","code_v1_no_empty_lines":"# deque \u3067\u9ad8\u901f\u306b\u6587\u5b57\u3092\u5148\u982d\u3067\u3082\u305f\u305b\u308b\n# \u521d\u671f\u5165\u529b\nfrom collections import deque\nimport sys\n\ninput = sys.stdin.readline\nS = input().strip()\nQ = int(eval(input()))\nFQ_dic = {}\nfor i in range(Q):\n FQ_dic[i] = input().split()\nrev = 0 # \u53cd\u8ee2Flag\ndq = deque(S)\nfor i in range(Q):\n if FQ_dic[i][0] == \"1\":\n rev += 1\n else:\n a, b, c = FQ_dic[i]\n if rev % 2 == 0 and b == \"1\":\n dq.appendleft(c)\n elif rev % 2 == 0 and b == \"2\":\n dq.append(c)\n elif rev % 2 == 1 and b == \"1\":\n dq.append(c)\n elif rev % 2 == 1 and b == \"2\":\n dq.appendleft(c)\nif rev % 2 == 1:\n dq.reverse()\nans = \"\".join(dq)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":22.5,"diff":["-# \u524d\u30fb\u5de6\u306b\u3064\u3051\u308b\u5909\u6570\u3001\u5f8c\u308d\u30fb\u53f3\u306b\u3064\u3051\u308b\u5909\u6570\u3092\u7528\u610f\u3057\u3066\u6700\u5f8c\u306b\u8db3\u3059","-# \u524d\u30fb\u5de6\u306f\u6700\u5f8c\u306b\u3072\u3063\u304f\u308a\u8fd4\u3059\uff08abc \u21d2cba)","+# deque \u3067\u9ad8\u901f\u306b\u6587\u5b57\u3092\u5148\u982d\u3067\u3082\u305f\u305b\u308b","+from collections import deque","-S = input()","-S = S.strip(\"\\n\")","-Q = int(input())","+S = input().strip()","+Q = int(eval(input()))","-rev = 0","-front = \"\"","-back = \"\"","+rev = 0 # \u53cd\u8ee2Flag","+dq = deque(S)","- # print(S)","- if FQ_dic[i][0] == \"1\": # \u9006\u8ee2\u3059\u308b","+ if FQ_dic[i][0] == \"1\":","- else: # \u9006\u8ee2\u306a\u3057","- if FQ_dic[i][1] == \"1\": # \u524d=\u5de6\u306b\u3064\u3051\u308b","- if rev % 2 == 0:","- front += FQ_dic[i][2]","- else:","- back += FQ_dic[i][2]","- else: # #\u5f8c\u308d=\u53f3\u306b\u3064\u3051\u308b","- if rev % 2 == 0:","- back += FQ_dic[i][2]","- else:","- front += FQ_dic[i][2]","-front = front[::-1]","-S = front + S + back","-if rev % 2 == 0:","- print(*S, sep=\"\")","-else:","- print(*S[::-1], sep=\"\")","+ else:","+ a, b, c = FQ_dic[i]","+ if rev % 2 == 0 and b == \"1\":","+ dq.appendleft(c)","+ elif rev % 2 == 0 and b == \"2\":","+ dq.append(c)","+ elif rev % 2 == 1 and b == \"1\":","+ dq.append(c)","+ elif rev % 2 == 1 and b == \"2\":","+ dq.appendleft(c)","+if rev % 2 == 1:","+ dq.reverse()","+ans = \"\".join(dq)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.047176038,"measured_runtime_v1":0.0412738109,"runtime_lift":1.1430017493,"key":["s541289755","s463207384"]} +{"user_id":"u528388170","problem_id":"p04001","language":"python","submission_id_v0":"s347967043","submission_id_v1":"s926669869","cpu_time_v0":20,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"ans=0\n\ndef dfs(x,len_x,i=0):\n\n global ans\n\n if i < len_x:\n\n dfs(x,len_x,i=i+1)\n\n if i < len_x:\n\n x=x[:i+1] + \"+\" + x[i+1:]\n\n dfs(x,len_x + 1,i=i+2)\n\n ans+=sum([int(k) for k in x.split(\"+\")])\n\n \n\ns = eval(input())\n\ndfs(s,len(s)-1)\n\nprint((ans+int(s)))","target":"s = eval(input())\n\nlen_s = len(s)\n\nans=0\n\ndef dfs(x,len_x,i=0):\n\n global ans\n\n if i < len_x:\n\n dfs(x,len_x,i=i+1)\n\n x=x[:i+1] + \"+\" + x[i+1:]\n\n dfs(x,len_x + 1,i=i+2)\n\n ans+=sum([int(k) for k in x.split(\"+\")])\n\ndfs(s,len_s-1)\n\nprint((ans+int(s)))","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":330,"code_v1_num_chars":312,"code_v0_no_empty_lines":"ans = 0\n\n\ndef dfs(x, len_x, i=0):\n global ans\n if i < len_x:\n dfs(x, len_x, i=i + 1)\n if i < len_x:\n x = x[: i + 1] + \"+\" + x[i + 1 :]\n dfs(x, len_x + 1, i=i + 2)\n ans += sum([int(k) for k in x.split(\"+\")])\n\n\ns = eval(input())\ndfs(s, len(s) - 1)\nprint((ans + int(s)))\n","code_v1_no_empty_lines":"s = eval(input())\nlen_s = len(s)\nans = 0\n\n\ndef dfs(x, len_x, i=0):\n global ans\n if i < len_x:\n dfs(x, len_x, i=i + 1)\n x = x[: i + 1] + \"+\" + x[i + 1 :]\n dfs(x, len_x + 1, i=i + 2)\n ans += sum([int(k) for k in x.split(\"+\")])\n\n\ndfs(s, len_s - 1)\nprint((ans + int(s)))\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["+s = eval(input())","+len_s = len(s)","- if i < len_x:","-s = eval(input())","-dfs(s, len(s) - 1)","+dfs(s, len_s - 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0519014359,"measured_runtime_v1":0.0394401073,"runtime_lift":1.3159557448,"key":["s347967043","s926669869"]} +{"user_id":"u598720217","problem_id":"p02947","language":"python","submission_id_v0":"s869772291","submission_id_v1":"s133897195","cpu_time_v0":1274,"cpu_time_v1":353,"memory_v0":135184,"memory_v1":18704,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.29,"input":"import sys\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\nN = int(eval(input()))\n\n\n\nsentences = [None]*N\n\n\n\ndp = {}\n\n\n\nfor i in range(N):\n\n k = list(map(str,eval(input())))\n\n k.sort()\n\n sentences[i] = k\n\n\n\ndef addTree(tree, sentence,org):\n\n l = len(sentence)\n\n if l==0:\n\n return None\n\n st = sentence[0]\n\n if st not in tree:\n\n tree[st] = {}\n\n else:\n\n if l==1:\n\n org = ''.join(org)\n\n if org in dp:\n\n dp[org] += 1\n\n else:\n\n dp[org] = 2\n\n\n\n tree[sentence[0]] = addTree(tree[st], sentence[1:],org)\n\n\n\n return tree\n\n\n\n\n\ndef createTree(sentences):\n\n tree = {}\n\n for sentence in sentences:\n\n tree = addTree(tree, sentence, sentence)\n\n\n\n return tree\n\n\n\ntree = createTree(sentences)\n\n\n\nans = 0\n\nfor i in list(dp.values()):\n\n ans += i*(i-1)\/2\n\nprint((int(ans)))","target":"import sys\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\n\n\nN = int(eval(input()))\n\n\n\nsentences = [None]*N\n\n\n\ndp = {}\n\n\n\nfor i in range(N):\n\n k = list(map(str,eval(input())))\n\n k.sort()\n\n k = ''.join(k)\n\n if k in dp:\n\n dp[k] += 1\n\n else:\n\n dp[k] = 1\n\n\n\nans = 0\n\n\n\nfor i in list(dp.values()):\n\n if not i==1:\n\n ans += i*(i-1)\/2\n\n\n\nprint((int(ans)))","code_v0_loc":47,"code_v1_loc":26,"code_v0_num_chars":872,"code_v1_num_chars":378,"code_v0_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nN = int(eval(input()))\nsentences = [None] * N\ndp = {}\nfor i in range(N):\n k = list(map(str, eval(input())))\n k.sort()\n sentences[i] = k\n\n\ndef addTree(tree, sentence, org):\n l = len(sentence)\n if l == 0:\n return None\n st = sentence[0]\n if st not in tree:\n tree[st] = {}\n else:\n if l == 1:\n org = \"\".join(org)\n if org in dp:\n dp[org] += 1\n else:\n dp[org] = 2\n tree[sentence[0]] = addTree(tree[st], sentence[1:], org)\n return tree\n\n\ndef createTree(sentences):\n tree = {}\n for sentence in sentences:\n tree = addTree(tree, sentence, sentence)\n return tree\n\n\ntree = createTree(sentences)\nans = 0\nfor i in list(dp.values()):\n ans += i * (i - 1) \/ 2\nprint((int(ans)))\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nN = int(eval(input()))\nsentences = [None] * N\ndp = {}\nfor i in range(N):\n k = list(map(str, eval(input())))\n k.sort()\n k = \"\".join(k)\n if k in dp:\n dp[k] += 1\n else:\n dp[k] = 1\nans = 0\nfor i in list(dp.values()):\n if not i == 1:\n ans += i * (i - 1) \/ 2\nprint((int(ans)))\n","code_same":false,"relative_loc_diff_percent":44.6808510638,"diff":["- sentences[i] = k","-","-","-def addTree(tree, sentence, org):","- l = len(sentence)","- if l == 0:","- return None","- st = sentence[0]","- if st not in tree:","- tree[st] = {}","+ k = \"\".join(k)","+ if k in dp:","+ dp[k] += 1","- if l == 1:","- org = \"\".join(org)","- if org in dp:","- dp[org] += 1","- else:","- dp[org] = 2","- tree[sentence[0]] = addTree(tree[st], sentence[1:], org)","- return tree","-","-","-def createTree(sentences):","- tree = {}","- for sentence in sentences:","- tree = addTree(tree, sentence, sentence)","- return tree","-","-","-tree = createTree(sentences)","+ dp[k] = 1","- ans += i * (i - 1) \/ 2","+ if not i == 1:","+ ans += i * (i - 1) \/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.089323967,"measured_runtime_v1":0.0471062167,"runtime_lift":1.8962246021,"key":["s869772291","s133897195"]} +{"user_id":"u408071652","problem_id":"p02608","language":"python","submission_id_v0":"s008059222","submission_id_v1":"s586992128","cpu_time_v0":117,"cpu_time_v1":50,"memory_v0":9608,"memory_v1":9404,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.26,"input":"import sys\n\n\n\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n\n\n dp = [0] * (N + 1)\n\n rt = int(N ** 0.5) + 1\n\n for i in range(1, rt):\n\n ii = i ** 2\n\n for j in range(1, rt):\n\n iji = ii + j **2 + i * j\n\n\n\n if iji + 1 + i + j > N:\n\n break\n\n for k in range(1, rt):\n\n case = iji + k**2 + i * k + j * k\n\n if case <= N:\n\n dp[case] += 1\n\n else:\n\n break\n\n\n\n print(*dp[1:N + 1], sep=\"\\n\")\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"import sys\n\n\n\n\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\n\n\n\n\n\n\ndef main():\n\n N = int(input())\n\n\n\n dp = [0] * (N + 1)\n\n rt = int(N ** 0.5) + 1\n\n for i in range(1, rt):\n\n ii = i ** 2\n\n for j in range(1, i+1):\n\n iji = ii + j **2 + i * j\n\n\n\n if iji + 1 + i + j > N:\n\n break\n\n for k in range(1, j+1):\n\n case = iji + k**2 + i * k + j * k\n\n l =6\n\n if i == j or j == k:\n\n l = 3\n\n if i == k:\n\n l = 1\n\n if case <= N:\n\n dp[case] += l\n\n else:\n\n break\n\n\n\n print(*dp[1:N + 1], sep=\"\\n\")\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":32,"code_v1_loc":37,"code_v0_num_chars":631,"code_v1_num_chars":783,"code_v0_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n N = int(input())\n dp = [0] * (N + 1)\n rt = int(N**0.5) + 1\n for i in range(1, rt):\n ii = i**2\n for j in range(1, rt):\n iji = ii + j**2 + i * j\n if iji + 1 + i + j > N:\n break\n for k in range(1, rt):\n case = iji + k**2 + i * k + j * k\n if case <= N:\n dp[case] += 1\n else:\n break\n print(*dp[1 : N + 1], sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n N = int(input())\n dp = [0] * (N + 1)\n rt = int(N**0.5) + 1\n for i in range(1, rt):\n ii = i**2\n for j in range(1, i + 1):\n iji = ii + j**2 + i * j\n if iji + 1 + i + j > N:\n break\n for k in range(1, j + 1):\n case = iji + k**2 + i * k + j * k\n l = 6\n if i == j or j == k:\n l = 3\n if i == k:\n l = 1\n if case <= N:\n dp[case] += l\n else:\n break\n print(*dp[1 : N + 1], sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":13.5135135135,"diff":["- for j in range(1, rt):","+ for j in range(1, i + 1):","- for k in range(1, rt):","+ for k in range(1, j + 1):","+ l = 6","+ if i == j or j == k:","+ l = 3","+ if i == k:","+ l = 1","- dp[case] += 1","+ dp[case] += l"],"diff_only_import_comment":false,"measured_runtime_v0":0.0382269523,"measured_runtime_v1":0.039071842,"runtime_lift":0.9783759964,"key":["s008059222","s586992128"]} +{"user_id":"u396495667","problem_id":"p03658","language":"python","submission_id_v0":"s361310056","submission_id_v1":"s611469020","cpu_time_v0":20,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"n,k = list(map(int, input().split()))\n\nl = [int(i) for i in input().split()]\n\nl.sort(reverse = True)\n\nans =0\n\nfor j in range(k):\n\n ans += l[j]\n\nprint(ans)","target":"n,k = list(map(int,input().split()))\n\nl = [int(_) for _ in input().split()]\n\nl.sort(reverse=True)\n\nprint((sum(l[:k])))","code_v0_loc":7,"code_v1_loc":4,"code_v0_num_chars":149,"code_v1_num_chars":110,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nl = [int(i) for i in input().split()]\nl.sort(reverse=True)\nans = 0\nfor j in range(k):\n ans += l[j]\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nl = [int(_) for _ in input().split()]\nl.sort(reverse=True)\nprint((sum(l[:k])))\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-l = [int(i) for i in input().split()]","+l = [int(_) for _ in input().split()]","-ans = 0","-for j in range(k):","- ans += l[j]","-print(ans)","+print((sum(l[:k])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0461761232,"measured_runtime_v1":0.0451630283,"runtime_lift":1.0224319522,"key":["s361310056","s611469020"]} +{"user_id":"u072717685","problem_id":"p02642","language":"python","submission_id_v0":"s402132736","submission_id_v1":"s602491683","cpu_time_v0":1456,"cpu_time_v1":711,"memory_v0":48008,"memory_v1":122364,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.17,"input":"import sys\n\nread = sys.stdin.read\n\nreadlines = sys.stdin.readlines\n\nimport numpy as np\n\ndef main():\n\n a = np.array(read().split(), np.int32)[1:]\n\n count = np.zeros(10**6+1, np.int32)\n\n for ae in a:\n\n if count[ae] <= 1:\n\n count[::ae] += 1\n\n r = 0\n\n for ae in a:\n\n r += count[ae] == 1\n\n print(r)\n\n\n\nif __name__ == '__main__':\n\n main()","target":"import sys\n\nread = sys.stdin.read\n\nreadlines = sys.stdin.readlines\n\nimport numpy as np\n\nfrom numba import njit\n\ndef main():\n\n\n\n @njit\n\n def solve(a):\n\n count = np.zeros(10 ** 6 + 1, np.int32)\n\n for ae in a:\n\n if count[ae] <= 1:\n\n count[::ae] += 1\n\n r = 0\n\n for ae in a:\n\n r += count[ae] == 1\n\n return r\n\n\n\n a = np.array(read().split(), np.int32)[1:]\n\n print((solve(a)))\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":17,"code_v1_loc":23,"code_v0_num_chars":378,"code_v1_num_chars":494,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nimport numpy as np\n\n\ndef main():\n a = np.array(read().split(), np.int32)[1:]\n count = np.zeros(10**6 + 1, np.int32)\n for ae in a:\n if count[ae] <= 1:\n count[::ae] += 1\n r = 0\n for ae in a:\n r += count[ae] == 1\n print(r)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nimport numpy as np\nfrom numba import njit\n\n\ndef main():\n @njit\n def solve(a):\n count = np.zeros(10**6 + 1, np.int32)\n for ae in a:\n if count[ae] <= 1:\n count[::ae] += 1\n r = 0\n for ae in a:\n r += count[ae] == 1\n return r\n\n a = np.array(read().split(), np.int32)[1:]\n print((solve(a)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":26.0869565217,"diff":["+from numba import njit","+ @njit","+ def solve(a):","+ count = np.zeros(10**6 + 1, np.int32)","+ for ae in a:","+ if count[ae] <= 1:","+ count[::ae] += 1","+ r = 0","+ for ae in a:","+ r += count[ae] == 1","+ return r","+","- count = np.zeros(10**6 + 1, np.int32)","- for ae in a:","- if count[ae] <= 1:","- count[::ae] += 1","- r = 0","- for ae in a:","- r += count[ae] == 1","- print(r)","+ print((solve(a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1775047207,"measured_runtime_v1":0.2558561559,"runtime_lift":0.693767637,"key":["s402132736","s602491683"]} +{"user_id":"u388084260","problem_id":"p02682","language":"python","submission_id_v0":"s817749719","submission_id_v1":"s528788524","cpu_time_v0":25,"cpu_time_v1":22,"memory_v0":9168,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.0,"input":"A,B,C,K=list(map(int,input().split()))\n\n\n\nif A>=K:\n\n print(K)\n\nelif A+B>=K:\n\n print(A)\n\nelse:\n\n print((A-(K-(A+B))))","target":"a,b,c,k=list(map(int,input().split()))\n\nxa=min(a,k)\n\nk-=xa\n\nxb=min(b,k)\n\nk-=xb\n\nxc=min(c,k)\n\nprint((xa-xc))","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":117,"code_v1_num_chars":99,"code_v0_no_empty_lines":"A, B, C, K = list(map(int, input().split()))\nif A >= K:\n print(K)\nelif A + B >= K:\n print(A)\nelse:\n print((A - (K - (A + B))))\n","code_v1_no_empty_lines":"a, b, c, k = list(map(int, input().split()))\nxa = min(a, k)\nk -= xa\nxb = min(b, k)\nk -= xb\nxc = min(c, k)\nprint((xa - xc))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-A, B, C, K = list(map(int, input().split()))","-if A >= K:","- print(K)","-elif A + B >= K:","- print(A)","-else:","- print((A - (K - (A + B))))","+a, b, c, k = list(map(int, input().split()))","+xa = min(a, k)","+k -= xa","+xb = min(b, k)","+k -= xb","+xc = min(c, k)","+print((xa - xc))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0472241402,"measured_runtime_v1":0.0489438503,"runtime_lift":0.9648636118,"key":["s817749719","s528788524"]} +{"user_id":"u203383537","problem_id":"p02756","language":"python","submission_id_v0":"s719518097","submission_id_v1":"s118756189","cpu_time_v0":565,"cpu_time_v1":338,"memory_v0":6900,"memory_v1":11644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.18,"input":"from collections import deque\n\n\n\ns=eval(input())\n\nn=int(eval(input()))\n\nq=deque()\n\nq.append(s)\n\nf=1\n\nfor i in range(n):\n\n t=list(input().split())\n\n if int(t[0])==1:\n\n f*=-1\n\n else:\n\n if f==1:\n\n if t[1]=='1' :\n\n q.appendleft(t[2])\n\n else:\n\n q.append(t[2])\n\n else:\n\n if t[1]=='2':\n\n q.appendleft(t[2])\n\n else: \n\n q.append(t[2])\n\nans=''.join(q)\n\nif f==-1:\n\n ans=ans[::-1]\n\n\n\n\n\nprint(ans) ","target":"from collections import deque\n\n\n\ns = eval(input())\n\nQ = int(eval(input()))\n\n\n\nl = deque()\n\nl.append(s)\n\n\n\nrev = True\n\nfor i in range(Q):\n\n q = list(input().split())\n\n if q[0] == \"1\":\n\n rev = not rev\n\n else:\n\n if rev:\n\n if q[1] == \"1\":\n\n l.appendleft(q[2])\n\n else:\n\n l.append(q[2])\n\n else:\n\n if q[1] == \"1\":\n\n l.append(q[2])\n\n else:\n\n l.appendleft(q[2])\n\n\n\nans = \"\" \n\nfor i in l:\n\n ans += i\n\n\n\nif not rev:\n\n print((ans[::-1]))\n\nelse:\n\n print(ans)","code_v0_loc":28,"code_v1_loc":33,"code_v0_num_chars":515,"code_v1_num_chars":577,"code_v0_no_empty_lines":"from collections import deque\n\ns = eval(input())\nn = int(eval(input()))\nq = deque()\nq.append(s)\nf = 1\nfor i in range(n):\n t = list(input().split())\n if int(t[0]) == 1:\n f *= -1\n else:\n if f == 1:\n if t[1] == \"1\":\n q.appendleft(t[2])\n else:\n q.append(t[2])\n else:\n if t[1] == \"2\":\n q.appendleft(t[2])\n else:\n q.append(t[2])\nans = \"\".join(q)\nif f == -1:\n ans = ans[::-1]\nprint(ans)\n","code_v1_no_empty_lines":"from collections import deque\n\ns = eval(input())\nQ = int(eval(input()))\nl = deque()\nl.append(s)\nrev = True\nfor i in range(Q):\n q = list(input().split())\n if q[0] == \"1\":\n rev = not rev\n else:\n if rev:\n if q[1] == \"1\":\n l.appendleft(q[2])\n else:\n l.append(q[2])\n else:\n if q[1] == \"1\":\n l.append(q[2])\n else:\n l.appendleft(q[2])\nans = \"\"\nfor i in l:\n ans += i\nif not rev:\n print((ans[::-1]))\nelse:\n print(ans)\n","code_same":false,"relative_loc_diff_percent":15.1515151515,"diff":["-n = int(eval(input()))","-q = deque()","-q.append(s)","-f = 1","-for i in range(n):","- t = list(input().split())","- if int(t[0]) == 1:","- f *= -1","+Q = int(eval(input()))","+l = deque()","+l.append(s)","+rev = True","+for i in range(Q):","+ q = list(input().split())","+ if q[0] == \"1\":","+ rev = not rev","- if f == 1:","- if t[1] == \"1\":","- q.appendleft(t[2])","+ if rev:","+ if q[1] == \"1\":","+ l.appendleft(q[2])","- q.append(t[2])","+ l.append(q[2])","- if t[1] == \"2\":","- q.appendleft(t[2])","+ if q[1] == \"1\":","+ l.append(q[2])","- q.append(t[2])","-ans = \"\".join(q)","-if f == -1:","- ans = ans[::-1]","-print(ans)","+ l.appendleft(q[2])","+ans = \"\"","+for i in l:","+ ans += i","+if not rev:","+ print((ans[::-1]))","+else:","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0420612028,"measured_runtime_v1":0.0468345909,"runtime_lift":0.898079858,"key":["s719518097","s118756189"]} +{"user_id":"u764860452","problem_id":"p02833","language":"python","submission_id_v0":"s198371500","submission_id_v1":"s940347018","cpu_time_v0":178,"cpu_time_v1":17,"memory_v0":38464,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.45,"input":"N=int(eval(input()))\n\n\n\n#N\u304c\u5947\u6570\u306e\u6642\u306f\u672b\u5c3e\u306b\uff10\u306f\u306a\u3044\uff08\u56e0\u6570\u306b\uff12\u3092\u3082\u305f\u306a\u3044\u304b\u3089\uff09\n\nif N%2!=0:\n\n print((0))\n\n exit()\n\n \n\n\n\n#N\u307e\u3067\u306e\u6570\u3092\u66f8\u304d\u51fa\u3057\u3066\u3001\u3044\u30645\u306e\u56e0\u6570\u3092\u6301\u3064\u304b\u5b9f\u9a13\u3057\u3066\u6cd5\u5247\u6027\u3092\u3064\u304b\u3081\u3070\u3044\u3044\n\n#\u3053\u306e\u6642i=5\u306b\u3057\u306a\u3044\u3053\u3068\uff01\uff08N\u304b\u30892\u3064\u3068\u3073\u3067\u6e1b\u3063\u3066\u308b\u305f\u3081\uff01\uff09\n\nans=0\n\ni=10\n\nwhile(i<=N):\n\n ans+=N\/\/i\n\n i*=5\n\nprint(ans)\n","target":"def main():\n\n N=int(eval(input()))\n\n\n\n if N%2!=0:\n\n print((0))\n\n exit()\n\n \n\n k=10\n\n ans=0\n\n while(k<=N):\n\n ans+=N\/\/k\n\n k*=5\n\n print(ans)\n\n \n\nif __name__==\"__main__\":\n\n main()","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":229,"code_v1_num_chars":221,"code_v0_no_empty_lines":"N = int(eval(input()))\n# N\u304c\u5947\u6570\u306e\u6642\u306f\u672b\u5c3e\u306b\uff10\u306f\u306a\u3044\uff08\u56e0\u6570\u306b\uff12\u3092\u3082\u305f\u306a\u3044\u304b\u3089\uff09\nif N % 2 != 0:\n print((0))\n exit()\n# N\u307e\u3067\u306e\u6570\u3092\u66f8\u304d\u51fa\u3057\u3066\u3001\u3044\u30645\u306e\u56e0\u6570\u3092\u6301\u3064\u304b\u5b9f\u9a13\u3057\u3066\u6cd5\u5247\u6027\u3092\u3064\u304b\u3081\u3070\u3044\u3044\n# \u3053\u306e\u6642i=5\u306b\u3057\u306a\u3044\u3053\u3068\uff01\uff08N\u304b\u30892\u3064\u3068\u3073\u3067\u6e1b\u3063\u3066\u308b\u305f\u3081\uff01\uff09\nans = 0\ni = 10\nwhile i <= N:\n ans += N \/\/ i\n i *= 5\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n if N % 2 != 0:\n print((0))\n exit()\n k = 10\n ans = 0\n while k <= N:\n ans += N \/\/ k\n k *= 5\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-N = int(eval(input()))","-# N\u304c\u5947\u6570\u306e\u6642\u306f\u672b\u5c3e\u306b\uff10\u306f\u306a\u3044\uff08\u56e0\u6570\u306b\uff12\u3092\u3082\u305f\u306a\u3044\u304b\u3089\uff09","-if N % 2 != 0:","- print((0))","- exit()","-# N\u307e\u3067\u306e\u6570\u3092\u66f8\u304d\u51fa\u3057\u3066\u3001\u3044\u30645\u306e\u56e0\u6570\u3092\u6301\u3064\u304b\u5b9f\u9a13\u3057\u3066\u6cd5\u5247\u6027\u3092\u3064\u304b\u3081\u3070\u3044\u3044","-# \u3053\u306e\u6642i=5\u306b\u3057\u306a\u3044\u3053\u3068\uff01\uff08N\u304b\u30892\u3064\u3068\u3073\u3067\u6e1b\u3063\u3066\u308b\u305f\u3081\uff01\uff09","-ans = 0","-i = 10","-while i <= N:","- ans += N \/\/ i","- i *= 5","-print(ans)","+def main():","+ N = int(eval(input()))","+ if N % 2 != 0:","+ print((0))","+ exit()","+ k = 10","+ ans = 0","+ while k <= N:","+ ans += N \/\/ k","+ k *= 5","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.042049974,"measured_runtime_v1":0.0382309215,"runtime_lift":1.0998943341,"key":["s198371500","s940347018"]} +{"user_id":"u625963200","problem_id":"p02996","language":"python","submission_id_v0":"s472358788","submission_id_v1":"s286729739","cpu_time_v0":1111,"cpu_time_v1":788,"memory_v0":66272,"memory_v1":66876,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.07,"input":"n=int(eval(input()))\n\nAB=[list(map(int,input().split())) for _ in range(n)]\n\n\n\nAB.sort(key=lambda x:(x[1],x[0]))\n\ntime=0\n\nfor a,b in AB:\n\n if time+a>b:\n\n print('No')\n\n exit()\n\n time+=a\n\nprint('Yes')","target":"import sys\n\ninput = sys.stdin.readline\n\nn=int(eval(input()))\n\nAB=[list(map(int,input().split())) for _ in range(n)]\n\n\n\nAB.sort(key=lambda x:(x[1],x[0]))\n\ntime=0\n\nfor a,b in AB:\n\n if time+a>b:\n\n print('No')\n\n exit()\n\n time+=a\n\nprint('Yes')","code_v0_loc":11,"code_v1_loc":13,"code_v0_num_chars":200,"code_v1_num_chars":240,"code_v0_no_empty_lines":"n = int(eval(input()))\nAB = [list(map(int, input().split())) for _ in range(n)]\nAB.sort(key=lambda x: (x[1], x[0]))\ntime = 0\nfor a, b in AB:\n if time + a > b:\n print(\"No\")\n exit()\n time += a\nprint(\"Yes\")\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn = int(eval(input()))\nAB = [list(map(int, input().split())) for _ in range(n)]\nAB.sort(key=lambda x: (x[1], x[0]))\ntime = 0\nfor a, b in AB:\n if time + a > b:\n print(\"No\")\n exit()\n time += a\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.1093753171,"measured_runtime_v1":0.1068804708,"runtime_lift":1.0233423966,"key":["s472358788","s286729739"]} +{"user_id":"u759412327","problem_id":"p03292","language":"python","submission_id_v0":"s565719331","submission_id_v1":"s550273362","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"A1,A2,A3 = sorted(list(map(int,input().split())))\n\nprint((A3-A1))","target":"A1,A2,A3 = sorted(map(int,input().split()))\n\nprint((A3-A1))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":63,"code_v1_num_chars":57,"code_v0_no_empty_lines":"A1, A2, A3 = sorted(list(map(int, input().split())))\nprint((A3 - A1))\n","code_v1_no_empty_lines":"A1, A2, A3 = sorted(map(int, input().split()))\nprint((A3 - A1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-A1, A2, A3 = sorted(list(map(int, input().split())))","+A1, A2, A3 = sorted(map(int, input().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1630749052,"measured_runtime_v1":0.0743520758,"runtime_lift":2.1932797887,"key":["s565719331","s550273362"]} +{"user_id":"u156815136","problem_id":"p02780","language":"python","submission_id_v0":"s099356731","submission_id_v1":"s812638170","cpu_time_v0":171,"cpu_time_v1":158,"memory_v0":32184,"memory_v1":33196,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.6,"input":"n,k = list(map(int,input().split()))\n\nP = list([int(x) + 1 for x in input().split()])\n\ns = [0] * (n+1)\n\nfor i in range(n):\n\n s[i+1] = s[i] + P[i]\n\nres = 0\n\nfor i in range(n-k+1):\n\n res = max(res, s[i+k] - s[i])\n\nprint((res\/2))\n","target":"#from statistics import median\n\n#import collections\n\n#aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\n\nfrom fractions import gcd\n\nfrom itertools import combinations,permutations,accumulate # (string,3) 3\u56de\n\n#from collections import deque\n\nfrom collections import deque,defaultdict,Counter\n\nimport decimal\n\nimport re\n\n#import bisect\n\n#\n\n# d = m - k[i] - k[j]\n\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n\n#\n\n#\n\n#\n\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n\n#\n\n#\n\n\n\nimport sys\n\nsys.setrecursionlimit(10000000)\n\nmod = 10**9 + 7\n\n#mod = 9982443453\n\ndef readInts():\n\n return list(map(int,input().split()))\n\ndef I():\n\n return int(eval(input()))\n\nn,k = readInts()\n\np = [0] + list([int (x) + 1 for x in input().split()])\n\ncum = list(accumulate(p))\n\nres = 0\n\nfor i in range(len(p)-k):\n\n res = max(res, cum[i+k] - cum[i])\n\nprint((res \/ 2))\n","code_v0_loc":9,"code_v1_loc":35,"code_v0_num_chars":230,"code_v1_num_chars":863,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nP = list([int(x) + 1 for x in input().split()])\ns = [0] * (n + 1)\nfor i in range(n):\n s[i + 1] = s[i] + P[i]\nres = 0\nfor i in range(n - k + 1):\n res = max(res, s[i + k] - s[i])\nprint((res \/ 2))\n","code_v1_no_empty_lines":"# from statistics import median\n# import collections\n# aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\nfrom fractions import gcd\nfrom itertools import combinations, permutations, accumulate # (string,3) 3\u56de\n\n# from collections import deque\nfrom collections import deque, defaultdict, Counter\nimport decimal\nimport re\n\n# import bisect\n#\n# d = m - k[i] - k[j]\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n#\n#\n#\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n#\n#\nimport sys\n\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n# mod = 9982443453\ndef readInts():\n return list(map(int, input().split()))\n\n\ndef I():\n return int(eval(input()))\n\n\nn, k = readInts()\np = [0] + list([int(x) + 1 for x in input().split()])\ncum = list(accumulate(p))\nres = 0\nfor i in range(len(p) - k):\n res = max(res, cum[i + k] - cum[i])\nprint((res \/ 2))\n","code_same":false,"relative_loc_diff_percent":74.2857142857,"diff":["-n, k = list(map(int, input().split()))","-P = list([int(x) + 1 for x in input().split()])","-s = [0] * (n + 1)","-for i in range(n):","- s[i + 1] = s[i] + P[i]","+# from statistics import median","+# import collections","+# aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]","+from fractions import gcd","+from itertools import combinations, permutations, accumulate # (string,3) 3\u56de","+","+# from collections import deque","+from collections import deque, defaultdict, Counter","+import decimal","+import re","+","+# import bisect","+#","+# d = m - k[i] - k[j]","+# if kk[bisect.bisect_right(kk,d) - 1] == d:","+#","+#","+#","+# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01","+#","+#","+import sys","+","+sys.setrecursionlimit(10000000)","+mod = 10**9 + 7","+# mod = 9982443453","+def readInts():","+ return list(map(int, input().split()))","+","+","+def I():","+ return int(eval(input()))","+","+","+n, k = readInts()","+p = [0] + list([int(x) + 1 for x in input().split()])","+cum = list(accumulate(p))","-for i in range(n - k + 1):","- res = max(res, s[i + k] - s[i])","+for i in range(len(p) - k):","+ res = max(res, cum[i + k] - cum[i])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0946423607,"measured_runtime_v1":0.0903105695,"runtime_lift":1.0479654948,"key":["s099356731","s812638170"]} +{"user_id":"u564902833","problem_id":"p02913","language":"python","submission_id_v0":"s421788034","submission_id_v1":"s114668991","cpu_time_v0":1308,"cpu_time_v1":411,"memory_v0":50676,"memory_v1":45292,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.58,"input":"BASE = 9973\n\nMOD = 2 ** 61 - 1\n\n\n\n\n\nclass RollingHash:\n\n # \u6587\u5b57\u5217S\u306e\u30ed\u30fc\u30ea\u30f3\u30b0\u30cf\u30c3\u30b7\u30e5\u3092\u69cb\u7bc9\n\n # \u8a08\u7b97\u91cf: O(N)\n\n def __init__(self, S):\n\n # acc[i]\u306fS[0:i]\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3068\u306a\u308b\n\n self.acc = [0]\n\n a = 0\n\n # \u7d2f\u7a4d\u548c\u3092\u8a08\u7b97\u3059\u308b\u30a4\u30e1\u30fc\u30b8\n\n for i, c in enumerate(S):\n\n h = ord(c) - ord(\"a\") + 1\n\n offset = pow(BASE, i, MOD)\n\n a = (a + (h * offset)) % MOD\n\n self.acc.append(a)\n\n\n\n # S[i:j]\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u8fd4\u3059\n\n # \u8a08\u7b97\u91cf: O(1)\n\n def hash(self, i, j):\n\n # \u7d2f\u7a4d\u548c\u3092\u7528\u3044\u3066\u90e8\u5206\u533a\u9593\u306e\u548c\u3092\u8a08\u7b97\u3059\u308b\u30a4\u30e1\u30fc\u30b8\n\n # \u6ce8\u610f: \u57fa\u6570\u306b\u3088\u308b\u30aa\u30d5\u30bb\u30c3\u30c8\u3092\u30ad\u30e3\u30f3\u30bb\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\n\n offset = pow(BASE, i, MOD)\n\n # \u7d20\u6570MOD\u3092\u6cd5\u3068\u3059\u308b\u5270\u4f59\u985e\u306b\u304a\u3051\u308b\u9664\u7b97\u306f\u9006\u5143\u3092\u4e57\u7b97\u3059\u308b\u3053\u3068\u3067\u8a08\u7b97\u3067\u304d\u308b\n\n # \u7d20\u6570MOD\u3092\u6cd5\u3068\u3059\u308b\u5270\u4f59\u985e\u306b\u304a\u3051\u308bx\u306e\u9006\u5143\u306fx^(MOD - 2)\u306b\u7b49\u3057\u3044\n\n offset_inv = pow(offset, MOD - 2, MOD)\n\n return ((self.acc[j] - self.acc[i]) * offset_inv) % MOD\n\n\n\n\n\nN = int(eval(input()))\n\nS = eval(input())\n\n\n\n# S\u306e\u30ed\u30fc\u30ea\u30f3\u30b0\u30cf\u30c3\u30b7\u30e5\u3092\u8a08\u7b97\u3057\u3066\u304a\u304f\n\nrolling = RollingHash(S)\n\n\n\n# \u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304cS\u306b\u542b\u307e\u308c\u308b\u306a\u3089\u3070\u3001\u9577\u3055m-1\u306e\u30c0\u30b8\u30e3\u30ec\u3082\u542b\u307e\u308c\u308b\n\n# \u3064\u307e\u308a\u3001\u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304cS\u306b\u542b\u307e\u308c\u308b\u306a\u3089\u3070\u771f\u3068\u306a\u308b\u8ff0\u8a9e\u3092P(m)\u3068\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u3092\u6e80\u305f\u3059\u6574\u6570c\u304c\u5b58\u5728\u3059\u308b:\n\n# - 0\u4ee5\u4e0ac\u4ee5\u4e0b\u306e\u6574\u6570m\u306b\u3064\u3044\u3066P(m)\u306f\u771f\n\n# - c\u3088\u308a\u5927\u304d\u3044\u6574\u6570m\u306b\u3064\u3044\u3066P(m)\u306f\u507d\n\n# \u203b P\u306f\u5358\u8abf\u95a2\u6570\u3068\u3044\u3046\u3053\u3068\n\n# \u3053\u306ec\u3092\u4e8c\u5206\u63a2\u7d22\u3067\u767a\u898b\u3059\u308c\u3070\u9ad8\u901f\u5316\u3067\u304d\u308b\uff01\n\n\n\n# P(ok)\u306f\u771f\n\nok = 0\n\n# P(ng)\u306f\u507d\n\nng = N\n\nwhile ng - ok > 1:\n\n # \u533a\u9593[ok, ng)\u306e\u4e2d\u592e\u5024\u3092m\u3068\u3059\u308b\n\n m = (ok + ng) \/\/ 2\n\n\n\n # \u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304c\u5b58\u5728\u3059\u308b\u304b\u5224\u5b9a\u3059\u308b\n\n # \u9577\u3055m\u306eformer\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\n\n former_cache = set()\n\n p = False\n\n # latter\u306b\u7740\u76ee\u3057\u3066\u30eb\u30fc\u30d7\u3092\u56de\u3059\n\n for i in range(m, N):\n\n # \u30c0\u30b8\u30e3\u30ec\u9577\u3092\u6c7a\u3081\u6253\u3061\u3057\u3066\u3044\u308b\u306e\u3067j\u3092\u76f4\u63a5\u8a08\u7b97\u3067\u304d\u308b\n\n j = i + m\n\n # S[i:j]\u304cS\u3092\u306f\u307f\u51fa\u3057\u305f\u3089\u30eb\u30fc\u30d7\u7d42\u4e86\n\n if j > N:\n\n break\n\n # former\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\n\n former_cache.add(rolling.hash(i - m, i))\n\n # \u30ad\u30e3\u30c3\u30b7\u30e3\u306b\u540c\u4e00\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\uff08\u30cf\u30c3\u30b7\u30e5\u5024\u304c\u885d\u7a81\u3057\u305f\u5834\u5408\uff09\u3001\u30c0\u30b8\u30e3\u30ec\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u5224\u5b9a\u3067\u304d\u308b\n\n if rolling.hash(i, j) in former_cache:\n\n p = True\n\n # \u30cf\u30c3\u30b7\u30e5\u5024\u306e\u8a08\u7b97\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u5b58\u5728\u5224\u5b9a\u306f\u5171\u306bO(1)\u3067\u51e6\u7406\u3067\u304d\u308b\uff01\n\n # \u533a\u9593[ok, ng) \u3092\u66f4\u65b0\n\n if p:\n\n ok = m\n\n else:\n\n ng = m\n\n# while\u30eb\u30fc\u30d7\u3092\u629c\u3051\u308b\u3068\u533a\u9593[ok, ng)\u306f[c, c + 1) \u306b\u306a\u3063\u3066\u3044\u308b\n\nans = ok\n\n\n\nprint(ans)\n","target":"BASE = 9973\n\nMOD1 = 10 ** 9 + 7\n\nMOD2 = 998244353\n\n\n\n\n\nclass RollingHash:\n\n # \u6587\u5b57\u5217S\u306e\u30ed\u30fc\u30ea\u30f3\u30b0\u30cf\u30c3\u30b7\u30e5\u3092\u69cb\u7bc9\n\n # \u8a08\u7b97\u91cf: O(N)\n\n def __init__(self, S, MOD):\n\n self.MOD = MOD\n\n # acc[i]\u306fS[0:i]\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3068\u306a\u308b\n\n self.acc = [0]\n\n a = 0\n\n # \u7d2f\u7a4d\u548c\u3092\u8a08\u7b97\u3059\u308b\u30a4\u30e1\u30fc\u30b8\n\n for i, c in enumerate(S):\n\n h = ord(c) - ord(\"a\") + 1\n\n offset = pow(BASE, i, MOD)\n\n a = (a + (h * offset)) % MOD\n\n self.acc.append(a)\n\n\n\n # S[i:j]\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u8fd4\u3059\n\n # \u8a08\u7b97\u91cf: O(1)\n\n def hash(self, i, j):\n\n # \u7d2f\u7a4d\u548c\u3092\u7528\u3044\u3066\u90e8\u5206\u533a\u9593\u306e\u548c\u3092\u8a08\u7b97\u3059\u308b\u30a4\u30e1\u30fc\u30b8\n\n # \u6ce8\u610f: \u57fa\u6570\u306b\u3088\u308b\u30aa\u30d5\u30bb\u30c3\u30c8\u3092\u30ad\u30e3\u30f3\u30bb\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\n\n offset = pow(BASE, i, self.MOD)\n\n # \u7d20\u6570MOD\u3092\u6cd5\u3068\u3059\u308b\u5270\u4f59\u985e\u306b\u304a\u3051\u308b\u9664\u7b97\u306f\u9006\u5143\u3092\u4e57\u7b97\u3059\u308b\u3053\u3068\u3067\u8a08\u7b97\u3067\u304d\u308b\n\n # \u7d20\u6570MOD\u3092\u6cd5\u3068\u3059\u308b\u5270\u4f59\u985e\u306b\u304a\u3051\u308bx\u306e\u9006\u5143\u306fx^(MOD - 2)\u306b\u7b49\u3057\u3044\n\n offset_inv = pow(offset, self.MOD - 2, self.MOD)\n\n return ((self.acc[j] - self.acc[i]) * offset_inv) % self.MOD\n\n\n\n\n\nN = int(eval(input()))\n\nS = eval(input())\n\n\n\n# S\u306e\u30ed\u30fc\u30ea\u30f3\u30b0\u30cf\u30c3\u30b7\u30e5\u3092\u8a08\u7b97\u3057\u3066\u304a\u304f\n\nrolling1 = RollingHash(S, MOD1)\n\nrolling2 = RollingHash(S, MOD2)\n\n\n\n# \u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304cS\u306b\u542b\u307e\u308c\u308b\u306a\u3089\u3070\u3001\u9577\u3055m-1\u306e\u30c0\u30b8\u30e3\u30ec\u3082\u542b\u307e\u308c\u308b\n\n# \u3064\u307e\u308a\u3001\u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304cS\u306b\u542b\u307e\u308c\u308b\u306a\u3089\u3070\u771f\u3068\u306a\u308b\u8ff0\u8a9e\u3092P(m)\u3068\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u3092\u6e80\u305f\u3059\u6574\u6570c\u304c\u5b58\u5728\u3059\u308b:\n\n# - 0\u4ee5\u4e0ac\u4ee5\u4e0b\u306e\u6574\u6570m\u306b\u3064\u3044\u3066P(m)\u306f\u771f\n\n# - c\u3088\u308a\u5927\u304d\u3044\u6574\u6570m\u306b\u3064\u3044\u3066P(m)\u306f\u507d\n\n# \u203b P\u306f\u5358\u8abf\u95a2\u6570\u3068\u3044\u3046\u3053\u3068\n\n# \u3053\u306ec\u3092\u4e8c\u5206\u63a2\u7d22\u3067\u767a\u898b\u3059\u308c\u3070\u9ad8\u901f\u5316\u3067\u304d\u308b\uff01\n\n\n\n# P(ok)\u306f\u771f\n\nok = 0\n\n# P(ng)\u306f\u507d\n\nng = N\n\nwhile ng - ok > 1:\n\n # \u533a\u9593[ok, ng)\u306e\u4e2d\u592e\u5024\u3092m\u3068\u3059\u308b\n\n m = (ok + ng) \/\/ 2\n\n\n\n # \u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304c\u5b58\u5728\u3059\u308b\u304b\u5224\u5b9a\u3059\u308b\n\n # \u9577\u3055m\u306eformer\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\n\n former_cache1 = set()\n\n former_cache2 = set()\n\n p = False\n\n # latter\u306b\u7740\u76ee\u3057\u3066\u30eb\u30fc\u30d7\u3092\u56de\u3059\n\n for i in range(m, N):\n\n # \u30c0\u30b8\u30e3\u30ec\u9577\u3092\u6c7a\u3081\u6253\u3061\u3057\u3066\u3044\u308b\u306e\u3067j\u3092\u76f4\u63a5\u8a08\u7b97\u3067\u304d\u308b\n\n j = i + m\n\n # S[i:j]\u304cS\u3092\u306f\u307f\u51fa\u3057\u305f\u3089\u30eb\u30fc\u30d7\u7d42\u4e86\n\n if j > N:\n\n break\n\n # former\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\n\n former_cache1.add(rolling1.hash(i - m, i))\n\n former_cache2.add(rolling2.hash(i - m, i))\n\n # \u30ad\u30e3\u30c3\u30b7\u30e3\u306b\u540c\u4e00\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\uff08\u30cf\u30c3\u30b7\u30e5\u5024\u304c\u885d\u7a81\u3057\u305f\u5834\u5408\uff09\u3001\u30c0\u30b8\u30e3\u30ec\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u5224\u5b9a\u3067\u304d\u308b\n\n # \u30cf\u30c3\u30b7\u30e5\u5024\u306e\u8a08\u7b97\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u5b58\u5728\u5224\u5b9a\u306f\u5171\u306bO(1)\u3067\u51e6\u7406\u3067\u304d\u308b\uff01\n\n if (\n\n rolling1.hash(i, j) in former_cache1\n\n and rolling2.hash(i, j) in former_cache2\n\n ):\n\n p = True\n\n # \u533a\u9593[ok, ng) \u3092\u66f4\u65b0\n\n if p:\n\n ok = m\n\n else:\n\n ng = m\n\n# while\u30eb\u30fc\u30d7\u3092\u629c\u3051\u308b\u3068\u533a\u9593[ok, ng)\u306f[c, c + 1) \u306b\u306a\u3063\u3066\u3044\u308b\n\nans = ok\n\n\n\nprint(ans)\n","code_v0_loc":77,"code_v1_loc":85,"code_v0_num_chars":1869,"code_v1_num_chars":2141,"code_v0_no_empty_lines":"BASE = 9973\nMOD = 2**61 - 1\n\n\nclass RollingHash:\n # \u6587\u5b57\u5217S\u306e\u30ed\u30fc\u30ea\u30f3\u30b0\u30cf\u30c3\u30b7\u30e5\u3092\u69cb\u7bc9\n # \u8a08\u7b97\u91cf: O(N)\n def __init__(self, S):\n # acc[i]\u306fS[0:i]\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3068\u306a\u308b\n self.acc = [0]\n a = 0\n # \u7d2f\u7a4d\u548c\u3092\u8a08\u7b97\u3059\u308b\u30a4\u30e1\u30fc\u30b8\n for i, c in enumerate(S):\n h = ord(c) - ord(\"a\") + 1\n offset = pow(BASE, i, MOD)\n a = (a + (h * offset)) % MOD\n self.acc.append(a)\n\n # S[i:j]\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u8fd4\u3059\n # \u8a08\u7b97\u91cf: O(1)\n def hash(self, i, j):\n # \u7d2f\u7a4d\u548c\u3092\u7528\u3044\u3066\u90e8\u5206\u533a\u9593\u306e\u548c\u3092\u8a08\u7b97\u3059\u308b\u30a4\u30e1\u30fc\u30b8\n # \u6ce8\u610f: \u57fa\u6570\u306b\u3088\u308b\u30aa\u30d5\u30bb\u30c3\u30c8\u3092\u30ad\u30e3\u30f3\u30bb\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\n offset = pow(BASE, i, MOD)\n # \u7d20\u6570MOD\u3092\u6cd5\u3068\u3059\u308b\u5270\u4f59\u985e\u306b\u304a\u3051\u308b\u9664\u7b97\u306f\u9006\u5143\u3092\u4e57\u7b97\u3059\u308b\u3053\u3068\u3067\u8a08\u7b97\u3067\u304d\u308b\n # \u7d20\u6570MOD\u3092\u6cd5\u3068\u3059\u308b\u5270\u4f59\u985e\u306b\u304a\u3051\u308bx\u306e\u9006\u5143\u306fx^(MOD - 2)\u306b\u7b49\u3057\u3044\n offset_inv = pow(offset, MOD - 2, MOD)\n return ((self.acc[j] - self.acc[i]) * offset_inv) % MOD\n\n\nN = int(eval(input()))\nS = eval(input())\n# S\u306e\u30ed\u30fc\u30ea\u30f3\u30b0\u30cf\u30c3\u30b7\u30e5\u3092\u8a08\u7b97\u3057\u3066\u304a\u304f\nrolling = RollingHash(S)\n# \u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304cS\u306b\u542b\u307e\u308c\u308b\u306a\u3089\u3070\u3001\u9577\u3055m-1\u306e\u30c0\u30b8\u30e3\u30ec\u3082\u542b\u307e\u308c\u308b\n# \u3064\u307e\u308a\u3001\u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304cS\u306b\u542b\u307e\u308c\u308b\u306a\u3089\u3070\u771f\u3068\u306a\u308b\u8ff0\u8a9e\u3092P(m)\u3068\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u3092\u6e80\u305f\u3059\u6574\u6570c\u304c\u5b58\u5728\u3059\u308b:\n# - 0\u4ee5\u4e0ac\u4ee5\u4e0b\u306e\u6574\u6570m\u306b\u3064\u3044\u3066P(m)\u306f\u771f\n# - c\u3088\u308a\u5927\u304d\u3044\u6574\u6570m\u306b\u3064\u3044\u3066P(m)\u306f\u507d\n# \u203b P\u306f\u5358\u8abf\u95a2\u6570\u3068\u3044\u3046\u3053\u3068\n# \u3053\u306ec\u3092\u4e8c\u5206\u63a2\u7d22\u3067\u767a\u898b\u3059\u308c\u3070\u9ad8\u901f\u5316\u3067\u304d\u308b\uff01\n# P(ok)\u306f\u771f\nok = 0\n# P(ng)\u306f\u507d\nng = N\nwhile ng - ok > 1:\n # \u533a\u9593[ok, ng)\u306e\u4e2d\u592e\u5024\u3092m\u3068\u3059\u308b\n m = (ok + ng) \/\/ 2\n # \u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304c\u5b58\u5728\u3059\u308b\u304b\u5224\u5b9a\u3059\u308b\n # \u9577\u3055m\u306eformer\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\n former_cache = set()\n p = False\n # latter\u306b\u7740\u76ee\u3057\u3066\u30eb\u30fc\u30d7\u3092\u56de\u3059\n for i in range(m, N):\n # \u30c0\u30b8\u30e3\u30ec\u9577\u3092\u6c7a\u3081\u6253\u3061\u3057\u3066\u3044\u308b\u306e\u3067j\u3092\u76f4\u63a5\u8a08\u7b97\u3067\u304d\u308b\n j = i + m\n # S[i:j]\u304cS\u3092\u306f\u307f\u51fa\u3057\u305f\u3089\u30eb\u30fc\u30d7\u7d42\u4e86\n if j > N:\n break\n # former\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\n former_cache.add(rolling.hash(i - m, i))\n # \u30ad\u30e3\u30c3\u30b7\u30e3\u306b\u540c\u4e00\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\uff08\u30cf\u30c3\u30b7\u30e5\u5024\u304c\u885d\u7a81\u3057\u305f\u5834\u5408\uff09\u3001\u30c0\u30b8\u30e3\u30ec\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u5224\u5b9a\u3067\u304d\u308b\n if rolling.hash(i, j) in former_cache:\n p = True\n # \u30cf\u30c3\u30b7\u30e5\u5024\u306e\u8a08\u7b97\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u5b58\u5728\u5224\u5b9a\u306f\u5171\u306bO(1)\u3067\u51e6\u7406\u3067\u304d\u308b\uff01\n # \u533a\u9593[ok, ng) \u3092\u66f4\u65b0\n if p:\n ok = m\n else:\n ng = m\n# while\u30eb\u30fc\u30d7\u3092\u629c\u3051\u308b\u3068\u533a\u9593[ok, ng)\u306f[c, c + 1) \u306b\u306a\u3063\u3066\u3044\u308b\nans = ok\nprint(ans)\n","code_v1_no_empty_lines":"BASE = 9973\nMOD1 = 10**9 + 7\nMOD2 = 998244353\n\n\nclass RollingHash:\n # \u6587\u5b57\u5217S\u306e\u30ed\u30fc\u30ea\u30f3\u30b0\u30cf\u30c3\u30b7\u30e5\u3092\u69cb\u7bc9\n # \u8a08\u7b97\u91cf: O(N)\n def __init__(self, S, MOD):\n self.MOD = MOD\n # acc[i]\u306fS[0:i]\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3068\u306a\u308b\n self.acc = [0]\n a = 0\n # \u7d2f\u7a4d\u548c\u3092\u8a08\u7b97\u3059\u308b\u30a4\u30e1\u30fc\u30b8\n for i, c in enumerate(S):\n h = ord(c) - ord(\"a\") + 1\n offset = pow(BASE, i, MOD)\n a = (a + (h * offset)) % MOD\n self.acc.append(a)\n\n # S[i:j]\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u8fd4\u3059\n # \u8a08\u7b97\u91cf: O(1)\n def hash(self, i, j):\n # \u7d2f\u7a4d\u548c\u3092\u7528\u3044\u3066\u90e8\u5206\u533a\u9593\u306e\u548c\u3092\u8a08\u7b97\u3059\u308b\u30a4\u30e1\u30fc\u30b8\n # \u6ce8\u610f: \u57fa\u6570\u306b\u3088\u308b\u30aa\u30d5\u30bb\u30c3\u30c8\u3092\u30ad\u30e3\u30f3\u30bb\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\n offset = pow(BASE, i, self.MOD)\n # \u7d20\u6570MOD\u3092\u6cd5\u3068\u3059\u308b\u5270\u4f59\u985e\u306b\u304a\u3051\u308b\u9664\u7b97\u306f\u9006\u5143\u3092\u4e57\u7b97\u3059\u308b\u3053\u3068\u3067\u8a08\u7b97\u3067\u304d\u308b\n # \u7d20\u6570MOD\u3092\u6cd5\u3068\u3059\u308b\u5270\u4f59\u985e\u306b\u304a\u3051\u308bx\u306e\u9006\u5143\u306fx^(MOD - 2)\u306b\u7b49\u3057\u3044\n offset_inv = pow(offset, self.MOD - 2, self.MOD)\n return ((self.acc[j] - self.acc[i]) * offset_inv) % self.MOD\n\n\nN = int(eval(input()))\nS = eval(input())\n# S\u306e\u30ed\u30fc\u30ea\u30f3\u30b0\u30cf\u30c3\u30b7\u30e5\u3092\u8a08\u7b97\u3057\u3066\u304a\u304f\nrolling1 = RollingHash(S, MOD1)\nrolling2 = RollingHash(S, MOD2)\n# \u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304cS\u306b\u542b\u307e\u308c\u308b\u306a\u3089\u3070\u3001\u9577\u3055m-1\u306e\u30c0\u30b8\u30e3\u30ec\u3082\u542b\u307e\u308c\u308b\n# \u3064\u307e\u308a\u3001\u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304cS\u306b\u542b\u307e\u308c\u308b\u306a\u3089\u3070\u771f\u3068\u306a\u308b\u8ff0\u8a9e\u3092P(m)\u3068\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u3092\u6e80\u305f\u3059\u6574\u6570c\u304c\u5b58\u5728\u3059\u308b:\n# - 0\u4ee5\u4e0ac\u4ee5\u4e0b\u306e\u6574\u6570m\u306b\u3064\u3044\u3066P(m)\u306f\u771f\n# - c\u3088\u308a\u5927\u304d\u3044\u6574\u6570m\u306b\u3064\u3044\u3066P(m)\u306f\u507d\n# \u203b P\u306f\u5358\u8abf\u95a2\u6570\u3068\u3044\u3046\u3053\u3068\n# \u3053\u306ec\u3092\u4e8c\u5206\u63a2\u7d22\u3067\u767a\u898b\u3059\u308c\u3070\u9ad8\u901f\u5316\u3067\u304d\u308b\uff01\n# P(ok)\u306f\u771f\nok = 0\n# P(ng)\u306f\u507d\nng = N\nwhile ng - ok > 1:\n # \u533a\u9593[ok, ng)\u306e\u4e2d\u592e\u5024\u3092m\u3068\u3059\u308b\n m = (ok + ng) \/\/ 2\n # \u9577\u3055m\u306e\u30c0\u30b8\u30e3\u30ec\u304c\u5b58\u5728\u3059\u308b\u304b\u5224\u5b9a\u3059\u308b\n # \u9577\u3055m\u306eformer\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\n former_cache1 = set()\n former_cache2 = set()\n p = False\n # latter\u306b\u7740\u76ee\u3057\u3066\u30eb\u30fc\u30d7\u3092\u56de\u3059\n for i in range(m, N):\n # \u30c0\u30b8\u30e3\u30ec\u9577\u3092\u6c7a\u3081\u6253\u3061\u3057\u3066\u3044\u308b\u306e\u3067j\u3092\u76f4\u63a5\u8a08\u7b97\u3067\u304d\u308b\n j = i + m\n # S[i:j]\u304cS\u3092\u306f\u307f\u51fa\u3057\u305f\u3089\u30eb\u30fc\u30d7\u7d42\u4e86\n if j > N:\n break\n # former\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\n former_cache1.add(rolling1.hash(i - m, i))\n former_cache2.add(rolling2.hash(i - m, i))\n # \u30ad\u30e3\u30c3\u30b7\u30e3\u306b\u540c\u4e00\u306e\u30cf\u30c3\u30b7\u30e5\u5024\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\uff08\u30cf\u30c3\u30b7\u30e5\u5024\u304c\u885d\u7a81\u3057\u305f\u5834\u5408\uff09\u3001\u30c0\u30b8\u30e3\u30ec\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u5224\u5b9a\u3067\u304d\u308b\n # \u30cf\u30c3\u30b7\u30e5\u5024\u306e\u8a08\u7b97\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u5b58\u5728\u5224\u5b9a\u306f\u5171\u306bO(1)\u3067\u51e6\u7406\u3067\u304d\u308b\uff01\n if (\n rolling1.hash(i, j) in former_cache1\n and rolling2.hash(i, j) in former_cache2\n ):\n p = True\n # \u533a\u9593[ok, ng) \u3092\u66f4\u65b0\n if p:\n ok = m\n else:\n ng = m\n# while\u30eb\u30fc\u30d7\u3092\u629c\u3051\u308b\u3068\u533a\u9593[ok, ng)\u306f[c, c + 1) \u306b\u306a\u3063\u3066\u3044\u308b\nans = ok\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.4117647059,"diff":["-MOD = 2**61 - 1","+MOD1 = 10**9 + 7","+MOD2 = 998244353","- def __init__(self, S):","+ def __init__(self, S, MOD):","+ self.MOD = MOD","- offset = pow(BASE, i, MOD)","+ offset = pow(BASE, i, self.MOD)","- offset_inv = pow(offset, MOD - 2, MOD)","- return ((self.acc[j] - self.acc[i]) * offset_inv) % MOD","+ offset_inv = pow(offset, self.MOD - 2, self.MOD)","+ return ((self.acc[j] - self.acc[i]) * offset_inv) % self.MOD","-rolling = RollingHash(S)","+rolling1 = RollingHash(S, MOD1)","+rolling2 = RollingHash(S, MOD2)","- former_cache = set()","+ former_cache1 = set()","+ former_cache2 = set()","- former_cache.add(rolling.hash(i - m, i))","+ former_cache1.add(rolling1.hash(i - m, i))","+ former_cache2.add(rolling2.hash(i - m, i))","- if rolling.hash(i, j) in former_cache:","+ # \u30cf\u30c3\u30b7\u30e5\u5024\u306e\u8a08\u7b97\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u5b58\u5728\u5224\u5b9a\u306f\u5171\u306bO(1)\u3067\u51e6\u7406\u3067\u304d\u308b\uff01","+ if (","+ rolling1.hash(i, j) in former_cache1","+ and rolling2.hash(i, j) in former_cache2","+ ):","- # \u30cf\u30c3\u30b7\u30e5\u5024\u306e\u8a08\u7b97\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u5b58\u5728\u5224\u5b9a\u306f\u5171\u306bO(1)\u3067\u51e6\u7406\u3067\u304d\u308b\uff01"],"diff_only_import_comment":false,"measured_runtime_v0":0.0884283047,"measured_runtime_v1":0.0772582359,"runtime_lift":1.1445809446,"key":["s421788034","s114668991"]} +{"user_id":"u428199834","problem_id":"p02732","language":"python","submission_id_v0":"s983254698","submission_id_v1":"s670867495","cpu_time_v0":454,"cpu_time_v1":221,"memory_v0":26140,"memory_v1":33876,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.32,"input":"N=int(eval(input()))\n\nA=list(map(int,input().split()))\n\ndic={}\n\nfor a in A:\n\n if a in dic:\n\n dic[a]+=1\n\n else:\n\n dic[a]=1\n\n \n\n\n\nc=0\n\nfor i in list(dic.values()):\n\n c+=i*(i-1)\/2\n\nfor j in range(1,N+1):\n\n d=c-dic[A[j-1]]+1\n\n print((int(d)))\n\n \n","target":"n=int(eval(input()))\n\ncnt=[0]*(n+1)\n\na=list(map(int,input().split()))\n\nfor i in range(n):\n\n cnt[a[i]]+=1 \n\nans=0 \n\nfor i in range(1,n+1):\n\n if cnt[i]>=1:\n\n ans+=cnt[i]*(cnt[i]-1)\/\/2\n\nfor i in range(n):\n\n print((ans-cnt[a[i]]+1))\n\n ","code_v0_loc":17,"code_v1_loc":12,"code_v0_num_chars":242,"code_v1_num_chars":231,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\ndic = {}\nfor a in A:\n if a in dic:\n dic[a] += 1\n else:\n dic[a] = 1\nc = 0\nfor i in list(dic.values()):\n c += i * (i - 1) \/ 2\nfor j in range(1, N + 1):\n d = c - dic[A[j - 1]] + 1\n print((int(d)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ncnt = [0] * (n + 1)\na = list(map(int, input().split()))\nfor i in range(n):\n cnt[a[i]] += 1\nans = 0\nfor i in range(1, n + 1):\n if cnt[i] >= 1:\n ans += cnt[i] * (cnt[i] - 1) \/\/ 2\nfor i in range(n):\n print((ans - cnt[a[i]] + 1))\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["-N = int(eval(input()))","-A = list(map(int, input().split()))","-dic = {}","-for a in A:","- if a in dic:","- dic[a] += 1","- else:","- dic[a] = 1","-c = 0","-for i in list(dic.values()):","- c += i * (i - 1) \/ 2","-for j in range(1, N + 1):","- d = c - dic[A[j - 1]] + 1","- print((int(d)))","+n = int(eval(input()))","+cnt = [0] * (n + 1)","+a = list(map(int, input().split()))","+for i in range(n):","+ cnt[a[i]] += 1","+ans = 0","+for i in range(1, n + 1):","+ if cnt[i] >= 1:","+ ans += cnt[i] * (cnt[i] - 1) \/\/ 2","+for i in range(n):","+ print((ans - cnt[a[i]] + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1067376397,"measured_runtime_v1":0.0853105738,"runtime_lift":1.2511654169,"key":["s983254698","s670867495"]} +{"user_id":"u663767599","problem_id":"p03150","language":"python","submission_id_v0":"s790588415","submission_id_v1":"s150541196","cpu_time_v0":56,"cpu_time_v1":19,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.07,"input":"S = eval(input())\n\n\n\n\n\ndef f():\n\n if S == \"keyence\":\n\n print(\"YES\")\n\n else:\n\n n = len(S)\n\n for i in range(n):\n\n for j in range(i, n):\n\n T = \"\"\n\n for k in range(n):\n\n if i <= k <= j:\n\n continue\n\n else:\n\n T += S[k]\n\n if T == \"keyence\":\n\n print(\"YES\")\n\n return\n\n else:\n\n print(\"NO\")\n\n\n\n\n\nf()\n","target":"S = eval(input())\n\n\n\n\n\ndef f():\n\n for i in range(len(S)):\n\n for j in range(len(S)):\n\n if S[:i] + S[j:] == \"keyence\":\n\n print(\"YES\")\n\n return\n\n else:\n\n print(\"NO\")\n\n\n\n\n\nf()\n","code_v0_loc":24,"code_v1_loc":14,"code_v0_num_chars":506,"code_v1_num_chars":227,"code_v0_no_empty_lines":"S = eval(input())\n\n\ndef f():\n if S == \"keyence\":\n print(\"YES\")\n else:\n n = len(S)\n for i in range(n):\n for j in range(i, n):\n T = \"\"\n for k in range(n):\n if i <= k <= j:\n continue\n else:\n T += S[k]\n if T == \"keyence\":\n print(\"YES\")\n return\n else:\n print(\"NO\")\n\n\nf()\n","code_v1_no_empty_lines":"S = eval(input())\n\n\ndef f():\n for i in range(len(S)):\n for j in range(len(S)):\n if S[:i] + S[j:] == \"keyence\":\n print(\"YES\")\n return\n else:\n print(\"NO\")\n\n\nf()\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["- if S == \"keyence\":","- print(\"YES\")","+ for i in range(len(S)):","+ for j in range(len(S)):","+ if S[:i] + S[j:] == \"keyence\":","+ print(\"YES\")","+ return","- n = len(S)","- for i in range(n):","- for j in range(i, n):","- T = \"\"","- for k in range(n):","- if i <= k <= j:","- continue","- else:","- T += S[k]","- if T == \"keyence\":","- print(\"YES\")","- return","- else:","- print(\"NO\")","+ print(\"NO\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0356272233,"measured_runtime_v1":0.0356080656,"runtime_lift":1.000538014,"key":["s790588415","s150541196"]} +{"user_id":"u678167152","problem_id":"p02586","language":"python","submission_id_v0":"s609101918","submission_id_v1":"s765472940","cpu_time_v0":1222,"cpu_time_v1":715,"memory_v0":186484,"memory_v1":186900,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.49,"input":"import sys\n\nimport numpy as np\n\nimport numba\n\nfrom numba import njit, b1, i4, i8, f8\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\n\n\n@njit((i8, i8, i8, i8[:]), cache=True)\n\ndef solve(R,C,K,XYV):\n\n item = np.zeros((R + 1, C + 1), dtype=np.int64)\n\n for i in range(0, 3 * K, 3):\n\n x, y, v = XYV[i:i + 3]\n\n item[x - 1, y - 1] = v\n\n dp = np.zeros((C+1,4), dtype=np.int64)\n\n for i in range(1,R+1):\n\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n\n #\u4e0a\u304b\u3089\u79fb\u52d5\n\n for k in range(4):\n\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n\n dp = new_dp\n\n for j in range(1,C+1):\n\n #\u6a2a\u304b\u3089\u79fb\u52d5\n\n new_dp[j] = np.maximum(new_dp[j],new_dp[j-1])\n\n #\u30a2\u30a4\u30c6\u30e0\u3092\u53d6\u308b\n\n for k in range(2,-1,-1):\n\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i-1,j-1])\n\n ans = dp[-1].max()\n\n return ans\n\n\n\nR, C, K = list(map(int, readline().split()))\n\nXYV = np.array(read().split(), np.int64)\n\nprint((solve(R,C,K,XYV)))\n","target":"import sys\n\nimport numpy as np\n\nimport numba\n\nfrom numba import njit, b1, i4, i8, f8\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\n\n\n@njit((i8, i8, i8, i8[:]), cache=True)\n\ndef solve(R,C,K,XYV):\n\n item = np.zeros((R + 1, C + 1), dtype=np.int64)\n\n for i in range(0, 3 * K, 3):\n\n x, y, v = XYV[i:i + 3]\n\n item[x - 1, y - 1] = v\n\n dp = np.zeros((C+1,4), dtype=np.int64)\n\n for i in range(R):\n\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n\n #\u4e0a\u304b\u3089\u79fb\u52d5\n\n for k in range(4):\n\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n\n dp = new_dp\n\n for j in range(1,C+1):\n\n #\u6a2a\u304b\u3089\u79fb\u52d5\n\n for k in range(4):\n\n new_dp[j,k] = np.maximum(new_dp[j,k],new_dp[j-1,k])\n\n #\u30a2\u30a4\u30c6\u30e0\u3092\u53d6\u308b\n\n for k in range(2,-1,-1):\n\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i,j-1])\n\n ans = dp[-1].max()\n\n return ans\n\n\n\nR, C, K = list(map(int, readline().split()))\n\nXYV = np.array(read().split(), np.int64)\n\nprint((solve(R,C,K,XYV)))\n","code_v0_loc":32,"code_v1_loc":33,"code_v0_num_chars":933,"code_v1_num_chars":961,"code_v0_no_empty_lines":"import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\n\n\n@njit((i8, i8, i8, i8[:]), cache=True)\ndef solve(R, C, K, XYV):\n item = np.zeros((R + 1, C + 1), dtype=np.int64)\n for i in range(0, 3 * K, 3):\n x, y, v = XYV[i : i + 3]\n item[x - 1, y - 1] = v\n dp = np.zeros((C + 1, 4), dtype=np.int64)\n for i in range(1, R + 1):\n new_dp = np.zeros((C + 1, 4), dtype=np.int64)\n # \u4e0a\u304b\u3089\u79fb\u52d5\n for k in range(4):\n new_dp[:, 0] = np.maximum(new_dp[:, 0], dp[:, k])\n dp = new_dp\n for j in range(1, C + 1):\n # \u6a2a\u304b\u3089\u79fb\u52d5\n new_dp[j] = np.maximum(new_dp[j], new_dp[j - 1])\n # \u30a2\u30a4\u30c6\u30e0\u3092\u53d6\u308b\n for k in range(2, -1, -1):\n dp[j, k + 1] = np.maximum(dp[j, k + 1], dp[j, k] + item[i - 1, j - 1])\n ans = dp[-1].max()\n return ans\n\n\nR, C, K = list(map(int, readline().split()))\nXYV = np.array(read().split(), np.int64)\nprint((solve(R, C, K, XYV)))\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\n\n\n@njit((i8, i8, i8, i8[:]), cache=True)\ndef solve(R, C, K, XYV):\n item = np.zeros((R + 1, C + 1), dtype=np.int64)\n for i in range(0, 3 * K, 3):\n x, y, v = XYV[i : i + 3]\n item[x - 1, y - 1] = v\n dp = np.zeros((C + 1, 4), dtype=np.int64)\n for i in range(R):\n new_dp = np.zeros((C + 1, 4), dtype=np.int64)\n # \u4e0a\u304b\u3089\u79fb\u52d5\n for k in range(4):\n new_dp[:, 0] = np.maximum(new_dp[:, 0], dp[:, k])\n dp = new_dp\n for j in range(1, C + 1):\n # \u6a2a\u304b\u3089\u79fb\u52d5\n for k in range(4):\n new_dp[j, k] = np.maximum(new_dp[j, k], new_dp[j - 1, k])\n # \u30a2\u30a4\u30c6\u30e0\u3092\u53d6\u308b\n for k in range(2, -1, -1):\n dp[j, k + 1] = np.maximum(dp[j, k + 1], dp[j, k] + item[i, j - 1])\n ans = dp[-1].max()\n return ans\n\n\nR, C, K = list(map(int, readline().split()))\nXYV = np.array(read().split(), np.int64)\nprint((solve(R, C, K, XYV)))\n","code_same":false,"relative_loc_diff_percent":3.0303030303,"diff":["- for i in range(1, R + 1):","+ for i in range(R):","- new_dp[j] = np.maximum(new_dp[j], new_dp[j - 1])","+ for k in range(4):","+ new_dp[j, k] = np.maximum(new_dp[j, k], new_dp[j - 1, k])","- dp[j, k + 1] = np.maximum(dp[j, k + 1], dp[j, k] + item[i - 1, j - 1])","+ dp[j, k + 1] = np.maximum(dp[j, k + 1], dp[j, k] + item[i, j - 1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.5280307114,"measured_runtime_v1":0.7303380756,"runtime_lift":0.7229949102,"key":["s609101918","s765472940"]} +{"user_id":"u369133448","problem_id":"p03043","language":"python","submission_id_v0":"s603605630","submission_id_v1":"s505123825","cpu_time_v0":57,"cpu_time_v1":48,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.79,"input":"n,k=list(map(int,input().split()))\n\nans=0\n\nfor i in range(1,n+1):\n\n tmp=i\n\n cnt=0\n\n while k>tmp:\n\n tmp=tmp*2\n\n cnt+=1\n\n ans+=(1\/n)*pow(1\/2,cnt)\n\nprint(ans)","target":"n,k=list(map(int,input().split()))\n\nans=0\n\nfor i in range(1,n+1):\n\n tmp=i\n\n div=1\n\n while k>tmp:\n\n tmp=tmp*2\n\n div*=1\/2\n\n ans+=(1\/n)*div\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":159,"code_v1_num_chars":152,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nans = 0\nfor i in range(1, n + 1):\n tmp = i\n cnt = 0\n while k > tmp:\n tmp = tmp * 2\n cnt += 1\n ans += (1 \/ n) * pow(1 \/ 2, cnt)\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nans = 0\nfor i in range(1, n + 1):\n tmp = i\n div = 1\n while k > tmp:\n tmp = tmp * 2\n div *= 1 \/ 2\n ans += (1 \/ n) * div\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- cnt = 0","+ div = 1","- cnt += 1","- ans += (1 \/ n) * pow(1 \/ 2, cnt)","+ div *= 1 \/ 2","+ ans += (1 \/ n) * div"],"diff_only_import_comment":false,"measured_runtime_v0":0.2139231335,"measured_runtime_v1":0.1056642458,"runtime_lift":2.024555534,"key":["s603605630","s505123825"]} +{"user_id":"u499381410","problem_id":"p03212","language":"python","submission_id_v0":"s777609202","submission_id_v1":"s376715959","cpu_time_v0":386,"cpu_time_v1":255,"memory_v0":53980,"memory_v1":45168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.94,"input":"n = eval(input())\n\n\n\nd_len = len(n)\n\n\n\n\n\ndef dfs(d):\n\n ret = 0\n\n if int(d) > int(n):\n\n return 0\n\n if all(i in d for i in ('357')):\n\n ret += 1\n\n for j in '357':\n\n ret += dfs(d + j)\n\n return ret\n\n\n\n\n\nprint((dfs('0')))","target":"from collections import defaultdict, deque, Counter\n\nfrom heapq import heappush, heappop, heapify\n\nimport math\n\nimport bisect\n\nimport random\n\nfrom itertools import permutations, accumulate, combinations, product\n\nimport sys\n\nimport string\n\nfrom bisect import bisect_left, bisect_right\n\nfrom math import factorial, ceil, floor\n\nfrom operator import mul\n\nfrom functools import reduce\n\n\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = 10 ** 20\n\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\n\ndef I(): return int(sys.stdin.buffer.readline())\n\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\n\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\n\ndef IR(n): return [I() for i in range(n)]\n\ndef LIR(n): return [LI() for i in range(n)]\n\ndef SR(n): return [S() for i in range(n)]\n\ndef LSR(n): return [LS() for i in range(n)]\n\ndef SRL(n): return [list(S()) for i in range(n)]\n\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\n\nmod = 1000000007\n\n\n\nn = I()\n\n\n\nret = 0\n\nfor l in range(1, len(str(n)) + 1):\n\n for i in product(*[('3', '5', '7') for _ in range(l)]):\n\n num = ''.join(i)\n\n if '3' not in num or '5' not in num or '7' not in num or int(num) > n:\n\n continue\n\n ret += 1\n\n\n\n\n\nprint(ret)\n","code_v0_loc":17,"code_v1_loc":40,"code_v0_num_chars":243,"code_v1_num_chars":1301,"code_v0_no_empty_lines":"n = eval(input())\nd_len = len(n)\n\n\ndef dfs(d):\n ret = 0\n if int(d) > int(n):\n return 0\n if all(i in d for i in (\"357\")):\n ret += 1\n for j in \"357\":\n ret += dfs(d + j)\n return ret\n\n\nprint((dfs(\"0\")))\n","code_v1_no_empty_lines":"from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor\nfrom operator import mul\nfrom functools import reduce\n\nsys.setrecursionlimit(2147483647)\nINF = 10**20\n\n\ndef LI():\n return list(map(int, sys.stdin.buffer.readline().split()))\n\n\ndef I():\n return int(sys.stdin.buffer.readline())\n\n\ndef LS():\n return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\").split()\n\n\ndef S():\n return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\ndef SRL(n):\n return [list(S()) for i in range(n)]\n\n\ndef MSRL(n):\n return [[int(j) for j in list(S())] for i in range(n)]\n\n\nmod = 1000000007\nn = I()\nret = 0\nfor l in range(1, len(str(n)) + 1):\n for i in product(*[(\"3\", \"5\", \"7\") for _ in range(l)]):\n num = \"\".join(i)\n if \"3\" not in num or \"5\" not in num or \"7\" not in num or int(num) > n:\n continue\n ret += 1\nprint(ret)\n","code_same":false,"relative_loc_diff_percent":57.5,"diff":["-n = eval(input())","-d_len = len(n)","+from collections import defaultdict, deque, Counter","+from heapq import heappush, heappop, heapify","+import math","+import bisect","+import random","+from itertools import permutations, accumulate, combinations, product","+import sys","+import string","+from bisect import bisect_left, bisect_right","+from math import factorial, ceil, floor","+from operator import mul","+from functools import reduce","+","+sys.setrecursionlimit(2147483647)","+INF = 10**20","-def dfs(d):","- ret = 0","- if int(d) > int(n):","- return 0","- if all(i in d for i in (\"357\")):","- ret += 1","- for j in \"357\":","- ret += dfs(d + j)","- return ret","+def LI():","+ return list(map(int, sys.stdin.buffer.readline().split()))","-print((dfs(\"0\")))","+def I():","+ return int(sys.stdin.buffer.readline())","+","+","+def LS():","+ return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\").split()","+","+","+def S():","+ return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")","+","+","+def IR(n):","+ return [I() for i in range(n)]","+","+","+def LIR(n):","+ return [LI() for i in range(n)]","+","+","+def SR(n):","+ return [S() for i in range(n)]","+","+","+def LSR(n):","+ return [LS() for i in range(n)]","+","+","+def SRL(n):","+ return [list(S()) for i in range(n)]","+","+","+def MSRL(n):","+ return [[int(j) for j in list(S())] for i in range(n)]","+","+","+mod = 1000000007","+n = I()","+ret = 0","+for l in range(1, len(str(n)) + 1):","+ for i in product(*[(\"3\", \"5\", \"7\") for _ in range(l)]):","+ num = \"\".join(i)","+ if \"3\" not in num or \"5\" not in num or \"7\" not in num or int(num) > n:","+ continue","+ ret += 1","+print(ret)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443188565,"measured_runtime_v1":0.074051435,"runtime_lift":0.5984874767,"key":["s777609202","s376715959"]} +{"user_id":"u699089116","problem_id":"p03386","language":"python","submission_id_v0":"s788897868","submission_id_v1":"s489284507","cpu_time_v0":166,"cpu_time_v1":29,"memory_v0":38256,"memory_v1":9196,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.53,"input":"a, b, k = list(map(int, input().split()))\n\n\n\nif b - a < k*2:\n\n for j in [i for i in range(a, b+1)]:\n\n print(j)\n\nelse:\n\n for j in [i for i in range(a, a+k)]:\n\n print(j)\n\n for j in [i for i in range(b-k+1, b+1)]:\n\n print(j)","target":"A, B, K = list(map(int, input().split()))\n\n\n\nL = []\n\ns = [i for i in range(A, min(A+K, B+1))]\n\nl = [j for j in range(B, max(A-1, B-K), -1)]\n\nL += s + l\n\nL = list(set(L))\n\nL.sort()\n\n\n\nfor i in L:\n\n print(i)","code_v0_loc":10,"code_v1_loc":11,"code_v0_num_chars":245,"code_v1_num_chars":202,"code_v0_no_empty_lines":"a, b, k = list(map(int, input().split()))\nif b - a < k * 2:\n for j in [i for i in range(a, b + 1)]:\n print(j)\nelse:\n for j in [i for i in range(a, a + k)]:\n print(j)\n for j in [i for i in range(b - k + 1, b + 1)]:\n print(j)\n","code_v1_no_empty_lines":"A, B, K = list(map(int, input().split()))\nL = []\ns = [i for i in range(A, min(A + K, B + 1))]\nl = [j for j in range(B, max(A - 1, B - K), -1)]\nL += s + l\nL = list(set(L))\nL.sort()\nfor i in L:\n print(i)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-a, b, k = list(map(int, input().split()))","-if b - a < k * 2:","- for j in [i for i in range(a, b + 1)]:","- print(j)","-else:","- for j in [i for i in range(a, a + k)]:","- print(j)","- for j in [i for i in range(b - k + 1, b + 1)]:","- print(j)","+A, B, K = list(map(int, input().split()))","+L = []","+s = [i for i in range(A, min(A + K, B + 1))]","+l = [j for j in range(B, max(A - 1, B - K), -1)]","+L += s + l","+L = list(set(L))","+L.sort()","+for i in L:","+ print(i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.047244576,"measured_runtime_v1":0.043220156,"runtime_lift":1.093114426,"key":["s788897868","s489284507"]} +{"user_id":"u909643606","problem_id":"p03018","language":"python","submission_id_v0":"s930017339","submission_id_v1":"s069479303","cpu_time_v0":100,"cpu_time_v1":45,"memory_v0":3500,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.0,"input":"s = eval(input())\n\nstock_bc = 0\n\nstate = 0\n\nans = 0\n\n\n\nfor i in range(len(s)):\n\n\n\n if s[-1-i] == \"C\":\n\n if state == 1:\n\n stock_bc = 0\n\n state = 1\n\n\n\n elif s[-1-i] == \"B\":\n\n if state == 0:\n\n stock_bc = 0\n\n elif state == 1:\n\n stock_bc += 1\n\n state = 0\n\n\n\n elif s[-1-i] == \"A\":\n\n if state == 0:\n\n ans += stock_bc\n\n else:\n\n stock_bc = 0\n\n state = 2\n\n\n\nprint(ans)","target":"s = eval(input())\n\ns2 = s.replace(\"BC\", \"D\")\n\n\n\nA, ans = 0, 0\n\n\n\nfor i in s2:\n\n if i == \"A\":\n\n A += 1\n\n elif i == \"D\":\n\n ans += A\n\n else:\n\n A = 0\n\n\n\nprint(ans)","code_v0_loc":27,"code_v1_loc":14,"code_v0_num_chars":476,"code_v1_num_chars":183,"code_v0_no_empty_lines":"s = eval(input())\nstock_bc = 0\nstate = 0\nans = 0\nfor i in range(len(s)):\n if s[-1 - i] == \"C\":\n if state == 1:\n stock_bc = 0\n state = 1\n elif s[-1 - i] == \"B\":\n if state == 0:\n stock_bc = 0\n elif state == 1:\n stock_bc += 1\n state = 0\n elif s[-1 - i] == \"A\":\n if state == 0:\n ans += stock_bc\n else:\n stock_bc = 0\n state = 2\nprint(ans)\n","code_v1_no_empty_lines":"s = eval(input())\ns2 = s.replace(\"BC\", \"D\")\nA, ans = 0, 0\nfor i in s2:\n if i == \"A\":\n A += 1\n elif i == \"D\":\n ans += A\n else:\n A = 0\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":48.1481481481,"diff":["-stock_bc = 0","-state = 0","-ans = 0","-for i in range(len(s)):","- if s[-1 - i] == \"C\":","- if state == 1:","- stock_bc = 0","- state = 1","- elif s[-1 - i] == \"B\":","- if state == 0:","- stock_bc = 0","- elif state == 1:","- stock_bc += 1","- state = 0","- elif s[-1 - i] == \"A\":","- if state == 0:","- ans += stock_bc","- else:","- stock_bc = 0","- state = 2","+s2 = s.replace(\"BC\", \"D\")","+A, ans = 0, 0","+for i in s2:","+ if i == \"A\":","+ A += 1","+ elif i == \"D\":","+ ans += A","+ else:","+ A = 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.0879663792,"measured_runtime_v1":0.0317355006,"runtime_lift":2.7718604574,"key":["s930017339","s069479303"]} +{"user_id":"u936985471","problem_id":"p02659","language":"python","submission_id_v0":"s639106177","submission_id_v1":"s382091575","cpu_time_v0":32,"cpu_time_v1":24,"memory_v0":10604,"memory_v1":9120,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"from fractions import Fraction\n\n\n\nA,B = input().split()\n\n#A = int(A)\n\n#B = float(B)\n\n\n\nfrom decimal import *\n\n\n\na = Decimal(A)\n\nb = Decimal(B)\n\ngetcontext().prec = 28\n\nans = a * b\n\nprint((int(ans)))\n","target":"import sys\n\nreadline = sys.stdin.readline\n\n\n\nA,B = readline().split()\n\nA = int(A)\n\nB = int(float(B) * 100 + 0.5)\n\n\n\nprint((A * B \/\/ 100))","code_v0_loc":13,"code_v1_loc":8,"code_v0_num_chars":197,"code_v1_num_chars":135,"code_v0_no_empty_lines":"from fractions import Fraction\n\nA, B = input().split()\n# A = int(A)\n# B = float(B)\nfrom decimal import *\n\na = Decimal(A)\nb = Decimal(B)\ngetcontext().prec = 28\nans = a * b\nprint((int(ans)))\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nA, B = readline().split()\nA = int(A)\nB = int(float(B) * 100 + 0.5)\nprint((A * B \/\/ 100))\n","code_same":false,"relative_loc_diff_percent":38.4615384615,"diff":["-from fractions import Fraction","+import sys","-A, B = input().split()","-# A = int(A)","-# B = float(B)","-from decimal import *","-","-a = Decimal(A)","-b = Decimal(B)","-getcontext().prec = 28","-ans = a * b","-print((int(ans)))","+readline = sys.stdin.readline","+A, B = readline().split()","+A = int(A)","+B = int(float(B) * 100 + 0.5)","+print((A * B \/\/ 100))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0526637166,"measured_runtime_v1":0.0454223895,"runtime_lift":1.1594219748,"key":["s639106177","s382091575"]} +{"user_id":"u251828455","problem_id":"p03390","language":"python","submission_id_v0":"s883519291","submission_id_v1":"s453169666","cpu_time_v0":1988,"cpu_time_v1":1082,"memory_v0":2696,"memory_v1":2760,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.57,"input":"def getKth(x, a, k):\n\n if(k < a):\n\n return k\n\n return k + 1\n\ndef getRKth(x, a, k):\n\n if(x < a):\n\n return x - k + 1\n\n if(k < (x - a)):\n\n return x - k + 1\n\n return x - k\n\ndef NB(x, b):\n\n if(x < b):\n\n return x\n\n return x + 1\n\ndef f(x, a, b):\n\n half = (x + 1) \/ 2\n\n rep = 0\n\n for delta in range(-50, 51):\n\n if(half + delta >= 1 and half + delta <= x):\n\n rep = max(rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta))\n\n half = b - a\n\n for delta in range(-50, 51):\n\n if(half + delta >= 1 and half + delta <= x):\n\n rep = max(rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta))\n\n half = NB(x, b) - b\n\n for delta in range(-50, 51):\n\n if(half + delta >= 1 and half + delta <= x):\n\n rep = max(rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta))\n\n return rep\n\nq = int(input())\n\nwhile(q > 0):\n\n a, b = list(map(int, input().split()))\n\n if(a > b):\n\n a, b = b, a\n\n lo = 1\n\n hi = 10**19\n\n res = 0\n\n # print f(1, a, b)\n\n # print f(2, a, b)\n\n # print f(3, a, b)\n\n # print getKth(2, a, 1), getRKth(NB(2, b), b, 1)\n\n # print getKth(2, a, 2), getRKth(NB(2, b), b, 2)\n\n while(lo <= hi):\n\n mid = (lo + hi)\/2\n\n if(f(mid, a, b) < a * b):\n\n lo = mid + 1\n\n res = mid\n\n else:\n\n hi = mid - 1\n\n print(res)\n\n q -= 1\n","target":"def getKth(x, a, k):\n\n if(k < a):\n\n return k\n\n return k + 1\n\ndef getRKth(x, a, k):\n\n if(x < a):\n\n return x - k + 1\n\n if(k < (x - a)):\n\n return x - k + 1\n\n return x - k\n\ndef NB(x, b):\n\n if(x < b):\n\n return x\n\n return x + 1\n\ndef f(x, a, b):\n\n mv = 25\n\n half = (x + 1) \/ 2\n\n rep = 0\n\n for delta in range(-mv, mv + 1):\n\n if(half + delta >= 1 and half + delta <= x):\n\n rep = max(rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta))\n\n half = b - a\n\n for delta in range(-mv, mv + 1):\n\n if(half + delta >= 1 and half + delta <= x):\n\n rep = max(rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta))\n\n half = NB(x, b) - b\n\n for delta in range(-mv, mv + 1):\n\n if(half + delta >= 1 and half + delta <= x):\n\n rep = max(rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta))\n\n return rep\n\nq = int(input())\n\nwhile(q > 0):\n\n a, b = list(map(int, input().split()))\n\n if(a > b):\n\n a, b = b, a\n\n lo = 1\n\n hi = 10**19\n\n res = 0\n\n # print f(1, a, b)\n\n # print f(2, a, b)\n\n # print f(3, a, b)\n\n # print getKth(2, a, 1), getRKth(NB(2, b), b, 1)\n\n # print getKth(2, a, 2), getRKth(NB(2, b), b, 2)\n\n while(lo <= hi):\n\n mid = (lo + hi)\/2\n\n if(f(mid, a, b) < a * b):\n\n lo = mid + 1\n\n res = mid\n\n else:\n\n hi = mid - 1\n\n print(res)\n\n q -= 1\n","code_v0_loc":51,"code_v1_loc":52,"code_v0_num_chars":1469,"code_v1_num_chars":1494,"code_v0_no_empty_lines":"def getKth(x, a, k):\n if k < a:\n return k\n return k + 1\n\n\ndef getRKth(x, a, k):\n if x < a:\n return x - k + 1\n if k < (x - a):\n return x - k + 1\n return x - k\n\n\ndef NB(x, b):\n if x < b:\n return x\n return x + 1\n\n\ndef f(x, a, b):\n half = (x + 1) \/ 2\n rep = 0\n for delta in range(-50, 51):\n if half + delta >= 1 and half + delta <= x:\n rep = max(\n rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta)\n )\n half = b - a\n for delta in range(-50, 51):\n if half + delta >= 1 and half + delta <= x:\n rep = max(\n rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta)\n )\n half = NB(x, b) - b\n for delta in range(-50, 51):\n if half + delta >= 1 and half + delta <= x:\n rep = max(\n rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta)\n )\n return rep\n\n\nq = int(input())\nwhile q > 0:\n a, b = list(map(int, input().split()))\n if a > b:\n a, b = b, a\n lo = 1\n hi = 10**19\n res = 0\n # print f(1, a, b)\n # print f(2, a, b)\n # print f(3, a, b)\n # print getKth(2, a, 1), getRKth(NB(2, b), b, 1)\n # print getKth(2, a, 2), getRKth(NB(2, b), b, 2)\n while lo <= hi:\n mid = (lo + hi) \/ 2\n if f(mid, a, b) < a * b:\n lo = mid + 1\n res = mid\n else:\n hi = mid - 1\n print(res)\n q -= 1\n","code_v1_no_empty_lines":"def getKth(x, a, k):\n if k < a:\n return k\n return k + 1\n\n\ndef getRKth(x, a, k):\n if x < a:\n return x - k + 1\n if k < (x - a):\n return x - k + 1\n return x - k\n\n\ndef NB(x, b):\n if x < b:\n return x\n return x + 1\n\n\ndef f(x, a, b):\n mv = 25\n half = (x + 1) \/ 2\n rep = 0\n for delta in range(-mv, mv + 1):\n if half + delta >= 1 and half + delta <= x:\n rep = max(\n rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta)\n )\n half = b - a\n for delta in range(-mv, mv + 1):\n if half + delta >= 1 and half + delta <= x:\n rep = max(\n rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta)\n )\n half = NB(x, b) - b\n for delta in range(-mv, mv + 1):\n if half + delta >= 1 and half + delta <= x:\n rep = max(\n rep, getKth(x, a, half + delta) * getRKth(NB(x, b), b, half + delta)\n )\n return rep\n\n\nq = int(input())\nwhile q > 0:\n a, b = list(map(int, input().split()))\n if a > b:\n a, b = b, a\n lo = 1\n hi = 10**19\n res = 0\n # print f(1, a, b)\n # print f(2, a, b)\n # print f(3, a, b)\n # print getKth(2, a, 1), getRKth(NB(2, b), b, 1)\n # print getKth(2, a, 2), getRKth(NB(2, b), b, 2)\n while lo <= hi:\n mid = (lo + hi) \/ 2\n if f(mid, a, b) < a * b:\n lo = mid + 1\n res = mid\n else:\n hi = mid - 1\n print(res)\n q -= 1\n","code_same":false,"relative_loc_diff_percent":1.9230769231,"diff":["+ mv = 25","- for delta in range(-50, 51):","+ for delta in range(-mv, mv + 1):","- for delta in range(-50, 51):","+ for delta in range(-mv, mv + 1):","- for delta in range(-50, 51):","+ for delta in range(-mv, mv + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.4075129509,"measured_runtime_v1":0.3320132732,"runtime_lift":1.2273995763,"key":["s883519291","s453169666"]} +{"user_id":"u864197622","problem_id":"p03007","language":"python","submission_id_v0":"s047732695","submission_id_v1":"s923694525","cpu_time_v0":435,"cpu_time_v1":372,"memory_v0":65108,"memory_v1":62628,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.48,"input":"N = int(eval(input()))\n\nA = [int(a) for a in input().split()]\n\nB = [abs(a) for a in A]\n\n\n\nfor i in range(N):\n\n if A[i] > 0:\n\n po = i\n\n break\n\nelse:\n\n po = -1\n\nfor i in range(N):\n\n if A[i] < 0:\n\n ne = i\n\n break\n\nelse:\n\n ne = -1\n\nmi = min(B)\n\nfor i in range(N):\n\n if B[i] == mi:\n\n mii = i\n\n break\n\nelse:\n\n mii = -1\n\n\n\nif po >= 0 and ne >= 0:\n\n print((sum(B)))\n\n t1, t2 = A[po], A[ne]\n\n if po > ne:\n\n po, ne = ne, po\n\n # print(\"pone =\", po, ne)\n\n if po == ne:\n\n del A[ne]\n\n A = [0] + A\n\n else:\n\n del A[ne]\n\n del A[po]\n\n A = [t1, t2] + A\n\nelse:\n\n print((sum(B) - 2 * mi))\n\n t = A[mii]\n\n del A[mii]\n\n A = [t] + A\n\n# print(A)\n\nprev = A[0]\n\nfor i in range(1, N):\n\n a, b = max(prev, A[i]), min(prev, A[i])\n\n if i == N-1 or A[i+1] < 0:\n\n print((a, b))\n\n prev = a - b\n\n else:\n\n print((b, a))\n\n prev = b - a\n","target":"N = int(eval(input()))\n\nA = sorted([int(a) for a in input().split()])\n\nprint((A[-1]-A[0]+sum([abs(a) for a in A[1:-1]])))\n\n\n\np = A[-1]\n\nfor i in range(N-1):\n\n a, b = max(p, A[i]), min(p, A[i])\n\n if i == N-2 or A[i+1] < 0:\n\n print((a, b))\n\n p = a - b\n\n else:\n\n print((b, a))\n\n p = b - a","code_v0_loc":52,"code_v1_loc":13,"code_v0_num_chars":952,"code_v1_num_chars":310,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [int(a) for a in input().split()]\nB = [abs(a) for a in A]\nfor i in range(N):\n if A[i] > 0:\n po = i\n break\nelse:\n po = -1\nfor i in range(N):\n if A[i] < 0:\n ne = i\n break\nelse:\n ne = -1\nmi = min(B)\nfor i in range(N):\n if B[i] == mi:\n mii = i\n break\nelse:\n mii = -1\nif po >= 0 and ne >= 0:\n print((sum(B)))\n t1, t2 = A[po], A[ne]\n if po > ne:\n po, ne = ne, po\n # print(\"pone =\", po, ne)\n if po == ne:\n del A[ne]\n A = [0] + A\n else:\n del A[ne]\n del A[po]\n A = [t1, t2] + A\nelse:\n print((sum(B) - 2 * mi))\n t = A[mii]\n del A[mii]\n A = [t] + A\n# print(A)\nprev = A[0]\nfor i in range(1, N):\n a, b = max(prev, A[i]), min(prev, A[i])\n if i == N - 1 or A[i + 1] < 0:\n print((a, b))\n prev = a - b\n else:\n print((b, a))\n prev = b - a\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = sorted([int(a) for a in input().split()])\nprint((A[-1] - A[0] + sum([abs(a) for a in A[1:-1]])))\np = A[-1]\nfor i in range(N - 1):\n a, b = max(p, A[i]), min(p, A[i])\n if i == N - 2 or A[i + 1] < 0:\n print((a, b))\n p = a - b\n else:\n print((b, a))\n p = b - a\n","code_same":false,"relative_loc_diff_percent":75.0,"diff":["-A = [int(a) for a in input().split()]","-B = [abs(a) for a in A]","-for i in range(N):","- if A[i] > 0:","- po = i","- break","-else:","- po = -1","-for i in range(N):","- if A[i] < 0:","- ne = i","- break","-else:","- ne = -1","-mi = min(B)","-for i in range(N):","- if B[i] == mi:","- mii = i","- break","-else:","- mii = -1","-if po >= 0 and ne >= 0:","- print((sum(B)))","- t1, t2 = A[po], A[ne]","- if po > ne:","- po, ne = ne, po","- # print(\"pone =\", po, ne)","- if po == ne:","- del A[ne]","- A = [0] + A","- else:","- del A[ne]","- del A[po]","- A = [t1, t2] + A","-else:","- print((sum(B) - 2 * mi))","- t = A[mii]","- del A[mii]","- A = [t] + A","-# print(A)","-prev = A[0]","-for i in range(1, N):","- a, b = max(prev, A[i]), min(prev, A[i])","- if i == N - 1 or A[i + 1] < 0:","+A = sorted([int(a) for a in input().split()])","+print((A[-1] - A[0] + sum([abs(a) for a in A[1:-1]])))","+p = A[-1]","+for i in range(N - 1):","+ a, b = max(p, A[i]), min(p, A[i])","+ if i == N - 2 or A[i + 1] < 0:","- prev = a - b","+ p = a - b","- prev = b - a","+ p = b - a"],"diff_only_import_comment":false,"measured_runtime_v0":0.0461438416,"measured_runtime_v1":0.1108452056,"runtime_lift":0.4162908203,"key":["s047732695","s923694525"]} +{"user_id":"u707808519","problem_id":"p02695","language":"python","submission_id_v0":"s456541385","submission_id_v1":"s185841543","cpu_time_v0":1243,"cpu_time_v1":317,"memory_v0":9192,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.5,"input":"import itertools\n\nN, M, Q = list(map(int, input().split()))\n\nbuff = [list(map(int, input().split())) for _ in range(Q)]\n\n\n\nans = 0\n\nfor A in itertools.combinations_with_replacement(list(range(1, M+1)), N):\n\n score = 0\n\n for a, b, c, d in buff:\n\n if A[b-1] - A[a-1] == c:\n\n score += d\n\n ans = max(ans, score)\n\n\n\nprint(ans)","target":"# coding: utf-8\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef dfs(A):\n\n # \u518d\u4ee3\u5165\u306e\u305f\u3081\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u5ba3\u8a00\n\n global ans\n\n \n\n # N\u6841\u306a\u3089\u8a08\u7b97\n\n if len(A) == N:\n\n score = 0\n\n for a, b, c, d in buff:\n\n if A[b-1] - A[a-1] == c:\n\n score += d\n\n ans = max(ans, score)\n\n return\n\n \n\n A.append(A[-1])\n\n # \u518d\u5e30\n\n while A[-1] <= M:\n\n # \u30b3\u30d4\u30fc\u3092\u6e21\u3059\n\n dfs(A[:])\n\n A[-1] += 1\n\n\n\n\n\n# main\n\nN, M, Q = list(map(int, input().split()))\n\nbuff = [list(map(int, input().split())) for _ in range(Q)]\n\n\n\nans = 0\n\ndfs([1])\n\n\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":34,"code_v0_num_chars":336,"code_v1_num_chars":607,"code_v0_no_empty_lines":"import itertools\n\nN, M, Q = list(map(int, input().split()))\nbuff = [list(map(int, input().split())) for _ in range(Q)]\nans = 0\nfor A in itertools.combinations_with_replacement(list(range(1, M + 1)), N):\n score = 0\n for a, b, c, d in buff:\n if A[b - 1] - A[a - 1] == c:\n score += d\n ans = max(ans, score)\nprint(ans)\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\n\n\ndef dfs(A):\n # \u518d\u4ee3\u5165\u306e\u305f\u3081\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u5ba3\u8a00\n global ans\n # N\u6841\u306a\u3089\u8a08\u7b97\n if len(A) == N:\n score = 0\n for a, b, c, d in buff:\n if A[b - 1] - A[a - 1] == c:\n score += d\n ans = max(ans, score)\n return\n A.append(A[-1])\n # \u518d\u5e30\n while A[-1] <= M:\n # \u30b3\u30d4\u30fc\u3092\u6e21\u3059\n dfs(A[:])\n A[-1] += 1\n\n\n# main\nN, M, Q = list(map(int, input().split()))\nbuff = [list(map(int, input().split())) for _ in range(Q)]\nans = 0\ndfs([1])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":61.7647058824,"diff":["-import itertools","+# coding: utf-8","+import sys","+input = sys.stdin.readline","+sys.setrecursionlimit(10**7)","+","+","+def dfs(A):","+ # \u518d\u4ee3\u5165\u306e\u305f\u3081\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u5ba3\u8a00","+ global ans","+ # N\u6841\u306a\u3089\u8a08\u7b97","+ if len(A) == N:","+ score = 0","+ for a, b, c, d in buff:","+ if A[b - 1] - A[a - 1] == c:","+ score += d","+ ans = max(ans, score)","+ return","+ A.append(A[-1])","+ # \u518d\u5e30","+ while A[-1] <= M:","+ # \u30b3\u30d4\u30fc\u3092\u6e21\u3059","+ dfs(A[:])","+ A[-1] += 1","+","+","+# main","-for A in itertools.combinations_with_replacement(list(range(1, M + 1)), N):","- score = 0","- for a, b, c, d in buff:","- if A[b - 1] - A[a - 1] == c:","- score += d","- ans = max(ans, score)","+dfs([1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0506148,"measured_runtime_v1":0.0523819396,"runtime_lift":0.9662643328,"key":["s456541385","s185841543"]} +{"user_id":"u112629957","problem_id":"p02707","language":"python","submission_id_v0":"s507739017","submission_id_v1":"s136100760","cpu_time_v0":185,"cpu_time_v1":152,"memory_v0":34184,"memory_v1":32360,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.84,"input":"from collections import Counter\n\nN = int(eval(input()))\n\nList = list(map(int,input().split()))\n\nC = Counter(List)\n\n\n\nfor i in range(1,N):\n\n if i in list(C.keys()):\n\n print((C[i]))\n\n else:\n\n print((0))\n\nprint((0))","target":"N = int(eval(input()))\n\nls = list(map(int,input().split()))\n\ncnt = [0] * (N+1)\n\n\n\nfor i in range(N-1):\n\n cnt[ls[i]] += 1\n\n \n\nfor i in range(1,N+1):\n\n print((cnt[i]))","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":202,"code_v1_num_chars":166,"code_v0_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\nList = list(map(int, input().split()))\nC = Counter(List)\nfor i in range(1, N):\n if i in list(C.keys()):\n print((C[i]))\n else:\n print((0))\nprint((0))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nls = list(map(int, input().split()))\ncnt = [0] * (N + 1)\nfor i in range(N - 1):\n cnt[ls[i]] += 1\nfor i in range(1, N + 1):\n print((cnt[i]))\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-from collections import Counter","-","-List = list(map(int, input().split()))","-C = Counter(List)","-for i in range(1, N):","- if i in list(C.keys()):","- print((C[i]))","- else:","- print((0))","-print((0))","+ls = list(map(int, input().split()))","+cnt = [0] * (N + 1)","+for i in range(N - 1):","+ cnt[ls[i]] += 1","+for i in range(1, N + 1):","+ print((cnt[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.05009059,"measured_runtime_v1":0.1205275116,"runtime_lift":0.4155946583,"key":["s507739017","s136100760"]} +{"user_id":"u533039576","problem_id":"p02713","language":"python","submission_id_v0":"s823297862","submission_id_v1":"s998021557","cpu_time_v0":273,"cpu_time_v1":193,"memory_v0":81032,"memory_v1":67720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.3,"input":"def GCD(a, b):\n\n return a if b == 0 else GCD(b, a % b)\n\n\n\n\n\nk = int(eval(input()))\n\n\n\nans = 0\n\nfor a in range(1, k + 1):\n\n for b in range(1, k + 1):\n\n ab = GCD(a, b)\n\n if ab == 1:\n\n ans += k\n\n continue\n\n for c in range(1, k + 1):\n\n ans += GCD(ab, c)\n\n\n\nprint(ans)\n","target":"from math import gcd\n\n\n\nk = int(eval(input()))\n\n\n\nans = 0\n\nfor a in range(1, k + 1):\n\n for b in range(1, k + 1):\n\n ab = gcd(a, b)\n\n for c in range(1, k + 1):\n\n ans += gcd(ab, c)\n\n\n\nprint(ans)\n","code_v0_loc":17,"code_v1_loc":12,"code_v0_num_chars":318,"code_v1_num_chars":214,"code_v0_no_empty_lines":"def GCD(a, b):\n return a if b == 0 else GCD(b, a % b)\n\n\nk = int(eval(input()))\nans = 0\nfor a in range(1, k + 1):\n for b in range(1, k + 1):\n ab = GCD(a, b)\n if ab == 1:\n ans += k\n continue\n for c in range(1, k + 1):\n ans += GCD(ab, c)\nprint(ans)\n","code_v1_no_empty_lines":"from math import gcd\n\nk = int(eval(input()))\nans = 0\nfor a in range(1, k + 1):\n for b in range(1, k + 1):\n ab = gcd(a, b)\n for c in range(1, k + 1):\n ans += gcd(ab, c)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["-def GCD(a, b):","- return a if b == 0 else GCD(b, a % b)","-","+from math import gcd","- ab = GCD(a, b)","- if ab == 1:","- ans += k","- continue","+ ab = gcd(a, b)","- ans += GCD(ab, c)","+ ans += gcd(ab, c)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1221834154,"measured_runtime_v1":0.098860465,"runtime_lift":1.2359178701,"key":["s823297862","s998021557"]} +{"user_id":"u159808230","problem_id":"p03273","language":"python","submission_id_v0":"s903460263","submission_id_v1":"s180936557","cpu_time_v0":22,"cpu_time_v1":20,"memory_v0":3316,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.09,"input":"l = [int(i) for i in input().split(\" \")]\n\nh = l[0]\n\nw = l[1]\n\n\n\nm = []\n\nm_t = []\n\nm_tt = []\n\n# .\u306e\u307f\u306e\u884c\u3092\u53d6\u308a\u9664\u304f\n\nfor i in range(h):\n\n row = list(eval(input()))\n\n if \"#\" not in row:\n\n pass\n\n else:\n\n m.append(row)\n\n\n\n# \u8ee2\u7f6e\u3057\u3066.\u306e\u307f\u306e\u884c\u3092\u53d6\u308a\u9664\u304f\n\nfor i in range(w):\n\n row = []\n\n for j in range(len(m)):\n\n row.append(m[j][i])\n\n if \"#\" not in row:\n\n pass\n\n else:\n\n m_t.append(row)\n\n\n\n# \u518d\u3073\u8ee2\u7f6e\u3059\u308b\n\nfor i in range(len(m)):\n\n row = []\n\n for j in range(len(m_t)):\n\n row.append(m_t[j][i])\n\n m_tt.append(row)\n\n\n\nfor row in m_tt:\n\n print((\"\".join(row)))\n","target":"l = [int(i) for i in input().split(\" \")]\n\nh = l[0]\n\nw = l[1]\n\nm = []\n\n\n\ndef trans(matrix):\n\n t_matrix = []\n\n h = len(matrix)\n\n w = len(matrix[0])\n\n for i in range(w):\n\n row = []\n\n for j in range(h):\n\n row.append(matrix[j][i])\n\n t_matrix.append(row)\n\n return t_matrix\n\n\n\ndef remove_dot(matrix):\n\n new_matrix = []\n\n for row in matrix:\n\n if \"#\" not in row:\n\n pass\n\n else:\n\n new_matrix.append(row)\n\n return new_matrix\n\n\n\nfor i in range(h):\n\n m.append(list(eval(input())))\n\nfor i in range(2):\n\n m = remove_dot(m)\n\n m = trans(m)\n\nfor row in m:\n\n print((\"\".join(row)))\n","code_v0_loc":34,"code_v1_loc":32,"code_v0_num_chars":589,"code_v1_num_chars":658,"code_v0_no_empty_lines":"l = [int(i) for i in input().split(\" \")]\nh = l[0]\nw = l[1]\nm = []\nm_t = []\nm_tt = []\n# .\u306e\u307f\u306e\u884c\u3092\u53d6\u308a\u9664\u304f\nfor i in range(h):\n row = list(eval(input()))\n if \"#\" not in row:\n pass\n else:\n m.append(row)\n# \u8ee2\u7f6e\u3057\u3066.\u306e\u307f\u306e\u884c\u3092\u53d6\u308a\u9664\u304f\nfor i in range(w):\n row = []\n for j in range(len(m)):\n row.append(m[j][i])\n if \"#\" not in row:\n pass\n else:\n m_t.append(row)\n# \u518d\u3073\u8ee2\u7f6e\u3059\u308b\nfor i in range(len(m)):\n row = []\n for j in range(len(m_t)):\n row.append(m_t[j][i])\n m_tt.append(row)\nfor row in m_tt:\n print((\"\".join(row)))\n","code_v1_no_empty_lines":"l = [int(i) for i in input().split(\" \")]\nh = l[0]\nw = l[1]\nm = []\n\n\ndef trans(matrix):\n t_matrix = []\n h = len(matrix)\n w = len(matrix[0])\n for i in range(w):\n row = []\n for j in range(h):\n row.append(matrix[j][i])\n t_matrix.append(row)\n return t_matrix\n\n\ndef remove_dot(matrix):\n new_matrix = []\n for row in matrix:\n if \"#\" not in row:\n pass\n else:\n new_matrix.append(row)\n return new_matrix\n\n\nfor i in range(h):\n m.append(list(eval(input())))\nfor i in range(2):\n m = remove_dot(m)\n m = trans(m)\nfor row in m:\n print((\"\".join(row)))\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-m_t = []","-m_tt = []","-# .\u306e\u307f\u306e\u884c\u3092\u53d6\u308a\u9664\u304f","+","+","+def trans(matrix):","+ t_matrix = []","+ h = len(matrix)","+ w = len(matrix[0])","+ for i in range(w):","+ row = []","+ for j in range(h):","+ row.append(matrix[j][i])","+ t_matrix.append(row)","+ return t_matrix","+","+","+def remove_dot(matrix):","+ new_matrix = []","+ for row in matrix:","+ if \"#\" not in row:","+ pass","+ else:","+ new_matrix.append(row)","+ return new_matrix","+","+","- row = list(eval(input()))","- if \"#\" not in row:","- pass","- else:","- m.append(row)","-# \u8ee2\u7f6e\u3057\u3066.\u306e\u307f\u306e\u884c\u3092\u53d6\u308a\u9664\u304f","-for i in range(w):","- row = []","- for j in range(len(m)):","- row.append(m[j][i])","- if \"#\" not in row:","- pass","- else:","- m_t.append(row)","-# \u518d\u3073\u8ee2\u7f6e\u3059\u308b","-for i in range(len(m)):","- row = []","- for j in range(len(m_t)):","- row.append(m_t[j][i])","- m_tt.append(row)","-for row in m_tt:","+ m.append(list(eval(input())))","+for i in range(2):","+ m = remove_dot(m)","+ m = trans(m)","+for row in m:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0382614516,"measured_runtime_v1":0.0398855725,"runtime_lift":0.9592804922,"key":["s903460263","s180936557"]} +{"user_id":"u186838327","problem_id":"p03408","language":"python","submission_id_v0":"s511522508","submission_id_v1":"s761688426","cpu_time_v0":82,"cpu_time_v1":71,"memory_v0":67020,"memory_v1":66980,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.41,"input":"n = int(eval(input()))\n\nS = [str(eval(input())) for _ in range(n)]\n\nm = int(eval(input()))\n\nT = [str(eval(input())) for _ in range(m)]\n\n\n\nfrom collections import Counter\n\nCS = Counter(S)\n\nCT = Counter(T)\n\n\n\nans = 0\n\nfor k in list(CS.keys()):\n\n if k not in CT:\n\n ans = max(CS[k], ans)\n\n else:\n\n ans = max(ans, max(0, CS[k]-CT[k]))\n\nprint(ans)\n","target":"n = int(eval(input()))\n\nS = [str(eval(input())) for _ in range(n)]\n\nm = int(eval(input()))\n\nT = [str(eval(input())) for _ in range(m)]\n\n\n\nfrom collections import Counter\n\ncs = Counter(S)\n\nct = Counter(T)\n\n\n\nans = -10**18\n\nfor k, v in list(cs.items()):\n\n if k in ct:\n\n temp = v - ct[k]\n\n else:\n\n temp = v\n\n ans = max(ans, temp)\n\nprint((max(ans, 0)))\n","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":332,"code_v1_num_chars":340,"code_v0_no_empty_lines":"n = int(eval(input()))\nS = [str(eval(input())) for _ in range(n)]\nm = int(eval(input()))\nT = [str(eval(input())) for _ in range(m)]\nfrom collections import Counter\n\nCS = Counter(S)\nCT = Counter(T)\nans = 0\nfor k in list(CS.keys()):\n if k not in CT:\n ans = max(CS[k], ans)\n else:\n ans = max(ans, max(0, CS[k] - CT[k]))\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nS = [str(eval(input())) for _ in range(n)]\nm = int(eval(input()))\nT = [str(eval(input())) for _ in range(m)]\nfrom collections import Counter\n\ncs = Counter(S)\nct = Counter(T)\nans = -(10**18)\nfor k, v in list(cs.items()):\n if k in ct:\n temp = v - ct[k]\n else:\n temp = v\n ans = max(ans, temp)\nprint((max(ans, 0)))\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-CS = Counter(S)","-CT = Counter(T)","-ans = 0","-for k in list(CS.keys()):","- if k not in CT:","- ans = max(CS[k], ans)","+cs = Counter(S)","+ct = Counter(T)","+ans = -(10**18)","+for k, v in list(cs.items()):","+ if k in ct:","+ temp = v - ct[k]","- ans = max(ans, max(0, CS[k] - CT[k]))","-print(ans)","+ temp = v","+ ans = max(ans, temp)","+print((max(ans, 0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1218697531,"measured_runtime_v1":0.047226974,"runtime_lift":2.5805115752,"key":["s511522508","s761688426"]} +{"user_id":"u057109575","problem_id":"p02834","language":"python","submission_id_v0":"s172865359","submission_id_v1":"s591611262","cpu_time_v0":713,"cpu_time_v1":315,"memory_v0":79704,"memory_v1":99464,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.82,"input":"from collections import deque\n\nINF = 10 ** 9 + 7\n\n\n\nN, u, v = list(map(int, input().split()))\n\nX = [list(map(int, input().split())) for _ in range(N - 1)]\n\n\n\nedges = [[] for _ in range(N)]\n\nfor x, y in X:\n\n edges[x - 1].append(y - 1)\n\n edges[y - 1].append(x - 1)\n\n \n\ndef bfs(s):\n\n d = [INF] * N\n\n d[s] = 0\n\n\n\n visited = [False] * N\n\n visited[s] = True\n\n \n\n q = deque()\n\n q.append(s)\n\n \n\n while q:\n\n u = q.popleft()\n\n for v in edges[u]:\n\n if visited[v]:\n\n continue\n\n \n\n visited[v] = True\n\n d[v] = d[u] + 1\n\n q.append(v)\n\n \n\n return d\n\n\n\nans = 0\n\nfor x, y in zip(bfs(u - 1), bfs(v - 1)):\n\n if x <= y:\n\n ans = max(ans, y - 1)\n\n \n\nprint(ans)\n","target":"from collections import deque\n\n\n\nN, U, V = list(map(int, input().split()))\n\nX = [list(map(int, input().split())) for _ in range(N - 1)]\n\n\n\ntree = [[] for _ in range(N + 1)]\n\nfor a, b in X:\n\n tree[a].append(b)\n\n tree[b].append(a)\n\n\n\ndef find_dist(s):\n\n dist = [-1] * (N + 1)\n\n dist[s] = 0\n\n q = deque()\n\n q.append(s)\n\n while q:\n\n u = q.popleft()\n\n for v in tree[u]:\n\n if dist[v] >= 0:\n\n continue\n\n \n\n dist[v] = dist[u] + 1\n\n q.append(v)\n\n \n\n return dist\n\n\n\n\n\ndist_u = find_dist(U)\n\ndist_v = find_dist(V)\n\n\n\nans = 0\n\nfor i in range(1, N + 1):\n\n if dist_u[i] <= dist_v[i]:\n\n ans = max(ans, dist_v[i] - 1)\n\n \n\nprint(ans)\n\n\n","code_v0_loc":39,"code_v1_loc":37,"code_v0_num_chars":783,"code_v1_num_chars":742,"code_v0_no_empty_lines":"from collections import deque\n\nINF = 10**9 + 7\nN, u, v = list(map(int, input().split()))\nX = [list(map(int, input().split())) for _ in range(N - 1)]\nedges = [[] for _ in range(N)]\nfor x, y in X:\n edges[x - 1].append(y - 1)\n edges[y - 1].append(x - 1)\n\n\ndef bfs(s):\n d = [INF] * N\n d[s] = 0\n visited = [False] * N\n visited[s] = True\n q = deque()\n q.append(s)\n while q:\n u = q.popleft()\n for v in edges[u]:\n if visited[v]:\n continue\n visited[v] = True\n d[v] = d[u] + 1\n q.append(v)\n return d\n\n\nans = 0\nfor x, y in zip(bfs(u - 1), bfs(v - 1)):\n if x <= y:\n ans = max(ans, y - 1)\nprint(ans)\n","code_v1_no_empty_lines":"from collections import deque\n\nN, U, V = list(map(int, input().split()))\nX = [list(map(int, input().split())) for _ in range(N - 1)]\ntree = [[] for _ in range(N + 1)]\nfor a, b in X:\n tree[a].append(b)\n tree[b].append(a)\n\n\ndef find_dist(s):\n dist = [-1] * (N + 1)\n dist[s] = 0\n q = deque()\n q.append(s)\n while q:\n u = q.popleft()\n for v in tree[u]:\n if dist[v] >= 0:\n continue\n dist[v] = dist[u] + 1\n q.append(v)\n return dist\n\n\ndist_u = find_dist(U)\ndist_v = find_dist(V)\nans = 0\nfor i in range(1, N + 1):\n if dist_u[i] <= dist_v[i]:\n ans = max(ans, dist_v[i] - 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.1282051282,"diff":["-INF = 10**9 + 7","-N, u, v = list(map(int, input().split()))","+N, U, V = list(map(int, input().split()))","-edges = [[] for _ in range(N)]","-for x, y in X:","- edges[x - 1].append(y - 1)","- edges[y - 1].append(x - 1)","+tree = [[] for _ in range(N + 1)]","+for a, b in X:","+ tree[a].append(b)","+ tree[b].append(a)","-def bfs(s):","- d = [INF] * N","- d[s] = 0","- visited = [False] * N","- visited[s] = True","+def find_dist(s):","+ dist = [-1] * (N + 1)","+ dist[s] = 0","- for v in edges[u]:","- if visited[v]:","+ for v in tree[u]:","+ if dist[v] >= 0:","- visited[v] = True","- d[v] = d[u] + 1","+ dist[v] = dist[u] + 1","- return d","+ return dist","+dist_u = find_dist(U)","+dist_v = find_dist(V)","-for x, y in zip(bfs(u - 1), bfs(v - 1)):","- if x <= y:","- ans = max(ans, y - 1)","+for i in range(1, N + 1):","+ if dist_u[i] <= dist_v[i]:","+ ans = max(ans, dist_v[i] - 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0937694082,"measured_runtime_v1":0.0399452806,"runtime_lift":2.3474464795,"key":["s172865359","s591611262"]} +{"user_id":"u607865971","problem_id":"p02954","language":"python","submission_id_v0":"s747785296","submission_id_v1":"s818200026","cpu_time_v0":139,"cpu_time_v1":114,"memory_v0":11252,"memory_v1":10492,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.99,"input":"import sys, math, itertools, bisect, copy, re\n\nfrom collections import Counter, deque, defaultdict\n\n\n\n# from itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n\n# from functools import reduce\n\n# from math import ceil, floor, log10, log2, factorial\n\n# from pprint import pprint\n\n\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\nEPS = 10 ** -7\n\nsys.setrecursionlimit(1000000)\n\n\n\n# N = int(input())\n\n# N,M = [int(x) for x in input().split()]\n\n# V = [[0] * 100 for _ in range(100)]\n\n# A = [int(input()) for _ in range(N)]\n\n# DP = [[0] * 100 for _ in range(100)]\n\n# DP = defaultdict(lambda: float('inf'))\n\n\n\nS = eval(input())\n\nN = len(S)\n\ni = 0\n\n\n\nANS = []\n\nwhile i < N :\n\n # print(S[i:i + 2])\n\n\n\n if S[i:i + 2] == 'RL':\n\n li = i\n\n while li > 0 and S[li] == 'R':\n\n li -= 1\n\n if li != 0:\n\n li += 1\n\n\n\n ri = i + 1\n\n while ri < N and S[ri] == 'L':\n\n ri += 1\n\n ri -= 1\n\n # print([li, i, ri])\n\n cnt = ri - li + 1\n\n if cnt % 2 == 0:\n\n ANS.append(cnt \/\/ 2)\n\n ANS.append(cnt \/\/ 2)\n\n else:\n\n if ri % 2 == i % 2:\n\n ANS.append(cnt \/\/ 2 + 1)\n\n ANS.append(cnt \/\/ 2)\n\n else:\n\n ANS.append(cnt \/\/ 2)\n\n ANS.append(cnt \/\/ 2 + 1)\n\n i += 2\n\n else:\n\n ANS.append(0)\n\n i += 1\n\n\n\nprint((\" \".join([str(s) for s in ANS])))\n","target":"S = eval(input())\n\nN = len(S)\n\nres = [0] * len(S)\n\n\n\na = b = 0\n\nfor i in range(N):\n\n if S[i] == 'R':\n\n a += 1\n\n if b != 0:\n\n res[i-b] += (b+1)\/\/2\n\n res[i-b-1] += (b)\/\/2\n\n b = 0\n\n elif S[i] == 'L':\n\n b += 1\n\n if a != 0:\n\n res[i-1] += (a+1)\/\/2\n\n res[i] += (a)\/\/2\n\n a = 0\n\nif b != 0:\n\n res[N-b] += (b+1)\/\/2\n\n res[N-b-1] += (b)\/\/2\n\n\n\nprint((\" \".join([str(x) for x in res])))\n","code_v0_loc":57,"code_v1_loc":23,"code_v0_num_chars":1446,"code_v1_num_chars":517,"code_v0_no_empty_lines":"import sys, math, itertools, bisect, copy, re\nfrom collections import Counter, deque, defaultdict\n\n# from itertools import accumulate, permutations, combinations, takewhile, compress, cycle\n# from functools import reduce\n# from math import ceil, floor, log10, log2, factorial\n# from pprint import pprint\nINF = float(\"inf\")\nMOD = 10**9 + 7\nEPS = 10**-7\nsys.setrecursionlimit(1000000)\n# N = int(input())\n# N,M = [int(x) for x in input().split()]\n# V = [[0] * 100 for _ in range(100)]\n# A = [int(input()) for _ in range(N)]\n# DP = [[0] * 100 for _ in range(100)]\n# DP = defaultdict(lambda: float('inf'))\nS = eval(input())\nN = len(S)\ni = 0\nANS = []\nwhile i < N:\n # print(S[i:i + 2])\n if S[i : i + 2] == \"RL\":\n li = i\n while li > 0 and S[li] == \"R\":\n li -= 1\n if li != 0:\n li += 1\n ri = i + 1\n while ri < N and S[ri] == \"L\":\n ri += 1\n ri -= 1\n # print([li, i, ri])\n cnt = ri - li + 1\n if cnt % 2 == 0:\n ANS.append(cnt \/\/ 2)\n ANS.append(cnt \/\/ 2)\n else:\n if ri % 2 == i % 2:\n ANS.append(cnt \/\/ 2 + 1)\n ANS.append(cnt \/\/ 2)\n else:\n ANS.append(cnt \/\/ 2)\n ANS.append(cnt \/\/ 2 + 1)\n i += 2\n else:\n ANS.append(0)\n i += 1\nprint((\" \".join([str(s) for s in ANS])))\n","code_v1_no_empty_lines":"S = eval(input())\nN = len(S)\nres = [0] * len(S)\na = b = 0\nfor i in range(N):\n if S[i] == \"R\":\n a += 1\n if b != 0:\n res[i - b] += (b + 1) \/\/ 2\n res[i - b - 1] += (b) \/\/ 2\n b = 0\n elif S[i] == \"L\":\n b += 1\n if a != 0:\n res[i - 1] += (a + 1) \/\/ 2\n res[i] += (a) \/\/ 2\n a = 0\nif b != 0:\n res[N - b] += (b + 1) \/\/ 2\n res[N - b - 1] += (b) \/\/ 2\nprint((\" \".join([str(x) for x in res])))\n","code_same":false,"relative_loc_diff_percent":59.649122807,"diff":["-import sys, math, itertools, bisect, copy, re","-from collections import Counter, deque, defaultdict","-","-# from itertools import accumulate, permutations, combinations, takewhile, compress, cycle","-# from functools import reduce","-# from math import ceil, floor, log10, log2, factorial","-# from pprint import pprint","-INF = float(\"inf\")","-MOD = 10**9 + 7","-EPS = 10**-7","-sys.setrecursionlimit(1000000)","-# N = int(input())","-# N,M = [int(x) for x in input().split()]","-# V = [[0] * 100 for _ in range(100)]","-# A = [int(input()) for _ in range(N)]","-# DP = [[0] * 100 for _ in range(100)]","-# DP = defaultdict(lambda: float('inf'))","-i = 0","-ANS = []","-while i < N:","- # print(S[i:i + 2])","- if S[i : i + 2] == \"RL\":","- li = i","- while li > 0 and S[li] == \"R\":","- li -= 1","- if li != 0:","- li += 1","- ri = i + 1","- while ri < N and S[ri] == \"L\":","- ri += 1","- ri -= 1","- # print([li, i, ri])","- cnt = ri - li + 1","- if cnt % 2 == 0:","- ANS.append(cnt \/\/ 2)","- ANS.append(cnt \/\/ 2)","- else:","- if ri % 2 == i % 2:","- ANS.append(cnt \/\/ 2 + 1)","- ANS.append(cnt \/\/ 2)","- else:","- ANS.append(cnt \/\/ 2)","- ANS.append(cnt \/\/ 2 + 1)","- i += 2","- else:","- ANS.append(0)","- i += 1","-print((\" \".join([str(s) for s in ANS])))","+res = [0] * len(S)","+a = b = 0","+for i in range(N):","+ if S[i] == \"R\":","+ a += 1","+ if b != 0:","+ res[i - b] += (b + 1) \/\/ 2","+ res[i - b - 1] += (b) \/\/ 2","+ b = 0","+ elif S[i] == \"L\":","+ b += 1","+ if a != 0:","+ res[i - 1] += (a + 1) \/\/ 2","+ res[i] += (a) \/\/ 2","+ a = 0","+if b != 0:","+ res[N - b] += (b + 1) \/\/ 2","+ res[N - b - 1] += (b) \/\/ 2","+print((\" \".join([str(x) for x in res])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0516991847,"measured_runtime_v1":0.0517656157,"runtime_lift":0.9987166953,"key":["s747785296","s818200026"]} +{"user_id":"u068862829","problem_id":"p02554","language":"python","submission_id_v0":"s482081627","submission_id_v1":"s008717021","cpu_time_v0":402,"cpu_time_v1":34,"memory_v0":11156,"memory_v1":9148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.54,"input":"N = int(eval(input()))\n\nans = 10**N - 2*9**N + 8**N\n\nprint((ans%(10**9+7)))","target":"N = int(eval(input()))\n\nMOD = 10**9+7\n\nans = (pow(10, N, MOD) - 2* pow(9, N, MOD) + pow(8, N, MOD))%MOD\n\nprint(ans)","code_v0_loc":3,"code_v1_loc":4,"code_v0_num_chars":67,"code_v1_num_chars":109,"code_v0_no_empty_lines":"N = int(eval(input()))\nans = 10**N - 2 * 9**N + 8**N\nprint((ans % (10**9 + 7)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nMOD = 10**9 + 7\nans = (pow(10, N, MOD) - 2 * pow(9, N, MOD) + pow(8, N, MOD)) % MOD\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-ans = 10**N - 2 * 9**N + 8**N","-print((ans % (10**9 + 7)))","+MOD = 10**9 + 7","+ans = (pow(10, N, MOD) - 2 * pow(9, N, MOD) + pow(8, N, MOD)) % MOD","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0859700813,"measured_runtime_v1":0.0363034732,"runtime_lift":2.3680952164,"key":["s482081627","s008717021"]} +{"user_id":"u729133443","problem_id":"p03425","language":"python","submission_id_v0":"s790756494","submission_id_v1":"s751092813","cpu_time_v0":96,"cpu_time_v1":58,"memory_v0":17688,"memory_v1":17688,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.58,"input":"from itertools import*;s,*_=list(zip(*open(0).readlines()));c=s.count;print((sum(c(p)*c(q)*c(r)for p,q,r in combinations('MARCH',3))))","target":"from itertools import*;s,*_=list(zip(*open(0).readlines()));print((sum(p*q*r for p,q,r in combinations(list(map(s.count,'MARCH')),3))))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":126,"code_v1_num_chars":121,"code_v0_no_empty_lines":"from itertools import *\n\ns, *_ = list(zip(*open(0).readlines()))\nc = s.count\nprint((sum(c(p) * c(q) * c(r) for p, q, r in combinations(\"MARCH\", 3))))\n","code_v1_no_empty_lines":"from itertools import *\n\ns, *_ = list(zip(*open(0).readlines()))\nprint((sum(p * q * r for p, q, r in combinations(list(map(s.count, \"MARCH\")), 3))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-c = s.count","-print((sum(c(p) * c(q) * c(r) for p, q, r in combinations(\"MARCH\", 3))))","+print((sum(p * q * r for p, q, r in combinations(list(map(s.count, \"MARCH\")), 3))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0421951177,"measured_runtime_v1":0.0595665047,"runtime_lift":0.7083698784,"key":["s790756494","s751092813"]} +{"user_id":"u680851063","problem_id":"p02854","language":"python","submission_id_v0":"s971632492","submission_id_v1":"s139481148","cpu_time_v0":222,"cpu_time_v1":148,"memory_v0":31568,"memory_v1":31416,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"n = int(eval(input()))\n\nl = list(map(int,input().split()))\n\n\n\nfrom itertools import accumulate\n\n\n\ntot=sum(l)\n\nans=2020202020*100000\n\nfor i in list(accumulate(l)):\n\n ans=min(ans, abs(tot-(i*2)))\n\n\n\nfor i in list(accumulate(l[::-1])):\n\n ans=min(ans, abs(tot--(i*2)))\n\n\n\nprint(ans)\n","target":"n = int(eval(input()))\n\nl = list(map(int,input().split()))\n\n\n\nfrom itertools import accumulate\n\ncum=list(accumulate(l))\n\n\n\ntot=sum(l)\n\nans=2020202020*100000\n\nfor i in cum:\n\n ans=min(ans, abs(tot-i*2))\n\nprint(ans)\n","code_v0_loc":14,"code_v1_loc":11,"code_v0_num_chars":279,"code_v1_num_chars":210,"code_v0_no_empty_lines":"n = int(eval(input()))\nl = list(map(int, input().split()))\nfrom itertools import accumulate\n\ntot = sum(l)\nans = 2020202020 * 100000\nfor i in list(accumulate(l)):\n ans = min(ans, abs(tot - (i * 2)))\nfor i in list(accumulate(l[::-1])):\n ans = min(ans, abs(tot - -(i * 2)))\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nl = list(map(int, input().split()))\nfrom itertools import accumulate\n\ncum = list(accumulate(l))\ntot = sum(l)\nans = 2020202020 * 100000\nfor i in cum:\n ans = min(ans, abs(tot - i * 2))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["+cum = list(accumulate(l))","-for i in list(accumulate(l)):","- ans = min(ans, abs(tot - (i * 2)))","-for i in list(accumulate(l[::-1])):","- ans = min(ans, abs(tot - -(i * 2)))","+for i in cum:","+ ans = min(ans, abs(tot - i * 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.057475325,"measured_runtime_v1":0.0432243209,"runtime_lift":1.3296987398,"key":["s971632492","s139481148"]} +{"user_id":"u316464887","problem_id":"p03172","language":"python","submission_id_v0":"s632051251","submission_id_v1":"s141517651","cpu_time_v0":1911,"cpu_time_v1":1758,"memory_v0":37144,"memory_v1":37616,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.01,"input":"N, K = list(map(int, input().split()))\n\na = tuple(map(int, input().split()))\n\n\n\ndef main():\n\n l = [1 if a[0] >= j else 0 for j in range(K+1)]\n\n lt= [0] * (K+1)\n\n s = a[0]\n\n for i in range(1,N):\n\n lt, l = l, lt\n\n s += a[i]\n\n l[0] = 1\n\n t = 1\n\n for j in range(1, a[i]+1):\n\n t += lt[j]\n\n l[j] = t\n\n for j in range(a[i]+1, min(K+1, s+1)):\n\n t += (lt[j] - lt[j - a[i] - 1])\n\n l[j] = t\n\n return l[-1] % (10 ** 9 + 7)\n\n \n\nprint((main()))\n","target":"def main():\n\n N, K = list(map(int, input().split()))\n\n a = tuple(map(int, input().split()))\n\n l = [1 if a[0] >= j else 0 for j in range(K+1)]\n\n lt= [1 if a[0] >= j else 0 for j in range(K+1)]\n\n s = a[0]\n\n for i in a[1:]:\n\n lt, l = l, lt\n\n s += i\n\n l[0] = 1\n\n t = 1\n\n for j in range(1, i+1):\n\n t += lt[j]\n\n l[j] = t\n\n for j in range(i+1, min(K+1, s+1)):\n\n t += (lt[j] - lt[j - i - 1])\n\n l[j] = t\n\n return l[-1] % (10 ** 9 + 7)\n\n \n\nprint((main()))\n","code_v0_loc":21,"code_v1_loc":20,"code_v0_num_chars":551,"code_v1_num_chars":572,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\na = tuple(map(int, input().split()))\n\n\ndef main():\n l = [1 if a[0] >= j else 0 for j in range(K + 1)]\n lt = [0] * (K + 1)\n s = a[0]\n for i in range(1, N):\n lt, l = l, lt\n s += a[i]\n l[0] = 1\n t = 1\n for j in range(1, a[i] + 1):\n t += lt[j]\n l[j] = t\n for j in range(a[i] + 1, min(K + 1, s + 1)):\n t += lt[j] - lt[j - a[i] - 1]\n l[j] = t\n return l[-1] % (10**9 + 7)\n\n\nprint((main()))\n","code_v1_no_empty_lines":"def main():\n N, K = list(map(int, input().split()))\n a = tuple(map(int, input().split()))\n l = [1 if a[0] >= j else 0 for j in range(K + 1)]\n lt = [1 if a[0] >= j else 0 for j in range(K + 1)]\n s = a[0]\n for i in a[1:]:\n lt, l = l, lt\n s += i\n l[0] = 1\n t = 1\n for j in range(1, i + 1):\n t += lt[j]\n l[j] = t\n for j in range(i + 1, min(K + 1, s + 1)):\n t += lt[j] - lt[j - i - 1]\n l[j] = t\n return l[-1] % (10**9 + 7)\n\n\nprint((main()))\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["-N, K = list(map(int, input().split()))","-a = tuple(map(int, input().split()))","-","-","+ N, K = list(map(int, input().split()))","+ a = tuple(map(int, input().split()))","- lt = [0] * (K + 1)","+ lt = [1 if a[0] >= j else 0 for j in range(K + 1)]","- for i in range(1, N):","+ for i in a[1:]:","- s += a[i]","+ s += i","- for j in range(1, a[i] + 1):","+ for j in range(1, i + 1):","- for j in range(a[i] + 1, min(K + 1, s + 1)):","- t += lt[j] - lt[j - a[i] - 1]","+ for j in range(i + 1, min(K + 1, s + 1)):","+ t += lt[j] - lt[j - i - 1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2034888668,"measured_runtime_v1":0.0910493734,"runtime_lift":2.2349287997,"key":["s632051251","s141517651"]} +{"user_id":"u287500079","problem_id":"p03107","language":"python","submission_id_v0":"s705728714","submission_id_v1":"s457903918","cpu_time_v0":347,"cpu_time_v1":283,"memory_v0":64620,"memory_v1":61036,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.44,"input":"import sys, re, os\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin\n\nfrom itertools import permutations, combinations, product, accumulate\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom fractions import gcd\n\ndef input(): return sys.stdin.readline().strip()\n\ndef STR(): return eval(input())\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef S_MAP(): return list(map(str, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef S_LIST(): return list(map(str, input().split()))\n\nsys.setrecursionlimit(10 ** 9)\n\ninf = sys.maxsize\n\nmod = 10 ** 9 + 7\n\n\n\ns = STR()\n\nprint((min(s.count('0'), s.count('1')) * 2))","target":"import sys, re, os\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10\n\nfrom itertools import permutations, combinations, product, accumulate\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom fractions import gcd\n\ndef debug(*args):\n\n if debugmode:\n\n print((*args))\n\ndef input(): return sys.stdin.readline().strip()\n\ndef STR(): return eval(input())\n\ndef INT(): return int(eval(input()))\n\ndef FLOAT(): return float(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef S_MAP(): return list(map(str, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef S_LIST(): return list(map(str, input().split()))\n\ndef lcm(a, b): return a * b \/\/ gcd(a, b)\n\nsys.setrecursionlimit(10 ** 9)\n\ninf = sys.maxsize\n\nmod = 10 ** 9 + 7\n\ndx = [0, 0, 1, -1, 1, -1, -1, 1]\n\ndy = [1, -1, 0, 0, 1, -1, 1, -1]\n\ndebugmode = True\n\n\n\ns = STR()\n\nt = Counter(s)\n\nprint((min(t['0'], t['1']) * 2))","code_v0_loc":21,"code_v1_loc":30,"code_v0_num_chars":817,"code_v1_num_chars":1057,"code_v0_no_empty_lines":"import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef STR():\n return eval(input())\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef S_MAP():\n return list(map(str, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef S_LIST():\n return list(map(str, input().split()))\n\n\nsys.setrecursionlimit(10**9)\ninf = sys.maxsize\nmod = 10**9 + 7\ns = STR()\nprint((min(s.count(\"0\"), s.count(\"1\")) * 2))\n","code_v1_no_empty_lines":"import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n radians,\n acos,\n atan,\n asin,\n log,\n log10,\n)\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\n\n\ndef debug(*args):\n if debugmode:\n print((*args))\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef STR():\n return eval(input())\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef FLOAT():\n return float(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef S_MAP():\n return list(map(str, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef S_LIST():\n return list(map(str, input().split()))\n\n\ndef lcm(a, b):\n return a * b \/\/ gcd(a, b)\n\n\nsys.setrecursionlimit(10**9)\ninf = sys.maxsize\nmod = 10**9 + 7\ndx = [0, 0, 1, -1, 1, -1, -1, 1]\ndy = [1, -1, 0, 0, 1, -1, 1, -1]\ndebugmode = True\ns = STR()\nt = Counter(s)\nprint((min(t[\"0\"], t[\"1\"]) * 2))\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin","+from math import (","+ ceil,","+ sqrt,","+ hypot,","+ factorial,","+ pi,","+ sin,","+ cos,","+ radians,","+ acos,","+ atan,","+ asin,","+ log,","+ log10,","+)","+","+","+def debug(*args):","+ if debugmode:","+ print((*args))","+","+","+def FLOAT():","+ return float(eval(input()))","+def lcm(a, b):","+ return a * b \/\/ gcd(a, b)","+","+","+dx = [0, 0, 1, -1, 1, -1, -1, 1]","+dy = [1, -1, 0, 0, 1, -1, 1, -1]","+debugmode = True","-print((min(s.count(\"0\"), s.count(\"1\")) * 2))","+t = Counter(s)","+print((min(t[\"0\"], t[\"1\"]) * 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0594780941,"measured_runtime_v1":0.0534856811,"runtime_lift":1.1120377064,"key":["s705728714","s457903918"]} +{"user_id":"u919633157","problem_id":"p03043","language":"python","submission_id_v0":"s677102139","submission_id_v1":"s288064415","cpu_time_v0":87,"cpu_time_v1":42,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.72,"input":"import math\n\nn,k=list(map(int,input().split()))\n\nans=0\n\nfor i in range(1,n+1):\n\n ans+=(1\/2)**math.ceil(max(math.log2(k\/i),0))\n\nprint((ans\/n))\n","target":"n,k=list(map(int,input().split()))\n\nans=0\n\nfor i in range(1,n+1):\n\n\ttmp=1\/n\n\n\tcnt=i\n\n\twhile cnt 1):\n\n mid = (ok + ng) \/\/ 2\n\n if is_ok(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n return ok\n\n \n\n ans = meguru_bisect(0, int(1e20))\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"from math import ceil\n\n \n\ndef main():\n\n N, K = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n def is_ok(arg):\n\n # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u304b\u3069\u3046\u304b\uff1f\u554f\u984c\u3054\u3068\u306b\u5b9a\u7fa9\n\n B = [int(ceil(a\/arg))-1 for a in A]\n\n #print(arg, B)\n\n if sum(B) <= K:\n\n return True\n\n else:\n\n return False\n\n \n\n def meguru_bisect(ng, ok):\n\n '''\n\n \u521d\u671f\u5024\u306eng,ok\u3092\u53d7\u3051\u53d6\u308a,is_ok\u3092\u6e80\u305f\u3059\u6700\u5c0f(\u6700\u5927)\u306eok\u3092\u8fd4\u3059\n\n \u307e\u305ais_ok\u3092\u5b9a\u7fa9\u3059\u3079\u3057\n\n ng ok \u306f \u3068\u308a\u5f97\u308b\u6700\u5c0f\u306e\u5024-1 \u3068\u308a\u5f97\u308b\u6700\u5927\u306e\u5024+1\n\n \u6700\u5927\u6700\u5c0f\u304c\u9006\u306e\u5834\u5408\u306f\u3088\u3057\u306a\u306b\u3072\u3063\u304f\u308a\u8fd4\u3059\n\n '''\n\n while (abs(ok - ng) > 1):\n\n mid = (ok + ng) \/\/ 2\n\n if is_ok(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n return ok\n\n \n\n ans = meguru_bisect(0, int(1e9))\n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":34,"code_v1_loc":34,"code_v0_num_chars":811,"code_v1_num_chars":813,"code_v0_no_empty_lines":"from math import ceil\n\n\ndef main():\n N, K = list(map(int, input().split()))\n A = list(map(int, input().split()))\n\n def is_ok(arg):\n # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u304b\u3069\u3046\u304b\uff1f\u554f\u984c\u3054\u3068\u306b\u5b9a\u7fa9\n B = [int(ceil(a \/ arg)) - 1 for a in A]\n # print(arg, B)\n if sum(B) <= K:\n return True\n else:\n return False\n\n def meguru_bisect(ng, ok):\n \"\"\"\n \u521d\u671f\u5024\u306eng,ok\u3092\u53d7\u3051\u53d6\u308a,is_ok\u3092\u6e80\u305f\u3059\u6700\u5c0f(\u6700\u5927)\u306eok\u3092\u8fd4\u3059\n \u307e\u305ais_ok\u3092\u5b9a\u7fa9\u3059\u3079\u3057\n ng ok \u306f \u3068\u308a\u5f97\u308b\u6700\u5c0f\u306e\u5024-1 \u3068\u308a\u5f97\u308b\u6700\u5927\u306e\u5024+1\n \u6700\u5927\u6700\u5c0f\u304c\u9006\u306e\u5834\u5408\u306f\u3088\u3057\u306a\u306b\u3072\u3063\u304f\u308a\u8fd4\u3059\n \"\"\"\n while abs(ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n if is_ok(mid):\n ok = mid\n else:\n ng = mid\n return ok\n\n ans = meguru_bisect(0, int(1e20))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from math import ceil\n\n\ndef main():\n N, K = list(map(int, input().split()))\n A = list(map(int, input().split()))\n\n def is_ok(arg):\n # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u304b\u3069\u3046\u304b\uff1f\u554f\u984c\u3054\u3068\u306b\u5b9a\u7fa9\n B = [int(ceil(a \/ arg)) - 1 for a in A]\n # print(arg, B)\n if sum(B) <= K:\n return True\n else:\n return False\n\n def meguru_bisect(ng, ok):\n \"\"\"\n \u521d\u671f\u5024\u306eng,ok\u3092\u53d7\u3051\u53d6\u308a,is_ok\u3092\u6e80\u305f\u3059\u6700\u5c0f(\u6700\u5927)\u306eok\u3092\u8fd4\u3059\n \u307e\u305ais_ok\u3092\u5b9a\u7fa9\u3059\u3079\u3057\n ng ok \u306f \u3068\u308a\u5f97\u308b\u6700\u5c0f\u306e\u5024-1 \u3068\u308a\u5f97\u308b\u6700\u5927\u306e\u5024+1\n \u6700\u5927\u6700\u5c0f\u304c\u9006\u306e\u5834\u5408\u306f\u3088\u3057\u306a\u306b\u3072\u3063\u304f\u308a\u8fd4\u3059\n \"\"\"\n while abs(ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n if is_ok(mid):\n ok = mid\n else:\n ng = mid\n return ok\n\n ans = meguru_bisect(0, int(1e9))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- ans = meguru_bisect(0, int(1e20))","+ ans = meguru_bisect(0, int(1e9))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0672104468,"measured_runtime_v1":0.0413664765,"runtime_lift":1.6247563836,"key":["s461332938","s979200413"]} +{"user_id":"u794173881","problem_id":"p03611","language":"python","submission_id_v0":"s987156902","submission_id_v1":"s160171005","cpu_time_v0":197,"cpu_time_v1":160,"memory_v0":14008,"memory_v1":20948,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.78,"input":"n = int(eval(input()))\n\na = list(map(int,input().split()))\n\na = sorted(a)\n\n\n\nli = [[a[0],1]]\n\n\n\nfor i in range(1,n):\n\n if a[i] != a[i-1]:\n\n li.append([a[i],1])\n\n else:\n\n li[len(li)-1][1]+=1\n\nans = 0\n\nfor i in range(len(li)):\n\n ans_tmp =li[i][1]\n\n if 0<=i-1:\n\n if li[i-1][0]+1 == li[i][0]:\n\n ans_tmp = ans_tmp +li[i-1][1]\n\n if i+1>= 1\n\n _xyz = []\n\n for j in range(n):\n\n _abc = [checker[s]*xyz[j][s] for s in range(3)]\n\n _xyz.append([sum(_abc)]+_abc)\n\n _xyz.sort(reverse=True)\n\n _r = abs(sum(i[1] for i in _xyz[:m]))\n\n _r += abs(sum(i[2] for i in _xyz[:m]))\n\n _r += abs(sum(i[3] for i in _xyz[:m]))\n\n r.append(_r)\n\n\n\nprint((max(r)))","target":"n, m = list(map(int, input().split()))\n\n\n\nxyz = [list(map(int, input().split())) for _i in range(n)]\n\n\n\nr = []\n\nfor i in range(2**3):\n\n checker = []\n\n num = i\n\n for _i in range(3):\n\n if num%2==1:\n\n checker.append(1)\n\n else:\n\n checker.append(-1)\n\n num >>= 1\n\n _xyz = []\n\n for j in range(n):\n\n _abc = [checker[s]*xyz[j][s] for s in range(3)]\n\n _xyz.append([sum(_abc)]+_abc)\n\n _xyz.sort(reverse=True)\n\n _r = abs(sum(i[1] for i in _xyz[:m]))+ abs(sum(i[2] for i in _xyz[:m]))+abs(sum(i[3] for i in _xyz[:m]))\n\n r.append(_r)\n\n\n\nprint((max(r)))","code_v0_loc":25,"code_v1_loc":23,"code_v0_num_chars":632,"code_v1_num_chars":611,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nxyz = [list(map(int, input().split())) for _i in range(n)]\nr = []\nfor i in range(2**3):\n checker = []\n num = i\n for _i in range(3):\n if num % 2 == 1:\n checker.append(1)\n else:\n checker.append(-1)\n num >>= 1\n _xyz = []\n for j in range(n):\n _abc = [checker[s] * xyz[j][s] for s in range(3)]\n _xyz.append([sum(_abc)] + _abc)\n _xyz.sort(reverse=True)\n _r = abs(sum(i[1] for i in _xyz[:m]))\n _r += abs(sum(i[2] for i in _xyz[:m]))\n _r += abs(sum(i[3] for i in _xyz[:m]))\n r.append(_r)\nprint((max(r)))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nxyz = [list(map(int, input().split())) for _i in range(n)]\nr = []\nfor i in range(2**3):\n checker = []\n num = i\n for _i in range(3):\n if num % 2 == 1:\n checker.append(1)\n else:\n checker.append(-1)\n num >>= 1\n _xyz = []\n for j in range(n):\n _abc = [checker[s] * xyz[j][s] for s in range(3)]\n _xyz.append([sum(_abc)] + _abc)\n _xyz.sort(reverse=True)\n _r = (\n abs(sum(i[1] for i in _xyz[:m]))\n + abs(sum(i[2] for i in _xyz[:m]))\n + abs(sum(i[3] for i in _xyz[:m]))\n )\n r.append(_r)\nprint((max(r)))\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["- _r = abs(sum(i[1] for i in _xyz[:m]))","- _r += abs(sum(i[2] for i in _xyz[:m]))","- _r += abs(sum(i[3] for i in _xyz[:m]))","+ _r = (","+ abs(sum(i[1] for i in _xyz[:m]))","+ + abs(sum(i[2] for i in _xyz[:m]))","+ + abs(sum(i[3] for i in _xyz[:m]))","+ )"],"diff_only_import_comment":false,"measured_runtime_v0":0.1067010598,"measured_runtime_v1":0.0754279757,"runtime_lift":1.4146085571,"key":["s921096513","s384090919"]} +{"user_id":"u252828980","problem_id":"p03013","language":"python","submission_id_v0":"s690599533","submission_id_v1":"s850536869","cpu_time_v0":174,"cpu_time_v1":158,"memory_v0":7848,"memory_v1":12796,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.2,"input":"n,m = list(map(int,input().split()))\n\nli = [int(eval(input())) for i in range(m)]\n\n\n\nst = [1]*(n+1)\n\nfor i in range(m):\n\n st[li[i]-1] = 0\n\n\n\nif st[0] == 0 and st[1] == 0:\n\n print((0))\n\n exit()\n\nelif st[0] == 0 and st[1] != 0:\n\n st[1] = 1\n\nelif st[0] == 1 and st[1] != 0:\n\n st[1] = 2\n\n\n\nfor i in range(2,n+1):\n\n if st[i] == 0:\n\n continue\n\n else:\n\n st[i] = (st[i-1] + st[i-2])%1000000007\n\nprint((st[n-1]))\n\n \n","target":"n,m = list(map(int,input().split()))\n\ndp = [-1]*(n+1) \n\ndp[0] = 1\n\nmod = 10**9 + 7\n\nfor i in range(m):\n\n a = int(eval(input()))\n\n dp[a-1] = 0\n\n#print(dp)\n\nfor i in range(1,n+1):\n\n if dp[i] == 0:\n\n continue\n\n else:\n\n if i == 1:\n\n dp[i] = dp[i-1] +1\n\n else:\n\n dp[i] = (dp[i-1] + dp[i-2])%mod\n\n #print(dp)\n\nprint((dp[n-1]))","code_v0_loc":22,"code_v1_loc":18,"code_v0_num_chars":429,"code_v1_num_chars":368,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nli = [int(eval(input())) for i in range(m)]\nst = [1] * (n + 1)\nfor i in range(m):\n st[li[i] - 1] = 0\nif st[0] == 0 and st[1] == 0:\n print((0))\n exit()\nelif st[0] == 0 and st[1] != 0:\n st[1] = 1\nelif st[0] == 1 and st[1] != 0:\n st[1] = 2\nfor i in range(2, n + 1):\n if st[i] == 0:\n continue\n else:\n st[i] = (st[i - 1] + st[i - 2]) % 1000000007\nprint((st[n - 1]))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\ndp = [-1] * (n + 1)\ndp[0] = 1\nmod = 10**9 + 7\nfor i in range(m):\n a = int(eval(input()))\n dp[a - 1] = 0\n# print(dp)\nfor i in range(1, n + 1):\n if dp[i] == 0:\n continue\n else:\n if i == 1:\n dp[i] = dp[i - 1] + 1\n else:\n dp[i] = (dp[i - 1] + dp[i - 2]) % mod\n # print(dp)\nprint((dp[n - 1]))\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-li = [int(eval(input())) for i in range(m)]","-st = [1] * (n + 1)","+dp = [-1] * (n + 1)","+dp[0] = 1","+mod = 10**9 + 7","- st[li[i] - 1] = 0","-if st[0] == 0 and st[1] == 0:","- print((0))","- exit()","-elif st[0] == 0 and st[1] != 0:","- st[1] = 1","-elif st[0] == 1 and st[1] != 0:","- st[1] = 2","-for i in range(2, n + 1):","- if st[i] == 0:","+ a = int(eval(input()))","+ dp[a - 1] = 0","+# print(dp)","+for i in range(1, n + 1):","+ if dp[i] == 0:","- st[i] = (st[i - 1] + st[i - 2]) % 1000000007","-print((st[n - 1]))","+ if i == 1:","+ dp[i] = dp[i - 1] + 1","+ else:","+ dp[i] = (dp[i - 1] + dp[i - 2]) % mod","+ # print(dp)","+print((dp[n - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.04854053,"measured_runtime_v1":0.1045241416,"runtime_lift":0.4643953946,"key":["s690599533","s850536869"]} +{"user_id":"u047796752","problem_id":"p02929","language":"python","submission_id_v0":"s676013632","submission_id_v1":"s055491776","cpu_time_v0":200,"cpu_time_v1":90,"memory_v0":53728,"memory_v1":82756,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.0,"input":"import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nN = int(eval(input()))\n\nS = input()[:-1]\n\n\n\nif S[0]=='W':\n\n print((0))\n\n exit()\n\n \n\nl = [0]\n\nans = 1\n\nMOD = 10**9+7\n\n\n\nfor i in range(1, 2*N):\n\n if S[i]==S[i-1]:\n\n l.append(1^l[-1])\n\n else:\n\n l.append(l[-1])\n\n\n\nif l.count(0)!=N:\n\n print((0))\n\n exit()\n\n \n\nzero = 0\n\n\n\nfor li in l:\n\n if li==0:\n\n zero += 1\n\n else:\n\n ans *= zero\n\n ans %= MOD\n\n zero -= 1\n\n \n\nfor i in range(1, N+1):\n\n ans *= i\n\n ans %= MOD\n\n\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\nfrom collections import *\n\n\n\nN = int(eval(input()))\n\nS = list(input()[:-1])\n\n\n\nfor i in range(2*N):\n\n if (2*N-i-1)%2==1:\n\n if S[i]=='B':\n\n S[i] = 'W'\n\n else:\n\n S[i] = 'B'\n\n \n\nif S.count('B')!=N:\n\n print((0))\n\n exit()\n\n\n\nw = 0\n\nans = 1\n\nMOD = 10**9+7\n\n\n\nfor i in range(2*N):\n\n if S[i]=='W':\n\n w += 1\n\n else:\n\n ans *= w\n\n w -= 1\n\n ans %= MOD\n\n\n\nfor i in range(1, N+1):\n\n ans *= i\n\n ans %= MOD\n\n\n\nprint(ans)","code_v0_loc":40,"code_v1_loc":35,"code_v0_num_chars":560,"code_v1_num_chars":524,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\nN = int(eval(input()))\nS = input()[:-1]\nif S[0] == \"W\":\n print((0))\n exit()\nl = [0]\nans = 1\nMOD = 10**9 + 7\nfor i in range(1, 2 * N):\n if S[i] == S[i - 1]:\n l.append(1 ^ l[-1])\n else:\n l.append(l[-1])\nif l.count(0) != N:\n print((0))\n exit()\nzero = 0\nfor li in l:\n if li == 0:\n zero += 1\n else:\n ans *= zero\n ans %= MOD\n zero -= 1\nfor i in range(1, N + 1):\n ans *= i\n ans %= MOD\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom collections import *\n\nN = int(eval(input()))\nS = list(input()[:-1])\nfor i in range(2 * N):\n if (2 * N - i - 1) % 2 == 1:\n if S[i] == \"B\":\n S[i] = \"W\"\n else:\n S[i] = \"B\"\nif S.count(\"B\") != N:\n print((0))\n exit()\nw = 0\nans = 1\nMOD = 10**9 + 7\nfor i in range(2 * N):\n if S[i] == \"W\":\n w += 1\n else:\n ans *= w\n w -= 1\n ans %= MOD\nfor i in range(1, N + 1):\n ans *= i\n ans %= MOD\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-S = input()[:-1]","-if S[0] == \"W\":","+S = list(input()[:-1])","+for i in range(2 * N):","+ if (2 * N - i - 1) % 2 == 1:","+ if S[i] == \"B\":","+ S[i] = \"W\"","+ else:","+ S[i] = \"B\"","+if S.count(\"B\") != N:","-l = [0]","+w = 0","-for i in range(1, 2 * N):","- if S[i] == S[i - 1]:","- l.append(1 ^ l[-1])","+for i in range(2 * N):","+ if S[i] == \"W\":","+ w += 1","- l.append(l[-1])","-if l.count(0) != N:","- print((0))","- exit()","-zero = 0","-for li in l:","- if li == 0:","- zero += 1","- else:","- ans *= zero","+ ans *= w","+ w -= 1","- zero -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.035406285,"measured_runtime_v1":0.0358164923,"runtime_lift":0.9885469722,"key":["s676013632","s055491776"]} +{"user_id":"u983918956","problem_id":"p02939","language":"python","submission_id_v0":"s214866878","submission_id_v1":"s220032008","cpu_time_v0":104,"cpu_time_v1":70,"memory_v0":3500,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.69,"input":"S = eval(input())\n\nN = len(S)\n\n\n\nans = 0\n\npre = \"\"\n\nnow = \"\"\n\n\n\nfor i in range(N):\n\n if pre == now or now == \"\":\n\n now += S[i]\n\n if pre != now:\n\n ans += 1\n\n pre = now\n\n now = \"\"\n\n\n\nprint(ans)","target":"S = eval(input())\n\nN = len(S)\n\n\n\nans = 0\n\npre = \"\"\n\nnow = \"\"\n\n\n\nfor s in S:\n\n now += s\n\n if pre != now:\n\n ans += 1\n\n pre = now\n\n now = \"\"\n\n\n\nprint(ans)","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":219,"code_v1_num_chars":172,"code_v0_no_empty_lines":"S = eval(input())\nN = len(S)\nans = 0\npre = \"\"\nnow = \"\"\nfor i in range(N):\n if pre == now or now == \"\":\n now += S[i]\n if pre != now:\n ans += 1\n pre = now\n now = \"\"\nprint(ans)\n","code_v1_no_empty_lines":"S = eval(input())\nN = len(S)\nans = 0\npre = \"\"\nnow = \"\"\nfor s in S:\n now += s\n if pre != now:\n ans += 1\n pre = now\n now = \"\"\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["-for i in range(N):","- if pre == now or now == \"\":","- now += S[i]","+for s in S:","+ now += s"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363698031,"measured_runtime_v1":0.0375962011,"runtime_lift":0.9673797361,"key":["s214866878","s220032008"]} +{"user_id":"u644907318","problem_id":"p02741","language":"python","submission_id_v0":"s455102942","submission_id_v1":"s035360210","cpu_time_v0":185,"cpu_time_v1":62,"memory_v0":38384,"memory_v1":61816,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.49,"input":"A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]\n\nk = int(eval(input()))\n\nprint((A[k-1]))","target":"A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]\n\nK = int(eval(input()))\n\nprint((A[K-1]))","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":136,"code_v1_num_chars":134,"code_v0_no_empty_lines":"A = [\n 1,\n 1,\n 1,\n 2,\n 1,\n 2,\n 1,\n 5,\n 2,\n 2,\n 1,\n 5,\n 1,\n 2,\n 1,\n 14,\n 1,\n 5,\n 1,\n 5,\n 2,\n 2,\n 1,\n 15,\n 2,\n 2,\n 5,\n 4,\n 1,\n 4,\n 1,\n 51,\n]\nk = int(eval(input()))\nprint((A[k - 1]))\n","code_v1_no_empty_lines":"A = [\n 1,\n 1,\n 1,\n 2,\n 1,\n 2,\n 1,\n 5,\n 2,\n 2,\n 1,\n 5,\n 1,\n 2,\n 1,\n 14,\n 1,\n 5,\n 1,\n 5,\n 2,\n 2,\n 1,\n 15,\n 2,\n 2,\n 5,\n 4,\n 1,\n 4,\n 1,\n 51,\n]\nK = int(eval(input()))\nprint((A[K - 1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-k = int(eval(input()))","-print((A[k - 1]))","+K = int(eval(input()))","+print((A[K - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376290751,"measured_runtime_v1":0.0374307543,"runtime_lift":1.005298338,"key":["s455102942","s035360210"]} +{"user_id":"u952708174","problem_id":"p02720","language":"python","submission_id_v0":"s124345843","submission_id_v1":"s557761311","cpu_time_v0":257,"cpu_time_v1":92,"memory_v0":13828,"memory_v1":12404,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.2,"input":"def d_lunlun_number():\n\n import sys\n\n sys.setrecursionlimit(10**6)\n\n K = int(eval(input()))\n\n\n\n ans = []\n\n\n\n def dfs(num, current, digit_max):\n\n if current == digit_max:\n\n ans.append(num)\n\n return None\n\n for n in range(10):\n\n if abs((num % 10) - n) >= 2:\n\n continue\n\n dfs(num * 10 + n, current + 1, digit_max)\n\n\n\n for leading in range(1, 10):\n\n for d in range(1, 11):\n\n dfs(leading, 1, d)\n\n return sorted(ans)[K - 1]\n\n\n\nprint((d_lunlun_number()))","target":"def d_lunlun_number():\n\n from collections import deque\n\n K = int(eval(input()))\n\n\n\n queue = deque(list(range(1, 10)))\n\n ans = -1\n\n for _ in range(K):\n\n ans = queue.popleft()\n\n lsd = ans % 10 # least significant digit\n\n if lsd != 0:\n\n queue.append(10 * ans + (lsd - 1))\n\n queue.append(10 * ans + lsd)\n\n if ans % 10 != 9:\n\n queue.append(10 * ans + (lsd + 1))\n\n return ans\n\n\n\nprint((d_lunlun_number()))","code_v0_loc":22,"code_v1_loc":17,"code_v0_num_chars":550,"code_v1_num_chars":461,"code_v0_no_empty_lines":"def d_lunlun_number():\n import sys\n\n sys.setrecursionlimit(10**6)\n K = int(eval(input()))\n ans = []\n\n def dfs(num, current, digit_max):\n if current == digit_max:\n ans.append(num)\n return None\n for n in range(10):\n if abs((num % 10) - n) >= 2:\n continue\n dfs(num * 10 + n, current + 1, digit_max)\n\n for leading in range(1, 10):\n for d in range(1, 11):\n dfs(leading, 1, d)\n return sorted(ans)[K - 1]\n\n\nprint((d_lunlun_number()))\n","code_v1_no_empty_lines":"def d_lunlun_number():\n from collections import deque\n\n K = int(eval(input()))\n queue = deque(list(range(1, 10)))\n ans = -1\n for _ in range(K):\n ans = queue.popleft()\n lsd = ans % 10 # least significant digit\n if lsd != 0:\n queue.append(10 * ans + (lsd - 1))\n queue.append(10 * ans + lsd)\n if ans % 10 != 9:\n queue.append(10 * ans + (lsd + 1))\n return ans\n\n\nprint((d_lunlun_number()))\n","code_same":false,"relative_loc_diff_percent":22.7272727273,"diff":["- import sys","+ from collections import deque","- sys.setrecursionlimit(10**6)","- ans = []","-","- def dfs(num, current, digit_max):","- if current == digit_max:","- ans.append(num)","- return None","- for n in range(10):","- if abs((num % 10) - n) >= 2:","- continue","- dfs(num * 10 + n, current + 1, digit_max)","-","- for leading in range(1, 10):","- for d in range(1, 11):","- dfs(leading, 1, d)","- return sorted(ans)[K - 1]","+ queue = deque(list(range(1, 10)))","+ ans = -1","+ for _ in range(K):","+ ans = queue.popleft()","+ lsd = ans % 10 # least significant digit","+ if lsd != 0:","+ queue.append(10 * ans + (lsd - 1))","+ queue.append(10 * ans + lsd)","+ if ans % 10 != 9:","+ queue.append(10 * ans + (lsd + 1))","+ return ans"],"diff_only_import_comment":false,"measured_runtime_v0":0.4264560766,"measured_runtime_v1":0.0528981354,"runtime_lift":8.0618356985,"key":["s124345843","s557761311"]} +{"user_id":"u950708010","problem_id":"p03682","language":"python","submission_id_v0":"s961597184","submission_id_v1":"s833640217","cpu_time_v0":1526,"cpu_time_v1":922,"memory_v0":57952,"memory_v1":49812,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.58,"input":"import heapq\n\nimport sys\n\ninput = sys.stdin.readline\n\nclass UnionFind:\n\n def __init__(self, n):\n\n self.par = [i for i in range(n+1)]\n\n self.rank = [0] * (n+1)\n\n\n\n def find(self, x):\n\n if self.par[x] == x:\n\n return x\n\n else:\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if self.rank[x] < self.rank[y]:\n\n self.par[x] = y\n\n else:\n\n self.par[y] = x\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n\n\n def same_check(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\ndef solve():\n\n n = int(eval(input()))\n\n query = []\n\n xquery = []\n\n yquery = []\n\n for i in range(n):\n\n x,y = (int(i) for i in input().split())\n\n xquery.append((x,y,i))\n\n yquery.append((y,x,i))\n\n xquery = sorted(xquery)\n\n yquery = sorted(yquery)\n\n for i in range(n-1):\n\n tx,ty,place = xquery[i]\n\n tx2,ty2,place2 = xquery[i+1]\n\n cost = min(abs(tx2-tx),abs(ty2-ty))\n\n heapq.heappush(query,(cost,place,place2))\n\n \n\n ty,tx,place = yquery[i]\n\n ty2,tx2,place2 = yquery[i+1]\n\n cost = min(abs(tx2-tx),abs(ty2-ty))\n\n heapq.heappush(query,(cost,place,place2))\n\n ct = 0\n\n uf = UnionFind(n)\n\n while len(query) > 0:\n\n cost,place1,place2 = heapq.heappop(query)\n\n if uf.same_check(place1,place2):\n\n continue\n\n else:\n\n uf.union(int(place1),int(place2))\n\n ct += cost\n\n print(ct)\n\n \n\n\n\nsolve()","target":"#https:\/\/atcoder.jp\/contests\/abc065\/submissions\/5881131\n\nimport sys\n\ninput = sys.stdin.readline\n\nclass UnionFind:\n\n def __init__(self, n):\n\n self.par = [i for i in range(n+1)]\n\n self.rank = [0] * (n+1)\n\n\n\n def find(self, x):\n\n if self.par[x] == x:\n\n return x\n\n else:\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if self.rank[x] < self.rank[y]:\n\n self.par[x] = y\n\n else:\n\n self.par[y] = x\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n\n\n def same_check(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\ndef MST(n, E):\n\n E = sorted(E, key=lambda x: x[2])\n\n uf = UnionFind(n)\n\n ct = 0\n\n for i,j,cost in E:\n\n if uf.same_check(i,j):\n\n continue\n\n else:\n\n uf.union(i,j)\n\n ct += cost\n\n return ct\n\n \n\ndef solve():\n\n N = int(eval(input()))\n\n X = []\n\n append=X.append\n\n for i in range(N):\n\n x, y = list(map(int, input().split()))\n\n append((i, x, y))\n\n \n\n F = []\n\n append = F.append\n\n Y = sorted(X, key = lambda x: x[1])\n\n for i in range(len(Y)-1):\n\n append((Y[i][0], Y[i+1][0], abs(Y[i+1][1]-Y[i][1])))\n\n \n\n Y = sorted(X, key = lambda x: x[2])\n\n for i in range(len(Y)-1):\n\n append((Y[i][0], Y[i+1][0], abs(Y[i+1][2]-Y[i][2])))\n\n \n\n print((MST(N, F)))\n\n\n\nsolve()","code_v0_loc":62,"code_v1_loc":61,"code_v0_num_chars":1555,"code_v1_num_chars":1458,"code_v0_no_empty_lines":"import heapq\nimport sys\n\ninput = sys.stdin.readline\n\n\nclass UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n + 1)]\n self.rank = [0] * (n + 1)\n\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n else:\n self.par[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n def same_check(self, x, y):\n return self.find(x) == self.find(y)\n\n\ndef solve():\n n = int(eval(input()))\n query = []\n xquery = []\n yquery = []\n for i in range(n):\n x, y = (int(i) for i in input().split())\n xquery.append((x, y, i))\n yquery.append((y, x, i))\n xquery = sorted(xquery)\n yquery = sorted(yquery)\n for i in range(n - 1):\n tx, ty, place = xquery[i]\n tx2, ty2, place2 = xquery[i + 1]\n cost = min(abs(tx2 - tx), abs(ty2 - ty))\n heapq.heappush(query, (cost, place, place2))\n ty, tx, place = yquery[i]\n ty2, tx2, place2 = yquery[i + 1]\n cost = min(abs(tx2 - tx), abs(ty2 - ty))\n heapq.heappush(query, (cost, place, place2))\n ct = 0\n uf = UnionFind(n)\n while len(query) > 0:\n cost, place1, place2 = heapq.heappop(query)\n if uf.same_check(place1, place2):\n continue\n else:\n uf.union(int(place1), int(place2))\n ct += cost\n print(ct)\n\n\nsolve()\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc065\/submissions\/5881131\nimport sys\n\ninput = sys.stdin.readline\n\n\nclass UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n + 1)]\n self.rank = [0] * (n + 1)\n\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n else:\n self.par[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n def same_check(self, x, y):\n return self.find(x) == self.find(y)\n\n\ndef MST(n, E):\n E = sorted(E, key=lambda x: x[2])\n uf = UnionFind(n)\n ct = 0\n for i, j, cost in E:\n if uf.same_check(i, j):\n continue\n else:\n uf.union(i, j)\n ct += cost\n return ct\n\n\ndef solve():\n N = int(eval(input()))\n X = []\n append = X.append\n for i in range(N):\n x, y = list(map(int, input().split()))\n append((i, x, y))\n F = []\n append = F.append\n Y = sorted(X, key=lambda x: x[1])\n for i in range(len(Y) - 1):\n append((Y[i][0], Y[i + 1][0], abs(Y[i + 1][1] - Y[i][1])))\n Y = sorted(X, key=lambda x: x[2])\n for i in range(len(Y) - 1):\n append((Y[i][0], Y[i + 1][0], abs(Y[i + 1][2] - Y[i][2])))\n print((MST(N, F)))\n\n\nsolve()\n","code_same":false,"relative_loc_diff_percent":1.6129032258,"diff":["-import heapq","+# https:\/\/atcoder.jp\/contests\/abc065\/submissions\/5881131","-def solve():","- n = int(eval(input()))","- query = []","- xquery = []","- yquery = []","- for i in range(n):","- x, y = (int(i) for i in input().split())","- xquery.append((x, y, i))","- yquery.append((y, x, i))","- xquery = sorted(xquery)","- yquery = sorted(yquery)","- for i in range(n - 1):","- tx, ty, place = xquery[i]","- tx2, ty2, place2 = xquery[i + 1]","- cost = min(abs(tx2 - tx), abs(ty2 - ty))","- heapq.heappush(query, (cost, place, place2))","- ty, tx, place = yquery[i]","- ty2, tx2, place2 = yquery[i + 1]","- cost = min(abs(tx2 - tx), abs(ty2 - ty))","- heapq.heappush(query, (cost, place, place2))","+def MST(n, E):","+ E = sorted(E, key=lambda x: x[2])","+ uf = UnionFind(n)","- uf = UnionFind(n)","- while len(query) > 0:","- cost, place1, place2 = heapq.heappop(query)","- if uf.same_check(place1, place2):","+ for i, j, cost in E:","+ if uf.same_check(i, j):","- uf.union(int(place1), int(place2))","+ uf.union(i, j)","- print(ct)","+ return ct","+","+","+def solve():","+ N = int(eval(input()))","+ X = []","+ append = X.append","+ for i in range(N):","+ x, y = list(map(int, input().split()))","+ append((i, x, y))","+ F = []","+ append = F.append","+ Y = sorted(X, key=lambda x: x[1])","+ for i in range(len(Y) - 1):","+ append((Y[i][0], Y[i + 1][0], abs(Y[i + 1][1] - Y[i][1])))","+ Y = sorted(X, key=lambda x: x[2])","+ for i in range(len(Y) - 1):","+ append((Y[i][0], Y[i + 1][0], abs(Y[i + 1][2] - Y[i][2])))","+ print((MST(N, F)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0338659286,"measured_runtime_v1":0.042784071,"runtime_lift":0.7915546108,"key":["s961597184","s833640217"]} +{"user_id":"u887207211","problem_id":"p03478","language":"python","submission_id_v0":"s477060582","submission_id_v1":"s501737246","cpu_time_v0":37,"cpu_time_v1":31,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.22,"input":"N, A, B = list(map(int,input().split()))\n\n \n\nans = 0\n\nfor i in range(1,N+1):\n\n if(A <= sum(list(map(int,str(i)))) <= B):\n\n ans += i\n\nprint(ans)","target":"N, A, B = list(map(int,input().split()))\n\n\n\ncnt = 0\n\nfor i in range(1,N+1):\n\n if(A <= sum(map(int,str(i))) <= B):\n\n cnt += i\n\nprint(cnt)","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":141,"code_v1_num_chars":134,"code_v0_no_empty_lines":"N, A, B = list(map(int, input().split()))\nans = 0\nfor i in range(1, N + 1):\n if A <= sum(list(map(int, str(i)))) <= B:\n ans += i\nprint(ans)\n","code_v1_no_empty_lines":"N, A, B = list(map(int, input().split()))\ncnt = 0\nfor i in range(1, N + 1):\n if A <= sum(map(int, str(i))) <= B:\n cnt += i\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-ans = 0","+cnt = 0","- if A <= sum(list(map(int, str(i)))) <= B:","- ans += i","-print(ans)","+ if A <= sum(map(int, str(i))) <= B:","+ cnt += i","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1028964243,"measured_runtime_v1":0.153083746,"runtime_lift":0.6721577372,"key":["s477060582","s501737246"]} +{"user_id":"u222668979","problem_id":"p02820","language":"python","submission_id_v0":"s824605268","submission_id_v1":"s249248945","cpu_time_v0":97,"cpu_time_v1":87,"memory_v0":81928,"memory_v1":82224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.31,"input":"n, k = list(map(int, input().split()))\n\nr, s, p = list(map(int, input().split()))\n\nt = eval(input())\n\n\n\ncnt, ans = set(), 0\n\nfor i, ti in enumerate(t):\n\n if (i - k in cnt) and ti == t[i - k]:\n\n continue\n\n ans += r * (ti == 's')\n\n ans += s * (ti == 'p')\n\n ans += p * (ti == 'r')\n\n cnt.add(i)\n\nprint(ans)\n","target":"n, k = list(map(int, input().split()))\n\nr, s, p = list(map(int, input().split()))\n\nt = eval(input())\n\n\n\ndict = {'s': r, 'p': s, 'r': p}\n\ncnt, ans = set(), 0\n\nfor i, ti in enumerate(t):\n\n if (i - k in cnt) and ti == t[i - k]:\n\n continue\n\n ans += dict[ti]\n\n cnt.add(i)\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":307,"code_v1_num_chars":277,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nr, s, p = list(map(int, input().split()))\nt = eval(input())\ncnt, ans = set(), 0\nfor i, ti in enumerate(t):\n if (i - k in cnt) and ti == t[i - k]:\n continue\n ans += r * (ti == \"s\")\n ans += s * (ti == \"p\")\n ans += p * (ti == \"r\")\n cnt.add(i)\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nr, s, p = list(map(int, input().split()))\nt = eval(input())\ndict = {\"s\": r, \"p\": s, \"r\": p}\ncnt, ans = set(), 0\nfor i, ti in enumerate(t):\n if (i - k in cnt) and ti == t[i - k]:\n continue\n ans += dict[ti]\n cnt.add(i)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["+dict = {\"s\": r, \"p\": s, \"r\": p}","- ans += r * (ti == \"s\")","- ans += s * (ti == \"p\")","- ans += p * (ti == \"r\")","+ ans += dict[ti]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0494715741,"measured_runtime_v1":0.0501560225,"runtime_lift":0.9863536131,"key":["s824605268","s249248945"]} +{"user_id":"u111365362","problem_id":"p03062","language":"python","submission_id_v0":"s097050034","submission_id_v1":"s224283078","cpu_time_v0":118,"cpu_time_v1":102,"memory_v0":14332,"memory_v1":14284,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.56,"input":"n = int(eval(input()))\n\na = list(map(int,input().split()))\n\nb = []\n\nminus = 0\n\nfor i in range(n):\n\n if a[i] < 0:\n\n minus += 1\n\n b.append(abs(a[i]))\n\nb.sort()\n\nif minus % 2 == 0:\n\n print((sum(b)))\n\nelse:\n\n print((sum(b) - 2 * b[0]))","target":"#14:20\n\nn = int(eval(input()))\n\na = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(n):\n\n if a[i] < 0:\n\n cnt += 1\n\n a[i] *= -1\n\na.sort()\n\nif cnt % 2 == 0:\n\n print((sum(a)))\n\nelse:\n\n print((sum(a)-2*a[0]))","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":228,"code_v1_num_chars":211,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nb = []\nminus = 0\nfor i in range(n):\n if a[i] < 0:\n minus += 1\n b.append(abs(a[i]))\nb.sort()\nif minus % 2 == 0:\n print((sum(b)))\nelse:\n print((sum(b) - 2 * b[0]))\n","code_v1_no_empty_lines":"# 14:20\nn = int(eval(input()))\na = list(map(int, input().split()))\ncnt = 0\nfor i in range(n):\n if a[i] < 0:\n cnt += 1\n a[i] *= -1\na.sort()\nif cnt % 2 == 0:\n print((sum(a)))\nelse:\n print((sum(a) - 2 * a[0]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+# 14:20","-b = []","-minus = 0","+cnt = 0","- minus += 1","- b.append(abs(a[i]))","-b.sort()","-if minus % 2 == 0:","- print((sum(b)))","+ cnt += 1","+ a[i] *= -1","+a.sort()","+if cnt % 2 == 0:","+ print((sum(a)))","- print((sum(b) - 2 * b[0]))","+ print((sum(a) - 2 * a[0]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0780327101,"measured_runtime_v1":0.0966055579,"runtime_lift":0.8077455557,"key":["s097050034","s224283078"]} +{"user_id":"u881590806","problem_id":"p02272","language":"python","submission_id_v0":"s577091406","submission_id_v1":"s616923332","cpu_time_v0":4240,"cpu_time_v1":3730,"memory_v0":66548,"memory_v1":66576,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.03,"input":"def merge_sort(a):\n\n return _merge_sort(a)\n\n\n\ndef _merge_sort(a):\n\n if len(a) == 1:\n\n return a,0\n\n m = len(a)\/2\n\n b,count1 = _merge_sort(a[0:m])\n\n c,count2 = _merge_sort(a[m:len(a)])\n\n ret,count3 = merge(b,c)\n\n return (ret,count1+count2+count3)\n\n\n\ndef merge(b,c):\n\n a = []\n\n i = 0\n\n j = 0\n\n count = 0\n\n while i < len(b) and j < len(c):\n\n count += 1\n\n if b[i] > c[j]:\n\n a.append(c[j])\n\n j += 1\n\n else:\n\n a.append(b[i])\n\n i += 1\n\n if i == len(b):\n\n while j < len(c):\n\n count += 1\n\n a.append(c[j])\n\n j += 1\n\n elif j == len(c):\n\n while i < len(b):\n\n count += 1\n\n a.append(b[i])\n\n i += 1\n\n return a,count\n\n\n\nn = int(input())\n\na = list(map(int,input().split(' ')))\n\nret,count = merge_sort(a)\n\nprint(' '.join(map(str,ret)))\n\nprint(count)","target":"global_count = 0\n\n\n\ndef sort(a):\n\n return merge_sort(a)\n\n\n\ndef merge_sort(a):\n\n n = len(a)\n\n if n <= 1:\n\n return a\n\n lo = 0\n\n hi = n\n\n med = (lo+hi)\/2\n\n left = merge_sort(a[lo:med])\n\n right = merge_sort(a[med:hi])\n\n return merge(left, right)\n\n\n\ndef merge(a,b):\n\n global global_count\n\n c = []\n\n na = len(a)\n\n nb = len(b)\n\n i = 0\n\n j = 0\n\n while i < na and j < nb:\n\n if a[i] < b[j]:\n\n global_count += 1\n\n c.append(a[i])\n\n i += 1\n\n else:\n\n global_count += 1\n\n c.append(b[j])\n\n j += 1\n\n\n\n if i == na:\n\n while j < nb:\n\n global_count += 1\n\n c.append(b[j])\n\n j += 1\n\n if j == nb:\n\n while i < na:\n\n global_count += 1\n\n c.append(a[i])\n\n i += 1\n\n\n\n return c\n\n\n\nn = int(input())\n\na = list(map(int, input().split(' ')))\n\nc = sort(a)\n\nprint(' '.join(map(str, c)))\n\nprint(global_count)","code_v0_loc":42,"code_v1_loc":51,"code_v0_num_chars":927,"code_v1_num_chars":995,"code_v0_no_empty_lines":"def merge_sort(a):\n return _merge_sort(a)\n\n\ndef _merge_sort(a):\n if len(a) == 1:\n return a, 0\n m = len(a) \/ 2\n b, count1 = _merge_sort(a[0:m])\n c, count2 = _merge_sort(a[m : len(a)])\n ret, count3 = merge(b, c)\n return (ret, count1 + count2 + count3)\n\n\ndef merge(b, c):\n a = []\n i = 0\n j = 0\n count = 0\n while i < len(b) and j < len(c):\n count += 1\n if b[i] > c[j]:\n a.append(c[j])\n j += 1\n else:\n a.append(b[i])\n i += 1\n if i == len(b):\n while j < len(c):\n count += 1\n a.append(c[j])\n j += 1\n elif j == len(c):\n while i < len(b):\n count += 1\n a.append(b[i])\n i += 1\n return a, count\n\n\nn = int(input())\na = list(map(int, input().split(\" \")))\nret, count = merge_sort(a)\nprint(\" \".join(map(str, ret)))\nprint(count)\n","code_v1_no_empty_lines":"global_count = 0\n\n\ndef sort(a):\n return merge_sort(a)\n\n\ndef merge_sort(a):\n n = len(a)\n if n <= 1:\n return a\n lo = 0\n hi = n\n med = (lo + hi) \/ 2\n left = merge_sort(a[lo:med])\n right = merge_sort(a[med:hi])\n return merge(left, right)\n\n\ndef merge(a, b):\n global global_count\n c = []\n na = len(a)\n nb = len(b)\n i = 0\n j = 0\n while i < na and j < nb:\n if a[i] < b[j]:\n global_count += 1\n c.append(a[i])\n i += 1\n else:\n global_count += 1\n c.append(b[j])\n j += 1\n if i == na:\n while j < nb:\n global_count += 1\n c.append(b[j])\n j += 1\n if j == nb:\n while i < na:\n global_count += 1\n c.append(a[i])\n i += 1\n return c\n\n\nn = int(input())\na = list(map(int, input().split(\" \")))\nc = sort(a)\nprint(\" \".join(map(str, c)))\nprint(global_count)\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["-def merge_sort(a):","- return _merge_sort(a)","+global_count = 0","-def _merge_sort(a):","- if len(a) == 1:","- return a, 0","- m = len(a) \/ 2","- b, count1 = _merge_sort(a[0:m])","- c, count2 = _merge_sort(a[m : len(a)])","- ret, count3 = merge(b, c)","- return (ret, count1 + count2 + count3)","+def sort(a):","+ return merge_sort(a)","-def merge(b, c):","- a = []","+def merge_sort(a):","+ n = len(a)","+ if n <= 1:","+ return a","+ lo = 0","+ hi = n","+ med = (lo + hi) \/ 2","+ left = merge_sort(a[lo:med])","+ right = merge_sort(a[med:hi])","+ return merge(left, right)","+","+","+def merge(a, b):","+ global global_count","+ c = []","+ na = len(a)","+ nb = len(b)","- count = 0","- while i < len(b) and j < len(c):","- count += 1","- if b[i] > c[j]:","- a.append(c[j])","+ while i < na and j < nb:","+ if a[i] < b[j]:","+ global_count += 1","+ c.append(a[i])","+ i += 1","+ else:","+ global_count += 1","+ c.append(b[j])","- else:","- a.append(b[i])","+ if i == na:","+ while j < nb:","+ global_count += 1","+ c.append(b[j])","+ j += 1","+ if j == nb:","+ while i < na:","+ global_count += 1","+ c.append(a[i])","- if i == len(b):","- while j < len(c):","- count += 1","- a.append(c[j])","- j += 1","- elif j == len(c):","- while i < len(b):","- count += 1","- a.append(b[i])","- i += 1","- return a, count","+ return c","-ret, count = merge_sort(a)","-print(\" \".join(map(str, ret)))","-print(count)","+c = sort(a)","+print(\" \".join(map(str, c)))","+print(global_count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.04947049,"measured_runtime_v1":0.049422318,"runtime_lift":1.0009747011,"key":["s577091406","s616923332"]} +{"user_id":"u608088992","problem_id":"p03450","language":"python","submission_id_v0":"s112528516","submission_id_v1":"s804694183","cpu_time_v0":853,"cpu_time_v1":665,"memory_v0":92920,"memory_v1":86304,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.04,"input":"import sys\n\nfrom collections import deque\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n N, M = list(map(int, input().split()))\n\n Edge = [[] for _ in range(N)]\n\n for _ in range(M):\n\n l, r, d = list(map(int, input().split()))\n\n Edge[l-1].append((r-1, d))\n\n Edge[r-1].append((l-1, -1 * d))\n\n Dist = [10 ** 20] * N\n\n possible = True\n\n for i in range(N):\n\n if Dist[i] == 10 ** 20:\n\n q = deque()\n\n q.append((i, 0))\n\n while q:\n\n nn, nd = q.popleft()\n\n if Dist[nn] == 10 ** 20:\n\n Dist[nn] = nd\n\n for ne, add in Edge[nn]: q.append((ne, nd + add))\n\n else:\n\n if Dist[nn] == nd: continue\n\n else:\n\n possible = False\n\n break\n\n if not possible:\n\n print(\"No\")\n\n break\n\n else: print(\"Yes\")\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","target":"import sys\n\nfrom collections import deque\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n N, M = list(map(int, input().split()))\n\n E = [[] for _ in range(N)]\n\n for _ in range(M):\n\n l, r, d = list(map(int, input().split()))\n\n E[l-1].append((r - 1, d))\n\n E[r-1].append((l - 1, -d))\n\n Pos = [10 ** 20] * N\n\n q = deque()\n\n flag = True\n\n for i in range(N):\n\n if Pos[i] == 10 ** 20:\n\n q.append((i, 0))\n\n minX, maxX = 0, 0\n\n while q:\n\n x, p = q.popleft()\n\n if Pos[x] == 10 ** 20:\n\n minX = min(minX, p)\n\n maxX = max(maxX, p)\n\n Pos[x] = p\n\n for ne, d in E[x]: q.append((ne, p + d))\n\n elif Pos[x] == p: continue\n\n else:\n\n flag = False\n\n break\n\n else:\n\n if maxX - minX <= 10 ** 9: continue\n\n else: flag = False\n\n if not flag:\n\n print(\"No\")\n\n break\n\n else: print(\"Yes\")\n\n #print(Pos)\n\n \n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":36,"code_v1_loc":42,"code_v0_num_chars":1013,"code_v1_num_chars":1176,"code_v0_no_empty_lines":"import sys\nfrom collections import deque\n\n\ndef solve():\n input = sys.stdin.readline\n N, M = list(map(int, input().split()))\n Edge = [[] for _ in range(N)]\n for _ in range(M):\n l, r, d = list(map(int, input().split()))\n Edge[l - 1].append((r - 1, d))\n Edge[r - 1].append((l - 1, -1 * d))\n Dist = [10**20] * N\n possible = True\n for i in range(N):\n if Dist[i] == 10**20:\n q = deque()\n q.append((i, 0))\n while q:\n nn, nd = q.popleft()\n if Dist[nn] == 10**20:\n Dist[nn] = nd\n for ne, add in Edge[nn]:\n q.append((ne, nd + add))\n else:\n if Dist[nn] == nd:\n continue\n else:\n possible = False\n break\n if not possible:\n print(\"No\")\n break\n else:\n print(\"Yes\")\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque\n\n\ndef solve():\n input = sys.stdin.readline\n N, M = list(map(int, input().split()))\n E = [[] for _ in range(N)]\n for _ in range(M):\n l, r, d = list(map(int, input().split()))\n E[l - 1].append((r - 1, d))\n E[r - 1].append((l - 1, -d))\n Pos = [10**20] * N\n q = deque()\n flag = True\n for i in range(N):\n if Pos[i] == 10**20:\n q.append((i, 0))\n minX, maxX = 0, 0\n while q:\n x, p = q.popleft()\n if Pos[x] == 10**20:\n minX = min(minX, p)\n maxX = max(maxX, p)\n Pos[x] = p\n for ne, d in E[x]:\n q.append((ne, p + d))\n elif Pos[x] == p:\n continue\n else:\n flag = False\n break\n else:\n if maxX - minX <= 10**9:\n continue\n else:\n flag = False\n if not flag:\n print(\"No\")\n break\n else:\n print(\"Yes\")\n # print(Pos)\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["- Edge = [[] for _ in range(N)]","+ E = [[] for _ in range(N)]","- Edge[l - 1].append((r - 1, d))","- Edge[r - 1].append((l - 1, -1 * d))","- Dist = [10**20] * N","- possible = True","+ E[l - 1].append((r - 1, d))","+ E[r - 1].append((l - 1, -d))","+ Pos = [10**20] * N","+ q = deque()","+ flag = True","- if Dist[i] == 10**20:","- q = deque()","+ if Pos[i] == 10**20:","+ minX, maxX = 0, 0","- nn, nd = q.popleft()","- if Dist[nn] == 10**20:","- Dist[nn] = nd","- for ne, add in Edge[nn]:","- q.append((ne, nd + add))","+ x, p = q.popleft()","+ if Pos[x] == 10**20:","+ minX = min(minX, p)","+ maxX = max(maxX, p)","+ Pos[x] = p","+ for ne, d in E[x]:","+ q.append((ne, p + d))","+ elif Pos[x] == p:","+ continue","- if Dist[nn] == nd:","- continue","- else:","- possible = False","- break","- if not possible:","+ flag = False","+ break","+ else:","+ if maxX - minX <= 10**9:","+ continue","+ else:","+ flag = False","+ if not flag:","+ # print(Pos)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0747686386,"measured_runtime_v1":0.038955164,"runtime_lift":1.9193511463,"key":["s112528516","s804694183"]} +{"user_id":"u234189749","problem_id":"p02748","language":"python","submission_id_v0":"s515987411","submission_id_v1":"s091916135","cpu_time_v0":483,"cpu_time_v1":414,"memory_v0":18736,"memory_v1":18608,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"A,B,M = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\n\n\nans = min(a)+min(b)\n\n\n\nfor i in range(M):\n\n c =list(map(int,input().split()))\n\n s = a[c[0]-1]+b[c[1]-1]-c[2]\n\n ans = min(s,ans)\n\n\n\nprint(ans)","target":"A,B,M = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\n \n\nans = min(a)+min(b)\n\n \n\nfor i in range(M):\n\n x,y,z = list(map(int,input().split()))\n\n s = a[x-1]+b[y-1]-z\n\n ans = (s if s < ans else ans)\n\n \n\nprint(ans)","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":258,"code_v1_num_chars":264,"code_v0_no_empty_lines":"A, B, M = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nans = min(a) + min(b)\nfor i in range(M):\n c = list(map(int, input().split()))\n s = a[c[0] - 1] + b[c[1] - 1] - c[2]\n ans = min(s, ans)\nprint(ans)\n","code_v1_no_empty_lines":"A, B, M = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nans = min(a) + min(b)\nfor i in range(M):\n x, y, z = list(map(int, input().split()))\n s = a[x - 1] + b[y - 1] - z\n ans = s if s < ans else ans\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- c = list(map(int, input().split()))","- s = a[c[0] - 1] + b[c[1] - 1] - c[2]","- ans = min(s, ans)","+ x, y, z = list(map(int, input().split()))","+ s = a[x - 1] + b[y - 1] - z","+ ans = s if s < ans else ans"],"diff_only_import_comment":false,"measured_runtime_v0":0.1050613878,"measured_runtime_v1":0.109524245,"runtime_lift":0.9592523349,"key":["s515987411","s091916135"]} +{"user_id":"u970197315","problem_id":"p03559","language":"python","submission_id_v0":"s901958192","submission_id_v1":"s711083820","cpu_time_v0":319,"cpu_time_v1":237,"memory_v0":22516,"memory_v1":29344,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.71,"input":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\nb=list(map(int,input().split()))\n\nc=list(map(int,input().split()))\n\na.sort()\n\nb.sort()\n\nc.sort()\n\nfrom bisect import bisect_left,bisect_right\n\nans=0\n\nfor i in range(n):\n\n ida=bisect_left(a,b[i])\n\n idc=bisect_right(c,b[i])\n\n ans+=ida*(n-idc)\n\nprint(ans)","target":"n = int(eval(input()))\n\n\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\na.sort()\n\nb.sort()\n\nc.sort()\n\n\n\nfrom bisect import bisect_left,bisect_right\n\nans = 0\n\nfor i in range(n):\n\n pos_a = bisect_left(a,b[i])\n\n pos_c = bisect_right(c,b[i])\n\n ans += pos_a*(n-pos_c)\n\n\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":17,"code_v0_num_chars":305,"code_v1_num_chars":344,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort()\nb.sort()\nc.sort()\nfrom bisect import bisect_left, bisect_right\n\nans = 0\nfor i in range(n):\n ida = bisect_left(a, b[i])\n idc = bisect_right(c, b[i])\n ans += ida * (n - idc)\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort()\nb.sort()\nc.sort()\nfrom bisect import bisect_left, bisect_right\n\nans = 0\nfor i in range(n):\n pos_a = bisect_left(a, b[i])\n pos_c = bisect_right(c, b[i])\n ans += pos_a * (n - pos_c)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["- ida = bisect_left(a, b[i])","- idc = bisect_right(c, b[i])","- ans += ida * (n - idc)","+ pos_a = bisect_left(a, b[i])","+ pos_c = bisect_right(c, b[i])","+ ans += pos_a * (n - pos_c)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1392122302,"measured_runtime_v1":0.0397577767,"runtime_lift":3.5015094302,"key":["s901958192","s711083820"]} +{"user_id":"u326609687","problem_id":"p02579","language":"python","submission_id_v0":"s846954627","submission_id_v1":"s522324935","cpu_time_v0":938,"cpu_time_v1":512,"memory_v0":123832,"memory_v1":114476,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.42,"input":"import numpy as np\n\nfrom numba import njit\n\ni4 = np.int32\n\ni8 = np.int64\n\n\n\nINF = 1000000000\n\n\n\n\n\n@njit\n\ndef solve(s, ch, cw):\n\n H = s.shape[0]\n\n W = s.shape[1] - 1\n\n ah = H + 4\n\n aw = W + 4\n\n\n\n a = np.full((ah, aw), -1, i4)\n\n for i in range(H):\n\n for j in range(W):\n\n if s[i, j] == 46:\n\n a[i + 2, j + 2] = INF\n\n\n\n sh1 = np.empty(1000000, i4)\n\n sw1 = np.empty(1000000, i4)\n\n p1 = 0\n\n sh2 = np.empty(1000000, i4)\n\n sw2 = np.empty(1000000, i4)\n\n p2 = 0\n\n\n\n def push2(h2, w2, dis2):\n\n nonlocal p2, sh2, sw2\n\n\n\n dis = 0\n\n a[ch + 1, cw + 1] = dis\n\n sh1[p1] = ch + 1\n\n sw1[p1] = cw + 1\n\n p1 += 1\n\n\n\n while True:\n\n while p1 > 0:\n\n p1 -= 1\n\n h = sh1[p1]\n\n w = sw1[p1]\n\n for i in range(-2, 3):\n\n for j in range(-2, 3):\n\n if ((i == 1 or i == -1) and j == 0) or (i == 0 and (j == 1 or j == -1)):\n\n if a[h + i, w + j] > dis:\n\n a[h + i, w + j] = dis\n\n sh1[p1] = h + i\n\n sw1[p1] = w + j\n\n p1 += 1\n\n else:\n\n if a[h + i, w + j] > dis + 1:\n\n push2(h + i, w + j, dis + 1)\n\n a[h + i, w + j] = dis + 1\n\n sh2[p2] = h + i\n\n sw2[p2] = w + j\n\n p2 += 1\n\n\n\n dis += 1\n\n for i in range(p2):\n\n if a[sh2[i], sw2[i]] == dis:\n\n sh1[p1] = sh2[i]\n\n sw1[p1] = sw2[i]\n\n p1 += 1\n\n p2 = 0\n\n\n\n if p1 == 0:\n\n break\n\n\n\n return a\n\n\n\n\n\ndef main(in_file):\n\n stdin = open(in_file)\n\n H, W = [int(x) for x in stdin.readline().split()]\n\n ch, cw = [int(x) for x in stdin.readline().split()]\n\n dh, dw = [int(x) for x in stdin.readline().split()]\n\n s = np.frombuffer(np.array(stdin.read()), i4).reshape((H, W + 1))\n\n a = solve(s, ch, cw)\n\n ans = a[dh + 1, dw + 1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n\n\n\n\nmain('\/dev\/stdin')\n","target":"import numpy as np\n\nfrom numba import njit, int32, int64\n\ni4 = np.int32\n\ni8 = np.int64\n\n\n\nINF = 1000000000\n\n\n\n\n\n@njit((int32[:,:], int64, int64), cache=True)\n\ndef solve(s, ch, cw):\n\n H = s.shape[0]\n\n W = s.shape[1] - 1\n\n ah = H + 4\n\n aw = W + 4\n\n\n\n a = np.full((ah, aw), -1, i4)\n\n for i in range(H):\n\n for j in range(W):\n\n if s[i, j] == 46:\n\n a[i + 2, j + 2] = INF\n\n\n\n sh1 = np.empty(1000000, i4)\n\n sw1 = np.empty(1000000, i4)\n\n p1 = 0\n\n sh2 = np.empty(1000000, i4)\n\n sw2 = np.empty(1000000, i4)\n\n p2 = 0\n\n\n\n dis = 0\n\n a[ch + 1, cw + 1] = dis\n\n sh1[p1] = ch + 1\n\n sw1[p1] = cw + 1\n\n p1 += 1\n\n\n\n while True:\n\n while p1 > 0:\n\n p1 -= 1\n\n h = sh1[p1]\n\n w = sw1[p1]\n\n for i in range(-2, 3):\n\n for j in range(-2, 3):\n\n if ((i == 1 or i == -1) and j == 0) or (i == 0 and (j == 1 or j == -1)):\n\n if a[h + i, w + j] > dis:\n\n a[h + i, w + j] = dis\n\n sh1[p1] = h + i\n\n sw1[p1] = w + j\n\n p1 += 1\n\n else:\n\n if a[h + i, w + j] > dis + 1:\n\n a[h + i, w + j] = dis + 1\n\n sh2[p2] = h + i\n\n sw2[p2] = w + j\n\n p2 += 1\n\n\n\n dis += 1\n\n for i in range(p2):\n\n if a[sh2[i], sw2[i]] == dis:\n\n sh1[p1] = sh2[i]\n\n sw1[p1] = sw2[i]\n\n p1 += 1\n\n p2 = 0\n\n\n\n if p1 == 0:\n\n break\n\n\n\n return a\n\n\n\n\n\ndef main(in_file):\n\n stdin = open(in_file)\n\n H, W = [int(x) for x in stdin.readline().split()]\n\n ch, cw = [int(x) for x in stdin.readline().split()]\n\n dh, dw = [int(x) for x in stdin.readline().split()]\n\n s = np.frombuffer(np.array(stdin.read()), i4).reshape((H, W + 1))\n\n a = solve(s, ch, cw)\n\n ans = a[dh + 1, dw + 1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n\n\n\n\nmain('\/dev\/stdin')\n","code_v0_loc":87,"code_v1_loc":83,"code_v0_num_chars":2216,"code_v1_num_chars":2149,"code_v0_no_empty_lines":"import numpy as np\nfrom numba import njit\n\ni4 = np.int32\ni8 = np.int64\nINF = 1000000000\n\n\n@njit\ndef solve(s, ch, cw):\n H = s.shape[0]\n W = s.shape[1] - 1\n ah = H + 4\n aw = W + 4\n a = np.full((ah, aw), -1, i4)\n for i in range(H):\n for j in range(W):\n if s[i, j] == 46:\n a[i + 2, j + 2] = INF\n sh1 = np.empty(1000000, i4)\n sw1 = np.empty(1000000, i4)\n p1 = 0\n sh2 = np.empty(1000000, i4)\n sw2 = np.empty(1000000, i4)\n p2 = 0\n\n def push2(h2, w2, dis2):\n nonlocal p2, sh2, sw2\n\n dis = 0\n a[ch + 1, cw + 1] = dis\n sh1[p1] = ch + 1\n sw1[p1] = cw + 1\n p1 += 1\n while True:\n while p1 > 0:\n p1 -= 1\n h = sh1[p1]\n w = sw1[p1]\n for i in range(-2, 3):\n for j in range(-2, 3):\n if ((i == 1 or i == -1) and j == 0) or (\n i == 0 and (j == 1 or j == -1)\n ):\n if a[h + i, w + j] > dis:\n a[h + i, w + j] = dis\n sh1[p1] = h + i\n sw1[p1] = w + j\n p1 += 1\n else:\n if a[h + i, w + j] > dis + 1:\n push2(h + i, w + j, dis + 1)\n a[h + i, w + j] = dis + 1\n sh2[p2] = h + i\n sw2[p2] = w + j\n p2 += 1\n dis += 1\n for i in range(p2):\n if a[sh2[i], sw2[i]] == dis:\n sh1[p1] = sh2[i]\n sw1[p1] = sw2[i]\n p1 += 1\n p2 = 0\n if p1 == 0:\n break\n return a\n\n\ndef main(in_file):\n stdin = open(in_file)\n H, W = [int(x) for x in stdin.readline().split()]\n ch, cw = [int(x) for x in stdin.readline().split()]\n dh, dw = [int(x) for x in stdin.readline().split()]\n s = np.frombuffer(np.array(stdin.read()), i4).reshape((H, W + 1))\n a = solve(s, ch, cw)\n ans = a[dh + 1, dw + 1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n\n\nmain(\"\/dev\/stdin\")\n","code_v1_no_empty_lines":"import numpy as np\nfrom numba import njit, int32, int64\n\ni4 = np.int32\ni8 = np.int64\nINF = 1000000000\n\n\n@njit((int32[:, :], int64, int64), cache=True)\ndef solve(s, ch, cw):\n H = s.shape[0]\n W = s.shape[1] - 1\n ah = H + 4\n aw = W + 4\n a = np.full((ah, aw), -1, i4)\n for i in range(H):\n for j in range(W):\n if s[i, j] == 46:\n a[i + 2, j + 2] = INF\n sh1 = np.empty(1000000, i4)\n sw1 = np.empty(1000000, i4)\n p1 = 0\n sh2 = np.empty(1000000, i4)\n sw2 = np.empty(1000000, i4)\n p2 = 0\n dis = 0\n a[ch + 1, cw + 1] = dis\n sh1[p1] = ch + 1\n sw1[p1] = cw + 1\n p1 += 1\n while True:\n while p1 > 0:\n p1 -= 1\n h = sh1[p1]\n w = sw1[p1]\n for i in range(-2, 3):\n for j in range(-2, 3):\n if ((i == 1 or i == -1) and j == 0) or (\n i == 0 and (j == 1 or j == -1)\n ):\n if a[h + i, w + j] > dis:\n a[h + i, w + j] = dis\n sh1[p1] = h + i\n sw1[p1] = w + j\n p1 += 1\n else:\n if a[h + i, w + j] > dis + 1:\n a[h + i, w + j] = dis + 1\n sh2[p2] = h + i\n sw2[p2] = w + j\n p2 += 1\n dis += 1\n for i in range(p2):\n if a[sh2[i], sw2[i]] == dis:\n sh1[p1] = sh2[i]\n sw1[p1] = sw2[i]\n p1 += 1\n p2 = 0\n if p1 == 0:\n break\n return a\n\n\ndef main(in_file):\n stdin = open(in_file)\n H, W = [int(x) for x in stdin.readline().split()]\n ch, cw = [int(x) for x in stdin.readline().split()]\n dh, dw = [int(x) for x in stdin.readline().split()]\n s = np.frombuffer(np.array(stdin.read()), i4).reshape((H, W + 1))\n a = solve(s, ch, cw)\n ans = a[dh + 1, dw + 1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n\n\nmain(\"\/dev\/stdin\")\n","code_same":false,"relative_loc_diff_percent":4.5977011494,"diff":["-from numba import njit","+from numba import njit, int32, int64","-@njit","+@njit((int32[:, :], int64, int64), cache=True)","-","- def push2(h2, w2, dis2):","- nonlocal p2, sh2, sw2","-","- push2(h + i, w + j, dis + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1955928278,"measured_runtime_v1":0.435398082,"runtime_lift":0.4492275825,"key":["s846954627","s522324935"]} +{"user_id":"u089230684","problem_id":"p03272","language":"python","submission_id_v0":"s508292950","submission_id_v1":"s348600515","cpu_time_v0":21,"cpu_time_v1":19,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.52,"input":"N,i=list(map(int,input().split( )))\n\ncount=0\n\n\n\nwhile N>=i:\n\n count+=1\n\n N-=1\n\n\n\n\n\nprint(count)","target":"n,i=list(map(int,input().split()))\n\nj=0\n\nfor v in range(n):\n\n j=j+1\n\n if (n-1)>= i:\n\n \n\n n=n-1\n\n\n\n else: \n\n break\n\n \n\nprint (j)\n","code_v0_loc":9,"code_v1_loc":12,"code_v0_num_chars":95,"code_v1_num_chars":155,"code_v0_no_empty_lines":"N, i = list(map(int, input().split()))\ncount = 0\nwhile N >= i:\n count += 1\n N -= 1\nprint(count)\n","code_v1_no_empty_lines":"n, i = list(map(int, input().split()))\nj = 0\nfor v in range(n):\n j = j + 1\n if (n - 1) >= i:\n n = n - 1\n else:\n break\nprint(j)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-N, i = list(map(int, input().split()))","-count = 0","-while N >= i:","- count += 1","- N -= 1","-print(count)","+n, i = list(map(int, input().split()))","+j = 0","+for v in range(n):","+ j = j + 1","+ if (n - 1) >= i:","+ n = n - 1","+ else:","+ break","+print(j)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0329396601,"measured_runtime_v1":0.0438951082,"runtime_lift":0.7504175613,"key":["s508292950","s348600515"]} +{"user_id":"u545368057","problem_id":"p02881","language":"python","submission_id_v0":"s637228514","submission_id_v1":"s473868053","cpu_time_v0":184,"cpu_time_v1":113,"memory_v0":3060,"memory_v1":3444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.59,"input":"N = int(eval(input()))\n\nsqN = int(N**0.5)+1\n\nfor i in range(sqN,0,-1):\n\n if N % i == 0:\n\n ans = i+N\/\/i\n\n break\n\n\n\nprint((ans-2))","target":"# \u7d04\u6570s\n\ndef make_divisors(n):\n\n divisors = []\n\n ret = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n ret.append((i,n\/\/i))\n\n return ret\n\n\n\nif __name__ == \"__main__\":\n\n n = int(eval(input()))\n\n ret = make_divisors(n)\n\n # print(ret)\n\n ans = 10**18\n\n for a,b in ret:\n\n ans = min(a+b, ans)\n\n print((ans-2))","code_v0_loc":8,"code_v1_loc":17,"code_v0_num_chars":137,"code_v1_num_chars":358,"code_v0_no_empty_lines":"N = int(eval(input()))\nsqN = int(N**0.5) + 1\nfor i in range(sqN, 0, -1):\n if N % i == 0:\n ans = i + N \/\/ i\n break\nprint((ans - 2))\n","code_v1_no_empty_lines":"# \u7d04\u6570s\ndef make_divisors(n):\n divisors = []\n ret = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n ret.append((i, n \/\/ i))\n return ret\n\n\nif __name__ == \"__main__\":\n n = int(eval(input()))\n ret = make_divisors(n)\n # print(ret)\n ans = 10**18\n for a, b in ret:\n ans = min(a + b, ans)\n print((ans - 2))\n","code_same":false,"relative_loc_diff_percent":52.9411764706,"diff":["-N = int(eval(input()))","-sqN = int(N**0.5) + 1","-for i in range(sqN, 0, -1):","- if N % i == 0:","- ans = i + N \/\/ i","- break","-print((ans - 2))","+# \u7d04\u6570s","+def make_divisors(n):","+ divisors = []","+ ret = []","+ for i in range(1, int(n**0.5) + 1):","+ if n % i == 0:","+ ret.append((i, n \/\/ i))","+ return ret","+","+","+if __name__ == \"__main__\":","+ n = int(eval(input()))","+ ret = make_divisors(n)","+ # print(ret)","+ ans = 10**18","+ for a, b in ret:","+ ans = min(a + b, ans)","+ print((ans - 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1192009377,"measured_runtime_v1":0.0483694043,"runtime_lift":2.464387135,"key":["s637228514","s473868053"]} +{"user_id":"u866124363","problem_id":"p02948","language":"python","submission_id_v0":"s787906846","submission_id_v1":"s397785917","cpu_time_v0":1032,"cpu_time_v1":435,"memory_v0":18496,"memory_v1":17604,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.85,"input":"import queue\n\n\n\nN, M = list(map(int, input().split()))\n\nAB = [[] for _ in range(M + 1)]\n\n\n\nfor n in range(N):\n\n a, b = list(map(int, input().split()))\n\n if a > M:\n\n continue\n\n AB[a].append(0-b)\n\n\n\nearn = 0\n\nq = queue.PriorityQueue()\n\n\n\nfor m in range(1, M + 1):\n\n\n\n for job in AB[m]:\n\n q.put(job)\n\n\n\n if not q.empty():\n\n earn += q.get()\n\n\n\nprint((0-earn))\n","target":"import heapq\n\n\n\nN, M = list(map(int, input().split()))\n\nAB = [[] for _ in range(M + 1)]\n\n\n\nfor n in range(N):\n\n a, b = list(map(int, input().split()))\n\n if a > M:\n\n continue\n\n AB[a].append(0-b)\n\n\n\nearn = 0\n\nq = []\n\n\n\nfor m in range(1, M + 1):\n\n\n\n for job in AB[m]:\n\n heapq.heappush(q, job)\n\n\n\n if q != []:\n\n earn += heapq.heappop(q)\n\n\n\nprint((0-earn))\n","code_v0_loc":23,"code_v1_loc":23,"code_v0_num_chars":378,"code_v1_num_chars":374,"code_v0_no_empty_lines":"import queue\n\nN, M = list(map(int, input().split()))\nAB = [[] for _ in range(M + 1)]\nfor n in range(N):\n a, b = list(map(int, input().split()))\n if a > M:\n continue\n AB[a].append(0 - b)\nearn = 0\nq = queue.PriorityQueue()\nfor m in range(1, M + 1):\n for job in AB[m]:\n q.put(job)\n if not q.empty():\n earn += q.get()\nprint((0 - earn))\n","code_v1_no_empty_lines":"import heapq\n\nN, M = list(map(int, input().split()))\nAB = [[] for _ in range(M + 1)]\nfor n in range(N):\n a, b = list(map(int, input().split()))\n if a > M:\n continue\n AB[a].append(0 - b)\nearn = 0\nq = []\nfor m in range(1, M + 1):\n for job in AB[m]:\n heapq.heappush(q, job)\n if q != []:\n earn += heapq.heappop(q)\nprint((0 - earn))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import queue","+import heapq","-q = queue.PriorityQueue()","+q = []","- q.put(job)","- if not q.empty():","- earn += q.get()","+ heapq.heappush(q, job)","+ if q != []:","+ earn += heapq.heappop(q)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0843071544,"measured_runtime_v1":0.079359875,"runtime_lift":1.0623398089,"key":["s787906846","s397785917"]} +{"user_id":"u437351386","problem_id":"p02862","language":"python","submission_id_v0":"s186218651","submission_id_v1":"s932446107","cpu_time_v0":853,"cpu_time_v1":768,"memory_v0":88080,"memory_v1":88068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.96,"input":"X,Y=list(map(int,input().split()))\n\n\n\nimport sys\n\nif (2*Y-X)%3!=0 or (2*X-Y)%3!=0:\n\n print((0))\n\n sys.exit()\n\nif (2*Y-X)<0 or (2*X-Y)<0:\n\n print((0))\n\n sys.exit()\n\nx=(2*Y-X)\/\/3\n\ny=(2*X-Y)\/\/3\n\n#(x+y)Cx\u3092\u6c42\u3081\u308b\n\nfac=[0 for i in range(x+y+1)]\n\ninv=[0 for i in range(x+y+1)]\n\nfinv=[0 for i in range(x+y+1)]\n\n#\u521d\u671f\u6761\u4ef6\n\np=1000000007\n\nfac[0]=fac[1]=1\n\ninv[1]=1\n\nfinv[0]=finv[1]=1\n\n#\u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210\n\nfor i in range(2,x+y+1):\n\n fac[i]=fac[i-1]*i%p\n\n #p=(p\/\/a)*a+(p%a) a^(-1)=-(p\/\/a)*(p%a)^(-1)\n\n inv[i]=(-(p\/\/i)*inv[p%i])%p\n\n finv[i]=finv[i-1]*inv[i]%p\n\n#\u6c42\u3081\u308b\n\n\n\nprint(((fac[x+y]*finv[x]%p)*finv[y]%p))\n\n\n\n\n","target":"#(i,j)\u2192\uff08i+1,j+2\uff09\u3092x\u56de\u3001(i,j)\u2192\uff08i+2,j+1\uff09\u304cy\u56de\u3042\u308b\u3068\u3059\u308b\u3068\n\n#x=(2Y-X)\/\/3,y=(2X-Y)\/\/3\u3001\u3068\u306a\u308b\n\n#\u3053\u308c\u304c\u6574\u6570or\u975e\u8ca0\u306a\u3089(x+y)Cx\u3092\u6c42\u3081\u308c\u3070\u3044\u3044\n\n\n\nX,Y=list(map(int,input().split()))\n\nimport sys\n\nif (2*Y-X)%3!=0 or (2*X-Y)%3!=0:\n\n print((0))\n\n sys.exit()\n\nif (2*Y-X)<0 or (2*X-Y)<0:\n\n print((0))\n\n sys.exit()\n\n\n\n \n\n#\u305d\u308c\u4ee5\u5916\u306a\u3089\u5b58\u5728\u3059\u308b\n\nx=(2*Y-X)\/\/3\n\ny=(2*X-Y)\/\/3\n\n#(x+y)Cx\u3092\u6c42\u3081\u308b\n\n\n\nfac=[0 for i in range(x+y+1)]\n\ninv=[0 for i in range(x+y+1)]\n\nfinv=[0 for i in range(x+y+1)]\n\n#\u521d\u671f\u6761\u4ef6\n\nfac[0]=fac[1]=1\n\ninv[1]=1\n\nfinv[0]=finv[1]=1\n\np=1000000007\n\nfor i in range(2,x+y+1):\n\n fac[i]=(fac[i-1]*i)%p\n\n #p=(p\/\/a)*a+(p%a) p\u306e\u4e16\u754c\u3067\u3000a^(-1)=-(p\/\/a)*inv[p%a]\n\n inv[i]=(-(p\/\/i)*inv[p%i])%p\n\n finv[i]=(finv[i-1]*inv[i])%p\n\n\n\nprint(((fac[x+y]*finv[x]%p)*finv[y]%p))\n\n\n","code_v0_loc":31,"code_v1_loc":35,"code_v0_num_chars":584,"code_v1_num_chars":699,"code_v0_no_empty_lines":"X, Y = list(map(int, input().split()))\nimport sys\n\nif (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0:\n print((0))\n sys.exit()\nif (2 * Y - X) < 0 or (2 * X - Y) < 0:\n print((0))\n sys.exit()\nx = (2 * Y - X) \/\/ 3\ny = (2 * X - Y) \/\/ 3\n# (x+y)Cx\u3092\u6c42\u3081\u308b\nfac = [0 for i in range(x + y + 1)]\ninv = [0 for i in range(x + y + 1)]\nfinv = [0 for i in range(x + y + 1)]\n# \u521d\u671f\u6761\u4ef6\np = 1000000007\nfac[0] = fac[1] = 1\ninv[1] = 1\nfinv[0] = finv[1] = 1\n# \u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210\nfor i in range(2, x + y + 1):\n fac[i] = fac[i - 1] * i % p\n # p=(p\/\/a)*a+(p%a) a^(-1)=-(p\/\/a)*(p%a)^(-1)\n inv[i] = (-(p \/\/ i) * inv[p % i]) % p\n finv[i] = finv[i - 1] * inv[i] % p\n# \u6c42\u3081\u308b\nprint(((fac[x + y] * finv[x] % p) * finv[y] % p))\n","code_v1_no_empty_lines":"# (i,j)\u2192\uff08i+1,j+2\uff09\u3092x\u56de\u3001(i,j)\u2192\uff08i+2,j+1\uff09\u304cy\u56de\u3042\u308b\u3068\u3059\u308b\u3068\n# x=(2Y-X)\/\/3,y=(2X-Y)\/\/3\u3001\u3068\u306a\u308b\n# \u3053\u308c\u304c\u6574\u6570or\u975e\u8ca0\u306a\u3089(x+y)Cx\u3092\u6c42\u3081\u308c\u3070\u3044\u3044\nX, Y = list(map(int, input().split()))\nimport sys\n\nif (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0:\n print((0))\n sys.exit()\nif (2 * Y - X) < 0 or (2 * X - Y) < 0:\n print((0))\n sys.exit()\n# \u305d\u308c\u4ee5\u5916\u306a\u3089\u5b58\u5728\u3059\u308b\nx = (2 * Y - X) \/\/ 3\ny = (2 * X - Y) \/\/ 3\n# (x+y)Cx\u3092\u6c42\u3081\u308b\nfac = [0 for i in range(x + y + 1)]\ninv = [0 for i in range(x + y + 1)]\nfinv = [0 for i in range(x + y + 1)]\n# \u521d\u671f\u6761\u4ef6\nfac[0] = fac[1] = 1\ninv[1] = 1\nfinv[0] = finv[1] = 1\np = 1000000007\nfor i in range(2, x + y + 1):\n fac[i] = (fac[i - 1] * i) % p\n # p=(p\/\/a)*a+(p%a) p\u306e\u4e16\u754c\u3067\u3000a^(-1)=-(p\/\/a)*inv[p%a]\n inv[i] = (-(p \/\/ i) * inv[p % i]) % p\n finv[i] = (finv[i - 1] * inv[i]) % p\nprint(((fac[x + y] * finv[x] % p) * finv[y] % p))\n","code_same":false,"relative_loc_diff_percent":11.4285714286,"diff":["+# (i,j)\u2192\uff08i+1,j+2\uff09\u3092x\u56de\u3001(i,j)\u2192\uff08i+2,j+1\uff09\u304cy\u56de\u3042\u308b\u3068\u3059\u308b\u3068","+# x=(2Y-X)\/\/3,y=(2X-Y)\/\/3\u3001\u3068\u306a\u308b","+# \u3053\u308c\u304c\u6574\u6570or\u975e\u8ca0\u306a\u3089(x+y)Cx\u3092\u6c42\u3081\u308c\u3070\u3044\u3044","+# \u305d\u308c\u4ee5\u5916\u306a\u3089\u5b58\u5728\u3059\u308b","-p = 1000000007","-# \u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210","+p = 1000000007","- fac[i] = fac[i - 1] * i % p","- # p=(p\/\/a)*a+(p%a) a^(-1)=-(p\/\/a)*(p%a)^(-1)","+ fac[i] = (fac[i - 1] * i) % p","+ # p=(p\/\/a)*a+(p%a) p\u306e\u4e16\u754c\u3067\u3000a^(-1)=-(p\/\/a)*inv[p%a]","- finv[i] = finv[i - 1] * inv[i] % p","-# \u6c42\u3081\u308b","+ finv[i] = (finv[i - 1] * inv[i]) % p"],"diff_only_import_comment":false,"measured_runtime_v0":0.3221904414,"measured_runtime_v1":0.3479983737,"runtime_lift":0.9258389282,"key":["s186218651","s932446107"]} +{"user_id":"u557792847","problem_id":"p03503","language":"python","submission_id_v0":"s584385747","submission_id_v1":"s968088142","cpu_time_v0":380,"cpu_time_v1":351,"memory_v0":12504,"memory_v1":12440,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.63,"input":"import sys\n\nimport numpy as np\n\n\n\n# N \u5e97\u306e\u6570\n\nn = int(eval(input()))\n\n\n\n# F \u5e97\u306e\u55b6\u696d\u8a08\u753b\n\nf = [input().replace(\" \", \"\") for i in range(n)]\n\n\n\n# P \u55b6\u696d\u5229\u76ca\n\np = [list(map(int, input().split())) for i in range(n)]\n\n\n\np_max = -999999999999999\n\nfor i in range(1, 1024):\n\n f_b = format(i, '010b')\n\n p_10 = 0\n\n for f_1, p_1 in zip(f, p):\n\n p_cnt = 0\n\n for j in range(10):\n\n if f_1[j] == '1' and f_b[j] == '1':\n\n p_cnt += 1\n\n p_10 += p_1[p_cnt]\n\n if p_10 > p_max:\n\n if p_10 == 0:\n\n print((str(i)))\n\n break\n\n p_max = p_10\n\n\n\nprint(p_max)","target":"import sys\n\nimport numpy as np\n\n\n\ninput = sys.stdin.readline\n\n\n\n# N \u5e97\u306e\u6570\n\nn = int(eval(input()))\n\n\n\n# F \u5e97\u306e\u55b6\u696d\u8a08\u753b\n\nf = [input().replace(\" \", \"\") for i in range(n)]\n\n\n\n# P \u55b6\u696d\u5229\u76ca\n\np = [list(map(int, input().split())) for i in range(n)]\n\n\n\n# \u5168\u3066\u306e\u6642\u9593\u5e2f\u3067\u5e97\u3092\u958b\u3051\u308b\u304b\u9589\u3081\u308b\u306e\u7d44\u5408\u305b\u3092\u8003\u3048\u308b\u3002\n\n# 2 ** 10 \u306e\u7d44\u5408\u305b\u3067\u6700\u5927\u306e\u5229\u76ca\u3068\u306a\u308b\u3082\u306e\u3092\u6c42\u3081\u308b\n\np_max = -999999999999999\n\n# 1\u65e5\u306f\u958b\u3051\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067 1\u304b\u3089\n\nfor i in range(1, 1024):\n\n # 2\u9032\u6570\u306b\u3057\u3066 1\uff1a\u5e97\u3092\u958b\u3051\u308b 0\uff1a\u5e97\u3092\u958b\u3051\u306a\u3044\n\n f_b = format(i, '010b')\n\n # 10\u500b\u306e\u6642\u9593\u5e2f\uff11\u30d1\u30bf\u30fc\u30f3\u3067\u306e\u6700\u5927\u5229\u76ca\n\n p_10 = 0\n\n for f_1, p_1 in zip(f, p):\n\n # \u5e97\uff11\u3064\u5206\u306e\u51e6\u7406\n\n # \u304a\u59c9\u3061\u3083\u3093\u306e\u5e97\u3068\u540c\u6642\u306b\u958b\u3044\u3066\u3044\u308b\u56de\u6570\n\n p_cnt = 0\n\n for j in range(10):\n\n # 10\u500b\u306e\u6642\u9593\u5e2f\u3054\u3068\u306e\u51e6\u7406\n\n if f_1[j] == '1' and f_b[j] == '1':\n\n # \u4e21\u65b9\u306e\u5e97\u304c\u958b\u3044\u3066\u3044\u308b\n\n p_cnt += 1\n\n # \u4e21\u65b9\u3067\u55b6\u696d\u3057\u3066\u3044\u308b\u56de\u6570\u3067\u306e\u5229\u76ca\n\n p_10 += p_1[p_cnt]\n\n if p_10 > p_max:\n\n # \u5229\u76ca\u304c\u5927\u304d\u3044\u306e\u3067\u5165\u308c\u66ff\u3048\n\n p_max = p_10\n\n\n\nprint(p_max)","code_v0_loc":29,"code_v1_loc":39,"code_v0_num_chars":603,"code_v1_num_chars":860,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\n# N \u5e97\u306e\u6570\nn = int(eval(input()))\n# F \u5e97\u306e\u55b6\u696d\u8a08\u753b\nf = [input().replace(\" \", \"\") for i in range(n)]\n# P \u55b6\u696d\u5229\u76ca\np = [list(map(int, input().split())) for i in range(n)]\np_max = -999999999999999\nfor i in range(1, 1024):\n f_b = format(i, \"010b\")\n p_10 = 0\n for f_1, p_1 in zip(f, p):\n p_cnt = 0\n for j in range(10):\n if f_1[j] == \"1\" and f_b[j] == \"1\":\n p_cnt += 1\n p_10 += p_1[p_cnt]\n if p_10 > p_max:\n if p_10 == 0:\n print((str(i)))\n break\n p_max = p_10\nprint(p_max)\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\ninput = sys.stdin.readline\n# N \u5e97\u306e\u6570\nn = int(eval(input()))\n# F \u5e97\u306e\u55b6\u696d\u8a08\u753b\nf = [input().replace(\" \", \"\") for i in range(n)]\n# P \u55b6\u696d\u5229\u76ca\np = [list(map(int, input().split())) for i in range(n)]\n# \u5168\u3066\u306e\u6642\u9593\u5e2f\u3067\u5e97\u3092\u958b\u3051\u308b\u304b\u9589\u3081\u308b\u306e\u7d44\u5408\u305b\u3092\u8003\u3048\u308b\u3002\n# 2 ** 10 \u306e\u7d44\u5408\u305b\u3067\u6700\u5927\u306e\u5229\u76ca\u3068\u306a\u308b\u3082\u306e\u3092\u6c42\u3081\u308b\np_max = -999999999999999\n# 1\u65e5\u306f\u958b\u3051\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067 1\u304b\u3089\nfor i in range(1, 1024):\n # 2\u9032\u6570\u306b\u3057\u3066 1\uff1a\u5e97\u3092\u958b\u3051\u308b 0\uff1a\u5e97\u3092\u958b\u3051\u306a\u3044\n f_b = format(i, \"010b\")\n # 10\u500b\u306e\u6642\u9593\u5e2f\uff11\u30d1\u30bf\u30fc\u30f3\u3067\u306e\u6700\u5927\u5229\u76ca\n p_10 = 0\n for f_1, p_1 in zip(f, p):\n # \u5e97\uff11\u3064\u5206\u306e\u51e6\u7406\n # \u304a\u59c9\u3061\u3083\u3093\u306e\u5e97\u3068\u540c\u6642\u306b\u958b\u3044\u3066\u3044\u308b\u56de\u6570\n p_cnt = 0\n for j in range(10):\n # 10\u500b\u306e\u6642\u9593\u5e2f\u3054\u3068\u306e\u51e6\u7406\n if f_1[j] == \"1\" and f_b[j] == \"1\":\n # \u4e21\u65b9\u306e\u5e97\u304c\u958b\u3044\u3066\u3044\u308b\n p_cnt += 1\n # \u4e21\u65b9\u3067\u55b6\u696d\u3057\u3066\u3044\u308b\u56de\u6570\u3067\u306e\u5229\u76ca\n p_10 += p_1[p_cnt]\n if p_10 > p_max:\n # \u5229\u76ca\u304c\u5927\u304d\u3044\u306e\u3067\u5165\u308c\u66ff\u3048\n p_max = p_10\nprint(p_max)\n","code_same":false,"relative_loc_diff_percent":25.641025641,"diff":["+input = sys.stdin.readline","+# \u5168\u3066\u306e\u6642\u9593\u5e2f\u3067\u5e97\u3092\u958b\u3051\u308b\u304b\u9589\u3081\u308b\u306e\u7d44\u5408\u305b\u3092\u8003\u3048\u308b\u3002","+# 2 ** 10 \u306e\u7d44\u5408\u305b\u3067\u6700\u5927\u306e\u5229\u76ca\u3068\u306a\u308b\u3082\u306e\u3092\u6c42\u3081\u308b","+# 1\u65e5\u306f\u958b\u3051\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067 1\u304b\u3089","+ # 2\u9032\u6570\u306b\u3057\u3066 1\uff1a\u5e97\u3092\u958b\u3051\u308b 0\uff1a\u5e97\u3092\u958b\u3051\u306a\u3044","+ # 10\u500b\u306e\u6642\u9593\u5e2f\uff11\u30d1\u30bf\u30fc\u30f3\u3067\u306e\u6700\u5927\u5229\u76ca","+ # \u5e97\uff11\u3064\u5206\u306e\u51e6\u7406","+ # \u304a\u59c9\u3061\u3083\u3093\u306e\u5e97\u3068\u540c\u6642\u306b\u958b\u3044\u3066\u3044\u308b\u56de\u6570","+ # 10\u500b\u306e\u6642\u9593\u5e2f\u3054\u3068\u306e\u51e6\u7406","+ # \u4e21\u65b9\u306e\u5e97\u304c\u958b\u3044\u3066\u3044\u308b","+ # \u4e21\u65b9\u3067\u55b6\u696d\u3057\u3066\u3044\u308b\u56de\u6570\u3067\u306e\u5229\u76ca","- if p_10 == 0:","- print((str(i)))","- break","+ # \u5229\u76ca\u304c\u5927\u304d\u3044\u306e\u3067\u5165\u308c\u66ff\u3048"],"diff_only_import_comment":false,"measured_runtime_v0":0.008434953,"measured_runtime_v1":0.0895898213,"runtime_lift":0.0941507958,"key":["s584385747","s968088142"]} +{"user_id":"u583507988","problem_id":"p03681","language":"python","submission_id_v0":"s981329830","submission_id_v1":"s697383787","cpu_time_v0":452,"cpu_time_v1":418,"memory_v0":10976,"memory_v1":10928,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.52,"input":"import math\n\nn, m = list(map(int, input().split()))\n\n\n\nif abs(n-m)>1:\n\n print((0))\n\nelif n-m==1:\n\n print((int((math.factorial(n)*math.factorial(m))%(10**9+7))))\n\nelif m-n==1:\n\n print((int((math.factorial(m)*math.factorial(n))%(10**9+7))))\n\nelif n==m:\n\n print((int((math.factorial(n)*math.factorial(m)*2)%(10**9+7))))","target":"from math import factorial\n\nn,m=list(map(int,input().split()))\n\nl=10**9+7\n\nif abs(n-m)>1:\n\n print((0))\n\n exit()\n\nif abs(n-m)==1:\n\n print(((factorial(n)*factorial(m))%l))\n\nelse:\n\n print((((factorial(n)**2)*2)%l))","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":306,"code_v1_num_chars":203,"code_v0_no_empty_lines":"import math\n\nn, m = list(map(int, input().split()))\nif abs(n - m) > 1:\n print((0))\nelif n - m == 1:\n print((int((math.factorial(n) * math.factorial(m)) % (10**9 + 7))))\nelif m - n == 1:\n print((int((math.factorial(m) * math.factorial(n)) % (10**9 + 7))))\nelif n == m:\n print((int((math.factorial(n) * math.factorial(m) * 2) % (10**9 + 7))))\n","code_v1_no_empty_lines":"from math import factorial\n\nn, m = list(map(int, input().split()))\nl = 10**9 + 7\nif abs(n - m) > 1:\n print((0))\n exit()\nif abs(n - m) == 1:\n print(((factorial(n) * factorial(m)) % l))\nelse:\n print((((factorial(n) ** 2) * 2) % l))\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-import math","+from math import factorial","+l = 10**9 + 7","-elif n - m == 1:","- print((int((math.factorial(n) * math.factorial(m)) % (10**9 + 7))))","-elif m - n == 1:","- print((int((math.factorial(m) * math.factorial(n)) % (10**9 + 7))))","-elif n == m:","- print((int((math.factorial(n) * math.factorial(m) * 2) % (10**9 + 7))))","+ exit()","+if abs(n - m) == 1:","+ print(((factorial(n) * factorial(m)) % l))","+else:","+ print((((factorial(n) ** 2) * 2) % l))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0396037102,"measured_runtime_v1":0.0402603149,"runtime_lift":0.9836910174,"key":["s981329830","s697383787"]} +{"user_id":"u141642872","problem_id":"p03814","language":"python","submission_id_v0":"s433791602","submission_id_v1":"s188641896","cpu_time_v0":48,"cpu_time_v1":36,"memory_v0":3516,"memory_v1":3516,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"# \u5165\u529b\n\ns = eval(input())\n\n\n\n# \u51e6\u7406\n\nleft_A = -1 # \u6700\u3082\u5de6\u306eA\u306e\u4f4d\u7f6e\n\nright_Z = -1 # \u6700\u3082\u53f3\u306eZ\u306e\u4f4d\u7f6e\n\n\n\nfor i in range(len(s)):\n\n # left_A < 0 => \u307e\u3060A\u3092\u898b\u3064\u3051\u3066\u3044\u306a\u3044\n\n if left_A < 0 and s[i] == \"A\":\n\n left_A = i\n\n if s[i] == \"Z\":\n\n right_Z = i\n\n\n\n# \u7b54\u3048\n\nprint((right_Z - left_A + 1))","target":"s = eval(input())\n\nleft = 0\n\nright = len(s)-1\n\nfor i in range(len(s)):\n\n if s[i] == \"A\":\n\n left = i\n\n break\n\nfor i in range(len(s)-1,0,-1):\n\n if s[i] == \"Z\":\n\n right = i\n\n break\n\nprint((right-left+1))\n","code_v0_loc":16,"code_v1_loc":12,"code_v0_num_chars":258,"code_v1_num_chars":227,"code_v0_no_empty_lines":"# \u5165\u529b\ns = eval(input())\n# \u51e6\u7406\nleft_A = -1 # \u6700\u3082\u5de6\u306eA\u306e\u4f4d\u7f6e\nright_Z = -1 # \u6700\u3082\u53f3\u306eZ\u306e\u4f4d\u7f6e\nfor i in range(len(s)):\n # left_A < 0 => \u307e\u3060A\u3092\u898b\u3064\u3051\u3066\u3044\u306a\u3044\n if left_A < 0 and s[i] == \"A\":\n left_A = i\n if s[i] == \"Z\":\n right_Z = i\n# \u7b54\u3048\nprint((right_Z - left_A + 1))\n","code_v1_no_empty_lines":"s = eval(input())\nleft = 0\nright = len(s) - 1\nfor i in range(len(s)):\n if s[i] == \"A\":\n left = i\n break\nfor i in range(len(s) - 1, 0, -1):\n if s[i] == \"Z\":\n right = i\n break\nprint((right - left + 1))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-# \u5165\u529b","-# \u51e6\u7406","-left_A = -1 # \u6700\u3082\u5de6\u306eA\u306e\u4f4d\u7f6e","-right_Z = -1 # \u6700\u3082\u53f3\u306eZ\u306e\u4f4d\u7f6e","+left = 0","+right = len(s) - 1","- # left_A < 0 => \u307e\u3060A\u3092\u898b\u3064\u3051\u3066\u3044\u306a\u3044","- if left_A < 0 and s[i] == \"A\":","- left_A = i","+ if s[i] == \"A\":","+ left = i","+ break","+for i in range(len(s) - 1, 0, -1):","- right_Z = i","-# \u7b54\u3048","-print((right_Z - left_A + 1))","+ right = i","+ break","+print((right - left + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0424109468,"measured_runtime_v1":0.0422159529,"runtime_lift":1.0046189639,"key":["s433791602","s188641896"]} +{"user_id":"u011621222","problem_id":"p02364","language":"python","submission_id_v0":"s335968870","submission_id_v1":"s873107801","cpu_time_v0":2370,"cpu_time_v1":650,"memory_v0":28552,"memory_v1":28188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.57,"input":"v,e = list(map(int, input().split()))\n\nadj = [list(map(int, input().split())) for i in range(e)]\n\nadj.sort(key = lambda x:x[2])\n\ngroup = [[i] for i in range(v)]\n\nkey = [i for i in range(v)]\n\nsum = 0\n\nfor i,j,k in adj:\n\n if key[i] != key[j]:\n\n h = key[j]\n\n group[key[i]] += group[h]\n\n sum += k\n\n for t in group[h]:\n\n key[t] = key[i]\n\n group[h] = []\n\n if len(group[key[i]]) == v:\n\n break\n\nprint(sum)\n","target":"def root(x):\n\n if par[x] == x:\n\n return x\n\n par[x] = root(par[x])\n\n return par[x]\n\n\n\ndef same(x, y):\n\n return root(x) == root(y)\n\n\n\ndef unite(x, y):\n\n x = root(x)\n\n y = root(y)\n\n par[x] = y\n\n\n\nv,e = list(map(int, input().split()))\n\nadj = [list(map(int, input().split())) for i in range(e)]\n\nadj.sort(key = lambda x:x[2])\n\npar = [i for i in range(v)]\n\nsum = 0\n\n\n\nfor i,j,k in adj:\n\n if not same(i, j):\n\n sum += k\n\n unite(i, j)\n\nprint(sum)\n","code_v0_loc":17,"code_v1_loc":25,"code_v0_num_chars":459,"code_v1_num_chars":477,"code_v0_no_empty_lines":"v, e = list(map(int, input().split()))\nadj = [list(map(int, input().split())) for i in range(e)]\nadj.sort(key=lambda x: x[2])\ngroup = [[i] for i in range(v)]\nkey = [i for i in range(v)]\nsum = 0\nfor i, j, k in adj:\n if key[i] != key[j]:\n h = key[j]\n group[key[i]] += group[h]\n sum += k\n for t in group[h]:\n key[t] = key[i]\n group[h] = []\n if len(group[key[i]]) == v:\n break\nprint(sum)\n","code_v1_no_empty_lines":"def root(x):\n if par[x] == x:\n return x\n par[x] = root(par[x])\n return par[x]\n\n\ndef same(x, y):\n return root(x) == root(y)\n\n\ndef unite(x, y):\n x = root(x)\n y = root(y)\n par[x] = y\n\n\nv, e = list(map(int, input().split()))\nadj = [list(map(int, input().split())) for i in range(e)]\nadj.sort(key=lambda x: x[2])\npar = [i for i in range(v)]\nsum = 0\nfor i, j, k in adj:\n if not same(i, j):\n sum += k\n unite(i, j)\nprint(sum)\n","code_same":false,"relative_loc_diff_percent":32.0,"diff":["+def root(x):","+ if par[x] == x:","+ return x","+ par[x] = root(par[x])","+ return par[x]","+","+","+def same(x, y):","+ return root(x) == root(y)","+","+","+def unite(x, y):","+ x = root(x)","+ y = root(y)","+ par[x] = y","+","+","-group = [[i] for i in range(v)]","-key = [i for i in range(v)]","+par = [i for i in range(v)]","- if key[i] != key[j]:","- h = key[j]","- group[key[i]] += group[h]","+ if not same(i, j):","- for t in group[h]:","- key[t] = key[i]","- group[h] = []","- if len(group[key[i]]) == v:","- break","+ unite(i, j)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0458858019,"measured_runtime_v1":0.0806876988,"runtime_lift":0.5686839824,"key":["s335968870","s873107801"]} +{"user_id":"u102461423","problem_id":"p02599","language":"python","submission_id_v0":"s088411903","submission_id_v1":"s701561192","cpu_time_v0":1369,"cpu_time_v1":1016,"memory_v0":102256,"memory_v1":193016,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.79,"input":"import sys\n\nimport numpy as np\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nBsize = 1333\n\n\n\ndef Mo_argsort(LR):\n\n L = LR[:, 0]\n\n R = LR[:, 1]\n\n key1 = L \/\/ Bsize\n\n key2 = np.where(key1 & 1, -R, R)\n\n key = (key1 << 32) + key2\n\n return np.argsort(key)\n\n\n\ndef main(A, LR):\n\n N = len(A)\n\n Q = len(LR)\n\n ind = Mo_argsort(LR)\n\n count = np.zeros(N + 1, np.int64)\n\n ans = 0\n\n\n\n def add(x):\n\n nonlocal ans\n\n if not count[x]:\n\n ans += 1\n\n count[x] += 1\n\n\n\n def rem(x):\n\n nonlocal ans\n\n count[x] -= 1\n\n if not count[x]:\n\n ans -= 1\n\n\n\n answers = np.empty(Q, np.int64)\n\n nl, nr = 0, 0\n\n for i in ind:\n\n l, r = LR[i]\n\n l -= 1\n\n # \u533a\u9593 [l, r) \u306b\u5bfe\u3059\u308b\u8a08\u7b97\n\n while nl > l:\n\n nl -= 1\n\n add(A[nl])\n\n while nr < r:\n\n add(A[nr])\n\n nr += 1\n\n while nl < l:\n\n rem(A[nl])\n\n nl += 1\n\n while nr > r:\n\n nr -= 1\n\n rem(A[nr])\n\n # \u7b54\u3092\u6c42\u3081\u3066 ans[i] \u306b\u683c\u7d0d\u3059\u308b\n\n answers[i] = ans\n\n return answers\n\n\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n import numba\n\n from numba.pycc import CC\n\n i4 = numba.int32\n\n i8 = numba.int64\n\n cc = CC('my_module')\n\n\n\n def cc_export(f, signature):\n\n cc.export(f.__name__, signature)(f)\n\n return numba.njit(f)\n\n\n\n Mo_argsort = cc_export(Mo_argsort, (i8[:,:],))\n\n main = cc_export(main, (i8[:], i8[:, :]))\n\n cc.compile()\n\n\n\nfrom my_module import main\n\n\n\nN, Q = list(map(int, readline().split()))\n\nA = np.array(readline().split(), np.int64)\n\nLR = np.array(read().split(), np.int64).reshape(Q, 2)\n\n\n\nans = main(A, LR)\n\nprint(('\\n'.join(map(str, ans.tolist()))))\n","target":"import sys\n\nimport numpy as np\n\nimport numba\n\nfrom numba import njit\n\nfrom numba.types import Omitted\n\ni4 = numba.int32\n\ni8 = numba.int64\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n@njit((i8[:], i8), cache=True)\n\ndef get_sum(bit, i):\n\n s = 0\n\n while i:\n\n s += bit[i]\n\n i -= i & -i\n\n return s\n\n\n\n\n\n@njit((i8[:], i8, i8), cache=True)\n\ndef add(bit, i, x):\n\n while i < len(bit):\n\n bit[i] += x\n\n i += i & -i\n\n\n\n@njit((i8[:], i8[:]), cache=True)\n\ndef main(A, LR):\n\n N = len(A)\n\n L, R = LR[::2], LR[1::2]\n\n Q = len(L)\n\n query_order = np.argsort(R)\n\n L, R = L[query_order], R[query_order]\n\n ind = np.searchsorted(R, np.arange(N + 2))\n\n right_end = np.zeros(N + 1, np.int64)\n\n bit = np.zeros(N + 1, np.int64)\n\n answers = np.empty(Q, np.int64)\n\n for r in range(1, N + 1):\n\n a = A[r - 1]\n\n p = right_end[a]\n\n if p:\n\n add(bit, p, -1)\n\n right_end[a] = r\n\n add(bit, r, 1)\n\n for i in range(ind[r], ind[r + 1]):\n\n l, r, i = L[i], R[i], query_order[i]\n\n answers[i] = get_sum(bit, r) - get_sum(bit, l - 1)\n\n return answers\n\n\n\nN, Q = list(map(int, readline().split()))\n\nA = np.array(readline().split(), np.int64)\n\nLR = np.array(read().split(), np.int64)\n\n\n\nans = main(A, LR)\n\nprint(('\\n'.join(map(str, ans.tolist()))))","code_v0_loc":81,"code_v1_loc":56,"code_v0_num_chars":1801,"code_v1_num_chars":1409,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nBsize = 1333\n\n\ndef Mo_argsort(LR):\n L = LR[:, 0]\n R = LR[:, 1]\n key1 = L \/\/ Bsize\n key2 = np.where(key1 & 1, -R, R)\n key = (key1 << 32) + key2\n return np.argsort(key)\n\n\ndef main(A, LR):\n N = len(A)\n Q = len(LR)\n ind = Mo_argsort(LR)\n count = np.zeros(N + 1, np.int64)\n ans = 0\n\n def add(x):\n nonlocal ans\n if not count[x]:\n ans += 1\n count[x] += 1\n\n def rem(x):\n nonlocal ans\n count[x] -= 1\n if not count[x]:\n ans -= 1\n\n answers = np.empty(Q, np.int64)\n nl, nr = 0, 0\n for i in ind:\n l, r = LR[i]\n l -= 1\n # \u533a\u9593 [l, r) \u306b\u5bfe\u3059\u308b\u8a08\u7b97\n while nl > l:\n nl -= 1\n add(A[nl])\n while nr < r:\n add(A[nr])\n nr += 1\n while nl < l:\n rem(A[nl])\n nl += 1\n while nr > r:\n nr -= 1\n rem(A[nr])\n # \u7b54\u3092\u6c42\u3081\u3066 ans[i] \u306b\u683c\u7d0d\u3059\u308b\n answers[i] = ans\n return answers\n\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n import numba\n from numba.pycc import CC\n\n i4 = numba.int32\n i8 = numba.int64\n cc = CC(\"my_module\")\n\n def cc_export(f, signature):\n cc.export(f.__name__, signature)(f)\n return numba.njit(f)\n\n Mo_argsort = cc_export(Mo_argsort, (i8[:, :],))\n main = cc_export(main, (i8[:], i8[:, :]))\n cc.compile()\nfrom my_module import main\n\nN, Q = list(map(int, readline().split()))\nA = np.array(readline().split(), np.int64)\nLR = np.array(read().split(), np.int64).reshape(Q, 2)\nans = main(A, LR)\nprint((\"\\n\".join(map(str, ans.tolist()))))\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\nimport numba\nfrom numba import njit\nfrom numba.types import Omitted\n\ni4 = numba.int32\ni8 = numba.int64\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\n@njit((i8[:], i8), cache=True)\ndef get_sum(bit, i):\n s = 0\n while i:\n s += bit[i]\n i -= i & -i\n return s\n\n\n@njit((i8[:], i8, i8), cache=True)\ndef add(bit, i, x):\n while i < len(bit):\n bit[i] += x\n i += i & -i\n\n\n@njit((i8[:], i8[:]), cache=True)\ndef main(A, LR):\n N = len(A)\n L, R = LR[::2], LR[1::2]\n Q = len(L)\n query_order = np.argsort(R)\n L, R = L[query_order], R[query_order]\n ind = np.searchsorted(R, np.arange(N + 2))\n right_end = np.zeros(N + 1, np.int64)\n bit = np.zeros(N + 1, np.int64)\n answers = np.empty(Q, np.int64)\n for r in range(1, N + 1):\n a = A[r - 1]\n p = right_end[a]\n if p:\n add(bit, p, -1)\n right_end[a] = r\n add(bit, r, 1)\n for i in range(ind[r], ind[r + 1]):\n l, r, i = L[i], R[i], query_order[i]\n answers[i] = get_sum(bit, r) - get_sum(bit, l - 1)\n return answers\n\n\nN, Q = list(map(int, readline().split()))\nA = np.array(readline().split(), np.int64)\nLR = np.array(read().split(), np.int64)\nans = main(A, LR)\nprint((\"\\n\".join(map(str, ans.tolist()))))\n","code_same":false,"relative_loc_diff_percent":30.8641975309,"diff":["+import numba","+from numba import njit","+from numba.types import Omitted","+i4 = numba.int32","+i8 = numba.int64","-Bsize = 1333","-def Mo_argsort(LR):","- L = LR[:, 0]","- R = LR[:, 1]","- key1 = L \/\/ Bsize","- key2 = np.where(key1 & 1, -R, R)","- key = (key1 << 32) + key2","- return np.argsort(key)","+@njit((i8[:], i8), cache=True)","+def get_sum(bit, i):","+ s = 0","+ while i:","+ s += bit[i]","+ i -= i & -i","+ return s","+@njit((i8[:], i8, i8), cache=True)","+def add(bit, i, x):","+ while i < len(bit):","+ bit[i] += x","+ i += i & -i","+","+","+@njit((i8[:], i8[:]), cache=True)","- Q = len(LR)","- ind = Mo_argsort(LR)","- count = np.zeros(N + 1, np.int64)","- ans = 0","-","- def add(x):","- nonlocal ans","- if not count[x]:","- ans += 1","- count[x] += 1","-","- def rem(x):","- nonlocal ans","- count[x] -= 1","- if not count[x]:","- ans -= 1","-","+ L, R = LR[::2], LR[1::2]","+ Q = len(L)","+ query_order = np.argsort(R)","+ L, R = L[query_order], R[query_order]","+ ind = np.searchsorted(R, np.arange(N + 2))","+ right_end = np.zeros(N + 1, np.int64)","+ bit = np.zeros(N + 1, np.int64)","- nl, nr = 0, 0","- for i in ind:","- l, r = LR[i]","- l -= 1","- # \u533a\u9593 [l, r) \u306b\u5bfe\u3059\u308b\u8a08\u7b97","- while nl > l:","- nl -= 1","- add(A[nl])","- while nr < r:","- add(A[nr])","- nr += 1","- while nl < l:","- rem(A[nl])","- nl += 1","- while nr > r:","- nr -= 1","- rem(A[nr])","- # \u7b54\u3092\u6c42\u3081\u3066 ans[i] \u306b\u683c\u7d0d\u3059\u308b","- answers[i] = ans","+ for r in range(1, N + 1):","+ a = A[r - 1]","+ p = right_end[a]","+ if p:","+ add(bit, p, -1)","+ right_end[a] = r","+ add(bit, r, 1)","+ for i in range(ind[r], ind[r + 1]):","+ l, r, i = L[i], R[i], query_order[i]","+ answers[i] = get_sum(bit, r) - get_sum(bit, l - 1)","-if sys.argv[-1] == \"ONLINE_JUDGE\":","- import numba","- from numba.pycc import CC","-","- i4 = numba.int32","- i8 = numba.int64","- cc = CC(\"my_module\")","-","- def cc_export(f, signature):","- cc.export(f.__name__, signature)(f)","- return numba.njit(f)","-","- Mo_argsort = cc_export(Mo_argsort, (i8[:, :],))","- main = cc_export(main, (i8[:], i8[:, :]))","- cc.compile()","-from my_module import main","-","-LR = np.array(read().split(), np.int64).reshape(Q, 2)","+LR = np.array(read().split(), np.int64)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2272176232,"measured_runtime_v1":0.2952003117,"runtime_lift":0.7697065829,"key":["s088411903","s701561192"]} +{"user_id":"u371763408","problem_id":"p03111","language":"python","submission_id_v0":"s505596756","submission_id_v1":"s271644574","cpu_time_v0":340,"cpu_time_v1":68,"memory_v0":3064,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.0,"input":"import itertools\n\nn,a,b,c=(list(map(int,input().split())))\n\nl=[int(eval(input())) for i in range(n)]\n\nans=10**9\n\nfor k in itertools.product(list(range(4)),repeat=n):\n\n A=[[] for i in range(4)]\n\n for i in range(n):\n\n A[k[i]]+=[l[i]]\n\n if A[1] and A[2] and A[3]:\n\n tmp=10*(n-len(A[0])-3)\n\n tmp+=abs(a-sum(A[1]))\n\n tmp+=abs(b-sum(A[2]))\n\n tmp+=abs(c-sum(A[3]))\n\n ans=min(tmp,ans)\n\nprint(ans)","target":"N,A,B,C=list(map(int,input().split()))\n\nl=[int(eval(input())) for i in range(N)]\n\ninf=10**9\n\ndef dfs(cur,a,b,c):\n\n if cur==N:\n\n return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else inf\n\n ret0 = dfs(cur+1,a,b,c)\n\n ret1 = dfs(cur+1,a+l[cur],b,c)+10\n\n ret2 = dfs(cur+1,a,b+l[cur],c)+10\n\n ret3 = dfs(cur+1,a,b,c+l[cur])+10\n\n return min(ret0,ret1,ret2,ret3)\n\nprint((dfs(0,0,0,0)))","code_v0_loc":15,"code_v1_loc":12,"code_v0_num_chars":421,"code_v1_num_chars":375,"code_v0_no_empty_lines":"import itertools\n\nn, a, b, c = list(map(int, input().split()))\nl = [int(eval(input())) for i in range(n)]\nans = 10**9\nfor k in itertools.product(list(range(4)), repeat=n):\n A = [[] for i in range(4)]\n for i in range(n):\n A[k[i]] += [l[i]]\n if A[1] and A[2] and A[3]:\n tmp = 10 * (n - len(A[0]) - 3)\n tmp += abs(a - sum(A[1]))\n tmp += abs(b - sum(A[2]))\n tmp += abs(c - sum(A[3]))\n ans = min(tmp, ans)\nprint(ans)\n","code_v1_no_empty_lines":"N, A, B, C = list(map(int, input().split()))\nl = [int(eval(input())) for i in range(N)]\ninf = 10**9\n\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else inf\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n ret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n return min(ret0, ret1, ret2, ret3)\n\n\nprint((dfs(0, 0, 0, 0)))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import itertools","+N, A, B, C = list(map(int, input().split()))","+l = [int(eval(input())) for i in range(N)]","+inf = 10**9","-n, a, b, c = list(map(int, input().split()))","-l = [int(eval(input())) for i in range(n)]","-ans = 10**9","-for k in itertools.product(list(range(4)), repeat=n):","- A = [[] for i in range(4)]","- for i in range(n):","- A[k[i]] += [l[i]]","- if A[1] and A[2] and A[3]:","- tmp = 10 * (n - len(A[0]) - 3)","- tmp += abs(a - sum(A[1]))","- tmp += abs(b - sum(A[2]))","- tmp += abs(c - sum(A[3]))","- ans = min(tmp, ans)","-print(ans)","+","+def dfs(cur, a, b, c):","+ if cur == N:","+ return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else inf","+ ret0 = dfs(cur + 1, a, b, c)","+ ret1 = dfs(cur + 1, a + l[cur], b, c) + 10","+ ret2 = dfs(cur + 1, a, b + l[cur], c) + 10","+ ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10","+ return min(ret0, ret1, ret2, ret3)","+","+","+print((dfs(0, 0, 0, 0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2310550499,"measured_runtime_v1":0.0076507256,"runtime_lift":30.2004099455,"key":["s505596756","s271644574"]} +{"user_id":"u440161695","problem_id":"p03128","language":"python","submission_id_v0":"s664939279","submission_id_v1":"s806372580","cpu_time_v0":132,"cpu_time_v1":83,"memory_v0":28120,"memory_v1":3356,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.12,"input":"# \u89e3\u8aac\u653e\u9001\u306e\uff11\u3064\u3081\n\nN,M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nf = [-1, 2,5,5,4,5,6,3,7,6] # 1-indexed\n\n\n\n# dp[i]: \u30de\u30c3\u30c1i\u672c\u6570\u3067\u4f5c\u308c\u308b\u6700\u5927\u306e\u6570(str)\n\ndp = [None]*(N+1)\n\ndp[0] = \"\"\n\n\n\n# str\u306e\u6570\u306e\u5927\u304d\u3044\u307b\u3046\n\ndef max_str(s1:str, s2:str)->str:\n\n \"\"\"return bigger one\"\"\"\n\n l1, l2 = len(s1), len(s2)\n\n if l1 != l2:\n\n return s1 if l1>l2 else s2\n\n if l1 == l2: \n\n return s1 if s1>s2 else s2\n\n \n\nfor i in range(2, N+1):\n\n nxt = \"\"\n\n for aj in A:\n\n # \u914d\u5217\u5916\u53c2\u7167\u3068\uff0ci\u672c\u3061\u3087\u3046\u3069\u3067\u4f5c\u308c\u306a\u3044\u3082\u306e\u306f\u3060\u3081\n\n if i-f[aj]<0 or dp[i-f[aj]]==None: continue\n\n nxt = max_str(nxt, \n\n dp[i-f[aj]]+str(aj))\n\n if nxt!=\"\":\n\n dp[i] = nxt\n\n #print(dp)\n\nprint((dp[N]))\n","target":"# dp\u306b\u6700\u5927\u6841\u6570\u3092\u6301\u305f\u305b\u308b\n\nN,M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nA.sort(reverse=True)\n\nf = [-1, 2,5,5,4,5,6,3,7,6] # 1-indexed\n\n\n\n# dp[i]: \u30de\u30c3\u30c1i\u672c\u6570\u3067\u4f5c\u308c\u308b\u6700\u5927\u306e\u6841\u6570(int)\n\ndp = [-float('inf')]*(N+1)\n\ndp[0] = 0\n\nfor i in range(N+1):\n\n nxt = dp[i]\n\n for aj in A:\n\n if i-f[aj]<0: continue\n\n nxt = max(nxt, \n\n dp[i-f[aj]] + 1)\n\n dp[i] = nxt\n\n #print(dp)\n\n#print(dp[N])\n\nketa = dp[N]\n\nans = \"\"\n\nmatchs = N\n\n# \u4e0a\u4f4d\u306e\u6841\u304b\u3089\u8caa\u6b32\u306b\n\nwhile keta>0:\n\n for aj in A:\n\n if matchs-f[aj] < 0: continue\n\n if dp[matchs-f[aj]] == keta-1:\n\n ans += str(aj)\n\n matchs -= f[aj]\n\n keta -= 1\n\n break\n\nprint(ans)\n","code_v0_loc":29,"code_v1_loc":31,"code_v0_num_chars":698,"code_v1_num_chars":690,"code_v0_no_empty_lines":"# \u89e3\u8aac\u653e\u9001\u306e\uff11\u3064\u3081\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nf = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6] # 1-indexed\n# dp[i]: \u30de\u30c3\u30c1i\u672c\u6570\u3067\u4f5c\u308c\u308b\u6700\u5927\u306e\u6570(str)\ndp = [None] * (N + 1)\ndp[0] = \"\"\n# str\u306e\u6570\u306e\u5927\u304d\u3044\u307b\u3046\ndef max_str(s1: str, s2: str) -> str:\n \"\"\"return bigger one\"\"\"\n l1, l2 = len(s1), len(s2)\n if l1 != l2:\n return s1 if l1 > l2 else s2\n if l1 == l2:\n return s1 if s1 > s2 else s2\n\n\nfor i in range(2, N + 1):\n nxt = \"\"\n for aj in A:\n # \u914d\u5217\u5916\u53c2\u7167\u3068\uff0ci\u672c\u3061\u3087\u3046\u3069\u3067\u4f5c\u308c\u306a\u3044\u3082\u306e\u306f\u3060\u3081\n if i - f[aj] < 0 or dp[i - f[aj]] == None:\n continue\n nxt = max_str(nxt, dp[i - f[aj]] + str(aj))\n if nxt != \"\":\n dp[i] = nxt\n # print(dp)\nprint((dp[N]))\n","code_v1_no_empty_lines":"# dp\u306b\u6700\u5927\u6841\u6570\u3092\u6301\u305f\u305b\u308b\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nA.sort(reverse=True)\nf = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6] # 1-indexed\n# dp[i]: \u30de\u30c3\u30c1i\u672c\u6570\u3067\u4f5c\u308c\u308b\u6700\u5927\u306e\u6841\u6570(int)\ndp = [-float(\"inf\")] * (N + 1)\ndp[0] = 0\nfor i in range(N + 1):\n nxt = dp[i]\n for aj in A:\n if i - f[aj] < 0:\n continue\n nxt = max(nxt, dp[i - f[aj]] + 1)\n dp[i] = nxt\n # print(dp)\n# print(dp[N])\nketa = dp[N]\nans = \"\"\nmatchs = N\n# \u4e0a\u4f4d\u306e\u6841\u304b\u3089\u8caa\u6b32\u306b\nwhile keta > 0:\n for aj in A:\n if matchs - f[aj] < 0:\n continue\n if dp[matchs - f[aj]] == keta - 1:\n ans += str(aj)\n matchs -= f[aj]\n keta -= 1\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.4516129032,"diff":["-# \u89e3\u8aac\u653e\u9001\u306e\uff11\u3064\u3081","+# dp\u306b\u6700\u5927\u6841\u6570\u3092\u6301\u305f\u305b\u308b","+A.sort(reverse=True)","-# dp[i]: \u30de\u30c3\u30c1i\u672c\u6570\u3067\u4f5c\u308c\u308b\u6700\u5927\u306e\u6570(str)","-dp = [None] * (N + 1)","-dp[0] = \"\"","-# str\u306e\u6570\u306e\u5927\u304d\u3044\u307b\u3046","-def max_str(s1: str, s2: str) -> str:","- \"\"\"return bigger one\"\"\"","- l1, l2 = len(s1), len(s2)","- if l1 != l2:","- return s1 if l1 > l2 else s2","- if l1 == l2:","- return s1 if s1 > s2 else s2","-","-","-for i in range(2, N + 1):","- nxt = \"\"","+# dp[i]: \u30de\u30c3\u30c1i\u672c\u6570\u3067\u4f5c\u308c\u308b\u6700\u5927\u306e\u6841\u6570(int)","+dp = [-float(\"inf\")] * (N + 1)","+dp[0] = 0","+for i in range(N + 1):","+ nxt = dp[i]","- # \u914d\u5217\u5916\u53c2\u7167\u3068\uff0ci\u672c\u3061\u3087\u3046\u3069\u3067\u4f5c\u308c\u306a\u3044\u3082\u306e\u306f\u3060\u3081","- if i - f[aj] < 0 or dp[i - f[aj]] == None:","+ if i - f[aj] < 0:","- nxt = max_str(nxt, dp[i - f[aj]] + str(aj))","- if nxt != \"\":","- dp[i] = nxt","+ nxt = max(nxt, dp[i - f[aj]] + 1)","+ dp[i] = nxt","-print((dp[N]))","+# print(dp[N])","+keta = dp[N]","+ans = \"\"","+matchs = N","+# \u4e0a\u4f4d\u306e\u6841\u304b\u3089\u8caa\u6b32\u306b","+while keta > 0:","+ for aj in A:","+ if matchs - f[aj] < 0:","+ continue","+ if dp[matchs - f[aj]] == keta - 1:","+ ans += str(aj)","+ matchs -= f[aj]","+ keta -= 1","+ break","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.097689199,"measured_runtime_v1":0.0377573848,"runtime_lift":2.587287216,"key":["s664939279","s806372580"]} +{"user_id":"u371763408","problem_id":"p03290","language":"python","submission_id_v0":"s565290988","submission_id_v1":"s361627579","cpu_time_v0":176,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.77,"input":"import sys\n\ninput=sys.stdin.readline\n\nd,g=list(map(int,input().split()))\n\nls=[list(map(int,input().split())) for i in range(d)]\n\nP=list([x[0] for x in ls])\n\nC=list([x[1] for x in ls])\n\n\n\ntmp=10**9\n\nfor i in range(1<>j)&1:\n\n total+=C[j]+P[j]*100*(j+1)\n\n num+=P[j]\n\n if total>=g:\n\n tmp=min(num,tmp)\n\n else:\n\n for j in range(d-1,-1,-1):\n\n if (i>>j)&1:\n\n continue\n\n for k in range(P[j]):\n\n if total>=g:\n\n break\n\n total+=100*(j+1)\n\n num+=1\n\n tmp=min(tmp,num)\n\nprint(tmp)","target":"d,g=list(map(int,input().split()))\n\nPC=[list(map(int,input().split())) for i in range(d)]\n\nP=list([x[0] for x in PC])\n\nC=list([x[1] for x in PC])\n\nans=10**9\n\ndef dfs(cur,target):\n\n if cur==0:\n\n return 10**9\n\n cnt=min(target\/\/(cur*100),P[cur-1]) #P[j]\u306e\u4e00\u90e8\u3092\u5229\u7528\u3059\u308b\/\u5168\u90e8\u5229\u7528\u306e\u3069\u3061\u3089\u304b\u5c0f\u3055\u3044\u65b9\u9078\u629e\n\n tmp=(100*cur)*cnt\n\n if cnt==P[cur-1]:\n\n tmp+=C[cur-1]\n\n if tmp> j) & 1:\n total += C[j] + P[j] * 100 * (j + 1)\n num += P[j]\n if total >= g:\n tmp = min(num, tmp)\n else:\n for j in range(d - 1, -1, -1):\n if (i >> j) & 1:\n continue\n for k in range(P[j]):\n if total >= g:\n break\n total += 100 * (j + 1)\n num += 1\n tmp = min(tmp, num)\nprint(tmp)\n","code_v1_no_empty_lines":"d, g = list(map(int, input().split()))\nPC = [list(map(int, input().split())) for i in range(d)]\nP = list([x[0] for x in PC])\nC = list([x[1] for x in PC])\nans = 10**9\n\n\ndef dfs(cur, target):\n if cur == 0:\n return 10**9\n cnt = min(target \/\/ (cur * 100), P[cur - 1]) # P[j]\u306e\u4e00\u90e8\u3092\u5229\u7528\u3059\u308b\/\u5168\u90e8\u5229\u7528\u306e\u3069\u3061\u3089\u304b\u5c0f\u3055\u3044\u65b9\u9078\u629e\n tmp = (100 * cur) * cnt\n if cnt == P[cur - 1]:\n tmp += C[cur - 1]\n if tmp < target:\n cnt += dfs(cur - 1, target - tmp) # \u6e1b\u3089\u3057\u305f\u5024\u3067dfs\u5b9f\u884c\n return min(cnt, dfs(cur - 1, target))\n\n\nprint((dfs(d, g)))\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-import sys","+d, g = list(map(int, input().split()))","+PC = [list(map(int, input().split())) for i in range(d)]","+P = list([x[0] for x in PC])","+C = list([x[1] for x in PC])","+ans = 10**9","-input = sys.stdin.readline","-d, g = list(map(int, input().split()))","-ls = [list(map(int, input().split())) for i in range(d)]","-P = list([x[0] for x in ls])","-C = list([x[1] for x in ls])","-tmp = 10**9","-for i in range(1 << d):","- total = 0","- num = 0","- for j in range(d):","- if (i >> j) & 1:","- total += C[j] + P[j] * 100 * (j + 1)","- num += P[j]","- if total >= g:","- tmp = min(num, tmp)","- else:","- for j in range(d - 1, -1, -1):","- if (i >> j) & 1:","- continue","- for k in range(P[j]):","- if total >= g:","- break","- total += 100 * (j + 1)","- num += 1","- tmp = min(tmp, num)","-print(tmp)","+","+def dfs(cur, target):","+ if cur == 0:","+ return 10**9","+ cnt = min(target \/\/ (cur * 100), P[cur - 1]) # P[j]\u306e\u4e00\u90e8\u3092\u5229\u7528\u3059\u308b\/\u5168\u90e8\u5229\u7528\u306e\u3069\u3061\u3089\u304b\u5c0f\u3055\u3044\u65b9\u9078\u629e","+ tmp = (100 * cur) * cnt","+ if cnt == P[cur - 1]:","+ tmp += C[cur - 1]","+ if tmp < target:","+ cnt += dfs(cur - 1, target - tmp) # \u6e1b\u3089\u3057\u305f\u5024\u3067dfs\u5b9f\u884c","+ return min(cnt, dfs(cur - 1, target))","+","+","+print((dfs(d, g)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0394362154,"measured_runtime_v1":0.0380495548,"runtime_lift":1.0364435424,"key":["s565290988","s361627579"]} +{"user_id":"u627234757","problem_id":"p02989","language":"python","submission_id_v0":"s160573788","submission_id_v1":"s278970892","cpu_time_v0":75,"cpu_time_v1":67,"memory_v0":14428,"memory_v1":20708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.67,"input":"N = int(eval(input()))\n\nd = list(map(int, input().split()))\n\nd.sort()\n\nharf_N = int(N\/2)\n\nprint((d[harf_N] - d[harf_N - 1]))","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\n#print(n)\n\na.sort()\n\n#print(a)\n\nprint((a[int(n\/2)]-a[int(n\/2)-1]))","code_v0_loc":5,"code_v1_loc":6,"code_v0_num_chars":116,"code_v1_num_chars":119,"code_v0_no_empty_lines":"N = int(eval(input()))\nd = list(map(int, input().split()))\nd.sort()\nharf_N = int(N \/ 2)\nprint((d[harf_N] - d[harf_N - 1]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\n# print(n)\na.sort()\n# print(a)\nprint((a[int(n \/ 2)] - a[int(n \/ 2) - 1]))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-N = int(eval(input()))","-d = list(map(int, input().split()))","-d.sort()","-harf_N = int(N \/ 2)","-print((d[harf_N] - d[harf_N - 1]))","+n = int(eval(input()))","+a = list(map(int, input().split()))","+# print(n)","+a.sort()","+# print(a)","+print((a[int(n \/ 2)] - a[int(n \/ 2) - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0441916959,"measured_runtime_v1":0.0450437596,"runtime_lift":0.9810836468,"key":["s160573788","s278970892"]} +{"user_id":"u020390084","problem_id":"p03078","language":"python","submission_id_v0":"s161603891","submission_id_v1":"s489602205","cpu_time_v0":759,"cpu_time_v1":34,"memory_v0":133992,"memory_v1":5108,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.52,"input":"#!\/usr\/bin\/env python3\n\nimport sys\n\n\n\n\n\ndef solve(X: int, Y: int, Z: int, K: int, A: \"List[int]\", B: \"List[int]\", C: \"List[int]\"):\n\n AB = []\n\n\n\n for i in range(X):\n\n for j in range(Y):\n\n AB.append(A[i]+B[j])\n\n AB.sort(reverse=True)\n\n AB = AB[:K]\n\n\n\n ABC = []\n\n for k in range(Z):\n\n for ab_index in range(len(AB)):\n\n ABC.append(C[k]+AB[ab_index])\n\n\n\n ABC.sort(reverse=True)\n\n ABC = ABC[:K]\n\n for i in range(len(ABC)):\n\n print((ABC[i]))\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n Z = int(next(tokens)) # type: int\n\n K = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(X)] # type: \"List[int]\"\n\n B = [int(next(tokens)) for _ in range(Y)] # type: \"List[int]\"\n\n C = [int(next(tokens)) for _ in range(Z)] # type: \"List[int]\"\n\n solve(X, Y, Z, K, A, B, C)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\nimport heapq\n\n\n\ndef solve(X: int, Y: int, Z: int, K: int, A: \"List[int]\", B: \"List[int]\", C: \"List[int]\"):\n\n A = sorted(A,reverse = True)\n\n B = sorted(B,reverse = True)\n\n C = sorted(C,reverse = True)\n\n\n\n d = []\n\n heapq.heappush(d, (-(A[0]+B[0]+C[0]), 0, 0, 0)) # heapq\u306b\u30bf\u30d7\u30eb\u3092\u4e0e\u3048\u308b\u3068\u6700\u521d\u306e\u8981\u7d20\u3067\u30bd\u30fc\u30c8\u3059\u308b\n\n ijk_set = set((0,0,0))\n\n\n\n for _ in range(K):\n\n tmp, i, j, k = heapq.heappop(d)\n\n print((-tmp))\n\n if (i+1,j,k) not in ijk_set and i+1 <= X-1:\n\n heapq.heappush(d, (-(A[i+1]+B[j]+C[k]), i+1, j, k))\n\n ijk_set.add((i+1,j,k))\n\n if (i,j+1,k) not in ijk_set and j+1 <= Y-1:\n\n heapq.heappush(d, (-(A[i]+B[j+1]+C[k]), i, j+1, k))\n\n ijk_set.add((i,j+1,k))\n\n if (i,j,k+1) not in ijk_set and k+1 <= Z-1:\n\n heapq.heappush(d, (-(A[i]+B[j]+C[k+1]), i, j, k+1))\n\n ijk_set.add((i,j,k+1))\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n X = int(next(tokens)) # type: int\n\n Y = int(next(tokens)) # type: int\n\n Z = int(next(tokens)) # type: int\n\n K = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(X)] # type: \"List[int]\"\n\n B = [int(next(tokens)) for _ in range(Y)] # type: \"List[int]\"\n\n C = [int(next(tokens)) for _ in range(Z)] # type: \"List[int]\"\n\n solve(X, Y, Z, K, A, B, C)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":42,"code_v1_loc":45,"code_v0_num_chars":1127,"code_v1_num_chars":1542,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\n\ndef solve(\n X: int, Y: int, Z: int, K: int, A: \"List[int]\", B: \"List[int]\", C: \"List[int]\"\n):\n AB = []\n for i in range(X):\n for j in range(Y):\n AB.append(A[i] + B[j])\n AB.sort(reverse=True)\n AB = AB[:K]\n ABC = []\n for k in range(Z):\n for ab_index in range(len(AB)):\n ABC.append(C[k] + AB[ab_index])\n ABC.sort(reverse=True)\n ABC = ABC[:K]\n for i in range(len(ABC)):\n print((ABC[i]))\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n X = int(next(tokens)) # type: int\n Y = int(next(tokens)) # type: int\n Z = int(next(tokens)) # type: int\n K = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(X)] # type: \"List[int]\"\n B = [int(next(tokens)) for _ in range(Y)] # type: \"List[int]\"\n C = [int(next(tokens)) for _ in range(Z)] # type: \"List[int]\"\n solve(X, Y, Z, K, A, B, C)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nimport heapq\n\n\ndef solve(\n X: int, Y: int, Z: int, K: int, A: \"List[int]\", B: \"List[int]\", C: \"List[int]\"\n):\n A = sorted(A, reverse=True)\n B = sorted(B, reverse=True)\n C = sorted(C, reverse=True)\n d = []\n heapq.heappush(d, (-(A[0] + B[0] + C[0]), 0, 0, 0)) # heapq\u306b\u30bf\u30d7\u30eb\u3092\u4e0e\u3048\u308b\u3068\u6700\u521d\u306e\u8981\u7d20\u3067\u30bd\u30fc\u30c8\u3059\u308b\n ijk_set = set((0, 0, 0))\n for _ in range(K):\n tmp, i, j, k = heapq.heappop(d)\n print((-tmp))\n if (i + 1, j, k) not in ijk_set and i + 1 <= X - 1:\n heapq.heappush(d, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k))\n ijk_set.add((i + 1, j, k))\n if (i, j + 1, k) not in ijk_set and j + 1 <= Y - 1:\n heapq.heappush(d, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k))\n ijk_set.add((i, j + 1, k))\n if (i, j, k + 1) not in ijk_set and k + 1 <= Z - 1:\n heapq.heappush(d, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1))\n ijk_set.add((i, j, k + 1))\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n X = int(next(tokens)) # type: int\n Y = int(next(tokens)) # type: int\n Z = int(next(tokens)) # type: int\n K = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(X)] # type: \"List[int]\"\n B = [int(next(tokens)) for _ in range(Y)] # type: \"List[int]\"\n C = [int(next(tokens)) for _ in range(Z)] # type: \"List[int]\"\n solve(X, Y, Z, K, A, B, C)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["+import heapq","- AB = []","- for i in range(X):","- for j in range(Y):","- AB.append(A[i] + B[j])","- AB.sort(reverse=True)","- AB = AB[:K]","- ABC = []","- for k in range(Z):","- for ab_index in range(len(AB)):","- ABC.append(C[k] + AB[ab_index])","- ABC.sort(reverse=True)","- ABC = ABC[:K]","- for i in range(len(ABC)):","- print((ABC[i]))","+ A = sorted(A, reverse=True)","+ B = sorted(B, reverse=True)","+ C = sorted(C, reverse=True)","+ d = []","+ heapq.heappush(d, (-(A[0] + B[0] + C[0]), 0, 0, 0)) # heapq\u306b\u30bf\u30d7\u30eb\u3092\u4e0e\u3048\u308b\u3068\u6700\u521d\u306e\u8981\u7d20\u3067\u30bd\u30fc\u30c8\u3059\u308b","+ ijk_set = set((0, 0, 0))","+ for _ in range(K):","+ tmp, i, j, k = heapq.heappop(d)","+ print((-tmp))","+ if (i + 1, j, k) not in ijk_set and i + 1 <= X - 1:","+ heapq.heappush(d, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k))","+ ijk_set.add((i + 1, j, k))","+ if (i, j + 1, k) not in ijk_set and j + 1 <= Y - 1:","+ heapq.heappush(d, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k))","+ ijk_set.add((i, j + 1, k))","+ if (i, j, k + 1) not in ijk_set and k + 1 <= Z - 1:","+ heapq.heappush(d, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1))","+ ijk_set.add((i, j, k + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0804722073,"measured_runtime_v1":0.034874126,"runtime_lift":2.3075046349,"key":["s161603891","s489602205"]} +{"user_id":"u893063840","problem_id":"p02955","language":"python","submission_id_v0":"s365889385","submission_id_v1":"s823547848","cpu_time_v0":419,"cpu_time_v1":277,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.89,"input":"from math import sqrt\n\nfrom itertools import accumulate\n\n\n\n\n\ndef common_divisors(x):\n\n ret = []\n\n for i in range(1, int(sqrt(x)) + 1):\n\n if x % i == 0:\n\n ret.append(i)\n\n ret.append(x \/\/ i)\n\n\n\n return ret\n\n\n\n\n\nn, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\nsm = sum(a)\n\ncd = common_divisors(sm)\n\n\n\nans = 1\n\nfor ecd in cd:\n\n r = [e % ecd for e in a]\n\n r.sort()\n\n acc = [0] + list(accumulate(r))\n\n for i in range(1, n + 1):\n\n sub = acc[i-1]\n\n add = ecd * (n - i + 1) - (acc[n] - acc[i-1])\n\n if sub == add:\n\n if sub <= k:\n\n ans = max(ans, ecd)\n\n\n\nprint(ans)\n","target":"from math import sqrt\n\nfrom itertools import accumulate\n\n\n\n\n\ndef common_divisors(x):\n\n ret = []\n\n for i in range(1, int(sqrt(x)) + 1):\n\n if x % i == 0:\n\n ret.append(i)\n\n ret.append(x \/\/ i)\n\n\n\n return ret\n\n\n\n\n\nn, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\nsm = sum(a)\n\ncd = common_divisors(sm)\n\n\n\nans = 1\n\nfor ecd in cd:\n\n r = [e % ecd for e in a]\n\n r.sort()\n\n sub = [0] + list(accumulate(r))\n\n add = [0] + list(accumulate(ecd - e for e in r[::-1]))\n\n add = add[::-1]\n\n for sb, ad in zip(sub, add):\n\n if sb == ad and sb <= k:\n\n ans = max(ans, ecd)\n\n\n\nprint(ans)\n","code_v0_loc":33,"code_v1_loc":32,"code_v0_num_chars":677,"code_v1_num_chars":662,"code_v0_no_empty_lines":"from math import sqrt\nfrom itertools import accumulate\n\n\ndef common_divisors(x):\n ret = []\n for i in range(1, int(sqrt(x)) + 1):\n if x % i == 0:\n ret.append(i)\n ret.append(x \/\/ i)\n return ret\n\n\nn, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nsm = sum(a)\ncd = common_divisors(sm)\nans = 1\nfor ecd in cd:\n r = [e % ecd for e in a]\n r.sort()\n acc = [0] + list(accumulate(r))\n for i in range(1, n + 1):\n sub = acc[i - 1]\n add = ecd * (n - i + 1) - (acc[n] - acc[i - 1])\n if sub == add:\n if sub <= k:\n ans = max(ans, ecd)\nprint(ans)\n","code_v1_no_empty_lines":"from math import sqrt\nfrom itertools import accumulate\n\n\ndef common_divisors(x):\n ret = []\n for i in range(1, int(sqrt(x)) + 1):\n if x % i == 0:\n ret.append(i)\n ret.append(x \/\/ i)\n return ret\n\n\nn, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nsm = sum(a)\ncd = common_divisors(sm)\nans = 1\nfor ecd in cd:\n r = [e % ecd for e in a]\n r.sort()\n sub = [0] + list(accumulate(r))\n add = [0] + list(accumulate(ecd - e for e in r[::-1]))\n add = add[::-1]\n for sb, ad in zip(sub, add):\n if sb == ad and sb <= k:\n ans = max(ans, ecd)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":3.0303030303,"diff":["- acc = [0] + list(accumulate(r))","- for i in range(1, n + 1):","- sub = acc[i - 1]","- add = ecd * (n - i + 1) - (acc[n] - acc[i - 1])","- if sub == add:","- if sub <= k:","- ans = max(ans, ecd)","+ sub = [0] + list(accumulate(r))","+ add = [0] + list(accumulate(ecd - e for e in r[::-1]))","+ add = add[::-1]","+ for sb, ad in zip(sub, add):","+ if sb == ad and sb <= k:","+ ans = max(ans, ecd)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0423248072,"measured_runtime_v1":0.0419651091,"runtime_lift":1.0085713597,"key":["s365889385","s823547848"]} +{"user_id":"u078042885","problem_id":"p02397","language":"python","submission_id_v0":"s400642849","submission_id_v1":"s533052185","cpu_time_v0":60,"cpu_time_v1":50,"memory_v0":7676,"memory_v1":7684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"while 1:\n\n x,y=map(int,input().split())\n\n if not x+y:break\n\n print(*[y,x] if x>y else [x,y])\n","target":"while 1:\n\n x,y=list(map(int,input().split()))\n\n if not x+y:break\n\n if x>y:x,y=y,x\n\n print((x,y))","code_v0_loc":4,"code_v1_loc":5,"code_v0_num_chars":101,"code_v1_num_chars":100,"code_v0_no_empty_lines":"while 1:\n x, y = map(int, input().split())\n if not x + y:\n break\n print(*[y, x] if x > y else [x, y])\n","code_v1_no_empty_lines":"while 1:\n x, y = list(map(int, input().split()))\n if not x + y:\n break\n if x > y:\n x, y = y, x\n print((x, y))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["- x, y = map(int, input().split())","+ x, y = list(map(int, input().split()))","- print(*[y, x] if x > y else [x, y])","+ if x > y:","+ x, y = y, x","+ print((x, y))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0404830406,"measured_runtime_v1":0.0995881062,"runtime_lift":0.4065047738,"key":["s400642849","s533052185"]} +{"user_id":"u514687406","problem_id":"p02658","language":"python","submission_id_v0":"s564668441","submission_id_v1":"s898920158","cpu_time_v0":104,"cpu_time_v1":50,"memory_v0":82580,"memory_v1":22684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.92,"input":"\"\"\"\n\n~~ Author : Bhaskar\n\n~~ Dated : 31~05~2020\n\n\"\"\"\n\n\n\nimport sys\n\nfrom bisect import *\n\nfrom math import floor,sqrt,ceil,factorial as F,gcd,pi\n\nfrom itertools import chain,combinations,permutations,accumulate\n\nfrom collections import Counter,defaultdict,OrderedDict,deque\n\nfrom array import array\n\nINT_MAX = sys.maxsize\n\nINT_MIN = -(sys.maxsize)-1\n\nmod = 10**18\n\nlcm = lambda a,b : (a*b)\/\/gcd(a,b)\n\nsetbit = lambda x : bin(x)[2:].count(\"1\")\n\n\n\ndef solve():\n\n n = int(sys.stdin.readline())\n\n a = list(map(int,sys.stdin.readline().split()))\n\n ans = 1\n\n flag = False\n\n for i in a:\n\n ans *= i\n\n # print(ans)\n\n if ans > mod:\n\n flag = True\n\n break\n\n if 0 in a:\n\n print((0))\n\n else:\n\n if not flag:\n\n print(ans)\n\n else:\n\n print((-1))\n\n\n\nif __name__ == \"__main__\":\n\n solve()\n","target":"\"\"\"\n\n~~ Author : Bhaskar\n\n~~ Dated : 13~06~2020\n\n\"\"\"\n\n\n\nimport sys\n\nfrom bisect import *\n\nfrom math import floor, sqrt, ceil, factorial as F, gcd, pi\n\nfrom itertools import chain, combinations, permutations, accumulate\n\nfrom collections import Counter, defaultdict, OrderedDict, deque\n\n\n\nINT_MAX = sys.maxsize\n\nINT_MIN = -(sys.maxsize) - 1\n\nmod = 1000000007\n\nch = \"abcdefghijklmnopqrstuvwxyz\"\n\nlcm = lambda a, b: (a * b) \/\/ gcd(a, b)\n\nsetbit = lambda x: bin(x)[2:].count(\"1\")\n\nINT = lambda type: type(sys.stdin.readline()) if type in [int, float] else type(sys.stdin.readline()).replace(\"\\n\", \"\")\n\nARRAY = lambda type: list(map(type, sys.stdin.readline().split()))\n\nNUMS = lambda type: list(map(type, sys.stdin.readline().split()))\n\n\n\n\n\ndef solve():\n\n\n\n n = INT(int)\n\n a = ARRAY(int)\n\n if 0 in a:\n\n print((0))\n\n else:\n\n p = 1\n\n ok = False\n\n for i in a:\n\n p *= i\n\n if p > 10**18:\n\n ok = True\n\n break\n\n print((p if not ok else -1))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n # try:\n\n # sys.stdin = open(\"input.txt\", \"r\")\n\n # except:\n\n # pass\n\n solve()\n","code_v0_loc":38,"code_v1_loc":46,"code_v0_num_chars":875,"code_v1_num_chars":1155,"code_v0_no_empty_lines":"\"\"\"\n~~ Author : Bhaskar\n~~ Dated : 31~05~2020\n\"\"\"\nimport sys\nfrom bisect import *\nfrom math import floor, sqrt, ceil, factorial as F, gcd, pi\nfrom itertools import chain, combinations, permutations, accumulate\nfrom collections import Counter, defaultdict, OrderedDict, deque\nfrom array import array\n\nINT_MAX = sys.maxsize\nINT_MIN = -(sys.maxsize) - 1\nmod = 10**18\nlcm = lambda a, b: (a * b) \/\/ gcd(a, b)\nsetbit = lambda x: bin(x)[2:].count(\"1\")\n\n\ndef solve():\n n = int(sys.stdin.readline())\n a = list(map(int, sys.stdin.readline().split()))\n ans = 1\n flag = False\n for i in a:\n ans *= i\n # print(ans)\n if ans > mod:\n flag = True\n break\n if 0 in a:\n print((0))\n else:\n if not flag:\n print(ans)\n else:\n print((-1))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"\"\"\"\n~~ Author : Bhaskar\n~~ Dated : 13~06~2020\n\"\"\"\nimport sys\nfrom bisect import *\nfrom math import floor, sqrt, ceil, factorial as F, gcd, pi\nfrom itertools import chain, combinations, permutations, accumulate\nfrom collections import Counter, defaultdict, OrderedDict, deque\n\nINT_MAX = sys.maxsize\nINT_MIN = -(sys.maxsize) - 1\nmod = 1000000007\nch = \"abcdefghijklmnopqrstuvwxyz\"\nlcm = lambda a, b: (a * b) \/\/ gcd(a, b)\nsetbit = lambda x: bin(x)[2:].count(\"1\")\nINT = (\n lambda type: type(sys.stdin.readline())\n if type in [int, float]\n else type(sys.stdin.readline()).replace(\"\\n\", \"\")\n)\nARRAY = lambda type: list(map(type, sys.stdin.readline().split()))\nNUMS = lambda type: list(map(type, sys.stdin.readline().split()))\n\n\ndef solve():\n n = INT(int)\n a = ARRAY(int)\n if 0 in a:\n print((0))\n else:\n p = 1\n ok = False\n for i in a:\n p *= i\n if p > 10**18:\n ok = True\n break\n print((p if not ok else -1))\n\n\nif __name__ == \"__main__\":\n # try:\n # sys.stdin = open(\"input.txt\", \"r\")\n # except:\n # pass\n solve()\n","code_same":false,"relative_loc_diff_percent":17.3913043478,"diff":["-~~ Dated : 31~05~2020","+~~ Dated : 13~06~2020","-from array import array","-mod = 10**18","+mod = 1000000007","+ch = \"abcdefghijklmnopqrstuvwxyz\"","+INT = (","+ lambda type: type(sys.stdin.readline())","+ if type in [int, float]","+ else type(sys.stdin.readline()).replace(\"\\n\", \"\")","+)","+ARRAY = lambda type: list(map(type, sys.stdin.readline().split()))","+NUMS = lambda type: list(map(type, sys.stdin.readline().split()))","- n = int(sys.stdin.readline())","- a = list(map(int, sys.stdin.readline().split()))","- ans = 1","- flag = False","- for i in a:","- ans *= i","- # print(ans)","- if ans > mod:","- flag = True","- break","+ n = INT(int)","+ a = ARRAY(int)","- if not flag:","- print(ans)","- else:","- print((-1))","+ p = 1","+ ok = False","+ for i in a:","+ p *= i","+ if p > 10**18:","+ ok = True","+ break","+ print((p if not ok else -1))","+ # try:","+ # sys.stdin = open(\"input.txt\", \"r\")","+ # except:","+ # pass"],"diff_only_import_comment":false,"measured_runtime_v0":0.1169898424,"measured_runtime_v1":0.040774811,"runtime_lift":2.8691694562,"key":["s564668441","s898920158"]} +{"user_id":"u989345508","problem_id":"p03426","language":"python","submission_id_v0":"s374236533","submission_id_v1":"s099855422","cpu_time_v0":1270,"cpu_time_v1":1158,"memory_v0":35664,"memory_v1":35692,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.82,"input":"h,w,d=list(map(int,input().split()))\n\na=[list(map(int,input().split())) for i in range(h)]\n\n\n\ndef find_element(k):\n\n global h,w,a\n\n for i in range(h):\n\n for j in range(w):\n\n if a[i][j]==k:\n\n return (i,j)\n\n\n\ndef make_distance(S,T):\n\n return abs(S[0]-T[0])+abs(S[1]-T[1])\n\n\n\nx1=[]\n\nx2=[]\n\nfor i in range(1,d+1):\n\n l=(h*w-i)\/\/d\n\n x1.append([0]*(l+1))\n\n x2.append([[0,0]for i in range(l+1)])\n\n\n\nfor i in range(h):\n\n for j in range(w):\n\n p=a[i][j]%d\n\n if p==0:\n\n p=d-1\n\n else:\n\n p-=1\n\n l=(a[i][j]-(p+1))\/\/d\n\n x2[p][l]=[i,j]\n\n\n\n\n\nfor i in range(1,d+1):\n\n l=len(x1[i-1])\n\n for j in range(l-1):\n\n x1[i-1][j+1]=x1[i-1][j]+make_distance(x2[i-1][j],x2[i-1][j+1])\n\n\n\nq=int(eval(input()))\n\nfor i in range(q):\n\n l,r=list(map(int,input().split()))\n\n p=l%d\n\n if p==0:\n\n v1=l\/\/d-1\n\n v2=r\/\/d-1\n\n print((x1[d-1][v2]-x1[d-1][v1]))\n\n else:\n\n v1=l\/\/d\n\n v2=r\/\/d\n\n print((x1[p-1][v2]-x1[p-1][v1]))\n\n#print(x)\n","target":"from math import ceil\n\nh,w,d=list(map(int,input().split()))\n\nx=ceil((h*w)\/d)\n\nnum=[[[-1,-1] for j in range(x)] for i in range(d)]#\u3042\u307e\u308a\u3067\u5834\u5408\u5206\u3051(1\u21920)\n\nmp=[[0]*x for i in range(d)]\n\na=[list(map(int,input().split())) for i in range(h)]\n\nfor i in range(h):\n\n for j in range(w):\n\n k,l=a[i][j]%d,a[i][j]\/\/d\n\n if k==0:\n\n num[d-1][l-1]=[i,j]\n\n else:\n\n num[k-1][l]=[i,j]\n\nfor i in range(d):\n\n for j in range(x):\n\n if j!=x-1:\n\n if num[i][j+1]!=[-1,-1]:\n\n mp[i][j+1]+=(mp[i][j]+abs(num[i][j+1][0]-num[i][j][0])+abs(num[i][j+1][1]-num[i][j][1]))\n\n else:\n\n break\n\nq=int(eval(input()))\n\nfor i in range(q):\n\n l,r=list(map(int,input().split()))\n\n if l%d!=0:\n\n e,f=l\/\/d,r\/\/d\n\n else:\n\n e,f=l\/\/d-1,r\/\/d-1\n\n g= d-1 if l%d==0 else l%d-1\n\n if e==0:\n\n print((mp[g][f]))\n\n else:\n\n print((mp[g][f]-mp[g][e]))\n","code_v0_loc":49,"code_v1_loc":32,"code_v0_num_chars":1041,"code_v1_num_chars":911,"code_v0_no_empty_lines":"h, w, d = list(map(int, input().split()))\na = [list(map(int, input().split())) for i in range(h)]\n\n\ndef find_element(k):\n global h, w, a\n for i in range(h):\n for j in range(w):\n if a[i][j] == k:\n return (i, j)\n\n\ndef make_distance(S, T):\n return abs(S[0] - T[0]) + abs(S[1] - T[1])\n\n\nx1 = []\nx2 = []\nfor i in range(1, d + 1):\n l = (h * w - i) \/\/ d\n x1.append([0] * (l + 1))\n x2.append([[0, 0] for i in range(l + 1)])\nfor i in range(h):\n for j in range(w):\n p = a[i][j] % d\n if p == 0:\n p = d - 1\n else:\n p -= 1\n l = (a[i][j] - (p + 1)) \/\/ d\n x2[p][l] = [i, j]\nfor i in range(1, d + 1):\n l = len(x1[i - 1])\n for j in range(l - 1):\n x1[i - 1][j + 1] = x1[i - 1][j] + make_distance(x2[i - 1][j], x2[i - 1][j + 1])\nq = int(eval(input()))\nfor i in range(q):\n l, r = list(map(int, input().split()))\n p = l % d\n if p == 0:\n v1 = l \/\/ d - 1\n v2 = r \/\/ d - 1\n print((x1[d - 1][v2] - x1[d - 1][v1]))\n else:\n v1 = l \/\/ d\n v2 = r \/\/ d\n print((x1[p - 1][v2] - x1[p - 1][v1]))\n# print(x)\n","code_v1_no_empty_lines":"from math import ceil\n\nh, w, d = list(map(int, input().split()))\nx = ceil((h * w) \/ d)\nnum = [[[-1, -1] for j in range(x)] for i in range(d)] # \u3042\u307e\u308a\u3067\u5834\u5408\u5206\u3051(1\u21920)\nmp = [[0] * x for i in range(d)]\na = [list(map(int, input().split())) for i in range(h)]\nfor i in range(h):\n for j in range(w):\n k, l = a[i][j] % d, a[i][j] \/\/ d\n if k == 0:\n num[d - 1][l - 1] = [i, j]\n else:\n num[k - 1][l] = [i, j]\nfor i in range(d):\n for j in range(x):\n if j != x - 1:\n if num[i][j + 1] != [-1, -1]:\n mp[i][j + 1] += (\n mp[i][j]\n + abs(num[i][j + 1][0] - num[i][j][0])\n + abs(num[i][j + 1][1] - num[i][j][1])\n )\n else:\n break\nq = int(eval(input()))\nfor i in range(q):\n l, r = list(map(int, input().split()))\n if l % d != 0:\n e, f = l \/\/ d, r \/\/ d\n else:\n e, f = l \/\/ d - 1, r \/\/ d - 1\n g = d - 1 if l % d == 0 else l % d - 1\n if e == 0:\n print((mp[g][f]))\n else:\n print((mp[g][f] - mp[g][e]))\n","code_same":false,"relative_loc_diff_percent":34.693877551,"diff":["+from math import ceil","+","+x = ceil((h * w) \/ d)","+num = [[[-1, -1] for j in range(x)] for i in range(d)] # \u3042\u307e\u308a\u3067\u5834\u5408\u5206\u3051(1\u21920)","+mp = [[0] * x for i in range(d)]","-","-","-def find_element(k):","- global h, w, a","- for i in range(h):","- for j in range(w):","- if a[i][j] == k:","- return (i, j)","-","-","-def make_distance(S, T):","- return abs(S[0] - T[0]) + abs(S[1] - T[1])","-","-","-x1 = []","-x2 = []","-for i in range(1, d + 1):","- l = (h * w - i) \/\/ d","- x1.append([0] * (l + 1))","- x2.append([[0, 0] for i in range(l + 1)])","- p = a[i][j] % d","- if p == 0:","- p = d - 1","+ k, l = a[i][j] % d, a[i][j] \/\/ d","+ if k == 0:","+ num[d - 1][l - 1] = [i, j]","- p -= 1","- l = (a[i][j] - (p + 1)) \/\/ d","- x2[p][l] = [i, j]","-for i in range(1, d + 1):","- l = len(x1[i - 1])","- for j in range(l - 1):","- x1[i - 1][j + 1] = x1[i - 1][j] + make_distance(x2[i - 1][j], x2[i - 1][j + 1])","+ num[k - 1][l] = [i, j]","+for i in range(d):","+ for j in range(x):","+ if j != x - 1:","+ if num[i][j + 1] != [-1, -1]:","+ mp[i][j + 1] += (","+ mp[i][j]","+ + abs(num[i][j + 1][0] - num[i][j][0])","+ + abs(num[i][j + 1][1] - num[i][j][1])","+ )","+ else:","+ break","- p = l % d","- if p == 0:","- v1 = l \/\/ d - 1","- v2 = r \/\/ d - 1","- print((x1[d - 1][v2] - x1[d - 1][v1]))","+ if l % d != 0:","+ e, f = l \/\/ d, r \/\/ d","- v1 = l \/\/ d","- v2 = r \/\/ d","- print((x1[p - 1][v2] - x1[p - 1][v1]))","-# print(x)","+ e, f = l \/\/ d - 1, r \/\/ d - 1","+ g = d - 1 if l % d == 0 else l % d - 1","+ if e == 0:","+ print((mp[g][f]))","+ else:","+ print((mp[g][f] - mp[g][e]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0406139019,"measured_runtime_v1":0.0953706641,"runtime_lift":0.4258531932,"key":["s374236533","s099855422"]} +{"user_id":"u591808161","problem_id":"p02554","language":"python","submission_id_v0":"s673208476","submission_id_v1":"s763718025","cpu_time_v0":1062,"cpu_time_v1":88,"memory_v0":97116,"memory_v1":68056,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.71,"input":"import sys\n\nimport math\n\nfrom collections import defaultdict, deque, Counter\n\nfrom copy import deepcopy\n\nfrom bisect import bisect, bisect_right, bisect_left\n\nfrom heapq import heapify, heappop, heappush\n\n \n\ninput = sys.stdin.readline\n\ndef RD(): return input().rstrip()\n\ndef F(): return float(input().rstrip())\n\ndef I(): return int(input().rstrip())\n\ndef MI(): return list(map(int, input().split()))\n\ndef MF(): return list(map(float,input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\ndef TI(): return tuple(map(int, input().split()))\n\ndef LF(): return list(map(float,input().split()))\n\ndef Init(H, W, num): return [[num for i in range(W)] for j in range(H)]\n\n \n\n\n\n#\u4e57\u6cd5\u306emod\u9006\u5143\n\ndef modinv(a, mod=10**9+7):\n\n return pow(a, mod-2, mod)\n\n\n\n# nCr mod m\n\n# modinv\u304c\u5fc5\u8981\n\n# r\u304cn\/2\u306b\u8fd1\u3044\u3068\u975e\u5e38\u306b\u91cd\u304f\u306a\u308b\n\ndef combination(n, r, mod=10**9+7):\n\n r = min(r, n-r)\n\n res = 1\n\n for i in range(r):\n\n res = res * (n - i) * modinv(i+1, mod) % mod\n\n return res\n\n\n\n\n\n#\u3079\u304d\u4e57\n\ndef Raise(x, y, mod=10**9+7):\n\n # x\u3092y\u4e57\u3059\u308b\u3002\n\n n = 0\n\n while True:\n\n if (1< y:\n\n break\n\n n+=1\n\n D = [0]*(n+1)\n\n x = x % mod\n\n D[0] = x\n\n index = 0\n\n for index in range(1,n):\n\n D[index] = (D[index-1]**2)\n\n res = 1\n\n index = 0\n\n for index in range(0, n):\n\n if (y>>index)&1 == 1:\n\n res *= D[index]\n\n return res\n\n\n\n\n\ndef main():\n\n #\u7b54\u3048\u306f 10^2 - 2*9^2 + 8^2\n\n n = I()\n\n res = Raise(10, n)- 2 * Raise(9, n) + Raise(8, n)\n\n print((res % (10**9+7)))\n\n \n\nif __name__ == \"__main__\":\n\n main()","target":"import sys\n\nimport math\n\nfrom collections import defaultdict, deque, Counter\n\nfrom copy import deepcopy\n\nfrom bisect import bisect, bisect_right, bisect_left\n\nfrom heapq import heapify, heappop, heappush\n\n \n\ninput = sys.stdin.readline\n\ndef RD(): return input().rstrip()\n\ndef F(): return float(input().rstrip())\n\ndef I(): return int(input().rstrip())\n\ndef MI(): return list(map(int, input().split()))\n\ndef MF(): return list(map(float,input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\ndef TI(): return tuple(map(int, input().split()))\n\ndef LF(): return list(map(float,input().split()))\n\ndef Init(H, W, num): return [[num for i in range(W)] for j in range(H)]\n\n \n\n\n\n#\u4e57\u6cd5\u306emod\u9006\u5143\n\ndef modinv(a, mod=10**9+7):\n\n return pow(a, mod-2, mod)\n\n\n\n# nCr mod m\n\n# modinv\u304c\u5fc5\u8981\n\n# r\u304cn\/2\u306b\u8fd1\u3044\u3068\u975e\u5e38\u306b\u91cd\u304f\u306a\u308b\n\ndef combination(n, r, mod=10**9+7):\n\n r = min(r, n-r)\n\n res = 1\n\n for i in range(r):\n\n res = res * (n - i) * modinv(i+1, mod) % mod\n\n return res\n\n\n\n\n\n#\u3079\u304d\u4e57\n\ndef Raise(x, y):\n\n # x\u3092y\u4e57\u3059\u308b\u3002\n\n n = 0\n\n while True:\n\n if (1< y:\n\n break\n\n n+=1\n\n D = [0]*(n+1)\n\n D[0] = x\n\n index = 0\n\n for index in range(1,n):\n\n D[index] = (D[index-1]**2)\n\n res = 1\n\n index = 0\n\n for index in range(0, n):\n\n if (y>>index)&1 == 1:\n\n res *= D[index]\n\n return res\n\n\n\n\n\ndef main():\n\n #\u7b54\u3048\u306f 10^2 - 2*9^2 + 8^2\n\n n = I()\n\n mod=10**9+7\n\n res = pow(10, n, mod)- 2 * pow(9, n, mod) + pow(8, n, mod)\n\n print((res % (10**9+7)))\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":64,"code_v1_loc":64,"code_v0_num_chars":1553,"code_v1_num_chars":1545,"code_v0_no_empty_lines":"import sys\nimport math\nfrom collections import defaultdict, deque, Counter\nfrom copy import deepcopy\nfrom bisect import bisect, bisect_right, bisect_left\nfrom heapq import heapify, heappop, heappush\n\ninput = sys.stdin.readline\n\n\ndef RD():\n return input().rstrip()\n\n\ndef F():\n return float(input().rstrip())\n\n\ndef I():\n return int(input().rstrip())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MF():\n return list(map(float, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef TI():\n return tuple(map(int, input().split()))\n\n\ndef LF():\n return list(map(float, input().split()))\n\n\ndef Init(H, W, num):\n return [[num for i in range(W)] for j in range(H)]\n\n\n# \u4e57\u6cd5\u306emod\u9006\u5143\ndef modinv(a, mod=10**9 + 7):\n return pow(a, mod - 2, mod)\n\n\n# nCr mod m\n# modinv\u304c\u5fc5\u8981\n# r\u304cn\/2\u306b\u8fd1\u3044\u3068\u975e\u5e38\u306b\u91cd\u304f\u306a\u308b\ndef combination(n, r, mod=10**9 + 7):\n r = min(r, n - r)\n res = 1\n for i in range(r):\n res = res * (n - i) * modinv(i + 1, mod) % mod\n return res\n\n\n# \u3079\u304d\u4e57\ndef Raise(x, y, mod=10**9 + 7):\n # x\u3092y\u4e57\u3059\u308b\u3002\n n = 0\n while True:\n if (1 << n) > y:\n break\n n += 1\n D = [0] * (n + 1)\n x = x % mod\n D[0] = x\n index = 0\n for index in range(1, n):\n D[index] = D[index - 1] ** 2\n res = 1\n index = 0\n for index in range(0, n):\n if (y >> index) & 1 == 1:\n res *= D[index]\n return res\n\n\ndef main():\n # \u7b54\u3048\u306f 10^2 - 2*9^2 + 8^2\n n = I()\n res = Raise(10, n) - 2 * Raise(9, n) + Raise(8, n)\n print((res % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport math\nfrom collections import defaultdict, deque, Counter\nfrom copy import deepcopy\nfrom bisect import bisect, bisect_right, bisect_left\nfrom heapq import heapify, heappop, heappush\n\ninput = sys.stdin.readline\n\n\ndef RD():\n return input().rstrip()\n\n\ndef F():\n return float(input().rstrip())\n\n\ndef I():\n return int(input().rstrip())\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MF():\n return list(map(float, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef TI():\n return tuple(map(int, input().split()))\n\n\ndef LF():\n return list(map(float, input().split()))\n\n\ndef Init(H, W, num):\n return [[num for i in range(W)] for j in range(H)]\n\n\n# \u4e57\u6cd5\u306emod\u9006\u5143\ndef modinv(a, mod=10**9 + 7):\n return pow(a, mod - 2, mod)\n\n\n# nCr mod m\n# modinv\u304c\u5fc5\u8981\n# r\u304cn\/2\u306b\u8fd1\u3044\u3068\u975e\u5e38\u306b\u91cd\u304f\u306a\u308b\ndef combination(n, r, mod=10**9 + 7):\n r = min(r, n - r)\n res = 1\n for i in range(r):\n res = res * (n - i) * modinv(i + 1, mod) % mod\n return res\n\n\n# \u3079\u304d\u4e57\ndef Raise(x, y):\n # x\u3092y\u4e57\u3059\u308b\u3002\n n = 0\n while True:\n if (1 << n) > y:\n break\n n += 1\n D = [0] * (n + 1)\n D[0] = x\n index = 0\n for index in range(1, n):\n D[index] = D[index - 1] ** 2\n res = 1\n index = 0\n for index in range(0, n):\n if (y >> index) & 1 == 1:\n res *= D[index]\n return res\n\n\ndef main():\n # \u7b54\u3048\u306f 10^2 - 2*9^2 + 8^2\n n = I()\n mod = 10**9 + 7\n res = pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)\n print((res % (10**9 + 7)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-def Raise(x, y, mod=10**9 + 7):","+def Raise(x, y):","- x = x % mod","- res = Raise(10, n) - 2 * Raise(9, n) + Raise(8, n)","+ mod = 10**9 + 7","+ res = pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5956982961,"measured_runtime_v1":0.0376368437,"runtime_lift":15.8275306228,"key":["s673208476","s763718025"]} +{"user_id":"u958506960","problem_id":"p03495","language":"python","submission_id_v0":"s295063960","submission_id_v1":"s178700100","cpu_time_v0":222,"cpu_time_v1":76,"memory_v0":38964,"memory_v1":35996,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.77,"input":"n, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nd = {}\n\nfor i in a:\n\n if i not in d:\n\n d[i] = 1\n\n else:\n\n d[i] += 1\n\n\n\nd = sorted(list(d.items()), key=lambda x:x[1], reverse=True)\n\nans = 0\n\nif len(d) <= k:\n\n print((0))\n\nelse:\n\n for i in range(len(d) - k):\n\n ans += d[-i-1][1]\n\n print(ans)","target":"import collections\n\n\n\nn, k = list(map(int,input().split()))\n\na = input().split()\n\na = sorted(list(collections.Counter(a).values()), reverse=True)\n\ns = sum(a[:k])\n\n\n\nprint((0 if s == n else n - s))","code_v0_loc":17,"code_v1_loc":8,"code_v0_num_chars":339,"code_v1_num_chars":182,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nd = {}\nfor i in a:\n if i not in d:\n d[i] = 1\n else:\n d[i] += 1\nd = sorted(list(d.items()), key=lambda x: x[1], reverse=True)\nans = 0\nif len(d) <= k:\n print((0))\nelse:\n for i in range(len(d) - k):\n ans += d[-i - 1][1]\n print(ans)\n","code_v1_no_empty_lines":"import collections\n\nn, k = list(map(int, input().split()))\na = input().split()\na = sorted(list(collections.Counter(a).values()), reverse=True)\ns = sum(a[:k])\nprint((0 if s == n else n - s))\n","code_same":false,"relative_loc_diff_percent":52.9411764706,"diff":["+import collections","+","-a = list(map(int, input().split()))","-d = {}","-for i in a:","- if i not in d:","- d[i] = 1","- else:","- d[i] += 1","-d = sorted(list(d.items()), key=lambda x: x[1], reverse=True)","-ans = 0","-if len(d) <= k:","- print((0))","-else:","- for i in range(len(d) - k):","- ans += d[-i - 1][1]","- print(ans)","+a = input().split()","+a = sorted(list(collections.Counter(a).values()), reverse=True)","+s = sum(a[:k])","+print((0 if s == n else n - s))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1094802856,"measured_runtime_v1":0.0417787552,"runtime_lift":2.6204774442,"key":["s295063960","s178700100"]} +{"user_id":"u847467233","problem_id":"p00991","language":"python","submission_id_v0":"s754232636","submission_id_v1":"s979339198","cpu_time_v0":280,"cpu_time_v1":20,"memory_v0":18928,"memory_v1":5668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.86,"input":"# AOJ 1501: Grid\n\n# Python3 2018.7.13 bal4u\n\n\n\nMOD = 100000007\n\ndef dp(n, k):\n\n\tif tbl[n][k]: return tbl[n][k]\n\n\tif (k << 1) > n: k = n-k\n\n\tif k == 0: ans = 1\n\n\telif k == 1: ans = n\n\n\telse: ans = dp(n-1, k) + dp(n-1, k-1)\n\n\ttbl[n][k] = ans % MOD\n\n\treturn tbl[n][k]\n\n\n\ntbl = [[0 for j in range(1001)] for i in range(1001)]\n\nk = 0\n\nr, c, a1, a2, b1, b2 = list(map(int, input().split()))\n\n\n\ndr = abs(a1-b1)\n\nif dr > r-dr: dr = r-dr\n\nif (dr << 1) == r: k += 1\n\n\n\ndc = abs(a2-b2)\n\nif dc > c-dc: dc = c-dc\n\nif (dc << 1) == c: k += 1\n\n\n\nprint(((dp(dr+dc, min(dr, dc)) << k) % MOD))\n\n\n","target":"# AOJ 1501: Grid\n\n# Python3 2018.7.13 bal4u\n\n\n\nfrom math import factorial\n\ndef comb (n, k):\n\n\treturn factorial(n)\/\/factorial(n-k)\/\/factorial(k)\n\n\t\n\nk = 0\n\nr, c, a1, a2, b1, b2 = list(map(int, input().split()))\n\n\n\ndr = abs(a1-b1)\n\nif dr > r-dr: dr = r-dr\n\nif (dr << 1) == r: k += 1\n\n\n\ndc = abs(a2-b2)\n\nif dc > c-dc: dc = c-dc\n\nif (dc << 1) == c: k += 1\n\n\n\nprint(((comb(dr+dc, min(dr, dc)) << k) % 100000007))\n","code_v0_loc":27,"code_v1_loc":19,"code_v0_num_chars":569,"code_v1_num_chars":400,"code_v0_no_empty_lines":"# AOJ 1501: Grid\n# Python3 2018.7.13 bal4u\nMOD = 100000007\n\n\ndef dp(n, k):\n if tbl[n][k]:\n return tbl[n][k]\n if (k << 1) > n:\n k = n - k\n if k == 0:\n ans = 1\n elif k == 1:\n ans = n\n else:\n ans = dp(n - 1, k) + dp(n - 1, k - 1)\n tbl[n][k] = ans % MOD\n return tbl[n][k]\n\n\ntbl = [[0 for j in range(1001)] for i in range(1001)]\nk = 0\nr, c, a1, a2, b1, b2 = list(map(int, input().split()))\ndr = abs(a1 - b1)\nif dr > r - dr:\n dr = r - dr\nif (dr << 1) == r:\n k += 1\ndc = abs(a2 - b2)\nif dc > c - dc:\n dc = c - dc\nif (dc << 1) == c:\n k += 1\nprint(((dp(dr + dc, min(dr, dc)) << k) % MOD))\n","code_v1_no_empty_lines":"# AOJ 1501: Grid\n# Python3 2018.7.13 bal4u\nfrom math import factorial\n\n\ndef comb(n, k):\n return factorial(n) \/\/ factorial(n - k) \/\/ factorial(k)\n\n\nk = 0\nr, c, a1, a2, b1, b2 = list(map(int, input().split()))\ndr = abs(a1 - b1)\nif dr > r - dr:\n dr = r - dr\nif (dr << 1) == r:\n k += 1\ndc = abs(a2 - b2)\nif dc > c - dc:\n dc = c - dc\nif (dc << 1) == c:\n k += 1\nprint(((comb(dr + dc, min(dr, dc)) << k) % 100000007))\n","code_same":false,"relative_loc_diff_percent":29.6296296296,"diff":["-MOD = 100000007","+from math import factorial","-def dp(n, k):","- if tbl[n][k]:","- return tbl[n][k]","- if (k << 1) > n:","- k = n - k","- if k == 0:","- ans = 1","- elif k == 1:","- ans = n","- else:","- ans = dp(n - 1, k) + dp(n - 1, k - 1)","- tbl[n][k] = ans % MOD","- return tbl[n][k]","+def comb(n, k):","+ return factorial(n) \/\/ factorial(n - k) \/\/ factorial(k)","-tbl = [[0 for j in range(1001)] for i in range(1001)]","-print(((dp(dr + dc, min(dr, dc)) << k) % MOD))","+print(((comb(dr + dc, min(dr, dc)) << k) % 100000007))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1437511306,"measured_runtime_v1":0.0358838608,"runtime_lift":4.0060107031,"key":["s754232636","s979339198"]} +{"user_id":"u753803401","problem_id":"p03474","language":"python","submission_id_v0":"s113618004","submission_id_v1":"s157393219","cpu_time_v0":197,"cpu_time_v1":168,"memory_v0":38384,"memory_v1":38384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.72,"input":"def slove():\n\n import sys\n\n input = sys.stdin.readline\n\n a, b = list(map(int, input().rstrip('\\n').split()))\n\n s = str(input().rstrip('\\n'))\n\n ls = list(\"1234567890\")\n\n for i in range(len(s)):\n\n if i < a:\n\n if s[i] not in ls:\n\n print(\"No\")\n\n exit()\n\n elif i == a:\n\n if s[i] != \"-\":\n\n print(\"No\")\n\n exit()\n\n elif b <= i:\n\n if s[i] not in ls:\n\n print(\"No\")\n\n exit()\n\n print(\"Yes\")\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n","target":"def slove():\n\n import sys\n\n import collections\n\n input = sys.stdin.readline\n\n a, b = list(map(int, input().rstrip('\\n').split()))\n\n s = str(input().rstrip('\\n'))\n\n d = collections.defaultdict(int)\n\n for i in range(10):\n\n d[str(i)]\n\n\n\n b = True\n\n for i in range(a + b + 1):\n\n if i < a:\n\n if s[i] not in d:\n\n b = False\n\n break\n\n elif i == a:\n\n if s[i] != \"-\":\n\n b = False\n\n break\n\n else:\n\n if s[i] not in d:\n\n b = False\n\n break\n\n if b:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n","code_v0_loc":24,"code_v1_loc":32,"code_v0_num_chars":589,"code_v1_num_chars":714,"code_v0_no_empty_lines":"def slove():\n import sys\n\n input = sys.stdin.readline\n a, b = list(map(int, input().rstrip(\"\\n\").split()))\n s = str(input().rstrip(\"\\n\"))\n ls = list(\"1234567890\")\n for i in range(len(s)):\n if i < a:\n if s[i] not in ls:\n print(\"No\")\n exit()\n elif i == a:\n if s[i] != \"-\":\n print(\"No\")\n exit()\n elif b <= i:\n if s[i] not in ls:\n print(\"No\")\n exit()\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n slove()\n","code_v1_no_empty_lines":"def slove():\n import sys\n import collections\n\n input = sys.stdin.readline\n a, b = list(map(int, input().rstrip(\"\\n\").split()))\n s = str(input().rstrip(\"\\n\"))\n d = collections.defaultdict(int)\n for i in range(10):\n d[str(i)]\n b = True\n for i in range(a + b + 1):\n if i < a:\n if s[i] not in d:\n b = False\n break\n elif i == a:\n if s[i] != \"-\":\n b = False\n break\n else:\n if s[i] not in d:\n b = False\n break\n if b:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n slove()\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["+ import collections","- ls = list(\"1234567890\")","- for i in range(len(s)):","+ d = collections.defaultdict(int)","+ for i in range(10):","+ d[str(i)]","+ b = True","+ for i in range(a + b + 1):","- if s[i] not in ls:","- print(\"No\")","- exit()","+ if s[i] not in d:","+ b = False","+ break","- print(\"No\")","- exit()","- elif b <= i:","- if s[i] not in ls:","- print(\"No\")","- exit()","- print(\"Yes\")","+ b = False","+ break","+ else:","+ if s[i] not in d:","+ b = False","+ break","+ if b:","+ print(\"Yes\")","+ else:","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0478568487,"measured_runtime_v1":0.0489796393,"runtime_lift":0.9770763811,"key":["s113618004","s157393219"]} +{"user_id":"u814986259","problem_id":"p03200","language":"python","submission_id_v0":"s982661527","submission_id_v1":"s716451545","cpu_time_v0":214,"cpu_time_v1":44,"memory_v0":37864,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.44,"input":"S = eval(input())\n\ntmp = []\n\ncount = 1\n\nfor i, x in enumerate(S):\n\n if x == 'B':\n\n tmp.append([i, count])\n\n count += 1\n\n\n\ntmp.sort(key=lambda x: x[1], reverse=True)\n\nans = 0\n\nfor i in range(len(tmp)):\n\n x = tmp[i][0]\n\n ans += len(S)-1-i - x\n\nprint(ans)\n","target":"S = eval(input())\n\ncount = 0\n\nans = 0\n\nfor x in S:\n\n if x == \"B\":\n\n count += 1\n\n else:\n\n ans += count\n\nprint(ans)\n","code_v0_loc":14,"code_v1_loc":9,"code_v0_num_chars":270,"code_v1_num_chars":128,"code_v0_no_empty_lines":"S = eval(input())\ntmp = []\ncount = 1\nfor i, x in enumerate(S):\n if x == \"B\":\n tmp.append([i, count])\n count += 1\ntmp.sort(key=lambda x: x[1], reverse=True)\nans = 0\nfor i in range(len(tmp)):\n x = tmp[i][0]\n ans += len(S) - 1 - i - x\nprint(ans)\n","code_v1_no_empty_lines":"S = eval(input())\ncount = 0\nans = 0\nfor x in S:\n if x == \"B\":\n count += 1\n else:\n ans += count\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-tmp = []","-count = 1","-for i, x in enumerate(S):","+count = 0","+ans = 0","+for x in S:","- tmp.append([i, count])","-tmp.sort(key=lambda x: x[1], reverse=True)","-ans = 0","-for i in range(len(tmp)):","- x = tmp[i][0]","- ans += len(S) - 1 - i - x","+ else:","+ ans += count"],"diff_only_import_comment":false,"measured_runtime_v0":0.0754173852,"measured_runtime_v1":0.0342022881,"runtime_lift":2.2050391775,"key":["s982661527","s716451545"]} +{"user_id":"u677121387","problem_id":"p03546","language":"python","submission_id_v0":"s716845802","submission_id_v1":"s234074289","cpu_time_v0":40,"cpu_time_v1":35,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"h,w = list(map(int,input().split()))\n\nc = [[int(i) for i in input().split()] for _ in range(10)]\n\na = [[int(i) for i in input().split()] for _ in range(h)]\n\n\n\nfor k in range(10):\n\n for i in range(10):\n\n for j in range(10):\n\n c[i][j] = min(c[i][j],c[i][k]+c[k][j])\n\n\n\nans = 0\n\nfor i in range(h):\n\n for j in range(w):\n\n if abs(a[i][j]) != 1:\n\n ans += c[a[i][j]][1]\n\n\n\nprint(ans)","target":"h,w = list(map(int,input().split()))\n\nc = [[int(i) for i in input().split()] for _ in range(10)]\n\na = [[int(i) for i in input().split()] for _ in range(h)]\n\n\n\nfor k in range(10):\n\n for i in range(10):\n\n for j in range(10):\n\n c[i][j] = min(c[i][j], c[i][k] + c[k][j])\n\n\n\nans = 0\n\nmp = [c[i][1] for i in range(10)]\n\nmp.append(0)\n\nfor i in range(h):\n\n for j in range(w): ans += mp[a[i][j]]\n\nprint(ans)","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":412,"code_v1_num_chars":416,"code_v0_no_empty_lines":"h, w = list(map(int, input().split()))\nc = [[int(i) for i in input().split()] for _ in range(10)]\na = [[int(i) for i in input().split()] for _ in range(h)]\nfor k in range(10):\n for i in range(10):\n for j in range(10):\n c[i][j] = min(c[i][j], c[i][k] + c[k][j])\nans = 0\nfor i in range(h):\n for j in range(w):\n if abs(a[i][j]) != 1:\n ans += c[a[i][j]][1]\nprint(ans)\n","code_v1_no_empty_lines":"h, w = list(map(int, input().split()))\nc = [[int(i) for i in input().split()] for _ in range(10)]\na = [[int(i) for i in input().split()] for _ in range(h)]\nfor k in range(10):\n for i in range(10):\n for j in range(10):\n c[i][j] = min(c[i][j], c[i][k] + c[k][j])\nans = 0\nmp = [c[i][1] for i in range(10)]\nmp.append(0)\nfor i in range(h):\n for j in range(w):\n ans += mp[a[i][j]]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["+mp = [c[i][1] for i in range(10)]","+mp.append(0)","- if abs(a[i][j]) != 1:","- ans += c[a[i][j]][1]","+ ans += mp[a[i][j]]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0383498795,"measured_runtime_v1":0.0485915823,"runtime_lift":0.7892288681,"key":["s716845802","s234074289"]} +{"user_id":"u694665829","problem_id":"p02936","language":"python","submission_id_v0":"s317370090","submission_id_v1":"s557947691","cpu_time_v0":1575,"cpu_time_v1":716,"memory_v0":349632,"memory_v1":90672,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.54,"input":"def solve():\n\n import sys\n\n sys.setrecursionlimit(10**6)\n\n def dfs(tree, n, ans):\n\n for i in tree[n]:\n\n ans[i] += ans[n]\n\n tree[i].remove(n)\n\n dfs(tree, i, ans) #\u518d\u5e30\u95a2\u6570\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u6b21\u306e\u6728\u306e\u4e2d\u3092\u63a2\u7d22\n\n \n\n n, q = list(map(int,input().split()))\n\n ab = [list(map(int,input().split())) for _ in range(n-1)]\n\n px = [list(map(int,input().split())) for _ in range(q)]\n\n \n\n g = [[] for _ in range(n)]\n\n for i in range(n-1):\n\n g[ab[i][0]-1].append(ab[i][1]-1)\n\n g[ab[i][1]-1].append(ab[i][0]-1)\n\n \n\n ans = [0]*n\n\n for i in range(q):\n\n ans[px[i-1][0]-1] += px[i-1][1]\n\n dfs(g, 0, ans)\n\n \n\n print((*ans))\n\n \n\nif __name__ == \"__main__\":\n\n solve()","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n \n\nn,q = list(map(int,readline().split()))\n\nABPX = list(map(int,read().split()))\n\nAB = iter(ABPX[:n+n-2])\n\nPX = iter(ABPX[n+n-2:])\n\n\n\ngraph = [[] for _ in range(n+1)]\n\nfor a, b in zip(AB, AB):\n\n graph[a].append(b)\n\n graph[b].append(a)\n\n\n\nval = [0] * (n+1)\n\nfor p, x in zip(PX, PX):\n\n val[p] += x\n\n\n\nstack = [1] #queue\u7684\u306a\u3084\u3064\n\nparent = [0] * (n+1)\n\nwhile stack:\n\n x = stack.pop() #\u6839\u3092\u5f15\u3063\u3053\u629c\u304f\n\n for y in graph[x]: #\u6728\u3092\u898b\u308b\n\n if y == parent[x]:\n\n continue\n\n parent[y] = x\n\n stack.append(y)\n\n val[y] += val[x]\n\n \n\nprint((' '.join(map(str, val[1:]))))","code_v0_loc":27,"code_v1_loc":31,"code_v0_num_chars":726,"code_v1_num_chars":710,"code_v0_no_empty_lines":"def solve():\n import sys\n\n sys.setrecursionlimit(10**6)\n\n def dfs(tree, n, ans):\n for i in tree[n]:\n ans[i] += ans[n]\n tree[i].remove(n)\n dfs(tree, i, ans) # \u518d\u5e30\u95a2\u6570\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u6b21\u306e\u6728\u306e\u4e2d\u3092\u63a2\u7d22\n\n n, q = list(map(int, input().split()))\n ab = [list(map(int, input().split())) for _ in range(n - 1)]\n px = [list(map(int, input().split())) for _ in range(q)]\n g = [[] for _ in range(n)]\n for i in range(n - 1):\n g[ab[i][0] - 1].append(ab[i][1] - 1)\n g[ab[i][1] - 1].append(ab[i][0] - 1)\n ans = [0] * n\n for i in range(q):\n ans[px[i - 1][0] - 1] += px[i - 1][1]\n dfs(g, 0, ans)\n print((*ans))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nn, q = list(map(int, readline().split()))\nABPX = list(map(int, read().split()))\nAB = iter(ABPX[: n + n - 2])\nPX = iter(ABPX[n + n - 2 :])\ngraph = [[] for _ in range(n + 1)]\nfor a, b in zip(AB, AB):\n graph[a].append(b)\n graph[b].append(a)\nval = [0] * (n + 1)\nfor p, x in zip(PX, PX):\n val[p] += x\nstack = [1] # queue\u7684\u306a\u3084\u3064\nparent = [0] * (n + 1)\nwhile stack:\n x = stack.pop() # \u6839\u3092\u5f15\u3063\u3053\u629c\u304f\n for y in graph[x]: # \u6728\u3092\u898b\u308b\n if y == parent[x]:\n continue\n parent[y] = x\n stack.append(y)\n val[y] += val[x]\nprint((\" \".join(map(str, val[1:]))))\n","code_same":false,"relative_loc_diff_percent":12.9032258065,"diff":["-def solve():","- import sys","+import sys","- sys.setrecursionlimit(10**6)","-","- def dfs(tree, n, ans):","- for i in tree[n]:","- ans[i] += ans[n]","- tree[i].remove(n)","- dfs(tree, i, ans) # \u518d\u5e30\u95a2\u6570\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u6b21\u306e\u6728\u306e\u4e2d\u3092\u63a2\u7d22","-","- n, q = list(map(int, input().split()))","- ab = [list(map(int, input().split())) for _ in range(n - 1)]","- px = [list(map(int, input().split())) for _ in range(q)]","- g = [[] for _ in range(n)]","- for i in range(n - 1):","- g[ab[i][0] - 1].append(ab[i][1] - 1)","- g[ab[i][1] - 1].append(ab[i][0] - 1)","- ans = [0] * n","- for i in range(q):","- ans[px[i - 1][0] - 1] += px[i - 1][1]","- dfs(g, 0, ans)","- print((*ans))","-","-","-if __name__ == \"__main__\":","- solve()","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+n, q = list(map(int, readline().split()))","+ABPX = list(map(int, read().split()))","+AB = iter(ABPX[: n + n - 2])","+PX = iter(ABPX[n + n - 2 :])","+graph = [[] for _ in range(n + 1)]","+for a, b in zip(AB, AB):","+ graph[a].append(b)","+ graph[b].append(a)","+val = [0] * (n + 1)","+for p, x in zip(PX, PX):","+ val[p] += x","+stack = [1] # queue\u7684\u306a\u3084\u3064","+parent = [0] * (n + 1)","+while stack:","+ x = stack.pop() # \u6839\u3092\u5f15\u3063\u3053\u629c\u304f","+ for y in graph[x]: # \u6728\u3092\u898b\u308b","+ if y == parent[x]:","+ continue","+ parent[y] = x","+ stack.append(y)","+ val[y] += val[x]","+print((\" \".join(map(str, val[1:]))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0411059973,"measured_runtime_v1":0.0670805697,"runtime_lift":0.6127854537,"key":["s317370090","s557947691"]} +{"user_id":"u031722966","problem_id":"p02612","language":"python","submission_id_v0":"s911723293","submission_id_v1":"s567663759","cpu_time_v0":31,"cpu_time_v1":28,"memory_v0":9140,"memory_v1":9052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.68,"input":"N = int(eval(input()))\n\nif N % 1000 != 0:\n\n print((1000 - N % 1000))\n\nelse:\n\n print((0))","target":"N = int(eval(input()))\n\nif N % 1000 == 0:\n\n print((0))\n\nelse:\n\n print((1000 - N % 1000))\n","code_v0_loc":5,"code_v1_loc":5,"code_v0_num_chars":84,"code_v1_num_chars":85,"code_v0_no_empty_lines":"N = int(eval(input()))\nif N % 1000 != 0:\n print((1000 - N % 1000))\nelse:\n print((0))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nif N % 1000 == 0:\n print((0))\nelse:\n print((1000 - N % 1000))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-if N % 1000 != 0:","+if N % 1000 == 0:","+ print((0))","+else:","-else:","- print((0))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1630067751,"measured_runtime_v1":0.1146739092,"runtime_lift":1.4214809304,"key":["s911723293","s567663759"]} +{"user_id":"u608088992","problem_id":"p03033","language":"python","submission_id_v0":"s657305864","submission_id_v1":"s083258294","cpu_time_v0":1727,"cpu_time_v1":1588,"memory_v0":97732,"memory_v1":97740,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.05,"input":"import sys, collections, heapq\n\nF = sys.stdin\n\ndef single_input(): return F.readline().strip(\"\\n\")\n\ndef line_input(): return F.readline().strip(\"\\n\").split()\n\n\n\ndef solve():\n\n N, Q = list(map(int, line_input()))\n\n event = []\n\n for i in range(N):\n\n s, t, x = list(map(int, line_input()))\n\n event.append((s-x, 1, x))\n\n event.append((t-x,-1, x))\n\n for i in range(Q):\n\n d = int(single_input())\n\n event.append((d, 2, d))\n\n event.sort()\n\n candidate = []\n\n heapq.heapify(candidate)\n\n stop = collections.defaultdict(int)\n\n ans = \"\"\n\n for time, parameter, co in event:\n\n if parameter == 1:\n\n heapq.heappush(candidate, co)\n\n stop[co] += 1\n\n elif parameter == -1:\n\n stop[co] -= 1\n\n else:\n\n while candidate:\n\n x = heapq.heappop(candidate)\n\n if stop[x] > 0:\n\n heapq.heappush(candidate, x)\n\n ans += str(x) + \"\\n\"\n\n break\n\n else: ans += \"-1\\n\"\n\n print(ans)\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","target":"import sys, collections, heapq\n\ndef single_input(F): return F.readline().strip(\"\\n\")\n\ndef line_input(F): return F.readline().strip(\"\\n\").split()\n\n\n\ndef solve():\n\n F = sys.stdin\n\n N, Q = list(map(int, line_input(F)))\n\n event = []\n\n for i in range(N):\n\n s, t, x = list(map(int, line_input(F)))\n\n event.append((s-x, 1, x))\n\n event.append((t-x,-1, x))\n\n for i in range(Q):\n\n d = int(single_input(F))\n\n event.append((d, 2, d))\n\n event.sort()\n\n candidate = []\n\n heapq.heapify(candidate)\n\n stop = collections.defaultdict(int)\n\n ans = \"\"\n\n for time, parameter, co in event:\n\n if parameter == 1:\n\n heapq.heappush(candidate, co)\n\n stop[co] += 1\n\n elif parameter == -1:\n\n stop[co] -= 1\n\n else:\n\n while candidate:\n\n x = heapq.heappop(candidate)\n\n if stop[x] > 0:\n\n heapq.heappush(candidate, x)\n\n ans += str(x) + \"\\n\"\n\n break\n\n else: ans += \"-1\\n\"\n\n print(ans)\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":40,"code_v1_loc":40,"code_v0_num_chars":1119,"code_v1_num_chars":1128,"code_v0_no_empty_lines":"import sys, collections, heapq\n\nF = sys.stdin\n\n\ndef single_input():\n return F.readline().strip(\"\\n\")\n\n\ndef line_input():\n return F.readline().strip(\"\\n\").split()\n\n\ndef solve():\n N, Q = list(map(int, line_input()))\n event = []\n for i in range(N):\n s, t, x = list(map(int, line_input()))\n event.append((s - x, 1, x))\n event.append((t - x, -1, x))\n for i in range(Q):\n d = int(single_input())\n event.append((d, 2, d))\n event.sort()\n candidate = []\n heapq.heapify(candidate)\n stop = collections.defaultdict(int)\n ans = \"\"\n for time, parameter, co in event:\n if parameter == 1:\n heapq.heappush(candidate, co)\n stop[co] += 1\n elif parameter == -1:\n stop[co] -= 1\n else:\n while candidate:\n x = heapq.heappop(candidate)\n if stop[x] > 0:\n heapq.heappush(candidate, x)\n ans += str(x) + \"\\n\"\n break\n else:\n ans += \"-1\\n\"\n print(ans)\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys, collections, heapq\n\n\ndef single_input(F):\n return F.readline().strip(\"\\n\")\n\n\ndef line_input(F):\n return F.readline().strip(\"\\n\").split()\n\n\ndef solve():\n F = sys.stdin\n N, Q = list(map(int, line_input(F)))\n event = []\n for i in range(N):\n s, t, x = list(map(int, line_input(F)))\n event.append((s - x, 1, x))\n event.append((t - x, -1, x))\n for i in range(Q):\n d = int(single_input(F))\n event.append((d, 2, d))\n event.sort()\n candidate = []\n heapq.heapify(candidate)\n stop = collections.defaultdict(int)\n ans = \"\"\n for time, parameter, co in event:\n if parameter == 1:\n heapq.heappush(candidate, co)\n stop[co] += 1\n elif parameter == -1:\n stop[co] -= 1\n else:\n while candidate:\n x = heapq.heappop(candidate)\n if stop[x] > 0:\n heapq.heappush(candidate, x)\n ans += str(x) + \"\\n\"\n break\n else:\n ans += \"-1\\n\"\n print(ans)\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-F = sys.stdin","-","-def single_input():","+def single_input(F):","-def line_input():","+def line_input(F):","- N, Q = list(map(int, line_input()))","+ F = sys.stdin","+ N, Q = list(map(int, line_input(F)))","- s, t, x = list(map(int, line_input()))","+ s, t, x = list(map(int, line_input(F)))","- d = int(single_input())","+ d = int(single_input(F))"],"diff_only_import_comment":false,"measured_runtime_v0":0.084306659,"measured_runtime_v1":0.1190830293,"runtime_lift":0.707965354,"key":["s657305864","s083258294"]} +{"user_id":"u188827677","problem_id":"p02694","language":"python","submission_id_v0":"s310885503","submission_id_v1":"s008248900","cpu_time_v0":24,"cpu_time_v1":20,"memory_v0":9116,"memory_v1":9176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"x = int(eval(input()))\n\n\n\nt = 100\n\ncount = 0\n\nwhile True:\n\n if t >= x:\n\n print(count)\n\n exit()\n\n \n\n t = int(t + t*0.01)\n\n count += 1","target":"x = int(eval(input()))\n\n\n\ns = 100\n\nans = 0\n\nwhile s < x:\n\n t = int(s*0.01)\n\n s = s+t\n\n ans += 1\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":136,"code_v1_num_chars":104,"code_v0_no_empty_lines":"x = int(eval(input()))\nt = 100\ncount = 0\nwhile True:\n if t >= x:\n print(count)\n exit()\n t = int(t + t * 0.01)\n count += 1\n","code_v1_no_empty_lines":"x = int(eval(input()))\ns = 100\nans = 0\nwhile s < x:\n t = int(s * 0.01)\n s = s + t\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-t = 100","-count = 0","-while True:","- if t >= x:","- print(count)","- exit()","- t = int(t + t * 0.01)","- count += 1","+s = 100","+ans = 0","+while s < x:","+ t = int(s * 0.01)","+ s = s + t","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0406881602,"measured_runtime_v1":0.0478095353,"runtime_lift":0.851046971,"key":["s310885503","s008248900"]} +{"user_id":"u057109575","problem_id":"p02889","language":"python","submission_id_v0":"s371075485","submission_id_v1":"s622941244","cpu_time_v0":1728,"cpu_time_v1":815,"memory_v0":84056,"memory_v1":99276,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.84,"input":"N, M, L = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\nQ = int(eval(input()))\n\nX = [list(map(int, input().split())) for _ in range(Q)]\n\n\n\nINF = 10 ** 9 + 6\n\ngraph = [[INF] * N for _ in range(N)]\n\n\n\nfor i in range(N):\n\n graph[i][i] = 0\n\n\n\nfor u, v, l in edges:\n\n graph[u - 1][v - 1] = l\n\n graph[v - 1][u - 1] = l\n\n\n\nfor k in range(N):\n\n for i in range(N):\n\n if graph[i][k] == INF:\n\n continue\n\n for j in range(N):\n\n if graph[k][j] == INF:\n\n continue\n\n graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])\n\n\n\ncnt = [[INF] * N for _ in range(N)]\n\n\n\nfor i in range(N):\n\n cnt[i][i] = 0\n\n\n\nfor i in range(N):\n\n for j in range(N):\n\n if i == j:\n\n continue\n\n if graph[i][j] <= L:\n\n cnt[i][j] = 1\n\n cnt[j][i] = 1\n\n\n\nfor k in range(N):\n\n for i in range(N):\n\n if cnt[i][k] == INF:\n\n continue\n\n for j in range(N):\n\n if cnt[k][j] == INF:\n\n continue\n\n cnt[i][j] = min(cnt[i][j], cnt[i][k] + cnt[k][j])\n\n\n\nfor s, t in X:\n\n if cnt[s - 1][t - 1] == INF:\n\n print((-1))\n\n else:\n\n print((cnt[s - 1][t - 1] - 1))\n","target":"N, M, L = list(map(int, input().split()))\n\nX = [list(map(int, input().split())) for _ in range(M)]\n\nQ = int(eval(input()))\n\nY = [list(map(int, input().split())) for _ in range(Q)]\n\n\n\ninf = 10 ** 9 + 7\n\ngraph = [[inf] * N for _ in range(N)]\n\ncount = [[inf] * N for _ in range(N)]\n\n\n\nfor i in range(N):\n\n graph[i][i] = 0\n\n count[i][i] = 0\n\n \n\nfor a, b, c in X:\n\n graph[a - 1][b - 1] = c\n\n graph[b - 1][a - 1] = c\n\n\n\nfor k in range(N):\n\n for i in range(N):\n\n for j in range(N):\n\n graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])\n\n\n\nfor i in range(N):\n\n for j in range(N):\n\n if i != j and graph[i][j] <= L:\n\n count[i][j] = 1\n\n\n\nfor k in range(N):\n\n for i in range(N):\n\n for j in range(N):\n\n count[i][j] = min(count[i][j], count[i][k] + count[k][j])\n\n\n\nfor s, t in Y:\n\n if count[s - 1][t - 1] == inf:\n\n print((-1))\n\n else:\n\n print((count[s - 1][t - 1] - 1))\n","code_v0_loc":51,"code_v1_loc":37,"code_v0_num_chars":1240,"code_v1_num_chars":944,"code_v0_no_empty_lines":"N, M, L = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\nQ = int(eval(input()))\nX = [list(map(int, input().split())) for _ in range(Q)]\nINF = 10**9 + 6\ngraph = [[INF] * N for _ in range(N)]\nfor i in range(N):\n graph[i][i] = 0\nfor u, v, l in edges:\n graph[u - 1][v - 1] = l\n graph[v - 1][u - 1] = l\nfor k in range(N):\n for i in range(N):\n if graph[i][k] == INF:\n continue\n for j in range(N):\n if graph[k][j] == INF:\n continue\n graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])\ncnt = [[INF] * N for _ in range(N)]\nfor i in range(N):\n cnt[i][i] = 0\nfor i in range(N):\n for j in range(N):\n if i == j:\n continue\n if graph[i][j] <= L:\n cnt[i][j] = 1\n cnt[j][i] = 1\nfor k in range(N):\n for i in range(N):\n if cnt[i][k] == INF:\n continue\n for j in range(N):\n if cnt[k][j] == INF:\n continue\n cnt[i][j] = min(cnt[i][j], cnt[i][k] + cnt[k][j])\nfor s, t in X:\n if cnt[s - 1][t - 1] == INF:\n print((-1))\n else:\n print((cnt[s - 1][t - 1] - 1))\n","code_v1_no_empty_lines":"N, M, L = list(map(int, input().split()))\nX = [list(map(int, input().split())) for _ in range(M)]\nQ = int(eval(input()))\nY = [list(map(int, input().split())) for _ in range(Q)]\ninf = 10**9 + 7\ngraph = [[inf] * N for _ in range(N)]\ncount = [[inf] * N for _ in range(N)]\nfor i in range(N):\n graph[i][i] = 0\n count[i][i] = 0\nfor a, b, c in X:\n graph[a - 1][b - 1] = c\n graph[b - 1][a - 1] = c\nfor k in range(N):\n for i in range(N):\n for j in range(N):\n graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])\nfor i in range(N):\n for j in range(N):\n if i != j and graph[i][j] <= L:\n count[i][j] = 1\nfor k in range(N):\n for i in range(N):\n for j in range(N):\n count[i][j] = min(count[i][j], count[i][k] + count[k][j])\nfor s, t in Y:\n if count[s - 1][t - 1] == inf:\n print((-1))\n else:\n print((count[s - 1][t - 1] - 1))\n","code_same":false,"relative_loc_diff_percent":27.4509803922,"diff":["-edges = [list(map(int, input().split())) for _ in range(M)]","+X = [list(map(int, input().split())) for _ in range(M)]","-X = [list(map(int, input().split())) for _ in range(Q)]","-INF = 10**9 + 6","-graph = [[INF] * N for _ in range(N)]","+Y = [list(map(int, input().split())) for _ in range(Q)]","+inf = 10**9 + 7","+graph = [[inf] * N for _ in range(N)]","+count = [[inf] * N for _ in range(N)]","-for u, v, l in edges:","- graph[u - 1][v - 1] = l","- graph[v - 1][u - 1] = l","+ count[i][i] = 0","+for a, b, c in X:","+ graph[a - 1][b - 1] = c","+ graph[b - 1][a - 1] = c","- if graph[i][k] == INF:","- continue","- if graph[k][j] == INF:","- continue","-cnt = [[INF] * N for _ in range(N)]","-for i in range(N):","- cnt[i][i] = 0","- if i == j:","- continue","- if graph[i][j] <= L:","- cnt[i][j] = 1","- cnt[j][i] = 1","+ if i != j and graph[i][j] <= L:","+ count[i][j] = 1","- if cnt[i][k] == INF:","- continue","- if cnt[k][j] == INF:","- continue","- cnt[i][j] = min(cnt[i][j], cnt[i][k] + cnt[k][j])","-for s, t in X:","- if cnt[s - 1][t - 1] == INF:","+ count[i][j] = min(count[i][j], count[i][k] + count[k][j])","+for s, t in Y:","+ if count[s - 1][t - 1] == inf:","- print((cnt[s - 1][t - 1] - 1))","+ print((count[s - 1][t - 1] - 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0668783522,"measured_runtime_v1":0.0872207429,"runtime_lift":0.766771182,"key":["s371075485","s622941244"]} +{"user_id":"u131984977","problem_id":"p02421","language":"python","submission_id_v0":"s804499817","submission_id_v1":"s136283442","cpu_time_v0":40,"cpu_time_v1":20,"memory_v0":6728,"memory_v1":7632,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"n = int(eval(input()))\n\ntp = hp = 0\n\n\n\nfor nc in range(n):\n\n (tc, hc) = input().split()\n\n if tc == hc:\n\n tp += 1\n\n hp += 1\n\n elif tc > hc:\n\n tp += 3\n\n elif tc < hc:\n\n hp += 3\n\n\n\nprint((tp, hp))","target":"n = int(eval(input()))\n\n\n\ntaro = 0\n\nhanako = 0\n\nfor ni in range(n):\n\n t, h = input().split()\n\n\n\n if t < h:\n\n hanako += 3\n\n elif t > h:\n\n taro += 3\n\n else:\n\n hanako += 1\n\n taro += 1\n\n\n\nprint((taro, hanako))","code_v0_loc":14,"code_v1_loc":16,"code_v0_num_chars":225,"code_v1_num_chars":237,"code_v0_no_empty_lines":"n = int(eval(input()))\ntp = hp = 0\nfor nc in range(n):\n (tc, hc) = input().split()\n if tc == hc:\n tp += 1\n hp += 1\n elif tc > hc:\n tp += 3\n elif tc < hc:\n hp += 3\nprint((tp, hp))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ntaro = 0\nhanako = 0\nfor ni in range(n):\n t, h = input().split()\n if t < h:\n hanako += 3\n elif t > h:\n taro += 3\n else:\n hanako += 1\n taro += 1\nprint((taro, hanako))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-tp = hp = 0","-for nc in range(n):","- (tc, hc) = input().split()","- if tc == hc:","- tp += 1","- hp += 1","- elif tc > hc:","- tp += 3","- elif tc < hc:","- hp += 3","-print((tp, hp))","+taro = 0","+hanako = 0","+for ni in range(n):","+ t, h = input().split()","+ if t < h:","+ hanako += 3","+ elif t > h:","+ taro += 3","+ else:","+ hanako += 1","+ taro += 1","+print((taro, hanako))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0502629118,"measured_runtime_v1":0.0868293099,"runtime_lift":0.5788703357,"key":["s804499817","s136283442"]} +{"user_id":"u273006189","problem_id":"p03013","language":"python","submission_id_v0":"s744544906","submission_id_v1":"s979458516","cpu_time_v0":174,"cpu_time_v1":149,"memory_v0":7076,"memory_v1":5132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.37,"input":"def fib(n):\n\n a, b = 0, 1\n\n if n == 1:\n\n return a\n\n elif n == 2:\n\n return b\n\n else:\n\n for i in range(n-2):\n\n a, b = b, a + b\n\n return b\n\n \n\nN, M = list(map(int, input().split()))\n\na = [-1]\n\nfor i in range(M):\n\n a.append(int(eval(input())))\n\n \n\nfor i in range(M-1):\n\n if a[i+1] == (a[i] + 1):\n\n print((0))\n\n exit()\n\n \n\ncombi = 1\n\n\n\nfor i in range(len(a)-1):\n\n dis = a[i+1] - a[i]\n\n #print(dis)\n\n combi *= fib(dis)\n\n #print(a[i])\n\n \n\ndis = N+1 - a[-1]\n\n#print(dis)\n\ncombi *= fib(dis)\n\n\n\nprint((combi % 1000000007))","target":"N, M = list(map(int, input().split()))\n\n\n\n# \u58ca\u308c\u3066\u3044\u308b\u5e8a\n\na = [-1]\n\nfor i in range(M):\n\n a.append(int(eval(input())))\n\n # \u9023\u7d9a\u3057\u3066\u58ca\u308c\u3066\u3044\u305f\u3089\u8fbf\u308a\u7740\u3051\u306a\u3044\n\n if a[i + 1] - a[i] == 1:\n\n print((0))\n\n exit()\n\n\n\n# \u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217\n\ndef fib(n):\n\n a, b = 0, 1\n\n if n == 1:\n\n return a\n\n elif n == 2:\n\n return b\n\n else:\n\n for i in range(n-2):\n\n a, b = b, a + b\n\n return b\n\n\n\n# \u968e\u6bb5\u3092\u767b\u308b\u7d44\u307f\u5408\u308f\u305b\n\ncombi = 1\n\n\n\nfor i in range(len(a) - 1):\n\n # \u6b21\u306e\u7a74\u3068\u306e\u8ddd\u96e2\n\n dis = a[i+1] - a[i]\n\n #print(dis)\n\n combi *= fib(dis)\n\n #print(a[i])\n\n \n\ndis = N+1 - a[-1]\n\n#print(dis)\n\ncombi *= fib(dis)\n\n \n\nprint((combi % 1000000007))","code_v0_loc":34,"code_v1_loc":38,"code_v0_num_chars":591,"code_v1_num_chars":581,"code_v0_no_empty_lines":"def fib(n):\n a, b = 0, 1\n if n == 1:\n return a\n elif n == 2:\n return b\n else:\n for i in range(n - 2):\n a, b = b, a + b\n return b\n\n\nN, M = list(map(int, input().split()))\na = [-1]\nfor i in range(M):\n a.append(int(eval(input())))\nfor i in range(M - 1):\n if a[i + 1] == (a[i] + 1):\n print((0))\n exit()\ncombi = 1\nfor i in range(len(a) - 1):\n dis = a[i + 1] - a[i]\n # print(dis)\n combi *= fib(dis)\n # print(a[i])\ndis = N + 1 - a[-1]\n# print(dis)\ncombi *= fib(dis)\nprint((combi % 1000000007))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\n# \u58ca\u308c\u3066\u3044\u308b\u5e8a\na = [-1]\nfor i in range(M):\n a.append(int(eval(input())))\n # \u9023\u7d9a\u3057\u3066\u58ca\u308c\u3066\u3044\u305f\u3089\u8fbf\u308a\u7740\u3051\u306a\u3044\n if a[i + 1] - a[i] == 1:\n print((0))\n exit()\n# \u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217\ndef fib(n):\n a, b = 0, 1\n if n == 1:\n return a\n elif n == 2:\n return b\n else:\n for i in range(n - 2):\n a, b = b, a + b\n return b\n\n\n# \u968e\u6bb5\u3092\u767b\u308b\u7d44\u307f\u5408\u308f\u305b\ncombi = 1\nfor i in range(len(a) - 1):\n # \u6b21\u306e\u7a74\u3068\u306e\u8ddd\u96e2\n dis = a[i + 1] - a[i]\n # print(dis)\n combi *= fib(dis)\n # print(a[i])\ndis = N + 1 - a[-1]\n# print(dis)\ncombi *= fib(dis)\nprint((combi % 1000000007))\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["+N, M = list(map(int, input().split()))","+# \u58ca\u308c\u3066\u3044\u308b\u5e8a","+a = [-1]","+for i in range(M):","+ a.append(int(eval(input())))","+ # \u9023\u7d9a\u3057\u3066\u58ca\u308c\u3066\u3044\u305f\u3089\u8fbf\u308a\u7740\u3051\u306a\u3044","+ if a[i + 1] - a[i] == 1:","+ print((0))","+ exit()","+# \u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217","-N, M = list(map(int, input().split()))","-a = [-1]","-for i in range(M):","- a.append(int(eval(input())))","-for i in range(M - 1):","- if a[i + 1] == (a[i] + 1):","- print((0))","- exit()","+# \u968e\u6bb5\u3092\u767b\u308b\u7d44\u307f\u5408\u308f\u305b","+ # \u6b21\u306e\u7a74\u3068\u306e\u8ddd\u96e2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0487305036,"measured_runtime_v1":0.0487457738,"runtime_lift":0.9996867371,"key":["s744544906","s979458516"]} +{"user_id":"u947883560","problem_id":"p02630","language":"python","submission_id_v0":"s351390134","submission_id_v1":"s008321818","cpu_time_v0":324,"cpu_time_v1":295,"memory_v0":91096,"memory_v1":88136,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.95,"input":"#!\/usr\/bin\/env python3\n\nimport sys\n\nfrom collections import Counter\n\nsys.setrecursionlimit(10**8)\n\nINF = float(\"inf\")\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n Q = int(eval(input()))\n\n B, C = [0]*Q, [0]*Q\n\n for i in range(Q):\n\n B[i], C[i] = list(map(int, input().split()))\n\n # \u500b\u6570\u3092\u6301\u3064\n\n # Bi\u306e\u500b\u6570 O(1),C[i]\u306e\u500b\u6570 O(1) \u66f4\u65b0 O(1) \u7dcf\u548cO(1)\n\n\n\n count = Counter(A)\n\n tot = sum(A)\n\n for i in range(Q):\n\n b = count[B[i]]\n\n c = count[C[i]]\n\n count[C[i]] += b\n\n count[B[i]] = 0\n\n tot = tot - B[i]*b + C[i]*b\n\n print(tot)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\nfrom collections import Counter\n\nsys.setrecursionlimit(10**8)\n\nINF = float(\"inf\")\n\n\n\n\n\nclass UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def members(self, x):\n\n root = self.find(x)\n\n return [i for i in range(self.n) if self.find(i) == root]\n\n\n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n\n\n def group_count(self):\n\n return len(self.roots())\n\n\n\n def all_group_members(self):\n\n return {r: self.members(r) for r in self.roots()}\n\n\n\n def __str__(self):\n\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n Q = int(eval(input()))\n\n B, C = [0]*Q, [0]*Q\n\n for i in range(Q):\n\n B[i], C[i] = list(map(int, input().split()))\n\n # \u500b\u6570\u3092\u6301\u3064\n\n # Bi\u306e\u500b\u6570 O(1),C[i]\u306e\u500b\u6570 O(1) \u66f4\u65b0 O(1) \u7dcf\u548cO(1)\n\n\n\n group = [None]*(10**5+1)\n\n uf = UnionFind(N)\n\n\n\n # union_find\n\n # N\u500b\u306e\u6570\u306b\u5bfe\u3057\u3066\u3001i\u756a\u76ee\u306e\u6570\u304c\u3069\u306e\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u306e\u304b\u3092\u793a\u3059\n\n # group\n\n # j (< 10**5)\u306b\u5bfe\u3057\u3066\u3001j\u304c\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u6839\u306e\u756a\u53f7\u3092\u793a\u3059\n\n\n\n for i, a in enumerate(A):\n\n # \u30b0\u30eb\u30fc\u30d7\u306b\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u756a\u53f7\u304ca\u3067\u3042\u308b\u3088\u3046\u306a\u30b0\u30eb\u30fc\u30d7\u306f\u3042\u308b\u304b\uff1f\n\n # \u306a\u3051\u308c\u3070\u81ea\u4fe1\u306e\u30b0\u30eb\u30fc\u30d7\u306b\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u756a\u53f7\u3068\u3057\u3066\u4fdd\u6301\n\n # \u3042\u308c\u3070\u305d\u3053\u306b\u5408\u6d41\n\n if group[a] is None:\n\n group[a] = i\n\n else:\n\n uf.union(i, group[a])\n\n group[a] = uf.find(i)\n\n # print(A)\n\n # print(group)\n\n # print(uf.parents)\n\n\n\n tot = sum(A)\n\n for i in range(Q):\n\n if group[B[i]] is None:\n\n b = 0\n\n elif group[C[i]] is None:\n\n b = uf.size(group[B[i]])\n\n group[C[i]] = uf.find(group[B[i]])\n\n group[B[i]] = None\n\n else:\n\n b = uf.size(group[B[i]])\n\n uf.union(group[B[i]], group[C[i]])\n\n group[C[i]] = uf.find(group[B[i]])\n\n group[B[i]] = None\n\n tot = tot - B[i]*b + C[i]*b\n\n print(tot)\n\n # print(group)\n\n # print(uf.parents)\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":32,"code_v1_loc":109,"code_v0_num_chars":660,"code_v1_num_chars":2677,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nfrom collections import Counter\n\nsys.setrecursionlimit(10**8)\nINF = float(\"inf\")\n\n\ndef main():\n N = int(eval(input()))\n A = list(map(int, input().split()))\n Q = int(eval(input()))\n B, C = [0] * Q, [0] * Q\n for i in range(Q):\n B[i], C[i] = list(map(int, input().split()))\n # \u500b\u6570\u3092\u6301\u3064\n # Bi\u306e\u500b\u6570 O(1),C[i]\u306e\u500b\u6570 O(1) \u66f4\u65b0 O(1) \u7dcf\u548cO(1)\n count = Counter(A)\n tot = sum(A)\n for i in range(Q):\n b = count[B[i]]\n c = count[C[i]]\n count[C[i]] += b\n count[B[i]] = 0\n tot = tot - B[i] * b + C[i] * b\n print(tot)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nfrom collections import Counter\n\nsys.setrecursionlimit(10**8)\nINF = float(\"inf\")\n\n\nclass UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())\n\n\ndef main():\n N = int(eval(input()))\n A = list(map(int, input().split()))\n Q = int(eval(input()))\n B, C = [0] * Q, [0] * Q\n for i in range(Q):\n B[i], C[i] = list(map(int, input().split()))\n # \u500b\u6570\u3092\u6301\u3064\n # Bi\u306e\u500b\u6570 O(1),C[i]\u306e\u500b\u6570 O(1) \u66f4\u65b0 O(1) \u7dcf\u548cO(1)\n group = [None] * (10**5 + 1)\n uf = UnionFind(N)\n # union_find\n # N\u500b\u306e\u6570\u306b\u5bfe\u3057\u3066\u3001i\u756a\u76ee\u306e\u6570\u304c\u3069\u306e\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u306e\u304b\u3092\u793a\u3059\n # group\n # j (< 10**5)\u306b\u5bfe\u3057\u3066\u3001j\u304c\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u6839\u306e\u756a\u53f7\u3092\u793a\u3059\n for i, a in enumerate(A):\n # \u30b0\u30eb\u30fc\u30d7\u306b\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u756a\u53f7\u304ca\u3067\u3042\u308b\u3088\u3046\u306a\u30b0\u30eb\u30fc\u30d7\u306f\u3042\u308b\u304b\uff1f\n # \u306a\u3051\u308c\u3070\u81ea\u4fe1\u306e\u30b0\u30eb\u30fc\u30d7\u306b\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u756a\u53f7\u3068\u3057\u3066\u4fdd\u6301\n # \u3042\u308c\u3070\u305d\u3053\u306b\u5408\u6d41\n if group[a] is None:\n group[a] = i\n else:\n uf.union(i, group[a])\n group[a] = uf.find(i)\n # print(A)\n # print(group)\n # print(uf.parents)\n tot = sum(A)\n for i in range(Q):\n if group[B[i]] is None:\n b = 0\n elif group[C[i]] is None:\n b = uf.size(group[B[i]])\n group[C[i]] = uf.find(group[B[i]])\n group[B[i]] = None\n else:\n b = uf.size(group[B[i]])\n uf.union(group[B[i]], group[C[i]])\n group[C[i]] = uf.find(group[B[i]])\n group[B[i]] = None\n tot = tot - B[i] * b + C[i] * b\n print(tot)\n # print(group)\n # print(uf.parents)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":70.6422018349,"diff":["+","+","+class UnionFind:","+ def __init__(self, n):","+ self.n = n","+ self.parents = [-1] * n","+","+ def find(self, x):","+ if self.parents[x] < 0:","+ return x","+ else:","+ self.parents[x] = self.find(self.parents[x])","+ return self.parents[x]","+","+ def union(self, x, y):","+ x = self.find(x)","+ y = self.find(y)","+ if x == y:","+ return","+ if self.parents[x] > self.parents[y]:","+ x, y = y, x","+ self.parents[x] += self.parents[y]","+ self.parents[y] = x","+","+ def size(self, x):","+ return -self.parents[self.find(x)]","+","+ def same(self, x, y):","+ return self.find(x) == self.find(y)","+","+ def members(self, x):","+ root = self.find(x)","+ return [i for i in range(self.n) if self.find(i) == root]","+","+ def roots(self):","+ return [i for i, x in enumerate(self.parents) if x < 0]","+","+ def group_count(self):","+ return len(self.roots())","+","+ def all_group_members(self):","+ return {r: self.members(r) for r in self.roots()}","+","+ def __str__(self):","+ return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())","- count = Counter(A)","+ group = [None] * (10**5 + 1)","+ uf = UnionFind(N)","+ # union_find","+ # N\u500b\u306e\u6570\u306b\u5bfe\u3057\u3066\u3001i\u756a\u76ee\u306e\u6570\u304c\u3069\u306e\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u306e\u304b\u3092\u793a\u3059","+ # group","+ # j (< 10**5)\u306b\u5bfe\u3057\u3066\u3001j\u304c\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u6839\u306e\u756a\u53f7\u3092\u793a\u3059","+ for i, a in enumerate(A):","+ # \u30b0\u30eb\u30fc\u30d7\u306b\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u756a\u53f7\u304ca\u3067\u3042\u308b\u3088\u3046\u306a\u30b0\u30eb\u30fc\u30d7\u306f\u3042\u308b\u304b\uff1f","+ # \u306a\u3051\u308c\u3070\u81ea\u4fe1\u306e\u30b0\u30eb\u30fc\u30d7\u306b\u3064\u3051\u3089\u308c\u3066\u3044\u308b\u756a\u53f7\u3068\u3057\u3066\u4fdd\u6301","+ # \u3042\u308c\u3070\u305d\u3053\u306b\u5408\u6d41","+ if group[a] is None:","+ group[a] = i","+ else:","+ uf.union(i, group[a])","+ group[a] = uf.find(i)","+ # print(A)","+ # print(group)","+ # print(uf.parents)","- b = count[B[i]]","- c = count[C[i]]","- count[C[i]] += b","- count[B[i]] = 0","+ if group[B[i]] is None:","+ b = 0","+ elif group[C[i]] is None:","+ b = uf.size(group[B[i]])","+ group[C[i]] = uf.find(group[B[i]])","+ group[B[i]] = None","+ else:","+ b = uf.size(group[B[i]])","+ uf.union(group[B[i]], group[C[i]])","+ group[C[i]] = uf.find(group[B[i]])","+ group[B[i]] = None","+ # print(group)","+ # print(uf.parents)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0435237472,"measured_runtime_v1":0.0456158283,"runtime_lift":0.9541369485,"key":["s351390134","s008321818"]} +{"user_id":"u607155447","problem_id":"p02713","language":"python","submission_id_v0":"s988651702","submission_id_v1":"s923443131","cpu_time_v0":892,"cpu_time_v1":551,"memory_v0":9540,"memory_v1":9228,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.23,"input":"def euclid(a, b):\n\n global l\n\n if b == 0:\n\n return a\n\n else:\n\n ch = l[a][b]\n\n if ch == 0:\n\n return euclid(b, a%b)\n\n else:\n\n return ch\n\n\n\ndef gcd(a, b, c):\n\n global l\n\n d = l[c][b]\n\n if d == 0:\n\n d = euclid(c, b)\n\n l[c][b] = d\n\n\n\n e = l[max(d, a)][min(d, a)]\n\n if e == 0:\n\n e = euclid(max(d, a), min(d, a))\n\n l[max(d, a)][min(d, a)] = e\n\n\n\n return e\n\n\n\nK = int(eval(input()))\n\nans = 0\n\nl = []\n\nfor i in range(K+1):\n\n l.append([0]*(K+1))\n\n\n\nfor i in range(1, K+1):\n\n for j in range(i, K+1):\n\n for k in range(j, K+1):\n\n num = gcd(i, j, k)\n\n if i == j:\n\n if j == k:\n\n ans += num\n\n else:\n\n ans += 3*num\n\n else:\n\n if j == k:\n\n ans += 3*num\n\n else:\n\n ans += 6*num\n\n\n\nprint(ans)","target":"import math\n\n\n\nK = int(eval(input()))\n\nans = 0\n\nl = []\n\nfor i in range(K+1):\n\n l.append([0]*(K+1))\n\n\n\nfor i in range(1, K+1):\n\n for j in range(i, K+1):\n\n for k in range(j, K+1):\n\n num = math.gcd(math.gcd(i, j), k)\n\n if i == j:\n\n if j == k:\n\n ans += num\n\n else:\n\n ans += 3*num\n\n else:\n\n if j == k:\n\n ans += 3*num\n\n else:\n\n ans += 6*num\n\n\n\nprint(ans)","code_v0_loc":47,"code_v1_loc":24,"code_v0_num_chars":951,"code_v1_num_chars":524,"code_v0_no_empty_lines":"def euclid(a, b):\n global l\n if b == 0:\n return a\n else:\n ch = l[a][b]\n if ch == 0:\n return euclid(b, a % b)\n else:\n return ch\n\n\ndef gcd(a, b, c):\n global l\n d = l[c][b]\n if d == 0:\n d = euclid(c, b)\n l[c][b] = d\n e = l[max(d, a)][min(d, a)]\n if e == 0:\n e = euclid(max(d, a), min(d, a))\n l[max(d, a)][min(d, a)] = e\n return e\n\n\nK = int(eval(input()))\nans = 0\nl = []\nfor i in range(K + 1):\n l.append([0] * (K + 1))\nfor i in range(1, K + 1):\n for j in range(i, K + 1):\n for k in range(j, K + 1):\n num = gcd(i, j, k)\n if i == j:\n if j == k:\n ans += num\n else:\n ans += 3 * num\n else:\n if j == k:\n ans += 3 * num\n else:\n ans += 6 * num\nprint(ans)\n","code_v1_no_empty_lines":"import math\n\nK = int(eval(input()))\nans = 0\nl = []\nfor i in range(K + 1):\n l.append([0] * (K + 1))\nfor i in range(1, K + 1):\n for j in range(i, K + 1):\n for k in range(j, K + 1):\n num = math.gcd(math.gcd(i, j), k)\n if i == j:\n if j == k:\n ans += num\n else:\n ans += 3 * num\n else:\n if j == k:\n ans += 3 * num\n else:\n ans += 6 * num\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":48.9361702128,"diff":["-def euclid(a, b):","- global l","- if b == 0:","- return a","- else:","- ch = l[a][b]","- if ch == 0:","- return euclid(b, a % b)","- else:","- return ch","-","-","-def gcd(a, b, c):","- global l","- d = l[c][b]","- if d == 0:","- d = euclid(c, b)","- l[c][b] = d","- e = l[max(d, a)][min(d, a)]","- if e == 0:","- e = euclid(max(d, a), min(d, a))","- l[max(d, a)][min(d, a)] = e","- return e","-","+import math","- num = gcd(i, j, k)","+ num = math.gcd(math.gcd(i, j), k)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1523839235,"measured_runtime_v1":0.07498263,"runtime_lift":2.032256317,"key":["s988651702","s923443131"]} +{"user_id":"u670133596","problem_id":"p03962","language":"python","submission_id_v0":"s105689035","submission_id_v1":"s420144274","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"colors = input().split()\n\nprint((len(set(colors))))","target":"abc = input().split()\n\nprint((len(set(abc))))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":49,"code_v1_num_chars":43,"code_v0_no_empty_lines":"colors = input().split()\nprint((len(set(colors))))\n","code_v1_no_empty_lines":"abc = input().split()\nprint((len(set(abc))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-colors = input().split()","-print((len(set(colors))))","+abc = input().split()","+print((len(set(abc))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0454797252,"measured_runtime_v1":0.0466473613,"runtime_lift":0.9749688717,"key":["s105689035","s420144274"]} +{"user_id":"u278886389","problem_id":"p02684","language":"python","submission_id_v0":"s928914063","submission_id_v1":"s275440423","cpu_time_v0":365,"cpu_time_v1":169,"memory_v0":170048,"memory_v1":92072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.7,"input":"N,K = list(map(int,input().split()))\n\nA = list([int(x)-1 for x in input().split()])\n\n\n\no = [0] * 63\n\n\n\ndef bi(x):\n\n i = 0\n\n while x != 0:\n\n o[i] = x%2\n\n x \/\/= 2\n\n i += 1\n\n\n\nbi(K)\n\n\n\nn = 0\n\nfor i in range(63):\n\n if o[i]:\n\n n = A[n]\n\n A = [A[A[x]] for x in range(N)]\n\n \n\nprint((n+1))","target":"N,K = list(map(int,input().split()))\n\nA = list([int(x)-1 for x in input().split()])\n\nB = [0]*N\n\n\n\no = [0] * 63\n\n\n\ndef bi(x):\n\n i = 0\n\n while x != 0:\n\n o[i] = x%2\n\n x \/\/= 2\n\n i += 1\n\n\n\nbi(K)\n\n\n\nn = 0\n\nfor i in range(63):\n\n if o[i]:\n\n n = A[n]\n\n for j in range(N):\n\n B[j] = A[A[j]]\n\n for j in range(N):\n\n A[j] = B[j]\n\n \n\nprint((n+1))","code_v0_loc":21,"code_v1_loc":25,"code_v0_num_chars":324,"code_v1_num_chars":391,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list([int(x) - 1 for x in input().split()])\no = [0] * 63\n\n\ndef bi(x):\n i = 0\n while x != 0:\n o[i] = x % 2\n x \/\/= 2\n i += 1\n\n\nbi(K)\nn = 0\nfor i in range(63):\n if o[i]:\n n = A[n]\n A = [A[A[x]] for x in range(N)]\nprint((n + 1))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list([int(x) - 1 for x in input().split()])\nB = [0] * N\no = [0] * 63\n\n\ndef bi(x):\n i = 0\n while x != 0:\n o[i] = x % 2\n x \/\/= 2\n i += 1\n\n\nbi(K)\nn = 0\nfor i in range(63):\n if o[i]:\n n = A[n]\n for j in range(N):\n B[j] = A[A[j]]\n for j in range(N):\n A[j] = B[j]\nprint((n + 1))\n","code_same":false,"relative_loc_diff_percent":16.0,"diff":["+B = [0] * N","- A = [A[A[x]] for x in range(N)]","+ for j in range(N):","+ B[j] = A[A[j]]","+ for j in range(N):","+ A[j] = B[j]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0354802027,"measured_runtime_v1":0.0374222199,"runtime_lift":0.9481052366,"key":["s928914063","s275440423"]} +{"user_id":"u241159583","problem_id":"p03103","language":"python","submission_id_v0":"s197250876","submission_id_v1":"s915789636","cpu_time_v0":537,"cpu_time_v1":350,"memory_v0":27760,"memory_v1":27344,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.82,"input":"n,m = list(map(int, input().split()))\n\nab = [list(map(int, input().split())) for _ in range(n)]\n\nab.sort()\n\nmoney = 0\n\ndrink = 0\n\nfor a,b in ab:\n\n money += a*b\n\n drink += b\n\n if drink >= m:\n\n money -= (drink-m) * a\n\n break\n\nprint(money)","target":"n,m = list(map(int, input().split()))\n\nab = [list(map(int, input().split())) for _ in range(n)]\n\nab.sort()\n\nmoney = 0\n\ndrink = 0\n\nfor a,b in ab:\n\n if drink+b <= m:\n\n drink += b\n\n money += a*b\n\n else:\n\n money += (m-drink) * a\n\n drink = m\n\n if drink == m: break\n\nprint(money)","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":239,"code_v1_num_chars":304,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(n)]\nab.sort()\nmoney = 0\ndrink = 0\nfor a, b in ab:\n money += a * b\n drink += b\n if drink >= m:\n money -= (drink - m) * a\n break\nprint(money)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(n)]\nab.sort()\nmoney = 0\ndrink = 0\nfor a, b in ab:\n if drink + b <= m:\n drink += b\n money += a * b\n else:\n money += (m - drink) * a\n drink = m\n if drink == m:\n break\nprint(money)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["- money += a * b","- drink += b","- if drink >= m:","- money -= (drink - m) * a","+ if drink + b <= m:","+ drink += b","+ money += a * b","+ else:","+ money += (m - drink) * a","+ drink = m","+ if drink == m:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0440675855,"measured_runtime_v1":0.0432952368,"runtime_lift":1.0178391132,"key":["s197250876","s915789636"]} +{"user_id":"u379959788","problem_id":"p02720","language":"python","submission_id_v0":"s586219101","submission_id_v1":"s937550659","cpu_time_v0":398,"cpu_time_v1":111,"memory_v0":40760,"memory_v1":18856,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.11,"input":"K = int(eval(input()))\n\n\n\nlunlun_number_list = []\n\n\n\ndef dfs(N):\n\n lunlun_number_list.append(N)\n\n if len(str(N)) > 10:\n\n return\n\n now_int = int(str(N)[-1])\n\n if now_int == 0:\n\n for i in range(2):\n\n dfs(N*10 + i)\n\n elif now_int == 9:\n\n for i in range(8, 10, 1):\n\n dfs(N*10 + i)\n\n else:\n\n for i in range(now_int-1, now_int+2, 1):\n\n dfs(N*10 + i)\n\n\n\nfor i in range(1, 10, 1):\n\n dfs(i)\n\n\n\nlunlun_number_list.sort()\n\nprint((lunlun_number_list[K-1]))\n","target":"import collections\n\nK = int(eval(input()))\n\n\n\nque = collections.deque()\n\nfor i in range(1, 10, 1):\n\n que.append(i)\n\ncnt = 0\n\nfor i in range(K):\n\n x = que.popleft()\n\n cnt += 1\n\n if cnt == K:\n\n print(x)\n\n exit()\n\n if x%10 == 0:\n\n que.append(10*x+0)\n\n que.append(10*x+1)\n\n elif x%10 == 9:\n\n que.append(10*x+8)\n\n que.append(10*x+9)\n\n else:\n\n que.append(10*x+(x%10)-1)\n\n que.append(10*x+(x%10)+0)\n\n que.append(10*x+(x%10)+1)\n\n\n","code_v0_loc":24,"code_v1_loc":24,"code_v0_num_chars":519,"code_v1_num_chars":500,"code_v0_no_empty_lines":"K = int(eval(input()))\nlunlun_number_list = []\n\n\ndef dfs(N):\n lunlun_number_list.append(N)\n if len(str(N)) > 10:\n return\n now_int = int(str(N)[-1])\n if now_int == 0:\n for i in range(2):\n dfs(N * 10 + i)\n elif now_int == 9:\n for i in range(8, 10, 1):\n dfs(N * 10 + i)\n else:\n for i in range(now_int - 1, now_int + 2, 1):\n dfs(N * 10 + i)\n\n\nfor i in range(1, 10, 1):\n dfs(i)\nlunlun_number_list.sort()\nprint((lunlun_number_list[K - 1]))\n","code_v1_no_empty_lines":"import collections\n\nK = int(eval(input()))\nque = collections.deque()\nfor i in range(1, 10, 1):\n que.append(i)\ncnt = 0\nfor i in range(K):\n x = que.popleft()\n cnt += 1\n if cnt == K:\n print(x)\n exit()\n if x % 10 == 0:\n que.append(10 * x + 0)\n que.append(10 * x + 1)\n elif x % 10 == 9:\n que.append(10 * x + 8)\n que.append(10 * x + 9)\n else:\n que.append(10 * x + (x % 10) - 1)\n que.append(10 * x + (x % 10) + 0)\n que.append(10 * x + (x % 10) + 1)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+import collections","+","-lunlun_number_list = []","-","-","-def dfs(N):","- lunlun_number_list.append(N)","- if len(str(N)) > 10:","- return","- now_int = int(str(N)[-1])","- if now_int == 0:","- for i in range(2):","- dfs(N * 10 + i)","- elif now_int == 9:","- for i in range(8, 10, 1):","- dfs(N * 10 + i)","+que = collections.deque()","+for i in range(1, 10, 1):","+ que.append(i)","+cnt = 0","+for i in range(K):","+ x = que.popleft()","+ cnt += 1","+ if cnt == K:","+ print(x)","+ exit()","+ if x % 10 == 0:","+ que.append(10 * x + 0)","+ que.append(10 * x + 1)","+ elif x % 10 == 9:","+ que.append(10 * x + 8)","+ que.append(10 * x + 9)","- for i in range(now_int - 1, now_int + 2, 1):","- dfs(N * 10 + i)","-","-","-for i in range(1, 10, 1):","- dfs(i)","-lunlun_number_list.sort()","-print((lunlun_number_list[K - 1]))","+ que.append(10 * x + (x % 10) - 1)","+ que.append(10 * x + (x % 10) + 0)","+ que.append(10 * x + (x % 10) + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.9932319355,"measured_runtime_v1":0.0692591319,"runtime_lift":14.3408083236,"key":["s586219101","s937550659"]} +{"user_id":"u222668979","problem_id":"p03472","language":"python","submission_id_v0":"s904298346","submission_id_v1":"s991965062","cpu_time_v0":233,"cpu_time_v1":213,"memory_v0":87424,"memory_v1":87312,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.58,"input":"n, h = list(map(int, input().split()))\n\na, b = [], []\n\nfor _ in range(n):\n\n ai, bi = list(map(int, input().split()))\n\n a.append(ai), b.append(bi)\n\na.sort(), b.sort()\n\n\n\nans, amax = 0, a[-1]\n\nfor bi in b[::-1]:\n\n if bi <= amax or h<=0:\n\n break\n\n h -= bi\n\n ans += 1\n\nprint((ans + ((h + amax - 1) \/\/ amax) * (h > 0)))\n","target":"n, h = list(map(int, input().split()))\n\na, b = [], []\n\nfor _ in range(n):\n\n ai, bi = list(map(int, input().split()))\n\n a.append(ai), b.append(bi)\n\na.sort(), b.sort()\n\n\n\nans, amax = 0, a[-1]\n\nfor bi in b[::-1]:\n\n if bi <= amax or h <= 0:\n\n break\n\n h -= bi\n\n ans += 1\n\nprint((ans + (h + amax - 1) \/\/ amax if h > 0 else ans))\n","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":323,"code_v1_num_chars":331,"code_v0_no_empty_lines":"n, h = list(map(int, input().split()))\na, b = [], []\nfor _ in range(n):\n ai, bi = list(map(int, input().split()))\n a.append(ai), b.append(bi)\na.sort(), b.sort()\nans, amax = 0, a[-1]\nfor bi in b[::-1]:\n if bi <= amax or h <= 0:\n break\n h -= bi\n ans += 1\nprint((ans + ((h + amax - 1) \/\/ amax) * (h > 0)))\n","code_v1_no_empty_lines":"n, h = list(map(int, input().split()))\na, b = [], []\nfor _ in range(n):\n ai, bi = list(map(int, input().split()))\n a.append(ai), b.append(bi)\na.sort(), b.sort()\nans, amax = 0, a[-1]\nfor bi in b[::-1]:\n if bi <= amax or h <= 0:\n break\n h -= bi\n ans += 1\nprint((ans + (h + amax - 1) \/\/ amax if h > 0 else ans))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((ans + ((h + amax - 1) \/\/ amax) * (h > 0)))","+print((ans + (h + amax - 1) \/\/ amax if h > 0 else ans))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0472470362,"measured_runtime_v1":0.0392677886,"runtime_lift":1.203200838,"key":["s904298346","s991965062"]} +{"user_id":"u634461820","problem_id":"p03285","language":"python","submission_id_v0":"s431670201","submission_id_v1":"s479380304","cpu_time_v0":22,"cpu_time_v1":18,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"def judge(a):\n\n global flg\n\n if a % 4 == 0 or a % 7 == 0:\n\n flg = 1\n\n\n\nN = int(eval(input()))\n\nflg = 0\n\njudge(N)\n\n\n\nwhile N > 7:\n\n N -= 7\n\n judge(N)\n\n\n\nif flg == 1:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n","target":"N = int(eval(input()))\n\nf = 0\n\n\n\nif N % 4 == 0 or N % 7 == 0:\n\n f = 1\n\nelse:\n\n while N > 4:\n\n N -= 4\n\n if N % 7 == 0:\n\n f = 1\n\n break\n\n\n\nif f == 0:\n\n print(\"No\")\n\nelse:\n\n print(\"Yes\")","code_v0_loc":17,"code_v1_loc":16,"code_v0_num_chars":220,"code_v1_num_chars":225,"code_v0_no_empty_lines":"def judge(a):\n global flg\n if a % 4 == 0 or a % 7 == 0:\n flg = 1\n\n\nN = int(eval(input()))\nflg = 0\njudge(N)\nwhile N > 7:\n N -= 7\n judge(N)\nif flg == 1:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nf = 0\nif N % 4 == 0 or N % 7 == 0:\n f = 1\nelse:\n while N > 4:\n N -= 4\n if N % 7 == 0:\n f = 1\n break\nif f == 0:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-def judge(a):","- global flg","- if a % 4 == 0 or a % 7 == 0:","- flg = 1","-","-","-flg = 0","-judge(N)","-while N > 7:","- N -= 7","- judge(N)","-if flg == 1:","+f = 0","+if N % 4 == 0 or N % 7 == 0:","+ f = 1","+else:","+ while N > 4:","+ N -= 4","+ if N % 7 == 0:","+ f = 1","+ break","+if f == 0:","+ print(\"No\")","+else:","-else:","- print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0894639504,"measured_runtime_v1":0.042960907,"runtime_lift":2.0824502241,"key":["s431670201","s479380304"]} +{"user_id":"u584174687","problem_id":"p04013","language":"python","submission_id_v0":"s235725956","submission_id_v1":"s152421237","cpu_time_v0":964,"cpu_time_v1":522,"memory_v0":158344,"memory_v1":95324,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.85,"input":"from collections import Counter\n\n\n\ndef main():\n\n num, avg = list(map(int, input().split()))\n\n data = list(map(int, input().split()))\n\n\n\n dp = [[[0 for i in range(6000)] for j in range(num + 1)] for k in range(num + 1)]\n\n dp[0][0][0] = 1\n\n\n\n for i in range(1, num + 1):\n\n now_card = data[i - 1]\n\n for j in range(num + 1):\n\n for k in range(6000):\n\n # print(i, j, k)\n\n dp[i][j][k] += dp[i - 1][j][k]\n\n if k - now_card >= 0 and j - 1 >= 0:\n\n dp[i][j][k] += dp[i - 1][j - 1][k - now_card]\n\n # print(dp[i][j])\n\n\n\n ans = 0\n\n for i in range(1, num + 1):\n\n ans += dp[num][i][i * avg]\n\n print(ans)\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"from collections import Counter\n\n\n\ndef main():\n\n num, avg = list(map(int, input().split()))\n\n data = list(map(int, input().split()))\n\n \n\n max_num = max(num, avg, max(data))\n\n dp = [[[0 for i in range(max_num ** 2 + 1)] for j in range(num + 1)] for k in range(num + 1)]\n\n dp[0][0][0] = 1\n\n\n\n for i in range(1, num + 1):\n\n now_card = data[i - 1]\n\n for j in range(num + 1):\n\n for k in range(max_num ** 2 + 1):\n\n # print(i, j, k)\n\n dp[i][j][k] += dp[i - 1][j][k]\n\n if k - now_card >= 0 and j - 1 >= 0:\n\n dp[i][j][k] += dp[i - 1][j - 1][k - now_card]\n\n # print(dp[i][j])\n\n\n\n ans = 0\n\n for i in range(1, num + 1):\n\n ans += dp[num][i][i * avg]\n\n print(ans)\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":30,"code_v1_loc":31,"code_v0_num_chars":760,"code_v1_num_chars":828,"code_v0_no_empty_lines":"from collections import Counter\n\n\ndef main():\n num, avg = list(map(int, input().split()))\n data = list(map(int, input().split()))\n dp = [[[0 for i in range(6000)] for j in range(num + 1)] for k in range(num + 1)]\n dp[0][0][0] = 1\n for i in range(1, num + 1):\n now_card = data[i - 1]\n for j in range(num + 1):\n for k in range(6000):\n # print(i, j, k)\n dp[i][j][k] += dp[i - 1][j][k]\n if k - now_card >= 0 and j - 1 >= 0:\n dp[i][j][k] += dp[i - 1][j - 1][k - now_card]\n # print(dp[i][j])\n ans = 0\n for i in range(1, num + 1):\n ans += dp[num][i][i * avg]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import Counter\n\n\ndef main():\n num, avg = list(map(int, input().split()))\n data = list(map(int, input().split()))\n max_num = max(num, avg, max(data))\n dp = [\n [[0 for i in range(max_num**2 + 1)] for j in range(num + 1)]\n for k in range(num + 1)\n ]\n dp[0][0][0] = 1\n for i in range(1, num + 1):\n now_card = data[i - 1]\n for j in range(num + 1):\n for k in range(max_num**2 + 1):\n # print(i, j, k)\n dp[i][j][k] += dp[i - 1][j][k]\n if k - now_card >= 0 and j - 1 >= 0:\n dp[i][j][k] += dp[i - 1][j - 1][k - now_card]\n # print(dp[i][j])\n ans = 0\n for i in range(1, num + 1):\n ans += dp[num][i][i * avg]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["- dp = [[[0 for i in range(6000)] for j in range(num + 1)] for k in range(num + 1)]","+ max_num = max(num, avg, max(data))","+ dp = [","+ [[0 for i in range(max_num**2 + 1)] for j in range(num + 1)]","+ for k in range(num + 1)","+ ]","- for k in range(6000):","+ for k in range(max_num**2 + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.6022846699,"measured_runtime_v1":0.2001354218,"runtime_lift":3.0093856678,"key":["s235725956","s152421237"]} +{"user_id":"u157379742","problem_id":"p03039","language":"python","submission_id_v0":"s664544643","submission_id_v1":"s954832253","cpu_time_v0":233,"cpu_time_v1":207,"memory_v0":38768,"memory_v1":40916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.16,"input":"from collections import deque\n\nfrom heapq import heappush,heappop\n\nimport re\n\n\n\ndef int_raw():\n\n return int(eval(input()))\n\n\n\ndef ss_raw():\n\n return input().split()\n\n\n\ndef ints_raw():\n\n return list(map(int, ss_raw()))\n\n\n\nINF = 1<<29\n\n\n\nDIV = 10**9+7\n\n\n\ndef mod_inv(a,mod = DIV):\n\n return pow(a,mod-2,mod)\n\n\n\ndef ncr(n,r, mod =DIV):\n\n\tr = min(r,n-r)\n\n\tret = 1\n\n\tfor i in range(1,r+1):\n\n\t\tret = ret * (n-i+1) % mod\n\n\t\tret = ret * pow(i, mod-2, mod) % mod\n\n\treturn ret\n\n\n\n\n\ndef main():\n\n N, M,K = ints_raw()\n\n ans = 0\n\n for d in range(1,N):\n\n ans =(ans+d*(N-d)*M*M)%DIV\n\n for d in range(1,M):\n\n ans =(ans+d*(M-d)*N*N)%DIV\n\n return (ans*ncr(N*M-2,K-2))%DIV\n\nprint((main()))\n","target":"from collections import deque\n\nfrom heapq import heappush,heappop\n\nimport re\n\n\n\ndef int_raw():\n\n return int(eval(input()))\n\n\n\ndef ss_raw():\n\n return input().split()\n\n\n\ndef ints_raw():\n\n return list(map(int, ss_raw()))\n\n\n\nINF = 1<<29\n\n\n\nDIV = 10**9+7\n\n\n\ndef mod_inv_prime(a,mod = DIV):\n\n return pow(a,mod-2,mod)\n\n\n\ndef mod_inv(a,b):\n\n r = a\n\n w = b\n\n u = 1\n\n v = 0\n\n while w!=0:\n\n t = r\/\/w\n\n r -=t*w\n\n r,w = w,r\n\n u -= t*v\n\n u,v = v,u\n\n return (u%b+b)%b\n\n\n\ndef ncr(n,r, mod =DIV):\n\n\tr = min(r,n-r)\n\n\tret = 1\n\n\tfor i in range(1,r+1):\n\n\t\tret = ret * (n-i+1) % mod\n\n\t\tret = ret * mod_inv(i, mod) % mod\n\n\treturn ret\n\n\n\n\n\ndef main():\n\n N, M,K = ints_raw()\n\n ans = 0\n\n for d in range(1,N):\n\n ans =(ans+d*(N-d)*M*M)%DIV\n\n for d in range(1,M):\n\n ans =(ans+d*(M-d)*N*N)%DIV\n\n return (ans*ncr(N*M-2,K-2))%DIV\n\n\n\nif __name__ ==\"__main__\":\n\n print((main()))\n","code_v0_loc":38,"code_v1_loc":53,"code_v0_num_chars":703,"code_v1_num_chars":934,"code_v0_no_empty_lines":"from collections import deque\nfrom heapq import heappush, heappop\nimport re\n\n\ndef int_raw():\n return int(eval(input()))\n\n\ndef ss_raw():\n return input().split()\n\n\ndef ints_raw():\n return list(map(int, ss_raw()))\n\n\nINF = 1 << 29\nDIV = 10**9 + 7\n\n\ndef mod_inv(a, mod=DIV):\n return pow(a, mod - 2, mod)\n\n\ndef ncr(n, r, mod=DIV):\n r = min(r, n - r)\n ret = 1\n for i in range(1, r + 1):\n ret = ret * (n - i + 1) % mod\n ret = ret * pow(i, mod - 2, mod) % mod\n return ret\n\n\ndef main():\n N, M, K = ints_raw()\n ans = 0\n for d in range(1, N):\n ans = (ans + d * (N - d) * M * M) % DIV\n for d in range(1, M):\n ans = (ans + d * (M - d) * N * N) % DIV\n return (ans * ncr(N * M - 2, K - 2)) % DIV\n\n\nprint((main()))\n","code_v1_no_empty_lines":"from collections import deque\nfrom heapq import heappush, heappop\nimport re\n\n\ndef int_raw():\n return int(eval(input()))\n\n\ndef ss_raw():\n return input().split()\n\n\ndef ints_raw():\n return list(map(int, ss_raw()))\n\n\nINF = 1 << 29\nDIV = 10**9 + 7\n\n\ndef mod_inv_prime(a, mod=DIV):\n return pow(a, mod - 2, mod)\n\n\ndef mod_inv(a, b):\n r = a\n w = b\n u = 1\n v = 0\n while w != 0:\n t = r \/\/ w\n r -= t * w\n r, w = w, r\n u -= t * v\n u, v = v, u\n return (u % b + b) % b\n\n\ndef ncr(n, r, mod=DIV):\n r = min(r, n - r)\n ret = 1\n for i in range(1, r + 1):\n ret = ret * (n - i + 1) % mod\n ret = ret * mod_inv(i, mod) % mod\n return ret\n\n\ndef main():\n N, M, K = ints_raw()\n ans = 0\n for d in range(1, N):\n ans = (ans + d * (N - d) * M * M) % DIV\n for d in range(1, M):\n ans = (ans + d * (M - d) * N * N) % DIV\n return (ans * ncr(N * M - 2, K - 2)) % DIV\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_same":false,"relative_loc_diff_percent":28.3018867925,"diff":["-def mod_inv(a, mod=DIV):","+def mod_inv_prime(a, mod=DIV):","+","+","+def mod_inv(a, b):","+ r = a","+ w = b","+ u = 1","+ v = 0","+ while w != 0:","+ t = r \/\/ w","+ r -= t * w","+ r, w = w, r","+ u -= t * v","+ u, v = v, u","+ return (u % b + b) % b","- ret = ret * pow(i, mod - 2, mod) % mod","+ ret = ret * mod_inv(i, mod) % mod","-print((main()))","+if __name__ == \"__main__\":","+ print((main()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1123640227,"measured_runtime_v1":0.1059873672,"runtime_lift":1.0601642982,"key":["s664544643","s954832253"]} +{"user_id":"u489959379","problem_id":"p03476","language":"python","submission_id_v0":"s219615456","submission_id_v1":"s690623268","cpu_time_v0":762,"cpu_time_v1":588,"memory_v0":37256,"memory_v1":13328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.83,"input":"# https:\/\/atcoder.jp\/contests\/abc084\/tasks\/abc084_d\n\n# D - 2017-like Number\n\nimport sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\n# \u7d20\u6570\u5224\u5b9a\n\ndef is_prime(n):\n\n if n == 1:\n\n return False\n\n for k in range(2, int(pow(n, 0.5)) + 1):\n\n if n % k == 0:\n\n return False\n\n return True\n\n\n\n\n\ndef resolve():\n\n q = int(eval(input()))\n\n LR = [list(map(int, input().split())) for _ in range(q)]\n\n\n\n # 1\u3067\u3042\u308c\u30702017\u306b\u4f3c\u305f\u6574\u6570\u30010\u3067\u3042\u308c\u30702017\u306b\u4f3c\u3066\u3044\u306a\u3044\u6570\u5b57\n\n Lile_2017 = [0] * (10 ** 5 + 1)\n\n\n\n # \u7d20\u6570\u5224\u5b9a\u6e08\u307f\u914d\u5217\n\n prime = set()\n\n not_prime = set()\n\n\n\n # 1~100000\u304c2017\u306b\u4f3c\u305f\u6570\u304b\u3069\u3046\u304b\u5224\u5b9a\u3059\u308b\n\n for n in range(1, 10 ** 5 + 1):\n\n flg1, flg2 = False, False\n\n if n % 2 != 0:\n\n if n in prime:\n\n flg1 = True\n\n elif n in not_prime:\n\n flg1 = False\n\n else:\n\n flg1 = is_prime(n)\n\n prime.add(n) if flg1 else not_prime.add(n)\n\n\n\n if (n + 1) \/\/ 2 in prime:\n\n flg2 = True\n\n elif (n + 1) \/\/ 2 in not_prime:\n\n flg2 = False\n\n else:\n\n flg2 = is_prime((n + 1) \/\/ 2)\n\n prime.add((n + 1) \/\/ 2) if flg1 else not_prime.add((n + 1) \/\/ 2)\n\n\n\n Lile_2017[n - 1] += 1 if flg1 and flg2 else 0\n\n\n\n # 2017\u306b\u4f3c\u305f\u6570\u306e\u7d2f\u7a4d\u548c\u914d\u5217\u3092\u4f5c\u308b\n\n Ruiseki = [0]\n\n for i in range(1, 10 ** 5 + 1):\n\n Ruiseki.append(Ruiseki[-1] + Lile_2017[i - 1])\n\n\n\n # \u30af\u30a8\u30ea\u306b\u7b54\u3048\u308b\n\n for l, r in LR:\n\n print((Ruiseki[r] - Ruiseki[l - 1]))\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","target":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n def is_prime(n):\n\n if n == 1:\n\n return False\n\n for k in range(2, int(pow(n, 0.5)) + 1):\n\n if n % k == 0:\n\n return False\n\n return True\n\n\n\n q = int(eval(input()))\n\n primes = set()\n\n nums = set()\n\n for i in range(2, 10 ** 5 + 1):\n\n if is_prime(i):\n\n primes.add(i)\n\n if (i + 1) \/\/ 2 in primes:\n\n nums.add(i)\n\n\n\n cnt = [0]\n\n for i in range(1, 10 ** 5 + 1):\n\n op = 1 if i in nums else 0\n\n cnt.append(cnt[-1] + op)\n\n\n\n for _ in range(q):\n\n l, r = list(map(int, input().split()))\n\n res = cnt[r] - cnt[l - 1]\n\n print(res)\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","code_v0_loc":64,"code_v1_loc":38,"code_v0_num_chars":1572,"code_v1_num_chars":817,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc084\/tasks\/abc084_d\n# D - 2017-like Number\nimport sys\n\nsys.setrecursionlimit(10**7)\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n# \u7d20\u6570\u5224\u5b9a\ndef is_prime(n):\n if n == 1:\n return False\n for k in range(2, int(pow(n, 0.5)) + 1):\n if n % k == 0:\n return False\n return True\n\n\ndef resolve():\n q = int(eval(input()))\n LR = [list(map(int, input().split())) for _ in range(q)]\n # 1\u3067\u3042\u308c\u30702017\u306b\u4f3c\u305f\u6574\u6570\u30010\u3067\u3042\u308c\u30702017\u306b\u4f3c\u3066\u3044\u306a\u3044\u6570\u5b57\n Lile_2017 = [0] * (10**5 + 1)\n # \u7d20\u6570\u5224\u5b9a\u6e08\u307f\u914d\u5217\n prime = set()\n not_prime = set()\n # 1~100000\u304c2017\u306b\u4f3c\u305f\u6570\u304b\u3069\u3046\u304b\u5224\u5b9a\u3059\u308b\n for n in range(1, 10**5 + 1):\n flg1, flg2 = False, False\n if n % 2 != 0:\n if n in prime:\n flg1 = True\n elif n in not_prime:\n flg1 = False\n else:\n flg1 = is_prime(n)\n prime.add(n) if flg1 else not_prime.add(n)\n if (n + 1) \/\/ 2 in prime:\n flg2 = True\n elif (n + 1) \/\/ 2 in not_prime:\n flg2 = False\n else:\n flg2 = is_prime((n + 1) \/\/ 2)\n prime.add((n + 1) \/\/ 2) if flg1 else not_prime.add((n + 1) \/\/ 2)\n Lile_2017[n - 1] += 1 if flg1 and flg2 else 0\n # 2017\u306b\u4f3c\u305f\u6570\u306e\u7d2f\u7a4d\u548c\u914d\u5217\u3092\u4f5c\u308b\n Ruiseki = [0]\n for i in range(1, 10**5 + 1):\n Ruiseki.append(Ruiseki[-1] + Lile_2017[i - 1])\n # \u30af\u30a8\u30ea\u306b\u7b54\u3048\u308b\n for l, r in LR:\n print((Ruiseki[r] - Ruiseki[l - 1]))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef resolve():\n def is_prime(n):\n if n == 1:\n return False\n for k in range(2, int(pow(n, 0.5)) + 1):\n if n % k == 0:\n return False\n return True\n\n q = int(eval(input()))\n primes = set()\n nums = set()\n for i in range(2, 10**5 + 1):\n if is_prime(i):\n primes.add(i)\n if (i + 1) \/\/ 2 in primes:\n nums.add(i)\n cnt = [0]\n for i in range(1, 10**5 + 1):\n op = 1 if i in nums else 0\n cnt.append(cnt[-1] + op)\n for _ in range(q):\n l, r = list(map(int, input().split()))\n res = cnt[r] - cnt[l - 1]\n print(res)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":40.625,"diff":["-# https:\/\/atcoder.jp\/contests\/abc084\/tasks\/abc084_d","-# D - 2017-like Number","-# \u7d20\u6570\u5224\u5b9a","-def is_prime(n):","- if n == 1:","- return False","- for k in range(2, int(pow(n, 0.5)) + 1):","- if n % k == 0:","- return False","- return True","+ def is_prime(n):","+ if n == 1:","+ return False","+ for k in range(2, int(pow(n, 0.5)) + 1):","+ if n % k == 0:","+ return False","+ return True","+","- LR = [list(map(int, input().split())) for _ in range(q)]","- # 1\u3067\u3042\u308c\u30702017\u306b\u4f3c\u305f\u6574\u6570\u30010\u3067\u3042\u308c\u30702017\u306b\u4f3c\u3066\u3044\u306a\u3044\u6570\u5b57","- Lile_2017 = [0] * (10**5 + 1)","- # \u7d20\u6570\u5224\u5b9a\u6e08\u307f\u914d\u5217","- prime = set()","- not_prime = set()","- # 1~100000\u304c2017\u306b\u4f3c\u305f\u6570\u304b\u3069\u3046\u304b\u5224\u5b9a\u3059\u308b","- for n in range(1, 10**5 + 1):","- flg1, flg2 = False, False","- if n % 2 != 0:","- if n in prime:","- flg1 = True","- elif n in not_prime:","- flg1 = False","- else:","- flg1 = is_prime(n)","- prime.add(n) if flg1 else not_prime.add(n)","- if (n + 1) \/\/ 2 in prime:","- flg2 = True","- elif (n + 1) \/\/ 2 in not_prime:","- flg2 = False","- else:","- flg2 = is_prime((n + 1) \/\/ 2)","- prime.add((n + 1) \/\/ 2) if flg1 else not_prime.add((n + 1) \/\/ 2)","- Lile_2017[n - 1] += 1 if flg1 and flg2 else 0","- # 2017\u306b\u4f3c\u305f\u6570\u306e\u7d2f\u7a4d\u548c\u914d\u5217\u3092\u4f5c\u308b","- Ruiseki = [0]","+ primes = set()","+ nums = set()","+ for i in range(2, 10**5 + 1):","+ if is_prime(i):","+ primes.add(i)","+ if (i + 1) \/\/ 2 in primes:","+ nums.add(i)","+ cnt = [0]","- Ruiseki.append(Ruiseki[-1] + Lile_2017[i - 1])","- # \u30af\u30a8\u30ea\u306b\u7b54\u3048\u308b","- for l, r in LR:","- print((Ruiseki[r] - Ruiseki[l - 1]))","+ op = 1 if i in nums else 0","+ cnt.append(cnt[-1] + op)","+ for _ in range(q):","+ l, r = list(map(int, input().split()))","+ res = cnt[r] - cnt[l - 1]","+ print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.8664066994,"measured_runtime_v1":1.0048793828,"runtime_lift":0.862199697,"key":["s219615456","s690623268"]} +{"user_id":"u197300773","problem_id":"p03061","language":"python","submission_id_v0":"s761935406","submission_id_v1":"s028803762","cpu_time_v0":197,"cpu_time_v1":175,"memory_v0":14400,"memory_v1":14436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.17,"input":"def gcd(x, y):\n\n if y > x:\n\n x, y = y, x\n\n while y:\n\n x, y = y, x % y\n\n return x\n\n\n\nN=int(eval(input()))\n\na=list(map(int,input().split()))\n\n\n\nl=[0]*N\n\nl[0]=a[0]\n\nfor i in range(1,N):\n\n l[i]=gcd(l[i-1],a[i])\n\n\n\nr=[0]*N\n\nr[N-1]=a[N-1]\n\nfor i in range(N-2,-1,-1):\n\n r[i]=gcd(r[i+1],a[i])\n\n\n\nans=max(r[1],l[N-2])\n\nfor i in range(1,N-1):\n\n tmp=gcd(l[i-1],r[i+1])\n\n ans=max(tmp,ans)\n\n\n\nprint(ans)","target":"def gcd(x, y):\n\n if y > x:\n\n x, y = y, x\n\n while y:\n\n x, y = y, x % y\n\n return x\n\n\n\nN=int(eval(input()))\n\na=list(map(int,input().split()))\n\n\n\nl=[0]*N\n\nl[0]=a[0]\n\nfor i in range(1,N):\n\n l[i]=gcd(l[i-1],a[i])\n\n\n\nr=[0]*N\n\nr[N-1]=a[N-1]\n\nfor i in range(N-2,-1,-1):\n\n r[i]=gcd(r[i+1],a[i])\n\n\n\nans=max(r[1],l[N-2])\n\nfor i in range(1,N-1):\n\n tmp=gcd(l[i-1],r[i+1])\n\n if tmp>ans: ans=tmp\n\n\n\nprint(ans)","code_v0_loc":26,"code_v1_loc":26,"code_v0_num_chars":419,"code_v1_num_chars":422,"code_v0_no_empty_lines":"def gcd(x, y):\n if y > x:\n x, y = y, x\n while y:\n x, y = y, x % y\n return x\n\n\nN = int(eval(input()))\na = list(map(int, input().split()))\nl = [0] * N\nl[0] = a[0]\nfor i in range(1, N):\n l[i] = gcd(l[i - 1], a[i])\nr = [0] * N\nr[N - 1] = a[N - 1]\nfor i in range(N - 2, -1, -1):\n r[i] = gcd(r[i + 1], a[i])\nans = max(r[1], l[N - 2])\nfor i in range(1, N - 1):\n tmp = gcd(l[i - 1], r[i + 1])\n ans = max(tmp, ans)\nprint(ans)\n","code_v1_no_empty_lines":"def gcd(x, y):\n if y > x:\n x, y = y, x\n while y:\n x, y = y, x % y\n return x\n\n\nN = int(eval(input()))\na = list(map(int, input().split()))\nl = [0] * N\nl[0] = a[0]\nfor i in range(1, N):\n l[i] = gcd(l[i - 1], a[i])\nr = [0] * N\nr[N - 1] = a[N - 1]\nfor i in range(N - 2, -1, -1):\n r[i] = gcd(r[i + 1], a[i])\nans = max(r[1], l[N - 2])\nfor i in range(1, N - 1):\n tmp = gcd(l[i - 1], r[i + 1])\n if tmp > ans:\n ans = tmp\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- ans = max(tmp, ans)","+ if tmp > ans:","+ ans = tmp"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450989223,"measured_runtime_v1":0.0379761724,"runtime_lift":1.1875583908,"key":["s761935406","s028803762"]} +{"user_id":"u203843959","problem_id":"p02769","language":"python","submission_id_v0":"s396632549","submission_id_v1":"s269089294","cpu_time_v0":365,"cpu_time_v1":316,"memory_v0":11052,"memory_v1":11052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.42,"input":"import sys\n\nsys.setrecursionlimit(10**9)\n\n\n\nMOD=10**9+7\n\nn,k=list(map(int,input().split()))\n\n\n\nif k>=n-1:\n\n k=n-1\n\n\n\ninv_table = [0]+[1]\n\nfor i in range(2,k+1):\n\n inv_table+=[inv_table[MOD%i]*(MOD-int(MOD\/i))%MOD]\n\n\n\ncomb_sum=1\n\nfact=1\n\ncomb1=1\n\ncomb2=1\n\nfor i in range(1,k+1):\n\n comb1=(comb1*(n-i+1)*inv_table[i])%MOD\n\n comb2=(comb2*(n-i)*inv_table[i])%MOD\n\n comb=(comb1*comb2)%MOD\n\n comb_sum+=comb\n\n\n\nprint((comb_sum%MOD))","target":"import sys\n\nsys.setrecursionlimit(10**9)\n\n\n\nMOD=10**9+7\n\nn,k=list(map(int,input().split()))\n\n\n\nif k>=n-1:\n\n k=n-1\n\n\n\ninv_table = [0]+[1]\n\nfor i in range(2,k+1):\n\n inv_table.append(-1*(MOD\/\/i)*inv_table[MOD%i] %MOD)\n\n\n\ncomb_sum=1\n\nfact=1\n\ncomb1=1\n\ncomb2=1\n\nfor i in range(1,k+1):\n\n comb1=(comb1*(n-i+1)*inv_table[i])%MOD\n\n comb2=(comb2*(n-i)*inv_table[i])%MOD\n\n comb=(comb1*comb2)%MOD\n\n comb_sum+=comb\n\n\n\nprint((comb_sum%MOD))","code_v0_loc":24,"code_v1_loc":24,"code_v0_num_chars":422,"code_v1_num_chars":423,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nMOD = 10**9 + 7\nn, k = list(map(int, input().split()))\nif k >= n - 1:\n k = n - 1\ninv_table = [0] + [1]\nfor i in range(2, k + 1):\n inv_table += [inv_table[MOD % i] * (MOD - int(MOD \/ i)) % MOD]\ncomb_sum = 1\nfact = 1\ncomb1 = 1\ncomb2 = 1\nfor i in range(1, k + 1):\n comb1 = (comb1 * (n - i + 1) * inv_table[i]) % MOD\n comb2 = (comb2 * (n - i) * inv_table[i]) % MOD\n comb = (comb1 * comb2) % MOD\n comb_sum += comb\nprint((comb_sum % MOD))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nMOD = 10**9 + 7\nn, k = list(map(int, input().split()))\nif k >= n - 1:\n k = n - 1\ninv_table = [0] + [1]\nfor i in range(2, k + 1):\n inv_table.append(-1 * (MOD \/\/ i) * inv_table[MOD % i] % MOD)\ncomb_sum = 1\nfact = 1\ncomb1 = 1\ncomb2 = 1\nfor i in range(1, k + 1):\n comb1 = (comb1 * (n - i + 1) * inv_table[i]) % MOD\n comb2 = (comb2 * (n - i) * inv_table[i]) % MOD\n comb = (comb1 * comb2) % MOD\n comb_sum += comb\nprint((comb_sum % MOD))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- inv_table += [inv_table[MOD % i] * (MOD - int(MOD \/ i)) % MOD]","+ inv_table.append(-1 * (MOD \/\/ i) * inv_table[MOD % i] % MOD)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1462175453,"measured_runtime_v1":0.4593861973,"runtime_lift":0.3182889388,"key":["s396632549","s269089294"]} +{"user_id":"u658993896","problem_id":"p03855","language":"python","submission_id_v0":"s503701502","submission_id_v1":"s061211755","cpu_time_v0":1800,"cpu_time_v1":1445,"memory_v0":88088,"memory_v1":101328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.72,"input":"import sys\n\n\n\nsys.setrecursionlimit(10**6)\n\ndef bps(gr,p,s,num):\n\n if gr[s]!=-1:\n\n return\n\n gr[s]=num\n\n for x in p[s]:\n\n bps(gr,p,x,num)\n\n\n\nN,K,L=list(map(int,input().split()))\n\ndic={}\n\nroad=[[] for _ in range(N)]\n\nrail=[[] for _ in range(N)]\n\n\n\nfor i in range(K):\n\n p,q=list(map(int,input().split()))\n\n road[p-1].append(q-1)\n\n road[q-1].append(p-1)\n\n\n\nfor i in range(L):\n\n r,s=list(map(int,input().split()))\n\n rail[r-1].append(s-1)\n\n rail[s-1].append(r-1)\n\n\n\n\n\nroadG=[-1 for _ in range(N)]\n\nnum=0\n\nfor i in range(N):\n\n if roadG[i]==-1:\n\n bps(roadG,road,i,num)\n\n num+=1\n\n\n\nrailG=[-1 for _ in range(N)]\n\nnum=0\n\nfor i in range(N):\n\n if railG[i]==-1:\n\n bps(railG,rail,i,num)\n\n num+=1\n\ndic={}\n\narr=[]\n\nfor i in range(N):\n\n key=roadG[i]*N+railG[i]\n\n arr.append(key)\n\n dic[key]=dic.setdefault(key,0)+1\n\nprint(dic[arr[0]],end='')\n\nfor x in arr[1:]:\n\n print(' {}'.format(dic[x]),end='')\n\nprint('')\n","target":"import sys\n\n\n\nsys.setrecursionlimit(10**6)\n\ndef dps(gr,p,s,num):\n\n if gr[s]!=-1:\n\n return\n\n gr[s]=num\n\n for x in p[s]:\n\n dps(gr,p,x,num)\n\n\n\nN,K,L=list(map(int,input().split()))\n\ndic={}\n\nroad=[[] for _ in range(N)]\n\nrail=[[] for _ in range(N)]\n\n\n\nfor i in range(K):\n\n p,q=list(map(int,input().split()))\n\n road[p-1].append(q-1)\n\n road[q-1].append(p-1)\n\n\n\nfor i in range(L):\n\n r,s=list(map(int,input().split()))\n\n rail[r-1].append(s-1)\n\n rail[s-1].append(r-1)\n\n\n\n\n\nroadG=[-1 for _ in range(N)]\n\nnum=0\n\nfor i in range(N):\n\n if roadG[i]==-1:\n\n dps(roadG,road,i,num)\n\n num+=1\n\n\n\nrailG=[-1 for _ in range(N)]\n\nnum=0\n\nfor i in range(N):\n\n if railG[i]==-1:\n\n dps(railG,rail,i,num)\n\n num+=1\n\ndic={}\n\narr=[]\n\nfor i in range(N):\n\n key=(roadG[i],railG[i])\n\n arr.append(key)\n\n dic[key]=dic.setdefault(key,0)+1\n\nprint((' '.join([str(dic[x]) for x in arr])))","code_v0_loc":49,"code_v1_loc":46,"code_v0_num_chars":976,"code_v1_num_chars":924,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef bps(gr, p, s, num):\n if gr[s] != -1:\n return\n gr[s] = num\n for x in p[s]:\n bps(gr, p, x, num)\n\n\nN, K, L = list(map(int, input().split()))\ndic = {}\nroad = [[] for _ in range(N)]\nrail = [[] for _ in range(N)]\nfor i in range(K):\n p, q = list(map(int, input().split()))\n road[p - 1].append(q - 1)\n road[q - 1].append(p - 1)\nfor i in range(L):\n r, s = list(map(int, input().split()))\n rail[r - 1].append(s - 1)\n rail[s - 1].append(r - 1)\nroadG = [-1 for _ in range(N)]\nnum = 0\nfor i in range(N):\n if roadG[i] == -1:\n bps(roadG, road, i, num)\n num += 1\nrailG = [-1 for _ in range(N)]\nnum = 0\nfor i in range(N):\n if railG[i] == -1:\n bps(railG, rail, i, num)\n num += 1\ndic = {}\narr = []\nfor i in range(N):\n key = roadG[i] * N + railG[i]\n arr.append(key)\n dic[key] = dic.setdefault(key, 0) + 1\nprint(dic[arr[0]], end=\"\")\nfor x in arr[1:]:\n print(\" {}\".format(dic[x]), end=\"\")\nprint(\"\")\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef dps(gr, p, s, num):\n if gr[s] != -1:\n return\n gr[s] = num\n for x in p[s]:\n dps(gr, p, x, num)\n\n\nN, K, L = list(map(int, input().split()))\ndic = {}\nroad = [[] for _ in range(N)]\nrail = [[] for _ in range(N)]\nfor i in range(K):\n p, q = list(map(int, input().split()))\n road[p - 1].append(q - 1)\n road[q - 1].append(p - 1)\nfor i in range(L):\n r, s = list(map(int, input().split()))\n rail[r - 1].append(s - 1)\n rail[s - 1].append(r - 1)\nroadG = [-1 for _ in range(N)]\nnum = 0\nfor i in range(N):\n if roadG[i] == -1:\n dps(roadG, road, i, num)\n num += 1\nrailG = [-1 for _ in range(N)]\nnum = 0\nfor i in range(N):\n if railG[i] == -1:\n dps(railG, rail, i, num)\n num += 1\ndic = {}\narr = []\nfor i in range(N):\n key = (roadG[i], railG[i])\n arr.append(key)\n dic[key] = dic.setdefault(key, 0) + 1\nprint((\" \".join([str(dic[x]) for x in arr])))\n","code_same":false,"relative_loc_diff_percent":6.1224489796,"diff":["-def bps(gr, p, s, num):","+def dps(gr, p, s, num):","- bps(gr, p, x, num)","+ dps(gr, p, x, num)","- bps(roadG, road, i, num)","+ dps(roadG, road, i, num)","- bps(railG, rail, i, num)","+ dps(railG, rail, i, num)","- key = roadG[i] * N + railG[i]","+ key = (roadG[i], railG[i])","-print(dic[arr[0]], end=\"\")","-for x in arr[1:]:","- print(\" {}\".format(dic[x]), end=\"\")","-print(\"\")","+print((\" \".join([str(dic[x]) for x in arr])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0461229801,"measured_runtime_v1":0.0448035717,"runtime_lift":1.0294487327,"key":["s503701502","s061211755"]} +{"user_id":"u028973125","problem_id":"p02936","language":"python","submission_id_v0":"s702943834","submission_id_v1":"s854963462","cpu_time_v0":1294,"cpu_time_v1":909,"memory_v0":81568,"memory_v1":129756,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.75,"input":"from pprint import pprint\n\nfrom collections import deque, defaultdict\n\n \n\nimport sys\n\n \n\n# n, q = map(int, input().strip().split(\" \"))\n\nn, q = list(map(int, sys.stdin.readline().strip().split(\" \")))\n\nedges = [[] for _ in range(n)]\n\nfor _ in range(n-1):\n\n # a_i, b_i = map(int, input().strip().split(\" \"))\n\n a_i, b_i = list(map(int, sys.stdin.readline().strip().split(\" \")))\n\n edges[a_i-1].append(b_i-1)\n\n edges[b_i-1].append(a_i-1)\n\n \n\ncounter = [0] * n\n\np = [0] * n\n\nfor _ in range(q):\n\n # p_i, x_i = map(int, input().strip().split(\" \"))\n\n p_i, x_i = list(map(int, sys.stdin.readline().strip().split(\" \")))\n\n p[p_i-1] += x_i\n\n # counter[p_i-1] += x_i\n\n \n\n \n\nparents = deque()\n\nparents.append(0)\n\nvisited = set()\n\nwhile parents:\n\n parent = parents.popleft()\n\n if parent in visited:\n\n continue\n\n counter[parent] += p[parent]\n\n visited.add(parent)\n\n for child in edges[parent]:\n\n if child in visited:\n\n continue\n\n counter[child] += counter[parent]\n\n # print(\"child\")\n\n # print(child, counter[child])\n\n parents.append(child)\n\n \n\nprint((\" \".join(list(map(str, counter)))))","target":"import sys\n\nfrom collections import deque\n\n\n\nN, Q = list(map(int, sys.stdin.readline().split(\" \")))\n\n\n\nedges = [[] for _ in range(N)]\n\nfor _ in range(N-1):\n\n a, b = list(map(int, sys.stdin.readline().split(\" \")))\n\n # print(a, b)\n\n edges[a-1].append(b-1)\n\n edges[b-1].append(a-1)\n\n# print(edges)\n\n# sys.exit()\n\n\n\npoints = [0] * N\n\nfor _ in range(Q):\n\n p, x = list(map(int, sys.stdin.readline().split(\" \")))\n\n points[p-1] += x\n\n\n\n\n\nvisited = set()\n\ncounted = [0] * N\n\nq = deque([(0, points[0])])\n\nwhile q:\n\n node, point = q.popleft()\n\n # print(node, point)\n\n if node in visited:\n\n continue\n\n counted[node] = str(point)\n\n visited.add(node)\n\n for edge in edges[node]:\n\n q.appendleft((edge, point + points[edge]))\n\n\n\nprint((\" \".join(counted)))","code_v0_loc":41,"code_v1_loc":34,"code_v0_num_chars":1140,"code_v1_num_chars":768,"code_v0_no_empty_lines":"from pprint import pprint\nfrom collections import deque, defaultdict\nimport sys\n\n# n, q = map(int, input().strip().split(\" \"))\nn, q = list(map(int, sys.stdin.readline().strip().split(\" \")))\nedges = [[] for _ in range(n)]\nfor _ in range(n - 1):\n # a_i, b_i = map(int, input().strip().split(\" \"))\n a_i, b_i = list(map(int, sys.stdin.readline().strip().split(\" \")))\n edges[a_i - 1].append(b_i - 1)\n edges[b_i - 1].append(a_i - 1)\ncounter = [0] * n\np = [0] * n\nfor _ in range(q):\n # p_i, x_i = map(int, input().strip().split(\" \"))\n p_i, x_i = list(map(int, sys.stdin.readline().strip().split(\" \")))\n p[p_i - 1] += x_i\n # counter[p_i-1] += x_i\nparents = deque()\nparents.append(0)\nvisited = set()\nwhile parents:\n parent = parents.popleft()\n if parent in visited:\n continue\n counter[parent] += p[parent]\n visited.add(parent)\n for child in edges[parent]:\n if child in visited:\n continue\n counter[child] += counter[parent]\n # print(\"child\")\n # print(child, counter[child])\n parents.append(child)\nprint((\" \".join(list(map(str, counter)))))\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque\n\nN, Q = list(map(int, sys.stdin.readline().split(\" \")))\nedges = [[] for _ in range(N)]\nfor _ in range(N - 1):\n a, b = list(map(int, sys.stdin.readline().split(\" \")))\n # print(a, b)\n edges[a - 1].append(b - 1)\n edges[b - 1].append(a - 1)\n# print(edges)\n# sys.exit()\npoints = [0] * N\nfor _ in range(Q):\n p, x = list(map(int, sys.stdin.readline().split(\" \")))\n points[p - 1] += x\nvisited = set()\ncounted = [0] * N\nq = deque([(0, points[0])])\nwhile q:\n node, point = q.popleft()\n # print(node, point)\n if node in visited:\n continue\n counted[node] = str(point)\n visited.add(node)\n for edge in edges[node]:\n q.appendleft((edge, point + points[edge]))\nprint((\" \".join(counted)))\n","code_same":false,"relative_loc_diff_percent":17.0731707317,"diff":["-from pprint import pprint","-from collections import deque, defaultdict","+from collections import deque","-# n, q = map(int, input().strip().split(\" \"))","-n, q = list(map(int, sys.stdin.readline().strip().split(\" \")))","-edges = [[] for _ in range(n)]","-for _ in range(n - 1):","- # a_i, b_i = map(int, input().strip().split(\" \"))","- a_i, b_i = list(map(int, sys.stdin.readline().strip().split(\" \")))","- edges[a_i - 1].append(b_i - 1)","- edges[b_i - 1].append(a_i - 1)","-counter = [0] * n","-p = [0] * n","-for _ in range(q):","- # p_i, x_i = map(int, input().strip().split(\" \"))","- p_i, x_i = list(map(int, sys.stdin.readline().strip().split(\" \")))","- p[p_i - 1] += x_i","- # counter[p_i-1] += x_i","-parents = deque()","-parents.append(0)","+N, Q = list(map(int, sys.stdin.readline().split(\" \")))","+edges = [[] for _ in range(N)]","+for _ in range(N - 1):","+ a, b = list(map(int, sys.stdin.readline().split(\" \")))","+ # print(a, b)","+ edges[a - 1].append(b - 1)","+ edges[b - 1].append(a - 1)","+# print(edges)","+# sys.exit()","+points = [0] * N","+for _ in range(Q):","+ p, x = list(map(int, sys.stdin.readline().split(\" \")))","+ points[p - 1] += x","-while parents:","- parent = parents.popleft()","- if parent in visited:","+counted = [0] * N","+q = deque([(0, points[0])])","+while q:","+ node, point = q.popleft()","+ # print(node, point)","+ if node in visited:","- counter[parent] += p[parent]","- visited.add(parent)","- for child in edges[parent]:","- if child in visited:","- continue","- counter[child] += counter[parent]","- # print(\"child\")","- # print(child, counter[child])","- parents.append(child)","-print((\" \".join(list(map(str, counter)))))","+ counted[node] = str(point)","+ visited.add(node)","+ for edge in edges[node]:","+ q.appendleft((edge, point + points[edge]))","+print((\" \".join(counted)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.037137466,"measured_runtime_v1":0.1042428984,"runtime_lift":0.3562589549,"key":["s702943834","s854963462"]} +{"user_id":"u608088992","problem_id":"p02881","language":"python","submission_id_v0":"s662550708","submission_id_v1":"s443179123","cpu_time_v0":486,"cpu_time_v1":392,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.34,"input":"N = int(eval(input()))\n\nans = 10 ** 20\n\nfor i in range(1, 10 ** 6 + 1):\n\n if i ** 2 > N: break\n\n if N % i == 0:\n\n ans = min(ans, i + N \/\/ i - 2)\n\nprint(ans)","target":"import sys\n\ndef solve():\n\n N = int(eval(input()))\n\n moveN = 10000000000000000000\n\n for i in range(1, N + 1):\n\n if i ** 2 > N: break\n\n if N % i == 0:\n\n moveN = min(i + (N \/\/ i) - 2, moveN)\n\n print(moveN)\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":7,"code_v1_loc":14,"code_v0_num_chars":163,"code_v1_num_chars":292,"code_v0_no_empty_lines":"N = int(eval(input()))\nans = 10**20\nfor i in range(1, 10**6 + 1):\n if i**2 > N:\n break\n if N % i == 0:\n ans = min(ans, i + N \/\/ i - 2)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\n\ndef solve():\n N = int(eval(input()))\n moveN = 10000000000000000000\n for i in range(1, N + 1):\n if i**2 > N:\n break\n if N % i == 0:\n moveN = min(i + (N \/\/ i) - 2, moveN)\n print(moveN)\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-N = int(eval(input()))","-ans = 10**20","-for i in range(1, 10**6 + 1):","- if i**2 > N:","- break","- if N % i == 0:","- ans = min(ans, i + N \/\/ i - 2)","-print(ans)","+import sys","+","+","+def solve():","+ N = int(eval(input()))","+ moveN = 10000000000000000000","+ for i in range(1, N + 1):","+ if i**2 > N:","+ break","+ if N % i == 0:","+ moveN = min(i + (N \/\/ i) - 2, moveN)","+ print(moveN)","+ return 0","+","+","+if __name__ == \"__main__\":","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0433307514,"measured_runtime_v1":0.1158292618,"runtime_lift":0.3740915788,"key":["s662550708","s443179123"]} +{"user_id":"u829735607","problem_id":"p02947","language":"python","submission_id_v0":"s412810718","submission_id_v1":"s706506612","cpu_time_v0":704,"cpu_time_v1":291,"memory_v0":27544,"memory_v1":21516,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.66,"input":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import accumulate, permutations, combinations, product\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\ndef comb_count(n, r):\n\n return factorial(n) \/\/ (factorial(n - r) * factorial(r))\n\n\n\nN = INT()\n\nS = [eval(input()) for _ in range(N)]\n\nfor i in range(N):\n\n\tS[i] = sorted(S[i])\n\nS = sorted(S)\n\n\n\nku = []\n\nkugiri = 0\n\nfor i in range(N - 1):\n\n\tif S[i] == S[i + 1]:\n\n\t\tkugiri += 1\n\n\t\tif i == N - 2:\n\n\t\t\tku.append(kugiri + 1)\n\n\n\n\telse:\n\n\t\tku.append(kugiri + 1)\n\n\t\tkugiri = 0\n\n\n\nwa = 0\n\nfor i in range(len(ku)):\n\n\tif ku[i] == 1:\n\n\t\tcontinue\n\n\twa += comb_count(ku[i], 2)\n\n\n\nprint(wa)","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import accumulate, permutations, combinations, product\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\ndef comb_count(n, r):\n\n return factorial(n) \/\/ (factorial(n - r) * factorial(r))\n\n\n\nN = INT()\n\nS = [\"\".join(sorted(eval(input()))) for _ in range(N)]\n\n\n\ndic = defaultdict(int)\n\nfor x in S:\n\n\tdic[x] += 1\n\n\n\nwa = 0\n\nfor n in list(dic.values()):\n\n\twa += int(n*(n - 1)\/2)\n\n\n\nprint(wa)","code_v0_loc":47,"code_v1_loc":34,"code_v0_num_chars":1193,"code_v1_num_chars":993,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import accumulate, permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef comb_count(n, r):\n return factorial(n) \/\/ (factorial(n - r) * factorial(r))\n\n\nN = INT()\nS = [eval(input()) for _ in range(N)]\nfor i in range(N):\n S[i] = sorted(S[i])\nS = sorted(S)\nku = []\nkugiri = 0\nfor i in range(N - 1):\n if S[i] == S[i + 1]:\n kugiri += 1\n if i == N - 2:\n ku.append(kugiri + 1)\n else:\n ku.append(kugiri + 1)\n kugiri = 0\nwa = 0\nfor i in range(len(ku)):\n if ku[i] == 1:\n continue\n wa += comb_count(ku[i], 2)\nprint(wa)\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import accumulate, permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef comb_count(n, r):\n return factorial(n) \/\/ (factorial(n - r) * factorial(r))\n\n\nN = INT()\nS = [\"\".join(sorted(eval(input()))) for _ in range(N)]\ndic = defaultdict(int)\nfor x in S:\n dic[x] += 1\nwa = 0\nfor n in list(dic.values()):\n wa += int(n * (n - 1) \/ 2)\nprint(wa)\n","code_same":false,"relative_loc_diff_percent":27.6595744681,"diff":["-S = [eval(input()) for _ in range(N)]","-for i in range(N):","- S[i] = sorted(S[i])","-S = sorted(S)","-ku = []","-kugiri = 0","-for i in range(N - 1):","- if S[i] == S[i + 1]:","- kugiri += 1","- if i == N - 2:","- ku.append(kugiri + 1)","- else:","- ku.append(kugiri + 1)","- kugiri = 0","+S = [\"\".join(sorted(eval(input()))) for _ in range(N)]","+dic = defaultdict(int)","+for x in S:","+ dic[x] += 1","-for i in range(len(ku)):","- if ku[i] == 1:","- continue","- wa += comb_count(ku[i], 2)","+for n in list(dic.values()):","+ wa += int(n * (n - 1) \/ 2)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0357833836,"measured_runtime_v1":0.0697641442,"runtime_lift":0.512919409,"key":["s412810718","s706506612"]} +{"user_id":"u124605948","problem_id":"p02756","language":"python","submission_id_v0":"s391108594","submission_id_v1":"s088459144","cpu_time_v0":349,"cpu_time_v1":304,"memory_v0":34876,"memory_v1":15780,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.89,"input":"def main():\n\n from collections import deque\n\n s = deque(eval(input()))\n\n q = int(eval(input()))\n\n\n\n flag = 0\n\n query = []\n\n\n\n for _ in range(q):\n\n temp = input().split()\n\n if len(temp) == 1:\n\n flag += 1\n\n else:\n\n query.append(temp + [flag%2])\n\n\n\n for q in query:\n\n if q[-1] == 0:\n\n if q[1] == \"1\":\n\n s.appendleft(q[2])\n\n else:\n\n s.append(q[2])\n\n else:\n\n if q[1] == \"1\":\n\n s.append(q[2])\n\n else:\n\n s.appendleft(q[2])\n\n\n\n if flag % 2 == 1:\n\n print((\"\".join(list(s)[::-1])))\n\n else:\n\n print((\"\".join(s)))\n\n\n\nmain()\n","target":"from collections import deque\n\n\n\ns = deque(eval(input()))\n\nq = int(eval(input()))\n\n\n\nflag = True\n\nfor _ in range(q):\n\n temp = input().split()\n\n if len(temp) == 1:\n\n flag = not flag\n\n else:\n\n if flag:\n\n if temp[1] == \"1\":\n\n s.appendleft(temp[2])\n\n else:\n\n s.append(temp[2])\n\n else:\n\n if temp[1] == \"1\":\n\n s.append(temp[2])\n\n else:\n\n s.appendleft(temp[2])\n\n\n\nif flag:\n\n print((\"\".join(s)))\n\nelse:\n\n print((\"\".join(list(s)[::-1])))","code_v0_loc":33,"code_v1_loc":26,"code_v0_num_chars":698,"code_v1_num_chars":552,"code_v0_no_empty_lines":"def main():\n from collections import deque\n\n s = deque(eval(input()))\n q = int(eval(input()))\n flag = 0\n query = []\n for _ in range(q):\n temp = input().split()\n if len(temp) == 1:\n flag += 1\n else:\n query.append(temp + [flag % 2])\n for q in query:\n if q[-1] == 0:\n if q[1] == \"1\":\n s.appendleft(q[2])\n else:\n s.append(q[2])\n else:\n if q[1] == \"1\":\n s.append(q[2])\n else:\n s.appendleft(q[2])\n if flag % 2 == 1:\n print((\"\".join(list(s)[::-1])))\n else:\n print((\"\".join(s)))\n\n\nmain()\n","code_v1_no_empty_lines":"from collections import deque\n\ns = deque(eval(input()))\nq = int(eval(input()))\nflag = True\nfor _ in range(q):\n temp = input().split()\n if len(temp) == 1:\n flag = not flag\n else:\n if flag:\n if temp[1] == \"1\":\n s.appendleft(temp[2])\n else:\n s.append(temp[2])\n else:\n if temp[1] == \"1\":\n s.append(temp[2])\n else:\n s.appendleft(temp[2])\nif flag:\n print((\"\".join(s)))\nelse:\n print((\"\".join(list(s)[::-1])))\n","code_same":false,"relative_loc_diff_percent":21.2121212121,"diff":["-def main():","- from collections import deque","+from collections import deque","- s = deque(eval(input()))","- q = int(eval(input()))","- flag = 0","- query = []","- for _ in range(q):","- temp = input().split()","- if len(temp) == 1:","- flag += 1","+s = deque(eval(input()))","+q = int(eval(input()))","+flag = True","+for _ in range(q):","+ temp = input().split()","+ if len(temp) == 1:","+ flag = not flag","+ else:","+ if flag:","+ if temp[1] == \"1\":","+ s.appendleft(temp[2])","+ else:","+ s.append(temp[2])","- query.append(temp + [flag % 2])","- for q in query:","- if q[-1] == 0:","- if q[1] == \"1\":","- s.appendleft(q[2])","+ if temp[1] == \"1\":","+ s.append(temp[2])","- s.append(q[2])","- else:","- if q[1] == \"1\":","- s.append(q[2])","- else:","- s.appendleft(q[2])","- if flag % 2 == 1:","- print((\"\".join(list(s)[::-1])))","- else:","- print((\"\".join(s)))","-","-","-main()","+ s.appendleft(temp[2])","+if flag:","+ print((\"\".join(s)))","+else:","+ print((\"\".join(list(s)[::-1])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0491232853,"measured_runtime_v1":0.0491449711,"runtime_lift":0.9995587372,"key":["s391108594","s088459144"]} +{"user_id":"u894258749","problem_id":"p03329","language":"python","submission_id_v0":"s565675849","submission_id_v1":"s917041079","cpu_time_v0":21,"cpu_time_v1":19,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.52,"input":"from bisect import bisect_right\n\nN = int(eval(input()))\n\nunit = [1]\n\nfor b in [6,9]:\n\n u = b\n\n while u <= N:\n\n unit.append(u)\n\n u *= b\n\nunit.sort()\n\nNu = len(unit)\n\n\n\nans = N\n\nstate_pool = [(0, 0, Nu-1)]\n\nwhile state_pool:\n\n n, i, pk = state_pool.pop()\n\n if N - n >= (ans-i)*unit[pk]:\n\n continue\n\n sk = bisect_right(unit, N-n, 0, pk+1)\n\n for k in range(sk):\n\n u = unit[k]\n\n c = n + u\n\n if c == N:\n\n if i + 1 < ans:\n\n ans = i + 1\n\n else:\n\n state_pool.append((c, i+1, k))\n\nprint(ans)","target":"from bisect import bisect_right\n\nN = int(eval(input()))\n\nunit = [1]\n\nfor b in [6,9]:\n\n u = b\n\n while u <= N:\n\n unit.append(u)\n\n u *= b\n\nunit.sort()\n\nNu = len(unit)\n\n\n\nans = N\n\nstate_pool = [(0, 0, 0, Nu-1)]\n\nwhile state_pool:\n\n n, i, parent, pk = state_pool.pop()\n\n if N - n >= (ans-i)*unit[pk]:\n\n continue\n\n elif pk > 0 and i > 0:\n\n state_pool.append((parent+unit[pk-1], i, parent, pk-1))\n\n\n\n k = bisect_right(unit, N-n, 0, pk+1) - 1\n\n c = n + unit[k]\n\n if c == N:\n\n if i + 1 < ans:\n\n ans = i + 1\n\n else:\n\n state_pool.append((c, i+1, n, k))\n\nprint(ans)","code_v0_loc":27,"code_v1_loc":28,"code_v0_num_chars":579,"code_v1_num_chars":627,"code_v0_no_empty_lines":"from bisect import bisect_right\n\nN = int(eval(input()))\nunit = [1]\nfor b in [6, 9]:\n u = b\n while u <= N:\n unit.append(u)\n u *= b\nunit.sort()\nNu = len(unit)\nans = N\nstate_pool = [(0, 0, Nu - 1)]\nwhile state_pool:\n n, i, pk = state_pool.pop()\n if N - n >= (ans - i) * unit[pk]:\n continue\n sk = bisect_right(unit, N - n, 0, pk + 1)\n for k in range(sk):\n u = unit[k]\n c = n + u\n if c == N:\n if i + 1 < ans:\n ans = i + 1\n else:\n state_pool.append((c, i + 1, k))\nprint(ans)\n","code_v1_no_empty_lines":"from bisect import bisect_right\n\nN = int(eval(input()))\nunit = [1]\nfor b in [6, 9]:\n u = b\n while u <= N:\n unit.append(u)\n u *= b\nunit.sort()\nNu = len(unit)\nans = N\nstate_pool = [(0, 0, 0, Nu - 1)]\nwhile state_pool:\n n, i, parent, pk = state_pool.pop()\n if N - n >= (ans - i) * unit[pk]:\n continue\n elif pk > 0 and i > 0:\n state_pool.append((parent + unit[pk - 1], i, parent, pk - 1))\n k = bisect_right(unit, N - n, 0, pk + 1) - 1\n c = n + unit[k]\n if c == N:\n if i + 1 < ans:\n ans = i + 1\n else:\n state_pool.append((c, i + 1, n, k))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":3.5714285714,"diff":["-state_pool = [(0, 0, Nu - 1)]","+state_pool = [(0, 0, 0, Nu - 1)]","- n, i, pk = state_pool.pop()","+ n, i, parent, pk = state_pool.pop()","- sk = bisect_right(unit, N - n, 0, pk + 1)","- for k in range(sk):","- u = unit[k]","- c = n + u","- if c == N:","- if i + 1 < ans:","- ans = i + 1","- else:","- state_pool.append((c, i + 1, k))","+ elif pk > 0 and i > 0:","+ state_pool.append((parent + unit[pk - 1], i, parent, pk - 1))","+ k = bisect_right(unit, N - n, 0, pk + 1) - 1","+ c = n + unit[k]","+ if c == N:","+ if i + 1 < ans:","+ ans = i + 1","+ else:","+ state_pool.append((c, i + 1, n, k))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0379000595,"measured_runtime_v1":0.0932019441,"runtime_lift":0.406644516,"key":["s565675849","s917041079"]} +{"user_id":"u906501980","problem_id":"p02901","language":"python","submission_id_v0":"s693249211","submission_id_v1":"s102208787","cpu_time_v0":887,"cpu_time_v1":265,"memory_v0":3188,"memory_v1":46168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.12,"input":"def main():\n\n n, m = list(map(int, input().split()))\n\n p = 2**n\n\n dp = [float('inf')]*p\n\n dp[0] = 0\n\n for _ in range(m):\n\n a, _ = list(map(int, input().split()))\n\n c = sum([2**(int(i)-1) for i in input().split()])\n\n for s in range(p):\n\n t = s|c\n\n if dp[t] > dp[s] + a:\n\n dp[t] = dp[s] + a\n\n ans = dp[-1]\n\n if ans == float('inf'):\n\n ans = -1\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()","target":"def main():\n\n n, m = list(map(int, input().split()))\n\n p = 2**n\n\n dp = [10**7]*p\n\n dp[0] = 0\n\n for _ in range(m):\n\n a, _ = list(map(int, input().split()))\n\n c = sum([2**(int(i)-1) for i in input().split()])\n\n for s in range(p):\n\n t = s|c\n\n if dp[t] > dp[s] + a:\n\n dp[t] = dp[s] + a\n\n ans = dp[-1]\n\n if ans == 10**7:\n\n ans = -1\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":484,"code_v1_num_chars":470,"code_v0_no_empty_lines":"def main():\n n, m = list(map(int, input().split()))\n p = 2**n\n dp = [float(\"inf\")] * p\n dp[0] = 0\n for _ in range(m):\n a, _ = list(map(int, input().split()))\n c = sum([2 ** (int(i) - 1) for i in input().split()])\n for s in range(p):\n t = s | c\n if dp[t] > dp[s] + a:\n dp[t] = dp[s] + a\n ans = dp[-1]\n if ans == float(\"inf\"):\n ans = -1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n, m = list(map(int, input().split()))\n p = 2**n\n dp = [10**7] * p\n dp[0] = 0\n for _ in range(m):\n a, _ = list(map(int, input().split()))\n c = sum([2 ** (int(i) - 1) for i in input().split()])\n for s in range(p):\n t = s | c\n if dp[t] > dp[s] + a:\n dp[t] = dp[s] + a\n ans = dp[-1]\n if ans == 10**7:\n ans = -1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dp = [float(\"inf\")] * p","+ dp = [10**7] * p","- if ans == float(\"inf\"):","+ if ans == 10**7:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0362993588,"measured_runtime_v1":0.0399853518,"runtime_lift":0.9078164178,"key":["s693249211","s102208787"]} +{"user_id":"u496344397","problem_id":"p03436","language":"python","submission_id_v0":"s613338651","submission_id_v1":"s192078460","cpu_time_v0":27,"cpu_time_v1":23,"memory_v0":4596,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.81,"input":"H, W = list(map(int, input().split()))\n\nc = [eval(input()) for _ in range(H)]\n\n\n\nmoves = [(-1, 0), (1, 0), (0, -1), (0, 1)]\n\n\n\ndef bfs():\n\n visited = [[False for _ in range(W)] for _ in range(H)]\n\n dist = [[[] for _ in range(W)] for _ in range(H)]\n\n routes = [(0, 0)]\n\n visited[0][0] = True\n\n\n\n hop_count = 0\n\n while len(routes) > 0:\n\n x, y = routes.pop(0)\n\n for move in moves:\n\n cx, cy = x + move[0], y + move[1]\n\n if cx < 0 or cy < 0 or cx >= W or cy >= H or c[cy][cx] == '#' or visited[cy][cx]:\n\n continue\n\n if cx == W-1 and cy == H-1:\n\n return sum([line.count('.')for line in c]) - len(dist[y][x]) - 2\n\n visited[cy][cx] = True\n\n routes.append((cx, cy))\n\n dist[cy][cx] += dist[y][x] + [(x, y)]\n\n return -1\n\n\n\nprint((bfs()))","target":"H, W = list(map(int, input().split()))\n\nc = [eval(input()) for _ in range(H)]\n\n\n\nmoves = [(-1, 0), (1, 0), (0, -1), (0, 1)]\n\n\n\ndef bfs():\n\n visited = [[False for _ in range(W)] for _ in range(H)]\n\n dist = [[0 for _ in range(W)] for _ in range(H)]\n\n routes = [(0, 0)]\n\n visited[0][0] = True\n\n\n\n while len(routes) > 0:\n\n x, y = routes.pop(0)\n\n for move in moves:\n\n cx, cy = x + move[0], y + move[1]\n\n if cx < 0 or cy < 0 or cx >= W or cy >= H or c[cy][cx] == '#' or visited[cy][cx]:\n\n continue\n\n if cx == W-1 and cy == H-1:\n\n return sum([line.count('.')for line in c]) - dist[y][x] - 2\n\n visited[cy][cx] = True\n\n routes.append((cx, cy))\n\n dist[cy][cx] = dist[y][x] + 1\n\n return -1\n\n\n\nprint((bfs()))","code_v0_loc":26,"code_v1_loc":25,"code_v0_num_chars":849,"code_v1_num_chars":816,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\nc = [eval(input()) for _ in range(H)]\nmoves = [(-1, 0), (1, 0), (0, -1), (0, 1)]\n\n\ndef bfs():\n visited = [[False for _ in range(W)] for _ in range(H)]\n dist = [[[] for _ in range(W)] for _ in range(H)]\n routes = [(0, 0)]\n visited[0][0] = True\n hop_count = 0\n while len(routes) > 0:\n x, y = routes.pop(0)\n for move in moves:\n cx, cy = x + move[0], y + move[1]\n if (\n cx < 0\n or cy < 0\n or cx >= W\n or cy >= H\n or c[cy][cx] == \"#\"\n or visited[cy][cx]\n ):\n continue\n if cx == W - 1 and cy == H - 1:\n return sum([line.count(\".\") for line in c]) - len(dist[y][x]) - 2\n visited[cy][cx] = True\n routes.append((cx, cy))\n dist[cy][cx] += dist[y][x] + [(x, y)]\n return -1\n\n\nprint((bfs()))\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nc = [eval(input()) for _ in range(H)]\nmoves = [(-1, 0), (1, 0), (0, -1), (0, 1)]\n\n\ndef bfs():\n visited = [[False for _ in range(W)] for _ in range(H)]\n dist = [[0 for _ in range(W)] for _ in range(H)]\n routes = [(0, 0)]\n visited[0][0] = True\n while len(routes) > 0:\n x, y = routes.pop(0)\n for move in moves:\n cx, cy = x + move[0], y + move[1]\n if (\n cx < 0\n or cy < 0\n or cx >= W\n or cy >= H\n or c[cy][cx] == \"#\"\n or visited[cy][cx]\n ):\n continue\n if cx == W - 1 and cy == H - 1:\n return sum([line.count(\".\") for line in c]) - dist[y][x] - 2\n visited[cy][cx] = True\n routes.append((cx, cy))\n dist[cy][cx] = dist[y][x] + 1\n return -1\n\n\nprint((bfs()))\n","code_same":false,"relative_loc_diff_percent":3.8461538462,"diff":["- dist = [[[] for _ in range(W)] for _ in range(H)]","+ dist = [[0 for _ in range(W)] for _ in range(H)]","- hop_count = 0","- return sum([line.count(\".\") for line in c]) - len(dist[y][x]) - 2","+ return sum([line.count(\".\") for line in c]) - dist[y][x] - 2","- dist[cy][cx] += dist[y][x] + [(x, y)]","+ dist[cy][cx] = dist[y][x] + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0498083305,"measured_runtime_v1":0.0502506306,"runtime_lift":0.9911981186,"key":["s613338651","s192078460"]} +{"user_id":"u968166680","problem_id":"p02913","language":"python","submission_id_v0":"s725097712","submission_id_v1":"s310548727","cpu_time_v0":464,"cpu_time_v1":386,"memory_v0":270088,"memory_v1":270380,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.81,"input":"import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n\n\ndef main():\n\n N = int(readline())\n\n S = readline().strip()\n\n\n\n dp = [[0] * (N + 1) for _ in range(N + 1)]\n\n for i in range(N - 1, -1, -1):\n\n for j in range(N - 1, i, -1):\n\n if S[i] == S[j]:\n\n dp[i][j] = dp[i + 1][j + 1] + 1\n\n\n\n ans = 0\n\n for i in range(N):\n\n for j in range(i + 1, N):\n\n if ans < min(dp[i][j], j - i):\n\n ans = min(dp[i][j], j - i)\n\n\n\n print(ans)\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n\n\ndef main():\n\n N = int(readline())\n\n S = readline().strip()\n\n\n\n dp = [[0] * (N + 1) for _ in range(N + 1)]\n\n ans = 0\n\n\n\n for i in range(N - 1, -1, -1):\n\n for j in range(N - 1, i, -1):\n\n if S[i] == S[j]:\n\n dp[i][j] = dp[i + 1][j + 1] + 1\n\n if ans < min(dp[i][j], j - i):\n\n ans = min(dp[i][j], j - i)\n\n\n\n print(ans)\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":32,"code_v1_loc":30,"code_v0_num_chars":675,"code_v1_num_chars":616,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N = int(readline())\n S = readline().strip()\n dp = [[0] * (N + 1) for _ in range(N + 1)]\n for i in range(N - 1, -1, -1):\n for j in range(N - 1, i, -1):\n if S[i] == S[j]:\n dp[i][j] = dp[i + 1][j + 1] + 1\n ans = 0\n for i in range(N):\n for j in range(i + 1, N):\n if ans < min(dp[i][j], j - i):\n ans = min(dp[i][j], j - i)\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N = int(readline())\n S = readline().strip()\n dp = [[0] * (N + 1) for _ in range(N + 1)]\n ans = 0\n for i in range(N - 1, -1, -1):\n for j in range(N - 1, i, -1):\n if S[i] == S[j]:\n dp[i][j] = dp[i + 1][j + 1] + 1\n if ans < min(dp[i][j], j - i):\n ans = min(dp[i][j], j - i)\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["+ ans = 0","- ans = 0","- for i in range(N):","- for j in range(i + 1, N):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0343654025,"measured_runtime_v1":0.0445248477,"runtime_lift":0.7718252659,"key":["s725097712","s310548727"]} +{"user_id":"u280809964","problem_id":"p03448","language":"python","submission_id_v0":"s731392437","submission_id_v1":"s909830389","cpu_time_v0":59,"cpu_time_v1":53,"memory_v0":8344,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.17,"input":"a=int(eval(input())) # 500\n\nb=int(eval(input())) # 100\n\nc=int(eval(input())) # 50\n\nx=int(eval(input()))\n\nsum = []\n\ncount = 0\n\n\n\nfor i in range(0, a+1):\n\n asum = 500 * i\n\n for i in range(0, b+1):\n\n bsum = 100 * i\n\n for i in range(0, c+1):\n\n csum = 50 * i\n\n sum.append(asum + bsum + csum)\n\n\n\nfor i in sum:\n\n if i == x:\n\n count += 1\n\n\n\nprint(count)\n","target":"a=int(eval(input())) # 500\n\nb=int(eval(input())) # 100\n\nc=int(eval(input())) # 50\n\nx=int(eval(input()))\n\ncount = 0\n\n\n\nfor i in range(0, a+1):\n\n for j in range(0, b+1):\n\n for k in range(0, c+1):\n\n if 500 * i + 100 * j + 50 * k == x:\n\n count += 1\n\nprint(count)\n","code_v0_loc":20,"code_v1_loc":12,"code_v0_num_chars":374,"code_v1_num_chars":271,"code_v0_no_empty_lines":"a = int(eval(input())) # 500\nb = int(eval(input())) # 100\nc = int(eval(input())) # 50\nx = int(eval(input()))\nsum = []\ncount = 0\nfor i in range(0, a + 1):\n asum = 500 * i\n for i in range(0, b + 1):\n bsum = 100 * i\n for i in range(0, c + 1):\n csum = 50 * i\n sum.append(asum + bsum + csum)\nfor i in sum:\n if i == x:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"a = int(eval(input())) # 500\nb = int(eval(input())) # 100\nc = int(eval(input())) # 50\nx = int(eval(input()))\ncount = 0\nfor i in range(0, a + 1):\n for j in range(0, b + 1):\n for k in range(0, c + 1):\n if 500 * i + 100 * j + 50 * k == x:\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-sum = []","- asum = 500 * i","- for i in range(0, b + 1):","- bsum = 100 * i","- for i in range(0, c + 1):","- csum = 50 * i","- sum.append(asum + bsum + csum)","-for i in sum:","- if i == x:","- count += 1","+ for j in range(0, b + 1):","+ for k in range(0, c + 1):","+ if 500 * i + 100 * j + 50 * k == x:","+ count += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.1155384147,"measured_runtime_v1":0.0891747978,"runtime_lift":1.2956397725,"key":["s731392437","s909830389"]} +{"user_id":"u227082700","problem_id":"p03821","language":"python","submission_id_v0":"s764519021","submission_id_v1":"s129587597","cpu_time_v0":619,"cpu_time_v1":373,"memory_v0":61656,"memory_v1":15020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.74,"input":"n=int(eval(input()))\n\na=[list(map(int,input().split()))for _ in range(n)]\n\nm=0\n\nfor i in range(n):\n\n s=(a[-1-i][0]+m)%a[-1-i][1]\n\n if s!=0:m+=a[-1-i][1]-s\n\nprint(m)","target":"n=int(eval(input()))\n\na=[]\n\nb=[]\n\nfor i in range(n):\n\n aa,bb=list(map(int,input().split()))\n\n a.append(aa)\n\n b.append(bb)\n\nm=0\n\nfor i in range(n-1,-1,-1):\n\n a[i]+=m\n\n if a[i]%b[i]:m+=b[i]-a[i]%b[i]\n\nprint(m)","code_v0_loc":7,"code_v1_loc":12,"code_v0_num_chars":160,"code_v1_num_chars":200,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [list(map(int, input().split())) for _ in range(n)]\nm = 0\nfor i in range(n):\n s = (a[-1 - i][0] + m) % a[-1 - i][1]\n if s != 0:\n m += a[-1 - i][1] - s\nprint(m)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = []\nb = []\nfor i in range(n):\n aa, bb = list(map(int, input().split()))\n a.append(aa)\n b.append(bb)\nm = 0\nfor i in range(n - 1, -1, -1):\n a[i] += m\n if a[i] % b[i]:\n m += b[i] - a[i] % b[i]\nprint(m)\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["-a = [list(map(int, input().split())) for _ in range(n)]","+a = []","+b = []","+for i in range(n):","+ aa, bb = list(map(int, input().split()))","+ a.append(aa)","+ b.append(bb)","-for i in range(n):","- s = (a[-1 - i][0] + m) % a[-1 - i][1]","- if s != 0:","- m += a[-1 - i][1] - s","+for i in range(n - 1, -1, -1):","+ a[i] += m","+ if a[i] % b[i]:","+ m += b[i] - a[i] % b[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0437322868,"measured_runtime_v1":0.0377478226,"runtime_lift":1.1585379962,"key":["s764519021","s129587597"]} +{"user_id":"u977389981","problem_id":"p03062","language":"python","submission_id_v0":"s371159519","submission_id_v1":"s959483238","cpu_time_v0":102,"cpu_time_v1":85,"memory_v0":14468,"memory_v1":14412,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"N = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\n\n\nabsA = []\n\nfor i in range(N):\n\n absA.append(abs(A[i]))\n\n\n\ncnt = 0\n\nfor i in range(N):\n\n if A[i] < 0:\n\n cnt += 1\n\n\n\nflag = 0\n\nfor i in range(N):\n\n if A[i] != 0:\n\n flag = 1\n\n if flag == 1 and A[i] == 0:\n\n cnt += 1\n\n \n\nif cnt % 2 == 0:\n\n ans = sum(absA)\n\nelse:\n\n ans = sum(absA) - min(absA) * 2\n\n\n\nprint(ans)","target":"N = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\n \n\nabsA = []\n\nfor i in range(N):\n\n absA.append(abs(A[i]))\n\n\n\ncnt = 0\n\nfor i in range(N):\n\n if A[i] <= 0:\n\n cnt += 1\n\n \n\nif cnt % 2 == 0:\n\n ans = sum(absA)\n\nelse:\n\n ans = sum(absA) - min(absA) * 2\n\n\n\nprint(ans)","code_v0_loc":25,"code_v1_loc":18,"code_v0_num_chars":406,"code_v1_num_chars":288,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [int(i) for i in input().split()]\nabsA = []\nfor i in range(N):\n absA.append(abs(A[i]))\ncnt = 0\nfor i in range(N):\n if A[i] < 0:\n cnt += 1\nflag = 0\nfor i in range(N):\n if A[i] != 0:\n flag = 1\n if flag == 1 and A[i] == 0:\n cnt += 1\nif cnt % 2 == 0:\n ans = sum(absA)\nelse:\n ans = sum(absA) - min(absA) * 2\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(i) for i in input().split()]\nabsA = []\nfor i in range(N):\n absA.append(abs(A[i]))\ncnt = 0\nfor i in range(N):\n if A[i] <= 0:\n cnt += 1\nif cnt % 2 == 0:\n ans = sum(absA)\nelse:\n ans = sum(absA) - min(absA) * 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":28.0,"diff":["- if A[i] < 0:","- cnt += 1","-flag = 0","-for i in range(N):","- if A[i] != 0:","- flag = 1","- if flag == 1 and A[i] == 0:","+ if A[i] <= 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1038764777,"measured_runtime_v1":0.0387574041,"runtime_lift":2.6801711862,"key":["s371159519","s959483238"]} +{"user_id":"u951601135","problem_id":"p03434","language":"python","submission_id_v0":"s231862213","submission_id_v1":"s571570776","cpu_time_v0":147,"cpu_time_v1":17,"memory_v0":12500,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.44,"input":"import numpy as np\n\nN = int(eval(input()))\n\na = sorted(list(map(int,input().split())),reverse=True)\n\nprint((sum(a[::2]) - sum(a[1::2])))\n\n\n","target":"N = int(eval(input()))\n\nvalue = sorted(list(map(int,input().split())))[::-1]\n\nprint((sum(value[::2]) - sum(value[1::2])))\n\n\n","code_v0_loc":5,"code_v1_loc":4,"code_v0_num_chars":131,"code_v1_num_chars":116,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\na = sorted(list(map(int, input().split())), reverse=True)\nprint((sum(a[::2]) - sum(a[1::2])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nvalue = sorted(list(map(int, input().split())))[::-1]\nprint((sum(value[::2]) - sum(value[1::2])))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import numpy as np","-","-a = sorted(list(map(int, input().split())), reverse=True)","-print((sum(a[::2]) - sum(a[1::2])))","+value = sorted(list(map(int, input().split())))[::-1]","+print((sum(value[::2]) - sum(value[1::2])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0352166684,"measured_runtime_v1":0.036595768,"runtime_lift":0.9623153251,"key":["s231862213","s571570776"]} +{"user_id":"u851706118","problem_id":"p03087","language":"python","submission_id_v0":"s443008007","submission_id_v1":"s033524199","cpu_time_v0":899,"cpu_time_v1":445,"memory_v0":8512,"memory_v1":31376,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.5,"input":"N, Q = list(map(int, input().split()))\n\nS = list(eval(input()))\n\n\n\nmark = [0]*(N+1)\n\n\n\nfor i in range(2, N+1):\n\n if S[i-2] == 'A' and S[i-1] == 'C':\n\n mark[i] = mark[i-1] + 1\n\n else:\n\n mark[i] = mark[i-1]\n\n\n\nfor i in range(Q):\n\n l,r = list(map(int,input().split()))\n\n l = l - 1\n\n r = r - 1\n\n print((mark[r+1]-mark[l+1]))","target":"N, Q = list(map(int, input().split()))\n\nS = list(eval(input()))\n\nlr = [list(map(int, input().split())) for i in range(Q)]\n\n\n\nmark = [0]*(N+1)\n\n\n\nfor i in range(2, N+1):\n\n if S[i-2] == 'A' and S[i-1] == 'C':\n\n mark[i] = mark[i-1] + 1\n\n else:\n\n mark[i] = mark[i-1]\n\n\n\nfor i in lr:\n\n print((mark[i[1]]-mark[i[0]]))","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":332,"code_v1_num_chars":320,"code_v0_no_empty_lines":"N, Q = list(map(int, input().split()))\nS = list(eval(input()))\nmark = [0] * (N + 1)\nfor i in range(2, N + 1):\n if S[i - 2] == \"A\" and S[i - 1] == \"C\":\n mark[i] = mark[i - 1] + 1\n else:\n mark[i] = mark[i - 1]\nfor i in range(Q):\n l, r = list(map(int, input().split()))\n l = l - 1\n r = r - 1\n print((mark[r + 1] - mark[l + 1]))\n","code_v1_no_empty_lines":"N, Q = list(map(int, input().split()))\nS = list(eval(input()))\nlr = [list(map(int, input().split())) for i in range(Q)]\nmark = [0] * (N + 1)\nfor i in range(2, N + 1):\n if S[i - 2] == \"A\" and S[i - 1] == \"C\":\n mark[i] = mark[i - 1] + 1\n else:\n mark[i] = mark[i - 1]\nfor i in lr:\n print((mark[i[1]] - mark[i[0]]))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["+lr = [list(map(int, input().split())) for i in range(Q)]","-for i in range(Q):","- l, r = list(map(int, input().split()))","- l = l - 1","- r = r - 1","- print((mark[r + 1] - mark[l + 1]))","+for i in lr:","+ print((mark[i[1]] - mark[i[0]]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0760325065,"measured_runtime_v1":0.0454065356,"runtime_lift":1.6744837588,"key":["s443008007","s033524199"]} +{"user_id":"u729133443","problem_id":"p02709","language":"python","submission_id_v0":"s031451843","submission_id_v1":"s591474248","cpu_time_v0":173,"cpu_time_v1":134,"memory_v0":77804,"memory_v1":75060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.54,"input":"e=enumerate\n\nn,a=open(0)\n\nn=int(n)\n\nd=[0]+[1e18]*n\n\nfor j,(a,i)in e(sorted((-int(a),i)for i,a in e(a.split()))):d=[min(t+a*abs(~i-j+k+n),d[k-1]+a*abs(~i+k))for k,t in e(d)]\n\nprint((-min(d)))","target":"n=int(eval(input()))\n\nd=[0]+[-10**18]*n\n\nfor j,(a,i)in enumerate(sorted((-a,i)for i,a in enumerate(map(int,input().split())))):\n\n d=[max(t-a*abs(~i-j+k+n),d[k-1]-a*abs(~i+k))for k,t in enumerate(d)]\n\nprint((max(d)))","code_v0_loc":6,"code_v1_loc":5,"code_v0_num_chars":188,"code_v1_num_chars":210,"code_v0_no_empty_lines":"e = enumerate\nn, a = open(0)\nn = int(n)\nd = [0] + [1e18] * n\nfor j, (a, i) in e(sorted((-int(a), i) for i, a in e(a.split()))):\n d = [min(t + a * abs(~i - j + k + n), d[k - 1] + a * abs(~i + k)) for k, t in e(d)]\nprint((-min(d)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nd = [0] + [-(10**18)] * n\nfor j, (a, i) in enumerate(\n sorted((-a, i) for i, a in enumerate(map(int, input().split())))\n):\n d = [\n max(t - a * abs(~i - j + k + n), d[k - 1] - a * abs(~i + k))\n for k, t in enumerate(d)\n ]\nprint((max(d)))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-e = enumerate","-n, a = open(0)","-n = int(n)","-d = [0] + [1e18] * n","-for j, (a, i) in e(sorted((-int(a), i) for i, a in e(a.split()))):","- d = [min(t + a * abs(~i - j + k + n), d[k - 1] + a * abs(~i + k)) for k, t in e(d)]","-print((-min(d)))","+n = int(eval(input()))","+d = [0] + [-(10**18)] * n","+for j, (a, i) in enumerate(","+ sorted((-a, i) for i, a in enumerate(map(int, input().split())))","+):","+ d = [","+ max(t - a * abs(~i - j + k + n), d[k - 1] - a * abs(~i + k))","+ for k, t in enumerate(d)","+ ]","+print((max(d)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0448241711,"measured_runtime_v1":0.0456839473,"runtime_lift":0.9811799041,"key":["s031451843","s591474248"]} +{"user_id":"u475503988","problem_id":"p03062","language":"python","submission_id_v0":"s854092999","submission_id_v1":"s109725197","cpu_time_v0":130,"cpu_time_v1":58,"memory_v0":14284,"memory_v1":14208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.38,"input":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nA.sort()\n\n\n\nfor i in range(N\/\/2):\n\n if A[i*2] + A[i*2+1] < 0:\n\n A[i*2] = -1 * A[i*2]\n\n A[i*2+1] = -1 * A[i*2+1]\n\n else:\n\n break\n\n\n\nprint((sum(A)))","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nnum_of_minus = sum([a < 0 for a in A])\n\nabs_A = [abs(a) for a in A]\n\nans = sum(abs_A)\n\n\n\nif num_of_minus % 2 == 0:\n\n print(ans)\n\nelse:\n\n print((ans - 2 * min(abs_A)))","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":226,"code_v1_num_chars":227,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nA.sort()\nfor i in range(N \/\/ 2):\n if A[i * 2] + A[i * 2 + 1] < 0:\n A[i * 2] = -1 * A[i * 2]\n A[i * 2 + 1] = -1 * A[i * 2 + 1]\n else:\n break\nprint((sum(A)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nnum_of_minus = sum([a < 0 for a in A])\nabs_A = [abs(a) for a in A]\nans = sum(abs_A)\nif num_of_minus % 2 == 0:\n print(ans)\nelse:\n print((ans - 2 * min(abs_A)))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-A.sort()","-for i in range(N \/\/ 2):","- if A[i * 2] + A[i * 2 + 1] < 0:","- A[i * 2] = -1 * A[i * 2]","- A[i * 2 + 1] = -1 * A[i * 2 + 1]","- else:","- break","-print((sum(A)))","+num_of_minus = sum([a < 0 for a in A])","+abs_A = [abs(a) for a in A]","+ans = sum(abs_A)","+if num_of_minus % 2 == 0:","+ print(ans)","+else:","+ print((ans - 2 * min(abs_A)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1208135815,"measured_runtime_v1":0.0773331511,"runtime_lift":1.5622482691,"key":["s854092999","s109725197"]} +{"user_id":"u729133443","problem_id":"p02889","language":"python","submission_id_v0":"s887812850","submission_id_v1":"s843742268","cpu_time_v0":339,"cpu_time_v1":273,"memory_v0":28852,"memory_v1":28828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.47,"input":"import numpy as np\n\nfrom scipy.sparse import csr_matrix\n\nfrom scipy.sparse.csgraph import floyd_warshall as f\n\ndef main():\n\n t=np.fromfile(open(0,'rb'),'i',sep=' ')\n\n n,m,l=t[:3]\n\n m=m*3+3\n\n print(('\\n'.join((f(f(csr_matrix((t[5:m:3],(t[3:m:3],t[4:m:3])),[n+1]*2),0)<=l)[t[m+1::2],t[m+2::2]].clip(0,n).astype(int)%n-1).astype(str).tolist())))\n\nmain()","target":"import sys\n\nfrom numpy import fromstring\n\nfrom scipy.sparse import csr_matrix\n\nfrom scipy.sparse.csgraph import floyd_warshall as f\n\ndef main():\n\n t=fromstring(sys.stdin.buffer.read(),'i',sep=' ')\n\n n,m,l=t[:3]\n\n m=m*3+3\n\n print(('\\n'.join((f(f(csr_matrix((t[5:m:3],(t[3:m:3],t[4:m:3])),[n+1]*2),0)<=l)[t[m+1::2],t[m+2::2]].clip(0,n).astype(int)%n-1).astype(str).tolist())))\n\nmain()","code_v0_loc":9,"code_v1_loc":10,"code_v0_num_chars":352,"code_v1_num_chars":384,"code_v0_no_empty_lines":"import numpy as np\nfrom scipy.sparse import csr_matrix\nfrom scipy.sparse.csgraph import floyd_warshall as f\n\n\ndef main():\n t = np.fromfile(open(0, \"rb\"), \"i\", sep=\" \")\n n, m, l = t[:3]\n m = m * 3 + 3\n print(\n (\n \"\\n\".join(\n (\n f(\n f(csr_matrix((t[5:m:3], (t[3:m:3], t[4:m:3])), [n + 1] * 2), 0)\n <= l\n )[t[m + 1 :: 2], t[m + 2 :: 2]]\n .clip(0, n)\n .astype(int)\n % n\n - 1\n )\n .astype(str)\n .tolist()\n )\n )\n )\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\nfrom numpy import fromstring\nfrom scipy.sparse import csr_matrix\nfrom scipy.sparse.csgraph import floyd_warshall as f\n\n\ndef main():\n t = fromstring(sys.stdin.buffer.read(), \"i\", sep=\" \")\n n, m, l = t[:3]\n m = m * 3 + 3\n print(\n (\n \"\\n\".join(\n (\n f(\n f(csr_matrix((t[5:m:3], (t[3:m:3], t[4:m:3])), [n + 1] * 2), 0)\n <= l\n )[t[m + 1 :: 2], t[m + 2 :: 2]]\n .clip(0, n)\n .astype(int)\n % n\n - 1\n )\n .astype(str)\n .tolist()\n )\n )\n )\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-import numpy as np","+import sys","+from numpy import fromstring","- t = np.fromfile(open(0, \"rb\"), \"i\", sep=\" \")","+ t = fromstring(sys.stdin.buffer.read(), \"i\", sep=\" \")"],"diff_only_import_comment":false,"measured_runtime_v0":0.4684266407,"measured_runtime_v1":0.485425812,"runtime_lift":0.9649809078,"key":["s887812850","s843742268"]} +{"user_id":"u985367427","problem_id":"p00503","language":"python","submission_id_v0":"s580860149","submission_id_v1":"s229782411","cpu_time_v0":2410,"cpu_time_v1":1330,"memory_v0":15796,"memory_v1":15800,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.81,"input":"import sys\n\nimport itertools\n\n\n\ninput_lines = sys.stdin.read().splitlines()\n\nN, K = [int(x) for x in input_lines[0].split(' ')]\n\nx_grid = set()\n\ny_grid = set()\n\nd_grid = set()\n\nfor line in input_lines[1:]:\n\n x1, y1, d1, x2, y2, d2 = [int(x) for x in line.split(' ')]\n\n x_grid.add(x1)\n\n x_grid.add(x2)\n\n y_grid.add(y1)\n\n y_grid.add(y2)\n\n d_grid.add(d1)\n\n d_grid.add(d2)\n\n\n\nx_grid = sorted(x_grid)\n\ny_grid = sorted(y_grid)\n\nd_grid = sorted(d_grid)\n\nx_grid_index = {x[1]:x[0] for x in enumerate(x_grid)}\n\ny_grid_index = {y[1]:y[0] for y in enumerate(y_grid)}\n\nd_grid_index = {d[1]:d[0] for d in enumerate(d_grid)}\n\n\n\nfish_dist = [[[0 for i in range(len(d_grid))] for i in range(len(y_grid))] for i in range(len(x_grid))]\n\n\n\nfor line in input_lines[1:]:\n\n x1, y1, d1, x2, y2, d2 = [int(x) for x in line.split(' ')]\n\n x1_index = x_grid_index[x1]\n\n x2_index = x_grid_index[x2]\n\n y1_index = y_grid_index[y1]\n\n y2_index = y_grid_index[y2]\n\n d1_index = d_grid_index[d1]\n\n d2_index = d_grid_index[d2]\n\n for x, y, d in itertools.product( list(range(x1_index, x2_index)), list(range(y1_index, y2_index)), list(range(d1_index, d2_index)) ):\n\n fish_dist[x][y][d] += 1\n\n\n\nvolume = 0\n\nfor x_index, y_index, d_index in itertools.product(list(range(len(x_grid))), list(range(len(y_grid))), list(range(len(d_grid)))):\n\n if fish_dist[x_index][y_index][d_index] >= K:\n\n x_begin = x_grid[x_index]\n\n y_begin = y_grid[y_index]\n\n d_begin = d_grid[d_index]\n\n x_end = x_grid[x_index + 1]\n\n y_end = y_grid[y_index + 1]\n\n d_end = d_grid[d_index + 1]\n\n volume += (x_end - x_begin) * (y_end - y_begin) * (d_end - d_begin)\n\nprint(volume)","target":"import itertools\n\n\n\ndef main():\n\n input_lines = []\n\n input_lines.append(eval(input()))\n\n N, K = [int(x) for x in input_lines[0].split(' ')]\n\n for i in range(N):\n\n input_lines.append(eval(input()))\n\n\n\n grid = [set() for i in range(3)]\n\n data = []\n\n for line in input_lines[1:]:\n\n x1, y1, d1, x2, y2, d2 = [int(x) for x in line.split(' ')]\n\n data.append((x1, y1, d1, x2, y2, d2))\n\n grid[0].add(x1)\n\n grid[0].add(x2)\n\n grid[1].add(y1)\n\n grid[1].add(y2)\n\n grid[2].add(d1)\n\n grid[2].add(d2)\n\n\n\n grid = [sorted(g) for g in grid]\n\n grid_index = [{x[1]:x[0] for x in enumerate(g)} for g in grid]\n\n grid_len = [len(g) for g in grid]\n\n\n\n fish_dist = [[[0 for i in range(grid_len[2])] for i in range(grid_len[1])] for i in range(grid_len[0])]\n\n\n\n for x1, y1, d1, x2, y2, d2 in data:\n\n x1_index = grid_index[0][x1]\n\n x2_index = grid_index[0][x2]\n\n y1_index = grid_index[1][y1]\n\n y2_index = grid_index[1][y2]\n\n d1_index = grid_index[2][d1]\n\n d2_index = grid_index[2][d2]\n\n for x_index, y_index, d_index in itertools.product( list(range(x1_index, x2_index)), list(range(y1_index, y2_index)), list(range(d1_index, d2_index)) ):\n\n fish_dist[x_index][y_index][d_index] += 1\n\n\n\n volume = 0\n\n for x_index, y_index, d_index in itertools.product(list(range(grid_len[0])), list(range(grid_len[1])), list(range(grid_len[2]))):\n\n if fish_dist[x_index][y_index][d_index] >= K:\n\n x_begin = grid[0][x_index]\n\n y_begin = grid[1][y_index]\n\n d_begin = grid[2][d_index]\n\n x_end = grid[0][x_index + 1]\n\n y_end = grid[1][y_index + 1]\n\n d_end = grid[2][d_index + 1]\n\n volume += (x_end - x_begin) * (y_end - y_begin) * (d_end - d_begin)\n\n print(volume)\n\n\n\nmain()","code_v0_loc":48,"code_v1_loc":50,"code_v0_num_chars":1673,"code_v1_num_chars":1831,"code_v0_no_empty_lines":"import sys\nimport itertools\n\ninput_lines = sys.stdin.read().splitlines()\nN, K = [int(x) for x in input_lines[0].split(\" \")]\nx_grid = set()\ny_grid = set()\nd_grid = set()\nfor line in input_lines[1:]:\n x1, y1, d1, x2, y2, d2 = [int(x) for x in line.split(\" \")]\n x_grid.add(x1)\n x_grid.add(x2)\n y_grid.add(y1)\n y_grid.add(y2)\n d_grid.add(d1)\n d_grid.add(d2)\nx_grid = sorted(x_grid)\ny_grid = sorted(y_grid)\nd_grid = sorted(d_grid)\nx_grid_index = {x[1]: x[0] for x in enumerate(x_grid)}\ny_grid_index = {y[1]: y[0] for y in enumerate(y_grid)}\nd_grid_index = {d[1]: d[0] for d in enumerate(d_grid)}\nfish_dist = [\n [[0 for i in range(len(d_grid))] for i in range(len(y_grid))]\n for i in range(len(x_grid))\n]\nfor line in input_lines[1:]:\n x1, y1, d1, x2, y2, d2 = [int(x) for x in line.split(\" \")]\n x1_index = x_grid_index[x1]\n x2_index = x_grid_index[x2]\n y1_index = y_grid_index[y1]\n y2_index = y_grid_index[y2]\n d1_index = d_grid_index[d1]\n d2_index = d_grid_index[d2]\n for x, y, d in itertools.product(\n list(range(x1_index, x2_index)),\n list(range(y1_index, y2_index)),\n list(range(d1_index, d2_index)),\n ):\n fish_dist[x][y][d] += 1\nvolume = 0\nfor x_index, y_index, d_index in itertools.product(\n list(range(len(x_grid))), list(range(len(y_grid))), list(range(len(d_grid)))\n):\n if fish_dist[x_index][y_index][d_index] >= K:\n x_begin = x_grid[x_index]\n y_begin = y_grid[y_index]\n d_begin = d_grid[d_index]\n x_end = x_grid[x_index + 1]\n y_end = y_grid[y_index + 1]\n d_end = d_grid[d_index + 1]\n volume += (x_end - x_begin) * (y_end - y_begin) * (d_end - d_begin)\nprint(volume)\n","code_v1_no_empty_lines":"import itertools\n\n\ndef main():\n input_lines = []\n input_lines.append(eval(input()))\n N, K = [int(x) for x in input_lines[0].split(\" \")]\n for i in range(N):\n input_lines.append(eval(input()))\n grid = [set() for i in range(3)]\n data = []\n for line in input_lines[1:]:\n x1, y1, d1, x2, y2, d2 = [int(x) for x in line.split(\" \")]\n data.append((x1, y1, d1, x2, y2, d2))\n grid[0].add(x1)\n grid[0].add(x2)\n grid[1].add(y1)\n grid[1].add(y2)\n grid[2].add(d1)\n grid[2].add(d2)\n grid = [sorted(g) for g in grid]\n grid_index = [{x[1]: x[0] for x in enumerate(g)} for g in grid]\n grid_len = [len(g) for g in grid]\n fish_dist = [\n [[0 for i in range(grid_len[2])] for i in range(grid_len[1])]\n for i in range(grid_len[0])\n ]\n for x1, y1, d1, x2, y2, d2 in data:\n x1_index = grid_index[0][x1]\n x2_index = grid_index[0][x2]\n y1_index = grid_index[1][y1]\n y2_index = grid_index[1][y2]\n d1_index = grid_index[2][d1]\n d2_index = grid_index[2][d2]\n for x_index, y_index, d_index in itertools.product(\n list(range(x1_index, x2_index)),\n list(range(y1_index, y2_index)),\n list(range(d1_index, d2_index)),\n ):\n fish_dist[x_index][y_index][d_index] += 1\n volume = 0\n for x_index, y_index, d_index in itertools.product(\n list(range(grid_len[0])), list(range(grid_len[1])), list(range(grid_len[2]))\n ):\n if fish_dist[x_index][y_index][d_index] >= K:\n x_begin = grid[0][x_index]\n y_begin = grid[1][y_index]\n d_begin = grid[2][d_index]\n x_end = grid[0][x_index + 1]\n y_end = grid[1][y_index + 1]\n d_end = grid[2][d_index + 1]\n volume += (x_end - x_begin) * (y_end - y_begin) * (d_end - d_begin)\n print(volume)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["-import sys","-input_lines = sys.stdin.read().splitlines()","-N, K = [int(x) for x in input_lines[0].split(\" \")]","-x_grid = set()","-y_grid = set()","-d_grid = set()","-for line in input_lines[1:]:","- x1, y1, d1, x2, y2, d2 = [int(x) for x in line.split(\" \")]","- x_grid.add(x1)","- x_grid.add(x2)","- y_grid.add(y1)","- y_grid.add(y2)","- d_grid.add(d1)","- d_grid.add(d2)","-x_grid = sorted(x_grid)","-y_grid = sorted(y_grid)","-d_grid = sorted(d_grid)","-x_grid_index = {x[1]: x[0] for x in enumerate(x_grid)}","-y_grid_index = {y[1]: y[0] for y in enumerate(y_grid)}","-d_grid_index = {d[1]: d[0] for d in enumerate(d_grid)}","-fish_dist = [","- [[0 for i in range(len(d_grid))] for i in range(len(y_grid))]","- for i in range(len(x_grid))","-]","-for line in input_lines[1:]:","- x1, y1, d1, x2, y2, d2 = [int(x) for x in line.split(\" \")]","- x1_index = x_grid_index[x1]","- x2_index = x_grid_index[x2]","- y1_index = y_grid_index[y1]","- y2_index = y_grid_index[y2]","- d1_index = d_grid_index[d1]","- d2_index = d_grid_index[d2]","- for x, y, d in itertools.product(","- list(range(x1_index, x2_index)),","- list(range(y1_index, y2_index)),","- list(range(d1_index, d2_index)),","+","+def main():","+ input_lines = []","+ input_lines.append(eval(input()))","+ N, K = [int(x) for x in input_lines[0].split(\" \")]","+ for i in range(N):","+ input_lines.append(eval(input()))","+ grid = [set() for i in range(3)]","+ data = []","+ for line in input_lines[1:]:","+ x1, y1, d1, x2, y2, d2 = [int(x) for x in line.split(\" \")]","+ data.append((x1, y1, d1, x2, y2, d2))","+ grid[0].add(x1)","+ grid[0].add(x2)","+ grid[1].add(y1)","+ grid[1].add(y2)","+ grid[2].add(d1)","+ grid[2].add(d2)","+ grid = [sorted(g) for g in grid]","+ grid_index = [{x[1]: x[0] for x in enumerate(g)} for g in grid]","+ grid_len = [len(g) for g in grid]","+ fish_dist = [","+ [[0 for i in range(grid_len[2])] for i in range(grid_len[1])]","+ for i in range(grid_len[0])","+ ]","+ for x1, y1, d1, x2, y2, d2 in data:","+ x1_index = grid_index[0][x1]","+ x2_index = grid_index[0][x2]","+ y1_index = grid_index[1][y1]","+ y2_index = grid_index[1][y2]","+ d1_index = grid_index[2][d1]","+ d2_index = grid_index[2][d2]","+ for x_index, y_index, d_index in itertools.product(","+ list(range(x1_index, x2_index)),","+ list(range(y1_index, y2_index)),","+ list(range(d1_index, d2_index)),","+ ):","+ fish_dist[x_index][y_index][d_index] += 1","+ volume = 0","+ for x_index, y_index, d_index in itertools.product(","+ list(range(grid_len[0])), list(range(grid_len[1])), list(range(grid_len[2]))","- fish_dist[x][y][d] += 1","-volume = 0","-for x_index, y_index, d_index in itertools.product(","- list(range(len(x_grid))), list(range(len(y_grid))), list(range(len(d_grid)))","-):","- if fish_dist[x_index][y_index][d_index] >= K:","- x_begin = x_grid[x_index]","- y_begin = y_grid[y_index]","- d_begin = d_grid[d_index]","- x_end = x_grid[x_index + 1]","- y_end = y_grid[y_index + 1]","- d_end = d_grid[d_index + 1]","- volume += (x_end - x_begin) * (y_end - y_begin) * (d_end - d_begin)","-print(volume)","+ if fish_dist[x_index][y_index][d_index] >= K:","+ x_begin = grid[0][x_index]","+ y_begin = grid[1][y_index]","+ d_begin = grid[2][d_index]","+ x_end = grid[0][x_index + 1]","+ y_end = grid[1][y_index + 1]","+ d_end = grid[2][d_index + 1]","+ volume += (x_end - x_begin) * (y_end - y_begin) * (d_end - d_begin)","+ print(volume)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.043314738,"measured_runtime_v1":0.0430745339,"runtime_lift":1.0055764756,"key":["s580860149","s229782411"]} +{"user_id":"u103902792","problem_id":"p02853","language":"python","submission_id_v0":"s369823196","submission_id_v1":"s776963779","cpu_time_v0":198,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.41,"input":"x,y = list(map(int,input().split()))\n\namount = 0\n\nif x < 4:\n\n amount += (4-x)*100000\n\nif y < 4:\n\n amount += (4-y)*100000\n\nif x ==1 and y==1:\n\n amount += 400000\n\nprint(amount)","target":"x,y = list(map(int,input().split()))\n\n\n\ndef f(x):\n\n if x==3:\n\n return 100000\n\n elif x==2:\n\n return 200000\n\n elif x== 1:\n\n return 300000\n\n else:\n\n return 0\n\n\n\nans = f(x)+f(y)\n\nif x == y== 1:\n\n ans += 400000\n\nprint(ans)","code_v0_loc":9,"code_v1_loc":16,"code_v0_num_chars":171,"code_v1_num_chars":228,"code_v0_no_empty_lines":"x, y = list(map(int, input().split()))\namount = 0\nif x < 4:\n amount += (4 - x) * 100000\nif y < 4:\n amount += (4 - y) * 100000\nif x == 1 and y == 1:\n amount += 400000\nprint(amount)\n","code_v1_no_empty_lines":"x, y = list(map(int, input().split()))\n\n\ndef f(x):\n if x == 3:\n return 100000\n elif x == 2:\n return 200000\n elif x == 1:\n return 300000\n else:\n return 0\n\n\nans = f(x) + f(y)\nif x == y == 1:\n ans += 400000\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":43.75,"diff":["-amount = 0","-if x < 4:","- amount += (4 - x) * 100000","-if y < 4:","- amount += (4 - y) * 100000","-if x == 1 and y == 1:","- amount += 400000","-print(amount)","+","+","+def f(x):","+ if x == 3:","+ return 100000","+ elif x == 2:","+ return 200000","+ elif x == 1:","+ return 300000","+ else:","+ return 0","+","+","+ans = f(x) + f(y)","+if x == y == 1:","+ ans += 400000","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.040352015,"measured_runtime_v1":0.0519351473,"runtime_lift":0.7769692996,"key":["s369823196","s776963779"]} +{"user_id":"u633068244","problem_id":"p00057","language":"python","submission_id_v0":"s328241418","submission_id_v1":"s797701840","cpu_time_v0":30,"cpu_time_v1":10,"memory_v0":4564,"memory_v1":4180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.67,"input":"while True:\n\n try:\n\n n = int(input())\n\n area = 2\n\n for i in range(n-1):\n\n area += i+2\n\n print(area)\n\n except:\n\n break","target":"while True:\n\n try:\n\n n = int(input())\n\n print(1 + n*(n+1)\/2)\n\n except:\n\n break","code_v0_loc":9,"code_v1_loc":6,"code_v0_num_chars":172,"code_v1_num_chars":108,"code_v0_no_empty_lines":"while True:\n try:\n n = int(input())\n area = 2\n for i in range(n - 1):\n area += i + 2\n print(area)\n except:\n break\n","code_v1_no_empty_lines":"while True:\n try:\n n = int(input())\n print(1 + n * (n + 1) \/ 2)\n except:\n break\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["- area = 2","- for i in range(n - 1):","- area += i + 2","- print(area)","+ print(1 + n * (n + 1) \/ 2)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0350450809,"measured_runtime_v1":0.0380876415,"runtime_lift":0.920116855,"key":["s328241418","s797701840"]} +{"user_id":"u958506960","problem_id":"p03796","language":"python","submission_id_v0":"s374050527","submission_id_v1":"s878980393","cpu_time_v0":36,"cpu_time_v1":29,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.44,"input":"n = int(eval(input()))\n\np = 1\n\n\n\nfor i in range(1, n+1):\n\n p = p * i % 1000000007\n\n\n\nprint(p)","target":"n = int(eval(input()))\n\n\n\ndef training(n):\n\n power = 1\n\n for i in range(1, n+1):\n\n power = power * i % 1000000007\n\n return power\n\n\n\nprint((training(n)))","code_v0_loc":7,"code_v1_loc":9,"code_v0_num_chars":90,"code_v1_num_chars":160,"code_v0_no_empty_lines":"n = int(eval(input()))\np = 1\nfor i in range(1, n + 1):\n p = p * i % 1000000007\nprint(p)\n","code_v1_no_empty_lines":"n = int(eval(input()))\n\n\ndef training(n):\n power = 1\n for i in range(1, n + 1):\n power = power * i % 1000000007\n return power\n\n\nprint((training(n)))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-p = 1","-for i in range(1, n + 1):","- p = p * i % 1000000007","-print(p)","+","+","+def training(n):","+ power = 1","+ for i in range(1, n + 1):","+ power = power * i % 1000000007","+ return power","+","+","+print((training(n)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1074517744,"measured_runtime_v1":0.0412085044,"runtime_lift":2.6075145361,"key":["s374050527","s878980393"]} +{"user_id":"u997521090","problem_id":"p03209","language":"python","submission_id_v0":"s200597778","submission_id_v1":"s804491578","cpu_time_v0":11,"cpu_time_v1":10,"memory_v0":2568,"memory_v1":2692,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.09,"input":"def func(lv, id):\n\n sz = 4 * 2 ** lv - 3\n\n num = 2 * 2 ** lv - 1\n\n mid = (sz + 1) \/ 2\n\n if lv == 0:\n\n return 1\n\n if id == 1:\n\n return 0\n\n if id == mid:\n\n return num \/ 2 + 1\n\n if id == sz:\n\n return num\n\n if 1 < id < mid:\n\n return func(lv - 1, id - 1)\n\n if mid < id < sz:\n\n return func(lv - 1, id - sz \/ 2 - 1) + num \/ 2 + 1\n\n\n\nprint(func(*list(map(int, input().split()))))","target":"def func(lv, id):\n\n sz = 4 * 2 ** lv - 3\n\n num = 2 * 2 ** lv - 1\n\n mid = (sz + 1) \/ 2\n\n if id < 1 or id > sz:\n\n return 0\n\n return [0, func(lv - 1, id - 1), num \/ 2 + 1, func(lv - 1, id - sz \/ 2 - 1) + num \/ 2 + 1, num, 1][(id > 1) + (id >= mid) + (id > mid) + (id >= sz) + (lv == 0) * 3]\n\n\n\nprint(func(*list(map(int, input().split()))))","code_v0_loc":18,"code_v1_loc":9,"code_v0_num_chars":437,"code_v1_num_chars":355,"code_v0_no_empty_lines":"def func(lv, id):\n sz = 4 * 2**lv - 3\n num = 2 * 2**lv - 1\n mid = (sz + 1) \/ 2\n if lv == 0:\n return 1\n if id == 1:\n return 0\n if id == mid:\n return num \/ 2 + 1\n if id == sz:\n return num\n if 1 < id < mid:\n return func(lv - 1, id - 1)\n if mid < id < sz:\n return func(lv - 1, id - sz \/ 2 - 1) + num \/ 2 + 1\n\n\nprint(func(*list(map(int, input().split()))))\n","code_v1_no_empty_lines":"def func(lv, id):\n sz = 4 * 2**lv - 3\n num = 2 * 2**lv - 1\n mid = (sz + 1) \/ 2\n if id < 1 or id > sz:\n return 0\n return [\n 0,\n func(lv - 1, id - 1),\n num \/ 2 + 1,\n func(lv - 1, id - sz \/ 2 - 1) + num \/ 2 + 1,\n num,\n 1,\n ][(id > 1) + (id >= mid) + (id > mid) + (id >= sz) + (lv == 0) * 3]\n\n\nprint(func(*list(map(int, input().split()))))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["- if lv == 0:","- return 1","- if id == 1:","+ if id < 1 or id > sz:","- if id == mid:","- return num \/ 2 + 1","- if id == sz:","- return num","- if 1 < id < mid:","- return func(lv - 1, id - 1)","- if mid < id < sz:","- return func(lv - 1, id - sz \/ 2 - 1) + num \/ 2 + 1","+ return [","+ 0,","+ func(lv - 1, id - 1),","+ num \/ 2 + 1,","+ func(lv - 1, id - sz \/ 2 - 1) + num \/ 2 + 1,","+ num,","+ 1,","+ ][(id > 1) + (id >= mid) + (id > mid) + (id >= sz) + (lv == 0) * 3]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0388142717,"measured_runtime_v1":0.0363514271,"runtime_lift":1.0677509742,"key":["s200597778","s804491578"]} +{"user_id":"u123756661","problem_id":"p03045","language":"python","submission_id_v0":"s551555155","submission_id_v1":"s855979438","cpu_time_v0":957,"cpu_time_v1":337,"memory_v0":72608,"memory_v1":79900,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.79,"input":"#!\/usr\/bin\/env python3\n\n# -*- coding: UTF-8 -*-\n\n\n\nclass UnionFind:\n\n def __init__(self, size):\n\n self.rank=[0]*size\n\n self.par =[int(i) for i in range(size)]\n\n self.grp =size\n\n\n\n def find(self, x):\n\n if x==self.par[x]: return x\n\n\n\n self.par[x]=self.find(self.par[x])\n\n return self.par[x]\n\n\n\n def same(self, x, y): #2\u3064\u306e\u9802\u70b9\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u3067\u3042\u308b\u304b\u3092\u5224\u5b9a\u3059\u308b\n\n return self.find(x)==self.find(y)\n\n\n\n def unite(self, x, y): #\u8fba\u3067\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b2\u3064\u306e\u9802\u70b9\u3092\u6295\u3052\u3066\u7d71\u5408\u3059\u308b\n\n x,y=self.find(x),self.find(y)\n\n if x==y:\n\n return\n\n\n\n self.grp-=1\n\n if self.rank[x]> j) & 1:\n\n t.append('+')\n\n ans += int(s[j+1])\n\n else:\n\n t.append('-')\n\n ans -= int(s[j+1])\n\n if ans == 7:\n\n siki = ''\n\n for i in range(4):\n\n siki += t[i]+s[i]\n\n siki += '=7'\n\n print(siki)\n\n exit()","target":"s = list(str(eval(input())))\n\nimport itertools\n\nfor p in itertools.product(('+', '-'), repeat=3):\n\n temp = [0]*7\n\n for i in range(4):\n\n temp[2*i] = s[i]\n\n for i in range(3):\n\n temp[2*i+1] = p[i]\n\n #print(temp)\n\n temp = ''.join(temp)\n\n if eval(temp) == 7:\n\n print((temp+'=7'))\n\n exit()\n","code_v0_loc":19,"code_v1_loc":13,"code_v0_num_chars":420,"code_v1_num_chars":323,"code_v0_no_empty_lines":"s = list(str(eval(input())))\nfor i in range(2**3):\n t = [\"\"]\n ans = int(s[0])\n for j in range(3):\n if (i >> j) & 1:\n t.append(\"+\")\n ans += int(s[j + 1])\n else:\n t.append(\"-\")\n ans -= int(s[j + 1])\n if ans == 7:\n siki = \"\"\n for i in range(4):\n siki += t[i] + s[i]\n siki += \"=7\"\n print(siki)\n exit()\n","code_v1_no_empty_lines":"s = list(str(eval(input())))\nimport itertools\n\nfor p in itertools.product((\"+\", \"-\"), repeat=3):\n temp = [0] * 7\n for i in range(4):\n temp[2 * i] = s[i]\n for i in range(3):\n temp[2 * i + 1] = p[i]\n # print(temp)\n temp = \"\".join(temp)\n if eval(temp) == 7:\n print((temp + \"=7\"))\n exit()\n","code_same":false,"relative_loc_diff_percent":31.5789473684,"diff":["-for i in range(2**3):","- t = [\"\"]","- ans = int(s[0])","- for j in range(3):","- if (i >> j) & 1:","- t.append(\"+\")","- ans += int(s[j + 1])","- else:","- t.append(\"-\")","- ans -= int(s[j + 1])","- if ans == 7:","- siki = \"\"","- for i in range(4):","- siki += t[i] + s[i]","- siki += \"=7\"","- print(siki)","+import itertools","+","+for p in itertools.product((\"+\", \"-\"), repeat=3):","+ temp = [0] * 7","+ for i in range(4):","+ temp[2 * i] = s[i]","+ for i in range(3):","+ temp[2 * i + 1] = p[i]","+ # print(temp)","+ temp = \"\".join(temp)","+ if eval(temp) == 7:","+ print((temp + \"=7\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0323433871,"measured_runtime_v1":0.0340404327,"runtime_lift":0.9501461809,"key":["s443460424","s124041574"]} +{"user_id":"u073852194","problem_id":"p02824","language":"python","submission_id_v0":"s685546848","submission_id_v1":"s429549964","cpu_time_v0":206,"cpu_time_v1":187,"memory_v0":14480,"memory_v1":14964,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.22,"input":"N,M,V,P = list(map(int,input().split()))\n\nA = sorted(list(map(int,input().split())))\n\nB = A[:N-P+1]\n\n\n\nS = [0]\n\nfor i in range(N-P+1):\n\n S.append(S[-1]+B[i])\n\n\n\nans = P-1\n\n\n\nfor i in range(N-P+1):\n\n if B[i]+M-B[-1]<0:\n\n continue\n\n if B[i]*(N-P-i)-(S[-1]-S[i+1])+M*(N-P)>=max(M*(V-P),0):\n\n ans += 1\n\n\n\nprint(ans)","target":"N,M,V,P = list(map(int,input().split()))\n\nA = sorted(list(map(int,input().split())))\n\nS = [0]\n\nfor i in range(N-P+1):\n\n S += [S[-1]+A[i]]\n\na = P-1\n\nfor i in range(N-P+1):\n\n if A[i]+M>=A[N-P] and A[i]*(N-P-i)-(S[-1]-S[i+1])>=M*(V-N):\n\n a += 1\n\nprint(a)","code_v0_loc":17,"code_v1_loc":10,"code_v0_num_chars":328,"code_v1_num_chars":258,"code_v0_no_empty_lines":"N, M, V, P = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())))\nB = A[: N - P + 1]\nS = [0]\nfor i in range(N - P + 1):\n S.append(S[-1] + B[i])\nans = P - 1\nfor i in range(N - P + 1):\n if B[i] + M - B[-1] < 0:\n continue\n if B[i] * (N - P - i) - (S[-1] - S[i + 1]) + M * (N - P) >= max(M * (V - P), 0):\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N, M, V, P = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())))\nS = [0]\nfor i in range(N - P + 1):\n S += [S[-1] + A[i]]\na = P - 1\nfor i in range(N - P + 1):\n if A[i] + M >= A[N - P] and A[i] * (N - P - i) - (S[-1] - S[i + 1]) >= M * (V - N):\n a += 1\nprint(a)\n","code_same":false,"relative_loc_diff_percent":41.1764705882,"diff":["-B = A[: N - P + 1]","- S.append(S[-1] + B[i])","-ans = P - 1","+ S += [S[-1] + A[i]]","+a = P - 1","- if B[i] + M - B[-1] < 0:","- continue","- if B[i] * (N - P - i) - (S[-1] - S[i + 1]) + M * (N - P) >= max(M * (V - P), 0):","- ans += 1","-print(ans)","+ if A[i] + M >= A[N - P] and A[i] * (N - P - i) - (S[-1] - S[i + 1]) >= M * (V - N):","+ a += 1","+print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0818324115,"measured_runtime_v1":0.0353301947,"runtime_lift":2.3162173934,"key":["s685546848","s429549964"]} +{"user_id":"u847467233","problem_id":"p00707","language":"python","submission_id_v0":"s855726623","submission_id_v1":"s980885217","cpu_time_v0":270,"cpu_time_v1":230,"memory_v0":5624,"memory_v1":5616,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.81,"input":"# AOJ 1126: The Secret Number\n\n# Python3 2018.7.16 bal4u\n\n\n\nwhile True:\n\n\tW, H = list(map(int, input().split()))\n\n\tif W == 0: break\n\n\td = [list(eval(input())) for r in range(H)]\n\n\ta = [[0 for c in range(W)] for r in range(H)]\n\n\tans = 0\n\n\tfor r in range(H):\n\n\t\tfor c in range(W):\n\n\t\t\tif not d[r][c].isdigit(): continue\n\n\t\t\ta[r][c] = k = int(d[r][c])\n\n\t\t\tif c > 0 and d[r][c-1].isdigit():\n\n\t\t\t\ta[r][c] = a[r][c-1]*10 + k\n\n\t\t\tif r > 0 and d[r-1][c].isdigit():\n\n\t\t\t\tt = a[r-1][c]*10 + k\n\n\t\t\t\ta[r][c] = max(a[r][c], t)\n\n\t\t\tans = max(ans, a[r][c])\n\n\tprint(ans);\n\n\n","target":"# AOJ 1126: The Secret Number\n\n# Python3 2018.7.16 bal4u\n\n\n\nwhile True:\n\n\tW, H = list(map(int, input().split()))\n\n\tif W == 0: break\n\n\td = [list(eval(input())) for r in range(H)]\n\n\ta = [[0 for c in range(W)] for r in range(H)]\n\n\tans = 0\n\n\tfor r in range(H):\n\n\t\tfor c in range(W):\n\n\t\t\tif d[r][c] >= '0' and d[r][c] <= '9':\n\n\t\t\t\tk = int(d[r][c])\n\n\t\t\t\tk1 = k2 = 0\n\n\t\t\t\tif c > 0: k1 = a[r][c-1]*10 + k\n\n\t\t\t\tif r > 0: k2 = a[r-1][c]*10 + k\n\n\t\t\t\ta[r][c] = max(k, k1, k2)\n\n\t\t\t\tans = max(ans, a[r][c])\n\n\tprint(ans);\n\n\n","code_v0_loc":21,"code_v1_loc":20,"code_v0_num_chars":546,"code_v1_num_chars":497,"code_v0_no_empty_lines":"# AOJ 1126: The Secret Number\n# Python3 2018.7.16 bal4u\nwhile True:\n W, H = list(map(int, input().split()))\n if W == 0:\n break\n d = [list(eval(input())) for r in range(H)]\n a = [[0 for c in range(W)] for r in range(H)]\n ans = 0\n for r in range(H):\n for c in range(W):\n if not d[r][c].isdigit():\n continue\n a[r][c] = k = int(d[r][c])\n if c > 0 and d[r][c - 1].isdigit():\n a[r][c] = a[r][c - 1] * 10 + k\n if r > 0 and d[r - 1][c].isdigit():\n t = a[r - 1][c] * 10 + k\n a[r][c] = max(a[r][c], t)\n ans = max(ans, a[r][c])\n print(ans)\n","code_v1_no_empty_lines":"# AOJ 1126: The Secret Number\n# Python3 2018.7.16 bal4u\nwhile True:\n W, H = list(map(int, input().split()))\n if W == 0:\n break\n d = [list(eval(input())) for r in range(H)]\n a = [[0 for c in range(W)] for r in range(H)]\n ans = 0\n for r in range(H):\n for c in range(W):\n if d[r][c] >= \"0\" and d[r][c] <= \"9\":\n k = int(d[r][c])\n k1 = k2 = 0\n if c > 0:\n k1 = a[r][c - 1] * 10 + k\n if r > 0:\n k2 = a[r - 1][c] * 10 + k\n a[r][c] = max(k, k1, k2)\n ans = max(ans, a[r][c])\n print(ans)\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["- if not d[r][c].isdigit():","- continue","- a[r][c] = k = int(d[r][c])","- if c > 0 and d[r][c - 1].isdigit():","- a[r][c] = a[r][c - 1] * 10 + k","- if r > 0 and d[r - 1][c].isdigit():","- t = a[r - 1][c] * 10 + k","- a[r][c] = max(a[r][c], t)","- ans = max(ans, a[r][c])","+ if d[r][c] >= \"0\" and d[r][c] <= \"9\":","+ k = int(d[r][c])","+ k1 = k2 = 0","+ if c > 0:","+ k1 = a[r][c - 1] * 10 + k","+ if r > 0:","+ k2 = a[r - 1][c] * 10 + k","+ a[r][c] = max(k, k1, k2)","+ ans = max(ans, a[r][c])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0707375987,"measured_runtime_v1":0.0732288806,"runtime_lift":0.9659795155,"key":["s855726623","s980885217"]} +{"user_id":"u036104576","problem_id":"p04045","language":"python","submission_id_v0":"s158997430","submission_id_v1":"s527824464","cpu_time_v0":95,"cpu_time_v1":77,"memory_v0":9364,"memory_v1":9124,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.95,"input":"import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\nimport heapq\n\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n# map(int, input().split())\n\nN, K = list(map(int, input().split()))\n\nD = input().split()\n\n\n\nfor n in range(N, 100000):\n\n s = str(n)\n\n ok = True\n\n for c in s:\n\n if c in D:\n\n ok = False\n\n if ok:\n\n print(n)\n\n break\n\n\n\n \n\n ","target":"N, K = list(map(int, input().split()))\n\nD = set(input().split())\n\n\n\nfor n in range(N, N * 10 + 1):\n\n ok = True\n\n for c in str(n):\n\n if c in D:\n\n ok = False\n\n if ok:\n\n print(n)\n\n break\n\n\n\n \n\n ","code_v0_loc":31,"code_v1_loc":14,"code_v0_num_chars":572,"code_v1_num_chars":232,"code_v0_no_empty_lines":"import sys\nimport itertools\n\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**7)\nINF = 10**18\nMOD = 10**9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n# map(int, input().split())\nN, K = list(map(int, input().split()))\nD = input().split()\nfor n in range(N, 100000):\n s = str(n)\n ok = True\n for c in s:\n if c in D:\n ok = False\n if ok:\n print(n)\n break\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nD = set(input().split())\nfor n in range(N, N * 10 + 1):\n ok = True\n for c in str(n):\n if c in D:\n ok = False\n if ok:\n print(n)\n break\n","code_same":false,"relative_loc_diff_percent":54.8387096774,"diff":["-import sys","-import itertools","-","-# import numpy as np","-import time","-import math","-import heapq","-from collections import defaultdict","-","-sys.setrecursionlimit(10**7)","-INF = 10**18","-MOD = 10**9 + 7","-read = sys.stdin.buffer.read","-readline = sys.stdin.buffer.readline","-readlines = sys.stdin.buffer.readlines","-# map(int, input().split())","-D = input().split()","-for n in range(N, 100000):","- s = str(n)","+D = set(input().split())","+for n in range(N, N * 10 + 1):","- for c in s:","+ for c in str(n):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0507157326,"measured_runtime_v1":0.0484319687,"runtime_lift":1.0471540583,"key":["s158997430","s527824464"]} +{"user_id":"u175034939","problem_id":"p03074","language":"python","submission_id_v0":"s517722887","submission_id_v1":"s033231623","cpu_time_v0":93,"cpu_time_v1":63,"memory_v0":8560,"memory_v1":9308,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.26,"input":"from itertools import accumulate\n\nn, k = list(map(int,input().split()))\n\ns = eval(input())\n\na = []\n\ni = 0\n\ncnt = 0\n\nnow = s[0]\n\nwhile i < n:\n\n if s[i] == now:\n\n cnt += 1\n\n else:\n\n a.append(cnt)\n\n now = s[i]\n\n cnt = 1\n\n if i == n-1:\n\n a.append(cnt)\n\n i += 1\n\n\n\nif len(a) == 1 and s[0] == '1':\n\n print(n)\n\n exit()\n\n\n\nif s[0] == '0':\n\n a = [0] + a\n\nif s[-1] == '0':\n\n a.append(0)\n\n \n\nr = list(accumulate(a))\n\nlr = len(r)\n\nans = -float('inf')\n\nkk = 2*k+1\n\nfor i in range(k*2, lr+1 , 2):\n\n if i == k*2:\n\n ans = max(ans, r[i])\n\n else:\n\n ans = max(ans, r[i] - r[i-kk])\n\n \n\nif ans == -float('inf'):\n\n print(n)\n\n exit()\n\nprint(ans)","target":"from itertools import accumulate\n\nn, k = list(map(int, input().split()))\n\ns = eval(input())\n\na = []\n\ncnt = 0\n\nnow = s[0]\n\nfor ss in s:\n\n if ss == now:\n\n cnt += 1\n\n else:\n\n a.append(cnt)\n\n cnt = 1\n\n now = ss\n\na.append(cnt)\n\n\n\na = [0]*(1-int(s[0])) + a + [0]*(1-int(s[-1]))\n\nla = len(a)\n\nkk = 2*k+1\n\nif la == 1 or la <= kk:\n\n print(n)\n\n exit()\n\n \n\nac = [0] + list(accumulate(a))\n\nans = -float('inf')\n\nfor i in range(kk, la+1, 2):\n\n ans = max(ans, ac[i] - ac[i-kk])\n\nprint(ans)","code_v0_loc":41,"code_v1_loc":27,"code_v0_num_chars":705,"code_v1_num_chars":508,"code_v0_no_empty_lines":"from itertools import accumulate\n\nn, k = list(map(int, input().split()))\ns = eval(input())\na = []\ni = 0\ncnt = 0\nnow = s[0]\nwhile i < n:\n if s[i] == now:\n cnt += 1\n else:\n a.append(cnt)\n now = s[i]\n cnt = 1\n if i == n - 1:\n a.append(cnt)\n i += 1\nif len(a) == 1 and s[0] == \"1\":\n print(n)\n exit()\nif s[0] == \"0\":\n a = [0] + a\nif s[-1] == \"0\":\n a.append(0)\nr = list(accumulate(a))\nlr = len(r)\nans = -float(\"inf\")\nkk = 2 * k + 1\nfor i in range(k * 2, lr + 1, 2):\n if i == k * 2:\n ans = max(ans, r[i])\n else:\n ans = max(ans, r[i] - r[i - kk])\nif ans == -float(\"inf\"):\n print(n)\n exit()\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import accumulate\n\nn, k = list(map(int, input().split()))\ns = eval(input())\na = []\ncnt = 0\nnow = s[0]\nfor ss in s:\n if ss == now:\n cnt += 1\n else:\n a.append(cnt)\n cnt = 1\n now = ss\na.append(cnt)\na = [0] * (1 - int(s[0])) + a + [0] * (1 - int(s[-1]))\nla = len(a)\nkk = 2 * k + 1\nif la == 1 or la <= kk:\n print(n)\n exit()\nac = [0] + list(accumulate(a))\nans = -float(\"inf\")\nfor i in range(kk, la + 1, 2):\n ans = max(ans, ac[i] - ac[i - kk])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":34.1463414634,"diff":["-i = 0","-while i < n:","- if s[i] == now:","+for ss in s:","+ if ss == now:","- now = s[i]","- if i == n - 1:","- a.append(cnt)","- i += 1","-if len(a) == 1 and s[0] == \"1\":","+ now = ss","+a.append(cnt)","+a = [0] * (1 - int(s[0])) + a + [0] * (1 - int(s[-1]))","+la = len(a)","+kk = 2 * k + 1","+if la == 1 or la <= kk:","-if s[0] == \"0\":","- a = [0] + a","-if s[-1] == \"0\":","- a.append(0)","-r = list(accumulate(a))","-lr = len(r)","+ac = [0] + list(accumulate(a))","-kk = 2 * k + 1","-for i in range(k * 2, lr + 1, 2):","- if i == k * 2:","- ans = max(ans, r[i])","- else:","- ans = max(ans, r[i] - r[i - kk])","-if ans == -float(\"inf\"):","- print(n)","- exit()","+for i in range(kk, la + 1, 2):","+ ans = max(ans, ac[i] - ac[i - kk])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0417046797,"measured_runtime_v1":0.0744110456,"runtime_lift":0.5604635631,"key":["s517722887","s033231623"]} +{"user_id":"u227082700","problem_id":"p03239","language":"python","submission_id_v0":"s116777858","submission_id_v1":"s076459575","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"n,t=list(map(int,input().split()));c=[]\n\nfor i in range(n):\n\n a,b=list(map(int,input().split()))\n\n if b<=t:\n\n c.append(a)\n\nif c==[]:print(\"TLE\")\n\nelse:c.sort();print((c[0]))","target":"n,t=list(map(int,input().split()))\n\nans=10**9\n\nfor i in range(n):\n\n c,tt=list(map(int,input().split()))\n\n if tt<=t:ans=min(ans,c)\n\nif ans==10**9:print(\"TLE\")\n\nelse:print(ans)","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":164,"code_v1_num_chars":164,"code_v0_no_empty_lines":"n, t = list(map(int, input().split()))\nc = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n if b <= t:\n c.append(a)\nif c == []:\n print(\"TLE\")\nelse:\n c.sort()\n print((c[0]))\n","code_v1_no_empty_lines":"n, t = list(map(int, input().split()))\nans = 10**9\nfor i in range(n):\n c, tt = list(map(int, input().split()))\n if tt <= t:\n ans = min(ans, c)\nif ans == 10**9:\n print(\"TLE\")\nelse:\n print(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-c = []","+ans = 10**9","- a, b = list(map(int, input().split()))","- if b <= t:","- c.append(a)","-if c == []:","+ c, tt = list(map(int, input().split()))","+ if tt <= t:","+ ans = min(ans, c)","+if ans == 10**9:","- c.sort()","- print((c[0]))","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0451920259,"measured_runtime_v1":0.0607865314,"runtime_lift":0.7434545913,"key":["s116777858","s076459575"]} +{"user_id":"u804711544","problem_id":"p02707","language":"python","submission_id_v0":"s760139856","submission_id_v1":"s507475620","cpu_time_v0":287,"cpu_time_v1":128,"memory_v0":62860,"memory_v1":32220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.4,"input":"n = int(eval(input()))\n\na = {}\n\nfor i in range(1, n+1):\n\n a[i] = []\n\n\n\nmember = list(map(int, input().split()))\n\nfor i in member:\n\n a[i].append(1)\n\n\n\nfor j in a:\n\n print((len(a[j])))","target":"n = int(input())\n\na = list(map(int, input().split()))\n\n\n\nmember = [0] * n\n\nfor i in a:\n\n member[i-1] += 1\n\n\n\nprint(*member, sep='\\n')\n","code_v0_loc":11,"code_v1_loc":8,"code_v0_num_chars":183,"code_v1_num_chars":136,"code_v0_no_empty_lines":"n = int(eval(input()))\na = {}\nfor i in range(1, n + 1):\n a[i] = []\nmember = list(map(int, input().split()))\nfor i in member:\n a[i].append(1)\nfor j in a:\n print((len(a[j])))\n","code_v1_no_empty_lines":"n = int(input())\na = list(map(int, input().split()))\nmember = [0] * n\nfor i in a:\n member[i - 1] += 1\nprint(*member, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-n = int(eval(input()))","-a = {}","-for i in range(1, n + 1):","- a[i] = []","-member = list(map(int, input().split()))","-for i in member:","- a[i].append(1)","-for j in a:","- print((len(a[j])))","+n = int(input())","+a = list(map(int, input().split()))","+member = [0] * n","+for i in a:","+ member[i - 1] += 1","+print(*member, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.079292238,"measured_runtime_v1":0.0587863233,"runtime_lift":1.3488211802,"key":["s760139856","s507475620"]} +{"user_id":"u754022296","problem_id":"p03203","language":"python","submission_id_v0":"s186575856","submission_id_v1":"s403131744","cpu_time_v0":1181,"cpu_time_v1":723,"memory_v0":54244,"memory_v1":54264,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.78,"input":"h, w, n = list(map(int, input().split()))\n\nxy = sorted([list(map(int, input().split())) for _ in range(n)])\n\ndx = 0\n\ndy = 0\n\nfor x, y in xy:\n\n x -= dx\n\n y -= dy\n\n if x == y:\n\n dx += x-1\n\n dy += y-2\n\n elif y < x:\n\n print((dx+x-1))\n\n break\n\nelse:\n\n print(h)","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n h, w, n = list(map(int, input().split()))\n\n xy = sorted([list(map(int, input().split())) for _ in range(n)])\n\n dx = 0\n\n dy = 0\n\n for x, y in xy:\n\n x -= dx\n\n y -= dy\n\n if x == y:\n\n dx += x-1\n\n dy += y-2\n\n elif y < x:\n\n print((dx+x-1))\n\n break\n\n else:\n\n print(h)\n\n \n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":15,"code_v1_loc":22,"code_v0_num_chars":264,"code_v1_num_chars":393,"code_v0_no_empty_lines":"h, w, n = list(map(int, input().split()))\nxy = sorted([list(map(int, input().split())) for _ in range(n)])\ndx = 0\ndy = 0\nfor x, y in xy:\n x -= dx\n y -= dy\n if x == y:\n dx += x - 1\n dy += y - 2\n elif y < x:\n print((dx + x - 1))\n break\nelse:\n print(h)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n h, w, n = list(map(int, input().split()))\n xy = sorted([list(map(int, input().split())) for _ in range(n)])\n dx = 0\n dy = 0\n for x, y in xy:\n x -= dx\n y -= dy\n if x == y:\n dx += x - 1\n dy += y - 2\n elif y < x:\n print((dx + x - 1))\n break\n else:\n print(h)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":31.8181818182,"diff":["-h, w, n = list(map(int, input().split()))","-xy = sorted([list(map(int, input().split())) for _ in range(n)])","-dx = 0","-dy = 0","-for x, y in xy:","- x -= dx","- y -= dy","- if x == y:","- dx += x - 1","- dy += y - 2","- elif y < x:","- print((dx + x - 1))","- break","-else:","- print(h)","+import sys","+","+input = sys.stdin.readline","+","+","+def main():","+ h, w, n = list(map(int, input().split()))","+ xy = sorted([list(map(int, input().split())) for _ in range(n)])","+ dx = 0","+ dy = 0","+ for x, y in xy:","+ x -= dx","+ y -= dy","+ if x == y:","+ dx += x - 1","+ dy += y - 2","+ elif y < x:","+ print((dx + x - 1))","+ break","+ else:","+ print(h)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0445584376,"measured_runtime_v1":0.0744419415,"runtime_lift":0.5985663012,"key":["s186575856","s403131744"]} +{"user_id":"u603234915","problem_id":"p03221","language":"python","submission_id_v0":"s958355209","submission_id_v1":"s315052983","cpu_time_v0":1423,"cpu_time_v1":689,"memory_v0":43752,"memory_v1":24116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.58,"input":"import numpy as np\n\n\n\nN, M = list(map(int, input().split()))\n\nP = []\n\nY = []\n\nfor _ in range(M):\n\n p, y = list(map(int, input().split()))\n\n P.append(p)\n\n Y.append(y)\n\nP = np.array(P)\n\nY = np.array(Y)\n\nPY = np.c_[P, Y]\n\nsort_ind = np.argsort(Y)\n\n\n\nPY_sort = PY[sort_ind]\n\ncount = [0] * (int(1e+5) + 1)\n\nid_list = []\n\nfor p, y in PY_sort:\n\n count[p] += 1\n\n id_list.append(str(p).zfill(6) + str(count[p]).zfill(6))\n\n\n\nid_list = np.array(id_list)\n\nid_list = id_list[np.argsort(sort_ind)]\n\nfor city_id in id_list:\n\n print(city_id)","target":"import bisect\n\nN, M = list(map(int, input().split()))\n\nP, Y = [], []\n\npref = [[] for _ in range(N+1)] # non-0-indexed\n\nfor m in range(M):\n\n p,y = list(map(int, input().split()))\n\n P.append(p)\n\n Y.append(y)\n\n pref[p].append(y)\n\nfor i, p in enumerate(pref):\n\n pref[i] = sorted(p)\n\n \n\nfor p,y in zip(P,Y):\n\n ans = \"{:0>6}\".format(p)\n\n i = bisect.bisect(pref[p], y)\n\n ans += \"{:0>6}\".format(i)\n\n print(ans)\n\n\n\n\n","code_v0_loc":25,"code_v1_loc":19,"code_v0_num_chars":531,"code_v1_num_chars":425,"code_v0_no_empty_lines":"import numpy as np\n\nN, M = list(map(int, input().split()))\nP = []\nY = []\nfor _ in range(M):\n p, y = list(map(int, input().split()))\n P.append(p)\n Y.append(y)\nP = np.array(P)\nY = np.array(Y)\nPY = np.c_[P, Y]\nsort_ind = np.argsort(Y)\nPY_sort = PY[sort_ind]\ncount = [0] * (int(1e5) + 1)\nid_list = []\nfor p, y in PY_sort:\n count[p] += 1\n id_list.append(str(p).zfill(6) + str(count[p]).zfill(6))\nid_list = np.array(id_list)\nid_list = id_list[np.argsort(sort_ind)]\nfor city_id in id_list:\n print(city_id)\n","code_v1_no_empty_lines":"import bisect\n\nN, M = list(map(int, input().split()))\nP, Y = [], []\npref = [[] for _ in range(N + 1)] # non-0-indexed\nfor m in range(M):\n p, y = list(map(int, input().split()))\n P.append(p)\n Y.append(y)\n pref[p].append(y)\nfor i, p in enumerate(pref):\n pref[i] = sorted(p)\nfor p, y in zip(P, Y):\n ans = \"{:0>6}\".format(p)\n i = bisect.bisect(pref[p], y)\n ans += \"{:0>6}\".format(i)\n print(ans)\n","code_same":false,"relative_loc_diff_percent":24.0,"diff":["-import numpy as np","+import bisect","-P = []","-Y = []","-for _ in range(M):","+P, Y = [], []","+pref = [[] for _ in range(N + 1)] # non-0-indexed","+for m in range(M):","-P = np.array(P)","-Y = np.array(Y)","-PY = np.c_[P, Y]","-sort_ind = np.argsort(Y)","-PY_sort = PY[sort_ind]","-count = [0] * (int(1e5) + 1)","-id_list = []","-for p, y in PY_sort:","- count[p] += 1","- id_list.append(str(p).zfill(6) + str(count[p]).zfill(6))","-id_list = np.array(id_list)","-id_list = id_list[np.argsort(sort_ind)]","-for city_id in id_list:","- print(city_id)","+ pref[p].append(y)","+for i, p in enumerate(pref):","+ pref[i] = sorted(p)","+for p, y in zip(P, Y):","+ ans = \"{:0>6}\".format(p)","+ i = bisect.bisect(pref[p], y)","+ ans += \"{:0>6}\".format(i)","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.227558795,"measured_runtime_v1":0.0785953689,"runtime_lift":2.8953206532,"key":["s958355209","s315052983"]} +{"user_id":"u813102292","problem_id":"p03160","language":"python","submission_id_v0":"s725998652","submission_id_v1":"s310992048","cpu_time_v0":154,"cpu_time_v1":100,"memory_v0":13800,"memory_v1":85756,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.06,"input":"n = int(eval(input()))\n\nh = [int(i) for i in input().split()]\n\ndp = [0 for i in range(n)]\n\nfor i in range(n):\n\n if i==0:\n\n dp[i] = 0\n\n elif i==1:\n\n dp[i] = abs(h[i]-h[i-1])\n\n else:\n\n dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))\n\n\n\nprint((dp[n-1]))","target":"N = int(eval(input()))\n\nH = list(map(int, input().split()))\n\nH = [0] + H\n\ndp = [0] * (N+1)\n\nfor i in range(2,N+1):\n\n if i-2>=1:\n\n dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2]))\n\n else:\n\n dp[i] = dp[i] + abs(H[i]-H[i-1])\n\nres = dp[N]\n\nprint(res)","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":288,"code_v1_num_chars":275,"code_v0_no_empty_lines":"n = int(eval(input()))\nh = [int(i) for i in input().split()]\ndp = [0 for i in range(n)]\nfor i in range(n):\n if i == 0:\n dp[i] = 0\n elif i == 1:\n dp[i] = abs(h[i] - h[i - 1])\n else:\n dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))\nprint((dp[n - 1]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\nH = [0] + H\ndp = [0] * (N + 1)\nfor i in range(2, N + 1):\n if i - 2 >= 1:\n dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))\n else:\n dp[i] = dp[i] + abs(H[i] - H[i - 1])\nres = dp[N]\nprint(res)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-n = int(eval(input()))","-h = [int(i) for i in input().split()]","-dp = [0 for i in range(n)]","-for i in range(n):","- if i == 0:","- dp[i] = 0","- elif i == 1:","- dp[i] = abs(h[i] - h[i - 1])","+N = int(eval(input()))","+H = list(map(int, input().split()))","+H = [0] + H","+dp = [0] * (N + 1)","+for i in range(2, N + 1):","+ if i - 2 >= 1:","+ dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))","- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))","-print((dp[n - 1]))","+ dp[i] = dp[i] + abs(H[i] - H[i - 1])","+res = dp[N]","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.140125226,"measured_runtime_v1":0.0433166637,"runtime_lift":3.2349034732,"key":["s725998652","s310992048"]} +{"user_id":"u323680411","problem_id":"p03821","language":"python","submission_id_v0":"s063762840","submission_id_v1":"s442791999","cpu_time_v0":185,"cpu_time_v1":171,"memory_v0":14836,"memory_v1":14836,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.57,"input":"import sys\n\n\n\n\n\ndef main() -> None:\n\n n = int(sys.stdin.readline())\n\n a = [0] * n\n\n b = [0] * n\n\n ans = 0\n\n\n\n for i in range(n):\n\n a[i], b[i] = list(map(int, sys.stdin.readline().split()))\n\n\n\n for i in range(n - 1, -1, -1):\n\n a[i] += ans\n\n if a[i] % b[i] != 0:\n\n ans += abs(a[i] % b[i] - b[i])\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","target":"import sys\n\n\n\n\n\ndef main() -> None:\n\n n = int(eval(input()))\n\n a = [0] * n\n\n b = [0] * n\n\n ans = 0\n\n\n\n for i in range(n):\n\n a[i], b[i] = list(map(int, sys.stdin.readline().split()))\n\n\n\n for i in range(n - 1, -1, -1):\n\n a[i] += ans\n\n if a[i] % b[i] != 0:\n\n ans += abs(a[i] % b[i] - b[i])\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":22,"code_v1_loc":22,"code_v0_num_chars":399,"code_v1_num_chars":386,"code_v0_no_empty_lines":"import sys\n\n\ndef main() -> None:\n n = int(sys.stdin.readline())\n a = [0] * n\n b = [0] * n\n ans = 0\n for i in range(n):\n a[i], b[i] = list(map(int, sys.stdin.readline().split()))\n for i in range(n - 1, -1, -1):\n a[i] += ans\n if a[i] % b[i] != 0:\n ans += abs(a[i] % b[i] - b[i])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef main() -> None:\n n = int(eval(input()))\n a = [0] * n\n b = [0] * n\n ans = 0\n for i in range(n):\n a[i], b[i] = list(map(int, sys.stdin.readline().split()))\n for i in range(n - 1, -1, -1):\n a[i] += ans\n if a[i] % b[i] != 0:\n ans += abs(a[i] % b[i] - b[i])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- n = int(sys.stdin.readline())","+ n = int(eval(input()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0871332935,"measured_runtime_v1":0.0395804757,"runtime_lift":2.2014210756,"key":["s063762840","s442791999"]} +{"user_id":"u670180528","problem_id":"p02991","language":"python","submission_id_v0":"s314916877","submission_id_v1":"s069378433","cpu_time_v0":443,"cpu_time_v1":407,"memory_v0":45960,"memory_v1":28484,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.13,"input":"from collections import deque\n\nN,M,*L,S,T = list(map(int,open(0).read().split()))\n\nG = [[] for _ in range(N)]\n\nstep = [[-1]*3 for _ in range(N)]\n\nstep[S-1][0] = 0\n\nfor u,v in zip(*[iter(L)]*2):\n\n\tG[u-1].append(v-1)\n\nq = deque([(S-1,0)])\n\nwhile q:\n\n\tcur,d = q.popleft()\n\n\tfor nxt in G[cur]:\n\n\t\tif nxt==T-1 and (d+1)%3==0:\n\n\t\t\tprint(((d+1)\/\/3))\n\n\t\t\texit()\n\n\t\tif step[nxt][(d+1)%3] < 0:\n\n\t\t\tstep[nxt][(d+1)%3] = d+1\n\n\t\t\tq.append((nxt,d+1))\n\nprint((-1))","target":"from collections import deque\n\nN,M,*L,S,T = list(map(int,open(0).read().split()))\n\nG = [[] for _ in range(N)]\n\nstep = [False for _ in range(3*N)]\n\nstep[(S-1)*3] = 0\n\nfor u,v in zip(*[iter(L)]*2):\n\n\tG[u-1].append(v-1)\n\nq = deque([(S-1,0)])\n\nwhile q:\n\n\tcur,d = q.popleft()\n\n\tfor nxt in G[cur]:\n\n\t\tif nxt==T-1 and (d+1)%3==0:\n\n\t\t\tprint(((d+1)\/\/3))\n\n\t\t\texit()\n\n\t\tif not step[nxt*3+(d+1)%3]:\n\n\t\t\tstep[nxt*3+(d+1)%3] = True\n\n\t\t\tq.append((nxt,d+1))\n\nprint((-1))","code_v0_loc":18,"code_v1_loc":18,"code_v0_num_chars":439,"code_v1_num_chars":444,"code_v0_no_empty_lines":"from collections import deque\n\nN, M, *L, S, T = list(map(int, open(0).read().split()))\nG = [[] for _ in range(N)]\nstep = [[-1] * 3 for _ in range(N)]\nstep[S - 1][0] = 0\nfor u, v in zip(*[iter(L)] * 2):\n G[u - 1].append(v - 1)\nq = deque([(S - 1, 0)])\nwhile q:\n cur, d = q.popleft()\n for nxt in G[cur]:\n if nxt == T - 1 and (d + 1) % 3 == 0:\n print(((d + 1) \/\/ 3))\n exit()\n if step[nxt][(d + 1) % 3] < 0:\n step[nxt][(d + 1) % 3] = d + 1\n q.append((nxt, d + 1))\nprint((-1))\n","code_v1_no_empty_lines":"from collections import deque\n\nN, M, *L, S, T = list(map(int, open(0).read().split()))\nG = [[] for _ in range(N)]\nstep = [False for _ in range(3 * N)]\nstep[(S - 1) * 3] = 0\nfor u, v in zip(*[iter(L)] * 2):\n G[u - 1].append(v - 1)\nq = deque([(S - 1, 0)])\nwhile q:\n cur, d = q.popleft()\n for nxt in G[cur]:\n if nxt == T - 1 and (d + 1) % 3 == 0:\n print(((d + 1) \/\/ 3))\n exit()\n if not step[nxt * 3 + (d + 1) % 3]:\n step[nxt * 3 + (d + 1) % 3] = True\n q.append((nxt, d + 1))\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-step = [[-1] * 3 for _ in range(N)]","-step[S - 1][0] = 0","+step = [False for _ in range(3 * N)]","+step[(S - 1) * 3] = 0","- if step[nxt][(d + 1) % 3] < 0:","- step[nxt][(d + 1) % 3] = d + 1","+ if not step[nxt * 3 + (d + 1) % 3]:","+ step[nxt * 3 + (d + 1) % 3] = True"],"diff_only_import_comment":false,"measured_runtime_v0":0.1100226684,"measured_runtime_v1":0.0441977828,"runtime_lift":2.4893255154,"key":["s314916877","s069378433"]} +{"user_id":"u573900545","problem_id":"p02641","language":"python","submission_id_v0":"s582194568","submission_id_v1":"s386535330","cpu_time_v0":123,"cpu_time_v1":29,"memory_v0":26988,"memory_v1":9176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.42,"input":"import numpy as np\n\nX, N = list(map(int, input().split()))\n\nif N == 0:\n\n print(X)\n\nelse:\n\n l = list(map(int, input().split()))\n\n app = [x for x in range(X - int(N \/ 2) - 1, X + int(N \/ 2) + 1) if x not in l]\n\n print((app[np.argmin([abs(x - X) for x in app])]))","target":"#cited from ppunchi\n\nX, N = list(map(int, input().split()))\n\np = list(map(int, input().split()))\n\nl = X - 1\n\nr = X + 1\n\nif not X in p:\n\n print(X)\n\n exit()\n\nwhile True:\n\n if not l in p:\n\n print(l)\n\n break\n\n elif not r in p:\n\n print(r)\n\n break\n\n l -= 1\n\n r += 1\n","code_v0_loc":8,"code_v1_loc":17,"code_v0_num_chars":264,"code_v1_num_chars":300,"code_v0_no_empty_lines":"import numpy as np\n\nX, N = list(map(int, input().split()))\nif N == 0:\n print(X)\nelse:\n l = list(map(int, input().split()))\n app = [x for x in range(X - int(N \/ 2) - 1, X + int(N \/ 2) + 1) if x not in l]\n print((app[np.argmin([abs(x - X) for x in app])]))\n","code_v1_no_empty_lines":"# cited from ppunchi\nX, N = list(map(int, input().split()))\np = list(map(int, input().split()))\nl = X - 1\nr = X + 1\nif not X in p:\n print(X)\n exit()\nwhile True:\n if not l in p:\n print(l)\n break\n elif not r in p:\n print(r)\n break\n l -= 1\n r += 1\n","code_same":false,"relative_loc_diff_percent":52.9411764706,"diff":["-import numpy as np","-","+# cited from ppunchi","-if N == 0:","+p = list(map(int, input().split()))","+l = X - 1","+r = X + 1","+if not X in p:","-else:","- l = list(map(int, input().split()))","- app = [x for x in range(X - int(N \/ 2) - 1, X + int(N \/ 2) + 1) if x not in l]","- print((app[np.argmin([abs(x - X) for x in app])]))","+ exit()","+while True:","+ if not l in p:","+ print(l)","+ break","+ elif not r in p:","+ print(r)","+ break","+ l -= 1","+ r += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.3222765536,"measured_runtime_v1":0.0349589849,"runtime_lift":9.2187045735,"key":["s582194568","s386535330"]} +{"user_id":"u597374218","problem_id":"p02947","language":"python","submission_id_v0":"s675122597","submission_id_v1":"s172720974","cpu_time_v0":477,"cpu_time_v1":416,"memory_v0":24652,"memory_v1":23524,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.79,"input":"import collections\n\nN=int(eval(input()))\n\ns=[str(sorted(eval(input()))) for i in range(N)]\n\nc=collections.Counter(s)\n\nprint((sum((v*(v-1))\/\/2 for v in list(c.values()))))","target":"N=int(eval(input()))\n\ndictionary={}\n\ncount=0\n\nfor i in range(N):\n\n s=tuple(sorted(eval(input())))\n\n if s in dictionary:\n\n dictionary[s]+=1\n\n count+=dictionary[s]\n\n else:\n\n dictionary[s]=0\n\nprint(count)","code_v0_loc":5,"code_v1_loc":11,"code_v0_num_chars":150,"code_v1_num_chars":219,"code_v0_no_empty_lines":"import collections\n\nN = int(eval(input()))\ns = [str(sorted(eval(input()))) for i in range(N)]\nc = collections.Counter(s)\nprint((sum((v * (v - 1)) \/\/ 2 for v in list(c.values()))))\n","code_v1_no_empty_lines":"N = int(eval(input()))\ndictionary = {}\ncount = 0\nfor i in range(N):\n s = tuple(sorted(eval(input())))\n if s in dictionary:\n dictionary[s] += 1\n count += dictionary[s]\n else:\n dictionary[s] = 0\nprint(count)\n","code_same":false,"relative_loc_diff_percent":54.5454545455,"diff":["-import collections","-","-s = [str(sorted(eval(input()))) for i in range(N)]","-c = collections.Counter(s)","-print((sum((v * (v - 1)) \/\/ 2 for v in list(c.values()))))","+dictionary = {}","+count = 0","+for i in range(N):","+ s = tuple(sorted(eval(input())))","+ if s in dictionary:","+ dictionary[s] += 1","+ count += dictionary[s]","+ else:","+ dictionary[s] = 0","+print(count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0595972328,"measured_runtime_v1":0.0349685373,"runtime_lift":1.7043101414,"key":["s675122597","s172720974"]} +{"user_id":"u366541443","problem_id":"p02913","language":"python","submission_id_v0":"s218641448","submission_id_v1":"s274285256","cpu_time_v0":498,"cpu_time_v1":364,"memory_v0":48356,"memory_v1":42076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.91,"input":"import math\n\nn = int(eval(input()))\n\ns = eval(input())\n\nans=0\n\nfor i in range(n):\n\n #print(i,n)\n\n maxim = i\n\n num=[0 for k in range(n-i)]\n\n count=0\n\n lmax=0\n\n for j in range(n-i):\n\n if(s[j]==s[i+j]):\n\n num[j]=1\n\n count+=1\n\n #print(count)\n\n if(lmax0:\n\n na = Q.popleft()\n\n for nb in g[na]:\n\n if v[nb] == -1:\n\n v[nb] = 1\n\n ans_tmp += 1\n\n Q.append(nb)\n\n ans = max(ans, ans_tmp)\n\nprint(ans)","target":"N, M = list(map(int, input().split()))\n\nr = [i for i in range(N+1)]\n\nn = [0 for i in range(N+1)]\n\nbuf = []\n\n\n\ndef root(x):\n\n if x==r[x]:\n\n return x\n\n else:\n\n r[x] = root(r[x])\n\n return r[x]\n\n\n\ndef unite(x, y):\n\n rx = root(x)\n\n ry = root(y)\n\n if rx < ry:\n\n r[ry] = rx\n\n elif rx > ry:\n\n r[rx] = ry\n\n \n\n\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n unite(a, b)\n\n\n\nfor x in range(1, N+1):\n\n if r[x] != x and r[r[x]] != r[x]:\n\n _ = root(x)\n\n \n\n \n\nfor x in r[1:]:\n\n n[x] += 1\n\n \n\nans = max(n[1:])\n\n\n\nprint(ans)","code_v0_loc":27,"code_v1_loc":36,"code_v0_num_chars":539,"code_v1_num_chars":546,"code_v0_no_empty_lines":"from collections import deque\n\nN, M = list(map(int, input().split()))\ng = {i: set() for i in range(N)}\nv = [-1 for i in range(N)]\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n g[a].add(b)\n g[b].add(a)\nQ = deque()\nans = 0\nfor a in g:\n if v[a] == -1:\n v[a] = 1\n ans_tmp = 1\n Q.append(a)\n while len(Q) > 0:\n na = Q.popleft()\n for nb in g[na]:\n if v[nb] == -1:\n v[nb] = 1\n ans_tmp += 1\n Q.append(nb)\n ans = max(ans, ans_tmp)\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nr = [i for i in range(N + 1)]\nn = [0 for i in range(N + 1)]\nbuf = []\n\n\ndef root(x):\n if x == r[x]:\n return x\n else:\n r[x] = root(r[x])\n return r[x]\n\n\ndef unite(x, y):\n rx = root(x)\n ry = root(y)\n if rx < ry:\n r[ry] = rx\n elif rx > ry:\n r[rx] = ry\n\n\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n unite(a, b)\nfor x in range(1, N + 1):\n if r[x] != x and r[r[x]] != r[x]:\n _ = root(x)\nfor x in r[1:]:\n n[x] += 1\nans = max(n[1:])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-from collections import deque","+N, M = list(map(int, input().split()))","+r = [i for i in range(N + 1)]","+n = [0 for i in range(N + 1)]","+buf = []","-N, M = list(map(int, input().split()))","-g = {i: set() for i in range(N)}","-v = [-1 for i in range(N)]","+","+def root(x):","+ if x == r[x]:","+ return x","+ else:","+ r[x] = root(r[x])","+ return r[x]","+","+","+def unite(x, y):","+ rx = root(x)","+ ry = root(y)","+ if rx < ry:","+ r[ry] = rx","+ elif rx > ry:","+ r[rx] = ry","+","+","- a, b = a - 1, b - 1","- g[a].add(b)","- g[b].add(a)","-Q = deque()","-ans = 0","-for a in g:","- if v[a] == -1:","- v[a] = 1","- ans_tmp = 1","- Q.append(a)","- while len(Q) > 0:","- na = Q.popleft()","- for nb in g[na]:","- if v[nb] == -1:","- v[nb] = 1","- ans_tmp += 1","- Q.append(nb)","- ans = max(ans, ans_tmp)","+ unite(a, b)","+for x in range(1, N + 1):","+ if r[x] != x and r[r[x]] != r[x]:","+ _ = root(x)","+for x in r[1:]:","+ n[x] += 1","+ans = max(n[1:])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0348883109,"measured_runtime_v1":0.044973208,"runtime_lift":0.7757576675,"key":["s669346244","s802682750"]} +{"user_id":"u150984829","problem_id":"p00468","language":"python","submission_id_v0":"s599895900","submission_id_v1":"s616092725","cpu_time_v0":110,"cpu_time_v1":90,"memory_v0":6772,"memory_v1":6292,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"for e in iter(input,'0'):\n\n R=[set()for _ in[0]*-~int(e)]\n\n for _ in[0]*int(eval(input())):\n\n a,b=list(map(int,input().split()))\n\n R[a]|={b}\n\n if a-1:R[b]|={a}\n\n for m in set(R[1]):\n\n R[1]|=R[m]\n\n print((len(R[1])))\n","target":"for e in iter(input,'0'):\n\n R=[[]for _ in[0]*-~int(e)]\n\n for _ in[0]*int(eval(input())):\n\n a,b=list(map(int,input().split()))\n\n R[a]+=[b];R[b]+=[a]\n\n for m in R[1][:]:R[1]+=R[m]\n\n print((len({*R[1]}-{1})))\n","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":206,"code_v1_num_chars":194,"code_v0_no_empty_lines":"for e in iter(input, \"0\"):\n R = [set() for _ in [0] * -~int(e)]\n for _ in [0] * int(eval(input())):\n a, b = list(map(int, input().split()))\n R[a] |= {b}\n if a - 1:\n R[b] |= {a}\n for m in set(R[1]):\n R[1] |= R[m]\n print((len(R[1])))\n","code_v1_no_empty_lines":"for e in iter(input, \"0\"):\n R = [[] for _ in [0] * -~int(e)]\n for _ in [0] * int(eval(input())):\n a, b = list(map(int, input().split()))\n R[a] += [b]\n R[b] += [a]\n for m in R[1][:]:\n R[1] += R[m]\n print((len({*R[1]} - {1})))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["- R = [set() for _ in [0] * -~int(e)]","+ R = [[] for _ in [0] * -~int(e)]","- R[a] |= {b}","- if a - 1:","- R[b] |= {a}","- for m in set(R[1]):","- R[1] |= R[m]","- print((len(R[1])))","+ R[a] += [b]","+ R[b] += [a]","+ for m in R[1][:]:","+ R[1] += R[m]","+ print((len({*R[1]} - {1})))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1287277646,"measured_runtime_v1":0.0490128434,"runtime_lift":2.6264088294,"key":["s599895900","s616092725"]} +{"user_id":"u930705402","problem_id":"p02743","language":"python","submission_id_v0":"s122265984","submission_id_v1":"s696396204","cpu_time_v0":34,"cpu_time_v1":17,"memory_v0":5076,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"from decimal import Decimal\n\na,b,c=list(map(int,input().split()))\n\nif(Decimal(a).sqrt()+Decimal(b).sqrt()0 else \"No\"))","code_v0_loc":6,"code_v1_loc":2,"code_v0_num_chars":167,"code_v1_num_chars":86,"code_v0_no_empty_lines":"from decimal import Decimal\n\na, b, c = list(map(int, input().split()))\nif Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nprint((\"Yes\" if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0 else \"No\"))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-from decimal import Decimal","-","-if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():","- print(\"Yes\")","-else:","- print(\"No\")","+print((\"Yes\" if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0 else \"No\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0498035206,"measured_runtime_v1":0.1070204659,"runtime_lift":0.4653644531,"key":["s122265984","s696396204"]} +{"user_id":"u901447859","problem_id":"p03339","language":"python","submission_id_v0":"s146841583","submission_id_v1":"s895515138","cpu_time_v0":229,"cpu_time_v1":157,"memory_v0":30828,"memory_v1":30828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.44,"input":"N=int(eval(input()))\n\nS=eval(input())\n\n\n\ntmp=0\n\nw=[]\n\nfor s in S:\n\n if s=='W': tmp+=1\n\n w.append(tmp)\n\n\n\ntmp=0\n\ne=[]\n\nfor s in S[::-1]:\n\n if s=='E': tmp+=1\n\n e.append(tmp)\n\ne=e[::-1]\n\n\n\nans=[]\n\nfor i in range(N):\n\n ans.append(w[i]+e[i]-1)\n\nprint((min(ans)))","target":"N=int(eval(input()))\n\nS=eval(input())\n\n\n\ndef cumsum_arr(s, w):\n\n arr=[]\n\n cnt=0\n\n for s_ in s:\n\n if s_==w: cnt+=1\n\n arr.append(cnt)\n\n return arr\n\n\n\nw=cumsum_arr(S, 'W')\n\ne=cumsum_arr(S[::-1],'E')\n\ne=e[::-1]\n\nans=[w[i]+e[i]-1 for i in range(N)]\n\nprint((min(ans)))","code_v0_loc":20,"code_v1_loc":16,"code_v0_num_chars":248,"code_v1_num_chars":263,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\ntmp = 0\nw = []\nfor s in S:\n if s == \"W\":\n tmp += 1\n w.append(tmp)\ntmp = 0\ne = []\nfor s in S[::-1]:\n if s == \"E\":\n tmp += 1\n e.append(tmp)\ne = e[::-1]\nans = []\nfor i in range(N):\n ans.append(w[i] + e[i] - 1)\nprint((min(ans)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\n\n\ndef cumsum_arr(s, w):\n arr = []\n cnt = 0\n for s_ in s:\n if s_ == w:\n cnt += 1\n arr.append(cnt)\n return arr\n\n\nw = cumsum_arr(S, \"W\")\ne = cumsum_arr(S[::-1], \"E\")\ne = e[::-1]\nans = [w[i] + e[i] - 1 for i in range(N)]\nprint((min(ans)))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-tmp = 0","-w = []","-for s in S:","- if s == \"W\":","- tmp += 1","- w.append(tmp)","-tmp = 0","-e = []","-for s in S[::-1]:","- if s == \"E\":","- tmp += 1","- e.append(tmp)","+","+","+def cumsum_arr(s, w):","+ arr = []","+ cnt = 0","+ for s_ in s:","+ if s_ == w:","+ cnt += 1","+ arr.append(cnt)","+ return arr","+","+","+w = cumsum_arr(S, \"W\")","+e = cumsum_arr(S[::-1], \"E\")","-ans = []","-for i in range(N):","- ans.append(w[i] + e[i] - 1)","+ans = [w[i] + e[i] - 1 for i in range(N)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.093584156,"measured_runtime_v1":0.0403206348,"runtime_lift":2.3209990711,"key":["s146841583","s895515138"]} +{"user_id":"u292735000","problem_id":"p03478","language":"python","submission_id_v0":"s443954234","submission_id_v1":"s735571495","cpu_time_v0":1538,"cpu_time_v1":40,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":97.4,"input":"import math\n\n\n\nn, a, b = list(map(int, input().split()))\n\n\n\nsum_all = 0\n\nfor i in range(1, n + 1):\n\n sum_n = 0\n\n m = i\n\n while(m > 0):\n\n sum_n += math.floor(m % 10)\n\n m \/= 10\n\n if a <= sum_n <= b:\n\n sum_all += i\n\n\n\nprint(sum_all)","target":"n, a, b = list(map(int, input().split()))\n\nsum_all = 0\n\nfor i in range(1, n + 1):\n\n m = str(i)\n\n sum_m = 0\n\n for j in range(len(m)):\n\n sum_m += int(m[j])\n\n if a <= sum_m <= b:\n\n sum_all += i\n\nprint(sum_all)","code_v0_loc":15,"code_v1_loc":10,"code_v0_num_chars":256,"code_v1_num_chars":226,"code_v0_no_empty_lines":"import math\n\nn, a, b = list(map(int, input().split()))\nsum_all = 0\nfor i in range(1, n + 1):\n sum_n = 0\n m = i\n while m > 0:\n sum_n += math.floor(m % 10)\n m \/= 10\n if a <= sum_n <= b:\n sum_all += i\nprint(sum_all)\n","code_v1_no_empty_lines":"n, a, b = list(map(int, input().split()))\nsum_all = 0\nfor i in range(1, n + 1):\n m = str(i)\n sum_m = 0\n for j in range(len(m)):\n sum_m += int(m[j])\n if a <= sum_m <= b:\n sum_all += i\nprint(sum_all)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-import math","-","- sum_n = 0","- m = i","- while m > 0:","- sum_n += math.floor(m % 10)","- m \/= 10","- if a <= sum_n <= b:","+ m = str(i)","+ sum_m = 0","+ for j in range(len(m)):","+ sum_m += int(m[j])","+ if a <= sum_m <= b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0763342624,"measured_runtime_v1":0.0381063504,"runtime_lift":2.003190059,"key":["s443954234","s735571495"]} +{"user_id":"u562935282","problem_id":"p02781","language":"python","submission_id_v0":"s737828959","submission_id_v1":"s605594716","cpu_time_v0":20,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"# \u89e3\u8aac\u653e\u9001\n\n\n\ndef main():\n\n S = eval(input())\n\n N = len(S)\n\n K = int(eval(input()))\n\n\n\n dp = [[[0] * 2 for _ in range(K + 1)] for _ in range(N + 1)]\n\n dp[0][0][0] = 1\n\n # dp[i][j][k]\n\n # i\u6841\u76ee\u307e\u3067\u6c7a\u3081\u3066j\u500b\u306e\u975e0\u3092\u4f7f\u3063\u3066\n\n # k=0: \u305d\u3053\u307e\u3067\u306e\u6841\u306fS\u3068\u4e00\u81f4\n\n # k=1: \u3059\u3067\u306bS\u672a\u6e80\u304c\u78ba\u5b9a\n\n\n\n for i, c in enumerate(S): # 100\n\n for j in range(K + 1): # 4\n\n for k in range(2): # 2\n\n nd = int(c)\n\n for d in range(10): # 10\n\n ni, nj, nk = i + 1, j, k\n\n if d != 0: nj += 1 # \u6b21\u306e\u6841\u306e\u5024d\u3068\u3057\u30660\u4ee5\u5916\u3092\u63a1\u7528\u3059\u308b\u3068\u975e0\u306e\u500b\u6570nj\u304c\u5897\u3048\u308b\n\n if nj > K: continue # \u975e0\u306e\u6570\u5b57\u3092\u4f7f\u7528\u3057\u3066\u3088\u3044\u4e0a\u9650\u3092\u8d85\u3048\u3066\u304a\u308a\u3001\u52a0\u7b97\u5bfe\u8c61\u3067\u306f\u306a\u3044\n\n if k == 0: # \u305d\u3053\u307e\u3067S\u3068\u4e00\u81f4\u3057\u3066\u3044\u308b\u3068\u304d\n\n if d > nd: continue # \u6b21\u306e\u6841\u306e\u5024d\u304cS[i]\u3092\u8d85\u3048\u3066\u304a\u308a\u3001\u63a1\u7528\u3059\u308b\u3068S\u3092\u8d85\u3048\u308b\u305f\u3081\u3001\u52a0\u7b97\u5bfe\u8c61\u3067\u306f\u306a\u3044\n\n if d < nd: nk = 1 # \u6b21\u306e\u6841\u306e\u5024d\u304cs[i]\u3092\u4e0b\u56de\u3063\u3066\u304a\u308a\u3001\u63a1\u7528\u3059\u308b\u3068\u672a\u6e80\u304c\u78ba\u5b9a\u3059\u308b\n\n dp[ni][nj][nk] += dp[i][j][k]\n\n\n\n print((sum(dp[N][K])))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n EQ = 0\n\n LESS = 1\n\n\n\n *S, = list(map(int, eval(input())))\n\n L = len(S)\n\n K = int(eval(input()))\n\n\n\n dp = [[[0] * 2 for _ in range(K + 2)] for _ in range(L + 1)]\n\n dp[0][0][EQ] = 1\n\n\n\n for i, x in enumerate(S):\n\n for k in range(K + 1): # \u3053\u3053\u3092range(K)\u306b\u3057\u3066\u30d0\u30b0\u3089\u305b\u305f\n\n if x == 0:\n\n dp[i + 1][k][EQ] += dp[i][k][EQ] # x\n\n else:\n\n dp[i + 1][k + 1][EQ] += dp[i][k][EQ] # x\n\n dp[i + 1][k + 1][LESS] += dp[i][k][EQ] * (x - 1) # K:\n continue # \u975e0\u306e\u6570\u5b57\u3092\u4f7f\u7528\u3057\u3066\u3088\u3044\u4e0a\u9650\u3092\u8d85\u3048\u3066\u304a\u308a\u3001\u52a0\u7b97\u5bfe\u8c61\u3067\u306f\u306a\u3044\n if k == 0: # \u305d\u3053\u307e\u3067S\u3068\u4e00\u81f4\u3057\u3066\u3044\u308b\u3068\u304d\n if d > nd:\n continue # \u6b21\u306e\u6841\u306e\u5024d\u304cS[i]\u3092\u8d85\u3048\u3066\u304a\u308a\u3001\u63a1\u7528\u3059\u308b\u3068S\u3092\u8d85\u3048\u308b\u305f\u3081\u3001\u52a0\u7b97\u5bfe\u8c61\u3067\u306f\u306a\u3044\n if d < nd:\n nk = 1 # \u6b21\u306e\u6841\u306e\u5024d\u304cs[i]\u3092\u4e0b\u56de\u3063\u3066\u304a\u308a\u3001\u63a1\u7528\u3059\u308b\u3068\u672a\u6e80\u304c\u78ba\u5b9a\u3059\u308b\n dp[ni][nj][nk] += dp[i][j][k]\n print((sum(dp[N][K])))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n EQ = 0\n LESS = 1\n (*S,) = list(map(int, eval(input())))\n L = len(S)\n K = int(eval(input()))\n dp = [[[0] * 2 for _ in range(K + 2)] for _ in range(L + 1)]\n dp[0][0][EQ] = 1\n for i, x in enumerate(S):\n for k in range(K + 1): # \u3053\u3053\u3092range(K)\u306b\u3057\u3066\u30d0\u30b0\u3089\u305b\u305f\n if x == 0:\n dp[i + 1][k][EQ] += dp[i][k][EQ] # x\n else:\n dp[i + 1][k + 1][EQ] += dp[i][k][EQ] # x\n dp[i + 1][k + 1][LESS] += dp[i][k][EQ] * (x - 1) # K:","- continue # \u975e0\u306e\u6570\u5b57\u3092\u4f7f\u7528\u3057\u3066\u3088\u3044\u4e0a\u9650\u3092\u8d85\u3048\u3066\u304a\u308a\u3001\u52a0\u7b97\u5bfe\u8c61\u3067\u306f\u306a\u3044","- if k == 0: # \u305d\u3053\u307e\u3067S\u3068\u4e00\u81f4\u3057\u3066\u3044\u308b\u3068\u304d","- if d > nd:","- continue # \u6b21\u306e\u6841\u306e\u5024d\u304cS[i]\u3092\u8d85\u3048\u3066\u304a\u308a\u3001\u63a1\u7528\u3059\u308b\u3068S\u3092\u8d85\u3048\u308b\u305f\u3081\u3001\u52a0\u7b97\u5bfe\u8c61\u3067\u306f\u306a\u3044","- if d < nd:","- nk = 1 # \u6b21\u306e\u6841\u306e\u5024d\u304cs[i]\u3092\u4e0b\u56de\u3063\u3066\u304a\u308a\u3001\u63a1\u7528\u3059\u308b\u3068\u672a\u6e80\u304c\u78ba\u5b9a\u3059\u308b","- dp[ni][nj][nk] += dp[i][j][k]","- print((sum(dp[N][K])))","+ dp = [[[0] * 2 for _ in range(K + 2)] for _ in range(L + 1)]","+ dp[0][0][EQ] = 1","+ for i, x in enumerate(S):","+ for k in range(K + 1): # \u3053\u3053\u3092range(K)\u306b\u3057\u3066\u30d0\u30b0\u3089\u305b\u305f","+ if x == 0:","+ dp[i + 1][k][EQ] += dp[i][k][EQ] # x","+ else:","+ dp[i + 1][k + 1][EQ] += dp[i][k][EQ] # x","+ dp[i + 1][k + 1][LESS] += dp[i][k][EQ] * (x - 1) # = K:\n\n ans += 2**i\n\n B = nxt_B\n\n\n\nprint(ans)","target":"\n\n\n\n\n\nN,K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\naccum = [0] * N\n\naccum[0] = A[0]\n\nfor i in range(1,N):\n\n accum[i] = accum[i-1] + A[i]\n\n\n\nB = []\n\nfor l in range(N):\n\n for r in range(l,N):\n\n if l == 0:\n\n B.append(accum[r])\n\n else:\n\n B.append(accum[r] - accum[l-1])\n\n\n\n\n\nans = 0\n\nfor i in range(45,-1,-1):\n\n used = []\n\n cnt = 0\n\n for b in B:\n\n if b & (1 << i):\n\n cnt += 1\n\n used.append(b)\n\n\n\n if cnt >= K:\n\n ans += pow(2,i)\n\n B = used\n\n\n\n\n\nprint(ans)","code_v0_loc":38,"code_v1_loc":35,"code_v0_num_chars":619,"code_v1_num_chars":575,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\naccum = [0] * N\nfor i in range(N):\n if i == 0:\n accum[i] = A[i]\n else:\n accum[i] = accum[i - 1] + A[i]\nB = []\nfor l in range(N):\n for r in range(l, N):\n if l == 0:\n B.append(accum[r])\n else:\n B.append(accum[r] - accum[l - 1])\nans = 0\nfor i in range(50, -1, -1):\n cnt = 0\n nxt_B = []\n for b in B:\n if b & (1 << i):\n cnt += 1\n nxt_B.append(b)\n if cnt >= K:\n ans += 2**i\n B = nxt_B\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\naccum = [0] * N\naccum[0] = A[0]\nfor i in range(1, N):\n accum[i] = accum[i - 1] + A[i]\nB = []\nfor l in range(N):\n for r in range(l, N):\n if l == 0:\n B.append(accum[r])\n else:\n B.append(accum[r] - accum[l - 1])\nans = 0\nfor i in range(45, -1, -1):\n used = []\n cnt = 0\n for b in B:\n if b & (1 << i):\n cnt += 1\n used.append(b)\n if cnt >= K:\n ans += pow(2, i)\n B = used\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.8947368421,"diff":["-for i in range(N):","- if i == 0:","- accum[i] = A[i]","- else:","- accum[i] = accum[i - 1] + A[i]","+accum[0] = A[0]","+for i in range(1, N):","+ accum[i] = accum[i - 1] + A[i]","-for i in range(50, -1, -1):","+for i in range(45, -1, -1):","+ used = []","- nxt_B = []","- nxt_B.append(b)","+ used.append(b)","- ans += 2**i","- B = nxt_B","+ ans += pow(2, i)","+ B = used"],"diff_only_import_comment":false,"measured_runtime_v0":0.0366686571,"measured_runtime_v1":0.0688494171,"runtime_lift":0.5325921204,"key":["s506629987","s219871069"]} +{"user_id":"u768152935","problem_id":"p03162","language":"python","submission_id_v0":"s741663056","submission_id_v1":"s776265686","cpu_time_v0":545,"cpu_time_v1":365,"memory_v0":17496,"memory_v1":57308,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.03,"input":"import cmath\n\nimport numpy as np\n\nimport sys\n\n\n\nINF=10**18\n\nMOD=10**9+7\n\nMAX=10**5+7\n\n\n\ndef main():\n\n N=int(eval(input()))\n\n dp=[0, 0, 0]\n\n for _ in range(N):\n\n a,b,c=list(map(int, input().split()))\n\n ndp=[0, 0, 0]\n\n ndp[0]=max(dp[1], dp[2])+a\n\n ndp[1]=max(dp[2], dp[0])+b\n\n ndp[2]=max(dp[0], dp[1])+c\n\n dp=ndp\n\n print((max(dp)))\n\n\n\nif __name__=='__main__':\n\n main()\n","target":"import sys\n\n\n\nINF=10**18\n\nMOD=10**9+7\n\nMAX=10**5+7\n\n\n\ndef main():\n\n N=int(eval(input()))\n\n dp=[0, 0, 0]\n\n for line in sys.stdin.readlines():\n\n a,b,c=list(map(int, line.split()))\n\n ndp=[0, 0, 0]\n\n ndp[0]=max(dp[1], dp[2])+a\n\n ndp[1]=max(dp[2], dp[0])+b\n\n ndp[2]=max(dp[0], dp[1])+c\n\n dp=ndp\n\n print((max(dp)))\n\n\n\nmain()\n","code_v0_loc":22,"code_v1_loc":19,"code_v0_num_chars":410,"code_v1_num_chars":359,"code_v0_no_empty_lines":"import cmath\nimport numpy as np\nimport sys\n\nINF = 10**18\nMOD = 10**9 + 7\nMAX = 10**5 + 7\n\n\ndef main():\n N = int(eval(input()))\n dp = [0, 0, 0]\n for _ in range(N):\n a, b, c = list(map(int, input().split()))\n ndp = [0, 0, 0]\n ndp[0] = max(dp[1], dp[2]) + a\n ndp[1] = max(dp[2], dp[0]) + b\n ndp[2] = max(dp[0], dp[1]) + c\n dp = ndp\n print((max(dp)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nINF = 10**18\nMOD = 10**9 + 7\nMAX = 10**5 + 7\n\n\ndef main():\n N = int(eval(input()))\n dp = [0, 0, 0]\n for line in sys.stdin.readlines():\n a, b, c = list(map(int, line.split()))\n ndp = [0, 0, 0]\n ndp[0] = max(dp[1], dp[2]) + a\n ndp[1] = max(dp[2], dp[0]) + b\n ndp[2] = max(dp[0], dp[1]) + c\n dp = ndp\n print((max(dp)))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":13.6363636364,"diff":["-import cmath","-import numpy as np","- for _ in range(N):","- a, b, c = list(map(int, input().split()))","+ for line in sys.stdin.readlines():","+ a, b, c = list(map(int, line.split()))","-if __name__ == \"__main__\":","- main()","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0411988947,"measured_runtime_v1":0.0968533432,"runtime_lift":0.4253740073,"key":["s741663056","s776265686"]} +{"user_id":"u021019433","problem_id":"p03032","language":"python","submission_id_v0":"s621293098","submission_id_v1":"s919865651","cpu_time_v0":40,"cpu_time_v1":31,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.5,"input":"from itertools import chain\n\n \n\nR = lambda: list(map(int, input().split()))\n\nn, k = R()\n\nv = list(R())\n\na = sorted((x, i) for i, x in enumerate(v) if x < 0)\n\nr = 0\n\nfor i in range(1, min(n, k) + 1):\n\n for j in range(i):\n\n r1, r2 = i - j, n - j\n\n s = sum(v[m] for m in chain(list(range(r1)), list(range(r2, n))))\n\n j = i\n\n for x, m in a:\n\n if j == k:\n\n break\n\n if m < r1 or m >= r2:\n\n s -= x\n\n j += 1\n\n r = max(r, s)\n\nprint(r)\n","target":"from itertools import chain, islice\n\n \n\nR = lambda: list(map(int, input().split()))\n\nn, k = R()\n\nv = list(R())\n\na = sorted((x, i) for i, x in enumerate(v) if x < 0)\n\nans = max(sum(v[m] for m in chain(list(range(i - j)), list(range(n - j, n)))) -\n\n sum(islice((x for x, m in a if m < i - j or m >= n - j), k - i))\n\n for i in range(1, min(n, k) + 1) for j in range(i))\n\nprint(ans)\n","code_v0_loc":20,"code_v1_loc":10,"code_v0_num_chars":513,"code_v1_num_chars":379,"code_v0_no_empty_lines":"from itertools import chain\n\nR = lambda: list(map(int, input().split()))\nn, k = R()\nv = list(R())\na = sorted((x, i) for i, x in enumerate(v) if x < 0)\nr = 0\nfor i in range(1, min(n, k) + 1):\n for j in range(i):\n r1, r2 = i - j, n - j\n s = sum(v[m] for m in chain(list(range(r1)), list(range(r2, n))))\n j = i\n for x, m in a:\n if j == k:\n break\n if m < r1 or m >= r2:\n s -= x\n j += 1\n r = max(r, s)\nprint(r)\n","code_v1_no_empty_lines":"from itertools import chain, islice\n\nR = lambda: list(map(int, input().split()))\nn, k = R()\nv = list(R())\na = sorted((x, i) for i, x in enumerate(v) if x < 0)\nans = max(\n sum(v[m] for m in chain(list(range(i - j)), list(range(n - j, n))))\n - sum(islice((x for x, m in a if m < i - j or m >= n - j), k - i))\n for i in range(1, min(n, k) + 1)\n for j in range(i)\n)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-from itertools import chain","+from itertools import chain, islice","-r = 0","-for i in range(1, min(n, k) + 1):","- for j in range(i):","- r1, r2 = i - j, n - j","- s = sum(v[m] for m in chain(list(range(r1)), list(range(r2, n))))","- j = i","- for x, m in a:","- if j == k:","- break","- if m < r1 or m >= r2:","- s -= x","- j += 1","- r = max(r, s)","-print(r)","+ans = max(","+ sum(v[m] for m in chain(list(range(i - j)), list(range(n - j, n))))","+ - sum(islice((x for x, m in a if m < i - j or m >= n - j), k - i))","+ for i in range(1, min(n, k) + 1)","+ for j in range(i)","+)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1127877147,"measured_runtime_v1":0.1034266081,"runtime_lift":1.0905096551,"key":["s621293098","s919865651"]} +{"user_id":"u724687935","problem_id":"p02834","language":"python","submission_id_v0":"s364253442","submission_id_v1":"s303096272","cpu_time_v0":706,"cpu_time_v1":559,"memory_v0":65056,"memory_v1":78528,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.82,"input":"from collections import deque\n\n\n\n\n\nN, u, v = list(map(int, input().split()))\n\nu -= 1\n\nv -= 1\n\nedge = [[] for _ in range(N)]\n\nfor _ in range(N - 1):\n\n A, B = list(map(int, input().split()))\n\n edge[A - 1].append(B - 1)\n\n edge[B - 1].append(A - 1)\n\n\n\nINF = 10 ** 6\n\nlenA = [INF] * N\n\nq = deque()\n\nq.append((v, 0))\n\nlenA[v] = 0\n\nwhile len(q) > 0:\n\n p, step = q.popleft()\n\n for np in edge[p]:\n\n if lenA[np] == INF:\n\n lenA[np] = step + 1\n\n q.append((np, step + 1))\n\n\n\n\n\nlenT = [INF] * N\n\nq = deque()\n\nq.append((u, 0))\n\nlenT[u] = 0\n\nans = 0\n\nwhile len(q) > 0:\n\n p, step = q.popleft()\n\n if len(edge[p]) == 1:\n\n ans = max(ans, step + (lenA[p] - step) - 1)\n\n for np in edge[p]:\n\n if lenT[np] == INF and lenA[np] > step + 1:\n\n lenT[np] = step + 1\n\n q.append((np, step + 1))\n\n\n\nprint(ans)\n","target":"from collections import deque\n\nimport sys\n\n\n\nN, u, v = list(map(int, input().split()))\n\nu -= 1; v -= 1\n\nedge = [[] for _ in range(N)]\n\nfor s in sys.stdin.readlines():\n\n A, B = [int(x) - 1 for x in s.split()]\n\n edge[A].append(B)\n\n edge[B].append(A)\n\n\n\nINF = float('inf')\n\n\n\n# Aoki\n\npathV = [INF] * N\n\npathV[v] = 0\n\nq = deque()\n\nq.append((v, 0))\n\nwhile q:\n\n p, d = q.popleft()\n\n nd = d + 1\n\n for np in edge[p]:\n\n if pathV[np] > nd:\n\n pathV[np] = nd\n\n q.append((np, nd))\n\n\n\n# Takahashi\n\nans = 0\n\npathU = [INF] * N\n\npathU[u] = 0\n\nq = deque()\n\nq.append((u, 0))\n\nwhile q:\n\n p, d = q.popleft()\n\n nd = d + 1\n\n if len(edge[p]) == 1:\n\n ans = max(ans, pathV[p] - 1)\n\n for np in edge[p]:\n\n if pathU[np] > nd and pathV[np] > nd:\n\n pathU[np] = nd\n\n q.append((np, nd))\n\n\n\nprint(ans)\n","code_v0_loc":40,"code_v1_loc":43,"code_v0_num_chars":854,"code_v1_num_chars":862,"code_v0_no_empty_lines":"from collections import deque\n\nN, u, v = list(map(int, input().split()))\nu -= 1\nv -= 1\nedge = [[] for _ in range(N)]\nfor _ in range(N - 1):\n A, B = list(map(int, input().split()))\n edge[A - 1].append(B - 1)\n edge[B - 1].append(A - 1)\nINF = 10**6\nlenA = [INF] * N\nq = deque()\nq.append((v, 0))\nlenA[v] = 0\nwhile len(q) > 0:\n p, step = q.popleft()\n for np in edge[p]:\n if lenA[np] == INF:\n lenA[np] = step + 1\n q.append((np, step + 1))\nlenT = [INF] * N\nq = deque()\nq.append((u, 0))\nlenT[u] = 0\nans = 0\nwhile len(q) > 0:\n p, step = q.popleft()\n if len(edge[p]) == 1:\n ans = max(ans, step + (lenA[p] - step) - 1)\n for np in edge[p]:\n if lenT[np] == INF and lenA[np] > step + 1:\n lenT[np] = step + 1\n q.append((np, step + 1))\nprint(ans)\n","code_v1_no_empty_lines":"from collections import deque\nimport sys\n\nN, u, v = list(map(int, input().split()))\nu -= 1\nv -= 1\nedge = [[] for _ in range(N)]\nfor s in sys.stdin.readlines():\n A, B = [int(x) - 1 for x in s.split()]\n edge[A].append(B)\n edge[B].append(A)\nINF = float(\"inf\")\n# Aoki\npathV = [INF] * N\npathV[v] = 0\nq = deque()\nq.append((v, 0))\nwhile q:\n p, d = q.popleft()\n nd = d + 1\n for np in edge[p]:\n if pathV[np] > nd:\n pathV[np] = nd\n q.append((np, nd))\n# Takahashi\nans = 0\npathU = [INF] * N\npathU[u] = 0\nq = deque()\nq.append((u, 0))\nwhile q:\n p, d = q.popleft()\n nd = d + 1\n if len(edge[p]) == 1:\n ans = max(ans, pathV[p] - 1)\n for np in edge[p]:\n if pathU[np] > nd and pathV[np] > nd:\n pathU[np] = nd\n q.append((np, nd))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.976744186,"diff":["+import sys","-for _ in range(N - 1):","- A, B = list(map(int, input().split()))","- edge[A - 1].append(B - 1)","- edge[B - 1].append(A - 1)","-INF = 10**6","-lenA = [INF] * N","+for s in sys.stdin.readlines():","+ A, B = [int(x) - 1 for x in s.split()]","+ edge[A].append(B)","+ edge[B].append(A)","+INF = float(\"inf\")","+# Aoki","+pathV = [INF] * N","+pathV[v] = 0","-lenA[v] = 0","-while len(q) > 0:","- p, step = q.popleft()","+while q:","+ p, d = q.popleft()","+ nd = d + 1","- if lenA[np] == INF:","- lenA[np] = step + 1","- q.append((np, step + 1))","-lenT = [INF] * N","+ if pathV[np] > nd:","+ pathV[np] = nd","+ q.append((np, nd))","+# Takahashi","+ans = 0","+pathU = [INF] * N","+pathU[u] = 0","-lenT[u] = 0","-ans = 0","-while len(q) > 0:","- p, step = q.popleft()","+while q:","+ p, d = q.popleft()","+ nd = d + 1","- ans = max(ans, step + (lenA[p] - step) - 1)","+ ans = max(ans, pathV[p] - 1)","- if lenT[np] == INF and lenA[np] > step + 1:","- lenT[np] = step + 1","- q.append((np, step + 1))","+ if pathU[np] > nd and pathV[np] > nd:","+ pathU[np] = nd","+ q.append((np, nd))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0441636448,"measured_runtime_v1":0.0427871714,"runtime_lift":1.0321702364,"key":["s364253442","s303096272"]} +{"user_id":"u756388720","problem_id":"p02937","language":"python","submission_id_v0":"s373396269","submission_id_v1":"s644865862","cpu_time_v0":728,"cpu_time_v1":201,"memory_v0":72108,"memory_v1":132892,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.39,"input":"def solve():\n\n S = eval(input())\n\n T = eval(input())\n\n N = len(S)\n\n M = 2 * N\n\n S += S\n\n nxt = [[M] * 26 for i in range(M + 1)]\n\n for i in range(M - 1, -1, -1):\n\n for j in range(26):\n\n nxt[i][j] = nxt[i + 1][j]\n\n nxt[i][ord(S[i]) - ord('a')] = i\n\n ans = 0\n\n i = 0\n\n for c in T:\n\n pos = ord(c) - ord('a')\n\n if nxt[i][pos] == M:\n\n return -1\n\n ans += nxt[i][pos] - i + 1\n\n i = (nxt[i][pos] + 1) % N\n\n return ans\n\n\n\nprint((solve()))\n","target":"def solve():\n\n S = eval(input())\n\n T = eval(input())\n\n N = len(S)\n\n M = 2 * N\n\n S += S\n\n nxt = [[M] * 26 for i in range(M + 1)]\n\n for i in range(M - 1, -1, -1):\n\n for j in range(26):\n\n nxt[i][j] = nxt[i + 1][j]\n\n nxt[i][ord(S[i]) - ord('a')] = i\n\n ans = -1\n\n for c in T:\n\n i = ans % N\n\n pos = ord(c) - ord('a')\n\n if nxt[i + 1][pos] == M:\n\n return -1\n\n ans += nxt[i + 1][pos] - i\n\n return ans + 1\n\n\n\nprint((solve()))\n","code_v0_loc":22,"code_v1_loc":21,"code_v0_num_chars":512,"code_v1_num_chars":496,"code_v0_no_empty_lines":"def solve():\n S = eval(input())\n T = eval(input())\n N = len(S)\n M = 2 * N\n S += S\n nxt = [[M] * 26 for i in range(M + 1)]\n for i in range(M - 1, -1, -1):\n for j in range(26):\n nxt[i][j] = nxt[i + 1][j]\n nxt[i][ord(S[i]) - ord(\"a\")] = i\n ans = 0\n i = 0\n for c in T:\n pos = ord(c) - ord(\"a\")\n if nxt[i][pos] == M:\n return -1\n ans += nxt[i][pos] - i + 1\n i = (nxt[i][pos] + 1) % N\n return ans\n\n\nprint((solve()))\n","code_v1_no_empty_lines":"def solve():\n S = eval(input())\n T = eval(input())\n N = len(S)\n M = 2 * N\n S += S\n nxt = [[M] * 26 for i in range(M + 1)]\n for i in range(M - 1, -1, -1):\n for j in range(26):\n nxt[i][j] = nxt[i + 1][j]\n nxt[i][ord(S[i]) - ord(\"a\")] = i\n ans = -1\n for c in T:\n i = ans % N\n pos = ord(c) - ord(\"a\")\n if nxt[i + 1][pos] == M:\n return -1\n ans += nxt[i + 1][pos] - i\n return ans + 1\n\n\nprint((solve()))\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["- ans = 0","- i = 0","+ ans = -1","+ i = ans % N","- if nxt[i][pos] == M:","+ if nxt[i + 1][pos] == M:","- ans += nxt[i][pos] - i + 1","- i = (nxt[i][pos] + 1) % N","- return ans","+ ans += nxt[i + 1][pos] - i","+ return ans + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0379376841,"measured_runtime_v1":0.1430688977,"runtime_lift":0.26517073,"key":["s373396269","s644865862"]} +{"user_id":"u049182844","problem_id":"p02916","language":"python","submission_id_v0":"s161651370","submission_id_v1":"s907755272","cpu_time_v0":30,"cpu_time_v1":26,"memory_v0":9132,"memory_v1":9068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.33,"input":"def main():\n\n n = int(eval(input()))\n\n a = list(map(int, input().split()))\n\n b = list(map(int, input().split()))\n\n c = list(map(int, input().split()))\n\n point = sum(b)\n\n\n\n for i in range(1,n):\n\n if a[i-1] +1 == a[i]:\n\n point += c[a[i-1]-1]\n\n\n\n\n\n print(point)\n\n\n\nif __name__ == '__main__':\n\n main()","target":"def main():\n\n n = int(eval(input()))\n\n a = list(map(int, input().split()))\n\n b = list(map(int, input().split()))\n\n c = list(map(int, input().split()))\n\n total_score = sum(b)\n\n\n\n for i in range(1, n):\n\n prev = a[i - 1]\n\n if prev + 1 == a[i]:\n\n total_score += c[prev - 1]\n\n\n\n print(total_score)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":333,"code_v1_num_chars":377,"code_v0_no_empty_lines":"def main():\n n = int(eval(input()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n point = sum(b)\n for i in range(1, n):\n if a[i - 1] + 1 == a[i]:\n point += c[a[i - 1] - 1]\n print(point)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n total_score = sum(b)\n for i in range(1, n):\n prev = a[i - 1]\n if prev + 1 == a[i]:\n total_score += c[prev - 1]\n print(total_score)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["- point = sum(b)","+ total_score = sum(b)","- if a[i - 1] + 1 == a[i]:","- point += c[a[i - 1] - 1]","- print(point)","+ prev = a[i - 1]","+ if prev + 1 == a[i]:","+ total_score += c[prev - 1]","+ print(total_score)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370037992,"measured_runtime_v1":0.038006803,"runtime_lift":0.9736098865,"key":["s161651370","s907755272"]} +{"user_id":"u063073794","problem_id":"p03107","language":"python","submission_id_v0":"s647752250","submission_id_v1":"s662257256","cpu_time_v0":30,"cpu_time_v1":18,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.0,"input":"a=eval(input())\n\none=0\n\nzero=0\n\nfor i in a:\n\n if i==\"0\":\n\n zero+=1\n\n else:\n\n one+=1\n\n\n\nprint((2*min(zero,one)))","target":"S = eval(input())\n\n \n\nred = S.count('0')\n\nblue = S.count('1')\n\n \n\nprint((min(red, blue)*2))","code_v0_loc":10,"code_v1_loc":6,"code_v0_num_chars":111,"code_v1_num_chars":83,"code_v0_no_empty_lines":"a = eval(input())\none = 0\nzero = 0\nfor i in a:\n if i == \"0\":\n zero += 1\n else:\n one += 1\nprint((2 * min(zero, one)))\n","code_v1_no_empty_lines":"S = eval(input())\nred = S.count(\"0\")\nblue = S.count(\"1\")\nprint((min(red, blue) * 2))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-a = eval(input())","-one = 0","-zero = 0","-for i in a:","- if i == \"0\":","- zero += 1","- else:","- one += 1","-print((2 * min(zero, one)))","+S = eval(input())","+red = S.count(\"0\")","+blue = S.count(\"1\")","+print((min(red, blue) * 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1150934744,"measured_runtime_v1":0.1055924518,"runtime_lift":1.0899782362,"key":["s647752250","s662257256"]} +{"user_id":"u948524308","problem_id":"p03303","language":"python","submission_id_v0":"s125172779","submission_id_v1":"s264121651","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"S = eval(input())\n\nw = int(eval(input()))\n\n\n\nnewS = [\"\"] * ((len(S) - 1 + w) \/\/ w)\n\n\n\nfor i in range(len(newS)):\n\n newS[i] = S[w * i]\n\n\n\nprint((\"\".join(newS)))\n","target":"S = eval(input())\n\nw = int(eval(input()))\n\n\n\nnewS =[\"\"]\n\ni = 0\n\n\n\nwhile i1:\n\n print((0))\n\nelif N == M:\n\n n = 1\n\n m = 1\n\n for i in range(N):\n\n n = n * (i + 1) % mod\n\n for i in range(M):\n\n m = m * (i + 1) % mod\n\n print((2 * m * n % mod))\n\nelse:\n\n n = 1\n\n m = 1\n\n for i in range(N):\n\n n = n * (i + 1) % mod\n\n for i in range(M):\n\n m = m * (i + 1) % mod\n\n print((m * n % mod))","target":"N , M = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef factorial(n):\n\n ans = 1\n\n for i in range(2, n + 1):\n\n ans = ans * i % mod\n\n return ans\n\n\n\n\n\nif abs(N - M) >1:\n\n print((0))\n\nelif N == M:\n\n print((2 * factorial(N) ** 2 % mod))\n\nelse:\n\n print((factorial(min(M, N)) ** 2 * max(M, N) % mod))","code_v0_loc":21,"code_v1_loc":17,"code_v0_num_chars":424,"code_v1_num_chars":318,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nmod = 10**9 + 7\nif abs(N - M) > 1:\n print((0))\nelif N == M:\n n = 1\n m = 1\n for i in range(N):\n n = n * (i + 1) % mod\n for i in range(M):\n m = m * (i + 1) % mod\n print((2 * m * n % mod))\nelse:\n n = 1\n m = 1\n for i in range(N):\n n = n * (i + 1) % mod\n for i in range(M):\n m = m * (i + 1) % mod\n print((m * n % mod))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nmod = 10**9 + 7\n\n\ndef factorial(n):\n ans = 1\n for i in range(2, n + 1):\n ans = ans * i % mod\n return ans\n\n\nif abs(N - M) > 1:\n print((0))\nelif N == M:\n print((2 * factorial(N) ** 2 % mod))\nelse:\n print((factorial(min(M, N)) ** 2 * max(M, N) % mod))\n","code_same":false,"relative_loc_diff_percent":19.0476190476,"diff":["+","+","+def factorial(n):","+ ans = 1","+ for i in range(2, n + 1):","+ ans = ans * i % mod","+ return ans","+","+","- n = 1","- m = 1","- for i in range(N):","- n = n * (i + 1) % mod","- for i in range(M):","- m = m * (i + 1) % mod","- print((2 * m * n % mod))","+ print((2 * factorial(N) ** 2 % mod))","- n = 1","- m = 1","- for i in range(N):","- n = n * (i + 1) % mod","- for i in range(M):","- m = m * (i + 1) % mod","- print((m * n % mod))","+ print((factorial(min(M, N)) ** 2 * max(M, N) % mod))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1655608654,"measured_runtime_v1":0.1276679516,"runtime_lift":1.296808348,"key":["s159201231","s367204441"]} +{"user_id":"u194894739","problem_id":"p03478","language":"python","submission_id_v0":"s608005993","submission_id_v1":"s805255424","cpu_time_v0":36,"cpu_time_v1":29,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.44,"input":"n, a, b = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(1, n + 1):\n\n if a <= sum(list(map(int, list(str(i))))) <= b:\n\n ans += i\n\nprint(ans)\n","target":"n, a, b = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(1, n + 1):\n\n sum = 0\n\n j = i\n\n while j != 0:\n\n sum += j % 10\n\n j = j \/\/ 10\n\n if a <= sum <= b:\n\n ans += i\n\nprint(ans)\n","code_v0_loc":6,"code_v1_loc":11,"code_v0_num_chars":154,"code_v1_num_chars":211,"code_v0_no_empty_lines":"n, a, b = list(map(int, input().split()))\nans = 0\nfor i in range(1, n + 1):\n if a <= sum(list(map(int, list(str(i))))) <= b:\n ans += i\nprint(ans)\n","code_v1_no_empty_lines":"n, a, b = list(map(int, input().split()))\nans = 0\nfor i in range(1, n + 1):\n sum = 0\n j = i\n while j != 0:\n sum += j % 10\n j = j \/\/ 10\n if a <= sum <= b:\n ans += i\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["- if a <= sum(list(map(int, list(str(i))))) <= b:","+ sum = 0","+ j = i","+ while j != 0:","+ sum += j % 10","+ j = j \/\/ 10","+ if a <= sum <= b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0347543797,"measured_runtime_v1":0.0423393118,"runtime_lift":0.8208536755,"key":["s608005993","s805255424"]} +{"user_id":"u073852194","problem_id":"p03411","language":"python","submission_id_v0":"s493682083","submission_id_v1":"s429968471","cpu_time_v0":200,"cpu_time_v1":127,"memory_v0":3948,"memory_v1":10132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.5,"input":"from collections import deque\n\n\n\nN = int(eval(input()))\n\nR = [list(map(int,input().split())) for _ in range(N)]\n\nB = [list(map(int,input().split())) for _ in range(N)]\n\n\n\ngraph = [[] for _ in range(2*N+2)] #\u6b8b\u4f59\u30b0\u30e9\u30d5\u3092\u69cb\u6210\u30000\u3092\u59cb\u70b9\uff0c1\u3092\u7d42\u70b9\u3068\u3059\u308b\n\n\n\nfor i in range(N):\n\n forward = [2+i,1,None] #[\u884c\u304d\u5148\uff0c\u6d41\u91cf\uff0c\u9006\u8fba\u306e\u60c5\u5831]\n\n forward[2] = backward = [0,0,forward]\n\n graph[0].append(forward)\n\n graph[2+i].append(backward)\n\n\n\nfor i in range(N):\n\n forward = [1,1,None]\n\n forward[2] = backward = [2+N+i,0,forward]\n\n graph[2+N+i].append(forward)\n\n graph[1].append(backward)\n\n\n\nfor i in range(N):\n\n for j in range(N):\n\n if R[i][0]0 and level[adj] is None:\n\n level[adj] = level[node]+1\n\n queue.append(adj)\n\n\n\n if level[1] is None:\n\n break\n\n\n\n stack = [0]\n\n visited = [0 for _ in range(2*N+2)]\n\n visited[0] = 1\n\n parent = [None for _ in range(2*N+2)]\n\n parent[0] = 0\n\n #*it, = map(iter, graph)\n\n \n\n while stack:\n\n node = stack.pop()\n\n for adj,adjcap,adjrev in graph[node]:\n\n if not visited[adj] and adjcap>0 and level[node] 0 and level[adj] is None:\n level[adj] = level[node] + 1\n queue.append(adj)\n if level[1] is None:\n break\n stack = [0]\n visited = [0 for _ in range(2 * N + 2)]\n visited[0] = 1\n parent = [None for _ in range(2 * N + 2)]\n parent[0] = 0\n # *it, = map(iter, graph)\n while stack:\n node = stack.pop()\n for adj, adjcap, adjrev in graph[node]:\n if not visited[adj] and adjcap > 0 and level[node] < level[adj]:\n visited[adj] = 1\n parent[adj] = node\n stack.append(adj)\n if visited[1]:\n flow += 1\n node = 1\n prev = parent[node]\n while node != 0:\n for g in graph[prev]:\n adj, adjcap, adjrev = g\n if adj == node:\n g[1] = 0\n adjrev[1] = 1\n node = prev\n prev = parent[node]\nprint(flow)\n","code_v1_no_empty_lines":"class Node:\n def __init__(self, idx=None):\n self.idx = idx\n self.edge = []\n self.level = None\n self.par = None\n\n\nclass Edge:\n def __init__(self, to, cap, rev=None):\n self.to = to\n self.cap = cap\n self.rev = rev\n\n\nfrom collections import deque\n\n\nclass BipartiteMatching:\n def __init__(self, n, m):\n self.n = n\n self.m = m\n self.inf = 10**18\n self.source = Node()\n self.sink = Node()\n self.lt = [Node(i) for i in range(n)]\n self.rt = [Node(i) for i in range(m)]\n for i in range(n):\n edge = Edge(self.lt[i], 1)\n rev = Edge(self.source, 0)\n edge.rev, rev.rev = rev, edge\n self.source.edge.append(edge)\n self.lt[i].edge.append(rev)\n for i in range(m):\n edge = Edge(self.sink, 1)\n rev = Edge(self.rt[i], 0)\n edge.rev, rev.rev = rev, edge\n self.rt[i].edge.append(edge)\n self.sink.edge.append(rev)\n\n def add(self, x, y):\n lt = self.lt[x]\n rt = self.rt[y]\n edge = Edge(rt, 1)\n rev = Edge(lt, 0)\n edge.rev, rev.rev = rev, edge\n lt.edge.append(edge)\n rt.edge.append(rev)\n\n def maximum_matching(self):\n flow = 0\n while True:\n queue = deque([self.source])\n self.source.level = 0\n self.sink.level = None\n for i in range(self.n):\n self.lt[i].level = None\n for i in range(self.m):\n self.rt[i].level = None\n while queue:\n node = queue.popleft()\n for edge in node.edge:\n to = edge.to\n if edge.cap and to.level is None:\n to.level = node.level + 1\n queue.append(to)\n if self.sink.level is None:\n break\n stack = [self.source]\n self.source.par = None\n self.sink.par = None\n for i in range(self.n):\n self.lt[i].par = None\n for i in range(self.m):\n self.rt[i].par = None\n while stack:\n node = stack.pop()\n if node is self.sink:\n break\n for edge in node.edge:\n to = edge.to\n if edge.cap and node.level < to.level:\n to.par = edge.rev\n stack.append(to)\n node = self.sink\n while node is not self.source:\n node.par.cap = 1\n node.par.rev.cap = 0\n node = node.par.to\n flow += 1\n return flow\n\n\nN = int(eval(input()))\nR = [tuple(map(int, input().split())) for _ in range(N)]\nB = [tuple(map(int, input().split())) for _ in range(N)]\nbip = BipartiteMatching(N, N)\nfor i in range(N):\n a, b = R[i]\n for j in range(N):\n c, d = B[j]\n if a < c and b < d:\n bip.add(i, j)\nprint((bip.maximum_matching()))\n","code_same":false,"relative_loc_diff_percent":27.4509803922,"diff":["+class Node:","+ def __init__(self, idx=None):","+ self.idx = idx","+ self.edge = []","+ self.level = None","+ self.par = None","+","+","+class Edge:","+ def __init__(self, to, cap, rev=None):","+ self.to = to","+ self.cap = cap","+ self.rev = rev","+","+","+","+class BipartiteMatching:","+ def __init__(self, n, m):","+ self.n = n","+ self.m = m","+ self.inf = 10**18","+ self.source = Node()","+ self.sink = Node()","+ self.lt = [Node(i) for i in range(n)]","+ self.rt = [Node(i) for i in range(m)]","+ for i in range(n):","+ edge = Edge(self.lt[i], 1)","+ rev = Edge(self.source, 0)","+ edge.rev, rev.rev = rev, edge","+ self.source.edge.append(edge)","+ self.lt[i].edge.append(rev)","+ for i in range(m):","+ edge = Edge(self.sink, 1)","+ rev = Edge(self.rt[i], 0)","+ edge.rev, rev.rev = rev, edge","+ self.rt[i].edge.append(edge)","+ self.sink.edge.append(rev)","+","+ def add(self, x, y):","+ lt = self.lt[x]","+ rt = self.rt[y]","+ edge = Edge(rt, 1)","+ rev = Edge(lt, 0)","+ edge.rev, rev.rev = rev, edge","+ lt.edge.append(edge)","+ rt.edge.append(rev)","+","+ def maximum_matching(self):","+ flow = 0","+ while True:","+ queue = deque([self.source])","+ self.source.level = 0","+ self.sink.level = None","+ for i in range(self.n):","+ self.lt[i].level = None","+ for i in range(self.m):","+ self.rt[i].level = None","+ while queue:","+ node = queue.popleft()","+ for edge in node.edge:","+ to = edge.to","+ if edge.cap and to.level is None:","+ to.level = node.level + 1","+ queue.append(to)","+ if self.sink.level is None:","+ break","+ stack = [self.source]","+ self.source.par = None","+ self.sink.par = None","+ for i in range(self.n):","+ self.lt[i].par = None","+ for i in range(self.m):","+ self.rt[i].par = None","+ while stack:","+ node = stack.pop()","+ if node is self.sink:","+ break","+ for edge in node.edge:","+ to = edge.to","+ if edge.cap and node.level < to.level:","+ to.par = edge.rev","+ stack.append(to)","+ node = self.sink","+ while node is not self.source:","+ node.par.cap = 1","+ node.par.rev.cap = 0","+ node = node.par.to","+ flow += 1","+ return flow","+","+","-R = [list(map(int, input().split())) for _ in range(N)]","-B = [list(map(int, input().split())) for _ in range(N)]","-graph = [[] for _ in range(2 * N + 2)] # \u6b8b\u4f59\u30b0\u30e9\u30d5\u3092\u69cb\u6210\u30000\u3092\u59cb\u70b9\uff0c1\u3092\u7d42\u70b9\u3068\u3059\u308b","+R = [tuple(map(int, input().split())) for _ in range(N)]","+B = [tuple(map(int, input().split())) for _ in range(N)]","+bip = BipartiteMatching(N, N)","- forward = [2 + i, 1, None] # [\u884c\u304d\u5148\uff0c\u6d41\u91cf\uff0c\u9006\u8fba\u306e\u60c5\u5831]","- forward[2] = backward = [0, 0, forward]","- graph[0].append(forward)","- graph[2 + i].append(backward)","-for i in range(N):","- forward = [1, 1, None]","- forward[2] = backward = [2 + N + i, 0, forward]","- graph[2 + N + i].append(forward)","- graph[1].append(backward)","-for i in range(N):","+ a, b = R[i]","- if R[i][0] < B[j][0] and R[i][1] < B[j][1]:","- forward = [2 + N + j, 1, None]","- forward[2] = backward = [2 + i, 0, forward]","- graph[2 + i].append(forward)","- graph[2 + N + j].append(backward)","-flow = 0","-while True:","- queue = deque([0])","- level = [None for _ in range(2 * N + 2)]","- level[0] = 0","- while queue:","- node = queue.popleft()","- for adj, adjcap, _ in graph[node]:","- if adjcap > 0 and level[adj] is None:","- level[adj] = level[node] + 1","- queue.append(adj)","- if level[1] is None:","- break","- stack = [0]","- visited = [0 for _ in range(2 * N + 2)]","- visited[0] = 1","- parent = [None for _ in range(2 * N + 2)]","- parent[0] = 0","- # *it, = map(iter, graph)","- while stack:","- node = stack.pop()","- for adj, adjcap, adjrev in graph[node]:","- if not visited[adj] and adjcap > 0 and level[node] < level[adj]:","- visited[adj] = 1","- parent[adj] = node","- stack.append(adj)","- if visited[1]:","- flow += 1","- node = 1","- prev = parent[node]","- while node != 0:","- for g in graph[prev]:","- adj, adjcap, adjrev = g","- if adj == node:","- g[1] = 0","- adjrev[1] = 1","- node = prev","- prev = parent[node]","-print(flow)","+ c, d = B[j]","+ if a < c and b < d:","+ bip.add(i, j)","+print((bip.maximum_matching()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0397796154,"measured_runtime_v1":0.0398486137,"runtime_lift":0.9982684882,"key":["s493682083","s429968471"]} +{"user_id":"u341926204","problem_id":"p03160","language":"python","submission_id_v0":"s297227376","submission_id_v1":"s177862174","cpu_time_v0":256,"cpu_time_v1":222,"memory_v0":52592,"memory_v1":52208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.28,"input":"\n\nN = int(eval(input()))\n\nH = list(map(int, input().split()))\n\n\n\n# memo = [0] + [abs(H[i] - H[i-1]) for i in range(1, N)]\n\n# memo = [H[i] - H[i-1] for i in range(1, N)]\n\nmemo = [sum(H)] * (N+2)\n\nmemo[0] = 0\n\nfor i in range(N):\n\n memo[i+1] = min(memo[i+1], memo[i] + abs(H[i+1] - H[i]))\n\n if i > N-3:\n\n break\n\n memo[i+2] = min(memo[i+2], memo[i] + abs(H[i+2] - H[i]))\n\n\n\nprint((memo[N-1]))","target":"N = int(eval(input()))\n\nH = list(map(int, input().split()))\n\n\n\ndp = [0] * N\n\ndp[1] = abs(H[1] - H[0])\n\nfor i in range(2, N):\n\n dp[i] = min(dp[i-1] + abs(H[i] - H[i-1]), dp[i-2] + abs(H[i] - H[i-2]))\n\n\n\nprint((dp[N-1]))\n","code_v0_loc":15,"code_v1_loc":9,"code_v0_num_chars":398,"code_v1_num_chars":214,"code_v0_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\n# memo = [0] + [abs(H[i] - H[i-1]) for i in range(1, N)]\n# memo = [H[i] - H[i-1] for i in range(1, N)]\nmemo = [sum(H)] * (N + 2)\nmemo[0] = 0\nfor i in range(N):\n memo[i + 1] = min(memo[i + 1], memo[i] + abs(H[i + 1] - H[i]))\n if i > N - 3:\n break\n memo[i + 2] = min(memo[i + 2], memo[i] + abs(H[i + 2] - H[i]))\nprint((memo[N - 1]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\ndp = [0] * N\ndp[1] = abs(H[1] - H[0])\nfor i in range(2, N):\n dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))\nprint((dp[N - 1]))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-# memo = [0] + [abs(H[i] - H[i-1]) for i in range(1, N)]","-# memo = [H[i] - H[i-1] for i in range(1, N)]","-memo = [sum(H)] * (N + 2)","-memo[0] = 0","-for i in range(N):","- memo[i + 1] = min(memo[i + 1], memo[i] + abs(H[i + 1] - H[i]))","- if i > N - 3:","- break","- memo[i + 2] = min(memo[i + 2], memo[i] + abs(H[i + 2] - H[i]))","-print((memo[N - 1]))","+dp = [0] * N","+dp[1] = abs(H[1] - H[0])","+for i in range(2, N):","+ dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))","+print((dp[N - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.04825319,"measured_runtime_v1":0.1242870405,"runtime_lift":0.3882399151,"key":["s297227376","s177862174"]} +{"user_id":"u192908410","problem_id":"p03838","language":"python","submission_id_v0":"s902541273","submission_id_v1":"s845717513","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"import math\n\ndef abs(x):\n\n return math.fabs(x)\n\na,b=list(map(int,input().split()))\n\nc=int(abs(b)-abs(a))\n\nprint((int(abs(c))+(c*a<0)+(c*b<0) if c!=0 else 1))","target":"a,b=list(map(int,input().split()))\n\nc=int(abs(b)-abs(a))\n\nprint((int(abs(c))+(c*a<0)+(c*b<0) if c!=0 else 1))","code_v0_loc":6,"code_v1_loc":3,"code_v0_num_chars":150,"code_v1_num_chars":101,"code_v0_no_empty_lines":"import math\n\n\ndef abs(x):\n return math.fabs(x)\n\n\na, b = list(map(int, input().split()))\nc = int(abs(b) - abs(a))\nprint((int(abs(c)) + (c * a < 0) + (c * b < 0) if c != 0 else 1))\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nc = int(abs(b) - abs(a))\nprint((int(abs(c)) + (c * a < 0) + (c * b < 0) if c != 0 else 1))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import math","-","-","-def abs(x):","- return math.fabs(x)","-","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.0389875448,"measured_runtime_v1":0.0367439437,"runtime_lift":1.0610604319,"key":["s902541273","s845717513"]} +{"user_id":"u402629484","problem_id":"p03212","language":"python","submission_id_v0":"s776868696","submission_id_v1":"s502811062","cpu_time_v0":33,"cpu_time_v1":29,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.12,"input":"N = eval(input())\n\n\n\ndef r(s):\n\n me = all(('3' in s, '5' in s, '7' in s))\n\n if len(s) < len(N):\n\n return r(s+'3') + r(s+'5') + r(s+'7') + me\n\n elif s<=N:\n\n return me\n\n else:\n\n return 0\n\n\n\nprint((r('')))\n","target":"N = eval(input())\n\n\n\ndef r(s):\n\n me = '3' in s and '5' in s and '7' in s\n\n if len(s) < len(N):\n\n return r(s+'3') + r(s+'5') + r(s+'7') + me\n\n elif s<=N:\n\n return me\n\n else:\n\n return 0\n\n\n\nprint((r('')))\n","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":228,"code_v1_num_chars":227,"code_v0_no_empty_lines":"N = eval(input())\n\n\ndef r(s):\n me = all((\"3\" in s, \"5\" in s, \"7\" in s))\n if len(s) < len(N):\n return r(s + \"3\") + r(s + \"5\") + r(s + \"7\") + me\n elif s <= N:\n return me\n else:\n return 0\n\n\nprint((r(\"\")))\n","code_v1_no_empty_lines":"N = eval(input())\n\n\ndef r(s):\n me = \"3\" in s and \"5\" in s and \"7\" in s\n if len(s) < len(N):\n return r(s + \"3\") + r(s + \"5\") + r(s + \"7\") + me\n elif s <= N:\n return me\n else:\n return 0\n\n\nprint((r(\"\")))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- me = all((\"3\" in s, \"5\" in s, \"7\" in s))","+ me = \"3\" in s and \"5\" in s and \"7\" in s"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463107965,"measured_runtime_v1":0.0469493043,"runtime_lift":0.9864000572,"key":["s776868696","s502811062"]} +{"user_id":"u562935282","problem_id":"p03173","language":"python","submission_id_v0":"s085440203","submission_id_v1":"s699432647","cpu_time_v0":464,"cpu_time_v1":321,"memory_v0":44636,"memory_v1":41328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.82,"input":"def solve(n, a):\n\n from itertools import accumulate\n\n\n\n inf = (400 ** 2) * (10 ** 9) + 10\n\n\n\n # [l,r)\n\n def dfs(l, r):\n\n if memo[l][r] != -1:\n\n return memo[l][r]\n\n if r - l == 1:\n\n return 0\n\n res = inf\n\n for c in range(l + 1, r):\n\n # [l, c), [c, r)\n\n res = min(res, dfs(l, c) + dfs(c, r))\n\n res += acc[r] - acc[l]\n\n memo[l][r] = res\n\n return res\n\n\n\n acc = (0,) + tuple(accumulate(a))\n\n memo = [[-1] * (n + 1) for _ in range(n + 1)]\n\n\n\n return dfs(0, n)\n\n\n\n\n\nif __name__ == '__main__':\n\n n = int(eval(input()))\n\n a = tuple(map(int, input().split()))\n\n print((solve(n, a)))\n","target":"def solve(n, a):\n\n from itertools import accumulate\n\n\n\n inf = (400 ** 2) * (10 ** 9) + 10\n\n\n\n acc = (0,) + tuple(accumulate(a))\n\n cost = [[inf] * (n + 1) for _ in range(n + 1)]\n\n for i in range(n):\n\n cost[i][i + 1] = 0\n\n\n\n for l in range(n - 1, -1, -1):\n\n for r in range(l + 2, n + 1):\n\n for c in range(l + 1, r):\n\n cost[l][r] = min(cost[l][r], cost[l][c] + cost[c][r])\n\n cost[l][r] += acc[r] - acc[l]\n\n\n\n return cost[0][n]\n\n\n\n\n\nif __name__ == '__main__':\n\n n = int(eval(input()))\n\n a = tuple(map(int, input().split()))\n\n print((solve(n, a)))\n","code_v0_loc":29,"code_v1_loc":23,"code_v0_num_chars":687,"code_v1_num_chars":616,"code_v0_no_empty_lines":"def solve(n, a):\n from itertools import accumulate\n\n inf = (400**2) * (10**9) + 10\n # [l,r)\n def dfs(l, r):\n if memo[l][r] != -1:\n return memo[l][r]\n if r - l == 1:\n return 0\n res = inf\n for c in range(l + 1, r):\n # [l, c), [c, r)\n res = min(res, dfs(l, c) + dfs(c, r))\n res += acc[r] - acc[l]\n memo[l][r] = res\n return res\n\n acc = (0,) + tuple(accumulate(a))\n memo = [[-1] * (n + 1) for _ in range(n + 1)]\n return dfs(0, n)\n\n\nif __name__ == \"__main__\":\n n = int(eval(input()))\n a = tuple(map(int, input().split()))\n print((solve(n, a)))\n","code_v1_no_empty_lines":"def solve(n, a):\n from itertools import accumulate\n\n inf = (400**2) * (10**9) + 10\n acc = (0,) + tuple(accumulate(a))\n cost = [[inf] * (n + 1) for _ in range(n + 1)]\n for i in range(n):\n cost[i][i + 1] = 0\n for l in range(n - 1, -1, -1):\n for r in range(l + 2, n + 1):\n for c in range(l + 1, r):\n cost[l][r] = min(cost[l][r], cost[l][c] + cost[c][r])\n cost[l][r] += acc[r] - acc[l]\n return cost[0][n]\n\n\nif __name__ == \"__main__\":\n n = int(eval(input()))\n a = tuple(map(int, input().split()))\n print((solve(n, a)))\n","code_same":false,"relative_loc_diff_percent":20.6896551724,"diff":["- # [l,r)","- def dfs(l, r):","- if memo[l][r] != -1:","- return memo[l][r]","- if r - l == 1:","- return 0","- res = inf","- for c in range(l + 1, r):","- # [l, c), [c, r)","- res = min(res, dfs(l, c) + dfs(c, r))","- res += acc[r] - acc[l]","- memo[l][r] = res","- return res","-","- memo = [[-1] * (n + 1) for _ in range(n + 1)]","- return dfs(0, n)","+ cost = [[inf] * (n + 1) for _ in range(n + 1)]","+ for i in range(n):","+ cost[i][i + 1] = 0","+ for l in range(n - 1, -1, -1):","+ for r in range(l + 2, n + 1):","+ for c in range(l + 1, r):","+ cost[l][r] = min(cost[l][r], cost[l][c] + cost[c][r])","+ cost[l][r] += acc[r] - acc[l]","+ return cost[0][n]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376568587,"measured_runtime_v1":0.0467163699,"runtime_lift":0.8060741616,"key":["s085440203","s699432647"]} +{"user_id":"u188827677","problem_id":"p02989","language":"python","submission_id_v0":"s769650707","submission_id_v1":"s659068723","cpu_time_v0":78,"cpu_time_v1":69,"memory_v0":14428,"memory_v1":20496,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.54,"input":"n = int(eval(input()))\n\nd = sorted(list(map(int, input().split())))\n\n\n\nm = len(d)\/\/2\n\nprint((d[m]-d[m-1]))","target":"n = int(eval(input()))\n\nd = sorted(list(map(int, input().split())))\n\n\n\nx = d[n\/\/2-1]\n\ny = d[n\/\/2]\n\nprint((y-x))","code_v0_loc":5,"code_v1_loc":6,"code_v0_num_chars":98,"code_v1_num_chars":103,"code_v0_no_empty_lines":"n = int(eval(input()))\nd = sorted(list(map(int, input().split())))\nm = len(d) \/\/ 2\nprint((d[m] - d[m - 1]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nd = sorted(list(map(int, input().split())))\nx = d[n \/\/ 2 - 1]\ny = d[n \/\/ 2]\nprint((y - x))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-m = len(d) \/\/ 2","-print((d[m] - d[m - 1]))","+x = d[n \/\/ 2 - 1]","+y = d[n \/\/ 2]","+print((y - x))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0342132847,"measured_runtime_v1":0.0881847398,"runtime_lift":0.3879728487,"key":["s769650707","s659068723"]} +{"user_id":"u703528810","problem_id":"p02660","language":"python","submission_id_v0":"s337750424","submission_id_v1":"s287023379","cpu_time_v0":339,"cpu_time_v1":275,"memory_v0":20280,"memory_v1":9384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.88,"input":"def era(num):\n\n input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]\n\n input_list[0] = input_list[1] = False\n\n input_list[2] = input_list[3] = input_list[5] = True\n\n sqrt = num**0.5\n\n\n\n for serial in range(3, num, 2):\n\n\n\n if serial >= sqrt:\n\n return input_list\n\n\n\n for s in range(serial ** 2, num, serial): \n\n input_list[s] = False\n\n\n\nN=int(eval(input()))\n\nif N<25:\n\n Prime=[2,3,5]\n\nelse:\n\n input_list=era(int(N**0.5)+1)\n\n Prime=[i for i, b in enumerate(input_list) if b == True]\n\n\n\nFac={}\n\nfor p in Prime:\n\n while N%p==0:\n\n N\/\/=p\n\n if p in Fac:\n\n Fac[p]+=1\n\n else:\n\n Fac[p]=1\n\n if N==1:\n\n break\n\nif N!=1:\n\n Fac[N]=1\n\nans=0\n\n\n\nfor k in Fac:\n\n nec=1\n\n while True:\n\n if Fac[k]>=nec:\n\n ans+=1\n\n Fac[k]-=nec\n\n nec+=1\n\n else:\n\n break\n\n\n\nprint(ans)","target":"N=int(eval(input()))\n\nF={}\n\nfor i in range(2,int(N**0.5)+1):\n\n if N%i==0:\n\n F[i]=1\n\n N\/\/=i\n\n while N%i==0:\n\n N\/\/=i\n\n F[i]+=1\n\nif N>1:\n\n F[N]=1\n\n\n\nans=0\n\nfor f in F:\n\n j=1\n\n while True:\n\n F[f]-=j\n\n j+=1\n\n if F[f]>=0:\n\n ans+=1\n\n else:\n\n break\n\nprint(ans)","code_v0_loc":46,"code_v1_loc":23,"code_v0_num_chars":959,"code_v1_num_chars":339,"code_v0_no_empty_lines":"def era(num):\n input_list = [\n False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)\n ]\n input_list[0] = input_list[1] = False\n input_list[2] = input_list[3] = input_list[5] = True\n sqrt = num**0.5\n for serial in range(3, num, 2):\n if serial >= sqrt:\n return input_list\n for s in range(serial**2, num, serial):\n input_list[s] = False\n\n\nN = int(eval(input()))\nif N < 25:\n Prime = [2, 3, 5]\nelse:\n input_list = era(int(N**0.5) + 1)\n Prime = [i for i, b in enumerate(input_list) if b == True]\nFac = {}\nfor p in Prime:\n while N % p == 0:\n N \/\/= p\n if p in Fac:\n Fac[p] += 1\n else:\n Fac[p] = 1\n if N == 1:\n break\nif N != 1:\n Fac[N] = 1\nans = 0\nfor k in Fac:\n nec = 1\n while True:\n if Fac[k] >= nec:\n ans += 1\n Fac[k] -= nec\n nec += 1\n else:\n break\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nF = {}\nfor i in range(2, int(N**0.5) + 1):\n if N % i == 0:\n F[i] = 1\n N \/\/= i\n while N % i == 0:\n N \/\/= i\n F[i] += 1\nif N > 1:\n F[N] = 1\nans = 0\nfor f in F:\n j = 1\n while True:\n F[f] -= j\n j += 1\n if F[f] >= 0:\n ans += 1\n else:\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-def era(num):","- input_list = [","- False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)","- ]","- input_list[0] = input_list[1] = False","- input_list[2] = input_list[3] = input_list[5] = True","- sqrt = num**0.5","- for serial in range(3, num, 2):","- if serial >= sqrt:","- return input_list","- for s in range(serial**2, num, serial):","- input_list[s] = False","-","-","-if N < 25:","- Prime = [2, 3, 5]","-else:","- input_list = era(int(N**0.5) + 1)","- Prime = [i for i, b in enumerate(input_list) if b == True]","-Fac = {}","-for p in Prime:","- while N % p == 0:","- N \/\/= p","- if p in Fac:","- Fac[p] += 1","- else:","- Fac[p] = 1","- if N == 1:","- break","-if N != 1:","- Fac[N] = 1","+F = {}","+for i in range(2, int(N**0.5) + 1):","+ if N % i == 0:","+ F[i] = 1","+ N \/\/= i","+ while N % i == 0:","+ N \/\/= i","+ F[i] += 1","+if N > 1:","+ F[N] = 1","-for k in Fac:","- nec = 1","+for f in F:","+ j = 1","- if Fac[k] >= nec:","+ F[f] -= j","+ j += 1","+ if F[f] >= 0:","- Fac[k] -= nec","- nec += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.1672101964,"measured_runtime_v1":0.0929990427,"runtime_lift":1.7979776092,"key":["s337750424","s287023379"]} +{"user_id":"u130900604","problem_id":"p02578","language":"python","submission_id_v0":"s900192569","submission_id_v1":"s309674021","cpu_time_v0":145,"cpu_time_v1":118,"memory_v0":33340,"memory_v1":97640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.62,"input":"# coding: utf-8\n\n# Your code here!\n\n\n\n# import math\n\n# from decimal import Decimal\n\n# from collections import deque, Counter\n\n# from itertools import product\n\n\n\n\n\ndef LI():\n\n return list(map(int,input().split()))\n\n \n\ndef OPEN():\n\n return list(map(int,open(0).read().split()))\n\n \n\n\n\nn,*a=OPEN()\n\n\n\nnow=a[0]\n\nans=[]\n\nfor i in range(n):\n\n if a[i] K: break\n\n for z in range(Z):\n\n if x * y * z > K: break\n\n result.append(A[x]+B[y]+C[z])\n\n \n\nfor i in sorted(result, reverse=True)[:K]:\n\n print(i)\n","target":"import sys; sys.setrecursionlimit(50000)\n\ninput = sys.stdin.readline\n\n\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\n\n\nimport heapq\n\nq = []\n\nS = set()\n\nheapq.heappush(q, (-(A[0]+B[0]+C[0]), 0, 0, 0))\n\nS.add((0, 0, 0))\n\nfor _ in range(K):\n\n p, i, j, k = heapq.heappop(q)\n\n print((-p))\n\n if i + 1 < X and not (i+1, j, k) in S:\n\n heapq.heappush(q, (-(A[i+1]+B[j]+C[k]), i+1, j, k))\n\n S.add((i+1,j,k))\n\n if j + 1 < Y and not (i, j+1, k) in S:\n\n heapq.heappush(q, (-(A[i]+B[j+1]+C[k]), i, j+1, k))\n\n S.add((i,j+1,k))\n\n if k + 1 < Z and not (i, j, k+1) in S:\n\n heapq.heappush(q, (-(A[i]+B[j]+C[k+1]), i, j, k+1))\n\n S.add((i,j,k+1))\n","code_v0_loc":18,"code_v1_loc":28,"code_v0_num_chars":538,"code_v1_num_chars":853,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(50000)\ninput = sys.stdin.readline\nX, Y, Z, K = list(map(int, input().split()))\nA = sorted(map(int, input().split()), reverse=True)\nB = sorted(map(int, input().split()), reverse=True)\nC = sorted(map(int, input().split()), reverse=True)\nresult = []\nfor x in range(X):\n for y in range(Y):\n if x * y > K:\n break\n for z in range(Z):\n if x * y * z > K:\n break\n result.append(A[x] + B[y] + C[z])\nfor i in sorted(result, reverse=True)[:K]:\n print(i)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(50000)\ninput = sys.stdin.readline\nX, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort(reverse=True)\nB.sort(reverse=True)\nC.sort(reverse=True)\nimport heapq\n\nq = []\nS = set()\nheapq.heappush(q, (-(A[0] + B[0] + C[0]), 0, 0, 0))\nS.add((0, 0, 0))\nfor _ in range(K):\n p, i, j, k = heapq.heappop(q)\n print((-p))\n if i + 1 < X and not (i + 1, j, k) in S:\n heapq.heappush(q, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k))\n S.add((i + 1, j, k))\n if j + 1 < Y and not (i, j + 1, k) in S:\n heapq.heappush(q, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k))\n S.add((i, j + 1, k))\n if k + 1 < Z and not (i, j, k + 1) in S:\n heapq.heappush(q, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1))\n S.add((i, j, k + 1))\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-A = sorted(map(int, input().split()), reverse=True)","-B = sorted(map(int, input().split()), reverse=True)","-C = sorted(map(int, input().split()), reverse=True)","-result = []","-for x in range(X):","- for y in range(Y):","- if x * y > K:","- break","- for z in range(Z):","- if x * y * z > K:","- break","- result.append(A[x] + B[y] + C[z])","-for i in sorted(result, reverse=True)[:K]:","- print(i)","+A = list(map(int, input().split()))","+B = list(map(int, input().split()))","+C = list(map(int, input().split()))","+A.sort(reverse=True)","+B.sort(reverse=True)","+C.sort(reverse=True)","+import heapq","+","+q = []","+S = set()","+heapq.heappush(q, (-(A[0] + B[0] + C[0]), 0, 0, 0))","+S.add((0, 0, 0))","+for _ in range(K):","+ p, i, j, k = heapq.heappop(q)","+ print((-p))","+ if i + 1 < X and not (i + 1, j, k) in S:","+ heapq.heappush(q, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k))","+ S.add((i + 1, j, k))","+ if j + 1 < Y and not (i, j + 1, k) in S:","+ heapq.heappush(q, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k))","+ S.add((i, j + 1, k))","+ if k + 1 < Z and not (i, j, k + 1) in S:","+ heapq.heappush(q, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1))","+ S.add((i, j, k + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1112618775,"measured_runtime_v1":0.0421019201,"runtime_lift":2.6426794116,"key":["s052674010","s890119887"]} +{"user_id":"u805332733","problem_id":"p02707","language":"python","submission_id_v0":"s508577931","submission_id_v1":"s697929070","cpu_time_v0":163,"cpu_time_v1":140,"memory_v0":35480,"memory_v1":89340,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.11,"input":"from collections import Counter\n\n\n\ndef resolve():\n\n N = int(eval(input()))\n\n A = [int(x) for x in input().split(\" \")]\n\n collection = Counter(A)\n\n for i in range(1, N + 1):\n\n print((collection[i]))\n\n # results = [str(A.count(i))+'\\n' for i in range(1, N+1)]\n\n # print('\\n'.join(results))\n\n\n\nif __name__ == \"__main__\":\n\n resolve()","target":"def resolve():\n\n N = int(eval(input()))\n\n A = [int(x) for x in input().split(\" \")]\n\n results = [0] * N\n\n for a in A:\n\n results[a-1] += 1\n\n for r in results:\n\n print(r)\n\n\n\nif __name__ == \"__main__\":\n\n resolve()","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":330,"code_v1_num_chars":215,"code_v0_no_empty_lines":"from collections import Counter\n\n\ndef resolve():\n N = int(eval(input()))\n A = [int(x) for x in input().split(\" \")]\n collection = Counter(A)\n for i in range(1, N + 1):\n print((collection[i]))\n # results = [str(A.count(i))+'\\n' for i in range(1, N+1)]\n # print('\\n'.join(results))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"def resolve():\n N = int(eval(input()))\n A = [int(x) for x in input().split(\" \")]\n results = [0] * N\n for a in A:\n results[a - 1] += 1\n for r in results:\n print(r)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-from collections import Counter","-","-","- collection = Counter(A)","- for i in range(1, N + 1):","- print((collection[i]))","- # results = [str(A.count(i))+'\\n' for i in range(1, N+1)]","- # print('\\n'.join(results))","+ results = [0] * N","+ for a in A:","+ results[a - 1] += 1","+ for r in results:","+ print(r)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0464429848,"measured_runtime_v1":0.0448281679,"runtime_lift":1.036022371,"key":["s508577931","s697929070"]} +{"user_id":"u257442624","problem_id":"p02706","language":"python","submission_id_v0":"s937763395","submission_id_v1":"s363792422","cpu_time_v0":24,"cpu_time_v1":22,"memory_v0":10036,"memory_v1":10124,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.33,"input":"NM = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nx = 0\n\nfor i in range(NM[1]):\n\n x += a[i]\n\n\n\nif x > NM[0]:\n\n print((-1))\n\nelse:\n\n print((NM[0] - x))","target":"NM = list(map(int, input().split()))\n\nN, M = NM[0],NM[1]\n\na = list(map(int, input().split()))\n\n\n\nif sum(a)> N:\n\n print((-1))\n\nelse:\n\n print((N - sum(a)))","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":180,"code_v1_num_chars":156,"code_v0_no_empty_lines":"NM = list(map(int, input().split()))\na = list(map(int, input().split()))\nx = 0\nfor i in range(NM[1]):\n x += a[i]\nif x > NM[0]:\n print((-1))\nelse:\n print((NM[0] - x))\n","code_v1_no_empty_lines":"NM = list(map(int, input().split()))\nN, M = NM[0], NM[1]\na = list(map(int, input().split()))\nif sum(a) > N:\n print((-1))\nelse:\n print((N - sum(a)))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["+N, M = NM[0], NM[1]","-x = 0","-for i in range(NM[1]):","- x += a[i]","-if x > NM[0]:","+if sum(a) > N:","- print((NM[0] - x))","+ print((N - sum(a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0353959138,"measured_runtime_v1":0.0362326767,"runtime_lift":0.9769058488,"key":["s937763395","s363792422"]} +{"user_id":"u029000441","problem_id":"p03127","language":"python","submission_id_v0":"s567237327","submission_id_v1":"s169134397","cpu_time_v0":112,"cpu_time_v1":79,"memory_v0":14636,"memory_v1":20268,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.46,"input":"#dp\u3067\u3067\u304d\u306a\u3044\u304b\u306a\uff1f\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**7)\n\nfrom collections import Counter, deque\n\nfrom collections import defaultdict\n\nfrom itertools import combinations, permutations, accumulate, groupby, product\n\nfrom bisect import bisect_left,bisect_right\n\nfrom heapq import heapify, heappop, heappush\n\nfrom math import floor, ceil,pi\n\nfrom operator import itemgetter\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI2(): return [int(eval(input())) for i in range(n)]\n\ndef MXI(): return [[LI()]for i in range(n)]\n\ndef SI(): return input().rstrip()\n\ndef printns(x): print(('\\n'.join(x)))\n\ndef printni(x): print(('\\n'.join(list(map(str,x)))))\n\ninf = 10**17\n\nmod = 10**9 + 7\n\n\n\nn=I()\n\nlis=LI()\n\nlis=sorted(lis)\n\n#print(lis)\n\n\n\nfor i in range(1,n):\n\n lis[i]=lis[i]%lis[0]\n\nlis.append(0)\n\nlis=sorted(list(set(lis)))\n\n \n\nwhile len(lis)>2:\n\n for i in range(2,len(lis)):\n\n lis[i]=lis[i]%lis[1]\n\n lis.append(0)\n\n lis=sorted(list(set(lis)))\n\n#print(lis)\n\nprint((lis[-1]))\n\n#print(lis[0])","target":"#float\u578b\u3092\u8a31\u3059\u306a\n\n#numpy\u306fpython\u3067\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**7)\n\nfrom collections import Counter, deque\n\nfrom collections import defaultdict\n\nfrom itertools import combinations, permutations, accumulate, groupby, product\n\nfrom bisect import bisect_left,bisect_right\n\nfrom heapq import heapify, heappop, heappush\n\nfrom math import floor, ceil,pi,factorial\n\nfrom operator import itemgetter\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\ndef LI2(): return [int(eval(input())) for i in range(n)]\n\ndef MXI(): return [[LI()]for i in range(n)]\n\ndef SI(): return input().rstrip()\n\ndef printns(x): print(('\\n'.join(x)))\n\ndef printni(x): print(('\\n'.join(list(map(str,x)))))\n\ninf = 10**17\n\nmod = 10**9 + 7\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n\n\nn=I()\n\nlis=LI()\n\np=lis[0]\n\nfor i in range(n-1):\n\n p=gcd(p,lis[i+1])\n\nprint(p)\n\n \n\n\n\n ","code_v0_loc":40,"code_v1_loc":37,"code_v0_num_chars":1097,"code_v1_num_chars":966,"code_v0_no_empty_lines":"# dp\u3067\u3067\u304d\u306a\u3044\u304b\u306a\uff1f\nimport sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nfrom collections import Counter, deque\nfrom collections import defaultdict\nfrom itertools import combinations, permutations, accumulate, groupby, product\nfrom bisect import bisect_left, bisect_right\nfrom heapq import heapify, heappop, heappush\nfrom math import floor, ceil, pi\nfrom operator import itemgetter\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI2():\n return [int(eval(input())) for i in range(n)]\n\n\ndef MXI():\n return [[LI()] for i in range(n)]\n\n\ndef SI():\n return input().rstrip()\n\n\ndef printns(x):\n print((\"\\n\".join(x)))\n\n\ndef printni(x):\n print((\"\\n\".join(list(map(str, x)))))\n\n\ninf = 10**17\nmod = 10**9 + 7\nn = I()\nlis = LI()\nlis = sorted(lis)\n# print(lis)\nfor i in range(1, n):\n lis[i] = lis[i] % lis[0]\nlis.append(0)\nlis = sorted(list(set(lis)))\nwhile len(lis) > 2:\n for i in range(2, len(lis)):\n lis[i] = lis[i] % lis[1]\n lis.append(0)\n lis = sorted(list(set(lis)))\n# print(lis)\nprint((lis[-1]))\n# print(lis[0])\n","code_v1_no_empty_lines":"# float\u578b\u3092\u8a31\u3059\u306a\n# numpy\u306fpython\u3067\nimport sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nfrom collections import Counter, deque\nfrom collections import defaultdict\nfrom itertools import combinations, permutations, accumulate, groupby, product\nfrom bisect import bisect_left, bisect_right\nfrom heapq import heapify, heappop, heappush\nfrom math import floor, ceil, pi, factorial\nfrom operator import itemgetter\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LI2():\n return [int(eval(input())) for i in range(n)]\n\n\ndef MXI():\n return [[LI()] for i in range(n)]\n\n\ndef SI():\n return input().rstrip()\n\n\ndef printns(x):\n print((\"\\n\".join(x)))\n\n\ndef printni(x):\n print((\"\\n\".join(list(map(str, x)))))\n\n\ninf = 10**17\nmod = 10**9 + 7\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\nn = I()\nlis = LI()\np = lis[0]\nfor i in range(n - 1):\n p = gcd(p, lis[i + 1])\nprint(p)\n","code_same":false,"relative_loc_diff_percent":7.5,"diff":["-# dp\u3067\u3067\u304d\u306a\u3044\u304b\u306a\uff1f","+# float\u578b\u3092\u8a31\u3059\u306a","+# numpy\u306fpython\u3067","-from math import floor, ceil, pi","+from math import floor, ceil, pi, factorial","+","+","+def gcd(a, b):","+ while b:","+ a, b = b, a % b","+ return a","+","+","-lis = sorted(lis)","-# print(lis)","-for i in range(1, n):","- lis[i] = lis[i] % lis[0]","-lis.append(0)","-lis = sorted(list(set(lis)))","-while len(lis) > 2:","- for i in range(2, len(lis)):","- lis[i] = lis[i] % lis[1]","- lis.append(0)","- lis = sorted(list(set(lis)))","-# print(lis)","-print((lis[-1]))","-# print(lis[0])","+p = lis[0]","+for i in range(n - 1):","+ p = gcd(p, lis[i + 1])","+print(p)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1455454469,"measured_runtime_v1":0.0422437072,"runtime_lift":3.4453758099,"key":["s567237327","s169134397"]} +{"user_id":"u626337957","problem_id":"p02614","language":"python","submission_id_v0":"s236403312","submission_id_v1":"s368398345","cpu_time_v0":143,"cpu_time_v1":98,"memory_v0":77140,"memory_v1":74732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.47,"input":"import copy\n\n \n\nH, W, K = list(map(int, input().split()))\n\ntiles = [list(eval(input())) for _ in range(H)]\n\ncount = 0\n\n \n\nfor num in range(2**(H+W)):\n\n copied_tiles = copy.deepcopy(tiles)\n\n for i in range(H+W):\n\n if num>>i&1:\n\n if i < H:\n\n for j in range(W):\n\n copied_tiles[i][j] = 'R'\n\n else:\n\n for j in range(H):\n\n copied_tiles[j][i-H] = 'R'\n\n black_c = 0\n\n for i in range(H):\n\n for j in range(W):\n\n if copied_tiles[i][j] == '#':\n\n black_c += 1\n\n if black_c == K:\n\n count += 1\n\nprint(count)","target":"import copy\n\n \n\nH, W, K = list(map(int, input().split()))\n\ntiles = [list(eval(input())) for _ in range(H)]\n\nanswer = 0\n\n\n\nfor h in range(2**H):\n\n for w in range(2**W):\n\n b_cnt = 0\n\n for i in range(H):\n\n for j in range(W):\n\n if not (h>>i&1 or w>>j&1) and tiles[i][j] == '#':\n\n b_cnt += 1\n\n if b_cnt == K:\n\n answer += 1\n\nprint(answer)","code_v0_loc":24,"code_v1_loc":16,"code_v0_num_chars":549,"code_v1_num_chars":357,"code_v0_no_empty_lines":"import copy\n\nH, W, K = list(map(int, input().split()))\ntiles = [list(eval(input())) for _ in range(H)]\ncount = 0\nfor num in range(2 ** (H + W)):\n copied_tiles = copy.deepcopy(tiles)\n for i in range(H + W):\n if num >> i & 1:\n if i < H:\n for j in range(W):\n copied_tiles[i][j] = \"R\"\n else:\n for j in range(H):\n copied_tiles[j][i - H] = \"R\"\n black_c = 0\n for i in range(H):\n for j in range(W):\n if copied_tiles[i][j] == \"#\":\n black_c += 1\n if black_c == K:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"import copy\n\nH, W, K = list(map(int, input().split()))\ntiles = [list(eval(input())) for _ in range(H)]\nanswer = 0\nfor h in range(2**H):\n for w in range(2**W):\n b_cnt = 0\n for i in range(H):\n for j in range(W):\n if not (h >> i & 1 or w >> j & 1) and tiles[i][j] == \"#\":\n b_cnt += 1\n if b_cnt == K:\n answer += 1\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-count = 0","-for num in range(2 ** (H + W)):","- copied_tiles = copy.deepcopy(tiles)","- for i in range(H + W):","- if num >> i & 1:","- if i < H:","- for j in range(W):","- copied_tiles[i][j] = \"R\"","- else:","- for j in range(H):","- copied_tiles[j][i - H] = \"R\"","- black_c = 0","- for i in range(H):","- for j in range(W):","- if copied_tiles[i][j] == \"#\":","- black_c += 1","- if black_c == K:","- count += 1","-print(count)","+answer = 0","+for h in range(2**H):","+ for w in range(2**W):","+ b_cnt = 0","+ for i in range(H):","+ for j in range(W):","+ if not (h >> i & 1 or w >> j & 1) and tiles[i][j] == \"#\":","+ b_cnt += 1","+ if b_cnt == K:","+ answer += 1","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0493268728,"measured_runtime_v1":0.0472231944,"runtime_lift":1.0445475661,"key":["s236403312","s368398345"]} +{"user_id":"u843175622","problem_id":"p03032","language":"python","submission_id_v0":"s856343863","submission_id_v1":"s871449381","cpu_time_v0":34,"cpu_time_v1":31,"memory_v0":9220,"memory_v1":9056,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.82,"input":"n, k = list(map(int, input().split()))\n\nv = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor l in range(0, k + 1):\n\n for r in range(0, k + 1 - l):\n\n if l == r == 0 or l + r > n:\n\n continue\n\n a = sorted(v[:l] + v[n - r:])\n\n m = min(k - l - r, len(a) - 1)\n\n ans = max(ans, sum(a[m:] if a[m] <\n\n 0 else [x for x in a if x > 0]))\n\nprint(ans)","target":"n, k, *a = list(map(int, open(0).read().split()))\n\n\n\nans = 0\n\nfor l in range(0, k + 1):\n\n for r in range(0, k + 1 - l):\n\n if l == r == 0 or l + r > n:\n\n continue\n\n b = sorted(a[:l] + a[n - r:])\n\n c = min(k - l - r, len(b) - 1)\n\n ans = max(ans, sum(b[c:] if b[c] < 0 else [x for x in b if x > 0]))\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":401,"code_v1_num_chars":348,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nv = list(map(int, input().split()))\nans = 0\nfor l in range(0, k + 1):\n for r in range(0, k + 1 - l):\n if l == r == 0 or l + r > n:\n continue\n a = sorted(v[:l] + v[n - r :])\n m = min(k - l - r, len(a) - 1)\n ans = max(ans, sum(a[m:] if a[m] < 0 else [x for x in a if x > 0]))\nprint(ans)\n","code_v1_no_empty_lines":"n, k, *a = list(map(int, open(0).read().split()))\nans = 0\nfor l in range(0, k + 1):\n for r in range(0, k + 1 - l):\n if l == r == 0 or l + r > n:\n continue\n b = sorted(a[:l] + a[n - r :])\n c = min(k - l - r, len(b) - 1)\n ans = max(ans, sum(b[c:] if b[c] < 0 else [x for x in b if x > 0]))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-n, k = list(map(int, input().split()))","-v = list(map(int, input().split()))","+n, k, *a = list(map(int, open(0).read().split()))","- a = sorted(v[:l] + v[n - r :])","- m = min(k - l - r, len(a) - 1)","- ans = max(ans, sum(a[m:] if a[m] < 0 else [x for x in a if x > 0]))","+ b = sorted(a[:l] + a[n - r :])","+ c = min(k - l - r, len(b) - 1)","+ ans = max(ans, sum(b[c:] if b[c] < 0 else [x for x in b if x > 0]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0740043936,"measured_runtime_v1":0.0851964705,"runtime_lift":0.8686321527,"key":["s856343863","s871449381"]} +{"user_id":"u599925824","problem_id":"p03285","language":"python","submission_id_v0":"s848688406","submission_id_v1":"s703081855","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"N = int(eval(input()))\n\nmultiple_4 = [x*4 for x in range(101) if x >= 1 and x <= 25]\n\nmultiple_7 = [x*7 for x in range(101) if x >= 1 and x <= 14]\n\nmultiple_4_7 = [x*4+7 for x in range(101) if x >= 1 and x <= 23]\n\nmultiple_7_4 = [x*7+4 for x in range(101) if x >= 1 and x <= 23]\n\ntmp = []\n\nfor i in range(10):\n\n for j in range(10):\n\n solve = (4*(i+1))+(7*(j+1))\n\n if solve <= 100:\n\n tmp.append(solve)\n\nmultiple_other = sorted(list(set(tmp)))\n\nif N in multiple_4 or N in multiple_7 or N in multiple_4_7 or N in multiple_7_4 or N in multiple_other:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","target":"N = int(eval(input()))\n\ntmp = []\n\nfor i in range(10):\n\n for j in range(10):\n\n solve = (4*(i+1))+(7*(j+1))\n\n if solve <= 100:\n\n tmp.append(solve)\n\nmultiples = sorted(list(set(tmp)))\n\nif N % 4 == 0 or N % 7 == 0 or N in multiples:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":16,"code_v1_loc":12,"code_v0_num_chars":590,"code_v1_num_chars":272,"code_v0_no_empty_lines":"N = int(eval(input()))\nmultiple_4 = [x * 4 for x in range(101) if x >= 1 and x <= 25]\nmultiple_7 = [x * 7 for x in range(101) if x >= 1 and x <= 14]\nmultiple_4_7 = [x * 4 + 7 for x in range(101) if x >= 1 and x <= 23]\nmultiple_7_4 = [x * 7 + 4 for x in range(101) if x >= 1 and x <= 23]\ntmp = []\nfor i in range(10):\n for j in range(10):\n solve = (4 * (i + 1)) + (7 * (j + 1))\n if solve <= 100:\n tmp.append(solve)\nmultiple_other = sorted(list(set(tmp)))\nif (\n N in multiple_4\n or N in multiple_7\n or N in multiple_4_7\n or N in multiple_7_4\n or N in multiple_other\n):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\ntmp = []\nfor i in range(10):\n for j in range(10):\n solve = (4 * (i + 1)) + (7 * (j + 1))\n if solve <= 100:\n tmp.append(solve)\nmultiples = sorted(list(set(tmp)))\nif N % 4 == 0 or N % 7 == 0 or N in multiples:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-multiple_4 = [x * 4 for x in range(101) if x >= 1 and x <= 25]","-multiple_7 = [x * 7 for x in range(101) if x >= 1 and x <= 14]","-multiple_4_7 = [x * 4 + 7 for x in range(101) if x >= 1 and x <= 23]","-multiple_7_4 = [x * 7 + 4 for x in range(101) if x >= 1 and x <= 23]","-multiple_other = sorted(list(set(tmp)))","-if (","- N in multiple_4","- or N in multiple_7","- or N in multiple_4_7","- or N in multiple_7_4","- or N in multiple_other","-):","+multiples = sorted(list(set(tmp)))","+if N % 4 == 0 or N % 7 == 0 or N in multiples:"],"diff_only_import_comment":false,"measured_runtime_v0":0.043492873,"measured_runtime_v1":0.0394080849,"runtime_lift":1.1036535545,"key":["s848688406","s703081855"]} +{"user_id":"u519939795","problem_id":"p03211","language":"python","submission_id_v0":"s875818332","submission_id_v1":"s786839208","cpu_time_v0":25,"cpu_time_v1":21,"memory_v0":9116,"memory_v1":9156,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.0,"input":"s=eval(input())\n\nans=10*100\n\nfor i in range(len(s)-2):\n\n if abs(753-int(s[i:i+3]))<=ans:\n\n ans=abs(753-int(s[i:i+3]))\n\nprint(ans)","target":"S = eval(input())\n\n\n\nans = []\n\n\n\nfor i in range(len(S)-2):\n\n ans.append(abs(int(S[i:i+3]) - 753))\n\n\n\nprint((min(ans)))\n","code_v0_loc":6,"code_v1_loc":8,"code_v0_num_chars":133,"code_v1_num_chars":114,"code_v0_no_empty_lines":"s = eval(input())\nans = 10 * 100\nfor i in range(len(s) - 2):\n if abs(753 - int(s[i : i + 3])) <= ans:\n ans = abs(753 - int(s[i : i + 3]))\nprint(ans)\n","code_v1_no_empty_lines":"S = eval(input())\nans = []\nfor i in range(len(S) - 2):\n ans.append(abs(int(S[i : i + 3]) - 753))\nprint((min(ans)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-s = eval(input())","-ans = 10 * 100","-for i in range(len(s) - 2):","- if abs(753 - int(s[i : i + 3])) <= ans:","- ans = abs(753 - int(s[i : i + 3]))","-print(ans)","+S = eval(input())","+ans = []","+for i in range(len(S) - 2):","+ ans.append(abs(int(S[i : i + 3]) - 753))","+print((min(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0410361094,"measured_runtime_v1":0.0453131707,"runtime_lift":0.9056110802,"key":["s875818332","s786839208"]} +{"user_id":"u597374218","problem_id":"p03137","language":"python","submission_id_v0":"s413170344","submission_id_v1":"s137543965","cpu_time_v0":103,"cpu_time_v1":91,"memory_v0":13964,"memory_v1":14976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.65,"input":"N,M=list(map(int,input().split()))\n\nX=sorted(map(int,input().split()))\n\nd=sorted(j-i for i,j in zip(X,X[1:]))[::-1]\n\nprint((sum(d[N-1:])))","target":"N,M=list(map(int,input().split()))\n\nX=sorted(set(list(map(int,input().split()))))\n\ns=[]\n\nfor i in range(M-1):s.append(X[i+1]-X[i])\n\ns=sorted(s)[::-1]\n\nprint((sum(s[N-1:])))","code_v0_loc":4,"code_v1_loc":6,"code_v0_num_chars":130,"code_v1_num_chars":164,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nX = sorted(map(int, input().split()))\nd = sorted(j - i for i, j in zip(X, X[1:]))[::-1]\nprint((sum(d[N - 1 :])))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nX = sorted(set(list(map(int, input().split()))))\ns = []\nfor i in range(M - 1):\n s.append(X[i + 1] - X[i])\ns = sorted(s)[::-1]\nprint((sum(s[N - 1 :])))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-X = sorted(map(int, input().split()))","-d = sorted(j - i for i, j in zip(X, X[1:]))[::-1]","-print((sum(d[N - 1 :])))","+X = sorted(set(list(map(int, input().split()))))","+s = []","+for i in range(M - 1):","+ s.append(X[i + 1] - X[i])","+s = sorted(s)[::-1]","+print((sum(s[N - 1 :])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0401033192,"measured_runtime_v1":0.0700697243,"runtime_lift":0.572334479,"key":["s413170344","s137543965"]} +{"user_id":"u123745130","problem_id":"p02732","language":"python","submission_id_v0":"s687611817","submission_id_v1":"s781864438","cpu_time_v0":602,"cpu_time_v1":535,"memory_v0":24996,"memory_v1":25644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.13,"input":"n=int(eval(input()))\n\nl=list(map(int,input().split()))\n\n\n\nans_l=[0]*(n+1)\n\nans=0\n\ndef con(a):\n\n return int(a*(a-1)*0.5)\n\nfor i in range(n):\n\n ans_l[l[i]]+=1\n\n#print(\"ans_l\",ans_l)\n\n#print(\"l\",l)\n\nfor j in ans_l:\n\n ans+=con(j)\n\n# print(ans)\n\nfor i in range(n):\n\n ans_2=ans\n\n # print(\"ans_2_0:\",ans_2)\n\n #print(\"ans_l[l[i]]\",ans_l[l[i]])\n\n ans_2-=con(ans_l[l[i]])\n\n #print(\"ans_2_1:\",ans_2)\n\n \n\n #print(\"ans_l[l[i]]:\",ans_l[l[i]]-1)\n\n ans_2+=con(ans_l[l[i]]-1)\n\n print(ans_2)\n","target":"n=int(eval(input()))\n\nl=list(map(int,input().split()))\n\n\n\nans_l=[0]*(n+1)\n\nans=0\n\ndef con(a):\n\n return int(a*(a-1)*0.5)\n\nfor i in l:\n\n ans_l[i]+=1\n\n#print(\"ans_l\",ans_l)\n\n#print(\"l\",l)\n\nfor j in ans_l:\n\n ans+=con(j)\n\n# print(ans)\n\nfor i in l:\n\n ans_2=ans\n\n # print(\"ans_2_0:\",ans_2)\n\n #print(\"ans_l[i]\",ans_l[i])\n\n ans_2-=con(ans_l[i])\n\n #print(\"ans_2_1:\",ans_2)\n\n \n\n #print(\"ans_l[i]:\",ans_l[i]-1) \n\n ans_2+=con(ans_l[i]-1)\n\n print(ans_2)","code_v0_loc":24,"code_v1_loc":24,"code_v0_num_chars":504,"code_v1_num_chars":471,"code_v0_no_empty_lines":"n = int(eval(input()))\nl = list(map(int, input().split()))\nans_l = [0] * (n + 1)\nans = 0\n\n\ndef con(a):\n return int(a * (a - 1) * 0.5)\n\n\nfor i in range(n):\n ans_l[l[i]] += 1\n# print(\"ans_l\",ans_l)\n# print(\"l\",l)\nfor j in ans_l:\n ans += con(j)\n# print(ans)\nfor i in range(n):\n ans_2 = ans\n # print(\"ans_2_0:\",ans_2)\n # print(\"ans_l[l[i]]\",ans_l[l[i]])\n ans_2 -= con(ans_l[l[i]])\n # print(\"ans_2_1:\",ans_2)\n # print(\"ans_l[l[i]]:\",ans_l[l[i]]-1)\n ans_2 += con(ans_l[l[i]] - 1)\n print(ans_2)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nl = list(map(int, input().split()))\nans_l = [0] * (n + 1)\nans = 0\n\n\ndef con(a):\n return int(a * (a - 1) * 0.5)\n\n\nfor i in l:\n ans_l[i] += 1\n# print(\"ans_l\",ans_l)\n# print(\"l\",l)\nfor j in ans_l:\n ans += con(j)\n# print(ans)\nfor i in l:\n ans_2 = ans\n # print(\"ans_2_0:\",ans_2)\n # print(\"ans_l[i]\",ans_l[i])\n ans_2 -= con(ans_l[i])\n # print(\"ans_2_1:\",ans_2)\n # print(\"ans_l[i]:\",ans_l[i]-1)\n ans_2 += con(ans_l[i] - 1)\n print(ans_2)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(n):","- ans_l[l[i]] += 1","+for i in l:","+ ans_l[i] += 1","-for i in range(n):","+for i in l:","- # print(\"ans_l[l[i]]\",ans_l[l[i]])","- ans_2 -= con(ans_l[l[i]])","+ # print(\"ans_l[i]\",ans_l[i])","+ ans_2 -= con(ans_l[i])","- # print(\"ans_l[l[i]]:\",ans_l[l[i]]-1)","- ans_2 += con(ans_l[l[i]] - 1)","+ # print(\"ans_l[i]:\",ans_l[i]-1)","+ ans_2 += con(ans_l[i] - 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0612003102,"measured_runtime_v1":0.0426261282,"runtime_lift":1.4357464026,"key":["s687611817","s781864438"]} +{"user_id":"u497952650","problem_id":"p03060","language":"python","submission_id_v0":"s015838852","submission_id_v1":"s608419474","cpu_time_v0":151,"cpu_time_v1":17,"memory_v0":12496,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.74,"input":"import numpy as np \n\n\n\nN = int(eval(input()))\n\nV = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\n\n\nans = 0\n\n\n\nfor i,j in zip(V,C):\n\n if i-j>0:\n\n ans += i-j\n\n\n\nprint(ans)","target":"N = int(eval(input()))\n\nV = list(map(int,input().split()))\n\nC = list(map(int,input().split()))\n\n\n\nans = 0\n\n\n\nfor i,j in zip(V,C):\n\n if i-j>0:\n\n ans += i-j\n\n\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":183,"code_v1_num_chars":161,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nV = list(map(int, input().split()))\nC = list(map(int, input().split()))\nans = 0\nfor i, j in zip(V, C):\n if i - j > 0:\n ans += i - j\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nV = list(map(int, input().split()))\nC = list(map(int, input().split()))\nans = 0\nfor i, j in zip(V, C):\n if i - j > 0:\n ans += i - j\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-import numpy as np","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.1923041534,"measured_runtime_v1":0.03452788,"runtime_lift":5.5695326109,"key":["s015838852","s608419474"]} +{"user_id":"u054514819","problem_id":"p03044","language":"python","submission_id_v0":"s849747838","submission_id_v1":"s057319900","cpu_time_v0":617,"cpu_time_v1":321,"memory_v0":45416,"memory_v1":108052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.97,"input":"N = int(eval(input()))\n\nfrom collections import deque\n\n\n\ntree = [{} for _ in range(N)]\n\n\n\ncolor = [-1]*N\n\nfor i in range(N-1):\n\n u, v, w = list(map(int, input().split()))\n\n tree[u-1][v-1] = w\n\n tree[v-1][u-1] = w\n\n\n\nqueue = deque()\n\nqueue.append((0, 0))\n\n\n\nwhile queue:\n\n v, w = queue.pop()\n\n color[v] = w%2\n\n for i in list(tree[v].keys()):\n\n if color[i]==-1:\n\n queue.append((i, w+tree[v][i]))\n\n\n\nfor c in color:\n\n print(c)","target":"import sys\n\ndef input(): return sys.stdin.readline().strip()\n\ndef mapint(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10**9)\n\n\n\nN = int(eval(input()))\n\ngraph = [{} for _ in range(N)]\n\n\n\nfor _ in range(N-1):\n\n u, v, w = mapint()\n\n graph[u-1][v-1] = w%2\n\n graph[v-1][u-1] = w%2\n\n\n\nfrom collections import deque\n\nstack = deque([0])\n\n\n\ncolors = [-1]*N\n\ncolors[0] = 0\n\nwhile stack:\n\n v = stack.pop()\n\n for nx in list(graph[v].keys()):\n\n if colors[nx]==-1:\n\n w = graph[v][nx]\n\n colors[nx] = (colors[v]+w)%2\n\n stack.append(nx)\n\n\n\nfor a in colors:\n\n print(a)","code_v0_loc":23,"code_v1_loc":28,"code_v0_num_chars":444,"code_v1_num_chars":610,"code_v0_no_empty_lines":"N = int(eval(input()))\nfrom collections import deque\n\ntree = [{} for _ in range(N)]\ncolor = [-1] * N\nfor i in range(N - 1):\n u, v, w = list(map(int, input().split()))\n tree[u - 1][v - 1] = w\n tree[v - 1][u - 1] = w\nqueue = deque()\nqueue.append((0, 0))\nwhile queue:\n v, w = queue.pop()\n color[v] = w % 2\n for i in list(tree[v].keys()):\n if color[i] == -1:\n queue.append((i, w + tree[v][i]))\nfor c in color:\n print(c)\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef mapint():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nN = int(eval(input()))\ngraph = [{} for _ in range(N)]\nfor _ in range(N - 1):\n u, v, w = mapint()\n graph[u - 1][v - 1] = w % 2\n graph[v - 1][u - 1] = w % 2\nfrom collections import deque\n\nstack = deque([0])\ncolors = [-1] * N\ncolors[0] = 0\nwhile stack:\n v = stack.pop()\n for nx in list(graph[v].keys()):\n if colors[nx] == -1:\n w = graph[v][nx]\n colors[nx] = (colors[v] + w) % 2\n stack.append(nx)\nfor a in colors:\n print(a)\n","code_same":false,"relative_loc_diff_percent":17.8571428571,"diff":["+import sys","+","+","+def input():","+ return sys.stdin.readline().strip()","+","+","+def mapint():","+ return list(map(int, input().split()))","+","+","+sys.setrecursionlimit(10**9)","+graph = [{} for _ in range(N)]","+for _ in range(N - 1):","+ u, v, w = mapint()","+ graph[u - 1][v - 1] = w % 2","+ graph[v - 1][u - 1] = w % 2","-tree = [{} for _ in range(N)]","-color = [-1] * N","-for i in range(N - 1):","- u, v, w = list(map(int, input().split()))","- tree[u - 1][v - 1] = w","- tree[v - 1][u - 1] = w","-queue = deque()","-queue.append((0, 0))","-while queue:","- v, w = queue.pop()","- color[v] = w % 2","- for i in list(tree[v].keys()):","- if color[i] == -1:","- queue.append((i, w + tree[v][i]))","-for c in color:","- print(c)","+stack = deque([0])","+colors = [-1] * N","+colors[0] = 0","+while stack:","+ v = stack.pop()","+ for nx in list(graph[v].keys()):","+ if colors[nx] == -1:","+ w = graph[v][nx]","+ colors[nx] = (colors[v] + w) % 2","+ stack.append(nx)","+for a in colors:","+ print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0682245653,"measured_runtime_v1":0.0735289212,"runtime_lift":0.9278602778,"key":["s849747838","s057319900"]} +{"user_id":"u870793476","problem_id":"p03109","language":"python","submission_id_v0":"s194535383","submission_id_v1":"s747731769","cpu_time_v0":29,"cpu_time_v1":17,"memory_v0":4336,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.38,"input":"import datetime\n\n\n\ns = eval(input())\n\n\n\ninputDate = datetime.datetime.strptime(s, '%Y\/%m\/%d')\n\nlastDate = datetime.datetime.strptime('2019\/04\/30', '%Y\/%m\/%d')\n\n\n\nif inputDate > lastDate:\n\n print('TBD')\n\nelse:\n\n print('Heisei')\n","target":"s = eval(input())\n\nif s <= '2019\/04\/30':\n\n print('Heisei')\n\nelse:\n\n print('TBD')","code_v0_loc":11,"code_v1_loc":5,"code_v0_num_chars":227,"code_v1_num_chars":80,"code_v0_no_empty_lines":"import datetime\n\ns = eval(input())\ninputDate = datetime.datetime.strptime(s, \"%Y\/%m\/%d\")\nlastDate = datetime.datetime.strptime(\"2019\/04\/30\", \"%Y\/%m\/%d\")\nif inputDate > lastDate:\n print(\"TBD\")\nelse:\n print(\"Heisei\")\n","code_v1_no_empty_lines":"s = eval(input())\nif s <= \"2019\/04\/30\":\n print(\"Heisei\")\nelse:\n print(\"TBD\")\n","code_same":false,"relative_loc_diff_percent":54.5454545455,"diff":["-import datetime","-","-inputDate = datetime.datetime.strptime(s, \"%Y\/%m\/%d\")","-lastDate = datetime.datetime.strptime(\"2019\/04\/30\", \"%Y\/%m\/%d\")","-if inputDate > lastDate:","+if s <= \"2019\/04\/30\":","+ print(\"Heisei\")","+else:","-else:","- print(\"Heisei\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0444320609,"measured_runtime_v1":0.0376011267,"runtime_lift":1.1816683381,"key":["s194535383","s747731769"]} +{"user_id":"u520276780","problem_id":"p03241","language":"python","submission_id_v0":"s741052183","submission_id_v1":"s437266958","cpu_time_v0":172,"cpu_time_v1":21,"memory_v0":38640,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.79,"input":"import bisect\n\nn, m = list(map(int, input().split()))\n\n\n\nfct = []\n\nfct2 = []\n\nsq = int(m**(1\/2))\n\nif sq + 1 ==m:\n\n sq += 1\n\n\n\nfor f in range(1, sq + 1):\n\n if m%f == 0:\n\n fct.append(f)\n\n fct2.append(m\/\/f)\n\nif fct2[-1] == fct[-1]:\n\n fct2.pop()\n\n\n\nfct2.reverse()\n\n\n\nfct += fct2\n\n\n\nk = m\/\/n\n\nind = bisect.bisect_left(fct,k)\n\n\n\nprint((fct[ind-1] if k1:\n\n dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]))\n\n else:\n\n dp[i] = dp[i-1] + abs(h[i]-h[i-1])\n\nprint((dp[-1]))","target":"n = int(eval(input()))\n\nh = list(map(int,input().split()))\n\n\n\ndp = [0]*n\n\ndp[1] = abs(h[0]-h[1])\n\n\n\nfor i in range(2,n):\n\n dp[i] = min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]))\n\nprint((dp[-1]))","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":248,"code_v1_num_chars":197,"code_v0_no_empty_lines":"n = int(eval(input()))\nh = list(map(int, input().split()))\ndp = [0] * (n)\nfor i in range(1, n):\n if i > 1:\n dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))\n else:\n dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])\nprint((dp[-1]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nh = list(map(int, input().split()))\ndp = [0] * n\ndp[1] = abs(h[0] - h[1])\nfor i in range(2, n):\n dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-dp = [0] * (n)","-for i in range(1, n):","- if i > 1:","- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))","- else:","- dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])","+dp = [0] * n","+dp[1] = abs(h[0] - h[1])","+for i in range(2, n):","+ dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463600521,"measured_runtime_v1":0.0400893569,"runtime_lift":1.1564179544,"key":["s942184870","s219080770"]} +{"user_id":"u254871849","problem_id":"p03418","language":"python","submission_id_v0":"s219160463","submission_id_v1":"s251430656","cpu_time_v0":92,"cpu_time_v1":80,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.04,"input":"import sys\n\n\n\nn, k = list(map(int, sys.stdin.readline().split()))\n\n\n\ndef main():\n\n res = 0\n\n for b in range(k+1, n+1):\n\n q, r = divmod(n, b)\n\n res += q * (b - k) + max(0, r - (max(k, 1) - 1))\n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","target":"import sys\n\n\n\nn, k = list(map(int, sys.stdin.readline().split()))\n\n\n\ndef main():\n\n res = 0\n\n for b in range(k+1, n+1):\n\n q, r = divmod(n, b)\n\n res += q * (b - k) + max(0, r - (k - 1))\n\n if k == 0:\n\n res -= n - k\n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":14,"code_v1_loc":16,"code_v0_num_chars":285,"code_v1_num_chars":315,"code_v0_no_empty_lines":"import sys\n\nn, k = list(map(int, sys.stdin.readline().split()))\n\n\ndef main():\n res = 0\n for b in range(k + 1, n + 1):\n q, r = divmod(n, b)\n res += q * (b - k) + max(0, r - (max(k, 1) - 1))\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_v1_no_empty_lines":"import sys\n\nn, k = list(map(int, sys.stdin.readline().split()))\n\n\ndef main():\n res = 0\n for b in range(k + 1, n + 1):\n q, r = divmod(n, b)\n res += q * (b - k) + max(0, r - (k - 1))\n if k == 0:\n res -= n - k\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["- res += q * (b - k) + max(0, r - (max(k, 1) - 1))","+ res += q * (b - k) + max(0, r - (k - 1))","+ if k == 0:","+ res -= n - k"],"diff_only_import_comment":false,"measured_runtime_v0":0.0717837334,"measured_runtime_v1":0.0764219284,"runtime_lift":0.9393080606,"key":["s219160463","s251430656"]} +{"user_id":"u814986259","problem_id":"p03673","language":"python","submission_id_v0":"s248220648","submission_id_v1":"s133698674","cpu_time_v0":175,"cpu_time_v1":140,"memory_v0":29764,"memory_v1":32480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"N=int(eval(input()))\n\na=list(map(int,input().split()))\n\nb=[0]*N\n\nb[N\/\/2]=a[0]\n\nfor i in range(1,N\/\/2+1):\n\n b[N\/\/2-i]=a[i*2-1]\n\n if i != N\/\/2 or N%2==1:\n\n b[N\/\/2+i]=a[i*2]\n\nif N%2==1:\n\n b=b[::-1]\n\nprint((\" \".join(map(str,b))))\n\n ","target":"import collections\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\nb = collections.deque()\n\n\n\nflag = True\n\n\n\nfor x in a:\n\n if flag:\n\n b.append(x)\n\n flag = False\n\n else:\n\n b.appendleft(x)\n\n flag = True\n\nif flag:\n\n print((*b))\n\nelse:\n\n print((*list(b)[::-1]))\n","code_v0_loc":12,"code_v1_loc":18,"code_v0_num_chars":227,"code_v1_num_chars":302,"code_v0_no_empty_lines":"N = int(eval(input()))\na = list(map(int, input().split()))\nb = [0] * N\nb[N \/\/ 2] = a[0]\nfor i in range(1, N \/\/ 2 + 1):\n b[N \/\/ 2 - i] = a[i * 2 - 1]\n if i != N \/\/ 2 or N % 2 == 1:\n b[N \/\/ 2 + i] = a[i * 2]\nif N % 2 == 1:\n b = b[::-1]\nprint((\" \".join(map(str, b))))\n","code_v1_no_empty_lines":"import collections\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nb = collections.deque()\nflag = True\nfor x in a:\n if flag:\n b.append(x)\n flag = False\n else:\n b.appendleft(x)\n flag = True\nif flag:\n print((*b))\nelse:\n print((*list(b)[::-1]))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-N = int(eval(input()))","+import collections","+","+n = int(eval(input()))","-b = [0] * N","-b[N \/\/ 2] = a[0]","-for i in range(1, N \/\/ 2 + 1):","- b[N \/\/ 2 - i] = a[i * 2 - 1]","- if i != N \/\/ 2 or N % 2 == 1:","- b[N \/\/ 2 + i] = a[i * 2]","-if N % 2 == 1:","- b = b[::-1]","-print((\" \".join(map(str, b))))","+b = collections.deque()","+flag = True","+for x in a:","+ if flag:","+ b.append(x)","+ flag = False","+ else:","+ b.appendleft(x)","+ flag = True","+if flag:","+ print((*b))","+else:","+ print((*list(b)[::-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450194836,"measured_runtime_v1":0.0435502052,"runtime_lift":1.0337375752,"key":["s248220648","s133698674"]} +{"user_id":"u588794534","problem_id":"p02888","language":"python","submission_id_v0":"s374050749","submission_id_v1":"s790224468","cpu_time_v0":845,"cpu_time_v1":586,"memory_v0":44500,"memory_v1":74664,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.65,"input":"n=int(eval(input()))\n\nl=list(map(int,input().split()))\n\n\n\nl.sort()\n\nl.append(10**9)\n\ncnt=0\n\ni=0\n\n#print(l)\n\n\n\nwhile il[k] and l[i]+l[j]<=l[k+1]:\n\n cnt+=k-j\n\n break\n\n elif LL==RR:\n\n break\n\n elif l[i]+l[j]<=l[k]:\n\n RR=k\n\n elif l[i]+l[j]>l[k]:\n\n LL=k+1\n\n elif l[i]+l[j]a[j]\n\n #=>a[i]> a[k] >a[j]-a[i]\n\n\n\n ll= bisect.bisect_right(a, a[j]-a[i])\n\n\n\n rr= bisect.bisect_left(a, a[i])\n\n if a[rr+1]==a[i]:\n\n rr=i\n\n #print(a[i],a[j],\"|\",ll,rr,max(0,rr-ll))\n\n ans+=(max(0,rr-ll))\n\n\n\nprint(ans)\n\n\n\n\n","code_v0_loc":37,"code_v1_loc":31,"code_v0_num_chars":787,"code_v1_num_chars":677,"code_v0_no_empty_lines":"n = int(eval(input()))\nl = list(map(int, input().split()))\nl.sort()\nl.append(10**9)\ncnt = 0\ni = 0\n# print(l)\nwhile i < n - 2:\n j = i + 1\n while j < n - 1:\n LL = j + 1\n RR = n - 1\n # print(\"#\",l[i],l[j],l[LL],l[RR])\n while LL <= RR:\n k = (LL + RR) \/\/ 2\n if k == n:\n break\n # print(l)\n # print(i,j,LL,RR,k)\n # print(l[i]+l[j],l[k],l[k+1])\n if l[i] + l[j] > l[k] and l[i] + l[j] <= l[k + 1]:\n cnt += k - j\n break\n elif LL == RR:\n break\n elif l[i] + l[j] <= l[k]:\n RR = k\n elif l[i] + l[j] > l[k]:\n LL = k + 1\n elif l[i] + l[j] < l[k] and k == j + 1:\n break\n j += 1\n i += 1\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\na.sort()\nimport bisect\n\nans = 0\n# A=[1,2,3,4,5] #\u30bd\u30fc\u30c8\u6e08\u307f\n# index = bisect.bisect_left(A, 3) #2 \u540c\u3058\u6570\u5b57\u304c\u3042\u3063\u305f\u5834\u5408\u3001\u524d\u5074\u306e\u633f\u5165\u7b87\u6240\u304c\u8fd4\u3063\u3066\u304d\u3066\u3044\u308b\n# index = bisect.bisect_right(A, 3) # 3 \u540c\u3058\u6570\u5b57\u304c\u3042\u3063\u305f\u5834\u5408\u3001\u5f8c\u308d\u5074\u306e\u633f\u5165\u7b87\u6240\u304c\u8fd4\u3063\u3066\u304d\u3066\u3044\u308b\n# A.insert(index, 3) #\u633f\u5165\n# print(a)\nfor i in range(len(a) - 1):\n for j in range(i + 1, len(a)):\n # a[i]a[j]\n # =>a[i]> a[k] >a[j]-a[i]\n ll = bisect.bisect_right(a, a[j] - a[i])\n rr = bisect.bisect_left(a, a[i])\n if a[rr + 1] == a[i]:\n rr = i\n # print(a[i],a[j],\"|\",ll,rr,max(0,rr-ll))\n ans += max(0, rr - ll)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.2162162162,"diff":["-l = list(map(int, input().split()))","-l.sort()","-l.append(10**9)","-cnt = 0","-i = 0","-# print(l)","-while i < n - 2:","- j = i + 1","- while j < n - 1:","- LL = j + 1","- RR = n - 1","- # print(\"#\",l[i],l[j],l[LL],l[RR])","- while LL <= RR:","- k = (LL + RR) \/\/ 2","- if k == n:","- break","- # print(l)","- # print(i,j,LL,RR,k)","- # print(l[i]+l[j],l[k],l[k+1])","- if l[i] + l[j] > l[k] and l[i] + l[j] <= l[k + 1]:","- cnt += k - j","- break","- elif LL == RR:","- break","- elif l[i] + l[j] <= l[k]:","- RR = k","- elif l[i] + l[j] > l[k]:","- LL = k + 1","- elif l[i] + l[j] < l[k] and k == j + 1:","- break","- j += 1","- i += 1","-print(cnt)","+a = list(map(int, input().split()))","+a.sort()","+import bisect","+","+ans = 0","+# A=[1,2,3,4,5] #\u30bd\u30fc\u30c8\u6e08\u307f","+# index = bisect.bisect_left(A, 3) #2 \u540c\u3058\u6570\u5b57\u304c\u3042\u3063\u305f\u5834\u5408\u3001\u524d\u5074\u306e\u633f\u5165\u7b87\u6240\u304c\u8fd4\u3063\u3066\u304d\u3066\u3044\u308b","+# index = bisect.bisect_right(A, 3) # 3 \u540c\u3058\u6570\u5b57\u304c\u3042\u3063\u305f\u5834\u5408\u3001\u5f8c\u308d\u5074\u306e\u633f\u5165\u7b87\u6240\u304c\u8fd4\u3063\u3066\u304d\u3066\u3044\u308b","+# A.insert(index, 3) #\u633f\u5165","+# print(a)","+for i in range(len(a) - 1):","+ for j in range(i + 1, len(a)):","+ # a[i]a[j]","+ # =>a[i]> a[k] >a[j]-a[i]","+ ll = bisect.bisect_right(a, a[j] - a[i])","+ rr = bisect.bisect_left(a, a[i])","+ if a[rr + 1] == a[i]:","+ rr = i","+ # print(a[i],a[j],\"|\",ll,rr,max(0,rr-ll))","+ ans += max(0, rr - ll)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1518155971,"measured_runtime_v1":0.0382816448,"runtime_lift":3.9657542858,"key":["s374050749","s790224468"]} +{"user_id":"u408620326","problem_id":"p03634","language":"python","submission_id_v0":"s687060509","submission_id_v1":"s853103689","cpu_time_v0":1021,"cpu_time_v1":941,"memory_v0":197876,"memory_v1":190344,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.84,"input":"import sys\n\nfrom collections import deque\n\nsys.setrecursionlimit(10 ** 6)\n\ninput = sys.stdin.readline\n\nn = int(eval(input()))\n\nm = {}\n\nnp = [deque([]) for _ in range(n)]\n\nfor _ in range(n-1):\n\n a, b, c = [int(x) for x in input().strip().split()]\n\n m[(a, b)] = c\n\n m[(b, a)] = c\n\n np[a-1].append(b)\n\n np[b-1].append(a)\n\n\n\nq, k = [int(x) for x in input().strip().split()]\n\nmaster = [-1 for _ in range(n)]\n\nmaster[k-1] = 0\n\n\n\ndef dfs(cur, pre, master):\n\n #print('cur = {}, pre = {}'.format(cur, pre))\n\n for p in np[cur-1]:\n\n if p == pre:\n\n continue\n\n master[p-1] = master[cur-1] + m[(cur, p)]\n\n dfs(p, cur, master)\n\n\n\ndfs(k, -1, master)\n\n\n\nfor _ in range(q):\n\n x, y = [int(x) for x in input().strip().split()]\n\n print((master[x-1] + master[y-1]))","target":"import sys\n\nfrom collections import deque\n\nsys.setrecursionlimit(10 ** 6)\n\ninput = sys.stdin.readline\n\nN = int(eval(input()))\n\np = [deque([]) for _ in range(N)]\n\n\n\nfor i in range(N-1):\n\n a, b, c = [int(x) for x in input().strip().split()]\n\n p[a-1].append((b, c))\n\n p[b-1].append((a, c))\n\n\n\nQ, K = [int(x) for x in input().strip().split()]\n\n\n\nc = [-1] * N\n\nf = [False] * N\n\n\n\ndef search(cp, cost):\n\n f[cp-1] = True\n\n for np, cos in p[cp-1]:\n\n if f[np-1]:\n\n continue\n\n c[np-1] = cost + cos\n\n f[np-1] = True\n\n search(np, cost + cos)\n\n\n\nsearch(K, 0)\n\nfor q in range(Q):\n\n x, y = [int(x) for x in input().strip().split()]\n\n print((c[x-1]+c[y-1]))","code_v0_loc":31,"code_v1_loc":30,"code_v0_num_chars":794,"code_v1_num_chars":693,"code_v0_no_empty_lines":"import sys\nfrom collections import deque\n\nsys.setrecursionlimit(10**6)\ninput = sys.stdin.readline\nn = int(eval(input()))\nm = {}\nnp = [deque([]) for _ in range(n)]\nfor _ in range(n - 1):\n a, b, c = [int(x) for x in input().strip().split()]\n m[(a, b)] = c\n m[(b, a)] = c\n np[a - 1].append(b)\n np[b - 1].append(a)\nq, k = [int(x) for x in input().strip().split()]\nmaster = [-1 for _ in range(n)]\nmaster[k - 1] = 0\n\n\ndef dfs(cur, pre, master):\n # print('cur = {}, pre = {}'.format(cur, pre))\n for p in np[cur - 1]:\n if p == pre:\n continue\n master[p - 1] = master[cur - 1] + m[(cur, p)]\n dfs(p, cur, master)\n\n\ndfs(k, -1, master)\nfor _ in range(q):\n x, y = [int(x) for x in input().strip().split()]\n print((master[x - 1] + master[y - 1]))\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque\n\nsys.setrecursionlimit(10**6)\ninput = sys.stdin.readline\nN = int(eval(input()))\np = [deque([]) for _ in range(N)]\nfor i in range(N - 1):\n a, b, c = [int(x) for x in input().strip().split()]\n p[a - 1].append((b, c))\n p[b - 1].append((a, c))\nQ, K = [int(x) for x in input().strip().split()]\nc = [-1] * N\nf = [False] * N\n\n\ndef search(cp, cost):\n f[cp - 1] = True\n for np, cos in p[cp - 1]:\n if f[np - 1]:\n continue\n c[np - 1] = cost + cos\n f[np - 1] = True\n search(np, cost + cos)\n\n\nsearch(K, 0)\nfor q in range(Q):\n x, y = [int(x) for x in input().strip().split()]\n print((c[x - 1] + c[y - 1]))\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["-n = int(eval(input()))","-m = {}","-np = [deque([]) for _ in range(n)]","-for _ in range(n - 1):","+N = int(eval(input()))","+p = [deque([]) for _ in range(N)]","+for i in range(N - 1):","- m[(a, b)] = c","- m[(b, a)] = c","- np[a - 1].append(b)","- np[b - 1].append(a)","-q, k = [int(x) for x in input().strip().split()]","-master = [-1 for _ in range(n)]","-master[k - 1] = 0","+ p[a - 1].append((b, c))","+ p[b - 1].append((a, c))","+Q, K = [int(x) for x in input().strip().split()]","+c = [-1] * N","+f = [False] * N","-def dfs(cur, pre, master):","- # print('cur = {}, pre = {}'.format(cur, pre))","- for p in np[cur - 1]:","- if p == pre:","+def search(cp, cost):","+ f[cp - 1] = True","+ for np, cos in p[cp - 1]:","+ if f[np - 1]:","- master[p - 1] = master[cur - 1] + m[(cur, p)]","- dfs(p, cur, master)","+ c[np - 1] = cost + cos","+ f[np - 1] = True","+ search(np, cost + cos)","-dfs(k, -1, master)","-for _ in range(q):","+search(K, 0)","+for q in range(Q):","- print((master[x - 1] + master[y - 1]))","+ print((c[x - 1] + c[y - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0878011808,"measured_runtime_v1":0.0379467623,"runtime_lift":2.3137990026,"key":["s687060509","s853103689"]} +{"user_id":"u790012205","problem_id":"p02681","language":"python","submission_id_v0":"s272860475","submission_id_v1":"s539275325","cpu_time_v0":60,"cpu_time_v1":20,"memory_v0":61588,"memory_v1":9088,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.67,"input":"import sys\n\nS = eval(input())\n\nT = eval(input())\n\nif len(S) > len(T):\n\n print('No')\n\n sys.exit()\n\nT = T[:-1]\n\nif S == T:\n\n print('Yes')\n\nelse:\n\n print('No')","target":"S = eval(input())\n\nT = eval(input())\n\nif S == T[:-1]:\n\n print('Yes')\n\nelse:\n\n print('No')","code_v0_loc":11,"code_v1_loc":6,"code_v0_num_chars":156,"code_v1_num_chars":83,"code_v0_no_empty_lines":"import sys\n\nS = eval(input())\nT = eval(input())\nif len(S) > len(T):\n print(\"No\")\n sys.exit()\nT = T[:-1]\nif S == T:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"S = eval(input())\nT = eval(input())\nif S == T[:-1]:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-import sys","-","-if len(S) > len(T):","- print(\"No\")","- sys.exit()","-T = T[:-1]","-if S == T:","+if S == T[:-1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0411197116,"measured_runtime_v1":0.0401626034,"runtime_lift":1.0238308319,"key":["s272860475","s539275325"]} +{"user_id":"u796942881","problem_id":"p03761","language":"python","submission_id_v0":"s177270307","submission_id_v1":"s862471678","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"from collections import defaultdict\n\n\n\n\n\nINF=int(1e9+7)\n\n\n\n\n\ndef main():\n\n Sn = list(open(0).read().split()[1:])\n\n d = defaultdict(lambda: INF)\n\n for Si in Sn:\n\n for i in range(26):\n\n d[i] = min(d[i], Si.count(chr(ord(\"a\") + i)))\n\n for i in range(26):\n\n if d[i] == INF:\n\n continue\n\n print(chr(ord(\"a\") + i) * d[i], end=\"\")\n\n\n\n\n\nmain()\n","target":"INF=int(1e9+7)\n\n\n\n\n\ndef main():\n\n Sn = list(open(0).read().split()[1:])\n\n for i in range(26):\n\n cnt = INF\n\n for Si in Sn:\n\n cnt = min(cnt, Si.count(chr(ord(\"a\") + i)))\n\n if cnt == INF:\n\n continue\n\n print(chr(ord(\"a\") + i) * cnt, end=\"\")\n\n\n\n\n\nmain()\n","code_v0_loc":19,"code_v1_loc":15,"code_v0_num_chars":383,"code_v1_num_chars":305,"code_v0_no_empty_lines":"from collections import defaultdict\n\nINF = int(1e9 + 7)\n\n\ndef main():\n Sn = list(open(0).read().split()[1:])\n d = defaultdict(lambda: INF)\n for Si in Sn:\n for i in range(26):\n d[i] = min(d[i], Si.count(chr(ord(\"a\") + i)))\n for i in range(26):\n if d[i] == INF:\n continue\n print(chr(ord(\"a\") + i) * d[i], end=\"\")\n\n\nmain()\n","code_v1_no_empty_lines":"INF = int(1e9 + 7)\n\n\ndef main():\n Sn = list(open(0).read().split()[1:])\n for i in range(26):\n cnt = INF\n for Si in Sn:\n cnt = min(cnt, Si.count(chr(ord(\"a\") + i)))\n if cnt == INF:\n continue\n print(chr(ord(\"a\") + i) * cnt, end=\"\")\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":21.0526315789,"diff":["-from collections import defaultdict","-","- d = defaultdict(lambda: INF)","- for Si in Sn:","- for i in range(26):","- d[i] = min(d[i], Si.count(chr(ord(\"a\") + i)))","- if d[i] == INF:","+ cnt = INF","+ for Si in Sn:","+ cnt = min(cnt, Si.count(chr(ord(\"a\") + i)))","+ if cnt == INF:","- print(chr(ord(\"a\") + i) * d[i], end=\"\")","+ print(chr(ord(\"a\") + i) * cnt, end=\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0342481283,"measured_runtime_v1":0.0365639196,"runtime_lift":0.9366645753,"key":["s177270307","s862471678"]} +{"user_id":"u251515715","problem_id":"p03338","language":"python","submission_id_v0":"s456217931","submission_id_v1":"s295196278","cpu_time_v0":22,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"n,s = int(eval(input())),eval(input())\n\ntmp=[]\n\nfor i in range(1,n):\n\n cnt = 0\n\n for j in list(set(s[:i])):\n\n if j in list(set(s[i:])):\n\n cnt += 1\n\n tmp.append(cnt)\n\nprint((max(tmp)))","target":"n,s = int(eval(input())),eval(input())\n\ntmp=[]\n\nfor i in range(1,n):\n\n tmp.append(len(list(set(s[:i])&set(s[i:]))))\n\nprint((max(tmp)))","code_v0_loc":9,"code_v1_loc":5,"code_v0_num_chars":180,"code_v1_num_chars":121,"code_v0_no_empty_lines":"n, s = int(eval(input())), eval(input())\ntmp = []\nfor i in range(1, n):\n cnt = 0\n for j in list(set(s[:i])):\n if j in list(set(s[i:])):\n cnt += 1\n tmp.append(cnt)\nprint((max(tmp)))\n","code_v1_no_empty_lines":"n, s = int(eval(input())), eval(input())\ntmp = []\nfor i in range(1, n):\n tmp.append(len(list(set(s[:i]) & set(s[i:]))))\nprint((max(tmp)))\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["- cnt = 0","- for j in list(set(s[:i])):","- if j in list(set(s[i:])):","- cnt += 1","- tmp.append(cnt)","+ tmp.append(len(list(set(s[:i]) & set(s[i:]))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0086203432,"measured_runtime_v1":0.0325514975,"runtime_lift":0.2648217096,"key":["s456217931","s295196278"]} +{"user_id":"u328364772","problem_id":"p03665","language":"python","submission_id_v0":"s168174352","submission_id_v1":"s808711573","cpu_time_v0":23,"cpu_time_v1":17,"memory_v0":3572,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.09,"input":"from operator import mul\n\nfrom functools import reduce\n\n\n\nn, p = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\neven = 0\n\nodd = 0\n\nfor a in A:\n\n if a % 2 == 0:\n\n even += 1\n\n else:\n\n odd += 1\n\n\n\n\n\ndef cmb(n, r):\n\n r = min(n-r, r)\n\n if r == 0:\n\n return 1\n\n over = reduce(mul, list(range(n, n - r, -1)))\n\n under = reduce(mul, list(range(1, r + 1)))\n\n return over \/\/ under\n\n\n\n\n\nans = 2**even\n\ncnt = 0\n\nif p == 0:\n\n for i in range(0, odd+1, 2):\n\n cnt += cmb(odd, i)\n\nelse:\n\n for i in range(1, odd+1, 2):\n\n cnt += cmb(odd, i)\n\n\n\nprint((ans*cnt))\n","target":"n, p = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\nodd = False\n\nfor a in A:\n\n if a % 2 == 1:\n\n odd = True\n\n break\n\n\n\nif odd:\n\n print((2**(n-1)))\n\nelif p == 0:\n\n print((2**n))\n\nelse:\n\n print((0))\n","code_v0_loc":34,"code_v1_loc":15,"code_v0_num_chars":607,"code_v1_num_chars":237,"code_v0_no_empty_lines":"from operator import mul\nfrom functools import reduce\n\nn, p = list(map(int, input().split()))\nA = list(map(int, input().split()))\neven = 0\nodd = 0\nfor a in A:\n if a % 2 == 0:\n even += 1\n else:\n odd += 1\n\n\ndef cmb(n, r):\n r = min(n - r, r)\n if r == 0:\n return 1\n over = reduce(mul, list(range(n, n - r, -1)))\n under = reduce(mul, list(range(1, r + 1)))\n return over \/\/ under\n\n\nans = 2**even\ncnt = 0\nif p == 0:\n for i in range(0, odd + 1, 2):\n cnt += cmb(odd, i)\nelse:\n for i in range(1, odd + 1, 2):\n cnt += cmb(odd, i)\nprint((ans * cnt))\n","code_v1_no_empty_lines":"n, p = list(map(int, input().split()))\nA = list(map(int, input().split()))\nodd = False\nfor a in A:\n if a % 2 == 1:\n odd = True\n break\nif odd:\n print((2 ** (n - 1)))\nelif p == 0:\n print((2**n))\nelse:\n print((0))\n","code_same":false,"relative_loc_diff_percent":55.8823529412,"diff":["-from operator import mul","-from functools import reduce","-","-even = 0","-odd = 0","+odd = False","- if a % 2 == 0:","- even += 1","- else:","- odd += 1","-","-","-def cmb(n, r):","- r = min(n - r, r)","- if r == 0:","- return 1","- over = reduce(mul, list(range(n, n - r, -1)))","- under = reduce(mul, list(range(1, r + 1)))","- return over \/\/ under","-","-","-ans = 2**even","-cnt = 0","-if p == 0:","- for i in range(0, odd + 1, 2):","- cnt += cmb(odd, i)","+ if a % 2 == 1:","+ odd = True","+ break","+if odd:","+ print((2 ** (n - 1)))","+elif p == 0:","+ print((2**n))","- for i in range(1, odd + 1, 2):","- cnt += cmb(odd, i)","-print((ans * cnt))","+ print((0))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0423575294,"measured_runtime_v1":0.0422903531,"runtime_lift":1.0015884552,"key":["s168174352","s808711573"]} +{"user_id":"u556589653","problem_id":"p03456","language":"python","submission_id_v0":"s734919162","submission_id_v1":"s984225597","cpu_time_v0":163,"cpu_time_v1":20,"memory_v0":38256,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.73,"input":"import math\n\na,b = input().split()\n\nS = a+b\n\nK = int(S)\n\nif math.sqrt(K) %1 == 0:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","target":"import math\n\ns,t = input().split()\n\nN = int(s+t)\n\nif (N**0.5)%1 == 0:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":119,"code_v1_num_chars":111,"code_v0_no_empty_lines":"import math\n\na, b = input().split()\nS = a + b\nK = int(S)\nif math.sqrt(K) % 1 == 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"import math\n\ns, t = input().split()\nN = int(s + t)\nif (N**0.5) % 1 == 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-a, b = input().split()","-S = a + b","-K = int(S)","-if math.sqrt(K) % 1 == 0:","+s, t = input().split()","+N = int(s + t)","+if (N**0.5) % 1 == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0452194486,"measured_runtime_v1":0.0438994064,"runtime_lift":1.0300697032,"key":["s734919162","s984225597"]} +{"user_id":"u190079347","problem_id":"p03331","language":"python","submission_id_v0":"s503083950","submission_id_v1":"s705548856","cpu_time_v0":355,"cpu_time_v1":263,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.92,"input":"n = int(eval(input()))\n\nmn = float(\"inf\")\n\nfor i in range(1,n):\n\n count = 0\n\n for s in str(i):\n\n count += int(s)\n\n for p in str(n-i):\n\n count += int(p)\n\n if count < mn:\n\n mn = count\n\nprint(mn)","target":"n = int(eval(input()))\n\nmn = float(\"inf\")\n\nfor i in range(1,n):\n\n if sum(map(int,str(i))) + sum(map(int,str(n-i))) < mn:\n\n mn = sum(map(int,str(i))) + sum(map(int,str(n-i)))\n\nprint(mn)","code_v0_loc":11,"code_v1_loc":6,"code_v0_num_chars":199,"code_v1_num_chars":182,"code_v0_no_empty_lines":"n = int(eval(input()))\nmn = float(\"inf\")\nfor i in range(1, n):\n count = 0\n for s in str(i):\n count += int(s)\n for p in str(n - i):\n count += int(p)\n if count < mn:\n mn = count\nprint(mn)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nmn = float(\"inf\")\nfor i in range(1, n):\n if sum(map(int, str(i))) + sum(map(int, str(n - i))) < mn:\n mn = sum(map(int, str(i))) + sum(map(int, str(n - i)))\nprint(mn)\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["- count = 0","- for s in str(i):","- count += int(s)","- for p in str(n - i):","- count += int(p)","- if count < mn:","- mn = count","+ if sum(map(int, str(i))) + sum(map(int, str(n - i))) < mn:","+ mn = sum(map(int, str(i))) + sum(map(int, str(n - i)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5772359773,"measured_runtime_v1":0.2481139993,"runtime_lift":2.3264949941,"key":["s503083950","s705548856"]} +{"user_id":"u190873802","problem_id":"p03075","language":"python","submission_id_v0":"s157198571","submission_id_v1":"s646785075","cpu_time_v0":27,"cpu_time_v1":24,"memory_v0":9044,"memory_v1":9164,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"# coding: utf-8\n\n# Your code here!\n\na=int(eval(input()))\n\nb=int(eval(input()))\n\nc=int(eval(input()))\n\nd=int(eval(input()))\n\ne=int(eval(input()))\n\nk=int(eval(input()))\n\nif e-a<=k:\n\n print(\"Yay!\")\n\nelse:\n\n print(\":(\")","target":"# coding: utf-8\n\na=int(eval(input()))\n\nb=int(eval(input()))\n\nc=int(eval(input()))\n\nd=int(eval(input()))\n\ne=int(eval(input()))\n\nk=int(eval(input()))\n\n\n\nif e-a>k:\n\n print(\":(\")\n\nelse:\n\n print(\"Yay!\")\n\n\n\n\n","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":185,"code_v1_num_chars":172,"code_v0_no_empty_lines":"# coding: utf-8\n# Your code here!\na = int(eval(input()))\nb = int(eval(input()))\nc = int(eval(input()))\nd = int(eval(input()))\ne = int(eval(input()))\nk = int(eval(input()))\nif e - a <= k:\n print(\"Yay!\")\nelse:\n print(\":(\")\n","code_v1_no_empty_lines":"# coding: utf-8\na = int(eval(input()))\nb = int(eval(input()))\nc = int(eval(input()))\nd = int(eval(input()))\ne = int(eval(input()))\nk = int(eval(input()))\nif e - a > k:\n print(\":(\")\nelse:\n print(\"Yay!\")\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-# Your code here!","-if e - a <= k:","+if e - a > k:","+ print(\":(\")","+else:","-else:","- print(\":(\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0379431055,"measured_runtime_v1":0.037215495,"runtime_lift":1.0195512761,"key":["s157198571","s646785075"]} +{"user_id":"u040298438","problem_id":"p02888","language":"python","submission_id_v0":"s077052041","submission_id_v1":"s694412508","cpu_time_v0":826,"cpu_time_v1":656,"memory_v0":9632,"memory_v1":9544,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.58,"input":"from collections import deque\n\nfrom bisect import bisect_left\n\n\n\nn = int(eval(input()))\n\nl = sorted(map(int, input().split()))\n\nld = deque(l)\n\ncnt = 0\n\nfor a in range(n - 2):\n\n l_a = ld.popleft()\n\n for b in range(a + 1, n - 1):\n\n cnt += bisect_left(l, l_a + l[b]) - b - 1\n\nprint(cnt)","target":"def main():\n\n from collections import deque\n\n from bisect import bisect_left\n\n\n\n n = int(eval(input()))\n\n l = sorted(map(int, input().split()))\n\n ld = deque(l)\n\n cnt = 0\n\n for a in range(n - 2):\n\n l_a = ld.popleft()\n\n for b in range(a + 1, n - 1):\n\n cnt += bisect_left(l, l_a + l[b]) - b - 1\n\n print(cnt)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":12,"code_v1_loc":17,"code_v0_num_chars":290,"code_v1_num_chars":391,"code_v0_no_empty_lines":"from collections import deque\nfrom bisect import bisect_left\n\nn = int(eval(input()))\nl = sorted(map(int, input().split()))\nld = deque(l)\ncnt = 0\nfor a in range(n - 2):\n l_a = ld.popleft()\n for b in range(a + 1, n - 1):\n cnt += bisect_left(l, l_a + l[b]) - b - 1\nprint(cnt)\n","code_v1_no_empty_lines":"def main():\n from collections import deque\n from bisect import bisect_left\n\n n = int(eval(input()))\n l = sorted(map(int, input().split()))\n ld = deque(l)\n cnt = 0\n for a in range(n - 2):\n l_a = ld.popleft()\n for b in range(a + 1, n - 1):\n cnt += bisect_left(l, l_a + l[b]) - b - 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["-from collections import deque","-from bisect import bisect_left","+def main():","+ from collections import deque","+ from bisect import bisect_left","-n = int(eval(input()))","-l = sorted(map(int, input().split()))","-ld = deque(l)","-cnt = 0","-for a in range(n - 2):","- l_a = ld.popleft()","- for b in range(a + 1, n - 1):","- cnt += bisect_left(l, l_a + l[b]) - b - 1","-print(cnt)","+ n = int(eval(input()))","+ l = sorted(map(int, input().split()))","+ ld = deque(l)","+ cnt = 0","+ for a in range(n - 2):","+ l_a = ld.popleft()","+ for b in range(a + 1, n - 1):","+ cnt += bisect_left(l, l_a + l[b]) - b - 1","+ print(cnt)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.1070912168,"measured_runtime_v1":0.0407821176,"runtime_lift":2.6259356567,"key":["s077052041","s694412508"]} +{"user_id":"u794173881","problem_id":"p02599","language":"python","submission_id_v0":"s617632558","submission_id_v1":"s556350444","cpu_time_v0":1934,"cpu_time_v1":893,"memory_v0":263984,"memory_v1":205284,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.83,"input":"import sys\n\ninput = sys.stdin.buffer.readline\n\nfrom operator import itemgetter\n\n\n\n\n\nclass BIT:\n\n \"\"\"\u4e00\u70b9\u52a0\u7b97\u3001\u533a\u9593\u53d6\u5f97\u30af\u30a8\u30ea\u3092\u305d\u308c\u305e\u308cO(logN)\u3067\u7b54\u3048\u308b\u30c7\u30fc\u30bf\u69cb\u9020\"\"\"\n\n def __init__(self, n):\n\n self.size = n\n\n self.bit = [0] * (n + 1)\n\n\n\n def build(self, array):\n\n \"\"\"array\u3092\u521d\u671f\u5024\u3068\u3059\u308bBinaryIndexTree\u3092\u69cb\u7bc9\u3059\u308b O(N)\"\"\"\n\n for i in range(self.size):\n\n self.bit[i + 1] = array[i]\n\n for i in range(1, self.size):\n\n if i + (i & -i) > self.size:\n\n continue\n\n self.bit[i + (i & -i)] += self.bit[i]\n\n\n\n def _sum(self, i):\n\n s = 0\n\n while i > 0:\n\n s += self.bit[i]\n\n i -= i & -i\n\n return s\n\n\n\n def add(self, i, val):\n\n \"\"\"i\u756a\u76ee\u306e\u8981\u7d20\u306bval\u3092\u52a0\u3048\u308b\"\"\"\n\n i += 1\n\n while i <= self.size:\n\n self.bit[i] += val\n\n i += i & -i\n\n\n\n def get_sum(self, l, r):\n\n \"\"\"\u533a\u9593[l, r)\u306e\u548c\u3092\u6c42\u3081\u308b\"\"\"\n\n return self._sum(r) - self._sum(l)\n\n\n\n\n\nn, q = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\nquery = [list(map(int, input().split())) + [i] for i in range(q)]\n\n\n\n\n\nbit = BIT(n)\n\nmemo = {}\n\nans = [0] * q\n\nquery = sorted(query, key=itemgetter(1))\n\nind = 0\n\n\n\nfor l, r, i in query:\n\n while ind < r:\n\n if c[ind] in memo:\n\n old_ind = memo[c[ind]]\n\n else:\n\n old_ind = -1\n\n memo[c[ind]] = ind\n\n bit.add(ind, 1)\n\n if old_ind != -1:\n\n bit.add(old_ind, -1)\n\n ind += 1\n\n ans[i] = bit.get_sum(l - 1, r)\n\n\n\nprint((\"\\n\".join(map(str, ans))))","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\nfrom operator import itemgetter\n\n\n\n\n\nclass BIT:\n\n \"\"\"\u4e00\u70b9\u52a0\u7b97\u3001\u533a\u9593\u53d6\u5f97\u30af\u30a8\u30ea\u3092\u305d\u308c\u305e\u308cO(logN)\u3067\u7b54\u3048\u308b\u30c7\u30fc\u30bf\u69cb\u9020\"\"\"\n\n def __init__(self, n):\n\n self.size = n\n\n self.bit = [0] * (n + 1)\n\n\n\n def build(self, array):\n\n \"\"\"array\u3092\u521d\u671f\u5024\u3068\u3059\u308bBinaryIndexTree\u3092\u69cb\u7bc9\u3059\u308b O(N)\"\"\"\n\n for i in range(self.size):\n\n self.bit[i + 1] = array[i]\n\n for i in range(1, self.size):\n\n if i + (i & -i) > self.size:\n\n continue\n\n self.bit[i + (i & -i)] += self.bit[i]\n\n\n\n def _sum(self, i):\n\n s = 0\n\n while i > 0:\n\n s += self.bit[i]\n\n i -= i & -i\n\n return s\n\n\n\n def add(self, i, val):\n\n \"\"\"i\u756a\u76ee\u306e\u8981\u7d20\u306bval\u3092\u52a0\u3048\u308b\"\"\"\n\n i += 1\n\n while i <= self.size:\n\n self.bit[i] += val\n\n i += i & -i\n\n\n\n def get_sum(self, l, r):\n\n \"\"\"\u533a\u9593[l, r)\u306e\u548c\u3092\u6c42\u3081\u308b\"\"\"\n\n return self._sum(r) - self._sum(l)\n\n\n\n\n\nn, q = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\nquery = []\n\nOFFSET = 10 ** 6\n\nfor i in range(q):\n\n l, r = list(map(int, input().split()))\n\n query.append(i + OFFSET * l + OFFSET * OFFSET * r)\n\n\n\n\n\nbit = BIT(n)\n\nmemo = {}\n\nans = [0] * q\n\nquery.sort()\n\nind = 0\n\n\n\nfor tmp in query:\n\n i = tmp % OFFSET\n\n l = (tmp \/\/ OFFSET) % OFFSET\n\n r = tmp \/\/ (OFFSET * OFFSET)\n\n while ind < r:\n\n if c[ind] in memo:\n\n old_ind = memo[c[ind]]\n\n else:\n\n old_ind = -1\n\n memo[c[ind]] = ind\n\n bit.add(ind, 1)\n\n if old_ind != -1:\n\n bit.add(old_ind, -1)\n\n ind += 1\n\n ans[i] = bit.get_sum(l - 1, r)\n\n\n\nprint((\"\\n\".join(map(str, ans))))\n","code_v0_loc":64,"code_v1_loc":71,"code_v0_num_chars":1538,"code_v1_num_chars":1674,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nfrom operator import itemgetter\n\n\nclass BIT:\n \"\"\"\u4e00\u70b9\u52a0\u7b97\u3001\u533a\u9593\u53d6\u5f97\u30af\u30a8\u30ea\u3092\u305d\u308c\u305e\u308cO(logN)\u3067\u7b54\u3048\u308b\u30c7\u30fc\u30bf\u69cb\u9020\"\"\"\n\n def __init__(self, n):\n self.size = n\n self.bit = [0] * (n + 1)\n\n def build(self, array):\n \"\"\"array\u3092\u521d\u671f\u5024\u3068\u3059\u308bBinaryIndexTree\u3092\u69cb\u7bc9\u3059\u308b O(N)\"\"\"\n for i in range(self.size):\n self.bit[i + 1] = array[i]\n for i in range(1, self.size):\n if i + (i & -i) > self.size:\n continue\n self.bit[i + (i & -i)] += self.bit[i]\n\n def _sum(self, i):\n s = 0\n while i > 0:\n s += self.bit[i]\n i -= i & -i\n return s\n\n def add(self, i, val):\n \"\"\"i\u756a\u76ee\u306e\u8981\u7d20\u306bval\u3092\u52a0\u3048\u308b\"\"\"\n i += 1\n while i <= self.size:\n self.bit[i] += val\n i += i & -i\n\n def get_sum(self, l, r):\n \"\"\"\u533a\u9593[l, r)\u306e\u548c\u3092\u6c42\u3081\u308b\"\"\"\n return self._sum(r) - self._sum(l)\n\n\nn, q = list(map(int, input().split()))\nc = list(map(int, input().split()))\nquery = [list(map(int, input().split())) + [i] for i in range(q)]\nbit = BIT(n)\nmemo = {}\nans = [0] * q\nquery = sorted(query, key=itemgetter(1))\nind = 0\nfor l, r, i in query:\n while ind < r:\n if c[ind] in memo:\n old_ind = memo[c[ind]]\n else:\n old_ind = -1\n memo[c[ind]] = ind\n bit.add(ind, 1)\n if old_ind != -1:\n bit.add(old_ind, -1)\n ind += 1\n ans[i] = bit.get_sum(l - 1, r)\nprint((\"\\n\".join(map(str, ans))))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nfrom operator import itemgetter\n\n\nclass BIT:\n \"\"\"\u4e00\u70b9\u52a0\u7b97\u3001\u533a\u9593\u53d6\u5f97\u30af\u30a8\u30ea\u3092\u305d\u308c\u305e\u308cO(logN)\u3067\u7b54\u3048\u308b\u30c7\u30fc\u30bf\u69cb\u9020\"\"\"\n\n def __init__(self, n):\n self.size = n\n self.bit = [0] * (n + 1)\n\n def build(self, array):\n \"\"\"array\u3092\u521d\u671f\u5024\u3068\u3059\u308bBinaryIndexTree\u3092\u69cb\u7bc9\u3059\u308b O(N)\"\"\"\n for i in range(self.size):\n self.bit[i + 1] = array[i]\n for i in range(1, self.size):\n if i + (i & -i) > self.size:\n continue\n self.bit[i + (i & -i)] += self.bit[i]\n\n def _sum(self, i):\n s = 0\n while i > 0:\n s += self.bit[i]\n i -= i & -i\n return s\n\n def add(self, i, val):\n \"\"\"i\u756a\u76ee\u306e\u8981\u7d20\u306bval\u3092\u52a0\u3048\u308b\"\"\"\n i += 1\n while i <= self.size:\n self.bit[i] += val\n i += i & -i\n\n def get_sum(self, l, r):\n \"\"\"\u533a\u9593[l, r)\u306e\u548c\u3092\u6c42\u3081\u308b\"\"\"\n return self._sum(r) - self._sum(l)\n\n\nn, q = list(map(int, input().split()))\nc = list(map(int, input().split()))\nquery = []\nOFFSET = 10**6\nfor i in range(q):\n l, r = list(map(int, input().split()))\n query.append(i + OFFSET * l + OFFSET * OFFSET * r)\nbit = BIT(n)\nmemo = {}\nans = [0] * q\nquery.sort()\nind = 0\nfor tmp in query:\n i = tmp % OFFSET\n l = (tmp \/\/ OFFSET) % OFFSET\n r = tmp \/\/ (OFFSET * OFFSET)\n while ind < r:\n if c[ind] in memo:\n old_ind = memo[c[ind]]\n else:\n old_ind = -1\n memo[c[ind]] = ind\n bit.add(ind, 1)\n if old_ind != -1:\n bit.add(old_ind, -1)\n ind += 1\n ans[i] = bit.get_sum(l - 1, r)\nprint((\"\\n\".join(map(str, ans))))\n","code_same":false,"relative_loc_diff_percent":9.8591549296,"diff":["-query = [list(map(int, input().split())) + [i] for i in range(q)]","+query = []","+OFFSET = 10**6","+for i in range(q):","+ l, r = list(map(int, input().split()))","+ query.append(i + OFFSET * l + OFFSET * OFFSET * r)","-query = sorted(query, key=itemgetter(1))","+query.sort()","-for l, r, i in query:","+for tmp in query:","+ i = tmp % OFFSET","+ l = (tmp \/\/ OFFSET) % OFFSET","+ r = tmp \/\/ (OFFSET * OFFSET)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1402318174,"measured_runtime_v1":0.2580259273,"runtime_lift":0.5434795598,"key":["s617632558","s556350444"]} +{"user_id":"u646244131","problem_id":"p02678","language":"python","submission_id_v0":"s326030644","submission_id_v1":"s298540287","cpu_time_v0":807,"cpu_time_v1":717,"memory_v0":48928,"memory_v1":48924,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.15,"input":"n, m = list(map(int,input().split()))\n\nli = [[] for i in range(n)]\n\nfor i in range(m):\n\n a, b = list(map(int,input().split()))\n\n li[a-1].append(b-1)\n\n li[b-1].append(a-1)\n\nsign = {0: 0}\n\nstep = {0: 1}\n\nnow = {0}\n\nflg = False\n\nwhile len(now) > 0:\n\n if flg:\n\n print('No')\n\n exit()\n\n flg = True\n\n next = set()\n\n for i in now:\n\n for j in li[i]:\n\n if not j in sign:\n\n sign[j] = i\n\n step[j] = step[i] + 1\n\n next.add(j)\n\n flg = False\n\n now.clear()\n\n now = next\n\n\n\nprint('Yes')\n\nfor i in range(n - 1):\n\n print((sign[i + 1] + 1))","target":"n, m = list(map(int,input().split()))\n\nli = [[] for i in range(n)]\n\nfor i in range(m):\n\n a, b = list(map(int,input().split()))\n\n li[a-1].append(b-1)\n\n li[b-1].append(a-1)\n\nsign = {0: 0}\n\nstep = {0: 0}\n\nnow = {0}\n\n \n\nwhile len(now) > 0:\n\n next = set()\n\n for i in now:\n\n for j in li[i]:\n\n if not j in sign:\n\n sign[j] = i\n\n step[j] = step[i] + 1\n\n next.add(j)\n\n now.clear()\n\n now = next\n\n \n\nprint('Yes')\n\nfor i in range(n - 1):\n\n print((sign[i + 1] + 1))","code_v0_loc":29,"code_v1_loc":24,"code_v0_num_chars":628,"code_v1_num_chars":524,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nli = [[] for i in range(n)]\nfor i in range(m):\n a, b = list(map(int, input().split()))\n li[a - 1].append(b - 1)\n li[b - 1].append(a - 1)\nsign = {0: 0}\nstep = {0: 1}\nnow = {0}\nflg = False\nwhile len(now) > 0:\n if flg:\n print(\"No\")\n exit()\n flg = True\n next = set()\n for i in now:\n for j in li[i]:\n if not j in sign:\n sign[j] = i\n step[j] = step[i] + 1\n next.add(j)\n flg = False\n now.clear()\n now = next\nprint(\"Yes\")\nfor i in range(n - 1):\n print((sign[i + 1] + 1))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nli = [[] for i in range(n)]\nfor i in range(m):\n a, b = list(map(int, input().split()))\n li[a - 1].append(b - 1)\n li[b - 1].append(a - 1)\nsign = {0: 0}\nstep = {0: 0}\nnow = {0}\nwhile len(now) > 0:\n next = set()\n for i in now:\n for j in li[i]:\n if not j in sign:\n sign[j] = i\n step[j] = step[i] + 1\n next.add(j)\n now.clear()\n now = next\nprint(\"Yes\")\nfor i in range(n - 1):\n print((sign[i + 1] + 1))\n","code_same":false,"relative_loc_diff_percent":17.2413793103,"diff":["-step = {0: 1}","+step = {0: 0}","-flg = False","- if flg:","- print(\"No\")","- exit()","- flg = True","- flg = False"],"diff_only_import_comment":false,"measured_runtime_v0":0.0384513811,"measured_runtime_v1":0.0368729878,"runtime_lift":1.0428062217,"key":["s326030644","s298540287"]} +{"user_id":"u150984829","problem_id":"p00424","language":"python","submission_id_v0":"s967314438","submission_id_v1":"s515543693","cpu_time_v0":290,"cpu_time_v1":140,"memory_v0":6484,"memory_v1":6472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.72,"input":"while 1:\n\n n=int(eval(input()))\n\n if n==0:break\n\n d={}\n\n for _ in[0]*n:\n\n k,v=input().strip().split()\n\n d[k]=v\n\n a=''\n\n for _ in[0]*int(eval(input())):\n\n e=input().strip()\n\n a+=d[e]if e in d else e\n\n print(a)\n","target":"import sys\n\ns=sys.stdin\n\nwhile 1:\n\n n=int(s.readline())\n\n if n==0:break\n\n d={}\n\n for _ in[0]*n:\n\n k,v=s.readline().strip().split()\n\n d[k]=v\n\n a=''\n\n for _ in[0]*int(s.readline()):\n\n e=s.readline().strip()\n\n a+=d[e]if e in d else e\n\n print(a)\n","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":201,"code_v1_num_chars":246,"code_v0_no_empty_lines":"while 1:\n n = int(eval(input()))\n if n == 0:\n break\n d = {}\n for _ in [0] * n:\n k, v = input().strip().split()\n d[k] = v\n a = \"\"\n for _ in [0] * int(eval(input())):\n e = input().strip()\n a += d[e] if e in d else e\n print(a)\n","code_v1_no_empty_lines":"import sys\n\ns = sys.stdin\nwhile 1:\n n = int(s.readline())\n if n == 0:\n break\n d = {}\n for _ in [0] * n:\n k, v = s.readline().strip().split()\n d[k] = v\n a = \"\"\n for _ in [0] * int(s.readline()):\n e = s.readline().strip()\n a += d[e] if e in d else e\n print(a)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+import sys","+","+s = sys.stdin","- n = int(eval(input()))","+ n = int(s.readline())","- k, v = input().strip().split()","+ k, v = s.readline().strip().split()","- for _ in [0] * int(eval(input())):","- e = input().strip()","+ for _ in [0] * int(s.readline()):","+ e = s.readline().strip()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0384619269,"measured_runtime_v1":0.0447183437,"runtime_lift":0.8600928325,"key":["s967314438","s515543693"]} +{"user_id":"u727148417","problem_id":"p04001","language":"python","submission_id_v0":"s628177841","submission_id_v1":"s978572978","cpu_time_v0":20,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"S = eval(input())\n\nn = len(S)\n\n\n\nans = 0\n\nfor bit in range(2**(n-1)):\n\n cand = []\n\n j = 0\n\n for i in range(n):\n\n if (bit >> i) & 1:\n\n cand.append(S[j:i+1])\n\n j = i + 1\n\n cand.append(S[j:])\n\n ans += sum(map(int, cand))\n\n #print(cand)\n\n\n\nprint(ans)","target":"def Recursion(S):\n\n list = []\n\n list.append(int(S))\n\n for i in range(len(S)-1):\n\n left = S[:i+1]\n\n right = S[i+1:]\n\n x = int(left)\n\n for y in Recursion(right):\n\n list.append(x + y)\n\n return list\n\n\n\nS = eval(input())\n\nprint((sum(Recursion(S))))\n","code_v0_loc":16,"code_v1_loc":13,"code_v0_num_chars":287,"code_v1_num_chars":287,"code_v0_no_empty_lines":"S = eval(input())\nn = len(S)\nans = 0\nfor bit in range(2 ** (n - 1)):\n cand = []\n j = 0\n for i in range(n):\n if (bit >> i) & 1:\n cand.append(S[j : i + 1])\n j = i + 1\n cand.append(S[j:])\n ans += sum(map(int, cand))\n # print(cand)\nprint(ans)\n","code_v1_no_empty_lines":"def Recursion(S):\n list = []\n list.append(int(S))\n for i in range(len(S) - 1):\n left = S[: i + 1]\n right = S[i + 1 :]\n x = int(left)\n for y in Recursion(right):\n list.append(x + y)\n return list\n\n\nS = eval(input())\nprint((sum(Recursion(S))))\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["+def Recursion(S):","+ list = []","+ list.append(int(S))","+ for i in range(len(S) - 1):","+ left = S[: i + 1]","+ right = S[i + 1 :]","+ x = int(left)","+ for y in Recursion(right):","+ list.append(x + y)","+ return list","+","+","-n = len(S)","-ans = 0","-for bit in range(2 ** (n - 1)):","- cand = []","- j = 0","- for i in range(n):","- if (bit >> i) & 1:","- cand.append(S[j : i + 1])","- j = i + 1","- cand.append(S[j:])","- ans += sum(map(int, cand))","- # print(cand)","-print(ans)","+print((sum(Recursion(S))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0471653461,"measured_runtime_v1":0.0487855911,"runtime_lift":0.9667884522,"key":["s628177841","s978572978"]} +{"user_id":"u633068244","problem_id":"p00445","language":"python","submission_id_v0":"s970979565","submission_id_v1":"s511355149","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4416,"memory_v1":4420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"while 1:\n\n\ttry:\n\n\t\ta=input()\n\n\t\tcjoi=cioi=0\n\n\t\tfor i in range(len(a)-2):\n\n\t\t\tif a[i:i+3]==\"JOI\":\n\n\t\t\t\tcjoi+=1\n\n\t\t\tif a[i:i+3]==\"IOI\":\n\n\t\t\t\tcioi+=1\n\n\t\tprint(cjoi)\n\n\t\tprint(cioi)\n\n\texcept:\n\n\t\tbreak\t\t","target":"while 1:\n\n\ttry:\n\n\t\ta=input()\n\n\t\tcjoi=cioi=0\n\n\t\tfor i in range(len(a)-2):\n\n\t\t\tif a[i]==\"J\" and a[i+1]==\"O\" and a[i+2]==\"I\":cjoi+=1\n\n\t\t\telif a[i]==\"I\" and a[i+1]==\"O\" and a[i+2]==\"I\":cioi+=1\n\n\t\tprint(cjoi)\n\n\t\tprint(cioi)\n\n\texcept:\n\n\t\tbreak\t\t","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":199,"code_v1_num_chars":243,"code_v0_no_empty_lines":"while 1:\n try:\n a = input()\n cjoi = cioi = 0\n for i in range(len(a) - 2):\n if a[i : i + 3] == \"JOI\":\n cjoi += 1\n if a[i : i + 3] == \"IOI\":\n cioi += 1\n print(cjoi)\n print(cioi)\n except:\n break\n","code_v1_no_empty_lines":"while 1:\n try:\n a = input()\n cjoi = cioi = 0\n for i in range(len(a) - 2):\n if a[i] == \"J\" and a[i + 1] == \"O\" and a[i + 2] == \"I\":\n cjoi += 1\n elif a[i] == \"I\" and a[i + 1] == \"O\" and a[i + 2] == \"I\":\n cioi += 1\n print(cjoi)\n print(cioi)\n except:\n break\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["- if a[i : i + 3] == \"JOI\":","+ if a[i] == \"J\" and a[i + 1] == \"O\" and a[i + 2] == \"I\":","- if a[i : i + 3] == \"IOI\":","+ elif a[i] == \"I\" and a[i + 1] == \"O\" and a[i + 2] == \"I\":"],"diff_only_import_comment":false,"measured_runtime_v0":0.0401031689,"measured_runtime_v1":0.0371134013,"runtime_lift":1.0805576293,"key":["s970979565","s511355149"]} +{"user_id":"u968166680","problem_id":"p02888","language":"python","submission_id_v0":"s426755726","submission_id_v1":"s343436092","cpu_time_v0":425,"cpu_time_v1":313,"memory_v0":74252,"memory_v1":74212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.35,"input":"import sys\n\nfrom bisect import bisect_left, bisect_right\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n\n\ndef main():\n\n N, *L = list(map(int, read().split()))\n\n\n\n L.sort()\n\n\n\n ans = 0\n\n for i in range(N):\n\n a = L[i]\n\n for j in range(i + 1, N):\n\n b = L[j]\n\n left = bisect_left(L, b, lo=j + 1)\n\n right = bisect_left(L, a + b, lo=j + 1)\n\n ans += right - left\n\n\n\n print(ans)\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nfrom bisect import bisect_left, bisect_right\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n\n\ndef main():\n\n N, *L = list(map(int, read().split()))\n\n\n\n L.sort()\n\n\n\n ans = 0\n\n for i, a in enumerate(L):\n\n for j, b in enumerate(L[i + 1 :], i + 1):\n\n k = bisect_left(L, a + b, lo=j + 1)\n\n ans += k - j - 1\n\n\n\n print(ans)\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":31,"code_v1_loc":28,"code_v0_num_chars":604,"code_v1_num_chars":532,"code_v0_no_empty_lines":"import sys\nfrom bisect import bisect_left, bisect_right\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N, *L = list(map(int, read().split()))\n L.sort()\n ans = 0\n for i in range(N):\n a = L[i]\n for j in range(i + 1, N):\n b = L[j]\n left = bisect_left(L, b, lo=j + 1)\n right = bisect_left(L, a + b, lo=j + 1)\n ans += right - left\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nfrom bisect import bisect_left, bisect_right\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N, *L = list(map(int, read().split()))\n L.sort()\n ans = 0\n for i, a in enumerate(L):\n for j, b in enumerate(L[i + 1 :], i + 1):\n k = bisect_left(L, a + b, lo=j + 1)\n ans += k - j - 1\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":9.6774193548,"diff":["- for i in range(N):","- a = L[i]","- for j in range(i + 1, N):","- b = L[j]","- left = bisect_left(L, b, lo=j + 1)","- right = bisect_left(L, a + b, lo=j + 1)","- ans += right - left","+ for i, a in enumerate(L):","+ for j, b in enumerate(L[i + 1 :], i + 1):","+ k = bisect_left(L, a + b, lo=j + 1)","+ ans += k - j - 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0379498117,"measured_runtime_v1":0.0904684589,"runtime_lift":0.4194811336,"key":["s426755726","s343436092"]} +{"user_id":"u281303342","problem_id":"p03329","language":"python","submission_id_v0":"s433352478","submission_id_v1":"s483227063","cpu_time_v0":171,"cpu_time_v1":157,"memory_v0":4596,"memory_v1":4596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.19,"input":"N = int(eval(input()))\n\n\n\ndp = [0]*(N+100001)\n\nfor i in range(99999):\n\n dp[i] = 10**10\n\n\n\nfor i in range(100000,N+100001):\n\n dp[i] = min(dp[i-1] + 1,\n\n dp[i-6] + 1,\n\n dp[i-9] + 1,\n\n dp[i-36] +1,\n\n dp[i-81] + 1,\n\n dp[i-216] + 1,\n\n dp[i-729] + 1,\n\n dp[i-1296] + 1,\n\n dp[i-6561] + 1,\n\n dp[i-7776] + 1,\n\n dp[i-46656] + 1,\n\n dp[i-59049] + 1)\n\n\n\nprint((dp[N+99999]))","target":"# Python3 (3.4.3)\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\n# -------------------------------------------------------------\n\n# function\n\n# -------------------------------------------------------------\n\n\n\n\n\n# -------------------------------------------------------------\n\n# main\n\n# -------------------------------------------------------------\n\nN = int(eval(input()))\n\n\n\n# dp[i+100000] : i \u5186\u3092\u5f15\u304d\u51fa\u3059\u306e\u306b\u5fc5\u8981\u306a\u6700\u5c0f\u56de\u6570 \n\ndp = [0]*(N+100010)\n\n# dp[99999] \u307e\u3067\u3092\u5927\u304d\u306a\u6570\u3067\u521d\u671f\u5316\u3057\u3066\u304a\u304f\n\nfor i in range(100000):\n\n dp[i] = 10**10\n\n\n\n# dp[100000] : 0\u5186\u3092\u5f15\u304d\u51fa\u3059\u306e\u306b\u5fc5\u8981\u306a\u6700\u5c0f\u56de\u6570 = 0 \u3067\u521d\u671f\u5316\u6e08\u307f\n\n# dp[100001] : 1\u5186\u3092\u5f15\u304d\u51fa\u3059\u306e\u306b\u5fc5\u8981\u306a\u6700\u5c0f\u56de\u6570 \u304b\u3089\u51e6\u7406\u3057\u3066\u3044\u304f\n\nfor i in range(100001,N+100010):\n\n dp[i] = min(dp[i-1] + 1,\n\n dp[i-6] + 1,\n\n dp[i-9] + 1,\n\n dp[i-36] +1,\n\n dp[i-81] + 1,\n\n dp[i-216] + 1,\n\n dp[i-729] + 1,\n\n dp[i-1296] + 1,\n\n dp[i-6561] + 1,\n\n dp[i-7776] + 1,\n\n dp[i-46656] + 1,\n\n dp[i-59049] + 1)\n\n \n\nprint((dp[N+100000]))","code_v0_loc":21,"code_v1_loc":37,"code_v0_num_chars":523,"code_v1_num_chars":1023,"code_v0_no_empty_lines":"N = int(eval(input()))\ndp = [0] * (N + 100001)\nfor i in range(99999):\n dp[i] = 10**10\nfor i in range(100000, N + 100001):\n dp[i] = min(\n dp[i - 1] + 1,\n dp[i - 6] + 1,\n dp[i - 9] + 1,\n dp[i - 36] + 1,\n dp[i - 81] + 1,\n dp[i - 216] + 1,\n dp[i - 729] + 1,\n dp[i - 1296] + 1,\n dp[i - 6561] + 1,\n dp[i - 7776] + 1,\n dp[i - 46656] + 1,\n dp[i - 59049] + 1,\n )\nprint((dp[N + 99999]))\n","code_v1_no_empty_lines":"# Python3 (3.4.3)\nimport sys\n\ninput = sys.stdin.readline\n# -------------------------------------------------------------\n# function\n# -------------------------------------------------------------\n# -------------------------------------------------------------\n# main\n# -------------------------------------------------------------\nN = int(eval(input()))\n# dp[i+100000] : i \u5186\u3092\u5f15\u304d\u51fa\u3059\u306e\u306b\u5fc5\u8981\u306a\u6700\u5c0f\u56de\u6570\ndp = [0] * (N + 100010)\n# dp[99999] \u307e\u3067\u3092\u5927\u304d\u306a\u6570\u3067\u521d\u671f\u5316\u3057\u3066\u304a\u304f\nfor i in range(100000):\n dp[i] = 10**10\n# dp[100000] : 0\u5186\u3092\u5f15\u304d\u51fa\u3059\u306e\u306b\u5fc5\u8981\u306a\u6700\u5c0f\u56de\u6570 = 0 \u3067\u521d\u671f\u5316\u6e08\u307f\n# dp[100001] : 1\u5186\u3092\u5f15\u304d\u51fa\u3059\u306e\u306b\u5fc5\u8981\u306a\u6700\u5c0f\u56de\u6570 \u304b\u3089\u51e6\u7406\u3057\u3066\u3044\u304f\nfor i in range(100001, N + 100010):\n dp[i] = min(\n dp[i - 1] + 1,\n dp[i - 6] + 1,\n dp[i - 9] + 1,\n dp[i - 36] + 1,\n dp[i - 81] + 1,\n dp[i - 216] + 1,\n dp[i - 729] + 1,\n dp[i - 1296] + 1,\n dp[i - 6561] + 1,\n dp[i - 7776] + 1,\n dp[i - 46656] + 1,\n dp[i - 59049] + 1,\n )\nprint((dp[N + 100000]))\n","code_same":false,"relative_loc_diff_percent":43.2432432432,"diff":["+# Python3 (3.4.3)","+import sys","+","+input = sys.stdin.readline","+# function","+# main","-dp = [0] * (N + 100001)","-for i in range(99999):","+# dp[i+100000] : i \u5186\u3092\u5f15\u304d\u51fa\u3059\u306e\u306b\u5fc5\u8981\u306a\u6700\u5c0f\u56de\u6570","+dp = [0] * (N + 100010)","+# dp[99999] \u307e\u3067\u3092\u5927\u304d\u306a\u6570\u3067\u521d\u671f\u5316\u3057\u3066\u304a\u304f","+for i in range(100000):","-for i in range(100000, N + 100001):","+# dp[100000] : 0\u5186\u3092\u5f15\u304d\u51fa\u3059\u306e\u306b\u5fc5\u8981\u306a\u6700\u5c0f\u56de\u6570 = 0 \u3067\u521d\u671f\u5316\u6e08\u307f","+# dp[100001] : 1\u5186\u3092\u5f15\u304d\u51fa\u3059\u306e\u306b\u5fc5\u8981\u306a\u6700\u5c0f\u56de\u6570 \u304b\u3089\u51e6\u7406\u3057\u3066\u3044\u304f","+for i in range(100001, N + 100010):","-print((dp[N + 99999]))","+print((dp[N + 100000]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0618579037,"measured_runtime_v1":0.0684133914,"runtime_lift":0.9041782974,"key":["s433352478","s483227063"]} +{"user_id":"u645250356","problem_id":"p02913","language":"python","submission_id_v0":"s142274300","submission_id_v1":"s028312421","cpu_time_v0":1449,"cpu_time_v1":1038,"memory_v0":258152,"memory_v1":76120,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.36,"input":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,pprint,fractions\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn = inp()\n\ns = eval(input())\n\ndp = [[0 for i in range(n+5)] for j in range(n+5)]\n\nres = 0\n\nfor i in range(n)[::-1]:\n\n for j in range(n)[::-1]:\n\n if i >= j: continue\n\n if s[i] == s[j]:\n\n dp[i][j] = dp[i+1][j+1] + 1\n\n else:\n\n dp[i][j] = 0\n\nfor i in range(n):\n\n for j in range(n):\n\n tmp = min(j-i, dp[i][j])\n\n res = max(res, tmp)\n\nprint(res)","target":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,fractions\n\nfrom decimal import Decimal\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\ndef z_algo(S):\n\n N = len(S)\n\n A = [0] * N\n\n i = 1; j = 0\n\n A[0] = l = N\n\n while i < l:\n\n while i+j < l and S[j] == S[i+j]:\n\n j += 1\n\n if not j:\n\n i += 1\n\n continue\n\n A[i] = j\n\n k = 1\n\n while l-i > k < j - A[k]:\n\n A[i+k] = A[k]\n\n k += 1\n\n i += k; j -= k\n\n return A\n\n\n\nn = inp()\n\ns = eval(input())\n\nres = 0\n\nfor i in range(n-1):\n\n a = z_algo(s[i:])\n\n ln = n-i\n\n for j,x in enumerate(a):\n\n tmp = min(j,x)\n\n res = max(res, tmp)\n\nprint(res)","code_v0_loc":25,"code_v1_loc":39,"code_v0_num_chars":718,"code_v1_num_chars":912,"code_v0_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, pprint, fractions\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = inp()\ns = eval(input())\ndp = [[0 for i in range(n + 5)] for j in range(n + 5)]\nres = 0\nfor i in range(n)[::-1]:\n for j in range(n)[::-1]:\n if i >= j:\n continue\n if s[i] == s[j]:\n dp[i][j] = dp[i + 1][j + 1] + 1\n else:\n dp[i][j] = 0\nfor i in range(n):\n for j in range(n):\n tmp = min(j - i, dp[i][j])\n res = max(res, tmp)\nprint(res)\n","code_v1_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, fractions\nfrom decimal import Decimal\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef z_algo(S):\n N = len(S)\n A = [0] * N\n i = 1\n j = 0\n A[0] = l = N\n while i < l:\n while i + j < l and S[j] == S[i + j]:\n j += 1\n if not j:\n i += 1\n continue\n A[i] = j\n k = 1\n while l - i > k < j - A[k]:\n A[i + k] = A[k]\n k += 1\n i += k\n j -= k\n return A\n\n\nn = inp()\ns = eval(input())\nres = 0\nfor i in range(n - 1):\n a = z_algo(s[i:])\n ln = n - i\n for j, x in enumerate(a):\n tmp = min(j, x)\n res = max(res, tmp)\nprint(res)\n","code_same":false,"relative_loc_diff_percent":35.8974358974,"diff":["-import sys, bisect, math, itertools, pprint, fractions","+import sys, bisect, math, itertools, fractions","+from decimal import Decimal","+def z_algo(S):","+ N = len(S)","+ A = [0] * N","+ i = 1","+ j = 0","+ A[0] = l = N","+ while i < l:","+ while i + j < l and S[j] == S[i + j]:","+ j += 1","+ if not j:","+ i += 1","+ continue","+ A[i] = j","+ k = 1","+ while l - i > k < j - A[k]:","+ A[i + k] = A[k]","+ k += 1","+ i += k","+ j -= k","+ return A","+","+","-dp = [[0 for i in range(n + 5)] for j in range(n + 5)]","-for i in range(n)[::-1]:","- for j in range(n)[::-1]:","- if i >= j:","- continue","- if s[i] == s[j]:","- dp[i][j] = dp[i + 1][j + 1] + 1","- else:","- dp[i][j] = 0","-for i in range(n):","- for j in range(n):","- tmp = min(j - i, dp[i][j])","+for i in range(n - 1):","+ a = z_algo(s[i:])","+ ln = n - i","+ for j, x in enumerate(a):","+ tmp = min(j, x)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369376323,"measured_runtime_v1":0.0609921954,"runtime_lift":0.605612441,"key":["s142274300","s028312421"]} +{"user_id":"u402547605","problem_id":"p02831","language":"python","submission_id_v0":"s219739792","submission_id_v1":"s511094318","cpu_time_v0":49,"cpu_time_v1":17,"memory_v0":5688,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.31,"input":"import fractions\n\na, b = list(map(int, input().split()))\n\nprint((a * b \/\/ fractions.gcd(a, b)))","target":"a, b = list(map(int, input().split()))\n\ndef gcd(x, y):\n\n x, y = max(x, y), min(x, y)\n\n if y == 0:\n\n return x\n\n return gcd(y, x % y)\n\n \n\nprint((a * b \/\/ gcd(a, b)))","code_v0_loc":3,"code_v1_loc":8,"code_v0_num_chars":87,"code_v1_num_chars":172,"code_v0_no_empty_lines":"import fractions\n\na, b = list(map(int, input().split()))\nprint((a * b \/\/ fractions.gcd(a, b)))\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\n\n\ndef gcd(x, y):\n x, y = max(x, y), min(x, y)\n if y == 0:\n return x\n return gcd(y, x % y)\n\n\nprint((a * b \/\/ gcd(a, b)))\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-import fractions","+a, b = list(map(int, input().split()))","-a, b = list(map(int, input().split()))","-print((a * b \/\/ fractions.gcd(a, b)))","+","+def gcd(x, y):","+ x, y = max(x, y), min(x, y)","+ if y == 0:","+ return x","+ return gcd(y, x % y)","+","+","+print((a * b \/\/ gcd(a, b)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1395747099,"measured_runtime_v1":0.0835541506,"runtime_lift":1.6704700952,"key":["s219739792","s511094318"]} +{"user_id":"u347640436","problem_id":"p02814","language":"python","submission_id_v0":"s959153059","submission_id_v1":"s147163378","cpu_time_v0":128,"cpu_time_v1":108,"memory_v0":16320,"memory_v1":16284,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.62,"input":"from sys import exit\n\nfrom fractions import gcd\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\na = A[0]\n\nn = 1\n\nwhile a % 2 == 0:\n\n n *= 2\n\n a \/\/= 2\n\n\n\nlcm = 1\n\nfor a in A:\n\n if a % n != 0 or a % (2 * n) == 0:\n\n print((0))\n\n exit()\n\n lcm = lcm * a \/\/ gcd(lcm, a)\n\n if lcm \/\/ 2 > M:\n\n print((0))\n\n exit()\n\n\n\nprint(((M - lcm \/\/ 2) \/\/ lcm + 1))\n","target":"def main():\n\n from fractions import gcd\n\n\n\n N, M = list(map(int, input().split()))\n\n A = list(map(int, input().split()))\n\n\n\n a = A[0]\n\n n = 1\n\n while a & 1 == 0:\n\n n <<= 1\n\n a >>= 1\n\n\n\n lcm = 1\n\n for a in A:\n\n if a % n != 0 or a % (2 * n) == 0:\n\n print((0))\n\n return\n\n lcm = lcm * a \/\/ gcd(lcm, a)\n\n if lcm > M * 2:\n\n print((0))\n\n return\n\n\n\n print(((M - lcm \/\/ 2) \/\/ lcm + 1))\n\n\n\n\n\nmain()\n","code_v0_loc":23,"code_v1_loc":26,"code_v0_num_chars":408,"code_v1_num_chars":483,"code_v0_no_empty_lines":"from sys import exit\nfrom fractions import gcd\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\na = A[0]\nn = 1\nwhile a % 2 == 0:\n n *= 2\n a \/\/= 2\nlcm = 1\nfor a in A:\n if a % n != 0 or a % (2 * n) == 0:\n print((0))\n exit()\n lcm = lcm * a \/\/ gcd(lcm, a)\n if lcm \/\/ 2 > M:\n print((0))\n exit()\nprint(((M - lcm \/\/ 2) \/\/ lcm + 1))\n","code_v1_no_empty_lines":"def main():\n from fractions import gcd\n\n N, M = list(map(int, input().split()))\n A = list(map(int, input().split()))\n a = A[0]\n n = 1\n while a & 1 == 0:\n n <<= 1\n a >>= 1\n lcm = 1\n for a in A:\n if a % n != 0 or a % (2 * n) == 0:\n print((0))\n return\n lcm = lcm * a \/\/ gcd(lcm, a)\n if lcm > M * 2:\n print((0))\n return\n print(((M - lcm \/\/ 2) \/\/ lcm + 1))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":11.5384615385,"diff":["-from sys import exit","-from fractions import gcd","+def main():","+ from fractions import gcd","-N, M = list(map(int, input().split()))","-A = list(map(int, input().split()))","-a = A[0]","-n = 1","-while a % 2 == 0:","- n *= 2","- a \/\/= 2","-lcm = 1","-for a in A:","- if a % n != 0 or a % (2 * n) == 0:","- print((0))","- exit()","- lcm = lcm * a \/\/ gcd(lcm, a)","- if lcm \/\/ 2 > M:","- print((0))","- exit()","-print(((M - lcm \/\/ 2) \/\/ lcm + 1))","+ N, M = list(map(int, input().split()))","+ A = list(map(int, input().split()))","+ a = A[0]","+ n = 1","+ while a & 1 == 0:","+ n <<= 1","+ a >>= 1","+ lcm = 1","+ for a in A:","+ if a % n != 0 or a % (2 * n) == 0:","+ print((0))","+ return","+ lcm = lcm * a \/\/ gcd(lcm, a)","+ if lcm > M * 2:","+ print((0))","+ return","+ print(((M - lcm \/\/ 2) \/\/ lcm + 1))","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.1015676095,"measured_runtime_v1":0.1593360417,"runtime_lift":0.6374427811,"key":["s959153059","s147163378"]} +{"user_id":"u644907318","problem_id":"p02756","language":"python","submission_id_v0":"s004591848","submission_id_v1":"s575574351","cpu_time_v0":1071,"cpu_time_v1":954,"memory_v0":76392,"memory_v1":74600,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.92,"input":"from collections import deque\n\nS = deque(list(input().strip()))\n\nQ = int(eval(input()))\n\ncnt = 0\n\nfor _ in range(Q):\n\n q = list(input().split())\n\n if int(q[0])==1:\n\n cnt += 1\n\n else:\n\n if cnt%2==0:\n\n if int(q[1])==1:\n\n S.appendleft(q[2])\n\n else:\n\n S.append(q[2])\n\n else:\n\n if int(q[1])==1:\n\n S.append(q[2])\n\n else:\n\n S.appendleft(q[2])\n\nif cnt%2==0:\n\n print((\"\".join(S)))\n\nelse:\n\n S.reverse()\n\n print((\"\".join(S)))","target":"from collections import deque\n\nS = deque(list(input().strip()))\n\nQ = int(eval(input()))\n\ncnt = 0\n\nfor i in range(Q):\n\n q = list(input().split())\n\n if len(q)==1:\n\n cnt += 1\n\n else:\n\n F = int(q[1])\n\n C = q[2]\n\n if cnt%2==0:\n\n if F==1:\n\n S.appendleft(C)\n\n else:\n\n S.append(C)\n\n else:\n\n if F==1:\n\n S.append(C)\n\n else:\n\n S.appendleft(C)\n\nif cnt%2==0:\n\n print((\"\".join(S)))\n\nelse:\n\n S = list(S)[::-1]\n\n print((\"\".join(S)))","code_v0_loc":24,"code_v1_loc":26,"code_v0_num_chars":547,"code_v1_num_chars":563,"code_v0_no_empty_lines":"from collections import deque\n\nS = deque(list(input().strip()))\nQ = int(eval(input()))\ncnt = 0\nfor _ in range(Q):\n q = list(input().split())\n if int(q[0]) == 1:\n cnt += 1\n else:\n if cnt % 2 == 0:\n if int(q[1]) == 1:\n S.appendleft(q[2])\n else:\n S.append(q[2])\n else:\n if int(q[1]) == 1:\n S.append(q[2])\n else:\n S.appendleft(q[2])\nif cnt % 2 == 0:\n print((\"\".join(S)))\nelse:\n S.reverse()\n print((\"\".join(S)))\n","code_v1_no_empty_lines":"from collections import deque\n\nS = deque(list(input().strip()))\nQ = int(eval(input()))\ncnt = 0\nfor i in range(Q):\n q = list(input().split())\n if len(q) == 1:\n cnt += 1\n else:\n F = int(q[1])\n C = q[2]\n if cnt % 2 == 0:\n if F == 1:\n S.appendleft(C)\n else:\n S.append(C)\n else:\n if F == 1:\n S.append(C)\n else:\n S.appendleft(C)\nif cnt % 2 == 0:\n print((\"\".join(S)))\nelse:\n S = list(S)[::-1]\n print((\"\".join(S)))\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-for _ in range(Q):","+for i in range(Q):","- if int(q[0]) == 1:","+ if len(q) == 1:","+ F = int(q[1])","+ C = q[2]","- if int(q[1]) == 1:","- S.appendleft(q[2])","+ if F == 1:","+ S.appendleft(C)","- S.append(q[2])","+ S.append(C)","- if int(q[1]) == 1:","- S.append(q[2])","+ if F == 1:","+ S.append(C)","- S.appendleft(q[2])","+ S.appendleft(C)","- S.reverse()","+ S = list(S)[::-1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.1187242687,"measured_runtime_v1":0.0352160044,"runtime_lift":3.371315706,"key":["s004591848","s575574351"]} +{"user_id":"u858575800","problem_id":"p02793","language":"python","submission_id_v0":"s900253647","submission_id_v1":"s632300589","cpu_time_v0":1860,"cpu_time_v1":1021,"memory_v0":6112,"memory_v1":6100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.11,"input":"from fractions import gcd\n\n\n\nMOD = 1000000000 + 7\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nl = 1\n\nans = 0\n\nfor a in A:\n\n g = gcd(a, l)\n\n l = (l \/\/ g) * a\n\n ans = (ans * (a \/\/ g)) % MOD\n\n ans = (ans + (l \/\/ a)) % MOD\n\nprint((int(ans)))\n","target":"from fractions import gcd\n\n\n\nMOD = 1000000000 + 7\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\ndef fact(a, n):\n\n r = 1\n\n while (n > 0):\n\n if (n & 1):\n\n r = (r * a) % MOD\n\n a = (a * a) % MOD\n\n n \/\/= 2\n\n return r\n\n\n\ndef modinv(a):\n\n return fact(a, MOD-2)\n\n\n\nl = 1\n\nans = 0\n\nfor a in A:\n\n l = l * a \/\/ gcd(a, l)\n\nl %= MOD\n\nans = 0\n\nfor a in A:\n\n ans += (l * modinv(a)) % MOD\n\nprint((ans % MOD))\n","code_v0_loc":15,"code_v1_loc":28,"code_v0_num_chars":264,"code_v1_num_chars":455,"code_v0_no_empty_lines":"from fractions import gcd\n\nMOD = 1000000000 + 7\nN = int(eval(input()))\nA = list(map(int, input().split()))\nl = 1\nans = 0\nfor a in A:\n g = gcd(a, l)\n l = (l \/\/ g) * a\n ans = (ans * (a \/\/ g)) % MOD\n ans = (ans + (l \/\/ a)) % MOD\nprint((int(ans)))\n","code_v1_no_empty_lines":"from fractions import gcd\n\nMOD = 1000000000 + 7\nN = int(eval(input()))\nA = list(map(int, input().split()))\n\n\ndef fact(a, n):\n r = 1\n while n > 0:\n if n & 1:\n r = (r * a) % MOD\n a = (a * a) % MOD\n n \/\/= 2\n return r\n\n\ndef modinv(a):\n return fact(a, MOD - 2)\n\n\nl = 1\nans = 0\nfor a in A:\n l = l * a \/\/ gcd(a, l)\nl %= MOD\nans = 0\nfor a in A:\n ans += (l * modinv(a)) % MOD\nprint((ans % MOD))\n","code_same":false,"relative_loc_diff_percent":46.4285714286,"diff":["+","+","+def fact(a, n):","+ r = 1","+ while n > 0:","+ if n & 1:","+ r = (r * a) % MOD","+ a = (a * a) % MOD","+ n \/\/= 2","+ return r","+","+","+def modinv(a):","+ return fact(a, MOD - 2)","+","+","- g = gcd(a, l)","- l = (l \/\/ g) * a","- ans = (ans * (a \/\/ g)) % MOD","- ans = (ans + (l \/\/ a)) % MOD","-print((int(ans)))","+ l = l * a \/\/ gcd(a, l)","+l %= MOD","+ans = 0","+for a in A:","+ ans += (l * modinv(a)) % MOD","+print((ans % MOD))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1127651038,"measured_runtime_v1":0.1125111721,"runtime_lift":1.002256947,"key":["s900253647","s632300589"]} +{"user_id":"u227020436","problem_id":"p03295","language":"python","submission_id_v0":"s284098223","submission_id_v1":"s916444248","cpu_time_v0":556,"cpu_time_v1":404,"memory_v0":27928,"memory_v1":18220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.34,"input":"N, M = [int(t) for t in input().split()]\n\nR = []\n\nfor i in range(M):\n\n a, b = [int(t) for t in input().split()]\n\n R.append((a, b))\n\n\n\nR.sort()\n\n\n\ninf = float('inf')\n\nRa = [inf for a in range(N + 1)]\n\nfor a, b in R:\n\n Ra[a] = min(Ra[a], b)\n\nR = [(a, Ra[a]) for a in range(1, N+1) if Ra[a] != inf]\n\n\n\nR.sort(key=lambda r: r[1])\n\n\n\nbridge = [True] * (N)\n\n\n\nlast = None\n\nfor a, b in R:\n\n if last == None or last < a:\n\n bridge[b-1] = False\n\n last = b-1\n\nprint((sum(1 for b in bridge if not b)))\n","target":"N, M = [int(t) for t in input().split()]\n\nR = []\n\nfor i in range(M):\n\n a, b = [int(t) for t in input().split()]\n\n R.append((a, b))\n\n\n\nR.sort(key=lambda r: r[1])\n\n\n\nlast = -1\n\ncount = 0\n\nfor a, b in R:\n\n if last < a:\n\n last = b - 1\n\n count += 1\n\nprint(count)","code_v0_loc":24,"code_v1_loc":15,"code_v0_num_chars":514,"code_v1_num_chars":281,"code_v0_no_empty_lines":"N, M = [int(t) for t in input().split()]\nR = []\nfor i in range(M):\n a, b = [int(t) for t in input().split()]\n R.append((a, b))\nR.sort()\ninf = float(\"inf\")\nRa = [inf for a in range(N + 1)]\nfor a, b in R:\n Ra[a] = min(Ra[a], b)\nR = [(a, Ra[a]) for a in range(1, N + 1) if Ra[a] != inf]\nR.sort(key=lambda r: r[1])\nbridge = [True] * (N)\nlast = None\nfor a, b in R:\n if last == None or last < a:\n bridge[b - 1] = False\n last = b - 1\nprint((sum(1 for b in bridge if not b)))\n","code_v1_no_empty_lines":"N, M = [int(t) for t in input().split()]\nR = []\nfor i in range(M):\n a, b = [int(t) for t in input().split()]\n R.append((a, b))\nR.sort(key=lambda r: r[1])\nlast = -1\ncount = 0\nfor a, b in R:\n if last < a:\n last = b - 1\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-R.sort()","-inf = float(\"inf\")","-Ra = [inf for a in range(N + 1)]","+R.sort(key=lambda r: r[1])","+last = -1","+count = 0","- Ra[a] = min(Ra[a], b)","-R = [(a, Ra[a]) for a in range(1, N + 1) if Ra[a] != inf]","-R.sort(key=lambda r: r[1])","-bridge = [True] * (N)","-last = None","-for a, b in R:","- if last == None or last < a:","- bridge[b - 1] = False","+ if last < a:","-print((sum(1 for b in bridge if not b)))","+ count += 1","+print(count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0988740618,"measured_runtime_v1":0.0363360136,"runtime_lift":2.7211037238,"key":["s284098223","s916444248"]} +{"user_id":"u893063840","problem_id":"p02660","language":"python","submission_id_v0":"s664933219","submission_id_v1":"s805994433","cpu_time_v0":330,"cpu_time_v1":144,"memory_v0":19948,"memory_v1":9480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.36,"input":"def sieve(x):\n\n \"\"\"\n\n Sieve of Eratosthenes\n\n :param x: max value\n\n :return: list of bool\n\n \"\"\"\n\n\n\n is_prime = [True] * (x + 1)\n\n is_prime[0] = is_prime[1] = False\n\n\n\n for i in range(2, x + 1):\n\n if is_prime[i]:\n\n for j in range(i * 2, x + 1, i):\n\n is_prime[j] = False\n\n\n\n return is_prime\n\n\n\n\n\nn = int(eval(input()))\n\n\n\nis_prime = sieve(10 ** 6)\n\nprimes = [i for i, e in enumerate(is_prime) if e]\n\n\n\nans = 0\n\nfor e in primes:\n\n div = e\n\n while n % div == 0:\n\n n \/\/= div\n\n ans += 1\n\n div *= e\n\n\n\n while n % e == 0:\n\n n \/\/= e\n\n\n\nans += n != 1\n\n\n\nprint(ans)\n","target":"from math import sqrt\n\nfrom collections import defaultdict\n\n\n\nn = int(eval(input()))\n\n\n\nd = defaultdict(int)\n\nfor i in range(2, int(sqrt(n)) + 10):\n\n while n % i == 0:\n\n d[i] += 1\n\n n \/\/= i\n\n\n\nif n != 1:\n\n d[n] += 1\n\n\n\nans = 0\n\nfor v in list(d.values()):\n\n mn = 1\n\n while v >= mn:\n\n v -= mn\n\n ans += 1\n\n mn += 1\n\n\n\nprint(ans)\n","code_v0_loc":37,"code_v1_loc":23,"code_v0_num_chars":646,"code_v1_num_chars":361,"code_v0_no_empty_lines":"def sieve(x):\n \"\"\"\n Sieve of Eratosthenes\n :param x: max value\n :return: list of bool\n \"\"\"\n is_prime = [True] * (x + 1)\n is_prime[0] = is_prime[1] = False\n for i in range(2, x + 1):\n if is_prime[i]:\n for j in range(i * 2, x + 1, i):\n is_prime[j] = False\n return is_prime\n\n\nn = int(eval(input()))\nis_prime = sieve(10**6)\nprimes = [i for i, e in enumerate(is_prime) if e]\nans = 0\nfor e in primes:\n div = e\n while n % div == 0:\n n \/\/= div\n ans += 1\n div *= e\n while n % e == 0:\n n \/\/= e\nans += n != 1\nprint(ans)\n","code_v1_no_empty_lines":"from math import sqrt\nfrom collections import defaultdict\n\nn = int(eval(input()))\nd = defaultdict(int)\nfor i in range(2, int(sqrt(n)) + 10):\n while n % i == 0:\n d[i] += 1\n n \/\/= i\nif n != 1:\n d[n] += 1\nans = 0\nfor v in list(d.values()):\n mn = 1\n while v >= mn:\n v -= mn\n ans += 1\n mn += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":37.8378378378,"diff":["-def sieve(x):","- \"\"\"","- Sieve of Eratosthenes","- :param x: max value","- :return: list of bool","- \"\"\"","- is_prime = [True] * (x + 1)","- is_prime[0] = is_prime[1] = False","- for i in range(2, x + 1):","- if is_prime[i]:","- for j in range(i * 2, x + 1, i):","- is_prime[j] = False","- return is_prime","-","+from math import sqrt","+from collections import defaultdict","-is_prime = sieve(10**6)","-primes = [i for i, e in enumerate(is_prime) if e]","+d = defaultdict(int)","+for i in range(2, int(sqrt(n)) + 10):","+ while n % i == 0:","+ d[i] += 1","+ n \/\/= i","+if n != 1:","+ d[n] += 1","-for e in primes:","- div = e","- while n % div == 0:","- n \/\/= div","+for v in list(d.values()):","+ mn = 1","+ while v >= mn:","+ v -= mn","- div *= e","- while n % e == 0:","- n \/\/= e","-ans += n != 1","+ mn += 1"],"diff_only_import_comment":false,"measured_runtime_v0":1.0325123172,"measured_runtime_v1":0.1325176463,"runtime_lift":7.7915081186,"key":["s664933219","s805994433"]} +{"user_id":"u977193988","problem_id":"p02773","language":"python","submission_id_v0":"s782412638","submission_id_v1":"s605868952","cpu_time_v0":724,"cpu_time_v1":565,"memory_v0":35948,"memory_v1":35824,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.96,"input":"from collections import Counter\n\n\n\nn = int(input())\n\nS = [input() for i in range(n)]\n\n\n\nL = Counter(S)\n\nm = 0\n\nfor v in L.values():\n\n m = max(m, v)\n\nans = []\n\nfor k, v in L.items():\n\n if v == m:\n\n ans.append(k)\n\nans.sort()\n\nprint(*ans, sep=\"\\n\")\n","target":"from collections import Counter\n\n\n\nN = int(input())\n\nS = [input() for i in range(N)]\n\n\n\nC = Counter(S)\n\nmax_cnt = max(C.values())\n\n\n\nnames = [names for names, values in C.items() if values == max_cnt]\n\nnames.sort()\n\n\n\nprint(*names, sep=\"\\n\")\n\n\n","code_v0_loc":15,"code_v1_loc":13,"code_v0_num_chars":258,"code_v1_num_chars":244,"code_v0_no_empty_lines":"from collections import Counter\n\nn = int(input())\nS = [input() for i in range(n)]\nL = Counter(S)\nm = 0\nfor v in L.values():\n m = max(m, v)\nans = []\nfor k, v in L.items():\n if v == m:\n ans.append(k)\nans.sort()\nprint(*ans, sep=\"\\n\")\n","code_v1_no_empty_lines":"from collections import Counter\n\nN = int(input())\nS = [input() for i in range(N)]\nC = Counter(S)\nmax_cnt = max(C.values())\nnames = [names for names, values in C.items() if values == max_cnt]\nnames.sort()\nprint(*names, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-n = int(input())","-S = [input() for i in range(n)]","-L = Counter(S)","-m = 0","-for v in L.values():","- m = max(m, v)","-ans = []","-for k, v in L.items():","- if v == m:","- ans.append(k)","-ans.sort()","-print(*ans, sep=\"\\n\")","+N = int(input())","+S = [input() for i in range(N)]","+C = Counter(S)","+max_cnt = max(C.values())","+names = [names for names, values in C.items() if values == max_cnt]","+names.sort()","+print(*names, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0419846048,"measured_runtime_v1":0.0431271827,"runtime_lift":0.973506781,"key":["s782412638","s605868952"]} +{"user_id":"u896741788","problem_id":"p03048","language":"python","submission_id_v0":"s822100432","submission_id_v1":"s948716817","cpu_time_v0":365,"cpu_time_v1":94,"memory_v0":41232,"memory_v1":66620,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.25,"input":"r,g,b,n=list(map(int,input().split()))\n\nans=0\n\nr,g,b=max(r,g,b),r+g+b-max(r,g,b)-min(r,g,b),min(r,g,b)\n\nfor i in range(n\/\/r+1):\n\n for j in range(n\/\/g+1):\n\n if (n-i*r-j*g)%b or (n-i*r-j*g)<0:\n\n continue\n\n ans+=1\n\nprint(ans)\n","target":"r,g,b,n=list(map(int,input().split()))\n\n\n\nans=0\n\nfor R in range(n\/\/r+1):\n\n for B in range((n)\/\/b+1):\n\n if (R*r+B*b-n)<=0 and (R*r+B*b-n)%g==0:\n\n ans+=1\n\n \n\nprint(ans)","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":229,"code_v1_num_chars":192,"code_v0_no_empty_lines":"r, g, b, n = list(map(int, input().split()))\nans = 0\nr, g, b = max(r, g, b), r + g + b - max(r, g, b) - min(r, g, b), min(r, g, b)\nfor i in range(n \/\/ r + 1):\n for j in range(n \/\/ g + 1):\n if (n - i * r - j * g) % b or (n - i * r - j * g) < 0:\n continue\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"r, g, b, n = list(map(int, input().split()))\nans = 0\nfor R in range(n \/\/ r + 1):\n for B in range((n) \/\/ b + 1):\n if (R * r + B * b - n) <= 0 and (R * r + B * b - n) % g == 0:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-r, g, b = max(r, g, b), r + g + b - max(r, g, b) - min(r, g, b), min(r, g, b)","-for i in range(n \/\/ r + 1):","- for j in range(n \/\/ g + 1):","- if (n - i * r - j * g) % b or (n - i * r - j * g) < 0:","- continue","- ans += 1","+for R in range(n \/\/ r + 1):","+ for B in range((n) \/\/ b + 1):","+ if (R * r + B * b - n) <= 0 and (R * r + B * b - n) % g == 0:","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.2051722821,"measured_runtime_v1":0.2261690392,"runtime_lift":0.9071634335,"key":["s822100432","s948716817"]} +{"user_id":"u374103100","problem_id":"p03436","language":"python","submission_id_v0":"s449112948","submission_id_v1":"s011815345","cpu_time_v0":48,"cpu_time_v1":27,"memory_v0":3952,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.75,"input":"from queue import Queue\n\n\n\ninf = 10 ** 20\n\n\n\ndef bfs(H, W, s):\n\n d = [[inf for i in range(W)] for j in range(H)]\n\n q = Queue()\n\n\n\n d[0][0] = 1\n\n q.put([0, 0])\n\n\n\n dx = (0, -1, 1, 0)\n\n dy = (-1, 0, 0, 1)\n\n\n\n while not q.empty():\n\n p = q.get()\n\n x = p[0]\n\n y = p[1]\n\n for i in range(4):\n\n nx = x + dx[i]\n\n ny = y + dy[i]\n\n if(nx >= 0 and nx < H and ny >= 0 and ny < W):\n\n if(s[nx][ny] == '.' and d[x][y] + 1 < d[nx][ny]):\n\n d[nx][ny] = d[x][y] + 1\n\n q.put([nx, ny])\n\n\n\n return d[H-1][W-1]\n\n\n\nH, W = list(map(int, input().split()))\n\ns = []\n\nwnum = 0\n\nfor i in range(H):\n\n s.append(eval(input()))\n\n for j in range(W):\n\n if(s[i][j] == \".\"):\n\n wnum += 1\n\nd = bfs(H, W, s)\n\nif(d == inf):\n\n print(\"-1\")\n\nelse:\n\n print((wnum - d))\n","target":"# https:\/\/atcoder.jp\/contests\/abc088\/tasks\/abc088_d\n\n\n\nH, W = list(map(int, input().split()))\n\ns = [eval(input()) for _ in range(H)]\n\nd = [[-1] * W for _ in range(H)]\n\n\n\n# 0,0 to h-1, w-1\n\nd[0][0] = 0\n\n\n\nqueue = []\n\nqueue.append([0, 0])\n\n\n\nwhile len(queue) > 0:\n\n p = queue.pop(0)\n\n y, x = p[0], p[1]\n\n\n\n dx4 = [0, 0, 1, -1]\n\n dy4 = [1, -1, 0, 0]\n\n\n\n for dx, dy in zip(dx4, dy4):\n\n next_y = y + dy\n\n next_x = x + dx\n\n if 0 <= next_y < H and 0 <= next_x < W and s[next_y][next_x] != \"#\" and d[next_y][next_x] == -1:\n\n d[next_y][next_x] = d[y][x] + 1\n\n queue.append([next_y, next_x])\n\n\n\ncount = 0\n\nfor l in s:\n\n for c in l:\n\n if c == \".\":\n\n count += 1\n\n\n\nif d[H-1][W-1] == -1:\n\n print((-1))\n\nelse:\n\n print((count - d[H-1][W-1] - 1))\n\n\n\n# [print(l) for l in s]\n\n# [print(l) for l in d]\n","code_v0_loc":41,"code_v1_loc":39,"code_v0_num_chars":876,"code_v1_num_chars":852,"code_v0_no_empty_lines":"from queue import Queue\n\ninf = 10**20\n\n\ndef bfs(H, W, s):\n d = [[inf for i in range(W)] for j in range(H)]\n q = Queue()\n d[0][0] = 1\n q.put([0, 0])\n dx = (0, -1, 1, 0)\n dy = (-1, 0, 0, 1)\n while not q.empty():\n p = q.get()\n x = p[0]\n y = p[1]\n for i in range(4):\n nx = x + dx[i]\n ny = y + dy[i]\n if nx >= 0 and nx < H and ny >= 0 and ny < W:\n if s[nx][ny] == \".\" and d[x][y] + 1 < d[nx][ny]:\n d[nx][ny] = d[x][y] + 1\n q.put([nx, ny])\n return d[H - 1][W - 1]\n\n\nH, W = list(map(int, input().split()))\ns = []\nwnum = 0\nfor i in range(H):\n s.append(eval(input()))\n for j in range(W):\n if s[i][j] == \".\":\n wnum += 1\nd = bfs(H, W, s)\nif d == inf:\n print(\"-1\")\nelse:\n print((wnum - d))\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc088\/tasks\/abc088_d\nH, W = list(map(int, input().split()))\ns = [eval(input()) for _ in range(H)]\nd = [[-1] * W for _ in range(H)]\n# 0,0 to h-1, w-1\nd[0][0] = 0\nqueue = []\nqueue.append([0, 0])\nwhile len(queue) > 0:\n p = queue.pop(0)\n y, x = p[0], p[1]\n dx4 = [0, 0, 1, -1]\n dy4 = [1, -1, 0, 0]\n for dx, dy in zip(dx4, dy4):\n next_y = y + dy\n next_x = x + dx\n if (\n 0 <= next_y < H\n and 0 <= next_x < W\n and s[next_y][next_x] != \"#\"\n and d[next_y][next_x] == -1\n ):\n d[next_y][next_x] = d[y][x] + 1\n queue.append([next_y, next_x])\ncount = 0\nfor l in s:\n for c in l:\n if c == \".\":\n count += 1\nif d[H - 1][W - 1] == -1:\n print((-1))\nelse:\n print((count - d[H - 1][W - 1] - 1))\n# [print(l) for l in s]\n# [print(l) for l in d]\n","code_same":false,"relative_loc_diff_percent":4.8780487805,"diff":["-from queue import Queue","-","-inf = 10**20","-","-","-def bfs(H, W, s):","- d = [[inf for i in range(W)] for j in range(H)]","- q = Queue()","- d[0][0] = 1","- q.put([0, 0])","- dx = (0, -1, 1, 0)","- dy = (-1, 0, 0, 1)","- while not q.empty():","- p = q.get()","- x = p[0]","- y = p[1]","- for i in range(4):","- nx = x + dx[i]","- ny = y + dy[i]","- if nx >= 0 and nx < H and ny >= 0 and ny < W:","- if s[nx][ny] == \".\" and d[x][y] + 1 < d[nx][ny]:","- d[nx][ny] = d[x][y] + 1","- q.put([nx, ny])","- return d[H - 1][W - 1]","-","-","+# https:\/\/atcoder.jp\/contests\/abc088\/tasks\/abc088_d","-s = []","-wnum = 0","-for i in range(H):","- s.append(eval(input()))","- for j in range(W):","- if s[i][j] == \".\":","- wnum += 1","-d = bfs(H, W, s)","-if d == inf:","- print(\"-1\")","+s = [eval(input()) for _ in range(H)]","+d = [[-1] * W for _ in range(H)]","+# 0,0 to h-1, w-1","+d[0][0] = 0","+queue = []","+queue.append([0, 0])","+while len(queue) > 0:","+ p = queue.pop(0)","+ y, x = p[0], p[1]","+ dx4 = [0, 0, 1, -1]","+ dy4 = [1, -1, 0, 0]","+ for dx, dy in zip(dx4, dy4):","+ next_y = y + dy","+ next_x = x + dx","+ if (","+ 0 <= next_y < H","+ and 0 <= next_x < W","+ and s[next_y][next_x] != \"#\"","+ and d[next_y][next_x] == -1","+ ):","+ d[next_y][next_x] = d[y][x] + 1","+ queue.append([next_y, next_x])","+count = 0","+for l in s:","+ for c in l:","+ if c == \".\":","+ count += 1","+if d[H - 1][W - 1] == -1:","+ print((-1))","- print((wnum - d))","+ print((count - d[H - 1][W - 1] - 1))","+# [print(l) for l in s]","+# [print(l) for l in d]"],"diff_only_import_comment":false,"measured_runtime_v0":0.1115709586,"measured_runtime_v1":0.0378848152,"runtime_lift":2.9450046925,"key":["s449112948","s011815345"]} +{"user_id":"u798129018","problem_id":"p03112","language":"python","submission_id_v0":"s471155768","submission_id_v1":"s455906280","cpu_time_v0":1901,"cpu_time_v1":994,"memory_v0":23444,"memory_v1":27452,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.71,"input":"import bisect\n\nfrom scipy.sparse.csgraph import floyd_warshall as wf\n\nINF = 10**20\n\n\n\nA,B,Q = list(map(int,input().split()))\n\ns = [-INF]+[int(eval(input())) for _ in range(A)]+[INF]\n\nt = [-INF]+[int(eval(input())) for _ in range(B)]+[INF]\n\n\n\nfor i in range(Q):\n\n q = int(eval(input()))\n\n b,d = bisect.bisect_right(s,q),bisect.bisect_right(t,q)\n\n ans = INF\n\n for S in [s[b-1],s[b]]:\n\n for T in [t[d-1],t[d]]:\n\n d1,d2 = abs(S-q)+abs(T-S),abs(T-q)+abs(S-T)\n\n ans = min(ans,d1,d2)\n\n print(ans)","target":"import sys\n\nimport itertools\n\nimport math\n\nfrom collections import deque\n\nfrom collections import defaultdict\n\nfrom itertools import permutations\n\nimport heapq\n\nimport bisect\n\nfrom scipy.sparse.csgraph import floyd_warshall as wf\n\nINF = 10**20\n\n\n\nA,B,Q = list(map(int,input().split()))\n\ns = [-INF]+list(map(int, (sys.stdin.readline() for _ in [0]*A)))+[INF]\n\nt = [-INF]+list(map(int, (sys.stdin.readline() for _ in [0]*B)))+[INF]\n\nqueries=list(map(int,sys.stdin))\n\nfor q in queries:\n\n b,d = bisect.bisect_right(s,q),bisect.bisect_right(t,q)\n\n ans = INF\n\n for S in [s[b-1],s[b]]:\n\n for T in [t[d-1],t[d]]:\n\n d1,d2 = abs(S-q)+abs(T-S),abs(T-q)+abs(S-T)\n\n ans = min(ans,d1,d2)\n\n print(ans)","code_v0_loc":17,"code_v1_loc":23,"code_v0_num_chars":509,"code_v1_num_chars":721,"code_v0_no_empty_lines":"import bisect\nfrom scipy.sparse.csgraph import floyd_warshall as wf\n\nINF = 10**20\nA, B, Q = list(map(int, input().split()))\ns = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]\nt = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]\nfor i in range(Q):\n q = int(eval(input()))\n b, d = bisect.bisect_right(s, q), bisect.bisect_right(t, q)\n ans = INF\n for S in [s[b - 1], s[b]]:\n for T in [t[d - 1], t[d]]:\n d1, d2 = abs(S - q) + abs(T - S), abs(T - q) + abs(S - T)\n ans = min(ans, d1, d2)\n print(ans)\n","code_v1_no_empty_lines":"import sys\nimport itertools\nimport math\nfrom collections import deque\nfrom collections import defaultdict\nfrom itertools import permutations\nimport heapq\nimport bisect\nfrom scipy.sparse.csgraph import floyd_warshall as wf\n\nINF = 10**20\nA, B, Q = list(map(int, input().split()))\ns = [-INF] + list(map(int, (sys.stdin.readline() for _ in [0] * A))) + [INF]\nt = [-INF] + list(map(int, (sys.stdin.readline() for _ in [0] * B))) + [INF]\nqueries = list(map(int, sys.stdin))\nfor q in queries:\n b, d = bisect.bisect_right(s, q), bisect.bisect_right(t, q)\n ans = INF\n for S in [s[b - 1], s[b]]:\n for T in [t[d - 1], t[d]]:\n d1, d2 = abs(S - q) + abs(T - S), abs(T - q) + abs(S - T)\n ans = min(ans, d1, d2)\n print(ans)\n","code_same":false,"relative_loc_diff_percent":26.0869565217,"diff":["+import sys","+import itertools","+import math","+from collections import deque","+from collections import defaultdict","+from itertools import permutations","+import heapq","-s = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]","-t = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]","-for i in range(Q):","- q = int(eval(input()))","+s = [-INF] + list(map(int, (sys.stdin.readline() for _ in [0] * A))) + [INF]","+t = [-INF] + list(map(int, (sys.stdin.readline() for _ in [0] * B))) + [INF]","+queries = list(map(int, sys.stdin))","+for q in queries:"],"diff_only_import_comment":false,"measured_runtime_v0":0.03766888,"measured_runtime_v1":0.0414133864,"runtime_lift":0.9095822204,"key":["s471155768","s455906280"]} +{"user_id":"u583014768","problem_id":"p03127","language":"python","submission_id_v0":"s305688050","submission_id_v1":"s128945690","cpu_time_v0":246,"cpu_time_v1":81,"memory_v0":16240,"memory_v1":16280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.07,"input":"from fractions import gcd\n\n\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\na = sorted(A)\n\nB = [a[0]]\n\nC = []\n\nfor i in range(1,N):\n\n x = a[i]%a[0]\n\n if x != 0:\n\n B.append(x)\n\nb =sorted(B)\n\nfor i in range(len(b)-1):\n\n y = gcd(b[i],b[-1])\n\n C.append(y)\n\n \n\nif len(b) == 1:\n\n print((b[0]))\n\nelse:\n\n print((min(C)))","target":"from fractions import gcd\n\n\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nmini = min(A)\n\nans = min(A)\n\nfor a in A:\n\n amari = a % mini\n\n if amari != 0:\n\n if amari < ans:\n\n ans = amari \n\nif mini - ans == 0:\n\n print(ans)\n\nelse:\n\n print((gcd(mini, ans)))","code_v0_loc":21,"code_v1_loc":16,"code_v0_num_chars":345,"code_v1_num_chars":300,"code_v0_no_empty_lines":"from fractions import gcd\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\na = sorted(A)\nB = [a[0]]\nC = []\nfor i in range(1, N):\n x = a[i] % a[0]\n if x != 0:\n B.append(x)\nb = sorted(B)\nfor i in range(len(b) - 1):\n y = gcd(b[i], b[-1])\n C.append(y)\nif len(b) == 1:\n print((b[0]))\nelse:\n print((min(C)))\n","code_v1_no_empty_lines":"from fractions import gcd\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nmini = min(A)\nans = min(A)\nfor a in A:\n amari = a % mini\n if amari != 0:\n if amari < ans:\n ans = amari\nif mini - ans == 0:\n print(ans)\nelse:\n print((gcd(mini, ans)))\n","code_same":false,"relative_loc_diff_percent":23.8095238095,"diff":["-a = sorted(A)","-B = [a[0]]","-C = []","-for i in range(1, N):","- x = a[i] % a[0]","- if x != 0:","- B.append(x)","-b = sorted(B)","-for i in range(len(b) - 1):","- y = gcd(b[i], b[-1])","- C.append(y)","-if len(b) == 1:","- print((b[0]))","+mini = min(A)","+ans = min(A)","+for a in A:","+ amari = a % mini","+ if amari != 0:","+ if amari < ans:","+ ans = amari","+if mini - ans == 0:","+ print(ans)","- print((min(C)))","+ print((gcd(mini, ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0423919575,"measured_runtime_v1":0.1056587408,"runtime_lift":0.4012158125,"key":["s305688050","s128945690"]} +{"user_id":"u729133443","problem_id":"p02882","language":"python","submission_id_v0":"s966539167","submission_id_v1":"s557464761","cpu_time_v0":171,"cpu_time_v1":17,"memory_v0":38640,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.06,"input":"from math import*\n\ndef solve(B):\n\n \u03b1=b*sin((90-B)*pi\/180)\/sin(B*pi\/180)\n\n s=\u03b1*b\/2\n\n if \u03b1>a:s-=(\u03b1-a)*(b-b*a\/\u03b1)\/2\n\n return s>=x\/a\n\na,b,x=list(map(int,input().split()))\n\nok=0\n\nng=90\n\nwhile ng-ok>1e-7:\n\n mid=(ok+ng)\/2\n\n if solve(mid):ok=mid\n\n else:ng=mid\n\nprint(ok)","target":"from math import*\n\na,b,x=list(map(int,input().split()))\n\nprint((atan(2*(b\/a-x\/a**3)if x>a**2*b\/2else a*b**2\/(2*x))\/pi*180))","code_v0_loc":14,"code_v1_loc":3,"code_v0_num_chars":276,"code_v1_num_chars":115,"code_v0_no_empty_lines":"from math import *\n\n\ndef solve(B):\n \u03b1 = b * sin((90 - B) * pi \/ 180) \/ sin(B * pi \/ 180)\n s = \u03b1 * b \/ 2\n if \u03b1 > a:\n s -= (\u03b1 - a) * (b - b * a \/ \u03b1) \/ 2\n return s >= x \/ a\n\n\na, b, x = list(map(int, input().split()))\nok = 0\nng = 90\nwhile ng - ok > 1e-7:\n mid = (ok + ng) \/ 2\n if solve(mid):\n ok = mid\n else:\n ng = mid\nprint(ok)\n","code_v1_no_empty_lines":"from math import *\n\na, b, x = list(map(int, input().split()))\nprint(\n (\n atan(2 * (b \/ a - x \/ a**3) if x > a**2 * b \/ 2 else a * b**2 \/ (2 * x))\n \/ pi\n * 180\n )\n)\n","code_same":false,"relative_loc_diff_percent":78.5714285714,"diff":["-","-def solve(B):","- \u03b1 = b * sin((90 - B) * pi \/ 180) \/ sin(B * pi \/ 180)","- s = \u03b1 * b \/ 2","- if \u03b1 > a:","- s -= (\u03b1 - a) * (b - b * a \/ \u03b1) \/ 2","- return s >= x \/ a","-","-","-ok = 0","-ng = 90","-while ng - ok > 1e-7:","- mid = (ok + ng) \/ 2","- if solve(mid):","- ok = mid","- else:","- ng = mid","-print(ok)","+print(","+ (","+ atan(2 * (b \/ a - x \/ a**3) if x > a**2 * b \/ 2 else a * b**2 \/ (2 * x))","+ \/ pi","+ * 180","+ )","+)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0401552618,"measured_runtime_v1":0.0349426134,"runtime_lift":1.1491774049,"key":["s966539167","s557464761"]} +{"user_id":"u349765885","problem_id":"p02647","language":"python","submission_id_v0":"s863156530","submission_id_v1":"s723346503","cpu_time_v0":528,"cpu_time_v1":366,"memory_v0":190144,"memory_v1":170588,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.68,"input":"#\u7d20\u306ePython\u3067\u306f\u901a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c\uff0cPyPy\u3092\u4f7f\u3063\u305f\u3089\u901a\u308a\u307e\u3057\u305f\n\nN, K = list(map(int, input().split()))\n\nAs = list(map(int, input().split()))\n\n\n\nfor i in range(K):\n\n table = [0 for _ in range(N*2)]\n\n # imos\u6cd5 - \u30e1\u30e2\n\n for j in range(N):\n\n ai = As[j]\n\n # \u96fb\u7403\u304c\u7167\u3089\u3059\u5de6\u7aef\u3092\u30e1\u30e2\n\n table[max((j-ai)*2-1, 0)] += 1\n\n # \u96fb\u7403\u304c\u7167\u3089\u3059\u53f3\u7aef\u3092\u30e1\u30e2\n\n table[min((j+ai)*2+1, N*2-1)] -= 1\n\n \n\n # imos\u6cd5 - \u30b7\u30df\u30e5\u30ec\u30fc\u30c8\n\n for j in range(N*2):\n\n if j > 0:\n\n table[j] += table[j-1]\n\n \n\n # \u7b54\u3048\u306b\u306a\u304a\u3059\n\n for j in range(N):\n\n As[j] = table[j*2]\n\n \n\n exit_condition = True\n\n for j in range(N):\n\n if As[j] != N:\n\n exit_condition = False\n\n break\n\n \n\n if exit_condition:\n\n print((*As))\n\n exit(0)\n\n \n\n\n\nprint((*As))","target":"N, K = list(map(int, input().split()))\n\nAs = list(map(int, input().split()))\n\n\n\n\n\nfor i in range(K):\n\n #imos\u6cd5(\u30e1\u30e2)\n\n table = [0 for _ in range(N+1)]\n\n #\u6570\u5024\u304cN\u500b\u306a\u306e\u3067N\u500b\u306e0\u306e\u8981\u7d20\u3092\u4f5c\u308b\n\n #index0\u306f\u7a7a\u767d\u3001index1\u304b\u3089x\u8ef8\u306e\u30e9\u30f3\u30d7\u304c\u3042\u308b\u4f4d\u7f6e\u306b\u5bfe\u5fdc\n\n #1-N\u307e\u3067\u306e\u30e9\u30f3\u30d7\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\n\n for j in range(1,N+1):\n\n ai = As[j-1]\n\n #\u96fb\u7403j\u304c\u7167\u3089\u3059\u5de6\u7aef\u3092\u30e1\u30e2\n\n #\u96fb\u7403j\u304c\u7167\u3089\u3059\u5de6\u7aef\u306fj-ai\u306a\u306e\u3067\u3001\u3053\u3053\u306b\uff11\u3092\u8db3\u3059\n\n table[max(j-ai, 1)] += 1\n\n #\u96fb\u7403j\u304c\u7167\u3089\u3059\u53f3\u7aef\u3092\u30e1\u30e2\n\n #\u96fb\u7403j\u304c\u7167\u3089\u3059\u53f3\u7aef\u306fj+ai\u306a\u306e\u3067\u3001\u3053\u306e\u6b21\u306e\u9805\u306b-1\u3092\u52a0\u3048\u308b\n\n if j+ai 0:\n table[j] += table[j - 1]\n # \u7b54\u3048\u306b\u306a\u304a\u3059\n for j in range(N):\n As[j] = table[j * 2]\n exit_condition = True\n for j in range(N):\n if As[j] != N:\n exit_condition = False\n break\n if exit_condition:\n print((*As))\n exit(0)\nprint((*As))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nAs = list(map(int, input().split()))\nfor i in range(K):\n # imos\u6cd5(\u30e1\u30e2)\n table = [0 for _ in range(N + 1)]\n # \u6570\u5024\u304cN\u500b\u306a\u306e\u3067N\u500b\u306e0\u306e\u8981\u7d20\u3092\u4f5c\u308b\n # index0\u306f\u7a7a\u767d\u3001index1\u304b\u3089x\u8ef8\u306e\u30e9\u30f3\u30d7\u304c\u3042\u308b\u4f4d\u7f6e\u306b\u5bfe\u5fdc\n # 1-N\u307e\u3067\u306e\u30e9\u30f3\u30d7\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\n for j in range(1, N + 1):\n ai = As[j - 1]\n # \u96fb\u7403j\u304c\u7167\u3089\u3059\u5de6\u7aef\u3092\u30e1\u30e2\n # \u96fb\u7403j\u304c\u7167\u3089\u3059\u5de6\u7aef\u306fj-ai\u306a\u306e\u3067\u3001\u3053\u3053\u306b\uff11\u3092\u8db3\u3059\n table[max(j - ai, 1)] += 1\n # \u96fb\u7403j\u304c\u7167\u3089\u3059\u53f3\u7aef\u3092\u30e1\u30e2\n # \u96fb\u7403j\u304c\u7167\u3089\u3059\u53f3\u7aef\u306fj+ai\u306a\u306e\u3067\u3001\u3053\u306e\u6b21\u306e\u9805\u306b-1\u3092\u52a0\u3048\u308b\n if j + ai < N:\n table[min(j + ai + 1, N)] -= 1\n # imos\u6cd5(\u7dcf\u548c\u3092\u6c42\u3081\u308b)\n for j in range(1, N + 1):\n table[j] += table[j - 1]\n # \u7b54\u3048\u306b\u306a\u304a\u3059\n for j in range(N):\n As[j] = table[j + 1]\n exit_condition = True\n for j in range(N):\n if As[j] != N:\n exit_condition = False\n break\n # \u8981\u7d20\u304c\u5168\u3066N\u306e\u6642\u306b\u3001condition\u306ftrue\u306e\u307e\u307e\n if exit_condition:\n print((*As))\n exit(0) # \u6761\u4ef6\u304c\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u305f\u6642\u3001\u3053\u3053\u3067\u7d42\u4e86\u3068\u3055\u305b\u308b\nprint((*As))\n","code_same":false,"relative_loc_diff_percent":18.6046511628,"diff":["-# \u7d20\u306ePython\u3067\u306f\u901a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c\uff0cPyPy\u3092\u4f7f\u3063\u305f\u3089\u901a\u308a\u307e\u3057\u305f","- table = [0 for _ in range(N * 2)]","- # imos\u6cd5 - \u30e1\u30e2","- for j in range(N):","- ai = As[j]","- # \u96fb\u7403\u304c\u7167\u3089\u3059\u5de6\u7aef\u3092\u30e1\u30e2","- table[max((j - ai) * 2 - 1, 0)] += 1","- # \u96fb\u7403\u304c\u7167\u3089\u3059\u53f3\u7aef\u3092\u30e1\u30e2","- table[min((j + ai) * 2 + 1, N * 2 - 1)] -= 1","- # imos\u6cd5 - \u30b7\u30df\u30e5\u30ec\u30fc\u30c8","- for j in range(N * 2):","- if j > 0:","- table[j] += table[j - 1]","+ # imos\u6cd5(\u30e1\u30e2)","+ table = [0 for _ in range(N + 1)]","+ # \u6570\u5024\u304cN\u500b\u306a\u306e\u3067N\u500b\u306e0\u306e\u8981\u7d20\u3092\u4f5c\u308b","+ # index0\u306f\u7a7a\u767d\u3001index1\u304b\u3089x\u8ef8\u306e\u30e9\u30f3\u30d7\u304c\u3042\u308b\u4f4d\u7f6e\u306b\u5bfe\u5fdc","+ # 1-N\u307e\u3067\u306e\u30e9\u30f3\u30d7\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b","+ for j in range(1, N + 1):","+ ai = As[j - 1]","+ # \u96fb\u7403j\u304c\u7167\u3089\u3059\u5de6\u7aef\u3092\u30e1\u30e2","+ # \u96fb\u7403j\u304c\u7167\u3089\u3059\u5de6\u7aef\u306fj-ai\u306a\u306e\u3067\u3001\u3053\u3053\u306b\uff11\u3092\u8db3\u3059","+ table[max(j - ai, 1)] += 1","+ # \u96fb\u7403j\u304c\u7167\u3089\u3059\u53f3\u7aef\u3092\u30e1\u30e2","+ # \u96fb\u7403j\u304c\u7167\u3089\u3059\u53f3\u7aef\u306fj+ai\u306a\u306e\u3067\u3001\u3053\u306e\u6b21\u306e\u9805\u306b-1\u3092\u52a0\u3048\u308b","+ if j + ai < N:","+ table[min(j + ai + 1, N)] -= 1","+ # imos\u6cd5(\u7dcf\u548c\u3092\u6c42\u3081\u308b)","+ for j in range(1, N + 1):","+ table[j] += table[j - 1]","- As[j] = table[j * 2]","+ As[j] = table[j + 1]","+ # \u8981\u7d20\u304c\u5168\u3066N\u306e\u6642\u306b\u3001condition\u306ftrue\u306e\u307e\u307e","- exit(0)","+ exit(0) # \u6761\u4ef6\u304c\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u305f\u6642\u3001\u3053\u3053\u3067\u7d42\u4e86\u3068\u3055\u305b\u308b"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443446704,"measured_runtime_v1":0.0343795631,"runtime_lift":1.2898555529,"key":["s863156530","s723346503"]} +{"user_id":"u203843959","problem_id":"p02862","language":"python","submission_id_v0":"s790263620","submission_id_v1":"s784000827","cpu_time_v0":276,"cpu_time_v1":156,"memory_v0":3064,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.48,"input":"MOD=10**9+7\n\n\n\ndef powmod(a,p):\n\n if p==0:\n\n return 1\n\n elif p==1:\n\n return a\n\n elif p%2==0:\n\n powsq=powmod(a,p\/\/2)\n\n return (powsq**2)%MOD\n\n elif p%2==1:\n\n powsq=powmod(a,p\/\/2)\n\n return (a*powsq**2)%MOD\n\n\n\ndef invmod(a):\n\n return powmod(a,MOD-2)\n\n\n\nX,Y=list(map(int,input().split()))\n\n\n\nif (X+Y)%3!=0:\n\n print((0))\n\nelse:\n\n u=(2*X-Y)\/\/3\n\n v=(-X+2*Y)\/\/3\n\n if u>=0 and v>=0:\n\n #print(int(u),int(v))\n\n ui=int(u)\n\n vi=int(v)\n\n\n\n bunshi=1\n\n for i in range(vi):\n\n bunshi*=ui+vi-i\n\n bunshi%=MOD\n\n bumbo=1\n\n for i in range(vi):\n\n bumbo*=vi-i\n\n bumbo%=MOD\n\n\n\n #calculate bunshi\/bumbo%MOD as bunshi*bumbo^-1%MOD\n\n print((bunshi*invmod(bumbo)%MOD))\n\n else:\n\n print((0))","target":"MOD=10**9+7\n\nX,Y=list(map(int,input().split()))\n\n\n\ndef powmod(a,p):\n\n if p==0:\n\n return 1\n\n elif p==1:\n\n return a\n\n else:\n\n pow2=powmod(a,p\/\/2)\n\n if p%2==0:\n\n return (pow2**2)%MOD\n\n else:\n\n return (a*pow2**2)%MOD\n\ndef invmod(a):\n\n return powmod(a,MOD-2)\n\ndef comb_mod(n,r):\n\n nPr=1\n\n fact_r=1\n\n for i in range(r):\n\n nPr*=n-i\n\n nPr%=MOD\n\n fact_r*=r-i\n\n fact_r%=MOD \n\n return (nPr*invmod(fact_r))%MOD\n\n\n\nif (X+Y)%3!=0:\n\n print((0))\n\nelse:\n\n u=(2*X-Y)\/\/3\n\n v=(-X+2*Y)\/\/3\n\n if u>=0 and v>=0: \n\n #print(u,v)\n\n print((comb_mod(u+v,v)))\n\n else:\n\n print((0))","code_v0_loc":42,"code_v1_loc":36,"code_v0_num_chars":725,"code_v1_num_chars":601,"code_v0_no_empty_lines":"MOD = 10**9 + 7\n\n\ndef powmod(a, p):\n if p == 0:\n return 1\n elif p == 1:\n return a\n elif p % 2 == 0:\n powsq = powmod(a, p \/\/ 2)\n return (powsq**2) % MOD\n elif p % 2 == 1:\n powsq = powmod(a, p \/\/ 2)\n return (a * powsq**2) % MOD\n\n\ndef invmod(a):\n return powmod(a, MOD - 2)\n\n\nX, Y = list(map(int, input().split()))\nif (X + Y) % 3 != 0:\n print((0))\nelse:\n u = (2 * X - Y) \/\/ 3\n v = (-X + 2 * Y) \/\/ 3\n if u >= 0 and v >= 0:\n # print(int(u),int(v))\n ui = int(u)\n vi = int(v)\n bunshi = 1\n for i in range(vi):\n bunshi *= ui + vi - i\n bunshi %= MOD\n bumbo = 1\n for i in range(vi):\n bumbo *= vi - i\n bumbo %= MOD\n # calculate bunshi\/bumbo%MOD as bunshi*bumbo^-1%MOD\n print((bunshi * invmod(bumbo) % MOD))\n else:\n print((0))\n","code_v1_no_empty_lines":"MOD = 10**9 + 7\nX, Y = list(map(int, input().split()))\n\n\ndef powmod(a, p):\n if p == 0:\n return 1\n elif p == 1:\n return a\n else:\n pow2 = powmod(a, p \/\/ 2)\n if p % 2 == 0:\n return (pow2**2) % MOD\n else:\n return (a * pow2**2) % MOD\n\n\ndef invmod(a):\n return powmod(a, MOD - 2)\n\n\ndef comb_mod(n, r):\n nPr = 1\n fact_r = 1\n for i in range(r):\n nPr *= n - i\n nPr %= MOD\n fact_r *= r - i\n fact_r %= MOD\n return (nPr * invmod(fact_r)) % MOD\n\n\nif (X + Y) % 3 != 0:\n print((0))\nelse:\n u = (2 * X - Y) \/\/ 3\n v = (-X + 2 * Y) \/\/ 3\n if u >= 0 and v >= 0:\n # print(u,v)\n print((comb_mod(u + v, v)))\n else:\n print((0))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+X, Y = list(map(int, input().split()))","- elif p % 2 == 0:","- powsq = powmod(a, p \/\/ 2)","- return (powsq**2) % MOD","- elif p % 2 == 1:","- powsq = powmod(a, p \/\/ 2)","- return (a * powsq**2) % MOD","+ else:","+ pow2 = powmod(a, p \/\/ 2)","+ if p % 2 == 0:","+ return (pow2**2) % MOD","+ else:","+ return (a * pow2**2) % MOD","-X, Y = list(map(int, input().split()))","+def comb_mod(n, r):","+ nPr = 1","+ fact_r = 1","+ for i in range(r):","+ nPr *= n - i","+ nPr %= MOD","+ fact_r *= r - i","+ fact_r %= MOD","+ return (nPr * invmod(fact_r)) % MOD","+","+","- # print(int(u),int(v))","- ui = int(u)","- vi = int(v)","- bunshi = 1","- for i in range(vi):","- bunshi *= ui + vi - i","- bunshi %= MOD","- bumbo = 1","- for i in range(vi):","- bumbo *= vi - i","- bumbo %= MOD","- # calculate bunshi\/bumbo%MOD as bunshi*bumbo^-1%MOD","- print((bunshi * invmod(bumbo) % MOD))","+ # print(u,v)","+ print((comb_mod(u + v, v)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.258753772,"measured_runtime_v1":0.1853236985,"runtime_lift":1.3962260308,"key":["s790263620","s784000827"]} +{"user_id":"u981931040","problem_id":"p03835","language":"python","submission_id_v0":"s655891876","submission_id_v1":"s787147887","cpu_time_v0":1736,"cpu_time_v1":276,"memory_v0":3060,"memory_v1":40684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.1,"input":"K , S = list(map(int,input().split()))\n\ncnt = 0\n\nfor x in range(K + 1):\n\n for y in range(K + 1):\n\n if x + y > S:\n\n continue\n\n z = S - x - y\n\n if z <= K:\n\n cnt += 1\n\nprint(cnt)","target":"K , S = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(K + 1):\n\n for j in range(K + 1):\n\n k = S - i - j\n\n if K >= k >= 0:\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":215,"code_v1_num_chars":176,"code_v0_no_empty_lines":"K, S = list(map(int, input().split()))\ncnt = 0\nfor x in range(K + 1):\n for y in range(K + 1):\n if x + y > S:\n continue\n z = S - x - y\n if z <= K:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"K, S = list(map(int, input().split()))\nans = 0\nfor i in range(K + 1):\n for j in range(K + 1):\n k = S - i - j\n if K >= k >= 0:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-cnt = 0","-for x in range(K + 1):","- for y in range(K + 1):","- if x + y > S:","- continue","- z = S - x - y","- if z <= K:","- cnt += 1","-print(cnt)","+ans = 0","+for i in range(K + 1):","+ for j in range(K + 1):","+ k = S - i - j","+ if K >= k >= 0:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.05999073,"measured_runtime_v1":0.0367207331,"runtime_lift":1.6337018624,"key":["s655891876","s787147887"]} +{"user_id":"u779805689","problem_id":"p02567","language":"python","submission_id_v0":"s456651602","submission_id_v1":"s965037873","cpu_time_v0":1187,"cpu_time_v1":932,"memory_v0":134972,"memory_v1":130344,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.48,"input":"class Segment_Tree():\n\n def __init__(self,N,calc,unit,L=[]):\n\n \"\"\"calc\u3092\u6f14\u7b97\u3068\u3059\u308bN\u9805\u306eSegment Tree\u3092\u4f5c\u6210\n\n\n\n N:\u8981\u7d20\u6570\n\n calc:\u6f14\u7b97(2\u5909\u6570\u95a2\u6570,\u30e2\u30ce\u30a4\u30c9)\n\n unit:\u30e2\u30ce\u30a4\u30c9calc\u306e\u5358\u4f4d\u5143 (xe=ex=x\u3092\u6e80\u305f\u3059e)\n\n \"\"\"\n\n self.calc=calc\n\n self.unit=unit\n\n\n\n N=max(N,len(L))\n\n\n\n d=max(1,(N-1).bit_length())\n\n k=2**d\n\n\n\n X=[unit]*(k-1)+L+[unit]*(k-len(L))\n\n\n\n self.num=k\n\n self.depth=d\n\n\n\n for i in range(k-2,-1,-1):\n\n X[i]=calc(X[2*i+1],X[2*i+2])\n\n\n\n self.data=X\n\n\n\n def index(self,k,index=0):\n\n return self.data[(self.num-1)+(k-index)]\n\n\n\n def update(self,k,x,index=0):\n\n \"\"\"\u7b2ck\u8981\u7d20\u3092x\u306b\u5909\u3048,\u66f4\u65b0\u3092\u884c\u3046.\n\n\n\n k:\u6570\u5217\u306e\u8981\u7d20\n\n x:\u66f4\u65b0\u5f8c\u306e\u5024\n\n \"\"\"\n\n\n\n m=(self.num-1)+(k-index)\n\n self.data[m]=x\n\n\n\n for _ in range(self.depth):\n\n m=(m-1)\/\/2\n\n self.data[m]=self.calc(self.data[2*m+1],self.data[2*m+2])\n\n\n\n\n\n def sub_array(self,From,To,index=0,left_closed=True,right_closed=True):\n\n A=From-index+(not left_closed)\n\n B=To-index-(not right_closed)\n\n\n\n return self.__sub_array_second(A,B+1,0,0,self.num)\n\n\n\n def __sub_array_second(self,a,b,k,l,r):\n\n if r<=a or b<=l:\n\n return self.unit\n\n elif a<=l and r<=b:\n\n return self.data[k]\n\n else:\n\n alpha=self.__sub_array_second(a,b,2*k+1,l,(l+r)\/\/2)\n\n beta=self.__sub_array_second(a,b,2*k+2,(l+r)\/\/2,r)\n\n return self.calc(alpha,beta)\n\n\n\n def all_prod(self):\n\n return self.data[0]\n\n\n\n def max_right(self,l,r,cond,index=0):\n\n \"\"\"\u4ee5\u4e0b\u306e2\u3064\u3092\u3068\u3082\u306b\u6e80\u305f\u3059x\u306e1\u3064\u3092\u8fd4\u3059.\\n\n\n (1) r=l or cond(data[l]*data[l+1]*...*d[r-1]):True\n\n (2) r=x or cond(data[l]*data[l+1]*...*data[r]):False\n\n \u203bf\u304c\u5358\u8abf\u6e1b\u5c11\u306e\u6642,cond(data[l]*...*data[r-1])\u3092\u6e80\u305f\u3059\u6700\u5927\u306er\u3068\u306a\u308b.\n\n\n\n cond:\u95a2\u6570(\u5f15\u6570\u304c\u540c\u3058\u306a\u3089\u3070\u7d50\u679c\u3082\u540c\u3058)\n\n cond(unit):True\n\n 0<=l<=r<=n\n\n \"\"\"\n\n l-=index\n\n assert 0<=l<=r<=self.num,\"\u6dfb\u5b57\u304c\u7bc4\u56f2\u5916\"\n\n assert cond(self.unit),\"\u5358\u4f4d\u5143\u304c\u6761\u4ef6\u3092\u6e80\u305f\u3055\u306a\u3044.\"\n\n\n\n if l==r:\n\n return r+index\n\n\n\n l+=(self.num-1)\n\n sm=self.unit\n\n\n\n calc=self.calc\n\n while True:\n\n while l%2:\n\n l=(l-1)>>1\n\n\n\n if not cond(calc(sm,self.data[l])):\n\n while l>1\n\n\n\n if not cond(calc(sm,self.data[l])):\n\n while l> 1\n if not cond(calc(sm, self.data[l])):\n while l < self.num - 1:\n l = 2 * l + 1\n if cond(calc(sm, self.data[l])):\n sm = calc(sm, self.data[l])\n l += 1\n return min(l - (self.num - 1) + index, r)\n sm = calc(sm, self.data[l])\n l += 1\n m = l + 1\n if not (m & (-m) != m):\n break\n return r + index\n\n\n# ================================================\nN, Q = list(map(int, input().split()))\nA = list(map(int, input().split()))\nS = Segment_Tree(N, lambda x, y: max(x, y), -float(\"inf\"), A)\nX = []\nfor _ in range(Q):\n T, alpha, beta = list(map(int, input().split()))\n if T == 1:\n S.update(alpha, beta, 1)\n elif T == 2:\n X.append(S.sub_array(alpha, beta, 1))\n else:\n X.append(S.max_right(alpha, N, lambda x: x < beta, 1))\nprint((\"\\n\".join(map(str, X))))\n","code_v1_no_empty_lines":"class Segment_Tree:\n def __init__(self, N, calc, unit, L=[]):\n \"\"\"calc\u3092\u6f14\u7b97\u3068\u3059\u308bN\u9805\u306eSegment Tree\u3092\u4f5c\u6210\n N:\u8981\u7d20\u6570\n calc:\u6f14\u7b97(2\u5909\u6570\u95a2\u6570,\u30e2\u30ce\u30a4\u30c9)\n unit:\u30e2\u30ce\u30a4\u30c9calc\u306e\u5358\u4f4d\u5143 (xe=ex=x\u3092\u6e80\u305f\u3059e)\n \"\"\"\n self.calc = calc\n self.unit = unit\n N = max(N, len(L))\n d = max(1, (N - 1).bit_length())\n k = 2**d\n X = [unit] * (k - 1) + L + [unit] * (k - len(L))\n self.num = k\n self.depth = d\n for i in range(k - 2, -1, -1):\n X[i] = calc(X[2 * i + 1], X[2 * i + 2])\n self.data = X\n\n def index(self, k, index=0):\n return self.data[(self.num - 1) + (k - index)]\n\n def update(self, k, x, index=0):\n \"\"\"\u7b2ck\u8981\u7d20\u3092x\u306b\u5909\u3048,\u66f4\u65b0\u3092\u884c\u3046.\n k:\u6570\u5217\u306e\u8981\u7d20\n x:\u66f4\u65b0\u5f8c\u306e\u5024\n \"\"\"\n m = (self.num - 1) + (k - index)\n self.data[m] = x\n for _ in range(self.depth):\n m = (m - 1) \/\/ 2\n self.data[m] = self.calc(self.data[2 * m + 1], self.data[2 * m + 2])\n\n def sub_array(self, From, To, index=0, left_closed=True, right_closed=True):\n A = From - index + (not left_closed)\n B = To - index - (not right_closed)\n return self.__sub_array_second(A, B + 1, 0, 0, self.num)\n\n def __sub_array_second(self, a, b, k, l, r):\n if r <= a or b <= l:\n return self.unit\n elif a <= l and r <= b:\n return self.data[k]\n else:\n alpha = self.__sub_array_second(a, b, 2 * k + 1, l, (l + r) \/\/ 2)\n beta = self.__sub_array_second(a, b, 2 * k + 2, (l + r) \/\/ 2, r)\n return self.calc(alpha, beta)\n\n def all_prod(self):\n return self.data[0]\n\n def max_right(self, l, r, cond, index=0):\n \"\"\"\u4ee5\u4e0b\u306e2\u3064\u3092\u3068\u3082\u306b\u6e80\u305f\u3059x\u306e1\u3064\u3092\u8fd4\u3059.\\n\n (1) r=l or cond(data[l]*data[l+1]*...*d[r-1]):True\n (2) r=x or cond(data[l]*data[l+1]*...*data[r]):False\n \u203bf\u304c\u5358\u8abf\u6e1b\u5c11\u306e\u6642,cond(data[l]*...*data[r-1])\u3092\u6e80\u305f\u3059\u6700\u5927\u306er\u3068\u306a\u308b.\n cond:\u95a2\u6570(\u5f15\u6570\u304c\u540c\u3058\u306a\u3089\u3070\u7d50\u679c\u3082\u540c\u3058)\n cond(unit):True\n 0<=l<=r<=n\n \"\"\"\n l -= index\n assert 0 <= l <= r <= self.num, \"\u6dfb\u5b57\u304c\u7bc4\u56f2\u5916\"\n assert cond(self.unit), \"\u5358\u4f4d\u5143\u304c\u6761\u4ef6\u3092\u6e80\u305f\u3055\u306a\u3044.\"\n if l == r:\n return r + index\n l += self.num - 1\n sm = self.unit\n calc = self.calc\n while True:\n while l % 2:\n l = (l - 1) >> 1\n if not cond(calc(sm, self.data[l])):\n while l < self.num - 1:\n l = 2 * l + 1\n if cond(calc(sm, self.data[l])):\n sm = calc(sm, self.data[l])\n l += 1\n return min(l - (self.num - 1) + index, r)\n sm = calc(sm, self.data[l])\n l += 1\n m = l + 1\n if not (m & (-m) != m):\n break\n return r + index\n\n\n# ================================================\nN, Q = list(map(int, input().split()))\nA = list(map(int, input().split()))\nS = Segment_Tree(N, lambda x, y: max(x, y), -1, A)\nX = []\nfor _ in range(Q):\n T, alpha, beta = list(map(int, input().split()))\n if T == 1:\n S.update(alpha, beta, 1)\n elif T == 2:\n X.append(S.sub_array(alpha, beta, 1))\n else:\n X.append(S.max_right(alpha, N, lambda x: x < beta, 1))\nprint((\"\\n\".join(map(str, X))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S = Segment_Tree(N, lambda x, y: max(x, y), -float(\"inf\"), A)","+S = Segment_Tree(N, lambda x, y: max(x, y), -1, A)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0501767175,"measured_runtime_v1":0.0491350403,"runtime_lift":1.0212002925,"key":["s456651602","s965037873"]} +{"user_id":"u814986259","problem_id":"p03252","language":"python","submission_id_v0":"s231237079","submission_id_v1":"s399564097","cpu_time_v0":231,"cpu_time_v1":57,"memory_v0":87740,"memory_v1":4016,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.32,"input":"def main():\n\n import collections\n\n S = eval(input())\n\n T = eval(input())\n\n\n\n table = collections.defaultdict(set)\n\n table2 = collections.defaultdict(set)\n\n a = []\n\n b = []\n\n\n\n for i, xy in enumerate(zip(S, T)):\n\n x, y = xy\n\n if x not in table:\n\n a.append(i)\n\n if y not in table2:\n\n b.append(i)\n\n\n\n table[x].add(i)\n\n table2[y].add(i)\n\n\n\n flag = True\n\n\n\n if a != b:\n\n flag = False\n\n\n\n for i in a:\n\n if flag:\n\n if table[S[i]] == table2[T[i]]:\n\n continue\n\n else:\n\n flag = False\n\n break\n\n if flag:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")\n\n\n\n\n\nmain()\n","target":"def main():\n\n import collections\n\n S = eval(input())\n\n T = eval(input())\n\n N = len(S)\n\n table = collections.defaultdict(int)\n\n table2 = collections.defaultdict(int)\n\n flag = True\n\n for i in range(N):\n\n x = S[i]\n\n y = T[i]\n\n\n\n if x in table:\n\n if y == T[table[x]]:\n\n continue\n\n else:\n\n flag = False\n\n break\n\n else:\n\n if y in table2:\n\n flag = False\n\n break\n\n table[x] = i\n\n table2[y] = i\n\n\n\n if flag:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")\n\n\n\n\n\nmain()\n","code_v0_loc":39,"code_v1_loc":32,"code_v0_num_chars":721,"code_v1_num_chars":638,"code_v0_no_empty_lines":"def main():\n import collections\n\n S = eval(input())\n T = eval(input())\n table = collections.defaultdict(set)\n table2 = collections.defaultdict(set)\n a = []\n b = []\n for i, xy in enumerate(zip(S, T)):\n x, y = xy\n if x not in table:\n a.append(i)\n if y not in table2:\n b.append(i)\n table[x].add(i)\n table2[y].add(i)\n flag = True\n if a != b:\n flag = False\n for i in a:\n if flag:\n if table[S[i]] == table2[T[i]]:\n continue\n else:\n flag = False\n break\n if flag:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nmain()\n","code_v1_no_empty_lines":"def main():\n import collections\n\n S = eval(input())\n T = eval(input())\n N = len(S)\n table = collections.defaultdict(int)\n table2 = collections.defaultdict(int)\n flag = True\n for i in range(N):\n x = S[i]\n y = T[i]\n if x in table:\n if y == T[table[x]]:\n continue\n else:\n flag = False\n break\n else:\n if y in table2:\n flag = False\n break\n table[x] = i\n table2[y] = i\n if flag:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":17.9487179487,"diff":["- table = collections.defaultdict(set)","- table2 = collections.defaultdict(set)","- a = []","- b = []","- for i, xy in enumerate(zip(S, T)):","- x, y = xy","- if x not in table:","- a.append(i)","- if y not in table2:","- b.append(i)","- table[x].add(i)","- table2[y].add(i)","+ N = len(S)","+ table = collections.defaultdict(int)","+ table2 = collections.defaultdict(int)","- if a != b:","- flag = False","- for i in a:","- if flag:","- if table[S[i]] == table2[T[i]]:","+ for i in range(N):","+ x = S[i]","+ y = T[i]","+ if x in table:","+ if y == T[table[x]]:","+ else:","+ if y in table2:","+ flag = False","+ break","+ table[x] = i","+ table2[y] = i"],"diff_only_import_comment":false,"measured_runtime_v0":0.0460354013,"measured_runtime_v1":0.0459879036,"runtime_lift":1.0010328311,"key":["s231237079","s399564097"]} +{"user_id":"u495863042","problem_id":"p04029","language":"python","submission_id_v0":"s121047303","submission_id_v1":"s597322586","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"N=int(eval(input()))\n\nprint((N*(N+1)\/\/2))\n","target":"n=int(eval(input()))\n\ni=0\n\nfor m in range(n+1):\n\n\ti=i+m\n\nprint(i)\n","code_v0_loc":2,"code_v1_loc":5,"code_v0_num_chars":34,"code_v1_num_chars":60,"code_v0_no_empty_lines":"N = int(eval(input()))\nprint((N * (N + 1) \/\/ 2))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ni = 0\nfor m in range(n + 1):\n i = i + m\nprint(i)\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-N = int(eval(input()))","-print((N * (N + 1) \/\/ 2))","+n = int(eval(input()))","+i = 0","+for m in range(n + 1):","+ i = i + m","+print(i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0534689341,"measured_runtime_v1":0.0383564618,"runtime_lift":1.3940006869,"key":["s121047303","s597322586"]} +{"user_id":"u396210538","problem_id":"p02696","language":"python","submission_id_v0":"s744782890","submission_id_v1":"s761574471","cpu_time_v0":302,"cpu_time_v1":60,"memory_v0":79732,"memory_v1":61916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.13,"input":"from sys import stdin\n\nimport sys\n\n\n\nA, B, N = [int(x) for x in stdin.readline().rstrip().split()]\n\n# N, M = [int(x) for x in stdin.readline().rstrip().split()]\n\n# U = input().split()\n\nx=min(B-1,N)\n\nans = int((A*x)\/B)-A*int(x\/B)\n\nprint(ans)\n\n# if N >= B:","target":"from sys import stdin\n\nimport sys\n\n \n\nA, B, N = [int(x) for x in stdin.readline().rstrip().split()]\n\n# N, M = [int(x) for x in stdin.readline().rstrip().split()]\n\n# U = input().split()\n\nans = int((A*N)\/B)-A*int(N\/B)\n\nans2=0\n\nif B-1= B:\n","code_v1_no_empty_lines":"from sys import stdin\nimport sys\n\nA, B, N = [int(x) for x in stdin.readline().rstrip().split()]\n# N, M = [int(x) for x in stdin.readline().rstrip().split()]\n# U = input().split()\nans = int((A * N) \/ B) - A * int(N \/ B)\nans2 = 0\nif B - 1 < N:\n ans = int((A * (B - 1)) \/ B) - A * int((B - 1) \/ B)\nelse:\n ans2 = 0\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-x = min(B - 1, N)","-ans = int((A * x) \/ B) - A * int(x \/ B)","+ans = int((A * N) \/ B) - A * int(N \/ B)","+ans2 = 0","+if B - 1 < N:","+ ans = int((A * (B - 1)) \/ B) - A * int((B - 1) \/ B)","+else:","+ ans2 = 0","-# if N >= B:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0388443327,"measured_runtime_v1":0.0342596973,"runtime_lift":1.1338200793,"key":["s744782890","s761574471"]} +{"user_id":"u380524497","problem_id":"p02873","language":"python","submission_id_v0":"s911920417","submission_id_v1":"s439427655","cpu_time_v0":710,"cpu_time_v1":390,"memory_v0":23232,"memory_v1":23336,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.07,"input":"S = '>' + eval(input()) + '<='\n\nl = len(S)\n\nA = [0] * (l-2)\n\nzero_posi = []\n\nmax_posi = []\n\n\n\nfor i in range(l-2):\n\n now = S[i]\n\n nex = S[i+1]\n\n if S[i] == '>' and S[i+1] =='<':\n\n A[i] = 0\n\n zero_posi.append(i)\n\n\n\nwhile zero_posi:\n\n start = zero_posi.pop()\n\n count = 0\n\n for i in range(start, -1, -1):\n\n A[i] = max(A[i], count)\n\n count += 1\n\n if S[i-1] == '<':\n\n A[i-1] = max(A[i], count)\n\n break\n\n\n\n count = 0\n\n for i in range(start, l-2):\n\n A[i] = max(A[i], count)\n\n count += 1\n\n if S[i + 1] == '>':\n\n break\n\n\n\nans = sum(A)\n\nprint(ans)","target":"S = eval(input())\n\nl = len(S)\n\nA = [0] * (l+1)\n\n\n\ncount = 0\n\nfor i, s in enumerate(S):\n\n if s == '>':\n\n count = 0\n\n else:\n\n count += 1\n\n A[i+1] = count\n\n\n\ncount = 0\n\nfor i in range(l-1, -1, -1):\n\n s = S[i]\n\n if s == '<':\n\n count = 0\n\n else:\n\n count += 1\n\n A[i] = max(A[i], count)\n\n\n\nprint((sum(A)))","code_v0_loc":32,"code_v1_loc":22,"code_v0_num_chars":644,"code_v1_num_chars":347,"code_v0_no_empty_lines":"S = \">\" + eval(input()) + \"<=\"\nl = len(S)\nA = [0] * (l - 2)\nzero_posi = []\nmax_posi = []\nfor i in range(l - 2):\n now = S[i]\n nex = S[i + 1]\n if S[i] == \">\" and S[i + 1] == \"<\":\n A[i] = 0\n zero_posi.append(i)\nwhile zero_posi:\n start = zero_posi.pop()\n count = 0\n for i in range(start, -1, -1):\n A[i] = max(A[i], count)\n count += 1\n if S[i - 1] == \"<\":\n A[i - 1] = max(A[i], count)\n break\n count = 0\n for i in range(start, l - 2):\n A[i] = max(A[i], count)\n count += 1\n if S[i + 1] == \">\":\n break\nans = sum(A)\nprint(ans)\n","code_v1_no_empty_lines":"S = eval(input())\nl = len(S)\nA = [0] * (l + 1)\ncount = 0\nfor i, s in enumerate(S):\n if s == \">\":\n count = 0\n else:\n count += 1\n A[i + 1] = count\ncount = 0\nfor i in range(l - 1, -1, -1):\n s = S[i]\n if s == \"<\":\n count = 0\n else:\n count += 1\n A[i] = max(A[i], count)\nprint((sum(A)))\n","code_same":false,"relative_loc_diff_percent":31.25,"diff":["-S = \">\" + eval(input()) + \"<=\"","+S = eval(input())","-A = [0] * (l - 2)","-zero_posi = []","-max_posi = []","-for i in range(l - 2):","- now = S[i]","- nex = S[i + 1]","- if S[i] == \">\" and S[i + 1] == \"<\":","- A[i] = 0","- zero_posi.append(i)","-while zero_posi:","- start = zero_posi.pop()","- count = 0","- for i in range(start, -1, -1):","+A = [0] * (l + 1)","+count = 0","+for i, s in enumerate(S):","+ if s == \">\":","+ count = 0","+ else:","+ count += 1","+ A[i + 1] = count","+count = 0","+for i in range(l - 1, -1, -1):","+ s = S[i]","+ if s == \"<\":","+ count = 0","+ else:","+ count += 1","- count += 1","- if S[i - 1] == \"<\":","- A[i - 1] = max(A[i], count)","- break","- count = 0","- for i in range(start, l - 2):","- A[i] = max(A[i], count)","- count += 1","- if S[i + 1] == \">\":","- break","-ans = sum(A)","-print(ans)","+print((sum(A)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0388372837,"measured_runtime_v1":0.0384156478,"runtime_lift":1.0109756279,"key":["s911920417","s439427655"]} +{"user_id":"u022407960","problem_id":"p02308","language":"python","submission_id_v0":"s114281226","submission_id_v1":"s274967766","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7908,"memory_v1":7912,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"#!\/usr\/bin\/env python\n\n# -*- coding: utf-8 -*-\n\n\n\n\"\"\"\n\ninput:\n\n2 1 1\n\n2\n\n0 1 4 1\n\n3 0 3 3\n\n\n\noutput:\n\n1.00000000 1.00000000 3.00000000 1.00000000\n\n3.00000000 1.00000000 3.00000000 1.00000000\n\n\"\"\"\n\n\n\nimport sys\n\nimport math\n\n\n\n\n\nclass Segment(object):\n\n __slots__ = ('source', 'target')\n\n\n\n def __init__(self, source, target):\n\n self.source = complex(source)\n\n self.target = complex(target)\n\n\n\n\n\nclass Circle(object):\n\n __slots__ = ('centre', 'radius')\n\n\n\n def __init__(self, x, y, r):\n\n self.centre = x + y * 1j\n\n self.radius = r\n\n\n\n\n\ndef dot(a, b):\n\n return a.real * b.real + a.imag * b.imag\n\n\n\n\n\ndef project(s, p):\n\n base_vector = s.target - s.source\n\n prj_ratio = dot(p - s.source, base_vector) \/ pow(abs(base_vector), 2)\n\n return s.source + base_vector * prj_ratio\n\n\n\n\n\ndef get_cross_point(c, l):\n\n prj_vector = project(l, c.centre)\n\n line_unit_vector = (l.target - l.source) \/ (abs(l.target - l.source))\n\n base = math.sqrt(pow(c.radius, 2) - pow(abs(prj_vector - c.centre), 2))\n\n p1, p2 = prj_vector + line_unit_vector * base, prj_vector - line_unit_vector * base\n\n\n\n if p1.real < p2.real:\n\n ans = (p1, p2)\n\n elif p1.real == p2.real:\n\n if p1.imag < p2.imag:\n\n ans = (p1, p2)\n\n else:\n\n ans = (p2, p1)\n\n else:\n\n ans = (p2, p1)\n\n return ans\n\n\n\n\n\ndef solve(_lines):\n\n for line in _lines:\n\n line_axis = tuple(map(int, line))\n\n p0, p1 = (x + y * 1j for x, y in zip(line_axis[::2], line_axis[1::2]))\n\n l = Segment(p0, p1)\n\n cp1, cp2 = get_cross_point(circle, l)\n\n print(('{0:.8f} {1:.8f} {2:.8f} {3:.8f}'.format(cp1.real, cp1.imag, cp2.real, cp2.imag)))\n\n\n\n return None\n\n\n\n\n\nif __name__ == '__main__':\n\n _input = sys.stdin.readlines()\n\n\n\n cx, cy, radius = list(map(int, _input[0].split()))\n\n q_num = int(_input[1])\n\n lines = [x.split() for x in _input[2:]]\n\n\n\n circle = Circle(cx, cy, radius)\n\n solve(lines)","target":"#!\/usr\/bin\/env python\n\n# -*- coding: utf-8 -*-\n\n\n\n\"\"\"\n\ninput:\n\n2 1 1\n\n2\n\n0 1 4 1\n\n3 0 3 3\n\n\n\noutput:\n\n1.00000000 1.00000000 3.00000000 1.00000000\n\n3.00000000 1.00000000 3.00000000 1.00000000\n\n\"\"\"\n\n\n\nimport sys\n\nimport math\n\n\n\n\n\nclass Segment(object):\n\n __slots__ = ('source', 'target')\n\n\n\n def __init__(self, source, target):\n\n self.source = complex(source)\n\n self.target = complex(target)\n\n\n\n\n\nclass Circle(object):\n\n __slots__ = ('centre', 'radius')\n\n\n\n def __init__(self, centre, radius):\n\n self.centre = complex(centre)\n\n self.radius = float(radius)\n\n\n\n\n\ndef dot(a, b):\n\n return a.real * b.real + a.imag * b.imag\n\n\n\n\n\ndef project(s, p):\n\n base_vector = s.target - s.source\n\n prj_ratio = dot(p - s.source, base_vector) \/ pow(abs(base_vector), 2)\n\n return s.source + base_vector * prj_ratio\n\n\n\n\n\ndef get_cross_point(c, l):\n\n prj_vector = project(l, c.centre)\n\n line_unit_vector = (l.target - l.source) \/ (abs(l.target - l.source))\n\n base = math.sqrt(pow(c.radius, 2) - pow(abs(prj_vector - c.centre), 2))\n\n p1, p2 = prj_vector + line_unit_vector * base, prj_vector - line_unit_vector * base\n\n\n\n if p1.real < p2.real:\n\n ans = (p1, p2)\n\n elif p1.real == p2.real:\n\n if p1.imag < p2.imag:\n\n ans = (p1, p2)\n\n else:\n\n ans = (p2, p1)\n\n else:\n\n ans = (p2, p1)\n\n return ans\n\n\n\n\n\ndef solve(_lines):\n\n for line in _lines:\n\n line_axis = tuple(map(int, line))\n\n p0, p1 = (x + y * 1j for x, y in zip(line_axis[::2], line_axis[1::2]))\n\n l = Segment(p0, p1)\n\n cp1, cp2 = get_cross_point(circle, l)\n\n print(('{0:.8f} {1:.8f} {2:.8f} {3:.8f}'.format(cp1.real, cp1.imag, cp2.real, cp2.imag)))\n\n\n\n return None\n\n\n\n\n\nif __name__ == '__main__':\n\n _input = sys.stdin.readlines()\n\n\n\n cx, cy, r = list(map(int, _input[0].split()))\n\n q_num = int(_input[1])\n\n lines = [x.split() for x in _input[2:]]\n\n\n\n circle = Circle(cx + cy * 1j, r)\n\n solve(lines)","code_v0_loc":83,"code_v1_loc":83,"code_v0_num_chars":1987,"code_v1_num_chars":2007,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python\n# -*- coding: utf-8 -*-\n\"\"\"\ninput:\n2 1 1\n2\n0 1 4 1\n3 0 3 3\noutput:\n1.00000000 1.00000000 3.00000000 1.00000000\n3.00000000 1.00000000 3.00000000 1.00000000\n\"\"\"\nimport sys\nimport math\n\n\nclass Segment(object):\n __slots__ = (\"source\", \"target\")\n\n def __init__(self, source, target):\n self.source = complex(source)\n self.target = complex(target)\n\n\nclass Circle(object):\n __slots__ = (\"centre\", \"radius\")\n\n def __init__(self, x, y, r):\n self.centre = x + y * 1j\n self.radius = r\n\n\ndef dot(a, b):\n return a.real * b.real + a.imag * b.imag\n\n\ndef project(s, p):\n base_vector = s.target - s.source\n prj_ratio = dot(p - s.source, base_vector) \/ pow(abs(base_vector), 2)\n return s.source + base_vector * prj_ratio\n\n\ndef get_cross_point(c, l):\n prj_vector = project(l, c.centre)\n line_unit_vector = (l.target - l.source) \/ (abs(l.target - l.source))\n base = math.sqrt(pow(c.radius, 2) - pow(abs(prj_vector - c.centre), 2))\n p1, p2 = prj_vector + line_unit_vector * base, prj_vector - line_unit_vector * base\n if p1.real < p2.real:\n ans = (p1, p2)\n elif p1.real == p2.real:\n if p1.imag < p2.imag:\n ans = (p1, p2)\n else:\n ans = (p2, p1)\n else:\n ans = (p2, p1)\n return ans\n\n\ndef solve(_lines):\n for line in _lines:\n line_axis = tuple(map(int, line))\n p0, p1 = (x + y * 1j for x, y in zip(line_axis[::2], line_axis[1::2]))\n l = Segment(p0, p1)\n cp1, cp2 = get_cross_point(circle, l)\n print(\n (\n \"{0:.8f} {1:.8f} {2:.8f} {3:.8f}\".format(\n cp1.real, cp1.imag, cp2.real, cp2.imag\n )\n )\n )\n return None\n\n\nif __name__ == \"__main__\":\n _input = sys.stdin.readlines()\n cx, cy, radius = list(map(int, _input[0].split()))\n q_num = int(_input[1])\n lines = [x.split() for x in _input[2:]]\n circle = Circle(cx, cy, radius)\n solve(lines)\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python\n# -*- coding: utf-8 -*-\n\"\"\"\ninput:\n2 1 1\n2\n0 1 4 1\n3 0 3 3\noutput:\n1.00000000 1.00000000 3.00000000 1.00000000\n3.00000000 1.00000000 3.00000000 1.00000000\n\"\"\"\nimport sys\nimport math\n\n\nclass Segment(object):\n __slots__ = (\"source\", \"target\")\n\n def __init__(self, source, target):\n self.source = complex(source)\n self.target = complex(target)\n\n\nclass Circle(object):\n __slots__ = (\"centre\", \"radius\")\n\n def __init__(self, centre, radius):\n self.centre = complex(centre)\n self.radius = float(radius)\n\n\ndef dot(a, b):\n return a.real * b.real + a.imag * b.imag\n\n\ndef project(s, p):\n base_vector = s.target - s.source\n prj_ratio = dot(p - s.source, base_vector) \/ pow(abs(base_vector), 2)\n return s.source + base_vector * prj_ratio\n\n\ndef get_cross_point(c, l):\n prj_vector = project(l, c.centre)\n line_unit_vector = (l.target - l.source) \/ (abs(l.target - l.source))\n base = math.sqrt(pow(c.radius, 2) - pow(abs(prj_vector - c.centre), 2))\n p1, p2 = prj_vector + line_unit_vector * base, prj_vector - line_unit_vector * base\n if p1.real < p2.real:\n ans = (p1, p2)\n elif p1.real == p2.real:\n if p1.imag < p2.imag:\n ans = (p1, p2)\n else:\n ans = (p2, p1)\n else:\n ans = (p2, p1)\n return ans\n\n\ndef solve(_lines):\n for line in _lines:\n line_axis = tuple(map(int, line))\n p0, p1 = (x + y * 1j for x, y in zip(line_axis[::2], line_axis[1::2]))\n l = Segment(p0, p1)\n cp1, cp2 = get_cross_point(circle, l)\n print(\n (\n \"{0:.8f} {1:.8f} {2:.8f} {3:.8f}\".format(\n cp1.real, cp1.imag, cp2.real, cp2.imag\n )\n )\n )\n return None\n\n\nif __name__ == \"__main__\":\n _input = sys.stdin.readlines()\n cx, cy, r = list(map(int, _input[0].split()))\n q_num = int(_input[1])\n lines = [x.split() for x in _input[2:]]\n circle = Circle(cx + cy * 1j, r)\n solve(lines)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- def __init__(self, x, y, r):","- self.centre = x + y * 1j","- self.radius = r","+ def __init__(self, centre, radius):","+ self.centre = complex(centre)","+ self.radius = float(radius)","- cx, cy, radius = list(map(int, _input[0].split()))","+ cx, cy, r = list(map(int, _input[0].split()))","- circle = Circle(cx, cy, radius)","+ circle = Circle(cx + cy * 1j, r)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0411100683,"measured_runtime_v1":0.0453482957,"runtime_lift":0.9065405367,"key":["s114281226","s274967766"]} +{"user_id":"u945181840","problem_id":"p03458","language":"python","submission_id_v0":"s208463404","submission_id_v1":"s439970233","cpu_time_v0":478,"cpu_time_v1":421,"memory_v0":128016,"memory_v1":118308,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.92,"input":"import sys\n\nimport numpy as np\n\nfrom collections import Counter\n\n\n\nread = sys.stdin\n\n\n\nN, K = list(map(int, read.readline().split()))\n\nk = 2 * K\n\nxyc = np.array(read.read().split(), np.str).reshape(-1, 3)\n\nx = xyc[:, 0].astype(int)\n\ny = xyc[:, 1].astype(int)\n\nc = xyc[:, 2]\n\n\n\nx[c == 'B'] -= K\n\nx %= k\n\ny %= k\n\n\n\n'''\n\n# grid[[1,1],[2,2]]+=1 \u3068\u3057\u3066\u3082grid[1,2]=1\u3067\u3042\u308a\u91cd\u8907\u306f\u8003\u616e\u3055\u308c\u306a\u3044\u3002\n\n# unique\u3092\u4f7f\u3063\u3066(x,y)\u306e\u91cd\u8907\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\n\n# return_count\u306fver1.9\u304b\u3089\u3060\u3063\u305f\u30fb\u30fb\u30fb \u30c0\u30e1\u3058\u3083\u3093\n\nxy, cnt = np.unique(x + y * 10000, return_counts=True)\n\nx = xy % 10000\n\ny = xy \/\/ 10000\n\n'''\n\nxy = Counter(list(zip(x.tolist(), y.tolist())))\n\ncnt = np.array(list(xy.values()), np.int64)\n\nxy = np.array(list(xy.keys()), np.int64)\n\nx = xy[:, 0]\n\ny = xy[:, 1]\n\n\n\ngrid = np.zeros((3 * K, 3 * K), np.int64)\n\ngrid[x, y] += cnt\n\ngrid[x + K, y + K] += cnt\n\ngrid[x + K, y] -= cnt\n\ngrid[x, y + K] -= cnt\n\nnp.cumsum(grid, axis=0, out=grid)\n\nnp.cumsum(grid, axis=1, out=grid)\n\n\n\np1 = grid[:K, :K] + grid[k:, k:] + grid[K:k, K:k] + grid[k:, :K] + grid[:K, k:]\n\np2 = grid[K:k, :K] + grid[K:k, k:] + grid[:K, K:k] + grid[k:, K:k]\n\nprint((max(p1.max(), p2.max())))\n","target":"import sys\n\nimport numpy as np\n\nfrom collections import Counter\n\n\n\nread = sys.stdin\n\n\n\nN, K = list(map(int, read.readline().split()))\n\nk = 2 * K\n\nxyc = np.array(read.read().split(), np.str).reshape(-1, 3)\n\nx = xyc[:, 0].astype(int)\n\ny = xyc[:, 1].astype(int)\n\nc = xyc[:, 2]\n\n\n\nx[c == 'B'] -= K\n\nx %= k\n\ny %= k\n\n\n\ngrid = np.zeros((3 * K, 3 * K), np.int64)\n\nnp.add.at(grid, (x, y), 1)\n\nnp.add.at(grid, (x + K, y + K), 1)\n\nnp.subtract.at(grid, (x + K, y), 1)\n\nnp.subtract.at(grid, (x, y + K), 1)\n\nnp.cumsum(grid, axis=0, out=grid)\n\nnp.cumsum(grid, axis=1, out=grid)\n\n\n\np1 = grid[:K, :K] + grid[k:, k:] + grid[K:k, K:k] + grid[k:, :K] + grid[:K, k:]\n\np2 = grid[K:k, :K] + grid[K:k, k:] + grid[:K, K:k] + grid[k:, K:k]\n\nprint((max(p1.max(), p2.max())))\n","code_v0_loc":42,"code_v1_loc":28,"code_v0_num_chars":1072,"code_v1_num_chars":740,"code_v0_no_empty_lines":"import sys\nimport numpy as np\nfrom collections import Counter\n\nread = sys.stdin\nN, K = list(map(int, read.readline().split()))\nk = 2 * K\nxyc = np.array(read.read().split(), np.str).reshape(-1, 3)\nx = xyc[:, 0].astype(int)\ny = xyc[:, 1].astype(int)\nc = xyc[:, 2]\nx[c == \"B\"] -= K\nx %= k\ny %= k\n\"\"\"\n# grid[[1,1],[2,2]]+=1 \u3068\u3057\u3066\u3082grid[1,2]=1\u3067\u3042\u308a\u91cd\u8907\u306f\u8003\u616e\u3055\u308c\u306a\u3044\u3002\n# unique\u3092\u4f7f\u3063\u3066(x,y)\u306e\u91cd\u8907\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\n# return_count\u306fver1.9\u304b\u3089\u3060\u3063\u305f\u30fb\u30fb\u30fb \u30c0\u30e1\u3058\u3083\u3093\nxy, cnt = np.unique(x + y * 10000, return_counts=True)\nx = xy % 10000\ny = xy \/\/ 10000\n\"\"\"\nxy = Counter(list(zip(x.tolist(), y.tolist())))\ncnt = np.array(list(xy.values()), np.int64)\nxy = np.array(list(xy.keys()), np.int64)\nx = xy[:, 0]\ny = xy[:, 1]\ngrid = np.zeros((3 * K, 3 * K), np.int64)\ngrid[x, y] += cnt\ngrid[x + K, y + K] += cnt\ngrid[x + K, y] -= cnt\ngrid[x, y + K] -= cnt\nnp.cumsum(grid, axis=0, out=grid)\nnp.cumsum(grid, axis=1, out=grid)\np1 = grid[:K, :K] + grid[k:, k:] + grid[K:k, K:k] + grid[k:, :K] + grid[:K, k:]\np2 = grid[K:k, :K] + grid[K:k, k:] + grid[:K, K:k] + grid[k:, K:k]\nprint((max(p1.max(), p2.max())))\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\nfrom collections import Counter\n\nread = sys.stdin\nN, K = list(map(int, read.readline().split()))\nk = 2 * K\nxyc = np.array(read.read().split(), np.str).reshape(-1, 3)\nx = xyc[:, 0].astype(int)\ny = xyc[:, 1].astype(int)\nc = xyc[:, 2]\nx[c == \"B\"] -= K\nx %= k\ny %= k\ngrid = np.zeros((3 * K, 3 * K), np.int64)\nnp.add.at(grid, (x, y), 1)\nnp.add.at(grid, (x + K, y + K), 1)\nnp.subtract.at(grid, (x + K, y), 1)\nnp.subtract.at(grid, (x, y + K), 1)\nnp.cumsum(grid, axis=0, out=grid)\nnp.cumsum(grid, axis=1, out=grid)\np1 = grid[:K, :K] + grid[k:, k:] + grid[K:k, K:k] + grid[k:, :K] + grid[:K, k:]\np2 = grid[K:k, :K] + grid[K:k, k:] + grid[:K, K:k] + grid[k:, K:k]\nprint((max(p1.max(), p2.max())))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-\"\"\"","-# grid[[1,1],[2,2]]+=1 \u3068\u3057\u3066\u3082grid[1,2]=1\u3067\u3042\u308a\u91cd\u8907\u306f\u8003\u616e\u3055\u308c\u306a\u3044\u3002","-# unique\u3092\u4f7f\u3063\u3066(x,y)\u306e\u91cd\u8907\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b","-# return_count\u306fver1.9\u304b\u3089\u3060\u3063\u305f\u30fb\u30fb\u30fb \u30c0\u30e1\u3058\u3083\u3093","-xy, cnt = np.unique(x + y * 10000, return_counts=True)","-x = xy % 10000","-y = xy \/\/ 10000","-\"\"\"","-xy = Counter(list(zip(x.tolist(), y.tolist())))","-cnt = np.array(list(xy.values()), np.int64)","-xy = np.array(list(xy.keys()), np.int64)","-x = xy[:, 0]","-y = xy[:, 1]","-grid[x, y] += cnt","-grid[x + K, y + K] += cnt","-grid[x + K, y] -= cnt","-grid[x, y + K] -= cnt","+np.add.at(grid, (x, y), 1)","+np.add.at(grid, (x + K, y + K), 1)","+np.subtract.at(grid, (x + K, y), 1)","+np.subtract.at(grid, (x, y + K), 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2910422037,"measured_runtime_v1":0.284889658,"runtime_lift":1.0215962409,"key":["s208463404","s439970233"]} +{"user_id":"u296518383","problem_id":"p03274","language":"python","submission_id_v0":"s068694968","submission_id_v1":"s782410629","cpu_time_v0":221,"cpu_time_v1":96,"memory_v0":62704,"memory_v1":14536,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.56,"input":"N, K = list(map(int, input().split()))\n\nX = list(map(int, input().split()))\n\n\n\nanswer = []\n\nfor i in range(N):\n\n if i + K > N:\n\n break\n\n Ys, Yt = X[i], X[i+K-1]\n\n if Ys > 0:\n\n answer.append(Yt)\n\n elif Yt < 0:\n\n answer.append(-Ys)\n\n else:\n\n answer.append(min(Ys*(-2)+Yt, Yt*2-Ys))\n\n\n\nprint((min(answer)))","target":"N, K = list(map(int, input().split()))\n\nX = list(map(int, input().split()))\n\n\n\nanswer = 10 ** 18\n\nfor i in range(N - K + 1):\n\n left, right = i, i + K - 1\n\n al, ar = abs(X[left]), abs(X[right])\n\n if X[left] * X[right] >= 0:\n\n answer = min(answer, max(al, ar))\n\n else:\n\n answer = min(answer, al * 2 + ar, al + ar * 2)\n\n \n\nprint(answer)","code_v0_loc":16,"code_v1_loc":13,"code_v0_num_chars":312,"code_v1_num_chars":360,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nX = list(map(int, input().split()))\nanswer = []\nfor i in range(N):\n if i + K > N:\n break\n Ys, Yt = X[i], X[i + K - 1]\n if Ys > 0:\n answer.append(Yt)\n elif Yt < 0:\n answer.append(-Ys)\n else:\n answer.append(min(Ys * (-2) + Yt, Yt * 2 - Ys))\nprint((min(answer)))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nX = list(map(int, input().split()))\nanswer = 10**18\nfor i in range(N - K + 1):\n left, right = i, i + K - 1\n al, ar = abs(X[left]), abs(X[right])\n if X[left] * X[right] >= 0:\n answer = min(answer, max(al, ar))\n else:\n answer = min(answer, al * 2 + ar, al + ar * 2)\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-answer = []","-for i in range(N):","- if i + K > N:","- break","- Ys, Yt = X[i], X[i + K - 1]","- if Ys > 0:","- answer.append(Yt)","- elif Yt < 0:","- answer.append(-Ys)","+answer = 10**18","+for i in range(N - K + 1):","+ left, right = i, i + K - 1","+ al, ar = abs(X[left]), abs(X[right])","+ if X[left] * X[right] >= 0:","+ answer = min(answer, max(al, ar))","- answer.append(min(Ys * (-2) + Yt, Yt * 2 - Ys))","-print((min(answer)))","+ answer = min(answer, al * 2 + ar, al + ar * 2)","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0406301425,"measured_runtime_v1":0.1269641728,"runtime_lift":0.3200126582,"key":["s068694968","s782410629"]} +{"user_id":"u677121387","problem_id":"p02768","language":"python","submission_id_v0":"s709206966","submission_id_v1":"s846379786","cpu_time_v0":162,"cpu_time_v1":144,"memory_v0":18804,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"n,a,b = list(map(int,input().split()))\n\nmod = 10**9+7\n\na = min(a,n-a)\n\nb = min(b,n-b)\n\nm = max(a,b)\n\nX = [0]*(m+1)\n\nY = [0]*(m+1)\n\nX[0] = 1\n\nX[1] = n\n\nY[0] = Y[1] = 1\n\n\n\nfor i in range(2,m+1):\n\n X[i] = X[i-1]*(n-i+1)%mod\n\n Y[i] = Y[i-1]*i%mod\n\n \n\nans = (((pow(2,n,mod)-1)%mod-X[a]*pow(Y[a],mod-2,mod)%mod)%mod-X[b]*pow(Y[b],mod-2,mod)%mod)%mod\n\nprint(ans)","target":"n,a,b = list(map(int,input().split()))\n\nmod = 10**9+7\n\ndef combmod(n,k,mod):\n\n x = y = 1\n\n for i in range(min(k,n-k)):\n\n x = x*(n-i)%mod\n\n y = y*(i+1)%mod\n\n return x * pow(y, mod-2, mod) % mod\n\nans = (((pow(2, n, mod) - 1)%mod - combmod(n, a, mod))%mod - combmod(n, b, mod))%mod\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":10,"code_v0_num_chars":358,"code_v1_num_chars":307,"code_v0_no_empty_lines":"n, a, b = list(map(int, input().split()))\nmod = 10**9 + 7\na = min(a, n - a)\nb = min(b, n - b)\nm = max(a, b)\nX = [0] * (m + 1)\nY = [0] * (m + 1)\nX[0] = 1\nX[1] = n\nY[0] = Y[1] = 1\nfor i in range(2, m + 1):\n X[i] = X[i - 1] * (n - i + 1) % mod\n Y[i] = Y[i - 1] * i % mod\nans = (\n ((pow(2, n, mod) - 1) % mod - X[a] * pow(Y[a], mod - 2, mod) % mod) % mod\n - X[b] * pow(Y[b], mod - 2, mod) % mod\n) % mod\nprint(ans)\n","code_v1_no_empty_lines":"n, a, b = list(map(int, input().split()))\nmod = 10**9 + 7\n\n\ndef combmod(n, k, mod):\n x = y = 1\n for i in range(min(k, n - k)):\n x = x * (n - i) % mod\n y = y * (i + 1) % mod\n return x * pow(y, mod - 2, mod) % mod\n\n\nans = (\n ((pow(2, n, mod) - 1) % mod - combmod(n, a, mod)) % mod - combmod(n, b, mod)\n) % mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":41.1764705882,"diff":["-a = min(a, n - a)","-b = min(b, n - b)","-m = max(a, b)","-X = [0] * (m + 1)","-Y = [0] * (m + 1)","-X[0] = 1","-X[1] = n","-Y[0] = Y[1] = 1","-for i in range(2, m + 1):","- X[i] = X[i - 1] * (n - i + 1) % mod","- Y[i] = Y[i - 1] * i % mod","+","+","+def combmod(n, k, mod):","+ x = y = 1","+ for i in range(min(k, n - k)):","+ x = x * (n - i) % mod","+ y = y * (i + 1) % mod","+ return x * pow(y, mod - 2, mod) % mod","+","+","- ((pow(2, n, mod) - 1) % mod - X[a] * pow(Y[a], mod - 2, mod) % mod) % mod","- - X[b] * pow(Y[b], mod - 2, mod) % mod","+ ((pow(2, n, mod) - 1) % mod - combmod(n, a, mod)) % mod - combmod(n, b, mod)"],"diff_only_import_comment":false,"measured_runtime_v0":0.184739816,"measured_runtime_v1":0.0974404395,"runtime_lift":1.8959255208,"key":["s709206966","s846379786"]} +{"user_id":"u439396449","problem_id":"p03266","language":"python","submission_id_v0":"s196649884","submission_id_v1":"s947896858","cpu_time_v0":97,"cpu_time_v1":17,"memory_v0":4596,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.47,"input":"N, K = list(map(int, input().split()))\n\n\n\nnum = [0] * K\n\nfor i in range(1, N + 1):\n\n num[i % K] += 1\n\n\n\nres = 0\n\nfor a in range(K):\n\n b = (K - a) % K\n\n c = (K - a) % K\n\n if (b + c) % K == 0:\n\n res += num[a] * num[b] * num[c]\n\nprint(res)","target":"N, K = list(map(int, input().split()))\n\n\n\nx = N \/\/ K\n\nans = x ** 3\n\nif K % 2 == 0:\n\n y = (N + (K \/\/ 2)) \/\/ K\n\n ans += y ** 3\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":8,"code_v0_num_chars":249,"code_v1_num_chars":137,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nnum = [0] * K\nfor i in range(1, N + 1):\n num[i % K] += 1\nres = 0\nfor a in range(K):\n b = (K - a) % K\n c = (K - a) % K\n if (b + c) % K == 0:\n res += num[a] * num[b] * num[c]\nprint(res)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nx = N \/\/ K\nans = x**3\nif K % 2 == 0:\n y = (N + (K \/\/ 2)) \/\/ K\n ans += y**3\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":38.4615384615,"diff":["-num = [0] * K","-for i in range(1, N + 1):","- num[i % K] += 1","-res = 0","-for a in range(K):","- b = (K - a) % K","- c = (K - a) % K","- if (b + c) % K == 0:","- res += num[a] * num[b] * num[c]","-print(res)","+x = N \/\/ K","+ans = x**3","+if K % 2 == 0:","+ y = (N + (K \/\/ 2)) \/\/ K","+ ans += y**3","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0386705875,"measured_runtime_v1":0.0314473152,"runtime_lift":1.2296944035,"key":["s196649884","s947896858"]} +{"user_id":"u020604402","problem_id":"p03738","language":"python","submission_id_v0":"s933998927","submission_id_v1":"s695288771","cpu_time_v0":163,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.57,"input":"A = int(eval(input()))\n\nB = int(eval(input()))\n\n\n\nif A > B :\n\n print('GREATER')\n\nelif A == B:\n\n print('EQUAL')\n\nelse:\n\n print('LESS')\n","target":"\n\nA = list(eval(input()))\n\nB = list(eval(input()))\n\n\n\nif len(A) > len(B):\n\n print(\"GREATER\")\n\nelif len(B) > len(A):\n\n print(\"LESS\")\n\nelse:\n\n for i in range(len(A)):\n\n if int(A[i]) > int(B[i]):\n\n print(\"GREATER\")\n\n quit()\n\n elif int(A[i]) < int(B[i]):\n\n print(\"LESS\")\n\n quit()\n\n else:\n\n if i == len(A) - 1 and int(A[i])==int(B[i]):\n\n print(\"EQUAL\")\n","code_v0_loc":9,"code_v1_loc":19,"code_v0_num_chars":131,"code_v1_num_chars":437,"code_v0_no_empty_lines":"A = int(eval(input()))\nB = int(eval(input()))\nif A > B:\n print(\"GREATER\")\nelif A == B:\n print(\"EQUAL\")\nelse:\n print(\"LESS\")\n","code_v1_no_empty_lines":"A = list(eval(input()))\nB = list(eval(input()))\nif len(A) > len(B):\n print(\"GREATER\")\nelif len(B) > len(A):\n print(\"LESS\")\nelse:\n for i in range(len(A)):\n if int(A[i]) > int(B[i]):\n print(\"GREATER\")\n quit()\n elif int(A[i]) < int(B[i]):\n print(\"LESS\")\n quit()\n else:\n if i == len(A) - 1 and int(A[i]) == int(B[i]):\n print(\"EQUAL\")\n","code_same":false,"relative_loc_diff_percent":52.6315789474,"diff":["-A = int(eval(input()))","-B = int(eval(input()))","-if A > B:","+A = list(eval(input()))","+B = list(eval(input()))","+if len(A) > len(B):","-elif A == B:","- print(\"EQUAL\")","+elif len(B) > len(A):","+ print(\"LESS\")","- print(\"LESS\")","+ for i in range(len(A)):","+ if int(A[i]) > int(B[i]):","+ print(\"GREATER\")","+ quit()","+ elif int(A[i]) < int(B[i]):","+ print(\"LESS\")","+ quit()","+ else:","+ if i == len(A) - 1 and int(A[i]) == int(B[i]):","+ print(\"EQUAL\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1411862576,"measured_runtime_v1":0.0428478591,"runtime_lift":3.2950597857,"key":["s933998927","s695288771"]} +{"user_id":"u411203878","problem_id":"p03712","language":"python","submission_id_v0":"s204936105","submission_id_v1":"s230256678","cpu_time_v0":182,"cpu_time_v1":65,"memory_v0":39024,"memory_v1":65664,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.29,"input":"h, w = (int(x) for x in input().split())\n\nab=[]\n\nab.append(['#']*(w+2))\n\nfor _ in range(h):\n\n s=eval(input())\n\n s=list(s)\n\n s =['#'] + s + ['#']\n\n ab.append(s)\n\nab.append(['#']*(w+2))\n\n\n\nfor i in range(h+2):\n\n k=ab[i]\n\n print((''.join(map(str,k))))\n","target":"H,W = list(map(int,input().split()))\n\n\n\nans = []\n\n\n\ntop = ['#']*(W+2)\n\n\n\nans.append(top)\n\n\n\nfor i in range(H):\n\n t = list(eval(input()))\n\n t = ['#'] + t + ['#']\n\n ans.append(t)\n\n\n\nans.append(top)\n\n\n\nfor aa in ans:\n\n print((''.join(map(str,aa))))","code_v0_loc":13,"code_v1_loc":17,"code_v0_num_chars":259,"code_v1_num_chars":243,"code_v0_no_empty_lines":"h, w = (int(x) for x in input().split())\nab = []\nab.append([\"#\"] * (w + 2))\nfor _ in range(h):\n s = eval(input())\n s = list(s)\n s = [\"#\"] + s + [\"#\"]\n ab.append(s)\nab.append([\"#\"] * (w + 2))\nfor i in range(h + 2):\n k = ab[i]\n print((\"\".join(map(str, k))))\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nans = []\ntop = [\"#\"] * (W + 2)\nans.append(top)\nfor i in range(H):\n t = list(eval(input()))\n t = [\"#\"] + t + [\"#\"]\n ans.append(t)\nans.append(top)\nfor aa in ans:\n print((\"\".join(map(str, aa))))\n","code_same":false,"relative_loc_diff_percent":23.5294117647,"diff":["-h, w = (int(x) for x in input().split())","-ab = []","-ab.append([\"#\"] * (w + 2))","-for _ in range(h):","- s = eval(input())","- s = list(s)","- s = [\"#\"] + s + [\"#\"]","- ab.append(s)","-ab.append([\"#\"] * (w + 2))","-for i in range(h + 2):","- k = ab[i]","- print((\"\".join(map(str, k))))","+H, W = list(map(int, input().split()))","+ans = []","+top = [\"#\"] * (W + 2)","+ans.append(top)","+for i in range(H):","+ t = list(eval(input()))","+ t = [\"#\"] + t + [\"#\"]","+ ans.append(t)","+ans.append(top)","+for aa in ans:","+ print((\"\".join(map(str, aa))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0681771525,"measured_runtime_v1":0.0747810829,"runtime_lift":0.9116898255,"key":["s204936105","s230256678"]} +{"user_id":"u775681539","problem_id":"p02936","language":"python","submission_id_v0":"s418711873","submission_id_v1":"s984289269","cpu_time_v0":1655,"cpu_time_v1":1133,"memory_v0":135444,"memory_v1":53000,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.54,"input":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nfrom copy import deepcopy\n\nfrom collections import deque\n\ndef main():\n\n N, Q = map(int, readline().split())\n\n m = map(int, read().split())\n\n n = deepcopy(m)\n\n to = [[] for _ in range(N)]\n\n for a, b in [(a-1, b-1) for a, b in zip(m, m)][:N-1]:\n\n to[a].append(b)\n\n to[b].append(a)\n\n score = [0 for _ in range(N)]\n\n for p, x in [(p-1, x) for p, x in zip(n, n)][N-1:]:\n\n score[p] += x\n\n\n\n dq = deque()\n\n dq.append(0)\n\n done = [0 for _ in range(N)]\n\n done[0] = 1\n\n while len(dq)>0:\n\n node = dq.popleft()\n\n for nx in to[node]: \n\n if done[nx] == 1:\n\n continue \n\n done[nx] = 1\n\n score[nx] += score[node]\n\n dq.append(nx)\n\n for i in score:\n\n print(i, end=' ')\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom collections import deque \n\ndef main():\n\n N, Q = map(int, readline().split())\n\n to = [[] for _ in range(N)]\n\n for _ in range(N-1):\n\n a, b = map(int, readline().split())\n\n a -= 1\n\n b -= 1\n\n to[a].append(b)\n\n to[b].append(a)\n\n score = [0 for _ in range(N)]\n\n for _ in range(Q):\n\n p, x = map(int, readline().split()) \n\n p -= 1\n\n score[p] += x \n\n \n\n dq = deque() \n\n dq.append(0)\n\n done = [0 for _ in range(N)]\n\n done[0] = 1\n\n\n\n while len(dq)>0:\n\n v = dq.popleft()\n\n for nx in to[v]:\n\n if done[nx]:\n\n continue\n\n score[nx] += score[v]\n\n done[nx] = 1\n\n dq.append(nx)\n\n for i in range(N):\n\n if i==N-1:\n\n print(score[i])\n\n else:\n\n print(score[i], end=' ')\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":34,"code_v1_loc":41,"code_v0_num_chars":949,"code_v1_num_chars":1016,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom copy import deepcopy\nfrom collections import deque\n\n\ndef main():\n N, Q = map(int, readline().split())\n m = map(int, read().split())\n n = deepcopy(m)\n to = [[] for _ in range(N)]\n for a, b in [(a - 1, b - 1) for a, b in zip(m, m)][: N - 1]:\n to[a].append(b)\n to[b].append(a)\n score = [0 for _ in range(N)]\n for p, x in [(p - 1, x) for p, x in zip(n, n)][N - 1 :]:\n score[p] += x\n dq = deque()\n dq.append(0)\n done = [0 for _ in range(N)]\n done[0] = 1\n while len(dq) > 0:\n node = dq.popleft()\n for nx in to[node]:\n if done[nx] == 1:\n continue\n done[nx] = 1\n score[nx] += score[node]\n dq.append(nx)\n for i in score:\n print(i, end=\" \")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom collections import deque\n\n\ndef main():\n N, Q = map(int, readline().split())\n to = [[] for _ in range(N)]\n for _ in range(N - 1):\n a, b = map(int, readline().split())\n a -= 1\n b -= 1\n to[a].append(b)\n to[b].append(a)\n score = [0 for _ in range(N)]\n for _ in range(Q):\n p, x = map(int, readline().split())\n p -= 1\n score[p] += x\n dq = deque()\n dq.append(0)\n done = [0 for _ in range(N)]\n done[0] = 1\n while len(dq) > 0:\n v = dq.popleft()\n for nx in to[v]:\n if done[nx]:\n continue\n score[nx] += score[v]\n done[nx] = 1\n dq.append(nx)\n for i in range(N):\n if i == N - 1:\n print(score[i])\n else:\n print(score[i], end=\" \")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":17.0731707317,"diff":["-from copy import deepcopy","- m = map(int, read().split())","- n = deepcopy(m)","- for a, b in [(a - 1, b - 1) for a, b in zip(m, m)][: N - 1]:","+ for _ in range(N - 1):","+ a, b = map(int, readline().split())","+ a -= 1","+ b -= 1","- for p, x in [(p - 1, x) for p, x in zip(n, n)][N - 1 :]:","+ for _ in range(Q):","+ p, x = map(int, readline().split())","+ p -= 1","- node = dq.popleft()","- for nx in to[node]:","- if done[nx] == 1:","+ v = dq.popleft()","+ for nx in to[v]:","+ if done[nx]:","+ score[nx] += score[v]","- score[nx] += score[node]","- for i in score:","- print(i, end=\" \")","+ for i in range(N):","+ if i == N - 1:","+ print(score[i])","+ else:","+ print(score[i], end=\" \")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0852930775,"measured_runtime_v1":0.0435600276,"runtime_lift":1.9580583904,"key":["s418711873","s984289269"]} +{"user_id":"u037430802","problem_id":"p03611","language":"python","submission_id_v0":"s891582644","submission_id_v1":"s793957957","cpu_time_v0":176,"cpu_time_v1":151,"memory_v0":19708,"memory_v1":18748,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.2,"input":"n = int(eval(input()))\n\n\n\na = list(map(int, input().split()))\n\n\n\nd = {}\n\n\n\nfor i in a:\n\n for j in range(i - 1, i + 2): #a\u306e\u5024\u306e\u4e21\u96a3\u307e\u3067\n\n d[j] = d.get(j, 0) + 1#get\u306f\u7b2c\u4e00\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u30ad\u30fc\u304c\u306a\u304b\u3063\u305f\u3089\u7b2c\u4e8c\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u5024\u3092\u623b\u3059\n\n \n\n \n\nprint((max(d.values())))","target":"N = int(eval(input()))\n\n\n\na = list(map(int, input().split()))\n\n\n\nnums = {}\n\nfor i in a:\n\n nums[i] = nums.get(i, 0) + 1\n\n nums[i+1] = nums.get(i+1, 0) + 1\n\n nums[i-1] = nums.get(i-1, 0) + 1\n\n\n\nans = 0\n\nfor i in list(nums.values()):\n\n ans = max(ans, i)\n\n\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":15,"code_v0_num_chars":222,"code_v1_num_chars":256,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nd = {}\nfor i in a:\n for j in range(i - 1, i + 2): # a\u306e\u5024\u306e\u4e21\u96a3\u307e\u3067\n d[j] = d.get(j, 0) + 1 # get\u306f\u7b2c\u4e00\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u30ad\u30fc\u304c\u306a\u304b\u3063\u305f\u3089\u7b2c\u4e8c\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u5024\u3092\u623b\u3059\nprint((max(d.values())))\n","code_v1_no_empty_lines":"N = int(eval(input()))\na = list(map(int, input().split()))\nnums = {}\nfor i in a:\n nums[i] = nums.get(i, 0) + 1\n nums[i + 1] = nums.get(i + 1, 0) + 1\n nums[i - 1] = nums.get(i - 1, 0) + 1\nans = 0\nfor i in list(nums.values()):\n ans = max(ans, i)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-n = int(eval(input()))","+N = int(eval(input()))","-d = {}","+nums = {}","- for j in range(i - 1, i + 2): # a\u306e\u5024\u306e\u4e21\u96a3\u307e\u3067","- d[j] = d.get(j, 0) + 1 # get\u306f\u7b2c\u4e00\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u30ad\u30fc\u304c\u306a\u304b\u3063\u305f\u3089\u7b2c\u4e8c\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u5024\u3092\u623b\u3059","-print((max(d.values())))","+ nums[i] = nums.get(i, 0) + 1","+ nums[i + 1] = nums.get(i + 1, 0) + 1","+ nums[i - 1] = nums.get(i - 1, 0) + 1","+ans = 0","+for i in list(nums.values()):","+ ans = max(ans, i)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409930229,"measured_runtime_v1":0.0430342674,"runtime_lift":0.9525669975,"key":["s891582644","s793957957"]} +{"user_id":"u537905693","problem_id":"p03111","language":"python","submission_id_v0":"s254639575","submission_id_v1":"s482263709","cpu_time_v0":153,"cpu_time_v1":69,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.9,"input":"#!\/usr\/bin\/env python\n\n# coding: utf-8\n\n\n\nimport itertools\n\n\n\ndef main():\n\n N, A, B, C = list(map(int, input().split()))\n\n ll = []\n\n for _ in range(N):\n\n ll.append(int(eval(input())))\n\n\n\n cand = []\n\n ids = set(range(N))\n\n for a in range(1, N-1):\n\n for b in range(1, N-a):\n\n for c in range(1, N-a-b+1):\n\n cand.append((a, b, c))\n\n best_cost = -1\n\n for a, b, c in cand:\n\n la = itertools.combinations(ids, a)\n\n for a_ in la:\n\n lb = itertools.combinations(ids-set(a_), b)\n\n for b_ in lb:\n\n lc = itertools.combinations(ids-set(a_)-set(b_), c)\n\n for c_ in lc:\n\n cost = (len(a_)-1)*10 + abs(sum(ll[e] for e in a_)-A)\n\n cost += (len(b_)-1)*10 + abs(sum(ll[e] for e in b_)-B)\n\n cost += (len(c_)-1)*10 + abs(sum(ll[e] for e in c_)-C)\n\n if best_cost == -1 or cost < best_cost:\n\n best_cost = cost\n\n print(best_cost)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#!\/usr\/bin\/env python\n\n# coding: utf-8\n\n\n\nN, A, B, C = list(map(int, input().split()))\n\nll = []\n\nfor _ in range(N):\n\n ll.append(int(eval(input())))\n\n\n\ndef dfs(n, a, b, c):\n\n if n == N:\n\n if a == 0 or b == 0 or c == 0: return float('inf')\n\n return abs(A-a) + abs(B-b) + abs(C-c)\n\n ca = dfs(n+1, a+ll[n], b, c)\n\n if a > 0: ca += 10\n\n cb = dfs(n+1, a, b+ll[n], c)\n\n if b > 0: cb += 10\n\n cc = dfs(n+1, a, b, c+ll[n])\n\n if c > 0: cc += 10\n\n cn = dfs(n+1, a, b, c)\n\n return min(ca, cb, cc, cn)\n\n\n\n\n\ndef main():\n\n print((dfs(0, 0, 0, 0)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":35,"code_v1_loc":28,"code_v0_num_chars":1073,"code_v1_num_chars":615,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python\n# coding: utf-8\nimport itertools\n\n\ndef main():\n N, A, B, C = list(map(int, input().split()))\n ll = []\n for _ in range(N):\n ll.append(int(eval(input())))\n cand = []\n ids = set(range(N))\n for a in range(1, N - 1):\n for b in range(1, N - a):\n for c in range(1, N - a - b + 1):\n cand.append((a, b, c))\n best_cost = -1\n for a, b, c in cand:\n la = itertools.combinations(ids, a)\n for a_ in la:\n lb = itertools.combinations(ids - set(a_), b)\n for b_ in lb:\n lc = itertools.combinations(ids - set(a_) - set(b_), c)\n for c_ in lc:\n cost = (len(a_) - 1) * 10 + abs(sum(ll[e] for e in a_) - A)\n cost += (len(b_) - 1) * 10 + abs(sum(ll[e] for e in b_) - B)\n cost += (len(c_) - 1) * 10 + abs(sum(ll[e] for e in c_) - C)\n if best_cost == -1 or cost < best_cost:\n best_cost = cost\n print(best_cost)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python\n# coding: utf-8\nN, A, B, C = list(map(int, input().split()))\nll = []\nfor _ in range(N):\n ll.append(int(eval(input())))\n\n\ndef dfs(n, a, b, c):\n if n == N:\n if a == 0 or b == 0 or c == 0:\n return float(\"inf\")\n return abs(A - a) + abs(B - b) + abs(C - c)\n ca = dfs(n + 1, a + ll[n], b, c)\n if a > 0:\n ca += 10\n cb = dfs(n + 1, a, b + ll[n], c)\n if b > 0:\n cb += 10\n cc = dfs(n + 1, a, b, c + ll[n])\n if c > 0:\n cc += 10\n cn = dfs(n + 1, a, b, c)\n return min(ca, cb, cc, cn)\n\n\ndef main():\n print((dfs(0, 0, 0, 0)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import itertools","+N, A, B, C = list(map(int, input().split()))","+ll = []","+for _ in range(N):","+ ll.append(int(eval(input())))","+","+","+def dfs(n, a, b, c):","+ if n == N:","+ if a == 0 or b == 0 or c == 0:","+ return float(\"inf\")","+ return abs(A - a) + abs(B - b) + abs(C - c)","+ ca = dfs(n + 1, a + ll[n], b, c)","+ if a > 0:","+ ca += 10","+ cb = dfs(n + 1, a, b + ll[n], c)","+ if b > 0:","+ cb += 10","+ cc = dfs(n + 1, a, b, c + ll[n])","+ if c > 0:","+ cc += 10","+ cn = dfs(n + 1, a, b, c)","+ return min(ca, cb, cc, cn)","- N, A, B, C = list(map(int, input().split()))","- ll = []","- for _ in range(N):","- ll.append(int(eval(input())))","- cand = []","- ids = set(range(N))","- for a in range(1, N - 1):","- for b in range(1, N - a):","- for c in range(1, N - a - b + 1):","- cand.append((a, b, c))","- best_cost = -1","- for a, b, c in cand:","- la = itertools.combinations(ids, a)","- for a_ in la:","- lb = itertools.combinations(ids - set(a_), b)","- for b_ in lb:","- lc = itertools.combinations(ids - set(a_) - set(b_), c)","- for c_ in lc:","- cost = (len(a_) - 1) * 10 + abs(sum(ll[e] for e in a_) - A)","- cost += (len(b_) - 1) * 10 + abs(sum(ll[e] for e in b_) - B)","- cost += (len(c_) - 1) * 10 + abs(sum(ll[e] for e in c_) - C)","- if best_cost == -1 or cost < best_cost:","- best_cost = cost","- print(best_cost)","+ print((dfs(0, 0, 0, 0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1591162002,"measured_runtime_v1":0.1889701054,"runtime_lift":0.8420178412,"key":["s254639575","s482263709"]} +{"user_id":"u285891772","problem_id":"p03298","language":"python","submission_id_v0":"s470739149","submission_id_v1":"s873330395","cpu_time_v0":2502,"cpu_time_v1":1427,"memory_v0":103248,"memory_v1":103440,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.97,"input":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\n\n\nN = INT()\n\nS = eval(input())\n\n\n\nformer = S[:N]\n\nlatter = S[N:][::-1]\n\n\n\ndic_f = defaultdict(int)\n\ndic_l = defaultdict(int)\n\n\n\nfor x in product([0, 1], repeat=N):\n\n\ttmp_red = \"\"\n\n\ttmp_blue = \"\"\n\n\tfor i in range(N):\n\n\t\tif x[i]:\n\n\t\t\ttmp_red += former[i]\n\n\t\telse:\n\n\t\t\ttmp_blue += former[i]\n\n\tdic_f[\"{},{}\".format(tmp_red, tmp_blue)] += 1\n\n\n\nfor x in product([0, 1], repeat=N):\n\n\ttmp_red = \"\"\n\n\ttmp_blue = \"\"\n\n\tfor i in range(N):\n\n\t\tif x[i]:\n\n\t\t\ttmp_red += latter[i]\n\n\t\telse:\n\n\t\t\ttmp_blue += latter[i]\n\n\tdic_l[\"{},{}\".format(tmp_red, tmp_blue)] += 1\n\n\n\nans = 0\n\n\n\nfor key in dic_f:\n\n\tans += dic_f[key] * dic_l[key]\n\n\n\nprint(ans)\n\n\n\n\n","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce, lru_cache\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\ndef main():\n\n\n\n\tN = INT()\n\n\tS = eval(input())\n\n\n\n\tformer = S[:N]\n\n\tlatter = S[N:][::-1]\n\n\n\n\tdic_f = defaultdict(int)\n\n\tdic_l = defaultdict(int)\n\n\n\n\tfor x in product([0, 1], repeat=N):\n\n\t\ttmp_red = \"\"\n\n\t\ttmp_blue = \"\"\n\n\t\tfor i in range(N):\n\n\t\t\tif x[i]:\n\n\t\t\t\ttmp_red += former[i]\n\n\t\t\telse:\n\n\t\t\t\ttmp_blue += former[i]\n\n\t\tdic_f[\"{},{}\".format(tmp_red, tmp_blue)] += 1\n\n\n\n\tfor x in product([0, 1], repeat=N):\n\n\t\ttmp_red = \"\"\n\n\t\ttmp_blue = \"\"\n\n\t\tfor i in range(N):\n\n\t\t\tif x[i]:\n\n\t\t\t\ttmp_red += latter[i]\n\n\t\t\telse:\n\n\t\t\t\ttmp_blue += latter[i]\n\n\t\tdic_l[\"{},{}\".format(tmp_red, tmp_blue)] += 1\n\n\n\n\tans = 0\n\n\n\n\tfor key in dic_f:\n\n\t\tans += dic_f[key] * dic_l[key]\n\n\n\n\tprint(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n\tmain()","code_v0_loc":62,"code_v1_loc":65,"code_v0_num_chars":1636,"code_v1_num_chars":1713,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nN = INT()\nS = eval(input())\nformer = S[:N]\nlatter = S[N:][::-1]\ndic_f = defaultdict(int)\ndic_l = defaultdict(int)\nfor x in product([0, 1], repeat=N):\n tmp_red = \"\"\n tmp_blue = \"\"\n for i in range(N):\n if x[i]:\n tmp_red += former[i]\n else:\n tmp_blue += former[i]\n dic_f[\"{},{}\".format(tmp_red, tmp_blue)] += 1\nfor x in product([0, 1], repeat=N):\n tmp_red = \"\"\n tmp_blue = \"\"\n for i in range(N):\n if x[i]:\n tmp_red += latter[i]\n else:\n tmp_blue += latter[i]\n dic_l[\"{},{}\".format(tmp_red, tmp_blue)] += 1\nans = 0\nfor key in dic_f:\n ans += dic_f[key] * dic_l[key]\nprint(ans)\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\ndef main():\n N = INT()\n S = eval(input())\n former = S[:N]\n latter = S[N:][::-1]\n dic_f = defaultdict(int)\n dic_l = defaultdict(int)\n for x in product([0, 1], repeat=N):\n tmp_red = \"\"\n tmp_blue = \"\"\n for i in range(N):\n if x[i]:\n tmp_red += former[i]\n else:\n tmp_blue += former[i]\n dic_f[\"{},{}\".format(tmp_red, tmp_blue)] += 1\n for x in product([0, 1], repeat=N):\n tmp_red = \"\"\n tmp_blue = \"\"\n for i in range(N):\n if x[i]:\n tmp_red += latter[i]\n else:\n tmp_blue += latter[i]\n dic_l[\"{},{}\".format(tmp_red, tmp_blue)] += 1\n ans = 0\n for key in dic_f:\n ans += dic_f[key] * dic_l[key]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":4.6153846154,"diff":["-N = INT()","-S = eval(input())","-former = S[:N]","-latter = S[N:][::-1]","-dic_f = defaultdict(int)","-dic_l = defaultdict(int)","-for x in product([0, 1], repeat=N):","- tmp_red = \"\"","- tmp_blue = \"\"","- for i in range(N):","- if x[i]:","- tmp_red += former[i]","- else:","- tmp_blue += former[i]","- dic_f[\"{},{}\".format(tmp_red, tmp_blue)] += 1","-for x in product([0, 1], repeat=N):","- tmp_red = \"\"","- tmp_blue = \"\"","- for i in range(N):","- if x[i]:","- tmp_red += latter[i]","- else:","- tmp_blue += latter[i]","- dic_l[\"{},{}\".format(tmp_red, tmp_blue)] += 1","-ans = 0","-for key in dic_f:","- ans += dic_f[key] * dic_l[key]","-print(ans)","+def main():","+ N = INT()","+ S = eval(input())","+ former = S[:N]","+ latter = S[N:][::-1]","+ dic_f = defaultdict(int)","+ dic_l = defaultdict(int)","+ for x in product([0, 1], repeat=N):","+ tmp_red = \"\"","+ tmp_blue = \"\"","+ for i in range(N):","+ if x[i]:","+ tmp_red += former[i]","+ else:","+ tmp_blue += former[i]","+ dic_f[\"{},{}\".format(tmp_red, tmp_blue)] += 1","+ for x in product([0, 1], repeat=N):","+ tmp_red = \"\"","+ tmp_blue = \"\"","+ for i in range(N):","+ if x[i]:","+ tmp_red += latter[i]","+ else:","+ tmp_blue += latter[i]","+ dic_l[\"{},{}\".format(tmp_red, tmp_blue)] += 1","+ ans = 0","+ for key in dic_f:","+ ans += dic_f[key] * dic_l[key]","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0584821138,"measured_runtime_v1":0.0340637422,"runtime_lift":1.7168434855,"key":["s470739149","s873330395"]} +{"user_id":"u191874006","problem_id":"p02973","language":"python","submission_id_v0":"s885672733","submission_id_v1":"s525295229","cpu_time_v0":306,"cpu_time_v1":127,"memory_v0":48476,"memory_v1":79056,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.5,"input":"#!\/usr\/bin\/env python3\n\nimport sys\n\nimport math\n\nfrom bisect import bisect_right as br\n\nfrom bisect import bisect_left as bl\n\nsys.setrecursionlimit(2147483647)\n\nfrom heapq import heappush, heappop,heappushpop\n\nfrom collections import defaultdict\n\nfrom itertools import accumulate\n\nfrom collections import Counter\n\nfrom collections import deque\n\nfrom operator import itemgetter\n\nfrom itertools import permutations\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\n\n\ndef main():\n\n n = I()\n\n a = [I() for _ in range(n)]\n\n dp = [inf]*n\n\n for i in range(n):\n\n r = br(dp,-a[i])\n\n dp[r] = -a[i]\n\n print((n-dp.count(inf)))\n\n return\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#!\/usr\/bin\/env python3\n\n\n\nimport sys\n\nimport math\n\nfrom bisect import bisect_right as br\n\nfrom bisect import bisect_left as bl\n\nsys.setrecursionlimit(2147483647)\n\nfrom heapq import heappush, heappop,heappushpop\n\nfrom collections import defaultdict\n\nfrom itertools import accumulate\n\nfrom collections import Counter\n\nfrom collections import deque\n\nfrom operator import itemgetter\n\nfrom itertools import permutations\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\n\n\nn = I()\n\na = [I() for _ in range(n)]\n\ndp = [10**10]*(n)\n\nfor i in range(n):\n\n r = br(dp, -a[i])\n\n dp[r] = -a[i]\n\nprint((n - dp.count(10**10))) ","code_v0_loc":30,"code_v1_loc":26,"code_v0_num_chars":767,"code_v1_num_chars":714,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nimport math\nfrom bisect import bisect_right as br\nfrom bisect import bisect_left as bl\n\nsys.setrecursionlimit(2147483647)\nfrom heapq import heappush, heappop, heappushpop\nfrom collections import defaultdict\nfrom itertools import accumulate\nfrom collections import Counter\nfrom collections import deque\nfrom operator import itemgetter\nfrom itertools import permutations\n\nmod = 10**9 + 7\ninf = float(\"inf\")\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef main():\n n = I()\n a = [I() for _ in range(n)]\n dp = [inf] * n\n for i in range(n):\n r = br(dp, -a[i])\n dp[r] = -a[i]\n print((n - dp.count(inf)))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nimport math\nfrom bisect import bisect_right as br\nfrom bisect import bisect_left as bl\n\nsys.setrecursionlimit(2147483647)\nfrom heapq import heappush, heappop, heappushpop\nfrom collections import defaultdict\nfrom itertools import accumulate\nfrom collections import Counter\nfrom collections import deque\nfrom operator import itemgetter\nfrom itertools import permutations\n\nmod = 10**9 + 7\ninf = float(\"inf\")\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn = I()\na = [I() for _ in range(n)]\ndp = [10**10] * (n)\nfor i in range(n):\n r = br(dp, -a[i])\n dp[r] = -a[i]\nprint((n - dp.count(10**10)))\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-def main():","- n = I()","- a = [I() for _ in range(n)]","- dp = [inf] * n","- for i in range(n):","- r = br(dp, -a[i])","- dp[r] = -a[i]","- print((n - dp.count(inf)))","- return","-","-","-if __name__ == \"__main__\":","- main()","+n = I()","+a = [I() for _ in range(n)]","+dp = [10**10] * (n)","+for i in range(n):","+ r = br(dp, -a[i])","+ dp[r] = -a[i]","+print((n - dp.count(10**10)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0391851825,"measured_runtime_v1":0.0381656492,"runtime_lift":1.0267133752,"key":["s885672733","s525295229"]} +{"user_id":"u075012704","problem_id":"p03222","language":"python","submission_id_v0":"s380586686","submission_id_v1":"s448545780","cpu_time_v0":34,"cpu_time_v1":20,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.18,"input":"from itertools import product\n\nH, W, K = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\n\n\n# dp[i][j]:= \u4e0a\u304b\u3089i\u756a\u76ee, \u5de6\u304b\u3089j\u756a\u76ee\u306b\u3044\u308b\u901a\u308a\u6570\n\ndp = [[0] * W for i in range(H + 1)]\n\ndp[0][0] = 1\n\n\n\n\n\ndef calc(x):\n\n if x < 0:\n\n return 1\n\n ret = 0\n\n for p in product(['0', '1'], repeat=x):\n\n p = ''.join(p)\n\n if '11' not in p:\n\n ret += 1\n\n return ret\n\n\n\n\n\nfor i in range(1, H + 1):\n\n for j in range(W):\n\n tmp = 0\n\n if j > 0: # \u5de6\u304b\u3089\n\n tmp += dp[i - 1][j - 1] * calc(j - 2) * calc(W - j - 2) % mod\n\n\n\n # \u4e0a\u304b\u3089\n\n tmp += dp[i - 1][j] * calc(j - 1) * calc(W - j - 2) % mod\n\n\n\n if j + 1 < W: # \u53f3\u304b\u3089\n\n tmp += dp[i - 1][j + 1] * calc(j - 1) * calc(W - j - 3) % mod\n\n\n\n dp[i][j] = tmp\n\n\n\nprint((dp[H][K - 1] % mod))\n","target":"H, W, K = list(map(int, input().split()))\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef transition(w):\n\n X = [1, 2, 3, 5, 8, 13, 21, 34]\n\n if w >= 0:\n\n return X[w]\n\n else:\n\n return 1\n\n\n\n\n\n# h\u884cw\u5217\u306b\u5230\u9054\u3059\u308b\u65b9\u6cd5\n\ndp = [[0] * W for h in range(H + 1)]\n\ndp[0][0] = 1\n\n\n\nfor h in range(H):\n\n for w in range(W):\n\n # \u771f\u4e0b\u3078\n\n dp[h + 1][w] += dp[h][w] * (transition(w - 1) * transition(W - w - 2))\n\n dp[h + 1][w] %= MOD\n\n\n\n # \u53f3\u4e0b\u3078\n\n if w + 1 < W:\n\n dp[h + 1][w + 1] += dp[h][w] * (transition(w - 1) * transition(W - w - 3))\n\n dp[h + 1][w + 1] %= MOD\n\n\n\n # \u5de6\u4e0b\u3078\n\n if w - 1 >= 0:\n\n dp[h + 1][w - 1] += dp[h][w] * (transition(w - 2) * transition(W - w - 2))\n\n dp[h + 1][w - 1] %= MOD\n\n\n\nprint((dp[H][K - 1]))\n","code_v0_loc":35,"code_v1_loc":33,"code_v0_num_chars":792,"code_v1_num_chars":777,"code_v0_no_empty_lines":"from itertools import product\n\nH, W, K = list(map(int, input().split()))\nmod = 10**9 + 7\n# dp[i][j]:= \u4e0a\u304b\u3089i\u756a\u76ee, \u5de6\u304b\u3089j\u756a\u76ee\u306b\u3044\u308b\u901a\u308a\u6570\ndp = [[0] * W for i in range(H + 1)]\ndp[0][0] = 1\n\n\ndef calc(x):\n if x < 0:\n return 1\n ret = 0\n for p in product([\"0\", \"1\"], repeat=x):\n p = \"\".join(p)\n if \"11\" not in p:\n ret += 1\n return ret\n\n\nfor i in range(1, H + 1):\n for j in range(W):\n tmp = 0\n if j > 0: # \u5de6\u304b\u3089\n tmp += dp[i - 1][j - 1] * calc(j - 2) * calc(W - j - 2) % mod\n # \u4e0a\u304b\u3089\n tmp += dp[i - 1][j] * calc(j - 1) * calc(W - j - 2) % mod\n if j + 1 < W: # \u53f3\u304b\u3089\n tmp += dp[i - 1][j + 1] * calc(j - 1) * calc(W - j - 3) % mod\n dp[i][j] = tmp\nprint((dp[H][K - 1] % mod))\n","code_v1_no_empty_lines":"H, W, K = list(map(int, input().split()))\nMOD = 10**9 + 7\n\n\ndef transition(w):\n X = [1, 2, 3, 5, 8, 13, 21, 34]\n if w >= 0:\n return X[w]\n else:\n return 1\n\n\n# h\u884cw\u5217\u306b\u5230\u9054\u3059\u308b\u65b9\u6cd5\ndp = [[0] * W for h in range(H + 1)]\ndp[0][0] = 1\nfor h in range(H):\n for w in range(W):\n # \u771f\u4e0b\u3078\n dp[h + 1][w] += dp[h][w] * (transition(w - 1) * transition(W - w - 2))\n dp[h + 1][w] %= MOD\n # \u53f3\u4e0b\u3078\n if w + 1 < W:\n dp[h + 1][w + 1] += dp[h][w] * (transition(w - 1) * transition(W - w - 3))\n dp[h + 1][w + 1] %= MOD\n # \u5de6\u4e0b\u3078\n if w - 1 >= 0:\n dp[h + 1][w - 1] += dp[h][w] * (transition(w - 2) * transition(W - w - 2))\n dp[h + 1][w - 1] %= MOD\nprint((dp[H][K - 1]))\n","code_same":false,"relative_loc_diff_percent":5.7142857143,"diff":["-from itertools import product","-","-mod = 10**9 + 7","-# dp[i][j]:= \u4e0a\u304b\u3089i\u756a\u76ee, \u5de6\u304b\u3089j\u756a\u76ee\u306b\u3044\u308b\u901a\u308a\u6570","-dp = [[0] * W for i in range(H + 1)]","-dp[0][0] = 1","+MOD = 10**9 + 7","-def calc(x):","- if x < 0:","+def transition(w):","+ X = [1, 2, 3, 5, 8, 13, 21, 34]","+ if w >= 0:","+ return X[w]","+ else:","- ret = 0","- for p in product([\"0\", \"1\"], repeat=x):","- p = \"\".join(p)","- if \"11\" not in p:","- ret += 1","- return ret","-for i in range(1, H + 1):","- for j in range(W):","- tmp = 0","- if j > 0: # \u5de6\u304b\u3089","- tmp += dp[i - 1][j - 1] * calc(j - 2) * calc(W - j - 2) % mod","- # \u4e0a\u304b\u3089","- tmp += dp[i - 1][j] * calc(j - 1) * calc(W - j - 2) % mod","- if j + 1 < W: # \u53f3\u304b\u3089","- tmp += dp[i - 1][j + 1] * calc(j - 1) * calc(W - j - 3) % mod","- dp[i][j] = tmp","-print((dp[H][K - 1] % mod))","+# h\u884cw\u5217\u306b\u5230\u9054\u3059\u308b\u65b9\u6cd5","+dp = [[0] * W for h in range(H + 1)]","+dp[0][0] = 1","+for h in range(H):","+ for w in range(W):","+ # \u771f\u4e0b\u3078","+ dp[h + 1][w] += dp[h][w] * (transition(w - 1) * transition(W - w - 2))","+ dp[h + 1][w] %= MOD","+ # \u53f3\u4e0b\u3078","+ if w + 1 < W:","+ dp[h + 1][w + 1] += dp[h][w] * (transition(w - 1) * transition(W - w - 3))","+ dp[h + 1][w + 1] %= MOD","+ # \u5de6\u4e0b\u3078","+ if w - 1 >= 0:","+ dp[h + 1][w - 1] += dp[h][w] * (transition(w - 2) * transition(W - w - 2))","+ dp[h + 1][w - 1] %= MOD","+print((dp[H][K - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0341210891,"measured_runtime_v1":0.0436547478,"runtime_lift":0.7816123294,"key":["s380586686","s448545780"]} +{"user_id":"u063052907","problem_id":"p03244","language":"python","submission_id_v0":"s375153971","submission_id_v1":"s389335058","cpu_time_v0":109,"cpu_time_v1":95,"memory_v0":21084,"memory_v1":21084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.84,"input":"from collections import Counter\n\n\n\n\n\nn = int(eval(input()))\n\nlst_v = list(map(int, input().split()))\n\n\n\n\n\nif len(set(lst_v)) == 1:\n\n ans = n \/\/ 2\n\nelse:\n\n lst_odd = lst_v[::2]\n\n lst_even = lst_v[1::2]\n\n cnt_odd = sorted(list(Counter(lst_odd).items()), key=lambda x: -x[1])\n\n cnt_even = sorted(list(Counter(lst_even).items()), key=lambda x :-x[1])\n\n\n\n if cnt_odd[0][0] == cnt_even[0][0]:\n\n rem_number = max(cnt_odd[0][1] + cnt_even[1][1], cnt_odd[1][1] + cnt_even[0][1])\n\n else:\n\n rem_number = cnt_odd[0][1] + cnt_even[0][1]\n\n sum_odd = sum(t[1] for t in cnt_odd)\n\n sum_even = sum(t[1] for t in cnt_even)\n\n ans = sum_odd + sum_even - rem_number\n\n\n\n\n\nprint(ans)\n","target":"from collections import Counter\n\n\n\n\n\nn = int(eval(input()))\n\nlst_v = list(map(int, input().split()))\n\n\n\n\n\n\n\nif len(set(lst_v)) == 1:\n\n ans = n \/\/ 2\n\nelse:\n\n lst_o = lst_v[::2]\n\n lst_e = lst_v[1::2]\n\n cnt_o = sorted(list(Counter(lst_o).items()), key=lambda x: -x[1])\n\n cnt_e = sorted(list(Counter(lst_e).items()), key=lambda x :-x[1])\n\n\n\n\n\n if cnt_o[0][0] == cnt_e[0][0]:\n\n rem_number = max(cnt_o[0][1] + cnt_e[1][1], cnt_o[1][1] + cnt_e[0][1])\n\n else:\n\n rem_number = cnt_o[0][1] + cnt_e[0][1]\n\n ans = n - rem_number\n\n\n\n\n\nprint(ans)\n","code_v0_loc":25,"code_v1_loc":25,"code_v0_num_chars":686,"code_v1_num_chars":552,"code_v0_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\nlst_v = list(map(int, input().split()))\nif len(set(lst_v)) == 1:\n ans = n \/\/ 2\nelse:\n lst_odd = lst_v[::2]\n lst_even = lst_v[1::2]\n cnt_odd = sorted(list(Counter(lst_odd).items()), key=lambda x: -x[1])\n cnt_even = sorted(list(Counter(lst_even).items()), key=lambda x: -x[1])\n if cnt_odd[0][0] == cnt_even[0][0]:\n rem_number = max(cnt_odd[0][1] + cnt_even[1][1], cnt_odd[1][1] + cnt_even[0][1])\n else:\n rem_number = cnt_odd[0][1] + cnt_even[0][1]\n sum_odd = sum(t[1] for t in cnt_odd)\n sum_even = sum(t[1] for t in cnt_even)\n ans = sum_odd + sum_even - rem_number\nprint(ans)\n","code_v1_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\nlst_v = list(map(int, input().split()))\nif len(set(lst_v)) == 1:\n ans = n \/\/ 2\nelse:\n lst_o = lst_v[::2]\n lst_e = lst_v[1::2]\n cnt_o = sorted(list(Counter(lst_o).items()), key=lambda x: -x[1])\n cnt_e = sorted(list(Counter(lst_e).items()), key=lambda x: -x[1])\n if cnt_o[0][0] == cnt_e[0][0]:\n rem_number = max(cnt_o[0][1] + cnt_e[1][1], cnt_o[1][1] + cnt_e[0][1])\n else:\n rem_number = cnt_o[0][1] + cnt_e[0][1]\n ans = n - rem_number\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- lst_odd = lst_v[::2]","- lst_even = lst_v[1::2]","- cnt_odd = sorted(list(Counter(lst_odd).items()), key=lambda x: -x[1])","- cnt_even = sorted(list(Counter(lst_even).items()), key=lambda x: -x[1])","- if cnt_odd[0][0] == cnt_even[0][0]:","- rem_number = max(cnt_odd[0][1] + cnt_even[1][1], cnt_odd[1][1] + cnt_even[0][1])","+ lst_o = lst_v[::2]","+ lst_e = lst_v[1::2]","+ cnt_o = sorted(list(Counter(lst_o).items()), key=lambda x: -x[1])","+ cnt_e = sorted(list(Counter(lst_e).items()), key=lambda x: -x[1])","+ if cnt_o[0][0] == cnt_e[0][0]:","+ rem_number = max(cnt_o[0][1] + cnt_e[1][1], cnt_o[1][1] + cnt_e[0][1])","- rem_number = cnt_odd[0][1] + cnt_even[0][1]","- sum_odd = sum(t[1] for t in cnt_odd)","- sum_even = sum(t[1] for t in cnt_even)","- ans = sum_odd + sum_even - rem_number","+ rem_number = cnt_o[0][1] + cnt_e[0][1]","+ ans = n - rem_number"],"diff_only_import_comment":false,"measured_runtime_v0":0.0378074799,"measured_runtime_v1":0.0381020911,"runtime_lift":0.9922678463,"key":["s375153971","s389335058"]} +{"user_id":"u070201429","problem_id":"p03380","language":"python","submission_id_v0":"s045623368","submission_id_v1":"s142444621","cpu_time_v0":106,"cpu_time_v1":98,"memory_v0":85032,"memory_v1":85496,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.55,"input":"from bisect import bisect\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\na.sort()\n\n\n\ni = bisect(a, (a[-1]+1) \/\/ 2)\n\n\n\nif a[i] - a[-1] \/ 2 < a[-1] \/ 2 - a[i-1]:\n\n print((a[-1], a[i]))\n\nelse:\n\n print((a[-1], a[i-1]))","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\nmax_a = max(a)\n\n\n\nans = 0\n\nfor i in range(n):\n\n if abs(ans - max_a\/2) > abs(a[i] - max_a\/2):\n\n ans = a[i]\n\n\n\nprint((max_a, ans))","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":227,"code_v1_num_chars":193,"code_v0_no_empty_lines":"from bisect import bisect\n\nn = int(eval(input()))\na = list(map(int, input().split()))\na.sort()\ni = bisect(a, (a[-1] + 1) \/\/ 2)\nif a[i] - a[-1] \/ 2 < a[-1] \/ 2 - a[i - 1]:\n print((a[-1], a[i]))\nelse:\n print((a[-1], a[i - 1]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nmax_a = max(a)\nans = 0\nfor i in range(n):\n if abs(ans - max_a \/ 2) > abs(a[i] - max_a \/ 2):\n ans = a[i]\nprint((max_a, ans))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-from bisect import bisect","-","-a.sort()","-i = bisect(a, (a[-1] + 1) \/\/ 2)","-if a[i] - a[-1] \/ 2 < a[-1] \/ 2 - a[i - 1]:","- print((a[-1], a[i]))","-else:","- print((a[-1], a[i - 1]))","+max_a = max(a)","+ans = 0","+for i in range(n):","+ if abs(ans - max_a \/ 2) > abs(a[i] - max_a \/ 2):","+ ans = a[i]","+print((max_a, ans))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0724145345,"measured_runtime_v1":0.0440849149,"runtime_lift":1.6426148173,"key":["s045623368","s142444621"]} +{"user_id":"u097121858","problem_id":"p03545","language":"python","submission_id_v0":"s584442491","submission_id_v1":"s111555186","cpu_time_v0":166,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.76,"input":"A, B, C, D = [int(c) for c in eval(input())]\n\n\n\nexpressions = [\n\n \"{}+{}+{}+{}\",\n\n \"{}+{}+{}-{}\",\n\n \"{}+{}-{}+{}\",\n\n \"{}-{}+{}+{}\",\n\n \"{}-{}-{}+{}\",\n\n \"{}-{}+{}-{}\",\n\n \"{}+{}-{}-{}\",\n\n \"{}-{}-{}-{}\",\n\n]\n\n\n\nfor exp in expressions:\n\n exp = exp.format(A, B, C, D)\n\n if eval(exp) == 7:\n\n print((exp + \"=7\"))\n\n break\n","target":"S = eval(input())\n\nA = S[0]\n\nB = S[1]\n\nC = S[2]\n\nD = S[3]\n\nfor i in range(2 ** 3):\n\n op1 = \"+\" if i & (2 ** 0) else \"-\"\n\n op2 = \"+\" if i & (2 ** 1) else \"-\"\n\n op3 = \"+\" if i & (2 ** 2) else \"-\"\n\n formula = \"{}{}{}{}{}{}{}\".format(A, op1, B, op2, C, op3, D)\n\n ans = eval(formula)\n\n if ans == 7:\n\n print((\"{}=7\".format(formula)))\n\n break\n","code_v0_loc":18,"code_v1_loc":14,"code_v0_num_chars":348,"code_v1_num_chars":360,"code_v0_no_empty_lines":"A, B, C, D = [int(c) for c in eval(input())]\nexpressions = [\n \"{}+{}+{}+{}\",\n \"{}+{}+{}-{}\",\n \"{}+{}-{}+{}\",\n \"{}-{}+{}+{}\",\n \"{}-{}-{}+{}\",\n \"{}-{}+{}-{}\",\n \"{}+{}-{}-{}\",\n \"{}-{}-{}-{}\",\n]\nfor exp in expressions:\n exp = exp.format(A, B, C, D)\n if eval(exp) == 7:\n print((exp + \"=7\"))\n break\n","code_v1_no_empty_lines":"S = eval(input())\nA = S[0]\nB = S[1]\nC = S[2]\nD = S[3]\nfor i in range(2**3):\n op1 = \"+\" if i & (2**0) else \"-\"\n op2 = \"+\" if i & (2**1) else \"-\"\n op3 = \"+\" if i & (2**2) else \"-\"\n formula = \"{}{}{}{}{}{}{}\".format(A, op1, B, op2, C, op3, D)\n ans = eval(formula)\n if ans == 7:\n print((\"{}=7\".format(formula)))\n break\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-A, B, C, D = [int(c) for c in eval(input())]","-expressions = [","- \"{}+{}+{}+{}\",","- \"{}+{}+{}-{}\",","- \"{}+{}-{}+{}\",","- \"{}-{}+{}+{}\",","- \"{}-{}-{}+{}\",","- \"{}-{}+{}-{}\",","- \"{}+{}-{}-{}\",","- \"{}-{}-{}-{}\",","-]","-for exp in expressions:","- exp = exp.format(A, B, C, D)","- if eval(exp) == 7:","- print((exp + \"=7\"))","+S = eval(input())","+A = S[0]","+B = S[1]","+C = S[2]","+D = S[3]","+for i in range(2**3):","+ op1 = \"+\" if i & (2**0) else \"-\"","+ op2 = \"+\" if i & (2**1) else \"-\"","+ op3 = \"+\" if i & (2**2) else \"-\"","+ formula = \"{}{}{}{}{}{}{}\".format(A, op1, B, op2, C, op3, D)","+ ans = eval(formula)","+ if ans == 7:","+ print((\"{}=7\".format(formula)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1134692678,"measured_runtime_v1":0.0356344159,"runtime_lift":3.1842606385,"key":["s584442491","s111555186"]} +{"user_id":"u312025627","problem_id":"p02732","language":"python","submission_id_v0":"s395265536","submission_id_v1":"s804629436","cpu_time_v0":467,"cpu_time_v1":286,"memory_v0":92876,"memory_v1":107820,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.76,"input":"def main():\n\n N = int(eval(input()))\n\n A = [int(i) for i in input().split()]\n\n from collections import Counter\n\n c = Counter(A)\n\n ans = 0\n\n for v in list(c.values()):\n\n if v > 1:\n\n ans += v*(v-1)\/\/2\n\n for k, a in enumerate(A):\n\n cnt = 0\n\n add = 0\n\n if c[a] > 1:\n\n cnt = c[a]*(c[a]-1)\/\/2\n\n if c[a] > 2:\n\n add = (c[a]-1)*(c[a]-2)\/\/2\n\n print((ans - cnt + add))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n N = int(eval(input()))\n\n A = [int(i) for i in input().split()]\n\n from collections import Counter\n\n c = Counter(A)\n\n ans = 0\n\n for v in list(c.values()):\n\n ans += v*(v-1)\/\/2\n\n\n\n for k in range(N):\n\n v = c[A[k]]\n\n diff = -v*(v-1)\/\/2 + (v-1)*(v-2)\/\/2\n\n print((ans + (diff if v != 1 else 0)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":21,"code_v1_loc":17,"code_v0_num_chars":484,"code_v1_num_chars":382,"code_v0_no_empty_lines":"def main():\n N = int(eval(input()))\n A = [int(i) for i in input().split()]\n from collections import Counter\n\n c = Counter(A)\n ans = 0\n for v in list(c.values()):\n if v > 1:\n ans += v * (v - 1) \/\/ 2\n for k, a in enumerate(A):\n cnt = 0\n add = 0\n if c[a] > 1:\n cnt = c[a] * (c[a] - 1) \/\/ 2\n if c[a] > 2:\n add = (c[a] - 1) * (c[a] - 2) \/\/ 2\n print((ans - cnt + add))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n A = [int(i) for i in input().split()]\n from collections import Counter\n\n c = Counter(A)\n ans = 0\n for v in list(c.values()):\n ans += v * (v - 1) \/\/ 2\n for k in range(N):\n v = c[A[k]]\n diff = -v * (v - 1) \/\/ 2 + (v - 1) * (v - 2) \/\/ 2\n print((ans + (diff if v != 1 else 0)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":19.0476190476,"diff":["- if v > 1:","- ans += v * (v - 1) \/\/ 2","- for k, a in enumerate(A):","- cnt = 0","- add = 0","- if c[a] > 1:","- cnt = c[a] * (c[a] - 1) \/\/ 2","- if c[a] > 2:","- add = (c[a] - 1) * (c[a] - 2) \/\/ 2","- print((ans - cnt + add))","+ ans += v * (v - 1) \/\/ 2","+ for k in range(N):","+ v = c[A[k]]","+ diff = -v * (v - 1) \/\/ 2 + (v - 1) * (v - 2) \/\/ 2","+ print((ans + (diff if v != 1 else 0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.047999361,"measured_runtime_v1":0.0454476855,"runtime_lift":1.0561453355,"key":["s395265536","s804629436"]} +{"user_id":"u228232845","problem_id":"p02608","language":"python","submission_id_v0":"s499672632","submission_id_v1":"s816978460","cpu_time_v0":925,"cpu_time_v1":465,"memory_v0":9264,"memory_v1":9256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.73,"input":"import sys\n\n\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef I(): return int(eval(input()))\n\n\n\n\n\nn = I()\n\ncnt = [0] * 10001\n\nfor x in range(1, 101):\n\n for y in range(1, 101):\n\n for z in range(1, 101):\n\n v = x**2 + y**2 + z**2 + x*y + y*z + z*x\n\n if v <= n:\n\n cnt[v] += 1\n\n\n\nfor i in range(1, n + 1):\n\n print((cnt[i]))\n","target":"import sys\n\n\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef I(): return int(eval(input()))\n\n\n\n\n\nn = I()\n\ncnt = [0] * 10001\n\nfor x in range(1, 101):\n\n for y in range(1, 101):\n\n for z in range(1, 101):\n\n v = x*x + y*y + z*z + x*y + y*z + z*x\n\n if v <= n:\n\n cnt[v] += 1\n\n\n\nfor i in range(1, n + 1):\n\n print((cnt[i]))\n","code_v0_loc":18,"code_v1_loc":18,"code_v0_num_chars":369,"code_v1_num_chars":366,"code_v0_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef I():\n return int(eval(input()))\n\n\nn = I()\ncnt = [0] * 10001\nfor x in range(1, 101):\n for y in range(1, 101):\n for z in range(1, 101):\n v = x**2 + y**2 + z**2 + x * y + y * z + z * x\n if v <= n:\n cnt[v] += 1\nfor i in range(1, n + 1):\n print((cnt[i]))\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef I():\n return int(eval(input()))\n\n\nn = I()\ncnt = [0] * 10001\nfor x in range(1, 101):\n for y in range(1, 101):\n for z in range(1, 101):\n v = x * x + y * y + z * z + x * y + y * z + z * x\n if v <= n:\n cnt[v] += 1\nfor i in range(1, n + 1):\n print((cnt[i]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- v = x**2 + y**2 + z**2 + x * y + y * z + z * x","+ v = x * x + y * y + z * z + x * y + y * z + z * x"],"diff_only_import_comment":false,"measured_runtime_v0":1.5620550394,"measured_runtime_v1":0.7197951794,"runtime_lift":2.170138234,"key":["s499672632","s816978460"]} +{"user_id":"u268793453","problem_id":"p03365","language":"python","submission_id_v0":"s756596682","submission_id_v1":"s177707002","cpu_time_v0":1000,"cpu_time_v1":920,"memory_v0":82212,"memory_v1":82340,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.0,"input":"n = int(eval(input()))\n\np = 10**9 + 7\n\n\n\ndef fact(n):\n\n n_ = 1\n\n yield n_\n\n for i in range(1, n+1):\n\n n_ = (n_*i) % p\n\n yield n_\n\n\n\ndef invfact(n, f, p):\n\n m = pow(f[n], p-2, p)\n\n yield m\n\n for i in range(n, 0, -1):\n\n m = m * i % p\n\n yield m\n\n\n\nans = 0\n\nm = n - 1\n\nf = list(fact(m))\n\nrf = list(invfact(m, f, p))\n\nrf.reverse()\n\nperm = 0\n\n\n\nfor k in range((n+1)\/\/2, n):\n\n b = m - k\n\n a = (m - 1) - (2 * b)\n\n perm_ = f[a+b] * rf[a] %p * f[k] % p\n\n ans += (perm_ - perm) %p * k % p\n\n ans %= p\n\n perm = perm_\n\n\n\nprint(ans)","target":"n = int(eval(input()))\n\np = 10**9 + 7\n\n\n\ndef fact(n):\n\n n_ = 1\n\n yield n_\n\n for i in range(1, n+1):\n\n n_ = (n_*i) % p\n\n yield n_\n\n\n\ndef invfact(n, f, p):\n\n m = pow(f[n], p-2, p)\n\n yield m\n\n for i in range(n, 0, -1):\n\n m = m * i % p\n\n yield m\n\n\n\nans = 0\n\nm = n - 1\n\nf = list(fact(m))\n\nrf = list(invfact(m, f, p))\n\nrf.reverse()\n\nperm = 0\n\n\n\nfor k in range((n+1)\/\/2, n):\n\n perm_ = f[k-1] * rf[2*k-n] %p * f[k] % p\n\n ans += (perm_ - perm) %p * k % p\n\n ans %= p\n\n perm = perm_\n\n\n\nprint(ans)","code_v0_loc":33,"code_v1_loc":31,"code_v0_num_chars":577,"code_v1_num_chars":539,"code_v0_no_empty_lines":"n = int(eval(input()))\np = 10**9 + 7\n\n\ndef fact(n):\n n_ = 1\n yield n_\n for i in range(1, n + 1):\n n_ = (n_ * i) % p\n yield n_\n\n\ndef invfact(n, f, p):\n m = pow(f[n], p - 2, p)\n yield m\n for i in range(n, 0, -1):\n m = m * i % p\n yield m\n\n\nans = 0\nm = n - 1\nf = list(fact(m))\nrf = list(invfact(m, f, p))\nrf.reverse()\nperm = 0\nfor k in range((n + 1) \/\/ 2, n):\n b = m - k\n a = (m - 1) - (2 * b)\n perm_ = f[a + b] * rf[a] % p * f[k] % p\n ans += (perm_ - perm) % p * k % p\n ans %= p\n perm = perm_\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\np = 10**9 + 7\n\n\ndef fact(n):\n n_ = 1\n yield n_\n for i in range(1, n + 1):\n n_ = (n_ * i) % p\n yield n_\n\n\ndef invfact(n, f, p):\n m = pow(f[n], p - 2, p)\n yield m\n for i in range(n, 0, -1):\n m = m * i % p\n yield m\n\n\nans = 0\nm = n - 1\nf = list(fact(m))\nrf = list(invfact(m, f, p))\nrf.reverse()\nperm = 0\nfor k in range((n + 1) \/\/ 2, n):\n perm_ = f[k - 1] * rf[2 * k - n] % p * f[k] % p\n ans += (perm_ - perm) % p * k % p\n ans %= p\n perm = perm_\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.0606060606,"diff":["- b = m - k","- a = (m - 1) - (2 * b)","- perm_ = f[a + b] * rf[a] % p * f[k] % p","+ perm_ = f[k - 1] * rf[2 * k - n] % p * f[k] % p"],"diff_only_import_comment":false,"measured_runtime_v0":0.0846870356,"measured_runtime_v1":0.090086973,"runtime_lift":0.9400586209,"key":["s756596682","s177707002"]} +{"user_id":"u722189950","problem_id":"p03386","language":"python","submission_id_v0":"s814348234","submission_id_v1":"s419565143","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"#ABC093B\n\nA,B,K = list(map(int, input().split()))\n\nans = []\n\nif abs(A-B) > K:\n\n for i in range(K):\n\n ans.append(A+i)\n\n ans.append(B-i)\n\n ans = set(ans)\n\n ans = sorted(ans)\n\n for j in ans: \n\n print(j)\n\nelse:\n\n for l in range(abs(A-B)+1):\n\n print((min(A,B) + l))","target":"#ABC093B\n\nA,B,K = list(map(int, input().split()))\n\nans = []\n\nif B-A + 1 > K*2:\n\n for i in range(K):\n\n ans.append(A+i)\n\n ans.append(B-i)\n\n ans.sort()\n\n for j in ans: \n\n print(j)\n\nelse:\n\n for l in range(B-A+1):\n\n print((A + l))","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":296,"code_v1_num_chars":258,"code_v0_no_empty_lines":"# ABC093B\nA, B, K = list(map(int, input().split()))\nans = []\nif abs(A - B) > K:\n for i in range(K):\n ans.append(A + i)\n ans.append(B - i)\n ans = set(ans)\n ans = sorted(ans)\n for j in ans:\n print(j)\nelse:\n for l in range(abs(A - B) + 1):\n print((min(A, B) + l))\n","code_v1_no_empty_lines":"# ABC093B\nA, B, K = list(map(int, input().split()))\nans = []\nif B - A + 1 > K * 2:\n for i in range(K):\n ans.append(A + i)\n ans.append(B - i)\n ans.sort()\n for j in ans:\n print(j)\nelse:\n for l in range(B - A + 1):\n print((A + l))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-if abs(A - B) > K:","+if B - A + 1 > K * 2:","- ans = set(ans)","- ans = sorted(ans)","+ ans.sort()","- for l in range(abs(A - B) + 1):","- print((min(A, B) + l))","+ for l in range(B - A + 1):","+ print((A + l))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0416569633,"measured_runtime_v1":0.0453004472,"runtime_lift":0.9195706862,"key":["s814348234","s419565143"]} +{"user_id":"u021019433","problem_id":"p02803","language":"python","submission_id_v0":"s063190938","submission_id_v1":"s482680531","cpu_time_v0":559,"cpu_time_v1":244,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.35,"input":"from collections import deque\n\n\n\nh, w = list(map(int, input().split()))\n\na = [eval(input()) + '#' for _ in range(h)]\n\nb = ['#' * (w + 1)]\n\nr = 0\n\nfor i in range(h):\n\n for j in range(w):\n\n if a[i][j] == '.':\n\n b[:-1] = list(map(list, a))\n\n b[i][j] = 0\n\n q = deque([(i, j)])\n\n while(q):\n\n i, j = q.popleft()\n\n r = max(r, b[i][j])\n\n d = 0\n\n for i1 in range(i - 1, i + 2):\n\n for j1 in range(j - d, j + 2, 2): \n\n if b[i1][j1] == '.':\n\n b[i1][j1] = b[i][j] + 1\n\n q.append((i1, j1))\n\n d ^= 1\n\nprint(r)\n","target":"from collections import deque\n\n\n\nh, w = list(map(int, input().split()))\n\na = ''.join(eval(input()) + '#' for _ in range(h))\n\nn = len(a)\n\nb = ['#'] * w\n\nr = 0\n\nfor i in range(n):\n\n if a[i] == '.':\n\n b[:-w] = a\n\n b[i] = 0\n\n q = deque([i])\n\n while(q):\n\n i = q.popleft()\n\n r = max(r, b[i])\n\n for j in (i - 1, i + 1, i - w - 1, i + w + 1):\n\n if b[j] == '.':\n\n b[j] = b[i] + 1\n\n q.append(j)\n\nprint(r)\n","code_v0_loc":23,"code_v1_loc":20,"code_v0_num_chars":599,"code_v1_num_chars":436,"code_v0_no_empty_lines":"from collections import deque\n\nh, w = list(map(int, input().split()))\na = [eval(input()) + \"#\" for _ in range(h)]\nb = [\"#\" * (w + 1)]\nr = 0\nfor i in range(h):\n for j in range(w):\n if a[i][j] == \".\":\n b[:-1] = list(map(list, a))\n b[i][j] = 0\n q = deque([(i, j)])\n while q:\n i, j = q.popleft()\n r = max(r, b[i][j])\n d = 0\n for i1 in range(i - 1, i + 2):\n for j1 in range(j - d, j + 2, 2):\n if b[i1][j1] == \".\":\n b[i1][j1] = b[i][j] + 1\n q.append((i1, j1))\n d ^= 1\nprint(r)\n","code_v1_no_empty_lines":"from collections import deque\n\nh, w = list(map(int, input().split()))\na = \"\".join(eval(input()) + \"#\" for _ in range(h))\nn = len(a)\nb = [\"#\"] * w\nr = 0\nfor i in range(n):\n if a[i] == \".\":\n b[:-w] = a\n b[i] = 0\n q = deque([i])\n while q:\n i = q.popleft()\n r = max(r, b[i])\n for j in (i - 1, i + 1, i - w - 1, i + w + 1):\n if b[j] == \".\":\n b[j] = b[i] + 1\n q.append(j)\nprint(r)\n","code_same":false,"relative_loc_diff_percent":13.0434782609,"diff":["-a = [eval(input()) + \"#\" for _ in range(h)]","-b = [\"#\" * (w + 1)]","+a = \"\".join(eval(input()) + \"#\" for _ in range(h))","+n = len(a)","+b = [\"#\"] * w","-for i in range(h):","- for j in range(w):","- if a[i][j] == \".\":","- b[:-1] = list(map(list, a))","- b[i][j] = 0","- q = deque([(i, j)])","- while q:","- i, j = q.popleft()","- r = max(r, b[i][j])","- d = 0","- for i1 in range(i - 1, i + 2):","- for j1 in range(j - d, j + 2, 2):","- if b[i1][j1] == \".\":","- b[i1][j1] = b[i][j] + 1","- q.append((i1, j1))","- d ^= 1","+for i in range(n):","+ if a[i] == \".\":","+ b[:-w] = a","+ b[i] = 0","+ q = deque([i])","+ while q:","+ i = q.popleft()","+ r = max(r, b[i])","+ for j in (i - 1, i + 1, i - w - 1, i + w + 1):","+ if b[j] == \".\":","+ b[j] = b[i] + 1","+ q.append(j)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1017972594,"measured_runtime_v1":0.036329934,"runtime_lift":2.8020215855,"key":["s063190938","s482680531"]} +{"user_id":"u727148417","problem_id":"p02755","language":"python","submission_id_v0":"s575289108","submission_id_v1":"s390540938","cpu_time_v0":22,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.73,"input":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nSpyder\u30a8\u30c7\u30a3\u30bf\n\n\n\n\u3053\u308c\u306f\u4e00\u6642\u7684\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002\n\n\"\"\"\n\nimport math\n\n\n\na,b = list(map(int, input().split()))\n\n\n\nalpha = []\n\nbeta = []\n\n\n\nfor x in range(math.floor(a\/0.08), math.floor(a\/0.05)):\n\n if math.floor(x * 0.08) == a:\n\n alpha.append(x)\n\nfor y in range(math.floor(b\/0.10), math.floor(b\/0.05)):\n\n if math.floor(y * 0.1) == b:\n\n beta.append(y)\n\n\n\nif min(alpha) in beta:\n\n print((min(alpha)))\n\nelif min(beta) in alpha:\n\n print((min(beta)))\n\nelse:\n\n print(\"-1\") \n","target":"import math\n\nA,B = (int(x) for x in input().split())\n\nA1 = math.ceil(A\/0.08)\n\nA2 = math.ceil((A+1)\/0.08)\n\n\n\n\"\"\"if float((A+1)\/0.08).is_integer() == True:\n\n A2 = math.floor((A+1)\/0.08)\n\nelse:\n\n A2 = math.floor((A+1)\/0.08) + 1\n\n\"\"\"\n\nB1 = math.ceil(B\/0.1)\n\nB2 = math.ceil((B+1)\/0.1)\n\n\n\n\"\"\"if float((B+1)\/0.1).is_integer() == True:\n\n B2 = math.floor((B+1)\/0.1)\n\nelse:\n\n B2 = math.floor((B+1)\/0.1) + 1\n\n\"\"\"\n\na = list(range(A1, A2))\n\nb = list(range(B1, B2))\n\nc = set(a) & set(b)\n\nif len(c) == 0:\n\n print((-1))\n\nelse:\n\n print((min(c)))","code_v0_loc":26,"code_v1_loc":25,"code_v0_num_chars":501,"code_v1_num_chars":542,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nSpyder\u30a8\u30c7\u30a3\u30bf\n\u3053\u308c\u306f\u4e00\u6642\u7684\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002\n\"\"\"\nimport math\n\na, b = list(map(int, input().split()))\nalpha = []\nbeta = []\nfor x in range(math.floor(a \/ 0.08), math.floor(a \/ 0.05)):\n if math.floor(x * 0.08) == a:\n alpha.append(x)\nfor y in range(math.floor(b \/ 0.10), math.floor(b \/ 0.05)):\n if math.floor(y * 0.1) == b:\n beta.append(y)\nif min(alpha) in beta:\n print((min(alpha)))\nelif min(beta) in alpha:\n print((min(beta)))\nelse:\n print(\"-1\")\n","code_v1_no_empty_lines":"import math\n\nA, B = (int(x) for x in input().split())\nA1 = math.ceil(A \/ 0.08)\nA2 = math.ceil((A + 1) \/ 0.08)\n\"\"\"if float((A+1)\/0.08).is_integer() == True:\n A2 = math.floor((A+1)\/0.08)\nelse:\n A2 = math.floor((A+1)\/0.08) + 1\n\"\"\"\nB1 = math.ceil(B \/ 0.1)\nB2 = math.ceil((B + 1) \/ 0.1)\n\"\"\"if float((B+1)\/0.1).is_integer() == True:\n B2 = math.floor((B+1)\/0.1)\nelse:\n B2 = math.floor((B+1)\/0.1) + 1\n\"\"\"\na = list(range(A1, A2))\nb = list(range(B1, B2))\nc = set(a) & set(b)\nif len(c) == 0:\n print((-1))\nelse:\n print((min(c)))\n","code_same":false,"relative_loc_diff_percent":3.8461538462,"diff":["-# -*- coding: utf-8 -*-","-\"\"\"","-Spyder\u30a8\u30c7\u30a3\u30bf","-\u3053\u308c\u306f\u4e00\u6642\u7684\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002","-\"\"\"","-a, b = list(map(int, input().split()))","-alpha = []","-beta = []","-for x in range(math.floor(a \/ 0.08), math.floor(a \/ 0.05)):","- if math.floor(x * 0.08) == a:","- alpha.append(x)","-for y in range(math.floor(b \/ 0.10), math.floor(b \/ 0.05)):","- if math.floor(y * 0.1) == b:","- beta.append(y)","-if min(alpha) in beta:","- print((min(alpha)))","-elif min(beta) in alpha:","- print((min(beta)))","+A, B = (int(x) for x in input().split())","+A1 = math.ceil(A \/ 0.08)","+A2 = math.ceil((A + 1) \/ 0.08)","+\"\"\"if float((A+1)\/0.08).is_integer() == True:","+ A2 = math.floor((A+1)\/0.08)","- print(\"-1\")","+ A2 = math.floor((A+1)\/0.08) + 1","+\"\"\"","+B1 = math.ceil(B \/ 0.1)","+B2 = math.ceil((B + 1) \/ 0.1)","+\"\"\"if float((B+1)\/0.1).is_integer() == True:","+ B2 = math.floor((B+1)\/0.1)","+else:","+ B2 = math.floor((B+1)\/0.1) + 1","+\"\"\"","+a = list(range(A1, A2))","+b = list(range(B1, B2))","+c = set(a) & set(b)","+if len(c) == 0:","+ print((-1))","+else:","+ print((min(c)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450353138,"measured_runtime_v1":0.0492681234,"runtime_lift":0.9140862436,"key":["s575289108","s390540938"]} +{"user_id":"u681444474","problem_id":"p03733","language":"python","submission_id_v0":"s075288784","submission_id_v1":"s412925477","cpu_time_v0":264,"cpu_time_v1":108,"memory_v0":85456,"memory_v1":103980,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.09,"input":"N,T = list(map(int,input().split()))\n\nt = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(1,N):\n\n emp_time=(t[i]-t[i-1])-T\n\n if emp_time >= 0:\n\n cnt += T\n\n else:\n\n cnt += t[i]-t[i-1]\n\nprint((cnt+T))","target":"# coding: utf-8\n\nn, t = list(map(int,input().split()))\n\nT = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(n-1):\n\n if T[i+1] - T[i] >= t:\n\n ans += t\n\n else:\n\n ans += T[i+1] - T[i]\n\nprint((ans+t))","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":221,"code_v1_num_chars":216,"code_v0_no_empty_lines":"N, T = list(map(int, input().split()))\nt = list(map(int, input().split()))\ncnt = 0\nfor i in range(1, N):\n emp_time = (t[i] - t[i - 1]) - T\n if emp_time >= 0:\n cnt += T\n else:\n cnt += t[i] - t[i - 1]\nprint((cnt + T))\n","code_v1_no_empty_lines":"# coding: utf-8\nn, t = list(map(int, input().split()))\nT = list(map(int, input().split()))\nans = 0\nfor i in range(n - 1):\n if T[i + 1] - T[i] >= t:\n ans += t\n else:\n ans += T[i + 1] - T[i]\nprint((ans + t))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-N, T = list(map(int, input().split()))","-t = list(map(int, input().split()))","-cnt = 0","-for i in range(1, N):","- emp_time = (t[i] - t[i - 1]) - T","- if emp_time >= 0:","- cnt += T","+# coding: utf-8","+n, t = list(map(int, input().split()))","+T = list(map(int, input().split()))","+ans = 0","+for i in range(n - 1):","+ if T[i + 1] - T[i] >= t:","+ ans += t","- cnt += t[i] - t[i - 1]","-print((cnt + T))","+ ans += T[i + 1] - T[i]","+print((ans + t))"],"diff_only_import_comment":false,"measured_runtime_v0":0.035051582,"measured_runtime_v1":0.0347655663,"runtime_lift":1.0082269835,"key":["s075288784","s412925477"]} +{"user_id":"u718949306","problem_id":"p02784","language":"python","submission_id_v0":"s379991404","submission_id_v1":"s544400652","cpu_time_v0":64,"cpu_time_v1":55,"memory_v0":13964,"memory_v1":14092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.06,"input":"H, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\ncnt = 0\n\nwhile (H > 0):\n\n for n in range(N):\n\n H = H - A[n]\n\n cnt += 1\n\nif cnt == 1:\n\n print('Yes')\n\nelse:\n\n print('No')","target":"H, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nfor n in range(N):\n\n H = H - A[n]\n\nif H <= 0:\n\n print('Yes')\n\nelse:\n\n print('No')","code_v0_loc":11,"code_v1_loc":8,"code_v0_num_chars":210,"code_v1_num_chars":164,"code_v0_no_empty_lines":"H, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\ncnt = 0\nwhile H > 0:\n for n in range(N):\n H = H - A[n]\n cnt += 1\nif cnt == 1:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"H, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\nfor n in range(N):\n H = H - A[n]\nif H <= 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-cnt = 0","-while H > 0:","- for n in range(N):","- H = H - A[n]","- cnt += 1","-if cnt == 1:","+for n in range(N):","+ H = H - A[n]","+if H <= 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443499887,"measured_runtime_v1":0.0410389717,"runtime_lift":1.0806798244,"key":["s379991404","s544400652"]} +{"user_id":"u888092736","problem_id":"p03687","language":"python","submission_id_v0":"s531133328","submission_id_v1":"s316615956","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"s = list(eval(input()))\n\nans = len(s)\n\nfor c in s:\n\n dist = 0\n\n dists = []\n\n for d in s:\n\n if c != d:\n\n dist += 1\n\n else:\n\n dists.append(dist)\n\n dist = 0\n\n ans = min(ans, max(dists + [dist]))\n\nprint(ans)","target":"s = list(eval(input()))\n\nans = len(s)\n\nfor c in set(s):\n\n dist = 0\n\n dists = []\n\n for d in s:\n\n if c != d:\n\n dist += 1\n\n else:\n\n dists.append(dist)\n\n dist = 0\n\n ans = min(ans, max(dists + [dist]))\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":256,"code_v1_num_chars":261,"code_v0_no_empty_lines":"s = list(eval(input()))\nans = len(s)\nfor c in s:\n dist = 0\n dists = []\n for d in s:\n if c != d:\n dist += 1\n else:\n dists.append(dist)\n dist = 0\n ans = min(ans, max(dists + [dist]))\nprint(ans)\n","code_v1_no_empty_lines":"s = list(eval(input()))\nans = len(s)\nfor c in set(s):\n dist = 0\n dists = []\n for d in s:\n if c != d:\n dist += 1\n else:\n dists.append(dist)\n dist = 0\n ans = min(ans, max(dists + [dist]))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for c in s:","+for c in set(s):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372079358,"measured_runtime_v1":0.0633350847,"runtime_lift":0.5874774778,"key":["s531133328","s316615956"]} +{"user_id":"u873190923","problem_id":"p02787","language":"python","submission_id_v0":"s245495281","submission_id_v1":"s461198717","cpu_time_v0":692,"cpu_time_v1":609,"memory_v0":125532,"memory_v1":125276,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.99,"input":"h,n = list(map(int, input().split()))\n\nmagic = []\n\nINF = 10**8\n\ndp = [[INF for j in range(h+1)] for i in range(n+1)] #\u4f53\u529b\u304cj\u306e\u30e2\u30f3\u30b9\u30bf\u30fc\u3092i\u756a\u76ee\u306e\u9b54\u6cd5\u307e\u3067\u3092\u4f7f\u3063\u3066\u5012\u305b\u308b\u6d88\u8cbb\u9b54\u529b\u306e\u6700\u5c0f\u5024\n\n \n\nfor i in range(n):\n\n a,b = list(map(int, input().split()))\n\n magic.append([a, b])\n\n \n\nfor i in range(n):\n\n for j in range(h):\n\n if j+1 > magic[i][0]:\n\n dp[i+1][j+1] = min(dp[i][j+1], dp[i][j+1-magic[i][0]] + magic[i][1], dp[i+1][j+1-magic[i][0]] + magic[i][1])\n\n else:\n\n dp[i+1][j+1] = min(dp[i][j+1], magic[i][1])\n\n \n\nprint((dp[n][h]))","target":"inf = 10**15\n\nmod = 10**9+7\n\nh,n = list(map(int, input().split()))\n\nab = [list(map(int, input().split())) for i in range(n)]\n\ndp = [[inf for j in range(h+1)] for i in range(n+1)]\n\nfor i in range(n):\n\n dp[i][0] = 0\n\n a,b = ab[i]\n\n for j in range(h):\n\n if j+1-a>=0:\n\n dp[i+1][j+1] = min(dp[i+1][j+1-a]+b, dp[i][j+1], dp[i][j+1-a]+b)\n\n else:\n\n dp[i+1][j+1] = min(dp[i][j+1], b)\n\nprint((dp[n][h]))","code_v0_loc":17,"code_v1_loc":14,"code_v0_num_chars":535,"code_v1_num_chars":430,"code_v0_no_empty_lines":"h, n = list(map(int, input().split()))\nmagic = []\nINF = 10**8\ndp = [\n [INF for j in range(h + 1)] for i in range(n + 1)\n] # \u4f53\u529b\u304cj\u306e\u30e2\u30f3\u30b9\u30bf\u30fc\u3092i\u756a\u76ee\u306e\u9b54\u6cd5\u307e\u3067\u3092\u4f7f\u3063\u3066\u5012\u305b\u308b\u6d88\u8cbb\u9b54\u529b\u306e\u6700\u5c0f\u5024\nfor i in range(n):\n a, b = list(map(int, input().split()))\n magic.append([a, b])\nfor i in range(n):\n for j in range(h):\n if j + 1 > magic[i][0]:\n dp[i + 1][j + 1] = min(\n dp[i][j + 1],\n dp[i][j + 1 - magic[i][0]] + magic[i][1],\n dp[i + 1][j + 1 - magic[i][0]] + magic[i][1],\n )\n else:\n dp[i + 1][j + 1] = min(dp[i][j + 1], magic[i][1])\nprint((dp[n][h]))\n","code_v1_no_empty_lines":"inf = 10**15\nmod = 10**9 + 7\nh, n = list(map(int, input().split()))\nab = [list(map(int, input().split())) for i in range(n)]\ndp = [[inf for j in range(h + 1)] for i in range(n + 1)]\nfor i in range(n):\n dp[i][0] = 0\n a, b = ab[i]\n for j in range(h):\n if j + 1 - a >= 0:\n dp[i + 1][j + 1] = min(\n dp[i + 1][j + 1 - a] + b, dp[i][j + 1], dp[i][j + 1 - a] + b\n )\n else:\n dp[i + 1][j + 1] = min(dp[i][j + 1], b)\nprint((dp[n][h]))\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["+inf = 10**15","+mod = 10**9 + 7","-magic = []","-INF = 10**8","-dp = [","- [INF for j in range(h + 1)] for i in range(n + 1)","-] # \u4f53\u529b\u304cj\u306e\u30e2\u30f3\u30b9\u30bf\u30fc\u3092i\u756a\u76ee\u306e\u9b54\u6cd5\u307e\u3067\u3092\u4f7f\u3063\u3066\u5012\u305b\u308b\u6d88\u8cbb\u9b54\u529b\u306e\u6700\u5c0f\u5024","+ab = [list(map(int, input().split())) for i in range(n)]","+dp = [[inf for j in range(h + 1)] for i in range(n + 1)]","- a, b = list(map(int, input().split()))","- magic.append([a, b])","-for i in range(n):","+ dp[i][0] = 0","+ a, b = ab[i]","- if j + 1 > magic[i][0]:","+ if j + 1 - a >= 0:","- dp[i][j + 1],","- dp[i][j + 1 - magic[i][0]] + magic[i][1],","- dp[i + 1][j + 1 - magic[i][0]] + magic[i][1],","+ dp[i + 1][j + 1 - a] + b, dp[i][j + 1], dp[i][j + 1 - a] + b","- dp[i + 1][j + 1] = min(dp[i][j + 1], magic[i][1])","+ dp[i + 1][j + 1] = min(dp[i][j + 1], b)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2193113978,"measured_runtime_v1":0.4301272311,"runtime_lift":0.5098756412,"key":["s245495281","s461198717"]} +{"user_id":"u408260374","problem_id":"p01138","language":"python","submission_id_v0":"s321276433","submission_id_v1":"s078865701","cpu_time_v0":9520,"cpu_time_v1":6420,"memory_v0":10804,"memory_v1":9592,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.56,"input":"def tosec(t):\n\n return int(t[:2])*60*60 + int(t[3:5])*60 + int(t[6:])\n\n\n\nwhile True:\n\n n = int(eval(input()))\n\n if n == 0: break\n\n time = [0] * (60*60*24 + 1)\n\n\n\n for _ in range(n):\n\n s, f = input().split()\n\n time[tosec(s)] += 1\n\n time[tosec(f)] -= 1\n\n\n\n ans = time[0]\n\n for i in range(60*60*24):\n\n time[i+1] += time[i]\n\n ans = max(ans, time[i+1])\n\n\n\n print(ans)","target":"while True:\n\n n = eval(input())\n\n if not n: break \n\n time = [0]*86400\n\n for i in range(n):\n\n s, t = input().split()\n\n ssec = int(s[0:2])*3600 + int(s[3:5])*60 + int(s[6:8])\n\n tsec = int(t[0:2])*3600 + int(t[3:5])*60 + int(t[6:8])\n\n time[ssec] += 1\n\n time[tsec] -= 1\n\n ans = time[0]\n\n for i in range(86400-1):\n\n time[i+1] += time[i]\n\n ans = max(ans, time[i+1])\n\n print(ans)\n\n\n\n ","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":415,"code_v1_num_chars":451,"code_v0_no_empty_lines":"def tosec(t):\n return int(t[:2]) * 60 * 60 + int(t[3:5]) * 60 + int(t[6:])\n\n\nwhile True:\n n = int(eval(input()))\n if n == 0:\n break\n time = [0] * (60 * 60 * 24 + 1)\n for _ in range(n):\n s, f = input().split()\n time[tosec(s)] += 1\n time[tosec(f)] -= 1\n ans = time[0]\n for i in range(60 * 60 * 24):\n time[i + 1] += time[i]\n ans = max(ans, time[i + 1])\n print(ans)\n","code_v1_no_empty_lines":"while True:\n n = eval(input())\n if not n:\n break\n time = [0] * 86400\n for i in range(n):\n s, t = input().split()\n ssec = int(s[0:2]) * 3600 + int(s[3:5]) * 60 + int(s[6:8])\n tsec = int(t[0:2]) * 3600 + int(t[3:5]) * 60 + int(t[6:8])\n time[ssec] += 1\n time[tsec] -= 1\n ans = time[0]\n for i in range(86400 - 1):\n time[i + 1] += time[i]\n ans = max(ans, time[i + 1])\n print(ans)\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-def tosec(t):","- return int(t[:2]) * 60 * 60 + int(t[3:5]) * 60 + int(t[6:])","-","-","- n = int(eval(input()))","- if n == 0:","+ n = eval(input())","+ if not n:","- time = [0] * (60 * 60 * 24 + 1)","- for _ in range(n):","- s, f = input().split()","- time[tosec(s)] += 1","- time[tosec(f)] -= 1","+ time = [0] * 86400","+ for i in range(n):","+ s, t = input().split()","+ ssec = int(s[0:2]) * 3600 + int(s[3:5]) * 60 + int(s[6:8])","+ tsec = int(t[0:2]) * 3600 + int(t[3:5]) * 60 + int(t[6:8])","+ time[ssec] += 1","+ time[tsec] -= 1","- for i in range(60 * 60 * 24):","+ for i in range(86400 - 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0071556511,"measured_runtime_v1":0.2606002402,"runtime_lift":0.0274583442,"key":["s321276433","s078865701"]} +{"user_id":"u761529120","problem_id":"p03722","language":"python","submission_id_v0":"s970621692","submission_id_v1":"s033198268","cpu_time_v0":988,"cpu_time_v1":311,"memory_v0":3316,"memory_v1":47064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.52,"input":"\n\nN, M = list(map(int, input().split()))\n\n\n\nedges = []\n\n\n\nfor i in range(M):\n\n a, b, c = list(map(int, input().split()))\n\n edges.append([a,b,c])\n\n\n\ndist = [float('inf')] * (N + 1)\n\ndist[1] = 0\n\n\n\nfor _ in range(N - 1):\n\n for a, b, c in edges:\n\n dist[b] = min(dist[b], dist[a] - c)\n\n\n\nans = dist[N]\n\nfor a, b, c in edges:\n\n dist[b] = min(dist[b], dist[a] - c)\n\n\n\nif ans == dist[N]:\n\n print((-ans))\n\nelse:\n\n print('inf')","target":"def main():\n\n N, M = list(map(int, input().split()))\n\n edges = []\n\n \n\n for _ in range(M):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n edges.append([a,b,c])\n\n\n\n d = [float('inf')] * N\n\n d[0] = 0\n\n\n\n for i in range(N-1):\n\n for edge in edges:\n\n d[edge[1]] = min(d[edge[1]], d[edge[0]] - edge[2])\n\n\n\n ans = d[N-1]\n\n for edge in edges:\n\n d[edge[1]] = min(d[edge[1]], d[edge[0]] - edge[2])\n\n\n\n if ans == d[N-1]:\n\n print((-ans))\n\n else:\n\n print('inf')\n\n\n\n\n\nmain()","code_v0_loc":24,"code_v1_loc":28,"code_v0_num_chars":429,"code_v1_num_chars":562,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nedges = []\nfor i in range(M):\n a, b, c = list(map(int, input().split()))\n edges.append([a, b, c])\ndist = [float(\"inf\")] * (N + 1)\ndist[1] = 0\nfor _ in range(N - 1):\n for a, b, c in edges:\n dist[b] = min(dist[b], dist[a] - c)\nans = dist[N]\nfor a, b, c in edges:\n dist[b] = min(dist[b], dist[a] - c)\nif ans == dist[N]:\n print((-ans))\nelse:\n print(\"inf\")\n","code_v1_no_empty_lines":"def main():\n N, M = list(map(int, input().split()))\n edges = []\n for _ in range(M):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n edges.append([a, b, c])\n d = [float(\"inf\")] * N\n d[0] = 0\n for i in range(N - 1):\n for edge in edges:\n d[edge[1]] = min(d[edge[1]], d[edge[0]] - edge[2])\n ans = d[N - 1]\n for edge in edges:\n d[edge[1]] = min(d[edge[1]], d[edge[0]] - edge[2])\n if ans == d[N - 1]:\n print((-ans))\n else:\n print(\"inf\")\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-N, M = list(map(int, input().split()))","-edges = []","-for i in range(M):","- a, b, c = list(map(int, input().split()))","- edges.append([a, b, c])","-dist = [float(\"inf\")] * (N + 1)","-dist[1] = 0","-for _ in range(N - 1):","- for a, b, c in edges:","- dist[b] = min(dist[b], dist[a] - c)","-ans = dist[N]","-for a, b, c in edges:","- dist[b] = min(dist[b], dist[a] - c)","-if ans == dist[N]:","- print((-ans))","-else:","- print(\"inf\")","+def main():","+ N, M = list(map(int, input().split()))","+ edges = []","+ for _ in range(M):","+ a, b, c = list(map(int, input().split()))","+ a -= 1","+ b -= 1","+ edges.append([a, b, c])","+ d = [float(\"inf\")] * N","+ d[0] = 0","+ for i in range(N - 1):","+ for edge in edges:","+ d[edge[1]] = min(d[edge[1]], d[edge[0]] - edge[2])","+ ans = d[N - 1]","+ for edge in edges:","+ d[edge[1]] = min(d[edge[1]], d[edge[0]] - edge[2])","+ if ans == d[N - 1]:","+ print((-ans))","+ else:","+ print(\"inf\")","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0410733366,"measured_runtime_v1":0.0627606051,"runtime_lift":0.6544445601,"key":["s970621692","s033198268"]} +{"user_id":"u759412327","problem_id":"p02596","language":"python","submission_id_v0":"s318711322","submission_id_v1":"s984031641","cpu_time_v0":227,"cpu_time_v1":208,"memory_v0":9164,"memory_v1":9064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.37,"input":"K = int(eval(input()))\n\na = 7\n\n\n\nfor n in range(1,1+K):\n\n if a%K==0:\n\n print(n)\n\n exit()\n\n a = (a*10+7)%K\n\n\n\nprint((-1))","target":"K = int(eval(input()))\n\na = 7\n\n\n\nfor k in range(1,K+1):\n\n if a%K==0:\n\n print(k)\n\n exit()\n\n a = (10*a+7)%K\n\n\n\nprint((-1))","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":120,"code_v1_num_chars":120,"code_v0_no_empty_lines":"K = int(eval(input()))\na = 7\nfor n in range(1, 1 + K):\n if a % K == 0:\n print(n)\n exit()\n a = (a * 10 + 7) % K\nprint((-1))\n","code_v1_no_empty_lines":"K = int(eval(input()))\na = 7\nfor k in range(1, K + 1):\n if a % K == 0:\n print(k)\n exit()\n a = (10 * a + 7) % K\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for n in range(1, 1 + K):","+for k in range(1, K + 1):","- print(n)","+ print(k)","- a = (a * 10 + 7) % K","+ a = (10 * a + 7) % K"],"diff_only_import_comment":false,"measured_runtime_v0":0.0840738461,"measured_runtime_v1":0.2587163925,"runtime_lift":0.3249652845,"key":["s318711322","s984031641"]} +{"user_id":"u519339498","problem_id":"p02582","language":"python","submission_id_v0":"s034100258","submission_id_v1":"s970235937","cpu_time_v0":28,"cpu_time_v1":25,"memory_v0":9024,"memory_v1":9080,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.71,"input":"S=eval(input())\n\nif S==\"RRR\":\n\n print((3))\n\nelif \"RR\" in S:\n\n print((2))\n\nelif \"R\" in S:\n\n print((1))\n\nelse:\n\n print((0))","target":"S=input().split(\"S\")\n\nans=0\n\nfor i in S:\n\n ans=max(ans,len(i))\n\nprint(ans)\n\n#\u3053\u308c\u601d\u3044\u3064\u304f\u4eba\u3059\u3054\u3044\u306a\u3041","code_v0_loc":9,"code_v1_loc":6,"code_v0_num_chars":111,"code_v1_num_chars":90,"code_v0_no_empty_lines":"S = eval(input())\nif S == \"RRR\":\n print((3))\nelif \"RR\" in S:\n print((2))\nelif \"R\" in S:\n print((1))\nelse:\n print((0))\n","code_v1_no_empty_lines":"S = input().split(\"S\")\nans = 0\nfor i in S:\n ans = max(ans, len(i))\nprint(ans)\n# \u3053\u308c\u601d\u3044\u3064\u304f\u4eba\u3059\u3054\u3044\u306a\u3041\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-S = eval(input())","-if S == \"RRR\":","- print((3))","-elif \"RR\" in S:","- print((2))","-elif \"R\" in S:","- print((1))","-else:","- print((0))","+S = input().split(\"S\")","+ans = 0","+for i in S:","+ ans = max(ans, len(i))","+print(ans)","+# \u3053\u308c\u601d\u3044\u3064\u304f\u4eba\u3059\u3054\u3044\u306a\u3041"],"diff_only_import_comment":false,"measured_runtime_v0":0.0359083675,"measured_runtime_v1":0.0994799308,"runtime_lift":0.3609609213,"key":["s034100258","s970235937"]} +{"user_id":"u784022244","problem_id":"p03221","language":"python","submission_id_v0":"s537224591","submission_id_v1":"s948857029","cpu_time_v0":945,"cpu_time_v1":703,"memory_v0":43084,"memory_v1":41388,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.61,"input":"\n\nN, M=list(map(int, input().split()))\n\n#A=[]\n\nY=[[] for _ in range(N)] #\u770c\n\nfor i in range(M):\n\n p,y=list(map(int, input().split()))\n\n #A.append((p,y))\n\n Y[p-1].append([y,i+1])\n\n\n\nfor i in range(N):\n\n if Y[i]:\n\n Y[i].sort(key=lambda x: x[0])\n\n#index\u306f\u6642\u9593\u304b\u304b\u308b\n\nans=[]\n\nfor i in range(N):\n\n for j,L in enumerate(Y[i]):\n\n p,y,n=i+1, L[0],L[1]\n\n ans.append((n,p,j+1))\n\nans=sorted(ans)\n\nfor n,p,y in ans:\n\n a=(6-len(str(p)))*\"0\"+str(p)+(6-len(str(y)))*\"0\"+str(y)\n\n print(a)","target":"import bisect\n\nN,M=list(map(int, input().split()))\n\nP=[[] for _ in range(N)]\n\nL=[]\n\nfor i in range(M):\n\n p,y=list(map(int, input().split()))\n\n L.append((p,y))\n\n P[p-1].append(y)\n\n\n\nnewP=[]\n\nfor p in P:\n\n p=sorted(p)\n\n newP.append(p)\n\n\n\nfor i in range(M):\n\n t=L[i]\n\n p,y=t\n\n num=bisect.bisect_right(newP[p-1],y)\n\n \n\n p=str(p).zfill(6)\n\n num=str(num).zfill(6)\n\n print((p+num))\n","code_v0_loc":22,"code_v1_loc":22,"code_v0_num_chars":469,"code_v1_num_chars":397,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\n# A=[]\nY = [[] for _ in range(N)] # \u770c\nfor i in range(M):\n p, y = list(map(int, input().split()))\n # A.append((p,y))\n Y[p - 1].append([y, i + 1])\nfor i in range(N):\n if Y[i]:\n Y[i].sort(key=lambda x: x[0])\n# index\u306f\u6642\u9593\u304b\u304b\u308b\nans = []\nfor i in range(N):\n for j, L in enumerate(Y[i]):\n p, y, n = i + 1, L[0], L[1]\n ans.append((n, p, j + 1))\nans = sorted(ans)\nfor n, p, y in ans:\n a = (6 - len(str(p))) * \"0\" + str(p) + (6 - len(str(y))) * \"0\" + str(y)\n print(a)\n","code_v1_no_empty_lines":"import bisect\n\nN, M = list(map(int, input().split()))\nP = [[] for _ in range(N)]\nL = []\nfor i in range(M):\n p, y = list(map(int, input().split()))\n L.append((p, y))\n P[p - 1].append(y)\nnewP = []\nfor p in P:\n p = sorted(p)\n newP.append(p)\nfor i in range(M):\n t = L[i]\n p, y = t\n num = bisect.bisect_right(newP[p - 1], y)\n p = str(p).zfill(6)\n num = str(num).zfill(6)\n print((p + num))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+import bisect","+","-# A=[]","-Y = [[] for _ in range(N)] # \u770c","+P = [[] for _ in range(N)]","+L = []","- # A.append((p,y))","- Y[p - 1].append([y, i + 1])","-for i in range(N):","- if Y[i]:","- Y[i].sort(key=lambda x: x[0])","-# index\u306f\u6642\u9593\u304b\u304b\u308b","-ans = []","-for i in range(N):","- for j, L in enumerate(Y[i]):","- p, y, n = i + 1, L[0], L[1]","- ans.append((n, p, j + 1))","-ans = sorted(ans)","-for n, p, y in ans:","- a = (6 - len(str(p))) * \"0\" + str(p) + (6 - len(str(y))) * \"0\" + str(y)","- print(a)","+ L.append((p, y))","+ P[p - 1].append(y)","+newP = []","+for p in P:","+ p = sorted(p)","+ newP.append(p)","+for i in range(M):","+ t = L[i]","+ p, y = t","+ num = bisect.bisect_right(newP[p - 1], y)","+ p = str(p).zfill(6)","+ num = str(num).zfill(6)","+ print((p + num))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0611273688,"measured_runtime_v1":0.0611533334,"runtime_lift":0.999575417,"key":["s537224591","s948857029"]} +{"user_id":"u815304751","problem_id":"p02910","language":"python","submission_id_v0":"s540657955","submission_id_v1":"s627487323","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"s = eval(input())\n\nflag = True\n\n\n\nfor i in range(1, len(s) + 1):\n\n \n\n if i % 2 == 1:\n\n if s[i-1] == 'L':\n\n flag = False\n\n \n\n else:\n\n if s[i-1] == 'R':\n\n flag = False\n\n\n\nif flag:\n\n print('Yes')\n\nelse:\n\n print('No')","target":"S=eval(input())\n\n\n\ncnt=0\n\nfor i in range(len(S)):\n\n if i%2==0:\n\n if S[i]=='L':\n\n cnt+=1\n\n else:\n\n if S[i]=='R':\n\n cnt+=1\n\nif cnt==0:\n\n print('Yes')\n\nelse:\n\n print('No')\n","code_v0_loc":17,"code_v1_loc":14,"code_v0_num_chars":269,"code_v1_num_chars":211,"code_v0_no_empty_lines":"s = eval(input())\nflag = True\nfor i in range(1, len(s) + 1):\n if i % 2 == 1:\n if s[i - 1] == \"L\":\n flag = False\n else:\n if s[i - 1] == \"R\":\n flag = False\nif flag:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"S = eval(input())\ncnt = 0\nfor i in range(len(S)):\n if i % 2 == 0:\n if S[i] == \"L\":\n cnt += 1\n else:\n if S[i] == \"R\":\n cnt += 1\nif cnt == 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["-s = eval(input())","-flag = True","-for i in range(1, len(s) + 1):","- if i % 2 == 1:","- if s[i - 1] == \"L\":","- flag = False","+S = eval(input())","+cnt = 0","+for i in range(len(S)):","+ if i % 2 == 0:","+ if S[i] == \"L\":","+ cnt += 1","- if s[i - 1] == \"R\":","- flag = False","-if flag:","+ if S[i] == \"R\":","+ cnt += 1","+if cnt == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0416741978,"measured_runtime_v1":0.0447133344,"runtime_lift":0.9320306432,"key":["s540657955","s627487323"]} +{"user_id":"u652569315","problem_id":"p02802","language":"python","submission_id_v0":"s933214085","submission_id_v1":"s721370445","cpu_time_v0":123,"cpu_time_v1":92,"memory_v0":4596,"memory_v1":4596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.2,"input":"def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n n,m=list(map(int,input().split()))\n\n ac,wa,l,k=0,0,[0]*n,[0]*m\n\n for _ in k:\n\n p,s=input().split()\n\n p=int(p)\n\n if type(l[p-1])==int:\n\n if s==b'AC':\n\n ac+=1\n\n wa+=l[p-1]\n\n l[p-1]=''\n\n else:\n\n l[p-1]+=1\n\n print((ac,wa))\n\n \n\nif __name__ == '__main__':\n\n main()","target":"def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n n,m=list(map(int,input().split()))\n\n a,w,l,k=0,0,[0]*n,[0]*m\n\n for _ in k:\n\n p,s=input().split()\n\n p=int(p)-1\n\n if l[p]>=0:\n\n if s==b'AC':\n\n a+=1\n\n w+=l[p]\n\n l[p]=-1\n\n else:\n\n l[p]+=1\n\n print((a,w))\n\n \n\nif __name__ == '__main__':\n\n main()","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":370,"code_v1_num_chars":350,"code_v0_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.buffer.readline\n n, m = list(map(int, input().split()))\n ac, wa, l, k = 0, 0, [0] * n, [0] * m\n for _ in k:\n p, s = input().split()\n p = int(p)\n if type(l[p - 1]) == int:\n if s == b\"AC\":\n ac += 1\n wa += l[p - 1]\n l[p - 1] = \"\"\n else:\n l[p - 1] += 1\n print((ac, wa))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.buffer.readline\n n, m = list(map(int, input().split()))\n a, w, l, k = 0, 0, [0] * n, [0] * m\n for _ in k:\n p, s = input().split()\n p = int(p) - 1\n if l[p] >= 0:\n if s == b\"AC\":\n a += 1\n w += l[p]\n l[p] = -1\n else:\n l[p] += 1\n print((a, w))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- ac, wa, l, k = 0, 0, [0] * n, [0] * m","+ a, w, l, k = 0, 0, [0] * n, [0] * m","- p = int(p)","- if type(l[p - 1]) == int:","+ p = int(p) - 1","+ if l[p] >= 0:","- ac += 1","- wa += l[p - 1]","- l[p - 1] = \"\"","+ a += 1","+ w += l[p]","+ l[p] = -1","- l[p - 1] += 1","- print((ac, wa))","+ l[p] += 1","+ print((a, w))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0368530459,"measured_runtime_v1":0.0367993402,"runtime_lift":1.0014594197,"key":["s933214085","s721370445"]} +{"user_id":"u340500592","problem_id":"p00433","language":"python","submission_id_v0":"s839905786","submission_id_v1":"s151153533","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7672,"memory_v1":7712,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"A = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nmax_sum = max([sum(A), sum(B)])\n\nprint(max_sum)","target":"A, B = [list(map(int, input().split())) for _ in range(2)]\n\nprint((max([sum(A), sum(B)])))","code_v0_loc":4,"code_v1_loc":2,"code_v0_num_chars":121,"code_v1_num_chars":88,"code_v0_no_empty_lines":"A = list(map(int, input().split()))\nB = list(map(int, input().split()))\nmax_sum = max([sum(A), sum(B)])\nprint(max_sum)\n","code_v1_no_empty_lines":"A, B = [list(map(int, input().split())) for _ in range(2)]\nprint((max([sum(A), sum(B)])))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-A = list(map(int, input().split()))","-B = list(map(int, input().split()))","-max_sum = max([sum(A), sum(B)])","-print(max_sum)","+A, B = [list(map(int, input().split())) for _ in range(2)]","+print((max([sum(A), sum(B)])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0784293652,"measured_runtime_v1":0.0384841442,"runtime_lift":2.0379656803,"key":["s839905786","s151153533"]} +{"user_id":"u078349616","problem_id":"p03546","language":"python","submission_id_v0":"s362722706","submission_id_v1":"s239015097","cpu_time_v0":264,"cpu_time_v1":39,"memory_v0":18412,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.23,"input":"# ABC79 D - Wall\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\nH, W = list(map(int, input().split()))\n\nC = [list(map(int, input().split())) for _ in range(10)]\n\nA = [list(map(int, input().split())) for _ in range(H)]\n\n\n\nC = floyd_warshall(C) \n\n\n\ncost = 0\n\nfor i in range(H):\n\n for a in A[i]:\n\n if a != -1:\n\n cost += C[a][1]\n\n\n\nprint((int(cost)))","target":"# ABC79 D - Wall\n\nH, W = list(map(int, input().split()))\n\nC = [list(map(int, input().split())) for _ in range(10)]\n\nA = [list(map(int, input().split())) for _ in range(H)]\n\n\n\ndef f_warshall(C):\n\n for k in range(10):\n\n for i in range(10):\n\n for j in range(10):\n\n C[i][j] = min(C[i][j], C[i][k] + C[k][j])\n\n\n\nf_warshall(C)\n\n\n\ncost = 0\n\nfor i in range(H):\n\n for j in range(W):\n\n if A[i][j] == -1:\n\n continue\n\n else:\n\n cost += C[A[i][j]][1]\n\n\n\nprint((int(cost)))","code_v0_loc":16,"code_v1_loc":22,"code_v0_num_chars":365,"code_v1_num_chars":483,"code_v0_no_empty_lines":"# ABC79 D - Wall\nfrom scipy.sparse.csgraph import floyd_warshall\n\nH, W = list(map(int, input().split()))\nC = [list(map(int, input().split())) for _ in range(10)]\nA = [list(map(int, input().split())) for _ in range(H)]\nC = floyd_warshall(C)\ncost = 0\nfor i in range(H):\n for a in A[i]:\n if a != -1:\n cost += C[a][1]\nprint((int(cost)))\n","code_v1_no_empty_lines":"# ABC79 D - Wall\nH, W = list(map(int, input().split()))\nC = [list(map(int, input().split())) for _ in range(10)]\nA = [list(map(int, input().split())) for _ in range(H)]\n\n\ndef f_warshall(C):\n for k in range(10):\n for i in range(10):\n for j in range(10):\n C[i][j] = min(C[i][j], C[i][k] + C[k][j])\n\n\nf_warshall(C)\ncost = 0\nfor i in range(H):\n for j in range(W):\n if A[i][j] == -1:\n continue\n else:\n cost += C[A[i][j]][1]\nprint((int(cost)))\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-from scipy.sparse.csgraph import floyd_warshall","-","-C = floyd_warshall(C)","+","+","+def f_warshall(C):","+ for k in range(10):","+ for i in range(10):","+ for j in range(10):","+ C[i][j] = min(C[i][j], C[i][k] + C[k][j])","+","+","+f_warshall(C)","- for a in A[i]:","- if a != -1:","- cost += C[a][1]","+ for j in range(W):","+ if A[i][j] == -1:","+ continue","+ else:","+ cost += C[A[i][j]][1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.5010698352,"measured_runtime_v1":0.041781764,"runtime_lift":11.9925485841,"key":["s362722706","s239015097"]} +{"user_id":"u860002137","problem_id":"p03311","language":"python","submission_id_v0":"s575512467","submission_id_v1":"s703344707","cpu_time_v0":224,"cpu_time_v1":186,"memory_v0":34232,"memory_v1":49424,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.96,"input":"import sys\n\nimport numpy as np\n\nn = int(eval(input()))\n\narr = np.array(list(map(int, input().split())))\n\n\n\ncomp = np.arange(n) + 1\n\ndiff = arr - comp\n\n\n\ndiff.sort()\n\n\n\ndiff = diff - np.median(diff)\n\n\n\nprint((int(np.abs(diff).sum())))","target":"import numpy as np\n\n\n\nn = int(eval(input()))\n\na = np.array(list(map(int, input().split())))\n\n\n\narr = np.arange(n) + 1\n\ndiff = a - arr\n\n\n\ndiff.sort()\n\n\n\ndiff = diff - np.median(diff)\n\n\n\nprint((int(np.abs(diff).sum())))","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":225,"code_v1_num_chars":209,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nn = int(eval(input()))\narr = np.array(list(map(int, input().split())))\ncomp = np.arange(n) + 1\ndiff = arr - comp\ndiff.sort()\ndiff = diff - np.median(diff)\nprint((int(np.abs(diff).sum())))\n","code_v1_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\na = np.array(list(map(int, input().split())))\narr = np.arange(n) + 1\ndiff = a - arr\ndiff.sort()\ndiff = diff - np.median(diff)\nprint((int(np.abs(diff).sum())))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import sys","-arr = np.array(list(map(int, input().split())))","-comp = np.arange(n) + 1","-diff = arr - comp","+a = np.array(list(map(int, input().split())))","+arr = np.arange(n) + 1","+diff = a - arr"],"diff_only_import_comment":false,"measured_runtime_v0":0.2373173237,"measured_runtime_v1":0.7020013809,"runtime_lift":0.3380582006,"key":["s575512467","s703344707"]} +{"user_id":"u680851063","problem_id":"p03162","language":"python","submission_id_v0":"s965042533","submission_id_v1":"s797258237","cpu_time_v0":926,"cpu_time_v1":676,"memory_v0":47344,"memory_v1":77144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.0,"input":"n = int(eval(input()))\n\nl = [list(map(int, input().split())) for _ in range(n)]\n\n\n\ndp = [[0,0,0] for _ in range(n)]\n\ndp[0] = l[0]\n\n\n\nfor i in range(1, n):\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k] + l[i][j])\n\n\n\nprint((max(dp[-1])))","target":"n = int(eval(input()))\n\nabc = [[], [], []]\n\n\n\nabc = [list(map(int, input().split())) for _ in range(n)] # DB\u53d6\u5f97\u65b9\u6cd5\u306e\u307f\u9055\u3046, \u5206\u304b\u308c\u3070\u3069\u3063\u3061\u3067\u3082ok\n\n#print(abc)\n\n\n\ndp = [[0,0,0] for _ in range(n)]\n\ndp[0] = abc[0]\n\n#print(dp)\n\n\n\nfor i in range(1, n):\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k:\n\n dp[i][j] = max(dp[i][j], dp[i-1][k] + abc[i][j]) # \u3053\u3053\u306eDB\u6307\u5b9a\u65b9\u6cd5\u306b\u5f71\u97ff\n\n\n\nprint((max(dp[-1])))","code_v0_loc":13,"code_v1_loc":17,"code_v0_num_chars":310,"code_v1_num_chars":405,"code_v0_no_empty_lines":"n = int(eval(input()))\nl = [list(map(int, input().split())) for _ in range(n)]\ndp = [[0, 0, 0] for _ in range(n)]\ndp[0] = l[0]\nfor i in range(1, n):\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[i][j] = max(dp[i][j], dp[i - 1][k] + l[i][j])\nprint((max(dp[-1])))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nabc = [[], [], []]\nabc = [list(map(int, input().split())) for _ in range(n)] # DB\u53d6\u5f97\u65b9\u6cd5\u306e\u307f\u9055\u3046, \u5206\u304b\u308c\u3070\u3069\u3063\u3061\u3067\u3082ok\n# print(abc)\ndp = [[0, 0, 0] for _ in range(n)]\ndp[0] = abc[0]\n# print(dp)\nfor i in range(1, n):\n for j in range(3):\n for k in range(3):\n if j != k:\n dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j]) # \u3053\u3053\u306eDB\u6307\u5b9a\u65b9\u6cd5\u306b\u5f71\u97ff\nprint((max(dp[-1])))\n","code_same":false,"relative_loc_diff_percent":23.5294117647,"diff":["-l = [list(map(int, input().split())) for _ in range(n)]","+abc = [[], [], []]","+abc = [list(map(int, input().split())) for _ in range(n)] # DB\u53d6\u5f97\u65b9\u6cd5\u306e\u307f\u9055\u3046, \u5206\u304b\u308c\u3070\u3069\u3063\u3061\u3067\u3082ok","+# print(abc)","-dp[0] = l[0]","+dp[0] = abc[0]","+# print(dp)","- dp[i][j] = max(dp[i][j], dp[i - 1][k] + l[i][j])","+ dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j]) # \u3053\u3053\u306eDB\u6307\u5b9a\u65b9\u6cd5\u306b\u5f71\u97ff"],"diff_only_import_comment":false,"measured_runtime_v0":0.0386668851,"measured_runtime_v1":0.0356536908,"runtime_lift":1.08451283,"key":["s965042533","s797258237"]} +{"user_id":"u493520238","problem_id":"p02683","language":"python","submission_id_v0":"s770613742","submission_id_v1":"s352110045","cpu_time_v0":370,"cpu_time_v1":90,"memory_v0":9276,"memory_v1":74468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.68,"input":"INF = 99999999999\n\n\n\nn, m, x = list(map(int, input().split())) \n\nc_l = []\n\na_l = []\n\n\n\nfor _ in range(n):\n\n a_list = list(map(int, input().split())) \n\n c_l.append(a_list[0])\n\n a_l.append(a_list[1:])\n\n\n\nmin_c = INF\n\nfor i in range(2 ** n):\n\n bag_c = []\n\n bag_a = []\n\n for j in range(n):\n\n if ((i >> j) & 1): \n\n bag_c.append(c_l[j]) \n\n bag_a.append(a_l[j])\n\n l = len(bag_a)\n\n c_sum = 0\n\n s_sum = [0]*m\n\n for ii in range(l):\n\n c_sum += bag_c[ii]\n\n for mm in range(m):\n\n s_sum[mm] += bag_a[ii][mm]\n\n if min(s_sum) >= x and c_sum < min_c:\n\n min_c = c_sum\n\nif min_c == INF:\n\n print((-1))\n\nelse: \n\n print(min_c)","target":"from itertools import product\n\n\n\nn,m,x = list(map(int, input().split()))\n\n\n\nal = []\n\ncl = []\n\nfor _ in range(n):\n\n row = list(map(int, input().split())) \n\n cl.append(row[0])\n\n al.append(row[1:])\n\n\n\n\n\nans = 10**9\n\nbit = 2\n\nite = list(product(list(range(bit)),repeat=n))\n\nfor pattern in ite:\n\n skills = [0]*m\n\n cost = 0\n\n for i, v in enumerate(pattern):\n\n if v == 1:\n\n curr_al = al[i]\n\n cost += cl[i]\n\n for j, a in enumerate(curr_al):\n\n skills[j] += a\n\n if min(skills) >= x:\n\n ans = min(ans,cost)\n\n\n\nif ans == 10**9: ans = -1\n\nprint(ans)","code_v0_loc":32,"code_v1_loc":29,"code_v0_num_chars":736,"code_v1_num_chars":606,"code_v0_no_empty_lines":"INF = 99999999999\nn, m, x = list(map(int, input().split()))\nc_l = []\na_l = []\nfor _ in range(n):\n a_list = list(map(int, input().split()))\n c_l.append(a_list[0])\n a_l.append(a_list[1:])\nmin_c = INF\nfor i in range(2**n):\n bag_c = []\n bag_a = []\n for j in range(n):\n if (i >> j) & 1:\n bag_c.append(c_l[j])\n bag_a.append(a_l[j])\n l = len(bag_a)\n c_sum = 0\n s_sum = [0] * m\n for ii in range(l):\n c_sum += bag_c[ii]\n for mm in range(m):\n s_sum[mm] += bag_a[ii][mm]\n if min(s_sum) >= x and c_sum < min_c:\n min_c = c_sum\nif min_c == INF:\n print((-1))\nelse:\n print(min_c)\n","code_v1_no_empty_lines":"from itertools import product\n\nn, m, x = list(map(int, input().split()))\nal = []\ncl = []\nfor _ in range(n):\n row = list(map(int, input().split()))\n cl.append(row[0])\n al.append(row[1:])\nans = 10**9\nbit = 2\nite = list(product(list(range(bit)), repeat=n))\nfor pattern in ite:\n skills = [0] * m\n cost = 0\n for i, v in enumerate(pattern):\n if v == 1:\n curr_al = al[i]\n cost += cl[i]\n for j, a in enumerate(curr_al):\n skills[j] += a\n if min(skills) >= x:\n ans = min(ans, cost)\nif ans == 10**9:\n ans = -1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.375,"diff":["-INF = 99999999999","+from itertools import product","+","-c_l = []","-a_l = []","+al = []","+cl = []","- a_list = list(map(int, input().split()))","- c_l.append(a_list[0])","- a_l.append(a_list[1:])","-min_c = INF","-for i in range(2**n):","- bag_c = []","- bag_a = []","- for j in range(n):","- if (i >> j) & 1:","- bag_c.append(c_l[j])","- bag_a.append(a_l[j])","- l = len(bag_a)","- c_sum = 0","- s_sum = [0] * m","- for ii in range(l):","- c_sum += bag_c[ii]","- for mm in range(m):","- s_sum[mm] += bag_a[ii][mm]","- if min(s_sum) >= x and c_sum < min_c:","- min_c = c_sum","-if min_c == INF:","- print((-1))","-else:","- print(min_c)","+ row = list(map(int, input().split()))","+ cl.append(row[0])","+ al.append(row[1:])","+ans = 10**9","+bit = 2","+ite = list(product(list(range(bit)), repeat=n))","+for pattern in ite:","+ skills = [0] * m","+ cost = 0","+ for i, v in enumerate(pattern):","+ if v == 1:","+ curr_al = al[i]","+ cost += cl[i]","+ for j, a in enumerate(curr_al):","+ skills[j] += a","+ if min(skills) >= x:","+ ans = min(ans, cost)","+if ans == 10**9:","+ ans = -1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0407552493,"measured_runtime_v1":0.061399538,"runtime_lift":0.6637712686,"key":["s770613742","s352110045"]} +{"user_id":"u745561510","problem_id":"p03053","language":"python","submission_id_v0":"s486011657","submission_id_v1":"s262861952","cpu_time_v0":713,"cpu_time_v1":402,"memory_v0":140892,"memory_v1":179396,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.62,"input":"from collections import deque\n\n\n\n\n\n\n\ndef bfs(maze, visited, queue, H, W):\n\n count = 0\n\n while queue:\n\n y, x = queue.popleft()\n\n for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):\n\n new_y, new_x = y + i, x + j\n\n if -1 < new_y < H and -1 < new_x < W:\n\n if maze[new_y][new_x] == \".\" and visited[new_y][new_x] == -1:\n\n visited[new_y][new_x] = visited[y][x] + 1\n\n queue.append([new_y, new_x])\n\n\n\n ans = -1\n\n for i in range(H):\n\n for j in range(W):\n\n ans = max(ans,visited[i][j])\n\n return ans\n\n\n\nH, W = list(map(int,input().split()))\n\n\n\nmaze = [eval(input()) for i in range(H)]\n\nvisited = [[-1] * W for i in range(H)]\n\n\n\nqueue = deque([])\n\nfor i in range(H):\n\n for j in range(W):\n\n if maze[i][j] == \"#\":\n\n visited[i][j] = 0\n\n queue.append([i, j])\n\n\n\nprint((bfs(maze, visited, queue, H, W)))","target":"H, W = list(map(int, input().split()))\n\nmaze = [eval(input()) for _ in range(H)]\n\nseen = [[-1] * W for _ in range(H)]\n\n\n\nfrom collections import deque\n\n\n\n\n\nqueue = deque()\n\nfor i in range(H):\n\n for j in range(W):\n\n if maze[i][j] == '#':\n\n queue.append([i, j, 0])\n\n seen[i][j] = 0\n\n\n\ndef bfs(maze, seen):\n\n while queue:\n\n y, x, c = queue.popleft()\n\n for i, j in [1, 0], [-1, 0], [0, 1], [0, -1]:\n\n dy = y + i\n\n dx = x + j\n\n if dy < 0 or H <= dy or dx < 0 or W <= dx:\n\n continue\n\n if seen[dy][dx] > -1:\n\n continue\n\n if maze[dy][dx] == '#':\n\n continue\n\n seen[dy][dx] = c + 1\n\n queue.append([dy, dx, c+1])\n\n\n\ndef check_max(seen):\n\n ans = 0\n\n for i in range(H):\n\n for j in range(W):\n\n ans = max(ans, seen[i][j])\n\n return ans\n\n \n\nbfs(maze, seen)\n\nprint((check_max(seen)))","code_v0_loc":34,"code_v1_loc":38,"code_v0_num_chars":921,"code_v1_num_chars":952,"code_v0_no_empty_lines":"from collections import deque\n\n\ndef bfs(maze, visited, queue, H, W):\n count = 0\n while queue:\n y, x = queue.popleft()\n for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):\n new_y, new_x = y + i, x + j\n if -1 < new_y < H and -1 < new_x < W:\n if maze[new_y][new_x] == \".\" and visited[new_y][new_x] == -1:\n visited[new_y][new_x] = visited[y][x] + 1\n queue.append([new_y, new_x])\n ans = -1\n for i in range(H):\n for j in range(W):\n ans = max(ans, visited[i][j])\n return ans\n\n\nH, W = list(map(int, input().split()))\nmaze = [eval(input()) for i in range(H)]\nvisited = [[-1] * W for i in range(H)]\nqueue = deque([])\nfor i in range(H):\n for j in range(W):\n if maze[i][j] == \"#\":\n visited[i][j] = 0\n queue.append([i, j])\nprint((bfs(maze, visited, queue, H, W)))\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nmaze = [eval(input()) for _ in range(H)]\nseen = [[-1] * W for _ in range(H)]\nfrom collections import deque\n\nqueue = deque()\nfor i in range(H):\n for j in range(W):\n if maze[i][j] == \"#\":\n queue.append([i, j, 0])\n seen[i][j] = 0\n\n\ndef bfs(maze, seen):\n while queue:\n y, x, c = queue.popleft()\n for i, j in [1, 0], [-1, 0], [0, 1], [0, -1]:\n dy = y + i\n dx = x + j\n if dy < 0 or H <= dy or dx < 0 or W <= dx:\n continue\n if seen[dy][dx] > -1:\n continue\n if maze[dy][dx] == \"#\":\n continue\n seen[dy][dx] = c + 1\n queue.append([dy, dx, c + 1])\n\n\ndef check_max(seen):\n ans = 0\n for i in range(H):\n for j in range(W):\n ans = max(ans, seen[i][j])\n return ans\n\n\nbfs(maze, seen)\nprint((check_max(seen)))\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["+H, W = list(map(int, input().split()))","+maze = [eval(input()) for _ in range(H)]","+seen = [[-1] * W for _ in range(H)]","+queue = deque()","+for i in range(H):","+ for j in range(W):","+ if maze[i][j] == \"#\":","+ queue.append([i, j, 0])","+ seen[i][j] = 0","-def bfs(maze, visited, queue, H, W):","- count = 0","+","+def bfs(maze, seen):","- y, x = queue.popleft()","- for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):","- new_y, new_x = y + i, x + j","- if -1 < new_y < H and -1 < new_x < W:","- if maze[new_y][new_x] == \".\" and visited[new_y][new_x] == -1:","- visited[new_y][new_x] = visited[y][x] + 1","- queue.append([new_y, new_x])","- ans = -1","+ y, x, c = queue.popleft()","+ for i, j in [1, 0], [-1, 0], [0, 1], [0, -1]:","+ dy = y + i","+ dx = x + j","+ if dy < 0 or H <= dy or dx < 0 or W <= dx:","+ continue","+ if seen[dy][dx] > -1:","+ continue","+ if maze[dy][dx] == \"#\":","+ continue","+ seen[dy][dx] = c + 1","+ queue.append([dy, dx, c + 1])","+","+","+def check_max(seen):","+ ans = 0","- ans = max(ans, visited[i][j])","+ ans = max(ans, seen[i][j])","-H, W = list(map(int, input().split()))","-maze = [eval(input()) for i in range(H)]","-visited = [[-1] * W for i in range(H)]","-queue = deque([])","-for i in range(H):","- for j in range(W):","- if maze[i][j] == \"#\":","- visited[i][j] = 0","- queue.append([i, j])","-print((bfs(maze, visited, queue, H, W)))","+bfs(maze, seen)","+print((check_max(seen)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0413920236,"measured_runtime_v1":0.0420213853,"runtime_lift":0.985022825,"key":["s486011657","s262861952"]} +{"user_id":"u970449052","problem_id":"p02690","language":"python","submission_id_v0":"s971471094","submission_id_v1":"s986250470","cpu_time_v0":70,"cpu_time_v1":38,"memory_v0":65620,"memory_v1":9144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.71,"input":"X=int(eval(input()))\n\nfor i in range(-1000,1000):\n\n for j in range(-1000,1000):\n\n if i**5-j**5==X:\n\n print((i,j))\n\n exit()","target":"X=int(eval(input()))\n\nfor i in range(-118,120):\n\n for j in range(-119,119):\n\n if i**5-j**5==X:\n\n print((i,j))\n\n exit()","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":146,"code_v1_num_chars":142,"code_v0_no_empty_lines":"X = int(eval(input()))\nfor i in range(-1000, 1000):\n for j in range(-1000, 1000):\n if i**5 - j**5 == X:\n print((i, j))\n exit()\n","code_v1_no_empty_lines":"X = int(eval(input()))\nfor i in range(-118, 120):\n for j in range(-119, 119):\n if i**5 - j**5 == X:\n print((i, j))\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(-1000, 1000):","- for j in range(-1000, 1000):","+for i in range(-118, 120):","+ for j in range(-119, 119):"],"diff_only_import_comment":false,"measured_runtime_v0":1.6791506767,"measured_runtime_v1":0.0647871137,"runtime_lift":25.9179732116,"key":["s971471094","s986250470"]} +{"user_id":"u409974118","problem_id":"p02657","language":"python","submission_id_v0":"s893021302","submission_id_v1":"s946695104","cpu_time_v0":24,"cpu_time_v1":20,"memory_v0":9152,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"a,b = list(map(int,input().split()))\n\nc = a*b\n\nprint(c)","target":"a,b = list(map(float,input().split()))\n\nA = int(a)\n\nB = 100*b\n\nc = int(A*B\/\/100)\n\n\n\nprint(c)\n","code_v0_loc":3,"code_v1_loc":6,"code_v0_num_chars":49,"code_v1_num_chars":87,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nc = a * b\nprint(c)\n","code_v1_no_empty_lines":"a, b = list(map(float, input().split()))\nA = int(a)\nB = 100 * b\nc = int(A * B \/\/ 100)\nprint(c)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-a, b = list(map(int, input().split()))","-c = a * b","+a, b = list(map(float, input().split()))","+A = int(a)","+B = 100 * b","+c = int(A * B \/\/ 100)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0381812764,"measured_runtime_v1":0.0436321059,"runtime_lift":0.8750729675,"key":["s893021302","s946695104"]} +{"user_id":"u191394596","problem_id":"p03161","language":"python","submission_id_v0":"s604033094","submission_id_v1":"s345085160","cpu_time_v0":422,"cpu_time_v1":375,"memory_v0":52448,"memory_v1":52448,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.14,"input":"import sys\n\n\n\n\n\nINF = sys.maxsize\n\n\n\nN, K = (int(x) for x in input().split())\n\nheights = [int(x) for x in input().split()]\n\n\n\nmemo = [INF] * N\n\n\n\nfor i in range(N - 1, -1, -1):\n\n if i == N - 1:\n\n # \u30b4\u30fc\u30eb\u304b\u3089\u30b4\u30fc\u30eb\u306e\u8ddd\u96e2\u30920\u3067\u521d\u671f\u5316\n\n memo[i] = 0\n\n continue\n\n cost = INF\n\n for j in range(1, K + 1):\n\n # \u7bc4\u56f2\u5916\n\n if i + j >= N:\n\n continue\n\n cost = min(cost, memo[i + j] + abs(heights[i] - heights[i + j]))\n\n memo[i] = cost \n\n\n\nprint((memo[0]))\n","target":"import sys\n\n\n\n\n\nINF = sys.maxsize\n\n\n\nN, K = list(map(int, input().split()))\n\n\n\nheights = list(map(int, input().split()))\n\n\n\nmemo = [INF] * N\n\n\n\nmemo[0] = 0\n\n\n\nfor i in range(N):\n\n for k in range(1, K + 1):\n\n if i + k < N:\n\n memo[i + k] = min(\n\n memo[i + k],\n\n memo[i] + abs(heights[i] - heights[i + k])\n\n )\n\n \n\nprint((memo[N - 1]))\n","code_v0_loc":24,"code_v1_loc":22,"code_v0_num_chars":460,"code_v1_num_chars":353,"code_v0_no_empty_lines":"import sys\n\nINF = sys.maxsize\nN, K = (int(x) for x in input().split())\nheights = [int(x) for x in input().split()]\nmemo = [INF] * N\nfor i in range(N - 1, -1, -1):\n if i == N - 1:\n # \u30b4\u30fc\u30eb\u304b\u3089\u30b4\u30fc\u30eb\u306e\u8ddd\u96e2\u30920\u3067\u521d\u671f\u5316\n memo[i] = 0\n continue\n cost = INF\n for j in range(1, K + 1):\n # \u7bc4\u56f2\u5916\n if i + j >= N:\n continue\n cost = min(cost, memo[i + j] + abs(heights[i] - heights[i + j]))\n memo[i] = cost\nprint((memo[0]))\n","code_v1_no_empty_lines":"import sys\n\nINF = sys.maxsize\nN, K = list(map(int, input().split()))\nheights = list(map(int, input().split()))\nmemo = [INF] * N\nmemo[0] = 0\nfor i in range(N):\n for k in range(1, K + 1):\n if i + k < N:\n memo[i + k] = min(memo[i + k], memo[i] + abs(heights[i] - heights[i + k]))\nprint((memo[N - 1]))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-N, K = (int(x) for x in input().split())","-heights = [int(x) for x in input().split()]","+N, K = list(map(int, input().split()))","+heights = list(map(int, input().split()))","-for i in range(N - 1, -1, -1):","- if i == N - 1:","- # \u30b4\u30fc\u30eb\u304b\u3089\u30b4\u30fc\u30eb\u306e\u8ddd\u96e2\u30920\u3067\u521d\u671f\u5316","- memo[i] = 0","- continue","- cost = INF","- for j in range(1, K + 1):","- # \u7bc4\u56f2\u5916","- if i + j >= N:","- continue","- cost = min(cost, memo[i + j] + abs(heights[i] - heights[i + j]))","- memo[i] = cost","-print((memo[0]))","+memo[0] = 0","+for i in range(N):","+ for k in range(1, K + 1):","+ if i + k < N:","+ memo[i + k] = min(memo[i + k], memo[i] + abs(heights[i] - heights[i + k]))","+print((memo[N - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0381600797,"measured_runtime_v1":0.0366869795,"runtime_lift":1.0401532149,"key":["s604033094","s345085160"]} +{"user_id":"u254871849","problem_id":"p03828","language":"python","submission_id_v0":"s455837522","submission_id_v1":"s097208271","cpu_time_v0":24,"cpu_time_v1":21,"memory_v0":3444,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"import sys\n\nfrom collections import defaultdict\n\n\n\ndef sieve_of_eratosthenes(n=5 * 10 ** 6):\n\n sieve = [1] * (n + 1); sieve[0] = sieve[1] = 0\n\n for i in range(2, int(n ** 0.5) + 1):\n\n if not sieve[i]: continue\n\n for j in range(i * 2, n, i): sieve[j] = 0\n\n prime_numbers = [i for i in range(2, n + 1) if sieve[i]]\n\n return sieve, prime_numbers\n\n\n\nis_prime, prime_numbers = sieve_of_eratosthenes(10 ** 3)\n\n\n\ndef prime_factorize(n):\n\n res = defaultdict(int)\n\n if n < 2: return res\n\n border = int(n ** 0.5)\n\n for p in prime_numbers:\n\n if p > border: break\n\n while n % p == 0: res[p] += 1; n \/\/= p\n\n if n == 1: return res\n\n res[n] = 1\n\n return res\n\n\n\ndef prime_factorize_factorial(n):\n\n res = defaultdict(int)\n\n for i in range(2, n + 1):\n\n for p, c in list(prime_factorize(i).items()): res[p] += c\n\n return res\n\n\n\nMOD = 10 ** 9 + 7\n\n\n\nn = int(sys.stdin.readline().rstrip())\n\n\n\ndef main():\n\n res = 1\n\n for c in list(prime_factorize_factorial(n).values()):\n\n res *= c + 1; res %= MOD\n\n print(res)\n\n\n\nif __name__ == '__main__':\n\n main()","target":"import sys\n\n\n\ndef sieve_of_eratosthenes(n=5 * 10 ** 6):\n\n sieve = [1] * (n + 1); sieve[0] = sieve[1] = 0\n\n for i in range(2, int(n ** 0.5) + 1):\n\n if not sieve[i]: continue\n\n for j in range(i * 2, n, i): sieve[j] = 0\n\n prime_numbers = [i for i in range(2, n + 1) if sieve[i]]\n\n return sieve, prime_numbers\n\n\n\nis_prime, prime_numbers = sieve_of_eratosthenes(10 ** 3)\n\n\n\ndef prime_factorize(n):\n\n res = dict()\n\n if n < 2: return res\n\n border = int(n ** 0.5)\n\n for p in prime_numbers:\n\n if p > border: break\n\n while n % p == 0: res[p] = res.get(p, 0) + 1; n \/\/= p\n\n if n == 1: return res\n\n res[n] = 1\n\n return res\n\n\n\ndef prime_factorize_factorial(n):\n\n res = dict()\n\n for i in range(2, n + 1):\n\n for p, c in list(prime_factorize(i).items()): res[p] = res.get(p, 0) + c\n\n return res\n\n\n\nMOD = 10 ** 9 + 7\n\n\n\nn = int(sys.stdin.readline().rstrip())\n\n\n\ndef main():\n\n res = 1\n\n for c in list(prime_factorize_factorial(n).values()):\n\n res *= c + 1; res %= MOD\n\n print(res)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":42,"code_v1_loc":41,"code_v0_num_chars":1055,"code_v1_num_chars":1028,"code_v0_no_empty_lines":"import sys\nfrom collections import defaultdict\n\n\ndef sieve_of_eratosthenes(n=5 * 10**6):\n sieve = [1] * (n + 1)\n sieve[0] = sieve[1] = 0\n for i in range(2, int(n**0.5) + 1):\n if not sieve[i]:\n continue\n for j in range(i * 2, n, i):\n sieve[j] = 0\n prime_numbers = [i for i in range(2, n + 1) if sieve[i]]\n return sieve, prime_numbers\n\n\nis_prime, prime_numbers = sieve_of_eratosthenes(10**3)\n\n\ndef prime_factorize(n):\n res = defaultdict(int)\n if n < 2:\n return res\n border = int(n**0.5)\n for p in prime_numbers:\n if p > border:\n break\n while n % p == 0:\n res[p] += 1\n n \/\/= p\n if n == 1:\n return res\n res[n] = 1\n return res\n\n\ndef prime_factorize_factorial(n):\n res = defaultdict(int)\n for i in range(2, n + 1):\n for p, c in list(prime_factorize(i).items()):\n res[p] += c\n return res\n\n\nMOD = 10**9 + 7\nn = int(sys.stdin.readline().rstrip())\n\n\ndef main():\n res = 1\n for c in list(prime_factorize_factorial(n).values()):\n res *= c + 1\n res %= MOD\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef sieve_of_eratosthenes(n=5 * 10**6):\n sieve = [1] * (n + 1)\n sieve[0] = sieve[1] = 0\n for i in range(2, int(n**0.5) + 1):\n if not sieve[i]:\n continue\n for j in range(i * 2, n, i):\n sieve[j] = 0\n prime_numbers = [i for i in range(2, n + 1) if sieve[i]]\n return sieve, prime_numbers\n\n\nis_prime, prime_numbers = sieve_of_eratosthenes(10**3)\n\n\ndef prime_factorize(n):\n res = dict()\n if n < 2:\n return res\n border = int(n**0.5)\n for p in prime_numbers:\n if p > border:\n break\n while n % p == 0:\n res[p] = res.get(p, 0) + 1\n n \/\/= p\n if n == 1:\n return res\n res[n] = 1\n return res\n\n\ndef prime_factorize_factorial(n):\n res = dict()\n for i in range(2, n + 1):\n for p, c in list(prime_factorize(i).items()):\n res[p] = res.get(p, 0) + c\n return res\n\n\nMOD = 10**9 + 7\nn = int(sys.stdin.readline().rstrip())\n\n\ndef main():\n res = 1\n for c in list(prime_factorize_factorial(n).values()):\n res *= c + 1\n res %= MOD\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.380952381,"diff":["-from collections import defaultdict","- res = defaultdict(int)","+ res = dict()","- res[p] += 1","+ res[p] = res.get(p, 0) + 1","- res = defaultdict(int)","+ res = dict()","- res[p] += c","+ res[p] = res.get(p, 0) + c"],"diff_only_import_comment":false,"measured_runtime_v0":0.0401347039,"measured_runtime_v1":0.0393821504,"runtime_lift":1.0191089985,"key":["s455837522","s097208271"]} +{"user_id":"u442396147","problem_id":"p03160","language":"python","submission_id_v0":"s179023522","submission_id_v1":"s016048519","cpu_time_v0":639,"cpu_time_v1":255,"memory_v0":120352,"memory_v1":52720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.09,"input":"import sys\n\n# import pdb\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nhs = list(map(int, input().split()))\n\n\n\ndp_list = [-1 for _ in range(N)]\n\ndp_list[0] = 0\n\ndp_list[1] = abs(hs[1] - hs[0])\n\n\n\nsys.setrecursionlimit(1000000)\n\ndef dp_memo(p):\n\n if dp_list[p] != -1:\n\n return dp_list[p]\n\n\n\n result = min(dp_memo(p-1) + abs(hs[p] - hs[p-1]), dp_memo(p-2) + abs(hs[p] - hs[p-2]))\n\n dp_list[p] = result\n\n return result\n\n\n\n\n\ndef dp_recur():\n\n cost1 = 0\n\n cost2 = abs(hs[1] - hs[0])\n\n\n\n if N == 2:\n\n print(cost2)\n\n exit()\n\n # pdb.set_trace()\n\n for i in range(2, N):\n\n cost3 = min(cost2 + abs(hs[i] - hs[i-1]), cost1 + abs(hs[i] - hs[i-2]))\n\n cost1 = cost2\n\n cost2 = cost3\n\n return cost3\n\n\n\n# print(dp_recur())\n\nprint((dp_memo(N-1)))\n","target":"N = int(eval(input()))\n\nhs = list(map(int, input().split()))\n\n\n\nif N == 2:\n\n print((abs(hs[1] - hs[0])))\n\n exit()\n\n\n\ntotal_cost = [-1 for _ in range(N)]\n\ntotal_cost[0] = 0\n\ntotal_cost[1] = abs(hs[1]-hs[0])\n\n\n\nfor i in range(2, N):\n\n total_cost[i] = min(abs(hs[i]-hs[i-1]) + total_cost[i-1], abs(hs[i]-hs[i-2]) + total_cost[i-2])\n\n\n\nprint((total_cost[N-1]))\n","code_v0_loc":37,"code_v1_loc":15,"code_v0_num_chars":757,"code_v1_num_chars":350,"code_v0_no_empty_lines":"import sys\n\n# import pdb\ninput = sys.stdin.readline\nN = int(eval(input()))\nhs = list(map(int, input().split()))\ndp_list = [-1 for _ in range(N)]\ndp_list[0] = 0\ndp_list[1] = abs(hs[1] - hs[0])\nsys.setrecursionlimit(1000000)\n\n\ndef dp_memo(p):\n if dp_list[p] != -1:\n return dp_list[p]\n result = min(\n dp_memo(p - 1) + abs(hs[p] - hs[p - 1]), dp_memo(p - 2) + abs(hs[p] - hs[p - 2])\n )\n dp_list[p] = result\n return result\n\n\ndef dp_recur():\n cost1 = 0\n cost2 = abs(hs[1] - hs[0])\n if N == 2:\n print(cost2)\n exit()\n # pdb.set_trace()\n for i in range(2, N):\n cost3 = min(cost2 + abs(hs[i] - hs[i - 1]), cost1 + abs(hs[i] - hs[i - 2]))\n cost1 = cost2\n cost2 = cost3\n return cost3\n\n\n# print(dp_recur())\nprint((dp_memo(N - 1)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nhs = list(map(int, input().split()))\nif N == 2:\n print((abs(hs[1] - hs[0])))\n exit()\ntotal_cost = [-1 for _ in range(N)]\ntotal_cost[0] = 0\ntotal_cost[1] = abs(hs[1] - hs[0])\nfor i in range(2, N):\n total_cost[i] = min(\n abs(hs[i] - hs[i - 1]) + total_cost[i - 1],\n abs(hs[i] - hs[i - 2]) + total_cost[i - 2],\n )\nprint((total_cost[N - 1]))\n","code_same":false,"relative_loc_diff_percent":59.4594594595,"diff":["-import sys","-","-# import pdb","-input = sys.stdin.readline","-dp_list = [-1 for _ in range(N)]","-dp_list[0] = 0","-dp_list[1] = abs(hs[1] - hs[0])","-sys.setrecursionlimit(1000000)","-","-","-def dp_memo(p):","- if dp_list[p] != -1:","- return dp_list[p]","- result = min(","- dp_memo(p - 1) + abs(hs[p] - hs[p - 1]), dp_memo(p - 2) + abs(hs[p] - hs[p - 2])","+if N == 2:","+ print((abs(hs[1] - hs[0])))","+ exit()","+total_cost = [-1 for _ in range(N)]","+total_cost[0] = 0","+total_cost[1] = abs(hs[1] - hs[0])","+for i in range(2, N):","+ total_cost[i] = min(","+ abs(hs[i] - hs[i - 1]) + total_cost[i - 1],","+ abs(hs[i] - hs[i - 2]) + total_cost[i - 2],","- dp_list[p] = result","- return result","-","-","-def dp_recur():","- cost1 = 0","- cost2 = abs(hs[1] - hs[0])","- if N == 2:","- print(cost2)","- exit()","- # pdb.set_trace()","- for i in range(2, N):","- cost3 = min(cost2 + abs(hs[i] - hs[i - 1]), cost1 + abs(hs[i] - hs[i - 2]))","- cost1 = cost2","- cost2 = cost3","- return cost3","-","-","-# print(dp_recur())","-print((dp_memo(N - 1)))","+print((total_cost[N - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0352018154,"measured_runtime_v1":0.0377058408,"runtime_lift":0.9335905151,"key":["s179023522","s016048519"]} +{"user_id":"u677121387","problem_id":"p03752","language":"python","submission_id_v0":"s550334486","submission_id_v1":"s001569273","cpu_time_v0":393,"cpu_time_v1":38,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.33,"input":"N,K = list(map(int,input().split()))\n\na = [int(i) for i in input().split()]\n\nans = float(\"INF\")\n\nfor i in range(1<> j & 1 and m >= tmp[j]:\n\n cnt += m - tmp[j] + 1\n\n tmp[j] = m + 1\n\n m = max(m,tmp[j])\n\n color = 1\n\n m = tmp[0]\n\n for j in range(1,N):\n\n if tmp[j] > m:\n\n color += 1\n\n m = tmp[j]\n\n if color >= K: ans = min(ans,cnt)\n\nprint(ans)","target":"from itertools import combinations as comb\n\nN,K = list(map(int,input().split()))\n\na = [int(i) for i in input().split()]\n\nans = float(\"INF\")\n\n\n\nfor c in comb(list(range(1,N)),K-1):\n\n cnt = 0\n\n color = 0\n\n mh = a[0]\n\n for i in range(1,N):\n\n if i == c[color]:\n\n cnt += max(mh-a[i]+1,0)\n\n color += 1\n\n if color == K-1: break\n\n mh = max(mh+1,a[i])\n\n else:\n\n mh = max(mh,a[i])\n\n ans = min(cnt ,ans)\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":19,"code_v0_num_chars":493,"code_v1_num_chars":476,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\na = [int(i) for i in input().split()]\nans = float(\"INF\")\nfor i in range(1 << N):\n cnt = 0\n tmp = a[:]\n m = tmp[0]\n for j in range(1, N):\n if i >> j & 1 and m >= tmp[j]:\n cnt += m - tmp[j] + 1\n tmp[j] = m + 1\n m = max(m, tmp[j])\n color = 1\n m = tmp[0]\n for j in range(1, N):\n if tmp[j] > m:\n color += 1\n m = tmp[j]\n if color >= K:\n ans = min(ans, cnt)\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import combinations as comb\n\nN, K = list(map(int, input().split()))\na = [int(i) for i in input().split()]\nans = float(\"INF\")\nfor c in comb(list(range(1, N)), K - 1):\n cnt = 0\n color = 0\n mh = a[0]\n for i in range(1, N):\n if i == c[color]:\n cnt += max(mh - a[i] + 1, 0)\n color += 1\n if color == K - 1:\n break\n mh = max(mh + 1, a[i])\n else:\n mh = max(mh, a[i])\n ans = min(cnt, ans)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.0,"diff":["+from itertools import combinations as comb","+","-for i in range(1 << N):","+for c in comb(list(range(1, N)), K - 1):","- tmp = a[:]","- m = tmp[0]","- for j in range(1, N):","- if i >> j & 1 and m >= tmp[j]:","- cnt += m - tmp[j] + 1","- tmp[j] = m + 1","- m = max(m, tmp[j])","- color = 1","- m = tmp[0]","- for j in range(1, N):","- if tmp[j] > m:","+ color = 0","+ mh = a[0]","+ for i in range(1, N):","+ if i == c[color]:","+ cnt += max(mh - a[i] + 1, 0)","- m = tmp[j]","- if color >= K:","- ans = min(ans, cnt)","+ if color == K - 1:","+ break","+ mh = max(mh + 1, a[i])","+ else:","+ mh = max(mh, a[i])","+ ans = min(cnt, ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.107061867,"measured_runtime_v1":0.0431299326,"runtime_lift":2.4823100899,"key":["s550334486","s001569273"]} +{"user_id":"u497952650","problem_id":"p03681","language":"python","submission_id_v0":"s374440213","submission_id_v1":"s479922538","cpu_time_v0":703,"cpu_time_v1":442,"memory_v0":5172,"memory_v1":4096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.13,"input":"import math\n\ndef fact(n):\n\n return math.factorial(n)\n\n\n\nN,M = list(map(int,input().split()))\n\n\n\nif abs(N-M) >= 2:\n\n print((0))\n\n exit()\n\n\n\nmod = int(1e9)+7\n\n\n\nif N == M:\n\n print((2*fact(N)*fact(M)%mod))\n\nelse:\n\n print((fact(N)*fact(M)%mod))","target":"import math\n\ndef fact(n):\n\n mod = int(1e9)+7\n\n return math.factorial(n)%mod\n\n\n\nN,M = list(map(int,input().split()))\n\n\n\nif abs(N-M) >= 2:\n\n print((0))\n\n exit()\n\n\n\nmod = int(1e9)+7\n\n\n\nif N == M:\n\n print((2*fact(N)*fact(M)%mod))\n\nelse:\n\n print((fact(N)*fact(M)%mod))","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":243,"code_v1_num_chars":269,"code_v0_no_empty_lines":"import math\n\n\ndef fact(n):\n return math.factorial(n)\n\n\nN, M = list(map(int, input().split()))\nif abs(N - M) >= 2:\n print((0))\n exit()\nmod = int(1e9) + 7\nif N == M:\n print((2 * fact(N) * fact(M) % mod))\nelse:\n print((fact(N) * fact(M) % mod))\n","code_v1_no_empty_lines":"import math\n\n\ndef fact(n):\n mod = int(1e9) + 7\n return math.factorial(n) % mod\n\n\nN, M = list(map(int, input().split()))\nif abs(N - M) >= 2:\n print((0))\n exit()\nmod = int(1e9) + 7\nif N == M:\n print((2 * fact(N) * fact(M) % mod))\nelse:\n print((fact(N) * fact(M) % mod))\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["- return math.factorial(n)","+ mod = int(1e9) + 7","+ return math.factorial(n) % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.0437633991,"measured_runtime_v1":0.0406168938,"runtime_lift":1.0774678971,"key":["s374440213","s479922538"]} +{"user_id":"u350997995","problem_id":"p03681","language":"python","submission_id_v0":"s096847011","submission_id_v1":"s904942946","cpu_time_v0":705,"cpu_time_v1":37,"memory_v0":5184,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.75,"input":"import math\n\nN,M = list(map(int,input().split()))\n\nif abs(N-M)>1:\n\n print((0))\n\n exit()\n\nIF = 10**9+7\n\nans = math.factorial(N)*math.factorial(M)\n\nif abs(N-M)==0:\n\n ans*=2\n\nprint((ans%IF))","target":"N,M = list(map(int,input().split()))\n\nmod = pow(10,9)+7\n\n\n\ndef f(x,mod):\n\n k = 1\n\n res = 1\n\n while k1:print((0))\n\nelif abs(N-M)==1:\n\n a = f(min(N,M),mod)\n\n print((pow(a,2,mod)*max(N,M)%mod))\n\nelse:\n\n a = f(N,mod)\n\n print((2*pow(a,2,mod)%mod))","code_v0_loc":10,"code_v1_loc":19,"code_v0_num_chars":186,"code_v1_num_chars":336,"code_v0_no_empty_lines":"import math\n\nN, M = list(map(int, input().split()))\nif abs(N - M) > 1:\n print((0))\n exit()\nIF = 10**9 + 7\nans = math.factorial(N) * math.factorial(M)\nif abs(N - M) == 0:\n ans *= 2\nprint((ans % IF))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nmod = pow(10, 9) + 7\n\n\ndef f(x, mod):\n k = 1\n res = 1\n while k < x:\n k += 1\n res *= k\n res %= mod\n return res\n\n\nif abs(N - M) > 1:\n print((0))\nelif abs(N - M) == 1:\n a = f(min(N, M), mod)\n print((pow(a, 2, mod) * max(N, M) % mod))\nelse:\n a = f(N, mod)\n print((2 * pow(a, 2, mod) % mod))\n","code_same":false,"relative_loc_diff_percent":47.3684210526,"diff":["-import math","+N, M = list(map(int, input().split()))","+mod = pow(10, 9) + 7","-N, M = list(map(int, input().split()))","+","+def f(x, mod):","+ k = 1","+ res = 1","+ while k < x:","+ k += 1","+ res *= k","+ res %= mod","+ return res","+","+","- exit()","-IF = 10**9 + 7","-ans = math.factorial(N) * math.factorial(M)","-if abs(N - M) == 0:","- ans *= 2","-print((ans % IF))","+elif abs(N - M) == 1:","+ a = f(min(N, M), mod)","+ print((pow(a, 2, mod) * max(N, M) % mod))","+else:","+ a = f(N, mod)","+ print((2 * pow(a, 2, mod) % mod))"],"diff_only_import_comment":false,"measured_runtime_v0":0.076209116,"measured_runtime_v1":0.0395065308,"runtime_lift":1.929025771,"key":["s096847011","s904942946"]} +{"user_id":"u006880673","problem_id":"p02767","language":"python","submission_id_v0":"s129129199","submission_id_v1":"s788314557","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"n = int(eval(input()))\n\nx = list(map(int, input().split()))\n\n\n\nf = 10**100\n\n\n\nfor p in range(min(x), max(x) + 1):\n\n l = [(x[i] - p)**2 for i in range(n)]\n\n f1 = sum(l)\n\n f = min(f, f1)\n\n\n\nprint(f)","target":"n = int(eval(input()))\n\nx = list(map(int, input().split()))\n\n\n\nx_mean = sum(x)\/n\n\np1 = int(x_mean)\n\np2 = p1 + 1\n\n\n\nif abs(x_mean - p1) > abs(x_mean - p2):\n\n p = p2\n\nelse:\n\n p = p1\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans += (x[i]-p)**2\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":16,"code_v0_num_chars":199,"code_v1_num_chars":246,"code_v0_no_empty_lines":"n = int(eval(input()))\nx = list(map(int, input().split()))\nf = 10**100\nfor p in range(min(x), max(x) + 1):\n l = [(x[i] - p) ** 2 for i in range(n)]\n f1 = sum(l)\n f = min(f, f1)\nprint(f)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nx = list(map(int, input().split()))\nx_mean = sum(x) \/ n\np1 = int(x_mean)\np2 = p1 + 1\nif abs(x_mean - p1) > abs(x_mean - p2):\n p = p2\nelse:\n p = p1\nans = 0\nfor i in range(n):\n ans += (x[i] - p) ** 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":31.25,"diff":["-f = 10**100","-for p in range(min(x), max(x) + 1):","- l = [(x[i] - p) ** 2 for i in range(n)]","- f1 = sum(l)","- f = min(f, f1)","-print(f)","+x_mean = sum(x) \/ n","+p1 = int(x_mean)","+p2 = p1 + 1","+if abs(x_mean - p1) > abs(x_mean - p2):","+ p = p2","+else:","+ p = p1","+ans = 0","+for i in range(n):","+ ans += (x[i] - p) ** 2","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0446248786,"measured_runtime_v1":0.0442604445,"runtime_lift":1.0082338566,"key":["s129129199","s788314557"]} +{"user_id":"u130900604","problem_id":"p02936","language":"python","submission_id_v0":"s747625261","submission_id_v1":"s134299579","cpu_time_v0":1905,"cpu_time_v1":782,"memory_v0":55828,"memory_v1":127620,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.95,"input":"I=lambda:list(map(int,input().split()));\n\nn,q=I();r=[0]*n;e=[[]for _ in range(n)];y=[0]+[1]*n;s=[0]\n\nfor _ in range(n-1):a,b=I();e[a-1]+=b-1,;e[b-1]+=a-1,;\n\nfor _ in range(q):p,x=I();r[p-1]+=x;\n\nwhile s:\n\n u=s.pop();v=r[u];\n\n for c in e[u]:\n\n if y[c]:y[c]=0;r[c]+=v;s+=c,;\n\nprint((*r))","target":"n,q=list(map(int,input().split()))\n\nfrom collections import deque\n\nedge=[[] for _ in range(n)]\n\nans=[0]*n\n\nfor i in range(n-1):\n\n a,b=[int(x)-1 for x in input().split()]\n\n edge[a].append(b)\n\n edge[b].append(a)\n\n\n\nfor i in range(q):\n\n p,x=list(map(int,input().split()))\n\n p-=1\n\n ans[p]+=x\n\n\n\ndone=[False]*n\n\nq=deque([])\n\nq.append(0)\n\ndone[0]=True\n\nwhile q:\n\n v=q.popleft()\n\n done[v]=True\n\n for c in edge[v]:\n\n if done[c]==False:\n\n ans[c]+=ans[v]\n\n q.append(c)\n\n \n\nprint((*ans)) \n\n \n","code_v0_loc":9,"code_v1_loc":28,"code_v0_num_chars":282,"code_v1_num_chars":496,"code_v0_no_empty_lines":"I = lambda: list(map(int, input().split()))\nn, q = I()\nr = [0] * n\ne = [[] for _ in range(n)]\ny = [0] + [1] * n\ns = [0]\nfor _ in range(n - 1):\n a, b = I()\n e[a - 1] += (b - 1,)\n e[b - 1] += (a - 1,)\nfor _ in range(q):\n p, x = I()\n r[p - 1] += x\nwhile s:\n u = s.pop()\n v = r[u]\n for c in e[u]:\n if y[c]:\n y[c] = 0\n r[c] += v\n s += (c,)\nprint((*r))\n","code_v1_no_empty_lines":"n, q = list(map(int, input().split()))\nfrom collections import deque\n\nedge = [[] for _ in range(n)]\nans = [0] * n\nfor i in range(n - 1):\n a, b = [int(x) - 1 for x in input().split()]\n edge[a].append(b)\n edge[b].append(a)\nfor i in range(q):\n p, x = list(map(int, input().split()))\n p -= 1\n ans[p] += x\ndone = [False] * n\nq = deque([])\nq.append(0)\ndone[0] = True\nwhile q:\n v = q.popleft()\n done[v] = True\n for c in edge[v]:\n if done[c] == False:\n ans[c] += ans[v]\n q.append(c)\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":67.8571428571,"diff":["-I = lambda: list(map(int, input().split()))","-n, q = I()","-r = [0] * n","-e = [[] for _ in range(n)]","-y = [0] + [1] * n","-s = [0]","-for _ in range(n - 1):","- a, b = I()","- e[a - 1] += (b - 1,)","- e[b - 1] += (a - 1,)","-for _ in range(q):","- p, x = I()","- r[p - 1] += x","-while s:","- u = s.pop()","- v = r[u]","- for c in e[u]:","- if y[c]:","- y[c] = 0","- r[c] += v","- s += (c,)","-print((*r))","+n, q = list(map(int, input().split()))","+from collections import deque","+","+edge = [[] for _ in range(n)]","+ans = [0] * n","+for i in range(n - 1):","+ a, b = [int(x) - 1 for x in input().split()]","+ edge[a].append(b)","+ edge[b].append(a)","+for i in range(q):","+ p, x = list(map(int, input().split()))","+ p -= 1","+ ans[p] += x","+done = [False] * n","+q = deque([])","+q.append(0)","+done[0] = True","+while q:","+ v = q.popleft()","+ done[v] = True","+ for c in edge[v]:","+ if done[c] == False:","+ ans[c] += ans[v]","+ q.append(c)","+print((*ans))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0323182998,"measured_runtime_v1":0.0354305441,"runtime_lift":0.9121592837,"key":["s747625261","s134299579"]} +{"user_id":"u519939795","problem_id":"p02642","language":"python","submission_id_v0":"s505187096","submission_id_v1":"s365711052","cpu_time_v0":400,"cpu_time_v1":332,"memory_v0":32240,"memory_v1":43916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.0,"input":"n=int(eval(input()))\n\nA=list(map(int,input().split()))\n\nA.sort()\n\nM=10**6+1\n\ncnt=[0]*M\n\nfor i in A:\n\n if cnt[i]!=0:\n\n cnt[i]=2\n\n continue\n\n for j in range(i,M,i):\n\n cnt[j]+=1\n\nans=0\n\nfor i in A:\n\n if cnt[i]==1:\n\n ans+=1\n\nprint(ans)","target":"from collections import Counter\n\nmax_=10**6+1\n\nans=0\n\n\n\nn=int(eval(input()))\n\ndata=list(map(int,input().split()))\n\n\n\nb=[True]*(max_+1)\n\ndata.sort()\n\nc=Counter(data)\n\n\n\nfor d in data:\n\n if b[d]:\n\n for j in range(d,max_,d):\n\n b[j]=False\n\n if c[d]==1:#\u8907\u6570\u5b58\u5728\u8003\u616e\n\n ans+=1\n\nprint(ans)","code_v0_loc":16,"code_v1_loc":18,"code_v0_num_chars":262,"code_v1_num_chars":309,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nA.sort()\nM = 10**6 + 1\ncnt = [0] * M\nfor i in A:\n if cnt[i] != 0:\n cnt[i] = 2\n continue\n for j in range(i, M, i):\n cnt[j] += 1\nans = 0\nfor i in A:\n if cnt[i] == 1:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"from collections import Counter\n\nmax_ = 10**6 + 1\nans = 0\nn = int(eval(input()))\ndata = list(map(int, input().split()))\nb = [True] * (max_ + 1)\ndata.sort()\nc = Counter(data)\nfor d in data:\n if b[d]:\n for j in range(d, max_, d):\n b[j] = False\n if c[d] == 1: # \u8907\u6570\u5b58\u5728\u8003\u616e\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["+from collections import Counter","+","+max_ = 10**6 + 1","+ans = 0","-A = list(map(int, input().split()))","-A.sort()","-M = 10**6 + 1","-cnt = [0] * M","-for i in A:","- if cnt[i] != 0:","- cnt[i] = 2","- continue","- for j in range(i, M, i):","- cnt[j] += 1","-ans = 0","-for i in A:","- if cnt[i] == 1:","- ans += 1","+data = list(map(int, input().split()))","+b = [True] * (max_ + 1)","+data.sort()","+c = Counter(data)","+for d in data:","+ if b[d]:","+ for j in range(d, max_, d):","+ b[j] = False","+ if c[d] == 1: # \u8907\u6570\u5b58\u5728\u8003\u616e","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.1323438761,"measured_runtime_v1":0.111516489,"runtime_lift":1.1867650898,"key":["s505187096","s365711052"]} +{"user_id":"u380524497","problem_id":"p03504","language":"python","submission_id_v0":"s645271493","submission_id_v1":"s144574497","cpu_time_v0":1944,"cpu_time_v1":618,"memory_v0":37956,"memory_v1":46072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.21,"input":"import sys\n\nimport numpy as np\n\ninput = sys.stdin.readline\n\n\n\n\n\nn, c = list(map(int, input().split()))\n\ntv_guide = np.zeros((c, 10**5+1), dtype=np.int)\n\n\n\nfor _ in range(n):\n\n s, t, c = [int(x)-1 for x in input().split()]\n\n tv_guide[c][s:t+1] = 1\n\n\n\nans = 0\n\nfor time in range(10**5+1):\n\n count = sum(tv_guide[:,time])\n\n ans = max(count, ans)\n\n\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\n\n\nn, c = list(map(int, input().split()))\n\ntv_guide = []\n\nfor _ in range(n):\n\n start, end, channel = list(map(int, input().split()))\n\n tv_guide.append([start, 1, channel-1])\n\n tv_guide.append([end, 0, channel-1])\n\n\n\ntv_guide.sort(key=lambda x:(x[0], -x[1]))\n\n\n\nchannel_count = [0] * c\n\nchannel_set = set()\n\nans = 0\n\nfor time, on, channel in tv_guide:\n\n if on:\n\n channel_set.add(channel)\n\n channel_count[channel] += 1\n\n\n\n else:\n\n channel_count[channel] -= 1\n\n if channel_count[channel] == 0:\n\n channel_set.discard(channel)\n\n\n\n candidate = len(channel_set)\n\n if ans < candidate:\n\n ans = candidate\n\n\n\nprint(ans)","code_v0_loc":18,"code_v1_loc":31,"code_v0_num_chars":367,"code_v1_num_chars":704,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\ninput = sys.stdin.readline\nn, c = list(map(int, input().split()))\ntv_guide = np.zeros((c, 10**5 + 1), dtype=np.int)\nfor _ in range(n):\n s, t, c = [int(x) - 1 for x in input().split()]\n tv_guide[c][s : t + 1] = 1\nans = 0\nfor time in range(10**5 + 1):\n count = sum(tv_guide[:, time])\n ans = max(count, ans)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, c = list(map(int, input().split()))\ntv_guide = []\nfor _ in range(n):\n start, end, channel = list(map(int, input().split()))\n tv_guide.append([start, 1, channel - 1])\n tv_guide.append([end, 0, channel - 1])\ntv_guide.sort(key=lambda x: (x[0], -x[1]))\nchannel_count = [0] * c\nchannel_set = set()\nans = 0\nfor time, on, channel in tv_guide:\n if on:\n channel_set.add(channel)\n channel_count[channel] += 1\n else:\n channel_count[channel] -= 1\n if channel_count[channel] == 0:\n channel_set.discard(channel)\n candidate = len(channel_set)\n if ans < candidate:\n ans = candidate\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":41.935483871,"diff":["-import numpy as np","-tv_guide = np.zeros((c, 10**5 + 1), dtype=np.int)","+tv_guide = []","- s, t, c = [int(x) - 1 for x in input().split()]","- tv_guide[c][s : t + 1] = 1","+ start, end, channel = list(map(int, input().split()))","+ tv_guide.append([start, 1, channel - 1])","+ tv_guide.append([end, 0, channel - 1])","+tv_guide.sort(key=lambda x: (x[0], -x[1]))","+channel_count = [0] * c","+channel_set = set()","-for time in range(10**5 + 1):","- count = sum(tv_guide[:, time])","- ans = max(count, ans)","+for time, on, channel in tv_guide:","+ if on:","+ channel_set.add(channel)","+ channel_count[channel] += 1","+ else:","+ channel_count[channel] -= 1","+ if channel_count[channel] == 0:","+ channel_set.discard(channel)","+ candidate = len(channel_set)","+ if ans < candidate:","+ ans = candidate"],"diff_only_import_comment":false,"measured_runtime_v0":0.4430344439,"measured_runtime_v1":0.0447908454,"runtime_lift":9.8911828937,"key":["s645271493","s144574497"]} +{"user_id":"u052332717","problem_id":"p03548","language":"python","submission_id_v0":"s550868347","submission_id_v1":"s330282284","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"x,y,z = list(map(int, input().split()))\n\n\n\nprint((int((x-z)\/(y+z))))","target":"x,y,z = list(map(int,input().split()))\n\n\n\nprint(((x-z)\/\/(y+z)))","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":60,"code_v1_num_chars":55,"code_v0_no_empty_lines":"x, y, z = list(map(int, input().split()))\nprint((int((x - z) \/ (y + z))))\n","code_v1_no_empty_lines":"x, y, z = list(map(int, input().split()))\nprint(((x - z) \/\/ (y + z)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((int((x - z) \/ (y + z))))","+print(((x - z) \/\/ (y + z)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0397481512,"measured_runtime_v1":0.078782456,"runtime_lift":0.5045304911,"key":["s550868347","s330282284"]} +{"user_id":"u179169725","problem_id":"p03371","language":"python","submission_id_v0":"s025355270","submission_id_v1":"s938777177","cpu_time_v0":163,"cpu_time_v1":21,"memory_v0":38384,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.12,"input":"# https:\/\/atcoder.jp\/contests\/abc095\/tasks\/arc096_a\n\n\n\n\n\n# A1\u679a\u2192A\u5186\n\n# B1\u679a\u2192B\u5186\n\n# A,B\u4e21\u65b9\u4e00\u679a\u2192AB\u5186\n\n\n\n\n\n# \u3082\u30572AB<=A+B\u306a\u3089min(X,Y)\u306b\u306a\u308b\u307e\u3067\u8cb7\u3063\u305f\u307b\u3046\u304c\u5b89\u3044\n\n# A\u3060\u3051\u5fc5\u8981\u2192A 10**9\n\n# default import\n\nfrom collections import defaultdict, Counter, deque\n\nfrom operator import itemgetter\n\nfrom itertools import product, permutations, combinations\n\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\n\n\n\n# https:\/\/atcoder.jp\/contests\/abc095\/tasks\/arc096_a\n\nA, B, C, X, Y = read_ints()\n\n\n\n# \u3082\u3057\u7d44\u307f\u5408\u308f\u305b\u3066\u8cb7\u3063\u305f\u307b\u3046\u304c\u3044\u3044\u306a\u3089\u9650\u754c\u307e\u3067\u7d44\u307f\u5408\u308f\u305b\u3066\u8cb7\u3046\n\nbuyed = min(X, Y)\n\nc1 = min(A + B, 2 * C) * buyed\n\nX -= buyed\n\nY -= buyed\n\n\n\nif X:\n\n c2 = min(A, 2 * C) * X\n\nelif Y:\n\n c2 = min(B, 2 * C) * Y\n\nelse:\n\n c2 = 0\n\n\n\nprint((c1 + c2))\n","code_v0_loc":39,"code_v1_loc":73,"code_v0_num_chars":592,"code_v1_num_chars":1516,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc095\/tasks\/arc096_a\n# A1\u679a\u2192A\u5186\n# B1\u679a\u2192B\u5186\n# A,B\u4e21\u65b9\u4e00\u679a\u2192AB\u5186\n# \u3082\u30572AB<=A+B\u306a\u3089min(X,Y)\u306b\u306a\u308b\u307e\u3067\u8cb7\u3063\u305f\u307b\u3046\u304c\u5b89\u3044\n# A\u3060\u3051\u5fc5\u8981\u2192A 10**9\n# default import\nfrom collections import defaultdict, Counter, deque\nfrom operator import itemgetter\nfrom itertools import product, permutations, combinations\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\n\n# https:\/\/atcoder.jp\/contests\/abc095\/tasks\/arc096_a\nA, B, C, X, Y = read_ints()\n# \u3082\u3057\u7d44\u307f\u5408\u308f\u305b\u3066\u8cb7\u3063\u305f\u307b\u3046\u304c\u3044\u3044\u306a\u3089\u9650\u754c\u307e\u3067\u7d44\u307f\u5408\u308f\u305b\u3066\u8cb7\u3046\nbuyed = min(X, Y)\nc1 = min(A + B, 2 * C) * buyed\nX -= buyed\nY -= buyed\nif X:\n c2 = min(A, 2 * C) * X\nelif Y:\n c2 = min(B, 2 * C) * Y\nelse:\n c2 = 0\nprint((c1 + c2))\n","code_same":false,"relative_loc_diff_percent":46.5753424658,"diff":["+import sys","+","+sys.setrecursionlimit(1 << 25)","+read = sys.stdin.readline","+ra = range","+enu = enumerate","+","+","+def read_ints():","+ return list(map(int, read().split()))","+","+","+def read_a_int():","+ return int(read())","+","+","+def read_tuple(H):","+ \"\"\"","+ H is number of rows","+ \"\"\"","+ ret = []","+ for _ in range(H):","+ ret.append(tuple(map(int, read().split())))","+ return ret","+","+","+def read_col(H):","+ \"\"\"","+ H is number of rows","+ A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d","+ ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408","+ \"\"\"","+ ret = []","+ for _ in range(H):","+ ret.append(list(map(int, read().split())))","+ return tuple(map(list, list(zip(*ret))))","+","+","+def read_matrix(H):","+ \"\"\"","+ H is number of rows","+ \"\"\"","+ ret = []","+ for _ in range(H):","+ ret.append(list(map(int, read().split())))","+ return ret","+ # return [list(map(int, read().split())) for _ in range(H)] # \u5185\u5305\u8868\u8a18\u306fpypy\u3067\u306f\u9045\u3044\u305f\u3081","+","+","+MOD = 10**9 + 7","+INF = 2**31 # 2147483648 > 10**9","+# default import","+from collections import defaultdict, Counter, deque","+from operator import itemgetter","+from itertools import product, permutations, combinations","+from bisect import bisect_left, bisect_right # , insort_left, insort_right","+","-# A1\u679a\u2192A\u5186","-# B1\u679a\u2192B\u5186","-# A,B\u4e21\u65b9\u4e00\u679a\u2192AB\u5186","-# \u3082\u30572AB<=A+B\u306a\u3089min(X,Y)\u306b\u306a\u308b\u307e\u3067\u8cb7\u3063\u305f\u307b\u3046\u304c\u5b89\u3044","-# A\u3060\u3051\u5fc5\u8981\u2192A= 0:\n\n x = x - min(m)\n\n sum += 1\n\nprint(sum)","target":"n, x = list(map(int, input().split()))\n\nm = [int(eval(input())) for i in range(n)]\n\nx -= sum(m)\n\nprint((n + x\/\/min(m)))","code_v0_loc":9,"code_v1_loc":4,"code_v0_num_chars":177,"code_v1_num_chars":105,"code_v0_no_empty_lines":"n, x = list(map(int, input().split()))\nm = [int(eval(input())) for i in range(n)]\nsum = n\nfor i in m:\n x = x - i\nwhile x - min(m) >= 0:\n x = x - min(m)\n sum += 1\nprint(sum)\n","code_v1_no_empty_lines":"n, x = list(map(int, input().split()))\nm = [int(eval(input())) for i in range(n)]\nx -= sum(m)\nprint((n + x \/\/ min(m)))\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-sum = n","-for i in m:","- x = x - i","-while x - min(m) >= 0:","- x = x - min(m)","- sum += 1","-print(sum)","+x -= sum(m)","+print((n + x \/\/ min(m)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0428570385,"measured_runtime_v1":0.0370785739,"runtime_lift":1.1558437645,"key":["s031169286","s130198372"]} +{"user_id":"u729133443","problem_id":"p02846","language":"python","submission_id_v0":"s448687289","submission_id_v1":"s354417993","cpu_time_v0":181,"cpu_time_v1":18,"memory_v0":38384,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.06,"input":"s,t,a,b,x,y=list(map(int,open(0).read().split()))\n\nif a*s+b*t==x*s+y*t:\n\n print('infinity')\n\n exit()\n\nif ax*s+y*t:\n\n print((0))\n\n exit()\n\nn=(a*s-x*s)\/(x*s+y*t-(a*s+b*t))\n\nm=int(n)\n\nprint((m*2+(n>m)))","target":"s,t,a,b,x,y=list(map(int,open(0).read().split()))\n\ni=(x-a)*s\n\nj=(b-y)*t-i\n\nprint((max(0,i\/\/j*2+(i%j!=0))if j else'infinity'))","code_v0_loc":11,"code_v1_loc":4,"code_v0_num_chars":224,"code_v1_num_chars":117,"code_v0_no_empty_lines":"s, t, a, b, x, y = list(map(int, open(0).read().split()))\nif a * s + b * t == x * s + y * t:\n print(\"infinity\")\n exit()\nif a < x:\n a, b, x, y = x, y, a, b\nif a * s + b * t > x * s + y * t:\n print((0))\n exit()\nn = (a * s - x * s) \/ (x * s + y * t - (a * s + b * t))\nm = int(n)\nprint((m * 2 + (n > m)))\n","code_v1_no_empty_lines":"s, t, a, b, x, y = list(map(int, open(0).read().split()))\ni = (x - a) * s\nj = (b - y) * t - i\nprint((max(0, i \/\/ j * 2 + (i % j != 0)) if j else \"infinity\"))\n","code_same":false,"relative_loc_diff_percent":63.6363636364,"diff":["-if a * s + b * t == x * s + y * t:","- print(\"infinity\")","- exit()","-if a < x:","- a, b, x, y = x, y, a, b","-if a * s + b * t > x * s + y * t:","- print((0))","- exit()","-n = (a * s - x * s) \/ (x * s + y * t - (a * s + b * t))","-m = int(n)","-print((m * 2 + (n > m)))","+i = (x - a) * s","+j = (b - y) * t - i","+print((max(0, i \/\/ j * 2 + (i % j != 0)) if j else \"infinity\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0478838222,"measured_runtime_v1":0.0446097383,"runtime_lift":1.0733939262,"key":["s448687289","s354417993"]} +{"user_id":"u285891772","problem_id":"p03141","language":"python","submission_id_v0":"s354577262","submission_id_v1":"s832356882","cpu_time_v0":290,"cpu_time_v1":248,"memory_v0":36452,"memory_v1":34160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.48,"input":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nN = INT()\n\nAB = [LIST() for _ in range(N)]\n\n\n\nfor i in range(N):\n\n\tAB[i].append(sum(AB[i]))\n\n\n\nAB.sort(key = lambda x: -x[2])\n\n\n\nprint((sum([AB[i][0] for i in range(0, N, 2)]) - sum([AB[i][1] for i in range(1, N, 2)])))","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\nfrom decimal import Decimal\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\nfrom decimal import *\n\n\n\nN = INT()\n\nAB = [LIST() for _ in range(N)]\n\n\n\nX = -sum([x[1] for x in AB])\n\n\n\nfor i, (A, B) in enumerate(sorted(AB, key=lambda x:x[0]+x[1], reverse = True)):\n\n\tif i%2 == 0:\n\n\t\tX += A+B\n\nprint(X)","code_v0_loc":32,"code_v1_loc":31,"code_v0_num_chars":1164,"code_v1_num_chars":1122,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nN = INT()\nAB = [LIST() for _ in range(N)]\nfor i in range(N):\n AB[i].append(sum(AB[i]))\nAB.sort(key=lambda x: -x[2])\nprint(\n (sum([AB[i][0] for i in range(0, N, 2)]) - sum([AB[i][1] for i in range(1, N, 2)]))\n)\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n log,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\nfrom decimal import Decimal\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nfrom decimal import *\n\nN = INT()\nAB = [LIST() for _ in range(N)]\nX = -sum([x[1] for x in AB])\nfor i, (A, B) in enumerate(sorted(AB, key=lambda x: x[0] + x[1], reverse=True)):\n if i % 2 == 0:\n X += A + B\nprint(X)\n","code_same":false,"relative_loc_diff_percent":3.125,"diff":["- gcd,","+ log,","+from fractions import gcd","+from decimal import Decimal","-# mod = 998244353","-# import numpy as np","-# decimal.getcontext().prec = 10","-for i in range(N):","- AB[i].append(sum(AB[i]))","-AB.sort(key=lambda x: -x[2])","-print(","- (sum([AB[i][0] for i in range(0, N, 2)]) - sum([AB[i][1] for i in range(1, N, 2)]))","-)","+X = -sum([x[1] for x in AB])","+for i, (A, B) in enumerate(sorted(AB, key=lambda x: x[0] + x[1], reverse=True)):","+ if i % 2 == 0:","+ X += A + B","+print(X)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0469005253,"measured_runtime_v1":0.047147929,"runtime_lift":0.9947526087,"key":["s354577262","s832356882"]} +{"user_id":"u408260374","problem_id":"p00914","language":"python","submission_id_v0":"s190236134","submission_id_v1":"s855021240","cpu_time_v0":490,"cpu_time_v1":420,"memory_v0":7512,"memory_v1":7720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"import itertools\n\n\n\nwhile True:\n\n N, K, S = list(map(int, input().split()))\n\n if N == K == S == 0:\n\n break\n\n ans = 0\n\n for l in itertools.combinations(list(range(1, N+1)), K):\n\n if sum(l) == S:\n\n ans += 1\n\n print(ans)","target":"import itertools\n\n\n\nwhile True:\n\n N, K, S = list(map(int, input().split()))\n\n if N == K == S == 0:\n\n break\n\n print((sum(1 for l in itertools.combinations(list(range(1, N+1)), K) if sum(l) == S)))","code_v0_loc":11,"code_v1_loc":7,"code_v0_num_chars":245,"code_v1_num_chars":197,"code_v0_no_empty_lines":"import itertools\n\nwhile True:\n N, K, S = list(map(int, input().split()))\n if N == K == S == 0:\n break\n ans = 0\n for l in itertools.combinations(list(range(1, N + 1)), K):\n if sum(l) == S:\n ans += 1\n print(ans)\n","code_v1_no_empty_lines":"import itertools\n\nwhile True:\n N, K, S = list(map(int, input().split()))\n if N == K == S == 0:\n break\n print(\n (\n sum(\n 1\n for l in itertools.combinations(list(range(1, N + 1)), K)\n if sum(l) == S\n )\n )\n )\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["- ans = 0","- for l in itertools.combinations(list(range(1, N + 1)), K):","- if sum(l) == S:","- ans += 1","- print(ans)","+ print(","+ (","+ sum(","+ 1","+ for l in itertools.combinations(list(range(1, N + 1)), K)","+ if sum(l) == S","+ )","+ )","+ )"],"diff_only_import_comment":false,"measured_runtime_v0":0.1617770195,"measured_runtime_v1":0.1814856246,"runtime_lift":0.8914040431,"key":["s190236134","s855021240"]} +{"user_id":"u875541136","problem_id":"p02754","language":"python","submission_id_v0":"s056819165","submission_id_v1":"s656426947","cpu_time_v0":194,"cpu_time_v1":179,"memory_v0":38384,"memory_v1":38256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.73,"input":"li = list(map(int,input().split()))\n\nout = int(li[0] \/ (li[1] + li[2])) * li[1]\n\nremain = li[0] - int(li[0] \/ (li[1] + li[2])) * (li[1] + li[2])\n\nif(remain > li[1]):\n\n out += li[1]\n\nelse:\n\n out += remain\n\nprint(out)","target":"N, A, B = list(map(int, input().split()))\n\nn = int(N \/ (A + B))\n\nm = min(N - n * (A + B), A)\n\nprint((n * A + m))","code_v0_loc":8,"code_v1_loc":4,"code_v0_num_chars":222,"code_v1_num_chars":104,"code_v0_no_empty_lines":"li = list(map(int, input().split()))\nout = int(li[0] \/ (li[1] + li[2])) * li[1]\nremain = li[0] - int(li[0] \/ (li[1] + li[2])) * (li[1] + li[2])\nif remain > li[1]:\n out += li[1]\nelse:\n out += remain\nprint(out)\n","code_v1_no_empty_lines":"N, A, B = list(map(int, input().split()))\nn = int(N \/ (A + B))\nm = min(N - n * (A + B), A)\nprint((n * A + m))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-li = list(map(int, input().split()))","-out = int(li[0] \/ (li[1] + li[2])) * li[1]","-remain = li[0] - int(li[0] \/ (li[1] + li[2])) * (li[1] + li[2])","-if remain > li[1]:","- out += li[1]","-else:","- out += remain","-print(out)","+N, A, B = list(map(int, input().split()))","+n = int(N \/ (A + B))","+m = min(N - n * (A + B), A)","+print((n * A + m))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0364744925,"measured_runtime_v1":0.0419473081,"runtime_lift":0.8695311863,"key":["s056819165","s656426947"]} +{"user_id":"u918601425","problem_id":"p03147","language":"python","submission_id_v0":"s150779014","submission_id_v1":"s133194912","cpu_time_v0":40,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.0,"input":"N=int(eval(input()))\n\nlst = [int(s) for s in input().split()]\n\ndef suc(ls):\n\n val_ls=ls\n\n i=0\n\n while(i 1:\n\n print((-1))\n\n exit()\n\n if b==0: continue\n\n if b-a == 1:\n\n ans += 1\n\n else:\n\n ans += b\n\nprint(ans)","target":"N = int(eval(input()))\n\nA = [int(eval(input())) for i in range(N)]\n\n\n\nif A[0]:\n\n print((-1))\n\n exit()\n\n\n\nans = 0\n\nfor a,b in zip(A,A[1:]):\n\n if a+1 < b:\n\n print((-1))\n\n exit()\n\n if a+1 == b:\n\n ans += 1\n\n else:\n\n ans += b\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":17,"code_v0_num_chars":280,"code_v1_num_chars":259,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [int(eval(input())) for i in range(N)]\nif A[0]:\n print((-1))\n exit()\nans = 0\nfor a, b in zip(A, A[1:]):\n if b - a > 1:\n print((-1))\n exit()\n if b == 0:\n continue\n if b - a == 1:\n ans += 1\n else:\n ans += b\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(eval(input())) for i in range(N)]\nif A[0]:\n print((-1))\n exit()\nans = 0\nfor a, b in zip(A, A[1:]):\n if a + 1 < b:\n print((-1))\n exit()\n if a + 1 == b:\n ans += 1\n else:\n ans += b\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if b - a > 1:","+ if a + 1 < b:","- if b == 0:","- continue","- if b - a == 1:","+ if a + 1 == b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0366117418,"measured_runtime_v1":0.0607840152,"runtime_lift":0.6023251618,"key":["s833758206","s917422264"]} +{"user_id":"u863044225","problem_id":"p02736","language":"python","submission_id_v0":"s589799558","submission_id_v1":"s643971364","cpu_time_v0":1473,"cpu_time_v1":1272,"memory_v0":55240,"memory_v1":53192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.65,"input":"n=int(eval(input()))\n\ns=eval(input())\n\na=[int(s[i])-1 for i in range(n)]\n\n\n\ndiv=[0]*(n+1)\n\nfor i in range(1,n+1):\n\n div[i]+=div[i-1]\n\n x=i\n\n while not x&1:\n\n x>>=1\n\n div[i]+=1\n\n\n\nXOR=0\n\nfor i in range(n):\n\n if div[n-1]<=div[i]+div[n-1-i]:\n\n XOR^=a[i]\n\nif XOR&1:\n\n print((1))\n\n exit(0)\n\n\n\n\n\nfor i in a:\n\n if i==1:\n\n print((0))\n\n exit(0)\n\n\n\nXOR=0\n\nfor i in range(n):\n\n if div[n-1]<=div[i]+div[n-1-i]:\n\n XOR^=a[i]>>1\n\nif XOR&1:\n\n print((2))\n\n exit(0)\n\nprint((0))","target":"n=int(eval(input()))\n\ns=eval(input())\n\na=[int(s[i])-1 for i in range(n)]\n\n\n\ndiv=[0]*(n+1)\n\nfor i in range(1,n+1):\n\n div[i]+=div[i-1]\n\n x=i\n\n while not x&1:\n\n x>>=1\n\n div[i]+=1\n\n\n\nXOR=0;one=False\n\nfor i in range(n):\n\n one|=a[i]==1\n\n if div[n-1]<=div[i]+div[n-1-i]:\n\n XOR^=a[i]\n\nif XOR&1:print((1))\n\nelif one:print((0))\n\nelif XOR&2:print((2))\n\nelse:print((0))","code_v0_loc":34,"code_v1_loc":21,"code_v0_num_chars":467,"code_v1_num_chars":351,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\na = [int(s[i]) - 1 for i in range(n)]\ndiv = [0] * (n + 1)\nfor i in range(1, n + 1):\n div[i] += div[i - 1]\n x = i\n while not x & 1:\n x >>= 1\n div[i] += 1\nXOR = 0\nfor i in range(n):\n if div[n - 1] <= div[i] + div[n - 1 - i]:\n XOR ^= a[i]\nif XOR & 1:\n print((1))\n exit(0)\nfor i in a:\n if i == 1:\n print((0))\n exit(0)\nXOR = 0\nfor i in range(n):\n if div[n - 1] <= div[i] + div[n - 1 - i]:\n XOR ^= a[i] >> 1\nif XOR & 1:\n print((2))\n exit(0)\nprint((0))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\na = [int(s[i]) - 1 for i in range(n)]\ndiv = [0] * (n + 1)\nfor i in range(1, n + 1):\n div[i] += div[i - 1]\n x = i\n while not x & 1:\n x >>= 1\n div[i] += 1\nXOR = 0\none = False\nfor i in range(n):\n one |= a[i] == 1\n if div[n - 1] <= div[i] + div[n - 1 - i]:\n XOR ^= a[i]\nif XOR & 1:\n print((1))\nelif one:\n print((0))\nelif XOR & 2:\n print((2))\nelse:\n print((0))\n","code_same":false,"relative_loc_diff_percent":38.2352941176,"diff":["+one = False","+ one |= a[i] == 1","- exit(0)","-for i in a:","- if i == 1:","- print((0))","- exit(0)","-XOR = 0","-for i in range(n):","- if div[n - 1] <= div[i] + div[n - 1 - i]:","- XOR ^= a[i] >> 1","-if XOR & 1:","+elif one:","+ print((0))","+elif XOR & 2:","- exit(0)","-print((0))","+else:","+ print((0))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0381296032,"measured_runtime_v1":0.0377213302,"runtime_lift":1.010823398,"key":["s589799558","s643971364"]} +{"user_id":"u498487134","problem_id":"p02900","language":"python","submission_id_v0":"s060455152","submission_id_v1":"s794682643","cpu_time_v0":308,"cpu_time_v1":71,"memory_v0":66264,"memory_v1":63688,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.95,"input":"import math\n\nimport fractions\n\n\n\nA, B = list(map(int,input().split()))\n\ngcd = fractions.gcd(A,B)\n\nN = int(math.ceil(math.sqrt(gcd)))\n\ncd = []\n\n\n\nfor i in range(1,N):\n\n if A%i==0 and B%i==0:\n\n cd.append(i)\n\n cd.append(gcd\/\/i)\n\nif N==1:\n\n cd.append(N)\n\n\n\nans=0\n\ncd.sort()\n\n\n\n\n\nfor i in range(len(cd)):\n\n tr=1\n\n for j in range(1,i):\n\n if cd[i]%cd[j]==0:\n\n tr=0\n\n break\n\n if tr==1:\n\n ans+=1\n\n\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n def factorization(n):\n\n if n==1:\n\n return []\n\n arr = []\n\n temp = n\n\n for i in range(2, int(-(-n**0.5\/\/1))+1):\n\n if temp%i==0:\n\n cnt=0\n\n while temp%i==0:\n\n cnt+=1\n\n temp \/\/= i\n\n arr.append([i, cnt])\n\n\n\n if temp!=1:\n\n arr.append([temp, 1])\n\n\n\n if arr==[]:\n\n arr.append([n, 1])\n\n\n\n return arr\n\n \n\n mod=10**9+7\n\n a,b=MI()\n\n from math import gcd\n\n g=gcd(a,b)\n\n arr=factorization(g)\n\n \n\n ans=len(arr)+1\n\n \n\n print(ans)\n\n \n\n \n\n \n\n\n\nmain()\n","code_v0_loc":29,"code_v1_loc":43,"code_v0_num_chars":459,"code_v1_num_chars":832,"code_v0_no_empty_lines":"import math\nimport fractions\n\nA, B = list(map(int, input().split()))\ngcd = fractions.gcd(A, B)\nN = int(math.ceil(math.sqrt(gcd)))\ncd = []\nfor i in range(1, N):\n if A % i == 0 and B % i == 0:\n cd.append(i)\n cd.append(gcd \/\/ i)\nif N == 1:\n cd.append(N)\nans = 0\ncd.sort()\nfor i in range(len(cd)):\n tr = 1\n for j in range(1, i):\n if cd[i] % cd[j] == 0:\n tr = 0\n break\n if tr == 1:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n def factorization(n):\n if n == 1:\n return []\n arr = []\n temp = n\n for i in range(2, int(-(-(n**0.5) \/\/ 1)) + 1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp \/\/= i\n arr.append([i, cnt])\n if temp != 1:\n arr.append([temp, 1])\n if arr == []:\n arr.append([n, 1])\n return arr\n\n mod = 10**9 + 7\n a, b = MI()\n from math import gcd\n\n g = gcd(a, b)\n arr = factorization(g)\n ans = len(arr) + 1\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":32.5581395349,"diff":["-import math","-import fractions","+import sys","-A, B = list(map(int, input().split()))","-gcd = fractions.gcd(A, B)","-N = int(math.ceil(math.sqrt(gcd)))","-cd = []","-for i in range(1, N):","- if A % i == 0 and B % i == 0:","- cd.append(i)","- cd.append(gcd \/\/ i)","-if N == 1:","- cd.append(N)","-ans = 0","-cd.sort()","-for i in range(len(cd)):","- tr = 1","- for j in range(1, i):","- if cd[i] % cd[j] == 0:","- tr = 0","- break","- if tr == 1:","- ans += 1","-print(ans)","+input = sys.stdin.readline","+","+","+def I():","+ return int(eval(input()))","+","+","+def MI():","+ return list(map(int, input().split()))","+","+","+def LI():","+ return list(map(int, input().split()))","+","+","+def main():","+ def factorization(n):","+ if n == 1:","+ return []","+ arr = []","+ temp = n","+ for i in range(2, int(-(-(n**0.5) \/\/ 1)) + 1):","+ if temp % i == 0:","+ cnt = 0","+ while temp % i == 0:","+ cnt += 1","+ temp \/\/= i","+ arr.append([i, cnt])","+ if temp != 1:","+ arr.append([temp, 1])","+ if arr == []:","+ arr.append([n, 1])","+ return arr","+","+ mod = 10**9 + 7","+ a, b = MI()","+ from math import gcd","+","+ g = gcd(a, b)","+ arr = factorization(g)","+ ans = len(arr) + 1","+ print(ans)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0521460674,"measured_runtime_v1":0.0398635037,"runtime_lift":1.3081155075,"key":["s060455152","s794682643"]} +{"user_id":"u687574784","problem_id":"p03599","language":"python","submission_id_v0":"s765323918","submission_id_v1":"s792835468","cpu_time_v0":32,"cpu_time_v1":28,"memory_v0":9220,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"a,b,c,d,e,f = list(map(int, input().split()))\n\nmaxn = -1\n\nans = ()\n\nfor at in range(0,31):\n\n for bt in range(0,31-at):\n\n water = (at * a + bt * b) * 100\n\n if water > f:\n\n continue\n\n\n\n # \u6eb6\u3051\u6b8b\u3089\u306a\u3044\u3088\u3046\u306b\u7802\u7cd6\u3092\u9078\u3076\n\n maxsugar = water * e \/\/ 100\n\n for ct in range(0, (maxsugar+1)\/\/c + 1):\n\n for dt in range(0, (maxsugar-ct*c+1)\/\/d + 1):\n\n sugar = ct * c + dt * d\n\n\n\n if 0 < sugar + water <= f and sugar <= (at * a + bt * b) * e:\n\n # \u6c34\uff11\uff10\uff10\u306b\u5bfe\u3057\u3066\u6eb6\u3051\u3066\u3044\u308b\u7802\u7cd6\u306e\u91cf\n\n n = 100 * sugar \/ water\n\n if n == e:\n\n print((water + sugar, sugar))\n\n exit()\n\n if n > maxn:\n\n ans = water + sugar, sugar\n\n maxn = n\n\nprint((*ans))","target":"a,b,c,d,e,f = list(map(int, input().split()))\n\nmaxn = -1\n\nans = ()\n\nfor at in range(0,31):\n\n for bt in range(0,31-at):\n\n water = (at * a + bt * b) * 100\n\n if water > f:\n\n continue\n\n\n\n # \u6eb6\u3051\u6b8b\u3089\u306a\u3044\u3088\u3046\u306b\u7802\u7cd6\u3092\u9078\u3076\n\n maxsugar = water * e \/\/ 100\n\n for ct in range(0, (maxsugar)\/\/c + 1):\n\n for dt in range(0, (maxsugar-ct*c+1)\/\/d + 1):\n\n sugar = ct * c + dt * d\n\n\n\n if 0 < sugar + water <= f and sugar <= (at * a + bt * b) * e:\n\n # \u6c34\uff11\uff10\uff10\u306b\u5bfe\u3057\u3066\u6eb6\u3051\u3066\u3044\u308b\u7802\u7cd6\u306e\u91cf\n\n n = 100 * sugar \/ water\n\n if n == e:\n\n print((water + sugar, sugar))\n\n exit()\n\n if n > maxn:\n\n ans = water + sugar, sugar\n\n maxn = n\n\nprint((*ans))","code_v0_loc":25,"code_v1_loc":25,"code_v0_num_chars":839,"code_v1_num_chars":837,"code_v0_no_empty_lines":"a, b, c, d, e, f = list(map(int, input().split()))\nmaxn = -1\nans = ()\nfor at in range(0, 31):\n for bt in range(0, 31 - at):\n water = (at * a + bt * b) * 100\n if water > f:\n continue\n # \u6eb6\u3051\u6b8b\u3089\u306a\u3044\u3088\u3046\u306b\u7802\u7cd6\u3092\u9078\u3076\n maxsugar = water * e \/\/ 100\n for ct in range(0, (maxsugar + 1) \/\/ c + 1):\n for dt in range(0, (maxsugar - ct * c + 1) \/\/ d + 1):\n sugar = ct * c + dt * d\n if 0 < sugar + water <= f and sugar <= (at * a + bt * b) * e:\n # \u6c34\uff11\uff10\uff10\u306b\u5bfe\u3057\u3066\u6eb6\u3051\u3066\u3044\u308b\u7802\u7cd6\u306e\u91cf\n n = 100 * sugar \/ water\n if n == e:\n print((water + sugar, sugar))\n exit()\n if n > maxn:\n ans = water + sugar, sugar\n maxn = n\nprint((*ans))\n","code_v1_no_empty_lines":"a, b, c, d, e, f = list(map(int, input().split()))\nmaxn = -1\nans = ()\nfor at in range(0, 31):\n for bt in range(0, 31 - at):\n water = (at * a + bt * b) * 100\n if water > f:\n continue\n # \u6eb6\u3051\u6b8b\u3089\u306a\u3044\u3088\u3046\u306b\u7802\u7cd6\u3092\u9078\u3076\n maxsugar = water * e \/\/ 100\n for ct in range(0, (maxsugar) \/\/ c + 1):\n for dt in range(0, (maxsugar - ct * c + 1) \/\/ d + 1):\n sugar = ct * c + dt * d\n if 0 < sugar + water <= f and sugar <= (at * a + bt * b) * e:\n # \u6c34\uff11\uff10\uff10\u306b\u5bfe\u3057\u3066\u6eb6\u3051\u3066\u3044\u308b\u7802\u7cd6\u306e\u91cf\n n = 100 * sugar \/ water\n if n == e:\n print((water + sugar, sugar))\n exit()\n if n > maxn:\n ans = water + sugar, sugar\n maxn = n\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for ct in range(0, (maxsugar + 1) \/\/ c + 1):","+ for ct in range(0, (maxsugar) \/\/ c + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0918524342,"measured_runtime_v1":0.0483331642,"runtime_lift":1.9004018386,"key":["s765323918","s792835468"]} +{"user_id":"u574779290","problem_id":"p02801","language":"python","submission_id_v0":"s204503674","submission_id_v1":"s969403642","cpu_time_v0":27,"cpu_time_v1":24,"memory_v0":8908,"memory_v1":9088,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"C = str(eval(input()))\n\n\n\nprint((chr(ord(C)+1)))","target":"print((chr(ord(str(eval(input())))+1)))","code_v0_loc":3,"code_v1_loc":1,"code_v0_num_chars":40,"code_v1_num_chars":31,"code_v0_no_empty_lines":"C = str(eval(input()))\nprint((chr(ord(C) + 1)))\n","code_v1_no_empty_lines":"print((chr(ord(str(eval(input()))) + 1)))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-C = str(eval(input()))","-print((chr(ord(C) + 1)))","+print((chr(ord(str(eval(input()))) + 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0892271936,"measured_runtime_v1":0.1139620076,"runtime_lift":0.7829556136,"key":["s204503674","s969403642"]} +{"user_id":"u759412327","problem_id":"p03281","language":"python","submission_id_v0":"s267665043","submission_id_v1":"s935552594","cpu_time_v0":151,"cpu_time_v1":25,"memory_v0":12392,"memory_v1":9064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.44,"input":"import numpy as np\n\n\n\na = np.zeros(201)\n\n\n\nfor d in range(1,201,2):\n\n a[d::2*d]+=1\n\n\n\na=(a==8).cumsum()\n\n\n\nN = int(eval(input()))\n\nprint((a[N]))\n","target":"N = int(eval(input()))\n\na = 0\n\n\n\nfor i in range(1,1+N,2):\n\n n = 0\n\n for j in range(1,1+i,2):\n\n if i%j==0:\n\n n+=1\n\n if n==8:\n\n a+=1\n\n\n\nprint(a)","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":138,"code_v1_num_chars":154,"code_v0_no_empty_lines":"import numpy as np\n\na = np.zeros(201)\nfor d in range(1, 201, 2):\n a[d :: 2 * d] += 1\na = (a == 8).cumsum()\nN = int(eval(input()))\nprint((a[N]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\na = 0\nfor i in range(1, 1 + N, 2):\n n = 0\n for j in range(1, 1 + i, 2):\n if i % j == 0:\n n += 1\n if n == 8:\n a += 1\nprint(a)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import numpy as np","-","-a = np.zeros(201)","-for d in range(1, 201, 2):","- a[d :: 2 * d] += 1","-a = (a == 8).cumsum()","-print((a[N]))","+a = 0","+for i in range(1, 1 + N, 2):","+ n = 0","+ for j in range(1, 1 + i, 2):","+ if i % j == 0:","+ n += 1","+ if n == 8:","+ a += 1","+print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2120381672,"measured_runtime_v1":0.0379025483,"runtime_lift":5.5942984453,"key":["s267665043","s935552594"]} +{"user_id":"u864197622","problem_id":"p02563","language":"python","submission_id_v0":"s721968011","submission_id_v1":"s389147712","cpu_time_v0":913,"cpu_time_v1":799,"memory_v0":197164,"memory_v1":204336,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.49,"input":"p, g, ig = 998244353, 3, 332748118\n\nW = [pow(g, (p - 1) >> i, p) for i in range(24)]\n\niW = [pow(ig, (p - 1) >> i, p) for i in range(24)]\n\n\n\ndef fft(k, f):\n\n for l in range(k, 0, -1):\n\n d = 1 << l - 1\n\n for i in range(1 << k - l):\n\n u = 1\n\n for j in range(i * 2 * d, (i * 2 + 1) * d):\n\n f[j], f[j+d] = (f[j] + f[j+d]) % p, u * (f[j] - f[j+d]) % p\n\n u = u * W[l] % p\n\n\n\ndef ifft(k, f):\n\n for l in range(1, k + 1):\n\n d = 1 << l - 1\n\n for i in range(1 << k - l):\n\n u = 1\n\n for j in range(i * 2 * d, (i * 2 + 1) * d):\n\n f[j+d] *= u\n\n f[j], f[j+d] = (f[j] + f[j+d]) % p, (f[j] - f[j+d]) % p\n\n u = u * iW[l] % p\n\n\n\ndef convolve(a, b):\n\n n0 = len(a) + len(b) - 1\n\n k = (n0).bit_length()\n\n n = 1 << k\n\n a = a + [0] * (n - len(a))\n\n b = b + [0] * (n - len(b))\n\n fft(k, a), fft(k, b)\n\n for i in range(n):\n\n a[i] = a[i] * b[i] % p\n\n ifft(k, a)\n\n invn = pow(n, p - 2, p)\n\n for i in range(n0):\n\n a[i] = a[i] * invn % p\n\n del a[n0:]\n\n return a\n\n\n\nN, M = list(map(int, input().split()))\n\nA = [int(a) for a in input().split()]\n\nB = [int(a) for a in input().split()]\n\nprint((*convolve(A, B)))\n","target":"p, g, ig = 998244353, 3, 332748118\n\nW = [pow(g, (p - 1) >> i, p) for i in range(24)]\n\niW = [pow(ig, (p - 1) >> i, p) for i in range(24)]\n\n\n\ndef fft(k, f):\n\n for l in range(k, 0, -1):\n\n d = 1 << l - 1\n\n U = [1]\n\n for i in range(d):\n\n U.append(U[-1] * W[l] % p)\n\n \n\n for i in range(1 << k - l):\n\n for j in range(d):\n\n s = i * 2 * d + j\n\n f[s], f[s+d] = (f[s] + f[s+d]) % p, U[j] * (f[s] - f[s+d]) % p\n\n\n\ndef ifft(k, f):\n\n for l in range(1, k + 1):\n\n d = 1 << l - 1\n\n for i in range(1 << k - l):\n\n u = 1\n\n for j in range(i * 2 * d, (i * 2 + 1) * d):\n\n f[j+d] *= u\n\n f[j], f[j+d] = (f[j] + f[j+d]) % p, (f[j] - f[j+d]) % p\n\n u = u * iW[l] % p\n\n\n\ndef convolve(a, b):\n\n n0 = len(a) + len(b) - 1\n\n k = (n0).bit_length()\n\n n = 1 << k\n\n a = a + [0] * (n - len(a))\n\n b = b + [0] * (n - len(b))\n\n fft(k, a), fft(k, b)\n\n for i in range(n):\n\n a[i] = a[i] * b[i] % p\n\n ifft(k, a)\n\n invn = pow(n, p - 2, p)\n\n for i in range(n0):\n\n a[i] = a[i] * invn % p\n\n del a[n0:]\n\n return a\n\n\n\nN, M = list(map(int, input().split()))\n\nA = [int(a) for a in input().split()]\n\nB = [int(a) for a in input().split()]\n\nprint((*convolve(A, B)))\n","code_v0_loc":43,"code_v1_loc":46,"code_v0_num_chars":1270,"code_v1_num_chars":1325,"code_v0_no_empty_lines":"p, g, ig = 998244353, 3, 332748118\nW = [pow(g, (p - 1) >> i, p) for i in range(24)]\niW = [pow(ig, (p - 1) >> i, p) for i in range(24)]\n\n\ndef fft(k, f):\n for l in range(k, 0, -1):\n d = 1 << l - 1\n for i in range(1 << k - l):\n u = 1\n for j in range(i * 2 * d, (i * 2 + 1) * d):\n f[j], f[j + d] = (f[j] + f[j + d]) % p, u * (f[j] - f[j + d]) % p\n u = u * W[l] % p\n\n\ndef ifft(k, f):\n for l in range(1, k + 1):\n d = 1 << l - 1\n for i in range(1 << k - l):\n u = 1\n for j in range(i * 2 * d, (i * 2 + 1) * d):\n f[j + d] *= u\n f[j], f[j + d] = (f[j] + f[j + d]) % p, (f[j] - f[j + d]) % p\n u = u * iW[l] % p\n\n\ndef convolve(a, b):\n n0 = len(a) + len(b) - 1\n k = (n0).bit_length()\n n = 1 << k\n a = a + [0] * (n - len(a))\n b = b + [0] * (n - len(b))\n fft(k, a), fft(k, b)\n for i in range(n):\n a[i] = a[i] * b[i] % p\n ifft(k, a)\n invn = pow(n, p - 2, p)\n for i in range(n0):\n a[i] = a[i] * invn % p\n del a[n0:]\n return a\n\n\nN, M = list(map(int, input().split()))\nA = [int(a) for a in input().split()]\nB = [int(a) for a in input().split()]\nprint((*convolve(A, B)))\n","code_v1_no_empty_lines":"p, g, ig = 998244353, 3, 332748118\nW = [pow(g, (p - 1) >> i, p) for i in range(24)]\niW = [pow(ig, (p - 1) >> i, p) for i in range(24)]\n\n\ndef fft(k, f):\n for l in range(k, 0, -1):\n d = 1 << l - 1\n U = [1]\n for i in range(d):\n U.append(U[-1] * W[l] % p)\n for i in range(1 << k - l):\n for j in range(d):\n s = i * 2 * d + j\n f[s], f[s + d] = (f[s] + f[s + d]) % p, U[j] * (f[s] - f[s + d]) % p\n\n\ndef ifft(k, f):\n for l in range(1, k + 1):\n d = 1 << l - 1\n for i in range(1 << k - l):\n u = 1\n for j in range(i * 2 * d, (i * 2 + 1) * d):\n f[j + d] *= u\n f[j], f[j + d] = (f[j] + f[j + d]) % p, (f[j] - f[j + d]) % p\n u = u * iW[l] % p\n\n\ndef convolve(a, b):\n n0 = len(a) + len(b) - 1\n k = (n0).bit_length()\n n = 1 << k\n a = a + [0] * (n - len(a))\n b = b + [0] * (n - len(b))\n fft(k, a), fft(k, b)\n for i in range(n):\n a[i] = a[i] * b[i] % p\n ifft(k, a)\n invn = pow(n, p - 2, p)\n for i in range(n0):\n a[i] = a[i] * invn % p\n del a[n0:]\n return a\n\n\nN, M = list(map(int, input().split()))\nA = [int(a) for a in input().split()]\nB = [int(a) for a in input().split()]\nprint((*convolve(A, B)))\n","code_same":false,"relative_loc_diff_percent":6.5217391304,"diff":["+ U = [1]","+ for i in range(d):","+ U.append(U[-1] * W[l] % p)","- u = 1","- for j in range(i * 2 * d, (i * 2 + 1) * d):","- f[j], f[j + d] = (f[j] + f[j + d]) % p, u * (f[j] - f[j + d]) % p","- u = u * W[l] % p","+ for j in range(d):","+ s = i * 2 * d + j","+ f[s], f[s + d] = (f[s] + f[s + d]) % p, U[j] * (f[s] - f[s + d]) % p"],"diff_only_import_comment":false,"measured_runtime_v0":0.0447858303,"measured_runtime_v1":0.0417144275,"runtime_lift":1.0736292703,"key":["s721968011","s389147712"]} +{"user_id":"u564902833","problem_id":"p02973","language":"python","submission_id_v0":"s388680254","submission_id_v1":"s992931295","cpu_time_v0":599,"cpu_time_v1":236,"memory_v0":56024,"memory_v1":7848,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.6,"input":"from bisect import bisect\n\n\n\nN = int(eval(input()))\n\nA = [int(eval(input())) for _ in range(N)]\n\n\n\nINF = 10**10\n\ndp = [-INF]\n\nfor a in A:\n\n if a <= -dp[-1]:\n\n dp.append(-a)\n\n else:\n\n i = bisect(dp, -a)\n\n dp[i] = -a\n\nans = len(dp) - 1\n\nprint(ans)\n","target":"from bisect import bisect_left\n\n\n\nN = int(eval(input()))\n\nA = [int(eval(input())) for _ in range(N)]\n\n\n\n# \u89e3\u306f\u6700\u9577\u975e\u5897\u52a0\u90e8\u5206\u5217\u306e\u9577\u3055\n\ndp = [-1 for _ in range(N)]\n\nfor a in A:\n\n dp[bisect_left(dp, a) - 1] = a\n\nans = sum(x >= 0 for x in dp)\n\n\n\nprint(ans)\n","code_v0_loc":15,"code_v1_loc":12,"code_v0_num_chars":261,"code_v1_num_chars":231,"code_v0_no_empty_lines":"from bisect import bisect\n\nN = int(eval(input()))\nA = [int(eval(input())) for _ in range(N)]\nINF = 10**10\ndp = [-INF]\nfor a in A:\n if a <= -dp[-1]:\n dp.append(-a)\n else:\n i = bisect(dp, -a)\n dp[i] = -a\nans = len(dp) - 1\nprint(ans)\n","code_v1_no_empty_lines":"from bisect import bisect_left\n\nN = int(eval(input()))\nA = [int(eval(input())) for _ in range(N)]\n# \u89e3\u306f\u6700\u9577\u975e\u5897\u52a0\u90e8\u5206\u5217\u306e\u9577\u3055\ndp = [-1 for _ in range(N)]\nfor a in A:\n dp[bisect_left(dp, a) - 1] = a\nans = sum(x >= 0 for x in dp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-from bisect import bisect","+from bisect import bisect_left","-INF = 10**10","-dp = [-INF]","+# \u89e3\u306f\u6700\u9577\u975e\u5897\u52a0\u90e8\u5206\u5217\u306e\u9577\u3055","+dp = [-1 for _ in range(N)]","- if a <= -dp[-1]:","- dp.append(-a)","- else:","- i = bisect(dp, -a)","- dp[i] = -a","-ans = len(dp) - 1","+ dp[bisect_left(dp, a) - 1] = a","+ans = sum(x >= 0 for x in dp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0420115759,"measured_runtime_v1":0.0358515315,"runtime_lift":1.1718209539,"key":["s388680254","s992931295"]} +{"user_id":"u466335531","problem_id":"p03148","language":"python","submission_id_v0":"s054200921","submission_id_v1":"s032750441","cpu_time_v0":852,"cpu_time_v1":485,"memory_v0":82776,"memory_v1":24556,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.08,"input":"from sys import exit\n\n\n\nN,K=list(map(int,input().split()))\n\na={} #{\u7a2e\u985e:\u7f8e\u5473\u3057\u3055}\n\nb=[] #[[\u7a2e\u985e,\u7f8e\u5473\u3057\u3055],...]\n\n\n\nfor _ in range(N):\n\n t,d=list(map(int,input().split()))\n\n b.append([t,d])\n\n try:\n\n a[t].append(d)\n\n except KeyError:\n\n a[t]=[d]\n\nb.sort(key=lambda x:-x[1])\n\n\n\nf=[0]*(N+1)\n\nx=0\n\npoint=0\n\npointsum=[]\n\n\n\nfor [t,d] in b[:K]:\n\n if f[t]==0: x+=1\n\n f[t]+=1\n\n point+=d\n\nmaxpoint=point+x*x\n\n\n\nh=K-1\n\nfor [t,d] in b[K:]:\n\n if f[t]==0:\n\n f[t]=1\n\n x+=1\n\n point+=d\n\n for i in range(h,-2,-1):\n\n if i==-1:\n\n print(maxpoint)\n\n exit()\n\n t=b[i][0]\n\n d=b[i][1]\n\n if f[t]>1:\n\n f[t]-=1\n\n point-=d\n\n h=i-1\n\n break\n\n maxpoint=max(maxpoint,point+x*x)\n\nprint(maxpoint)","target":"from sys import exit\n\n\n\nN,K=list(map(int,input().split()))\n\nb=[] #[[\u7a2e\u985e,\u7f8e\u5473\u3057\u3055],...]\n\n\n\nfor _ in range(N):\n\n t,d=list(map(int,input().split()))\n\n b.append([t,d])\n\nb.sort(key=lambda x:-x[1])\n\n\n\nf=[0]*(N+1)\n\nx=0\n\npoint=0\n\n\n\nfor [t,d] in b[:K]:\n\n if f[t]==0: x+=1\n\n f[t]+=1\n\n point+=d\n\nmaxpoint=point+x*x\n\n\n\nh=K-1\n\nfor [t,d] in b[K:]:\n\n if f[t]==0:\n\n f[t]=1\n\n x+=1\n\n point+=d\n\n for i in range(h,-2,-1):\n\n if i==-1:\n\n print(maxpoint)\n\n exit()\n\n t=b[i][0]\n\n d=b[i][1]\n\n if f[t]>1:\n\n f[t]-=1\n\n point-=d\n\n h=i-1\n\n break\n\n maxpoint=max(maxpoint,point+x*x)\n\nprint(maxpoint)","code_v0_loc":45,"code_v1_loc":39,"code_v0_num_chars":840,"code_v1_num_chars":736,"code_v0_no_empty_lines":"from sys import exit\n\nN, K = list(map(int, input().split()))\na = {} # {\u7a2e\u985e:\u7f8e\u5473\u3057\u3055}\nb = [] # [[\u7a2e\u985e,\u7f8e\u5473\u3057\u3055],...]\nfor _ in range(N):\n t, d = list(map(int, input().split()))\n b.append([t, d])\n try:\n a[t].append(d)\n except KeyError:\n a[t] = [d]\nb.sort(key=lambda x: -x[1])\nf = [0] * (N + 1)\nx = 0\npoint = 0\npointsum = []\nfor [t, d] in b[:K]:\n if f[t] == 0:\n x += 1\n f[t] += 1\n point += d\nmaxpoint = point + x * x\nh = K - 1\nfor [t, d] in b[K:]:\n if f[t] == 0:\n f[t] = 1\n x += 1\n point += d\n for i in range(h, -2, -1):\n if i == -1:\n print(maxpoint)\n exit()\n t = b[i][0]\n d = b[i][1]\n if f[t] > 1:\n f[t] -= 1\n point -= d\n h = i - 1\n break\n maxpoint = max(maxpoint, point + x * x)\nprint(maxpoint)\n","code_v1_no_empty_lines":"from sys import exit\n\nN, K = list(map(int, input().split()))\nb = [] # [[\u7a2e\u985e,\u7f8e\u5473\u3057\u3055],...]\nfor _ in range(N):\n t, d = list(map(int, input().split()))\n b.append([t, d])\nb.sort(key=lambda x: -x[1])\nf = [0] * (N + 1)\nx = 0\npoint = 0\nfor [t, d] in b[:K]:\n if f[t] == 0:\n x += 1\n f[t] += 1\n point += d\nmaxpoint = point + x * x\nh = K - 1\nfor [t, d] in b[K:]:\n if f[t] == 0:\n f[t] = 1\n x += 1\n point += d\n for i in range(h, -2, -1):\n if i == -1:\n print(maxpoint)\n exit()\n t = b[i][0]\n d = b[i][1]\n if f[t] > 1:\n f[t] -= 1\n point -= d\n h = i - 1\n break\n maxpoint = max(maxpoint, point + x * x)\nprint(maxpoint)\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-a = {} # {\u7a2e\u985e:\u7f8e\u5473\u3057\u3055}","- try:","- a[t].append(d)","- except KeyError:","- a[t] = [d]","-pointsum = []"],"diff_only_import_comment":false,"measured_runtime_v0":0.0380619593,"measured_runtime_v1":0.0369794562,"runtime_lift":1.0292730933,"key":["s054200921","s032750441"]} +{"user_id":"u886545507","problem_id":"p02813","language":"python","submission_id_v0":"s366241504","submission_id_v1":"s162499412","cpu_time_v0":27,"cpu_time_v1":20,"memory_v0":8052,"memory_v1":7920,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.93,"input":"#abc150c\n\nfrom itertools import *\n\n\n\nn=int(eval(input()))\n\np=tuple(map(int,input().split()))\n\nq=tuple(map(int,input().split()))\n\nl=list(permutations(list(range(1,n+1))))\n\nprint((abs(l.index(p)-l.index(q))))\n","target":"#abc150c\n\nfrom itertools import *\n\n\n\nn=int(input())\n\np=tuple(map(int,input().split()))\n\nq=tuple(map(int,input().split()))\n\nl=list(permutations(list(range(1,n+1))))\n\nprint(abs(l.index(p)-l.index(q)))\n","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":193,"code_v1_num_chars":204,"code_v0_no_empty_lines":"# abc150c\nfrom itertools import *\n\nn = int(eval(input()))\np = tuple(map(int, input().split()))\nq = tuple(map(int, input().split()))\nl = list(permutations(list(range(1, n + 1))))\nprint((abs(l.index(p) - l.index(q))))\n","code_v1_no_empty_lines":"# abc150c\nfrom itertools import *\n\nn = int(input())\np = tuple(map(int, input().split()))\nq = tuple(map(int, input().split()))\nl = list(permutations(list(range(1, n + 1))))\nprint(abs(l.index(p) - l.index(q)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-n = int(eval(input()))","+n = int(input())","-print((abs(l.index(p) - l.index(q))))","+print(abs(l.index(p) - l.index(q)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0590977192,"measured_runtime_v1":0.0886441231,"runtime_lift":0.6666851353,"key":["s366241504","s162499412"]} +{"user_id":"u756829954","problem_id":"p03166","language":"python","submission_id_v0":"s260562762","submission_id_v1":"s334489414","cpu_time_v0":628,"cpu_time_v1":447,"memory_v0":65968,"memory_v1":23860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.82,"input":"import sys\n\n\n\n\n\ndef recursion_g(eges, length, f):\n\n if length[f] != -1:\n\n return length[f]\n\n memo = [0]\n\n for t in eges[f]:\n\n memo.append(recursion_g(eges, length, t) + 1)\n\n length[f] = max(memo)\n\n return length[f]\n\n\n\n\n\ndef p_g():\n\n sys.setrecursionlimit(10 ** 6)\n\n N, M = list(map(int, input().split()))\n\n edges = [[] for _ in range(N)]\n\n length = [-1] * N\n\n for _ in range(M):\n\n x, y = list(map(int, input().split()))\n\n edges[x - 1].append(y - 1)\n\n\n\n for i in range(N):\n\n recursion_g(edges, length, i)\n\n print((max(length)))\n\n\n\n\n\nif __name__ == '__main__':\n\n p_g()\n","target":"from collections import deque\n\n\n\n\n\ndef p_g_dp():\n\n N, M = list(map(int, input().split()))\n\n outs = [[] for _ in range(N)]\n\n ins = [0] * N\n\n for _ in range(M):\n\n f, t = list(map(int, input().split()))\n\n outs[f - 1].append(t - 1)\n\n ins[t - 1] += 1\n\n q = deque(t for t in range(N) if ins[t] == 0)\n\n res = []\n\n dp = [0] * N\n\n while q:\n\n f = q.popleft()\n\n res.append(f)\n\n for t in outs[f]:\n\n ins[t] -= 1\n\n if ins[t] == 0:\n\n q.append(t)\n\n dp[t] = max(dp[t], dp[f] + 1)\n\n print((max(dp)))\n\n\n\n\n\nif __name__ == '__main__':\n\n p_g_dp()\n","code_v0_loc":29,"code_v1_loc":27,"code_v0_num_chars":627,"code_v1_num_chars":635,"code_v0_no_empty_lines":"import sys\n\n\ndef recursion_g(eges, length, f):\n if length[f] != -1:\n return length[f]\n memo = [0]\n for t in eges[f]:\n memo.append(recursion_g(eges, length, t) + 1)\n length[f] = max(memo)\n return length[f]\n\n\ndef p_g():\n sys.setrecursionlimit(10**6)\n N, M = list(map(int, input().split()))\n edges = [[] for _ in range(N)]\n length = [-1] * N\n for _ in range(M):\n x, y = list(map(int, input().split()))\n edges[x - 1].append(y - 1)\n for i in range(N):\n recursion_g(edges, length, i)\n print((max(length)))\n\n\nif __name__ == \"__main__\":\n p_g()\n","code_v1_no_empty_lines":"from collections import deque\n\n\ndef p_g_dp():\n N, M = list(map(int, input().split()))\n outs = [[] for _ in range(N)]\n ins = [0] * N\n for _ in range(M):\n f, t = list(map(int, input().split()))\n outs[f - 1].append(t - 1)\n ins[t - 1] += 1\n q = deque(t for t in range(N) if ins[t] == 0)\n res = []\n dp = [0] * N\n while q:\n f = q.popleft()\n res.append(f)\n for t in outs[f]:\n ins[t] -= 1\n if ins[t] == 0:\n q.append(t)\n dp[t] = max(dp[t], dp[f] + 1)\n print((max(dp)))\n\n\nif __name__ == \"__main__\":\n p_g_dp()\n","code_same":false,"relative_loc_diff_percent":6.8965517241,"diff":["-import sys","+from collections import deque","-def recursion_g(eges, length, f):","- if length[f] != -1:","- return length[f]","- memo = [0]","- for t in eges[f]:","- memo.append(recursion_g(eges, length, t) + 1)","- length[f] = max(memo)","- return length[f]","-","-","-def p_g():","- sys.setrecursionlimit(10**6)","+def p_g_dp():","- edges = [[] for _ in range(N)]","- length = [-1] * N","+ outs = [[] for _ in range(N)]","+ ins = [0] * N","- x, y = list(map(int, input().split()))","- edges[x - 1].append(y - 1)","- for i in range(N):","- recursion_g(edges, length, i)","- print((max(length)))","+ f, t = list(map(int, input().split()))","+ outs[f - 1].append(t - 1)","+ ins[t - 1] += 1","+ q = deque(t for t in range(N) if ins[t] == 0)","+ res = []","+ dp = [0] * N","+ while q:","+ f = q.popleft()","+ res.append(f)","+ for t in outs[f]:","+ ins[t] -= 1","+ if ins[t] == 0:","+ q.append(t)","+ dp[t] = max(dp[t], dp[f] + 1)","+ print((max(dp)))","- p_g()","+ p_g_dp()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0672086132,"measured_runtime_v1":0.0376465838,"runtime_lift":1.7852513127,"key":["s260562762","s334489414"]} +{"user_id":"u019678978","problem_id":"p02397","language":"python","submission_id_v0":"s712325390","submission_id_v1":"s523693016","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":7752,"memory_v1":7840,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"import sys\n\nwhile True :\n\n a,b = list(map(int, sys.stdin.readline().split()))\n\n if a == 0 and b == 0 :\n\n break\n\n elif a > b :\n\n print((b,a))\n\n else :\n\n print((a,b))","target":"import sys\n\nwhile True :\n\n a,b = sys.stdin.readline().split()\n\n a = int(a)\n\n b = int(b)\n\n if a == 0 and b == 0 :\n\n break\n\n elif a > b :\n\n print((b,a))\n\n else :\n\n print((a,b))","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":187,"code_v1_num_chars":209,"code_v0_no_empty_lines":"import sys\n\nwhile True:\n a, b = list(map(int, sys.stdin.readline().split()))\n if a == 0 and b == 0:\n break\n elif a > b:\n print((b, a))\n else:\n print((a, b))\n","code_v1_no_empty_lines":"import sys\n\nwhile True:\n a, b = sys.stdin.readline().split()\n a = int(a)\n b = int(b)\n if a == 0 and b == 0:\n break\n elif a > b:\n print((b, a))\n else:\n print((a, b))\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["- a, b = list(map(int, sys.stdin.readline().split()))","+ a, b = sys.stdin.readline().split()","+ a = int(a)","+ b = int(b)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422447913,"measured_runtime_v1":0.0404798613,"runtime_lift":1.0436001988,"key":["s712325390","s523693016"]} +{"user_id":"u116038906","problem_id":"p02725","language":"python","submission_id_v0":"s323820309","submission_id_v1":"s299906800","cpu_time_v0":135,"cpu_time_v1":108,"memory_v0":24600,"memory_v1":26444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"# \u521d\u671f\u5165\u529b\n\nK,N = (int(x) for x in input().split(\" \"))\n\nA = [0]\n\nfor i in input().split():\n\n if i !=\"0\":\n\n A.append( int(i) )\n\n\n\n# 1\u8ed2\u305a\u3064\u8ddd\u96e2\u306e\u30ea\u30b9\u30c8\n\nx =[A[i+1] - A[i] for i,v in enumerate(A[:-1]) ]\n\nif N == len(A):\n\n x.append(K -A[-1])\n\nelse:\n\n x.append(K - A[-1] +A[1])\n\n\n\n#\u3000\u6c42\u3081\u308b\u306e\u306f\u3000K\u3000\uff0d\u3000max(\u96a3\u3068\u96e2\u308c\u305f\u5bb6\u306e\u8ddd\u96e2)\n\nkyori_min = K - max(x)\n\nprint(kyori_min)","target":"# \u521d\u671f\u5165\u529b\n\nK,N = (int(x) for x in input().split(\" \"))\n\nA = list(map(int, input().split()))\n\nA.append(0) # \u57fa\u6e96\u5730\u70b9\u3092\u6700\u5f8c\u306b\u8ffd\u52a0\u3001\u30b9\u30bf\u30fc\u30c8\u304c\uff10\u3067\u3082\u3046\u307e\u304f\u3044\u304f\n\n\n\n# 1\u4ef6\u3068\u306a\u308a\u307e\u3067\u306e\u8ddd\u96e2\n\nkyori = [ A[i+1] -A[i] for i,v in enumerate(A[:-1]) ]\n\nkyori[-1] = kyori[-1] + K # n\u756a\u76ee\u304b\u3089\u57fa\u6e96\u307e\u3067\u306f\u5168\u4f53\u304b\u3089\u300c\u5f15\u304f\u300d\n\nkyori.append(A[0] -A[-1] ) # \u57fa\u6e96\u304b\u30891\u756a\u76ee\u307e\u3067\u306e\u8ddd\u96e2\n\nx_saisyo_saigo = kyori[-2] +kyori[-1]\n\nkyori.append(x_saisyo_saigo) # n\u756a\u76ee\u304b\u30891\u756a\u76ee\u306e\u8ddd\u96e2\n\n\n\n# \u6700\u77ed\u8ddd\u96e2\u306f\u3001\u5168\u4f53\u304b\u3089max(\u96a3\u306e\u5bb6\u3068\u306e\u8ddd\u96e2)\u3092\u5f15\u304f\n\nkyori_min = K - max(kyori)\n\nprint(kyori_min)","code_v0_loc":17,"code_v1_loc":15,"code_v0_num_chars":348,"code_v1_num_chars":449,"code_v0_no_empty_lines":"# \u521d\u671f\u5165\u529b\nK, N = (int(x) for x in input().split(\" \"))\nA = [0]\nfor i in input().split():\n if i != \"0\":\n A.append(int(i))\n# 1\u8ed2\u305a\u3064\u8ddd\u96e2\u306e\u30ea\u30b9\u30c8\nx = [A[i + 1] - A[i] for i, v in enumerate(A[:-1])]\nif N == len(A):\n x.append(K - A[-1])\nelse:\n x.append(K - A[-1] + A[1])\n# \u3000\u6c42\u3081\u308b\u306e\u306f\u3000K\u3000\uff0d\u3000max(\u96a3\u3068\u96e2\u308c\u305f\u5bb6\u306e\u8ddd\u96e2)\nkyori_min = K - max(x)\nprint(kyori_min)\n","code_v1_no_empty_lines":"# \u521d\u671f\u5165\u529b\nK, N = (int(x) for x in input().split(\" \"))\nA = list(map(int, input().split()))\nA.append(0) # \u57fa\u6e96\u5730\u70b9\u3092\u6700\u5f8c\u306b\u8ffd\u52a0\u3001\u30b9\u30bf\u30fc\u30c8\u304c\uff10\u3067\u3082\u3046\u307e\u304f\u3044\u304f\n# 1\u4ef6\u3068\u306a\u308a\u307e\u3067\u306e\u8ddd\u96e2\nkyori = [A[i + 1] - A[i] for i, v in enumerate(A[:-1])]\nkyori[-1] = kyori[-1] + K # n\u756a\u76ee\u304b\u3089\u57fa\u6e96\u307e\u3067\u306f\u5168\u4f53\u304b\u3089\u300c\u5f15\u304f\u300d\nkyori.append(A[0] - A[-1]) # \u57fa\u6e96\u304b\u30891\u756a\u76ee\u307e\u3067\u306e\u8ddd\u96e2\nx_saisyo_saigo = kyori[-2] + kyori[-1]\nkyori.append(x_saisyo_saigo) # n\u756a\u76ee\u304b\u30891\u756a\u76ee\u306e\u8ddd\u96e2\n# \u6700\u77ed\u8ddd\u96e2\u306f\u3001\u5168\u4f53\u304b\u3089max(\u96a3\u306e\u5bb6\u3068\u306e\u8ddd\u96e2)\u3092\u5f15\u304f\nkyori_min = K - max(kyori)\nprint(kyori_min)\n","code_same":false,"relative_loc_diff_percent":11.7647058824,"diff":["-A = [0]","-for i in input().split():","- if i != \"0\":","- A.append(int(i))","-# 1\u8ed2\u305a\u3064\u8ddd\u96e2\u306e\u30ea\u30b9\u30c8","-x = [A[i + 1] - A[i] for i, v in enumerate(A[:-1])]","-if N == len(A):","- x.append(K - A[-1])","-else:","- x.append(K - A[-1] + A[1])","-# \u3000\u6c42\u3081\u308b\u306e\u306f\u3000K\u3000\uff0d\u3000max(\u96a3\u3068\u96e2\u308c\u305f\u5bb6\u306e\u8ddd\u96e2)","-kyori_min = K - max(x)","+A = list(map(int, input().split()))","+A.append(0) # \u57fa\u6e96\u5730\u70b9\u3092\u6700\u5f8c\u306b\u8ffd\u52a0\u3001\u30b9\u30bf\u30fc\u30c8\u304c\uff10\u3067\u3082\u3046\u307e\u304f\u3044\u304f","+# 1\u4ef6\u3068\u306a\u308a\u307e\u3067\u306e\u8ddd\u96e2","+kyori = [A[i + 1] - A[i] for i, v in enumerate(A[:-1])]","+kyori[-1] = kyori[-1] + K # n\u756a\u76ee\u304b\u3089\u57fa\u6e96\u307e\u3067\u306f\u5168\u4f53\u304b\u3089\u300c\u5f15\u304f\u300d","+kyori.append(A[0] - A[-1]) # \u57fa\u6e96\u304b\u30891\u756a\u76ee\u307e\u3067\u306e\u8ddd\u96e2","+x_saisyo_saigo = kyori[-2] + kyori[-1]","+kyori.append(x_saisyo_saigo) # n\u756a\u76ee\u304b\u30891\u756a\u76ee\u306e\u8ddd\u96e2","+# \u6700\u77ed\u8ddd\u96e2\u306f\u3001\u5168\u4f53\u304b\u3089max(\u96a3\u306e\u5bb6\u3068\u306e\u8ddd\u96e2)\u3092\u5f15\u304f","+kyori_min = K - max(kyori)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0388927182,"measured_runtime_v1":0.0634883951,"runtime_lift":0.6125957046,"key":["s323820309","s299906800"]} +{"user_id":"u761320129","problem_id":"p03680","language":"python","submission_id_v0":"s029906980","submission_id_v1":"s518517237","cpu_time_v0":687,"cpu_time_v1":192,"memory_v0":9092,"memory_v1":7084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.05,"input":"N = eval(input())\n\narr = [eval(input())-1 for i in range(N)]\n\n\n\nnow = 0\n\ncount = 0\n\nwhile (now != 1):\n\n count += 1\n\n now = arr[now]\n\n if count > 100000:\n\n count = -1\n\n break\n\nprint(count)\n","target":"N = int(eval(input()))\n\nsrc = [int(eval(input())) for i in range(N)]\n\nnow = 0\n\nfor i in range(N):\n\n a = src[now] - 1\n\n if a == 1:\n\n print((i+1))\n\n exit()\n\n now = a\n\nprint((-1))","code_v0_loc":12,"code_v1_loc":10,"code_v0_num_chars":198,"code_v1_num_chars":183,"code_v0_no_empty_lines":"N = eval(input())\narr = [eval(input()) - 1 for i in range(N)]\nnow = 0\ncount = 0\nwhile now != 1:\n count += 1\n now = arr[now]\n if count > 100000:\n count = -1\n break\nprint(count)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nsrc = [int(eval(input())) for i in range(N)]\nnow = 0\nfor i in range(N):\n a = src[now] - 1\n if a == 1:\n print((i + 1))\n exit()\n now = a\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-N = eval(input())","-arr = [eval(input()) - 1 for i in range(N)]","+N = int(eval(input()))","+src = [int(eval(input())) for i in range(N)]","-count = 0","-while now != 1:","- count += 1","- now = arr[now]","- if count > 100000:","- count = -1","- break","-print(count)","+for i in range(N):","+ a = src[now] - 1","+ if a == 1:","+ print((i + 1))","+ exit()","+ now = a","+print((-1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0843798532,"measured_runtime_v1":0.0373281894,"runtime_lift":2.2604861003,"key":["s029906980","s518517237"]} +{"user_id":"u588341295","problem_id":"p02972","language":"python","submission_id_v0":"s042149579","submission_id_v1":"s953790445","cpu_time_v0":922,"cpu_time_v1":317,"memory_v0":70120,"memory_v1":67176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.62,"input":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\nfrom math import sqrt\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\ndef divisor_set(N: int) -> set:\n\n \"\"\" \u7d04\u6570\u306e\u5217\u6319\u30fb\u500b\u6570 \"\"\"\n\n # 1\u3068\u305d\u306e\u6570\u306f\u30c7\u30d5\u30a9\u3067\u5165\u308c\u3068\u304f\n\n s = {1, N}\n\n # \u7d42\u70b9\u306f\u30eb\u30fc\u30c8\u5207\u308a\u6368\u3066\n\n for i in range(2, int(sqrt(N))+1):\n\n # \u5272\u308a\u5207\u308c\u308b\u306a\u3089\u3001i\u3068N\/i\u3092\u8ffd\u52a0\n\n if N % i == 0:\n\n s.add(i)\n\n s.add(N \/\/ i)\n\n return s\n\n\n\nN=INT()\n\nA=LIST()\n\n\n\nA2=[0]*N\n\nB=[]\n\nfor i in range(N-1, -1, -1):\n\n if A[i]!=A2[i]:\n\n B.append(i+1)\n\n div=divisor_set(i+1)\n\n for num in div:\n\n A2[num-1]=1-A2[num-1]\n\n \n\nprint((len(B)))\n\nprint((*B))\n","target":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nN=INT()\n\nA=LIST()\n\n\n\n# \u305d\u306e\u4f4d\u7f6e\u306b\u30dc\u30fc\u30eb\u3092\u5165\u308c\u308b\u304b\u3092\u4fdd\u6301\u3059\u308bA2\n\nA2=[0]*N\n\nB=[]\n\n# \u5f8c\u308d\u304b\u3089\u6c7a\u3081\u3066\u3044\u304f\n\nfor i in range(N-1, -1, -1):\n\n cur=i+1\n\n cnt=0\n\n # cur\u306e\u500d\u6570\u3092\u5168\u90e8\u898b\u306b\u884c\u304f\n\n for j in range(cur*2, N+1, cur):\n\n cnt^=A2[j-1]\n\n # \u30dc\u30fc\u30eb\u3092\u5165\u308c\u308b\u3079\u304d\u304b\u3069\u3046\u304b\n\n if A[i]!=cnt:\n\n B.append(cur)\n\n A2[i]=1\n\n\n\nprint((len(B)))\n\nprint((*B))\n","code_v0_loc":46,"code_v1_loc":39,"code_v0_num_chars":1095,"code_v1_num_chars":884,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\nfrom math import sqrt\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x \/\/ y))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef divisor_set(N: int) -> set:\n \"\"\"\u7d04\u6570\u306e\u5217\u6319\u30fb\u500b\u6570\"\"\"\n # 1\u3068\u305d\u306e\u6570\u306f\u30c7\u30d5\u30a9\u3067\u5165\u308c\u3068\u304f\n s = {1, N}\n # \u7d42\u70b9\u306f\u30eb\u30fc\u30c8\u5207\u308a\u6368\u3066\n for i in range(2, int(sqrt(N)) + 1):\n # \u5272\u308a\u5207\u308c\u308b\u306a\u3089\u3001i\u3068N\/i\u3092\u8ffd\u52a0\n if N % i == 0:\n s.add(i)\n s.add(N \/\/ i)\n return s\n\n\nN = INT()\nA = LIST()\nA2 = [0] * N\nB = []\nfor i in range(N - 1, -1, -1):\n if A[i] != A2[i]:\n B.append(i + 1)\n div = divisor_set(i + 1)\n for num in div:\n A2[num - 1] = 1 - A2[num - 1]\nprint((len(B)))\nprint((*B))\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x \/\/ y))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nMOD = 10**9 + 7\nN = INT()\nA = LIST()\n# \u305d\u306e\u4f4d\u7f6e\u306b\u30dc\u30fc\u30eb\u3092\u5165\u308c\u308b\u304b\u3092\u4fdd\u6301\u3059\u308bA2\nA2 = [0] * N\nB = []\n# \u5f8c\u308d\u304b\u3089\u6c7a\u3081\u3066\u3044\u304f\nfor i in range(N - 1, -1, -1):\n cur = i + 1\n cnt = 0\n # cur\u306e\u500d\u6570\u3092\u5168\u90e8\u898b\u306b\u884c\u304f\n for j in range(cur * 2, N + 1, cur):\n cnt ^= A2[j - 1]\n # \u30dc\u30fc\u30eb\u3092\u5165\u308c\u308b\u3079\u304d\u304b\u3069\u3046\u304b\n if A[i] != cnt:\n B.append(cur)\n A2[i] = 1\nprint((len(B)))\nprint((*B))\n","code_same":false,"relative_loc_diff_percent":15.2173913043,"diff":["-from math import sqrt","-","-","-def divisor_set(N: int) -> set:","- \"\"\"\u7d04\u6570\u306e\u5217\u6319\u30fb\u500b\u6570\"\"\"","- # 1\u3068\u305d\u306e\u6570\u306f\u30c7\u30d5\u30a9\u3067\u5165\u308c\u3068\u304f","- s = {1, N}","- # \u7d42\u70b9\u306f\u30eb\u30fc\u30c8\u5207\u308a\u6368\u3066","- for i in range(2, int(sqrt(N)) + 1):","- # \u5272\u308a\u5207\u308c\u308b\u306a\u3089\u3001i\u3068N\/i\u3092\u8ffd\u52a0","- if N % i == 0:","- s.add(i)","- s.add(N \/\/ i)","- return s","-","-","+# \u305d\u306e\u4f4d\u7f6e\u306b\u30dc\u30fc\u30eb\u3092\u5165\u308c\u308b\u304b\u3092\u4fdd\u6301\u3059\u308bA2","+# \u5f8c\u308d\u304b\u3089\u6c7a\u3081\u3066\u3044\u304f","- if A[i] != A2[i]:","- B.append(i + 1)","- div = divisor_set(i + 1)","- for num in div:","- A2[num - 1] = 1 - A2[num - 1]","+ cur = i + 1","+ cnt = 0","+ # cur\u306e\u500d\u6570\u3092\u5168\u90e8\u898b\u306b\u884c\u304f","+ for j in range(cur * 2, N + 1, cur):","+ cnt ^= A2[j - 1]","+ # \u30dc\u30fc\u30eb\u3092\u5165\u308c\u308b\u3079\u304d\u304b\u3069\u3046\u304b","+ if A[i] != cnt:","+ B.append(cur)","+ A2[i] = 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373895382,"measured_runtime_v1":0.0351194585,"runtime_lift":1.0646387996,"key":["s042149579","s953790445"]} +{"user_id":"u366185462","problem_id":"p02887","language":"python","submission_id_v0":"s132191607","submission_id_v1":"s526201606","cpu_time_v0":57,"cpu_time_v1":43,"memory_v0":4212,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.56,"input":"n = int(eval(input()))\n\ns = str(eval(input()))\n\nslist = []\n\nfor i in range(n):\n\n slist.append(s[i])\n\nslime = slist[0]\n\ncount = 1\n\nfor i in range(1, n):\n\n if slime != slist[i]:\n\n count += 1\n\n slime = slist[i]\n\nprint(count)","target":"n = int(eval(input()))\n\ns = str(eval(input()))\n\nslime = s[0]\n\ncount = 1\n\nfor i in range(1, n):\n\n if slime != s[i]:\n\n count += 1\n\n slime = s[i]\n\nprint(count)","code_v0_loc":12,"code_v1_loc":9,"code_v0_num_chars":217,"code_v1_num_chars":151,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = str(eval(input()))\nslist = []\nfor i in range(n):\n slist.append(s[i])\nslime = slist[0]\ncount = 1\nfor i in range(1, n):\n if slime != slist[i]:\n count += 1\n slime = slist[i]\nprint(count)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = str(eval(input()))\nslime = s[0]\ncount = 1\nfor i in range(1, n):\n if slime != s[i]:\n count += 1\n slime = s[i]\nprint(count)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-slist = []","-for i in range(n):","- slist.append(s[i])","-slime = slist[0]","+slime = s[0]","- if slime != slist[i]:","+ if slime != s[i]:","- slime = slist[i]","+ slime = s[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0377181652,"measured_runtime_v1":0.0377405767,"runtime_lift":0.9994061671,"key":["s132191607","s526201606"]} +{"user_id":"u807028974","problem_id":"p03315","language":"python","submission_id_v0":"s219017235","submission_id_v1":"s557941053","cpu_time_v0":179,"cpu_time_v1":18,"memory_v0":38636,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.94,"input":"import math\n\nimport queue\n\nimport bisect\n\nimport heapq\n\nimport time\n\nimport itertools\n\n\n\nmod = int(1e9+7)\n\n\n\ndef swap(a,b):\n\n return (b,a)\n\n\n\ndef my_round(a,dig=0):\n\n p = 10 ** dig\n\n return (a * p * 2 + 1) \/\/ 2 \/ p\n\n\n\ndef gcd(a,b): #\u6700\u5927\u516c\u7d04\u6570\n\n if (a 12):\n\n print('MMYY')\n\nelif (a == 0 or a > 12) and 0 < b <= 12:\n\n print('YYMM')\n\nelif 0 < a <= 12 and 0 < b <= 12:\n\n print('AMBIGUOUS')\n\nelse:\n\n print('NA')","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":262,"code_v1_num_chars":249,"code_v0_no_empty_lines":"S = eval(input())\na = S[:2]\nb = S[2:]\nif 1 <= int(a) <= 12 and 1 <= int(b) <= 12:\n print(\"AMBIGUOUS\")\nelif 0 <= int(a) <= 99 and 1 <= int(b) <= 12:\n print(\"YYMM\")\nelif 1 <= int(a) <= 12 and 0 <= int(b) <= 99:\n print(\"MMYY\")\nelse:\n print(\"NA\")\n","code_v1_no_empty_lines":"n = eval(input())\na = int(n[:2])\nb = int(n[2:])\nif 0 < a <= 12 and (b == 0 or b > 12):\n print(\"MMYY\")\nelif (a == 0 or a > 12) and 0 < b <= 12:\n print(\"YYMM\")\nelif 0 < a <= 12 and 0 < b <= 12:\n print(\"AMBIGUOUS\")\nelse:\n print(\"NA\")\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-S = eval(input())","-a = S[:2]","-b = S[2:]","-if 1 <= int(a) <= 12 and 1 <= int(b) <= 12:","+n = eval(input())","+a = int(n[:2])","+b = int(n[2:])","+if 0 < a <= 12 and (b == 0 or b > 12):","+ print(\"MMYY\")","+elif (a == 0 or a > 12) and 0 < b <= 12:","+ print(\"YYMM\")","+elif 0 < a <= 12 and 0 < b <= 12:","-elif 0 <= int(a) <= 99 and 1 <= int(b) <= 12:","- print(\"YYMM\")","-elif 1 <= int(a) <= 12 and 0 <= int(b) <= 99:","- print(\"MMYY\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.035737463,"measured_runtime_v1":0.0356263969,"runtime_lift":1.0031175225,"key":["s226933891","s392330768"]} +{"user_id":"u881590806","problem_id":"p02255","language":"python","submission_id_v0":"s942213976","submission_id_v1":"s479795756","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4224,"memory_v1":6296,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"n = int(input())\n\narr = list(map(int, input().split(' ')))\n\n\n\np = 1\n\nprint(' '.join(map(str, arr)))\n\nwhile True:\n\n if p >= len(arr):\n\n break\n\n for j in range(0,p):\n\n if arr[p] < arr[j]:\n\n arr[p],arr[j] = arr[j],arr[p]\n\n p += 1\n\n print(' '.join(map(str, arr)))","target":"def sort(a):\n\n n = len(a)\n\n for i in range(1,n):\n\n for j in range(i):\n\n p = i-j\n\n if a[p] < a[p-1]:\n\n a[p], a[p-1] = a[p-1], a[p]\n\n print(' '.join(map(str, a)))\n\n\n\nn = int(input())\n\na = list(map(int, input().split(' ')))\n\nprint(' '.join(map(str, a)))\n\nsort(a)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":296,"code_v1_num_chars":316,"code_v0_no_empty_lines":"n = int(input())\narr = list(map(int, input().split(\" \")))\np = 1\nprint(\" \".join(map(str, arr)))\nwhile True:\n if p >= len(arr):\n break\n for j in range(0, p):\n if arr[p] < arr[j]:\n arr[p], arr[j] = arr[j], arr[p]\n p += 1\n print(\" \".join(map(str, arr)))\n","code_v1_no_empty_lines":"def sort(a):\n n = len(a)\n for i in range(1, n):\n for j in range(i):\n p = i - j\n if a[p] < a[p - 1]:\n a[p], a[p - 1] = a[p - 1], a[p]\n print(\" \".join(map(str, a)))\n\n\nn = int(input())\na = list(map(int, input().split(\" \")))\nprint(\" \".join(map(str, a)))\nsort(a)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+def sort(a):","+ n = len(a)","+ for i in range(1, n):","+ for j in range(i):","+ p = i - j","+ if a[p] < a[p - 1]:","+ a[p], a[p - 1] = a[p - 1], a[p]","+ print(\" \".join(map(str, a)))","+","+","-arr = list(map(int, input().split(\" \")))","-p = 1","-print(\" \".join(map(str, arr)))","-while True:","- if p >= len(arr):","- break","- for j in range(0, p):","- if arr[p] < arr[j]:","- arr[p], arr[j] = arr[j], arr[p]","- p += 1","- print(\" \".join(map(str, arr)))","+a = list(map(int, input().split(\" \")))","+print(\" \".join(map(str, a)))","+sort(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0432980737,"measured_runtime_v1":0.0478533358,"runtime_lift":0.9048078462,"key":["s942213976","s479795756"]} +{"user_id":"u729133443","problem_id":"p02629","language":"python","submission_id_v0":"s392089836","submission_id_v1":"s744991466","cpu_time_v0":33,"cpu_time_v1":27,"memory_v0":9104,"memory_v1":9068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"n=int(eval(input()))\n\na=[]\n\nwhile n:\n\n a+=n%26,\n\n n\/\/=26\n\na=a[::-1]\n\nfor i in range(len(a)-1,0,-1):\n\n if a[i]<1:\n\n a[i]+=26\n\n a[i-1]-=1\n\nprint((''.join(chr(c+96)for c in a[not a[0]:])))","target":"n=int(input())\n\na=[]\n\nwhile n:\n\n a+=n%26+96,\n\n n\/\/=26\n\nfor i in range(len(a)-1):\n\n f=a[i]<97\n\n a[i]+=f*26\n\n a[i+1]-=f\n\nprint(*map(chr,a[::-1][a[-1]<97:]),sep='')\n","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":200,"code_v1_num_chars":176,"code_v0_no_empty_lines":"n = int(eval(input()))\na = []\nwhile n:\n a += (n % 26,)\n n \/\/= 26\na = a[::-1]\nfor i in range(len(a) - 1, 0, -1):\n if a[i] < 1:\n a[i] += 26\n a[i - 1] -= 1\nprint((\"\".join(chr(c + 96) for c in a[not a[0] :])))\n","code_v1_no_empty_lines":"n = int(input())\na = []\nwhile n:\n a += (n % 26 + 96,)\n n \/\/= 26\nfor i in range(len(a) - 1):\n f = a[i] < 97\n a[i] += f * 26\n a[i + 1] -= f\nprint(*map(chr, a[::-1][a[-1] < 97 :]), sep=\"\")\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-n = int(eval(input()))","+n = int(input())","- a += (n % 26,)","+ a += (n % 26 + 96,)","-a = a[::-1]","-for i in range(len(a) - 1, 0, -1):","- if a[i] < 1:","- a[i] += 26","- a[i - 1] -= 1","-print((\"\".join(chr(c + 96) for c in a[not a[0] :])))","+for i in range(len(a) - 1):","+ f = a[i] < 97","+ a[i] += f * 26","+ a[i + 1] -= f","+print(*map(chr, a[::-1][a[-1] < 97 :]), sep=\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0454624319,"measured_runtime_v1":0.0457815838,"runtime_lift":0.993028815,"key":["s392089836","s744991466"]} +{"user_id":"u691018832","problem_id":"p03325","language":"python","submission_id_v0":"s878092217","submission_id_v1":"s982516292","cpu_time_v0":147,"cpu_time_v1":96,"memory_v0":4148,"memory_v1":3956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.69,"input":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n):\n\n for j in range(30):\n\n if a[i]%2 == 0:\n\n a[i] \/= 2\n\n ans += 1\n\n else:\n\n break\n\nprint(ans)\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nn = int(readline())\n\na = list(map(int, readline().split()))\n\ncnt = 0\n\nfor aa in a:\n\n for i in range(aa):\n\n if aa % 2 == 0:\n\n cnt += 1\n\n aa \/\/= 2\n\n else:\n\n break\n\nprint(cnt)\n","code_v0_loc":11,"code_v1_loc":17,"code_v0_num_chars":224,"code_v1_num_chars":377,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nans = 0\nfor i in range(n):\n for j in range(30):\n if a[i] % 2 == 0:\n a[i] \/= 2\n ans += 1\n else:\n break\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**7)\nn = int(readline())\na = list(map(int, readline().split()))\ncnt = 0\nfor aa in a:\n for i in range(aa):\n if aa % 2 == 0:\n cnt += 1\n aa \/\/= 2\n else:\n break\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":35.2941176471,"diff":["-n = int(eval(input()))","-a = list(map(int, input().split()))","-ans = 0","-for i in range(n):","- for j in range(30):","- if a[i] % 2 == 0:","- a[i] \/= 2","- ans += 1","+import sys","+","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+sys.setrecursionlimit(10**7)","+n = int(readline())","+a = list(map(int, readline().split()))","+cnt = 0","+for aa in a:","+ for i in range(aa):","+ if aa % 2 == 0:","+ cnt += 1","+ aa \/\/= 2","-print(ans)","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0562290676,"measured_runtime_v1":0.0561441689,"runtime_lift":1.0015121553,"key":["s878092217","s982516292"]} +{"user_id":"u606045429","problem_id":"p02998","language":"python","submission_id_v0":"s584830648","submission_id_v1":"s882740263","cpu_time_v0":483,"cpu_time_v1":445,"memory_v0":38580,"memory_v1":38580,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.87,"input":"from collections import Counter\n\n\n\nclass UnionFind:\n\n def __init__(self, size):\n\n self.data = [-1] * size\n\n\n\n def find(self, x):\n\n if self.data[x] < 0:\n\n return x\n\n else:\n\n self.data[x] = self.find(self.data[x])\n\n return self.data[x]\n\n\n\n def union(self, x, y):\n\n x, y = self.find(x), self.find(y)\n\n if x != y:\n\n if self.data[y] < self.data[x]:\n\n x, y = y, x\n\n self.data[x] += self.data[y]\n\n self.data[y] = x\n\n return (x != y)\n\n\n\n def same(self, x, y):\n\n return (self.find(x) == self.find(y))\n\n\n\n def size(self, x):\n\n return -self.data[self.find(x)]\n\n\n\n\n\nMAX = 10 ** 5 + 10\n\nuf = UnionFind(2 * MAX)\n\n\n\nN, *XY = list(map(int, open(0).read().split()))\n\n\n\nfor x, y in zip(*[iter(XY)] * 2):\n\n uf.union(x, y + MAX)\n\n\n\nX = Counter(uf.find(i) for i in range(MAX))\n\nY = Counter(uf.find(i) for i in range(MAX, MAX * 2))\n\nres = sum(X[i] * Y[i] for i in range(MAX * 2))\n\n\n\nprint((res - N))\n","target":"from collections import Counter\n\n\n\n\n\nclass UnionFind:\n\n def __init__(self, size):\n\n self.data = [-1] * size\n\n\n\n def find(self, x):\n\n if self.data[x] < 0:\n\n return x\n\n else:\n\n self.data[x] = self.find(self.data[x])\n\n return self.data[x]\n\n\n\n def union(self, x, y):\n\n x, y = self.find(x), self.find(y)\n\n if x != y:\n\n if self.data[y] < self.data[x]:\n\n x, y = y, x\n\n self.data[x] += self.data[y]\n\n self.data[y] = x\n\n return (x != y)\n\n\n\n def same(self, x, y):\n\n return (self.find(x) == self.find(y))\n\n\n\n def size(self, x):\n\n return -self.data[self.find(x)]\n\n\n\n\n\ndef main():\n\n MAX = 10 ** 5 + 1\n\n uf = UnionFind(2 * MAX)\n\n\n\n N, *XY = list(map(int, open(0).read().split()))\n\n\n\n for x, y in zip(*[iter(XY)] * 2):\n\n uf.union(x, y + MAX)\n\n\n\n X = Counter(uf.find(i) for i in range(MAX))\n\n Y = Counter(uf.find(i) for i in range(MAX, MAX * 2))\n\n res = sum(X[i] * Y[i] for i in range(MAX * 2))\n\n\n\n print((res - N))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":42,"code_v1_loc":48,"code_v0_num_chars":1025,"code_v1_num_chars":1119,"code_v0_no_empty_lines":"from collections import Counter\n\n\nclass UnionFind:\n def __init__(self, size):\n self.data = [-1] * size\n\n def find(self, x):\n if self.data[x] < 0:\n return x\n else:\n self.data[x] = self.find(self.data[x])\n return self.data[x]\n\n def union(self, x, y):\n x, y = self.find(x), self.find(y)\n if x != y:\n if self.data[y] < self.data[x]:\n x, y = y, x\n self.data[x] += self.data[y]\n self.data[y] = x\n return x != y\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def size(self, x):\n return -self.data[self.find(x)]\n\n\nMAX = 10**5 + 10\nuf = UnionFind(2 * MAX)\nN, *XY = list(map(int, open(0).read().split()))\nfor x, y in zip(*[iter(XY)] * 2):\n uf.union(x, y + MAX)\nX = Counter(uf.find(i) for i in range(MAX))\nY = Counter(uf.find(i) for i in range(MAX, MAX * 2))\nres = sum(X[i] * Y[i] for i in range(MAX * 2))\nprint((res - N))\n","code_v1_no_empty_lines":"from collections import Counter\n\n\nclass UnionFind:\n def __init__(self, size):\n self.data = [-1] * size\n\n def find(self, x):\n if self.data[x] < 0:\n return x\n else:\n self.data[x] = self.find(self.data[x])\n return self.data[x]\n\n def union(self, x, y):\n x, y = self.find(x), self.find(y)\n if x != y:\n if self.data[y] < self.data[x]:\n x, y = y, x\n self.data[x] += self.data[y]\n self.data[y] = x\n return x != y\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def size(self, x):\n return -self.data[self.find(x)]\n\n\ndef main():\n MAX = 10**5 + 1\n uf = UnionFind(2 * MAX)\n N, *XY = list(map(int, open(0).read().split()))\n for x, y in zip(*[iter(XY)] * 2):\n uf.union(x, y + MAX)\n X = Counter(uf.find(i) for i in range(MAX))\n Y = Counter(uf.find(i) for i in range(MAX, MAX * 2))\n res = sum(X[i] * Y[i] for i in range(MAX * 2))\n print((res - N))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-MAX = 10**5 + 10","-uf = UnionFind(2 * MAX)","-N, *XY = list(map(int, open(0).read().split()))","-for x, y in zip(*[iter(XY)] * 2):","- uf.union(x, y + MAX)","-X = Counter(uf.find(i) for i in range(MAX))","-Y = Counter(uf.find(i) for i in range(MAX, MAX * 2))","-res = sum(X[i] * Y[i] for i in range(MAX * 2))","-print((res - N))","+def main():","+ MAX = 10**5 + 1","+ uf = UnionFind(2 * MAX)","+ N, *XY = list(map(int, open(0).read().split()))","+ for x, y in zip(*[iter(XY)] * 2):","+ uf.union(x, y + MAX)","+ X = Counter(uf.find(i) for i in range(MAX))","+ Y = Counter(uf.find(i) for i in range(MAX, MAX * 2))","+ res = sum(X[i] * Y[i] for i in range(MAX * 2))","+ print((res - N))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3395468869,"measured_runtime_v1":0.3095779965,"runtime_lift":1.0968056217,"key":["s584830648","s882740263"]} +{"user_id":"u977389981","problem_id":"p02999","language":"python","submission_id_v0":"s183015526","submission_id_v1":"s605986819","cpu_time_v0":196,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.33,"input":"X, A = list(map(int, input().split()))\n\nprint((0 if X < A else 10))","target":"X, A = list(map(int, input().split()))\n\nif X < A:\n\n print((0))\n\nelse:\n\n print((10))","code_v0_loc":2,"code_v1_loc":5,"code_v0_num_chars":59,"code_v1_num_chars":79,"code_v0_no_empty_lines":"X, A = list(map(int, input().split()))\nprint((0 if X < A else 10))\n","code_v1_no_empty_lines":"X, A = list(map(int, input().split()))\nif X < A:\n print((0))\nelse:\n print((10))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-print((0 if X < A else 10))","+if X < A:","+ print((0))","+else:","+ print((10))"],"diff_only_import_comment":false,"measured_runtime_v0":0.044852529,"measured_runtime_v1":0.0412468584,"runtime_lift":1.0874168561,"key":["s183015526","s605986819"]} +{"user_id":"u089116225","problem_id":"p00773","language":"python","submission_id_v0":"s208126180","submission_id_v1":"s672821513","cpu_time_v0":8000,"cpu_time_v1":6970,"memory_v0":5640,"memory_v1":5640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.88,"input":"from time import time\n\n\n\ndef change(before_tax,after_tax,previous_price):\n\n #change z from taxrate x to taxrate y\n\n original_price = 0\n\n for i in range(1, previous_price+1):\n\n if i * (100 + before_tax) \/\/ 100 == previous_price:\n\n original_price = i\n\n break\n\n else:\n\n pass\n\n return original_price * (100 + after_tax) \/\/ 100\n\n\n\n#l = []\n\n\n\nwhile True:\n\n x,y,s = [int(x) for x in input().split()]\n\n if x == 0:\n\n break\n\n else:\n\n ans = 0\n\n for i in range(1,s):\n\n price1, price2 = i, s - i\n\n afterprice = change(x,y,price1) + change(x,y,price2)\n\n if afterprice > ans:\n\n ans = afterprice\n\n else:\n\n continue\n\n #l.append(ans)\n\n print(ans)\n\n'''\n\nfor x in l:\n\n print(x)\n\n'''\n","target":"def change(before_tax,after_tax,previous_price):\n\n original_price = 0\n\n for i in range(1, previous_price+1):\n\n if i * (100 + before_tax) \/\/ 100 == previous_price:\n\n original_price = i\n\n break\n\n else:\n\n pass\n\n return original_price * (100 + after_tax) \/\/ 100\n\n\n\nans_list = []\n\n\n\nwhile True:\n\n x,y,s = [int(x) for x in input().split()]\n\n if x == 0:\n\n break\n\n else:\n\n ans = 0\n\n for i in range(1,s):\n\n price1, price2 = i, s - i\n\n afterprice = change(x,y,price1) + change(x,y,price2)\n\n if afterprice > ans:\n\n ans = afterprice\n\n else:\n\n continue\n\n ans_list.append(ans)\n\n\n\nfor x in ans_list:\n\n print(x)\n","code_v0_loc":34,"code_v1_loc":29,"code_v0_num_chars":843,"code_v1_num_chars":766,"code_v0_no_empty_lines":"from time import time\n\n\ndef change(before_tax, after_tax, previous_price):\n # change z from taxrate x to taxrate y\n original_price = 0\n for i in range(1, previous_price + 1):\n if i * (100 + before_tax) \/\/ 100 == previous_price:\n original_price = i\n break\n else:\n pass\n return original_price * (100 + after_tax) \/\/ 100\n\n\n# l = []\nwhile True:\n x, y, s = [int(x) for x in input().split()]\n if x == 0:\n break\n else:\n ans = 0\n for i in range(1, s):\n price1, price2 = i, s - i\n afterprice = change(x, y, price1) + change(x, y, price2)\n if afterprice > ans:\n ans = afterprice\n else:\n continue\n # l.append(ans)\n print(ans)\n\"\"\"\nfor x in l:\n print(x)\n\"\"\"\n","code_v1_no_empty_lines":"def change(before_tax, after_tax, previous_price):\n original_price = 0\n for i in range(1, previous_price + 1):\n if i * (100 + before_tax) \/\/ 100 == previous_price:\n original_price = i\n break\n else:\n pass\n return original_price * (100 + after_tax) \/\/ 100\n\n\nans_list = []\nwhile True:\n x, y, s = [int(x) for x in input().split()]\n if x == 0:\n break\n else:\n ans = 0\n for i in range(1, s):\n price1, price2 = i, s - i\n afterprice = change(x, y, price1) + change(x, y, price2)\n if afterprice > ans:\n ans = afterprice\n else:\n continue\n ans_list.append(ans)\nfor x in ans_list:\n print(x)\n","code_same":false,"relative_loc_diff_percent":14.7058823529,"diff":["-from time import time","-","-","- # change z from taxrate x to taxrate y","-# l = []","+ans_list = []","- # l.append(ans)","- print(ans)","-\"\"\"","-for x in l:","+ ans_list.append(ans)","+for x in ans_list:","-\"\"\""],"diff_only_import_comment":false,"measured_runtime_v0":0.4502001762,"measured_runtime_v1":0.4685302258,"runtime_lift":0.9608775517,"key":["s208126180","s672821513"]} +{"user_id":"u541610817","problem_id":"p03495","language":"python","submission_id_v0":"s894075493","submission_id_v1":"s911234150","cpu_time_v0":209,"cpu_time_v1":166,"memory_v0":33004,"memory_v1":34172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.57,"input":"N, K = [int(x) for x in input().split()]\n\nA_lst = [int(x) for x in input().split()]\n\ndict = {}\n\nfor i in A_lst:\n\n if not i in list(dict.keys()):\n\n dict[i] = 1\n\n else:\n\n dict[i] += 1\n\n\n\nlst = []\n\nfor i in list(dict.keys()):\n\n lst.append(dict[i])\n\nlst.sort()\n\nk = len(lst)\n\ncnt = 0\n\n\n\nfor i in lst:\n\n if k <= K:\n\n break\n\n else:\n\n k -= 1\n\n cnt += i\n\n\n\nprint(cnt)\n","target":"N, K = [int(x) for x in input().split()]\n\nA_lst = [int(x) for x in input().split()]\n\ndict = {}\n\nfor i in A_lst:\n\n if not i in list(dict.keys()):\n\n dict[i] = 1\n\n else:\n\n dict[i] += 1\n\n\n\nval_lst = list(dict.values())\n\nval_lst.sort()\n\nk = len(val_lst)\n\ncnt = 0\n\n\n\nfor i in val_lst:\n\n if k <= K:\n\n break\n\n else:\n\n k -= 1\n\n cnt += i\n\n\n\nprint(cnt)\n","code_v0_loc":24,"code_v1_loc":22,"code_v0_num_chars":398,"code_v1_num_chars":383,"code_v0_no_empty_lines":"N, K = [int(x) for x in input().split()]\nA_lst = [int(x) for x in input().split()]\ndict = {}\nfor i in A_lst:\n if not i in list(dict.keys()):\n dict[i] = 1\n else:\n dict[i] += 1\nlst = []\nfor i in list(dict.keys()):\n lst.append(dict[i])\nlst.sort()\nk = len(lst)\ncnt = 0\nfor i in lst:\n if k <= K:\n break\n else:\n k -= 1\n cnt += i\nprint(cnt)\n","code_v1_no_empty_lines":"N, K = [int(x) for x in input().split()]\nA_lst = [int(x) for x in input().split()]\ndict = {}\nfor i in A_lst:\n if not i in list(dict.keys()):\n dict[i] = 1\n else:\n dict[i] += 1\nval_lst = list(dict.values())\nval_lst.sort()\nk = len(val_lst)\ncnt = 0\nfor i in val_lst:\n if k <= K:\n break\n else:\n k -= 1\n cnt += i\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-lst = []","-for i in list(dict.keys()):","- lst.append(dict[i])","-lst.sort()","-k = len(lst)","+val_lst = list(dict.values())","+val_lst.sort()","+k = len(val_lst)","-for i in lst:","+for i in val_lst:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0316962719,"measured_runtime_v1":0.0395839691,"runtime_lift":0.8007350601,"key":["s894075493","s911234150"]} +{"user_id":"u023846178","problem_id":"p00018","language":"python","submission_id_v0":"s801248324","submission_id_v1":"s955644466","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4188,"memory_v1":4188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"print(' '.join(map(str, sorted(map(int, input().split())))[::-1]))","target":"print(' '.join([str(x) for x in sorted([int(x) for x in input().split()])[::-1]]))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":69,"code_v1_num_chars":85,"code_v0_no_empty_lines":"print(\" \".join(map(str, sorted(map(int, input().split())))[::-1]))\n","code_v1_no_empty_lines":"print(\" \".join([str(x) for x in sorted([int(x) for x in input().split()])[::-1]]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print(\" \".join(map(str, sorted(map(int, input().split())))[::-1]))","+print(\" \".join([str(x) for x in sorted([int(x) for x in input().split()])[::-1]]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0429116249,"measured_runtime_v1":0.0432035923,"runtime_lift":0.9932420573,"key":["s801248324","s955644466"]} +{"user_id":"u598684283","problem_id":"p03239","language":"python","submission_id_v0":"s493701439","submission_id_v1":"s586776966","cpu_time_v0":30,"cpu_time_v1":27,"memory_v0":8956,"memory_v1":9120,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"n,t = list(map(int,input().split()))\n\nc = []\n\nfor i in range(n):\n\n c1,t1 = list(map(int,input().split()))\n\n if t1 <= t:\n\n c.insert(i,c1)\n\nif len(c) == 0:\n\n print(\"TLE\")\n\nelse:\n\n c.sort(key=int)\n\n print((c[0]))","target":"n,t = list(map(int,input().split()))\n\nc = []\n\nfor _ in range(n):\n\n c1,t1 = list(map(int,input().split()))\n\n if t1 <= t:\n\n c.append(c1)\n\nif len(c) == 0:\n\n print(\"TLE\")\n\nelse:\n\n c.sort(key=int)\n\n print((c[0]))","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":217,"code_v1_num_chars":215,"code_v0_no_empty_lines":"n, t = list(map(int, input().split()))\nc = []\nfor i in range(n):\n c1, t1 = list(map(int, input().split()))\n if t1 <= t:\n c.insert(i, c1)\nif len(c) == 0:\n print(\"TLE\")\nelse:\n c.sort(key=int)\n print((c[0]))\n","code_v1_no_empty_lines":"n, t = list(map(int, input().split()))\nc = []\nfor _ in range(n):\n c1, t1 = list(map(int, input().split()))\n if t1 <= t:\n c.append(c1)\nif len(c) == 0:\n print(\"TLE\")\nelse:\n c.sort(key=int)\n print((c[0]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(n):","+for _ in range(n):","- c.insert(i, c1)","+ c.append(c1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0431817989,"measured_runtime_v1":0.0456860273,"runtime_lift":0.9451861212,"key":["s493701439","s586776966"]} +{"user_id":"u633068244","problem_id":"p00012","language":"python","submission_id_v0":"s426844946","submission_id_v1":"s768883549","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4248,"memory_v1":4240,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"def S(x1,y1,x2,y2,x3,y3):\n\n return abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))\/2.0\n\n\n\nwhile True:\n\n try:\n\n x1,y1,x2,y2,x3,y3,xp,yp = list(map(float,input().split()))\n\n flag = S(x1,y1,x2,y2,xp,yp)+S(x1,y1,x3,y3,xp,yp)+S(x3,y3,x2,y2,xp,yp)-S(x1,y1,x2,y2,x3,y3) > 0.0000001\n\n print(\"NO\" if flag else \"YES\")\n\n except:\n\n break","target":"while True:\n\n try:\n\n x1,y1,x2,y2,x3,y3,xp,yp = list(map(float,input().split()))\n\n S = lambda x1,y1,x2,y2,x3=xp,y3=yp:abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))\/2.0\n\n print(\"NO\" if S(x1,y1,x2,y2)+S(x1,y1,x3,y3)+S(x3,y3,x2,y2)-S(x1,y1,x2,y2,x3,y3) > 0.0000001 else \"YES\")\n\n except:\n\n break","code_v0_loc":10,"code_v1_loc":7,"code_v0_num_chars":349,"code_v1_num_chars":313,"code_v0_no_empty_lines":"def S(x1, y1, x2, y2, x3, y3):\n return abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) \/ 2.0\n\n\nwhile True:\n try:\n x1, y1, x2, y2, x3, y3, xp, yp = list(map(float, input().split()))\n flag = (\n S(x1, y1, x2, y2, xp, yp)\n + S(x1, y1, x3, y3, xp, yp)\n + S(x3, y3, x2, y2, xp, yp)\n - S(x1, y1, x2, y2, x3, y3)\n > 0.0000001\n )\n print(\"NO\" if flag else \"YES\")\n except:\n break\n","code_v1_no_empty_lines":"while True:\n try:\n x1, y1, x2, y2, x3, y3, xp, yp = list(map(float, input().split()))\n S = (\n lambda x1, y1, x2, y2, x3=xp, y3=yp: abs(\n x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)\n )\n \/ 2.0\n )\n print(\n \"NO\"\n if S(x1, y1, x2, y2)\n + S(x1, y1, x3, y3)\n + S(x3, y3, x2, y2)\n - S(x1, y1, x2, y2, x3, y3)\n > 0.0000001\n else \"YES\"\n )\n except:\n break\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-def S(x1, y1, x2, y2, x3, y3):","- return abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) \/ 2.0","-","-","- flag = (","- S(x1, y1, x2, y2, xp, yp)","- + S(x1, y1, x3, y3, xp, yp)","- + S(x3, y3, x2, y2, xp, yp)","+ S = (","+ lambda x1, y1, x2, y2, x3=xp, y3=yp: abs(","+ x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)","+ )","+ \/ 2.0","+ )","+ print(","+ \"NO\"","+ if S(x1, y1, x2, y2)","+ + S(x1, y1, x3, y3)","+ + S(x3, y3, x2, y2)","+ else \"YES\"","- print(\"NO\" if flag else \"YES\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0537057617,"measured_runtime_v1":0.0357476454,"runtime_lift":1.5023580179,"key":["s426844946","s768883549"]} +{"user_id":"u847727454","problem_id":"p02712","language":"python","submission_id_v0":"s547880017","submission_id_v1":"s792949744","cpu_time_v0":175,"cpu_time_v1":100,"memory_v0":9068,"memory_v1":103312,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.86,"input":"N = int(eval(input()))\n\nans = 0\n\n\n\nfor i in range(1,N+1):\n\n if i % 3 == 0 or i % 5 == 0:\n\n ans += 0\n\n else:\n\n ans += i\n\n\n\nprint(ans)\n","target":"N = int(eval(input()))\n\nans = []\n\n\n\nfor i in range(N+1):\n\n if i % 3 != 0 and i % 5 != 0:\n\n ans.append(i)\n\n\n\nprint((sum(ans)))","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":148,"code_v1_num_chars":127,"code_v0_no_empty_lines":"N = int(eval(input()))\nans = 0\nfor i in range(1, N + 1):\n if i % 3 == 0 or i % 5 == 0:\n ans += 0\n else:\n ans += i\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nans = []\nfor i in range(N + 1):\n if i % 3 != 0 and i % 5 != 0:\n ans.append(i)\nprint((sum(ans)))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-ans = 0","-for i in range(1, N + 1):","- if i % 3 == 0 or i % 5 == 0:","- ans += 0","- else:","- ans += i","-print(ans)","+ans = []","+for i in range(N + 1):","+ if i % 3 != 0 and i % 5 != 0:","+ ans.append(i)","+print((sum(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2688319201,"measured_runtime_v1":0.1570566228,"runtime_lift":1.7116878946,"key":["s547880017","s792949744"]} +{"user_id":"u729133443","problem_id":"p02842","language":"python","submission_id_v0":"s562412262","submission_id_v1":"s834965813","cpu_time_v0":29,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.38,"input":"n=int(eval(input()));print((([m for m in range(n+1)if int(m*1.08)==n]+[':('])[0]))","target":"n=int(eval(input()))+1;print((n%27%14and int(n\/1.08)or':('))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":74,"code_v1_num_chars":52,"code_v0_no_empty_lines":"n = int(eval(input()))\nprint((([m for m in range(n + 1) if int(m * 1.08) == n] + [\":(\"])[0]))\n","code_v1_no_empty_lines":"n = int(eval(input())) + 1\nprint((n % 27 % 14 and int(n \/ 1.08) or \":(\"))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-n = int(eval(input()))","-print((([m for m in range(n + 1) if int(m * 1.08) == n] + [\":(\"])[0]))","+n = int(eval(input())) + 1","+print((n % 27 % 14 and int(n \/ 1.08) or \":(\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0377282786,"measured_runtime_v1":0.0441145294,"runtime_lift":0.855234753,"key":["s562412262","s834965813"]} +{"user_id":"u735335967","problem_id":"p02935","language":"python","submission_id_v0":"s060119149","submission_id_v1":"s976922764","cpu_time_v0":23,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.09,"input":"n = int(eval(input()))\n\nv = sorted(list(map(int, input().split())))\n\n\n\nwhile len(v) > 1:\n\n new_v = (v[0]+v[1]) \/ 2\n\n del v[0:2]\n\n v = [new_v]+v\n\n\n\nprint((v[0]))\n","target":"n = int(eval(input()))\n\nv = sorted(list(map(int, input().split())))\n\n\n\nans = (v[0]+v[1])\/2\n\nfor i in range(2,n):\n\n ans = (ans+v[i])\/2\n\nprint(ans)\n","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":162,"code_v1_num_chars":143,"code_v0_no_empty_lines":"n = int(eval(input()))\nv = sorted(list(map(int, input().split())))\nwhile len(v) > 1:\n new_v = (v[0] + v[1]) \/ 2\n del v[0:2]\n v = [new_v] + v\nprint((v[0]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nv = sorted(list(map(int, input().split())))\nans = (v[0] + v[1]) \/ 2\nfor i in range(2, n):\n ans = (ans + v[i]) \/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-while len(v) > 1:","- new_v = (v[0] + v[1]) \/ 2","- del v[0:2]","- v = [new_v] + v","-print((v[0]))","+ans = (v[0] + v[1]) \/ 2","+for i in range(2, n):","+ ans = (ans + v[i]) \/ 2","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372018991,"measured_runtime_v1":0.0376228573,"runtime_lift":0.9888111026,"key":["s060119149","s976922764"]} +{"user_id":"u145231176","problem_id":"p02549","language":"python","submission_id_v0":"s647123599","submission_id_v1":"s884291865","cpu_time_v0":125,"cpu_time_v1":113,"memory_v0":69792,"memory_v1":76988,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.6,"input":"def getN():\n\n return int(eval(input()))\n\ndef getNM():\n\n return list(map(int, input().split()))\n\ndef getList():\n\n return list(map(int, input().split()))\n\ndef getArray(intn):\n\n return [int(eval(input())) for i in range(intn)]\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\ndef rand_N(ran1, ran2):\n\n return random.randint(ran1, ran2)\n\ndef rand_List(ran1, ran2, rantime):\n\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n\n ns = []\n\n while len(ns) < rantime:\n\n n = random.randint(ran1, ran2)\n\n if not n in ns:\n\n ns.append(n)\n\n return sorted(ns)\n\n\n\ndef rand_query(ran1, ran2, rantime):\n\n r_query = []\n\n while len(r_query) < rantime:\n\n n_q = rand_ints_nodup(ran1, ran2, 2)\n\n if not n_q in r_query:\n\n r_query.append(n_q)\n\n return sorted(r_query)\n\n\n\nfrom sys import exit\n\n\n\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\nmod = 998244353\n\n\n\n#############\n\n# Main Code #\n\n#############\n\n\n\nN, K = getNM()\n\nque = [getList() for i in range(K)]\n\n\n\ndp = [0] * (N + 1)\n\ndp[1] = 1\n\ndp[2] = -1\n\n\n\nfor i in range(1, N + 1):\n\n dp[i] += dp[i - 1]\n\n dp[i] %= mod\n\n for l, r in que:\n\n if i + l <= N:\n\n dp[i + l] += dp[i]\n\n if i + r + 1 <= N:\n\n dp[i + r + 1] -= dp[i]\n\nprint((dp[N] % mod))","target":"def getN():\n\n return int(eval(input()))\n\ndef getNM():\n\n return list(map(int, input().split()))\n\ndef getList():\n\n return list(map(int, input().split()))\n\ndef getArray(intn):\n\n return [int(eval(input())) for i in range(intn)]\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\ndef rand_N(ran1, ran2):\n\n return random.randint(ran1, ran2)\n\ndef rand_List(ran1, ran2, rantime):\n\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n\n ns = []\n\n while len(ns) < rantime:\n\n n = random.randint(ran1, ran2)\n\n if not n in ns:\n\n ns.append(n)\n\n return sorted(ns)\n\n\n\ndef rand_query(ran1, ran2, rantime):\n\n r_query = []\n\n while len(r_query) < rantime:\n\n n_q = rand_ints_nodup(ran1, ran2, 2)\n\n if not n_q in r_query:\n\n r_query.append(n_q)\n\n return sorted(r_query)\n\n\n\nfrom sys import exit\n\n\n\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\nmod = 998244353\n\n\n\n#############\n\n# Main Code #\n\n#############\n\n\n\nN, K = getNM()\n\nque = [getList() for i in range(K)]\n\n\n\ndp = [0] * (N + 1) # dp[i] i\u306e\u6642\u306e\u901a\u308a\u306e\u6570\n\nimos = [0] * (N + 1) # imos[i]: dp[1] ~ dp[i]\u307e\u3067\u306e\u7d2f\u8a08\n\ndp[1] = 1\n\nimos[1] = 1\n\n\n\n# \u8cb0\u3046dp\n\n# dp += dp[l] - dp[r]\n\n\n\nfor i in range(2, N + 1):\n\n for l, r in que:\n\n if i - l >= 0:\n\n dp[i] += imos[i - l] - imos[max((i - r - 1), 0)]\n\n dp[i] %= mod\n\n imos[i] = dp[i]\n\n imos[i] += imos[i - 1]\n\n imos[i] %= mod\n\n\n\nprint((dp[N] % mod))\n\n\n\n\"\"\"\n\n# \u914d\u308bdp\n\n\n\ndp = [0] * (N + 1)\n\ndp[1] = 1\n\ndp[2] = -1\n\n\n\nfor i in range(1, N + 1):\n\n dp[i] += dp[i - 1]\n\n dp[i] %= mod\n\n for l, r in que:\n\n if i + l <= N:\n\n dp[i + l] += dp[i]\n\n if i + r + 1 <= N:\n\n dp[i + r + 1] -= dp[i]\n\nprint(dp[N] % mod)\n\n\"\"\"","code_v0_loc":56,"code_v1_loc":79,"code_v0_num_chars":1301,"code_v1_num_chars":1723,"code_v0_no_empty_lines":"def getN():\n return int(eval(input()))\n\n\ndef getNM():\n return list(map(int, input().split()))\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\ndef getArray(intn):\n return [int(eval(input())) for i in range(intn)]\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef rand_N(ran1, ran2):\n return random.randint(ran1, ran2)\n\n\ndef rand_List(ran1, ran2, rantime):\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n ns = []\n while len(ns) < rantime:\n n = random.randint(ran1, ran2)\n if not n in ns:\n ns.append(n)\n return sorted(ns)\n\n\ndef rand_query(ran1, ran2, rantime):\n r_query = []\n while len(r_query) < rantime:\n n_q = rand_ints_nodup(ran1, ran2, 2)\n if not n_q in r_query:\n r_query.append(n_q)\n return sorted(r_query)\n\n\nfrom sys import exit\nimport sys\n\nsys.setrecursionlimit(1000000000)\nmod = 998244353\n#############\n# Main Code #\n#############\nN, K = getNM()\nque = [getList() for i in range(K)]\ndp = [0] * (N + 1)\ndp[1] = 1\ndp[2] = -1\nfor i in range(1, N + 1):\n dp[i] += dp[i - 1]\n dp[i] %= mod\n for l, r in que:\n if i + l <= N:\n dp[i + l] += dp[i]\n if i + r + 1 <= N:\n dp[i + r + 1] -= dp[i]\nprint((dp[N] % mod))\n","code_v1_no_empty_lines":"def getN():\n return int(eval(input()))\n\n\ndef getNM():\n return list(map(int, input().split()))\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\ndef getArray(intn):\n return [int(eval(input())) for i in range(intn)]\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef rand_N(ran1, ran2):\n return random.randint(ran1, ran2)\n\n\ndef rand_List(ran1, ran2, rantime):\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n ns = []\n while len(ns) < rantime:\n n = random.randint(ran1, ran2)\n if not n in ns:\n ns.append(n)\n return sorted(ns)\n\n\ndef rand_query(ran1, ran2, rantime):\n r_query = []\n while len(r_query) < rantime:\n n_q = rand_ints_nodup(ran1, ran2, 2)\n if not n_q in r_query:\n r_query.append(n_q)\n return sorted(r_query)\n\n\nfrom sys import exit\nimport sys\n\nsys.setrecursionlimit(1000000000)\nmod = 998244353\n#############\n# Main Code #\n#############\nN, K = getNM()\nque = [getList() for i in range(K)]\ndp = [0] * (N + 1) # dp[i] i\u306e\u6642\u306e\u901a\u308a\u306e\u6570\nimos = [0] * (N + 1) # imos[i]: dp[1] ~ dp[i]\u307e\u3067\u306e\u7d2f\u8a08\ndp[1] = 1\nimos[1] = 1\n# \u8cb0\u3046dp\n# dp += dp[l] - dp[r]\nfor i in range(2, N + 1):\n for l, r in que:\n if i - l >= 0:\n dp[i] += imos[i - l] - imos[max((i - r - 1), 0)]\n dp[i] %= mod\n imos[i] = dp[i]\n imos[i] += imos[i - 1]\n imos[i] %= mod\nprint((dp[N] % mod))\n\"\"\"\n# \u914d\u308bdp\ndp = [0] * (N + 1)\ndp[1] = 1\ndp[2] = -1\nfor i in range(1, N + 1):\n dp[i] += dp[i - 1]\n dp[i] %= mod\n for l, r in que:\n if i + l <= N:\n dp[i + l] += dp[i]\n if i + r + 1 <= N:\n dp[i + r + 1] -= dp[i]\nprint(dp[N] % mod)\n\"\"\"\n","code_same":false,"relative_loc_diff_percent":29.1139240506,"diff":["+dp = [0] * (N + 1) # dp[i] i\u306e\u6642\u306e\u901a\u308a\u306e\u6570","+imos = [0] * (N + 1) # imos[i]: dp[1] ~ dp[i]\u307e\u3067\u306e\u7d2f\u8a08","+dp[1] = 1","+imos[1] = 1","+# \u8cb0\u3046dp","+# dp += dp[l] - dp[r]","+for i in range(2, N + 1):","+ for l, r in que:","+ if i - l >= 0:","+ dp[i] += imos[i - l] - imos[max((i - r - 1), 0)]","+ dp[i] %= mod","+ imos[i] = dp[i]","+ imos[i] += imos[i - 1]","+ imos[i] %= mod","+print((dp[N] % mod))","+\"\"\"","+# \u914d\u308bdp","-print((dp[N] % mod))","+print(dp[N] % mod)","+\"\"\""],"diff_only_import_comment":false,"measured_runtime_v0":0.0355890057,"measured_runtime_v1":0.0366330712,"runtime_lift":0.9714993733,"key":["s647123599","s884291865"]} +{"user_id":"u585482323","problem_id":"p03222","language":"python","submission_id_v0":"s237217422","submission_id_v1":"s748315524","cpu_time_v0":212,"cpu_time_v1":184,"memory_v0":42480,"memory_v1":40048,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.21,"input":"#!usr\/bin\/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n return\n\n\n\n#B\n\ndef B():\n\n return\n\n\n\n#C\n\ndef C():\n\n n,m = LI()\n\n v = LIR(m)\n\n for i in range(m):\n\n v[i] = [v[i][0],v[i][1],i]\n\n v.sort(key = lambda x:x[1])\n\n f = [0 for i in range(n+1)]\n\n ans = [None for i in range(m)]\n\n for p,y,i in v:\n\n f[p] += 1\n\n s = \"{:0>6}\".format(p)\n\n t = \"{:0>6}\".format(f[p])\n\n ans[i] = s+t\n\n for i in ans:\n\n print(i)\n\n#D\n\ndef D():\n\n h,w,k = LI()\n\n dp = [[0 for i in range(w)] for j in range(h+1)]\n\n dp[0][0] = 1\n\n p = [1 for i in range(w+1)]\n\n for i in range(w):\n\n p[i+1] = p[i]*2\n\n l = [i for i in range(p[w-1])]\n\n i = 0\n\n while i < len(l):\n\n a = l[i]\n\n for j in range(w):\n\n if a&p[j] and a&p[j+1]:\n\n l.pop(i)\n\n i -= 1\n\n break\n\n i += 1\n\n for i in range(h):\n\n for j in range(w):\n\n a = 0\n\n b = 0\n\n c = 0\n\n for s in l:\n\n if 0 < j < w-1:\n\n if p[j]&s:\n\n c += 1\n\n elif p[j-1]&s:\n\n a += 1\n\n else:\n\n b += 1\n\n elif j == 0:\n\n if p[j]&s:\n\n c += 1\n\n else:\n\n b += 1\n\n else:\n\n if p[j-1]&s:\n\n a += 1\n\n else:\n\n b += 1\n\n dp[i+1][j] += b*dp[i][j]\n\n dp[i+1][j] %= mod\n\n if j > 0:\n\n dp[i+1][j-1] += a*dp[i][j]\n\n dp[i+1][j-1] %= mod\n\n if j < w-1:\n\n dp[i+1][j+1] += c*dp[i][j]\n\n dp[i+1][j+1] %= mod\n\n print((dp[h][k-1]))\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n return\n\n\n\n#G\n\ndef G():\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n D()\n","target":"#!usr\/bin\/env python3\n\nfrom collections import defaultdict\n\nfrom collections import deque\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nimport math\n\nimport bisect\n\nimport random\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS():return list(map(list, sys.stdin.readline().split()))\n\ndef S(): return list(sys.stdin.readline())[:-1]\n\ndef IR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = I()\n\n return l\n\ndef LIR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = LI()\n\n return l\n\ndef SR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = S()\n\n return l\n\ndef LSR(n):\n\n l = [None for i in range(n)]\n\n for i in range(n):l[i] = SR()\n\n return l\n\nmod = 1000000007\n\n\n\n#A\n\ndef A():\n\n return\n\n\n\n#B\n\ndef B():\n\n return\n\n\n\n#C\n\ndef C():\n\n n,m = LI()\n\n v = LIR(m)\n\n for i in range(m):\n\n v[i] = [v[i][0],v[i][1],i]\n\n v.sort(key = lambda x:x[1])\n\n f = [0 for i in range(n+1)]\n\n ans = [None for i in range(m)]\n\n for p,y,i in v:\n\n f[p] += 1\n\n s = \"{:0>6}\".format(p)\n\n t = \"{:0>6}\".format(f[p])\n\n ans[i] = s+t\n\n for i in ans:\n\n print(i)\n\n#D\n\ndef D():\n\n h,w,k = LI()\n\n dp = [[0 for i in range(w)] for j in range(h+1)]\n\n dp[0][0] = 1\n\n p = [1 for i in range(w+1)]\n\n for i in range(w):\n\n p[i+1] = p[i]*2\n\n l = [i for i in range(p[w-1])]\n\n i = 0\n\n while i < len(l):\n\n a = l[i]\n\n for j in range(w):\n\n if a&p[j] and a&p[j+1]:\n\n l.pop(i)\n\n i -= 1\n\n break\n\n i += 1\n\n d = [[0 for i in range(3)] for j in range(w)]\n\n for j in range(w):\n\n for s in l:\n\n if 0 < j < w-1:\n\n if p[j]&s:\n\n d[j][2] += 1\n\n elif p[j-1]&s:\n\n d[j][0] += 1\n\n else:\n\n d[j][1] += 1\n\n elif j == 0:\n\n if p[j]&s:\n\n d[j][2] += 1\n\n else:\n\n d[j][1] += 1\n\n else:\n\n if p[j-1]&s:\n\n d[j][0] += 1\n\n else:\n\n d[j][1] += 1\n\n for i in range(h):\n\n for j in range(w):\n\n dp[i+1][j] += d[j][1]*dp[i][j]\n\n dp[i+1][j] %= mod\n\n if j > 0:\n\n dp[i+1][j-1] += d[j][0]*dp[i][j]\n\n dp[i+1][j-1] %= mod\n\n if j < w-1:\n\n dp[i+1][j+1] += d[j][2]*dp[i][j]\n\n dp[i+1][j+1] %= mod\n\n print((dp[h][k-1]))\n\n#E\n\ndef E():\n\n return\n\n\n\n#F\n\ndef F():\n\n return\n\n\n\n#G\n\ndef G():\n\n return\n\n\n\n#H\n\ndef H():\n\n return\n\n\n\n#Solve\n\nif __name__ == \"__main__\":\n\n D()\n","code_v0_loc":123,"code_v1_loc":122,"code_v0_num_chars":2776,"code_v1_num_chars":2782,"code_v0_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\ndef A():\n return\n\n\n# B\ndef B():\n return\n\n\n# C\ndef C():\n n, m = LI()\n v = LIR(m)\n for i in range(m):\n v[i] = [v[i][0], v[i][1], i]\n v.sort(key=lambda x: x[1])\n f = [0 for i in range(n + 1)]\n ans = [None for i in range(m)]\n for p, y, i in v:\n f[p] += 1\n s = \"{:0>6}\".format(p)\n t = \"{:0>6}\".format(f[p])\n ans[i] = s + t\n for i in ans:\n print(i)\n\n\n# D\ndef D():\n h, w, k = LI()\n dp = [[0 for i in range(w)] for j in range(h + 1)]\n dp[0][0] = 1\n p = [1 for i in range(w + 1)]\n for i in range(w):\n p[i + 1] = p[i] * 2\n l = [i for i in range(p[w - 1])]\n i = 0\n while i < len(l):\n a = l[i]\n for j in range(w):\n if a & p[j] and a & p[j + 1]:\n l.pop(i)\n i -= 1\n break\n i += 1\n for i in range(h):\n for j in range(w):\n a = 0\n b = 0\n c = 0\n for s in l:\n if 0 < j < w - 1:\n if p[j] & s:\n c += 1\n elif p[j - 1] & s:\n a += 1\n else:\n b += 1\n elif j == 0:\n if p[j] & s:\n c += 1\n else:\n b += 1\n else:\n if p[j - 1] & s:\n a += 1\n else:\n b += 1\n dp[i + 1][j] += b * dp[i][j]\n dp[i + 1][j] %= mod\n if j > 0:\n dp[i + 1][j - 1] += a * dp[i][j]\n dp[i + 1][j - 1] %= mod\n if j < w - 1:\n dp[i + 1][j + 1] += c * dp[i][j]\n dp[i + 1][j + 1] %= mod\n print((dp[h][k - 1]))\n\n\n# E\ndef E():\n return\n\n\n# F\ndef F():\n return\n\n\n# G\ndef G():\n return\n\n\n# H\ndef H():\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n D()\n","code_v1_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return list(map(list, sys.stdin.readline().split()))\n\n\ndef S():\n return list(sys.stdin.readline())[:-1]\n\n\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = I()\n return l\n\n\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = LI()\n return l\n\n\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = S()\n return l\n\n\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):\n l[i] = SR()\n return l\n\n\nmod = 1000000007\n# A\ndef A():\n return\n\n\n# B\ndef B():\n return\n\n\n# C\ndef C():\n n, m = LI()\n v = LIR(m)\n for i in range(m):\n v[i] = [v[i][0], v[i][1], i]\n v.sort(key=lambda x: x[1])\n f = [0 for i in range(n + 1)]\n ans = [None for i in range(m)]\n for p, y, i in v:\n f[p] += 1\n s = \"{:0>6}\".format(p)\n t = \"{:0>6}\".format(f[p])\n ans[i] = s + t\n for i in ans:\n print(i)\n\n\n# D\ndef D():\n h, w, k = LI()\n dp = [[0 for i in range(w)] for j in range(h + 1)]\n dp[0][0] = 1\n p = [1 for i in range(w + 1)]\n for i in range(w):\n p[i + 1] = p[i] * 2\n l = [i for i in range(p[w - 1])]\n i = 0\n while i < len(l):\n a = l[i]\n for j in range(w):\n if a & p[j] and a & p[j + 1]:\n l.pop(i)\n i -= 1\n break\n i += 1\n d = [[0 for i in range(3)] for j in range(w)]\n for j in range(w):\n for s in l:\n if 0 < j < w - 1:\n if p[j] & s:\n d[j][2] += 1\n elif p[j - 1] & s:\n d[j][0] += 1\n else:\n d[j][1] += 1\n elif j == 0:\n if p[j] & s:\n d[j][2] += 1\n else:\n d[j][1] += 1\n else:\n if p[j - 1] & s:\n d[j][0] += 1\n else:\n d[j][1] += 1\n for i in range(h):\n for j in range(w):\n dp[i + 1][j] += d[j][1] * dp[i][j]\n dp[i + 1][j] %= mod\n if j > 0:\n dp[i + 1][j - 1] += d[j][0] * dp[i][j]\n dp[i + 1][j - 1] %= mod\n if j < w - 1:\n dp[i + 1][j + 1] += d[j][2] * dp[i][j]\n dp[i + 1][j + 1] %= mod\n print((dp[h][k - 1]))\n\n\n# E\ndef E():\n return\n\n\n# F\ndef F():\n return\n\n\n# G\ndef G():\n return\n\n\n# H\ndef H():\n return\n\n\n# Solve\nif __name__ == \"__main__\":\n D()\n","code_same":false,"relative_loc_diff_percent":0.8130081301,"diff":["+ d = [[0 for i in range(3)] for j in range(w)]","+ for j in range(w):","+ for s in l:","+ if 0 < j < w - 1:","+ if p[j] & s:","+ d[j][2] += 1","+ elif p[j - 1] & s:","+ d[j][0] += 1","+ else:","+ d[j][1] += 1","+ elif j == 0:","+ if p[j] & s:","+ d[j][2] += 1","+ else:","+ d[j][1] += 1","+ else:","+ if p[j - 1] & s:","+ d[j][0] += 1","+ else:","+ d[j][1] += 1","- a = 0","- b = 0","- c = 0","- for s in l:","- if 0 < j < w - 1:","- if p[j] & s:","- c += 1","- elif p[j - 1] & s:","- a += 1","- else:","- b += 1","- elif j == 0:","- if p[j] & s:","- c += 1","- else:","- b += 1","- else:","- if p[j - 1] & s:","- a += 1","- else:","- b += 1","- dp[i + 1][j] += b * dp[i][j]","+ dp[i + 1][j] += d[j][1] * dp[i][j]","- dp[i + 1][j - 1] += a * dp[i][j]","+ dp[i + 1][j - 1] += d[j][0] * dp[i][j]","- dp[i + 1][j + 1] += c * dp[i][j]","+ dp[i + 1][j + 1] += d[j][2] * dp[i][j]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0839514669,"measured_runtime_v1":0.079747782,"runtime_lift":1.0527122485,"key":["s237217422","s748315524"]} +{"user_id":"u018679195","problem_id":"p03325","language":"python","submission_id_v0":"s934245112","submission_id_v1":"s971386112","cpu_time_v0":194,"cpu_time_v1":129,"memory_v0":40688,"memory_v1":4148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.51,"input":"n1 = int(eval(input()))\n\n\n\nlista = list(map(int, input().split()))\n\n\n\ncont = 0\n\nfor e in lista:\n\n aux = e\n\n while(aux%2 == 0):\n\n aux \/= 2\n\n cont += 1\n\n \n\n\n\nprint(cont)","target":"a = int(eval(input()))\n\nlista = list(map(int, input().split()))\n\nans=0\n\n\n\nfor i in lista:\n\n while i % 2==0:\n\n i = i \/ 2\n\n ans += 1\n\n \n\nprint(ans)","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":188,"code_v1_num_chars":149,"code_v0_no_empty_lines":"n1 = int(eval(input()))\nlista = list(map(int, input().split()))\ncont = 0\nfor e in lista:\n aux = e\n while aux % 2 == 0:\n aux \/= 2\n cont += 1\nprint(cont)\n","code_v1_no_empty_lines":"a = int(eval(input()))\nlista = list(map(int, input().split()))\nans = 0\nfor i in lista:\n while i % 2 == 0:\n i = i \/ 2\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-n1 = int(eval(input()))","+a = int(eval(input()))","-cont = 0","-for e in lista:","- aux = e","- while aux % 2 == 0:","- aux \/= 2","- cont += 1","-print(cont)","+ans = 0","+for i in lista:","+ while i % 2 == 0:","+ i = i \/ 2","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0614700601,"measured_runtime_v1":0.0339537916,"runtime_lift":1.8104034089,"key":["s934245112","s971386112"]} +{"user_id":"u644907318","problem_id":"p03593","language":"python","submission_id_v0":"s972871132","submission_id_v1":"s458844003","cpu_time_v0":188,"cpu_time_v1":66,"memory_v0":38640,"memory_v1":65460,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.89,"input":"H,W = list(map(int,input().split()))\n\nC = {}\n\nfor _ in range(H):\n\n A = input().strip()\n\n for i in range(W):\n\n if A[i] not in C:\n\n C[A[i]] = 0\n\n C[A[i]] += 1\n\ncnt4 = 0\n\ncnt1 = 0\n\nfor a in C:\n\n if C[a]>=4:\n\n cnt4 += C[a]\/\/4\n\n C[a] = C[a]%4\n\n if C[a]%2==1:\n\n cnt1 += 1\n\nif cnt4<(W\/\/2)*(H\/\/2):\n\n flag = 0\n\nelse:\n\n if H%2==1 and W%2==1:\n\n if cnt1==1:\n\n flag = 1\n\n else:\n\n flag = 0\n\n else:\n\n if cnt1==0:\n\n flag = 1\n\n else:\n\n flag = 0\n\nif flag==1:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","target":"H,W = list(map(int,input().split()))\n\nA = [input().strip() for _ in range(H)]\n\nC = {chr(i):0 for i in range(97,123)}\n\nfor i in range(H):\n\n for j in range(W):\n\n C[A[i][j]] += 1\n\nif H%2==0 and W%2==0:\n\n flag = 0\n\n for a in C:\n\n if C[a]%4!=0:\n\n flag = 1\n\n break\n\n if flag==0:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")\n\nelif (H%2==0 and W%2==1) or (H%2==1 and W%2==0):\n\n n = (H\/\/2)*(W\/\/2)\n\n for a in C:\n\n if C[a]>=4:\n\n n -= C[a]\/\/4\n\n C[a] = C[a]%4\n\n if n>0:\n\n print(\"No\")\n\n else:\n\n flag = 0\n\n for a in C:\n\n if C[a]%2==1:\n\n flag=1\n\n break\n\n if flag==0:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")\n\nelse:\n\n n = (H\/\/2)*(W\/\/2)\n\n for a in C:\n\n if C[a]>=4:\n\n n -= C[a]\/\/4\n\n C[a] = C[a]%4\n\n if n>0:\n\n print(\"No\")\n\n else:\n\n cnt = 0\n\n for a in C:\n\n cnt += C[a]%2\n\n if cnt==1:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")","code_v0_loc":33,"code_v1_loc":50,"code_v0_num_chars":615,"code_v1_num_chars":1094,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\nC = {}\nfor _ in range(H):\n A = input().strip()\n for i in range(W):\n if A[i] not in C:\n C[A[i]] = 0\n C[A[i]] += 1\ncnt4 = 0\ncnt1 = 0\nfor a in C:\n if C[a] >= 4:\n cnt4 += C[a] \/\/ 4\n C[a] = C[a] % 4\n if C[a] % 2 == 1:\n cnt1 += 1\nif cnt4 < (W \/\/ 2) * (H \/\/ 2):\n flag = 0\nelse:\n if H % 2 == 1 and W % 2 == 1:\n if cnt1 == 1:\n flag = 1\n else:\n flag = 0\n else:\n if cnt1 == 0:\n flag = 1\n else:\n flag = 0\nif flag == 1:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nA = [input().strip() for _ in range(H)]\nC = {chr(i): 0 for i in range(97, 123)}\nfor i in range(H):\n for j in range(W):\n C[A[i][j]] += 1\nif H % 2 == 0 and W % 2 == 0:\n flag = 0\n for a in C:\n if C[a] % 4 != 0:\n flag = 1\n break\n if flag == 0:\n print(\"Yes\")\n else:\n print(\"No\")\nelif (H % 2 == 0 and W % 2 == 1) or (H % 2 == 1 and W % 2 == 0):\n n = (H \/\/ 2) * (W \/\/ 2)\n for a in C:\n if C[a] >= 4:\n n -= C[a] \/\/ 4\n C[a] = C[a] % 4\n if n > 0:\n print(\"No\")\n else:\n flag = 0\n for a in C:\n if C[a] % 2 == 1:\n flag = 1\n break\n if flag == 0:\n print(\"Yes\")\n else:\n print(\"No\")\nelse:\n n = (H \/\/ 2) * (W \/\/ 2)\n for a in C:\n if C[a] >= 4:\n n -= C[a] \/\/ 4\n C[a] = C[a] % 4\n if n > 0:\n print(\"No\")\n else:\n cnt = 0\n for a in C:\n cnt += C[a] % 2\n if cnt == 1:\n print(\"Yes\")\n else:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":34.0,"diff":["-C = {}","-for _ in range(H):","- A = input().strip()","- for i in range(W):","- if A[i] not in C:","- C[A[i]] = 0","- C[A[i]] += 1","-cnt4 = 0","-cnt1 = 0","-for a in C:","- if C[a] >= 4:","- cnt4 += C[a] \/\/ 4","- C[a] = C[a] % 4","- if C[a] % 2 == 1:","- cnt1 += 1","-if cnt4 < (W \/\/ 2) * (H \/\/ 2):","+A = [input().strip() for _ in range(H)]","+C = {chr(i): 0 for i in range(97, 123)}","+for i in range(H):","+ for j in range(W):","+ C[A[i][j]] += 1","+if H % 2 == 0 and W % 2 == 0:","+ for a in C:","+ if C[a] % 4 != 0:","+ flag = 1","+ break","+ if flag == 0:","+ print(\"Yes\")","+ else:","+ print(\"No\")","+elif (H % 2 == 0 and W % 2 == 1) or (H % 2 == 1 and W % 2 == 0):","+ n = (H \/\/ 2) * (W \/\/ 2)","+ for a in C:","+ if C[a] >= 4:","+ n -= C[a] \/\/ 4","+ C[a] = C[a] % 4","+ if n > 0:","+ print(\"No\")","+ else:","+ flag = 0","+ for a in C:","+ if C[a] % 2 == 1:","+ flag = 1","+ break","+ if flag == 0:","+ print(\"Yes\")","+ else:","+ print(\"No\")","- if H % 2 == 1 and W % 2 == 1:","- if cnt1 == 1:","- flag = 1","+ n = (H \/\/ 2) * (W \/\/ 2)","+ for a in C:","+ if C[a] >= 4:","+ n -= C[a] \/\/ 4","+ C[a] = C[a] % 4","+ if n > 0:","+ print(\"No\")","+ else:","+ cnt = 0","+ for a in C:","+ cnt += C[a] % 2","+ if cnt == 1:","+ print(\"Yes\")","- flag = 0","- else:","- if cnt1 == 0:","- flag = 1","- else:","- flag = 0","-if flag == 1:","- print(\"Yes\")","-else:","- print(\"No\")","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1033674455,"measured_runtime_v1":0.1410320706,"runtime_lift":0.7329357433,"key":["s972871132","s458844003"]} +{"user_id":"u979667682","problem_id":"p02683","language":"python","submission_id_v0":"s991623893","submission_id_v1":"s159176453","cpu_time_v0":826,"cpu_time_v1":140,"memory_v0":77956,"memory_v1":75048,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.05,"input":"from sys import stdin\n\nimport math\n\nimport fractions\n\nfrom collections import deque\n\nfrom collections import Counter\n\nimport itertools\n\n\n\nINF = 10 ** 10\n\n\n\nN, M, X = [int(x) for x in stdin.readline().rstrip().split()]\n\n\n\nCA = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]\n\n\n\nknowledge_list = [[0 for _ in range(M)]]\n\nmoney_list = [0]\n\n\n\nfor i in range(N):\n\n C = CA[i][0]\n\n A = CA[i][1:]\n\n\n\n # \u8cfc\u5165\u3059\u308b\u5834\u5408\n\n tmp2 = []\n\n for i, knowledge in enumerate(knowledge_list):\n\n tmp = []\n\n for k in range(len(knowledge)):\n\n tmp.append(knowledge[k] + A[k])\n\n \n\n tmp2.append(tmp)\n\n money_list.append(money_list[i]+C)\n\n\n\n knowledge_list = knowledge_list + tmp2\n\n\n\nans = INF\n\nfor i in range(len(money_list)):\n\n if min(knowledge_list[i]) >= X:\n\n ans = min(ans, money_list[i])\n\n\n\nif ans != INF:\n\n print(ans)\n\nelse:\n\n print((-1))\n\n\n\n\n\n \n","target":"from sys import stdin\n\nimport math\n\nimport fractions\n\nfrom collections import deque\n\nfrom collections import Counter\n\nimport itertools\n\n\n\nINF = 10 ** 10\n\n\n\nN, M, X = [int(x) for x in stdin.readline().rstrip().split()]\n\n\n\nCA = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]\n\n\n\ndp = [[[0 for _ in range(M)] for _ in range(4)] for _ in range(N+1)]\n\ndp_money = [[0 for _ in range(2)] for _ in range(N+1)]\n\n\n\ntm = [0 for _ in range(2**N)] \n\ntl = [[0 for _ in range(M)] for _ in range(2**N)]\n\n\n\nknowledge_list = [[0 for _ in range(M)]]\n\nmoney_list = [0]\n\n\n\nfor i in range(N):\n\n C = CA[i][0]\n\n A = CA[i][1:]\n\n\n\n # \u8cfc\u5165\u3059\u308b\u5834\u5408\n\n tmp2 = []\n\n \n\n for i, knowledge in enumerate(knowledge_list):\n\n tmp = []\n\n for k in range(len(knowledge)):\n\n tmp.append(knowledge[k] + A[k])\n\n \n\n tmp2.append(tmp)\n\n money_list.append(money_list[i]+C)\n\n\n\n knowledge_list = knowledge_list + tmp2\n\n\n\nans = INF\n\nfor i in range(len(money_list)):\n\n if min(knowledge_list[i]) >= X:\n\n ans = min(ans, money_list[i])\n\n\n\nif ans != INF:\n\n print(ans)\n\nelse:\n\n print((-1))\n\n\n\n\n\n \n","code_v0_loc":44,"code_v1_loc":51,"code_v0_num_chars":928,"code_v1_num_chars":1147,"code_v0_no_empty_lines":"from sys import stdin\nimport math\nimport fractions\nfrom collections import deque\nfrom collections import Counter\nimport itertools\n\nINF = 10**10\nN, M, X = [int(x) for x in stdin.readline().rstrip().split()]\nCA = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]\nknowledge_list = [[0 for _ in range(M)]]\nmoney_list = [0]\nfor i in range(N):\n C = CA[i][0]\n A = CA[i][1:]\n # \u8cfc\u5165\u3059\u308b\u5834\u5408\n tmp2 = []\n for i, knowledge in enumerate(knowledge_list):\n tmp = []\n for k in range(len(knowledge)):\n tmp.append(knowledge[k] + A[k])\n tmp2.append(tmp)\n money_list.append(money_list[i] + C)\n knowledge_list = knowledge_list + tmp2\nans = INF\nfor i in range(len(money_list)):\n if min(knowledge_list[i]) >= X:\n ans = min(ans, money_list[i])\nif ans != INF:\n print(ans)\nelse:\n print((-1))\n","code_v1_no_empty_lines":"from sys import stdin\nimport math\nimport fractions\nfrom collections import deque\nfrom collections import Counter\nimport itertools\n\nINF = 10**10\nN, M, X = [int(x) for x in stdin.readline().rstrip().split()]\nCA = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]\ndp = [[[0 for _ in range(M)] for _ in range(4)] for _ in range(N + 1)]\ndp_money = [[0 for _ in range(2)] for _ in range(N + 1)]\ntm = [0 for _ in range(2**N)]\ntl = [[0 for _ in range(M)] for _ in range(2**N)]\nknowledge_list = [[0 for _ in range(M)]]\nmoney_list = [0]\nfor i in range(N):\n C = CA[i][0]\n A = CA[i][1:]\n # \u8cfc\u5165\u3059\u308b\u5834\u5408\n tmp2 = []\n for i, knowledge in enumerate(knowledge_list):\n tmp = []\n for k in range(len(knowledge)):\n tmp.append(knowledge[k] + A[k])\n tmp2.append(tmp)\n money_list.append(money_list[i] + C)\n knowledge_list = knowledge_list + tmp2\nans = INF\nfor i in range(len(money_list)):\n if min(knowledge_list[i]) >= X:\n ans = min(ans, money_list[i])\nif ans != INF:\n print(ans)\nelse:\n print((-1))\n","code_same":false,"relative_loc_diff_percent":13.7254901961,"diff":["+dp = [[[0 for _ in range(M)] for _ in range(4)] for _ in range(N + 1)]","+dp_money = [[0 for _ in range(2)] for _ in range(N + 1)]","+tm = [0 for _ in range(2**N)]","+tl = [[0 for _ in range(M)] for _ in range(2**N)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.081545887,"measured_runtime_v1":0.0449946964,"runtime_lift":1.8123444214,"key":["s991623893","s159176453"]} +{"user_id":"u157020659","problem_id":"p02824","language":"python","submission_id_v0":"s060866598","submission_id_v1":"s923236336","cpu_time_v0":350,"cpu_time_v1":120,"memory_v0":14480,"memory_v1":14480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.71,"input":"def judge(a, i, m, n, v, p):\n\n if i <= p: return True\n\n if a[i-1] + m < a[p-1]: return False\n\n check = (p + n - i)*m\n\n for j in range(p, i):\n\n check += a[i-1] + m - a[j-1]\n\n return check >= m*v\n\n\n\nn, m, v, p = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\na.sort(reverse=True)\n\nng = n + 1\n\nok = 0\n\n\n\nwhile (ng - ok) > 1:\n\n mid = (ok + ng) \/\/ 2\n\n if judge(a, mid, m, n, v, p):\n\n ok = mid\n\n else:\n\n ng = mid\n\nprint(ok)","target":"def judge(a, acc, i, m, n, v, p):\n\n if i <= p: return True\n\n if a[i-1] + m < a[p-1]: return False\n\n check = (p + n - i)*m + (a[i-1] + m)*(i - p) - (acc[i-2] - acc[p-2])\n\n return check >= m*v\n\n\n\nn, m, v, p = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\na.sort(reverse=True)\n\nacc = [0] * (n+1)\n\nfor i in range(n):\n\n acc[i] = a[0] if i == 0 else a[i] + acc[i-1]\n\nng = n + 1\n\nok = 0\n\n\n\nwhile (ng - ok) > 1:\n\n mid = (ok + ng) \/\/ 2\n\n if judge(a, acc, mid, m, n, v, p):\n\n ok = mid\n\n else:\n\n ng = mid\n\nprint(ok)","code_v0_loc":22,"code_v1_loc":23,"code_v0_num_chars":481,"code_v1_num_chars":562,"code_v0_no_empty_lines":"def judge(a, i, m, n, v, p):\n if i <= p:\n return True\n if a[i - 1] + m < a[p - 1]:\n return False\n check = (p + n - i) * m\n for j in range(p, i):\n check += a[i - 1] + m - a[j - 1]\n return check >= m * v\n\n\nn, m, v, p = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort(reverse=True)\nng = n + 1\nok = 0\nwhile (ng - ok) > 1:\n mid = (ok + ng) \/\/ 2\n if judge(a, mid, m, n, v, p):\n ok = mid\n else:\n ng = mid\nprint(ok)\n","code_v1_no_empty_lines":"def judge(a, acc, i, m, n, v, p):\n if i <= p:\n return True\n if a[i - 1] + m < a[p - 1]:\n return False\n check = (p + n - i) * m + (a[i - 1] + m) * (i - p) - (acc[i - 2] - acc[p - 2])\n return check >= m * v\n\n\nn, m, v, p = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort(reverse=True)\nacc = [0] * (n + 1)\nfor i in range(n):\n acc[i] = a[0] if i == 0 else a[i] + acc[i - 1]\nng = n + 1\nok = 0\nwhile (ng - ok) > 1:\n mid = (ok + ng) \/\/ 2\n if judge(a, acc, mid, m, n, v, p):\n ok = mid\n else:\n ng = mid\nprint(ok)\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["-def judge(a, i, m, n, v, p):","+def judge(a, acc, i, m, n, v, p):","- check = (p + n - i) * m","- for j in range(p, i):","- check += a[i - 1] + m - a[j - 1]","+ check = (p + n - i) * m + (a[i - 1] + m) * (i - p) - (acc[i - 2] - acc[p - 2])","+acc = [0] * (n + 1)","+for i in range(n):","+ acc[i] = a[0] if i == 0 else a[i] + acc[i - 1]","- if judge(a, mid, m, n, v, p):","+ if judge(a, acc, mid, m, n, v, p):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0927057881,"measured_runtime_v1":0.0755024626,"runtime_lift":1.2278511839,"key":["s060866598","s923236336"]} +{"user_id":"u562935282","problem_id":"p03475","language":"python","submission_id_v0":"s657686542","submission_id_v1":"s871370643","cpu_time_v0":90,"cpu_time_v1":50,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.44,"input":"n = int(eval(input()))\n\ncsf = [tuple(map(int, input().split())) for _ in range(n - 1)]#csf\n\nfor i in range(n):\n\n #i:\u8d77\u70b9\n\n t = 0#\u99c5j\u306e\u51fa\u767a\u6642\u523b, \u99c5n\uff08\u6dfb\u3048\u5b57n - 1\uff09\u3067\u306f\u3001\u3053\u306e\u6642\u523b\u304cprint\u3055\u308c\u308b\u306e\u3067\u3001\u521d\u671f\u5024\u306f0\u3068\u3059\u308b\n\n for j in range(i, n - 1):\n\n #j:\u4e57\u8eca\u3059\u308b\u533a\u9593\n\n c_j, s_j, f_j = csf[j]\n\n\n\n #\u99c5j\u306e\u51fa\u767a\u6642\u523b\u3092\u6c42\u3081\u308b\n\n if t < s_j:\n\n t = s_j\n\n elif t % f_j == 0:\n\n pass\n\n #t = t\n\n else:\n\n #\u59cb\u767a\u3088\u308a\u5f8c\u306b\u99c5\u306b\u5230\u7740\u3057\u3001\u99c5\u3067\u96fb\u8eca\u3092\u5f85\u3064\n\n t += f_j - (t % f_j)\n\n t += c_j#\u4e57\u8eca\u3057\u3066\u6b21\u306e\u99c5\u306b\u5230\u7740\u3055\u305b\u308b\n\n print(t)#\u99c5n\uff08\u6dfb\u3048\u5b57n - 1\uff09\u306e\u5230\u7740\u6642\u523b","target":"def main():\n\n from itertools import islice\n\n\n\n N = int(input())\n\n\n\n trains = []\n\n for _ in range(N - 1):\n\n c, s, f = map(int, input().split())\n\n trains.append((c, s, f))\n\n\n\n ans = [0] * N\n\n for i, (ci, si, fi) in enumerate(trains):\n\n curr = si + ci\n\n for j, (cj, sj, fj) in enumerate(islice(trains, i + 1, N, 1)):\n\n if curr < sj: curr = sj\n\n r = curr % fj\n\n if r != 0: curr += (fj - r)\n\n curr += cj\n\n ans[i] = curr\n\n\n\n print(*ans, sep='\\n')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":20,"code_v1_loc":25,"code_v0_num_chars":536,"code_v1_num_chars":585,"code_v0_no_empty_lines":"n = int(eval(input()))\ncsf = [tuple(map(int, input().split())) for _ in range(n - 1)] # csf\nfor i in range(n):\n # i:\u8d77\u70b9\n t = 0 # \u99c5j\u306e\u51fa\u767a\u6642\u523b, \u99c5n\uff08\u6dfb\u3048\u5b57n - 1\uff09\u3067\u306f\u3001\u3053\u306e\u6642\u523b\u304cprint\u3055\u308c\u308b\u306e\u3067\u3001\u521d\u671f\u5024\u306f0\u3068\u3059\u308b\n for j in range(i, n - 1):\n # j:\u4e57\u8eca\u3059\u308b\u533a\u9593\n c_j, s_j, f_j = csf[j]\n # \u99c5j\u306e\u51fa\u767a\u6642\u523b\u3092\u6c42\u3081\u308b\n if t < s_j:\n t = s_j\n elif t % f_j == 0:\n pass\n # t = t\n else:\n # \u59cb\u767a\u3088\u308a\u5f8c\u306b\u99c5\u306b\u5230\u7740\u3057\u3001\u99c5\u3067\u96fb\u8eca\u3092\u5f85\u3064\n t += f_j - (t % f_j)\n t += c_j # \u4e57\u8eca\u3057\u3066\u6b21\u306e\u99c5\u306b\u5230\u7740\u3055\u305b\u308b\n print(t) # \u99c5n\uff08\u6dfb\u3048\u5b57n - 1\uff09\u306e\u5230\u7740\u6642\u523b\n","code_v1_no_empty_lines":"def main():\n from itertools import islice\n\n N = int(input())\n trains = []\n for _ in range(N - 1):\n c, s, f = map(int, input().split())\n trains.append((c, s, f))\n ans = [0] * N\n for i, (ci, si, fi) in enumerate(trains):\n curr = si + ci\n for j, (cj, sj, fj) in enumerate(islice(trains, i + 1, N, 1)):\n if curr < sj:\n curr = sj\n r = curr % fj\n if r != 0:\n curr += fj - r\n curr += cj\n ans[i] = curr\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-n = int(eval(input()))","-csf = [tuple(map(int, input().split())) for _ in range(n - 1)] # csf","-for i in range(n):","- # i:\u8d77\u70b9","- t = 0 # \u99c5j\u306e\u51fa\u767a\u6642\u523b, \u99c5n\uff08\u6dfb\u3048\u5b57n - 1\uff09\u3067\u306f\u3001\u3053\u306e\u6642\u523b\u304cprint\u3055\u308c\u308b\u306e\u3067\u3001\u521d\u671f\u5024\u306f0\u3068\u3059\u308b","- for j in range(i, n - 1):","- # j:\u4e57\u8eca\u3059\u308b\u533a\u9593","- c_j, s_j, f_j = csf[j]","- # \u99c5j\u306e\u51fa\u767a\u6642\u523b\u3092\u6c42\u3081\u308b","- if t < s_j:","- t = s_j","- elif t % f_j == 0:","- pass","- # t = t","- else:","- # \u59cb\u767a\u3088\u308a\u5f8c\u306b\u99c5\u306b\u5230\u7740\u3057\u3001\u99c5\u3067\u96fb\u8eca\u3092\u5f85\u3064","- t += f_j - (t % f_j)","- t += c_j # \u4e57\u8eca\u3057\u3066\u6b21\u306e\u99c5\u306b\u5230\u7740\u3055\u305b\u308b","- print(t) # \u99c5n\uff08\u6dfb\u3048\u5b57n - 1\uff09\u306e\u5230\u7740\u6642\u523b","+def main():","+ from itertools import islice","+","+ N = int(input())","+ trains = []","+ for _ in range(N - 1):","+ c, s, f = map(int, input().split())","+ trains.append((c, s, f))","+ ans = [0] * N","+ for i, (ci, si, fi) in enumerate(trains):","+ curr = si + ci","+ for j, (cj, sj, fj) in enumerate(islice(trains, i + 1, N, 1)):","+ if curr < sj:","+ curr = sj","+ r = curr % fj","+ if r != 0:","+ curr += fj - r","+ curr += cj","+ ans[i] = curr","+ print(*ans, sep=\"\\n\")","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0454199088,"measured_runtime_v1":0.0475246222,"runtime_lift":0.9557131998,"key":["s657686542","s871370643"]} +{"user_id":"u173148629","problem_id":"p02762","language":"python","submission_id_v0":"s329885201","submission_id_v1":"s790866976","cpu_time_v0":1325,"cpu_time_v1":1156,"memory_v0":6404,"memory_v1":6428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.75,"input":"N,M,K=map(int,input().split())\n\n\n\npar=[-1]*N\n\nnum=[0]*N\n\n\n\ndef find(x):\n\n if par[x-1]<0:\n\n return x\n\n else:\n\n par[x-1]=find(par[x-1])\n\n return par[x-1]\n\n\n\ndef union(x,y):\n\n if find(x)==find(y):\n\n return\n\n if find(x)>find(y):\n\n x,y=y,x\n\n par[find(x)-1]+=par[find(y)-1]\n\n par[find(y)-1]=find(x) \n\n\n\ndef size(x):\n\n return -par[find(x)-1]\n\n\n\ndef same(x,y):\n\n return find(x)==find(y)\n\n \n\n\n\nfor _ in range(M):\n\n a,b=map(int,input().split())\n\n union(a,b)\n\n num[a-1]+=1\n\n num[b-1]+=1\n\n\n\nfor _ in range(K):\n\n c,d=map(int,input().split())\n\n if same(c,d):\n\n num[c-1]+=1\n\n num[d-1]+=1\n\n\n\nfor i in range(N):\n\n print(size(i+1)-1-num[i],end=\" \")\n","target":"N,M,K=map(int,input().split())\n\n\n\npar=[-1]*N\n\nnum=[0]*N\n\n\n\ndef find(x):\n\n if par[x-1]<0:\n\n return x\n\n else:\n\n par[x-1]=find(par[x-1])\n\n return par[x-1]\n\n\n\ndef union(x,y):\n\n p,q=find(x),find(y)\n\n if p==q:\n\n return\n\n if p>q:\n\n p,q=q,p\n\n par[p-1]+=par[q-1]\n\n par[q-1]=p \n\n\n\ndef size(x):\n\n return -par[find(x)-1]\n\n\n\ndef same(x,y):\n\n return find(x)==find(y)\n\n \n\n\n\nfor _ in range(M):\n\n a,b=map(int,input().split())\n\n union(a,b)\n\n num[a-1]+=1\n\n num[b-1]+=1\n\n\n\nfor _ in range(K):\n\n c,d=map(int,input().split())\n\n if same(c,d):\n\n num[c-1]+=1\n\n num[d-1]+=1\n\n\n\nfor i in range(N):\n\n print(size(i+1)-1-num[i],end=\" \")\n","code_v0_loc":41,"code_v1_loc":42,"code_v0_num_chars":734,"code_v1_num_chars":710,"code_v0_no_empty_lines":"N, M, K = map(int, input().split())\npar = [-1] * N\nnum = [0] * N\n\n\ndef find(x):\n if par[x - 1] < 0:\n return x\n else:\n par[x - 1] = find(par[x - 1])\n return par[x - 1]\n\n\ndef union(x, y):\n if find(x) == find(y):\n return\n if find(x) > find(y):\n x, y = y, x\n par[find(x) - 1] += par[find(y) - 1]\n par[find(y) - 1] = find(x)\n\n\ndef size(x):\n return -par[find(x) - 1]\n\n\ndef same(x, y):\n return find(x) == find(y)\n\n\nfor _ in range(M):\n a, b = map(int, input().split())\n union(a, b)\n num[a - 1] += 1\n num[b - 1] += 1\nfor _ in range(K):\n c, d = map(int, input().split())\n if same(c, d):\n num[c - 1] += 1\n num[d - 1] += 1\nfor i in range(N):\n print(size(i + 1) - 1 - num[i], end=\" \")\n","code_v1_no_empty_lines":"N, M, K = map(int, input().split())\npar = [-1] * N\nnum = [0] * N\n\n\ndef find(x):\n if par[x - 1] < 0:\n return x\n else:\n par[x - 1] = find(par[x - 1])\n return par[x - 1]\n\n\ndef union(x, y):\n p, q = find(x), find(y)\n if p == q:\n return\n if p > q:\n p, q = q, p\n par[p - 1] += par[q - 1]\n par[q - 1] = p\n\n\ndef size(x):\n return -par[find(x) - 1]\n\n\ndef same(x, y):\n return find(x) == find(y)\n\n\nfor _ in range(M):\n a, b = map(int, input().split())\n union(a, b)\n num[a - 1] += 1\n num[b - 1] += 1\nfor _ in range(K):\n c, d = map(int, input().split())\n if same(c, d):\n num[c - 1] += 1\n num[d - 1] += 1\nfor i in range(N):\n print(size(i + 1) - 1 - num[i], end=\" \")\n","code_same":false,"relative_loc_diff_percent":2.380952381,"diff":["- if find(x) == find(y):","+ p, q = find(x), find(y)","+ if p == q:","- if find(x) > find(y):","- x, y = y, x","- par[find(x) - 1] += par[find(y) - 1]","- par[find(y) - 1] = find(x)","+ if p > q:","+ p, q = q, p","+ par[p - 1] += par[q - 1]","+ par[q - 1] = p"],"diff_only_import_comment":false,"measured_runtime_v0":0.0380455012,"measured_runtime_v1":0.0378828719,"runtime_lift":1.0042929521,"key":["s329885201","s790866976"]} +{"user_id":"u094191970","problem_id":"p02573","language":"python","submission_id_v0":"s216023793","submission_id_v1":"s178917795","cpu_time_v0":639,"cpu_time_v1":415,"memory_v0":49924,"memory_v1":18488,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.05,"input":"from sys import stdin\n\nnii=lambda:list(map(int,stdin.readline().split()))\n\nlnii=lambda:list(map(int,stdin.readline().split()))\n\n\n\nn,m=nii()\n\nl=[lnii() for i in range(m)]\n\n\n\nclass UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n\n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n\n\nuf=UnionFind(n)\n\nfor a,b, in l:\n\n a-=1\n\n b-=1\n\n if uf.same(a,b)==False:\n\n uf.union(a,b)\n\n\n\nans=0\n\nroots=uf.roots()\n\nfor i in uf.roots():\n\n ans=max(ans,uf.size(i))\n\nprint(ans)","target":"from sys import stdin\n\nnii=lambda:list(map(int,stdin.readline().split()))\n\nlnii=lambda:list(map(int,stdin.readline().split()))\n\n\n\nclass UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n\n\n def members(self, x):\n\n root = self.find(x)\n\n return [i for i in range(self.n) if self.find(i) == root]\n\n\n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n\n\n def group_count(self):\n\n return len(self.roots())\n\n\n\n def all_group_members(self):\n\n return {r: self.members(r) for r in self.roots()}\n\n\n\n def __str__(self):\n\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\n\n\nn,m=nii()\n\nuf=UnionFind(n)\n\nfor i in range(m):\n\n a,b=nii()\n\n a-=1\n\n b-=1\n\n uf.union(a,b)\n\n\n\nroot=uf.roots()\n\nans=0\n\nfor i in root:\n\n ans=max(ans,uf.size(i))\n\n\n\nprint(ans)","code_v0_loc":53,"code_v1_loc":65,"code_v0_num_chars":1147,"code_v1_num_chars":1493,"code_v0_no_empty_lines":"from sys import stdin\n\nnii = lambda: list(map(int, stdin.readline().split()))\nlnii = lambda: list(map(int, stdin.readline().split()))\nn, m = nii()\nl = [lnii() for i in range(m)]\n\n\nclass UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n\nuf = UnionFind(n)\nfor (\n a,\n b,\n) in l:\n a -= 1\n b -= 1\n if uf.same(a, b) == False:\n uf.union(a, b)\nans = 0\nroots = uf.roots()\nfor i in uf.roots():\n ans = max(ans, uf.size(i))\nprint(ans)\n","code_v1_no_empty_lines":"from sys import stdin\n\nnii = lambda: list(map(int, stdin.readline().split()))\nlnii = lambda: list(map(int, stdin.readline().split()))\n\n\nclass UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())\n\n\nn, m = nii()\nuf = UnionFind(n)\nfor i in range(m):\n a, b = nii()\n a -= 1\n b -= 1\n uf.union(a, b)\nroot = uf.roots()\nans = 0\nfor i in root:\n ans = max(ans, uf.size(i))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.4615384615,"diff":["-n, m = nii()","-l = [lnii() for i in range(m)]","+ def members(self, x):","+ root = self.find(x)","+ return [i for i in range(self.n) if self.find(i) == root]","+","+ def group_count(self):","+ return len(self.roots())","+ def all_group_members(self):","+ return {r: self.members(r) for r in self.roots()}","+","+ def __str__(self):","+ return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())","+","+","+n, m = nii()","-for (","- a,","- b,","-) in l:","+for i in range(m):","+ a, b = nii()","- if uf.same(a, b) == False:","- uf.union(a, b)","+ uf.union(a, b)","+root = uf.roots()","-roots = uf.roots()","-for i in uf.roots():","+for i in root:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0368053212,"measured_runtime_v1":0.0379070334,"runtime_lift":0.9709364691,"key":["s216023793","s178917795"]} +{"user_id":"u077898957","problem_id":"p03434","language":"python","submission_id_v0":"s889038184","submission_id_v1":"s222088220","cpu_time_v0":177,"cpu_time_v1":18,"memory_v0":13092,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.83,"input":"import numpy as np\n\nimport sys\n\nn = int(eval(input()))\n\na = sorted(list(map(int,input().split())))[::-1]\n\nprint((sum(a[::2])-sum(a[1::2])))\n","target":"n=int(eval(input()))\n\na=sorted(list(map(int,input().split())))[::-1]\n\nans=0\n\nfor i in range(n):\n\n if i%2==0:\n\n ans+=a[i]\n\n else:\n\n ans-=a[i]\n\nprint(ans)\n","code_v0_loc":5,"code_v1_loc":9,"code_v0_num_chars":132,"code_v1_num_chars":167,"code_v0_no_empty_lines":"import numpy as np\nimport sys\n\nn = int(eval(input()))\na = sorted(list(map(int, input().split())))[::-1]\nprint((sum(a[::2]) - sum(a[1::2])))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = sorted(list(map(int, input().split())))[::-1]\nans = 0\nfor i in range(n):\n if i % 2 == 0:\n ans += a[i]\n else:\n ans -= a[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-import numpy as np","-import sys","-","-print((sum(a[::2]) - sum(a[1::2])))","+ans = 0","+for i in range(n):","+ if i % 2 == 0:","+ ans += a[i]","+ else:","+ ans -= a[i]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0465611353,"measured_runtime_v1":0.0417098906,"runtime_lift":1.116309216,"key":["s889038184","s222088220"]} +{"user_id":"u368796742","problem_id":"p04014","language":"python","submission_id_v0":"s655485424","submission_id_v1":"s844833669","cpu_time_v0":717,"cpu_time_v1":642,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.46,"input":"n = int(eval(input()))\n\ns = int(eval(input()))\n\nif s == 1 and n == 1:\n\n print((2))\n\n exit()\n\nif s > n:\n\n print((-1))\n\n exit()\n\nif n%2 == 0 and n > s > n\/\/2:\n\n print((-1))\n\n exit()\n\nif n%2 == 1 and n > s > n\/\/2+1:\n\n print((-1))\n\n exit()\n\n\n\nans = float(\"INF\")\n\nfor i in range(2,int(n**0.5)+1):\n\n x = n\n\n count = 0\n\n while x >= i:\n\n count += x%i\n\n x \/\/= i\n\n if count + x == s:\n\n print(i)\n\n exit()\n\nnow = 2\n\nli = int(n**0.5)+1\n\nwhile True:\n\n\n\n x = n\/\/now\n\n if x < li:\n\n break\n\n count = 0\n\n y = n\n\n while y >= x:\n\n count += y%x\n\n y \/\/= x\n\n count += y\n\n if count <= s and (s-count)%now == 0:\n\n z = x-n\/\/(now+1)\n\n if (s-count)\/\/now < z:\n\n ans = x-(s-count)\/\/now\n\n now += 1\n\n\n\nif s == n:\n\n print((min(ans,n+1)))\n\nelse:\n\n print((min(ans,n-s+1)))\n","target":"n = int(eval(input()))\n\ns = int(eval(input()))\n\nif s == n:\n\n print((n+1))\n\n exit()\n\nif s > n%2+n\/\/2:\n\n print((-1))\n\n exit()\n\n \n\n\n\nans = float(\"INF\")\n\nfor i in range(2,int(n**0.5)+1):\n\n x = n\n\n count = 0\n\n while x >= i:\n\n count += x%i\n\n x \/\/= i\n\n if count + x == s:\n\n print(i)\n\n exit()\n\nnow = 2\n\nli = int(n**0.5)+1\n\nwhile True:\n\n\n\n x = n\/\/now\n\n if x < li:\n\n break\n\n count = 0\n\n y = n\n\n while y >= x:\n\n count += y%x\n\n y \/\/= x\n\n count += y\n\n if count <= s and (s-count)%now == 0:\n\n z = x-n\/\/(now+1)\n\n if (s-count)\/\/now < z:\n\n ans = x-(s-count)\/\/now\n\n now += 1\n\n\n\n\n\n\n\nprint((min(ans,n-s+1)))\n","code_v0_loc":48,"code_v1_loc":42,"code_v0_num_chars":853,"code_v1_num_chars":695,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = int(eval(input()))\nif s == 1 and n == 1:\n print((2))\n exit()\nif s > n:\n print((-1))\n exit()\nif n % 2 == 0 and n > s > n \/\/ 2:\n print((-1))\n exit()\nif n % 2 == 1 and n > s > n \/\/ 2 + 1:\n print((-1))\n exit()\nans = float(\"INF\")\nfor i in range(2, int(n**0.5) + 1):\n x = n\n count = 0\n while x >= i:\n count += x % i\n x \/\/= i\n if count + x == s:\n print(i)\n exit()\nnow = 2\nli = int(n**0.5) + 1\nwhile True:\n x = n \/\/ now\n if x < li:\n break\n count = 0\n y = n\n while y >= x:\n count += y % x\n y \/\/= x\n count += y\n if count <= s and (s - count) % now == 0:\n z = x - n \/\/ (now + 1)\n if (s - count) \/\/ now < z:\n ans = x - (s - count) \/\/ now\n now += 1\nif s == n:\n print((min(ans, n + 1)))\nelse:\n print((min(ans, n - s + 1)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = int(eval(input()))\nif s == n:\n print((n + 1))\n exit()\nif s > n % 2 + n \/\/ 2:\n print((-1))\n exit()\nans = float(\"INF\")\nfor i in range(2, int(n**0.5) + 1):\n x = n\n count = 0\n while x >= i:\n count += x % i\n x \/\/= i\n if count + x == s:\n print(i)\n exit()\nnow = 2\nli = int(n**0.5) + 1\nwhile True:\n x = n \/\/ now\n if x < li:\n break\n count = 0\n y = n\n while y >= x:\n count += y % x\n y \/\/= x\n count += y\n if count <= s and (s - count) % now == 0:\n z = x - n \/\/ (now + 1)\n if (s - count) \/\/ now < z:\n ans = x - (s - count) \/\/ now\n now += 1\nprint((min(ans, n - s + 1)))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-if s == 1 and n == 1:","- print((2))","+if s == n:","+ print((n + 1))","-if s > n:","- print((-1))","- exit()","-if n % 2 == 0 and n > s > n \/\/ 2:","- print((-1))","- exit()","-if n % 2 == 1 and n > s > n \/\/ 2 + 1:","+if s > n % 2 + n \/\/ 2:","-if s == n:","- print((min(ans, n + 1)))","-else:","- print((min(ans, n - s + 1)))","+print((min(ans, n - s + 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1476332987,"measured_runtime_v1":0.1484567366,"runtime_lift":0.9944533474,"key":["s655485424","s844833669"]} +{"user_id":"u537905693","problem_id":"p03318","language":"python","submission_id_v0":"s761048452","submission_id_v1":"s257273109","cpu_time_v0":330,"cpu_time_v1":22,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.33,"input":"#!\/usr\/bin\/env python\n\n# coding: utf-8\n\n\n\ndef ri():\n\n return int(eval(input()))\n\n\n\ndef rl():\n\n return list(input().split())\n\n\n\ndef rli():\n\n return list(map(int, input().split()))\n\n\n\ndef calc(n):\n\n s = sum(map(int, str(n)))\n\n return n \/ s\n\n\n\ndef f(n):\n\n ld = list(map(int, str(n)))\n\n cand = []\n\n for i in range(len(ld)-1):\n\n d = len(ld)-1-i\n\n ld[d] = 9\n\n for i in range(1, 10):\n\n if i < ld[d-1]:\n\n continue\n\n ld[d-1] = i\n\n p = int(\"\".join(map(str, ld)))\n\n cand.append((calc(p), p))\n\n cand.sort()\n\n return cand[0][1]\n\n\n\nMAX = 10**15\n\ndef main():\n\n k = ri()\n\n cand = list(range(1, 10))\n\n n = 10\n\n while True:\n\n if n > MAX:\n\n break\n\n p = f(n)\n\n cand.append(p)\n\n n = p+1\n\n print((\"\\n\".join(map(str, cand[:k]))))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#!\/usr\/bin\/env python\n\n# coding: utf-8\n\n\n\ndef ri():\n\n return int(eval(input()))\n\n\n\ndef rl():\n\n return list(input().split())\n\n\n\ndef rli():\n\n return list(map(int, input().split()))\n\n\n\ndef calc(n):\n\n s = sum(map(int, str(n)))\n\n return n \/ s\n\n\n\ndef main():\n\n k = ri()\n\n cand = list(range(1, 10))\n\n last = 9\n\n for n in range(1, 15):\n\n pow10n = pow(10, n)\n\n for d in range(1, 10):\n\n lim = (d+1)*pow10n\n\n e = 0\n\n while True:\n\n e1 = d*pow10n+e*(last+1)+last\n\n if e1 >= lim:\n\n break\n\n e2 = e1 + (last+1)\n\n if calc(e1) > calc(e2):\n\n last = last*10+9\n\n e = 0\n\n continue\n\n cand.append(e1)\n\n e += 1\n\n cand = sorted(list(set(cand)))\n\n print((\"\\n\".join(map(str, cand[:k]))))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n\"\"\"\n\n1 1.0\n\n2 1.0\n\n3 1.0\n\n4 1.0\n\n5 1.0\n\n6 1.0\n\n7 1.0\n\n8 1.0\n\n9 1.0\n\n19 1.9\n\n29 2.6363636363636362\n\n39 3.25\n\n49 3.769230769230769\n\n59 4.214285714285714\n\n69 4.6\n\n79 4.9375\n\n89 5.235294117647059\n\n99 5.5\n\n199 10.473684210526315\n\n299 14.95\n\n399 19.0\n\n499 22.681818181818183\n\n599 26.043478260869566\n\n699 29.125\n\n799 31.96\n\n899 34.57692307692308\n\n999 37.0\n\n1099 57.8421052631579\n\n1199 59.95\n\n1299 61.857142857142854\n\n1399 63.59090909090909\n\n1499 65.17391304347827\n\n1599 66.625\n\n1699 67.96\n\n1799 69.1923076923077\n\n1899 70.33333333333333\n\n1999 71.39285714285714\n\n2999 103.41379310344827\n\n3999 133.3\n\n4999 161.25806451612902\n\n5999 187.46875\n\n6999 212.0909090909091\n\n7999 235.26470588235293\n\n8999 257.1142857142857\n\n9999 277.75\n\n10999 392.82142857142856\n\n11999 413.7586206896552\n\n12999 433.3\n\n13999 451.5806451612903\n\n14999 468.71875\n\n15999 484.8181818181818\n\n16999 499.97058823529414\n\n17999 514.2571428571429\n\n18999 527.75\n\n19999 540.5135135135135\n\n20999 724.1034482758621\n\n21999 733.3\n\n22999 741.9032258064516\n\n23999 749.96875\n\n24999 757.5454545454545\n\n25999 764.6764705882352\n\n26999 771.4\n\n27999 777.75\n\n28999 783.7567567567568\n\n29999 789.4473684210526\n\n39999 1025.6153846153845\n\n49999 1249.975\n\n59999 1463.3902439024391\n\n69999 1666.642857142857\n\n79999 1860.4418604651162\n\n89999 2045.4318181818182\n\n99999 2222.2\n\n109999 2972.945945945946\n\n119999 3157.8684210526317\n\n129999 3333.3076923076924\n\n139999 3499.975\n\n149999 3658.512195121951\n\n159999 3809.5\n\n169999 3953.4651162790697\n\n179999 4090.8863636363635\n\n189999 4222.2\n\n199999 4347.804347826087\n\n209999 5526.289473684211\n\n219999 5641.0\n\n229999 5749.975\n\n239999 5853.634146341464\n\n249999 5952.357142857143\n\n259999 6046.488372093023\n\n269999 6136.340909090909\n\n279999 6222.2\n\n289999 6304.326086956522\n\n299999 6382.95744680851\n\n309999 7948.692307692308\n\n319999 7999.975\n\n329999 8048.756097560976\n\n339999 8095.214285714285\n\n349999 8139.511627906977\n\n359999 8181.795454545455\n\n369999 8222.2\n\n379999 8260.847826086956\n\n389999 8297.851063829787\n\n399999 8333.3125\n\n499999 10204.061224489797\n\n599999 11999.98\n\n699999 13725.470588235294\n\n799999 15384.596153846154\n\n899999 16981.11320754717\n\n999999 18518.5\n\n\"\"\"\n\n\n","code_v0_loc":47,"code_v1_loc":154,"code_v0_num_chars":907,"code_v1_num_chars":3089,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python\n# coding: utf-8\ndef ri():\n return int(eval(input()))\n\n\ndef rl():\n return list(input().split())\n\n\ndef rli():\n return list(map(int, input().split()))\n\n\ndef calc(n):\n s = sum(map(int, str(n)))\n return n \/ s\n\n\ndef f(n):\n ld = list(map(int, str(n)))\n cand = []\n for i in range(len(ld) - 1):\n d = len(ld) - 1 - i\n ld[d] = 9\n for i in range(1, 10):\n if i < ld[d - 1]:\n continue\n ld[d - 1] = i\n p = int(\"\".join(map(str, ld)))\n cand.append((calc(p), p))\n cand.sort()\n return cand[0][1]\n\n\nMAX = 10**15\n\n\ndef main():\n k = ri()\n cand = list(range(1, 10))\n n = 10\n while True:\n if n > MAX:\n break\n p = f(n)\n cand.append(p)\n n = p + 1\n print((\"\\n\".join(map(str, cand[:k]))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python\n# coding: utf-8\ndef ri():\n return int(eval(input()))\n\n\ndef rl():\n return list(input().split())\n\n\ndef rli():\n return list(map(int, input().split()))\n\n\ndef calc(n):\n s = sum(map(int, str(n)))\n return n \/ s\n\n\ndef main():\n k = ri()\n cand = list(range(1, 10))\n last = 9\n for n in range(1, 15):\n pow10n = pow(10, n)\n for d in range(1, 10):\n lim = (d + 1) * pow10n\n e = 0\n while True:\n e1 = d * pow10n + e * (last + 1) + last\n if e1 >= lim:\n break\n e2 = e1 + (last + 1)\n if calc(e1) > calc(e2):\n last = last * 10 + 9\n e = 0\n continue\n cand.append(e1)\n e += 1\n cand = sorted(list(set(cand)))\n print((\"\\n\".join(map(str, cand[:k]))))\n\n\nif __name__ == \"__main__\":\n main()\n\"\"\"\n1 1.0\n2 1.0\n3 1.0\n4 1.0\n5 1.0\n6 1.0\n7 1.0\n8 1.0\n9 1.0\n19 1.9\n29 2.6363636363636362\n39 3.25\n49 3.769230769230769\n59 4.214285714285714\n69 4.6\n79 4.9375\n89 5.235294117647059\n99 5.5\n199 10.473684210526315\n299 14.95\n399 19.0\n499 22.681818181818183\n599 26.043478260869566\n699 29.125\n799 31.96\n899 34.57692307692308\n999 37.0\n1099 57.8421052631579\n1199 59.95\n1299 61.857142857142854\n1399 63.59090909090909\n1499 65.17391304347827\n1599 66.625\n1699 67.96\n1799 69.1923076923077\n1899 70.33333333333333\n1999 71.39285714285714\n2999 103.41379310344827\n3999 133.3\n4999 161.25806451612902\n5999 187.46875\n6999 212.0909090909091\n7999 235.26470588235293\n8999 257.1142857142857\n9999 277.75\n10999 392.82142857142856\n11999 413.7586206896552\n12999 433.3\n13999 451.5806451612903\n14999 468.71875\n15999 484.8181818181818\n16999 499.97058823529414\n17999 514.2571428571429\n18999 527.75\n19999 540.5135135135135\n20999 724.1034482758621\n21999 733.3\n22999 741.9032258064516\n23999 749.96875\n24999 757.5454545454545\n25999 764.6764705882352\n26999 771.4\n27999 777.75\n28999 783.7567567567568\n29999 789.4473684210526\n39999 1025.6153846153845\n49999 1249.975\n59999 1463.3902439024391\n69999 1666.642857142857\n79999 1860.4418604651162\n89999 2045.4318181818182\n99999 2222.2\n109999 2972.945945945946\n119999 3157.8684210526317\n129999 3333.3076923076924\n139999 3499.975\n149999 3658.512195121951\n159999 3809.5\n169999 3953.4651162790697\n179999 4090.8863636363635\n189999 4222.2\n199999 4347.804347826087\n209999 5526.289473684211\n219999 5641.0\n229999 5749.975\n239999 5853.634146341464\n249999 5952.357142857143\n259999 6046.488372093023\n269999 6136.340909090909\n279999 6222.2\n289999 6304.326086956522\n299999 6382.95744680851\n309999 7948.692307692308\n319999 7999.975\n329999 8048.756097560976\n339999 8095.214285714285\n349999 8139.511627906977\n359999 8181.795454545455\n369999 8222.2\n379999 8260.847826086956\n389999 8297.851063829787\n399999 8333.3125\n499999 10204.061224489797\n599999 11999.98\n699999 13725.470588235294\n799999 15384.596153846154\n899999 16981.11320754717\n999999 18518.5\n\"\"\"\n","code_same":false,"relative_loc_diff_percent":69.4805194805,"diff":["-def f(n):","- ld = list(map(int, str(n)))","- cand = []","- for i in range(len(ld) - 1):","- d = len(ld) - 1 - i","- ld[d] = 9","- for i in range(1, 10):","- if i < ld[d - 1]:","- continue","- ld[d - 1] = i","- p = int(\"\".join(map(str, ld)))","- cand.append((calc(p), p))","- cand.sort()","- return cand[0][1]","-","-","-MAX = 10**15","-","-","- n = 10","- while True:","- if n > MAX:","- break","- p = f(n)","- cand.append(p)","- n = p + 1","+ last = 9","+ for n in range(1, 15):","+ pow10n = pow(10, n)","+ for d in range(1, 10):","+ lim = (d + 1) * pow10n","+ e = 0","+ while True:","+ e1 = d * pow10n + e * (last + 1) + last","+ if e1 >= lim:","+ break","+ e2 = e1 + (last + 1)","+ if calc(e1) > calc(e2):","+ last = last * 10 + 9","+ e = 0","+ continue","+ cand.append(e1)","+ e += 1","+ cand = sorted(list(set(cand)))","+\"\"\"","+1 1.0","+2 1.0","+3 1.0","+4 1.0","+5 1.0","+6 1.0","+7 1.0","+8 1.0","+9 1.0","+19 1.9","+29 2.6363636363636362","+39 3.25","+49 3.769230769230769","+59 4.214285714285714","+69 4.6","+79 4.9375","+89 5.235294117647059","+99 5.5","+199 10.473684210526315","+299 14.95","+399 19.0","+499 22.681818181818183","+599 26.043478260869566","+699 29.125","+799 31.96","+899 34.57692307692308","+999 37.0","+1099 57.8421052631579","+1199 59.95","+1299 61.857142857142854","+1399 63.59090909090909","+1499 65.17391304347827","+1599 66.625","+1699 67.96","+1799 69.1923076923077","+1899 70.33333333333333","+1999 71.39285714285714","+2999 103.41379310344827","+3999 133.3","+4999 161.25806451612902","+5999 187.46875","+6999 212.0909090909091","+7999 235.26470588235293","+8999 257.1142857142857","+9999 277.75","+10999 392.82142857142856","+11999 413.7586206896552","+12999 433.3","+13999 451.5806451612903","+14999 468.71875","+15999 484.8181818181818","+16999 499.97058823529414","+17999 514.2571428571429","+18999 527.75","+19999 540.5135135135135","+20999 724.1034482758621","+21999 733.3","+22999 741.9032258064516","+23999 749.96875","+24999 757.5454545454545","+25999 764.6764705882352","+26999 771.4","+27999 777.75","+28999 783.7567567567568","+29999 789.4473684210526","+39999 1025.6153846153845","+49999 1249.975","+59999 1463.3902439024391","+69999 1666.642857142857","+79999 1860.4418604651162","+89999 2045.4318181818182","+99999 2222.2","+109999 2972.945945945946","+119999 3157.8684210526317","+129999 3333.3076923076924","+139999 3499.975","+149999 3658.512195121951","+159999 3809.5","+169999 3953.4651162790697","+179999 4090.8863636363635","+189999 4222.2","+199999 4347.804347826087","+209999 5526.289473684211","+219999 5641.0","+229999 5749.975","+239999 5853.634146341464","+249999 5952.357142857143","+259999 6046.488372093023","+269999 6136.340909090909","+279999 6222.2","+289999 6304.326086956522","+299999 6382.95744680851","+309999 7948.692307692308","+319999 7999.975","+329999 8048.756097560976","+339999 8095.214285714285","+349999 8139.511627906977","+359999 8181.795454545455","+369999 8222.2","+379999 8260.847826086956","+389999 8297.851063829787","+399999 8333.3125","+499999 10204.061224489797","+599999 11999.98","+699999 13725.470588235294","+799999 15384.596153846154","+899999 16981.11320754717","+999999 18518.5","+\"\"\""],"diff_only_import_comment":false,"measured_runtime_v0":1.4742169905,"measured_runtime_v1":0.0391613038,"runtime_lift":37.6447372432,"key":["s761048452","s257273109"]} +{"user_id":"u865067466","problem_id":"p03208","language":"python","submission_id_v0":"s898097810","submission_id_v1":"s409822743","cpu_time_v0":221,"cpu_time_v1":97,"memory_v0":8280,"memory_v1":14092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.11,"input":"N, K = list(map(int, input().split()))\n\ntrees = [int(eval(input())) for i in range(N)]\n\ntrees = sorted(trees)\n\n\n\nresult = min(trees[i+K-1] - trees[i] for i in range(N-K+1))\n\n\n\nprint(result)\n","target":"N, K, *trees = list(map(int, open(0).read().split()))\n\ntrees = sorted(trees)\n\nprint((min(trees[i+K-1] - trees[i] for i in range(N-K+1))))\n","code_v0_loc":7,"code_v1_loc":3,"code_v0_num_chars":178,"code_v1_num_chars":130,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\ntrees = [int(eval(input())) for i in range(N)]\ntrees = sorted(trees)\nresult = min(trees[i + K - 1] - trees[i] for i in range(N - K + 1))\nprint(result)\n","code_v1_no_empty_lines":"N, K, *trees = list(map(int, open(0).read().split()))\ntrees = sorted(trees)\nprint((min(trees[i + K - 1] - trees[i] for i in range(N - K + 1))))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-N, K = list(map(int, input().split()))","-trees = [int(eval(input())) for i in range(N)]","+N, K, *trees = list(map(int, open(0).read().split()))","-result = min(trees[i + K - 1] - trees[i] for i in range(N - K + 1))","-print(result)","+print((min(trees[i + K - 1] - trees[i] for i in range(N - K + 1))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.045745146,"measured_runtime_v1":0.0475437989,"runtime_lift":0.962168507,"key":["s898097810","s409822743"]} +{"user_id":"u606045429","problem_id":"p03063","language":"python","submission_id_v0":"s041078339","submission_id_v1":"s646769426","cpu_time_v0":127,"cpu_time_v1":112,"memory_v0":3444,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.81,"input":"import sys\n\n\n\nN, S = int(sys.stdin.readline()), sys.stdin.readline()\n\n\n\nb, w = 0, S.count('.')\n\n\n\nans = b + w\n\nfor si in S:\n\n if si == \"#\":\n\n b += 1\n\n if si == \".\":\n\n w -= 1\n\n ans = min(ans, b + w)\n\n\n\nprint(ans)\n","target":"N, S = int(eval(input())), eval(input())\n\nb, w = 0, S.count('.')\n\nans = b + w\n\nfor si in S:\n\n if si == \"#\":\n\n b += 1\n\n else:\n\n w -= 1\n\n ans = min(ans, b + w)\n\nprint(ans)\n","code_v0_loc":15,"code_v1_loc":10,"code_v0_num_chars":235,"code_v1_num_chars":181,"code_v0_no_empty_lines":"import sys\n\nN, S = int(sys.stdin.readline()), sys.stdin.readline()\nb, w = 0, S.count(\".\")\nans = b + w\nfor si in S:\n if si == \"#\":\n b += 1\n if si == \".\":\n w -= 1\n ans = min(ans, b + w)\nprint(ans)\n","code_v1_no_empty_lines":"N, S = int(eval(input())), eval(input())\nb, w = 0, S.count(\".\")\nans = b + w\nfor si in S:\n if si == \"#\":\n b += 1\n else:\n w -= 1\n ans = min(ans, b + w)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-import sys","-","-N, S = int(sys.stdin.readline()), sys.stdin.readline()","+N, S = int(eval(input())), eval(input())","- if si == \".\":","+ else:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0382165432,"measured_runtime_v1":0.070218277,"runtime_lift":0.5442535026,"key":["s041078339","s646769426"]} +{"user_id":"u599547273","problem_id":"p03295","language":"python","submission_id_v0":"s584225640","submission_id_v1":"s733176438","cpu_time_v0":511,"cpu_time_v1":418,"memory_v0":29452,"memory_v1":29100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.2,"input":"n, m = list(map(int, input().split(\" \")))\n\nab = [list(map(int, input().split(\" \"))) for _ in range(m)]\n\n\n\nab.sort(key=lambda x: x[1])\n\n\n\ncount = 0\n\nx = 0\n\nfor a_i, b_i in ab:\n\n\tif a_i <= x < b_i:\n\n\t\tcontinue\n\n\tx = b_i-1\n\n\tcount += 1\n\n\n\nprint(count)","target":"n, m = list(map(int, input().split(\" \")))\n\nab = [list(map(int, input().split(\" \"))) for _ in range(m)]\n\n\n\nab.sort(key=lambda x: x[1])\n\n\n\ncount = 0\n\nbefore = 0\n\nfor a_i, b_i in ab:\n\n\tif before > a_i:\n\n\t\tcontinue\n\n\tbefore = b_i\n\n\tcount += 1\n\n\n\nprint(count)","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":242,"code_v1_num_chars":248,"code_v0_no_empty_lines":"n, m = list(map(int, input().split(\" \")))\nab = [list(map(int, input().split(\" \"))) for _ in range(m)]\nab.sort(key=lambda x: x[1])\ncount = 0\nx = 0\nfor a_i, b_i in ab:\n if a_i <= x < b_i:\n continue\n x = b_i - 1\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split(\" \")))\nab = [list(map(int, input().split(\" \"))) for _ in range(m)]\nab.sort(key=lambda x: x[1])\ncount = 0\nbefore = 0\nfor a_i, b_i in ab:\n if before > a_i:\n continue\n before = b_i\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-x = 0","+before = 0","- if a_i <= x < b_i:","+ if before > a_i:","- x = b_i - 1","+ before = b_i"],"diff_only_import_comment":false,"measured_runtime_v0":0.0440622904,"measured_runtime_v1":0.0431973996,"runtime_lift":1.0200218256,"key":["s584225640","s733176438"]} +{"user_id":"u353797797","problem_id":"p03172","language":"python","submission_id_v0":"s489328941","submission_id_v1":"s543751610","cpu_time_v0":1857,"cpu_time_v1":392,"memory_v0":12368,"memory_v1":14744,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.89,"input":"def f(n, k, a_s):\n\n md = 10 ** 9 + 7\n\n dp = [0] * (k + 1)\n\n dp[0] = 1\n\n for a in a_s[:-1]:\n\n ndp = [0] * (k + 1)\n\n ndp[0] = s = dp[0] % md\n\n for j in range(1, a + 1):\n\n ndp[j] = s = (s + dp[j]) % md\n\n for j in range(a + 1, k + 1):\n\n ndp[j] = s = (s + dp[j] - dp[j - a - 1]) % md\n\n dp = ndp\n\n return sum(dp[k - a_s[-1]:]) % md\n\n\n\n\n\nn, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\nprint((f(n, k, a_s)))\n","target":"import numpy as np\n\n\n\n\n\ndef f(n, k, a_s):\n\n md = 10 ** 9 + 7\n\n dp = np.zeros(k + 1, dtype=np.int64)\n\n dp[0] = 1\n\n for a in a_s[:-1]:\n\n dp = np.cumsum(dp) % md\n\n if k != a:\n\n dp[k:a:-1] = (dp[k:a:-1] - dp[k - a - 1::-1]) % md\n\n return np.sum(dp[k - a_s[-1]:]) % md\n\n\n\n\n\nn, k = list(map(int, input().split()))\n\na_s = list(map(int, input().split()))\n\nprint((f(n, k, a_s)))\n","code_v0_loc":18,"code_v1_loc":17,"code_v0_num_chars":496,"code_v1_num_chars":402,"code_v0_no_empty_lines":"def f(n, k, a_s):\n md = 10**9 + 7\n dp = [0] * (k + 1)\n dp[0] = 1\n for a in a_s[:-1]:\n ndp = [0] * (k + 1)\n ndp[0] = s = dp[0] % md\n for j in range(1, a + 1):\n ndp[j] = s = (s + dp[j]) % md\n for j in range(a + 1, k + 1):\n ndp[j] = s = (s + dp[j] - dp[j - a - 1]) % md\n dp = ndp\n return sum(dp[k - a_s[-1] :]) % md\n\n\nn, k = list(map(int, input().split()))\na_s = list(map(int, input().split()))\nprint((f(n, k, a_s)))\n","code_v1_no_empty_lines":"import numpy as np\n\n\ndef f(n, k, a_s):\n md = 10**9 + 7\n dp = np.zeros(k + 1, dtype=np.int64)\n dp[0] = 1\n for a in a_s[:-1]:\n dp = np.cumsum(dp) % md\n if k != a:\n dp[k:a:-1] = (dp[k:a:-1] - dp[k - a - 1 :: -1]) % md\n return np.sum(dp[k - a_s[-1] :]) % md\n\n\nn, k = list(map(int, input().split()))\na_s = list(map(int, input().split()))\nprint((f(n, k, a_s)))\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["+import numpy as np","+","+","- dp = [0] * (k + 1)","+ dp = np.zeros(k + 1, dtype=np.int64)","- ndp = [0] * (k + 1)","- ndp[0] = s = dp[0] % md","- for j in range(1, a + 1):","- ndp[j] = s = (s + dp[j]) % md","- for j in range(a + 1, k + 1):","- ndp[j] = s = (s + dp[j] - dp[j - a - 1]) % md","- dp = ndp","- return sum(dp[k - a_s[-1] :]) % md","+ dp = np.cumsum(dp) % md","+ if k != a:","+ dp[k:a:-1] = (dp[k:a:-1] - dp[k - a - 1 :: -1]) % md","+ return np.sum(dp[k - a_s[-1] :]) % md"],"diff_only_import_comment":false,"measured_runtime_v0":0.0538661351,"measured_runtime_v1":0.3415728581,"runtime_lift":0.1577002793,"key":["s489328941","s543751610"]} +{"user_id":"u797106134","problem_id":"p02614","language":"python","submission_id_v0":"s936422871","submission_id_v1":"s680182352","cpu_time_v0":180,"cpu_time_v1":77,"memory_v0":9272,"memory_v1":9112,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.22,"input":"# \u591a\u5206\u5168\u63a2\u7d22\u3060\u3068\u601d\u308f\u308c\u308b\u3051\u3069\u3082\n\n# 2111 ~\n\n# 2115 \u89e3\u6cd5\u306b\u306fbit\u5168\u63a2\u7d22\u3092\u7528\u3044\u308b.\u5404\u5217\uff0c\u884c\u306b\u3064\u3044\u3066\u5857\u308b\u304b\u5857\u3089\u306a\u3044\u304b\u3067bit\u63a2\u7d22\u3092\u3057\u3066\u3042\u3052\u308b\u3068\u305f\u304b\u3060\u304b2**(6*2) \u306710**4\u7a0b\u5ea6\u306e\u8a08\u7b97\u91cf\u306b\u53ce\u307e\u308b\n\n# \u5b9f\u88c5\n\n\n\nH,W,K = list(map(int,input().split()))\n\nMo = [[] for _ in range(H)]\n\nfor i in range(H):\n\n Mo[i] = list(eval(input()))\n\n\n\nH_num = 2**H\n\nW_num = 2**W\n\nans = 0\n\nimport copy\n\nfor i in range(H_num):\n\n for j in range(W_num):\n\n M = copy.deepcopy(Mo)\n\n # sum\u306e\u8a08\u7b97\u3092\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\n\n dumi = i\n\n dumj = j\n\n SH = [(dumi & 2**kh)\/\/(2**kh) for kh in range(H)]\n\n SW = [(dumj & 2**kw)\/\/(2**kw) for kw in range(W)]\n\n num = 0\n\n for ih,h in enumerate(SH):\n\n if h == 1:\n\n M[ih] = ['.' for _ in range(W)]\n\n for iw,w in enumerate(SW):\n\n if w == 1:\n\n for k in range(H):\n\n M[k][iw] = '.'\n\n count = 0\n\n for ii in range(H):\n\n for jj in range(W):\n\n if M[ii][jj] == '#':\n\n count += 1\n\n if count == K:\n\n ans += 1\n\n\n\nprint(ans)\n\n\n\n\n","target":"H,W,K=list(map(int,input().split()))\n\nC=[]\n\nfor _ in range(H):\n\n C.append(list(eval(input())))\n\n# \u30b7\u30d5\u30c8\u6f14\u7b97\u3068&\u3092\u4f7f\u3046\u3068\u65e9\u3044.\n\nans = 0\n\nfor i in range(1<>i2 & 1\n\n bit_j = j>>j2 & 1\n\n if bit_i == 1 or bit_j == 1:\n\n continue\n\n if C[i2][j2] == '#':\n\n count += 1\n\n if count == K:\n\n ans += 1\n\n\n\nprint(ans)\n","code_v0_loc":41,"code_v1_loc":21,"code_v0_num_chars":1016,"code_v1_num_chars":548,"code_v0_no_empty_lines":"# \u591a\u5206\u5168\u63a2\u7d22\u3060\u3068\u601d\u308f\u308c\u308b\u3051\u3069\u3082\n# 2111 ~\n# 2115 \u89e3\u6cd5\u306b\u306fbit\u5168\u63a2\u7d22\u3092\u7528\u3044\u308b.\u5404\u5217\uff0c\u884c\u306b\u3064\u3044\u3066\u5857\u308b\u304b\u5857\u3089\u306a\u3044\u304b\u3067bit\u63a2\u7d22\u3092\u3057\u3066\u3042\u3052\u308b\u3068\u305f\u304b\u3060\u304b2**(6*2) \u306710**4\u7a0b\u5ea6\u306e\u8a08\u7b97\u91cf\u306b\u53ce\u307e\u308b\n# \u5b9f\u88c5\nH, W, K = list(map(int, input().split()))\nMo = [[] for _ in range(H)]\nfor i in range(H):\n Mo[i] = list(eval(input()))\nH_num = 2**H\nW_num = 2**W\nans = 0\nimport copy\n\nfor i in range(H_num):\n for j in range(W_num):\n M = copy.deepcopy(Mo)\n # sum\u306e\u8a08\u7b97\u3092\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\n dumi = i\n dumj = j\n SH = [(dumi & 2**kh) \/\/ (2**kh) for kh in range(H)]\n SW = [(dumj & 2**kw) \/\/ (2**kw) for kw in range(W)]\n num = 0\n for ih, h in enumerate(SH):\n if h == 1:\n M[ih] = [\".\" for _ in range(W)]\n for iw, w in enumerate(SW):\n if w == 1:\n for k in range(H):\n M[k][iw] = \".\"\n count = 0\n for ii in range(H):\n for jj in range(W):\n if M[ii][jj] == \"#\":\n count += 1\n if count == K:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"H, W, K = list(map(int, input().split()))\nC = []\nfor _ in range(H):\n C.append(list(eval(input())))\n# \u30b7\u30d5\u30c8\u6f14\u7b97\u3068&\u3092\u4f7f\u3046\u3068\u65e9\u3044.\nans = 0\nfor i in range(1 << H): # \u8981\u3059\u308b\u306b2**H\u306e\u3053\u3068\n for j in range(1 << W): # \u8981\u3059\u308b\u306b2**W\u306e\u3053\u3068\n count = 0\n for i2 in range(H):\n for j2 in range(W):\n bit_i = i >> i2 & 1\n bit_j = j >> j2 & 1\n if bit_i == 1 or bit_j == 1:\n continue\n if C[i2][j2] == \"#\":\n count += 1\n if count == K:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":48.7804878049,"diff":["-# \u591a\u5206\u5168\u63a2\u7d22\u3060\u3068\u601d\u308f\u308c\u308b\u3051\u3069\u3082","-# 2111 ~","-# 2115 \u89e3\u6cd5\u306b\u306fbit\u5168\u63a2\u7d22\u3092\u7528\u3044\u308b.\u5404\u5217\uff0c\u884c\u306b\u3064\u3044\u3066\u5857\u308b\u304b\u5857\u3089\u306a\u3044\u304b\u3067bit\u63a2\u7d22\u3092\u3057\u3066\u3042\u3052\u308b\u3068\u305f\u304b\u3060\u304b2**(6*2) \u306710**4\u7a0b\u5ea6\u306e\u8a08\u7b97\u91cf\u306b\u53ce\u307e\u308b","-# \u5b9f\u88c5","-Mo = [[] for _ in range(H)]","-for i in range(H):","- Mo[i] = list(eval(input()))","-H_num = 2**H","-W_num = 2**W","+C = []","+for _ in range(H):","+ C.append(list(eval(input())))","+# \u30b7\u30d5\u30c8\u6f14\u7b97\u3068&\u3092\u4f7f\u3046\u3068\u65e9\u3044.","-import copy","-","-for i in range(H_num):","- for j in range(W_num):","- M = copy.deepcopy(Mo)","- # sum\u306e\u8a08\u7b97\u3092\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044","- dumi = i","- dumj = j","- SH = [(dumi & 2**kh) \/\/ (2**kh) for kh in range(H)]","- SW = [(dumj & 2**kw) \/\/ (2**kw) for kw in range(W)]","- num = 0","- for ih, h in enumerate(SH):","- if h == 1:","- M[ih] = [\".\" for _ in range(W)]","- for iw, w in enumerate(SW):","- if w == 1:","- for k in range(H):","- M[k][iw] = \".\"","+for i in range(1 << H): # \u8981\u3059\u308b\u306b2**H\u306e\u3053\u3068","+ for j in range(1 << W): # \u8981\u3059\u308b\u306b2**W\u306e\u3053\u3068","- for ii in range(H):","- for jj in range(W):","- if M[ii][jj] == \"#\":","+ for i2 in range(H):","+ for j2 in range(W):","+ bit_i = i >> i2 & 1","+ bit_j = j >> j2 & 1","+ if bit_i == 1 or bit_j == 1:","+ continue","+ if C[i2][j2] == \"#\":"],"diff_only_import_comment":false,"measured_runtime_v0":0.0402552684,"measured_runtime_v1":0.0392087301,"runtime_lift":1.0266914624,"key":["s936422871","s680182352"]} +{"user_id":"u832399163","problem_id":"p03611","language":"python","submission_id_v0":"s264493799","submission_id_v1":"s141611305","cpu_time_v0":141,"cpu_time_v1":116,"memory_v0":13964,"memory_v1":14180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.73,"input":"from sys import stdin\n\nimport sys\n\nimport math\n\n\n\nn = int(eval(input()))\n\n#a = list(map(int, stdin.readline().rstrip().split()))\n\na = sorted(list(map(int, stdin.readline().rstrip().split())))\n\n\n\n\n\ncount_max = 1\n\n\n\ncount_prev = 0\n\ncount_curr = 1\n\ncount_next = 0\n\n\n\ncurrent_value = a[0]\n\nfor i in range(1, n):\n\n if a[i] == current_value:\n\n count_curr += 1\n\n elif a[i] == current_value + 1:\n\n count_next += 1\n\n elif a[i] == current_value + 2:\n\n count_max = max(count_max, (count_prev + count_curr + count_next))\n\n current_value = current_value + 1\n\n count_prev = count_curr\n\n count_curr = count_next\n\n count_next = 1\n\n elif a[i] >= current_value + 3:\n\n count_max = max(count_max, (count_prev + count_curr + count_next))\n\n current_value = a[i]\n\n count_prev = 0\n\n count_curr = 1\n\n count_next = 0\n\n else:\n\n print(\"Error\")\n\n\n\ncount_max = max(count_max, (count_prev + count_curr + count_next))\n\n\n\nprint(count_max)\n","target":"from sys import stdin\n\nimport sys\n\nimport math\n\n\n\nn = int(eval(input()))\n\na = list(map(int, stdin.readline().rstrip().split()))\n\n\n\ndict_count = {}\n\nfor i in a:\n\n dict_count[i] = 0\n\n\n\nfor j in a:\n\n dict_count[j] += 1\n\n\n\n#print(dict_count)\n\n\n\nmax_count = 0\n\n\n\nfor key in list(dict_count.keys()):\n\n max_count = max(max_count, dict_count.get(key - 1, 0) + dict_count.get(key, 0) + dict_count.get(key + 1, 0))\n\n\n\nprint(max_count)\n","code_v0_loc":39,"code_v1_loc":22,"code_v0_num_chars":1006,"code_v1_num_chars":422,"code_v0_no_empty_lines":"from sys import stdin\nimport sys\nimport math\n\nn = int(eval(input()))\n# a = list(map(int, stdin.readline().rstrip().split()))\na = sorted(list(map(int, stdin.readline().rstrip().split())))\ncount_max = 1\ncount_prev = 0\ncount_curr = 1\ncount_next = 0\ncurrent_value = a[0]\nfor i in range(1, n):\n if a[i] == current_value:\n count_curr += 1\n elif a[i] == current_value + 1:\n count_next += 1\n elif a[i] == current_value + 2:\n count_max = max(count_max, (count_prev + count_curr + count_next))\n current_value = current_value + 1\n count_prev = count_curr\n count_curr = count_next\n count_next = 1\n elif a[i] >= current_value + 3:\n count_max = max(count_max, (count_prev + count_curr + count_next))\n current_value = a[i]\n count_prev = 0\n count_curr = 1\n count_next = 0\n else:\n print(\"Error\")\ncount_max = max(count_max, (count_prev + count_curr + count_next))\nprint(count_max)\n","code_v1_no_empty_lines":"from sys import stdin\nimport sys\nimport math\n\nn = int(eval(input()))\na = list(map(int, stdin.readline().rstrip().split()))\ndict_count = {}\nfor i in a:\n dict_count[i] = 0\nfor j in a:\n dict_count[j] += 1\n# print(dict_count)\nmax_count = 0\nfor key in list(dict_count.keys()):\n max_count = max(\n max_count,\n dict_count.get(key - 1, 0)\n + dict_count.get(key, 0)\n + dict_count.get(key + 1, 0),\n )\nprint(max_count)\n","code_same":false,"relative_loc_diff_percent":43.5897435897,"diff":["-# a = list(map(int, stdin.readline().rstrip().split()))","-a = sorted(list(map(int, stdin.readline().rstrip().split())))","-count_max = 1","-count_prev = 0","-count_curr = 1","-count_next = 0","-current_value = a[0]","-for i in range(1, n):","- if a[i] == current_value:","- count_curr += 1","- elif a[i] == current_value + 1:","- count_next += 1","- elif a[i] == current_value + 2:","- count_max = max(count_max, (count_prev + count_curr + count_next))","- current_value = current_value + 1","- count_prev = count_curr","- count_curr = count_next","- count_next = 1","- elif a[i] >= current_value + 3:","- count_max = max(count_max, (count_prev + count_curr + count_next))","- current_value = a[i]","- count_prev = 0","- count_curr = 1","- count_next = 0","- else:","- print(\"Error\")","-count_max = max(count_max, (count_prev + count_curr + count_next))","-print(count_max)","+a = list(map(int, stdin.readline().rstrip().split()))","+dict_count = {}","+for i in a:","+ dict_count[i] = 0","+for j in a:","+ dict_count[j] += 1","+# print(dict_count)","+max_count = 0","+for key in list(dict_count.keys()):","+ max_count = max(","+ max_count,","+ dict_count.get(key - 1, 0)","+ + dict_count.get(key, 0)","+ + dict_count.get(key + 1, 0),","+ )","+print(max_count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0418280602,"measured_runtime_v1":0.0415513039,"runtime_lift":1.0066605919,"key":["s264493799","s141611305"]} +{"user_id":"u860002137","problem_id":"p03212","language":"python","submission_id_v0":"s766035094","submission_id_v1":"s139554007","cpu_time_v0":110,"cpu_time_v1":65,"memory_v0":7712,"memory_v1":4008,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.91,"input":"def is_753(n):\n\n n = str(n)\n\n return(n.count(\"7\") >= 1 and n.count(\"3\") >= 1 and n.count(\"5\") >= 1)\n\n\n\n\n\nn = int(eval(input()))\n\n\n\n\n\nv = [7, 5, 3]\n\nli = []\n\nprev = [7, 5, 3]\n\n\n\nfor i in range(9):\n\n tmp = []\n\n for j in v:\n\n for k in prev:\n\n tmp.append(k * 10 + j)\n\n prev = tmp\n\n li = li + prev\n\n\n\nli = [x for x in li if is_753(x) and x <= n]\n\n\n\nprint((len(li)))","target":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\n\nN = int(eval(input()))\n\nV = [3, 5, 7]\n\n\n\nli = []\n\n\n\n\n\ndef rec(curr, use):\n\n if curr > N:\n\n return\n\n if use == 0b111:\n\n li.append(curr)\n\n for i, b in enumerate(V):\n\n rec(curr * 10 + b, use | max(1, i * 2))\n\n\n\n\n\nrec(0, 0)\n\n\n\nprint((len(li)))","code_v0_loc":23,"code_v1_loc":21,"code_v0_num_chars":388,"code_v1_num_chars":305,"code_v0_no_empty_lines":"def is_753(n):\n n = str(n)\n return n.count(\"7\") >= 1 and n.count(\"3\") >= 1 and n.count(\"5\") >= 1\n\n\nn = int(eval(input()))\nv = [7, 5, 3]\nli = []\nprev = [7, 5, 3]\nfor i in range(9):\n tmp = []\n for j in v:\n for k in prev:\n tmp.append(k * 10 + j)\n prev = tmp\n li = li + prev\nli = [x for x in li if is_753(x) and x <= n]\nprint((len(li)))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\nN = int(eval(input()))\nV = [3, 5, 7]\nli = []\n\n\ndef rec(curr, use):\n if curr > N:\n return\n if use == 0b111:\n li.append(curr)\n for i, b in enumerate(V):\n rec(curr * 10 + b, use | max(1, i * 2))\n\n\nrec(0, 0)\nprint((len(li)))\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["-def is_753(n):","- n = str(n)","- return n.count(\"7\") >= 1 and n.count(\"3\") >= 1 and n.count(\"5\") >= 1","+import sys","+","+sys.setrecursionlimit(10**6)","+N = int(eval(input()))","+V = [3, 5, 7]","+li = []","-n = int(eval(input()))","-v = [7, 5, 3]","-li = []","-prev = [7, 5, 3]","-for i in range(9):","- tmp = []","- for j in v:","- for k in prev:","- tmp.append(k * 10 + j)","- prev = tmp","- li = li + prev","-li = [x for x in li if is_753(x) and x <= n]","+def rec(curr, use):","+ if curr > N:","+ return","+ if use == 0b111:","+ li.append(curr)","+ for i, b in enumerate(V):","+ rec(curr * 10 + b, use | max(1, i * 2))","+","+","+rec(0, 0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2961560729,"measured_runtime_v1":0.0634319487,"runtime_lift":4.6688786811,"key":["s766035094","s139554007"]} +{"user_id":"u367701763","problem_id":"p02588","language":"python","submission_id_v0":"s183880983","submission_id_v1":"s430405365","cpu_time_v0":522,"cpu_time_v1":317,"memory_v0":87244,"memory_v1":69980,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.27,"input":"def five(x):\n\n cnt1 = 0\n\n while x%5==0:\n\n cnt1+= 1\n\n x = x\/\/5\n\n cnt2 = 0\n\n while x%2==0:\n\n cnt2+= 1\n\n x = x\/\/2\n\n return (min2(cnt1,18), min2(cnt2,18))\n\n\n\ndef min2(x,y):\n\n return x if x < y else y\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nF = []\n\nfor i in range(N):\n\n A = input().rstrip()\n\n if '.' in A:\n\n a,b = A.split('.')\n\n n = int(a+b)*10**(9-len(b))\n\n else:\n\n n = int(A) * 10 ** 9\n\n F.append(five(n))\n\n\n\nF.sort()\n\nj = 0\n\ntemp = 0\n\ndp = [0]*19\n\nk = 0\n\nfor i in range(N-1):\n\n if N-1-j < i:\n\n dp[min2(F[i][1], 18)] -= 1\n\n while N-1-j> i and F[i][0]+F[N-1-j][0] >= 18:\n\n dp[min2(F[N-1-j][1],18)] += 1\n\n j += 1\n\n k = sum(dp[:18-F[i][1]])\n\n temp += min2(j, N-i-1) - k\n\n\n\nprint(temp)\n","target":"class cumsum2D:\n\n def __init__(self, data):\n\n self.N = len(data)\n\n self.M= len(data[0])\n\n self.cum = [[0] * (self.M + 1) for _ in range(self.N + 1)]\n\n for i in range(self.N):\n\n for j in range(self.M):\n\n self.cum[i + 1][j + 1] = self.cum[i][j + 1] + self.cum[i + 1][j] - self.cum[i][j] + data[i][j]\n\n\n\n def get(self,x1,y1,x2,y2):\n\n \"\"\"\n\n \u9577\u65b9\u5f62\u306e\u9818\u57df [x1,x2)*[y1,y2) \u306e\u7bc4\u56f2\u5185\u306b\u30a4\u30f3\u30d7\u30c3\u30c8\u3055\u308c\u305f\u6570\u5b57\u306e\u548c\u3092\u53d6\u308b\n\n \"\"\"\n\n return self.cum[x2][y2] - self.cum[x1][y2] - self.cum[x2][y1] + self.cum[x1][y1]\n\n\n\ndef five(x):\n\n cnt1 = 0\n\n while x%5==0:\n\n cnt1+= 1\n\n x = x\/\/5\n\n cnt2 = 0\n\n while x%2==0:\n\n cnt2+= 1\n\n x = x\/\/2\n\n return (min(cnt1,18), min(cnt2,18))\n\n\n\ndef digit_lift(S, l):\n\n if '.' in S:\n\n a, b = S.split('.')\n\n n = int(a + b) * 10 ** (l - len(b))\n\n else:\n\n n = int(S) * 10 ** l\n\n return n\n\n\n\ndata = [[0]*19 for _ in range(19)]\n\n\n\nN = int(eval(input()))\n\nQ = set()\n\nfor _ in range(N):\n\n A = digit_lift(input().rstrip(),9)\n\n x, y = five(A)\n\n data[x][y] += 1\n\n Q.add((x,y))\n\n\n\ncum = cumsum2D(data)\n\nres = 0\n\nfor x, y in Q:\n\n res += (cum.get(18-x,18-y,-1,-1)- (x>=9 and y>=9))*data[x][y]\n\nprint((res\/\/2))","code_v0_loc":43,"code_v1_loc":49,"code_v0_num_chars":814,"code_v1_num_chars":1243,"code_v0_no_empty_lines":"def five(x):\n cnt1 = 0\n while x % 5 == 0:\n cnt1 += 1\n x = x \/\/ 5\n cnt2 = 0\n while x % 2 == 0:\n cnt2 += 1\n x = x \/\/ 2\n return (min2(cnt1, 18), min2(cnt2, 18))\n\n\ndef min2(x, y):\n return x if x < y else y\n\n\nimport sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nF = []\nfor i in range(N):\n A = input().rstrip()\n if \".\" in A:\n a, b = A.split(\".\")\n n = int(a + b) * 10 ** (9 - len(b))\n else:\n n = int(A) * 10**9\n F.append(five(n))\nF.sort()\nj = 0\ntemp = 0\ndp = [0] * 19\nk = 0\nfor i in range(N - 1):\n if N - 1 - j < i:\n dp[min2(F[i][1], 18)] -= 1\n while N - 1 - j > i and F[i][0] + F[N - 1 - j][0] >= 18:\n dp[min2(F[N - 1 - j][1], 18)] += 1\n j += 1\n k = sum(dp[: 18 - F[i][1]])\n temp += min2(j, N - i - 1) - k\nprint(temp)\n","code_v1_no_empty_lines":"class cumsum2D:\n def __init__(self, data):\n self.N = len(data)\n self.M = len(data[0])\n self.cum = [[0] * (self.M + 1) for _ in range(self.N + 1)]\n for i in range(self.N):\n for j in range(self.M):\n self.cum[i + 1][j + 1] = (\n self.cum[i][j + 1]\n + self.cum[i + 1][j]\n - self.cum[i][j]\n + data[i][j]\n )\n\n def get(self, x1, y1, x2, y2):\n \"\"\"\n \u9577\u65b9\u5f62\u306e\u9818\u57df [x1,x2)*[y1,y2) \u306e\u7bc4\u56f2\u5185\u306b\u30a4\u30f3\u30d7\u30c3\u30c8\u3055\u308c\u305f\u6570\u5b57\u306e\u548c\u3092\u53d6\u308b\n \"\"\"\n return self.cum[x2][y2] - self.cum[x1][y2] - self.cum[x2][y1] + self.cum[x1][y1]\n\n\ndef five(x):\n cnt1 = 0\n while x % 5 == 0:\n cnt1 += 1\n x = x \/\/ 5\n cnt2 = 0\n while x % 2 == 0:\n cnt2 += 1\n x = x \/\/ 2\n return (min(cnt1, 18), min(cnt2, 18))\n\n\ndef digit_lift(S, l):\n if \".\" in S:\n a, b = S.split(\".\")\n n = int(a + b) * 10 ** (l - len(b))\n else:\n n = int(S) * 10**l\n return n\n\n\ndata = [[0] * 19 for _ in range(19)]\nN = int(eval(input()))\nQ = set()\nfor _ in range(N):\n A = digit_lift(input().rstrip(), 9)\n x, y = five(A)\n data[x][y] += 1\n Q.add((x, y))\ncum = cumsum2D(data)\nres = 0\nfor x, y in Q:\n res += (cum.get(18 - x, 18 - y, -1, -1) - (x >= 9 and y >= 9)) * data[x][y]\nprint((res \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":12.2448979592,"diff":["+class cumsum2D:","+ def __init__(self, data):","+ self.N = len(data)","+ self.M = len(data[0])","+ self.cum = [[0] * (self.M + 1) for _ in range(self.N + 1)]","+ for i in range(self.N):","+ for j in range(self.M):","+ self.cum[i + 1][j + 1] = (","+ self.cum[i][j + 1]","+ + self.cum[i + 1][j]","+ - self.cum[i][j]","+ + data[i][j]","+ )","+","+ def get(self, x1, y1, x2, y2):","+ \"\"\"","+ \u9577\u65b9\u5f62\u306e\u9818\u57df [x1,x2)*[y1,y2) \u306e\u7bc4\u56f2\u5185\u306b\u30a4\u30f3\u30d7\u30c3\u30c8\u3055\u308c\u305f\u6570\u5b57\u306e\u548c\u3092\u53d6\u308b","+ \"\"\"","+ return self.cum[x2][y2] - self.cum[x1][y2] - self.cum[x2][y1] + self.cum[x1][y1]","+","+","- return (min2(cnt1, 18), min2(cnt2, 18))","+ return (min(cnt1, 18), min(cnt2, 18))","-def min2(x, y):","- return x if x < y else y","+def digit_lift(S, l):","+ if \".\" in S:","+ a, b = S.split(\".\")","+ n = int(a + b) * 10 ** (l - len(b))","+ else:","+ n = int(S) * 10**l","+ return n","-import sys","-","-input = sys.stdin.readline","+data = [[0] * 19 for _ in range(19)]","-F = []","-for i in range(N):","- A = input().rstrip()","- if \".\" in A:","- a, b = A.split(\".\")","- n = int(a + b) * 10 ** (9 - len(b))","- else:","- n = int(A) * 10**9","- F.append(five(n))","-F.sort()","-j = 0","-temp = 0","-dp = [0] * 19","-k = 0","-for i in range(N - 1):","- if N - 1 - j < i:","- dp[min2(F[i][1], 18)] -= 1","- while N - 1 - j > i and F[i][0] + F[N - 1 - j][0] >= 18:","- dp[min2(F[N - 1 - j][1], 18)] += 1","- j += 1","- k = sum(dp[: 18 - F[i][1]])","- temp += min2(j, N - i - 1) - k","-print(temp)","+Q = set()","+for _ in range(N):","+ A = digit_lift(input().rstrip(), 9)","+ x, y = five(A)","+ data[x][y] += 1","+ Q.add((x, y))","+cum = cumsum2D(data)","+res = 0","+for x, y in Q:","+ res += (cum.get(18 - x, 18 - y, -1, -1) - (x >= 9 and y >= 9)) * data[x][y]","+print((res \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0398892673,"measured_runtime_v1":0.0374652873,"runtime_lift":1.0646993567,"key":["s183880983","s430405365"]} +{"user_id":"u852690916","problem_id":"p03208","language":"python","submission_id_v0":"s558317911","submission_id_v1":"s000948487","cpu_time_v0":530,"cpu_time_v1":253,"memory_v0":51160,"memory_v1":43996,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.26,"input":"N,K = list(map(int, input().split()))\n\nH = [int(eval(input())) for _ in range(N)]\n\nH.sort()\n\nans = 10**10\n\nfor i in range(N-K+1):\n\n ans = min(ans, H[i+K-1] - H[i])\n\nprint(ans)","target":"import sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N,K=list(map(int, input().split()))\n\n H=[int(eval(input())) for _ in range(N)]\n\n\n\n H.sort()\n\n ans=10**12\n\n for i in range(N):\n\n if i+K-1 >= N: break\n\n ans = min(ans, H[i+K-1]-H[i])\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":7,"code_v1_loc":15,"code_v0_num_chars":166,"code_v1_num_chars":313,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nH = [int(eval(input())) for _ in range(N)]\nH.sort()\nans = 10**10\nfor i in range(N - K + 1):\n ans = min(ans, H[i + K - 1] - H[i])\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\n\ndef main():\n input = sys.stdin.readline\n N, K = list(map(int, input().split()))\n H = [int(eval(input())) for _ in range(N)]\n H.sort()\n ans = 10**12\n for i in range(N):\n if i + K - 1 >= N:\n break\n ans = min(ans, H[i + K - 1] - H[i])\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":53.3333333333,"diff":["-N, K = list(map(int, input().split()))","-H = [int(eval(input())) for _ in range(N)]","-H.sort()","-ans = 10**10","-for i in range(N - K + 1):","- ans = min(ans, H[i + K - 1] - H[i])","-print(ans)","+import sys","+","+","+def main():","+ input = sys.stdin.readline","+ N, K = list(map(int, input().split()))","+ H = [int(eval(input())) for _ in range(N)]","+ H.sort()","+ ans = 10**12","+ for i in range(N):","+ if i + K - 1 >= N:","+ break","+ ans = min(ans, H[i + K - 1] - H[i])","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0428814135,"measured_runtime_v1":0.0071083344,"runtime_lift":6.0325543359,"key":["s558317911","s000948487"]} +{"user_id":"u134302690","problem_id":"p03369","language":"python","submission_id_v0":"s824804667","submission_id_v1":"s798848933","cpu_time_v0":183,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.71,"input":"s = eval(input())\n\ncount = 0\n\nif s[0] == \"o\":\n\n count+=1\n\nif s[1] == \"o\":\n\n count+=1\n\nif s[2] == \"o\":\n\n count+=1\n\nprint((700+100*count))","target":"S = eval(input())\n\nc = S.count(\"o\")\n\nprint((700+100*c))","code_v0_loc":9,"code_v1_loc":3,"code_v0_num_chars":137,"code_v1_num_chars":47,"code_v0_no_empty_lines":"s = eval(input())\ncount = 0\nif s[0] == \"o\":\n count += 1\nif s[1] == \"o\":\n count += 1\nif s[2] == \"o\":\n count += 1\nprint((700 + 100 * count))\n","code_v1_no_empty_lines":"S = eval(input())\nc = S.count(\"o\")\nprint((700 + 100 * c))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-s = eval(input())","-count = 0","-if s[0] == \"o\":","- count += 1","-if s[1] == \"o\":","- count += 1","-if s[2] == \"o\":","- count += 1","-print((700 + 100 * count))","+S = eval(input())","+c = S.count(\"o\")","+print((700 + 100 * c))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0873887565,"measured_runtime_v1":0.0793067555,"runtime_lift":1.1019081023,"key":["s824804667","s798848933"]} +{"user_id":"u014333473","problem_id":"p04031","language":"python","submission_id_v0":"s144236263","submission_id_v1":"s711269765","cpu_time_v0":41,"cpu_time_v1":33,"memory_v0":10788,"memory_v1":9192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.51,"input":"import statistics\n\nn=int(eval(input()))\n\na=list(map(int,input().split()))\n\nnum=round(statistics.mean(a))\n\nprint((sum([(num-i)**2 for i in a])))","target":"eval(input());a=list(map(int,input().split()));r=float('inf')\n\nfor i in range(min(a),max(a)+1):\n\n n=0\n\n for j in a:\n\n n+=(j-i)**2\n\n r=min(n,r)\n\nprint(r)","code_v0_loc":5,"code_v1_loc":7,"code_v0_num_chars":135,"code_v1_num_chars":152,"code_v0_no_empty_lines":"import statistics\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nnum = round(statistics.mean(a))\nprint((sum([(num - i) ** 2 for i in a])))\n","code_v1_no_empty_lines":"eval(input())\na = list(map(int, input().split()))\nr = float(\"inf\")\nfor i in range(min(a), max(a) + 1):\n n = 0\n for j in a:\n n += (j - i) ** 2\n r = min(n, r)\nprint(r)\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-import statistics","-","-n = int(eval(input()))","+eval(input())","-num = round(statistics.mean(a))","-print((sum([(num - i) ** 2 for i in a])))","+r = float(\"inf\")","+for i in range(min(a), max(a) + 1):","+ n = 0","+ for j in a:","+ n += (j - i) ** 2","+ r = min(n, r)","+print(r)"],"diff_only_import_comment":false,"measured_runtime_v0":0.119993022,"measured_runtime_v1":0.0364175441,"runtime_lift":3.2949234994,"key":["s144236263","s711269765"]} +{"user_id":"u032566873","problem_id":"p03448","language":"python","submission_id_v0":"s593616328","submission_id_v1":"s214335298","cpu_time_v0":20,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"A = int(eval(input()))\n\nB = int(eval(input()))\n\nC = int(eval(input()))\n\nX = int(eval(input()))\n\nvar = 0\n\nfor i in range(A+1):\n\n if (X-500*i) >= 0:\n\n Y = X-500*i\n\n for j in range(B+1):\n\n if ((Y-100*j) >= 0) and (((Y-100*j)\/\/50) <= C):\n\n var = var+1\n\nprint(var)","target":"s = [int(eval(input())) for i in range(4)]\n\nvar = 0\n\nfor i in range(s[0]+1):\n\n if (s[3]-500*i) >= 0:\n\n Y = s[3]-500*i\n\n for j in range(s[1]+1):\n\n if ((Y-100*j) >= 0) and (((Y-100*j)\/\/50) <= s[2]):\n\n var = var+1\n\nprint(var)","code_v0_loc":12,"code_v1_loc":9,"code_v0_num_chars":254,"code_v1_num_chars":235,"code_v0_no_empty_lines":"A = int(eval(input()))\nB = int(eval(input()))\nC = int(eval(input()))\nX = int(eval(input()))\nvar = 0\nfor i in range(A + 1):\n if (X - 500 * i) >= 0:\n Y = X - 500 * i\n for j in range(B + 1):\n if ((Y - 100 * j) >= 0) and (((Y - 100 * j) \/\/ 50) <= C):\n var = var + 1\nprint(var)\n","code_v1_no_empty_lines":"s = [int(eval(input())) for i in range(4)]\nvar = 0\nfor i in range(s[0] + 1):\n if (s[3] - 500 * i) >= 0:\n Y = s[3] - 500 * i\n for j in range(s[1] + 1):\n if ((Y - 100 * j) >= 0) and (((Y - 100 * j) \/\/ 50) <= s[2]):\n var = var + 1\nprint(var)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-A = int(eval(input()))","-B = int(eval(input()))","-C = int(eval(input()))","-X = int(eval(input()))","+s = [int(eval(input())) for i in range(4)]","-for i in range(A + 1):","- if (X - 500 * i) >= 0:","- Y = X - 500 * i","- for j in range(B + 1):","- if ((Y - 100 * j) >= 0) and (((Y - 100 * j) \/\/ 50) <= C):","+for i in range(s[0] + 1):","+ if (s[3] - 500 * i) >= 0:","+ Y = s[3] - 500 * i","+ for j in range(s[1] + 1):","+ if ((Y - 100 * j) >= 0) and (((Y - 100 * j) \/\/ 50) <= s[2]):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0335889127,"measured_runtime_v1":0.0338944006,"runtime_lift":0.9909870694,"key":["s593616328","s214335298"]} +{"user_id":"u867848444","problem_id":"p03209","language":"python","submission_id_v0":"s350952376","submission_id_v1":"s007756501","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"n,x=list(map(int,input().split()))\n\n\n\n#\u30ec\u30d9\u30ebN\u306e\u5c64\u3068\u30d1\u30c6\u30a3\u306e\u6570\u3092\u6c42\u3081\u308b\n\na,p=[1],[1]\n\nfor i in range(n):\n\n a.append(2*a[i]+3)\n\n p.append(2*p[i]+1)\n\n\n\ndef cnt(n,x):\n\n #\u30ec\u30d9\u30ebN\u306e\u30d0\u30fc\u30ac\u30fc\u306eX\u5c64\u307e\u3067\u306b\u542b\u307e\u308c\u308b\u30d1\u30c6\u30a3\u3092\u6570\u3048\u308b\n\n if n==0:\n\n return 1 if x>=1 else 0\n\n\n\n elif x<=1+a[n-1]:\n\n return cnt(n-1,x-1)\n\n\n\n elif 2+a[n-1]<=x:\n\n return cnt(n-1,x-(a[n-1]+2))+p[n-1]+1\n\n\n\nprint((cnt(n,x)))","target":"n,x=list(map(int,input().split()))\n\n\n\na,p=[1],[1]\n\nfor i in range(n):\n\n a.append(2*a[i]+3)\n\n p.append(2*p[i]+1)\n\n\n\ndef F(N,X):\n\n if N==0:\n\n return 0 if X<=0 else 1\n\n\n\n elif X==1:\n\n return 0\n\n \n\n elif 1= 1 else 0\n elif x <= 1 + a[n - 1]:\n return cnt(n - 1, x - 1)\n elif 2 + a[n - 1] <= x:\n return cnt(n - 1, x - (a[n - 1] + 2)) + p[n - 1] + 1\n\n\nprint((cnt(n, x)))\n","code_v1_no_empty_lines":"n, x = list(map(int, input().split()))\na, p = [1], [1]\nfor i in range(n):\n a.append(2 * a[i] + 3)\n p.append(2 * p[i] + 1)\n\n\ndef F(N, X):\n if N == 0:\n return 0 if X <= 0 else 1\n elif X == 1:\n return 0\n elif 1 < X <= 1 + a[N - 1]:\n return F(N - 1, X - 1)\n elif X == 2 + a[N - 1]:\n return p[N - 1] + 1\n elif 2 + a[N - 1] < X <= a[N] - 1:\n return F(N - 1, X - (2 + a[N - 1])) + p[N - 1] + 1\n elif X == a[N]:\n return 2 * p[N - 1] + 1\n\n\nprint((F(n, x)))\n","code_same":false,"relative_loc_diff_percent":25.9259259259,"diff":["-# \u30ec\u30d9\u30ebN\u306e\u5c64\u3068\u30d1\u30c6\u30a3\u306e\u6570\u3092\u6c42\u3081\u308b","-def cnt(n, x):","- # \u30ec\u30d9\u30ebN\u306e\u30d0\u30fc\u30ac\u30fc\u306eX\u5c64\u307e\u3067\u306b\u542b\u307e\u308c\u308b\u30d1\u30c6\u30a3\u3092\u6570\u3048\u308b","- if n == 0:","- return 1 if x >= 1 else 0","- elif x <= 1 + a[n - 1]:","- return cnt(n - 1, x - 1)","- elif 2 + a[n - 1] <= x:","- return cnt(n - 1, x - (a[n - 1] + 2)) + p[n - 1] + 1","+def F(N, X):","+ if N == 0:","+ return 0 if X <= 0 else 1","+ elif X == 1:","+ return 0","+ elif 1 < X <= 1 + a[N - 1]:","+ return F(N - 1, X - 1)","+ elif X == 2 + a[N - 1]:","+ return p[N - 1] + 1","+ elif 2 + a[N - 1] < X <= a[N] - 1:","+ return F(N - 1, X - (2 + a[N - 1])) + p[N - 1] + 1","+ elif X == a[N]:","+ return 2 * p[N - 1] + 1","-print((cnt(n, x)))","+print((F(n, x)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0956934843,"measured_runtime_v1":0.0427579033,"runtime_lift":2.2380303246,"key":["s350952376","s007756501"]} +{"user_id":"u983967747","problem_id":"p02572","language":"python","submission_id_v0":"s832151364","submission_id_v1":"s498730211","cpu_time_v0":143,"cpu_time_v1":126,"memory_v0":31736,"memory_v1":31596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.89,"input":"s = int(eval(input()))\n\na = list(map(int,input().split()))\n\nmod = 10 ** 9 + 7\n\nans = 0\n\nsum_a = sum(a)\n\nfor i in range(s):\n\n sum_a -= a[i]\n\n ans += sum_a * a[i] % mod\n\nprint((ans%mod))","target":"s = int(eval(input()))\n\na = list(map(int,input().split()))\n\nmod = 10 ** 9 + 7\n\nans = 0\n\nsum_a = sum(a)\n\nfor i in range(s):\n\n sum_a -= a[i]\n\n ans += sum_a * a[i]\n\nprint((ans%mod))","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":182,"code_v1_num_chars":176,"code_v0_no_empty_lines":"s = int(eval(input()))\na = list(map(int, input().split()))\nmod = 10**9 + 7\nans = 0\nsum_a = sum(a)\nfor i in range(s):\n sum_a -= a[i]\n ans += sum_a * a[i] % mod\nprint((ans % mod))\n","code_v1_no_empty_lines":"s = int(eval(input()))\na = list(map(int, input().split()))\nmod = 10**9 + 7\nans = 0\nsum_a = sum(a)\nfor i in range(s):\n sum_a -= a[i]\n ans += sum_a * a[i]\nprint((ans % mod))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- ans += sum_a * a[i] % mod","+ ans += sum_a * a[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0084261865,"measured_runtime_v1":0.0356380735,"runtime_lift":0.2364377658,"key":["s832151364","s498730211"]} +{"user_id":"u394950523","problem_id":"p02791","language":"python","submission_id_v0":"s313766245","submission_id_v1":"s645238398","cpu_time_v0":106,"cpu_time_v1":98,"memory_v0":24744,"memory_v1":24744,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.55,"input":"N = int(eval(input()))\n\nP = list(map(int, input().split()))\n\n\n\nl = []\n\na = P[0]\n\nfor i in range(N):\n\n if P[i] <= a:\n\n a = P[i]\n\n continue\n\n else:\n\n l.append(i)\n\nprint((N - len(l)))","target":"N = int(eval(input()))\n\nP = list(map(int, input().split()))\n\n\n\nl = 0\n\na = P[0]\n\nfor p in P:\n\n if p <= a:\n\n a = p\n\n l += 1\n\n continue\n\nprint(l)","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":199,"code_v1_num_chars":160,"code_v0_no_empty_lines":"N = int(eval(input()))\nP = list(map(int, input().split()))\nl = []\na = P[0]\nfor i in range(N):\n if P[i] <= a:\n a = P[i]\n continue\n else:\n l.append(i)\nprint((N - len(l)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nP = list(map(int, input().split()))\nl = 0\na = P[0]\nfor p in P:\n if p <= a:\n a = p\n l += 1\n continue\nprint(l)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-l = []","+l = 0","-for i in range(N):","- if P[i] <= a:","- a = P[i]","+for p in P:","+ if p <= a:","+ a = p","+ l += 1","- else:","- l.append(i)","-print((N - len(l)))","+print(l)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0374284565,"measured_runtime_v1":0.035900742,"runtime_lift":1.0425538414,"key":["s313766245","s645238398"]} +{"user_id":"u094191970","problem_id":"p02629","language":"python","submission_id_v0":"s965777657","submission_id_v1":"s744676158","cpu_time_v0":33,"cpu_time_v1":28,"memory_v0":9160,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.15,"input":"from sys import stdin\n\nnii=lambda:list(map(int,stdin.readline().split()))\n\nlnii=lambda:list(map(int,stdin.readline().split()))\n\n\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\n\n\nn=int(eval(input()))\n\n\n\nans=''\n\nwhile n!=0:\n\n t_ans=n%26\n\n ans+=str(abc[t_ans-1])\n\n\n\n if abc[t_ans-1]=='z':\n\n n-=1\n\n\n\n n\/\/=26\n\n\n\nprint((ans[::-1]))","target":"n=int(eval(input()))\n\n\n\nabc='abcdefghijklmnopqrstuvwxyz'\n\n\n\nans=''\n\nwhile n!=0:\n\n q=n%26\n\n ans+=abc[q-1]\n\n\n\n if q==0:\n\n n-=1\n\n\n\n n\/\/=26\n\n\n\nprint((ans[::-1]))","code_v0_loc":19,"code_v1_loc":15,"code_v0_num_chars":306,"code_v1_num_chars":156,"code_v0_no_empty_lines":"from sys import stdin\n\nnii = lambda: list(map(int, stdin.readline().split()))\nlnii = lambda: list(map(int, stdin.readline().split()))\nabc = \"abcdefghijklmnopqrstuvwxyz\"\nn = int(eval(input()))\nans = \"\"\nwhile n != 0:\n t_ans = n % 26\n ans += str(abc[t_ans - 1])\n if abc[t_ans - 1] == \"z\":\n n -= 1\n n \/\/= 26\nprint((ans[::-1]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nabc = \"abcdefghijklmnopqrstuvwxyz\"\nans = \"\"\nwhile n != 0:\n q = n % 26\n ans += abc[q - 1]\n if q == 0:\n n -= 1\n n \/\/= 26\nprint((ans[::-1]))\n","code_same":false,"relative_loc_diff_percent":21.0526315789,"diff":["-from sys import stdin","-","-nii = lambda: list(map(int, stdin.readline().split()))","-lnii = lambda: list(map(int, stdin.readline().split()))","+n = int(eval(input()))","-n = int(eval(input()))","- t_ans = n % 26","- ans += str(abc[t_ans - 1])","- if abc[t_ans - 1] == \"z\":","+ q = n % 26","+ ans += abc[q - 1]","+ if q == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0427728097,"measured_runtime_v1":0.0480444791,"runtime_lift":0.8902752305,"key":["s965777657","s744676158"]} +{"user_id":"u180058306","problem_id":"p03805","language":"python","submission_id_v0":"s057062135","submission_id_v1":"s240717469","cpu_time_v0":44,"cpu_time_v1":27,"memory_v0":3828,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.64,"input":"# \u9802\u70b9\u304a\u3088\u3073\u8fba\u306e\u6570\u3092\u5165\u529b\n\nN, M = list(map(int, input().split()))\n\n# \u8fba\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\n\nlist_edge = [[] for _ in range(N + 1)]\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n list_edge[a].append(b)\n\n list_edge[b].append(a)\n\n# \u30d1\u30b9\uff08\u30ea\u30b9\u30c8\uff09\u306e\u30ea\u30b9\u30c8\u3092\u521d\u671f\u5316\n\nlist_path = [[1]]\n\n# \u30d1\u30b9\u304c\u5b58\u5728\u3059\u308b\u3001\u304b\u3064\u30d1\u30b9\u306e\u9577\u3055\u304c\u9802\u70b9\u306e\u6570\u672a\u6e80\u3067\u3042\u308b\u5834\u5408\u306b\u7e70\u308a\u8fd4\u3057\n\nwhile list_path != [] and len(list_path[0]) < N:\n\n # \u30d1\u30b9\u306e\u30ea\u30b9\u30c8\u304b\u3089\u5148\u982d\u306e\u30d1\u30b9\u3092\u53d6\u308a\u51fa\u3059\n\n path = list_path.pop(0)\n\n # \u30d1\u30b9\u306e\u6700\u5f8c\u5c3e\u306e\u9802\u70b9\u304b\u3089\u8a2a\u554f\u53ef\u80fd\u306a\u9802\u70b9\u306b\u3064\u3044\u3066\u3001\u3001\n\n for node in list_edge[path[-1]]:\n\n # \u305d\u306e\u9802\u70b9\u306b\u307e\u3060\u8a2a\u554f\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u3001\n\n if node not in path:\n\n # \u30d1\u30b9\u306e\u30ea\u30b9\u30c8\u306b\u65b0\u305f\u306a\u30d1\u30b9\u3092\u52a0\u3048\u308b\n\n list_path.append(path + [node])\n\n# \u30d1\u30b9\u306e\u6570\u3092\u51fa\u529b\u3059\u308b\n\nprint((len(list_path)))","target":"# \u9802\u70b9\u304a\u3088\u3073\u8fba\u306e\u6570\u3092\u5165\u529b\n\nN, M = list(map(int, input().split()))\n\n# \u8fba\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\n\nlist_edge = [[] for _ in range(N + 1)]\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n list_edge[a].append(b)\n\n list_edge[b].append(a)\n\n\n\n# \u30d1\u30b9\u306e\u6570\u3092\u8fd4\u3059\u95a2\u6570\u3092\u5b9a\u7fa9\n\ndef count_path(node, path, list_edge, N):\n\n # \u30d1\u30b9\u306e\u6570\u3092\u521d\u671f\u5316\n\n count = 0\n\n # \u5168\u3066\u306e\u9802\u70b9\u3092\u8a2a\u554f\u3057\u305f\u5834\u5408\u3001\u3001\n\n if len(path) == N:\n\n # \u30d1\u30b9\u306e\u6570\u306b1\u3092\u52a0\u3048\u308b\n\n count += 1\n\n # \u5168\u3066\u306e\u9802\u70b9\u3092\u8a2a\u554f\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u3001\n\n else:\n\n # \u73fe\u5728\u306e\u9802\u70b9\u304b\u3089\u8a2a\u554f\u3067\u304d\u308b\u5404\u9802\u70b9\u306b\u3064\u3044\u3066\u3001\u3001\n\n for next_node in list_edge[node]:\n\n # \u305d\u306e\u9802\u70b9\u306b\u307e\u3060\u8a2a\u554f\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u3001\n\n if next_node not in path:\n\n # \u518d\u5e30\n\n count += count_path(next_node, path + [next_node], list_edge, N)\n\n # \u30d1\u30b9\u306e\u672c\u6570\u3092\u8fd4\u3059\n\n return count\n\n# \u30d1\u30b9\u306e\u672c\u6570\u3092\u51fa\u529b\u3059\u308b\n\nprint((count_path(1, [1], list_edge, N)))","code_v0_loc":22,"code_v1_loc":29,"code_v0_num_chars":635,"code_v1_num_chars":771,"code_v0_no_empty_lines":"# \u9802\u70b9\u304a\u3088\u3073\u8fba\u306e\u6570\u3092\u5165\u529b\nN, M = list(map(int, input().split()))\n# \u8fba\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\nlist_edge = [[] for _ in range(N + 1)]\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n list_edge[a].append(b)\n list_edge[b].append(a)\n# \u30d1\u30b9\uff08\u30ea\u30b9\u30c8\uff09\u306e\u30ea\u30b9\u30c8\u3092\u521d\u671f\u5316\nlist_path = [[1]]\n# \u30d1\u30b9\u304c\u5b58\u5728\u3059\u308b\u3001\u304b\u3064\u30d1\u30b9\u306e\u9577\u3055\u304c\u9802\u70b9\u306e\u6570\u672a\u6e80\u3067\u3042\u308b\u5834\u5408\u306b\u7e70\u308a\u8fd4\u3057\nwhile list_path != [] and len(list_path[0]) < N:\n # \u30d1\u30b9\u306e\u30ea\u30b9\u30c8\u304b\u3089\u5148\u982d\u306e\u30d1\u30b9\u3092\u53d6\u308a\u51fa\u3059\n path = list_path.pop(0)\n # \u30d1\u30b9\u306e\u6700\u5f8c\u5c3e\u306e\u9802\u70b9\u304b\u3089\u8a2a\u554f\u53ef\u80fd\u306a\u9802\u70b9\u306b\u3064\u3044\u3066\u3001\u3001\n for node in list_edge[path[-1]]:\n # \u305d\u306e\u9802\u70b9\u306b\u307e\u3060\u8a2a\u554f\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u3001\n if node not in path:\n # \u30d1\u30b9\u306e\u30ea\u30b9\u30c8\u306b\u65b0\u305f\u306a\u30d1\u30b9\u3092\u52a0\u3048\u308b\n list_path.append(path + [node])\n# \u30d1\u30b9\u306e\u6570\u3092\u51fa\u529b\u3059\u308b\nprint((len(list_path)))\n","code_v1_no_empty_lines":"# \u9802\u70b9\u304a\u3088\u3073\u8fba\u306e\u6570\u3092\u5165\u529b\nN, M = list(map(int, input().split()))\n# \u8fba\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\nlist_edge = [[] for _ in range(N + 1)]\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n list_edge[a].append(b)\n list_edge[b].append(a)\n# \u30d1\u30b9\u306e\u6570\u3092\u8fd4\u3059\u95a2\u6570\u3092\u5b9a\u7fa9\ndef count_path(node, path, list_edge, N):\n # \u30d1\u30b9\u306e\u6570\u3092\u521d\u671f\u5316\n count = 0\n # \u5168\u3066\u306e\u9802\u70b9\u3092\u8a2a\u554f\u3057\u305f\u5834\u5408\u3001\u3001\n if len(path) == N:\n # \u30d1\u30b9\u306e\u6570\u306b1\u3092\u52a0\u3048\u308b\n count += 1\n # \u5168\u3066\u306e\u9802\u70b9\u3092\u8a2a\u554f\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u3001\n else:\n # \u73fe\u5728\u306e\u9802\u70b9\u304b\u3089\u8a2a\u554f\u3067\u304d\u308b\u5404\u9802\u70b9\u306b\u3064\u3044\u3066\u3001\u3001\n for next_node in list_edge[node]:\n # \u305d\u306e\u9802\u70b9\u306b\u307e\u3060\u8a2a\u554f\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u3001\n if next_node not in path:\n # \u518d\u5e30\n count += count_path(next_node, path + [next_node], list_edge, N)\n # \u30d1\u30b9\u306e\u672c\u6570\u3092\u8fd4\u3059\n return count\n\n\n# \u30d1\u30b9\u306e\u672c\u6570\u3092\u51fa\u529b\u3059\u308b\nprint((count_path(1, [1], list_edge, N)))\n","code_same":false,"relative_loc_diff_percent":24.1379310345,"diff":["-# \u30d1\u30b9\uff08\u30ea\u30b9\u30c8\uff09\u306e\u30ea\u30b9\u30c8\u3092\u521d\u671f\u5316","-list_path = [[1]]","-# \u30d1\u30b9\u304c\u5b58\u5728\u3059\u308b\u3001\u304b\u3064\u30d1\u30b9\u306e\u9577\u3055\u304c\u9802\u70b9\u306e\u6570\u672a\u6e80\u3067\u3042\u308b\u5834\u5408\u306b\u7e70\u308a\u8fd4\u3057","-while list_path != [] and len(list_path[0]) < N:","- # \u30d1\u30b9\u306e\u30ea\u30b9\u30c8\u304b\u3089\u5148\u982d\u306e\u30d1\u30b9\u3092\u53d6\u308a\u51fa\u3059","- path = list_path.pop(0)","- # \u30d1\u30b9\u306e\u6700\u5f8c\u5c3e\u306e\u9802\u70b9\u304b\u3089\u8a2a\u554f\u53ef\u80fd\u306a\u9802\u70b9\u306b\u3064\u3044\u3066\u3001\u3001","- for node in list_edge[path[-1]]:","- # \u305d\u306e\u9802\u70b9\u306b\u307e\u3060\u8a2a\u554f\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u3001","- if node not in path:","- # \u30d1\u30b9\u306e\u30ea\u30b9\u30c8\u306b\u65b0\u305f\u306a\u30d1\u30b9\u3092\u52a0\u3048\u308b","- list_path.append(path + [node])","-# \u30d1\u30b9\u306e\u6570\u3092\u51fa\u529b\u3059\u308b","-print((len(list_path)))","+# \u30d1\u30b9\u306e\u6570\u3092\u8fd4\u3059\u95a2\u6570\u3092\u5b9a\u7fa9","+def count_path(node, path, list_edge, N):","+ # \u30d1\u30b9\u306e\u6570\u3092\u521d\u671f\u5316","+ count = 0","+ # \u5168\u3066\u306e\u9802\u70b9\u3092\u8a2a\u554f\u3057\u305f\u5834\u5408\u3001\u3001","+ if len(path) == N:","+ # \u30d1\u30b9\u306e\u6570\u306b1\u3092\u52a0\u3048\u308b","+ count += 1","+ # \u5168\u3066\u306e\u9802\u70b9\u3092\u8a2a\u554f\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u3001","+ else:","+ # \u73fe\u5728\u306e\u9802\u70b9\u304b\u3089\u8a2a\u554f\u3067\u304d\u308b\u5404\u9802\u70b9\u306b\u3064\u3044\u3066\u3001\u3001","+ for next_node in list_edge[node]:","+ # \u305d\u306e\u9802\u70b9\u306b\u307e\u3060\u8a2a\u554f\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u3001","+ if next_node not in path:","+ # \u518d\u5e30","+ count += count_path(next_node, path + [next_node], list_edge, N)","+ # \u30d1\u30b9\u306e\u672c\u6570\u3092\u8fd4\u3059","+ return count","+","+","+# \u30d1\u30b9\u306e\u672c\u6570\u3092\u51fa\u529b\u3059\u308b","+print((count_path(1, [1], list_edge, N)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0354268115,"measured_runtime_v1":0.0774331717,"runtime_lift":0.4575146631,"key":["s057062135","s240717469"]} +{"user_id":"u729133443","problem_id":"p02990","language":"python","submission_id_v0":"s406249508","submission_id_v1":"s159783611","cpu_time_v0":877,"cpu_time_v1":76,"memory_v0":13532,"memory_v1":27760,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.33,"input":"from scipy.misc import*\n\nn,k=list(map(int,input().split()))\n\nfor i in range(k):print((comb(n-k+1,i+1,1)*comb(k-1,i,1)%(10**9+7)))","target":"n,k=list(map(int,input().split()));p=n-k+1;i=0;exec('print(p%(10**9+7));i+=1;p=p*(k-i)*(n-k+1-i)\/\/i\/\/-~i;'*k)","code_v0_loc":3,"code_v1_loc":1,"code_v0_num_chars":121,"code_v1_num_chars":103,"code_v0_no_empty_lines":"from scipy.misc import *\n\nn, k = list(map(int, input().split()))\nfor i in range(k):\n print((comb(n - k + 1, i + 1, 1) * comb(k - 1, i, 1) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\np = n - k + 1\ni = 0\nexec(\"print(p%(10**9+7));i+=1;p=p*(k-i)*(n-k+1-i)\/\/i\/\/-~i;\" * k)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-from scipy.misc import *","-","-for i in range(k):","- print((comb(n - k + 1, i + 1, 1) * comb(k - 1, i, 1) % (10**9 + 7)))","+p = n - k + 1","+i = 0","+exec(\"print(p%(10**9+7));i+=1;p=p*(k-i)*(n-k+1-i)\/\/i\/\/-~i;\" * k)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4423946697,"measured_runtime_v1":0.0348242464,"runtime_lift":12.7036394241,"key":["s406249508","s159783611"]} +{"user_id":"u678167152","problem_id":"p02629","language":"python","submission_id_v0":"s506447199","submission_id_v1":"s611837406","cpu_time_v0":67,"cpu_time_v1":28,"memory_v0":61860,"memory_v1":9164,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.21,"input":"N = int(eval(input()))\n\nlis = [0,26]\n\nnum = 26\n\nn = 1\n\nwhile lis[-1]pow(26,k):\n\n N -= pow(26,k)\n\n k += 1\n\n ans = ''\n\n N -= 1\n\n for i in range(k,0,-1):\n\n if i>1:\n\n ans += chr(ord('a')+N\/\/pow(26,i-1))\n\n else:\n\n ans += chr(ord('a')+N%pow(26,i))\n\n N%=pow(26,i-1)\n\n return ans\n\nprint((solve()))","code_v0_loc":14,"code_v1_loc":16,"code_v0_num_chars":230,"code_v1_num_chars":301,"code_v0_no_empty_lines":"N = int(eval(input()))\nlis = [0, 26]\nnum = 26\nn = 1\nwhile lis[-1] < N:\n num *= 26\n lis.append(lis[-1] + num)\n n += 1\nc = N - lis[-2] - 1\nans = \"\"\nfor i in range(n):\n ans = chr(c % 26 + ord(\"a\")) + ans\n c \/\/= 26\nprint(ans)\n","code_v1_no_empty_lines":"def solve():\n N = int(eval(input()))\n k = 1\n while N > pow(26, k):\n N -= pow(26, k)\n k += 1\n ans = \"\"\n N -= 1\n for i in range(k, 0, -1):\n if i > 1:\n ans += chr(ord(\"a\") + N \/\/ pow(26, i - 1))\n else:\n ans += chr(ord(\"a\") + N % pow(26, i))\n N %= pow(26, i - 1)\n return ans\n\n\nprint((solve()))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-N = int(eval(input()))","-lis = [0, 26]","-num = 26","-n = 1","-while lis[-1] < N:","- num *= 26","- lis.append(lis[-1] + num)","- n += 1","-c = N - lis[-2] - 1","-ans = \"\"","-for i in range(n):","- ans = chr(c % 26 + ord(\"a\")) + ans","- c \/\/= 26","-print(ans)","+def solve():","+ N = int(eval(input()))","+ k = 1","+ while N > pow(26, k):","+ N -= pow(26, k)","+ k += 1","+ ans = \"\"","+ N -= 1","+ for i in range(k, 0, -1):","+ if i > 1:","+ ans += chr(ord(\"a\") + N \/\/ pow(26, i - 1))","+ else:","+ ans += chr(ord(\"a\") + N % pow(26, i))","+ N %= pow(26, i - 1)","+ return ans","+","+","+print((solve()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0343038239,"measured_runtime_v1":0.0405857396,"runtime_lift":0.8452186474,"key":["s506447199","s611837406"]} +{"user_id":"u073852194","problem_id":"p03166","language":"python","submission_id_v0":"s101918421","submission_id_v1":"s981034216","cpu_time_v0":401,"cpu_time_v1":161,"memory_v0":71388,"memory_v1":94624,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.85,"input":"import sys\n\nfrom collections import deque\n\n\n\ninput = sys.stdin.readline\n\n\n\nN,M = list(map(int,input().split()))\n\nedge = [list(map(int,input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N)]\n\nindegree = [0 for _ in range(N)]\n\n\n\nfor i in range(M):\n\n graph[edge[i][0]-1].append(edge[i][1]-1)\n\n indegree[edge[i][1]-1] += 1\n\n\n\nqueue = deque()\n\nfor i in range(N):\n\n if indegree[i] == 0:\n\n queue.append(i)\n\n\n\ndp = [0]*N\n\n\n\nwhile queue:\n\n node = queue.popleft()\n\n for adj in graph[node]:\n\n indegree[adj] -= 1\n\n if indegree[adj] == 0:\n\n queue.append(adj)\n\n dp[adj] = dp[node]+1\n\n\n\nprint((max(dp)))","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, M = list(map(int, input().split()))\n\ngraph = [[] for _ in range(N)]\n\ndeg = [0 for _ in range(N)]\n\ndp = [0 for _ in range(N)]\n\n\n\nfor _ in range(M):\n\n x, y = list(map(int, input().split()))\n\n graph[x - 1].append(y - 1)\n\n deg[y - 1] += 1\n\n\n\nstack = []\n\n\n\nfor i in range(N):\n\n if not deg[i]:\n\n stack.append(i)\n\n\n\nwhile stack:\n\n node = stack.pop()\n\n for adj in graph[node]:\n\n deg[adj] -= 1\n\n dp[adj] = max(dp[adj], dp[node] + 1)\n\n if not deg[adj]:\n\n stack.append(adj)\n\n\n\nprint((max(dp)))","code_v0_loc":31,"code_v1_loc":28,"code_v0_num_chars":653,"code_v1_num_chars":577,"code_v0_no_empty_lines":"import sys\nfrom collections import deque\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nedge = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N)]\nindegree = [0 for _ in range(N)]\nfor i in range(M):\n graph[edge[i][0] - 1].append(edge[i][1] - 1)\n indegree[edge[i][1] - 1] += 1\nqueue = deque()\nfor i in range(N):\n if indegree[i] == 0:\n queue.append(i)\ndp = [0] * N\nwhile queue:\n node = queue.popleft()\n for adj in graph[node]:\n indegree[adj] -= 1\n if indegree[adj] == 0:\n queue.append(adj)\n dp[adj] = dp[node] + 1\nprint((max(dp)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nN, M = list(map(int, input().split()))\ngraph = [[] for _ in range(N)]\ndeg = [0 for _ in range(N)]\ndp = [0 for _ in range(N)]\nfor _ in range(M):\n x, y = list(map(int, input().split()))\n graph[x - 1].append(y - 1)\n deg[y - 1] += 1\nstack = []\nfor i in range(N):\n if not deg[i]:\n stack.append(i)\nwhile stack:\n node = stack.pop()\n for adj in graph[node]:\n deg[adj] -= 1\n dp[adj] = max(dp[adj], dp[node] + 1)\n if not deg[adj]:\n stack.append(adj)\nprint((max(dp)))\n","code_same":false,"relative_loc_diff_percent":9.6774193548,"diff":["-from collections import deque","-input = sys.stdin.readline","+input = sys.stdin.buffer.readline","-edge = [list(map(int, input().split())) for _ in range(M)]","-indegree = [0 for _ in range(N)]","-for i in range(M):","- graph[edge[i][0] - 1].append(edge[i][1] - 1)","- indegree[edge[i][1] - 1] += 1","-queue = deque()","+deg = [0 for _ in range(N)]","+dp = [0 for _ in range(N)]","+for _ in range(M):","+ x, y = list(map(int, input().split()))","+ graph[x - 1].append(y - 1)","+ deg[y - 1] += 1","+stack = []","- if indegree[i] == 0:","- queue.append(i)","-dp = [0] * N","-while queue:","- node = queue.popleft()","+ if not deg[i]:","+ stack.append(i)","+while stack:","+ node = stack.pop()","- indegree[adj] -= 1","- if indegree[adj] == 0:","- queue.append(adj)","- dp[adj] = dp[node] + 1","+ deg[adj] -= 1","+ dp[adj] = max(dp[adj], dp[node] + 1)","+ if not deg[adj]:","+ stack.append(adj)"],"diff_only_import_comment":false,"measured_runtime_v0":0.041633431,"measured_runtime_v1":0.041595866,"runtime_lift":1.0009030941,"key":["s101918421","s981034216"]} +{"user_id":"u116002573","problem_id":"p02953","language":"python","submission_id_v0":"s201954152","submission_id_v1":"s623808662","cpu_time_v0":80,"cpu_time_v1":52,"memory_v0":14396,"memory_v1":14396,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.0,"input":"N = int(eval(input()))\n\nH = [int(x) for x in input().split()]\n\n\n\nprev = -1\n\nis_possible = \"Yes\"\n\nfor i in range(N):\n\n if prev < H[i]:\n\n H[i] -= 1\n\n if prev > H[i]:\n\n is_possible = \"No\"\n\n break\n\n prev = H[i]\n\n\n\nprint(is_possible)\n","target":"def main():\n\n\n\n N = int(eval(input()))\n\n H = list(map(int, input().split()))\n\n prev = float('-inf')\n\n for i in range(len(H)):\n\n if H[i] > prev: prev = H[i]-1\n\n elif H[i] == prev: pass\n\n else: return \"No\"\n\n\n\n return \"Yes\"\n\n\n\nif __name__ == '__main__':\n\n print((main()))","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":253,"code_v1_num_chars":299,"code_v0_no_empty_lines":"N = int(eval(input()))\nH = [int(x) for x in input().split()]\nprev = -1\nis_possible = \"Yes\"\nfor i in range(N):\n if prev < H[i]:\n H[i] -= 1\n if prev > H[i]:\n is_possible = \"No\"\n break\n prev = H[i]\nprint(is_possible)\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n H = list(map(int, input().split()))\n prev = float(\"-inf\")\n for i in range(len(H)):\n if H[i] > prev:\n prev = H[i] - 1\n elif H[i] == prev:\n pass\n else:\n return \"No\"\n return \"Yes\"\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-N = int(eval(input()))","-H = [int(x) for x in input().split()]","-prev = -1","-is_possible = \"Yes\"","-for i in range(N):","- if prev < H[i]:","- H[i] -= 1","- if prev > H[i]:","- is_possible = \"No\"","- break","- prev = H[i]","-print(is_possible)","+def main():","+ N = int(eval(input()))","+ H = list(map(int, input().split()))","+ prev = float(\"-inf\")","+ for i in range(len(H)):","+ if H[i] > prev:","+ prev = H[i] - 1","+ elif H[i] == prev:","+ pass","+ else:","+ return \"No\"","+ return \"Yes\"","+","+","+if __name__ == \"__main__\":","+ print((main()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372195976,"measured_runtime_v1":0.0408877885,"runtime_lift":0.9102863936,"key":["s201954152","s623808662"]} +{"user_id":"u680851063","problem_id":"p02773","language":"python","submission_id_v0":"s484625598","submission_id_v1":"s292983180","cpu_time_v0":903,"cpu_time_v1":579,"memory_v0":45024,"memory_v1":35936,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.88,"input":"import collections\n\nimport itertools\n\n\n\nn = int(input())\n\nl = [input() for _ in [0] * n]\n\n\n\ncounter = collections.Counter(l)\n\n\n\na = counter.most_common()[0][-1]\n\nb = itertools.takewhile(\n\n lambda kv: kv[-1] == a, counter.most_common()\n\n)\n\n\n\nc = sorted(list(k for k, v in b))\n\nprint(*c,sep='\\n')\n\n\n\n\n","target":"import collections\n\n\n\nn = int(input())\n\nl = [input() for _ in [0] * n]\n\n\n\ncounted = collections.Counter(l)\n\n#print(counted)\n\n# \u6700\u983b\u5024\u3092\u6c42\u3081\u308b\n\nm = max(counted.values())\n\n#print(m)\n\n# \u983b\u51fa\u6570\u306e\u6587\u5b57\u3092\u96c6\u3081\u308b\n\nchars = [key for key, value in counted.items()\n\n if value == m]\n\n\n\nprint(*sorted(chars),sep='\\n')\n\n\n","code_v0_loc":17,"code_v1_loc":16,"code_v0_num_chars":302,"code_v1_num_chars":300,"code_v0_no_empty_lines":"import collections\nimport itertools\n\nn = int(input())\nl = [input() for _ in [0] * n]\ncounter = collections.Counter(l)\na = counter.most_common()[0][-1]\nb = itertools.takewhile(lambda kv: kv[-1] == a, counter.most_common())\nc = sorted(list(k for k, v in b))\nprint(*c, sep=\"\\n\")\n","code_v1_no_empty_lines":"import collections\n\nn = int(input())\nl = [input() for _ in [0] * n]\ncounted = collections.Counter(l)\n# print(counted)\n# \u6700\u983b\u5024\u3092\u6c42\u3081\u308b\nm = max(counted.values())\n# print(m)\n# \u983b\u51fa\u6570\u306e\u6587\u5b57\u3092\u96c6\u3081\u308b\nchars = [key for key, value in counted.items() if value == m]\nprint(*sorted(chars), sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-import itertools","-counter = collections.Counter(l)","-a = counter.most_common()[0][-1]","-b = itertools.takewhile(lambda kv: kv[-1] == a, counter.most_common())","-c = sorted(list(k for k, v in b))","-print(*c, sep=\"\\n\")","+counted = collections.Counter(l)","+# print(counted)","+# \u6700\u983b\u5024\u3092\u6c42\u3081\u308b","+m = max(counted.values())","+# print(m)","+# \u983b\u51fa\u6570\u306e\u6587\u5b57\u3092\u96c6\u3081\u308b","+chars = [key for key, value in counted.items() if value == m]","+print(*sorted(chars), sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0374315283,"measured_runtime_v1":0.037949892,"runtime_lift":0.986340838,"key":["s484625598","s292983180"]} +{"user_id":"u300645821","problem_id":"p00760","language":"python","submission_id_v0":"s144204612","submission_id_v1":"s799459029","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4216,"memory_v1":4220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"import sys\n\nif sys.version_info[0]>=3: raw_input=input\n\n\n\nn=int(input())\n\nfor i in range(0,n):\n\n\ta=list(map(int,input().split()))\n\n\ta[0]-=1;a[1]-=1\n\n\tprint((196471-a[0]*195-a[0]\/3*5-a[1]*20+(a[1]\/2 if a[0]%3!=2 else 0)-a[2]))","target":"import sys\n\nif sys.version_info[0]>=3: raw_input=input\n\n\n\nn=int(input())\n\nfor i in range(0,n):\n\n\ta=[int(e) for e in input().split()]\n\n\ta[0]-=1;a[1]-=1\n\n\tprint((196471-a[0]*195-a[0]\/3*5-a[1]*20+(a[1]\/2 if a[0]%3!=2 else 0)-a[2]))","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":225,"code_v1_num_chars":234,"code_v0_no_empty_lines":"import sys\n\nif sys.version_info[0] >= 3:\n raw_input = input\nn = int(input())\nfor i in range(0, n):\n a = list(map(int, input().split()))\n a[0] -= 1\n a[1] -= 1\n print(\n (\n 196471\n - a[0] * 195\n - a[0] \/ 3 * 5\n - a[1] * 20\n + (a[1] \/ 2 if a[0] % 3 != 2 else 0)\n - a[2]\n )\n )\n","code_v1_no_empty_lines":"import sys\n\nif sys.version_info[0] >= 3:\n raw_input = input\nn = int(input())\nfor i in range(0, n):\n a = [int(e) for e in input().split()]\n a[0] -= 1\n a[1] -= 1\n print(\n (\n 196471\n - a[0] * 195\n - a[0] \/ 3 * 5\n - a[1] * 20\n + (a[1] \/ 2 if a[0] % 3 != 2 else 0)\n - a[2]\n )\n )\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- a = list(map(int, input().split()))","+ a = [int(e) for e in input().split()]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0427522159,"measured_runtime_v1":0.0430974603,"runtime_lift":0.9919892166,"key":["s144204612","s799459029"]} +{"user_id":"u723345499","problem_id":"p02640","language":"python","submission_id_v0":"s946661212","submission_id_v1":"s252006621","cpu_time_v0":24,"cpu_time_v1":22,"memory_v0":9184,"memory_v1":9180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.33,"input":"x, y = list(map(int, input().split()))\n\n\n\nflg = False\n\nfor i in range(101):\n\n for j in range(101):\n\n if (i * 2) + (j * 4) == y and (i + j) == x:\n\n print(\"Yes\")\n\n flg = True\n\n break\n\n if flg == True:\n\n break\n\nelse:\n\n print(\"No\")","target":"x, y = list(map(int, input().split()))\n\n\n\nans = \"No\"\n\nfor i in range(101):\n\n for j in range(101):\n\n if (i * 2) + (j * 4) == y and (i + j) == x:\n\n ans = \"Yes\"\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":8,"code_v0_num_chars":277,"code_v1_num_chars":184,"code_v0_no_empty_lines":"x, y = list(map(int, input().split()))\nflg = False\nfor i in range(101):\n for j in range(101):\n if (i * 2) + (j * 4) == y and (i + j) == x:\n print(\"Yes\")\n flg = True\n break\n if flg == True:\n break\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"x, y = list(map(int, input().split()))\nans = \"No\"\nfor i in range(101):\n for j in range(101):\n if (i * 2) + (j * 4) == y and (i + j) == x:\n ans = \"Yes\"\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":38.4615384615,"diff":["-flg = False","+ans = \"No\"","- print(\"Yes\")","- flg = True","- break","- if flg == True:","- break","-else:","- print(\"No\")","+ ans = \"Yes\"","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.132777056,"measured_runtime_v1":0.0531169398,"runtime_lift":2.4997120786,"key":["s946661212","s252006621"]} +{"user_id":"u638282348","problem_id":"p03835","language":"python","submission_id_v0":"s043728844","submission_id_v1":"s811448585","cpu_time_v0":1095,"cpu_time_v1":937,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.43,"input":"k, s = list(map(int, input().split()))\n\nprint((sum(0 <= s - (x + y) <= k for y in range(k + 1) for x in range(k + 1))))\n","target":"[print(sum(0 <= s - (x + y) <= k for y in range(k + 1) for x in range(k + 1))) for k, s in [map(int, input().split())]]\n","code_v0_loc":2,"code_v1_loc":1,"code_v0_num_chars":112,"code_v1_num_chars":120,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\nprint((sum(0 <= s - (x + y) <= k for y in range(k + 1) for x in range(k + 1))))\n","code_v1_no_empty_lines":"[\n print(sum(0 <= s - (x + y) <= k for y in range(k + 1) for x in range(k + 1)))\n for k, s in [map(int, input().split())]\n]\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-k, s = list(map(int, input().split()))","-print((sum(0 <= s - (x + y) <= k for y in range(k + 1) for x in range(k + 1))))","+[","+ print(sum(0 <= s - (x + y) <= k for y in range(k + 1) for x in range(k + 1)))","+ for k, s in [map(int, input().split())]","+]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0425029779,"measured_runtime_v1":0.0373857462,"runtime_lift":1.1368765423,"key":["s043728844","s811448585"]} +{"user_id":"u761320129","problem_id":"p03752","language":"python","submission_id_v0":"s768375145","submission_id_v1":"s213207458","cpu_time_v0":161,"cpu_time_v1":120,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.47,"input":"N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\n\n\nans = float('inf')\n\nfor b in range(1<<(N-1)):\n\n mxa = A[0]\n\n k = 1\n\n cost = 0\n\n for i,a in enumerate(A[1:]):\n\n if b&(1<= K:\n\n ans = min(ans, cost)\n\nprint(ans)","target":"N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nif K==1:\n\n print((0))\n\n exit()\n\n\n\nans = 10**12\n\nfor b in range(1<<(N-1)):\n\n h = A[0]\n\n k = 1\n\n cost = 0\n\n for i in range(N-1):\n\n a = A[i+1]\n\n if a > h:\n\n k += 1\n\n h = a\n\n elif b&(1<= K:\n\n ans = min(ans, cost)\n\nprint(ans)","code_v0_loc":21,"code_v1_loc":23,"code_v0_num_chars":470,"code_v1_num_chars":439,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nans = float(\"inf\")\nfor b in range(1 << (N - 1)):\n mxa = A[0]\n k = 1\n cost = 0\n for i, a in enumerate(A[1:]):\n if b & (1 << i):\n c = max(0, mxa + 1 - a)\n cost += c\n mxa = max(a, mxa + 1)\n k += 1\n else:\n if mxa < a:\n mxa = a\n k += 1\n if k >= K:\n ans = min(ans, cost)\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nif K == 1:\n print((0))\n exit()\nans = 10**12\nfor b in range(1 << (N - 1)):\n h = A[0]\n k = 1\n cost = 0\n for i in range(N - 1):\n a = A[i + 1]\n if a > h:\n k += 1\n h = a\n elif b & (1 << i):\n k += 1\n cost += h + 1 - a\n h += 1\n if k >= K:\n ans = min(ans, cost)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["-ans = float(\"inf\")","+if K == 1:","+ print((0))","+ exit()","+ans = 10**12","- mxa = A[0]","+ h = A[0]","- for i, a in enumerate(A[1:]):","- if b & (1 << i):","- c = max(0, mxa + 1 - a)","- cost += c","- mxa = max(a, mxa + 1)","+ for i in range(N - 1):","+ a = A[i + 1]","+ if a > h:","- else:","- if mxa < a:","- mxa = a","- k += 1","+ h = a","+ elif b & (1 << i):","+ k += 1","+ cost += h + 1 - a","+ h += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0425439157,"measured_runtime_v1":0.0713005562,"runtime_lift":0.5966842058,"key":["s768375145","s213207458"]} +{"user_id":"u620084012","problem_id":"p02720","language":"python","submission_id_v0":"s249051456","submission_id_v1":"s430911802","cpu_time_v0":246,"cpu_time_v1":126,"memory_v0":71536,"memory_v1":37796,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.78,"input":"K = int(eval(input()))\n\na = set([1,2,3,4,5,6,7,8,9])\n\nprev = set([1,2,3,4,5,6,7,8,9])\n\n\n\nwhile len(a) < K:\n\n temp = set()\n\n for now in prev:\n\n c = now%10\n\n if c == 0:\n\n temp.add(now*10)\n\n temp.add(now*10+1)\n\n elif c == 9:\n\n temp.add(now*10+9)\n\n temp.add(now*10+8)\n\n else:\n\n temp.add(now*10+c-1)\n\n temp.add(now*10+c)\n\n temp.add(now*10+c+1)\n\n prev = temp\n\n a = a|temp\n\nprint((sorted(list(a))[K-1]))\n","target":"K = int(eval(input()))\n\nS = set([1,2,3,4,5,6,7,8,9])\n\nprev = set([1,2,3,4,5,6,7,8,9])\n\n\n\nwhile len(S) < K:\n\n temp = set([])\n\n for e in prev:\n\n if e%10 == 0:\n\n temp.add(e*10)\n\n temp.add(e*10+1)\n\n elif e%10 == 9:\n\n temp.add(e*10+8)\n\n temp.add(e*10+9)\n\n else:\n\n temp.add(e*10+e%10-1)\n\n temp.add(e*10+e%10)\n\n temp.add(e*10+e%10+1)\n\n prev = temp\n\n S = S|temp\n\nprint((sorted(list(S))[K-1]))\n","code_v0_loc":21,"code_v1_loc":20,"code_v0_num_chars":506,"code_v1_num_chars":487,"code_v0_no_empty_lines":"K = int(eval(input()))\na = set([1, 2, 3, 4, 5, 6, 7, 8, 9])\nprev = set([1, 2, 3, 4, 5, 6, 7, 8, 9])\nwhile len(a) < K:\n temp = set()\n for now in prev:\n c = now % 10\n if c == 0:\n temp.add(now * 10)\n temp.add(now * 10 + 1)\n elif c == 9:\n temp.add(now * 10 + 9)\n temp.add(now * 10 + 8)\n else:\n temp.add(now * 10 + c - 1)\n temp.add(now * 10 + c)\n temp.add(now * 10 + c + 1)\n prev = temp\n a = a | temp\nprint((sorted(list(a))[K - 1]))\n","code_v1_no_empty_lines":"K = int(eval(input()))\nS = set([1, 2, 3, 4, 5, 6, 7, 8, 9])\nprev = set([1, 2, 3, 4, 5, 6, 7, 8, 9])\nwhile len(S) < K:\n temp = set([])\n for e in prev:\n if e % 10 == 0:\n temp.add(e * 10)\n temp.add(e * 10 + 1)\n elif e % 10 == 9:\n temp.add(e * 10 + 8)\n temp.add(e * 10 + 9)\n else:\n temp.add(e * 10 + e % 10 - 1)\n temp.add(e * 10 + e % 10)\n temp.add(e * 10 + e % 10 + 1)\n prev = temp\n S = S | temp\nprint((sorted(list(S))[K - 1]))\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["-a = set([1, 2, 3, 4, 5, 6, 7, 8, 9])","+S = set([1, 2, 3, 4, 5, 6, 7, 8, 9])","-while len(a) < K:","- temp = set()","- for now in prev:","- c = now % 10","- if c == 0:","- temp.add(now * 10)","- temp.add(now * 10 + 1)","- elif c == 9:","- temp.add(now * 10 + 9)","- temp.add(now * 10 + 8)","+while len(S) < K:","+ temp = set([])","+ for e in prev:","+ if e % 10 == 0:","+ temp.add(e * 10)","+ temp.add(e * 10 + 1)","+ elif e % 10 == 9:","+ temp.add(e * 10 + 8)","+ temp.add(e * 10 + 9)","- temp.add(now * 10 + c - 1)","- temp.add(now * 10 + c)","- temp.add(now * 10 + c + 1)","+ temp.add(e * 10 + e % 10 - 1)","+ temp.add(e * 10 + e % 10)","+ temp.add(e * 10 + e % 10 + 1)","- a = a | temp","-print((sorted(list(a))[K - 1]))","+ S = S | temp","+print((sorted(list(S))[K - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3865150044,"measured_runtime_v1":0.1994290795,"runtime_lift":1.9381075482,"key":["s249051456","s430911802"]} +{"user_id":"u301624971","problem_id":"p03386","language":"python","submission_id_v0":"s265065207","submission_id_v1":"s715520288","cpu_time_v0":22,"cpu_time_v1":18,"memory_v0":3444,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"\n\nimport sys\n\nA,B,K=list(map(int,input().split()))\n\nif((B-A) < K):\n\n for i in range(A,B+1):\n\n print(i)\n\n sys.exit()\n\nansmin=[i for i in range(A,A+K,1)]\n\nansmax=[i for i in range(B,B-K,-1)]\n\n\n\nans=ansmin+ansmax\n\nans=set(ans)\n\nans=sorted(ans)\n\nfor a in ans:\n\n print(a)\n","target":"def myAnswer(A:int,B:int,K:int) -> int:\n\n if(B - A >= K):\n\n ans = [i for i in range(A,A+K) ]\n\n for i in range(B,B-K,-1):\n\n ans.append(i)\n\n else:\n\n ans = [i for i in range(A,B+1)]\n\n ans = list(set(ans))\n\n ans.sort()\n\n for a in ans:\n\n print(a)\n\n\n\n \n\n\n\ndef modelAnswer():\n\n tmp=1\n\ndef main():\n\n A,B,K = list(map(int,input().split()))\n\n myAnswer(A,B,K)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":15,"code_v1_loc":22,"code_v0_num_chars":277,"code_v1_num_chars":429,"code_v0_no_empty_lines":"import sys\n\nA, B, K = list(map(int, input().split()))\nif (B - A) < K:\n for i in range(A, B + 1):\n print(i)\n sys.exit()\nansmin = [i for i in range(A, A + K, 1)]\nansmax = [i for i in range(B, B - K, -1)]\nans = ansmin + ansmax\nans = set(ans)\nans = sorted(ans)\nfor a in ans:\n print(a)\n","code_v1_no_empty_lines":"def myAnswer(A: int, B: int, K: int) -> int:\n if B - A >= K:\n ans = [i for i in range(A, A + K)]\n for i in range(B, B - K, -1):\n ans.append(i)\n else:\n ans = [i for i in range(A, B + 1)]\n ans = list(set(ans))\n ans.sort()\n for a in ans:\n print(a)\n\n\ndef modelAnswer():\n tmp = 1\n\n\ndef main():\n A, B, K = list(map(int, input().split()))\n myAnswer(A, B, K)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":31.8181818182,"diff":["-import sys","+def myAnswer(A: int, B: int, K: int) -> int:","+ if B - A >= K:","+ ans = [i for i in range(A, A + K)]","+ for i in range(B, B - K, -1):","+ ans.append(i)","+ else:","+ ans = [i for i in range(A, B + 1)]","+ ans = list(set(ans))","+ ans.sort()","+ for a in ans:","+ print(a)","-A, B, K = list(map(int, input().split()))","-if (B - A) < K:","- for i in range(A, B + 1):","- print(i)","- sys.exit()","-ansmin = [i for i in range(A, A + K, 1)]","-ansmax = [i for i in range(B, B - K, -1)]","-ans = ansmin + ansmax","-ans = set(ans)","-ans = sorted(ans)","-for a in ans:","- print(a)","+","+def modelAnswer():","+ tmp = 1","+","+","+def main():","+ A, B, K = list(map(int, input().split()))","+ myAnswer(A, B, K)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0367063653,"measured_runtime_v1":0.0353929615,"runtime_lift":1.0371091816,"key":["s265065207","s715520288"]} +{"user_id":"u761320129","problem_id":"p03440","language":"python","submission_id_v0":"s157077348","submission_id_v1":"s785130360","cpu_time_v0":543,"cpu_time_v1":437,"memory_v0":50256,"memory_v1":33824,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.52,"input":"N,M = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nXY = [tuple(map(int,input().split())) for i in range(M)]\n\n\n\nif M==N-1:\n\n print((0))\n\n exit()\n\n\n\nclass UnionFind:\n\n def __init__(self,N):\n\n self.parent = [i for i in range(N)]\n\n self._size = [1] * N\n\n self.count = 0\n\n def root(self,a):\n\n if self.parent[a] == a:\n\n return a\n\n else:\n\n self.parent[a] = self.root(self.parent[a])\n\n return self.parent[a]\n\n def is_same(self,a,b):\n\n return self.root(a) == self.root(b)\n\n def unite(self,a,b):\n\n ra = self.root(a)\n\n rb = self.root(b)\n\n if ra == rb: return\n\n if self._size[ra] < self._size[rb]: ra,rb = rb,ra\n\n self._size[ra] += self._size[rb]\n\n self.parent[rb] = ra\n\n self.count += 1\n\n def size(self,a):\n\n return self._size[self.root(a)]\n\n\n\nuf = UnionFind(N)\n\nfor x,y in XY:\n\n if uf.is_same(x,y): continue\n\n uf.unite(x,y)\n\nfor i in range(N):\n\n uf.root(i)\n\n\n\nfrom collections import defaultdict\n\ndic = defaultdict(lambda: set())\n\nfor i in range(N):\n\n dic[uf.root(i)].add(i)\n\n\n\nneed = (len(dic)-1)*2\n\nif need > N:\n\n print('Impossible')\n\n exit()\n\n\n\nans = used = 0\n\nimport heapq\n\nhq = []\n\nheapq.heapify(hq)\n\nfor r,vs in list(dic.items()):\n\n mini = -1\n\n mina = 10**9+1\n\n for i in vs:\n\n if A[i] < mina:\n\n mina = A[i]\n\n mini = i\n\n ans += mina\n\n used += 1\n\n for i in vs:\n\n if i==mini: continue\n\n heapq.heappush(hq, A[i])\n\n\n\nfor _ in range(need - used):\n\n ans += heapq.heappop(hq)\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\nN,M = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nXY = [tuple(map(int,input().split())) for i in range(M)]\n\n\n\nif (N-1-M)*2 > N:\n\n print('Impossible')\n\n exit()\n\n\n\nclass UnionFind:\n\n def __init__(self,N):\n\n self.parent = [i for i in range(N)]\n\n self._size = [1] * N\n\n self.count = 0\n\n def root(self,a):\n\n if self.parent[a] == a:\n\n return a\n\n else:\n\n self.parent[a] = self.root(self.parent[a])\n\n return self.parent[a]\n\n def is_same(self,a,b):\n\n return self.root(a) == self.root(b)\n\n def unite(self,a,b):\n\n ra = self.root(a)\n\n rb = self.root(b)\n\n if ra == rb: return\n\n if self._size[ra] < self._size[rb]: ra,rb = rb,ra\n\n self._size[ra] += self._size[rb]\n\n self.parent[rb] = ra\n\n self.count += 1\n\n def size(self,a):\n\n return self._size[self.root(a)]\n\n\n\nuf = UnionFind(N)\n\nfor x,y in XY:\n\n if uf.is_same(x,y): continue\n\n uf.unite(x,y)\n\nfor i in range(N):\n\n uf.root(i)\n\n\n\nfrom collections import defaultdict\n\ndic = defaultdict(lambda: [])\n\nfor i in range(N):\n\n r = uf.root(i)\n\n dic[r].append(A[i])\n\nif len(dic)==1:\n\n print((0))\n\n exit()\n\n\n\nans = 0\n\narr = []\n\nc = 0\n\nfor k in list(dic.keys()):\n\n dic[k].sort(reverse=True)\n\n ans += dic[k].pop()\n\n c += 1\n\n for a in dic[k]:\n\n arr.append(a)\n\nrem = (N-1-M)*2 - c\n\nif rem > len(arr):\n\n print('Impossible')\n\nelse:\n\n arr.sort()\n\n ans += sum(arr[:rem])\n\nprint(ans)","code_v0_loc":69,"code_v1_loc":66,"code_v0_num_chars":1618,"code_v1_num_chars":1549,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nXY = [tuple(map(int, input().split())) for i in range(M)]\nif M == N - 1:\n print((0))\n exit()\n\n\nclass UnionFind:\n def __init__(self, N):\n self.parent = [i for i in range(N)]\n self._size = [1] * N\n self.count = 0\n\n def root(self, a):\n if self.parent[a] == a:\n return a\n else:\n self.parent[a] = self.root(self.parent[a])\n return self.parent[a]\n\n def is_same(self, a, b):\n return self.root(a) == self.root(b)\n\n def unite(self, a, b):\n ra = self.root(a)\n rb = self.root(b)\n if ra == rb:\n return\n if self._size[ra] < self._size[rb]:\n ra, rb = rb, ra\n self._size[ra] += self._size[rb]\n self.parent[rb] = ra\n self.count += 1\n\n def size(self, a):\n return self._size[self.root(a)]\n\n\nuf = UnionFind(N)\nfor x, y in XY:\n if uf.is_same(x, y):\n continue\n uf.unite(x, y)\nfor i in range(N):\n uf.root(i)\nfrom collections import defaultdict\n\ndic = defaultdict(lambda: set())\nfor i in range(N):\n dic[uf.root(i)].add(i)\nneed = (len(dic) - 1) * 2\nif need > N:\n print(\"Impossible\")\n exit()\nans = used = 0\nimport heapq\n\nhq = []\nheapq.heapify(hq)\nfor r, vs in list(dic.items()):\n mini = -1\n mina = 10**9 + 1\n for i in vs:\n if A[i] < mina:\n mina = A[i]\n mini = i\n ans += mina\n used += 1\n for i in vs:\n if i == mini:\n continue\n heapq.heappush(hq, A[i])\nfor _ in range(need - used):\n ans += heapq.heappop(hq)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nXY = [tuple(map(int, input().split())) for i in range(M)]\nif (N - 1 - M) * 2 > N:\n print(\"Impossible\")\n exit()\n\n\nclass UnionFind:\n def __init__(self, N):\n self.parent = [i for i in range(N)]\n self._size = [1] * N\n self.count = 0\n\n def root(self, a):\n if self.parent[a] == a:\n return a\n else:\n self.parent[a] = self.root(self.parent[a])\n return self.parent[a]\n\n def is_same(self, a, b):\n return self.root(a) == self.root(b)\n\n def unite(self, a, b):\n ra = self.root(a)\n rb = self.root(b)\n if ra == rb:\n return\n if self._size[ra] < self._size[rb]:\n ra, rb = rb, ra\n self._size[ra] += self._size[rb]\n self.parent[rb] = ra\n self.count += 1\n\n def size(self, a):\n return self._size[self.root(a)]\n\n\nuf = UnionFind(N)\nfor x, y in XY:\n if uf.is_same(x, y):\n continue\n uf.unite(x, y)\nfor i in range(N):\n uf.root(i)\nfrom collections import defaultdict\n\ndic = defaultdict(lambda: [])\nfor i in range(N):\n r = uf.root(i)\n dic[r].append(A[i])\nif len(dic) == 1:\n print((0))\n exit()\nans = 0\narr = []\nc = 0\nfor k in list(dic.keys()):\n dic[k].sort(reverse=True)\n ans += dic[k].pop()\n c += 1\n for a in dic[k]:\n arr.append(a)\nrem = (N - 1 - M) * 2 - c\nif rem > len(arr):\n print(\"Impossible\")\nelse:\n arr.sort()\n ans += sum(arr[:rem])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["+import sys","+","+input = sys.stdin.readline","-if M == N - 1:","- print((0))","+if (N - 1 - M) * 2 > N:","+ print(\"Impossible\")","-dic = defaultdict(lambda: set())","+dic = defaultdict(lambda: [])","- dic[uf.root(i)].add(i)","-need = (len(dic) - 1) * 2","-if need > N:","+ r = uf.root(i)","+ dic[r].append(A[i])","+if len(dic) == 1:","+ print((0))","+ exit()","+ans = 0","+arr = []","+c = 0","+for k in list(dic.keys()):","+ dic[k].sort(reverse=True)","+ ans += dic[k].pop()","+ c += 1","+ for a in dic[k]:","+ arr.append(a)","+rem = (N - 1 - M) * 2 - c","+if rem > len(arr):","- exit()","-ans = used = 0","-import heapq","-","-hq = []","-heapq.heapify(hq)","-for r, vs in list(dic.items()):","- mini = -1","- mina = 10**9 + 1","- for i in vs:","- if A[i] < mina:","- mina = A[i]","- mini = i","- ans += mina","- used += 1","- for i in vs:","- if i == mini:","- continue","- heapq.heappush(hq, A[i])","-for _ in range(need - used):","- ans += heapq.heappop(hq)","+else:","+ arr.sort()","+ ans += sum(arr[:rem])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376542792,"measured_runtime_v1":0.1034732742,"runtime_lift":0.3639034283,"key":["s157077348","s785130360"]} +{"user_id":"u332906195","problem_id":"p03108","language":"python","submission_id_v0":"s824854918","submission_id_v1":"s320792010","cpu_time_v0":1095,"cpu_time_v1":943,"memory_v0":43768,"memory_v1":33696,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.88,"input":"# -*- coding: utf-8 -*-\n\n\n\nfrom scipy.misc import comb\n\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\n\n\n\n\nclass UnionFind:\n\n\n\n def __init__(self, n):\n\n self.parent = [i for i in range(n + 1)]\n\n self.depth = [1] * (n + 1)\n\n self.count = [1] * (n + 1)\n\n\n\n def find(self, x):\n\n if self.parent[x] == x:\n\n if self.depth[x] > 2:\n\n self.depth[x] = 2\n\n return x\n\n else:\n\n self.parent[x] = self.find(self.parent[x])\n\n self.depth[x], self.count[x] = 0, 0\n\n return self.parent[x]\n\n\n\n def isSame(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def union(self, x, y):\n\n x, y = self.find(x), self.find(y)\n\n\n\n if self.depth[x] < self.depth[y]:\n\n self.parent[x] = self.parent[y]\n\n self.count[y] += self.count[x]\n\n self.depth[x], self.count[x] = 0, 0\n\n else:\n\n self.parent[y] = self.parent[x]\n\n self.count[x] += self.count[y]\n\n self.depth[y], self.count[y] = 0, 0\n\n if self.depth[x] == self.depth[y]:\n\n self.depth[x] += 1\n\n\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\nA, B = [], []\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n A.append(a)\n\n B.append(b)\n\n\n\nA.reverse()\n\nB.reverse()\n\n\n\ngroups = UnionFind(N)\n\nans = [comb(N, 2, exact=True)]\n\nfor i in range(M):\n\n tmp = ans[-1]\n\n if not groups.isSame(A[i], B[i]):\n\n nA, nB = groups.count[groups.find(\n\n A[i])], groups.count[groups.find(B[i])]\n\n tmp -= nA * nB\n\n groups.union(A[i], B[i])\n\n ans.append(tmp)\n\n\n\nfor i in range(M):\n\n print((ans[-(i + 2)]))\n","target":"# -*- coding: utf-8 -*-\n\n\n\nfrom scipy.misc import comb\n\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\n\n\n\n\nclass UnionFind:\n\n\n\n def __init__(self, n):\n\n # parent[x] < 0 means x is root and abs(parent[x]) == size[x]\n\n self.parent, self.depth = [-1] * (n + 1), [0] * (n + 1)\n\n\n\n def find(self, x):\n\n if self.parent[x] < 0:\n\n return x\n\n else:\n\n self.parent[x] = self.find(self.parent[x])\n\n return self.parent[x]\n\n\n\n def isSame(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def unite(self, x, y):\n\n x, y = self.find(x), self.find(y)\n\n\n\n if self.depth[x] > self.depth[y]:\n\n self.parent[x] += self.parent[y]\n\n self.parent[y] = x\n\n else:\n\n self.parent[y] += self.parent[x]\n\n self.parent[x] = y\n\n if self.depth[x] == self.depth[y]:\n\n self.depth[y] += 1\n\n\n\n def count(self, x):\n\n return - self.parent[self.find(x)]\n\n\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\nAB = [tuple(map(int, input().split())) for _ in range(M)]\n\nAB.reverse()\n\n\n\ngroups = UnionFind(N)\n\nans = [comb(N, 2, exact=True)]\n\nfor i in range(M):\n\n if groups.isSame(AB[i][0], AB[i][1]):\n\n ans.append(ans[-1])\n\n else:\n\n ans.append(ans[-1] - groups.count(AB[i][0]) * groups.count(AB[i][1]))\n\n groups.unite(AB[i][0], AB[i][1])\n\n\n\nfor i in range(M):\n\n print((ans[-(i + 2)]))\n","code_v0_loc":66,"code_v1_loc":55,"code_v0_num_chars":1684,"code_v1_num_chars":1438,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nfrom scipy.misc import comb\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\n\nclass UnionFind:\n def __init__(self, n):\n self.parent = [i for i in range(n + 1)]\n self.depth = [1] * (n + 1)\n self.count = [1] * (n + 1)\n\n def find(self, x):\n if self.parent[x] == x:\n if self.depth[x] > 2:\n self.depth[x] = 2\n return x\n else:\n self.parent[x] = self.find(self.parent[x])\n self.depth[x], self.count[x] = 0, 0\n return self.parent[x]\n\n def isSame(self, x, y):\n return self.find(x) == self.find(y)\n\n def union(self, x, y):\n x, y = self.find(x), self.find(y)\n if self.depth[x] < self.depth[y]:\n self.parent[x] = self.parent[y]\n self.count[y] += self.count[x]\n self.depth[x], self.count[x] = 0, 0\n else:\n self.parent[y] = self.parent[x]\n self.count[x] += self.count[y]\n self.depth[y], self.count[y] = 0, 0\n if self.depth[x] == self.depth[y]:\n self.depth[x] += 1\n\n\nN, M = list(map(int, input().split()))\nA, B = [], []\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n A.append(a)\n B.append(b)\nA.reverse()\nB.reverse()\ngroups = UnionFind(N)\nans = [comb(N, 2, exact=True)]\nfor i in range(M):\n tmp = ans[-1]\n if not groups.isSame(A[i], B[i]):\n nA, nB = groups.count[groups.find(A[i])], groups.count[groups.find(B[i])]\n tmp -= nA * nB\n groups.union(A[i], B[i])\n ans.append(tmp)\nfor i in range(M):\n print((ans[-(i + 2)]))\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nfrom scipy.misc import comb\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\n\nclass UnionFind:\n def __init__(self, n):\n # parent[x] < 0 means x is root and abs(parent[x]) == size[x]\n self.parent, self.depth = [-1] * (n + 1), [0] * (n + 1)\n\n def find(self, x):\n if self.parent[x] < 0:\n return x\n else:\n self.parent[x] = self.find(self.parent[x])\n return self.parent[x]\n\n def isSame(self, x, y):\n return self.find(x) == self.find(y)\n\n def unite(self, x, y):\n x, y = self.find(x), self.find(y)\n if self.depth[x] > self.depth[y]:\n self.parent[x] += self.parent[y]\n self.parent[y] = x\n else:\n self.parent[y] += self.parent[x]\n self.parent[x] = y\n if self.depth[x] == self.depth[y]:\n self.depth[y] += 1\n\n def count(self, x):\n return -self.parent[self.find(x)]\n\n\nN, M = list(map(int, input().split()))\nAB = [tuple(map(int, input().split())) for _ in range(M)]\nAB.reverse()\ngroups = UnionFind(N)\nans = [comb(N, 2, exact=True)]\nfor i in range(M):\n if groups.isSame(AB[i][0], AB[i][1]):\n ans.append(ans[-1])\n else:\n ans.append(ans[-1] - groups.count(AB[i][0]) * groups.count(AB[i][1]))\n groups.unite(AB[i][0], AB[i][1])\nfor i in range(M):\n print((ans[-(i + 2)]))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["- self.parent = [i for i in range(n + 1)]","- self.depth = [1] * (n + 1)","- self.count = [1] * (n + 1)","+ # parent[x] < 0 means x is root and abs(parent[x]) == size[x]","+ self.parent, self.depth = [-1] * (n + 1), [0] * (n + 1)","- if self.parent[x] == x:","- if self.depth[x] > 2:","- self.depth[x] = 2","+ if self.parent[x] < 0:","- self.depth[x], self.count[x] = 0, 0","- def union(self, x, y):","+ def unite(self, x, y):","- if self.depth[x] < self.depth[y]:","- self.parent[x] = self.parent[y]","- self.count[y] += self.count[x]","- self.depth[x], self.count[x] = 0, 0","+ if self.depth[x] > self.depth[y]:","+ self.parent[x] += self.parent[y]","+ self.parent[y] = x","- self.parent[y] = self.parent[x]","- self.count[x] += self.count[y]","- self.depth[y], self.count[y] = 0, 0","+ self.parent[y] += self.parent[x]","+ self.parent[x] = y","- self.depth[x] += 1","+ self.depth[y] += 1","+","+ def count(self, x):","+ return -self.parent[self.find(x)]","-A, B = [], []","-for _ in range(M):","- a, b = list(map(int, input().split()))","- A.append(a)","- B.append(b)","-A.reverse()","-B.reverse()","+AB = [tuple(map(int, input().split())) for _ in range(M)]","+AB.reverse()","- tmp = ans[-1]","- if not groups.isSame(A[i], B[i]):","- nA, nB = groups.count[groups.find(A[i])], groups.count[groups.find(B[i])]","- tmp -= nA * nB","- groups.union(A[i], B[i])","- ans.append(tmp)","+ if groups.isSame(AB[i][0], AB[i][1]):","+ ans.append(ans[-1])","+ else:","+ ans.append(ans[-1] - groups.count(AB[i][0]) * groups.count(AB[i][1]))","+ groups.unite(AB[i][0], AB[i][1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.4872127695,"measured_runtime_v1":0.2996637797,"runtime_lift":1.6258647272,"key":["s824854918","s320792010"]} +{"user_id":"u564589929","problem_id":"p02813","language":"python","submission_id_v0":"s734575273","submission_id_v1":"s742509888","cpu_time_v0":185,"cpu_time_v1":27,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.41,"input":"from collections import deque\n\nn = int(eval(input()))\n\np_que = deque(list(map(int, input().split())))\n\nq_que = deque(list(map(int, input().split())))\n\n\n\nque = deque(i for i in range(1, n+1))\n\ncnt = 0\n\na = 0\n\nb = 0\n\n\n\ndef dfs(d, q):\n\n # print('-'*10, q)\n\n # sorted(q)\n\n for i in list(q):\n\n # print(i, d, q)\n\n d.append(i)\n\n q.remove(i)\n\n # print('>', d, q)\n\n if q == deque([]):\n\n global cnt\n\n cnt += 1\n\n # print('>>>', cnt, d, q)\n\n if d == p_que:\n\n global a\n\n a = cnt\n\n if d == q_que:\n\n global b\n\n b = cnt\n\n # print('return')\n\n d.remove(i)\n\n q.appendleft(i)\n\n return\n\n # print('tansaku')\n\n dfs(d, q)\n\n # print('>returned')\n\n # print('---', i, d, q)\n\n d.remove(i)\n\n if i > q[0]:\n\n q.append(i)\n\n else:\n\n q.appendleft(i)\n\n q = deque(sorted(q))\n\n\n\ndfs(deque(), que)\n\n# print(a, b)\n\nprint((abs(a-b)))","target":"from itertools import permutations\n\nn = int(eval(input()))\n\nP = tuple(map(int, input().split()))\n\nQ = tuple(map(int, input().split()))\n\n\n\nn_list = [x for x in range(1, n+1)]\n\n# print(list(permutations(n_list, n)))\n\na = b = 0\n\nfor n, i in enumerate(permutations(n_list, n)):\n\n # print(n, i)\n\n if i == P:\n\n a = n\n\n if i == Q:\n\n b = n\n\n \n\nprint((abs(a-b)))","code_v0_loc":46,"code_v1_loc":16,"code_v0_num_chars":898,"code_v1_num_chars":357,"code_v0_no_empty_lines":"from collections import deque\n\nn = int(eval(input()))\np_que = deque(list(map(int, input().split())))\nq_que = deque(list(map(int, input().split())))\nque = deque(i for i in range(1, n + 1))\ncnt = 0\na = 0\nb = 0\n\n\ndef dfs(d, q):\n # print('-'*10, q)\n # sorted(q)\n for i in list(q):\n # print(i, d, q)\n d.append(i)\n q.remove(i)\n # print('>', d, q)\n if q == deque([]):\n global cnt\n cnt += 1\n # print('>>>', cnt, d, q)\n if d == p_que:\n global a\n a = cnt\n if d == q_que:\n global b\n b = cnt\n # print('return')\n d.remove(i)\n q.appendleft(i)\n return\n # print('tansaku')\n dfs(d, q)\n # print('>returned')\n # print('---', i, d, q)\n d.remove(i)\n if i > q[0]:\n q.append(i)\n else:\n q.appendleft(i)\n q = deque(sorted(q))\n\n\ndfs(deque(), que)\n# print(a, b)\nprint((abs(a - b)))\n","code_v1_no_empty_lines":"from itertools import permutations\n\nn = int(eval(input()))\nP = tuple(map(int, input().split()))\nQ = tuple(map(int, input().split()))\nn_list = [x for x in range(1, n + 1)]\n# print(list(permutations(n_list, n)))\na = b = 0\nfor n, i in enumerate(permutations(n_list, n)):\n # print(n, i)\n if i == P:\n a = n\n if i == Q:\n b = n\nprint((abs(a - b)))\n","code_same":false,"relative_loc_diff_percent":65.2173913043,"diff":["-from collections import deque","+from itertools import permutations","-p_que = deque(list(map(int, input().split())))","-q_que = deque(list(map(int, input().split())))","-que = deque(i for i in range(1, n + 1))","-cnt = 0","-a = 0","-b = 0","-","-","-def dfs(d, q):","- # print('-'*10, q)","- # sorted(q)","- for i in list(q):","- # print(i, d, q)","- d.append(i)","- q.remove(i)","- # print('>', d, q)","- if q == deque([]):","- global cnt","- cnt += 1","- # print('>>>', cnt, d, q)","- if d == p_que:","- global a","- a = cnt","- if d == q_que:","- global b","- b = cnt","- # print('return')","- d.remove(i)","- q.appendleft(i)","- return","- # print('tansaku')","- dfs(d, q)","- # print('>returned')","- d.remove(i)","- if i > q[0]:","- q.append(i)","- else:","- q.appendleft(i)","- q = deque(sorted(q))","-","-","-dfs(deque(), que)","-# print(a, b)","+P = tuple(map(int, input().split()))","+Q = tuple(map(int, input().split()))","+n_list = [x for x in range(1, n + 1)]","+# print(list(permutations(n_list, n)))","+a = b = 0","+for n, i in enumerate(permutations(n_list, n)):","+ # print(n, i)","+ if i == P:","+ a = n","+ if i == Q:","+ b = n"],"diff_only_import_comment":false,"measured_runtime_v0":0.2224411488,"measured_runtime_v1":0.0442416191,"runtime_lift":5.0278708868,"key":["s734575273","s742509888"]} +{"user_id":"u745812846","problem_id":"p02759","language":"python","submission_id_v0":"s236245394","submission_id_v1":"s298372669","cpu_time_v0":171,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.06,"input":"n = int(eval(input()))\n\nprint((int(n\/2) if n%2 == 0 else n\/\/2+1))","target":"print((-(-int(eval(input()))\/\/2)))","code_v0_loc":2,"code_v1_loc":1,"code_v0_num_chars":57,"code_v1_num_chars":26,"code_v0_no_empty_lines":"n = int(eval(input()))\nprint((int(n \/ 2) if n % 2 == 0 else n \/\/ 2 + 1))\n","code_v1_no_empty_lines":"print((-(-int(eval(input())) \/\/ 2)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-n = int(eval(input()))","-print((int(n \/ 2) if n % 2 == 0 else n \/\/ 2 + 1))","+print((-(-int(eval(input())) \/\/ 2)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0351843305,"measured_runtime_v1":0.0588188844,"runtime_lift":0.5981808535,"key":["s236245394","s298372669"]} +{"user_id":"u796942881","problem_id":"p03457","language":"python","submission_id_v0":"s889079435","submission_id_v1":"s069936328","cpu_time_v0":199,"cpu_time_v1":140,"memory_v0":21080,"memory_v1":10276,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.65,"input":"from sys import stdin\n\n\n\ninput = stdin.readline\n\n\n\nN = int(eval(input()))\n\n\n\ntxy = [[int(j) for j in input().split()] for i in range(N)]\n\n\n\n\n\ndef main():\n\n pt = 0\n\n px = 0\n\n py = 0\n\n\n\n flg = False\n\n\n\n for t, x, y in txy:\n\n dt = t - pt - abs(x - px) - abs(y - py)\n\n # \u4f59\u3063\u305f\u6642\u9593\u304c\u5947\u6570 \u623b\u308c\u306a\u3044\n\n if dt < 0 or dt % 2 == 1:\n\n break\n\n\n\n pt = t\n\n px = x\n\n py = y\n\n else:\n\n # break \u3057\u306a\u304b\u3063\u305f \u5b8c\u8d70\n\n flg = True\n\n\n\n print((\"Yes\" if flg else \"No\"))\n\n return\n\n\n\n\n\nmain()\n","target":"from sys import stdin\n\n\n\ninput = stdin.readline\n\nlines = stdin.readlines\n\n\n\nN = int(eval(input()))\n\n\n\ntxy = ((list(map(int, line.split()))) for line in lines())\n\n\n\n\n\ndef main():\n\n pt = 0\n\n px = 0\n\n py = 0\n\n\n\n flg = False\n\n\n\n for t, x, y in txy:\n\n dt = t - pt - abs(x - px) - abs(y - py)\n\n # \u4f59\u3063\u305f\u6642\u9593\u304c\u5947\u6570 \u623b\u308c\u306a\u3044\n\n if dt < 0 or dt % 2 == 1:\n\n break\n\n\n\n pt = t\n\n px = x\n\n py = y\n\n else:\n\n # break \u3057\u306a\u304b\u3063\u305f \u5b8c\u8d70\n\n flg = True\n\n\n\n print((\"Yes\" if flg else \"No\"))\n\n return\n\n\n\n\n\nmain()\n","code_v0_loc":34,"code_v1_loc":35,"code_v0_num_chars":526,"code_v1_num_chars":544,"code_v0_no_empty_lines":"from sys import stdin\n\ninput = stdin.readline\nN = int(eval(input()))\ntxy = [[int(j) for j in input().split()] for i in range(N)]\n\n\ndef main():\n pt = 0\n px = 0\n py = 0\n flg = False\n for t, x, y in txy:\n dt = t - pt - abs(x - px) - abs(y - py)\n # \u4f59\u3063\u305f\u6642\u9593\u304c\u5947\u6570 \u623b\u308c\u306a\u3044\n if dt < 0 or dt % 2 == 1:\n break\n pt = t\n px = x\n py = y\n else:\n # break \u3057\u306a\u304b\u3063\u305f \u5b8c\u8d70\n flg = True\n print((\"Yes\" if flg else \"No\"))\n return\n\n\nmain()\n","code_v1_no_empty_lines":"from sys import stdin\n\ninput = stdin.readline\nlines = stdin.readlines\nN = int(eval(input()))\ntxy = ((list(map(int, line.split()))) for line in lines())\n\n\ndef main():\n pt = 0\n px = 0\n py = 0\n flg = False\n for t, x, y in txy:\n dt = t - pt - abs(x - px) - abs(y - py)\n # \u4f59\u3063\u305f\u6642\u9593\u304c\u5947\u6570 \u623b\u308c\u306a\u3044\n if dt < 0 or dt % 2 == 1:\n break\n pt = t\n px = x\n py = y\n else:\n # break \u3057\u306a\u304b\u3063\u305f \u5b8c\u8d70\n flg = True\n print((\"Yes\" if flg else \"No\"))\n return\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":2.8571428571,"diff":["+lines = stdin.readlines","-txy = [[int(j) for j in input().split()] for i in range(N)]","+txy = ((list(map(int, line.split()))) for line in lines())"],"diff_only_import_comment":false,"measured_runtime_v0":0.0413620386,"measured_runtime_v1":0.0408319325,"runtime_lift":1.0129826345,"key":["s889079435","s069936328"]} +{"user_id":"u777923818","problem_id":"p03049","language":"python","submission_id_v0":"s975351586","submission_id_v1":"s592358103","cpu_time_v0":42,"cpu_time_v1":36,"memory_v0":3572,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"from collections import defaultdict, deque, Counter\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\nN = int(eval(input()))\n\nA = 0\n\nBA = 0\n\nB = 0\n\nZ = 0\n\nans = 0\n\n\n\nfor _ in range(N):\n\n s = eval(input())\n\n ans += s.count(\"AB\")\n\n if s[0] == \"B\":\n\n if s[-1] == \"A\":\n\n BA += 1\n\n else:\n\n B += 1\n\n elif s[-1] == \"A\":\n\n A += 1\n\n\n\nif BA:\n\n ans += (BA - 1)\n\n if A:\n\n A -= 1\n\n ans += 1\n\n if B:\n\n B -= 1\n\n ans += 1\n\n\n\nans += min(A, B)\n\nprint(ans)","target":"N = int(eval(input()))\n\nA = 0\n\nB = 0\n\nAB = 0\n\nans = 0\n\nfor _ in range(N):\n\n S = eval(input())\n\n ans += S.count(\"AB\")\n\n if S[0] == \"B\":\n\n if S[-1] == \"A\":\n\n AB += 1\n\n else:\n\n B += 1\n\n elif S[-1] == \"A\":\n\n A += 1\n\n\n\nif AB:\n\n ans += AB-1\n\n if A:\n\n ans += 1\n\n A -= 1\n\n if B:\n\n ans += 1\n\n B -= 1\n\n\n\nans += min(A, B)\n\nprint(ans)","code_v0_loc":32,"code_v1_loc":27,"code_v0_num_chars":522,"code_v1_num_chars":402,"code_v0_no_empty_lines":"from collections import defaultdict, deque, Counter\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\nN = int(eval(input()))\nA = 0\nBA = 0\nB = 0\nZ = 0\nans = 0\nfor _ in range(N):\n s = eval(input())\n ans += s.count(\"AB\")\n if s[0] == \"B\":\n if s[-1] == \"A\":\n BA += 1\n else:\n B += 1\n elif s[-1] == \"A\":\n A += 1\nif BA:\n ans += BA - 1\n if A:\n A -= 1\n ans += 1\n if B:\n B -= 1\n ans += 1\nans += min(A, B)\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = 0\nB = 0\nAB = 0\nans = 0\nfor _ in range(N):\n S = eval(input())\n ans += S.count(\"AB\")\n if S[0] == \"B\":\n if S[-1] == \"A\":\n AB += 1\n else:\n B += 1\n elif S[-1] == \"A\":\n A += 1\nif AB:\n ans += AB - 1\n if A:\n ans += 1\n A -= 1\n if B:\n ans += 1\n B -= 1\nans += min(A, B)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.625,"diff":["-from collections import defaultdict, deque, Counter","-","-","-def inpl():","- return list(map(int, input().split()))","-","-","-BA = 0","-Z = 0","+AB = 0","- s = eval(input())","- ans += s.count(\"AB\")","- if s[0] == \"B\":","- if s[-1] == \"A\":","- BA += 1","+ S = eval(input())","+ ans += S.count(\"AB\")","+ if S[0] == \"B\":","+ if S[-1] == \"A\":","+ AB += 1","- elif s[-1] == \"A\":","+ elif S[-1] == \"A\":","-if BA:","- ans += BA - 1","+if AB:","+ ans += AB - 1","+ ans += 1","+ if B:","- if B:","- ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0434618638,"measured_runtime_v1":0.062198225,"runtime_lift":0.6987637305,"key":["s975351586","s592358103"]} +{"user_id":"u186838327","problem_id":"p02837","language":"python","submission_id_v0":"s184528676","submission_id_v1":"s050136436","cpu_time_v0":317,"cpu_time_v1":280,"memory_v0":45532,"memory_v1":43484,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.67,"input":"n = int(eval(input()))\n\nL = [[-1]*n for _ in range(n)]\n\nfor i in range(n):\n\n a = int(eval(input()))\n\n for j in range(a):\n\n x, y = list(map(int, input().split()))\n\n x -= 1\n\n L[i][x] = y\n\n#print(L)\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n temp = 0\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n temp += 1\n\n flag = True\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n for k in range(n):\n\n #print((i >> k) & 0)\n\n if L[j][k] == 1 and ((i >> k) & 1) == 0:\n\n flag = False\n\n elif L[j][k] == 0 and ((i >> k) & 1) != 0:\n\n flag = False\n\n else:\n\n pass\n\n if flag:\n\n ans = max(ans, temp)\n\nprint(ans)","target":"n = int(eval(input()))\n\nX = [[] for _ in range(n)]\n\nfor i in range(n):\n\n a = int(eval(input()))\n\n for j in range(a):\n\n x, y = list(map(int, input().split()))\n\n x -= 1\n\n X[i].append((x, y))\n\n\n\nans = 0\n\nfor i in range(2**n):\n\n t = [-1]*n\n\n flag = True\n\n cnt = 0\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n cnt += 1\n\n t[j] = 1\n\n else:\n\n t[j] = 0\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n for x, y in X[j]:\n\n if t[x] != y:\n\n flag = False\n\n if flag:\n\n ans = max(ans, cnt)\n\n\n\nprint(ans)\n","code_v0_loc":30,"code_v1_loc":29,"code_v0_num_chars":755,"code_v1_num_chars":612,"code_v0_no_empty_lines":"n = int(eval(input()))\nL = [[-1] * n for _ in range(n)]\nfor i in range(n):\n a = int(eval(input()))\n for j in range(a):\n x, y = list(map(int, input().split()))\n x -= 1\n L[i][x] = y\n# print(L)\nans = 0\nfor i in range(2**n):\n temp = 0\n for j in range(n):\n if (i >> j) & 1:\n temp += 1\n flag = True\n for j in range(n):\n if (i >> j) & 1:\n for k in range(n):\n # print((i >> k) & 0)\n if L[j][k] == 1 and ((i >> k) & 1) == 0:\n flag = False\n elif L[j][k] == 0 and ((i >> k) & 1) != 0:\n flag = False\n else:\n pass\n if flag:\n ans = max(ans, temp)\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nX = [[] for _ in range(n)]\nfor i in range(n):\n a = int(eval(input()))\n for j in range(a):\n x, y = list(map(int, input().split()))\n x -= 1\n X[i].append((x, y))\nans = 0\nfor i in range(2**n):\n t = [-1] * n\n flag = True\n cnt = 0\n for j in range(n):\n if (i >> j) & 1:\n cnt += 1\n t[j] = 1\n else:\n t[j] = 0\n for j in range(n):\n if (i >> j) & 1:\n for x, y in X[j]:\n if t[x] != y:\n flag = False\n if flag:\n ans = max(ans, cnt)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":3.3333333333,"diff":["-L = [[-1] * n for _ in range(n)]","+X = [[] for _ in range(n)]","- L[i][x] = y","-# print(L)","+ X[i].append((x, y))","- temp = 0","+ t = [-1] * n","+ flag = True","+ cnt = 0","- temp += 1","- flag = True","+ cnt += 1","+ t[j] = 1","+ else:","+ t[j] = 0","- for k in range(n):","- # print((i >> k) & 0)","- if L[j][k] == 1 and ((i >> k) & 1) == 0:","+ for x, y in X[j]:","+ if t[x] != y:","- elif L[j][k] == 0 and ((i >> k) & 1) != 0:","- flag = False","- else:","- pass","- ans = max(ans, temp)","+ ans = max(ans, cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0692325559,"measured_runtime_v1":0.0430008097,"runtime_lift":1.6100291223,"key":["s184528676","s050136436"]} +{"user_id":"u923279197","problem_id":"p03141","language":"python","submission_id_v0":"s312933420","submission_id_v1":"s130673105","cpu_time_v0":860,"cpu_time_v1":590,"memory_v0":58840,"memory_v1":51032,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.4,"input":"n = int(eval(input()))\n\nab = []\n\nans = 0\n\nfor i in range(n):\n\n a,b = list(map(int,input().split()))\n\n ab.append([a+b,b])\n\n ans -= b\n\nab.sort(reverse=True)\n\nfor i in range(n):\n\n if i%2 == 0:\n\n ans += ab[i][0]\n\nprint(ans)\n","target":"N = int(eval(input()))\n\nAB = []\n\nans = 0\n\nfor i in range(N):\n\n a,b = list(map(int,input().split()))\n\n ans += a\n\n AB.append(a+b)\n\n\n\nAB.sort(reverse=True)\n\nfor i in range(N):\n\n if i%2 == 1:\n\n ans -= AB[i]\n\n\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":227,"code_v1_num_chars":223,"code_v0_no_empty_lines":"n = int(eval(input()))\nab = []\nans = 0\nfor i in range(n):\n a, b = list(map(int, input().split()))\n ab.append([a + b, b])\n ans -= b\nab.sort(reverse=True)\nfor i in range(n):\n if i % 2 == 0:\n ans += ab[i][0]\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nAB = []\nans = 0\nfor i in range(N):\n a, b = list(map(int, input().split()))\n ans += a\n AB.append(a + b)\nAB.sort(reverse=True)\nfor i in range(N):\n if i % 2 == 1:\n ans -= AB[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-n = int(eval(input()))","-ab = []","+N = int(eval(input()))","+AB = []","-for i in range(n):","+for i in range(N):","- ab.append([a + b, b])","- ans -= b","-ab.sort(reverse=True)","-for i in range(n):","- if i % 2 == 0:","- ans += ab[i][0]","+ ans += a","+ AB.append(a + b)","+AB.sort(reverse=True)","+for i in range(N):","+ if i % 2 == 1:","+ ans -= AB[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373628654,"measured_runtime_v1":0.0615094845,"runtime_lift":0.6074325891,"key":["s312933420","s130673105"]} +{"user_id":"u325492232","problem_id":"p02844","language":"python","submission_id_v0":"s473058968","submission_id_v1":"s983298670","cpu_time_v0":789,"cpu_time_v1":31,"memory_v0":8996,"memory_v1":9224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":96.07,"input":"def sumitrust2019_d():\n\n n = int(eval(input()))\n\n s = eval(input())\n\n\n\n ans = 0\n\n\n\n for i in range(1000):\n\n # \u78ba\u8a8d\u3059\u308bpin\u306e\u6570\u5b57\u306e\u7d44\u307f\u5408\u308f\u305b\u3068\u6841\u306e\u521d\u671f\u5316\n\n # pin = list(str(i).zfill(3))\n\n current_digit = 0\n\n pin = f'{i:0>3}'\n\n search_num = pin[current_digit]\n\n\n\n for num in s:\n\n # \u898b\u3064\u3051\u308b\u3068\u6841\u3092\u53f3\u306b\u4e00\u3064\u305a\u3089\u3059\n\n # \u6bce\u56de\u30ea\u30b9\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3088\u308a\u5909\u6570\u306b\u53d6\u308a\u51fa\u3057\u3066\u304a\u304f\u307b\u3046\u304c\u3044\u3044\u304b\u3082\u3002\n\n # if num == pin[current_digit]:\n\n if num == search_num:\n\n current_digit += 1\n\n\n\n # index\u304c3(\u6841\u304c3\u21922\u21921\u21920)\u306b\u306a\u3063\u305f\u3068\u304d\u306f\u305d\u306ePIN\u306f\u4f5c\u308c\u308b\n\n if current_digit == 3:\n\n ans += 1\n\n break\n\n # \u898b\u3064\u3051\u7d42\u308f\u308b\u307e\u3067\u306f\u30c1\u30a7\u30c3\u30af\u3059\u308b\u6570\u5b57\u3092\u7f6e\u304d\u63db\u3048\u3002\n\n elif current_digit < 3:\n\n search_num = pin[current_digit]\n\n\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n sumitrust2019_d()","target":"def sumitrust2019_d_01():\n\n n = int(eval(input()))\n\n s = eval(input())\n\n ans = 0\n\n\n\n for i in range(1000):\n\n # \u78ba\u8a8d\u3059\u308bpin\u306e\u6570\u5b57\u306e\u7d44\u307f\u5408\u308f\u305b\u3068\u6841\u306e\u521d\u671f\u5316\n\n # pin = list(str(i).zfill(3))\n\n pin = f'{i:0>3}'\n\n\n\n # list+index\u3067\u66f8\u3053\u3046\u3068\u601d\u3063\u305f\u3051\u3069\u3001\u305d\u3082\u305d\u3082\u6587\u5b57\u5217\u3067\u3084\u3063\u3066\u3044\u308b\u306e\u3067find\u3067\u63a2\u3057\u3061\u3083\u3046\n\n p1 = s.find(pin[0])\n\n\n\n if p1 != -1:\n\n p2 = s.find(pin[1], p1 + 1)\n\n if p2 != -1:\n\n p3 = s.find(pin[2], p2 + 1)\n\n if p3 != -1:\n\n ans += 1\n\n\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n sumitrust2019_d_01()","code_v0_loc":32,"code_v1_loc":24,"code_v0_num_chars":852,"code_v1_num_chars":564,"code_v0_no_empty_lines":"def sumitrust2019_d():\n n = int(eval(input()))\n s = eval(input())\n ans = 0\n for i in range(1000):\n # \u78ba\u8a8d\u3059\u308bpin\u306e\u6570\u5b57\u306e\u7d44\u307f\u5408\u308f\u305b\u3068\u6841\u306e\u521d\u671f\u5316\n # pin = list(str(i).zfill(3))\n current_digit = 0\n pin = f\"{i:0>3}\"\n search_num = pin[current_digit]\n for num in s:\n # \u898b\u3064\u3051\u308b\u3068\u6841\u3092\u53f3\u306b\u4e00\u3064\u305a\u3089\u3059\n # \u6bce\u56de\u30ea\u30b9\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3088\u308a\u5909\u6570\u306b\u53d6\u308a\u51fa\u3057\u3066\u304a\u304f\u307b\u3046\u304c\u3044\u3044\u304b\u3082\u3002\n # if num == pin[current_digit]:\n if num == search_num:\n current_digit += 1\n # index\u304c3(\u6841\u304c3\u21922\u21921\u21920)\u306b\u306a\u3063\u305f\u3068\u304d\u306f\u305d\u306ePIN\u306f\u4f5c\u308c\u308b\n if current_digit == 3:\n ans += 1\n break\n # \u898b\u3064\u3051\u7d42\u308f\u308b\u307e\u3067\u306f\u30c1\u30a7\u30c3\u30af\u3059\u308b\u6570\u5b57\u3092\u7f6e\u304d\u63db\u3048\u3002\n elif current_digit < 3:\n search_num = pin[current_digit]\n print(ans)\n\n\nif __name__ == \"__main__\":\n sumitrust2019_d()\n","code_v1_no_empty_lines":"def sumitrust2019_d_01():\n n = int(eval(input()))\n s = eval(input())\n ans = 0\n for i in range(1000):\n # \u78ba\u8a8d\u3059\u308bpin\u306e\u6570\u5b57\u306e\u7d44\u307f\u5408\u308f\u305b\u3068\u6841\u306e\u521d\u671f\u5316\n # pin = list(str(i).zfill(3))\n pin = f\"{i:0>3}\"\n # list+index\u3067\u66f8\u3053\u3046\u3068\u601d\u3063\u305f\u3051\u3069\u3001\u305d\u3082\u305d\u3082\u6587\u5b57\u5217\u3067\u3084\u3063\u3066\u3044\u308b\u306e\u3067find\u3067\u63a2\u3057\u3061\u3083\u3046\n p1 = s.find(pin[0])\n if p1 != -1:\n p2 = s.find(pin[1], p1 + 1)\n if p2 != -1:\n p3 = s.find(pin[2], p2 + 1)\n if p3 != -1:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n sumitrust2019_d_01()\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-def sumitrust2019_d():","+def sumitrust2019_d_01():","- current_digit = 0","- search_num = pin[current_digit]","- for num in s:","- # \u898b\u3064\u3051\u308b\u3068\u6841\u3092\u53f3\u306b\u4e00\u3064\u305a\u3089\u3059","- # \u6bce\u56de\u30ea\u30b9\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3088\u308a\u5909\u6570\u306b\u53d6\u308a\u51fa\u3057\u3066\u304a\u304f\u307b\u3046\u304c\u3044\u3044\u304b\u3082\u3002","- # if num == pin[current_digit]:","- if num == search_num:","- current_digit += 1","- # index\u304c3(\u6841\u304c3\u21922\u21921\u21920)\u306b\u306a\u3063\u305f\u3068\u304d\u306f\u305d\u306ePIN\u306f\u4f5c\u308c\u308b","- if current_digit == 3:","+ # list+index\u3067\u66f8\u3053\u3046\u3068\u601d\u3063\u305f\u3051\u3069\u3001\u305d\u3082\u305d\u3082\u6587\u5b57\u5217\u3067\u3084\u3063\u3066\u3044\u308b\u306e\u3067find\u3067\u63a2\u3057\u3061\u3083\u3046","+ p1 = s.find(pin[0])","+ if p1 != -1:","+ p2 = s.find(pin[1], p1 + 1)","+ if p2 != -1:","+ p3 = s.find(pin[2], p2 + 1)","+ if p3 != -1:","- break","- # \u898b\u3064\u3051\u7d42\u308f\u308b\u307e\u3067\u306f\u30c1\u30a7\u30c3\u30af\u3059\u308b\u6570\u5b57\u3092\u7f6e\u304d\u63db\u3048\u3002","- elif current_digit < 3:","- search_num = pin[current_digit]","- sumitrust2019_d()","+ sumitrust2019_d_01()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0438477619,"measured_runtime_v1":0.0371687195,"runtime_lift":1.1796952494,"key":["s473058968","s983298670"]} +{"user_id":"u730769327","problem_id":"p03086","language":"python","submission_id_v0":"s125574674","submission_id_v1":"s254144656","cpu_time_v0":184,"cpu_time_v1":70,"memory_v0":38384,"memory_v1":61888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.96,"input":"s=eval(input())\n\nmx=0\n\nfor i in range(len(s)):\n\n a=s[:len(s)-i]\n\n for j in range(len(s)-i):\n\n b=a[j:]\n\n if b.count('A')+b.count('C')+b.count('G')+b.count('T')==len(b):\n\n mx=max(mx,len(b))\n\nprint(mx)","target":"s=eval(input())\n\nn=len(s)\n\na=[0]*n\n\nfor i in range(n):\n\n if s[i] in 'ATCG':a[i]=a[i-1]+1\n\n else:a[i]=0\n\nprint((max(a)))","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":205,"code_v1_num_chars":113,"code_v0_no_empty_lines":"s = eval(input())\nmx = 0\nfor i in range(len(s)):\n a = s[: len(s) - i]\n for j in range(len(s) - i):\n b = a[j:]\n if b.count(\"A\") + b.count(\"C\") + b.count(\"G\") + b.count(\"T\") == len(b):\n mx = max(mx, len(b))\nprint(mx)\n","code_v1_no_empty_lines":"s = eval(input())\nn = len(s)\na = [0] * n\nfor i in range(n):\n if s[i] in \"ATCG\":\n a[i] = a[i - 1] + 1\n else:\n a[i] = 0\nprint((max(a)))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-mx = 0","-for i in range(len(s)):","- a = s[: len(s) - i]","- for j in range(len(s) - i):","- b = a[j:]","- if b.count(\"A\") + b.count(\"C\") + b.count(\"G\") + b.count(\"T\") == len(b):","- mx = max(mx, len(b))","-print(mx)","+n = len(s)","+a = [0] * n","+for i in range(n):","+ if s[i] in \"ATCG\":","+ a[i] = a[i - 1] + 1","+ else:","+ a[i] = 0","+print((max(a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443855457,"measured_runtime_v1":0.0375810564,"runtime_lift":1.1810616843,"key":["s125574674","s254144656"]} +{"user_id":"u163528399","problem_id":"p02657","language":"python","submission_id_v0":"s847416416","submission_id_v1":"s655287496","cpu_time_v0":29,"cpu_time_v1":26,"memory_v0":9032,"memory_v1":8908,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.34,"input":"A,B=list(map(float,input().split()))\n\nX=A*(B*100)\n\nprint((int(X\/100)))","target":"A,B=input().split()\n\nA=int(A)\n\nB=int(100*float(B)+0.5)\n\nprint((int(A*B\/100)))","code_v0_loc":3,"code_v1_loc":4,"code_v0_num_chars":62,"code_v1_num_chars":75,"code_v0_no_empty_lines":"A, B = list(map(float, input().split()))\nX = A * (B * 100)\nprint((int(X \/ 100)))\n","code_v1_no_empty_lines":"A, B = input().split()\nA = int(A)\nB = int(100 * float(B) + 0.5)\nprint((int(A * B \/ 100)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-A, B = list(map(float, input().split()))","-X = A * (B * 100)","-print((int(X \/ 100)))","+A, B = input().split()","+A = int(A)","+B = int(100 * float(B) + 0.5)","+print((int(A * B \/ 100)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0498857024,"measured_runtime_v1":0.0089487609,"runtime_lift":5.5745932688,"key":["s847416416","s655287496"]} +{"user_id":"u729133443","problem_id":"p02641","language":"python","submission_id_v0":"s691096229","submission_id_v1":"s627677958","cpu_time_v0":23,"cpu_time_v1":21,"memory_v0":9244,"memory_v1":9248,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.7,"input":"x,n,*p=list(map(int,open(0).read().split()))\n\nprint((min({*list(range(999))}-{*p},key=lambda y:(abs(y-x),y))))","target":"x,n,*p=list(map(int,open(0).read().split()))\n\nprint((min({*list(range(999))}-{*p},key=lambda y:abs(y-x))))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":96,"code_v1_num_chars":92,"code_v0_no_empty_lines":"x, n, *p = list(map(int, open(0).read().split()))\nprint((min({*list(range(999))} - {*p}, key=lambda y: (abs(y - x), y))))\n","code_v1_no_empty_lines":"x, n, *p = list(map(int, open(0).read().split()))\nprint((min({*list(range(999))} - {*p}, key=lambda y: abs(y - x))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((min({*list(range(999))} - {*p}, key=lambda y: (abs(y - x), y))))","+print((min({*list(range(999))} - {*p}, key=lambda y: abs(y - x))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376657631,"measured_runtime_v1":0.0374302382,"runtime_lift":1.0062923693,"key":["s691096229","s627677958"]} +{"user_id":"u994988729","problem_id":"p02754","language":"python","submission_id_v0":"s145427071","submission_id_v1":"s499699834","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"N, A, B = list(map(int, input().split()))\n\n\n\ndiv, mod = divmod(N, A + B)\n\nans = A * div\n\nans += min(mod, A)\n\n\n\nprint(ans)\n","target":"N, A, B = list(map(int, input().split()))\n\n\n\nd, m = divmod(N, A + B)\n\nans = A * d + min(m, A)\n\nprint(ans)","code_v0_loc":7,"code_v1_loc":5,"code_v0_num_chars":116,"code_v1_num_chars":99,"code_v0_no_empty_lines":"N, A, B = list(map(int, input().split()))\ndiv, mod = divmod(N, A + B)\nans = A * div\nans += min(mod, A)\nprint(ans)\n","code_v1_no_empty_lines":"N, A, B = list(map(int, input().split()))\nd, m = divmod(N, A + B)\nans = A * d + min(m, A)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-div, mod = divmod(N, A + B)","-ans = A * div","-ans += min(mod, A)","+d, m = divmod(N, A + B)","+ans = A * d + min(m, A)"],"diff_only_import_comment":false,"measured_runtime_v0":0.050281884,"measured_runtime_v1":0.1036840005,"runtime_lift":0.4849531626,"key":["s145427071","s499699834"]} +{"user_id":"u819135704","problem_id":"p03854","language":"python","submission_id_v0":"s508580217","submission_id_v1":"s799648449","cpu_time_v0":52,"cpu_time_v1":41,"memory_v0":9792,"memory_v1":9744,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.15,"input":"S = list(eval(input()))\n\nN = len(S)\n\n\n\ndef f(x):\n\n print(x)\n\n exit()\n\n\n\nif N < 5:\n\n f(\"NO\")\n\nelif S[0] == \"d\":\n\n w = 1\n\nelif S[0] == \"e\":\n\n w = -1\n\nelse:\n\n f(\"NO\")\n\n\n\ni = 0\n\nwhile True:\n\n if w > 0:\n\n if S[i]+S[i+1]+S[i+2]+S[i+3]+S[i+4] == \"dream\":\n\n i += 5\n\n if i == N:\n\n f(\"YES\")\n\n elif S[i] == \"d\":\n\n pass\n\n elif S[i] == \"e\":\n\n if i+1 <= N-1:\n\n if S[i+1] == \"r\":\n\n if i+1 == N-1:\n\n f(\"YES\")\n\n elif S[i+2] == \"a\":\n\n w *= -1\n\n elif S[i+2] == \"e\":\n\n i += 2\n\n w *= -1\n\n elif S[i+2] == \"d\":\n\n i += 2\n\n else:\n\n f(\"NO\")\n\n else:\n\n f(\"NO\")\n\n else:\n\n f(\"NO\")\n\n else:\n\n f(\"NO\")\n\n else:\n\n f(\"NO\")\n\n elif w < 0:\n\n if S[i]+S[i+1]+S[i+2]+S[i+3]+S[i+4] == \"erase\":\n\n i += 5\n\n if i == N:\n\n f(\"YES\")\n\n if S[i] == \"r\":\n\n i += 1\n\n if i == N:\n\n f(\"YES\")\n\n if S[i] == \"d\":\n\n w *= -1\n\n elif S[i] == \"e\":\n\n pass\n\n else:\n\n f(\"NO\")\n\n else:\n\n f(\"NO\")\n\n if i+4 > N-1:\n\n f(\"NO\")\n","target":"s = eval(input())\n\nS = ''.join(list(reversed(s)))\n\nN = len(S)\n\n\n\ni = 0\n\nwhile True:\n\n l = N - i\n\n if l>=5 and (S[i:i+5]=='maerd' or S[i:i+5]=='esare'):\n\n i += 5\n\n elif l>=6 and S[i:i+6]=='resare':\n\n i += 6\n\n elif l>=7 and S[i:i+7]=='remaerd':\n\n i += 7\n\n else:\n\n print(\"NO\")\n\n exit()\n\n if i == N:\n\n print('YES')\n\n exit()\n","code_v0_loc":66,"code_v1_loc":19,"code_v0_num_chars":1592,"code_v1_num_chars":381,"code_v0_no_empty_lines":"S = list(eval(input()))\nN = len(S)\n\n\ndef f(x):\n print(x)\n exit()\n\n\nif N < 5:\n f(\"NO\")\nelif S[0] == \"d\":\n w = 1\nelif S[0] == \"e\":\n w = -1\nelse:\n f(\"NO\")\ni = 0\nwhile True:\n if w > 0:\n if S[i] + S[i + 1] + S[i + 2] + S[i + 3] + S[i + 4] == \"dream\":\n i += 5\n if i == N:\n f(\"YES\")\n elif S[i] == \"d\":\n pass\n elif S[i] == \"e\":\n if i + 1 <= N - 1:\n if S[i + 1] == \"r\":\n if i + 1 == N - 1:\n f(\"YES\")\n elif S[i + 2] == \"a\":\n w *= -1\n elif S[i + 2] == \"e\":\n i += 2\n w *= -1\n elif S[i + 2] == \"d\":\n i += 2\n else:\n f(\"NO\")\n else:\n f(\"NO\")\n else:\n f(\"NO\")\n else:\n f(\"NO\")\n else:\n f(\"NO\")\n elif w < 0:\n if S[i] + S[i + 1] + S[i + 2] + S[i + 3] + S[i + 4] == \"erase\":\n i += 5\n if i == N:\n f(\"YES\")\n if S[i] == \"r\":\n i += 1\n if i == N:\n f(\"YES\")\n if S[i] == \"d\":\n w *= -1\n elif S[i] == \"e\":\n pass\n else:\n f(\"NO\")\n else:\n f(\"NO\")\n if i + 4 > N - 1:\n f(\"NO\")\n","code_v1_no_empty_lines":"s = eval(input())\nS = \"\".join(list(reversed(s)))\nN = len(S)\ni = 0\nwhile True:\n l = N - i\n if l >= 5 and (S[i : i + 5] == \"maerd\" or S[i : i + 5] == \"esare\"):\n i += 5\n elif l >= 6 and S[i : i + 6] == \"resare\":\n i += 6\n elif l >= 7 and S[i : i + 7] == \"remaerd\":\n i += 7\n else:\n print(\"NO\")\n exit()\n if i == N:\n print(\"YES\")\n exit()\n","code_same":false,"relative_loc_diff_percent":71.2121212121,"diff":["-S = list(eval(input()))","+s = eval(input())","+S = \"\".join(list(reversed(s)))","-","-","-def f(x):","- print(x)","- exit()","-","-","-if N < 5:","- f(\"NO\")","-elif S[0] == \"d\":","- w = 1","-elif S[0] == \"e\":","- w = -1","-else:","- f(\"NO\")","- if w > 0:","- if S[i] + S[i + 1] + S[i + 2] + S[i + 3] + S[i + 4] == \"dream\":","- i += 5","- if i == N:","- f(\"YES\")","- elif S[i] == \"d\":","- pass","- elif S[i] == \"e\":","- if i + 1 <= N - 1:","- if S[i + 1] == \"r\":","- if i + 1 == N - 1:","- f(\"YES\")","- elif S[i + 2] == \"a\":","- w *= -1","- elif S[i + 2] == \"e\":","- i += 2","- w *= -1","- elif S[i + 2] == \"d\":","- i += 2","- else:","- f(\"NO\")","- else:","- f(\"NO\")","- else:","- f(\"NO\")","- else:","- f(\"NO\")","- else:","- f(\"NO\")","- elif w < 0:","- if S[i] + S[i + 1] + S[i + 2] + S[i + 3] + S[i + 4] == \"erase\":","- i += 5","- if i == N:","- f(\"YES\")","- if S[i] == \"r\":","- i += 1","- if i == N:","- f(\"YES\")","- if S[i] == \"d\":","- w *= -1","- elif S[i] == \"e\":","- pass","- else:","- f(\"NO\")","- else:","- f(\"NO\")","- if i + 4 > N - 1:","- f(\"NO\")","+ l = N - i","+ if l >= 5 and (S[i : i + 5] == \"maerd\" or S[i : i + 5] == \"esare\"):","+ i += 5","+ elif l >= 6 and S[i : i + 6] == \"resare\":","+ i += 6","+ elif l >= 7 and S[i : i + 7] == \"remaerd\":","+ i += 7","+ else:","+ print(\"NO\")","+ exit()","+ if i == N:","+ print(\"YES\")","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0785525184,"measured_runtime_v1":0.038737608,"runtime_lift":2.0278102467,"key":["s508580217","s799648449"]} +{"user_id":"u600402037","problem_id":"p03253","language":"python","submission_id_v0":"s950930627","submission_id_v1":"s929546173","cpu_time_v0":271,"cpu_time_v1":170,"memory_v0":51480,"memory_v1":16400,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.27,"input":"# coding: utf-8\n\nimport sys\n\nimport numpy as np\n\nfrom collections import Counter\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nMOD = 10 ** 9 + 7\n\n# \u7d20\u56e0\u6570\u5206\u89e3\u3092\u3057\u3066\u3001\u305d\u308c\u305e\u308c\u306e\u56e0\u6570\u3092\u3069\u3053\u306b\u5165\u308c\u308b\u304b\n\n\n\ndef cmb(n, k):\n\n if k < 0 or k > n: return 0\n\n return fact[n] * fact_inv[k] % MOD * fact_inv[n-k] % MOD\n\n\n\ndef cumprod(arr, MOD):\n\n L = len(arr); Lsq = int(L**.5+1)\n\n arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)\n\n for n in range(1, Lsq):\n\n arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD\n\n for n in range(1, Lsq):\n\n arr[n] *= arr[n-1, -1]; arr[n] %= MOD\n\n return arr.ravel()[:L]\n\n\n\ndef make_fact(U, MOD):\n\n x = np.arange(U, dtype=np.int64); x[0] = 1\n\n fact = cumprod(x, MOD)\n\n x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)\n\n fact_inv = cumprod(x, MOD)[::-1]\n\n return fact, fact_inv\n\n\n\nU = 10 ** 6 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650\n\nfact, fact_inv = make_fact(U, MOD)\n\n\n\ndef prime_factorize(n): # N\u306e\u7d20\u56e0\u6570\u5206\u89e3\n\n A = []\n\n while n % 2 == 0:\n\n A.append(2); n \/\/= 2\n\n f = 3\n\n while f * f <= n:\n\n if n % f == 0:\n\n A.append(f); n \/\/= f\n\n else:\n\n f += 2\n\n if n != 1:\n\n A.append(n)\n\n return A\n\n\n\nN, M = lr()\n\nprimes = prime_factorize(M)\n\ncounter = Counter(primes)\n\nanswer = 1\n\nfor v in list(counter.values()):\n\n cases = cmb(N-1+v, v)\n\n answer *= cases\n\n answer %= MOD\n\n\n\nprint((answer % MOD))\n\n# np.int64\u3068int\u578b\u306e\u9055\u3044\u306b\u6ce8\u610f\n\n# 16","target":"# coding: utf-8\n\nimport sys\n\nimport numpy as np\n\nfrom collections import Counter\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nMOD = 10 ** 9 + 7\n\n# \u7d20\u56e0\u6570\u5206\u89e3\u3092\u3057\u3066\u3001\u305d\u308c\u305e\u308c\u306e\u56e0\u6570\u3092\u3069\u3053\u306b\u5165\u308c\u308b\u304b\n\n\n\ndef cmb(n, k):\n\n if k < 0 or k > n: return 0\n\n return fact[n] * fact_inv[k] % MOD * fact_inv[n-k] % MOD\n\n\n\ndef cumprod(arr, MOD):\n\n L = len(arr); Lsq = int(L**.5+1)\n\n arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)\n\n for n in range(1, Lsq):\n\n arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD\n\n for n in range(1, Lsq):\n\n arr[n] *= arr[n-1, -1]; arr[n] %= MOD\n\n return arr.ravel()[:L]\n\n\n\ndef make_fact(U, MOD):\n\n x = np.arange(U, dtype=np.int64); x[0] = 1\n\n fact = cumprod(x, MOD)\n\n x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)\n\n fact_inv = cumprod(x, MOD)[::-1]\n\n return fact, fact_inv\n\n\n\nU = 10 ** 5 + 100 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650\n\nfact, fact_inv = make_fact(U, MOD)\n\n\n\ndef prime_factorize(n): # N\u306e\u7d20\u56e0\u6570\u5206\u89e3\n\n A = []\n\n while n % 2 == 0:\n\n A.append(2); n \/\/= 2\n\n f = 3\n\n while f * f <= n:\n\n if n % f == 0:\n\n A.append(f); n \/\/= f\n\n else:\n\n f += 2\n\n if n != 1:\n\n A.append(n)\n\n return A\n\n\n\nN, M = lr()\n\nprimes = prime_factorize(M)\n\ncounter = Counter(primes)\n\nanswer = 1\n\nfor v in list(counter.values()):\n\n cases = cmb(N-1+v, v)\n\n answer *= cases\n\n answer %= MOD\n\n\n\nprint((answer % MOD))\n\n# np.int64\u3068int\u578b\u306e\u9055\u3044\u306b\u6ce8\u610f\n\n# 16","code_v0_loc":61,"code_v1_loc":61,"code_v0_num_chars":1481,"code_v1_num_chars":1487,"code_v0_no_empty_lines":"# coding: utf-8\nimport sys\nimport numpy as np\nfrom collections import Counter\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nMOD = 10**9 + 7\n# \u7d20\u56e0\u6570\u5206\u89e3\u3092\u3057\u3066\u3001\u305d\u308c\u305e\u308c\u306e\u56e0\u6570\u3092\u3069\u3053\u306b\u5165\u308c\u308b\u304b\ndef cmb(n, k):\n if k < 0 or k > n:\n return 0\n return fact[n] * fact_inv[k] % MOD * fact_inv[n - k] % MOD\n\n\ndef cumprod(arr, MOD):\n L = len(arr)\n Lsq = int(L**0.5 + 1)\n arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)\n for n in range(1, Lsq):\n arr[:, n] *= arr[:, n - 1]\n arr[:, n] %= MOD\n for n in range(1, Lsq):\n arr[n] *= arr[n - 1, -1]\n arr[n] %= MOD\n return arr.ravel()[:L]\n\n\ndef make_fact(U, MOD):\n x = np.arange(U, dtype=np.int64)\n x[0] = 1\n fact = cumprod(x, MOD)\n x = np.arange(U, 0, -1, dtype=np.int64)\n x[0] = pow(int(fact[-1]), MOD - 2, MOD)\n fact_inv = cumprod(x, MOD)[::-1]\n return fact, fact_inv\n\n\nU = 10**6 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650\nfact, fact_inv = make_fact(U, MOD)\n\n\ndef prime_factorize(n): # N\u306e\u7d20\u56e0\u6570\u5206\u89e3\n A = []\n while n % 2 == 0:\n A.append(2)\n n \/\/= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n A.append(f)\n n \/\/= f\n else:\n f += 2\n if n != 1:\n A.append(n)\n return A\n\n\nN, M = lr()\nprimes = prime_factorize(M)\ncounter = Counter(primes)\nanswer = 1\nfor v in list(counter.values()):\n cases = cmb(N - 1 + v, v)\n answer *= cases\n answer %= MOD\nprint((answer % MOD))\n# np.int64\u3068int\u578b\u306e\u9055\u3044\u306b\u6ce8\u610f\n# 16\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\nimport numpy as np\nfrom collections import Counter\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nMOD = 10**9 + 7\n# \u7d20\u56e0\u6570\u5206\u89e3\u3092\u3057\u3066\u3001\u305d\u308c\u305e\u308c\u306e\u56e0\u6570\u3092\u3069\u3053\u306b\u5165\u308c\u308b\u304b\ndef cmb(n, k):\n if k < 0 or k > n:\n return 0\n return fact[n] * fact_inv[k] % MOD * fact_inv[n - k] % MOD\n\n\ndef cumprod(arr, MOD):\n L = len(arr)\n Lsq = int(L**0.5 + 1)\n arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)\n for n in range(1, Lsq):\n arr[:, n] *= arr[:, n - 1]\n arr[:, n] %= MOD\n for n in range(1, Lsq):\n arr[n] *= arr[n - 1, -1]\n arr[n] %= MOD\n return arr.ravel()[:L]\n\n\ndef make_fact(U, MOD):\n x = np.arange(U, dtype=np.int64)\n x[0] = 1\n fact = cumprod(x, MOD)\n x = np.arange(U, 0, -1, dtype=np.int64)\n x[0] = pow(int(fact[-1]), MOD - 2, MOD)\n fact_inv = cumprod(x, MOD)[::-1]\n return fact, fact_inv\n\n\nU = 10**5 + 100 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650\nfact, fact_inv = make_fact(U, MOD)\n\n\ndef prime_factorize(n): # N\u306e\u7d20\u56e0\u6570\u5206\u89e3\n A = []\n while n % 2 == 0:\n A.append(2)\n n \/\/= 2\n f = 3\n while f * f <= n:\n if n % f == 0:\n A.append(f)\n n \/\/= f\n else:\n f += 2\n if n != 1:\n A.append(n)\n return A\n\n\nN, M = lr()\nprimes = prime_factorize(M)\ncounter = Counter(primes)\nanswer = 1\nfor v in list(counter.values()):\n cases = cmb(N - 1 + v, v)\n answer *= cases\n answer %= MOD\nprint((answer % MOD))\n# np.int64\u3068int\u578b\u306e\u9055\u3044\u306b\u6ce8\u610f\n# 16\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-U = 10**6 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650","+U = 10**5 + 100 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650"],"diff_only_import_comment":false,"measured_runtime_v0":0.3811991968,"measured_runtime_v1":0.2097297401,"runtime_lift":1.8175733996,"key":["s950930627","s929546173"]} +{"user_id":"u809819902","problem_id":"p02681","language":"python","submission_id_v0":"s889105374","submission_id_v1":"s386940703","cpu_time_v0":32,"cpu_time_v1":28,"memory_v0":8984,"memory_v1":8912,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"a,b = eval(input()), eval(input())\n\nprint((\"Yes\" if b[ :len(b)-1] == a else \"No\"))","target":"a=eval(input())\n\nb=eval(input())\n\nres=\"No\"\n\nif a==b[:-1]:res=\"Yes\"\n\nprint(res)","code_v0_loc":2,"code_v1_loc":5,"code_v0_num_chars":68,"code_v1_num_chars":66,"code_v0_no_empty_lines":"a, b = eval(input()), eval(input())\nprint((\"Yes\" if b[: len(b) - 1] == a else \"No\"))\n","code_v1_no_empty_lines":"a = eval(input())\nb = eval(input())\nres = \"No\"\nif a == b[:-1]:\n res = \"Yes\"\nprint(res)\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-a, b = eval(input()), eval(input())","-print((\"Yes\" if b[: len(b) - 1] == a else \"No\"))","+a = eval(input())","+b = eval(input())","+res = \"No\"","+if a == b[:-1]:","+ res = \"Yes\"","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0462267599,"measured_runtime_v1":0.0464308052,"runtime_lift":0.9956053895,"key":["s889105374","s386940703"]} +{"user_id":"u785213188","problem_id":"p02761","language":"python","submission_id_v0":"s103717594","submission_id_v1":"s035874132","cpu_time_v0":22,"cpu_time_v1":19,"memory_v0":3444,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.64,"input":"N, M = list(map(int, input().split()))\n\n\n\ncondition = set()\n\nfor i in range(M):\n\n s, c = list(map(int, input().split()))\n\n condition.add((s, c))\n\n\n\nans = float(\"inf\")\n\nif N == 1:\n\n for i in range(10):\n\n num = str(i)\n\n for s, c in condition:\n\n if num[s-1] != str(c):\n\n break\n\n else:\n\n print(i)\n\n exit() \n\n\n\nfor i in range(10**(N-1), 10**N):\n\n num = str(i)\n\n for s, c in condition:\n\n if num[s-1] != str(c):\n\n break\n\n else:\n\n print(i)\n\n exit()\n\nprint((-1))","target":"N, M = list(map(int, input().split()))\n\n\n\ncondition = set()\n\nfor i in range(M):\n\n s, c = list(map(int, input().split()))\n\n condition.add((s, c))\n\n\n\nans = float(\"inf\")\n\nif N == 1:\n\n for i in range(10):\n\n num = str(i)\n\n for s, c in condition:\n\n if num[s-1] != str(c):\n\n break\n\n else:\n\n print(i)\n\n exit() \n\nelse:\n\n for i in range(10**(N-1), 10**N):\n\n num = str(i)\n\n for s, c in condition:\n\n if num[s-1] != str(c):\n\n break\n\n else:\n\n print(i)\n\n exit()\n\nprint((-1))","code_v0_loc":27,"code_v1_loc":27,"code_v0_num_chars":564,"code_v1_num_chars":601,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\ncondition = set()\nfor i in range(M):\n s, c = list(map(int, input().split()))\n condition.add((s, c))\nans = float(\"inf\")\nif N == 1:\n for i in range(10):\n num = str(i)\n for s, c in condition:\n if num[s - 1] != str(c):\n break\n else:\n print(i)\n exit()\nfor i in range(10 ** (N - 1), 10**N):\n num = str(i)\n for s, c in condition:\n if num[s - 1] != str(c):\n break\n else:\n print(i)\n exit()\nprint((-1))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\ncondition = set()\nfor i in range(M):\n s, c = list(map(int, input().split()))\n condition.add((s, c))\nans = float(\"inf\")\nif N == 1:\n for i in range(10):\n num = str(i)\n for s, c in condition:\n if num[s - 1] != str(c):\n break\n else:\n print(i)\n exit()\nelse:\n for i in range(10 ** (N - 1), 10**N):\n num = str(i)\n for s, c in condition:\n if num[s - 1] != str(c):\n break\n else:\n print(i)\n exit()\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(10 ** (N - 1), 10**N):","- num = str(i)","- for s, c in condition:","- if num[s - 1] != str(c):","- break","- else:","- print(i)","- exit()","+else:","+ for i in range(10 ** (N - 1), 10**N):","+ num = str(i)","+ for s, c in condition:","+ if num[s - 1] != str(c):","+ break","+ else:","+ print(i)","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0390517235,"measured_runtime_v1":0.040026067,"runtime_lift":0.9756572749,"key":["s103717594","s035874132"]} +{"user_id":"u370086573","problem_id":"p02260","language":"python","submission_id_v0":"s700892881","submission_id_v1":"s626922865","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7756,"memory_v1":7736,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"def serect_sort(r, n):\n\n cnt = 0\n\n for i in range(0, n):\n\n minj = i\n\n for j in range(i, n):\n\n if r[j] < r[minj]:\n\n minj = j\n\n r[i],r[minj] = r[minj],r[i]\n\n if i != minj:\n\n cnt +=1\n\n print((*r))\n\n print(cnt)\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nserect_sort(A, N)","target":"def selectionSort(n, A):\n\n cnt =0\n\n for i in range(n):\n\n minj = i\n\n for j in range(i,n):\n\n if A[minj] > A[j]:\n\n minj = j\n\n if i != minj:\n\n A[i],A[minj] = A[minj],A[i]\n\n cnt += 1\n\n print((*A))\n\n print(cnt)\n\n\n\nif __name__ == '__main__':\n\n n = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n selectionSort(n,A)","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":357,"code_v1_num_chars":400,"code_v0_no_empty_lines":"def serect_sort(r, n):\n cnt = 0\n for i in range(0, n):\n minj = i\n for j in range(i, n):\n if r[j] < r[minj]:\n minj = j\n r[i], r[minj] = r[minj], r[i]\n if i != minj:\n cnt += 1\n print((*r))\n print(cnt)\n\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nserect_sort(A, N)\n","code_v1_no_empty_lines":"def selectionSort(n, A):\n cnt = 0\n for i in range(n):\n minj = i\n for j in range(i, n):\n if A[minj] > A[j]:\n minj = j\n if i != minj:\n A[i], A[minj] = A[minj], A[i]\n cnt += 1\n print((*A))\n print(cnt)\n\n\nif __name__ == \"__main__\":\n n = int(eval(input()))\n A = list(map(int, input().split()))\n selectionSort(n, A)\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-def serect_sort(r, n):","+def selectionSort(n, A):","- for i in range(0, n):","+ for i in range(n):","- if r[j] < r[minj]:","+ if A[minj] > A[j]:","- r[i], r[minj] = r[minj], r[i]","+ A[i], A[minj] = A[minj], A[i]","- print((*r))","+ print((*A))","-N = int(eval(input()))","-A = list(map(int, input().split()))","-serect_sort(A, N)","+if __name__ == \"__main__\":","+ n = int(eval(input()))","+ A = list(map(int, input().split()))","+ selectionSort(n, A)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1723145851,"measured_runtime_v1":0.0404480275,"runtime_lift":4.2601480453,"key":["s700892881","s626922865"]} +{"user_id":"u197300773","problem_id":"p03372","language":"python","submission_id_v0":"s809158931","submission_id_v1":"s053269944","cpu_time_v0":674,"cpu_time_v1":579,"memory_v0":54156,"memory_v1":36840,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.09,"input":"from itertools import accumulate as acc\n\nimport sys\n\n\n\nN,C=list(map(int,input().split()))\n\na=[list(map(int,input().split())) for i in range(N)]\n\n\n\nif N==1: print((max(0, a[0][1]-a[0][0], a[0][1]-(C-a[0][0]) ) ),sys.exit())\n\n\n\nb=list(acc( [ a[i][1] for i in range(N)] ))\n\n\n\nans= sum([a[i][1] for i in range(N)])+max(C-a[0][0],a[N-1][0])\n\n\n\nl=[[b[i]-a[i][0],0] for i in range(N)]\n\nr=[[b[N-1]-(C-a[0][0]),0]]+[[b[N-1]-b[i]-(C-a[i+1][0]),0] for i in range(N-1)]\n\n\n\ntmp=0\n\nfor i in range(N):\n\n if l[i][0]>tmp: tmp=l[i][0]\n\n l[i][1]=tmp\n\ntmp=0\n\nfor i in range(N-1,-1,-1):\n\n if r[i][0]>tmp: tmp=r[i][0]\n\n r[i][1]=tmp\n\n\n\np=[l[0][1],r[0][1],l[0][1]-a[0][0]+r[1][1]]\n\nq=[l[N-1][1],r[N-1][1],r[N-1][0]-(C-a[N-1][0])+l[N-2][1]]\n\n\n\nans=max(p+q)\n\n\n\nfor i in range(1,N-1):\n\n p1=l[i][1]\n\n p2=r[i][1]\n\n p3=l[i][1]-a[i][0]+r[i+1][1]\n\n p4=r[i][1]-(C-a[i][0])+l[i-1][1]\n\n \n\n ans=max(ans,p1,p2,p3,p4)\n\n \n\nprint(ans)","target":"from itertools import accumulate as acc\n\nimport sys\n\n\n\nN,C=list(map(int,input().split()))\n\na=[list(map(int,input().split())) for i in range(N)]\n\n\n\nif N==1: print((max(0, a[0][1]-a[0][0], a[0][1]-(C-a[0][0]) ) ),sys.exit())\n\n\n\ntmp=a[0][1]-a[0][0]\n\nM=max(0,tmp)\n\nl=[M]\n\nfor i in range(1,N):\n\n tmp+=a[i][1]-(a[i][0]-a[i-1][0])\n\n M=max(tmp,M)\n\n l.append(M)\n\n\n\ntmp=a[N-1][1]-(C-a[N-1][0])\n\nM=max(0,tmp)\n\nr=[M]\n\nfor i in range(N-2,-1,-1):\n\n tmp+=a[i][1]-(a[i+1][0]-a[i][0])\n\n M=max(tmp,M)\n\n r.append(M)\n\n\n\nr.reverse()\n\n\n\nans=max(l[0], r[0], l[0]-a[0][0]+r[1], l[N-1], r[N-1], r[N-1]-(C-a[N-1][0])+l[N-2])\n\n\n\nfor i in range(1,N-1):\n\n ans=max(ans, l[i], r[i], l[i]-a[i][0]+r[i+1], r[i]-(C-a[i][0])+l[i-1])\n\n\n\nprint(ans)","code_v0_loc":38,"code_v1_loc":32,"code_v0_num_chars":919,"code_v1_num_chars":724,"code_v0_no_empty_lines":"from itertools import accumulate as acc\nimport sys\n\nN, C = list(map(int, input().split()))\na = [list(map(int, input().split())) for i in range(N)]\nif N == 1:\n print((max(0, a[0][1] - a[0][0], a[0][1] - (C - a[0][0]))), sys.exit())\nb = list(acc([a[i][1] for i in range(N)]))\nans = sum([a[i][1] for i in range(N)]) + max(C - a[0][0], a[N - 1][0])\nl = [[b[i] - a[i][0], 0] for i in range(N)]\nr = [[b[N - 1] - (C - a[0][0]), 0]] + [\n [b[N - 1] - b[i] - (C - a[i + 1][0]), 0] for i in range(N - 1)\n]\ntmp = 0\nfor i in range(N):\n if l[i][0] > tmp:\n tmp = l[i][0]\n l[i][1] = tmp\ntmp = 0\nfor i in range(N - 1, -1, -1):\n if r[i][0] > tmp:\n tmp = r[i][0]\n r[i][1] = tmp\np = [l[0][1], r[0][1], l[0][1] - a[0][0] + r[1][1]]\nq = [l[N - 1][1], r[N - 1][1], r[N - 1][0] - (C - a[N - 1][0]) + l[N - 2][1]]\nans = max(p + q)\nfor i in range(1, N - 1):\n p1 = l[i][1]\n p2 = r[i][1]\n p3 = l[i][1] - a[i][0] + r[i + 1][1]\n p4 = r[i][1] - (C - a[i][0]) + l[i - 1][1]\n ans = max(ans, p1, p2, p3, p4)\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import accumulate as acc\nimport sys\n\nN, C = list(map(int, input().split()))\na = [list(map(int, input().split())) for i in range(N)]\nif N == 1:\n print((max(0, a[0][1] - a[0][0], a[0][1] - (C - a[0][0]))), sys.exit())\ntmp = a[0][1] - a[0][0]\nM = max(0, tmp)\nl = [M]\nfor i in range(1, N):\n tmp += a[i][1] - (a[i][0] - a[i - 1][0])\n M = max(tmp, M)\n l.append(M)\ntmp = a[N - 1][1] - (C - a[N - 1][0])\nM = max(0, tmp)\nr = [M]\nfor i in range(N - 2, -1, -1):\n tmp += a[i][1] - (a[i + 1][0] - a[i][0])\n M = max(tmp, M)\n r.append(M)\nr.reverse()\nans = max(\n l[0],\n r[0],\n l[0] - a[0][0] + r[1],\n l[N - 1],\n r[N - 1],\n r[N - 1] - (C - a[N - 1][0]) + l[N - 2],\n)\nfor i in range(1, N - 1):\n ans = max(\n ans, l[i], r[i], l[i] - a[i][0] + r[i + 1], r[i] - (C - a[i][0]) + l[i - 1]\n )\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-b = list(acc([a[i][1] for i in range(N)]))","-ans = sum([a[i][1] for i in range(N)]) + max(C - a[0][0], a[N - 1][0])","-l = [[b[i] - a[i][0], 0] for i in range(N)]","-r = [[b[N - 1] - (C - a[0][0]), 0]] + [","- [b[N - 1] - b[i] - (C - a[i + 1][0]), 0] for i in range(N - 1)","-]","-tmp = 0","-for i in range(N):","- if l[i][0] > tmp:","- tmp = l[i][0]","- l[i][1] = tmp","-tmp = 0","-for i in range(N - 1, -1, -1):","- if r[i][0] > tmp:","- tmp = r[i][0]","- r[i][1] = tmp","-p = [l[0][1], r[0][1], l[0][1] - a[0][0] + r[1][1]]","-q = [l[N - 1][1], r[N - 1][1], r[N - 1][0] - (C - a[N - 1][0]) + l[N - 2][1]]","-ans = max(p + q)","+tmp = a[0][1] - a[0][0]","+M = max(0, tmp)","+l = [M]","+for i in range(1, N):","+ tmp += a[i][1] - (a[i][0] - a[i - 1][0])","+ M = max(tmp, M)","+ l.append(M)","+tmp = a[N - 1][1] - (C - a[N - 1][0])","+M = max(0, tmp)","+r = [M]","+for i in range(N - 2, -1, -1):","+ tmp += a[i][1] - (a[i + 1][0] - a[i][0])","+ M = max(tmp, M)","+ r.append(M)","+r.reverse()","+ans = max(","+ l[0],","+ r[0],","+ l[0] - a[0][0] + r[1],","+ l[N - 1],","+ r[N - 1],","+ r[N - 1] - (C - a[N - 1][0]) + l[N - 2],","+)","- p1 = l[i][1]","- p2 = r[i][1]","- p3 = l[i][1] - a[i][0] + r[i + 1][1]","- p4 = r[i][1] - (C - a[i][0]) + l[i - 1][1]","- ans = max(ans, p1, p2, p3, p4)","+ ans = max(","+ ans, l[i], r[i], l[i] - a[i][0] + r[i + 1], r[i] - (C - a[i][0]) + l[i - 1]","+ )"],"diff_only_import_comment":false,"measured_runtime_v0":0.1086718082,"measured_runtime_v1":0.0929413795,"runtime_lift":1.1692510781,"key":["s809158931","s053269944"]} +{"user_id":"u562935282","problem_id":"p02975","language":"python","submission_id_v0":"s194108436","submission_id_v1":"s451075467","cpu_time_v0":66,"cpu_time_v1":53,"memory_v0":15364,"memory_v1":14468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.7,"input":"from collections import defaultdict\n\n\n\nn = int(eval(input()))\n\na = tuple(map(int, input().split()))\n\n\n\ncan = True\n\nif n % 3 == 0:\n\n d = defaultdict(int)\n\n for aa in a:\n\n d[aa] += 1\n\n m = n \/\/ 3\n\n\n\n t = []\n\n for number, cnt in list(d.items()):\n\n if cnt % m != 0:\n\n can = False\n\n break\n\n else:\n\n for _ in range(cnt \/\/ m):\n\n t.append(number)\n\n else:\n\n if any(t[(0 + i) % 3] ^ t[(1 + i) % 3] != t[(2 + i) % 3] for i in range(3)):\n\n can = False\n\n\n\nelse:\n\n if any(aa != 0 for aa in a):\n\n can = False\n\n\n\nprint(('Yes' if can else 'No'))","target":"def main():\n\n from collections import Counter\n\n\n\n n = int(eval(input()))\n\n *a, = list(map(int, input().split()))\n\n\n\n if n % 3 == 0:\n\n ctr = Counter(a)\n\n if len(ctr) == 1:\n\n print(('Yes' if 0 in ctr else 'No'))\n\n return\n\n\n\n elif len(ctr) == 2:\n\n print(('Yes' if ctr[0] == n \/\/ 3 else 'No'))\n\n return\n\n\n\n elif len(ctr) == 3:\n\n x = 0\n\n p = None\n\n for k, v in list(ctr.items()):\n\n if p is None:\n\n p = v\n\n elif p != v:\n\n print('No')\n\n return\n\n x ^= k\n\n print(('Yes' if x == 0 else 'No'))\n\n return\n\n\n\n else:\n\n print('No')\n\n return\n\n\n\n else:\n\n print(('Yes' if all([x == 0 for x in a]) else 'No'))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":29,"code_v1_loc":40,"code_v0_num_chars":629,"code_v1_num_chars":909,"code_v0_no_empty_lines":"from collections import defaultdict\n\nn = int(eval(input()))\na = tuple(map(int, input().split()))\ncan = True\nif n % 3 == 0:\n d = defaultdict(int)\n for aa in a:\n d[aa] += 1\n m = n \/\/ 3\n t = []\n for number, cnt in list(d.items()):\n if cnt % m != 0:\n can = False\n break\n else:\n for _ in range(cnt \/\/ m):\n t.append(number)\n else:\n if any(t[(0 + i) % 3] ^ t[(1 + i) % 3] != t[(2 + i) % 3] for i in range(3)):\n can = False\nelse:\n if any(aa != 0 for aa in a):\n can = False\nprint((\"Yes\" if can else \"No\"))\n","code_v1_no_empty_lines":"def main():\n from collections import Counter\n\n n = int(eval(input()))\n (*a,) = list(map(int, input().split()))\n if n % 3 == 0:\n ctr = Counter(a)\n if len(ctr) == 1:\n print((\"Yes\" if 0 in ctr else \"No\"))\n return\n elif len(ctr) == 2:\n print((\"Yes\" if ctr[0] == n \/\/ 3 else \"No\"))\n return\n elif len(ctr) == 3:\n x = 0\n p = None\n for k, v in list(ctr.items()):\n if p is None:\n p = v\n elif p != v:\n print(\"No\")\n return\n x ^= k\n print((\"Yes\" if x == 0 else \"No\"))\n return\n else:\n print(\"No\")\n return\n else:\n print((\"Yes\" if all([x == 0 for x in a]) else \"No\"))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":27.5,"diff":["-from collections import defaultdict","+def main():","+ from collections import Counter","-n = int(eval(input()))","-a = tuple(map(int, input().split()))","-can = True","-if n % 3 == 0:","- d = defaultdict(int)","- for aa in a:","- d[aa] += 1","- m = n \/\/ 3","- t = []","- for number, cnt in list(d.items()):","- if cnt % m != 0:","- can = False","- break","+ n = int(eval(input()))","+ (*a,) = list(map(int, input().split()))","+ if n % 3 == 0:","+ ctr = Counter(a)","+ if len(ctr) == 1:","+ print((\"Yes\" if 0 in ctr else \"No\"))","+ return","+ elif len(ctr) == 2:","+ print((\"Yes\" if ctr[0] == n \/\/ 3 else \"No\"))","+ return","+ elif len(ctr) == 3:","+ x = 0","+ p = None","+ for k, v in list(ctr.items()):","+ if p is None:","+ p = v","+ elif p != v:","+ print(\"No\")","+ return","+ x ^= k","+ print((\"Yes\" if x == 0 else \"No\"))","+ return","- for _ in range(cnt \/\/ m):","- t.append(number)","+ print(\"No\")","+ return","- if any(t[(0 + i) % 3] ^ t[(1 + i) % 3] != t[(2 + i) % 3] for i in range(3)):","- can = False","-else:","- if any(aa != 0 for aa in a):","- can = False","-print((\"Yes\" if can else \"No\"))","+ print((\"Yes\" if all([x == 0 for x in a]) else \"No\"))","+ return","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.06732365,"measured_runtime_v1":0.0819391468,"runtime_lift":0.8216298643,"key":["s194108436","s451075467"]} +{"user_id":"u600402037","problem_id":"p03837","language":"python","submission_id_v0":"s671349300","submission_id_v1":"s654250465","cpu_time_v0":332,"cpu_time_v1":283,"memory_v0":3316,"memory_v1":18492,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.76,"input":"import sys\n\nfrom heapq import heappop, heappush\n\n#import numpy as np\n\n\n\nstdin = sys.stdin\n\n\n\nri = lambda: int(rs())\n\nrl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only\n\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\n\n\ndef dijkstra(start):\n\n INF = 10 ** 5\n\n dist = [INF] * (N+1) # dist[0]\u306f\u4f7f\u308f\u306a\u3044\n\n dist[start] = 0\n\n que = [(0, start)]\n\n while que:\n\n # (d, v) \u306fd\u304c\u73fe\u5728\u306e\u6700\u5c0f\u306e\u4ea4\u901a\u8cbb\u3001v\u304c\u73fe\u5728\u306e\u5834\u6240\n\n d, v = heappop(que)\n\n # \u4eca\u3088\u308a\u5b89\u3044\u4ea4\u901a\u8cbb\u3067\u65e2\u306b\u6765\u305f\u3053\u3068\u304c\u3042\u308b\u5834\u5408\u3001continue\n\n if dist[v] < d:\n\n continue\n\n for next_city, cost in list(edges[v].items()):\n\n # mode\u306b\u3088\u3063\u3066\u5186\u304b\u30b9\u30cc\u30fc\u30af\u3092\u4f7f\u3046\u304b\u9078\u3076\n\n d1 = d + cost\n\n # \u6b21\u306e\u5834\u6240\u306e\u4ea4\u901a\u8cbb\u3088\u308a\u5b89\u304f\u306a\u308b\u5834\u5408\u306f\u3001\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\n\n if dist[next_city] > d1:\n\n dist[next_city] = d1\n\n heappush(que, (d1, next_city))\n\n return dist\n\n\n\nN, M = rl()\n\nINF = 10 ** 5\n\nedges = [{} for _ in range(N+1)]\n\nfor _ in range(M):\n\n a, b, c = rl()\n\n edges[a][b] = c\n\n edges[b][a] = c\n\n\n\nanswer = 0\n\nfor i in range(1, N+1):\n\n for j in range(i+1, N+1):\n\n if j not in edges[i]:\n\n continue\n\n A = dijkstra(i)\n\n if A[j] < edges[i][j]:\n\n answer += 1\n\n edges[i].pop(j)\n\n edges[j].pop(i)\n\n\n\nprint(answer)\n\n# 00\n","target":"import sys\n\nfrom scipy.sparse.csgraph import shortest_path\n\nimport numpy as np\n\n\n\nstdin = sys.stdin\n\n\n\nri = lambda: int(rs())\n\nrl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only\n\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\n\n\nN, M = rl()\n\nedges = [rl() for _ in range(M)]\n\ngraph = np.zeros((N, N))\n\n\n\nfor a, b, c in edges:\n\n graph[a-1, b-1] = c\n\n\n\ndist = shortest_path(graph, directed=False).astype(int)\n\nanswer = 0\n\nfor a, b, c in edges:\n\n if c != dist[a-1, b-1]:\n\n answer += 1\n\n\n\nprint(answer)\n\n#05","code_v0_loc":51,"code_v1_loc":25,"code_v0_num_chars":1290,"code_v1_num_chars":563,"code_v0_no_empty_lines":"import sys\nfrom heapq import heappop, heappush\n\n# import numpy as np\nstdin = sys.stdin\nri = lambda: int(rs())\nrl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\n\ndef dijkstra(start):\n INF = 10**5\n dist = [INF] * (N + 1) # dist[0]\u306f\u4f7f\u308f\u306a\u3044\n dist[start] = 0\n que = [(0, start)]\n while que:\n # (d, v) \u306fd\u304c\u73fe\u5728\u306e\u6700\u5c0f\u306e\u4ea4\u901a\u8cbb\u3001v\u304c\u73fe\u5728\u306e\u5834\u6240\n d, v = heappop(que)\n # \u4eca\u3088\u308a\u5b89\u3044\u4ea4\u901a\u8cbb\u3067\u65e2\u306b\u6765\u305f\u3053\u3068\u304c\u3042\u308b\u5834\u5408\u3001continue\n if dist[v] < d:\n continue\n for next_city, cost in list(edges[v].items()):\n # mode\u306b\u3088\u3063\u3066\u5186\u304b\u30b9\u30cc\u30fc\u30af\u3092\u4f7f\u3046\u304b\u9078\u3076\n d1 = d + cost\n # \u6b21\u306e\u5834\u6240\u306e\u4ea4\u901a\u8cbb\u3088\u308a\u5b89\u304f\u306a\u308b\u5834\u5408\u306f\u3001\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\n if dist[next_city] > d1:\n dist[next_city] = d1\n heappush(que, (d1, next_city))\n return dist\n\n\nN, M = rl()\nINF = 10**5\nedges = [{} for _ in range(N + 1)]\nfor _ in range(M):\n a, b, c = rl()\n edges[a][b] = c\n edges[b][a] = c\nanswer = 0\nfor i in range(1, N + 1):\n for j in range(i + 1, N + 1):\n if j not in edges[i]:\n continue\n A = dijkstra(i)\n if A[j] < edges[i][j]:\n answer += 1\n edges[i].pop(j)\n edges[j].pop(i)\nprint(answer)\n# 00\n","code_v1_no_empty_lines":"import sys\nfrom scipy.sparse.csgraph import shortest_path\nimport numpy as np\n\nstdin = sys.stdin\nri = lambda: int(rs())\nrl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\nN, M = rl()\nedges = [rl() for _ in range(M)]\ngraph = np.zeros((N, N))\nfor a, b, c in edges:\n graph[a - 1, b - 1] = c\ndist = shortest_path(graph, directed=False).astype(int)\nanswer = 0\nfor a, b, c in edges:\n if c != dist[a - 1, b - 1]:\n answer += 1\nprint(answer)\n# 05\n","code_same":false,"relative_loc_diff_percent":50.9803921569,"diff":["-from heapq import heappop, heappush","+from scipy.sparse.csgraph import shortest_path","+import numpy as np","-# import numpy as np","-","-","-def dijkstra(start):","- INF = 10**5","- dist = [INF] * (N + 1) # dist[0]\u306f\u4f7f\u308f\u306a\u3044","- dist[start] = 0","- que = [(0, start)]","- while que:","- # (d, v) \u306fd\u304c\u73fe\u5728\u306e\u6700\u5c0f\u306e\u4ea4\u901a\u8cbb\u3001v\u304c\u73fe\u5728\u306e\u5834\u6240","- d, v = heappop(que)","- # \u4eca\u3088\u308a\u5b89\u3044\u4ea4\u901a\u8cbb\u3067\u65e2\u306b\u6765\u305f\u3053\u3068\u304c\u3042\u308b\u5834\u5408\u3001continue","- if dist[v] < d:","- continue","- for next_city, cost in list(edges[v].items()):","- # mode\u306b\u3088\u3063\u3066\u5186\u304b\u30b9\u30cc\u30fc\u30af\u3092\u4f7f\u3046\u304b\u9078\u3076","- d1 = d + cost","- # \u6b21\u306e\u5834\u6240\u306e\u4ea4\u901a\u8cbb\u3088\u308a\u5b89\u304f\u306a\u308b\u5834\u5408\u306f\u3001\u30c7\u30fc\u30bf\u3092\u66f4\u65b0","- if dist[next_city] > d1:","- dist[next_city] = d1","- heappush(que, (d1, next_city))","- return dist","-","-","-INF = 10**5","-edges = [{} for _ in range(N + 1)]","-for _ in range(M):","- a, b, c = rl()","- edges[a][b] = c","- edges[b][a] = c","+edges = [rl() for _ in range(M)]","+graph = np.zeros((N, N))","+for a, b, c in edges:","+ graph[a - 1, b - 1] = c","+dist = shortest_path(graph, directed=False).astype(int)","-for i in range(1, N + 1):","- for j in range(i + 1, N + 1):","- if j not in edges[i]:","- continue","- A = dijkstra(i)","- if A[j] < edges[i][j]:","- answer += 1","- edges[i].pop(j)","- edges[j].pop(i)","+for a, b, c in edges:","+ if c != dist[a - 1, b - 1]:","+ answer += 1","-# 00","+# 05"],"diff_only_import_comment":false,"measured_runtime_v0":0.0438737356,"measured_runtime_v1":0.4798817194,"runtime_lift":0.0914261449,"key":["s671349300","s654250465"]} +{"user_id":"u506858457","problem_id":"p02762","language":"python","submission_id_v0":"s367351671","submission_id_v1":"s124577186","cpu_time_v0":1587,"cpu_time_v1":1274,"memory_v0":125220,"memory_v1":116828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.72,"input":"#\u3042\u3063\u3068\u306eTECH LOG\u3001\u3053\u3053\u304b\u3089DFS\n\nN, M, K = map(int, input().split())\n\nF = [[] for _ in range(N)]\n\nB = [[] for _ in range(N)]\n\n\n\nfor _ in range(M):\n\n a, b = map(int, input().split())\n\n a, b = a - 1, b - 1\n\n F[a].append(b)\n\n F[b].append(a)\n\n\n\nfor _ in range(K):\n\n c, d = map(int, input().split())\n\n c, d = c - 1, d - 1\n\n B[c].append(d)\n\n B[d].append(c)\n\n\n\n\n\nD = {}\n\nparent = [-1] * N\n\nvisited = [False] * N\n\nfor root in range(N):\n\n if visited[root]:\n\n continue\n\n\n\n D[root] = set([root])\n\n stack = [root]\n\n while stack:\n\n n = stack.pop()\n\n visited[n] = True\n\n parent[n] = root\n\n\n\n for to in F[n]:\n\n if visited[to]:\n\n continue\n\n D[root].add(to)\n\n stack.append(to)\n\n\n\nans = [0] * N\n\nfor iam in range(N):\n\n group = D[parent[iam]]\n\n tmp_ans = len(group) - len(F[iam]) - 1\n\n for block in B[iam]:\n\n if block in group:\n\n tmp_ans -= 1\n\n ans[iam] = tmp_ans\n\n\n\nprint(*ans, sep=' ')\n","target":"#@YottyPG\u3000Qiita\n\nfrom collections import deque\n\n\n\nN,M,K = list(map(int,input().split()))\n\nfriend = [list(map(int,input().split())) for _ in range(M)]\n\nblock = [list(map(int,input().split())) for _ in range(K)]\n\n\n\nf = [set() for _ in range(N+1)]\n\nb = [set() for _ in range(N+1)]\n\n\n\nfor i,j in friend:\n\n f[i].add(j)\n\n f[j].add(i)\n\nfor i,j in block:\n\n b[i].add(j)\n\n b[j].add(i)\n\n\n\nstack=deque()\n\nans = [0]*(N+1)\n\nvisited = [0]*(N+1)\n\n\n\nfor i in range(1,N+1):\n\n if visited[i]:\n\n continue\n\n link = {i}\n\n visited[i] = 1 \n\n stack.append(i)\n\n while stack:\n\n n = stack.pop()\n\n for j in f[n]:\n\n if visited[j]==0:\n\n stack.append(j)\n\n visited[j] = 1\n\n link.add(j)\n\n for i in link:\n\n ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1\n\nprint((*ans[1:]))","code_v0_loc":48,"code_v1_loc":37,"code_v0_num_chars":1007,"code_v1_num_chars":856,"code_v0_no_empty_lines":"# \u3042\u3063\u3068\u306eTECH LOG\u3001\u3053\u3053\u304b\u3089DFS\nN, M, K = map(int, input().split())\nF = [[] for _ in range(N)]\nB = [[] for _ in range(N)]\nfor _ in range(M):\n a, b = map(int, input().split())\n a, b = a - 1, b - 1\n F[a].append(b)\n F[b].append(a)\nfor _ in range(K):\n c, d = map(int, input().split())\n c, d = c - 1, d - 1\n B[c].append(d)\n B[d].append(c)\nD = {}\nparent = [-1] * N\nvisited = [False] * N\nfor root in range(N):\n if visited[root]:\n continue\n D[root] = set([root])\n stack = [root]\n while stack:\n n = stack.pop()\n visited[n] = True\n parent[n] = root\n for to in F[n]:\n if visited[to]:\n continue\n D[root].add(to)\n stack.append(to)\nans = [0] * N\nfor iam in range(N):\n group = D[parent[iam]]\n tmp_ans = len(group) - len(F[iam]) - 1\n for block in B[iam]:\n if block in group:\n tmp_ans -= 1\n ans[iam] = tmp_ans\nprint(*ans, sep=\" \")\n","code_v1_no_empty_lines":"# @YottyPG\u3000Qiita\nfrom collections import deque\n\nN, M, K = list(map(int, input().split()))\nfriend = [list(map(int, input().split())) for _ in range(M)]\nblock = [list(map(int, input().split())) for _ in range(K)]\nf = [set() for _ in range(N + 1)]\nb = [set() for _ in range(N + 1)]\nfor i, j in friend:\n f[i].add(j)\n f[j].add(i)\nfor i, j in block:\n b[i].add(j)\n b[j].add(i)\nstack = deque()\nans = [0] * (N + 1)\nvisited = [0] * (N + 1)\nfor i in range(1, N + 1):\n if visited[i]:\n continue\n link = {i}\n visited[i] = 1\n stack.append(i)\n while stack:\n n = stack.pop()\n for j in f[n]:\n if visited[j] == 0:\n stack.append(j)\n visited[j] = 1\n link.add(j)\n for i in link:\n ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1\nprint((*ans[1:]))\n","code_same":false,"relative_loc_diff_percent":22.9166666667,"diff":["-# \u3042\u3063\u3068\u306eTECH LOG\u3001\u3053\u3053\u304b\u3089DFS","-N, M, K = map(int, input().split())","-F = [[] for _ in range(N)]","-B = [[] for _ in range(N)]","-for _ in range(M):","- a, b = map(int, input().split())","- a, b = a - 1, b - 1","- F[a].append(b)","- F[b].append(a)","-for _ in range(K):","- c, d = map(int, input().split())","- c, d = c - 1, d - 1","- B[c].append(d)","- B[d].append(c)","-D = {}","-parent = [-1] * N","-visited = [False] * N","-for root in range(N):","- if visited[root]:","+# @YottyPG\u3000Qiita","+from collections import deque","+","+N, M, K = list(map(int, input().split()))","+friend = [list(map(int, input().split())) for _ in range(M)]","+block = [list(map(int, input().split())) for _ in range(K)]","+f = [set() for _ in range(N + 1)]","+b = [set() for _ in range(N + 1)]","+for i, j in friend:","+ f[i].add(j)","+ f[j].add(i)","+for i, j in block:","+ b[i].add(j)","+ b[j].add(i)","+stack = deque()","+ans = [0] * (N + 1)","+visited = [0] * (N + 1)","+for i in range(1, N + 1):","+ if visited[i]:","- D[root] = set([root])","- stack = [root]","+ link = {i}","+ visited[i] = 1","+ stack.append(i)","- visited[n] = True","- parent[n] = root","- for to in F[n]:","- if visited[to]:","- continue","- D[root].add(to)","- stack.append(to)","-ans = [0] * N","-for iam in range(N):","- group = D[parent[iam]]","- tmp_ans = len(group) - len(F[iam]) - 1","- for block in B[iam]:","- if block in group:","- tmp_ans -= 1","- ans[iam] = tmp_ans","-print(*ans, sep=\" \")","+ for j in f[n]:","+ if visited[j] == 0:","+ stack.append(j)","+ visited[j] = 1","+ link.add(j)","+ for i in link:","+ ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1","+print((*ans[1:]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0458998392,"measured_runtime_v1":0.0400581417,"runtime_lift":1.1458304653,"key":["s367351671","s124577186"]} +{"user_id":"u865119809","problem_id":"p02861","language":"python","submission_id_v0":"s298432919","submission_id_v1":"s360971238","cpu_time_v0":451,"cpu_time_v1":18,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":96.01,"input":"import math\n\nimport itertools\n\nn = int(eval(input()))\n\n\n\nxys = [[] for i in range(n)]\n\n\n\nfor i in range(n):\n\n xys[i] = list(map(int,input().split()))\n\n\n\n\n\nm = math.factorial(n)\n\nc = [i for i in range(n)]\n\ncs = itertools.permutations(c)\n\n\n\ns = 0\n\nfor d in cs:\n\n for j in range(len(d)-1):\n\n x = (xys[d[j]][0] - xys[d[j+1]][0]) ** 2 + (xys[d[j]][1] - xys[d[j+1]][1]) ** 2\n\n s += x ** (0.5)\n\n\n\nprint((s\/m))\n","target":"import itertools\n\nimport math\n\nn = int(eval(input()))\n\n\n\npoints = []\n\nfor i in range(n):\n\n x,y = list(map(int,input().split()))\n\n points.append([x,y])\n\n\n\n\n\ncs = list(itertools.combinations(points,2))\n\nans = 0\n\nfor a,b in cs:\n\n c = (a[0]-b[0]) ** 2 + (a[1]-b[1]) ** 2\n\n ans += math.sqrt(c)\n\n\n\nans = (ans \/ n) * 2\n\nprint(ans)\n","code_v0_loc":21,"code_v1_loc":18,"code_v0_num_chars":415,"code_v1_num_chars":324,"code_v0_no_empty_lines":"import math\nimport itertools\n\nn = int(eval(input()))\nxys = [[] for i in range(n)]\nfor i in range(n):\n xys[i] = list(map(int, input().split()))\nm = math.factorial(n)\nc = [i for i in range(n)]\ncs = itertools.permutations(c)\ns = 0\nfor d in cs:\n for j in range(len(d) - 1):\n x = (xys[d[j]][0] - xys[d[j + 1]][0]) ** 2 + (\n xys[d[j]][1] - xys[d[j + 1]][1]\n ) ** 2\n s += x ** (0.5)\nprint((s \/ m))\n","code_v1_no_empty_lines":"import itertools\nimport math\n\nn = int(eval(input()))\npoints = []\nfor i in range(n):\n x, y = list(map(int, input().split()))\n points.append([x, y])\ncs = list(itertools.combinations(points, 2))\nans = 0\nfor a, b in cs:\n c = (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2\n ans += math.sqrt(c)\nans = (ans \/ n) * 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+import itertools","-import itertools","-xys = [[] for i in range(n)]","+points = []","- xys[i] = list(map(int, input().split()))","-m = math.factorial(n)","-c = [i for i in range(n)]","-cs = itertools.permutations(c)","-s = 0","-for d in cs:","- for j in range(len(d) - 1):","- x = (xys[d[j]][0] - xys[d[j + 1]][0]) ** 2 + (","- xys[d[j]][1] - xys[d[j + 1]][1]","- ) ** 2","- s += x ** (0.5)","-print((s \/ m))","+ x, y = list(map(int, input().split()))","+ points.append([x, y])","+cs = list(itertools.combinations(points, 2))","+ans = 0","+for a, b in cs:","+ c = (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2","+ ans += math.sqrt(c)","+ans = (ans \/ n) * 2","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0762213707,"measured_runtime_v1":0.0435182571,"runtime_lift":1.7514803139,"key":["s298432919","s360971238"]} +{"user_id":"u723590269","problem_id":"p03494","language":"python","submission_id_v0":"s293130956","submission_id_v1":"s660330670","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"N = int(eval(input()))\n\nA = list(map(int, input().split(\" \"))) \n\n\n\nA_amari = [0]*N\n\ncnt = 0\n\n\n\nwhile(not(1 in A_amari)):\n\n for i in range(len(A)):\n\n A_amari[i] = A[i] % 2 \n\n A[i] = A[i] \/ 2\n\n if(not(1 in A_amari)):cnt += 1\n\n\n\nprint(cnt)","target":"n = int(eval(input()))\n\na = list(map(int,input().split()))\n\n\n\nflg = 0\n\ncnt = 0\n\n\n\nwhile (flg == 0):\n\n for i in a:\n\n if i%2 == 1:\n\n flg = 1\n\n if flg == 1:\n\n break\n\n cnt += 1\n\n a = [i\/2 for i in a]\n\n\n\nprint(cnt)","code_v0_loc":13,"code_v1_loc":16,"code_v0_num_chars":257,"code_v1_num_chars":240,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split(\" \")))\nA_amari = [0] * N\ncnt = 0\nwhile not (1 in A_amari):\n for i in range(len(A)):\n A_amari[i] = A[i] % 2\n A[i] = A[i] \/ 2\n if not (1 in A_amari):\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nflg = 0\ncnt = 0\nwhile flg == 0:\n for i in a:\n if i % 2 == 1:\n flg = 1\n if flg == 1:\n break\n cnt += 1\n a = [i \/ 2 for i in a]\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-N = int(eval(input()))","-A = list(map(int, input().split(\" \")))","-A_amari = [0] * N","+n = int(eval(input()))","+a = list(map(int, input().split()))","+flg = 0","-while not (1 in A_amari):","- for i in range(len(A)):","- A_amari[i] = A[i] % 2","- A[i] = A[i] \/ 2","- if not (1 in A_amari):","- cnt += 1","+while flg == 0:","+ for i in a:","+ if i % 2 == 1:","+ flg = 1","+ if flg == 1:","+ break","+ cnt += 1","+ a = [i \/ 2 for i in a]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0390165854,"measured_runtime_v1":0.0428650973,"runtime_lift":0.9102180518,"key":["s293130956","s660330670"]} +{"user_id":"u891635666","problem_id":"p03354","language":"python","submission_id_v0":"s450583417","submission_id_v1":"s573605122","cpu_time_v0":704,"cpu_time_v1":560,"memory_v0":36072,"memory_v1":36040,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.45,"input":"n, m = list(map(int, input().split()))\n\nps = list(map(int, input().split()))\n\nls = [list(map(int, input().split())) for _ in range(m)]\n\n\n\n\n\nclass UnionFind:\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = list(range(n + 1))\n\n self.ranks = [0 for _ in range(n + 1)]\n\n\n\n def get_root(self, x):\n\n if self.parents[x] == x:\n\n return x\n\n self.parents[x] = self.get_root(self.parents[x])\n\n return self.parents[x]\n\n\n\n def merge(self, x, y):\n\n x = self.get_root(x)\n\n y = self.get_root(y)\n\n if x != y:\n\n if self.ranks[x] < self.ranks[y]:\n\n self.parents[x] = y\n\n else:\n\n self.parents[y] = x\n\n if self.ranks[x] == self.ranks[y]:\n\n self.ranks[x] += 1\n\n\n\n\n\nuf = UnionFind(n)\n\nfor a, b in ls:\n\n uf.merge(a, b)\n\nres = 0\n\nfor i in range(1, n + 1):\n\n p0 = uf.get_root(i)\n\n p1 = uf.get_root(ps[i - 1])\n\n if p0 == p1:\n\n res += 1\n\nprint(res)","target":"import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\nri = lambda: int(eval(input()))\n\nrs = lambda: input().rstrip()\n\nril = lambda: list(map(int, input().split()))\n\nrsl = lambda: input().rstrip().split()\n\nris = lambda n: [ri() for _ in range(n)]\n\nrss = lambda n: [rs() for _ in range(n)]\n\nrils = lambda n: [ril() for _ in range(n)]\n\nrsls = lambda n: [rsl() for _ in range(n)]\n\n\n\n\n\nclass UnionFind:\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = list(range(n))\n\n self.ranks = [0 for _ in range(n)]\n\n\n\n def get_root(self, x):\n\n if self.parents[x] == x:\n\n return x\n\n self.parents[x] = self.get_root(self.parents[x])\n\n return self.parents[x]\n\n\n\n def merge(self, x, y):\n\n x = self.get_root(x)\n\n y = self.get_root(y)\n\n if x != y:\n\n if self.ranks[x] < self.ranks[y]:\n\n self.parents[x] = y\n\n else:\n\n self.parents[y] = x\n\n if self.ranks[x] == self.ranks[y]:\n\n self.ranks[x] += 1\n\n\n\n\n\nn, m = ril()\n\nps = ril()\n\nls = rils(m)\n\n\n\nuf = UnionFind(n)\n\nfor a, b in ls:\n\n uf.merge(a - 1, b - 1)\n\nres = 0\n\nfor i in range(n):\n\n p0 = uf.get_root(i)\n\n p1 = uf.get_root(ps[i] - 1)\n\n if p0 == p1:\n\n res += 1\n\nprint(res)","code_v0_loc":39,"code_v1_loc":52,"code_v0_num_chars":1009,"code_v1_num_chars":1275,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nps = list(map(int, input().split()))\nls = [list(map(int, input().split())) for _ in range(m)]\n\n\nclass UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = list(range(n + 1))\n self.ranks = [0 for _ in range(n + 1)]\n\n def get_root(self, x):\n if self.parents[x] == x:\n return x\n self.parents[x] = self.get_root(self.parents[x])\n return self.parents[x]\n\n def merge(self, x, y):\n x = self.get_root(x)\n y = self.get_root(y)\n if x != y:\n if self.ranks[x] < self.ranks[y]:\n self.parents[x] = y\n else:\n self.parents[y] = x\n if self.ranks[x] == self.ranks[y]:\n self.ranks[x] += 1\n\n\nuf = UnionFind(n)\nfor a, b in ls:\n uf.merge(a, b)\nres = 0\nfor i in range(1, n + 1):\n p0 = uf.get_root(i)\n p1 = uf.get_root(ps[i - 1])\n if p0 == p1:\n res += 1\nprint(res)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nri = lambda: int(eval(input()))\nrs = lambda: input().rstrip()\nril = lambda: list(map(int, input().split()))\nrsl = lambda: input().rstrip().split()\nris = lambda n: [ri() for _ in range(n)]\nrss = lambda n: [rs() for _ in range(n)]\nrils = lambda n: [ril() for _ in range(n)]\nrsls = lambda n: [rsl() for _ in range(n)]\n\n\nclass UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = list(range(n))\n self.ranks = [0 for _ in range(n)]\n\n def get_root(self, x):\n if self.parents[x] == x:\n return x\n self.parents[x] = self.get_root(self.parents[x])\n return self.parents[x]\n\n def merge(self, x, y):\n x = self.get_root(x)\n y = self.get_root(y)\n if x != y:\n if self.ranks[x] < self.ranks[y]:\n self.parents[x] = y\n else:\n self.parents[y] = x\n if self.ranks[x] == self.ranks[y]:\n self.ranks[x] += 1\n\n\nn, m = ril()\nps = ril()\nls = rils(m)\nuf = UnionFind(n)\nfor a, b in ls:\n uf.merge(a - 1, b - 1)\nres = 0\nfor i in range(n):\n p0 = uf.get_root(i)\n p1 = uf.get_root(ps[i] - 1)\n if p0 == p1:\n res += 1\nprint(res)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-n, m = list(map(int, input().split()))","-ps = list(map(int, input().split()))","-ls = [list(map(int, input().split())) for _ in range(m)]","+import sys","+","+input = sys.stdin.readline","+ri = lambda: int(eval(input()))","+rs = lambda: input().rstrip()","+ril = lambda: list(map(int, input().split()))","+rsl = lambda: input().rstrip().split()","+ris = lambda n: [ri() for _ in range(n)]","+rss = lambda n: [rs() for _ in range(n)]","+rils = lambda n: [ril() for _ in range(n)]","+rsls = lambda n: [rsl() for _ in range(n)]","- self.parents = list(range(n + 1))","- self.ranks = [0 for _ in range(n + 1)]","+ self.parents = list(range(n))","+ self.ranks = [0 for _ in range(n)]","+n, m = ril()","+ps = ril()","+ls = rils(m)","- uf.merge(a, b)","+ uf.merge(a - 1, b - 1)","-for i in range(1, n + 1):","+for i in range(n):","- p1 = uf.get_root(ps[i - 1])","+ p1 = uf.get_root(ps[i] - 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.037937561,"measured_runtime_v1":0.0378112388,"runtime_lift":1.0033408654,"key":["s450583417","s573605122"]} +{"user_id":"u782850731","problem_id":"p00111","language":"python","submission_id_v0":"s023376880","submission_id_v1":"s611677703","cpu_time_v0":50,"cpu_time_v1":30,"memory_v0":4392,"memory_v1":4304,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.0,"input":"#!\/usr\/bin\/env python\n\n\n\nfrom sys import stdin, exit\n\n\n\n\n\ncode_table = {chr(65+i): '{:05b}'.format(i) for i in range(26)}\n\ncode_table.update({' ': '11010', '.': '11011', ',': '11100', '-': '11101',\n\n \"'\": '11110', '?': '11111'})\n\n\n\n\n\ndef decrypt(it):\n\n if int(next(it)):\n\n if int(next(it)):\n\n if int(next(it)):\n\n return 'P'\n\n else:\n\n return 'E'\n\n else:\n\n if int(next(it)):\n\n return ' '\n\n else:\n\n if int(next(it)):\n\n if int(next(it)):\n\n if int(next(it)):\n\n if int(next(it)):\n\n if int(next(it)):\n\n return 'Q'\n\n else:\n\n return 'N'\n\n else:\n\n if int(next(it)):\n\n return 'V'\n\n else:\n\n return 'U'\n\n else:\n\n if int(next(it)):\n\n if int(next(it)):\n\n return 'G'\n\n else:\n\n return 'B'\n\n else:\n\n if int(next(it)):\n\n return 'M'\n\n else:\n\n return 'J'\n\n else:\n\n if int(next(it)):\n\n return 'A'\n\n else:\n\n if int(next(it)):\n\n if int(next(it)):\n\n return 'Y'\n\n else:\n\n return 'X'\n\n else:\n\n if int(next(it)):\n\n return '-'\n\n else:\n\n return 'Z'\n\n else:\n\n return 'R'\n\n else:\n\n if int(next(it)):\n\n if int(next(it)):\n\n if int(next(it)):\n\n return 'I'\n\n else:\n\n return 'K'\n\n else:\n\n if int(next(it)):\n\n return 'C'\n\n else:\n\n if int(next(it)):\n\n return 'F'\n\n else:\n\n if int(next(it)):\n\n return '.'\n\n else:\n\n return 'H'\n\n else:\n\n if int(next(it)):\n\n if int(next(it)):\n\n if int(next(it)):\n\n return 'T'\n\n else:\n\n return 'S'\n\n else:\n\n if int(next(it)):\n\n return 'O'\n\n else:\n\n return 'L'\n\n else:\n\n if int(next(it)):\n\n return 'D'\n\n else:\n\n if int(next(it)):\n\n if int(next(it)):\n\n return ','\n\n else:\n\n return 'W'\n\n else:\n\n if int(next(it)):\n\n return '?'\n\n else:\n\n return \"'\"\n\n\n\n\n\ndef main():\n\n for line in stdin:\n\n it = iter(''.join(code_table[c] for c in line.rstrip('\\r\\n')))\n\n try:\n\n while 1:\n\n print(decrypt(it), end='')\n\n except StopIteration:\n\n print()\n\n exit()\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","target":"#!\/usr\/bin\/env python\n\n\n\nfrom sys import stdin, exit\n\n\n\n\n\ncode_table = {chr(65+i): '{:05b}'.format(i) for i in range(26)}\n\ncode_table.update({' ': '11010', '.': '11011', ',': '11100', '-': '11101',\n\n \"'\": '11110', '?': '11111'})\n\n\n\ndecrypt = {\n\n '101': ' ', '000000': \"'\", '000011': ',', '10010001': '-',\n\n '010001': '.', '000001': '?', '100101': 'A', '10011010': 'B',\n\n '0101': 'C', '0001': 'D', '110': 'E', '01001': 'F',\n\n '10011011': 'G', '010000': 'H', '0111': 'I', '10011000': 'J',\n\n '0110': 'K', '00100': 'L', '10011001': 'M', '10011110': 'N',\n\n '00101': 'O', '111': 'P', '10011111': 'Q', '1000': 'R',\n\n '00110': 'S', '00111': 'T', '10011100': 'U', '10011101': 'V',\n\n '000010': 'W', '10010010': 'X', '10010011': 'Y', '10010000': 'Z'}\n\n\n\n\n\ndef main():\n\n for line in stdin:\n\n buf = ''\n\n for c in ''.join(code_table[c] for c in line.rstrip('\\r\\n')):\n\n buf += c\n\n plain = decrypt.get(buf)\n\n if plain:\n\n print(plain, end='')\n\n buf = ''\n\n print()\n\n exit()\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":120,"code_v1_loc":35,"code_v0_num_chars":3990,"code_v1_num_chars":1178,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python\nfrom sys import stdin, exit\n\ncode_table = {chr(65 + i): \"{:05b}\".format(i) for i in range(26)}\ncode_table.update(\n {\" \": \"11010\", \".\": \"11011\", \",\": \"11100\", \"-\": \"11101\", \"'\": \"11110\", \"?\": \"11111\"}\n)\n\n\ndef decrypt(it):\n if int(next(it)):\n if int(next(it)):\n if int(next(it)):\n return \"P\"\n else:\n return \"E\"\n else:\n if int(next(it)):\n return \" \"\n else:\n if int(next(it)):\n if int(next(it)):\n if int(next(it)):\n if int(next(it)):\n if int(next(it)):\n return \"Q\"\n else:\n return \"N\"\n else:\n if int(next(it)):\n return \"V\"\n else:\n return \"U\"\n else:\n if int(next(it)):\n if int(next(it)):\n return \"G\"\n else:\n return \"B\"\n else:\n if int(next(it)):\n return \"M\"\n else:\n return \"J\"\n else:\n if int(next(it)):\n return \"A\"\n else:\n if int(next(it)):\n if int(next(it)):\n return \"Y\"\n else:\n return \"X\"\n else:\n if int(next(it)):\n return \"-\"\n else:\n return \"Z\"\n else:\n return \"R\"\n else:\n if int(next(it)):\n if int(next(it)):\n if int(next(it)):\n return \"I\"\n else:\n return \"K\"\n else:\n if int(next(it)):\n return \"C\"\n else:\n if int(next(it)):\n return \"F\"\n else:\n if int(next(it)):\n return \".\"\n else:\n return \"H\"\n else:\n if int(next(it)):\n if int(next(it)):\n if int(next(it)):\n return \"T\"\n else:\n return \"S\"\n else:\n if int(next(it)):\n return \"O\"\n else:\n return \"L\"\n else:\n if int(next(it)):\n return \"D\"\n else:\n if int(next(it)):\n if int(next(it)):\n return \",\"\n else:\n return \"W\"\n else:\n if int(next(it)):\n return \"?\"\n else:\n return \"'\"\n\n\ndef main():\n for line in stdin:\n it = iter(\"\".join(code_table[c] for c in line.rstrip(\"\\r\\n\")))\n try:\n while 1:\n print(decrypt(it), end=\"\")\n except StopIteration:\n print()\n exit()\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python\nfrom sys import stdin, exit\n\ncode_table = {chr(65 + i): \"{:05b}\".format(i) for i in range(26)}\ncode_table.update(\n {\" \": \"11010\", \".\": \"11011\", \",\": \"11100\", \"-\": \"11101\", \"'\": \"11110\", \"?\": \"11111\"}\n)\ndecrypt = {\n \"101\": \" \",\n \"000000\": \"'\",\n \"000011\": \",\",\n \"10010001\": \"-\",\n \"010001\": \".\",\n \"000001\": \"?\",\n \"100101\": \"A\",\n \"10011010\": \"B\",\n \"0101\": \"C\",\n \"0001\": \"D\",\n \"110\": \"E\",\n \"01001\": \"F\",\n \"10011011\": \"G\",\n \"010000\": \"H\",\n \"0111\": \"I\",\n \"10011000\": \"J\",\n \"0110\": \"K\",\n \"00100\": \"L\",\n \"10011001\": \"M\",\n \"10011110\": \"N\",\n \"00101\": \"O\",\n \"111\": \"P\",\n \"10011111\": \"Q\",\n \"1000\": \"R\",\n \"00110\": \"S\",\n \"00111\": \"T\",\n \"10011100\": \"U\",\n \"10011101\": \"V\",\n \"000010\": \"W\",\n \"10010010\": \"X\",\n \"10010011\": \"Y\",\n \"10010000\": \"Z\",\n}\n\n\ndef main():\n for line in stdin:\n buf = \"\"\n for c in \"\".join(code_table[c] for c in line.rstrip(\"\\r\\n\")):\n buf += c\n plain = decrypt.get(buf)\n if plain:\n print(plain, end=\"\")\n buf = \"\"\n print()\n exit()\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":70.8333333333,"diff":["-","-","-def decrypt(it):","- if int(next(it)):","- if int(next(it)):","- if int(next(it)):","- return \"P\"","- else:","- return \"E\"","- else:","- if int(next(it)):","- return \" \"","- else:","- if int(next(it)):","- if int(next(it)):","- if int(next(it)):","- if int(next(it)):","- if int(next(it)):","- return \"Q\"","- else:","- return \"N\"","- else:","- if int(next(it)):","- return \"V\"","- else:","- return \"U\"","- else:","- if int(next(it)):","- if int(next(it)):","- return \"G\"","- else:","- return \"B\"","- else:","- if int(next(it)):","- return \"M\"","- else:","- return \"J\"","- else:","- if int(next(it)):","- return \"A\"","- else:","- if int(next(it)):","- if int(next(it)):","- return \"Y\"","- else:","- return \"X\"","- else:","- if int(next(it)):","- return \"-\"","- else:","- return \"Z\"","- else:","- return \"R\"","- else:","- if int(next(it)):","- if int(next(it)):","- if int(next(it)):","- return \"I\"","- else:","- return \"K\"","- else:","- if int(next(it)):","- return \"C\"","- else:","- if int(next(it)):","- return \"F\"","- else:","- if int(next(it)):","- return \".\"","- else:","- return \"H\"","- else:","- if int(next(it)):","- if int(next(it)):","- if int(next(it)):","- return \"T\"","- else:","- return \"S\"","- else:","- if int(next(it)):","- return \"O\"","- else:","- return \"L\"","- else:","- if int(next(it)):","- return \"D\"","- else:","- if int(next(it)):","- if int(next(it)):","- return \",\"","- else:","- return \"W\"","- else:","- if int(next(it)):","- return \"?\"","- else:","- return \"'\"","+decrypt = {","+ \"101\": \" \",","+ \"000000\": \"'\",","+ \"000011\": \",\",","+ \"10010001\": \"-\",","+ \"010001\": \".\",","+ \"000001\": \"?\",","+ \"100101\": \"A\",","+ \"10011010\": \"B\",","+ \"0101\": \"C\",","+ \"0001\": \"D\",","+ \"110\": \"E\",","+ \"01001\": \"F\",","+ \"10011011\": \"G\",","+ \"010000\": \"H\",","+ \"0111\": \"I\",","+ \"10011000\": \"J\",","+ \"0110\": \"K\",","+ \"00100\": \"L\",","+ \"10011001\": \"M\",","+ \"10011110\": \"N\",","+ \"00101\": \"O\",","+ \"111\": \"P\",","+ \"10011111\": \"Q\",","+ \"1000\": \"R\",","+ \"00110\": \"S\",","+ \"00111\": \"T\",","+ \"10011100\": \"U\",","+ \"10011101\": \"V\",","+ \"000010\": \"W\",","+ \"10010010\": \"X\",","+ \"10010011\": \"Y\",","+ \"10010000\": \"Z\",","+}","- it = iter(\"\".join(code_table[c] for c in line.rstrip(\"\\r\\n\")))","- try:","- while 1:","- print(decrypt(it), end=\"\")","- except StopIteration:","- print()","+ buf = \"\"","+ for c in \"\".join(code_table[c] for c in line.rstrip(\"\\r\\n\")):","+ buf += c","+ plain = decrypt.get(buf)","+ if plain:","+ print(plain, end=\"\")","+ buf = \"\"","+ print()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0355442395,"measured_runtime_v1":0.0336113865,"runtime_lift":1.0575058982,"key":["s023376880","s611677703"]} +{"user_id":"u477977638","problem_id":"p02913","language":"python","submission_id_v0":"s727442851","submission_id_v1":"s437924903","cpu_time_v0":589,"cpu_time_v1":351,"memory_v0":48092,"memory_v1":135644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.41,"input":"import sys\n\nread = sys.stdin.buffer.read\n\ninput=lambda :sys.stdin.readline().rstrip()\n\n# inputs= sys.stdin.buffer.readlines\n\nINF=float(\"inf\")\n\nMOD=10**9+7\n\n#input = sys.stdin.buffer.readline\n\n#sys.setrecursionlimit(2147483647)\n\n#rstrip().decode('utf-8')\n\n#import math\n\n#import numpy as np\n\n#import operator\n\n#import bisect\n\n#from heapq import heapify,heappop,heappush\n\n#from math import gcd\n\n#from fractions import gcd\n\n#from collections import deque\n\n#from collections import defaultdict\n\n#from collections import Counter\n\n#from itertools import accumulate\n\n#from itertools import groupby\n\n#from itertools import permutations\n\n#from itertools import combinations\n\n#from scipy.sparse import csr_matrix\n\n#from scipy.sparse.csgraph import floyd_warshall\n\n#from scipy.sparse.csgraph import csgraph_from_dense\n\n#from scipy.sparse.csgraph import dijkstra\n\n#map(int,input().split())\n\n\n\n# Z-algorithm (O(N))\n\n# https:\/\/deve68.hatenadiary.org\/entry\/20120201\/1328109890\n\ndef Z(s):\n\n n=len(s)\n\n z=[0]*n\n\n z[0]=n\n\n L,R=0,0\n\n for i in range(1,n):\n\n if(i>=R): # \u904e\u53bb\u306e\u7d50\u679c\u304c\u5168\u304f\u4f7f\u3048\u306a\u3044\n\n L=R=i\n\n while(R= R: # \u904e\u53bb\u306e\u7d50\u679c\u304c\u5168\u304f\u4f7f\u3048\u306a\u3044\n L = R = i\n while R < n and s[R - L] == s[R]:\n R += 1\n z[i] = R - L\n elif z[i - L] < R - i: # \u904e\u53bb\u306e\u7d50\u679c\u304c\u5168\u3066\u4f7f\u3048\u308b\n z[i] = z[i - L]\n else: # \u904e\u53bb\u306e\u7d50\u679c\u304c\u4e00\u90e8\u4f7f\u3048\u308b\n L = i\n while R < n and s[R - L] == s[R]:\n R += 1\n z[i] = R - L\n return z\n\n\n# example\n# print(Z(\"abaaabaabb\")) # [10,0,1,1,4,0,1,2,0,0]\ndef main():\n n = int(eval(input()))\n s = eval(input())\n ans = 0\n for i in range(n - 1):\n z = Z(s[i:])\n k = len(z)\n for j in range(k):\n ans = max(ans, min(j, z[j]))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = input().rstrip()\n\n\ndef check(length):\n d = set()\n for i in range(n - 2 * length + 1):\n d.add(s[i : i + length])\n if s[i + length : i + 2 * length] in d:\n return True\n return False\n\n\nlo = 0\nhi = n \/\/ 2 + 1\nwhile lo + 1 < hi:\n mid = (lo + hi) \/\/ 2\n if check(mid):\n lo = mid\n else:\n hi = mid\nprint(lo)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-import sys","-","-read = sys.stdin.buffer.read","-input = lambda: sys.stdin.readline().rstrip()","-# inputs= sys.stdin.buffer.readlines","-INF = float(\"inf\")","-MOD = 10**9 + 7","-# input = sys.stdin.buffer.readline","-# sys.setrecursionlimit(2147483647)","-# rstrip().decode('utf-8')","-# import math","-# import numpy as np","-# import operator","-# import bisect","-# from heapq import heapify,heappop,heappush","-# from math import gcd","-# from fractions import gcd","-# from collections import deque","-# from collections import defaultdict","-# from collections import Counter","-# from itertools import accumulate","-# from itertools import groupby","-# from itertools import permutations","-# from itertools import combinations","-# from scipy.sparse import csr_matrix","-# from scipy.sparse.csgraph import floyd_warshall","-# from scipy.sparse.csgraph import csgraph_from_dense","-# from scipy.sparse.csgraph import dijkstra","-# map(int,input().split())","-# Z-algorithm (O(N))","-# https:\/\/deve68.hatenadiary.org\/entry\/20120201\/1328109890","-def Z(s):","- n = len(s)","- z = [0] * n","- z[0] = n","- L, R = 0, 0","- for i in range(1, n):","- if i >= R: # \u904e\u53bb\u306e\u7d50\u679c\u304c\u5168\u304f\u4f7f\u3048\u306a\u3044","- L = R = i","- while R < n and s[R - L] == s[R]:","- R += 1","- z[i] = R - L","- elif z[i - L] < R - i: # \u904e\u53bb\u306e\u7d50\u679c\u304c\u5168\u3066\u4f7f\u3048\u308b","- z[i] = z[i - L]","- else: # \u904e\u53bb\u306e\u7d50\u679c\u304c\u4e00\u90e8\u4f7f\u3048\u308b","- L = i","- while R < n and s[R - L] == s[R]:","- R += 1","- z[i] = R - L","- return z","+n = int(eval(input()))","+s = input().rstrip()","-# example","-# print(Z(\"abaaabaabb\")) # [10,0,1,1,4,0,1,2,0,0]","-def main():","- n = int(eval(input()))","- s = eval(input())","- ans = 0","- for i in range(n - 1):","- z = Z(s[i:])","- k = len(z)","- for j in range(k):","- ans = max(ans, min(j, z[j]))","- print(ans)","+def check(length):","+ d = set()","+ for i in range(n - 2 * length + 1):","+ d.add(s[i : i + length])","+ if s[i + length : i + 2 * length] in d:","+ return True","+ return False","-if __name__ == \"__main__\":","- main()","+lo = 0","+hi = n \/\/ 2 + 1","+while lo + 1 < hi:","+ mid = (lo + hi) \/\/ 2","+ if check(mid):","+ lo = mid","+ else:","+ hi = mid","+print(lo)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409006932,"measured_runtime_v1":0.0464456739,"runtime_lift":0.8806136223,"key":["s727442851","s437924903"]} +{"user_id":"u762420987","problem_id":"p03944","language":"python","submission_id_v0":"s838597764","submission_id_v1":"s321072182","cpu_time_v0":66,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.24,"input":"W, H, N = list(map(int, input().split()))\n\ngraph = [[1] * W for _ in range(H)]\n\nfor _ in range(N):\n\n x, y, a = list(map(int, input().split()))\n\n if a == 1:\n\n for i in range(H):\n\n for j in range(x):\n\n graph[i][j] = 0\n\n if a == 2:\n\n for i in range(H):\n\n for j in range(x, W):\n\n graph[i][j] = 0\n\n if a == 3:\n\n for i in range(y):\n\n for j in range(W):\n\n graph[i][j] = 0\n\n if a == 4:\n\n for i in range(y, H):\n\n for j in range(W):\n\n graph[i][j] = 0\n\nans = sum([sum(line) for line in graph])\n\nprint(ans)\n","target":"W, H, N = list(map(int, input().split()))\n\nlx, rx, uy, dy = 0, W, H, 0\n\nfor i in range(N):\n\n x, y, a = list(map(int, input().split()))\n\n if a == 1:\n\n lx = max(lx, x)\n\n if a == 2:\n\n rx = min(rx, x)\n\n if a == 3:\n\n dy = max(dy, y)\n\n if a == 4:\n\n uy = min(uy, y)\n\n# print(lx, rx, uy, dy)\n\nprint((max(0, uy - dy) * max(0, rx - lx)))\n","code_v0_loc":22,"code_v1_loc":14,"code_v0_num_chars":630,"code_v1_num_chars":357,"code_v0_no_empty_lines":"W, H, N = list(map(int, input().split()))\ngraph = [[1] * W for _ in range(H)]\nfor _ in range(N):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n for i in range(H):\n for j in range(x):\n graph[i][j] = 0\n if a == 2:\n for i in range(H):\n for j in range(x, W):\n graph[i][j] = 0\n if a == 3:\n for i in range(y):\n for j in range(W):\n graph[i][j] = 0\n if a == 4:\n for i in range(y, H):\n for j in range(W):\n graph[i][j] = 0\nans = sum([sum(line) for line in graph])\nprint(ans)\n","code_v1_no_empty_lines":"W, H, N = list(map(int, input().split()))\nlx, rx, uy, dy = 0, W, H, 0\nfor i in range(N):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n lx = max(lx, x)\n if a == 2:\n rx = min(rx, x)\n if a == 3:\n dy = max(dy, y)\n if a == 4:\n uy = min(uy, y)\n# print(lx, rx, uy, dy)\nprint((max(0, uy - dy) * max(0, rx - lx)))\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-graph = [[1] * W for _ in range(H)]","-for _ in range(N):","+lx, rx, uy, dy = 0, W, H, 0","+for i in range(N):","- for i in range(H):","- for j in range(x):","- graph[i][j] = 0","+ lx = max(lx, x)","- for i in range(H):","- for j in range(x, W):","- graph[i][j] = 0","+ rx = min(rx, x)","- for i in range(y):","- for j in range(W):","- graph[i][j] = 0","+ dy = max(dy, y)","- for i in range(y, H):","- for j in range(W):","- graph[i][j] = 0","-ans = sum([sum(line) for line in graph])","-print(ans)","+ uy = min(uy, y)","+# print(lx, rx, uy, dy)","+print((max(0, uy - dy) * max(0, rx - lx)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0843866351,"measured_runtime_v1":0.0384540043,"runtime_lift":2.194482385,"key":["s838597764","s321072182"]} +{"user_id":"u367701763","problem_id":"p02586","language":"python","submission_id_v0":"s575429455","submission_id_v1":"s512217254","cpu_time_v0":569,"cpu_time_v1":403,"memory_v0":147028,"memory_v1":140668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.17,"input":"def max2(x,y):\n\n return x if x > y else y\n\n\n\nR, L, K = list(map(int, input().split()))\n\nV = [[0]*R for _ in range(L)]\n\nfor _ in range(K):\n\n r, c, v = list(map(int, input().split()))\n\n V[c-1][r-1] = v\n\nA, B, C, D = [[0]*(R+1) for _ in range(4)]\n\nfor i in range(L):\n\n for j in range(R):\n\n A[j] = max(A[j-1], B[j-1], C[j-1], D[j-1])\n\n v = V[i][j]\n\n if v != 0:\n\n D[j], C[j], B[j] = max2(C[j] + v, D[j]), max2(B[j] + v, C[j]), max2(A[j] + v, B[j])\n\n\n\nprint((max(A[-2], B[-2], C[-2], D[-2])))","target":"import sys\n\ninput = sys.stdin.readline\n\nR, L, K = list(map(int, input().split()))\n\nV = [[0]*R for _ in range(L)]\n\nfor _ in range(K):\n\n r, c, v = list(map(int, input().split()))\n\n V[c-1][r-1] = v\n\nA, B, C, D = [[0]*(R+1) for _ in range(4)]\n\nfor i in range(L):\n\n for j in range(R):\n\n A[j] = max(A[j-1],B[j-1],C[j-1],D[j-1])\n\n v = V[i][j]\n\n if v != 0:\n\n D[j], C[j], B[j] = max(C[j]+v,D[j]), max(B[j]+v,C[j]), max(A[j]+v,B[j])\n\nprint((max(A[-2],B[-2],C[-2],D[-2])))","code_v0_loc":17,"code_v1_loc":15,"code_v0_num_chars":516,"code_v1_num_chars":488,"code_v0_no_empty_lines":"def max2(x, y):\n return x if x > y else y\n\n\nR, L, K = list(map(int, input().split()))\nV = [[0] * R for _ in range(L)]\nfor _ in range(K):\n r, c, v = list(map(int, input().split()))\n V[c - 1][r - 1] = v\nA, B, C, D = [[0] * (R + 1) for _ in range(4)]\nfor i in range(L):\n for j in range(R):\n A[j] = max(A[j - 1], B[j - 1], C[j - 1], D[j - 1])\n v = V[i][j]\n if v != 0:\n D[j], C[j], B[j] = (\n max2(C[j] + v, D[j]),\n max2(B[j] + v, C[j]),\n max2(A[j] + v, B[j]),\n )\nprint((max(A[-2], B[-2], C[-2], D[-2])))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nR, L, K = list(map(int, input().split()))\nV = [[0] * R for _ in range(L)]\nfor _ in range(K):\n r, c, v = list(map(int, input().split()))\n V[c - 1][r - 1] = v\nA, B, C, D = [[0] * (R + 1) for _ in range(4)]\nfor i in range(L):\n for j in range(R):\n A[j] = max(A[j - 1], B[j - 1], C[j - 1], D[j - 1])\n v = V[i][j]\n if v != 0:\n D[j], C[j], B[j] = (\n max(C[j] + v, D[j]),\n max(B[j] + v, C[j]),\n max(A[j] + v, B[j]),\n )\nprint((max(A[-2], B[-2], C[-2], D[-2])))\n","code_same":false,"relative_loc_diff_percent":11.7647058824,"diff":["-def max2(x, y):","- return x if x > y else y","+import sys","-","+input = sys.stdin.readline","- max2(C[j] + v, D[j]),","- max2(B[j] + v, C[j]),","- max2(A[j] + v, B[j]),","+ max(C[j] + v, D[j]),","+ max(B[j] + v, C[j]),","+ max(A[j] + v, B[j]),"],"diff_only_import_comment":false,"measured_runtime_v0":0.034951596,"measured_runtime_v1":0.0370856605,"runtime_lift":0.9424558059,"key":["s575429455","s512217254"]} +{"user_id":"u562935282","problem_id":"p03837","language":"python","submission_id_v0":"s208282968","submission_id_v1":"s408783428","cpu_time_v0":342,"cpu_time_v1":242,"memory_v0":42988,"memory_v1":42588,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.24,"input":"inf = 1000 * 1000 + 10\n\n\n\nn, m = list(map(int, input().split()))\n\n\n\ng = tuple([inf] * n for _ in range(n))\n\ne = set()\n\nfor _ in range(m):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n g[a][b] = c\n\n g[b][a] = c\n\n e.add((a, b, c))\n\n\n\nfor i in range(n):\n\n g[i][i] = 0\n\n\n\nfor k in range(n):\n\n for i in range(n):\n\n for j in range(n):\n\n g[i][j] = min(g[i][j], g[i][k] + g[k][j])\n\n\n\n# print(g)\n\n\n\nneed = set()\n\nfor a, b, c in e:\n\n for s in range(n):\n\n for t in range(n):\n\n if g[s][t] == g[s][a] + c + g[b][t]:\n\n need.add((a, b))\n\n break\n\n else:\n\n continue\n\n break\n\n# print(need)\n\nprint((m - len(need)))\n","target":"inf = 1000 * 1000 + 10\n\n\n\nn, m = list(map(int, input().split()))\n\n\n\ng = tuple([inf] * n for _ in range(n))\n\ne = set()\n\nfor _ in range(m):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n g[a][b] = c\n\n g[b][a] = c\n\n e.add((a, b, c))\n\n e.add((b, a, c))\n\n\n\nfor i in range(n):\n\n g[i][i] = 0\n\n\n\nfor k in range(n):\n\n for i in range(n):\n\n for j in range(n):\n\n g[i][j] = min(g[i][j], g[i][k] + g[k][j])\n\n\n\nres = 0\n\nfor a, b, c in e:\n\n for s in range(n):\n\n if g[s][b] == g[s][a] + c:\n\n res += 1\n\n break\n\n\n\nprint((m - res \/\/ 2))\n","code_v0_loc":36,"code_v1_loc":31,"code_v0_num_chars":718,"code_v1_num_chars":597,"code_v0_no_empty_lines":"inf = 1000 * 1000 + 10\nn, m = list(map(int, input().split()))\ng = tuple([inf] * n for _ in range(n))\ne = set()\nfor _ in range(m):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n g[a][b] = c\n g[b][a] = c\n e.add((a, b, c))\nfor i in range(n):\n g[i][i] = 0\nfor k in range(n):\n for i in range(n):\n for j in range(n):\n g[i][j] = min(g[i][j], g[i][k] + g[k][j])\n# print(g)\nneed = set()\nfor a, b, c in e:\n for s in range(n):\n for t in range(n):\n if g[s][t] == g[s][a] + c + g[b][t]:\n need.add((a, b))\n break\n else:\n continue\n break\n# print(need)\nprint((m - len(need)))\n","code_v1_no_empty_lines":"inf = 1000 * 1000 + 10\nn, m = list(map(int, input().split()))\ng = tuple([inf] * n for _ in range(n))\ne = set()\nfor _ in range(m):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n g[a][b] = c\n g[b][a] = c\n e.add((a, b, c))\n e.add((b, a, c))\nfor i in range(n):\n g[i][i] = 0\nfor k in range(n):\n for i in range(n):\n for j in range(n):\n g[i][j] = min(g[i][j], g[i][k] + g[k][j])\nres = 0\nfor a, b, c in e:\n for s in range(n):\n if g[s][b] == g[s][a] + c:\n res += 1\n break\nprint((m - res \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":13.8888888889,"diff":["+ e.add((b, a, c))","-# print(g)","-need = set()","+res = 0","- for t in range(n):","- if g[s][t] == g[s][a] + c + g[b][t]:","- need.add((a, b))","- break","- else:","- continue","- break","-# print(need)","-print((m - len(need)))","+ if g[s][b] == g[s][a] + c:","+ res += 1","+ break","+print((m - res \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370819546,"measured_runtime_v1":0.0616133405,"runtime_lift":0.6018494417,"key":["s208282968","s408783428"]} +{"user_id":"u226108478","problem_id":"p03730","language":"python","submission_id_v0":"s340981517","submission_id_v1":"s123936416","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"# -*- coding: utf-8 -*-\n\n\n\n# AtCoder Beginner Contest\n\n# Problem B\n\n\n\nif __name__ == '__main__':\n\n a, b, c = list(map(int, input().split()))\n\n count = 1\n\n\n\n while count < 10001:\n\n if ((a * count) % b) == c:\n\n print('YES')\n\n exit()\n\n\n\n count += 1\n\n\n\n print('NO')\n","target":"# -*- coding: utf-8 -*-\n\n\n\n# AtCoder Beginner Contest\n\n# Problem B\n\n\n\nif __name__ == '__main__':\n\n a, b, c = list(map(int, input().split()))\n\n count = 1\n\n\n\n while count < (b + 1):\n\n if ((a * count) % b) == c:\n\n print('YES')\n\n exit()\n\n\n\n count += 1\n\n\n\n print('NO')\n","code_v0_loc":17,"code_v1_loc":17,"code_v0_num_chars":304,"code_v1_num_chars":306,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n# AtCoder Beginner Contest\n# Problem B\nif __name__ == \"__main__\":\n a, b, c = list(map(int, input().split()))\n count = 1\n while count < 10001:\n if ((a * count) % b) == c:\n print(\"YES\")\n exit()\n count += 1\n print(\"NO\")\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n# AtCoder Beginner Contest\n# Problem B\nif __name__ == \"__main__\":\n a, b, c = list(map(int, input().split()))\n count = 1\n while count < (b + 1):\n if ((a * count) % b) == c:\n print(\"YES\")\n exit()\n count += 1\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- while count < 10001:","+ while count < (b + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0396071248,"measured_runtime_v1":0.0362052704,"runtime_lift":1.093960197,"key":["s340981517","s123936416"]} +{"user_id":"u707124227","problem_id":"p02727","language":"python","submission_id_v0":"s495507083","submission_id_v1":"s085586931","cpu_time_v0":582,"cpu_time_v1":237,"memory_v0":52788,"memory_v1":23328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.28,"input":"x,y,a,b,c=list(map(int,input().split()))\n\np=list([['red',int(x)] for x in input().split()])\n\nq=list([['green',int(x)] for x in input().split()])\n\nr=list([['nan',int(x)] for x in input().split()])\n\np.sort(key=lambda x:x[1])\n\np=p[-x:]\n\nq.sort(key=lambda x:x[1])\n\nq=q[-y:]\n\np[len(p):len(p)]=q\n\np[len(p):len(p)]=r\n\np.sort(key=lambda x:x[1])\n\np=p[-x-y:]\n\nprint((sum([pi[1] for pi in p])))\n\n \n","target":"x,y,a,b,c=list(map(int,input().split()))\n\np=list(map(int,input().split()))\n\nq=list(map(int,input().split()))\n\nr=list(map(int,input().split()))\n\np.sort()\n\np=p[-x:]\n\nq.sort()\n\nq=q[-y:]\n\np[len(p):len(p)]=q\n\np[len(p):len(p)]=r\n\np.sort()\n\np=p[-x-y:]\n\nprint((sum(p)))","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":389,"code_v1_num_chars":253,"code_v0_no_empty_lines":"x, y, a, b, c = list(map(int, input().split()))\np = list([[\"red\", int(x)] for x in input().split()])\nq = list([[\"green\", int(x)] for x in input().split()])\nr = list([[\"nan\", int(x)] for x in input().split()])\np.sort(key=lambda x: x[1])\np = p[-x:]\nq.sort(key=lambda x: x[1])\nq = q[-y:]\np[len(p) : len(p)] = q\np[len(p) : len(p)] = r\np.sort(key=lambda x: x[1])\np = p[-x - y :]\nprint((sum([pi[1] for pi in p])))\n","code_v1_no_empty_lines":"x, y, a, b, c = list(map(int, input().split()))\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\np.sort()\np = p[-x:]\nq.sort()\nq = q[-y:]\np[len(p) : len(p)] = q\np[len(p) : len(p)] = r\np.sort()\np = p[-x - y :]\nprint((sum(p)))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-p = list([[\"red\", int(x)] for x in input().split()])","-q = list([[\"green\", int(x)] for x in input().split()])","-r = list([[\"nan\", int(x)] for x in input().split()])","-p.sort(key=lambda x: x[1])","+p = list(map(int, input().split()))","+q = list(map(int, input().split()))","+r = list(map(int, input().split()))","+p.sort()","-q.sort(key=lambda x: x[1])","+q.sort()","-p.sort(key=lambda x: x[1])","+p.sort()","-print((sum([pi[1] for pi in p])))","+print((sum(p)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0930426426,"measured_runtime_v1":0.0846332076,"runtime_lift":1.0993633027,"key":["s495507083","s085586931"]} +{"user_id":"u450956662","problem_id":"p03409","language":"python","submission_id_v0":"s912252668","submission_id_v1":"s468789013","cpu_time_v0":21,"cpu_time_v1":19,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.52,"input":"N = int(eval(input()))\n\nR = [(-1, -1)] * N\n\nfor n in range(N):\n\n x, y = list(map(int, input().split()))\n\n R[n] = (x, y)\n\nB = [(-1, -1)] * N\n\nfor n in range(N):\n\n x, y = list(map(int, input().split()))\n\n B[n] = (x, y)\n\n\n\nB = sorted(B)\n\nR = sorted(R, reverse=True)\n\n\n\nans = 0\n\nfor i, b in enumerate(B):\n\n tmp = []\n\n for j, r in enumerate(R):\n\n if r[0] == -1:\n\n continue\n\n if r[0] < b[0] and r[1] < b[1]:\n\n tmp.append((j, r))\n\n if tmp:\n\n tmp = sorted(tmp, key=lambda x: x[1][1], reverse=True)\n\n R[tmp[0][0]] = (-1, -1)\n\n ans += 1\n\n\n\nprint(ans)","target":"N = int(eval(input()))\n\nR = [tuple(map(int, input().split())) for _ in range(N)]\n\nB = [tuple(map(int, input().split())) for _ in range(N)]\n\nR = sorted(R)\n\nB = sorted(B)\n\n\n\nres = 0\n\nfor bx, by in B:\n\n idx = -1\n\n tmp = -1\n\n for i, (rx, ry) in enumerate(R):\n\n if rx < bx and ry < by:\n\n if ry >= tmp:\n\n tmp = ry\n\n idx = i\n\n if idx != -1:\n\n R.pop(idx)\n\n res += 1\n\nprint(res)","code_v0_loc":27,"code_v1_loc":19,"code_v0_num_chars":600,"code_v1_num_chars":437,"code_v0_no_empty_lines":"N = int(eval(input()))\nR = [(-1, -1)] * N\nfor n in range(N):\n x, y = list(map(int, input().split()))\n R[n] = (x, y)\nB = [(-1, -1)] * N\nfor n in range(N):\n x, y = list(map(int, input().split()))\n B[n] = (x, y)\nB = sorted(B)\nR = sorted(R, reverse=True)\nans = 0\nfor i, b in enumerate(B):\n tmp = []\n for j, r in enumerate(R):\n if r[0] == -1:\n continue\n if r[0] < b[0] and r[1] < b[1]:\n tmp.append((j, r))\n if tmp:\n tmp = sorted(tmp, key=lambda x: x[1][1], reverse=True)\n R[tmp[0][0]] = (-1, -1)\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nR = [tuple(map(int, input().split())) for _ in range(N)]\nB = [tuple(map(int, input().split())) for _ in range(N)]\nR = sorted(R)\nB = sorted(B)\nres = 0\nfor bx, by in B:\n idx = -1\n tmp = -1\n for i, (rx, ry) in enumerate(R):\n if rx < bx and ry < by:\n if ry >= tmp:\n tmp = ry\n idx = i\n if idx != -1:\n R.pop(idx)\n res += 1\nprint(res)\n","code_same":false,"relative_loc_diff_percent":29.6296296296,"diff":["-R = [(-1, -1)] * N","-for n in range(N):","- x, y = list(map(int, input().split()))","- R[n] = (x, y)","-B = [(-1, -1)] * N","-for n in range(N):","- x, y = list(map(int, input().split()))","- B[n] = (x, y)","+R = [tuple(map(int, input().split())) for _ in range(N)]","+B = [tuple(map(int, input().split())) for _ in range(N)]","+R = sorted(R)","-R = sorted(R, reverse=True)","-ans = 0","-for i, b in enumerate(B):","- tmp = []","- for j, r in enumerate(R):","- if r[0] == -1:","- continue","- if r[0] < b[0] and r[1] < b[1]:","- tmp.append((j, r))","- if tmp:","- tmp = sorted(tmp, key=lambda x: x[1][1], reverse=True)","- R[tmp[0][0]] = (-1, -1)","- ans += 1","-print(ans)","+res = 0","+for bx, by in B:","+ idx = -1","+ tmp = -1","+ for i, (rx, ry) in enumerate(R):","+ if rx < bx and ry < by:","+ if ry >= tmp:","+ tmp = ry","+ idx = i","+ if idx != -1:","+ R.pop(idx)","+ res += 1","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372015301,"measured_runtime_v1":0.0371482248,"runtime_lift":1.0014349353,"key":["s912252668","s468789013"]} +{"user_id":"u673559119","problem_id":"p03078","language":"python","submission_id_v0":"s972335506","submission_id_v1":"s653415692","cpu_time_v0":763,"cpu_time_v1":119,"memory_v0":138384,"memory_v1":8708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.4,"input":"#conding utf-8\n\nx,y,z,k=list(map(int,input().split()))\n\na=list(map(int,input().split())) \n\nb=list(map(int,input().split())) \n\nc=list(map(int,input().split())) \n\n\n\nab=[]\n\nans=[]\n\nfor i in range(len(a)):\n\n for j in range(len(b)):\n\n ab.append(a[i]+b[j])\n\n \n\nab.sort()\n\nab.reverse()\n\ndel ab[k:]\n\n\n\nc.sort()\n\nc.reverse()\n\n\n\nfor i in range(len(ab)):\n\n for j in range(len(c)):\n\n ans.append(ab[i]+c[j])\n\n \n\nans.sort()\n\nans.reverse()\n\n\n\nfor i in range(k):\n\n print((ans[i]))","target":"#conding utf-8\n\nx,y,z,K=list(map(int,input().split()))\n\na=list(map(int,input().split())) \n\nb=list(map(int,input().split())) \n\nc=list(map(int,input().split())) \n\n\n\na.sort()\n\nb.sort()\n\nc.sort()\n\na.reverse()\n\nb.reverse()\n\nc.reverse()\n\n\n\nans=[]\n\n\n\nfor i in range(len(a)):\n\n for j in range(len(b)):\n\n if (i+1)*(j+1)>K:\n\n break\n\n for k in range(len(c)):\n\n if (i+1)*(j+1)*(k+1)>K:\n\n break\n\n ans.append(a[i]+b[j]+c[k])\n\n \n\nans.sort()\n\nans.reverse()\n\n\n\nfor i in range(K):\n\n print((ans[i]))","code_v0_loc":28,"code_v1_loc":29,"code_v0_num_chars":471,"code_v1_num_chars":505,"code_v0_no_empty_lines":"# conding utf-8\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\nab = []\nans = []\nfor i in range(len(a)):\n for j in range(len(b)):\n ab.append(a[i] + b[j])\nab.sort()\nab.reverse()\ndel ab[k:]\nc.sort()\nc.reverse()\nfor i in range(len(ab)):\n for j in range(len(c)):\n ans.append(ab[i] + c[j])\nans.sort()\nans.reverse()\nfor i in range(k):\n print((ans[i]))\n","code_v1_no_empty_lines":"# conding utf-8\nx, y, z, K = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort()\nb.sort()\nc.sort()\na.reverse()\nb.reverse()\nc.reverse()\nans = []\nfor i in range(len(a)):\n for j in range(len(b)):\n if (i + 1) * (j + 1) > K:\n break\n for k in range(len(c)):\n if (i + 1) * (j + 1) * (k + 1) > K:\n break\n ans.append(a[i] + b[j] + c[k])\nans.sort()\nans.reverse()\nfor i in range(K):\n print((ans[i]))\n","code_same":false,"relative_loc_diff_percent":3.4482758621,"diff":["-x, y, z, k = list(map(int, input().split()))","+x, y, z, K = list(map(int, input().split()))","-ab = []","+a.sort()","+b.sort()","+c.sort()","+a.reverse()","+b.reverse()","+c.reverse()","- ab.append(a[i] + b[j])","-ab.sort()","-ab.reverse()","-del ab[k:]","-c.sort()","-c.reverse()","-for i in range(len(ab)):","- for j in range(len(c)):","- ans.append(ab[i] + c[j])","+ if (i + 1) * (j + 1) > K:","+ break","+ for k in range(len(c)):","+ if (i + 1) * (j + 1) * (k + 1) > K:","+ break","+ ans.append(a[i] + b[j] + c[k])","-for i in range(k):","+for i in range(K):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0724503388,"measured_runtime_v1":0.1041904037,"runtime_lift":0.6953647962,"key":["s972335506","s653415692"]} +{"user_id":"u411923565","problem_id":"p02572","language":"python","submission_id_v0":"s531924124","submission_id_v1":"s105979348","cpu_time_v0":167,"cpu_time_v1":129,"memory_v0":31436,"memory_v1":104992,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.75,"input":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nA_sum = sum(A[1:])\n\n\n\ntot = 0\n\nfor i in range(N-1):\n\n tot += (A[i]*A_sum)%(10**9+7)\n\n tot = tot%(10**9+7)\n\n A_sum -= A[i+1]\n\n \n\nprint(tot)","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\ns = [0]*(N+1)\n\nfor i in range(N):\n\n s[i+1] = s[i] + A[i]\n\n \n\ncnt = 0\n\nfor j in range(N):\n\n cnt = (cnt + (A[j]*(s[N] - s[j+1])))%(10**9+7)\n\nprint(cnt)","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":204,"code_v1_num_chars":215,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nA_sum = sum(A[1:])\ntot = 0\nfor i in range(N - 1):\n tot += (A[i] * A_sum) % (10**9 + 7)\n tot = tot % (10**9 + 7)\n A_sum -= A[i + 1]\nprint(tot)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\ns = [0] * (N + 1)\nfor i in range(N):\n s[i + 1] = s[i] + A[i]\ncnt = 0\nfor j in range(N):\n cnt = (cnt + (A[j] * (s[N] - s[j + 1]))) % (10**9 + 7)\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-A_sum = sum(A[1:])","-tot = 0","-for i in range(N - 1):","- tot += (A[i] * A_sum) % (10**9 + 7)","- tot = tot % (10**9 + 7)","- A_sum -= A[i + 1]","-print(tot)","+s = [0] * (N + 1)","+for i in range(N):","+ s[i + 1] = s[i] + A[i]","+cnt = 0","+for j in range(N):","+ cnt = (cnt + (A[j] * (s[N] - s[j + 1]))) % (10**9 + 7)","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0318854742,"measured_runtime_v1":0.0354386689,"runtime_lift":0.8997367903,"key":["s531924124","s105979348"]} +{"user_id":"u054556734","problem_id":"p02665","language":"python","submission_id_v0":"s755917141","submission_id_v1":"s980276690","cpu_time_v0":283,"cpu_time_v1":259,"memory_v0":49172,"memory_v1":49172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.48,"input":"import numpy as np\n\nimport scipy.sparse as sps\n\nimport scipy.misc as spm\n\nimport collections as col\n\nimport functools as func\n\nimport itertools as ite\n\nimport fractions as frac\n\nimport math as ma\n\nimport cmath as cma\n\nimport copy as cp\n\nimport sys\n\ndef sinput(): return sys.stdin.readline().strip()\n\ndef iinput(): return int(sinput())\n\ndef imap(): return list(map(int, sinput().split()))\n\ndef fmap(): return list(map(float, sinput().split()))\n\ndef iarr(n=0):\n\n if n: return [0 for _ in range(n)]\n\n else: return list(map())\n\ndef farr(): return list(fmap())\n\ndef sarr(n=0):\n\n if n: return [\"\" for _ in range(n)]\n\n else: return sinput().split()\n\nsys.setrecursionlimit(10**7)\n\nMOD = 10**9 + 7; EPS = sys.float_info.epsilon\n\nPI = np.pi; EXP = np.e; INF = np.inf\n\n\n\nn = iinput()\n\na = iarr()\n\n\n\ncum = []; sum = 0\n\nfor num in a: sum += num; cum.append(sum)\n\n\n\nans = 1\n\nnow = 1\n\nfor i in range(n+1):\n\n next = min(2*(now - a[i]), cum[n]-cum[i])\n\n now = next\n\n if n==i and next<0 : ans = -1; break\n\n if n!=i and next<=0 : ans = -1; break\n\n ans += next\n\n\n\nif a[n] > 2**n: ans = -1\n\nprint(ans)\n\n\n","target":"import numpy as np\n\nimport scipy.sparse as sps\n\nimport scipy.misc as spm\n\nimport collections as col\n\nimport functools as func\n\nimport itertools as ite\n\nimport fractions as frac\n\nimport math as ma\n\nimport cmath as cma\n\nimport copy as cp\n\nimport sys\n\ndef sinput(): return sys.stdin.readline().strip()\n\ndef iinput(): return int(sinput())\n\ndef imap(): return list(map(int, sinput().split()))\n\ndef fmap(): return list(map(float, sinput().split()))\n\ndef iarr(n=0):\n\n if n: return [0 for _ in range(n)]\n\n else: return list(map())\n\ndef farr(): return list(fmap())\n\ndef sarr(n=0):\n\n if n: return [\"\" for _ in range(n)]\n\n else: return sinput().split()\n\nsys.setrecursionlimit(10**7)\n\nMOD = 10**9 + 7; EPS = sys.float_info.epsilon\n\nPI = np.pi; EXP = np.e; INF = np.inf\n\n\n\nn = iinput()\n\na = iarr()\n\n\n\ncum = []; sum = 0\n\nfor num in a: sum += num; cum.append(sum)\n\n\n\nans = 1\n\nnow = 1\n\nfor i in range(n+1):\n\n next = min(2*(now - a[i]), cum[n]-cum[i])\n\n now = next\n\n if n==i and next<0 : ans = -1; break\n\n if n!=i and next<=0 : ans = -1; break\n\n ans += next\n\n\n\n#if a[n] > 2**n: ans = -1\n\nprint(ans)\n\n\n","code_v0_loc":44,"code_v1_loc":44,"code_v0_num_chars":1099,"code_v1_num_chars":1100,"code_v0_no_empty_lines":"import numpy as np\nimport scipy.sparse as sps\nimport scipy.misc as spm\nimport collections as col\nimport functools as func\nimport itertools as ite\nimport fractions as frac\nimport math as ma\nimport cmath as cma\nimport copy as cp\nimport sys\n\n\ndef sinput():\n return sys.stdin.readline().strip()\n\n\ndef iinput():\n return int(sinput())\n\n\ndef imap():\n return list(map(int, sinput().split()))\n\n\ndef fmap():\n return list(map(float, sinput().split()))\n\n\ndef iarr(n=0):\n if n:\n return [0 for _ in range(n)]\n else:\n return list(map())\n\n\ndef farr():\n return list(fmap())\n\n\ndef sarr(n=0):\n if n:\n return [\"\" for _ in range(n)]\n else:\n return sinput().split()\n\n\nsys.setrecursionlimit(10**7)\nMOD = 10**9 + 7\nEPS = sys.float_info.epsilon\nPI = np.pi\nEXP = np.e\nINF = np.inf\nn = iinput()\na = iarr()\ncum = []\nsum = 0\nfor num in a:\n sum += num\n cum.append(sum)\nans = 1\nnow = 1\nfor i in range(n + 1):\n next = min(2 * (now - a[i]), cum[n] - cum[i])\n now = next\n if n == i and next < 0:\n ans = -1\n break\n if n != i and next <= 0:\n ans = -1\n break\n ans += next\nif a[n] > 2**n:\n ans = -1\nprint(ans)\n","code_v1_no_empty_lines":"import numpy as np\nimport scipy.sparse as sps\nimport scipy.misc as spm\nimport collections as col\nimport functools as func\nimport itertools as ite\nimport fractions as frac\nimport math as ma\nimport cmath as cma\nimport copy as cp\nimport sys\n\n\ndef sinput():\n return sys.stdin.readline().strip()\n\n\ndef iinput():\n return int(sinput())\n\n\ndef imap():\n return list(map(int, sinput().split()))\n\n\ndef fmap():\n return list(map(float, sinput().split()))\n\n\ndef iarr(n=0):\n if n:\n return [0 for _ in range(n)]\n else:\n return list(map())\n\n\ndef farr():\n return list(fmap())\n\n\ndef sarr(n=0):\n if n:\n return [\"\" for _ in range(n)]\n else:\n return sinput().split()\n\n\nsys.setrecursionlimit(10**7)\nMOD = 10**9 + 7\nEPS = sys.float_info.epsilon\nPI = np.pi\nEXP = np.e\nINF = np.inf\nn = iinput()\na = iarr()\ncum = []\nsum = 0\nfor num in a:\n sum += num\n cum.append(sum)\nans = 1\nnow = 1\nfor i in range(n + 1):\n next = min(2 * (now - a[i]), cum[n] - cum[i])\n now = next\n if n == i and next < 0:\n ans = -1\n break\n if n != i and next <= 0:\n ans = -1\n break\n ans += next\n# if a[n] > 2**n: ans = -1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-if a[n] > 2**n:","- ans = -1","+# if a[n] > 2**n: ans = -1"],"diff_only_import_comment":false,"measured_runtime_v0":0.6923606129,"measured_runtime_v1":0.2552854394,"runtime_lift":2.7121038102,"key":["s755917141","s980276690"]} +{"user_id":"u645250356","problem_id":"p03673","language":"python","submission_id_v0":"s707036126","submission_id_v1":"s268952853","cpu_time_v0":574,"cpu_time_v1":421,"memory_v0":87424,"memory_v1":87124,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.66,"input":"from collections import Counter,defaultdict,deque\n\nimport sys,heapq,bisect,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn = inp()\n\na = inpl()\n\nif n%2:\n\n for i in range(n)[::-2]:\n\n print(a[i],end=' ')\n\n for i in range(1,n)[::2]:\n\n print(a[i],end=' ')\n\n print()\n\nelse:\n\n for i in range(n)[::-2]:\n\n print(a[i],end=' ')\n\n for i in range(n)[::2]:\n\n print(a[i],end=' ')\n\n print()\n\n \n","target":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nmod2 = 998244353\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\nn = inp()\n\na = inpl()\n\nfor i in range(n-1,-1,-2):\n\n print((a[i]))\n\nif n%2:\n\n j = 1\n\nelse:\n\n j = 0\n\nfor i in range(j,n,2):\n\n print((a[i]))","code_v0_loc":24,"code_v1_loc":21,"code_v0_num_chars":697,"code_v1_num_chars":541,"code_v0_no_empty_lines":"from collections import Counter, defaultdict, deque\nimport sys, heapq, bisect, math, itertools, string, queue\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef inpl_str():\n return list(sys.stdin.readline().split())\n\n\ndef inpln(n):\n return list(int(sys.stdin.readline()) for i in range(n))\n\n\nn = inp()\na = inpl()\nif n % 2:\n for i in range(n)[::-2]:\n print(a[i], end=\" \")\n for i in range(1, n)[::2]:\n print(a[i], end=\" \")\n print()\nelse:\n for i in range(n)[::-2]:\n print(a[i], end=\" \")\n for i in range(n)[::2]:\n print(a[i], end=\" \")\n print()\n","code_v1_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nmod2 = 998244353\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef inpln(n):\n return list(int(sys.stdin.readline()) for i in range(n))\n\n\nn = inp()\na = inpl()\nfor i in range(n - 1, -1, -2):\n print((a[i]))\nif n % 2:\n j = 1\nelse:\n j = 0\nfor i in range(j, n, 2):\n print((a[i]))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import sys, heapq, bisect, math, itertools, string, queue","+from heapq import heappop, heappush, heapify","+import sys, bisect, math, itertools","+mod2 = 998244353","+INF = float(\"inf\")","-def inpl_str():","- return list(sys.stdin.readline().split())","-","-","+for i in range(n - 1, -1, -2):","+ print((a[i]))","- for i in range(n)[::-2]:","- print(a[i], end=\" \")","- for i in range(1, n)[::2]:","- print(a[i], end=\" \")","- print()","+ j = 1","- for i in range(n)[::-2]:","- print(a[i], end=\" \")","- for i in range(n)[::2]:","- print(a[i], end=\" \")","- print()","+ j = 0","+for i in range(j, n, 2):","+ print((a[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0382684231,"measured_runtime_v1":0.0398153782,"runtime_lift":0.9611467933,"key":["s707036126","s268952853"]} +{"user_id":"u606045429","problem_id":"p03240","language":"python","submission_id_v0":"s916133580","submission_id_v1":"s911262103","cpu_time_v0":32,"cpu_time_v1":26,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.75,"input":"N = int(eval(input()))\n\nL = [tuple(map(int, input().split())) for _ in range(N)]\n\n\n\nxx, yy, hh = next(l for l in L if l[2] >= 1)\n\nfor Cx in range(101):\n\n for Cy in range(101):\n\n H = hh + abs(xx - Cx) + abs(yy - Cy)\n\n for x, y, h in L:\n\n if h != max(H - abs(x - Cx) - abs(y - Cy), 0):\n\n break\n\n else:\n\n print((Cx, Cy, H))\n\n quit()","target":"def main():\n\n N = int(eval(input()))\n\n L = [tuple(map(int, input().split())) for _ in range(N)]\n\n xx, yy, hh = next(l for l in L if l[2] >= 1)\n\n for Cx in range(101):\n\n for Cy in range(101):\n\n H = hh + abs(xx - Cx) + abs(yy - Cy)\n\n for x, y, h in L:\n\n if h != max(H - abs(x - Cx) - abs(y - Cy), 0):\n\n break\n\n else:\n\n print((Cx, Cy, H))\n\n quit()\n\n\n\nmain()","code_v0_loc":13,"code_v1_loc":15,"code_v0_num_chars":393,"code_v1_num_chars":462,"code_v0_no_empty_lines":"N = int(eval(input()))\nL = [tuple(map(int, input().split())) for _ in range(N)]\nxx, yy, hh = next(l for l in L if l[2] >= 1)\nfor Cx in range(101):\n for Cy in range(101):\n H = hh + abs(xx - Cx) + abs(yy - Cy)\n for x, y, h in L:\n if h != max(H - abs(x - Cx) - abs(y - Cy), 0):\n break\n else:\n print((Cx, Cy, H))\n quit()\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n L = [tuple(map(int, input().split())) for _ in range(N)]\n xx, yy, hh = next(l for l in L if l[2] >= 1)\n for Cx in range(101):\n for Cy in range(101):\n H = hh + abs(xx - Cx) + abs(yy - Cy)\n for x, y, h in L:\n if h != max(H - abs(x - Cx) - abs(y - Cy), 0):\n break\n else:\n print((Cx, Cy, H))\n quit()\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-N = int(eval(input()))","-L = [tuple(map(int, input().split())) for _ in range(N)]","-xx, yy, hh = next(l for l in L if l[2] >= 1)","-for Cx in range(101):","- for Cy in range(101):","- H = hh + abs(xx - Cx) + abs(yy - Cy)","- for x, y, h in L:","- if h != max(H - abs(x - Cx) - abs(y - Cy), 0):","- break","- else:","- print((Cx, Cy, H))","- quit()","+def main():","+ N = int(eval(input()))","+ L = [tuple(map(int, input().split())) for _ in range(N)]","+ xx, yy, hh = next(l for l in L if l[2] >= 1)","+ for Cx in range(101):","+ for Cy in range(101):","+ H = hh + abs(xx - Cx) + abs(yy - Cy)","+ for x, y, h in L:","+ if h != max(H - abs(x - Cx) - abs(y - Cy), 0):","+ break","+ else:","+ print((Cx, Cy, H))","+ quit()","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0499783382,"measured_runtime_v1":0.0504693165,"runtime_lift":0.9902717476,"key":["s916133580","s911262103"]} +{"user_id":"u932291797","problem_id":"p02660","language":"python","submission_id_v0":"s821876826","submission_id_v1":"s999146810","cpu_time_v0":420,"cpu_time_v1":274,"memory_v0":9212,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.76,"input":"n = int(eval(input()))\n\nif n == 1:\n\n print((0))\n\n exit()\n\nF = {}\n\ntmp = n\n\ni = 2\n\nwhile i**2 <= tmp:\n\n cnt = 0\n\n while tmp % i == 0:\n\n cnt += 1\n\n tmp \/\/= i\n\n if cnt > 0:\n\n F[i] = cnt\n\n i += 1\n\nif tmp != 1 or F == {}:\n\n F[tmp] = 1\n\nans = 0\n\nfor p in F:\n\n a = 1\n\n while F[p] >= a:\n\n F[p] -= a\n\n ans += 1\n\n a += 1\n\nprint(ans)","target":"n = int(eval(input()))\n\n\n\nans = 0\n\n\n\ni = 2\n\nnum = n\n\nwhile i * i <= n:\n\n cnta = 0\n\n cntb = 0\n\n while num % i == 0:\n\n num \/\/= i\n\n if cnta == cntb:\n\n ans += 1\n\n cnta = 0\n\n cntb += 1\n\n else:\n\n cnta += 1\n\n i += 1\n\n \n\nif (ans == 0 and n != 1) or num != 1:\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":25,"code_v1_loc":22,"code_v0_num_chars":383,"code_v1_num_chars":303,"code_v0_no_empty_lines":"n = int(eval(input()))\nif n == 1:\n print((0))\n exit()\nF = {}\ntmp = n\ni = 2\nwhile i**2 <= tmp:\n cnt = 0\n while tmp % i == 0:\n cnt += 1\n tmp \/\/= i\n if cnt > 0:\n F[i] = cnt\n i += 1\nif tmp != 1 or F == {}:\n F[tmp] = 1\nans = 0\nfor p in F:\n a = 1\n while F[p] >= a:\n F[p] -= a\n ans += 1\n a += 1\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = 0\ni = 2\nnum = n\nwhile i * i <= n:\n cnta = 0\n cntb = 0\n while num % i == 0:\n num \/\/= i\n if cnta == cntb:\n ans += 1\n cnta = 0\n cntb += 1\n else:\n cnta += 1\n i += 1\nif (ans == 0 and n != 1) or num != 1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["-if n == 1:","- print((0))","- exit()","-F = {}","-tmp = n","+ans = 0","-while i**2 <= tmp:","- cnt = 0","- while tmp % i == 0:","- cnt += 1","- tmp \/\/= i","- if cnt > 0:","- F[i] = cnt","+num = n","+while i * i <= n:","+ cnta = 0","+ cntb = 0","+ while num % i == 0:","+ num \/\/= i","+ if cnta == cntb:","+ ans += 1","+ cnta = 0","+ cntb += 1","+ else:","+ cnta += 1","-if tmp != 1 or F == {}:","- F[tmp] = 1","-ans = 0","-for p in F:","- a = 1","- while F[p] >= a:","- F[p] -= a","- ans += 1","- a += 1","+if (ans == 0 and n != 1) or num != 1:","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.106020235,"measured_runtime_v1":0.0803492325,"runtime_lift":1.3194928147,"key":["s821876826","s999146810"]} +{"user_id":"u893063840","problem_id":"p03164","language":"python","submission_id_v0":"s651824085","submission_id_v1":"s564689266","cpu_time_v0":202,"cpu_time_v1":184,"memory_v0":29080,"memory_v1":29096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.91,"input":"import numpy as np\n\n\n\nN, W = list(map(int, input().split()))\n\nwv = [list(map(int, input().split())) for _ in range(N)]\n\nINF = 10 ** 18\n\nV_MAX = 10 ** 3 * N\n\n\n\ndp = np.full(V_MAX + 1, INF)\n\ndp[0] = 0\n\n\n\nfor w, v in wv:\n\n dp[v:] = np.minimum(dp[v:], dp[:-v] + w)\n\n\n\nans = 0\n\nfor i in range(V_MAX, -1, -1):\n\n if dp[i] <= W:\n\n ans = i\n\n break\n\n\n\nprint(ans)\n","target":"import numpy as np\n\n\n\nN, W = list(map(int, input().split()))\n\nwv = [list(map(int, input().split())) for _ in range(N)]\n\nINF = 10 ** 18\n\nV_MAX = 10 ** 3 * N\n\n\n\ndp = np.full(V_MAX + 1, INF)\n\ndp[0] = 0\n\n\n\nfor w, v in wv:\n\n dp[v:] = np.minimum(dp[v:], dp[:-v] + w)\n\n\n\nans = np.where(dp <= W)[0].max()\n\nprint(ans)\n","code_v0_loc":20,"code_v1_loc":15,"code_v0_num_chars":367,"code_v1_num_chars":306,"code_v0_no_empty_lines":"import numpy as np\n\nN, W = list(map(int, input().split()))\nwv = [list(map(int, input().split())) for _ in range(N)]\nINF = 10**18\nV_MAX = 10**3 * N\ndp = np.full(V_MAX + 1, INF)\ndp[0] = 0\nfor w, v in wv:\n dp[v:] = np.minimum(dp[v:], dp[:-v] + w)\nans = 0\nfor i in range(V_MAX, -1, -1):\n if dp[i] <= W:\n ans = i\n break\nprint(ans)\n","code_v1_no_empty_lines":"import numpy as np\n\nN, W = list(map(int, input().split()))\nwv = [list(map(int, input().split())) for _ in range(N)]\nINF = 10**18\nV_MAX = 10**3 * N\ndp = np.full(V_MAX + 1, INF)\ndp[0] = 0\nfor w, v in wv:\n dp[v:] = np.minimum(dp[v:], dp[:-v] + w)\nans = np.where(dp <= W)[0].max()\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-ans = 0","-for i in range(V_MAX, -1, -1):","- if dp[i] <= W:","- ans = i","- break","+ans = np.where(dp <= W)[0].max()"],"diff_only_import_comment":false,"measured_runtime_v0":0.3783743477,"measured_runtime_v1":0.2422925434,"runtime_lift":1.5616425596,"key":["s651824085","s564689266"]} +{"user_id":"u844646164","problem_id":"p03696","language":"python","submission_id_v0":"s668101557","submission_id_v1":"s726858126","cpu_time_v0":166,"cpu_time_v1":65,"memory_v0":38256,"memory_v1":61696,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.84,"input":"from collections import deque\n\nN = int(eval(input()))\n\nS = list(eval(input()))\n\nT = deque(S[:])\n\nins = []\n\npointer = 0\n\na = 0\n\nfor i in range(N):\n\n if S[i] == ')':\n\n if pointer >= 1:\n\n pointer -= 1\n\n else:\n\n T.appendleft('(')\n\n else:\n\n pointer += 1\n\n \n\na = 0\n\nb = 0\n\nfor t in T:\n\n if t == ')':\n\n b += 1\n\n else:\n\n a += 1\n\n\n\nfor i in range(max(a-b, 0)):\n\n T.append(')')\n\nprint((''.join(T)))\n","target":"N = int(eval(input()))\n\nS = list(eval(input()))\n\n\n\na = 0 # (\n\nb = 0 # )\n\nfor i in range(N):\n\n if S[i] == '(':\n\n a += 1\n\n else:\n\n if a > 0:\n\n a -= 1\n\n else:\n\n b += 1\n\n\n\nans = \"\".join(S)\n\nif b > 0:\n\n ans = \"(\"*b + ans\n\nif a > 0:\n\n ans = ans + \")\"*a\n\nprint(ans)\n","code_v0_loc":27,"code_v1_loc":20,"code_v0_num_chars":406,"code_v1_num_chars":270,"code_v0_no_empty_lines":"from collections import deque\n\nN = int(eval(input()))\nS = list(eval(input()))\nT = deque(S[:])\nins = []\npointer = 0\na = 0\nfor i in range(N):\n if S[i] == \")\":\n if pointer >= 1:\n pointer -= 1\n else:\n T.appendleft(\"(\")\n else:\n pointer += 1\na = 0\nb = 0\nfor t in T:\n if t == \")\":\n b += 1\n else:\n a += 1\nfor i in range(max(a - b, 0)):\n T.append(\")\")\nprint((\"\".join(T)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = list(eval(input()))\na = 0 # (\nb = 0 # )\nfor i in range(N):\n if S[i] == \"(\":\n a += 1\n else:\n if a > 0:\n a -= 1\n else:\n b += 1\nans = \"\".join(S)\nif b > 0:\n ans = \"(\" * b + ans\nif a > 0:\n ans = ans + \")\" * a\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.9259259259,"diff":["-from collections import deque","-","-T = deque(S[:])","-ins = []","-pointer = 0","-a = 0","+a = 0 # (","+b = 0 # )","- if S[i] == \")\":","- if pointer >= 1:","- pointer -= 1","+ if S[i] == \"(\":","+ a += 1","+ else:","+ if a > 0:","+ a -= 1","- T.appendleft(\"(\")","- else:","- pointer += 1","-a = 0","-b = 0","-for t in T:","- if t == \")\":","- b += 1","- else:","- a += 1","-for i in range(max(a - b, 0)):","- T.append(\")\")","-print((\"\".join(T)))","+ b += 1","+ans = \"\".join(S)","+if b > 0:","+ ans = \"(\" * b + ans","+if a > 0:","+ ans = ans + \")\" * a","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369618652,"measured_runtime_v1":0.0343576274,"runtime_lift":1.0757979518,"key":["s668101557","s726858126"]} +{"user_id":"u228223940","problem_id":"p03283","language":"python","submission_id_v0":"s625890328","submission_id_v1":"s830486805","cpu_time_v0":1953,"cpu_time_v1":1610,"memory_v0":83160,"memory_v1":82520,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.56,"input":"n,m,q = list(map(int,input().split()))\n\n\n\nlr = [[0 for i in range(n+1)] for j in range(n+1)]\n\n#lr = [[int(i) for i in input().split()]for j in range(m)]\n\n\n\nst = [0] * (n+1)\n\ned = [0] * (n+1)\n\n\n\nfor i in range(m):\n\n l,r = list(map(int,input().split()))\n\n lr[l][r] += 1\n\n\n\npq = [[int(i) for i in input().split()]for j in range(q)]\n\n\n\ndp = [[0 for i in range(n+1)] for j in range(n+1)]\n\n\n\n#print(lr)\n\n\n\nfor i in range(1,n+1):\n\n #print(i)\n\n for j in range(i,n+1):\n\n #print(i,j)\n\n dp[i][j] = dp[i][j-1]+lr[i][j]\n\n\n\nfor i in range(q):\n\n st = pq[i][0]\n\n ed = pq[i][1]\n\n tmp = 0\n\n for j in range(ed-st+1):\n\n tmp += dp[st+j][ed]\n\n print(tmp)\n\n#print(dp)","target":"n,m,q = list(map(int,input().split()))\n\n\n\nlr = [[0 for i in range(n+1)] for j in range(n+1)]\n\n\n\n\n\nfor i in range(m):\n\n l,r = list(map(int,input().split()))\n\n lr[l][r] += 1\n\n\n\npq = [[int(i) for i in input().split()]for j in range(q)]\n\n\n\ndp = [[0 for i in range(n+1)] for j in range(n+1)]\n\n\n\nfor i in range(1,n+1):\n\n for j in range(i,n+1):\n\n dp[i][j] = dp[i][j-1]+lr[i][j]\n\n\n\nans_dp = [[0 for i in range(n+1)] for j in range(n+1)]\n\n\n\nfor i in range(1,n+1):\n\n for j in range(i,n+1):\n\n tmp = 0\n\n for k in range(j-i+1):\n\n tmp += dp[i+k][j]\n\n ans_dp[i][j] = tmp\n\n\n\nfor i in range(q):\n\n print((ans_dp[pq[i][0]][pq[i][1]]))\n","code_v0_loc":32,"code_v1_loc":28,"code_v0_num_chars":680,"code_v1_num_chars":656,"code_v0_no_empty_lines":"n, m, q = list(map(int, input().split()))\nlr = [[0 for i in range(n + 1)] for j in range(n + 1)]\n# lr = [[int(i) for i in input().split()]for j in range(m)]\nst = [0] * (n + 1)\ned = [0] * (n + 1)\nfor i in range(m):\n l, r = list(map(int, input().split()))\n lr[l][r] += 1\npq = [[int(i) for i in input().split()] for j in range(q)]\ndp = [[0 for i in range(n + 1)] for j in range(n + 1)]\n# print(lr)\nfor i in range(1, n + 1):\n # print(i)\n for j in range(i, n + 1):\n # print(i,j)\n dp[i][j] = dp[i][j - 1] + lr[i][j]\nfor i in range(q):\n st = pq[i][0]\n ed = pq[i][1]\n tmp = 0\n for j in range(ed - st + 1):\n tmp += dp[st + j][ed]\n print(tmp)\n# print(dp)\n","code_v1_no_empty_lines":"n, m, q = list(map(int, input().split()))\nlr = [[0 for i in range(n + 1)] for j in range(n + 1)]\nfor i in range(m):\n l, r = list(map(int, input().split()))\n lr[l][r] += 1\npq = [[int(i) for i in input().split()] for j in range(q)]\ndp = [[0 for i in range(n + 1)] for j in range(n + 1)]\nfor i in range(1, n + 1):\n for j in range(i, n + 1):\n dp[i][j] = dp[i][j - 1] + lr[i][j]\nans_dp = [[0 for i in range(n + 1)] for j in range(n + 1)]\nfor i in range(1, n + 1):\n for j in range(i, n + 1):\n tmp = 0\n for k in range(j - i + 1):\n tmp += dp[i + k][j]\n ans_dp[i][j] = tmp\nfor i in range(q):\n print((ans_dp[pq[i][0]][pq[i][1]]))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-# lr = [[int(i) for i in input().split()]for j in range(m)]","-st = [0] * (n + 1)","-ed = [0] * (n + 1)","-# print(lr)","- # print(i)","- # print(i,j)","+ans_dp = [[0 for i in range(n + 1)] for j in range(n + 1)]","+for i in range(1, n + 1):","+ for j in range(i, n + 1):","+ tmp = 0","+ for k in range(j - i + 1):","+ tmp += dp[i + k][j]","+ ans_dp[i][j] = tmp","- st = pq[i][0]","- ed = pq[i][1]","- tmp = 0","- for j in range(ed - st + 1):","- tmp += dp[st + j][ed]","- print(tmp)","-# print(dp)","+ print((ans_dp[pq[i][0]][pq[i][1]]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0386513891,"measured_runtime_v1":0.0437186143,"runtime_lift":0.8840945601,"key":["s625890328","s830486805"]} +{"user_id":"u987164499","problem_id":"p03463","language":"python","submission_id_v0":"s437315596","submission_id_v1":"s143715764","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"from sys import stdin\n\n\n\nn,a,b = [int(x) for x in stdin.readline().rstrip().split()]\n\n\n\nwhile True:\n\n if a+1 != b:\n\n a += 1\n\n else:\n\n print(\"Borys\")\n\n exit()\n\n if b-1 != a:\n\n b -= 1\n\n else:\n\n print(\"Alice\")\n\n exit()","target":"from sys import stdin\n\n\n\nn,a,b = [int(x) for x in stdin.readline().rstrip().split()]\n\n\n\nif (b-a)%2 == 1:\n\n print(\"Borys\")\n\nelse:\n\n print(\"Alice\")","code_v0_loc":15,"code_v1_loc":8,"code_v0_num_chars":269,"code_v1_num_chars":151,"code_v0_no_empty_lines":"from sys import stdin\n\nn, a, b = [int(x) for x in stdin.readline().rstrip().split()]\nwhile True:\n if a + 1 != b:\n a += 1\n else:\n print(\"Borys\")\n exit()\n if b - 1 != a:\n b -= 1\n else:\n print(\"Alice\")\n exit()\n","code_v1_no_empty_lines":"from sys import stdin\n\nn, a, b = [int(x) for x in stdin.readline().rstrip().split()]\nif (b - a) % 2 == 1:\n print(\"Borys\")\nelse:\n print(\"Alice\")\n","code_same":false,"relative_loc_diff_percent":46.6666666667,"diff":["-while True:","- if a + 1 != b:","- a += 1","- else:","- print(\"Borys\")","- exit()","- if b - 1 != a:","- b -= 1","- else:","- print(\"Alice\")","- exit()","+if (b - a) % 2 == 1:","+ print(\"Borys\")","+else:","+ print(\"Alice\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0416553617,"measured_runtime_v1":0.0368609686,"runtime_lift":1.1300669308,"key":["s437315596","s143715764"]} +{"user_id":"u054871430","problem_id":"p03835","language":"python","submission_id_v0":"s276527146","submission_id_v1":"s817917727","cpu_time_v0":475,"cpu_time_v1":262,"memory_v0":41180,"memory_v1":40684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.84,"input":"k, s = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(s + 1):\n\n for y in range(s - x + 1):\n\n z = s - x - y\n\n \n\n if x <= k and y <= k and z <= k:\n\n ans += 1\n\n\n\nprint(ans)","target":"k, s = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n z = (s-(x+y))\n\n if 0 <= z and z <= k:\n\n ans += 1 \n\n\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":190,"code_v1_num_chars":182,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\nans = 0\nfor x in range(s + 1):\n for y in range(s - x + 1):\n z = s - x - y\n if x <= k and y <= k and z <= k:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"k, s = list(map(int, input().split()))\nans = 0\nfor x in range(k + 1):\n for y in range(k + 1):\n z = s - (x + y)\n if 0 <= z and z <= k:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-for x in range(s + 1):","- for y in range(s - x + 1):","- z = s - x - y","- if x <= k and y <= k and z <= k:","+for x in range(k + 1):","+ for y in range(k + 1):","+ z = s - (x + y)","+ if 0 <= z and z <= k:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0383816723,"measured_runtime_v1":0.0375455918,"runtime_lift":1.0222684054,"key":["s276527146","s817917727"]} +{"user_id":"u279464152","problem_id":"p02711","language":"python","submission_id_v0":"s299948008","submission_id_v1":"s214678752","cpu_time_v0":23,"cpu_time_v1":21,"memory_v0":9148,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.7,"input":"N=str(eval(input()))\n\nif int(N[0])==7:\n\n print(\"Yes\")\n\nelif int(N[1])==7:\n\n print(\"Yes\")\n\nelif int(N[2])==7:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n","target":"N=str(eval(input()))\n\nif int(N[0])==7 or int(N[1])==7 or int(N[2])==7:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":9,"code_v1_loc":5,"code_v0_num_chars":151,"code_v1_num_chars":106,"code_v0_no_empty_lines":"N = str(eval(input()))\nif int(N[0]) == 7:\n print(\"Yes\")\nelif int(N[1]) == 7:\n print(\"Yes\")\nelif int(N[2]) == 7:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"N = str(eval(input()))\nif int(N[0]) == 7 or int(N[1]) == 7 or int(N[2]) == 7:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-if int(N[0]) == 7:","- print(\"Yes\")","-elif int(N[1]) == 7:","- print(\"Yes\")","-elif int(N[2]) == 7:","+if int(N[0]) == 7 or int(N[1]) == 7 or int(N[2]) == 7:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0390598767,"measured_runtime_v1":0.0371246471,"runtime_lift":1.0521278902,"key":["s299948008","s214678752"]} +{"user_id":"u102461423","problem_id":"p02680","language":"python","submission_id_v0":"s487305861","submission_id_v1":"s931733955","cpu_time_v0":784,"cpu_time_v1":663,"memory_v0":165764,"memory_v1":165176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.43,"input":"import sys\n\nimport numpy as np\n\nfrom numba import njit\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nINF = 10**9 + 1\n\n\n\ndef precompute(N, M, data):\n\n data = data.reshape(-1, 3)\n\n A, B, C = data[:N].T\n\n D, E, F = data[N:].T\n\n X = np.unique(np.concatenate([A, B, D, [0, -INF, INF]]))\n\n Y = np.unique(np.concatenate([C, E, F, [0, -INF, INF]]))\n\n A = np.searchsorted(X, A)\n\n B = np.searchsorted(X, B)\n\n D = np.searchsorted(X, D)\n\n C = np.searchsorted(Y, C)\n\n E = np.searchsorted(Y, E)\n\n F = np.searchsorted(Y, F)\n\n return A, B, C, D, E, F, X, Y\n\n\n\n@njit('(i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8,i8)', cache=True)\n\ndef set_ng(A, B, C, D, E, F, H, W):\n\n ng = np.zeros((H * W, 4), np.bool_)\n\n\n\n for i in range(len(A)):\n\n for x in range(A[i], B[i]):\n\n v = x * W + C[i]\n\n ng[v][1] = 1\n\n ng[v - 1][0] = 1\n\n\n\n for i in range(len(D)):\n\n for y in range(E[i], F[i]):\n\n v = D[i] * W + y\n\n ng[v][3] = 1\n\n ng[v - W][2] = 1\n\n return ng\n\n\n\n@njit('(i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8[:])', cache=True)\n\ndef solve(A, B, C, D, E, F, X, Y):\n\n H, W = len(X), len(Y)\n\n N = H * W\n\n DX = X[1:] - X[:-1]\n\n DY = Y[1:] - Y[:-1]\n\n ng = set_ng(A, B, C, D, E, F, H, W)\n\n x0, y0 = np.searchsorted(X, 0), np.searchsorted(Y, 0)\n\n v0 = x0 * W + y0\n\n visited = np.zeros(N, np.bool_)\n\n visited[v0] = 1\n\n stack = np.empty(N, np.int32)\n\n p = 0\n\n ret = 0\n\n\n\n def area(x):\n\n x, y = divmod(x, W)\n\n return DX[x] * DY[y]\n\n\n\n def push(x):\n\n nonlocal p, ret\n\n stack[p] = x\n\n visited[x] = 1\n\n ret += area(x)\n\n p += 1\n\n\n\n def pop():\n\n nonlocal p\n\n p -= 1\n\n return stack[p]\n\n\n\n push(v0)\n\n move = (1, -1, W, -W)\n\n while p:\n\n v = pop()\n\n for i in range(4):\n\n if ng[v][i]:\n\n continue\n\n w = v + move[i]\n\n if visited[w]:\n\n continue\n\n x, y = divmod(w, W)\n\n if x == 0 or x == H - 1 or y == 0 or y == W - 1:\n\n return 0\n\n push(w)\n\n return ret\n\n\n\nN, M = list(map(int, readline().split()))\n\ndata = np.int64(read().split())\n\n\n\nx = solve(*precompute(N, M, data))\n\nif x == 0:\n\n print('INF')\n\nelse:\n\n print(x)","target":"import sys\n\nimport numpy as np\n\nfrom numba import njit\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nINF = 10**9 + 1\n\n\n\ndef precompute(N, M, data):\n\n data = data.reshape(-1, 3)\n\n A, B, C = data[:N].T\n\n D, E, F = data[N:].T\n\n X = np.unique(np.concatenate([A, B, D, [0, -INF, INF]]))\n\n Y = np.unique(np.concatenate([C, E, F, [0, -INF, INF]]))\n\n A = np.searchsorted(X, A)\n\n B = np.searchsorted(X, B)\n\n D = np.searchsorted(X, D)\n\n C = np.searchsorted(Y, C)\n\n E = np.searchsorted(Y, E)\n\n F = np.searchsorted(Y, F)\n\n return A, B, C, D, E, F, X, Y\n\n\n\n@njit('(i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8[:])', cache=True)\n\ndef solve(A, B, C, D, E, F, X, Y):\n\n H, W = len(X), len(Y)\n\n N = H * W\n\n DX = X[1:] - X[:-1]\n\n DY = Y[1:] - Y[:-1]\n\n\n\n def set_ng(A, B, C, D, E, F, H, W):\n\n ng = np.zeros((H * W, 4), np.bool_)\n\n\n\n for i in range(len(A)):\n\n for x in range(A[i], B[i]):\n\n v = x * W + C[i]\n\n ng[v][1] = 1\n\n ng[v - 1][0] = 1\n\n\n\n for i in range(len(D)):\n\n for y in range(E[i], F[i]):\n\n v = D[i] * W + y\n\n ng[v][3] = 1\n\n ng[v - W][2] = 1\n\n return ng\n\n\n\n ng = set_ng(A, B, C, D, E, F, H, W)\n\n x0, y0 = np.searchsorted(X, 0), np.searchsorted(Y, 0)\n\n v0 = x0 * W + y0\n\n visited = np.zeros(N, np.bool_)\n\n visited[v0] = 1\n\n stack = np.empty(N, np.int32)\n\n p = 0\n\n ret = 0\n\n\n\n def area(x):\n\n x, y = divmod(x, W)\n\n return DX[x] * DY[y]\n\n\n\n def push(x):\n\n nonlocal p, ret\n\n stack[p] = x\n\n visited[x] = 1\n\n ret += area(x)\n\n p += 1\n\n\n\n def pop():\n\n nonlocal p\n\n p -= 1\n\n return stack[p]\n\n\n\n push(v0)\n\n move = (1, -1, W, -W)\n\n while p:\n\n v = pop()\n\n for i in range(4):\n\n if ng[v][i]:\n\n continue\n\n w = v + move[i]\n\n if visited[w]:\n\n continue\n\n x, y = divmod(w, W)\n\n if x == 0 or x == H - 1 or y == 0 or y == W - 1:\n\n return 0\n\n push(w)\n\n return ret\n\n\n\nN, M = list(map(int, readline().split()))\n\ndata = np.int64(read().split())\n\n\n\nx = solve(*precompute(N, M, data))\n\nif x == 0:\n\n print('INF')\n\nelse:\n\n print(x)","code_v0_loc":96,"code_v1_loc":96,"code_v0_num_chars":2400,"code_v1_num_chars":2388,"code_v0_no_empty_lines":"import sys\nimport numpy as np\nfrom numba import njit\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nINF = 10**9 + 1\n\n\ndef precompute(N, M, data):\n data = data.reshape(-1, 3)\n A, B, C = data[:N].T\n D, E, F = data[N:].T\n X = np.unique(np.concatenate([A, B, D, [0, -INF, INF]]))\n Y = np.unique(np.concatenate([C, E, F, [0, -INF, INF]]))\n A = np.searchsorted(X, A)\n B = np.searchsorted(X, B)\n D = np.searchsorted(X, D)\n C = np.searchsorted(Y, C)\n E = np.searchsorted(Y, E)\n F = np.searchsorted(Y, F)\n return A, B, C, D, E, F, X, Y\n\n\n@njit(\"(i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8,i8)\", cache=True)\ndef set_ng(A, B, C, D, E, F, H, W):\n ng = np.zeros((H * W, 4), np.bool_)\n for i in range(len(A)):\n for x in range(A[i], B[i]):\n v = x * W + C[i]\n ng[v][1] = 1\n ng[v - 1][0] = 1\n for i in range(len(D)):\n for y in range(E[i], F[i]):\n v = D[i] * W + y\n ng[v][3] = 1\n ng[v - W][2] = 1\n return ng\n\n\n@njit(\"(i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8[:])\", cache=True)\ndef solve(A, B, C, D, E, F, X, Y):\n H, W = len(X), len(Y)\n N = H * W\n DX = X[1:] - X[:-1]\n DY = Y[1:] - Y[:-1]\n ng = set_ng(A, B, C, D, E, F, H, W)\n x0, y0 = np.searchsorted(X, 0), np.searchsorted(Y, 0)\n v0 = x0 * W + y0\n visited = np.zeros(N, np.bool_)\n visited[v0] = 1\n stack = np.empty(N, np.int32)\n p = 0\n ret = 0\n\n def area(x):\n x, y = divmod(x, W)\n return DX[x] * DY[y]\n\n def push(x):\n nonlocal p, ret\n stack[p] = x\n visited[x] = 1\n ret += area(x)\n p += 1\n\n def pop():\n nonlocal p\n p -= 1\n return stack[p]\n\n push(v0)\n move = (1, -1, W, -W)\n while p:\n v = pop()\n for i in range(4):\n if ng[v][i]:\n continue\n w = v + move[i]\n if visited[w]:\n continue\n x, y = divmod(w, W)\n if x == 0 or x == H - 1 or y == 0 or y == W - 1:\n return 0\n push(w)\n return ret\n\n\nN, M = list(map(int, readline().split()))\ndata = np.int64(read().split())\nx = solve(*precompute(N, M, data))\nif x == 0:\n print(\"INF\")\nelse:\n print(x)\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\nfrom numba import njit\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nINF = 10**9 + 1\n\n\ndef precompute(N, M, data):\n data = data.reshape(-1, 3)\n A, B, C = data[:N].T\n D, E, F = data[N:].T\n X = np.unique(np.concatenate([A, B, D, [0, -INF, INF]]))\n Y = np.unique(np.concatenate([C, E, F, [0, -INF, INF]]))\n A = np.searchsorted(X, A)\n B = np.searchsorted(X, B)\n D = np.searchsorted(X, D)\n C = np.searchsorted(Y, C)\n E = np.searchsorted(Y, E)\n F = np.searchsorted(Y, F)\n return A, B, C, D, E, F, X, Y\n\n\n@njit(\"(i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8[:])\", cache=True)\ndef solve(A, B, C, D, E, F, X, Y):\n H, W = len(X), len(Y)\n N = H * W\n DX = X[1:] - X[:-1]\n DY = Y[1:] - Y[:-1]\n\n def set_ng(A, B, C, D, E, F, H, W):\n ng = np.zeros((H * W, 4), np.bool_)\n for i in range(len(A)):\n for x in range(A[i], B[i]):\n v = x * W + C[i]\n ng[v][1] = 1\n ng[v - 1][0] = 1\n for i in range(len(D)):\n for y in range(E[i], F[i]):\n v = D[i] * W + y\n ng[v][3] = 1\n ng[v - W][2] = 1\n return ng\n\n ng = set_ng(A, B, C, D, E, F, H, W)\n x0, y0 = np.searchsorted(X, 0), np.searchsorted(Y, 0)\n v0 = x0 * W + y0\n visited = np.zeros(N, np.bool_)\n visited[v0] = 1\n stack = np.empty(N, np.int32)\n p = 0\n ret = 0\n\n def area(x):\n x, y = divmod(x, W)\n return DX[x] * DY[y]\n\n def push(x):\n nonlocal p, ret\n stack[p] = x\n visited[x] = 1\n ret += area(x)\n p += 1\n\n def pop():\n nonlocal p\n p -= 1\n return stack[p]\n\n push(v0)\n move = (1, -1, W, -W)\n while p:\n v = pop()\n for i in range(4):\n if ng[v][i]:\n continue\n w = v + move[i]\n if visited[w]:\n continue\n x, y = divmod(w, W)\n if x == 0 or x == H - 1 or y == 0 or y == W - 1:\n return 0\n push(w)\n return ret\n\n\nN, M = list(map(int, readline().split()))\ndata = np.int64(read().split())\nx = solve(*precompute(N, M, data))\nif x == 0:\n print(\"INF\")\nelse:\n print(x)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-@njit(\"(i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8,i8)\", cache=True)","-def set_ng(A, B, C, D, E, F, H, W):","- ng = np.zeros((H * W, 4), np.bool_)","- for i in range(len(A)):","- for x in range(A[i], B[i]):","- v = x * W + C[i]","- ng[v][1] = 1","- ng[v - 1][0] = 1","- for i in range(len(D)):","- for y in range(E[i], F[i]):","- v = D[i] * W + y","- ng[v][3] = 1","- ng[v - W][2] = 1","- return ng","-","-","+","+ def set_ng(A, B, C, D, E, F, H, W):","+ ng = np.zeros((H * W, 4), np.bool_)","+ for i in range(len(A)):","+ for x in range(A[i], B[i]):","+ v = x * W + C[i]","+ ng[v][1] = 1","+ ng[v - 1][0] = 1","+ for i in range(len(D)):","+ for y in range(E[i], F[i]):","+ v = D[i] * W + y","+ ng[v][3] = 1","+ ng[v - W][2] = 1","+ return ng","+"],"diff_only_import_comment":false,"measured_runtime_v0":0.1934161241,"measured_runtime_v1":0.2817035091,"runtime_lift":0.6865946566,"key":["s487305861","s931733955"]} +{"user_id":"u167681750","problem_id":"p03006","language":"python","submission_id_v0":"s382407916","submission_id_v1":"s835988517","cpu_time_v0":100,"cpu_time_v1":33,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.0,"input":"n = int(eval(input()))\n\nxy = [tuple(map(int, input().split())) for _ in range(n)]\n\ns_xy = set(xy)\n\n\n\ncount = 0\n\nfor i in range(n-1):\n\n for j in range(i+1, n):\n\n ix, iy = xy[i]\n\n jx, jy = xy[j]\n\n p = jx - ix\n\n q = jy - iy\n\n tc = sum((x-p,y-q) in xy for x, y in s_xy)\n\n\n\n count = max(count, tc)\n\n\n\nprint((n-count))","target":"#https:\/\/atcoder.jp\/contests\/diverta2019-2\/submissions\/11229318\n\nn = int(eval(input()))\n\nt = [tuple(map(int, input().split())) for _ in range(n)]\n\ns = set(t)\n\ncnt = 0\n\nfor i in range(n-1):\n\n for j in range(i+1,n):\n\n u,v = t[i]\n\n x,y = t[j]\n\n p = u-x; q = v-y\n\n c = sum((x-p, y-q) in s for x,y in t)\n\n if cnt < c: cnt = c\n\nprint((n-cnt))\n","code_v0_loc":16,"code_v1_loc":13,"code_v0_num_chars":349,"code_v1_num_chars":345,"code_v0_no_empty_lines":"n = int(eval(input()))\nxy = [tuple(map(int, input().split())) for _ in range(n)]\ns_xy = set(xy)\ncount = 0\nfor i in range(n - 1):\n for j in range(i + 1, n):\n ix, iy = xy[i]\n jx, jy = xy[j]\n p = jx - ix\n q = jy - iy\n tc = sum((x - p, y - q) in xy for x, y in s_xy)\n count = max(count, tc)\nprint((n - count))\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/diverta2019-2\/submissions\/11229318\nn = int(eval(input()))\nt = [tuple(map(int, input().split())) for _ in range(n)]\ns = set(t)\ncnt = 0\nfor i in range(n - 1):\n for j in range(i + 1, n):\n u, v = t[i]\n x, y = t[j]\n p = u - x\n q = v - y\n c = sum((x - p, y - q) in s for x, y in t)\n if cnt < c:\n cnt = c\nprint((n - cnt))\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["+# https:\/\/atcoder.jp\/contests\/diverta2019-2\/submissions\/11229318","-xy = [tuple(map(int, input().split())) for _ in range(n)]","-s_xy = set(xy)","-count = 0","+t = [tuple(map(int, input().split())) for _ in range(n)]","+s = set(t)","+cnt = 0","- ix, iy = xy[i]","- jx, jy = xy[j]","- p = jx - ix","- q = jy - iy","- tc = sum((x - p, y - q) in xy for x, y in s_xy)","- count = max(count, tc)","-print((n - count))","+ u, v = t[i]","+ x, y = t[j]","+ p = u - x","+ q = v - y","+ c = sum((x - p, y - q) in s for x, y in t)","+ if cnt < c:","+ cnt = c","+print((n - cnt))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0817448564,"measured_runtime_v1":0.0438204155,"runtime_lift":1.8654514206,"key":["s382407916","s835988517"]} +{"user_id":"u416011173","problem_id":"p02689","language":"python","submission_id_v0":"s918451353","submission_id_v1":"s847667638","cpu_time_v0":314,"cpu_time_v1":278,"memory_v0":22264,"memory_v1":22976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.46,"input":"# -*- coding: utf-8 -*-\n\n# \u6a19\u6e96\u5165\u529b\u306e\u53d6\u5f97\n\nN, M = list(map(int, input().split()))\n\nH = list(map(int, input().split()))\n\nA, B = [], []\n\nfor m in range(M):\n\n A_m, B_m = list(map(int, input().split()))\n\n A.append(A_m)\n\n B.append(B_m)\n\n\n\n# \u6c42\u89e3\u51e6\u7406\n\nobservatory = [True for n in range(N)]\n\nfor A_m, B_m in zip(A, B):\n\n lower_observatory = int()\n\n if H[A_m-1] < H[B_m-1]:\n\n observatory[A_m-1] = False\n\n elif H[A_m-1] > H[B_m-1]:\n\n observatory[B_m-1] = False\n\n else:\n\n observatory[A_m-1] = False\n\n observatory[B_m-1] = False\n\n\n\nresult = sum(observatory)\n\n\n\n# \u7d50\u679c\u51fa\u529b\n\nprint(result)\n","target":"# -*- coding: utf-8 -*-\n\n# \u6a19\u6e96\u5165\u529b\u306e\u53d6\u5f97\n\nN, M = list(map(int, input().split()))\n\nH = list(map(int, input().split()))\n\nA, B = [], []\n\nfor m in range(M):\n\n A_m, B_m = list(map(int, input().split()))\n\n A.append(A_m)\n\n B.append(B_m)\n\n\n\n\n\ndef main() -> None:\n\n \"\"\"Entry point\n\n \"\"\"\n\n # \u6c42\u89e3\u51e6\u7406\n\n # \u9053\u3054\u3068\u306b\u300c\u826f\u3044\u5c55\u671b\u53f0\u300d\u3067\u306f\u306a\u3044\u5c55\u671b\u53f0\u3092\u524a\u9664\u3057\u3001\u6b8b\u308a\u306e\u5c55\u671b\u53f0\u306e\u6570\u3092\u8a08\u7b97\u3059\u308b\u3002\n\n observatory = [True for n in range(N)] # \u521d\u671f\u72b6\u614b\u306f\u3059\u3079\u3066\u300c\u826f\u3044\u5c55\u671b\u53f0\u300d\n\n for A_m, B_m in zip(A, B):\n\n A_m -= 1 # \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u306b\u5909\u63db\n\n B_m -= 1 # \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u306b\u5909\u63db\n\n if H[A_m] < H[B_m]:\n\n observatory[A_m] = False\n\n elif H[A_m] > H[B_m]:\n\n observatory[B_m] = False\n\n else:\n\n observatory[A_m] = False\n\n observatory[B_m] = False\n\n\n\n result = sum(observatory)\n\n\n\n # \u7d50\u679c\u51fa\u529b\n\n print(result)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":26,"code_v1_loc":36,"code_v0_num_chars":611,"code_v1_num_chars":842,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n# \u6a19\u6e96\u5165\u529b\u306e\u53d6\u5f97\nN, M = list(map(int, input().split()))\nH = list(map(int, input().split()))\nA, B = [], []\nfor m in range(M):\n A_m, B_m = list(map(int, input().split()))\n A.append(A_m)\n B.append(B_m)\n# \u6c42\u89e3\u51e6\u7406\nobservatory = [True for n in range(N)]\nfor A_m, B_m in zip(A, B):\n lower_observatory = int()\n if H[A_m - 1] < H[B_m - 1]:\n observatory[A_m - 1] = False\n elif H[A_m - 1] > H[B_m - 1]:\n observatory[B_m - 1] = False\n else:\n observatory[A_m - 1] = False\n observatory[B_m - 1] = False\nresult = sum(observatory)\n# \u7d50\u679c\u51fa\u529b\nprint(result)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n# \u6a19\u6e96\u5165\u529b\u306e\u53d6\u5f97\nN, M = list(map(int, input().split()))\nH = list(map(int, input().split()))\nA, B = [], []\nfor m in range(M):\n A_m, B_m = list(map(int, input().split()))\n A.append(A_m)\n B.append(B_m)\n\n\ndef main() -> None:\n \"\"\"Entry point\"\"\"\n # \u6c42\u89e3\u51e6\u7406\n # \u9053\u3054\u3068\u306b\u300c\u826f\u3044\u5c55\u671b\u53f0\u300d\u3067\u306f\u306a\u3044\u5c55\u671b\u53f0\u3092\u524a\u9664\u3057\u3001\u6b8b\u308a\u306e\u5c55\u671b\u53f0\u306e\u6570\u3092\u8a08\u7b97\u3059\u308b\u3002\n observatory = [True for n in range(N)] # \u521d\u671f\u72b6\u614b\u306f\u3059\u3079\u3066\u300c\u826f\u3044\u5c55\u671b\u53f0\u300d\n for A_m, B_m in zip(A, B):\n A_m -= 1 # \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u306b\u5909\u63db\n B_m -= 1 # \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u306b\u5909\u63db\n if H[A_m] < H[B_m]:\n observatory[A_m] = False\n elif H[A_m] > H[B_m]:\n observatory[B_m] = False\n else:\n observatory[A_m] = False\n observatory[B_m] = False\n result = sum(observatory)\n # \u7d50\u679c\u51fa\u529b\n print(result)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":27.7777777778,"diff":["-# \u6c42\u89e3\u51e6\u7406","-observatory = [True for n in range(N)]","-for A_m, B_m in zip(A, B):","- lower_observatory = int()","- if H[A_m - 1] < H[B_m - 1]:","- observatory[A_m - 1] = False","- elif H[A_m - 1] > H[B_m - 1]:","- observatory[B_m - 1] = False","- else:","- observatory[A_m - 1] = False","- observatory[B_m - 1] = False","-result = sum(observatory)","-# \u7d50\u679c\u51fa\u529b","-print(result)","+","+","+def main() -> None:","+ \"\"\"Entry point\"\"\"","+ # \u6c42\u89e3\u51e6\u7406","+ # \u9053\u3054\u3068\u306b\u300c\u826f\u3044\u5c55\u671b\u53f0\u300d\u3067\u306f\u306a\u3044\u5c55\u671b\u53f0\u3092\u524a\u9664\u3057\u3001\u6b8b\u308a\u306e\u5c55\u671b\u53f0\u306e\u6570\u3092\u8a08\u7b97\u3059\u308b\u3002","+ observatory = [True for n in range(N)] # \u521d\u671f\u72b6\u614b\u306f\u3059\u3079\u3066\u300c\u826f\u3044\u5c55\u671b\u53f0\u300d","+ for A_m, B_m in zip(A, B):","+ A_m -= 1 # \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u306b\u5909\u63db","+ B_m -= 1 # \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u306b\u5909\u63db","+ if H[A_m] < H[B_m]:","+ observatory[A_m] = False","+ elif H[A_m] > H[B_m]:","+ observatory[B_m] = False","+ else:","+ observatory[A_m] = False","+ observatory[B_m] = False","+ result = sum(observatory)","+ # \u7d50\u679c\u51fa\u529b","+ print(result)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.100448464,"measured_runtime_v1":0.0312106384,"runtime_lift":3.2184046522,"key":["s918451353","s847667638"]} +{"user_id":"u046187684","problem_id":"p02819","language":"python","submission_id_v0":"s513679336","submission_id_v1":"s668942409","cpu_time_v0":184,"cpu_time_v1":17,"memory_v0":15308,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.76,"input":"import numpy as np\n\nfrom bisect import bisect_left\n\n\n\n\n\ndef primes():\n\n p = []\n\n c = np.ones(10**5 + 10)\n\n c[0] = c[1] = 0\n\n for i, f in enumerate(c):\n\n if f:\n\n p.append(i)\n\n c[2 * i:10**5 + 10:i] = 0\n\n return p\n\n\n\n\n\ndef solve(string):\n\n x = int(string)\n\n ps = primes()\n\n return str(ps[bisect_left(ps, x)])\n\n\n\n\n\nif __name__ == '__main__':\n\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","target":"def solve(string):\n\n x = int(string)\n\n for i in range(x, 2 * x):\n\n for j in range(2, int(i**0.5)):\n\n if i % j == 0:\n\n break\n\n else:\n\n return str(i)\n\n\n\n\n\nif __name__ == '__main__':\n\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","code_v0_loc":24,"code_v1_loc":13,"code_v0_num_chars":452,"code_v1_num_chars":297,"code_v0_no_empty_lines":"import numpy as np\nfrom bisect import bisect_left\n\n\ndef primes():\n p = []\n c = np.ones(10**5 + 10)\n c[0] = c[1] = 0\n for i, f in enumerate(c):\n if f:\n p.append(i)\n c[2 * i : 10**5 + 10 : i] = 0\n return p\n\n\ndef solve(string):\n x = int(string)\n ps = primes()\n return str(ps[bisect_left(ps, x)])\n\n\nif __name__ == \"__main__\":\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","code_v1_no_empty_lines":"def solve(string):\n x = int(string)\n for i in range(x, 2 * x):\n for j in range(2, int(i**0.5)):\n if i % j == 0:\n break\n else:\n return str(i)\n\n\nif __name__ == \"__main__\":\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","code_same":false,"relative_loc_diff_percent":45.8333333333,"diff":["-import numpy as np","-from bisect import bisect_left","-","-","-def primes():","- p = []","- c = np.ones(10**5 + 10)","- c[0] = c[1] = 0","- for i, f in enumerate(c):","- if f:","- p.append(i)","- c[2 * i : 10**5 + 10 : i] = 0","- return p","-","-","- ps = primes()","- return str(ps[bisect_left(ps, x)])","+ for i in range(x, 2 * x):","+ for j in range(2, int(i**0.5)):","+ if i % j == 0:","+ break","+ else:","+ return str(i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3260102577,"measured_runtime_v1":0.0362112308,"runtime_lift":9.0030151098,"key":["s513679336","s668942409"]} +{"user_id":"u279546122","problem_id":"p02361","language":"python","submission_id_v0":"s669247379","submission_id_v1":"s507490403","cpu_time_v0":7880,"cpu_time_v1":3170,"memory_v0":106856,"memory_v1":106872,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.77,"input":"#!usr\/bin\/env python3\n\n\n\nfrom collections import defaultdict\n\n\n\n\n\ndef main():\n\n #Read stdin\n\n\n\n fl = input().split(\" \")\n\n V = int(fl[0])\n\n E = int(fl[1])\n\n R = int(fl[2])\n\n #Adjacency list\n\n G = defaultdict(list)\n\n for i in range(int(E)):\n\n s, t, w = [int(x) for x in input().split(\" \")]\n\n G[s].append((t,w))\n\n #initialized\n\n d = {}\n\n INF = float('inf')\n\n #INF = 10001\n\n for i in range(V):\n\n d[i] = INF\n\n d[R] = 0\n\n q = [R]\n\n while q:\n\n u = q.pop(0)\n\n for v in G[u]:\n\n if d[v[0]] > d[u] + v[1]:\n\n d[v[0]] = d[u] + v[1]\n\n\n\n q.append(v[0])\n\n\n\n for k in range(V):\n\n if d[k] == float('inf'):\n\n \n\n print(\"INF\")\n\n else:\n\n print((d[k]))\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","target":"from collections import defaultdict\n\nfrom collections import deque\n\n#import time\n\n\n\ndef main():\n\n # Read stdin\n\n #start = time.clock()\n\n fl = input().split(\" \")\n\n V = int(fl[0])\n\n E = int(fl[1])\n\n R = int(fl[2])\n\n # Adjacency list\n\n G = defaultdict(list)\n\n for i in range(int(E)):\n\n s, t, w = [int(x) for x in input().split(\" \")]\n\n G[s].append((t, w))\n\n # initialized\n\n d = {}\n\n INF = float('inf')\n\n # INF = 10001\n\n for i in range(V):\n\n d[i] = INF\n\n d[R] = 0\n\n q = deque([R])\n\n while q:\n\n # u = heappop(q)\n\n u = q.popleft()\n\n for v in G[u]:\n\n if d[v[0]] > d[u] + v[1]:\n\n d[v[0]] = d[u] + v[1]\n\n # heappush(q, v[0])\n\n q.append(v[0])\n\n #end = time.clock() - start\n\n for k in range(V):\n\n if d[k] == float('inf'):\n\n print(\"INF\")\n\n else:\n\n print((d[k]))\n\n #print('Computation time : {}'.format(end))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":44,"code_v1_loc":43,"code_v0_num_chars":847,"code_v1_num_chars":1030,"code_v0_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict\n\n\ndef main():\n # Read stdin\n fl = input().split(\" \")\n V = int(fl[0])\n E = int(fl[1])\n R = int(fl[2])\n # Adjacency list\n G = defaultdict(list)\n for i in range(int(E)):\n s, t, w = [int(x) for x in input().split(\" \")]\n G[s].append((t, w))\n # initialized\n d = {}\n INF = float(\"inf\")\n # INF = 10001\n for i in range(V):\n d[i] = INF\n d[R] = 0\n q = [R]\n while q:\n u = q.pop(0)\n for v in G[u]:\n if d[v[0]] > d[u] + v[1]:\n d[v[0]] = d[u] + v[1]\n q.append(v[0])\n for k in range(V):\n if d[k] == float(\"inf\"):\n print(\"INF\")\n else:\n print((d[k]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import defaultdict\nfrom collections import deque\n\n# import time\ndef main():\n # Read stdin\n # start = time.clock()\n fl = input().split(\" \")\n V = int(fl[0])\n E = int(fl[1])\n R = int(fl[2])\n # Adjacency list\n G = defaultdict(list)\n for i in range(int(E)):\n s, t, w = [int(x) for x in input().split(\" \")]\n G[s].append((t, w))\n # initialized\n d = {}\n INF = float(\"inf\")\n # INF = 10001\n for i in range(V):\n d[i] = INF\n d[R] = 0\n q = deque([R])\n while q:\n # u = heappop(q)\n u = q.popleft()\n for v in G[u]:\n if d[v[0]] > d[u] + v[1]:\n d[v[0]] = d[u] + v[1]\n # heappush(q, v[0])\n q.append(v[0])\n # end = time.clock() - start\n for k in range(V):\n if d[k] == float(\"inf\"):\n print(\"INF\")\n else:\n print((d[k]))\n # print('Computation time : {}'.format(end))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.2727272727,"diff":["-#!usr\/bin\/env python3","+from collections import deque","-","+# import time","+ # start = time.clock()","- q = [R]","+ q = deque([R])","- u = q.pop(0)","+ # u = heappop(q)","+ u = q.popleft()","+ # heappush(q, v[0])","+ # end = time.clock() - start","+ # print('Computation time : {}'.format(end))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0394511239,"measured_runtime_v1":0.0692940978,"runtime_lift":0.5693287756,"key":["s669247379","s507490403"]} +{"user_id":"u032662562","problem_id":"p00113","language":"python","submission_id_v0":"s794528673","submission_id_v1":"s432971298","cpu_time_v0":130,"cpu_time_v1":120,"memory_v0":9944,"memory_v1":9904,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.69,"input":"from decimal import *\n\nimport re\n\ndef solve2(m, n):\n\n maxlen = 160\n\n PREC=200\n\n getcontext().prec = PREC\n\n x = Decimal(m) \/ Decimal(n)\n\n s = x.to_eng_string()\n\n if len(s) < PREC:\n\n return(s[2:],'')\n\n rep = 1\n\n while True:\n\n r = r'(.{%d})\\1{%d,}' % (rep, int(maxlen\/rep)-1) #ex. '(.{6})\\\\1{12,}'\n\n a=re.search(r, s)\n\n if a:\n\n break\n\n rep += 1\n\n if rep > maxlen:\n\n raise ValueError('This cannot happen.rep=%d' % rep)\n\n\n\n u = s[2:a.start()+len(a.group(1))]\n\n v = (' '*PREC + '^'*len(a.group(1)))[-len(u):]\n\n return(u,v)\n\n\n\nwhile True:\n\n try:\n\n m,n = list(map(int, input().strip().split()))\n\n s,t = solve2(m, n)\n\n print(s)\n\n if t!='':\n\n print(t)\n\n except EOFError:\n\n break","target":"from decimal import *\n\nimport re\n\ndef solve2(m, n):\n\n maxlen = 80\n\n PREC=200\n\n getcontext().prec = PREC\n\n x = Decimal(m) \/ Decimal(n)\n\n s = x.to_eng_string()\n\n if len(s) < PREC:\n\n return(s[2:],'')\n\n rep = 1\n\n while True:\n\n r = r'(.{%d})\\1{%d,}' % (rep, int(maxlen\/rep)) #ex. '(.{6})\\\\1{12,}'\n\n a=re.search(r, s)\n\n if a:\n\n break\n\n rep += 1\n\n if rep > maxlen:\n\n raise ValueError('This cannot happen.rep=%d' % rep)\n\n\n\n u = s[2:a.start()+len(a.group(1))]\n\n v = (' '*PREC + '^'*len(a.group(1)))[-len(u):]\n\n return(u,v)\n\n\n\nwhile True:\n\n try:\n\n m,n = list(map(int, input().strip().split()))\n\n s,t = solve2(m, n)\n\n print(s)\n\n if t!='':\n\n print(t)\n\n except EOFError:\n\n break","code_v0_loc":33,"code_v1_loc":33,"code_v0_num_chars":812,"code_v1_num_chars":809,"code_v0_no_empty_lines":"from decimal import *\nimport re\n\n\ndef solve2(m, n):\n maxlen = 160\n PREC = 200\n getcontext().prec = PREC\n x = Decimal(m) \/ Decimal(n)\n s = x.to_eng_string()\n if len(s) < PREC:\n return (s[2:], \"\")\n rep = 1\n while True:\n r = r\"(.{%d})\\1{%d,}\" % (rep, int(maxlen \/ rep) - 1) # ex. '(.{6})\\\\1{12,}'\n a = re.search(r, s)\n if a:\n break\n rep += 1\n if rep > maxlen:\n raise ValueError(\"This cannot happen.rep=%d\" % rep)\n u = s[2 : a.start() + len(a.group(1))]\n v = (\" \" * PREC + \"^\" * len(a.group(1)))[-len(u) :]\n return (u, v)\n\n\nwhile True:\n try:\n m, n = list(map(int, input().strip().split()))\n s, t = solve2(m, n)\n print(s)\n if t != \"\":\n print(t)\n except EOFError:\n break\n","code_v1_no_empty_lines":"from decimal import *\nimport re\n\n\ndef solve2(m, n):\n maxlen = 80\n PREC = 200\n getcontext().prec = PREC\n x = Decimal(m) \/ Decimal(n)\n s = x.to_eng_string()\n if len(s) < PREC:\n return (s[2:], \"\")\n rep = 1\n while True:\n r = r\"(.{%d})\\1{%d,}\" % (rep, int(maxlen \/ rep)) # ex. '(.{6})\\\\1{12,}'\n a = re.search(r, s)\n if a:\n break\n rep += 1\n if rep > maxlen:\n raise ValueError(\"This cannot happen.rep=%d\" % rep)\n u = s[2 : a.start() + len(a.group(1))]\n v = (\" \" * PREC + \"^\" * len(a.group(1)))[-len(u) :]\n return (u, v)\n\n\nwhile True:\n try:\n m, n = list(map(int, input().strip().split()))\n s, t = solve2(m, n)\n print(s)\n if t != \"\":\n print(t)\n except EOFError:\n break\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- maxlen = 160","+ maxlen = 80","- r = r\"(.{%d})\\1{%d,}\" % (rep, int(maxlen \/ rep) - 1) # ex. '(.{6})\\\\1{12,}'","+ r = r\"(.{%d})\\1{%d,}\" % (rep, int(maxlen \/ rep)) # ex. '(.{6})\\\\1{12,}'"],"diff_only_import_comment":false,"measured_runtime_v0":0.0508598804,"measured_runtime_v1":0.0542675018,"runtime_lift":0.9372069604,"key":["s794528673","s432971298"]} +{"user_id":"u139682473","problem_id":"p02773","language":"python","submission_id_v0":"s415890177","submission_id_v1":"s386906636","cpu_time_v0":962,"cpu_time_v1":471,"memory_v0":82136,"memory_v1":72016,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.04,"input":"# import sys\n\n# input = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\n\n\nSlist = []\n\nfor i in range(N):\n\n Slist.append(eval(input()))\n\n # if S in Slist.keys():\n\n # Slist[S] += 1\n\n # if Slist[S] > maxNum:\n\n # maxNum = Slist[S]\n\n # else:\n\n # Slist[S] = 1\n\nSlist.sort()\n\n\n\nmax_cnt = 1\n\ncnt = 1\n\ns_old = Slist[0]\n\nmax_Slist = []\n\n\n\nfor i in range(1,N):\n\n if Slist[i] == s_old:\n\n cnt += 1\n\n else:\n\n if cnt > max_cnt:\n\n max_cnt = cnt\n\n max_Slist = [s_old]\n\n elif cnt == max_cnt:\n\n max_Slist.append(s_old)\n\n s_old = Slist[i]\n\n cnt = 1\n\n\n\nif Slist[N-1] == s_old:\n\n if cnt > max_cnt:\n\n max_Slist = [s_old]\n\n elif cnt == max_cnt:\n\n max_Slist.append(s_old)\n\n\n\nfor str in max_Slist:\n\n print(str)","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\n\n\nSlist = []\n\nfor i in range(N):\n\n Slist.append(eval(input()))\n\n # if S in Slist.keys():\n\n # Slist[S] += 1\n\n # if Slist[S] > maxNum:\n\n # maxNum = Slist[S]\n\n # else:\n\n # Slist[S] = 1\n\nSlist.sort()\n\n\n\nmax_cnt = 1\n\ncnt = 1\n\ns_old = Slist[0]\n\nmax_Slist = []\n\n\n\nfor i in range(1,N):\n\n if Slist[i] == s_old:\n\n cnt += 1\n\n else:\n\n if cnt > max_cnt:\n\n max_cnt = cnt\n\n max_Slist = [s_old]\n\n elif cnt == max_cnt:\n\n max_Slist.append(s_old)\n\n s_old = Slist[i]\n\n cnt = 1\n\n\n\nif Slist[N-1] == s_old:\n\n if cnt > max_cnt:\n\n max_Slist = [s_old]\n\n elif cnt == max_cnt:\n\n max_Slist.append(s_old)\n\n\n\nfor str in max_Slist:\n\n print(str)\n","code_v0_loc":41,"code_v1_loc":41,"code_v0_num_chars":808,"code_v1_num_chars":805,"code_v0_no_empty_lines":"# import sys\n# input = sys.stdin.readline\nN = int(eval(input()))\nSlist = []\nfor i in range(N):\n Slist.append(eval(input()))\n # if S in Slist.keys():\n # Slist[S] += 1\n # if Slist[S] > maxNum:\n # maxNum = Slist[S]\n # else:\n # Slist[S] = 1\nSlist.sort()\nmax_cnt = 1\ncnt = 1\ns_old = Slist[0]\nmax_Slist = []\nfor i in range(1, N):\n if Slist[i] == s_old:\n cnt += 1\n else:\n if cnt > max_cnt:\n max_cnt = cnt\n max_Slist = [s_old]\n elif cnt == max_cnt:\n max_Slist.append(s_old)\n s_old = Slist[i]\n cnt = 1\nif Slist[N - 1] == s_old:\n if cnt > max_cnt:\n max_Slist = [s_old]\n elif cnt == max_cnt:\n max_Slist.append(s_old)\nfor str in max_Slist:\n print(str)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nSlist = []\nfor i in range(N):\n Slist.append(eval(input()))\n # if S in Slist.keys():\n # Slist[S] += 1\n # if Slist[S] > maxNum:\n # maxNum = Slist[S]\n # else:\n # Slist[S] = 1\nSlist.sort()\nmax_cnt = 1\ncnt = 1\ns_old = Slist[0]\nmax_Slist = []\nfor i in range(1, N):\n if Slist[i] == s_old:\n cnt += 1\n else:\n if cnt > max_cnt:\n max_cnt = cnt\n max_Slist = [s_old]\n elif cnt == max_cnt:\n max_Slist.append(s_old)\n s_old = Slist[i]\n cnt = 1\nif Slist[N - 1] == s_old:\n if cnt > max_cnt:\n max_Slist = [s_old]\n elif cnt == max_cnt:\n max_Slist.append(s_old)\nfor str in max_Slist:\n print(str)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-# import sys","-# input = sys.stdin.readline","+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.035413244,"measured_runtime_v1":0.0548606718,"runtime_lift":0.645512402,"key":["s415890177","s386906636"]} +{"user_id":"u058781705","problem_id":"p03309","language":"python","submission_id_v0":"s464674593","submission_id_v1":"s594314683","cpu_time_v0":307,"cpu_time_v1":139,"memory_v0":99796,"memory_v1":119408,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.72,"input":"N = int(eval(input()))\n\nalist = list(map(int, input().split()))\n\n\n\nblist = []\n\nfor i in range(N):\n\n blist.append(alist[i]-i-1)\n\n\n\nblist.sort()\n\nmid = blist[len(blist)\/\/2]\n\n\n\nans = 0\n\n\n\nfor i in range(N):\n\n ans += abs(blist[i]-mid)\n\n\n\nprint(ans)\n","target":"N = int(eval(input()))\n\nalist = list(map(int, input().split()))\n\n\n\nblist = []\n\n\n\nfor i in range(N):\n\n blist.append(alist[i]-i-1)\n\n\n\nblist.sort()\n\nmid = blist[N\/\/2]\n\n\n\nprint((sum([abs(b-mid) for b in blist])))\n","code_v0_loc":16,"code_v1_loc":12,"code_v0_num_chars":245,"code_v1_num_chars":204,"code_v0_no_empty_lines":"N = int(eval(input()))\nalist = list(map(int, input().split()))\nblist = []\nfor i in range(N):\n blist.append(alist[i] - i - 1)\nblist.sort()\nmid = blist[len(blist) \/\/ 2]\nans = 0\nfor i in range(N):\n ans += abs(blist[i] - mid)\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nalist = list(map(int, input().split()))\nblist = []\nfor i in range(N):\n blist.append(alist[i] - i - 1)\nblist.sort()\nmid = blist[N \/\/ 2]\nprint((sum([abs(b - mid) for b in blist])))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-mid = blist[len(blist) \/\/ 2]","-ans = 0","-for i in range(N):","- ans += abs(blist[i] - mid)","-print(ans)","+mid = blist[N \/\/ 2]","+print((sum([abs(b - mid) for b in blist])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.034146276,"measured_runtime_v1":0.0347194195,"runtime_lift":0.9834921349,"key":["s464674593","s594314683"]} +{"user_id":"u597455618","problem_id":"p03588","language":"python","submission_id_v0":"s406588537","submission_id_v1":"s060665270","cpu_time_v0":502,"cpu_time_v1":456,"memory_v0":29920,"memory_v1":27884,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.16,"input":"n = int(eval(input()))\n\na = [[]]*n\n\nfor i in range(n):\n\n a[i] = list(map(int, input().split()))\n\n\n\na.sort()\n\nprint((a[-1][0]+a[-1][1]))","target":"def main():\n\n n = int(eval(input()))\n\n a = [[]]*n\n\n for i in range(n):\n\n a[i] = list(map(int, input().split()))\n\n\n\n a.sort()\n\n print((a[-1][0]+a[-1][1]))\n\n\n\nmain()","code_v0_loc":7,"code_v1_loc":10,"code_v0_num_chars":128,"code_v1_num_chars":163,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [[]] * n\nfor i in range(n):\n a[i] = list(map(int, input().split()))\na.sort()\nprint((a[-1][0] + a[-1][1]))\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n a = [[]] * n\n for i in range(n):\n a[i] = list(map(int, input().split()))\n a.sort()\n print((a[-1][0] + a[-1][1]))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-n = int(eval(input()))","-a = [[]] * n","-for i in range(n):","- a[i] = list(map(int, input().split()))","-a.sort()","-print((a[-1][0] + a[-1][1]))","+def main():","+ n = int(eval(input()))","+ a = [[]] * n","+ for i in range(n):","+ a[i] = list(map(int, input().split()))","+ a.sort()","+ print((a[-1][0] + a[-1][1]))","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0431376724,"measured_runtime_v1":0.0431374221,"runtime_lift":1.0000058031,"key":["s406588537","s060665270"]} +{"user_id":"u312025627","problem_id":"p03494","language":"python","submission_id_v0":"s880434485","submission_id_v1":"s585779020","cpu_time_v0":200,"cpu_time_v1":177,"memory_v0":39280,"memory_v1":39024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.5,"input":"n = int(eval(input()))\n\na = [int(i) for i in input().split()]\n\nans = 0\n\nwhile not any(i&1 for i in a):\n\n ans += 1\n\n a = [i\/\/2 for i in a]\n\n\n\nprint(ans)","target":"n = int(eval(input()))\n\na = {int(i) for i in input().split()}\n\nans = 0\n\nwhile not any(i&1 for i in a):\n\n ans += 1\n\n a = {i\/\/2 for i in a}\n\n\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":151,"code_v1_num_chars":151,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [int(i) for i in input().split()]\nans = 0\nwhile not any(i & 1 for i in a):\n ans += 1\n a = [i \/\/ 2 for i in a]\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = {int(i) for i in input().split()}\nans = 0\nwhile not any(i & 1 for i in a):\n ans += 1\n a = {i \/\/ 2 for i in a}\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a = [int(i) for i in input().split()]","+a = {int(i) for i in input().split()}","- a = [i \/\/ 2 for i in a]","+ a = {i \/\/ 2 for i in a}"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372966189,"measured_runtime_v1":0.0435009177,"runtime_lift":0.8573754515,"key":["s880434485","s585779020"]} +{"user_id":"u889914341","problem_id":"p03195","language":"python","submission_id_v0":"s072191922","submission_id_v1":"s006939360","cpu_time_v0":188,"cpu_time_v1":62,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.02,"input":"def solve():\n\n for _ in range(int(eval(input()))):\n\n if int(eval(input())) & 1:\n\n return \"first\"\n\n return \"second \"\n\nprint((solve()))","target":"import sys\n\nreadline = sys.stdin.readline\n\nfrom itertools import product\n\ndef solve():\n\n for _ in range(int(eval(input()))):\n\n if int(readline()) & 1:\n\n return \"first\"\n\n return \"second \"\n\nprint((solve()))\n","code_v0_loc":6,"code_v1_loc":9,"code_v0_num_chars":143,"code_v1_num_chars":221,"code_v0_no_empty_lines":"def solve():\n for _ in range(int(eval(input()))):\n if int(eval(input())) & 1:\n return \"first\"\n return \"second \"\n\n\nprint((solve()))\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nfrom itertools import product\n\n\ndef solve():\n for _ in range(int(eval(input()))):\n if int(readline()) & 1:\n return \"first\"\n return \"second \"\n\n\nprint((solve()))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["+import sys","+","+readline = sys.stdin.readline","+from itertools import product","+","+","- if int(eval(input())) & 1:","+ if int(readline()) & 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0426618576,"measured_runtime_v1":0.040697813,"runtime_lift":1.0482592163,"key":["s072191922","s006939360"]} +{"user_id":"u129978636","problem_id":"p03337","language":"python","submission_id_v0":"s906661973","submission_id_v1":"s305573920","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"A, B = list(map( int, input().split()))\n\n\n\nC = [ A + B, A - B, A * B]\n\n\n\nprint((max(C)))\n\n\n","target":"A, B = list(map( int, input().split()))\n\n\n\nprint((max( A + B, A - B, A * B)))","code_v0_loc":6,"code_v1_loc":3,"code_v0_num_chars":83,"code_v1_num_chars":69,"code_v0_no_empty_lines":"A, B = list(map(int, input().split()))\nC = [A + B, A - B, A * B]\nprint((max(C)))\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\nprint((max(A + B, A - B, A * B)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-C = [A + B, A - B, A * B]","-print((max(C)))","+print((max(A + B, A - B, A * B)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0396695349,"measured_runtime_v1":0.0390300143,"runtime_lift":1.0163853549,"key":["s906661973","s305573920"]} +{"user_id":"u201234972","problem_id":"p02757","language":"python","submission_id_v0":"s254920857","submission_id_v1":"s636920570","cpu_time_v0":449,"cpu_time_v1":121,"memory_v0":6436,"memory_v1":6436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.05,"input":"def main():\n\n N, P = list(map( int ,input().split()))\n\n S = [ int(s) for s in list(eval(input()))][::-1]\n\n if P == 2 or P == 5:\n\n ans = 0\n\n for i in range(N):\n\n if S[i]%P == 0:\n\n ans += N-i\n\n print(ans)\n\n return\n\n L = [0]*P\n\n L[0] = 1\n\n t = 0\n\n for i in range(N):\n\n t = (S[i]*pow(10,i,P)+t)%P\n\n L[t] += 1\n\n ans = 0\n\n for l in L:\n\n ans += l*(l-1)\/\/2\n\n print(ans)\n\n \n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n N, P = list(map( int ,input().split()))\n\n S = [ int(s) for s in list(eval(input()))][::-1]\n\n if P == 2 or P == 5:\n\n ans = 0\n\n for i in range(N):\n\n if S[i]%P == 0:\n\n ans += N-i\n\n print(ans)\n\n return\n\n L = [0]*P\n\n L[0] = 1\n\n t = 0\n\n s = 1\n\n for i in range(N):\n\n t = (S[i]*s+t)%P\n\n L[t] += 1\n\n s *= 10\n\n s %= P\n\n ans = 0\n\n for l in L:\n\n ans += l*(l-1)\/\/2\n\n print(ans)\n\n \n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":23,"code_v1_loc":26,"code_v0_num_chars":501,"code_v1_num_chars":535,"code_v0_no_empty_lines":"def main():\n N, P = list(map(int, input().split()))\n S = [int(s) for s in list(eval(input()))][::-1]\n if P == 2 or P == 5:\n ans = 0\n for i in range(N):\n if S[i] % P == 0:\n ans += N - i\n print(ans)\n return\n L = [0] * P\n L[0] = 1\n t = 0\n for i in range(N):\n t = (S[i] * pow(10, i, P) + t) % P\n L[t] += 1\n ans = 0\n for l in L:\n ans += l * (l - 1) \/\/ 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N, P = list(map(int, input().split()))\n S = [int(s) for s in list(eval(input()))][::-1]\n if P == 2 or P == 5:\n ans = 0\n for i in range(N):\n if S[i] % P == 0:\n ans += N - i\n print(ans)\n return\n L = [0] * P\n L[0] = 1\n t = 0\n s = 1\n for i in range(N):\n t = (S[i] * s + t) % P\n L[t] += 1\n s *= 10\n s %= P\n ans = 0\n for l in L:\n ans += l * (l - 1) \/\/ 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":11.5384615385,"diff":["+ s = 1","- t = (S[i] * pow(10, i, P) + t) % P","+ t = (S[i] * s + t) % P","+ s *= 10","+ s %= P"],"diff_only_import_comment":false,"measured_runtime_v0":0.0367995973,"measured_runtime_v1":0.0438628337,"runtime_lift":0.8389699005,"key":["s254920857","s636920570"]} +{"user_id":"u185896732","problem_id":"p03013","language":"python","submission_id_v0":"s676251500","submission_id_v1":"s064787429","cpu_time_v0":369,"cpu_time_v1":192,"memory_v0":461044,"memory_v1":7668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.97,"input":"n,m=list(map(int,input().split()))\n\nstair_m=[True]*(110000)\n\nfor i in range(m):\n\n a=int(eval(input()))\n\n stair_m[a]=False\n\ndp=[0]*(110000)\n\ndp[0]=1\n\nfor i in range(1,n+1):\n\n if stair_m[i]:\n\n dp[i]=dp[i-1]+dp[i-2]\n\n else:\n\n dp[i]=0\n\nprint((dp[n]%1000000007))","target":"n,m=list(map(int,input().split()))\n\nstair=[False]*(n+1)\n\nfor i in range(m):\n\n a=int(eval(input()))\n\n stair[a]=True\n\n\n\n\n\ndp=[0]*(n+1)\n\ndp[0]=1\n\n\n\nfor i in range(1,n+1):\n\n if stair[i]:\n\n dp[i]=0\n\n else:\n\n dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)\n\nprint((dp[n]))","code_v0_loc":13,"code_v1_loc":16,"code_v0_num_chars":269,"code_v1_num_chars":264,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nstair_m = [True] * (110000)\nfor i in range(m):\n a = int(eval(input()))\n stair_m[a] = False\ndp = [0] * (110000)\ndp[0] = 1\nfor i in range(1, n + 1):\n if stair_m[i]:\n dp[i] = dp[i - 1] + dp[i - 2]\n else:\n dp[i] = 0\nprint((dp[n] % 1000000007))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nstair = [False] * (n + 1)\nfor i in range(m):\n a = int(eval(input()))\n stair[a] = True\ndp = [0] * (n + 1)\ndp[0] = 1\nfor i in range(1, n + 1):\n if stair[i]:\n dp[i] = 0\n else:\n dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7)\nprint((dp[n]))\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-stair_m = [True] * (110000)","+stair = [False] * (n + 1)","- stair_m[a] = False","-dp = [0] * (110000)","+ stair[a] = True","+dp = [0] * (n + 1)","- if stair_m[i]:","- dp[i] = dp[i - 1] + dp[i - 2]","+ if stair[i]:","+ dp[i] = 0","- dp[i] = 0","-print((dp[n] % 1000000007))","+ dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7)","+print((dp[n]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1939449756,"measured_runtime_v1":0.0760662055,"runtime_lift":2.5496864779,"key":["s676251500","s064787429"]} +{"user_id":"u681444474","problem_id":"p03854","language":"python","submission_id_v0":"s043727083","submission_id_v1":"s777646733","cpu_time_v0":1018,"cpu_time_v1":41,"memory_v0":135036,"memory_v1":9212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.97,"input":"# coding: utf-8\n\n# Your code here!\n\nS = eval(input())\n\nN = len(S)\n\n\n\nS = S[::-1]\n\n#print(S)\n\nL = ['maerd', 'remaerd', 'esare', 'resare']\n\n\n\nwhile len(S) > 0:\n\n if S[:5] in L:\n\n S = S[5:]\n\n elif S[:6] in L:\n\n S = S[6:]\n\n elif S[:7] in L:\n\n S = S[7:]\n\n else:\n\n print('NO')\n\n break\n\nif len(S) == 0:\n\n print('YES')","target":"# coding: utf-8\n\nimport math\n\n#n = int(input())\n\n#x, y = map(int,input().split())\n\n#A = list(map(int,input().split()))\n\nans = 0\n\ns = eval(input())\n\nn = len(s)\n\ns=s[::-1]\n\ni=0\n\nflg=True\n\nwhile True:\n\n if i>=n:\n\n break\n\n if s[i:i+7]==\"remaerd\":\n\n i+=7\n\n elif s[i:i+6]==\"resare\":\n\n i+=6\n\n elif s[i:i+5]==\"maerd\" or s[i:i+5]==\"esare\":\n\n i+=5\n\n else:\n\n flg=False\n\n break\n\nif flg:\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")","code_v0_loc":21,"code_v1_loc":27,"code_v0_num_chars":354,"code_v1_num_chars":467,"code_v0_no_empty_lines":"# coding: utf-8\n# Your code here!\nS = eval(input())\nN = len(S)\nS = S[::-1]\n# print(S)\nL = [\"maerd\", \"remaerd\", \"esare\", \"resare\"]\nwhile len(S) > 0:\n if S[:5] in L:\n S = S[5:]\n elif S[:6] in L:\n S = S[6:]\n elif S[:7] in L:\n S = S[7:]\n else:\n print(\"NO\")\n break\nif len(S) == 0:\n print(\"YES\")\n","code_v1_no_empty_lines":"# coding: utf-8\nimport math\n\n# n = int(input())\n# x, y = map(int,input().split())\n# A = list(map(int,input().split()))\nans = 0\ns = eval(input())\nn = len(s)\ns = s[::-1]\ni = 0\nflg = True\nwhile True:\n if i >= n:\n break\n if s[i : i + 7] == \"remaerd\":\n i += 7\n elif s[i : i + 6] == \"resare\":\n i += 6\n elif s[i : i + 5] == \"maerd\" or s[i : i + 5] == \"esare\":\n i += 5\n else:\n flg = False\n break\nif flg:\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-# Your code here!","-S = eval(input())","-N = len(S)","-S = S[::-1]","-# print(S)","-L = [\"maerd\", \"remaerd\", \"esare\", \"resare\"]","-while len(S) > 0:","- if S[:5] in L:","- S = S[5:]","- elif S[:6] in L:","- S = S[6:]","- elif S[:7] in L:","- S = S[7:]","+import math","+","+# n = int(input())","+# x, y = map(int,input().split())","+# A = list(map(int,input().split()))","+ans = 0","+s = eval(input())","+n = len(s)","+s = s[::-1]","+i = 0","+flg = True","+while True:","+ if i >= n:","+ break","+ if s[i : i + 7] == \"remaerd\":","+ i += 7","+ elif s[i : i + 6] == \"resare\":","+ i += 6","+ elif s[i : i + 5] == \"maerd\" or s[i : i + 5] == \"esare\":","+ i += 5","- print(\"NO\")","+ flg = False","-if len(S) == 0:","+if flg:","+else:","+ print(\"NO\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0860127039,"measured_runtime_v1":0.0372297804,"runtime_lift":2.3103199338,"key":["s043727083","s777646733"]} +{"user_id":"u652569315","problem_id":"p03013","language":"python","submission_id_v0":"s405972285","submission_id_v1":"s367843773","cpu_time_v0":63,"cpu_time_v1":51,"memory_v0":6900,"memory_v1":6900,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"def main():\n\n import sys\n\n input = sys.stdin.readline\n\n n,m=list(map(int,input().split()))\n\n mod=pow(10,9)+7\n\n ans=[1]*(n+1)\n\n for _ in [0]*m:\n\n ans[int(eval(input()))]=0\n\n for i in range(n+1):\n\n ans[i]=ans[i] if ans[i]==0 or i<2 else (ans[i-1]+ans[i-2])%mod\n\n print((ans[-1]))\n\nif __name__ == '__main__':\n\n main()","target":"def main():\n\n import sys\n\n input = sys.stdin.readline\n\n n,m=list(map(int,input().split()))\n\n mod=pow(10,9)+7\n\n ans=[1]*(n+1)\n\n for _ in [0]*m:\n\n ans[int(eval(input()))]=0\n\n for i in range(2,n+1):\n\n if ans[i]>0:\n\n ans[i]=(ans[i-1]+ans[i-2])%mod\n\n print((ans[-1]))\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":13,"code_v1_loc":14,"code_v0_num_chars":317,"code_v1_num_chars":307,"code_v0_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.readline\n n, m = list(map(int, input().split()))\n mod = pow(10, 9) + 7\n ans = [1] * (n + 1)\n for _ in [0] * m:\n ans[int(eval(input()))] = 0\n for i in range(n + 1):\n ans[i] = ans[i] if ans[i] == 0 or i < 2 else (ans[i - 1] + ans[i - 2]) % mod\n print((ans[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.readline\n n, m = list(map(int, input().split()))\n mod = pow(10, 9) + 7\n ans = [1] * (n + 1)\n for _ in [0] * m:\n ans[int(eval(input()))] = 0\n for i in range(2, n + 1):\n if ans[i] > 0:\n ans[i] = (ans[i - 1] + ans[i - 2]) % mod\n print((ans[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["- for i in range(n + 1):","- ans[i] = ans[i] if ans[i] == 0 or i < 2 else (ans[i - 1] + ans[i - 2]) % mod","+ for i in range(2, n + 1):","+ if ans[i] > 0:","+ ans[i] = (ans[i - 1] + ans[i - 2]) % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.037384722,"measured_runtime_v1":0.0355144176,"runtime_lift":1.052663241,"key":["s405972285","s367843773"]} +{"user_id":"u197615397","problem_id":"p02235","language":"python","submission_id_v0":"s322761980","submission_id_v1":"s071258484","cpu_time_v0":2980,"cpu_time_v1":1360,"memory_v0":216100,"memory_v1":123684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.36,"input":"from bisect import bisect_left\n\nq = int(eval(input()))\n\nfor _ in [0]*q:\n\n s1, s2 = eval(input()), eval(input())\n\n l1, l2 = len(s1), len(s2)\n\n\n\n p = []\n\n for i, c in enumerate(s1):\n\n s = 0\n\n while True:\n\n j = s2[s:].find(c)\n\n if j == -1:\n\n break\n\n p.append((i, s+j))\n\n s += j+1\n\n\n\n lis = []\n\n for _, y in sorted(p, key=lambda x: (x[0], -x[1])):\n\n i = bisect_left(lis, y)\n\n if len(lis) <= i:\n\n lis.append(y)\n\n else:\n\n lis[i] = y\n\n print((len(lis)))\n","target":"def lcs_hs(s1, s2):\n\n from bisect import bisect_left\n\n\n\n p = []\n\n append_p = p.append\n\n for i, c in enumerate(s1):\n\n j = s2.find(c)+1\n\n while j:\n\n append_p((i, -j))\n\n j = s2.find(c, j)+1\n\n\n\n lis, result = [], 0\n\n append_lis = lis.append\n\n for _, y in sorted(p):\n\n i = bisect_left(lis, -y)\n\n if i >= result:\n\n append_lis(-y)\n\n result += 1\n\n else:\n\n lis[i] = -y\n\n\n\n return result\n\n\n\n\n\nprint(*(lcs_hs(input(), input()) for _ in [0]*int(input())), sep=\"\\n\")\n","code_v0_loc":24,"code_v1_loc":25,"code_v0_num_chars":564,"code_v1_num_chars":568,"code_v0_no_empty_lines":"from bisect import bisect_left\n\nq = int(eval(input()))\nfor _ in [0] * q:\n s1, s2 = eval(input()), eval(input())\n l1, l2 = len(s1), len(s2)\n p = []\n for i, c in enumerate(s1):\n s = 0\n while True:\n j = s2[s:].find(c)\n if j == -1:\n break\n p.append((i, s + j))\n s += j + 1\n lis = []\n for _, y in sorted(p, key=lambda x: (x[0], -x[1])):\n i = bisect_left(lis, y)\n if len(lis) <= i:\n lis.append(y)\n else:\n lis[i] = y\n print((len(lis)))\n","code_v1_no_empty_lines":"def lcs_hs(s1, s2):\n from bisect import bisect_left\n\n p = []\n append_p = p.append\n for i, c in enumerate(s1):\n j = s2.find(c) + 1\n while j:\n append_p((i, -j))\n j = s2.find(c, j) + 1\n lis, result = [], 0\n append_lis = lis.append\n for _, y in sorted(p):\n i = bisect_left(lis, -y)\n if i >= result:\n append_lis(-y)\n result += 1\n else:\n lis[i] = -y\n return result\n\n\nprint(*(lcs_hs(input(), input()) for _ in [0] * int(input())), sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["-from bisect import bisect_left","+def lcs_hs(s1, s2):","+ from bisect import bisect_left","-q = int(eval(input()))","-for _ in [0] * q:","- s1, s2 = eval(input()), eval(input())","- l1, l2 = len(s1), len(s2)","+ append_p = p.append","- s = 0","- while True:","- j = s2[s:].find(c)","- if j == -1:","- break","- p.append((i, s + j))","- s += j + 1","- lis = []","- for _, y in sorted(p, key=lambda x: (x[0], -x[1])):","- i = bisect_left(lis, y)","- if len(lis) <= i:","- lis.append(y)","+ j = s2.find(c) + 1","+ while j:","+ append_p((i, -j))","+ j = s2.find(c, j) + 1","+ lis, result = [], 0","+ append_lis = lis.append","+ for _, y in sorted(p):","+ i = bisect_left(lis, -y)","+ if i >= result:","+ append_lis(-y)","+ result += 1","- lis[i] = y","- print((len(lis)))","+ lis[i] = -y","+ return result","+","+","+print(*(lcs_hs(input(), input()) for _ in [0] * int(input())), sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.106498975,"measured_runtime_v1":0.1267168841,"runtime_lift":0.840448183,"key":["s322761980","s071258484"]} +{"user_id":"u352394527","problem_id":"p00458","language":"python","submission_id_v0":"s724761345","submission_id_v1":"s810332131","cpu_time_v0":210,"cpu_time_v1":180,"memory_v0":5816,"memory_v1":5812,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"def solve():\n\n while True:\n\n m, n = int(eval(input())), int(eval(input()))\n\n if not m:\n\n break\n\n ices = [[0] + list(map(int,input().split())) + [0] for _ in range(n)]\n\n ices.insert(0, [0] * (m + 2),)\n\n ices.append([0] * (m + 2))\n\n score = [[0] * (m + 2) for _ in range(n + 2)]\n\n \n\n for x in range(1, n + 1):\n\n for y in range(1, m + 1):\n\n score[x][y] = ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1] \n\n def search(x, y, imap, acc):\n\n imap[x][y] = 0\n\n acc += 1\n\n a = b = c = d = 0\n\n if imap[x - 1][y]:\n\n a = search(x - 1, y, imap, acc)\n\n if imap[x + 1][y]:\n\n b = search(x + 1, y, imap, acc)\n\n if imap[x][y - 1]:\n\n c = search(x, y - 1, imap, acc)\n\n if imap[x][y + 1]:\n\n d = search(x, y + 1, imap, acc)\n\n imap[x][y] = 1\n\n return max(acc, a, b, c, d)\n\n \n\n ans = 0\n\n for x in range(1, n + 1):\n\n for y in range(1, m + 1):\n\n if score[x][y] in [1, 2] and ices[x][y]:\n\n a = search(x, y, ices, 0)\n\n if ans < a:\n\n ans = a\n\n \n\n print(ans)\n\n\n\nsolve()\n","target":"def solve():\n\n while True:\n\n m, n = int(eval(input())), int(eval(input()))\n\n if not m:\n\n break\n\n ices = [[0] + list(map(int,input().split())) + [0] for _ in range(n)]\n\n ices.insert(0, [0] * (m + 2),)\n\n ices.append([0] * (m + 2))\n\n score = [[0] * (m + 2) for _ in range(n + 2)]\n\n \n\n for x in range(1, n + 1):\n\n for y in range(1, m + 1):\n\n score[x][y] = ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1] \n\n\n\n def search(x, y, imap, acc):\n\n imap[x][y] = 0\n\n acc += 1\n\n ret = acc\n\n a = b = c = d = 0\n\n if imap[x - 1][y]:\n\n a = search(x - 1, y, imap, acc)\n\n if ret < a:\n\n ret = a\n\n if imap[x + 1][y]:\n\n b = search(x + 1, y, imap, acc)\n\n if ret < b:\n\n ret = b\n\n if imap[x][y - 1]:\n\n c = search(x, y - 1, imap, acc)\n\n if ret < c:\n\n ret = c\n\n if imap[x][y + 1]:\n\n d = search(x, y + 1, imap, acc)\n\n if ret < d:\n\n ret = d\n\n imap[x][y] = 1\n\n return ret\n\n \n\n ans = 0\n\n for x in range(1, n + 1):\n\n for y in range(1, m + 1):\n\n if score[x][y] in [1, 2] and ices[x][y]:\n\n a = search(x, y, ices, 0)\n\n if ans < a:\n\n ans = a\n\n \n\n print(ans)\n\n\n\nsolve()\n","code_v0_loc":39,"code_v1_loc":49,"code_v0_num_chars":1119,"code_v1_num_chars":1281,"code_v0_no_empty_lines":"def solve():\n while True:\n m, n = int(eval(input())), int(eval(input()))\n if not m:\n break\n ices = [[0] + list(map(int, input().split())) + [0] for _ in range(n)]\n ices.insert(\n 0,\n [0] * (m + 2),\n )\n ices.append([0] * (m + 2))\n score = [[0] * (m + 2) for _ in range(n + 2)]\n for x in range(1, n + 1):\n for y in range(1, m + 1):\n score[x][y] = (\n ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1]\n )\n\n def search(x, y, imap, acc):\n imap[x][y] = 0\n acc += 1\n a = b = c = d = 0\n if imap[x - 1][y]:\n a = search(x - 1, y, imap, acc)\n if imap[x + 1][y]:\n b = search(x + 1, y, imap, acc)\n if imap[x][y - 1]:\n c = search(x, y - 1, imap, acc)\n if imap[x][y + 1]:\n d = search(x, y + 1, imap, acc)\n imap[x][y] = 1\n return max(acc, a, b, c, d)\n\n ans = 0\n for x in range(1, n + 1):\n for y in range(1, m + 1):\n if score[x][y] in [1, 2] and ices[x][y]:\n a = search(x, y, ices, 0)\n if ans < a:\n ans = a\n print(ans)\n\n\nsolve()\n","code_v1_no_empty_lines":"def solve():\n while True:\n m, n = int(eval(input())), int(eval(input()))\n if not m:\n break\n ices = [[0] + list(map(int, input().split())) + [0] for _ in range(n)]\n ices.insert(\n 0,\n [0] * (m + 2),\n )\n ices.append([0] * (m + 2))\n score = [[0] * (m + 2) for _ in range(n + 2)]\n for x in range(1, n + 1):\n for y in range(1, m + 1):\n score[x][y] = (\n ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1]\n )\n\n def search(x, y, imap, acc):\n imap[x][y] = 0\n acc += 1\n ret = acc\n a = b = c = d = 0\n if imap[x - 1][y]:\n a = search(x - 1, y, imap, acc)\n if ret < a:\n ret = a\n if imap[x + 1][y]:\n b = search(x + 1, y, imap, acc)\n if ret < b:\n ret = b\n if imap[x][y - 1]:\n c = search(x, y - 1, imap, acc)\n if ret < c:\n ret = c\n if imap[x][y + 1]:\n d = search(x, y + 1, imap, acc)\n if ret < d:\n ret = d\n imap[x][y] = 1\n return ret\n\n ans = 0\n for x in range(1, n + 1):\n for y in range(1, m + 1):\n if score[x][y] in [1, 2] and ices[x][y]:\n a = search(x, y, ices, 0)\n if ans < a:\n ans = a\n print(ans)\n\n\nsolve()\n","code_same":false,"relative_loc_diff_percent":20.4081632653,"diff":["+ ret = acc","+ if ret < a:","+ ret = a","+ if ret < b:","+ ret = b","+ if ret < c:","+ ret = c","+ if ret < d:","+ ret = d","- return max(acc, a, b, c, d)","+ return ret"],"diff_only_import_comment":false,"measured_runtime_v0":0.0483795402,"measured_runtime_v1":0.0449110332,"runtime_lift":1.0772306223,"key":["s724761345","s810332131"]} +{"user_id":"u367701763","problem_id":"p02686","language":"python","submission_id_v0":"s595915826","submission_id_v1":"s700521957","cpu_time_v0":1641,"cpu_time_v1":950,"memory_v0":234984,"memory_v1":231868,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.11,"input":"N = int(eval(input()))\n\nD, E = [], []\n\nt,l = 0, 0\n\nres = 0\n\nfor _ in range(N):\n\n S = input().rstrip()\n\n x,y = 0,0\n\n for s in S:\n\n if s==\"(\": x+=1\n\n else: x=max(x-1,0)\n\n for s in reversed(S):\n\n if s==\")\": y+=1\n\n else: y=max(y-1,0)\n\n D.append((x,y))\n\nD.sort(key=lambda x:x[1])\n\nt = 0\n\nfor x,y in D:\n\n if x-y>=0:\n\n if t>=y: t+=x-y\n\n else: print(\"No\"); exit()\n\nD.sort(key=lambda x:x[0])\n\ns = 0\n\nfor x,y in D:\n\n if y-x>=0:\n\n if s>=x: s+=y-x\n\n else: print(\"No\"); exit()\n\nif t!=s: print(\"No\")\n\nelse: print(\"Yes\")\n","target":"import sys\n\ninput = sys.stdin.readline\n\nN = int(eval(input()))\n\nD, E = [], []\n\nt,l = 0, 0\n\nres = 0\n\nfor _ in range(N):\n\n S = input().rstrip()\n\n x,y = 0,0\n\n for s in S:\n\n if s==\"(\": x+=1\n\n else: x=max(x-1,0)\n\n for s in reversed(S):\n\n if s==\")\": y+=1\n\n else: y=max(y-1,0)\n\n D.append((x,y))\n\nD.sort(key=lambda x:x[1])\n\nt = 0\n\nfor x,y in D:\n\n if x-y>=0:\n\n if t>=y: t+=x-y\n\n else: print(\"No\"); exit()\n\nD.sort(key=lambda x:x[0])\n\ns = 0\n\nfor x,y in D:\n\n if y-x>=0:\n\n if s>=x: s+=y-x\n\n else: print(\"No\"); exit()\n\nif t!=s: print(\"No\")\n\nelse: print(\"Yes\")\n","code_v0_loc":28,"code_v1_loc":30,"code_v0_num_chars":577,"code_v1_num_chars":617,"code_v0_no_empty_lines":"N = int(eval(input()))\nD, E = [], []\nt, l = 0, 0\nres = 0\nfor _ in range(N):\n S = input().rstrip()\n x, y = 0, 0\n for s in S:\n if s == \"(\":\n x += 1\n else:\n x = max(x - 1, 0)\n for s in reversed(S):\n if s == \")\":\n y += 1\n else:\n y = max(y - 1, 0)\n D.append((x, y))\nD.sort(key=lambda x: x[1])\nt = 0\nfor x, y in D:\n if x - y >= 0:\n if t >= y:\n t += x - y\n else:\n print(\"No\")\n exit()\nD.sort(key=lambda x: x[0])\ns = 0\nfor x, y in D:\n if y - x >= 0:\n if s >= x:\n s += y - x\n else:\n print(\"No\")\n exit()\nif t != s:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nD, E = [], []\nt, l = 0, 0\nres = 0\nfor _ in range(N):\n S = input().rstrip()\n x, y = 0, 0\n for s in S:\n if s == \"(\":\n x += 1\n else:\n x = max(x - 1, 0)\n for s in reversed(S):\n if s == \")\":\n y += 1\n else:\n y = max(y - 1, 0)\n D.append((x, y))\nD.sort(key=lambda x: x[1])\nt = 0\nfor x, y in D:\n if x - y >= 0:\n if t >= y:\n t += x - y\n else:\n print(\"No\")\n exit()\nD.sort(key=lambda x: x[0])\ns = 0\nfor x, y in D:\n if y - x >= 0:\n if s >= x:\n s += y - x\n else:\n print(\"No\")\n exit()\nif t != s:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.0359547381,"measured_runtime_v1":0.0361057103,"runtime_lift":0.9958186077,"key":["s595915826","s700521957"]} +{"user_id":"u411203878","problem_id":"p02754","language":"python","submission_id_v0":"s466221311","submission_id_v1":"s787410934","cpu_time_v0":210,"cpu_time_v1":82,"memory_v0":38384,"memory_v1":61604,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.95,"input":"n,a,b = list(map(int,input().split()))\n\n\n\nif (n%(a+b)) == 0:\n\n print(((n\/\/(a+b))*a))\n\nelse:\n\n if (n%(a+b)) < a:\n\n print((((n\/\/(a+b))*a)+(n%(a+b))))\n\n else:\n\n print((((n\/\/(a+b))*a)+a))","target":"N,A,B = list(map(int,input().split()))\n\n\n\nAB = A+B\n\n\n\nshou = N\/\/AB\n\n\n\namari = N%AB\n\n\n\nans = shou*A+min(A,amari)\n\n\n\nprint(ans)","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":196,"code_v1_num_chars":119,"code_v0_no_empty_lines":"n, a, b = list(map(int, input().split()))\nif (n % (a + b)) == 0:\n print(((n \/\/ (a + b)) * a))\nelse:\n if (n % (a + b)) < a:\n print((((n \/\/ (a + b)) * a) + (n % (a + b))))\n else:\n print((((n \/\/ (a + b)) * a) + a))\n","code_v1_no_empty_lines":"N, A, B = list(map(int, input().split()))\nAB = A + B\nshou = N \/\/ AB\namari = N % AB\nans = shou * A + min(A, amari)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-n, a, b = list(map(int, input().split()))","-if (n % (a + b)) == 0:","- print(((n \/\/ (a + b)) * a))","-else:","- if (n % (a + b)) < a:","- print((((n \/\/ (a + b)) * a) + (n % (a + b))))","- else:","- print((((n \/\/ (a + b)) * a) + a))","+N, A, B = list(map(int, input().split()))","+AB = A + B","+shou = N \/\/ AB","+amari = N % AB","+ans = shou * A + min(A, amari)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0355981181,"measured_runtime_v1":0.038409445,"runtime_lift":0.9268063627,"key":["s466221311","s787410934"]} +{"user_id":"u869790980","problem_id":"p03400","language":"python","submission_id_v0":"s807087810","submission_id_v1":"s197456715","cpu_time_v0":383,"cpu_time_v1":57,"memory_v0":85204,"memory_v1":64228,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.12,"input":"\n\n\n\nn = int(input())\n\nd,x = list(map(int, input().split()))\n\nais = [int(input()) for _ in range(n)]\n\n\n\ndef f(ai,d):\n\n\treturn 1 + (d-1)\/(ai)\n\n\n\nprint(x + sum([f(ai,d) for ai in ais] or [0]))","target":"n = int(input())\n\nd,x = list(map(int, input().split()))\n\ndef f(ai,d): return 1 + (d-1)\/(ai)\n\nprint(x + sum([f(int(input()),d) for _ in range(n)] or [0]))","code_v0_loc":10,"code_v1_loc":4,"code_v0_num_chars":194,"code_v1_num_chars":159,"code_v0_no_empty_lines":"n = int(input())\nd, x = list(map(int, input().split()))\nais = [int(input()) for _ in range(n)]\n\n\ndef f(ai, d):\n return 1 + (d - 1) \/ (ai)\n\n\nprint(x + sum([f(ai, d) for ai in ais] or [0]))\n","code_v1_no_empty_lines":"n = int(input())\nd, x = list(map(int, input().split()))\n\n\ndef f(ai, d):\n return 1 + (d - 1) \/ (ai)\n\n\nprint(x + sum([f(int(input()), d) for _ in range(n)] or [0]))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-ais = [int(input()) for _ in range(n)]","-print(x + sum([f(ai, d) for ai in ais] or [0]))","+print(x + sum([f(int(input()), d) for _ in range(n)] or [0]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1241813765,"measured_runtime_v1":0.0379485626,"runtime_lift":3.2723604754,"key":["s807087810","s197456715"]} +{"user_id":"u079022693","problem_id":"p02838","language":"python","submission_id_v0":"s007552685","submission_id_v1":"s652083727","cpu_time_v0":1611,"cpu_time_v1":306,"memory_v0":126852,"memory_v1":48764,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.01,"input":"N=int(eval(input()))\n\nA=list(map(int,input().split()))\n\nbin_A=[bin(c) for c in A]\n\nflags=[True]*N\n\n\n\ncount=0\n\nfor keta in range(60):\n\n count_0=0\n\n count_1=0\n\n for i in range(N):\n\n if flags[i]:\n\n if bin_A[i][-1*(keta+1)]==\"b\":\n\n count_0+=1\n\n flags[i]=False\n\n elif bin_A[i][-1*(keta+1)]==\"0\":\n\n count_0+=1\n\n else:\n\n count_1+=1\n\n elif flags[i]==False:\n\n count_0+=1\n\n count+=count_0*count_1*2**keta\n\n\n\nprint((count%(10**9+7)))","target":"from sys import stdin\n\nimport numpy as np\n\ndef main():\n\n #\u5165\u529b\n\n readline=stdin.readline\n\n mod=10**9+7\n\n n=int(readline())\n\n a=list(map(int,readline().split()))\n\n a=np.array(a,dtype=np.int64)\n\n\n\n b=np.array([((a>>i)&1).sum() for i in range(61)],dtype=np.int64)\n\n c=np.full(61,n,dtype=np.int64)-b\n\n d=b*c\n\n d%=mod\n\n\n\n ans=0\n\n now=1\n\n for i in range(60):\n\n ans+=d[i]*now\n\n ans%=mod\n\n now*=2\n\n now%=mod\n\n\n\n print(ans)\n\n\n\nif __name__==\"__main__\":\n\n main()","code_v0_loc":23,"code_v1_loc":27,"code_v0_num_chars":508,"code_v1_num_chars":522,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nbin_A = [bin(c) for c in A]\nflags = [True] * N\ncount = 0\nfor keta in range(60):\n count_0 = 0\n count_1 = 0\n for i in range(N):\n if flags[i]:\n if bin_A[i][-1 * (keta + 1)] == \"b\":\n count_0 += 1\n flags[i] = False\n elif bin_A[i][-1 * (keta + 1)] == \"0\":\n count_0 += 1\n else:\n count_1 += 1\n elif flags[i] == False:\n count_0 += 1\n count += count_0 * count_1 * 2**keta\nprint((count % (10**9 + 7)))\n","code_v1_no_empty_lines":"from sys import stdin\nimport numpy as np\n\n\ndef main():\n # \u5165\u529b\n readline = stdin.readline\n mod = 10**9 + 7\n n = int(readline())\n a = list(map(int, readline().split()))\n a = np.array(a, dtype=np.int64)\n b = np.array([((a >> i) & 1).sum() for i in range(61)], dtype=np.int64)\n c = np.full(61, n, dtype=np.int64) - b\n d = b * c\n d %= mod\n ans = 0\n now = 1\n for i in range(60):\n ans += d[i] * now\n ans %= mod\n now *= 2\n now %= mod\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":14.8148148148,"diff":["-N = int(eval(input()))","-A = list(map(int, input().split()))","-bin_A = [bin(c) for c in A]","-flags = [True] * N","-count = 0","-for keta in range(60):","- count_0 = 0","- count_1 = 0","- for i in range(N):","- if flags[i]:","- if bin_A[i][-1 * (keta + 1)] == \"b\":","- count_0 += 1","- flags[i] = False","- elif bin_A[i][-1 * (keta + 1)] == \"0\":","- count_0 += 1","- else:","- count_1 += 1","- elif flags[i] == False:","- count_0 += 1","- count += count_0 * count_1 * 2**keta","-print((count % (10**9 + 7)))","+from sys import stdin","+import numpy as np","+","+","+def main():","+ # \u5165\u529b","+ readline = stdin.readline","+ mod = 10**9 + 7","+ n = int(readline())","+ a = list(map(int, readline().split()))","+ a = np.array(a, dtype=np.int64)","+ b = np.array([((a >> i) & 1).sum() for i in range(61)], dtype=np.int64)","+ c = np.full(61, n, dtype=np.int64) - b","+ d = b * c","+ d %= mod","+ ans = 0","+ now = 1","+ for i in range(60):","+ ans += d[i] * now","+ ans %= mod","+ now *= 2","+ now %= mod","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0786713798,"measured_runtime_v1":0.2109864309,"runtime_lift":0.3728741203,"key":["s007552685","s652083727"]} +{"user_id":"u334712262","problem_id":"p03088","language":"python","submission_id_v0":"s339698163","submission_id_v1":"s384280967","cpu_time_v0":250,"cpu_time_v1":124,"memory_v0":5444,"memory_v1":7992,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.4,"input":"# -*- coding: utf-8 -*-\n\nimport bisect\n\nimport heapq\n\nimport math\n\nimport random\n\nimport sys\n\nfrom collections import Counter, defaultdict, deque\n\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\n\nfrom functools import lru_cache, reduce\n\nfrom itertools import combinations, combinations_with_replacement, product, permutations\n\nfrom operator import add, mul, sub\n\n\n\nsys.setrecursionlimit(100000)\n\n\n\n\n\ndef read_int():\n\n return int(input())\n\n\n\n\n\ndef read_int_n():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef read_float():\n\n return float(input())\n\n\n\n\n\ndef read_float_n():\n\n return list(map(float, input().split()))\n\n\n\n\n\ndef read_str():\n\n return input().strip()\n\n\n\n\n\ndef read_str_n():\n\n return list(map(str, input().split()))\n\n\n\n\n\ndef error_print(*args):\n\n print(*args, file=sys.stderr)\n\n\n\n\n\ndef mt(f):\n\n import time\n\n\n\n def wrap(*args, **kwargs):\n\n s = time.time()\n\n ret = f(*args, **kwargs)\n\n e = time.time()\n\n\n\n error_print(e - s, 'sec')\n\n return ret\n\n\n\n return wrap\n\n\n\nclass Mod:\n\n def __init__(self, m):\n\n self.m = m\n\n \n\n def add(self, a, b):\n\n return (a + b ) % self.m\n\n\n\n def sub(self, a, b):\n\n return (a - b) % self.m\n\n \n\n def mul(self, a, b):\n\n return ((a % self.m) * (b % self.m)) % self.m\n\n\n\n def div(self, a, b):\n\n return self.mul(a, self.pow(b, self.m-2))\n\n\n\n def pow(self, x, y):\n\n if y == 0: \n\n return 1\n\n elif y == 1: \n\n return x % self.m\n\n elif y % 2 == 0: \n\n return self.pow(x, y\/\/2)**2 % self.m\n\n else: \n\n return self.pow(x, y\/\/2)**2 * x % self.m\n\n\n\n\n\n@mt\n\ndef slv(N):\n\n if N==3:\n\n return 61\n\n\n\n m = Mod(10**9+7)\n\n dp = {}\n\n iv = [\n\n 'agc',\n\n 'acg',\n\n 'gac',\n\n 'aggc'\n\n 'acgc',\n\n 'atgc',\n\n 'agac',\n\n 'aggc',\n\n 'agtc',\n\n ]\n\n for s in product('agct', repeat=4):\n\n s = ''.join(s)\n\n if not any(map(lambda x: x in s, iv)):\n\n dp[s] = 1\n\n\n\n for _ in range(N-4):\n\n dp_ = Counter()\n\n for k, v in dp.items():\n\n for c in 'agct':\n\n s = k + c\n\n if not any(map(lambda x: x in s, iv)):\n\n dp_[s[1:]] = m.add(v, dp_[s[1:]])\n\n dp = dp_\n\n \n\n ans = 0\n\n for k, v in dp.items():\n\n ans = m.add(ans, v)\n\n\n\n\n\n return ans\n\n\n\n\n\ndef main():\n\n N = read_int()\n\n print(slv(N))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"# -*- coding: utf-8 -*-\n\nimport bisect\n\nimport heapq\n\nimport math\n\nimport random\n\nimport sys\n\nfrom collections import Counter, defaultdict, deque\n\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\n\nfrom functools import lru_cache, reduce\n\nfrom itertools import combinations, combinations_with_replacement, product, permutations\n\nfrom operator import add, mul, sub\n\n\n\nsys.setrecursionlimit(100000)\n\n\n\n\n\ndef read_int():\n\n return int(input())\n\n\n\n\n\ndef read_int_n():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef read_float():\n\n return float(input())\n\n\n\n\n\ndef read_float_n():\n\n return list(map(float, input().split()))\n\n\n\n\n\ndef read_str():\n\n return input().strip()\n\n\n\n\n\ndef read_str_n():\n\n return list(map(str, input().split()))\n\n\n\n\n\ndef error_print(*args):\n\n print(*args, file=sys.stderr)\n\n\n\n\n\ndef mt(f):\n\n import time\n\n\n\n def wrap(*args, **kwargs):\n\n s = time.time()\n\n ret = f(*args, **kwargs)\n\n e = time.time()\n\n\n\n error_print(e - s, 'sec')\n\n return ret\n\n\n\n return wrap\n\n\n\nclass Mod:\n\n def __init__(self, m):\n\n self.m = m\n\n \n\n def add(self, a, b):\n\n return (a + b ) % self.m\n\n\n\n def sub(self, a, b):\n\n return (a - b) % self.m\n\n \n\n def mul(self, a, b):\n\n return ((a % self.m) * (b % self.m)) % self.m\n\n\n\n def div(self, a, b):\n\n return self.mul(a, self.pow(b, self.m-2))\n\n\n\n def pow(self, x, y):\n\n if y == 0: \n\n return 1\n\n elif y == 1: \n\n return x % self.m\n\n elif y % 2 == 0: \n\n return self.pow(x, y\/\/2)**2 % self.m\n\n else: \n\n return self.pow(x, y\/\/2)**2 * x % self.m\n\n\n\n\n\n@mt\n\ndef slv(N):\n\n if N==3:\n\n return 61\n\n\n\n m = Mod(10**9+7)\n\n dp = {}\n\n iv = [\n\n 'agc',\n\n 'acg',\n\n 'gac',\n\n 'aggc'\n\n 'acgc',\n\n 'atgc',\n\n 'agac',\n\n 'aggc',\n\n 'agtc',\n\n ]\n\n for s in product('agct', repeat=4):\n\n s = ''.join(s)\n\n if not any(map(lambda x: x in s, iv)):\n\n dp[s] = 1\n\n\n\n for _ in range(N-4):\n\n dp_ = Counter()\n\n for k, v in dp.items():\n\n for c in 'agct':\n\n s = k + c\n\n s = s[1:]\n\n if s in dp:\n\n dp_[s] = m.add(v, dp_[s])\n\n dp = dp_\n\n \n\n ans = 0\n\n for k, v in dp.items():\n\n ans = m.add(ans, v)\n\n\n\n\n\n return ans\n\n\n\n\n\ndef main():\n\n N = read_int()\n\n print(slv(N))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":130,"code_v1_loc":131,"code_v0_num_chars":2538,"code_v1_num_chars":2530,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(100000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n error_print(e - s, \"sec\")\n return ret\n\n return wrap\n\n\nclass Mod:\n def __init__(self, m):\n self.m = m\n\n def add(self, a, b):\n return (a + b) % self.m\n\n def sub(self, a, b):\n return (a - b) % self.m\n\n def mul(self, a, b):\n return ((a % self.m) * (b % self.m)) % self.m\n\n def div(self, a, b):\n return self.mul(a, self.pow(b, self.m - 2))\n\n def pow(self, x, y):\n if y == 0:\n return 1\n elif y == 1:\n return x % self.m\n elif y % 2 == 0:\n return self.pow(x, y \/\/ 2) ** 2 % self.m\n else:\n return self.pow(x, y \/\/ 2) ** 2 * x % self.m\n\n\n@mt\ndef slv(N):\n if N == 3:\n return 61\n m = Mod(10**9 + 7)\n dp = {}\n iv = [\n \"agc\",\n \"acg\",\n \"gac\",\n \"aggc\" \"acgc\",\n \"atgc\",\n \"agac\",\n \"aggc\",\n \"agtc\",\n ]\n for s in product(\"agct\", repeat=4):\n s = \"\".join(s)\n if not any(map(lambda x: x in s, iv)):\n dp[s] = 1\n for _ in range(N - 4):\n dp_ = Counter()\n for k, v in dp.items():\n for c in \"agct\":\n s = k + c\n if not any(map(lambda x: x in s, iv)):\n dp_[s[1:]] = m.add(v, dp_[s[1:]])\n dp = dp_\n ans = 0\n for k, v in dp.items():\n ans = m.add(ans, v)\n return ans\n\n\ndef main():\n N = read_int()\n print(slv(N))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(100000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n error_print(e - s, \"sec\")\n return ret\n\n return wrap\n\n\nclass Mod:\n def __init__(self, m):\n self.m = m\n\n def add(self, a, b):\n return (a + b) % self.m\n\n def sub(self, a, b):\n return (a - b) % self.m\n\n def mul(self, a, b):\n return ((a % self.m) * (b % self.m)) % self.m\n\n def div(self, a, b):\n return self.mul(a, self.pow(b, self.m - 2))\n\n def pow(self, x, y):\n if y == 0:\n return 1\n elif y == 1:\n return x % self.m\n elif y % 2 == 0:\n return self.pow(x, y \/\/ 2) ** 2 % self.m\n else:\n return self.pow(x, y \/\/ 2) ** 2 * x % self.m\n\n\n@mt\ndef slv(N):\n if N == 3:\n return 61\n m = Mod(10**9 + 7)\n dp = {}\n iv = [\n \"agc\",\n \"acg\",\n \"gac\",\n \"aggc\" \"acgc\",\n \"atgc\",\n \"agac\",\n \"aggc\",\n \"agtc\",\n ]\n for s in product(\"agct\", repeat=4):\n s = \"\".join(s)\n if not any(map(lambda x: x in s, iv)):\n dp[s] = 1\n for _ in range(N - 4):\n dp_ = Counter()\n for k, v in dp.items():\n for c in \"agct\":\n s = k + c\n s = s[1:]\n if s in dp:\n dp_[s] = m.add(v, dp_[s])\n dp = dp_\n ans = 0\n for k, v in dp.items():\n ans = m.add(ans, v)\n return ans\n\n\ndef main():\n N = read_int()\n print(slv(N))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.7633587786,"diff":["- if not any(map(lambda x: x in s, iv)):","- dp_[s[1:]] = m.add(v, dp_[s[1:]])","+ s = s[1:]","+ if s in dp:","+ dp_[s] = m.add(v, dp_[s])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0935584834,"measured_runtime_v1":0.0609362595,"runtime_lift":1.5353499559,"key":["s339698163","s384280967"]} +{"user_id":"u280978334","problem_id":"p03147","language":"python","submission_id_v0":"s684677340","submission_id_v1":"s817882027","cpu_time_v0":63,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":71.43,"input":"n = int(eval(input()))\n\nH = list(map(int,input().split()))\n\nans = 0\n\nsize = sum(H)\n\nwhile(size > 0):\n\n count = 0\n\n temp = 0\n\n for h in H:\n\n if(h == 0 and temp > 0):\n\n ans += 1\n\n break\n\n elif(h != 0):\n\n temp += 1\n\n H[count] -= 1\n\n size -= 1\n\n if(count == n-1):\n\n ans += 1\n\n count += 1\n\nprint(ans)","target":"n = int(eval(input()))\n\nH = list(map(int,input().split()))\n\nans = 0\n\nlst = 0\n\nfor h in H:\n\n if(h > lst):\n\n ans += h-lst\n\n lst = h\n\n\n\nprint(ans)","code_v0_loc":19,"code_v1_loc":10,"code_v0_num_chars":400,"code_v1_num_chars":150,"code_v0_no_empty_lines":"n = int(eval(input()))\nH = list(map(int, input().split()))\nans = 0\nsize = sum(H)\nwhile size > 0:\n count = 0\n temp = 0\n for h in H:\n if h == 0 and temp > 0:\n ans += 1\n break\n elif h != 0:\n temp += 1\n H[count] -= 1\n size -= 1\n if count == n - 1:\n ans += 1\n count += 1\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nH = list(map(int, input().split()))\nans = 0\nlst = 0\nfor h in H:\n if h > lst:\n ans += h - lst\n lst = h\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":47.3684210526,"diff":["-size = sum(H)","-while size > 0:","- count = 0","- temp = 0","- for h in H:","- if h == 0 and temp > 0:","- ans += 1","- break","- elif h != 0:","- temp += 1","- H[count] -= 1","- size -= 1","- if count == n - 1:","- ans += 1","- count += 1","+lst = 0","+for h in H:","+ if h > lst:","+ ans += h - lst","+ lst = h"],"diff_only_import_comment":false,"measured_runtime_v0":0.0420771317,"measured_runtime_v1":0.0406169236,"runtime_lift":1.0359507328,"key":["s684677340","s817882027"]} +{"user_id":"u688587139","problem_id":"p02844","language":"python","submission_id_v0":"s026998192","submission_id_v1":"s964269339","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3188,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"N = int(eval(input()))\n\nS = eval(input())\n\ncount = 0\n\n\n\nfor i in range(0, 10):\n\n if str(i) in S:\n\n idx = S.index(str(i))\n\n for j in range(0, 10):\n\n if str(j) in S[idx+1:]:\n\n idx2 = S[idx+1:].index(str(j)) + idx + 1\n\n for k in range(0, 10):\n\n if str(k) in S[idx2+1:]:\n\n count += 1\n\n\n\nprint(count)\n","target":"N = int(eval(input()))\n\nS = eval(input())\n\ncount = 0\n\nD = 3\n\n\n\n\n\ndef find_number(digits, series):\n\n global count\n\n if digits > 1:\n\n for i in range(0, 10):\n\n if str(i) in series:\n\n idx = series.index(str(i))\n\n find_number(digits - 1, series[idx+1:])\n\n elif digits == 1:\n\n for j in range(0, 10):\n\n if str(j) in series:\n\n count += 1\n\n return count\n\n\n\n\n\nprint((find_number(D, S)))\n","code_v0_loc":15,"code_v1_loc":21,"code_v0_num_chars":384,"code_v1_num_chars":456,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\ncount = 0\nfor i in range(0, 10):\n if str(i) in S:\n idx = S.index(str(i))\n for j in range(0, 10):\n if str(j) in S[idx + 1 :]:\n idx2 = S[idx + 1 :].index(str(j)) + idx + 1\n for k in range(0, 10):\n if str(k) in S[idx2 + 1 :]:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\ncount = 0\nD = 3\n\n\ndef find_number(digits, series):\n global count\n if digits > 1:\n for i in range(0, 10):\n if str(i) in series:\n idx = series.index(str(i))\n find_number(digits - 1, series[idx + 1 :])\n elif digits == 1:\n for j in range(0, 10):\n if str(j) in series:\n count += 1\n return count\n\n\nprint((find_number(D, S)))\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-for i in range(0, 10):","- if str(i) in S:","- idx = S.index(str(i))","+D = 3","+","+","+def find_number(digits, series):","+ global count","+ if digits > 1:","+ for i in range(0, 10):","+ if str(i) in series:","+ idx = series.index(str(i))","+ find_number(digits - 1, series[idx + 1 :])","+ elif digits == 1:","- if str(j) in S[idx + 1 :]:","- idx2 = S[idx + 1 :].index(str(j)) + idx + 1","- for k in range(0, 10):","- if str(k) in S[idx2 + 1 :]:","- count += 1","-print(count)","+ if str(j) in series:","+ count += 1","+ return count","+","+","+print((find_number(D, S)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0428151603,"measured_runtime_v1":0.0441409812,"runtime_lift":0.9699639451,"key":["s026998192","s964269339"]} +{"user_id":"u057964173","problem_id":"p03208","language":"python","submission_id_v0":"s056884219","submission_id_v1":"s941597945","cpu_time_v0":220,"cpu_time_v1":137,"memory_v0":7484,"memory_v1":7384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.73,"input":"def resolve():\n\n n,k=list(map(int, input().split()))\n\n l=[int(eval(input())) for i in range(n)]\n\n l.sort()\n\n print((min(l[i+k-1]-l[i] for i in range(n-k+1))))\n\nresolve()","target":"import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n n,k=list(map(int, input().split()))\n\n l=[int(eval(input())) for i in range(n)]\n\n l.sort()\n\n ans=10**18\n\n for i in range(0,n-k+1):\n\n ans=min(ans,l[i+k-1]-l[i])\n\n print(ans)\n\nresolve()","code_v0_loc":6,"code_v1_loc":12,"code_v0_num_chars":167,"code_v1_num_chars":276,"code_v0_no_empty_lines":"def resolve():\n n, k = list(map(int, input().split()))\n l = [int(eval(input())) for i in range(n)]\n l.sort()\n print((min(l[i + k - 1] - l[i] for i in range(n - k + 1))))\n\n\nresolve()\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n n, k = list(map(int, input().split()))\n l = [int(eval(input())) for i in range(n)]\n l.sort()\n ans = 10**18\n for i in range(0, n - k + 1):\n ans = min(ans, l[i + k - 1] - l[i])\n print(ans)\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["+import sys","+","+","+def input():","+ return sys.stdin.readline().strip()","+","+","- print((min(l[i + k - 1] - l[i] for i in range(n - k + 1))))","+ ans = 10**18","+ for i in range(0, n - k + 1):","+ ans = min(ans, l[i + k - 1] - l[i])","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0328608636,"measured_runtime_v1":0.0341271397,"runtime_lift":0.9628953337,"key":["s056884219","s941597945"]} +{"user_id":"u621935300","problem_id":"p03714","language":"python","submission_id_v0":"s226856276","submission_id_v1":"s270938186","cpu_time_v0":346,"cpu_time_v1":307,"memory_v0":72528,"memory_v1":72400,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.27,"input":"from heapq import heapify,heappush, heappop\n\n\n\nN=eval(input())\n\nA=list(map( int, input().split() )) \n\n\n\nq=A[:N]\n\nheapify(q)\n\nq_sum=sum(q)\n\n\n\nB=[ float(\"-inf\") for i in range(3*N)]\n\nB[N-1]=q_sum\n\n\n\nfor i in range(N,2*N):\n\n\tx=A[i]\n\n\tif x>q[0]:\n\n\t\ttmp=heappop(q)\n\n\t\tq_sum-=tmp\n\n\t\tq_sum+=x\n\n\t\theappush(q,x)\n\n\tB[i]=q_sum\n\n\n\nq=[x*-1 for x in A[2*N:]]\n\nheapify(q)\n\n\n\nq_sum=sum(q)*-1\n\nB[2*N-1]-=q_sum\n\n\n\nfor i in range(2*N-1,N-1,-1):\n\n\tx=A[i]*-1\n\n\tif q[0] hq2[0] q[0]:\n tmp = heappop(q)\n q_sum -= tmp\n q_sum += x\n heappush(q, x)\n B[i] = q_sum\nq = [x * -1 for x in A[2 * N :]]\nheapify(q)\nq_sum = sum(q) * -1\nB[2 * N - 1] -= q_sum\nfor i in range(2 * N - 1, N - 1, -1):\n x = A[i] * -1\n if q[0] < x:\n tmp = heappop(q)\n q_sum -= tmp * -1\n q_sum += x * -1\n heappush(q, x)\n B[i - 1] -= q_sum\nprint(max(B))\n","code_v1_no_empty_lines":"from heapq import heapify, heappush, heappop\n\nN = eval(input())\nA = list(map(int, input().split()))\nhq1 = A[:N]\nheapify(hq1)\nsum1 = sum(hq1)\nT1 = []\nT1.append(sum1)\nfor i in range(N, 2 * N):\n x = A[i]\n if hq1[0] < x:\n u = heappop(hq1)\n heappush(hq1, x)\n sum1 += x - u\n T1.append(sum1)\nhq2 = [x * -1 for x in A[2 * N :]]\nsum2 = -1 * sum(hq2)\nheapify(hq2)\nT2 = []\nT2.append(sum2)\nfor i in range(2 * N - 1, N - 1, -1):\n x = A[i]\n if x * -1 > hq2[0] < x:\n u = heappop(hq2)\n heappush(hq2, x * -1)\n sum2 += u + x\n T2.append(sum2)\nT2.reverse()\nans = float(\"-inf\")\nfor x, y in zip(T1, T2):\n ans = max(ans, x - y)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":22.9166666667,"diff":["-q = A[:N]","-heapify(q)","-q_sum = sum(q)","-B = [float(\"-inf\") for i in range(3 * N)]","-B[N - 1] = q_sum","+hq1 = A[:N]","+heapify(hq1)","+sum1 = sum(hq1)","+T1 = []","+T1.append(sum1)","- if x > q[0]:","- tmp = heappop(q)","- q_sum -= tmp","- q_sum += x","- heappush(q, x)","- B[i] = q_sum","-q = [x * -1 for x in A[2 * N :]]","-heapify(q)","-q_sum = sum(q) * -1","-B[2 * N - 1] -= q_sum","+ if hq1[0] < x:","+ u = heappop(hq1)","+ heappush(hq1, x)","+ sum1 += x - u","+ T1.append(sum1)","+hq2 = [x * -1 for x in A[2 * N :]]","+sum2 = -1 * sum(hq2)","+heapify(hq2)","+T2 = []","+T2.append(sum2)","- x = A[i] * -1","- if q[0] < x:","- tmp = heappop(q)","- q_sum -= tmp * -1","- q_sum += x * -1","- heappush(q, x)","- B[i - 1] -= q_sum","-print(max(B))","+ x = A[i]","+ if x * -1 > hq2[0] < x:","+ u = heappop(hq2)","+ heappush(hq2, x * -1)","+ sum2 += u + x","+ T2.append(sum2)","+T2.reverse()","+ans = float(\"-inf\")","+for x, y in zip(T1, T2):","+ ans = max(ans, x - y)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1054838638,"measured_runtime_v1":0.1177558506,"runtime_lift":0.895784484,"key":["s226856276","s270938186"]} +{"user_id":"u003475507","problem_id":"p02820","language":"python","submission_id_v0":"s038453680","submission_id_v1":"s151377169","cpu_time_v0":226,"cpu_time_v1":207,"memory_v0":56076,"memory_v1":49648,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.41,"input":"n,k=list(map(int,input().split()))\n\nr,s,p=list(map(int,input().split()))\n\nt=list(eval(input()))\n\n\n\n# d={'r':0,'s':0,'p':0}\n\nd={}\n\nans=0\n\nc=0\n\nfor i in t:\n\n\n\n if c >= k:\n\n x =d[c-k]\n\n y = c+k\n\n if i =='r':\n\n if x == 'p':\n\n if y < n and t[y] == 's':\n\n d[c]='s'\n\n else:\n\n d[c]='r'\n\n else:\n\n ans += p ; d[c]='p'\n\n elif i == 's': \n\n if x == 'r':\n\n if y < n and t[y] == 'p' :\n\n d[c]='p'\n\n else:\n\n d[c]='s'\n\n else:\n\n ans += r;d[c]='r'\n\n elif i == 'p': \n\n if x == 's':\n\n if y < n and t[y] == 'r':\n\n d[c]='r'\n\n else:\n\n d[c]='p'\n\n else:\n\n ans += s;d[c]='s'\n\n\n\n else:\n\n if i =='r':\n\n ans += p ; d[c]='p'\n\n elif i == 's': \n\n ans += r;d[c]='r'\n\n elif i == 'p': \n\n ans += s;d[c]='s'\n\n\n\n c+=1\n\n\n\n\n\nprint(ans)","target":"n,k=list(map(int,input().split()))\n\nr,s,p=list(map(int,input().split()))\n\nt=list(eval(input()))\n\n \n\nres=0\n\nfor i in range(n):\n\n if i>k-1 and t[i-k]==t[i]:\n\n t[i]=\"n\"\n\n if t[i]==\"r\":\n\n res+=p\n\n elif t[i]==\"s\":\n\n res+=r\n\n elif t[i]==\"p\":\n\n res+=s\n\n \n\nprint(res)","code_v0_loc":50,"code_v1_loc":16,"code_v0_num_chars":1086,"code_v1_num_chars":258,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nr, s, p = list(map(int, input().split()))\nt = list(eval(input()))\n# d={'r':0,'s':0,'p':0}\nd = {}\nans = 0\nc = 0\nfor i in t:\n if c >= k:\n x = d[c - k]\n y = c + k\n if i == \"r\":\n if x == \"p\":\n if y < n and t[y] == \"s\":\n d[c] = \"s\"\n else:\n d[c] = \"r\"\n else:\n ans += p\n d[c] = \"p\"\n elif i == \"s\":\n if x == \"r\":\n if y < n and t[y] == \"p\":\n d[c] = \"p\"\n else:\n d[c] = \"s\"\n else:\n ans += r\n d[c] = \"r\"\n elif i == \"p\":\n if x == \"s\":\n if y < n and t[y] == \"r\":\n d[c] = \"r\"\n else:\n d[c] = \"p\"\n else:\n ans += s\n d[c] = \"s\"\n else:\n if i == \"r\":\n ans += p\n d[c] = \"p\"\n elif i == \"s\":\n ans += r\n d[c] = \"r\"\n elif i == \"p\":\n ans += s\n d[c] = \"s\"\n c += 1\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nr, s, p = list(map(int, input().split()))\nt = list(eval(input()))\nres = 0\nfor i in range(n):\n if i > k - 1 and t[i - k] == t[i]:\n t[i] = \"n\"\n if t[i] == \"r\":\n res += p\n elif t[i] == \"s\":\n res += r\n elif t[i] == \"p\":\n res += s\nprint(res)\n","code_same":false,"relative_loc_diff_percent":68.0,"diff":["-# d={'r':0,'s':0,'p':0}","-d = {}","-ans = 0","-c = 0","-for i in t:","- if c >= k:","- x = d[c - k]","- y = c + k","- if i == \"r\":","- if x == \"p\":","- if y < n and t[y] == \"s\":","- d[c] = \"s\"","- else:","- d[c] = \"r\"","- else:","- ans += p","- d[c] = \"p\"","- elif i == \"s\":","- if x == \"r\":","- if y < n and t[y] == \"p\":","- d[c] = \"p\"","- else:","- d[c] = \"s\"","- else:","- ans += r","- d[c] = \"r\"","- elif i == \"p\":","- if x == \"s\":","- if y < n and t[y] == \"r\":","- d[c] = \"r\"","- else:","- d[c] = \"p\"","- else:","- ans += s","- d[c] = \"s\"","- else:","- if i == \"r\":","- ans += p","- d[c] = \"p\"","- elif i == \"s\":","- ans += r","- d[c] = \"r\"","- elif i == \"p\":","- ans += s","- d[c] = \"s\"","- c += 1","-print(ans)","+res = 0","+for i in range(n):","+ if i > k - 1 and t[i - k] == t[i]:","+ t[i] = \"n\"","+ if t[i] == \"r\":","+ res += p","+ elif t[i] == \"s\":","+ res += r","+ elif t[i] == \"p\":","+ res += s","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0358849208,"measured_runtime_v1":0.0333865855,"runtime_lift":1.074830514,"key":["s038453680","s151377169"]} +{"user_id":"u588794534","problem_id":"p02923","language":"python","submission_id_v0":"s386507474","submission_id_v1":"s598970310","cpu_time_v0":230,"cpu_time_v1":86,"memory_v0":63984,"memory_v1":85464,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.61,"input":"n=int(eval(input()))\n\ns=list(map(int,input().split()))\n\n\n\ni=1\n\ncnt=0\n\ncnt_max=0\n\nwhile i= 0:\n\n print('Yes')\n\nelse:\n\n print('No')\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\n\n\nYES = \"Yes\" # type: str\n\nNO = \"No\" # type: str\n\n\n\n\n\ndef solve(D: int, T: int, S: int):\n\n\n\n if D <= T*S:\n\n return print('Yes')\n\n else:\n\n return print('No')\n\n\n\n\n\n\n\n# Generated by 1.1.7.1 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n D = int(next(tokens)) # type: int\n\n T = int(next(tokens)) # type: int\n\n S = int(next(tokens)) # type: int\n\n solve(D, T, S)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":7,"code_v1_loc":30,"code_v0_num_chars":107,"code_v1_num_chars":742,"code_v0_no_empty_lines":"D, T, S = list(map(int, input().split()))\na = T * S - D\nif a >= 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\nYES = \"Yes\" # type: str\nNO = \"No\" # type: str\n\n\ndef solve(D: int, T: int, S: int):\n if D <= T * S:\n return print(\"Yes\")\n else:\n return print(\"No\")\n\n\n# Generated by 1.1.7.1 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n D = int(next(tokens)) # type: int\n T = int(next(tokens)) # type: int\n S = int(next(tokens)) # type: int\n solve(D, T, S)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":76.6666666667,"diff":["-D, T, S = list(map(int, input().split()))","-a = T * S - D","-if a >= 0:","- print(\"Yes\")","-else:","- print(\"No\")","+#!\/usr\/bin\/env python3","+import sys","+","+YES = \"Yes\" # type: str","+NO = \"No\" # type: str","+","+","+def solve(D: int, T: int, S: int):","+ if D <= T * S:","+ return print(\"Yes\")","+ else:","+ return print(\"No\")","+","+","+# Generated by 1.1.7.1 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)","+def main():","+ def iterate_tokens():","+ for line in sys.stdin:","+ for word in line.split():","+ yield word","+","+ tokens = iterate_tokens()","+ D = int(next(tokens)) # type: int","+ T = int(next(tokens)) # type: int","+ S = int(next(tokens)) # type: int","+ solve(D, T, S)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0787604685,"measured_runtime_v1":0.0374823654,"runtime_lift":2.1012672942,"key":["s393838498","s496228141"]} +{"user_id":"u150984829","problem_id":"p00514","language":"python","submission_id_v0":"s997442920","submission_id_v1":"s264705127","cpu_time_v0":70,"cpu_time_v1":60,"memory_v0":5672,"memory_v1":5796,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"n,m,r=list(map(int,input().split()))\n\na,b=sorted([n-1,r-m*n])\n\nif a<1:print((0))\n\nelse:\n\n d=1\n\n for i in range(a):d*=i+1\n\n u=1\n\n for i in range(b,a+b):u*=i+1\n\n print((u\/\/d))\n","target":"n,m,r=list(map(int,input().split()))\n\nr-=n*m\n\nif r<0:print((0))\n\nelse:\n\n from math import*\n\n print((factorial(n+r-1)\/\/factorial(r)\/\/factorial(n-1)))\n","code_v0_loc":9,"code_v1_loc":6,"code_v0_num_chars":164,"code_v1_num_chars":139,"code_v0_no_empty_lines":"n, m, r = list(map(int, input().split()))\na, b = sorted([n - 1, r - m * n])\nif a < 1:\n print((0))\nelse:\n d = 1\n for i in range(a):\n d *= i + 1\n u = 1\n for i in range(b, a + b):\n u *= i + 1\n print((u \/\/ d))\n","code_v1_no_empty_lines":"n, m, r = list(map(int, input().split()))\nr -= n * m\nif r < 0:\n print((0))\nelse:\n from math import *\n\n print((factorial(n + r - 1) \/\/ factorial(r) \/\/ factorial(n - 1)))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-a, b = sorted([n - 1, r - m * n])","-if a < 1:","+r -= n * m","+if r < 0:","- d = 1","- for i in range(a):","- d *= i + 1","- u = 1","- for i in range(b, a + b):","- u *= i + 1","- print((u \/\/ d))","+ from math import *","+","+ print((factorial(n + r - 1) \/\/ factorial(r) \/\/ factorial(n - 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0394402504,"measured_runtime_v1":0.0413189411,"runtime_lift":0.954531973,"key":["s997442920","s264705127"]} +{"user_id":"u467736898","problem_id":"p02919","language":"python","submission_id_v0":"s179262892","submission_id_v1":"s760496708","cpu_time_v0":349,"cpu_time_v1":258,"memory_v0":20168,"memory_v1":20196,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.07,"input":"N = int(eval(input()))\n\nP = list(map(int, input().split()))\n\nR = list(range(N))\n\nL = list(range(N))\n\nI = [-1] * (N+1)\n\nfor i, p in enumerate(P):\n\n I[p] = i\n\n\n\nans = 0\n\nfor n, idx in enumerate(I[1:], 1):\n\n l = idx-1\n\n while l>=0 and l!=L[l]:\n\n l = L[l]\n\n r = idx+1\n\n while r=0 and l2!=L[l2]:\n\n l2 = L[l2]\n\n ans += n * (l-l2) * (r-idx)\n\n if r != N:\n\n r2 = r+1\n\n while r2=0:\n\n l = L[l]\n\n r = idx+1\n\n if r=0:\n\n l2 = l-1\n\n if l2>=0:\n\n l2 = L[l2]\n\n ans += n * (l-l2) * (r-idx)\n\n if r= 0 and l != L[l]:\n l = L[l]\n r = idx + 1\n while r < N and r != R[r]:\n r = R[r]\n L[idx] = l\n R[idx] = r\n if l != -1:\n l2 = l - 1\n while l2 >= 0 and l2 != L[l2]:\n l2 = L[l2]\n ans += n * (l - l2) * (r - idx)\n if r != N:\n r2 = r + 1\n while r2 < N and r2 != R[r2]:\n r2 = R[r2]\n ans += n * (idx - l) * (r2 - r)\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nP = list(map(int, input().split()))\nR = list(range(N))\nL = list(range(N))\nI = [-1] * (N + 1)\nfor i, p in enumerate(P):\n I[p] = i\nans = 0\nfor n, idx in enumerate(I[1:], 1):\n l = idx - 1\n if l >= 0:\n l = L[l]\n r = idx + 1\n if r < N:\n r = R[r]\n L[r - 1] = l\n R[l + 1] = r\n if l >= 0:\n l2 = l - 1\n if l2 >= 0:\n l2 = L[l2]\n ans += n * (l - l2) * (r - idx)\n if r < N:\n r2 = r + 1\n if r2 < N:\n r2 = R[r2]\n ans += n * (idx - l) * (r2 - r)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- while l >= 0 and l != L[l]:","+ if l >= 0:","- while r < N and r != R[r]:","+ if r < N:","- L[idx] = l","- R[idx] = r","- if l != -1:","+ L[r - 1] = l","+ R[l + 1] = r","+ if l >= 0:","- while l2 >= 0 and l2 != L[l2]:","+ if l2 >= 0:","- if r != N:","+ if r < N:","- while r2 < N and r2 != R[r2]:","+ if r2 < N:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0492427601,"measured_runtime_v1":0.0497303619,"runtime_lift":0.9901950891,"key":["s179262892","s760496708"]} +{"user_id":"u508486691","problem_id":"p02659","language":"python","submission_id_v0":"s628505961","submission_id_v1":"s613969481","cpu_time_v0":151,"cpu_time_v1":94,"memory_v0":65556,"memory_v1":71308,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.75,"input":"import sys\n\nimport math\n\nfrom collections import defaultdict\n\nfrom bisect import bisect_left, bisect_right\n\n\n\nsys.setrecursionlimit(10**7)\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\n\n\nmod = 10**9 + 7\n\n\n\ndef I(): return int(eval(input()))\n\ndef LI(): return list(map(int, input().split()))\n\ndef LIR(row,col):\n\n if row <= 0:\n\n return [[] for _ in range(col)]\n\n elif col == 1:\n\n return [I() for _ in range(row)]\n\n else:\n\n read_all = [LI() for _ in range(row)]\n\n return list(map(list, list(zip(*read_all))))\n\n\n\n#################\n\n\n\nA,B = list(map(str, input().split()))\n\nA = int(A)\n\nB = 100*int(B[0])+10*int(B[2])+int(B[3])\n\n\n\nprint((A*B\/\/100))","target":"import sys\n\nimport math\n\nfrom collections import defaultdict\n\nfrom bisect import bisect_left, bisect_right\n\n\n\nsys.setrecursionlimit(10**7)\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\n\n\nmod = 10**9 + 7\n\n\n\ndef I(): return int(eval(input()))\n\ndef LI(): return list(map(int, input().split()))\n\ndef LIR(row,col):\n\n if row <= 0:\n\n return [[] for _ in range(col)]\n\n elif col == 1:\n\n return [I() for _ in range(row)]\n\n else:\n\n read_all = [LI() for _ in range(row)]\n\n return list(map(list, list(zip(*read_all))))\n\n\n\n#################\n\n\n\nfrom decimal import getcontext,Decimal\n\ngetcontext().prec = 28\n\n\n\nA,B = list(map(str, input().split()))\n\nA = int(A)\n\nB = Decimal(B)\n\n\n\nprint((int(A*B)))","code_v0_loc":29,"code_v1_loc":32,"code_v0_num_chars":666,"code_v1_num_chars":706,"code_v0_no_empty_lines":"import sys\nimport math\nfrom collections import defaultdict\nfrom bisect import bisect_left, bisect_right\n\nsys.setrecursionlimit(10**7)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nmod = 10**9 + 7\n\n\ndef I():\n return int(eval(input()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LIR(row, col):\n if row <= 0:\n return [[] for _ in range(col)]\n elif col == 1:\n return [I() for _ in range(row)]\n else:\n read_all = [LI() for _ in range(row)]\n return list(map(list, list(zip(*read_all))))\n\n\n#################\nA, B = list(map(str, input().split()))\nA = int(A)\nB = 100 * int(B[0]) + 10 * int(B[2]) + int(B[3])\nprint((A * B \/\/ 100))\n","code_v1_no_empty_lines":"import sys\nimport math\nfrom collections import defaultdict\nfrom bisect import bisect_left, bisect_right\n\nsys.setrecursionlimit(10**7)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nmod = 10**9 + 7\n\n\ndef I():\n return int(eval(input()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LIR(row, col):\n if row <= 0:\n return [[] for _ in range(col)]\n elif col == 1:\n return [I() for _ in range(row)]\n else:\n read_all = [LI() for _ in range(row)]\n return list(map(list, list(zip(*read_all))))\n\n\n#################\nfrom decimal import getcontext, Decimal\n\ngetcontext().prec = 28\nA, B = list(map(str, input().split()))\nA = int(A)\nB = Decimal(B)\nprint((int(A * B)))\n","code_same":false,"relative_loc_diff_percent":9.375,"diff":["+from decimal import getcontext, Decimal","+","+getcontext().prec = 28","-B = 100 * int(B[0]) + 10 * int(B[2]) + int(B[3])","-print((A * B \/\/ 100))","+B = Decimal(B)","+print((int(A * B)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0848648999,"measured_runtime_v1":0.0893347409,"runtime_lift":0.9499652546,"key":["s628505961","s613969481"]} +{"user_id":"u512212329","problem_id":"p02608","language":"python","submission_id_v0":"s731162033","submission_id_v1":"s648589050","cpu_time_v0":142,"cpu_time_v1":130,"memory_v0":9272,"memory_v1":9268,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.45,"input":"def main():\n\n num = int(eval(input()))\n\n counter = [0] * (num + 1)\n\n # func(41, 41, 41) = 10086\n\n # func(99, 1, 1) = 10002\n\n for x in range(1, 100):\n\n for y in range(1, 100):\n\n for z in range(1, 123 - x - y + 1):\n\n tmp = (x + y + z) ** 2 - x * y - y * z - z * x\n\n if tmp <= num:\n\n counter[tmp] += 1\n\n for count in counter[1:]:\n\n print(count)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n num = int(eval(input()))\n\n counter = [0] * (num + 1)\n\n # func(41, 41, 41) = 10086\n\n # func(99, 1, 1) = 10002\n\n for x in range(1, 100):\n\n for y in range(1, 100):\n\n for z in range(1, 123 - x - y + 1):\n\n tmp = (x + y + z) ** 2 - x * y - y * z - z * x\n\n if tmp > num:\n\n break\n\n counter[tmp] += 1\n\n for count in counter[1:]:\n\n print(count)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":17,"code_v1_loc":18,"code_v0_num_chars":472,"code_v1_num_chars":494,"code_v0_no_empty_lines":"def main():\n num = int(eval(input()))\n counter = [0] * (num + 1)\n # func(41, 41, 41) = 10086\n # func(99, 1, 1) = 10002\n for x in range(1, 100):\n for y in range(1, 100):\n for z in range(1, 123 - x - y + 1):\n tmp = (x + y + z) ** 2 - x * y - y * z - z * x\n if tmp <= num:\n counter[tmp] += 1\n for count in counter[1:]:\n print(count)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n num = int(eval(input()))\n counter = [0] * (num + 1)\n # func(41, 41, 41) = 10086\n # func(99, 1, 1) = 10002\n for x in range(1, 100):\n for y in range(1, 100):\n for z in range(1, 123 - x - y + 1):\n tmp = (x + y + z) ** 2 - x * y - y * z - z * x\n if tmp > num:\n break\n counter[tmp] += 1\n for count in counter[1:]:\n print(count)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["- if tmp <= num:","- counter[tmp] += 1","+ if tmp > num:","+ break","+ counter[tmp] += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.2299752889,"measured_runtime_v1":0.1737043185,"runtime_lift":1.3239468702,"key":["s731162033","s648589050"]} +{"user_id":"u254871849","problem_id":"p02936","language":"python","submission_id_v0":"s311535546","submission_id_v1":"s057189406","cpu_time_v0":969,"cpu_time_v1":878,"memory_v0":66864,"memory_v1":74680,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.39,"input":"# 2019-11-17 10:52:21(JST)\n\nimport sys\n\n# import collections\n\n# import math\n\n# from string import ascii_lowercase, ascii_uppercase, digits\n\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n\n# import itertools\n\n# from functools import reduce\n\n# import operator as op\n\n# import re\n\n# import heapq\n\n# import array\n\n# from scipy.misc import comb # (default: exact=False)\n\n# import numpy as np \n\n\n\n\n\ndef main():\n\n n, q = [int(x) for x in sys.stdin.readline().split()]\n\n AB = [[] for _ in range(n+1)]\n\n for _ in range(n-1):\n\n a, b = [int(x) for x in sys.stdin.readline().split()]\n\n AB[a].append(b)\n\n AB[b].append(a)\n\n # \u7121\u5411\u30b0\u30e9\u30d5\u3068\u3057\u3066\u8003\u3048\u308b\n\n\n\n ans = [0 for _ in range(n+1)]\n\n for _ in range(q):\n\n p, x = [int(x) for x in sys.stdin.readline().split()]\n\n ans[p] += x\n\n \n\n stack = [1]\n\n parent = [0 for _ in range(n+1)]\n\n while stack:\n\n x = stack.pop()\n\n for y in AB[x]:\n\n if y != parent[x]: # y\u304cx\u306e\u89aa\u3067\u306a\u3051\u308c\u3070\n\n parent[y] = x # x\u304cy\u306e\u89aa\n\n stack.append(y)\n\n ans[y] += ans[x]\n\n \n\n \n\n print((' '.join(map(str, ans[1:]))))\n\n\n\nif __name__ == \"__main__\":\n\n main()\n\n\n","target":"import sys\n\n\n\nn, q = map(int, sys.stdin.readline().split())\n\ng = [[] for _ in range(n+1)]\n\nfor _ in range(n-1):\n\n a, b = map(int, sys.stdin.readline().split())\n\n g[a].append(b)\n\n g[b].append(a)\n\n\n\npx = zip(*[map(int, sys.stdin.read().split())] * 2)\n\n\n\ndef main():\n\n value = [0] * (n + 1)\n\n for p, x in px:\n\n value[p] += x\n\n \n\n stack = [1]\n\n par = [None] * (n + 1)\n\n while stack:\n\n u = stack.pop()\n\n for v in g[u]:\n\n if v != par[u]:\n\n par[v] = u\n\n value[v] += value[u]\n\n stack.append(v)\n\n \n\n return value[1:]\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(*ans, sep=' ')\n","code_v0_loc":46,"code_v1_loc":31,"code_v0_num_chars":1191,"code_v1_num_chars":695,"code_v0_no_empty_lines":"# 2019-11-17 10:52:21(JST)\nimport sys\n\n# import collections\n# import math\n# from string import ascii_lowercase, ascii_uppercase, digits\n# from bisect import bisect_left as bi_l, bisect_right as bi_r\n# import itertools\n# from functools import reduce\n# import operator as op\n# import re\n# import heapq\n# import array\n# from scipy.misc import comb # (default: exact=False)\n# import numpy as np\ndef main():\n n, q = [int(x) for x in sys.stdin.readline().split()]\n AB = [[] for _ in range(n + 1)]\n for _ in range(n - 1):\n a, b = [int(x) for x in sys.stdin.readline().split()]\n AB[a].append(b)\n AB[b].append(a)\n # \u7121\u5411\u30b0\u30e9\u30d5\u3068\u3057\u3066\u8003\u3048\u308b\n ans = [0 for _ in range(n + 1)]\n for _ in range(q):\n p, x = [int(x) for x in sys.stdin.readline().split()]\n ans[p] += x\n stack = [1]\n parent = [0 for _ in range(n + 1)]\n while stack:\n x = stack.pop()\n for y in AB[x]:\n if y != parent[x]: # y\u304cx\u306e\u89aa\u3067\u306a\u3051\u308c\u3070\n parent[y] = x # x\u304cy\u306e\u89aa\n stack.append(y)\n ans[y] += ans[x]\n print((\" \".join(map(str, ans[1:]))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nn, q = map(int, sys.stdin.readline().split())\ng = [[] for _ in range(n + 1)]\nfor _ in range(n - 1):\n a, b = map(int, sys.stdin.readline().split())\n g[a].append(b)\n g[b].append(a)\npx = zip(*[map(int, sys.stdin.read().split())] * 2)\n\n\ndef main():\n value = [0] * (n + 1)\n for p, x in px:\n value[p] += x\n stack = [1]\n par = [None] * (n + 1)\n while stack:\n u = stack.pop()\n for v in g[u]:\n if v != par[u]:\n par[v] = u\n value[v] += value[u]\n stack.append(v)\n return value[1:]\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(*ans, sep=\" \")\n","code_same":false,"relative_loc_diff_percent":32.6086956522,"diff":["-# 2019-11-17 10:52:21(JST)","-# import collections","-# import math","-# from string import ascii_lowercase, ascii_uppercase, digits","-# from bisect import bisect_left as bi_l, bisect_right as bi_r","-# import itertools","-# from functools import reduce","-# import operator as op","-# import re","-# import heapq","-# import array","-# from scipy.misc import comb # (default: exact=False)","-# import numpy as np","+n, q = map(int, sys.stdin.readline().split())","+g = [[] for _ in range(n + 1)]","+for _ in range(n - 1):","+ a, b = map(int, sys.stdin.readline().split())","+ g[a].append(b)","+ g[b].append(a)","+px = zip(*[map(int, sys.stdin.read().split())] * 2)","+","+","- n, q = [int(x) for x in sys.stdin.readline().split()]","- AB = [[] for _ in range(n + 1)]","- for _ in range(n - 1):","- a, b = [int(x) for x in sys.stdin.readline().split()]","- AB[a].append(b)","- AB[b].append(a)","- # \u7121\u5411\u30b0\u30e9\u30d5\u3068\u3057\u3066\u8003\u3048\u308b","- ans = [0 for _ in range(n + 1)]","- for _ in range(q):","- p, x = [int(x) for x in sys.stdin.readline().split()]","- ans[p] += x","+ value = [0] * (n + 1)","+ for p, x in px:","+ value[p] += x","- parent = [0 for _ in range(n + 1)]","+ par = [None] * (n + 1)","- x = stack.pop()","- for y in AB[x]:","- if y != parent[x]: # y\u304cx\u306e\u89aa\u3067\u306a\u3051\u308c\u3070","- parent[y] = x # x\u304cy\u306e\u89aa","- stack.append(y)","- ans[y] += ans[x]","- print((\" \".join(map(str, ans[1:]))))","+ u = stack.pop()","+ for v in g[u]:","+ if v != par[u]:","+ par[v] = u","+ value[v] += value[u]","+ stack.append(v)","+ return value[1:]","- main()","+ ans = main()","+ print(*ans, sep=\" \")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0464586546,"measured_runtime_v1":0.1073658117,"runtime_lift":0.4327136715,"key":["s311535546","s057189406"]} +{"user_id":"u145950990","problem_id":"p03557","language":"python","submission_id_v0":"s212453243","submission_id_v1":"s640831999","cpu_time_v0":413,"cpu_time_v1":362,"memory_v0":27380,"memory_v1":22720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.35,"input":"n = int(eval(input()))\n\na,b,c = [sorted(list(map(int,input().split())),reverse=True) for i in range(3)]\n\ncomp1 = []\n\ni,j = 0,0\n\ncnt = 0\n\nwhile ia[i]:\n\n cnt+=1\n\n j+=1\n\n comp1.append(cnt)\n\n i+=1\n\ncomp2 = []\n\ni,j = 0,0\n\ncnt = 0\n\nwhile ib[i]:\n\n cnt+=1\n\n j+=1\n\n comp2.append(cnt)\n\n i+=1\n\nx = [0]\n\nfor i in range(n):\n\n x.append(x[i]+comp2[i])\n\nans = 0\n\nfor i in comp1:\n\n ans += x[i]\n\nprint(ans)","target":"import bisect\n\nn = int(eval(input()))\n\na,b,c = [sorted(list(map(int,input().split()))) for i in range(3)]\n\nans = 0\n\ncnt = [0]\n\n[cnt.append(cnt[i]+bisect.bisect_left(a,b[i])) for i in range(n)]\n\nfor i in range(n):\n\n index = bisect.bisect_left(b,c[i])\n\n ans += cnt[index] \n\nprint(ans)","code_v0_loc":27,"code_v1_loc":10,"code_v0_num_chars":484,"code_v1_num_chars":282,"code_v0_no_empty_lines":"n = int(eval(input()))\na, b, c = [sorted(list(map(int, input().split())), reverse=True) for i in range(3)]\ncomp1 = []\ni, j = 0, 0\ncnt = 0\nwhile i < n:\n while j < n and b[j] > a[i]:\n cnt += 1\n j += 1\n comp1.append(cnt)\n i += 1\ncomp2 = []\ni, j = 0, 0\ncnt = 0\nwhile i < n:\n while j < n and c[j] > b[i]:\n cnt += 1\n j += 1\n comp2.append(cnt)\n i += 1\nx = [0]\nfor i in range(n):\n x.append(x[i] + comp2[i])\nans = 0\nfor i in comp1:\n ans += x[i]\nprint(ans)\n","code_v1_no_empty_lines":"import bisect\n\nn = int(eval(input()))\na, b, c = [sorted(list(map(int, input().split()))) for i in range(3)]\nans = 0\ncnt = [0]\n[cnt.append(cnt[i] + bisect.bisect_left(a, b[i])) for i in range(n)]\nfor i in range(n):\n index = bisect.bisect_left(b, c[i])\n ans += cnt[index]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":62.962962963,"diff":["+import bisect","+","-a, b, c = [sorted(list(map(int, input().split())), reverse=True) for i in range(3)]","-comp1 = []","-i, j = 0, 0","-cnt = 0","-while i < n:","- while j < n and b[j] > a[i]:","- cnt += 1","- j += 1","- comp1.append(cnt)","- i += 1","-comp2 = []","-i, j = 0, 0","-cnt = 0","-while i < n:","- while j < n and c[j] > b[i]:","- cnt += 1","- j += 1","- comp2.append(cnt)","- i += 1","-x = [0]","+a, b, c = [sorted(list(map(int, input().split()))) for i in range(3)]","+ans = 0","+cnt = [0]","+[cnt.append(cnt[i] + bisect.bisect_left(a, b[i])) for i in range(n)]","- x.append(x[i] + comp2[i])","-ans = 0","-for i in comp1:","- ans += x[i]","+ index = bisect.bisect_left(b, c[i])","+ ans += cnt[index]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0788882256,"measured_runtime_v1":0.0454956055,"runtime_lift":1.7339746273,"key":["s212453243","s640831999"]} +{"user_id":"u729133443","problem_id":"p02605","language":"python","submission_id_v0":"s489098949","submission_id_v1":"s352260697","cpu_time_v0":2831,"cpu_time_v1":1387,"memory_v0":71532,"memory_v1":183656,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.01,"input":"I=N=9**9\n\nP,M,L,R,U,*D='x+y,','x-y,',[],[],[]\n\nfor t in[*open(0)][1:]:*z,u=t.split();exec(u+'+=[*map(int,z)],')\n\nfor*A,S in(D,U,'x,y,'),(L,R,'y,x,'),(U,R,P+M),(L,D,P+M),(L,U,M+P),(D,R,M+P):\n\n n=p=-I\n\n for x,y,r in eval('sorted((%sQ)for Q,P in enumerate(A)for x,y in P)'%S):\n\n if r:n,p=x,y\n\n elif x==n:N=min(N,y-p)\n\nprint((N%I*5or'SAFE'))","target":"I=N=9**9\n\nd=[[],[],[],[]]\n\nfor t in[*open(0)][1:]:\n\n *z,u=t.split()\n\n d[ord(u)%5]+=[*list(map(int,z))],\n\nf=lambda x,y:x\n\ng=lambda x,y:y\n\nh=lambda x,y:x+y\n\ni=lambda x,y:x-y\n\nfor*A,f,g in(3,0,f,g),(1,2,g,f),(0,2,h,i),(1,3,h,i),(1,0,i,h),(3,2,i,h):\n\n n=p=-I\n\n for x,y,r in sorted((f(x,y),g(x,y),Q)for Q,P in enumerate(A)for x,y in d[P]):\n\n if r:n,p=x,y\n\n elif x==n:N=min(N,y-p)\n\nprint((N%I*5or'SAFE'))","code_v0_loc":9,"code_v1_loc":15,"code_v0_num_chars":337,"code_v1_num_chars":400,"code_v0_no_empty_lines":"I = N = 9**9\nP, M, L, R, U, *D = \"x+y,\", \"x-y,\", [], [], []\nfor t in [*open(0)][1:]:\n *z, u = t.split()\n exec(u + \"+=[*map(int,z)],\")\nfor *A, S in (\n (D, U, \"x,y,\"),\n (L, R, \"y,x,\"),\n (U, R, P + M),\n (L, D, P + M),\n (L, U, M + P),\n (D, R, M + P),\n):\n n = p = -I\n for x, y, r in eval(\"sorted((%sQ)for Q,P in enumerate(A)for x,y in P)\" % S):\n if r:\n n, p = x, y\n elif x == n:\n N = min(N, y - p)\nprint((N % I * 5 or \"SAFE\"))\n","code_v1_no_empty_lines":"I = N = 9**9\nd = [[], [], [], []]\nfor t in [*open(0)][1:]:\n *z, u = t.split()\n d[ord(u) % 5] += ([*list(map(int, z))],)\nf = lambda x, y: x\ng = lambda x, y: y\nh = lambda x, y: x + y\ni = lambda x, y: x - y\nfor *A, f, g in (\n (3, 0, f, g),\n (1, 2, g, f),\n (0, 2, h, i),\n (1, 3, h, i),\n (1, 0, i, h),\n (3, 2, i, h),\n):\n n = p = -I\n for x, y, r in sorted(\n (f(x, y), g(x, y), Q) for Q, P in enumerate(A) for x, y in d[P]\n ):\n if r:\n n, p = x, y\n elif x == n:\n N = min(N, y - p)\nprint((N % I * 5 or \"SAFE\"))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-P, M, L, R, U, *D = \"x+y,\", \"x-y,\", [], [], []","+d = [[], [], [], []]","- exec(u + \"+=[*map(int,z)],\")","-for *A, S in (","- (D, U, \"x,y,\"),","- (L, R, \"y,x,\"),","- (U, R, P + M),","- (L, D, P + M),","- (L, U, M + P),","- (D, R, M + P),","+ d[ord(u) % 5] += ([*list(map(int, z))],)","+f = lambda x, y: x","+g = lambda x, y: y","+h = lambda x, y: x + y","+i = lambda x, y: x - y","+for *A, f, g in (","+ (3, 0, f, g),","+ (1, 2, g, f),","+ (0, 2, h, i),","+ (1, 3, h, i),","+ (1, 0, i, h),","+ (3, 2, i, h),","- for x, y, r in eval(\"sorted((%sQ)for Q,P in enumerate(A)for x,y in P)\" % S):","+ for x, y, r in sorted(","+ (f(x, y), g(x, y), Q) for Q, P in enumerate(A) for x, y in d[P]","+ ):"],"diff_only_import_comment":false,"measured_runtime_v0":0.1034517,"measured_runtime_v1":0.1053625927,"runtime_lift":0.9818636512,"key":["s489098949","s352260697"]} +{"user_id":"u200239931","problem_id":"p03986","language":"python","submission_id_v0":"s493972206","submission_id_v1":"s501131663","cpu_time_v0":80,"cpu_time_v1":62,"memory_v0":5084,"memory_v1":5096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.5,"input":"from collections import deque\n\ndef getinputdata():\n\n\n\n array_result = [] \n\n data = eval(input())\n\n array_result.append(data.split(\" \"))\n\n\n\n flg = True\n\n\n\n try:\n\n while flg:\n\n\n\n data = eval(input())\n\n\n\n if(data != \"\"):\n\n \n\n array_result.append(data.split(\" \"))\n\n\n\n flg = True\n\n\n\n else:\n\n\n\n flg = False\n\n finally:\n\n\n\n return array_result\n\n\n\narr_data = getinputdata()\n\n\n\nx=arr_data[0][0]\n\n\n\nb = deque([])\n\n\n\nfor v in x:\n\n \n\n if v==\"S\":\n\n \n\n b.appendleft(v)\n\n \n\n elif v==\"T\" and (len(b)==0 or b[0]==\"T\"):\n\n \n\n b.appendleft(v)\n\n \n\n else:\n\n \n\n b.popleft()\n\n \n\nprint((len(b))) \n","target":"def getinputdata():\n\n\n\n array_result = [] \n\n data = eval(input())\n\n array_result.append(data.split(\" \"))\n\n\n\n flg = True\n\n\n\n try:\n\n while flg:\n\n\n\n data = eval(input())\n\n\n\n if(data != \"\"):\n\n \n\n array_result.append(data.split(\" \"))\n\n\n\n flg = True\n\n\n\n else:\n\n\n\n flg = False\n\n finally:\n\n\n\n return array_result\n\n\n\narr_data = getinputdata()\n\n\n\nx=arr_data[0][0]\n\n\n\narr=[]\n\n\n\n\n\nfor v in x:\n\n \n\n# s\u306e\u5834\u5408\n\n if v==\"S\":\n\n \n\n arr.append(\"S\")\n\n \n\n# t\u306e\u5834\u5408 \u76f4\u524d\u304cT\u3042\u308b\u3044\u306f\u521d\u3081\u3066\u306e\u5834\u5408\n\n elif v==\"T\" and (len(arr)==0 or arr[-1]==\"T\"):\n\n \n\n arr.append(\"T\")\n\n \n\n else:\n\n \n\n del arr[-1]\n\n \n\n \n\nprint((len(arr))) \n","code_v0_loc":48,"code_v1_loc":51,"code_v0_num_chars":771,"code_v1_num_chars":787,"code_v0_no_empty_lines":"from collections import deque\n\n\ndef getinputdata():\n array_result = []\n data = eval(input())\n array_result.append(data.split(\" \"))\n flg = True\n try:\n while flg:\n data = eval(input())\n if data != \"\":\n array_result.append(data.split(\" \"))\n flg = True\n else:\n flg = False\n finally:\n return array_result\n\n\narr_data = getinputdata()\nx = arr_data[0][0]\nb = deque([])\nfor v in x:\n if v == \"S\":\n b.appendleft(v)\n elif v == \"T\" and (len(b) == 0 or b[0] == \"T\"):\n b.appendleft(v)\n else:\n b.popleft()\nprint((len(b)))\n","code_v1_no_empty_lines":"def getinputdata():\n array_result = []\n data = eval(input())\n array_result.append(data.split(\" \"))\n flg = True\n try:\n while flg:\n data = eval(input())\n if data != \"\":\n array_result.append(data.split(\" \"))\n flg = True\n else:\n flg = False\n finally:\n return array_result\n\n\narr_data = getinputdata()\nx = arr_data[0][0]\narr = []\nfor v in x:\n # s\u306e\u5834\u5408\n if v == \"S\":\n arr.append(\"S\")\n # t\u306e\u5834\u5408 \u76f4\u524d\u304cT\u3042\u308b\u3044\u306f\u521d\u3081\u3066\u306e\u5834\u5408\n elif v == \"T\" and (len(arr) == 0 or arr[-1] == \"T\"):\n arr.append(\"T\")\n else:\n del arr[-1]\nprint((len(arr)))\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-from collections import deque","-","-","-b = deque([])","+arr = []","+ # s\u306e\u5834\u5408","- b.appendleft(v)","- elif v == \"T\" and (len(b) == 0 or b[0] == \"T\"):","- b.appendleft(v)","+ arr.append(\"S\")","+ # t\u306e\u5834\u5408 \u76f4\u524d\u304cT\u3042\u308b\u3044\u306f\u521d\u3081\u3066\u306e\u5834\u5408","+ elif v == \"T\" and (len(arr) == 0 or arr[-1] == \"T\"):","+ arr.append(\"T\")","- b.popleft()","-print((len(b)))","+ del arr[-1]","+print((len(arr)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372963731,"measured_runtime_v1":0.0424729819,"runtime_lift":0.8781199583,"key":["s493972206","s501131663"]} +{"user_id":"u489959379","problem_id":"p03488","language":"python","submission_id_v0":"s807070900","submission_id_v1":"s208367479","cpu_time_v0":569,"cpu_time_v1":248,"memory_v0":9720,"memory_v1":81860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.41,"input":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n S = eval(input())\n\n X, Y = list(map(int, input().split()))\n\n\n\n S = list(map(len, S.split(\"T\")))\n\n init_x = S[0]\n\n is_x = 0\n\n to_x, to_y = [], []\n\n for i in range(1, len(S)):\n\n if S[i]:\n\n to_x.append(S[i]) if is_x else to_y.append(S[i])\n\n is_x ^= 1\n\n\n\n now_x = {init_x}\n\n for x in to_x:\n\n tmp = set()\n\n for now in now_x:\n\n tmp.add(now - x)\n\n tmp.add(now + x)\n\n now_x = tmp\n\n\n\n now_y = {0}\n\n for y in to_y:\n\n tmp = set()\n\n for now in now_y:\n\n tmp.add(now - y)\n\n tmp.add(now + y)\n\n now_y = tmp\n\n\n\n print((\"Yes\" if X in now_x and Y in now_y else \"No\"))\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","target":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n S = list(input().split(\"T\"))\n\n gx, gy = list(map(int, input().split()))\n\n\n\n to_X = 0\n\n init_x = len(S[0])\n\n S.pop(0)\n\n X, Y = [], []\n\n for s in S:\n\n X.append(len(s)) if to_X else Y.append(len(s))\n\n to_X ^= 1\n\n\n\n now_x = {init_x}\n\n for x in X:\n\n tmp = set()\n\n for prev_x in now_x:\n\n tmp.add(prev_x + x)\n\n tmp.add(prev_x - x)\n\n now_x = tmp\n\n\n\n now_y = {0}\n\n for y in Y:\n\n tmp = set()\n\n for prev_y in now_y:\n\n tmp.add(prev_y + y)\n\n tmp.add(prev_y - y)\n\n now_y = tmp\n\n\n\n print((\"Yes\" if gx in now_x and gy in now_y else \"No\"))\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","code_v0_loc":41,"code_v1_loc":40,"code_v0_num_chars":837,"code_v1_num_chars":806,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef resolve():\n S = eval(input())\n X, Y = list(map(int, input().split()))\n S = list(map(len, S.split(\"T\")))\n init_x = S[0]\n is_x = 0\n to_x, to_y = [], []\n for i in range(1, len(S)):\n if S[i]:\n to_x.append(S[i]) if is_x else to_y.append(S[i])\n is_x ^= 1\n now_x = {init_x}\n for x in to_x:\n tmp = set()\n for now in now_x:\n tmp.add(now - x)\n tmp.add(now + x)\n now_x = tmp\n now_y = {0}\n for y in to_y:\n tmp = set()\n for now in now_y:\n tmp.add(now - y)\n tmp.add(now + y)\n now_y = tmp\n print((\"Yes\" if X in now_x and Y in now_y else \"No\"))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef resolve():\n S = list(input().split(\"T\"))\n gx, gy = list(map(int, input().split()))\n to_X = 0\n init_x = len(S[0])\n S.pop(0)\n X, Y = [], []\n for s in S:\n X.append(len(s)) if to_X else Y.append(len(s))\n to_X ^= 1\n now_x = {init_x}\n for x in X:\n tmp = set()\n for prev_x in now_x:\n tmp.add(prev_x + x)\n tmp.add(prev_x - x)\n now_x = tmp\n now_y = {0}\n for y in Y:\n tmp = set()\n for prev_y in now_y:\n tmp.add(prev_y + y)\n tmp.add(prev_y - y)\n now_y = tmp\n print((\"Yes\" if gx in now_x and gy in now_y else \"No\"))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":2.4390243902,"diff":["- S = eval(input())","- X, Y = list(map(int, input().split()))","- S = list(map(len, S.split(\"T\")))","- init_x = S[0]","- is_x = 0","- to_x, to_y = [], []","- for i in range(1, len(S)):","- if S[i]:","- to_x.append(S[i]) if is_x else to_y.append(S[i])","- is_x ^= 1","+ S = list(input().split(\"T\"))","+ gx, gy = list(map(int, input().split()))","+ to_X = 0","+ init_x = len(S[0])","+ S.pop(0)","+ X, Y = [], []","+ for s in S:","+ X.append(len(s)) if to_X else Y.append(len(s))","+ to_X ^= 1","- for x in to_x:","+ for x in X:","- for now in now_x:","- tmp.add(now - x)","- tmp.add(now + x)","+ for prev_x in now_x:","+ tmp.add(prev_x + x)","+ tmp.add(prev_x - x)","- for y in to_y:","+ for y in Y:","- for now in now_y:","- tmp.add(now - y)","- tmp.add(now + y)","+ for prev_y in now_y:","+ tmp.add(prev_y + y)","+ tmp.add(prev_y - y)","- print((\"Yes\" if X in now_x and Y in now_y else \"No\"))","+ print((\"Yes\" if gx in now_x and gy in now_y else \"No\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0389064312,"measured_runtime_v1":0.0399830818,"runtime_lift":0.9730723451,"key":["s807070900","s208367479"]} +{"user_id":"u948524308","problem_id":"p03761","language":"python","submission_id_v0":"s278954739","submission_id_v1":"s317762366","cpu_time_v0":24,"cpu_time_v1":18,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"import collections\n\n\n\nn=int(eval(input()))\n\nS=collections.Counter(list(eval(input())))\n\nS0=list(S.items())\n\nL=len(S0)\n\nfor i in range(L):\n\n S0[i]=list(S0[i])\n\n\n\nfor i in range(1,n):\n\n temp=list(eval(input()))\n\n for j in range(L):\n\n h=temp.count(S0[j][0])\n\n if h 0:\n\n d_c[t[i]] -= 1\n\n else:\n\n print('NO')\n\n exit()\n\nprint('YES')\n","code_v0_loc":22,"code_v1_loc":15,"code_v0_num_chars":392,"code_v1_num_chars":315,"code_v0_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\nd = list(map(int, input().split()))\nd_c = Counter(d)\nm = int(eval(input()))\nt = list(map(int, input().split()))\n# print(d_c)\nfor i in range(m):\n if t[i] in d_c:\n d_c[t[i]] -= 1\n if d_c[t[i]] < 0:\n print(\"NO\")\n exit()\n else:\n print(\"NO\")\n exit()\n# print(d_c)\nprint(\"YES\")\n","code_v1_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\nd = list(map(int, input().split()))\nd_c = Counter(d)\nm = int(eval(input()))\nt = sorted(list(map(int, input().split())), reverse=True)\nfor i in range(m):\n if d_c[t[i]] > 0:\n d_c[t[i]] -= 1\n else:\n print(\"NO\")\n exit()\nprint(\"YES\")\n","code_same":false,"relative_loc_diff_percent":31.8181818182,"diff":["-t = list(map(int, input().split()))","-# print(d_c)","+t = sorted(list(map(int, input().split())), reverse=True)","- if t[i] in d_c:","+ if d_c[t[i]] > 0:","- if d_c[t[i]] < 0:","- print(\"NO\")","- exit()","-# print(d_c)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0453945961,"measured_runtime_v1":0.0451209066,"runtime_lift":1.0060656915,"key":["s952678443","s393968488"]} +{"user_id":"u320511454","problem_id":"p03804","language":"python","submission_id_v0":"s338095177","submission_id_v1":"s595576126","cpu_time_v0":123,"cpu_time_v1":32,"memory_v0":9208,"memory_v1":9208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.98,"input":"n,m=list(map(int,input().split()))\n\nN=[list(eval(input())) for _ in range(n)]\n\nM=[list(eval(input())) for _ in range(m)]\n\n\n\nfor i in range(n-m+1):\n\n for j in range(n-m+1):\n\n count = 0\n\n for k in range(m):\n\n for l in range(m):\n\n if N[i+k][j+l] == M[k][l]:\n\n count += 1\n\n if count == m**2:\n\n print(\"Yes\")\n\n exit()\n\n \n\nprint(\"No\")","target":"n,m=list(map(int,input().split()))\n\nN=[list(eval(input())) for _ in range(n)]\n\nM=[list(eval(input())) for _ in range(m)]\n\n\n\nfor i in range(n-m+1):\n\n for j in range(n-m+1):\n\n count = 0\n\n for k in range(m):\n\n if N[i+k][j:j+m] == M[k][:]:\n\n count += 1\n\n if count == m:\n\n print(\"Yes\")\n\n exit()\n\n \n\nprint(\"No\")","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":359,"code_v1_num_chars":328,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nN = [list(eval(input())) for _ in range(n)]\nM = [list(eval(input())) for _ in range(m)]\nfor i in range(n - m + 1):\n for j in range(n - m + 1):\n count = 0\n for k in range(m):\n for l in range(m):\n if N[i + k][j + l] == M[k][l]:\n count += 1\n if count == m**2:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nN = [list(eval(input())) for _ in range(n)]\nM = [list(eval(input())) for _ in range(m)]\nfor i in range(n - m + 1):\n for j in range(n - m + 1):\n count = 0\n for k in range(m):\n if N[i + k][j : j + m] == M[k][:]:\n count += 1\n if count == m:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["- for l in range(m):","- if N[i + k][j + l] == M[k][l]:","- count += 1","- if count == m**2:","+ if N[i + k][j : j + m] == M[k][:]:","+ count += 1","+ if count == m:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0418792257,"measured_runtime_v1":0.0348306012,"runtime_lift":1.2023687292,"key":["s338095177","s595576126"]} +{"user_id":"u451017206","problem_id":"p03073","language":"python","submission_id_v0":"s319456037","submission_id_v1":"s195732667","cpu_time_v0":107,"cpu_time_v1":97,"memory_v0":9588,"memory_v1":9716,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.35,"input":"S = eval(input())\n\nA = ''.join([str(i % 2) for i in range(len(S))])\n\nB = ''.join([str((i + 1) % 2) for i in range(len(S))])\n\n\n\nans1 = ans2 = 0\n\n\n\nfor a, b in zip(S, A):\n\n if a != b:\n\n ans1 += 1\n\n\n\nfor a, b in zip(S, B):\n\n if a != b:\n\n ans2 += 1\n\n\n\nprint((min(ans1, ans2)))","target":"S = eval(input())\n\nA = ''.join([str(i % 2) for i in range(len(S))])\n\nB = ''.join([str((i + 1) % 2) for i in range(len(S))])\n\n\n\nans1 = ans2 = 0\n\n\n\nfor s, a, b, in zip(S, A, B):\n\n if s != a:\n\n ans1 += 1\n\n if s != b:\n\n ans2 += 1\n\n\n\nprint((min(ans1, ans2)))\n","code_v0_loc":15,"code_v1_loc":13,"code_v0_num_chars":285,"code_v1_num_chars":267,"code_v0_no_empty_lines":"S = eval(input())\nA = \"\".join([str(i % 2) for i in range(len(S))])\nB = \"\".join([str((i + 1) % 2) for i in range(len(S))])\nans1 = ans2 = 0\nfor a, b in zip(S, A):\n if a != b:\n ans1 += 1\nfor a, b in zip(S, B):\n if a != b:\n ans2 += 1\nprint((min(ans1, ans2)))\n","code_v1_no_empty_lines":"S = eval(input())\nA = \"\".join([str(i % 2) for i in range(len(S))])\nB = \"\".join([str((i + 1) % 2) for i in range(len(S))])\nans1 = ans2 = 0\nfor (\n s,\n a,\n b,\n) in zip(S, A, B):\n if s != a:\n ans1 += 1\n if s != b:\n ans2 += 1\nprint((min(ans1, ans2)))\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-for a, b in zip(S, A):","- if a != b:","+for (","+ s,","+ a,","+ b,","+) in zip(S, A, B):","+ if s != a:","-for a, b in zip(S, B):","- if a != b:","+ if s != b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0768227484,"measured_runtime_v1":0.0482192211,"runtime_lift":1.5931976218,"key":["s319456037","s195732667"]} +{"user_id":"u026155812","problem_id":"p03487","language":"python","submission_id_v0":"s073743411","submission_id_v1":"s332119644","cpu_time_v0":121,"cpu_time_v1":87,"memory_v0":18676,"memory_v1":18672,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.1,"input":"from collections import Counter\n\nN = int(eval(input()))\n\na = [int(i) for i in input().split()]\n\nb = Counter(a)\n\nans = 0\n\nfor x in b:\n\n if b[x] > x:\n\n ans += b[x] - x\n\n elif b[x] < x:\n\n ans += b[x]\n\nprint(ans)","target":"from collections import Counter\n\nN = int(eval(input()))\n\na = [int(i) for i in input().split()]\n\n\n\nans = 0\n\nm = Counter(a)\n\nfor x, y in list(m.items()):\n\n if x == y:\n\n continue\n\n elif x < y:\n\n ans += abs(y-x)\n\n else:\n\n ans += y\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":222,"code_v1_num_chars":256,"code_v0_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\na = [int(i) for i in input().split()]\nb = Counter(a)\nans = 0\nfor x in b:\n if b[x] > x:\n ans += b[x] - x\n elif b[x] < x:\n ans += b[x]\nprint(ans)\n","code_v1_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\na = [int(i) for i in input().split()]\nans = 0\nm = Counter(a)\nfor x, y in list(m.items()):\n if x == y:\n continue\n elif x < y:\n ans += abs(y - x)\n else:\n ans += y\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-b = Counter(a)","-for x in b:","- if b[x] > x:","- ans += b[x] - x","- elif b[x] < x:","- ans += b[x]","+m = Counter(a)","+for x, y in list(m.items()):","+ if x == y:","+ continue","+ elif x < y:","+ ans += abs(y - x)","+ else:","+ ans += y"],"diff_only_import_comment":false,"measured_runtime_v0":0.0478098392,"measured_runtime_v1":0.1557887077,"runtime_lift":0.3068889905,"key":["s073743411","s332119644"]} +{"user_id":"u054514819","problem_id":"p02804","language":"python","submission_id_v0":"s826526864","submission_id_v1":"s513948518","cpu_time_v0":269,"cpu_time_v1":190,"memory_v0":125708,"memory_v1":113292,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.37,"input":"import sys\n\ndef input(): return sys.stdin.readline().strip()\n\ndef mapint(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10**9)\n\n\n\nN, K = mapint()\n\nfrom collections import Counter\n\nAs = list(mapint())\n\ncount = Counter(As)\n\nmod = 10**9+7\n\nmaxi = 0\n\ncum = 0\n\npos = {}\n\nneg = {}\n\npos[0] = 1\n\nneg[0] = 1\n\nAs = sorted(list(set(As)))\n\nfor i in range(1, 10**5+5):\n\n pos[i] = pos[i-1]*i%mod\n\n neg[i] = pow(pos[i], mod-2, mod)\n\nfor a in As:\n\n cum += count[a]\n\n if cum=K-1:\n\n maxi += a*pos[i]*neg[K-1]*neg[i-K+1]\n\n maxi %= mod\n\nprint(((maxi-mini)%mod))","code_v0_loc":39,"code_v1_loc":28,"code_v0_num_chars":1041,"code_v1_num_chars":594,"code_v0_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef mapint():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nN, K = mapint()\nfrom collections import Counter\n\nAs = list(mapint())\ncount = Counter(As)\nmod = 10**9 + 7\nmaxi = 0\ncum = 0\npos = {}\nneg = {}\npos[0] = 1\nneg[0] = 1\nAs = sorted(list(set(As)))\nfor i in range(1, 10**5 + 5):\n pos[i] = pos[i - 1] * i % mod\n neg[i] = pow(pos[i], mod - 2, mod)\nfor a in As:\n cum += count[a]\n if cum < K:\n continue\n for i in range(1, min(K, count[a]) + 1):\n if cum - count[a] - K + i < 0:\n continue\n maxi += (\n a\n * pos[count[a]]\n * neg[i]\n * neg[count[a] - i]\n * pos[cum - count[a]]\n * neg[K - i]\n * neg[cum - count[a] - K + i]\n )\n maxi %= mod\nmini = 0\ncum = 0\nfor a in As[::-1]:\n cum += count[a]\n if cum < K:\n continue\n for i in range(1, min(K, count[a]) + 1):\n if cum - count[a] - K + i < 0:\n continue\n mini += (\n a\n * pos[count[a]]\n * neg[i]\n * neg[count[a] - i]\n * pos[cum - count[a]]\n * neg[K - i]\n * neg[cum - count[a] - K + i]\n )\n mini %= mod\nprint(((maxi - mini) % mod))\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef mapint():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nN, K = mapint()\nAs = list(mapint())\nmod = 10**9 + 7\nAs.sort()\npos = {}\nneg = {}\npos[0] = 1\nneg[0] = 1\nfor i in range(1, 10**5 + 3):\n pos[i] = (pos[i - 1] * i) % mod\n neg[i] = pow(pos[i], mod - 2, mod)\nmini = 0\nmaxi = 0\nfor i, a in enumerate(As):\n if i <= N - K:\n mini += a * pos[(N - i - 1)] * neg[K - 1] * neg[N - i - K]\n mini %= mod\n if i >= K - 1:\n maxi += a * pos[i] * neg[K - 1] * neg[i - K + 1]\n maxi %= mod\nprint(((maxi - mini) % mod))\n","code_same":false,"relative_loc_diff_percent":28.2051282051,"diff":["-from collections import Counter","-","-count = Counter(As)","-maxi = 0","-cum = 0","+As.sort()","-As = sorted(list(set(As)))","-for i in range(1, 10**5 + 5):","- pos[i] = pos[i - 1] * i % mod","+for i in range(1, 10**5 + 3):","+ pos[i] = (pos[i - 1] * i) % mod","-for a in As:","- cum += count[a]","- if cum < K:","- continue","- for i in range(1, min(K, count[a]) + 1):","- if cum - count[a] - K + i < 0:","- continue","- maxi += (","- a","- * pos[count[a]]","- * neg[i]","- * neg[count[a] - i]","- * pos[cum - count[a]]","- * neg[K - i]","- * neg[cum - count[a] - K + i]","- )","+mini = 0","+maxi = 0","+for i, a in enumerate(As):","+ if i <= N - K:","+ mini += a * pos[(N - i - 1)] * neg[K - 1] * neg[N - i - K]","+ mini %= mod","+ if i >= K - 1:","+ maxi += a * pos[i] * neg[K - 1] * neg[i - K + 1]","-mini = 0","-cum = 0","-for a in As[::-1]:","- cum += count[a]","- if cum < K:","- continue","- for i in range(1, min(K, count[a]) + 1):","- if cum - count[a] - K + i < 0:","- continue","- mini += (","- a","- * pos[count[a]]","- * neg[i]","- * neg[count[a] - i]","- * pos[cum - count[a]]","- * neg[K - i]","- * neg[cum - count[a] - K + i]","- )","- mini %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":1.6116951942,"measured_runtime_v1":2.3027769578,"runtime_lift":0.6998920103,"key":["s826526864","s513948518"]} +{"user_id":"u302789073","problem_id":"p02606","language":"python","submission_id_v0":"s938957339","submission_id_v1":"s654601033","cpu_time_v0":31,"cpu_time_v1":27,"memory_v0":9156,"memory_v1":9100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.9,"input":"l,r,d=[int(i) for i in input().split()]\n\n\n\ncount=0\n\nfor i in range(l,r+1):\n\n if i%d==0:\n\n count+=1\n\n\n\nprint(count)","target":"l,r,d=list(map(int, input().split()))\n\n\n\nans=r\/\/d-(l-1)\/\/d\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":4,"code_v0_num_chars":124,"code_v1_num_chars":64,"code_v0_no_empty_lines":"l, r, d = [int(i) for i in input().split()]\ncount = 0\nfor i in range(l, r + 1):\n if i % d == 0:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"l, r, d = list(map(int, input().split()))\nans = r \/\/ d - (l - 1) \/\/ d\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-l, r, d = [int(i) for i in input().split()]","-count = 0","-for i in range(l, r + 1):","- if i % d == 0:","- count += 1","-print(count)","+l, r, d = list(map(int, input().split()))","+ans = r \/\/ d - (l - 1) \/\/ d","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0398952231,"measured_runtime_v1":0.0394795558,"runtime_lift":1.0105286718,"key":["s938957339","s654601033"]} +{"user_id":"u227082700","problem_id":"p02947","language":"python","submission_id_v0":"s388227571","submission_id_v1":"s390502611","cpu_time_v0":623,"cpu_time_v1":433,"memory_v0":10736,"memory_v1":19732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.5,"input":"def dic(s):\n\n dics,ans=[],\"\"\n\n for i in range(len(s)):dics.append(s[i])\n\n dics.sort()\n\n for i in dics:ans+=i\n\n return ans\n\nn=int(eval(input()))\n\ns=[dic(eval(input()))for _ in range(n)]\n\ns.sort()\n\na=b=1\n\nc=\"\"\n\nfor i in range(n):\n\n if c!=s[i]:\n\n b+=a*(a-1)\/\/2\n\n a=1\n\n c=s[i]\n\n else:a+=1\n\nb+=a*(a-1)\/\/2\n\nprint((b-1))","target":"n=int(eval(input()))\n\ndef f(s):\n\n return \"\".join(sorted(list(s)))\n\ns=[f(eval(input()))for _ in range(n)]\n\nfrom collections import Counter\n\nd=Counter(s)\n\nans=0\n\nfor i in d:ans+=d[i]*(d[i]-1)\/\/2\n\nprint(ans)","code_v0_loc":19,"code_v1_loc":9,"code_v0_num_chars":315,"code_v1_num_chars":193,"code_v0_no_empty_lines":"def dic(s):\n dics, ans = [], \"\"\n for i in range(len(s)):\n dics.append(s[i])\n dics.sort()\n for i in dics:\n ans += i\n return ans\n\n\nn = int(eval(input()))\ns = [dic(eval(input())) for _ in range(n)]\ns.sort()\na = b = 1\nc = \"\"\nfor i in range(n):\n if c != s[i]:\n b += a * (a - 1) \/\/ 2\n a = 1\n c = s[i]\n else:\n a += 1\nb += a * (a - 1) \/\/ 2\nprint((b - 1))\n","code_v1_no_empty_lines":"n = int(eval(input()))\n\n\ndef f(s):\n return \"\".join(sorted(list(s)))\n\n\ns = [f(eval(input())) for _ in range(n)]\nfrom collections import Counter\n\nd = Counter(s)\nans = 0\nfor i in d:\n ans += d[i] * (d[i] - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":52.6315789474,"diff":["-def dic(s):","- dics, ans = [], \"\"","- for i in range(len(s)):","- dics.append(s[i])","- dics.sort()","- for i in dics:","- ans += i","- return ans","+n = int(eval(input()))","-n = int(eval(input()))","-s = [dic(eval(input())) for _ in range(n)]","-s.sort()","-a = b = 1","-c = \"\"","-for i in range(n):","- if c != s[i]:","- b += a * (a - 1) \/\/ 2","- a = 1","- c = s[i]","- else:","- a += 1","-b += a * (a - 1) \/\/ 2","-print((b - 1))","+def f(s):","+ return \"\".join(sorted(list(s)))","+","+","+s = [f(eval(input())) for _ in range(n)]","+from collections import Counter","+","+d = Counter(s)","+ans = 0","+for i in d:","+ ans += d[i] * (d[i] - 1) \/\/ 2","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0445025706,"measured_runtime_v1":0.0355001631,"runtime_lift":1.2535877798,"key":["s388227571","s390502611"]} +{"user_id":"u057109575","problem_id":"p03241","language":"python","submission_id_v0":"s780320246","submission_id_v1":"s361462099","cpu_time_v0":621,"cpu_time_v1":68,"memory_v0":63056,"memory_v1":64276,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.05,"input":"\n\nN, M = list(map(int, input().split()))\n\n\n\nif M % N == 0:\n\n print((M \/\/ N))\n\nelse:\n\n ans = 1\n\n for n in range(1, M \/\/ N + 1):\n\n res = M - n * N\n\n if res % n == 0:\n\n ans = n\n\n\n\n print(ans)\n","target":"\n\nN, M = list(map(int, input().split()))\n\n\n\ndivisor = []\n\nfor i in range(1, int(M ** 0.5) + 1):\n\n if M % i == 0:\n\n divisor.append(i)\n\n if i != M \/\/ i:\n\n divisor.append(M \/\/ i)\n\n\n\nprint((max([x for x in divisor if x <= M \/\/ N])))\n","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":218,"code_v1_num_chars":252,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nif M % N == 0:\n print((M \/\/ N))\nelse:\n ans = 1\n for n in range(1, M \/\/ N + 1):\n res = M - n * N\n if res % n == 0:\n ans = n\n print(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\ndivisor = []\nfor i in range(1, int(M**0.5) + 1):\n if M % i == 0:\n divisor.append(i)\n if i != M \/\/ i:\n divisor.append(M \/\/ i)\nprint((max([x for x in divisor if x <= M \/\/ N])))\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-if M % N == 0:","- print((M \/\/ N))","-else:","- ans = 1","- for n in range(1, M \/\/ N + 1):","- res = M - n * N","- if res % n == 0:","- ans = n","- print(ans)","+divisor = []","+for i in range(1, int(M**0.5) + 1):","+ if M % i == 0:","+ divisor.append(i)","+ if i != M \/\/ i:","+ divisor.append(M \/\/ i)","+print((max([x for x in divisor if x <= M \/\/ N])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0404291987,"measured_runtime_v1":0.0373928111,"runtime_lift":1.0812024447,"key":["s780320246","s361462099"]} +{"user_id":"u994988729","problem_id":"p02792","language":"python","submission_id_v0":"s224870614","submission_id_v1":"s358829812","cpu_time_v0":211,"cpu_time_v1":164,"memory_v0":3064,"memory_v1":9404,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.27,"input":"N = int(eval(input()))\n\n\n\nd = [[0]*9 for _ in range(9)]\n\n\n\nfor i in range(1, N + 1):\n\n if i % 10 == 0:\n\n continue\n\n s = str(i)\n\n x = int(s[-1])\n\n y = int(s[0])\n\n d[x-1][y-1] += 1\n\n\n\nans = 0\n\nfor i in range(9):\n\n for j in range(9):\n\n ans += d[i][j] * d[j][i]\n\nprint(ans)\n","target":"from collections import defaultdict\n\nN = int(eval(input()))\n\n\n\nd = defaultdict(int)\n\nfor i in range(1, N + 1):\n\n s = str(i)\n\n f = int(s[0])\n\n b = int(s[-1])\n\n d[(f, b)] += 1\n\n\n\nans = 0\n\nfor a in range(1, 10):\n\n for b in range(1, 10):\n\n ans += d[(a, b)] * d[(b, a)]\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":15,"code_v0_num_chars":296,"code_v1_num_chars":292,"code_v0_no_empty_lines":"N = int(eval(input()))\nd = [[0] * 9 for _ in range(9)]\nfor i in range(1, N + 1):\n if i % 10 == 0:\n continue\n s = str(i)\n x = int(s[-1])\n y = int(s[0])\n d[x - 1][y - 1] += 1\nans = 0\nfor i in range(9):\n for j in range(9):\n ans += d[i][j] * d[j][i]\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nN = int(eval(input()))\nd = defaultdict(int)\nfor i in range(1, N + 1):\n s = str(i)\n f = int(s[0])\n b = int(s[-1])\n d[(f, b)] += 1\nans = 0\nfor a in range(1, 10):\n for b in range(1, 10):\n ans += d[(a, b)] * d[(b, a)]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.7647058824,"diff":["+from collections import defaultdict","+","-d = [[0] * 9 for _ in range(9)]","+d = defaultdict(int)","- if i % 10 == 0:","- continue","- x = int(s[-1])","- y = int(s[0])","- d[x - 1][y - 1] += 1","+ f = int(s[0])","+ b = int(s[-1])","+ d[(f, b)] += 1","-for i in range(9):","- for j in range(9):","- ans += d[i][j] * d[j][i]","+for a in range(1, 10):","+ for b in range(1, 10):","+ ans += d[(a, b)] * d[(b, a)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0772229172,"measured_runtime_v1":0.0696994081,"runtime_lift":1.1079422235,"key":["s224870614","s358829812"]} +{"user_id":"u047796752","problem_id":"p03062","language":"python","submission_id_v0":"s829803897","submission_id_v1":"s427251384","cpu_time_v0":191,"cpu_time_v1":107,"memory_v0":88172,"memory_v1":98820,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.98,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\ncnt = 0\n\n\n\nfor Ai in A:\n\n if Ai<0:\n\n cnt += 1\n\n\n\nif cnt%2==0:\n\n print((sum(abs(Ai) for Ai in A)))\n\nelse:\n\n A.sort(key=lambda x: abs(x))\n\n print((-abs(A[0])+sum(abs(Ai) for Ai in A[1:])))","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\ndp = [[0]*2 for _ in range(N)]\n\ndp[0][1] = -10**18\n\n\n\nfor i in range(N-1):\n\n dp[i+1][0] = max(dp[i][0]+A[i], dp[i][1]-A[i])\n\n dp[i+1][1] = max(dp[i][0]-A[i], dp[i][1]+A[i])\n\n\n\nprint((max(dp[-1][0]+A[-1], dp[-1][1]-A[-1])))","code_v0_loc":16,"code_v1_loc":13,"code_v0_num_chars":298,"code_v1_num_chars":323,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nA = list(map(int, input().split()))\ncnt = 0\nfor Ai in A:\n if Ai < 0:\n cnt += 1\nif cnt % 2 == 0:\n print((sum(abs(Ai) for Ai in A)))\nelse:\n A.sort(key=lambda x: abs(x))\n print((-abs(A[0]) + sum(abs(Ai) for Ai in A[1:])))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nA = list(map(int, input().split()))\ndp = [[0] * 2 for _ in range(N)]\ndp[0][1] = -(10**18)\nfor i in range(N - 1):\n dp[i + 1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i])\n dp[i + 1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i])\nprint((max(dp[-1][0] + A[-1], dp[-1][1] - A[-1])))\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-cnt = 0","-for Ai in A:","- if Ai < 0:","- cnt += 1","-if cnt % 2 == 0:","- print((sum(abs(Ai) for Ai in A)))","-else:","- A.sort(key=lambda x: abs(x))","- print((-abs(A[0]) + sum(abs(Ai) for Ai in A[1:])))","+dp = [[0] * 2 for _ in range(N)]","+dp[0][1] = -(10**18)","+for i in range(N - 1):","+ dp[i + 1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i])","+ dp[i + 1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i])","+print((max(dp[-1][0] + A[-1], dp[-1][1] - A[-1])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376557434,"measured_runtime_v1":0.0361616328,"runtime_lift":1.0413175639,"key":["s829803897","s427251384"]} +{"user_id":"u279955105","problem_id":"p02400","language":"python","submission_id_v0":"s312127728","submission_id_v1":"s782044325","cpu_time_v0":40,"cpu_time_v1":20,"memory_v0":7612,"memory_v1":5576,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"import math\n\nr = float(eval(input()))\n\n\n\na = math.pi * r**2\n\nb = math.pi * r * 2\n\n\n\nprint((str(a) + \" \" + str(b)))","target":"Input = float(eval(input()))\n\nArea = Input**2*3.141592653589\n\nCircumference = Input*2*3.141592653589\n\nprint(('{0:.6f} {1:.6f}'.format(Area,Circumference)))\n","code_v0_loc":7,"code_v1_loc":4,"code_v0_num_chars":106,"code_v1_num_chars":148,"code_v0_no_empty_lines":"import math\n\nr = float(eval(input()))\na = math.pi * r**2\nb = math.pi * r * 2\nprint((str(a) + \" \" + str(b)))\n","code_v1_no_empty_lines":"Input = float(eval(input()))\nArea = Input**2 * 3.141592653589\nCircumference = Input * 2 * 3.141592653589\nprint((\"{0:.6f} {1:.6f}\".format(Area, Circumference)))\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-import math","-","-r = float(eval(input()))","-a = math.pi * r**2","-b = math.pi * r * 2","-print((str(a) + \" \" + str(b)))","+Input = float(eval(input()))","+Area = Input**2 * 3.141592653589","+Circumference = Input * 2 * 3.141592653589","+print((\"{0:.6f} {1:.6f}\".format(Area, Circumference)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0078495306,"measured_runtime_v1":0.0394002066,"runtime_lift":0.1992256209,"key":["s312127728","s782044325"]} +{"user_id":"u533039576","problem_id":"p02583","language":"python","submission_id_v0":"s249842939","submission_id_v1":"s723721809","cpu_time_v0":131,"cpu_time_v1":31,"memory_v0":67956,"memory_v1":9080,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.34,"input":"from bisect import bisect_left, bisect_right\n\nn = int(eval(input()))\n\nl = list(map(int, input().split()))\n\nl.sort()\n\n\n\nans = 0\n\nfor i in range(n):\n\n for j in range(i + 1, n):\n\n if l[i] == l[j]:\n\n continue\n\n\n\n for k in range(j + 1, n):\n\n if l[i] == l[k] or l[j] == l[k]:\n\n continue\n\n if l[i] + l[j] > l[k]:\n\n ans += 1\n\n\n\nprint(ans)\n","target":"from bisect import bisect_left, bisect_right\n\nn = int(eval(input()))\n\nl = list(map(int, input().split()))\n\nl.sort()\n\n\n\nans = 0\n\nfor j in range(n):\n\n for k in range(j + 1, n):\n\n if l[j] == l[k]:\n\n continue\n\n\n\n ans += max(bisect_left(l, l[j]) - bisect_right(l, l[k] - l[j]), 0)\n\n\n\nprint(ans)\n","code_v0_loc":18,"code_v1_loc":14,"code_v0_num_chars":405,"code_v1_num_chars":312,"code_v0_no_empty_lines":"from bisect import bisect_left, bisect_right\n\nn = int(eval(input()))\nl = list(map(int, input().split()))\nl.sort()\nans = 0\nfor i in range(n):\n for j in range(i + 1, n):\n if l[i] == l[j]:\n continue\n for k in range(j + 1, n):\n if l[i] == l[k] or l[j] == l[k]:\n continue\n if l[i] + l[j] > l[k]:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"from bisect import bisect_left, bisect_right\n\nn = int(eval(input()))\nl = list(map(int, input().split()))\nl.sort()\nans = 0\nfor j in range(n):\n for k in range(j + 1, n):\n if l[j] == l[k]:\n continue\n ans += max(bisect_left(l, l[j]) - bisect_right(l, l[k] - l[j]), 0)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-for i in range(n):","- for j in range(i + 1, n):","- if l[i] == l[j]:","+for j in range(n):","+ for k in range(j + 1, n):","+ if l[j] == l[k]:","- for k in range(j + 1, n):","- if l[i] == l[k] or l[j] == l[k]:","- continue","- if l[i] + l[j] > l[k]:","- ans += 1","+ ans += max(bisect_left(l, l[j]) - bisect_right(l, l[k] - l[j]), 0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0354711292,"measured_runtime_v1":0.0357159796,"runtime_lift":0.9931445137,"key":["s249842939","s723721809"]} +{"user_id":"u264312747","problem_id":"p02683","language":"python","submission_id_v0":"s215536365","submission_id_v1":"s629806758","cpu_time_v0":145,"cpu_time_v1":79,"memory_v0":27304,"memory_v1":9264,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.52,"input":"#!\/usr\/bin\/python3\n\n# -*- coding: utf-8 -*-\n\nimport numpy as np\n\ndef func(ans, b_list, a_list, c_list, k, x):\n\n if k == 0:\n\n b_list = np.asarray(b_list)\n\n x_list = np.dot(b_list, a_list)\n\n if np.all(x_list >= x):\n\n return np.inner(c_list, b_list)\n\n else:\n\n return ans\n\n ans = min(ans, func(ans, b_list + [1], a_list, c_list, k - 1, x))\n\n ans = min(ans, func(ans, b_list + [0], a_list, c_list, k - 1, x))\n\n return ans\n\n\n\nn, m, x = list(map(int, input().split()))\n\nc_list = [] \n\na_list = []\n\nfor i in range(0, n):\n\n c, *a = list(map(int, input().split()))\n\n c_list.append(c)\n\n a_list.append(a)\n\nans = float(\"inf\")\n\nc_list = np.asarray(c_list)\n\na_list = np.asarray(a_list)\n\nans = min(ans, func(ans, [1], a_list, c_list, n - 1, x))\n\nans = min(ans, func(ans, [0], a_list, c_list, n - 1, x))\n\n\n\nif ans == float(\"inf\"):\n\n print((-1))\n\nelse:\n\n print(ans)\n","target":"n, m, x = list(map(int, input().split()))\n\nc_list = [] \n\na_list = []\n\nfor i in range(0, n):\n\n c, *a = list(map(int, input().split()))\n\n c_list.append(c)\n\n a_list.append(a)\n\nans = float(\"inf\")\n\n\n\nfor x1 in [0, 1]:\n\n for x2 in [0, 1]:\n\n for x3 in [0, 1]:\n\n for x4 in [0, 1]:\n\n for x5 in [0, 1]:\n\n for x6 in [0, 1]:\n\n for x7 in [0, 1]:\n\n for x8 in [0, 1]:\n\n for x9 in [0, 1]:\n\n for x10 in [0, 1]:\n\n for x11 in [0, 1]:\n\n for x12 in [0, 1]:\n\n if n == 1:\n\n x_list = [x1]\n\n elif n == 2:\n\n x_list = [x1, x2]\n\n elif n == 3:\n\n x_list = [x1, x2, x3]\n\n elif n == 4:\n\n x_list = [x1, x2, x3, x4]\n\n elif n == 5:\n\n x_list = [x1, x2, x3, x4 ,x5]\n\n elif n == 6:\n\n x_list = [x1, x2, x3, x4 ,x5, x6]\n\n elif n == 7:\n\n x_list = [x1, x2, x3, x4 ,x5, x6, x7]\n\n elif n == 8:\n\n x_list = [x1, x2, x3, x4 ,x5, x6, x7, x8]\n\n elif n == 9:\n\n x_list = [x1, x2, x3, x4 ,x5, x6, x7, x8, x9]\n\n elif n == 10:\n\n x_list = [x1, x2, x3, x4 ,x5, x6, x7, x8, x9, x10]\n\n elif n == 11:\n\n x_list = [x1, x2, x3, x4 ,x5, x6, x7, x8, x9, x10, x11]\n\n elif n == 12:\n\n x_list = [x1, x2, x3, x4 ,x5, x6, x7, x8, x9, x10, x11, x12]\n\n cost = 0\n\n gaku_list = [0] * m\n\n for i in range(0, n):\n\n if x_list[i] == 1:\n\n for j in range(0, m):\n\n gaku_list[j] += a_list[i][j]\n\n cost += c_list[i]\n\n flag = 1\n\n for gaku in gaku_list:\n\n if gaku < x:\n\n flag = 0\n\n break\n\n if flag == 1 and cost < ans:\n\n ans = cost\n\nif ans == float(\"inf\"):\n\n print((-1))\n\nelse:\n\n print(ans)","code_v0_loc":32,"code_v1_loc":63,"code_v0_num_chars":910,"code_v1_num_chars":2442,"code_v0_no_empty_lines":"#!\/usr\/bin\/python3\n# -*- coding: utf-8 -*-\nimport numpy as np\n\n\ndef func(ans, b_list, a_list, c_list, k, x):\n if k == 0:\n b_list = np.asarray(b_list)\n x_list = np.dot(b_list, a_list)\n if np.all(x_list >= x):\n return np.inner(c_list, b_list)\n else:\n return ans\n ans = min(ans, func(ans, b_list + [1], a_list, c_list, k - 1, x))\n ans = min(ans, func(ans, b_list + [0], a_list, c_list, k - 1, x))\n return ans\n\n\nn, m, x = list(map(int, input().split()))\nc_list = []\na_list = []\nfor i in range(0, n):\n c, *a = list(map(int, input().split()))\n c_list.append(c)\n a_list.append(a)\nans = float(\"inf\")\nc_list = np.asarray(c_list)\na_list = np.asarray(a_list)\nans = min(ans, func(ans, [1], a_list, c_list, n - 1, x))\nans = min(ans, func(ans, [0], a_list, c_list, n - 1, x))\nif ans == float(\"inf\"):\n print((-1))\nelse:\n print(ans)\n","code_v1_no_empty_lines":"n, m, x = list(map(int, input().split()))\nc_list = []\na_list = []\nfor i in range(0, n):\n c, *a = list(map(int, input().split()))\n c_list.append(c)\n a_list.append(a)\nans = float(\"inf\")\nfor x1 in [0, 1]:\n for x2 in [0, 1]:\n for x3 in [0, 1]:\n for x4 in [0, 1]:\n for x5 in [0, 1]:\n for x6 in [0, 1]:\n for x7 in [0, 1]:\n for x8 in [0, 1]:\n for x9 in [0, 1]:\n for x10 in [0, 1]:\n for x11 in [0, 1]:\n for x12 in [0, 1]:\n if n == 1:\n x_list = [x1]\n elif n == 2:\n x_list = [x1, x2]\n elif n == 3:\n x_list = [x1, x2, x3]\n elif n == 4:\n x_list = [x1, x2, x3, x4]\n elif n == 5:\n x_list = [x1, x2, x3, x4, x5]\n elif n == 6:\n x_list = [x1, x2, x3, x4, x5, x6]\n elif n == 7:\n x_list = [\n x1,\n x2,\n x3,\n x4,\n x5,\n x6,\n x7,\n ]\n elif n == 8:\n x_list = [\n x1,\n x2,\n x3,\n x4,\n x5,\n x6,\n x7,\n x8,\n ]\n elif n == 9:\n x_list = [\n x1,\n x2,\n x3,\n x4,\n x5,\n x6,\n x7,\n x8,\n x9,\n ]\n elif n == 10:\n x_list = [\n x1,\n x2,\n x3,\n x4,\n x5,\n x6,\n x7,\n x8,\n x9,\n x10,\n ]\n elif n == 11:\n x_list = [\n x1,\n x2,\n x3,\n x4,\n x5,\n x6,\n x7,\n x8,\n x9,\n x10,\n x11,\n ]\n elif n == 12:\n x_list = [\n x1,\n x2,\n x3,\n x4,\n x5,\n x6,\n x7,\n x8,\n x9,\n x10,\n x11,\n x12,\n ]\n cost = 0\n gaku_list = [0] * m\n for i in range(0, n):\n if x_list[i] == 1:\n for j in range(0, m):\n gaku_list[j] += a_list[i][j]\n cost += c_list[i]\n flag = 1\n for gaku in gaku_list:\n if gaku < x:\n flag = 0\n break\n if flag == 1 and cost < ans:\n ans = cost\nif ans == float(\"inf\"):\n print((-1))\nelse:\n print(ans)\n","code_same":false,"relative_loc_diff_percent":49.2063492063,"diff":["-#!\/usr\/bin\/python3","-# -*- coding: utf-8 -*-","-import numpy as np","-","-","-def func(ans, b_list, a_list, c_list, k, x):","- if k == 0:","- b_list = np.asarray(b_list)","- x_list = np.dot(b_list, a_list)","- if np.all(x_list >= x):","- return np.inner(c_list, b_list)","- else:","- return ans","- ans = min(ans, func(ans, b_list + [1], a_list, c_list, k - 1, x))","- ans = min(ans, func(ans, b_list + [0], a_list, c_list, k - 1, x))","- return ans","-","-","-c_list = np.asarray(c_list)","-a_list = np.asarray(a_list)","-ans = min(ans, func(ans, [1], a_list, c_list, n - 1, x))","-ans = min(ans, func(ans, [0], a_list, c_list, n - 1, x))","+for x1 in [0, 1]:","+ for x2 in [0, 1]:","+ for x3 in [0, 1]:","+ for x4 in [0, 1]:","+ for x5 in [0, 1]:","+ for x6 in [0, 1]:","+ for x7 in [0, 1]:","+ for x8 in [0, 1]:","+ for x9 in [0, 1]:","+ for x10 in [0, 1]:","+ for x11 in [0, 1]:","+ for x12 in [0, 1]:","+ if n == 1:","+ x_list = [x1]","+ elif n == 2:","+ x_list = [x1, x2]","+ elif n == 3:","+ x_list = [x1, x2, x3]","+ elif n == 4:","+ x_list = [x1, x2, x3, x4]","+ elif n == 5:","+ x_list = [x1, x2, x3, x4, x5]","+ elif n == 6:","+ x_list = [x1, x2, x3, x4, x5, x6]","+ elif n == 7:","+ x_list = [","+ x1,","+ x2,","+ x3,","+ x4,","+ x5,","+ x6,","+ x7,","+ ]","+ elif n == 8:","+ x_list = [","+ x1,","+ x2,","+ x3,","+ x4,","+ x5,","+ x6,","+ x7,","+ x8,","+ ]","+ elif n == 9:","+ x_list = [","+ x1,","+ x2,","+ x3,","+ x4,","+ x5,","+ x6,","+ x7,","+ x8,","+ x9,","+ ]","+ elif n == 10:","+ x_list = [","+ x1,","+ x2,","+ x3,","+ x4,","+ x5,","+ x6,","+ x7,","+ x8,","+ x9,","+ x10,","+ ]","+ elif n == 11:","+ x_list = [","+ x1,","+ x2,","+ x3,","+ x4,","+ x5,","+ x6,","+ x7,","+ x8,","+ x9,","+ x10,","+ x11,","+ ]","+ elif n == 12:","+ x_list = [","+ x1,","+ x2,","+ x3,","+ x4,","+ x5,","+ x6,","+ x7,","+ x8,","+ x9,","+ x10,","+ x11,","+ x12,","+ ]","+ cost = 0","+ gaku_list = [0] * m","+ for i in range(0, n):","+ if x_list[i] == 1:","+ for j in range(0, m):","+ gaku_list[j] += a_list[i][j]","+ cost += c_list[i]","+ flag = 1","+ for gaku in gaku_list:","+ if gaku < x:","+ flag = 0","+ break","+ if flag == 1 and cost < ans:","+ ans = cost"],"diff_only_import_comment":false,"measured_runtime_v0":0.3872902184,"measured_runtime_v1":0.2906826317,"runtime_lift":1.3323472959,"key":["s215536365","s629806758"]} +{"user_id":"u028973125","problem_id":"p02571","language":"python","submission_id_v0":"s578690379","submission_id_v1":"s168548144","cpu_time_v0":69,"cpu_time_v1":61,"memory_v0":8988,"memory_v1":9076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.59,"input":"import sys\n\n\n\nS = sys.stdin.readline().strip()\n\nT = sys.stdin.readline().strip()\n\n\n\nls = len(S)\n\nlt = len(T)\n\nmatch = 0\n\nfor i in range(ls - lt + 1):\n\n tmp = 0\n\n for j in range(lt):\n\n if S[i+j] == T[j]:\n\n tmp += 1\n\n match = max(match, tmp)\n\n\n\nprint((lt - match))","target":"import sys\n\n\n\ninput = sys.stdin.readline\n\nS = input().strip()\n\nT = input().strip()\n\n\n\nans = float(\"inf\")\n\nls = len(S)\n\nlt = len(T)\n\nfor i in range(ls - lt + 1):\n\n tmp = 0\n\n for j in range(lt):\n\n if S[i+j] != T[j]:\n\n tmp += 1\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":287,"code_v1_num_chars":287,"code_v0_no_empty_lines":"import sys\n\nS = sys.stdin.readline().strip()\nT = sys.stdin.readline().strip()\nls = len(S)\nlt = len(T)\nmatch = 0\nfor i in range(ls - lt + 1):\n tmp = 0\n for j in range(lt):\n if S[i + j] == T[j]:\n tmp += 1\n match = max(match, tmp)\nprint((lt - match))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nS = input().strip()\nT = input().strip()\nans = float(\"inf\")\nls = len(S)\nlt = len(T)\nfor i in range(ls - lt + 1):\n tmp = 0\n for j in range(lt):\n if S[i + j] != T[j]:\n tmp += 1\n ans = min(ans, tmp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-S = sys.stdin.readline().strip()","-T = sys.stdin.readline().strip()","+input = sys.stdin.readline","+S = input().strip()","+T = input().strip()","+ans = float(\"inf\")","-match = 0","- if S[i + j] == T[j]:","+ if S[i + j] != T[j]:","- match = max(match, tmp)","-print((lt - match))","+ ans = min(ans, tmp)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0364548085,"measured_runtime_v1":0.0428987302,"runtime_lift":0.849787588,"key":["s578690379","s168548144"]} +{"user_id":"u989345508","problem_id":"p03425","language":"python","submission_id_v0":"s120623280","submission_id_v1":"s399599106","cpu_time_v0":233,"cpu_time_v1":169,"memory_v0":10136,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.47,"input":"n=int(eval(input()))\n\nA=[\"M\",\"A\",\"R\",\"C\",\"H\"]\n\nB=[0,0,0,0,0]\n\ns=[]\n\nfor i in range(n):\n\n S=eval(input())\n\n if S[0] in A:\n\n s.append(S)\n\n#print(s)\n\nfor i in s:\n\n for j in range(5):\n\n if A[j]==i[0]:\n\n B[j]+=1\n\n break\n\nc=B.count(0)\n\nif c>2:\n\n print((0))\n\nelse:\n\n c=0\n\n for i in range(3):\n\n for j in range(i+1,4):\n\n for k in range(j+1,5):\n\n c+=(B[i]*B[j]*B[k])\n\n print(c)\n\n#print(B)\n","target":"import itertools\n\nn=int(eval(input()))\n\ns=dict()\n\nfor i in [\"M\",\"A\",\"R\",\"C\",\"H\"]:\n\n s[i]=0\n\nfor i in range(n):\n\n _s=eval(input())\n\n if _s[0] in [\"M\",\"A\",\"R\",\"C\",\"H\"]:\n\n s[_s[0]]+=1\n\ns=list(s.items())\n\nans=0\n\nfor i in range(5):\n\n for j in range(i+1,5):\n\n for k in range(j+1,5):\n\n ans+=(s[i][1]*s[j][1]*s[k][1])\n\nprint(ans)","code_v0_loc":25,"code_v1_loc":16,"code_v0_num_chars":455,"code_v1_num_chars":346,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = [\"M\", \"A\", \"R\", \"C\", \"H\"]\nB = [0, 0, 0, 0, 0]\ns = []\nfor i in range(n):\n S = eval(input())\n if S[0] in A:\n s.append(S)\n# print(s)\nfor i in s:\n for j in range(5):\n if A[j] == i[0]:\n B[j] += 1\n break\nc = B.count(0)\nif c > 2:\n print((0))\nelse:\n c = 0\n for i in range(3):\n for j in range(i + 1, 4):\n for k in range(j + 1, 5):\n c += B[i] * B[j] * B[k]\n print(c)\n# print(B)\n","code_v1_no_empty_lines":"import itertools\n\nn = int(eval(input()))\ns = dict()\nfor i in [\"M\", \"A\", \"R\", \"C\", \"H\"]:\n s[i] = 0\nfor i in range(n):\n _s = eval(input())\n if _s[0] in [\"M\", \"A\", \"R\", \"C\", \"H\"]:\n s[_s[0]] += 1\ns = list(s.items())\nans = 0\nfor i in range(5):\n for j in range(i + 1, 5):\n for k in range(j + 1, 5):\n ans += s[i][1] * s[j][1] * s[k][1]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":36.0,"diff":["+import itertools","+","-A = [\"M\", \"A\", \"R\", \"C\", \"H\"]","-B = [0, 0, 0, 0, 0]","-s = []","+s = dict()","+for i in [\"M\", \"A\", \"R\", \"C\", \"H\"]:","+ s[i] = 0","- S = eval(input())","- if S[0] in A:","- s.append(S)","-# print(s)","-for i in s:","- for j in range(5):","- if A[j] == i[0]:","- B[j] += 1","- break","-c = B.count(0)","-if c > 2:","- print((0))","-else:","- c = 0","- for i in range(3):","- for j in range(i + 1, 4):","- for k in range(j + 1, 5):","- c += B[i] * B[j] * B[k]","- print(c)","-# print(B)","+ _s = eval(input())","+ if _s[0] in [\"M\", \"A\", \"R\", \"C\", \"H\"]:","+ s[_s[0]] += 1","+s = list(s.items())","+ans = 0","+for i in range(5):","+ for j in range(i + 1, 5):","+ for k in range(j + 1, 5):","+ ans += s[i][1] * s[j][1] * s[k][1]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.035396754,"measured_runtime_v1":0.078362766,"runtime_lift":0.451703734,"key":["s120623280","s399599106"]} +{"user_id":"u596505843","problem_id":"p02579","language":"python","submission_id_v0":"s956638307","submission_id_v1":"s394198659","cpu_time_v0":1347,"cpu_time_v1":502,"memory_v0":178056,"memory_v1":98756,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.73,"input":"import sys, math\n\nfrom collections import defaultdict, deque, Counter\n\n#from bisect import bisect_left, bisect_right\n\n#from itertools import combinations, permutations, product\n\nfrom heapq import heappush, heappop\n\n#from functools import lru_cache\n\ninput = sys.stdin.readline\n\nrs = lambda: input().strip()\n\nri = lambda: int(eval(input()))\n\nrl = lambda: list(map(int, input().split()))\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\n\n\nH, W = rl()\n\nC = rl()\n\nD = rl()\n\nM = []\n\nfor i in range(H):\n\n\ts = rs()\n\n\tM.append(s)\n\n\n\nstart = tuple([C[0]-1, C[1]-1])\n\nend = tuple([D[0]-1, D[1]-1])\n\n\n\nqueue = deque()\n\nqueue.append((start, 0))\n\nvisited = defaultdict(lambda: float('inf'))\n\nvisited[start] = 0\n\n\n\nds = [(1,0),(-1,0),(0,1),(0,-1)]\n\nwhile queue:\n\n\tn, d = queue.popleft()\n\n\tif n == end:\n\n\t\tprint(d)\n\n\t\texit()\n\n\tif visited[n] != d:\n\n\t\tcontinue\n\n\ti, j = n\n\n\tnd = d\n\n\tfor di, dj in ds:\n\n\t\tni, nj = i+di, j+dj\n\n\t\tif not (0 <= ni < H and 0 <= nj < W): continue\n\n\t\tif M[ni][nj] == '#': continue\n\n\t\tif nd < visited[(ni,nj)]:\n\n\t\t\tqueue.appendleft(((ni,nj), nd))\n\n\t\t\tvisited[(ni,nj)] = nd\n\n\tnd = d+1\n\n\tfor di in range(-2, 3):\n\n\t\tfor dj in range(-2, 3):\n\n\t\t\tif (di, dj) == (0,0): continue\n\n\t\t\tni, nj = i+di, j+dj\n\n\t\t\tif not (0 <= ni < H and 0 <= nj < W): continue\n\n\t\t\tif M[ni][nj] == '#': continue\n\n\t\t\tif nd < visited[(ni,nj)]:\n\n\t\t\t\tqueue.append(((ni,nj), nd))\n\n\t\t\t\tvisited[(ni,nj)] = nd\n\nprint((-1))\n","target":"import sys, math\n\nfrom collections import defaultdict, deque, Counter\n\n#from bisect import bisect_left, bisect_right\n\n#from itertools import combinations, permutations, product\n\nfrom heapq import heappush, heappop\n\n#from functools import lru_cache\n\ninput = sys.stdin.readline\n\nrs = lambda: input().strip()\n\nri = lambda: int(eval(input()))\n\nrl = lambda: list(map(int, input().split()))\n\nmod = 1000000007\n\nsys.setrecursionlimit(1000000)\n\n\n\nH, W = rl()\n\nC = rl()\n\nD = rl()\n\nM = []\n\nfor i in range(H):\n\n\ts = rs()\n\n\tM.append(s)\n\n\n\nstart = tuple([C[0]-1, C[1]-1])\n\nend = tuple([D[0]-1, D[1]-1])\n\n\n\nqueue = deque()\n\nqueue.append((start, 0))\n\nvisited = [[float('inf')]*W for _ in range(H)]\n\nvisited[start[0]][start[1]] = 0\n\n\n\nds = [(1,0),(-1,0),(0,1),(0,-1)]\n\nwhile queue:\n\n\tn, d = queue.popleft()\n\n\tif n == end:\n\n\t\tprint(d)\n\n\t\texit()\n\n\ti, j = n\n\n\tif visited[i][j] != d:\n\n\t\tcontinue\n\n\tnd = d\n\n\tfor di, dj in ds:\n\n\t\tni, nj = i+di, j+dj\n\n\t\tif not (0 <= ni < H and 0 <= nj < W): continue\n\n\t\tif M[ni][nj] == '#': continue\n\n\t\tif nd < visited[ni][nj]:\n\n\t\t\tqueue.appendleft(((ni,nj), nd))\n\n\t\t\tvisited[ni][nj] = nd\n\n\tnd = d+1\n\n\tfor di in range(-2, 3):\n\n\t\tfor dj in range(-2, 3):\n\n\t\t\tif (di, dj) == (0,0): continue\n\n\t\t\tni, nj = i+di, j+dj\n\n\t\t\tif not (0 <= ni < H and 0 <= nj < W): continue\n\n\t\t\tif M[ni][nj] == '#': continue\n\n\t\t\tif nd < visited[ni][nj]:\n\n\t\t\t\tqueue.append(((ni,nj), nd))\n\n\t\t\t\tvisited[ni][nj] = nd\n\nprint((-1))\n","code_v0_loc":57,"code_v1_loc":57,"code_v0_num_chars":1385,"code_v1_num_chars":1400,"code_v0_no_empty_lines":"import sys, math\nfrom collections import defaultdict, deque, Counter\n\n# from bisect import bisect_left, bisect_right\n# from itertools import combinations, permutations, product\nfrom heapq import heappush, heappop\n\n# from functools import lru_cache\ninput = sys.stdin.readline\nrs = lambda: input().strip()\nri = lambda: int(eval(input()))\nrl = lambda: list(map(int, input().split()))\nmod = 1000000007\nsys.setrecursionlimit(1000000)\nH, W = rl()\nC = rl()\nD = rl()\nM = []\nfor i in range(H):\n s = rs()\n M.append(s)\nstart = tuple([C[0] - 1, C[1] - 1])\nend = tuple([D[0] - 1, D[1] - 1])\nqueue = deque()\nqueue.append((start, 0))\nvisited = defaultdict(lambda: float(\"inf\"))\nvisited[start] = 0\nds = [(1, 0), (-1, 0), (0, 1), (0, -1)]\nwhile queue:\n n, d = queue.popleft()\n if n == end:\n print(d)\n exit()\n if visited[n] != d:\n continue\n i, j = n\n nd = d\n for di, dj in ds:\n ni, nj = i + di, j + dj\n if not (0 <= ni < H and 0 <= nj < W):\n continue\n if M[ni][nj] == \"#\":\n continue\n if nd < visited[(ni, nj)]:\n queue.appendleft(((ni, nj), nd))\n visited[(ni, nj)] = nd\n nd = d + 1\n for di in range(-2, 3):\n for dj in range(-2, 3):\n if (di, dj) == (0, 0):\n continue\n ni, nj = i + di, j + dj\n if not (0 <= ni < H and 0 <= nj < W):\n continue\n if M[ni][nj] == \"#\":\n continue\n if nd < visited[(ni, nj)]:\n queue.append(((ni, nj), nd))\n visited[(ni, nj)] = nd\nprint((-1))\n","code_v1_no_empty_lines":"import sys, math\nfrom collections import defaultdict, deque, Counter\n\n# from bisect import bisect_left, bisect_right\n# from itertools import combinations, permutations, product\nfrom heapq import heappush, heappop\n\n# from functools import lru_cache\ninput = sys.stdin.readline\nrs = lambda: input().strip()\nri = lambda: int(eval(input()))\nrl = lambda: list(map(int, input().split()))\nmod = 1000000007\nsys.setrecursionlimit(1000000)\nH, W = rl()\nC = rl()\nD = rl()\nM = []\nfor i in range(H):\n s = rs()\n M.append(s)\nstart = tuple([C[0] - 1, C[1] - 1])\nend = tuple([D[0] - 1, D[1] - 1])\nqueue = deque()\nqueue.append((start, 0))\nvisited = [[float(\"inf\")] * W for _ in range(H)]\nvisited[start[0]][start[1]] = 0\nds = [(1, 0), (-1, 0), (0, 1), (0, -1)]\nwhile queue:\n n, d = queue.popleft()\n if n == end:\n print(d)\n exit()\n i, j = n\n if visited[i][j] != d:\n continue\n nd = d\n for di, dj in ds:\n ni, nj = i + di, j + dj\n if not (0 <= ni < H and 0 <= nj < W):\n continue\n if M[ni][nj] == \"#\":\n continue\n if nd < visited[ni][nj]:\n queue.appendleft(((ni, nj), nd))\n visited[ni][nj] = nd\n nd = d + 1\n for di in range(-2, 3):\n for dj in range(-2, 3):\n if (di, dj) == (0, 0):\n continue\n ni, nj = i + di, j + dj\n if not (0 <= ni < H and 0 <= nj < W):\n continue\n if M[ni][nj] == \"#\":\n continue\n if nd < visited[ni][nj]:\n queue.append(((ni, nj), nd))\n visited[ni][nj] = nd\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-visited = defaultdict(lambda: float(\"inf\"))","-visited[start] = 0","+visited = [[float(\"inf\")] * W for _ in range(H)]","+visited[start[0]][start[1]] = 0","- if visited[n] != d:","+ i, j = n","+ if visited[i][j] != d:","- i, j = n","- if nd < visited[(ni, nj)]:","+ if nd < visited[ni][nj]:","- visited[(ni, nj)] = nd","+ visited[ni][nj] = nd","- if nd < visited[(ni, nj)]:","+ if nd < visited[ni][nj]:","- visited[(ni, nj)] = nd","+ visited[ni][nj] = nd"],"diff_only_import_comment":false,"measured_runtime_v0":0.0440596998,"measured_runtime_v1":0.0434946494,"runtime_lift":1.0129912612,"key":["s956638307","s394198659"]} +{"user_id":"u618251217","problem_id":"p02683","language":"python","submission_id_v0":"s492088298","submission_id_v1":"s617280914","cpu_time_v0":137,"cpu_time_v1":57,"memory_v0":9260,"memory_v1":9276,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.39,"input":"from sys import stdin\n\ninput = stdin.readline\n\n\n\nN, M, X = list(map(int, input().split()))\n\npricelist = [0] * N\n\nmatrix = [[0] * M for _ in range(N)]\n\nfor i in range(N):\n\n row = list(map(int, input().split()))\n\n pricelist[i] = row.pop(0)\n\n matrix[i] = row\n\n\n\nmintotalprice = 10**5 * 12 + 1\n\nfor bit in range(2**N):\n\n flag = True\n\n for j in range(M):\n\n totalscore = 0\n\n for i in range(N):\n\n if (bit>>i & 1) == 1:\n\n totalscore += matrix[i][j]\n\n if totalscore < X:\n\n flag = False\n\n break\n\n if flag:\n\n totalprice = 0\n\n for i in range(N):\n\n if (bit>>i & 1) == 1:\n\n totalprice += pricelist[i]\n\n mintotalprice = totalprice if mintotalprice > totalprice else mintotalprice\n\n \n\nprint((mintotalprice if mintotalprice != 10**5 * 12 + 1 else -1))","target":"N,M,X = list(map(int, input().split()))\n\nC = [0]*N\n\nA = [[[0]*M] for i in range(N)]\n\nfor i in range(N):\n\n C[i], *A[i] = list(map(int, input().split()))\n\nMAX = 10**5 * 12 + 1\n\nminprice = MAX\n\nfor b in range(2**N):\n\n abilityList = [0]*M\n\n price = 0\n\n for i in range(N):\n\n if b >> i & 1 == 1:\n\n abilityList = [x+y for (x,y) in zip(abilityList, A[i])]\n\n price += C[i]\n\n judge = True\n\n for ability in abilityList:\n\n if ability < X:\n\n judge = False\n\n if judge:\n\n minprice = min(minprice, price)\n\nans = minprice if minprice != MAX else -1\n\nprint(ans)","code_v0_loc":30,"code_v1_loc":22,"code_v0_num_chars":867,"code_v1_num_chars":606,"code_v0_no_empty_lines":"from sys import stdin\n\ninput = stdin.readline\nN, M, X = list(map(int, input().split()))\npricelist = [0] * N\nmatrix = [[0] * M for _ in range(N)]\nfor i in range(N):\n row = list(map(int, input().split()))\n pricelist[i] = row.pop(0)\n matrix[i] = row\nmintotalprice = 10**5 * 12 + 1\nfor bit in range(2**N):\n flag = True\n for j in range(M):\n totalscore = 0\n for i in range(N):\n if (bit >> i & 1) == 1:\n totalscore += matrix[i][j]\n if totalscore < X:\n flag = False\n break\n if flag:\n totalprice = 0\n for i in range(N):\n if (bit >> i & 1) == 1:\n totalprice += pricelist[i]\n mintotalprice = totalprice if mintotalprice > totalprice else mintotalprice\nprint((mintotalprice if mintotalprice != 10**5 * 12 + 1 else -1))\n","code_v1_no_empty_lines":"N, M, X = list(map(int, input().split()))\nC = [0] * N\nA = [[[0] * M] for i in range(N)]\nfor i in range(N):\n C[i], *A[i] = list(map(int, input().split()))\nMAX = 10**5 * 12 + 1\nminprice = MAX\nfor b in range(2**N):\n abilityList = [0] * M\n price = 0\n for i in range(N):\n if b >> i & 1 == 1:\n abilityList = [x + y for (x, y) in zip(abilityList, A[i])]\n price += C[i]\n judge = True\n for ability in abilityList:\n if ability < X:\n judge = False\n if judge:\n minprice = min(minprice, price)\nans = minprice if minprice != MAX else -1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["-from sys import stdin","-","-input = stdin.readline","-pricelist = [0] * N","-matrix = [[0] * M for _ in range(N)]","+C = [0] * N","+A = [[[0] * M] for i in range(N)]","- row = list(map(int, input().split()))","- pricelist[i] = row.pop(0)","- matrix[i] = row","-mintotalprice = 10**5 * 12 + 1","-for bit in range(2**N):","- flag = True","- for j in range(M):","- totalscore = 0","- for i in range(N):","- if (bit >> i & 1) == 1:","- totalscore += matrix[i][j]","- if totalscore < X:","- flag = False","- break","- if flag:","- totalprice = 0","- for i in range(N):","- if (bit >> i & 1) == 1:","- totalprice += pricelist[i]","- mintotalprice = totalprice if mintotalprice > totalprice else mintotalprice","-print((mintotalprice if mintotalprice != 10**5 * 12 + 1 else -1))","+ C[i], *A[i] = list(map(int, input().split()))","+MAX = 10**5 * 12 + 1","+minprice = MAX","+for b in range(2**N):","+ abilityList = [0] * M","+ price = 0","+ for i in range(N):","+ if b >> i & 1 == 1:","+ abilityList = [x + y for (x, y) in zip(abilityList, A[i])]","+ price += C[i]","+ judge = True","+ for ability in abilityList:","+ if ability < X:","+ judge = False","+ if judge:","+ minprice = min(minprice, price)","+ans = minprice if minprice != MAX else -1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0532988884,"measured_runtime_v1":0.0337504818,"runtime_lift":1.5792037778,"key":["s492088298","s617280914"]} +{"user_id":"u414458988","problem_id":"p04030","language":"python","submission_id_v0":"s730151763","submission_id_v1":"s186566679","cpu_time_v0":173,"cpu_time_v1":75,"memory_v0":38256,"memory_v1":65036,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.65,"input":"def main():\n\n s = eval(input())\n\n res = ''\n\n for i in s:\n\n if i == 'B':\n\n res = res[:-1]\n\n else:\n\n res += i\n\n print(res)\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n","target":"def main():\n\n s = eval(input())\n\n from collections import deque\n\n c = deque()\n\n for i in s:\n\n if i == 'B':\n\n if c:\n\n c.pop()\n\n else:\n\n c.append(i)\n\n print((''.join(list(c))))\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":13,"code_v1_loc":14,"code_v0_num_chars":207,"code_v1_num_chars":275,"code_v0_no_empty_lines":"def main():\n s = eval(input())\n res = \"\"\n for i in s:\n if i == \"B\":\n res = res[:-1]\n else:\n res += i\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n s = eval(input())\n from collections import deque\n\n c = deque()\n for i in s:\n if i == \"B\":\n if c:\n c.pop()\n else:\n c.append(i)\n print((\"\".join(list(c))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["- res = \"\"","+ from collections import deque","+","+ c = deque()","- res = res[:-1]","+ if c:","+ c.pop()","- res += i","- print(res)","+ c.append(i)","+ print((\"\".join(list(c))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0366078861,"measured_runtime_v1":0.0373913622,"runtime_lift":0.9790466012,"key":["s730151763","s186566679"]} +{"user_id":"u846694620","problem_id":"p03665","language":"python","submission_id_v0":"s099477213","submission_id_v1":"s701582505","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"n, p = list(map(int, input().split()))\n\n\n\ncount = {0: 0, 1: 0}\n\nfor a in input().split():\n\n count[int(a) % 2] += 1\n\n\n\nif count[1] == 0:\n\n if p == 0:\n\n print((pow(2, n)))\n\n else:\n\n print((0))\n\nelse:\n\n print((pow(2, n - 1)))","target":"import math\n\n \n\n \n\ndef comb(n, r):\n\n return math.factorial(n) \/ math.factorial(r) \/ math.factorial(n - r)\n\n \n\n \n\ndef main():\n\n n, p = list(map(int, input().split()))\n\n a = tuple([int(x) % 2 for x in input().split()])\n\n \n\n if n == 1 and a[0] % 2 != p:\n\n print((0))\n\n return 0\n\n \n\n t = len(tuple([x for x in a if x == 1]))\n\n f = n - t\n\n \n\n f_comb = 0\n\n for j in range(f + 1):\n\n f_comb += comb(f, j)\n\n \n\n t_comb = 0\n\n if p == 0:\n\n for i in range(t + 1):\n\n if i % 2 == 0:\n\n t_comb += comb(t, i)\n\n else:\n\n for i in range(t + 1):\n\n if i % 2 == 1:\n\n t_comb += comb(t, i)\n\n \n\n print((int(t_comb * f_comb)))\n\n \n\n return 0\n\n \n\n \n\nif __name__ == '__main__':\n\n main()","code_v0_loc":13,"code_v1_loc":39,"code_v0_num_chars":236,"code_v1_num_chars":782,"code_v0_no_empty_lines":"n, p = list(map(int, input().split()))\ncount = {0: 0, 1: 0}\nfor a in input().split():\n count[int(a) % 2] += 1\nif count[1] == 0:\n if p == 0:\n print((pow(2, n)))\n else:\n print((0))\nelse:\n print((pow(2, n - 1)))\n","code_v1_no_empty_lines":"import math\n\n\ndef comb(n, r):\n return math.factorial(n) \/ math.factorial(r) \/ math.factorial(n - r)\n\n\ndef main():\n n, p = list(map(int, input().split()))\n a = tuple([int(x) % 2 for x in input().split()])\n if n == 1 and a[0] % 2 != p:\n print((0))\n return 0\n t = len(tuple([x for x in a if x == 1]))\n f = n - t\n f_comb = 0\n for j in range(f + 1):\n f_comb += comb(f, j)\n t_comb = 0\n if p == 0:\n for i in range(t + 1):\n if i % 2 == 0:\n t_comb += comb(t, i)\n else:\n for i in range(t + 1):\n if i % 2 == 1:\n t_comb += comb(t, i)\n print((int(t_comb * f_comb)))\n return 0\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-n, p = list(map(int, input().split()))","-count = {0: 0, 1: 0}","-for a in input().split():","- count[int(a) % 2] += 1","-if count[1] == 0:","+import math","+","+","+def comb(n, r):","+ return math.factorial(n) \/ math.factorial(r) \/ math.factorial(n - r)","+","+","+def main():","+ n, p = list(map(int, input().split()))","+ a = tuple([int(x) % 2 for x in input().split()])","+ if n == 1 and a[0] % 2 != p:","+ print((0))","+ return 0","+ t = len(tuple([x for x in a if x == 1]))","+ f = n - t","+ f_comb = 0","+ for j in range(f + 1):","+ f_comb += comb(f, j)","+ t_comb = 0","- print((pow(2, n)))","+ for i in range(t + 1):","+ if i % 2 == 0:","+ t_comb += comb(t, i)","- print((0))","-else:","- print((pow(2, n - 1)))","+ for i in range(t + 1):","+ if i % 2 == 1:","+ t_comb += comb(t, i)","+ print((int(t_comb * f_comb)))","+ return 0","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0438631759,"measured_runtime_v1":0.0456249318,"runtime_lift":0.9613861132,"key":["s099477213","s701582505"]} +{"user_id":"u989345508","problem_id":"p03574","language":"python","submission_id_v0":"s153550812","submission_id_v1":"s557217036","cpu_time_v0":165,"cpu_time_v1":26,"memory_v0":12800,"memory_v1":3572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.24,"input":"import numpy as np\n\nh,w=input().split()\n\nh,w=int(h),int(w)\n\nt1=[]\n\nfor i in range(h):\n\n s1=list(input())\n\n t1.append(s1)\n\n\n\nt2=[[0 for i in range(w)] for i in range(h)]\n\nfor i in range(h):\n\n for j in range(w):\n\n if t1[i][j]==\"#\":\n\n for k in range(3):\n\n for l in range(3):\n\n if k==1 and l==1:\n\n continue\n\n if i+k-1>=0 and j+l-1>=0 and i+k-1=0 and j-1>=0:\n\n if s[i-1][j-1]==\"#\":\n\n cnt+=1\n\n if i-1>=0 and j+1<=w-1:\n\n if s[i-1][j+1]==\"#\":\n\n cnt+=1\n\n if i+1<=h-1 and j-1>=0:\n\n if s[i+1][j-1]==\"#\":\n\n cnt+=1\n\n if i+1<=h-1 and j+1<=w-1:\n\n if s[i+1][j+1]==\"#\":\n\n cnt+=1\n\n if i-1>=0:\n\n if s[i-1][j]==\"#\":\n\n cnt+=1\n\n if j-1>=0:\n\n if s[i][j-1]==\"#\":\n\n cnt+=1\n\n if i+1<=h-1:\n\n if s[i+1][j]==\"#\":\n\n cnt+=1\n\n if j+1<=w-1:\n\n if s[i][j+1]==\"#\":\n\n cnt+=1\n\n return str(cnt)\n\nfor i in range(h):\n\n for j in range(w):\n\n if s[i][j]==\"#\":\n\n print(\"#\",end=\"\")\n\n else:\n\n print(count_8(i,j),end=\"\")\n\n print()\n","code_v0_loc":23,"code_v1_loc":37,"code_v0_num_chars":646,"code_v1_num_chars":880,"code_v0_no_empty_lines":"import numpy as np\n\nh, w = input().split()\nh, w = int(h), int(w)\nt1 = []\nfor i in range(h):\n s1 = list(input())\n t1.append(s1)\nt2 = [[0 for i in range(w)] for i in range(h)]\nfor i in range(h):\n for j in range(w):\n if t1[i][j] == \"#\":\n for k in range(3):\n for l in range(3):\n if k == 1 and l == 1:\n continue\n if (\n i + k - 1 >= 0\n and j + l - 1 >= 0\n and i + k - 1 < h\n and j + l - 1 < w\n and t1[i + k - 1][j + l - 1] != \"#\"\n ):\n t2[i + k - 1][j + l - 1] += 1\n t2[i][j] = \"#\"\nfor i in range(h):\n for j in range(w):\n print(t2[i][j], end=\"\")\n print(\"\")\n","code_v1_no_empty_lines":"h, w = map(int, input().split())\ns = [list(input()) for i in range(h)]\n\n\ndef count_8(i, j):\n global h, w, s\n cnt = 0\n if i - 1 >= 0 and j - 1 >= 0:\n if s[i - 1][j - 1] == \"#\":\n cnt += 1\n if i - 1 >= 0 and j + 1 <= w - 1:\n if s[i - 1][j + 1] == \"#\":\n cnt += 1\n if i + 1 <= h - 1 and j - 1 >= 0:\n if s[i + 1][j - 1] == \"#\":\n cnt += 1\n if i + 1 <= h - 1 and j + 1 <= w - 1:\n if s[i + 1][j + 1] == \"#\":\n cnt += 1\n if i - 1 >= 0:\n if s[i - 1][j] == \"#\":\n cnt += 1\n if j - 1 >= 0:\n if s[i][j - 1] == \"#\":\n cnt += 1\n if i + 1 <= h - 1:\n if s[i + 1][j] == \"#\":\n cnt += 1\n if j + 1 <= w - 1:\n if s[i][j + 1] == \"#\":\n cnt += 1\n return str(cnt)\n\n\nfor i in range(h):\n for j in range(w):\n if s[i][j] == \"#\":\n print(\"#\", end=\"\")\n else:\n print(count_8(i, j), end=\"\")\n print()\n","code_same":false,"relative_loc_diff_percent":37.8378378378,"diff":["-import numpy as np","+h, w = map(int, input().split())","+s = [list(input()) for i in range(h)]","-h, w = input().split()","-h, w = int(h), int(w)","-t1 = []","-for i in range(h):","- s1 = list(input())","- t1.append(s1)","-t2 = [[0 for i in range(w)] for i in range(h)]","+","+def count_8(i, j):","+ global h, w, s","+ cnt = 0","+ if i - 1 >= 0 and j - 1 >= 0:","+ if s[i - 1][j - 1] == \"#\":","+ cnt += 1","+ if i - 1 >= 0 and j + 1 <= w - 1:","+ if s[i - 1][j + 1] == \"#\":","+ cnt += 1","+ if i + 1 <= h - 1 and j - 1 >= 0:","+ if s[i + 1][j - 1] == \"#\":","+ cnt += 1","+ if i + 1 <= h - 1 and j + 1 <= w - 1:","+ if s[i + 1][j + 1] == \"#\":","+ cnt += 1","+ if i - 1 >= 0:","+ if s[i - 1][j] == \"#\":","+ cnt += 1","+ if j - 1 >= 0:","+ if s[i][j - 1] == \"#\":","+ cnt += 1","+ if i + 1 <= h - 1:","+ if s[i + 1][j] == \"#\":","+ cnt += 1","+ if j + 1 <= w - 1:","+ if s[i][j + 1] == \"#\":","+ cnt += 1","+ return str(cnt)","+","+","- if t1[i][j] == \"#\":","- for k in range(3):","- for l in range(3):","- if k == 1 and l == 1:","- continue","- if (","- i + k - 1 >= 0","- and j + l - 1 >= 0","- and i + k - 1 < h","- and j + l - 1 < w","- and t1[i + k - 1][j + l - 1] != \"#\"","- ):","- t2[i + k - 1][j + l - 1] += 1","- t2[i][j] = \"#\"","-for i in range(h):","- for j in range(w):","- print(t2[i][j], end=\"\")","- print(\"\")","+ if s[i][j] == \"#\":","+ print(\"#\", end=\"\")","+ else:","+ print(count_8(i, j), end=\"\")","+ print()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463025644,"measured_runtime_v1":0.0815524759,"runtime_lift":0.5677640544,"key":["s153550812","s557217036"]} +{"user_id":"u976225138","problem_id":"p03486","language":"python","submission_id_v0":"s605351969","submission_id_v1":"s139713746","cpu_time_v0":31,"cpu_time_v1":28,"memory_v0":9096,"memory_v1":9096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.68,"input":"s = sorted(eval(input()))\n\nt = sorted(eval(input()))\n\nt.reverse()\n\n\n\nst = [s, t]\n\nif st == sorted(st) and s != t:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","target":"s = sorted(eval(input()))\n\nt = sorted(eval(input()))\n\nt.reverse()\n\n\n\nts = [t, s]\n\nif ts != sorted(ts):\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":143,"code_v1_num_chars":132,"code_v0_no_empty_lines":"s = sorted(eval(input()))\nt = sorted(eval(input()))\nt.reverse()\nst = [s, t]\nif st == sorted(st) and s != t:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"s = sorted(eval(input()))\nt = sorted(eval(input()))\nt.reverse()\nts = [t, s]\nif ts != sorted(ts):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-st = [s, t]","-if st == sorted(st) and s != t:","+ts = [t, s]","+if ts != sorted(ts):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0452798232,"measured_runtime_v1":0.0354083149,"runtime_lift":1.2787906819,"key":["s605351969","s139713746"]} +{"user_id":"u006657459","problem_id":"p03296","language":"python","submission_id_v0":"s004435502","submission_id_v1":"s710063431","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"import random\n\nN = int(eval(input()))\n\na = [int(ai) for ai in input().split()]\n\n\n\nrandom.seed(42)\n\ncount = 0\n\nfor i in range(0, N-1):\n\n if a[i] == a[i+1]:\n\n count += 1\n\n while a[i] == a[i+1]:\n\n a[i+1] = random.randint(1, N)\n\n if i < N - 2:\n\n while a[i+1] == a[i+2]:\n\n a[i+1] = random.randint(1, N)\n\n\n\nprint(count)","target":"N = int(eval(input()))\n\na = [int(ai) for ai in input().split()]\n\n\n\ncount = 0\n\nfor i in range(0, N-1):\n\n if a[i] == a[i+1]:\n\n count += 1\n\n a[i+1] = float('inf')\n\nprint(count)","code_v0_loc":16,"code_v1_loc":9,"code_v0_num_chars":360,"code_v1_num_chars":184,"code_v0_no_empty_lines":"import random\n\nN = int(eval(input()))\na = [int(ai) for ai in input().split()]\nrandom.seed(42)\ncount = 0\nfor i in range(0, N - 1):\n if a[i] == a[i + 1]:\n count += 1\n while a[i] == a[i + 1]:\n a[i + 1] = random.randint(1, N)\n if i < N - 2:\n while a[i + 1] == a[i + 2]:\n a[i + 1] = random.randint(1, N)\nprint(count)\n","code_v1_no_empty_lines":"N = int(eval(input()))\na = [int(ai) for ai in input().split()]\ncount = 0\nfor i in range(0, N - 1):\n if a[i] == a[i + 1]:\n count += 1\n a[i + 1] = float(\"inf\")\nprint(count)\n","code_same":false,"relative_loc_diff_percent":43.75,"diff":["-import random","-","-random.seed(42)","- while a[i] == a[i + 1]:","- a[i + 1] = random.randint(1, N)","- if i < N - 2:","- while a[i + 1] == a[i + 2]:","- a[i + 1] = random.randint(1, N)","+ a[i + 1] = float(\"inf\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0387938857,"measured_runtime_v1":0.057191633,"runtime_lift":0.6783140064,"key":["s004435502","s710063431"]} +{"user_id":"u314837274","problem_id":"p03545","language":"python","submission_id_v0":"s431116619","submission_id_v1":"s867140652","cpu_time_v0":29,"cpu_time_v1":26,"memory_v0":9116,"memory_v1":9068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.34,"input":"from itertools import product\n\ns=eval(input())\n\n\n\nfor operators in product([\"+\",\"-\"],repeat=3):\n\n formula=\"\"\n\n for i in range(3):\n\n formula+=s[i]+operators[i]\n\n formula+=s[-1]\n\n if eval(formula)==7:\n\n print((formula+\"=7\"))\n\n exit()\n\n ","target":"from itertools import product\n\n\n\ns=eval(input())\n\n\n\nfor op in product([\"+\",\"-\"],repeat=3):\n\n formula =\"\"\n\n for i in range(3):\n\n formula+=s[i]+op[i]\n\n formula+=s[-1]\n\n if eval(formula)==7:\n\n print((formula+\"=7\"))\n\n exit()","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":240,"code_v1_num_chars":225,"code_v0_no_empty_lines":"from itertools import product\n\ns = eval(input())\nfor operators in product([\"+\", \"-\"], repeat=3):\n formula = \"\"\n for i in range(3):\n formula += s[i] + operators[i]\n formula += s[-1]\n if eval(formula) == 7:\n print((formula + \"=7\"))\n exit()\n","code_v1_no_empty_lines":"from itertools import product\n\ns = eval(input())\nfor op in product([\"+\", \"-\"], repeat=3):\n formula = \"\"\n for i in range(3):\n formula += s[i] + op[i]\n formula += s[-1]\n if eval(formula) == 7:\n print((formula + \"=7\"))\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for operators in product([\"+\", \"-\"], repeat=3):","+for op in product([\"+\", \"-\"], repeat=3):","- formula += s[i] + operators[i]","+ formula += s[i] + op[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463428266,"measured_runtime_v1":0.0479307604,"runtime_lift":0.9668702567,"key":["s431116619","s867140652"]} +{"user_id":"u786020649","problem_id":"p03450","language":"python","submission_id_v0":"s814672328","submission_id_v1":"s555636527","cpu_time_v0":531,"cpu_time_v1":486,"memory_v0":74380,"memory_v1":74568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.47,"input":"import sys\n\nsys.setrecursionlimit(10**9)\n\n\n\nread=sys.stdin.read\n\nclass Unionfind():\n\n def __init__(self,n):\n\n self.parents=[-1]*n\n\n self.dist=[0]*n \n\n \n\n def find(self,x):\n\n if self.parents[x]<0:\n\n return x,self.dist[x]\n\n else:\n\n tmp=self.find(self.parents[x])\n\n self.parents[x]=tmp[0]\n\n self.dist[x]+=tmp[1]\n\n return self.parents[x],self.dist[x]\n\n \n\n def union(self,x,y,d):\n\n rx=self.find(x)[0]\n\n ry=self.find(y)[0]\n\n diff=self.dist[y]-self.dist[x]-d\n\n if rx==ry:\n\n if diff!=0:\n\n return True\n\n return False\n\n if diff<0:\n\n rx,ry=ry,rx\n\n diff=-diff\n\n self.parents[ry]=min(self.parents[ry],self.parents[rx]-diff)\n\n self.parents[rx]=ry\n\n self.dist[rx]=diff\n\n return False\n\n \n\ndef main():\n\n n,m,*lrd=list(map(int,read().split()))\n\n v=Unionfind(n)\n\n for l,r,d in zip(*[iter(lrd)]*3):\n\n if v.union(l-1,r-1,d):\n\n print('No')\n\n break\n\n else:\n\n print('Yes')\n\nif __name__=='__main__':\n\n main()\n","target":"import sys\n\nsys.setrecursionlimit(10**9)\n\n\n\nread=sys.stdin.read\n\nclass Unionfind():\n\n def __init__(self,n):\n\n self.parents=[-1]*n\n\n self.dist=[0]*n \n\n \n\n def find(self,x):\n\n if self.parents[x]<0:\n\n return self.dist[x],x\n\n else:\n\n tmp=self.find(self.parents[x])\n\n self.dist[x]+=tmp[0]\n\n self.parents[x]=tmp[1]\n\n return self.dist[x], self.parents[x]\n\n \n\n def union(self,x,y,d):\n\n _,rx=self.find(x)\n\n _,ry=self.find(y)\n\n diff=self.dist[y]-self.dist[x]-d\n\n if rx==ry:\n\n if diff!=0:\n\n return True\n\n return False\n\n if diff<0:\n\n rx,ry=ry,rx\n\n diff=-diff\n\n self.parents[ry]=min(self.parents[ry],self.parents[rx]-diff)\n\n self.parents[rx]=ry\n\n self.dist[rx]=diff\n\n return False\n\n \n\ndef main():\n\n n,m,*lrd=list(map(int,read().split()))\n\n v=Unionfind(n)\n\n for l,r,d in zip(*[iter(lrd)]*3):\n\n if v.union(l-1,r-1,d):\n\n print('No')\n\n break\n\n else:\n\n if max(-d-1 for d in v.parents if d<0) >10**9:\n\n print('No')\n\n else:\n\n print('Yes')\n\nif __name__=='__main__':\n\n main()\n","code_v0_loc":45,"code_v1_loc":48,"code_v0_num_chars":1152,"code_v1_num_chars":1247,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nread = sys.stdin.read\n\n\nclass Unionfind:\n def __init__(self, n):\n self.parents = [-1] * n\n self.dist = [0] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x, self.dist[x]\n else:\n tmp = self.find(self.parents[x])\n self.parents[x] = tmp[0]\n self.dist[x] += tmp[1]\n return self.parents[x], self.dist[x]\n\n def union(self, x, y, d):\n rx = self.find(x)[0]\n ry = self.find(y)[0]\n diff = self.dist[y] - self.dist[x] - d\n if rx == ry:\n if diff != 0:\n return True\n return False\n if diff < 0:\n rx, ry = ry, rx\n diff = -diff\n self.parents[ry] = min(self.parents[ry], self.parents[rx] - diff)\n self.parents[rx] = ry\n self.dist[rx] = diff\n return False\n\n\ndef main():\n n, m, *lrd = list(map(int, read().split()))\n v = Unionfind(n)\n for l, r, d in zip(*[iter(lrd)] * 3):\n if v.union(l - 1, r - 1, d):\n print(\"No\")\n break\n else:\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nread = sys.stdin.read\n\n\nclass Unionfind:\n def __init__(self, n):\n self.parents = [-1] * n\n self.dist = [0] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return self.dist[x], x\n else:\n tmp = self.find(self.parents[x])\n self.dist[x] += tmp[0]\n self.parents[x] = tmp[1]\n return self.dist[x], self.parents[x]\n\n def union(self, x, y, d):\n _, rx = self.find(x)\n _, ry = self.find(y)\n diff = self.dist[y] - self.dist[x] - d\n if rx == ry:\n if diff != 0:\n return True\n return False\n if diff < 0:\n rx, ry = ry, rx\n diff = -diff\n self.parents[ry] = min(self.parents[ry], self.parents[rx] - diff)\n self.parents[rx] = ry\n self.dist[rx] = diff\n return False\n\n\ndef main():\n n, m, *lrd = list(map(int, read().split()))\n v = Unionfind(n)\n for l, r, d in zip(*[iter(lrd)] * 3):\n if v.union(l - 1, r - 1, d):\n print(\"No\")\n break\n else:\n if max(-d - 1 for d in v.parents if d < 0) > 10**9:\n print(\"No\")\n else:\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["- return x, self.dist[x]","+ return self.dist[x], x","- self.parents[x] = tmp[0]","- self.dist[x] += tmp[1]","- return self.parents[x], self.dist[x]","+ self.dist[x] += tmp[0]","+ self.parents[x] = tmp[1]","+ return self.dist[x], self.parents[x]","- rx = self.find(x)[0]","- ry = self.find(y)[0]","+ _, rx = self.find(x)","+ _, ry = self.find(y)","- print(\"Yes\")","+ if max(-d - 1 for d in v.parents if d < 0) > 10**9:","+ print(\"No\")","+ else:","+ print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0724239349,"measured_runtime_v1":0.0652001381,"runtime_lift":1.1107941953,"key":["s814672328","s555636527"]} +{"user_id":"u179376941","problem_id":"p02585","language":"python","submission_id_v0":"s909183720","submission_id_v1":"s401763945","cpu_time_v0":558,"cpu_time_v1":283,"memory_v0":81792,"memory_v1":75544,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.28,"input":"n, k = list(map(int, input().split()))\n\npositions = [int(i) for i in input().split()]\n\nscores = [int(i) for i in input().split()]\n\nif max(scores) <= 0:\n\n print((max(scores)))\n\nelse:\n\n positions = [0] + positions\n\n scores = [0] + scores\n\n max_point = -pow(10, 9)\n\n #print(max_point)\n\n for i in range(1, n + 1):\n\n s = []\n\n f_pos = positions[i]\n\n score = scores[f_pos]\n\n s.append(score)\n\n while f_pos != i:\n\n f_pos = positions[f_pos]\n\n score += scores[f_pos]\n\n s.append(score)\n\n loop = len(s)\n\n if loop >= k:\n\n point = max(s[:k])\n\n elif s[-1] <= 0:\n\n point = max(s)\n\n else:\n\n loop_c = k \/\/ loop\n\n r = k % loop\n\n point1 = s[-1] * loop_c\n\n if r != 0:\n\n point1 += max(s[:r])\n\n point2 = s[-1] * (loop_c - 1)\n\n point2 += max(0, max(s))\n\n point = max(point1, point2)\n\n max_point = max(max_point, point)\n\n print(max_point)\n","target":"n, k = list(map(int, input().split()))\n\npositions = [int(i) for i in input().split()]\n\nscores = [int(i) for i in input().split()]\n\nif max(scores) <= 0:\n\n print((max(scores)))\n\nelse:\n\n positions = [0] + positions\n\n scores = [0] + scores\n\n max_point = -pow(10, 9)\n\n #print(max_point)\n\n dic = {}\n\n for i in range(1, n + 1):\n\n f_pos = i\n\n #print('f_pos',f_pos)\n\n if f_pos not in dic:\n\n point_loop = 0\n\n loop = 0\n\n pos_set = set([f_pos])\n\n while True:\n\n f_pos = positions[f_pos]\n\n point_loop += scores[f_pos]\n\n #print('pos', f_pos)\n\n #print(point)\n\n loop += 1\n\n if f_pos in pos_set:\n\n for j in pos_set:\n\n dic[j] = [loop, point_loop]\n\n break\n\n pos_set.add(f_pos)\n\n else:\n\n loop, point_loop = dic[f_pos]\n\n #print(loop, point)\n\n loop_c = k \/\/ loop\n\n r = k % loop\n\n if loop_c == 0 or point_loop <= 0:\n\n if point_loop <= 0:\n\n if loop_c > 0:\n\n r = loop\n\n point = 0\n\n for _ in range(r):\n\n f_pos = positions[f_pos]\n\n point += scores[f_pos]\n\n max_point = max(max_point, point)\n\n else:\n\n point1, point2 = 0, 0\n\n point1 = loop_c * point_loop\n\n max_point1 = point1\n\n for _ in range(r):\n\n f_pos = positions[f_pos]\n\n point1 += scores[f_pos]\n\n max_point1 = max(point1, max_point1)\n\n f_pos = i\n\n point2 = (loop_c - 1) * point_loop\n\n max_point2 = point2\n\n for _ in range(loop):\n\n f_pos = positions[f_pos]\n\n point2 += scores[f_pos]\n\n max_point2 = max(point2, max_point2)\n\n max_point = max(max_point, max(max_point1, max_point2))\n\n print(max_point)\n","code_v0_loc":35,"code_v1_loc":60,"code_v0_num_chars":909,"code_v1_num_chars":1694,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\npositions = [int(i) for i in input().split()]\nscores = [int(i) for i in input().split()]\nif max(scores) <= 0:\n print((max(scores)))\nelse:\n positions = [0] + positions\n scores = [0] + scores\n max_point = -pow(10, 9)\n # print(max_point)\n for i in range(1, n + 1):\n s = []\n f_pos = positions[i]\n score = scores[f_pos]\n s.append(score)\n while f_pos != i:\n f_pos = positions[f_pos]\n score += scores[f_pos]\n s.append(score)\n loop = len(s)\n if loop >= k:\n point = max(s[:k])\n elif s[-1] <= 0:\n point = max(s)\n else:\n loop_c = k \/\/ loop\n r = k % loop\n point1 = s[-1] * loop_c\n if r != 0:\n point1 += max(s[:r])\n point2 = s[-1] * (loop_c - 1)\n point2 += max(0, max(s))\n point = max(point1, point2)\n max_point = max(max_point, point)\n print(max_point)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\npositions = [int(i) for i in input().split()]\nscores = [int(i) for i in input().split()]\nif max(scores) <= 0:\n print((max(scores)))\nelse:\n positions = [0] + positions\n scores = [0] + scores\n max_point = -pow(10, 9)\n # print(max_point)\n dic = {}\n for i in range(1, n + 1):\n f_pos = i\n # print('f_pos',f_pos)\n if f_pos not in dic:\n point_loop = 0\n loop = 0\n pos_set = set([f_pos])\n while True:\n f_pos = positions[f_pos]\n point_loop += scores[f_pos]\n # print('pos', f_pos)\n # print(point)\n loop += 1\n if f_pos in pos_set:\n for j in pos_set:\n dic[j] = [loop, point_loop]\n break\n pos_set.add(f_pos)\n else:\n loop, point_loop = dic[f_pos]\n # print(loop, point)\n loop_c = k \/\/ loop\n r = k % loop\n if loop_c == 0 or point_loop <= 0:\n if point_loop <= 0:\n if loop_c > 0:\n r = loop\n point = 0\n for _ in range(r):\n f_pos = positions[f_pos]\n point += scores[f_pos]\n max_point = max(max_point, point)\n else:\n point1, point2 = 0, 0\n point1 = loop_c * point_loop\n max_point1 = point1\n for _ in range(r):\n f_pos = positions[f_pos]\n point1 += scores[f_pos]\n max_point1 = max(point1, max_point1)\n f_pos = i\n point2 = (loop_c - 1) * point_loop\n max_point2 = point2\n for _ in range(loop):\n f_pos = positions[f_pos]\n point2 += scores[f_pos]\n max_point2 = max(point2, max_point2)\n max_point = max(max_point, max(max_point1, max_point2))\n print(max_point)\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["+ dic = {}","- s = []","- f_pos = positions[i]","- score = scores[f_pos]","- s.append(score)","- while f_pos != i:","- f_pos = positions[f_pos]","- score += scores[f_pos]","- s.append(score)","- loop = len(s)","- if loop >= k:","- point = max(s[:k])","- elif s[-1] <= 0:","- point = max(s)","+ f_pos = i","+ # print('f_pos',f_pos)","+ if f_pos not in dic:","+ point_loop = 0","+ loop = 0","+ pos_set = set([f_pos])","+ while True:","+ f_pos = positions[f_pos]","+ point_loop += scores[f_pos]","+ # print('pos', f_pos)","+ # print(point)","+ loop += 1","+ if f_pos in pos_set:","+ for j in pos_set:","+ dic[j] = [loop, point_loop]","+ break","+ pos_set.add(f_pos)","- loop_c = k \/\/ loop","- r = k % loop","- point1 = s[-1] * loop_c","- if r != 0:","- point1 += max(s[:r])","- point2 = s[-1] * (loop_c - 1)","- point2 += max(0, max(s))","- point = max(point1, point2)","- max_point = max(max_point, point)","+ loop, point_loop = dic[f_pos]","+ # print(loop, point)","+ loop_c = k \/\/ loop","+ r = k % loop","+ if loop_c == 0 or point_loop <= 0:","+ if point_loop <= 0:","+ if loop_c > 0:","+ r = loop","+ point = 0","+ for _ in range(r):","+ f_pos = positions[f_pos]","+ point += scores[f_pos]","+ max_point = max(max_point, point)","+ else:","+ point1, point2 = 0, 0","+ point1 = loop_c * point_loop","+ max_point1 = point1","+ for _ in range(r):","+ f_pos = positions[f_pos]","+ point1 += scores[f_pos]","+ max_point1 = max(point1, max_point1)","+ f_pos = i","+ point2 = (loop_c - 1) * point_loop","+ max_point2 = point2","+ for _ in range(loop):","+ f_pos = positions[f_pos]","+ point2 += scores[f_pos]","+ max_point2 = max(point2, max_point2)","+ max_point = max(max_point, max(max_point1, max_point2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0342368016,"measured_runtime_v1":0.0359951668,"runtime_lift":0.9511499648,"key":["s909183720","s401763945"]} +{"user_id":"u606045429","problem_id":"p03721","language":"python","submission_id_v0":"s226457521","submission_id_v1":"s535798690","cpu_time_v0":336,"cpu_time_v1":165,"memory_v0":10544,"memory_v1":10636,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.89,"input":"from itertools import accumulate\n\nfrom bisect import bisect_left\n\n\n\nN, K = [int(i) for i in input().split()]\n\n\n\nmemo = [0] * 100010\n\nfor _ in range(N):\n\n a, b = [int(i) for i in input().split()]\n\n memo[a] += b\n\n\n\nprint((bisect_left(list(accumulate(memo)), K)))","target":"from sys import stdin\n\ninput = stdin.readline\n\n\n\nfrom itertools import accumulate\n\nfrom bisect import bisect_left\n\n\n\nN, K = [int(i) for i in input().split()]\n\n\n\nmemo = [0] * 100010\n\nfor _ in range(N):\n\n a, b = [int(i) for i in input().split()]\n\n memo[a] += b\n\n\n\nprint((bisect_left(list(accumulate(memo)), K)))","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":264,"code_v1_num_chars":313,"code_v0_no_empty_lines":"from itertools import accumulate\nfrom bisect import bisect_left\n\nN, K = [int(i) for i in input().split()]\nmemo = [0] * 100010\nfor _ in range(N):\n a, b = [int(i) for i in input().split()]\n memo[a] += b\nprint((bisect_left(list(accumulate(memo)), K)))\n","code_v1_no_empty_lines":"from sys import stdin\n\ninput = stdin.readline\nfrom itertools import accumulate\nfrom bisect import bisect_left\n\nN, K = [int(i) for i in input().split()]\nmemo = [0] * 100010\nfor _ in range(N):\n a, b = [int(i) for i in input().split()]\n memo[a] += b\nprint((bisect_left(list(accumulate(memo)), K)))\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["+from sys import stdin","+","+input = stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.1028005924,"measured_runtime_v1":0.0436914919,"runtime_lift":2.3528743899,"key":["s226457521","s535798690"]} +{"user_id":"u918601425","problem_id":"p03043","language":"python","submission_id_v0":"s076715386","submission_id_v1":"s440554231","cpu_time_v0":119,"cpu_time_v1":109,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.4,"input":"import math\n\nN,K=[int(s) for s in input().split()]\n\nsum=0\n\nfor i in range(N):\n\n a=max([math.log(K\/(i+1), 2),0])\n\n a=math.ceil(a)\n\n sum=sum+0.5**a\n\nprint((sum\/N))","target":"import math\n\nN,K=[int(s) for s in input().split()]\n\na=0\n\nfor i in range(N):\n\n a+=2**(-max([0,math.ceil(math.log2(K\/(i+1)))]))\n\nprint((a\/N))","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":162,"code_v1_num_chars":138,"code_v0_no_empty_lines":"import math\n\nN, K = [int(s) for s in input().split()]\nsum = 0\nfor i in range(N):\n a = max([math.log(K \/ (i + 1), 2), 0])\n a = math.ceil(a)\n sum = sum + 0.5**a\nprint((sum \/ N))\n","code_v1_no_empty_lines":"import math\n\nN, K = [int(s) for s in input().split()]\na = 0\nfor i in range(N):\n a += 2 ** (-max([0, math.ceil(math.log2(K \/ (i + 1)))]))\nprint((a \/ N))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-sum = 0","+a = 0","- a = max([math.log(K \/ (i + 1), 2), 0])","- a = math.ceil(a)","- sum = sum + 0.5**a","-print((sum \/ N))","+ a += 2 ** (-max([0, math.ceil(math.log2(K \/ (i + 1)))]))","+print((a \/ N))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3124488714,"measured_runtime_v1":0.1744795192,"runtime_lift":1.790748122,"key":["s076715386","s440554231"]} +{"user_id":"u606045429","problem_id":"p03409","language":"python","submission_id_v0":"s623830506","submission_id_v1":"s602529182","cpu_time_v0":24,"cpu_time_v1":18,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"N = int(eval(input()))\n\nR = [[int(i) for i in input().split()] for _ in range(N)]\n\nB = [[int(i) for i in input().split()] for _ in range(N)]\n\n\n\nR.sort()\n\nB.sort()\n\n\n\ncount = 0\n\ntmp = []\n\nfor bx, by in B:\n\n for rx, ry in R:\n\n if bx > rx and by > ry:\n\n tmp.append([rx, ry])\n\n if tmp != []:\n\n max_red = max(tmp, key=lambda r: r[1])\n\n count += 1\n\n R.remove(max_red)\n\n tmp = []\n\nprint(count)\n\n\n","target":"N, *I = list(map(int, open(0).read().split()))\n\nAB = list(zip(*[iter(I[:2 * N])] * 2))\n\nCD = sorted(zip(*[iter(I[2 * N:])] * 2))\n\n\n\nfor c, d in CD:\n\n ma = max(((a, b) for a, b in AB if a < c and b < d), key=lambda x: x[1], default=None)\n\n if ma:\n\n AB.remove(ma)\n\n\n\nprint((N - len(AB)))","code_v0_loc":20,"code_v1_loc":10,"code_v0_num_chars":435,"code_v1_num_chars":290,"code_v0_no_empty_lines":"N = int(eval(input()))\nR = [[int(i) for i in input().split()] for _ in range(N)]\nB = [[int(i) for i in input().split()] for _ in range(N)]\nR.sort()\nB.sort()\ncount = 0\ntmp = []\nfor bx, by in B:\n for rx, ry in R:\n if bx > rx and by > ry:\n tmp.append([rx, ry])\n if tmp != []:\n max_red = max(tmp, key=lambda r: r[1])\n count += 1\n R.remove(max_red)\n tmp = []\nprint(count)\n","code_v1_no_empty_lines":"N, *I = list(map(int, open(0).read().split()))\nAB = list(zip(*[iter(I[: 2 * N])] * 2))\nCD = sorted(zip(*[iter(I[2 * N :])] * 2))\nfor c, d in CD:\n ma = max(\n ((a, b) for a, b in AB if a < c and b < d), key=lambda x: x[1], default=None\n )\n if ma:\n AB.remove(ma)\nprint((N - len(AB)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-N = int(eval(input()))","-R = [[int(i) for i in input().split()] for _ in range(N)]","-B = [[int(i) for i in input().split()] for _ in range(N)]","-R.sort()","-B.sort()","-count = 0","-tmp = []","-for bx, by in B:","- for rx, ry in R:","- if bx > rx and by > ry:","- tmp.append([rx, ry])","- if tmp != []:","- max_red = max(tmp, key=lambda r: r[1])","- count += 1","- R.remove(max_red)","- tmp = []","-print(count)","+N, *I = list(map(int, open(0).read().split()))","+AB = list(zip(*[iter(I[: 2 * N])] * 2))","+CD = sorted(zip(*[iter(I[2 * N :])] * 2))","+for c, d in CD:","+ ma = max(","+ ((a, b) for a, b in AB if a < c and b < d), key=lambda x: x[1], default=None","+ )","+ if ma:","+ AB.remove(ma)","+print((N - len(AB)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0475290814,"measured_runtime_v1":0.0469753677,"runtime_lift":1.0117873204,"key":["s623830506","s602529182"]} +{"user_id":"u236162829","problem_id":"p03379","language":"python","submission_id_v0":"s584092660","submission_id_v1":"s707086581","cpu_time_v0":418,"cpu_time_v1":284,"memory_v0":34156,"memory_v1":26016,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.06,"input":"import numpy as np\n\nN = int(eval(input()))\n\nX = list(map(int, input().split()))\n\n\n\nX_sort = sorted(X)\n\nsmall, big = X_sort[N\/\/2-1], X_sort[N\/\/2]\n\n\n\nfor x in X:\n\n if x >= big:\n\n print(small)\n\n else:\n\n print(big)","target":"N = int(eval(input()))\n\nX = list(map(int, input().split()))\n\n\n\nX_sort = sorted(X)\n\nsmall, big = X_sort[N\/\/2-1], X_sort[N\/\/2]\n\n\n\nfor x in X:\n\n if x >= big:\n\n print(small)\n\n else:\n\n print(big)","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":224,"code_v1_num_chars":204,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nX = list(map(int, input().split()))\nX_sort = sorted(X)\nsmall, big = X_sort[N \/\/ 2 - 1], X_sort[N \/\/ 2]\nfor x in X:\n if x >= big:\n print(small)\n else:\n print(big)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nX = list(map(int, input().split()))\nX_sort = sorted(X)\nsmall, big = X_sort[N \/\/ 2 - 1], X_sort[N \/\/ 2]\nfor x in X:\n if x >= big:\n print(small)\n else:\n print(big)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import numpy as np","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.1156774044,"measured_runtime_v1":0.0415378094,"runtime_lift":2.784870125,"key":["s584092660","s707086581"]} +{"user_id":"u682672120","problem_id":"p03045","language":"python","submission_id_v0":"s312222263","submission_id_v1":"s980706750","cpu_time_v0":922,"cpu_time_v1":644,"memory_v0":96756,"memory_v1":93264,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.15,"input":"n, m = list(map(int, input().split()))\n\n\n\ncard = [[] for _ in range(n)]\n\n\n\nfor _ in range(m):\n\n x, y, _ = list(map(int, input().split()))\n\n card[x-1].append(y-1)\n\n card[y-1].append(x-1)\n\n\n\nchecked = [False] * n\n\n\n\ncount = 0\n\nimport queue\n\nq = queue.Queue()\n\nfor i in range(n):\n\n if checked[i]:\n\n continue\n\n count += 1\n\n q.put(i)\n\n while not q.empty():\n\n j = q.get()\n\n checked[j] = True\n\n for k in card[j]:\n\n if not checked[k]:\n\n q.put(k)\n\n\n\nprint (count)\n\n\n\n\n\n \n\n\n","target":"n, m = list(map(int, input().split()))\n\n\n\ncard = [[] for _ in range(n)]\n\n\n\nfor _ in range(m):\n\n x, y, _ = list(map(int, input().split()))\n\n card[x-1].append(y-1)\n\n card[y-1].append(x-1)\n\n\n\nchecked = [False] * n\n\n\n\ncount = 0\n\nfrom collections import deque\n\nfor i in range(n):\n\n if checked[i]:\n\n continue\n\n count += 1\n\n q = deque([i])\n\n while q:\n\n j = q.popleft()\n\n checked[j] = True\n\n for k in card[j]:\n\n if not checked[k]:\n\n q.append(k)\n\nprint (count) \n\n\n","code_v0_loc":31,"code_v1_loc":26,"code_v0_num_chars":530,"code_v1_num_chars":518,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\ncard = [[] for _ in range(n)]\nfor _ in range(m):\n x, y, _ = list(map(int, input().split()))\n card[x - 1].append(y - 1)\n card[y - 1].append(x - 1)\nchecked = [False] * n\ncount = 0\nimport queue\n\nq = queue.Queue()\nfor i in range(n):\n if checked[i]:\n continue\n count += 1\n q.put(i)\n while not q.empty():\n j = q.get()\n checked[j] = True\n for k in card[j]:\n if not checked[k]:\n q.put(k)\nprint(count)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\ncard = [[] for _ in range(n)]\nfor _ in range(m):\n x, y, _ = list(map(int, input().split()))\n card[x - 1].append(y - 1)\n card[y - 1].append(x - 1)\nchecked = [False] * n\ncount = 0\nfrom collections import deque\n\nfor i in range(n):\n if checked[i]:\n continue\n count += 1\n q = deque([i])\n while q:\n j = q.popleft()\n checked[j] = True\n for k in card[j]:\n if not checked[k]:\n q.append(k)\nprint(count)\n","code_same":false,"relative_loc_diff_percent":16.1290322581,"diff":["-import queue","+from collections import deque","-q = queue.Queue()","- q.put(i)","- while not q.empty():","- j = q.get()","+ q = deque([i])","+ while q:","+ j = q.popleft()","- q.put(k)","+ q.append(k)"],"diff_only_import_comment":false,"measured_runtime_v0":0.157173717,"measured_runtime_v1":0.0625509155,"runtime_lift":2.5127324803,"key":["s312222263","s980706750"]} +{"user_id":"u112317104","problem_id":"p02813","language":"python","submission_id_v0":"s085916288","submission_id_v1":"s283392735","cpu_time_v0":45,"cpu_time_v1":40,"memory_v0":8052,"memory_v1":8052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"import itertools\n\n\n\ndef solve():\n\n N = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n l = [i for i in range(1, N+1)]\n\n l = list(itertools.permutations(l))\n\n \n\n a = 0\n\n for k, v in enumerate(l):\n\n if A == list(v):\n\n a = k+1\n\n \n\n b = 0\n\n for k, v in enumerate(l):\n\n if B == list(v):\n\n b = k+1\n\n return abs(a-b)\n\n\n\nprint((solve()))","target":"import itertools\n\n\n\ndef solve():\n\n N = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n l = [i for i in range(1, N+1)]\n\n l = list(itertools.permutations(l))\n\n \n\n a = 0\n\n b = 0\n\n for k, v in enumerate(l):\n\n v = list(v)\n\n if v == A:\n\n a = k+1\n\n if v == B:\n\n b = k+1\n\n \n\n return abs(a-b)\n\n\n\nprint((solve()))","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":446,"code_v1_num_chars":420,"code_v0_no_empty_lines":"import itertools\n\n\ndef solve():\n N = int(eval(input()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n l = [i for i in range(1, N + 1)]\n l = list(itertools.permutations(l))\n a = 0\n for k, v in enumerate(l):\n if A == list(v):\n a = k + 1\n b = 0\n for k, v in enumerate(l):\n if B == list(v):\n b = k + 1\n return abs(a - b)\n\n\nprint((solve()))\n","code_v1_no_empty_lines":"import itertools\n\n\ndef solve():\n N = int(eval(input()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n l = [i for i in range(1, N + 1)]\n l = list(itertools.permutations(l))\n a = 0\n b = 0\n for k, v in enumerate(l):\n v = list(v)\n if v == A:\n a = k + 1\n if v == B:\n b = k + 1\n return abs(a - b)\n\n\nprint((solve()))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for k, v in enumerate(l):","- if A == list(v):","- a = k + 1","- if B == list(v):","+ v = list(v)","+ if v == A:","+ a = k + 1","+ if v == B:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409574509,"measured_runtime_v1":0.0702587605,"runtime_lift":0.5829515152,"key":["s085916288","s283392735"]} +{"user_id":"u238504302","problem_id":"p02912","language":"python","submission_id_v0":"s149835261","submission_id_v1":"s885549863","cpu_time_v0":1294,"cpu_time_v1":158,"memory_v0":85636,"memory_v1":86512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.79,"input":"from bisect import bisect_left as b\n\nn,m= list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.sort()\n\nwhile m>0:\n\n i=a.pop(-1)\/\/2\n\n a.insert(b(a,i),i)\n\n m-=1\n\nprint((sum(a)))","target":"import heapq\n\n\n\nN, M = list(map(int,input().split()))\n\nA = list([int(x) * (-1) for x in input().split()])\n\nheapq.heapify(A)\n\n\n\nfor _ in range(M):\n\n tmp_min = heapq.heappop(A)\n\n heapq.heappush(A, (-1) * (-tmp_min \/\/ 2))\n\n\n\nprint((-sum(A)))","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":185,"code_v1_num_chars":237,"code_v0_no_empty_lines":"from bisect import bisect_left as b\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort()\nwhile m > 0:\n i = a.pop(-1) \/\/ 2\n a.insert(b(a, i), i)\n m -= 1\nprint((sum(a)))\n","code_v1_no_empty_lines":"import heapq\n\nN, M = list(map(int, input().split()))\nA = list([int(x) * (-1) for x in input().split()])\nheapq.heapify(A)\nfor _ in range(M):\n tmp_min = heapq.heappop(A)\n heapq.heappush(A, (-1) * (-tmp_min \/\/ 2))\nprint((-sum(A)))\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-from bisect import bisect_left as b","+import heapq","-n, m = list(map(int, input().split()))","-a = list(map(int, input().split()))","-a.sort()","-while m > 0:","- i = a.pop(-1) \/\/ 2","- a.insert(b(a, i), i)","- m -= 1","-print((sum(a)))","+N, M = list(map(int, input().split()))","+A = list([int(x) * (-1) for x in input().split()])","+heapq.heapify(A)","+for _ in range(M):","+ tmp_min = heapq.heappop(A)","+ heapq.heappush(A, (-1) * (-tmp_min \/\/ 2))","+print((-sum(A)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0813830488,"measured_runtime_v1":0.0671106811,"runtime_lift":1.2126690935,"key":["s149835261","s885549863"]} +{"user_id":"u216235239","problem_id":"p02394","language":"python","submission_id_v0":"s867984461","submission_id_v1":"s892714104","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":7636,"memory_v1":7724,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"W, H, x, y, r = list(map(int, input().split()))\n\n \n\nif x - r < 0 or x + r > W or y - r < 0 or y + r > H:\n\n print (\"No\")\n\nelse:\n\n print (\"Yes\")","target":"W, H, x, y, r = (int(i) for i in input().split())\n\n \n\nif x - r < 0 :\n\n print(\"No\")\n\nelif x + r > W:\n\n print(\"No\")\n\nelif y - r < 0:\n\n print(\"No\")\n\nelif y + r > H:\n\n print (\"No\")\n\nelse:\n\n print (\"Yes\")","code_v0_loc":6,"code_v1_loc":12,"code_v0_num_chars":138,"code_v1_num_chars":211,"code_v0_no_empty_lines":"W, H, x, y, r = list(map(int, input().split()))\nif x - r < 0 or x + r > W or y - r < 0 or y + r > H:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"W, H, x, y, r = (int(i) for i in input().split())\nif x - r < 0:\n print(\"No\")\nelif x + r > W:\n print(\"No\")\nelif y - r < 0:\n print(\"No\")\nelif y + r > H:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-W, H, x, y, r = list(map(int, input().split()))","-if x - r < 0 or x + r > W or y - r < 0 or y + r > H:","+W, H, x, y, r = (int(i) for i in input().split())","+if x - r < 0:","+ print(\"No\")","+elif x + r > W:","+ print(\"No\")","+elif y - r < 0:","+ print(\"No\")","+elif y + r > H:"],"diff_only_import_comment":false,"measured_runtime_v0":0.085547613,"measured_runtime_v1":0.0838981073,"runtime_lift":1.0196608212,"key":["s867984461","s892714104"]} +{"user_id":"u432551953","problem_id":"p03212","language":"python","submission_id_v0":"s923751784","submission_id_v1":"s463602782","cpu_time_v0":379,"cpu_time_v1":273,"memory_v0":57052,"memory_v1":46300,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.97,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\n\n\nc = 0\n\nnum = 0\n\ndef check(n):\n\n\tstrn = str(n)\n\n\tl = [0, 0, 0]\n\n\tfor c in strn:\n\n\t\tif c == '3':\n\n\t\t\tl[0] = 1\n\n\t\telif c == '5':\n\n\t\t\tl[1] = 1\n\n\t\telif c == '7':\n\n\t\t\tl[2] = 1\n\n\treturn all(l) or False\n\n\n\ndef gen(n):\n\n\tglobal c\n\n\t# print(n)\n\n\tif n > num:\n\n\t\treturn\n\n\tif check(n):\n\n\t\t# print(n)\n\n\t\tc += 1\n\n\tfor i in [3, 5, 7]:\n\n\t\tk = 10 * n + i\n\n\t\tgen(k)\n\n\n\ndef main():\n\n\tglobal num\n\n\tnum = int(input().strip())\n\n\tgen(0)\n\n\tprint(c)\n\n\n\nif __name__ == '__main__':\n\n\tmain()\n","target":"import sys\n\ninput = sys.stdin.readline\n\nfrom operator import itemgetter\n\nsys.setrecursionlimit(10000000)\n\nINF = 10**30\n\n\n\nans = 0\n\nc = ['3', '5', '7']\n\nN = 0\n\n\n\ndef check(l):\n\n return len(set(l)) == 3\n\n\n\ndef nummaker(k, n):\n\n global ans\n\n if k == 0:\n\n q = int(''.join(n))\n\n if q > N:\n\n print(ans)\n\n sys.exit(0)\n\n if check(n):\n\n ans += 1\n\n return\n\n for i in c:\n\n m = n[:]\n\n m.append(i)\n\n nummaker(k-1, m)\n\n\n\ndef main():\n\n global N\n\n N = int(input().strip())\n\n for i in range(1, 11):\n\n nummaker(i, [])\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":38,"code_v1_loc":36,"code_v0_num_chars":507,"code_v1_num_chars":652,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nc = 0\nnum = 0\n\n\ndef check(n):\n strn = str(n)\n l = [0, 0, 0]\n for c in strn:\n if c == \"3\":\n l[0] = 1\n elif c == \"5\":\n l[1] = 1\n elif c == \"7\":\n l[2] = 1\n return all(l) or False\n\n\ndef gen(n):\n global c\n # print(n)\n if n > num:\n return\n if check(n):\n # print(n)\n c += 1\n for i in [3, 5, 7]:\n k = 10 * n + i\n gen(k)\n\n\ndef main():\n global num\n num = int(input().strip())\n gen(0)\n print(c)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom operator import itemgetter\n\nsys.setrecursionlimit(10000000)\nINF = 10**30\nans = 0\nc = [\"3\", \"5\", \"7\"]\nN = 0\n\n\ndef check(l):\n return len(set(l)) == 3\n\n\ndef nummaker(k, n):\n global ans\n if k == 0:\n q = int(\"\".join(n))\n if q > N:\n print(ans)\n sys.exit(0)\n if check(n):\n ans += 1\n return\n for i in c:\n m = n[:]\n m.append(i)\n nummaker(k - 1, m)\n\n\ndef main():\n global N\n N = int(input().strip())\n for i in range(1, 11):\n nummaker(i, [])\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-c = 0","-num = 0","+from operator import itemgetter","+","+sys.setrecursionlimit(10000000)","+INF = 10**30","+ans = 0","+c = [\"3\", \"5\", \"7\"]","+N = 0","-def check(n):","- strn = str(n)","- l = [0, 0, 0]","- for c in strn:","- if c == \"3\":","- l[0] = 1","- elif c == \"5\":","- l[1] = 1","- elif c == \"7\":","- l[2] = 1","- return all(l) or False","+def check(l):","+ return len(set(l)) == 3","-def gen(n):","- global c","- # print(n)","- if n > num:","+def nummaker(k, n):","+ global ans","+ if k == 0:","+ q = int(\"\".join(n))","+ if q > N:","+ print(ans)","+ sys.exit(0)","+ if check(n):","+ ans += 1","- if check(n):","- # print(n)","- c += 1","- for i in [3, 5, 7]:","- k = 10 * n + i","- gen(k)","+ for i in c:","+ m = n[:]","+ m.append(i)","+ nummaker(k - 1, m)","- global num","- num = int(input().strip())","- gen(0)","- print(c)","+ global N","+ N = int(input().strip())","+ for i in range(1, 11):","+ nummaker(i, [])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0471683958,"measured_runtime_v1":0.0461908386,"runtime_lift":1.0211634428,"key":["s923751784","s463602782"]} +{"user_id":"u498487134","problem_id":"p02888","language":"python","submission_id_v0":"s399656046","submission_id_v1":"s487513376","cpu_time_v0":726,"cpu_time_v1":344,"memory_v0":43452,"memory_v1":74304,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.62,"input":"N = int(eval(input()))\n\nL = list(map(int,input().split()))\n\nL.sort()\n\n\n\nans=0\n\nfor i in range(N-2):\n\n for j in range(i+1,N):\n\n ng=N\n\n ok=j\n\n while abs(ok-ng)!=1:\n\n med =(ok+ng)\/\/2\n\n if L[med] ans:\n\n ans = temp\n\nprint(ans)","target":"from itertools import combinations_with_replacement\n\n\n\ndef main():\n\n N, M, Q = list(map(int, input().split()))\n\n ABCD = [list(map(int, input().split())) for i in range(Q)]\n\n ans = 0\n\n\n\n for A in combinations_with_replacement(list(range(M)), N):\n\n temp = 0\n\n for abcd in ABCD:\n\n if A[abcd[1]-1]+1 == A[abcd[0]-1]+1 + abcd[2]:\n\n temp += abcd[3]\n\n if temp > ans:\n\n ans = temp\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":14,"code_v1_loc":18,"code_v0_num_chars":389,"code_v1_num_chars":489,"code_v0_no_empty_lines":"from itertools import combinations_with_replacement\n\nN, M, Q = list(map(int, input().split()))\nABCD = [list(map(int, input().split())) for i in range(Q)]\nans = 0\nfor A in combinations_with_replacement(list(range(M)), N):\n temp = 0\n for abcd in ABCD:\n if A[abcd[1] - 1] + 1 == A[abcd[0] - 1] + 1 + abcd[2]:\n temp += abcd[3]\n if temp > ans:\n ans = temp\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import combinations_with_replacement\n\n\ndef main():\n N, M, Q = list(map(int, input().split()))\n ABCD = [list(map(int, input().split())) for i in range(Q)]\n ans = 0\n for A in combinations_with_replacement(list(range(M)), N):\n temp = 0\n for abcd in ABCD:\n if A[abcd[1] - 1] + 1 == A[abcd[0] - 1] + 1 + abcd[2]:\n temp += abcd[3]\n if temp > ans:\n ans = temp\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-N, M, Q = list(map(int, input().split()))","-ABCD = [list(map(int, input().split())) for i in range(Q)]","-ans = 0","-for A in combinations_with_replacement(list(range(M)), N):","- temp = 0","- for abcd in ABCD:","- if A[abcd[1] - 1] + 1 == A[abcd[0] - 1] + 1 + abcd[2]:","- temp += abcd[3]","- if temp > ans:","- ans = temp","-print(ans)","+","+def main():","+ N, M, Q = list(map(int, input().split()))","+ ABCD = [list(map(int, input().split())) for i in range(Q)]","+ ans = 0","+ for A in combinations_with_replacement(list(range(M)), N):","+ temp = 0","+ for abcd in ABCD:","+ if A[abcd[1] - 1] + 1 == A[abcd[0] - 1] + 1 + abcd[2]:","+ temp += abcd[3]","+ if temp > ans:","+ ans = temp","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0850958879,"measured_runtime_v1":0.089452317,"runtime_lift":0.9512988679,"key":["s338195573","s718750057"]} +{"user_id":"u562935282","problem_id":"p02786","language":"python","submission_id_v0":"s385627707","submission_id_v1":"s721269915","cpu_time_v0":31,"cpu_time_v1":17,"memory_v0":3940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.16,"input":"from functools import lru_cache\n\nimport sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\n\n\n@lru_cache(maxsize=None)\n\ndef dfs(h):\n\n if h == 1:\n\n return 1\n\n return 1 + dfs(h \/\/ 2) * 2\n\n\n\n\n\ndef main():\n\n h = int(eval(input()))\n\n print((dfs(h)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n#\n\n# input = sys.stdin.readline\n\n# rstrip()\n\n# int(input())\n\n# map(int, input().split())\n","target":"H = int(eval(input()))\n\n\n\nret = 0\n\nmon = 1\n\nwhile H:\n\n H \/\/= 2\n\n ret += mon\n\n mon <<= 1\n\nprint(ret)\n","code_v0_loc":26,"code_v1_loc":9,"code_v0_num_chars":381,"code_v1_num_chars":103,"code_v0_no_empty_lines":"from functools import lru_cache\nimport sys\n\nsys.setrecursionlimit(10**7)\n\n\n@lru_cache(maxsize=None)\ndef dfs(h):\n if h == 1:\n return 1\n return 1 + dfs(h \/\/ 2) * 2\n\n\ndef main():\n h = int(eval(input()))\n print((dfs(h)))\n\n\nif __name__ == \"__main__\":\n main()\n#\n# input = sys.stdin.readline\n# rstrip()\n# int(input())\n# map(int, input().split())\n","code_v1_no_empty_lines":"H = int(eval(input()))\nret = 0\nmon = 1\nwhile H:\n H \/\/= 2\n ret += mon\n mon <<= 1\nprint(ret)\n","code_same":false,"relative_loc_diff_percent":65.3846153846,"diff":["-from functools import lru_cache","-import sys","-","-sys.setrecursionlimit(10**7)","-","-","-@lru_cache(maxsize=None)","-def dfs(h):","- if h == 1:","- return 1","- return 1 + dfs(h \/\/ 2) * 2","-","-","-def main():","- h = int(eval(input()))","- print((dfs(h)))","-","-","-if __name__ == \"__main__\":","- main()","-#","-# input = sys.stdin.readline","-# rstrip()","-# int(input())","-# map(int, input().split())","+H = int(eval(input()))","+ret = 0","+mon = 1","+while H:","+ H \/\/= 2","+ ret += mon","+ mon <<= 1","+print(ret)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0810328066,"measured_runtime_v1":0.0736137545,"runtime_lift":1.1007835039,"key":["s385627707","s721269915"]} +{"user_id":"u279546122","problem_id":"p02361","language":"python","submission_id_v0":"s216186547","submission_id_v1":"s669247379","cpu_time_v0":8560,"cpu_time_v1":7880,"memory_v0":98980,"memory_v1":106856,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.94,"input":"#!usr\/bin\/env python3\n\nfrom collections import defaultdict\n\n\n\ndef main():\n\n fl = input().split(\" \")\n\n V = int(fl[0])\n\n E = int(fl[1])\n\n R = int(fl[2])\n\n #Adjacency list\n\n G = defaultdict(dict)\n\n for i in range(int(E)):\n\n s, t, w = [int(x) for x in input().split(\" \")]\n\n G[s][t] = w\n\n #initialized\n\n d = {}\n\n INF = float('inf')\n\n #INF = 10001\n\n for i in range(V):\n\n d[i] = INF\n\n d[R] = 0\n\n q = [R]\n\n while q:\n\n u = q.pop(0)\n\n for v in list(G[u].keys()):\n\n if d[v] > d[u] + G[u][v]:\n\n d[v] = d[u] + G[u][v]\n\n q.append(v)\n\n\n\n for k in range(V):\n\n if d[k] == float('inf'):\n\n \n\n print(\"INF\")\n\n else:\n\n print((d[k]))\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","target":"#!usr\/bin\/env python3\n\n\n\nfrom collections import defaultdict\n\n\n\n\n\ndef main():\n\n #Read stdin\n\n\n\n fl = input().split(\" \")\n\n V = int(fl[0])\n\n E = int(fl[1])\n\n R = int(fl[2])\n\n #Adjacency list\n\n G = defaultdict(list)\n\n for i in range(int(E)):\n\n s, t, w = [int(x) for x in input().split(\" \")]\n\n G[s].append((t,w))\n\n #initialized\n\n d = {}\n\n INF = float('inf')\n\n #INF = 10001\n\n for i in range(V):\n\n d[i] = INF\n\n d[R] = 0\n\n q = [R]\n\n while q:\n\n u = q.pop(0)\n\n for v in G[u]:\n\n if d[v[0]] > d[u] + v[1]:\n\n d[v[0]] = d[u] + v[1]\n\n\n\n q.append(v[0])\n\n\n\n for k in range(V):\n\n if d[k] == float('inf'):\n\n \n\n print(\"INF\")\n\n else:\n\n print((d[k]))\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":39,"code_v1_loc":44,"code_v0_num_chars":819,"code_v1_num_chars":847,"code_v0_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict\n\n\ndef main():\n fl = input().split(\" \")\n V = int(fl[0])\n E = int(fl[1])\n R = int(fl[2])\n # Adjacency list\n G = defaultdict(dict)\n for i in range(int(E)):\n s, t, w = [int(x) for x in input().split(\" \")]\n G[s][t] = w\n # initialized\n d = {}\n INF = float(\"inf\")\n # INF = 10001\n for i in range(V):\n d[i] = INF\n d[R] = 0\n q = [R]\n while q:\n u = q.pop(0)\n for v in list(G[u].keys()):\n if d[v] > d[u] + G[u][v]:\n d[v] = d[u] + G[u][v]\n q.append(v)\n for k in range(V):\n if d[k] == float(\"inf\"):\n print(\"INF\")\n else:\n print((d[k]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!usr\/bin\/env python3\nfrom collections import defaultdict\n\n\ndef main():\n # Read stdin\n fl = input().split(\" \")\n V = int(fl[0])\n E = int(fl[1])\n R = int(fl[2])\n # Adjacency list\n G = defaultdict(list)\n for i in range(int(E)):\n s, t, w = [int(x) for x in input().split(\" \")]\n G[s].append((t, w))\n # initialized\n d = {}\n INF = float(\"inf\")\n # INF = 10001\n for i in range(V):\n d[i] = INF\n d[R] = 0\n q = [R]\n while q:\n u = q.pop(0)\n for v in G[u]:\n if d[v[0]] > d[u] + v[1]:\n d[v[0]] = d[u] + v[1]\n q.append(v[0])\n for k in range(V):\n if d[k] == float(\"inf\"):\n print(\"INF\")\n else:\n print((d[k]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":11.3636363636,"diff":["+ # Read stdin","- G = defaultdict(dict)","+ G = defaultdict(list)","- G[s][t] = w","+ G[s].append((t, w))","- for v in list(G[u].keys()):","- if d[v] > d[u] + G[u][v]:","- d[v] = d[u] + G[u][v]","- q.append(v)","+ for v in G[u]:","+ if d[v[0]] > d[u] + v[1]:","+ d[v[0]] = d[u] + v[1]","+ q.append(v[0])"],"diff_only_import_comment":false,"measured_runtime_v0":0.074508389,"measured_runtime_v1":0.0394511239,"runtime_lift":1.8886252573,"key":["s216186547","s669247379"]} +{"user_id":"u707614029","problem_id":"p03031","language":"python","submission_id_v0":"s305574631","submission_id_v1":"s332609858","cpu_time_v0":51,"cpu_time_v1":43,"memory_v0":9192,"memory_v1":9072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.69,"input":"# cs: c nnected switches\n\nn, m = list(map(int, input().split()))\n\n\n\n# cs: connected switches\n\ncs = [list(map(int, input().split())) for _ in range(m)]\n\nps = list(map(int, input().split()))\n\n\n\n# bit\u5168\u63a2\u7d22(0: \u3059\u3079\u3066off\u306f\u4e0d\u8981)\n\nans = 0\n\n# on: 0:\u6d88\u3048\u3066\u308b\u30011:\u70b9\u3044\u3066\u308b\n\n# 10: 1 2 3 4 \n\n# 0b: 1 10 11, 100..\n\nfor on in range(2**n):\n\n # bin: \u30d0\u30a4\u30ca\u30ea\u6587\u5b57\u5217\u306b\u5909\u63db\n\n # 3 -> '0b11'\n\n # rust \u3067\u53f30\u57cb\u3081\n\n patern = bin(on)[2:].rjust(n, '0')\n\n ok = True\n\n\n\n for i in range(m):\n\n ct = 0\n\n for j in range(cs[i][0]):\n\n if patern[cs[i][j+1] - 1] == '1':\n\n ct += 1\n\n if ct%2 != ps[i]:\n\n ok = False\n\n if ok:\n\n ans += 1\n\nprint(ans)\n","target":"# cs: c nnected switches\n\nn, m = list(map(int, input().split()))\n\n\n\ndef get_connected_switches():\n\n # k s1 s2 .. sn\n\n lst = list(map(int, input().split()))\n\n lst.pop(0) # k is not use\n\n return list([1<<(d-1) for d in lst])\n\n\n\n# cs: connected switches\n\ncs = [get_connected_switches() for _ in range(m)]\n\nps = list(map(int, input().split()))\n\n\n\n# bit\u5168\u63a2\u7d22(0: \u3059\u3079\u3066off\u306f\u4e0d\u8981)\n\nans = 0\n\n# on: 0:\u6d88\u3048\u3066\u308b\u30011:\u70b9\u3044\u3066\u308b\n\n# 10: 1 2 3 4 \n\n# 0b: 1 10 11, 100..\n\nfor on in range(2**n):\n\n ok = True\n\n for i in range(m):\n\n ct = 0\n\n for s in cs[i]:\n\n if s&on: ct += 1\n\n if ct%2 != ps[i]:\n\n ok = False\n\n if ok:\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":29,"code_v1_loc":29,"code_v0_num_chars":661,"code_v1_num_chars":676,"code_v0_no_empty_lines":"# cs: c nnected switches\nn, m = list(map(int, input().split()))\n# cs: connected switches\ncs = [list(map(int, input().split())) for _ in range(m)]\nps = list(map(int, input().split()))\n# bit\u5168\u63a2\u7d22(0: \u3059\u3079\u3066off\u306f\u4e0d\u8981)\nans = 0\n# on: 0:\u6d88\u3048\u3066\u308b\u30011:\u70b9\u3044\u3066\u308b\n# 10: 1 2 3 4\n# 0b: 1 10 11, 100..\nfor on in range(2**n):\n # bin: \u30d0\u30a4\u30ca\u30ea\u6587\u5b57\u5217\u306b\u5909\u63db\n # 3 -> '0b11'\n # rust \u3067\u53f30\u57cb\u3081\n patern = bin(on)[2:].rjust(n, \"0\")\n ok = True\n for i in range(m):\n ct = 0\n for j in range(cs[i][0]):\n if patern[cs[i][j + 1] - 1] == \"1\":\n ct += 1\n if ct % 2 != ps[i]:\n ok = False\n if ok:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"# cs: c nnected switches\nn, m = list(map(int, input().split()))\n\n\ndef get_connected_switches():\n # k s1 s2 .. sn\n lst = list(map(int, input().split()))\n lst.pop(0) # k is not use\n return list([1 << (d - 1) for d in lst])\n\n\n# cs: connected switches\ncs = [get_connected_switches() for _ in range(m)]\nps = list(map(int, input().split()))\n# bit\u5168\u63a2\u7d22(0: \u3059\u3079\u3066off\u306f\u4e0d\u8981)\nans = 0\n# on: 0:\u6d88\u3048\u3066\u308b\u30011:\u70b9\u3044\u3066\u308b\n# 10: 1 2 3 4\n# 0b: 1 10 11, 100..\nfor on in range(2**n):\n ok = True\n for i in range(m):\n ct = 0\n for s in cs[i]:\n if s & on:\n ct += 1\n if ct % 2 != ps[i]:\n ok = False\n if ok:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+","+","+def get_connected_switches():","+ # k s1 s2 .. sn","+ lst = list(map(int, input().split()))","+ lst.pop(0) # k is not use","+ return list([1 << (d - 1) for d in lst])","+","+","-cs = [list(map(int, input().split())) for _ in range(m)]","+cs = [get_connected_switches() for _ in range(m)]","- # bin: \u30d0\u30a4\u30ca\u30ea\u6587\u5b57\u5217\u306b\u5909\u63db","- # 3 -> '0b11'","- # rust \u3067\u53f30\u57cb\u3081","- patern = bin(on)[2:].rjust(n, \"0\")","- for j in range(cs[i][0]):","- if patern[cs[i][j + 1] - 1] == \"1\":","+ for s in cs[i]:","+ if s & on:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0453694718,"measured_runtime_v1":0.0460265579,"runtime_lift":0.9857237609,"key":["s305574631","s332609858"]} +{"user_id":"u967398153","problem_id":"p02947","language":"python","submission_id_v0":"s021017339","submission_id_v1":"s628463610","cpu_time_v0":396,"cpu_time_v1":283,"memory_v0":18228,"memory_v1":18184,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.54,"input":"from collections import Counter\n\n\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n anas = Counter(''.join(sorted(eval(input()))) for _ in range(n))\n\n\n\n result = sum(sum(range(anas[a])) for a in anas)\n\n print(result)\n\n\n\n\n\nmain()","target":"from collections import Counter\n\nfrom sys import stdin\n\n\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n anas = Counter(''.join(sorted(stdin.readline())) for _ in range(n))\n\n\n\n result = sum(sum(range(anas[a])) for a in anas)\n\n print(result)\n\n\n\n\n\nmain()\n","code_v0_loc":12,"code_v1_loc":13,"code_v0_num_chars":220,"code_v1_num_chars":253,"code_v0_no_empty_lines":"from collections import Counter\n\n\ndef main():\n n = int(eval(input()))\n anas = Counter(\"\".join(sorted(eval(input()))) for _ in range(n))\n result = sum(sum(range(anas[a])) for a in anas)\n print(result)\n\n\nmain()\n","code_v1_no_empty_lines":"from collections import Counter\nfrom sys import stdin\n\n\ndef main():\n n = int(eval(input()))\n anas = Counter(\"\".join(sorted(stdin.readline())) for _ in range(n))\n result = sum(sum(range(anas[a])) for a in anas)\n print(result)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["+from sys import stdin","- anas = Counter(\"\".join(sorted(eval(input()))) for _ in range(n))","+ anas = Counter(\"\".join(sorted(stdin.readline())) for _ in range(n))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0346126211,"measured_runtime_v1":0.0344260035,"runtime_lift":1.0054208326,"key":["s021017339","s628463610"]} +{"user_id":"u600402037","problem_id":"p02763","language":"python","submission_id_v0":"s255436928","submission_id_v1":"s145559466","cpu_time_v0":1719,"cpu_time_v1":1309,"memory_v0":94556,"memory_v1":95708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.85,"input":"import sys\n\nfrom bisect import bisect_left, bisect_right, insort\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN = ir()\n\nS = list('-' + sr())\n\nd = [[] for _ in range(26)]\n\nfor i in range(1, N+1):\n\n s = S[i]\n\n o = ord(s) - ord('a')\n\n d[o].append(i)\n\n\n\nQ = ir()\n\nfor _ in range(Q):\n\n q, a, b = sr().split()\n\n if q == '1':\n\n a = int(a)\n\n if S[a] == b:\n\n continue\n\n prev = ord(S[a]) - ord('a')\n\n d[prev].remove(a)\n\n next = ord(b) - ord('a')\n\n insort(d[next], a)\n\n S[a] = b\n\n else:\n\n a = int(a); b = int(b)\n\n ans = 0\n\n for alpha in range(26):\n\n if bisect_right(d[alpha], b) - bisect_left(d[alpha], a) >= 1:\n\n ans += 1\n\n print(ans)\n","target":"import sys\n\nfrom bisect import bisect_left, bisect_right, insort\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nN = ir()\n\nS = list('-' + sr())\n\nd = [[] for _ in range(26)]\n\nfor i in range(1, N+1):\n\n s = S[i]\n\n o = ord(s) - ord('a')\n\n d[o].append(i)\n\n\n\nQ = ir()\n\nfor _ in range(Q):\n\n q, a, b = sr().split()\n\n if q == '1':\n\n a = int(a)\n\n if S[a] == b:\n\n continue\n\n prev = ord(S[a]) - ord('a')\n\n d[prev].pop(bisect_left(d[prev], a))\n\n next = ord(b) - ord('a')\n\n insort(d[next], a)\n\n S[a] = b\n\n else:\n\n a = int(a); b = int(b)\n\n ans = 0\n\n for alpha in range(26):\n\n if bisect_right(d[alpha], b) - bisect_left(d[alpha], a) >= 1:\n\n ans += 1\n\n print(ans)\n","code_v0_loc":34,"code_v1_loc":34,"code_v0_num_chars":828,"code_v1_num_chars":847,"code_v0_no_empty_lines":"import sys\nfrom bisect import bisect_left, bisect_right, insort\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN = ir()\nS = list(\"-\" + sr())\nd = [[] for _ in range(26)]\nfor i in range(1, N + 1):\n s = S[i]\n o = ord(s) - ord(\"a\")\n d[o].append(i)\nQ = ir()\nfor _ in range(Q):\n q, a, b = sr().split()\n if q == \"1\":\n a = int(a)\n if S[a] == b:\n continue\n prev = ord(S[a]) - ord(\"a\")\n d[prev].remove(a)\n next = ord(b) - ord(\"a\")\n insort(d[next], a)\n S[a] = b\n else:\n a = int(a)\n b = int(b)\n ans = 0\n for alpha in range(26):\n if bisect_right(d[alpha], b) - bisect_left(d[alpha], a) >= 1:\n ans += 1\n print(ans)\n","code_v1_no_empty_lines":"import sys\nfrom bisect import bisect_left, bisect_right, insort\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nN = ir()\nS = list(\"-\" + sr())\nd = [[] for _ in range(26)]\nfor i in range(1, N + 1):\n s = S[i]\n o = ord(s) - ord(\"a\")\n d[o].append(i)\nQ = ir()\nfor _ in range(Q):\n q, a, b = sr().split()\n if q == \"1\":\n a = int(a)\n if S[a] == b:\n continue\n prev = ord(S[a]) - ord(\"a\")\n d[prev].pop(bisect_left(d[prev], a))\n next = ord(b) - ord(\"a\")\n insort(d[next], a)\n S[a] = b\n else:\n a = int(a)\n b = int(b)\n ans = 0\n for alpha in range(26):\n if bisect_right(d[alpha], b) - bisect_left(d[alpha], a) >= 1:\n ans += 1\n print(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- d[prev].remove(a)","+ d[prev].pop(bisect_left(d[prev], a))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0354648182,"measured_runtime_v1":0.0790308533,"runtime_lift":0.4487464929,"key":["s255436928","s145559466"]} +{"user_id":"u626337957","problem_id":"p02597","language":"python","submission_id_v0":"s347296704","submission_id_v1":"s343122392","cpu_time_v0":85,"cpu_time_v1":67,"memory_v0":82696,"memory_v1":62792,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.18,"input":"N=int(eval(input()))\n\nstones = list(eval(input()))\n\nl = 0\n\nr = N-1\n\ncount = 0\n\n\n\nwhile(True):\n\n while(stones[l] == \"R\" and l < N-1):\n\n l += 1\n\n while(stones[r] == \"W\" and r > 0):\n\n r -= 1\n\n if (l >= r):\n\n print(count)\n\n exit()\n\n else:\n\n count += 1\n\n l += 1\n\n r -= 1","target":"N= int(eval(input()))\n\nstone_str = eval(input())\n\nr_cnt = stone_str.count('R')\n\nprint((stone_str.count('W', 0, r_cnt)))","code_v0_loc":18,"code_v1_loc":4,"code_v0_num_chars":278,"code_v1_num_chars":105,"code_v0_no_empty_lines":"N = int(eval(input()))\nstones = list(eval(input()))\nl = 0\nr = N - 1\ncount = 0\nwhile True:\n while stones[l] == \"R\" and l < N - 1:\n l += 1\n while stones[r] == \"W\" and r > 0:\n r -= 1\n if l >= r:\n print(count)\n exit()\n else:\n count += 1\n l += 1\n r -= 1\n","code_v1_no_empty_lines":"N = int(eval(input()))\nstone_str = eval(input())\nr_cnt = stone_str.count(\"R\")\nprint((stone_str.count(\"W\", 0, r_cnt)))\n","code_same":false,"relative_loc_diff_percent":77.7777777778,"diff":["-stones = list(eval(input()))","-l = 0","-r = N - 1","-count = 0","-while True:","- while stones[l] == \"R\" and l < N - 1:","- l += 1","- while stones[r] == \"W\" and r > 0:","- r -= 1","- if l >= r:","- print(count)","- exit()","- else:","- count += 1","- l += 1","- r -= 1","+stone_str = eval(input())","+r_cnt = stone_str.count(\"R\")","+print((stone_str.count(\"W\", 0, r_cnt)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0478880847,"measured_runtime_v1":0.0446588652,"runtime_lift":1.0723085867,"key":["s347296704","s343122392"]} +{"user_id":"u312025627","problem_id":"p03161","language":"python","submission_id_v0":"s024603052","submission_id_v1":"s869527027","cpu_time_v0":483,"cpu_time_v1":365,"memory_v0":55392,"memory_v1":54092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.43,"input":"n, k = list(map(int,input().split()))\n\nh = list(map(int,input().split()))\n\n\n\ndp = [float(\"inf\")] * n\n\ndp[0] = 0\n\n\n\nfor i in range(n-1):\n\n for j in range(1,k+1):\n\n if i+j <= n-1:\n\n dp[i+j] = min(dp[i] + abs(h[i] - h[i+j]), dp[i+j])\n\nprint((dp[n-1]))","target":"def main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N, K = (int(i) for i in input().split())\n\n h = [0] + [int(i) for i in input().split()]\n\n memo = [float('inf')] * (N+1)\n\n\n\n memo[1] = 0\n\n for j in range(2, N+1):\n\n for i in range(j-K, j):\n\n if i < 0:\n\n continue\n\n memo[j] = min(memo[j], memo[i] + abs(h[j] - h[i]))\n\n\n\n print((memo[N]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":11,"code_v1_loc":19,"code_v0_num_chars":261,"code_v1_num_chars":457,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nh = list(map(int, input().split()))\ndp = [float(\"inf\")] * n\ndp[0] = 0\nfor i in range(n - 1):\n for j in range(1, k + 1):\n if i + j <= n - 1:\n dp[i + j] = min(dp[i] + abs(h[i] - h[i + j]), dp[i + j])\nprint((dp[n - 1]))\n","code_v1_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.buffer.readline\n N, K = (int(i) for i in input().split())\n h = [0] + [int(i) for i in input().split()]\n memo = [float(\"inf\")] * (N + 1)\n memo[1] = 0\n for j in range(2, N + 1):\n for i in range(j - K, j):\n if i < 0:\n continue\n memo[j] = min(memo[j], memo[i] + abs(h[j] - h[i]))\n print((memo[N]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":42.1052631579,"diff":["-n, k = list(map(int, input().split()))","-h = list(map(int, input().split()))","-dp = [float(\"inf\")] * n","-dp[0] = 0","-for i in range(n - 1):","- for j in range(1, k + 1):","- if i + j <= n - 1:","- dp[i + j] = min(dp[i] + abs(h[i] - h[i + j]), dp[i + j])","-print((dp[n - 1]))","+def main():","+ import sys","+","+ input = sys.stdin.buffer.readline","+ N, K = (int(i) for i in input().split())","+ h = [0] + [int(i) for i in input().split()]","+ memo = [float(\"inf\")] * (N + 1)","+ memo[1] = 0","+ for j in range(2, N + 1):","+ for i in range(j - K, j):","+ if i < 0:","+ continue","+ memo[j] = min(memo[j], memo[i] + abs(h[j] - h[i]))","+ print((memo[N]))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0651941462,"measured_runtime_v1":0.0435866408,"runtime_lift":1.4957368793,"key":["s024603052","s869527027"]} +{"user_id":"u114628916","problem_id":"p02258","language":"python","submission_id_v0":"s154422119","submission_id_v1":"s150416627","cpu_time_v0":1170,"cpu_time_v1":870,"memory_v0":15092,"memory_v1":27836,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.64,"input":"N = int(eval(input()))\n\ndatas = [int(eval(input())) for _ in range(N)]\n\nnow_max = max(datas[1:])\n\nmax_index = (N-1) - datas[::-1].index(now_max)\n\n_min = min(datas)\n\nmin_index = datas.index(_min)\n\n\n\nif max_index > min_index:\n\n diff = now_max - _min\n\nelse:\n\n diff = now_max - datas[0]\n\n \n\n for i in range(1,N-1):\n\n if i == max_index:\n\n now_max = max(datas[i+1:])\n\n max_index = datas.index(now_max,i+1)\n\n new_diff = now_max - datas[i]\n\n if diff < new_diff:\n\n diff = new_diff\n\n\n\nprint(diff)\n","target":"from sys import stdin\n\n\n\nN,*datas = [int(i) for i in stdin.readlines()]\n\nnow_max = max(datas[1:])\n\nmax_index = (N-1) - datas[::-1].index(now_max)\n\n_min = min(datas)\n\nmin_index = datas.index(_min)\n\n\n\nif max_index > min_index:\n\n diff = now_max - _min\n\nelse:\n\n diff = now_max - datas[0]\n\n \n\n for i in range(1,N-1):\n\n if i == max_index:\n\n now_max = max(datas[i+1:])\n\n max_index = datas.index(now_max,i+1)\n\n new_diff = now_max - datas[i]\n\n if diff < new_diff:\n\n diff = new_diff\n\n\n\nprint(diff)\n","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":541,"code_v1_num_chars":554,"code_v0_no_empty_lines":"N = int(eval(input()))\ndatas = [int(eval(input())) for _ in range(N)]\nnow_max = max(datas[1:])\nmax_index = (N - 1) - datas[::-1].index(now_max)\n_min = min(datas)\nmin_index = datas.index(_min)\nif max_index > min_index:\n diff = now_max - _min\nelse:\n diff = now_max - datas[0]\n for i in range(1, N - 1):\n if i == max_index:\n now_max = max(datas[i + 1 :])\n max_index = datas.index(now_max, i + 1)\n new_diff = now_max - datas[i]\n if diff < new_diff:\n diff = new_diff\nprint(diff)\n","code_v1_no_empty_lines":"from sys import stdin\n\nN, *datas = [int(i) for i in stdin.readlines()]\nnow_max = max(datas[1:])\nmax_index = (N - 1) - datas[::-1].index(now_max)\n_min = min(datas)\nmin_index = datas.index(_min)\nif max_index > min_index:\n diff = now_max - _min\nelse:\n diff = now_max - datas[0]\n for i in range(1, N - 1):\n if i == max_index:\n now_max = max(datas[i + 1 :])\n max_index = datas.index(now_max, i + 1)\n new_diff = now_max - datas[i]\n if diff < new_diff:\n diff = new_diff\nprint(diff)\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-N = int(eval(input()))","-datas = [int(eval(input())) for _ in range(N)]","+from sys import stdin","+","+N, *datas = [int(i) for i in stdin.readlines()]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0374260159,"measured_runtime_v1":0.0363743517,"runtime_lift":1.0289122432,"key":["s154422119","s150416627"]} +{"user_id":"u100641536","problem_id":"p02554","language":"python","submission_id_v0":"s063192763","submission_id_v1":"s355400915","cpu_time_v0":275,"cpu_time_v1":93,"memory_v0":81292,"memory_v1":62808,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.18,"input":"n=int(eval(input()))\n\nprint(((10**n-2*9**n+8**n)%(10**9+7)))","target":"m = 10**9 + 7\n\ndef powmod(x,y):\n\n a=1\n\n for i in range(y):\n\n a=(a*x)%m\n\n return a\n\nn=int(eval(input()))\n\ns=powmod(10,n)-2*powmod(9,n)+powmod(8,n)\n\nprint(((s+m)%m))","code_v0_loc":2,"code_v1_loc":9,"code_v0_num_chars":52,"code_v1_num_chars":161,"code_v0_no_empty_lines":"n = int(eval(input()))\nprint(((10**n - 2 * 9**n + 8**n) % (10**9 + 7)))\n","code_v1_no_empty_lines":"m = 10**9 + 7\n\n\ndef powmod(x, y):\n a = 1\n for i in range(y):\n a = (a * x) % m\n return a\n\n\nn = int(eval(input()))\ns = powmod(10, n) - 2 * powmod(9, n) + powmod(8, n)\nprint(((s + m) % m))\n","code_same":false,"relative_loc_diff_percent":77.7777777778,"diff":["+m = 10**9 + 7","+","+","+def powmod(x, y):","+ a = 1","+ for i in range(y):","+ a = (a * x) % m","+ return a","+","+","-print(((10**n - 2 * 9**n + 8**n) % (10**9 + 7)))","+s = powmod(10, n) - 2 * powmod(9, n) + powmod(8, n)","+print(((s + m) % m))"],"diff_only_import_comment":false,"measured_runtime_v0":0.372460391,"measured_runtime_v1":0.1761791503,"runtime_lift":2.1141002797,"key":["s063192763","s355400915"]} +{"user_id":"u105124953","problem_id":"p02683","language":"python","submission_id_v0":"s196709463","submission_id_v1":"s997235689","cpu_time_v0":92,"cpu_time_v1":77,"memory_v0":9520,"memory_v1":69036,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.3,"input":"import itertools\n\nans_li = []\n\nn,m,x = list(map(int,input().split()))\n\nli = []\n\nfor _ in range(n):\n\n li.append(list(map(int,input().split())))\n\n\n\nfor i in range(n):\n\n if i == 0:\n\n tmp = [kkk for kkk in range(n)]\n\n #print(tmp)\n\n #score_li = [0]*m\n\n #okane = 0\n\n #print([k for k in range(n)],i+1,tmp)\n\n for t in tmp:\n\n score_li = [0]*m\n\n okane = 0\n\n #print(li,t,'ttttt')\n\n for ii,ll in enumerate(list(li[t])):\n\n if ii==0:\n\n okane += li[t][ii]\n\n else:\n\n #print(score_li,ii,ll)\n\n score_li[ii-1]+=ll\n\n flag = True\n\n #print(score_li,okane)\n\n for ss in score_li:\n\n if ss0:\n\n print((min(ans_li)))\n\nelse:\n\n print((-1))","target":"import itertools\n\nn,m,x = list(map(int,input().split()))\n\nc_li = []\n\na_li = []\n\nfor _ in range(n):\n\n tmp = list(map(int,input().split()))\n\n c_li.append(tmp[0])\n\n a_li.append(tmp[1:])\n\nkumi = list(itertools.product([0,1], repeat=n))\n\nans_li = []\n\nfor each_kumi in kumi:\n\n each_li = [0]*m\n\n score = 0\n\n for i,k in enumerate(each_kumi):\n\n if k == 1:\n\n score += c_li[i]\n\n for j,kk in enumerate(a_li[i]):\n\n each_li[j] += kk\n\n flag = True\n\n for ea in each_li:\n\n if ea 0:\n print((min(ans_li)))\nelse:\n print((-1))\n","code_v1_no_empty_lines":"import itertools\n\nn, m, x = list(map(int, input().split()))\nc_li = []\na_li = []\nfor _ in range(n):\n tmp = list(map(int, input().split()))\n c_li.append(tmp[0])\n a_li.append(tmp[1:])\nkumi = list(itertools.product([0, 1], repeat=n))\nans_li = []\nfor each_kumi in kumi:\n each_li = [0] * m\n score = 0\n for i, k in enumerate(each_kumi):\n if k == 1:\n score += c_li[i]\n for j, kk in enumerate(a_li[i]):\n each_li[j] += kk\n flag = True\n for ea in each_li:\n if ea < x:\n flag = False\n if flag:\n ans_li.append(score)\nif len(ans_li) == 0:\n print((-1))\nelse:\n print((min(ans_li)))\n","code_same":false,"relative_loc_diff_percent":53.3333333333,"diff":["+n, m, x = list(map(int, input().split()))","+c_li = []","+a_li = []","+for _ in range(n):","+ tmp = list(map(int, input().split()))","+ c_li.append(tmp[0])","+ a_li.append(tmp[1:])","+kumi = list(itertools.product([0, 1], repeat=n))","-n, m, x = list(map(int, input().split()))","-li = []","-for _ in range(n):","- li.append(list(map(int, input().split())))","-for i in range(n):","- if i == 0:","- tmp = [kkk for kkk in range(n)]","- # print(tmp)","- # score_li = [0]*m","- # okane = 0","- # print([k for k in range(n)],i+1,tmp)","- for t in tmp:","- score_li = [0] * m","- okane = 0","- # print(li,t,'ttttt')","- for ii, ll in enumerate(list(li[t])):","- if ii == 0:","- okane += li[t][ii]","- else:","- # print(score_li,ii,ll)","- score_li[ii - 1] += ll","- flag = True","- # print(score_li,okane)","- for ss in score_li:","- if ss < x:","- flag = False","- if flag:","- ans_li.append(okane)","- else:","- tmp = list(itertools.combinations(list(range(n)), i + 1))","- # print(tmp)","- # score_li = [0]*m","- # okane = 0","- # print([k for k in range(n)],i+1,tmp)","- for t in tmp:","- score_li = [0] * m","- okane = 0","- # print(li,t,'ttttt')","- for aaa in t:","- for ii, ll in enumerate(list(li[aaa])):","- if ii == 0:","- okane += li[aaa][ii]","- else:","- # print(score_li,ii,ll)","- score_li[ii - 1] += ll","- flag = True","- for ss in score_li:","- if ss < x:","- flag = False","- if flag:","- ans_li.append(okane)","-# print(ans_li)","-if len(ans_li) > 0:","+for each_kumi in kumi:","+ each_li = [0] * m","+ score = 0","+ for i, k in enumerate(each_kumi):","+ if k == 1:","+ score += c_li[i]","+ for j, kk in enumerate(a_li[i]):","+ each_li[j] += kk","+ flag = True","+ for ea in each_li:","+ if ea < x:","+ flag = False","+ if flag:","+ ans_li.append(score)","+if len(ans_li) == 0:","+ print((-1))","+else:","-else:","- print((-1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0440708776,"measured_runtime_v1":0.0451401987,"runtime_lift":0.9763111108,"key":["s196709463","s997235689"]} +{"user_id":"u133936772","problem_id":"p02834","language":"python","submission_id_v0":"s210516280","submission_id_v1":"s288974511","cpu_time_v0":851,"cpu_time_v1":628,"memory_v0":129420,"memory_v1":39744,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.2,"input":"import sys\n\nsys.setrecursionlimit(10**9)\n\nf=lambda:list(map(int,sys.stdin.readline().split()))\n\nn,st,sa=f()\n\ng=[set() for _ in range(n)]\n\nfor _ in range(n-1):\n\n a,b=f()\n\n g[a-1].add(b-1)\n\n g[b-1].add(a-1)\n\ndef dfs(l,v,p=-1,d=0):\n\n l[v]=d\n\n for c in g[v]:\n\n if c!=p: dfs(l,c,v,d+1)\n\nlt=[0]*n\n\ndfs(lt,st-1)\n\nla=[0]*n\n\ndfs(la,sa-1)\n\nprint((max(la[i] for i in range(n) if lt[i] 0:\n\n cnt += i%6\n\n i \/\/= 6\n\n while j > 0:\n\n cnt += j%9\n\n j \/\/= 9\n\n ans = min(ans, cnt)\n\nprint(ans)","target":"N = int(eval(input()))\n\n\n\nsixs = [6**i for i in range(1,7)]\n\nnines = [9**i for i in range(1,6)]\n\ntmp = {}\n\n\n\ndef dfs(n):\n\n if(n < 6):\n\n return n\n\n\n\n if(n in tmp):\n\n return tmp[n]\n\n\n\n m = 10**9+7\n\n if(n >= 9):\n\n max_nine = max(nine for nine in nines if nine <= n)\n\n if(n%max_nine == 0):\n\n m = min(m, n \/\/ max_nine)\n\n else:\n\n m = min(m, dfs(n - max_nine) + 1)\n\n\n\n max_six = max(six for six in sixs if six <= n)\n\n if(n%max_six == 0):\n\n m = min(m, n \/\/ max_six)\n\n\n\n tmp[n] = min(m, dfs(n - max_six) + 1)\n\n return tmp[n]\n\n\n\nprint((dfs(N)))","code_v0_loc":14,"code_v1_loc":29,"code_v0_num_chars":202,"code_v1_num_chars":562,"code_v0_no_empty_lines":"N = int(eval(input()))\nans = 10**9 + 7\nfor i in range(N + 1):\n j = N - i\n cnt = 0\n while i > 0:\n cnt += i % 6\n i \/\/= 6\n while j > 0:\n cnt += j % 9\n j \/\/= 9\n ans = min(ans, cnt)\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nsixs = [6**i for i in range(1, 7)]\nnines = [9**i for i in range(1, 6)]\ntmp = {}\n\n\ndef dfs(n):\n if n < 6:\n return n\n if n in tmp:\n return tmp[n]\n m = 10**9 + 7\n if n >= 9:\n max_nine = max(nine for nine in nines if nine <= n)\n if n % max_nine == 0:\n m = min(m, n \/\/ max_nine)\n else:\n m = min(m, dfs(n - max_nine) + 1)\n max_six = max(six for six in sixs if six <= n)\n if n % max_six == 0:\n m = min(m, n \/\/ max_six)\n tmp[n] = min(m, dfs(n - max_six) + 1)\n return tmp[n]\n\n\nprint((dfs(N)))\n","code_same":false,"relative_loc_diff_percent":51.724137931,"diff":["-ans = 10**9 + 7","-for i in range(N + 1):","- j = N - i","- cnt = 0","- while i > 0:","- cnt += i % 6","- i \/\/= 6","- while j > 0:","- cnt += j % 9","- j \/\/= 9","- ans = min(ans, cnt)","-print(ans)","+sixs = [6**i for i in range(1, 7)]","+nines = [9**i for i in range(1, 6)]","+tmp = {}","+","+","+def dfs(n):","+ if n < 6:","+ return n","+ if n in tmp:","+ return tmp[n]","+ m = 10**9 + 7","+ if n >= 9:","+ max_nine = max(nine for nine in nines if nine <= n)","+ if n % max_nine == 0:","+ m = min(m, n \/\/ max_nine)","+ else:","+ m = min(m, dfs(n - max_nine) + 1)","+ max_six = max(six for six in sixs if six <= n)","+ if n % max_six == 0:","+ m = min(m, n \/\/ max_six)","+ tmp[n] = min(m, dfs(n - max_six) + 1)","+ return tmp[n]","+","+","+print((dfs(N)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1765732336,"measured_runtime_v1":0.0371914721,"runtime_lift":4.7476806861,"key":["s339258845","s508615035"]} +{"user_id":"u641929438","problem_id":"p02727","language":"python","submission_id_v0":"s376522957","submission_id_v1":"s126175161","cpu_time_v0":324,"cpu_time_v1":273,"memory_v0":24832,"memory_v1":24840,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.74,"input":"import numpy as np\n\nx, y, a, b, c = list(map(int, input().split()))\n\np = np.array(list(map(int, input().split())))\n\nq = np.array(list(map(int, input().split())))\n\nr = np.array(list(map(int, input().split())))\n\n\n\np = np.sort(p)[::-1][:x]\n\nq = np.sort(q)[::-1][:y]\n\n\n\nmix = np.hstack((p, q, r))\n\nmix = np.sort(mix)[::-1]\n\n\n\neat = x+y\n\n\n\nprint((sum(mix[:eat])))","target":"import numpy as np\n\n\n\nx, y, a, b, c = list(map(int, input().split()))\n\np = np.array(list(map(int, input().split())))\n\nq = np.array(list(map(int, input().split())))\n\nr = np.array(list(map(int, input().split())))\n\n\n\np = np.sort(p)[::-1][:x]\n\nq = np.sort(q)[::-1][:y]\n\na = np.hstack((p, q, r))\n\na = np.sort(a)[::-1][:(x+y)]\n\n\n\nprint((np.sum(a)))","code_v0_loc":15,"code_v1_loc":13,"code_v0_num_chars":350,"code_v1_num_chars":334,"code_v0_no_empty_lines":"import numpy as np\n\nx, y, a, b, c = list(map(int, input().split()))\np = np.array(list(map(int, input().split())))\nq = np.array(list(map(int, input().split())))\nr = np.array(list(map(int, input().split())))\np = np.sort(p)[::-1][:x]\nq = np.sort(q)[::-1][:y]\nmix = np.hstack((p, q, r))\nmix = np.sort(mix)[::-1]\neat = x + y\nprint((sum(mix[:eat])))\n","code_v1_no_empty_lines":"import numpy as np\n\nx, y, a, b, c = list(map(int, input().split()))\np = np.array(list(map(int, input().split())))\nq = np.array(list(map(int, input().split())))\nr = np.array(list(map(int, input().split())))\np = np.sort(p)[::-1][:x]\nq = np.sort(q)[::-1][:y]\na = np.hstack((p, q, r))\na = np.sort(a)[::-1][: (x + y)]\nprint((np.sum(a)))\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-mix = np.hstack((p, q, r))","-mix = np.sort(mix)[::-1]","-eat = x + y","-print((sum(mix[:eat])))","+a = np.hstack((p, q, r))","+a = np.sort(a)[::-1][: (x + y)]","+print((np.sum(a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.6268622503,"measured_runtime_v1":0.4191265748,"runtime_lift":1.4956394752,"key":["s376522957","s126175161"]} +{"user_id":"u163320134","problem_id":"p02676","language":"python","submission_id_v0":"s151657650","submission_id_v1":"s892848630","cpu_time_v0":24,"cpu_time_v1":22,"memory_v0":9092,"memory_v1":9040,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.33,"input":"k=int(eval(input()))\n\ns=eval(input())\n\nif len(s)>k:\n\n print((s[:k]+'...'))\n\nelse:\n\n print(s)","target":"k=int(eval(input()))\n\ns=eval(input())\n\nl=len(s)\n\nans=''\n\nfor i in range(k):\n\n ans+=s[i]\n\n if i==l-1:\n\n break\n\nelse:\n\n ans+='...'\n\nprint(ans)","code_v0_loc":6,"code_v1_loc":11,"code_v0_num_chars":80,"code_v1_num_chars":134,"code_v0_no_empty_lines":"k = int(eval(input()))\ns = eval(input())\nif len(s) > k:\n print((s[:k] + \"...\"))\nelse:\n print(s)\n","code_v1_no_empty_lines":"k = int(eval(input()))\ns = eval(input())\nl = len(s)\nans = \"\"\nfor i in range(k):\n ans += s[i]\n if i == l - 1:\n break\nelse:\n ans += \"...\"\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-if len(s) > k:","- print((s[:k] + \"...\"))","+l = len(s)","+ans = \"\"","+for i in range(k):","+ ans += s[i]","+ if i == l - 1:","+ break","- print(s)","+ ans += \"...\"","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0566407681,"measured_runtime_v1":0.040253506,"runtime_lift":1.4071014833,"key":["s151657650","s892848630"]} +{"user_id":"u821588465","problem_id":"p02861","language":"python","submission_id_v0":"s246548508","submission_id_v1":"s343917001","cpu_time_v0":199,"cpu_time_v1":126,"memory_v0":9232,"memory_v1":27136,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.68,"input":"from itertools import permutations\n\nfrom math import sqrt, pow, factorial\n\n\n\nn = int(eval(input()))\n\nxy = [list(map(int, input().split())) for _ in range(n)]\n\n\n\ndef calc(a,b):\n\n [x1, y1] = a\n\n [x2, y2] = b\n\n return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2))\n\n\n\nsum = 0\n\nfor i in permutations(list(range(n))):\n\n distance = 0\n\n for j in range(1, n):\n\n distance = calc(xy[i[j]], xy[i[j-1]])\n\n sum += distance\n\nprint((sum\/factorial(n)))\n\n\n\n\n\n\n\n\n","target":"import numpy as np\n\nfrom itertools import combinations\n\nfrom itertools import permutations\n\nfrom math import factorial\n\n\n\n\n\nN = int(eval(input()))\n\nxy = np.array([list(map(int, input().split())) for _ in range(N)])\n\ncnt = 0\n\n\n\nfor i in xy:\n\n for j in xy:\n\n cnt += np.linalg.norm(i - j)\n\nprint((cnt \/ N))","code_v0_loc":22,"code_v1_loc":14,"code_v0_num_chars":453,"code_v1_num_chars":305,"code_v0_no_empty_lines":"from itertools import permutations\nfrom math import sqrt, pow, factorial\n\nn = int(eval(input()))\nxy = [list(map(int, input().split())) for _ in range(n)]\n\n\ndef calc(a, b):\n [x1, y1] = a\n [x2, y2] = b\n return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2))\n\n\nsum = 0\nfor i in permutations(list(range(n))):\n distance = 0\n for j in range(1, n):\n distance = calc(xy[i[j]], xy[i[j - 1]])\n sum += distance\nprint((sum \/ factorial(n)))\n","code_v1_no_empty_lines":"import numpy as np\nfrom itertools import combinations\nfrom itertools import permutations\nfrom math import factorial\n\nN = int(eval(input()))\nxy = np.array([list(map(int, input().split())) for _ in range(N)])\ncnt = 0\nfor i in xy:\n for j in xy:\n cnt += np.linalg.norm(i - j)\nprint((cnt \/ N))\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["+import numpy as np","+from itertools import combinations","-from math import sqrt, pow, factorial","+from math import factorial","-n = int(eval(input()))","-xy = [list(map(int, input().split())) for _ in range(n)]","-","-","-def calc(a, b):","- [x1, y1] = a","- [x2, y2] = b","- return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2))","-","-","-sum = 0","-for i in permutations(list(range(n))):","- distance = 0","- for j in range(1, n):","- distance = calc(xy[i[j]], xy[i[j - 1]])","- sum += distance","-print((sum \/ factorial(n)))","+N = int(eval(input()))","+xy = np.array([list(map(int, input().split())) for _ in range(N)])","+cnt = 0","+for i in xy:","+ for j in xy:","+ cnt += np.linalg.norm(i - j)","+print((cnt \/ N))"],"diff_only_import_comment":false,"measured_runtime_v0":0.04645648,"measured_runtime_v1":0.4392174244,"runtime_lift":0.1057710315,"key":["s246548508","s343917001"]} +{"user_id":"u493491792","problem_id":"p02934","language":"python","submission_id_v0":"s219630291","submission_id_v1":"s869953641","cpu_time_v0":164,"cpu_time_v1":20,"memory_v0":12468,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.8,"input":"import numpy as np\n\nn=int(eval(input()))\n\na=list(map(int,input().split()))\n\n\n\nlista=0\n\nfor i in range(n):\n\n lista=lista+1\/a[i]\n\nprint((1\/lista))\n","target":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\n \n\nlista=0\n\nfor i in range(n):\n\n lista=lista+1\/a[i]\n\nprint((1\/lista))\n","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":140,"code_v1_num_chars":121,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nlista = 0\nfor i in range(n):\n lista = lista + 1 \/ a[i]\nprint((1 \/ lista))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nlista = 0\nfor i in range(n):\n lista = lista + 1 \/ a[i]\nprint((1 \/ lista))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import numpy as np","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.0698088727,"measured_runtime_v1":0.0816577208,"runtime_lift":0.8548961691,"key":["s219630291","s869953641"]} +{"user_id":"u353895424","problem_id":"p03219","language":"python","submission_id_v0":"s996914927","submission_id_v1":"s383310953","cpu_time_v0":165,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.7,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\nx,y = list(map(int, input().split()))\n\nprint((x+y\/\/2))\n","target":"x, y = list(map(int, input().split()))\n\nprint((x+y\/\/2))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":89,"code_v1_num_chars":47,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nx, y = list(map(int, input().split()))\nprint((x + y \/\/ 2))\n","code_v1_no_empty_lines":"x, y = list(map(int, input().split()))\nprint((x + y \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-import sys","-","-input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.1191544455,"measured_runtime_v1":0.0366589667,"runtime_lift":3.2503492646,"key":["s996914927","s383310953"]} +{"user_id":"u074220993","problem_id":"p03659","language":"python","submission_id_v0":"s076380156","submission_id_v1":"s889116907","cpu_time_v0":186,"cpu_time_v1":136,"memory_v0":31148,"memory_v1":30548,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.88,"input":"N = int(eval(input()))\n\na = [int(x) for x in input().split()]\n\nans = 10**9*N\n\nfront = 0\n\nback = sum(a)\n\nfor i in range(N-1):\n\n front += a[i]\n\n back -= a[i]\n\n ans = min(ans, abs(front-back))\n\nprint(ans)","target":"with open(0) as f:\n\n N, *a = list(map(int, f.read().split()))\n\nscore = -sum(a[1:]) + a[0]\n\nans = abs(score)\n\nfor x in a[1:N-1]:\n\n score += 2*x\n\n ans = min(ans, abs(score))\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":204,"code_v1_num_chars":186,"code_v0_no_empty_lines":"N = int(eval(input()))\na = [int(x) for x in input().split()]\nans = 10**9 * N\nfront = 0\nback = sum(a)\nfor i in range(N - 1):\n front += a[i]\n back -= a[i]\n ans = min(ans, abs(front - back))\nprint(ans)\n","code_v1_no_empty_lines":"with open(0) as f:\n N, *a = list(map(int, f.read().split()))\nscore = -sum(a[1:]) + a[0]\nans = abs(score)\nfor x in a[1 : N - 1]:\n score += 2 * x\n ans = min(ans, abs(score))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-N = int(eval(input()))","-a = [int(x) for x in input().split()]","-ans = 10**9 * N","-front = 0","-back = sum(a)","-for i in range(N - 1):","- front += a[i]","- back -= a[i]","- ans = min(ans, abs(front - back))","+with open(0) as f:","+ N, *a = list(map(int, f.read().split()))","+score = -sum(a[1:]) + a[0]","+ans = abs(score)","+for x in a[1 : N - 1]:","+ score += 2 * x","+ ans = min(ans, abs(score))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1186726861,"measured_runtime_v1":0.031808399,"runtime_lift":3.7308600852,"key":["s076380156","s889116907"]} +{"user_id":"u131464432","problem_id":"p03319","language":"python","submission_id_v0":"s853676969","submission_id_v1":"s838143000","cpu_time_v0":65,"cpu_time_v1":53,"memory_v0":23980,"memory_v1":20476,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.46,"input":"import collections\n\nN,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = collections.Counter(A)[min(A)]\n\nprint((-(-(N-B)\/\/(K-1))))","target":"N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nprint((-(-(N-1)\/\/(K-1))))","code_v0_loc":5,"code_v1_loc":3,"code_v0_num_chars":147,"code_v1_num_chars":91,"code_v0_no_empty_lines":"import collections\n\nN, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = collections.Counter(A)[min(A)]\nprint((-(-(N - B) \/\/ (K - 1))))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nprint((-(-(N - 1) \/\/ (K - 1))))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-import collections","-","-B = collections.Counter(A)[min(A)]","-print((-(-(N - B) \/\/ (K - 1))))","+print((-(-(N - 1) \/\/ (K - 1))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0475494862,"measured_runtime_v1":0.0468720913,"runtime_lift":1.0144519871,"key":["s853676969","s838143000"]} +{"user_id":"u562935282","problem_id":"p03014","language":"python","submission_id_v0":"s789681780","submission_id_v1":"s744369283","cpu_time_v0":1132,"cpu_time_v1":867,"memory_v0":209096,"memory_v1":179844,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.41,"input":"class UnionFind:\n\n def __init__(self, n):\n\n self.v = [-1 for _ in range(n)] # \u6839(\u8ca0): \u9023\u7d50\u9802\u70b9\u6570 * (-1) \/ \u5b50(\u6b63): \u6839\u306e\u9802\u70b9\u756a\u53f7(0-indexed)\n\n\n\n def find(self, x): # x\u3092\u542b\u3080\u6728\u306b\u304a\u3051\u308b\u6839\u306e\u9802\u70b9\u756a\u53f7\u3092\u8fd4\u3059\n\n if self.v[x] < 0: # (\u8ca0)\u306f\u6839\n\n return x\n\n else: # \u6839\u306e\u9802\u70b9\u756a\u53f7\n\n self.v[x] = self.find(self.v[x]) # unite\u3067\u306f, \u65e7\u6839\u306b\u5c5e\u3059\u308b\u9802\u70b9\u306e\u6839\u304c\u65e7\u6839\u306e\u307e\u307e\u306a\u306e\u3067\u66f4\u65b0\n\n return self.v[x]\n\n\n\n def unite(self, x, y): # \u9055\u3046\u6839\u306b\u5c5e\u3057\u3066\u3044\u305f\u3089rank\u304c\u4f4e\u304f\u306a\u308b\u3088\u3046\u306b\u9023\u7d50\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:\n\n return\n\n if -self.v[x] < -self.v[y]: # size\u6bd4\u8f03, \u3000(-1) * (\u9023\u7d50\u9802\u70b9\u6570 * (-1)), (\u6b63)\u540c\u58eb\u306e\u5927\u5c0f\u6bd4\u8f03\n\n x, y = y, x # \u9023\u7d50\u9802\u70b9\u6570\u304c\u5c11\u306a\u3044\u65b9\u3092y\u306b\u3059\u308b\u3068, find\u3067\u306e\u66f4\u65b0\u56de\u6570\u304c\u6e1b\u308b\uff1f\n\n self.v[x] += self.v[y] # \u9023\u7d50\u9802\u70b9\u6570\u306e\u548c\u3092\u53d6\u308b, \u9023\u7d50\u9802\u70b9\u6570 * (-1)\n\n self.v[y] = x # \u9023\u7d50\u9802\u70b9\u6570\u304c\u5c11\u306a\u3044y(\u5f15\u6570y\u306e\u6839\u306e\u9802\u70b9\u756a\u53f7)\u306e\u6839\u3092x(\u5f15\u6570x\u306e\u6839\u306e\u9802\u70b9\u756a\u53f7)\u306b\u3059\u308b\n\n\n\n def root(self, x):\n\n return self.v[x] < 0 # (\u8ca0)\u306f\u6839\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y) # \u540c\u3058\u6839\u306b\u5c5e\u3059\u308b\u304b\n\n\n\n def size(self, x):\n\n return -self.v[self.find(x)] # \u9023\u7d50\u9802\u70b9\u6570\u3092\u8fd4\u3059\n\n\n\n\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\n\n\nH, W = list(map(int, input().split()))\n\ns = tuple(eval(input()) for _ in range(H))\n\n\n\nuf_r = UnionFind(H * W)\n\nfor r in range(H - 1):\n\n for c in range(W):\n\n if s[r][c] == '.' and s[r + 1][c] == '.':\n\n uf_r.unite(r * W + c, (r + 1) * W + c)\n\n\n\nuf_c = UnionFind(H * W)\n\nfor c in range(W - 1):\n\n for r in range(H):\n\n if s[r][c] == '.' and s[r][c + 1] == '.':\n\n uf_c.unite(r * W + c, r * W + (c + 1))\n\n\n\nans = 0\n\nfor r in range(H):\n\n for c in range(W):\n\n if s[r][c] == '#': continue\n\n t = uf_r.size(r * W + c) + uf_c.size(r * W + c) - 1\n\n ans = max(ans, t)\n\nprint(ans)\n","target":"H, W = list(map(int, input().split()))\n\ns = [eval(input()) for _ in range(H)]\n\n\n\nL = [[-1] * W for _ in range(H)]\n\nR = [[-1] * W for _ in range(H)]\n\nD = [[-1] * W for _ in range(H)]\n\nU = [[-1] * W for _ in range(H)]\n\n\n\nfor r in range(H):\n\n for c in range(W):\n\n if s[r][c] == '.':\n\n if c == 0:\n\n L[r][c] = 1\n\n else:\n\n L[r][c] = L[r][c - 1] + 1\n\n else:\n\n L[r][c] = 0\n\n\n\nfor r in range(H):\n\n for c in reversed(list(range(W))):\n\n if s[r][c] == '.':\n\n if c == W - 1:\n\n R[r][c] = 1\n\n else:\n\n R[r][c] = R[r][c + 1] + 1\n\n else:\n\n R[r][c] = 0\n\n\n\nfor r in range(H):\n\n for c in range(W):\n\n if s[r][c] == '.':\n\n if r == 0:\n\n U[r][c] = 1\n\n else:\n\n U[r][c] = U[r - 1][c] + 1\n\n else:\n\n U[r][c] = 0\n\n\n\nfor r in reversed(list(range(H))):\n\n for c in range(W):\n\n if s[r][c] == '.':\n\n if r == H - 1:\n\n D[r][c] = 1\n\n else:\n\n D[r][c] = D[r + 1][c] + 1\n\n else:\n\n D[r][c] = 0\n\n\n\nans = 0\n\nfor r in range(H):\n\n for c in range(W):\n\n ans = max(ans, L[r][c] + R[r][c] + D[r][c] + U[r][c] - 3)\n\nprint(ans)\n","code_v0_loc":57,"code_v1_loc":53,"code_v0_num_chars":1692,"code_v1_num_chars":1282,"code_v0_no_empty_lines":"class UnionFind:\n def __init__(self, n):\n self.v = [-1 for _ in range(n)] # \u6839(\u8ca0): \u9023\u7d50\u9802\u70b9\u6570 * (-1) \/ \u5b50(\u6b63): \u6839\u306e\u9802\u70b9\u756a\u53f7(0-indexed)\n\n def find(self, x): # x\u3092\u542b\u3080\u6728\u306b\u304a\u3051\u308b\u6839\u306e\u9802\u70b9\u756a\u53f7\u3092\u8fd4\u3059\n if self.v[x] < 0: # (\u8ca0)\u306f\u6839\n return x\n else: # \u6839\u306e\u9802\u70b9\u756a\u53f7\n self.v[x] = self.find(self.v[x]) # unite\u3067\u306f, \u65e7\u6839\u306b\u5c5e\u3059\u308b\u9802\u70b9\u306e\u6839\u304c\u65e7\u6839\u306e\u307e\u307e\u306a\u306e\u3067\u66f4\u65b0\n return self.v[x]\n\n def unite(self, x, y): # \u9055\u3046\u6839\u306b\u5c5e\u3057\u3066\u3044\u305f\u3089rank\u304c\u4f4e\u304f\u306a\u308b\u3088\u3046\u306b\u9023\u7d50\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if -self.v[x] < -self.v[y]: # size\u6bd4\u8f03, \u3000(-1) * (\u9023\u7d50\u9802\u70b9\u6570 * (-1)), (\u6b63)\u540c\u58eb\u306e\u5927\u5c0f\u6bd4\u8f03\n x, y = y, x # \u9023\u7d50\u9802\u70b9\u6570\u304c\u5c11\u306a\u3044\u65b9\u3092y\u306b\u3059\u308b\u3068, find\u3067\u306e\u66f4\u65b0\u56de\u6570\u304c\u6e1b\u308b\uff1f\n self.v[x] += self.v[y] # \u9023\u7d50\u9802\u70b9\u6570\u306e\u548c\u3092\u53d6\u308b, \u9023\u7d50\u9802\u70b9\u6570 * (-1)\n self.v[y] = x # \u9023\u7d50\u9802\u70b9\u6570\u304c\u5c11\u306a\u3044y(\u5f15\u6570y\u306e\u6839\u306e\u9802\u70b9\u756a\u53f7)\u306e\u6839\u3092x(\u5f15\u6570x\u306e\u6839\u306e\u9802\u70b9\u756a\u53f7)\u306b\u3059\u308b\n\n def root(self, x):\n return self.v[x] < 0 # (\u8ca0)\u306f\u6839\n\n def same(self, x, y):\n return self.find(x) == self.find(y) # \u540c\u3058\u6839\u306b\u5c5e\u3059\u308b\u304b\n\n def size(self, x):\n return -self.v[self.find(x)] # \u9023\u7d50\u9802\u70b9\u6570\u3092\u8fd4\u3059\n\n\nimport sys\n\ninput = sys.stdin.readline\nH, W = list(map(int, input().split()))\ns = tuple(eval(input()) for _ in range(H))\nuf_r = UnionFind(H * W)\nfor r in range(H - 1):\n for c in range(W):\n if s[r][c] == \".\" and s[r + 1][c] == \".\":\n uf_r.unite(r * W + c, (r + 1) * W + c)\nuf_c = UnionFind(H * W)\nfor c in range(W - 1):\n for r in range(H):\n if s[r][c] == \".\" and s[r][c + 1] == \".\":\n uf_c.unite(r * W + c, r * W + (c + 1))\nans = 0\nfor r in range(H):\n for c in range(W):\n if s[r][c] == \"#\":\n continue\n t = uf_r.size(r * W + c) + uf_c.size(r * W + c) - 1\n ans = max(ans, t)\nprint(ans)\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\ns = [eval(input()) for _ in range(H)]\nL = [[-1] * W for _ in range(H)]\nR = [[-1] * W for _ in range(H)]\nD = [[-1] * W for _ in range(H)]\nU = [[-1] * W for _ in range(H)]\nfor r in range(H):\n for c in range(W):\n if s[r][c] == \".\":\n if c == 0:\n L[r][c] = 1\n else:\n L[r][c] = L[r][c - 1] + 1\n else:\n L[r][c] = 0\nfor r in range(H):\n for c in reversed(list(range(W))):\n if s[r][c] == \".\":\n if c == W - 1:\n R[r][c] = 1\n else:\n R[r][c] = R[r][c + 1] + 1\n else:\n R[r][c] = 0\nfor r in range(H):\n for c in range(W):\n if s[r][c] == \".\":\n if r == 0:\n U[r][c] = 1\n else:\n U[r][c] = U[r - 1][c] + 1\n else:\n U[r][c] = 0\nfor r in reversed(list(range(H))):\n for c in range(W):\n if s[r][c] == \".\":\n if r == H - 1:\n D[r][c] = 1\n else:\n D[r][c] = D[r + 1][c] + 1\n else:\n D[r][c] = 0\nans = 0\nfor r in range(H):\n for c in range(W):\n ans = max(ans, L[r][c] + R[r][c] + D[r][c] + U[r][c] - 3)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.0175438596,"diff":["-class UnionFind:","- def __init__(self, n):","- self.v = [-1 for _ in range(n)] # \u6839(\u8ca0): \u9023\u7d50\u9802\u70b9\u6570 * (-1) \/ \u5b50(\u6b63): \u6839\u306e\u9802\u70b9\u756a\u53f7(0-indexed)","-","- def find(self, x): # x\u3092\u542b\u3080\u6728\u306b\u304a\u3051\u308b\u6839\u306e\u9802\u70b9\u756a\u53f7\u3092\u8fd4\u3059","- if self.v[x] < 0: # (\u8ca0)\u306f\u6839","- return x","- else: # \u6839\u306e\u9802\u70b9\u756a\u53f7","- self.v[x] = self.find(self.v[x]) # unite\u3067\u306f, \u65e7\u6839\u306b\u5c5e\u3059\u308b\u9802\u70b9\u306e\u6839\u304c\u65e7\u6839\u306e\u307e\u307e\u306a\u306e\u3067\u66f4\u65b0","- return self.v[x]","-","- def unite(self, x, y): # \u9055\u3046\u6839\u306b\u5c5e\u3057\u3066\u3044\u305f\u3089rank\u304c\u4f4e\u304f\u306a\u308b\u3088\u3046\u306b\u9023\u7d50","- x = self.find(x)","- y = self.find(y)","- if x == y:","- return","- if -self.v[x] < -self.v[y]: # size\u6bd4\u8f03, \u3000(-1) * (\u9023\u7d50\u9802\u70b9\u6570 * (-1)), (\u6b63)\u540c\u58eb\u306e\u5927\u5c0f\u6bd4\u8f03","- x, y = y, x # \u9023\u7d50\u9802\u70b9\u6570\u304c\u5c11\u306a\u3044\u65b9\u3092y\u306b\u3059\u308b\u3068, find\u3067\u306e\u66f4\u65b0\u56de\u6570\u304c\u6e1b\u308b\uff1f","- self.v[x] += self.v[y] # \u9023\u7d50\u9802\u70b9\u6570\u306e\u548c\u3092\u53d6\u308b, \u9023\u7d50\u9802\u70b9\u6570 * (-1)","- self.v[y] = x # \u9023\u7d50\u9802\u70b9\u6570\u304c\u5c11\u306a\u3044y(\u5f15\u6570y\u306e\u6839\u306e\u9802\u70b9\u756a\u53f7)\u306e\u6839\u3092x(\u5f15\u6570x\u306e\u6839\u306e\u9802\u70b9\u756a\u53f7)\u306b\u3059\u308b","-","- def root(self, x):","- return self.v[x] < 0 # (\u8ca0)\u306f\u6839","-","- def same(self, x, y):","- return self.find(x) == self.find(y) # \u540c\u3058\u6839\u306b\u5c5e\u3059\u308b\u304b","-","- def size(self, x):","- return -self.v[self.find(x)] # \u9023\u7d50\u9802\u70b9\u6570\u3092\u8fd4\u3059","-","-","-import sys","-","-input = sys.stdin.readline","-s = tuple(eval(input()) for _ in range(H))","-uf_r = UnionFind(H * W)","-for r in range(H - 1):","+s = [eval(input()) for _ in range(H)]","+L = [[-1] * W for _ in range(H)]","+R = [[-1] * W for _ in range(H)]","+D = [[-1] * W for _ in range(H)]","+U = [[-1] * W for _ in range(H)]","+for r in range(H):","- if s[r][c] == \".\" and s[r + 1][c] == \".\":","- uf_r.unite(r * W + c, (r + 1) * W + c)","-uf_c = UnionFind(H * W)","-for c in range(W - 1):","- for r in range(H):","- if s[r][c] == \".\" and s[r][c + 1] == \".\":","- uf_c.unite(r * W + c, r * W + (c + 1))","+ if s[r][c] == \".\":","+ if c == 0:","+ L[r][c] = 1","+ else:","+ L[r][c] = L[r][c - 1] + 1","+ else:","+ L[r][c] = 0","+for r in range(H):","+ for c in reversed(list(range(W))):","+ if s[r][c] == \".\":","+ if c == W - 1:","+ R[r][c] = 1","+ else:","+ R[r][c] = R[r][c + 1] + 1","+ else:","+ R[r][c] = 0","+for r in range(H):","+ for c in range(W):","+ if s[r][c] == \".\":","+ if r == 0:","+ U[r][c] = 1","+ else:","+ U[r][c] = U[r - 1][c] + 1","+ else:","+ U[r][c] = 0","+for r in reversed(list(range(H))):","+ for c in range(W):","+ if s[r][c] == \".\":","+ if r == H - 1:","+ D[r][c] = 1","+ else:","+ D[r][c] = D[r + 1][c] + 1","+ else:","+ D[r][c] = 0","- if s[r][c] == \"#\":","- continue","- t = uf_r.size(r * W + c) + uf_c.size(r * W + c) - 1","- ans = max(ans, t)","+ ans = max(ans, L[r][c] + R[r][c] + D[r][c] + U[r][c] - 3)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0434213421,"measured_runtime_v1":0.0344901793,"runtime_lift":1.2589479963,"key":["s789681780","s744369283"]} +{"user_id":"u879870653","problem_id":"p03804","language":"python","submission_id_v0":"s789806214","submission_id_v1":"s763935196","cpu_time_v0":1890,"cpu_time_v1":227,"memory_v0":3188,"memory_v1":3192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.99,"input":"N,M = list(map(int,input().split()))\n\nA = [eval(input()) for i in range(N)]\n\nB = [eval(input()) for i in range(M)]\n\n\n\ndxy = []\n\nfor y in range(M) :\n\n for x in range(M) :\n\n dxy.append((x,y))\n\nflag = 0\n\nfor y in range(N) :\n\n for x in range(N) :\n\n if A[y][x] == B[0][0] and flag == 0 :\n\n counter = 0\n\n for dx,dy in dxy :\n\n nx = x+dx\n\n ny = y+dy\n\n if (0 <= nx <= N-1) and (0 <= ny <= N-1) and flag == 0 :\n\n if A[ny][nx] == B[dy][dx] :\n\n counter += 1\n\n if counter == M**2 :\n\n flag = 1\n\nif flag == 1 :\n\n print(\"Yes\")\n\nelse :\n\n print(\"No\")\n","target":"N,M = list(map(int,input().split()))\n\nA = [eval(input()) for i in range(N)]\n\nB = [eval(input()) for i in range(M)]\n\ndxy = []\n\nfor y in range(M) :\n\n for x in range(M) :\n\n dxy.append((x,y))\n\nflag = 0\n\nfor y in range(N) :\n\n for x in range(N) :\n\n if A[y][x] == B[0][0] and flag == 0 :\n\n counter = 0\n\n for dx,dy in dxy :\n\n if flag == 0 :\n\n nx = x+dx\n\n ny = y+dy\n\n if not (0 <= nx <= N-1) :\n\n break\n\n if not (0 <= ny <= N-1) :\n\n break\n\n if A[ny][nx] == B[dy][dx] :\n\n counter += 1\n\n if counter == M**2 :\n\n flag = 1\n\nif flag == 1 :\n\n print(\"Yes\")\n\nelse :\n\n print(\"No\")\n","code_v0_loc":25,"code_v1_loc":28,"code_v0_num_chars":684,"code_v1_num_chars":796,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nA = [eval(input()) for i in range(N)]\nB = [eval(input()) for i in range(M)]\ndxy = []\nfor y in range(M):\n for x in range(M):\n dxy.append((x, y))\nflag = 0\nfor y in range(N):\n for x in range(N):\n if A[y][x] == B[0][0] and flag == 0:\n counter = 0\n for dx, dy in dxy:\n nx = x + dx\n ny = y + dy\n if (0 <= nx <= N - 1) and (0 <= ny <= N - 1) and flag == 0:\n if A[ny][nx] == B[dy][dx]:\n counter += 1\n if counter == M**2:\n flag = 1\nif flag == 1:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nA = [eval(input()) for i in range(N)]\nB = [eval(input()) for i in range(M)]\ndxy = []\nfor y in range(M):\n for x in range(M):\n dxy.append((x, y))\nflag = 0\nfor y in range(N):\n for x in range(N):\n if A[y][x] == B[0][0] and flag == 0:\n counter = 0\n for dx, dy in dxy:\n if flag == 0:\n nx = x + dx\n ny = y + dy\n if not (0 <= nx <= N - 1):\n break\n if not (0 <= ny <= N - 1):\n break\n if A[ny][nx] == B[dy][dx]:\n counter += 1\n if counter == M**2:\n flag = 1\nif flag == 1:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":10.7142857143,"diff":["- nx = x + dx","- ny = y + dy","- if (0 <= nx <= N - 1) and (0 <= ny <= N - 1) and flag == 0:","+ if flag == 0:","+ nx = x + dx","+ ny = y + dy","+ if not (0 <= nx <= N - 1):","+ break","+ if not (0 <= ny <= N - 1):","+ break","- if counter == M**2:","- flag = 1","+ if counter == M**2:","+ flag = 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0848252156,"measured_runtime_v1":0.0863370247,"runtime_lift":0.9824894461,"key":["s789806214","s763935196"]} +{"user_id":"u416758623","problem_id":"p03478","language":"python","submission_id_v0":"s315035368","submission_id_v1":"s949664100","cpu_time_v0":34,"cpu_time_v1":26,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.53,"input":"n,a,b = list(map(int, input().split()))\n\nans = 0\n\n\n\ndef sum(k):\n\n s = 0\n\n for j in range(len(k)):\n\n s+=int(k[j])\n\n return s\n\n\n\nfor i in range(1,n+1):\n\n if a<=sum(str(i))<=b:\n\n ans+=i\n\nprint(ans)\n","target":"def findSumDigit(num):\n\n global total\n\n total = 0\n\n while num > 0:\n\n total += num % 10\n\n num \/\/= 10\n\n return total\n\n\n\ndef main():\n\n n,a,b = list(map(int, input().split()))\n\n ans = 0\n\n for i in range(1,n+1):\n\n tmp = findSumDigit(i)\n\n if a <= tmp <= b:\n\n ans += i\n\n print(ans)\n\n \n\nif __name__ == '__main__':\n\n main()","code_v0_loc":13,"code_v1_loc":19,"code_v0_num_chars":199,"code_v1_num_chars":377,"code_v0_no_empty_lines":"n, a, b = list(map(int, input().split()))\nans = 0\n\n\ndef sum(k):\n s = 0\n for j in range(len(k)):\n s += int(k[j])\n return s\n\n\nfor i in range(1, n + 1):\n if a <= sum(str(i)) <= b:\n ans += i\nprint(ans)\n","code_v1_no_empty_lines":"def findSumDigit(num):\n global total\n total = 0\n while num > 0:\n total += num % 10\n num \/\/= 10\n return total\n\n\ndef main():\n n, a, b = list(map(int, input().split()))\n ans = 0\n for i in range(1, n + 1):\n tmp = findSumDigit(i)\n if a <= tmp <= b:\n ans += i\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":31.5789473684,"diff":["-n, a, b = list(map(int, input().split()))","-ans = 0","+def findSumDigit(num):","+ global total","+ total = 0","+ while num > 0:","+ total += num % 10","+ num \/\/= 10","+ return total","-def sum(k):","- s = 0","- for j in range(len(k)):","- s += int(k[j])","- return s","+def main():","+ n, a, b = list(map(int, input().split()))","+ ans = 0","+ for i in range(1, n + 1):","+ tmp = findSumDigit(i)","+ if a <= tmp <= b:","+ ans += i","+ print(ans)","-for i in range(1, n + 1):","- if a <= sum(str(i)) <= b:","- ans += i","-print(ans)","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0353833055,"measured_runtime_v1":0.0360624917,"runtime_lift":0.9811664118,"key":["s315035368","s949664100"]} +{"user_id":"u636683284","problem_id":"p03424","language":"python","submission_id_v0":"s112247957","submission_id_v1":"s566088708","cpu_time_v0":182,"cpu_time_v1":63,"memory_v0":38384,"memory_v1":61860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.38,"input":"N = int(eval(input()))\n\nl = list(map(str, input().split()))\n\ns = set(l)\n\nif len(s)==3:\n\n print('Three')\n\nelse:\n\n print('Four')","target":"n = int(eval(input()))\n\nl = list(input().split())\n\nif len(set(l)) == 4:\n\n print('Four')\n\nelse:\n\n print('Three')","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":122,"code_v1_num_chars":111,"code_v0_no_empty_lines":"N = int(eval(input()))\nl = list(map(str, input().split()))\ns = set(l)\nif len(s) == 3:\n print(\"Three\")\nelse:\n print(\"Four\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\nl = list(input().split())\nif len(set(l)) == 4:\n print(\"Four\")\nelse:\n print(\"Three\")\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-N = int(eval(input()))","-l = list(map(str, input().split()))","-s = set(l)","-if len(s) == 3:","+n = int(eval(input()))","+l = list(input().split())","+if len(set(l)) == 4:","+ print(\"Four\")","+else:","-else:","- print(\"Four\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0432878079,"measured_runtime_v1":0.0430229874,"runtime_lift":1.0061553272,"key":["s112247957","s566088708"]} +{"user_id":"u125090409","problem_id":"p02614","language":"python","submission_id_v0":"s040242485","submission_id_v1":"s114248760","cpu_time_v0":209,"cpu_time_v1":77,"memory_v0":27356,"memory_v1":9140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.16,"input":"import itertools\n\nimport numpy as np\n\n\n\nh, w, k = list(map(int, input().split()))\n\nc = [eval(input()) for _ in range(h)]\n\n\n\ncount = 0\n\nfor ph in itertools.product([0, 1], repeat=h):\n\n for pw in itertools.product([0, 1], repeat=w):\n\n squares = np.array([[1 if cell == '#' else -1 for cell in row] for row in c])\n\n squares[np.array(ph) == 1, :] *= 0\n\n squares[:, np.array(pw) == 1] *= 0\n\n count += np.count_nonzero(squares == 1) == k\n\n\n\nprint(count)\n","target":"h, w, k = list(map(int, input().split()))\n\nc = [eval(input()) for _ in range(h)]\n\n\n\ncount = 0\n\nfor binh in range(2**h):\n\n for binw in range(2**w):\n\n redh, redw = bin(binh)[2:].zfill(h), bin(binw)[2:].zfill(w) # remove suffix '0x'\n\n squares = [list(row) for row in c]\n\n for i, rh in enumerate(redh):\n\n for wh in range(w):\n\n if rh == '1':\n\n squares[i][wh] = '*'\n\n for j, rw in enumerate(redw):\n\n for hw in range(h):\n\n if rw == '1':\n\n squares[hw][j] = '*'\n\n count += sum(row.count('#') for row in squares) == k\n\n\n\nprint(count)\n","code_v0_loc":15,"code_v1_loc":19,"code_v0_num_chars":467,"code_v1_num_chars":641,"code_v0_no_empty_lines":"import itertools\nimport numpy as np\n\nh, w, k = list(map(int, input().split()))\nc = [eval(input()) for _ in range(h)]\ncount = 0\nfor ph in itertools.product([0, 1], repeat=h):\n for pw in itertools.product([0, 1], repeat=w):\n squares = np.array([[1 if cell == \"#\" else -1 for cell in row] for row in c])\n squares[np.array(ph) == 1, :] *= 0\n squares[:, np.array(pw) == 1] *= 0\n count += np.count_nonzero(squares == 1) == k\nprint(count)\n","code_v1_no_empty_lines":"h, w, k = list(map(int, input().split()))\nc = [eval(input()) for _ in range(h)]\ncount = 0\nfor binh in range(2**h):\n for binw in range(2**w):\n redh, redw = bin(binh)[2:].zfill(h), bin(binw)[2:].zfill(\n w\n ) # remove suffix '0x'\n squares = [list(row) for row in c]\n for i, rh in enumerate(redh):\n for wh in range(w):\n if rh == \"1\":\n squares[i][wh] = \"*\"\n for j, rw in enumerate(redw):\n for hw in range(h):\n if rw == \"1\":\n squares[hw][j] = \"*\"\n count += sum(row.count(\"#\") for row in squares) == k\nprint(count)\n","code_same":false,"relative_loc_diff_percent":21.0526315789,"diff":["-import itertools","-import numpy as np","-","-for ph in itertools.product([0, 1], repeat=h):","- for pw in itertools.product([0, 1], repeat=w):","- squares = np.array([[1 if cell == \"#\" else -1 for cell in row] for row in c])","- squares[np.array(ph) == 1, :] *= 0","- squares[:, np.array(pw) == 1] *= 0","- count += np.count_nonzero(squares == 1) == k","+for binh in range(2**h):","+ for binw in range(2**w):","+ redh, redw = bin(binh)[2:].zfill(h), bin(binw)[2:].zfill(","+ w","+ ) # remove suffix '0x'","+ squares = [list(row) for row in c]","+ for i, rh in enumerate(redh):","+ for wh in range(w):","+ if rh == \"1\":","+ squares[i][wh] = \"*\"","+ for j, rw in enumerate(redw):","+ for hw in range(h):","+ if rw == \"1\":","+ squares[hw][j] = \"*\"","+ count += sum(row.count(\"#\") for row in squares) == k"],"diff_only_import_comment":false,"measured_runtime_v0":0.508912929,"measured_runtime_v1":0.0518875122,"runtime_lift":9.8080040309,"key":["s040242485","s114248760"]} +{"user_id":"u652583512","problem_id":"p02947","language":"python","submission_id_v0":"s499546285","submission_id_v1":"s254857719","cpu_time_v0":862,"cpu_time_v1":608,"memory_v0":76248,"memory_v1":67032,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.47,"input":"def f(array):\n\n temp = 'abcdefghijklmnopqrstuvwxyz'\n\n res = [0] * len(temp)\n\n cnt = 0\n\n for x in array:\n\n res[temp.index(x)] += 1\n\n cnt += 1\n\n if cnt == 10:\n\n break\n\n return ''.join([str(i) for i in res])\n\n\n\nN = int(eval(input()))\n\ns = [''.join(f(eval(input()))) for i in range(N)]\n\n\n\ndic = {}\n\nfor i in range(N):\n\n if s[i] in dic:\n\n dic[s[i]] += 1\n\n else:\n\n dic[s[i]] = 1\n\n\n\ncnt = 0\n\nfor v in list(dic.values()):\n\n cnt += v * (v - 1) \/\/ 2\n\n\n\nprint(cnt)\n\n\n\n\n\n\n","target":"N = int(eval(input()))\n\ns = [''.join(sorted(eval(input()))) for i in range(N)]\n\n\n\ndic = {}\n\ncnt = 0\n\nfor i in range(N):\n\n if s[i] in dic:\n\n cnt += dic[s[i]]\n\n dic[s[i]] += 1\n\n else:\n\n dic[s[i]] = 1\n\nprint(cnt)\n\n\n\n\n\n\n","code_v0_loc":29,"code_v1_loc":15,"code_v0_num_chars":512,"code_v1_num_chars":231,"code_v0_no_empty_lines":"def f(array):\n temp = \"abcdefghijklmnopqrstuvwxyz\"\n res = [0] * len(temp)\n cnt = 0\n for x in array:\n res[temp.index(x)] += 1\n cnt += 1\n if cnt == 10:\n break\n return \"\".join([str(i) for i in res])\n\n\nN = int(eval(input()))\ns = [\"\".join(f(eval(input()))) for i in range(N)]\ndic = {}\nfor i in range(N):\n if s[i] in dic:\n dic[s[i]] += 1\n else:\n dic[s[i]] = 1\ncnt = 0\nfor v in list(dic.values()):\n cnt += v * (v - 1) \/\/ 2\nprint(cnt)\n","code_v1_no_empty_lines":"N = int(eval(input()))\ns = [\"\".join(sorted(eval(input()))) for i in range(N)]\ndic = {}\ncnt = 0\nfor i in range(N):\n if s[i] in dic:\n cnt += dic[s[i]]\n dic[s[i]] += 1\n else:\n dic[s[i]] = 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":48.275862069,"diff":["-def f(array):","- temp = \"abcdefghijklmnopqrstuvwxyz\"","- res = [0] * len(temp)","- cnt = 0","- for x in array:","- res[temp.index(x)] += 1","- cnt += 1","- if cnt == 10:","- break","- return \"\".join([str(i) for i in res])","-","-","-s = [\"\".join(f(eval(input()))) for i in range(N)]","+s = [\"\".join(sorted(eval(input()))) for i in range(N)]","+cnt = 0","+ cnt += dic[s[i]]","-cnt = 0","-for v in list(dic.values()):","- cnt += v * (v - 1) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0453436821,"measured_runtime_v1":0.0432503953,"runtime_lift":1.0483992511,"key":["s499546285","s254857719"]} +{"user_id":"u225388820","problem_id":"p03476","language":"python","submission_id_v0":"s167828792","submission_id_v1":"s408641404","cpu_time_v0":304,"cpu_time_v1":150,"memory_v0":6108,"memory_v1":77260,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.66,"input":"'''\n\n\u3000 \u2227_,,\u2227 \u7a76\u6975\u5965\u7fa9\u300cWA\u304cAC\u306b\u306a\u30fc\u308c\uff01\uff01\u300d\n\n\u3000\uff08`\u30fb\u03c9\u30fb)\u3064\u2501\u2606\u30fb*\u3002\n\n\u3000\u2282\u3000\u3000 \u30ce \u3000\u3000\u3000\u30fb\u309c+.\n\n\u3000 \u3057\u2019\u00b4\uff2a\u3000\u3000*\u30fb \n\n'''\n\nimport sys\n\ninput = sys.stdin.readline\n\ndef sieve(n):\n\n is_prime = [True for _ in range(n+1)]\n\n is_prime[0] = False\n\n\n\n for i in range(2, n+1):\n\n if is_prime[i-1]:\n\n j = 2 * i\n\n while j <= n:\n\n is_prime[j-1] = False\n\n j += i\n\n #table = [ i for i in range(1, n+1) if is_prime[i-1]]\n\n return is_prime\n\nn=10**5+2\n\na=sieve(n)\n\nans=[0]*(n\/\/2)\n\nfor i in range(0,n,2):\n\n if a[i] and a[i\/\/2]:\n\n ans[i\/\/2]=1\n\n#print(ans[:20])\n\nfor i in range(1,n\/\/2):\n\n ans[i]+=ans[i-1]\n\n#print(ans[:20])\n\nq=int(eval(input()))\n\nfor i in range(q):\n\n l,r=list(map(int,input().split()))\n\n if l==1:\n\n l=2\n\n if r==1:\n\n r=2\n\n print((ans[r\/\/2]-ans[l\/\/2 -1]))","target":"import sys\n\ninput = sys.stdin.readline\n\nfrom math import sqrt\n\n\n\n\n\ndef Eratosthenes(n):\n\n \"\"\"n(>=6)\u672a\u6e80\u306e\u7d20\u6570\u5217\u6319 \"\"\"\n\n n, correction = n - n % 6 + 6, 2 - (n % 6 > 1)\n\n sieve = [True] * (n \/\/ 3)\n\n for i in range(1, int(sqrt(n)) \/\/ 3 + 1):\n\n if sieve[i]:\n\n k = 3 * i + 1 | 1\n\n sieve[k * k \/\/ 3::2 * k] = [False] * ((n \/\/ 6 - k * k \/\/ 6 - 1) \/\/ k + 1)\n\n sieve[k * (k - 2 * (i & 1) + 4) \/\/ 3::2 * k] = [False] * ((n \/\/ 6 - k * (k - 2 * (i & 1) + 4) \/\/ 6 - 1) \/\/ k + 1)\n\n # return [2, 3] + [3 * i + 1 | 1 for i in range(1, n \/\/ 3 - correction) if sieve[i]]\n\n # x \u304c\u7d20\u6570\u304b\u5224\u5b9a\u3057\u305f\u3044\u3068\u304d\n\n return {2, 3}.union({3 * i + 1 | 1 for i in range(1, n \/\/ 3 - correction) if sieve[i]})\n\n\n\n\n\nsieve = Eratosthenes(10 ** 5 + 1)\n\nans = [0] * (10 ** 5 + 1)\n\nfor i in range(3, 10 ** 5, 2):\n\n if i in sieve and (i + 1) \/\/ 2 in sieve:\n\n ans[i] += 1\n\nfor i in range(3, 10 ** 5):\n\n ans[i + 1] += ans[i]\n\nq = int(eval(input()))\n\nfor i in range(q):\n\n l, r = list(map(int, input().split()))\n\n print((ans[r] - ans[l - 1]))\n","code_v0_loc":38,"code_v1_loc":30,"code_v0_num_chars":808,"code_v1_num_chars":1043,"code_v0_no_empty_lines":"\"\"\"\n\u3000 \u2227_,,\u2227 \u7a76\u6975\u5965\u7fa9\u300cWA\u304cAC\u306b\u306a\u30fc\u308c\uff01\uff01\u300d\n\u3000\uff08`\u30fb\u03c9\u30fb)\u3064\u2501\u2606\u30fb*\u3002\n\u3000\u2282\u3000\u3000 \u30ce \u3000\u3000\u3000\u30fb\u309c+.\n\u3000 \u3057\u2019\u00b4\uff2a\u3000\u3000*\u30fb \n\"\"\"\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef sieve(n):\n is_prime = [True for _ in range(n + 1)]\n is_prime[0] = False\n for i in range(2, n + 1):\n if is_prime[i - 1]:\n j = 2 * i\n while j <= n:\n is_prime[j - 1] = False\n j += i\n # table = [ i for i in range(1, n+1) if is_prime[i-1]]\n return is_prime\n\n\nn = 10**5 + 2\na = sieve(n)\nans = [0] * (n \/\/ 2)\nfor i in range(0, n, 2):\n if a[i] and a[i \/\/ 2]:\n ans[i \/\/ 2] = 1\n# print(ans[:20])\nfor i in range(1, n \/\/ 2):\n ans[i] += ans[i - 1]\n# print(ans[:20])\nq = int(eval(input()))\nfor i in range(q):\n l, r = list(map(int, input().split()))\n if l == 1:\n l = 2\n if r == 1:\n r = 2\n print((ans[r \/\/ 2] - ans[l \/\/ 2 - 1]))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom math import sqrt\n\n\ndef Eratosthenes(n):\n \"\"\"n(>=6)\u672a\u6e80\u306e\u7d20\u6570\u5217\u6319\"\"\"\n n, correction = n - n % 6 + 6, 2 - (n % 6 > 1)\n sieve = [True] * (n \/\/ 3)\n for i in range(1, int(sqrt(n)) \/\/ 3 + 1):\n if sieve[i]:\n k = 3 * i + 1 | 1\n sieve[k * k \/\/ 3 :: 2 * k] = [False] * ((n \/\/ 6 - k * k \/\/ 6 - 1) \/\/ k + 1)\n sieve[k * (k - 2 * (i & 1) + 4) \/\/ 3 :: 2 * k] = [False] * (\n (n \/\/ 6 - k * (k - 2 * (i & 1) + 4) \/\/ 6 - 1) \/\/ k + 1\n )\n # return [2, 3] + [3 * i + 1 | 1 for i in range(1, n \/\/ 3 - correction) if sieve[i]]\n # x \u304c\u7d20\u6570\u304b\u5224\u5b9a\u3057\u305f\u3044\u3068\u304d\n return {2, 3}.union(\n {3 * i + 1 | 1 for i in range(1, n \/\/ 3 - correction) if sieve[i]}\n )\n\n\nsieve = Eratosthenes(10**5 + 1)\nans = [0] * (10**5 + 1)\nfor i in range(3, 10**5, 2):\n if i in sieve and (i + 1) \/\/ 2 in sieve:\n ans[i] += 1\nfor i in range(3, 10**5):\n ans[i + 1] += ans[i]\nq = int(eval(input()))\nfor i in range(q):\n l, r = list(map(int, input().split()))\n print((ans[r] - ans[l - 1]))\n","code_same":false,"relative_loc_diff_percent":21.0526315789,"diff":["-\"\"\"","-\u3000 \u2227_,,\u2227 \u7a76\u6975\u5965\u7fa9\u300cWA\u304cAC\u306b\u306a\u30fc\u308c\uff01\uff01\u300d","-\u3000\uff08`\u30fb\u03c9\u30fb)\u3064\u2501\u2606\u30fb*\u3002","-\u3000\u2282\u3000\u3000 \u30ce \u3000\u3000\u3000\u30fb\u309c+.","-\u3000 \u3057\u2019\u00b4\uff2a\u3000\u3000*\u30fb","-\"\"\"","+from math import sqrt","-def sieve(n):","- is_prime = [True for _ in range(n + 1)]","- is_prime[0] = False","- for i in range(2, n + 1):","- if is_prime[i - 1]:","- j = 2 * i","- while j <= n:","- is_prime[j - 1] = False","- j += i","- # table = [ i for i in range(1, n+1) if is_prime[i-1]]","- return is_prime","+def Eratosthenes(n):","+ \"\"\"n(>=6)\u672a\u6e80\u306e\u7d20\u6570\u5217\u6319\"\"\"","+ n, correction = n - n % 6 + 6, 2 - (n % 6 > 1)","+ sieve = [True] * (n \/\/ 3)","+ for i in range(1, int(sqrt(n)) \/\/ 3 + 1):","+ if sieve[i]:","+ k = 3 * i + 1 | 1","+ sieve[k * k \/\/ 3 :: 2 * k] = [False] * ((n \/\/ 6 - k * k \/\/ 6 - 1) \/\/ k + 1)","+ sieve[k * (k - 2 * (i & 1) + 4) \/\/ 3 :: 2 * k] = [False] * (","+ (n \/\/ 6 - k * (k - 2 * (i & 1) + 4) \/\/ 6 - 1) \/\/ k + 1","+ )","+ # return [2, 3] + [3 * i + 1 | 1 for i in range(1, n \/\/ 3 - correction) if sieve[i]]","+ # x \u304c\u7d20\u6570\u304b\u5224\u5b9a\u3057\u305f\u3044\u3068\u304d","+ return {2, 3}.union(","+ {3 * i + 1 | 1 for i in range(1, n \/\/ 3 - correction) if sieve[i]}","+ )","-n = 10**5 + 2","-a = sieve(n)","-ans = [0] * (n \/\/ 2)","-for i in range(0, n, 2):","- if a[i] and a[i \/\/ 2]:","- ans[i \/\/ 2] = 1","-# print(ans[:20])","-for i in range(1, n \/\/ 2):","- ans[i] += ans[i - 1]","-# print(ans[:20])","+sieve = Eratosthenes(10**5 + 1)","+ans = [0] * (10**5 + 1)","+for i in range(3, 10**5, 2):","+ if i in sieve and (i + 1) \/\/ 2 in sieve:","+ ans[i] += 1","+for i in range(3, 10**5):","+ ans[i + 1] += ans[i]","- if l == 1:","- l = 2","- if r == 1:","- r = 2","- print((ans[r \/\/ 2] - ans[l \/\/ 2 - 1]))","+ print((ans[r] - ans[l - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3351635175,"measured_runtime_v1":0.0833793321,"runtime_lift":4.019743372,"key":["s167828792","s408641404"]} +{"user_id":"u648117624","problem_id":"p02400","language":"python","submission_id_v0":"s034229190","submission_id_v1":"s297982708","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":5620,"memory_v1":5628,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"from math import pi\n\n\n\nr = float(eval(input()))\n\n\n\ns = pi * r * r\n\n\n\np = 2 * pi * r\n\n\n\nprint((s,p))\n\n\n","target":"from math import pi\n\n\n\nr = float(eval(input()))\n\n\n\ns = pi * (r ** 2)\n\n\n\np = 2 * pi * r\n\n\n\nprint((s,p))\n\n\n","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":94,"code_v1_num_chars":97,"code_v0_no_empty_lines":"from math import pi\n\nr = float(eval(input()))\ns = pi * r * r\np = 2 * pi * r\nprint((s, p))\n","code_v1_no_empty_lines":"from math import pi\n\nr = float(eval(input()))\ns = pi * (r**2)\np = 2 * pi * r\nprint((s, p))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-s = pi * r * r","+s = pi * (r**2)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0774361963,"measured_runtime_v1":0.065102802,"runtime_lift":1.189444907,"key":["s034229190","s297982708"]} +{"user_id":"u141610915","problem_id":"p02889","language":"python","submission_id_v0":"s662225230","submission_id_v1":"s669723659","cpu_time_v0":1401,"cpu_time_v1":678,"memory_v0":73436,"memory_v1":78852,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.61,"input":"import sys\n\ninput = sys.stdin.buffer.readline\n\nN, M, L = list(map(int, input().split()))\n\nd = [[float(\"inf\")] * (N + 1) for _ in range(N + 1)]\n\nfor _ in range(M):\n\n u, v, c = list(map(int, input().split()))\n\n d[u][v] = c\n\n d[v][u] = c\n\nQ = int(eval(input()))\n\nfor k in range(1, N + 1):\n\n for i in range(1, N + 1):\n\n for j in range(1, N + 1):\n\n if d[i][j] > d[i][k] + d[k][j]:\n\n d[i][j] = d[i][k] + d[k][j]\n\n\n\nnd = [[float(\"inf\")] * (N + 1) for _ in range(N + 1)]\n\n\n\nfor i in range(1, N + 1):\n\n for j in range(1, N + 1):\n\n if d[i][j] <= L:\n\n nd[i][j] = 1\n\nfor k in range(1, N + 1):\n\n for i in range(1, N + 1):\n\n for j in range(1, N + 1):\n\n if nd[i][j] > nd[i][k] + nd[k][j]:\n\n nd[i][j] = nd[i][k] + nd[k][j]\n\n\n\nfor _ in range(Q):\n\n s, t = list(map(int, input().split()))\n\n if nd[s][t] == float(\"inf\"):\n\n print((-1))\n\n else:\n\n print((nd[s][t] - 1))","target":"import sys\n\ninput = sys.stdin.readline\n\nN, M, L = list(map(int, input().split()))\n\nd = [[10 ** 16 * (i != j) for j in range(N + 1)] for i in range(N + 1)]\n\nfor _ in range(M):\n\n x, y, c = list(map(int, input().split()))\n\n d[x][y] = c\n\n d[y][x] = c\n\nfor k in range(N + 1):\n\n for i in range(N + 1):\n\n for j in range(N + 1): d[i][j] = min(d[i][j], d[i][k] + d[k][j])\n\n\n\ndd = [[(d[i][j] <= L) + (d[i][j] > L) * 10 ** 16 for j in range(N + 1)] for i in range(N + 1)]\n\nfor k in range(N + 1):\n\n for i in range(N + 1):\n\n for j in range(N + 1): dd[i][j] = min(dd[i][j], dd[i][k] + dd[k][j])\n\n\n\nfor _ in range(int(eval(input()))):\n\n s, t = list(map(int, input().split()))\n\n if dd[s][t] != 10 ** 16: print((dd[s][t] - 1))\n\n else: print((-1))","code_v0_loc":33,"code_v1_loc":21,"code_v0_num_chars":871,"code_v1_num_chars":715,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nN, M, L = list(map(int, input().split()))\nd = [[float(\"inf\")] * (N + 1) for _ in range(N + 1)]\nfor _ in range(M):\n u, v, c = list(map(int, input().split()))\n d[u][v] = c\n d[v][u] = c\nQ = int(eval(input()))\nfor k in range(1, N + 1):\n for i in range(1, N + 1):\n for j in range(1, N + 1):\n if d[i][j] > d[i][k] + d[k][j]:\n d[i][j] = d[i][k] + d[k][j]\nnd = [[float(\"inf\")] * (N + 1) for _ in range(N + 1)]\nfor i in range(1, N + 1):\n for j in range(1, N + 1):\n if d[i][j] <= L:\n nd[i][j] = 1\nfor k in range(1, N + 1):\n for i in range(1, N + 1):\n for j in range(1, N + 1):\n if nd[i][j] > nd[i][k] + nd[k][j]:\n nd[i][j] = nd[i][k] + nd[k][j]\nfor _ in range(Q):\n s, t = list(map(int, input().split()))\n if nd[s][t] == float(\"inf\"):\n print((-1))\n else:\n print((nd[s][t] - 1))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, M, L = list(map(int, input().split()))\nd = [[10**16 * (i != j) for j in range(N + 1)] for i in range(N + 1)]\nfor _ in range(M):\n x, y, c = list(map(int, input().split()))\n d[x][y] = c\n d[y][x] = c\nfor k in range(N + 1):\n for i in range(N + 1):\n for j in range(N + 1):\n d[i][j] = min(d[i][j], d[i][k] + d[k][j])\ndd = [\n [(d[i][j] <= L) + (d[i][j] > L) * 10**16 for j in range(N + 1)]\n for i in range(N + 1)\n]\nfor k in range(N + 1):\n for i in range(N + 1):\n for j in range(N + 1):\n dd[i][j] = min(dd[i][j], dd[i][k] + dd[k][j])\nfor _ in range(int(eval(input()))):\n s, t = list(map(int, input().split()))\n if dd[s][t] != 10**16:\n print((dd[s][t] - 1))\n else:\n print((-1))\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-input = sys.stdin.buffer.readline","+input = sys.stdin.readline","-d = [[float(\"inf\")] * (N + 1) for _ in range(N + 1)]","+d = [[10**16 * (i != j) for j in range(N + 1)] for i in range(N + 1)]","- u, v, c = list(map(int, input().split()))","- d[u][v] = c","- d[v][u] = c","-Q = int(eval(input()))","-for k in range(1, N + 1):","- for i in range(1, N + 1):","- for j in range(1, N + 1):","- if d[i][j] > d[i][k] + d[k][j]:","- d[i][j] = d[i][k] + d[k][j]","-nd = [[float(\"inf\")] * (N + 1) for _ in range(N + 1)]","-for i in range(1, N + 1):","- for j in range(1, N + 1):","- if d[i][j] <= L:","- nd[i][j] = 1","-for k in range(1, N + 1):","- for i in range(1, N + 1):","- for j in range(1, N + 1):","- if nd[i][j] > nd[i][k] + nd[k][j]:","- nd[i][j] = nd[i][k] + nd[k][j]","-for _ in range(Q):","+ x, y, c = list(map(int, input().split()))","+ d[x][y] = c","+ d[y][x] = c","+for k in range(N + 1):","+ for i in range(N + 1):","+ for j in range(N + 1):","+ d[i][j] = min(d[i][j], d[i][k] + d[k][j])","+dd = [","+ [(d[i][j] <= L) + (d[i][j] > L) * 10**16 for j in range(N + 1)]","+ for i in range(N + 1)","+]","+for k in range(N + 1):","+ for i in range(N + 1):","+ for j in range(N + 1):","+ dd[i][j] = min(dd[i][j], dd[i][k] + dd[k][j])","+for _ in range(int(eval(input()))):","- if nd[s][t] == float(\"inf\"):","+ if dd[s][t] != 10**16:","+ print((dd[s][t] - 1))","+ else:","- else:","- print((nd[s][t] - 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0458684649,"measured_runtime_v1":0.0404031224,"runtime_lift":1.1352703005,"key":["s662225230","s669723659"]} +{"user_id":"u116766943","problem_id":"p00001","language":"python","submission_id_v0":"s811725812","submission_id_v1":"s615088453","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4204,"memory_v1":6424,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"lis = []\n\nfor i in range(10):\n\n lis.append(eval(input()))\n\nfor a in sorted(lis,reverse=True)[:3]:\n\n print(a)","target":"\n\ndef main():\n\n arr = []\n\n for i in range(0,10):\n\n arr.append(eval(input())) \n\n arr.sort()\n\n arr.reverse()\n\n for i in range(0,3):\n\n print(arr[i])\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":5,"code_v1_loc":12,"code_v0_num_chars":102,"code_v1_num_chars":208,"code_v0_no_empty_lines":"lis = []\nfor i in range(10):\n lis.append(eval(input()))\nfor a in sorted(lis, reverse=True)[:3]:\n print(a)\n","code_v1_no_empty_lines":"def main():\n arr = []\n for i in range(0, 10):\n arr.append(eval(input()))\n arr.sort()\n arr.reverse()\n for i in range(0, 3):\n print(arr[i])\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":58.3333333333,"diff":["-lis = []","-for i in range(10):","- lis.append(eval(input()))","-for a in sorted(lis, reverse=True)[:3]:","- print(a)","+def main():","+ arr = []","+ for i in range(0, 10):","+ arr.append(eval(input()))","+ arr.sort()","+ arr.reverse()","+ for i in range(0, 3):","+ print(arr[i])","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0540741158,"measured_runtime_v1":0.0536879286,"runtime_lift":1.0071931839,"key":["s811725812","s615088453"]} +{"user_id":"u293359059","problem_id":"p03352","language":"python","submission_id_v0":"s564076066","submission_id_v1":"s646332268","cpu_time_v0":27,"cpu_time_v1":18,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"X = int(eval(input()))\n\nans = 1\n\nt = min(X, 100)\n\nfor b in range(1, t):\n\n for p in range(1, t):\n\n if b**p > ans and b**p <= X:\n\n ans = b**p\n\nprint(ans)\n","target":"X = int(eval(input()))\n\nans = 1\n\nfor b in range(1, X+1):\n\n for p in range(2, X+1):\n\n if b**p > X:\n\n break\n\n if b**p > ans and b**p <= X:\n\n ans = b**p\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":9,"code_v0_num_chars":167,"code_v1_num_chars":194,"code_v0_no_empty_lines":"X = int(eval(input()))\nans = 1\nt = min(X, 100)\nfor b in range(1, t):\n for p in range(1, t):\n if b**p > ans and b**p <= X:\n ans = b**p\nprint(ans)\n","code_v1_no_empty_lines":"X = int(eval(input()))\nans = 1\nfor b in range(1, X + 1):\n for p in range(2, X + 1):\n if b**p > X:\n break\n if b**p > ans and b**p <= X:\n ans = b**p\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-t = min(X, 100)","-for b in range(1, t):","- for p in range(1, t):","+for b in range(1, X + 1):","+ for p in range(2, X + 1):","+ if b**p > X:","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.0489239874,"measured_runtime_v1":0.0419674561,"runtime_lift":1.165760137,"key":["s564076066","s646332268"]} +{"user_id":"u046187684","problem_id":"p02861","language":"python","submission_id_v0":"s108169234","submission_id_v1":"s329779315","cpu_time_v0":403,"cpu_time_v1":20,"memory_v0":3572,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.04,"input":"from itertools import permutations\n\nfrom functools import reduce\n\nfrom operator import mul\n\n\n\n\n\ndef solve(string):\n\n n, *xy = list(map(int, string.split()))\n\n *xy, = list(zip(*[iter(xy)] * 2))\n\n return str(\n\n sum(\n\n sum(((xy[p0][0] - xy[p1][0])**2 + (xy[p0][1] - xy[p1][1])**2)**0.5\n\n for p0, p1 in zip(list(i),\n\n list(i)[1:]))\n\n for i in permutations(list(range(n)), n)) \/ reduce(mul, list(range(1, n + 1))))\n\n\n\n\n\nif __name__ == '__main__':\n\n n = int(eval(input()))\n\n print((solve('{}\\n'.format(n)+'\\n'.join([eval(input()) for _ in range(n)]))))\n","target":"from itertools import product\n\n\n\n\n\ndef solve(string):\n\n n, *xy = list(map(int, string.split()))\n\n *xy, = list(zip(*[iter(xy)] * 2))\n\n return str(\n\n sum(((xy[i][0] - xy[j][0])**2 + (xy[i][1] - xy[j][1])**2)**0.5\n\n for i, j in product(list(range(n)), repeat=2)) \/ n)\n\n\n\n\n\nif __name__ == '__main__':\n\n n = int(eval(input()))\n\n print((solve('{}\\n'.format(n) + '\\n'.join([eval(input()) for _ in range(n)]))))\n","code_v0_loc":19,"code_v1_loc":14,"code_v0_num_chars":601,"code_v1_num_chars":405,"code_v0_no_empty_lines":"from itertools import permutations\nfrom functools import reduce\nfrom operator import mul\n\n\ndef solve(string):\n n, *xy = list(map(int, string.split()))\n (*xy,) = list(zip(*[iter(xy)] * 2))\n return str(\n sum(\n sum(\n ((xy[p0][0] - xy[p1][0]) ** 2 + (xy[p0][1] - xy[p1][1]) ** 2) ** 0.5\n for p0, p1 in zip(list(i), list(i)[1:])\n )\n for i in permutations(list(range(n)), n)\n )\n \/ reduce(mul, list(range(1, n + 1)))\n )\n\n\nif __name__ == \"__main__\":\n n = int(eval(input()))\n print((solve(\"{}\\n\".format(n) + \"\\n\".join([eval(input()) for _ in range(n)]))))\n","code_v1_no_empty_lines":"from itertools import product\n\n\ndef solve(string):\n n, *xy = list(map(int, string.split()))\n (*xy,) = list(zip(*[iter(xy)] * 2))\n return str(\n sum(\n ((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2) ** 0.5\n for i, j in product(list(range(n)), repeat=2)\n )\n \/ n\n )\n\n\nif __name__ == \"__main__\":\n n = int(eval(input()))\n print((solve(\"{}\\n\".format(n) + \"\\n\".join([eval(input()) for _ in range(n)]))))\n","code_same":false,"relative_loc_diff_percent":26.3157894737,"diff":["-from itertools import permutations","-from functools import reduce","-from operator import mul","+from itertools import product","- sum(","- ((xy[p0][0] - xy[p1][0]) ** 2 + (xy[p0][1] - xy[p1][1]) ** 2) ** 0.5","- for p0, p1 in zip(list(i), list(i)[1:])","- )","- for i in permutations(list(range(n)), n)","+ ((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2) ** 0.5","+ for i, j in product(list(range(n)), repeat=2)","- \/ reduce(mul, list(range(1, n + 1)))","+ \/ n"],"diff_only_import_comment":false,"measured_runtime_v0":0.039345026,"measured_runtime_v1":0.038105011,"runtime_lift":1.032542046,"key":["s108169234","s329779315"]} +{"user_id":"u871201743","problem_id":"p03160","language":"python","submission_id_v0":"s378366248","submission_id_v1":"s704563743","cpu_time_v0":136,"cpu_time_v1":115,"memory_v0":13980,"memory_v1":13928,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.44,"input":"N = int(eval(input()))\n\nH = [int(c) for c in input().split()]\n\n\n\nprv1 = prv2 = cur = 0\n\nfor i in range(1, N):\n\n j1 = abs(H[i] - H[i-1])\n\n cur = min(j1 + prv1, abs(H[i] - H[i-2]) + prv2) if i > 1 else j1\n\n prv2 = prv1\n\n prv1 = cur\n\n\n\nprint(cur)\n","target":"N = int(eval(input()))\n\nH = [int(c) for c in input().split()]\n\n\n\ncur = abs(H[1] - H[0])\n\nprv1 = cur\n\nprv2 = 0\n\nfor i in range(2, N):\n\n cur = min(abs(H[i] - H[i-1]) + prv1, abs(H[i] - H[i-2]) + prv2)\n\n prv2 = prv1\n\n prv1 = cur\n\n\n\nprint(cur)\n","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":250,"code_v1_num_chars":243,"code_v0_no_empty_lines":"N = int(eval(input()))\nH = [int(c) for c in input().split()]\nprv1 = prv2 = cur = 0\nfor i in range(1, N):\n j1 = abs(H[i] - H[i - 1])\n cur = min(j1 + prv1, abs(H[i] - H[i - 2]) + prv2) if i > 1 else j1\n prv2 = prv1\n prv1 = cur\nprint(cur)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nH = [int(c) for c in input().split()]\ncur = abs(H[1] - H[0])\nprv1 = cur\nprv2 = 0\nfor i in range(2, N):\n cur = min(abs(H[i] - H[i - 1]) + prv1, abs(H[i] - H[i - 2]) + prv2)\n prv2 = prv1\n prv1 = cur\nprint(cur)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-prv1 = prv2 = cur = 0","-for i in range(1, N):","- j1 = abs(H[i] - H[i - 1])","- cur = min(j1 + prv1, abs(H[i] - H[i - 2]) + prv2) if i > 1 else j1","+cur = abs(H[1] - H[0])","+prv1 = cur","+prv2 = 0","+for i in range(2, N):","+ cur = min(abs(H[i] - H[i - 1]) + prv1, abs(H[i] - H[i - 2]) + prv2)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0336267951,"measured_runtime_v1":0.049499716,"runtime_lift":0.6793330899,"key":["s378366248","s704563743"]} +{"user_id":"u380524497","problem_id":"p03682","language":"python","submission_id_v0":"s902732303","submission_id_v1":"s902545753","cpu_time_v0":1052,"cpu_time_v1":911,"memory_v0":86420,"memory_v1":55492,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.4,"input":"import sys\n\nfrom heapq import heappush, heappop\n\nbuf = sys.stdin.buffer\n\n\n\n\n\ndef main():\n\n n = int(buf.readline())\n\n XY = list(map(int, buf.read().split()))\n\n Xs = []\n\n Ys = []\n\n for i, (x, y) in enumerate(zip(XY, XY)):\n\n Xs.append((x-1, i))\n\n Ys.append((y-1, i))\n\n\n\n Xs.sort()\n\n Ys.sort()\n\n\n\n edges = [[] for _ in range(n)]\n\n for i, ((x, node), (nx, new_node)) in enumerate(zip(Xs[:-1], Xs[1:])):\n\n edges[node].append((nx-x, new_node))\n\n edges[new_node].append((nx-x, node))\n\n\n\n for i, ((y, node), (ny, new_node)) in enumerate(zip(Ys[:-1], Ys[1:])):\n\n edges[node].append((ny-y, new_node))\n\n edges[new_node].append((ny-y, node))\n\n\n\n seen = [False] * n\n\n dist = [float('INF')] * n\n\n todo = [(0, 0)]\n\n\n\n while todo:\n\n d, node = heappop(todo)\n\n if seen[node]:\n\n continue\n\n seen[node] = True\n\n dist[node] = d\n\n\n\n while edges[node]:\n\n edge = edges[node].pop()\n\n nd, to = edge\n\n if dist[to] <= nd:\n\n continue\n\n heappush(todo, (nd, to))\n\n\n\n print((sum(dist)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"import sys\n\nbuf = sys.stdin.buffer\n\n\n\n\n\nclass UnionFind:\n\n def __init__(self, num_of_node):\n\n self.roots = [-1] * num_of_node\n\n self.ranks = [1] * num_of_node\n\n self.groups = num_of_node\n\n\n\n def get_root(self, node):\n\n root = self.roots[node]\n\n if root == -1:\n\n return node\n\n\n\n else:\n\n root = self.get_root(root)\n\n self.roots[node] = root\n\n return root\n\n\n\n def is_same_group(self, node1, node2):\n\n return self.get_root(node1) == self.get_root(node2)\n\n\n\n def unite(self, node1, node2):\n\n self.groups -= 1\n\n root1, root2 = self.get_root(node1), self.get_root(node2)\n\n rank1, rank2 = self.ranks[root1], self.ranks[root2]\n\n if rank1 < rank2:\n\n root1, root2 = root2, root1\n\n\n\n self.roots[root2] = root1\n\n self.ranks[root2] += self.ranks[root1]\n\n\n\n\n\ndef main():\n\n n = int(buf.readline())\n\n XY = list(map(int, buf.read().split()))\n\n Xs = []\n\n Ys = []\n\n for i, (x, y) in enumerate(zip(XY, XY)):\n\n Xs.append((x-1, i))\n\n Ys.append((y-1, i))\n\n\n\n Xs.sort()\n\n Ys.sort()\n\n\n\n edges = []\n\n for i, ((x, node), (nx, new_node)) in enumerate(zip(Xs[:-1], Xs[1:])):\n\n edges.append((nx-x, node, new_node))\n\n\n\n for i, ((y, node), (ny, new_node)) in enumerate(zip(Ys[:-1], Ys[1:])):\n\n edges.append((ny-y, node, new_node))\n\n\n\n edges.sort(reverse=True)\n\n\n\n ans = 0\n\n uf = UnionFind(n)\n\n while uf.groups != 1:\n\n d, node1, node2 = edges.pop()\n\n if uf.is_same_group(node1, node2):\n\n continue\n\n uf.unite(node1, node2)\n\n ans += d\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":49,"code_v1_loc":69,"code_v0_num_chars":1181,"code_v1_num_chars":1721,"code_v0_no_empty_lines":"import sys\nfrom heapq import heappush, heappop\n\nbuf = sys.stdin.buffer\n\n\ndef main():\n n = int(buf.readline())\n XY = list(map(int, buf.read().split()))\n Xs = []\n Ys = []\n for i, (x, y) in enumerate(zip(XY, XY)):\n Xs.append((x - 1, i))\n Ys.append((y - 1, i))\n Xs.sort()\n Ys.sort()\n edges = [[] for _ in range(n)]\n for i, ((x, node), (nx, new_node)) in enumerate(zip(Xs[:-1], Xs[1:])):\n edges[node].append((nx - x, new_node))\n edges[new_node].append((nx - x, node))\n for i, ((y, node), (ny, new_node)) in enumerate(zip(Ys[:-1], Ys[1:])):\n edges[node].append((ny - y, new_node))\n edges[new_node].append((ny - y, node))\n seen = [False] * n\n dist = [float(\"INF\")] * n\n todo = [(0, 0)]\n while todo:\n d, node = heappop(todo)\n if seen[node]:\n continue\n seen[node] = True\n dist[node] = d\n while edges[node]:\n edge = edges[node].pop()\n nd, to = edge\n if dist[to] <= nd:\n continue\n heappush(todo, (nd, to))\n print((sum(dist)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nbuf = sys.stdin.buffer\n\n\nclass UnionFind:\n def __init__(self, num_of_node):\n self.roots = [-1] * num_of_node\n self.ranks = [1] * num_of_node\n self.groups = num_of_node\n\n def get_root(self, node):\n root = self.roots[node]\n if root == -1:\n return node\n else:\n root = self.get_root(root)\n self.roots[node] = root\n return root\n\n def is_same_group(self, node1, node2):\n return self.get_root(node1) == self.get_root(node2)\n\n def unite(self, node1, node2):\n self.groups -= 1\n root1, root2 = self.get_root(node1), self.get_root(node2)\n rank1, rank2 = self.ranks[root1], self.ranks[root2]\n if rank1 < rank2:\n root1, root2 = root2, root1\n self.roots[root2] = root1\n self.ranks[root2] += self.ranks[root1]\n\n\ndef main():\n n = int(buf.readline())\n XY = list(map(int, buf.read().split()))\n Xs = []\n Ys = []\n for i, (x, y) in enumerate(zip(XY, XY)):\n Xs.append((x - 1, i))\n Ys.append((y - 1, i))\n Xs.sort()\n Ys.sort()\n edges = []\n for i, ((x, node), (nx, new_node)) in enumerate(zip(Xs[:-1], Xs[1:])):\n edges.append((nx - x, node, new_node))\n for i, ((y, node), (ny, new_node)) in enumerate(zip(Ys[:-1], Ys[1:])):\n edges.append((ny - y, node, new_node))\n edges.sort(reverse=True)\n ans = 0\n uf = UnionFind(n)\n while uf.groups != 1:\n d, node1, node2 = edges.pop()\n if uf.is_same_group(node1, node2):\n continue\n uf.unite(node1, node2)\n ans += d\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":28.9855072464,"diff":["-from heapq import heappush, heappop","+","+","+class UnionFind:","+ def __init__(self, num_of_node):","+ self.roots = [-1] * num_of_node","+ self.ranks = [1] * num_of_node","+ self.groups = num_of_node","+","+ def get_root(self, node):","+ root = self.roots[node]","+ if root == -1:","+ return node","+ else:","+ root = self.get_root(root)","+ self.roots[node] = root","+ return root","+","+ def is_same_group(self, node1, node2):","+ return self.get_root(node1) == self.get_root(node2)","+","+ def unite(self, node1, node2):","+ self.groups -= 1","+ root1, root2 = self.get_root(node1), self.get_root(node2)","+ rank1, rank2 = self.ranks[root1], self.ranks[root2]","+ if rank1 < rank2:","+ root1, root2 = root2, root1","+ self.roots[root2] = root1","+ self.ranks[root2] += self.ranks[root1]","- edges = [[] for _ in range(n)]","+ edges = []","- edges[node].append((nx - x, new_node))","- edges[new_node].append((nx - x, node))","+ edges.append((nx - x, node, new_node))","- edges[node].append((ny - y, new_node))","- edges[new_node].append((ny - y, node))","- seen = [False] * n","- dist = [float(\"INF\")] * n","- todo = [(0, 0)]","- while todo:","- d, node = heappop(todo)","- if seen[node]:","+ edges.append((ny - y, node, new_node))","+ edges.sort(reverse=True)","+ ans = 0","+ uf = UnionFind(n)","+ while uf.groups != 1:","+ d, node1, node2 = edges.pop()","+ if uf.is_same_group(node1, node2):","- seen[node] = True","- dist[node] = d","- while edges[node]:","- edge = edges[node].pop()","- nd, to = edge","- if dist[to] <= nd:","- continue","- heappush(todo, (nd, to))","- print((sum(dist)))","+ uf.unite(node1, node2)","+ ans += d","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0365351677,"measured_runtime_v1":0.0462440968,"runtime_lift":0.7900504118,"key":["s902732303","s902545753"]} +{"user_id":"u970197315","problem_id":"p02781","language":"python","submission_id_v0":"s596491634","submission_id_v1":"s241376533","cpu_time_v0":201,"cpu_time_v1":20,"memory_v0":41072,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.05,"input":"N=int(eval(input()))\n\nK=int(eval(input()))\n\ns=str(N)\n\nN=len(s)\n\n\n\ndp=[[[0]*2 for j in range(K+1)] for i in range(N+1)]\n\ndp[0][0][0]=1\n\n\n\nfor i in range(N):\n\n for j in range(K+1):\n\n for k in range(2):\n\n cd=int(s[i])\n\n for nd in range(10):\n\n ni=i+1\n\n nj=j\n\n nk=k\n\n if nd!=0:nj+=1\n\n if nj>K:continue\n\n if k==0:\n\n if nd>cd:continue\n\n if nd0:\n\n dp[i+1][1][k+1]+=dp[i][0][k]*(ni-1) # i+1\u6841\u76ee\u304c0\u4ee5\u5916\n\n dp[i+1][1][k]+=dp[i][0][k] # i+1\u6841\u76ee\u304c0\u4ee5\u5916\n\n # i\u6841\u76ee\u307e\u3067N\u3068\u540c\u3058\u3067\u3001i+1\u6841\u76ee\u3082N\u3068\u540c\u3058\u6570\u306e\u6642\n\n if ni>0:\n\n dp[i+1][0][k+1]=dp[i][0][k] # i+1\u6841\u76ee\u304c0\u4ee5\u5916\n\n else:\n\n dp[i+1][0][k]=dp[i][0][k] # i+1\u6841\u76ee\u304c0\n\nprint((dp[N][0][K]+dp[N][1][K]))\n","code_v0_loc":23,"code_v1_loc":25,"code_v0_num_chars":569,"code_v1_num_chars":741,"code_v0_no_empty_lines":"N = int(eval(input()))\nK = int(eval(input()))\ns = str(N)\nN = len(s)\ndp = [[[0] * 2 for j in range(K + 1)] for i in range(N + 1)]\ndp[0][0][0] = 1\nfor i in range(N):\n for j in range(K + 1):\n for k in range(2):\n cd = int(s[i])\n for nd in range(10):\n ni = i + 1\n nj = j\n nk = k\n if nd != 0:\n nj += 1\n if nj > K:\n continue\n if k == 0:\n if nd > cd:\n continue\n if nd < cd:\n nk = 1\n dp[ni][nj][nk] += dp[i][j][k]\nprint((dp[N][K][0] + dp[N][K][1]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nK = int(eval(input()))\ns = str(N)\nN = len(s)\n# dp[i][smaller][k] :=i\u6841\u76ee\u307e\u3067\u30670\u4ee5\u5916\u306e\u6570\u3092\u4f7f\u7528\u3057\u305f\u306e\u304ck\u500b\u3067\u3042\u308b\u6570\u306e\u500b\u6570\u3002\n# smaller\u304c1\u306a\u3089N\u3088\u308a\u5c0f\u3055\u304f\u30010\u306a\u3089N\u3068\u7b49\u3057\u3044\u6570\u3067\u3042\u308b\u3068\u3059\u308b\u3002\ndp = [[[0] * (K + 2) for j in range(2)] for i in range(N + 1)]\ndp[0][0][0] = 1\nfor i in range(N):\n for k in range(K + 1):\n ni = int(s[i])\n # i\u6841\u76ee\u307e\u3067\u3067N\u3088\u308a\u5c0f\u3055\u3044\u306a\u3089i+1\u6841\u76ee\u306f\u4f55\u3067\u3082\u826f\u3044\n dp[i + 1][1][k + 1] += dp[i][1][k] * 9 # i+1\u6841\u76ee\u304c0\u4ee5\u5916\n dp[i + 1][1][k] += dp[i][1][k] # i+1\u6841\u76ee\u304c0\n # i\u6841\u76ee\u307e\u3067\u3067N\u3068\u540c\u3058\u3067\u3001i+1\u6841\u76ee\u306fN\u3088\u308a\u5c0f\u3055\u3044\u6642\n if ni > 0:\n dp[i + 1][1][k + 1] += dp[i][0][k] * (ni - 1) # i+1\u6841\u76ee\u304c0\u4ee5\u5916\n dp[i + 1][1][k] += dp[i][0][k] # i+1\u6841\u76ee\u304c0\u4ee5\u5916\n # i\u6841\u76ee\u307e\u3067N\u3068\u540c\u3058\u3067\u3001i+1\u6841\u76ee\u3082N\u3068\u540c\u3058\u6570\u306e\u6642\n if ni > 0:\n dp[i + 1][0][k + 1] = dp[i][0][k] # i+1\u6841\u76ee\u304c0\u4ee5\u5916\n else:\n dp[i + 1][0][k] = dp[i][0][k] # i+1\u6841\u76ee\u304c0\nprint((dp[N][0][K] + dp[N][1][K]))\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["-dp = [[[0] * 2 for j in range(K + 1)] for i in range(N + 1)]","+# dp[i][smaller][k] :=i\u6841\u76ee\u307e\u3067\u30670\u4ee5\u5916\u306e\u6570\u3092\u4f7f\u7528\u3057\u305f\u306e\u304ck\u500b\u3067\u3042\u308b\u6570\u306e\u500b\u6570\u3002","+# smaller\u304c1\u306a\u3089N\u3088\u308a\u5c0f\u3055\u304f\u30010\u306a\u3089N\u3068\u7b49\u3057\u3044\u6570\u3067\u3042\u308b\u3068\u3059\u308b\u3002","+dp = [[[0] * (K + 2) for j in range(2)] for i in range(N + 1)]","- for j in range(K + 1):","- for k in range(2):","- cd = int(s[i])","- for nd in range(10):","- ni = i + 1","- nj = j","- nk = k","- if nd != 0:","- nj += 1","- if nj > K:","- continue","- if k == 0:","- if nd > cd:","- continue","- if nd < cd:","- nk = 1","- dp[ni][nj][nk] += dp[i][j][k]","-print((dp[N][K][0] + dp[N][K][1]))","+ for k in range(K + 1):","+ ni = int(s[i])","+ # i\u6841\u76ee\u307e\u3067\u3067N\u3088\u308a\u5c0f\u3055\u3044\u306a\u3089i+1\u6841\u76ee\u306f\u4f55\u3067\u3082\u826f\u3044","+ dp[i + 1][1][k + 1] += dp[i][1][k] * 9 # i+1\u6841\u76ee\u304c0\u4ee5\u5916","+ dp[i + 1][1][k] += dp[i][1][k] # i+1\u6841\u76ee\u304c0","+ # i\u6841\u76ee\u307e\u3067\u3067N\u3068\u540c\u3058\u3067\u3001i+1\u6841\u76ee\u306fN\u3088\u308a\u5c0f\u3055\u3044\u6642","+ if ni > 0:","+ dp[i + 1][1][k + 1] += dp[i][0][k] * (ni - 1) # i+1\u6841\u76ee\u304c0\u4ee5\u5916","+ dp[i + 1][1][k] += dp[i][0][k] # i+1\u6841\u76ee\u304c0\u4ee5\u5916","+ # i\u6841\u76ee\u307e\u3067N\u3068\u540c\u3058\u3067\u3001i+1\u6841\u76ee\u3082N\u3068\u540c\u3058\u6570\u306e\u6642","+ if ni > 0:","+ dp[i + 1][0][k + 1] = dp[i][0][k] # i+1\u6841\u76ee\u304c0\u4ee5\u5916","+ else:","+ dp[i + 1][0][k] = dp[i][0][k] # i+1\u6841\u76ee\u304c0","+print((dp[N][0][K] + dp[N][1][K]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0360641818,"measured_runtime_v1":0.0363937464,"runtime_lift":0.9909444722,"key":["s596491634","s241376533"]} +{"user_id":"u227082700","problem_id":"p04035","language":"python","submission_id_v0":"s957360272","submission_id_v1":"s518763371","cpu_time_v0":137,"cpu_time_v1":121,"memory_v0":14052,"memory_v1":14620,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.68,"input":"n,l=list(map(int,input().split()))\n\na=list(map(int, input().split()))\n\nfor i in range(n-1):\n\n if a[i]+a[i+1]>=l:\n\n print(\"Possible\")\n\n for j in range(i):print((j+1))\n\n for j in range(n-1,i,-1):print(j)\n\n exit()\n\nprint(\"Impossible\")","target":"n,l=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\nif a[0]+a[1]>=l:\n\n print(\"Possible\")\n\n for i in range(n-1,0,-1):print(i)\n\n exit()\n\nif a[-2]+a[-1]>=l:\n\n print(\"Possible\")\n\n for i in range(1,n):print(i)\n\n exit()\n\nans=-1\n\nfor i in range(1,n):\n\n if a[i-1]+a[i]>=l:\n\n ans=i\n\n break\n\nif ans==-1:print(\"Impossible\")\n\nelse:\n\n print(\"Possible\")\n\n for i in range(1,ans):print(i)\n\n for i in range(n-1,ans,-1):print(i)\n\n print(ans)\n","code_v0_loc":9,"code_v1_loc":21,"code_v0_num_chars":236,"code_v1_num_chars":453,"code_v0_no_empty_lines":"n, l = list(map(int, input().split()))\na = list(map(int, input().split()))\nfor i in range(n - 1):\n if a[i] + a[i + 1] >= l:\n print(\"Possible\")\n for j in range(i):\n print((j + 1))\n for j in range(n - 1, i, -1):\n print(j)\n exit()\nprint(\"Impossible\")\n","code_v1_no_empty_lines":"n, l = list(map(int, input().split()))\na = list(map(int, input().split()))\nif a[0] + a[1] >= l:\n print(\"Possible\")\n for i in range(n - 1, 0, -1):\n print(i)\n exit()\nif a[-2] + a[-1] >= l:\n print(\"Possible\")\n for i in range(1, n):\n print(i)\n exit()\nans = -1\nfor i in range(1, n):\n if a[i - 1] + a[i] >= l:\n ans = i\n break\nif ans == -1:\n print(\"Impossible\")\nelse:\n print(\"Possible\")\n for i in range(1, ans):\n print(i)\n for i in range(n - 1, ans, -1):\n print(i)\n print(ans)\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-for i in range(n - 1):","- if a[i] + a[i + 1] >= l:","- print(\"Possible\")","- for j in range(i):","- print((j + 1))","- for j in range(n - 1, i, -1):","- print(j)","- exit()","-print(\"Impossible\")","+if a[0] + a[1] >= l:","+ print(\"Possible\")","+ for i in range(n - 1, 0, -1):","+ print(i)","+ exit()","+if a[-2] + a[-1] >= l:","+ print(\"Possible\")","+ for i in range(1, n):","+ print(i)","+ exit()","+ans = -1","+for i in range(1, n):","+ if a[i - 1] + a[i] >= l:","+ ans = i","+ break","+if ans == -1:","+ print(\"Impossible\")","+else:","+ print(\"Possible\")","+ for i in range(1, ans):","+ print(i)","+ for i in range(n - 1, ans, -1):","+ print(i)","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0405653291,"measured_runtime_v1":0.04536041,"runtime_lift":0.8942892952,"key":["s957360272","s518763371"]} +{"user_id":"u923662841","problem_id":"p02983","language":"python","submission_id_v0":"s883814428","submission_id_v1":"s067974851","cpu_time_v0":700,"cpu_time_v1":62,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.14,"input":"L,R=list(map(int,input().split()))\n\nif R-L>=2019:\n\n minimum=0\n\nelse:\n\n left,right=L%2019,R%2019\n\n minimum=2018**2\n\n for i in range(left,right+1):\n\n for j in range(i+1,right+1):\n\n minimum=min(minimum,i*j%2019)\n\nprint(minimum)","target":"import itertools\n\nL,R = list(map(int,input().split()))\n\n\n\nif R-L>=2019:\n\n print((0))\n\n exit()\n\nb = 2018\n\nfor i in range(L,R+1):\n\n for j in range(i+1,R+1):\n\n a = (i*j)%2019\n\n b = min(b,a)\n\n if b == 0:\n\n break\n\nprint(b)","code_v0_loc":10,"code_v1_loc":14,"code_v0_num_chars":248,"code_v1_num_chars":250,"code_v0_no_empty_lines":"L, R = list(map(int, input().split()))\nif R - L >= 2019:\n minimum = 0\nelse:\n left, right = L % 2019, R % 2019\n minimum = 2018**2\n for i in range(left, right + 1):\n for j in range(i + 1, right + 1):\n minimum = min(minimum, i * j % 2019)\nprint(minimum)\n","code_v1_no_empty_lines":"import itertools\n\nL, R = list(map(int, input().split()))\nif R - L >= 2019:\n print((0))\n exit()\nb = 2018\nfor i in range(L, R + 1):\n for j in range(i + 1, R + 1):\n a = (i * j) % 2019\n b = min(b, a)\n if b == 0:\n break\nprint(b)\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["+import itertools","+","- minimum = 0","-else:","- left, right = L % 2019, R % 2019","- minimum = 2018**2","- for i in range(left, right + 1):","- for j in range(i + 1, right + 1):","- minimum = min(minimum, i * j % 2019)","-print(minimum)","+ print((0))","+ exit()","+b = 2018","+for i in range(L, R + 1):","+ for j in range(i + 1, R + 1):","+ a = (i * j) % 2019","+ b = min(b, a)","+ if b == 0:","+ break","+print(b)"],"diff_only_import_comment":false,"measured_runtime_v0":0.042380933,"measured_runtime_v1":0.0370175064,"runtime_lift":1.1448889218,"key":["s883814428","s067974851"]} +{"user_id":"u888092736","problem_id":"p02596","language":"python","submission_id_v0":"s573340270","submission_id_v1":"s223474676","cpu_time_v0":1917,"cpu_time_v1":185,"memory_v0":9152,"memory_v1":9036,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.35,"input":"K = int(eval(input()))\n\nnum = 0\n\nfor i in range(1000001):\n\n num += 7 * pow(10, i, K)\n\n num %= K\n\n if num == 0:\n\n print((i + 1))\n\n break\n\nelse:\n\n print((-1))\n","target":"def solve(K):\n\n cur = 0\n\n tens = 1\n\n for i in range(1_000_001):\n\n cur += 7 * tens\n\n cur %= K\n\n if cur == 0:\n\n return i + 1\n\n tens *= 10\n\n tens %= K\n\n else:\n\n return -1\n\n\n\n\n\nprint((solve(int(eval(input())))))\n","code_v0_loc":10,"code_v1_loc":15,"code_v0_num_chars":173,"code_v1_num_chars":265,"code_v0_no_empty_lines":"K = int(eval(input()))\nnum = 0\nfor i in range(1000001):\n num += 7 * pow(10, i, K)\n num %= K\n if num == 0:\n print((i + 1))\n break\nelse:\n print((-1))\n","code_v1_no_empty_lines":"def solve(K):\n cur = 0\n tens = 1\n for i in range(1_000_001):\n cur += 7 * tens\n cur %= K\n if cur == 0:\n return i + 1\n tens *= 10\n tens %= K\n else:\n return -1\n\n\nprint((solve(int(eval(input())))))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-K = int(eval(input()))","-num = 0","-for i in range(1000001):","- num += 7 * pow(10, i, K)","- num %= K","- if num == 0:","- print((i + 1))","- break","-else:","- print((-1))","+def solve(K):","+ cur = 0","+ tens = 1","+ for i in range(1_000_001):","+ cur += 7 * tens","+ cur %= K","+ if cur == 0:","+ return i + 1","+ tens *= 10","+ tens %= K","+ else:","+ return -1","+","+","+print((solve(int(eval(input())))))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4237033486,"measured_runtime_v1":0.1266515532,"runtime_lift":11.241104535,"key":["s573340270","s223474676"]} +{"user_id":"u513081876","problem_id":"p03945","language":"python","submission_id_v0":"s509672715","submission_id_v1":"s562365986","cpu_time_v0":48,"cpu_time_v1":32,"memory_v0":3956,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"S = list(eval(input()))\n\nflag = S[0]\n\nflag_num = 0\n\nans = 0\n\n\n\n\n\nfor i in range(len(S)):\n\n if flag != S[flag_num]:\n\n ans += 1\n\n flag = S[flag_num]\n\n \n\n flag_num += 1\n\nprint(ans)","target":"S = eval(input())\n\nnow = S[0]\n\nans = 0\n\nfor i in S:\n\n if now != i:\n\n ans += 1\n\n now = i\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":8,"code_v0_num_chars":194,"code_v1_num_chars":110,"code_v0_no_empty_lines":"S = list(eval(input()))\nflag = S[0]\nflag_num = 0\nans = 0\nfor i in range(len(S)):\n if flag != S[flag_num]:\n ans += 1\n flag = S[flag_num]\n flag_num += 1\nprint(ans)\n","code_v1_no_empty_lines":"S = eval(input())\nnow = S[0]\nans = 0\nfor i in S:\n if now != i:\n ans += 1\n now = i\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":38.4615384615,"diff":["-S = list(eval(input()))","-flag = S[0]","-flag_num = 0","+S = eval(input())","+now = S[0]","-for i in range(len(S)):","- if flag != S[flag_num]:","+for i in S:","+ if now != i:","- flag = S[flag_num]","- flag_num += 1","+ now = i"],"diff_only_import_comment":false,"measured_runtime_v0":0.0428104987,"measured_runtime_v1":0.0422829063,"runtime_lift":1.0124776761,"key":["s509672715","s562365986"]} +{"user_id":"u945181840","problem_id":"p02936","language":"python","submission_id_v0":"s653261218","submission_id_v1":"s728625054","cpu_time_v0":1056,"cpu_time_v1":889,"memory_v0":66944,"memory_v1":76216,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.81,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN, Q = list(map(int, input().split()))\n\ngraph = [[] for _ in range(N + 1)]\n\ncnt = [0] * (N + 1)\n\n\n\nfor i in range(N - 1):\n\n a, b = list(map(int, input().split()))\n\n graph[a].append(b)\n\n graph[b].append(a)\n\n\n\nfor i in range(Q):\n\n p, x = list(map(int, input().split()))\n\n cnt[p] += x\n\n\n\nwait = [1]\n\nparent = [0] * (N + 1)\n\nwhile wait:\n\n temp = wait.pop()\n\n\n\n # \u9802\u70b9temp\u306b\u3064\u3044\u3066\n\n for i in graph[temp]:\n\n if i != parent[temp]:\n\n parent[i] = temp\n\n wait.append(i)\n\n cnt[i] += cnt[temp]\n\n\n\n\n\nprint((' '.join(map(str, cnt[1:]))))","target":"import sys\n\n\n\nreadline = sys.stdin.readline\n\nread = sys.stdin.read\n\n\n\nN, Q = list(map(int, readline().split()))\n\ngraph = [[] for _ in range(N + 1)]\n\ncnt = [0] * (N + 1)\n\n\n\nfor _ in range(N - 1):\n\n a, b = list(map(int, readline().split()))\n\n graph[a].append(b)\n\n graph[b].append(a)\n\n\n\npx = list(map(int, read().split()))\n\nfor p, x in zip(*[px] * 2):\n\n cnt[p] += x\n\n\n\nstack = [1]\n\nchecked = [False] * (N + 1)\n\nchecked[1] = True\n\nwhile stack:\n\n V = stack.pop()\n\n for i in graph[V]:\n\n if checked[i]:\n\n continue\n\n checked[i] = True\n\n stack.append(i)\n\n cnt[i] += cnt[V]\n\n\n\nprint((' '.join(map(str, cnt[1:]))))\n","code_v0_loc":30,"code_v1_loc":31,"code_v0_num_chars":603,"code_v1_num_chars":641,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, Q = list(map(int, input().split()))\ngraph = [[] for _ in range(N + 1)]\ncnt = [0] * (N + 1)\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n graph[a].append(b)\n graph[b].append(a)\nfor i in range(Q):\n p, x = list(map(int, input().split()))\n cnt[p] += x\nwait = [1]\nparent = [0] * (N + 1)\nwhile wait:\n temp = wait.pop()\n # \u9802\u70b9temp\u306b\u3064\u3044\u3066\n for i in graph[temp]:\n if i != parent[temp]:\n parent[i] = temp\n wait.append(i)\n cnt[i] += cnt[temp]\nprint((\" \".join(map(str, cnt[1:]))))\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nread = sys.stdin.read\nN, Q = list(map(int, readline().split()))\ngraph = [[] for _ in range(N + 1)]\ncnt = [0] * (N + 1)\nfor _ in range(N - 1):\n a, b = list(map(int, readline().split()))\n graph[a].append(b)\n graph[b].append(a)\npx = list(map(int, read().split()))\nfor p, x in zip(*[px] * 2):\n cnt[p] += x\nstack = [1]\nchecked = [False] * (N + 1)\nchecked[1] = True\nwhile stack:\n V = stack.pop()\n for i in graph[V]:\n if checked[i]:\n continue\n checked[i] = True\n stack.append(i)\n cnt[i] += cnt[V]\nprint((\" \".join(map(str, cnt[1:]))))\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["-input = sys.stdin.readline","-N, Q = list(map(int, input().split()))","+readline = sys.stdin.readline","+read = sys.stdin.read","+N, Q = list(map(int, readline().split()))","-for i in range(N - 1):","- a, b = list(map(int, input().split()))","+for _ in range(N - 1):","+ a, b = list(map(int, readline().split()))","-for i in range(Q):","- p, x = list(map(int, input().split()))","+px = list(map(int, read().split()))","+for p, x in zip(*[px] * 2):","-wait = [1]","-parent = [0] * (N + 1)","-while wait:","- temp = wait.pop()","- # \u9802\u70b9temp\u306b\u3064\u3044\u3066","- for i in graph[temp]:","- if i != parent[temp]:","- parent[i] = temp","- wait.append(i)","- cnt[i] += cnt[temp]","+stack = [1]","+checked = [False] * (N + 1)","+checked[1] = True","+while stack:","+ V = stack.pop()","+ for i in graph[V]:","+ if checked[i]:","+ continue","+ checked[i] = True","+ stack.append(i)","+ cnt[i] += cnt[V]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0357058108,"measured_runtime_v1":0.0928477046,"runtime_lift":0.3845632043,"key":["s653261218","s728625054"]} +{"user_id":"u809819902","problem_id":"p02801","language":"python","submission_id_v0":"s688655611","submission_id_v1":"s687391596","cpu_time_v0":29,"cpu_time_v1":26,"memory_v0":9088,"memory_v1":9028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.34,"input":"print((chr(ord(eval(input()))+1)))","target":"c=eval(input())\n\nprint((chr(ord(c)+1)))","code_v0_loc":1,"code_v1_loc":2,"code_v0_num_chars":26,"code_v1_num_chars":31,"code_v0_no_empty_lines":"print((chr(ord(eval(input())) + 1)))\n","code_v1_no_empty_lines":"c = eval(input())\nprint((chr(ord(c) + 1)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-print((chr(ord(eval(input())) + 1)))","+c = eval(input())","+print((chr(ord(c) + 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0932213478,"measured_runtime_v1":0.0457338118,"runtime_lift":2.0383463387,"key":["s688655611","s687391596"]} +{"user_id":"u188827677","problem_id":"p02711","language":"python","submission_id_v0":"s509178437","submission_id_v1":"s064604697","cpu_time_v0":27,"cpu_time_v1":22,"memory_v0":9788,"memory_v1":9080,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.52,"input":"import re\n\nn = eval(input())\n\n\n\nif re.findall('[7]', n):\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","target":"n = eval(input())\n\nprint((\"Yes\" if n.find(\"7\") >= 0 else \"No\"))","code_v0_loc":7,"code_v1_loc":2,"code_v0_num_chars":88,"code_v1_num_chars":55,"code_v0_no_empty_lines":"import re\n\nn = eval(input())\nif re.findall(\"[7]\", n):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"n = eval(input())\nprint((\"Yes\" if n.find(\"7\") >= 0 else \"No\"))\n","code_same":false,"relative_loc_diff_percent":71.4285714286,"diff":["-import re","-","-if re.findall(\"[7]\", n):","- print(\"Yes\")","-else:","- print(\"No\")","+print((\"Yes\" if n.find(\"7\") >= 0 else \"No\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1349130611,"measured_runtime_v1":0.049281852,"runtime_lift":2.7375809881,"key":["s509178437","s064604697"]} +{"user_id":"u540762794","problem_id":"p03329","language":"python","submission_id_v0":"s073463280","submission_id_v1":"s528063518","cpu_time_v0":924,"cpu_time_v1":438,"memory_v0":9200,"memory_v1":9280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.6,"input":"# -*- coding: utf-8 -*-\n\n\n\ndef count(val1, val2):\n\n digit = 1\n\n while val1 >= (val2 ** digit):\n\n digit += 1\n\n\n\n res = 0\n\n while digit!=0:\n\n cnt = int(val1 \/\/ val2 ** digit)\n\n val1 -= (val2 ** digit)*cnt\n\n res += cnt\n\n digit -= 1\n\n\n\n return res,val1\n\n\n\n\n\nN = int(eval(input()))\n\nans = N\n\n\n\nfor i in range(0,N+1):\n\n n = i\n\n m = N - i\n\n res = 0\n\n\n\n cnt, nn = count(n, 9)\n\n n = nn\n\n res += cnt\n\n\n\n cnt, mm = count(m, 6)\n\n m = mm\n\n res += cnt\n\n\n\n res += n + m\n\n ans = min(ans, res)\n\n\n\nprint(ans)\n","target":"# -*- coding: utf-8 -*-\n\n\n\ndef count(val1, val2):\n\n digit = 1\n\n while digit*val2 <= val1:\n\n digit *= val2\n\n\n\n res = 0\n\n while digit!=1:\n\n cnt = int(val1 \/\/ digit)\n\n val1 -= digit*cnt\n\n res += cnt\n\n digit \/= val2\n\n\n\n return res,val1\n\n\n\n\n\nN = int(eval(input()))\n\nans = N\n\n\n\nfor i in range(0,N+1):\n\n n = i\n\n m = N - i\n\n res = 0\n\n\n\n cnt, nn = count(n, 9)\n\n n = nn\n\n res += cnt\n\n\n\n cnt, mm = count(m, 6)\n\n m = mm\n\n res += cnt\n\n\n\n res += n + m\n\n ans = min(ans, int(res))\n\n\n\nprint(ans)\n","code_v0_loc":37,"code_v1_loc":37,"code_v0_num_chars":568,"code_v1_num_chars":556,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\ndef count(val1, val2):\n digit = 1\n while val1 >= (val2**digit):\n digit += 1\n res = 0\n while digit != 0:\n cnt = int(val1 \/\/ val2**digit)\n val1 -= (val2**digit) * cnt\n res += cnt\n digit -= 1\n return res, val1\n\n\nN = int(eval(input()))\nans = N\nfor i in range(0, N + 1):\n n = i\n m = N - i\n res = 0\n cnt, nn = count(n, 9)\n n = nn\n res += cnt\n cnt, mm = count(m, 6)\n m = mm\n res += cnt\n res += n + m\n ans = min(ans, res)\nprint(ans)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\ndef count(val1, val2):\n digit = 1\n while digit * val2 <= val1:\n digit *= val2\n res = 0\n while digit != 1:\n cnt = int(val1 \/\/ digit)\n val1 -= digit * cnt\n res += cnt\n digit \/= val2\n return res, val1\n\n\nN = int(eval(input()))\nans = N\nfor i in range(0, N + 1):\n n = i\n m = N - i\n res = 0\n cnt, nn = count(n, 9)\n n = nn\n res += cnt\n cnt, mm = count(m, 6)\n m = mm\n res += cnt\n res += n + m\n ans = min(ans, int(res))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- while val1 >= (val2**digit):","- digit += 1","+ while digit * val2 <= val1:","+ digit *= val2","- while digit != 0:","- cnt = int(val1 \/\/ val2**digit)","- val1 -= (val2**digit) * cnt","+ while digit != 1:","+ cnt = int(val1 \/\/ digit)","+ val1 -= digit * cnt","- digit -= 1","+ digit \/= val2","- ans = min(ans, res)","+ ans = min(ans, int(res))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4998745322,"measured_runtime_v1":0.2437054288,"runtime_lift":2.0511423754,"key":["s073463280","s528063518"]} +{"user_id":"u729133443","problem_id":"p04006","language":"python","submission_id_v0":"s925898463","submission_id_v1":"s643090274","cpu_time_v0":818,"cpu_time_v1":625,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.59,"input":"n,x,*a=list(map(int,open(0).read().split()))\n\nm=1e18\n\nfor i in range(n):m=min(m,sum(a)+x*i);a=[min(t)for t in zip(a,a[-1:]+a)]\n\nprint(m)","target":"n,x,*a=list(map(int,open(0).read().split()))\n\nm=1e18\n\nfor i in range(n):m=min(m,sum(a)+x*i);*a,=list(map(min,list(zip(a,a[-1:]+a))))\n\nprint(m)","code_v0_loc":4,"code_v1_loc":4,"code_v0_num_chars":130,"code_v1_num_chars":124,"code_v0_no_empty_lines":"n, x, *a = list(map(int, open(0).read().split()))\nm = 1e18\nfor i in range(n):\n m = min(m, sum(a) + x * i)\n a = [min(t) for t in zip(a, a[-1:] + a)]\nprint(m)\n","code_v1_no_empty_lines":"n, x, *a = list(map(int, open(0).read().split()))\nm = 1e18\nfor i in range(n):\n m = min(m, sum(a) + x * i)\n (*a,) = list(map(min, list(zip(a, a[-1:] + a))))\nprint(m)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- a = [min(t) for t in zip(a, a[-1:] + a)]","+ (*a,) = list(map(min, list(zip(a, a[-1:] + a))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0738264954,"measured_runtime_v1":0.0398140795,"runtime_lift":1.8542811054,"key":["s925898463","s643090274"]} +{"user_id":"u112317104","problem_id":"p02796","language":"python","submission_id_v0":"s669109546","submission_id_v1":"s106483664","cpu_time_v0":511,"cpu_time_v1":382,"memory_v0":41440,"memory_v1":18276,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.24,"input":"N = int(eval(input()))\n\nXL = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nt = [(x + l, x - l) for x, l in XL]\n\nt.sort()\n\nmax_r = -float('inf')\n\nresult = 0\n\nfor i in range(N):\n\n r, l = t[i]\n\n if max_r <= l:\n\n result += 1\n\n max_r = r\n\nprint(result)","target":"from operator import itemgetter\n\n\n\ndef solve():\n\n N = int(eval(input()))\n\n X = []\n\n for i in range(N):\n\n xx, ll = list(map(int, input().split()))\n\n X.append((xx-ll, xx+ll))\n\n X.sort(key=itemgetter(1))\n\n count = 0\n\n cur = -float('inf')\n\n for i in range(N):\n\n c, d = X[i]\n\n if cur <= c:\n\n count += 1\n\n cur = d\n\n return count\n\n\n\nprint((solve()))\n","code_v0_loc":13,"code_v1_loc":19,"code_v0_num_chars":270,"code_v1_num_chars":403,"code_v0_no_empty_lines":"N = int(eval(input()))\nXL = [list(map(int, input().split())) for _ in range(N)]\nt = [(x + l, x - l) for x, l in XL]\nt.sort()\nmax_r = -float(\"inf\")\nresult = 0\nfor i in range(N):\n r, l = t[i]\n if max_r <= l:\n result += 1\n max_r = r\nprint(result)\n","code_v1_no_empty_lines":"from operator import itemgetter\n\n\ndef solve():\n N = int(eval(input()))\n X = []\n for i in range(N):\n xx, ll = list(map(int, input().split()))\n X.append((xx - ll, xx + ll))\n X.sort(key=itemgetter(1))\n count = 0\n cur = -float(\"inf\")\n for i in range(N):\n c, d = X[i]\n if cur <= c:\n count += 1\n cur = d\n return count\n\n\nprint((solve()))\n","code_same":false,"relative_loc_diff_percent":31.5789473684,"diff":["-N = int(eval(input()))","-XL = [list(map(int, input().split())) for _ in range(N)]","-t = [(x + l, x - l) for x, l in XL]","-t.sort()","-max_r = -float(\"inf\")","-result = 0","-for i in range(N):","- r, l = t[i]","- if max_r <= l:","- result += 1","- max_r = r","-print(result)","+from operator import itemgetter","+","+","+def solve():","+ N = int(eval(input()))","+ X = []","+ for i in range(N):","+ xx, ll = list(map(int, input().split()))","+ X.append((xx - ll, xx + ll))","+ X.sort(key=itemgetter(1))","+ count = 0","+ cur = -float(\"inf\")","+ for i in range(N):","+ c, d = X[i]","+ if cur <= c:","+ count += 1","+ cur = d","+ return count","+","+","+print((solve()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0909861145,"measured_runtime_v1":0.0387579458,"runtime_lift":2.3475473908,"key":["s669109546","s106483664"]} +{"user_id":"u466331465","problem_id":"p03087","language":"python","submission_id_v0":"s817671277","submission_id_v1":"s860217645","cpu_time_v0":1403,"cpu_time_v1":461,"memory_v0":16448,"memory_v1":14968,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.14,"input":"import numpy as np\n\nfrom collections import Counter\n\nimport collections\n\nimport numpy as np \n\nfrom scipy import sqrt, power, exp, log10\n\nfrom scipy.fftpack import fft, ifft, fftfreq\n\nimport tarfile\n\nimport re\n\nimport os\n\nimport glob\n\nfrom datetime import datetime\n\nimport time\n\nimport numpy.linalg as LA\n\n\n\nround = lambda x:(x*2+1)\/\/2\n\na,b = list(map(int,input().split()))\n\nS = eval(input())\n\nsub= \"AC\"\n\nl = np.zeros(len(S)+1)\n\nfor i in range(len(S)):\n\n l[i+1] = l[i] + (1 if S[i:i+2]==\"AC\" else 0)\n\n\n\nfor i in range(b):\n\n r,t = list(map(int,input().split()))\n\n n = l[t-1]-l[r-1]\n\n print((int(n)))","target":"N, Q = list(map(int, input().split()))\n\nS = eval(input())\n\nL = [0]*Q \n\nR = [0]*Q\n\nfor q in range(Q):\n\n l, r = list(map(int, input().split()))\n\n L[q] = l\n\n R[q] = r\n\nans = [0]*Q \n\naccumulative_count = [0]*(N) \n\naccumulative_count[0] = 0 \n\nfor i in range(1, N, 1): \n\n accumulative_count[i] = accumulative_count[i-1]\n\n if (S[i-1:i] == 'A') & (S[i:i+1] == 'C'):\n\n accumulative_count[i] = accumulative_count[i-1] + 1\n\nfor q in range(Q):\n\n print((accumulative_count[R[q]-1] - accumulative_count[L[q]-1]))\n","code_v0_loc":26,"code_v1_loc":17,"code_v0_num_chars":599,"code_v1_num_chars":504,"code_v0_no_empty_lines":"import numpy as np\nfrom collections import Counter\nimport collections\nimport numpy as np\nfrom scipy import sqrt, power, exp, log10\nfrom scipy.fftpack import fft, ifft, fftfreq\nimport tarfile\nimport re\nimport os\nimport glob\nfrom datetime import datetime\nimport time\nimport numpy.linalg as LA\n\nround = lambda x: (x * 2 + 1) \/\/ 2\na, b = list(map(int, input().split()))\nS = eval(input())\nsub = \"AC\"\nl = np.zeros(len(S) + 1)\nfor i in range(len(S)):\n l[i + 1] = l[i] + (1 if S[i : i + 2] == \"AC\" else 0)\nfor i in range(b):\n r, t = list(map(int, input().split()))\n n = l[t - 1] - l[r - 1]\n print((int(n)))\n","code_v1_no_empty_lines":"N, Q = list(map(int, input().split()))\nS = eval(input())\nL = [0] * Q\nR = [0] * Q\nfor q in range(Q):\n l, r = list(map(int, input().split()))\n L[q] = l\n R[q] = r\nans = [0] * Q\naccumulative_count = [0] * (N)\naccumulative_count[0] = 0\nfor i in range(1, N, 1):\n accumulative_count[i] = accumulative_count[i - 1]\n if (S[i - 1 : i] == \"A\") & (S[i : i + 1] == \"C\"):\n accumulative_count[i] = accumulative_count[i - 1] + 1\nfor q in range(Q):\n print((accumulative_count[R[q] - 1] - accumulative_count[L[q] - 1]))\n","code_same":false,"relative_loc_diff_percent":34.6153846154,"diff":["-import numpy as np","-from collections import Counter","-import collections","-import numpy as np","-from scipy import sqrt, power, exp, log10","-from scipy.fftpack import fft, ifft, fftfreq","-import tarfile","-import re","-import os","-import glob","-from datetime import datetime","-import time","-import numpy.linalg as LA","-","-round = lambda x: (x * 2 + 1) \/\/ 2","-a, b = list(map(int, input().split()))","+N, Q = list(map(int, input().split()))","-sub = \"AC\"","-l = np.zeros(len(S) + 1)","-for i in range(len(S)):","- l[i + 1] = l[i] + (1 if S[i : i + 2] == \"AC\" else 0)","-for i in range(b):","- r, t = list(map(int, input().split()))","- n = l[t - 1] - l[r - 1]","- print((int(n)))","+L = [0] * Q","+R = [0] * Q","+for q in range(Q):","+ l, r = list(map(int, input().split()))","+ L[q] = l","+ R[q] = r","+ans = [0] * Q","+accumulative_count = [0] * (N)","+accumulative_count[0] = 0","+for i in range(1, N, 1):","+ accumulative_count[i] = accumulative_count[i - 1]","+ if (S[i - 1 : i] == \"A\") & (S[i : i + 1] == \"C\"):","+ accumulative_count[i] = accumulative_count[i - 1] + 1","+for q in range(Q):","+ print((accumulative_count[R[q] - 1] - accumulative_count[L[q] - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.4201591921,"measured_runtime_v1":0.0731718323,"runtime_lift":5.7420892533,"key":["s817671277","s860217645"]} +{"user_id":"u606045429","problem_id":"p03524","language":"python","submission_id_v0":"s130168403","submission_id_v1":"s864894003","cpu_time_v0":25,"cpu_time_v1":18,"memory_v0":3444,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.0,"input":"from collections import Counter\n\n\n\ndef check(a, b):\n\n return (abs(a - b) <= 1)\n\n\n\nC = Counter(eval(input()))\n\na, b, c = (C[s] for s in \"abc\")\n\nif check(a, b) and check(b, c) and check(c, a):\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")\n","target":"S = eval(input())\n\nL = [S.count(s) for s in \"abc\"]\n\nif max(L) - min(L) <= 1:\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")\n","code_v0_loc":11,"code_v1_loc":6,"code_v0_num_chars":230,"code_v1_num_chars":113,"code_v0_no_empty_lines":"from collections import Counter\n\n\ndef check(a, b):\n return abs(a - b) <= 1\n\n\nC = Counter(eval(input()))\na, b, c = (C[s] for s in \"abc\")\nif check(a, b) and check(b, c) and check(c, a):\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_v1_no_empty_lines":"S = eval(input())\nL = [S.count(s) for s in \"abc\"]\nif max(L) - min(L) <= 1:\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-from collections import Counter","-","-","-def check(a, b):","- return abs(a - b) <= 1","-","-","-C = Counter(eval(input()))","-a, b, c = (C[s] for s in \"abc\")","-if check(a, b) and check(b, c) and check(c, a):","+S = eval(input())","+L = [S.count(s) for s in \"abc\"]","+if max(L) - min(L) <= 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0473383427,"measured_runtime_v1":0.0399709702,"runtime_lift":1.1843180807,"key":["s130168403","s864894003"]} +{"user_id":"u690536347","problem_id":"p03584","language":"python","submission_id_v0":"s672684637","submission_id_v1":"s629634793","cpu_time_v0":595,"cpu_time_v1":154,"memory_v0":85424,"memory_v1":85168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.12,"input":"import sys\n\ninput=sys.stdin.readline\n\n\n\n\n\ndef get_candidate(K):\n\n l = []\n\n b = 0\n\n for i in range(30)[::-1]:\n\n if (K&(1<>i\n\n\n\n ans = 0\n\n for i, j in l:\n\n for k in range(30):\n\n b = (i&(1<>k\n\n if not ((bit[k]==1) or (b==0 and bit[k]==0)):\n\n break\n\n else:\n\n ans += j\n\n return ans\n\n\n\n\n\ndef solve():\n\n N, K = list(map(int, input().split()))\n\n l = [tuple(map(int, input().split())) for _ in range(N)]\n\n ans = 0\n\n for k in get_candidate(K):\n\n ans = max(ans, get_ans(k, l))\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n solve()\n","target":"import sys\n\ninput=sys.stdin.readline\n\n\n\n\n\ndef get_candidate(K):\n\n l = []\n\n b = 0\n\n for i in range(30)[::-1]:\n\n if K&(1<> i\n ans = 0\n for i, j in l:\n for k in range(30):\n b = (i & (1 << k)) >> k\n if not ((bit[k] == 1) or (b == 0 and bit[k] == 0)):\n break\n else:\n ans += j\n return ans\n\n\ndef solve():\n N, K = list(map(int, input().split()))\n l = [tuple(map(int, input().split())) for _ in range(N)]\n ans = 0\n for k in get_candidate(K):\n ans = max(ans, get_ans(k, l))\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef get_candidate(K):\n l = []\n b = 0\n for i in range(30)[::-1]:\n if K & (1 << i):\n l.append(b + (1 << i) - 1)\n b += 1 << i\n return l + [K]\n\n\ndef get_ans(K, l):\n ans = 0\n for i, j in l:\n if i | K == K:\n ans += j\n return ans\n\n\ndef solve():\n N, K = list(map(int, input().split()))\n l = [tuple(map(int, input().split())) for _ in range(N)]\n ans = 0\n for k in get_candidate(K):\n ans = max(ans, get_ans(k, l))\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":19.512195122,"diff":["- bit = [None] * 30","- for i in range(30):","- bit[i] = (K & (1 << i)) >> i","- for k in range(30):","- b = (i & (1 << k)) >> k","- if not ((bit[k] == 1) or (b == 0 and bit[k] == 0)):","- break","- else:","+ if i | K == K:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0597863674,"measured_runtime_v1":0.0596035004,"runtime_lift":1.0030680587,"key":["s672684637","s629634793"]} +{"user_id":"u178079174","problem_id":"p02813","language":"python","submission_id_v0":"s101961208","submission_id_v1":"s817984958","cpu_time_v0":71,"cpu_time_v1":32,"memory_v0":8308,"memory_v1":6308,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.93,"input":"import itertools\n\nN = int(eval(input()))\n\nNL = [str(i) for i in range(1,N+1)]\n\nP = input().replace(' ', '')\n\nQ = input().replace(' ', '')\n\nNLL = sorted(list(itertools.permutations(NL,N)))\n\na = 0\n\nb = 0\n\nfor i in range(len(NLL)):\n\n if ''.join(list(NLL[i])) == P:\n\n a = i+1\n\n if ''.join(list(NLL[i])) == Q:\n\n b = i+1\n\nprint((abs(a-b)))","target":"import itertools\n\nimport math\n\nN = int(eval(input()))\n\nP = ''.join(input().split())\n\nQ = ''.join(input().split())\n\nnp = sorted(list([''.join(x) for x in itertools.permutations([str(i+1) for i in range(N)])]))\n\nprint((abs((np.index(P)+1)-(np.index(Q)+1))))","code_v0_loc":14,"code_v1_loc":7,"code_v0_num_chars":345,"code_v1_num_chars":252,"code_v0_no_empty_lines":"import itertools\n\nN = int(eval(input()))\nNL = [str(i) for i in range(1, N + 1)]\nP = input().replace(\" \", \"\")\nQ = input().replace(\" \", \"\")\nNLL = sorted(list(itertools.permutations(NL, N)))\na = 0\nb = 0\nfor i in range(len(NLL)):\n if \"\".join(list(NLL[i])) == P:\n a = i + 1\n if \"\".join(list(NLL[i])) == Q:\n b = i + 1\nprint((abs(a - b)))\n","code_v1_no_empty_lines":"import itertools\nimport math\n\nN = int(eval(input()))\nP = \"\".join(input().split())\nQ = \"\".join(input().split())\nnp = sorted(\n list([\"\".join(x) for x in itertools.permutations([str(i + 1) for i in range(N)])])\n)\nprint((abs((np.index(P) + 1) - (np.index(Q) + 1))))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["+import math","-NL = [str(i) for i in range(1, N + 1)]","-P = input().replace(\" \", \"\")","-Q = input().replace(\" \", \"\")","-NLL = sorted(list(itertools.permutations(NL, N)))","-a = 0","-b = 0","-for i in range(len(NLL)):","- if \"\".join(list(NLL[i])) == P:","- a = i + 1","- if \"\".join(list(NLL[i])) == Q:","- b = i + 1","-print((abs(a - b)))","+P = \"\".join(input().split())","+Q = \"\".join(input().split())","+np = sorted(","+ list([\"\".join(x) for x in itertools.permutations([str(i + 1) for i in range(N)])])","+)","+print((abs((np.index(P) + 1) - (np.index(Q) + 1))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0666719437,"measured_runtime_v1":0.04629879,"runtime_lift":1.4400364174,"key":["s101961208","s817984958"]} +{"user_id":"u216015528","problem_id":"p02614","language":"python","submission_id_v0":"s625301626","submission_id_v1":"s697359144","cpu_time_v0":280,"cpu_time_v1":53,"memory_v0":26820,"memory_v1":8964,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.07,"input":"def resolve():\n\n import numpy as np\n\n import sys\n\n\n\n readline = sys.stdin.readline # 1\u884c\u3060\u3051\u6587\u5b57\u5217\u306b\u3059\u308b\n\n\n\n H, W, K = list(map(int, readline().split()))\n\n c = [list(readline().strip()) for _ in [0] * H]\n\n\n\n # matrix\u306f\u6587\u5b57\u5217#\u3068\u305d\u308c\u4ee5\u5916\u3067\u306a\u308b\u6642\uff0c#\u30921\u306b\uff0c\u305d\u308c\u4ee5\u5916\u30920\u306b\u3059\u308b\n\n c = np.array([[1 if c[i][j] == \"#\" else 0\n\n for j in range(W)]\n\n for i in range(H)], dtype=np.int64)\n\n\n\n ans = 0\n\n \n\n for bit_i in range(1 << H):\n\n lst_y = []\n\n for i in range(H):\n\n if bit_i & (1 << i):\n\n lst_y.append(i)\n\n for bit_j in range(1 << W):\n\n lst_x = []\n\n for j in range(W):\n\n if bit_j & (1 << j):\n\n lst_x.append(j)\n\n fig = c[:]\n\n fig = np.delete(fig, lst_y, axis=0)\n\n fig = np.delete(fig, lst_x, axis=1)\n\n if np.count_nonzero(fig == 1) == K:\n\n ans += 1\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n","target":"import sys\n\n\n\n\n\ndef resolve():\n\n \"\"\"\n\n \u5168\u30d1\u30bf\u30fc\u30f3\u306f2**12=4096\u901a\u308a\u3060\u304b\u3089bit\u5168\u63a2\u7d22\n\n \u6d88\u3055\u306a\u3044\u884c\u5217\u3060\u3051\u5224\u5b9a\u3059\u308b\u30b3\u30fc\u30c9\u306e\u65b9\u304c\u30b9\u30de\u30fc\u30c8\uff1f(\u89e3\u8aac\u52d5\u753b\u3088\u308a)\n\n \"\"\"\n\n\n\n readline = sys.stdin.readline # 1\u884c\u3060\u3051\u6587\u5b57\u5217\u306b\u3059\u308b\n\n\n\n H, W, K = list(map(int, readline().split()))\n\n c = [list(readline().strip()) for _ in [0] * H]\n\n ans = 0\n\n\n\n # bit\u5168\u63a2\u7d22\n\n for bit_i in range(1 << H):\n\n for bit_j in range(1 << W):\n\n cnt = 0\n\n for i in range(H):\n\n for j in range(W):\n\n if (1\n\n and bit_i & (1 << i)\n\n and bit_j & (1 << j)\n\n and c[i][j] == '#'):\n\n cnt += 1\n\n if cnt == K:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nresolve()","code_v0_loc":35,"code_v1_loc":32,"code_v0_num_chars":985,"code_v1_num_chars":752,"code_v0_no_empty_lines":"def resolve():\n import numpy as np\n import sys\n\n readline = sys.stdin.readline # 1\u884c\u3060\u3051\u6587\u5b57\u5217\u306b\u3059\u308b\n H, W, K = list(map(int, readline().split()))\n c = [list(readline().strip()) for _ in [0] * H]\n # matrix\u306f\u6587\u5b57\u5217#\u3068\u305d\u308c\u4ee5\u5916\u3067\u306a\u308b\u6642\uff0c#\u30921\u306b\uff0c\u305d\u308c\u4ee5\u5916\u30920\u306b\u3059\u308b\n c = np.array(\n [[1 if c[i][j] == \"#\" else 0 for j in range(W)] for i in range(H)],\n dtype=np.int64,\n )\n ans = 0\n for bit_i in range(1 << H):\n lst_y = []\n for i in range(H):\n if bit_i & (1 << i):\n lst_y.append(i)\n for bit_j in range(1 << W):\n lst_x = []\n for j in range(W):\n if bit_j & (1 << j):\n lst_x.append(j)\n fig = c[:]\n fig = np.delete(fig, lst_y, axis=0)\n fig = np.delete(fig, lst_x, axis=1)\n if np.count_nonzero(fig == 1) == K:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"import sys\n\n\ndef resolve():\n \"\"\"\n \u5168\u30d1\u30bf\u30fc\u30f3\u306f2**12=4096\u901a\u308a\u3060\u304b\u3089bit\u5168\u63a2\u7d22\n \u6d88\u3055\u306a\u3044\u884c\u5217\u3060\u3051\u5224\u5b9a\u3059\u308b\u30b3\u30fc\u30c9\u306e\u65b9\u304c\u30b9\u30de\u30fc\u30c8\uff1f(\u89e3\u8aac\u52d5\u753b\u3088\u308a)\n \"\"\"\n readline = sys.stdin.readline # 1\u884c\u3060\u3051\u6587\u5b57\u5217\u306b\u3059\u308b\n H, W, K = list(map(int, readline().split()))\n c = [list(readline().strip()) for _ in [0] * H]\n ans = 0\n # bit\u5168\u63a2\u7d22\n for bit_i in range(1 << H):\n for bit_j in range(1 << W):\n cnt = 0\n for i in range(H):\n for j in range(W):\n if 1 and bit_i & (1 << i) and bit_j & (1 << j) and c[i][j] == \"#\":\n cnt += 1\n if cnt == K:\n ans += 1\n print(ans)\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":8.5714285714,"diff":["+import sys","+","+","- import numpy as np","- import sys","-","+ \"\"\"","+ \u5168\u30d1\u30bf\u30fc\u30f3\u306f2**12=4096\u901a\u308a\u3060\u304b\u3089bit\u5168\u63a2\u7d22","+ \u6d88\u3055\u306a\u3044\u884c\u5217\u3060\u3051\u5224\u5b9a\u3059\u308b\u30b3\u30fc\u30c9\u306e\u65b9\u304c\u30b9\u30de\u30fc\u30c8\uff1f(\u89e3\u8aac\u52d5\u753b\u3088\u308a)","+ \"\"\"","- # matrix\u306f\u6587\u5b57\u5217#\u3068\u305d\u308c\u4ee5\u5916\u3067\u306a\u308b\u6642\uff0c#\u30921\u306b\uff0c\u305d\u308c\u4ee5\u5916\u30920\u306b\u3059\u308b","- c = np.array(","- [[1 if c[i][j] == \"#\" else 0 for j in range(W)] for i in range(H)],","- dtype=np.int64,","- )","+ # bit\u5168\u63a2\u7d22","- lst_y = []","- for i in range(H):","- if bit_i & (1 << i):","- lst_y.append(i)","- lst_x = []","- for j in range(W):","- if bit_j & (1 << j):","- lst_x.append(j)","- fig = c[:]","- fig = np.delete(fig, lst_y, axis=0)","- fig = np.delete(fig, lst_x, axis=1)","- if np.count_nonzero(fig == 1) == K:","+ cnt = 0","+ for i in range(H):","+ for j in range(W):","+ if 1 and bit_i & (1 << i) and bit_j & (1 << j) and c[i][j] == \"#\":","+ cnt += 1","+ if cnt == K:","-if __name__ == \"__main__\":","- resolve()","+resolve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2208839655,"measured_runtime_v1":0.0374181827,"runtime_lift":5.903118472,"key":["s625301626","s697359144"]} +{"user_id":"u279493135","problem_id":"p02936","language":"python","submission_id_v0":"s407038989","submission_id_v1":"s283776829","cpu_time_v0":1503,"cpu_time_v1":1164,"memory_v0":168316,"memory_v1":148888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.55,"input":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import permutations, combinations, product, accumulate\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom fractions import gcd\n\n \n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(input())\n\ndef MAP(): return map(int, input().split())\n\ndef LIST(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\ndef solve():\n\n\tN, Q = MAP()\n\n\tab = [LIST() for _ in range(N-1)]\n\n\ttree = defaultdict(list)\n\n\tpar = [-1]*N\n\n\tpar[0] = 0\n\n\tfor a, b in ab:\n\n\t\ttree[a-1].append(b-1)\n\n\t\ttree[b-1].append(a-1)\n\n\t\tpar[b-1] = a-1\n\n\n\n\tpx = [LIST() for _ in range(Q)]\n\n\n\n\tans = [0] * N # \u7b54\u3048\u5165\u308c\u308b\n\n\n\n\tfor p, x in px:\n\n\t\tans[p-1] += x\n\n\n\n\t\n\n\tfor i in range(1, N):\n\n\t\tans[i] += ans[par[i]]\n\n\n\n\tprint(*ans, sep=\" \")\n\n\n\nif __name__ == \"__main__\":\n\n\tsolve()\n","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import permutations, combinations, product\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom fractions import gcd\n\nfrom bisect import bisect\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nN, Q = MAP()\n\nab = [LIST() for _ in range(N-1)]\n\npx = [LIST() for _ in range(Q)]\n\n\n\ntree = defaultdict(list)\n\nfor a, b in ab:\n\n\ttree[a-1].append(b-1)\n\n\ttree[b-1].append(a-1)\n\n\n\ndic = defaultdict(int)\n\n\n\nfor p, x in px:\n\n\tdic[p-1] += x\n\n\n\nans = [0]*N\n\n\n\nchecked = [0]*N\n\nchecked[0] = 1\n\n\n\nq = deque([])\n\nq.append(0)\n\n\n\nwhile q:\n\n\tn = q.popleft()\n\n\tans[n] += dic[n]\n\n\tfor node in tree[n]:\n\n\t\tif checked[node]:\n\n\t\t\tcontinue\n\n\t\tans[node] += ans[n]\n\n\t\tchecked[node] = 1\n\n\t\tq.append(node)\n\n\n\nprint((*ans))\n","code_v0_loc":43,"code_v1_loc":51,"code_v0_num_chars":1043,"code_v1_num_chars":1130,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(input())\n\n\ndef MAP():\n return map(int, input().split())\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef solve():\n N, Q = MAP()\n ab = [LIST() for _ in range(N - 1)]\n tree = defaultdict(list)\n par = [-1] * N\n par[0] = 0\n for a, b in ab:\n tree[a - 1].append(b - 1)\n tree[b - 1].append(a - 1)\n par[b - 1] = a - 1\n px = [LIST() for _ in range(Q)]\n ans = [0] * N # \u7b54\u3048\u5165\u308c\u308b\n for p, x in px:\n ans[p - 1] += x\n for i in range(1, N):\n ans[i] += ans[par[i]]\n print(*ans, sep=\" \")\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\nfrom bisect import bisect\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nN, Q = MAP()\nab = [LIST() for _ in range(N - 1)]\npx = [LIST() for _ in range(Q)]\ntree = defaultdict(list)\nfor a, b in ab:\n tree[a - 1].append(b - 1)\n tree[b - 1].append(a - 1)\ndic = defaultdict(int)\nfor p, x in px:\n dic[p - 1] += x\nans = [0] * N\nchecked = [0] * N\nchecked[0] = 1\nq = deque([])\nq.append(0)\nwhile q:\n n = q.popleft()\n ans[n] += dic[n]\n for node in tree[n]:\n if checked[node]:\n continue\n ans[node] += ans[n]\n checked[node] = 1\n q.append(node)\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":15.6862745098,"diff":["-from itertools import permutations, combinations, product, accumulate","+from itertools import permutations, combinations, product","+from bisect import bisect","- return int(input())","+ return int(eval(input()))","- return map(int, input().split())","+ return list(map(int, input().split()))","-","-","-def solve():","- N, Q = MAP()","- ab = [LIST() for _ in range(N - 1)]","- tree = defaultdict(list)","- par = [-1] * N","- par[0] = 0","- for a, b in ab:","- tree[a - 1].append(b - 1)","- tree[b - 1].append(a - 1)","- par[b - 1] = a - 1","- px = [LIST() for _ in range(Q)]","- ans = [0] * N # \u7b54\u3048\u5165\u308c\u308b","- for p, x in px:","- ans[p - 1] += x","- for i in range(1, N):","- ans[i] += ans[par[i]]","- print(*ans, sep=\" \")","-","-","-if __name__ == \"__main__\":","- solve()","+N, Q = MAP()","+ab = [LIST() for _ in range(N - 1)]","+px = [LIST() for _ in range(Q)]","+tree = defaultdict(list)","+for a, b in ab:","+ tree[a - 1].append(b - 1)","+ tree[b - 1].append(a - 1)","+dic = defaultdict(int)","+for p, x in px:","+ dic[p - 1] += x","+ans = [0] * N","+checked = [0] * N","+checked[0] = 1","+q = deque([])","+q.append(0)","+while q:","+ n = q.popleft()","+ ans[n] += dic[n]","+ for node in tree[n]:","+ if checked[node]:","+ continue","+ ans[node] += ans[n]","+ checked[node] = 1","+ q.append(node)","+print((*ans))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0576446048,"measured_runtime_v1":0.0372002609,"runtime_lift":1.5495752843,"key":["s407038989","s283776829"]} +{"user_id":"u475402977","problem_id":"p02657","language":"python","submission_id_v0":"s949575025","submission_id_v1":"s410723424","cpu_time_v0":25,"cpu_time_v1":23,"memory_v0":9156,"memory_v1":9096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.0,"input":"N, M = list(map(int, input().split()))\n\nprint((N*M))","target":"a,b = list(map(float,input().split()))\n\na = int(a)\n\nb = int(b*1000)\n\nprint((int(a*b)\/\/1000))","code_v0_loc":2,"code_v1_loc":4,"code_v0_num_chars":44,"code_v1_num_chars":84,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nprint((N * M))\n","code_v1_no_empty_lines":"a, b = list(map(float, input().split()))\na = int(a)\nb = int(b * 1000)\nprint((int(a * b) \/\/ 1000))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-N, M = list(map(int, input().split()))","-print((N * M))","+a, b = list(map(float, input().split()))","+a = int(a)","+b = int(b * 1000)","+print((int(a * b) \/\/ 1000))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0650448684,"measured_runtime_v1":0.0448751785,"runtime_lift":1.4494620535,"key":["s949575025","s410723424"]} +{"user_id":"u179169725","problem_id":"p03283","language":"python","submission_id_v0":"s515183551","submission_id_v1":"s999863301","cpu_time_v0":1237,"cpu_time_v1":1104,"memory_v0":48896,"memory_v1":53300,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.75,"input":"# https:\/\/atcoder.jp\/contests\/abc106\/tasks\/abc106_d\n\n# \u3069\u3046\u3084\u3063\u305f\u3089\u9ad8\u901f\u306b\u533a\u9593[p,q]\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u533a\u9593\u306e\u6570\u3092\u53d6\u5f97\u3067\u304d\u308b\u304b\uff1f\n\n# p,q\u3092\u4e8c\u6b21\u5143\u5ea7\u6a19\u3068\u3057\u3066\u6349\u3048\u308b\u3068\u96fb\u8eca1\u672c\u306e\u7dda\u306f\u4e8c\u6b21\u5143\u5e73\u9762\u4e0a\u306e1\u70b9\u3068\u3057\u3066\u8868\u305b\u308b\n\n# \u3053\u306e\u3068\u304dp,q\u306e\u533a\u9593\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u96fb\u8eca\u306e\u672c\u6570\u3068\u3044\u3046\u306e\u306f\u3001x\u8ef8\u3001y\u8ef8\u306e\u4e21\u65b9\u306b\u304a\u3044\u3066[p,q]\u3068\u306a\u308b\u56db\u89d2\u5f62\u5185\u306b\u3042\u308b\u96fb\u8eca\u306e\u672c\u6570\n\n# query\u306b\u9ad8\u901f\u306b\u7b54\u3048\u308b\u305f\u3081\u306b\u4e8c\u6b21\u5143\u7d2f\u7a4d\u548c\u3092\u69cb\u7bc9\u3059\u308b\n\nimport sys\n\nread = sys.stdin.readline\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\ndef read_tuple(H):\n\n '''\n\n H is number of rows\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(tuple(map(int, read().split())))\n\n return ret\n\n\n\n\n\nimport numpy as np\n\n\n\nN, M, Q = read_ints()\n\nLR = read_tuple(M)\n\npq = read_tuple(Q)\n\n\n\n# numpy\u4f7f\u308f\u305a\u306b\u518d\u5b9f\u88c5 #\u5165\u308c\u308b\u3068\u304d\u306fpython\u306e\u307b\u3046\u304c\u901f\u3044\u306e\u3067\n\nLR2d = [[0] * (N + 1) for _ in range(N + 1)]\n\nfor L, R in LR:\n\n LR2d[L][R] += 1\n\nLR2d = np.array(LR2d, np.int64)\n\n\n\nLR2d_accum = np.zeros((N + 2, N + 2), np.int64)\n\nLR2d_accum[1:, 1:] = LR2d.cumsum(axis=0).cumsum(axis=1) # 1\u6b21\u5143\u7d2f\u7a4d\u548c\u540c\u69d8\u534a\u958b\u533a\u9593\u3067\u8003\u3048\u308b\n\n# \u3064\u307e\u308a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9i,j\u3068\u306f\u3082\u3068\u306e\u914d\u5217\u306b\u304a\u3044\u3066i,j\u3092\u542b\u307e\u306a\u3044\u56db\u89d2\u5f62\u306e\u9818\u57df\u306e\u5408\u8a08\u3092\u51fa\u3059\n\n\n\n# query\u306b\u7b54\u3048\u3066\u3044\u304f\n\nfor p, q in pq:\n\n print((LR2d_accum[q + 1, q + 1] - LR2d_accum[q + 1, p] -\n\n LR2d_accum[p, q + 1] + LR2d_accum[p, p]))\n","target":"# https:\/\/atcoder.jp\/contests\/abc106\/tasks\/abc106_d\n\n# \u3069\u3046\u3084\u3063\u305f\u3089\u9ad8\u901f\u306b\u533a\u9593[p,q]\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u533a\u9593\u306e\u6570\u3092\u53d6\u5f97\u3067\u304d\u308b\u304b\uff1f\n\n# p,q\u3092\u4e8c\u6b21\u5143\u5ea7\u6a19\u3068\u3057\u3066\u6349\u3048\u308b\u3068\u96fb\u8eca1\u672c\u306e\u7dda\u306f\u4e8c\u6b21\u5143\u5e73\u9762\u4e0a\u306e1\u70b9\u3068\u3057\u3066\u8868\u305b\u308b\n\n# \u3053\u306e\u3068\u304dp,q\u306e\u533a\u9593\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u96fb\u8eca\u306e\u672c\u6570\u3068\u3044\u3046\u306e\u306f\u3001x\u8ef8\u3001y\u8ef8\u306e\u4e21\u65b9\u306b\u304a\u3044\u3066[p,q]\u3068\u306a\u308b\u56db\u89d2\u5f62\u5185\u306b\u3042\u308b\u96fb\u8eca\u306e\u672c\u6570\n\n# query\u306b\u9ad8\u901f\u306b\u7b54\u3048\u308b\u305f\u3081\u306b\u4e8c\u6b21\u5143\u7d2f\u7a4d\u548c\u3092\u69cb\u7bc9\u3059\u308b\n\nimport sys\n\nread = sys.stdin.readline\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\ndef read_tuple(H):\n\n '''\n\n H is number of rows\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(tuple(map(int, read().split())))\n\n return ret\n\n\n\n\n\nimport numpy as np\n\n\n\nN, M, Q = read_ints()\n\nLR = read_tuple(M)\n\npq = read_tuple(Q)\n\n\n\n# numpy\u4f7f\u308f\u305a\u306b\u518d\u5b9f\u88c5 #\u5165\u308c\u308b\u3068\u304d\u306fpython\u306e\u307b\u3046\u304c\u901f\u3044\u306e\u3067\n\nLR2d = [[0] * (N + 1) for _ in range(N + 1)]\n\nfor L, R in LR:\n\n LR2d[L][R] += 1\n\nLR2d = np.array(LR2d, np.int64)\n\n\n\nLR2d_accum = np.zeros((N + 2, N + 2), np.int64)\n\nLR2d_accum[1:, 1:] = LR2d.cumsum(axis=0).cumsum(axis=1) # 1\u6b21\u5143\u7d2f\u7a4d\u548c\u540c\u69d8\u534a\u958b\u533a\u9593\u3067\u8003\u3048\u308b\n\n# \u3064\u307e\u308a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9i,j\u3068\u306f\u3082\u3068\u306e\u914d\u5217\u306b\u304a\u3044\u3066i,j\u3092\u542b\u307e\u306a\u3044\u56db\u89d2\u5f62\u306e\u9818\u57df\u306e\u5408\u8a08\u3092\u51fa\u3059\n\n\n\n# query\u306b\u7b54\u3048\u3066\u3044\u304f\n\nans = []\n\nfor p, q in pq:\n\n ans.append(LR2d_accum[q + 1, q + 1] - LR2d_accum[q + 1, p] -\n\n LR2d_accum[p, q + 1] + LR2d_accum[p, p])\n\n\n\nprint(*ans, sep='\\n')\n","code_v0_loc":43,"code_v1_loc":46,"code_v0_num_chars":1077,"code_v1_num_chars":1122,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc106\/tasks\/abc106_d\n# \u3069\u3046\u3084\u3063\u305f\u3089\u9ad8\u901f\u306b\u533a\u9593[p,q]\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u533a\u9593\u306e\u6570\u3092\u53d6\u5f97\u3067\u304d\u308b\u304b\uff1f\n# p,q\u3092\u4e8c\u6b21\u5143\u5ea7\u6a19\u3068\u3057\u3066\u6349\u3048\u308b\u3068\u96fb\u8eca1\u672c\u306e\u7dda\u306f\u4e8c\u6b21\u5143\u5e73\u9762\u4e0a\u306e1\u70b9\u3068\u3057\u3066\u8868\u305b\u308b\n# \u3053\u306e\u3068\u304dp,q\u306e\u533a\u9593\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u96fb\u8eca\u306e\u672c\u6570\u3068\u3044\u3046\u306e\u306f\u3001x\u8ef8\u3001y\u8ef8\u306e\u4e21\u65b9\u306b\u304a\u3044\u3066[p,q]\u3068\u306a\u308b\u56db\u89d2\u5f62\u5185\u306b\u3042\u308b\u96fb\u8eca\u306e\u672c\u6570\n# query\u306b\u9ad8\u901f\u306b\u7b54\u3048\u308b\u305f\u3081\u306b\u4e8c\u6b21\u5143\u7d2f\u7a4d\u548c\u3092\u69cb\u7bc9\u3059\u308b\nimport sys\n\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_tuple(H):\n \"\"\"\n H is number of rows\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, read().split())))\n return ret\n\n\nimport numpy as np\n\nN, M, Q = read_ints()\nLR = read_tuple(M)\npq = read_tuple(Q)\n# numpy\u4f7f\u308f\u305a\u306b\u518d\u5b9f\u88c5 #\u5165\u308c\u308b\u3068\u304d\u306fpython\u306e\u307b\u3046\u304c\u901f\u3044\u306e\u3067\nLR2d = [[0] * (N + 1) for _ in range(N + 1)]\nfor L, R in LR:\n LR2d[L][R] += 1\nLR2d = np.array(LR2d, np.int64)\nLR2d_accum = np.zeros((N + 2, N + 2), np.int64)\nLR2d_accum[1:, 1:] = LR2d.cumsum(axis=0).cumsum(axis=1) # 1\u6b21\u5143\u7d2f\u7a4d\u548c\u540c\u69d8\u534a\u958b\u533a\u9593\u3067\u8003\u3048\u308b\n# \u3064\u307e\u308a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9i,j\u3068\u306f\u3082\u3068\u306e\u914d\u5217\u306b\u304a\u3044\u3066i,j\u3092\u542b\u307e\u306a\u3044\u56db\u89d2\u5f62\u306e\u9818\u57df\u306e\u5408\u8a08\u3092\u51fa\u3059\n# query\u306b\u7b54\u3048\u3066\u3044\u304f\nfor p, q in pq:\n print(\n (\n LR2d_accum[q + 1, q + 1]\n - LR2d_accum[q + 1, p]\n - LR2d_accum[p, q + 1]\n + LR2d_accum[p, p]\n )\n )\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc106\/tasks\/abc106_d\n# \u3069\u3046\u3084\u3063\u305f\u3089\u9ad8\u901f\u306b\u533a\u9593[p,q]\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u533a\u9593\u306e\u6570\u3092\u53d6\u5f97\u3067\u304d\u308b\u304b\uff1f\n# p,q\u3092\u4e8c\u6b21\u5143\u5ea7\u6a19\u3068\u3057\u3066\u6349\u3048\u308b\u3068\u96fb\u8eca1\u672c\u306e\u7dda\u306f\u4e8c\u6b21\u5143\u5e73\u9762\u4e0a\u306e1\u70b9\u3068\u3057\u3066\u8868\u305b\u308b\n# \u3053\u306e\u3068\u304dp,q\u306e\u533a\u9593\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u96fb\u8eca\u306e\u672c\u6570\u3068\u3044\u3046\u306e\u306f\u3001x\u8ef8\u3001y\u8ef8\u306e\u4e21\u65b9\u306b\u304a\u3044\u3066[p,q]\u3068\u306a\u308b\u56db\u89d2\u5f62\u5185\u306b\u3042\u308b\u96fb\u8eca\u306e\u672c\u6570\n# query\u306b\u9ad8\u901f\u306b\u7b54\u3048\u308b\u305f\u3081\u306b\u4e8c\u6b21\u5143\u7d2f\u7a4d\u548c\u3092\u69cb\u7bc9\u3059\u308b\nimport sys\n\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_tuple(H):\n \"\"\"\n H is number of rows\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, read().split())))\n return ret\n\n\nimport numpy as np\n\nN, M, Q = read_ints()\nLR = read_tuple(M)\npq = read_tuple(Q)\n# numpy\u4f7f\u308f\u305a\u306b\u518d\u5b9f\u88c5 #\u5165\u308c\u308b\u3068\u304d\u306fpython\u306e\u307b\u3046\u304c\u901f\u3044\u306e\u3067\nLR2d = [[0] * (N + 1) for _ in range(N + 1)]\nfor L, R in LR:\n LR2d[L][R] += 1\nLR2d = np.array(LR2d, np.int64)\nLR2d_accum = np.zeros((N + 2, N + 2), np.int64)\nLR2d_accum[1:, 1:] = LR2d.cumsum(axis=0).cumsum(axis=1) # 1\u6b21\u5143\u7d2f\u7a4d\u548c\u540c\u69d8\u534a\u958b\u533a\u9593\u3067\u8003\u3048\u308b\n# \u3064\u307e\u308a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9i,j\u3068\u306f\u3082\u3068\u306e\u914d\u5217\u306b\u304a\u3044\u3066i,j\u3092\u542b\u307e\u306a\u3044\u56db\u89d2\u5f62\u306e\u9818\u57df\u306e\u5408\u8a08\u3092\u51fa\u3059\n# query\u306b\u7b54\u3048\u3066\u3044\u304f\nans = []\nfor p, q in pq:\n ans.append(\n LR2d_accum[q + 1, q + 1]\n - LR2d_accum[q + 1, p]\n - LR2d_accum[p, q + 1]\n + LR2d_accum[p, p]\n )\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":6.5217391304,"diff":["+ans = []","- print(","- (","- LR2d_accum[q + 1, q + 1]","- - LR2d_accum[q + 1, p]","- - LR2d_accum[p, q + 1]","- + LR2d_accum[p, p]","- )","+ ans.append(","+ LR2d_accum[q + 1, q + 1]","+ - LR2d_accum[q + 1, p]","+ - LR2d_accum[p, q + 1]","+ + LR2d_accum[p, p]","+print(*ans, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.2009805231,"measured_runtime_v1":0.2747292843,"runtime_lift":0.7315584271,"key":["s515183551","s999863301"]} +{"user_id":"u634079249","problem_id":"p02548","language":"python","submission_id_v0":"s407907141","submission_id_v1":"s587686540","cpu_time_v0":148,"cpu_time_v1":105,"memory_v0":9912,"memory_v1":9664,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.05,"input":"import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array\n\n\n\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n\n# from decimal import Decimal\n\n# from collections import defaultdict, deque\n\n\n\nsys.setrecursionlimit(10000000)\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\nlcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)\n\n\n\nMOD = 10 ** 9 + 7\n\nINF = float('inf')\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n\n\n ret = 0\n\n for a in range(1, N):\n\n b = N \/\/ a\n\n if N - (a * b) <= 0:\n\n ret += b - 1\n\n else:\n\n ret += b\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nimport os\n\nimport math\n\nimport bisect\n\nimport itertools\n\nimport collections\n\nimport heapq\n\nimport queue\n\nimport array\n\n\n\n# \u6642\u3005\u4f7f\u3046\n\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n\n# from decimal import Decimal\n\n# from collections import defaultdict, deque\n\n\n\n# \u518d\u5e30\u306e\u5236\u9650\u8a2d\u5b9a\n\nsys.setrecursionlimit(10000000)\n\n\n\n\n\ndef ii(): return int(sys.stdin.buffer.readline().rstrip())\n\ndef il(): return list(map(int, sys.stdin.buffer.readline().split()))\n\ndef fl(): return list(map(float, sys.stdin.buffer.readline().split()))\n\ndef iln(n): return [int(sys.stdin.buffer.readline().rstrip())\n\n for _ in range(n)]\n\n\n\n\n\ndef iss(): return sys.stdin.buffer.readline().decode().rstrip()\n\ndef sl(): return list(map(str, sys.stdin.buffer.readline().decode().split()))\n\ndef isn(n): return [sys.stdin.buffer.readline().decode().rstrip()\n\n for _ in range(n)]\n\n\n\n\n\ndef lcm(x, y): return (x * y) \/\/ math.gcd(x, y)\n\n\n\n\n\nMOD = 10 ** 9 + 7\n\nINF = float('inf')\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = ii()\n\n\n\n ret = 0\n\n for i in range(1, N):\n\n ret += (N - 1) \/\/ i\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":41,"code_v1_loc":53,"code_v0_num_chars":1166,"code_v1_num_chars":1230,"code_v0_no_empty_lines":"import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array\n\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n# from decimal import Decimal\n# from collections import defaultdict, deque\nsys.setrecursionlimit(10000000)\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\nlcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)\nMOD = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = ii()\n ret = 0\n for a in range(1, N):\n b = N \/\/ a\n if N - (a * b) <= 0:\n ret += b - 1\n else:\n ret += b\n print(ret)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport os\nimport math\nimport bisect\nimport itertools\nimport collections\nimport heapq\nimport queue\nimport array\n\n# \u6642\u3005\u4f7f\u3046\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\n# from decimal import Decimal\n# from collections import defaultdict, deque\n# \u518d\u5e30\u306e\u5236\u9650\u8a2d\u5b9a\nsys.setrecursionlimit(10000000)\n\n\ndef ii():\n return int(sys.stdin.buffer.readline().rstrip())\n\n\ndef il():\n return list(map(int, sys.stdin.buffer.readline().split()))\n\n\ndef fl():\n return list(map(float, sys.stdin.buffer.readline().split()))\n\n\ndef iln(n):\n return [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\ndef iss():\n return sys.stdin.buffer.readline().decode().rstrip()\n\n\ndef sl():\n return list(map(str, sys.stdin.buffer.readline().decode().split()))\n\n\ndef isn(n):\n return [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\ndef lcm(x, y):\n return (x * y) \/\/ math.gcd(x, y)\n\n\nMOD = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = ii()\n ret = 0\n for i in range(1, N):\n ret += (N - 1) \/\/ i\n print(ret)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":22.641509434,"diff":["-import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array","+import sys","+import os","+import math","+import bisect","+import itertools","+import collections","+import heapq","+import queue","+import array","+# \u6642\u3005\u4f7f\u3046","+# \u518d\u5e30\u306e\u5236\u9650\u8a2d\u5b9a","-ii = lambda: int(sys.stdin.buffer.readline().rstrip())","-il = lambda: list(map(int, sys.stdin.buffer.readline().split()))","-fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))","-iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]","-iss = lambda: sys.stdin.buffer.readline().decode().rstrip()","-sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))","-isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]","-lcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)","+","+","+def ii():","+ return int(sys.stdin.buffer.readline().rstrip())","+","+","+def il():","+ return list(map(int, sys.stdin.buffer.readline().split()))","+","+","+def fl():","+ return list(map(float, sys.stdin.buffer.readline().split()))","+","+","+def iln(n):","+ return [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]","+","+","+def iss():","+ return sys.stdin.buffer.readline().decode().rstrip()","+","+","+def sl():","+ return list(map(str, sys.stdin.buffer.readline().decode().split()))","+","+","+def isn(n):","+ return [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]","+","+","+def lcm(x, y):","+ return (x * y) \/\/ math.gcd(x, y)","+","+","- for a in range(1, N):","- b = N \/\/ a","- if N - (a * b) <= 0:","- ret += b - 1","- else:","- ret += b","+ for i in range(1, N):","+ ret += (N - 1) \/\/ i"],"diff_only_import_comment":false,"measured_runtime_v0":0.0607523565,"measured_runtime_v1":0.0655764618,"runtime_lift":0.9264354139,"key":["s407907141","s587686540"]} +{"user_id":"u963009166","problem_id":"p03448","language":"python","submission_id_v0":"s554281164","submission_id_v1":"s119622553","cpu_time_v0":182,"cpu_time_v1":18,"memory_v0":39536,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.11,"input":"A = int(eval(input())) #500\n\nB = int(eval(input())) #100\n\nC = int(eval(input())) #50\n\nX = int(eval(input())) #sum\n\ncount = 0\n\n\n\nfor a in range(A + 1):\n\n for b in range(B + 1):\n\n for c in range(C + 1):\n\n if 500 * a + 100 * b + 50 * c == X:\n\n count += 1\n\n\n\nprint(count)\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nA = int(eval(input())) #500\n\nB = int(eval(input())) #100\n\nC = int(eval(input())) #50\n\nX = int(eval(input())) #sum\n\ncount = 0\n\n\n\nfor a in range(A + 1):\n\n for b in range(B + 1):\n\n if 500 * a + 100 * b <= X <= 500 * a + 100 * b + 50 * C:\n\n count += 1\n\n\n\nprint(count)\n","code_v0_loc":13,"code_v1_loc":15,"code_v0_num_chars":280,"code_v1_num_chars":303,"code_v0_no_empty_lines":"A = int(eval(input())) # 500\nB = int(eval(input())) # 100\nC = int(eval(input())) # 50\nX = int(eval(input())) # sum\ncount = 0\nfor a in range(A + 1):\n for b in range(B + 1):\n for c in range(C + 1):\n if 500 * a + 100 * b + 50 * c == X:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nA = int(eval(input())) # 500\nB = int(eval(input())) # 100\nC = int(eval(input())) # 50\nX = int(eval(input())) # sum\ncount = 0\nfor a in range(A + 1):\n for b in range(B + 1):\n if 500 * a + 100 * b <= X <= 500 * a + 100 * b + 50 * C:\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["+import sys","+","+input = sys.stdin.readline","- for c in range(C + 1):","- if 500 * a + 100 * b + 50 * c == X:","- count += 1","+ if 500 * a + 100 * b <= X <= 500 * a + 100 * b + 50 * C:","+ count += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.1088931544,"measured_runtime_v1":0.0379685366,"runtime_lift":2.8679839694,"key":["s554281164","s119622553"]} +{"user_id":"u811967730","problem_id":"p03610","language":"python","submission_id_v0":"s737948587","submission_id_v1":"s382024847","cpu_time_v0":38,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.26,"input":"s = eval(input())\n\nodd_string = \"\"\n\n\n\nfor i, c in enumerate(s):\n\n if i % 2 == 0:\n\n odd_string += c\n\n\n\nprint(odd_string)\n","target":"s = eval(input())\n\nodd_string = s[::2]\n\n\n\nprint(odd_string)\n","code_v0_loc":8,"code_v1_loc":4,"code_v0_num_chars":124,"code_v1_num_chars":54,"code_v0_no_empty_lines":"s = eval(input())\nodd_string = \"\"\nfor i, c in enumerate(s):\n if i % 2 == 0:\n odd_string += c\nprint(odd_string)\n","code_v1_no_empty_lines":"s = eval(input())\nodd_string = s[::2]\nprint(odd_string)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-odd_string = \"\"","-for i, c in enumerate(s):","- if i % 2 == 0:","- odd_string += c","+odd_string = s[::2]"],"diff_only_import_comment":false,"measured_runtime_v0":0.085380888,"measured_runtime_v1":0.0815525055,"runtime_lift":1.0469437752,"key":["s737948587","s382024847"]} +{"user_id":"u186838327","problem_id":"p03733","language":"python","submission_id_v0":"s383524714","submission_id_v1":"s651290787","cpu_time_v0":261,"cpu_time_v1":108,"memory_v0":85328,"memory_v1":105340,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.62,"input":"n, t = list(map(int, input().split()))\n\nT = list(map(int, input().split()))\n\nans = 0\n\nx_ = 0\n\nfor x in T:\n\n if x-x_ >= t:\n\n ans += t\n\n else:\n\n ans += x-x_\n\n x_ = x\n\nans += t\n\nprint(ans)\n","target":"n, T = list(map(int, input().split()))\n\nX = list(map(int, input().split()))\n\n\n\nans = 0\n\nY = []\n\nfor i in range(n-1):\n\n Y.append(X[i+1]-X[i])\n\n\n\nans = 0\n\nfor y in Y:\n\n ans += min(T, y)\n\nans += T\n\nprint(ans)\n","code_v0_loc":12,"code_v1_loc":13,"code_v0_num_chars":203,"code_v1_num_chars":206,"code_v0_no_empty_lines":"n, t = list(map(int, input().split()))\nT = list(map(int, input().split()))\nans = 0\nx_ = 0\nfor x in T:\n if x - x_ >= t:\n ans += t\n else:\n ans += x - x_\n x_ = x\nans += t\nprint(ans)\n","code_v1_no_empty_lines":"n, T = list(map(int, input().split()))\nX = list(map(int, input().split()))\nans = 0\nY = []\nfor i in range(n - 1):\n Y.append(X[i + 1] - X[i])\nans = 0\nfor y in Y:\n ans += min(T, y)\nans += T\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-n, t = list(map(int, input().split()))","-T = list(map(int, input().split()))","+n, T = list(map(int, input().split()))","+X = list(map(int, input().split()))","-x_ = 0","-for x in T:","- if x - x_ >= t:","- ans += t","- else:","- ans += x - x_","- x_ = x","-ans += t","+Y = []","+for i in range(n - 1):","+ Y.append(X[i + 1] - X[i])","+ans = 0","+for y in Y:","+ ans += min(T, y)","+ans += T"],"diff_only_import_comment":false,"measured_runtime_v0":0.0386842299,"measured_runtime_v1":0.0376552943,"runtime_lift":1.0273251239,"key":["s383524714","s651290787"]} +{"user_id":"u312025627","problem_id":"p02952","language":"python","submission_id_v0":"s533339607","submission_id_v1":"s279531123","cpu_time_v0":206,"cpu_time_v1":179,"memory_v0":42972,"memory_v1":44272,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.11,"input":"n = int(eval(input()))\n\nprint((len(list([x for x in range(1,n+1) if len(str(x))%2 == 1]))))","target":"n = int(eval(input()))\n\ngen = (x for x in range(1,n+1) if len(str(x))%2 == 1)\n\nprint((len(list(gen))))","code_v0_loc":2,"code_v1_loc":3,"code_v0_num_chars":86,"code_v1_num_chars":94,"code_v0_no_empty_lines":"n = int(eval(input()))\nprint((len(list([x for x in range(1, n + 1) if len(str(x)) % 2 == 1]))))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ngen = (x for x in range(1, n + 1) if len(str(x)) % 2 == 1)\nprint((len(list(gen))))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-print((len(list([x for x in range(1, n + 1) if len(str(x)) % 2 == 1]))))","+gen = (x for x in range(1, n + 1) if len(str(x)) % 2 == 1)","+print((len(list(gen))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1531428413,"measured_runtime_v1":0.043946069,"runtime_lift":3.4847904439,"key":["s533339607","s279531123"]} +{"user_id":"u404676457","problem_id":"p03463","language":"python","submission_id_v0":"s953257292","submission_id_v1":"s206736742","cpu_time_v0":20,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"n, a, b = list(map(int, input().split()))\n\nif (b - a) % 2 == 0:\n\n print('Alice')\n\nelse:\n\n print('Borys')\n","target":"n, a, b = list(map(int, input().split()))\n\nprint(('Alice' if (b - a) % 2 == 0 else 'Borys'))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":105,"code_v1_num_chars":84,"code_v0_no_empty_lines":"n, a, b = list(map(int, input().split()))\nif (b - a) % 2 == 0:\n print(\"Alice\")\nelse:\n print(\"Borys\")\n","code_v1_no_empty_lines":"n, a, b = list(map(int, input().split()))\nprint((\"Alice\" if (b - a) % 2 == 0 else \"Borys\"))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-if (b - a) % 2 == 0:","- print(\"Alice\")","-else:","- print(\"Borys\")","+print((\"Alice\" if (b - a) % 2 == 0 else \"Borys\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0479993374,"measured_runtime_v1":0.0477574506,"runtime_lift":1.0050649028,"key":["s953257292","s206736742"]} +{"user_id":"u535803878","problem_id":"p02680","language":"python","submission_id_v0":"s921450751","submission_id_v1":"s420537027","cpu_time_v0":2978,"cpu_time_v1":2718,"memory_v0":640304,"memory_v1":640324,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.73,"input":"import sys\n\ninput = lambda : sys.stdin.readline().rstrip()\n\nsys.setrecursionlimit(max(1000, 10**9))\n\nwrite = lambda x: sys.stdout.write(x+\"\\n\")\n\n\n\n\n\nn,m = list(map(int, input().split()))\n\n\n\nlx = [None] * n\n\nly = [None] * m\n\nsx = set([-10**10, 0, 10**10])\n\nsy = set([-10**10, 0, 10**10])\n\nix = 0\n\niy = 0\n\nfor i in range(n):\n\n t = tuple(map(int, input().split()))\n\n lx[i] = t\n\n sx.add(t[0])\n\n sx.add(t[1])\n\n sy.add(t[2])\n\n \n\nfor i in range(m):\n\n t = tuple(map(int, input().split()))\n\n ly[i] = t\n\n sx.add(t[0])\n\n sy.add(t[1])\n\n sy.add(t[2])\n\n \n\nxs = list(sx)\n\nys = list(sy)\n\nxs.sort(); ys.sort()\n\n\n\nwx = len(xs)*2\n\nwy = len(ys)*2\n\nbs = [[1]*wy for _ in range(wx)]\n\nimport bisect\n\nfor i, (x0, x1, y) in enumerate(lx):\n\n ix0 = bisect.bisect_left(xs, x0)*2\n\n ix1 = bisect.bisect_left(xs, x1)*2\n\n iy = bisect.bisect_left(ys, y)*2\n\n for ii in range(ix0, ix1):\n\n bs[ii][iy] = -1\n\nfor i, (x, y0, y1) in enumerate(ly):\n\n ix = bisect.bisect_left(xs, x)*2\n\n iy0 = bisect.bisect_left(ys, y0)*2\n\n iy1 = bisect.bisect_left(ys, y1)*2\n\n for ii in range(iy0, iy1):\n\n bs[ix][ii] = -1\n\n\n\nxx = bisect.bisect_left(xs, 0)*2+1\n\nyy = bisect.bisect_left(ys, 0)*2+1\n\ns = [(xx,yy)]\n\ndx = [-1,0,1,0]\n\ndy = [0,-1,0,1]\n\nans = 0\n\nend = False\n\nwhile s:\n\n ix,iy = s.pop()\n\n for x, y in zip(dx,dy):\n\n ixx = ix + x\n\n iyy = iy + y\n\n if bs[ixx][iyy]!=1:\n\n continue\n\n ixx += x\n\n iyy += y\n\n if bs[ixx][iyy]!=1:\n\n continue\n\n if ixx<0 or ixx>=wx-1 or iyy<0 or iyy>=wy-1:\n\n print(\"INF\")\n\n s = []\n\n end = True\n\n break\n\n bs[ixx][iyy] = 2\n\n ans += (xs[ixx\/\/2+1] - xs[ixx\/\/2]) * (ys[iyy\/\/2+1] - ys[iyy\/\/2])\n\n s.append((ixx, iyy))\n\n \n\nif not end:\n\n print(ans)\n","target":"def main():\n\n import sys\n\n input = lambda : sys.stdin.readline().rstrip()\n\n sys.setrecursionlimit(max(1000, 10**9))\n\n write = lambda x: sys.stdout.write(x+\"\\n\")\n\n\n\n\n\n n,m = list(map(int, input().split()))\n\n\n\n lx = [None] * n\n\n ly = [None] * m\n\n sx = set([-10**10, 0, 10**10])\n\n sy = set([-10**10, 0, 10**10])\n\n ix = 0\n\n iy = 0\n\n for i in range(n):\n\n t = tuple(map(int, input().split()))\n\n lx[i] = t\n\n sx.add(t[0])\n\n sx.add(t[1])\n\n sy.add(t[2])\n\n\n\n for i in range(m):\n\n t = tuple(map(int, input().split()))\n\n ly[i] = t\n\n sx.add(t[0])\n\n sy.add(t[1])\n\n sy.add(t[2])\n\n\n\n xs = list(sx)\n\n ys = list(sy)\n\n xs.sort(); ys.sort()\n\n\n\n wx = len(xs)*2\n\n wy = len(ys)*2\n\n bs = [[1]*wy for _ in range(wx)]\n\n import bisect\n\n for i, (x0, x1, y) in enumerate(lx):\n\n ix0 = bisect.bisect_left(xs, x0)*2\n\n ix1 = bisect.bisect_left(xs, x1)*2\n\n iy = bisect.bisect_left(ys, y)*2\n\n for ii in range(ix0+1, ix1, 2):\n\n bs[ii][iy] = -1\n\n for i, (x, y0, y1) in enumerate(ly):\n\n ix = bisect.bisect_left(xs, x)*2\n\n iy0 = bisect.bisect_left(ys, y0)*2\n\n iy1 = bisect.bisect_left(ys, y1)*2\n\n for ii in range(iy0+1, iy1, 2):\n\n bs[ix][ii] = -1\n\n\n\n xx = bisect.bisect_left(xs, 0)*2+1\n\n yy = bisect.bisect_left(ys, 0)*2+1\n\n s = [(xx,yy)]\n\n dx = [-1,0,1,0]\n\n dy = [0,-1,0,1]\n\n ans = 0\n\n end = False\n\n while s:\n\n ix,iy = s.pop()\n\n for x, y in zip(dx,dy):\n\n ixx = ix + x\n\n iyy = iy + y\n\n if bs[ixx][iyy]!=1:\n\n continue\n\n ixx += x\n\n iyy += y\n\n if bs[ixx][iyy]!=1:\n\n continue\n\n if ixx<0 or ixx>=wx-1 or iyy<0 or iyy>=wy-1:\n\n print(\"INF\")\n\n s = []\n\n end = True\n\n break\n\n bs[ixx][iyy] = 2\n\n ans += (xs[ixx\/\/2+1] - xs[ixx\/\/2]) * (ys[iyy\/\/2+1] - ys[iyy\/\/2])\n\n s.append((ixx, iyy))\n\n\n\n if not end:\n\n print(ans)\n\nmain()","code_v0_loc":78,"code_v1_loc":80,"code_v0_num_chars":1843,"code_v1_num_chars":2125,"code_v0_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\nsys.setrecursionlimit(max(1000, 10**9))\nwrite = lambda x: sys.stdout.write(x + \"\\n\")\nn, m = list(map(int, input().split()))\nlx = [None] * n\nly = [None] * m\nsx = set([-(10**10), 0, 10**10])\nsy = set([-(10**10), 0, 10**10])\nix = 0\niy = 0\nfor i in range(n):\n t = tuple(map(int, input().split()))\n lx[i] = t\n sx.add(t[0])\n sx.add(t[1])\n sy.add(t[2])\nfor i in range(m):\n t = tuple(map(int, input().split()))\n ly[i] = t\n sx.add(t[0])\n sy.add(t[1])\n sy.add(t[2])\nxs = list(sx)\nys = list(sy)\nxs.sort()\nys.sort()\nwx = len(xs) * 2\nwy = len(ys) * 2\nbs = [[1] * wy for _ in range(wx)]\nimport bisect\n\nfor i, (x0, x1, y) in enumerate(lx):\n ix0 = bisect.bisect_left(xs, x0) * 2\n ix1 = bisect.bisect_left(xs, x1) * 2\n iy = bisect.bisect_left(ys, y) * 2\n for ii in range(ix0, ix1):\n bs[ii][iy] = -1\nfor i, (x, y0, y1) in enumerate(ly):\n ix = bisect.bisect_left(xs, x) * 2\n iy0 = bisect.bisect_left(ys, y0) * 2\n iy1 = bisect.bisect_left(ys, y1) * 2\n for ii in range(iy0, iy1):\n bs[ix][ii] = -1\nxx = bisect.bisect_left(xs, 0) * 2 + 1\nyy = bisect.bisect_left(ys, 0) * 2 + 1\ns = [(xx, yy)]\ndx = [-1, 0, 1, 0]\ndy = [0, -1, 0, 1]\nans = 0\nend = False\nwhile s:\n ix, iy = s.pop()\n for x, y in zip(dx, dy):\n ixx = ix + x\n iyy = iy + y\n if bs[ixx][iyy] != 1:\n continue\n ixx += x\n iyy += y\n if bs[ixx][iyy] != 1:\n continue\n if ixx < 0 or ixx >= wx - 1 or iyy < 0 or iyy >= wy - 1:\n print(\"INF\")\n s = []\n end = True\n break\n bs[ixx][iyy] = 2\n ans += (xs[ixx \/\/ 2 + 1] - xs[ixx \/\/ 2]) * (ys[iyy \/\/ 2 + 1] - ys[iyy \/\/ 2])\n s.append((ixx, iyy))\nif not end:\n print(ans)\n","code_v1_no_empty_lines":"def main():\n import sys\n\n input = lambda: sys.stdin.readline().rstrip()\n sys.setrecursionlimit(max(1000, 10**9))\n write = lambda x: sys.stdout.write(x + \"\\n\")\n n, m = list(map(int, input().split()))\n lx = [None] * n\n ly = [None] * m\n sx = set([-(10**10), 0, 10**10])\n sy = set([-(10**10), 0, 10**10])\n ix = 0\n iy = 0\n for i in range(n):\n t = tuple(map(int, input().split()))\n lx[i] = t\n sx.add(t[0])\n sx.add(t[1])\n sy.add(t[2])\n for i in range(m):\n t = tuple(map(int, input().split()))\n ly[i] = t\n sx.add(t[0])\n sy.add(t[1])\n sy.add(t[2])\n xs = list(sx)\n ys = list(sy)\n xs.sort()\n ys.sort()\n wx = len(xs) * 2\n wy = len(ys) * 2\n bs = [[1] * wy for _ in range(wx)]\n import bisect\n\n for i, (x0, x1, y) in enumerate(lx):\n ix0 = bisect.bisect_left(xs, x0) * 2\n ix1 = bisect.bisect_left(xs, x1) * 2\n iy = bisect.bisect_left(ys, y) * 2\n for ii in range(ix0 + 1, ix1, 2):\n bs[ii][iy] = -1\n for i, (x, y0, y1) in enumerate(ly):\n ix = bisect.bisect_left(xs, x) * 2\n iy0 = bisect.bisect_left(ys, y0) * 2\n iy1 = bisect.bisect_left(ys, y1) * 2\n for ii in range(iy0 + 1, iy1, 2):\n bs[ix][ii] = -1\n xx = bisect.bisect_left(xs, 0) * 2 + 1\n yy = bisect.bisect_left(ys, 0) * 2 + 1\n s = [(xx, yy)]\n dx = [-1, 0, 1, 0]\n dy = [0, -1, 0, 1]\n ans = 0\n end = False\n while s:\n ix, iy = s.pop()\n for x, y in zip(dx, dy):\n ixx = ix + x\n iyy = iy + y\n if bs[ixx][iyy] != 1:\n continue\n ixx += x\n iyy += y\n if bs[ixx][iyy] != 1:\n continue\n if ixx < 0 or ixx >= wx - 1 or iyy < 0 or iyy >= wy - 1:\n print(\"INF\")\n s = []\n end = True\n break\n bs[ixx][iyy] = 2\n ans += (xs[ixx \/\/ 2 + 1] - xs[ixx \/\/ 2]) * (ys[iyy \/\/ 2 + 1] - ys[iyy \/\/ 2])\n s.append((ixx, iyy))\n if not end:\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":2.5,"diff":["-import sys","+def main():","+ import sys","-input = lambda: sys.stdin.readline().rstrip()","-sys.setrecursionlimit(max(1000, 10**9))","-write = lambda x: sys.stdout.write(x + \"\\n\")","-n, m = list(map(int, input().split()))","-lx = [None] * n","-ly = [None] * m","-sx = set([-(10**10), 0, 10**10])","-sy = set([-(10**10), 0, 10**10])","-ix = 0","-iy = 0","-for i in range(n):","- t = tuple(map(int, input().split()))","- lx[i] = t","- sx.add(t[0])","- sx.add(t[1])","- sy.add(t[2])","-for i in range(m):","- t = tuple(map(int, input().split()))","- ly[i] = t","- sx.add(t[0])","- sy.add(t[1])","- sy.add(t[2])","-xs = list(sx)","-ys = list(sy)","-xs.sort()","-ys.sort()","-wx = len(xs) * 2","-wy = len(ys) * 2","-bs = [[1] * wy for _ in range(wx)]","-import bisect","+ input = lambda: sys.stdin.readline().rstrip()","+ sys.setrecursionlimit(max(1000, 10**9))","+ write = lambda x: sys.stdout.write(x + \"\\n\")","+ n, m = list(map(int, input().split()))","+ lx = [None] * n","+ ly = [None] * m","+ sx = set([-(10**10), 0, 10**10])","+ sy = set([-(10**10), 0, 10**10])","+ ix = 0","+ iy = 0","+ for i in range(n):","+ t = tuple(map(int, input().split()))","+ lx[i] = t","+ sx.add(t[0])","+ sx.add(t[1])","+ sy.add(t[2])","+ for i in range(m):","+ t = tuple(map(int, input().split()))","+ ly[i] = t","+ sx.add(t[0])","+ sy.add(t[1])","+ sy.add(t[2])","+ xs = list(sx)","+ ys = list(sy)","+ xs.sort()","+ ys.sort()","+ wx = len(xs) * 2","+ wy = len(ys) * 2","+ bs = [[1] * wy for _ in range(wx)]","+ import bisect","-for i, (x0, x1, y) in enumerate(lx):","- ix0 = bisect.bisect_left(xs, x0) * 2","- ix1 = bisect.bisect_left(xs, x1) * 2","- iy = bisect.bisect_left(ys, y) * 2","- for ii in range(ix0, ix1):","- bs[ii][iy] = -1","-for i, (x, y0, y1) in enumerate(ly):","- ix = bisect.bisect_left(xs, x) * 2","- iy0 = bisect.bisect_left(ys, y0) * 2","- iy1 = bisect.bisect_left(ys, y1) * 2","- for ii in range(iy0, iy1):","- bs[ix][ii] = -1","-xx = bisect.bisect_left(xs, 0) * 2 + 1","-yy = bisect.bisect_left(ys, 0) * 2 + 1","-s = [(xx, yy)]","-dx = [-1, 0, 1, 0]","-dy = [0, -1, 0, 1]","-ans = 0","-end = False","-while s:","- ix, iy = s.pop()","- for x, y in zip(dx, dy):","- ixx = ix + x","- iyy = iy + y","- if bs[ixx][iyy] != 1:","- continue","- ixx += x","- iyy += y","- if bs[ixx][iyy] != 1:","- continue","- if ixx < 0 or ixx >= wx - 1 or iyy < 0 or iyy >= wy - 1:","- print(\"INF\")","- s = []","- end = True","- break","- bs[ixx][iyy] = 2","- ans += (xs[ixx \/\/ 2 + 1] - xs[ixx \/\/ 2]) * (ys[iyy \/\/ 2 + 1] - ys[iyy \/\/ 2])","- s.append((ixx, iyy))","-if not end:","- print(ans)","+ for i, (x0, x1, y) in enumerate(lx):","+ ix0 = bisect.bisect_left(xs, x0) * 2","+ ix1 = bisect.bisect_left(xs, x1) * 2","+ iy = bisect.bisect_left(ys, y) * 2","+ for ii in range(ix0 + 1, ix1, 2):","+ bs[ii][iy] = -1","+ for i, (x, y0, y1) in enumerate(ly):","+ ix = bisect.bisect_left(xs, x) * 2","+ iy0 = bisect.bisect_left(ys, y0) * 2","+ iy1 = bisect.bisect_left(ys, y1) * 2","+ for ii in range(iy0 + 1, iy1, 2):","+ bs[ix][ii] = -1","+ xx = bisect.bisect_left(xs, 0) * 2 + 1","+ yy = bisect.bisect_left(ys, 0) * 2 + 1","+ s = [(xx, yy)]","+ dx = [-1, 0, 1, 0]","+ dy = [0, -1, 0, 1]","+ ans = 0","+ end = False","+ while s:","+ ix, iy = s.pop()","+ for x, y in zip(dx, dy):","+ ixx = ix + x","+ iyy = iy + y","+ if bs[ixx][iyy] != 1:","+ continue","+ ixx += x","+ iyy += y","+ if bs[ixx][iyy] != 1:","+ continue","+ if ixx < 0 or ixx >= wx - 1 or iyy < 0 or iyy >= wy - 1:","+ print(\"INF\")","+ s = []","+ end = True","+ break","+ bs[ixx][iyy] = 2","+ ans += (xs[ixx \/\/ 2 + 1] - xs[ixx \/\/ 2]) * (ys[iyy \/\/ 2 + 1] - ys[iyy \/\/ 2])","+ s.append((ixx, iyy))","+ if not end:","+ print(ans)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0398869177,"measured_runtime_v1":0.0644822447,"runtime_lift":0.6185721028,"key":["s921450751","s420537027"]} +{"user_id":"u729133443","problem_id":"p02821","language":"python","submission_id_v0":"s736183301","submission_id_v1":"s590731514","cpu_time_v0":843,"cpu_time_v1":614,"memory_v0":54192,"memory_v1":123228,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.16,"input":"from scipy.signal import*\n\nn,m,*a=list(map(int,open(0).read().split()))\n\nb=[0]*2**17\n\nfor i in a:b[i]+=1\n\ni=2**18-1\n\nc=0\n\nfor a in(fftconvolve(b,b)+.5).astype(int)[::-1]:\n\n i-=1\n\n if a:\n\n t=min(m,a)\n\n c+=i*t\n\n m-=t\n\n if not m:break\n\nprint(c)","target":"import cmath\n\npi = cmath.pi\n\nexp = cmath.exp\n\n\n\nN=2**18\n\n\n\ndef make_exp_t(N, base):\n\n exp_t = {0: 1}\n\n temp = N\n\n while temp:\n\n exp_t[temp] = exp(base \/ temp)\n\n temp >>= 1\n\n return exp_t\n\n\n\nfft_exp_t = make_exp_t(N, -2j*pi)\n\nifft_exp_t = make_exp_t(N, 2j*pi)\n\n\n\ndef fft_dfs(f, s, N, st, exp_t):\n\n if N==2:\n\n a = f[s]; b = f[s+st]\n\n return [a+b, a-b]\n\n N2 = N\/\/2; st2 = st*2\n\n F0 = fft_dfs(f, s , N2, st2, exp_t)\n\n F1 = fft_dfs(f, s+st, N2, st2, exp_t)\n\n w = exp_t[N]; wk = 1.0\n\n for k in range(N2):\n\n U = F0[k]; V = wk * F1[k]\n\n F0[k] = U + V\n\n F1[k] = U - V\n\n wk *= w\n\n F0.extend(F1)\n\n return F0\n\n\n\ndef fft(f, N):\n\n if N==1:\n\n return f\n\n return fft_dfs(f, 0, N, 1, fft_exp_t)\n\n\n\ndef ifft(F, N):\n\n if N==1:\n\n return F\n\n f = fft_dfs(F, 0, N, 1, ifft_exp_t)\n\n for i in range(N):\n\n f[i] \/= N\n\n return f\n\n\n\nn,m,*a=list(map(int,open(0).read().split()))\n\nb=[0]*N\n\nfor i in a:b[i]+=1\n\ni=N\n\nc=0\n\nfor a in ifft([t*t for t in fft(b,N)],N)[::-1]:\n\n a=int(a.real+.5)\n\n i-=1\n\n if a:\n\n t=min(m,a)\n\n c+=i*t\n\n m-=t\n\n if not m:break\n\nprint(c)","code_v0_loc":14,"code_v1_loc":60,"code_v0_num_chars":249,"code_v1_num_chars":1167,"code_v0_no_empty_lines":"from scipy.signal import *\n\nn, m, *a = list(map(int, open(0).read().split()))\nb = [0] * 2**17\nfor i in a:\n b[i] += 1\ni = 2**18 - 1\nc = 0\nfor a in (fftconvolve(b, b) + 0.5).astype(int)[::-1]:\n i -= 1\n if a:\n t = min(m, a)\n c += i * t\n m -= t\n if not m:\n break\nprint(c)\n","code_v1_no_empty_lines":"import cmath\n\npi = cmath.pi\nexp = cmath.exp\nN = 2**18\n\n\ndef make_exp_t(N, base):\n exp_t = {0: 1}\n temp = N\n while temp:\n exp_t[temp] = exp(base \/ temp)\n temp >>= 1\n return exp_t\n\n\nfft_exp_t = make_exp_t(N, -2j * pi)\nifft_exp_t = make_exp_t(N, 2j * pi)\n\n\ndef fft_dfs(f, s, N, st, exp_t):\n if N == 2:\n a = f[s]\n b = f[s + st]\n return [a + b, a - b]\n N2 = N \/\/ 2\n st2 = st * 2\n F0 = fft_dfs(f, s, N2, st2, exp_t)\n F1 = fft_dfs(f, s + st, N2, st2, exp_t)\n w = exp_t[N]\n wk = 1.0\n for k in range(N2):\n U = F0[k]\n V = wk * F1[k]\n F0[k] = U + V\n F1[k] = U - V\n wk *= w\n F0.extend(F1)\n return F0\n\n\ndef fft(f, N):\n if N == 1:\n return f\n return fft_dfs(f, 0, N, 1, fft_exp_t)\n\n\ndef ifft(F, N):\n if N == 1:\n return F\n f = fft_dfs(F, 0, N, 1, ifft_exp_t)\n for i in range(N):\n f[i] \/= N\n return f\n\n\nn, m, *a = list(map(int, open(0).read().split()))\nb = [0] * N\nfor i in a:\n b[i] += 1\ni = N\nc = 0\nfor a in ifft([t * t for t in fft(b, N)], N)[::-1]:\n a = int(a.real + 0.5)\n i -= 1\n if a:\n t = min(m, a)\n c += i * t\n m -= t\n if not m:\n break\nprint(c)\n","code_same":false,"relative_loc_diff_percent":76.6666666667,"diff":["-from scipy.signal import *","+import cmath","+","+pi = cmath.pi","+exp = cmath.exp","+N = 2**18","+","+","+def make_exp_t(N, base):","+ exp_t = {0: 1}","+ temp = N","+ while temp:","+ exp_t[temp] = exp(base \/ temp)","+ temp >>= 1","+ return exp_t","+","+","+fft_exp_t = make_exp_t(N, -2j * pi)","+ifft_exp_t = make_exp_t(N, 2j * pi)","+","+","+def fft_dfs(f, s, N, st, exp_t):","+ if N == 2:","+ a = f[s]","+ b = f[s + st]","+ return [a + b, a - b]","+ N2 = N \/\/ 2","+ st2 = st * 2","+ F0 = fft_dfs(f, s, N2, st2, exp_t)","+ F1 = fft_dfs(f, s + st, N2, st2, exp_t)","+ w = exp_t[N]","+ wk = 1.0","+ for k in range(N2):","+ U = F0[k]","+ V = wk * F1[k]","+ F0[k] = U + V","+ F1[k] = U - V","+ wk *= w","+ F0.extend(F1)","+ return F0","+","+","+def fft(f, N):","+ if N == 1:","+ return f","+ return fft_dfs(f, 0, N, 1, fft_exp_t)","+","+","+def ifft(F, N):","+ if N == 1:","+ return F","+ f = fft_dfs(F, 0, N, 1, ifft_exp_t)","+ for i in range(N):","+ f[i] \/= N","+ return f","+","-b = [0] * 2**17","+b = [0] * N","-i = 2**18 - 1","+i = N","-for a in (fftconvolve(b, b) + 0.5).astype(int)[::-1]:","+for a in ifft([t * t for t in fft(b, N)], N)[::-1]:","+ a = int(a.real + 0.5)"],"diff_only_import_comment":false,"measured_runtime_v0":1.2301235669,"measured_runtime_v1":2.7984476089,"runtime_lift":0.439573556,"key":["s736183301","s590731514"]} +{"user_id":"u729133443","problem_id":"p02708","language":"python","submission_id_v0":"s324927444","submission_id_v1":"s746776060","cpu_time_v0":154,"cpu_time_v1":55,"memory_v0":9152,"memory_v1":67444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.29,"input":"M=10**9+7\n\nn,k=list(map(int,input().split()))\n\na=0\n\nfor i in range(k,n+2):\n\n l=i*~-i\/\/2\n\n r=n*-~n\/\/2-(n-i)*(n-i+1)\/\/2\n\n a=(a+r+1-l)%M\n\nprint(a)","target":"n,k=list(map(int,input().split()))\n\nprint((sum(-~i+i*(n-i)for i in range(k,n+2))%(10**9+7)))","code_v0_loc":8,"code_v1_loc":2,"code_v0_num_chars":146,"code_v1_num_chars":84,"code_v0_no_empty_lines":"M = 10**9 + 7\nn, k = list(map(int, input().split()))\na = 0\nfor i in range(k, n + 2):\n l = i * ~-i \/\/ 2\n r = n * -~n \/\/ 2 - (n - i) * (n - i + 1) \/\/ 2\n a = (a + r + 1 - l) % M\nprint(a)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nprint((sum(-~i + i * (n - i) for i in range(k, n + 2)) % (10**9 + 7)))\n","code_same":false,"relative_loc_diff_percent":75.0,"diff":["-M = 10**9 + 7","-a = 0","-for i in range(k, n + 2):","- l = i * ~-i \/\/ 2","- r = n * -~n \/\/ 2 - (n - i) * (n - i + 1) \/\/ 2","- a = (a + r + 1 - l) % M","-print(a)","+print((sum(-~i + i * (n - i) for i in range(k, n + 2)) % (10**9 + 7)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0599175522,"measured_runtime_v1":0.0470444596,"runtime_lift":1.2736367418,"key":["s324927444","s746776060"]} +{"user_id":"u133936772","problem_id":"p02909","language":"python","submission_id_v0":"s860861407","submission_id_v1":"s488978063","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"s = eval(input())\n\nl = ['Sunny', 'Cloudy', 'Rainy']\n\nprint((l[l.index(s)-2]))","target":"L=['Sunny','Cloudy','Rainy']\n\nprint((L[(L.index(eval(input()))+1)%3]))","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":69,"code_v1_num_chars":62,"code_v0_no_empty_lines":"s = eval(input())\nl = [\"Sunny\", \"Cloudy\", \"Rainy\"]\nprint((l[l.index(s) - 2]))\n","code_v1_no_empty_lines":"L = [\"Sunny\", \"Cloudy\", \"Rainy\"]\nprint((L[(L.index(eval(input())) + 1) % 3]))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-s = eval(input())","-l = [\"Sunny\", \"Cloudy\", \"Rainy\"]","-print((l[l.index(s) - 2]))","+L = [\"Sunny\", \"Cloudy\", \"Rainy\"]","+print((L[(L.index(eval(input())) + 1) % 3]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0427585125,"measured_runtime_v1":0.0461829027,"runtime_lift":0.9258515604,"key":["s860861407","s488978063"]} +{"user_id":"u780475861","problem_id":"p03451","language":"python","submission_id_v0":"s776985758","submission_id_v1":"s896806817","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"from heapq import heappop, heappush\n\nn = int(eval(input()))\n\ngrid = [list(map(int, input().split())), list(map(int, input().split()))]\n\n\n\n\n\ndef biggest(grid, start, cost=0):\n\n dist = [[0 for _ in range(n)] for _ in range(2)]\n\n dx = [1, 0]\n\n dy = [0, 1]\n\n st = [(cost, start)]\n\n dist[start[0]][start[1]] = grid[start[0]][start[1]] + cost\n\n while(st):\n\n c, [sx, sy] = heappop(st)\n\n for a, b in zip(dx, dy):\n\n x = sx + a\n\n y = sy + b\n\n if x >= 2 or y >= n:\n\n continue\n\n dxy = dist[sx][sy] + grid[x][y]\n\n if dist[x][y] >= dxy:\n\n continue\n\n dist[x][y] = dxy\n\n heappush(st, (dist[x][y], [x, y]))\n\n return dist[-1][-1]\n\n\n\n\n\ndist = biggest(grid, [0, 0], cost=0)\n\nprint(dist)","target":"n = int(eval(input()))\n\ngrid = [list(map(int, input().split())), list(map(int, input().split()))]\n\ndist = [[0 for _ in range(n)] for _ in range(2)]\n\ndist[0][0] = grid[0][0]\n\nfor i in range(2):\n\n for j in range(n):\n\n if j < n - 1:\n\n dist[i][j + 1] = max(dist[i][j + 1], dist[i][j] + grid[i][j + 1])\n\n if i == 0:\n\n dist[1][j] = max(dist[1][j], dist[0][j] + grid[1][j])\n\nprint((dist[-1][-1]))","code_v0_loc":28,"code_v1_loc":11,"code_v0_num_chars":800,"code_v1_num_chars":398,"code_v0_no_empty_lines":"from heapq import heappop, heappush\n\nn = int(eval(input()))\ngrid = [list(map(int, input().split())), list(map(int, input().split()))]\n\n\ndef biggest(grid, start, cost=0):\n dist = [[0 for _ in range(n)] for _ in range(2)]\n dx = [1, 0]\n dy = [0, 1]\n st = [(cost, start)]\n dist[start[0]][start[1]] = grid[start[0]][start[1]] + cost\n while st:\n c, [sx, sy] = heappop(st)\n for a, b in zip(dx, dy):\n x = sx + a\n y = sy + b\n if x >= 2 or y >= n:\n continue\n dxy = dist[sx][sy] + grid[x][y]\n if dist[x][y] >= dxy:\n continue\n dist[x][y] = dxy\n heappush(st, (dist[x][y], [x, y]))\n return dist[-1][-1]\n\n\ndist = biggest(grid, [0, 0], cost=0)\nprint(dist)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ngrid = [list(map(int, input().split())), list(map(int, input().split()))]\ndist = [[0 for _ in range(n)] for _ in range(2)]\ndist[0][0] = grid[0][0]\nfor i in range(2):\n for j in range(n):\n if j < n - 1:\n dist[i][j + 1] = max(dist[i][j + 1], dist[i][j] + grid[i][j + 1])\n if i == 0:\n dist[1][j] = max(dist[1][j], dist[0][j] + grid[1][j])\nprint((dist[-1][-1]))\n","code_same":false,"relative_loc_diff_percent":60.7142857143,"diff":["-from heapq import heappop, heappush","-","-","-","-def biggest(grid, start, cost=0):","- dist = [[0 for _ in range(n)] for _ in range(2)]","- dx = [1, 0]","- dy = [0, 1]","- st = [(cost, start)]","- dist[start[0]][start[1]] = grid[start[0]][start[1]] + cost","- while st:","- c, [sx, sy] = heappop(st)","- for a, b in zip(dx, dy):","- x = sx + a","- y = sy + b","- if x >= 2 or y >= n:","- continue","- dxy = dist[sx][sy] + grid[x][y]","- if dist[x][y] >= dxy:","- continue","- dist[x][y] = dxy","- heappush(st, (dist[x][y], [x, y]))","- return dist[-1][-1]","-","-","-dist = biggest(grid, [0, 0], cost=0)","-print(dist)","+dist = [[0 for _ in range(n)] for _ in range(2)]","+dist[0][0] = grid[0][0]","+for i in range(2):","+ for j in range(n):","+ if j < n - 1:","+ dist[i][j + 1] = max(dist[i][j + 1], dist[i][j] + grid[i][j + 1])","+ if i == 0:","+ dist[1][j] = max(dist[1][j], dist[0][j] + grid[1][j])","+print((dist[-1][-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1210361481,"measured_runtime_v1":0.0798045158,"runtime_lift":1.5166578831,"key":["s776985758","s896806817"]} +{"user_id":"u657361950","problem_id":"p02264","language":"python","submission_id_v0":"s790426501","submission_id_v1":"s866282165","cpu_time_v0":1990,"cpu_time_v1":910,"memory_v0":18624,"memory_v1":25196,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.27,"input":"from queue import Queue\n\n\n\nclass Process:\n\n\tdef __init__(self, name, time):\n\n\t\tself.name = name\n\n\t\tself.time = int(time)\n\n\n\n\tdef set_time(self, time):\n\n\t\tself.time = time\n\n\n\nn, q = list(map(int, input().split()))\n\nqueue = Queue()\n\nfor i in range(n):\n\n\tname, time = list(map(str, input().split()))\n\n\tqueue.put(Process(name, time))\n\n\n\ntime_elapsed = 0\n\nwhile queue.empty() != True:\n\n\tprocess = queue.get()\n\n\ttime = process.time\n\n\tif time > q:\n\n\t\tprocess.set_time(time - q)\n\n\t\ttime_elapsed += q\n\n\t\tqueue.put(process)\n\n\telse:\n\n\t\ttime_elapsed += time\n\n\t\tprint((process.name + ' ' + str(time_elapsed)))\n","target":"\n\nclass Node:\n\n\tdef __init__(self, value):\n\n\t\tself.value = value\n\n\t\tself.next = None\n\n\n\nclass SimpleQeueue:\n\n\tdef __init__(self):\n\n\t\tself.size = 0\n\n\t\tself.head = None\n\n\t\tself.tail = None\n\n\t\treturn\n\n\n\n\tdef enqueue(self, value):\n\n\t\tnode = Node(value)\n\n\t\tif self.head == None:\n\n\t\t\tself.head = node\n\n\t\t\tself.tail = node\n\n\t\telse:\n\n\t\t\tself.tail.next = node\n\n\t\t\tself.tail = node\n\n\t\tself.size += 1\n\n\n\n\tdef dequeue(self):\n\n\t\tif self.is_empty() == True:\n\n\t\t\treturn None\n\n\t\tnode = self.head\n\n\t\tself.head = self.head.__next__\n\n\t\tself.size -= 1\n\n\t\tif self.is_empty() == True:\n\n\t\t\tself.head = None\n\n\t\t\tself.tail = None\n\n\t\treturn node.value\n\n\n\n\tdef peek(self):\n\n\t\tif self.is_empty() == True:\n\n\t\t\treturn None\n\n\t\treturn self.head.value\n\n\n\n\tdef get_size(self):\n\n\t\treturn self.size\n\n\n\n\tdef is_empty(self):\n\n\t\treturn self.size == 0\n\n\n\n\tdef __str__(self):\n\n\t\tstr_ = '['\n\n\t\tcurrent = self.head\n\n\t\twhile current != None:\n\n\t\t\tstr_ += str(current.value)\n\n\t\t\tcurrent = current.__next__\n\n\t\t\tif current != None:\n\n\t\t\t\tstr_ += ', '\n\n\t\tstr_ += ']['\n\n\t\tif self.tail != None:\n\n\t\t\tstr_ += str(self.tail.value)\n\n\t\tstr_ += ']'\n\n\t\treturn str_\n\n\n\nclass Process:\n\n\tdef __init__(self, name, time):\n\n\t\tself.name = name\n\n\t\tself.time = int(time)\n\n\n\n\tdef set_time(self, time):\n\n\t\tself.time = time\n\n\n\nn, q = list(map(int, input().split()))\n\nmyqueue = SimpleQeueue()\n\nfor i in range(n):\n\n\tname, time = list(map(str, input().split()))\n\n\tmyqueue.enqueue(Process(name, time))\n\n\n\ntime_elapsed = 0\n\nwhile myqueue.is_empty() != True:\n\n\tprocess = myqueue.dequeue()\n\n\ttime = process.time\n\n\tif time > q:\n\n\t\tprocess.set_time(time - q)\n\n\t\ttime_elapsed += q\n\n\t\tmyqueue.enqueue(process)\n\n\telse:\n\n\t\ttime_elapsed += time\n\n\t\tprint((process.name + ' ' + str(time_elapsed)))\n\n\n","code_v0_loc":27,"code_v1_loc":85,"code_v0_num_chars":583,"code_v1_num_chars":1691,"code_v0_no_empty_lines":"from queue import Queue\n\n\nclass Process:\n def __init__(self, name, time):\n self.name = name\n self.time = int(time)\n\n def set_time(self, time):\n self.time = time\n\n\nn, q = list(map(int, input().split()))\nqueue = Queue()\nfor i in range(n):\n name, time = list(map(str, input().split()))\n queue.put(Process(name, time))\ntime_elapsed = 0\nwhile queue.empty() != True:\n process = queue.get()\n time = process.time\n if time > q:\n process.set_time(time - q)\n time_elapsed += q\n queue.put(process)\n else:\n time_elapsed += time\n print((process.name + \" \" + str(time_elapsed)))\n","code_v1_no_empty_lines":"class Node:\n def __init__(self, value):\n self.value = value\n self.next = None\n\n\nclass SimpleQeueue:\n def __init__(self):\n self.size = 0\n self.head = None\n self.tail = None\n return\n\n def enqueue(self, value):\n node = Node(value)\n if self.head == None:\n self.head = node\n self.tail = node\n else:\n self.tail.next = node\n self.tail = node\n self.size += 1\n\n def dequeue(self):\n if self.is_empty() == True:\n return None\n node = self.head\n self.head = self.head.__next__\n self.size -= 1\n if self.is_empty() == True:\n self.head = None\n self.tail = None\n return node.value\n\n def peek(self):\n if self.is_empty() == True:\n return None\n return self.head.value\n\n def get_size(self):\n return self.size\n\n def is_empty(self):\n return self.size == 0\n\n def __str__(self):\n str_ = \"[\"\n current = self.head\n while current != None:\n str_ += str(current.value)\n current = current.__next__\n if current != None:\n str_ += \", \"\n str_ += \"][\"\n if self.tail != None:\n str_ += str(self.tail.value)\n str_ += \"]\"\n return str_\n\n\nclass Process:\n def __init__(self, name, time):\n self.name = name\n self.time = int(time)\n\n def set_time(self, time):\n self.time = time\n\n\nn, q = list(map(int, input().split()))\nmyqueue = SimpleQeueue()\nfor i in range(n):\n name, time = list(map(str, input().split()))\n myqueue.enqueue(Process(name, time))\ntime_elapsed = 0\nwhile myqueue.is_empty() != True:\n process = myqueue.dequeue()\n time = process.time\n if time > q:\n process.set_time(time - q)\n time_elapsed += q\n myqueue.enqueue(process)\n else:\n time_elapsed += time\n print((process.name + \" \" + str(time_elapsed)))\n","code_same":false,"relative_loc_diff_percent":68.2352941176,"diff":["-from queue import Queue","+class Node:","+ def __init__(self, value):","+ self.value = value","+ self.next = None","+","+","+class SimpleQeueue:","+ def __init__(self):","+ self.size = 0","+ self.head = None","+ self.tail = None","+ return","+","+ def enqueue(self, value):","+ node = Node(value)","+ if self.head == None:","+ self.head = node","+ self.tail = node","+ else:","+ self.tail.next = node","+ self.tail = node","+ self.size += 1","+","+ def dequeue(self):","+ if self.is_empty() == True:","+ return None","+ node = self.head","+ self.head = self.head.__next__","+ self.size -= 1","+ if self.is_empty() == True:","+ self.head = None","+ self.tail = None","+ return node.value","+","+ def peek(self):","+ if self.is_empty() == True:","+ return None","+ return self.head.value","+","+ def get_size(self):","+ return self.size","+","+ def is_empty(self):","+ return self.size == 0","+","+ def __str__(self):","+ str_ = \"[\"","+ current = self.head","+ while current != None:","+ str_ += str(current.value)","+ current = current.__next__","+ if current != None:","+ str_ += \", \"","+ str_ += \"][\"","+ if self.tail != None:","+ str_ += str(self.tail.value)","+ str_ += \"]\"","+ return str_","-queue = Queue()","+myqueue = SimpleQeueue()","- queue.put(Process(name, time))","+ myqueue.enqueue(Process(name, time))","-while queue.empty() != True:","- process = queue.get()","+while myqueue.is_empty() != True:","+ process = myqueue.dequeue()","- queue.put(process)","+ myqueue.enqueue(process)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1122980344,"measured_runtime_v1":0.0423311656,"runtime_lift":2.6528453195,"key":["s790426501","s866282165"]} +{"user_id":"u250734103","problem_id":"p03998","language":"python","submission_id_v0":"s480545259","submission_id_v1":"s618628259","cpu_time_v0":29,"cpu_time_v1":26,"memory_v0":9048,"memory_v1":9048,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.34,"input":"SA = eval(input())\n\nSB = eval(input())\n\nSC = eval(input())\n\n\n\npointer = SA[0]\n\nSA = SA[1:]\n\nd = {'a': SA, 'b': SB, 'c': SC}\n\n\n\nwhile True:\n\n if d[pointer] == '':\n\n ans = pointer\n\n break\n\n tmp = d[pointer][0]\n\n d[pointer] = d[pointer][1:]\n\n pointer = tmp\n\n\n\nprint((ans.upper()))","target":"d = { 'a':eval(input()), 'b':eval(input()), 'c':eval(input()) }\n\npointer = 'a'\n\nwhile True:\n\n if 0 < len(d[pointer]):\n\n tmp = d[pointer][0]\n\n d[pointer] = d[pointer][1:]\n\n pointer = tmp\n\n else:\n\n print((pointer.upper()))\n\n break\n","code_v0_loc":17,"code_v1_loc":10,"code_v0_num_chars":283,"code_v1_num_chars":250,"code_v0_no_empty_lines":"SA = eval(input())\nSB = eval(input())\nSC = eval(input())\npointer = SA[0]\nSA = SA[1:]\nd = {\"a\": SA, \"b\": SB, \"c\": SC}\nwhile True:\n if d[pointer] == \"\":\n ans = pointer\n break\n tmp = d[pointer][0]\n d[pointer] = d[pointer][1:]\n pointer = tmp\nprint((ans.upper()))\n","code_v1_no_empty_lines":"d = {\"a\": eval(input()), \"b\": eval(input()), \"c\": eval(input())}\npointer = \"a\"\nwhile True:\n if 0 < len(d[pointer]):\n tmp = d[pointer][0]\n d[pointer] = d[pointer][1:]\n pointer = tmp\n else:\n print((pointer.upper()))\n break\n","code_same":false,"relative_loc_diff_percent":41.1764705882,"diff":["-SA = eval(input())","-SB = eval(input())","-SC = eval(input())","-pointer = SA[0]","-SA = SA[1:]","-d = {\"a\": SA, \"b\": SB, \"c\": SC}","+d = {\"a\": eval(input()), \"b\": eval(input()), \"c\": eval(input())}","+pointer = \"a\"","- if d[pointer] == \"\":","- ans = pointer","+ if 0 < len(d[pointer]):","+ tmp = d[pointer][0]","+ d[pointer] = d[pointer][1:]","+ pointer = tmp","+ else:","+ print((pointer.upper()))","- tmp = d[pointer][0]","- d[pointer] = d[pointer][1:]","- pointer = tmp","-print((ans.upper()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0396702921,"measured_runtime_v1":0.0411635904,"runtime_lift":0.9637228345,"key":["s480545259","s618628259"]} +{"user_id":"u065137691","problem_id":"p02766","language":"python","submission_id_v0":"s263526861","submission_id_v1":"s625094470","cpu_time_v0":172,"cpu_time_v1":118,"memory_v0":38256,"memory_v1":61636,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.4,"input":"n, k = input().split()\n\n\n\nn = int(n)\n\nk = int(k)\n\n\n\ncount = 0\n\nwhile True:\n\n if n == 0:\n\n break\n\n else:\n\n n = n\/\/k\n\n count += 1\n\n\n\nprint(count)","target":"N, K = list(map(int, input().split()))\n\nans = 0\n\n\n\nwhile N != 0:\n\n N = N\/\/K\n\n ans += 1\n\n\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":8,"code_v0_num_chars":170,"code_v1_num_chars":100,"code_v0_no_empty_lines":"n, k = input().split()\nn = int(n)\nk = int(k)\ncount = 0\nwhile True:\n if n == 0:\n break\n else:\n n = n \/\/ k\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nans = 0\nwhile N != 0:\n N = N \/\/ K\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-n, k = input().split()","-n = int(n)","-k = int(k)","-count = 0","-while True:","- if n == 0:","- break","- else:","- n = n \/\/ k","- count += 1","-print(count)","+N, K = list(map(int, input().split()))","+ans = 0","+while N != 0:","+ N = N \/\/ K","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373436253,"measured_runtime_v1":0.0463050108,"runtime_lift":0.8064705019,"key":["s263526861","s625094470"]} +{"user_id":"u367701763","problem_id":"p02972","language":"python","submission_id_v0":"s544644377","submission_id_v1":"s183637324","cpu_time_v0":629,"cpu_time_v1":131,"memory_v0":98468,"memory_v1":98512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.17,"input":"def divisors(n):\n\n i = 1\n\n table = set()\n\n while i * i <= n:\n\n if not n % i:\n\n table.add(i)\n\n table.add(n\/\/i)\n\n i += 1\n\n table = list(table)\n\n return table\n\n\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\ntemp = [0] * N\n\nfor n in reversed(list(range(1,N+1))):\n\n if (A[n-1] + temp[n - 1])%2 == 0:\n\n temp[n - 1] = 0\n\n continue\n\n for a in divisors(n):\n\n temp[a-1] += 1\n\n\n\n\n\nres = list(i+1 for i, _ in enumerate(temp) if temp[i])\n\nprint((len(res)))\n\nprint((*res))\n\n\n\n\"\"\"\n\n4\n\n1 1 1 1\n\n\"\"\"","target":"N=int(eval(input()))\n\nA=list(map(int, input().split()))\n\nd = [0]*N\n\nfor i in reversed(list(range(1,N+1))):\n\n n=1\n\n t=0\n\n while i*n<=N:\n\n t+=d[i*n-1]\n\n n+=1\n\n d[i-1]=(t+A[i-1])%2\n\nres = [i+1 for i,x in enumerate(d) if x]\n\nprint((len(res)))\n\nprint((*res))","code_v0_loc":31,"code_v1_loc":13,"code_v0_num_chars":562,"code_v1_num_chars":263,"code_v0_no_empty_lines":"def divisors(n):\n i = 1\n table = set()\n while i * i <= n:\n if not n % i:\n table.add(i)\n table.add(n \/\/ i)\n i += 1\n table = list(table)\n return table\n\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\ntemp = [0] * N\nfor n in reversed(list(range(1, N + 1))):\n if (A[n - 1] + temp[n - 1]) % 2 == 0:\n temp[n - 1] = 0\n continue\n for a in divisors(n):\n temp[a - 1] += 1\nres = list(i + 1 for i, _ in enumerate(temp) if temp[i])\nprint((len(res)))\nprint((*res))\n\"\"\"\n4\n1 1 1 1\n\"\"\"\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nd = [0] * N\nfor i in reversed(list(range(1, N + 1))):\n n = 1\n t = 0\n while i * n <= N:\n t += d[i * n - 1]\n n += 1\n d[i - 1] = (t + A[i - 1]) % 2\nres = [i + 1 for i, x in enumerate(d) if x]\nprint((len(res)))\nprint((*res))\n","code_same":false,"relative_loc_diff_percent":58.064516129,"diff":["-def divisors(n):","- i = 1","- table = set()","- while i * i <= n:","- if not n % i:","- table.add(i)","- table.add(n \/\/ i)","- i += 1","- table = list(table)","- return table","-","-","-temp = [0] * N","-for n in reversed(list(range(1, N + 1))):","- if (A[n - 1] + temp[n - 1]) % 2 == 0:","- temp[n - 1] = 0","- continue","- for a in divisors(n):","- temp[a - 1] += 1","-res = list(i + 1 for i, _ in enumerate(temp) if temp[i])","+d = [0] * N","+for i in reversed(list(range(1, N + 1))):","+ n = 1","+ t = 0","+ while i * n <= N:","+ t += d[i * n - 1]","+ n += 1","+ d[i - 1] = (t + A[i - 1]) % 2","+res = [i + 1 for i, x in enumerate(d) if x]","-\"\"\"","-4","-1 1 1 1","-\"\"\""],"diff_only_import_comment":false,"measured_runtime_v0":0.0072741911,"measured_runtime_v1":0.0405455788,"runtime_lift":0.1794077504,"key":["s544644377","s183637324"]} +{"user_id":"u602544363","problem_id":"p02861","language":"python","submission_id_v0":"s973076533","submission_id_v1":"s361794045","cpu_time_v0":171,"cpu_time_v1":150,"memory_v0":38256,"memory_v1":12504,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.28,"input":"n = int(eval(input()))\n\nX, Y= [0]*n,[0]*n\n\n\n\nfor i in range(n):\n\n x,y = list(map(int,input().split()))\n\n X[i]=x\n\n Y[i]=y\n\n \n\n\n\ndef kaijo(x):\n\n if x==1:\n\n return 1\n\n else:\n\n return x*kaijo(x-1)\n\n\n\ndis = 0.0\n\nfor i in range(n):\n\n for j in range(n):\n\n dis += (((X[i]-X[j])**2+(Y[i]-Y[j])**2)**0.5)*kaijo(n-1)\n\n\n\n\n\nprint((dis\/kaijo(n)))","target":"import numpy as np\n\nn = int(eval(input()))\n\ntowns = []\n\nfor _ in range(n):\n\n x,y = list(map(int,input().split()))\n\n towns.append((x,y))\n\ndist = []\n\nfor i in range(n-1):\n\n for j in range(i+1,n):\n\n x1,y1 = towns[i]\n\n x2,y2 = towns[j]\n\n dist.append(np.sqrt((x1-x2)**2+(y1-y2)**2))\n\nprint(((sum(dist)\/len(dist)) * (n-1)))","code_v0_loc":22,"code_v1_loc":13,"code_v0_num_chars":360,"code_v1_num_chars":333,"code_v0_no_empty_lines":"n = int(eval(input()))\nX, Y = [0] * n, [0] * n\nfor i in range(n):\n x, y = list(map(int, input().split()))\n X[i] = x\n Y[i] = y\n\n\ndef kaijo(x):\n if x == 1:\n return 1\n else:\n return x * kaijo(x - 1)\n\n\ndis = 0.0\nfor i in range(n):\n for j in range(n):\n dis += (((X[i] - X[j]) ** 2 + (Y[i] - Y[j]) ** 2) ** 0.5) * kaijo(n - 1)\nprint((dis \/ kaijo(n)))\n","code_v1_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\ntowns = []\nfor _ in range(n):\n x, y = list(map(int, input().split()))\n towns.append((x, y))\ndist = []\nfor i in range(n - 1):\n for j in range(i + 1, n):\n x1, y1 = towns[i]\n x2, y2 = towns[j]\n dist.append(np.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2))\nprint(((sum(dist) \/ len(dist)) * (n - 1)))\n","code_same":false,"relative_loc_diff_percent":40.9090909091,"diff":["+import numpy as np","+","-X, Y = [0] * n, [0] * n","-for i in range(n):","+towns = []","+for _ in range(n):","- X[i] = x","- Y[i] = y","-","-","-def kaijo(x):","- if x == 1:","- return 1","- else:","- return x * kaijo(x - 1)","-","-","-dis = 0.0","-for i in range(n):","- for j in range(n):","- dis += (((X[i] - X[j]) ** 2 + (Y[i] - Y[j]) ** 2) ** 0.5) * kaijo(n - 1)","-print((dis \/ kaijo(n)))","+ towns.append((x, y))","+dist = []","+for i in range(n - 1):","+ for j in range(i + 1, n):","+ x1, y1 = towns[i]","+ x2, y2 = towns[j]","+ dist.append(np.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2))","+print(((sum(dist) \/ len(dist)) * (n - 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0469149113,"measured_runtime_v1":0.2302066326,"runtime_lift":0.2037947853,"key":["s973076533","s361794045"]} +{"user_id":"u811841526","problem_id":"p02382","language":"python","submission_id_v0":"s607538111","submission_id_v1":"s079512229","cpu_time_v0":70,"cpu_time_v1":20,"memory_v0":7788,"memory_v1":5696,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":71.43,"input":"import math\n\n\n\ndef manhattan(xs, ys):\n\n return sum([abs(x-y) for x, y in zip(xs, ys)])\n\n\n\ndef euclid(xs, ys):\n\n return math.sqrt(sum([(x-y)**2 for x, y in zip(xs, ys)]))\n\n\n\ndef l3(xs, ys):\n\n return sum([abs(x-y)**3 for x, y in zip(xs, ys)])**(1\/3)\n\n\n\ndef chev(xs, ys):\n\n return max([abs(x-y) for x, y in zip(xs, ys)])\n\n\n\ndef norm():\n\n n = int(eval(input()))\n\n xs = list(map(int, input().split()))\n\n ys = list(map(int, input().split()))\n\n print((manhattan(xs, ys)))\n\n print((euclid(xs, ys)))\n\n print((l3(xs, ys)))\n\n print((chev(xs, ys)))\n\n\n\nnorm()","target":"import math\n\n\n\nn = int(eval(input()))\n\nx = list(map(int, input().split()))\n\ny = list(map(int, input().split()))\n\n\n\nprint((sum([math.fabs(v[0] - v[1]) for v in zip(x, y)])))\n\nprint((sum([math.fabs((v[0] - v[1]) ** 2) for v in zip(x, y)]) ** (1\/2)))\n\nprint((sum([math.fabs((v[0] - v[1]) ** 3) for v in zip(x, y)]) ** (1\/3)))\n\nprint((max([math.fabs(v[0] - v[1]) for v in zip(x, y)])))\n\n\n","code_v0_loc":24,"code_v1_loc":11,"code_v0_num_chars":565,"code_v1_num_chars":390,"code_v0_no_empty_lines":"import math\n\n\ndef manhattan(xs, ys):\n return sum([abs(x - y) for x, y in zip(xs, ys)])\n\n\ndef euclid(xs, ys):\n return math.sqrt(sum([(x - y) ** 2 for x, y in zip(xs, ys)]))\n\n\ndef l3(xs, ys):\n return sum([abs(x - y) ** 3 for x, y in zip(xs, ys)]) ** (1 \/ 3)\n\n\ndef chev(xs, ys):\n return max([abs(x - y) for x, y in zip(xs, ys)])\n\n\ndef norm():\n n = int(eval(input()))\n xs = list(map(int, input().split()))\n ys = list(map(int, input().split()))\n print((manhattan(xs, ys)))\n print((euclid(xs, ys)))\n print((l3(xs, ys)))\n print((chev(xs, ys)))\n\n\nnorm()\n","code_v1_no_empty_lines":"import math\n\nn = int(eval(input()))\nx = list(map(int, input().split()))\ny = list(map(int, input().split()))\nprint((sum([math.fabs(v[0] - v[1]) for v in zip(x, y)])))\nprint((sum([math.fabs((v[0] - v[1]) ** 2) for v in zip(x, y)]) ** (1 \/ 2)))\nprint((sum([math.fabs((v[0] - v[1]) ** 3) for v in zip(x, y)]) ** (1 \/ 3)))\nprint((max([math.fabs(v[0] - v[1]) for v in zip(x, y)])))\n","code_same":false,"relative_loc_diff_percent":54.1666666667,"diff":["-","-def manhattan(xs, ys):","- return sum([abs(x - y) for x, y in zip(xs, ys)])","-","-","-def euclid(xs, ys):","- return math.sqrt(sum([(x - y) ** 2 for x, y in zip(xs, ys)]))","-","-","-def l3(xs, ys):","- return sum([abs(x - y) ** 3 for x, y in zip(xs, ys)]) ** (1 \/ 3)","-","-","-def chev(xs, ys):","- return max([abs(x - y) for x, y in zip(xs, ys)])","-","-","-def norm():","- n = int(eval(input()))","- xs = list(map(int, input().split()))","- ys = list(map(int, input().split()))","- print((manhattan(xs, ys)))","- print((euclid(xs, ys)))","- print((l3(xs, ys)))","- print((chev(xs, ys)))","-","-","-norm()","+n = int(eval(input()))","+x = list(map(int, input().split()))","+y = list(map(int, input().split()))","+print((sum([math.fabs(v[0] - v[1]) for v in zip(x, y)])))","+print((sum([math.fabs((v[0] - v[1]) ** 2) for v in zip(x, y)]) ** (1 \/ 2)))","+print((sum([math.fabs((v[0] - v[1]) ** 3) for v in zip(x, y)]) ** (1 \/ 3)))","+print((max([math.fabs(v[0] - v[1]) for v in zip(x, y)])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0380730081,"measured_runtime_v1":0.0069741096,"runtime_lift":5.4591926308,"key":["s607538111","s079512229"]} +{"user_id":"u562935282","problem_id":"p03450","language":"python","submission_id_v0":"s543962095","submission_id_v1":"s360586160","cpu_time_v0":1544,"cpu_time_v1":642,"memory_v0":129096,"memory_v1":55940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.42,"input":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 9)\n\n\n\n\n\ndef rec(x, n):\n\n # print(pos)\n\n if pos[x] is None:\n\n pos[x] = n\n\n else:\n\n if pos[x] == n:\n\n return True\n\n else:\n\n # print(pos[x], n)\n\n return False\n\n\n\n for nx, d in g[x]:\n\n if not rec(nx, n + d):\n\n return False\n\n else:\n\n return True\n\n\n\nINF = 1 << 30\n\n\n\nN, M = list(map(int, input().split()))\n\ng = [[] for _ in range(N)]\n\nfor _ in range(M):\n\n L, R, D = list(map(int, input().split()))\n\n L -= 1\n\n R -= 1\n\n g[L].append((R, D))\n\n g[R].append((L, -D))\n\n\n\npos = [None for _ in range(N)]\n\n\n\nfor v in range(N):\n\n # print(pos)\n\n if pos[v] is None:\n\n if not rec(v, 0):\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n","target":"def main():\n\n from collections import deque\n\n import sys\n\n input = sys.stdin.readline\n\n\n\n N, M = list(map(int, input().split()))\n\n\n\n g = tuple(set() for _ in range(N))\n\n h = [0] * N # \u5165\u308a\u6b21\u6570\n\n for _ in range(M):\n\n L, R, D = list(map(int, input().split()))\n\n L -= 1\n\n R -= 1\n\n g[L].add((R, D))\n\n h[R] += 1\n\n\n\n dist = [-1] * N\n\n\n\n def dfs(s):\n\n dist[s] = 0\n\n dq = deque([s])\n\n while dq:\n\n v = dq.popleft()\n\n for u, d in g[v]:\n\n if ~dist[u]:\n\n if dist[u] != dist[v] + d:\n\n return False\n\n else:\n\n dist[u] = dist[v] + d\n\n dq.append(u)\n\n return True\n\n\n\n # \u59cb\u70b9\u304b\u3089\u306e\u30d1\u30b9\u3092\u51e6\u7406\n\n for s in range(N):\n\n if h[s]: continue # s\u306b\u5165\u3063\u3066\u304f\u308b\u30d1\u30b9\u304c\u3042\u308b\u306e\u3067\u3001s\u3092\u59cb\u70b9\u306b\u3057\u306a\u3044\n\n if ~dist[s]: continue\n\n if not dfs(s):\n\n print('No')\n\n return\n\n\n\n # \u30b5\u30a4\u30af\u30eb\u3092\u51e6\u7406\uff08\u3069\u306e\u70b9\u3082\u5165\u308b\u30d1\u30b9\u304c\u3042\u308a\u3001\u51e6\u7406\u3067\u304d\u3066\u3044\u306a\u3044\uff09\n\n for s in range(N):\n\n if ~dist[s]: continue\n\n if not dfs(s):\n\n print('No')\n\n return\n\n\n\n print('Yes')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":43,"code_v1_loc":52,"code_v0_num_chars":788,"code_v1_num_chars":1178,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\n\n\ndef rec(x, n):\n # print(pos)\n if pos[x] is None:\n pos[x] = n\n else:\n if pos[x] == n:\n return True\n else:\n # print(pos[x], n)\n return False\n for nx, d in g[x]:\n if not rec(nx, n + d):\n return False\n else:\n return True\n\n\nINF = 1 << 30\nN, M = list(map(int, input().split()))\ng = [[] for _ in range(N)]\nfor _ in range(M):\n L, R, D = list(map(int, input().split()))\n L -= 1\n R -= 1\n g[L].append((R, D))\n g[R].append((L, -D))\npos = [None for _ in range(N)]\nfor v in range(N):\n # print(pos)\n if pos[v] is None:\n if not rec(v, 0):\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"def main():\n from collections import deque\n import sys\n\n input = sys.stdin.readline\n N, M = list(map(int, input().split()))\n g = tuple(set() for _ in range(N))\n h = [0] * N # \u5165\u308a\u6b21\u6570\n for _ in range(M):\n L, R, D = list(map(int, input().split()))\n L -= 1\n R -= 1\n g[L].add((R, D))\n h[R] += 1\n dist = [-1] * N\n\n def dfs(s):\n dist[s] = 0\n dq = deque([s])\n while dq:\n v = dq.popleft()\n for u, d in g[v]:\n if ~dist[u]:\n if dist[u] != dist[v] + d:\n return False\n else:\n dist[u] = dist[v] + d\n dq.append(u)\n return True\n\n # \u59cb\u70b9\u304b\u3089\u306e\u30d1\u30b9\u3092\u51e6\u7406\n for s in range(N):\n if h[s]:\n continue # s\u306b\u5165\u3063\u3066\u304f\u308b\u30d1\u30b9\u304c\u3042\u308b\u306e\u3067\u3001s\u3092\u59cb\u70b9\u306b\u3057\u306a\u3044\n if ~dist[s]:\n continue\n if not dfs(s):\n print(\"No\")\n return\n # \u30b5\u30a4\u30af\u30eb\u3092\u51e6\u7406\uff08\u3069\u306e\u70b9\u3082\u5165\u308b\u30d1\u30b9\u304c\u3042\u308a\u3001\u51e6\u7406\u3067\u304d\u3066\u3044\u306a\u3044\uff09\n for s in range(N):\n if ~dist[s]:\n continue\n if not dfs(s):\n print(\"No\")\n return\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":17.3076923077,"diff":["-import sys","+def main():","+ from collections import deque","+ import sys","-sys.setrecursionlimit(10**9)","+ input = sys.stdin.readline","+ N, M = list(map(int, input().split()))","+ g = tuple(set() for _ in range(N))","+ h = [0] * N # \u5165\u308a\u6b21\u6570","+ for _ in range(M):","+ L, R, D = list(map(int, input().split()))","+ L -= 1","+ R -= 1","+ g[L].add((R, D))","+ h[R] += 1","+ dist = [-1] * N","+","+ def dfs(s):","+ dist[s] = 0","+ dq = deque([s])","+ while dq:","+ v = dq.popleft()","+ for u, d in g[v]:","+ if ~dist[u]:","+ if dist[u] != dist[v] + d:","+ return False","+ else:","+ dist[u] = dist[v] + d","+ dq.append(u)","+ return True","+","+ # \u59cb\u70b9\u304b\u3089\u306e\u30d1\u30b9\u3092\u51e6\u7406","+ for s in range(N):","+ if h[s]:","+ continue # s\u306b\u5165\u3063\u3066\u304f\u308b\u30d1\u30b9\u304c\u3042\u308b\u306e\u3067\u3001s\u3092\u59cb\u70b9\u306b\u3057\u306a\u3044","+ if ~dist[s]:","+ continue","+ if not dfs(s):","+ print(\"No\")","+ return","+ # \u30b5\u30a4\u30af\u30eb\u3092\u51e6\u7406\uff08\u3069\u306e\u70b9\u3082\u5165\u308b\u30d1\u30b9\u304c\u3042\u308a\u3001\u51e6\u7406\u3067\u304d\u3066\u3044\u306a\u3044\uff09","+ for s in range(N):","+ if ~dist[s]:","+ continue","+ if not dfs(s):","+ print(\"No\")","+ return","+ print(\"Yes\")","-def rec(x, n):","- # print(pos)","- if pos[x] is None:","- pos[x] = n","- else:","- if pos[x] == n:","- return True","- else:","- # print(pos[x], n)","- return False","- for nx, d in g[x]:","- if not rec(nx, n + d):","- return False","- else:","- return True","-","-","-INF = 1 << 30","-N, M = list(map(int, input().split()))","-g = [[] for _ in range(N)]","-for _ in range(M):","- L, R, D = list(map(int, input().split()))","- L -= 1","- R -= 1","- g[L].append((R, D))","- g[R].append((L, -D))","-pos = [None for _ in range(N)]","-for v in range(N):","- # print(pos)","- if pos[v] is None:","- if not rec(v, 0):","- print(\"No\")","- break","-else:","- print(\"Yes\")","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0389800549,"measured_runtime_v1":0.0375929832,"runtime_lift":1.0368970877,"key":["s543962095","s360586160"]} +{"user_id":"u606045429","problem_id":"p03779","language":"python","submission_id_v0":"s129188902","submission_id_v1":"s308200121","cpu_time_v0":27,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.04,"input":"X = int(eval(input()))\n\n\n\ni, x = 1, 0\n\nwhile x < X:\n\n x += i\n\n i += 1\n\nprint((i - 1))","target":"import math\n\nX = int(eval(input()))\n\nprint((math.ceil((-1 + (1 + 8 * X) ** 0.5) \/ 2)))","code_v0_loc":7,"code_v1_loc":3,"code_v0_num_chars":83,"code_v1_num_chars":78,"code_v0_no_empty_lines":"X = int(eval(input()))\ni, x = 1, 0\nwhile x < X:\n x += i\n i += 1\nprint((i - 1))\n","code_v1_no_empty_lines":"import math\n\nX = int(eval(input()))\nprint((math.ceil((-1 + (1 + 8 * X) ** 0.5) \/ 2)))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["+import math","+","-i, x = 1, 0","-while x < X:","- x += i","- i += 1","-print((i - 1))","+print((math.ceil((-1 + (1 + 8 * X) ** 0.5) \/ 2)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0436092377,"measured_runtime_v1":0.1165842056,"runtime_lift":0.3740578531,"key":["s129188902","s308200121"]} +{"user_id":"u346395915","problem_id":"p03162","language":"python","submission_id_v0":"s121570856","submission_id_v1":"s218896611","cpu_time_v0":994,"cpu_time_v1":668,"memory_v0":47364,"memory_v1":49988,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.8,"input":"n = int(eval(input()))\n\n\n\nli = [list(map(int,input().split())) for _ in range(n)]\n\n\n\ndp = [[0,0,0] for _ in range(n)]\n\n\n\n\n\nfor i in range(n):\n\n if i == 0:\n\n for j in range(3):\n\n dp[i][j] = li[i][j]\n\n else:\n\n for j in range(3):\n\n for k in range(3):\n\n if j == k:\n\n continue\n\n else:\n\n dp[i][j] = max(dp[i-1][k] + li[i][j], dp[i][j])\n\n \n\nprint((max(dp[-1])))\n\n ","target":"n = int(eval(input()))\n\nli = [list(map(int, input().split())) for _ in range(n)]\n\n\n\ndp = [[0,0,0] for _ in range(n)]\n\n\n\nfor i in range(n):\n\n if i == 0:\n\n for j in range(3):\n\n dp[i][j] = li[i][j]\n\n else:\n\n for j in range(3):\n\n for k in range(3):\n\n if j == k:\n\n continue\n\n dp[i][k] = max(dp[i][k], dp[i-1][j] + li[i][k])\n\n\n\nprint((max(dp[-1])))","code_v0_loc":21,"code_v1_loc":17,"code_v0_num_chars":481,"code_v1_num_chars":425,"code_v0_no_empty_lines":"n = int(eval(input()))\nli = [list(map(int, input().split())) for _ in range(n)]\ndp = [[0, 0, 0] for _ in range(n)]\nfor i in range(n):\n if i == 0:\n for j in range(3):\n dp[i][j] = li[i][j]\n else:\n for j in range(3):\n for k in range(3):\n if j == k:\n continue\n else:\n dp[i][j] = max(dp[i - 1][k] + li[i][j], dp[i][j])\nprint((max(dp[-1])))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nli = [list(map(int, input().split())) for _ in range(n)]\ndp = [[0, 0, 0] for _ in range(n)]\nfor i in range(n):\n if i == 0:\n for j in range(3):\n dp[i][j] = li[i][j]\n else:\n for j in range(3):\n for k in range(3):\n if j == k:\n continue\n dp[i][k] = max(dp[i][k], dp[i - 1][j] + li[i][k])\nprint((max(dp[-1])))\n","code_same":false,"relative_loc_diff_percent":19.0476190476,"diff":["- else:","- dp[i][j] = max(dp[i - 1][k] + li[i][j], dp[i][j])","+ dp[i][k] = max(dp[i][k], dp[i - 1][j] + li[i][k])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0368287807,"measured_runtime_v1":0.0356952257,"runtime_lift":1.0317564857,"key":["s121570856","s218896611"]} +{"user_id":"u721425712","problem_id":"p03502","language":"python","submission_id_v0":"s452004523","submission_id_v1":"s828800501","cpu_time_v0":23,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.09,"input":"# B\n\nn = int(eval(input()))\n\n\n\ndef SumDegit(x):\n\n ans = 0\n\n while x > 0:\n\n ans += x%10\n\n x = x \/\/10\n\n return ans\n\n \n\nif n%SumDegit(n) == 0:\n\n print('Yes')\n\nelse:\n\n print('No')","target":"# ABC 080 B - Harshad Number\n\nn = int(eval(input()))\n\n\n\ndef harshad(x):\n\n tot = 0\n\n X = x\n\n while x > 0:\n\n tot += x%10\n\n x = x \/\/ 10\n\n if (X \/ tot)%1 == 0:\n\n return 'Yes'\n\n else:\n\n return 'No'\n\nprint((harshad(n)))","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":205,"code_v1_num_chars":248,"code_v0_no_empty_lines":"# B\nn = int(eval(input()))\n\n\ndef SumDegit(x):\n ans = 0\n while x > 0:\n ans += x % 10\n x = x \/\/ 10\n return ans\n\n\nif n % SumDegit(n) == 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"# ABC 080 B - Harshad Number\nn = int(eval(input()))\n\n\ndef harshad(x):\n tot = 0\n X = x\n while x > 0:\n tot += x % 10\n x = x \/\/ 10\n if (X \/ tot) % 1 == 0:\n return \"Yes\"\n else:\n return \"No\"\n\n\nprint((harshad(n)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-# B","+# ABC 080 B - Harshad Number","-def SumDegit(x):","- ans = 0","+def harshad(x):","+ tot = 0","+ X = x","- ans += x % 10","+ tot += x % 10","- return ans","+ if (X \/ tot) % 1 == 0:","+ return \"Yes\"","+ else:","+ return \"No\"","-if n % SumDegit(n) == 0:","- print(\"Yes\")","-else:","- print(\"No\")","+print((harshad(n)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0391676178,"measured_runtime_v1":0.0069614174,"runtime_lift":5.626385445,"key":["s452004523","s828800501"]} +{"user_id":"u731807761","problem_id":"p02554","language":"python","submission_id_v0":"s586416773","submission_id_v1":"s593263783","cpu_time_v0":342,"cpu_time_v1":33,"memory_v0":9260,"memory_v1":9280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.35,"input":"from sys import exit, stdin\n\n\n\ninput = stdin.readline\n\nimport copy\n\n\n\n# from collections import deque,Counter\n\n# import numpy as np\n\n\n\n\n\ndef pow_mod(a, n, d):\n\n tmp = 1\n\n for _ in range(n):\n\n tmp = (tmp * a) % d\n\n return tmp\n\n\n\n\n\n(N,) = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\nans = (pow_mod(10, N, mod) + pow_mod(8, N, mod) - 2 * pow_mod(9, N, mod)) % mod\n\n\n\nprint(ans)\n","target":"from sys import exit, stdin\n\n\n\ninput = stdin.readline\n\nimport copy\n\n\n\n# from collections import deque,Counter\n\n# import numpy as np\n\n\n\n(N,) = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\nans = (pow(10, N, mod) + pow(8, N, mod) - 2 * pow(9, N, mod)) % mod\n\n\n\nprint(ans)\n","code_v0_loc":21,"code_v1_loc":13,"code_v0_num_chars":399,"code_v1_num_chars":276,"code_v0_no_empty_lines":"from sys import exit, stdin\n\ninput = stdin.readline\nimport copy\n\n# from collections import deque,Counter\n# import numpy as np\ndef pow_mod(a, n, d):\n tmp = 1\n for _ in range(n):\n tmp = (tmp * a) % d\n return tmp\n\n\n(N,) = list(map(int, input().split()))\nmod = 10**9 + 7\nans = (pow_mod(10, N, mod) + pow_mod(8, N, mod) - 2 * pow_mod(9, N, mod)) % mod\nprint(ans)\n","code_v1_no_empty_lines":"from sys import exit, stdin\n\ninput = stdin.readline\nimport copy\n\n# from collections import deque,Counter\n# import numpy as np\n(N,) = list(map(int, input().split()))\nmod = 10**9 + 7\nans = (pow(10, N, mod) + pow(8, N, mod) - 2 * pow(9, N, mod)) % mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":38.0952380952,"diff":["-def pow_mod(a, n, d):","- tmp = 1","- for _ in range(n):","- tmp = (tmp * a) % d","- return tmp","-","-","-ans = (pow_mod(10, N, mod) + pow_mod(8, N, mod) - 2 * pow_mod(9, N, mod)) % mod","+ans = (pow(10, N, mod) + pow(8, N, mod) - 2 * pow(9, N, mod)) % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.1536970761,"measured_runtime_v1":0.0432091639,"runtime_lift":3.5570481388,"key":["s586416773","s593263783"]} +{"user_id":"u075012704","problem_id":"p04049","language":"python","submission_id_v0":"s203445479","submission_id_v1":"s155683327","cpu_time_v0":1538,"cpu_time_v1":713,"memory_v0":94808,"memory_v1":87000,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.64,"input":"from collections import deque\n\n\n\nN, K = list(map(int, input().split()))\n\nT = [[] for i in range(N)]\n\nE = []\n\nfor i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n T[a].append(b)\n\n T[b].append(a)\n\n E.append((a, b))\n\n\n\n\n\ndef bfs(n):\n\n visited = [False] * N\n\n dist = [0] * N\n\n queue = deque([n])\n\n while queue:\n\n node = queue.pop()\n\n if visited[node]:\n\n continue\n\n visited[node] = True\n\n for n in T[node]:\n\n if not visited[n]:\n\n dist[n] = dist[node] + 1\n\n queue.appendleft(n)\n\n return dist\n\n\n\n\n\ndist = []\n\nfor i in range(N):\n\n dist.append(bfs(i))\n\n\n\nans = float('inf')\n\nif K % 2 == 0:\n\n # \u5168\u3066\u306e\u9802\u70b9\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\n\n for i in range(N):\n\n ans = min(ans, len(list([x for x in dist[i] if K \/ 2 < x])))\n\nelse:\n\n # \u5168\u3066\u306e\u8fba\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\n\n for a, b in E:\n\n adist = [min(d1, d2) for d1, d2 in zip(dist[a], dist[b])]\n\n ans = min(ans, len(list([x for x in adist if (K-1) \/ 2 < x])))\n\n\n\nprint(ans)\n","target":"from collections import deque\n\n\n\nN, K = list(map(int, input().split()))\n\nT = [[] for i in range(N)]\n\nE = []\n\nfor i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a, b = a-1, b-1\n\n T[a].append(b)\n\n T[b].append(a)\n\n E.append((a, b))\n\n\n\n\n\ndef bfs(n):\n\n visited = [False] * N\n\n dist = [0] * N\n\n queue = deque([n])\n\n while queue:\n\n node = queue.pop()\n\n if visited[node]:\n\n continue\n\n visited[node] = True\n\n for n in T[node]:\n\n if not visited[n]:\n\n dist[n] = dist[node] + 1\n\n queue.appendleft(n)\n\n return dist\n\n\n\n\n\ndist = []\n\nfor i in range(N):\n\n dist.append(bfs(i))\n\n\n\nans = float('inf')\n\nif K % 2 == 0:\n\n # \u5168\u3066\u306e\u9802\u70b9\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\n\n for i in range(N):\n\n ans = min(ans, len([d for d in dist[i] if d > K \/ 2]))\n\nelse:\n\n # \u5168\u3066\u306e\u8fba\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\n\n for a, b in E:\n\n adist = [(1 if min(d1, d2) > (K-1) \/ 2 else 0) for d1, d2 in zip(dist[a], dist[b])]\n\n ans = min(ans, sum(adist))\n\n\n\nprint(ans)\n","code_v0_loc":45,"code_v1_loc":45,"code_v0_num_chars":1030,"code_v1_num_chars":1008,"code_v0_no_empty_lines":"from collections import deque\n\nN, K = list(map(int, input().split()))\nT = [[] for i in range(N)]\nE = []\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n T[a].append(b)\n T[b].append(a)\n E.append((a, b))\n\n\ndef bfs(n):\n visited = [False] * N\n dist = [0] * N\n queue = deque([n])\n while queue:\n node = queue.pop()\n if visited[node]:\n continue\n visited[node] = True\n for n in T[node]:\n if not visited[n]:\n dist[n] = dist[node] + 1\n queue.appendleft(n)\n return dist\n\n\ndist = []\nfor i in range(N):\n dist.append(bfs(i))\nans = float(\"inf\")\nif K % 2 == 0:\n # \u5168\u3066\u306e\u9802\u70b9\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\n for i in range(N):\n ans = min(ans, len(list([x for x in dist[i] if K \/ 2 < x])))\nelse:\n # \u5168\u3066\u306e\u8fba\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\n for a, b in E:\n adist = [min(d1, d2) for d1, d2 in zip(dist[a], dist[b])]\n ans = min(ans, len(list([x for x in adist if (K - 1) \/ 2 < x])))\nprint(ans)\n","code_v1_no_empty_lines":"from collections import deque\n\nN, K = list(map(int, input().split()))\nT = [[] for i in range(N)]\nE = []\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n T[a].append(b)\n T[b].append(a)\n E.append((a, b))\n\n\ndef bfs(n):\n visited = [False] * N\n dist = [0] * N\n queue = deque([n])\n while queue:\n node = queue.pop()\n if visited[node]:\n continue\n visited[node] = True\n for n in T[node]:\n if not visited[n]:\n dist[n] = dist[node] + 1\n queue.appendleft(n)\n return dist\n\n\ndist = []\nfor i in range(N):\n dist.append(bfs(i))\nans = float(\"inf\")\nif K % 2 == 0:\n # \u5168\u3066\u306e\u9802\u70b9\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\n for i in range(N):\n ans = min(ans, len([d for d in dist[i] if d > K \/ 2]))\nelse:\n # \u5168\u3066\u306e\u8fba\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\n for a, b in E:\n adist = [\n (1 if min(d1, d2) > (K - 1) \/ 2 else 0) for d1, d2 in zip(dist[a], dist[b])\n ]\n ans = min(ans, sum(adist))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- ans = min(ans, len(list([x for x in dist[i] if K \/ 2 < x])))","+ ans = min(ans, len([d for d in dist[i] if d > K \/ 2]))","- adist = [min(d1, d2) for d1, d2 in zip(dist[a], dist[b])]","- ans = min(ans, len(list([x for x in adist if (K - 1) \/ 2 < x])))","+ adist = [","+ (1 if min(d1, d2) > (K - 1) \/ 2 else 0) for d1, d2 in zip(dist[a], dist[b])","+ ]","+ ans = min(ans, sum(adist))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0415065265,"measured_runtime_v1":0.040081025,"runtime_lift":1.035565495,"key":["s203445479","s155683327"]} +{"user_id":"u727057618","problem_id":"p02713","language":"python","submission_id_v0":"s267828149","submission_id_v1":"s640619657","cpu_time_v0":1054,"cpu_time_v1":249,"memory_v0":27336,"memory_v1":9440,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.38,"input":"import numpy as np\n\nfrom itertools import combinations\n\n\n\ndef main():\n\n k = int(eval(input()))\n\n res = 0\n\n memo = np.zeros((k+1, k+1), int)\n\n for i in range(1, k+1):\n\n for j in range(i, k+1):\n\n tmp = np.gcd(i,j)\n\n memo[i][j] = tmp\n\n memo[j][i] = tmp\n\n\n\n for i in range(1, k+1):\n\n res += i \n\n\n\n for c in combinations(list(range(1,k+1)),2):\n\n ab = memo[c[0], c[1]]\n\n res += ab * 6\n\n\n\n for c in combinations(list(range(1,k+1)), 3):\n\n ab = memo[c[0], c[1]]\n\n abc = memo[ab, c[2]]\n\n res += abc * 6\n\n print(res)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n","target":"import math\n\nfrom itertools import combinations\n\n\n\ndef main():\n\n k = int(eval(input()))\n\n res = 0\n\n memo = [[0 for _ in range(k+1)] for _ in range(k+1)]\n\n for i in range(1, k+1):\n\n for j in range(i, k+1):\n\n tmp = math.gcd(i,j)\n\n memo[i][j] = tmp\n\n memo[j][i] = tmp\n\n\n\n for i in range(1, k+1):\n\n res += i \n\n\n\n for c in combinations(list(range(1,k+1)),2):\n\n ab = memo[c[0]][c[1]]\n\n res += ab * 6\n\n\n\n for c in combinations(list(range(1,k+1)), 3):\n\n ab = memo[c[0]][c[1]]\n\n abc = memo[ab][c[2]]\n\n res += abc * 6\n\n print(res)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n","code_v0_loc":30,"code_v1_loc":30,"code_v0_num_chars":640,"code_v1_num_chars":655,"code_v0_no_empty_lines":"import numpy as np\nfrom itertools import combinations\n\n\ndef main():\n k = int(eval(input()))\n res = 0\n memo = np.zeros((k + 1, k + 1), int)\n for i in range(1, k + 1):\n for j in range(i, k + 1):\n tmp = np.gcd(i, j)\n memo[i][j] = tmp\n memo[j][i] = tmp\n for i in range(1, k + 1):\n res += i\n for c in combinations(list(range(1, k + 1)), 2):\n ab = memo[c[0], c[1]]\n res += ab * 6\n for c in combinations(list(range(1, k + 1)), 3):\n ab = memo[c[0], c[1]]\n abc = memo[ab, c[2]]\n res += abc * 6\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import math\nfrom itertools import combinations\n\n\ndef main():\n k = int(eval(input()))\n res = 0\n memo = [[0 for _ in range(k + 1)] for _ in range(k + 1)]\n for i in range(1, k + 1):\n for j in range(i, k + 1):\n tmp = math.gcd(i, j)\n memo[i][j] = tmp\n memo[j][i] = tmp\n for i in range(1, k + 1):\n res += i\n for c in combinations(list(range(1, k + 1)), 2):\n ab = memo[c[0]][c[1]]\n res += ab * 6\n for c in combinations(list(range(1, k + 1)), 3):\n ab = memo[c[0]][c[1]]\n abc = memo[ab][c[2]]\n res += abc * 6\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","+import math","- memo = np.zeros((k + 1, k + 1), int)","+ memo = [[0 for _ in range(k + 1)] for _ in range(k + 1)]","- tmp = np.gcd(i, j)","+ tmp = math.gcd(i, j)","- ab = memo[c[0], c[1]]","+ ab = memo[c[0]][c[1]]","- ab = memo[c[0], c[1]]","- abc = memo[ab, c[2]]","+ ab = memo[c[0]][c[1]]","+ abc = memo[ab][c[2]]"],"diff_only_import_comment":false,"measured_runtime_v0":0.3283250284,"measured_runtime_v1":0.3139746611,"runtime_lift":1.045705495,"key":["s267828149","s640619657"]} +{"user_id":"u077291787","problem_id":"p02937","language":"python","submission_id_v0":"s765031044","submission_id_v1":"s726874123","cpu_time_v0":894,"cpu_time_v1":120,"memory_v0":3316,"memory_v1":7924,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.58,"input":"# ABC138E - Strings of Impurity\n\ndef main():\n\n S, T = tuple(eval(input()) for _ in range(2))\n\n if not set(T) <= set(S): # corner case\n\n print((-1))\n\n return\n\n ans, cur, idx, lim = 1, 0, -1, len(T)\n\n while cur < lim:\n\n find = S[idx + 1:].find(T[cur])\n\n if find == -1:\n\n ans += 1\n\n idx = -1\n\n else:\n\n idx += find + 1\n\n cur += 1\n\n ans = (ans - 1) * len(S) + idx + 1\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"# ABC138E - Strings of Impurity\n\nfrom bisect import bisect_left as bs\n\nfrom collections import defaultdict\n\n\n\n\n\ndef main():\n\n S, T = tuple(eval(input()) for _ in range(2))\n\n if not set(T) <= set(S): # corner case\n\n print((-1))\n\n return\n\n idx, ls = defaultdict(list), len(S)\n\n for i, s in enumerate(S):\n\n idx[s] += [i]\n\n cur = -1\n\n for t in T:\n\n tgt = idx[t]\n\n x = (cur + 1) % ls\n\n i = bs(tgt, x)\n\n if i < len(tgt):\n\n cur += 1 + tgt[i] - x\n\n else:\n\n cur += 1 + tgt[0] - x + ls\n\n print((cur + 1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":21,"code_v1_loc":27,"code_v0_num_chars":509,"code_v1_num_chars":628,"code_v0_no_empty_lines":"# ABC138E - Strings of Impurity\ndef main():\n S, T = tuple(eval(input()) for _ in range(2))\n if not set(T) <= set(S): # corner case\n print((-1))\n return\n ans, cur, idx, lim = 1, 0, -1, len(T)\n while cur < lim:\n find = S[idx + 1 :].find(T[cur])\n if find == -1:\n ans += 1\n idx = -1\n else:\n idx += find + 1\n cur += 1\n ans = (ans - 1) * len(S) + idx + 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# ABC138E - Strings of Impurity\nfrom bisect import bisect_left as bs\nfrom collections import defaultdict\n\n\ndef main():\n S, T = tuple(eval(input()) for _ in range(2))\n if not set(T) <= set(S): # corner case\n print((-1))\n return\n idx, ls = defaultdict(list), len(S)\n for i, s in enumerate(S):\n idx[s] += [i]\n cur = -1\n for t in T:\n tgt = idx[t]\n x = (cur + 1) % ls\n i = bs(tgt, x)\n if i < len(tgt):\n cur += 1 + tgt[i] - x\n else:\n cur += 1 + tgt[0] - x + ls\n print((cur + 1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["+from bisect import bisect_left as bs","+from collections import defaultdict","+","+","- ans, cur, idx, lim = 1, 0, -1, len(T)","- while cur < lim:","- find = S[idx + 1 :].find(T[cur])","- if find == -1:","- ans += 1","- idx = -1","+ idx, ls = defaultdict(list), len(S)","+ for i, s in enumerate(S):","+ idx[s] += [i]","+ cur = -1","+ for t in T:","+ tgt = idx[t]","+ x = (cur + 1) % ls","+ i = bs(tgt, x)","+ if i < len(tgt):","+ cur += 1 + tgt[i] - x","- idx += find + 1","- cur += 1","- ans = (ans - 1) * len(S) + idx + 1","- print(ans)","+ cur += 1 + tgt[0] - x + ls","+ print((cur + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0496177332,"measured_runtime_v1":0.0546397097,"runtime_lift":0.908089254,"key":["s765031044","s726874123"]} +{"user_id":"u079022693","problem_id":"p02863","language":"python","submission_id_v0":"s644864011","submission_id_v1":"s752811319","cpu_time_v0":932,"cpu_time_v1":532,"memory_v0":259848,"memory_v1":115292,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.92,"input":"from sys import stdin\n\ndef main():\n\n #\u5165\u529b\n\n readline=stdin.readline\n\n n,t=list(map(int,readline().split()))\n\n li=[list(map(int,readline().split())) for _ in range(n)]\n\n li.sort()\n\n a=[0]*n\n\n b=[0]*n\n\n for i in range(n):\n\n a[i],b[i]=li[i][0],li[i][1]\n\n\n\n #\u30ca\u30c3\u30d7\u30b5\u30c3\u30afDP\n\n inf=-float(\"inf\")\n\n dp=[[inf]*(t+1) for _ in range(n+1)]\n\n dp[0][0]=0\n\n for i in range(n):\n\n for j in range(t+1):\n\n #i\u756a\u76ee\u3092\u98df\u3079\u308b\n\n if j!=t:\n\n dp[i+1][min(t,j+a[i])]=max(dp[i+1][min(t,j+a[i])],dp[i][j]+b[i])\n\n \n\n #i\u756a\u76ee\u3092\u98df\u3079\u306a\u3044\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\n\n\n print((max(dp[n])))\n\n\n\nif __name__==\"__main__\":\n\n main()","target":"from sys import stdin\n\ndef main():\n\n #\u5165\u529b\n\n readline=stdin.readline\n\n n,t=list(map(int,readline().split()))\n\n li=[list(map(int,readline().split())) for _ in range(n)]\n\n li.sort()\n\n a=[0]*n\n\n b=[0]*n\n\n for i in range(n):\n\n a[i],b[i]=li[i][0],li[i][1]\n\n\n\n #\u30ca\u30c3\u30d7\u30b5\u30c3\u30afDP\n\n inf=-10**9\n\n dp=[[inf]*(t+1) for _ in range(n+1)]\n\n dp[0][0]=0\n\n for i in range(n):\n\n for j in range(t+1):\n\n #i\u756a\u76ee\u3092\u98df\u3079\u308b\n\n if j!=t:\n\n dp[i+1][min(t,j+a[i])]=max(dp[i+1][min(t,j+a[i])],dp[i][j]+b[i])\n\n \n\n #i\u756a\u76ee\u3092\u98df\u3079\u306a\u3044\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\n\n\n print((max(dp[n])))\n\n\n\nif __name__==\"__main__\":\n\n main()","code_v0_loc":29,"code_v1_loc":29,"code_v0_num_chars":702,"code_v1_num_chars":695,"code_v0_no_empty_lines":"from sys import stdin\n\n\ndef main():\n # \u5165\u529b\n readline = stdin.readline\n n, t = list(map(int, readline().split()))\n li = [list(map(int, readline().split())) for _ in range(n)]\n li.sort()\n a = [0] * n\n b = [0] * n\n for i in range(n):\n a[i], b[i] = li[i][0], li[i][1]\n # \u30ca\u30c3\u30d7\u30b5\u30c3\u30afDP\n inf = -float(\"inf\")\n dp = [[inf] * (t + 1) for _ in range(n + 1)]\n dp[0][0] = 0\n for i in range(n):\n for j in range(t + 1):\n # i\u756a\u76ee\u3092\u98df\u3079\u308b\n if j != t:\n dp[i + 1][min(t, j + a[i])] = max(\n dp[i + 1][min(t, j + a[i])], dp[i][j] + b[i]\n )\n # i\u756a\u76ee\u3092\u98df\u3079\u306a\u3044\n dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])\n print((max(dp[n])))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from sys import stdin\n\n\ndef main():\n # \u5165\u529b\n readline = stdin.readline\n n, t = list(map(int, readline().split()))\n li = [list(map(int, readline().split())) for _ in range(n)]\n li.sort()\n a = [0] * n\n b = [0] * n\n for i in range(n):\n a[i], b[i] = li[i][0], li[i][1]\n # \u30ca\u30c3\u30d7\u30b5\u30c3\u30afDP\n inf = -(10**9)\n dp = [[inf] * (t + 1) for _ in range(n + 1)]\n dp[0][0] = 0\n for i in range(n):\n for j in range(t + 1):\n # i\u756a\u76ee\u3092\u98df\u3079\u308b\n if j != t:\n dp[i + 1][min(t, j + a[i])] = max(\n dp[i + 1][min(t, j + a[i])], dp[i][j] + b[i]\n )\n # i\u756a\u76ee\u3092\u98df\u3079\u306a\u3044\n dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])\n print((max(dp[n])))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- inf = -float(\"inf\")","+ inf = -(10**9)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0424843645,"measured_runtime_v1":0.0382222726,"runtime_lift":1.1115080703,"key":["s644864011","s752811319"]} +{"user_id":"u493130708","problem_id":"p02679","language":"python","submission_id_v0":"s674468009","submission_id_v1":"s245882024","cpu_time_v0":560,"cpu_time_v1":511,"memory_v0":159636,"memory_v1":162468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.75,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n\n\nMOD = 10**9+7\n\nN = int(eval(input()))\n\nF = []\n\nzero_v = 0\n\ninf = 0\n\nzero = 0\n\nfor _ in range(N):\n\n x,y = list(map(int,input().split()))\n\n if x==0 and y==0:\n\n zero_v += 1\n\n elif x==0:\n\n inf += 1\n\n elif y==0:\n\n zero += 1\n\n else:\n\n G = gcd(abs(x),abs(y))\n\n F.append((x\/\/G,y\/\/G))\n\n\n\nall_keys = set()\n\n\n\nfor x,y in F:\n\n if x*y >0:\n\n if x>0:\n\n all_keys.add((x,y))\n\n else:\n\n all_keys.add((-x,-y))\n\n x,y = -y,x\n\n if x*y >0:\n\n if x>0:\n\n all_keys.add((x,y))\n\n else:\n\n all_keys.add((-x,-y))\n\n\n\nall_dic = {k:[0,0] for k in all_keys}\n\n\n\nfor x,y in F:\n\n if x*y > 0:\n\n if x>0:\n\n all_dic[(x,y)][0] += 1\n\n else:\n\n all_dic[(-x,-y)][0] += 1\n\n else:\n\n if x>0:\n\n all_dic[(-y,x)][1] += 1\n\n else:\n\n all_dic[(y,-x)][1] += 1\n\n\n\nans = (pow(2,inf,MOD)) + (pow(2,zero,MOD))-1\n\nans %= MOD\n\n\n\nfor k in all_keys:\n\n P,N = all_dic[k]\n\n ans *= (pow(2,P,MOD)) + (pow(2,N,MOD))-1\n\n ans %= MOD\n\n\n\n\n\nans += zero_v-1\n\n\n\nprint((ans%MOD))\n","target":"import sys\n\ninput = sys.stdin.readline\n\nimport math\n\n\n\nMOD = 10**9+7\n\nN = int(eval(input()))\n\nF = []\n\nzero_v = 0\n\ninf = 0\n\nzero = 0\n\nfor _ in range(N):\n\n x,y = list(map(int,input().split()))\n\n if x==0 and y==0:\n\n zero_v += 1\n\n elif x==0:\n\n inf += 1\n\n elif y==0:\n\n zero += 1\n\n else:\n\n G = math.gcd(abs(x),abs(y))\n\n F.append((x\/\/G,y\/\/G))\n\n\n\nall_keys = set()\n\n\n\nfor x,y in F:\n\n if x*y >0:\n\n if x>0:\n\n all_keys.add((x,y))\n\n else:\n\n all_keys.add((-x,-y))\n\n x,y = -y,x\n\n if x*y >0:\n\n if x>0:\n\n all_keys.add((x,y))\n\n else:\n\n all_keys.add((-x,-y))\n\n\n\nall_dic = {k:[0,0] for k in all_keys}\n\n\n\nfor x,y in F:\n\n if x*y > 0:\n\n if x>0:\n\n all_dic[(x,y)][0] += 1\n\n else:\n\n all_dic[(-x,-y)][0] += 1\n\n else:\n\n if x>0:\n\n all_dic[(-y,x)][1] += 1\n\n else:\n\n all_dic[(y,-x)][1] += 1\n\n\n\nans = (pow(2,inf,MOD)) + (pow(2,zero,MOD))-1\n\nans %= MOD\n\n\n\nfor k in all_keys:\n\n P,N = all_dic[k]\n\n ans *= (pow(2,P,MOD)) + (pow(2,N,MOD))-1\n\n ans %= MOD\n\n\n\n\n\nans += zero_v-1\n\n\n\nprint((ans%MOD))\n","code_v0_loc":67,"code_v1_loc":63,"code_v0_num_chars":1081,"code_v1_num_chars":1036,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\nMOD = 10**9 + 7\nN = int(eval(input()))\nF = []\nzero_v = 0\ninf = 0\nzero = 0\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if x == 0 and y == 0:\n zero_v += 1\n elif x == 0:\n inf += 1\n elif y == 0:\n zero += 1\n else:\n G = gcd(abs(x), abs(y))\n F.append((x \/\/ G, y \/\/ G))\nall_keys = set()\nfor x, y in F:\n if x * y > 0:\n if x > 0:\n all_keys.add((x, y))\n else:\n all_keys.add((-x, -y))\n x, y = -y, x\n if x * y > 0:\n if x > 0:\n all_keys.add((x, y))\n else:\n all_keys.add((-x, -y))\nall_dic = {k: [0, 0] for k in all_keys}\nfor x, y in F:\n if x * y > 0:\n if x > 0:\n all_dic[(x, y)][0] += 1\n else:\n all_dic[(-x, -y)][0] += 1\n else:\n if x > 0:\n all_dic[(-y, x)][1] += 1\n else:\n all_dic[(y, -x)][1] += 1\nans = (pow(2, inf, MOD)) + (pow(2, zero, MOD)) - 1\nans %= MOD\nfor k in all_keys:\n P, N = all_dic[k]\n ans *= (pow(2, P, MOD)) + (pow(2, N, MOD)) - 1\n ans %= MOD\nans += zero_v - 1\nprint((ans % MOD))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nimport math\n\nMOD = 10**9 + 7\nN = int(eval(input()))\nF = []\nzero_v = 0\ninf = 0\nzero = 0\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if x == 0 and y == 0:\n zero_v += 1\n elif x == 0:\n inf += 1\n elif y == 0:\n zero += 1\n else:\n G = math.gcd(abs(x), abs(y))\n F.append((x \/\/ G, y \/\/ G))\nall_keys = set()\nfor x, y in F:\n if x * y > 0:\n if x > 0:\n all_keys.add((x, y))\n else:\n all_keys.add((-x, -y))\n x, y = -y, x\n if x * y > 0:\n if x > 0:\n all_keys.add((x, y))\n else:\n all_keys.add((-x, -y))\nall_dic = {k: [0, 0] for k in all_keys}\nfor x, y in F:\n if x * y > 0:\n if x > 0:\n all_dic[(x, y)][0] += 1\n else:\n all_dic[(-x, -y)][0] += 1\n else:\n if x > 0:\n all_dic[(-y, x)][1] += 1\n else:\n all_dic[(y, -x)][1] += 1\nans = (pow(2, inf, MOD)) + (pow(2, zero, MOD)) - 1\nans %= MOD\nfor k in all_keys:\n P, N = all_dic[k]\n ans *= (pow(2, P, MOD)) + (pow(2, N, MOD)) - 1\n ans %= MOD\nans += zero_v - 1\nprint((ans % MOD))\n","code_same":false,"relative_loc_diff_percent":5.9701492537,"diff":["-","-","-def gcd(a, b):","- while b:","- a, b = b, a % b","- return a","-","+import math","- G = gcd(abs(x), abs(y))","+ G = math.gcd(abs(x), abs(y))"],"diff_only_import_comment":false,"measured_runtime_v0":0.038055551,"measured_runtime_v1":0.035256813,"runtime_lift":1.07938148,"key":["s674468009","s245882024"]} +{"user_id":"u527993431","problem_id":"p03110","language":"python","submission_id_v0":"s244426846","submission_id_v1":"s309771250","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"N=int(eval(input()))\n\nX=[]\n\nU=[]\n\nans=0\n\nfor i in range(N):\n\n\tA,B=input().split()\n\n\tX.append(float(A))\n\n\tU.append(B)\n\nfor i in range(N):\n\n\tif U[i]==\"JPY\":\n\n\t\tans+=X[i]\n\n\telif U[i]==\"BTC\":\n\n\t\tans+=(X[i]*380000.0)\n\nprint(ans)","target":"N=int(eval(input()))\n\nans=0\n\nfor i in range (N):\n\n\tA,B=input().split()\n\n\tif B==\"JPY\":\n\n\t\tans+=float(A)\n\n\telif B==\"BTC\":\n\n\t\tans+=float(A)*380000.0\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":9,"code_v0_num_chars":217,"code_v1_num_chars":151,"code_v0_no_empty_lines":"N = int(eval(input()))\nX = []\nU = []\nans = 0\nfor i in range(N):\n A, B = input().split()\n X.append(float(A))\n U.append(B)\nfor i in range(N):\n if U[i] == \"JPY\":\n ans += X[i]\n elif U[i] == \"BTC\":\n ans += X[i] * 380000.0\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nans = 0\nfor i in range(N):\n A, B = input().split()\n if B == \"JPY\":\n ans += float(A)\n elif B == \"BTC\":\n ans += float(A) * 380000.0\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-X = []","-U = []","- X.append(float(A))","- U.append(B)","-for i in range(N):","- if U[i] == \"JPY\":","- ans += X[i]","- elif U[i] == \"BTC\":","- ans += X[i] * 380000.0","+ if B == \"JPY\":","+ ans += float(A)","+ elif B == \"BTC\":","+ ans += float(A) * 380000.0"],"diff_only_import_comment":false,"measured_runtime_v0":0.121890249,"measured_runtime_v1":0.0838430693,"runtime_lift":1.4537903967,"key":["s244426846","s309771250"]} +{"user_id":"u296150111","problem_id":"p03013","language":"python","submission_id_v0":"s287236221","submission_id_v1":"s200979855","cpu_time_v0":351,"cpu_time_v1":166,"memory_v0":460020,"memory_v1":16804,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.71,"input":"def Fib(n):\n\n a=[0,1,1]\n\n if n<=2:\n\n \treturn a[n]\n\n else:\n\n \tfor i in range(n-2):\n\n \t\ta.append(a[i+1]+a[i+2])\n\n \treturn a[n]\n\nn,m=list(map(int,input().split()))\n\nif m==0:\n\n\tprint((Fib(n+1)%(10**9+7)))\n\n\texit()\n\na=[]\n\nfor i in range(m):\n\n\ta.append(int(eval(input())))\n\nif a[0]!=1:\n\n\ta.insert(0,-1)\n\nif a[-1]!=n-1:\n\n\ta.append(n+1)\n\nb=[]\n\nfor i in range(len(a)-1):\n\n\tb.append(a[i+1]-a[i]-1)\n\n\tif a[i+1]-a[i]==1:\n\n\t\tprint((0))\n\n\t\texit()\n\nans=1\n\nfor i in range(len(b)):\n\n\tans*=Fib(b[i])\n\n\tans%=10**9+7\n\nprint(ans)","target":"mod=10**9+7\n\nn,m=list(map(int,input().split()))\n\na=[int(eval(input()))for _ in range(m)]\n\na.append(n+1)\n\nfib=[1,1]\n\nfor i in range(n):\n\n\tr=fib[-1]+fib[-2]\n\n\tfib.append(r%mod)\n\nans=1\n\nnow=0\n\nfor x in a:\n\n\tans*=fib[x-1-now]\n\n\tif x-1-now<0:\n\n\t\tprint((0))\n\n\t\texit()\n\n\tans%=mod\n\n\tnow=x+1\n\nprint(ans)","code_v0_loc":30,"code_v1_loc":18,"code_v0_num_chars":513,"code_v1_num_chars":280,"code_v0_no_empty_lines":"def Fib(n):\n a = [0, 1, 1]\n if n <= 2:\n return a[n]\n else:\n for i in range(n - 2):\n a.append(a[i + 1] + a[i + 2])\n return a[n]\n\n\nn, m = list(map(int, input().split()))\nif m == 0:\n print((Fib(n + 1) % (10**9 + 7)))\n exit()\na = []\nfor i in range(m):\n a.append(int(eval(input())))\nif a[0] != 1:\n a.insert(0, -1)\nif a[-1] != n - 1:\n a.append(n + 1)\nb = []\nfor i in range(len(a) - 1):\n b.append(a[i + 1] - a[i] - 1)\n if a[i + 1] - a[i] == 1:\n print((0))\n exit()\nans = 1\nfor i in range(len(b)):\n ans *= Fib(b[i])\n ans %= 10**9 + 7\nprint(ans)\n","code_v1_no_empty_lines":"mod = 10**9 + 7\nn, m = list(map(int, input().split()))\na = [int(eval(input())) for _ in range(m)]\na.append(n + 1)\nfib = [1, 1]\nfor i in range(n):\n r = fib[-1] + fib[-2]\n fib.append(r % mod)\nans = 1\nnow = 0\nfor x in a:\n ans *= fib[x - 1 - now]\n if x - 1 - now < 0:\n print((0))\n exit()\n ans %= mod\n now = x + 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-def Fib(n):","- a = [0, 1, 1]","- if n <= 2:","- return a[n]","- else:","- for i in range(n - 2):","- a.append(a[i + 1] + a[i + 2])","- return a[n]","-","-","+mod = 10**9 + 7","-if m == 0:","- print((Fib(n + 1) % (10**9 + 7)))","- exit()","-a = []","-for i in range(m):","- a.append(int(eval(input())))","-if a[0] != 1:","- a.insert(0, -1)","-if a[-1] != n - 1:","- a.append(n + 1)","-b = []","-for i in range(len(a) - 1):","- b.append(a[i + 1] - a[i] - 1)","- if a[i + 1] - a[i] == 1:","+a = [int(eval(input())) for _ in range(m)]","+a.append(n + 1)","+fib = [1, 1]","+for i in range(n):","+ r = fib[-1] + fib[-2]","+ fib.append(r % mod)","+ans = 1","+now = 0","+for x in a:","+ ans *= fib[x - 1 - now]","+ if x - 1 - now < 0:","-ans = 1","-for i in range(len(b)):","- ans *= Fib(b[i])","- ans %= 10**9 + 7","+ ans %= mod","+ now = x + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0393255856,"measured_runtime_v1":0.0387844818,"runtime_lift":1.013951555,"key":["s287236221","s200979855"]} +{"user_id":"u561083515","problem_id":"p02762","language":"python","submission_id_v0":"s916641409","submission_id_v1":"s936379713","cpu_time_v0":1412,"cpu_time_v1":1259,"memory_v0":31844,"memory_v1":31776,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.84,"input":"\"\"\"\n\n\u53cb\u9054\u3067\u3082\u5acc\u3044\u3067\u3082\u306a\u3044\u4eba\n\n\u53cb\u9054\u306e\u53cb\u9054(\u306e\u53cb\u9054\u306e...)\n\n-> ok\n\n\"\"\"\n\nclass UnionFind():\n\n # \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\n\n def __init__(self, n):\n\n # \u8981\u7d20\u6570\n\n self.n = n\n\n # parents[i]: \u8981\u7d20i\u306e\u89aa\u8981\u7d20\u306e\u756a\u53f7\n\n # \u8981\u7d20i\u304c\u6839\u306e\u5834\u5408\u3001parents[i] = -(\u305d\u306e\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u6570)\n\n self.parents = [-1] * n\n\n\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u6839\u3092\u8fd4\u3059\n\n # \u7d4c\u8def\u5727\u7e2e\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u8981\u7d20y\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u3092\u4f75\u5408\u3059\u308b\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u6570\u3092\u8fd4\u3059\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n\n\n # \u8981\u7d20x,y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u8fd4\u3059\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n\n def members(self, x):\n\n root = self.find(x)\n\n return [i for i in range(self.n) if self.find(i) == root]\n\n\n\n # \u5168\u3066\u306e\u6839\u306e\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n\n\n # \u30b0\u30eb\u30fc\u30d7\u306e\u6570\u3092\u8fd4\u3059\n\n def group_count(self):\n\n return len(self.roots())\n\n\n\n\n\nN,M,K = map(int,input().split())\n\n\n\nbest = [0] * N\n\n\n\nfriend = UnionFind(N)\n\nfor _ in range(M):\n\n A,B = map(int,input().split())\n\n best[A-1] += 1\n\n best[B-1] += 1\n\n friend.union(A-1, B-1)\n\n\n\nbad = [[] for _ in range(N)]\n\nfor _ in range(K):\n\n C,D = map(int,input().split())\n\n bad[C-1].append(D-1)\n\n bad[D-1].append(C-1)\n\n\n\n\n\nans = [0] * N\n\nfor i in range(N):\n\n ans[i] = friend.size(i) - best[i] - 1\n\n for kirai in bad[i]:\n\n if friend.same(i, kirai):\n\n ans[i] -= 1\n\n\n\nprint(*ans, sep=\" \")\n","target":"class UnionFind():\n\n # \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\n\n def __init__(self, n):\n\n # \u8981\u7d20\u6570\n\n self.n = n\n\n # parents[i]: \u8981\u7d20i\u306e\u89aa\u8981\u7d20\u306e\u756a\u53f7\n\n # \u8981\u7d20i\u304c\u6839\u306e\u5834\u5408\u3001parents[i] = -(\u305d\u306e\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u6570)\n\n self.parents = [-1] * n\n\n \n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u6839\u3092\u8fd4\u3059\n\n # \u7d4c\u8def\u5727\u7e2e\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n \n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u8981\u7d20y\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u3092\u4f75\u5408\u3059\u308b\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n \n\n if x == y:\n\n return\n\n \n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n \n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n \n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u6570\u3092\u8fd4\u3059\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n \n\n # \u8981\u7d20x,y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u8fd4\u3059\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n \n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n\n def members(self, x):\n\n root = self.find(x)\n\n return [i for i in range(self.n) if self.find(i) == root]\n\n \n\n # \u5168\u3066\u306e\u6839\u306e\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n \n\n # \u30b0\u30eb\u30fc\u30d7\u306e\u6570\u3092\u8fd4\u3059\n\n def group_count(self):\n\n return len(self.roots())\n\n\n\ndef main():\n\n N,M,K = map(int,input().split())\n\n\n\n best_friend = [0] * N\n\n friend = UnionFind(N)\n\n for _ in range(M):\n\n A,B = map(int,input().split())\n\n best_friend[A-1] += 1\n\n best_friend[B-1] += 1\n\n friend.union(A-1, B-1)\n\n\n\n blocked = [[] for _ in range(N)]\n\n for _ in range(K):\n\n C,D = map(int,input().split())\n\n blocked[C-1].append(D-1)\n\n blocked[D-1].append(C-1)\n\n\n\n ans = [0] * N\n\n for i in range(N):\n\n # \u53cb\u9054\u5019\u88dc - \u53cb\u9054 - \u81ea\u5206\n\n ans[i] = friend.size(i) - best_friend[i] - 1\n\n # \u5acc\u3044\u306a\u4eba\u306f\u53cb\u9054\u306b\u306a\u308c\u306a\u3044\n\n for bad in blocked[i]:\n\n if friend.same(i, bad):\n\n ans[i] -= 1\n\n\n\n print(*ans, sep=\" \")\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":85,"code_v1_loc":83,"code_v0_num_chars":1879,"code_v1_num_chars":2062,"code_v0_no_empty_lines":"\"\"\"\n\u53cb\u9054\u3067\u3082\u5acc\u3044\u3067\u3082\u306a\u3044\u4eba\n\u53cb\u9054\u306e\u53cb\u9054(\u306e\u53cb\u9054\u306e...)\n-> ok\n\"\"\"\n\n\nclass UnionFind:\n # \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\n def __init__(self, n):\n # \u8981\u7d20\u6570\n self.n = n\n # parents[i]: \u8981\u7d20i\u306e\u89aa\u8981\u7d20\u306e\u756a\u53f7\n # \u8981\u7d20i\u304c\u6839\u306e\u5834\u5408\u3001parents[i] = -(\u305d\u306e\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u6570)\n self.parents = [-1] * n\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u6839\u3092\u8fd4\u3059\n # \u7d4c\u8def\u5727\u7e2e\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u8981\u7d20y\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u3092\u4f75\u5408\u3059\u308b\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u6570\u3092\u8fd4\u3059\n def size(self, x):\n return -self.parents[self.find(x)]\n\n # \u8981\u7d20x,y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u8fd4\u3059\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n # \u5168\u3066\u306e\u6839\u306e\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n # \u30b0\u30eb\u30fc\u30d7\u306e\u6570\u3092\u8fd4\u3059\n def group_count(self):\n return len(self.roots())\n\n\nN, M, K = map(int, input().split())\nbest = [0] * N\nfriend = UnionFind(N)\nfor _ in range(M):\n A, B = map(int, input().split())\n best[A - 1] += 1\n best[B - 1] += 1\n friend.union(A - 1, B - 1)\nbad = [[] for _ in range(N)]\nfor _ in range(K):\n C, D = map(int, input().split())\n bad[C - 1].append(D - 1)\n bad[D - 1].append(C - 1)\nans = [0] * N\nfor i in range(N):\n ans[i] = friend.size(i) - best[i] - 1\n for kirai in bad[i]:\n if friend.same(i, kirai):\n ans[i] -= 1\nprint(*ans, sep=\" \")\n","code_v1_no_empty_lines":"class UnionFind:\n # \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\n def __init__(self, n):\n # \u8981\u7d20\u6570\n self.n = n\n # parents[i]: \u8981\u7d20i\u306e\u89aa\u8981\u7d20\u306e\u756a\u53f7\n # \u8981\u7d20i\u304c\u6839\u306e\u5834\u5408\u3001parents[i] = -(\u305d\u306e\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u6570)\n self.parents = [-1] * n\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u6839\u3092\u8fd4\u3059\n # \u7d4c\u8def\u5727\u7e2e\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u8981\u7d20y\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u3092\u4f75\u5408\u3059\u308b\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u8981\u7d20\u6570\u3092\u8fd4\u3059\n def size(self, x):\n return -self.parents[self.find(x)]\n\n # \u8981\u7d20x,y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u8fd4\u3059\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n # \u5168\u3066\u306e\u6839\u306e\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n # \u30b0\u30eb\u30fc\u30d7\u306e\u6570\u3092\u8fd4\u3059\n def group_count(self):\n return len(self.roots())\n\n\ndef main():\n N, M, K = map(int, input().split())\n best_friend = [0] * N\n friend = UnionFind(N)\n for _ in range(M):\n A, B = map(int, input().split())\n best_friend[A - 1] += 1\n best_friend[B - 1] += 1\n friend.union(A - 1, B - 1)\n blocked = [[] for _ in range(N)]\n for _ in range(K):\n C, D = map(int, input().split())\n blocked[C - 1].append(D - 1)\n blocked[D - 1].append(C - 1)\n ans = [0] * N\n for i in range(N):\n # \u53cb\u9054\u5019\u88dc - \u53cb\u9054 - \u81ea\u5206\n ans[i] = friend.size(i) - best_friend[i] - 1\n # \u5acc\u3044\u306a\u4eba\u306f\u53cb\u9054\u306b\u306a\u308c\u306a\u3044\n for bad in blocked[i]:\n if friend.same(i, bad):\n ans[i] -= 1\n print(*ans, sep=\" \")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.3529411765,"diff":["-\"\"\"","-\u53cb\u9054\u3067\u3082\u5acc\u3044\u3067\u3082\u306a\u3044\u4eba","-\u53cb\u9054\u306e\u53cb\u9054(\u306e\u53cb\u9054\u306e...)","--> ok","-\"\"\"","-","-","-N, M, K = map(int, input().split())","-best = [0] * N","-friend = UnionFind(N)","-for _ in range(M):","- A, B = map(int, input().split())","- best[A - 1] += 1","- best[B - 1] += 1","- friend.union(A - 1, B - 1)","-bad = [[] for _ in range(N)]","-for _ in range(K):","- C, D = map(int, input().split())","- bad[C - 1].append(D - 1)","- bad[D - 1].append(C - 1)","-ans = [0] * N","-for i in range(N):","- ans[i] = friend.size(i) - best[i] - 1","- for kirai in bad[i]:","- if friend.same(i, kirai):","- ans[i] -= 1","-print(*ans, sep=\" \")","+def main():","+ N, M, K = map(int, input().split())","+ best_friend = [0] * N","+ friend = UnionFind(N)","+ for _ in range(M):","+ A, B = map(int, input().split())","+ best_friend[A - 1] += 1","+ best_friend[B - 1] += 1","+ friend.union(A - 1, B - 1)","+ blocked = [[] for _ in range(N)]","+ for _ in range(K):","+ C, D = map(int, input().split())","+ blocked[C - 1].append(D - 1)","+ blocked[D - 1].append(C - 1)","+ ans = [0] * N","+ for i in range(N):","+ # \u53cb\u9054\u5019\u88dc - \u53cb\u9054 - \u81ea\u5206","+ ans[i] = friend.size(i) - best_friend[i] - 1","+ # \u5acc\u3044\u306a\u4eba\u306f\u53cb\u9054\u306b\u306a\u308c\u306a\u3044","+ for bad in blocked[i]:","+ if friend.same(i, bad):","+ ans[i] -= 1","+ print(*ans, sep=\" \")","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370196652,"measured_runtime_v1":0.0429042757,"runtime_lift":0.8628432637,"key":["s916641409","s936379713"]} +{"user_id":"u803617136","problem_id":"p03029","language":"python","submission_id_v0":"s456560803","submission_id_v1":"s797008704","cpu_time_v0":174,"cpu_time_v1":24,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.21,"input":"A, P = list(map(int, input().split()))\n\nprint(((A * 3 + P) \/\/ 2))","target":"a, p = list(map(int, input().split()))\n\nans = (a * 3 + p) \/\/ 2\n\nprint(ans)","code_v0_loc":2,"code_v1_loc":3,"code_v0_num_chars":57,"code_v1_num_chars":68,"code_v0_no_empty_lines":"A, P = list(map(int, input().split()))\nprint(((A * 3 + P) \/\/ 2))\n","code_v1_no_empty_lines":"a, p = list(map(int, input().split()))\nans = (a * 3 + p) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-A, P = list(map(int, input().split()))","-print(((A * 3 + P) \/\/ 2))","+a, p = list(map(int, input().split()))","+ans = (a * 3 + p) \/\/ 2","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0865677371,"measured_runtime_v1":0.0072432373,"runtime_lift":11.9515258042,"key":["s456560803","s797008704"]} +{"user_id":"u762420987","problem_id":"p04045","language":"python","submission_id_v0":"s516582219","submission_id_v1":"s982508234","cpu_time_v0":99,"cpu_time_v1":70,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.29,"input":"N, K = list(map(int, input().split()))\n\nDset = set(input().split())\n\nwhile True:\n\n if Dset & set(str(N)) == set():\n\n print(N)\n\n break\n\n else:\n\n N += 1\n","target":"def check(num, ng):\n\n for c in str(num):\n\n if int(c) in ng:\n\n return False\n\n return True\n\nN, K = list(map(int, input().split()))\n\nD = set(list(map(int, input().split())))\n\nwhile True:\n\n if check(N, D):\n\n print(N)\n\n break\n\n else:\n\n N += 1\n","code_v0_loc":8,"code_v1_loc":13,"code_v0_num_chars":172,"code_v1_num_chars":283,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nDset = set(input().split())\nwhile True:\n if Dset & set(str(N)) == set():\n print(N)\n break\n else:\n N += 1\n","code_v1_no_empty_lines":"def check(num, ng):\n for c in str(num):\n if int(c) in ng:\n return False\n return True\n\n\nN, K = list(map(int, input().split()))\nD = set(list(map(int, input().split())))\nwhile True:\n if check(N, D):\n print(N)\n break\n else:\n N += 1\n","code_same":false,"relative_loc_diff_percent":38.4615384615,"diff":["+def check(num, ng):","+ for c in str(num):","+ if int(c) in ng:","+ return False","+ return True","+","+","-Dset = set(input().split())","+D = set(list(map(int, input().split())))","- if Dset & set(str(N)) == set():","+ if check(N, D):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0390007019,"measured_runtime_v1":0.081976223,"runtime_lift":0.4757562678,"key":["s516582219","s982508234"]} +{"user_id":"u588341295","problem_id":"p03645","language":"python","submission_id_v0":"s596950997","submission_id_v1":"s417352851","cpu_time_v0":716,"cpu_time_v1":582,"memory_v0":61028,"memory_v1":6132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.72,"input":"# -*- coding: utf-8 -*-\n\n\n\nN, M = list(map(int, input().split()))\n\nabM = [list(map(int, input().split())) for i in range(M)]\n\n\n\ntransit = []\n\ntransit2 = []\n\nfor i in range(M):\n\n if abM[i][0] == 1:\n\n transit.append(abM[i][1])\n\n if abM[i][1] == N:\n\n transit2.append(abM[i][0])\n\n\n\n# set\u3067\u5171\u901a\u8981\u7d20\u306e\u96c6\u5408\u3092\u53d6\u3063\u3066\u307f\u308b\n\nif len(set(transit) & set(transit2)) != 0:\n\n print(\"POSSIBLE\")\n\nelse:\n\n print(\"IMPOSSIBLE\")","target":"# -*- coding: utf-8 -*-\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\n# 1\u304b\u3089\u3042\u308b\u5cf6\u3078\u306e\u4fbf\u304c\u3042\u308b\u304b\u3092\u4fdd\u6301\n\ntransit = [False] * N\n\n# \u3042\u308b\u5cf6\u304b\u3089N\u3078\u306e\u4fbf\u304c\u3042\u308b\u304b\u3092\u4fdd\u6301\n\ntransit2 = [False] * N\n\n\n\nfor i in range(M):\n\n a, b = list(map(int, input().split()))\n\n if a == 1:\n\n transit[b] = True\n\n if b == N:\n\n transit2[a] = True\n\n\n\nfor i in range(N):\n\n if transit[i] and transit2[i]:\n\n print(\"POSSIBLE\")\n\n exit()\n\nprint(\"IMPOSSIBLE\")","code_v0_loc":18,"code_v1_loc":21,"code_v0_num_chars":410,"code_v1_num_chars":417,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nN, M = list(map(int, input().split()))\nabM = [list(map(int, input().split())) for i in range(M)]\ntransit = []\ntransit2 = []\nfor i in range(M):\n if abM[i][0] == 1:\n transit.append(abM[i][1])\n if abM[i][1] == N:\n transit2.append(abM[i][0])\n# set\u3067\u5171\u901a\u8981\u7d20\u306e\u96c6\u5408\u3092\u53d6\u3063\u3066\u307f\u308b\nif len(set(transit) & set(transit2)) != 0:\n print(\"POSSIBLE\")\nelse:\n print(\"IMPOSSIBLE\")\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nN, M = list(map(int, input().split()))\n# 1\u304b\u3089\u3042\u308b\u5cf6\u3078\u306e\u4fbf\u304c\u3042\u308b\u304b\u3092\u4fdd\u6301\ntransit = [False] * N\n# \u3042\u308b\u5cf6\u304b\u3089N\u3078\u306e\u4fbf\u304c\u3042\u308b\u304b\u3092\u4fdd\u6301\ntransit2 = [False] * N\nfor i in range(M):\n a, b = list(map(int, input().split()))\n if a == 1:\n transit[b] = True\n if b == N:\n transit2[a] = True\nfor i in range(N):\n if transit[i] and transit2[i]:\n print(\"POSSIBLE\")\n exit()\nprint(\"IMPOSSIBLE\")\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-abM = [list(map(int, input().split())) for i in range(M)]","-transit = []","-transit2 = []","+# 1\u304b\u3089\u3042\u308b\u5cf6\u3078\u306e\u4fbf\u304c\u3042\u308b\u304b\u3092\u4fdd\u6301","+transit = [False] * N","+# \u3042\u308b\u5cf6\u304b\u3089N\u3078\u306e\u4fbf\u304c\u3042\u308b\u304b\u3092\u4fdd\u6301","+transit2 = [False] * N","- if abM[i][0] == 1:","- transit.append(abM[i][1])","- if abM[i][1] == N:","- transit2.append(abM[i][0])","-# set\u3067\u5171\u901a\u8981\u7d20\u306e\u96c6\u5408\u3092\u53d6\u3063\u3066\u307f\u308b","-if len(set(transit) & set(transit2)) != 0:","- print(\"POSSIBLE\")","-else:","- print(\"IMPOSSIBLE\")","+ a, b = list(map(int, input().split()))","+ if a == 1:","+ transit[b] = True","+ if b == N:","+ transit2[a] = True","+for i in range(N):","+ if transit[i] and transit2[i]:","+ print(\"POSSIBLE\")","+ exit()","+print(\"IMPOSSIBLE\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0675536156,"measured_runtime_v1":0.0372154236,"runtime_lift":1.8152048008,"key":["s596950997","s417352851"]} +{"user_id":"u095426154","problem_id":"p03608","language":"python","submission_id_v0":"s058847362","submission_id_v1":"s403793125","cpu_time_v0":259,"cpu_time_v1":188,"memory_v0":4212,"memory_v1":77780,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.41,"input":"# coding: utf-8\n\nfrom heapq import heappop, heappush\n\nfrom itertools import permutations\n\n\n\nN,M,R=list(map(int,input().split()))\n\ntown=list(map(int,input().split()))\n\nINF=10**9\n\nG=[[INF for i in range(N+1)] for j in range(N+1)]\n\n\n\nfor i in range(M):\n\n A,B,C=list(map(int,input().split()))\n\n G[A][B]=C\n\n G[B][A]=C\n\n\n\nd=[[INF*10 for i in range(N+1)] for j in range(R)]\n\n\n\nfor k in range(R):\n\n r=town[k]\n\n d[k][r]=0\n\n \n\n used=[False for i in range(N+1)]\n\n \n\n heap=[]\n\n heappush(heap,(d[k][r],r))\n\n \n\n while heap:\n\n d_u, u = heappop(heap)\n\n\n\n used[u] = True\n\n \n\n if d[k][u] < d_u:\n\n continue\n\n \n\n for v in range(N+1):\n\n if not(used[v]) and d_u + G[u][v] < d[k][v]:\n\n d[k][v] = d_u + G[u][v]\n\n heappush(heap,(d[k][v],v))\n\n\n\nans=INF\n\n\n\nL=[i for i in range(R)]\n\n\n\nfor v in permutations(L,R):\n\n D=0\n\n for i in range(R-1):\n\n D+=d[v[i]][town[v[i+1]]]\n\n ans=min(ans,D)\n\n \n\nprint(ans)","target":"# coding: utf-8\n\nfrom heapq import heappop, heappush\n\nfrom itertools import permutations\n\nN,M,R=list(map(int,input().split()))\n\nr_list=list(map(int,input().split()))\n\n\n\nINF=10**11\n\nG=[[INF for j in range(N+1)] for i in range(N+1)]\n\nconection=[[] for i in range(N+1)]\n\n\n\nRG=[[INF for j in range(N+1)] for i in range(N+1)]\n\n\n\nfor i in range(M):\n\n A,B,C=list(map(int,input().split()))\n\n G[A][B]=C\n\n G[B][A]=C\n\n conection[A].append(B)\n\n conection[B].append(A)\n\n\n\nfor k in range(R):\n\n start=r_list[k]\n\n d=[INF for i in range(N+1)]\n\n d[start]=0\n\n \n\n used=[False for i in range(N+1)]\n\n \n\n heap=[]\n\n heappush(heap,(d[start],start))\n\n \n\n while heap:\n\n d_u, u = heappop(heap)\n\n used[u] = True\n\n\n\n if d[u] < d_u:\n\n continue\n\n \n\n for v in conection[u]:\n\n if not(used[v]) and d_u + G[u][v] < d[v]:\n\n d[v] = d_u + G[u][v]\n\n heappush(heap,(d[v],v))\n\n \n\n for i in range(R):\n\n r=r_list[i]\n\n RG[start][r]=d[r]\n\n RG[r][start]=d[r]\n\n \n\nP=permutations(r_list,R)\n\nans=INF\n\n\n\nfor p in P:\n\n tmp=0\n\n for j in range(R-1):\n\n tmp+=RG[p[j]][p[j+1]]\n\n ans=min(ans,tmp)\n\n\n\nprint(ans)","code_v0_loc":49,"code_v1_loc":56,"code_v0_num_chars":1009,"code_v1_num_chars":1222,"code_v0_no_empty_lines":"# coding: utf-8\nfrom heapq import heappop, heappush\nfrom itertools import permutations\n\nN, M, R = list(map(int, input().split()))\ntown = list(map(int, input().split()))\nINF = 10**9\nG = [[INF for i in range(N + 1)] for j in range(N + 1)]\nfor i in range(M):\n A, B, C = list(map(int, input().split()))\n G[A][B] = C\n G[B][A] = C\nd = [[INF * 10 for i in range(N + 1)] for j in range(R)]\nfor k in range(R):\n r = town[k]\n d[k][r] = 0\n used = [False for i in range(N + 1)]\n heap = []\n heappush(heap, (d[k][r], r))\n while heap:\n d_u, u = heappop(heap)\n used[u] = True\n if d[k][u] < d_u:\n continue\n for v in range(N + 1):\n if not (used[v]) and d_u + G[u][v] < d[k][v]:\n d[k][v] = d_u + G[u][v]\n heappush(heap, (d[k][v], v))\nans = INF\nL = [i for i in range(R)]\nfor v in permutations(L, R):\n D = 0\n for i in range(R - 1):\n D += d[v[i]][town[v[i + 1]]]\n ans = min(ans, D)\nprint(ans)\n","code_v1_no_empty_lines":"# coding: utf-8\nfrom heapq import heappop, heappush\nfrom itertools import permutations\n\nN, M, R = list(map(int, input().split()))\nr_list = list(map(int, input().split()))\nINF = 10**11\nG = [[INF for j in range(N + 1)] for i in range(N + 1)]\nconection = [[] for i in range(N + 1)]\nRG = [[INF for j in range(N + 1)] for i in range(N + 1)]\nfor i in range(M):\n A, B, C = list(map(int, input().split()))\n G[A][B] = C\n G[B][A] = C\n conection[A].append(B)\n conection[B].append(A)\nfor k in range(R):\n start = r_list[k]\n d = [INF for i in range(N + 1)]\n d[start] = 0\n used = [False for i in range(N + 1)]\n heap = []\n heappush(heap, (d[start], start))\n while heap:\n d_u, u = heappop(heap)\n used[u] = True\n if d[u] < d_u:\n continue\n for v in conection[u]:\n if not (used[v]) and d_u + G[u][v] < d[v]:\n d[v] = d_u + G[u][v]\n heappush(heap, (d[v], v))\n for i in range(R):\n r = r_list[i]\n RG[start][r] = d[r]\n RG[r][start] = d[r]\nP = permutations(r_list, R)\nans = INF\nfor p in P:\n tmp = 0\n for j in range(R - 1):\n tmp += RG[p[j]][p[j + 1]]\n ans = min(ans, tmp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-town = list(map(int, input().split()))","-INF = 10**9","-G = [[INF for i in range(N + 1)] for j in range(N + 1)]","+r_list = list(map(int, input().split()))","+INF = 10**11","+G = [[INF for j in range(N + 1)] for i in range(N + 1)]","+conection = [[] for i in range(N + 1)]","+RG = [[INF for j in range(N + 1)] for i in range(N + 1)]","-d = [[INF * 10 for i in range(N + 1)] for j in range(R)]","+ conection[A].append(B)","+ conection[B].append(A)","- r = town[k]","- d[k][r] = 0","+ start = r_list[k]","+ d = [INF for i in range(N + 1)]","+ d[start] = 0","- heappush(heap, (d[k][r], r))","+ heappush(heap, (d[start], start))","- if d[k][u] < d_u:","+ if d[u] < d_u:","- for v in range(N + 1):","- if not (used[v]) and d_u + G[u][v] < d[k][v]:","- d[k][v] = d_u + G[u][v]","- heappush(heap, (d[k][v], v))","+ for v in conection[u]:","+ if not (used[v]) and d_u + G[u][v] < d[v]:","+ d[v] = d_u + G[u][v]","+ heappush(heap, (d[v], v))","+ for i in range(R):","+ r = r_list[i]","+ RG[start][r] = d[r]","+ RG[r][start] = d[r]","+P = permutations(r_list, R)","-L = [i for i in range(R)]","-for v in permutations(L, R):","- D = 0","- for i in range(R - 1):","- D += d[v[i]][town[v[i + 1]]]","- ans = min(ans, D)","+for p in P:","+ tmp = 0","+ for j in range(R - 1):","+ tmp += RG[p[j]][p[j + 1]]","+ ans = min(ans, tmp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0371026921,"measured_runtime_v1":0.043424974,"runtime_lift":0.8544090815,"key":["s058847362","s403793125"]} +{"user_id":"u576432509","problem_id":"p03503","language":"python","submission_id_v0":"s753136655","submission_id_v1":"s630484896","cpu_time_v0":320,"cpu_time_v1":262,"memory_v0":3192,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.12,"input":"icase=0\n\nif icase==0:\n\n n=int(eval(input()))\n\n\n\n f=[]\n\n for i in range(n):\n\n fi=list(map(int,input().split()))\n\n f.append(fi)\n\n p=[]\n\n for i in range(n):\n\n pi=list(map(int,input().split()))\n\n p.append(pi)\n\nelif icase==1: \n\n n=1\n\n f=[[1, 1, 0, 1, 0, 0, 0, 1, 0, 1]]\n\n p=[[3, 4, 5, 6, 7, 8, 9, -2, -3, 4, -2]]\n\nelif icase==2: \n\n n=2\n\n f=[[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],\n\n [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]]\n\n p=[[0, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1],\n\n [0, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1]]\n\nelif icase==3: \n\n n=3\n\n f=[[1, 1, 1, 1, 1, 1, 0, 0, 1, 1],\n\n [0, 1, 0, 1, 1, 1, 1, 0, 1, 0],\n\n [1, 0, 1, 1, 0, 1, 0, 1, 0, 1]]\n\n p=[[-8, 6, -2, -8, -8, 4, 8, 7, -6, 2, 2],\n\n [-9, 2, 0, 1, 7, -5, 0, -2, -6, 5, 5],\n\n [6, -6, 7, -9, 6, -5, 8, 0, -9, -7, -7]]\n\n \n\nimport itertools\n\nsumpmax=-10**11\n\nfor i in itertools.product([0,1], repeat=10):\n\n r=list(i)\n\n sump=0\n\n if sum(r)!=0:\n\n for jj in range(n):\n\n ci=0\n\n for j in range(10):\n\n ci=ci+r[j]*f[jj][j]\n\n sump=sump+p[jj][ci]\n\n# print(sump,r)\n\n sumpmax=max(sump,sumpmax)\n\nprint(sumpmax)","target":"import itertools\n\n\n\nn=int(eval(input()))\n\nf=[[]]*n\n\nfor i in range(n):\n\n fij=list(map(int,input().split()))\n\n# f[i].append(fij)\n\n f[i]=fij\n\np=[[]]*n\n\nfor i in range(n):\n\n pij=list(map(int,input().split()))\n\n p[i]=pij\n\n \n\npmax=-10**11\n\nfor a in itertools.product([0,1], repeat=10):\n\n if sum(a)==0:\n\n continue\n\n psum=0\n\n for ni in range(n):\n\n k=0\n\n for i in range(10):\n\n if f[ni][i]==1 and a[i]==1:\n\n k+=1\n\n psum=psum+p[ni][k] \n\n pmax=max(pmax,psum) \n\n\n\nprint(pmax)\n","code_v0_loc":45,"code_v1_loc":27,"code_v0_num_chars":1218,"code_v1_num_chars":544,"code_v0_no_empty_lines":"icase = 0\nif icase == 0:\n n = int(eval(input()))\n f = []\n for i in range(n):\n fi = list(map(int, input().split()))\n f.append(fi)\n p = []\n for i in range(n):\n pi = list(map(int, input().split()))\n p.append(pi)\nelif icase == 1:\n n = 1\n f = [[1, 1, 0, 1, 0, 0, 0, 1, 0, 1]]\n p = [[3, 4, 5, 6, 7, 8, 9, -2, -3, 4, -2]]\nelif icase == 2:\n n = 2\n f = [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]]\n p = [\n [0, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1],\n [0, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1],\n ]\nelif icase == 3:\n n = 3\n f = [\n [1, 1, 1, 1, 1, 1, 0, 0, 1, 1],\n [0, 1, 0, 1, 1, 1, 1, 0, 1, 0],\n [1, 0, 1, 1, 0, 1, 0, 1, 0, 1],\n ]\n p = [\n [-8, 6, -2, -8, -8, 4, 8, 7, -6, 2, 2],\n [-9, 2, 0, 1, 7, -5, 0, -2, -6, 5, 5],\n [6, -6, 7, -9, 6, -5, 8, 0, -9, -7, -7],\n ]\nimport itertools\n\nsumpmax = -(10**11)\nfor i in itertools.product([0, 1], repeat=10):\n r = list(i)\n sump = 0\n if sum(r) != 0:\n for jj in range(n):\n ci = 0\n for j in range(10):\n ci = ci + r[j] * f[jj][j]\n sump = sump + p[jj][ci]\n # print(sump,r)\n sumpmax = max(sump, sumpmax)\nprint(sumpmax)\n","code_v1_no_empty_lines":"import itertools\n\nn = int(eval(input()))\nf = [[]] * n\nfor i in range(n):\n fij = list(map(int, input().split()))\n # f[i].append(fij)\n f[i] = fij\np = [[]] * n\nfor i in range(n):\n pij = list(map(int, input().split()))\n p[i] = pij\npmax = -(10**11)\nfor a in itertools.product([0, 1], repeat=10):\n if sum(a) == 0:\n continue\n psum = 0\n for ni in range(n):\n k = 0\n for i in range(10):\n if f[ni][i] == 1 and a[i] == 1:\n k += 1\n psum = psum + p[ni][k]\n pmax = max(pmax, psum)\nprint(pmax)\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-icase = 0","-if icase == 0:","- n = int(eval(input()))","- f = []","- for i in range(n):","- fi = list(map(int, input().split()))","- f.append(fi)","- p = []","- for i in range(n):","- pi = list(map(int, input().split()))","- p.append(pi)","-elif icase == 1:","- n = 1","- f = [[1, 1, 0, 1, 0, 0, 0, 1, 0, 1]]","- p = [[3, 4, 5, 6, 7, 8, 9, -2, -3, 4, -2]]","-elif icase == 2:","- n = 2","- f = [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]]","- p = [","- [0, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1],","- [0, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1],","- ]","-elif icase == 3:","- n = 3","- f = [","- [1, 1, 1, 1, 1, 1, 0, 0, 1, 1],","- [0, 1, 0, 1, 1, 1, 1, 0, 1, 0],","- [1, 0, 1, 1, 0, 1, 0, 1, 0, 1],","- ]","- p = [","- [-8, 6, -2, -8, -8, 4, 8, 7, -6, 2, 2],","- [-9, 2, 0, 1, 7, -5, 0, -2, -6, 5, 5],","- [6, -6, 7, -9, 6, -5, 8, 0, -9, -7, -7],","- ]","-sumpmax = -(10**11)","-for i in itertools.product([0, 1], repeat=10):","- r = list(i)","- sump = 0","- if sum(r) != 0:","- for jj in range(n):","- ci = 0","- for j in range(10):","- ci = ci + r[j] * f[jj][j]","- sump = sump + p[jj][ci]","- # print(sump,r)","- sumpmax = max(sump, sumpmax)","-print(sumpmax)","+n = int(eval(input()))","+f = [[]] * n","+for i in range(n):","+ fij = list(map(int, input().split()))","+ # f[i].append(fij)","+ f[i] = fij","+p = [[]] * n","+for i in range(n):","+ pij = list(map(int, input().split()))","+ p[i] = pij","+pmax = -(10**11)","+for a in itertools.product([0, 1], repeat=10):","+ if sum(a) == 0:","+ continue","+ psum = 0","+ for ni in range(n):","+ k = 0","+ for i in range(10):","+ if f[ni][i] == 1 and a[i] == 1:","+ k += 1","+ psum = psum + p[ni][k]","+ pmax = max(pmax, psum)","+print(pmax)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0444106205,"measured_runtime_v1":0.0423027644,"runtime_lift":1.0498278553,"key":["s753136655","s630484896"]} +{"user_id":"u281610856","problem_id":"p03160","language":"python","submission_id_v0":"s726911404","submission_id_v1":"s646169294","cpu_time_v0":172,"cpu_time_v1":133,"memory_v0":13904,"memory_v1":13928,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.67,"input":"n = int(eval(input()))\n\nh = list(map(int, input().split()))\n\nINF = float('inf')\n\ndp = [INF] * (1 + 10 ** 5)\n\ndp[0] = 0\n\nfor i in range(n):\n\n dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))\n\n if i < 2:\n\n continue\n\n dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))\n\nprint((dp[n-1]))","target":"N = int(eval(input()))\n\nh = list(map(int, input().split()))\n\nINF = float('inf')\n\ndp = [INF] * N\n\ndp[0] = 0\n\nfor i in range(1, N):\n\n if i == 1:\n\n dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i-1]))\n\n else:\n\n dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))\n\n# print(dp)\n\nprint((dp[N - 1]))","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":297,"code_v1_num_chars":330,"code_v0_no_empty_lines":"n = int(eval(input()))\nh = list(map(int, input().split()))\nINF = float(\"inf\")\ndp = [INF] * (1 + 10**5)\ndp[0] = 0\nfor i in range(n):\n dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))\n if i < 2:\n continue\n dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))\nprint((dp[n - 1]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nh = list(map(int, input().split()))\nINF = float(\"inf\")\ndp = [INF] * N\ndp[0] = 0\nfor i in range(1, N):\n if i == 1:\n dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))\n else:\n dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))\n# print(dp)\nprint((dp[N - 1]))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-n = int(eval(input()))","+N = int(eval(input()))","-dp = [INF] * (1 + 10**5)","+dp = [INF] * N","-for i in range(n):","- dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))","- if i < 2:","- continue","- dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))","-print((dp[n - 1]))","+for i in range(1, N):","+ if i == 1:","+ dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))","+ else:","+ dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))","+# print(dp)","+print((dp[N - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0727255051,"measured_runtime_v1":0.0373448234,"runtime_lift":1.9474052506,"key":["s726911404","s646169294"]} +{"user_id":"u734548018","problem_id":"p02982","language":"python","submission_id_v0":"s724170847","submission_id_v1":"s217381665","cpu_time_v0":184,"cpu_time_v1":165,"memory_v0":38384,"memory_v1":38384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.33,"input":"#!\/usr\/bin\/python3\n\n# -*- coding: utf-8 -*-\n\n\n\n\n\n\n\ndef main():\n\n N,D = list(map(int, input().split()))\n\n Xn = []\n\n for _ in range(N):\n\n Xn.append(list(map(int, input().split())))\n\n\n\n ans = 0\n\n ansset = [i**2 for i in range(1001)]\n\n for i in range(N):\n\n for j in range(i+1,N):\n\n sm = 0\n\n for k in range(D):\n\n sm += (Xn[i][k]-Xn[j][k])**2\n\n if sm in ansset:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"#!\/usr\/bin\/python3\n\n# -*- coding: utf-8 -*-\n\n\n\n\n\n\n\ndef main():\n\n N,D = list(map(int, input().split()))\n\n Xn = [list(map(int, input().split())) for _ in range(N)]\n\n\n\n sqrtset = [i**2 for i in range(1000)]\n\n\n\n ans = 0\n\n for i in range(N):\n\n for j in range(i+1,N):\n\n sm = 0\n\n for d in range(D):\n\n sm += (Xn[i][d]-Xn[j][d])**2\n\n if sm in sqrtset:\n\n ans += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":25,"code_v1_loc":25,"code_v0_num_chars":457,"code_v1_num_chars":442,"code_v0_no_empty_lines":"#!\/usr\/bin\/python3\n# -*- coding: utf-8 -*-\ndef main():\n N, D = list(map(int, input().split()))\n Xn = []\n for _ in range(N):\n Xn.append(list(map(int, input().split())))\n ans = 0\n ansset = [i**2 for i in range(1001)]\n for i in range(N):\n for j in range(i + 1, N):\n sm = 0\n for k in range(D):\n sm += (Xn[i][k] - Xn[j][k]) ** 2\n if sm in ansset:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/python3\n# -*- coding: utf-8 -*-\ndef main():\n N, D = list(map(int, input().split()))\n Xn = [list(map(int, input().split())) for _ in range(N)]\n sqrtset = [i**2 for i in range(1000)]\n ans = 0\n for i in range(N):\n for j in range(i + 1, N):\n sm = 0\n for d in range(D):\n sm += (Xn[i][d] - Xn[j][d]) ** 2\n if sm in sqrtset:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- Xn = []","- for _ in range(N):","- Xn.append(list(map(int, input().split())))","+ Xn = [list(map(int, input().split())) for _ in range(N)]","+ sqrtset = [i**2 for i in range(1000)]","- ansset = [i**2 for i in range(1001)]","- for k in range(D):","- sm += (Xn[i][k] - Xn[j][k]) ** 2","- if sm in ansset:","+ for d in range(D):","+ sm += (Xn[i][d] - Xn[j][d]) ** 2","+ if sm in sqrtset:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370158138,"measured_runtime_v1":0.0371847849,"runtime_lift":0.9954559083,"key":["s724170847","s217381665"]} +{"user_id":"u702517202","problem_id":"p02772","language":"python","submission_id_v0":"s921839873","submission_id_v1":"s414566514","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"n = int(eval(input()))\n\nlist_num = list(map(int, input().split()))\n\nflg = False\n\nfor i in range(n):\n\n if list_num[i] % 2 == 1 or (list_num[i] % 2 == 0 and (list_num[i] % 3 == 0 or list_num[i] % 5 == 0)):\n\n flg = True\n\n else:\n\n flg = False\n\n break\n\n\n\nif flg:\n\n print(\"APPROVED\")\n\nelse:\n\n print(\"DENIED\")","target":"n = int(eval(input()))\n\nnumbers = list(map(int, input().split()))\n\nflg = True\n\nfor number in numbers:\n\n if number % 2 == 0 and number % 3 != 0 and number % 5 != 0:\n\n flg = False\n\n break\n\n\n\nif flg:\n\n print(\"APPROVED\")\n\nelse:\n\n print(\"DENIED\")","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":309,"code_v1_num_chars":258,"code_v0_no_empty_lines":"n = int(eval(input()))\nlist_num = list(map(int, input().split()))\nflg = False\nfor i in range(n):\n if list_num[i] % 2 == 1 or (\n list_num[i] % 2 == 0 and (list_num[i] % 3 == 0 or list_num[i] % 5 == 0)\n ):\n flg = True\n else:\n flg = False\n break\nif flg:\n print(\"APPROVED\")\nelse:\n print(\"DENIED\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\nnumbers = list(map(int, input().split()))\nflg = True\nfor number in numbers:\n if number % 2 == 0 and number % 3 != 0 and number % 5 != 0:\n flg = False\n break\nif flg:\n print(\"APPROVED\")\nelse:\n print(\"DENIED\")\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-list_num = list(map(int, input().split()))","-flg = False","-for i in range(n):","- if list_num[i] % 2 == 1 or (","- list_num[i] % 2 == 0 and (list_num[i] % 3 == 0 or list_num[i] % 5 == 0)","- ):","- flg = True","- else:","+numbers = list(map(int, input().split()))","+flg = True","+for number in numbers:","+ if number % 2 == 0 and number % 3 != 0 and number % 5 != 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0472431578,"measured_runtime_v1":0.0685968782,"runtime_lift":0.6887071104,"key":["s921839873","s414566514"]} +{"user_id":"u933096856","problem_id":"p02420","language":"python","submission_id_v0":"s971189445","submission_id_v1":"s369774361","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":7684,"memory_v1":6440,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"while True:\n\n a=eval(input())\n\n if a=='-':\n\n break\n\n else:\n\n n=int(eval(input()))\n\n for i in range(n):\n\n h=int(eval(input()))\n\n a=a[h:]+a[:h]\n\n print(a)","target":"while True:\n\n a=input()\n\n if a=='-':\n\n break\n\n else:\n\n n=int(input())\n\n for i in range(n):\n\n h=int(input())\n\n a=a[h:]+a[:h]\n\n print(a)","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":191,"code_v1_num_chars":202,"code_v0_no_empty_lines":"while True:\n a = eval(input())\n if a == \"-\":\n break\n else:\n n = int(eval(input()))\n for i in range(n):\n h = int(eval(input()))\n a = a[h:] + a[:h]\n print(a)\n","code_v1_no_empty_lines":"while True:\n a = input()\n if a == \"-\":\n break\n else:\n n = int(input())\n for i in range(n):\n h = int(input())\n a = a[h:] + a[:h]\n print(a)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- a = eval(input())","+ a = input()","- n = int(eval(input()))","+ n = int(input())","- h = int(eval(input()))","+ h = int(input())"],"diff_only_import_comment":false,"measured_runtime_v0":0.0432588449,"measured_runtime_v1":0.0431054447,"runtime_lift":1.0035587192,"key":["s971189445","s369774361"]} +{"user_id":"u836939578","problem_id":"p02660","language":"python","submission_id_v0":"s080355533","submission_id_v1":"s953720089","cpu_time_v0":78,"cpu_time_v1":71,"memory_v0":66244,"memory_v1":63288,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.97,"input":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\nfrom collections import defaultdict\n\n\n\nN = int(eval(input()))\n\n\n\ndef prime_factorize(n):\n\n ret = []\n\n for i in range(2, int(n ** (1 \/ 2)) + 1):\n\n if i > n:break\n\n while n % i == 0:\n\n n \/\/= i\n\n ret.append(i)\n\n if n != 1:\n\n ret.append(n)\n\n return ret\n\n\n\ndic = defaultdict(int)\n\nlis = prime_factorize(N)\n\nfor num in lis:\n\n dic[num] += 1\n\n\n\nans = 0\n\n\n\nfor v in list(dic.values()):\n\n i = 1\n\n while v >= i:\n\n v -= i\n\n i += 1 \n\n ans += i - 1\n\nprint(ans)","target":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\n\nN = int(eval(input()))\n\n\n\ndef prime_factorize(n):\n\n ret = []\n\n for i in range(2, int(n ** (1 \/ 2)) + 1):\n\n if i > n:break\n\n cnt = 0\n\n while n % i == 0:\n\n n \/\/= i\n\n cnt += 1\n\n if cnt > 0: \n\n ret.append((i, cnt))\n\n if n != 1:\n\n ret.append((n, 1))\n\n return ret\n\n\n\nlis = prime_factorize(N)\n\n\n\nans = 0\n\n\n\nfor v, cnt in lis:\n\n i = 1\n\n while cnt >= i:\n\n cnt -= i\n\n i += 1 \n\n ans += i - 1\n\nprint(ans) ","code_v0_loc":31,"code_v1_loc":30,"code_v0_num_chars":544,"code_v1_num_chars":508,"code_v0_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\nfrom collections import defaultdict\n\nN = int(eval(input()))\n\n\ndef prime_factorize(n):\n ret = []\n for i in range(2, int(n ** (1 \/ 2)) + 1):\n if i > n:\n break\n while n % i == 0:\n n \/\/= i\n ret.append(i)\n if n != 1:\n ret.append(n)\n return ret\n\n\ndic = defaultdict(int)\nlis = prime_factorize(N)\nfor num in lis:\n dic[num] += 1\nans = 0\nfor v in list(dic.values()):\n i = 1\n while v >= i:\n v -= i\n i += 1\n ans += i - 1\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\nN = int(eval(input()))\n\n\ndef prime_factorize(n):\n ret = []\n for i in range(2, int(n ** (1 \/ 2)) + 1):\n if i > n:\n break\n cnt = 0\n while n % i == 0:\n n \/\/= i\n cnt += 1\n if cnt > 0:\n ret.append((i, cnt))\n if n != 1:\n ret.append((n, 1))\n return ret\n\n\nlis = prime_factorize(N)\nans = 0\nfor v, cnt in lis:\n i = 1\n while cnt >= i:\n cnt -= i\n i += 1\n ans += i - 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["-from collections import defaultdict","-","+ cnt = 0","- ret.append(i)","+ cnt += 1","+ if cnt > 0:","+ ret.append((i, cnt))","- ret.append(n)","+ ret.append((n, 1))","-dic = defaultdict(int)","-for num in lis:","- dic[num] += 1","-for v in list(dic.values()):","+for v, cnt in lis:","- while v >= i:","- v -= i","+ while cnt >= i:","+ cnt -= i"],"diff_only_import_comment":false,"measured_runtime_v0":0.1073845471,"measured_runtime_v1":0.0942640994,"runtime_lift":1.1391881723,"key":["s080355533","s953720089"]} +{"user_id":"u560867850","problem_id":"p03503","language":"python","submission_id_v0":"s675921448","submission_id_v1":"s481092296","cpu_time_v0":122,"cpu_time_v1":95,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.13,"input":"import sys\n\ninput = sys.stdin.readline\n\nfrom itertools import combinations\n\n\n\ndef readlines(n):\n\n for _ in range(n):\n\n yield list(map(int,input().split()))\n\n\n\ndef bene(me, f, p):\n\n a = sum(1 if f[m] == 1 else 0 for m in me)\n\n return p[a]\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n F = list(readlines(n))\n\n P = list(readlines(n))\n\n\n\n for i in range(1, 11):\n\n for comb in combinations(list(range(10)), i):\n\n yield sum(bene(comb, f, p) for f, p in zip(F,P))\n\n\n\n \n\nprint((max(main())))","target":"import sys\n\ninput = sys.stdin.readline\n\nfrom itertools import combinations\n\n\n\ndef readlines(n):\n\n for _ in range(n):\n\n yield list(map(int,input().split()))\n\n\n\ndef bene(me, f, p):\n\n a = len([0 for m in me if f[m] == 1])\n\n return p[a]\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n F = list(readlines(n))\n\n P = list(readlines(n))\n\n\n\n for i in range(1, 11):\n\n for comb in combinations(list(range(10)), i):\n\n yield sum(bene(comb, f, p) for f, p in zip(F,P))\n\n\n\n \n\nprint((max(main())))","code_v0_loc":23,"code_v1_loc":23,"code_v0_num_chars":515,"code_v1_num_chars":510,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom itertools import combinations\n\n\ndef readlines(n):\n for _ in range(n):\n yield list(map(int, input().split()))\n\n\ndef bene(me, f, p):\n a = sum(1 if f[m] == 1 else 0 for m in me)\n return p[a]\n\n\ndef main():\n n = int(eval(input()))\n F = list(readlines(n))\n P = list(readlines(n))\n for i in range(1, 11):\n for comb in combinations(list(range(10)), i):\n yield sum(bene(comb, f, p) for f, p in zip(F, P))\n\n\nprint((max(main())))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom itertools import combinations\n\n\ndef readlines(n):\n for _ in range(n):\n yield list(map(int, input().split()))\n\n\ndef bene(me, f, p):\n a = len([0 for m in me if f[m] == 1])\n return p[a]\n\n\ndef main():\n n = int(eval(input()))\n F = list(readlines(n))\n P = list(readlines(n))\n for i in range(1, 11):\n for comb in combinations(list(range(10)), i):\n yield sum(bene(comb, f, p) for f, p in zip(F, P))\n\n\nprint((max(main())))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- a = sum(1 if f[m] == 1 else 0 for m in me)","+ a = len([0 for m in me if f[m] == 1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0442870667,"measured_runtime_v1":0.0427375228,"runtime_lift":1.0362572219,"key":["s675921448","s481092296"]} +{"user_id":"u186838327","problem_id":"p02911","language":"python","submission_id_v0":"s857714391","submission_id_v1":"s609587948","cpu_time_v0":611,"cpu_time_v1":248,"memory_v0":51800,"memory_v1":10472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.41,"input":"n, k, q = list(map(int, input().split()))\n\nx = [0]*n\n\nfor i in range(q):\n\n a = int(eval(input()))\n\n a -= 1\n\n x[a] += 1\n\n\n\ny = [k]*n\n\nfor i in range(n):\n\n y[i] -= (q-x[i])\n\n if y[i] <= 0:\n\n print('No')\n\n else:\n\n print('Yes')\n\n ","target":"n, k, q = list(map(int, input().split()))\n\nA = [int(eval(input())) for _ in range(q)]\n\n\n\nB = [k-q]*n\n\nfor i in range(q):\n\n B[A[i]-1] += 1\n\n\n\nfor i in range(n):\n\n if B[i] <= 0:\n\n print('No')\n\n else:\n\n print('Yes')\n","code_v0_loc":15,"code_v1_loc":12,"code_v0_num_chars":227,"code_v1_num_chars":224,"code_v0_no_empty_lines":"n, k, q = list(map(int, input().split()))\nx = [0] * n\nfor i in range(q):\n a = int(eval(input()))\n a -= 1\n x[a] += 1\ny = [k] * n\nfor i in range(n):\n y[i] -= q - x[i]\n if y[i] <= 0:\n print(\"No\")\n else:\n print(\"Yes\")\n","code_v1_no_empty_lines":"n, k, q = list(map(int, input().split()))\nA = [int(eval(input())) for _ in range(q)]\nB = [k - q] * n\nfor i in range(q):\n B[A[i] - 1] += 1\nfor i in range(n):\n if B[i] <= 0:\n print(\"No\")\n else:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-x = [0] * n","+A = [int(eval(input())) for _ in range(q)]","+B = [k - q] * n","- a = int(eval(input()))","- a -= 1","- x[a] += 1","-y = [k] * n","+ B[A[i] - 1] += 1","- y[i] -= q - x[i]","- if y[i] <= 0:","+ if B[i] <= 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1525272779,"measured_runtime_v1":0.035796443,"runtime_lift":4.2609618494,"key":["s857714391","s609587948"]} +{"user_id":"u068844030","problem_id":"p03436","language":"python","submission_id_v0":"s350422567","submission_id_v1":"s795961431","cpu_time_v0":38,"cpu_time_v1":33,"memory_v0":9516,"memory_v1":9420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.16,"input":"from collections import deque\n\nh, w = list(map(int, input().split()))\n\nmaze = [list(eval(input())) for i in range(h)]\n\ndx = [1, 0, -1, 0]\n\ndy = [0, 1, 0, -1]\n\n\n\nsx, sy, gx, gy = 0, 0, h - 1, w - 1\n\nd = [[float(\"inf\")] * w for _ in range(h)]\n\n\n\nque = deque([])\n\nque.append((sx, sy))\n\nd[sx][sy] = 0\n\n\n\n\n\ndef bfs():\n\n while que:\n\n p = que.popleft()\n\n if p[0] == gx and p[1] == gy:\n\n break\n\n for i in range(4):\n\n nx = p[0] + dx[i]\n\n ny = p[1] + dy[i]\n\n if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != \"#\" and d[nx][ny] == float(\"inf\"):\n\n que.append((nx, ny))\n\n d[nx][ny] = d[p[0]][p[1]] + 1\n\n return d[gx][gy]\n\n\n\n##\u6700\u77ed\u8ddd\u96e2\u3092\u683c\u7d0d\n\nbfs = bfs()\n\ncnt = 0\n\nfor i in range(h):\n\n for j in range(w):\n\n if maze[i][j] == \".\":\n\n cnt += 1\n\nif bfs == float(\"inf\"):\n\n print((-1))\n\nelse:\n\n print((cnt - (bfs + 1)))\n","target":"from collections import deque\n\nh, w = list(map(int, input().split()))\n\nmaze = [list(eval(input())) for i in range(h)]\n\ndh = [1, 0, -1, 0]\n\ndw = [0, 1, 0, -1]\n\n\n\nsh, sw, gh, gw = 0, 0, h - 1, w - 1\n\nd = [[float(\"inf\")] * w for _ in range(h)]\n\n\n\nque = deque([])\n\nque.append((sh, sw))\n\nd[sh][sw] = 0\n\n\n\n\n\ndef bfs():\n\n while que:\n\n p = que.popleft()\n\n if p[0] == gh and p[1] == gw:\n\n break\n\n for i in range(4):\n\n nh = p[0] + dh[i]\n\n nw = p[1] + dw[i]\n\n if 0 <= nh < h and 0 <= nw < w and maze[nh][nw] != \"#\" and d[nh][nw] == float(\"inf\"):\n\n que.append((nh, nw))\n\n d[nh][nw] = d[p[0]][p[1]] + 1\n\n return d[gh][gw]\n\n\n\n##\u6700\u77ed\u8ddd\u96e2\u3092\u683c\u7d0d\n\nbfs = bfs()\n\ncnt = 0\n\nfor i in range(h):\n\n for j in range(w):\n\n if maze[i][j] == \".\":\n\n cnt += 1\n\nif bfs == float(\"inf\"):\n\n print((-1))\n\nelse:\n\n print((cnt - (bfs + 1)))\n","code_v0_loc":38,"code_v1_loc":38,"code_v0_num_chars":905,"code_v1_num_chars":905,"code_v0_no_empty_lines":"from collections import deque\n\nh, w = list(map(int, input().split()))\nmaze = [list(eval(input())) for i in range(h)]\ndx = [1, 0, -1, 0]\ndy = [0, 1, 0, -1]\nsx, sy, gx, gy = 0, 0, h - 1, w - 1\nd = [[float(\"inf\")] * w for _ in range(h)]\nque = deque([])\nque.append((sx, sy))\nd[sx][sy] = 0\n\n\ndef bfs():\n while que:\n p = que.popleft()\n if p[0] == gx and p[1] == gy:\n break\n for i in range(4):\n nx = p[0] + dx[i]\n ny = p[1] + dy[i]\n if (\n 0 <= nx < h\n and 0 <= ny < w\n and maze[nx][ny] != \"#\"\n and d[nx][ny] == float(\"inf\")\n ):\n que.append((nx, ny))\n d[nx][ny] = d[p[0]][p[1]] + 1\n return d[gx][gy]\n\n\n##\u6700\u77ed\u8ddd\u96e2\u3092\u683c\u7d0d\nbfs = bfs()\ncnt = 0\nfor i in range(h):\n for j in range(w):\n if maze[i][j] == \".\":\n cnt += 1\nif bfs == float(\"inf\"):\n print((-1))\nelse:\n print((cnt - (bfs + 1)))\n","code_v1_no_empty_lines":"from collections import deque\n\nh, w = list(map(int, input().split()))\nmaze = [list(eval(input())) for i in range(h)]\ndh = [1, 0, -1, 0]\ndw = [0, 1, 0, -1]\nsh, sw, gh, gw = 0, 0, h - 1, w - 1\nd = [[float(\"inf\")] * w for _ in range(h)]\nque = deque([])\nque.append((sh, sw))\nd[sh][sw] = 0\n\n\ndef bfs():\n while que:\n p = que.popleft()\n if p[0] == gh and p[1] == gw:\n break\n for i in range(4):\n nh = p[0] + dh[i]\n nw = p[1] + dw[i]\n if (\n 0 <= nh < h\n and 0 <= nw < w\n and maze[nh][nw] != \"#\"\n and d[nh][nw] == float(\"inf\")\n ):\n que.append((nh, nw))\n d[nh][nw] = d[p[0]][p[1]] + 1\n return d[gh][gw]\n\n\n##\u6700\u77ed\u8ddd\u96e2\u3092\u683c\u7d0d\nbfs = bfs()\ncnt = 0\nfor i in range(h):\n for j in range(w):\n if maze[i][j] == \".\":\n cnt += 1\nif bfs == float(\"inf\"):\n print((-1))\nelse:\n print((cnt - (bfs + 1)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-dx = [1, 0, -1, 0]","-dy = [0, 1, 0, -1]","-sx, sy, gx, gy = 0, 0, h - 1, w - 1","+dh = [1, 0, -1, 0]","+dw = [0, 1, 0, -1]","+sh, sw, gh, gw = 0, 0, h - 1, w - 1","-que.append((sx, sy))","-d[sx][sy] = 0","+que.append((sh, sw))","+d[sh][sw] = 0","- if p[0] == gx and p[1] == gy:","+ if p[0] == gh and p[1] == gw:","- nx = p[0] + dx[i]","- ny = p[1] + dy[i]","+ nh = p[0] + dh[i]","+ nw = p[1] + dw[i]","- 0 <= nx < h","- and 0 <= ny < w","- and maze[nx][ny] != \"#\"","- and d[nx][ny] == float(\"inf\")","+ 0 <= nh < h","+ and 0 <= nw < w","+ and maze[nh][nw] != \"#\"","+ and d[nh][nw] == float(\"inf\")","- que.append((nx, ny))","- d[nx][ny] = d[p[0]][p[1]] + 1","- return d[gx][gy]","+ que.append((nh, nw))","+ d[nh][nw] = d[p[0]][p[1]] + 1","+ return d[gh][gw]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363285327,"measured_runtime_v1":0.0371930635,"runtime_lift":0.9767555901,"key":["s350422567","s795961431"]} +{"user_id":"u179169725","problem_id":"p03177","language":"python","submission_id_v0":"s379508606","submission_id_v1":"s787354194","cpu_time_v0":1538,"cpu_time_v1":328,"memory_v0":27364,"memory_v1":27464,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.67,"input":"import sys\n\nsys.setrecursionlimit(1 << 25)\n\nreadline = sys.stdin.buffer.readline\n\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\n\n\n\nimport numpy as np\n\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\n\nzeros = partial(np.zeros, dtype=np.int64)\n\nfull = partial(np.full, dtype=np.int64)\n\n\n\n\n\ndef ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)\n\n\n\n\n\ndef read_matrix(H, W)->np.ndarray:\n\n '''return np.ndarray shape=(H,W) matrix'''\n\n lines = []\n\n for _ in range(H):\n\n lines.append(read())\n\n lines = ' '.join(lines) # byte\u540c\u58eb\u306e\u7d50\u5408\u304c\u3067\u304d\u306a\u3044\u306e\u3067readline\u3067\u306a\u304fread\u3067\n\n return np.fromstring(lines, sep=' ', dtype=np.int64).reshape(H, W)\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\n\n\nN, K = ints()\n\nA = read_matrix(N, N)\n\n\n\n\n\n# from numba import njit\n\n\n\n\n\n# @njit('i8[:,:](i8[:,:],i8[:,:])', cache=True)\n\ndef matmul_mod(X: np.ndarray, Y: np.ndarray)->np.ndarray:\n\n MOD = 10**9 + 7\n\n # return X @ Y\n\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n\n for i in range(X.shape[0]): # X\u306e\u884c\n\n for j in range(Y.shape[1]): # Y\u306e\u5217\n\n tmp = (X[i, :] * Y[:, j]) % MOD\n\n ret[i, j] = tmp.sum() % MOD\n\n return ret\n\n\n\n\n\nA_double = np.asanyarray(A, dtype=np.int64)\n\nans = np.eye(N, dtype=np.int64)\n\nfor j in range(int(K).bit_length()):\n\n if (K >> j) & 1:\n\n ans = matmul_mod(ans, A_double)\n\n A_double = matmul_mod(A_double, A_double)\n\n\n\nprint((ans.sum() % MOD))\n\n\n\n\n","target":"import sys\n\nsys.setrecursionlimit(1 << 25)\n\nreadline = sys.stdin.buffer.readline\n\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\n\n\n\nimport numpy as np\n\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\n\nzeros = partial(np.zeros, dtype=np.int64)\n\nfull = partial(np.full, dtype=np.int64)\n\n\n\n\n\ndef ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)\n\n\n\n\n\ndef read_matrix(H, W)->np.ndarray:\n\n '''return np.ndarray shape=(H,W) matrix'''\n\n lines = []\n\n for _ in range(H):\n\n lines.append(read())\n\n lines = ' '.join(lines) # byte\u540c\u58eb\u306e\u7d50\u5408\u304c\u3067\u304d\u306a\u3044\u306e\u3067readline\u3067\u306a\u304fread\u3067\n\n return np.fromstring(lines, sep=' ', dtype=np.int64).reshape(H, W)\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\n\n\nN, K = ints()\n\nA = read_matrix(N, N)\n\n\n\n\n\n# from numba import njit\n\n\n\n\n\n# @njit('i8[:,:](i8[:,:],i8[:,:])', cache=True)\n\ndef matmul_mod(X: np.ndarray, Y: np.ndarray)->np.ndarray:\n\n MOD = 10**9 + 7\n\n # return X @ Y\n\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n\n for i in range(X.shape[0]): # X\u306e\u884c\n\n for j in range(Y.shape[1]): # Y\u306e\u5217\n\n tmp = (X[i, :] * Y[:, j]) % MOD\n\n ret[i, j] = tmp.sum() % MOD\n\n return ret\n\n\n\n\n\ndef matmul_mod_try(X: np.ndarray, Y: np.ndarray)->np.ndarray:\n\n MOD = 10**9 + 7\n\n # return X @ Y\n\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n\n YT = Y.T\n\n for i in range(X.shape[0]): # X\u306e\u884c\n\n Xi = X[i, :]\n\n tmp = (YT * Xi) % MOD\n\n ret[i, :] = tmp.sum(1) % MOD\n\n return ret\n\n\n\n\n\nA_double = np.asanyarray(A, dtype=np.int64)\n\nans = np.eye(N, dtype=np.int64)\n\nfor j in range(int(K).bit_length()):\n\n if (K >> j) & 1:\n\n # t1, t2 = matmul_mod(ans, A_double), matmul_mod_try(ans, A_double)\n\n # assert np.array_equal(t1, t2), (t1, t2)\n\n ans = matmul_mod_try(ans, A_double)\n\n A_double = matmul_mod_try(A_double, A_double)\n\n\n\nprint((ans.sum() % MOD))\n","code_v0_loc":57,"code_v1_loc":69,"code_v0_num_chars":1479,"code_v1_num_chars":1942,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1 << 25)\nreadline = sys.stdin.buffer.readline\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\nimport numpy as np\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\nzeros = partial(np.zeros, dtype=np.int64)\nfull = partial(np.full, dtype=np.int64)\n\n\ndef ints():\n return np.fromstring(readline(), sep=\" \", dtype=np.int64)\n\n\ndef read_matrix(H, W) -> np.ndarray:\n \"\"\"return np.ndarray shape=(H,W) matrix\"\"\"\n lines = []\n for _ in range(H):\n lines.append(read())\n lines = \" \".join(lines) # byte\u540c\u58eb\u306e\u7d50\u5408\u304c\u3067\u304d\u306a\u3044\u306e\u3067readline\u3067\u306a\u304fread\u3067\n return np.fromstring(lines, sep=\" \", dtype=np.int64).reshape(H, W)\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nN, K = ints()\nA = read_matrix(N, N)\n# from numba import njit\n# @njit('i8[:,:](i8[:,:],i8[:,:])', cache=True)\ndef matmul_mod(X: np.ndarray, Y: np.ndarray) -> np.ndarray:\n MOD = 10**9 + 7\n # return X @ Y\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n for i in range(X.shape[0]): # X\u306e\u884c\n for j in range(Y.shape[1]): # Y\u306e\u5217\n tmp = (X[i, :] * Y[:, j]) % MOD\n ret[i, j] = tmp.sum() % MOD\n return ret\n\n\nA_double = np.asanyarray(A, dtype=np.int64)\nans = np.eye(N, dtype=np.int64)\nfor j in range(int(K).bit_length()):\n if (K >> j) & 1:\n ans = matmul_mod(ans, A_double)\n A_double = matmul_mod(A_double, A_double)\nprint((ans.sum() % MOD))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1 << 25)\nreadline = sys.stdin.buffer.readline\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\nimport numpy as np\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\nzeros = partial(np.zeros, dtype=np.int64)\nfull = partial(np.full, dtype=np.int64)\n\n\ndef ints():\n return np.fromstring(readline(), sep=\" \", dtype=np.int64)\n\n\ndef read_matrix(H, W) -> np.ndarray:\n \"\"\"return np.ndarray shape=(H,W) matrix\"\"\"\n lines = []\n for _ in range(H):\n lines.append(read())\n lines = \" \".join(lines) # byte\u540c\u58eb\u306e\u7d50\u5408\u304c\u3067\u304d\u306a\u3044\u306e\u3067readline\u3067\u306a\u304fread\u3067\n return np.fromstring(lines, sep=\" \", dtype=np.int64).reshape(H, W)\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nN, K = ints()\nA = read_matrix(N, N)\n# from numba import njit\n# @njit('i8[:,:](i8[:,:],i8[:,:])', cache=True)\ndef matmul_mod(X: np.ndarray, Y: np.ndarray) -> np.ndarray:\n MOD = 10**9 + 7\n # return X @ Y\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n for i in range(X.shape[0]): # X\u306e\u884c\n for j in range(Y.shape[1]): # Y\u306e\u5217\n tmp = (X[i, :] * Y[:, j]) % MOD\n ret[i, j] = tmp.sum() % MOD\n return ret\n\n\ndef matmul_mod_try(X: np.ndarray, Y: np.ndarray) -> np.ndarray:\n MOD = 10**9 + 7\n # return X @ Y\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n YT = Y.T\n for i in range(X.shape[0]): # X\u306e\u884c\n Xi = X[i, :]\n tmp = (YT * Xi) % MOD\n ret[i, :] = tmp.sum(1) % MOD\n return ret\n\n\nA_double = np.asanyarray(A, dtype=np.int64)\nans = np.eye(N, dtype=np.int64)\nfor j in range(int(K).bit_length()):\n if (K >> j) & 1:\n # t1, t2 = matmul_mod(ans, A_double), matmul_mod_try(ans, A_double)\n # assert np.array_equal(t1, t2), (t1, t2)\n ans = matmul_mod_try(ans, A_double)\n A_double = matmul_mod_try(A_double, A_double)\nprint((ans.sum() % MOD))\n","code_same":false,"relative_loc_diff_percent":17.3913043478,"diff":["+def matmul_mod_try(X: np.ndarray, Y: np.ndarray) -> np.ndarray:","+ MOD = 10**9 + 7","+ # return X @ Y","+ ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)","+ YT = Y.T","+ for i in range(X.shape[0]): # X\u306e\u884c","+ Xi = X[i, :]","+ tmp = (YT * Xi) % MOD","+ ret[i, :] = tmp.sum(1) % MOD","+ return ret","+","+","- ans = matmul_mod(ans, A_double)","- A_double = matmul_mod(A_double, A_double)","+ # t1, t2 = matmul_mod(ans, A_double), matmul_mod_try(ans, A_double)","+ # assert np.array_equal(t1, t2), (t1, t2)","+ ans = matmul_mod_try(ans, A_double)","+ A_double = matmul_mod_try(A_double, A_double)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2426760131,"measured_runtime_v1":0.3362972616,"runtime_lift":0.721611624,"key":["s379508606","s787354194"]} +{"user_id":"u179169725","problem_id":"p03283","language":"python","submission_id_v0":"s999863301","submission_id_v1":"s241227529","cpu_time_v0":1104,"cpu_time_v1":886,"memory_v0":53300,"memory_v1":55160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.75,"input":"# https:\/\/atcoder.jp\/contests\/abc106\/tasks\/abc106_d\n\n# \u3069\u3046\u3084\u3063\u305f\u3089\u9ad8\u901f\u306b\u533a\u9593[p,q]\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u533a\u9593\u306e\u6570\u3092\u53d6\u5f97\u3067\u304d\u308b\u304b\uff1f\n\n# p,q\u3092\u4e8c\u6b21\u5143\u5ea7\u6a19\u3068\u3057\u3066\u6349\u3048\u308b\u3068\u96fb\u8eca1\u672c\u306e\u7dda\u306f\u4e8c\u6b21\u5143\u5e73\u9762\u4e0a\u306e1\u70b9\u3068\u3057\u3066\u8868\u305b\u308b\n\n# \u3053\u306e\u3068\u304dp,q\u306e\u533a\u9593\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u96fb\u8eca\u306e\u672c\u6570\u3068\u3044\u3046\u306e\u306f\u3001x\u8ef8\u3001y\u8ef8\u306e\u4e21\u65b9\u306b\u304a\u3044\u3066[p,q]\u3068\u306a\u308b\u56db\u89d2\u5f62\u5185\u306b\u3042\u308b\u96fb\u8eca\u306e\u672c\u6570\n\n# query\u306b\u9ad8\u901f\u306b\u7b54\u3048\u308b\u305f\u3081\u306b\u4e8c\u6b21\u5143\u7d2f\u7a4d\u548c\u3092\u69cb\u7bc9\u3059\u308b\n\nimport sys\n\nread = sys.stdin.readline\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\ndef read_tuple(H):\n\n '''\n\n H is number of rows\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(tuple(map(int, read().split())))\n\n return ret\n\n\n\n\n\nimport numpy as np\n\n\n\nN, M, Q = read_ints()\n\nLR = read_tuple(M)\n\npq = read_tuple(Q)\n\n\n\n# numpy\u4f7f\u308f\u305a\u306b\u518d\u5b9f\u88c5 #\u5165\u308c\u308b\u3068\u304d\u306fpython\u306e\u307b\u3046\u304c\u901f\u3044\u306e\u3067\n\nLR2d = [[0] * (N + 1) for _ in range(N + 1)]\n\nfor L, R in LR:\n\n LR2d[L][R] += 1\n\nLR2d = np.array(LR2d, np.int64)\n\n\n\nLR2d_accum = np.zeros((N + 2, N + 2), np.int64)\n\nLR2d_accum[1:, 1:] = LR2d.cumsum(axis=0).cumsum(axis=1) # 1\u6b21\u5143\u7d2f\u7a4d\u548c\u540c\u69d8\u534a\u958b\u533a\u9593\u3067\u8003\u3048\u308b\n\n# \u3064\u307e\u308a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9i,j\u3068\u306f\u3082\u3068\u306e\u914d\u5217\u306b\u304a\u3044\u3066i,j\u3092\u542b\u307e\u306a\u3044\u56db\u89d2\u5f62\u306e\u9818\u57df\u306e\u5408\u8a08\u3092\u51fa\u3059\n\n\n\n# query\u306b\u7b54\u3048\u3066\u3044\u304f\n\nans = []\n\nfor p, q in pq:\n\n ans.append(LR2d_accum[q + 1, q + 1] - LR2d_accum[q + 1, p] -\n\n LR2d_accum[p, q + 1] + LR2d_accum[p, p])\n\n\n\nprint(*ans, sep='\\n')\n","target":"# https:\/\/atcoder.jp\/contests\/abc106\/tasks\/abc106_d\n\n# \u3069\u3046\u3084\u3063\u305f\u3089\u9ad8\u901f\u306b\u533a\u9593[p,q]\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u533a\u9593\u306e\u6570\u3092\u53d6\u5f97\u3067\u304d\u308b\u304b\uff1f\n\n# p,q\u3092\u4e8c\u6b21\u5143\u5ea7\u6a19\u3068\u3057\u3066\u6349\u3048\u308b\u3068\u96fb\u8eca1\u672c\u306e\u7dda\u306f\u4e8c\u6b21\u5143\u5e73\u9762\u4e0a\u306e1\u70b9\u3068\u3057\u3066\u8868\u305b\u308b\n\n# \u3053\u306e\u3068\u304dp,q\u306e\u533a\u9593\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u96fb\u8eca\u306e\u672c\u6570\u3068\u3044\u3046\u306e\u306f\u3001x\u8ef8\u3001y\u8ef8\u306e\u4e21\u65b9\u306b\u304a\u3044\u3066[p,q]\u3068\u306a\u308b\u56db\u89d2\u5f62\u5185\u306b\u3042\u308b\u96fb\u8eca\u306e\u672c\u6570\n\n# query\u306b\u9ad8\u901f\u306b\u7b54\u3048\u308b\u305f\u3081\u306b\u4e8c\u6b21\u5143\u7d2f\u7a4d\u548c\u3092\u69cb\u7bc9\u3059\u308b\n\nimport sys\n\nread = sys.stdin.readline\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\ndef read_tuple(H):\n\n '''\n\n H is number of rows\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(tuple(map(int, read().split())))\n\n return ret\n\n\n\n\n\n\n\n\n\n# \u30af\u30e9\u30b9\u3067\u5b9f\u88c5\u3057\u3066\u307f\u308b\n\nclass cumsum2d:\n\n def __init__(self, ls: list):\n\n '''\n\n 2\u6b21\u5143\u306e\u30ea\u30b9\u30c8\u3092\u53d7\u3051\u53d6\u308b\n\n '''\n\n import numpy as np\n\n self.ls = np.array(ls)\n\n H, W = self.ls.shape\n\n self.ls_accum = np.zeros((H + 1, W + 1))\n\n self.ls_accum[1:, 1:] = self.ls.cumsum(axis=0).cumsum(axis=1)\n\n\n\n def total(self, i1, j1, i2, j2):\n\n '''\n\n \u70b9(i1,j1),(i1,j2),(i2,j1),(i2,j2)\u306e4\u70b9\u304c\u6210\u3059\u56db\u89d2\u306e\u4e2d\u306e\u5408\u8a08\u3092\u53d6\u308a\u51fa\u3059\n\n \u305f\u3060\u3057 i1<=i2, j1<=j2\n\n \u305f\u3060\u3057\u3001i\u8ef8\u306b\u95a2\u3057\u3066\u306f[i1,i2),j\u8ef8\u306b\u95a2\u3057\u3066\u306f[j1,j2)\u306e\u534a\u958b\u533a\u9593\u3067\u3042\u308b\n\n '''\n\n return self.ls_accum[i2, j2] - self.ls_accum[i1, j2] \\\n\n - self.ls_accum[i2, j1] + self.ls_accum[i1, j1]\n\n\n\n\n\nN, M, Q = read_ints()\n\nLR = read_tuple(M)\n\npq = read_tuple(Q)\n\n\n\n# numpy\u4f7f\u308f\u305a\u306b\u518d\u5b9f\u88c5 #\u5165\u308c\u308b\u3068\u304d\u306fpython\u306e\u307b\u3046\u304c\u901f\u3044\u306e\u3067\n\nLR2d = [[0] * (N + 1) for _ in range(N + 1)]\n\nfor L, R in LR:\n\n LR2d[L][R] += 1\n\n\n\nLR2d_accum = cumsum2d(LR2d)\n\n\n\n# query\u306b\u7b54\u3048\u3066\u3044\u304f\n\nans = []\n\nfor p, q in pq:\n\n ans.append(int(LR2d_accum.total(p, p, q + 1, q + 1)))\n\n\n\nprint(*ans, sep='\\n')\n","code_v0_loc":46,"code_v1_loc":64,"code_v0_num_chars":1122,"code_v1_num_chars":1522,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc106\/tasks\/abc106_d\n# \u3069\u3046\u3084\u3063\u305f\u3089\u9ad8\u901f\u306b\u533a\u9593[p,q]\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u533a\u9593\u306e\u6570\u3092\u53d6\u5f97\u3067\u304d\u308b\u304b\uff1f\n# p,q\u3092\u4e8c\u6b21\u5143\u5ea7\u6a19\u3068\u3057\u3066\u6349\u3048\u308b\u3068\u96fb\u8eca1\u672c\u306e\u7dda\u306f\u4e8c\u6b21\u5143\u5e73\u9762\u4e0a\u306e1\u70b9\u3068\u3057\u3066\u8868\u305b\u308b\n# \u3053\u306e\u3068\u304dp,q\u306e\u533a\u9593\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u96fb\u8eca\u306e\u672c\u6570\u3068\u3044\u3046\u306e\u306f\u3001x\u8ef8\u3001y\u8ef8\u306e\u4e21\u65b9\u306b\u304a\u3044\u3066[p,q]\u3068\u306a\u308b\u56db\u89d2\u5f62\u5185\u306b\u3042\u308b\u96fb\u8eca\u306e\u672c\u6570\n# query\u306b\u9ad8\u901f\u306b\u7b54\u3048\u308b\u305f\u3081\u306b\u4e8c\u6b21\u5143\u7d2f\u7a4d\u548c\u3092\u69cb\u7bc9\u3059\u308b\nimport sys\n\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_tuple(H):\n \"\"\"\n H is number of rows\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, read().split())))\n return ret\n\n\nimport numpy as np\n\nN, M, Q = read_ints()\nLR = read_tuple(M)\npq = read_tuple(Q)\n# numpy\u4f7f\u308f\u305a\u306b\u518d\u5b9f\u88c5 #\u5165\u308c\u308b\u3068\u304d\u306fpython\u306e\u307b\u3046\u304c\u901f\u3044\u306e\u3067\nLR2d = [[0] * (N + 1) for _ in range(N + 1)]\nfor L, R in LR:\n LR2d[L][R] += 1\nLR2d = np.array(LR2d, np.int64)\nLR2d_accum = np.zeros((N + 2, N + 2), np.int64)\nLR2d_accum[1:, 1:] = LR2d.cumsum(axis=0).cumsum(axis=1) # 1\u6b21\u5143\u7d2f\u7a4d\u548c\u540c\u69d8\u534a\u958b\u533a\u9593\u3067\u8003\u3048\u308b\n# \u3064\u307e\u308a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9i,j\u3068\u306f\u3082\u3068\u306e\u914d\u5217\u306b\u304a\u3044\u3066i,j\u3092\u542b\u307e\u306a\u3044\u56db\u89d2\u5f62\u306e\u9818\u57df\u306e\u5408\u8a08\u3092\u51fa\u3059\n# query\u306b\u7b54\u3048\u3066\u3044\u304f\nans = []\nfor p, q in pq:\n ans.append(\n LR2d_accum[q + 1, q + 1]\n - LR2d_accum[q + 1, p]\n - LR2d_accum[p, q + 1]\n + LR2d_accum[p, p]\n )\nprint(*ans, sep=\"\\n\")\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc106\/tasks\/abc106_d\n# \u3069\u3046\u3084\u3063\u305f\u3089\u9ad8\u901f\u306b\u533a\u9593[p,q]\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u533a\u9593\u306e\u6570\u3092\u53d6\u5f97\u3067\u304d\u308b\u304b\uff1f\n# p,q\u3092\u4e8c\u6b21\u5143\u5ea7\u6a19\u3068\u3057\u3066\u6349\u3048\u308b\u3068\u96fb\u8eca1\u672c\u306e\u7dda\u306f\u4e8c\u6b21\u5143\u5e73\u9762\u4e0a\u306e1\u70b9\u3068\u3057\u3066\u8868\u305b\u308b\n# \u3053\u306e\u3068\u304dp,q\u306e\u533a\u9593\u306b\u5b8c\u5168\u306b\u5165\u3063\u3066\u3044\u308b\u96fb\u8eca\u306e\u672c\u6570\u3068\u3044\u3046\u306e\u306f\u3001x\u8ef8\u3001y\u8ef8\u306e\u4e21\u65b9\u306b\u304a\u3044\u3066[p,q]\u3068\u306a\u308b\u56db\u89d2\u5f62\u5185\u306b\u3042\u308b\u96fb\u8eca\u306e\u672c\u6570\n# query\u306b\u9ad8\u901f\u306b\u7b54\u3048\u308b\u305f\u3081\u306b\u4e8c\u6b21\u5143\u7d2f\u7a4d\u548c\u3092\u69cb\u7bc9\u3059\u308b\nimport sys\n\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_tuple(H):\n \"\"\"\n H is number of rows\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, read().split())))\n return ret\n\n\n# \u30af\u30e9\u30b9\u3067\u5b9f\u88c5\u3057\u3066\u307f\u308b\nclass cumsum2d:\n def __init__(self, ls: list):\n \"\"\"\n 2\u6b21\u5143\u306e\u30ea\u30b9\u30c8\u3092\u53d7\u3051\u53d6\u308b\n \"\"\"\n import numpy as np\n\n self.ls = np.array(ls)\n H, W = self.ls.shape\n self.ls_accum = np.zeros((H + 1, W + 1))\n self.ls_accum[1:, 1:] = self.ls.cumsum(axis=0).cumsum(axis=1)\n\n def total(self, i1, j1, i2, j2):\n \"\"\"\n \u70b9(i1,j1),(i1,j2),(i2,j1),(i2,j2)\u306e4\u70b9\u304c\u6210\u3059\u56db\u89d2\u306e\u4e2d\u306e\u5408\u8a08\u3092\u53d6\u308a\u51fa\u3059\n \u305f\u3060\u3057 i1<=i2, j1<=j2\n \u305f\u3060\u3057\u3001i\u8ef8\u306b\u95a2\u3057\u3066\u306f[i1,i2),j\u8ef8\u306b\u95a2\u3057\u3066\u306f[j1,j2)\u306e\u534a\u958b\u533a\u9593\u3067\u3042\u308b\n \"\"\"\n return (\n self.ls_accum[i2, j2]\n - self.ls_accum[i1, j2]\n - self.ls_accum[i2, j1]\n + self.ls_accum[i1, j1]\n )\n\n\nN, M, Q = read_ints()\nLR = read_tuple(M)\npq = read_tuple(Q)\n# numpy\u4f7f\u308f\u305a\u306b\u518d\u5b9f\u88c5 #\u5165\u308c\u308b\u3068\u304d\u306fpython\u306e\u307b\u3046\u304c\u901f\u3044\u306e\u3067\nLR2d = [[0] * (N + 1) for _ in range(N + 1)]\nfor L, R in LR:\n LR2d[L][R] += 1\nLR2d_accum = cumsum2d(LR2d)\n# query\u306b\u7b54\u3048\u3066\u3044\u304f\nans = []\nfor p, q in pq:\n ans.append(int(LR2d_accum.total(p, p, q + 1, q + 1)))\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":28.125,"diff":["-import numpy as np","+# \u30af\u30e9\u30b9\u3067\u5b9f\u88c5\u3057\u3066\u307f\u308b","+class cumsum2d:","+ def __init__(self, ls: list):","+ \"\"\"","+ 2\u6b21\u5143\u306e\u30ea\u30b9\u30c8\u3092\u53d7\u3051\u53d6\u308b","+ \"\"\"","+ import numpy as np","+","+ self.ls = np.array(ls)","+ H, W = self.ls.shape","+ self.ls_accum = np.zeros((H + 1, W + 1))","+ self.ls_accum[1:, 1:] = self.ls.cumsum(axis=0).cumsum(axis=1)","+","+ def total(self, i1, j1, i2, j2):","+ \"\"\"","+ \u70b9(i1,j1),(i1,j2),(i2,j1),(i2,j2)\u306e4\u70b9\u304c\u6210\u3059\u56db\u89d2\u306e\u4e2d\u306e\u5408\u8a08\u3092\u53d6\u308a\u51fa\u3059","+ \u305f\u3060\u3057 i1<=i2, j1<=j2","+ \u305f\u3060\u3057\u3001i\u8ef8\u306b\u95a2\u3057\u3066\u306f[i1,i2),j\u8ef8\u306b\u95a2\u3057\u3066\u306f[j1,j2)\u306e\u534a\u958b\u533a\u9593\u3067\u3042\u308b","+ \"\"\"","+ return (","+ self.ls_accum[i2, j2]","+ - self.ls_accum[i1, j2]","+ - self.ls_accum[i2, j1]","+ + self.ls_accum[i1, j1]","+ )","+","-LR2d = np.array(LR2d, np.int64)","-LR2d_accum = np.zeros((N + 2, N + 2), np.int64)","-LR2d_accum[1:, 1:] = LR2d.cumsum(axis=0).cumsum(axis=1) # 1\u6b21\u5143\u7d2f\u7a4d\u548c\u540c\u69d8\u534a\u958b\u533a\u9593\u3067\u8003\u3048\u308b","-# \u3064\u307e\u308a\u30a4\u30f3\u30c7\u30c3\u30af\u30b9i,j\u3068\u306f\u3082\u3068\u306e\u914d\u5217\u306b\u304a\u3044\u3066i,j\u3092\u542b\u307e\u306a\u3044\u56db\u89d2\u5f62\u306e\u9818\u57df\u306e\u5408\u8a08\u3092\u51fa\u3059","+LR2d_accum = cumsum2d(LR2d)","- ans.append(","- LR2d_accum[q + 1, q + 1]","- - LR2d_accum[q + 1, p]","- - LR2d_accum[p, q + 1]","- + LR2d_accum[p, p]","- )","+ ans.append(int(LR2d_accum.total(p, p, q + 1, q + 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2747292843,"measured_runtime_v1":0.0399481599,"runtime_lift":6.8771448967,"key":["s999863301","s241227529"]} +{"user_id":"u681444474","problem_id":"p03487","language":"python","submission_id_v0":"s518030564","submission_id_v1":"s698875940","cpu_time_v0":279,"cpu_time_v1":114,"memory_v0":75432,"memory_v1":25464,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.14,"input":"import collections\n\nN=int(eval(input()))\n\nA=list(map(int,input().split()))\n\nc = collections.Counter(A)\n\nans=0\n\nn=len(set(A))\n\nc_=c.most_common()\n\nfor i in range(n):\n\n a=int(c_[i][0])\n\n b=c_[i][1]\n\n if a <= b:\n\n ans+=b-a\n\n else:\n\n ans+=b\n\nprint(ans)","target":"# coding: utf-8\n\nimport collections\n\nN = int(eval(input()))\n\nA= list(map(int,input().split()))\n\n\n\nA.sort()\n\n\n\nc = collections.Counter(A)\n\nA_ = list(set(A))\n\nans = 0\n\nfor a in A_:\n\n #print(c[a],a)\n\n if a > c[a]:\n\n ans += c[a]\n\n else:\n\n ans += c[a]-a\n\n \n\nprint(ans)","code_v0_loc":15,"code_v1_loc":18,"code_v0_num_chars":268,"code_v1_num_chars":284,"code_v0_no_empty_lines":"import collections\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nc = collections.Counter(A)\nans = 0\nn = len(set(A))\nc_ = c.most_common()\nfor i in range(n):\n a = int(c_[i][0])\n b = c_[i][1]\n if a <= b:\n ans += b - a\n else:\n ans += b\nprint(ans)\n","code_v1_no_empty_lines":"# coding: utf-8\nimport collections\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nA.sort()\nc = collections.Counter(A)\nA_ = list(set(A))\nans = 0\nfor a in A_:\n # print(c[a],a)\n if a > c[a]:\n ans += c[a]\n else:\n ans += c[a] - a\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["+# coding: utf-8","+A.sort()","+A_ = list(set(A))","-n = len(set(A))","-c_ = c.most_common()","-for i in range(n):","- a = int(c_[i][0])","- b = c_[i][1]","- if a <= b:","- ans += b - a","+for a in A_:","+ # print(c[a],a)","+ if a > c[a]:","+ ans += c[a]","- ans += b","+ ans += c[a] - a"],"diff_only_import_comment":false,"measured_runtime_v0":0.0392314911,"measured_runtime_v1":0.054605484,"runtime_lift":0.7184533164,"key":["s518030564","s698875940"]} +{"user_id":"u102461423","problem_id":"p03162","language":"python","submission_id_v0":"s812021448","submission_id_v1":"s243570341","cpu_time_v0":232,"cpu_time_v1":172,"memory_v0":3188,"memory_v1":20192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.86,"input":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nN = int(eval(input()))\n\nx,y,z = 0,0,0 # \u6700\u5f8c\u306b\u7279\u5b9a\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u884c\u3063\u305f\u5834\u5408\u306e\u6700\u5927\u5e78\u798f\u5ea6\n\nfor _ in range(N):\n\n a,b,c = list(map(int,input().split()))\n\n x,y,z = max(y,z) + a, max(x,z) + b, max(x,y) + c\n\nanswer = max(x,y,z)\n\nprint(answer)","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(readline())\n\nm = list(map(int,read().split()))\n\nABC = list(zip(m,m,m))\n\n\n\nx,y,z = 0,0,0 # \u6700\u5f8c\u306e\u6d3b\u52d5 -> \u5e78\u798f\u5ea6\u306emax\n\nfor a,b,c in ABC:\n\n x,y,z = max(y,z)+a,max(x,z)+b,max(x,y)+c\n\n\n\nanswer = max(x,y,z)\n\nprint(answer)","code_v0_loc":11,"code_v1_loc":15,"code_v0_num_chars":278,"code_v1_num_chars":327,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nN = int(eval(input()))\nx, y, z = 0, 0, 0 # \u6700\u5f8c\u306b\u7279\u5b9a\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u884c\u3063\u305f\u5834\u5408\u306e\u6700\u5927\u5e78\u798f\u5ea6\nfor _ in range(N):\n a, b, c = list(map(int, input().split()))\n x, y, z = max(y, z) + a, max(x, z) + b, max(x, y) + c\nanswer = max(x, y, z)\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nm = list(map(int, read().split()))\nABC = list(zip(m, m, m))\nx, y, z = 0, 0, 0 # \u6700\u5f8c\u306e\u6d3b\u52d5 -> \u5e78\u798f\u5ea6\u306emax\nfor a, b, c in ABC:\n x, y, z = max(y, z) + a, max(x, z) + b, max(x, y) + c\nanswer = max(x, y, z)\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["-input = sys.stdin.readline","-sys.setrecursionlimit(10**7)","-N = int(eval(input()))","-x, y, z = 0, 0, 0 # \u6700\u5f8c\u306b\u7279\u5b9a\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u884c\u3063\u305f\u5834\u5408\u306e\u6700\u5927\u5e78\u798f\u5ea6","-for _ in range(N):","- a, b, c = list(map(int, input().split()))","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+N = int(readline())","+m = list(map(int, read().split()))","+ABC = list(zip(m, m, m))","+x, y, z = 0, 0, 0 # \u6700\u5f8c\u306e\u6d3b\u52d5 -> \u5e78\u798f\u5ea6\u306emax","+for a, b, c in ABC:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0353139005,"measured_runtime_v1":0.0412637553,"runtime_lift":0.8558091765,"key":["s812021448","s243570341"]} +{"user_id":"u922449550","problem_id":"p02722","language":"python","submission_id_v0":"s109444817","submission_id_v1":"s122437516","cpu_time_v0":300,"cpu_time_v1":208,"memory_v0":3828,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.67,"input":"N = int(eval(input()))\n\n\n\ndef check(p):\n\n _N = N\n\n while _N%p == 0:\n\n _N \/\/= p\n\n return (_N-1)%p == 0\n\n\n\nn = int(N**0.5) + 1\n\nP0 = set([N])\n\nP1 = set([N-1])\n\nfor i in range(2, n+1):\n\n if (N-1)%i == 0:\n\n P1.add(i)\n\n P1.add((N-1)\/\/i)\n\n if N%i == 0:\n\n P0.add(i)\n\n P0.add(N\/\/i)\n\n\n\nP0.discard(1)\n\nP1.discard(1)\n\nans = len(P1)\n\nfor p in P0:\n\n ans += check(p)\n\n\n\nprint(ans)","target":"def check(p):\n\n _N = N\n\n while _N%p == 0:\n\n _N \/\/= p\n\n return (_N-1)%p == 0\n\n\n\ndef calc_divisors(n):\n\n m = int(n**0.5)\n\n left = []\n\n right = []\n\n for i in range(1, m+1):\n\n if n%i == 0:\n\n left.append(i)\n\n right.append(n\/\/i)\n\n if left[-1] == right[-1]:\n\n right.pop()\n\n return left + right[::-1]\n\n\n\nN = int(eval(input()))\n\nP0 = calc_divisors(N)[1:] # [:1]\u30671\u3092\u9664\u5916\n\nP1 = calc_divisors(N-1)[1:] # \u540c\u4e0a\n\nans = len(P1)\n\nfor p in P0:\n\n ans += check(p)\n\n\n\nprint(ans)","code_v0_loc":26,"code_v1_loc":26,"code_v0_num_chars":381,"code_v1_num_chars":507,"code_v0_no_empty_lines":"N = int(eval(input()))\n\n\ndef check(p):\n _N = N\n while _N % p == 0:\n _N \/\/= p\n return (_N - 1) % p == 0\n\n\nn = int(N**0.5) + 1\nP0 = set([N])\nP1 = set([N - 1])\nfor i in range(2, n + 1):\n if (N - 1) % i == 0:\n P1.add(i)\n P1.add((N - 1) \/\/ i)\n if N % i == 0:\n P0.add(i)\n P0.add(N \/\/ i)\nP0.discard(1)\nP1.discard(1)\nans = len(P1)\nfor p in P0:\n ans += check(p)\nprint(ans)\n","code_v1_no_empty_lines":"def check(p):\n _N = N\n while _N % p == 0:\n _N \/\/= p\n return (_N - 1) % p == 0\n\n\ndef calc_divisors(n):\n m = int(n**0.5)\n left = []\n right = []\n for i in range(1, m + 1):\n if n % i == 0:\n left.append(i)\n right.append(n \/\/ i)\n if left[-1] == right[-1]:\n right.pop()\n return left + right[::-1]\n\n\nN = int(eval(input()))\nP0 = calc_divisors(N)[1:] # [:1]\u30671\u3092\u9664\u5916\nP1 = calc_divisors(N - 1)[1:] # \u540c\u4e0a\nans = len(P1)\nfor p in P0:\n ans += check(p)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-N = int(eval(input()))","-","-","-n = int(N**0.5) + 1","-P0 = set([N])","-P1 = set([N - 1])","-for i in range(2, n + 1):","- if (N - 1) % i == 0:","- P1.add(i)","- P1.add((N - 1) \/\/ i)","- if N % i == 0:","- P0.add(i)","- P0.add(N \/\/ i)","-P0.discard(1)","-P1.discard(1)","+def calc_divisors(n):","+ m = int(n**0.5)","+ left = []","+ right = []","+ for i in range(1, m + 1):","+ if n % i == 0:","+ left.append(i)","+ right.append(n \/\/ i)","+ if left[-1] == right[-1]:","+ right.pop()","+ return left + right[::-1]","+","+","+N = int(eval(input()))","+P0 = calc_divisors(N)[1:] # [:1]\u30671\u3092\u9664\u5916","+P1 = calc_divisors(N - 1)[1:] # \u540c\u4e0a"],"diff_only_import_comment":false,"measured_runtime_v0":0.0975081227,"measured_runtime_v1":0.0784787245,"runtime_lift":1.2424784337,"key":["s109444817","s122437516"]} +{"user_id":"u562935282","problem_id":"p03176","language":"python","submission_id_v0":"s079589527","submission_id_v1":"s329875393","cpu_time_v0":1527,"cpu_time_v1":555,"memory_v0":128636,"memory_v1":128892,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.65,"input":"class SegmentTree:\n\n def __init__(self, a: list, e: 'default' = 0, f: 'function' = max):\n\n size = len(a)\n\n n = 1 << (size - 1).bit_length()\n\n seg = [e] * (n * 2 - 1)\n\n for i, a_ in enumerate(a, n - 1):\n\n seg[i] = a_\n\n for i in range(n - 2, -1, -1):\n\n seg[i] = f(seg[i * 2 + 1], seg[i * 2 + 2])\n\n self.size = size\n\n self.n = n\n\n self.seg = seg\n\n self.a = a\n\n self.e = e\n\n self.f = f\n\n\n\n def update(self, k, x):\n\n n = self.n\n\n seg = self.seg\n\n f = self.f\n\n\n\n k += n - 1\n\n seg[k] = x\n\n while k > 0:\n\n k = (k - 1) \/\/ 2\n\n seg[k] = f(seg[k * 2 + 1], seg[k * 2 + 2])\n\n\n\n def query(self, a, b, k=0, l=0, r=-1):\n\n if r < 0:\n\n r = self.n\n\n if r <= a or b <= l:\n\n return self.e\n\n if a <= l and r <= b:\n\n return self.seg[k]\n\n m = (l + r) \/\/ 2\n\n vl = self.query(a, b, k * 2 + 1, l, m)\n\n vr = self.query(a, b, k * 2 + 2, m, r)\n\n return self.f(vl, vr)\n\n\n\n\n\nn = int(eval(input()))\n\nh = tuple(map(int, input().split()))\n\na = tuple(map(int, input().split()))\n\n\n\ndp = [0] * (n + 1)\n\n# dp[j] := \u672b\u5c3ej\u306e\u5358\u8abf\u5897\u52a0\u5217\u306e\u7f8e\u3057\u3055\u306e\u7dcf\u548c\u306e\u6700\u5927\u5024\n\n\n\nseg = SegmentTree(a=dp, e=0, f=max)\n\n\n\nfor h_, a_ in zip(h, a):\n\n # i\u672c\u76ee\u3092\u53d6\u3063\u3066\u672b\u5c3e\u306b\u3059\u308b\u3068\u304d\n\n max_ = seg.query(0, h_) + a_\n\n seg.update(h_, max_)\n\nprint((seg.query(0, n + 1)))","target":"# seg = SegmentTree(init_val=dp, segfunc=max, ide_ele=0)\n\nclass SegmentTree:\n\n # original: @solzard_\n\n def __init__(self,\n\n init_val: 'initial value: iterable',\n\n segfunc: 'operation unique in case',\n\n ide_ele: 'identity element corresponding init_val' = 0,\n\n ):\n\n self.segfunc = segfunc\n\n self.ide_ele = ide_ele\n\n self.size = 1 << (len(init_val) - 1).bit_length()\n\n self.tree = self._build(init_val)\n\n\n\n def _build(self, init_val) -> 'tree':\n\n segfunc = self.segfunc\n\n\n\n tree = [self.ide_ele] * (self.size * 2 - 1)\n\n\n\n for idx, val in enumerate(init_val, self.size - 1): # set\n\n # modify val if needed (e.g. str -> ord())\n\n tree[idx] = val\n\n\n\n for idx in range(self.size - 2, -1, -1): # build\n\n tree[idx] = segfunc(tree[idx * 2 + 1], tree[idx * 2 + 2])\n\n\n\n return tree\n\n\n\n def update(self, idx: int, val) -> None:\n\n tree = self.tree\n\n segfunc = self.segfunc\n\n\n\n idx += self.size - 1\n\n # modify val if needed as same as in _build()\n\n tree[idx] = val\n\n while idx > 0:\n\n idx = (idx - 1) \/\/ 2\n\n tree[idx] = segfunc(tree[idx * 2 + 1], tree[idx * 2 + 2])\n\n\n\n def query(self, left: int, right: int) -> 'result':\n\n left += self.size\n\n right += self.size\n\n ret = self.ide_ele # left >= right: return self.ide_ele\n\n segfunc = self.segfunc\n\n tree = self.tree\n\n while left < right:\n\n if left & 1: # odd\n\n ret = segfunc(ret, tree[left - 1])\n\n left += 1\n\n if right & 1: # odd\n\n right -= 1\n\n ret = segfunc(ret, tree[right - 1])\n\n left >>= 1\n\n right >>= 1\n\n return ret\n\n\n\n\n\nn = int(eval(input()))\n\nh = tuple(map(int, input().split()))\n\na = tuple(map(int, input().split()))\n\n\n\ndp = [0] * (n + 1)\n\n# dp[j] := \u672b\u5c3ej\u306e\u5358\u8abf\u5897\u52a0\u5217\u306e\u7f8e\u3057\u3055\u306e\u7dcf\u548c\u306e\u6700\u5927\u5024\n\n\n\nseg = SegmentTree(init_val=dp, segfunc=max, ide_ele=0)\n\n\n\nfor h_, a_ in zip(h, a):\n\n # i\u672c\u76ee\u3092\u53d6\u3063\u3066\u672b\u5c3e\u306b\u3059\u308b\u3068\u304d\n\n max_ = seg.query(0, h_) + a_\n\n seg.update(h_, max_)\n\nprint((seg.query(0, n + 1)))\n","code_v0_loc":54,"code_v1_loc":70,"code_v0_num_chars":1420,"code_v1_num_chars":2200,"code_v0_no_empty_lines":"class SegmentTree:\n def __init__(self, a: list, e: \"default\" = 0, f: \"function\" = max):\n size = len(a)\n n = 1 << (size - 1).bit_length()\n seg = [e] * (n * 2 - 1)\n for i, a_ in enumerate(a, n - 1):\n seg[i] = a_\n for i in range(n - 2, -1, -1):\n seg[i] = f(seg[i * 2 + 1], seg[i * 2 + 2])\n self.size = size\n self.n = n\n self.seg = seg\n self.a = a\n self.e = e\n self.f = f\n\n def update(self, k, x):\n n = self.n\n seg = self.seg\n f = self.f\n k += n - 1\n seg[k] = x\n while k > 0:\n k = (k - 1) \/\/ 2\n seg[k] = f(seg[k * 2 + 1], seg[k * 2 + 2])\n\n def query(self, a, b, k=0, l=0, r=-1):\n if r < 0:\n r = self.n\n if r <= a or b <= l:\n return self.e\n if a <= l and r <= b:\n return self.seg[k]\n m = (l + r) \/\/ 2\n vl = self.query(a, b, k * 2 + 1, l, m)\n vr = self.query(a, b, k * 2 + 2, m, r)\n return self.f(vl, vr)\n\n\nn = int(eval(input()))\nh = tuple(map(int, input().split()))\na = tuple(map(int, input().split()))\ndp = [0] * (n + 1)\n# dp[j] := \u672b\u5c3ej\u306e\u5358\u8abf\u5897\u52a0\u5217\u306e\u7f8e\u3057\u3055\u306e\u7dcf\u548c\u306e\u6700\u5927\u5024\nseg = SegmentTree(a=dp, e=0, f=max)\nfor h_, a_ in zip(h, a):\n # i\u672c\u76ee\u3092\u53d6\u3063\u3066\u672b\u5c3e\u306b\u3059\u308b\u3068\u304d\n max_ = seg.query(0, h_) + a_\n seg.update(h_, max_)\nprint((seg.query(0, n + 1)))\n","code_v1_no_empty_lines":"# seg = SegmentTree(init_val=dp, segfunc=max, ide_ele=0)\nclass SegmentTree:\n # original: @solzard_\n def __init__(\n self,\n init_val: \"initial value: iterable\",\n segfunc: \"operation unique in case\",\n ide_ele: \"identity element corresponding init_val\" = 0,\n ):\n self.segfunc = segfunc\n self.ide_ele = ide_ele\n self.size = 1 << (len(init_val) - 1).bit_length()\n self.tree = self._build(init_val)\n\n def _build(self, init_val) -> \"tree\":\n segfunc = self.segfunc\n tree = [self.ide_ele] * (self.size * 2 - 1)\n for idx, val in enumerate(init_val, self.size - 1): # set\n # modify val if needed (e.g. str -> ord())\n tree[idx] = val\n for idx in range(self.size - 2, -1, -1): # build\n tree[idx] = segfunc(tree[idx * 2 + 1], tree[idx * 2 + 2])\n return tree\n\n def update(self, idx: int, val) -> None:\n tree = self.tree\n segfunc = self.segfunc\n idx += self.size - 1\n # modify val if needed as same as in _build()\n tree[idx] = val\n while idx > 0:\n idx = (idx - 1) \/\/ 2\n tree[idx] = segfunc(tree[idx * 2 + 1], tree[idx * 2 + 2])\n\n def query(self, left: int, right: int) -> \"result\":\n left += self.size\n right += self.size\n ret = self.ide_ele # left >= right: return self.ide_ele\n segfunc = self.segfunc\n tree = self.tree\n while left < right:\n if left & 1: # odd\n ret = segfunc(ret, tree[left - 1])\n left += 1\n if right & 1: # odd\n right -= 1\n ret = segfunc(ret, tree[right - 1])\n left >>= 1\n right >>= 1\n return ret\n\n\nn = int(eval(input()))\nh = tuple(map(int, input().split()))\na = tuple(map(int, input().split()))\ndp = [0] * (n + 1)\n# dp[j] := \u672b\u5c3ej\u306e\u5358\u8abf\u5897\u52a0\u5217\u306e\u7f8e\u3057\u3055\u306e\u7dcf\u548c\u306e\u6700\u5927\u5024\nseg = SegmentTree(init_val=dp, segfunc=max, ide_ele=0)\nfor h_, a_ in zip(h, a):\n # i\u672c\u76ee\u3092\u53d6\u3063\u3066\u672b\u5c3e\u306b\u3059\u308b\u3068\u304d\n max_ = seg.query(0, h_) + a_\n seg.update(h_, max_)\nprint((seg.query(0, n + 1)))\n","code_same":false,"relative_loc_diff_percent":22.8571428571,"diff":["+# seg = SegmentTree(init_val=dp, segfunc=max, ide_ele=0)","- def __init__(self, a: list, e: \"default\" = 0, f: \"function\" = max):","- size = len(a)","- n = 1 << (size - 1).bit_length()","- seg = [e] * (n * 2 - 1)","- for i, a_ in enumerate(a, n - 1):","- seg[i] = a_","- for i in range(n - 2, -1, -1):","- seg[i] = f(seg[i * 2 + 1], seg[i * 2 + 2])","- self.size = size","- self.n = n","- self.seg = seg","- self.a = a","- self.e = e","- self.f = f","+ # original: @solzard_","+ def __init__(","+ self,","+ init_val: \"initial value: iterable\",","+ segfunc: \"operation unique in case\",","+ ide_ele: \"identity element corresponding init_val\" = 0,","+ ):","+ self.segfunc = segfunc","+ self.ide_ele = ide_ele","+ self.size = 1 << (len(init_val) - 1).bit_length()","+ self.tree = self._build(init_val)","- def update(self, k, x):","- n = self.n","- seg = self.seg","- f = self.f","- k += n - 1","- seg[k] = x","- while k > 0:","- k = (k - 1) \/\/ 2","- seg[k] = f(seg[k * 2 + 1], seg[k * 2 + 2])","+ def _build(self, init_val) -> \"tree\":","+ segfunc = self.segfunc","+ tree = [self.ide_ele] * (self.size * 2 - 1)","+ for idx, val in enumerate(init_val, self.size - 1): # set","+ # modify val if needed (e.g. str -> ord())","+ tree[idx] = val","+ for idx in range(self.size - 2, -1, -1): # build","+ tree[idx] = segfunc(tree[idx * 2 + 1], tree[idx * 2 + 2])","+ return tree","- def query(self, a, b, k=0, l=0, r=-1):","- if r < 0:","- r = self.n","- if r <= a or b <= l:","- return self.e","- if a <= l and r <= b:","- return self.seg[k]","- m = (l + r) \/\/ 2","- vl = self.query(a, b, k * 2 + 1, l, m)","- vr = self.query(a, b, k * 2 + 2, m, r)","- return self.f(vl, vr)","+ def update(self, idx: int, val) -> None:","+ tree = self.tree","+ segfunc = self.segfunc","+ idx += self.size - 1","+ # modify val if needed as same as in _build()","+ tree[idx] = val","+ while idx > 0:","+ idx = (idx - 1) \/\/ 2","+ tree[idx] = segfunc(tree[idx * 2 + 1], tree[idx * 2 + 2])","+","+ def query(self, left: int, right: int) -> \"result\":","+ left += self.size","+ right += self.size","+ ret = self.ide_ele # left >= right: return self.ide_ele","+ segfunc = self.segfunc","+ tree = self.tree","+ while left < right:","+ if left & 1: # odd","+ ret = segfunc(ret, tree[left - 1])","+ left += 1","+ if right & 1: # odd","+ right -= 1","+ ret = segfunc(ret, tree[right - 1])","+ left >>= 1","+ right >>= 1","+ return ret","-seg = SegmentTree(a=dp, e=0, f=max)","+seg = SegmentTree(init_val=dp, segfunc=max, ide_ele=0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376392429,"measured_runtime_v1":0.0378757269,"runtime_lift":0.9937563163,"key":["s079589527","s329875393"]} +{"user_id":"u631277801","problem_id":"p02954","language":"python","submission_id_v0":"s801138250","submission_id_v1":"s189681597","cpu_time_v0":277,"cpu_time_v1":147,"memory_v0":51012,"memory_v1":11812,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.93,"input":"import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\ns = ns()\n\nn = len(s)\n\n\n\nans = [0]*n\n\n\n\n#\u5de6\u304b\u3089R\u3092\u898b\u308b\n\nnextl = [-1]*n\n\ncurl = n-1\n\nfor i, si in enumerate(s[::-1]):\n\n if si == \"R\":\n\n nextl[n-i-1] = curl\n\n else:\n\n curl = n-i-1\n\n\n\nfor i, nli in enumerate(nextl):\n\n if nli == -1:\n\n continue\n\n\n\n if(nli - i) % 2:\n\n ans[nli-1] += 1\n\n else:\n\n ans[nli] += 1\n\n\n\n# \u53f3\u304b\u3089L\u3092\u898b\u308b\n\nnextr = [-1]*n\n\ncurr = 0\n\nfor i, si in enumerate(s):\n\n if si == \"L\":\n\n nextr[i] = curr\n\n else:\n\n curr = i\n\n\n\nfor i, nri in enumerate(nextr):\n\n if nri == -1:\n\n continue\n\n\n\n if (i - nri) % 2:\n\n ans[nri+1] += 1\n\n else:\n\n ans[nri] += 1\n\n\n\nprint((*ans))\n\n\n","target":"import sys\n\nstdin = sys.stdin\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x) - 1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\ns = lc()\n\nn = len(s)\n\n\n\ntol = [0]*n\n\ntor = [0]*n\n\nans = [0]*n\n\n\n\n# R\u306b\u3044\u308b\u5b50\u306eL\u307e\u3067\u306e\u8ddd\u96e2\n\ndist = 0\n\nfor i in range(n-1, -1, -1):\n\n if s[i] == \"L\":\n\n dist = 0\n\n else:\n\n dist += 1\n\n tol[i] = dist\n\n\n\n# L\u306b\u3044\u308b\u5b50\u306eR\u307e\u3067\u306e\u8ddd\u96e2\n\ndist = 0\n\nfor i in range(n):\n\n if s[i] == \"R\":\n\n dist = 0\n\n else:\n\n dist += 1\n\n tor[i] = dist\n\n\n\n# \u305d\u308c\u305e\u308c\u306e\u6700\u7d42\u7684\u306a\u4f4d\u7f6e\n\nfor j, tolj in enumerate(tol):\n\n if tolj == 0:\n\n continue\n\n elif tolj % 2:\n\n ans[j + tolj - 1] += 1\n\n else:\n\n ans[j + tolj] += 1\n\n\n\nfor j, torj in enumerate(tor):\n\n if torj == 0:\n\n continue\n\n elif torj % 2:\n\n ans[j - torj + 1] += 1\n\n else:\n\n ans[j -torj] += 1\n\n\n\nprint((*ans))\n\n\n\n\n","code_v0_loc":57,"code_v1_loc":59,"code_v0_num_chars":1105,"code_v1_num_chars":1155,"code_v0_no_empty_lines":"import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\ns = ns()\nn = len(s)\nans = [0] * n\n# \u5de6\u304b\u3089R\u3092\u898b\u308b\nnextl = [-1] * n\ncurl = n - 1\nfor i, si in enumerate(s[::-1]):\n if si == \"R\":\n nextl[n - i - 1] = curl\n else:\n curl = n - i - 1\nfor i, nli in enumerate(nextl):\n if nli == -1:\n continue\n if (nli - i) % 2:\n ans[nli - 1] += 1\n else:\n ans[nli] += 1\n# \u53f3\u304b\u3089L\u3092\u898b\u308b\nnextr = [-1] * n\ncurr = 0\nfor i, si in enumerate(s):\n if si == \"L\":\n nextr[i] = curr\n else:\n curr = i\nfor i, nri in enumerate(nextr):\n if nri == -1:\n continue\n if (i - nri) % 2:\n ans[nri + 1] += 1\n else:\n ans[nri] += 1\nprint((*ans))\n","code_v1_no_empty_lines":"import sys\n\nstdin = sys.stdin\nsys.setrecursionlimit(10**7)\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\ns = lc()\nn = len(s)\ntol = [0] * n\ntor = [0] * n\nans = [0] * n\n# R\u306b\u3044\u308b\u5b50\u306eL\u307e\u3067\u306e\u8ddd\u96e2\ndist = 0\nfor i in range(n - 1, -1, -1):\n if s[i] == \"L\":\n dist = 0\n else:\n dist += 1\n tol[i] = dist\n# L\u306b\u3044\u308b\u5b50\u306eR\u307e\u3067\u306e\u8ddd\u96e2\ndist = 0\nfor i in range(n):\n if s[i] == \"R\":\n dist = 0\n else:\n dist += 1\n tor[i] = dist\n# \u305d\u308c\u305e\u308c\u306e\u6700\u7d42\u7684\u306a\u4f4d\u7f6e\nfor j, tolj in enumerate(tol):\n if tolj == 0:\n continue\n elif tolj % 2:\n ans[j + tolj - 1] += 1\n else:\n ans[j + tolj] += 1\nfor j, torj in enumerate(tor):\n if torj == 0:\n continue\n elif torj % 2:\n ans[j - torj + 1] += 1\n else:\n ans[j - torj] += 1\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":3.3898305085,"diff":["-s = ns()","+s = lc()","+tol = [0] * n","+tor = [0] * n","-# \u5de6\u304b\u3089R\u3092\u898b\u308b","-nextl = [-1] * n","-curl = n - 1","-for i, si in enumerate(s[::-1]):","- if si == \"R\":","- nextl[n - i - 1] = curl","+# R\u306b\u3044\u308b\u5b50\u306eL\u307e\u3067\u306e\u8ddd\u96e2","+dist = 0","+for i in range(n - 1, -1, -1):","+ if s[i] == \"L\":","+ dist = 0","- curl = n - i - 1","-for i, nli in enumerate(nextl):","- if nli == -1:","+ dist += 1","+ tol[i] = dist","+# L\u306b\u3044\u308b\u5b50\u306eR\u307e\u3067\u306e\u8ddd\u96e2","+dist = 0","+for i in range(n):","+ if s[i] == \"R\":","+ dist = 0","+ else:","+ dist += 1","+ tor[i] = dist","+# \u305d\u308c\u305e\u308c\u306e\u6700\u7d42\u7684\u306a\u4f4d\u7f6e","+for j, tolj in enumerate(tol):","+ if tolj == 0:","- if (nli - i) % 2:","- ans[nli - 1] += 1","+ elif tolj % 2:","+ ans[j + tolj - 1] += 1","- ans[nli] += 1","-# \u53f3\u304b\u3089L\u3092\u898b\u308b","-nextr = [-1] * n","-curr = 0","-for i, si in enumerate(s):","- if si == \"L\":","- nextr[i] = curr","+ ans[j + tolj] += 1","+for j, torj in enumerate(tor):","+ if torj == 0:","+ continue","+ elif torj % 2:","+ ans[j - torj + 1] += 1","- curr = i","-for i, nri in enumerate(nextr):","- if nri == -1:","- continue","- if (i - nri) % 2:","- ans[nri + 1] += 1","- else:","- ans[nri] += 1","+ ans[j - torj] += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0353338845,"measured_runtime_v1":0.1052505667,"runtime_lift":0.3357120591,"key":["s801138250","s189681597"]} +{"user_id":"u906501980","problem_id":"p02658","language":"python","submission_id_v0":"s818782129","submission_id_v1":"s057122164","cpu_time_v0":58,"cpu_time_v1":48,"memory_v0":21628,"memory_v1":21692,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.24,"input":"def main():\n\n n = int(eval(input()))\n\n a = list(map(int, input().split()))\n\n MAX = 10**18\n\n if 0 in set(a):\n\n print((0))\n\n else:\n\n ans = a[0]\n\n for ai in a[1:]:\n\n ans *= ai\n\n if ans > MAX:\n\n print((-1))\n\n return\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"def main():\n\n n = int(eval(input()))\n\n a = list(map(int, input().split()))\n\n if 0 in a:\n\n print((0))\n\n exit(0)\n\n ans = 1\n\n MAX = 10**18\n\n for ai in a:\n\n ans *= ai\n\n if ans > MAX:\n\n print((-1))\n\n exit(0)\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":17,"code_v1_loc":17,"code_v0_num_chars":351,"code_v1_num_chars":318,"code_v0_no_empty_lines":"def main():\n n = int(eval(input()))\n a = list(map(int, input().split()))\n MAX = 10**18\n if 0 in set(a):\n print((0))\n else:\n ans = a[0]\n for ai in a[1:]:\n ans *= ai\n if ans > MAX:\n print((-1))\n return\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n a = list(map(int, input().split()))\n if 0 in a:\n print((0))\n exit(0)\n ans = 1\n MAX = 10**18\n for ai in a:\n ans *= ai\n if ans > MAX:\n print((-1))\n exit(0)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+ if 0 in a:","+ print((0))","+ exit(0)","+ ans = 1","- if 0 in set(a):","- print((0))","- else:","- ans = a[0]","- for ai in a[1:]:","- ans *= ai","- if ans > MAX:","- print((-1))","- return","- print(ans)","+ for ai in a:","+ ans *= ai","+ if ans > MAX:","+ print((-1))","+ exit(0)","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0967342281,"measured_runtime_v1":0.0403506725,"runtime_lift":2.397338685,"key":["s818782129","s057122164"]} +{"user_id":"u024715419","problem_id":"p02281","language":"python","submission_id_v0":"s576369895","submission_id_v1":"s325509712","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7848,"memory_v1":7860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"class Node():\n\n def __init__(self, node_id, left, right):\n\n self.node_id = node_id\n\n self.left = left\n\n self.right = right\n\n\n\n def pre_order_search(self):\n\n l = self.left\n\n r = self.right\n\n print(\"\",self.node_id, end=\"\")\n\n if l != -1:\n\n tree[l].pre_order_search()\n\n if r != -1:\n\n tree[r].pre_order_search()\n\n\n\n def in_order_search(self):\n\n l = self.left\n\n r = self.right\n\n if l != -1:\n\n tree[l].in_order_search()\n\n print(\"\",self.node_id, end=\"\")\n\n if r != -1:\n\n tree[r].in_order_search()\n\n\n\n def post_order_search(self):\n\n l = self.left\n\n r = self.right\n\n if l != -1:\n\n tree[l].post_order_search()\n\n if r != -1:\n\n tree[r].post_order_search()\n\n print(\"\",self.node_id, end=\"\")\n\n\n\nn = int(input())\n\ntree = [None for i in range(n)]\n\nroot_set = set(range(n))\n\n\n\nfor i in range(n):\n\n node_id, left, right = map(int, input().split())\n\n tree[node_id] = Node(node_id, left, right)\n\n root_set -= set([left, right])\n\nroot = root_set.pop()\n\n\n\nprint(\"Preorder\")\n\ntree[root].pre_order_search()\n\nprint(\"\")\n\n\n\nprint(\"Inorder\")\n\ntree[root].in_order_search()\n\nprint()\n\n\n\nprint(\"Postorder\")\n\ntree[root].post_order_search()\n\nprint()\n","target":"class Node():\n\n def __init__(self, node_id, left, right):\n\n self.node_id = node_id\n\n self.left = left\n\n self.right = right\n\n\n\n def pre_order_search(self):\n\n l = self.left\n\n r = self.right\n\n print(\"\",self.node_id, end=\"\")\n\n if l != -1:\n\n tree[l].pre_order_search()\n\n if r != -1:\n\n tree[r].pre_order_search()\n\n\n\n def in_order_search(self):\n\n l = self.left\n\n r = self.right\n\n if l != -1:\n\n tree[l].in_order_search()\n\n print(\"\",self.node_id, end=\"\")\n\n if r != -1:\n\n tree[r].in_order_search()\n\n\n\n def post_order_search(self):\n\n l = self.left\n\n r = self.right\n\n if l != -1:\n\n tree[l].post_order_search()\n\n if r != -1:\n\n tree[r].post_order_search()\n\n print(\"\",self.node_id, end=\"\")\n\n\n\nn = int(input())\n\ntree = [None for i in range(n)]\n\nroot_set = set(range(n))\n\n\n\nfor i in range(n):\n\n node_id, left, right = map(int, input().split())\n\n tree[node_id] = Node(node_id, left, right)\n\n root_set -= set([left, right])\n\nroot = root_set.pop()\n\n\n\nprint(\"Preorder\")\n\ntree[root].pre_order_search()\n\nprint(\"\")\n\n\n\nprint(\"Inorder\")\n\ntree[root].in_order_search()\n\nprint(\"\")\n\n\n\nprint(\"Postorder\")\n\ntree[root].post_order_search()\n\nprint(\"\")\n","code_v0_loc":54,"code_v1_loc":54,"code_v0_num_chars":1345,"code_v1_num_chars":1349,"code_v0_no_empty_lines":"class Node:\n def __init__(self, node_id, left, right):\n self.node_id = node_id\n self.left = left\n self.right = right\n\n def pre_order_search(self):\n l = self.left\n r = self.right\n print(\"\", self.node_id, end=\"\")\n if l != -1:\n tree[l].pre_order_search()\n if r != -1:\n tree[r].pre_order_search()\n\n def in_order_search(self):\n l = self.left\n r = self.right\n if l != -1:\n tree[l].in_order_search()\n print(\"\", self.node_id, end=\"\")\n if r != -1:\n tree[r].in_order_search()\n\n def post_order_search(self):\n l = self.left\n r = self.right\n if l != -1:\n tree[l].post_order_search()\n if r != -1:\n tree[r].post_order_search()\n print(\"\", self.node_id, end=\"\")\n\n\nn = int(input())\ntree = [None for i in range(n)]\nroot_set = set(range(n))\nfor i in range(n):\n node_id, left, right = map(int, input().split())\n tree[node_id] = Node(node_id, left, right)\n root_set -= set([left, right])\nroot = root_set.pop()\nprint(\"Preorder\")\ntree[root].pre_order_search()\nprint(\"\")\nprint(\"Inorder\")\ntree[root].in_order_search()\nprint()\nprint(\"Postorder\")\ntree[root].post_order_search()\nprint()\n","code_v1_no_empty_lines":"class Node:\n def __init__(self, node_id, left, right):\n self.node_id = node_id\n self.left = left\n self.right = right\n\n def pre_order_search(self):\n l = self.left\n r = self.right\n print(\"\", self.node_id, end=\"\")\n if l != -1:\n tree[l].pre_order_search()\n if r != -1:\n tree[r].pre_order_search()\n\n def in_order_search(self):\n l = self.left\n r = self.right\n if l != -1:\n tree[l].in_order_search()\n print(\"\", self.node_id, end=\"\")\n if r != -1:\n tree[r].in_order_search()\n\n def post_order_search(self):\n l = self.left\n r = self.right\n if l != -1:\n tree[l].post_order_search()\n if r != -1:\n tree[r].post_order_search()\n print(\"\", self.node_id, end=\"\")\n\n\nn = int(input())\ntree = [None for i in range(n)]\nroot_set = set(range(n))\nfor i in range(n):\n node_id, left, right = map(int, input().split())\n tree[node_id] = Node(node_id, left, right)\n root_set -= set([left, right])\nroot = root_set.pop()\nprint(\"Preorder\")\ntree[root].pre_order_search()\nprint(\"\")\nprint(\"Inorder\")\ntree[root].in_order_search()\nprint(\"\")\nprint(\"Postorder\")\ntree[root].post_order_search()\nprint(\"\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print()","+print(\"\")","-print()","+print(\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.048556397,"measured_runtime_v1":0.046624372,"runtime_lift":1.0414380905,"key":["s576369895","s325509712"]} +{"user_id":"u606045429","problem_id":"p03253","language":"python","submission_id_v0":"s566976871","submission_id_v1":"s493648465","cpu_time_v0":21,"cpu_time_v1":19,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.52,"input":"N, M = [int(i) for i in input().split()]\n\n\n\ndef prime_decomposition(n):\n\n i = 2\n\n table = []\n\n while i * i <= n:\n\n while n % i == 0:\n\n n \/\/= i\n\n table.append(i)\n\n i += 1\n\n if n > 1:\n\n table.append(n)\n\n return table\n\n\n\ndef cmb(n, r):\n\n N, R = n, r\n\n for i in range(1, r):\n\n N *= n - i\n\n R *= r - i\n\n return N \/\/ R\n\n\n\nfrom collections import Counter\n\nA = Counter(prime_decomposition(M))\n\n\n\nmod = 10 ** 9 + 7\n\nresult = 1\n\nfor a in list(A.values()):\n\n result = result * cmb(a + N - 1, a) % mod\n\n\n\nprint(result)","target":"N, M = [int(i) for i in input().split()]\n\n\n\ndef prime_decomposition(n):\n\n table = []\n\n i = 2\n\n while i * i <= n:\n\n count = 0\n\n while n % i == 0:\n\n n \/\/= i\n\n count += 1\n\n if count != 0:\n\n table.append((i, count))\n\n i += 1\n\n if n > 1:\n\n table.append((n, 1))\n\n return table\n\n\n\ndef cmb(n, r):\n\n N, R = n, r\n\n for i in range(1, r):\n\n N *= n - i\n\n R *= r - i\n\n return N \/\/ R\n\n\n\nmod = 10 ** 9 + 7\n\nA = prime_decomposition(M)\n\nresult = 1\n\nfor _, a in A:\n\n result = result * cmb(a + N - 1, a) % mod\n\n\n\nprint(result)","code_v0_loc":30,"code_v1_loc":31,"code_v0_num_chars":550,"code_v1_num_chars":569,"code_v0_no_empty_lines":"N, M = [int(i) for i in input().split()]\n\n\ndef prime_decomposition(n):\n i = 2\n table = []\n while i * i <= n:\n while n % i == 0:\n n \/\/= i\n table.append(i)\n i += 1\n if n > 1:\n table.append(n)\n return table\n\n\ndef cmb(n, r):\n N, R = n, r\n for i in range(1, r):\n N *= n - i\n R *= r - i\n return N \/\/ R\n\n\nfrom collections import Counter\n\nA = Counter(prime_decomposition(M))\nmod = 10**9 + 7\nresult = 1\nfor a in list(A.values()):\n result = result * cmb(a + N - 1, a) % mod\nprint(result)\n","code_v1_no_empty_lines":"N, M = [int(i) for i in input().split()]\n\n\ndef prime_decomposition(n):\n table = []\n i = 2\n while i * i <= n:\n count = 0\n while n % i == 0:\n n \/\/= i\n count += 1\n if count != 0:\n table.append((i, count))\n i += 1\n if n > 1:\n table.append((n, 1))\n return table\n\n\ndef cmb(n, r):\n N, R = n, r\n for i in range(1, r):\n N *= n - i\n R *= r - i\n return N \/\/ R\n\n\nmod = 10**9 + 7\nA = prime_decomposition(M)\nresult = 1\nfor _, a in A:\n result = result * cmb(a + N - 1, a) % mod\nprint(result)\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["+ table = []","- table = []","+ count = 0","- table.append(i)","+ count += 1","+ if count != 0:","+ table.append((i, count))","- table.append(n)","+ table.append((n, 1))","-from collections import Counter","-","-A = Counter(prime_decomposition(M))","+A = prime_decomposition(M)","-for a in list(A.values()):","+for _, a in A:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0761662033,"measured_runtime_v1":0.0744855399,"runtime_lift":1.0225636189,"key":["s566976871","s493648465"]} +{"user_id":"u581187895","problem_id":"p02659","language":"python","submission_id_v0":"s174479984","submission_id_v1":"s121916046","cpu_time_v0":26,"cpu_time_v1":24,"memory_v0":9944,"memory_v1":9104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.69,"input":"import decimal\n\ndef resolve(): \n\n\n\n a, b = list(map(decimal.Decimal, input().split()))\n\n print((a * b \/\/ 1))\n\n \n\nif __name__ == \"__main__\":\n\n resolve()","target":"\n\ndef resolve():\n\n a, b = input().split()\n\n a = int(a)\n\n b = int(float(b) * 100 + .5)\n\n \n\n ans = a*b\n\n print((ans\/\/100))\n\nif __name__ == \"__main__\":\n\n resolve()","code_v0_loc":8,"code_v1_loc":10,"code_v0_num_chars":158,"code_v1_num_chars":179,"code_v0_no_empty_lines":"import decimal\n\n\ndef resolve():\n a, b = list(map(decimal.Decimal, input().split()))\n print((a * b \/\/ 1))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"def resolve():\n a, b = input().split()\n a = int(a)\n b = int(float(b) * 100 + 0.5)\n ans = a * b\n print((ans \/\/ 100))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import decimal","-","-","- a, b = list(map(decimal.Decimal, input().split()))","- print((a * b \/\/ 1))","+ a, b = input().split()","+ a = int(a)","+ b = int(float(b) * 100 + 0.5)","+ ans = a * b","+ print((ans \/\/ 100))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0436719213,"measured_runtime_v1":0.0418881288,"runtime_lift":1.0425846782,"key":["s174479984","s121916046"]} +{"user_id":"u048945791","problem_id":"p03339","language":"python","submission_id_v0":"s896338208","submission_id_v1":"s497663602","cpu_time_v0":208,"cpu_time_v1":168,"memory_v0":3676,"memory_v1":6044,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.23,"input":"N = int(eval(input()))\n\nS = eval(input())\n\n\n\nleftWest = 0\n\nrightEast = S.count(\"E\")\n\n\n\nans = 10 ** 6\n\nfor i in range(len(S)):\n\n if S[i] == \"E\":\n\n rightEast -= 1\n\n \n\n ans = min(ans, leftWest + rightEast)\n\n\n\n if S[i] == \"W\":\n\n leftWest += 1\n\n\n\nprint(ans)","target":"N = int(eval(input()))\n\nS = eval(input())\n\n\n\nleftWest = 0\n\nrightEast = list(S).count(\"E\")\n\n\n\nans = 10 ** 6\n\nfor si in S:\n\n if si == \"E\":\n\n rightEast -= 1\n\n \n\n ans = min(ans, leftWest + rightEast)\n\n\n\n if si == \"W\":\n\n leftWest += 1\n\n\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":17,"code_v0_num_chars":266,"code_v1_num_chars":257,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nleftWest = 0\nrightEast = S.count(\"E\")\nans = 10**6\nfor i in range(len(S)):\n if S[i] == \"E\":\n rightEast -= 1\n ans = min(ans, leftWest + rightEast)\n if S[i] == \"W\":\n leftWest += 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nleftWest = 0\nrightEast = list(S).count(\"E\")\nans = 10**6\nfor si in S:\n if si == \"E\":\n rightEast -= 1\n ans = min(ans, leftWest + rightEast)\n if si == \"W\":\n leftWest += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-rightEast = S.count(\"E\")","+rightEast = list(S).count(\"E\")","-for i in range(len(S)):","- if S[i] == \"E\":","+for si in S:","+ if si == \"E\":","- if S[i] == \"W\":","+ if si == \"W\":"],"diff_only_import_comment":false,"measured_runtime_v0":0.1219567299,"measured_runtime_v1":0.1210457325,"runtime_lift":1.0075260595,"key":["s896338208","s497663602"]} +{"user_id":"u314050667","problem_id":"p03102","language":"python","submission_id_v0":"s237215731","submission_id_v1":"s990029593","cpu_time_v0":149,"cpu_time_v1":18,"memory_v0":12504,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.92,"input":"import numpy as np\n\nn,m,c = list(map(int, input().split()))\n\ncond = list(map(int,input().split()))\n\nchar = []\n\nfor i in range(n):\n\n char.append(list(map(int, input().split())))\n\nnpcond = np.asarray(cond)\n\nnpchar = np.asarray(char)\n\n\n\nnpstat = npchar * npcond\n\nnpstat1 = np.sum(npstat, axis = 1) + c\n\n\n\nprint((np.count_nonzero(npstat1 > 0)))","target":"n, m, c=list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\na = []\n\nfor i in range(n):\n\n a.append(list(map(int, input().split())))\n\n\n\nab=0\n\nans=0\n\nfor i in range(n):\n\n for j in range(m):\n\n ab+=a[i][j]*b[j]\n\n if ab+c>0:\n\n ans+=1\n\n ab = 0\n\n else:\n\n ab = 0\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":17,"code_v0_num_chars":335,"code_v1_num_chars":318,"code_v0_no_empty_lines":"import numpy as np\n\nn, m, c = list(map(int, input().split()))\ncond = list(map(int, input().split()))\nchar = []\nfor i in range(n):\n char.append(list(map(int, input().split())))\nnpcond = np.asarray(cond)\nnpchar = np.asarray(char)\nnpstat = npchar * npcond\nnpstat1 = np.sum(npstat, axis=1) + c\nprint((np.count_nonzero(npstat1 > 0)))\n","code_v1_no_empty_lines":"n, m, c = list(map(int, input().split()))\nb = list(map(int, input().split()))\na = []\nfor i in range(n):\n a.append(list(map(int, input().split())))\nab = 0\nans = 0\nfor i in range(n):\n for j in range(m):\n ab += a[i][j] * b[j]\n if ab + c > 0:\n ans += 1\n ab = 0\n else:\n ab = 0\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":23.5294117647,"diff":["-import numpy as np","-","-cond = list(map(int, input().split()))","-char = []","+b = list(map(int, input().split()))","+a = []","- char.append(list(map(int, input().split())))","-npcond = np.asarray(cond)","-npchar = np.asarray(char)","-npstat = npchar * npcond","-npstat1 = np.sum(npstat, axis=1) + c","-print((np.count_nonzero(npstat1 > 0)))","+ a.append(list(map(int, input().split())))","+ab = 0","+ans = 0","+for i in range(n):","+ for j in range(m):","+ ab += a[i][j] * b[j]","+ if ab + c > 0:","+ ans += 1","+ ab = 0","+ else:","+ ab = 0","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1833765688,"measured_runtime_v1":0.0600419579,"runtime_lift":3.0541403931,"key":["s237215731","s990029593"]} +{"user_id":"u764215612","problem_id":"p02690","language":"python","submission_id_v0":"s867409267","submission_id_v1":"s621848889","cpu_time_v0":30,"cpu_time_v1":27,"memory_v0":9164,"memory_v1":9044,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"x=int(eval(input()))\n\nfor i in range(120):\n\n for j in range(-75,i):\n\n if i**5-j**5==x:print((i,j));exit()","target":"x=int(eval(input()))\n\nfor i in range(120):\n\n for j in range(-62,i):\n\n if i**5-j**5==x:print((i,j));exit()","code_v0_loc":4,"code_v1_loc":4,"code_v0_num_chars":98,"code_v1_num_chars":98,"code_v0_no_empty_lines":"x = int(eval(input()))\nfor i in range(120):\n for j in range(-75, i):\n if i**5 - j**5 == x:\n print((i, j))\n exit()\n","code_v1_no_empty_lines":"x = int(eval(input()))\nfor i in range(120):\n for j in range(-62, i):\n if i**5 - j**5 == x:\n print((i, j))\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for j in range(-75, i):","+ for j in range(-62, i):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0433275481,"measured_runtime_v1":0.0443172872,"runtime_lift":0.9776669744,"key":["s867409267","s621848889"]} +{"user_id":"u145231176","problem_id":"p02901","language":"python","submission_id_v0":"s366952505","submission_id_v1":"s308316632","cpu_time_v0":386,"cpu_time_v1":165,"memory_v0":66156,"memory_v1":84876,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.25,"input":"def getN():\n\n return int(eval(input()))\n\ndef getNM():\n\n return list(map(int, input().split()))\n\ndef getList():\n\n return list(map(int, input().split()))\n\ndef getArray(intn):\n\n return [int(eval(input())) for i in range(intn)]\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\ndef rand_N(ran1, ran2):\n\n return random.randint(ran1, ran2)\n\ndef rand_List(ran1, ran2, rantime):\n\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n\n ns = []\n\n while len(ns) < rantime:\n\n n = random.randint(ran1, ran2)\n\n if not n in ns:\n\n ns.append(n)\n\n return sorted(ns)\n\n\n\ndef rand_query(ran1, ran2, rantime):\n\n r_query = []\n\n while len(r_query) < rantime:\n\n n_q = rand_ints_nodup(ran1, ran2, 2)\n\n if not n_q in r_query:\n\n r_query.append(n_q)\n\n return sorted(r_query)\n\n\n\nfrom collections import defaultdict, deque, Counter\n\nfrom sys import exit\n\nfrom decimal import *\n\nimport heapq\n\nimport math\n\nfrom fractions import gcd\n\nimport random\n\nimport string\n\nimport copy\n\nfrom itertools import combinations, permutations, product\n\nfrom operator import mul\n\nfrom functools import reduce\n\nfrom bisect import bisect_left, bisect_right\n\n\n\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\nmod = 10 ** 9 + 7\n\n\n\n\n\n#############\n\n# Main Code #\n\n#############\n\n\n\nN, M = getNM()\n\ndp = [float(\"inf\")] * (1 << N)\n\ndp[0] = 0\n\n\n\n# 1 ~ N\u3092\u5168\u3066\u958b\u3051\u3089\u308c\u308b\u9375\u3092\u63c3\u3048\u308b\u30b3\u30b9\u30c8\u306e\u6700\u5c0f\u5024\u304cO(M * 2 ** N)\u3067\u308f\u304b\u308b\n\n# \u5404\u9375\u306b\u3064\u3044\u3066\n\nfor i in range(M):\n\n a, b = getNM()\n\n c = getList()\n\n bit = 0\n\n # \u305d\u306e\u9375\u3067\u958b\u3051\u3089\u308c\u308b\u90e8\u5c4b\u3092\u63c3\u3048\u308b\n\n for item in c:\n\n bit |= (1 << (item - 1))\n\n # \u90e8\u5c4b\u306e\u5404\u72b6\u614b\u306b\u3064\u3044\u3066\n\n # \u305d\u3053\u304b\u3089\u3055\u3089\u306b\u9375c\u3092\u53d6\u5f97\u3057\u305f\u5834\u5408\u3068\u4ed6\u306e\u9375\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\u3068\u3067\u6bd4\u8f03\u3059\u308b\n\n for j in range(1 << N):\n\n dp[j | bit] = min(dp[j | bit], dp[j] + a)\n\n\n\nif dp[(1 << N) - 1] == float(\"inf\"):\n\n print((-1))\n\nelse:\n\n print((dp[(1 << N) - 1]))","target":"def getN():\n\n return int(eval(input()))\n\ndef getNM():\n\n return list(map(int, input().split()))\n\ndef getList():\n\n return list(map(int, input().split()))\n\ndef getArray(intn):\n\n return [int(eval(input())) for i in range(intn)]\n\ndef input():\n\n return sys.stdin.readline().rstrip()\n\ndef rand_N(ran1, ran2):\n\n return random.randint(ran1, ran2)\n\ndef rand_List(ran1, ran2, rantime):\n\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n\n ns = []\n\n while len(ns) < rantime:\n\n n = random.randint(ran1, ran2)\n\n if not n in ns:\n\n ns.append(n)\n\n return sorted(ns)\n\n\n\ndef rand_query(ran1, ran2, rantime):\n\n r_query = []\n\n while len(r_query) < rantime:\n\n n_q = rand_ints_nodup(ran1, ran2, 2)\n\n if not n_q in r_query:\n\n r_query.append(n_q)\n\n return sorted(r_query)\n\n\n\nfrom collections import defaultdict, deque, Counter\n\nfrom sys import exit\n\nfrom decimal import *\n\nimport heapq\n\nimport math\n\nfrom fractions import gcd\n\nimport random\n\nimport string\n\nimport copy\n\nfrom itertools import combinations, permutations, product\n\nfrom operator import mul\n\nfrom functools import reduce\n\nfrom bisect import bisect_left, bisect_right\n\n\n\nimport sys\n\nsys.setrecursionlimit(1000000000)\n\nmod = 10 ** 9 + 7\n\n\n\n\n\n#############\n\n# Main Code #\n\n#############\n\n\n\nN, M = getNM()\n\nweight = []\n\nvalue = []\n\nfor i in range(M):\n\n a, b = getNM()\n\n c = getList()\n\n weight.append(a)\n\n value.append(c)\n\n\"\"\"\n\nN, M = 4, 6\n\nweight = [67786, 3497, 44908, 2156, 26230, 86918]\n\nvalue = [[1, 3, 4], [2], [2, 3, 4], [2, 3, 4], [2], [3]]\n\n\"\"\"\n\n\n\n# N\u500b\u306e\u3082\u306e\u3092\u5168\u3066\u624b\u306b\u5165\u308c\u308b\u306e\u306b\u5fc5\u8981\u306a\u30b3\u30b9\u30c8\u306e\u6700\u5c0f\u5024\n\n# \u30b3\u30b9\u30c8\u30921\u306b\u3059\u308c\u3070\u6700\u5c0f\u500b\u6570\u304c\u308f\u304b\u308b\n\n# N\u306e\u6570\u304c\u5341\u5206\u306b\u5c0f\u3055\u3044\u3068\u4f7f\u7528\u53ef\u80fd\n\ndef get_everything(n, weight, value):\n\n m = len(weight)\n\n dp = [float(\"inf\")] * (1 << n)\n\n dp[0] = 0\n\n\n\n for i in range(m):\n\n bit = 0\n\n for item in value[i]:\n\n bit |= (1 << (item - 1))\n\n\n\n for j in range(1 << n):\n\n dp[j | bit] = min(dp[j | bit], dp[j] + weight[i])\n\n\n\n return dp[(1 << N) - 1]\n\n\n\nans = get_everything(N, weight, value)\n\nif ans == float(\"inf\"):\n\n print((-1))\n\nelse:\n\n print(ans)","code_v0_loc":75,"code_v1_loc":90,"code_v0_num_chars":1805,"code_v1_num_chars":2111,"code_v0_no_empty_lines":"def getN():\n return int(eval(input()))\n\n\ndef getNM():\n return list(map(int, input().split()))\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\ndef getArray(intn):\n return [int(eval(input())) for i in range(intn)]\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef rand_N(ran1, ran2):\n return random.randint(ran1, ran2)\n\n\ndef rand_List(ran1, ran2, rantime):\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n ns = []\n while len(ns) < rantime:\n n = random.randint(ran1, ran2)\n if not n in ns:\n ns.append(n)\n return sorted(ns)\n\n\ndef rand_query(ran1, ran2, rantime):\n r_query = []\n while len(r_query) < rantime:\n n_q = rand_ints_nodup(ran1, ran2, 2)\n if not n_q in r_query:\n r_query.append(n_q)\n return sorted(r_query)\n\n\nfrom collections import defaultdict, deque, Counter\nfrom sys import exit\nfrom decimal import *\nimport heapq\nimport math\nfrom fractions import gcd\nimport random\nimport string\nimport copy\nfrom itertools import combinations, permutations, product\nfrom operator import mul\nfrom functools import reduce\nfrom bisect import bisect_left, bisect_right\nimport sys\n\nsys.setrecursionlimit(1000000000)\nmod = 10**9 + 7\n#############\n# Main Code #\n#############\nN, M = getNM()\ndp = [float(\"inf\")] * (1 << N)\ndp[0] = 0\n# 1 ~ N\u3092\u5168\u3066\u958b\u3051\u3089\u308c\u308b\u9375\u3092\u63c3\u3048\u308b\u30b3\u30b9\u30c8\u306e\u6700\u5c0f\u5024\u304cO(M * 2 ** N)\u3067\u308f\u304b\u308b\n# \u5404\u9375\u306b\u3064\u3044\u3066\nfor i in range(M):\n a, b = getNM()\n c = getList()\n bit = 0\n # \u305d\u306e\u9375\u3067\u958b\u3051\u3089\u308c\u308b\u90e8\u5c4b\u3092\u63c3\u3048\u308b\n for item in c:\n bit |= 1 << (item - 1)\n # \u90e8\u5c4b\u306e\u5404\u72b6\u614b\u306b\u3064\u3044\u3066\n # \u305d\u3053\u304b\u3089\u3055\u3089\u306b\u9375c\u3092\u53d6\u5f97\u3057\u305f\u5834\u5408\u3068\u4ed6\u306e\u9375\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\u3068\u3067\u6bd4\u8f03\u3059\u308b\n for j in range(1 << N):\n dp[j | bit] = min(dp[j | bit], dp[j] + a)\nif dp[(1 << N) - 1] == float(\"inf\"):\n print((-1))\nelse:\n print((dp[(1 << N) - 1]))\n","code_v1_no_empty_lines":"def getN():\n return int(eval(input()))\n\n\ndef getNM():\n return list(map(int, input().split()))\n\n\ndef getList():\n return list(map(int, input().split()))\n\n\ndef getArray(intn):\n return [int(eval(input())) for i in range(intn)]\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef rand_N(ran1, ran2):\n return random.randint(ran1, ran2)\n\n\ndef rand_List(ran1, ran2, rantime):\n return [random.randint(ran1, ran2) for i in range(rantime)]\n\n\ndef rand_ints_nodup(ran1, ran2, rantime):\n ns = []\n while len(ns) < rantime:\n n = random.randint(ran1, ran2)\n if not n in ns:\n ns.append(n)\n return sorted(ns)\n\n\ndef rand_query(ran1, ran2, rantime):\n r_query = []\n while len(r_query) < rantime:\n n_q = rand_ints_nodup(ran1, ran2, 2)\n if not n_q in r_query:\n r_query.append(n_q)\n return sorted(r_query)\n\n\nfrom collections import defaultdict, deque, Counter\nfrom sys import exit\nfrom decimal import *\nimport heapq\nimport math\nfrom fractions import gcd\nimport random\nimport string\nimport copy\nfrom itertools import combinations, permutations, product\nfrom operator import mul\nfrom functools import reduce\nfrom bisect import bisect_left, bisect_right\nimport sys\n\nsys.setrecursionlimit(1000000000)\nmod = 10**9 + 7\n#############\n# Main Code #\n#############\nN, M = getNM()\nweight = []\nvalue = []\nfor i in range(M):\n a, b = getNM()\n c = getList()\n weight.append(a)\n value.append(c)\n\"\"\"\nN, M = 4, 6\nweight = [67786, 3497, 44908, 2156, 26230, 86918]\nvalue = [[1, 3, 4], [2], [2, 3, 4], [2, 3, 4], [2], [3]]\n\"\"\"\n# N\u500b\u306e\u3082\u306e\u3092\u5168\u3066\u624b\u306b\u5165\u308c\u308b\u306e\u306b\u5fc5\u8981\u306a\u30b3\u30b9\u30c8\u306e\u6700\u5c0f\u5024\n# \u30b3\u30b9\u30c8\u30921\u306b\u3059\u308c\u3070\u6700\u5c0f\u500b\u6570\u304c\u308f\u304b\u308b\n# N\u306e\u6570\u304c\u5341\u5206\u306b\u5c0f\u3055\u3044\u3068\u4f7f\u7528\u53ef\u80fd\ndef get_everything(n, weight, value):\n m = len(weight)\n dp = [float(\"inf\")] * (1 << n)\n dp[0] = 0\n for i in range(m):\n bit = 0\n for item in value[i]:\n bit |= 1 << (item - 1)\n for j in range(1 << n):\n dp[j | bit] = min(dp[j | bit], dp[j] + weight[i])\n return dp[(1 << N) - 1]\n\n\nans = get_everything(N, weight, value)\nif ans == float(\"inf\"):\n print((-1))\nelse:\n print(ans)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-dp = [float(\"inf\")] * (1 << N)","-dp[0] = 0","-# 1 ~ N\u3092\u5168\u3066\u958b\u3051\u3089\u308c\u308b\u9375\u3092\u63c3\u3048\u308b\u30b3\u30b9\u30c8\u306e\u6700\u5c0f\u5024\u304cO(M * 2 ** N)\u3067\u308f\u304b\u308b","-# \u5404\u9375\u306b\u3064\u3044\u3066","+weight = []","+value = []","- bit = 0","- # \u305d\u306e\u9375\u3067\u958b\u3051\u3089\u308c\u308b\u90e8\u5c4b\u3092\u63c3\u3048\u308b","- for item in c:","- bit |= 1 << (item - 1)","- # \u90e8\u5c4b\u306e\u5404\u72b6\u614b\u306b\u3064\u3044\u3066","- # \u305d\u3053\u304b\u3089\u3055\u3089\u306b\u9375c\u3092\u53d6\u5f97\u3057\u305f\u5834\u5408\u3068\u4ed6\u306e\u9375\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\u3068\u3067\u6bd4\u8f03\u3059\u308b","- for j in range(1 << N):","- dp[j | bit] = min(dp[j | bit], dp[j] + a)","-if dp[(1 << N) - 1] == float(\"inf\"):","+ weight.append(a)","+ value.append(c)","+\"\"\"","+N, M = 4, 6","+weight = [67786, 3497, 44908, 2156, 26230, 86918]","+value = [[1, 3, 4], [2], [2, 3, 4], [2, 3, 4], [2], [3]]","+\"\"\"","+# N\u500b\u306e\u3082\u306e\u3092\u5168\u3066\u624b\u306b\u5165\u308c\u308b\u306e\u306b\u5fc5\u8981\u306a\u30b3\u30b9\u30c8\u306e\u6700\u5c0f\u5024","+# \u30b3\u30b9\u30c8\u30921\u306b\u3059\u308c\u3070\u6700\u5c0f\u500b\u6570\u304c\u308f\u304b\u308b","+# N\u306e\u6570\u304c\u5341\u5206\u306b\u5c0f\u3055\u3044\u3068\u4f7f\u7528\u53ef\u80fd","+def get_everything(n, weight, value):","+ m = len(weight)","+ dp = [float(\"inf\")] * (1 << n)","+ dp[0] = 0","+ for i in range(m):","+ bit = 0","+ for item in value[i]:","+ bit |= 1 << (item - 1)","+ for j in range(1 << n):","+ dp[j | bit] = min(dp[j | bit], dp[j] + weight[i])","+ return dp[(1 << N) - 1]","+","+","+ans = get_everything(N, weight, value)","+if ans == float(\"inf\"):","- print((dp[(1 << N) - 1]))","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1255671096,"measured_runtime_v1":0.0414928641,"runtime_lift":3.02623384,"key":["s366952505","s308316632"]} +{"user_id":"u631277801","problem_id":"p03351","language":"python","submission_id_v0":"s053898299","submission_id_v1":"s833374444","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"def main():\n\n # 1.input\n\n a,b,c,d = list(map(int, input().split()))\n\n \n\n \n\n #2. judge\n\n if abs(a-c) <= d:\n\n print(\"Yes\")\n\n elif abs(a-b) <= d and abs(b-c) <= d:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"a,b,c,d = list(map(int, input().split()))\n\n\n\nif abs(c-a)<=d or (abs(b-a)<=d and abs(c-b)<=d):\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":16,"code_v1_loc":6,"code_v0_num_chars":280,"code_v1_num_chars":129,"code_v0_no_empty_lines":"def main():\n # 1.input\n a, b, c, d = list(map(int, input().split()))\n # 2. judge\n if abs(a - c) <= d:\n print(\"Yes\")\n elif abs(a - b) <= d and abs(b - c) <= d:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"a, b, c, d = list(map(int, input().split()))\nif abs(c - a) <= d or (abs(b - a) <= d and abs(c - b) <= d):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-def main():","- # 1.input","- a, b, c, d = list(map(int, input().split()))","- # 2. judge","- if abs(a - c) <= d:","- print(\"Yes\")","- elif abs(a - b) <= d and abs(b - c) <= d:","- print(\"Yes\")","- else:","- print(\"No\")","-","-","-if __name__ == \"__main__\":","- main()","+a, b, c, d = list(map(int, input().split()))","+if abs(c - a) <= d or (abs(b - a) <= d and abs(c - b) <= d):","+ print(\"Yes\")","+else:","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0365931132,"measured_runtime_v1":0.0350500164,"runtime_lift":1.0440255649,"key":["s053898299","s833374444"]} +{"user_id":"u638282348","problem_id":"p02787","language":"python","submission_id_v0":"s632026996","submission_id_v1":"s153264617","cpu_time_v0":664,"cpu_time_v1":411,"memory_v0":12500,"memory_v1":12512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.1,"input":"import numpy as np\n\nH, N = list(map(int, input().split()))\n\nATK, MP = np.array(tuple(tuple(map(int, input().split())) for _ in range(N)), dtype=np.int64).T\n\nMAX_ATK = ATK.max()\n\ntable = np.zeros((H + MAX_ATK,), dtype=np.int64)\n\nfor damage in range(1, H + 1):\n\n table[damage] = (table[damage - ATK[np.arange(N, dtype=np.int16)]] + MP[np.arange(N, dtype=np.int16)]).min()\n\nprint((table[H]))\n","target":"import numpy as np\n\nH, N = list(map(int, input().split()))\n\nATK, MP = np.array(tuple(tuple(map(int, input().split())) for _ in range(N)), dtype=np.int64).T\n\nMAX_ATK = ATK.max()\n\ntable = np.zeros((H + MAX_ATK,), dtype=np.int64)\n\nfor damage in range(1, H + 1):\n\n table[damage] = (table[damage - ATK] + MP).min()\n\nprint((table[H]))\n","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":384,"code_v1_num_chars":324,"code_v0_no_empty_lines":"import numpy as np\n\nH, N = list(map(int, input().split()))\nATK, MP = np.array(\n tuple(tuple(map(int, input().split())) for _ in range(N)), dtype=np.int64\n).T\nMAX_ATK = ATK.max()\ntable = np.zeros((H + MAX_ATK,), dtype=np.int64)\nfor damage in range(1, H + 1):\n table[damage] = (\n table[damage - ATK[np.arange(N, dtype=np.int16)]]\n + MP[np.arange(N, dtype=np.int16)]\n ).min()\nprint((table[H]))\n","code_v1_no_empty_lines":"import numpy as np\n\nH, N = list(map(int, input().split()))\nATK, MP = np.array(\n tuple(tuple(map(int, input().split())) for _ in range(N)), dtype=np.int64\n).T\nMAX_ATK = ATK.max()\ntable = np.zeros((H + MAX_ATK,), dtype=np.int64)\nfor damage in range(1, H + 1):\n table[damage] = (table[damage - ATK] + MP).min()\nprint((table[H]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- table[damage] = (","- table[damage - ATK[np.arange(N, dtype=np.int16)]]","- + MP[np.arange(N, dtype=np.int16)]","- ).min()","+ table[damage] = (table[damage - ATK] + MP).min()"],"diff_only_import_comment":false,"measured_runtime_v0":0.309320523,"measured_runtime_v1":0.95827946,"runtime_lift":0.3227873871,"key":["s632026996","s153264617"]} +{"user_id":"u083960235","problem_id":"p02861","language":"python","submission_id_v0":"s756107853","submission_id_v1":"s549577450","cpu_time_v0":464,"cpu_time_v1":38,"memory_v0":10436,"memory_v1":5200,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.81,"input":"import sys, re, os\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import permutations, combinations, product, accumulate\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom fractions import gcd\n\n \n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef S_MAP(): return list(map(str, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef S_LIST(): return list(map(str, input().split()))\n\nimport itertools\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\ndef dist(x1, x2, y1, y2):\n\n d = sqrt((x1-x2)**2 + (y1-y2)**2)\n\n return d\n\n\n\n\n\nN = INT()\n\nb = []\n\nfor i in range(N):\n\n a = LIST()\n\n b.append(a)\n\n# print(b)\n\n\n\njun = [i for i in range(N)]\n\nc = list(itertools.permutations(jun))\n\n# print(c)\n\n\n\nans2 = 0\n\nfor j in c:\n\n # tuple\n\n ans = 0\n\n # print(j)\n\n for i in range(len(j)-1):\n\n # print(j[i])\n\n # print(j[i+1])\n\n x1 = b[j[i]][0]\n\n x2 = b[j[i+1]][0]\n\n y1 = b[j[i]][1]\n\n y2 = b[j[i+1]][1]\n\n ans += dist(x1, x2, y1, y2)\n\n # print(ans)\n\n # print(ans)\n\n ans2 += ans\n\n # print(ans2)\n\n # print(dist(x1, x2, y1, y2))\n\nprint((ans2\/len(c)))\n","target":"# \u306a\u305c\u304b\u3046\u307e\u304f\u3044\u304b\u306a\u3044\n\nimport sys, re, os\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import permutations, combinations, product, accumulate\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom fractions import gcd\n\nfrom bisect import bisect, bisect_right, bisect_left\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef S_MAP(): return list(map(str, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef S_LIST(): return list(map(str, input().split()))\n\n \n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nN = INT()\n\nL = [LIST() for i in range(N)]\n\n\n\n# print(list(combinatins(L, 2)))\n\nA = [n for n in range(N)]\n\nans = 0\n\nfor i in list(combinations(A, 2)):\n\n l, r = i\n\n a, b = L[r], L[l]\n\n c = (a[0] - b[0]) ** 2\n\n d = (a[1] - b[1]) ** 2\n\n ans += sqrt(c + d)\n\n\n\nprint((ans\/ N * 2))","code_v0_loc":55,"code_v1_loc":36,"code_v0_num_chars":1354,"code_v1_num_chars":1080,"code_v0_no_empty_lines":"import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef S_MAP():\n return list(map(str, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef S_LIST():\n return list(map(str, input().split()))\n\n\nimport itertools\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef dist(x1, x2, y1, y2):\n d = sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)\n return d\n\n\nN = INT()\nb = []\nfor i in range(N):\n a = LIST()\n b.append(a)\n# print(b)\njun = [i for i in range(N)]\nc = list(itertools.permutations(jun))\n# print(c)\nans2 = 0\nfor j in c:\n # tuple\n ans = 0\n # print(j)\n for i in range(len(j) - 1):\n # print(j[i])\n # print(j[i+1])\n x1 = b[j[i]][0]\n x2 = b[j[i + 1]][0]\n y1 = b[j[i]][1]\n y2 = b[j[i + 1]][1]\n ans += dist(x1, x2, y1, y2)\n # print(ans)\n # print(ans)\n ans2 += ans\n # print(ans2)\n # print(dist(x1, x2, y1, y2))\nprint((ans2 \/ len(c)))\n","code_v1_no_empty_lines":"# \u306a\u305c\u304b\u3046\u307e\u304f\u3044\u304b\u306a\u3044\nimport sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\nfrom bisect import bisect, bisect_right, bisect_left\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef S_MAP():\n return list(map(str, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef S_LIST():\n return list(map(str, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nN = INT()\nL = [LIST() for i in range(N)]\n# print(list(combinatins(L, 2)))\nA = [n for n in range(N)]\nans = 0\nfor i in list(combinations(A, 2)):\n l, r = i\n a, b = L[r], L[l]\n c = (a[0] - b[0]) ** 2\n d = (a[1] - b[1]) ** 2\n ans += sqrt(c + d)\nprint((ans \/ N * 2))\n","code_same":false,"relative_loc_diff_percent":34.5454545455,"diff":["+# \u306a\u305c\u304b\u3046\u307e\u304f\u3044\u304b\u306a\u3044","+from bisect import bisect, bisect_right, bisect_left","-import itertools","-","-","-","-def dist(x1, x2, y1, y2):","- d = sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)","- return d","-","-","-b = []","-for i in range(N):","- a = LIST()","- b.append(a)","-# print(b)","-jun = [i for i in range(N)]","-c = list(itertools.permutations(jun))","-# print(c)","-ans2 = 0","-for j in c:","- # tuple","- ans = 0","- # print(j)","- for i in range(len(j) - 1):","- # print(j[i])","- # print(j[i+1])","- x1 = b[j[i]][0]","- x2 = b[j[i + 1]][0]","- y1 = b[j[i]][1]","- y2 = b[j[i + 1]][1]","- ans += dist(x1, x2, y1, y2)","- # print(ans)","- # print(ans)","- ans2 += ans","- # print(ans2)","- # print(dist(x1, x2, y1, y2))","-print((ans2 \/ len(c)))","+L = [LIST() for i in range(N)]","+# print(list(combinatins(L, 2)))","+A = [n for n in range(N)]","+ans = 0","+for i in list(combinations(A, 2)):","+ l, r = i","+ a, b = L[r], L[l]","+ c = (a[0] - b[0]) ** 2","+ d = (a[1] - b[1]) ** 2","+ ans += sqrt(c + d)","+print((ans \/ N * 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.08687253,"measured_runtime_v1":0.0586209774,"runtime_lift":1.481935884,"key":["s756107853","s549577450"]} +{"user_id":"u098012509","problem_id":"p02925","language":"python","submission_id_v0":"s500073926","submission_id_v1":"s204388430","cpu_time_v0":992,"cpu_time_v1":879,"memory_v0":36180,"memory_v1":51020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.39,"input":"import sys\n\nimport collections\n\nimport copy\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = [collections.deque([int(x) for x in input().split()]) for _ in range(N)]\n\n\n\n day = 0\n\n c = 0\n\n nxt = [x for x in range(N)]\n\n oppo = [0] * N\n\n\n\n while c != N * (N - 1):\n\n day += 1\n\n\n\n for i in nxt:\n\n oppo[i] = A[i].popleft() if A[i] else -1\n\n\n\n tmp = set()\n\n for i in nxt:\n\n if i == -1 or i in tmp:\n\n continue\n\n if i == oppo[oppo[i] - 1] - 1:\n\n tmp.add(i)\n\n tmp.add(oppo[i] - 1)\n\n c += 2\n\n if not tmp:\n\n print((-1))\n\n return\n\n\n\n nxt = tmp\n\n\n\n print(day)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nimport collections\n\nfrom collections import defaultdict\n\n\n\nsys.setrecursionlimit(10 ** 8)\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = [[int(x) for x in input().split()] for _ in range(N)]\n\n\n\n q = [collections.deque() for j in range(N)]\n\n\n\n for i, a in enumerate(A):\n\n for aa in a:\n\n q[i].append(aa)\n\n\n\n ans = 0\n\n\n\n current = defaultdict(int)\n\n for i, v in enumerate(q):\n\n current[i + 1] = v[0]\n\n\n\n while True:\n\n v = set()\n\n for k in list(current.keys()):\n\n if k == q[current[k] - 1][0]:\n\n v.add(k)\n\n v.add(current[k])\n\n\n\n current = defaultdict(int)\n\n\n\n if len(v) == 0:\n\n break\n\n\n\n for vv in v:\n\n q[vv - 1].popleft()\n\n if len(q[vv - 1]):\n\n current[vv] = q[vv - 1][0]\n\n\n\n ans += 1\n\n\n\n # \u5168\u3066\u7a7a\u306a\u3089\n\n size = 0\n\n for i in range(N):\n\n size += len(q[i])\n\n\n\n if size == 0:\n\n print(ans)\n\n else:\n\n print((-1))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":41,"code_v1_loc":57,"code_v0_num_chars":792,"code_v1_num_chars":1088,"code_v0_no_empty_lines":"import sys\nimport collections\nimport copy\n\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(eval(input()))\n A = [collections.deque([int(x) for x in input().split()]) for _ in range(N)]\n day = 0\n c = 0\n nxt = [x for x in range(N)]\n oppo = [0] * N\n while c != N * (N - 1):\n day += 1\n for i in nxt:\n oppo[i] = A[i].popleft() if A[i] else -1\n tmp = set()\n for i in nxt:\n if i == -1 or i in tmp:\n continue\n if i == oppo[oppo[i] - 1] - 1:\n tmp.add(i)\n tmp.add(oppo[i] - 1)\n c += 2\n if not tmp:\n print((-1))\n return\n nxt = tmp\n print(day)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport collections\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**8)\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(eval(input()))\n A = [[int(x) for x in input().split()] for _ in range(N)]\n q = [collections.deque() for j in range(N)]\n for i, a in enumerate(A):\n for aa in a:\n q[i].append(aa)\n ans = 0\n current = defaultdict(int)\n for i, v in enumerate(q):\n current[i + 1] = v[0]\n while True:\n v = set()\n for k in list(current.keys()):\n if k == q[current[k] - 1][0]:\n v.add(k)\n v.add(current[k])\n current = defaultdict(int)\n if len(v) == 0:\n break\n for vv in v:\n q[vv - 1].popleft()\n if len(q[vv - 1]):\n current[vv] = q[vv - 1][0]\n ans += 1\n # \u5168\u3066\u7a7a\u306a\u3089\n size = 0\n for i in range(N):\n size += len(q[i])\n if size == 0:\n print(ans)\n else:\n print((-1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":28.0701754386,"diff":["-import copy","+from collections import defaultdict","+sys.setrecursionlimit(10**8)","- A = [collections.deque([int(x) for x in input().split()]) for _ in range(N)]","- day = 0","- c = 0","- nxt = [x for x in range(N)]","- oppo = [0] * N","- while c != N * (N - 1):","- day += 1","- for i in nxt:","- oppo[i] = A[i].popleft() if A[i] else -1","- tmp = set()","- for i in nxt:","- if i == -1 or i in tmp:","- continue","- if i == oppo[oppo[i] - 1] - 1:","- tmp.add(i)","- tmp.add(oppo[i] - 1)","- c += 2","- if not tmp:","- print((-1))","- return","- nxt = tmp","- print(day)","+ A = [[int(x) for x in input().split()] for _ in range(N)]","+ q = [collections.deque() for j in range(N)]","+ for i, a in enumerate(A):","+ for aa in a:","+ q[i].append(aa)","+ ans = 0","+ current = defaultdict(int)","+ for i, v in enumerate(q):","+ current[i + 1] = v[0]","+ while True:","+ v = set()","+ for k in list(current.keys()):","+ if k == q[current[k] - 1][0]:","+ v.add(k)","+ v.add(current[k])","+ current = defaultdict(int)","+ if len(v) == 0:","+ break","+ for vv in v:","+ q[vv - 1].popleft()","+ if len(q[vv - 1]):","+ current[vv] = q[vv - 1][0]","+ ans += 1","+ # \u5168\u3066\u7a7a\u306a\u3089","+ size = 0","+ for i in range(N):","+ size += len(q[i])","+ if size == 0:","+ print(ans)","+ else:","+ print((-1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0754174955,"measured_runtime_v1":0.0401374502,"runtime_lift":1.878980729,"key":["s500073926","s204388430"]} +{"user_id":"u922901775","problem_id":"p03161","language":"python","submission_id_v0":"s495396032","submission_id_v1":"s741225924","cpu_time_v0":1999,"cpu_time_v1":1824,"memory_v0":22812,"memory_v1":22836,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.75,"input":"# -*- coding: utf-8 -*-\n\n\n\nimport numpy as np\n\n\n\nN, K = list(map(int, input().split()))\n\n \n\nh = np.array(list(map(int, input().split())))\n\n \n\ndp = np.zeros(N)\n\n \n\nfor n in range(1, N):\n\n k = min(K, n)\n\n temp = np.min(dp[n-k:n] + np.abs(h[n]-h[n-k:n]))\n\n dp[n] = temp\n\nprint((int(dp[-1])))","target":"# -*- coding: utf-8 -*-\n\n \n\nimport numpy as np\n\n \n\nN, K = list(map(int, input().split()))\n\n \n\nh = np.array(list(map(int, input().split())))\n\n \n\ndp = np.zeros(N, dtype=np.int)\n\n \n\nfor n in range(1, N):\n\n k = min(K, n)\n\n temp = np.min(dp[n-k:n] + np.abs(h[n]-h[n-k:n]))\n\n dp[n] = temp\n\nprint((dp[-1]))","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":289,"code_v1_num_chars":300,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport numpy as np\n\nN, K = list(map(int, input().split()))\nh = np.array(list(map(int, input().split())))\ndp = np.zeros(N)\nfor n in range(1, N):\n k = min(K, n)\n temp = np.min(dp[n - k : n] + np.abs(h[n] - h[n - k : n]))\n dp[n] = temp\nprint((int(dp[-1])))\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport numpy as np\n\nN, K = list(map(int, input().split()))\nh = np.array(list(map(int, input().split())))\ndp = np.zeros(N, dtype=np.int)\nfor n in range(1, N):\n k = min(K, n)\n temp = np.min(dp[n - k : n] + np.abs(h[n] - h[n - k : n]))\n dp[n] = temp\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-dp = np.zeros(N)","+dp = np.zeros(N, dtype=np.int)","-print((int(dp[-1])))","+print((dp[-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.6662038772,"measured_runtime_v1":0.6829017289,"runtime_lift":0.9755486757,"key":["s495396032","s741225924"]} +{"user_id":"u644972721","problem_id":"p03298","language":"python","submission_id_v0":"s225225947","submission_id_v1":"s605168875","cpu_time_v0":866,"cpu_time_v1":490,"memory_v0":163080,"memory_v1":163104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.42,"input":"def f(i, k):\n\n if i == n and k == 0:\n\n global d\n\n hr1, hb1 = 0, 0\n\n hr2, hb2 = 0, 0\n\n cntr, cntb = 0, 0\n\n for j in range(n):\n\n if c[j]:\n\n hr1 += x[j] * pow(b1, cntr, mod)\n\n hr2 += x[j] * pow(b2, cntr, mod)\n\n hr1 %= mod\n\n hr2 %= mod\n\n cntr += 1\n\n else:\n\n hb1 += x[j] * pow(b1, cntb, mod)\n\n hb2 += x[j] * pow(b2, cntb, mod)\n\n hb1 %= mod\n\n hb2 %= mod\n\n cntb += 1\n\n if min(cntr, cntb) == 0:\n\n return\n\n if (hr1, hr2, hb1, hb2) in d:\n\n d[(hr1, hr2, hb1, hb2)] += 1\n\n else:\n\n d[(hr1, hr2, hb1, hb2)] = 1\n\n return\n\n elif i == n and k == 1:\n\n hr1, hb1 = 0, 0\n\n hr2, hb2 = 0, 0\n\n cntr, cntb = 0, 0\n\n for j in range(n):\n\n if c[j]:\n\n hr1 += y[j] * powb1[cntr]\n\n hr2 += y[j] * powb2[cntr]\n\n hr1 %= mod\n\n hr2 %= mod\n\n cntr += 1\n\n else:\n\n hb1 += y[j] * powb1[cntb]\n\n hb2 += y[j] * powb2[cntb]\n\n hb1 %= mod\n\n hb2 %= mod\n\n cntb += 1\n\n if min(cntr, cntb) == 0:\n\n return\n\n if (hr1, hr2, hb1, hb2) in d:\n\n global ans\n\n ans += d[(hr1, hr2, hb1, hb2)]\n\n return\n\n c[i] = 1\n\n f(i + 1, k)\n\n c[i] = 0\n\n f(i + 1, k)\n\n\n\n\n\nn = int(eval(input()))\n\ns = list(eval(input()))\n\nmod = pow(2, 31) - 1\n\nb1, b2 = 27, 31\n\npowb1 = [pow(27, i, mod) for i in range(n)]\n\npowb2 = [pow(31, i, mod) for i in range(n)]\n\nd = {}\n\nx, y = [], []\n\nfor i in range(n):\n\n x.append(ord(s[i]) - 96)\n\n y.append(ord(s[-(i + 1)]) - 96)\n\nans = 0 if not x == y else 2\n\nc = [0] * n\n\nf(0, 0)\n\nc = [0] * n\n\nf(0, 1)\n\nprint(ans)","target":"def f(i, k):\n\n if i == n and k == 0:\n\n global d\n\n hr1, hb1 = 0, 0\n\n hr2, hb2 = 0, 0\n\n cntr, cntb = 0, 0\n\n for j in range(n):\n\n if c[j]:\n\n hr1 += x[j] * powb1[cntr]\n\n hr2 += x[j] * powb2[cntr]\n\n hr1 %= mod\n\n hr2 %= mod\n\n cntr += 1\n\n else:\n\n hb1 += x[j] * powb1[cntb]\n\n hb2 += x[j] * powb2[cntb]\n\n hb1 %= mod\n\n hb2 %= mod\n\n cntb += 1\n\n if min(cntr, cntb) == 0:\n\n return\n\n if (hr1, hr2, hb1, hb2) in d:\n\n d[(hr1, hr2, hb1, hb2)] += 1\n\n else:\n\n d[(hr1, hr2, hb1, hb2)] = 1\n\n return\n\n elif i == n and k == 1:\n\n hr1, hb1 = 0, 0\n\n hr2, hb2 = 0, 0\n\n cntr, cntb = 0, 0\n\n for j in range(n):\n\n if c[j]:\n\n hr1 += y[j] * powb1[cntr]\n\n hr2 += y[j] * powb2[cntr]\n\n hr1 %= mod\n\n hr2 %= mod\n\n cntr += 1\n\n else:\n\n hb1 += y[j] * powb1[cntb]\n\n hb2 += y[j] * powb2[cntb]\n\n hb1 %= mod\n\n hb2 %= mod\n\n cntb += 1\n\n if min(cntr, cntb) == 0:\n\n return\n\n if (hr1, hr2, hb1, hb2) in d:\n\n global ans\n\n ans += d[(hr1, hr2, hb1, hb2)]\n\n return\n\n c[i] = 1\n\n f(i + 1, k)\n\n c[i] = 0\n\n f(i + 1, k)\n\n\n\n\n\nn = int(eval(input()))\n\ns = list(eval(input()))\n\nmod = pow(2, 31) - 1\n\nb1, b2 = 27, 31\n\npowb1 = [pow(27, i, mod) for i in range(n)]\n\npowb2 = [pow(31, i, mod) for i in range(n)]\n\nd = {}\n\nx, y = [], []\n\nfor i in range(n):\n\n x.append(ord(s[i]) - 96)\n\n y.append(ord(s[-(i + 1)]) - 96)\n\nans = 0 if not x == y else 2\n\nc = [0] * n\n\nf(0, 0)\n\nc = [0] * n\n\nf(0, 1)\n\nprint(ans)","code_v0_loc":72,"code_v1_loc":72,"code_v0_num_chars":1894,"code_v1_num_chars":1866,"code_v0_no_empty_lines":"def f(i, k):\n if i == n and k == 0:\n global d\n hr1, hb1 = 0, 0\n hr2, hb2 = 0, 0\n cntr, cntb = 0, 0\n for j in range(n):\n if c[j]:\n hr1 += x[j] * pow(b1, cntr, mod)\n hr2 += x[j] * pow(b2, cntr, mod)\n hr1 %= mod\n hr2 %= mod\n cntr += 1\n else:\n hb1 += x[j] * pow(b1, cntb, mod)\n hb2 += x[j] * pow(b2, cntb, mod)\n hb1 %= mod\n hb2 %= mod\n cntb += 1\n if min(cntr, cntb) == 0:\n return\n if (hr1, hr2, hb1, hb2) in d:\n d[(hr1, hr2, hb1, hb2)] += 1\n else:\n d[(hr1, hr2, hb1, hb2)] = 1\n return\n elif i == n and k == 1:\n hr1, hb1 = 0, 0\n hr2, hb2 = 0, 0\n cntr, cntb = 0, 0\n for j in range(n):\n if c[j]:\n hr1 += y[j] * powb1[cntr]\n hr2 += y[j] * powb2[cntr]\n hr1 %= mod\n hr2 %= mod\n cntr += 1\n else:\n hb1 += y[j] * powb1[cntb]\n hb2 += y[j] * powb2[cntb]\n hb1 %= mod\n hb2 %= mod\n cntb += 1\n if min(cntr, cntb) == 0:\n return\n if (hr1, hr2, hb1, hb2) in d:\n global ans\n ans += d[(hr1, hr2, hb1, hb2)]\n return\n c[i] = 1\n f(i + 1, k)\n c[i] = 0\n f(i + 1, k)\n\n\nn = int(eval(input()))\ns = list(eval(input()))\nmod = pow(2, 31) - 1\nb1, b2 = 27, 31\npowb1 = [pow(27, i, mod) for i in range(n)]\npowb2 = [pow(31, i, mod) for i in range(n)]\nd = {}\nx, y = [], []\nfor i in range(n):\n x.append(ord(s[i]) - 96)\n y.append(ord(s[-(i + 1)]) - 96)\nans = 0 if not x == y else 2\nc = [0] * n\nf(0, 0)\nc = [0] * n\nf(0, 1)\nprint(ans)\n","code_v1_no_empty_lines":"def f(i, k):\n if i == n and k == 0:\n global d\n hr1, hb1 = 0, 0\n hr2, hb2 = 0, 0\n cntr, cntb = 0, 0\n for j in range(n):\n if c[j]:\n hr1 += x[j] * powb1[cntr]\n hr2 += x[j] * powb2[cntr]\n hr1 %= mod\n hr2 %= mod\n cntr += 1\n else:\n hb1 += x[j] * powb1[cntb]\n hb2 += x[j] * powb2[cntb]\n hb1 %= mod\n hb2 %= mod\n cntb += 1\n if min(cntr, cntb) == 0:\n return\n if (hr1, hr2, hb1, hb2) in d:\n d[(hr1, hr2, hb1, hb2)] += 1\n else:\n d[(hr1, hr2, hb1, hb2)] = 1\n return\n elif i == n and k == 1:\n hr1, hb1 = 0, 0\n hr2, hb2 = 0, 0\n cntr, cntb = 0, 0\n for j in range(n):\n if c[j]:\n hr1 += y[j] * powb1[cntr]\n hr2 += y[j] * powb2[cntr]\n hr1 %= mod\n hr2 %= mod\n cntr += 1\n else:\n hb1 += y[j] * powb1[cntb]\n hb2 += y[j] * powb2[cntb]\n hb1 %= mod\n hb2 %= mod\n cntb += 1\n if min(cntr, cntb) == 0:\n return\n if (hr1, hr2, hb1, hb2) in d:\n global ans\n ans += d[(hr1, hr2, hb1, hb2)]\n return\n c[i] = 1\n f(i + 1, k)\n c[i] = 0\n f(i + 1, k)\n\n\nn = int(eval(input()))\ns = list(eval(input()))\nmod = pow(2, 31) - 1\nb1, b2 = 27, 31\npowb1 = [pow(27, i, mod) for i in range(n)]\npowb2 = [pow(31, i, mod) for i in range(n)]\nd = {}\nx, y = [], []\nfor i in range(n):\n x.append(ord(s[i]) - 96)\n y.append(ord(s[-(i + 1)]) - 96)\nans = 0 if not x == y else 2\nc = [0] * n\nf(0, 0)\nc = [0] * n\nf(0, 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- hr1 += x[j] * pow(b1, cntr, mod)","- hr2 += x[j] * pow(b2, cntr, mod)","+ hr1 += x[j] * powb1[cntr]","+ hr2 += x[j] * powb2[cntr]","- hb1 += x[j] * pow(b1, cntb, mod)","- hb2 += x[j] * pow(b2, cntb, mod)","+ hb1 += x[j] * powb1[cntb]","+ hb2 += x[j] * powb2[cntb]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0678553782,"measured_runtime_v1":0.0909499953,"runtime_lift":0.7460734653,"key":["s225225947","s605168875"]} +{"user_id":"u940139461","problem_id":"p03699","language":"python","submission_id_v0":"s067440803","submission_id_v1":"s520654678","cpu_time_v0":236,"cpu_time_v1":169,"memory_v0":49884,"memory_v1":38456,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.39,"input":"# https:\/\/atcoder.jp\/contests\/abc063\/tasks\/arc075_a\n\n\n\nn = int(eval(input()))\n\nnums = []\n\nfor _ in range(n):\n\n nums.append(int(eval(input())))\n\n\n\ntotal = sum(nums)\n\ndp = [[False for _ in range(total + 1)] for _ in range(n + 1)]\n\ndp[0][0] = True\n\nfor i in range(n):\n\n num = nums[i]\n\n dp[i + 1][num] = True\n\n for j in range(total + 1):\n\n if dp[i][j] and num + j <= total:\n\n dp[i + 1][num + j] = True\n\n\n\n dp[i + 1][j] = dp[i][j] or dp[i + 1][j]\n\n\n\nfor i in range(len(dp[0]))[::-1]:\n\n if dp[-1][i] and i % 10 != 0:\n\n print(i)\n\n break\n\nelse:\n\n print((0))","target":"n = int(eval(input()))\n\nnums = []\n\nfor _ in range(n):\n\n nums.append(int(eval(input())))\n\nnums.sort()\n\nans = sum(nums)\n\nif ans % 10 != 0:\n\n print(ans)\n\nelse:\n\n for num in nums:\n\n t = ans - num\n\n if t % 10 != 0:\n\n print(t)\n\n break\n\n else:\n\n print((0))","code_v0_loc":25,"code_v1_loc":16,"code_v0_num_chars":592,"code_v1_num_chars":290,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc063\/tasks\/arc075_a\nn = int(eval(input()))\nnums = []\nfor _ in range(n):\n nums.append(int(eval(input())))\ntotal = sum(nums)\ndp = [[False for _ in range(total + 1)] for _ in range(n + 1)]\ndp[0][0] = True\nfor i in range(n):\n num = nums[i]\n dp[i + 1][num] = True\n for j in range(total + 1):\n if dp[i][j] and num + j <= total:\n dp[i + 1][num + j] = True\n dp[i + 1][j] = dp[i][j] or dp[i + 1][j]\nfor i in range(len(dp[0]))[::-1]:\n if dp[-1][i] and i % 10 != 0:\n print(i)\n break\nelse:\n print((0))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nnums = []\nfor _ in range(n):\n nums.append(int(eval(input())))\nnums.sort()\nans = sum(nums)\nif ans % 10 != 0:\n print(ans)\nelse:\n for num in nums:\n t = ans - num\n if t % 10 != 0:\n print(t)\n break\n else:\n print((0))\n","code_same":false,"relative_loc_diff_percent":36.0,"diff":["-# https:\/\/atcoder.jp\/contests\/abc063\/tasks\/arc075_a","-total = sum(nums)","-dp = [[False for _ in range(total + 1)] for _ in range(n + 1)]","-dp[0][0] = True","-for i in range(n):","- num = nums[i]","- dp[i + 1][num] = True","- for j in range(total + 1):","- if dp[i][j] and num + j <= total:","- dp[i + 1][num + j] = True","- dp[i + 1][j] = dp[i][j] or dp[i + 1][j]","-for i in range(len(dp[0]))[::-1]:","- if dp[-1][i] and i % 10 != 0:","- print(i)","- break","+nums.sort()","+ans = sum(nums)","+if ans % 10 != 0:","+ print(ans)","- print((0))","+ for num in nums:","+ t = ans - num","+ if t % 10 != 0:","+ print(t)","+ break","+ else:","+ print((0))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0885918379,"measured_runtime_v1":0.0884226413,"runtime_lift":1.0019134985,"key":["s067440803","s520654678"]} +{"user_id":"u327466606","problem_id":"p02658","language":"python","submission_id_v0":"s971709614","submission_id_v1":"s239320157","cpu_time_v0":81,"cpu_time_v1":55,"memory_v0":84504,"memory_v1":21720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.1,"input":"N = int(eval(input()))\n\n\n\nA = tuple(map(int,input().split()))\n\nif 0 in A:\n\n print((0))\n\nelse:\n\n p = 1\n\n for a in A:\n\n p *= a\n\n if p > 10**18:\n\n p = -1\n\n break\n\n\n\n print(p)","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nif 0 in A:\n\n print((0))\n\nelse:\n\n r = 1\n\n for a in A:\n\n r *= a\n\n if r > 10**18:\n\n r = -1\n\n break\n\n print(r)","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":211,"code_v1_num_chars":208,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = tuple(map(int, input().split()))\nif 0 in A:\n print((0))\nelse:\n p = 1\n for a in A:\n p *= a\n if p > 10**18:\n p = -1\n break\n print(p)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nif 0 in A:\n print((0))\nelse:\n r = 1\n for a in A:\n r *= a\n if r > 10**18:\n r = -1\n break\n print(r)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-A = tuple(map(int, input().split()))","+A = list(map(int, input().split()))","- p = 1","+ r = 1","- p *= a","- if p > 10**18:","- p = -1","+ r *= a","+ if r > 10**18:","+ r = -1","- print(p)","+ print(r)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0379835365,"measured_runtime_v1":0.0370954568,"runtime_lift":1.0239403881,"key":["s971709614","s239320157"]} +{"user_id":"u426649993","problem_id":"p03835","language":"python","submission_id_v0":"s489027351","submission_id_v1":"s001171781","cpu_time_v0":1783,"cpu_time_v1":1641,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.96,"input":"\"\"\"\n\nAtCoder Beginner Contest 051\n\nB - Sum of Three Integers\n\n\"\"\"\n\n\n\nif __name__ == \"__main__\":\n\n K, S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n for x in range(K+1):\n\n for y in range(K+1):\n\n if x + y > S or S - (x + y) > K:\n\n continue\n\n ans += 1\n\n\n\n print(ans)\n","target":"\"\"\"\n\nAtCoder Beginner Contest 051\n\nB - Sum of Three Integers\n\n\"\"\"\n\n\n\nif __name__ == \"__main__\":\n\n K, S = list(map(int, input().split()))\n\n\n\n ans = 0\n\n A = [i for i in range(K+1)]\n\n for x in A:\n\n for y in A:\n\n if x + y > S or S - (x + y) > K:\n\n continue\n\n ans += 1\n\n\n\n print(ans)\n","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":317,"code_v1_num_chars":332,"code_v0_no_empty_lines":"\"\"\"\nAtCoder Beginner Contest 051\nB - Sum of Three Integers\n\"\"\"\nif __name__ == \"__main__\":\n K, S = list(map(int, input().split()))\n ans = 0\n for x in range(K + 1):\n for y in range(K + 1):\n if x + y > S or S - (x + y) > K:\n continue\n ans += 1\n print(ans)\n","code_v1_no_empty_lines":"\"\"\"\nAtCoder Beginner Contest 051\nB - Sum of Three Integers\n\"\"\"\nif __name__ == \"__main__\":\n K, S = list(map(int, input().split()))\n ans = 0\n A = [i for i in range(K + 1)]\n for x in A:\n for y in A:\n if x + y > S or S - (x + y) > K:\n continue\n ans += 1\n print(ans)\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["- for x in range(K + 1):","- for y in range(K + 1):","+ A = [i for i in range(K + 1)]","+ for x in A:","+ for y in A:"],"diff_only_import_comment":false,"measured_runtime_v0":0.116423776,"measured_runtime_v1":0.044904378,"runtime_lift":2.5927043444,"key":["s489027351","s001171781"]} +{"user_id":"u934442292","problem_id":"p03557","language":"python","submission_id_v0":"s989071065","submission_id_v1":"s416857170","cpu_time_v0":1666,"cpu_time_v1":215,"memory_v0":121748,"memory_v1":29084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.09,"input":"import sys\n\n\n\nimport numba as nb\n\nimport numpy as np\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\n@nb.njit(\"i8(i8[:],i8)\", cache=True)\n\ndef binary_search(a, key):\n\n \"\"\"Meguru type binary search\"\"\"\n\n ng = -1\n\n ok = len(a)\n\n\n\n def is_ok(a, key, idx):\n\n if a[idx] > key:\n\n return True\n\n else:\n\n return False\n\n\n\n while (abs(ok - ng) > 1):\n\n mid = (ok + ng) \/\/ 2\n\n if is_ok(a, key, mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n\n\n return ok\n\n\n\n\n\n@nb.njit(\"i8(i8,i8[:],i8[:],i8[:])\", cache=True)\n\ndef solve(N, A, B, C):\n\n A.sort()\n\n B.sort()\n\n C.sort()\n\n\n\n BC = np.zeros(shape=N + 1, dtype=np.int64)\n\n for i in range(N):\n\n BC[i] = N - binary_search(C, B[i])\n\n\n\n ans = 0\n\n for a in A:\n\n idx = binary_search(B, a)\n\n ans += np.sum(BC[idx:])\n\n\n\n return ans\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = np.array(input().split(), dtype=np.int64)\n\n B = np.array(input().split(), dtype=np.int64)\n\n C = np.array(input().split(), dtype=np.int64)\n\n\n\n ans = solve(N, A, B, C)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"import sys\n\nfrom bisect import bisect_left, bisect_right\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n B = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n\n\n A.sort()\n\n B.sort()\n\n C.sort()\n\n\n\n ans = 0\n\n for b in B:\n\n n_a = bisect_left(A, b)\n\n n_c = N - bisect_right(C, b)\n\n ans += n_a * n_c\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":60,"code_v1_loc":27,"code_v0_num_chars":1153,"code_v1_num_chars":484,"code_v0_no_empty_lines":"import sys\nimport numba as nb\nimport numpy as np\n\ninput = sys.stdin.readline\n\n\n@nb.njit(\"i8(i8[:],i8)\", cache=True)\ndef binary_search(a, key):\n \"\"\"Meguru type binary search\"\"\"\n ng = -1\n ok = len(a)\n\n def is_ok(a, key, idx):\n if a[idx] > key:\n return True\n else:\n return False\n\n while abs(ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n if is_ok(a, key, mid):\n ok = mid\n else:\n ng = mid\n return ok\n\n\n@nb.njit(\"i8(i8,i8[:],i8[:],i8[:])\", cache=True)\ndef solve(N, A, B, C):\n A.sort()\n B.sort()\n C.sort()\n BC = np.zeros(shape=N + 1, dtype=np.int64)\n for i in range(N):\n BC[i] = N - binary_search(C, B[i])\n ans = 0\n for a in A:\n idx = binary_search(B, a)\n ans += np.sum(BC[idx:])\n return ans\n\n\ndef main():\n N = int(eval(input()))\n A = np.array(input().split(), dtype=np.int64)\n B = np.array(input().split(), dtype=np.int64)\n C = np.array(input().split(), dtype=np.int64)\n ans = solve(N, A, B, C)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nfrom bisect import bisect_left, bisect_right\n\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(eval(input()))\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n C = list(map(int, input().split()))\n A.sort()\n B.sort()\n C.sort()\n ans = 0\n for b in B:\n n_a = bisect_left(A, b)\n n_c = N - bisect_right(C, b)\n ans += n_a * n_c\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":55.0,"diff":["-import numba as nb","-import numpy as np","+from bisect import bisect_left, bisect_right","-@nb.njit(\"i8(i8[:],i8)\", cache=True)","-def binary_search(a, key):","- \"\"\"Meguru type binary search\"\"\"","- ng = -1","- ok = len(a)","-","- def is_ok(a, key, idx):","- if a[idx] > key:","- return True","- else:","- return False","-","- while abs(ok - ng) > 1:","- mid = (ok + ng) \/\/ 2","- if is_ok(a, key, mid):","- ok = mid","- else:","- ng = mid","- return ok","-","-","-@nb.njit(\"i8(i8,i8[:],i8[:],i8[:])\", cache=True)","-def solve(N, A, B, C):","+def main():","+ N = int(eval(input()))","+ A = list(map(int, input().split()))","+ B = list(map(int, input().split()))","+ C = list(map(int, input().split()))","- BC = np.zeros(shape=N + 1, dtype=np.int64)","- for i in range(N):","- BC[i] = N - binary_search(C, B[i])","- for a in A:","- idx = binary_search(B, a)","- ans += np.sum(BC[idx:])","- return ans","-","-","-def main():","- N = int(eval(input()))","- A = np.array(input().split(), dtype=np.int64)","- B = np.array(input().split(), dtype=np.int64)","- C = np.array(input().split(), dtype=np.int64)","- ans = solve(N, A, B, C)","+ for b in B:","+ n_a = bisect_left(A, b)","+ n_c = N - bisect_right(C, b)","+ ans += n_a * n_c"],"diff_only_import_comment":false,"measured_runtime_v0":0.1093753338,"measured_runtime_v1":0.0395624161,"runtime_lift":2.764627255,"key":["s989071065","s416857170"]} +{"user_id":"u905203728","problem_id":"p03283","language":"python","submission_id_v0":"s244986152","submission_id_v1":"s341161435","cpu_time_v0":2448,"cpu_time_v1":1392,"memory_v0":16348,"memory_v1":75864,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.14,"input":"import numpy as np\n\nN, M, Q = list(map(int, input().split()))\n\n\n\n#input\n\nlst = [[0] * (N + 1) for _ in range(N + 1)]\n\nfor _ in range(M):\n\n L, R = list(map(int, input().split()))\n\n lst[R][L] += 1\n\n\n\nlst = np.array(lst)\n\n# print (lst)\n\n\n\n#2\u6b21\u5143\u7d2f\u7a4d\u548c\n\nfor i in range(1, N + 1):\n\n lst[:,i] += lst[:, i - 1]\n\nfor j in range(1, N + 1):\n\n lst[j,:] += lst[j - 1, :]\n\n\n\n\n\n#output\n\nfor _ in range(Q):\n\n p, q = list(map(int, input().split()))\n\n print((lst[q, q] - lst[p-1, q] - lst[q, p-1] + lst[p-1, p-1]))\n\n\n\n# print (lst)\n","target":"n,m,q=list(map(int,input().split()))\n\natlas=[[0]*(n+1) for _ in range(n+1)]\n\nfor _ in range(m):\n\n l,r=list(map(int,input().split()))\n\n atlas[l][r] +=1\n\nfor i in range(n+1):\n\n for j in range(1,n+1):\n\n atlas[i][j] +=atlas[i][j-1]\n\n\n\nfor i in range(n+1):\n\n for j in range(1,n+1):\n\n atlas[i][j] +=atlas[i-1][j]\n\n\n\nfor p,q in [list(map(int,input().split())) for _ in range(q)]:\n\n print((atlas[q][q]-atlas[q][p-1]-atlas[p-1][q]+atlas[p-1][p-1]))","code_v0_loc":25,"code_v1_loc":15,"code_v0_num_chars":509,"code_v1_num_chars":454,"code_v0_no_empty_lines":"import numpy as np\n\nN, M, Q = list(map(int, input().split()))\n# input\nlst = [[0] * (N + 1) for _ in range(N + 1)]\nfor _ in range(M):\n L, R = list(map(int, input().split()))\n lst[R][L] += 1\nlst = np.array(lst)\n# print (lst)\n# 2\u6b21\u5143\u7d2f\u7a4d\u548c\nfor i in range(1, N + 1):\n lst[:, i] += lst[:, i - 1]\nfor j in range(1, N + 1):\n lst[j, :] += lst[j - 1, :]\n# output\nfor _ in range(Q):\n p, q = list(map(int, input().split()))\n print((lst[q, q] - lst[p - 1, q] - lst[q, p - 1] + lst[p - 1, p - 1]))\n# print (lst)\n","code_v1_no_empty_lines":"n, m, q = list(map(int, input().split()))\natlas = [[0] * (n + 1) for _ in range(n + 1)]\nfor _ in range(m):\n l, r = list(map(int, input().split()))\n atlas[l][r] += 1\nfor i in range(n + 1):\n for j in range(1, n + 1):\n atlas[i][j] += atlas[i][j - 1]\nfor i in range(n + 1):\n for j in range(1, n + 1):\n atlas[i][j] += atlas[i - 1][j]\nfor p, q in [list(map(int, input().split())) for _ in range(q)]:\n print((atlas[q][q] - atlas[q][p - 1] - atlas[p - 1][q] + atlas[p - 1][p - 1]))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-import numpy as np","-","-N, M, Q = list(map(int, input().split()))","-# input","-lst = [[0] * (N + 1) for _ in range(N + 1)]","-for _ in range(M):","- L, R = list(map(int, input().split()))","- lst[R][L] += 1","-lst = np.array(lst)","-# print (lst)","-# 2\u6b21\u5143\u7d2f\u7a4d\u548c","-for i in range(1, N + 1):","- lst[:, i] += lst[:, i - 1]","-for j in range(1, N + 1):","- lst[j, :] += lst[j - 1, :]","-# output","-for _ in range(Q):","- p, q = list(map(int, input().split()))","- print((lst[q, q] - lst[p - 1, q] - lst[q, p - 1] + lst[p - 1, p - 1]))","-# print (lst)","+n, m, q = list(map(int, input().split()))","+atlas = [[0] * (n + 1) for _ in range(n + 1)]","+for _ in range(m):","+ l, r = list(map(int, input().split()))","+ atlas[l][r] += 1","+for i in range(n + 1):","+ for j in range(1, n + 1):","+ atlas[i][j] += atlas[i][j - 1]","+for i in range(n + 1):","+ for j in range(1, n + 1):","+ atlas[i][j] += atlas[i - 1][j]","+for p, q in [list(map(int, input().split())) for _ in range(q)]:","+ print((atlas[q][q] - atlas[q][p - 1] - atlas[p - 1][q] + atlas[p - 1][p - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1902613151,"measured_runtime_v1":0.0867051148,"runtime_lift":2.194349381,"key":["s244986152","s341161435"]} +{"user_id":"u871841829","problem_id":"p02866","language":"python","submission_id_v0":"s235585693","submission_id_v1":"s892484905","cpu_time_v0":202,"cpu_time_v1":144,"memory_v0":26648,"memory_v1":26948,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.71,"input":"N = int(eval(input()))\n\nD = list(map(int, input().split()))\n\nM = 998244353\n\nfrom collections import Counter\n\n\n\nif D[0] != 0:\n\n print((0))\n\n exit(0)\n\n\n\ncd = Counter(D)\n\nif cd[0] != 1:\n\n print((0))\n\n exit(0)\n\n\n\ntmp = sorted(list(cd.items()), key=lambda x: x[0])\n\n\n\nans = 1\n\n\n\n\n\nfor kx in range(1, max(D)+1):\n\n ans *= pow(cd[kx-1], cd[kx],M)\n\n ans %= M\n\n\n\nprint(ans)\n","target":"N = int(eval(input()))\n\nD = list(map(int, input().split()))\n\nM = 998244353\n\nfrom collections import Counter\n\n\n\nif D[0] != 0:\n\n print((0))\n\n exit(0)\n\n\n\ncd = Counter(D)\n\nif cd[0] != 1:\n\n print((0))\n\n exit(0)\n\n\n\ntmp = sorted(list(cd.items()), key=lambda x: x[0])\n\n\n\nans = 1\n\nfor kx in range(1, max(D)+1):\n\n # __, p = tmp[kx-1]\n\n # _, v = tmp[kx]\n\n p = cd[kx-1]\n\n v = cd[kx]\n\n # print(\"{}^{}\".format(p, v))\n\n while v > 0:\n\n ans *= p\n\n ans %= M\n\n v -= 1\n\n# print(cd)\n\n\n\n# for kx in range(1, max(D)+1):\n\n# ans *= pow(cd[kx-1], cd[kx],M)\n\n# ans %= M\n\n\n\nprint(ans)","code_v0_loc":24,"code_v1_loc":34,"code_v0_num_chars":366,"code_v1_num_chars":599,"code_v0_no_empty_lines":"N = int(eval(input()))\nD = list(map(int, input().split()))\nM = 998244353\nfrom collections import Counter\n\nif D[0] != 0:\n print((0))\n exit(0)\ncd = Counter(D)\nif cd[0] != 1:\n print((0))\n exit(0)\ntmp = sorted(list(cd.items()), key=lambda x: x[0])\nans = 1\nfor kx in range(1, max(D) + 1):\n ans *= pow(cd[kx - 1], cd[kx], M)\n ans %= M\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nD = list(map(int, input().split()))\nM = 998244353\nfrom collections import Counter\n\nif D[0] != 0:\n print((0))\n exit(0)\ncd = Counter(D)\nif cd[0] != 1:\n print((0))\n exit(0)\ntmp = sorted(list(cd.items()), key=lambda x: x[0])\nans = 1\nfor kx in range(1, max(D) + 1):\n # __, p = tmp[kx-1]\n # _, v = tmp[kx]\n p = cd[kx - 1]\n v = cd[kx]\n # print(\"{}^{}\".format(p, v))\n while v > 0:\n ans *= p\n ans %= M\n v -= 1\n# print(cd)\n# for kx in range(1, max(D)+1):\n# ans *= pow(cd[kx-1], cd[kx],M)\n# ans %= M\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["- ans *= pow(cd[kx - 1], cd[kx], M)","- ans %= M","+ # __, p = tmp[kx-1]","+ # _, v = tmp[kx]","+ p = cd[kx - 1]","+ v = cd[kx]","+ # print(\"{}^{}\".format(p, v))","+ while v > 0:","+ ans *= p","+ ans %= M","+ v -= 1","+# print(cd)","+# for kx in range(1, max(D)+1):","+# ans *= pow(cd[kx-1], cd[kx],M)","+# ans %= M"],"diff_only_import_comment":false,"measured_runtime_v0":0.0840707302,"measured_runtime_v1":0.0066346169,"runtime_lift":12.6715275291,"key":["s235585693","s892484905"]} +{"user_id":"u348805958","problem_id":"p02611","language":"python","submission_id_v0":"s451856355","submission_id_v1":"s788708354","cpu_time_v0":274,"cpu_time_v1":72,"memory_v0":69504,"memory_v1":69944,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.72,"input":"#!python3\n\n\n\nimport sys\n\niim = lambda: map(int, sys.stdin.readline().rstrip().split())\n\nfrom functools import lru_cache\n\n\n\nmod = 10 **9 + 7\n\n\n\n\n\n@lru_cache(100)\n\ndef calc(n):\n\n m = (n-5) \/\/ 2\n\n\n\n #return (1+m)*(2+m)*(3+m)*(4+m)*(5+m)*(1025024*m**10+3003*(-4+n)*(-3+n)*(-2+n)*(-1+n)*n*(1+n)*(2+n)*(3+n)*(4+n)*(5+n)-549120*m**9*(-1+10*n)+42240*m**8*(-398+45*n*(-1+7*n))-369600*m**7*(3+2*(-2+n)*n*(49+26*n))+2688*m**6*(33529+75*n*(-33-679*n+91*n**3))-336*m**5*(88065+2*n*(426107+7*n*(-6675+13*n*(-2420+9*n*(5+22*n)))))+560*m**4*(-291598+n*(216249+7*n*(95465+26*n*(-495+n*(-980+11*n*(3+5*n))))))-30*m**3*(-3080960+n*(-10447602+7*n*(854525+13*n*(93170+n*(-15295+22*n*(-714+5*n*(7+6*n)))))))+2*m**2*(28412712+25*n*(-3433650+n*(-4123841+13*n*(189882+n*(142177+22*n*(-1344+n*(-791+27*n*(2+n))))))))-m*(30149280+n*(31294296+n*(-93275400+13*n*(-3808420+n*(2988195+11*n*(111678+25*n*(-1302+n*(-456+n*(45+14*n))))))))))\/1307674368000\n\n return (\n\n (1+m)*(2+m)*(3+m)*(4+m)*(5+m)%mod*(\n\n 1025024*pow(m,10,mod)+3003*(-4+n)%mod*(-3+n)%mod*(-2+n)%mod*(-1+n)*n*(1+n)%mod*(2+n)%mod*(3+n)%mod*(4+n)%mod*(5+n)%mod\n\n -549120*pow(m,9,mod)*(-1+10*n)%mod\n\n +42240*pow(m,8,mod)*(-398+45*n*(-1+7*n)%mod)%mod\n\n -369600*pow(m,7,mod)*(3+2*(-2+n)*n*(49+26*n)%mod)%mod\n\n +2688*pow(m,6,mod)*(33529+75*n*(-33-679*n+91*n**3)%mod)%mod\n\n -336*pow(m,5,mod)*(88065+2*n*(426107+7*n*(-6675+13*n*(-2420+9*n*(5+22*n)%mod)%mod)%mod)%mod)%mod\n\n +560*pow(m,4,mod)*(-291598+n*(216249+7*n*(95465+26*n*(-495+n*(-980+11*n*(3+5*n)%mod)%mod)%mod)%mod)%mod)%mod\n\n -30*pow(m,3,mod)*(-3080960+n*(-10447602+7*n*(854525+13*n*(93170+n*(-15295+22*n*(-714+5*n*(7+6*n)%mod)%mod)%mod)%mod)%mod)%mod)%mod\n\n +2*pow(m,2,mod)*(28412712+25*n*(-3433650+n*(-4123841+13*n*(189882+n*(142177+22*n*(-1344+n*(-791+27*n*(2+n)%mod)%mod)%mod)%mod)%mod)%mod)%mod)%mod\n\n -m*(30149280+n*(31294296+n*(-93275400+13*n*(-3808420+n*(2988195+11*n*(111678+25*n*(-1302+n*(-456+n*(45+14*n)%mod)%mod)%mod)%mod)%mod)%mod)%mod)%mod)%mod\n\n )%mod*pow(1307674368000%mod, mod-2, mod)%mod\n\n )\n\n\n\ndef resolve():\n\n it = map(int, sys.stdin.read().split())\n\n N = next(it)\n\n\n\n ans = [0] * N\n\n for i in range(N):\n\n n = next(it)\n\n ans[i] = calc(n)\n\n\n\n print(*ans, sep=\"\\n\")\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n","target":"#!python3\n\n\n\nimport sys\n\niim = lambda: map(int, sys.stdin.readline().rstrip().split())\n\nfrom functools import lru_cache\n\n\n\nmod = 10 **9 + 7\n\n\n\n\n\n@lru_cache(100)\n\ndef calc(n):\n\n m = (n-5) \/\/ 2\n\n\n\n #return (1+m)*(2+m)*(3+m)*(4+m)*(5+m)*(1025024*m**10+3003*(-4+n)*(-3+n)*(-2+n)*(-1+n)*n*(1+n)*(2+n)*(3+n)*(4+n)*(5+n)-549120*m**9*(-1+10*n)+42240*m**8*(-398+45*n*(-1+7*n))-369600*m**7*(3+2*(-2+n)*n*(49+26*n))+2688*m**6*(33529+75*n*(-33-679*n+91*n**3))-336*m**5*(88065+2*n*(426107+7*n*(-6675+13*n*(-2420+9*n*(5+22*n)))))+560*m**4*(-291598+n*(216249+7*n*(95465+26*n*(-495+n*(-980+11*n*(3+5*n))))))-30*m**3*(-3080960+n*(-10447602+7*n*(854525+13*n*(93170+n*(-15295+22*n*(-714+5*n*(7+6*n)))))))+2*m**2*(28412712+25*n*(-3433650+n*(-4123841+13*n*(189882+n*(142177+22*n*(-1344+n*(-791+27*n*(2+n))))))))-m*(30149280+n*(31294296+n*(-93275400+13*n*(-3808420+n*(2988195+11*n*(111678+25*n*(-1302+n*(-456+n*(45+14*n))))))))))\/1307674368000\n\n return (\n\n (1+m)*(2+m)*(3+m)%mod*(4+m)*(5+m)%mod*(\n\n 1025024*pow(m,10,mod)+3003*(-4+n)%mod*(-3+n)*(-2+n)%mod*(-1+n)*n*(1+n)%mod*(2+n)*(3+n)%mod*(4+n)*(5+n)%mod\n\n -549120*pow(m,9,mod)*(-1+10*n)%mod\n\n +42240*pow(m,8,mod)*(-398+45*n*(-1+7*n))%mod\n\n -369600*pow(m,7,mod)*(3+2*(-2+n)*n*(49+26*n)%mod)%mod\n\n +2688*pow(m,6,mod)*(33529+75*n*(-33-679*n+91*n**3)%mod)%mod\n\n -336*pow(m,5,mod)*(88065+2*n*(426107+7*n*(-6675+13*n*(-2420+9*n*(5+22*n)%mod))%mod))%mod\n\n +560*pow(m,4,mod)*(-291598+n*(216249+7*n*(95465+26*n*(-495+n*(-980+11*n*(3+5*n))%mod))%mod))%mod\n\n -30*pow(m,3,mod)*(-3080960+n*(-10447602+7*n*(854525+13*n*(93170+n*(-15295+22*n*(-714+5*n*(7+6*n)%mod))%mod))%mod))%mod\n\n +2*pow(m,2,mod)*(28412712+25*n*(-3433650+n*(-4123841+13*n*(189882+n*(142177+22*n*(-1344+n*(-791+27*n*(2+n))%mod))%mod))%mod))%mod\n\n -m*(30149280+n*(31294296+n*(-93275400+13*n*(-3808420+n*(2988195+11*n*(111678+25*n*(-1302+n*(-456+n*(45+14*n)%mod))%mod))%mod))%mod))%mod\n\n )%mod*pow(1307674368000%mod, mod-2, mod)%mod\n\n )\n\n\n\ndef resolve():\n\n it = map(int, sys.stdin.read().split())\n\n N = next(it)\n\n\n\n ans = [0] * N\n\n for i in range(N):\n\n n = next(it)\n\n ans[i] = calc(n)\n\n\n\n print(*ans, sep=\"\\n\")\n\n\n\nif __name__ == \"__main__\":\n\n resolve()\n","code_v0_loc":42,"code_v1_loc":42,"code_v0_num_chars":2379,"code_v1_num_chars":2303,"code_v0_no_empty_lines":"#!python3\nimport sys\n\niim = lambda: map(int, sys.stdin.readline().rstrip().split())\nfrom functools import lru_cache\n\nmod = 10**9 + 7\n\n\n@lru_cache(100)\ndef calc(n):\n m = (n - 5) \/\/ 2\n # return (1+m)*(2+m)*(3+m)*(4+m)*(5+m)*(1025024*m**10+3003*(-4+n)*(-3+n)*(-2+n)*(-1+n)*n*(1+n)*(2+n)*(3+n)*(4+n)*(5+n)-549120*m**9*(-1+10*n)+42240*m**8*(-398+45*n*(-1+7*n))-369600*m**7*(3+2*(-2+n)*n*(49+26*n))+2688*m**6*(33529+75*n*(-33-679*n+91*n**3))-336*m**5*(88065+2*n*(426107+7*n*(-6675+13*n*(-2420+9*n*(5+22*n)))))+560*m**4*(-291598+n*(216249+7*n*(95465+26*n*(-495+n*(-980+11*n*(3+5*n))))))-30*m**3*(-3080960+n*(-10447602+7*n*(854525+13*n*(93170+n*(-15295+22*n*(-714+5*n*(7+6*n)))))))+2*m**2*(28412712+25*n*(-3433650+n*(-4123841+13*n*(189882+n*(142177+22*n*(-1344+n*(-791+27*n*(2+n))))))))-m*(30149280+n*(31294296+n*(-93275400+13*n*(-3808420+n*(2988195+11*n*(111678+25*n*(-1302+n*(-456+n*(45+14*n))))))))))\/1307674368000\n return (\n (1 + m)\n * (2 + m)\n * (3 + m)\n * (4 + m)\n * (5 + m)\n % mod\n * (\n 1025024 * pow(m, 10, mod)\n + 3003\n * (-4 + n)\n % mod\n * (-3 + n)\n % mod\n * (-2 + n)\n % mod\n * (-1 + n)\n * n\n * (1 + n)\n % mod\n * (2 + n)\n % mod\n * (3 + n)\n % mod\n * (4 + n)\n % mod\n * (5 + n)\n % mod\n - 549120 * pow(m, 9, mod) * (-1 + 10 * n) % mod\n + 42240 * pow(m, 8, mod) * (-398 + 45 * n * (-1 + 7 * n) % mod) % mod\n - 369600\n * pow(m, 7, mod)\n * (3 + 2 * (-2 + n) * n * (49 + 26 * n) % mod)\n % mod\n + 2688\n * pow(m, 6, mod)\n * (33529 + 75 * n * (-33 - 679 * n + 91 * n**3) % mod)\n % mod\n - 336\n * pow(m, 5, mod)\n * (\n 88065\n + 2\n * n\n * (\n 426107\n + 7\n * n\n * (-6675 + 13 * n * (-2420 + 9 * n * (5 + 22 * n) % mod) % mod)\n % mod\n )\n % mod\n )\n % mod\n + 560\n * pow(m, 4, mod)\n * (\n -291598\n + n\n * (\n 216249\n + 7\n * n\n * (\n 95465\n + 26\n * n\n * (-495 + n * (-980 + 11 * n * (3 + 5 * n) % mod) % mod)\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n - 30\n * pow(m, 3, mod)\n * (\n -3080960\n + n\n * (\n -10447602\n + 7\n * n\n * (\n 854525\n + 13\n * n\n * (\n 93170\n + n\n * (\n -15295\n + 22 * n * (-714 + 5 * n * (7 + 6 * n) % mod) % mod\n )\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n + 2\n * pow(m, 2, mod)\n * (\n 28412712\n + 25\n * n\n * (\n -3433650\n + n\n * (\n -4123841\n + 13\n * n\n * (\n 189882\n + n\n * (\n 142177\n + 22\n * n\n * (-1344 + n * (-791 + 27 * n * (2 + n) % mod) % mod)\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n - m\n * (\n 30149280\n + n\n * (\n 31294296\n + n\n * (\n -93275400\n + 13\n * n\n * (\n -3808420\n + n\n * (\n 2988195\n + 11\n * n\n * (\n 111678\n + 25\n * n\n * (\n -1302\n + n * (-456 + n * (45 + 14 * n) % mod) % mod\n )\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n )\n % mod\n * pow(1307674368000 % mod, mod - 2, mod)\n % mod\n )\n\n\ndef resolve():\n it = map(int, sys.stdin.read().split())\n N = next(it)\n ans = [0] * N\n for i in range(N):\n n = next(it)\n ans[i] = calc(n)\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"#!python3\nimport sys\n\niim = lambda: map(int, sys.stdin.readline().rstrip().split())\nfrom functools import lru_cache\n\nmod = 10**9 + 7\n\n\n@lru_cache(100)\ndef calc(n):\n m = (n - 5) \/\/ 2\n # return (1+m)*(2+m)*(3+m)*(4+m)*(5+m)*(1025024*m**10+3003*(-4+n)*(-3+n)*(-2+n)*(-1+n)*n*(1+n)*(2+n)*(3+n)*(4+n)*(5+n)-549120*m**9*(-1+10*n)+42240*m**8*(-398+45*n*(-1+7*n))-369600*m**7*(3+2*(-2+n)*n*(49+26*n))+2688*m**6*(33529+75*n*(-33-679*n+91*n**3))-336*m**5*(88065+2*n*(426107+7*n*(-6675+13*n*(-2420+9*n*(5+22*n)))))+560*m**4*(-291598+n*(216249+7*n*(95465+26*n*(-495+n*(-980+11*n*(3+5*n))))))-30*m**3*(-3080960+n*(-10447602+7*n*(854525+13*n*(93170+n*(-15295+22*n*(-714+5*n*(7+6*n)))))))+2*m**2*(28412712+25*n*(-3433650+n*(-4123841+13*n*(189882+n*(142177+22*n*(-1344+n*(-791+27*n*(2+n))))))))-m*(30149280+n*(31294296+n*(-93275400+13*n*(-3808420+n*(2988195+11*n*(111678+25*n*(-1302+n*(-456+n*(45+14*n))))))))))\/1307674368000\n return (\n (1 + m)\n * (2 + m)\n * (3 + m)\n % mod\n * (4 + m)\n * (5 + m)\n % mod\n * (\n 1025024 * pow(m, 10, mod)\n + 3003\n * (-4 + n)\n % mod\n * (-3 + n)\n * (-2 + n)\n % mod\n * (-1 + n)\n * n\n * (1 + n)\n % mod\n * (2 + n)\n * (3 + n)\n % mod\n * (4 + n)\n * (5 + n)\n % mod\n - 549120 * pow(m, 9, mod) * (-1 + 10 * n) % mod\n + 42240 * pow(m, 8, mod) * (-398 + 45 * n * (-1 + 7 * n)) % mod\n - 369600\n * pow(m, 7, mod)\n * (3 + 2 * (-2 + n) * n * (49 + 26 * n) % mod)\n % mod\n + 2688\n * pow(m, 6, mod)\n * (33529 + 75 * n * (-33 - 679 * n + 91 * n**3) % mod)\n % mod\n - 336\n * pow(m, 5, mod)\n * (\n 88065\n + 2\n * n\n * (\n 426107\n + 7\n * n\n * (-6675 + 13 * n * (-2420 + 9 * n * (5 + 22 * n) % mod))\n % mod\n )\n )\n % mod\n + 560\n * pow(m, 4, mod)\n * (\n -291598\n + n\n * (\n 216249\n + 7\n * n\n * (\n 95465\n + 26 * n * (-495 + n * (-980 + 11 * n * (3 + 5 * n)) % mod)\n )\n % mod\n )\n )\n % mod\n - 30\n * pow(m, 3, mod)\n * (\n -3080960\n + n\n * (\n -10447602\n + 7\n * n\n * (\n 854525\n + 13\n * n\n * (\n 93170\n + n\n * (-15295 + 22 * n * (-714 + 5 * n * (7 + 6 * n) % mod))\n % mod\n )\n )\n % mod\n )\n )\n % mod\n + 2\n * pow(m, 2, mod)\n * (\n 28412712\n + 25\n * n\n * (\n -3433650\n + n\n * (\n -4123841\n + 13\n * n\n * (\n 189882\n + n\n * (\n 142177\n + 22 * n * (-1344 + n * (-791 + 27 * n * (2 + n)) % mod)\n )\n % mod\n )\n )\n % mod\n )\n )\n % mod\n - m\n * (\n 30149280\n + n\n * (\n 31294296\n + n\n * (\n -93275400\n + 13\n * n\n * (\n -3808420\n + n\n * (\n 2988195\n + 11\n * n\n * (\n 111678\n + 25\n * n\n * (-1302 + n * (-456 + n * (45 + 14 * n) % mod))\n % mod\n )\n )\n % mod\n )\n )\n % mod\n )\n )\n % mod\n )\n % mod\n * pow(1307674368000 % mod, mod - 2, mod)\n % mod\n )\n\n\ndef resolve():\n it = map(int, sys.stdin.read().split())\n N = next(it)\n ans = [0] * N\n for i in range(N):\n n = next(it)\n ans[i] = calc(n)\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+ % mod","- % mod","- % mod","- % mod","- + 42240 * pow(m, 8, mod) * (-398 + 45 * n * (-1 + 7 * n) % mod) % mod","+ + 42240 * pow(m, 8, mod) * (-398 + 45 * n * (-1 + 7 * n)) % mod","- * (-6675 + 13 * n * (-2420 + 9 * n * (5 + 22 * n) % mod) % mod)","+ * (-6675 + 13 * n * (-2420 + 9 * n * (5 + 22 * n) % mod))","- % mod","- + 26","- * n","- * (-495 + n * (-980 + 11 * n * (3 + 5 * n) % mod) % mod)","- % mod","+ + 26 * n * (-495 + n * (-980 + 11 * n * (3 + 5 * n)) % mod)","- % mod","- * (","- -15295","- + 22 * n * (-714 + 5 * n * (7 + 6 * n) % mod) % mod","- )","+ * (-15295 + 22 * n * (-714 + 5 * n * (7 + 6 * n) % mod))","- % mod","- % mod","- + 22","- * n","- * (-1344 + n * (-791 + 27 * n * (2 + n) % mod) % mod)","- % mod","+ + 22 * n * (-1344 + n * (-791 + 27 * n * (2 + n)) % mod)","- % mod","- % mod","- * (","- -1302","- + n * (-456 + n * (45 + 14 * n) % mod) % mod","- )","+ * (-1302 + n * (-456 + n * (45 + 14 * n) % mod))","- % mod","- % mod","- % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.041937036,"measured_runtime_v1":0.0389788127,"runtime_lift":1.0758931103,"key":["s451856355","s788708354"]} +{"user_id":"u391875425","problem_id":"p03380","language":"python","submission_id_v0":"s827368923","submission_id_v1":"s925230664","cpu_time_v0":218,"cpu_time_v1":71,"memory_v0":23092,"memory_v1":14428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.43,"input":"import numpy as np\n\n\n\nn = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nAs = sorted(A)\n\nm = As[-1]\n\ns = np.searchsorted(As,m\/2)\n\nd1 = abs(m\/2-As[s])\n\nd2 = abs(m\/2-As[s-1])\n\nif d1 >= d2:\n\n r = As[s-1]\n\nelse:\n\n r = As[s]\n\nprint((m,r))","target":"n = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nm = max(A) \n\nmin = float(\"inf\")\n\nfor i in range(n):\n\n if min > abs(A[i] - m\/2) and A[i] != m: \n\n min = abs(A[i] - m\/2)\n\n r = A[i]\n\nprint((m,r))\n","code_v0_loc":14,"code_v1_loc":9,"code_v0_num_chars":241,"code_v1_num_chars":204,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nA = list(map(int, input().split()))\nAs = sorted(A)\nm = As[-1]\ns = np.searchsorted(As, m \/ 2)\nd1 = abs(m \/ 2 - As[s])\nd2 = abs(m \/ 2 - As[s - 1])\nif d1 >= d2:\n r = As[s - 1]\nelse:\n r = As[s]\nprint((m, r))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nm = max(A)\nmin = float(\"inf\")\nfor i in range(n):\n if min > abs(A[i] - m \/ 2) and A[i] != m:\n min = abs(A[i] - m \/ 2)\n r = A[i]\nprint((m, r))\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-import numpy as np","-","-As = sorted(A)","-m = As[-1]","-s = np.searchsorted(As, m \/ 2)","-d1 = abs(m \/ 2 - As[s])","-d2 = abs(m \/ 2 - As[s - 1])","-if d1 >= d2:","- r = As[s - 1]","-else:","- r = As[s]","+m = max(A)","+min = float(\"inf\")","+for i in range(n):","+ if min > abs(A[i] - m \/ 2) and A[i] != m:","+ min = abs(A[i] - m \/ 2)","+ r = A[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.4356126721,"measured_runtime_v1":0.0411261815,"runtime_lift":10.5921010863,"key":["s827368923","s925230664"]} +{"user_id":"u724687935","problem_id":"p03379","language":"python","submission_id_v0":"s202621492","submission_id_v1":"s322158047","cpu_time_v0":1004,"cpu_time_v1":219,"memory_v0":115668,"memory_v1":40740,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.19,"input":"N = int(input())\n\nX = []\n\nfor i, x in enumerate(map(int, input().split())):\n\n X.append((x, i))\n\n\n\nX.sort()\n\nY = [0] * N\n\nfor j, (x, i) in enumerate(X):\n\n Y[i] = j\n\n\n\nmid = N \/ 2\n\nl = X[N \/\/ 2 - 1][0]\n\nr = X[N \/\/ 2][0]\n\nans = []\n\nfor j in Y:\n\n if j < mid:\n\n ans.append(r)\n\n else:\n\n ans.append(l)\n\n\n\nprint(*ans, sep='\\n')\n","target":"N = int(eval(input()))\n\nX = list(map(int, input().split()))\n\norder = {}\n\nfor idx, x in enumerate(X):\n\n order[idx] = x\n\n\n\nX.sort()\n\nm = N \/\/ 2\n\nl = X[m - 1]\n\nr = X[m]\n\n\n\nfor idx in range(N):\n\n x = order[idx]\n\n if x <= l:\n\n print(r)\n\n else:\n\n print(l)\n","code_v0_loc":21,"code_v1_loc":17,"code_v0_num_chars":346,"code_v1_num_chars":270,"code_v0_no_empty_lines":"N = int(input())\nX = []\nfor i, x in enumerate(map(int, input().split())):\n X.append((x, i))\nX.sort()\nY = [0] * N\nfor j, (x, i) in enumerate(X):\n Y[i] = j\nmid = N \/ 2\nl = X[N \/\/ 2 - 1][0]\nr = X[N \/\/ 2][0]\nans = []\nfor j in Y:\n if j < mid:\n ans.append(r)\n else:\n ans.append(l)\nprint(*ans, sep=\"\\n\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nX = list(map(int, input().split()))\norder = {}\nfor idx, x in enumerate(X):\n order[idx] = x\nX.sort()\nm = N \/\/ 2\nl = X[m - 1]\nr = X[m]\nfor idx in range(N):\n x = order[idx]\n if x <= l:\n print(r)\n else:\n print(l)\n","code_same":false,"relative_loc_diff_percent":19.0476190476,"diff":["-N = int(input())","-X = []","-for i, x in enumerate(map(int, input().split())):","- X.append((x, i))","+N = int(eval(input()))","+X = list(map(int, input().split()))","+order = {}","+for idx, x in enumerate(X):","+ order[idx] = x","-Y = [0] * N","-for j, (x, i) in enumerate(X):","- Y[i] = j","-mid = N \/ 2","-l = X[N \/\/ 2 - 1][0]","-r = X[N \/\/ 2][0]","-ans = []","-for j in Y:","- if j < mid:","- ans.append(r)","+m = N \/\/ 2","+l = X[m - 1]","+r = X[m]","+for idx in range(N):","+ x = order[idx]","+ if x <= l:","+ print(r)","- ans.append(l)","-print(*ans, sep=\"\\n\")","+ print(l)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369459152,"measured_runtime_v1":0.0378320217,"runtime_lift":0.9765778708,"key":["s202621492","s322158047"]} +{"user_id":"u807772568","problem_id":"p03213","language":"python","submission_id_v0":"s518684407","submission_id_v1":"s097419846","cpu_time_v0":26,"cpu_time_v1":19,"memory_v0":3572,"memory_v1":3192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.92,"input":"from operator import mul\n\nfrom functools import reduce\n\n\n\nnCr = {}\n\ndef cmb(n, r):\n\n if r == 0 or r == n: return 1\n\n if r == 1: return n\n\n if (n,r) in nCr: return nCr[(n,r)]\n\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n\n return nCr[(n,r)]\n\n\n\n\n\na = int(eval(input()))\n\n\n\nb = [0 for i in range(15)]\n\nj = 0\n\nc = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]\n\nd = [0 for i in range(101)]\n\np = 0\n\npp = 0\n\ng = 0\n\ngg = 0\n\nggg = 0\n\nco = 0\n\nfor i in range(1,101):\n\n k = i\n\n while True:\n\n if k % c[j] == 0 and k >= c[j]:\n\n b[j] += 1\n\n k \/\/= c[j]\n\n else:\n\n j += 1\n\n if j == 15:\n\n j = 0\n\n break\n\n for k in range(15):\n\n if b[k] >= 74:\n\n g += 1\n\n if b[k] >= 24:\n\n gg += 1\n\n if b[k] >= 14:\n\n ggg += 1\n\n if b[k] >= 4:\n\n p += 1\n\n if b[k] >= 2:\n\n pp += 1\n\n if i >= 10:\n\n d[i] = cmb(p, 2)*cmb((pp-2), 1) + cmb(g, 1) + cmb(gg, 1)*cmb((pp-1), 1) + cmb(ggg, 1)*cmb((p-1), 1)\n\n p = 0\n\n pp = 0\n\n g = 0\n\n gg = 0\n\n ggg = 0\n\nprint((d[a]))","target":"def cmb(n, r):\n\n if n - r < r: r = n - r\n\n if n <= 0: return 0\n\n if r == 0: return 1\n\n if r == 1: return n\n\n\n\n numerator = [n - r + k + 1 for k in range(r)]\n\n denominator = [k + 1 for k in range(r)]\n\n\n\n for p in range(2,r+1):\n\n pivot = denominator[p - 1]\n\n if pivot > 1:\n\n offset = (n - r) % p;\n\n for k in range(p-1,r,p):\n\n numerator[k - offset] \/\/= pivot\n\n denominator[k] \/\/= pivot\n\n\n\n result = 1\n\n for k in range(r):\n\n if numerator[k] > 1:\n\n result *= int(numerator[k])\n\n\n\n return result\n\n\n\na = int(eval(input()))\n\n\n\nb = [0 for i in range(15)]\n\nj = 0\n\nc = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]\n\nd = [0 for i in range(101)]\n\np = 0\n\npp = 0\n\ng = 0\n\ngg = 0\n\nggg = 0\n\nco = 0\n\nfor i in range(1,101):\n\n k = i\n\n while True:\n\n if k % c[j] == 0 and k >= c[j]:\n\n b[j] += 1\n\n k \/\/= c[j]\n\n else:\n\n j += 1\n\n if j == 15:\n\n j = 0\n\n break\n\n for k in range(15):\n\n if b[k] >= 74:\n\n g += 1\n\n if b[k] >= 24:\n\n gg += 1\n\n if b[k] >= 14:\n\n ggg += 1\n\n if b[k] >= 4:\n\n p += 1\n\n if b[k] >= 2:\n\n pp += 1\n\n if i >= 10:\n\n d[i] = cmb(p, 2)*cmb((pp-2), 1) + cmb(g, 1) + cmb(gg, 1)*cmb((pp-1), 1) + cmb(ggg, 1)*cmb((p-1), 1)\n\n p = 0\n\n pp = 0\n\n g = 0\n\n gg = 0\n\n ggg = 0\n\nprint((d[a]))\n","code_v0_loc":54,"code_v1_loc":66,"code_v0_num_chars":1003,"code_v1_num_chars":1356,"code_v0_no_empty_lines":"from operator import mul\nfrom functools import reduce\n\nnCr = {}\n\n\ndef cmb(n, r):\n if r == 0 or r == n:\n return 1\n if r == 1:\n return n\n if (n, r) in nCr:\n return nCr[(n, r)]\n nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)\n return nCr[(n, r)]\n\n\na = int(eval(input()))\nb = [0 for i in range(15)]\nj = 0\nc = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]\nd = [0 for i in range(101)]\np = 0\npp = 0\ng = 0\ngg = 0\nggg = 0\nco = 0\nfor i in range(1, 101):\n k = i\n while True:\n if k % c[j] == 0 and k >= c[j]:\n b[j] += 1\n k \/\/= c[j]\n else:\n j += 1\n if j == 15:\n j = 0\n break\n for k in range(15):\n if b[k] >= 74:\n g += 1\n if b[k] >= 24:\n gg += 1\n if b[k] >= 14:\n ggg += 1\n if b[k] >= 4:\n p += 1\n if b[k] >= 2:\n pp += 1\n if i >= 10:\n d[i] = (\n cmb(p, 2) * cmb((pp - 2), 1)\n + cmb(g, 1)\n + cmb(gg, 1) * cmb((pp - 1), 1)\n + cmb(ggg, 1) * cmb((p - 1), 1)\n )\n p = 0\n pp = 0\n g = 0\n gg = 0\n ggg = 0\nprint((d[a]))\n","code_v1_no_empty_lines":"def cmb(n, r):\n if n - r < r:\n r = n - r\n if n <= 0:\n return 0\n if r == 0:\n return 1\n if r == 1:\n return n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n for p in range(2, r + 1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p - 1, r, p):\n numerator[k - offset] \/\/= pivot\n denominator[k] \/\/= pivot\n result = 1\n for k in range(r):\n if numerator[k] > 1:\n result *= int(numerator[k])\n return result\n\n\na = int(eval(input()))\nb = [0 for i in range(15)]\nj = 0\nc = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]\nd = [0 for i in range(101)]\np = 0\npp = 0\ng = 0\ngg = 0\nggg = 0\nco = 0\nfor i in range(1, 101):\n k = i\n while True:\n if k % c[j] == 0 and k >= c[j]:\n b[j] += 1\n k \/\/= c[j]\n else:\n j += 1\n if j == 15:\n j = 0\n break\n for k in range(15):\n if b[k] >= 74:\n g += 1\n if b[k] >= 24:\n gg += 1\n if b[k] >= 14:\n ggg += 1\n if b[k] >= 4:\n p += 1\n if b[k] >= 2:\n pp += 1\n if i >= 10:\n d[i] = (\n cmb(p, 2) * cmb((pp - 2), 1)\n + cmb(g, 1)\n + cmb(gg, 1) * cmb((pp - 1), 1)\n + cmb(ggg, 1) * cmb((p - 1), 1)\n )\n p = 0\n pp = 0\n g = 0\n gg = 0\n ggg = 0\nprint((d[a]))\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-from operator import mul","-from functools import reduce","-","-nCr = {}","-","-","- if r == 0 or r == n:","+ if n - r < r:","+ r = n - r","+ if n <= 0:","+ return 0","+ if r == 0:","- if (n, r) in nCr:","- return nCr[(n, r)]","- nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)","- return nCr[(n, r)]","+ numerator = [n - r + k + 1 for k in range(r)]","+ denominator = [k + 1 for k in range(r)]","+ for p in range(2, r + 1):","+ pivot = denominator[p - 1]","+ if pivot > 1:","+ offset = (n - r) % p","+ for k in range(p - 1, r, p):","+ numerator[k - offset] \/\/= pivot","+ denominator[k] \/\/= pivot","+ result = 1","+ for k in range(r):","+ if numerator[k] > 1:","+ result *= int(numerator[k])","+ return result"],"diff_only_import_comment":false,"measured_runtime_v0":0.0382284291,"measured_runtime_v1":0.039623379,"runtime_lift":0.9647947763,"key":["s518684407","s097419846"]} +{"user_id":"u906428167","problem_id":"p03166","language":"python","submission_id_v0":"s843798309","submission_id_v1":"s553016013","cpu_time_v0":875,"cpu_time_v1":380,"memory_v0":148976,"memory_v1":59312,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.57,"input":"import sys\n\nsys.setrecursionlimit(10 ** 7)\n\ninput = sys.stdin.readline\n\n\n\nn, m = list(map(int, input().split()))\n\n\n\ng = [[] for _ in range(n)]\n\nindeg = [0 for _ in range(n)]\n\n\n\nfor _ in range(m):\n\n x, y = list(map(int, input().split()))\n\n g[x-1].append(y-1)\n\n indeg[y-1] += 1\n\n\n\ndp = [-1 for _ in range(n)]\n\n\n\n\n\ndef LP(v):\n\n if dp[v] != -1:\n\n return dp[v]\n\n ans = 0\n\n for w in g[v]:\n\n ans = max(ans, LP(w)+1)\n\n dp[v] = ans\n\n return dp[v]\n\n\n\n\n\nfor i in range(n):\n\n LP(i)\n\n\n\nprint((max(dp)))\n","target":"from collections import deque\n\nimport sys\n\nsys.setrecursionlimit(10 ** 7)\n\ninput = sys.stdin.readline\n\n\n\nn, m = list(map(int, input().split()))\n\n\n\ng = [[] for _ in range(n)]\n\nindeg = [0 for _ in range(n)]\n\n\n\nfor _ in range(m):\n\n x, y = list(map(int, input().split()))\n\n g[x-1].append(y-1)\n\n indeg[y-1] += 1\n\n\n\ndp = [0 for _ in range(n)]\n\nq = deque([])\n\n\n\nfor i in range(n):\n\n if indeg[i] == 0:\n\n q.append(i)\n\n\n\nwhile q:\n\n v = q.popleft()\n\n for w in g[v]:\n\n indeg[w] -= 1\n\n if indeg[w] == 0:\n\n q.append(w)\n\n dp[w] = max(dp[w], dp[v]+1)\n\n\n\nprint((max(dp)))\n","code_v0_loc":31,"code_v1_loc":31,"code_v0_num_chars":517,"code_v1_num_chars":602,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\nn, m = list(map(int, input().split()))\ng = [[] for _ in range(n)]\nindeg = [0 for _ in range(n)]\nfor _ in range(m):\n x, y = list(map(int, input().split()))\n g[x - 1].append(y - 1)\n indeg[y - 1] += 1\ndp = [-1 for _ in range(n)]\n\n\ndef LP(v):\n if dp[v] != -1:\n return dp[v]\n ans = 0\n for w in g[v]:\n ans = max(ans, LP(w) + 1)\n dp[v] = ans\n return dp[v]\n\n\nfor i in range(n):\n LP(i)\nprint((max(dp)))\n","code_v1_no_empty_lines":"from collections import deque\nimport sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\nn, m = list(map(int, input().split()))\ng = [[] for _ in range(n)]\nindeg = [0 for _ in range(n)]\nfor _ in range(m):\n x, y = list(map(int, input().split()))\n g[x - 1].append(y - 1)\n indeg[y - 1] += 1\ndp = [0 for _ in range(n)]\nq = deque([])\nfor i in range(n):\n if indeg[i] == 0:\n q.append(i)\nwhile q:\n v = q.popleft()\n for w in g[v]:\n indeg[w] -= 1\n if indeg[w] == 0:\n q.append(w)\n dp[w] = max(dp[w], dp[v] + 1)\nprint((max(dp)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+from collections import deque","-dp = [-1 for _ in range(n)]","-","-","-def LP(v):","- if dp[v] != -1:","- return dp[v]","- ans = 0","+dp = [0 for _ in range(n)]","+q = deque([])","+for i in range(n):","+ if indeg[i] == 0:","+ q.append(i)","+while q:","+ v = q.popleft()","- ans = max(ans, LP(w) + 1)","- dp[v] = ans","- return dp[v]","-","-","-for i in range(n):","- LP(i)","+ indeg[w] -= 1","+ if indeg[w] == 0:","+ q.append(w)","+ dp[w] = max(dp[w], dp[v] + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0542092566,"measured_runtime_v1":0.0355106766,"runtime_lift":1.5265622002,"key":["s843798309","s553016013"]} +{"user_id":"u857547702","problem_id":"p02726","language":"python","submission_id_v0":"s753003783","submission_id_v1":"s906136466","cpu_time_v0":400,"cpu_time_v1":279,"memory_v0":136284,"memory_v1":45532,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.25,"input":"N,X,Y=list(map(int,input().split()))\n\nA=[[] for i in range(N+1)]\n\nfor i in range(1,N):\n\n for j in range(i,N+1):\n\n A[int(min(j-i,abs(X-i)+abs(Y-j)+1))].append(1)\n\n \n\nfor i in range(N):\n\n if i!=0:\n\n print((sum(A[i])))","target":"N,X,Y=list(map(int,input().split()))\n\nA=[0 for i in range(N)]\n\nfor i in range(1,N):\n\n for j in range(i+1,N+1):\n\n A[int(min(j-i,abs(X-i)+abs(Y-j)+1))]+=1 \n\ndel A[0]\n\nprint(*A,sep=('\\n'))\n","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":240,"code_v1_num_chars":196,"code_v0_no_empty_lines":"N, X, Y = list(map(int, input().split()))\nA = [[] for i in range(N + 1)]\nfor i in range(1, N):\n for j in range(i, N + 1):\n A[int(min(j - i, abs(X - i) + abs(Y - j) + 1))].append(1)\nfor i in range(N):\n if i != 0:\n print((sum(A[i])))\n","code_v1_no_empty_lines":"N, X, Y = list(map(int, input().split()))\nA = [0 for i in range(N)]\nfor i in range(1, N):\n for j in range(i + 1, N + 1):\n A[int(min(j - i, abs(X - i) + abs(Y - j) + 1))] += 1\ndel A[0]\nprint(*A, sep=(\"\\n\"))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-A = [[] for i in range(N + 1)]","+A = [0 for i in range(N)]","- for j in range(i, N + 1):","- A[int(min(j - i, abs(X - i) + abs(Y - j) + 1))].append(1)","-for i in range(N):","- if i != 0:","- print((sum(A[i])))","+ for j in range(i + 1, N + 1):","+ A[int(min(j - i, abs(X - i) + abs(Y - j) + 1))] += 1","+del A[0]","+print(*A, sep=(\"\\n\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0368134947,"measured_runtime_v1":0.0380719695,"runtime_lift":0.9669448454,"key":["s753003783","s906136466"]} +{"user_id":"u485319545","problem_id":"p02899","language":"python","submission_id_v0":"s535896149","submission_id_v1":"s385749573","cpu_time_v0":188,"cpu_time_v1":168,"memory_v0":27064,"memory_v1":26976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.64,"input":"N=int(eval(input()))\n\nStudents=list(map(int,input().split()))\n\n\n\n\n\nd={}\n\n\n\nfor i in range(N):\n\n d[i+1]=Students[i]\n\n\n\nd_2 = sorted(list(d.items()),key=lambda x: x[1])\n\n\n\nans=[]\n\nfor k in d_2:\n\n ans.append(k[0])\n\n\n\nprint((*ans))","target":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\n\n\nb=[]\n\nfor i in range(n):\n\n tmp=[i+1,a[i]]\n\n b.append(tmp)\n\n\n\nb=sorted(b,key=lambda x:x[1])\n\n\n\n\n\nans=[]\n\nfor j in b:\n\n ans.append(j[0])\n\n\n\nprint((*ans))","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":219,"code_v1_num_chars":210,"code_v0_no_empty_lines":"N = int(eval(input()))\nStudents = list(map(int, input().split()))\nd = {}\nfor i in range(N):\n d[i + 1] = Students[i]\nd_2 = sorted(list(d.items()), key=lambda x: x[1])\nans = []\nfor k in d_2:\n ans.append(k[0])\nprint((*ans))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nb = []\nfor i in range(n):\n tmp = [i + 1, a[i]]\n b.append(tmp)\nb = sorted(b, key=lambda x: x[1])\nans = []\nfor j in b:\n ans.append(j[0])\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-N = int(eval(input()))","-Students = list(map(int, input().split()))","-d = {}","-for i in range(N):","- d[i + 1] = Students[i]","-d_2 = sorted(list(d.items()), key=lambda x: x[1])","+n = int(eval(input()))","+a = list(map(int, input().split()))","+b = []","+for i in range(n):","+ tmp = [i + 1, a[i]]","+ b.append(tmp)","+b = sorted(b, key=lambda x: x[1])","-for k in d_2:","- ans.append(k[0])","+for j in b:","+ ans.append(j[0])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0420469949,"measured_runtime_v1":0.0456423322,"runtime_lift":0.9212280096,"key":["s535896149","s385749573"]} +{"user_id":"u344276999","problem_id":"p03763","language":"python","submission_id_v0":"s554380358","submission_id_v1":"s389686830","cpu_time_v0":30,"cpu_time_v1":26,"memory_v0":9204,"memory_v1":9192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.33,"input":"n = int(input())\n\nss = \"abcdefghijklmnopqrstuvwxyz\"\n\ndmin = {}\n\nfor s in ss:\n\n dmin[s] = 51\n\n\n\nfor i in range(n):\n\n S = input()\n\n\n\n d ={}\n\n for s in S:\n\n if s not in d.keys():\n\n d[s] = 1\n\n else:\n\n d[s] += 1\n\n \n\n for s in ss:\n\n if s not in d.keys():\n\n dmin[s] = 0\n\n\n\n for s in d.keys():\n\n dmin[s] = min(dmin[s], d[s])\n\nfor k in dmin.keys():\n\n print(k*dmin[k],sep=\"\",end=\"\")\n\nprint()\n","target":"n = int(input())\n\nss = \"abcdefghijklmnopqrstuvwxyz\"\n\ndmin = {}\n\nfor s in ss:\n\n dmin[s] = 51\n\n\n\nfor i in range(n):\n\n S = input()\n\n\n\n d ={}\n\n for s in S:\n\n if s not in d.keys():\n\n d[s] = 1\n\n else:\n\n d[s] += 1\n\n \n\n for s in ss:\n\n if s not in d.keys():\n\n dmin[s] = 0\n\n\n\n for s in d.keys():\n\n dmin[s] = min(dmin[s], d[s])\n\nfor k in dmin.keys():\n\n print(k*dmin[k],sep=\"\",end=\"\")\n","code_v0_loc":25,"code_v1_loc":24,"code_v0_num_chars":416,"code_v1_num_chars":407,"code_v0_no_empty_lines":"n = int(input())\nss = \"abcdefghijklmnopqrstuvwxyz\"\ndmin = {}\nfor s in ss:\n dmin[s] = 51\nfor i in range(n):\n S = input()\n d = {}\n for s in S:\n if s not in d.keys():\n d[s] = 1\n else:\n d[s] += 1\n for s in ss:\n if s not in d.keys():\n dmin[s] = 0\n for s in d.keys():\n dmin[s] = min(dmin[s], d[s])\nfor k in dmin.keys():\n print(k * dmin[k], sep=\"\", end=\"\")\nprint()\n","code_v1_no_empty_lines":"n = int(input())\nss = \"abcdefghijklmnopqrstuvwxyz\"\ndmin = {}\nfor s in ss:\n dmin[s] = 51\nfor i in range(n):\n S = input()\n d = {}\n for s in S:\n if s not in d.keys():\n d[s] = 1\n else:\n d[s] += 1\n for s in ss:\n if s not in d.keys():\n dmin[s] = 0\n for s in d.keys():\n dmin[s] = min(dmin[s], d[s])\nfor k in dmin.keys():\n print(k * dmin[k], sep=\"\", end=\"\")\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["-print()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422935009,"measured_runtime_v1":0.0395523071,"runtime_lift":1.0693055339,"key":["s554380358","s389686830"]} +{"user_id":"u780475861","problem_id":"p03251","language":"python","submission_id_v0":"s684143711","submission_id_v1":"s911715305","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"n,m,x,y = list(map(int,input().split()))\n\n\n\nx1 = max([int(i) for i in input().split()]) + 1\n\ny1 = min([int(i) for i in input().split()])\n\n\n\nif x1 <= y1 and x1 <= y and y1 > x:\n\n print('No War')\n\nelse:\n\n print('War')","target":"n,m,x,y = list(map(int,input().split()))\n\n\n\nx1 = max(list(map(int,input().split()))) + 1\n\ny1 = min(list(map(int,input().split())))\n\n\n\nif x1 <= y1 and x1 <= y and y1 > x:\n\n print('No War')\n\nelse:\n\n print('War')","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":215,"code_v1_num_chars":197,"code_v0_no_empty_lines":"n, m, x, y = list(map(int, input().split()))\nx1 = max([int(i) for i in input().split()]) + 1\ny1 = min([int(i) for i in input().split()])\nif x1 <= y1 and x1 <= y and y1 > x:\n print(\"No War\")\nelse:\n print(\"War\")\n","code_v1_no_empty_lines":"n, m, x, y = list(map(int, input().split()))\nx1 = max(list(map(int, input().split()))) + 1\ny1 = min(list(map(int, input().split())))\nif x1 <= y1 and x1 <= y and y1 > x:\n print(\"No War\")\nelse:\n print(\"War\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-x1 = max([int(i) for i in input().split()]) + 1","-y1 = min([int(i) for i in input().split()])","+x1 = max(list(map(int, input().split()))) + 1","+y1 = min(list(map(int, input().split())))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1051585457,"measured_runtime_v1":0.1172288306,"runtime_lift":0.8970365499,"key":["s684143711","s911715305"]} +{"user_id":"u757274384","problem_id":"p02712","language":"python","submission_id_v0":"s684047196","submission_id_v1":"s244035883","cpu_time_v0":247,"cpu_time_v1":177,"memory_v0":33656,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.34,"input":"n = int(eval(input()))\n\nl = []\n\nfor i in range(n):\n\n if (i+1)%3 != 0 and (i+1)%5 != 0:\n\n l.append(i+1)\n\n else:\n\n l.append(0)\n\nprint((sum(l)))","target":"n = int(eval(input()))\n\nans = 0\n\nfor i in range(n+1):\n\n if i%3 == 0 or i%5 == 0:\n\n ans += 0\n\n else:\n\n ans += i\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":141,"code_v1_num_chars":124,"code_v0_no_empty_lines":"n = int(eval(input()))\nl = []\nfor i in range(n):\n if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:\n l.append(i + 1)\n else:\n l.append(0)\nprint((sum(l)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = 0\nfor i in range(n + 1):\n if i % 3 == 0 or i % 5 == 0:\n ans += 0\n else:\n ans += i\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-l = []","-for i in range(n):","- if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:","- l.append(i + 1)","+ans = 0","+for i in range(n + 1):","+ if i % 3 == 0 or i % 5 == 0:","+ ans += 0","- l.append(0)","-print((sum(l)))","+ ans += i","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2800400102,"measured_runtime_v1":0.2065781333,"runtime_lift":1.3556130345,"key":["s684047196","s244035883"]} +{"user_id":"u130900604","problem_id":"p03634","language":"python","submission_id_v0":"s853410239","submission_id_v1":"s146886629","cpu_time_v0":1620,"cpu_time_v1":1494,"memory_v0":83252,"memory_v1":44376,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.78,"input":"# !\u5165\u529b\n\n# \u30b0\u30e9\u30d5\u306e\u69cb\u7bc9\n\n# \u30af\u30a8\u30ea\u306e\u5165\u529b\n\n# K\u304b\u3089\u306e\u5404\u70b9\u306e\u306e\u8ddd\u96e2\u3092dfs\n\n# \u30af\u30a8\u30ea\u306e\u51e6\u7406\n\nfrom collections import deque\n\nn=int(eval(input()))\n\nedge=[[]for _ in range(n)]\n\nfor i in range(n-1):\n\n a,b,c=list(map(int,input().split()))\n\n edge[a-1].append((b-1,c))\n\n edge[b-1].append((a-1,c))\n\nq,k=list(map(int,input().split()))\n\ndist=[0]*n\n\nseen=[False]*n\n\ntodo=deque([k-1])\n\nwhile todo:\n\n par=todo.pop()\n\n seen[par]=True\n\n for cld,cost in edge[par]:\n\n if dist[cld]==0:\n\n if seen[cld]==False:\n\n dist[cld]=dist[par]+cost\n\n seen[cld]=True\n\n todo.append(cld)\n\n\n\nfor i in range(q):\n\n x,y=list(map(int,input().split()))\n\n print((dist[x-1]+dist[y-1]))\n\n \n\n ","target":"# !\u5165\u529b\n\n# \u30b0\u30e9\u30d5\u306e\u69cb\u7bc9\n\n# \u30af\u30a8\u30ea\u306e\u5165\u529b\n\n# K\u304b\u3089\u306e\u5404\u70b9\u306e\u306e\u8ddd\u96e2\u3092dfs\n\n# \u30af\u30a8\u30ea\u306e\u51e6\u7406\n\nfrom collections import deque\n\nn=int(eval(input()))\n\nedge=[[]for _ in range(n)]\n\nfor i in range(n-1):\n\n a,b,c=list(map(int,input().split()))\n\n edge[a-1].append((b-1,c))\n\n edge[b-1].append((a-1,c))\n\nq,k=list(map(int,input().split()))\n\ndist=[0]*n\n\nseen=[False]*n\n\ntodo=deque([k-1])\n\nwhile todo:\n\n par=todo.popleft()\n\n seen[par]=True\n\n for cld,cost in edge[par]:\n\n if dist[cld]==0:\n\n if seen[cld]==False:\n\n dist[cld]=dist[par]+cost\n\n seen[cld]=True\n\n todo.append(cld)\n\n\n\nfor i in range(q):\n\n x,y=list(map(int,input().split()))\n\n print((dist[x-1]+dist[y-1]))\n\n \n\n ","code_v0_loc":31,"code_v1_loc":31,"code_v0_num_chars":624,"code_v1_num_chars":628,"code_v0_no_empty_lines":"# !\u5165\u529b\n# \u30b0\u30e9\u30d5\u306e\u69cb\u7bc9\n# \u30af\u30a8\u30ea\u306e\u5165\u529b\n# K\u304b\u3089\u306e\u5404\u70b9\u306e\u306e\u8ddd\u96e2\u3092dfs\n# \u30af\u30a8\u30ea\u306e\u51e6\u7406\nfrom collections import deque\n\nn = int(eval(input()))\nedge = [[] for _ in range(n)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n edge[a - 1].append((b - 1, c))\n edge[b - 1].append((a - 1, c))\nq, k = list(map(int, input().split()))\ndist = [0] * n\nseen = [False] * n\ntodo = deque([k - 1])\nwhile todo:\n par = todo.pop()\n seen[par] = True\n for cld, cost in edge[par]:\n if dist[cld] == 0:\n if seen[cld] == False:\n dist[cld] = dist[par] + cost\n seen[cld] = True\n todo.append(cld)\nfor i in range(q):\n x, y = list(map(int, input().split()))\n print((dist[x - 1] + dist[y - 1]))\n","code_v1_no_empty_lines":"# !\u5165\u529b\n# \u30b0\u30e9\u30d5\u306e\u69cb\u7bc9\n# \u30af\u30a8\u30ea\u306e\u5165\u529b\n# K\u304b\u3089\u306e\u5404\u70b9\u306e\u306e\u8ddd\u96e2\u3092dfs\n# \u30af\u30a8\u30ea\u306e\u51e6\u7406\nfrom collections import deque\n\nn = int(eval(input()))\nedge = [[] for _ in range(n)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n edge[a - 1].append((b - 1, c))\n edge[b - 1].append((a - 1, c))\nq, k = list(map(int, input().split()))\ndist = [0] * n\nseen = [False] * n\ntodo = deque([k - 1])\nwhile todo:\n par = todo.popleft()\n seen[par] = True\n for cld, cost in edge[par]:\n if dist[cld] == 0:\n if seen[cld] == False:\n dist[cld] = dist[par] + cost\n seen[cld] = True\n todo.append(cld)\nfor i in range(q):\n x, y = list(map(int, input().split()))\n print((dist[x - 1] + dist[y - 1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- par = todo.pop()","+ par = todo.popleft()"],"diff_only_import_comment":false,"measured_runtime_v0":0.1459831829,"measured_runtime_v1":0.0828922527,"runtime_lift":1.7611197448,"key":["s853410239","s146886629"]} +{"user_id":"u063052907","problem_id":"p03680","language":"python","submission_id_v0":"s933175682","submission_id_v1":"s230130956","cpu_time_v0":195,"cpu_time_v1":68,"memory_v0":7084,"memory_v1":7084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.13,"input":"# coding: utf-8\n\nimport sys\n\n\n\nN = int(eval(input()))\n\nlst = [int(eval(input())) for _ in range(N)]\n\n\n\nbtn = 1\n\ncnt = 0\n\nfor a in lst:\n\n btn = lst[btn-1]\n\n cnt += 1\n\n if btn == 2:\n\n print(cnt)\n\n sys.exit()\n\nprint((-1))","target":"# coding: utf-8\n\nimport sys\n\n\n\nN = int(eval(input()))\n\nlst = [int(i) for i in sys.stdin]\n\n\n\nbtn = 1\n\ncnt = 0\n\nfor a in lst:\n\n btn = lst[btn-1]\n\n cnt += 1\n\n if btn == 2:\n\n print(cnt)\n\n sys.exit()\n\nprint((-1))","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":227,"code_v1_num_chars":222,"code_v0_no_empty_lines":"# coding: utf-8\nimport sys\n\nN = int(eval(input()))\nlst = [int(eval(input())) for _ in range(N)]\nbtn = 1\ncnt = 0\nfor a in lst:\n btn = lst[btn - 1]\n cnt += 1\n if btn == 2:\n print(cnt)\n sys.exit()\nprint((-1))\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\n\nN = int(eval(input()))\nlst = [int(i) for i in sys.stdin]\nbtn = 1\ncnt = 0\nfor a in lst:\n btn = lst[btn - 1]\n cnt += 1\n if btn == 2:\n print(cnt)\n sys.exit()\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-lst = [int(eval(input())) for _ in range(N)]","+lst = [int(i) for i in sys.stdin]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0919818604,"measured_runtime_v1":0.0438631759,"runtime_lift":2.0970177958,"key":["s933175682","s230130956"]} +{"user_id":"u279493135","problem_id":"p03087","language":"python","submission_id_v0":"s279085854","submission_id_v1":"s859611208","cpu_time_v0":368,"cpu_time_v1":316,"memory_v0":31540,"memory_v1":10952,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.13,"input":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import permutations, combinations, product\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\nN, Q = MAP()\n\nS = eval(input())\n\nlr = [LIST() for _ in range(Q)]\n\n\n\naccum = []\n\ncount = 0\n\n\n\nfor i in range(len(S)-1):\n\n\taccum.append(count)\n\n\tif S[i] == \"A\" and S[i+1] == \"C\":\n\n\t\tcount += 1\n\naccum.append(count)\n\n# print(accum)\n\nfor l, r in lr:\n\n\tprint((accum[r-1]-accum[l-1]))\n","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import accumulate, permutations, combinations, product\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nN, Q = MAP()\n\nS = eval(input())\n\n\n\nlis = [0]*N\n\ncount = 0\n\n\n\nfor i in range(N-1):\n\n\tif S[i] == \"A\" and S[i+1] == \"C\":\n\n\t\tlis[i+1] = 1\n\n\n\nlis_acc = list(accumulate(lis))\n\n\n\nfor _ in range(Q):\n\n\tl, r = MAP()\n\n\tprint((lis_acc[r-1]-lis_acc[l-1]))\n","code_v0_loc":31,"code_v1_loc":34,"code_v0_num_chars":848,"code_v1_num_chars":957,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nMOD = 10**9 + 7\nN, Q = MAP()\nS = eval(input())\nlr = [LIST() for _ in range(Q)]\naccum = []\ncount = 0\nfor i in range(len(S) - 1):\n accum.append(count)\n if S[i] == \"A\" and S[i + 1] == \"C\":\n count += 1\naccum.append(count)\n# print(accum)\nfor l, r in lr:\n print((accum[r - 1] - accum[l - 1]))\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import accumulate, permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nN, Q = MAP()\nS = eval(input())\nlis = [0] * N\ncount = 0\nfor i in range(N - 1):\n if S[i] == \"A\" and S[i + 1] == \"C\":\n lis[i + 1] = 1\nlis_acc = list(accumulate(lis))\nfor _ in range(Q):\n l, r = MAP()\n print((lis_acc[r - 1] - lis_acc[l - 1]))\n","code_same":false,"relative_loc_diff_percent":8.8235294118,"diff":["-from itertools import permutations, combinations, product","+from itertools import accumulate, permutations, combinations, product","+from bisect import bisect, bisect_left","+from fractions import gcd","+from heapq import heappush, heappop","+from functools import reduce","-MOD = 10**9 + 7","+mod = 10**9 + 7","-lr = [LIST() for _ in range(Q)]","-accum = []","+lis = [0] * N","-for i in range(len(S) - 1):","- accum.append(count)","+for i in range(N - 1):","- count += 1","-accum.append(count)","-# print(accum)","-for l, r in lr:","- print((accum[r - 1] - accum[l - 1]))","+ lis[i + 1] = 1","+lis_acc = list(accumulate(lis))","+for _ in range(Q):","+ l, r = MAP()","+ print((lis_acc[r - 1] - lis_acc[l - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0421501095,"measured_runtime_v1":0.1058602951,"runtime_lift":0.3981673157,"key":["s279085854","s859611208"]} +{"user_id":"u991567869","problem_id":"p02832","language":"python","submission_id_v0":"s730862160","submission_id_v1":"s382544465","cpu_time_v0":102,"cpu_time_v1":90,"memory_v0":24744,"memory_v1":24744,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.76,"input":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\ncnt = 1\n\nans = 0\n\n\n\nfor i in range(n):\n\n if a[i] != cnt:\n\n ans += 1\n\n else:\n\n cnt += 1\n\n\n\nif ans == n:\n\n print((-1))\n\nelse:\n\n print(ans)","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\nans = 0\n\ncnt = 1\n\n\n\nfor i in a:\n\n if cnt == i:\n\n cnt += 1\n\n else:\n\n ans += 1\n\nif ans == n:\n\n print((-1))\n\nelse:\n\n print(ans)","code_v0_loc":15,"code_v1_loc":14,"code_v0_num_chars":215,"code_v1_num_chars":203,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\ncnt = 1\nans = 0\nfor i in range(n):\n if a[i] != cnt:\n ans += 1\n else:\n cnt += 1\nif ans == n:\n print((-1))\nelse:\n print(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nans = 0\ncnt = 1\nfor i in a:\n if cnt == i:\n cnt += 1\n else:\n ans += 1\nif ans == n:\n print((-1))\nelse:\n print(ans)\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["+ans = 0","-ans = 0","-for i in range(n):","- if a[i] != cnt:","+for i in a:","+ if cnt == i:","+ cnt += 1","+ else:","- else:","- cnt += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.045372376,"measured_runtime_v1":0.0451496084,"runtime_lift":1.004933987,"key":["s730862160","s382544465"]} +{"user_id":"u241159583","problem_id":"p02606","language":"python","submission_id_v0":"s311937727","submission_id_v1":"s518093892","cpu_time_v0":33,"cpu_time_v1":29,"memory_v0":9096,"memory_v1":9044,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.12,"input":"l,r,d = list(map(int, input().split()))\n\ncnt = 0\n\nfor i in range(l,r+1):\n\n if i%d==0: cnt += 1\n\nprint(cnt)","target":"l,r,d = list(map(int, input().split()))\n\nprint((r\/\/d - (l-1)\/\/d))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":103,"code_v1_num_chars":57,"code_v0_no_empty_lines":"l, r, d = list(map(int, input().split()))\ncnt = 0\nfor i in range(l, r + 1):\n if i % d == 0:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"l, r, d = list(map(int, input().split()))\nprint((r \/\/ d - (l - 1) \/\/ d))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-cnt = 0","-for i in range(l, r + 1):","- if i % d == 0:","- cnt += 1","-print(cnt)","+print((r \/\/ d - (l - 1) \/\/ d))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0347307653,"measured_runtime_v1":0.041483032,"runtime_lift":0.8372282273,"key":["s311937727","s518093892"]} +{"user_id":"u296150111","problem_id":"p03215","language":"python","submission_id_v0":"s931244507","submission_id_v1":"s153702985","cpu_time_v0":485,"cpu_time_v1":431,"memory_v0":112256,"memory_v1":111948,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.13,"input":"n,k=list(map(int,input().split()))\n\na=[0]+list(map(int,input().split()))\n\np=[]\n\nfor i in range(n):\n\n\ta[i+1]+=a[i]\n\nfor i in range(n+1):\n\n\tfor j in range(i):\n\n\t\tp.append(a[i]-a[j])\n\np.sort(reverse=True)\n\nans=0\n\nfrom math import log,ceil\n\nr=ceil(log(sum(p))+10**-3)\n\nfor i in range(r+3,-1,-1):\n\n\tcnt=0\n\n\tfor j in range(len(p)):\n\n\t\tif (ans+2**i)&p[j]==ans+2**i:\n\n\t\t\tcnt+=1\n\n\t\tif cnt==k:\n\n\t\t\tbreak\n\n\tif cnt==k:\n\n\t\tans+=2**i\n\nprint(ans)","target":"def main():\n\n\tn,k=list(map(int,input().split()))\n\n\ta=[0]+list(map(int,input().split()))\n\n\tp=[]\n\n\tfor i in range(n):\n\n\t\ta[i+1]+=a[i]\n\n\tfor i in range(n+1):\n\n\t\tfor j in range(i):\n\n\t\t\tp.append(a[i]-a[j])\n\n\tp.sort()\n\n\tans=0\n\n\tfrom math import log,ceil\n\n\tr=ceil(log(sum(p))+10**-3)\n\n\tfor i in range(r+2,-1,-1):\n\n\t\tcnt=0\n\n\t\tfor j in range(len(p)):\n\n\t\t\tif (ans+2**i)&p[j]==ans+2**i:\n\n\t\t\t\tcnt+=1\n\n\t\t\t\tif cnt==k:\n\n\t\t\t\t\tbreak\n\n\t\tif cnt==k:\n\n\t\t\tans+=2**i\n\n\tprint(ans)\n\nif __name__ == '__main__':\n\n\tmain()","code_v0_loc":22,"code_v1_loc":25,"code_v0_num_chars":425,"code_v1_num_chars":487,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\na = [0] + list(map(int, input().split()))\np = []\nfor i in range(n):\n a[i + 1] += a[i]\nfor i in range(n + 1):\n for j in range(i):\n p.append(a[i] - a[j])\np.sort(reverse=True)\nans = 0\nfrom math import log, ceil\n\nr = ceil(log(sum(p)) + 10**-3)\nfor i in range(r + 3, -1, -1):\n cnt = 0\n for j in range(len(p)):\n if (ans + 2**i) & p[j] == ans + 2**i:\n cnt += 1\n if cnt == k:\n break\n if cnt == k:\n ans += 2**i\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n n, k = list(map(int, input().split()))\n a = [0] + list(map(int, input().split()))\n p = []\n for i in range(n):\n a[i + 1] += a[i]\n for i in range(n + 1):\n for j in range(i):\n p.append(a[i] - a[j])\n p.sort()\n ans = 0\n from math import log, ceil\n\n r = ceil(log(sum(p)) + 10**-3)\n for i in range(r + 2, -1, -1):\n cnt = 0\n for j in range(len(p)):\n if (ans + 2**i) & p[j] == ans + 2**i:\n cnt += 1\n if cnt == k:\n break\n if cnt == k:\n ans += 2**i\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["-n, k = list(map(int, input().split()))","-a = [0] + list(map(int, input().split()))","-p = []","-for i in range(n):","- a[i + 1] += a[i]","-for i in range(n + 1):","- for j in range(i):","- p.append(a[i] - a[j])","-p.sort(reverse=True)","-ans = 0","-from math import log, ceil","+def main():","+ n, k = list(map(int, input().split()))","+ a = [0] + list(map(int, input().split()))","+ p = []","+ for i in range(n):","+ a[i + 1] += a[i]","+ for i in range(n + 1):","+ for j in range(i):","+ p.append(a[i] - a[j])","+ p.sort()","+ ans = 0","+ from math import log, ceil","-r = ceil(log(sum(p)) + 10**-3)","-for i in range(r + 3, -1, -1):","- cnt = 0","- for j in range(len(p)):","- if (ans + 2**i) & p[j] == ans + 2**i:","- cnt += 1","+ r = ceil(log(sum(p)) + 10**-3)","+ for i in range(r + 2, -1, -1):","+ cnt = 0","+ for j in range(len(p)):","+ if (ans + 2**i) & p[j] == ans + 2**i:","+ cnt += 1","+ if cnt == k:","+ break","- break","- if cnt == k:","- ans += 2**i","-print(ans)","+ ans += 2**i","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0459169567,"measured_runtime_v1":0.0453025559,"runtime_lift":1.0135621676,"key":["s931244507","s153702985"]} +{"user_id":"u606045429","problem_id":"p02726","language":"python","submission_id_v0":"s091889336","submission_id_v1":"s081232679","cpu_time_v0":1983,"cpu_time_v1":1539,"memory_v0":3444,"memory_v1":3700,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.39,"input":"from itertools import combinations\n\n\n\nN, X, Y = list(map(int, input().split()))\n\n\n\nA = [0] * N\n\nfor i, j in combinations(list(range(1, N + 1)), 2):\n\n A[min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(X - j) + abs(Y - i) + 1)] += 1\n\n\n\nfor a in A[1:]:\n\n print(a)","target":"from itertools import combinations\n\nfrom collections import Counter\n\n\n\nN, X, Y = list(map(int, input().split()))\n\n\n\nC = Counter(min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(X - j) + abs(Y - i) + 1) for i, j in combinations(list(range(1, N + 1)), 2))\n\n\n\nprint((\"\\n\".join(str(C[k]) for k in range(1, N))))","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":255,"code_v1_num_chars":293,"code_v0_no_empty_lines":"from itertools import combinations\n\nN, X, Y = list(map(int, input().split()))\nA = [0] * N\nfor i, j in combinations(list(range(1, N + 1)), 2):\n A[min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(X - j) + abs(Y - i) + 1)] += 1\nfor a in A[1:]:\n print(a)\n","code_v1_no_empty_lines":"from itertools import combinations\nfrom collections import Counter\n\nN, X, Y = list(map(int, input().split()))\nC = Counter(\n min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(X - j) + abs(Y - i) + 1)\n for i, j in combinations(list(range(1, N + 1)), 2)\n)\nprint((\"\\n\".join(str(C[k]) for k in range(1, N))))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["+from collections import Counter","-A = [0] * N","-for i, j in combinations(list(range(1, N + 1)), 2):","- A[min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(X - j) + abs(Y - i) + 1)] += 1","-for a in A[1:]:","- print(a)","+C = Counter(","+ min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(X - j) + abs(Y - i) + 1)","+ for i, j in combinations(list(range(1, N + 1)), 2)","+)","+print((\"\\n\".join(str(C[k]) for k in range(1, N))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0345072885,"measured_runtime_v1":0.0363644547,"runtime_lift":0.9489290761,"key":["s091889336","s081232679"]} +{"user_id":"u596536048","problem_id":"p03105","language":"python","submission_id_v0":"s111810570","submission_id_v1":"s982902918","cpu_time_v0":29,"cpu_time_v1":26,"memory_v0":9140,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.34,"input":"A, B, C = list(map(int, input().split()))\n\nprint((C if B \/\/ A > C else B \/\/ A))","target":"A, B, C = list(map(int, input().split()))\n\nprint((min(C, B \/\/ A)))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":71,"code_v1_num_chars":58,"code_v0_no_empty_lines":"A, B, C = list(map(int, input().split()))\nprint((C if B \/\/ A > C else B \/\/ A))\n","code_v1_no_empty_lines":"A, B, C = list(map(int, input().split()))\nprint((min(C, B \/\/ A)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((C if B \/\/ A > C else B \/\/ A))","+print((min(C, B \/\/ A)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0411664653,"measured_runtime_v1":0.0381821148,"runtime_lift":1.0781609517,"key":["s111810570","s982902918"]} +{"user_id":"u906501980","problem_id":"p02690","language":"python","submission_id_v0":"s925480933","submission_id_v1":"s116904709","cpu_time_v0":400,"cpu_time_v1":37,"memory_v0":81088,"memory_v1":9176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.75,"input":"def main():\n\n x = int(eval(input()))\n\n for a in range(-120, 121):\n\n for b in range(-120, 121):\n\n if (a**5-b**5==x):\n\n print((a, b))\n\n exit(0)\n\n \n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"def main():\n\n x = int(eval(input()))\n\n for i in range(-120, 121):\n\n for j in range(-120, 121):\n\n if i**5 - j**5 == x:\n\n print((i, j))\n\n exit(0)\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":235,"code_v1_num_chars":231,"code_v0_no_empty_lines":"def main():\n x = int(eval(input()))\n for a in range(-120, 121):\n for b in range(-120, 121):\n if a**5 - b**5 == x:\n print((a, b))\n exit(0)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n x = int(eval(input()))\n for i in range(-120, 121):\n for j in range(-120, 121):\n if i**5 - j**5 == x:\n print((i, j))\n exit(0)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["- for a in range(-120, 121):","- for b in range(-120, 121):","- if a**5 - b**5 == x:","- print((a, b))","+ for i in range(-120, 121):","+ for j in range(-120, 121):","+ if i**5 - j**5 == x:","+ print((i, j))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0522337377,"measured_runtime_v1":0.0698711673,"runtime_lift":0.7475721344,"key":["s925480933","s116904709"]} +{"user_id":"u425762225","problem_id":"p03945","language":"python","submission_id_v0":"s387805338","submission_id_v1":"s730219150","cpu_time_v0":43,"cpu_time_v1":37,"memory_v0":9204,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.95,"input":"#!\/usr\/bin\/env python3\n\n\n\n# from numba import njit\n\n\n\n# input = stdin.readline\n\n\n\ndef calcGroup(s):\n\n whiteCount = 0\n\n blackCount = 0\n\n prev = \"\"\n\n for i in range(len(s)):\n\n if s[i] == prev:\n\n pass\n\n else:\n\n if s[i] == \"W\":\n\n whiteCount += 1\n\n elif s[i] == \"B\":\n\n blackCount += 1\n\n else:\n\n raise ValueError\n\n prev = s[i]\n\n return whiteCount,blackCount\n\n\n\n# @njit\n\ndef solve(s):\n\n white,black = calcGroup(s)\n\n if abs(white-black) == 0:\n\n return (white-1)*2+1\n\n else:\n\n return min(white,black)*2\n\n\n\n\n\n\n\ndef main():\n\n s = eval(input())\n\n print((solve(s)))\n\n return\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#!\/usr\/bin\/env python3\n\n\n\n# from numba import njit\n\n\n\n# input = stdin.readline\n\n\n\ndef calcDivision(s):\n\n res = 0\n\n prev = \"\"\n\n for i in range(len(s)):\n\n if s[i] == prev:\n\n pass\n\n else:\n\n if prev == \"\":\n\n pass\n\n else:\n\n res += 1\n\n prev = s[i]\n\n return res\n\n\n\n# @njit\n\ndef solve(s):\n\n return calcDivision(s)\n\n\n\n\n\n\n\ndef main():\n\n s = eval(input())\n\n print((solve(s)))\n\n return\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":40,"code_v1_loc":33,"code_v0_num_chars":661,"code_v1_num_chars":452,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\n# from numba import njit\n# input = stdin.readline\ndef calcGroup(s):\n whiteCount = 0\n blackCount = 0\n prev = \"\"\n for i in range(len(s)):\n if s[i] == prev:\n pass\n else:\n if s[i] == \"W\":\n whiteCount += 1\n elif s[i] == \"B\":\n blackCount += 1\n else:\n raise ValueError\n prev = s[i]\n return whiteCount, blackCount\n\n\n# @njit\ndef solve(s):\n white, black = calcGroup(s)\n if abs(white - black) == 0:\n return (white - 1) * 2 + 1\n else:\n return min(white, black) * 2\n\n\ndef main():\n s = eval(input())\n print((solve(s)))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\n# from numba import njit\n# input = stdin.readline\ndef calcDivision(s):\n res = 0\n prev = \"\"\n for i in range(len(s)):\n if s[i] == prev:\n pass\n else:\n if prev == \"\":\n pass\n else:\n res += 1\n prev = s[i]\n return res\n\n\n# @njit\ndef solve(s):\n return calcDivision(s)\n\n\ndef main():\n s = eval(input())\n print((solve(s)))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":17.5,"diff":["-def calcGroup(s):","- whiteCount = 0","- blackCount = 0","+def calcDivision(s):","+ res = 0","- if s[i] == \"W\":","- whiteCount += 1","- elif s[i] == \"B\":","- blackCount += 1","+ if prev == \"\":","+ pass","- raise ValueError","+ res += 1","- return whiteCount, blackCount","+ return res","- white, black = calcGroup(s)","- if abs(white - black) == 0:","- return (white - 1) * 2 + 1","- else:","- return min(white, black) * 2","+ return calcDivision(s)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0375813613,"measured_runtime_v1":0.0374902961,"runtime_lift":1.0024290328,"key":["s387805338","s730219150"]} +{"user_id":"u641722141","problem_id":"p03470","language":"python","submission_id_v0":"s902740230","submission_id_v1":"s967122521","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"cnt = int(eval(input()))\n\nset1 = set([int(eval(input())) for i in range(cnt)])\n\nprint((len(set1)))","target":"n= int(eval(input()))\n\nlst = [0] * (100 + 1)\n\n\n\nfor i in range(n):\n\n lst[int(eval(input()))] = 1\n\n\n\nans = 0\n\nfor j in lst:\n\n ans += j\n\nprint(ans)\n\n ","code_v0_loc":3,"code_v1_loc":11,"code_v0_num_chars":84,"code_v1_num_chars":145,"code_v0_no_empty_lines":"cnt = int(eval(input()))\nset1 = set([int(eval(input())) for i in range(cnt)])\nprint((len(set1)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nlst = [0] * (100 + 1)\nfor i in range(n):\n lst[int(eval(input()))] = 1\nans = 0\nfor j in lst:\n ans += j\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":72.7272727273,"diff":["-cnt = int(eval(input()))","-set1 = set([int(eval(input())) for i in range(cnt)])","-print((len(set1)))","+n = int(eval(input()))","+lst = [0] * (100 + 1)","+for i in range(n):","+ lst[int(eval(input()))] = 1","+ans = 0","+for j in lst:","+ ans += j","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0368629894,"measured_runtime_v1":0.0381840703,"runtime_lift":0.965402302,"key":["s902740230","s967122521"]} +{"user_id":"u141786930","problem_id":"p04045","language":"python","submission_id_v0":"s800271980","submission_id_v1":"s257761061","cpu_time_v0":98,"cpu_time_v1":72,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.53,"input":"n, k = list(map(int, input().split()))\n\nd = {str(x) for x in input().split()}\n\na = {int(x) for x in range(10)}\n\nl = a - d\n\n\n\nfor i in range(n,100000+1):\n\n i2 = str(i)\n\n for j in range(len(i2))[::-1]:\n\n if i2[j] in d:\n\n break\n\n else:\n\n print(i2)\n\n break","target":"n, k = list(map(int, input().split()))\n\nd = {str(x) for x in input().split()}\n\na = {str(x) for x in range(10)}\n\nl = a - d\n\n\n\nwhile True:\n\n if all(j in l for j in str(n)):\n\n print(n)\n\n break\n\n else:\n\n n += 1","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":287,"code_v1_num_chars":227,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nd = {str(x) for x in input().split()}\na = {int(x) for x in range(10)}\nl = a - d\nfor i in range(n, 100000 + 1):\n i2 = str(i)\n for j in range(len(i2))[::-1]:\n if i2[j] in d:\n break\n else:\n print(i2)\n break\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nd = {str(x) for x in input().split()}\na = {str(x) for x in range(10)}\nl = a - d\nwhile True:\n if all(j in l for j in str(n)):\n print(n)\n break\n else:\n n += 1\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-a = {int(x) for x in range(10)}","+a = {str(x) for x in range(10)}","-for i in range(n, 100000 + 1):","- i2 = str(i)","- for j in range(len(i2))[::-1]:","- if i2[j] in d:","- break","+while True:","+ if all(j in l for j in str(n)):","+ print(n)","+ break","- print(i2)","- break","+ n += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0848563194,"measured_runtime_v1":0.0844824791,"runtime_lift":1.0044250634,"key":["s800271980","s257761061"]} +{"user_id":"u920103253","problem_id":"p02971","language":"python","submission_id_v0":"s228171114","submission_id_v1":"s827289164","cpu_time_v0":559,"cpu_time_v1":505,"memory_v0":14132,"memory_v1":19380,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.66,"input":"\n\ndef s0():return eval(input())\n\ndef s1():return input().split()\n\ndef s2(n):return [eval(input()) for x in range(n)]\n\ndef s3(n):return [input().split() for _ in range(n)]\n\ndef s4(n): return [[x for x in s] for s in s2(n)]\n\ndef n0():return int(eval(input()))\n\ndef n1():return [int(x) for x in input().split()]\n\ndef n2(n):return [int(eval(input())) for _ in range(n)]\n\ndef n3(n):return [[int(x) for x in input().split()] for _ in range(n)]\n\ndef t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]\n\ndef p0(b,yes=\"Yes\",no=\"No\"): print((yes if b else no))\n\n# from sys import setrecursionlimit\n\n# setrecursionlimit(1000000)\n\n# from collections import Counter,deque,defaultdict\n\n# import itertools\n\n# import math\n\n# import networkx\n\n# from bisect import bisect_left,bisect_right\n\n# from heapq import heapify,heappush,heappop\n\nn=n0()\n\na=n2(n)\n\nb=sorted(a)\n\nm1=b[-1]\n\nm2=b[-2]\n\n\n\nfor i in a:\n\n p0(i==m1,m2,m1)\n\n ","target":"\n\ndef s0():return input()\n\ndef s1():return input().split()\n\ndef s2(n):return [input() for x in range(n)]\n\ndef s3(n):return [input().split() for _ in range(n)]\n\ndef s4(n): return [[x for x in s] for s in s2(n)]\n\ndef n0():return int(input())\n\ndef n1():return [int(x) for x in input().split()]\n\ndef n2(n):return [int(input()) for _ in range(n)]\n\ndef n3(n):return [[int(x) for x in input().split()] for _ in range(n)]\n\ndef t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]\n\ndef p0(b,yes=\"Yes\",no=\"No\"): print(yes if b else no)\n\n# from sys import setrecursionlimit\n\n# setrecursionlimit(1000000)\n\n# from collections import Counter,deque,defaultdict\n\n# import itertools\n\n# import math\n\n# import networkx\n\n# from bisect import bisect_left,bisect_right\n\n# from heapq import heapify,heappush,heappop\n\nn=n0()\n\na=n2(n)\n\nb=sorted(a)\n\nm1=b[-1]\n\nm2=b[-2]\n\nc=[]\n\n\n\nfor i in a:\n\n if i==m1:\n\n c.append(m2)\n\n else:\n\n c.append(m1)\n\nprint(*c,sep=\"\\n\")\n","code_v0_loc":29,"code_v1_loc":33,"code_v0_num_chars":903,"code_v1_num_chars":972,"code_v0_no_empty_lines":"def s0():\n return eval(input())\n\n\ndef s1():\n return input().split()\n\n\ndef s2(n):\n return [eval(input()) for x in range(n)]\n\n\ndef s3(n):\n return [input().split() for _ in range(n)]\n\n\ndef s4(n):\n return [[x for x in s] for s in s2(n)]\n\n\ndef n0():\n return int(eval(input()))\n\n\ndef n1():\n return [int(x) for x in input().split()]\n\n\ndef n2(n):\n return [int(eval(input())) for _ in range(n)]\n\n\ndef n3(n):\n return [[int(x) for x in input().split()] for _ in range(n)]\n\n\ndef t3(n):\n return [tuple(int(x) for x in input().split()) for _ in range(n)]\n\n\ndef p0(b, yes=\"Yes\", no=\"No\"):\n print((yes if b else no))\n\n\n# from sys import setrecursionlimit\n# setrecursionlimit(1000000)\n# from collections import Counter,deque,defaultdict\n# import itertools\n# import math\n# import networkx\n# from bisect import bisect_left,bisect_right\n# from heapq import heapify,heappush,heappop\nn = n0()\na = n2(n)\nb = sorted(a)\nm1 = b[-1]\nm2 = b[-2]\nfor i in a:\n p0(i == m1, m2, m1)\n","code_v1_no_empty_lines":"def s0():\n return input()\n\n\ndef s1():\n return input().split()\n\n\ndef s2(n):\n return [input() for x in range(n)]\n\n\ndef s3(n):\n return [input().split() for _ in range(n)]\n\n\ndef s4(n):\n return [[x for x in s] for s in s2(n)]\n\n\ndef n0():\n return int(input())\n\n\ndef n1():\n return [int(x) for x in input().split()]\n\n\ndef n2(n):\n return [int(input()) for _ in range(n)]\n\n\ndef n3(n):\n return [[int(x) for x in input().split()] for _ in range(n)]\n\n\ndef t3(n):\n return [tuple(int(x) for x in input().split()) for _ in range(n)]\n\n\ndef p0(b, yes=\"Yes\", no=\"No\"):\n print(yes if b else no)\n\n\n# from sys import setrecursionlimit\n# setrecursionlimit(1000000)\n# from collections import Counter,deque,defaultdict\n# import itertools\n# import math\n# import networkx\n# from bisect import bisect_left,bisect_right\n# from heapq import heapify,heappush,heappop\nn = n0()\na = n2(n)\nb = sorted(a)\nm1 = b[-1]\nm2 = b[-2]\nc = []\nfor i in a:\n if i == m1:\n c.append(m2)\n else:\n c.append(m1)\nprint(*c, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":12.1212121212,"diff":["- return eval(input())","+ return input()","- return [eval(input()) for x in range(n)]","+ return [input() for x in range(n)]","- return int(eval(input()))","+ return int(input())","- return [int(eval(input())) for _ in range(n)]","+ return [int(input()) for _ in range(n)]","- print((yes if b else no))","+ print(yes if b else no)","+c = []","- p0(i == m1, m2, m1)","+ if i == m1:","+ c.append(m2)","+ else:","+ c.append(m1)","+print(*c, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0475803211,"measured_runtime_v1":0.0481566842,"runtime_lift":0.9880315021,"key":["s228171114","s827289164"]} +{"user_id":"u561231954","problem_id":"p03044","language":"python","submission_id_v0":"s889507222","submission_id_v1":"s602224443","cpu_time_v0":866,"cpu_time_v1":547,"memory_v0":69696,"memory_v1":49328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.84,"input":"from collections import deque,defaultdict\n\nn=int(input())\n\nroutes=[tuple(map(int,input().split())) for i in range(n-1)]\n\n\n\nedges=defaultdict(list)\n\nfor v1,v2,dist in routes:\n\n edges[v1-1].append([v2-1,dist])\n\n edges[v2-1].append([v1-1,dist])\n\n#print(edges)\n\n\n\nans=[0]*n\n\nq=deque([0])\n\nwhile q:\n\n v=q.popleft()\n\n #print(v)\n\n if ans[v]==0:\n\n color=[1,0]\n\n else:\n\n color=[0,1]\n\n #print(edges)\n\n for edge in edges[v]:\n\n v2=edge[0]\n\n dist=edge[1]\n\n edges[v2].remove([v,dist])\n\n q.append(v2)\n\n if dist%2==1:\n\n ans[v2]=color[0]\n\n else:\n\n ans[v2]=color[1]\n\n \n\nprint(*ans,sep='\\n') \n","target":"import sys\n\nsys.setrecursionlimit(10000000)\n\nMOD = 10 ** 9 + 7\n\nINF = 10 ** 15\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n G = [[] for _ in range(N)]\n\n for _ in range(N - 1):\n\n a,b,c = list(map(int,input().split()))\n\n a -= 1\n\n b -= 1\n\n G[a].append((b,c))\n\n G[b].append((a,c))\n\n \n\n color = [0] * N\n\n dist = [-1] * N\n\n stack = [0]\n\n dist[0] = 0\n\n while stack:\n\n v = stack.pop()\n\n for e,c in G[v]:\n\n if dist[e] >= 0:\n\n continue\n\n dist[e] = dist[v] + c\n\n color[e] = dist[e]%2\n\n stack.append(e)\n\n print(('\\n'.join(map(str,color))))\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":31,"code_v1_loc":30,"code_v0_num_chars":627,"code_v1_num_chars":688,"code_v0_no_empty_lines":"from collections import deque, defaultdict\n\nn = int(input())\nroutes = [tuple(map(int, input().split())) for i in range(n - 1)]\nedges = defaultdict(list)\nfor v1, v2, dist in routes:\n edges[v1 - 1].append([v2 - 1, dist])\n edges[v2 - 1].append([v1 - 1, dist])\n# print(edges)\nans = [0] * n\nq = deque([0])\nwhile q:\n v = q.popleft()\n # print(v)\n if ans[v] == 0:\n color = [1, 0]\n else:\n color = [0, 1]\n # print(edges)\n for edge in edges[v]:\n v2 = edge[0]\n dist = edge[1]\n edges[v2].remove([v, dist])\n q.append(v2)\n if dist % 2 == 1:\n ans[v2] = color[0]\n else:\n ans[v2] = color[1]\nprint(*ans, sep=\"\\n\")\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10000000)\nMOD = 10**9 + 7\nINF = 10**15\n\n\ndef main():\n N = int(eval(input()))\n G = [[] for _ in range(N)]\n for _ in range(N - 1):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n G[a].append((b, c))\n G[b].append((a, c))\n color = [0] * N\n dist = [-1] * N\n stack = [0]\n dist[0] = 0\n while stack:\n v = stack.pop()\n for e, c in G[v]:\n if dist[e] >= 0:\n continue\n dist[e] = dist[v] + c\n color[e] = dist[e] % 2\n stack.append(e)\n print((\"\\n\".join(map(str, color))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["-from collections import deque, defaultdict","+import sys","-n = int(input())","-routes = [tuple(map(int, input().split())) for i in range(n - 1)]","-edges = defaultdict(list)","-for v1, v2, dist in routes:","- edges[v1 - 1].append([v2 - 1, dist])","- edges[v2 - 1].append([v1 - 1, dist])","-# print(edges)","-ans = [0] * n","-q = deque([0])","-while q:","- v = q.popleft()","- # print(v)","- if ans[v] == 0:","- color = [1, 0]","- else:","- color = [0, 1]","- # print(edges)","- for edge in edges[v]:","- v2 = edge[0]","- dist = edge[1]","- edges[v2].remove([v, dist])","- q.append(v2)","- if dist % 2 == 1:","- ans[v2] = color[0]","- else:","- ans[v2] = color[1]","-print(*ans, sep=\"\\n\")","+sys.setrecursionlimit(10000000)","+MOD = 10**9 + 7","+INF = 10**15","+","+","+def main():","+ N = int(eval(input()))","+ G = [[] for _ in range(N)]","+ for _ in range(N - 1):","+ a, b, c = list(map(int, input().split()))","+ a -= 1","+ b -= 1","+ G[a].append((b, c))","+ G[b].append((a, c))","+ color = [0] * N","+ dist = [-1] * N","+ stack = [0]","+ dist[0] = 0","+ while stack:","+ v = stack.pop()","+ for e, c in G[v]:","+ if dist[e] >= 0:","+ continue","+ dist[e] = dist[v] + c","+ color[e] = dist[e] % 2","+ stack.append(e)","+ print((\"\\n\".join(map(str, color))))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0610937014,"measured_runtime_v1":0.0391687234,"runtime_lift":1.5597572759,"key":["s889507222","s602224443"]} +{"user_id":"u893063840","problem_id":"p02862","language":"python","submission_id_v0":"s349937979","submission_id_v1":"s697524810","cpu_time_v0":1340,"cpu_time_v1":544,"memory_v0":122000,"memory_v1":40300,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.4,"input":"def cmb(n, r, mod):\n\n if ( r<0 or r>n ):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\nmod = 10**9+7 #\u51fa\u529b\u306e\u5236\u9650\n\nN = 10**6 + 10\n\ng1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\ng2 = [1, 1] #\u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\ninverse = [0, 1] #\u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\n\nfor i in range( 2, N + 1 ):\n\n g1.append( ( g1[-1] * i ) % mod )\n\n inverse.append( ( -inverse[mod % i] * (mod\/\/i) ) % mod )\n\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\n\n\nx, y = list(map(int, input().split()))\n\n\n\nn = (2 * x - y) \/ 3\n\nm = (2 * y - x) \/ 3\n\nmod = 10 ** 9 + 7\n\n\n\nif int(n) == n and int(m) == m:\n\n n = int(n)\n\n m = int(m)\n\n ans = cmb(n + m, n, mod)\n\n ans %= mod\n\n print(ans)\n\n\n\nelse:\n\n print((0))\n","target":"x, y = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\n\n\ncnt1 = cnt2 = 0\n\nfor i in range(x + 1):\n\n x_left = x - i\n\n y_left = y - 2 * i\n\n if x_left == y_left * 2:\n\n cnt1 = i\n\n cnt2 = y_left\n\n\n\nif cnt1 == cnt2 == 0:\n\n ans = 0\n\nelse:\n\n ans = 1\n\n for i in range(1, cnt1 + 1):\n\n ans *= (cnt1 + cnt2 - i + 1)\n\n ans %= mod\n\n ans *= pow(i, mod - 2, mod)\n\n ans %= mod\n\n\n\nprint(ans)\n","code_v0_loc":32,"code_v1_loc":22,"code_v0_num_chars":670,"code_v1_num_chars":431,"code_v0_no_empty_lines":"def cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\nmod = 10**9 + 7 # \u51fa\u529b\u306e\u5236\u9650\nN = 10**6 + 10\ng1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\ng2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\ninverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\nfor i in range(2, N + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\nx, y = list(map(int, input().split()))\nn = (2 * x - y) \/ 3\nm = (2 * y - x) \/ 3\nmod = 10**9 + 7\nif int(n) == n and int(m) == m:\n n = int(n)\n m = int(m)\n ans = cmb(n + m, n, mod)\n ans %= mod\n print(ans)\nelse:\n print((0))\n","code_v1_no_empty_lines":"x, y = list(map(int, input().split()))\nmod = 10**9 + 7\ncnt1 = cnt2 = 0\nfor i in range(x + 1):\n x_left = x - i\n y_left = y - 2 * i\n if x_left == y_left * 2:\n cnt1 = i\n cnt2 = y_left\nif cnt1 == cnt2 == 0:\n ans = 0\nelse:\n ans = 1\n for i in range(1, cnt1 + 1):\n ans *= cnt1 + cnt2 - i + 1\n ans %= mod\n ans *= pow(i, mod - 2, mod)\n ans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":31.25,"diff":["-def cmb(n, r, mod):","- if r < 0 or r > n:","- return 0","- r = min(r, n - r)","- return g1[n] * g2[r] * g2[n - r] % mod","-","-","-mod = 10**9 + 7 # \u51fa\u529b\u306e\u5236\u9650","-N = 10**6 + 10","-g1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb","-g2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb","-inverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb","-for i in range(2, N + 1):","- g1.append((g1[-1] * i) % mod)","- inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)","- g2.append((g2[-1] * inverse[-1]) % mod)","-n = (2 * x - y) \/ 3","-m = (2 * y - x) \/ 3","-if int(n) == n and int(m) == m:","- n = int(n)","- m = int(m)","- ans = cmb(n + m, n, mod)","- ans %= mod","- print(ans)","+cnt1 = cnt2 = 0","+for i in range(x + 1):","+ x_left = x - i","+ y_left = y - 2 * i","+ if x_left == y_left * 2:","+ cnt1 = i","+ cnt2 = y_left","+if cnt1 == cnt2 == 0:","+ ans = 0","- print((0))","+ ans = 1","+ for i in range(1, cnt1 + 1):","+ ans *= cnt1 + cnt2 - i + 1","+ ans %= mod","+ ans *= pow(i, mod - 2, mod)","+ ans %= mod","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.7106080413,"measured_runtime_v1":0.5927778602,"runtime_lift":2.8857488719,"key":["s349937979","s697524810"]} +{"user_id":"u744920373","problem_id":"p03283","language":"python","submission_id_v0":"s450801008","submission_id_v1":"s614472935","cpu_time_v0":2461,"cpu_time_v1":1494,"memory_v0":72944,"memory_v1":107936,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.29,"input":"import sys\n\nsys.setrecursionlimit(10**8)\n\ndef ii(): return int(sys.stdin.readline())\n\ndef mi(): return list(map(int, sys.stdin.readline().split()))\n\ndef li(): return list(map(int, sys.stdin.readline().split()))\n\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]\n\ndef dp2(ini, i, j): return [[ini]*i for _ in range(j)]\n\n#import bisect #bisect.bisect_left(B, a)\n\n#from collections import defaultdict #d = defaultdict(int) d[key] += value\n\n#from collections import Counter # a = Counter(A).most_common()\n\nfrom itertools import accumulate #list(accumulate(A))\n\n\n\n\n\ndef segfunc(a,b):\n\n return a+b\n\n\n\ndef init(init_val):\n\n #set_val\n\n for i in range(n):\n\n seg[i+num-1]=init_val[i] \n\n #built\n\n for i in range(num-2,-1,-1) :\n\n seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) \n\n \n\ndef update(k,x):\n\n k += num-1\n\n seg[k] = x\n\n while k:\n\n k = (k-1)\/\/2\n\n seg[k] = segfunc(seg[k*2+1],seg[k*2+2])\n\n \n\ndef query(p,q):\n\n if q<=p:\n\n return ide_ele\n\n p += num-1\n\n q += num-2\n\n res=ide_ele\n\n while q-p>1:\n\n if p&1 == 0:\n\n res = segfunc(res,seg[p])\n\n if q&1 == 1:\n\n res = segfunc(res,seg[q])\n\n q -= 1\n\n p = p\/\/2\n\n q = (q-1)\/\/2\n\n if p == q:\n\n res = segfunc(res,seg[p])\n\n else:\n\n res = segfunc(segfunc(res,seg[p]),seg[q])\n\n return res\n\n\n\n\n\nn, M, Q = mi()\n\n\n\n#####\u5358\u4f4d\u5143######\n\nide_ele = 0\n\n#num:n\u4ee5\u4e0a\u306e\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\n\nnum =2**(n-1).bit_length()\n\nseg=[ide_ele]*2*num\n\n\n\nL = [0]*n\n\ninit(L)\n\n\n\nlrpq = dp2(0, 3, M+Q)\n\n\n\nfor i in range(M):\n\n l, r = mi()\n\n lrpq[i][1] = l-1\n\n lrpq[i][2] = r-1\n\n\n\nfor i in range(M, M+Q):\n\n p, q = mi()\n\n lrpq[i][0] = i\n\n lrpq[i][1] = p-1\n\n lrpq[i][2] = q-1\n\n\n\nlrpq = sorted(lrpq, key=lambda x:(x[2], x[0]))\n\n\n\nans = [0]*(Q)\n\n\n\nfor i in range(M+Q):\n\n if lrpq[i][0] == 0:\n\n #L[lrpq[i][1]] += 1\n\n update(lrpq[i][1], seg[lrpq[i][1]+num-1]+1)\n\n else:\n\n ans[lrpq[i][0]-M] = query(lrpq[i][1], lrpq[i][2]+1)\n\n\n\nfor num in ans:\n\n print(num)","target":"import sys\n\nsys.setrecursionlimit(10**8)\n\ndef ii(): return int(sys.stdin.readline())\n\ndef mi(): return list(map(int, sys.stdin.readline().split()))\n\ndef li(): return list(map(int, sys.stdin.readline().split()))\n\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]\n\ndef dp2(ini, i, j): return [[ini]*i for _ in range(j)]\n\n#import bisect #bisect.bisect_left(B, a)\n\n#from collections import defaultdict #d = defaultdict(int) d[key] += value\n\n#from collections import Counter # a = Counter(A).most_common()\n\nfrom itertools import accumulate #list(accumulate(A))\n\n\n\n# \u30bb\u30b0\u6728\n\n\n\ndef segfunc(a,b):\n\n return a+b\n\n\n\ndef init(init_val):\n\n #set_val\n\n for i in range(n):\n\n seg[i+num-1]=init_val[i] \n\n #built\n\n for i in range(num-2,-1,-1) :\n\n seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) \n\n \n\ndef update(k,x):\n\n k += num-1\n\n seg[k] = x\n\n while k:\n\n k = (k-1)\/\/2\n\n seg[k] = segfunc(seg[k*2+1],seg[k*2+2])\n\n \n\ndef query(p,q):\n\n if q<=p:\n\n return ide_ele\n\n p += num-1\n\n q += num-2\n\n res=ide_ele\n\n while q-p>1:\n\n if p&1 == 0:\n\n res = segfunc(res,seg[p])\n\n if q&1 == 1:\n\n res = segfunc(res,seg[q])\n\n q -= 1\n\n p = p\/\/2\n\n q = (q-1)\/\/2\n\n if p == q:\n\n res = segfunc(res,seg[p])\n\n else:\n\n res = segfunc(segfunc(res,seg[p]),seg[q])\n\n return res\n\n\n\n\n\nn, M, Q = mi()\n\n\n\n#####\u5358\u4f4d\u5143######\n\nide_ele = 0\n\n#num:n\u4ee5\u4e0a\u306e\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\n\nnum =2**(n-1).bit_length()\n\nseg=[ide_ele]*2*num\n\n\n\nL = [0]*n\n\ninit(L)\n\n\n\nlrpq = dp2(0, 3, M+Q)\n\n\n\nfor i in range(M):\n\n l, r = mi()\n\n lrpq[i][1] = l-1\n\n lrpq[i][2] = r-1\n\n\n\nfor i in range(M, M+Q):\n\n p, q = mi()\n\n lrpq[i][0] = i\n\n lrpq[i][1] = p-1\n\n lrpq[i][2] = q-1\n\n\n\nlrpq = sorted(lrpq, key=lambda x:(x[2], x[0]))\n\n\n\nans = [0]*(Q)\n\n\n\nfor i in range(M+Q):\n\n if lrpq[i][0] == 0:\n\n #L[lrpq[i][1]] += 1\n\n update(lrpq[i][1], seg[lrpq[i][1]+num-1]+1)\n\n else:\n\n ans[lrpq[i][0]-M] = query(lrpq[i][1], lrpq[i][2]+1)\n\n\n\nfor num in ans:\n\n print(num)","code_v0_loc":89,"code_v1_loc":90,"code_v0_num_chars":2058,"code_v1_num_chars":2065,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**8)\n\n\ndef ii():\n return int(sys.stdin.readline())\n\n\ndef mi():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef li():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef li2(N):\n return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]\n\n\ndef dp2(ini, i, j):\n return [[ini] * i for _ in range(j)]\n\n\n# import bisect #bisect.bisect_left(B, a)\n# from collections import defaultdict #d = defaultdict(int) d[key] += value\n# from collections import Counter # a = Counter(A).most_common()\nfrom itertools import accumulate # list(accumulate(A))\n\n\ndef segfunc(a, b):\n return a + b\n\n\ndef init(init_val):\n # set_val\n for i in range(n):\n seg[i + num - 1] = init_val[i]\n # built\n for i in range(num - 2, -1, -1):\n seg[i] = segfunc(seg[2 * i + 1], seg[2 * i + 2])\n\n\ndef update(k, x):\n k += num - 1\n seg[k] = x\n while k:\n k = (k - 1) \/\/ 2\n seg[k] = segfunc(seg[k * 2 + 1], seg[k * 2 + 2])\n\n\ndef query(p, q):\n if q <= p:\n return ide_ele\n p += num - 1\n q += num - 2\n res = ide_ele\n while q - p > 1:\n if p & 1 == 0:\n res = segfunc(res, seg[p])\n if q & 1 == 1:\n res = segfunc(res, seg[q])\n q -= 1\n p = p \/\/ 2\n q = (q - 1) \/\/ 2\n if p == q:\n res = segfunc(res, seg[p])\n else:\n res = segfunc(segfunc(res, seg[p]), seg[q])\n return res\n\n\nn, M, Q = mi()\n#####\u5358\u4f4d\u5143######\nide_ele = 0\n# num:n\u4ee5\u4e0a\u306e\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\nnum = 2 ** (n - 1).bit_length()\nseg = [ide_ele] * 2 * num\nL = [0] * n\ninit(L)\nlrpq = dp2(0, 3, M + Q)\nfor i in range(M):\n l, r = mi()\n lrpq[i][1] = l - 1\n lrpq[i][2] = r - 1\nfor i in range(M, M + Q):\n p, q = mi()\n lrpq[i][0] = i\n lrpq[i][1] = p - 1\n lrpq[i][2] = q - 1\nlrpq = sorted(lrpq, key=lambda x: (x[2], x[0]))\nans = [0] * (Q)\nfor i in range(M + Q):\n if lrpq[i][0] == 0:\n # L[lrpq[i][1]] += 1\n update(lrpq[i][1], seg[lrpq[i][1] + num - 1] + 1)\n else:\n ans[lrpq[i][0] - M] = query(lrpq[i][1], lrpq[i][2] + 1)\nfor num in ans:\n print(num)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**8)\n\n\ndef ii():\n return int(sys.stdin.readline())\n\n\ndef mi():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef li():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef li2(N):\n return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]\n\n\ndef dp2(ini, i, j):\n return [[ini] * i for _ in range(j)]\n\n\n# import bisect #bisect.bisect_left(B, a)\n# from collections import defaultdict #d = defaultdict(int) d[key] += value\n# from collections import Counter # a = Counter(A).most_common()\nfrom itertools import accumulate # list(accumulate(A))\n\n# \u30bb\u30b0\u6728\ndef segfunc(a, b):\n return a + b\n\n\ndef init(init_val):\n # set_val\n for i in range(n):\n seg[i + num - 1] = init_val[i]\n # built\n for i in range(num - 2, -1, -1):\n seg[i] = segfunc(seg[2 * i + 1], seg[2 * i + 2])\n\n\ndef update(k, x):\n k += num - 1\n seg[k] = x\n while k:\n k = (k - 1) \/\/ 2\n seg[k] = segfunc(seg[k * 2 + 1], seg[k * 2 + 2])\n\n\ndef query(p, q):\n if q <= p:\n return ide_ele\n p += num - 1\n q += num - 2\n res = ide_ele\n while q - p > 1:\n if p & 1 == 0:\n res = segfunc(res, seg[p])\n if q & 1 == 1:\n res = segfunc(res, seg[q])\n q -= 1\n p = p \/\/ 2\n q = (q - 1) \/\/ 2\n if p == q:\n res = segfunc(res, seg[p])\n else:\n res = segfunc(segfunc(res, seg[p]), seg[q])\n return res\n\n\nn, M, Q = mi()\n#####\u5358\u4f4d\u5143######\nide_ele = 0\n# num:n\u4ee5\u4e0a\u306e\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\nnum = 2 ** (n - 1).bit_length()\nseg = [ide_ele] * 2 * num\nL = [0] * n\ninit(L)\nlrpq = dp2(0, 3, M + Q)\nfor i in range(M):\n l, r = mi()\n lrpq[i][1] = l - 1\n lrpq[i][2] = r - 1\nfor i in range(M, M + Q):\n p, q = mi()\n lrpq[i][0] = i\n lrpq[i][1] = p - 1\n lrpq[i][2] = q - 1\nlrpq = sorted(lrpq, key=lambda x: (x[2], x[0]))\nans = [0] * (Q)\nfor i in range(M + Q):\n if lrpq[i][0] == 0:\n # L[lrpq[i][1]] += 1\n update(lrpq[i][1], seg[lrpq[i][1] + num - 1] + 1)\n else:\n ans[lrpq[i][0] - M] = query(lrpq[i][1], lrpq[i][2] + 1)\nfor num in ans:\n print(num)\n","code_same":false,"relative_loc_diff_percent":1.1111111111,"diff":["-","+# \u30bb\u30b0\u6728"],"diff_only_import_comment":false,"measured_runtime_v0":0.0643558841,"measured_runtime_v1":0.0725000784,"runtime_lift":0.887666406,"key":["s450801008","s614472935"]} +{"user_id":"u905203728","problem_id":"p03409","language":"python","submission_id_v0":"s128352332","submission_id_v1":"s749851388","cpu_time_v0":180,"cpu_time_v1":19,"memory_v0":39152,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.44,"input":"from operator import itemgetter\n\nN = int(eval(input()))\n\nA = [tuple(map(int,input().split())) for i in range(N)]\n\nB = [tuple(map(int,input().split())) for i in range(N)]\n\nA.sort()\n\nB.sort()\n\nnum = 0\n\nfor i in range(N):\n\n K = [A[k] for k in range(len(A)) if (A[k][0] np.ndarray:\n\n '''return np.ndarray shape=(H,W) matrix'''\n\n lines = []\n\n for _ in range(H):\n\n lines.append(read())\n\n lines = ' '.join(lines) # byte\u540c\u58eb\u306e\u7d50\u5408\u304c\u3067\u304d\u306a\u3044\u306e\u3067readline\u3067\u306a\u304fread\u3067\n\n return np.fromstring(lines, sep=' ', dtype=np.int64).reshape(H, W)\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\n\n\nN, K = ints()\n\nA = read_matrix(N, N)\n\n\n\n\n\n# from numba import njit\n\n\n\n\n\n# @njit('i8[:,:](i8[:,:],i8[:,:])', cache=True)\n\ndef matmul_mod(X: np.ndarray, Y: np.ndarray)->np.ndarray:\n\n MOD = 10**9 + 7\n\n # return X @ Y\n\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n\n for i in range(X.shape[0]): # X\u306e\u884c\n\n for j in range(Y.shape[1]): # Y\u306e\u5217\n\n tmp = (X[i, :] * Y[:, j]) % MOD\n\n ret[i, j] = tmp.sum() % MOD\n\n return ret\n\n\n\n\n\ndef matmul_mod_try(X: np.ndarray, Y: np.ndarray)->np.ndarray:\n\n MOD = 10**9 + 7\n\n # return X @ Y\n\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n\n YT = Y.T\n\n for i in range(X.shape[0]): # X\u306e\u884c\n\n Xi = X[i, :]\n\n tmp = (YT * Xi) % MOD\n\n ret[i, :] = tmp.sum(1) % MOD\n\n return ret\n\n\n\n\n\ndef matmul_mod_fast(X: np.ndarray, Y: np.ndarray)->np.ndarray:\n\n MOD = 10**9 + 7\n\n X3d = X[:, :, np.newaxis].transpose(0, 2, 1)\n\n Y3d = Y[:, :, np.newaxis].transpose(2, 1, 0)\n\n return ((X3d * Y3d) % MOD).sum(2) % MOD\n\n\n\n\n\nA_double = np.asanyarray(A, dtype=np.int64)\n\nans = np.eye(N, dtype=np.int64)\n\nfor j in range(int(K).bit_length()):\n\n if (K >> j) & 1:\n\n ans = matmul_mod_fast(ans, A_double)\n\n A_double = matmul_mod_fast(A_double, A_double)\n\n\n\nprint((ans.sum() % MOD))\n","target":"import sys\n\nsys.setrecursionlimit(1 << 25)\n\nreadline = sys.stdin.buffer.readline\n\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\n\n\n\nimport numpy as np\n\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\n\nzeros = partial(np.zeros, dtype=np.int64)\n\nfull = partial(np.full, dtype=np.int64)\n\n\n\n\n\ndef ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)\n\n\n\n\n\ndef read_matrix(H, W)->np.ndarray:\n\n '''return np.ndarray shape=(H,W) matrix'''\n\n lines = []\n\n for _ in range(H):\n\n lines.append(read())\n\n lines = ' '.join(lines) # byte\u540c\u58eb\u306e\u7d50\u5408\u304c\u3067\u304d\u306a\u3044\u306e\u3067readline\u3067\u306a\u304fread\u3067\n\n return np.fromstring(lines, sep=' ', dtype=np.int64).reshape(H, W)\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\n\n\nN, K = ints()\n\nA = read_matrix(N, N)\n\n\n\n\n\n# from numba import njit\n\n\n\n\n\n# @njit('i8[:,:](i8[:,:],i8[:,:])', cache=True)\n\n# def matmul_mod(X: np.ndarray, Y: np.ndarray)->np.ndarray:\n\n# MOD = 10**9 + 7\n\n# # return X @ Y\n\n# ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n\n# for i in range(X.shape[0]): # X\u306e\u884c\n\n# for j in range(Y.shape[1]): # Y\u306e\u5217\n\n# tmp = (X[i, :] * Y[:, j]) % MOD\n\n# ret[i, j] = tmp.sum() % MOD\n\n# return ret\n\n\n\n\n\ndef matmul_mod(X: np.ndarray, Y: np.ndarray, MOD: int=10**9 + 7)->np.ndarray:\n\n # return X@Y %MOD\n\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n\n YT = Y.T\n\n for i in range(X.shape[0]): # X\u306e\u884c\n\n tmp = (YT * X[i, :]) % MOD\n\n ret[i, :] = tmp.sum(1) % MOD\n\n return ret\n\n\n\n\n\n# def matmul_mod(X: np.ndarray, Y: np.ndarray, MOD: int=10**9 + 7)->np.ndarray:\n\n# # return X@Y %MOD\n\n# MOD = 10**9 + 7\n\n# X3d = X[:, :, np.newaxis].transpose(0, 2, 1)\n\n# Y3d = Y[:, :, np.newaxis].transpose(2, 1, 0)\n\n# return ((X3d * Y3d) % MOD).sum(2) % MOD\n\n\n\n\n\nA_double = np.asanyarray(A, dtype=np.int64)\n\nans = np.eye(N, dtype=np.int64)\n\nfor j in range(int(K).bit_length()):\n\n if (K >> j) & 1:\n\n ans = matmul_mod(ans, A_double)\n\n A_double = matmul_mod(A_double, A_double)\n\n\n\nprint((ans.sum() % MOD))\n","code_v0_loc":74,"code_v1_loc":73,"code_v0_num_chars":2050,"code_v1_num_chars":2089,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1 << 25)\nreadline = sys.stdin.buffer.readline\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\nimport numpy as np\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\nzeros = partial(np.zeros, dtype=np.int64)\nfull = partial(np.full, dtype=np.int64)\n\n\ndef ints():\n return np.fromstring(readline(), sep=\" \", dtype=np.int64)\n\n\ndef read_matrix(H, W) -> np.ndarray:\n \"\"\"return np.ndarray shape=(H,W) matrix\"\"\"\n lines = []\n for _ in range(H):\n lines.append(read())\n lines = \" \".join(lines) # byte\u540c\u58eb\u306e\u7d50\u5408\u304c\u3067\u304d\u306a\u3044\u306e\u3067readline\u3067\u306a\u304fread\u3067\n return np.fromstring(lines, sep=\" \", dtype=np.int64).reshape(H, W)\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nN, K = ints()\nA = read_matrix(N, N)\n# from numba import njit\n# @njit('i8[:,:](i8[:,:],i8[:,:])', cache=True)\ndef matmul_mod(X: np.ndarray, Y: np.ndarray) -> np.ndarray:\n MOD = 10**9 + 7\n # return X @ Y\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n for i in range(X.shape[0]): # X\u306e\u884c\n for j in range(Y.shape[1]): # Y\u306e\u5217\n tmp = (X[i, :] * Y[:, j]) % MOD\n ret[i, j] = tmp.sum() % MOD\n return ret\n\n\ndef matmul_mod_try(X: np.ndarray, Y: np.ndarray) -> np.ndarray:\n MOD = 10**9 + 7\n # return X @ Y\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n YT = Y.T\n for i in range(X.shape[0]): # X\u306e\u884c\n Xi = X[i, :]\n tmp = (YT * Xi) % MOD\n ret[i, :] = tmp.sum(1) % MOD\n return ret\n\n\ndef matmul_mod_fast(X: np.ndarray, Y: np.ndarray) -> np.ndarray:\n MOD = 10**9 + 7\n X3d = X[:, :, np.newaxis].transpose(0, 2, 1)\n Y3d = Y[:, :, np.newaxis].transpose(2, 1, 0)\n return ((X3d * Y3d) % MOD).sum(2) % MOD\n\n\nA_double = np.asanyarray(A, dtype=np.int64)\nans = np.eye(N, dtype=np.int64)\nfor j in range(int(K).bit_length()):\n if (K >> j) & 1:\n ans = matmul_mod_fast(ans, A_double)\n A_double = matmul_mod_fast(A_double, A_double)\nprint((ans.sum() % MOD))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1 << 25)\nreadline = sys.stdin.buffer.readline\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\nimport numpy as np\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\nzeros = partial(np.zeros, dtype=np.int64)\nfull = partial(np.full, dtype=np.int64)\n\n\ndef ints():\n return np.fromstring(readline(), sep=\" \", dtype=np.int64)\n\n\ndef read_matrix(H, W) -> np.ndarray:\n \"\"\"return np.ndarray shape=(H,W) matrix\"\"\"\n lines = []\n for _ in range(H):\n lines.append(read())\n lines = \" \".join(lines) # byte\u540c\u58eb\u306e\u7d50\u5408\u304c\u3067\u304d\u306a\u3044\u306e\u3067readline\u3067\u306a\u304fread\u3067\n return np.fromstring(lines, sep=\" \", dtype=np.int64).reshape(H, W)\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nN, K = ints()\nA = read_matrix(N, N)\n# from numba import njit\n# @njit('i8[:,:](i8[:,:],i8[:,:])', cache=True)\n# def matmul_mod(X: np.ndarray, Y: np.ndarray)->np.ndarray:\n# MOD = 10**9 + 7\n# # return X @ Y\n# ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n# for i in range(X.shape[0]): # X\u306e\u884c\n# for j in range(Y.shape[1]): # Y\u306e\u5217\n# tmp = (X[i, :] * Y[:, j]) % MOD\n# ret[i, j] = tmp.sum() % MOD\n# return ret\ndef matmul_mod(X: np.ndarray, Y: np.ndarray, MOD: int = 10**9 + 7) -> np.ndarray:\n # return X@Y %MOD\n ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)\n YT = Y.T\n for i in range(X.shape[0]): # X\u306e\u884c\n tmp = (YT * X[i, :]) % MOD\n ret[i, :] = tmp.sum(1) % MOD\n return ret\n\n\n# def matmul_mod(X: np.ndarray, Y: np.ndarray, MOD: int=10**9 + 7)->np.ndarray:\n# # return X@Y %MOD\n# MOD = 10**9 + 7\n# X3d = X[:, :, np.newaxis].transpose(0, 2, 1)\n# Y3d = Y[:, :, np.newaxis].transpose(2, 1, 0)\n# return ((X3d * Y3d) % MOD).sum(2) % MOD\nA_double = np.asanyarray(A, dtype=np.int64)\nans = np.eye(N, dtype=np.int64)\nfor j in range(int(K).bit_length()):\n if (K >> j) & 1:\n ans = matmul_mod(ans, A_double)\n A_double = matmul_mod(A_double, A_double)\nprint((ans.sum() % MOD))\n","code_same":false,"relative_loc_diff_percent":1.3513513514,"diff":["-def matmul_mod(X: np.ndarray, Y: np.ndarray) -> np.ndarray:","- MOD = 10**9 + 7","- # return X @ Y","- ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)","- for i in range(X.shape[0]): # X\u306e\u884c","- for j in range(Y.shape[1]): # Y\u306e\u5217","- tmp = (X[i, :] * Y[:, j]) % MOD","- ret[i, j] = tmp.sum() % MOD","- return ret","-","-","-def matmul_mod_try(X: np.ndarray, Y: np.ndarray) -> np.ndarray:","- MOD = 10**9 + 7","- # return X @ Y","+# def matmul_mod(X: np.ndarray, Y: np.ndarray)->np.ndarray:","+# MOD = 10**9 + 7","+# # return X @ Y","+# ret = np.empty((X.shape[0], Y.shape[1]), dtype=np.int64)","+# for i in range(X.shape[0]): # X\u306e\u884c","+# for j in range(Y.shape[1]): # Y\u306e\u5217","+# tmp = (X[i, :] * Y[:, j]) % MOD","+# ret[i, j] = tmp.sum() % MOD","+# return ret","+def matmul_mod(X: np.ndarray, Y: np.ndarray, MOD: int = 10**9 + 7) -> np.ndarray:","+ # return X@Y %MOD","- Xi = X[i, :]","- tmp = (YT * Xi) % MOD","+ tmp = (YT * X[i, :]) % MOD","-def matmul_mod_fast(X: np.ndarray, Y: np.ndarray) -> np.ndarray:","- MOD = 10**9 + 7","- X3d = X[:, :, np.newaxis].transpose(0, 2, 1)","- Y3d = Y[:, :, np.newaxis].transpose(2, 1, 0)","- return ((X3d * Y3d) % MOD).sum(2) % MOD","-","-","+# def matmul_mod(X: np.ndarray, Y: np.ndarray, MOD: int=10**9 + 7)->np.ndarray:","+# # return X@Y %MOD","+# MOD = 10**9 + 7","+# X3d = X[:, :, np.newaxis].transpose(0, 2, 1)","+# Y3d = Y[:, :, np.newaxis].transpose(2, 1, 0)","+# return ((X3d * Y3d) % MOD).sum(2) % MOD","- ans = matmul_mod_fast(ans, A_double)","- A_double = matmul_mod_fast(A_double, A_double)","+ ans = matmul_mod(ans, A_double)","+ A_double = matmul_mod(A_double, A_double)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4182974617,"measured_runtime_v1":0.2355889467,"runtime_lift":1.7755394195,"key":["s347048321","s034662256"]} +{"user_id":"u033606236","problem_id":"p03013","language":"python","submission_id_v0":"s601377356","submission_id_v1":"s779412621","cpu_time_v0":557,"cpu_time_v1":470,"memory_v0":494196,"memory_v1":460020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.62,"input":"import sys\n\nsys.setrecursionlimit(500000)\n\n\n\ndef f(i):\n\n if dp[i] != -1 and dp[i] != 0: return dp[i]\n\n if dp[i] == -1: return 0\n\n\n\n if i == -1:\n\n return f(i - 1)\n\n elif i > 1:\n\n dp[i] = f(i - 1) + f(i - 2)\n\n else:\n\n dp[i] = f(i - 1)\n\n return dp[i]\n\n\n\nn,m = list(map(int,input().split()))\n\ndp = [0]*(n+1)\n\nary = [int(eval(input())) for _ in range(m)]\n\ndp[0] = 1\n\nfor i in ary:\n\n dp[i] = -1\n\n if dp[i-1] == -1 and dp[i] == -1:print((0));exit()\n\nprint((f(n)%(10**9+7)))\n","target":"n,m = list(map(int,input().split()))\n\ndp = [0]*(n+1)\n\nfor i in range(m):\n\n x = int(eval(input()))\n\n dp[x] = -1\n\ndp[0] = 1\n\nfor i in range(1,n+1):\n\n if dp[i] == -1:continue\n\n elif dp[i-1] == -1:dp[i] = dp[i-2]\n\n elif dp[i-2] == -1:dp[i] = dp[i-1]\n\n elif i > 1:\n\n dp[i] = dp[i-2]+dp[i-1]\n\n else:dp[i] = dp[i-1]\n\nprint((dp[n]%(10**9+7) if dp[n] != -1 else 0))","code_v0_loc":23,"code_v1_loc":14,"code_v0_num_chars":496,"code_v1_num_chars":376,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(500000)\n\n\ndef f(i):\n if dp[i] != -1 and dp[i] != 0:\n return dp[i]\n if dp[i] == -1:\n return 0\n if i == -1:\n return f(i - 1)\n elif i > 1:\n dp[i] = f(i - 1) + f(i - 2)\n else:\n dp[i] = f(i - 1)\n return dp[i]\n\n\nn, m = list(map(int, input().split()))\ndp = [0] * (n + 1)\nary = [int(eval(input())) for _ in range(m)]\ndp[0] = 1\nfor i in ary:\n dp[i] = -1\n if dp[i - 1] == -1 and dp[i] == -1:\n print((0))\n exit()\nprint((f(n) % (10**9 + 7)))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\ndp = [0] * (n + 1)\nfor i in range(m):\n x = int(eval(input()))\n dp[x] = -1\ndp[0] = 1\nfor i in range(1, n + 1):\n if dp[i] == -1:\n continue\n elif dp[i - 1] == -1:\n dp[i] = dp[i - 2]\n elif dp[i - 2] == -1:\n dp[i] = dp[i - 1]\n elif i > 1:\n dp[i] = dp[i - 2] + dp[i - 1]\n else:\n dp[i] = dp[i - 1]\nprint((dp[n] % (10**9 + 7) if dp[n] != -1 else 0))\n","code_same":false,"relative_loc_diff_percent":39.1304347826,"diff":["-import sys","-","-sys.setrecursionlimit(500000)","-","-","-def f(i):","- if dp[i] != -1 and dp[i] != 0:","- return dp[i]","- if dp[i] == -1:","- return 0","- if i == -1:","- return f(i - 1)","- elif i > 1:","- dp[i] = f(i - 1) + f(i - 2)","- else:","- dp[i] = f(i - 1)","- return dp[i]","-","-","-ary = [int(eval(input())) for _ in range(m)]","+for i in range(m):","+ x = int(eval(input()))","+ dp[x] = -1","-for i in ary:","- dp[i] = -1","- if dp[i - 1] == -1 and dp[i] == -1:","- print((0))","- exit()","-print((f(n) % (10**9 + 7)))","+for i in range(1, n + 1):","+ if dp[i] == -1:","+ continue","+ elif dp[i - 1] == -1:","+ dp[i] = dp[i - 2]","+ elif dp[i - 2] == -1:","+ dp[i] = dp[i - 1]","+ elif i > 1:","+ dp[i] = dp[i - 2] + dp[i - 1]","+ else:","+ dp[i] = dp[i - 1]","+print((dp[n] % (10**9 + 7) if dp[n] != -1 else 0))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0072385349,"measured_runtime_v1":0.0364234335,"runtime_lift":0.1987329096,"key":["s601377356","s779412621"]} +{"user_id":"u647766105","problem_id":"p00001","language":"python","submission_id_v0":"s273428297","submission_id_v1":"s958372806","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4204,"memory_v1":5076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"a=[]\n\nfor x in range(10):\n\n a.append(eval(input()))\n\n\n\na.sort(reverse=True)\n\nfor x in range(3):\n\n print(a[x])","target":"a=[eval(input()) for i in range(10)]\n\na.sort(reverse=True)\n\nfor i in range(3):\n\n print(a[i])","code_v0_loc":7,"code_v1_loc":4,"code_v0_num_chars":108,"code_v1_num_chars":89,"code_v0_no_empty_lines":"a = []\nfor x in range(10):\n a.append(eval(input()))\na.sort(reverse=True)\nfor x in range(3):\n print(a[x])\n","code_v1_no_empty_lines":"a = [eval(input()) for i in range(10)]\na.sort(reverse=True)\nfor i in range(3):\n print(a[i])\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-a = []","-for x in range(10):","- a.append(eval(input()))","+a = [eval(input()) for i in range(10)]","-for x in range(3):","- print(a[x])","+for i in range(3):","+ print(a[i])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0457335227,"measured_runtime_v1":0.0455801534,"runtime_lift":1.0033648271,"key":["s273428297","s958372806"]} +{"user_id":"u086566114","problem_id":"p02414","language":"python","submission_id_v0":"s265967240","submission_id_v1":"s877528630","cpu_time_v0":350,"cpu_time_v1":220,"memory_v0":7052,"memory_v1":7112,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.14,"input":"[n, m, l] = [int(x) for x in input().split()]\n\n\n\nA = []\n\nB = []\n\nC = []\n\ncounter = 0\n\nwhile counter < n:\n\n A.append([int(x) for x in input().split()])\n\n counter += 1\n\n\n\ncounter = 0\n\nwhile counter < m:\n\n B.append([int(x) for x in input().split()])\n\n counter += 1\n\n\n\ncounter = 0\n\nwhile counter < n:\n\n C.append([0] * l)\n\n counter += 1\n\n\n\nfor i in range(n):\n\n for j in range(l):\n\n for k in range(m):\n\n C[i][j] += (A[i][k] * B[k][j])\n\n\n\nfor data in C:\n\n print((' '.join([str(x) for x in data])))","target":"[n, m, l] = [int(x) for x in input().split()]\n\n\n\nA = []\n\nB = []\n\ncounter = 0\n\nwhile counter < n:\n\n A.append([int(x) for x in input().split()])\n\n counter += 1\n\n\n\ncounter = 0\n\nwhile counter < m:\n\n B.append([int(x) for x in input().split()])\n\n counter += 1\n\n\n\nB = list(zip(*B))\n\n\n\nfor i in range(n):\n\n data = []\n\n for j in range(l):\n\n data.append(sum([x[0] * x[1] for x in zip(A[i], B[j])]))\n\n print((' '.join([str(x) for x in data])))","code_v0_loc":27,"code_v1_loc":21,"code_v0_num_chars":542,"code_v1_num_chars":470,"code_v0_no_empty_lines":"[n, m, l] = [int(x) for x in input().split()]\nA = []\nB = []\nC = []\ncounter = 0\nwhile counter < n:\n A.append([int(x) for x in input().split()])\n counter += 1\ncounter = 0\nwhile counter < m:\n B.append([int(x) for x in input().split()])\n counter += 1\ncounter = 0\nwhile counter < n:\n C.append([0] * l)\n counter += 1\nfor i in range(n):\n for j in range(l):\n for k in range(m):\n C[i][j] += A[i][k] * B[k][j]\nfor data in C:\n print((\" \".join([str(x) for x in data])))\n","code_v1_no_empty_lines":"[n, m, l] = [int(x) for x in input().split()]\nA = []\nB = []\ncounter = 0\nwhile counter < n:\n A.append([int(x) for x in input().split()])\n counter += 1\ncounter = 0\nwhile counter < m:\n B.append([int(x) for x in input().split()])\n counter += 1\nB = list(zip(*B))\nfor i in range(n):\n data = []\n for j in range(l):\n data.append(sum([x[0] * x[1] for x in zip(A[i], B[j])]))\n print((\" \".join([str(x) for x in data])))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-C = []","-counter = 0","-while counter < n:","- C.append([0] * l)","- counter += 1","+B = list(zip(*B))","+ data = []","- for k in range(m):","- C[i][j] += A[i][k] * B[k][j]","-for data in C:","+ data.append(sum([x[0] * x[1] for x in zip(A[i], B[j])]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0805771067,"measured_runtime_v1":0.037082886,"runtime_lift":2.172892011,"key":["s265967240","s877528630"]} +{"user_id":"u375193358","problem_id":"p02640","language":"python","submission_id_v0":"s871258777","submission_id_v1":"s695159233","cpu_time_v0":31,"cpu_time_v1":26,"memory_v0":9192,"memory_v1":9108,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.13,"input":"X, Y = list(map(int,input().split()))\n\nans = 'No'\n\nif 4*X < Y:\n\n print(ans)\n\nelse:\n\n for i in range(1,X+1):\n\n crane = i\n\n turtle = X - i\n\n crane2 = X - i\n\n turtle2 = i\n\n if 2*crane + 4*turtle == Y or 2*crane2 + 4*turtle2 == Y:\n\n ans = 'Yes'\n\n break\n\n print(ans)","target":"X, Y = list(map(int,input().split()))\n\nans = 'No'\n\nif 4*X < Y:\n\n print(ans)\n\nelse:\n\n for i in range(X+1):\n\n crane = i\n\n turtle = X - i\n\n if 2*crane + 4*turtle == Y:\n\n ans = 'Yes'\n\n break\n\n print(ans)","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":321,"code_v1_num_chars":245,"code_v0_no_empty_lines":"X, Y = list(map(int, input().split()))\nans = \"No\"\nif 4 * X < Y:\n print(ans)\nelse:\n for i in range(1, X + 1):\n crane = i\n turtle = X - i\n crane2 = X - i\n turtle2 = i\n if 2 * crane + 4 * turtle == Y or 2 * crane2 + 4 * turtle2 == Y:\n ans = \"Yes\"\n break\n print(ans)\n","code_v1_no_empty_lines":"X, Y = list(map(int, input().split()))\nans = \"No\"\nif 4 * X < Y:\n print(ans)\nelse:\n for i in range(X + 1):\n crane = i\n turtle = X - i\n if 2 * crane + 4 * turtle == Y:\n ans = \"Yes\"\n break\n print(ans)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["- for i in range(1, X + 1):","+ for i in range(X + 1):","- crane2 = X - i","- turtle2 = i","- if 2 * crane + 4 * turtle == Y or 2 * crane2 + 4 * turtle2 == Y:","+ if 2 * crane + 4 * turtle == Y:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0346502099,"measured_runtime_v1":0.0331605184,"runtime_lift":1.0449236489,"key":["s871258777","s695159233"]} +{"user_id":"u164727245","problem_id":"p02596","language":"python","submission_id_v0":"s939571884","submission_id_v1":"s121951272","cpu_time_v0":144,"cpu_time_v1":131,"memory_v0":9144,"memory_v1":9476,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.03,"input":"# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n ret = 1\n\n a = 7 % k\n\n while(a):\n\n a = (a*10+7) % k\n\n ret += 1\n\n if k < ret:\n\n ret = -1\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n","target":"# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n k = int(args[0])\n\n\n\n l = 9*(k\/\/7 if k % 7 == 0 else k)\n\n if l % 2 == 0 or l % 5 == 0:\n\n return '-1'\n\n\n\n r = phi = l\n\n for i in range(2, int(-pow(l, 1\/2))):\n\n if r % i == 0:\n\n phi = phi\/\/i*(i-1)\n\n while r % i:\n\n r \/\/= i\n\n\n\n a = 10 % l\n\n ret = 1\n\n while(a != 1):\n\n a = a*10 % l\n\n ret += 1\n\n if phi < ret:\n\n ret = -1\n\n break\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n","code_v0_loc":20,"code_v1_loc":31,"code_v0_num_chars":329,"code_v1_num_chars":598,"code_v0_no_empty_lines":"# coding: utf-8\ndef solve(*args: str) -> str:\n k = int(args[0])\n ret = 1\n a = 7 % k\n while a:\n a = (a * 10 + 7) % k\n ret += 1\n if k < ret:\n ret = -1\n break\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_v1_no_empty_lines":"# coding: utf-8\ndef solve(*args: str) -> str:\n k = int(args[0])\n l = 9 * (k \/\/ 7 if k % 7 == 0 else k)\n if l % 2 == 0 or l % 5 == 0:\n return \"-1\"\n r = phi = l\n for i in range(2, int(-pow(l, 1 \/ 2))):\n if r % i == 0:\n phi = phi \/\/ i * (i - 1)\n while r % i:\n r \/\/= i\n a = 10 % l\n ret = 1\n while a != 1:\n a = a * 10 % l\n ret += 1\n if phi < ret:\n ret = -1\n break\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_same":false,"relative_loc_diff_percent":35.4838709677,"diff":["+ l = 9 * (k \/\/ 7 if k % 7 == 0 else k)","+ if l % 2 == 0 or l % 5 == 0:","+ return \"-1\"","+ r = phi = l","+ for i in range(2, int(-pow(l, 1 \/ 2))):","+ if r % i == 0:","+ phi = phi \/\/ i * (i - 1)","+ while r % i:","+ r \/\/= i","+ a = 10 % l","- a = 7 % k","- while a:","- a = (a * 10 + 7) % k","+ while a != 1:","+ a = a * 10 % l","- if k < ret:","+ if phi < ret:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0924160597,"measured_runtime_v1":0.184799403,"runtime_lift":0.500088519,"key":["s939571884","s121951272"]} +{"user_id":"u562935282","problem_id":"p03862","language":"python","submission_id_v0":"s645487388","submission_id_v1":"s482271611","cpu_time_v0":161,"cpu_time_v1":111,"memory_v0":14636,"memory_v1":14508,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.06,"input":"def main():\n\n from collections import deque\n\n\n\n N, L = list(map(int, input().split()))\n\n *a, = list(map(int, input().split()))\n\n\n\n def solve(a):\n\n dq = deque()\n\n s = 0\n\n ans = 0\n\n for x in a:\n\n if len(dq) > 1:\n\n t = dq.popleft()\n\n s -= t\n\n eat = max(0, s + x - L)\n\n if eat:\n\n x -= eat\n\n ans += eat\n\n s += x\n\n dq.append(x)\n\n return ans\n\n\n\n ans = min(solve(a), solve(reversed(a)))\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n from collections import deque\n\n\n\n N, L = list(map(int, input().split()))\n\n *a, = list(map(int, input().split()))\n\n\n\n def solve(a):\n\n dq = deque()\n\n s = 0\n\n ans = 0\n\n for x in a:\n\n if len(dq) > 1:\n\n t = dq.popleft()\n\n s -= t\n\n eat = max(0, s + x - L)\n\n if eat:\n\n x -= eat\n\n ans += eat\n\n s += x\n\n dq.append(x)\n\n return ans\n\n\n\n ans =solve(a) # reversed(a)\u78ba\u8a8d\u3057\u306a\u3044\u3068\u3069\u3046\u306a\u308b\u304b\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":29,"code_v1_loc":29,"code_v0_num_chars":594,"code_v1_num_chars":593,"code_v0_no_empty_lines":"def main():\n from collections import deque\n\n N, L = list(map(int, input().split()))\n (*a,) = list(map(int, input().split()))\n\n def solve(a):\n dq = deque()\n s = 0\n ans = 0\n for x in a:\n if len(dq) > 1:\n t = dq.popleft()\n s -= t\n eat = max(0, s + x - L)\n if eat:\n x -= eat\n ans += eat\n s += x\n dq.append(x)\n return ans\n\n ans = min(solve(a), solve(reversed(a)))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n from collections import deque\n\n N, L = list(map(int, input().split()))\n (*a,) = list(map(int, input().split()))\n\n def solve(a):\n dq = deque()\n s = 0\n ans = 0\n for x in a:\n if len(dq) > 1:\n t = dq.popleft()\n s -= t\n eat = max(0, s + x - L)\n if eat:\n x -= eat\n ans += eat\n s += x\n dq.append(x)\n return ans\n\n ans = solve(a) # reversed(a)\u78ba\u8a8d\u3057\u306a\u3044\u3068\u3069\u3046\u306a\u308b\u304b\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- ans = min(solve(a), solve(reversed(a)))","+ ans = solve(a) # reversed(a)\u78ba\u8a8d\u3057\u306a\u3044\u3068\u3069\u3046\u306a\u308b\u304b"],"diff_only_import_comment":false,"measured_runtime_v0":0.0325497847,"measured_runtime_v1":0.0333342056,"runtime_lift":0.9764679865,"key":["s645487388","s482271611"]} +{"user_id":"u072053884","problem_id":"p02279","language":"python","submission_id_v0":"s208753076","submission_id_v1":"s133281111","cpu_time_v0":1440,"cpu_time_v1":1310,"memory_v0":61852,"memory_v1":61916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.03,"input":"\"\"\"Rooted Trees.\"\"\"\n\n\n\nclass Node:\n\n def __init__(self, num, parent, *children):\n\n self.id = num\n\n self.parent = parent\n\n self.children = list(children)\n\n self.depth = 0\n\n \n\n def show_info(self):\n\n print('node {0}: '.format(self.id), end = '')\n\n print('parent = {0}, '.format(self.parent), end = '')\n\n print('depth = {0}, '.format(self.depth), end = '')\n\n if self.children and self.parent != -1:\n\n print('internal node, ', end = '')\n\n elif self.parent != -1:\n\n print('leaf, ', end = '')\n\n else:\n\n print('root, ', end = '')\n\n print(self.children)\n\n\n\n\n\nclass RootedTree():\n\n def __init__(self, n):\n\n self.nodes = [Node(i, -1) for i in range(n)]\n\n \n\n def set_node(self, i_p):\n\n i_p = list(map(int, i_p.split()))\n\n num = i_p[0]\n\n children = i_p[2:]\n\n if children:\n\n self.nodes[num].children = children\n\n for n in children:\n\n self.nodes[n].parent = num\n\n\n\n def set_depth(self):\n\n for n in self.nodes:\n\n t_n = n\n\n while t_n.parent != -1:\n\n n.depth += 1\n\n t_n = self.nodes[t_n.parent]\n\n\n\n def show_nodes_info(self):\n\n for n in self.nodes:\n\n n.show_info()\n\n\n\n\n\n\n\nimport sys\n\n\n\nn = int(sys.stdin.readline())\n\n\n\nT = RootedTree(n)\n\n\n\nfor x in sys.stdin.readlines():\n\n T.set_node(x)\n\n\n\nT.set_depth()\n\n\n\nT.show_nodes_info()\n","target":"class Node:\n\n def __init__(self, num, parent, *children):\n\n self.id = num\n\n self.parent = parent\n\n self.children = list(children)\n\n self.depth = 0\n\n \n\n def show_info(self):\n\n print('node {0}: '.format(self.id), end = '')\n\n print('parent = {0}, '.format(self.parent), end = '')\n\n print('depth = {0}, '.format(self.depth), end = '')\n\n if self.children and self.parent != -1:\n\n print('internal node, ', end = '')\n\n elif self.parent != -1:\n\n print('leaf, ', end = '')\n\n else:\n\n print('root, ', end = '')\n\n print(self.children)\n\n\n\n\n\ndef set_node(i_p):\n\n i_p = list(map(int, i_p.split()))\n\n num = i_p[0]\n\n children = i_p[2:]\n\n if children:\n\n T[num].children = children\n\n for n in children:\n\n T[n].parent = num\n\n\n\ndef find_root(node):\n\n while node.parent != -1:\n\n node = T[node.parent]\n\n return node\n\n\n\ndef set_depth(node, depth):\n\n node.depth = depth\n\n for n in node.children:\n\n set_depth(T[n], depth + 1)\n\n\n\n\n\n\n\nimport sys\n\n\n\nn = int(sys.stdin.readline())\n\n\n\nT = [Node(i, -1) for i in range(n)]\n\n\n\nfor x in sys.stdin.readlines():\n\n set_node(x)\n\n\n\nr_n = find_root(T[0])\n\n\n\nset_depth(r_n, 0)\n\n\n\nfor n in T:\n\n n.show_info()\n","code_v0_loc":60,"code_v1_loc":56,"code_v0_num_chars":1500,"code_v1_num_chars":1307,"code_v0_no_empty_lines":"\"\"\"Rooted Trees.\"\"\"\n\n\nclass Node:\n def __init__(self, num, parent, *children):\n self.id = num\n self.parent = parent\n self.children = list(children)\n self.depth = 0\n\n def show_info(self):\n print(\"node {0}: \".format(self.id), end=\"\")\n print(\"parent = {0}, \".format(self.parent), end=\"\")\n print(\"depth = {0}, \".format(self.depth), end=\"\")\n if self.children and self.parent != -1:\n print(\"internal node, \", end=\"\")\n elif self.parent != -1:\n print(\"leaf, \", end=\"\")\n else:\n print(\"root, \", end=\"\")\n print(self.children)\n\n\nclass RootedTree:\n def __init__(self, n):\n self.nodes = [Node(i, -1) for i in range(n)]\n\n def set_node(self, i_p):\n i_p = list(map(int, i_p.split()))\n num = i_p[0]\n children = i_p[2:]\n if children:\n self.nodes[num].children = children\n for n in children:\n self.nodes[n].parent = num\n\n def set_depth(self):\n for n in self.nodes:\n t_n = n\n while t_n.parent != -1:\n n.depth += 1\n t_n = self.nodes[t_n.parent]\n\n def show_nodes_info(self):\n for n in self.nodes:\n n.show_info()\n\n\nimport sys\n\nn = int(sys.stdin.readline())\nT = RootedTree(n)\nfor x in sys.stdin.readlines():\n T.set_node(x)\nT.set_depth()\nT.show_nodes_info()\n","code_v1_no_empty_lines":"class Node:\n def __init__(self, num, parent, *children):\n self.id = num\n self.parent = parent\n self.children = list(children)\n self.depth = 0\n\n def show_info(self):\n print(\"node {0}: \".format(self.id), end=\"\")\n print(\"parent = {0}, \".format(self.parent), end=\"\")\n print(\"depth = {0}, \".format(self.depth), end=\"\")\n if self.children and self.parent != -1:\n print(\"internal node, \", end=\"\")\n elif self.parent != -1:\n print(\"leaf, \", end=\"\")\n else:\n print(\"root, \", end=\"\")\n print(self.children)\n\n\ndef set_node(i_p):\n i_p = list(map(int, i_p.split()))\n num = i_p[0]\n children = i_p[2:]\n if children:\n T[num].children = children\n for n in children:\n T[n].parent = num\n\n\ndef find_root(node):\n while node.parent != -1:\n node = T[node.parent]\n return node\n\n\ndef set_depth(node, depth):\n node.depth = depth\n for n in node.children:\n set_depth(T[n], depth + 1)\n\n\nimport sys\n\nn = int(sys.stdin.readline())\nT = [Node(i, -1) for i in range(n)]\nfor x in sys.stdin.readlines():\n set_node(x)\nr_n = find_root(T[0])\nset_depth(r_n, 0)\nfor n in T:\n n.show_info()\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["-\"\"\"Rooted Trees.\"\"\"","-","-","-class RootedTree:","- def __init__(self, n):","- self.nodes = [Node(i, -1) for i in range(n)]","+def set_node(i_p):","+ i_p = list(map(int, i_p.split()))","+ num = i_p[0]","+ children = i_p[2:]","+ if children:","+ T[num].children = children","+ for n in children:","+ T[n].parent = num","- def set_node(self, i_p):","- i_p = list(map(int, i_p.split()))","- num = i_p[0]","- children = i_p[2:]","- if children:","- self.nodes[num].children = children","- for n in children:","- self.nodes[n].parent = num","- def set_depth(self):","- for n in self.nodes:","- t_n = n","- while t_n.parent != -1:","- n.depth += 1","- t_n = self.nodes[t_n.parent]","+def find_root(node):","+ while node.parent != -1:","+ node = T[node.parent]","+ return node","- def show_nodes_info(self):","- for n in self.nodes:","- n.show_info()","+","+def set_depth(node, depth):","+ node.depth = depth","+ for n in node.children:","+ set_depth(T[n], depth + 1)","-T = RootedTree(n)","+T = [Node(i, -1) for i in range(n)]","- T.set_node(x)","-T.set_depth()","-T.show_nodes_info()","+ set_node(x)","+r_n = find_root(T[0])","+set_depth(r_n, 0)","+for n in T:","+ n.show_info()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0069772879,"measured_runtime_v1":0.0444175919,"runtime_lift":0.1570838857,"key":["s208753076","s133281111"]} +{"user_id":"u324314500","problem_id":"p03147","language":"python","submission_id_v0":"s694466224","submission_id_v1":"s991799754","cpu_time_v0":195,"cpu_time_v1":33,"memory_v0":40944,"memory_v1":9432,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.08,"input":"# ContestName\n\n# URL\n\nimport sys\n\n#import numpy as np\n\n\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\n\nss2nn = lambda ss: [int(s) for s in ss]\n\nss2nnn = lambda ss: [s2nn(s) for s in ss]\n\ni2s = lambda: sys.stdin.readline().rstrip()\n\ni2n = lambda: int(i2s())\n\ni2nn = lambda: s2nn(i2s())\n\nii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]\n\nii2nn = lambda n: ss2nn(ii2ss(n))\n\nii2nnn = lambda n: ss2nnn(ii2ss(n))\n\n\n\ndef main():\n\n N = i2n()\n\n H = i2nn()\n\n n = 0\n\n while True:\n\n l = -1\n\n r = -1\n\n for i, h in enumerate(H):\n\n if l == -1 and h > 0:\n\n l = i\n\n if l > -1 and r == -1 and h <= 0:\n\n r = i\n\n if l == -1:\n\n break\n\n if r == -1:\n\n r = N\n\n for i in range(l, r):\n\n H[i] -= 1\n\n n += 1\n\n print(n)\n\n\n\nmain()\n","target":"import sys\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\n\nss2nn = lambda ss: [int(s) for s in ss]\n\nss2nnn = lambda ss: [s2nn(s) for s in ss]\n\ni2s = lambda: sys.stdin.readline().rstrip()\n\ni2n = lambda: int(i2s())\n\ni2nn = lambda: s2nn(i2s())\n\nii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]\n\nii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]\n\nii2nn = lambda n: ss2nn(ii2ss(n))\n\nii2nnn = lambda n: ss2nnn(ii2ss(n))\n\nfrom collections import deque # \u53cc\u65b9\u5411\u30ad\u30e5\u30fc\n\nfrom collections import defaultdict # \u521d\u671f\u5316\u6e08\u307f\u8f9e\u66f8\n\nfrom heapq import heapify, heappush, heappop, heappushpop # \u30d7\u30e9\u30a4\u30aa\u30ea\u30c6\u30a3\u30ad\u30e5\u30fc\n\nfrom bisect import bisect_left, bisect_right # \u4e8c\u5206\u63a2\u7d22\n\nsys.setrecursionlimit(int(1e+6))\n\nMOD = int(1e+9) + 7\n\n#import numpy as np # 1.8.2\n\n#import scipy # 0.13.3\n\n\n\ndef main():\n\n N = i2n()\n\n H = i2nn()\n\n op = 0\n\n while True:\n\n b = False\n\n hmax = 0\n\n for i in range(N):\n\n if H[i] > 0:\n\n if b == False:\n\n b = True\n\n op += 1\n\n H[i] -= 1\n\n if hmax < H[i]:\n\n hmax = H[i]\n\n else:\n\n b = False\n\n if hmax == 0:\n\n break\n\n print(op)\n\n\n\nmain()\n","code_v0_loc":37,"code_v1_loc":42,"code_v0_num_chars":872,"code_v1_num_chars":1249,"code_v0_no_empty_lines":"# ContestName\n# URL\nimport sys\n\n# import numpy as np\ns2nn = lambda s: [int(c) for c in s.split(\" \")]\nss2nn = lambda ss: [int(s) for s in ss]\nss2nnn = lambda ss: [s2nn(s) for s in ss]\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\nii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]\nii2nn = lambda n: ss2nn(ii2ss(n))\nii2nnn = lambda n: ss2nnn(ii2ss(n))\n\n\ndef main():\n N = i2n()\n H = i2nn()\n n = 0\n while True:\n l = -1\n r = -1\n for i, h in enumerate(H):\n if l == -1 and h > 0:\n l = i\n if l > -1 and r == -1 and h <= 0:\n r = i\n if l == -1:\n break\n if r == -1:\n r = N\n for i in range(l, r):\n H[i] -= 1\n n += 1\n print(n)\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\n\ns2nn = lambda s: [int(c) for c in s.split(\" \")]\nss2nn = lambda ss: [int(s) for s in ss]\nss2nnn = lambda ss: [s2nn(s) for s in ss]\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\nii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]\nii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]\nii2nn = lambda n: ss2nn(ii2ss(n))\nii2nnn = lambda n: ss2nnn(ii2ss(n))\nfrom collections import deque # \u53cc\u65b9\u5411\u30ad\u30e5\u30fc\nfrom collections import defaultdict # \u521d\u671f\u5316\u6e08\u307f\u8f9e\u66f8\nfrom heapq import heapify, heappush, heappop, heappushpop # \u30d7\u30e9\u30a4\u30aa\u30ea\u30c6\u30a3\u30ad\u30e5\u30fc\nfrom bisect import bisect_left, bisect_right # \u4e8c\u5206\u63a2\u7d22\n\nsys.setrecursionlimit(int(1e6))\nMOD = int(1e9) + 7\n# import numpy as np # 1.8.2\n# import scipy # 0.13.3\ndef main():\n N = i2n()\n H = i2nn()\n op = 0\n while True:\n b = False\n hmax = 0\n for i in range(N):\n if H[i] > 0:\n if b == False:\n b = True\n op += 1\n H[i] -= 1\n if hmax < H[i]:\n hmax = H[i]\n else:\n b = False\n if hmax == 0:\n break\n print(op)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":11.9047619048,"diff":["-# ContestName","-# URL","-# import numpy as np","+ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]","+from collections import deque # \u53cc\u65b9\u5411\u30ad\u30e5\u30fc","+from collections import defaultdict # \u521d\u671f\u5316\u6e08\u307f\u8f9e\u66f8","+from heapq import heapify, heappush, heappop, heappushpop # \u30d7\u30e9\u30a4\u30aa\u30ea\u30c6\u30a3\u30ad\u30e5\u30fc","+from bisect import bisect_left, bisect_right # \u4e8c\u5206\u63a2\u7d22","-","+sys.setrecursionlimit(int(1e6))","+MOD = int(1e9) + 7","+# import numpy as np # 1.8.2","+# import scipy # 0.13.3","- n = 0","+ op = 0","- l = -1","- r = -1","- for i, h in enumerate(H):","- if l == -1 and h > 0:","- l = i","- if l > -1 and r == -1 and h <= 0:","- r = i","- if l == -1:","+ b = False","+ hmax = 0","+ for i in range(N):","+ if H[i] > 0:","+ if b == False:","+ b = True","+ op += 1","+ H[i] -= 1","+ if hmax < H[i]:","+ hmax = H[i]","+ else:","+ b = False","+ if hmax == 0:","- if r == -1:","- r = N","- for i in range(l, r):","- H[i] -= 1","- n += 1","- print(n)","+ print(op)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0461494262,"measured_runtime_v1":0.1218801293,"runtime_lift":0.3786460227,"key":["s694466224","s991799754"]} +{"user_id":"u223646582","problem_id":"p03363","language":"python","submission_id_v0":"s930595054","submission_id_v1":"s715261983","cpu_time_v0":339,"cpu_time_v1":165,"memory_v0":111440,"memory_v1":41472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.33,"input":"from collections import defaultdict\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\n\n\nd = defaultdict(int)\n\n\n\nd[0] = 1\n\nsum = 0\n\nfor i in range(N):\n\n sum += A[i]\n\n d[sum] += 1\n\n\n\nans = 0\n\nfor v in list(d.values()):\n\n if v >= 2:\n\n ans += (v*(v-1))\/\/2\n\n\n\nprint(ans)\n","target":"import collections\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\n\n\nS = [0]\n\nfor a in A:\n\n S.append(S[-1]+a)\n\n\n\nC = collections.Counter(S)\n\n\n\nans = 0\n\nfor v in list(C.values()):\n\n if v >= 2:\n\n ans += v*(v-1)\/\/2\n\nprint(ans)\n","code_v0_loc":18,"code_v1_loc":15,"code_v0_num_chars":284,"code_v1_num_chars":241,"code_v0_no_empty_lines":"from collections import defaultdict\n\nN = int(eval(input()))\nA = [int(i) for i in input().split()]\nd = defaultdict(int)\nd[0] = 1\nsum = 0\nfor i in range(N):\n sum += A[i]\n d[sum] += 1\nans = 0\nfor v in list(d.values()):\n if v >= 2:\n ans += (v * (v - 1)) \/\/ 2\nprint(ans)\n","code_v1_no_empty_lines":"import collections\n\nN = int(eval(input()))\nA = [int(i) for i in input().split()]\nS = [0]\nfor a in A:\n S.append(S[-1] + a)\nC = collections.Counter(S)\nans = 0\nfor v in list(C.values()):\n if v >= 2:\n ans += v * (v - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-from collections import defaultdict","+import collections","-d = defaultdict(int)","-d[0] = 1","-sum = 0","-for i in range(N):","- sum += A[i]","- d[sum] += 1","+S = [0]","+for a in A:","+ S.append(S[-1] + a)","+C = collections.Counter(S)","-for v in list(d.values()):","+for v in list(C.values()):","- ans += (v * (v - 1)) \/\/ 2","+ ans += v * (v - 1) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.112792798,"measured_runtime_v1":0.0465047712,"runtime_lift":2.4254027066,"key":["s930595054","s715261983"]} +{"user_id":"u046187684","problem_id":"p03111","language":"python","submission_id_v0":"s747320970","submission_id_v1":"s056803520","cpu_time_v0":1812,"cpu_time_v1":843,"memory_v0":73180,"memory_v1":48860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.48,"input":"from itertools import permutations\n\n\n\n\n\ndef solve(string):\n\n n, a, b, c, *l = list(map(int, string.split()))\n\n ans = 3000\n\n\n\n for _l in permutations(l):\n\n for i in range(1, len(l) - 1):\n\n for j in range(i + 1, len(l)):\n\n for k in range(j + 1, len(l) + 1):\n\n tmp = 10 * (i - 1) + abs(a - sum(_l[:i])) + 10 * (j - i - 1) + abs(\n\n b - sum(_l[i:j])) + 10 * (k - j - 1) + abs(c - sum(_l[j:k]))\n\n if tmp < ans:\n\n ans = tmp\n\n return str(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n n, a, b, c = list(map(int, input().split()))\n\n print((solve('{} {} {} {}\\n'.format(n, a, b, c) + '\\n'.join([eval(input()) for _ in range(n)]))))\n","target":"from itertools import permutations\n\n\n\n\n\ndef solve(string):\n\n n, a, b, c, *l = list(map(int, string.split()))\n\n ans = 3000\n\n\n\n for _l in permutations(l):\n\n for i in range(1, len(l) - 1):\n\n tmp_a = 10 * (i - 1) + abs(a - sum(_l[:i]))\n\n if tmp_a >= ans:\n\n continue\n\n for j in range(i + 1, len(l)):\n\n tmp_b = 10 * (j - i - 1) + abs(b - sum(_l[i:j]))\n\n if tmp_a + tmp_b >= ans:\n\n continue\n\n for k in range(j + 1, len(l) + 1):\n\n tmp = tmp_a + tmp_b + 10 * (k - j - 1) + abs(c - sum(_l[j:k]))\n\n if tmp < ans:\n\n ans = tmp\n\n return str(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n n, a, b, c = list(map(int, input().split()))\n\n print((solve('{} {} {} {}\\n'.format(n, a, b, c) + '\\n'.join([eval(input()) for _ in range(n)]))))\n","code_v0_loc":21,"code_v1_loc":26,"code_v0_num_chars":729,"code_v1_num_chars":889,"code_v0_no_empty_lines":"from itertools import permutations\n\n\ndef solve(string):\n n, a, b, c, *l = list(map(int, string.split()))\n ans = 3000\n for _l in permutations(l):\n for i in range(1, len(l) - 1):\n for j in range(i + 1, len(l)):\n for k in range(j + 1, len(l) + 1):\n tmp = (\n 10 * (i - 1)\n + abs(a - sum(_l[:i]))\n + 10 * (j - i - 1)\n + abs(b - sum(_l[i:j]))\n + 10 * (k - j - 1)\n + abs(c - sum(_l[j:k]))\n )\n if tmp < ans:\n ans = tmp\n return str(ans)\n\n\nif __name__ == \"__main__\":\n n, a, b, c = list(map(int, input().split()))\n print(\n (\n solve(\n \"{} {} {} {}\\n\".format(n, a, b, c)\n + \"\\n\".join([eval(input()) for _ in range(n)])\n )\n )\n )\n","code_v1_no_empty_lines":"from itertools import permutations\n\n\ndef solve(string):\n n, a, b, c, *l = list(map(int, string.split()))\n ans = 3000\n for _l in permutations(l):\n for i in range(1, len(l) - 1):\n tmp_a = 10 * (i - 1) + abs(a - sum(_l[:i]))\n if tmp_a >= ans:\n continue\n for j in range(i + 1, len(l)):\n tmp_b = 10 * (j - i - 1) + abs(b - sum(_l[i:j]))\n if tmp_a + tmp_b >= ans:\n continue\n for k in range(j + 1, len(l) + 1):\n tmp = tmp_a + tmp_b + 10 * (k - j - 1) + abs(c - sum(_l[j:k]))\n if tmp < ans:\n ans = tmp\n return str(ans)\n\n\nif __name__ == \"__main__\":\n n, a, b, c = list(map(int, input().split()))\n print(\n (\n solve(\n \"{} {} {} {}\\n\".format(n, a, b, c)\n + \"\\n\".join([eval(input()) for _ in range(n)])\n )\n )\n )\n","code_same":false,"relative_loc_diff_percent":19.2307692308,"diff":["+ tmp_a = 10 * (i - 1) + abs(a - sum(_l[:i]))","+ if tmp_a >= ans:","+ continue","+ tmp_b = 10 * (j - i - 1) + abs(b - sum(_l[i:j]))","+ if tmp_a + tmp_b >= ans:","+ continue","- tmp = (","- 10 * (i - 1)","- + abs(a - sum(_l[:i]))","- + 10 * (j - i - 1)","- + abs(b - sum(_l[i:j]))","- + 10 * (k - j - 1)","- + abs(c - sum(_l[j:k]))","- )","+ tmp = tmp_a + tmp_b + 10 * (k - j - 1) + abs(c - sum(_l[j:k]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0833213131,"measured_runtime_v1":0.0805916104,"runtime_lift":1.0338708047,"key":["s747320970","s056803520"]} +{"user_id":"u941753895","problem_id":"p03575","language":"python","submission_id_v0":"s056864080","submission_id_v1":"s230856053","cpu_time_v0":51,"cpu_time_v1":47,"memory_v0":5464,"memory_v1":5428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.84,"input":"import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf=10**20\n\nmod=10**9+7\n\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\n\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS(): return sys.stdin.readline().split()\n\ndef S(): return eval(input())\n\n\n\nnmax=50\n\ngraph=[[False]*nmax for _ in range(nmax)]\n\nvisited=[False]*nmax\n\n\n\ndef dfs(n,v):\n\n visited[v]=True\n\n for v2 in range(n):\n\n if graph[v][v2]==False:\n\n continue\n\n if visited[v2]:\n\n continue\n\n dfs(n,v2)\n\n\n\ndef main():\n\n n,m=LI()\n\n a=[]\n\n b=[]\n\n for _ in range(m):\n\n _a,_b=LI()\n\n a.append(_a-1)\n\n b.append(_b-1)\n\n graph[_a-1][_b-1]=True\n\n graph[_b-1][_a-1]=True\n\n\n\n ans=0\n\n for i in range(m):\n\n graph[a[i]][b[i]]=False\n\n graph[b[i]][a[i]]=False\n\n\n\n for j in range(n):\n\n visited[j]=False\n\n\n\n dfs(n,j)\n\n\n\n bridge=False\n\n for j in range(n):\n\n if visited[j]==False:\n\n bridge=True\n\n if bridge:\n\n ans+=1\n\n\n\n graph[a[i]][b[i]]=True\n\n graph[b[i]][a[i]]=True\n\n\n\n return ans\n\n\n\n# main()\n\nprint((main()))\n","target":"import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf=10**20\n\nmod=10**9+7\n\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\n\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef F(): return float(sys.stdin.readline())\n\ndef LS(): return sys.stdin.readline().split()\n\ndef S(): return eval(input())\n\n\n\nlimit=50\n\ngraph=[[False]*limit for _ in range(limit)]\n\nvisited=[False]*limit\n\n\n\ndef dfs(n,v):\n\n visited[v]=True\n\n for v2 in range(n):\n\n if graph[v][v2]==False:\n\n continue\n\n if visited[v2]:\n\n continue\n\n dfs(n,v2)\n\n\n\ndef main():\n\n n,m=LI()\n\n a=[[] for _ in range(n*n)]\n\n b=[[] for _ in range(n*n)]\n\n for i in range(m):\n\n _a,_b=LI()\n\n _a-=1\n\n _b-=1\n\n a[i]=_a\n\n b[i]=_b\n\n graph[_a][_b]=True\n\n graph[_b][_a]=True\n\n\n\n ans=0\n\n for i in range(m):\n\n graph[a[i]][b[i]]=False\n\n graph[b[i]][a[i]]=False\n\n\n\n for j in range(n):\n\n visited[j]=False\n\n dfs(n,0)\n\n no_visited=False\n\n for j in range(n):\n\n if visited[j]==False:\n\n no_visited=True\n\n if no_visited:\n\n ans+=1\n\n graph[a[i]][b[i]]=True\n\n graph[b[i]][a[i]]=True\n\n\n\n return ans\n\n\n\n# main()\n\nprint((main()))\n","code_v0_loc":61,"code_v1_loc":62,"code_v0_num_chars":1223,"code_v1_num_chars":1361,"code_v0_no_empty_lines":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef S():\n return eval(input())\n\n\nnmax = 50\ngraph = [[False] * nmax for _ in range(nmax)]\nvisited = [False] * nmax\n\n\ndef dfs(n, v):\n visited[v] = True\n for v2 in range(n):\n if graph[v][v2] == False:\n continue\n if visited[v2]:\n continue\n dfs(n, v2)\n\n\ndef main():\n n, m = LI()\n a = []\n b = []\n for _ in range(m):\n _a, _b = LI()\n a.append(_a - 1)\n b.append(_b - 1)\n graph[_a - 1][_b - 1] = True\n graph[_b - 1][_a - 1] = True\n ans = 0\n for i in range(m):\n graph[a[i]][b[i]] = False\n graph[b[i]][a[i]] = False\n for j in range(n):\n visited[j] = False\n dfs(n, j)\n bridge = False\n for j in range(n):\n if visited[j] == False:\n bridge = True\n if bridge:\n ans += 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\n return ans\n\n\n# main()\nprint((main()))\n","code_v1_no_empty_lines":"import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef F():\n return float(sys.stdin.readline())\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef S():\n return eval(input())\n\n\nlimit = 50\ngraph = [[False] * limit for _ in range(limit)]\nvisited = [False] * limit\n\n\ndef dfs(n, v):\n visited[v] = True\n for v2 in range(n):\n if graph[v][v2] == False:\n continue\n if visited[v2]:\n continue\n dfs(n, v2)\n\n\ndef main():\n n, m = LI()\n a = [[] for _ in range(n * n)]\n b = [[] for _ in range(n * n)]\n for i in range(m):\n _a, _b = LI()\n _a -= 1\n _b -= 1\n a[i] = _a\n b[i] = _b\n graph[_a][_b] = True\n graph[_b][_a] = True\n ans = 0\n for i in range(m):\n graph[a[i]][b[i]] = False\n graph[b[i]][a[i]] = False\n for j in range(n):\n visited[j] = False\n dfs(n, 0)\n no_visited = False\n for j in range(n):\n if visited[j] == False:\n no_visited = True\n if no_visited:\n ans += 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\n return ans\n\n\n# main()\nprint((main()))\n","code_same":false,"relative_loc_diff_percent":1.6129032258,"diff":["-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy","+import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy","+def LF():","+ return [float(x) for x in sys.stdin.readline().split()]","+","+","+","+","+def F():","+ return float(sys.stdin.readline())","-nmax = 50","-graph = [[False] * nmax for _ in range(nmax)]","-visited = [False] * nmax","+limit = 50","+graph = [[False] * limit for _ in range(limit)]","+visited = [False] * limit","- a = []","- b = []","- for _ in range(m):","+ a = [[] for _ in range(n * n)]","+ b = [[] for _ in range(n * n)]","+ for i in range(m):","- a.append(_a - 1)","- b.append(_b - 1)","- graph[_a - 1][_b - 1] = True","- graph[_b - 1][_a - 1] = True","+ _a -= 1","+ _b -= 1","+ a[i] = _a","+ b[i] = _b","+ graph[_a][_b] = True","+ graph[_b][_a] = True","- dfs(n, j)","- bridge = False","+ dfs(n, 0)","+ no_visited = False","- bridge = True","- if bridge:","+ no_visited = True","+ if no_visited:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0683543675,"measured_runtime_v1":0.0692548609,"runtime_lift":0.986997398,"key":["s056864080","s230856053"]} +{"user_id":"u077291787","problem_id":"p03645","language":"python","submission_id_v0":"s424331983","submission_id_v1":"s691129612","cpu_time_v0":674,"cpu_time_v1":273,"memory_v0":37216,"memory_v1":66180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.5,"input":"# ABC068C - Cat Snuke and a Voyage (ARC079C)\n\ndef main():\n\n N, M = tuple(map(int, input().split()))\n\n A = tuple(tuple(map(int, input().split())) for _ in range(M))\n\n S, D = set(), set() # start, destination\n\n for a, b in A:\n\n if a == 1:\n\n S |= {b}\n\n if b == N:\n\n D |= {a}\n\n flg = S & D # if the same X in both S & D -> possible\n\n print((\"POSSIBLE\" if flg else \"IMPOSSIBLE\"))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"# ABC068C - Cat Snuke and a Voyage (ARC079C)\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n N, M = input().split()\n\n A = tuple(input().split() for _ in range(int(M)))\n\n S, D = set(), set() # start, destination\n\n for a, b in A:\n\n if a == \"1\":\n\n S |= {b}\n\n if b == N:\n\n D |= {a}\n\n flg = S & D # if the same X in both S & D -> possible\n\n print((\"POSSIBLE\" if flg else \"IMPOSSIBLE\"))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":16,"code_v1_loc":19,"code_v0_num_chars":472,"code_v1_num_chars":487,"code_v0_no_empty_lines":"# ABC068C - Cat Snuke and a Voyage (ARC079C)\ndef main():\n N, M = tuple(map(int, input().split()))\n A = tuple(tuple(map(int, input().split())) for _ in range(M))\n S, D = set(), set() # start, destination\n for a, b in A:\n if a == 1:\n S |= {b}\n if b == N:\n D |= {a}\n flg = S & D # if the same X in both S & D -> possible\n print((\"POSSIBLE\" if flg else \"IMPOSSIBLE\"))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# ABC068C - Cat Snuke and a Voyage (ARC079C)\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N, M = input().split()\n A = tuple(input().split() for _ in range(int(M)))\n S, D = set(), set() # start, destination\n for a, b in A:\n if a == \"1\":\n S |= {b}\n if b == N:\n D |= {a}\n flg = S & D # if the same X in both S & D -> possible\n print((\"POSSIBLE\" if flg else \"IMPOSSIBLE\"))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["+import sys","+","+input = sys.stdin.readline","+","+","- N, M = tuple(map(int, input().split()))","- A = tuple(tuple(map(int, input().split())) for _ in range(M))","+ N, M = input().split()","+ A = tuple(input().split() for _ in range(int(M)))","- if a == 1:","+ if a == \"1\":"],"diff_only_import_comment":false,"measured_runtime_v0":0.046375227,"measured_runtime_v1":0.1184339523,"runtime_lift":0.3915703737,"key":["s424331983","s691129612"]} +{"user_id":"u157020659","problem_id":"p03141","language":"python","submission_id_v0":"s221190768","submission_id_v1":"s026784375","cpu_time_v0":469,"cpu_time_v1":404,"memory_v0":7312,"memory_v1":7516,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.86,"input":"import heapq\n\n\n\nn = int(eval(input()))\n\nhappy = []\n\nans = 0\n\nfor i in range(n):\n\n a, b = tuple(map(int, input().split()))\n\n heapq.heappush(happy, - (a + b))\n\n ans += a\n\nwhile len(happy) != 0:\n\n heapq.heappop(happy)\n\n if len(happy) != 0:\n\n h = heapq.heappop(happy)\n\n ans += h\n\n else:\n\n break\n\nprint(ans)\n","target":"n = int(eval(input()))\n\nhappy = []\n\nans = 0\n\nfor i in range(n):\n\n a, b = tuple(map(int, input().split()))\n\n happy.append(a + b)\n\n ans += a\n\nhappy.sort(reverse=True)\n\nfor i in range(1, n, 2):\n\n ans -= happy[i]\n\nprint(ans)\n","code_v0_loc":17,"code_v1_loc":11,"code_v0_num_chars":336,"code_v1_num_chars":227,"code_v0_no_empty_lines":"import heapq\n\nn = int(eval(input()))\nhappy = []\nans = 0\nfor i in range(n):\n a, b = tuple(map(int, input().split()))\n heapq.heappush(happy, -(a + b))\n ans += a\nwhile len(happy) != 0:\n heapq.heappop(happy)\n if len(happy) != 0:\n h = heapq.heappop(happy)\n ans += h\n else:\n break\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nhappy = []\nans = 0\nfor i in range(n):\n a, b = tuple(map(int, input().split()))\n happy.append(a + b)\n ans += a\nhappy.sort(reverse=True)\nfor i in range(1, n, 2):\n ans -= happy[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":35.2941176471,"diff":["-import heapq","-","- heapq.heappush(happy, -(a + b))","+ happy.append(a + b)","-while len(happy) != 0:","- heapq.heappop(happy)","- if len(happy) != 0:","- h = heapq.heappop(happy)","- ans += h","- else:","- break","+happy.sort(reverse=True)","+for i in range(1, n, 2):","+ ans -= happy[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0377304027,"measured_runtime_v1":0.0386638949,"runtime_lift":0.9758562298,"key":["s221190768","s026784375"]} +{"user_id":"u179169725","problem_id":"p02862","language":"python","submission_id_v0":"s247530884","submission_id_v1":"s459795556","cpu_time_v0":932,"cpu_time_v1":660,"memory_v0":82504,"memory_v1":82452,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.18,"input":"# \u5165\u529b\u304c10**5\u3068\u304b\u306b\u306a\u3063\u305f\u3068\u304d\u306b100ms\u7a0b\u5ea6\u65e9\u3044\n\nimport sys\n\nread = sys.stdin.readline\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\ndef read_a_int():\n\n return int(read())\n\n\n\n\n\ndef read_matrix(H):\n\n '''\n\n H is number of rows\n\n '''\n\n return [list(map(int, read().split())) for _ in range(H)]\n\n\n\n\n\ndef read_map(H):\n\n '''\n\n H is number of rows\n\n \u6587\u5b57\u5217\u3067\u4e0e\u3048\u3089\u308c\u305f\u76e4\u9762\u3092\u8aad\u307f\u53d6\u308b\u7528\n\n '''\n\n return [read()[:-1] for _ in range(H)]\n\n\n\n\n\ndef read_col(H, n_cols):\n\n '''\n\n H is number of rows\n\n n_cols is number of cols\n\n\n\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n\n '''\n\n ret = [[] for _ in range(n_cols)]\n\n for _ in range(H):\n\n tmp = list(map(int, read().split()))\n\n for col in range(n_cols):\n\n ret[col].append(tmp[col])\n\n\n\n return ret\n\n\n\n\n\nMOD = 10**9 + 7\n\n\n\nX, Y = read_ints()\n\nif (X + Y) % 3 != 0: # !=0\n\n print((0))\n\n exit()\n\n\n\npascal_depth = int((X + Y) \/ 3) # \u30d1\u30b9\u30ab\u30eb\u306e\u4e09\u89d2\u5f62\u306b\u5f53\u305f\u308bn\n\nx, y = int((X + Y) * 2 \/ 3), (X + Y) \/ 3\n\npascal_k = x - X # \u7aef\u304b\u3089\u3044\u304f\u3064\u305a\u308c\u3066\u3044\u308b\u304b\n\n\n\nif pascal_k > pascal_depth \/ 2:\n\n pascal_k = pascal_depth - pascal_k\n\n\n\n# ans = 1\n\n# # for k in range(int(pascal_k), 0, -1):\n\n# # ans *= pascal_depth\n\n# # # print(ans)\n\n# # pascal_depth -= 1\n\n# # if ans > MOD:\n\n# # ans %= MOD\n\n\n\n# # for k in range(int(pascal_k), 0, -1):\n\n# # \u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c11\u5b9a\u7406j\u3092\u4f7f\u3063\u3066\u307f\u308b\n\n# for i in range(1, int(pascal_depth) + 1):\n\n# ans *= i\n\n# if ans > MOD:\n\n# ans %= MOD\n\n\n\n# from math import factorial\n\n# # k_fact = factorial(pascal_k)\n\n# k_fact = 1\n\n# # k_fact\n\n# for i in range(1, pascal_k + 1):\n\n# k_fact *= i\n\n# if k_fact > MOD:\n\n# k_fact %= MOD\n\n# ans *= k_fact**(MOD - 2) % MOD\n\n# # nk_fact = factorial(pascal_depth - pascal_k)\n\n# nk_fact = 1\n\n# for i in range(1, int(pascal_depth - pascal_k) + 1):\n\n# nk_fact *= i\n\n# if nk_fact > MOD:\n\n# nk_fact %= MOD\n\n\n\n# ans *= nk_fact**(MOD - 2) % MOD\n\n\n\n\n\ndef cmb(n, r, mod):\n\n if (r < 0 or r > n):\n\n return 0\n\n r = min(r, n - r)\n\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\n\n\n\nmod = 10**9 + 7 # \u51fa\u529b\u306e\u5236\u9650\n\nN = pascal_depth\n\ng1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\ng2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\ninverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\n\nfor i in range(2, N + 1):\n\n g1.append((g1[-1] * i) % mod)\n\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n\n g2.append((g2[-1] * inverse[-1]) % mod)\n\n\n\n\n\na = cmb(pascal_depth, pascal_k, mod)\n\nprint(a)\n","target":"# \u5165\u529b\u304c10**5\u3068\u304b\u306b\u306a\u3063\u305f\u3068\u304d\u306b100ms\u7a0b\u5ea6\u65e9\u3044\n\nimport sys\n\nread = sys.stdin.readline\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\ndef read_a_int():\n\n return int(read())\n\n\n\n\n\ndef read_matrix(H):\n\n '''\n\n H is number of rows\n\n '''\n\n return [list(map(int, read().split())) for _ in range(H)]\n\n\n\n\n\ndef read_map(H):\n\n '''\n\n H is number of rows\n\n \u6587\u5b57\u5217\u3067\u4e0e\u3048\u3089\u308c\u305f\u76e4\u9762\u3092\u8aad\u307f\u53d6\u308b\u7528\n\n '''\n\n return [read()[:-1] for _ in range(H)]\n\n\n\n\n\ndef read_col(H, n_cols):\n\n '''\n\n H is number of rows\n\n n_cols is number of cols\n\n\n\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n\n '''\n\n ret = [[] for _ in range(n_cols)]\n\n for _ in range(H):\n\n tmp = list(map(int, read().split()))\n\n for col in range(n_cols):\n\n ret[col].append(tmp[col])\n\n\n\n return ret\n\n\n\n\n\nMOD = 10**9 + 7\n\n\n\nX, Y = read_ints()\n\nif (X + Y) % 3 != 0: # !=0\n\n print((0))\n\n exit()\n\n\n\npascal_depth = int((X + Y) \/ 3) # \u30d1\u30b9\u30ab\u30eb\u306e\u4e09\u89d2\u5f62\u306b\u5f53\u305f\u308bn\n\nx, y = int((X + Y) * 2 \/ 3), (X + Y) \/ 3\n\npascal_k = x - X # \u7aef\u304b\u3089\u3044\u304f\u3064\u305a\u308c\u3066\u3044\u308b\u304b\n\n\n\nif pascal_k > pascal_depth \/ 2:\n\n pascal_k = pascal_depth - pascal_k\n\n\n\n\n\ndef cmb(n, r, mod):\n\n if (r < 0 or r > n):\n\n return 0\n\n r = min(r, n - r)\n\n g1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\n g2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\n inverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\n\n for i in range(2, n + 1):\n\n g1.append((g1[-1] * i) % mod)\n\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n\n g2.append((g2[-1] * inverse[-1]) % mod)\n\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\n\n\n\na = cmb(pascal_depth, pascal_k, MOD)\n\nprint(a)\n","code_v0_loc":113,"code_v1_loc":76,"code_v0_num_chars":2368,"code_v1_num_chars":1537,"code_v0_no_empty_lines":"# \u5165\u529b\u304c10**5\u3068\u304b\u306b\u306a\u3063\u305f\u3068\u304d\u306b100ms\u7a0b\u5ea6\u65e9\u3044\nimport sys\n\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_a_int():\n return int(read())\n\n\ndef read_matrix(H):\n \"\"\"\n H is number of rows\n \"\"\"\n return [list(map(int, read().split())) for _ in range(H)]\n\n\ndef read_map(H):\n \"\"\"\n H is number of rows\n \u6587\u5b57\u5217\u3067\u4e0e\u3048\u3089\u308c\u305f\u76e4\u9762\u3092\u8aad\u307f\u53d6\u308b\u7528\n \"\"\"\n return [read()[:-1] for _ in range(H)]\n\n\ndef read_col(H, n_cols):\n \"\"\"\n H is number of rows\n n_cols is number of cols\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n \"\"\"\n ret = [[] for _ in range(n_cols)]\n for _ in range(H):\n tmp = list(map(int, read().split()))\n for col in range(n_cols):\n ret[col].append(tmp[col])\n return ret\n\n\nMOD = 10**9 + 7\nX, Y = read_ints()\nif (X + Y) % 3 != 0: # !=0\n print((0))\n exit()\npascal_depth = int((X + Y) \/ 3) # \u30d1\u30b9\u30ab\u30eb\u306e\u4e09\u89d2\u5f62\u306b\u5f53\u305f\u308bn\nx, y = int((X + Y) * 2 \/ 3), (X + Y) \/ 3\npascal_k = x - X # \u7aef\u304b\u3089\u3044\u304f\u3064\u305a\u308c\u3066\u3044\u308b\u304b\nif pascal_k > pascal_depth \/ 2:\n pascal_k = pascal_depth - pascal_k\n# ans = 1\n# # for k in range(int(pascal_k), 0, -1):\n# # ans *= pascal_depth\n# # # print(ans)\n# # pascal_depth -= 1\n# # if ans > MOD:\n# # ans %= MOD\n# # for k in range(int(pascal_k), 0, -1):\n# # \u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c11\u5b9a\u7406j\u3092\u4f7f\u3063\u3066\u307f\u308b\n# for i in range(1, int(pascal_depth) + 1):\n# ans *= i\n# if ans > MOD:\n# ans %= MOD\n# from math import factorial\n# # k_fact = factorial(pascal_k)\n# k_fact = 1\n# # k_fact\n# for i in range(1, pascal_k + 1):\n# k_fact *= i\n# if k_fact > MOD:\n# k_fact %= MOD\n# ans *= k_fact**(MOD - 2) % MOD\n# # nk_fact = factorial(pascal_depth - pascal_k)\n# nk_fact = 1\n# for i in range(1, int(pascal_depth - pascal_k) + 1):\n# nk_fact *= i\n# if nk_fact > MOD:\n# nk_fact %= MOD\n# ans *= nk_fact**(MOD - 2) % MOD\ndef cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\nmod = 10**9 + 7 # \u51fa\u529b\u306e\u5236\u9650\nN = pascal_depth\ng1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\ng2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\ninverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\nfor i in range(2, N + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\na = cmb(pascal_depth, pascal_k, mod)\nprint(a)\n","code_v1_no_empty_lines":"# \u5165\u529b\u304c10**5\u3068\u304b\u306b\u306a\u3063\u305f\u3068\u304d\u306b100ms\u7a0b\u5ea6\u65e9\u3044\nimport sys\n\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_a_int():\n return int(read())\n\n\ndef read_matrix(H):\n \"\"\"\n H is number of rows\n \"\"\"\n return [list(map(int, read().split())) for _ in range(H)]\n\n\ndef read_map(H):\n \"\"\"\n H is number of rows\n \u6587\u5b57\u5217\u3067\u4e0e\u3048\u3089\u308c\u305f\u76e4\u9762\u3092\u8aad\u307f\u53d6\u308b\u7528\n \"\"\"\n return [read()[:-1] for _ in range(H)]\n\n\ndef read_col(H, n_cols):\n \"\"\"\n H is number of rows\n n_cols is number of cols\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n \"\"\"\n ret = [[] for _ in range(n_cols)]\n for _ in range(H):\n tmp = list(map(int, read().split()))\n for col in range(n_cols):\n ret[col].append(tmp[col])\n return ret\n\n\nMOD = 10**9 + 7\nX, Y = read_ints()\nif (X + Y) % 3 != 0: # !=0\n print((0))\n exit()\npascal_depth = int((X + Y) \/ 3) # \u30d1\u30b9\u30ab\u30eb\u306e\u4e09\u89d2\u5f62\u306b\u5f53\u305f\u308bn\nx, y = int((X + Y) * 2 \/ 3), (X + Y) \/ 3\npascal_k = x - X # \u7aef\u304b\u3089\u3044\u304f\u3064\u305a\u308c\u3066\u3044\u308b\u304b\nif pascal_k > pascal_depth \/ 2:\n pascal_k = pascal_depth - pascal_k\n\n\ndef cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n g1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n g2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n inverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n for i in range(2, n + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\na = cmb(pascal_depth, pascal_k, MOD)\nprint(a)\n","code_same":false,"relative_loc_diff_percent":32.7433628319,"diff":["-# ans = 1","-# # for k in range(int(pascal_k), 0, -1):","-# # ans *= pascal_depth","-# # # print(ans)","-# # pascal_depth -= 1","-# # if ans > MOD:","-# # ans %= MOD","-# # for k in range(int(pascal_k), 0, -1):","-# # \u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c11\u5b9a\u7406j\u3092\u4f7f\u3063\u3066\u307f\u308b","-# for i in range(1, int(pascal_depth) + 1):","-# ans *= i","-# if ans > MOD:","-# ans %= MOD","-# from math import factorial","-# # k_fact = factorial(pascal_k)","-# k_fact = 1","-# # k_fact","-# for i in range(1, pascal_k + 1):","-# k_fact *= i","-# if k_fact > MOD:","-# k_fact %= MOD","-# ans *= k_fact**(MOD - 2) % MOD","-# # nk_fact = factorial(pascal_depth - pascal_k)","-# nk_fact = 1","-# for i in range(1, int(pascal_depth - pascal_k) + 1):","-# nk_fact *= i","-# if nk_fact > MOD:","-# nk_fact %= MOD","-# ans *= nk_fact**(MOD - 2) % MOD","+","+","+ g1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb","+ g2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb","+ inverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb","+ for i in range(2, n + 1):","+ g1.append((g1[-1] * i) % mod)","+ inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)","+ g2.append((g2[-1] * inverse[-1]) % mod)","-mod = 10**9 + 7 # \u51fa\u529b\u306e\u5236\u9650","-N = pascal_depth","-g1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb","-g2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb","-inverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb","-for i in range(2, N + 1):","- g1.append((g1[-1] * i) % mod)","- inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)","- g2.append((g2[-1] * inverse[-1]) % mod)","-a = cmb(pascal_depth, pascal_k, mod)","+a = cmb(pascal_depth, pascal_k, MOD)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4023358386,"measured_runtime_v1":0.2112327464,"runtime_lift":1.9047039129,"key":["s247530884","s459795556"]} +{"user_id":"u086566114","problem_id":"p02412","language":"python","submission_id_v0":"s498101811","submission_id_v1":"s222732998","cpu_time_v0":640,"cpu_time_v1":560,"memory_v0":6360,"memory_v1":6416,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"while True:\n\n [n, m] = [int(x) for x in input().split()]\n\n if [n, m] == [0, 0]:\n\n break\n\n\n\n hoge = list(range(1, n + 1))\n\n\n\n data = []\n\n for x in range(0, n - 2):\n\n for y in range(x + 1, n - 1):\n\n for z in range(y + 1, n):\n\n s = hoge[x] + hoge[y] + hoge[z]\n\n if s == m:\n\n data.append(s)\n\n\n\n print((len(data)))","target":"while True:\n\n [n, m] = [int(x) for x in input().split()]\n\n if [n, m] == [0, 0]:\n\n break\n\n\n\n hoge = list(range(1, n + 1))\n\n\n\n data = []\n\n for x in range(n - 1, 1, -1):\n\n for y in range(x - 1, 0, -1):\n\n for z in range(y - 1, -1, -1):\n\n # print((x, y, z))\n\n s = hoge[x] + hoge[y] + hoge[z]\n\n if s < m:\n\n break\n\n if s == m:\n\n data.append(s)\n\n\n\n print((len(data)))","code_v0_loc":16,"code_v1_loc":19,"code_v0_num_chars":397,"code_v1_num_chars":496,"code_v0_no_empty_lines":"while True:\n [n, m] = [int(x) for x in input().split()]\n if [n, m] == [0, 0]:\n break\n hoge = list(range(1, n + 1))\n data = []\n for x in range(0, n - 2):\n for y in range(x + 1, n - 1):\n for z in range(y + 1, n):\n s = hoge[x] + hoge[y] + hoge[z]\n if s == m:\n data.append(s)\n print((len(data)))\n","code_v1_no_empty_lines":"while True:\n [n, m] = [int(x) for x in input().split()]\n if [n, m] == [0, 0]:\n break\n hoge = list(range(1, n + 1))\n data = []\n for x in range(n - 1, 1, -1):\n for y in range(x - 1, 0, -1):\n for z in range(y - 1, -1, -1):\n # print((x, y, z))\n s = hoge[x] + hoge[y] + hoge[z]\n if s < m:\n break\n if s == m:\n data.append(s)\n print((len(data)))\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["- for x in range(0, n - 2):","- for y in range(x + 1, n - 1):","- for z in range(y + 1, n):","+ for x in range(n - 1, 1, -1):","+ for y in range(x - 1, 0, -1):","+ for z in range(y - 1, -1, -1):","+ # print((x, y, z))","+ if s < m:","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.0432787189,"measured_runtime_v1":0.0467073138,"runtime_lift":0.9265940479,"key":["s498101811","s222732998"]} +{"user_id":"u409306788","problem_id":"p02939","language":"python","submission_id_v0":"s517235863","submission_id_v1":"s578009408","cpu_time_v0":146,"cpu_time_v1":107,"memory_v0":8064,"memory_v1":8068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.71,"input":"# A - Dividing a String\n\ndef count_substrings(first_substring):\n\n\n\n\tarr = [first_substring]\n\n\ti = len(first_substring)\n\n\n\n\twhile i < len(S):\n\n\t\ts = S[i]\n\n\t\n\n\t\tif s == arr[-1]:\n\n\t\t\tif i + 1 < len(S):\n\n\t\t\t\ti += 1\n\n\t\t\t\ts += S[i]\n\n\t\t\telse:\n\n\t\t\t\tarr[-1] += s\n\n\t\t\t\tbreak\n\n\t\n\n\t\tarr.append(s)\n\n\t\ti += 1\n\n\n\n\treturn len(arr)\n\n\n\n\n\nS = eval(input())\n\n\n\nans1 = count_substrings(S[:1])\n\nans2 = count_substrings(S[:2])\n\n\n\nprint((max(ans1, ans2)))","target":"# A - Dividing a String\n\nS = eval(input())\n\n\n\narr = [S[0]]\n\ni = 1\n\n\n\nwhile i < len(S):\n\n\ts = S[i]\n\n\t\n\n\tif s == arr[-1]:\n\n\t\tif i + 1 < len(S):\n\n\t\t\ti += 1\n\n\t\t\ts += S[i]\n\n\t\telse:\n\n\t\t\tarr[-1] += s\n\n\t\t\tbreak\n\n\t\n\n\tarr.append(s)\n\n\ti += 1\n\n\n\nprint((len(arr)))","code_v0_loc":29,"code_v1_loc":21,"code_v0_num_chars":423,"code_v1_num_chars":243,"code_v0_no_empty_lines":"# A - Dividing a String\ndef count_substrings(first_substring):\n arr = [first_substring]\n i = len(first_substring)\n while i < len(S):\n s = S[i]\n if s == arr[-1]:\n if i + 1 < len(S):\n i += 1\n s += S[i]\n else:\n arr[-1] += s\n break\n arr.append(s)\n i += 1\n return len(arr)\n\n\nS = eval(input())\nans1 = count_substrings(S[:1])\nans2 = count_substrings(S[:2])\nprint((max(ans1, ans2)))\n","code_v1_no_empty_lines":"# A - Dividing a String\nS = eval(input())\narr = [S[0]]\ni = 1\nwhile i < len(S):\n s = S[i]\n if s == arr[-1]:\n if i + 1 < len(S):\n i += 1\n s += S[i]\n else:\n arr[-1] += s\n break\n arr.append(s)\n i += 1\nprint((len(arr)))\n","code_same":false,"relative_loc_diff_percent":27.5862068966,"diff":["-def count_substrings(first_substring):","- arr = [first_substring]","- i = len(first_substring)","- while i < len(S):","- s = S[i]","- if s == arr[-1]:","- if i + 1 < len(S):","- i += 1","- s += S[i]","- else:","- arr[-1] += s","- break","- arr.append(s)","- i += 1","- return len(arr)","-","-","-ans1 = count_substrings(S[:1])","-ans2 = count_substrings(S[:2])","-print((max(ans1, ans2)))","+arr = [S[0]]","+i = 1","+while i < len(S):","+ s = S[i]","+ if s == arr[-1]:","+ if i + 1 < len(S):","+ i += 1","+ s += S[i]","+ else:","+ arr[-1] += s","+ break","+ arr.append(s)","+ i += 1","+print((len(arr)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0770225684,"measured_runtime_v1":0.0769008392,"runtime_lift":1.0015829362,"key":["s517235863","s578009408"]} +{"user_id":"u848535504","problem_id":"p02780","language":"python","submission_id_v0":"s967728932","submission_id_v1":"s449834417","cpu_time_v0":293,"cpu_time_v1":226,"memory_v0":50920,"memory_v1":32520,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.87,"input":"import numpy as np\n\nN,K = list(map(int,input().split()))\n\np = list(map(int,input().split()))\n\n\n\nl = []\n\nfor i in range(N):\n\n l.append((1+p[i])\/2)\n\n\n\na = [0] * N\n\na[0] = l[0]\n\nfor i in range(1,len(l)):\n\n a[i] = a[i-1] + l[i]\n\n\n\nans = 0\n\nfor i in range(K,len(l)):\n\n ans = max(ans,a[i]-a[i-K])\n\n\n\nif N - K == 0:\n\n print((max(a)))\n\nelse:\n\n print(ans)","target":"N,K = list(map(int,input().split()))\n\np = list(map(int,input().split()))\n\n\n\nl = []\n\nfor i in range(N):\n\n l.append(((1+p[i])*(p[i]\/2))\/p[i])\n\n\n\nque = [0]*(N+1)\n\nfor i in range(1,N+1):\n\n que[i] = l[i-1]+que[i-1]\n\n\n\nans = 0\n\nfor i in range(K,len(l)):\n\n ans = max(ans,que[i+1]-que[i+1-K])\n\n\n\nif N == K:\n\n print((max(que)))\n\nelse:\n\n print(ans)","code_v0_loc":21,"code_v1_loc":19,"code_v0_num_chars":353,"code_v1_num_chars":345,"code_v0_no_empty_lines":"import numpy as np\n\nN, K = list(map(int, input().split()))\np = list(map(int, input().split()))\nl = []\nfor i in range(N):\n l.append((1 + p[i]) \/ 2)\na = [0] * N\na[0] = l[0]\nfor i in range(1, len(l)):\n a[i] = a[i - 1] + l[i]\nans = 0\nfor i in range(K, len(l)):\n ans = max(ans, a[i] - a[i - K])\nif N - K == 0:\n print((max(a)))\nelse:\n print(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\np = list(map(int, input().split()))\nl = []\nfor i in range(N):\n l.append(((1 + p[i]) * (p[i] \/ 2)) \/ p[i])\nque = [0] * (N + 1)\nfor i in range(1, N + 1):\n que[i] = l[i - 1] + que[i - 1]\nans = 0\nfor i in range(K, len(l)):\n ans = max(ans, que[i + 1] - que[i + 1 - K])\nif N == K:\n print((max(que)))\nelse:\n print(ans)\n","code_same":false,"relative_loc_diff_percent":9.5238095238,"diff":["-import numpy as np","-","- l.append((1 + p[i]) \/ 2)","-a = [0] * N","-a[0] = l[0]","-for i in range(1, len(l)):","- a[i] = a[i - 1] + l[i]","+ l.append(((1 + p[i]) * (p[i] \/ 2)) \/ p[i])","+que = [0] * (N + 1)","+for i in range(1, N + 1):","+ que[i] = l[i - 1] + que[i - 1]","- ans = max(ans, a[i] - a[i - K])","-if N - K == 0:","- print((max(a)))","+ ans = max(ans, que[i + 1] - que[i + 1 - K])","+if N == K:","+ print((max(que)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0892415221,"measured_runtime_v1":0.0469943335,"runtime_lift":1.898984737,"key":["s967728932","s449834417"]} +{"user_id":"u707124227","problem_id":"p03311","language":"python","submission_id_v0":"s995038178","submission_id_v1":"s786317276","cpu_time_v0":216,"cpu_time_v1":143,"memory_v0":25168,"memory_v1":119420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.8,"input":"def main(n,a):\n\n a=sorted([a[i]-i for i in range(n)])\n\n m0=a[n\/\/2]\n\n m1=a[n\/\/2-1]\n\n ans0,ans1=0,0\n\n for i in range(n):\n\n ans0+=abs(a[i]-m0)\n\n ans1+=abs(a[i]-m1)\n\n print((min(ans0,ans1)))\n\nif __name__=='__main__':\n\n import sys\n\n input = sys.stdin.readline\n\n n=int(eval(input()))\n\n a=list(map(int,input().split()))\n\n main(n,a)\n","target":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\na=[x-i-1 for i,x in enumerate(a)]\n\na.sort()\n\nb=a[n\/\/2]\n\nprint((sum([abs(x-b) for x in a])))","code_v0_loc":15,"code_v1_loc":6,"code_v0_num_chars":334,"code_v1_num_chars":139,"code_v0_no_empty_lines":"def main(n, a):\n a = sorted([a[i] - i for i in range(n)])\n m0 = a[n \/\/ 2]\n m1 = a[n \/\/ 2 - 1]\n ans0, ans1 = 0, 0\n for i in range(n):\n ans0 += abs(a[i] - m0)\n ans1 += abs(a[i] - m1)\n print((min(ans0, ans1)))\n\n\nif __name__ == \"__main__\":\n import sys\n\n input = sys.stdin.readline\n n = int(eval(input()))\n a = list(map(int, input().split()))\n main(n, a)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\na = [x - i - 1 for i, x in enumerate(a)]\na.sort()\nb = a[n \/\/ 2]\nprint((sum([abs(x - b) for x in a])))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-def main(n, a):","- a = sorted([a[i] - i for i in range(n)])","- m0 = a[n \/\/ 2]","- m1 = a[n \/\/ 2 - 1]","- ans0, ans1 = 0, 0","- for i in range(n):","- ans0 += abs(a[i] - m0)","- ans1 += abs(a[i] - m1)","- print((min(ans0, ans1)))","-","-","-if __name__ == \"__main__\":","- import sys","-","- input = sys.stdin.readline","- n = int(eval(input()))","- a = list(map(int, input().split()))","- main(n, a)","+n = int(eval(input()))","+a = list(map(int, input().split()))","+a = [x - i - 1 for i, x in enumerate(a)]","+a.sort()","+b = a[n \/\/ 2]","+print((sum([abs(x - b) for x in a])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0768548489,"measured_runtime_v1":0.0649424076,"runtime_lift":1.1834308533,"key":["s995038178","s786317276"]} +{"user_id":"u884087839","problem_id":"p02912","language":"python","submission_id_v0":"s895571132","submission_id_v1":"s234681291","cpu_time_v0":171,"cpu_time_v1":155,"memory_v0":19264,"memory_v1":14184,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.36,"input":"#!\/usr\/bin\/env python3\n\nimport sys\n\nimport heapq\n\n\n\ndef solve(N: int, M: int, A: \"List[int]\"):\n\n a = []\n\n for i in A:\n\n heapq.heappush(a, -i)\n\n\n\n for _ in range(M):\n\n m = heapq.heappop(a)\n\n heapq.heappush(a, -(-m \/\/ 2))\n\n\n\n sum = 0\n\n for i in a:\n\n sum += i\n\n print((-sum))\n\n return\n\n\n\n\n\n# Generated by 1.1.7.1 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n M = int(next(tokens)) # type: int\n\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, M, A)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\nimport heapq\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n A = [int(i) for i in input().split()]\n\n a = []\n\n for i in A:\n\n heapq.heappush(a, -i)\n\n\n\n for _ in range(M):\n\n m = heapq.heappop(a)\n\n heapq.heappush(a, -(-m \/\/ 2))\n\n\n\n sum = 0\n\n for i in a:\n\n sum += i\n\n print((-sum))\n\n return \n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":34,"code_v1_loc":23,"code_v0_num_chars":882,"code_v1_num_chars":422,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nimport heapq\n\n\ndef solve(N: int, M: int, A: \"List[int]\"):\n a = []\n for i in A:\n heapq.heappush(a, -i)\n for _ in range(M):\n m = heapq.heappop(a)\n heapq.heappush(a, -(-m \/\/ 2))\n sum = 0\n for i in a:\n sum += i\n print((-sum))\n return\n\n\n# Generated by 1.1.7.1 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n M = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, M, A)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nimport heapq\n\n\ndef main():\n N, M = list(map(int, input().split()))\n A = [int(i) for i in input().split()]\n a = []\n for i in A:\n heapq.heappush(a, -i)\n for _ in range(M):\n m = heapq.heappop(a)\n heapq.heappush(a, -(-m \/\/ 2))\n sum = 0\n for i in a:\n sum += i\n print((-sum))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":32.3529411765,"diff":["-def solve(N: int, M: int, A: \"List[int]\"):","+def main():","+ N, M = list(map(int, input().split()))","+ A = [int(i) for i in input().split()]","-# Generated by 1.1.7.1 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)","-def main():","- def iterate_tokens():","- for line in sys.stdin:","- for word in line.split():","- yield word","-","- tokens = iterate_tokens()","- N = int(next(tokens)) # type: int","- M = int(next(tokens)) # type: int","- A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"","- solve(N, M, A)","-","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.0359044418,"measured_runtime_v1":0.0379660349,"runtime_lift":0.9456990157,"key":["s895571132","s234681291"]} +{"user_id":"u013629972","problem_id":"p03252","language":"python","submission_id_v0":"s180849887","submission_id_v1":"s749645051","cpu_time_v0":167,"cpu_time_v1":148,"memory_v0":3812,"memory_v1":3632,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.38,"input":"S = eval(input())\n\nT = eval(input())\n\n\n\n\n\nfrom collections import Counter\n\n\n\n\n\ns_dict, t_dict = {}, {}\n\n\n\nfor i in range(len(S)):\n\n if S[i] in list(s_dict.keys()):\n\n if s_dict[S[i]] != T[i]:\n\n print(\"No\")\n\n exit()\n\n else:\n\n s_dict[S[i]] = T[i]\n\n\n\n if T[i] in list(t_dict.keys()):\n\n if t_dict[T[i]] != S[i]:\n\n print(\"No\")\n\n exit()\n\n else:\n\n t_dict[T[i]] = S[i]\n\n\n\nprint(\"Yes\")\n","target":"S = eval(input())\n\nT = eval(input())\n\n\n\ns_dict, t_dict = {}, {}\n\n\n\nfor i in range(len(S)):\n\n if S[i] in list(s_dict.keys()):\n\n if s_dict[S[i]] != T[i]:\n\n print(\"No\")\n\n exit()\n\n else:\n\n s_dict[S[i]] = T[i]\n\n\n\n if T[i] in list(t_dict.keys()):\n\n if t_dict[T[i]] != S[i]:\n\n print(\"No\")\n\n exit()\n\n else:\n\n t_dict[T[i]] = S[i]\n\n\n\nprint(\"Yes\")\n","code_v0_loc":25,"code_v1_loc":21,"code_v0_num_chars":436,"code_v1_num_chars":397,"code_v0_no_empty_lines":"S = eval(input())\nT = eval(input())\nfrom collections import Counter\n\ns_dict, t_dict = {}, {}\nfor i in range(len(S)):\n if S[i] in list(s_dict.keys()):\n if s_dict[S[i]] != T[i]:\n print(\"No\")\n exit()\n else:\n s_dict[S[i]] = T[i]\n if T[i] in list(t_dict.keys()):\n if t_dict[T[i]] != S[i]:\n print(\"No\")\n exit()\n else:\n t_dict[T[i]] = S[i]\nprint(\"Yes\")\n","code_v1_no_empty_lines":"S = eval(input())\nT = eval(input())\ns_dict, t_dict = {}, {}\nfor i in range(len(S)):\n if S[i] in list(s_dict.keys()):\n if s_dict[S[i]] != T[i]:\n print(\"No\")\n exit()\n else:\n s_dict[S[i]] = T[i]\n if T[i] in list(t_dict.keys()):\n if t_dict[T[i]] != S[i]:\n print(\"No\")\n exit()\n else:\n t_dict[T[i]] = S[i]\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":16.0,"diff":["-from collections import Counter","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.0471971374,"measured_runtime_v1":0.1671174757,"runtime_lift":0.282418922,"key":["s180849887","s749645051"]} +{"user_id":"u337626942","problem_id":"p03013","language":"python","submission_id_v0":"s126843181","submission_id_v1":"s887871363","cpu_time_v0":475,"cpu_time_v1":196,"memory_v0":460020,"memory_v1":7824,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.74,"input":"n, m=list(map(int, input().split()))\n\na=[int(eval(input())) for i in range(m)]\n\nmod=10**9 +7\n\ndp=[1]*(n+1)\n\ndp[0]=1\n\ndp[1]=1\n\n\n\nfor i in range(m):\n\n dp[a[i]] = 0\n\n\n\nfor i in range(2, n+1):\n\n \n\n if dp[i] > 0:\n\n dp[i]=dp[i-1]+dp[i-2]\n\n\n\nprint((dp[n]%mod))","target":"n, m=list(map(int, input().split()))\n\na=[int(eval(input())) for i in range(m)]\n\nmod=10**9 +7\n\ndp=[1]*(n+1)\n\ndp[0]=1\n\ndp[1]=1\n\n\n\nfor i in range(m):\n\n dp[a[i]] = 0\n\n\n\nfor i in range(2, n+1):\n\n \n\n if dp[i] > 0:\n\n dp[i]=(dp[i-1]+dp[i-2])%mod\n\n\n\nprint((dp[n]))","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":255,"code_v1_num_chars":257,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\na = [int(eval(input())) for i in range(m)]\nmod = 10**9 + 7\ndp = [1] * (n + 1)\ndp[0] = 1\ndp[1] = 1\nfor i in range(m):\n dp[a[i]] = 0\nfor i in range(2, n + 1):\n if dp[i] > 0:\n dp[i] = dp[i - 1] + dp[i - 2]\nprint((dp[n] % mod))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\na = [int(eval(input())) for i in range(m)]\nmod = 10**9 + 7\ndp = [1] * (n + 1)\ndp[0] = 1\ndp[1] = 1\nfor i in range(m):\n dp[a[i]] = 0\nfor i in range(2, n + 1):\n if dp[i] > 0:\n dp[i] = (dp[i - 1] + dp[i - 2]) % mod\nprint((dp[n]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dp[i] = dp[i - 1] + dp[i - 2]","-print((dp[n] % mod))","+ dp[i] = (dp[i - 1] + dp[i - 2]) % mod","+print((dp[n]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.038078501,"measured_runtime_v1":0.0382375643,"runtime_lift":0.9958401286,"key":["s126843181","s887871363"]} +{"user_id":"u879226672","problem_id":"p02407","language":"python","submission_id_v0":"s836796797","submission_id_v1":"s219065666","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4192,"memory_v1":4184,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"n = int(input())\n\nls = list(map(int,input().split()))\n\nprint(' '.join(map(str,ls[::-1])))","target":"n = int(input())\n\nprint(' '.join(input().split()[::-1]))","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":90,"code_v1_num_chars":63,"code_v0_no_empty_lines":"n = int(input())\nls = list(map(int, input().split()))\nprint(\" \".join(map(str, ls[::-1])))\n","code_v1_no_empty_lines":"n = int(input())\nprint(\" \".join(input().split()[::-1]))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-ls = list(map(int, input().split()))","-print(\" \".join(map(str, ls[::-1])))","+print(\" \".join(input().split()[::-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0829824549,"measured_runtime_v1":0.008134798,"runtime_lift":10.2009238748,"key":["s836796797","s219065666"]} +{"user_id":"u408071652","problem_id":"p02707","language":"python","submission_id_v0":"s625692243","submission_id_v1":"s614432119","cpu_time_v0":167,"cpu_time_v1":152,"memory_v0":92512,"memory_v1":25816,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.98,"input":"n = int(eval(input()))\n\na =list(map(int, input().split()))\n\nl =[0] * (n+1)\n\n\n\nfor i in range(0,n-1):\n\n l[a[i]] +=1\n\n \n\nfor i in range(1,n+1):\n\n print((l[i]))\n\n ","target":"N = int(eval(input()))\n\nl = [0] * (N+1) # 0\u306f\u5229\u7528\u3057\u306a\u3044\n\nA = list(map(int,input().split()))\n\nfor a in A:\n\n l[a] +=1\n\n \n\nfor i in range(N):\n\n print((l[i+1]))\n\n ","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":164,"code_v1_num_chars":152,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nl = [0] * (n + 1)\nfor i in range(0, n - 1):\n l[a[i]] += 1\nfor i in range(1, n + 1):\n print((l[i]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nl = [0] * (N + 1) # 0\u306f\u5229\u7528\u3057\u306a\u3044\nA = list(map(int, input().split()))\nfor a in A:\n l[a] += 1\nfor i in range(N):\n print((l[i + 1]))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-n = int(eval(input()))","-a = list(map(int, input().split()))","-l = [0] * (n + 1)","-for i in range(0, n - 1):","- l[a[i]] += 1","-for i in range(1, n + 1):","- print((l[i]))","+N = int(eval(input()))","+l = [0] * (N + 1) # 0\u306f\u5229\u7528\u3057\u306a\u3044","+A = list(map(int, input().split()))","+for a in A:","+ l[a] += 1","+for i in range(N):","+ print((l[i + 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0380898688,"measured_runtime_v1":0.0371670344,"runtime_lift":1.0248293791,"key":["s625692243","s614432119"]} +{"user_id":"u531220228","problem_id":"p03029","language":"python","submission_id_v0":"s670196924","submission_id_v1":"s715008450","cpu_time_v0":149,"cpu_time_v1":18,"memory_v0":12392,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.92,"input":"import numpy as np\n\nA,P = list(map(int, input().split()))\n\nprint((int(np.floor((3*A+P)\/2))))","target":"import math\n\nA,P = list(map(int, input().split()))\n\nprint((int(math.floor((3*A+P)\/2))))","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":84,"code_v1_num_chars":79,"code_v0_no_empty_lines":"import numpy as np\n\nA, P = list(map(int, input().split()))\nprint((int(np.floor((3 * A + P) \/ 2))))\n","code_v1_no_empty_lines":"import math\n\nA, P = list(map(int, input().split()))\nprint((int(math.floor((3 * A + P) \/ 2))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","+import math","-print((int(np.floor((3 * A + P) \/ 2))))","+print((int(math.floor((3 * A + P) \/ 2))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2103917968,"measured_runtime_v1":0.1394575996,"runtime_lift":1.5086434684,"key":["s670196924","s715008450"]} +{"user_id":"u164727245","problem_id":"p02837","language":"python","submission_id_v0":"s799434567","submission_id_v1":"s523360335","cpu_time_v0":497,"cpu_time_v1":133,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.24,"input":"# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n = int(args[0])\n\n T = [[None]*n for _ in range(n)]\n\n\n\n try:\n\n it = iter(args[1:])\n\n a = next(it)\n\n i = 1\n\n while a:\n\n for _ in range(int(a)):\n\n x, y = list(map(int, next(it).split()))\n\n T[i-1][x-1] = y == 1\n\n a = next(it)\n\n i += 1\n\n except StopIteration:\n\n pass\n\n\n\n ret = 0\n\n for hypo in range(2**n):\n\n consistent = True\n\n truth = [None]*n\n\n count = 0\n\n i = 0\n\n while consistent and i < n:\n\n if (hypo >> i) & 1:\n\n count += 1\n\n j = 0\n\n while consistent and j < n:\n\n t = T[i][j]\n\n if t is not None:\n\n if truth[j] is None:\n\n truth[j] = t\n\n elif truth[j] != t:\n\n consistent = False\n\n\n\n consistent = (hypo >> j) & 1 == t\n\n j += 1\n\n i += 1\n\n\n\n if consistent:\n\n ret = max(ret, count)\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n","target":"# coding: utf-8\n\n\n\n\n\ndef solve(*args: str) -> str:\n\n n = int(args[0])\n\n XY = [[] for _ in range(n)]\n\n\n\n try:\n\n it = iter(args[1:])\n\n a = next(it)\n\n i = 0\n\n while a:\n\n for _ in range(int(a)):\n\n x, y = list(map(int, next(it).split()))\n\n XY[i].append((x-1, y == 1))\n\n a = next(it)\n\n i += 1\n\n except StopIteration:\n\n pass\n\n\n\n ret = 0\n\n for hypo in range(2**n):\n\n consistent = True\n\n truth = [None]*n\n\n count = 0\n\n i = 0\n\n while consistent and i < n:\n\n if (hypo >> i) & 1:\n\n count += 1\n\n for x, y in XY[i]:\n\n if truth[x] is None:\n\n truth[x] = y\n\n elif truth[x] != y:\n\n consistent = False\n\n\n\n consistent &= (hypo >> x) & 1 == y\n\n i += 1\n\n\n\n if consistent:\n\n ret = max(ret, count)\n\n\n\n return str(ret)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n print((solve(*(open(0).read().splitlines()))))\n","code_v0_loc":50,"code_v1_loc":46,"code_v0_num_chars":1246,"code_v1_num_chars":1097,"code_v0_no_empty_lines":"# coding: utf-8\ndef solve(*args: str) -> str:\n n = int(args[0])\n T = [[None] * n for _ in range(n)]\n try:\n it = iter(args[1:])\n a = next(it)\n i = 1\n while a:\n for _ in range(int(a)):\n x, y = list(map(int, next(it).split()))\n T[i - 1][x - 1] = y == 1\n a = next(it)\n i += 1\n except StopIteration:\n pass\n ret = 0\n for hypo in range(2**n):\n consistent = True\n truth = [None] * n\n count = 0\n i = 0\n while consistent and i < n:\n if (hypo >> i) & 1:\n count += 1\n j = 0\n while consistent and j < n:\n t = T[i][j]\n if t is not None:\n if truth[j] is None:\n truth[j] = t\n elif truth[j] != t:\n consistent = False\n consistent = (hypo >> j) & 1 == t\n j += 1\n i += 1\n if consistent:\n ret = max(ret, count)\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_v1_no_empty_lines":"# coding: utf-8\ndef solve(*args: str) -> str:\n n = int(args[0])\n XY = [[] for _ in range(n)]\n try:\n it = iter(args[1:])\n a = next(it)\n i = 0\n while a:\n for _ in range(int(a)):\n x, y = list(map(int, next(it).split()))\n XY[i].append((x - 1, y == 1))\n a = next(it)\n i += 1\n except StopIteration:\n pass\n ret = 0\n for hypo in range(2**n):\n consistent = True\n truth = [None] * n\n count = 0\n i = 0\n while consistent and i < n:\n if (hypo >> i) & 1:\n count += 1\n for x, y in XY[i]:\n if truth[x] is None:\n truth[x] = y\n elif truth[x] != y:\n consistent = False\n consistent &= (hypo >> x) & 1 == y\n i += 1\n if consistent:\n ret = max(ret, count)\n return str(ret)\n\n\nif __name__ == \"__main__\":\n print((solve(*(open(0).read().splitlines()))))\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["- T = [[None] * n for _ in range(n)]","+ XY = [[] for _ in range(n)]","- i = 1","+ i = 0","- T[i - 1][x - 1] = y == 1","+ XY[i].append((x - 1, y == 1))","- j = 0","- while consistent and j < n:","- t = T[i][j]","- if t is not None:","- if truth[j] is None:","- truth[j] = t","- elif truth[j] != t:","- consistent = False","- consistent = (hypo >> j) & 1 == t","- j += 1","+ for x, y in XY[i]:","+ if truth[x] is None:","+ truth[x] = y","+ elif truth[x] != y:","+ consistent = False","+ consistent &= (hypo >> x) & 1 == y"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376918151,"measured_runtime_v1":0.045689105,"runtime_lift":0.8249628681,"key":["s799434567","s523360335"]} +{"user_id":"u745087332","problem_id":"p03168","language":"python","submission_id_v0":"s213835776","submission_id_v1":"s405212276","cpu_time_v0":1481,"cpu_time_v1":320,"memory_v0":3316,"memory_v1":21020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.39,"input":"# coding:utf-8\n\n\n\nimport sys\n\n\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef II(): return int(sys.stdin.readline())\n\ndef SI(): return eval(input())\n\n\n\n\n\ndef main():\n\n n = II()\n\n P = LF()\n\n\n\n # dp[i]: i\u679a\u306e\u30b3\u30a4\u30f3\u304c\u8868\u306b\u306a\u308b\u78ba\u7387\n\n dp = [1]\n\n\n\n # \u8abf\u548c\u7d1a\u6570\n\n # O(NlogN)\n\n for i in range(n):\n\n tmp = [0] * (i + 2)\n\n p = P[i]\n\n q = 1 - P[i]\n\n for j in range(i + 1):\n\n tmp[j] += dp[j] * q\n\n tmp[j + 1] += dp[j] * p\n\n dp = tmp\n\n\n\n return sum(dp[n \/\/ 2 + 1:])\n\n\n\n\n\nprint((main()))\n","target":"# coding:utf-8\n\n\n\nimport sys\n\nimport numpy as np\n\n\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef II(): return int(sys.stdin.readline())\n\ndef SI(): return eval(input())\n\n\n\n\n\ndef main():\n\n n = II()\n\n P = LF()\n\n\n\n dp = np.zeros(n + 1, dtype=float)\n\n dp[0] = 1\n\n\n\n for p in P:\n\n tmp = dp * (1 - p)\n\n tmp[1:] += dp[:-1] * p\n\n dp = tmp\n\n\n\n return np.sum(dp[n \/\/ 2 + 1:])\n\n\n\n\n\nprint((main()))\n","code_v0_loc":37,"code_v1_loc":32,"code_v0_num_chars":777,"code_v1_num_chars":666,"code_v0_no_empty_lines":"# coding:utf-8\nimport sys\n\nINF = float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef SI():\n return eval(input())\n\n\ndef main():\n n = II()\n P = LF()\n # dp[i]: i\u679a\u306e\u30b3\u30a4\u30f3\u304c\u8868\u306b\u306a\u308b\u78ba\u7387\n dp = [1]\n # \u8abf\u548c\u7d1a\u6570\n # O(NlogN)\n for i in range(n):\n tmp = [0] * (i + 2)\n p = P[i]\n q = 1 - P[i]\n for j in range(i + 1):\n tmp[j] += dp[j] * q\n tmp[j + 1] += dp[j] * p\n dp = tmp\n return sum(dp[n \/\/ 2 + 1 :])\n\n\nprint((main()))\n","code_v1_no_empty_lines":"# coding:utf-8\nimport sys\nimport numpy as np\n\nINF = float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef SI():\n return eval(input())\n\n\ndef main():\n n = II()\n P = LF()\n dp = np.zeros(n + 1, dtype=float)\n dp[0] = 1\n for p in P:\n tmp = dp * (1 - p)\n tmp[1:] += dp[:-1] * p\n dp = tmp\n return np.sum(dp[n \/\/ 2 + 1 :])\n\n\nprint((main()))\n","code_same":false,"relative_loc_diff_percent":13.5135135135,"diff":["+import numpy as np","- # dp[i]: i\u679a\u306e\u30b3\u30a4\u30f3\u304c\u8868\u306b\u306a\u308b\u78ba\u7387","- dp = [1]","- # \u8abf\u548c\u7d1a\u6570","- # O(NlogN)","- for i in range(n):","- tmp = [0] * (i + 2)","- p = P[i]","- q = 1 - P[i]","- for j in range(i + 1):","- tmp[j] += dp[j] * q","- tmp[j + 1] += dp[j] * p","+ dp = np.zeros(n + 1, dtype=float)","+ dp[0] = 1","+ for p in P:","+ tmp = dp * (1 - p)","+ tmp[1:] += dp[:-1] * p","- return sum(dp[n \/\/ 2 + 1 :])","+ return np.sum(dp[n \/\/ 2 + 1 :])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370833566,"measured_runtime_v1":0.2823742969,"runtime_lift":0.1313269551,"key":["s213835776","s405212276"]} +{"user_id":"u994988729","problem_id":"p03142","language":"python","submission_id_v0":"s133302305","submission_id_v1":"s190030830","cpu_time_v0":1785,"cpu_time_v1":1484,"memory_v0":53084,"memory_v1":53024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.86,"input":"from collections import deque\n\nimport numpy as np\n\nimport sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nN, M = map(int, input().split())\n\nAB = [tuple(map(int, input().split())) for _ in range(N + M - 1)]\n\ne_from = [[] for _ in range(N+1)]\n\ne_to = [[] for _ in range(N+1)]\n\nfor a, b in AB:\n\n e_from[a].append(b)\n\n e_to[b].append(a)\n\n\n\n\n\nadd = np.zeros(N+1, dtype=int)\n\nrank = [-1]*(N+1)\n\n\n\n# \u307e\u305a\u6839\u3092\u63a2\u3059\n\nfor i in range(1, N+1):\n\n add[i] = len(e_to[i])\n\n if len(e_to[i]) == 0:\n\n root = i\n\n\n\n# BFS\n\nrank[root] = 0\n\nnode = deque([root])\n\nwhile node:\n\n s = node.popleft()\n\n add[e_from[s]] -= 1\n\n for t in e_from[s]:\n\n if add[t] == 0:\n\n rank[t] = s\n\n node.append(t)\n\n\n\nprint(*rank[1:], sep=\"\\n\")\n","target":"from collections import deque\n\nimport numpy as np\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN, M = map(int, input().split())\n\nAB = [tuple(map(int, input().split())) for _ in range(N + M - 1)]\n\ne_from = [[] for _ in range(N+1)]\n\ne_to = [[] for _ in range(N+1)]\n\nfor a, b in AB:\n\n e_from[a].append(b)\n\n e_to[b].append(a)\n\n\n\n\n\nadd = np.zeros(N+1, dtype=int)\n\nrank = [-1]*(N+1)\n\n\n\n# \u307e\u305a\u6839\u3092\u63a2\u3059\n\nfor i in range(1, N+1):\n\n add[i] = len(e_to[i])\n\n if len(e_to[i]) == 0:\n\n root = i\n\n\n\n# BFS\n\nrank[root] = 0\n\nnode = deque([root])\n\nwhile node:\n\n s = node.popleft()\n\n add[e_from[s]] -= 1\n\n for t in e_from[s]:\n\n if add[t] == 0:\n\n rank[t] = s\n\n node.append(t)\n\n\n\nprint(*rank[1:], sep=\"\\n\")\n","code_v0_loc":38,"code_v1_loc":35,"code_v0_num_chars":844,"code_v1_num_chars":732,"code_v0_no_empty_lines":"from collections import deque\nimport numpy as np\nimport sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**7)\nN, M = map(int, input().split())\nAB = [tuple(map(int, input().split())) for _ in range(N + M - 1)]\ne_from = [[] for _ in range(N + 1)]\ne_to = [[] for _ in range(N + 1)]\nfor a, b in AB:\n e_from[a].append(b)\n e_to[b].append(a)\nadd = np.zeros(N + 1, dtype=int)\nrank = [-1] * (N + 1)\n# \u307e\u305a\u6839\u3092\u63a2\u3059\nfor i in range(1, N + 1):\n add[i] = len(e_to[i])\n if len(e_to[i]) == 0:\n root = i\n# BFS\nrank[root] = 0\nnode = deque([root])\nwhile node:\n s = node.popleft()\n add[e_from[s]] -= 1\n for t in e_from[s]:\n if add[t] == 0:\n rank[t] = s\n node.append(t)\nprint(*rank[1:], sep=\"\\n\")\n","code_v1_no_empty_lines":"from collections import deque\nimport numpy as np\nimport sys\n\ninput = sys.stdin.readline\nN, M = map(int, input().split())\nAB = [tuple(map(int, input().split())) for _ in range(N + M - 1)]\ne_from = [[] for _ in range(N + 1)]\ne_to = [[] for _ in range(N + 1)]\nfor a, b in AB:\n e_from[a].append(b)\n e_to[b].append(a)\nadd = np.zeros(N + 1, dtype=int)\nrank = [-1] * (N + 1)\n# \u307e\u305a\u6839\u3092\u63a2\u3059\nfor i in range(1, N + 1):\n add[i] = len(e_to[i])\n if len(e_to[i]) == 0:\n root = i\n# BFS\nrank[root] = 0\nnode = deque([root])\nwhile node:\n s = node.popleft()\n add[e_from[s]] -= 1\n for t in e_from[s]:\n if add[t] == 0:\n rank[t] = s\n node.append(t)\nprint(*rank[1:], sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":7.8947368421,"diff":["-read = sys.stdin.buffer.read","-readline = sys.stdin.buffer.readline","-readlines = sys.stdin.buffer.readlines","-sys.setrecursionlimit(10**7)","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.2125958082,"measured_runtime_v1":0.2675240672,"runtime_lift":0.7946791867,"key":["s133302305","s190030830"]} +{"user_id":"u591143370","problem_id":"p02678","language":"python","submission_id_v0":"s177111744","submission_id_v1":"s030936361","cpu_time_v0":1119,"cpu_time_v1":714,"memory_v0":106392,"memory_v1":45208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.19,"input":"from collections import deque\n\n\n\nN, M = list(map(int, input().split()))\n\nAB = [list(map(int, input().split())) for _ in range(M)]\n\n#print(AB)\n\nlinks = [[] for _ in range(N + 1)]\n\nfor a, b in AB:\n\n links[a].append(b)\n\n links[b].append(a)\n\n#print(AB)\n\n#print(links)\n\nresult = [-1] * (N + 1)\n\nq = deque([1])\n\n#print(q)\n\nwhile q:\n\n i = q.popleft()\n\n for j in links[i]:\n\n if result[j] == -1:\n\n result[j] = i\n\n q.append(j)\n\n #print(q)\n\nprint('Yes')\n\nprint(('\\n'.join(str(i) for i in result[2:])))","target":"from collections import deque\n\n\n\nN, M = list(map(int, input().split()))\n\nA = [0] * M\n\nB = [0] * M\n\nfor i in range(M):\n\n A[i], B[i]= list(map(int, input().split()))\n\nlinks = [[] for _ in range(N + 1)]\n\nfor i in range(len(A)):\n\n links[A[i]].append(B[i])\n\n links[B[i]].append(A[i])\n\n \n\n#print(links)\n\nresult = [-1] * (N + 1)\n\nq = deque([1])\n\n#print(q)\n\nwhile q:\n\n i = q.popleft()\n\n for j in links[i]:\n\n if result[j] == -1:\n\n result[j] = i\n\n q.append(j)\n\n #print(q)\n\nprint('Yes')\n\nprint(('\\n'.join(str(i) for i in result[2:])))","code_v0_loc":23,"code_v1_loc":25,"code_v0_num_chars":528,"code_v1_num_chars":567,"code_v0_no_empty_lines":"from collections import deque\n\nN, M = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(M)]\n# print(AB)\nlinks = [[] for _ in range(N + 1)]\nfor a, b in AB:\n links[a].append(b)\n links[b].append(a)\n# print(AB)\n# print(links)\nresult = [-1] * (N + 1)\nq = deque([1])\n# print(q)\nwhile q:\n i = q.popleft()\n for j in links[i]:\n if result[j] == -1:\n result[j] = i\n q.append(j)\n # print(q)\nprint(\"Yes\")\nprint((\"\\n\".join(str(i) for i in result[2:])))\n","code_v1_no_empty_lines":"from collections import deque\n\nN, M = list(map(int, input().split()))\nA = [0] * M\nB = [0] * M\nfor i in range(M):\n A[i], B[i] = list(map(int, input().split()))\nlinks = [[] for _ in range(N + 1)]\nfor i in range(len(A)):\n links[A[i]].append(B[i])\n links[B[i]].append(A[i])\n# print(links)\nresult = [-1] * (N + 1)\nq = deque([1])\n# print(q)\nwhile q:\n i = q.popleft()\n for j in links[i]:\n if result[j] == -1:\n result[j] = i\n q.append(j)\n # print(q)\nprint(\"Yes\")\nprint((\"\\n\".join(str(i) for i in result[2:])))\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["-AB = [list(map(int, input().split())) for _ in range(M)]","-# print(AB)","+A = [0] * M","+B = [0] * M","+for i in range(M):","+ A[i], B[i] = list(map(int, input().split()))","-for a, b in AB:","- links[a].append(b)","- links[b].append(a)","-# print(AB)","+for i in range(len(A)):","+ links[A[i]].append(B[i])","+ links[B[i]].append(A[i])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409367125,"measured_runtime_v1":0.096941581,"runtime_lift":0.4222822866,"key":["s177111744","s030936361"]} +{"user_id":"u217547685","problem_id":"p04044","language":"python","submission_id_v0":"s122117651","submission_id_v1":"s141238709","cpu_time_v0":179,"cpu_time_v1":164,"memory_v0":38512,"memory_v1":38256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.38,"input":"n, l = list(map(int, input().split()))\n\ns = [eval(input()) for _ in range(n)]\n\ns.sort()\n\nprint((\"\".join(s)))","target":"n, l = list(map(int, input().split()))\n\ns = [eval(input()) for _ in range(n)]\n\ns.sort()\n\nans = \"\"\n\nfor i in s:\n\n ans += i\n\nprint(ans)","code_v0_loc":4,"code_v1_loc":7,"code_v0_num_chars":94,"code_v1_num_chars":124,"code_v0_no_empty_lines":"n, l = list(map(int, input().split()))\ns = [eval(input()) for _ in range(n)]\ns.sort()\nprint((\"\".join(s)))\n","code_v1_no_empty_lines":"n, l = list(map(int, input().split()))\ns = [eval(input()) for _ in range(n)]\ns.sort()\nans = \"\"\nfor i in s:\n ans += i\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-print((\"\".join(s)))","+ans = \"\"","+for i in s:","+ ans += i","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1124846222,"measured_runtime_v1":0.0431302421,"runtime_lift":2.6080220447,"key":["s122117651","s141238709"]} +{"user_id":"u562935282","problem_id":"p02726","language":"python","submission_id_v0":"s265397507","submission_id_v1":"s679228655","cpu_time_v0":495,"cpu_time_v1":302,"memory_v0":48348,"memory_v1":46428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.99,"input":"def main():\n\n from collections import deque\n\n\n\n N, X, Y = map(int, input().split())\n\n X -= 1\n\n Y -= 1\n\n\n\n g = tuple(set() for _ in range(N))\n\n for v in range(N):\n\n if v > 0:\n\n g[v].add(v - 1)\n\n if v < N - 1:\n\n g[v].add(v + 1)\n\n\n\n g[X].add(Y)\n\n g[Y].add(X)\n\n\n\n ctr = [0] * N\n\n for v in range(N):\n\n dist = [-1] * N\n\n\n\n q = deque()\n\n q.append((v, 0))\n\n\n\n while q:\n\n v, d = q.popleft()\n\n if ~dist[v] and dist[v] < d: continue\n\n dist[v] = d\n\n for u in g[v]:\n\n if ~dist[u]: continue\n\n dist[u] = d + 1\n\n q.append((u, d + 1))\n\n\n\n for d in dist:\n\n ctr[d] += 1\n\n\n\n print(*map(lambda x: x \/\/ 2, ctr[1:]), sep='\\n')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"# https:\/\/atcoder.jp\/contests\/abc160\/submissions\/11310424\n\n\n\ndef main():\n\n N, X, Y = map(int, input().split())\n\n X -= 1\n\n Y -= 1\n\n\n\n def dist(a, b):\n\n return min(\n\n abs(a - b),\n\n abs(a - X) + abs(b - Y) + 1,\n\n abs(a - Y) + abs(b - X) + 1\n\n )\n\n\n\n ctr = [0] * N\n\n for b in range(N):\n\n for a in range(b):\n\n d = dist(a, b)\n\n ctr[d] += 1\n\n\n\n print(*ctr[1:], sep='\\n')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":41,"code_v1_loc":25,"code_v0_num_chars":852,"code_v1_num_chars":504,"code_v0_no_empty_lines":"def main():\n from collections import deque\n\n N, X, Y = map(int, input().split())\n X -= 1\n Y -= 1\n g = tuple(set() for _ in range(N))\n for v in range(N):\n if v > 0:\n g[v].add(v - 1)\n if v < N - 1:\n g[v].add(v + 1)\n g[X].add(Y)\n g[Y].add(X)\n ctr = [0] * N\n for v in range(N):\n dist = [-1] * N\n q = deque()\n q.append((v, 0))\n while q:\n v, d = q.popleft()\n if ~dist[v] and dist[v] < d:\n continue\n dist[v] = d\n for u in g[v]:\n if ~dist[u]:\n continue\n dist[u] = d + 1\n q.append((u, d + 1))\n for d in dist:\n ctr[d] += 1\n print(*map(lambda x: x \/\/ 2, ctr[1:]), sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc160\/submissions\/11310424\ndef main():\n N, X, Y = map(int, input().split())\n X -= 1\n Y -= 1\n\n def dist(a, b):\n return min(abs(a - b), abs(a - X) + abs(b - Y) + 1, abs(a - Y) + abs(b - X) + 1)\n\n ctr = [0] * N\n for b in range(N):\n for a in range(b):\n d = dist(a, b)\n ctr[d] += 1\n print(*ctr[1:], sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":39.0243902439,"diff":["+# https:\/\/atcoder.jp\/contests\/abc160\/submissions\/11310424","- from collections import deque","-","- g = tuple(set() for _ in range(N))","- for v in range(N):","- if v > 0:","- g[v].add(v - 1)","- if v < N - 1:","- g[v].add(v + 1)","- g[X].add(Y)","- g[Y].add(X)","+","+ def dist(a, b):","+ return min(abs(a - b), abs(a - X) + abs(b - Y) + 1, abs(a - Y) + abs(b - X) + 1)","+","- for v in range(N):","- dist = [-1] * N","- q = deque()","- q.append((v, 0))","- while q:","- v, d = q.popleft()","- if ~dist[v] and dist[v] < d:","- continue","- dist[v] = d","- for u in g[v]:","- if ~dist[u]:","- continue","- dist[u] = d + 1","- q.append((u, d + 1))","- for d in dist:","+ for b in range(N):","+ for a in range(b):","+ d = dist(a, b)","- print(*map(lambda x: x \/\/ 2, ctr[1:]), sep=\"\\n\")","+ print(*ctr[1:], sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1090777831,"measured_runtime_v1":0.047645685,"runtime_lift":2.2893528172,"key":["s265397507","s679228655"]} +{"user_id":"u226108478","problem_id":"p03495","language":"python","submission_id_v0":"s811554702","submission_id_v1":"s741914744","cpu_time_v0":227,"cpu_time_v1":109,"memory_v0":37776,"memory_v1":32564,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.98,"input":"# -*- coding: utf-8 -*-\n\n\n\n# AtCoder Beginner Contest\n\n# Problem C\n\n\n\nif __name__ == '__main__':\n\n from collections import Counter\n\n\n\n ball_count, kind_count = list(map(int, input().split()))\n\n ball_numbers = Counter(list(map(int, input().split())))\n\n sorted_ball_numbers = sorted(list(ball_numbers.items()), key=lambda x: x[1])\n\n ball_number_key_count = len(list(ball_numbers.keys()))\n\n\n\n need_rewritten_count = 0\n\n diff_count = ball_number_key_count - kind_count\n\n\n\n if diff_count > 0:\n\n for i, (key, value) in enumerate(sorted_ball_numbers):\n\n if diff_count > i:\n\n need_rewritten_count += value\n\n\n\n print(need_rewritten_count)\n","target":"# -*- coding: utf-8 -*-\n\n\n\n# AtCoder Beginner Contest\n\n# Problem C\n\n\n\nif __name__ == '__main__':\n\n from collections import Counter\n\n\n\n ball_count, kind_count = list(map(int, input().split()))\n\n ball_numbers = Counter(list(map(int, input().split())))\n\n sorted_ball_numbers = sorted(ball_numbers.values())\n\n print((sum(sorted_ball_numbers[:-kind_count])))\n","code_v0_loc":22,"code_v1_loc":12,"code_v0_num_chars":672,"code_v1_num_chars":361,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n# AtCoder Beginner Contest\n# Problem C\nif __name__ == \"__main__\":\n from collections import Counter\n\n ball_count, kind_count = list(map(int, input().split()))\n ball_numbers = Counter(list(map(int, input().split())))\n sorted_ball_numbers = sorted(list(ball_numbers.items()), key=lambda x: x[1])\n ball_number_key_count = len(list(ball_numbers.keys()))\n need_rewritten_count = 0\n diff_count = ball_number_key_count - kind_count\n if diff_count > 0:\n for i, (key, value) in enumerate(sorted_ball_numbers):\n if diff_count > i:\n need_rewritten_count += value\n print(need_rewritten_count)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n# AtCoder Beginner Contest\n# Problem C\nif __name__ == \"__main__\":\n from collections import Counter\n\n ball_count, kind_count = list(map(int, input().split()))\n ball_numbers = Counter(list(map(int, input().split())))\n sorted_ball_numbers = sorted(ball_numbers.values())\n print((sum(sorted_ball_numbers[:-kind_count])))\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["- sorted_ball_numbers = sorted(list(ball_numbers.items()), key=lambda x: x[1])","- ball_number_key_count = len(list(ball_numbers.keys()))","- need_rewritten_count = 0","- diff_count = ball_number_key_count - kind_count","- if diff_count > 0:","- for i, (key, value) in enumerate(sorted_ball_numbers):","- if diff_count > i:","- need_rewritten_count += value","- print(need_rewritten_count)","+ sorted_ball_numbers = sorted(ball_numbers.values())","+ print((sum(sorted_ball_numbers[:-kind_count])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0419900417,"measured_runtime_v1":0.0482954979,"runtime_lift":0.8694400835,"key":["s811554702","s741914744"]} +{"user_id":"u536600145","problem_id":"p02921","language":"python","submission_id_v0":"s742120193","submission_id_v1":"s935781213","cpu_time_v0":345,"cpu_time_v1":27,"memory_v0":79556,"memory_v1":8904,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.17,"input":"S = eval(input())\n\nT = eval(input())\n\n\n\ncnt, i = 0, 0\n\n\n\nfor s in S:\n\n if s == T[i]:\n\n cnt += 1\n\n i += 1\n\n\n\nprint(cnt)","target":"S = eval(input())\n\nT = eval(input())\n\n\n\ncount = 0\n\nfor s,t in zip(S,T):\n\n if s == t:\n\n count+=1\n\n \n\nprint(count)","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":119,"code_v1_num_chars":113,"code_v0_no_empty_lines":"S = eval(input())\nT = eval(input())\ncnt, i = 0, 0\nfor s in S:\n if s == T[i]:\n cnt += 1\n i += 1\nprint(cnt)\n","code_v1_no_empty_lines":"S = eval(input())\nT = eval(input())\ncount = 0\nfor s, t in zip(S, T):\n if s == t:\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-cnt, i = 0, 0","-for s in S:","- if s == T[i]:","- cnt += 1","- i += 1","-print(cnt)","+count = 0","+for s, t in zip(S, T):","+ if s == t:","+ count += 1","+print(count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0705341065,"measured_runtime_v1":0.0346080379,"runtime_lift":2.0380845218,"key":["s742120193","s935781213"]} +{"user_id":"u840310460","problem_id":"p03636","language":"python","submission_id_v0":"s876955975","submission_id_v1":"s899381235","cpu_time_v0":164,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.63,"input":"A = eval(input())\n\nprint((A[0]+str(len(A[1:-1]))+A[-1]))","target":"S = eval(input())\n\nprint((S[0]+str(len(S[1:-1]))+S[-1]))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":48,"code_v1_num_chars":48,"code_v0_no_empty_lines":"A = eval(input())\nprint((A[0] + str(len(A[1:-1])) + A[-1]))\n","code_v1_no_empty_lines":"S = eval(input())\nprint((S[0] + str(len(S[1:-1])) + S[-1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-A = eval(input())","-print((A[0] + str(len(A[1:-1])) + A[-1]))","+S = eval(input())","+print((S[0] + str(len(S[1:-1])) + S[-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.037261503,"measured_runtime_v1":0.0386145623,"runtime_lift":0.9649598695,"key":["s876955975","s899381235"]} +{"user_id":"u761320129","problem_id":"p02982","language":"python","submission_id_v0":"s636502089","submission_id_v1":"s087847542","cpu_time_v0":62,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.58,"input":"N,D = list(map(int,input().split()))\n\nX = [tuple(map(int,input().split())) for i in range(N)]\n\n\n\nans = 0\n\nfor i,a in enumerate(X[:-1]):\n\n for b in X[i+1:]:\n\n d = 0\n\n for x,y in zip(a,b):\n\n d += (x-y)**2\n\n if d**0.5 - int(d**0.5) < 10e-10:\n\n ans += 1\n\nprint(ans)","target":"N,D = list(map(int,input().split()))\n\nX = [tuple(map(int,input().split())) for i in range(N)]\n\nans = 0\n\nfor i,x in enumerate(X[:-1]):\n\n for y in X[i+1:]:\n\n d = 0\n\n for a,b in zip(x,y):\n\n d += (a-b)**2\n\n if int(d**0.5) == d**0.5:\n\n ans += 1\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":301,"code_v1_num_chars":291,"code_v0_no_empty_lines":"N, D = list(map(int, input().split()))\nX = [tuple(map(int, input().split())) for i in range(N)]\nans = 0\nfor i, a in enumerate(X[:-1]):\n for b in X[i + 1 :]:\n d = 0\n for x, y in zip(a, b):\n d += (x - y) ** 2\n if d**0.5 - int(d**0.5) < 10e-10:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N, D = list(map(int, input().split()))\nX = [tuple(map(int, input().split())) for i in range(N)]\nans = 0\nfor i, x in enumerate(X[:-1]):\n for y in X[i + 1 :]:\n d = 0\n for a, b in zip(x, y):\n d += (a - b) ** 2\n if int(d**0.5) == d**0.5:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-for i, a in enumerate(X[:-1]):","- for b in X[i + 1 :]:","+for i, x in enumerate(X[:-1]):","+ for y in X[i + 1 :]:","- for x, y in zip(a, b):","- d += (x - y) ** 2","- if d**0.5 - int(d**0.5) < 10e-10:","+ for a, b in zip(x, y):","+ d += (a - b) ** 2","+ if int(d**0.5) == d**0.5:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0819742486,"measured_runtime_v1":0.0406739154,"runtime_lift":2.0154009726,"key":["s636502089","s087847542"]} +{"user_id":"u534308356","problem_id":"p02783","language":"python","submission_id_v0":"s226534033","submission_id_v1":"s703544991","cpu_time_v0":165,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.7,"input":"h, a = list(map(int, input().split()))\n\nif h % a == 0:\n\n print((h\/\/a))\n\nelse:\n\n print((h\/\/a + 1))\n","target":"a, b = list(map(int, input().split()))\n\nprint((-(-a\/\/b)))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":90,"code_v1_num_chars":49,"code_v0_no_empty_lines":"h, a = list(map(int, input().split()))\nif h % a == 0:\n print((h \/\/ a))\nelse:\n print((h \/\/ a + 1))\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nprint((-(-a \/\/ b)))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-h, a = list(map(int, input().split()))","-if h % a == 0:","- print((h \/\/ a))","-else:","- print((h \/\/ a + 1))","+a, b = list(map(int, input().split()))","+print((-(-a \/\/ b)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1004595065,"measured_runtime_v1":0.0906183362,"runtime_lift":1.1086002095,"key":["s226534033","s703544991"]} +{"user_id":"u561231954","problem_id":"p02662","language":"python","submission_id_v0":"s400770447","submission_id_v1":"s897761451","cpu_time_v0":1610,"cpu_time_v1":191,"memory_v0":9252,"memory_v1":27016,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.14,"input":"import sys\n\nsys.setrecursionlimit(10000000)\n\nMOD = 998244353\n\nINF = 10 ** 15\n\n\n\ndef main():\n\n N,S = list(map(int,input().split()))\n\n A = list(map(int,input().split()))\n\n\n\n dp = [0] * (1 + S)\n\n dp[0] = pow(2,N,MOD)\n\n inv2 = pow(2,MOD - 2,MOD)\n\n for a in A:\n\n for s in range(S,a - 1,-1):\n\n dp[s] = (dp[s] + dp[s - a] * inv2)%MOD\n\n print((dp[S]))\n\nif __name__ == '__main__':\n\n main()","target":"import sys\n\nsys.setrecursionlimit(10000000)\n\nMOD = 998244353\n\nINF = 10 ** 15\n\nimport numpy as np\n\n\n\ndef main():\n\n N,S = list(map(int,input().split()))\n\n A = list(map(int,input().split()))\n\n\n\n dp = np.zeros(S + 1,np.int64)\n\n dp[0] = pow(2,N,MOD)\n\n inv2 = pow(2,MOD - 2,MOD)\n\n for a in A:\n\n dp[a:] = np.mod(dp[a:] + dp[:-a] * inv2,MOD)\n\n print((dp[S]))\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":18,"code_v1_loc":18,"code_v0_num_chars":414,"code_v1_num_chars":410,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10000000)\nMOD = 998244353\nINF = 10**15\n\n\ndef main():\n N, S = list(map(int, input().split()))\n A = list(map(int, input().split()))\n dp = [0] * (1 + S)\n dp[0] = pow(2, N, MOD)\n inv2 = pow(2, MOD - 2, MOD)\n for a in A:\n for s in range(S, a - 1, -1):\n dp[s] = (dp[s] + dp[s - a] * inv2) % MOD\n print((dp[S]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10000000)\nMOD = 998244353\nINF = 10**15\nimport numpy as np\n\n\ndef main():\n N, S = list(map(int, input().split()))\n A = list(map(int, input().split()))\n dp = np.zeros(S + 1, np.int64)\n dp[0] = pow(2, N, MOD)\n inv2 = pow(2, MOD - 2, MOD)\n for a in A:\n dp[a:] = np.mod(dp[a:] + dp[:-a] * inv2, MOD)\n print((dp[S]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+import numpy as np","- dp = [0] * (1 + S)","+ dp = np.zeros(S + 1, np.int64)","- for s in range(S, a - 1, -1):","- dp[s] = (dp[s] + dp[s - a] * inv2) % MOD","+ dp[a:] = np.mod(dp[a:] + dp[:-a] * inv2, MOD)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0375455759,"measured_runtime_v1":0.1634378283,"runtime_lift":0.2297239032,"key":["s400770447","s897761451"]} +{"user_id":"u989345508","problem_id":"p02651","language":"python","submission_id_v0":"s211461642","submission_id_v1":"s656481413","cpu_time_v0":290,"cpu_time_v1":178,"memory_v0":26900,"memory_v1":9224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.62,"input":"#\u4e00\u6b21\u72ec\u7acb\uff1arank\u304c\u6210\u5206\u6570\n\nimport numpy as np\n\n#0-indexed,MSB\u304cma\u4ee5\u4e0b\u306e\u6642\n\ndef msb(x,ma=59):\n\n for i in range(ma,-1,-1):\n\n if (x>>i)&1:\n\n return i\n\n return len()\n\nt=int(eval(input()))\n\nfor _ in range(t):\n\n n=int(eval(input()))\n\n a=list(map(int,input().split()))\n\n s=eval(input())\n\n #\u72ec\u7acb\u3001msb\u540c\u3058\u3082\u306e\u306f\u306a\u3044\n\n #\u9006\u306b\u7570\u306a\u308c\u3070\u72ec\u7acb\n\n msbs=[0 for i in range(60)]\n\n for i in range(n-1,-1,-1):\n\n now=a[i]\n\n m=59\n\n #\u72ec\u7acb\u306e\u3068\u304df\u306fTrue\u3001\u72ec\u7acb\u3067\u306a\u3044\u6642f\u306fFalse\n\n while True:\n\n m=msb(now,m)\n\n if msbs[m]==0:\n\n f=True\n\n break\n\n now=msbs[m]^now\n\n if now==0:\n\n f=False\n\n break\n\n if s[i]==\"0\":\n\n if f:\n\n msbs[m]=now\n\n else:\n\n if f:\n\n print((1))\n\n break\n\n else:\n\n print((0))","target":"t=int(eval(input()))\n\nfor _ in range(t):\n\n n=int(eval(input()))\n\n a=list(map(int,input().split()))\n\n s=eval(input())\n\n b=[]\n\n for i in range(n)[::-1]:\n\n for e in b:\n\n a[i]=min(a[i],a[i]^e)\n\n if a[i]:\n\n if s[i]==\"0\":\n\n b+=[a[i]]\n\n else:\n\n print((1))\n\n break\n\n else:\n\n print((0))","code_v0_loc":38,"code_v1_loc":17,"code_v0_num_chars":852,"code_v1_num_chars":372,"code_v0_no_empty_lines":"# \u4e00\u6b21\u72ec\u7acb\uff1arank\u304c\u6210\u5206\u6570\nimport numpy as np\n\n# 0-indexed,MSB\u304cma\u4ee5\u4e0b\u306e\u6642\ndef msb(x, ma=59):\n for i in range(ma, -1, -1):\n if (x >> i) & 1:\n return i\n return len()\n\n\nt = int(eval(input()))\nfor _ in range(t):\n n = int(eval(input()))\n a = list(map(int, input().split()))\n s = eval(input())\n # \u72ec\u7acb\u3001msb\u540c\u3058\u3082\u306e\u306f\u306a\u3044\n # \u9006\u306b\u7570\u306a\u308c\u3070\u72ec\u7acb\n msbs = [0 for i in range(60)]\n for i in range(n - 1, -1, -1):\n now = a[i]\n m = 59\n # \u72ec\u7acb\u306e\u3068\u304df\u306fTrue\u3001\u72ec\u7acb\u3067\u306a\u3044\u6642f\u306fFalse\n while True:\n m = msb(now, m)\n if msbs[m] == 0:\n f = True\n break\n now = msbs[m] ^ now\n if now == 0:\n f = False\n break\n if s[i] == \"0\":\n if f:\n msbs[m] = now\n else:\n if f:\n print((1))\n break\n else:\n print((0))\n","code_v1_no_empty_lines":"t = int(eval(input()))\nfor _ in range(t):\n n = int(eval(input()))\n a = list(map(int, input().split()))\n s = eval(input())\n b = []\n for i in range(n)[::-1]:\n for e in b:\n a[i] = min(a[i], a[i] ^ e)\n if a[i]:\n if s[i] == \"0\":\n b += [a[i]]\n else:\n print((1))\n break\n else:\n print((0))\n","code_same":false,"relative_loc_diff_percent":55.2631578947,"diff":["-# \u4e00\u6b21\u72ec\u7acb\uff1arank\u304c\u6210\u5206\u6570","-import numpy as np","-","-# 0-indexed,MSB\u304cma\u4ee5\u4e0b\u306e\u6642","-def msb(x, ma=59):","- for i in range(ma, -1, -1):","- if (x >> i) & 1:","- return i","- return len()","-","-","- # \u72ec\u7acb\u3001msb\u540c\u3058\u3082\u306e\u306f\u306a\u3044","- # \u9006\u306b\u7570\u306a\u308c\u3070\u72ec\u7acb","- msbs = [0 for i in range(60)]","- for i in range(n - 1, -1, -1):","- now = a[i]","- m = 59","- # \u72ec\u7acb\u306e\u3068\u304df\u306fTrue\u3001\u72ec\u7acb\u3067\u306a\u3044\u6642f\u306fFalse","- while True:","- m = msb(now, m)","- if msbs[m] == 0:","- f = True","- break","- now = msbs[m] ^ now","- if now == 0:","- f = False","- break","- if s[i] == \"0\":","- if f:","- msbs[m] = now","- else:","- if f:","+ b = []","+ for i in range(n)[::-1]:","+ for e in b:","+ a[i] = min(a[i], a[i] ^ e)","+ if a[i]:","+ if s[i] == \"0\":","+ b += [a[i]]","+ else:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0390809216,"measured_runtime_v1":0.1202194853,"runtime_lift":0.3250797619,"key":["s211461642","s656481413"]} +{"user_id":"u499381410","problem_id":"p03016","language":"python","submission_id_v0":"s499513551","submission_id_v1":"s156241141","cpu_time_v0":229,"cpu_time_v1":163,"memory_v0":41968,"memory_v1":83824,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.82,"input":"from collections import defaultdict, deque, Counter\n\nfrom heapq import heappush, heappop, heapify\n\nimport math\n\nimport bisect\n\nimport random\n\nfrom itertools import permutations, accumulate, combinations, product\n\nimport sys\n\nimport string\n\nfrom bisect import bisect_left, bisect_right\n\nfrom math import factorial, ceil, floor\n\nfrom operator import mul\n\nfrom functools import reduce\n\n\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = 10 ** 20\n\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\n\ndef I(): return int(sys.stdin.buffer.readline())\n\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\n\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\n\ndef IR(n): return [I() for i in range(n)]\n\ndef LIR(n): return [LI() for i in range(n)]\n\ndef SR(n): return [S() for i in range(n)]\n\ndef LSR(n): return [LS() for i in range(n)]\n\ndef SRL(n): return [list(S()) for i in range(n)]\n\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\n\nmod = 1000000007\n\n\n\n\n\n\n\ndef mat_mul(a, b) :\n\n I, J, K = len(a), len(b[0]), len(b)\n\n c = [[0] * J for _ in range(I)]\n\n for i in range(I) :\n\n for j in range(J) :\n\n for k in range(K) :\n\n c[i][j] += a[i][k] * b[k][j]\n\n c[i][j] %= m\n\n return c\n\n\n\n\n\ndef mat_pow(x, n):\n\n y = [[0] * len(x) for _ in range(len(x))]\n\n\n\n for i in range(len(x)):\n\n y[i][i] = 1\n\n\n\n while n > 0:\n\n if n & 1:\n\n y = mat_mul(x, y)\n\n x = mat_mul(x, x)\n\n n >>= 1\n\n\n\n return y\n\n\n\n\n\nl, a, b, m = LI()\n\nd0 = 0\n\nret = [[0], [a], [1]]\n\nfor i in range(1, 19):\n\n if 10 ** i - 1 - a < 0:\n\n continue\n\n d1 = min((10 ** i - 1 - a) \/\/ b + 1, l)\n\n mat = [[10 ** i, 1, 0], [0, 1, b], [0, 0, 1]]\n\n ret = mat_mul(mat_pow(mat, d1 - d0), ret)\n\n if d1 == l:\n\n break\n\n d0 = d1\n\n\n\n\n\nprint((ret[0][0]))\n","target":"from collections import defaultdict, deque, Counter\n\nfrom heapq import heappush, heappop, heapify\n\nimport math\n\nimport bisect\n\nimport random\n\nfrom itertools import permutations, accumulate, combinations, product\n\nimport sys\n\nimport string\n\nfrom bisect import bisect_left, bisect_right\n\nfrom math import factorial, ceil, floor\n\nfrom operator import mul\n\nfrom functools import reduce\n\n\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = 10 ** 20\n\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\n\ndef I(): return int(sys.stdin.buffer.readline())\n\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\n\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\n\ndef IR(n): return [I() for i in range(n)]\n\ndef LIR(n): return [LI() for i in range(n)]\n\ndef SR(n): return [S() for i in range(n)]\n\ndef LSR(n): return [LS() for i in range(n)]\n\ndef SRL(n): return [list(S()) for i in range(n)]\n\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\n\nmod = 1000000007\n\n\n\n\n\n\n\ndef mat_mul(a, b) :\n\n I, J, K = len(a), len(b[0]), len(b)\n\n c = [[0] * J for _ in range(I)]\n\n for i in range(I) :\n\n for j in range(J) :\n\n for k in range(K) :\n\n c[i][j] += a[i][k] * b[k][j]\n\n c[i][j] %= m\n\n return c\n\n\n\n\n\ndef mat_pow(x, n):\n\n y = [[0] * len(x) for _ in range(len(x))]\n\n\n\n for i in range(len(x)):\n\n y[i][i] = 1\n\n\n\n while n > 0:\n\n if n & 1:\n\n y = mat_mul(x, y)\n\n x = mat_mul(x, x)\n\n n >>= 1\n\n\n\n return y\n\n\n\n\n\nl, a, b, m = LI()\n\nd0 = 0\n\nret = [[0], [a], [b]]\n\nfor i in range(1, 19):\n\n if 10 ** i - 1 - a < 0:\n\n continue\n\n d1 = min((10 ** i - 1 - a) \/\/ b + 1, l)\n\n mat = [[10 ** i, 1, 0], [0, 1, 1], [0, 0, 1]]\n\n ret = mat_mul(mat_pow(mat, d1 - d0), ret)\n\n if d1 == l:\n\n break\n\n d0 = d1\n\n\n\n\n\nprint((ret[0][0]))\n","code_v0_loc":71,"code_v1_loc":71,"code_v0_num_chars":1885,"code_v1_num_chars":1885,"code_v0_no_empty_lines":"from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor\nfrom operator import mul\nfrom functools import reduce\n\nsys.setrecursionlimit(2147483647)\nINF = 10**20\n\n\ndef LI():\n return list(map(int, sys.stdin.buffer.readline().split()))\n\n\ndef I():\n return int(sys.stdin.buffer.readline())\n\n\ndef LS():\n return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\").split()\n\n\ndef S():\n return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\ndef SRL(n):\n return [list(S()) for i in range(n)]\n\n\ndef MSRL(n):\n return [[int(j) for j in list(S())] for i in range(n)]\n\n\nmod = 1000000007\n\n\ndef mat_mul(a, b):\n I, J, K = len(a), len(b[0]), len(b)\n c = [[0] * J for _ in range(I)]\n for i in range(I):\n for j in range(J):\n for k in range(K):\n c[i][j] += a[i][k] * b[k][j]\n c[i][j] %= m\n return c\n\n\ndef mat_pow(x, n):\n y = [[0] * len(x) for _ in range(len(x))]\n for i in range(len(x)):\n y[i][i] = 1\n while n > 0:\n if n & 1:\n y = mat_mul(x, y)\n x = mat_mul(x, x)\n n >>= 1\n return y\n\n\nl, a, b, m = LI()\nd0 = 0\nret = [[0], [a], [1]]\nfor i in range(1, 19):\n if 10**i - 1 - a < 0:\n continue\n d1 = min((10**i - 1 - a) \/\/ b + 1, l)\n mat = [[10**i, 1, 0], [0, 1, b], [0, 0, 1]]\n ret = mat_mul(mat_pow(mat, d1 - d0), ret)\n if d1 == l:\n break\n d0 = d1\nprint((ret[0][0]))\n","code_v1_no_empty_lines":"from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor\nfrom operator import mul\nfrom functools import reduce\n\nsys.setrecursionlimit(2147483647)\nINF = 10**20\n\n\ndef LI():\n return list(map(int, sys.stdin.buffer.readline().split()))\n\n\ndef I():\n return int(sys.stdin.buffer.readline())\n\n\ndef LS():\n return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\").split()\n\n\ndef S():\n return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\ndef SRL(n):\n return [list(S()) for i in range(n)]\n\n\ndef MSRL(n):\n return [[int(j) for j in list(S())] for i in range(n)]\n\n\nmod = 1000000007\n\n\ndef mat_mul(a, b):\n I, J, K = len(a), len(b[0]), len(b)\n c = [[0] * J for _ in range(I)]\n for i in range(I):\n for j in range(J):\n for k in range(K):\n c[i][j] += a[i][k] * b[k][j]\n c[i][j] %= m\n return c\n\n\ndef mat_pow(x, n):\n y = [[0] * len(x) for _ in range(len(x))]\n for i in range(len(x)):\n y[i][i] = 1\n while n > 0:\n if n & 1:\n y = mat_mul(x, y)\n x = mat_mul(x, x)\n n >>= 1\n return y\n\n\nl, a, b, m = LI()\nd0 = 0\nret = [[0], [a], [b]]\nfor i in range(1, 19):\n if 10**i - 1 - a < 0:\n continue\n d1 = min((10**i - 1 - a) \/\/ b + 1, l)\n mat = [[10**i, 1, 0], [0, 1, 1], [0, 0, 1]]\n ret = mat_mul(mat_pow(mat, d1 - d0), ret)\n if d1 == l:\n break\n d0 = d1\nprint((ret[0][0]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-ret = [[0], [a], [1]]","+ret = [[0], [a], [b]]","- mat = [[10**i, 1, 0], [0, 1, b], [0, 0, 1]]","+ mat = [[10**i, 1, 0], [0, 1, 1], [0, 0, 1]]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369090197,"measured_runtime_v1":0.0370862553,"runtime_lift":0.9952209892,"key":["s499513551","s156241141"]} +{"user_id":"u305366205","problem_id":"p03363","language":"python","submission_id_v0":"s167053706","submission_id_v1":"s631763878","cpu_time_v0":261,"cpu_time_v1":190,"memory_v0":41880,"memory_v1":41472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.2,"input":"from collections import Counter\n\nn = int(eval(input()))\n\na = [int(i) for i in input().split()]\n\ncum = [0] * (n + 1)\n\nfor i in range(n):\n\n cum[i + 1] = cum[i] + a[i]\n\ncum = sorted(cum)\n\ncount = Counter(cum)\n\nans = 0\n\nfor v in list(count.values()):\n\n ans += v * (v - 1) \/\/ 2\n\nprint(ans)","target":"from collections import Counter\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\ncum = [0]\n\nfor a in A:\n\n cum.append(cum[-1] + a)\n\ncount = Counter(cum)\n\nans = 0\n\nfor v in list(count.values()):\n\n ans += v * (v - 1) \/\/ 2\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":278,"code_v1_num_chars":239,"code_v0_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\na = [int(i) for i in input().split()]\ncum = [0] * (n + 1)\nfor i in range(n):\n cum[i + 1] = cum[i] + a[i]\ncum = sorted(cum)\ncount = Counter(cum)\nans = 0\nfor v in list(count.values()):\n ans += v * (v - 1) \/\/ 2\nprint(ans)\n","code_v1_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\nA = [int(i) for i in input().split()]\ncum = [0]\nfor a in A:\n cum.append(cum[-1] + a)\ncount = Counter(cum)\nans = 0\nfor v in list(count.values()):\n ans += v * (v - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-n = int(eval(input()))","-a = [int(i) for i in input().split()]","-cum = [0] * (n + 1)","-for i in range(n):","- cum[i + 1] = cum[i] + a[i]","-cum = sorted(cum)","+N = int(eval(input()))","+A = [int(i) for i in input().split()]","+cum = [0]","+for a in A:","+ cum.append(cum[-1] + a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0851260455,"measured_runtime_v1":0.0368492637,"runtime_lift":2.3101152362,"key":["s167053706","s631763878"]} +{"user_id":"u686036872","problem_id":"p03231","language":"python","submission_id_v0":"s112903551","submission_id_v1":"s318872131","cpu_time_v0":44,"cpu_time_v1":38,"memory_v0":6500,"memory_v1":6584,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.64,"input":"from fractions import gcd\n\nN,M=list(map(int,input().split()))\n\nS=list(eval(input()))\n\nT=list(eval(input()))\n\nL=gcd(N,M)\n\nprint((N*M\/\/L if all([S[i*N\/\/L]==T[i*M\/\/L] for i in range(L)]) else \"-1\"))","target":"from fractions import gcd\n\n\n\nN, M = list(map(int,input().split()))\n\nS = list(eval(input()))\n\nT = list(eval(input()))\n\n\n\ngc = gcd(N, M)\n\n\n\nans = N*M\/\/gc\n\n\n\nfor i in range(gc):\n\n if S[N\/\/gc*i] != T[M\/\/gc*i]:\n\n ans = -1\n\n break\n\n \n\nprint(ans)","code_v0_loc":6,"code_v1_loc":16,"code_v0_num_chars":175,"code_v1_num_chars":253,"code_v0_no_empty_lines":"from fractions import gcd\n\nN, M = list(map(int, input().split()))\nS = list(eval(input()))\nT = list(eval(input()))\nL = gcd(N, M)\nprint((N * M \/\/ L if all([S[i * N \/\/ L] == T[i * M \/\/ L] for i in range(L)]) else \"-1\"))\n","code_v1_no_empty_lines":"from fractions import gcd\n\nN, M = list(map(int, input().split()))\nS = list(eval(input()))\nT = list(eval(input()))\ngc = gcd(N, M)\nans = N * M \/\/ gc\nfor i in range(gc):\n if S[N \/\/ gc * i] != T[M \/\/ gc * i]:\n ans = -1\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-L = gcd(N, M)","-print((N * M \/\/ L if all([S[i * N \/\/ L] == T[i * M \/\/ L] for i in range(L)]) else \"-1\"))","+gc = gcd(N, M)","+ans = N * M \/\/ gc","+for i in range(gc):","+ if S[N \/\/ gc * i] != T[M \/\/ gc * i]:","+ ans = -1","+ break","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0452919242,"measured_runtime_v1":0.0446803441,"runtime_lift":1.0136879009,"key":["s112903551","s318872131"]} +{"user_id":"u407535999","problem_id":"p03385","language":"python","submission_id_v0":"s518042558","submission_id_v1":"s768799776","cpu_time_v0":167,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.82,"input":"str=eval(input())\n\nlist=[\"a\",\"b\",\"c\"]\n\nif str[0] in list:\n\n list.remove(str[0])\n\n if str[1] in list:\n\n list.remove(str[1])\n\n if str[2] in list:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")\n\n else:\n\n print(\"No\")\n\nelse:\n\n print(\"No\")","target":"string=eval(input())\n\nlist=[\"a\",\"b\",\"c\"]\n\n\n\nlist.remove(string[0])\n\ntry:\n\n list.remove(string[1])\n\n try:\n\n list.remove(string[2])\n\n print(\"Yes\")\n\n except:\n\n print(\"No\")\n\nexcept:\n\n print(\"No\")","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":243,"code_v1_num_chars":198,"code_v0_no_empty_lines":"str = eval(input())\nlist = [\"a\", \"b\", \"c\"]\nif str[0] in list:\n list.remove(str[0])\n if str[1] in list:\n list.remove(str[1])\n if str[2] in list:\n print(\"Yes\")\n else:\n print(\"No\")\n else:\n print(\"No\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"string = eval(input())\nlist = [\"a\", \"b\", \"c\"]\nlist.remove(string[0])\ntry:\n list.remove(string[1])\n try:\n list.remove(string[2])\n print(\"Yes\")\n except:\n print(\"No\")\nexcept:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-str = eval(input())","+string = eval(input())","-if str[0] in list:","- list.remove(str[0])","- if str[1] in list:","- list.remove(str[1])","- if str[2] in list:","- print(\"Yes\")","- else:","- print(\"No\")","- else:","+list.remove(string[0])","+try:","+ list.remove(string[1])","+ try:","+ list.remove(string[2])","+ print(\"Yes\")","+ except:","-else:","+except:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443201008,"measured_runtime_v1":0.0355534129,"runtime_lift":1.2465779552,"key":["s518042558","s768799776"]} +{"user_id":"u546285759","problem_id":"p00102","language":"python","submission_id_v0":"s748437334","submission_id_v1":"s887595126","cpu_time_v0":50,"cpu_time_v1":30,"memory_v0":7588,"memory_v1":7648,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.0,"input":"while True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n row = n\n\n tab = []\n\n for i in range(row):\n\n r = list(map(int, input().split()))\n\n r.append(sum(r))\n\n tab.append(r)\n\n\n\n bel = []\n\n for i in range(row):\n\n tmp = 0\n\n for j in range(row):\n\n tmp += tab[j][i]\n\n bel.append(tmp)\n\n bel.append(sum(bel))\n\n tab.append(bel)\n\n\n\n for i in range(row+1):\n\n for j in range(row+1):\n\n #print(\"\".join(map(\"{0:>5}\".format, str(tab[i][j]))))\n\n print('{:>5}'.format(str(tab[i][j])), end='')\n\n print()\n","target":"def form(x, e=\"\"):\n\n print(\"{:>5}\".format(x), end=e)\n\n\n\nwhile True:\n\n n = int(input())\n\n if n == 0:\n\n break\n\n rows = [list(map(int, input().split())) for _ in range(n)]\n\n for row in rows:\n\n for r in row:\n\n form(r)\n\n form(sum(row), \"\\n\")\n\n columns = list(zip(*rows))\n\n for column in columns:\n\n form(sum(column))\n\n form(sum(sum(row) for row in rows), \"\\n\")\n","code_v0_loc":25,"code_v1_loc":16,"code_v0_num_chars":607,"code_v1_num_chars":417,"code_v0_no_empty_lines":"while True:\n n = int(input())\n if n == 0:\n break\n row = n\n tab = []\n for i in range(row):\n r = list(map(int, input().split()))\n r.append(sum(r))\n tab.append(r)\n bel = []\n for i in range(row):\n tmp = 0\n for j in range(row):\n tmp += tab[j][i]\n bel.append(tmp)\n bel.append(sum(bel))\n tab.append(bel)\n for i in range(row + 1):\n for j in range(row + 1):\n # print(\"\".join(map(\"{0:>5}\".format, str(tab[i][j]))))\n print(\"{:>5}\".format(str(tab[i][j])), end=\"\")\n print()\n","code_v1_no_empty_lines":"def form(x, e=\"\"):\n print(\"{:>5}\".format(x), end=e)\n\n\nwhile True:\n n = int(input())\n if n == 0:\n break\n rows = [list(map(int, input().split())) for _ in range(n)]\n for row in rows:\n for r in row:\n form(r)\n form(sum(row), \"\\n\")\n columns = list(zip(*rows))\n for column in columns:\n form(sum(column))\n form(sum(sum(row) for row in rows), \"\\n\")\n","code_same":false,"relative_loc_diff_percent":36.0,"diff":["+def form(x, e=\"\"):","+ print(\"{:>5}\".format(x), end=e)","+","+","- row = n","- tab = []","- for i in range(row):","- r = list(map(int, input().split()))","- r.append(sum(r))","- tab.append(r)","- bel = []","- for i in range(row):","- tmp = 0","- for j in range(row):","- tmp += tab[j][i]","- bel.append(tmp)","- bel.append(sum(bel))","- tab.append(bel)","- for i in range(row + 1):","- for j in range(row + 1):","- # print(\"\".join(map(\"{0:>5}\".format, str(tab[i][j]))))","- print(\"{:>5}\".format(str(tab[i][j])), end=\"\")","- print()","+ rows = [list(map(int, input().split())) for _ in range(n)]","+ for row in rows:","+ for r in row:","+ form(r)","+ form(sum(row), \"\\n\")","+ columns = list(zip(*rows))","+ for column in columns:","+ form(sum(column))","+ form(sum(sum(row) for row in rows), \"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0398267422,"measured_runtime_v1":0.081158963,"runtime_lift":0.490725124,"key":["s748437334","s887595126"]} +{"user_id":"u661290476","problem_id":"p00017","language":"python","submission_id_v0":"s125617937","submission_id_v1":"s705697033","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7464,"memory_v1":7500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"def chg(s,n):\n\n res=\"\"\n\n for i in s:\n\n o=ord(i)\n\n if 97<=o<=122:\n\n if o+n<=122:\n\n res+=chr(o+n)\n\n else:\n\n res+=chr(o+n-26)\n\n else:\n\n res+=i\n\n return res\n\n\n\nwhile True:\n\n try:\n\n s=eval(input())\n\n for i in range(25,-1,-1):\n\n c=chg(s,i)\n\n e=c.split()\n\n if \"the\" in e or \"this\" in e or \"that\" in e:\n\n print(c)\n\n break\n\n except:\n\n break","target":"def decode(s, n):\n\n a = \"\"\n\n for i in s:\n\n if i.islower():\n\n o = ord(i) + n\n\n if o <= 122:\n\n a += chr(o)\n\n else:\n\n a += chr(o - 26)\n\n else:\n\n a += i\n\n return a\n\n\n\ndef judge(s):\n\n a = s.split()\n\n return \"the\" in a or \"this\" in a or \"that\" in a\n\n\n\nwhile True:\n\n try:\n\n s = eval(input())\n\n except:\n\n break\n\n for i in range(26):\n\n a = decode(s, i)\n\n if judge(a):\n\n print(a)\n\n break","code_v0_loc":24,"code_v1_loc":27,"code_v0_num_chars":508,"code_v1_num_chars":533,"code_v0_no_empty_lines":"def chg(s, n):\n res = \"\"\n for i in s:\n o = ord(i)\n if 97 <= o <= 122:\n if o + n <= 122:\n res += chr(o + n)\n else:\n res += chr(o + n - 26)\n else:\n res += i\n return res\n\n\nwhile True:\n try:\n s = eval(input())\n for i in range(25, -1, -1):\n c = chg(s, i)\n e = c.split()\n if \"the\" in e or \"this\" in e or \"that\" in e:\n print(c)\n break\n except:\n break\n","code_v1_no_empty_lines":"def decode(s, n):\n a = \"\"\n for i in s:\n if i.islower():\n o = ord(i) + n\n if o <= 122:\n a += chr(o)\n else:\n a += chr(o - 26)\n else:\n a += i\n return a\n\n\ndef judge(s):\n a = s.split()\n return \"the\" in a or \"this\" in a or \"that\" in a\n\n\nwhile True:\n try:\n s = eval(input())\n except:\n break\n for i in range(26):\n a = decode(s, i)\n if judge(a):\n print(a)\n break\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-def chg(s, n):","- res = \"\"","+def decode(s, n):","+ a = \"\"","- o = ord(i)","- if 97 <= o <= 122:","- if o + n <= 122:","- res += chr(o + n)","+ if i.islower():","+ o = ord(i) + n","+ if o <= 122:","+ a += chr(o)","- res += chr(o + n - 26)","+ a += chr(o - 26)","- res += i","- return res","+ a += i","+ return a","+","+","+def judge(s):","+ a = s.split()","+ return \"the\" in a or \"this\" in a or \"that\" in a","- for i in range(25, -1, -1):","- c = chg(s, i)","- e = c.split()","- if \"the\" in e or \"this\" in e or \"that\" in e:","- print(c)","- break","+ for i in range(26):","+ a = decode(s, i)","+ if judge(a):","+ print(a)","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.2200303702,"measured_runtime_v1":0.0425024486,"runtime_lift":5.176886924,"key":["s125617937","s705697033"]} +{"user_id":"u254871849","problem_id":"p03503","language":"python","submission_id_v0":"s743836461","submission_id_v1":"s261773750","cpu_time_v0":1488,"cpu_time_v1":80,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.62,"input":"import sys\n\nimport itertools\n\n\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\n# import statistics\n\n\n\n\n\n# bit \u3092\u4f7f\u3063\u3066ci \u3092\u7ba1\u7406\u3059\u308b\n\n\n\ndef toBit(n): \n\n return bin(eval('0b' + str(n)))\n\n\n\ndef main():\n\n\n\n n = int(sys.stdin.readline().rstrip())\n\n\n\n schedule = [toBit(''.join(str(x) for x in sys.stdin.readline().split())) for _ in range(n)]\n\n profit_table = [[int(x) for x in sys.stdin.readline().split()] for _ in range(n)]\n\n\n\n maximum_profit = -10**10\n\n for open_pattern in itertools.product('01', repeat=10):\n\n open_pattern = toBit(''.join(open_pattern))\n\n if open_pattern == '0b0':\n\n continue\n\n profit = 0\n\n for i in range(n):\n\n checked = schedule[i]\n\n number_of_periods = bin(eval(checked) & eval(open_pattern)).count('1')\n\n profit += profit_table[i][number_of_periods]\n\n maximum_profit = max(maximum_profit, profit)\n\n\n\n print(maximum_profit)\n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n","target":"import sys\n\nimport itertools\n\n\n\n# import collections\n\n# import math\n\n# import string\n\n# import bisect\n\n# import re\n\n# import itertools\n\n# import statistics\n\n\n\n\n\n# bit \u3092\u4f7f\u3063\u3066ci \u3092\u7ba1\u7406\u3059\u308b\n\n\n\ndef toBit(n): \n\n return eval('0b' + n)\n\n\n\ndef main():\n\n\n\n n = int(sys.stdin.readline().rstrip())\n\n\n\n schedule = [toBit(''.join(str(x) for x in sys.stdin.readline().split())) for _ in range(n)]\n\n profit_table = [[int(x) for x in sys.stdin.readline().split()] for _ in range(n)]\n\n\n\n maximum_profit = -10**10\n\n for open_pattern in itertools.product('01', repeat=10):\n\n open_pattern = toBit(''.join(open_pattern))\n\n if open_pattern == 0:\n\n continue\n\n profit = 0\n\n for i in range(n):\n\n checked = schedule[i]\n\n number_of_periods = bin(checked & open_pattern).count('1')\n\n profit += profit_table[i][number_of_periods]\n\n maximum_profit = max(maximum_profit, profit)\n\n\n\n print(maximum_profit)\n\n\n\nif __name__ == \"__main__\":\n\n # execute only if run as a script\n\n main()\n","code_v0_loc":41,"code_v1_loc":41,"code_v0_num_chars":1074,"code_v1_num_chars":1048,"code_v0_no_empty_lines":"import sys\nimport itertools\n\n# import collections\n# import math\n# import string\n# import bisect\n# import re\n# import itertools\n# import statistics\n# bit \u3092\u4f7f\u3063\u3066ci \u3092\u7ba1\u7406\u3059\u308b\ndef toBit(n):\n return bin(eval(\"0b\" + str(n)))\n\n\ndef main():\n n = int(sys.stdin.readline().rstrip())\n schedule = [\n toBit(\"\".join(str(x) for x in sys.stdin.readline().split())) for _ in range(n)\n ]\n profit_table = [[int(x) for x in sys.stdin.readline().split()] for _ in range(n)]\n maximum_profit = -(10**10)\n for open_pattern in itertools.product(\"01\", repeat=10):\n open_pattern = toBit(\"\".join(open_pattern))\n if open_pattern == \"0b0\":\n continue\n profit = 0\n for i in range(n):\n checked = schedule[i]\n number_of_periods = bin(eval(checked) & eval(open_pattern)).count(\"1\")\n profit += profit_table[i][number_of_periods]\n maximum_profit = max(maximum_profit, profit)\n print(maximum_profit)\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n","code_v1_no_empty_lines":"import sys\nimport itertools\n\n# import collections\n# import math\n# import string\n# import bisect\n# import re\n# import itertools\n# import statistics\n# bit \u3092\u4f7f\u3063\u3066ci \u3092\u7ba1\u7406\u3059\u308b\ndef toBit(n):\n return eval(\"0b\" + n)\n\n\ndef main():\n n = int(sys.stdin.readline().rstrip())\n schedule = [\n toBit(\"\".join(str(x) for x in sys.stdin.readline().split())) for _ in range(n)\n ]\n profit_table = [[int(x) for x in sys.stdin.readline().split()] for _ in range(n)]\n maximum_profit = -(10**10)\n for open_pattern in itertools.product(\"01\", repeat=10):\n open_pattern = toBit(\"\".join(open_pattern))\n if open_pattern == 0:\n continue\n profit = 0\n for i in range(n):\n checked = schedule[i]\n number_of_periods = bin(checked & open_pattern).count(\"1\")\n profit += profit_table[i][number_of_periods]\n maximum_profit = max(maximum_profit, profit)\n print(maximum_profit)\n\n\nif __name__ == \"__main__\":\n # execute only if run as a script\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- return bin(eval(\"0b\" + str(n)))","+ return eval(\"0b\" + n)","- if open_pattern == \"0b0\":","+ if open_pattern == 0:","- number_of_periods = bin(eval(checked) & eval(open_pattern)).count(\"1\")","+ number_of_periods = bin(checked & open_pattern).count(\"1\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0764234457,"measured_runtime_v1":0.0426573336,"runtime_lift":1.7915664016,"key":["s743836461","s261773750"]} +{"user_id":"u747709646","problem_id":"p02383","language":"python","submission_id_v0":"s084609660","submission_id_v1":"s186434155","cpu_time_v0":40,"cpu_time_v1":20,"memory_v0":7860,"memory_v1":7796,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"currAndRot2FBLR = {\n\n 'N':{'N':'F','E':'R','S':'B','W':'L'},\n\n 'E':{'E':'F','S':'R','W':'B','N':'L'},\n\n 'S':{'S':'F','W':'R','N':'B','E':'L'},\n\n 'W':{'W':'F','N':'R','E':'B','S':'L'}\n\n}\n\n\n\ndice = {\n\n '1': {'F':'2F', 'R':'4R', 'B':'5B', 'L':'3L'},\n\n '2': {'F':'6F', 'R':'4F', 'B':'1F', 'L':'3F'},\n\n '3': {'F':'6L', 'R':'2F', 'B':'1R', 'L':'5F'},\n\n '4': {'F':'6R', 'R':'5F', 'B':'1L', 'L':'2F'},\n\n '5': {'F':'6B', 'R':'3F', 'B':'1B', 'L':'4F'},\n\n '6': {'F':'5B', 'R':'4L', 'B':'2F', 'L':'3R'}\n\n}\n\n\n\nfaces = list(map(int, input().split()))\n\ncmd = eval(input())\n\n\n\n## initial state\n\ncurrNum = '1'\n\ncurrDir = 'N'\n\n\n\nfor c in cmd:\n\n numDir = dice[currNum][currAndRot2FBLR[currDir][c]]\n\n currNum = numDir[0]\n\n currFBLR = numDir[1]\n\n currDir = {v:k for k,v in list(currAndRot2FBLR[currDir].items())}[currFBLR]\n\n\n\nprint((faces[int(currNum) - 1]))","target":"class Dice:\n\n dice = {'N':2, 'E':4, 'S':5, 'W':3}\n\n currTop = 1\n\n\n\n def top(self):\n\n return self.currTop\n\n\n\n def rot(self, direction):\n\n newTop = self.dice[direction]\n\n currTop = self.currTop\n\n self.currTop = newTop\n\n if direction == 'N':\n\n self.dice['N'] = 7 - currTop\n\n self.dice['S'] = currTop\n\n elif direction == 'S':\n\n self.dice['N'] = currTop\n\n self.dice['S'] = 7 - currTop\n\n elif direction == 'E':\n\n self.dice['E'] = 7 - currTop\n\n self.dice['W'] = currTop\n\n elif direction == 'W':\n\n self.dice['E'] = currTop\n\n self.dice['W'] = 7 - currTop\n\n\n\n\n\nfaces = list(map(int, input().split()))\n\ncmd = eval(input())\n\n\n\nd = Dice()\n\nfor c in cmd:\n\n d.rot(c)\n\n\n\nprint((faces[d.top()-1]))","code_v0_loc":30,"code_v1_loc":33,"code_v0_num_chars":865,"code_v1_num_chars":831,"code_v0_no_empty_lines":"currAndRot2FBLR = {\n \"N\": {\"N\": \"F\", \"E\": \"R\", \"S\": \"B\", \"W\": \"L\"},\n \"E\": {\"E\": \"F\", \"S\": \"R\", \"W\": \"B\", \"N\": \"L\"},\n \"S\": {\"S\": \"F\", \"W\": \"R\", \"N\": \"B\", \"E\": \"L\"},\n \"W\": {\"W\": \"F\", \"N\": \"R\", \"E\": \"B\", \"S\": \"L\"},\n}\ndice = {\n \"1\": {\"F\": \"2F\", \"R\": \"4R\", \"B\": \"5B\", \"L\": \"3L\"},\n \"2\": {\"F\": \"6F\", \"R\": \"4F\", \"B\": \"1F\", \"L\": \"3F\"},\n \"3\": {\"F\": \"6L\", \"R\": \"2F\", \"B\": \"1R\", \"L\": \"5F\"},\n \"4\": {\"F\": \"6R\", \"R\": \"5F\", \"B\": \"1L\", \"L\": \"2F\"},\n \"5\": {\"F\": \"6B\", \"R\": \"3F\", \"B\": \"1B\", \"L\": \"4F\"},\n \"6\": {\"F\": \"5B\", \"R\": \"4L\", \"B\": \"2F\", \"L\": \"3R\"},\n}\nfaces = list(map(int, input().split()))\ncmd = eval(input())\n## initial state\ncurrNum = \"1\"\ncurrDir = \"N\"\nfor c in cmd:\n numDir = dice[currNum][currAndRot2FBLR[currDir][c]]\n currNum = numDir[0]\n currFBLR = numDir[1]\n currDir = {v: k for k, v in list(currAndRot2FBLR[currDir].items())}[currFBLR]\nprint((faces[int(currNum) - 1]))\n","code_v1_no_empty_lines":"class Dice:\n dice = {\"N\": 2, \"E\": 4, \"S\": 5, \"W\": 3}\n currTop = 1\n\n def top(self):\n return self.currTop\n\n def rot(self, direction):\n newTop = self.dice[direction]\n currTop = self.currTop\n self.currTop = newTop\n if direction == \"N\":\n self.dice[\"N\"] = 7 - currTop\n self.dice[\"S\"] = currTop\n elif direction == \"S\":\n self.dice[\"N\"] = currTop\n self.dice[\"S\"] = 7 - currTop\n elif direction == \"E\":\n self.dice[\"E\"] = 7 - currTop\n self.dice[\"W\"] = currTop\n elif direction == \"W\":\n self.dice[\"E\"] = currTop\n self.dice[\"W\"] = 7 - currTop\n\n\nfaces = list(map(int, input().split()))\ncmd = eval(input())\nd = Dice()\nfor c in cmd:\n d.rot(c)\nprint((faces[d.top() - 1]))\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-currAndRot2FBLR = {","- \"N\": {\"N\": \"F\", \"E\": \"R\", \"S\": \"B\", \"W\": \"L\"},","- \"E\": {\"E\": \"F\", \"S\": \"R\", \"W\": \"B\", \"N\": \"L\"},","- \"S\": {\"S\": \"F\", \"W\": \"R\", \"N\": \"B\", \"E\": \"L\"},","- \"W\": {\"W\": \"F\", \"N\": \"R\", \"E\": \"B\", \"S\": \"L\"},","-}","-dice = {","- \"1\": {\"F\": \"2F\", \"R\": \"4R\", \"B\": \"5B\", \"L\": \"3L\"},","- \"2\": {\"F\": \"6F\", \"R\": \"4F\", \"B\": \"1F\", \"L\": \"3F\"},","- \"3\": {\"F\": \"6L\", \"R\": \"2F\", \"B\": \"1R\", \"L\": \"5F\"},","- \"4\": {\"F\": \"6R\", \"R\": \"5F\", \"B\": \"1L\", \"L\": \"2F\"},","- \"5\": {\"F\": \"6B\", \"R\": \"3F\", \"B\": \"1B\", \"L\": \"4F\"},","- \"6\": {\"F\": \"5B\", \"R\": \"4L\", \"B\": \"2F\", \"L\": \"3R\"},","-}","+class Dice:","+ dice = {\"N\": 2, \"E\": 4, \"S\": 5, \"W\": 3}","+ currTop = 1","+","+ def top(self):","+ return self.currTop","+","+ def rot(self, direction):","+ newTop = self.dice[direction]","+ currTop = self.currTop","+ self.currTop = newTop","+ if direction == \"N\":","+ self.dice[\"N\"] = 7 - currTop","+ self.dice[\"S\"] = currTop","+ elif direction == \"S\":","+ self.dice[\"N\"] = currTop","+ self.dice[\"S\"] = 7 - currTop","+ elif direction == \"E\":","+ self.dice[\"E\"] = 7 - currTop","+ self.dice[\"W\"] = currTop","+ elif direction == \"W\":","+ self.dice[\"E\"] = currTop","+ self.dice[\"W\"] = 7 - currTop","+","+","-## initial state","-currNum = \"1\"","-currDir = \"N\"","+d = Dice()","- numDir = dice[currNum][currAndRot2FBLR[currDir][c]]","- currNum = numDir[0]","- currFBLR = numDir[1]","- currDir = {v: k for k, v in list(currAndRot2FBLR[currDir].items())}[currFBLR]","-print((faces[int(currNum) - 1]))","+ d.rot(c)","+print((faces[d.top() - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0464689736,"measured_runtime_v1":0.0716330121,"runtime_lift":0.6487089164,"key":["s084609660","s186434155"]} +{"user_id":"u539953365","problem_id":"p03420","language":"python","submission_id_v0":"s091541792","submission_id_v1":"s709546365","cpu_time_v0":109,"cpu_time_v1":90,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.43,"input":"n, k = [int(i) for i in input().split()]\n\nans = 0\n\nif k == 0:\n\n ans = n*n\n\nelse:\n\n for b in range(k+1, n+1):\n\n # number of perfect cycle\n\n ans += max(n \/\/ b, 0) * (b-k)\n\n r = n % b\n\n ans += max(r - k+1, 0)\n\nprint(ans)","target":"n, k = [int(i) for i in input().split()]\n\nans = 0\n\nif k == 0:\n\n ans = n*n\n\nelse:\n\n for b in range(k+1, n+1):\n\n # number of perfect cycle\n\n ans += n \/\/ b * (b-k)\n\n r = n % b\n\n ans += max(r - k+1, 0)\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":251,"code_v1_num_chars":243,"code_v0_no_empty_lines":"n, k = [int(i) for i in input().split()]\nans = 0\nif k == 0:\n ans = n * n\nelse:\n for b in range(k + 1, n + 1):\n # number of perfect cycle\n ans += max(n \/\/ b, 0) * (b - k)\n r = n % b\n ans += max(r - k + 1, 0)\nprint(ans)\n","code_v1_no_empty_lines":"n, k = [int(i) for i in input().split()]\nans = 0\nif k == 0:\n ans = n * n\nelse:\n for b in range(k + 1, n + 1):\n # number of perfect cycle\n ans += n \/\/ b * (b - k)\n r = n % b\n ans += max(r - k + 1, 0)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- ans += max(n \/\/ b, 0) * (b - k)","+ ans += n \/\/ b * (b - k)"],"diff_only_import_comment":false,"measured_runtime_v0":0.075006031,"measured_runtime_v1":0.0505121884,"runtime_lift":1.4849095505,"key":["s091541792","s709546365"]} +{"user_id":"u357751375","problem_id":"p03548","language":"python","submission_id_v0":"s354112376","submission_id_v1":"s537745287","cpu_time_v0":32,"cpu_time_v1":27,"memory_v0":9112,"memory_v1":9052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.62,"input":"x,y,z = list(map(int,input().split()))\n\np = y + z + z\n\nc = 0\n\n\n\nwhile p <= x:\n\n c += 1\n\n p = p + y + z\n\n\n\nprint(c)","target":"x,y,z = list(map(int,input().split()))\n\nyz = y + z\n\nx -= z\n\nprint((x \/\/ yz))","code_v0_loc":9,"code_v1_loc":4,"code_v0_num_chars":114,"code_v1_num_chars":68,"code_v0_no_empty_lines":"x, y, z = list(map(int, input().split()))\np = y + z + z\nc = 0\nwhile p <= x:\n c += 1\n p = p + y + z\nprint(c)\n","code_v1_no_empty_lines":"x, y, z = list(map(int, input().split()))\nyz = y + z\nx -= z\nprint((x \/\/ yz))\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-p = y + z + z","-c = 0","-while p <= x:","- c += 1","- p = p + y + z","-print(c)","+yz = y + z","+x -= z","+print((x \/\/ yz))"],"diff_only_import_comment":false,"measured_runtime_v0":0.041027832,"measured_runtime_v1":0.0361965571,"runtime_lift":1.1334733267,"key":["s354112376","s537745287"]} +{"user_id":"u347600233","problem_id":"p03042","language":"python","submission_id_v0":"s933890359","submission_id_v1":"s687910242","cpu_time_v0":32,"cpu_time_v1":29,"memory_v0":8956,"memory_v1":9076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.38,"input":"s = eval(input())\n\ns1, s2 = int(s[:2]), int(s[2:])\n\nans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']\n\nprint((ans[((1 <= s1 <= 12) << 1) + (1 <= s2 <= 12)]))","target":"s = eval(input())\n\nb1 = 1 <= int(s[:2]) <= 12\n\nb2 = 1 <= int(s[2:]) <= 12\n\nans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']\n\nprint((ans[2*b1 + b2]))","code_v0_loc":4,"code_v1_loc":5,"code_v0_num_chars":141,"code_v1_num_chars":133,"code_v0_no_empty_lines":"s = eval(input())\ns1, s2 = int(s[:2]), int(s[2:])\nans = [\"NA\", \"YYMM\", \"MMYY\", \"AMBIGUOUS\"]\nprint((ans[((1 <= s1 <= 12) << 1) + (1 <= s2 <= 12)]))\n","code_v1_no_empty_lines":"s = eval(input())\nb1 = 1 <= int(s[:2]) <= 12\nb2 = 1 <= int(s[2:]) <= 12\nans = [\"NA\", \"YYMM\", \"MMYY\", \"AMBIGUOUS\"]\nprint((ans[2 * b1 + b2]))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-s1, s2 = int(s[:2]), int(s[2:])","+b1 = 1 <= int(s[:2]) <= 12","+b2 = 1 <= int(s[2:]) <= 12","-print((ans[((1 <= s1 <= 12) << 1) + (1 <= s2 <= 12)]))","+print((ans[2 * b1 + b2]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0359664497,"measured_runtime_v1":0.0365241928,"runtime_lift":0.9847294892,"key":["s933890359","s687910242"]} +{"user_id":"u936985471","problem_id":"p03329","language":"python","submission_id_v0":"s200815646","submission_id_v1":"s620739928","cpu_time_v0":485,"cpu_time_v1":214,"memory_v0":7064,"memory_v1":9544,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.88,"input":"# dp\n\n# N\u5186\u3092\u4f5c\u308b\u306e\u306b\u6700\u3082\u5c0f\u3055\u3044\u64cd\u4f5c\u56de\u6570\n\n\n\nimport sys\n\nreadline = sys.stdin.readline\n\n\n\nN = int(readline())\n\n\n\ndp = [i for i in range(N + 1)]\n\n\n\nfor i in range(len(dp)):\n\n n = 6\n\n while i + n < len(dp):\n\n if dp[i + n] > dp[i] + 1:\n\n dp[i + n] = dp[i] + 1\n\n n *= 6\n\n n = 9\n\n while i + n < len(dp):\n\n if dp[i + n] > dp[i] + 1:\n\n dp[i + n] = dp[i] + 1\n\n n *= 9\n\nprint((dp[N]))\n","target":"import sys\n\nreadline = sys.stdin.readline\n\n\n\nN = int(readline())\n\nINF = 10 ** 10\n\ndp = [INF] * (N + 1)\n\ndp[0] = 0\n\n\n\nfor i in range(10,0,-1):\n\n for j in range(N + 1):\n\n if dp[j] != INF:\n\n if j + 6 ** i <= N:\n\n dp[j + 6 ** i] = min(dp[j + 6 ** i], dp[j] + 1)\n\n if j + 9 ** i <= N:\n\n dp[j + 9 ** i] = min(dp[j + 9 ** i], dp[j] + 1)\n\n\n\nans = INF\n\nfor i in range(len(dp) - 1, -1, -1):\n\n money = dp[i] + N - i\n\n if ans > money:\n\n ans = money\n\n \n\nprint(ans)","code_v0_loc":22,"code_v1_loc":23,"code_v0_num_chars":383,"code_v1_num_chars":491,"code_v0_no_empty_lines":"# dp\n# N\u5186\u3092\u4f5c\u308b\u306e\u306b\u6700\u3082\u5c0f\u3055\u3044\u64cd\u4f5c\u56de\u6570\nimport sys\n\nreadline = sys.stdin.readline\nN = int(readline())\ndp = [i for i in range(N + 1)]\nfor i in range(len(dp)):\n n = 6\n while i + n < len(dp):\n if dp[i + n] > dp[i] + 1:\n dp[i + n] = dp[i] + 1\n n *= 6\n n = 9\n while i + n < len(dp):\n if dp[i + n] > dp[i] + 1:\n dp[i + n] = dp[i] + 1\n n *= 9\nprint((dp[N]))\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nN = int(readline())\nINF = 10**10\ndp = [INF] * (N + 1)\ndp[0] = 0\nfor i in range(10, 0, -1):\n for j in range(N + 1):\n if dp[j] != INF:\n if j + 6**i <= N:\n dp[j + 6**i] = min(dp[j + 6**i], dp[j] + 1)\n if j + 9**i <= N:\n dp[j + 9**i] = min(dp[j + 9**i], dp[j] + 1)\nans = INF\nfor i in range(len(dp) - 1, -1, -1):\n money = dp[i] + N - i\n if ans > money:\n ans = money\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["-# dp","-# N\u5186\u3092\u4f5c\u308b\u306e\u306b\u6700\u3082\u5c0f\u3055\u3044\u64cd\u4f5c\u56de\u6570","-dp = [i for i in range(N + 1)]","-for i in range(len(dp)):","- n = 6","- while i + n < len(dp):","- if dp[i + n] > dp[i] + 1:","- dp[i + n] = dp[i] + 1","- n *= 6","- n = 9","- while i + n < len(dp):","- if dp[i + n] > dp[i] + 1:","- dp[i + n] = dp[i] + 1","- n *= 9","-print((dp[N]))","+INF = 10**10","+dp = [INF] * (N + 1)","+dp[0] = 0","+for i in range(10, 0, -1):","+ for j in range(N + 1):","+ if dp[j] != INF:","+ if j + 6**i <= N:","+ dp[j + 6**i] = min(dp[j + 6**i], dp[j] + 1)","+ if j + 9**i <= N:","+ dp[j + 9**i] = min(dp[j + 9**i], dp[j] + 1)","+ans = INF","+for i in range(len(dp) - 1, -1, -1):","+ money = dp[i] + N - i","+ if ans > money:","+ ans = money","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0919139521,"measured_runtime_v1":0.0949556859,"runtime_lift":0.9679668076,"key":["s200815646","s620739928"]} +{"user_id":"u365156087","problem_id":"p02641","language":"python","submission_id_v0":"s090803746","submission_id_v1":"s266984205","cpu_time_v0":29,"cpu_time_v1":26,"memory_v0":9112,"memory_v1":9120,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.34,"input":"x, n = list(map(int,input().split()))\n\nL = list(map(int,input().split()))\n\nl, r = x-1, x+1\n\n\n\nif n == 0 or x not in L:\n\n print(x)\n\n exit()\n\n\n\nwhile True:\n\n flg = True\n\n if l not in L:\n\n print(l)\n\n break\n\n elif r not in L:\n\n print(r)\n\n break\n\n l -= 1\n\n r += 1","target":"x, n = list(map(int,input().split()))\n\nL = list(map(int,input().split()))\n\nl, r = x-1, x+1\n\n\n\nif n == 0 or x not in L:\n\n print(x)\n\n exit()\n\n\n\nwhile True:\n\n if l not in L:\n\n print(l)\n\n break\n\n elif r not in L:\n\n print(r)\n\n break\n\n l -= 1\n\n r += 1","code_v0_loc":18,"code_v1_loc":17,"code_v0_num_chars":271,"code_v1_num_chars":257,"code_v0_no_empty_lines":"x, n = list(map(int, input().split()))\nL = list(map(int, input().split()))\nl, r = x - 1, x + 1\nif n == 0 or x not in L:\n print(x)\n exit()\nwhile True:\n flg = True\n if l not in L:\n print(l)\n break\n elif r not in L:\n print(r)\n break\n l -= 1\n r += 1\n","code_v1_no_empty_lines":"x, n = list(map(int, input().split()))\nL = list(map(int, input().split()))\nl, r = x - 1, x + 1\nif n == 0 or x not in L:\n print(x)\n exit()\nwhile True:\n if l not in L:\n print(l)\n break\n elif r not in L:\n print(r)\n break\n l -= 1\n r += 1\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["- flg = True"],"diff_only_import_comment":false,"measured_runtime_v0":0.0426283731,"measured_runtime_v1":0.0386909773,"runtime_lift":1.1017652195,"key":["s090803746","s266984205"]} +{"user_id":"u956433805","problem_id":"p02900","language":"python","submission_id_v0":"s360824964","submission_id_v1":"s882176944","cpu_time_v0":449,"cpu_time_v1":355,"memory_v0":28760,"memory_v1":11084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.94,"input":"import numpy as np\n\n\n\ndef divisor(n): \n\n i = 1\n\n table = []\n\n while i * i <= n:\n\n if n%i == 0:\n\n table.append(i)\n\n table.append(n\/\/i)\n\n i += 1\n\n table = list(set(table))\n\n table = sorted(table)\n\n return table\n\n\n\ndef make_prime(U):\n\n is_prime = np.zeros(U,np.bool)\n\n is_prime[2] = 1\n\n is_prime[3::2] = 1\n\n M = int(U**.5)+1\n\n for p in range(3,M,2):\n\n if is_prime[p]:\n\n is_prime[p*p::p+p] = 0\n\n return is_prime, is_prime.nonzero()[0]\n\nA, B = list(map(int, input().split()))\n\n\n\ndef is_prime(n):\n\n if n == 1:\n\n return False\n\n for i in range(2,int(n**0.5)+1):\n\n if n % i == 0:\n\n return False\n\n return True\n\n\n\nA_list = set(divisor(A))\n\nB_list = set(divisor(B))\n\n\n\nlist = A_list & B_list\n\n\n\n#_, primes = make_prime(10**8)\n\n\n\ncnt = 1\n\n\n\nfor i in list:\n\n if is_prime(i):\n\n cnt += 1\n\n\n\nprint(cnt)","target":"def divisor(n): \n\n i = 1\n\n table = []\n\n while i * i <= n:\n\n if n%i == 0:\n\n table.append(i)\n\n table.append(n\/\/i)\n\n i += 1\n\n table = list(set(table))\n\n table = sorted(table)\n\n return table\n\n\n\ndef is_prime(n):\n\n if n == 1:\n\n return False\n\n for i in range(2,int(n**0.5)+1):\n\n if n % i == 0:\n\n return False\n\n return True\n\n\n\nA, B = list(map(int, input().split()))\n\n\n\nA_list = set(divisor(A))\n\nB_list = set(divisor(B))\n\n\n\nlist = A_list & B_list\n\n\n\ncnt = 1\n\n\n\nfor i in list:\n\n if is_prime(i):\n\n cnt += 1\n\n\n\nprint(cnt)","code_v0_loc":47,"code_v1_loc":34,"code_v0_num_chars":913,"code_v1_num_chars":601,"code_v0_no_empty_lines":"import numpy as np\n\n\ndef divisor(n):\n i = 1\n table = []\n while i * i <= n:\n if n % i == 0:\n table.append(i)\n table.append(n \/\/ i)\n i += 1\n table = list(set(table))\n table = sorted(table)\n return table\n\n\ndef make_prime(U):\n is_prime = np.zeros(U, np.bool)\n is_prime[2] = 1\n is_prime[3::2] = 1\n M = int(U**0.5) + 1\n for p in range(3, M, 2):\n if is_prime[p]:\n is_prime[p * p :: p + p] = 0\n return is_prime, is_prime.nonzero()[0]\n\n\nA, B = list(map(int, input().split()))\n\n\ndef is_prime(n):\n if n == 1:\n return False\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n return True\n\n\nA_list = set(divisor(A))\nB_list = set(divisor(B))\nlist = A_list & B_list\n# _, primes = make_prime(10**8)\ncnt = 1\nfor i in list:\n if is_prime(i):\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"def divisor(n):\n i = 1\n table = []\n while i * i <= n:\n if n % i == 0:\n table.append(i)\n table.append(n \/\/ i)\n i += 1\n table = list(set(table))\n table = sorted(table)\n return table\n\n\ndef is_prime(n):\n if n == 1:\n return False\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n return True\n\n\nA, B = list(map(int, input().split()))\nA_list = set(divisor(A))\nB_list = set(divisor(B))\nlist = A_list & B_list\ncnt = 1\nfor i in list:\n if is_prime(i):\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":27.6595744681,"diff":["-import numpy as np","-","-","-def make_prime(U):","- is_prime = np.zeros(U, np.bool)","- is_prime[2] = 1","- is_prime[3::2] = 1","- M = int(U**0.5) + 1","- for p in range(3, M, 2):","- if is_prime[p]:","- is_prime[p * p :: p + p] = 0","- return is_prime, is_prime.nonzero()[0]","-","-","-A, B = list(map(int, input().split()))","-","-","+A, B = list(map(int, input().split()))","-# _, primes = make_prime(10**8)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2801882675,"measured_runtime_v1":0.0360872741,"runtime_lift":7.7641848706,"key":["s360824964","s882176944"]} +{"user_id":"u498487134","problem_id":"p03031","language":"python","submission_id_v0":"s521200804","submission_id_v1":"s837993561","cpu_time_v0":203,"cpu_time_v1":75,"memory_v0":41456,"memory_v1":73704,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.05,"input":"N,M=list(map(int,input().split()))\n\nk=[0]*M\n\ns=[[] for _ in range(M)]\n\n\n\nfor i in range(M):\n\n a=list(map(int,input().split()))\n\n k[i]=a[0]\n\n s[i]=a[1:]\n\n s[i].sort()\n\n\n\np=list(map(int,input().split()))\n\n \n\nans=0\n\nfor i in range(pow(2,N)):\n\n light=0\n\n for j in range(M):\n\n temp=0\n\n for kk in range(k[j]):\n\n a=i>>(s[j][kk]-1)\n\n if a&1==1:\n\n temp+=1\n\n if temp%2!=p[j]:\n\n break\n\n light+=1\n\n if light==M:\n\n ans+=1\n\n \n\nprint(ans)\n\n\n\n\n\n\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N,M=MI()\n\n s=[]\n\n for i in range(M):\n\n L=LI()\n\n s.append(L[1:])\n\n p=LI()\n\n \n\n import itertools\n\n \n\n ans=0\n\n for ite in itertools.product([0,1], repeat=N):\n\n flag=1\n\n for i in range(M):\n\n temp=0\n\n for ss in s[i]:\n\n if ite[ss-1]:\n\n temp+=1\n\n if temp%2==p[i]:\n\n pass\n\n else:\n\n flag=0\n\n if flag:\n\n ans+=1\n\n \n\n print(ans)\n\n \n\n \n\n \n\n \n\n\n\nmain()\n","code_v0_loc":31,"code_v1_loc":40,"code_v0_num_chars":545,"code_v1_num_chars":781,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nk = [0] * M\ns = [[] for _ in range(M)]\nfor i in range(M):\n a = list(map(int, input().split()))\n k[i] = a[0]\n s[i] = a[1:]\n s[i].sort()\np = list(map(int, input().split()))\nans = 0\nfor i in range(pow(2, N)):\n light = 0\n for j in range(M):\n temp = 0\n for kk in range(k[j]):\n a = i >> (s[j][kk] - 1)\n if a & 1 == 1:\n temp += 1\n if temp % 2 != p[j]:\n break\n light += 1\n if light == M:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, M = MI()\n s = []\n for i in range(M):\n L = LI()\n s.append(L[1:])\n p = LI()\n import itertools\n\n ans = 0\n for ite in itertools.product([0, 1], repeat=N):\n flag = 1\n for i in range(M):\n temp = 0\n for ss in s[i]:\n if ite[ss - 1]:\n temp += 1\n if temp % 2 == p[i]:\n pass\n else:\n flag = 0\n if flag:\n ans += 1\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":22.5,"diff":["-N, M = list(map(int, input().split()))","-k = [0] * M","-s = [[] for _ in range(M)]","-for i in range(M):","- a = list(map(int, input().split()))","- k[i] = a[0]","- s[i] = a[1:]","- s[i].sort()","-p = list(map(int, input().split()))","-ans = 0","-for i in range(pow(2, N)):","- light = 0","- for j in range(M):","- temp = 0","- for kk in range(k[j]):","- a = i >> (s[j][kk] - 1)","- if a & 1 == 1:","- temp += 1","- if temp % 2 != p[j]:","- break","- light += 1","- if light == M:","- ans += 1","-print(ans)","+import sys","+","+input = sys.stdin.readline","+","+","+def I():","+ return int(eval(input()))","+","+","+def MI():","+ return list(map(int, input().split()))","+","+","+def LI():","+ return list(map(int, input().split()))","+","+","+def main():","+ mod = 10**9 + 7","+ N, M = MI()","+ s = []","+ for i in range(M):","+ L = LI()","+ s.append(L[1:])","+ p = LI()","+ import itertools","+","+ ans = 0","+ for ite in itertools.product([0, 1], repeat=N):","+ flag = 1","+ for i in range(M):","+ temp = 0","+ for ss in s[i]:","+ if ite[ss - 1]:","+ temp += 1","+ if temp % 2 == p[i]:","+ pass","+ else:","+ flag = 0","+ if flag:","+ ans += 1","+ print(ans)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0431123881,"measured_runtime_v1":0.0076307042,"runtime_lift":5.6498570968,"key":["s521200804","s837993561"]} +{"user_id":"u094191970","problem_id":"p03608","language":"python","submission_id_v0":"s870534243","submission_id_v1":"s220785932","cpu_time_v0":972,"cpu_time_v1":713,"memory_v0":32600,"memory_v1":23420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.65,"input":"import itertools\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\nN,M,R=list(map(int,input().split()))\n\nr=list(map(int,input().split()))\n\nl=[list(map(int,input().split())) for i in range(M)]\n\n\n\ns=[[float('inf') for i in range(N)] for i in range(N)]\n\nfor i in range(M):\n\n a,b,c=l[i]\n\n s[a-1][b-1]=c\n\n s[b-1][a-1]=c\n\nfor i in range(N):\n\n s[i][i]=0\n\n\n\ns=floyd_warshall(s)\n\n#print(s)\n\nans=10**9\n\nfor i in itertools.permutations(r):\n\n# print(i)\n\n temp_ans=0\n\n for j in range(R-1):\n\n temp_ans+=s[i[j]-1][i[j+1]-1]\n\n ans=min(ans,temp_ans)\n\nprint((int(ans)))","target":"import itertools\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\nn,m,r=list(map(int,input().split()))\n\nr_l=list(map(int,input().split()))\n\nl=[list(map(int,input().split())) for i in range(m)]\n\n\n\nd=[[float('inf')]*n for i in range(n)]\n\nfor i in range(n):\n\n d[i][i]=0\n\nfor i in l:\n\n d[i[0]-1][i[1]-1]=i[2]\n\n d[i[1]-1][i[0]-1]=i[2]\n\nd=floyd_warshall(d)\n\n\n\nans=10**9\n\nfor i in itertools.permutations(r_l):\n\n t_ans=0\n\n for j in range(len(i)-1):\n\n t_ans+=d[i[j]-1][i[j+1]-1]\n\n ans=min(ans,t_ans)\n\nprint((int(ans)))","code_v0_loc":25,"code_v1_loc":22,"code_v0_num_chars":576,"code_v1_num_chars":529,"code_v0_no_empty_lines":"import itertools\nfrom scipy.sparse.csgraph import floyd_warshall\n\nN, M, R = list(map(int, input().split()))\nr = list(map(int, input().split()))\nl = [list(map(int, input().split())) for i in range(M)]\ns = [[float(\"inf\") for i in range(N)] for i in range(N)]\nfor i in range(M):\n a, b, c = l[i]\n s[a - 1][b - 1] = c\n s[b - 1][a - 1] = c\nfor i in range(N):\n s[i][i] = 0\ns = floyd_warshall(s)\n# print(s)\nans = 10**9\nfor i in itertools.permutations(r):\n # print(i)\n temp_ans = 0\n for j in range(R - 1):\n temp_ans += s[i[j] - 1][i[j + 1] - 1]\n ans = min(ans, temp_ans)\nprint((int(ans)))\n","code_v1_no_empty_lines":"import itertools\nfrom scipy.sparse.csgraph import floyd_warshall\n\nn, m, r = list(map(int, input().split()))\nr_l = list(map(int, input().split()))\nl = [list(map(int, input().split())) for i in range(m)]\nd = [[float(\"inf\")] * n for i in range(n)]\nfor i in range(n):\n d[i][i] = 0\nfor i in l:\n d[i[0] - 1][i[1] - 1] = i[2]\n d[i[1] - 1][i[0] - 1] = i[2]\nd = floyd_warshall(d)\nans = 10**9\nfor i in itertools.permutations(r_l):\n t_ans = 0\n for j in range(len(i) - 1):\n t_ans += d[i[j] - 1][i[j + 1] - 1]\n ans = min(ans, t_ans)\nprint((int(ans)))\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["-N, M, R = list(map(int, input().split()))","-r = list(map(int, input().split()))","-l = [list(map(int, input().split())) for i in range(M)]","-s = [[float(\"inf\") for i in range(N)] for i in range(N)]","-for i in range(M):","- a, b, c = l[i]","- s[a - 1][b - 1] = c","- s[b - 1][a - 1] = c","-for i in range(N):","- s[i][i] = 0","-s = floyd_warshall(s)","-# print(s)","+n, m, r = list(map(int, input().split()))","+r_l = list(map(int, input().split()))","+l = [list(map(int, input().split())) for i in range(m)]","+d = [[float(\"inf\")] * n for i in range(n)]","+for i in range(n):","+ d[i][i] = 0","+for i in l:","+ d[i[0] - 1][i[1] - 1] = i[2]","+ d[i[1] - 1][i[0] - 1] = i[2]","+d = floyd_warshall(d)","-for i in itertools.permutations(r):","- # print(i)","- temp_ans = 0","- for j in range(R - 1):","- temp_ans += s[i[j] - 1][i[j + 1] - 1]","- ans = min(ans, temp_ans)","+for i in itertools.permutations(r_l):","+ t_ans = 0","+ for j in range(len(i) - 1):","+ t_ans += d[i[j] - 1][i[j + 1] - 1]","+ ans = min(ans, t_ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3815171642,"measured_runtime_v1":0.2646732118,"runtime_lift":1.4414649734,"key":["s870534243","s220785932"]} +{"user_id":"u439396449","problem_id":"p03946","language":"python","submission_id_v0":"s816487918","submission_id_v1":"s778905609","cpu_time_v0":158,"cpu_time_v1":127,"memory_v0":22112,"memory_v1":21720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.62,"input":"from collections import defaultdict\n\n\n\nN, T = list(map(int, input().split()))\n\nA = [int(x) for x in input().split()]\n\n\n\nB = [0] * N\n\nfor i in range(N - 1):\n\n a = A[N - i - 1]\n\n B[i + 1] = max(B[i], a)\n\nB = B[::-1]\n\n\n\nc = defaultdict(int)\n\nfor i in range(N - 1):\n\n c[B[i] - A[i]] += 1\n\nprint((c[max(c)]))\n","target":"from itertools import accumulate\n\nfrom collections import defaultdict\n\n\n\nN, T = list(map(int, input().split()))\n\nA = [int(x) for x in input().split()]\n\n\n\nB = [x for x in accumulate(A[::-1], max)][::-1]\n\nc = defaultdict(int)\n\nfor i in range(N - 1):\n\n c[B[i] - A[i]] += 1\n\nprint((c[max(c)]))","code_v0_loc":15,"code_v1_loc":11,"code_v0_num_chars":305,"code_v1_num_chars":284,"code_v0_no_empty_lines":"from collections import defaultdict\n\nN, T = list(map(int, input().split()))\nA = [int(x) for x in input().split()]\nB = [0] * N\nfor i in range(N - 1):\n a = A[N - i - 1]\n B[i + 1] = max(B[i], a)\nB = B[::-1]\nc = defaultdict(int)\nfor i in range(N - 1):\n c[B[i] - A[i]] += 1\nprint((c[max(c)]))\n","code_v1_no_empty_lines":"from itertools import accumulate\nfrom collections import defaultdict\n\nN, T = list(map(int, input().split()))\nA = [int(x) for x in input().split()]\nB = [x for x in accumulate(A[::-1], max)][::-1]\nc = defaultdict(int)\nfor i in range(N - 1):\n c[B[i] - A[i]] += 1\nprint((c[max(c)]))\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["+from itertools import accumulate","-B = [0] * N","-for i in range(N - 1):","- a = A[N - i - 1]","- B[i + 1] = max(B[i], a)","-B = B[::-1]","+B = [x for x in accumulate(A[::-1], max)][::-1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0449748039,"measured_runtime_v1":0.0449725628,"runtime_lift":1.0000498332,"key":["s816487918","s778905609"]} +{"user_id":"u543584809","problem_id":"p02681","language":"python","submission_id_v0":"s984226640","submission_id_v1":"s555692003","cpu_time_v0":24,"cpu_time_v1":20,"memory_v0":8968,"memory_v1":8988,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"s = eval(input())\n\nt = input()[:-1]\n\n\n\nif s == t:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","target":"if eval(input()) == input()[:-1]:print(\"Yes\")\n\nelse: print(\"No\")","code_v0_loc":7,"code_v1_loc":2,"code_v0_num_chars":81,"code_v1_num_chars":58,"code_v0_no_empty_lines":"s = eval(input())\nt = input()[:-1]\nif s == t:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"if eval(input()) == input()[:-1]:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":71.4285714286,"diff":["-s = eval(input())","-t = input()[:-1]","-if s == t:","+if eval(input()) == input()[:-1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0494748092,"measured_runtime_v1":0.0493951926,"runtime_lift":1.0016118276,"key":["s984226640","s555692003"]} +{"user_id":"u412563426","problem_id":"p03208","language":"python","submission_id_v0":"s463064539","submission_id_v1":"s743553013","cpu_time_v0":234,"cpu_time_v1":129,"memory_v0":7472,"memory_v1":7384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.87,"input":"# import sys\n\n# input = sys.stdin.readline\n\n\n\nn, k = list(map(int, input().split()))\n\nh = [0]*n\n\n\n\nfor i in range(n):\n\n h[i] = int(eval(input()))\n\n\n\nh.sort()\n\n\n\nans = 10**9\n\nfor i in range(n-k+1):\n\n temp = h[i+k-1] - h[i]\n\n if ans > temp:\n\n ans = temp\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nn, k = list(map(int, input().split()))\n\n\n\n# h = [0]*n\n\n# for i in range(n):\n\n# h[i] = int(input())\n\n\n\nh = [int(eval(input())) for _ in range(n)]\n\n\n\nh.sort()\n\n\n\nans = 10**9\n\nfor i in range(n-k+1):\n\n temp = h[i+k-1] - h[i]\n\n ans = min(ans, temp)\n\n\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":19,"code_v0_num_chars":267,"code_v1_num_chars":297,"code_v0_no_empty_lines":"# import sys\n# input = sys.stdin.readline\nn, k = list(map(int, input().split()))\nh = [0] * n\nfor i in range(n):\n h[i] = int(eval(input()))\nh.sort()\nans = 10**9\nfor i in range(n - k + 1):\n temp = h[i + k - 1] - h[i]\n if ans > temp:\n ans = temp\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, k = list(map(int, input().split()))\n# h = [0]*n\n# for i in range(n):\n# h[i] = int(input())\nh = [int(eval(input())) for _ in range(n)]\nh.sort()\nans = 10**9\nfor i in range(n - k + 1):\n temp = h[i + k - 1] - h[i]\n ans = min(ans, temp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-# import sys","-# input = sys.stdin.readline","+import sys","+","+input = sys.stdin.readline","-h = [0] * n","-for i in range(n):","- h[i] = int(eval(input()))","+# h = [0]*n","+# for i in range(n):","+# h[i] = int(input())","+h = [int(eval(input())) for _ in range(n)]","- if ans > temp:","- ans = temp","+ ans = min(ans, temp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373732065,"measured_runtime_v1":0.0431581615,"runtime_lift":0.8659591893,"key":["s463064539","s743553013"]} +{"user_id":"u297574184","problem_id":"p03044","language":"python","submission_id_v0":"s266250912","submission_id_v1":"s335594075","cpu_time_v0":753,"cpu_time_v1":487,"memory_v0":80156,"memory_v1":79388,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.33,"input":"import sys\n\nsys.setrecursionlimit(10**9)\n\n\n\nN = int(eval(input()))\n\nadjL = [[] for _ in range(N)]\n\nfor _ in range(N-1):\n\n u, v, w = list(map(int, input().split()))\n\n adjL[u-1].append((v-1, w))\n\n adjL[v-1].append((u-1, w))\n\n\n\ndef dfs(vNow):\n\n useds[vNow] = True\n\n ans = anss[vNow]\n\n for v2, wt in adjL[vNow]:\n\n if useds[v2]: continue\n\n if wt % 2: # \u9577\u3055\u304c\u5947\u6570\u306a\u3089\u3070\u3001\u8272\u3092\u53cd\u8ee2\n\n anss[v2] = 1-ans\n\n else:\n\n anss[v2] = ans\n\n dfs(v2)\n\n\n\nuseds = [False] * N\n\nanss = [0] * N\n\nanss[0] = 0\n\ndfs(0)\n\n\n\nprint(('\\n'.join(map(str, anss))))\n","target":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**9)\n\n\n\nN = int(eval(input()))\n\nadjL = [[] for _ in range(N)]\n\nfor _ in range(N-1):\n\n u, v, w = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n adjL[u].append((v, w))\n\n adjL[v].append((u, w))\n\n\n\ncolors = [0] * N\n\ndef dfs(vNow, vPar):\n\n color = colors[vNow]\n\n for v2, wt in adjL[vNow]:\n\n if v2 == vPar: continue\n\n if wt%2:\n\n colors[v2] = 1-color\n\n else:\n\n colors[v2] = color\n\n dfs(v2, vNow)\n\n\n\ndfs(0, -1)\n\n\n\nprint(('\\n'.join(map(str, colors))))\n","code_v0_loc":27,"code_v1_loc":26,"code_v0_num_chars":569,"code_v1_num_chars":566,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nN = int(eval(input()))\nadjL = [[] for _ in range(N)]\nfor _ in range(N - 1):\n u, v, w = list(map(int, input().split()))\n adjL[u - 1].append((v - 1, w))\n adjL[v - 1].append((u - 1, w))\n\n\ndef dfs(vNow):\n useds[vNow] = True\n ans = anss[vNow]\n for v2, wt in adjL[vNow]:\n if useds[v2]:\n continue\n if wt % 2: # \u9577\u3055\u304c\u5947\u6570\u306a\u3089\u3070\u3001\u8272\u3092\u53cd\u8ee2\n anss[v2] = 1 - ans\n else:\n anss[v2] = ans\n dfs(v2)\n\n\nuseds = [False] * N\nanss = [0] * N\nanss[0] = 0\ndfs(0)\nprint((\"\\n\".join(map(str, anss))))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**9)\nN = int(eval(input()))\nadjL = [[] for _ in range(N)]\nfor _ in range(N - 1):\n u, v, w = list(map(int, input().split()))\n u, v = u - 1, v - 1\n adjL[u].append((v, w))\n adjL[v].append((u, w))\ncolors = [0] * N\n\n\ndef dfs(vNow, vPar):\n color = colors[vNow]\n for v2, wt in adjL[vNow]:\n if v2 == vPar:\n continue\n if wt % 2:\n colors[v2] = 1 - color\n else:\n colors[v2] = color\n dfs(v2, vNow)\n\n\ndfs(0, -1)\nprint((\"\\n\".join(map(str, colors))))\n","code_same":false,"relative_loc_diff_percent":3.7037037037,"diff":["+input = sys.stdin.readline","- adjL[u - 1].append((v - 1, w))","- adjL[v - 1].append((u - 1, w))","+ u, v = u - 1, v - 1","+ adjL[u].append((v, w))","+ adjL[v].append((u, w))","+colors = [0] * N","-def dfs(vNow):","- useds[vNow] = True","- ans = anss[vNow]","+def dfs(vNow, vPar):","+ color = colors[vNow]","- if useds[v2]:","+ if v2 == vPar:","- if wt % 2: # \u9577\u3055\u304c\u5947\u6570\u306a\u3089\u3070\u3001\u8272\u3092\u53cd\u8ee2","- anss[v2] = 1 - ans","+ if wt % 2:","+ colors[v2] = 1 - color","- anss[v2] = ans","- dfs(v2)","+ colors[v2] = color","+ dfs(v2, vNow)","-useds = [False] * N","-anss = [0] * N","-anss[0] = 0","-dfs(0)","-print((\"\\n\".join(map(str, anss))))","+dfs(0, -1)","+print((\"\\n\".join(map(str, colors))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0635368402,"measured_runtime_v1":0.0834811415,"runtime_lift":0.7610921348,"key":["s266250912","s335594075"]} +{"user_id":"u572142121","problem_id":"p03680","language":"python","submission_id_v0":"s814855789","submission_id_v1":"s604696455","cpu_time_v0":228,"cpu_time_v1":195,"memory_v0":16556,"memory_v1":7084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.47,"input":"N=int(eval(input()))\n\nA=[((i+1),int(eval(input()))) for i in range(N)]\n\ncount = 0\n\nb=1\n\nfor i in range(N+1):\n\n b = A[b-1][1]\n\n count+= 1\n\n if b==2:\n\n print(count)\n\n break\n\nif count == N+1:\n\n print((-1))\n\n ","target":"N=int(eval(input()))\n\nA=[(int(eval(input()))) for i in range(N)]\n\ncount = 0\n\nb=1\n\nfor i in range(N+1):\n\n b = A[b-1]\n\n count+= 1\n\n if b==2:\n\n print(count)\n\n break\n\nif count == N+1:\n\n print((-1))","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":204,"code_v1_num_chars":189,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [((i + 1), int(eval(input()))) for i in range(N)]\ncount = 0\nb = 1\nfor i in range(N + 1):\n b = A[b - 1][1]\n count += 1\n if b == 2:\n print(count)\n break\nif count == N + 1:\n print((-1))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [(int(eval(input()))) for i in range(N)]\ncount = 0\nb = 1\nfor i in range(N + 1):\n b = A[b - 1]\n count += 1\n if b == 2:\n print(count)\n break\nif count == N + 1:\n print((-1))\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-A = [((i + 1), int(eval(input()))) for i in range(N)]","+A = [(int(eval(input()))) for i in range(N)]","- b = A[b - 1][1]","+ b = A[b - 1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0458131886,"measured_runtime_v1":0.0450566688,"runtime_lift":1.0167904065,"key":["s814855789","s604696455"]} +{"user_id":"u467175809","problem_id":"p02388","language":"python","submission_id_v0":"s268959168","submission_id_v1":"s244498899","cpu_time_v0":10,"cpu_time_v1":0,"memory_v0":4620,"memory_v1":4628,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":100.0,"input":"print(input() ** 3)\n","target":"x = eval(input())\n\nprint(x * x * x)\n","code_v0_loc":1,"code_v1_loc":2,"code_v0_num_chars":19,"code_v1_num_chars":29,"code_v0_no_empty_lines":"print(input() ** 3)\n","code_v1_no_empty_lines":"x = eval(input())\nprint(x * x * x)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-print(input() ** 3)","+x = eval(input())","+print(x * x * x)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0475053787,"measured_runtime_v1":0.0447796822,"runtime_lift":1.0608690464,"key":["s268959168","s244498899"]} +{"user_id":"u958693198","problem_id":"p02850","language":"python","submission_id_v0":"s684439484","submission_id_v1":"s437113442","cpu_time_v0":456,"cpu_time_v1":376,"memory_v0":82308,"memory_v1":28984,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.54,"input":"import sys\n\nfrom collections import deque\n\ninput = sys.stdin.readline\n\nN = int(eval(input()))\n\nX = [deque() for _ in range(N)]\n\nP = [-1] * N\n\nfor i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n X[a-1].append((i, b-1))\n\n #print(X)\n\n #P[b-1] = a-1\n\n#print(X)\n\n\n\nQ = deque([(0, -1)])\n\nANS = [-1] * (N-1)\n\ncmax = 0\n\nwhile Q:\n\n x, c0 = Q.pop()\n\n c = 1\n\n for i, y in X[x]:\n\n if c == c0: c += 1\n\n ANS[i] = c\n\n Q.appendleft((y, c))\n\n c += 1\n\n cmax = max(cmax, c-1)\n\n\n\nprint(cmax)\n\nfor ans in ANS:\n\n print(ans)","target":"import sys\n\nfrom collections import deque\n\ninput = sys.stdin.readline\n\nN = int(eval(input()))\n\nX = [[] for _ in range(N)]\n\nP = [-1] * N\n\nfor i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n X[a-1].append((i, b-1))\n\n #print(X)\n\n #P[b-1] = a-1\n\n#print(X)\n\n\n\nQ = deque([(0, -1)])\n\nANS = [-1] * (N-1)\n\ncmax = 0\n\nwhile Q:\n\n x, c0 = Q.pop()\n\n c = 1\n\n for i, y in X[x]:\n\n if c == c0: c += 1\n\n ANS[i] = c\n\n Q.appendleft((y, c))\n\n c += 1\n\n cmax = max(cmax, c-1)\n\n\n\nprint(cmax)\n\nfor ans in ANS:\n\n print(ans)","code_v0_loc":29,"code_v1_loc":29,"code_v0_num_chars":556,"code_v1_num_chars":551,"code_v0_no_empty_lines":"import sys\nfrom collections import deque\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nX = [deque() for _ in range(N)]\nP = [-1] * N\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n X[a - 1].append((i, b - 1))\n # print(X)\n # P[b-1] = a-1\n# print(X)\nQ = deque([(0, -1)])\nANS = [-1] * (N - 1)\ncmax = 0\nwhile Q:\n x, c0 = Q.pop()\n c = 1\n for i, y in X[x]:\n if c == c0:\n c += 1\n ANS[i] = c\n Q.appendleft((y, c))\n c += 1\n cmax = max(cmax, c - 1)\nprint(cmax)\nfor ans in ANS:\n print(ans)\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nX = [[] for _ in range(N)]\nP = [-1] * N\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n X[a - 1].append((i, b - 1))\n # print(X)\n # P[b-1] = a-1\n# print(X)\nQ = deque([(0, -1)])\nANS = [-1] * (N - 1)\ncmax = 0\nwhile Q:\n x, c0 = Q.pop()\n c = 1\n for i, y in X[x]:\n if c == c0:\n c += 1\n ANS[i] = c\n Q.appendleft((y, c))\n c += 1\n cmax = max(cmax, c - 1)\nprint(cmax)\nfor ans in ANS:\n print(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-X = [deque() for _ in range(N)]","+X = [[] for _ in range(N)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0498450987,"measured_runtime_v1":0.04977549,"runtime_lift":1.0013984529,"key":["s684439484","s437113442"]} +{"user_id":"u325119213","problem_id":"p02958","language":"python","submission_id_v0":"s611598391","submission_id_v1":"s634855147","cpu_time_v0":112,"cpu_time_v1":17,"memory_v0":3444,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.82,"input":"import copy\n\n\n\n\n\ndef actual(n, P):\n\n nums_asc = sorted(P)\n\n\n\n if nums_asc == P:\n\n return 'YES'\n\n\n\n N = len(P)\n\n for i in range(N):\n\n for j in range(1, N):\n\n swapped_nums = copy.deepcopy(P)\n\n\n\n swapped_nums[i] = P[j]\n\n swapped_nums[j] = P[i]\n\n\n\n if swapped_nums == nums_asc:\n\n return 'YES'\n\n\n\n return 'NO'\n\n\n\nn = int(eval(input()))\n\nP = list(map(int, input().split()))\n\n\n\nprint((actual(n, P)))","target":"def actual(n, P):\n\n # \u6b63\u3057\u304f\u306a\u3044\u914d\u7f6e\u306b\u3042\u308b\u6570\u5b57\u304c2\u3064\u4ee5\u4e0b\u306a\u3089\u30011\u56de\u4ee5\u4e0b\u306eSwap\u3067\u7167\u6e96\u306b\u306a\u308b\n\n n_unmatched = [i == p for i, p in enumerate(P, start=1)].count(False)\n\n\n\n if n_unmatched <= 2:\n\n return 'YES'\n\n\n\n return 'NO'\n\n\n\n\n\nn = int(eval(input()))\n\nP = list(map(int, input().split()))\n\n\n\nprint((actual(n, P)))","code_v0_loc":26,"code_v1_loc":14,"code_v0_num_chars":472,"code_v1_num_chars":286,"code_v0_no_empty_lines":"import copy\n\n\ndef actual(n, P):\n nums_asc = sorted(P)\n if nums_asc == P:\n return \"YES\"\n N = len(P)\n for i in range(N):\n for j in range(1, N):\n swapped_nums = copy.deepcopy(P)\n swapped_nums[i] = P[j]\n swapped_nums[j] = P[i]\n if swapped_nums == nums_asc:\n return \"YES\"\n return \"NO\"\n\n\nn = int(eval(input()))\nP = list(map(int, input().split()))\nprint((actual(n, P)))\n","code_v1_no_empty_lines":"def actual(n, P):\n # \u6b63\u3057\u304f\u306a\u3044\u914d\u7f6e\u306b\u3042\u308b\u6570\u5b57\u304c2\u3064\u4ee5\u4e0b\u306a\u3089\u30011\u56de\u4ee5\u4e0b\u306eSwap\u3067\u7167\u6e96\u306b\u306a\u308b\n n_unmatched = [i == p for i, p in enumerate(P, start=1)].count(False)\n if n_unmatched <= 2:\n return \"YES\"\n return \"NO\"\n\n\nn = int(eval(input()))\nP = list(map(int, input().split()))\nprint((actual(n, P)))\n","code_same":false,"relative_loc_diff_percent":46.1538461538,"diff":["-import copy","-","-","- nums_asc = sorted(P)","- if nums_asc == P:","+ # \u6b63\u3057\u304f\u306a\u3044\u914d\u7f6e\u306b\u3042\u308b\u6570\u5b57\u304c2\u3064\u4ee5\u4e0b\u306a\u3089\u30011\u56de\u4ee5\u4e0b\u306eSwap\u3067\u7167\u6e96\u306b\u306a\u308b","+ n_unmatched = [i == p for i, p in enumerate(P, start=1)].count(False)","+ if n_unmatched <= 2:","- N = len(P)","- for i in range(N):","- for j in range(1, N):","- swapped_nums = copy.deepcopy(P)","- swapped_nums[i] = P[j]","- swapped_nums[j] = P[i]","- if swapped_nums == nums_asc:","- return \"YES\""],"diff_only_import_comment":false,"measured_runtime_v0":0.0583649845,"measured_runtime_v1":0.0522684767,"runtime_lift":1.1166383288,"key":["s611598391","s634855147"]} +{"user_id":"u620868411","problem_id":"p03304","language":"python","submission_id_v0":"s910600077","submission_id_v1":"s498840188","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"# -*- coding: utf-8 -*-\n\nfrom math import log2\n\n\n\nline = list(map(int, input().split(\" \")))\n\nn = line[0]\n\nm = line[1]\n\nd = line[2]\n\n\n\nif 2*d0:\n\n ret1 = 1+(m-2)*log2(n)\n\n ret2 = log2(n-d)\n\n ret3 = log2(m-1)\n\n ret4 = m*log2(n)\n\n print((2**(ret1+ret2+ret3-ret4)))\n\nelse:\n\n ret1 = (m-1)*log2(n)\n\n ret2 = log2(m-1)\n\n ret3 = m*log2(n)\n\n print((2**(ret1+ret2-ret3)))\n","target":"n,m,d = list(map(int, input().split()))\n\n\n\nif d == 0:\n\n print(((m-1)\/n))\n\nelse:\n\n print((2*(n-d)*(m-1)\/n\/n))","code_v0_loc":19,"code_v1_loc":6,"code_v0_num_chars":392,"code_v1_num_chars":104,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nfrom math import log2\n\nline = list(map(int, input().split(\" \")))\nn = line[0]\nm = line[1]\nd = line[2]\nif 2 * d < n and d > 0:\n ret1 = 1 + (m - 2) * log2(n)\n ret2 = log2(n - d)\n ret3 = log2(m - 1)\n ret4 = m * log2(n)\n print((2 ** (ret1 + ret2 + ret3 - ret4)))\nelse:\n ret1 = (m - 1) * log2(n)\n ret2 = log2(m - 1)\n ret3 = m * log2(n)\n print((2 ** (ret1 + ret2 - ret3)))\n","code_v1_no_empty_lines":"n, m, d = list(map(int, input().split()))\nif d == 0:\n print(((m - 1) \/ n))\nelse:\n print((2 * (n - d) * (m - 1) \/ n \/ n))\n","code_same":false,"relative_loc_diff_percent":68.4210526316,"diff":["-# -*- coding: utf-8 -*-","-from math import log2","-","-line = list(map(int, input().split(\" \")))","-n = line[0]","-m = line[1]","-d = line[2]","-if 2 * d < n and d > 0:","- ret1 = 1 + (m - 2) * log2(n)","- ret2 = log2(n - d)","- ret3 = log2(m - 1)","- ret4 = m * log2(n)","- print((2 ** (ret1 + ret2 + ret3 - ret4)))","+n, m, d = list(map(int, input().split()))","+if d == 0:","+ print(((m - 1) \/ n))","- ret1 = (m - 1) * log2(n)","- ret2 = log2(m - 1)","- ret3 = m * log2(n)","- print((2 ** (ret1 + ret2 - ret3)))","+ print((2 * (n - d) * (m - 1) \/ n \/ n))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0677752925,"measured_runtime_v1":0.0666913892,"runtime_lift":1.0162525225,"key":["s910600077","s498840188"]} +{"user_id":"u456353530","problem_id":"p02761","language":"python","submission_id_v0":"s566976056","submission_id_v1":"s431491697","cpu_time_v0":172,"cpu_time_v1":18,"memory_v0":38256,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.53,"input":"N, M = list(map(int, input().split()))\n\nsc = [list(map(int, input().split())) for _ in range(M)]\n\n\n\nL = [-1] * N\n\n\n\nfor s, c in sc:\n\n s -= 1\n\n if L[s] == -1:\n\n L[s] = c\n\n else:\n\n if L[s] != c:\n\n print((-1))\n\n exit()\n\n\n\nif N == 1:\n\n if L[0] == -1:\n\n print((0))\n\n else:\n\n print((L[0]))\n\nelse:\n\n if L[0] == 0:\n\n print((-1))\n\n exit()\n\n if L[0] == -1:\n\n ans = 1\n\n else:\n\n ans = L[0]\n\n for i in range(1, N):\n\n ans *= 10\n\n if L[i] != -1:\n\n ans += L[i]\n\n print(ans)\n","target":"N, M = list(map(int, input().split()))\n\nsc = [list(map(int, input().split())) for _ in range(M)]\n\n\n\nt = 10 ** (N - 1)\n\ne = t * 10\n\nif N == 1:\n\n t = 0\n\n\n\nfor i in range(t, e):\n\n k = list(str(i))\n\n for s, c in sc:\n\n if int(k[s - 1]) != c:\n\n break\n\n else:\n\n print(i)\n\n exit()\n\nprint((-1))\n","code_v0_loc":32,"code_v1_loc":17,"code_v0_num_chars":505,"code_v1_num_chars":302,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nsc = [list(map(int, input().split())) for _ in range(M)]\nL = [-1] * N\nfor s, c in sc:\n s -= 1\n if L[s] == -1:\n L[s] = c\n else:\n if L[s] != c:\n print((-1))\n exit()\nif N == 1:\n if L[0] == -1:\n print((0))\n else:\n print((L[0]))\nelse:\n if L[0] == 0:\n print((-1))\n exit()\n if L[0] == -1:\n ans = 1\n else:\n ans = L[0]\n for i in range(1, N):\n ans *= 10\n if L[i] != -1:\n ans += L[i]\n print(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nsc = [list(map(int, input().split())) for _ in range(M)]\nt = 10 ** (N - 1)\ne = t * 10\nif N == 1:\n t = 0\nfor i in range(t, e):\n k = list(str(i))\n for s, c in sc:\n if int(k[s - 1]) != c:\n break\n else:\n print(i)\n exit()\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":46.875,"diff":["-L = [-1] * N","-for s, c in sc:","- s -= 1","- if L[s] == -1:","- L[s] = c","+t = 10 ** (N - 1)","+e = t * 10","+if N == 1:","+ t = 0","+for i in range(t, e):","+ k = list(str(i))","+ for s, c in sc:","+ if int(k[s - 1]) != c:","+ break","- if L[s] != c:","- print((-1))","- exit()","-if N == 1:","- if L[0] == -1:","- print((0))","- else:","- print((L[0]))","-else:","- if L[0] == 0:","- print((-1))","+ print(i)","- if L[0] == -1:","- ans = 1","- else:","- ans = L[0]","- for i in range(1, N):","- ans *= 10","- if L[i] != -1:","- ans += L[i]","- print(ans)","+print((-1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0410408583,"measured_runtime_v1":0.0365100098,"runtime_lift":1.1240988025,"key":["s566976056","s431491697"]} +{"user_id":"u670180528","problem_id":"p02696","language":"python","submission_id_v0":"s802786570","submission_id_v1":"s299908931","cpu_time_v0":56,"cpu_time_v1":20,"memory_v0":61848,"memory_v1":9008,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.29,"input":"x, y, z = list(map(int, input().split()))\n\nif y - 1 >= z:\n\n\tprint(((x * z) \/\/ y - x * (z \/\/ y)))\n\nelse:\n\n\tw = (z \/\/ y) * y - 1\n\n\tprint((max((x * w) \/\/ y - x * (w \/\/ y), (x * z) \/\/ y - x * (z \/\/ y))))\n","target":"a,b,n=list(map(int,input().split()))\n\nf=lambda x:(a*x)\/\/b-a*(x\/\/b)\n\nprint((f(min(b-1,n))))","code_v0_loc":6,"code_v1_loc":3,"code_v0_num_chars":190,"code_v1_num_chars":82,"code_v0_no_empty_lines":"x, y, z = list(map(int, input().split()))\nif y - 1 >= z:\n print(((x * z) \/\/ y - x * (z \/\/ y)))\nelse:\n w = (z \/\/ y) * y - 1\n print((max((x * w) \/\/ y - x * (w \/\/ y), (x * z) \/\/ y - x * (z \/\/ y))))\n","code_v1_no_empty_lines":"a, b, n = list(map(int, input().split()))\nf = lambda x: (a * x) \/\/ b - a * (x \/\/ b)\nprint((f(min(b - 1, n))))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-x, y, z = list(map(int, input().split()))","-if y - 1 >= z:","- print(((x * z) \/\/ y - x * (z \/\/ y)))","-else:","- w = (z \/\/ y) * y - 1","- print((max((x * w) \/\/ y - x * (w \/\/ y), (x * z) \/\/ y - x * (z \/\/ y))))","+a, b, n = list(map(int, input().split()))","+f = lambda x: (a * x) \/\/ b - a * (x \/\/ b)","+print((f(min(b - 1, n))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369591104,"measured_runtime_v1":0.0342241792,"runtime_lift":1.0799122516,"key":["s802786570","s299908931"]} +{"user_id":"u499381410","problem_id":"p03453","language":"python","submission_id_v0":"s940630419","submission_id_v1":"s062122482","cpu_time_v0":1514,"cpu_time_v1":995,"memory_v0":120224,"memory_v1":132884,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.28,"input":"from collections import defaultdict, deque, Counter\n\nfrom heapq import heappush, heappop, heapify\n\nimport math\n\nimport bisect\n\nimport random\n\nfrom itertools import permutations, accumulate, combinations, product\n\nimport sys\n\nimport string\n\nfrom bisect import bisect_left, bisect_right\n\nfrom math import factorial, ceil, floor\n\nfrom functools import reduce\n\n\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = 10 ** 15\n\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\n\ndef I(): return int(sys.stdin.buffer.readline())\n\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\n\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\n\ndef IR(n): return [I() for i in range(n)]\n\ndef LIR(n): return [LI() for i in range(n)]\n\ndef SR(n): return [S() for i in range(n)]\n\ndef LSR(n): return [LS() for i in range(n)]\n\ndef SRL(n): return [list(S()) for i in range(n)]\n\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\n\nmod = 1000000007\n\n\n\n\n\nn, m = LI()\n\ns, t = LI()\n\nG = [[] for _ in range(n)]\n\nfor i in range(m):\n\n a, b, c = LI()\n\n G[a - 1] += [(b - 1, c)]\n\n G[b - 1] += [(a - 1, c)]\n\n\n\n\n\ndef dijkstra(graph, start=0):\n\n route_cnt = [start] * n\n\n route_cnt[start] = 1\n\n que = [(0, start)]\n\n dist = [INF] * n\n\n dist[start] = 0\n\n while que:\n\n min_dist, u = heappop(que)\n\n if min_dist > dist[u]:\n\n continue\n\n for v, c in graph[u]:\n\n if dist[u] + c < dist[v]:\n\n dist[v] = dist[u] + c\n\n route_cnt[v] = route_cnt[u]\n\n heappush(que, (dist[u] + c , v))\n\n elif dist[u] + c == dist[v]:\n\n route_cnt[v] = (route_cnt[v] + route_cnt[u]) % mod\n\n return route_cnt, dist\n\n\n\n\n\nroute_cnt, dist = dijkstra(G, s - 1)\n\nr_route_cnt, r_dist = dijkstra(G, t - 1)\n\ntotal_dist = dist[t - 1]\n\nret = 0\n\nfor i in range(n):\n\n if dist[i] == r_dist[i]:\n\n ret = ret + (route_cnt[i] * r_route_cnt[i] % mod) ** 2 % mod\n\n\n\n\n\nfor u in range(n):\n\n for v, c in G[u]:\n\n if dist[u] < total_dist \/ 2 < dist[v] and dist[u] + c + r_dist[v] == total_dist:\n\n ret = (ret + route_cnt[u] ** 2 % mod * r_route_cnt[v] ** 2 % mod) % mod\n\n\n\n\n\nprint(((route_cnt[t - 1] ** 2 - ret) % mod))","target":"from collections import defaultdict, deque, Counter\n\nfrom heapq import heappush, heappop, heapify\n\nimport math\n\nfrom bisect import bisect_left, bisect_right\n\nimport random\n\nfrom itertools import permutations, accumulate, combinations\n\nimport sys\n\nimport string\n\nfrom copy import deepcopy\n\n\n\nINF = 10 ** 20\n\n\n\n\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS(): return sys.stdin.readline().split()\n\ndef S(): return sys.stdin.readline().strip()\n\ndef IR(n): return [I() for i in range(n)]\n\ndef LIR(n): return [LI() for i in range(n)]\n\ndef SR(n): return [S() for i in range(n)]\n\ndef LSR(n): return [LS() for i in range(n)]\n\ndef SRL(n): return [list(S()) for i in range(n)]\n\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\n\nmod = 10 ** 9 + 7\n\n\n\ndef dijkstra(s):\n\n hq=[(0,s)]\n\n dist=[INF]*n\n\n dp=[0]*n\n\n dp[s]=1\n\n dist[s]=0\n\n checked=[0]*n\n\n while hq:\n\n min_dist,u=heappop(hq)\n\n if checked[u]:\n\n continue\n\n checked[u]=1\n\n for v,c in G[u]:\n\n if dist[u]+c dist[u]:\n continue\n for v, c in graph[u]:\n if dist[u] + c < dist[v]:\n dist[v] = dist[u] + c\n route_cnt[v] = route_cnt[u]\n heappush(que, (dist[u] + c, v))\n elif dist[u] + c == dist[v]:\n route_cnt[v] = (route_cnt[v] + route_cnt[u]) % mod\n return route_cnt, dist\n\n\nroute_cnt, dist = dijkstra(G, s - 1)\nr_route_cnt, r_dist = dijkstra(G, t - 1)\ntotal_dist = dist[t - 1]\nret = 0\nfor i in range(n):\n if dist[i] == r_dist[i]:\n ret = ret + (route_cnt[i] * r_route_cnt[i] % mod) ** 2 % mod\nfor u in range(n):\n for v, c in G[u]:\n if dist[u] < total_dist \/ 2 < dist[v] and dist[u] + c + r_dist[v] == total_dist:\n ret = (ret + route_cnt[u] ** 2 % mod * r_route_cnt[v] ** 2 % mod) % mod\nprint(((route_cnt[t - 1] ** 2 - ret) % mod))\n","code_v1_no_empty_lines":"from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nfrom bisect import bisect_left, bisect_right\nimport random\nfrom itertools import permutations, accumulate, combinations\nimport sys\nimport string\nfrom copy import deepcopy\n\nINF = 10**20\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef S():\n return sys.stdin.readline().strip()\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\ndef SRL(n):\n return [list(S()) for i in range(n)]\n\n\ndef MSRL(n):\n return [[int(j) for j in list(S())] for i in range(n)]\n\n\nmod = 10**9 + 7\n\n\ndef dijkstra(s):\n hq = [(0, s)]\n dist = [INF] * n\n dp = [0] * n\n dp[s] = 1\n dist[s] = 0\n checked = [0] * n\n while hq:\n min_dist, u = heappop(hq)\n if checked[u]:\n continue\n checked[u] = 1\n for v, c in G[u]:\n if dist[u] + c < dist[v]:\n dist[v] = dist[u] + c\n dp[v] = dp[u]\n heappush(hq, (dist[v], v))\n elif dist[u] + c == dist[v]:\n dp[v] += dp[u]\n dp[v] %= mod\n return dp, dist\n\n\nn, m = LI()\ns, t = LI()\nG = [[] for _ in range(n)]\nfor _ in range(m):\n a, b, d = LI()\n G[a - 1] += [(b - 1, d)]\n G[b - 1] += [(a - 1, d)]\ndp1, dist1 = dijkstra(s - 1)\ndp2, dist2 = dijkstra(t - 1)\ntotal = dist1[t - 1]\nans = dp1[t - 1] * dp2[s - 1] % mod\nfor i in range(n):\n if dist1[i] == dist2[i] == total \/ 2:\n ans -= pow(dp1[i] * dp2[i] % mod, 2, mod)\nfor j in range(n):\n for k, ci in G[j]:\n if (\n dist1[j] + dist2[k] + ci == total\n and dist1[j] < total \/ 2\n and dist2[k] < total \/ 2\n ):\n ans -= pow(dp1[j] * dp2[k] % mod, 2, mod)\nprint((ans % mod))\n","code_same":false,"relative_loc_diff_percent":2.6666666667,"diff":["-import bisect","+from bisect import bisect_left, bisect_right","-from itertools import permutations, accumulate, combinations, product","+from itertools import permutations, accumulate, combinations","-from bisect import bisect_left, bisect_right","-from math import factorial, ceil, floor","-from functools import reduce","+from copy import deepcopy","-sys.setrecursionlimit(2147483647)","-INF = 10**15","+INF = 10**20","- return list(map(int, sys.stdin.buffer.readline().split()))","+ return list(map(int, sys.stdin.readline().split()))","- return int(sys.stdin.buffer.readline())","+ return int(sys.stdin.readline())","- return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\").split()","+ return sys.stdin.readline().split()","- return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")","+ return sys.stdin.readline().strip()","-mod = 1000000007","+mod = 10**9 + 7","+","+","+def dijkstra(s):","+ hq = [(0, s)]","+ dist = [INF] * n","+ dp = [0] * n","+ dp[s] = 1","+ dist[s] = 0","+ checked = [0] * n","+ while hq:","+ min_dist, u = heappop(hq)","+ if checked[u]:","+ continue","+ checked[u] = 1","+ for v, c in G[u]:","+ if dist[u] + c < dist[v]:","+ dist[v] = dist[u] + c","+ dp[v] = dp[u]","+ heappush(hq, (dist[v], v))","+ elif dist[u] + c == dist[v]:","+ dp[v] += dp[u]","+ dp[v] %= mod","+ return dp, dist","+","+","-for i in range(m):","- a, b, c = LI()","- G[a - 1] += [(b - 1, c)]","- G[b - 1] += [(a - 1, c)]","-","-","-def dijkstra(graph, start=0):","- route_cnt = [start] * n","- route_cnt[start] = 1","- que = [(0, start)]","- dist = [INF] * n","- dist[start] = 0","- while que:","- min_dist, u = heappop(que)","- if min_dist > dist[u]:","- continue","- for v, c in graph[u]:","- if dist[u] + c < dist[v]:","- dist[v] = dist[u] + c","- route_cnt[v] = route_cnt[u]","- heappush(que, (dist[u] + c, v))","- elif dist[u] + c == dist[v]:","- route_cnt[v] = (route_cnt[v] + route_cnt[u]) % mod","- return route_cnt, dist","-","-","-route_cnt, dist = dijkstra(G, s - 1)","-r_route_cnt, r_dist = dijkstra(G, t - 1)","-total_dist = dist[t - 1]","-ret = 0","+for _ in range(m):","+ a, b, d = LI()","+ G[a - 1] += [(b - 1, d)]","+ G[b - 1] += [(a - 1, d)]","+dp1, dist1 = dijkstra(s - 1)","+dp2, dist2 = dijkstra(t - 1)","+total = dist1[t - 1]","+ans = dp1[t - 1] * dp2[s - 1] % mod","- if dist[i] == r_dist[i]:","- ret = ret + (route_cnt[i] * r_route_cnt[i] % mod) ** 2 % mod","-for u in range(n):","- for v, c in G[u]:","- if dist[u] < total_dist \/ 2 < dist[v] and dist[u] + c + r_dist[v] == total_dist:","- ret = (ret + route_cnt[u] ** 2 % mod * r_route_cnt[v] ** 2 % mod) % mod","-print(((route_cnt[t - 1] ** 2 - ret) % mod))","+ if dist1[i] == dist2[i] == total \/ 2:","+ ans -= pow(dp1[i] * dp2[i] % mod, 2, mod)","+for j in range(n):","+ for k, ci in G[j]:","+ if (","+ dist1[j] + dist2[k] + ci == total","+ and dist1[j] < total \/ 2","+ and dist2[k] < total \/ 2","+ ):","+ ans -= pow(dp1[j] * dp2[k] % mod, 2, mod)","+print((ans % mod))"],"diff_only_import_comment":false,"measured_runtime_v0":0.180666465,"measured_runtime_v1":0.0375981805,"runtime_lift":4.8051916991,"key":["s940630419","s062122482"]} +{"user_id":"u514118270","problem_id":"p02996","language":"python","submission_id_v0":"s316455087","submission_id_v1":"s344296814","cpu_time_v0":1543,"cpu_time_v1":828,"memory_v0":66264,"memory_v1":105640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.34,"input":"from collections import deque\n\nN = int(eval(input()))\n\nA = deque()\n\nfor _ in range(N):\n\n a,b = list(map(int,input().split()))\n\n A.append([b,a])\n\nA = list(A)\n\nA.sort()\n\ntime = 0\n\nfor i in A:\n\n time += i[1]\n\n if time > i[0]:\n\n print('No')\n\n exit()\n\nprint('Yes')","target":"import sys\n\nimport math\n\nimport itertools\n\nimport bisect\n\nfrom copy import copy\n\nfrom collections import deque,Counter\n\nfrom decimal import Decimal\n\ndef s(): return eval(input())\n\ndef i(): return int(eval(input()))\n\ndef S(): return input().split()\n\ndef I(): return list(map(int,input().split()))\n\ndef L(): return list(map(int,input().split()))\n\ndef l(): return list(map(int,input().split()))\n\ndef lcm(a,b): return a*b\/\/math.gcd(a,b)\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 10**9\n\nmod = 10**9+7\n\n\n\nN = i()\n\nL = []\n\nfor i in range(N):\n\n A,B = I()\n\n L.append([B,A])\n\nL.sort()\n\ncnt = 0\n\nfor i in range(N):\n\n cnt += L[i][1]\n\n if cnt > L[i][0]:\n\n print('No')\n\n exit()\n\nprint('Yes')","code_v0_loc":15,"code_v1_loc":31,"code_v0_num_chars":279,"code_v1_num_chars":682,"code_v0_no_empty_lines":"from collections import deque\n\nN = int(eval(input()))\nA = deque()\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n A.append([b, a])\nA = list(A)\nA.sort()\ntime = 0\nfor i in A:\n time += i[1]\n if time > i[0]:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"import sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque, Counter\nfrom decimal import Decimal\n\n\ndef s():\n return eval(input())\n\n\ndef i():\n return int(eval(input()))\n\n\ndef S():\n return input().split()\n\n\ndef I():\n return list(map(int, input().split()))\n\n\ndef L():\n return list(map(int, input().split()))\n\n\ndef l():\n return list(map(int, input().split()))\n\n\ndef lcm(a, b):\n return a * b \/\/ math.gcd(a, b)\n\n\nsys.setrecursionlimit(10**9)\nINF = 10**9\nmod = 10**9 + 7\nN = i()\nL = []\nfor i in range(N):\n A, B = I()\n L.append([B, A])\nL.sort()\ncnt = 0\nfor i in range(N):\n cnt += L[i][1]\n if cnt > L[i][0]:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":51.6129032258,"diff":["-from collections import deque","+import sys","+import math","+import itertools","+import bisect","+from copy import copy","+from collections import deque, Counter","+from decimal import Decimal","-N = int(eval(input()))","-A = deque()","-for _ in range(N):","- a, b = list(map(int, input().split()))","- A.append([b, a])","-A = list(A)","-A.sort()","-time = 0","-for i in A:","- time += i[1]","- if time > i[0]:","+","+def s():","+ return eval(input())","+","+","+def i():","+ return int(eval(input()))","+","+","+def S():","+ return input().split()","+","+","+def I():","+ return list(map(int, input().split()))","+","+","+def L():","+ return list(map(int, input().split()))","+","+","+def l():","+ return list(map(int, input().split()))","+","+","+def lcm(a, b):","+ return a * b \/\/ math.gcd(a, b)","+","+","+sys.setrecursionlimit(10**9)","+INF = 10**9","+mod = 10**9 + 7","+N = i()","+L = []","+for i in range(N):","+ A, B = I()","+ L.append([B, A])","+L.sort()","+cnt = 0","+for i in range(N):","+ cnt += L[i][1]","+ if cnt > L[i][0]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1071012681,"measured_runtime_v1":0.0381805227,"runtime_lift":2.8051283876,"key":["s316455087","s344296814"]} +{"user_id":"u497596438","problem_id":"p03805","language":"python","submission_id_v0":"s737013252","submission_id_v1":"s780040208","cpu_time_v0":288,"cpu_time_v1":200,"memory_v0":43244,"memory_v1":39920,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.56,"input":"import itertools\n\n\n\nN,M=list(map(int,input().split()))\n\nab=[]\n\nfor i in range(M):\n\n a,b=list(map(int,input().split()))\n\n ab.append([a,b])\n\n\n\nper=[i for i in range(2,N+1)]\n\npermu=[]\n\nfor i in itertools.permutations(per):\n\n lst=[1]\n\n lst.extend(i)\n\n permu.append(lst)\n\nnum=0\n\nfor lst in permu:\n\n can=True\n\n for i in range(N-1):\n\n if not([lst[i],lst[i+1]] in ab) and not([lst[i+1],lst[i]] in ab):\n\n can=False\n\n break\n\n if can:\n\n num+=1\n\nprint(num)\n","target":"from itertools import permutations\n\nfrom heapq import *\n\nfrom collections import defaultdict\n\nfrom math import log\n\nfrom itertools import accumulate\n\nfrom collections import deque\n\n#maxv=[0]\n\nimport sys\n\nsys.setrecursionlimit(100100)\n\n\n\nimport math\n\nfrom math import ceil\n\nfrom copy import deepcopy\n\n\n\n\n\nN,M=list(map(int,input().split()))\n\nT=[[] for i in range(N)]\n\nfor i in range(M):\n\n u,v=list(map(int,input().split()))\n\n u,v=u-1,v-1\n\n T[u].append(v)\n\n T[v].append(u)\n\nlist=list(range(1,N))\n\nans=0\n\nfor l in permutations(list):\n\n t=True\n\n for i in range(N-1):\n\n if i==0:\n\n if not l[0] in T[0]:\n\n t=False\n\n break\n\n else:\n\n if not l[i] in T[l[i-1]]:\n\n t=False\n\n break\n\n if t:\n\n ans+=1\n\nprint(ans)\n","code_v0_loc":24,"code_v1_loc":38,"code_v0_num_chars":493,"code_v1_num_chars":809,"code_v0_no_empty_lines":"import itertools\n\nN, M = list(map(int, input().split()))\nab = []\nfor i in range(M):\n a, b = list(map(int, input().split()))\n ab.append([a, b])\nper = [i for i in range(2, N + 1)]\npermu = []\nfor i in itertools.permutations(per):\n lst = [1]\n lst.extend(i)\n permu.append(lst)\nnum = 0\nfor lst in permu:\n can = True\n for i in range(N - 1):\n if not ([lst[i], lst[i + 1]] in ab) and not ([lst[i + 1], lst[i]] in ab):\n can = False\n break\n if can:\n num += 1\nprint(num)\n","code_v1_no_empty_lines":"from itertools import permutations\nfrom heapq import *\nfrom collections import defaultdict\nfrom math import log\nfrom itertools import accumulate\nfrom collections import deque\n\n# maxv=[0]\nimport sys\n\nsys.setrecursionlimit(100100)\nimport math\nfrom math import ceil\nfrom copy import deepcopy\n\nN, M = list(map(int, input().split()))\nT = [[] for i in range(N)]\nfor i in range(M):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n T[u].append(v)\n T[v].append(u)\nlist = list(range(1, N))\nans = 0\nfor l in permutations(list):\n t = True\n for i in range(N - 1):\n if i == 0:\n if not l[0] in T[0]:\n t = False\n break\n else:\n if not l[i] in T[l[i - 1]]:\n t = False\n break\n if t:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":36.8421052632,"diff":["-import itertools","+from itertools import permutations","+from heapq import *","+from collections import defaultdict","+from math import log","+from itertools import accumulate","+from collections import deque","+","+# maxv=[0]","+import sys","+","+sys.setrecursionlimit(100100)","+import math","+from math import ceil","+from copy import deepcopy","-ab = []","+T = [[] for i in range(N)]","- a, b = list(map(int, input().split()))","- ab.append([a, b])","-per = [i for i in range(2, N + 1)]","-permu = []","-for i in itertools.permutations(per):","- lst = [1]","- lst.extend(i)","- permu.append(lst)","-num = 0","-for lst in permu:","- can = True","+ u, v = list(map(int, input().split()))","+ u, v = u - 1, v - 1","+ T[u].append(v)","+ T[v].append(u)","+list = list(range(1, N))","+ans = 0","+for l in permutations(list):","+ t = True","- if not ([lst[i], lst[i + 1]] in ab) and not ([lst[i + 1], lst[i]] in ab):","- can = False","- break","- if can:","- num += 1","-print(num)","+ if i == 0:","+ if not l[0] in T[0]:","+ t = False","+ break","+ else:","+ if not l[i] in T[l[i - 1]]:","+ t = False","+ break","+ if t:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0482817879,"measured_runtime_v1":0.0441930491,"runtime_lift":1.0925199512,"key":["s737013252","s780040208"]} +{"user_id":"u997648604","problem_id":"p02759","language":"python","submission_id_v0":"s837648460","submission_id_v1":"s007593576","cpu_time_v0":783,"cpu_time_v1":177,"memory_v0":21900,"memory_v1":38384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":77.39,"input":"import itertools\n\nimport sys\n\nimport math\n\nimport numpy as np\n\nfrom collections import deque\n\nfrom itertools import combinations\n\nfrom functools import reduce\n\nfrom functools import lru_cache\n\nsys.setrecursionlimit(10**9)\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n print((math.ceil(N\/2)))\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"n = int(eval(input()))\n\nif n%2==0:\n\n print((n\/\/2))\n\nelse:\n\n print(((n+1)\/\/2))","code_v0_loc":16,"code_v1_loc":5,"code_v0_num_chars":326,"code_v1_num_chars":69,"code_v0_no_empty_lines":"import itertools\nimport sys\nimport math\nimport numpy as np\nfrom collections import deque\nfrom itertools import combinations\nfrom functools import reduce\nfrom functools import lru_cache\n\nsys.setrecursionlimit(10**9)\n\n\ndef main():\n N = int(eval(input()))\n print((math.ceil(N \/ 2)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"n = int(eval(input()))\nif n % 2 == 0:\n print((n \/\/ 2))\nelse:\n print(((n + 1) \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":68.75,"diff":["-import itertools","-import sys","-import math","-import numpy as np","-from collections import deque","-from itertools import combinations","-from functools import reduce","-from functools import lru_cache","-","-sys.setrecursionlimit(10**9)","-","-","-def main():","- N = int(eval(input()))","- print((math.ceil(N \/ 2)))","-","-","-if __name__ == \"__main__\":","- main()","+n = int(eval(input()))","+if n % 2 == 0:","+ print((n \/\/ 2))","+else:","+ print(((n + 1) \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0359180472,"measured_runtime_v1":0.0431218104,"runtime_lift":0.8329438588,"key":["s837648460","s007593576"]} +{"user_id":"u072717685","problem_id":"p03162","language":"python","submission_id_v0":"s939682954","submission_id_v1":"s333845569","cpu_time_v0":529,"cpu_time_v1":481,"memory_v0":47280,"memory_v1":40224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.07,"input":"n = int(eval(input()))\n\na = ([list(map(int, input().split())) for _ in range(n)])\n\na.insert(0,[0,0,0])\n\n\n\ndp = [[0,0,0] for _ in range(n+1)]\n\n\n\nfor i, a in enumerate(a):\n\n dp_1 = dp[i-1]\n\n dp[i][0] = max(dp_1[1], dp_1[2]) + a[0]\n\n dp[i][1] = max(dp_1[0], dp_1[2]) + a[1]\n\n dp[i][2] = max(dp_1[0], dp_1[1]) + a[2]\n\n\n\nprint((max(dp[n])))\n","target":"def main():\n\n n = int(eval(input()))\n\n abc = []\n\n for _ in range(n):\n\n abc.append(tuple(map(int, input().split())))\n\n dp = [[0,0,0] for _ in range(n)]\n\n dp[0][0] = abc[0][0]\n\n dp[0][1] = abc[0][1]\n\n dp[0][2] = abc[0][2]\n\n\n\n for i in range(1, n):\n\n dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + abc[i][0]\n\n dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + abc[i][1]\n\n dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + abc[i][2]\n\n print((max(dp[n-1])))\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":13,"code_v1_loc":18,"code_v0_num_chars":332,"code_v1_num_chars":529,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [list(map(int, input().split())) for _ in range(n)]\na.insert(0, [0, 0, 0])\ndp = [[0, 0, 0] for _ in range(n + 1)]\nfor i, a in enumerate(a):\n dp_1 = dp[i - 1]\n dp[i][0] = max(dp_1[1], dp_1[2]) + a[0]\n dp[i][1] = max(dp_1[0], dp_1[2]) + a[1]\n dp[i][2] = max(dp_1[0], dp_1[1]) + a[2]\nprint((max(dp[n])))\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n abc = []\n for _ in range(n):\n abc.append(tuple(map(int, input().split())))\n dp = [[0, 0, 0] for _ in range(n)]\n dp[0][0] = abc[0][0]\n dp[0][1] = abc[0][1]\n dp[0][2] = abc[0][2]\n for i in range(1, n):\n dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + abc[i][0]\n dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + abc[i][1]\n dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + abc[i][2]\n print((max(dp[n - 1])))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":27.7777777778,"diff":["-n = int(eval(input()))","-a = [list(map(int, input().split())) for _ in range(n)]","-a.insert(0, [0, 0, 0])","-dp = [[0, 0, 0] for _ in range(n + 1)]","-for i, a in enumerate(a):","- dp_1 = dp[i - 1]","- dp[i][0] = max(dp_1[1], dp_1[2]) + a[0]","- dp[i][1] = max(dp_1[0], dp_1[2]) + a[1]","- dp[i][2] = max(dp_1[0], dp_1[1]) + a[2]","-print((max(dp[n])))","+def main():","+ n = int(eval(input()))","+ abc = []","+ for _ in range(n):","+ abc.append(tuple(map(int, input().split())))","+ dp = [[0, 0, 0] for _ in range(n)]","+ dp[0][0] = abc[0][0]","+ dp[0][1] = abc[0][1]","+ dp[0][2] = abc[0][2]","+ for i in range(1, n):","+ dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + abc[i][0]","+ dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + abc[i][1]","+ dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + abc[i][2]","+ print((max(dp[n - 1])))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450600188,"measured_runtime_v1":0.0637698119,"runtime_lift":0.7066042293,"key":["s939682954","s333845569"]} +{"user_id":"u145950990","problem_id":"p03425","language":"python","submission_id_v0":"s209243844","submission_id_v1":"s403424180","cpu_time_v0":482,"cpu_time_v1":445,"memory_v0":49640,"memory_v1":52312,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.68,"input":"n = int(eval(input()))\n\nm,a,r,c,h = 0,0,0,0,0\n\nfor i in range(n):\n\n s = input()[0]\n\n if s=='M':m+=1\n\n elif s=='A':a+=1\n\n elif s=='R':r+=1\n\n elif s=='C':c+=1\n\n elif s=='H':h+=1\n\nx = [m,a,r,c,h]\n\nans = 0\n\nfor i in range(5):\n\n for j in range(i):\n\n for k in range(j):\n\n ans += x[i]*x[j]*x[k]\n\nprint(ans)","target":"import itertools\n\nfrom collections import Counter\n\n\n\nn=int(eval(input()))\n\ns=[input()[0] for _ in range(n)]\n\nd=Counter(s)\n\nans=0\n\nfor i,j,k in itertools.combinations(\"MARCH\",3):\n\n ans+=d[i]*d[j]*d[k]\n\nprint(ans)","code_v0_loc":16,"code_v1_loc":10,"code_v0_num_chars":336,"code_v1_num_chars":208,"code_v0_no_empty_lines":"n = int(eval(input()))\nm, a, r, c, h = 0, 0, 0, 0, 0\nfor i in range(n):\n s = input()[0]\n if s == \"M\":\n m += 1\n elif s == \"A\":\n a += 1\n elif s == \"R\":\n r += 1\n elif s == \"C\":\n c += 1\n elif s == \"H\":\n h += 1\nx = [m, a, r, c, h]\nans = 0\nfor i in range(5):\n for j in range(i):\n for k in range(j):\n ans += x[i] * x[j] * x[k]\nprint(ans)\n","code_v1_no_empty_lines":"import itertools\nfrom collections import Counter\n\nn = int(eval(input()))\ns = [input()[0] for _ in range(n)]\nd = Counter(s)\nans = 0\nfor i, j, k in itertools.combinations(\"MARCH\", 3):\n ans += d[i] * d[j] * d[k]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["+import itertools","+from collections import Counter","+","-m, a, r, c, h = 0, 0, 0, 0, 0","-for i in range(n):","- s = input()[0]","- if s == \"M\":","- m += 1","- elif s == \"A\":","- a += 1","- elif s == \"R\":","- r += 1","- elif s == \"C\":","- c += 1","- elif s == \"H\":","- h += 1","-x = [m, a, r, c, h]","+s = [input()[0] for _ in range(n)]","+d = Counter(s)","-for i in range(5):","- for j in range(i):","- for k in range(j):","- ans += x[i] * x[j] * x[k]","+for i, j, k in itertools.combinations(\"MARCH\", 3):","+ ans += d[i] * d[j] * d[k]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0477490296,"measured_runtime_v1":0.0487463112,"runtime_lift":0.9795413943,"key":["s209243844","s403424180"]} +{"user_id":"u768636516","problem_id":"p02695","language":"python","submission_id_v0":"s120118714","submission_id_v1":"s848686480","cpu_time_v0":1030,"cpu_time_v1":648,"memory_v0":9100,"memory_v1":23228,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.09,"input":"from itertools import combinations_with_replacement as comb_rplc\n\nN,M,Q = list(map(int,input().split()))\n\narray = [ list(map(int,input().split())) for _ in range(Q) ]\n\nans = 0\n\nfor seq in comb_rplc(list(range(1, M + 1)), N):\n\n score = 0\n\n for a,b,c,d in array:\n\n if seq[b-1] - seq [a-1] == c:\n\n score += d\n\n ans = max(score,ans)\n\nprint(ans)\n\n \n","target":"from collections import deque\n\ndef calc(seq):\n\n score = 0\n\n for a,b,c,d in array:\n\n if seq[b-1] - seq[a-1] == c:\n\n score += d\n\n return score\n\n \n\nN,M,Q = list(map(int,input().split()))\n\narray = [ list(map(int,input().split())) for _ in range (Q) ]\n\nans = 0\n\nque = deque()\n\nfor i in range(1,M+1):\n\n que.append([i])\n\n \n\nwhile que:\n\n seq = que.popleft()\n\n if len(seq) == N:\n\n score = calc(seq)\n\n ans = max(ans,score)\n\n else:\n\n for i in range(seq[-1],M+1):\n\n seq_next = seq + [i]\n\n que.append(seq_next)\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":25,"code_v0_num_chars":346,"code_v1_num_chars":539,"code_v0_no_empty_lines":"from itertools import combinations_with_replacement as comb_rplc\n\nN, M, Q = list(map(int, input().split()))\narray = [list(map(int, input().split())) for _ in range(Q)]\nans = 0\nfor seq in comb_rplc(list(range(1, M + 1)), N):\n score = 0\n for a, b, c, d in array:\n if seq[b - 1] - seq[a - 1] == c:\n score += d\n ans = max(score, ans)\nprint(ans)\n","code_v1_no_empty_lines":"from collections import deque\n\n\ndef calc(seq):\n score = 0\n for a, b, c, d in array:\n if seq[b - 1] - seq[a - 1] == c:\n score += d\n return score\n\n\nN, M, Q = list(map(int, input().split()))\narray = [list(map(int, input().split())) for _ in range(Q)]\nans = 0\nque = deque()\nfor i in range(1, M + 1):\n que.append([i])\nwhile que:\n seq = que.popleft()\n if len(seq) == N:\n score = calc(seq)\n ans = max(ans, score)\n else:\n for i in range(seq[-1], M + 1):\n seq_next = seq + [i]\n que.append(seq_next)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":52.0,"diff":["-from itertools import combinations_with_replacement as comb_rplc","+from collections import deque","+","+","+def calc(seq):","+ score = 0","+ for a, b, c, d in array:","+ if seq[b - 1] - seq[a - 1] == c:","+ score += d","+ return score","+","-for seq in comb_rplc(list(range(1, M + 1)), N):","- score = 0","- for a, b, c, d in array:","- if seq[b - 1] - seq[a - 1] == c:","- score += d","- ans = max(score, ans)","+que = deque()","+for i in range(1, M + 1):","+ que.append([i])","+while que:","+ seq = que.popleft()","+ if len(seq) == N:","+ score = calc(seq)","+ ans = max(ans, score)","+ else:","+ for i in range(seq[-1], M + 1):","+ seq_next = seq + [i]","+ que.append(seq_next)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2080408816,"measured_runtime_v1":0.0673310351,"runtime_lift":3.089821524,"key":["s120118714","s848686480"]} +{"user_id":"u316386814","problem_id":"p03025","language":"python","submission_id_v0":"s824811737","submission_id_v1":"s673328772","cpu_time_v0":1022,"cpu_time_v1":711,"memory_v0":22956,"memory_v1":31044,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.43,"input":"import sys\n\nsys.setrecursionlimit(10**7)\n\nINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\ndef POW(x, y): return pow(x, y, MOD)\n\ndef INV(x, m=MOD): return pow(x, m - 2, m)\n\ndef DIV(x, y, m=MOD): return (x * INV(y, m)) % m\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef II(): return int(sys.stdin.readline())\n\ndef SI(): return eval(input())\n\n\n\n# factorials\n\n_nfact = 2 * (10 ** 5) + 10\n\nfacts = [0] * _nfact\n\nfacts[0] = 1\n\nfor i in range(1, _nfact):\n\n facts[i] = (facts[i - 1] * i) % MOD\n\n\n\ndef binomial(m, n):\n\n return DIV(facts[m], facts[n] * facts[m - n])\n\n\n\ndef main():\n\n N, A, B, C = LI()\n\n D = DIV(100, 100 - C)\n\n ans = 0\n\n ap, bp, abp = [1], [1], [POW(A + B, N)]\n\n for _ in range(0, N + 1):\n\n ap.append(ap[-1] * A % MOD)\n\n bp.append(bp[-1] * B % MOD)\n\n abp.append(abp[-1] * (A + B) % MOD)\n\n for m in range(N, 2 * N):\n\n x = binomial(m - 1, N - 1) * DIV(\n\n ap[N] * bp[m - N] + ap[m - N] * bp[N],\n\n abp[m - N]) % MOD\n\n y = (m * D) % MOD\n\n ans = (ans + (x * y) % MOD) % MOD\n\n return ans\n\n\n\nprint((main()))","target":"import sys\n\nsys.setrecursionlimit(10**7)\n\nINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\ndef POW(x, y): return pow(x, y, MOD)\n\ndef INV(x, m=MOD): return pow(x, m - 2, m)\n\ndef DIV(x, y, m=MOD): return (x * INV(y, m)) % m\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]\n\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef II(): return int(sys.stdin.readline())\n\ndef SI(): return eval(input())\n\n\n\n# factorials\n\n_nfact = 2 * (10 ** 5) + 10\n\nfacts = [0] * _nfact\n\nfacts[0] = 1\n\nfor i in range(1, _nfact):\n\n facts[i] = (facts[i - 1] * i) % MOD\n\nifacts = [0] * _nfact\n\nifacts[-1] = INV(facts[-1])\n\nfor i in range(_nfact - 1, 0, -1):\n\n ifacts[i - 1] = (ifacts[i] * i) % MOD\n\n\n\ndef binomial(m, n):\n\n return facts[m] * ifacts[n] * ifacts[m - n]\n\n\n\ndef main():\n\n N, A, B, C = LI()\n\n D = DIV(100, 100 - C)\n\n ans = 0\n\n ap, bp, abp = [1], [1], [POW(A + B, N)]\n\n for _ in range(0, N + 1):\n\n ap.append(ap[-1] * A % MOD)\n\n bp.append(bp[-1] * B % MOD)\n\n abp.append(abp[-1] * (A + B) % MOD)\n\n for m in range(N, 2 * N):\n\n x = binomial(m - 1, N - 1) * DIV(\n\n ap[N] * bp[m - N] + ap[m - N] * bp[N],\n\n abp[m - N]) % MOD\n\n y = (m * D) % MOD\n\n ans = (ans + (x * y) % MOD) % MOD\n\n return ans\n\n\n\nprint((main()))","code_v0_loc":42,"code_v1_loc":46,"code_v0_num_chars":1283,"code_v1_num_chars":1412,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nINF = 10**18\nMOD = 10**9 + 7\n\n\ndef POW(x, y):\n return pow(x, y, MOD)\n\n\ndef INV(x, m=MOD):\n return pow(x, m - 2, m)\n\n\ndef DIV(x, y, m=MOD):\n return (x * INV(y, m)) % m\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef SI():\n return eval(input())\n\n\n# factorials\n_nfact = 2 * (10**5) + 10\nfacts = [0] * _nfact\nfacts[0] = 1\nfor i in range(1, _nfact):\n facts[i] = (facts[i - 1] * i) % MOD\n\n\ndef binomial(m, n):\n return DIV(facts[m], facts[n] * facts[m - n])\n\n\ndef main():\n N, A, B, C = LI()\n D = DIV(100, 100 - C)\n ans = 0\n ap, bp, abp = [1], [1], [POW(A + B, N)]\n for _ in range(0, N + 1):\n ap.append(ap[-1] * A % MOD)\n bp.append(bp[-1] * B % MOD)\n abp.append(abp[-1] * (A + B) % MOD)\n for m in range(N, 2 * N):\n x = (\n binomial(m - 1, N - 1)\n * DIV(ap[N] * bp[m - N] + ap[m - N] * bp[N], abp[m - N])\n % MOD\n )\n y = (m * D) % MOD\n ans = (ans + (x * y) % MOD) % MOD\n return ans\n\n\nprint((main()))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nINF = 10**18\nMOD = 10**9 + 7\n\n\ndef POW(x, y):\n return pow(x, y, MOD)\n\n\ndef INV(x, m=MOD):\n return pow(x, m - 2, m)\n\n\ndef DIV(x, y, m=MOD):\n return (x * INV(y, m)) % m\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LF():\n return [float(x) for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef SI():\n return eval(input())\n\n\n# factorials\n_nfact = 2 * (10**5) + 10\nfacts = [0] * _nfact\nfacts[0] = 1\nfor i in range(1, _nfact):\n facts[i] = (facts[i - 1] * i) % MOD\nifacts = [0] * _nfact\nifacts[-1] = INV(facts[-1])\nfor i in range(_nfact - 1, 0, -1):\n ifacts[i - 1] = (ifacts[i] * i) % MOD\n\n\ndef binomial(m, n):\n return facts[m] * ifacts[n] * ifacts[m - n]\n\n\ndef main():\n N, A, B, C = LI()\n D = DIV(100, 100 - C)\n ans = 0\n ap, bp, abp = [1], [1], [POW(A + B, N)]\n for _ in range(0, N + 1):\n ap.append(ap[-1] * A % MOD)\n bp.append(bp[-1] * B % MOD)\n abp.append(abp[-1] * (A + B) % MOD)\n for m in range(N, 2 * N):\n x = (\n binomial(m - 1, N - 1)\n * DIV(ap[N] * bp[m - N] + ap[m - N] * bp[N], abp[m - N])\n % MOD\n )\n y = (m * D) % MOD\n ans = (ans + (x * y) % MOD) % MOD\n return ans\n\n\nprint((main()))\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["+ifacts = [0] * _nfact","+ifacts[-1] = INV(facts[-1])","+for i in range(_nfact - 1, 0, -1):","+ ifacts[i - 1] = (ifacts[i] * i) % MOD","- return DIV(facts[m], facts[n] * facts[m - n])","+ return facts[m] * ifacts[n] * ifacts[m - n]"],"diff_only_import_comment":false,"measured_runtime_v0":0.2387013237,"measured_runtime_v1":0.669555722,"runtime_lift":0.3565070328,"key":["s824811737","s673328772"]} +{"user_id":"u976225138","problem_id":"p03645","language":"python","submission_id_v0":"s631283501","submission_id_v1":"s116341576","cpu_time_v0":387,"cpu_time_v1":330,"memory_v0":24208,"memory_v1":29636,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.73,"input":"n, m = list(map(int, input().split()))\n\n\n\np = set()\n\nq = set()\n\n\n\nfor _ in range(m):\n\n a, b = list(map(int, input().split()))\n\n if a == 1:\n\n p.add(b)\n\n elif b == n:\n\n q.add(a)\n\nelse:\n\n print((\"POSSIBLE\" if p & q else \"IMPOSSIBLE\"))","target":"n, m = input().split()\n\n\n\np = set()\n\nq = set()\n\nfor _ in range(int(m)):\n\n a, b = input().split()\n\n if a == \"1\":\n\n p.add(b)\n\n elif b == n:\n\n q.add(a)\n\nelse:\n\n if p & q:\n\n print(\"POSSIBLE\")\n\n else:\n\n print(\"IMPOSSIBLE\")","code_v0_loc":13,"code_v1_loc":15,"code_v0_num_chars":243,"code_v1_num_chars":260,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\np = set()\nq = set()\nfor _ in range(m):\n a, b = list(map(int, input().split()))\n if a == 1:\n p.add(b)\n elif b == n:\n q.add(a)\nelse:\n print((\"POSSIBLE\" if p & q else \"IMPOSSIBLE\"))\n","code_v1_no_empty_lines":"n, m = input().split()\np = set()\nq = set()\nfor _ in range(int(m)):\n a, b = input().split()\n if a == \"1\":\n p.add(b)\n elif b == n:\n q.add(a)\nelse:\n if p & q:\n print(\"POSSIBLE\")\n else:\n print(\"IMPOSSIBLE\")\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-n, m = list(map(int, input().split()))","+n, m = input().split()","-for _ in range(m):","- a, b = list(map(int, input().split()))","- if a == 1:","+for _ in range(int(m)):","+ a, b = input().split()","+ if a == \"1\":","- print((\"POSSIBLE\" if p & q else \"IMPOSSIBLE\"))","+ if p & q:","+ print(\"POSSIBLE\")","+ else:","+ print(\"IMPOSSIBLE\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1215347767,"measured_runtime_v1":0.0434117317,"runtime_lift":2.7995837034,"key":["s631283501","s116341576"]} +{"user_id":"u205561862","problem_id":"p03631","language":"python","submission_id_v0":"s198691758","submission_id_v1":"s284582279","cpu_time_v0":13,"cpu_time_v1":10,"memory_v0":2568,"memory_v1":2568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.08,"input":"print(([\"Yes\",\"No\"][(lambda x:(abs(x\/\/100-x%10)+99)\/\/100)(eval(input()))]))","target":"print(([\"Yes\",\"No\"][(lambda x:bool(x\/\/100-x%10))(eval(input()))]))\n","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":67,"code_v1_num_chars":59,"code_v0_no_empty_lines":"print(([\"Yes\", \"No\"][(lambda x: (abs(x \/\/ 100 - x % 10) + 99) \/\/ 100)(eval(input()))]))\n","code_v1_no_empty_lines":"print(([\"Yes\", \"No\"][(lambda x: bool(x \/\/ 100 - x % 10))(eval(input()))]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print(([\"Yes\", \"No\"][(lambda x: (abs(x \/\/ 100 - x % 10) + 99) \/\/ 100)(eval(input()))]))","+print(([\"Yes\", \"No\"][(lambda x: bool(x \/\/ 100 - x % 10))(eval(input()))]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.100453629,"measured_runtime_v1":0.0364076006,"runtime_lift":2.7591389496,"key":["s198691758","s284582279"]} +{"user_id":"u297574184","problem_id":"p03602","language":"python","submission_id_v0":"s737601924","submission_id_v1":"s469368057","cpu_time_v0":1825,"cpu_time_v1":834,"memory_v0":6644,"memory_v1":46588,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.3,"input":"N = int(eval(input()))\n\nA = [list(map(int, input().split())) for i in range(N)]\n\n\n\nINF = 10 ** 9 + 1\n\nfor i in range(N):\n\n A[i][i] = INF\n\n\n\nans = 0\n\nfor i in range(N):\n\n Ai = A[i]\n\n for j in range(i):\n\n d = min(list(map(sum, list(zip(Ai, A[j])))))\n\n\n\n if A[i][j] > d:\n\n print('-1')\n\n exit()\n\n elif A[i][j] < d:\n\n ans += A[i][j]\n\n\n\nprint(ans)\n","target":"N = int(eval(input()))\n\nA = [list(map(int, input().split())) for i in range(N)]\n\n\n\n# Warshall-Floyd\u6cd5\n\ndist = [list(A[i]) for i in range(N)]\n\nvia = [[None for i in range(N)] for j in range(N)]\n\nfor k in range(N):\n\n for i in range(N):\n\n for j in range(N):\n\n d = dist[i][k] + dist[k][j]\n\n if dist[i][j] >= d:\n\n dist[i][j] = d\n\n if i != k and j != k:\n\n via[i][j] = k\n\n\n\nans = 0\n\nfor i in range(N):\n\n for j in range(i):\n\n if dist[i][j] < A[i][j]:\n\n ans = -1\n\n break\n\n\n\n if via[i][j] == None:\n\n ans += dist[i][j]\n\n\n\n if ans == -1:\n\n break\n\n\n\nprint(ans)\n","code_v0_loc":20,"code_v1_loc":29,"code_v0_num_chars":387,"code_v1_num_chars":682,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [list(map(int, input().split())) for i in range(N)]\nINF = 10**9 + 1\nfor i in range(N):\n A[i][i] = INF\nans = 0\nfor i in range(N):\n Ai = A[i]\n for j in range(i):\n d = min(list(map(sum, list(zip(Ai, A[j])))))\n if A[i][j] > d:\n print(\"-1\")\n exit()\n elif A[i][j] < d:\n ans += A[i][j]\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [list(map(int, input().split())) for i in range(N)]\n# Warshall-Floyd\u6cd5\ndist = [list(A[i]) for i in range(N)]\nvia = [[None for i in range(N)] for j in range(N)]\nfor k in range(N):\n for i in range(N):\n for j in range(N):\n d = dist[i][k] + dist[k][j]\n if dist[i][j] >= d:\n dist[i][j] = d\n if i != k and j != k:\n via[i][j] = k\nans = 0\nfor i in range(N):\n for j in range(i):\n if dist[i][j] < A[i][j]:\n ans = -1\n break\n if via[i][j] == None:\n ans += dist[i][j]\n if ans == -1:\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":31.0344827586,"diff":["-INF = 10**9 + 1","-for i in range(N):","- A[i][i] = INF","+# Warshall-Floyd\u6cd5","+dist = [list(A[i]) for i in range(N)]","+via = [[None for i in range(N)] for j in range(N)]","+for k in range(N):","+ for i in range(N):","+ for j in range(N):","+ d = dist[i][k] + dist[k][j]","+ if dist[i][j] >= d:","+ dist[i][j] = d","+ if i != k and j != k:","+ via[i][j] = k","- Ai = A[i]","- d = min(list(map(sum, list(zip(Ai, A[j])))))","- if A[i][j] > d:","- print(\"-1\")","- exit()","- elif A[i][j] < d:","- ans += A[i][j]","+ if dist[i][j] < A[i][j]:","+ ans = -1","+ break","+ if via[i][j] == None:","+ ans += dist[i][j]","+ if ans == -1:","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.0420019627,"measured_runtime_v1":0.1136260986,"runtime_lift":0.3696506627,"key":["s737601924","s469368057"]} +{"user_id":"u934442292","problem_id":"p02888","language":"python","submission_id_v0":"s367168284","submission_id_v1":"s057549482","cpu_time_v0":1263,"cpu_time_v1":599,"memory_v0":119048,"memory_v1":106984,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.57,"input":"import sys\n\n\n\nimport numba as nb\n\nimport numpy as np\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\n@nb.njit(\"i8(i8[:], i8)\")\n\ndef binary_search(a, key):\n\n \"\"\"Meguru type binary search\"\"\"\n\n ng = -1\n\n ok = len(a)\n\n\n\n while (abs(ok - ng) > 1):\n\n mid = (ok + ng) \/\/ 2\n\n if a[mid] >= key:\n\n ok = mid\n\n else:\n\n ng = mid\n\n\n\n return ok\n\n\n\n\n\n@nb.njit(\"i8(i8, i8[:])\")\n\ndef solve(N, L):\n\n L.sort()\n\n ans = 0\n\n for a in range(N - 2):\n\n for b in range(a + 1, N - 1):\n\n c = binary_search(L, L[a] + L[b]) - 1\n\n ans += c - b\n\n return ans\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n L = np.array(input().split(), dtype=np.int64)\n\n\n\n ans = solve(N, L)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"import sys\n\n\n\nimport numba as nb\n\nimport numpy as np\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\n@nb.njit(\"i8(i8[:], i8)\", cache=True)\n\ndef binary_search(a, key):\n\n \"\"\"Meguru type binary search\"\"\"\n\n ng = -1\n\n ok = len(a)\n\n\n\n while (abs(ok - ng) > 1):\n\n mid = (ok + ng) \/\/ 2\n\n if a[mid] >= key:\n\n ok = mid\n\n else:\n\n ng = mid\n\n\n\n return ok\n\n\n\n\n\n@nb.njit(\"i8(i8, i8[:])\", cache=True)\n\ndef solve(N, L):\n\n L.sort()\n\n ans = 0\n\n for a in range(N - 2):\n\n for b in range(a + 1, N - 1):\n\n c = binary_search(L, L[a] + L[b]) - 1\n\n ans += c - b\n\n return ans\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n L = np.array(input().split(), dtype=np.int64)\n\n\n\n ans = solve(N, L)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":45,"code_v1_loc":45,"code_v0_num_chars":786,"code_v1_num_chars":810,"code_v0_no_empty_lines":"import sys\nimport numba as nb\nimport numpy as np\n\ninput = sys.stdin.readline\n\n\n@nb.njit(\"i8(i8[:], i8)\")\ndef binary_search(a, key):\n \"\"\"Meguru type binary search\"\"\"\n ng = -1\n ok = len(a)\n while abs(ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n if a[mid] >= key:\n ok = mid\n else:\n ng = mid\n return ok\n\n\n@nb.njit(\"i8(i8, i8[:])\")\ndef solve(N, L):\n L.sort()\n ans = 0\n for a in range(N - 2):\n for b in range(a + 1, N - 1):\n c = binary_search(L, L[a] + L[b]) - 1\n ans += c - b\n return ans\n\n\ndef main():\n N = int(eval(input()))\n L = np.array(input().split(), dtype=np.int64)\n ans = solve(N, L)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport numba as nb\nimport numpy as np\n\ninput = sys.stdin.readline\n\n\n@nb.njit(\"i8(i8[:], i8)\", cache=True)\ndef binary_search(a, key):\n \"\"\"Meguru type binary search\"\"\"\n ng = -1\n ok = len(a)\n while abs(ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n if a[mid] >= key:\n ok = mid\n else:\n ng = mid\n return ok\n\n\n@nb.njit(\"i8(i8, i8[:])\", cache=True)\ndef solve(N, L):\n L.sort()\n ans = 0\n for a in range(N - 2):\n for b in range(a + 1, N - 1):\n c = binary_search(L, L[a] + L[b]) - 1\n ans += c - b\n return ans\n\n\ndef main():\n N = int(eval(input()))\n L = np.array(input().split(), dtype=np.int64)\n ans = solve(N, L)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-@nb.njit(\"i8(i8[:], i8)\")","+@nb.njit(\"i8(i8[:], i8)\", cache=True)","-@nb.njit(\"i8(i8, i8[:])\")","+@nb.njit(\"i8(i8, i8[:])\", cache=True)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0532180238,"measured_runtime_v1":0.0372250102,"runtime_lift":1.4296308729,"key":["s367168284","s057549482"]} +{"user_id":"u912862653","problem_id":"p03044","language":"python","submission_id_v0":"s486418044","submission_id_v1":"s453288916","cpu_time_v0":1023,"cpu_time_v1":789,"memory_v0":158640,"memory_v1":103160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.87,"input":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**7)\n\n\n\n\n\ndef dfs(v, c, C, visited, G):\n\n visited[v] = True\n\n C[v] = c\n\n\n\n for nv, w in G[v]:\n\n if visited[nv]:\n\n continue\n\n dfs(nv, c^w, C, visited, G)\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n \n\n G = [[] for _ in range(N)]\n\n for _ in range(N-1):\n\n u, v, w = list(map(int, input().split()))\n\n G[u-1].append([v-1, w%2])\n\n G[v-1].append([u-1, w%2])\n\n # print(G)\n\n\n\n C = [0]*N\n\n visited = [False]*N\n\n dfs(0, 0, C, visited, G)\n\n for c in C:\n\n print(c)\n\n \n\n \n\n\n\n\n\nif __name__ == '__main__':\n\n main()","target":"from functools import reduce\n\nfrom fractions import gcd\n\nimport math\n\nimport bisect\n\nimport itertools\n\nimport sys\n\nsys.setrecursionlimit(10**7)\n\ninput = sys.stdin.readline\n\nINF = float(\"inf\")\n\nMOD = 1000000007\n\n\n\n\n\nclass Edge:\n\n def __init__(self, to, cost):\n\n self.to = to\n\n self.cost = cost\n\n\n\n\n\nvisited = []\n\nvertex = []\n\ndef dfs(G, v, d):\n\n visited[v] = True\n\n if d % 2 == 0:\n\n vertex[v] = 0\n\n else:\n\n vertex[v] = 1\n\n\n\n for edge in G[v]:\n\n nv = edge.to\n\n if visited[nv]:\n\n continue\n\n nd = d + edge.cost\n\n dfs(G, nv, nd)\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n G = [[] for _ in range(N)]\n\n for _ in range(N-1):\n\n a, b, cost = list(map(int, input().split()))\n\n a -= 1; b -= 1\n\n G[a].append(Edge(b, cost))\n\n G[b].append(Edge(a, cost))\n\n\n\n for _ in range(N):\n\n visited.append(False)\n\n vertex.append(0)\n\n \n\n dfs(G, 0, 0)\n\n\n\n for v in vertex:\n\n print(v)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":36,"code_v1_loc":56,"code_v0_num_chars":651,"code_v1_num_chars":1039,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\n\n\ndef dfs(v, c, C, visited, G):\n visited[v] = True\n C[v] = c\n for nv, w in G[v]:\n if visited[nv]:\n continue\n dfs(nv, c ^ w, C, visited, G)\n\n\ndef main():\n N = int(eval(input()))\n G = [[] for _ in range(N)]\n for _ in range(N - 1):\n u, v, w = list(map(int, input().split()))\n G[u - 1].append([v - 1, w % 2])\n G[v - 1].append([u - 1, w % 2])\n # print(G)\n C = [0] * N\n visited = [False] * N\n dfs(0, 0, C, visited, G)\n for c in C:\n print(c)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from functools import reduce\nfrom fractions import gcd\nimport math\nimport bisect\nimport itertools\nimport sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\nINF = float(\"inf\")\nMOD = 1000000007\n\n\nclass Edge:\n def __init__(self, to, cost):\n self.to = to\n self.cost = cost\n\n\nvisited = []\nvertex = []\n\n\ndef dfs(G, v, d):\n visited[v] = True\n if d % 2 == 0:\n vertex[v] = 0\n else:\n vertex[v] = 1\n for edge in G[v]:\n nv = edge.to\n if visited[nv]:\n continue\n nd = d + edge.cost\n dfs(G, nv, nd)\n\n\ndef main():\n N = int(eval(input()))\n G = [[] for _ in range(N)]\n for _ in range(N - 1):\n a, b, cost = list(map(int, input().split()))\n a -= 1\n b -= 1\n G[a].append(Edge(b, cost))\n G[b].append(Edge(a, cost))\n for _ in range(N):\n visited.append(False)\n vertex.append(0)\n dfs(G, 0, 0)\n for v in vertex:\n print(v)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["+from functools import reduce","+from fractions import gcd","+import math","+import bisect","+import itertools","+sys.setrecursionlimit(10**7)","-sys.setrecursionlimit(10**7)","+INF = float(\"inf\")","+MOD = 1000000007","-def dfs(v, c, C, visited, G):","+class Edge:","+ def __init__(self, to, cost):","+ self.to = to","+ self.cost = cost","+","+","+visited = []","+vertex = []","+","+","+def dfs(G, v, d):","- C[v] = c","- for nv, w in G[v]:","+ if d % 2 == 0:","+ vertex[v] = 0","+ else:","+ vertex[v] = 1","+ for edge in G[v]:","+ nv = edge.to","- dfs(nv, c ^ w, C, visited, G)","+ nd = d + edge.cost","+ dfs(G, nv, nd)","- u, v, w = list(map(int, input().split()))","- G[u - 1].append([v - 1, w % 2])","- G[v - 1].append([u - 1, w % 2])","- # print(G)","- C = [0] * N","- visited = [False] * N","- dfs(0, 0, C, visited, G)","- for c in C:","- print(c)","+ a, b, cost = list(map(int, input().split()))","+ a -= 1","+ b -= 1","+ G[a].append(Edge(b, cost))","+ G[b].append(Edge(a, cost))","+ for _ in range(N):","+ visited.append(False)","+ vertex.append(0)","+ dfs(G, 0, 0)","+ for v in vertex:","+ print(v)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0692286007,"measured_runtime_v1":0.0975782638,"runtime_lift":0.7094674366,"key":["s486418044","s453288916"]} +{"user_id":"u241544828","problem_id":"p04001","language":"python","submission_id_v0":"s319754663","submission_id_v1":"s853923321","cpu_time_v0":29,"cpu_time_v1":19,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.48,"input":"s = [int(x) for x in eval(input())]\n\n##print(s)\n\ncount = len(s)-1##+\u306e\u5165\u308a\u3046\u308b\u30dd\u30b8\u30b7\u30e7\u30f3\u6570\n\nsum = 0\n\nfor bit in range(2**count):\n\n hugou = [\"\"] * count\n\n ##print(bin(bit))\n\n for i in range(count):\n\n if (bit >> i) & 1:\n\n hugou[count-1-i] = \"+\"\n\n ##print(hugou)\n\n calc = \"\"\n\n \n\n for j in range(count):\n\n calc += str(s[j])\n\n ##print(s)\n\n calc += str(hugou[j])\n\n ##print(hugou)\n\n ##print(calc)\n\n calc += str(s[-1])\n\n ##print(calc)\n\n sum += eval(calc)\n\nprint(sum)","target":"s = eval(input())\n\nlen = len(s)\n\nns = list(map(int,s))\n\ntotal_sum = 0\n\nfor bit in range(1 << (len-1)):\n\n ##print(bit)\n\n sum_ = 0\n\n num = ns[0]\n\n for i in range(1, len):\n\n if (bit & 1) > 0:\n\n \n\n sum_ += num\n\n num = ns[i]\n\n else:\n\n num = (num * 10 + ns[i])\n\n bit = bit >> 1\n\n total_sum += sum_ + num\n\nprint(total_sum)","code_v0_loc":23,"code_v1_loc":18,"code_v0_num_chars":531,"code_v1_num_chars":342,"code_v0_no_empty_lines":"s = [int(x) for x in eval(input())]\n##print(s)\ncount = len(s) - 1 ##+\u306e\u5165\u308a\u3046\u308b\u30dd\u30b8\u30b7\u30e7\u30f3\u6570\nsum = 0\nfor bit in range(2**count):\n hugou = [\"\"] * count\n ##print(bin(bit))\n for i in range(count):\n if (bit >> i) & 1:\n hugou[count - 1 - i] = \"+\"\n ##print(hugou)\n calc = \"\"\n for j in range(count):\n calc += str(s[j])\n ##print(s)\n calc += str(hugou[j])\n ##print(hugou)\n ##print(calc)\n calc += str(s[-1])\n ##print(calc)\n sum += eval(calc)\nprint(sum)\n","code_v1_no_empty_lines":"s = eval(input())\nlen = len(s)\nns = list(map(int, s))\ntotal_sum = 0\nfor bit in range(1 << (len - 1)):\n ##print(bit)\n sum_ = 0\n num = ns[0]\n for i in range(1, len):\n if (bit & 1) > 0:\n sum_ += num\n num = ns[i]\n else:\n num = num * 10 + ns[i]\n bit = bit >> 1\n total_sum += sum_ + num\nprint(total_sum)\n","code_same":false,"relative_loc_diff_percent":21.7391304348,"diff":["-s = [int(x) for x in eval(input())]","-##print(s)","-count = len(s) - 1 ##+\u306e\u5165\u308a\u3046\u308b\u30dd\u30b8\u30b7\u30e7\u30f3\u6570","-sum = 0","-for bit in range(2**count):","- hugou = [\"\"] * count","- ##print(bin(bit))","- for i in range(count):","- if (bit >> i) & 1:","- hugou[count - 1 - i] = \"+\"","- ##print(hugou)","- calc = \"\"","- for j in range(count):","- calc += str(s[j])","- ##print(s)","- calc += str(hugou[j])","- ##print(hugou)","- ##print(calc)","- calc += str(s[-1])","- ##print(calc)","- sum += eval(calc)","-print(sum)","+s = eval(input())","+len = len(s)","+ns = list(map(int, s))","+total_sum = 0","+for bit in range(1 << (len - 1)):","+ ##print(bit)","+ sum_ = 0","+ num = ns[0]","+ for i in range(1, len):","+ if (bit & 1) > 0:","+ sum_ += num","+ num = ns[i]","+ else:","+ num = num * 10 + ns[i]","+ bit = bit >> 1","+ total_sum += sum_ + num","+print(total_sum)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0435235977,"measured_runtime_v1":0.0441312313,"runtime_lift":0.9862312113,"key":["s319754663","s853923321"]} +{"user_id":"u889344512","problem_id":"p03606","language":"python","submission_id_v0":"s728987235","submission_id_v1":"s351964232","cpu_time_v0":222,"cpu_time_v1":195,"memory_v0":39920,"memory_v1":38768,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.16,"input":"n = int(eval(input()))\n\ncount = 0\n\nfor i in range(n):\n\n l,r = list(map(int,input().split()))\n\n count += r-l+1\n\nprint(count)","target":"n = int(eval(input()))\n\ncount = 0\n\nfor i in range(n):\n\n li,ri = list(map(int,input().split()))\n\n count += ri-li+1\n\nprint(count)","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":117,"code_v1_num_chars":121,"code_v0_no_empty_lines":"n = int(eval(input()))\ncount = 0\nfor i in range(n):\n l, r = list(map(int, input().split()))\n count += r - l + 1\nprint(count)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ncount = 0\nfor i in range(n):\n li, ri = list(map(int, input().split()))\n count += ri - li + 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- l, r = list(map(int, input().split()))","- count += r - l + 1","+ li, ri = list(map(int, input().split()))","+ count += ri - li + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.103340402,"measured_runtime_v1":0.0816291924,"runtime_lift":1.265973593,"key":["s728987235","s351964232"]} +{"user_id":"u645250356","problem_id":"p03994","language":"python","submission_id_v0":"s052974820","submission_id_v1":"s844701178","cpu_time_v0":90,"cpu_time_v1":73,"memory_v0":7256,"memory_v1":11292,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.89,"input":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,fractions,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpln(n): return list(int(sys.stdin.readline()) for i in range(n))\n\n\n\ns = eval(input())\n\nn = len(s)\n\nr = [ord('z') - ord(t) + 1 if t != 'a' else 0 for t in s]\n\nres = [None] * n\n\nk = inp()\n\nfor i,x in enumerate(r):\n\n if x <= k:\n\n res[i] = 'a'\n\n k -= x\n\nif k > 0:\n\n tmp = 'a' if res[-1] != None else s[-1]\n\n res[-1] = chr((ord(tmp) - ord('a') + k)%26 + ord('a'))\n\nfor i,t in enumerate(res):\n\n if t == None:\n\n res[i] = s[i]\n\nprint((''.join(res)))","target":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush\n\nfrom bisect import bisect_left,bisect_right \n\nimport sys,math,itertools,fractions,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\ns = list(eval(input()))\n\nk = inp()\n\nn = len(s)\n\nnxa = ord('z') + 1\n\n\n\nfor i,x in enumerate(s):\n\n if x == 'a':\n\n continue\n\n rem = nxa - ord(x)\n\n if rem <= k:\n\n s[i] = 'a'\n\n k -= rem\n\nif k > 0:\n\n s[-1] = chr(ord('a') + (ord(s[-1])-ord('a')+k)%26)\n\nprint((''.join(s)))","code_v0_loc":26,"code_v1_loc":25,"code_v0_num_chars":793,"code_v1_num_chars":644,"code_v0_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, fractions, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef inpln(n):\n return list(int(sys.stdin.readline()) for i in range(n))\n\n\ns = eval(input())\nn = len(s)\nr = [ord(\"z\") - ord(t) + 1 if t != \"a\" else 0 for t in s]\nres = [None] * n\nk = inp()\nfor i, x in enumerate(r):\n if x <= k:\n res[i] = \"a\"\n k -= x\nif k > 0:\n tmp = \"a\" if res[-1] != None else s[-1]\n res[-1] = chr((ord(tmp) - ord(\"a\") + k) % 26 + ord(\"a\"))\nfor i, t in enumerate(res):\n if t == None:\n res[i] = s[i]\nprint((\"\".join(res)))\n","code_v1_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, fractions, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\ns = list(eval(input()))\nk = inp()\nn = len(s)\nnxa = ord(\"z\") + 1\nfor i, x in enumerate(s):\n if x == \"a\":\n continue\n rem = nxa - ord(x)\n if rem <= k:\n s[i] = \"a\"\n k -= rem\nif k > 0:\n s[-1] = chr(ord(\"a\") + (ord(s[-1]) - ord(\"a\") + k) % 26)\nprint((\"\".join(s)))\n","code_same":false,"relative_loc_diff_percent":3.8461538462,"diff":["-from heapq import heappop, heappush, heapify","-import sys, bisect, math, itertools, fractions, pprint","+from heapq import heappop, heappush","+from bisect import bisect_left, bisect_right","+import sys, math, itertools, fractions, pprint","-def inpln(n):","- return list(int(sys.stdin.readline()) for i in range(n))","-","-","-s = eval(input())","+s = list(eval(input()))","+k = inp()","-r = [ord(\"z\") - ord(t) + 1 if t != \"a\" else 0 for t in s]","-res = [None] * n","-k = inp()","-for i, x in enumerate(r):","- if x <= k:","- res[i] = \"a\"","- k -= x","+nxa = ord(\"z\") + 1","+for i, x in enumerate(s):","+ if x == \"a\":","+ continue","+ rem = nxa - ord(x)","+ if rem <= k:","+ s[i] = \"a\"","+ k -= rem","- tmp = \"a\" if res[-1] != None else s[-1]","- res[-1] = chr((ord(tmp) - ord(\"a\") + k) % 26 + ord(\"a\"))","-for i, t in enumerate(res):","- if t == None:","- res[i] = s[i]","-print((\"\".join(res)))","+ s[-1] = chr(ord(\"a\") + (ord(s[-1]) - ord(\"a\") + k) % 26)","+print((\"\".join(s)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0438109832,"measured_runtime_v1":0.0454706442,"runtime_lift":0.9635003838,"key":["s052974820","s844701178"]} +{"user_id":"u761320129","problem_id":"p03971","language":"python","submission_id_v0":"s031287566","submission_id_v1":"s416565412","cpu_time_v0":113,"cpu_time_v1":94,"memory_v0":4016,"memory_v1":6344,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.81,"input":"N,A,B = list(map(int,input().split()))\n\nS = eval(input())\n\n\n\npa = pb = 0\n\nfor c in S:\n\n if c == 'a' and pa+pb < A+B:\n\n print('Yes')\n\n pa += 1\n\n elif c == 'b' and pa+pb < A+B and pb < B:\n\n print('Yes')\n\n pb += 1\n\n else:\n\n print('No')\n","target":"N,A,B = map(int,input().split())\n\nS = input()\n\n\n\nans = ['No'] * N\n\np = b = 0\n\nfor i,c in enumerate(S):\n\n if c == 'a':\n\n if p < A+B:\n\n ans[i] = 'Yes'\n\n p += 1\n\n elif c == 'b':\n\n if p < A+B and b < B:\n\n ans[i] = 'Yes'\n\n p += 1\n\n b += 1\n\nprint(*ans,sep='\\n')\n","code_v0_loc":13,"code_v1_loc":16,"code_v0_num_chars":265,"code_v1_num_chars":330,"code_v0_no_empty_lines":"N, A, B = list(map(int, input().split()))\nS = eval(input())\npa = pb = 0\nfor c in S:\n if c == \"a\" and pa + pb < A + B:\n print(\"Yes\")\n pa += 1\n elif c == \"b\" and pa + pb < A + B and pb < B:\n print(\"Yes\")\n pb += 1\n else:\n print(\"No\")\n","code_v1_no_empty_lines":"N, A, B = map(int, input().split())\nS = input()\nans = [\"No\"] * N\np = b = 0\nfor i, c in enumerate(S):\n if c == \"a\":\n if p < A + B:\n ans[i] = \"Yes\"\n p += 1\n elif c == \"b\":\n if p < A + B and b < B:\n ans[i] = \"Yes\"\n p += 1\n b += 1\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-N, A, B = list(map(int, input().split()))","-S = eval(input())","-pa = pb = 0","-for c in S:","- if c == \"a\" and pa + pb < A + B:","- print(\"Yes\")","- pa += 1","- elif c == \"b\" and pa + pb < A + B and pb < B:","- print(\"Yes\")","- pb += 1","- else:","- print(\"No\")","+N, A, B = map(int, input().split())","+S = input()","+ans = [\"No\"] * N","+p = b = 0","+for i, c in enumerate(S):","+ if c == \"a\":","+ if p < A + B:","+ ans[i] = \"Yes\"","+ p += 1","+ elif c == \"b\":","+ if p < A + B and b < B:","+ ans[i] = \"Yes\"","+ p += 1","+ b += 1","+print(*ans, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373254755,"measured_runtime_v1":0.0369954991,"runtime_lift":1.0089193636,"key":["s031287566","s416565412"]} +{"user_id":"u556589653","problem_id":"p03760","language":"python","submission_id_v0":"s697032204","submission_id_v1":"s280384056","cpu_time_v0":25,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.0,"input":"O = eval(input())\n\nE = eval(input())\n\nP = \"\"\n\nfor i in range(min(len(O),len(E))):\n\n if O[i] == \"\":\n\n break\n\n else:\n\n P = P+O[i]\n\n if E[i] == \"\":\n\n break\n\n else:\n\n P = P+E[i]\n\nif len(O)-len(E) == 1:\n\n P = P+O[-1]\n\nelif len(E)-len(O) == 1:\n\n P = P+E[-1]\n\nelse:\n\n P = P\n\nprint(P)","target":"S = eval(input())\n\nT = eval(input())\n\nans = \"\"\n\nif len(S)>len(T):\n\n for i in range(len(T)):\n\n ans += S[i]\n\n ans += T[i]\n\n ans += S[-1]\n\nelif len(S) len(T):\n for i in range(len(T)):\n ans += S[i]\n ans += T[i]\n ans += S[-1]\nelif len(S) < len(T):\n for i in range(len(S)):\n ans += S[i]\n ans += T[i]\n ans += T[-1]\nelse:\n for i in range(len(T)):\n ans += S[i]\n ans += T[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-O = eval(input())","-E = eval(input())","-P = \"\"","-for i in range(min(len(O), len(E))):","- if O[i] == \"\":","- break","- else:","- P = P + O[i]","- if E[i] == \"\":","- break","- else:","- P = P + E[i]","-if len(O) - len(E) == 1:","- P = P + O[-1]","-elif len(E) - len(O) == 1:","- P = P + E[-1]","+S = eval(input())","+T = eval(input())","+ans = \"\"","+if len(S) > len(T):","+ for i in range(len(T)):","+ ans += S[i]","+ ans += T[i]","+ ans += S[-1]","+elif len(S) < len(T):","+ for i in range(len(S)):","+ ans += S[i]","+ ans += T[i]","+ ans += T[-1]","- P = P","-print(P)","+ for i in range(len(T)):","+ ans += S[i]","+ ans += T[i]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363589209,"measured_runtime_v1":0.0348376843,"runtime_lift":1.0436664089,"key":["s697032204","s280384056"]} +{"user_id":"u747602774","problem_id":"p03759","language":"python","submission_id_v0":"s092056276","submission_id_v1":"s834914232","cpu_time_v0":178,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.45,"input":"a,b,c = list(map(int,input().split()))\n\n \n\nif (b-a) == (c-b):\n\n print('YES')\n\nelse:\n\n print('NO')","target":"a,b,c = list(map(int,input().split()))\n\nprint(('YES' if b-a == c-b else 'NO'))\n","code_v0_loc":6,"code_v1_loc":2,"code_v0_num_chars":93,"code_v1_num_chars":71,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nif (b - a) == (c - b):\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nprint((\"YES\" if b - a == c - b else \"NO\"))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-if (b - a) == (c - b):","- print(\"YES\")","-else:","- print(\"NO\")","+print((\"YES\" if b - a == c - b else \"NO\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0410129948,"measured_runtime_v1":0.036844466,"runtime_lift":1.1131385318,"key":["s092056276","s834914232"]} +{"user_id":"u895408600","problem_id":"p02623","language":"python","submission_id_v0":"s359060406","submission_id_v1":"s845189155","cpu_time_v0":342,"cpu_time_v1":282,"memory_v0":47540,"memory_v1":49068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.54,"input":"N,M,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\n\n\nsumA = [0] * (N+1)\n\nsumB = [0] * (M+1)\n\nfor i in range(N):\n\n sumA[i+1] = sumA[i] + A[i]\n\nfor i in range(M):\n\n sumB[i+1] = sumB[i] + B[i]\n\n\n\nans = 0\n\nimport bisect\n\nfor i in range(N+1):\n\n if K - sumA[i] >= 0:\n\n idx = bisect.bisect_right(sumB,K-sumA[i])\n\n ans = max(ans,i + idx - 1)\n\n# print(idx-1)\n\nprint(ans)","target":"n,m,k = list(map(int,input().split()))\n\na_list = list(map(int,input().split()))\n\nb_list = list(map(int,input().split()))\n\n\n\nfrom itertools import accumulate\n\nimport bisect\n\n\n\nsum_a_list = list(accumulate([0] + a_list))\n\nsum_b_list = list(accumulate([0] + b_list))\n\n\n\nans = 0\n\nb_idx = 0\n\nfor a_idx in range(n+1):\n\n if sum_a_list[a_idx] > k:\n\n continue\n\n\n\n time_rest = k - sum_a_list[a_idx]\n\n b_idx = bisect.bisect_right(sum_b_list,time_rest)\n\n\n\n ans = max(ans, a_idx + b_idx - 1)\n\n\n\nprint(ans)","code_v0_loc":19,"code_v1_loc":22,"code_v0_num_chars":453,"code_v1_num_chars":505,"code_v0_no_empty_lines":"N, M, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nsumA = [0] * (N + 1)\nsumB = [0] * (M + 1)\nfor i in range(N):\n sumA[i + 1] = sumA[i] + A[i]\nfor i in range(M):\n sumB[i + 1] = sumB[i] + B[i]\nans = 0\nimport bisect\n\nfor i in range(N + 1):\n if K - sumA[i] >= 0:\n idx = bisect.bisect_right(sumB, K - sumA[i])\n ans = max(ans, i + idx - 1)\n# print(idx-1)\nprint(ans)\n","code_v1_no_empty_lines":"n, m, k = list(map(int, input().split()))\na_list = list(map(int, input().split()))\nb_list = list(map(int, input().split()))\nfrom itertools import accumulate\nimport bisect\n\nsum_a_list = list(accumulate([0] + a_list))\nsum_b_list = list(accumulate([0] + b_list))\nans = 0\nb_idx = 0\nfor a_idx in range(n + 1):\n if sum_a_list[a_idx] > k:\n continue\n time_rest = k - sum_a_list[a_idx]\n b_idx = bisect.bisect_right(sum_b_list, time_rest)\n ans = max(ans, a_idx + b_idx - 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":13.6363636364,"diff":["-N, M, K = list(map(int, input().split()))","-A = list(map(int, input().split()))","-B = list(map(int, input().split()))","-sumA = [0] * (N + 1)","-sumB = [0] * (M + 1)","-for i in range(N):","- sumA[i + 1] = sumA[i] + A[i]","-for i in range(M):","- sumB[i + 1] = sumB[i] + B[i]","-ans = 0","+n, m, k = list(map(int, input().split()))","+a_list = list(map(int, input().split()))","+b_list = list(map(int, input().split()))","+from itertools import accumulate","-for i in range(N + 1):","- if K - sumA[i] >= 0:","- idx = bisect.bisect_right(sumB, K - sumA[i])","- ans = max(ans, i + idx - 1)","-# print(idx-1)","+sum_a_list = list(accumulate([0] + a_list))","+sum_b_list = list(accumulate([0] + b_list))","+ans = 0","+b_idx = 0","+for a_idx in range(n + 1):","+ if sum_a_list[a_idx] > k:","+ continue","+ time_rest = k - sum_a_list[a_idx]","+ b_idx = bisect.bisect_right(sum_b_list, time_rest)","+ ans = max(ans, a_idx + b_idx - 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0482636125,"measured_runtime_v1":0.0496327159,"runtime_lift":0.9724153028,"key":["s359060406","s845189155"]} +{"user_id":"u549211107","problem_id":"p02887","language":"python","submission_id_v0":"s252928121","submission_id_v1":"s757206005","cpu_time_v0":42,"cpu_time_v1":33,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.43,"input":"N=int(eval(input()))\n\nS=str(eval(input()))\n\nT=0\n\nfor i in range(N-1):\n\n if S[i]==S[i+1]:\n\n T+=1\n\nprint((N-T))","target":"N=int(eval(input()))\n\nS=str(eval(input()))\n\nc=''\n\nt=0\n\nfor s in S:\n\n if s==c:\n\n t+=1\n\n c=s\n\nprint((N-t))","code_v0_loc":7,"code_v1_loc":9,"code_v0_num_chars":105,"code_v1_num_chars":103,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = str(eval(input()))\nT = 0\nfor i in range(N - 1):\n if S[i] == S[i + 1]:\n T += 1\nprint((N - T))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = str(eval(input()))\nc = \"\"\nt = 0\nfor s in S:\n if s == c:\n t += 1\n c = s\nprint((N - t))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-T = 0","-for i in range(N - 1):","- if S[i] == S[i + 1]:","- T += 1","-print((N - T))","+c = \"\"","+t = 0","+for s in S:","+ if s == c:","+ t += 1","+ c = s","+print((N - t))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1211975541,"measured_runtime_v1":0.0797063494,"runtime_lift":1.5205508099,"key":["s252928121","s757206005"]} +{"user_id":"u017810624","problem_id":"p02991","language":"python","submission_id_v0":"s271069215","submission_id_v1":"s111901457","cpu_time_v0":1397,"cpu_time_v1":901,"memory_v0":82532,"memory_v1":110332,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.5,"input":"import copy\n\nn,m=list(map(int,input().split()))\n\nl=[list(map(int,input().split())) for i in range(m)]\n\ns,t=list(map(int,input().split()))\n\n\n\nconnection=[[] for i in range(3*n)]\n\nfor i in range(m):\n\n connection[l[i][0]-1].append(l[i][1]-1+n)\n\n connection[l[i][0]-1+n].append(l[i][1]-1+2*n)\n\n connection[l[i][0]-1+2*n].append(l[i][1]-1)\n\ndistance=[-1 for i in range(3*n)]\n\ndistance[s-1]=0\n\nL=[s-1]\n\nL2=[]\n\nL3=[]\n\nct=1\n\nwhile len(L2)!=3*n and len(L)!=0:\n\n for j in range(len(L)):\n\n for k in range(len(connection[L[j]])):\n\n if distance[connection[L[j]][k]]==-1:\n\n distance[connection[L[j]][k]]=ct\n\n L3.append(connection[L[j]][k])\n\n L2.append(L[j])\n\n L=copy.copy(L3)\n\n L3=[]\n\n ct+=1\n\nif distance[t-1]==-1:\n\n print((-1))\n\nelse:\n\n x=distance[t-1]-distance[s-1]\n\n if x%3==0:\n\n print((x\/\/3))\n\n else:\n\n print((-1))","target":"n,m=list(map(int,input().split()))\n\nl=[list(map(int,input().split())) for i in range(m)]\n\ns,t=list(map(int,input().split()))\n\n\n\nconnection=[[] for i in range(3*n)]\n\nfor i in range(m):\n\n connection[l[i][0]-1].append(l[i][1]-1+n)\n\n connection[l[i][0]-1+n].append(l[i][1]-1+2*n)\n\n connection[l[i][0]-1+2*n].append(l[i][1]-1)\n\n\n\ndef bfs(v):\n\n distance=[-1]*(3*n)\n\n distance[v]=0\n\n next=connection[v]\n\n next2=set()\n\n visited=[-1]*(3*n)\n\n visited[v]=1\n\n visitct=1\n\n ct=0\n\n while len(next)!=0 and visitct!=3*n:\n\n ct+=1\n\n for i in range(len(next)):\n\n if visited[next[i]]==-1:\n\n distance[next[i]]=ct\n\n visited[next[i]]=1\n\n visitct+=1\n\n for j in range(len(connection[next[i]])):\n\n if visited[connection[next[i]][j]]==-1:\n\n next2.add(connection[next[i]][j])\n\n next=list(next2)\n\n next2=set()\n\n return distance\n\n\n\nif bfs(s-1)[t-1]==-1 or bfs(s-1)[t-1]%3!=0:\n\n print((-1))\n\nelse:\n\n print((bfs(s-1)[t-1]\/\/3))","code_v0_loc":34,"code_v1_loc":37,"code_v0_num_chars":828,"code_v1_num_chars":957,"code_v0_no_empty_lines":"import copy\n\nn, m = list(map(int, input().split()))\nl = [list(map(int, input().split())) for i in range(m)]\ns, t = list(map(int, input().split()))\nconnection = [[] for i in range(3 * n)]\nfor i in range(m):\n connection[l[i][0] - 1].append(l[i][1] - 1 + n)\n connection[l[i][0] - 1 + n].append(l[i][1] - 1 + 2 * n)\n connection[l[i][0] - 1 + 2 * n].append(l[i][1] - 1)\ndistance = [-1 for i in range(3 * n)]\ndistance[s - 1] = 0\nL = [s - 1]\nL2 = []\nL3 = []\nct = 1\nwhile len(L2) != 3 * n and len(L) != 0:\n for j in range(len(L)):\n for k in range(len(connection[L[j]])):\n if distance[connection[L[j]][k]] == -1:\n distance[connection[L[j]][k]] = ct\n L3.append(connection[L[j]][k])\n L2.append(L[j])\n L = copy.copy(L3)\n L3 = []\n ct += 1\nif distance[t - 1] == -1:\n print((-1))\nelse:\n x = distance[t - 1] - distance[s - 1]\n if x % 3 == 0:\n print((x \/\/ 3))\n else:\n print((-1))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nl = [list(map(int, input().split())) for i in range(m)]\ns, t = list(map(int, input().split()))\nconnection = [[] for i in range(3 * n)]\nfor i in range(m):\n connection[l[i][0] - 1].append(l[i][1] - 1 + n)\n connection[l[i][0] - 1 + n].append(l[i][1] - 1 + 2 * n)\n connection[l[i][0] - 1 + 2 * n].append(l[i][1] - 1)\n\n\ndef bfs(v):\n distance = [-1] * (3 * n)\n distance[v] = 0\n next = connection[v]\n next2 = set()\n visited = [-1] * (3 * n)\n visited[v] = 1\n visitct = 1\n ct = 0\n while len(next) != 0 and visitct != 3 * n:\n ct += 1\n for i in range(len(next)):\n if visited[next[i]] == -1:\n distance[next[i]] = ct\n visited[next[i]] = 1\n visitct += 1\n for j in range(len(connection[next[i]])):\n if visited[connection[next[i]][j]] == -1:\n next2.add(connection[next[i]][j])\n next = list(next2)\n next2 = set()\n return distance\n\n\nif bfs(s - 1)[t - 1] == -1 or bfs(s - 1)[t - 1] % 3 != 0:\n print((-1))\nelse:\n print((bfs(s - 1)[t - 1] \/\/ 3))\n","code_same":false,"relative_loc_diff_percent":8.1081081081,"diff":["-import copy","-","-distance = [-1 for i in range(3 * n)]","-distance[s - 1] = 0","-L = [s - 1]","-L2 = []","-L3 = []","-ct = 1","-while len(L2) != 3 * n and len(L) != 0:","- for j in range(len(L)):","- for k in range(len(connection[L[j]])):","- if distance[connection[L[j]][k]] == -1:","- distance[connection[L[j]][k]] = ct","- L3.append(connection[L[j]][k])","- L2.append(L[j])","- L = copy.copy(L3)","- L3 = []","- ct += 1","-if distance[t - 1] == -1:","+","+","+def bfs(v):","+ distance = [-1] * (3 * n)","+ distance[v] = 0","+ next = connection[v]","+ next2 = set()","+ visited = [-1] * (3 * n)","+ visited[v] = 1","+ visitct = 1","+ ct = 0","+ while len(next) != 0 and visitct != 3 * n:","+ ct += 1","+ for i in range(len(next)):","+ if visited[next[i]] == -1:","+ distance[next[i]] = ct","+ visited[next[i]] = 1","+ visitct += 1","+ for j in range(len(connection[next[i]])):","+ if visited[connection[next[i]][j]] == -1:","+ next2.add(connection[next[i]][j])","+ next = list(next2)","+ next2 = set()","+ return distance","+","+","+if bfs(s - 1)[t - 1] == -1 or bfs(s - 1)[t - 1] % 3 != 0:","- x = distance[t - 1] - distance[s - 1]","- if x % 3 == 0:","- print((x \/\/ 3))","- else:","- print((-1))","+ print((bfs(s - 1)[t - 1] \/\/ 3))"],"diff_only_import_comment":false,"measured_runtime_v0":0.046001689,"measured_runtime_v1":0.0811669533,"runtime_lift":0.5667539198,"key":["s271069215","s111901457"]} +{"user_id":"u316464887","problem_id":"p04013","language":"python","submission_id_v0":"s921921249","submission_id_v1":"s568499646","cpu_time_v0":569,"cpu_time_v1":78,"memory_v0":129080,"memory_v1":65820,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.29,"input":"import copy\n\ndef main():\n\n N, A = list(map(int, input().split()))\n\n x = list(map(int, input().split()))\n\n dp = [[0] * (50*N + 1) for _ in range(N+1)]\n\n dp[0][0] = 1\n\n for k in range(N):\n\n dpn = copy.deepcopy(dp)\n\n for i in range(k+1):\n\n for j in range(50 * N + 1 -x[k]):\n\n dpn[i+1][j+x[k]] += dp[i][j]\n\n dp = dpn\n\n r = 0\n\n for i in range(1, N+1):\n\n r += dp[i][i*A]\n\n return r\n\nprint((main()))\n","target":"def main():\n\n N, A = list(map(int, input().split()))\n\n x = list(map(int, input().split()))\n\n dp = [[0] * (50*N + 1) for _ in range(N+1)]\n\n dp[0][0] = 1\n\n for k in range(N):\n\n for i in reversed(list(range(k+1))):\n\n for j in range(50 * N + 1 -x[k]):\n\n dp[i+1][j+x[k]] += dp[i][j]\n\n r = 0\n\n for i in range(1, N+1):\n\n r += dp[i][i*A]\n\n return r\n\nprint((main()))\n","code_v0_loc":17,"code_v1_loc":14,"code_v0_num_chars":463,"code_v1_num_chars":408,"code_v0_no_empty_lines":"import copy\n\n\ndef main():\n N, A = list(map(int, input().split()))\n x = list(map(int, input().split()))\n dp = [[0] * (50 * N + 1) for _ in range(N + 1)]\n dp[0][0] = 1\n for k in range(N):\n dpn = copy.deepcopy(dp)\n for i in range(k + 1):\n for j in range(50 * N + 1 - x[k]):\n dpn[i + 1][j + x[k]] += dp[i][j]\n dp = dpn\n r = 0\n for i in range(1, N + 1):\n r += dp[i][i * A]\n return r\n\n\nprint((main()))\n","code_v1_no_empty_lines":"def main():\n N, A = list(map(int, input().split()))\n x = list(map(int, input().split()))\n dp = [[0] * (50 * N + 1) for _ in range(N + 1)]\n dp[0][0] = 1\n for k in range(N):\n for i in reversed(list(range(k + 1))):\n for j in range(50 * N + 1 - x[k]):\n dp[i + 1][j + x[k]] += dp[i][j]\n r = 0\n for i in range(1, N + 1):\n r += dp[i][i * A]\n return r\n\n\nprint((main()))\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["-import copy","-","-","- dpn = copy.deepcopy(dp)","- for i in range(k + 1):","+ for i in reversed(list(range(k + 1))):","- dpn[i + 1][j + x[k]] += dp[i][j]","- dp = dpn","+ dp[i + 1][j + x[k]] += dp[i][j]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0627568245,"measured_runtime_v1":0.0394915104,"runtime_lift":1.5891219114,"key":["s921921249","s568499646"]} +{"user_id":"u968166680","problem_id":"p03108","language":"python","submission_id_v0":"s784396398","submission_id_v1":"s501538105","cpu_time_v0":734,"cpu_time_v1":443,"memory_v0":115060,"memory_v1":25564,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.65,"input":"import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\nclass UnionFind:\n\n # Reference: https:\/\/note.nkmk.me\/python-union-find\/\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n\n\nN, M, *AB = map(int, read().split())\n\nuf = UnionFind(N)\n\nans = [N * (N - 1) \/\/ 2]\n\n\n\nfor a, b in zip(AB[-2:0:-2], AB[-1:1:-2]):\n\n a -= 1\n\n b -= 1\n\n if uf.same(a, b):\n\n ans.append(ans[-1])\n\n else:\n\n ans.append(ans[-1] - uf.parents[uf.find(a)] * uf.parents[uf.find(b)])\n\n uf.union(a, b)\n\n\n\nprint(*reversed(ans), sep='\\n')\n","target":"import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\nclass UnionFind:\n\n # Reference: https:\/\/note.nkmk.me\/python-union-find\/\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def members(self, x):\n\n root = self.find(x)\n\n return [i for i in range(self.n) if self.find(i) == root]\n\n\n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n\n\n def group_count(self):\n\n return len(self.roots())\n\n\n\n\n\ndef main():\n\n N, M, *AB = map(int, read().split())\n\n\n\n count = N * (N - 1) \/\/ 2\n\n ans = [count]\n\n uf = UnionFind(N)\n\n\n\n for a, b in zip(reversed(AB[::2]), reversed(AB[1::2])):\n\n a -= 1\n\n b -= 1\n\n if not uf.same(a, b):\n\n count -= uf.size(a) * uf.size(b)\n\n uf.union(a, b)\n\n ans.append(count)\n\n\n\n print(*reversed(ans[:-1]), sep='\\n')\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":53,"code_v1_loc":73,"code_v0_num_chars":1203,"code_v1_num_chars":1653,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\nclass UnionFind:\n # Reference: https:\/\/note.nkmk.me\/python-union-find\/\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n\nN, M, *AB = map(int, read().split())\nuf = UnionFind(N)\nans = [N * (N - 1) \/\/ 2]\nfor a, b in zip(AB[-2:0:-2], AB[-1:1:-2]):\n a -= 1\n b -= 1\n if uf.same(a, b):\n ans.append(ans[-1])\n else:\n ans.append(ans[-1] - uf.parents[uf.find(a)] * uf.parents[uf.find(b)])\n uf.union(a, b)\nprint(*reversed(ans), sep=\"\\n\")\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\nclass UnionFind:\n # Reference: https:\/\/note.nkmk.me\/python-union-find\/\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n\ndef main():\n N, M, *AB = map(int, read().split())\n count = N * (N - 1) \/\/ 2\n ans = [count]\n uf = UnionFind(N)\n for a, b in zip(reversed(AB[::2]), reversed(AB[1::2])):\n a -= 1\n b -= 1\n if not uf.same(a, b):\n count -= uf.size(a) * uf.size(b)\n uf.union(a, b)\n ans.append(count)\n print(*reversed(ans[:-1]), sep=\"\\n\")\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":27.397260274,"diff":["+ def size(self, x):","+ return -self.parents[self.find(x)]","+","+ def members(self, x):","+ root = self.find(x)","+ return [i for i in range(self.n) if self.find(i) == root]","-N, M, *AB = map(int, read().split())","-uf = UnionFind(N)","-ans = [N * (N - 1) \/\/ 2]","-for a, b in zip(AB[-2:0:-2], AB[-1:1:-2]):","- a -= 1","- b -= 1","- if uf.same(a, b):","- ans.append(ans[-1])","- else:","- ans.append(ans[-1] - uf.parents[uf.find(a)] * uf.parents[uf.find(b)])","- uf.union(a, b)","-print(*reversed(ans), sep=\"\\n\")","+ def roots(self):","+ return [i for i, x in enumerate(self.parents) if x < 0]","+","+ def group_count(self):","+ return len(self.roots())","+","+","+def main():","+ N, M, *AB = map(int, read().split())","+ count = N * (N - 1) \/\/ 2","+ ans = [count]","+ uf = UnionFind(N)","+ for a, b in zip(reversed(AB[::2]), reversed(AB[1::2])):","+ a -= 1","+ b -= 1","+ if not uf.same(a, b):","+ count -= uf.size(a) * uf.size(b)","+ uf.union(a, b)","+ ans.append(count)","+ print(*reversed(ans[:-1]), sep=\"\\n\")","+ return","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.1622922432,"measured_runtime_v1":0.1081213329,"runtime_lift":1.5010196314,"key":["s784396398","s501538105"]} +{"user_id":"u945181840","problem_id":"p03364","language":"python","submission_id_v0":"s909735053","submission_id_v1":"s694604688","cpu_time_v0":1847,"cpu_time_v1":1629,"memory_v0":43880,"memory_v1":15116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.8,"input":"import sys\n\nfrom itertools import product\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\n\n\nN, *S = list(map(str, read().split()))\n\nN = int(N)\n\nx = 0\n\nanswer = 0\n\nfor y in range(N):\n\n for i, j in product(list(range(N)), repeat=2):\n\n if S[(i + x) % N][(j + y) % N] != S[(j + x) % N][(i + y) % N]:\n\n break\n\n else:\n\n answer += N\n\n\n\nprint(answer)\n","target":"import sys\n\nimport numpy as np\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\n\n\nN, *S = list(map(str, read().split()))\n\nS = np.array(list(map(list, S)), np.str)\n\nN = int(N)\n\nanswer = 0\n\nfor y in range(N):\n\n for i in range(N):\n\n a = S[i, y:].tolist() + S[i, :y].tolist()\n\n b = S[:, (i + y) % N].tolist()\n\n if a != b:\n\n break\n\n else:\n\n answer += N\n\n\n\nprint(answer)\n","code_v0_loc":18,"code_v1_loc":20,"code_v0_num_chars":371,"code_v1_num_chars":412,"code_v0_no_empty_lines":"import sys\nfrom itertools import product\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nN, *S = list(map(str, read().split()))\nN = int(N)\nx = 0\nanswer = 0\nfor y in range(N):\n for i, j in product(list(range(N)), repeat=2):\n if S[(i + x) % N][(j + y) % N] != S[(j + x) % N][(i + y) % N]:\n break\n else:\n answer += N\nprint(answer)\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nN, *S = list(map(str, read().split()))\nS = np.array(list(map(list, S)), np.str)\nN = int(N)\nanswer = 0\nfor y in range(N):\n for i in range(N):\n a = S[i, y:].tolist() + S[i, :y].tolist()\n b = S[:, (i + y) % N].tolist()\n if a != b:\n break\n else:\n answer += N\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-from itertools import product","+import numpy as np","+S = np.array(list(map(list, S)), np.str)","-x = 0","- for i, j in product(list(range(N)), repeat=2):","- if S[(i + x) % N][(j + y) % N] != S[(j + x) % N][(i + y) % N]:","+ for i in range(N):","+ a = S[i, y:].tolist() + S[i, :y].tolist()","+ b = S[:, (i + y) % N].tolist()","+ if a != b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0470104721,"measured_runtime_v1":0.2499037232,"runtime_lift":0.1881143324,"key":["s909735053","s694604688"]} +{"user_id":"u941753895","problem_id":"p03854","language":"python","submission_id_v0":"s715839945","submission_id_v1":"s672394322","cpu_time_v0":88,"cpu_time_v1":67,"memory_v0":6552,"memory_v1":6360,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.86,"input":"import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf=10**20\n\nmod=10**9+7\n\n\n\ndef LI(): return list(map(int,input().split()))\n\ndef I(): return int(eval(input()))\n\ndef LS(): return input().split()\n\ndef S(): return eval(input())\n\n\n\ndef main():\n\n s=S()\n\n\n\n l=['dream','dreamer','erase','eraser']\n\n\n\n while True:\n\n a=s[-5:]\n\n b=s[-7:]\n\n c=s[-6:]\n\n\n\n if a==l[0]:\n\n s=s[:-5]\n\n elif b==l[1]:\n\n s=s[:-7]\n\n elif a==l[2]:\n\n s=s[:-5]\n\n elif c==l[3]:\n\n s=s[:-6]\n\n else:\n\n if s=='':\n\n return 'YES'\n\n else:\n\n return 'NO'\n\n\n\nprint((main()))\n","target":"import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf=10**20\n\nmod=10**9+7\n\n\n\ndef LI(): return list(map(int,input().split()))\n\ndef I(): return int(eval(input()))\n\ndef LS(): return input().split()\n\ndef S(): return eval(input())\n\n\n\ndef main():\n\n s=list(S())\n\n\n\n l=[['d', 'r', 'e', 'a', 'm'],\n\n ['d', 'r', 'e', 'a', 'm', 'e', 'r'],\n\n ['e', 'r', 'a', 's', 'e'],\n\n ['e', 'r', 'a', 's', 'e', 'r']]\n\n\n\n while True:\n\n if len(s)<=4:\n\n break\n\n else:\n\n if l[0]==s[-5:]:\n\n [s.pop() for _ in ' '*5]\n\n elif l[1]==s[-7:]:\n\n [s.pop() for _ in ' '*7]\n\n elif l[2]==s[-5:]:\n\n [s.pop() for _ in ' '*5]\n\n elif l[3]==s[-6:]:\n\n [s.pop() for _ in ' '*6]\n\n else:\n\n return 'NO'\n\n\n\n if len(s)==0:\n\n return 'YES'\n\n return 'NO'\n\n\n\nprint((main()))\n","code_v0_loc":36,"code_v1_loc":39,"code_v0_num_chars":654,"code_v1_num_chars":857,"code_v0_no_empty_lines":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef I():\n return int(eval(input()))\n\n\ndef LS():\n return input().split()\n\n\ndef S():\n return eval(input())\n\n\ndef main():\n s = S()\n l = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\n while True:\n a = s[-5:]\n b = s[-7:]\n c = s[-6:]\n if a == l[0]:\n s = s[:-5]\n elif b == l[1]:\n s = s[:-7]\n elif a == l[2]:\n s = s[:-5]\n elif c == l[3]:\n s = s[:-6]\n else:\n if s == \"\":\n return \"YES\"\n else:\n return \"NO\"\n\n\nprint((main()))\n","code_v1_no_empty_lines":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef I():\n return int(eval(input()))\n\n\ndef LS():\n return input().split()\n\n\ndef S():\n return eval(input())\n\n\ndef main():\n s = list(S())\n l = [\n [\"d\", \"r\", \"e\", \"a\", \"m\"],\n [\"d\", \"r\", \"e\", \"a\", \"m\", \"e\", \"r\"],\n [\"e\", \"r\", \"a\", \"s\", \"e\"],\n [\"e\", \"r\", \"a\", \"s\", \"e\", \"r\"],\n ]\n while True:\n if len(s) <= 4:\n break\n else:\n if l[0] == s[-5:]:\n [s.pop() for _ in \" \" * 5]\n elif l[1] == s[-7:]:\n [s.pop() for _ in \" \" * 7]\n elif l[2] == s[-5:]:\n [s.pop() for _ in \" \" * 5]\n elif l[3] == s[-6:]:\n [s.pop() for _ in \" \" * 6]\n else:\n return \"NO\"\n if len(s) == 0:\n return \"YES\"\n return \"NO\"\n\n\nprint((main()))\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["- s = S()","- l = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]","+ s = list(S())","+ l = [","+ [\"d\", \"r\", \"e\", \"a\", \"m\"],","+ [\"d\", \"r\", \"e\", \"a\", \"m\", \"e\", \"r\"],","+ [\"e\", \"r\", \"a\", \"s\", \"e\"],","+ [\"e\", \"r\", \"a\", \"s\", \"e\", \"r\"],","+ ]","- a = s[-5:]","- b = s[-7:]","- c = s[-6:]","- if a == l[0]:","- s = s[:-5]","- elif b == l[1]:","- s = s[:-7]","- elif a == l[2]:","- s = s[:-5]","- elif c == l[3]:","- s = s[:-6]","+ if len(s) <= 4:","+ break","- if s == \"\":","- return \"YES\"","+ if l[0] == s[-5:]:","+ [s.pop() for _ in \" \" * 5]","+ elif l[1] == s[-7:]:","+ [s.pop() for _ in \" \" * 7]","+ elif l[2] == s[-5:]:","+ [s.pop() for _ in \" \" * 5]","+ elif l[3] == s[-6:]:","+ [s.pop() for _ in \" \" * 6]","+ if len(s) == 0:","+ return \"YES\"","+ return \"NO\""],"diff_only_import_comment":false,"measured_runtime_v0":0.0943376515,"measured_runtime_v1":0.0773122838,"runtime_lift":1.2202155582,"key":["s715839945","s672394322"]} +{"user_id":"u537782349","problem_id":"p03456","language":"python","submission_id_v0":"s287002556","submission_id_v1":"s997146817","cpu_time_v0":24,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.17,"input":"a, b = input().split()\n\nc = int(a + b)\n\nprint((\"Yes\" if c ** 0.5 % 1 == 0 else \"No\"))\n","target":"a, b = list(map(str, input().split()))\n\nc = int(a + b)\n\nif c ** 0.5 == int(c ** 0.5):\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n","code_v0_loc":3,"code_v1_loc":6,"code_v0_num_chars":84,"code_v1_num_chars":122,"code_v0_no_empty_lines":"a, b = input().split()\nc = int(a + b)\nprint((\"Yes\" if c**0.5 % 1 == 0 else \"No\"))\n","code_v1_no_empty_lines":"a, b = list(map(str, input().split()))\nc = int(a + b)\nif c**0.5 == int(c**0.5):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-a, b = input().split()","+a, b = list(map(str, input().split()))","-print((\"Yes\" if c**0.5 % 1 == 0 else \"No\"))","+if c**0.5 == int(c**0.5):","+ print(\"Yes\")","+else:","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0877285697,"measured_runtime_v1":0.0368235168,"runtime_lift":2.382406061,"key":["s287002556","s997146817"]} +{"user_id":"u072053884","problem_id":"p02326","language":"python","submission_id_v0":"s796994901","submission_id_v1":"s954079951","cpu_time_v0":1640,"cpu_time_v1":1040,"memory_v0":45860,"memory_v1":7728,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.59,"input":"import sys\n\n\n\ndef solve():\n\n file_input = sys.stdin\n\n H, W = list(map(int, file_input.readline().split()))\n\n dp = [[0] * (W + 1)]\n\n for line in file_input:\n\n dp.append([0] + list(map(int, line.split())))\n\n max_width = 0\n\n for i in range(1, H + 1):\n\n for j in range(1, W + 1):\n\n if dp[i][j] == 1:\n\n dp[i][j] = 0\n\n else:\n\n dp[i][j] = min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) + 1\n\n max_width = max(max_width, dp[i][j])\n\n print((max_width ** 2))\n\n\n\nsolve()","target":"import sys\n\n\n\ndef solve():\n\n file_input = sys.stdin\n\n H, W = list(map(int, file_input.readline().split()))\n\n side_length = 0\n\n prev = [0] * (W + 1)\n\n for line in file_input:\n\n tile_line = list(map(int, line.split()))\n\n current = [0] * (W + 1)\n\n for i, tpl in enumerate(zip(tile_line, prev, prev[1:]), start=1):\n\n t, p1, p2 = tpl\n\n if t:\n\n current[i] = 0\n\n else:\n\n current[i] = min(p1, p2, current[i - 1]) + 1\n\n prev = current\n\n side_length = max(side_length, max(current))\n\n print((side_length ** 2))\n\n\n\nsolve()","code_v0_loc":19,"code_v1_loc":21,"code_v0_num_chars":555,"code_v1_num_chars":613,"code_v0_no_empty_lines":"import sys\n\n\ndef solve():\n file_input = sys.stdin\n H, W = list(map(int, file_input.readline().split()))\n dp = [[0] * (W + 1)]\n for line in file_input:\n dp.append([0] + list(map(int, line.split())))\n max_width = 0\n for i in range(1, H + 1):\n for j in range(1, W + 1):\n if dp[i][j] == 1:\n dp[i][j] = 0\n else:\n dp[i][j] = min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) + 1\n max_width = max(max_width, dp[i][j])\n print((max_width**2))\n\n\nsolve()\n","code_v1_no_empty_lines":"import sys\n\n\ndef solve():\n file_input = sys.stdin\n H, W = list(map(int, file_input.readline().split()))\n side_length = 0\n prev = [0] * (W + 1)\n for line in file_input:\n tile_line = list(map(int, line.split()))\n current = [0] * (W + 1)\n for i, tpl in enumerate(zip(tile_line, prev, prev[1:]), start=1):\n t, p1, p2 = tpl\n if t:\n current[i] = 0\n else:\n current[i] = min(p1, p2, current[i - 1]) + 1\n prev = current\n side_length = max(side_length, max(current))\n print((side_length**2))\n\n\nsolve()\n","code_same":false,"relative_loc_diff_percent":9.5238095238,"diff":["- dp = [[0] * (W + 1)]","+ side_length = 0","+ prev = [0] * (W + 1)","- dp.append([0] + list(map(int, line.split())))","- max_width = 0","- for i in range(1, H + 1):","- for j in range(1, W + 1):","- if dp[i][j] == 1:","- dp[i][j] = 0","+ tile_line = list(map(int, line.split()))","+ current = [0] * (W + 1)","+ for i, tpl in enumerate(zip(tile_line, prev, prev[1:]), start=1):","+ t, p1, p2 = tpl","+ if t:","+ current[i] = 0","- dp[i][j] = min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) + 1","- max_width = max(max_width, dp[i][j])","- print((max_width**2))","+ current[i] = min(p1, p2, current[i - 1]) + 1","+ prev = current","+ side_length = max(side_length, max(current))","+ print((side_length**2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.046252198,"measured_runtime_v1":0.0789872646,"runtime_lift":0.5855652578,"key":["s796994901","s954079951"]} +{"user_id":"u546338822","problem_id":"p02627","language":"python","submission_id_v0":"s981029919","submission_id_v1":"s178526078","cpu_time_v0":31,"cpu_time_v1":26,"memory_v0":9108,"memory_v1":9000,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.13,"input":"def main():\n\n a = eval(input())\n\n if a in ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']:\n\n print('A')\n\n else:\n\n print('a')\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"def main():\n\n s = eval(input())\n\n ko = [i for i in range(ord('a'),ord('z')+1)]\n\n if ord(s) in ko:\n\n print('a')\n\n else:\n\n print('A')\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":9,"code_v1_loc":10,"code_v0_num_chars":242,"code_v1_num_chars":194,"code_v0_no_empty_lines":"def main():\n a = eval(input())\n if a in [\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n ]:\n print(\"A\")\n else:\n print(\"a\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n s = eval(input())\n ko = [i for i in range(ord(\"a\"), ord(\"z\") + 1)]\n if ord(s) in ko:\n print(\"a\")\n else:\n print(\"A\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["- a = eval(input())","- if a in [","- \"A\",","- \"B\",","- \"C\",","- \"D\",","- \"E\",","- \"F\",","- \"G\",","- \"H\",","- \"I\",","- \"J\",","- \"K\",","- \"L\",","- \"M\",","- \"N\",","- \"O\",","- \"P\",","- \"Q\",","- \"R\",","- \"S\",","- \"T\",","- \"U\",","- \"V\",","- \"W\",","- \"X\",","- \"Y\",","- \"Z\",","- ]:","+ s = eval(input())","+ ko = [i for i in range(ord(\"a\"), ord(\"z\") + 1)]","+ if ord(s) in ko:","+ print(\"a\")","+ else:","- else:","- print(\"a\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0359053969,"measured_runtime_v1":0.0378691903,"runtime_lift":0.9481427157,"key":["s981029919","s178526078"]} +{"user_id":"u729133443","problem_id":"p02975","language":"python","submission_id_v0":"s504912269","submission_id_v1":"s005127989","cpu_time_v0":55,"cpu_time_v1":50,"memory_v0":11632,"memory_v1":15096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.09,"input":"from functools import*;_,a=open(0);print(('YNeos'[reduce(lambda x,y:x^y,list(map(int,a.split())))>0::2]))","target":"_,a=open(0);a,*b=list(map(int,a.split()))\n\nfor b in b:a^=b\n\nprint(('YNeos'[a>0::2]))","code_v0_loc":1,"code_v1_loc":3,"code_v0_num_chars":97,"code_v1_num_chars":76,"code_v0_no_empty_lines":"from functools import *\n\n_, a = open(0)\nprint((\"YNeos\"[reduce(lambda x, y: x ^ y, list(map(int, a.split()))) > 0 :: 2]))\n","code_v1_no_empty_lines":"_, a = open(0)\na, *b = list(map(int, a.split()))\nfor b in b:\n a ^= b\nprint((\"YNeos\"[a > 0 :: 2]))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-from functools import *","-","-print((\"YNeos\"[reduce(lambda x, y: x ^ y, list(map(int, a.split()))) > 0 :: 2]))","+a, *b = list(map(int, a.split()))","+for b in b:","+ a ^= b","+print((\"YNeos\"[a > 0 :: 2]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.043463175,"measured_runtime_v1":0.0377413352,"runtime_lift":1.1516067142,"key":["s504912269","s005127989"]} +{"user_id":"u227082700","problem_id":"p02558","language":"python","submission_id_v0":"s634864726","submission_id_v1":"s753493106","cpu_time_v0":808,"cpu_time_v1":458,"memory_v0":13044,"memory_v1":13276,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.32,"input":"# UnionFind\n\nimport sys\n\nsys.setrecursionlimit(10**9)\n\nclass UnionFind:\n\n def __init__(self, n):\n\n self.n = [-1]*n\n\n self.r = [0]*n\n\n self.siz = n\n\n\n\n def find_root(self, x):\n\n if self.n[x] < 0:\n\n return x\n\n else:\n\n self.n[x] = self.find_root(self.n[x])\n\n return self.n[x]\n\n\n\n def unite(self, x, y):\n\n x = self.find_root(x)\n\n y = self.find_root(y)\n\n if x == y:\n\n return\n\n elif self.r[x] > self.r[y]:\n\n self.n[x] += self.n[y]\n\n self.n[y] = x\n\n else:\n\n self.n[y] += self.n[x]\n\n self.n[x] = y\n\n if self.r[x] == self.r[y]:\n\n self.r[y] += 1\n\n self.siz -= 1\n\n\n\n def root_same(self, x, y):\n\n return self.find_root(x) == self.find_root(y)\n\n\n\n def count(self, x):\n\n return -self.n[self.find_root(x)]\n\n\n\n def size(self):\n\n return self.siz\n\n\n\nn,q=list(map(int,input().split()))\n\nuf=UnionFind(n)\n\nfor _ in range(q):\n\n t,u,v=list(map(int,input().split()))\n\n if t==0:\n\n uf.unite(u,v)\n\n else:\n\n print((uf.root_same(u,v)+0))","target":"# UnionFind\n\nimport sys\n\ndef input(): return sys.stdin.readline().rstrip()\n\nsys.setrecursionlimit(10**9)\n\nclass UnionFind:\n\n def __init__(self, n):\n\n self.n = [-1]*n\n\n self.r = [0]*n\n\n self.siz = n\n\n\n\n def find_root(self, x):\n\n if self.n[x] < 0:\n\n return x\n\n else:\n\n self.n[x] = self.find_root(self.n[x])\n\n return self.n[x]\n\n\n\n def unite(self, x, y):\n\n x = self.find_root(x)\n\n y = self.find_root(y)\n\n if x == y:\n\n return\n\n elif self.r[x] > self.r[y]:\n\n self.n[x] += self.n[y]\n\n self.n[y] = x\n\n else:\n\n self.n[y] += self.n[x]\n\n self.n[x] = y\n\n if self.r[x] == self.r[y]:\n\n self.r[y] += 1\n\n self.siz -= 1\n\n\n\n def root_same(self, x, y):\n\n return self.find_root(x) == self.find_root(y)\n\n\n\n def count(self, x):\n\n return -self.n[self.find_root(x)]\n\n\n\n def size(self):\n\n return self.siz\n\n\n\nn,q=list(map(int,input().split()))\n\nuf=UnionFind(n)\n\nfor _ in range(q):\n\n t,u,v=list(map(int,input().split()))\n\n if t==0:\n\n uf.unite(u,v)\n\n else:\n\n print((uf.root_same(u,v)+0))","code_v0_loc":48,"code_v1_loc":49,"code_v0_num_chars":1003,"code_v1_num_chars":1054,"code_v0_no_empty_lines":"# UnionFind\nimport sys\n\nsys.setrecursionlimit(10**9)\n\n\nclass UnionFind:\n def __init__(self, n):\n self.n = [-1] * n\n self.r = [0] * n\n self.siz = n\n\n def find_root(self, x):\n if self.n[x] < 0:\n return x\n else:\n self.n[x] = self.find_root(self.n[x])\n return self.n[x]\n\n def unite(self, x, y):\n x = self.find_root(x)\n y = self.find_root(y)\n if x == y:\n return\n elif self.r[x] > self.r[y]:\n self.n[x] += self.n[y]\n self.n[y] = x\n else:\n self.n[y] += self.n[x]\n self.n[x] = y\n if self.r[x] == self.r[y]:\n self.r[y] += 1\n self.siz -= 1\n\n def root_same(self, x, y):\n return self.find_root(x) == self.find_root(y)\n\n def count(self, x):\n return -self.n[self.find_root(x)]\n\n def size(self):\n return self.siz\n\n\nn, q = list(map(int, input().split()))\nuf = UnionFind(n)\nfor _ in range(q):\n t, u, v = list(map(int, input().split()))\n if t == 0:\n uf.unite(u, v)\n else:\n print((uf.root_same(u, v) + 0))\n","code_v1_no_empty_lines":"# UnionFind\nimport sys\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\nsys.setrecursionlimit(10**9)\n\n\nclass UnionFind:\n def __init__(self, n):\n self.n = [-1] * n\n self.r = [0] * n\n self.siz = n\n\n def find_root(self, x):\n if self.n[x] < 0:\n return x\n else:\n self.n[x] = self.find_root(self.n[x])\n return self.n[x]\n\n def unite(self, x, y):\n x = self.find_root(x)\n y = self.find_root(y)\n if x == y:\n return\n elif self.r[x] > self.r[y]:\n self.n[x] += self.n[y]\n self.n[y] = x\n else:\n self.n[y] += self.n[x]\n self.n[x] = y\n if self.r[x] == self.r[y]:\n self.r[y] += 1\n self.siz -= 1\n\n def root_same(self, x, y):\n return self.find_root(x) == self.find_root(y)\n\n def count(self, x):\n return -self.n[self.find_root(x)]\n\n def size(self):\n return self.siz\n\n\nn, q = list(map(int, input().split()))\nuf = UnionFind(n)\nfor _ in range(q):\n t, u, v = list(map(int, input().split()))\n if t == 0:\n uf.unite(u, v)\n else:\n print((uf.root_same(u, v) + 0))\n","code_same":false,"relative_loc_diff_percent":2.0408163265,"diff":["+","+","+def input():","+ return sys.stdin.readline().rstrip()","+"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376420603,"measured_runtime_v1":0.0357395165,"runtime_lift":1.0532336181,"key":["s634864726","s753493106"]} +{"user_id":"u543954314","problem_id":"p03645","language":"python","submission_id_v0":"s307861133","submission_id_v1":"s026902406","cpu_time_v0":889,"cpu_time_v1":436,"memory_v0":62916,"memory_v1":48612,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.96,"input":"n, m = list(map(int, input().split()))\n\nl = [tuple(map(int, input().split())) for i in range(m)]\n\nc = [[] for _ in range(n+1)]\n\nfor x in l:\n\n c[x[0]].append(x[1])\n\n c[x[1]].append(x[0])\n\nif set(c[1])&set(c[n]):\n\n print(\"POSSIBLE\")\n\nelse:\n\n print(\"IMPOSSIBLE\")","target":"import sys\n\n\n\nreadline = sys.stdin.buffer.readline\n\nni = lambda: int(readline().rstrip())\n\nnm = lambda: list(map(int, readline().split()))\n\nnl = lambda: list(map(int, readline().split()))\n\n\n\ndef solve():\n\n n, m = nm()\n\n G = [list() for _ in range(n)]\n\n for _ in range(m):\n\n u, v = nm()\n\n u -= 1; v -= 1\n\n G[u].append(v)\n\n G[v].append(u)\n\n if (set(G[0]) & set(G[n-1])):\n\n print('POSSIBLE')\n\n else:\n\n print('IMPOSSIBLE')\n\n return\n\n\n\nsolve()\n\n\n\n# T = ni()\n\n# for _ in range(T):\n\n# solve()\n","code_v0_loc":10,"code_v1_loc":26,"code_v0_num_chars":265,"code_v1_num_chars":544,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nl = [tuple(map(int, input().split())) for i in range(m)]\nc = [[] for _ in range(n + 1)]\nfor x in l:\n c[x[0]].append(x[1])\n c[x[1]].append(x[0])\nif set(c[1]) & set(c[n]):\n print(\"POSSIBLE\")\nelse:\n print(\"IMPOSSIBLE\")\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.buffer.readline\nni = lambda: int(readline().rstrip())\nnm = lambda: list(map(int, readline().split()))\nnl = lambda: list(map(int, readline().split()))\n\n\ndef solve():\n n, m = nm()\n G = [list() for _ in range(n)]\n for _ in range(m):\n u, v = nm()\n u -= 1\n v -= 1\n G[u].append(v)\n G[v].append(u)\n if set(G[0]) & set(G[n - 1]):\n print(\"POSSIBLE\")\n else:\n print(\"IMPOSSIBLE\")\n return\n\n\nsolve()\n# T = ni()\n# for _ in range(T):\n# solve()\n","code_same":false,"relative_loc_diff_percent":61.5384615385,"diff":["-n, m = list(map(int, input().split()))","-l = [tuple(map(int, input().split())) for i in range(m)]","-c = [[] for _ in range(n + 1)]","-for x in l:","- c[x[0]].append(x[1])","- c[x[1]].append(x[0])","-if set(c[1]) & set(c[n]):","- print(\"POSSIBLE\")","-else:","- print(\"IMPOSSIBLE\")","+import sys","+","+readline = sys.stdin.buffer.readline","+ni = lambda: int(readline().rstrip())","+nm = lambda: list(map(int, readline().split()))","+nl = lambda: list(map(int, readline().split()))","+","+","+def solve():","+ n, m = nm()","+ G = [list() for _ in range(n)]","+ for _ in range(m):","+ u, v = nm()","+ u -= 1","+ v -= 1","+ G[u].append(v)","+ G[v].append(u)","+ if set(G[0]) & set(G[n - 1]):","+ print(\"POSSIBLE\")","+ else:","+ print(\"IMPOSSIBLE\")","+ return","+","+","+solve()","+# T = ni()","+# for _ in range(T):","+# solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422978878,"measured_runtime_v1":0.0537190914,"runtime_lift":0.7873902309,"key":["s307861133","s026902406"]} +{"user_id":"u608088992","problem_id":"p03095","language":"python","submission_id_v0":"s597708535","submission_id_v1":"s842249724","cpu_time_v0":73,"cpu_time_v1":32,"memory_v0":3188,"memory_v1":3236,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.16,"input":"N = int(eval(input()))\n\nS = eval(input())\n\nmod = 7 + 10 ** 9\n\n\n\nword = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\"\\\n\n ,\"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\",\"z\"]\n\ncount = [1] * 26\n\nfor i in range(N):\n\n count[word.index(S[i])] += 1\n\nTotal = 1\n\nfor c in count:\n\n Total *= c\n\n Total %= mod\n\nprint((Total - 1))","target":"import sys\n\nclass alphabet: #True\u306a\u3089\u5927\u6587\u5b57\n\n def __init__(self, capitalize):\n\n self.num = dict()\n\n self.index = dict()\n\n self.abc = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\"\\\n\n ,\"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\n if capitalize: \n\n for i in range(26): self.abc[i] = self.abc[i].upper()\n\n for i, a in enumerate(self.abc):\n\n self.num[a] = i\n\n self.index[i] = a\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n N = int(eval(input()))\n\n S = input().strip(\"\\n\")\n\n AB = alphabet(False)\n\n Count = [1] * 26\n\n for i in range(len(S)):\n\n Count[AB.num[S[i]]] += 1\n\n mod = 7 + 10 ** 9\n\n Ans = 1\n\n for i, n in enumerate(Count):\n\n Ans *= n\n\n Ans %= mod\n\n print(((Ans - 1 + mod) % mod))\n\n\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":14,"code_v1_loc":33,"code_v0_num_chars":346,"code_v1_num_chars":904,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nmod = 7 + 10**9\nword = [\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\",\n]\ncount = [1] * 26\nfor i in range(N):\n count[word.index(S[i])] += 1\nTotal = 1\nfor c in count:\n Total *= c\n Total %= mod\nprint((Total - 1))\n","code_v1_no_empty_lines":"import sys\n\n\nclass alphabet: # True\u306a\u3089\u5927\u6587\u5b57\n def __init__(self, capitalize):\n self.num = dict()\n self.index = dict()\n self.abc = [\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\",\n ]\n if capitalize:\n for i in range(26):\n self.abc[i] = self.abc[i].upper()\n for i, a in enumerate(self.abc):\n self.num[a] = i\n self.index[i] = a\n\n\ndef solve():\n input = sys.stdin.readline\n N = int(eval(input()))\n S = input().strip(\"\\n\")\n AB = alphabet(False)\n Count = [1] * 26\n for i in range(len(S)):\n Count[AB.num[S[i]]] += 1\n mod = 7 + 10**9\n Ans = 1\n for i, n in enumerate(Count):\n Ans *= n\n Ans %= mod\n print(((Ans - 1 + mod) % mod))\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":57.5757575758,"diff":["-N = int(eval(input()))","-S = eval(input())","-mod = 7 + 10**9","-word = [","- \"a\",","- \"b\",","- \"c\",","- \"d\",","- \"e\",","- \"f\",","- \"g\",","- \"h\",","- \"i\",","- \"j\",","- \"k\",","- \"l\",","- \"m\",","- \"n\",","- \"o\",","- \"p\",","- \"q\",","- \"r\",","- \"s\",","- \"t\",","- \"u\",","- \"v\",","- \"w\",","- \"x\",","- \"y\",","- \"z\",","-]","-count = [1] * 26","-for i in range(N):","- count[word.index(S[i])] += 1","-Total = 1","-for c in count:","- Total *= c","- Total %= mod","-print((Total - 1))","+import sys","+","+","+class alphabet: # True\u306a\u3089\u5927\u6587\u5b57","+ def __init__(self, capitalize):","+ self.num = dict()","+ self.index = dict()","+ self.abc = [","+ \"a\",","+ \"b\",","+ \"c\",","+ \"d\",","+ \"e\",","+ \"f\",","+ \"g\",","+ \"h\",","+ \"i\",","+ \"j\",","+ \"k\",","+ \"l\",","+ \"m\",","+ \"n\",","+ \"o\",","+ \"p\",","+ \"q\",","+ \"r\",","+ \"s\",","+ \"t\",","+ \"u\",","+ \"v\",","+ \"w\",","+ \"x\",","+ \"y\",","+ \"z\",","+ ]","+ if capitalize:","+ for i in range(26):","+ self.abc[i] = self.abc[i].upper()","+ for i, a in enumerate(self.abc):","+ self.num[a] = i","+ self.index[i] = a","+","+","+def solve():","+ input = sys.stdin.readline","+ N = int(eval(input()))","+ S = input().strip(\"\\n\")","+ AB = alphabet(False)","+ Count = [1] * 26","+ for i in range(len(S)):","+ Count[AB.num[S[i]]] += 1","+ mod = 7 + 10**9","+ Ans = 1","+ for i, n in enumerate(Count):","+ Ans *= n","+ Ans %= mod","+ print(((Ans - 1 + mod) % mod))","+ return 0","+","+","+if __name__ == \"__main__\":","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0358991315,"measured_runtime_v1":0.0356276336,"runtime_lift":1.0076204319,"key":["s597708535","s842249724"]} +{"user_id":"u480138356","problem_id":"p03608","language":"python","submission_id_v0":"s859274977","submission_id_v1":"s451908071","cpu_time_v0":796,"cpu_time_v1":680,"memory_v0":31024,"memory_v1":18916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.57,"input":"from collections import deque\n\nimport itertools\n\nfrom scipy.sparse.csgraph import floyd_warshall as wf\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nMAX = 1e9\n\n\n\ndef main():\n\n N, M, R = list(map(int, input().split()))\n\n r = list(map(int, input().split()))\n\n link = [[MAX if j != i else 0 for j in range(N+1)] for i in range(N+1)]\n\n\n\n for i in range(M):\n\n a, b, c = list(map(int, input().split()))\n\n link[a][b] = c\n\n link[b][a] = c\n\n\n\n link = wf(link)\n\n\n\n ans = MAX\n\n for per in list(itertools.permutations(r)):\n\n tmp = 0\n\n for i in range(R-1):\n\n tmp += link[per[i]][per[i+1]]\n\n ans = min(ans, tmp)\n\n print((int(ans)))\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"from scipy.sparse.csgraph import floyd_warshall as wf\n\nfrom itertools import permutations\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n N, M, R = list(map(int, input().split()))\n\n r = list(map(int, input().split()))\n\n\n\n MAX = int(1e9)\n\n link = [[MAX if i != j else 0 for j in range(N)] for i in range(N)]\n\n\n\n for i in range(M):\n\n a, b, c = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n link[a][b] = c\n\n link[b][a] = c\n\n \n\n link = wf(link)\n\n\n\n ans = -1\n\n for t in permutations(r):\n\n tmp = 0\n\n for i in range(1, R):\n\n tmp += link[t[i-1]-1][t[i]-1]\n\n if ans == -1:\n\n ans = tmp\n\n else:\n\n ans = min(ans, tmp)\n\n print((int(ans)))\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":30,"code_v1_loc":34,"code_v0_num_chars":720,"code_v1_num_chars":794,"code_v0_no_empty_lines":"from collections import deque\nimport itertools\nfrom scipy.sparse.csgraph import floyd_warshall as wf\nimport sys\n\ninput = sys.stdin.readline\nMAX = 1e9\n\n\ndef main():\n N, M, R = list(map(int, input().split()))\n r = list(map(int, input().split()))\n link = [[MAX if j != i else 0 for j in range(N + 1)] for i in range(N + 1)]\n for i in range(M):\n a, b, c = list(map(int, input().split()))\n link[a][b] = c\n link[b][a] = c\n link = wf(link)\n ans = MAX\n for per in list(itertools.permutations(r)):\n tmp = 0\n for i in range(R - 1):\n tmp += link[per[i]][per[i + 1]]\n ans = min(ans, tmp)\n print((int(ans)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from scipy.sparse.csgraph import floyd_warshall as wf\nfrom itertools import permutations\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N, M, R = list(map(int, input().split()))\n r = list(map(int, input().split()))\n MAX = int(1e9)\n link = [[MAX if i != j else 0 for j in range(N)] for i in range(N)]\n for i in range(M):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n link[a][b] = c\n link[b][a] = c\n link = wf(link)\n ans = -1\n for t in permutations(r):\n tmp = 0\n for i in range(1, R):\n tmp += link[t[i - 1] - 1][t[i] - 1]\n if ans == -1:\n ans = tmp\n else:\n ans = min(ans, tmp)\n print((int(ans)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":11.7647058824,"diff":["-from collections import deque","-import itertools","+from itertools import permutations","-MAX = 1e9","- link = [[MAX if j != i else 0 for j in range(N + 1)] for i in range(N + 1)]","+ MAX = int(1e9)","+ link = [[MAX if i != j else 0 for j in range(N)] for i in range(N)]","+ a -= 1","+ b -= 1","- ans = MAX","- for per in list(itertools.permutations(r)):","+ ans = -1","+ for t in permutations(r):","- for i in range(R - 1):","- tmp += link[per[i]][per[i + 1]]","- ans = min(ans, tmp)","+ for i in range(1, R):","+ tmp += link[t[i - 1] - 1][t[i] - 1]","+ if ans == -1:","+ ans = tmp","+ else:","+ ans = min(ans, tmp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4269707644,"measured_runtime_v1":0.6495794392,"runtime_lift":0.6573033853,"key":["s859274977","s451908071"]} +{"user_id":"u477977638","problem_id":"p02574","language":"python","submission_id_v0":"s841163176","submission_id_v1":"s511845402","cpu_time_v0":1847,"cpu_time_v1":1668,"memory_v0":206368,"memory_v1":203508,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.69,"input":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\n#sys.setrecursionlimit(10**9)\n\n#from functools import lru_cache\n\n\n\ndef RD(): return input().rstrip().decode()\n\ndef II(): return int(eval(input()))\n\ndef FI(): return float(eval(input()))\n\ndef MI(): return list(map(int,input().split()))\n\ndef MF(): return list(map(float,input().split()))\n\ndef LI(): return list(map(int,input().split()))\n\ndef LF(): return list(map(float,input().split()))\n\ndef TI(): return tuple(map(int,input().split()))\n\n# rstrip().decode()\n\n\n\n\n\n\n\ndef main():\n\n\tnn=II()\n\n\tA=LI()\n\n\tans=\"pairwise coprime\"\n\n\n\n\tn = 500005\n\n\tprimes = set(range(2, n+1))\n\n\tfor i in range(2, int(n**0.5+1)):\n\n\t\tprimes.difference_update(list(range(i*2, n+1, i)))\n\n\tprimes=set(primes)\n\n\n\n\t#print(primes)\n\n\n\n\n\n\tB=set(range(1,5*10**5+5))\n\n\tC=set()\n\n\tfor i in A:\n\n\t\ta=set()\n\n\t\twhile i%2==0:\n\n\t\t\ta.add(2)\n\n\t\t\ti\/\/=2\n\n\t\tf=3\n\n\t\twhile f*f<=i:\n\n\t\t\tif i in primes:\n\n\t\t\t\tbreak\n\n\t\t\telif i%f==0:\n\n\t\t\t\ta.add(f)\n\n\t\t\t\ti\/\/=f\n\n\t\t\telse:\n\n\t\t\t\tf+=2\n\n\t\tif i!=1:\n\n\t\t\ta.add(i)\n\n\t\tB&=a\n\n\t\tif C&a:\n\n\t\t\tans=\"setwise coprime\"\n\n\t\tC|=a\n\n\n\n\tif B:\n\n\t\tans=\"not coprime\"\n\n\n\n\tprint(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()\n","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\n#sys.setrecursionlimit(10**9)\n\n#from functools import lru_cache\n\n\n\ndef RD(): return input().rstrip().decode()\n\ndef II(): return int(eval(input()))\n\ndef FI(): return float(eval(input()))\n\ndef MI(): return list(map(int,input().split()))\n\ndef MF(): return list(map(float,input().split()))\n\ndef LI(): return list(map(int,input().split()))\n\ndef LF(): return list(map(float,input().split()))\n\ndef TI(): return tuple(map(int,input().split()))\n\n# rstrip().decode()\n\n\n\n\n\n\n\ndef main():\n\n\tnn=II()\n\n\tA=LI()\n\n\tans=\"pairwise coprime\"\n\n\n\n\tn = 333335\n\n\tprimes = set(range(2, n+1))\n\n\tfor i in range(2, int(n**0.5+1)):\n\n\t\tprimes.difference_update(list(range(i*2, n+1, i)))\n\n\tprimes=set(primes)\n\n\n\n\t#print(primes)\n\n\n\n\n\n\tB=set(range(1,333335))\n\n\tC=set()\n\n\tfor i in A:\n\n\t\ta=set()\n\n\t\twhile i%2==0:\n\n\t\t\ta.add(2)\n\n\t\t\ti\/\/=2\n\n\t\tf=3\n\n\t\twhile f*f<=i:\n\n\t\t\tif i in primes:\n\n\t\t\t\tbreak\n\n\t\t\telif i%f==0:\n\n\t\t\t\ta.add(f)\n\n\t\t\t\ti\/\/=f\n\n\t\t\telse:\n\n\t\t\t\tf+=2\n\n\t\tif i!=1:\n\n\t\t\ta.add(i)\n\n\t\tB&=a\n\n\t\tif C&a:\n\n\t\t\tans=\"setwise coprime\"\n\n\t\tC|=a\n\n\n\n\tif B:\n\n\t\tans=\"not coprime\"\n\n\n\n\tprint(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()\n","code_v0_loc":82,"code_v1_loc":82,"code_v0_num_chars":1141,"code_v1_num_chars":1138,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\n# sys.setrecursionlimit(10**9)\n# from functools import lru_cache\ndef RD():\n return input().rstrip().decode()\n\n\ndef II():\n return int(eval(input()))\n\n\ndef FI():\n return float(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MF():\n return list(map(float, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LF():\n return list(map(float, input().split()))\n\n\ndef TI():\n return tuple(map(int, input().split()))\n\n\n# rstrip().decode()\ndef main():\n nn = II()\n A = LI()\n ans = \"pairwise coprime\"\n n = 500005\n primes = set(range(2, n + 1))\n for i in range(2, int(n**0.5 + 1)):\n primes.difference_update(list(range(i * 2, n + 1, i)))\n primes = set(primes)\n # print(primes)\n B = set(range(1, 5 * 10**5 + 5))\n C = set()\n for i in A:\n a = set()\n while i % 2 == 0:\n a.add(2)\n i \/\/= 2\n f = 3\n while f * f <= i:\n if i in primes:\n break\n elif i % f == 0:\n a.add(f)\n i \/\/= f\n else:\n f += 2\n if i != 1:\n a.add(i)\n B &= a\n if C & a:\n ans = \"setwise coprime\"\n C |= a\n if B:\n ans = \"not coprime\"\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\n# sys.setrecursionlimit(10**9)\n# from functools import lru_cache\ndef RD():\n return input().rstrip().decode()\n\n\ndef II():\n return int(eval(input()))\n\n\ndef FI():\n return float(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef MF():\n return list(map(float, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef LF():\n return list(map(float, input().split()))\n\n\ndef TI():\n return tuple(map(int, input().split()))\n\n\n# rstrip().decode()\ndef main():\n nn = II()\n A = LI()\n ans = \"pairwise coprime\"\n n = 333335\n primes = set(range(2, n + 1))\n for i in range(2, int(n**0.5 + 1)):\n primes.difference_update(list(range(i * 2, n + 1, i)))\n primes = set(primes)\n # print(primes)\n B = set(range(1, 333335))\n C = set()\n for i in A:\n a = set()\n while i % 2 == 0:\n a.add(2)\n i \/\/= 2\n f = 3\n while f * f <= i:\n if i in primes:\n break\n elif i % f == 0:\n a.add(f)\n i \/\/= f\n else:\n f += 2\n if i != 1:\n a.add(i)\n B &= a\n if C & a:\n ans = \"setwise coprime\"\n C |= a\n if B:\n ans = \"not coprime\"\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- n = 500005","+ n = 333335","- B = set(range(1, 5 * 10**5 + 5))","+ B = set(range(1, 333335))"],"diff_only_import_comment":false,"measured_runtime_v0":1.4118388777,"measured_runtime_v1":0.6938456473,"runtime_lift":2.0348025286,"key":["s841163176","s511845402"]} +{"user_id":"u729133443","problem_id":"p02741","language":"python","submission_id_v0":"s331321127","submission_id_v1":"s336464322","cpu_time_v0":185,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.81,"input":"print(((51,1,4,1,4,5,2,2,15,1,2,2,5,1,5,1,14,1,2,1,5,1,2,2,5,1,2,1,2,1,1,1)[-int(eval(input()))]))","target":"print((ord('\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005'[int(eval(input()))%14])))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":90,"code_v1_num_chars":45,"code_v0_no_empty_lines":"print(\n (\n (\n 51,\n 1,\n 4,\n 1,\n 4,\n 5,\n 2,\n 2,\n 15,\n 1,\n 2,\n 2,\n 5,\n 1,\n 5,\n 1,\n 14,\n 1,\n 2,\n 1,\n 5,\n 1,\n 2,\n 2,\n 5,\n 1,\n 2,\n 1,\n 2,\n 1,\n 1,\n 1,\n )[-int(eval(input()))]\n )\n)\n","code_v1_no_empty_lines":"print((ord(\"\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005\"[int(eval(input())) % 14])))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print(","- (","- (","- 51,","- 1,","- 4,","- 1,","- 4,","- 5,","- 2,","- 2,","- 15,","- 1,","- 2,","- 2,","- 5,","- 1,","- 5,","- 1,","- 14,","- 1,","- 2,","- 1,","- 5,","- 1,","- 2,","- 2,","- 5,","- 1,","- 2,","- 1,","- 2,","- 1,","- 1,","- 1,","- )[-int(eval(input()))]","- )","-)","+print((ord(\"\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005\"[int(eval(input())) % 14])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443315285,"measured_runtime_v1":0.0384404416,"runtime_lift":1.153252321,"key":["s331321127","s336464322"]} +{"user_id":"u284851373","problem_id":"p00118","language":"python","submission_id_v0":"s875221415","submission_id_v1":"s215310464","cpu_time_v0":150,"cpu_time_v1":120,"memory_v0":16220,"memory_v1":16108,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"import sys\n\ndef solve():\n\n person = 0\n\n for i in range(0,H):\n\n for j in range(0,W):\n\n if geo[i][j] is not \"_\":\n\n search(i,j)\n\n person += 1\n\n print(person)\n\n \n\ndef search(i,j):\n\n temp = geo[i][j]\n\n geo[i][j] = \"_\"\n\n for a in range(0,4):\n\n idx, jdy = i + dx[a], j + dy[a]\n\n if(isOnMap(idx, jdy)):\n\n if(isNeededToSolve(temp, idx, jdy)):\n\n search(idx,jdy)\n\n \n\ndef isOnMap(i,j): return (0<=i and 0<=j and i k:\n\n break\n\n else:\n\n t = bisect(ba, k - aa[i1])\n\n r = max(r, i1 + 1 + t)\n\n for j1 in range(m):\n\n if ba[j1] > k:\n\n break\n\n else:\n\n t = bisect(aa, k - ba[j1])\n\n r = max(r, j1 + 1 + t)\n\n print(r)\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nread = sys.stdin.read\n\nreadlines = sys.stdin.readlines\n\nfrom itertools import accumulate\n\nfrom bisect import bisect\n\ndef main():\n\n n, m, k = list(map(int, input().split()))\n\n a = tuple(map(int, input().split()))\n\n b = tuple(map(int, input().split()))\n\n\n\n aa = [0] + list(accumulate(a))\n\n ba = [0] + list(accumulate(b))\n\n r = 0\n\n for i1, aae in enumerate(aa):\n\n if aae > k:\n\n break\n\n else:\n\n time_remain = k - aae\n\n b_num = bisect(ba, time_remain)\n\n r = max(r, i1 + b_num - 1)\n\n print(r)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":25,"code_v1_loc":24,"code_v0_num_chars":645,"code_v1_num_chars":616,"code_v0_no_empty_lines":"from itertools import accumulate\nfrom bisect import bisect\n\n\ndef main():\n n, m, k = list(map(int, input().split()))\n a = tuple(map(int, input().split()))\n b = tuple(map(int, input().split()))\n aa = tuple(accumulate(a))\n ba = tuple(accumulate(b))\n r = 0\n for i1 in range(n):\n if aa[i1] > k:\n break\n else:\n t = bisect(ba, k - aa[i1])\n r = max(r, i1 + 1 + t)\n for j1 in range(m):\n if ba[j1] > k:\n break\n else:\n t = bisect(aa, k - ba[j1])\n r = max(r, j1 + 1 + t)\n print(r)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nfrom itertools import accumulate\nfrom bisect import bisect\n\n\ndef main():\n n, m, k = list(map(int, input().split()))\n a = tuple(map(int, input().split()))\n b = tuple(map(int, input().split()))\n aa = [0] + list(accumulate(a))\n ba = [0] + list(accumulate(b))\n r = 0\n for i1, aae in enumerate(aa):\n if aae > k:\n break\n else:\n time_remain = k - aae\n b_num = bisect(ba, time_remain)\n r = max(r, i1 + b_num - 1)\n print(r)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["+import sys","+","+read = sys.stdin.read","+readlines = sys.stdin.readlines","- aa = tuple(accumulate(a))","- ba = tuple(accumulate(b))","+ aa = [0] + list(accumulate(a))","+ ba = [0] + list(accumulate(b))","- for i1 in range(n):","- if aa[i1] > k:","+ for i1, aae in enumerate(aa):","+ if aae > k:","- t = bisect(ba, k - aa[i1])","- r = max(r, i1 + 1 + t)","- for j1 in range(m):","- if ba[j1] > k:","- break","- else:","- t = bisect(aa, k - ba[j1])","- r = max(r, j1 + 1 + t)","+ time_remain = k - aae","+ b_num = bisect(ba, time_remain)","+ r = max(r, i1 + b_num - 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0396008198,"measured_runtime_v1":0.0438282008,"runtime_lift":0.903546554,"key":["s554175667","s145382051"]} +{"user_id":"u844895214","problem_id":"p02597","language":"python","submission_id_v0":"s931472175","submission_id_v1":"s850373616","cpu_time_v0":153,"cpu_time_v1":79,"memory_v0":28712,"memory_v1":10708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.37,"input":"import sys\n\nfrom collections import deque\n\nimport numpy as np\n\nimport math\n\nsys.setrecursionlimit(10**6)\n\ndef S(): return sys.stdin.readline().rstrip()\n\ndef SL(): return list(map(str,sys.stdin.readline().rstrip().split()))\n\ndef I(): return int(sys.stdin.readline().rstrip())\n\ndef IL(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\n\n\nif __name__=='__main__':\n\n n = I()\n\n c = list(S())\n\n i,j = 0,n-1\n\n ans = 0\n\n while i a[i]:\n\n print(Amax)\n\n else:\n\n print(Amax2)","target":"n = int(eval(input()))\n\nA = []\n\nfor i in range(n):\n\n A.append(int(eval(input())))\n\nma = max(A)\n\nma2 = sorted(A)[-2]\n\nfor a in A:\n\n if a == ma:\n\n print(ma2)\n\n else:\n\n print(ma)","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":187,"code_v1_num_chars":187,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [int(eval(input())) for i in range(n)]\nAmax = max(a)\nAmax2 = sorted(a)[-2]\nfor i in range(n):\n if Amax > a[i]:\n print(Amax)\n else:\n print(Amax2)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = []\nfor i in range(n):\n A.append(int(eval(input())))\nma = max(A)\nma2 = sorted(A)[-2]\nfor a in A:\n if a == ma:\n print(ma2)\n else:\n print(ma)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-a = [int(eval(input())) for i in range(n)]","-Amax = max(a)","-Amax2 = sorted(a)[-2]","+A = []","- if Amax > a[i]:","- print(Amax)","+ A.append(int(eval(input())))","+ma = max(A)","+ma2 = sorted(A)[-2]","+for a in A:","+ if a == ma:","+ print(ma2)","- print(Amax2)","+ print(ma)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0354987684,"measured_runtime_v1":0.0367986383,"runtime_lift":0.9646761422,"key":["s543330058","s171566908"]} +{"user_id":"u133936772","problem_id":"p02953","language":"python","submission_id_v0":"s367911410","submission_id_v1":"s406134377","cpu_time_v0":66,"cpu_time_v1":61,"memory_v0":20116,"memory_v1":20028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.58,"input":"n,*l=list(map(int,open(0).read().split()))\n\nt=0\n\nfor i in l:\n\n if it: i-=1\n\n t=i\n\nelse: print('Yes')","target":"n,*l=list(map(int,open(0).read().split()))\n\nt=0\n\nfor i in l:\n\n if it: t=i-1\n\nprint('Yes')","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":127,"code_v1_num_chars":116,"code_v0_no_empty_lines":"n, *l = list(map(int, open(0).read().split()))\nt = 0\nfor i in l:\n if i < t:\n print(\"No\")\n break\n if i > t:\n i -= 1\n t = i\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"n, *l = list(map(int, open(0).read().split()))\nt = 0\nfor i in l:\n if i < t:\n print(\"No\")\n exit()\n if i > t:\n t = i - 1\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["- break","+ exit()","- i -= 1","- t = i","-else:","- print(\"Yes\")","+ t = i - 1","+print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1260959222,"measured_runtime_v1":0.0471415572,"runtime_lift":2.6748357426,"key":["s367911410","s406134377"]} +{"user_id":"u729133443","problem_id":"p02703","language":"python","submission_id_v0":"s536951513","submission_id_v1":"s594545442","cpu_time_v0":1588,"cpu_time_v1":1241,"memory_v0":390776,"memory_v1":117800,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.85,"input":"from heapq import*\n\n(n,m,s),*t=[list(map(int,t.split()))for t in open(0)]\n\n*e,=eval('[],'*8**6)\n\nfor u,v,a,b in t[:m]:\n\n for i in range(2501-a):\n\n e[(i+a)*51+u]+=(b,i*51+v),\n\n e[(i+a)*51+v]+=(b,i*51+u),\n\nfor i,(c,d)in enumerate(t[m:],1):\n\n for j in range(2501-c):\n\n e[j*51+i]+=(d,(j+c)*51+i),\n\nd=[10**18]*8**6\n\nf=[1]*8**6\n\nq=[(0,min(2500,s)*51+1)]\n\nwhile q:\n\n c,v=heappop(q)\n\n if f[v]<1:continue\n\n d[v],f[v]=c,0\n\n for p,w in e[v]:\n\n if f[w]:heappush(q,(c+p,w))\n\nfor i in range(2,n+1):print((min(d[i::51])))","target":"def main():\n\n from heapq import heappush,heappop\n\n (n,m,s),*t=[list(map(int,r.split()))for r in open(0)]\n\n e=[[]for _ in range(8**6)]\n\n for u,v,a,b in t[:m]:\n\n for i in range(2501-a):\n\n e[(i+a)*51+u]+=(b,i*51+v),\n\n e[(i+a)*51+v]+=(b,i*51+u),\n\n for i,(c,d)in enumerate(t[m:],1):\n\n for j in range(2501-c):\n\n e[j*51+i]+=(d,(j+c)*51+i),\n\n x=[10**18]*8**6\n\n f=[1]*8**6\n\n q=[(0,min(2500,s)*51+1)]\n\n while q:\n\n c,v=heappop(q)\n\n if f[v]<1:continue\n\n x[v],f[v]=c,0\n\n for p,w in e[v]:\n\n if f[w]:heappush(q,(c+p,w))\n\n for i in range(2,n+1):print((min(x[i::51])))\n\nmain()","code_v0_loc":20,"code_v1_loc":22,"code_v0_num_chars":544,"code_v1_num_chars":667,"code_v0_no_empty_lines":"from heapq import *\n\n(n, m, s), *t = [list(map(int, t.split())) for t in open(0)]\n(*e,) = eval(\"[],\" * 8**6)\nfor u, v, a, b in t[:m]:\n for i in range(2501 - a):\n e[(i + a) * 51 + u] += ((b, i * 51 + v),)\n e[(i + a) * 51 + v] += ((b, i * 51 + u),)\nfor i, (c, d) in enumerate(t[m:], 1):\n for j in range(2501 - c):\n e[j * 51 + i] += ((d, (j + c) * 51 + i),)\nd = [10**18] * 8**6\nf = [1] * 8**6\nq = [(0, min(2500, s) * 51 + 1)]\nwhile q:\n c, v = heappop(q)\n if f[v] < 1:\n continue\n d[v], f[v] = c, 0\n for p, w in e[v]:\n if f[w]:\n heappush(q, (c + p, w))\nfor i in range(2, n + 1):\n print((min(d[i::51])))\n","code_v1_no_empty_lines":"def main():\n from heapq import heappush, heappop\n\n (n, m, s), *t = [list(map(int, r.split())) for r in open(0)]\n e = [[] for _ in range(8**6)]\n for u, v, a, b in t[:m]:\n for i in range(2501 - a):\n e[(i + a) * 51 + u] += ((b, i * 51 + v),)\n e[(i + a) * 51 + v] += ((b, i * 51 + u),)\n for i, (c, d) in enumerate(t[m:], 1):\n for j in range(2501 - c):\n e[j * 51 + i] += ((d, (j + c) * 51 + i),)\n x = [10**18] * 8**6\n f = [1] * 8**6\n q = [(0, min(2500, s) * 51 + 1)]\n while q:\n c, v = heappop(q)\n if f[v] < 1:\n continue\n x[v], f[v] = c, 0\n for p, w in e[v]:\n if f[w]:\n heappush(q, (c + p, w))\n for i in range(2, n + 1):\n print((min(x[i::51])))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-from heapq import *","+def main():","+ from heapq import heappush, heappop","-(n, m, s), *t = [list(map(int, t.split())) for t in open(0)]","-(*e,) = eval(\"[],\" * 8**6)","-for u, v, a, b in t[:m]:","- for i in range(2501 - a):","- e[(i + a) * 51 + u] += ((b, i * 51 + v),)","- e[(i + a) * 51 + v] += ((b, i * 51 + u),)","-for i, (c, d) in enumerate(t[m:], 1):","- for j in range(2501 - c):","- e[j * 51 + i] += ((d, (j + c) * 51 + i),)","-d = [10**18] * 8**6","-f = [1] * 8**6","-q = [(0, min(2500, s) * 51 + 1)]","-while q:","- c, v = heappop(q)","- if f[v] < 1:","- continue","- d[v], f[v] = c, 0","- for p, w in e[v]:","- if f[w]:","- heappush(q, (c + p, w))","-for i in range(2, n + 1):","- print((min(d[i::51])))","+ (n, m, s), *t = [list(map(int, r.split())) for r in open(0)]","+ e = [[] for _ in range(8**6)]","+ for u, v, a, b in t[:m]:","+ for i in range(2501 - a):","+ e[(i + a) * 51 + u] += ((b, i * 51 + v),)","+ e[(i + a) * 51 + v] += ((b, i * 51 + u),)","+ for i, (c, d) in enumerate(t[m:], 1):","+ for j in range(2501 - c):","+ e[j * 51 + i] += ((d, (j + c) * 51 + i),)","+ x = [10**18] * 8**6","+ f = [1] * 8**6","+ q = [(0, min(2500, s) * 51 + 1)]","+ while q:","+ c, v = heappop(q)","+ if f[v] < 1:","+ continue","+ x[v], f[v] = c, 0","+ for p, w in e[v]:","+ if f[w]:","+ heappush(q, (c + p, w))","+ for i in range(2, n + 1):","+ print((min(x[i::51])))","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.9015515853,"measured_runtime_v1":0.2646836561,"runtime_lift":3.4061475449,"key":["s536951513","s594545442"]} +{"user_id":"u729133443","problem_id":"p03200","language":"python","submission_id_v0":"s520085141","submission_id_v1":"s385496310","cpu_time_v0":194,"cpu_time_v1":49,"memory_v0":40560,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.74,"input":"s=eval(input())\n\na=b=0\n\nfor i in range(len(s)):\n\n if s[i]=='B':\n\n b+=1\n\n else:\n\n a+=b\n\nprint(a)","target":"a=b=0\n\nfor s in eval(input()):\n\n if s>'B':a+=b\n\n else:b+=1\n\nprint(a)","code_v0_loc":8,"code_v1_loc":5,"code_v0_num_chars":97,"code_v1_num_chars":62,"code_v0_no_empty_lines":"s = eval(input())\na = b = 0\nfor i in range(len(s)):\n if s[i] == \"B\":\n b += 1\n else:\n a += b\nprint(a)\n","code_v1_no_empty_lines":"a = b = 0\nfor s in eval(input()):\n if s > \"B\":\n a += b\n else:\n b += 1\nprint(a)\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-s = eval(input())","-for i in range(len(s)):","- if s[i] == \"B\":","+for s in eval(input()):","+ if s > \"B\":","+ a += b","+ else:","- else:","- a += b"],"diff_only_import_comment":false,"measured_runtime_v0":0.0361124647,"measured_runtime_v1":0.0532880637,"runtime_lift":0.677683936,"key":["s520085141","s385496310"]} +{"user_id":"u186838327","problem_id":"p02865","language":"python","submission_id_v0":"s761092164","submission_id_v1":"s132272071","cpu_time_v0":169,"cpu_time_v1":67,"memory_v0":38384,"memory_v1":61688,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.36,"input":"n = int(eval(input()))\n\nif n%2 == 0:\n\n print((n\/\/2-1))\n\nelse:\n\n print(((n+1)\/\/2-1))","target":"n = int(eval(input()))\n\nif n%2 == 0:\n\n print((n\/\/2-1))\n\nelse:\n\n print((n\/\/2))\n","code_v0_loc":5,"code_v1_loc":5,"code_v0_num_chars":75,"code_v1_num_chars":74,"code_v0_no_empty_lines":"n = int(eval(input()))\nif n % 2 == 0:\n print((n \/\/ 2 - 1))\nelse:\n print(((n + 1) \/\/ 2 - 1))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nif n % 2 == 0:\n print((n \/\/ 2 - 1))\nelse:\n print((n \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- print(((n + 1) \/\/ 2 - 1))","+ print((n \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0456079767,"measured_runtime_v1":0.0591465745,"runtime_lift":0.7711008973,"key":["s761092164","s132272071"]} +{"user_id":"u729133443","problem_id":"p02960","language":"python","submission_id_v0":"s450434003","submission_id_v1":"s448743129","cpu_time_v0":1653,"cpu_time_v1":691,"memory_v0":42732,"memory_v1":44848,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.2,"input":"d=[1]+[0]*12\n\nfor c in eval(input()):\n\n p=[0]*13\n\n for j in range(13):\n\n for k in range(10):t=(j*10+k)%13;p[t]+=d[j]*(c>'9'or k==int(c));p[t]%=10**9+7\n\n d=p\n\nprint((d[5]))","target":"d=[1]+[0]*12\n\nfor c in eval(input()):\n\n\te=[0]*13\n\n\tfor k in([c],list(range(10)))[c>'9']:\n\n\t\tfor j in range(13):t=(j*10+int(k))%13;e[t]+=d[j];e[t]%=10**9+7\n\n\td=e\n\nprint((d[5]))","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":164,"code_v1_num_chars":161,"code_v0_no_empty_lines":"d = [1] + [0] * 12\nfor c in eval(input()):\n p = [0] * 13\n for j in range(13):\n for k in range(10):\n t = (j * 10 + k) % 13\n p[t] += d[j] * (c > \"9\" or k == int(c))\n p[t] %= 10**9 + 7\n d = p\nprint((d[5]))\n","code_v1_no_empty_lines":"d = [1] + [0] * 12\nfor c in eval(input()):\n e = [0] * 13\n for k in ([c], list(range(10)))[c > \"9\"]:\n for j in range(13):\n t = (j * 10 + int(k)) % 13\n e[t] += d[j]\n e[t] %= 10**9 + 7\n d = e\nprint((d[5]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- p = [0] * 13","- for j in range(13):","- for k in range(10):","- t = (j * 10 + k) % 13","- p[t] += d[j] * (c > \"9\" or k == int(c))","- p[t] %= 10**9 + 7","- d = p","+ e = [0] * 13","+ for k in ([c], list(range(10)))[c > \"9\"]:","+ for j in range(13):","+ t = (j * 10 + int(k)) % 13","+ e[t] += d[j]","+ e[t] %= 10**9 + 7","+ d = e"],"diff_only_import_comment":false,"measured_runtime_v0":0.0602093055,"measured_runtime_v1":0.0629936032,"runtime_lift":0.9558003103,"key":["s450434003","s448743129"]} +{"user_id":"u560867850","problem_id":"p03673","language":"python","submission_id_v0":"s691037421","submission_id_v1":"s356197582","cpu_time_v0":128,"cpu_time_v1":102,"memory_v0":47172,"memory_v1":47172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.31,"input":"from collections import deque\n\n\n\ndef main():\n\n eval(input())\n\n A = list(enumerate(input().split()))\n\n size = len(A)\n\n b = deque()\n\n for i, a in A:\n\n if i % 2 == 0:\n\n if size % 2 == 0:\n\n b.append(a)\n\n else:\n\n b.appendleft(a) \n\n else:\n\n if size % 2 == 0:\n\n b.appendleft(a)\n\n else:\n\n b.append(a)\n\n\n\n print((\" \".join(list(b))))\n\n\n\nmain()","target":"from collections import deque\n\n\n\ndef main():\n\n eval(input())\n\n A = list(enumerate(input().split()))\n\n b = deque()\n\n (append1, append2) = (b.append, b.appendleft) if len(A) % 2 == 0 else (b.appendleft, b.append)\n\n for i, a in A:\n\n if i % 2 == 0:\n\n append1(a) \n\n else:\n\n append2(a)\n\n\n\n print((\" \".join(list(b))))\n\n\n\nmain()\n","code_v0_loc":22,"code_v1_loc":16,"code_v0_num_chars":464,"code_v1_num_chars":367,"code_v0_no_empty_lines":"from collections import deque\n\n\ndef main():\n eval(input())\n A = list(enumerate(input().split()))\n size = len(A)\n b = deque()\n for i, a in A:\n if i % 2 == 0:\n if size % 2 == 0:\n b.append(a)\n else:\n b.appendleft(a)\n else:\n if size % 2 == 0:\n b.appendleft(a)\n else:\n b.append(a)\n print((\" \".join(list(b))))\n\n\nmain()\n","code_v1_no_empty_lines":"from collections import deque\n\n\ndef main():\n eval(input())\n A = list(enumerate(input().split()))\n b = deque()\n (append1, append2) = (\n (b.append, b.appendleft) if len(A) % 2 == 0 else (b.appendleft, b.append)\n )\n for i, a in A:\n if i % 2 == 0:\n append1(a)\n else:\n append2(a)\n print((\" \".join(list(b))))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["- size = len(A)","+ (append1, append2) = (","+ (b.append, b.appendleft) if len(A) % 2 == 0 else (b.appendleft, b.append)","+ )","- if size % 2 == 0:","- b.append(a)","- else:","- b.appendleft(a)","+ append1(a)","- if size % 2 == 0:","- b.appendleft(a)","- else:","- b.append(a)","+ append2(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0506287575,"measured_runtime_v1":0.0478859425,"runtime_lift":1.0572780834,"key":["s691037421","s356197582"]} +{"user_id":"u597455618","problem_id":"p02559","language":"python","submission_id_v0":"s984452006","submission_id_v1":"s181972347","cpu_time_v0":1569,"cpu_time_v1":745,"memory_v0":148296,"memory_v1":172576,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.52,"input":"from numba import njit, b1, i4, i8, f8\n\nimport numpy as np\n\nimport sys\n\n\n\n\n\n@njit((i8[:], i8), cache=True)\n\ndef sum(tree, i):\n\n s = 0\n\n while i > 0:\n\n s += tree[i]\n\n i -= i & -i\n\n return s\n\n\n\n\n\n@njit((i8[:], i8, i8, i8), cache=True)\n\ndef add(tree, size, i, x):\n\n while i <= size:\n\n tree[i] += x\n\n i += i & -i\n\n\n\n\n\n@njit((i8[:], i8, i8), cache=True)\n\ndef range_sum(tree, l, r):\n\n return sum(tree, r) - sum(tree, l)\n\n\n\n\n\ndef main():\n\n n, q = list(map(int, sys.stdin.buffer.readline().split()))\n\n\n\n bit = np.array([0] + sys.stdin.buffer.readline().split(), np.int64)\n\n for i in range(1, n+1):\n\n if i + (i & -i) < n + 1:\n\n bit[i + (i & -i)] += bit[i]\n\n\n\n for y in sys.stdin.buffer.readlines():\n\n q, p, x = list(map(int, y.split()))\n\n if q:\n\n print((range_sum(bit, p, x)))\n\n else:\n\n add(bit, n, p+1, x)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"import sys\n\n\n\n\n\ndef sum(tree, i):\n\n s = 0\n\n while i > 0:\n\n s += tree[i]\n\n i -= i & -i\n\n return s\n\n\n\n\n\ndef add(tree, size, i, x):\n\n while i <= size:\n\n tree[i] += x\n\n i += i & -i\n\n\n\n\n\ndef range_sum(tree, l, r):\n\n return sum(tree, r) - sum(tree, l)\n\n\n\n\n\ndef main():\n\n n, q = list(map(int, sys.stdin.buffer.readline().split()))\n\n\n\n bit = [0] + list(map(int, sys.stdin.buffer.readline().split()))\n\n for i in range(1, n+1):\n\n if i + (i & -i) < n + 1:\n\n bit[i + (i & -i)] += bit[i]\n\n\n\n for y in sys.stdin.buffer.readlines():\n\n q, p, x = list(map(int, y.split()))\n\n if q:\n\n print((range_sum(bit, p, x)))\n\n else:\n\n add(bit,n, p+1, x)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":44,"code_v1_loc":39,"code_v0_num_chars":945,"code_v1_num_chars":772,"code_v0_no_empty_lines":"from numba import njit, b1, i4, i8, f8\nimport numpy as np\nimport sys\n\n\n@njit((i8[:], i8), cache=True)\ndef sum(tree, i):\n s = 0\n while i > 0:\n s += tree[i]\n i -= i & -i\n return s\n\n\n@njit((i8[:], i8, i8, i8), cache=True)\ndef add(tree, size, i, x):\n while i <= size:\n tree[i] += x\n i += i & -i\n\n\n@njit((i8[:], i8, i8), cache=True)\ndef range_sum(tree, l, r):\n return sum(tree, r) - sum(tree, l)\n\n\ndef main():\n n, q = list(map(int, sys.stdin.buffer.readline().split()))\n bit = np.array([0] + sys.stdin.buffer.readline().split(), np.int64)\n for i in range(1, n + 1):\n if i + (i & -i) < n + 1:\n bit[i + (i & -i)] += bit[i]\n for y in sys.stdin.buffer.readlines():\n q, p, x = list(map(int, y.split()))\n if q:\n print((range_sum(bit, p, x)))\n else:\n add(bit, n, p + 1, x)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef sum(tree, i):\n s = 0\n while i > 0:\n s += tree[i]\n i -= i & -i\n return s\n\n\ndef add(tree, size, i, x):\n while i <= size:\n tree[i] += x\n i += i & -i\n\n\ndef range_sum(tree, l, r):\n return sum(tree, r) - sum(tree, l)\n\n\ndef main():\n n, q = list(map(int, sys.stdin.buffer.readline().split()))\n bit = [0] + list(map(int, sys.stdin.buffer.readline().split()))\n for i in range(1, n + 1):\n if i + (i & -i) < n + 1:\n bit[i + (i & -i)] += bit[i]\n for y in sys.stdin.buffer.readlines():\n q, p, x = list(map(int, y.split()))\n if q:\n print((range_sum(bit, p, x)))\n else:\n add(bit, n, p + 1, x)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":11.3636363636,"diff":["-from numba import njit, b1, i4, i8, f8","-import numpy as np","-@njit((i8[:], i8), cache=True)","-@njit((i8[:], i8, i8, i8), cache=True)","-@njit((i8[:], i8, i8), cache=True)","- bit = np.array([0] + sys.stdin.buffer.readline().split(), np.int64)","+ bit = [0] + list(map(int, sys.stdin.buffer.readline().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.047039851,"measured_runtime_v1":0.0387998159,"runtime_lift":1.212373045,"key":["s984452006","s181972347"]} +{"user_id":"u223133214","problem_id":"p02981","language":"python","submission_id_v0":"s998522016","submission_id_v1":"s551370934","cpu_time_v0":177,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.4,"input":"N, A, B = list(map(int, input().split()))\n\nprint((min(N * A, B)))\n","target":"N, A, B = list(map(int, input().split()))\n\nprint((min(B, A*N)))\n","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":58,"code_v1_num_chars":56,"code_v0_no_empty_lines":"N, A, B = list(map(int, input().split()))\nprint((min(N * A, B)))\n","code_v1_no_empty_lines":"N, A, B = list(map(int, input().split()))\nprint((min(B, A * N)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((min(N * A, B)))","+print((min(B, A * N)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1316676328,"measured_runtime_v1":0.0372604277,"runtime_lift":3.5337123287,"key":["s998522016","s551370934"]} +{"user_id":"u977389981","problem_id":"p03309","language":"python","submission_id_v0":"s367034163","submission_id_v1":"s952040903","cpu_time_v0":293,"cpu_time_v1":254,"memory_v0":25196,"memory_v1":26128,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.31,"input":"n = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nB = []\n\n\n\nfor i in range(n):\n\n b = A[i] - ( i + 1)\n\n B.append(b)\n\n \n\nB.sort()\n\nans = 0\n\nfor i in range(n):\n\n ans += abs(A[i] - (B[len(B) \/\/ 2] + i + 1))\n\n\n\nprint(ans)","target":"n = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nM = []\n\n\n\nfor i in range(n):\n\n M.append(A[i] - (i + 1))\n\n \n\nM.sort()\n\nb = M[len(M) \/\/ 2]\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans += abs(A[i] - (b + i + 1))\n\n \n\nprint(ans)","code_v0_loc":14,"code_v1_loc":15,"code_v0_num_chars":235,"code_v1_num_chars":236,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = [int(i) for i in input().split()]\nB = []\nfor i in range(n):\n b = A[i] - (i + 1)\n B.append(b)\nB.sort()\nans = 0\nfor i in range(n):\n ans += abs(A[i] - (B[len(B) \/\/ 2] + i + 1))\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = [int(i) for i in input().split()]\nM = []\nfor i in range(n):\n M.append(A[i] - (i + 1))\nM.sort()\nb = M[len(M) \/\/ 2]\nans = 0\nfor i in range(n):\n ans += abs(A[i] - (b + i + 1))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["-B = []","+M = []","- b = A[i] - (i + 1)","- B.append(b)","-B.sort()","+ M.append(A[i] - (i + 1))","+M.sort()","+b = M[len(M) \/\/ 2]","- ans += abs(A[i] - (B[len(B) \/\/ 2] + i + 1))","+ ans += abs(A[i] - (b + i + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443982441,"measured_runtime_v1":0.0458746786,"runtime_lift":0.9678159167,"key":["s367034163","s952040903"]} +{"user_id":"u627691992","problem_id":"p03470","language":"python","submission_id_v0":"s940651018","submission_id_v1":"s446911447","cpu_time_v0":34,"cpu_time_v1":30,"memory_v0":9412,"memory_v1":8736,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.76,"input":"from collections import defaultdict\n\n\n\nn = int(eval(input()))\n\nd = [int(eval(input())) for i in range(n)]\n\n\n\ndict = defaultdict(int)\n\nfor i in d:\n\n dict[i] += 1\n\nprint((len(dict)))\n","target":"n = int(eval(input()))\n\nd = {int(eval(input())) for i in range(n)}\n\nprint((len(d)))\n","code_v0_loc":9,"code_v1_loc":3,"code_v0_num_chars":170,"code_v1_num_chars":70,"code_v0_no_empty_lines":"from collections import defaultdict\n\nn = int(eval(input()))\nd = [int(eval(input())) for i in range(n)]\ndict = defaultdict(int)\nfor i in d:\n dict[i] += 1\nprint((len(dict)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nd = {int(eval(input())) for i in range(n)}\nprint((len(d)))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-from collections import defaultdict","-","-d = [int(eval(input())) for i in range(n)]","-dict = defaultdict(int)","-for i in d:","- dict[i] += 1","-print((len(dict)))","+d = {int(eval(input())) for i in range(n)}","+print((len(d)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0068180177,"measured_runtime_v1":0.1038903005,"runtime_lift":0.0656270863,"key":["s940651018","s446911447"]} +{"user_id":"u310233294","problem_id":"p03078","language":"python","submission_id_v0":"s406029572","submission_id_v1":"s322110237","cpu_time_v0":665,"cpu_time_v1":419,"memory_v0":8708,"memory_v1":8864,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.99,"input":"x, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\nt = []\n\nfor i in range(x):\n\n for j in range(y):\n\n for l in range(z):\n\n if (i+1) * (j+1) * (l+1) <= k:\n\n t.append(a[i]+b[j]+c[l])\n\n else:\n\n break\n\nt.sort(reverse=True)\n\nfor i in range(k):\n\n print((t[i]))","target":"x, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\na.sort(reverse=True)\n\nb.sort(reverse=True)\n\nc.sort(reverse=True)\n\nxl = set(range(x))\n\nyl = set(range(y))\n\nzl = set(range(z))\n\nt = []\n\nfor i in xl:\n\n for j in yl:\n\n for l in zl:\n\n if (i+1) * (j+1) * (l+1) <= k:\n\n t.append(a[i]+b[j]+c[l])\n\n else:\n\n break\n\nt.sort(reverse=True)\n\nfor i in range(k):\n\n print((t[i]))","code_v0_loc":18,"code_v1_loc":21,"code_v0_num_chars":482,"code_v1_num_chars":524,"code_v0_no_empty_lines":"x, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nt = []\nfor i in range(x):\n for j in range(y):\n for l in range(z):\n if (i + 1) * (j + 1) * (l + 1) <= k:\n t.append(a[i] + b[j] + c[l])\n else:\n break\nt.sort(reverse=True)\nfor i in range(k):\n print((t[i]))\n","code_v1_no_empty_lines":"x, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\na.sort(reverse=True)\nb.sort(reverse=True)\nc.sort(reverse=True)\nxl = set(range(x))\nyl = set(range(y))\nzl = set(range(z))\nt = []\nfor i in xl:\n for j in yl:\n for l in zl:\n if (i + 1) * (j + 1) * (l + 1) <= k:\n t.append(a[i] + b[j] + c[l])\n else:\n break\nt.sort(reverse=True)\nfor i in range(k):\n print((t[i]))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+xl = set(range(x))","+yl = set(range(y))","+zl = set(range(z))","-for i in range(x):","- for j in range(y):","- for l in range(z):","+for i in xl:","+ for j in yl:","+ for l in zl:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0424257801,"measured_runtime_v1":0.0803453135,"runtime_lift":0.5280429956,"key":["s406029572","s322110237"]} +{"user_id":"u285681431","problem_id":"p02955","language":"python","submission_id_v0":"s613432846","submission_id_v1":"s926403096","cpu_time_v0":323,"cpu_time_v1":133,"memory_v0":9376,"memory_v1":74104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.82,"input":"# \u7d04\u6570\u306e\u5217\u6319\n\n#############################################################\n\n\n\n\n\ndef make_divisors(n):\n\n lower_divisors, upper_divisors = [], []\n\n i = 1\n\n while i * i <= n:\n\n if n % i == 0:\n\n lower_divisors.append(i)\n\n if i != n \/\/ i:\n\n upper_divisors.append(n \/\/ i)\n\n i += 1\n\n return lower_divisors + upper_divisors[::-1]\n\n#############################################################\n\n\n\n\n\nN, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\nsum_A = sum(A)\n\ndiv_list = make_divisors(sum_A)\n\nans = 1\n\n# print(div_list)\n\n\n\nfor div in div_list:\n\n tmp = []\n\n for a in A:\n\n tmp.append(a % div)\n\n tmp.sort()\n\n cumsum1 = [0]\n\n cumsum2 = [0]\n\n for i in tmp:\n\n cumsum1.append(cumsum1[-1] + i)\n\n if i != 0:\n\n cumsum2.append(cumsum2[-1] + (div - i))\n\n else:\n\n cumsum2.append(cumsum2[-1])\n\n for i in range(1, N):\n\n if cumsum1[i] <= K and cumsum2[N] - cumsum2[i] <= K:\n\n ans = div\n\n\n\nprint(ans)\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\n# \u7d04\u6570\u306e\u5217\u6319\n\n#############################################################\n\ndef make_divisors(n):\n\n lower_divisors, upper_divisors = [], []\n\n i = 1\n\n while i * i <= n:\n\n if n % i == 0:\n\n lower_divisors.append(i)\n\n if i != n \/\/ i:\n\n upper_divisors.append(n \/\/ i)\n\n i += 1\n\n return lower_divisors + upper_divisors[::-1]\n\n#############################################################\n\n\n\nN, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\n# \u64cd\u4f5c\u5f8c\u3082\u7dcf\u548c\u306f\u5909\u308f\u3089\u306a\u3044\n\n# \u64cd\u4f5c\u5f8c\u306bdiv\u304c\u516c\u7d04\u6570\u306a\u3089\u3001div\u306f\u7dcf\u548c\u306e\u7d04\u6570\u3067\u3082\u3042\u308b\n\nsum_A = sum(A)\n\ndiv_list = make_divisors(sum_A)\n\nans = 1\n\n\n\nfor div in div_list:\n\n # div\u3067\u5272\u3063\u305f\u4f59\u308a\u306e\u30ea\u30b9\u30c8\u3092\u30bd\u30fc\u30c8\n\n # \u3069\u3053\u304b\u3092\u5883\u306b\u3001\u5de6\u5074\u306f-1\u3092\u3057\u3066\u53f3\u5074\u306f+1\u3092\u3059\u308b\u3068\u4eee\u5b9a\u3059\u308b\n\n tmp = [a % div for a in A]\n\n tmp.sort()\n\n\n\n # \u7d2f\u7a4d\u548c\n\n cumsum1 = [0]\n\n cumsum2 = [0]\n\n for i in tmp:\n\n cumsum1.append(cumsum1[-1] + i)\n\n if i != 0:\n\n cumsum2.append(cumsum2[-1] + (div - i))\n\n else:\n\n cumsum2.append(cumsum2[-1])\n\n\n\n for i in range(1, N):\n\n cnt_minus = cumsum1[i]\n\n cnt_plus = cumsum2[N] - cumsum2[i]\n\n # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u6642\u3001\u5fc5\u305a\u3069\u3053\u304b\u3067\u7b49\u3057\u304f\u306a\u308b\n\n # \uff08\u8a3c\u660e\u304c\u7406\u89e3\u3067\u304d\u3066\u3044\u306a\u3044\u304c\u3001\u5b9f\u9a13\u3059\u308b\u3068\u78ba\u304b\u306b\u305d\u3046\u306a\u308a\u305d\u3046\uff09\n\n if cnt_minus == cnt_plus and cnt_minus <= K:\n\n ans = div\n\n\n\nprint(ans)\n","code_v0_loc":43,"code_v1_loc":51,"code_v0_num_chars":1051,"code_v1_num_chars":1303,"code_v0_no_empty_lines":"# \u7d04\u6570\u306e\u5217\u6319\n#############################################################\ndef make_divisors(n):\n lower_divisors, upper_divisors = [], []\n i = 1\n while i * i <= n:\n if n % i == 0:\n lower_divisors.append(i)\n if i != n \/\/ i:\n upper_divisors.append(n \/\/ i)\n i += 1\n return lower_divisors + upper_divisors[::-1]\n\n\n#############################################################\nN, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nsum_A = sum(A)\ndiv_list = make_divisors(sum_A)\nans = 1\n# print(div_list)\nfor div in div_list:\n tmp = []\n for a in A:\n tmp.append(a % div)\n tmp.sort()\n cumsum1 = [0]\n cumsum2 = [0]\n for i in tmp:\n cumsum1.append(cumsum1[-1] + i)\n if i != 0:\n cumsum2.append(cumsum2[-1] + (div - i))\n else:\n cumsum2.append(cumsum2[-1])\n for i in range(1, N):\n if cumsum1[i] <= K and cumsum2[N] - cumsum2[i] <= K:\n ans = div\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n# \u7d04\u6570\u306e\u5217\u6319\n#############################################################\ndef make_divisors(n):\n lower_divisors, upper_divisors = [], []\n i = 1\n while i * i <= n:\n if n % i == 0:\n lower_divisors.append(i)\n if i != n \/\/ i:\n upper_divisors.append(n \/\/ i)\n i += 1\n return lower_divisors + upper_divisors[::-1]\n\n\n#############################################################\nN, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\n# \u64cd\u4f5c\u5f8c\u3082\u7dcf\u548c\u306f\u5909\u308f\u3089\u306a\u3044\n# \u64cd\u4f5c\u5f8c\u306bdiv\u304c\u516c\u7d04\u6570\u306a\u3089\u3001div\u306f\u7dcf\u548c\u306e\u7d04\u6570\u3067\u3082\u3042\u308b\nsum_A = sum(A)\ndiv_list = make_divisors(sum_A)\nans = 1\nfor div in div_list:\n # div\u3067\u5272\u3063\u305f\u4f59\u308a\u306e\u30ea\u30b9\u30c8\u3092\u30bd\u30fc\u30c8\n # \u3069\u3053\u304b\u3092\u5883\u306b\u3001\u5de6\u5074\u306f-1\u3092\u3057\u3066\u53f3\u5074\u306f+1\u3092\u3059\u308b\u3068\u4eee\u5b9a\u3059\u308b\n tmp = [a % div for a in A]\n tmp.sort()\n # \u7d2f\u7a4d\u548c\n cumsum1 = [0]\n cumsum2 = [0]\n for i in tmp:\n cumsum1.append(cumsum1[-1] + i)\n if i != 0:\n cumsum2.append(cumsum2[-1] + (div - i))\n else:\n cumsum2.append(cumsum2[-1])\n for i in range(1, N):\n cnt_minus = cumsum1[i]\n cnt_plus = cumsum2[N] - cumsum2[i]\n # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u6642\u3001\u5fc5\u305a\u3069\u3053\u304b\u3067\u7b49\u3057\u304f\u306a\u308b\n # \uff08\u8a3c\u660e\u304c\u7406\u89e3\u3067\u304d\u3066\u3044\u306a\u3044\u304c\u3001\u5b9f\u9a13\u3059\u308b\u3068\u78ba\u304b\u306b\u305d\u3046\u306a\u308a\u305d\u3046\uff09\n if cnt_minus == cnt_plus and cnt_minus <= K:\n ans = div\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.6862745098,"diff":["+import sys","+","+input = sys.stdin.readline","+# \u64cd\u4f5c\u5f8c\u3082\u7dcf\u548c\u306f\u5909\u308f\u3089\u306a\u3044","+# \u64cd\u4f5c\u5f8c\u306bdiv\u304c\u516c\u7d04\u6570\u306a\u3089\u3001div\u306f\u7dcf\u548c\u306e\u7d04\u6570\u3067\u3082\u3042\u308b","-# print(div_list)","- tmp = []","- for a in A:","- tmp.append(a % div)","+ # div\u3067\u5272\u3063\u305f\u4f59\u308a\u306e\u30ea\u30b9\u30c8\u3092\u30bd\u30fc\u30c8","+ # \u3069\u3053\u304b\u3092\u5883\u306b\u3001\u5de6\u5074\u306f-1\u3092\u3057\u3066\u53f3\u5074\u306f+1\u3092\u3059\u308b\u3068\u4eee\u5b9a\u3059\u308b","+ tmp = [a % div for a in A]","+ # \u7d2f\u7a4d\u548c","- if cumsum1[i] <= K and cumsum2[N] - cumsum2[i] <= K:","+ cnt_minus = cumsum1[i]","+ cnt_plus = cumsum2[N] - cumsum2[i]","+ # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u6642\u3001\u5fc5\u305a\u3069\u3053\u304b\u3067\u7b49\u3057\u304f\u306a\u308b","+ # \uff08\u8a3c\u660e\u304c\u7406\u89e3\u3067\u304d\u3066\u3044\u306a\u3044\u304c\u3001\u5b9f\u9a13\u3059\u308b\u3068\u78ba\u304b\u306b\u305d\u3046\u306a\u308a\u305d\u3046\uff09","+ if cnt_minus == cnt_plus and cnt_minus <= K:"],"diff_only_import_comment":false,"measured_runtime_v0":0.090282162,"measured_runtime_v1":0.0475431139,"runtime_lift":1.8989534853,"key":["s613432846","s926403096"]} +{"user_id":"u969850098","problem_id":"p02993","language":"python","submission_id_v0":"s841917448","submission_id_v1":"s069957993","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"import sys\n\nS = list(eval(input()))\n\nv = S.pop(0)\n\nfor s in S:\n\n if s == v:\n\n print('Bad')\n\n sys.exit()\n\n v = s\n\n\n\nprint('Good')","target":"S = eval(input())\n\nif S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:\n\n print('Bad')\n\nelse:\n\n print('Good')","code_v0_loc":10,"code_v1_loc":5,"code_v0_num_chars":142,"code_v1_num_chars":105,"code_v0_no_empty_lines":"import sys\n\nS = list(eval(input()))\nv = S.pop(0)\nfor s in S:\n if s == v:\n print(\"Bad\")\n sys.exit()\n v = s\nprint(\"Good\")\n","code_v1_no_empty_lines":"S = eval(input())\nif S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:\n print(\"Bad\")\nelse:\n print(\"Good\")\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import sys","-","-S = list(eval(input()))","-v = S.pop(0)","-for s in S:","- if s == v:","- print(\"Bad\")","- sys.exit()","- v = s","-print(\"Good\")","+S = eval(input())","+if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:","+ print(\"Bad\")","+else:","+ print(\"Good\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0361027172,"measured_runtime_v1":0.0829090521,"runtime_lift":0.435449643,"key":["s841917448","s069957993"]} +{"user_id":"u212919262","problem_id":"p02898","language":"python","submission_id_v0":"s572960573","submission_id_v1":"s574523325","cpu_time_v0":75,"cpu_time_v1":64,"memory_v0":11912,"memory_v1":11904,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.67,"input":"N, K = list(map(int, input().split()))\n\nh = list(map(int, input().split()))\n\nh = sorted(h, reverse=True)\n\nfor i, h_i in enumerate(h):\n\n if h_i >= K:\n\n continue\n\n else:\n\n print(i)\n\n exit()\n\n\n\nprint(N)","target":"import bisect\n\n\n\nN, K = list(map(int, input().split()))\n\nh = list(map(int, input().split()))\n\nh = sorted(h)\n\nprint((N - bisect.bisect_left(h,K)))\n","code_v0_loc":11,"code_v1_loc":6,"code_v0_num_chars":204,"code_v1_num_chars":138,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nh = list(map(int, input().split()))\nh = sorted(h, reverse=True)\nfor i, h_i in enumerate(h):\n if h_i >= K:\n continue\n else:\n print(i)\n exit()\nprint(N)\n","code_v1_no_empty_lines":"import bisect\n\nN, K = list(map(int, input().split()))\nh = list(map(int, input().split()))\nh = sorted(h)\nprint((N - bisect.bisect_left(h, K)))\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["+import bisect","+","-h = sorted(h, reverse=True)","-for i, h_i in enumerate(h):","- if h_i >= K:","- continue","- else:","- print(i)","- exit()","-print(N)","+h = sorted(h)","+print((N - bisect.bisect_left(h, K)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1049035757,"measured_runtime_v1":0.092000726,"runtime_lift":1.1402472592,"key":["s572960573","s574523325"]} +{"user_id":"u673173160","problem_id":"p02629","language":"python","submission_id_v0":"s454636668","submission_id_v1":"s914711978","cpu_time_v0":36,"cpu_time_v1":28,"memory_v0":9124,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.22,"input":"n = int(eval(input()))\n\nans = ''\n\nfor i in range(1, 99):\n\n if n <= 26 ** i:\n\n n -= 1\n\n for j in range(i):\n\n ans += chr(ord('a') + n%26)\n\n n \/\/= 26\n\n break\n\n else:\n\n n -= 26 ** i\n\nprint((ans[::-1]))","target":"n = int(eval(input()))\n\nans = ''\n\nwhile n>0:\n\n n -= 1\n\n ans += chr(ord('a') + n%26)\n\n n \/\/= 26\n\nprint((ans[::-1]))","code_v0_loc":12,"code_v1_loc":7,"code_v0_num_chars":245,"code_v1_num_chars":115,"code_v0_no_empty_lines":"n = int(eval(input()))\nans = \"\"\nfor i in range(1, 99):\n if n <= 26**i:\n n -= 1\n for j in range(i):\n ans += chr(ord(\"a\") + n % 26)\n n \/\/= 26\n break\n else:\n n -= 26**i\nprint((ans[::-1]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nans = \"\"\nwhile n > 0:\n n -= 1\n ans += chr(ord(\"a\") + n % 26)\n n \/\/= 26\nprint((ans[::-1]))\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["-for i in range(1, 99):","- if n <= 26**i:","- n -= 1","- for j in range(i):","- ans += chr(ord(\"a\") + n % 26)","- n \/\/= 26","- break","- else:","- n -= 26**i","+while n > 0:","+ n -= 1","+ ans += chr(ord(\"a\") + n % 26)","+ n \/\/= 26"],"diff_only_import_comment":false,"measured_runtime_v0":0.1034784539,"measured_runtime_v1":0.0457955835,"runtime_lift":2.2595727792,"key":["s454636668","s914711978"]} +{"user_id":"u305018585","problem_id":"p03127","language":"python","submission_id_v0":"s414543306","submission_id_v1":"s160034700","cpu_time_v0":366,"cpu_time_v1":173,"memory_v0":28644,"memory_v1":38064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.73,"input":"import numpy as np\n\ni = eval(input())\n\nN = list(set(map(int, input().split(' '))))\n\ndef one_turn(l):\n\n l.sort()\n\n n = l[0]\n\n return np.array(list(set([n]+[ l[i]%n for i in range(1,len(l)) if ((l[i]%n != 0))])))\n\n\n\nif len(set(N)) == 1 :\n\n print((N[0]))\n\nelse :\n\n N = np.array(N)\n\n while True :\n\n N = one_turn(N)\n\n if N[0] == 1 :\n\n print((1))\n\n break\n\n if len(N) == 1 :\n\n print((N[0]))\n\n break","target":"import numpy as np\n\n\n\nN= int(eval(input()))\n\n\n\nA=list(map(int,input().split()))\n\nA.sort()\n\n\n\ndef gcd(a,b):\n\n if b==0:\n\n return a\n\n else:\n\n return gcd(b,a%b)\n\n \n\n\n\nr = 0\n\nfor i in A:\n\n r = gcd(i,r)\n\nprint(r)\n\n ","code_v0_loc":20,"code_v1_loc":19,"code_v0_num_chars":414,"code_v1_num_chars":214,"code_v0_no_empty_lines":"import numpy as np\n\ni = eval(input())\nN = list(set(map(int, input().split(\" \"))))\n\n\ndef one_turn(l):\n l.sort()\n n = l[0]\n return np.array(\n list(set([n] + [l[i] % n for i in range(1, len(l)) if ((l[i] % n != 0))]))\n )\n\n\nif len(set(N)) == 1:\n print((N[0]))\nelse:\n N = np.array(N)\n while True:\n N = one_turn(N)\n if N[0] == 1:\n print((1))\n break\n if len(N) == 1:\n print((N[0]))\n break\n","code_v1_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nA.sort()\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\n\n\nr = 0\nfor i in A:\n r = gcd(i, r)\nprint(r)\n","code_same":false,"relative_loc_diff_percent":5.0,"diff":["-i = eval(input())","-N = list(set(map(int, input().split(\" \"))))","+N = int(eval(input()))","+A = list(map(int, input().split()))","+A.sort()","-def one_turn(l):","- l.sort()","- n = l[0]","- return np.array(","- list(set([n] + [l[i] % n for i in range(1, len(l)) if ((l[i] % n != 0))]))","- )","+def gcd(a, b):","+ if b == 0:","+ return a","+ else:","+ return gcd(b, a % b)","-if len(set(N)) == 1:","- print((N[0]))","-else:","- N = np.array(N)","- while True:","- N = one_turn(N)","- if N[0] == 1:","- print((1))","- break","- if len(N) == 1:","- print((N[0]))","- break","+r = 0","+for i in A:","+ r = gcd(i, r)","+print(r)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1673826098,"measured_runtime_v1":0.0373234887,"runtime_lift":4.484645342,"key":["s414543306","s160034700"]} +{"user_id":"u909643606","problem_id":"p03162","language":"python","submission_id_v0":"s295727332","submission_id_v1":"s445078506","cpu_time_v0":725,"cpu_time_v1":628,"memory_v0":86232,"memory_v1":47960,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.38,"input":"#import sys\n\n#input = sys.stdin.readline\n\n\n\nn = int(eval(input()))\n\nabc = []\n\nfor i in range(n):\n\n abc.append([int(i) for i in input().split()])\n\ndp = [[float(\"inf\") for i in range(3)] for i in range(n)]\n\n\n\ndp[0] = abc[0]\n\nfor i in range(n-1):\n\n dp[i+1][0] = abc[i+1][0] + max(dp[i][1], dp[i][2])\n\n dp[i+1][1] = abc[i+1][1] + max(dp[i][0], dp[i][2])\n\n dp[i+1][2] = abc[i+1][2] + max(dp[i][0], dp[i][1])\n\n \n\nprint((max(dp[-1])))\n","target":"#import sys\n\n#input = sys.stdin.readline\n\n\n\nn = int(eval(input()))\n\n\n\nfor i in range(n):\n\n if i == 0:\n\n dp = [int(i) for i in input().split()]\n\n else:\n\n abc = [int(i) for i in input().split()]\n\n dp[0], dp[1], dp[2] = abc[0] + max(dp[1], dp[2]), abc[1] + max(dp[0], dp[2]), abc[2] + max(dp[0], dp[1])\n\n \n\nprint((max(dp)))\n\n\n","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":435,"code_v1_num_chars":345,"code_v0_no_empty_lines":"# import sys\n# input = sys.stdin.readline\nn = int(eval(input()))\nabc = []\nfor i in range(n):\n abc.append([int(i) for i in input().split()])\ndp = [[float(\"inf\") for i in range(3)] for i in range(n)]\ndp[0] = abc[0]\nfor i in range(n - 1):\n dp[i + 1][0] = abc[i + 1][0] + max(dp[i][1], dp[i][2])\n dp[i + 1][1] = abc[i + 1][1] + max(dp[i][0], dp[i][2])\n dp[i + 1][2] = abc[i + 1][2] + max(dp[i][0], dp[i][1])\nprint((max(dp[-1])))\n","code_v1_no_empty_lines":"# import sys\n# input = sys.stdin.readline\nn = int(eval(input()))\nfor i in range(n):\n if i == 0:\n dp = [int(i) for i in input().split()]\n else:\n abc = [int(i) for i in input().split()]\n dp[0], dp[1], dp[2] = (\n abc[0] + max(dp[1], dp[2]),\n abc[1] + max(dp[0], dp[2]),\n abc[2] + max(dp[0], dp[1]),\n )\nprint((max(dp)))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-abc = []","- abc.append([int(i) for i in input().split()])","-dp = [[float(\"inf\") for i in range(3)] for i in range(n)]","-dp[0] = abc[0]","-for i in range(n - 1):","- dp[i + 1][0] = abc[i + 1][0] + max(dp[i][1], dp[i][2])","- dp[i + 1][1] = abc[i + 1][1] + max(dp[i][0], dp[i][2])","- dp[i + 1][2] = abc[i + 1][2] + max(dp[i][0], dp[i][1])","-print((max(dp[-1])))","+ if i == 0:","+ dp = [int(i) for i in input().split()]","+ else:","+ abc = [int(i) for i in input().split()]","+ dp[0], dp[1], dp[2] = (","+ abc[0] + max(dp[1], dp[2]),","+ abc[1] + max(dp[0], dp[2]),","+ abc[2] + max(dp[0], dp[1]),","+ )","+print((max(dp)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0364335887,"measured_runtime_v1":0.0413520572,"runtime_lift":0.8810586748,"key":["s295727332","s445078506"]} +{"user_id":"u790710233","problem_id":"p03103","language":"python","submission_id_v0":"s120311160","submission_id_v1":"s914269101","cpu_time_v0":312,"cpu_time_v1":281,"memory_v0":16896,"memory_v1":16916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.94,"input":"import sys\n\ninput = sys.stdin.readline\n\nn, m = list(map(int, input().split()))\n\nab = [tuple(map(int, input().split())) for _ in range(n)]\n\nab.sort()\n\nans = 0\n\nfor a, b in ab:\n\n buy = [m, b][0 <= m-b]\n\n m -= buy\n\n ans += a*buy\n\nprint(ans)\n","target":"import sys\n\ninput = sys.stdin.readline\n\nn, m = list(map(int, input().split()))\n\nab = [tuple(map(int, input().split())) for _ in range(n)]\n\nab.sort()\n\nans = 0\n\nfor a, b in ab:\n\n buy = min(m, b)\n\n m -= buy\n\n ans += a*buy\n\nprint(ans)\n","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":241,"code_v1_num_chars":234,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, m = list(map(int, input().split()))\nab = [tuple(map(int, input().split())) for _ in range(n)]\nab.sort()\nans = 0\nfor a, b in ab:\n buy = [m, b][0 <= m - b]\n m -= buy\n ans += a * buy\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, m = list(map(int, input().split()))\nab = [tuple(map(int, input().split())) for _ in range(n)]\nab.sort()\nans = 0\nfor a, b in ab:\n buy = min(m, b)\n m -= buy\n ans += a * buy\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- buy = [m, b][0 <= m - b]","+ buy = min(m, b)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0345670216,"measured_runtime_v1":0.2567556999,"runtime_lift":0.1346300068,"key":["s120311160","s914269101"]} +{"user_id":"u634079249","problem_id":"p03013","language":"python","submission_id_v0":"s931124052","submission_id_v1":"s868903436","cpu_time_v0":457,"cpu_time_v1":84,"memory_v0":460912,"memory_v1":14140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.62,"input":"import sys\n\n\n\nsys.setrecursionlimit(10000000)\n\nimport os\n\nimport math\n\nimport bisect\n\nimport collections\n\nimport itertools\n\nimport heapq\n\nimport re\n\nimport queue\n\n\n\n# import fractions\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\nlcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)\n\n# lcm = lambda x, y: (x * y) \/\/ fractions.gcd(x, y)\n\n\n\nMOD = 10 ** 9 + 7\n\nMAX = float('inf')\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N, M = il()\n\n A = set(iln(M))\n\n dp = [0]*(N+1)\n\n dp[0] = 1\n\n\n\n for n in range(1, N+1):\n\n if n in A:\n\n dp[n] = 0\n\n else:\n\n dp[n] = dp[n-1] + dp[n-2]\n\n print((dp[N]%MOD))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\n\n\nsys.setrecursionlimit(10000000)\n\nimport os\n\nimport math\n\nimport bisect\n\nimport collections\n\nimport itertools\n\nimport heapq\n\nimport re\n\nimport queue\n\n\n\n# import fractions\n\n\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\n\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\n\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\n\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\n\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\n\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\n\n\nlcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)\n\n# lcm = lambda x, y: (x * y) \/\/ fractions.gcd(x, y)\n\n\n\nMOD = 10 ** 9 + 7\n\nMAX = float('inf')\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N, M = il()\n\n A = set(iln(M))\n\n dp = [0]*(N+1)\n\n dp[0] = 1\n\n\n\n for n in range(1, N+1):\n\n if n in A:\n\n dp[n] = 0\n\n else:\n\n dp[n] = (dp[n-1] + dp[n-2])%MOD\n\n print((dp[N]%MOD))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":49,"code_v1_loc":49,"code_v0_num_chars":1176,"code_v1_num_chars":1182,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10000000)\nimport os\nimport math\nimport bisect\nimport collections\nimport itertools\nimport heapq\nimport re\nimport queue\n\n# import fractions\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\nlcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)\n# lcm = lambda x, y: (x * y) \/\/ fractions.gcd(x, y)\nMOD = 10**9 + 7\nMAX = float(\"inf\")\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N, M = il()\n A = set(iln(M))\n dp = [0] * (N + 1)\n dp[0] = 1\n for n in range(1, N + 1):\n if n in A:\n dp[n] = 0\n else:\n dp[n] = dp[n - 1] + dp[n - 2]\n print((dp[N] % MOD))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10000000)\nimport os\nimport math\nimport bisect\nimport collections\nimport itertools\nimport heapq\nimport re\nimport queue\n\n# import fractions\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\nlcm = lambda x, y: (x * y) \/\/ math.gcd(x, y)\n# lcm = lambda x, y: (x * y) \/\/ fractions.gcd(x, y)\nMOD = 10**9 + 7\nMAX = float(\"inf\")\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N, M = il()\n A = set(iln(M))\n dp = [0] * (N + 1)\n dp[0] = 1\n for n in range(1, N + 1):\n if n in A:\n dp[n] = 0\n else:\n dp[n] = (dp[n - 1] + dp[n - 2]) % MOD\n print((dp[N] % MOD))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dp[n] = dp[n - 1] + dp[n - 2]","+ dp[n] = (dp[n - 1] + dp[n - 2]) % MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.0936082835,"measured_runtime_v1":0.1043342345,"runtime_lift":0.8971962461,"key":["s931124052","s868903436"]} +{"user_id":"u472065247","problem_id":"p03108","language":"python","submission_id_v0":"s850239562","submission_id_v1":"s035004924","cpu_time_v0":727,"cpu_time_v1":525,"memory_v0":22420,"memory_v1":25076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.79,"input":"n, m = list(map(int, input().split()))\n\nab = [tuple(map(int, input().split())) for _ in range(m)]\n\n\n\nu = [-1] * (n + 1)\n\n\n\ndef find(v):\n\n if u[v] < 0:\n\n return v\n\n else:\n\n return find(u[v])\n\n\n\ntotal = n * (n - 1) \/\/ 2\n\nans = [total]\n\n\n\nfor a, b in reversed(ab[1:]):\n\n af = find(a)\n\n bf = find(b)\n\n af, bf =sorted([af, bf])\n\n if af != bf:\n\n total -= u[af] * u[bf]\n\n u[af] += u[bf]\n\n u[bf] = af\n\n ans.append(total)\n\n\n\nfor a in reversed(ans):\n\n print(a)","target":"class UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n \n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\nN, M, *X = list(map(int,open(0).read().split()))\n\n\n\nuf = UnionFind(N + 1)\n\n\n\nS = N * (N - 1) \/\/ 2\n\nr = [S]\n\n\n\nwhile X:\n\n b, a = X.pop(), X.pop()\n\n if not uf.same(a, b):\n\n S -= uf.size(a) * uf.size(b)\n\n r.append(S)\n\n uf.union(a, b)\n\n\n\nfor a in r[-2::-1]:\n\n print(a)","code_v0_loc":26,"code_v1_loc":47,"code_v0_num_chars":503,"code_v1_num_chars":980,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nab = [tuple(map(int, input().split())) for _ in range(m)]\nu = [-1] * (n + 1)\n\n\ndef find(v):\n if u[v] < 0:\n return v\n else:\n return find(u[v])\n\n\ntotal = n * (n - 1) \/\/ 2\nans = [total]\nfor a, b in reversed(ab[1:]):\n af = find(a)\n bf = find(b)\n af, bf = sorted([af, bf])\n if af != bf:\n total -= u[af] * u[bf]\n u[af] += u[bf]\n u[bf] = af\n ans.append(total)\nfor a in reversed(ans):\n print(a)\n","code_v1_no_empty_lines":"class UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n\nN, M, *X = list(map(int, open(0).read().split()))\nuf = UnionFind(N + 1)\nS = N * (N - 1) \/\/ 2\nr = [S]\nwhile X:\n b, a = X.pop(), X.pop()\n if not uf.same(a, b):\n S -= uf.size(a) * uf.size(b)\n r.append(S)\n uf.union(a, b)\nfor a in r[-2::-1]:\n print(a)\n","code_same":false,"relative_loc_diff_percent":44.6808510638,"diff":["-n, m = list(map(int, input().split()))","-ab = [tuple(map(int, input().split())) for _ in range(m)]","-u = [-1] * (n + 1)","+class UnionFind:","+ def __init__(self, n):","+ self.n = n","+ self.parents = [-1] * n","+","+ def find(self, x):","+ if self.parents[x] < 0:","+ return x","+ else:","+ self.parents[x] = self.find(self.parents[x])","+ return self.parents[x]","+","+ def union(self, x, y):","+ x = self.find(x)","+ y = self.find(y)","+ if x == y:","+ return","+ if self.parents[x] > self.parents[y]:","+ x, y = y, x","+ self.parents[x] += self.parents[y]","+ self.parents[y] = x","+","+ def size(self, x):","+ return -self.parents[self.find(x)]","+","+ def same(self, x, y):","+ return self.find(x) == self.find(y)","-def find(v):","- if u[v] < 0:","- return v","- else:","- return find(u[v])","-","-","-total = n * (n - 1) \/\/ 2","-ans = [total]","-for a, b in reversed(ab[1:]):","- af = find(a)","- bf = find(b)","- af, bf = sorted([af, bf])","- if af != bf:","- total -= u[af] * u[bf]","- u[af] += u[bf]","- u[bf] = af","- ans.append(total)","-for a in reversed(ans):","+N, M, *X = list(map(int, open(0).read().split()))","+uf = UnionFind(N + 1)","+S = N * (N - 1) \/\/ 2","+r = [S]","+while X:","+ b, a = X.pop(), X.pop()","+ if not uf.same(a, b):","+ S -= uf.size(a) * uf.size(b)","+ r.append(S)","+ uf.union(a, b)","+for a in r[-2::-1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0394290257,"measured_runtime_v1":0.0488045657,"runtime_lift":0.8078962511,"key":["s850239562","s035004924"]} +{"user_id":"u057109575","problem_id":"p02833","language":"python","submission_id_v0":"s981297413","submission_id_v1":"s228837836","cpu_time_v0":258,"cpu_time_v1":66,"memory_v0":61140,"memory_v1":61868,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.42,"input":"N = int(eval(input()))\n\n\n\nif N % 2 == 1:\n\n print((0))\n\nelse:\n\n cnt = 0\n\n div = 10\n\n for _ in range(100):\n\n cnt += N \/\/ div\n\n div *= 5\n\n print(cnt)\n","target":"\n\nN = int(eval(input()))\n\n\n\nif N % 2 == 1:\n\n print((0))\n\nelse:\n\n ans = 0\n\n div = 10\n\n for _ in range(100):\n\n ans += N \/\/ div\n\n div *= 5\n\n\n\n print(ans)\n","code_v0_loc":11,"code_v1_loc":13,"code_v0_num_chars":168,"code_v1_num_chars":172,"code_v0_no_empty_lines":"N = int(eval(input()))\nif N % 2 == 1:\n print((0))\nelse:\n cnt = 0\n div = 10\n for _ in range(100):\n cnt += N \/\/ div\n div *= 5\n print(cnt)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nif N % 2 == 1:\n print((0))\nelse:\n ans = 0\n div = 10\n for _ in range(100):\n ans += N \/\/ div\n div *= 5\n print(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["- cnt = 0","+ ans = 0","- cnt += N \/\/ div","+ ans += N \/\/ div","- print(cnt)","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.036189544,"measured_runtime_v1":0.0360753326,"runtime_lift":1.0031659115,"key":["s981297413","s228837836"]} +{"user_id":"u604774382","problem_id":"p02261","language":"python","submission_id_v0":"s875904659","submission_id_v1":"s368986207","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":6756,"memory_v1":4272,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"def bubbleSort( cards ):\n\n n = len( cards )\n\n for i in range( 0, n ):\n\n for j in range( n-1 , i, -1 ):\n\n if int( cards[j][1] ) < int( cards[ j-1 ][1] ):\n\n cards[j], cards[ j-1 ] = cards[ j-1 ], cards[j]\n\n \n\n print(( \" \".join( map( str, cards ) ) ))\n\n \n\ndef selectionSort( cards ):\n\n\tn = len( cards )\n\n\tfor i in range( 0, n ):\n\n\t\tmini = i\n\n\t\tfor j in range( i , n ):\n\n\t\t\tif int( cards[j][1] ) < int( cards[ mini ][1] ):\n\n\t\t\t\tmini = j\n\n\t\tif mini != i:\n\n\t\t\tcards[i], cards[ mini ] = cards[ mini ], cards[i]\n\n\n\n\tprint(( \" \".join( map( str, cards ) ) ))\n\n\n\n\n\nn = int( eval(input( )) )\n\ncards = input( ).split( \" \" )\n\ncards2 = list( cards )\n\nbubbleSort( cards )\n\nprint( \"Stable\" )\n\nselectionSort( cards2 )\n\nif \" \".join( map( str, cards2 ) ) == \" \".join( map( str, cards ) ):\n\n\tprint( \"Stable\" )\n\nelse:\n\n\tprint( \"Not stable\" )","target":"def bubbleSort( cards ):\n\n n = len( cards )\n\n for i in range( 0, n ):\n\n for j in range( n-1 , i, -1 ):\n\n if int( cards[j][1] ) < int( cards[ j-1 ][1] ):\n\n cards[j], cards[ j-1 ] = cards[ j-1 ], cards[j]\n\n \n\n print(( \" \".join( map( str, cards ) ) ))\n\n \n\ndef selectionSort( cards ):\n\n\tn = len( cards )\n\n\tfor i in range( 0, n ):\n\n\t\tmini = i\n\n\t\tfor j in range( i , n ):\n\n\t\t\tif int( cards[j][1] ) < int( cards[ mini ][1] ):\n\n\t\t\t\tmini = j\n\n\t\tif mini != i:\n\n\t\t\tcards[i], cards[ mini ] = cards[ mini ], cards[i]\n\n\n\n\tprint(( \" \".join( map( str, cards ) ) ))\n\n\n\n\n\nn = int( input( ) )\n\ncards = input( ).split( \" \" )\n\ncards2 = list( cards )\n\nbubbleSort( cards )\n\nprint( \"Stable\" )\n\nselectionSort( cards2 )\n\nif cards2 == cards:\n\n\tprint( \"Stable\" )\n\nelse:\n\n\tprint( \"Not stable\" )","code_v0_loc":32,"code_v1_loc":32,"code_v0_num_chars":851,"code_v1_num_chars":811,"code_v0_no_empty_lines":"def bubbleSort(cards):\n n = len(cards)\n for i in range(0, n):\n for j in range(n - 1, i, -1):\n if int(cards[j][1]) < int(cards[j - 1][1]):\n cards[j], cards[j - 1] = cards[j - 1], cards[j]\n print((\" \".join(map(str, cards))))\n\n\ndef selectionSort(cards):\n n = len(cards)\n for i in range(0, n):\n mini = i\n for j in range(i, n):\n if int(cards[j][1]) < int(cards[mini][1]):\n mini = j\n if mini != i:\n cards[i], cards[mini] = cards[mini], cards[i]\n print((\" \".join(map(str, cards))))\n\n\nn = int(eval(input()))\ncards = input().split(\" \")\ncards2 = list(cards)\nbubbleSort(cards)\nprint(\"Stable\")\nselectionSort(cards2)\nif \" \".join(map(str, cards2)) == \" \".join(map(str, cards)):\n print(\"Stable\")\nelse:\n print(\"Not stable\")\n","code_v1_no_empty_lines":"def bubbleSort(cards):\n n = len(cards)\n for i in range(0, n):\n for j in range(n - 1, i, -1):\n if int(cards[j][1]) < int(cards[j - 1][1]):\n cards[j], cards[j - 1] = cards[j - 1], cards[j]\n print((\" \".join(map(str, cards))))\n\n\ndef selectionSort(cards):\n n = len(cards)\n for i in range(0, n):\n mini = i\n for j in range(i, n):\n if int(cards[j][1]) < int(cards[mini][1]):\n mini = j\n if mini != i:\n cards[i], cards[mini] = cards[mini], cards[i]\n print((\" \".join(map(str, cards))))\n\n\nn = int(input())\ncards = input().split(\" \")\ncards2 = list(cards)\nbubbleSort(cards)\nprint(\"Stable\")\nselectionSort(cards2)\nif cards2 == cards:\n print(\"Stable\")\nelse:\n print(\"Not stable\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-n = int(eval(input()))","+n = int(input())","-if \" \".join(map(str, cards2)) == \" \".join(map(str, cards)):","+if cards2 == cards:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0498777876,"measured_runtime_v1":0.0470203714,"runtime_lift":1.0607697502,"key":["s875904659","s368986207"]} +{"user_id":"u606045429","problem_id":"p02874","language":"python","submission_id_v0":"s309408105","submission_id_v1":"s873072751","cpu_time_v0":345,"cpu_time_v1":303,"memory_v0":34608,"memory_v1":28384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.17,"input":"from sys import stdin\n\n\n\ndef main():\n\n N, *LR = list(map(int, stdin.buffer.read().split()))\n\n L, R = LR[::2], LR[1::2]\n\n\n\n Lp = max(L)\n\n Rq = min(R)\n\n\n\n A, B = list(zip(*sorted((max(0, r - Lp + 1), -max(0, Rq - l + 1)) for l, r in zip(L, R))))\n\n\n\n mi = float(\"inf\")\n\n ma = max(r - l + 1 for l, r in zip(L, R)) + max(0, Rq - Lp + 1)\n\n\n\n for a, b in zip(A[1:], B):\n\n mi = min(mi, -b)\n\n ma = max(ma, mi + a)\n\n\n\n print(ma)\n\n\n\n\n\nmain()\n","target":"from sys import stdin\n\n\n\ndef main():\n\n N, *LR = list(map(int, stdin.buffer.read().split()))\n\n L, R = LR[::2], LR[1::2]\n\n\n\n Lp = max(L)\n\n Rq = min(R)\n\n\n\n AB = sorted((max(0, r - Lp + 1), -max(0, Rq - l + 1)) for l, r in zip(L, R))\n\n\n\n mi = float(\"inf\")\n\n ma = max(r - l + 1 for l, r in zip(L, R)) + max(0, Rq - Lp + 1)\n\n\n\n for i, (a, b) in enumerate(AB):\n\n if i:\n\n ma = max(ma, mi + a)\n\n mi = min(mi, -b)\n\n\n\n print(ma)\n\n\n\n\n\nmain()\n","code_v0_loc":22,"code_v1_loc":23,"code_v0_num_chars":460,"code_v1_num_chars":476,"code_v0_no_empty_lines":"from sys import stdin\n\n\ndef main():\n N, *LR = list(map(int, stdin.buffer.read().split()))\n L, R = LR[::2], LR[1::2]\n Lp = max(L)\n Rq = min(R)\n A, B = list(\n zip(*sorted((max(0, r - Lp + 1), -max(0, Rq - l + 1)) for l, r in zip(L, R)))\n )\n mi = float(\"inf\")\n ma = max(r - l + 1 for l, r in zip(L, R)) + max(0, Rq - Lp + 1)\n for a, b in zip(A[1:], B):\n mi = min(mi, -b)\n ma = max(ma, mi + a)\n print(ma)\n\n\nmain()\n","code_v1_no_empty_lines":"from sys import stdin\n\n\ndef main():\n N, *LR = list(map(int, stdin.buffer.read().split()))\n L, R = LR[::2], LR[1::2]\n Lp = max(L)\n Rq = min(R)\n AB = sorted((max(0, r - Lp + 1), -max(0, Rq - l + 1)) for l, r in zip(L, R))\n mi = float(\"inf\")\n ma = max(r - l + 1 for l, r in zip(L, R)) + max(0, Rq - Lp + 1)\n for i, (a, b) in enumerate(AB):\n if i:\n ma = max(ma, mi + a)\n mi = min(mi, -b)\n print(ma)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["- A, B = list(","- zip(*sorted((max(0, r - Lp + 1), -max(0, Rq - l + 1)) for l, r in zip(L, R)))","- )","+ AB = sorted((max(0, r - Lp + 1), -max(0, Rq - l + 1)) for l, r in zip(L, R))","- for a, b in zip(A[1:], B):","+ for i, (a, b) in enumerate(AB):","+ if i:","+ ma = max(ma, mi + a)","- ma = max(ma, mi + a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0438662891,"measured_runtime_v1":0.0440910499,"runtime_lift":0.9949023491,"key":["s309408105","s873072751"]} +{"user_id":"u934442292","problem_id":"p03164","language":"python","submission_id_v0":"s183250058","submission_id_v1":"s744040297","cpu_time_v0":1336,"cpu_time_v1":1141,"memory_v0":200464,"memory_v1":198232,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.6,"input":"import sys\n\n\n\nimport numba as nb\n\nimport numpy as np\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\n@nb.njit(\"i8(i8,i8,i8[:],i8[:])\")\n\ndef solve(N, W, w, v):\n\n dp = np.full(shape=(N + 1, np.sum(v) + 1), fill_value=(N * W), dtype=np.int64)\n\n dp[:, 0] = 0\n\n for i in range(N):\n\n # TODO: use out keyward\n\n dp[i + 1][:v[i]] = np.minimum(w[i], dp[i][:v[i]])\n\n dp[i + 1][v[i]:] = np.minimum(w[i] + dp[i][: - v[i]], dp[i][v[i]:])\n\n return np.where(dp[-1] <= W)[0][-1]\n\n\n\n\n\ndef main():\n\n N, W = list(map(int, input().split()))\n\n\n\n w = np.empty(shape=N, dtype=np.int64)\n\n v = np.empty(shape=N, dtype=np.int64)\n\n for i in range(N):\n\n w[i], v[i] = list(map(int, input().split()))\n\n\n\n ans = solve(N, W, w, v)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"import sys\n\n\n\nimport numba as nb\n\nimport numpy as np\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\n@nb.njit(\"i8(i8,i8,i8[:],i8[:])\")\n\ndef solve(N, W, w, v):\n\n dp = np.full(shape=(N + 1, np.sum(v) + 1), fill_value=(N * W), dtype=np.int64)\n\n dp[:, 0] = 0\n\n for i in range(N):\n\n np.minimum(w[i], dp[i][:v[i]], dp[i + 1][:v[i]])\n\n np.minimum(w[i] + dp[i][: - v[i]], dp[i][v[i]:], dp[i + 1][v[i]:])\n\n return np.where(dp[-1] <= W)[0][-1]\n\n\n\n\n\ndef main():\n\n N, W = list(map(int, input().split()))\n\n\n\n w = np.empty(shape=N, dtype=np.int64)\n\n v = np.empty(shape=N, dtype=np.int64)\n\n for i in range(N):\n\n w[i], v[i] = list(map(int, input().split()))\n\n\n\n ans = solve(N, W, w, v)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":33,"code_v1_loc":32,"code_v0_num_chars":788,"code_v1_num_chars":753,"code_v0_no_empty_lines":"import sys\nimport numba as nb\nimport numpy as np\n\ninput = sys.stdin.readline\n\n\n@nb.njit(\"i8(i8,i8,i8[:],i8[:])\")\ndef solve(N, W, w, v):\n dp = np.full(shape=(N + 1, np.sum(v) + 1), fill_value=(N * W), dtype=np.int64)\n dp[:, 0] = 0\n for i in range(N):\n # TODO: use out keyward\n dp[i + 1][: v[i]] = np.minimum(w[i], dp[i][: v[i]])\n dp[i + 1][v[i] :] = np.minimum(w[i] + dp[i][: -v[i]], dp[i][v[i] :])\n return np.where(dp[-1] <= W)[0][-1]\n\n\ndef main():\n N, W = list(map(int, input().split()))\n w = np.empty(shape=N, dtype=np.int64)\n v = np.empty(shape=N, dtype=np.int64)\n for i in range(N):\n w[i], v[i] = list(map(int, input().split()))\n ans = solve(N, W, w, v)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport numba as nb\nimport numpy as np\n\ninput = sys.stdin.readline\n\n\n@nb.njit(\"i8(i8,i8,i8[:],i8[:])\")\ndef solve(N, W, w, v):\n dp = np.full(shape=(N + 1, np.sum(v) + 1), fill_value=(N * W), dtype=np.int64)\n dp[:, 0] = 0\n for i in range(N):\n np.minimum(w[i], dp[i][: v[i]], dp[i + 1][: v[i]])\n np.minimum(w[i] + dp[i][: -v[i]], dp[i][v[i] :], dp[i + 1][v[i] :])\n return np.where(dp[-1] <= W)[0][-1]\n\n\ndef main():\n N, W = list(map(int, input().split()))\n w = np.empty(shape=N, dtype=np.int64)\n v = np.empty(shape=N, dtype=np.int64)\n for i in range(N):\n w[i], v[i] = list(map(int, input().split()))\n ans = solve(N, W, w, v)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.0303030303,"diff":["- # TODO: use out keyward","- dp[i + 1][: v[i]] = np.minimum(w[i], dp[i][: v[i]])","- dp[i + 1][v[i] :] = np.minimum(w[i] + dp[i][: -v[i]], dp[i][v[i] :])","+ np.minimum(w[i], dp[i][: v[i]], dp[i + 1][: v[i]])","+ np.minimum(w[i] + dp[i][: -v[i]], dp[i][v[i] :], dp[i + 1][v[i] :])"],"diff_only_import_comment":false,"measured_runtime_v0":0.1457276947,"measured_runtime_v1":0.0466497595,"runtime_lift":3.1238680796,"key":["s183250058","s744040297"]} +{"user_id":"u460245024","problem_id":"p03061","language":"python","submission_id_v0":"s107398735","submission_id_v1":"s613376319","cpu_time_v0":214,"cpu_time_v1":197,"memory_v0":16132,"memory_v1":16144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.94,"input":"from fractions import gcd\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nl_gcd_list = [0]*(N+1)\n\nr_gcd_list = [0]*(N+1)\n\nfor i in range(N):\n\n l_gcd_list[i+1] = (gcd(l_gcd_list[i], A[i]))\n\n r_gcd_list[-(i+2)] = (gcd(r_gcd_list[-(i+1)], A[-(i+1)]))\n\n# print(l_gcd_list)\n\n# print(r_gcd_list)\n\n\n\nresults = []\n\nfor i in range(N):\n\n results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))\n\n\n\nprint((max(results)))\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nfrom fractions import gcd\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nl_gcd_list = [0]\n\nr_gcd_list = [0]\n\nfor i in range(N):\n\n l_gcd_list.append(gcd(l_gcd_list[i], A[i]))\n\n r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))\n\nr_gcd_list = r_gcd_list[::-1]\n\n# print(l_gcd_list)\n\n# print(r_gcd_list)\n\n\n\nresults = []\n\nfor i in range(N):\n\n results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))\n\n\n\nprint((max(results)))\n","code_v0_loc":20,"code_v1_loc":22,"code_v0_num_chars":464,"code_v1_num_chars":475,"code_v0_no_empty_lines":"from fractions import gcd\nimport sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nA = list(map(int, input().split()))\nl_gcd_list = [0] * (N + 1)\nr_gcd_list = [0] * (N + 1)\nfor i in range(N):\n l_gcd_list[i + 1] = gcd(l_gcd_list[i], A[i])\n r_gcd_list[-(i + 2)] = gcd(r_gcd_list[-(i + 1)], A[-(i + 1)])\n# print(l_gcd_list)\n# print(r_gcd_list)\nresults = []\nfor i in range(N):\n results.append(gcd(l_gcd_list[i], r_gcd_list[i + 1]))\nprint((max(results)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom fractions import gcd\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nl_gcd_list = [0]\nr_gcd_list = [0]\nfor i in range(N):\n l_gcd_list.append(gcd(l_gcd_list[i], A[i]))\n r_gcd_list.append(gcd(r_gcd_list[i], A[-(i + 1)]))\nr_gcd_list = r_gcd_list[::-1]\n# print(l_gcd_list)\n# print(r_gcd_list)\nresults = []\nfor i in range(N):\n results.append(gcd(l_gcd_list[i], r_gcd_list[i + 1]))\nprint((max(results)))\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-from fractions import gcd","+from fractions import gcd","+","-l_gcd_list = [0] * (N + 1)","-r_gcd_list = [0] * (N + 1)","+l_gcd_list = [0]","+r_gcd_list = [0]","- l_gcd_list[i + 1] = gcd(l_gcd_list[i], A[i])","- r_gcd_list[-(i + 2)] = gcd(r_gcd_list[-(i + 1)], A[-(i + 1)])","+ l_gcd_list.append(gcd(l_gcd_list[i], A[i]))","+ r_gcd_list.append(gcd(r_gcd_list[i], A[-(i + 1)]))","+r_gcd_list = r_gcd_list[::-1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0799044631,"measured_runtime_v1":0.145865509,"runtime_lift":0.5477954561,"key":["s107398735","s613376319"]} +{"user_id":"u017415492","problem_id":"p02947","language":"python","submission_id_v0":"s745202784","submission_id_v1":"s982243262","cpu_time_v0":529,"cpu_time_v1":448,"memory_v0":24652,"memory_v1":12012,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.31,"input":"n=int(eval(input()))\n\nd=[list(eval(input())) for i in range(n)]\n\ncount=0\n\nans=0\n\nfor i in range(n):\n\n d[i].sort()\n\nd.sort()\n\n\n\nfor i in range(n-1):\n\n if d[i]==d[i+1]:\n\n count+=1\n\n elif d[i]!=d[i+1]:\n\n x=count+1\n\n count=0\n\n ans+=(x*(x-1))\/2\n\n if i==(n-2):\n\n x=count+1\n\n count=0\n\n ans+=(x*(x-1))\/2\n\n \n\nprint((int(ans)))","target":"n=int(eval(input()))\n\nd=[]\n\nfor i in range(n):\n\n s=list(eval(input()))\n\n s.sort()\n\n s=\"\".join(s)\n\n d.append(s)\n\nd.sort()\n\nx=[]\n\nk=1\n\n\n\nfor i in range(n-1):\n\n if d[i]==d[i+1]:\n\n k+=1\n\n else:\n\n x.append(k)\n\n k=1\n\nx.append(k)\n\n\n\nans=[]\n\nfor i in range(len(x)):\n\n if x[i]>1:\n\n ans.append((x[i]*(x[i]-1))\/2)\n\n else:\n\n ans.append(0)\n\n \n\n \n\nprint((int(sum(ans))))","code_v0_loc":21,"code_v1_loc":28,"code_v0_num_chars":329,"code_v1_num_chars":371,"code_v0_no_empty_lines":"n = int(eval(input()))\nd = [list(eval(input())) for i in range(n)]\ncount = 0\nans = 0\nfor i in range(n):\n d[i].sort()\nd.sort()\nfor i in range(n - 1):\n if d[i] == d[i + 1]:\n count += 1\n elif d[i] != d[i + 1]:\n x = count + 1\n count = 0\n ans += (x * (x - 1)) \/ 2\n if i == (n - 2):\n x = count + 1\n count = 0\n ans += (x * (x - 1)) \/ 2\nprint((int(ans)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nd = []\nfor i in range(n):\n s = list(eval(input()))\n s.sort()\n s = \"\".join(s)\n d.append(s)\nd.sort()\nx = []\nk = 1\nfor i in range(n - 1):\n if d[i] == d[i + 1]:\n k += 1\n else:\n x.append(k)\n k = 1\nx.append(k)\nans = []\nfor i in range(len(x)):\n if x[i] > 1:\n ans.append((x[i] * (x[i] - 1)) \/ 2)\n else:\n ans.append(0)\nprint((int(sum(ans))))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-d = [list(eval(input())) for i in range(n)]","-count = 0","-ans = 0","+d = []","- d[i].sort()","+ s = list(eval(input()))","+ s.sort()","+ s = \"\".join(s)","+ d.append(s)","+x = []","+k = 1","- count += 1","- elif d[i] != d[i + 1]:","- x = count + 1","- count = 0","- ans += (x * (x - 1)) \/ 2","- if i == (n - 2):","- x = count + 1","- count = 0","- ans += (x * (x - 1)) \/ 2","-print((int(ans)))","+ k += 1","+ else:","+ x.append(k)","+ k = 1","+x.append(k)","+ans = []","+for i in range(len(x)):","+ if x[i] > 1:","+ ans.append((x[i] * (x[i] - 1)) \/ 2)","+ else:","+ ans.append(0)","+print((int(sum(ans))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0360148811,"measured_runtime_v1":0.0343990722,"runtime_lift":1.0469724574,"key":["s745202784","s982243262"]} +{"user_id":"u698693989","problem_id":"p02394","language":"python","submission_id_v0":"s698315876","submission_id_v1":"s700214809","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7668,"memory_v1":5596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"W,H,x,y,r=list(map(int,input().split()))\n\nif x+r > W or y+r > H:\n\n print(\"No\")\n\nelif x-r < 0 or y-r < 0:\n\n print(\"No\")\n\nelse:\n\n print(\"Yes\") ","target":"list=input().split()\n\nw=int(list[0])\n\nh=int(list[1])\n\nx=int(list[2])\n\ny=int(list[3])\n\nr=int(list[4])\n\n\n\nif w>=x+r and x-r>=0:\n\n if h>=y+r and y-r>=0:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")\n\nelse:\n\n print(\"No\")\n","code_v0_loc":7,"code_v1_loc":14,"code_v0_num_chars":179,"code_v1_num_chars":217,"code_v0_no_empty_lines":"W, H, x, y, r = list(map(int, input().split()))\nif x + r > W or y + r > H:\n print(\"No\")\nelif x - r < 0 or y - r < 0:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"list = input().split()\nw = int(list[0])\nh = int(list[1])\nx = int(list[2])\ny = int(list[3])\nr = int(list[4])\nif w >= x + r and x - r >= 0:\n if h >= y + r and y - r >= 0:\n print(\"Yes\")\n else:\n print(\"No\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-W, H, x, y, r = list(map(int, input().split()))","-if x + r > W or y + r > H:","+list = input().split()","+w = int(list[0])","+h = int(list[1])","+x = int(list[2])","+y = int(list[3])","+r = int(list[4])","+if w >= x + r and x - r >= 0:","+ if h >= y + r and y - r >= 0:","+ print(\"Yes\")","+ else:","+ print(\"No\")","+else:","-elif x - r < 0 or y - r < 0:","- print(\"No\")","-else:","- print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0362334998,"measured_runtime_v1":0.034708813,"runtime_lift":1.0439279442,"key":["s698315876","s700214809"]} +{"user_id":"u404556828","problem_id":"p03370","language":"python","submission_id_v0":"s229856741","submission_id_v1":"s662476278","cpu_time_v0":288,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.1,"input":"N, X = [int(x) for x in input().split()]\n\n\n\nlist01=[]\n\nfor i in range(N):\n\n j = int(eval(input()))\n\n list01.append(j)\n\n \n\nj = 0\n\nmass = sum(list01)\n\n\n\nwhile mass <= X:\n\n j += 1\n\n mass = sum(list01) + min(list01) * j\n\n\n\nprint((N + j -1))","target":"N, X = [int(x) for x in input().split()]\n\n\n\nlist01 = []\n\nfor i in range(N):\n\n i = int(eval(input()))\n\n list01.append(i)\n\n\n\nmin_01 = 0\n\nfor i in range(len(list01)):\n\n if min_01 == 0:\n\n min_01 = list01[i]\n\n elif list01[i] < min_01:\n\n min_01 = list01[i]\n\n \n\nfor i in range(len(list01)):\n\n X -= list01[i]\n\n \n\nprint((X \/\/ min_01 + N))\n","code_v0_loc":15,"code_v1_loc":18,"code_v0_num_chars":232,"code_v1_num_chars":337,"code_v0_no_empty_lines":"N, X = [int(x) for x in input().split()]\nlist01 = []\nfor i in range(N):\n j = int(eval(input()))\n list01.append(j)\nj = 0\nmass = sum(list01)\nwhile mass <= X:\n j += 1\n mass = sum(list01) + min(list01) * j\nprint((N + j - 1))\n","code_v1_no_empty_lines":"N, X = [int(x) for x in input().split()]\nlist01 = []\nfor i in range(N):\n i = int(eval(input()))\n list01.append(i)\nmin_01 = 0\nfor i in range(len(list01)):\n if min_01 == 0:\n min_01 = list01[i]\n elif list01[i] < min_01:\n min_01 = list01[i]\nfor i in range(len(list01)):\n X -= list01[i]\nprint((X \/\/ min_01 + N))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["- j = int(eval(input()))","- list01.append(j)","-j = 0","-mass = sum(list01)","-while mass <= X:","- j += 1","- mass = sum(list01) + min(list01) * j","-print((N + j - 1))","+ i = int(eval(input()))","+ list01.append(i)","+min_01 = 0","+for i in range(len(list01)):","+ if min_01 == 0:","+ min_01 = list01[i]","+ elif list01[i] < min_01:","+ min_01 = list01[i]","+for i in range(len(list01)):","+ X -= list01[i]","+print((X \/\/ min_01 + N))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0543528161,"measured_runtime_v1":0.0340071867,"runtime_lift":1.5982744073,"key":["s229856741","s662476278"]} +{"user_id":"u490489966","problem_id":"p02911","language":"python","submission_id_v0":"s711484646","submission_id_v1":"s658959755","cpu_time_v0":251,"cpu_time_v1":178,"memory_v0":8620,"memory_v1":13748,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.08,"input":"n,k,q=list(map(int,input().split()))\n\na=[]\n\nwhile True:\n\n try:\n\n a.append(int(eval(input())))\n\n except:\n\n break;\n\nt=[0]*n\n\nfor i in a:\n\n t[i-1]+=1\n\nfor i in t:\n\n if i >= q - k + 1:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")","target":"#C\n\nn, k, q = list(map(int, input().split()))\n\na = [int(eval(input())) for _ in range(q)]\n\npeople = [0] * n\n\nfor i in a:\n\n people[i-1] += 1\n\n# print(people)\n\nfor i in people:\n\n if k <= q - i:\n\n print(\"No\")\n\n else:\n\n print(\"Yes\")","code_v0_loc":15,"code_v1_loc":12,"code_v0_num_chars":222,"code_v1_num_chars":239,"code_v0_no_empty_lines":"n, k, q = list(map(int, input().split()))\na = []\nwhile True:\n try:\n a.append(int(eval(input())))\n except:\n break\nt = [0] * n\nfor i in a:\n t[i - 1] += 1\nfor i in t:\n if i >= q - k + 1:\n print(\"Yes\")\n else:\n print(\"No\")\n","code_v1_no_empty_lines":"# C\nn, k, q = list(map(int, input().split()))\na = [int(eval(input())) for _ in range(q)]\npeople = [0] * n\nfor i in a:\n people[i - 1] += 1\n# print(people)\nfor i in people:\n if k <= q - i:\n print(\"No\")\n else:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["+# C","-a = []","-while True:","- try:","- a.append(int(eval(input())))","- except:","- break","-t = [0] * n","+a = [int(eval(input())) for _ in range(q)]","+people = [0] * n","- t[i - 1] += 1","-for i in t:","- if i >= q - k + 1:","+ people[i - 1] += 1","+# print(people)","+for i in people:","+ if k <= q - i:","+ print(\"No\")","+ else:","- else:","- print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0916290505,"measured_runtime_v1":0.0913696847,"runtime_lift":1.0028386416,"key":["s711484646","s658959755"]} +{"user_id":"u888092736","problem_id":"p02720","language":"python","submission_id_v0":"s104600774","submission_id_v1":"s044281981","cpu_time_v0":98,"cpu_time_v1":38,"memory_v0":14524,"memory_v1":9240,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.22,"input":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 5)\n\n\n\n\n\ndef dfs(v):\n\n if v > 3234566667:\n\n return\n\n ans.append(v)\n\n d = v % 10\n\n if d - 1 >= 0:\n\n dfs(v * 10 + d - 1)\n\n dfs(v * 10 + d)\n\n if d + 1 < 10:\n\n dfs(v * 10 + d + 1)\n\n\n\n\n\nK = int(eval(input()))\n\nans = []\n\n[dfs(i) for i in range(1, 10)]\n\nprint((sorted(ans)[K - 1]))\n","target":"def is_good(mid, key):\n\n S = list(map(int, str(mid)))\n\n N = len(S)\n\n dp = [[[0] * 11 for _ in range(2)] for _ in range(N + 1)]\n\n dp[1][1][10] = 1\n\n for k in range(1, S[0]):\n\n dp[1][1][k] = 1\n\n dp[1][0][S[0]] = 1\n\n for i in range(1, N):\n\n for k in range(1, 11):\n\n dp[i + 1][1][k] += dp[i][0][10] + dp[i][1][10]\n\n for is_less in range(2):\n\n for k in range(10):\n\n for l in range(k - 1, k + 2):\n\n if not 0 <= l <= 9 or (not is_less and l > S[i]):\n\n continue\n\n dp[i + 1][is_less or l < S[i]][l] += dp[i][is_less][k]\n\n return sum(dp[N][0][k] + dp[N][1][k] for k in range(10)) >= key\n\n\n\n\n\ndef binary_search(bad, good, key):\n\n while good - bad > 1:\n\n mid = (bad + good) \/\/ 2\n\n if is_good(mid, key):\n\n good = mid\n\n else:\n\n bad = mid\n\n return good\n\n\n\n\n\nK = int(eval(input()))\n\nprint((binary_search(0, 3234566667, K)))\n","code_v0_loc":21,"code_v1_loc":32,"code_v0_num_chars":347,"code_v1_num_chars":992,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**5)\n\n\ndef dfs(v):\n if v > 3234566667:\n return\n ans.append(v)\n d = v % 10\n if d - 1 >= 0:\n dfs(v * 10 + d - 1)\n dfs(v * 10 + d)\n if d + 1 < 10:\n dfs(v * 10 + d + 1)\n\n\nK = int(eval(input()))\nans = []\n[dfs(i) for i in range(1, 10)]\nprint((sorted(ans)[K - 1]))\n","code_v1_no_empty_lines":"def is_good(mid, key):\n S = list(map(int, str(mid)))\n N = len(S)\n dp = [[[0] * 11 for _ in range(2)] for _ in range(N + 1)]\n dp[1][1][10] = 1\n for k in range(1, S[0]):\n dp[1][1][k] = 1\n dp[1][0][S[0]] = 1\n for i in range(1, N):\n for k in range(1, 11):\n dp[i + 1][1][k] += dp[i][0][10] + dp[i][1][10]\n for is_less in range(2):\n for k in range(10):\n for l in range(k - 1, k + 2):\n if not 0 <= l <= 9 or (not is_less and l > S[i]):\n continue\n dp[i + 1][is_less or l < S[i]][l] += dp[i][is_less][k]\n return sum(dp[N][0][k] + dp[N][1][k] for k in range(10)) >= key\n\n\ndef binary_search(bad, good, key):\n while good - bad > 1:\n mid = (bad + good) \/\/ 2\n if is_good(mid, key):\n good = mid\n else:\n bad = mid\n return good\n\n\nK = int(eval(input()))\nprint((binary_search(0, 3234566667, K)))\n","code_same":false,"relative_loc_diff_percent":34.375,"diff":["-import sys","-","-sys.setrecursionlimit(10**5)","+def is_good(mid, key):","+ S = list(map(int, str(mid)))","+ N = len(S)","+ dp = [[[0] * 11 for _ in range(2)] for _ in range(N + 1)]","+ dp[1][1][10] = 1","+ for k in range(1, S[0]):","+ dp[1][1][k] = 1","+ dp[1][0][S[0]] = 1","+ for i in range(1, N):","+ for k in range(1, 11):","+ dp[i + 1][1][k] += dp[i][0][10] + dp[i][1][10]","+ for is_less in range(2):","+ for k in range(10):","+ for l in range(k - 1, k + 2):","+ if not 0 <= l <= 9 or (not is_less and l > S[i]):","+ continue","+ dp[i + 1][is_less or l < S[i]][l] += dp[i][is_less][k]","+ return sum(dp[N][0][k] + dp[N][1][k] for k in range(10)) >= key","-def dfs(v):","- if v > 3234566667:","- return","- ans.append(v)","- d = v % 10","- if d - 1 >= 0:","- dfs(v * 10 + d - 1)","- dfs(v * 10 + d)","- if d + 1 < 10:","- dfs(v * 10 + d + 1)","+def binary_search(bad, good, key):","+ while good - bad > 1:","+ mid = (bad + good) \/\/ 2","+ if is_good(mid, key):","+ good = mid","+ else:","+ bad = mid","+ return good","-ans = []","-[dfs(i) for i in range(1, 10)]","-print((sorted(ans)[K - 1]))","+print((binary_search(0, 3234566667, K)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3974089105,"measured_runtime_v1":0.071247184,"runtime_lift":5.5778893696,"key":["s104600774","s044281981"]} +{"user_id":"u348805958","problem_id":"p02548","language":"python","submission_id_v0":"s725355161","submission_id_v1":"s166256699","cpu_time_v0":285,"cpu_time_v1":72,"memory_v0":76452,"memory_v1":62604,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.74,"input":"#!python3\n\n\n\nimport sys\n\niim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))\n\n\n\ndef get_factor(N):\n\n N1 = N + 2\n\n A = [2, 0] * (N1\/\/2)\n\n\n\n for i in range(3, N1, 2):\n\n if A[i]:\n\n continue\n\n for j in range(i, N1, 2*i):\n\n A[j] = i\n\n\n\n def factor(n):\n\n i = 0\n\n ans = []\n\n\n\n while n & 1 == 0:\n\n i += 1\n\n n >>= 1\n\n if i:\n\n ans.append((2, i))\n\n\n\n while n > 1:\n\n a = A[n]\n\n i = 1\n\n while True:\n\n n \/\/= a\n\n b = A[n]\n\n if a != b:\n\n ans.append((a, i))\n\n b = a\n\n break\n\n i += 1\n\n\n\n return ans\n\n\n\n\n\n return factor\n\n\n\ndef resolve():\n\n N = int(sys.stdin.readline())\n\n\n\n f = get_factor(N)\n\n\n\n ans = 0\n\n for i in range(1, N):\n\n num = 1\n\n #print(i, f(i))\n\n for a, b in f(i):\n\n num *= b + 1\n\n ans += num\n\n print(ans)\n\nif __name__ == \"__main__\":\n\n resolve()\n","target":"#!python3\n\n\n\nimport sys\n\niim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))\n\n\n\ndef resolve():\n\n N = int(sys.stdin.readline())\n\n N1 = N - 1\n\n\n\n ans = 0\n\n for i in range(1, N):\n\n ans += N1\/\/i\n\n print(ans)\n\nif __name__ == \"__main__\":\n\n resolve()\n","code_v0_loc":57,"code_v1_loc":15,"code_v0_num_chars":1081,"code_v1_num_chars":279,"code_v0_no_empty_lines":"#!python3\nimport sys\n\niim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))\n\n\ndef get_factor(N):\n N1 = N + 2\n A = [2, 0] * (N1 \/\/ 2)\n for i in range(3, N1, 2):\n if A[i]:\n continue\n for j in range(i, N1, 2 * i):\n A[j] = i\n\n def factor(n):\n i = 0\n ans = []\n while n & 1 == 0:\n i += 1\n n >>= 1\n if i:\n ans.append((2, i))\n while n > 1:\n a = A[n]\n i = 1\n while True:\n n \/\/= a\n b = A[n]\n if a != b:\n ans.append((a, i))\n b = a\n break\n i += 1\n return ans\n\n return factor\n\n\ndef resolve():\n N = int(sys.stdin.readline())\n f = get_factor(N)\n ans = 0\n for i in range(1, N):\n num = 1\n # print(i, f(i))\n for a, b in f(i):\n num *= b + 1\n ans += num\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"#!python3\nimport sys\n\niim = lambda: list(map(int, sys.stdin.readline().rstrip().split()))\n\n\ndef resolve():\n N = int(sys.stdin.readline())\n N1 = N - 1\n ans = 0\n for i in range(1, N):\n ans += N1 \/\/ i\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":73.6842105263,"diff":["-def get_factor(N):","- N1 = N + 2","- A = [2, 0] * (N1 \/\/ 2)","- for i in range(3, N1, 2):","- if A[i]:","- continue","- for j in range(i, N1, 2 * i):","- A[j] = i","-","- def factor(n):","- i = 0","- ans = []","- while n & 1 == 0:","- i += 1","- n >>= 1","- if i:","- ans.append((2, i))","- while n > 1:","- a = A[n]","- i = 1","- while True:","- n \/\/= a","- b = A[n]","- if a != b:","- ans.append((a, i))","- b = a","- break","- i += 1","- return ans","-","- return factor","-","-","- f = get_factor(N)","+ N1 = N - 1","- num = 1","- # print(i, f(i))","- for a, b in f(i):","- num *= b + 1","- ans += num","+ ans += N1 \/\/ i"],"diff_only_import_comment":false,"measured_runtime_v0":0.2764764044,"measured_runtime_v1":0.0448578918,"runtime_lift":6.1633838169,"key":["s725355161","s166256699"]} +{"user_id":"u623687794","problem_id":"p03085","language":"python","submission_id_v0":"s252252958","submission_id_v1":"s959489907","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"b = eval(input())\n\nif b == \"T\":\n\n print (\"A\")\n\nelif b == \"A\":\n\n print (\"T\")\n\nelif b == (\"G\"):\n\n print (\"C\")\n\nelse:\n\n print (\"G\")","target":"array = [\"A\",\"T\",\"G\",\"C\"]\n\nb = eval(input())\n\nif b == array[0]:\n\n print((array[1]))\n\nelif b == array[1]:\n\n print((array[0]))\n\nelif b == array[2]:\n\n print((array[3]))\n\nelse:\n\n print((array[2]))","code_v0_loc":9,"code_v1_loc":10,"code_v0_num_chars":126,"code_v1_num_chars":186,"code_v0_no_empty_lines":"b = eval(input())\nif b == \"T\":\n print(\"A\")\nelif b == \"A\":\n print(\"T\")\nelif b == (\"G\"):\n print(\"C\")\nelse:\n print(\"G\")\n","code_v1_no_empty_lines":"array = [\"A\", \"T\", \"G\", \"C\"]\nb = eval(input())\nif b == array[0]:\n print((array[1]))\nelif b == array[1]:\n print((array[0]))\nelif b == array[2]:\n print((array[3]))\nelse:\n print((array[2]))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["+array = [\"A\", \"T\", \"G\", \"C\"]","-if b == \"T\":","- print(\"A\")","-elif b == \"A\":","- print(\"T\")","-elif b == (\"G\"):","- print(\"C\")","+if b == array[0]:","+ print((array[1]))","+elif b == array[1]:","+ print((array[0]))","+elif b == array[2]:","+ print((array[3]))","- print(\"G\")","+ print((array[2]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0728614072,"measured_runtime_v1":0.0505482713,"runtime_lift":1.4414223327,"key":["s252252958","s959489907"]} +{"user_id":"u852690916","problem_id":"p03319","language":"python","submission_id_v0":"s876961383","submission_id_v1":"s220463445","cpu_time_v0":213,"cpu_time_v1":39,"memory_v0":52652,"memory_v1":14008,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.69,"input":"N, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\ni = A.index(1)\n\nj = K-1\n\nl = i\n\nr = N - l - 1\n\nans, e = divmod(l, j)\n\nif e:\n\n ans += 1\n\n r -= K - e - 1\n\nans += (r+j-1)\/\/j\n\nprint(ans)","target":"N,K=list(map(int, input().split()))\n\n*A,=list(map(int, input().split()))\n\n\n\nprint((((N-1)+(K-1)-1)\/\/(K-1)))","code_v0_loc":12,"code_v1_loc":4,"code_v0_num_chars":211,"code_v1_num_chars":93,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\ni = A.index(1)\nj = K - 1\nl = i\nr = N - l - 1\nans, e = divmod(l, j)\nif e:\n ans += 1\n r -= K - e - 1\nans += (r + j - 1) \/\/ j\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\n(*A,) = list(map(int, input().split()))\nprint((((N - 1) + (K - 1) - 1) \/\/ (K - 1)))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-A = list(map(int, input().split()))","-i = A.index(1)","-j = K - 1","-l = i","-r = N - l - 1","-ans, e = divmod(l, j)","-if e:","- ans += 1","- r -= K - e - 1","-ans += (r + j - 1) \/\/ j","-print(ans)","+(*A,) = list(map(int, input().split()))","+print((((N - 1) + (K - 1) - 1) \/\/ (K - 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0414227486,"measured_runtime_v1":0.0409344673,"runtime_lift":1.0119283643,"key":["s876961383","s220463445"]} +{"user_id":"u923279197","problem_id":"p02762","language":"python","submission_id_v0":"s479080577","submission_id_v1":"s442699169","cpu_time_v0":1502,"cpu_time_v1":1376,"memory_v0":77984,"memory_v1":77344,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.39,"input":"class UnionFind:\n\n def __init__(self, n):\n\n # \u89aa\u8981\u7d20\u306e\u30ce\u30fc\u30c9\u756a\u53f7\u3092\u683c\u7d0d\u3000par[x] == x \u306e\u6642\u305d\u306e\u30ce\u30fc\u30c9\u306f\u6839\n\n self.par = [i for i in range(n+1)]\n\n # \u6728\u306e\u9ad8\u3055\u3092\u683c\u7d0d\u3059\u308b\uff08\u521d\u671f\u72b6\u614b\u3067\u306f0)\n\n self.rank = [0] * (n+1)\n\n # \u5404\u3005\u306e\u96c6\u5408\u306e\u8981\u7d20\u6570\uff08\u6839\u304c\u4ee3\u8868\u3057\u3066\u5024\u3092\u6301\u3063\u3066\u304a\u304f\uff09\n\n self.count = [1] * (n+1)\n\n\n\n # \u691c\u7d22\n\n def find(self, x):\n\n # \u6839\u306a\u3089\u305d\u306e\u756a\u53f7\u3092\u8fd4\u3059\n\n root = x\n\n queue = [x]\n\n data = []\n\n while queue:\n\n now = queue.pop()\n\n if self.par[now] == now:\n\n root = now\n\n else:\n\n # \u6839\u3067\u306a\u3044\u306a\u3089\u89aa\u306e\u8981\u7d20\u3067\u518d\u691c\u7d22\n\n data.append(now)\n\n queue.append(self.par[now])\n\n # \u691c\u7d22\u3059\u308b\u904e\u7a0b\u3067\u89aa\u3092\u66f4\u65b0\n\n for y in data:\n\n self.par[y] = root\n\n return root\n\n\n\n # \u4f75\u5408\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n t = (x == y)\n\n if UnionFind.same_check(self,x,y):\n\n return t\n\n if self.rank[x] < self.rank[y]:\n\n self.par[x] = y\n\n self.count[y] += self.count[x]\n\n self.count[x] = 0\n\n else:\n\n self.par[y] = x\n\n self.count[x] += self.count[y]\n\n self.count[y] = 0\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n return t\n\n\n\n\n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3057\u3066\u3044\u308b\u304b\u5224\u5b9a\n\n def same_check(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n # \u5c5e\u3057\u3066\u3044\u308b\u96c6\u5408\u306e\u8981\u7d20\u6570\n\n def size(self,x):\n\n q = UnionFind.find(self,x)\n\n return self.count[q]\n\n\n\nn,m,k = list(map(int,input().split()))\n\nu = UnionFind(n)\n\nfriend = [1 for i in range(n)]\n\nfor i in range(m):\n\n a,b = list(map(int,input().split()))\n\n a -= 1\n\n b -= 1\n\n friend[a] += 1\n\n friend[b] += 1\n\n u.union(a,b)\n\n\n\n\n\nans = [u.size(i)-friend[i] for i in range(n)]\n\n#print(*ans)\n\nfor i in range(k):\n\n c,d = list(map(int,input().split()))\n\n c -= 1\n\n d -= 1\n\n if u.same_check(c,d):\n\n ans[c] -= 1\n\n ans[d] -= 1\n\n\n\nprint((*ans))","target":"class UnionFind:\n\n def __init__(self, n):\n\n # \u89aa\u8981\u7d20\u306e\u30ce\u30fc\u30c9\u756a\u53f7\u3092\u683c\u7d0d\u3000par[x] == x \u306e\u6642\u305d\u306e\u30ce\u30fc\u30c9\u306f\u6839\n\n self.par = [i for i in range(n+1)]\n\n # \u6728\u306e\u9ad8\u3055\u3092\u683c\u7d0d\u3059\u308b\uff08\u521d\u671f\u72b6\u614b\u3067\u306f0)\n\n self.rank = [0] * (n+1)\n\n # \u5404\u3005\u306e\u96c6\u5408\u306e\u8981\u7d20\u6570\uff08\u6839\u304c\u4ee3\u8868\u3057\u3066\u5024\u3092\u6301\u3063\u3066\u304a\u304f\uff09\n\n self.count = [1] * (n+1)\n\n\n\n # \u691c\u7d22\n\n def find(self, x):\n\n # \u6839\u306a\u3089\u305d\u306e\u756a\u53f7\u3092\u8fd4\u3059\n\n root = x\n\n queue = [x]\n\n data = []\n\n while queue:\n\n now = queue.pop()\n\n if self.par[now] == now:\n\n root = now\n\n else:\n\n # \u6839\u3067\u306a\u3044\u306a\u3089\u89aa\u306e\u8981\u7d20\u3067\u518d\u691c\u7d22\n\n data.append(now)\n\n queue.append(self.par[now])\n\n # \u691c\u7d22\u3059\u308b\u904e\u7a0b\u3067\u89aa\u3092\u66f4\u65b0\n\n for y in data:\n\n self.par[y] = root\n\n return root\n\n\n\n # \u4f75\u5408\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n t = (x == y)\n\n if UnionFind.same_check(self,x,y):\n\n return t\n\n if self.rank[x] < self.rank[y]:\n\n self.par[x] = y\n\n self.count[y] += self.count[x]\n\n self.count[x] = 0\n\n else:\n\n self.par[y] = x\n\n self.count[x] += self.count[y]\n\n self.count[y] = 0\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n return t\n\n\n\n\n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3057\u3066\u3044\u308b\u304b\u5224\u5b9a\n\n def same_check(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n # \u5c5e\u3057\u3066\u3044\u308b\u96c6\u5408\u306e\u8981\u7d20\u6570\n\n def size(self,x):\n\n q = UnionFind.find(self,x)\n\n return self.count[q]\n\n\n\nn,m,k = list(map(int,input().split()))\n\nu = UnionFind(n)\n\nans = [-1 for i in range(n)]\n\nfor i in range(m):\n\n a,b = list(map(int,input().split()))\n\n a -= 1\n\n b -= 1\n\n ans[a] -= 1\n\n ans[b] -= 1\n\n u.union(a,b)\n\n#print(*ans)\n\nfor i in range(k):\n\n c,d = list(map(int,input().split()))\n\n c -= 1\n\n d -= 1\n\n if u.same_check(c,d):\n\n ans[c] -= 1\n\n ans[d] -= 1\n\n\n\nprint((*[u.size(i)+x for i,x in enumerate(ans)]))","code_v0_loc":80,"code_v1_loc":77,"code_v0_num_chars":1943,"code_v1_num_chars":1920,"code_v0_no_empty_lines":"class UnionFind:\n def __init__(self, n):\n # \u89aa\u8981\u7d20\u306e\u30ce\u30fc\u30c9\u756a\u53f7\u3092\u683c\u7d0d\u3000par[x] == x \u306e\u6642\u305d\u306e\u30ce\u30fc\u30c9\u306f\u6839\n self.par = [i for i in range(n + 1)]\n # \u6728\u306e\u9ad8\u3055\u3092\u683c\u7d0d\u3059\u308b\uff08\u521d\u671f\u72b6\u614b\u3067\u306f0)\n self.rank = [0] * (n + 1)\n # \u5404\u3005\u306e\u96c6\u5408\u306e\u8981\u7d20\u6570\uff08\u6839\u304c\u4ee3\u8868\u3057\u3066\u5024\u3092\u6301\u3063\u3066\u304a\u304f\uff09\n self.count = [1] * (n + 1)\n\n # \u691c\u7d22\n def find(self, x):\n # \u6839\u306a\u3089\u305d\u306e\u756a\u53f7\u3092\u8fd4\u3059\n root = x\n queue = [x]\n data = []\n while queue:\n now = queue.pop()\n if self.par[now] == now:\n root = now\n else:\n # \u6839\u3067\u306a\u3044\u306a\u3089\u89aa\u306e\u8981\u7d20\u3067\u518d\u691c\u7d22\n data.append(now)\n queue.append(self.par[now])\n # \u691c\u7d22\u3059\u308b\u904e\u7a0b\u3067\u89aa\u3092\u66f4\u65b0\n for y in data:\n self.par[y] = root\n return root\n\n # \u4f75\u5408\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n t = x == y\n if UnionFind.same_check(self, x, y):\n return t\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n self.count[y] += self.count[x]\n self.count[x] = 0\n else:\n self.par[y] = x\n self.count[x] += self.count[y]\n self.count[y] = 0\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n return t\n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3057\u3066\u3044\u308b\u304b\u5224\u5b9a\n def same_check(self, x, y):\n return self.find(x) == self.find(y)\n\n # \u5c5e\u3057\u3066\u3044\u308b\u96c6\u5408\u306e\u8981\u7d20\u6570\n def size(self, x):\n q = UnionFind.find(self, x)\n return self.count[q]\n\n\nn, m, k = list(map(int, input().split()))\nu = UnionFind(n)\nfriend = [1 for i in range(n)]\nfor i in range(m):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n friend[a] += 1\n friend[b] += 1\n u.union(a, b)\nans = [u.size(i) - friend[i] for i in range(n)]\n# print(*ans)\nfor i in range(k):\n c, d = list(map(int, input().split()))\n c -= 1\n d -= 1\n if u.same_check(c, d):\n ans[c] -= 1\n ans[d] -= 1\nprint((*ans))\n","code_v1_no_empty_lines":"class UnionFind:\n def __init__(self, n):\n # \u89aa\u8981\u7d20\u306e\u30ce\u30fc\u30c9\u756a\u53f7\u3092\u683c\u7d0d\u3000par[x] == x \u306e\u6642\u305d\u306e\u30ce\u30fc\u30c9\u306f\u6839\n self.par = [i for i in range(n + 1)]\n # \u6728\u306e\u9ad8\u3055\u3092\u683c\u7d0d\u3059\u308b\uff08\u521d\u671f\u72b6\u614b\u3067\u306f0)\n self.rank = [0] * (n + 1)\n # \u5404\u3005\u306e\u96c6\u5408\u306e\u8981\u7d20\u6570\uff08\u6839\u304c\u4ee3\u8868\u3057\u3066\u5024\u3092\u6301\u3063\u3066\u304a\u304f\uff09\n self.count = [1] * (n + 1)\n\n # \u691c\u7d22\n def find(self, x):\n # \u6839\u306a\u3089\u305d\u306e\u756a\u53f7\u3092\u8fd4\u3059\n root = x\n queue = [x]\n data = []\n while queue:\n now = queue.pop()\n if self.par[now] == now:\n root = now\n else:\n # \u6839\u3067\u306a\u3044\u306a\u3089\u89aa\u306e\u8981\u7d20\u3067\u518d\u691c\u7d22\n data.append(now)\n queue.append(self.par[now])\n # \u691c\u7d22\u3059\u308b\u904e\u7a0b\u3067\u89aa\u3092\u66f4\u65b0\n for y in data:\n self.par[y] = root\n return root\n\n # \u4f75\u5408\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n t = x == y\n if UnionFind.same_check(self, x, y):\n return t\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n self.count[y] += self.count[x]\n self.count[x] = 0\n else:\n self.par[y] = x\n self.count[x] += self.count[y]\n self.count[y] = 0\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n return t\n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3057\u3066\u3044\u308b\u304b\u5224\u5b9a\n def same_check(self, x, y):\n return self.find(x) == self.find(y)\n\n # \u5c5e\u3057\u3066\u3044\u308b\u96c6\u5408\u306e\u8981\u7d20\u6570\n def size(self, x):\n q = UnionFind.find(self, x)\n return self.count[q]\n\n\nn, m, k = list(map(int, input().split()))\nu = UnionFind(n)\nans = [-1 for i in range(n)]\nfor i in range(m):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n ans[a] -= 1\n ans[b] -= 1\n u.union(a, b)\n# print(*ans)\nfor i in range(k):\n c, d = list(map(int, input().split()))\n c -= 1\n d -= 1\n if u.same_check(c, d):\n ans[c] -= 1\n ans[d] -= 1\nprint((*[u.size(i) + x for i, x in enumerate(ans)]))\n","code_same":false,"relative_loc_diff_percent":3.75,"diff":["-friend = [1 for i in range(n)]","+ans = [-1 for i in range(n)]","- friend[a] += 1","- friend[b] += 1","+ ans[a] -= 1","+ ans[b] -= 1","-ans = [u.size(i) - friend[i] for i in range(n)]","-print((*ans))","+print((*[u.size(i) + x for i, x in enumerate(ans)]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0332970581,"measured_runtime_v1":0.0313226316,"runtime_lift":1.0630351409,"key":["s479080577","s442699169"]} +{"user_id":"u070201429","problem_id":"p03566","language":"python","submission_id_v0":"s124387081","submission_id_v1":"s773325722","cpu_time_v0":69,"cpu_time_v1":30,"memory_v0":62064,"memory_v1":9248,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.52,"input":"n = int(eval(input()))\n\nt = list(map(int, input().split()))\n\nv = list(map(int, input().split()))\n\nv.append(0)\n\n\n\n# forward\n\nnow = 0\n\nfor i in range(n):\n\n if now + t[i] < v[i]:\n\n v[i] = now + t[i]\n\n\n\n if v[i] <= v[i+1]:\n\n now = v[i]\n\n elif t[i] + v[i+1] + now < 2 * v[i]:\n\n v[i] = (t[i] + v[i+1] + now) \/ 2\n\n now = v[i+1]\n\n else:\n\n now = v[i+1]\n\n\n\n# back\n\nnow = 0\n\nfor i in range(n-1, -1, -1):\n\n if now + t[i] < v[i]:\n\n v[i] = now + t[i]\n\n\n\n if v[i] <= v[i-1]:\n\n now = v[i]\n\n elif t[i] + v[i-1] + now < 2 * v[i]:\n\n v[i] = (t[i] + v[i-1] + now) \/ 2\n\n now = v[i-1]\n\n else:\n\n now = v[i-1]\n\n\n\nans = 0\n\nnow = 0\n\nfor i in range(n):\n\n t1 = v[i] - now\n\n t3 = v[i] - v[i+1]\n\n t2 = t[i] - t1 - t3\n\n ans += now * t1 + t1 * t1 \/ 2\n\n now = v[i] # now += t1\n\n ans += now * t2\n\n # now = now\n\n ans += now * t3 - t3 * t3 \/ 2\n\n now -= t3\n\n\n\nprint(ans)","target":"n = int(eval(input()))\n\nt = list(map(int, input().split()))\n\nv = list(map(int, input().split()))\n\nv.append(0)\n\n\n\n# forward\n\nnow = 0\n\nfor i in range(n):\n\n if now + t[i] < v[i]:\n\n v[i] = now + t[i]\n\n\n\n if v[i] <= v[i+1]:\n\n now = v[i]\n\n elif t[i] + v[i+1] + now < 2 * v[i]:\n\n v[i] = (t[i] + v[i+1] + now) \/ 2\n\n now = v[i+1]\n\n else:\n\n now = v[i+1]\n\n\n\n# back\n\nnow = 0\n\nfor i in range(n-1, -1, -1):\n\n if now + t[i] < v[i]:\n\n v[i] = now + t[i]\n\n\n\n if v[i] <= v[i-1]:\n\n now = v[i]\n\n elif t[i] + v[i-1] + now < 2 * v[i]:\n\n v[i] = (t[i] + v[i-1] + now) \/ 2\n\n now = v[i-1]\n\n else:\n\n now = v[i-1]\n\n\n\nans = 0\n\nnow = 0\n\nfor i in range(n):\n\n t1 = v[i] - now\n\n t3 = v[i] - v[i+1]\n\n # t2 = t[i] - t1 - t3\n\n\n\n ans += now * t1 + t1 * t1 \/ 2\n\n now = v[i] # now += t1\n\n\n\n ans += now * (t[i] - t1 - t3) # ans += now * t2\n\n # now = now\n\n\n\n ans += now * t3 - t3 * t3 \/ 2\n\n now -= t3\n\n\n\nprint(ans)","code_v0_loc":47,"code_v1_loc":50,"code_v0_num_chars":947,"code_v1_num_chars":987,"code_v0_no_empty_lines":"n = int(eval(input()))\nt = list(map(int, input().split()))\nv = list(map(int, input().split()))\nv.append(0)\n# forward\nnow = 0\nfor i in range(n):\n if now + t[i] < v[i]:\n v[i] = now + t[i]\n if v[i] <= v[i + 1]:\n now = v[i]\n elif t[i] + v[i + 1] + now < 2 * v[i]:\n v[i] = (t[i] + v[i + 1] + now) \/ 2\n now = v[i + 1]\n else:\n now = v[i + 1]\n# back\nnow = 0\nfor i in range(n - 1, -1, -1):\n if now + t[i] < v[i]:\n v[i] = now + t[i]\n if v[i] <= v[i - 1]:\n now = v[i]\n elif t[i] + v[i - 1] + now < 2 * v[i]:\n v[i] = (t[i] + v[i - 1] + now) \/ 2\n now = v[i - 1]\n else:\n now = v[i - 1]\nans = 0\nnow = 0\nfor i in range(n):\n t1 = v[i] - now\n t3 = v[i] - v[i + 1]\n t2 = t[i] - t1 - t3\n ans += now * t1 + t1 * t1 \/ 2\n now = v[i] # now += t1\n ans += now * t2\n # now = now\n ans += now * t3 - t3 * t3 \/ 2\n now -= t3\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nt = list(map(int, input().split()))\nv = list(map(int, input().split()))\nv.append(0)\n# forward\nnow = 0\nfor i in range(n):\n if now + t[i] < v[i]:\n v[i] = now + t[i]\n if v[i] <= v[i + 1]:\n now = v[i]\n elif t[i] + v[i + 1] + now < 2 * v[i]:\n v[i] = (t[i] + v[i + 1] + now) \/ 2\n now = v[i + 1]\n else:\n now = v[i + 1]\n# back\nnow = 0\nfor i in range(n - 1, -1, -1):\n if now + t[i] < v[i]:\n v[i] = now + t[i]\n if v[i] <= v[i - 1]:\n now = v[i]\n elif t[i] + v[i - 1] + now < 2 * v[i]:\n v[i] = (t[i] + v[i - 1] + now) \/ 2\n now = v[i - 1]\n else:\n now = v[i - 1]\nans = 0\nnow = 0\nfor i in range(n):\n t1 = v[i] - now\n t3 = v[i] - v[i + 1]\n # t2 = t[i] - t1 - t3\n ans += now * t1 + t1 * t1 \/ 2\n now = v[i] # now += t1\n ans += now * (t[i] - t1 - t3) # ans += now * t2\n # now = now\n ans += now * t3 - t3 * t3 \/ 2\n now -= t3\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.0,"diff":["- t2 = t[i] - t1 - t3","+ # t2 = t[i] - t1 - t3","- ans += now * t2","+ ans += now * (t[i] - t1 - t3) # ans += now * t2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0356009219,"measured_runtime_v1":0.0550491486,"runtime_lift":0.6467115794,"key":["s124387081","s773325722"]} +{"user_id":"u875291233","problem_id":"p03184","language":"python","submission_id_v0":"s461479252","submission_id_v1":"s829805911","cpu_time_v0":768,"cpu_time_v1":688,"memory_v0":53976,"memory_v1":54424,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.42,"input":"# coding: utf-8\n\n# Your code here!\n\nSIZE=300000; MOD=10**9+7 #\u3053\u3053\u3092\u5909\u66f4\u3059\u308b\n\n\n\ninv = [0]*(SIZE+1)# inv[j] = j^{-1} mod MOD\n\nfac = [0]*(SIZE+1)# fac[j] = j! mod MOD\n\nfinv = [0]*(SIZE+1)# finv[j] = (j!)^{-1} mod MOD\n\ninv[1] = 1\n\nfac[0] = fac[1] = 1\n\nfinv[0] = finv[1] = 1\n\nfor i in range(2,SIZE+1):\n\n inv[i] = MOD -(MOD\/\/i)*inv[MOD%i]%MOD\n\n fac[i] = fac[i-1]*i%MOD\n\n finv[i]= finv[i-1]*inv[i]%MOD\n\n\n\ndef choose(n,r): # nCk mod MOD \u306e\u8a08\u7b97\n\n if 0 <= r <= n:\n\n return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD\n\n else:\n\n return 0\n\n\n\n\n\nh,w,n = [int(i) for i in input().split()]\n\nxy = [[1,1]]+[[int(i) for i in input().split()] for _ in range(n)]\n\n\n\ndp = [0]*(n+1)\n\ndp[0] = 1\n\n\n\nxy.sort(key=lambda x: x[1])\n\nxy.sort(key=lambda x: x[0])\n\n\n\n#print(xy)\n\n\n\nfor i in range(1,n+1):\n\n x,y = xy[i]\n\n for j in range(i):\n\n xj,yj = xy[j]\n\n dp[i] -= choose(x - xj + y-yj, y-yj)*dp[j]\n\n dp[i] %= MOD\n\n\n\nans = 0\n\n#print(dp)\n\nfor i,dpi in enumerate(dp):\n\n x,y=xy[i]\n\n ans += choose(h-x + w-y, w-y) * dpi\n\n ans %= MOD\n\nprint(ans)\n\n\n\n\n","target":"# coding: utf-8\n\n# Your code here!\n\nSIZE=300000; MOD=10**9+7 #\u3053\u3053\u3092\u5909\u66f4\u3059\u308b\n\n\n\ninv = [0]*(SIZE+1)# inv[j] = j^{-1} mod MOD\n\nfac = [0]*(SIZE+1)# fac[j] = j! mod MOD\n\nfinv = [0]*(SIZE+1)# finv[j] = (j!)^{-1} mod MOD\n\ninv[1] = 1\n\nfac[0] = fac[1] = 1\n\nfinv[0] = finv[1] = 1\n\nfor i in range(2,SIZE+1):\n\n inv[i] = MOD -(MOD\/\/i)*inv[MOD%i]%MOD\n\n fac[i] = fac[i-1]*i%MOD\n\n finv[i]= finv[i-1]*inv[i]%MOD\n\n\n\ndef choose(n,r): # nCk mod MOD \u306e\u8a08\u7b97\n\n if 0 <= r <= n:\n\n return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD\n\n else:\n\n return 0\n\n\n\n\n\nh,w,n = [int(i) for i in input().split()]\n\nxy = [[1,1]]+[[int(i) for i in input().split()] for _ in range(n)]\n\n\n\ndp = [0]*(n+1)\n\ndp[0] = 1\n\n\n\nxy.sort()\n\n\n\n#print(xy)\n\n\n\nfor i in range(1,n+1):\n\n x,y = xy[i]\n\n for j in range(i):\n\n xj,yj = xy[j]\n\n dp[i] -= choose(x - xj + y-yj, y-yj)*dp[j]\n\n dp[i] %= MOD\n\n\n\nans = 0\n\n#print(dp)\n\nfor i,dpi in enumerate(dp):\n\n x,y=xy[i]\n\n ans += choose(h-x + w-y, w-y) * dpi\n\n ans %= MOD\n\nprint(ans)\n\n\n\n\n","code_v0_loc":49,"code_v1_loc":48,"code_v0_num_chars":1059,"code_v1_num_chars":1012,"code_v0_no_empty_lines":"# coding: utf-8\n# Your code here!\nSIZE = 300000\nMOD = 10**9 + 7 # \u3053\u3053\u3092\u5909\u66f4\u3059\u308b\ninv = [0] * (SIZE + 1) # inv[j] = j^{-1} mod MOD\nfac = [0] * (SIZE + 1) # fac[j] = j! mod MOD\nfinv = [0] * (SIZE + 1) # finv[j] = (j!)^{-1} mod MOD\ninv[1] = 1\nfac[0] = fac[1] = 1\nfinv[0] = finv[1] = 1\nfor i in range(2, SIZE + 1):\n inv[i] = MOD - (MOD \/\/ i) * inv[MOD % i] % MOD\n fac[i] = fac[i - 1] * i % MOD\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n\ndef choose(n, r): # nCk mod MOD \u306e\u8a08\u7b97\n if 0 <= r <= n:\n return (fac[n] * finv[r] % MOD) * finv[n - r] % MOD\n else:\n return 0\n\n\nh, w, n = [int(i) for i in input().split()]\nxy = [[1, 1]] + [[int(i) for i in input().split()] for _ in range(n)]\ndp = [0] * (n + 1)\ndp[0] = 1\nxy.sort(key=lambda x: x[1])\nxy.sort(key=lambda x: x[0])\n# print(xy)\nfor i in range(1, n + 1):\n x, y = xy[i]\n for j in range(i):\n xj, yj = xy[j]\n dp[i] -= choose(x - xj + y - yj, y - yj) * dp[j]\n dp[i] %= MOD\nans = 0\n# print(dp)\nfor i, dpi in enumerate(dp):\n x, y = xy[i]\n ans += choose(h - x + w - y, w - y) * dpi\n ans %= MOD\nprint(ans)\n","code_v1_no_empty_lines":"# coding: utf-8\n# Your code here!\nSIZE = 300000\nMOD = 10**9 + 7 # \u3053\u3053\u3092\u5909\u66f4\u3059\u308b\ninv = [0] * (SIZE + 1) # inv[j] = j^{-1} mod MOD\nfac = [0] * (SIZE + 1) # fac[j] = j! mod MOD\nfinv = [0] * (SIZE + 1) # finv[j] = (j!)^{-1} mod MOD\ninv[1] = 1\nfac[0] = fac[1] = 1\nfinv[0] = finv[1] = 1\nfor i in range(2, SIZE + 1):\n inv[i] = MOD - (MOD \/\/ i) * inv[MOD % i] % MOD\n fac[i] = fac[i - 1] * i % MOD\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n\ndef choose(n, r): # nCk mod MOD \u306e\u8a08\u7b97\n if 0 <= r <= n:\n return (fac[n] * finv[r] % MOD) * finv[n - r] % MOD\n else:\n return 0\n\n\nh, w, n = [int(i) for i in input().split()]\nxy = [[1, 1]] + [[int(i) for i in input().split()] for _ in range(n)]\ndp = [0] * (n + 1)\ndp[0] = 1\nxy.sort()\n# print(xy)\nfor i in range(1, n + 1):\n x, y = xy[i]\n for j in range(i):\n xj, yj = xy[j]\n dp[i] -= choose(x - xj + y - yj, y - yj) * dp[j]\n dp[i] %= MOD\nans = 0\n# print(dp)\nfor i, dpi in enumerate(dp):\n x, y = xy[i]\n ans += choose(h - x + w - y, w - y) * dpi\n ans %= MOD\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":2.0408163265,"diff":["-xy.sort(key=lambda x: x[1])","-xy.sort(key=lambda x: x[0])","+xy.sort()"],"diff_only_import_comment":false,"measured_runtime_v0":0.6962113667,"measured_runtime_v1":0.6532790852,"runtime_lift":1.0657181325,"key":["s461479252","s829805911"]} +{"user_id":"u646412443","problem_id":"p02683","language":"python","submission_id_v0":"s092293110","submission_id_v1":"s938138718","cpu_time_v0":103,"cpu_time_v1":93,"memory_v0":9092,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.71,"input":"import itertools\n\nn, m, x = list(map(int, input().split()))\n\nca = [list(map(int, input().split())) for _ in range(n)]\n\ncnt = [i for i in range(n)]\n\nans = 10**12\n\nok = False\n\nfor i in range(1,n+1):\n\n for conb in itertools.combinations(cnt, i):\n\n z = [0]*(m+1)\n\n for j in conb:\n\n for k in range(m+1):\n\n z[k] = z[k] + ca[j][k]\n\n if sum(l >= x for l in z[1:]) == m:\n\n ans = min(ans, z[0])\n\n ok = True\n\nif ok:\n\n print(ans)\n\nelse:\n\n print((-1))\n","target":"n, m, x = list(map(int, input().split()))\n\nca = [list(map(int, input().split())) for _ in range(n)]\n\nans = 10**111\n\nok = False\n\nfor i in range(2**n):\n\n y = [0]*(m+1)\n\n for j in range(n):\n\n if i & (1 << j):\n\n for k in range(m+1):\n\n y[k] = y[k] + ca[j][k]\n\n if sum(z >= x for z in y[1:]) == m:\n\n ans = min(ans, y[0])\n\n ok = True\n\nif ok:\n\n print(ans)\n\nelse:\n\n print((-1))\n","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":521,"code_v1_num_chars":423,"code_v0_no_empty_lines":"import itertools\n\nn, m, x = list(map(int, input().split()))\nca = [list(map(int, input().split())) for _ in range(n)]\ncnt = [i for i in range(n)]\nans = 10**12\nok = False\nfor i in range(1, n + 1):\n for conb in itertools.combinations(cnt, i):\n z = [0] * (m + 1)\n for j in conb:\n for k in range(m + 1):\n z[k] = z[k] + ca[j][k]\n if sum(l >= x for l in z[1:]) == m:\n ans = min(ans, z[0])\n ok = True\nif ok:\n print(ans)\nelse:\n print((-1))\n","code_v1_no_empty_lines":"n, m, x = list(map(int, input().split()))\nca = [list(map(int, input().split())) for _ in range(n)]\nans = 10**111\nok = False\nfor i in range(2**n):\n y = [0] * (m + 1)\n for j in range(n):\n if i & (1 << j):\n for k in range(m + 1):\n y[k] = y[k] + ca[j][k]\n if sum(z >= x for z in y[1:]) == m:\n ans = min(ans, y[0])\n ok = True\nif ok:\n print(ans)\nelse:\n print((-1))\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-import itertools","-","-cnt = [i for i in range(n)]","-ans = 10**12","+ans = 10**111","-for i in range(1, n + 1):","- for conb in itertools.combinations(cnt, i):","- z = [0] * (m + 1)","- for j in conb:","+for i in range(2**n):","+ y = [0] * (m + 1)","+ for j in range(n):","+ if i & (1 << j):","- z[k] = z[k] + ca[j][k]","- if sum(l >= x for l in z[1:]) == m:","- ans = min(ans, z[0])","- ok = True","+ y[k] = y[k] + ca[j][k]","+ if sum(z >= x for z in y[1:]) == m:","+ ans = min(ans, y[0])","+ ok = True"],"diff_only_import_comment":false,"measured_runtime_v0":0.1487874899,"measured_runtime_v1":0.1150854404,"runtime_lift":1.2928437287,"key":["s092293110","s938138718"]} +{"user_id":"u077898957","problem_id":"p03408","language":"python","submission_id_v0":"s374363993","submission_id_v1":"s912750267","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"n = int(eval(input()))\n\ns = [(eval(input())) for i in range(n)]\n\nm = int(eval(input()))\n\nt = [(eval(input())) for i in range(m)]\n\nprint((max([0]+[s.count(s[i])-t.count(s[i]) for i in range(n)])))\n","target":"n=int(eval(input()))\n\ns=[eval(input()) for i in range(n)]\n\nm=int(eval(input()))\n\nt=[eval(input()) for i in range(m)]\n\nu=set(s)\n\nans=0\n\nfor i in u:\n\n cnt=s.count(i)-t.count(i)\n\n ans=max(ans,cnt)\n\nprint(ans)\n","code_v0_loc":5,"code_v1_loc":10,"code_v0_num_chars":170,"code_v1_num_chars":188,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = [(eval(input())) for i in range(n)]\nm = int(eval(input()))\nt = [(eval(input())) for i in range(m)]\nprint((max([0] + [s.count(s[i]) - t.count(s[i]) for i in range(n)])))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = [eval(input()) for i in range(n)]\nm = int(eval(input()))\nt = [eval(input()) for i in range(m)]\nu = set(s)\nans = 0\nfor i in u:\n cnt = s.count(i) - t.count(i)\n ans = max(ans, cnt)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-s = [(eval(input())) for i in range(n)]","+s = [eval(input()) for i in range(n)]","-t = [(eval(input())) for i in range(m)]","-print((max([0] + [s.count(s[i]) - t.count(s[i]) for i in range(n)])))","+t = [eval(input()) for i in range(m)]","+u = set(s)","+ans = 0","+for i in u:","+ cnt = s.count(i) - t.count(i)","+ ans = max(ans, cnt)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0544757183,"measured_runtime_v1":0.0720128477,"runtime_lift":0.7564722132,"key":["s374363993","s912750267"]} +{"user_id":"u021548497","problem_id":"p02838","language":"python","submission_id_v0":"s407749412","submission_id_v1":"s767250952","cpu_time_v0":717,"cpu_time_v1":271,"memory_v0":49984,"memory_v1":68672,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.2,"input":"import numpy as np\n\nimport sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n n = int(eval(input()))\n\n a = np.array([int(x) for x in input().split()])\n\n inf = pow(10, 9)+7\n\n max_a = np.max(a)\n\n bit = 1\n\n ans = 0\n\n num = 0\n\n while max_a:\n\n num += 1\n\n max_a \/\/= 2\n\n for _ in range(num):\n\n bit_count = np.sum(a%2)\n\n ans += ((((bit_count%inf)*((n-bit_count)%inf))%inf)*(bit%inf))%inf\n\n ans %= inf\n\n a \/\/= 2\n\n bit *= 2\n\n print(ans)\n\n \n\nif __name__ == \"__main__\":\n\n main()","target":"import numpy as np\n\n\n\nn = int(eval(input()))\n\na = np.array([int(x) for x in input().split()])\n\n\n\nans = 0\n\nmod = pow(10, 9)+7\n\nfor i in range(100):\n\n c = np.sum((a>>i)&1)\n\n ans += (c*(n-c)%mod)*pow(2, i, mod)%mod\n\n ans %= mod\n\n\n\nprint(ans)","code_v0_loc":25,"code_v1_loc":13,"code_v0_num_chars":493,"code_v1_num_chars":235,"code_v0_no_empty_lines":"import numpy as np\nimport sys\n\n\ndef main():\n input = sys.stdin.readline\n n = int(eval(input()))\n a = np.array([int(x) for x in input().split()])\n inf = pow(10, 9) + 7\n max_a = np.max(a)\n bit = 1\n ans = 0\n num = 0\n while max_a:\n num += 1\n max_a \/\/= 2\n for _ in range(num):\n bit_count = np.sum(a % 2)\n ans += (\n (((bit_count % inf) * ((n - bit_count) % inf)) % inf) * (bit % inf)\n ) % inf\n ans %= inf\n a \/\/= 2\n bit *= 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\na = np.array([int(x) for x in input().split()])\nans = 0\nmod = pow(10, 9) + 7\nfor i in range(100):\n c = np.sum((a >> i) & 1)\n ans += (c * (n - c) % mod) * pow(2, i, mod) % mod\n ans %= mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":48.0,"diff":["-import sys","-","-def main():","- input = sys.stdin.readline","- n = int(eval(input()))","- a = np.array([int(x) for x in input().split()])","- inf = pow(10, 9) + 7","- max_a = np.max(a)","- bit = 1","- ans = 0","- num = 0","- while max_a:","- num += 1","- max_a \/\/= 2","- for _ in range(num):","- bit_count = np.sum(a % 2)","- ans += (","- (((bit_count % inf) * ((n - bit_count) % inf)) % inf) * (bit % inf)","- ) % inf","- ans %= inf","- a \/\/= 2","- bit *= 2","- print(ans)","-","-","-if __name__ == \"__main__\":","- main()","+n = int(eval(input()))","+a = np.array([int(x) for x in input().split()])","+ans = 0","+mod = pow(10, 9) + 7","+for i in range(100):","+ c = np.sum((a >> i) & 1)","+ ans += (c * (n - c) % mod) * pow(2, i, mod) % mod","+ ans %= mod","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5239514971,"measured_runtime_v1":0.4669025192,"runtime_lift":1.122186057,"key":["s407749412","s767250952"]} +{"user_id":"u188827677","problem_id":"p03835","language":"python","submission_id_v0":"s135835864","submission_id_v1":"s967816025","cpu_time_v0":1161,"cpu_time_v1":1023,"memory_v0":9068,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.89,"input":"k,s = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n if x+y > s: break\n\n elif s-x-y <= k: ans += 1\n\nprint(ans)","target":"k,s = list(map(int ,input().split()))\n\n\n\nans = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n if 0 <= s - (x+y) <= k:\n\n ans += 1\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":154,"code_v1_num_chars":145,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\nans = 0\nfor x in range(k + 1):\n for y in range(k + 1):\n if x + y > s:\n break\n elif s - x - y <= k:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"k, s = list(map(int, input().split()))\nans = 0\nfor x in range(k + 1):\n for y in range(k + 1):\n if 0 <= s - (x + y) <= k:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if x + y > s:","- break","- elif s - x - y <= k:","+ if 0 <= s - (x + y) <= k:"],"diff_only_import_comment":false,"measured_runtime_v0":0.032470013,"measured_runtime_v1":0.034193228,"runtime_lift":0.9496036165,"key":["s135835864","s967816025"]} +{"user_id":"u200785298","problem_id":"p03053","language":"python","submission_id_v0":"s506210307","submission_id_v1":"s007445491","cpu_time_v0":809,"cpu_time_v1":255,"memory_v0":126944,"memory_v1":54512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.48,"input":"#!\/usr\/bin\/env python3\n\nimport sys\n\nfrom pprint import pprint\n\n\n\ndef solve(H: int, W: int, A: \"List[str]\"):\n\n used = [[False] * W for _ in range(H)]\n\n dx = [1, 0, -1, 0]\n\n dy = [0, -1, 0, 1]\n\n s = set()\n\n for i in range(H):\n\n for j in range(W):\n\n if A[i][j] == '#':\n\n s.add((i, j))\n\n used[i][j] = True\n\n\n\n ret = 0\n\n while True:\n\n nex = set()\n\n for x, y in s:\n\n for j in range(4):\n\n tx = x + dx[j]\n\n ty = y + dy[j]\n\n if 0 <= tx < H and 0 <= ty < W and not used[tx][ty]:\n\n nex.add((tx, ty))\n\n used[tx][ty] = True\n\n if len(nex) < 1:\n\n break\n\n s = nex\n\n ret += 1\n\n\n\n print(ret)\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n H = int(next(tokens)) # type: int\n\n W = int(next(tokens)) # type: int\n\n A = [next(tokens) for _ in range(H) ] # type: \"List[str]\"\n\n solve(H, W, A)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\nfrom pprint import pprint\n\n \n\ndef solve(H: int, W: int, A: \"List[str]\"):\n\n count = [[H + W] * (W + 2) for _ in range(H + 2)]\n\n for i in range(H):\n\n for j in range(W):\n\n if A[i][j] == '#':\n\n count[i + 1][j + 1] = 0\n\n else:\n\n count[i + 1][j + 1] = min(count[i][j + 1], count[i + 1][j]) + 1\n\n \n\n #pprint(count)\n\n ret = 0\n\n for i in range(H, 0, -1):\n\n for j in range(W, 0, -1):\n\n count[i][j] = min(count[i][j], min(count[i][j + 1], count[i + 1][j]) + 1)\n\n ret = max(ret, count[i][j])\n\n #pprint(count)\n\n print(ret)\n\n return\n\n \n\n \n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n H = int(next(tokens)) # type: int\n\n W = int(next(tokens)) # type: int\n\n A = [next(tokens) for _ in range(H) ] # type: \"List[str]\"\n\n solve(H, W, A)\n\n \n\nif __name__ == '__main__':\n\n main()","code_v0_loc":47,"code_v1_loc":37,"code_v0_num_chars":1178,"code_v1_num_chars":1049,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nfrom pprint import pprint\n\n\ndef solve(H: int, W: int, A: \"List[str]\"):\n used = [[False] * W for _ in range(H)]\n dx = [1, 0, -1, 0]\n dy = [0, -1, 0, 1]\n s = set()\n for i in range(H):\n for j in range(W):\n if A[i][j] == \"#\":\n s.add((i, j))\n used[i][j] = True\n ret = 0\n while True:\n nex = set()\n for x, y in s:\n for j in range(4):\n tx = x + dx[j]\n ty = y + dy[j]\n if 0 <= tx < H and 0 <= ty < W and not used[tx][ty]:\n nex.add((tx, ty))\n used[tx][ty] = True\n if len(nex) < 1:\n break\n s = nex\n ret += 1\n print(ret)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n A = [next(tokens) for _ in range(H)] # type: \"List[str]\"\n solve(H, W, A)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nfrom pprint import pprint\n\n\ndef solve(H: int, W: int, A: \"List[str]\"):\n count = [[H + W] * (W + 2) for _ in range(H + 2)]\n for i in range(H):\n for j in range(W):\n if A[i][j] == \"#\":\n count[i + 1][j + 1] = 0\n else:\n count[i + 1][j + 1] = min(count[i][j + 1], count[i + 1][j]) + 1\n # pprint(count)\n ret = 0\n for i in range(H, 0, -1):\n for j in range(W, 0, -1):\n count[i][j] = min(count[i][j], min(count[i][j + 1], count[i + 1][j]) + 1)\n ret = max(ret, count[i][j])\n # pprint(count)\n print(ret)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n A = [next(tokens) for _ in range(H)] # type: \"List[str]\"\n solve(H, W, A)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":21.2765957447,"diff":["- used = [[False] * W for _ in range(H)]","- dx = [1, 0, -1, 0]","- dy = [0, -1, 0, 1]","- s = set()","+ count = [[H + W] * (W + 2) for _ in range(H + 2)]","- s.add((i, j))","- used[i][j] = True","+ count[i + 1][j + 1] = 0","+ else:","+ count[i + 1][j + 1] = min(count[i][j + 1], count[i + 1][j]) + 1","+ # pprint(count)","- while True:","- nex = set()","- for x, y in s:","- for j in range(4):","- tx = x + dx[j]","- ty = y + dy[j]","- if 0 <= tx < H and 0 <= ty < W and not used[tx][ty]:","- nex.add((tx, ty))","- used[tx][ty] = True","- if len(nex) < 1:","- break","- s = nex","- ret += 1","+ for i in range(H, 0, -1):","+ for j in range(W, 0, -1):","+ count[i][j] = min(count[i][j], min(count[i][j + 1], count[i + 1][j]) + 1)","+ ret = max(ret, count[i][j])","+ # pprint(count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0662967039,"measured_runtime_v1":0.0947120566,"runtime_lift":0.6999816739,"key":["s506210307","s007445491"]} +{"user_id":"u380524497","problem_id":"p02937","language":"python","submission_id_v0":"s966860628","submission_id_v1":"s552496012","cpu_time_v0":149,"cpu_time_v1":136,"memory_v0":7924,"memory_v1":8052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.72,"input":"from collections import defaultdict\n\nimport bisect\n\n\n\n\n\nS = eval(input())\n\nT = eval(input())\n\n\n\nif set(T) - set(S):\n\n print((-1))\n\n exit()\n\n\n\ndic = defaultdict(list)\n\nleng_dic = defaultdict(int)\n\n\n\nfor pos, s in enumerate(S):\n\n dic[s].append(pos)\n\n leng_dic[s] += 1\n\n\n\nlength = len(S)\n\nnow = -1\n\ncount = 0\n\nfor t in T:\n\n if dic[t][-1] < now+1:\n\n now = -1\n\n count += 1\n\n idx = bisect.bisect_left(dic[t], now+1)\n\n now = dic[t][idx]\n\n\n\nans = count*length + now + 1\n\nprint(ans)","target":"from collections import defaultdict\n\nimport bisect\n\n\n\n\n\nS = eval(input())\n\nT = eval(input())\n\n\n\nif set(T) - set(S):\n\n print((-1))\n\n exit()\n\n\n\ndic = defaultdict(list)\n\nfor pos, s in enumerate(S):\n\n dic[s].append(pos)\n\n\n\nnow = -1\n\ncount = 0\n\nfor t in T:\n\n if dic[t][-1] < now+1:\n\n now = -1\n\n count += 1\n\n idx = bisect.bisect_left(dic[t], now+1)\n\n now = dic[t][idx]\n\n\n\nans = count*len(S) + now + 1\n\nprint(ans)","code_v0_loc":30,"code_v1_loc":26,"code_v0_num_chars":494,"code_v1_num_chars":424,"code_v0_no_empty_lines":"from collections import defaultdict\nimport bisect\n\nS = eval(input())\nT = eval(input())\nif set(T) - set(S):\n print((-1))\n exit()\ndic = defaultdict(list)\nleng_dic = defaultdict(int)\nfor pos, s in enumerate(S):\n dic[s].append(pos)\n leng_dic[s] += 1\nlength = len(S)\nnow = -1\ncount = 0\nfor t in T:\n if dic[t][-1] < now + 1:\n now = -1\n count += 1\n idx = bisect.bisect_left(dic[t], now + 1)\n now = dic[t][idx]\nans = count * length + now + 1\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\nimport bisect\n\nS = eval(input())\nT = eval(input())\nif set(T) - set(S):\n print((-1))\n exit()\ndic = defaultdict(list)\nfor pos, s in enumerate(S):\n dic[s].append(pos)\nnow = -1\ncount = 0\nfor t in T:\n if dic[t][-1] < now + 1:\n now = -1\n count += 1\n idx = bisect.bisect_left(dic[t], now + 1)\n now = dic[t][idx]\nans = count * len(S) + now + 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-leng_dic = defaultdict(int)","- leng_dic[s] += 1","-length = len(S)","-ans = count * length + now + 1","+ans = count * len(S) + now + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0431524429,"measured_runtime_v1":0.0449265795,"runtime_lift":0.9605103132,"key":["s966860628","s552496012"]} +{"user_id":"u945181840","problem_id":"p02803","language":"python","submission_id_v0":"s055676764","submission_id_v1":"s054497596","cpu_time_v0":141,"cpu_time_v1":122,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.48,"input":"import sys\n\nfrom collections import deque\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\n\n\nH, W = list(map(int, readline().split()))\n\nS = [list(eval(input())) for i in range(H)]\n\n\n\n\n\ndef bfs(grid, start):\n\n distance = [[0] * W for _ in range(H)]\n\n queue = deque([start])\n\n visited = [[False] * W for _ in range(H)]\n\n visited[start[0]][start[1]] = True\n\n while queue:\n\n x, y = queue.popleft()\n\n\n\n for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):\n\n new_y, new_x = y + j, x + i\n\n if 0 <= new_y < W and 0 <= new_x < H:\n\n if grid[new_x][new_y] == '.' and not visited[new_x][new_y]:\n\n distance[new_x][new_y] = distance[x][y] + 1\n\n visited[new_x][new_y] = True\n\n queue.append((new_x, new_y))\n\n return distance\n\n\n\n\n\nanswer = 0\n\nlimit = H - 1 + W - 1\n\nfor i in range(H):\n\n for j in range(W):\n\n if S[i][j] == '#':\n\n continue\n\n\n\n cnt = 0\n\n for dx, dy in ([1, 0], [-1, 0], [0, 1], [0, -1]):\n\n new_y, new_x = dy + j, dx + i\n\n if 0 <= new_y < W and 0 <= new_x < H:\n\n if S[new_x][new_y] == '.':\n\n cnt += 1\n\n\n\n if cnt > 2:\n\n continue\n\n\n\n tmp = max(list(map(max, bfs(S, (i, j)))))\n\n if tmp > answer:\n\n answer = tmp\n\n if answer == limit:\n\n print(answer)\n\n exit()\n\n\n\nprint(answer)\n","target":"import sys\n\nfrom collections import deque\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\n\n\nH, W = list(map(int, readline().split()))\n\nS = [list(eval(input())) for i in range(H)]\n\n\n\n\n\ndef bfs(grid, start):\n\n distance = [[0] * W for _ in range(H)]\n\n queue = deque([start])\n\n visited = [[False] * W for _ in range(H)]\n\n visited[start[0]][start[1]] = True\n\n while queue:\n\n x, y = queue.popleft()\n\n\n\n for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):\n\n new_y, new_x = y + j, x + i\n\n if 0 <= new_y < W and 0 <= new_x < H:\n\n if grid[new_x][new_y] == '.' and not visited[new_x][new_y]:\n\n distance[new_x][new_y] = distance[x][y] + 1\n\n visited[new_x][new_y] = True\n\n queue.append((new_x, new_y))\n\n return distance\n\n\n\n\n\nanswer = 0\n\nfor i in range(H):\n\n for j in range(W):\n\n if S[i][j] == '#':\n\n continue\n\n\n\n cnt = 0\n\n for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):\n\n new_y, new_x = dy + j, dx + i\n\n if 0 <= new_y < W and 0 <= new_x < H:\n\n if S[new_x][new_y] == '.':\n\n cnt += 1\n\n\n\n if cnt > 2:\n\n continue\n\n\n\n tmp = max(list(map(max, bfs(S, (i, j)))))\n\n if tmp > answer:\n\n answer = tmp\n\n\n\nprint(answer)\n","code_v0_loc":53,"code_v1_loc":49,"code_v0_num_chars":1442,"code_v1_num_chars":1343,"code_v0_no_empty_lines":"import sys\nfrom collections import deque\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nH, W = list(map(int, readline().split()))\nS = [list(eval(input())) for i in range(H)]\n\n\ndef bfs(grid, start):\n distance = [[0] * W for _ in range(H)]\n queue = deque([start])\n visited = [[False] * W for _ in range(H)]\n visited[start[0]][start[1]] = True\n while queue:\n x, y = queue.popleft()\n for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):\n new_y, new_x = y + j, x + i\n if 0 <= new_y < W and 0 <= new_x < H:\n if grid[new_x][new_y] == \".\" and not visited[new_x][new_y]:\n distance[new_x][new_y] = distance[x][y] + 1\n visited[new_x][new_y] = True\n queue.append((new_x, new_y))\n return distance\n\n\nanswer = 0\nlimit = H - 1 + W - 1\nfor i in range(H):\n for j in range(W):\n if S[i][j] == \"#\":\n continue\n cnt = 0\n for dx, dy in ([1, 0], [-1, 0], [0, 1], [0, -1]):\n new_y, new_x = dy + j, dx + i\n if 0 <= new_y < W and 0 <= new_x < H:\n if S[new_x][new_y] == \".\":\n cnt += 1\n if cnt > 2:\n continue\n tmp = max(list(map(max, bfs(S, (i, j)))))\n if tmp > answer:\n answer = tmp\n if answer == limit:\n print(answer)\n exit()\nprint(answer)\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nH, W = list(map(int, readline().split()))\nS = [list(eval(input())) for i in range(H)]\n\n\ndef bfs(grid, start):\n distance = [[0] * W for _ in range(H)]\n queue = deque([start])\n visited = [[False] * W for _ in range(H)]\n visited[start[0]][start[1]] = True\n while queue:\n x, y = queue.popleft()\n for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):\n new_y, new_x = y + j, x + i\n if 0 <= new_y < W and 0 <= new_x < H:\n if grid[new_x][new_y] == \".\" and not visited[new_x][new_y]:\n distance[new_x][new_y] = distance[x][y] + 1\n visited[new_x][new_y] = True\n queue.append((new_x, new_y))\n return distance\n\n\nanswer = 0\nfor i in range(H):\n for j in range(W):\n if S[i][j] == \"#\":\n continue\n cnt = 0\n for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):\n new_y, new_x = dy + j, dx + i\n if 0 <= new_y < W and 0 <= new_x < H:\n if S[new_x][new_y] == \".\":\n cnt += 1\n if cnt > 2:\n continue\n tmp = max(list(map(max, bfs(S, (i, j)))))\n if tmp > answer:\n answer = tmp\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":7.5471698113,"diff":["- for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):","+ for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):","-limit = H - 1 + W - 1","- for dx, dy in ([1, 0], [-1, 0], [0, 1], [0, -1]):","+ for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):","- if answer == limit:","- print(answer)","- exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422439382,"measured_runtime_v1":0.0463037749,"runtime_lift":0.9123216904,"key":["s055676764","s054497596"]} +{"user_id":"u037430802","problem_id":"p04045","language":"python","submission_id_v0":"s516704787","submission_id_v1":"s709274763","cpu_time_v0":215,"cpu_time_v1":71,"memory_v0":3064,"memory_v1":5472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.98,"input":"n, k = list(map(int, input().split()))\n\n\n\nd = list(map(int, input().split()))\n\n\n\nn_list = list(str(n))\n\nn_list = [int(num) for num in n_list]\n\n\n\nnum = {1,2,3,4,5,6,7,8,9,0}\n\n\n\nd_set = set(d)\n\nempty = set()\n\n#print(set(n_list))\n\n#print(d_set)\n\n#print(set(n_list) & d_set)\n\nwhile(1):\n\n n_list = list(str(n))\n\n n_list = [int(num) for num in n_list]\n\n if(set(n_list) & d_set == empty):\n\n print(n)\n\n break\n\n n += 1\n\n \n","target":"import sys\n\nN, K = list(map(int, input().split()))\n\n\n\n\n\nd = list(map(int, input().split()))\n\nd_set = set(d)\n\n\n\nnum_set = set([1,2,3,4,5,6,7,8,9,0])\n\nenable = num_set - d_set\n\n#print(type(enable))\n\n#print(enable)\n\n\n\n\n\ndef dfs(s):\n\n #print(s)\n\n global ans\n\n # \u3059\u3067\u306bN\u4ee5\u4e0a\u306e\u5834\u5408\u306f\u3053\u306e\u5148\u3092\u63a2\u7d22\u3057\u306a\u3044\n\n if s != \"\":\n\n if int(s) >= N:\n\n #print(s)\n\n ans.append(int(s))\n\n return\n\n\n\n for num in enable:\n\n if len(s) == 0 and num == 0:\n\n continue\n\n else:\n\n (dfs(s+str(num)))\n\n \n\n return\n\n\n\nans = []\n\ndfs(\"\")\n\n#print(ans)\n\nprint((min(ans)))","code_v0_loc":22,"code_v1_loc":35,"code_v0_num_chars":418,"code_v1_num_chars":544,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nd = list(map(int, input().split()))\nn_list = list(str(n))\nn_list = [int(num) for num in n_list]\nnum = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}\nd_set = set(d)\nempty = set()\n# print(set(n_list))\n# print(d_set)\n# print(set(n_list) & d_set)\nwhile 1:\n n_list = list(str(n))\n n_list = [int(num) for num in n_list]\n if set(n_list) & d_set == empty:\n print(n)\n break\n n += 1\n","code_v1_no_empty_lines":"import sys\n\nN, K = list(map(int, input().split()))\nd = list(map(int, input().split()))\nd_set = set(d)\nnum_set = set([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])\nenable = num_set - d_set\n# print(type(enable))\n# print(enable)\ndef dfs(s):\n # print(s)\n global ans\n # \u3059\u3067\u306bN\u4ee5\u4e0a\u306e\u5834\u5408\u306f\u3053\u306e\u5148\u3092\u63a2\u7d22\u3057\u306a\u3044\n if s != \"\":\n if int(s) >= N:\n # print(s)\n ans.append(int(s))\n return\n for num in enable:\n if len(s) == 0 and num == 0:\n continue\n else:\n (dfs(s + str(num)))\n return\n\n\nans = []\ndfs(\"\")\n# print(ans)\nprint((min(ans)))\n","code_same":false,"relative_loc_diff_percent":37.1428571429,"diff":["-n, k = list(map(int, input().split()))","+import sys","+","+N, K = list(map(int, input().split()))","-n_list = list(str(n))","-n_list = [int(num) for num in n_list]","-num = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}","-empty = set()","-# print(set(n_list))","-# print(d_set)","-# print(set(n_list) & d_set)","-while 1:","- n_list = list(str(n))","- n_list = [int(num) for num in n_list]","- if set(n_list) & d_set == empty:","- print(n)","- break","- n += 1","+num_set = set([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])","+enable = num_set - d_set","+# print(type(enable))","+# print(enable)","+def dfs(s):","+ # print(s)","+ global ans","+ # \u3059\u3067\u306bN\u4ee5\u4e0a\u306e\u5834\u5408\u306f\u3053\u306e\u5148\u3092\u63a2\u7d22\u3057\u306a\u3044","+ if s != \"\":","+ if int(s) >= N:","+ # print(s)","+ ans.append(int(s))","+ return","+ for num in enable:","+ if len(s) == 0 and num == 0:","+ continue","+ else:","+ (dfs(s + str(num)))","+ return","+","+","+ans = []","+dfs(\"\")","+# print(ans)","+print((min(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0356616497,"measured_runtime_v1":0.0352844715,"runtime_lift":1.0106896367,"key":["s516704787","s709274763"]} +{"user_id":"u022407960","problem_id":"p02238","language":"python","submission_id_v0":"s843964990","submission_id_v1":"s414876741","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7796,"memory_v1":7812,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"#!\/usr\/bin\/env python\n\n# -*- coding: utf-8 -*-\n\n\n\n\"\"\"\n\ninput:\n\n6\n\n1 2 2 3\n\n2 2 3 4\n\n3 1 5\n\n4 1 6\n\n5 1 6\n\n6 0\n\n\n\noutput:\n\n1 1 12\n\n2 2 11\n\n3 3 8\n\n4 9 10\n\n5 4 7\n\n6 5 6\n\n\"\"\"\n\nimport sys\n\n\n\nUNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2\n\n\n\n\n\ndef generate_adj_matrix(v_info):\n\n for v_detail in v_info:\n\n v_index, adj_num, *adj_list = list(map(int, v_detail))\n\n # assert len(adj_list) == adj_num\n\n init_adj_table[v_index].extend(sorted(adj_list, reverse=True))\n\n return init_adj_table\n\n\n\n\n\ndef graph_dfs(v_init):\n\n global time\n\n\n\n # init the first node of overall graph iterations(times >= 1)\n\n stack.append(v_init)\n\n d_time[v_init] += time\n\n # init end\n\n\n\n while stack:\n\n current = stack[-1]\n\n v_table = adj_table[current]\n\n color[current]=VISITED_IN_STACK\n\n # if adj is None, current's adj(s) have been all visited\n\n adj = v_table.pop() if v_table else None\n\n\n\n if adj:\n\n if color[adj] is UNVISITED:\n\n color[adj] = VISITED_IN_STACK\n\n time += 1\n\n d_time[adj] += time\n\n stack.append(adj)\n\n else:\n\n stack.pop()\n\n color[current] = POPPED_OUT\n\n time += 1\n\n f_time[current] += time\n\n\n\n return None\n\n\n\n\n\ndef dfs_start():\n\n global time\n\n for i in range(vertices):\n\n if color[i + 1] == UNVISITED:\n\n # print('round: ', i + 1)\n\n graph_dfs(i + 1)\n\n time += 1\n\n\n\n\n\nif __name__ == '__main__':\n\n _input = sys.stdin.readlines()\n\n vertices = int(_input[0])\n\n v_info = [x.split() for x in _input[1:]]\n\n init_adj_table = tuple([] for _ in range(vertices + 1))\n\n # assert len(vertex_info) == vertex_num\n\n\n\n # config length = (vertex_num + 1)\n\n stack = []\n\n color = [UNVISITED] * (vertices + 1)\n\n d_time, f_time = ([0] * (vertices + 1) for _ in range(2))\n\n\n\n adj_table = generate_adj_matrix(v_info)\n\n # timing start from 1\n\n time = 1\n\n dfs_start()\n\n\n\n for index, v in enumerate(zip(d_time[1:], f_time[1:]), 1):\n\n print((index, *v))","target":"#!\/usr\/bin\/env python\n\n# -*- coding: utf-8 -*-\n\n\n\n\"\"\"\n\n\n\ninput:\n\n6\n\n1 2 2 3\n\n2 2 3 4\n\n3 1 5\n\n4 1 6\n\n5 1 6\n\n6 0\n\n\n\noutput:\n\n1 1 12\n\n2 2 11\n\n3 3 8\n\n4 9 10\n\n5 4 7\n\n6 5 6\n\n\n\n\"\"\"\n\nimport sys\n\n\n\nUNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2\n\n\n\n\n\ndef dfs(v_init):\n\n global timer\n\n\n\n # init the first node of overall graph iterations(times >= 1)\n\n stack = list()\n\n stack.append(v_init)\n\n d_time[v_init] += timer\n\n # init end\n\n\n\n while stack:\n\n current = stack[-1]\n\n v_table = adj_table[current]\n\n visited[current] = VISITED_IN_STACK\n\n # if adj is None, current's adj(s) have been all visited\n\n adj = v_table.pop() if v_table else None\n\n\n\n if adj:\n\n if visited[adj] is UNVISITED:\n\n visited[adj] = VISITED_IN_STACK\n\n timer += 1\n\n d_time[adj] += timer\n\n stack.append(adj)\n\n else:\n\n stack.pop()\n\n visited[current] = POPPED_OUT\n\n timer += 1\n\n f_time[current] += timer\n\n\n\n return None\n\n\n\n\n\ndef dfs_init():\n\n global timer\n\n for v in range(v_num):\n\n if visited[v + 1] == UNVISITED:\n\n dfs(v + 1)\n\n timer += 1\n\n\n\n\n\nif __name__ == '__main__':\n\n _input = sys.stdin.readlines()\n\n v_num = int(_input[0])\n\n vertices = [x.split() for x in _input[1:]]\n\n\n\n # config length = (v_num + 1)\n\n # stack = []\n\n visited = [UNVISITED] * (v_num + 1)\n\n d_time, f_time = ([0] * (v_num + 1) for _ in range(2))\n\n adj_table = tuple([] for _ in range(v_num + 1))\n\n for v_info in vertices:\n\n v_index, adj_num, *adj_list = list(map(int, v_info))\n\n # assert len(adj_list) == adj_num\n\n adj_table[v_index].extend(sorted(adj_list, reverse=True))\n\n\n\n # timing start from 1\n\n timer = 1\n\n dfs_init()\n\n\n\n for index, time_info in enumerate(zip(d_time[1:], f_time[1:]), 1):\n\n print((index, *time_info))","code_v0_loc":92,"code_v1_loc":88,"code_v0_num_chars":2112,"code_v1_num_chars":1939,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python\n# -*- coding: utf-8 -*-\n\"\"\"\ninput:\n6\n1 2 2 3\n2 2 3 4\n3 1 5\n4 1 6\n5 1 6\n6 0\noutput:\n1 1 12\n2 2 11\n3 3 8\n4 9 10\n5 4 7\n6 5 6\n\"\"\"\nimport sys\n\nUNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2\n\n\ndef generate_adj_matrix(v_info):\n for v_detail in v_info:\n v_index, adj_num, *adj_list = list(map(int, v_detail))\n # assert len(adj_list) == adj_num\n init_adj_table[v_index].extend(sorted(adj_list, reverse=True))\n return init_adj_table\n\n\ndef graph_dfs(v_init):\n global time\n # init the first node of overall graph iterations(times >= 1)\n stack.append(v_init)\n d_time[v_init] += time\n # init end\n while stack:\n current = stack[-1]\n v_table = adj_table[current]\n color[current] = VISITED_IN_STACK\n # if adj is None, current's adj(s) have been all visited\n adj = v_table.pop() if v_table else None\n if adj:\n if color[adj] is UNVISITED:\n color[adj] = VISITED_IN_STACK\n time += 1\n d_time[adj] += time\n stack.append(adj)\n else:\n stack.pop()\n color[current] = POPPED_OUT\n time += 1\n f_time[current] += time\n return None\n\n\ndef dfs_start():\n global time\n for i in range(vertices):\n if color[i + 1] == UNVISITED:\n # print('round: ', i + 1)\n graph_dfs(i + 1)\n time += 1\n\n\nif __name__ == \"__main__\":\n _input = sys.stdin.readlines()\n vertices = int(_input[0])\n v_info = [x.split() for x in _input[1:]]\n init_adj_table = tuple([] for _ in range(vertices + 1))\n # assert len(vertex_info) == vertex_num\n # config length = (vertex_num + 1)\n stack = []\n color = [UNVISITED] * (vertices + 1)\n d_time, f_time = ([0] * (vertices + 1) for _ in range(2))\n adj_table = generate_adj_matrix(v_info)\n # timing start from 1\n time = 1\n dfs_start()\n for index, v in enumerate(zip(d_time[1:], f_time[1:]), 1):\n print((index, *v))\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python\n# -*- coding: utf-8 -*-\n\"\"\"\ninput:\n6\n1 2 2 3\n2 2 3 4\n3 1 5\n4 1 6\n5 1 6\n6 0\noutput:\n1 1 12\n2 2 11\n3 3 8\n4 9 10\n5 4 7\n6 5 6\n\"\"\"\nimport sys\n\nUNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2\n\n\ndef dfs(v_init):\n global timer\n # init the first node of overall graph iterations(times >= 1)\n stack = list()\n stack.append(v_init)\n d_time[v_init] += timer\n # init end\n while stack:\n current = stack[-1]\n v_table = adj_table[current]\n visited[current] = VISITED_IN_STACK\n # if adj is None, current's adj(s) have been all visited\n adj = v_table.pop() if v_table else None\n if adj:\n if visited[adj] is UNVISITED:\n visited[adj] = VISITED_IN_STACK\n timer += 1\n d_time[adj] += timer\n stack.append(adj)\n else:\n stack.pop()\n visited[current] = POPPED_OUT\n timer += 1\n f_time[current] += timer\n return None\n\n\ndef dfs_init():\n global timer\n for v in range(v_num):\n if visited[v + 1] == UNVISITED:\n dfs(v + 1)\n timer += 1\n\n\nif __name__ == \"__main__\":\n _input = sys.stdin.readlines()\n v_num = int(_input[0])\n vertices = [x.split() for x in _input[1:]]\n # config length = (v_num + 1)\n # stack = []\n visited = [UNVISITED] * (v_num + 1)\n d_time, f_time = ([0] * (v_num + 1) for _ in range(2))\n adj_table = tuple([] for _ in range(v_num + 1))\n for v_info in vertices:\n v_index, adj_num, *adj_list = list(map(int, v_info))\n # assert len(adj_list) == adj_num\n adj_table[v_index].extend(sorted(adj_list, reverse=True))\n # timing start from 1\n timer = 1\n dfs_init()\n for index, time_info in enumerate(zip(d_time[1:], f_time[1:]), 1):\n print((index, *time_info))\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["-def generate_adj_matrix(v_info):","- for v_detail in v_info:","- v_index, adj_num, *adj_list = list(map(int, v_detail))","- # assert len(adj_list) == adj_num","- init_adj_table[v_index].extend(sorted(adj_list, reverse=True))","- return init_adj_table","-","-","-def graph_dfs(v_init):","- global time","+def dfs(v_init):","+ global timer","+ stack = list()","- d_time[v_init] += time","+ d_time[v_init] += timer","- color[current] = VISITED_IN_STACK","+ visited[current] = VISITED_IN_STACK","- if color[adj] is UNVISITED:","- color[adj] = VISITED_IN_STACK","- time += 1","- d_time[adj] += time","+ if visited[adj] is UNVISITED:","+ visited[adj] = VISITED_IN_STACK","+ timer += 1","+ d_time[adj] += timer","- color[current] = POPPED_OUT","- time += 1","- f_time[current] += time","+ visited[current] = POPPED_OUT","+ timer += 1","+ f_time[current] += timer","-def dfs_start():","- global time","- for i in range(vertices):","- if color[i + 1] == UNVISITED:","- # print('round: ', i + 1)","- graph_dfs(i + 1)","- time += 1","+def dfs_init():","+ global timer","+ for v in range(v_num):","+ if visited[v + 1] == UNVISITED:","+ dfs(v + 1)","+ timer += 1","- vertices = int(_input[0])","- v_info = [x.split() for x in _input[1:]]","- init_adj_table = tuple([] for _ in range(vertices + 1))","- # assert len(vertex_info) == vertex_num","- # config length = (vertex_num + 1)","- stack = []","- color = [UNVISITED] * (vertices + 1)","- d_time, f_time = ([0] * (vertices + 1) for _ in range(2))","- adj_table = generate_adj_matrix(v_info)","+ v_num = int(_input[0])","+ vertices = [x.split() for x in _input[1:]]","+ # config length = (v_num + 1)","+ # stack = []","+ visited = [UNVISITED] * (v_num + 1)","+ d_time, f_time = ([0] * (v_num + 1) for _ in range(2))","+ adj_table = tuple([] for _ in range(v_num + 1))","+ for v_info in vertices:","+ v_index, adj_num, *adj_list = list(map(int, v_info))","+ # assert len(adj_list) == adj_num","+ adj_table[v_index].extend(sorted(adj_list, reverse=True))","- time = 1","- dfs_start()","- for index, v in enumerate(zip(d_time[1:], f_time[1:]), 1):","- print((index, *v))","+ timer = 1","+ dfs_init()","+ for index, time_info in enumerate(zip(d_time[1:], f_time[1:]), 1):","+ print((index, *time_info))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0378290862,"measured_runtime_v1":0.038188626,"runtime_lift":0.9905851612,"key":["s843964990","s414876741"]} +{"user_id":"u309120194","problem_id":"p02547","language":"python","submission_id_v0":"s706780936","submission_id_v1":"s422511547","cpu_time_v0":33,"cpu_time_v1":28,"memory_v0":9220,"memory_v1":9188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.15,"input":"N = int(eval(input()))\n\nD = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nans = 'No'\n\nflag = False\n\nfor i in range(N-2):\n\n if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]: flag = True\n\n if flag:\n\n ans = 'Yes'\n\n break\n\n \n\nprint(ans)","target":"N = int(eval(input()))\n\nD = [list(map(int, input().split())) for _ in range(N)]\n\n \n\nans = 'No'\n\nfor i in range(N-2):\n\n if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:\n\n ans = 'Yes'\n\n break\n\n \n\nprint(ans)","code_v0_loc":12,"code_v1_loc":10,"code_v0_num_chars":273,"code_v1_num_chars":236,"code_v0_no_empty_lines":"N = int(eval(input()))\nD = [list(map(int, input().split())) for _ in range(N)]\nans = \"No\"\nflag = False\nfor i in range(N - 2):\n if D[i][0] == D[i][1] and D[i + 1][0] == D[i + 1][1] and D[i + 2][0] == D[i + 2][1]:\n flag = True\n if flag:\n ans = \"Yes\"\n break\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nD = [list(map(int, input().split())) for _ in range(N)]\nans = \"No\"\nfor i in range(N - 2):\n if D[i][0] == D[i][1] and D[i + 1][0] == D[i + 1][1] and D[i + 2][0] == D[i + 2][1]:\n ans = \"Yes\"\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-flag = False","- flag = True","- if flag:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0392052824,"measured_runtime_v1":0.0384257967,"runtime_lift":1.020285479,"key":["s706780936","s422511547"]} +{"user_id":"u788703383","problem_id":"p03162","language":"python","submission_id_v0":"s844289155","submission_id_v1":"s089186386","cpu_time_v0":709,"cpu_time_v1":392,"memory_v0":34644,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.71,"input":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\na=[[0],[0],[0]]\n\nn = int(eval(input()))\n\nfor i in range(n):\n\n A,B,C = list(map(int,input().split()))\n\n a[0].append(A)\n\n a[1].append(B)\n\n a[2].append(C)\n\ndp = []\n\nfor j in range(n+1):\n\n dp.append([0,0,0])\n\n\n\ndp[1][0] = a[0][1]\n\ndp[1][1] = a[1][1]\n\ndp[1][2] = a[2][1]\n\nfor i in range(2,n+1):\n\n for j in range(3):\n\n x = dp[i-1][(j+1)%3]+a[j][i]\n\n y = dp[i-1][(j+2)%3]+a[j][i]\n\n dp[i][j] = max(x,y)\n\nprint((max(dp[n][0],dp[n][1],dp[n][2])))\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\na,b,c = 0,0,0\n\nn = int(eval(input()))\n\nfor i in range(n):\n\n x,y,z = list(map(int,input().split()))\n\n a,b,c = max(b,c)+x,max(a,c)+y,max(a,b)+z\n\n\n\nprint((max(a,b,c)))\n","code_v0_loc":24,"code_v1_loc":12,"code_v0_num_chars":582,"code_v1_num_chars":279,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\na = [[0], [0], [0]]\nn = int(eval(input()))\nfor i in range(n):\n A, B, C = list(map(int, input().split()))\n a[0].append(A)\n a[1].append(B)\n a[2].append(C)\ndp = []\nfor j in range(n + 1):\n dp.append([0, 0, 0])\ndp[1][0] = a[0][1]\ndp[1][1] = a[1][1]\ndp[1][2] = a[2][1]\nfor i in range(2, n + 1):\n for j in range(3):\n x = dp[i - 1][(j + 1) % 3] + a[j][i]\n y = dp[i - 1][(j + 2) % 3] + a[j][i]\n dp[i][j] = max(x, y)\nprint((max(dp[n][0], dp[n][1], dp[n][2])))\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\na, b, c = 0, 0, 0\nn = int(eval(input()))\nfor i in range(n):\n x, y, z = list(map(int, input().split()))\n a, b, c = max(b, c) + x, max(a, c) + y, max(a, b) + z\nprint((max(a, b, c)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-a = [[0], [0], [0]]","+a, b, c = 0, 0, 0","- A, B, C = list(map(int, input().split()))","- a[0].append(A)","- a[1].append(B)","- a[2].append(C)","-dp = []","-for j in range(n + 1):","- dp.append([0, 0, 0])","-dp[1][0] = a[0][1]","-dp[1][1] = a[1][1]","-dp[1][2] = a[2][1]","-for i in range(2, n + 1):","- for j in range(3):","- x = dp[i - 1][(j + 1) % 3] + a[j][i]","- y = dp[i - 1][(j + 2) % 3] + a[j][i]","- dp[i][j] = max(x, y)","-print((max(dp[n][0], dp[n][1], dp[n][2])))","+ x, y, z = list(map(int, input().split()))","+ a, b, c = max(b, c) + x, max(a, c) + y, max(a, b) + z","+print((max(a, b, c)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0855881085,"measured_runtime_v1":0.0375700512,"runtime_lift":2.2780940084,"key":["s844289155","s089186386"]} +{"user_id":"u906428167","problem_id":"p03164","language":"python","submission_id_v0":"s305631771","submission_id_v1":"s228688007","cpu_time_v0":1887,"cpu_time_v1":556,"memory_v0":314864,"memory_v1":172296,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.54,"input":"n, w = list(map(int, input().split()))\n\n\n\nweight = []\n\nvalue = []\n\n\n\nfor i in range(n):\n\n wi, vi = list(map(int, input().split()))\n\n weight.append(wi)\n\n value.append(vi)\n\n\n\nv_sum = sum(value)\n\n\n\ndp = [[float('inf') for _ in range(v_sum+1)] for i in range(n)]\n\n\n\nfor i in range(n):\n\n if i == 0:\n\n dp[i][0] = 0\n\n dp[i][value[0]] = weight[0]\n\n else:\n\n for k in range(v_sum+1):\n\n if k < value[i]:\n\n dp[i][k] = dp[i-1][k]\n\n else:\n\n dp[i][k] = min(dp[i-1][k], dp[i-1][k-value[i]]+weight[i])\n\n\n\nfor i in range(v_sum, -1, -1):\n\n if dp[n-1][i] <= w:\n\n print(i)\n\n exit()\n","target":"n, w = list(map(int, input().split()))\n\n\n\nweight = []\n\nvalue = []\n\n\n\nfor i in range(n):\n\n wi, vi = list(map(int, input().split()))\n\n weight.append(wi)\n\n value.append(vi)\n\n\n\nv_sum = sum(value)\n\n\n\ndp = [[10**12 for _ in range(v_sum+1)] for i in range(n)]\n\n\n\nfor i in range(n):\n\n if i == 0:\n\n dp[i][0] = 0\n\n dp[i][value[0]] = weight[0]\n\n else:\n\n for k in range(v_sum+1):\n\n if k < value[i]:\n\n dp[i][k] = dp[i-1][k]\n\n else:\n\n dp[i][k] = min(dp[i-1][k], dp[i-1][k-value[i]]+weight[i])\n\n\n\nfor i in range(v_sum, -1, -1):\n\n if dp[n-1][i] <= w:\n\n print(i)\n\n exit()\n","code_v0_loc":29,"code_v1_loc":29,"code_v0_num_chars":654,"code_v1_num_chars":648,"code_v0_no_empty_lines":"n, w = list(map(int, input().split()))\nweight = []\nvalue = []\nfor i in range(n):\n wi, vi = list(map(int, input().split()))\n weight.append(wi)\n value.append(vi)\nv_sum = sum(value)\ndp = [[float(\"inf\") for _ in range(v_sum + 1)] for i in range(n)]\nfor i in range(n):\n if i == 0:\n dp[i][0] = 0\n dp[i][value[0]] = weight[0]\n else:\n for k in range(v_sum + 1):\n if k < value[i]:\n dp[i][k] = dp[i - 1][k]\n else:\n dp[i][k] = min(dp[i - 1][k], dp[i - 1][k - value[i]] + weight[i])\nfor i in range(v_sum, -1, -1):\n if dp[n - 1][i] <= w:\n print(i)\n exit()\n","code_v1_no_empty_lines":"n, w = list(map(int, input().split()))\nweight = []\nvalue = []\nfor i in range(n):\n wi, vi = list(map(int, input().split()))\n weight.append(wi)\n value.append(vi)\nv_sum = sum(value)\ndp = [[10**12 for _ in range(v_sum + 1)] for i in range(n)]\nfor i in range(n):\n if i == 0:\n dp[i][0] = 0\n dp[i][value[0]] = weight[0]\n else:\n for k in range(v_sum + 1):\n if k < value[i]:\n dp[i][k] = dp[i - 1][k]\n else:\n dp[i][k] = min(dp[i - 1][k], dp[i - 1][k - value[i]] + weight[i])\nfor i in range(v_sum, -1, -1):\n if dp[n - 1][i] <= w:\n print(i)\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-dp = [[float(\"inf\") for _ in range(v_sum + 1)] for i in range(n)]","+dp = [[10**12 for _ in range(v_sum + 1)] for i in range(n)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0438015499,"measured_runtime_v1":0.145953048,"runtime_lift":0.300107127,"key":["s305631771","s228688007"]} +{"user_id":"u562016607","problem_id":"p03152","language":"python","submission_id_v0":"s910985715","submission_id_v1":"s776772013","cpu_time_v0":371,"cpu_time_v1":259,"memory_v0":42740,"memory_v1":3320,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.19,"input":"P=10**9+7\n\nN,M=list(map(int,input().split()))\n\nX=sorted([int(i) for i in input().split()])\n\nY=sorted([int(i) for i in input().split()])\n\nA=[i for i in X]\n\nB=[i for i in Y]\n\nif len(set(A))!=N or len(set(B))!=M:\n\n print((0))\n\n exit()\n\nL=[]\n\nx=0\n\ny=0\n\nD=N*M\n\nwhile(len(A)>0 and len(B)>0):\n\n if max(A[-1],B[-1])==D:\n\n if A[-1]>B[-1]:\n\n A.pop()\n\n L.append(y)\n\n x+=1\n\n elif A[-1]0:\n\n D=min(Y)-1\n\n while(len(A)>0):\n\n C=A[-1]+1\n\n tmp=x*y-(N*M-D)\n\n for i in range(C,D+1)[::-1]:\n\n L.append(tmp)\n\n tmp-=1\n\n D=A.pop()-1\n\n x+=1\n\n L.append(M)\n\nif len(B)>0:\n\n D=min(X)-1\n\n while(len(B)>0):\n\n C=B[-1]+1\n\n tmp=x*y-(N*M-D)\n\n for i in range(C,D+1)[::-1]:\n\n L.append(tmp)\n\n tmp-=1\n\n D=B.pop()-1\n\n y+=1\n\n L.append(N)\n\nm=min(min(X),min(Y))-1\n\nfor i in range(1,m+1):\n\n L.append(i)\n\nans=1\n\nfor i in L:\n\n ans*=i\n\n ans%=P\n\nprint(ans)\n","target":"P=10**9+7\n\nN,M=list(map(int,input().split()))\n\nA=sorted([int(i) for i in input().split()])\n\nB=sorted([int(i) for i in input().split()])\n\nmx=A[0]-1\n\nmy=B[0]-1\n\nm=min(mx,my)\n\nans=1\n\nif len(set(A))!=N or len(set(B))!=M:\n\n print((0))\n\n exit()\n\nx=0\n\ny=0\n\nD=N*M\n\nwhile(len(A)>0 and len(B)>0):\n\n if max(A[-1],B[-1])==D:\n\n if A[-1]>B[-1]:\n\n A.pop()\n\n ans*=y\n\n ans%=P\n\n x+=1\n\n elif A[-1]0:\n\n D=my\n\n while(len(A)>0):\n\n C=A[-1]+1\n\n for i in range(C,D+1)[::-1]:\n\n ans*=x*y-N*M+i\n\n ans%=P\n\n D=A.pop()-1\n\n x+=1\n\n ans*=M\n\n ans%=P\n\nif len(B)>0:\n\n D=mx\n\n while(len(B)>0):\n\n C=B[-1]+1\n\n for i in range(C,D+1):\n\n ans*=x*y-N*M+i\n\n ans%=P\n\n D=B.pop()-1\n\n y+=1\n\n ans*=N\n\n ans%=P\n\nfor i in range(1,m+1):\n\n ans*=i\n\n ans%=P\n\nprint(ans)\n","code_v0_loc":66,"code_v1_loc":64,"code_v0_num_chars":1374,"code_v1_num_chars":1270,"code_v0_no_empty_lines":"P = 10**9 + 7\nN, M = list(map(int, input().split()))\nX = sorted([int(i) for i in input().split()])\nY = sorted([int(i) for i in input().split()])\nA = [i for i in X]\nB = [i for i in Y]\nif len(set(A)) != N or len(set(B)) != M:\n print((0))\n exit()\nL = []\nx = 0\ny = 0\nD = N * M\nwhile len(A) > 0 and len(B) > 0:\n if max(A[-1], B[-1]) == D:\n if A[-1] > B[-1]:\n A.pop()\n L.append(y)\n x += 1\n elif A[-1] < B[-1]:\n B.pop()\n L.append(x)\n y += 1\n else:\n A.pop()\n B.pop()\n x += 1\n y += 1\n D -= 1\n else:\n C = max(A[-1], B[-1]) + 1\n tmp = x * y - (N * M - D)\n for i in range(C, D + 1)[::-1]:\n L.append(tmp)\n tmp -= 1\n D = max(A[-1], B[-1])\nif len(A) > 0:\n D = min(Y) - 1\n while len(A) > 0:\n C = A[-1] + 1\n tmp = x * y - (N * M - D)\n for i in range(C, D + 1)[::-1]:\n L.append(tmp)\n tmp -= 1\n D = A.pop() - 1\n x += 1\n L.append(M)\nif len(B) > 0:\n D = min(X) - 1\n while len(B) > 0:\n C = B[-1] + 1\n tmp = x * y - (N * M - D)\n for i in range(C, D + 1)[::-1]:\n L.append(tmp)\n tmp -= 1\n D = B.pop() - 1\n y += 1\n L.append(N)\nm = min(min(X), min(Y)) - 1\nfor i in range(1, m + 1):\n L.append(i)\nans = 1\nfor i in L:\n ans *= i\n ans %= P\nprint(ans)\n","code_v1_no_empty_lines":"P = 10**9 + 7\nN, M = list(map(int, input().split()))\nA = sorted([int(i) for i in input().split()])\nB = sorted([int(i) for i in input().split()])\nmx = A[0] - 1\nmy = B[0] - 1\nm = min(mx, my)\nans = 1\nif len(set(A)) != N or len(set(B)) != M:\n print((0))\n exit()\nx = 0\ny = 0\nD = N * M\nwhile len(A) > 0 and len(B) > 0:\n if max(A[-1], B[-1]) == D:\n if A[-1] > B[-1]:\n A.pop()\n ans *= y\n ans %= P\n x += 1\n elif A[-1] < B[-1]:\n B.pop()\n ans *= x\n ans %= P\n y += 1\n else:\n A.pop()\n B.pop()\n x += 1\n y += 1\n D -= 1\n else:\n C = max(A[-1], B[-1]) + 1\n for i in range(C, D + 1):\n ans *= x * y - N * M + i\n ans %= P\n D = max(A[-1], B[-1])\nif len(A) > 0:\n D = my\n while len(A) > 0:\n C = A[-1] + 1\n for i in range(C, D + 1)[::-1]:\n ans *= x * y - N * M + i\n ans %= P\n D = A.pop() - 1\n x += 1\n ans *= M\n ans %= P\nif len(B) > 0:\n D = mx\n while len(B) > 0:\n C = B[-1] + 1\n for i in range(C, D + 1):\n ans *= x * y - N * M + i\n ans %= P\n D = B.pop() - 1\n y += 1\n ans *= N\n ans %= P\nfor i in range(1, m + 1):\n ans *= i\n ans %= P\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":3.0303030303,"diff":["-X = sorted([int(i) for i in input().split()])","-Y = sorted([int(i) for i in input().split()])","-A = [i for i in X]","-B = [i for i in Y]","+A = sorted([int(i) for i in input().split()])","+B = sorted([int(i) for i in input().split()])","+mx = A[0] - 1","+my = B[0] - 1","+m = min(mx, my)","+ans = 1","-L = []","- L.append(y)","+ ans *= y","+ ans %= P","- L.append(x)","+ ans *= x","+ ans %= P","- tmp = x * y - (N * M - D)","- for i in range(C, D + 1)[::-1]:","- L.append(tmp)","- tmp -= 1","+ for i in range(C, D + 1):","+ ans *= x * y - N * M + i","+ ans %= P","- D = min(Y) - 1","+ D = my","- tmp = x * y - (N * M - D)","- L.append(tmp)","- tmp -= 1","+ ans *= x * y - N * M + i","+ ans %= P","- L.append(M)","+ ans *= M","+ ans %= P","- D = min(X) - 1","+ D = mx","- tmp = x * y - (N * M - D)","- for i in range(C, D + 1)[::-1]:","- L.append(tmp)","- tmp -= 1","+ for i in range(C, D + 1):","+ ans *= x * y - N * M + i","+ ans %= P","- L.append(N)","-m = min(min(X), min(Y)) - 1","+ ans *= N","+ ans %= P","- L.append(i)","-ans = 1","-for i in L:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0846891427,"measured_runtime_v1":0.0810643365,"runtime_lift":1.044715177,"key":["s910985715","s776772013"]} +{"user_id":"u789339072","problem_id":"p03112","language":"python","submission_id_v0":"s081262629","submission_id_v1":"s532916266","cpu_time_v0":1924,"cpu_time_v1":1141,"memory_v0":14852,"memory_v1":19116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.7,"input":"import bisect\n\nimport sys\n\n\n\nA, B, Q = list(map(int,input().split()))\n\ns = tuple([-(10**18)] + list(map(int, (sys.stdin.readline() for _ in [0]*A))) + [10**18])\n\nt = tuple([-(10**18)] + list(map(int, (sys.stdin.readline() for _ in [0]*B))) + [10**18])\n\n\n\n\n\ndef solve(s,t,x):\n\n ans = 10**18\n\n for i in range(2):\n\n a, b = (s, t) if i==0 else (t, s)\n\n posX1 = bisect.bisect_left(a,x)\n\n for j in range(2):\n\n ax = a[posX1 -j]\n\n posX2 = bisect.bisect_left(b,ax)\n\n for k in range(2):\n\n bx = b[posX2-k]\n\n ans = min(ans, abs(x-ax)+abs(bx-ax))\n\n return ans\n\n\n\nfor _ in range(Q):\n\n x = int(eval(input()))\n\n print((solve(s,t,x)))","target":"import bisect\n\nimport sys\n\n\n\nA, B, Q = map(int,input().split())\n\ns = tuple([-(10**18)] + list(map(int, (sys.stdin.readline() for _ in [0]*A))) + [10**18])\n\nt = tuple([-(10**18)] + list(map(int, (sys.stdin.readline() for _ in [0]*B))) + [10**18])\n\n\n\n\n\ndef solve(s,t,x):\n\n ans = 10**18\n\n for i in range(2):\n\n a, b = (s, t) if i==0 else (t, s)\n\n posX1 = bisect.bisect_left(a,x)\n\n for j in range(2):\n\n ax = a[posX1 -j]\n\n posX2 = bisect.bisect_left(b,ax)\n\n for k in range(2):\n\n bx = b[posX2-k]\n\n ans = min(ans, abs(x-ax)+abs(bx-ax))\n\n return ans\n\n\n\nans = [solve(s,t,x) for x in map(int,sys.stdin)]\n\nprint(*ans, sep=\"\\n\")\n","code_v0_loc":24,"code_v1_loc":23,"code_v0_num_chars":702,"code_v1_num_chars":708,"code_v0_no_empty_lines":"import bisect\nimport sys\n\nA, B, Q = list(map(int, input().split()))\ns = tuple(\n [-(10**18)] + list(map(int, (sys.stdin.readline() for _ in [0] * A))) + [10**18]\n)\nt = tuple(\n [-(10**18)] + list(map(int, (sys.stdin.readline() for _ in [0] * B))) + [10**18]\n)\n\n\ndef solve(s, t, x):\n ans = 10**18\n for i in range(2):\n a, b = (s, t) if i == 0 else (t, s)\n posX1 = bisect.bisect_left(a, x)\n for j in range(2):\n ax = a[posX1 - j]\n posX2 = bisect.bisect_left(b, ax)\n for k in range(2):\n bx = b[posX2 - k]\n ans = min(ans, abs(x - ax) + abs(bx - ax))\n return ans\n\n\nfor _ in range(Q):\n x = int(eval(input()))\n print((solve(s, t, x)))\n","code_v1_no_empty_lines":"import bisect\nimport sys\n\nA, B, Q = map(int, input().split())\ns = tuple(\n [-(10**18)] + list(map(int, (sys.stdin.readline() for _ in [0] * A))) + [10**18]\n)\nt = tuple(\n [-(10**18)] + list(map(int, (sys.stdin.readline() for _ in [0] * B))) + [10**18]\n)\n\n\ndef solve(s, t, x):\n ans = 10**18\n for i in range(2):\n a, b = (s, t) if i == 0 else (t, s)\n posX1 = bisect.bisect_left(a, x)\n for j in range(2):\n ax = a[posX1 - j]\n posX2 = bisect.bisect_left(b, ax)\n for k in range(2):\n bx = b[posX2 - k]\n ans = min(ans, abs(x - ax) + abs(bx - ax))\n return ans\n\n\nans = [solve(s, t, x) for x in map(int, sys.stdin)]\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":4.1666666667,"diff":["-A, B, Q = list(map(int, input().split()))","+A, B, Q = map(int, input().split())","-for _ in range(Q):","- x = int(eval(input()))","- print((solve(s, t, x)))","+ans = [solve(s, t, x) for x in map(int, sys.stdin)]","+print(*ans, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0476072534,"measured_runtime_v1":0.103638589,"runtime_lift":0.4593583708,"key":["s081262629","s532916266"]} +{"user_id":"u230621983","problem_id":"p02911","language":"python","submission_id_v0":"s155045806","submission_id_v1":"s577606259","cpu_time_v0":273,"cpu_time_v1":248,"memory_v0":8136,"memory_v1":12124,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.16,"input":"import collections\n\nn,k,q = list(map(int, input().split()))\n\ntemp = [k-q for _ in range(n)]\n\nfor _ in range(q):\n\n a = int(eval(input()))\n\n temp[a-1] += 1\n\nfor i in temp:\n\n print(('Yes' if i > 0 else 'No'))","target":"import collections\n\nn,k,q = list(map(int, input().split()))\n\ntemp = [k-q for _ in range(n)]\n\na = [int(eval(input())) for _ in range(q)]\n\nfor A in a:\n\n temp[A-1] += 1\n\nfor i in temp:\n\n print(('Yes' if i > 0 else 'No'))","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":194,"code_v1_num_chars":205,"code_v0_no_empty_lines":"import collections\n\nn, k, q = list(map(int, input().split()))\ntemp = [k - q for _ in range(n)]\nfor _ in range(q):\n a = int(eval(input()))\n temp[a - 1] += 1\nfor i in temp:\n print((\"Yes\" if i > 0 else \"No\"))\n","code_v1_no_empty_lines":"import collections\n\nn, k, q = list(map(int, input().split()))\ntemp = [k - q for _ in range(n)]\na = [int(eval(input())) for _ in range(q)]\nfor A in a:\n temp[A - 1] += 1\nfor i in temp:\n print((\"Yes\" if i > 0 else \"No\"))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for _ in range(q):","- a = int(eval(input()))","- temp[a - 1] += 1","+a = [int(eval(input())) for _ in range(q)]","+for A in a:","+ temp[A - 1] += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.1004746468,"measured_runtime_v1":0.042501024,"runtime_lift":2.3640523759,"key":["s155045806","s577606259"]} +{"user_id":"u305366205","problem_id":"p02888","language":"python","submission_id_v0":"s806110127","submission_id_v1":"s002328558","cpu_time_v0":1492,"cpu_time_v1":1068,"memory_v0":3188,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.42,"input":"import bisect\n\nn = int(eval(input()))\n\nl = list(map(int, input().split()))\n\nl.sort()\n\nans = 0\n\n# a < b < c \u3068\u3059\u308b\u3068\u30012\u5f0f\u306f\u5fc5\u305a\u6210\u7acb\u3057\u3001c < a + b \u306e\u307f\u8003\u616e\u3059\u308c\u3070\u826f\u3044\n\n# \u3064\u307e\u308a\u3000b < c < a + b\n\n# c < a + b \u306e\u5883\u754c\u90e8\u306e\u767a\u898b\u306b2\u5206\u63a2\u7d22\u3092\u5229\u7528\u3059\u308b\n\nfor i in range(n - 1):\n\n for j in range(i + 1, n):\n\n k = bisect.bisect_left(l, l[i] + l[j])\n\n ans += k - (j + 1)\n\nprint(ans)","target":"def main():\n\n import bisect\n\n n = int(eval(input()))\n\n l = list(map(int, input().split()))\n\n l.sort()\n\n ans = 0\n\n # a < b < c \u3068\u3059\u308b\u3068\u30012\u5f0f\u306f\u5fc5\u305a\u6210\u7acb\u3057\u3001c < a + b \u306e\u307f\u8003\u616e\u3059\u308c\u3070\u826f\u3044\n\n # \u3064\u307e\u308a\u3000b < c < a + b\n\n # c < a + b \u306e\u5883\u754c\u90e8\u306e\u767a\u898b\u306b2\u5206\u63a2\u7d22\u3092\u5229\u7528\u3059\u308b\n\n for i in range(n - 1):\n\n for j in range(i + 1, n):\n\n k = bisect.bisect_left(l, l[i] + l[j])\n\n ans += k - (j + 1)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":13,"code_v1_loc":18,"code_v0_num_chars":329,"code_v1_num_chars":438,"code_v0_no_empty_lines":"import bisect\n\nn = int(eval(input()))\nl = list(map(int, input().split()))\nl.sort()\nans = 0\n# a < b < c \u3068\u3059\u308b\u3068\u30012\u5f0f\u306f\u5fc5\u305a\u6210\u7acb\u3057\u3001c < a + b \u306e\u307f\u8003\u616e\u3059\u308c\u3070\u826f\u3044\n# \u3064\u307e\u308a\u3000b < c < a + b\n# c < a + b \u306e\u5883\u754c\u90e8\u306e\u767a\u898b\u306b2\u5206\u63a2\u7d22\u3092\u5229\u7528\u3059\u308b\nfor i in range(n - 1):\n for j in range(i + 1, n):\n k = bisect.bisect_left(l, l[i] + l[j])\n ans += k - (j + 1)\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n import bisect\n\n n = int(eval(input()))\n l = list(map(int, input().split()))\n l.sort()\n ans = 0\n # a < b < c \u3068\u3059\u308b\u3068\u30012\u5f0f\u306f\u5fc5\u305a\u6210\u7acb\u3057\u3001c < a + b \u306e\u307f\u8003\u616e\u3059\u308c\u3070\u826f\u3044\n # \u3064\u307e\u308a\u3000b < c < a + b\n # c < a + b \u306e\u5883\u754c\u90e8\u306e\u767a\u898b\u306b2\u5206\u63a2\u7d22\u3092\u5229\u7528\u3059\u308b\n for i in range(n - 1):\n for j in range(i + 1, n):\n k = bisect.bisect_left(l, l[i] + l[j])\n ans += k - (j + 1)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":27.7777777778,"diff":["-import bisect","+def main():","+ import bisect","-n = int(eval(input()))","-l = list(map(int, input().split()))","-l.sort()","-ans = 0","-# a < b < c \u3068\u3059\u308b\u3068\u30012\u5f0f\u306f\u5fc5\u305a\u6210\u7acb\u3057\u3001c < a + b \u306e\u307f\u8003\u616e\u3059\u308c\u3070\u826f\u3044","-# \u3064\u307e\u308a\u3000b < c < a + b","-# c < a + b \u306e\u5883\u754c\u90e8\u306e\u767a\u898b\u306b2\u5206\u63a2\u7d22\u3092\u5229\u7528\u3059\u308b","-for i in range(n - 1):","- for j in range(i + 1, n):","- k = bisect.bisect_left(l, l[i] + l[j])","- ans += k - (j + 1)","-print(ans)","+ n = int(eval(input()))","+ l = list(map(int, input().split()))","+ l.sort()","+ ans = 0","+ # a < b < c \u3068\u3059\u308b\u3068\u30012\u5f0f\u306f\u5fc5\u305a\u6210\u7acb\u3057\u3001c < a + b \u306e\u307f\u8003\u616e\u3059\u308c\u3070\u826f\u3044","+ # \u3064\u307e\u308a\u3000b < c < a + b","+ # c < a + b \u306e\u5883\u754c\u90e8\u306e\u767a\u898b\u306b2\u5206\u63a2\u7d22\u3092\u5229\u7528\u3059\u308b","+ for i in range(n - 1):","+ for j in range(i + 1, n):","+ k = bisect.bisect_left(l, l[i] + l[j])","+ ans += k - (j + 1)","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0358412273,"measured_runtime_v1":0.0440388916,"runtime_lift":0.8138539827,"key":["s806110127","s002328558"]} +{"user_id":"u384793271","problem_id":"p02756","language":"python","submission_id_v0":"s906057534","submission_id_v1":"s122674057","cpu_time_v0":1392,"cpu_time_v1":429,"memory_v0":40660,"memory_v1":44788,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.18,"input":"S = eval(input())\n\nQ = int(eval(input()))\n\nQuery = [input().split() for _ in range(Q)]\n\n\n\nrev = False\n\nS1 = ''\n\nS2 = ''\n\n\n\nfor TFC in Query:\n\n if TFC[0] == '1':\n\n rev = not rev\n\n else:\n\n if TFC[1] == '1':\n\n if rev:\n\n S2 += TFC[2]\n\n else:\n\n S1 = TFC[2] + S1\n\n else:\n\n if rev:\n\n S1 = TFC[2] + S1\n\n else:\n\n S2 += TFC[2]\n\n\n\nif rev:\n\n print((S2[::-1] + S[::-1] + S1[::-1]))\n\nelse:\n\n print((S1 + S + S2))","target":"from collections import deque\n\n\n\nS = eval(input())\n\nQ = int(eval(input()))\n\nQuery = [input().split() for _ in range(Q)]\n\n\n\nS = deque(S)\n\nrev = False\n\n\n\nfor TFC in Query:\n\n if TFC[0] == '1':\n\n rev = not rev\n\n else:\n\n if TFC[1] == '1':\n\n if rev:\n\n S.append(TFC[2])\n\n else:\n\n S.appendleft(TFC[2])\n\n else:\n\n if rev:\n\n S.appendleft(TFC[2])\n\n else:\n\n S.append(TFC[2])\n\nif rev:\n\n S.reverse()\n\nprint((''.join(S)))","code_v0_loc":27,"code_v1_loc":26,"code_v0_num_chars":519,"code_v1_num_chars":525,"code_v0_no_empty_lines":"S = eval(input())\nQ = int(eval(input()))\nQuery = [input().split() for _ in range(Q)]\nrev = False\nS1 = \"\"\nS2 = \"\"\nfor TFC in Query:\n if TFC[0] == \"1\":\n rev = not rev\n else:\n if TFC[1] == \"1\":\n if rev:\n S2 += TFC[2]\n else:\n S1 = TFC[2] + S1\n else:\n if rev:\n S1 = TFC[2] + S1\n else:\n S2 += TFC[2]\nif rev:\n print((S2[::-1] + S[::-1] + S1[::-1]))\nelse:\n print((S1 + S + S2))\n","code_v1_no_empty_lines":"from collections import deque\n\nS = eval(input())\nQ = int(eval(input()))\nQuery = [input().split() for _ in range(Q)]\nS = deque(S)\nrev = False\nfor TFC in Query:\n if TFC[0] == \"1\":\n rev = not rev\n else:\n if TFC[1] == \"1\":\n if rev:\n S.append(TFC[2])\n else:\n S.appendleft(TFC[2])\n else:\n if rev:\n S.appendleft(TFC[2])\n else:\n S.append(TFC[2])\nif rev:\n S.reverse()\nprint((\"\".join(S)))\n","code_same":false,"relative_loc_diff_percent":3.7037037037,"diff":["+from collections import deque","+","+S = deque(S)","-S1 = \"\"","-S2 = \"\"","- S2 += TFC[2]","+ S.append(TFC[2])","- S1 = TFC[2] + S1","+ S.appendleft(TFC[2])","- S1 = TFC[2] + S1","+ S.appendleft(TFC[2])","- S2 += TFC[2]","+ S.append(TFC[2])","- print((S2[::-1] + S[::-1] + S1[::-1]))","-else:","- print((S1 + S + S2))","+ S.reverse()","+print((\"\".join(S)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0436754487,"measured_runtime_v1":0.0437423651,"runtime_lift":0.9984702136,"key":["s906057534","s122674057"]} +{"user_id":"u508486691","problem_id":"p02821","language":"python","submission_id_v0":"s279313164","submission_id_v1":"s568343837","cpu_time_v0":1209,"cpu_time_v1":993,"memory_v0":63512,"memory_v1":55528,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.87,"input":"import sys\n\nimport math\n\nfrom collections import defaultdict\n\n\n\nsys.setrecursionlimit(10**7)\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\n\n\nmod = 10**9 + 7\n\n\n\ndef I(): return int(input())\n\ndef II(): return map(int, input().split())\n\ndef III(): return list(map(int, input().split()))\n\ndef Line(N,num):\n\n if N<=0:\n\n return [[]]*num\n\n elif num==1:\n\n return [I() for _ in range(N)]\n\n else:\n\n read_all = [tuple(II()) for _ in range(N)]\n\n return map(list, zip(*read_all))\n\n\n\n#################\n\n\n\nfrom bisect import bisect_left\n\n\n\n#Binary Indexed Tree\uff08\u533a\u9593\u52a0\u7b97\uff09\n\n#1-indexed\n\nclass Range_BIT():\n\n def __init__(self, N):\n\n self.size = N\n\n self.data0 = [0]*(N+1)\n\n self.data1 = [0]*(N+1)\n\n\n\n def _add(self, data, k, x):\n\n while k <= self.size:\n\n data[k] += x\n\n k += k & -k\n\n\n\n # \u533a\u9593[l,r)\u306bx\u3092\u52a0\u7b97\n\n def add(self, l, r, x):\n\n self._add(self.data0, l, -x*(l-1))\n\n self._add(self.data0, r, x*(r-1))\n\n self._add(self.data1, l, x)\n\n self._add(self.data1, r, -x)\n\n\n\n def _get(self, data, k):\n\n s = 0\n\n while k:\n\n s += data[k]\n\n k -= k & -k\n\n return s\n\n\n\n # \u533a\u9593[l,r)\u306e\u548c\u3092\u6c42\u3081\u308b\n\n def query(self, l, r):\n\n return self._get(self.data1, r-1)*(r-1)+self._get(self.data0, r-1)\\\n\n -self._get(self.data1, l-1)*(l-1)-self._get(self.data0, l-1)\n\n\n\nN,M = II()\n\nA = III()\n\nA.sort()\n\n\n\ndef is_ok(x):\n\n num = 0\n\n for a in A:\n\n p = bisect_left(A,x-a)\n\n num += N-p\n\n if num>=M:\n\n return True\n\n else:\n\n return False\n\n\n\n#l\uff1a\u305d\u306e\u5024\u4ee5\u4e0a\u306e\u5e78\u798f\u5ea6\u306e\u63e1\u624b\u304cM\u901a\u308a\u4ee5\u4e0a\u3042\u308b\u6700\u5927\u5024\n\nl = 0\n\nr = 2*10**5 + 1\n\nwhile abs(r-l)>1:\n\n mid = (l+r)\/\/2\n\n if is_ok(mid):\n\n l = mid\n\n else:\n\n r = mid\n\n\n\n#\u5024l\u4ee5\u4e0a\u306e\u63e1\u624b\u3067\u7528\u3044\u308bA[i]\u306e\u500b\u6570\u3092\u8abf\u3079\u308b\n\nbit = Range_BIT(N)\n\nfor i in range(1,N+1):\n\n p = bisect_left(A,l-A[i-1])\n\n if p!=N:\n\n bit.add(p+1,N+1,1)\n\n bit.add(i,i+1,N-p)\n\nx = [0]*N\n\nfor i in range(N):\n\n x[i] = bit.query(i+1,i+2)\n\n\n\nans = 0\n\nfor i in range(N):\n\n ans += A[i]*x[i]\n\n\n\n#\u63e1\u624b\u306e\u56de\u6570\u304cM\u56de\u306b\u306a\u308b\u3088\u3046\u306b\u8abf\u6574\n\nans -= l*((sum(x)-2*M)\/\/2)\n\n\n\nprint(ans)\n","target":"import sys\n\nimport math\n\nfrom collections import defaultdict\n\n\n\nsys.setrecursionlimit(10**7)\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\n\n\nmod = 10**9 + 7\n\n\n\ndef I(): return int(eval(input()))\n\ndef II(): return list(map(int, input().split()))\n\ndef III(): return list(map(int, input().split()))\n\ndef Line(N,num):\n\n if N<=0:\n\n return [[] for _ in range(num)]\n\n elif num==1:\n\n return [I() for _ in range(N)]\n\n else:\n\n read_all = [tuple(II()) for _ in range(N)]\n\n return list(map(list, list(zip(*read_all))))\n\n\n\n#################\n\n\n\n# FFT\n\n# use python3\n\n# a = np.array([a1,a2,a3]), b= np.array([b1,b2,b3])\n\n# c = np.array([a1b1,a1b2+a2b1,a1a3+a2b2+a3b1,a2b3+a3b2,a3b3])\n\nimport numpy as np\n\ndef FFT(a,b):\n\n bit = (len(a)+len(b)).bit_length()+1\n\n L = 2**bit\n\n fa,fb = np.fft.rfft(a,L), np.fft.rfft(b,L)\n\n c = np.rint(np.fft.irfft(fa*fb,L)).astype(np.int64)\n\n return c[:len(a)+len(b)-1]\n\n\n\nN,M = II()\n\nA = III()\n\n\n\nh = [0]*(max(A))\n\nfor a in A:\n\n h[a-1] += 1\n\n\n\nconv = np.append([0,0],FFT(h,h))\n\nans = 0\n\ncount = 0\n\n\n\nfor k in range(2,2*max(A)+1)[::-1]:\n\n if conv[k]:\n\n num = min(M-count,conv[k])\n\n count += num\n\n ans += k*num\n\n if count==M:\n\n break\n\n\n\nprint(ans)","code_v0_loc":101,"code_v1_loc":56,"code_v0_num_chars":2126,"code_v1_num_chars":1232,"code_v0_no_empty_lines":"import sys\nimport math\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**7)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nmod = 10**9 + 7\n\n\ndef I():\n return int(input())\n\n\ndef II():\n return map(int, input().split())\n\n\ndef III():\n return list(map(int, input().split()))\n\n\ndef Line(N, num):\n if N <= 0:\n return [[]] * num\n elif num == 1:\n return [I() for _ in range(N)]\n else:\n read_all = [tuple(II()) for _ in range(N)]\n return map(list, zip(*read_all))\n\n\n#################\nfrom bisect import bisect_left\n\n# Binary Indexed Tree\uff08\u533a\u9593\u52a0\u7b97\uff09\n# 1-indexed\nclass Range_BIT:\n def __init__(self, N):\n self.size = N\n self.data0 = [0] * (N + 1)\n self.data1 = [0] * (N + 1)\n\n def _add(self, data, k, x):\n while k <= self.size:\n data[k] += x\n k += k & -k\n\n # \u533a\u9593[l,r)\u306bx\u3092\u52a0\u7b97\n def add(self, l, r, x):\n self._add(self.data0, l, -x * (l - 1))\n self._add(self.data0, r, x * (r - 1))\n self._add(self.data1, l, x)\n self._add(self.data1, r, -x)\n\n def _get(self, data, k):\n s = 0\n while k:\n s += data[k]\n k -= k & -k\n return s\n\n # \u533a\u9593[l,r)\u306e\u548c\u3092\u6c42\u3081\u308b\n def query(self, l, r):\n return (\n self._get(self.data1, r - 1) * (r - 1)\n + self._get(self.data0, r - 1)\n - self._get(self.data1, l - 1) * (l - 1)\n - self._get(self.data0, l - 1)\n )\n\n\nN, M = II()\nA = III()\nA.sort()\n\n\ndef is_ok(x):\n num = 0\n for a in A:\n p = bisect_left(A, x - a)\n num += N - p\n if num >= M:\n return True\n else:\n return False\n\n\n# l\uff1a\u305d\u306e\u5024\u4ee5\u4e0a\u306e\u5e78\u798f\u5ea6\u306e\u63e1\u624b\u304cM\u901a\u308a\u4ee5\u4e0a\u3042\u308b\u6700\u5927\u5024\nl = 0\nr = 2 * 10**5 + 1\nwhile abs(r - l) > 1:\n mid = (l + r) \/\/ 2\n if is_ok(mid):\n l = mid\n else:\n r = mid\n# \u5024l\u4ee5\u4e0a\u306e\u63e1\u624b\u3067\u7528\u3044\u308bA[i]\u306e\u500b\u6570\u3092\u8abf\u3079\u308b\nbit = Range_BIT(N)\nfor i in range(1, N + 1):\n p = bisect_left(A, l - A[i - 1])\n if p != N:\n bit.add(p + 1, N + 1, 1)\n bit.add(i, i + 1, N - p)\nx = [0] * N\nfor i in range(N):\n x[i] = bit.query(i + 1, i + 2)\nans = 0\nfor i in range(N):\n ans += A[i] * x[i]\n# \u63e1\u624b\u306e\u56de\u6570\u304cM\u56de\u306b\u306a\u308b\u3088\u3046\u306b\u8abf\u6574\nans -= l * ((sum(x) - 2 * M) \/\/ 2)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\nimport math\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**7)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nmod = 10**9 + 7\n\n\ndef I():\n return int(eval(input()))\n\n\ndef II():\n return list(map(int, input().split()))\n\n\ndef III():\n return list(map(int, input().split()))\n\n\ndef Line(N, num):\n if N <= 0:\n return [[] for _ in range(num)]\n elif num == 1:\n return [I() for _ in range(N)]\n else:\n read_all = [tuple(II()) for _ in range(N)]\n return list(map(list, list(zip(*read_all))))\n\n\n#################\n# FFT\n# use python3\n# a = np.array([a1,a2,a3]), b= np.array([b1,b2,b3])\n# c = np.array([a1b1,a1b2+a2b1,a1a3+a2b2+a3b1,a2b3+a3b2,a3b3])\nimport numpy as np\n\n\ndef FFT(a, b):\n bit = (len(a) + len(b)).bit_length() + 1\n L = 2**bit\n fa, fb = np.fft.rfft(a, L), np.fft.rfft(b, L)\n c = np.rint(np.fft.irfft(fa * fb, L)).astype(np.int64)\n return c[: len(a) + len(b) - 1]\n\n\nN, M = II()\nA = III()\nh = [0] * (max(A))\nfor a in A:\n h[a - 1] += 1\nconv = np.append([0, 0], FFT(h, h))\nans = 0\ncount = 0\nfor k in range(2, 2 * max(A) + 1)[::-1]:\n if conv[k]:\n num = min(M - count, conv[k])\n count += num\n ans += k * num\n if count == M:\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":44.5544554455,"diff":["- return int(input())","+ return int(eval(input()))","- return map(int, input().split())","+ return list(map(int, input().split()))","- return [[]] * num","+ return [[] for _ in range(num)]","- return map(list, zip(*read_all))","+ return list(map(list, list(zip(*read_all))))","-from bisect import bisect_left","+# FFT","+# use python3","+# a = np.array([a1,a2,a3]), b= np.array([b1,b2,b3])","+# c = np.array([a1b1,a1b2+a2b1,a1a3+a2b2+a3b1,a2b3+a3b2,a3b3])","+import numpy as np","-# Binary Indexed Tree\uff08\u533a\u9593\u52a0\u7b97\uff09","-# 1-indexed","-class Range_BIT:","- def __init__(self, N):","- self.size = N","- self.data0 = [0] * (N + 1)","- self.data1 = [0] * (N + 1)","- def _add(self, data, k, x):","- while k <= self.size:","- data[k] += x","- k += k & -k","-","- # \u533a\u9593[l,r)\u306bx\u3092\u52a0\u7b97","- def add(self, l, r, x):","- self._add(self.data0, l, -x * (l - 1))","- self._add(self.data0, r, x * (r - 1))","- self._add(self.data1, l, x)","- self._add(self.data1, r, -x)","-","- def _get(self, data, k):","- s = 0","- while k:","- s += data[k]","- k -= k & -k","- return s","-","- # \u533a\u9593[l,r)\u306e\u548c\u3092\u6c42\u3081\u308b","- def query(self, l, r):","- return (","- self._get(self.data1, r - 1) * (r - 1)","- + self._get(self.data0, r - 1)","- - self._get(self.data1, l - 1) * (l - 1)","- - self._get(self.data0, l - 1)","- )","+def FFT(a, b):","+ bit = (len(a) + len(b)).bit_length() + 1","+ L = 2**bit","+ fa, fb = np.fft.rfft(a, L), np.fft.rfft(b, L)","+ c = np.rint(np.fft.irfft(fa * fb, L)).astype(np.int64)","+ return c[: len(a) + len(b) - 1]","-A.sort()","-","-","-def is_ok(x):","- num = 0","- for a in A:","- p = bisect_left(A, x - a)","- num += N - p","- if num >= M:","- return True","- else:","- return False","-","-","-# l\uff1a\u305d\u306e\u5024\u4ee5\u4e0a\u306e\u5e78\u798f\u5ea6\u306e\u63e1\u624b\u304cM\u901a\u308a\u4ee5\u4e0a\u3042\u308b\u6700\u5927\u5024","-l = 0","-r = 2 * 10**5 + 1","-while abs(r - l) > 1:","- mid = (l + r) \/\/ 2","- if is_ok(mid):","- l = mid","- else:","- r = mid","-# \u5024l\u4ee5\u4e0a\u306e\u63e1\u624b\u3067\u7528\u3044\u308bA[i]\u306e\u500b\u6570\u3092\u8abf\u3079\u308b","-bit = Range_BIT(N)","-for i in range(1, N + 1):","- p = bisect_left(A, l - A[i - 1])","- if p != N:","- bit.add(p + 1, N + 1, 1)","- bit.add(i, i + 1, N - p)","-x = [0] * N","-for i in range(N):","- x[i] = bit.query(i + 1, i + 2)","+h = [0] * (max(A))","+for a in A:","+ h[a - 1] += 1","+conv = np.append([0, 0], FFT(h, h))","-for i in range(N):","- ans += A[i] * x[i]","-# \u63e1\u624b\u306e\u56de\u6570\u304cM\u56de\u306b\u306a\u308b\u3088\u3046\u306b\u8abf\u6574","-ans -= l * ((sum(x) - 2 * M) \/\/ 2)","+count = 0","+for k in range(2, 2 * max(A) + 1)[::-1]:","+ if conv[k]:","+ num = min(M - count, conv[k])","+ count += num","+ ans += k * num","+ if count == M:","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.0479407442,"measured_runtime_v1":0.7920351267,"runtime_lift":0.0605285581,"key":["s279313164","s568343837"]} +{"user_id":"u241159583","problem_id":"p03612","language":"python","submission_id_v0":"s473900629","submission_id_v1":"s008719530","cpu_time_v0":86,"cpu_time_v1":79,"memory_v0":13880,"memory_v1":14008,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.14,"input":"N = int(eval(input()))\n\np = [int(x) for x in input().split()]\n\n\n\nans = 0\n\nfor i in range(N):\n\n if i < N - 1 and p[i] == i + 1:\n\n p[i] = p[i+1]\n\n p[i+1] = i+1\n\n ans += 1\n\n elif i == N -1 and p[i] == i+1:\n\n p[i] = p[i-1]\n\n p[i-1] = i + 1\n\n ans += 1\n\nprint(ans)","target":"N = int(eval(input()))\n\np = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(N):\n\n if p[i]-1 == i:\n\n if i + 1 <= N-1:\n\n p[i] = p[i+1]\n\n p[i+1] = i + 1\n\n ans += 1\n\n elif i - 1 >= 0:\n\n p[i] = p[i-1]\n\n p[i-1] = i + 1\n\n ans += 1\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":272,"code_v1_num_chars":321,"code_v0_no_empty_lines":"N = int(eval(input()))\np = [int(x) for x in input().split()]\nans = 0\nfor i in range(N):\n if i < N - 1 and p[i] == i + 1:\n p[i] = p[i + 1]\n p[i + 1] = i + 1\n ans += 1\n elif i == N - 1 and p[i] == i + 1:\n p[i] = p[i - 1]\n p[i - 1] = i + 1\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\np = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n if p[i] - 1 == i:\n if i + 1 <= N - 1:\n p[i] = p[i + 1]\n p[i + 1] = i + 1\n ans += 1\n elif i - 1 >= 0:\n p[i] = p[i - 1]\n p[i - 1] = i + 1\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-p = [int(x) for x in input().split()]","+p = list(map(int, input().split()))","- if i < N - 1 and p[i] == i + 1:","- p[i] = p[i + 1]","- p[i + 1] = i + 1","- ans += 1","- elif i == N - 1 and p[i] == i + 1:","- p[i] = p[i - 1]","- p[i - 1] = i + 1","- ans += 1","+ if p[i] - 1 == i:","+ if i + 1 <= N - 1:","+ p[i] = p[i + 1]","+ p[i + 1] = i + 1","+ ans += 1","+ elif i - 1 >= 0:","+ p[i] = p[i - 1]","+ p[i - 1] = i + 1","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372779787,"measured_runtime_v1":0.0424491637,"runtime_lift":0.8781793426,"key":["s473900629","s008719530"]} +{"user_id":"u633068244","problem_id":"p00012","language":"python","submission_id_v0":"s981947697","submission_id_v1":"s615569987","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4448,"memory_v1":4436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"import math\n\ndef S(a,b,c):\n\n\ts = (a+b+c)\/2\n\n\treturn math.sqrt(s*(s-a)*(s-b)*(s-c))\n\n\t\n\nwhile True:\n\n\ttry:\n\n\t\tx1,y1,x2,y2,x3,y3,xp,yp = list(map(float, input().split()))\n\n\t\ta = math.sqrt((x1-x2)**2+(y1-y2)**2)\n\n\t\tb = math.sqrt((x1-x3)**2+(y1-y3)**2)\n\n\t\tc = math.sqrt((x2-x3)**2+(y2-y3)**2)\n\n\t\txa = math.sqrt((x3-xp)**2+(y3-yp)**2)\n\n\t\txb = math.sqrt((x2-xp)**2+(y2-yp)**2)\n\n\t\txc = math.sqrt((x1-xp)**2+(y1-yp)**2)\n\n\t\tif S(a,xb,xc)+S(b,xc,xa)+S(c,xa,xb)-S(a,b,c) > 0.0000001:\n\n\t\t\tprint(\"NO\")\n\n\t\telse:\n\n\t\t\tprint(\"YES\")\n\n\texcept:\n\n\t\tbreak","target":"import math\n\n\n\ndef L(x1,y1,x2,y2):\n\n\treturn math.sqrt((x1-x2)**2+(y1-y2)**2)\n\n\t\n\ndef S(a,b,c):\n\n\ts=(a+b+c)\/2\n\n\treturn math.sqrt(s*(s-a)*(s-b)*(s-c))\n\n\t\n\nwhile True:\n\n try:\n\n x1,y1,x2,y2,x3,y3,xp,yp = list(map(float, input().split()))\n\n a = L(x1,y1,x2,y2)\n\n b = L(x1,y1,x3,y3)\n\n c = L(x2,y2,x3,y3)\n\n pa = L(x3,y3,xp,yp)\n\n pb = L(x2,y2,xp,yp)\n\n pc = L(x1,y1,xp,yp)\n\n if S(a,pb,pc)+S(b,pc,pa)+S(c,pa,pb)-S(a,b,c) > 0.0000001:\n\n print(\"NO\")\n\n else:\n\n print(\"YES\")\n\n except:\n\n break","code_v0_loc":20,"code_v1_loc":24,"code_v0_num_chars":529,"code_v1_num_chars":574,"code_v0_no_empty_lines":"import math\n\n\ndef S(a, b, c):\n s = (a + b + c) \/ 2\n return math.sqrt(s * (s - a) * (s - b) * (s - c))\n\n\nwhile True:\n try:\n x1, y1, x2, y2, x3, y3, xp, yp = list(map(float, input().split()))\n a = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)\n b = math.sqrt((x1 - x3) ** 2 + (y1 - y3) ** 2)\n c = math.sqrt((x2 - x3) ** 2 + (y2 - y3) ** 2)\n xa = math.sqrt((x3 - xp) ** 2 + (y3 - yp) ** 2)\n xb = math.sqrt((x2 - xp) ** 2 + (y2 - yp) ** 2)\n xc = math.sqrt((x1 - xp) ** 2 + (y1 - yp) ** 2)\n if S(a, xb, xc) + S(b, xc, xa) + S(c, xa, xb) - S(a, b, c) > 0.0000001:\n print(\"NO\")\n else:\n print(\"YES\")\n except:\n break\n","code_v1_no_empty_lines":"import math\n\n\ndef L(x1, y1, x2, y2):\n return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)\n\n\ndef S(a, b, c):\n s = (a + b + c) \/ 2\n return math.sqrt(s * (s - a) * (s - b) * (s - c))\n\n\nwhile True:\n try:\n x1, y1, x2, y2, x3, y3, xp, yp = list(map(float, input().split()))\n a = L(x1, y1, x2, y2)\n b = L(x1, y1, x3, y3)\n c = L(x2, y2, x3, y3)\n pa = L(x3, y3, xp, yp)\n pb = L(x2, y2, xp, yp)\n pc = L(x1, y1, xp, yp)\n if S(a, pb, pc) + S(b, pc, pa) + S(c, pa, pb) - S(a, b, c) > 0.0000001:\n print(\"NO\")\n else:\n print(\"YES\")\n except:\n break\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["+","+","+def L(x1, y1, x2, y2):","+ return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)","- a = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)","- b = math.sqrt((x1 - x3) ** 2 + (y1 - y3) ** 2)","- c = math.sqrt((x2 - x3) ** 2 + (y2 - y3) ** 2)","- xa = math.sqrt((x3 - xp) ** 2 + (y3 - yp) ** 2)","- xb = math.sqrt((x2 - xp) ** 2 + (y2 - yp) ** 2)","- xc = math.sqrt((x1 - xp) ** 2 + (y1 - yp) ** 2)","- if S(a, xb, xc) + S(b, xc, xa) + S(c, xa, xb) - S(a, b, c) > 0.0000001:","+ a = L(x1, y1, x2, y2)","+ b = L(x1, y1, x3, y3)","+ c = L(x2, y2, x3, y3)","+ pa = L(x3, y3, xp, yp)","+ pb = L(x2, y2, xp, yp)","+ pc = L(x1, y1, xp, yp)","+ if S(a, pb, pc) + S(b, pc, pa) + S(c, pa, pb) - S(a, b, c) > 0.0000001:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0378039875,"measured_runtime_v1":0.0357831173,"runtime_lift":1.0564755212,"key":["s981947697","s615569987"]} +{"user_id":"u373047809","problem_id":"p02684","language":"python","submission_id_v0":"s368684203","submission_id_v1":"s679615036","cpu_time_v0":1610,"cpu_time_v1":1165,"memory_v0":31800,"memory_v1":31732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.64,"input":"n, k, *a = list(map(int, open(0).read().split()))\n\na = [0] + a\n\np = 1\n\nwhile k:\n\n if k % 2:\n\n p = a[p]\n\n a = [a[b] for b in a]\n\n k \/\/= 2\n\nprint(p)","target":"n,k,*a=list(map(int,open(0).read().split()));a=[0]+a;p=1\n\nwhile k:p=k%2and a[p]or p;a=[a[b]for b in a];k\/\/=2\n\nprint(p)","code_v0_loc":9,"code_v1_loc":3,"code_v0_num_chars":156,"code_v1_num_chars":112,"code_v0_no_empty_lines":"n, k, *a = list(map(int, open(0).read().split()))\na = [0] + a\np = 1\nwhile k:\n if k % 2:\n p = a[p]\n a = [a[b] for b in a]\n k \/\/= 2\nprint(p)\n","code_v1_no_empty_lines":"n, k, *a = list(map(int, open(0).read().split()))\na = [0] + a\np = 1\nwhile k:\n p = k % 2 and a[p] or p\n a = [a[b] for b in a]\n k \/\/= 2\nprint(p)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["- if k % 2:","- p = a[p]","+ p = k % 2 and a[p] or p"],"diff_only_import_comment":false,"measured_runtime_v0":0.0069250724,"measured_runtime_v1":0.0382591943,"runtime_lift":0.1810041366,"key":["s368684203","s679615036"]} +{"user_id":"u167874423","problem_id":"p02658","language":"python","submission_id_v0":"s832928023","submission_id_v1":"s926993016","cpu_time_v0":84,"cpu_time_v1":69,"memory_v0":21788,"memory_v1":21472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.86,"input":"n = int(eval(input()))\n\na = [int(_) for _ in input().split()]\n\na.sort()\n\nans = 1\n\nfor i in a:\n\n if i == 0:\n\n ans = 0\n\n break\n\n ans *= i\n\n if ans > 10**18:\n\n ans = -1\n\n break\n\n \n\nprint(ans)","target":"num = int(eval(input()))\n\nnums = list(map(int,input().split()))\n\nnums.sort()\n\nans = 1\n\nfor i in nums:\n\n if i == 0:\n\n ans = 0\n\n break\n\n ans *= i\n\n if ans > 10 **18:\n\n ans = -1\n\n break\n\nprint(ans)\n","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":219,"code_v1_num_chars":226,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [int(_) for _ in input().split()]\na.sort()\nans = 1\nfor i in a:\n if i == 0:\n ans = 0\n break\n ans *= i\n if ans > 10**18:\n ans = -1\n break\nprint(ans)\n","code_v1_no_empty_lines":"num = int(eval(input()))\nnums = list(map(int, input().split()))\nnums.sort()\nans = 1\nfor i in nums:\n if i == 0:\n ans = 0\n break\n ans *= i\n if ans > 10**18:\n ans = -1\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-n = int(eval(input()))","-a = [int(_) for _ in input().split()]","-a.sort()","+num = int(eval(input()))","+nums = list(map(int, input().split()))","+nums.sort()","-for i in a:","+for i in nums:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0498751702,"measured_runtime_v1":0.0489306462,"runtime_lift":1.0193033224,"key":["s832928023","s926993016"]} +{"user_id":"u119148115","problem_id":"p02554","language":"python","submission_id_v0":"s301433258","submission_id_v1":"s834567829","cpu_time_v0":131,"cpu_time_v1":66,"memory_v0":61788,"memory_v1":61716,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.62,"input":"import sys\n\n\n\nsys.setrecursionlimit(10**7)\n\ndef I(): return int(sys.stdin.readline().rstrip())\n\ndef MI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #\u7a7a\u767d\u3042\u308a\n\ndef LI2(): return list(map(int,sys.stdin.readline().rstrip())) #\u7a7a\u767d\u306a\u3057\n\ndef S(): return sys.stdin.readline().rstrip()\n\ndef LS(): return list(sys.stdin.readline().rstrip().split()) #\u7a7a\u767d\u3042\u308a\n\ndef LS2(): return list(sys.stdin.readline().rstrip()) #\u7a7a\u767d\u306a\u3057\n\n\n\n\n\nN = I()\n\nmod = 10**9+7\n\nprint(((pow(10,N,mod)-2*pow(9,N,mod)+pow(8,N,mod)) % mod))\n","target":"import sys\n\ndef I(): return int(sys.stdin.readline().rstrip())\n\n\n\n\n\nN = I()\n\nmod = 10**9+7\n\nprint(((pow(10,N,mod)-2*pow(9,N,mod)+pow(8,N,mod)) % mod))\n","code_v0_loc":15,"code_v1_loc":7,"code_v0_num_chars":573,"code_v1_num_chars":149,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef I():\n return int(sys.stdin.readline().rstrip())\n\n\ndef MI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().rstrip().split())) # \u7a7a\u767d\u3042\u308a\n\n\ndef LI2():\n return list(map(int, sys.stdin.readline().rstrip())) # \u7a7a\u767d\u306a\u3057\n\n\ndef S():\n return sys.stdin.readline().rstrip()\n\n\ndef LS():\n return list(sys.stdin.readline().rstrip().split()) # \u7a7a\u767d\u3042\u308a\n\n\ndef LS2():\n return list(sys.stdin.readline().rstrip()) # \u7a7a\u767d\u306a\u3057\n\n\nN = I()\nmod = 10**9 + 7\nprint(((pow(10, N, mod) - 2 * pow(9, N, mod) + pow(8, N, mod)) % mod))\n","code_v1_no_empty_lines":"import sys\n\n\ndef I():\n return int(sys.stdin.readline().rstrip())\n\n\nN = I()\nmod = 10**9 + 7\nprint(((pow(10, N, mod) - 2 * pow(9, N, mod) + pow(8, N, mod)) % mod))\n","code_same":false,"relative_loc_diff_percent":53.3333333333,"diff":["-","-sys.setrecursionlimit(10**7)","-def MI():","- return list(map(int, sys.stdin.readline().rstrip().split()))","-","-","-def LI():","- return list(map(int, sys.stdin.readline().rstrip().split())) # \u7a7a\u767d\u3042\u308a","-","-","-def LI2():","- return list(map(int, sys.stdin.readline().rstrip())) # \u7a7a\u767d\u306a\u3057","-","-","-def S():","- return sys.stdin.readline().rstrip()","-","-","-def LS():","- return list(sys.stdin.readline().rstrip().split()) # \u7a7a\u767d\u3042\u308a","-","-","-def LS2():","- return list(sys.stdin.readline().rstrip()) # \u7a7a\u767d\u306a\u3057","-","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363103416,"measured_runtime_v1":0.0368159041,"runtime_lift":0.9862678219,"key":["s301433258","s834567829"]} +{"user_id":"u773077120","problem_id":"p02660","language":"python","submission_id_v0":"s575457058","submission_id_v1":"s751400228","cpu_time_v0":958,"cpu_time_v1":663,"memory_v0":9132,"memory_v1":9080,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.79,"input":"N = int(eval(input()))\n\nn, p, score = N, 2, 0\n\nwhile p ** 2 <= N:\n\n e = 1\n\n while n >= (p ** e) and n % (p ** e) == 0:\n\n n \/\/= (p ** e)\n\n score += 1\n\n e += 1\n\n else:\n\n while n >= p and n % p == 0:\n\n n \/\/= p\n\n p += 1\n\nelse:\n\n if n != 1:\n\n score += 1\n\nprint(score)","target":"N = int(eval(input()))\n\nn, p, score = N, 2, 0\n\nwhile p ** 2 <= N:\n\n e = 1\n\n while n % (p ** e) == 0:\n\n n \/\/= (p ** e)\n\n score += 1\n\n e += 1\n\n else:\n\n while n % p == 0:\n\n n \/\/= p\n\n p += 1\n\nelse:\n\n if n != 1:\n\n score += 1\n\nprint(score)","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":283,"code_v1_num_chars":254,"code_v0_no_empty_lines":"N = int(eval(input()))\nn, p, score = N, 2, 0\nwhile p**2 <= N:\n e = 1\n while n >= (p**e) and n % (p**e) == 0:\n n \/\/= p**e\n score += 1\n e += 1\n else:\n while n >= p and n % p == 0:\n n \/\/= p\n p += 1\nelse:\n if n != 1:\n score += 1\nprint(score)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nn, p, score = N, 2, 0\nwhile p**2 <= N:\n e = 1\n while n % (p**e) == 0:\n n \/\/= p**e\n score += 1\n e += 1\n else:\n while n % p == 0:\n n \/\/= p\n p += 1\nelse:\n if n != 1:\n score += 1\nprint(score)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- while n >= (p**e) and n % (p**e) == 0:","+ while n % (p**e) == 0:","- while n >= p and n % p == 0:","+ while n % p == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2092194857,"measured_runtime_v1":0.2356546949,"runtime_lift":0.887822268,"key":["s575457058","s751400228"]} +{"user_id":"u179169725","problem_id":"p03171","language":"python","submission_id_v0":"s057804926","submission_id_v1":"s598531640","cpu_time_v0":1304,"cpu_time_v1":1205,"memory_v0":181276,"memory_v1":157084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.59,"input":"# https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_l\n\n\n\n'''\n\ndp[i,j] ... deque\u306b[i,j]\u304c\u6b8b\u3063\u3066\u3044\u308b\u3068\u304d\u306b\u884c\u52d5\u3059\u308b\u30d7\u30ec\u30a4\u30e4\u30fc\u306e\u30b9\u30b3\u30a2\u306e\u6700\u5927\n\ndp[i,j] = max(a[i-1]-dp[i-1,j], a[j+1]-dp[i,j+1]) #\u3053\u308c\u3058\u3083greedy\u3068\u540c\u3058\u3058\u3083\u3093\n\n\n\ndp[i,j] ... deque\u306b[i,j)\u304c\u6b8b\u3063\u3066\u3044\u308b\u3068\u304d\u306b\u305d\u306e\u72b6\u614b\u304b\u3089\u30b9\u30bf\u30fc\u30c8\u3059\u308b\u30d7\u30ec\u30a4\u30e4\u30fc\u304c\u9054\u6210\u3067\u304d\u308b\u30b9\u30b3\u30a2\u306e\u6700\u5927 (\u533a\u9593\u3092\u4f38\u3070\u3057\u3066\u3044\u304f\u611f\u3058)\n\n\n\n\u521d\u671f\u5024 dp[i,i]==0\n\n\n\ndp[i,j]=max(a[i]-dp[i+1,j], a[j-1]-dp[i,j-1])\n\n'''\n\nimport sys\n\nsys.setrecursionlimit(1 << 25)\n\nreadline = sys.stdin.buffer.readline\n\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\n\n\n\nimport numpy as np\n\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\n\nzeros = partial(np.zeros, dtype=np.int64)\n\nfull = partial(np.full, dtype=np.int64)\n\n\n\n\n\ndef a_int(): return int(readline())\n\n\n\n\n\ndef ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\n\n\nN = a_int()\n\nA = ints()\n\n\n\n\n\nfrom numba import njit\n\n\n\n\n\n@njit('(i8,i8[:])', cache=True)\n\ndef solve(N, A):\n\n dp = np.zeros((N + 1, N + 1), dtype=np.int64)\n\n for i in range(N - 1, -1, -1):\n\n for j in range(i + 1, N + 1):\n\n dp[i, j] = max(A[i] - dp[i + 1, j], A[j - 1] - dp[i, j - 1])\n\n print((dp[0, N]))\n\n # print(*dp, sep='\\n')\n\n\n\n\n\nsolve(N, A)\n","target":"# https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_l\n\n\n\n'''\n\ndp[i,j] ... deque\u306b[i,j]\u304c\u6b8b\u3063\u3066\u3044\u308b\u3068\u304d\u306b\u884c\u52d5\u3059\u308b\u30d7\u30ec\u30a4\u30e4\u30fc\u306e\u30b9\u30b3\u30a2\u306e\u6700\u5927\n\ndp[i,j] = max(a[i-1]-dp[i-1,j], a[j+1]-dp[i,j+1]) #\u3053\u308c\u3058\u3083greedy\u3068\u540c\u3058\u3058\u3083\u3093\n\n\n\ndp[i,j] ... deque\u306b[i,j)\u304c\u6b8b\u3063\u3066\u3044\u308b\u3068\u304d\u306b\u305d\u306e\u72b6\u614b\u304b\u3089\u30b9\u30bf\u30fc\u30c8\u3059\u308b\u30d7\u30ec\u30a4\u30e4\u30fc\u304c\u9054\u6210\u3067\u304d\u308b\u30b9\u30b3\u30a2\u306e\u6700\u5927 (\u533a\u9593\u3092\u4f38\u3070\u3057\u3066\u3044\u304f\u611f\u3058)\n\n\n\n\u521d\u671f\u5024 dp[i,i]==0\n\n\n\ndp[i,j]=max(a[i]-dp[i+1,j], a[j-1]-dp[i,j-1])\n\n'''\n\nimport sys\n\nsys.setrecursionlimit(1 << 25)\n\nreadline = sys.stdin.buffer.readline\n\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\n\n\n\nimport numpy as np\n\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\n\nzeros = partial(np.zeros, dtype=np.int64)\n\nfull = partial(np.full, dtype=np.int64)\n\n\n\n\n\ndef a_int(): return int(readline())\n\n\n\n\n\ndef ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\n\n\nN = a_int()\n\nA = ints()\n\n\n\ndp = zeros((N + 1, N + 1))\n\n\n\nfrom numba import njit\n\n\n\n\n\n@njit('(i8,i8[:],i8[:,:])', cache=True)\n\ndef solve(N, A, dp):\n\n for i in range(N - 1, -1, -1):\n\n for j in range(i + 1, N + 1):\n\n dp[i, j] = max(A[i] - dp[i + 1, j], A[j - 1] - dp[i, j - 1])\n\n print((dp[0, N]))\n\n # print(*dp, sep='\\n')\n\n\n\n\n\nsolve(N, A, dp)\n","code_v0_loc":52,"code_v1_loc":52,"code_v0_num_chars":1192,"code_v1_num_chars":1185,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_l\n\"\"\"\ndp[i,j] ... deque\u306b[i,j]\u304c\u6b8b\u3063\u3066\u3044\u308b\u3068\u304d\u306b\u884c\u52d5\u3059\u308b\u30d7\u30ec\u30a4\u30e4\u30fc\u306e\u30b9\u30b3\u30a2\u306e\u6700\u5927\ndp[i,j] = max(a[i-1]-dp[i-1,j], a[j+1]-dp[i,j+1]) #\u3053\u308c\u3058\u3083greedy\u3068\u540c\u3058\u3058\u3083\u3093\ndp[i,j] ... deque\u306b[i,j)\u304c\u6b8b\u3063\u3066\u3044\u308b\u3068\u304d\u306b\u305d\u306e\u72b6\u614b\u304b\u3089\u30b9\u30bf\u30fc\u30c8\u3059\u308b\u30d7\u30ec\u30a4\u30e4\u30fc\u304c\u9054\u6210\u3067\u304d\u308b\u30b9\u30b3\u30a2\u306e\u6700\u5927 (\u533a\u9593\u3092\u4f38\u3070\u3057\u3066\u3044\u304f\u611f\u3058)\n\u521d\u671f\u5024 dp[i,i]==0\ndp[i,j]=max(a[i]-dp[i+1,j], a[j-1]-dp[i,j-1])\n\"\"\"\nimport sys\n\nsys.setrecursionlimit(1 << 25)\nreadline = sys.stdin.buffer.readline\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\nimport numpy as np\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\nzeros = partial(np.zeros, dtype=np.int64)\nfull = partial(np.full, dtype=np.int64)\n\n\ndef a_int():\n return int(readline())\n\n\ndef ints():\n return np.fromstring(readline(), sep=\" \", dtype=np.int64)\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nN = a_int()\nA = ints()\nfrom numba import njit\n\n\n@njit(\"(i8,i8[:])\", cache=True)\ndef solve(N, A):\n dp = np.zeros((N + 1, N + 1), dtype=np.int64)\n for i in range(N - 1, -1, -1):\n for j in range(i + 1, N + 1):\n dp[i, j] = max(A[i] - dp[i + 1, j], A[j - 1] - dp[i, j - 1])\n print((dp[0, N]))\n # print(*dp, sep='\\n')\n\n\nsolve(N, A)\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_l\n\"\"\"\ndp[i,j] ... deque\u306b[i,j]\u304c\u6b8b\u3063\u3066\u3044\u308b\u3068\u304d\u306b\u884c\u52d5\u3059\u308b\u30d7\u30ec\u30a4\u30e4\u30fc\u306e\u30b9\u30b3\u30a2\u306e\u6700\u5927\ndp[i,j] = max(a[i-1]-dp[i-1,j], a[j+1]-dp[i,j+1]) #\u3053\u308c\u3058\u3083greedy\u3068\u540c\u3058\u3058\u3083\u3093\ndp[i,j] ... deque\u306b[i,j)\u304c\u6b8b\u3063\u3066\u3044\u308b\u3068\u304d\u306b\u305d\u306e\u72b6\u614b\u304b\u3089\u30b9\u30bf\u30fc\u30c8\u3059\u308b\u30d7\u30ec\u30a4\u30e4\u30fc\u304c\u9054\u6210\u3067\u304d\u308b\u30b9\u30b3\u30a2\u306e\u6700\u5927 (\u533a\u9593\u3092\u4f38\u3070\u3057\u3066\u3044\u304f\u611f\u3058)\n\u521d\u671f\u5024 dp[i,i]==0\ndp[i,j]=max(a[i]-dp[i+1,j], a[j-1]-dp[i,j-1])\n\"\"\"\nimport sys\n\nsys.setrecursionlimit(1 << 25)\nreadline = sys.stdin.buffer.readline\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\nimport numpy as np\nfrom functools import partial\n\narray = partial(np.array, dtype=np.int64)\nzeros = partial(np.zeros, dtype=np.int64)\nfull = partial(np.full, dtype=np.int64)\n\n\ndef a_int():\n return int(readline())\n\n\ndef ints():\n return np.fromstring(readline(), sep=\" \", dtype=np.int64)\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nN = a_int()\nA = ints()\ndp = zeros((N + 1, N + 1))\nfrom numba import njit\n\n\n@njit(\"(i8,i8[:],i8[:,:])\", cache=True)\ndef solve(N, A, dp):\n for i in range(N - 1, -1, -1):\n for j in range(i + 1, N + 1):\n dp[i, j] = max(A[i] - dp[i + 1, j], A[j - 1] - dp[i, j - 1])\n print((dp[0, N]))\n # print(*dp, sep='\\n')\n\n\nsolve(N, A, dp)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+dp = zeros((N + 1, N + 1))","-@njit(\"(i8,i8[:])\", cache=True)","-def solve(N, A):","- dp = np.zeros((N + 1, N + 1), dtype=np.int64)","+@njit(\"(i8,i8[:],i8[:,:])\", cache=True)","+def solve(N, A, dp):","-solve(N, A)","+solve(N, A, dp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.5688530742,"measured_runtime_v1":0.5099231473,"runtime_lift":1.1155662912,"key":["s057804926","s598531640"]} +{"user_id":"u906501980","problem_id":"p02689","language":"python","submission_id_v0":"s318405410","submission_id_v1":"s434412557","cpu_time_v0":394,"cpu_time_v1":256,"memory_v0":24616,"memory_v1":84828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.03,"input":"from heapq import heapify, heappush, heappop\n\nfrom heapq import _heapify_max, _heappop_max\n\nimport heapq\n\n\n\ndef _heappush_max(heap, item):\n\n heap.append(item)\n\n heapq._siftdown_max(heap, 0, len(heap)-1)\n\n\n\n\"\"\"\n\nmethod:\n\n heapify(x): \u30d2\u30fc\u30d7\u306b\u5909\u63db\n\n heappush(heap, item): item\u3092heap\u306bpush\n\n heappop(heap): heap\u304b\u3089\u6700\u5c0f\u5024\u3092\u53d6\u5f97 \u7a7a\u306e\u5834\u5408\u306fIndexError\n\nnote:\n\n max heap\u306b\u3059\u308b\u5834\u5408\u306f\u3001prefix: _ \u3068suffix: _max\u3092\u3064\u3051\u308c\u3070\u826f\u3044\n\n\"\"\"\n\ndef main():\n\n n, m = list(map(int, input().split()))\n\n h = [0] + list(map(int, input().split()))\n\n ans = [[] for _ in range(n+1)]\n\n for _ in range(m):\n\n a, b = list(map(int, input().split()))\n\n _heappush_max(ans[a], h[b])\n\n _heappush_max(ans[b], h[a])\n\n out = 0\n\n for ai, hi in zip(ans[1:], h[1:]):\n\n if (not ai) or hi > _heappop_max(ai):\n\n out += 1\n\n print(out)\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"def main():\n\n n, m = list(map(int, input().split()))\n\n h = list(map(int, input().split()))\n\n to = [0]*(n+1)\n\n ans = 0\n\n for _ in range(m):\n\n a, b = list(map(int, input().split()))\n\n to[a] = max(to[a], h[b-1])\n\n to[b] = max(to[b], h[a-1])\n\n for i, hi in enumerate(h, 1):\n\n t = to[i]\n\n if t == 0 or hi > t:\n\n ans += 1\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":32,"code_v1_loc":17,"code_v0_num_chars":857,"code_v1_num_chars":425,"code_v0_no_empty_lines":"from heapq import heapify, heappush, heappop\nfrom heapq import _heapify_max, _heappop_max\nimport heapq\n\n\ndef _heappush_max(heap, item):\n heap.append(item)\n heapq._siftdown_max(heap, 0, len(heap) - 1)\n\n\n\"\"\"\nmethod:\n heapify(x): \u30d2\u30fc\u30d7\u306b\u5909\u63db\n heappush(heap, item): item\u3092heap\u306bpush\n heappop(heap): heap\u304b\u3089\u6700\u5c0f\u5024\u3092\u53d6\u5f97 \u7a7a\u306e\u5834\u5408\u306fIndexError\nnote:\n max heap\u306b\u3059\u308b\u5834\u5408\u306f\u3001prefix: _ \u3068suffix: _max\u3092\u3064\u3051\u308c\u3070\u826f\u3044\n\"\"\"\n\n\ndef main():\n n, m = list(map(int, input().split()))\n h = [0] + list(map(int, input().split()))\n ans = [[] for _ in range(n + 1)]\n for _ in range(m):\n a, b = list(map(int, input().split()))\n _heappush_max(ans[a], h[b])\n _heappush_max(ans[b], h[a])\n out = 0\n for ai, hi in zip(ans[1:], h[1:]):\n if (not ai) or hi > _heappop_max(ai):\n out += 1\n print(out)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n, m = list(map(int, input().split()))\n h = list(map(int, input().split()))\n to = [0] * (n + 1)\n ans = 0\n for _ in range(m):\n a, b = list(map(int, input().split()))\n to[a] = max(to[a], h[b - 1])\n to[b] = max(to[b], h[a - 1])\n for i, hi in enumerate(h, 1):\n t = to[i]\n if t == 0 or hi > t:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":46.875,"diff":["-from heapq import heapify, heappush, heappop","-from heapq import _heapify_max, _heappop_max","-import heapq","-","-","-def _heappush_max(heap, item):","- heap.append(item)","- heapq._siftdown_max(heap, 0, len(heap) - 1)","-","-","-\"\"\"","-method:","- heapify(x): \u30d2\u30fc\u30d7\u306b\u5909\u63db","- heappush(heap, item): item\u3092heap\u306bpush","- heappop(heap): heap\u304b\u3089\u6700\u5c0f\u5024\u3092\u53d6\u5f97 \u7a7a\u306e\u5834\u5408\u306fIndexError","-note:","- max heap\u306b\u3059\u308b\u5834\u5408\u306f\u3001prefix: _ \u3068suffix: _max\u3092\u3064\u3051\u308c\u3070\u826f\u3044","-\"\"\"","-","-","- h = [0] + list(map(int, input().split()))","- ans = [[] for _ in range(n + 1)]","+ h = list(map(int, input().split()))","+ to = [0] * (n + 1)","+ ans = 0","- _heappush_max(ans[a], h[b])","- _heappush_max(ans[b], h[a])","- out = 0","- for ai, hi in zip(ans[1:], h[1:]):","- if (not ai) or hi > _heappop_max(ai):","- out += 1","- print(out)","+ to[a] = max(to[a], h[b - 1])","+ to[b] = max(to[b], h[a - 1])","+ for i, hi in enumerate(h, 1):","+ t = to[i]","+ if t == 0 or hi > t:","+ ans += 1","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0424502552,"measured_runtime_v1":0.042726051,"runtime_lift":0.9935450185,"key":["s318405410","s434412557"]} +{"user_id":"u506422818","problem_id":"p02578","language":"python","submission_id_v0":"s057905801","submission_id_v1":"s030440115","cpu_time_v0":162,"cpu_time_v1":148,"memory_v0":32128,"memory_v1":31972,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.64,"input":"n = int(eval(input()))\n\ntotal = 0\n\nh = list(map(int, input().split(\" \")))\n\nfor i in range(1, n):\n\n if h[i] < h[i - 1]:\n\n total += abs(h[i] - h[i-1])\n\n h[i] = h[i - 1]\n\n\n\nprint(total)","target":"n = int(eval(input()))\n\na = list(map(int,input().split(\" \")))\n\nanswer = 0\n\nfor i in range(1,n):\n\n if a[i] < a[i - 1]:\n\n answer += a[i-1] - a[i]\n\n a[i]= a[i - 1]\n\n\n\nprint(answer)","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":193,"code_v1_num_chars":188,"code_v0_no_empty_lines":"n = int(eval(input()))\ntotal = 0\nh = list(map(int, input().split(\" \")))\nfor i in range(1, n):\n if h[i] < h[i - 1]:\n total += abs(h[i] - h[i - 1])\n h[i] = h[i - 1]\nprint(total)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split(\" \")))\nanswer = 0\nfor i in range(1, n):\n if a[i] < a[i - 1]:\n answer += a[i - 1] - a[i]\n a[i] = a[i - 1]\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-total = 0","-h = list(map(int, input().split(\" \")))","+a = list(map(int, input().split(\" \")))","+answer = 0","- if h[i] < h[i - 1]:","- total += abs(h[i] - h[i - 1])","- h[i] = h[i - 1]","-print(total)","+ if a[i] < a[i - 1]:","+ answer += a[i - 1] - a[i]","+ a[i] = a[i - 1]","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0465328413,"measured_runtime_v1":0.0371325196,"runtime_lift":1.2531560401,"key":["s057905801","s030440115"]} +{"user_id":"u476604182","problem_id":"p03003","language":"python","submission_id_v0":"s774493454","submission_id_v1":"s789370724","cpu_time_v0":403,"cpu_time_v1":290,"memory_v0":104924,"memory_v1":43444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.04,"input":"N, M = list(map(int, input().split()))\n\ns = [int(c) for c in input().split()]\n\nt = [int(c) for c in input().split()]\n\nMOD = 10**9+7\n\n\n\ndp = [[0]*(M+1) for i in range(N+1)]\n\ndp_cum = [[0]*(M+1) for i in range(N+1)]\n\n\n\ndp[0][0] = 1\n\nfor i in range(N+1):\n\n dp_cum[i][0] = 1\n\nfor j in range(M+1):\n\n dp_cum[0][j] = 1\n\n \n\nfor i in range(N):\n\n for j in range(M):\n\n if s[i]!=t[j]:\n\n dp[i+1][j+1] = 0\n\n else:\n\n dp[i+1][j+1] = dp_cum[i][j]\n\n dp_cum[i+1][j+1] = dp_cum[i][j+1] + dp_cum[i+1][j] - dp_cum[i][j] + dp[i+1][j+1]\n\n dp_cum[i+1][j+1] %= MOD\n\n\n\nprint((dp_cum[-1][-1]))","target":"import numpy as np\n\nMOD = 10**9+7\n\nN, M = list(map(int, input().split()))\n\ns = np.array(input().split(), dtype=np.int32)\n\nt = np.array(input().split(), dtype=np.int32)\n\n\n\ndp = np.zeros((N+1,M+1), dtype=np.int64)\n\ndp[0] = 1\n\n\n\nfor i in range(N):\n\n same = (s[i]==t)\n\n dp[i+1,1:][same] = dp[i,:-1][same]\n\n dp[i+1] = (dp[i+1].cumsum()+dp[i])%MOD\n\n\n\nprint((dp[-1,-1]))\n","code_v0_loc":24,"code_v1_loc":15,"code_v0_num_chars":583,"code_v1_num_chars":359,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\ns = [int(c) for c in input().split()]\nt = [int(c) for c in input().split()]\nMOD = 10**9 + 7\ndp = [[0] * (M + 1) for i in range(N + 1)]\ndp_cum = [[0] * (M + 1) for i in range(N + 1)]\ndp[0][0] = 1\nfor i in range(N + 1):\n dp_cum[i][0] = 1\nfor j in range(M + 1):\n dp_cum[0][j] = 1\nfor i in range(N):\n for j in range(M):\n if s[i] != t[j]:\n dp[i + 1][j + 1] = 0\n else:\n dp[i + 1][j + 1] = dp_cum[i][j]\n dp_cum[i + 1][j + 1] = (\n dp_cum[i][j + 1] + dp_cum[i + 1][j] - dp_cum[i][j] + dp[i + 1][j + 1]\n )\n dp_cum[i + 1][j + 1] %= MOD\nprint((dp_cum[-1][-1]))\n","code_v1_no_empty_lines":"import numpy as np\n\nMOD = 10**9 + 7\nN, M = list(map(int, input().split()))\ns = np.array(input().split(), dtype=np.int32)\nt = np.array(input().split(), dtype=np.int32)\ndp = np.zeros((N + 1, M + 1), dtype=np.int64)\ndp[0] = 1\nfor i in range(N):\n same = s[i] == t\n dp[i + 1, 1:][same] = dp[i, :-1][same]\n dp[i + 1] = (dp[i + 1].cumsum() + dp[i]) % MOD\nprint((dp[-1, -1]))\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["+import numpy as np","+","+MOD = 10**9 + 7","-s = [int(c) for c in input().split()]","-t = [int(c) for c in input().split()]","-MOD = 10**9 + 7","-dp = [[0] * (M + 1) for i in range(N + 1)]","-dp_cum = [[0] * (M + 1) for i in range(N + 1)]","-dp[0][0] = 1","-for i in range(N + 1):","- dp_cum[i][0] = 1","-for j in range(M + 1):","- dp_cum[0][j] = 1","+s = np.array(input().split(), dtype=np.int32)","+t = np.array(input().split(), dtype=np.int32)","+dp = np.zeros((N + 1, M + 1), dtype=np.int64)","+dp[0] = 1","- for j in range(M):","- if s[i] != t[j]:","- dp[i + 1][j + 1] = 0","- else:","- dp[i + 1][j + 1] = dp_cum[i][j]","- dp_cum[i + 1][j + 1] = (","- dp_cum[i][j + 1] + dp_cum[i + 1][j] - dp_cum[i][j] + dp[i + 1][j + 1]","- )","- dp_cum[i + 1][j + 1] %= MOD","-print((dp_cum[-1][-1]))","+ same = s[i] == t","+ dp[i + 1, 1:][same] = dp[i, :-1][same]","+ dp[i + 1] = (dp[i + 1].cumsum() + dp[i]) % MOD","+print((dp[-1, -1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422043649,"measured_runtime_v1":0.3205161736,"runtime_lift":0.131676241,"key":["s774493454","s789370724"]} +{"user_id":"u127499732","problem_id":"p02574","language":"python","submission_id_v0":"s557526452","submission_id_v1":"s880417157","cpu_time_v0":817,"cpu_time_v1":536,"memory_v0":223496,"memory_v1":228136,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.39,"input":"def main():\n\n n, *a, = list(map(int, open(0).read().split()))\n\n m = max(a)\n\n\n\n d = [0] * (m + 1)\n\n d[1] = 1\n\n for i in range(2, m + 1):\n\n for j in range(i, m + 1, i):\n\n if d[j] == 0:\n\n d[j] = i\n\n\n\n def primes(x):\n\n ps = set()\n\n while x != 1:\n\n p = d[x]\n\n ps.add(p)\n\n x = x \/\/ d[x]\n\n return ps\n\n\n\n b = set()\n\n c = primes(a[0])\n\n f = 0\n\n for i in a:\n\n ps = primes(i)\n\n if f == 0:\n\n if b & ps:\n\n f = 1\n\n b |= ps\n\n c &= ps\n\n else:\n\n if f == 1 and len(c) > 0:\n\n f = 2\n\n \n\n ans = [\"pairwise coprime\", \"setwise coprime\", \"not coprime\"][f]\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"from functools import reduce\ndef main():\n\n from math import gcd\n\n from functools import reduce\n\n n, *a, = list(map(int, open(0).read().split()))\n\n m = max(a)\n\n\n\n d = [0] * (m + 1)\n\n d[1] = 1\n\n for i in range(2, m + 1):\n\n for j in range(i, m + 1, i):\n\n if d[j] == 0:\n\n d[j] = i\n\n\n\n def primes(x):\n\n ps = set()\n\n while x != 1:\n\n p = d[x]\n\n ps.add(p)\n\n x = x \/\/ d[x]\n\n return ps\n\n\n\n b = set()\n\n f = 0\n\n for i in a:\n\n ps = primes(i)\n\n if b & ps:\n\n f = 1\n\n break\n\n b |= ps\n\n if f > 0 and reduce(gcd, a) != 1:\n\n f = 2\n\n\n\n ans = [\"pairwise coprime\", \"setwise coprime\", \"not coprime\"][f]\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":39,"code_v1_loc":38,"code_v0_num_chars":788,"code_v1_num_chars":781,"code_v0_no_empty_lines":"def main():\n (\n n,\n *a,\n ) = list(map(int, open(0).read().split()))\n m = max(a)\n d = [0] * (m + 1)\n d[1] = 1\n for i in range(2, m + 1):\n for j in range(i, m + 1, i):\n if d[j] == 0:\n d[j] = i\n\n def primes(x):\n ps = set()\n while x != 1:\n p = d[x]\n ps.add(p)\n x = x \/\/ d[x]\n return ps\n\n b = set()\n c = primes(a[0])\n f = 0\n for i in a:\n ps = primes(i)\n if f == 0:\n if b & ps:\n f = 1\n b |= ps\n c &= ps\n else:\n if f == 1 and len(c) > 0:\n f = 2\n ans = [\"pairwise coprime\", \"setwise coprime\", \"not coprime\"][f]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from functools import reduce\n\n\ndef main():\n from math import gcd\n from functools import reduce\n\n (\n n,\n *a,\n ) = list(map(int, open(0).read().split()))\n m = max(a)\n d = [0] * (m + 1)\n d[1] = 1\n for i in range(2, m + 1):\n for j in range(i, m + 1, i):\n if d[j] == 0:\n d[j] = i\n\n def primes(x):\n ps = set()\n while x != 1:\n p = d[x]\n ps.add(p)\n x = x \/\/ d[x]\n return ps\n\n b = set()\n f = 0\n for i in a:\n ps = primes(i)\n if b & ps:\n f = 1\n break\n b |= ps\n if f > 0 and reduce(gcd, a) != 1:\n f = 2\n ans = [\"pairwise coprime\", \"setwise coprime\", \"not coprime\"][f]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.5641025641,"diff":["+from functools import reduce","+","+","+ from math import gcd","+ from functools import reduce","+","- c = primes(a[0])","- if f == 0:","- if b & ps:","- f = 1","- b |= ps","- c &= ps","- else:","- if f == 1 and len(c) > 0:","- f = 2","+ if b & ps:","+ f = 1","+ break","+ b |= ps","+ if f > 0 and reduce(gcd, a) != 1:","+ f = 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0406834385,"measured_runtime_v1":0.0463623168,"runtime_lift":0.8775109032,"key":["s557526452","s880417157"]} +{"user_id":"u606045429","problem_id":"p03132","language":"python","submission_id_v0":"s473631075","submission_id_v1":"s082851297","cpu_time_v0":265,"cpu_time_v1":163,"memory_v0":11036,"memory_v1":11036,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.49,"input":"L, *A = list(map(int, open(0)))\n\n\n\nD = [(2, 1), (1, 0), (0, 1)]\n\n\n\ns0 = s1 = s2 = s3 = s4 = 0\n\n\n\nfor a in A:\n\n e, o = D[(a - 1) % 2 + 1 if a else 0]\n\n\n\n s0 += a\n\n s1 = s0 if s0 < s1 + e else s1 + e\n\n s2 = s1 if s1 < s2 + o else s2 + o\n\n s3 = s2 if s2 < s3 + e else s3 + e\n\n s4 = s3 if s3 < s4 + a else s4 + a\n\n\n\nprint((min(s0, s1, s2, s3, s4)))\n","target":"def main():\n\n L, *A = list(map(int, open(0)))\n\n\n\n D = [(2, 1), (1, 0), (0, 1)]\n\n\n\n s0 = s1 = s2 = s3 = s4 = 0\n\n\n\n for a in A:\n\n e, o = D[(a - 1) % 2 + 1 if a else 0]\n\n\n\n s0 += a\n\n s1 = s0 if s0 < s1 + e else s1 + e\n\n s2 = s1 if s1 < s2 + o else s2 + o\n\n s3 = s2 if s2 < s3 + e else s3 + e\n\n s4 = s3 if s3 < s4 + a else s4 + a\n\n\n\n print((min(s0, s1, s2, s3, s4)))\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":16,"code_v1_loc":20,"code_v0_num_chars":355,"code_v1_num_chars":454,"code_v0_no_empty_lines":"L, *A = list(map(int, open(0)))\nD = [(2, 1), (1, 0), (0, 1)]\ns0 = s1 = s2 = s3 = s4 = 0\nfor a in A:\n e, o = D[(a - 1) % 2 + 1 if a else 0]\n s0 += a\n s1 = s0 if s0 < s1 + e else s1 + e\n s2 = s1 if s1 < s2 + o else s2 + o\n s3 = s2 if s2 < s3 + e else s3 + e\n s4 = s3 if s3 < s4 + a else s4 + a\nprint((min(s0, s1, s2, s3, s4)))\n","code_v1_no_empty_lines":"def main():\n L, *A = list(map(int, open(0)))\n D = [(2, 1), (1, 0), (0, 1)]\n s0 = s1 = s2 = s3 = s4 = 0\n for a in A:\n e, o = D[(a - 1) % 2 + 1 if a else 0]\n s0 += a\n s1 = s0 if s0 < s1 + e else s1 + e\n s2 = s1 if s1 < s2 + o else s2 + o\n s3 = s2 if s2 < s3 + e else s3 + e\n s4 = s3 if s3 < s4 + a else s4 + a\n print((min(s0, s1, s2, s3, s4)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-L, *A = list(map(int, open(0)))","-D = [(2, 1), (1, 0), (0, 1)]","-s0 = s1 = s2 = s3 = s4 = 0","-for a in A:","- e, o = D[(a - 1) % 2 + 1 if a else 0]","- s0 += a","- s1 = s0 if s0 < s1 + e else s1 + e","- s2 = s1 if s1 < s2 + o else s2 + o","- s3 = s2 if s2 < s3 + e else s3 + e","- s4 = s3 if s3 < s4 + a else s4 + a","-print((min(s0, s1, s2, s3, s4)))","+def main():","+ L, *A = list(map(int, open(0)))","+ D = [(2, 1), (1, 0), (0, 1)]","+ s0 = s1 = s2 = s3 = s4 = 0","+ for a in A:","+ e, o = D[(a - 1) % 2 + 1 if a else 0]","+ s0 += a","+ s1 = s0 if s0 < s1 + e else s1 + e","+ s2 = s1 if s1 < s2 + o else s2 + o","+ s3 = s2 if s2 < s3 + e else s3 + e","+ s4 = s3 if s3 < s4 + a else s4 + a","+ print((min(s0, s1, s2, s3, s4)))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0351714087,"measured_runtime_v1":0.0391056254,"runtime_lift":0.8993951201,"key":["s473631075","s082851297"]} +{"user_id":"u985076807","problem_id":"p03400","language":"python","submission_id_v0":"s459470242","submission_id_v1":"s797515832","cpu_time_v0":42,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.52,"input":"# -*-*-*- coding: utf-8 -*-*-*-\n\nmember = int(eval(input()))\n\ndays, choco = list(map(int, input().split()))\n\nans = choco\n\n\n\nfor i in range(member):\n\n num = int(eval(input()))\n\n if days % num == 0:\n\n ans -= 1\n\n ans += days \/\/ num + 1\n\n# print(i, 'day : eat = {} \/\/ {} = {:2}, ans = {:2}'.format(days, num, (days \/\/ num + 1), ans))\n\n\n\nprint(ans)\n","target":"# -*-*-*- coding: utf-8 -*-*-*-\n\nmember = int(eval(input()))\n\ndays, choco = list(map(int, input().split()))\n\nans = choco\n\n \n\nfor i in range(member):\n\n num = int(eval(input()))\n\n ans += (days - 1) \/\/ num + 1\n\n# print(i, 'day : eat = {} \/\/ {} = {:2}, ans = {:2}'.format(days, num, (days \/\/ num + 1), ans))\n\n \n\nprint(ans)","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":345,"code_v1_num_chars":309,"code_v0_no_empty_lines":"# -*-*-*- coding: utf-8 -*-*-*-\nmember = int(eval(input()))\ndays, choco = list(map(int, input().split()))\nans = choco\nfor i in range(member):\n num = int(eval(input()))\n if days % num == 0:\n ans -= 1\n ans += days \/\/ num + 1\n# print(i, 'day : eat = {} \/\/ {} = {:2}, ans = {:2}'.format(days, num, (days \/\/ num + 1), ans))\nprint(ans)\n","code_v1_no_empty_lines":"# -*-*-*- coding: utf-8 -*-*-*-\nmember = int(eval(input()))\ndays, choco = list(map(int, input().split()))\nans = choco\nfor i in range(member):\n num = int(eval(input()))\n ans += (days - 1) \/\/ num + 1\n# print(i, 'day : eat = {} \/\/ {} = {:2}, ans = {:2}'.format(days, num, (days \/\/ num + 1), ans))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["- if days % num == 0:","- ans -= 1","- ans += days \/\/ num + 1","+ ans += (days - 1) \/\/ num + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0389322917,"measured_runtime_v1":0.0439726675,"runtime_lift":0.8853748019,"key":["s459470242","s797515832"]} +{"user_id":"u340781749","problem_id":"p02644","language":"python","submission_id_v0":"s105728118","submission_id_v1":"s004190869","cpu_time_v0":2837,"cpu_time_v1":2566,"memory_v0":444872,"memory_v1":294956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.55,"input":"from heapq import heappop, heappush\n\n\n\n\n\ndef solve(field, s, t, k):\n\n INF = 10 ** 18\n\n ans = [[INF, INF] for _ in field]\n\n ans[s][0] = ans[s][1] = 0\n\n MOVE = [(-w2, 0), (-1, 1), (1, 1), (w2, 0)]\n\n\n\n q = [(0, s, 0)]\n\n while q:\n\n cost, v, direction = heappop(q)\n\n if v == t:\n\n return (cost - 1) \/\/ k + 1\n\n\n\n ceiling = ((cost - 1) \/\/ k + 1) * k + 1\n\n for di, ax in MOVE:\n\n u = v + di\n\n if field[u] == '@':\n\n continue\n\n nc = cost + 1 if di == direction else ceiling\n\n if ans[u][ax] <= nc:\n\n continue\n\n ans[u][ax] = nc\n\n heappush(q, (nc, u, di))\n\n\n\n return -1\n\n\n\n\n\nh, w, k = list(map(int, input().split()))\n\nx1, y1, x2, y2 = list(map(int, input().split()))\n\nh2 = h + 2\n\nw2 = w + 2\n\n\n\nfield_tmp = [eval(input()) for _ in range(h)]\n\nfield = ['@' * w2]\n\nfor row in field_tmp:\n\n field.append('@')\n\n field.append(row)\n\n field.append('@')\n\nfield.append('@' * w2)\n\nfield = ''.join(field)\n\ns = x1 * w2 + y1\n\nt = x2 * w2 + y2\n\nprint((solve(field, s, t, k)))\n","target":"from heapq import heappop, heappush\n\n\n\n\n\ndef solve(field, s, t, k):\n\n INF = 10 ** 18\n\n ans = [[INF, INF] for _ in field]\n\n ans[s][0] = ans[s][1] = 0\n\n MOVE = [(-w2, 0), (-1, 1), (1, 1), (w2, 0)]\n\n\n\n q = [(0, s, 0)]\n\n while q:\n\n cost, v, direction = heappop(q)\n\n if v == t:\n\n return (cost - 1) \/\/ k + 1\n\n\n\n ceiling = -1\n\n for di, ax in MOVE:\n\n u = v + di\n\n if field[u] == '@':\n\n continue\n\n nc = cost + 1 if di == direction else ceiling\n\n if nc == -1:\n\n nc = ceiling = ((cost - 1) \/\/ k + 1) * k + 1\n\n if ans[u][ax] <= nc:\n\n continue\n\n ans[u][ax] = nc\n\n heappush(q, (nc, u, di))\n\n\n\n return -1\n\n\n\n\n\nh, w, k = list(map(int, input().split()))\n\nx1, y1, x2, y2 = list(map(int, input().split()))\n\nh2 = h + 2\n\nw2 = w + 2\n\n\n\nfield_tmp = [eval(input()) for _ in range(h)]\n\nfield = ['@' * w2]\n\nfor row in field_tmp:\n\n field.append('@')\n\n field.append(row)\n\n field.append('@')\n\nfield.append('@' * w2)\n\nfield = ''.join(field)\n\ns = x1 * w2 + y1\n\nt = x2 * w2 + y2\n\nprint((solve(field, s, t, k)))\n","code_v0_loc":45,"code_v1_loc":47,"code_v0_num_chars":1089,"code_v1_num_chars":1150,"code_v0_no_empty_lines":"from heapq import heappop, heappush\n\n\ndef solve(field, s, t, k):\n INF = 10**18\n ans = [[INF, INF] for _ in field]\n ans[s][0] = ans[s][1] = 0\n MOVE = [(-w2, 0), (-1, 1), (1, 1), (w2, 0)]\n q = [(0, s, 0)]\n while q:\n cost, v, direction = heappop(q)\n if v == t:\n return (cost - 1) \/\/ k + 1\n ceiling = ((cost - 1) \/\/ k + 1) * k + 1\n for di, ax in MOVE:\n u = v + di\n if field[u] == \"@\":\n continue\n nc = cost + 1 if di == direction else ceiling\n if ans[u][ax] <= nc:\n continue\n ans[u][ax] = nc\n heappush(q, (nc, u, di))\n return -1\n\n\nh, w, k = list(map(int, input().split()))\nx1, y1, x2, y2 = list(map(int, input().split()))\nh2 = h + 2\nw2 = w + 2\nfield_tmp = [eval(input()) for _ in range(h)]\nfield = [\"@\" * w2]\nfor row in field_tmp:\n field.append(\"@\")\n field.append(row)\n field.append(\"@\")\nfield.append(\"@\" * w2)\nfield = \"\".join(field)\ns = x1 * w2 + y1\nt = x2 * w2 + y2\nprint((solve(field, s, t, k)))\n","code_v1_no_empty_lines":"from heapq import heappop, heappush\n\n\ndef solve(field, s, t, k):\n INF = 10**18\n ans = [[INF, INF] for _ in field]\n ans[s][0] = ans[s][1] = 0\n MOVE = [(-w2, 0), (-1, 1), (1, 1), (w2, 0)]\n q = [(0, s, 0)]\n while q:\n cost, v, direction = heappop(q)\n if v == t:\n return (cost - 1) \/\/ k + 1\n ceiling = -1\n for di, ax in MOVE:\n u = v + di\n if field[u] == \"@\":\n continue\n nc = cost + 1 if di == direction else ceiling\n if nc == -1:\n nc = ceiling = ((cost - 1) \/\/ k + 1) * k + 1\n if ans[u][ax] <= nc:\n continue\n ans[u][ax] = nc\n heappush(q, (nc, u, di))\n return -1\n\n\nh, w, k = list(map(int, input().split()))\nx1, y1, x2, y2 = list(map(int, input().split()))\nh2 = h + 2\nw2 = w + 2\nfield_tmp = [eval(input()) for _ in range(h)]\nfield = [\"@\" * w2]\nfor row in field_tmp:\n field.append(\"@\")\n field.append(row)\n field.append(\"@\")\nfield.append(\"@\" * w2)\nfield = \"\".join(field)\ns = x1 * w2 + y1\nt = x2 * w2 + y2\nprint((solve(field, s, t, k)))\n","code_same":false,"relative_loc_diff_percent":4.2553191489,"diff":["- ceiling = ((cost - 1) \/\/ k + 1) * k + 1","+ ceiling = -1","+ if nc == -1:","+ nc = ceiling = ((cost - 1) \/\/ k + 1) * k + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0474148536,"measured_runtime_v1":0.0080535002,"runtime_lift":5.8874840108,"key":["s105728118","s004190869"]} +{"user_id":"u968166680","problem_id":"p03476","language":"python","submission_id_v0":"s484134821","submission_id_v1":"s973161846","cpu_time_v0":158,"cpu_time_v1":133,"memory_v0":29012,"memory_v1":29012,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.82,"input":"from sys import stdin, setrecursionlimit\n\nfrom itertools import accumulate\n\n\n\nsetrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef input():\n\n return stdin.readline().strip()\n\n\n\n\n\ndef prime_numbers(n):\n\n if n < 2:\n\n return []\n\n\n\n m = (n + 1) \/\/ 2\n\n p = [True] * m\n\n for i in range(1, int((n ** 0.5 - 1) \/ 2) + 1):\n\n if p[i]:\n\n for j in range(2 * i * (i + 1), m, 2 * i + 1):\n\n p[j] = False\n\n\n\n return {2} | {2 * i + 1 for i in range(1, m) if p[i]}\n\n\n\n\n\nN = 10 ** 5\n\nprimes = prime_numbers(N)\n\na = [1 if n in primes and (n + 1) \/\/ 2 in primes else 0 for n in range(N + 1)]\n\na = list(accumulate(a))\n\n\n\nans = []\n\nQ, *LR = map(int, open(0).read().split())\n\nfor l, r in zip(*[iter(LR)] * 2):\n\n ans.append(a[r] - a[l - 1])\n\n\n\nprint(*ans, sep='\\n')\n","target":"from sys import stdin, setrecursionlimit\n\nfrom itertools import accumulate\n\n\n\nsetrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef input():\n\n return stdin.readline().strip()\n\n\n\n\n\ndef prime_numbers(n):\n\n if n < 2:\n\n return []\n\n\n\n m = (n + 1) \/\/ 2\n\n p = [True] * m\n\n for i in range(1, int((n ** 0.5 - 1) \/ 2) + 1):\n\n if p[i]:\n\n for j in range(2 * i * (i + 1), m, 2 * i + 1):\n\n p[j] = False\n\n\n\n return {2} | {2 * i + 1 for i in range(1, m) if p[i]}\n\n\n\n\n\nN = 10 ** 5\n\nprimes = prime_numbers(N)\n\na = [1 if n in primes and (n + 1) \/\/ 2 in primes else 0 for n in range(N + 1)]\n\na = list(accumulate(a))\n\n\n\nans = []\n\nQ, *LR = list(map(int, open(0).read().split()))\n\nfor l, r in zip(*[iter(LR)] * 2):\n\n ans.append(a[r] - a[l - 1])\n\n\n\nprint(('\\n'.join(map(str, ans))))\n","code_v0_loc":36,"code_v1_loc":36,"code_v0_num_chars":799,"code_v1_num_chars":809,"code_v0_no_empty_lines":"from sys import stdin, setrecursionlimit\nfrom itertools import accumulate\n\nsetrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef input():\n return stdin.readline().strip()\n\n\ndef prime_numbers(n):\n if n < 2:\n return []\n m = (n + 1) \/\/ 2\n p = [True] * m\n for i in range(1, int((n**0.5 - 1) \/ 2) + 1):\n if p[i]:\n for j in range(2 * i * (i + 1), m, 2 * i + 1):\n p[j] = False\n return {2} | {2 * i + 1 for i in range(1, m) if p[i]}\n\n\nN = 10**5\nprimes = prime_numbers(N)\na = [1 if n in primes and (n + 1) \/\/ 2 in primes else 0 for n in range(N + 1)]\na = list(accumulate(a))\nans = []\nQ, *LR = map(int, open(0).read().split())\nfor l, r in zip(*[iter(LR)] * 2):\n ans.append(a[r] - a[l - 1])\nprint(*ans, sep=\"\\n\")\n","code_v1_no_empty_lines":"from sys import stdin, setrecursionlimit\nfrom itertools import accumulate\n\nsetrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef input():\n return stdin.readline().strip()\n\n\ndef prime_numbers(n):\n if n < 2:\n return []\n m = (n + 1) \/\/ 2\n p = [True] * m\n for i in range(1, int((n**0.5 - 1) \/ 2) + 1):\n if p[i]:\n for j in range(2 * i * (i + 1), m, 2 * i + 1):\n p[j] = False\n return {2} | {2 * i + 1 for i in range(1, m) if p[i]}\n\n\nN = 10**5\nprimes = prime_numbers(N)\na = [1 if n in primes and (n + 1) \/\/ 2 in primes else 0 for n in range(N + 1)]\na = list(accumulate(a))\nans = []\nQ, *LR = list(map(int, open(0).read().split()))\nfor l, r in zip(*[iter(LR)] * 2):\n ans.append(a[r] - a[l - 1])\nprint((\"\\n\".join(map(str, ans))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-Q, *LR = map(int, open(0).read().split())","+Q, *LR = list(map(int, open(0).read().split()))","-print(*ans, sep=\"\\n\")","+print((\"\\n\".join(map(str, ans))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0602458467,"measured_runtime_v1":0.0641664114,"runtime_lift":0.9389000479,"key":["s484134821","s973161846"]} +{"user_id":"u127499732","problem_id":"p03274","language":"python","submission_id_v0":"s349470119","submission_id_v1":"s165286226","cpu_time_v0":74,"cpu_time_v1":65,"memory_v0":14052,"memory_v1":14052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.16,"input":"def main():\n\n n, k, *x = list(map(int, open(0).read().split()))\n\n f = lambda i: x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))\n\n l = f(0)\n\n\n\n for i in range(n - k + 1):\n\n y = f(i)\n\n if y < l:\n\n l = y\n\n\n\n print(l)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n n, k, *x = list(map(int, open(0).read().split()))\n\n l = x[0 + k - 1] - x[0] + min(abs(x[0 + k - 1]), abs(x[0]))\n\n\n\n for i in range(n - k + 1):\n\n y = x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))\n\n if y < l:\n\n l = y\n\n\n\n print(l)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":15,"code_v1_loc":14,"code_v0_num_chars":300,"code_v1_num_chars":327,"code_v0_no_empty_lines":"def main():\n n, k, *x = list(map(int, open(0).read().split()))\n f = lambda i: x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))\n l = f(0)\n for i in range(n - k + 1):\n y = f(i)\n if y < l:\n l = y\n print(l)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n, k, *x = list(map(int, open(0).read().split()))\n l = x[0 + k - 1] - x[0] + min(abs(x[0 + k - 1]), abs(x[0]))\n for i in range(n - k + 1):\n y = x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))\n if y < l:\n l = y\n print(l)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["- f = lambda i: x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))","- l = f(0)","+ l = x[0 + k - 1] - x[0] + min(abs(x[0 + k - 1]), abs(x[0]))","- y = f(i)","+ y = x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0622598507,"measured_runtime_v1":0.0610949688,"runtime_lift":1.0190667408,"key":["s349470119","s165286226"]} +{"user_id":"u633255271","problem_id":"p02888","language":"python","submission_id_v0":"s307765451","submission_id_v1":"s499264169","cpu_time_v0":1776,"cpu_time_v1":753,"memory_v0":52316,"memory_v1":45988,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.6,"input":"import bisect\n\n\n\nN = int(eval(input()))\n\nL = list(map(int, input().split()))\n\n\n\nL.sort()\n\n\n\nans = 0\n\nfor i in range(N-2):\n\n for j in range(N-i-1):\n\n a = L[i]\n\n b = L[i+j+1]\n\n c_right = bisect.bisect_left(L[i+j+2:], b + a)\n\n ans += c_right\n\nprint(ans)\n","target":"import bisect\n\n\n\nN = int(eval(input()))\n\nL = list(map(int, input().split()))\n\n\n\nL.sort()\n\n\n\nans = 0\n\nfor i in range(N-2):\n\n for j in range(N-i-1):\n\n a = L[i]\n\n b = L[i+j+1]\n\n c_right = bisect.bisect_left(L, b + a, i+j+2)\n\n ans += c_right - (i+j+2)\n\nprint(ans)\n","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":276,"code_v1_num_chars":285,"code_v0_no_empty_lines":"import bisect\n\nN = int(eval(input()))\nL = list(map(int, input().split()))\nL.sort()\nans = 0\nfor i in range(N - 2):\n for j in range(N - i - 1):\n a = L[i]\n b = L[i + j + 1]\n c_right = bisect.bisect_left(L[i + j + 2 :], b + a)\n ans += c_right\nprint(ans)\n","code_v1_no_empty_lines":"import bisect\n\nN = int(eval(input()))\nL = list(map(int, input().split()))\nL.sort()\nans = 0\nfor i in range(N - 2):\n for j in range(N - i - 1):\n a = L[i]\n b = L[i + j + 1]\n c_right = bisect.bisect_left(L, b + a, i + j + 2)\n ans += c_right - (i + j + 2)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- c_right = bisect.bisect_left(L[i + j + 2 :], b + a)","- ans += c_right","+ c_right = bisect.bisect_left(L, b + a, i + j + 2)","+ ans += c_right - (i + j + 2)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0469515135,"measured_runtime_v1":0.0775404694,"runtime_lift":0.6055097923,"key":["s307765451","s499264169"]} +{"user_id":"u571445182","problem_id":"p03416","language":"python","submission_id_v0":"s805967975","submission_id_v1":"s796108967","cpu_time_v0":83,"cpu_time_v1":58,"memory_v0":3188,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.12,"input":"Tmp = []\n\nTmp = input().rstrip().split(' ')\n\n\n\nA = int(Tmp[0])\n\nB = int(Tmp[1])\n\n\n\nAns = 0\n\nData = A\n\nwhile Data <= B:\n\n C = Data \/\/ 10000\n\n D = (Data - C * 10000 )\/\/ 1000\n\n E = Data \/\/ 100\n\n F = (Data - E * 100 )\/\/ 10\n\n G = Data % 10\n\n if (C==G) and (D==F):\n\n Ans += 1 \n\n Data += 1 \n\n\n\nprint(Ans)\n","target":"\n\nA, B=list(map(int,input().split()))\n\n\n\nN = B - A + 1\n\nAns = 0\n\n\n\nfor i in range(N):\n\n TmpN = A + i\n\n S = str(TmpN)\n\n if S[0]==S[4] and S[1]==S[3]:\n\n Ans += 1\n\n\n\nprint(Ans)\n\n \n\n \n\n\n","code_v0_loc":19,"code_v1_loc":16,"code_v0_num_chars":330,"code_v1_num_chars":184,"code_v0_no_empty_lines":"Tmp = []\nTmp = input().rstrip().split(\" \")\nA = int(Tmp[0])\nB = int(Tmp[1])\nAns = 0\nData = A\nwhile Data <= B:\n C = Data \/\/ 10000\n D = (Data - C * 10000) \/\/ 1000\n E = Data \/\/ 100\n F = (Data - E * 100) \/\/ 10\n G = Data % 10\n if (C == G) and (D == F):\n Ans += 1\n Data += 1\nprint(Ans)\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\nN = B - A + 1\nAns = 0\nfor i in range(N):\n TmpN = A + i\n S = str(TmpN)\n if S[0] == S[4] and S[1] == S[3]:\n Ans += 1\nprint(Ans)\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-Tmp = []","-Tmp = input().rstrip().split(\" \")","-A = int(Tmp[0])","-B = int(Tmp[1])","+A, B = list(map(int, input().split()))","+N = B - A + 1","-Data = A","-while Data <= B:","- C = Data \/\/ 10000","- D = (Data - C * 10000) \/\/ 1000","- E = Data \/\/ 100","- F = (Data - E * 100) \/\/ 10","- G = Data % 10","- if (C == G) and (D == F):","+for i in range(N):","+ TmpN = A + i","+ S = str(TmpN)","+ if S[0] == S[4] and S[1] == S[3]:","- Data += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0504483464,"measured_runtime_v1":0.0598957346,"runtime_lift":0.8422694317,"key":["s805967975","s796108967"]} +{"user_id":"u021019433","problem_id":"p02947","language":"python","submission_id_v0":"s415418586","submission_id_v1":"s725556261","cpu_time_v0":392,"cpu_time_v1":361,"memory_v0":17852,"memory_v1":18236,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.91,"input":"c = {}\n\nn = int(eval(input()))\n\nr = 0\n\nfor _ in range(n):\n\n s = ''.join(sorted(eval(input())))\n\n v = c.get(s, 0)\n\n r += v\n\n c[s] = v + 1\n\nprint(r)\n","target":"from collections import Counter\n\nc = Counter(''.join(sorted(eval(input()))) for _ in range(int(eval(input()))))\n\nprint((sum(x * (x - 1) \/\/ 2 for x in list(c.values()))))","code_v0_loc":9,"code_v1_loc":3,"code_v0_num_chars":147,"code_v1_num_chars":149,"code_v0_no_empty_lines":"c = {}\nn = int(eval(input()))\nr = 0\nfor _ in range(n):\n s = \"\".join(sorted(eval(input())))\n v = c.get(s, 0)\n r += v\n c[s] = v + 1\nprint(r)\n","code_v1_no_empty_lines":"from collections import Counter\n\nc = Counter(\"\".join(sorted(eval(input()))) for _ in range(int(eval(input()))))\nprint((sum(x * (x - 1) \/\/ 2 for x in list(c.values()))))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-c = {}","-n = int(eval(input()))","-r = 0","-for _ in range(n):","- s = \"\".join(sorted(eval(input())))","- v = c.get(s, 0)","- r += v","- c[s] = v + 1","-print(r)","+from collections import Counter","+","+c = Counter(\"\".join(sorted(eval(input()))) for _ in range(int(eval(input()))))","+print((sum(x * (x - 1) \/\/ 2 for x in list(c.values()))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0433910496,"measured_runtime_v1":0.0444575067,"runtime_lift":0.9760117667,"key":["s415418586","s725556261"]} +{"user_id":"u596276291","problem_id":"p03796","language":"python","submission_id_v0":"s048556750","submission_id_v1":"s112692158","cpu_time_v0":36,"cpu_time_v1":32,"memory_v0":3316,"memory_v1":3444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"from collections import defaultdict\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n ans = 1\n\n for i in range(1, N + 1):\n\n ans *= i\n\n ans %= MOD\n\n print((ans % MOD))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"from collections import defaultdict\n\n\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n ans = 1\n\n for i in range(1, N + 1):\n\n ans = (ans * i) % MOD\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":242,"code_v1_num_chars":231,"code_v0_no_empty_lines":"from collections import defaultdict\n\nMOD = 10**9 + 7\n\n\ndef main():\n N = int(eval(input()))\n ans = 1\n for i in range(1, N + 1):\n ans *= i\n ans %= MOD\n print((ans % MOD))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nMOD = 10**9 + 7\n\n\ndef main():\n N = int(eval(input()))\n ans = 1\n for i in range(1, N + 1):\n ans = (ans * i) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- ans *= i","- ans %= MOD","- print((ans % MOD))","+ ans = (ans * i) % MOD","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0937615452,"measured_runtime_v1":0.0524728971,"runtime_lift":1.7868566523,"key":["s048556750","s112692158"]} +{"user_id":"u733618878","problem_id":"p03964","language":"python","submission_id_v0":"s049139695","submission_id_v1":"s336410769","cpu_time_v0":91,"cpu_time_v1":55,"memory_v0":5588,"memory_v1":5844,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.56,"input":"import math\n\nfrom decimal import Decimal\n\nn = int(eval(input()))\n\ni = 0\n\nlist = []\n\nwhile i < n:\n\n list.append(input().split())\n\n i += 1\n\nh = 0\n\nth = 1\n\nah = 1\n\nwhile h < n:\n\n listh = list[h]\n\n x = int(listh[0])\n\n y = int(listh[1])\n\n m = max(math.ceil(th\/x),math.ceil(ah\/y))\n\n th = Decimal(m*x)\n\n ah = Decimal(m*y)\n\n h += 1\n\nprint((th+ah))","target":"import math\n\nfrom decimal import Decimal\n\nn = int(eval(input()))\n\ni = 0\n\nlist = []\n\nwhile i < n:\n\n list.append(input().split())\n\n i += 1\n\nh = 0\n\nth = 1\n\nah = 1\n\nwhile h < n:\n\n listh = list[h]\n\n x = int(listh[0])\n\n y = int(listh[1])\n\n m = max((th+x-1)\/\/x, (ah+y-1)\/\/y)\n\n th = m*x\n\n ah = m*y\n\n h += 1\n\nprint((th+ah))","code_v0_loc":20,"code_v1_loc":20,"code_v0_num_chars":363,"code_v1_num_chars":338,"code_v0_no_empty_lines":"import math\nfrom decimal import Decimal\n\nn = int(eval(input()))\ni = 0\nlist = []\nwhile i < n:\n list.append(input().split())\n i += 1\nh = 0\nth = 1\nah = 1\nwhile h < n:\n listh = list[h]\n x = int(listh[0])\n y = int(listh[1])\n m = max(math.ceil(th \/ x), math.ceil(ah \/ y))\n th = Decimal(m * x)\n ah = Decimal(m * y)\n h += 1\nprint((th + ah))\n","code_v1_no_empty_lines":"import math\nfrom decimal import Decimal\n\nn = int(eval(input()))\ni = 0\nlist = []\nwhile i < n:\n list.append(input().split())\n i += 1\nh = 0\nth = 1\nah = 1\nwhile h < n:\n listh = list[h]\n x = int(listh[0])\n y = int(listh[1])\n m = max((th + x - 1) \/\/ x, (ah + y - 1) \/\/ y)\n th = m * x\n ah = m * y\n h += 1\nprint((th + ah))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- m = max(math.ceil(th \/ x), math.ceil(ah \/ y))","- th = Decimal(m * x)","- ah = Decimal(m * y)","+ m = max((th + x - 1) \/\/ x, (ah + y - 1) \/\/ y)","+ th = m * x","+ ah = m * y"],"diff_only_import_comment":false,"measured_runtime_v0":0.0448632061,"measured_runtime_v1":0.0391374998,"runtime_lift":1.1462971921,"key":["s049139695","s336410769"]} +{"user_id":"u001024152","problem_id":"p03575","language":"python","submission_id_v0":"s727768701","submission_id_v1":"s017070658","cpu_time_v0":28,"cpu_time_v1":25,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.71,"input":"# C\n\nN,M = list(map(int, input().split()))\n\ngraph = [[False]*N for _ in range(N)]\n\nvisited = [False]*N\n\n\n\ndef dfs(cur):\n\n global visited\n\n visited[cur] = True\n\n for nxt in range(N):\n\n if graph[cur][nxt]==False: continue\n\n if visited[nxt]==True: continue\n\n dfs(nxt)\n\n\n\n\n\na = [-1]*M\n\nb = [-1]*M\n\nfor i in range(M):\n\n ai,bi = list(map(int, input().split()))\n\n a[i],b[i] = ai-1, bi-1\n\n graph[a[i]][b[i]] = True\n\n graph[b[i]][a[i]] = True\n\n\n\nans = 0\n\nfor i in range(M):\n\n graph[a[i]][b[i]] = False # \u8fba\u3092\u6d88\u3059\n\n graph[b[i]][a[i]] = False\n\n # print(\"graph: \"+\"\\n\".join(map(str, graph)))\n\n visited = [False]*N\n\n dfs(0)\n\n if not all(visited):\n\n ans += 1\n\n graph[a[i]][b[i]] = True # \u8fba\u3092\u623b\u3059\n\n graph[b[i]][a[i]] = True\n\n \n\nprint(ans)","target":"class UnionFind:\n\n \"\"\"\n\n - size\u3092\u6307\u5b9a\n\n - \u8981\u7d20\u3092\u30b0\u30eb\u30fc\u30d7\u306b\u307e\u3068\u3081\u308b(unite) \n\n - \u8981\u7d20\u540c\u58eb\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u304b\u5224\u5b9a\u3059\u308b(isSame)\n\n - \u5206\u96e2\u306f\u3067\u304d\u306a\u3044\n\n - par: \u89aa\u306e\u756a\u53f7(\u306f\u3058\u3081 par[i]==i \u3064\u307e\u308a\u3059\u3079\u3066\u306e\u9802\u70b9\u304c\u6839)\n\n - \u59cb\u3081\u5404\u8981\u7d20\u306f\u5225\u3005\u306e\u30b0\u30eb\u30fc\u30d7\"\"\"\n\n def __init__(self, size: int):\n\n self.par = [-1]*size\n\n for i in range(size):\n\n self.par[i] = i \n\n \n\n def root(self, x: int) -> int:\n\n \"\"\"\u6839\u3092\u6c42\u3081\u308b\"\"\"\n\n if self.par[x] == x: # if root\n\n return x\n\n else:\n\n self.par[x] = self.root(self.par[x]) # \u7d4c\u8def\u5727\u7e2e\n\n return self.par[x]\n\n \n\n def isSame(self, x:int, y:int)->bool:\n\n \"\"\"x \u3068 y \u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5426\u304b\"\"\"\n\n return self.root(x)==self.root(y)\n\n \n\n def unite(self, x:int, y:int):\n\n \"\"\"x \u3068 y \u306e\u5c5e\u3059\u308b\u96c6\u5408\u3092\u4f75\u5408\"\"\"\n\n x = self.root(x)\n\n y = self.root(y)\n\n if x == y: return\n\n self.par[x] = y\n\n\n\n \n\n \n\n##### main #####\n\nN,M = list(map(int, input().split()))\n\na,b = [0]*M, [0]*M\n\nfor i in range(M):\n\n ai,bi = list(map(int, input().split()))\n\n a[i],b[i] = ai-1, bi-1\n\n \n\nans = 0\n\nfor i in range(M):\n\n uf = UnionFind(N)\n\n for j in range(M):\n\n if i==j: continue # \u3053\u306e\u8fba\u306f\u30d1\u30b9\n\n uf.unite(a[j], b[j])\n\n bridge = False\n\n for i in range(N):\n\n if not uf.isSame(0,i):\n\n bridge = True\n\n if bridge:\n\n ans += 1\n\nprint(ans)","code_v0_loc":35,"code_v1_loc":54,"code_v0_num_chars":780,"code_v1_num_chars":1320,"code_v0_no_empty_lines":"# C\nN, M = list(map(int, input().split()))\ngraph = [[False] * N for _ in range(N)]\nvisited = [False] * N\n\n\ndef dfs(cur):\n global visited\n visited[cur] = True\n for nxt in range(N):\n if graph[cur][nxt] == False:\n continue\n if visited[nxt] == True:\n continue\n dfs(nxt)\n\n\na = [-1] * M\nb = [-1] * M\nfor i in range(M):\n ai, bi = list(map(int, input().split()))\n a[i], b[i] = ai - 1, bi - 1\n graph[a[i]][b[i]] = True\n graph[b[i]][a[i]] = True\nans = 0\nfor i in range(M):\n graph[a[i]][b[i]] = False # \u8fba\u3092\u6d88\u3059\n graph[b[i]][a[i]] = False\n # print(\"graph: \"+\"\\n\".join(map(str, graph)))\n visited = [False] * N\n dfs(0)\n if not all(visited):\n ans += 1\n graph[a[i]][b[i]] = True # \u8fba\u3092\u623b\u3059\n graph[b[i]][a[i]] = True\nprint(ans)\n","code_v1_no_empty_lines":"class UnionFind:\n \"\"\"\n - size\u3092\u6307\u5b9a\n - \u8981\u7d20\u3092\u30b0\u30eb\u30fc\u30d7\u306b\u307e\u3068\u3081\u308b(unite)\n - \u8981\u7d20\u540c\u58eb\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u304b\u5224\u5b9a\u3059\u308b(isSame)\n - \u5206\u96e2\u306f\u3067\u304d\u306a\u3044\n - par: \u89aa\u306e\u756a\u53f7(\u306f\u3058\u3081 par[i]==i \u3064\u307e\u308a\u3059\u3079\u3066\u306e\u9802\u70b9\u304c\u6839)\n - \u59cb\u3081\u5404\u8981\u7d20\u306f\u5225\u3005\u306e\u30b0\u30eb\u30fc\u30d7\"\"\"\n\n def __init__(self, size: int):\n self.par = [-1] * size\n for i in range(size):\n self.par[i] = i\n\n def root(self, x: int) -> int:\n \"\"\"\u6839\u3092\u6c42\u3081\u308b\"\"\"\n if self.par[x] == x: # if root\n return x\n else:\n self.par[x] = self.root(self.par[x]) # \u7d4c\u8def\u5727\u7e2e\n return self.par[x]\n\n def isSame(self, x: int, y: int) -> bool:\n \"\"\"x \u3068 y \u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5426\u304b\"\"\"\n return self.root(x) == self.root(y)\n\n def unite(self, x: int, y: int):\n \"\"\"x \u3068 y \u306e\u5c5e\u3059\u308b\u96c6\u5408\u3092\u4f75\u5408\"\"\"\n x = self.root(x)\n y = self.root(y)\n if x == y:\n return\n self.par[x] = y\n\n\n##### main #####\nN, M = list(map(int, input().split()))\na, b = [0] * M, [0] * M\nfor i in range(M):\n ai, bi = list(map(int, input().split()))\n a[i], b[i] = ai - 1, bi - 1\nans = 0\nfor i in range(M):\n uf = UnionFind(N)\n for j in range(M):\n if i == j:\n continue # \u3053\u306e\u8fba\u306f\u30d1\u30b9\n uf.unite(a[j], b[j])\n bridge = False\n for i in range(N):\n if not uf.isSame(0, i):\n bridge = True\n if bridge:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":35.1851851852,"diff":["-# C","-N, M = list(map(int, input().split()))","-graph = [[False] * N for _ in range(N)]","-visited = [False] * N","+class UnionFind:","+ \"\"\"","+ - size\u3092\u6307\u5b9a","+ - \u8981\u7d20\u3092\u30b0\u30eb\u30fc\u30d7\u306b\u307e\u3068\u3081\u308b(unite)","+ - \u8981\u7d20\u540c\u58eb\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u304b\u5224\u5b9a\u3059\u308b(isSame)","+ - \u5206\u96e2\u306f\u3067\u304d\u306a\u3044","+ - par: \u89aa\u306e\u756a\u53f7(\u306f\u3058\u3081 par[i]==i \u3064\u307e\u308a\u3059\u3079\u3066\u306e\u9802\u70b9\u304c\u6839)","+ - \u59cb\u3081\u5404\u8981\u7d20\u306f\u5225\u3005\u306e\u30b0\u30eb\u30fc\u30d7\"\"\"","+","+ def __init__(self, size: int):","+ self.par = [-1] * size","+ for i in range(size):","+ self.par[i] = i","+","+ def root(self, x: int) -> int:","+ \"\"\"\u6839\u3092\u6c42\u3081\u308b\"\"\"","+ if self.par[x] == x: # if root","+ return x","+ else:","+ self.par[x] = self.root(self.par[x]) # \u7d4c\u8def\u5727\u7e2e","+ return self.par[x]","+","+ def isSame(self, x: int, y: int) -> bool:","+ \"\"\"x \u3068 y \u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5426\u304b\"\"\"","+ return self.root(x) == self.root(y)","+","+ def unite(self, x: int, y: int):","+ \"\"\"x \u3068 y \u306e\u5c5e\u3059\u308b\u96c6\u5408\u3092\u4f75\u5408\"\"\"","+ x = self.root(x)","+ y = self.root(y)","+ if x == y:","+ return","+ self.par[x] = y","-def dfs(cur):","- global visited","- visited[cur] = True","- for nxt in range(N):","- if graph[cur][nxt] == False:","- continue","- if visited[nxt] == True:","- continue","- dfs(nxt)","-","-","-a = [-1] * M","-b = [-1] * M","+##### main #####","+N, M = list(map(int, input().split()))","+a, b = [0] * M, [0] * M","- graph[a[i]][b[i]] = True","- graph[b[i]][a[i]] = True","- graph[a[i]][b[i]] = False # \u8fba\u3092\u6d88\u3059","- graph[b[i]][a[i]] = False","- # print(\"graph: \"+\"\\n\".join(map(str, graph)))","- visited = [False] * N","- dfs(0)","- if not all(visited):","+ uf = UnionFind(N)","+ for j in range(M):","+ if i == j:","+ continue # \u3053\u306e\u8fba\u306f\u30d1\u30b9","+ uf.unite(a[j], b[j])","+ bridge = False","+ for i in range(N):","+ if not uf.isSame(0, i):","+ bridge = True","+ if bridge:","- graph[a[i]][b[i]] = True # \u8fba\u3092\u623b\u3059","- graph[b[i]][a[i]] = True"],"diff_only_import_comment":false,"measured_runtime_v0":0.0594339571,"measured_runtime_v1":0.0661529012,"runtime_lift":0.8984331154,"key":["s727768701","s017070658"]} +{"user_id":"u047393579","problem_id":"p03162","language":"python","submission_id_v0":"s332032348","submission_id_v1":"s699474323","cpu_time_v0":625,"cpu_time_v1":434,"memory_v0":66136,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.56,"input":"N = int(eval(input()))\n\nABC = []\n\nfor _ in range(N):\n\n a,b,c = list(map(int,input().split()))\n\n ABC.append((a,b,c))\n\n\n\ndpA = [ABC[0][0]]*N\n\ndpB = [ABC[0][1]]*N\n\ndpC = [ABC[0][2]]*N\n\n\n\nfor i in range(1, N):\n\n dpA[i] = max(dpB[i-1] + ABC[i][0], dpC[i-1] + ABC[i][0])\n\n dpB[i] = max(dpA[i-1] + ABC[i][1], dpC[i-1] + ABC[i][1])\n\n dpC[i] = max(dpA[i-1] + ABC[i][2], dpB[i-1] + ABC[i][2])\n\nprint((max(dpA[N-1], dpB[N-1], dpC[N-1])))","target":"N = int(eval(input()))\n\nfor i in range(N):\n\n a,b,c = list(map(int,input().split()))\n\n if i == 0:\n\n preA = a\n\n preB = b\n\n preC = c\n\n else:\n\n A = max(preB + a, preC + a)\n\n B = max(preA + b, preC + b)\n\n C = max(preA + c, preB + c)\n\n preA = A\n\n preB = B\n\n preC = C\n\nprint((max(preA, preB, preC)))","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":447,"code_v1_num_chars":434,"code_v0_no_empty_lines":"N = int(eval(input()))\nABC = []\nfor _ in range(N):\n a, b, c = list(map(int, input().split()))\n ABC.append((a, b, c))\ndpA = [ABC[0][0]] * N\ndpB = [ABC[0][1]] * N\ndpC = [ABC[0][2]] * N\nfor i in range(1, N):\n dpA[i] = max(dpB[i - 1] + ABC[i][0], dpC[i - 1] + ABC[i][0])\n dpB[i] = max(dpA[i - 1] + ABC[i][1], dpC[i - 1] + ABC[i][1])\n dpC[i] = max(dpA[i - 1] + ABC[i][2], dpB[i - 1] + ABC[i][2])\nprint((max(dpA[N - 1], dpB[N - 1], dpC[N - 1])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nfor i in range(N):\n a, b, c = list(map(int, input().split()))\n if i == 0:\n preA = a\n preB = b\n preC = c\n else:\n A = max(preB + a, preC + a)\n B = max(preA + b, preC + b)\n C = max(preA + c, preB + c)\n preA = A\n preB = B\n preC = C\nprint((max(preA, preB, preC)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-ABC = []","-for _ in range(N):","+for i in range(N):","- ABC.append((a, b, c))","-dpA = [ABC[0][0]] * N","-dpB = [ABC[0][1]] * N","-dpC = [ABC[0][2]] * N","-for i in range(1, N):","- dpA[i] = max(dpB[i - 1] + ABC[i][0], dpC[i - 1] + ABC[i][0])","- dpB[i] = max(dpA[i - 1] + ABC[i][1], dpC[i - 1] + ABC[i][1])","- dpC[i] = max(dpA[i - 1] + ABC[i][2], dpB[i - 1] + ABC[i][2])","-print((max(dpA[N - 1], dpB[N - 1], dpC[N - 1])))","+ if i == 0:","+ preA = a","+ preB = b","+ preC = c","+ else:","+ A = max(preB + a, preC + a)","+ B = max(preA + b, preC + b)","+ C = max(preA + c, preB + c)","+ preA = A","+ preB = B","+ preC = C","+print((max(preA, preB, preC)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2418055544,"measured_runtime_v1":0.1707199154,"runtime_lift":1.4163875013,"key":["s332032348","s699474323"]} +{"user_id":"u581187895","problem_id":"p02901","language":"python","submission_id_v0":"s656030635","submission_id_v1":"s574340737","cpu_time_v0":193,"cpu_time_v1":118,"memory_v0":106740,"memory_v1":69576,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.86,"input":"\n\ndef resolve():\n\n INF = 10 ** 18\n\n N, M = list(map(int, input().split()))\n\n\n\n Cost = [0] * M\n\n Box_key = [0] * M\n\n for i in range(M):\n\n a, b = list(map(int, input().split()))\n\n Cost[i] = a\n\n C = list(map(int, input().split()))\n\n Box_key[i] = sum(1 << (c - 1) for c in C)\n\n\n\n # dp[ i ][ S ] := \u6700\u521d\u306e i \u500b\u306e\u9375\u304b\u3089\u3044\u304f\u3064\u304b\u9078\u3093\u3067\u3001\n\n # \u958b\u3044\u305f\u5b9d\u7bb1\u306e\u96c6\u5408\u304c S \u3067\u8868\u3055\u308c\u308b\u3088\u3046\u306a\u5834\u5408\u306b\u3064\u3044\u3066\u306e\u3001\u6700\u5c0f\u30b3\u30b9\u30c8\n\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n\n dp[0][0] = 0\n\n\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n\n dp[i + 1][j | Box_key[i]] = min(dp[i + 1][j | Box_key[i]], dp[i][j] + Cost[i])\n\n\n\n if dp[M][(1 << N) - 1] == INF:\n\n print((-1))\n\n else:\n\n print((dp[M][(1 << N) - 1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n resolve()","target":"\n\ndef resolve():\n\n INF = 10 ** 18\n\n N, M = list(map(int, input().split()))\n\n\n\n Box_key = []\n\n for i in range(M):\n\n a, b = list(map(int, input().split()))\n\n C = list(map(int, input().split()))\n\n s = sum(1 << (c - 1) for c in C)\n\n Box_key.append((s, a))\n\n\n\n # dp[i]: \u96c6\u5408i\u306e\u5b9d\u7bb1\u3092\u958b\u3051\u308b\u6700\u5c0f\u30b3\u30b9\u30c8\n\n dp = [INF] * (1 << N)\n\n dp[0] = 0\n\n\n\n for s in range(1 << N):\n\n for i in range(M):\n\n ns = s | Box_key[i][0]\n\n cost = dp[s] + Box_key[i][1]\n\n dp[ns] = min(dp[ns], cost)\n\n\n\n if dp[(1 << N) - 1] == INF:\n\n print((-1))\n\n else:\n\n print((dp[(1 << N) - 1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n resolve()","code_v0_loc":31,"code_v1_loc":30,"code_v0_num_chars":815,"code_v1_num_chars":675,"code_v0_no_empty_lines":"def resolve():\n INF = 10**18\n N, M = list(map(int, input().split()))\n Cost = [0] * M\n Box_key = [0] * M\n for i in range(M):\n a, b = list(map(int, input().split()))\n Cost[i] = a\n C = list(map(int, input().split()))\n Box_key[i] = sum(1 << (c - 1) for c in C)\n # dp[ i ][ S ] := \u6700\u521d\u306e i \u500b\u306e\u9375\u304b\u3089\u3044\u304f\u3064\u304b\u9078\u3093\u3067\u3001\n # \u958b\u3044\u305f\u5b9d\u7bb1\u306e\u96c6\u5408\u304c S \u3067\u8868\u3055\u308c\u308b\u3088\u3046\u306a\u5834\u5408\u306b\u3064\u3044\u3066\u306e\u3001\u6700\u5c0f\u30b3\u30b9\u30c8\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n dp[i + 1][j | Box_key[i]] = min(\n dp[i + 1][j | Box_key[i]], dp[i][j] + Cost[i]\n )\n if dp[M][(1 << N) - 1] == INF:\n print((-1))\n else:\n print((dp[M][(1 << N) - 1]))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"def resolve():\n INF = 10**18\n N, M = list(map(int, input().split()))\n Box_key = []\n for i in range(M):\n a, b = list(map(int, input().split()))\n C = list(map(int, input().split()))\n s = sum(1 << (c - 1) for c in C)\n Box_key.append((s, a))\n # dp[i]: \u96c6\u5408i\u306e\u5b9d\u7bb1\u3092\u958b\u3051\u308b\u6700\u5c0f\u30b3\u30b9\u30c8\n dp = [INF] * (1 << N)\n dp[0] = 0\n for s in range(1 << N):\n for i in range(M):\n ns = s | Box_key[i][0]\n cost = dp[s] + Box_key[i][1]\n dp[ns] = min(dp[ns], cost)\n if dp[(1 << N) - 1] == INF:\n print((-1))\n else:\n print((dp[(1 << N) - 1]))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["- Cost = [0] * M","- Box_key = [0] * M","+ Box_key = []","- Cost[i] = a","- Box_key[i] = sum(1 << (c - 1) for c in C)","- # dp[ i ][ S ] := \u6700\u521d\u306e i \u500b\u306e\u9375\u304b\u3089\u3044\u304f\u3064\u304b\u9078\u3093\u3067\u3001","- # \u958b\u3044\u305f\u5b9d\u7bb1\u306e\u96c6\u5408\u304c S \u3067\u8868\u3055\u308c\u308b\u3088\u3046\u306a\u5834\u5408\u306b\u3064\u3044\u3066\u306e\u3001\u6700\u5c0f\u30b3\u30b9\u30c8","- dp = [[INF] * (1 << N) for _ in range(M + 1)]","- dp[0][0] = 0","- for i in range(M):","- for j in range(1 << N):","- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])","- dp[i + 1][j | Box_key[i]] = min(","- dp[i + 1][j | Box_key[i]], dp[i][j] + Cost[i]","- )","- if dp[M][(1 << N) - 1] == INF:","+ s = sum(1 << (c - 1) for c in C)","+ Box_key.append((s, a))","+ # dp[i]: \u96c6\u5408i\u306e\u5b9d\u7bb1\u3092\u958b\u3051\u308b\u6700\u5c0f\u30b3\u30b9\u30c8","+ dp = [INF] * (1 << N)","+ dp[0] = 0","+ for s in range(1 << N):","+ for i in range(M):","+ ns = s | Box_key[i][0]","+ cost = dp[s] + Box_key[i][1]","+ dp[ns] = min(dp[ns], cost)","+ if dp[(1 << N) - 1] == INF:","- print((dp[M][(1 << N) - 1]))","+ print((dp[(1 << N) - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0760153503,"measured_runtime_v1":0.06518448,"runtime_lift":1.1661571955,"key":["s656030635","s574340737"]} +{"user_id":"u912237403","problem_id":"p00129","language":"python","submission_id_v0":"s881556219","submission_id_v1":"s920929630","cpu_time_v0":60,"cpu_time_v1":50,"memory_v0":4600,"memory_v1":4588,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"import math as M\n\ndef R(A): return (A[0]**2+A[1]**2)**.5\n\ndef I(i): return [list(map(int,input().split())) for _ in [0]*i]\n\ndef C(a,b): return a>b or abs(a-b)<1e-6\n\ndef f(e1):\n\n tx,ty,sx,sy=e1\n\n x=[]\n\n for e2 in WP:\n\n wx,wy,r=e2\n\n wt=[tx-wx,ty-wy]; rwt=R(wt)\n\n sw=[wx-sx,wy-sy]; rsw=R(sw)\n\n st=[tx-sx,ty-sy]; rst=R(st)\n\n F=[rwtb or abs(a-b)<1e-6\n\ndef f(e1):\n\n tx,ty,sx,sy=e1\n\n x=[]\n\n st=[tx-sx,ty-sy]; rst=R(st)\n\n for e2 in WP:\n\n wx,wy,r=e2\n\n wt=[tx-wx,ty-wy]; rwt=R(wt)\n\n sw=[wx-sx,wy-sy]; rsw=R(sw)\n\n F=[rwt b or abs(a - b) < 1e-6\n\n\ndef f(e1):\n tx, ty, sx, sy = e1\n x = []\n for e2 in WP:\n wx, wy, r = e2\n wt = [tx - wx, ty - wy]\n rwt = R(wt)\n sw = [wx - sx, wy - sy]\n rsw = R(sw)\n st = [tx - sx, ty - sy]\n rst = R(st)\n F = [rwt < r, rsw < r]\n if rst == 0:\n c = 1\n elif F == [1, 1]:\n c = 1\n elif F == [1, 0] or F == [0, 1]:\n c = 0\n elif F == [0, 0]:\n a = M.pi \/ 2 - M.acos(r \/ rsw)\n b = M.acos(round((sw[0] * st[0] + sw[1] * st[1]) \/ rsw \/ rst, 4))\n if C(a, b) and C(rst**2, rsw**2 - r**2):\n c = 0\n else:\n c = 1\n if c == 0:\n return 0\n x.append(c)\n return all(x)\n\n\nwhile 1:\n n = eval(input())\n if n == 0:\n break\n WP = I(n)\n P = I(eval(input()))\n for e in P:\n print([\"Safe\", \"Danger\"][f(e)])\n","code_v1_no_empty_lines":"import math as M\n\n\ndef R(A):\n return (A[0] ** 2 + A[1] ** 2) ** 0.5\n\n\ndef I(i):\n return [list(map(int, input().split())) for _ in [0] * i]\n\n\ndef C(a, b):\n return a > b or abs(a - b) < 1e-6\n\n\ndef f(e1):\n tx, ty, sx, sy = e1\n x = []\n st = [tx - sx, ty - sy]\n rst = R(st)\n for e2 in WP:\n wx, wy, r = e2\n wt = [tx - wx, ty - wy]\n rwt = R(wt)\n sw = [wx - sx, wy - sy]\n rsw = R(sw)\n F = [rwt < r, rsw < r]\n c = 1\n if F == [1, 0] or F == [0, 1]:\n return 0\n elif F == [0, 0]:\n a = M.pi \/ 2 - M.acos(r \/ rsw)\n b = M.acos(round((sw[0] * st[0] + sw[1] * st[1]) \/ rsw \/ rst, 4))\n if C(a, b) and C(rst**2, rsw**2 - r**2):\n return 0\n x.append(c)\n return all(x)\n\n\nwhile 1:\n n = eval(input())\n if n == 0:\n break\n WP = I(n)\n P = I(eval(input()))\n for e in P:\n print([\"Safe\", \"Danger\"][f(e)])\n","code_same":false,"relative_loc_diff_percent":9.6774193548,"diff":["+ st = [tx - sx, ty - sy]","+ rst = R(st)","- st = [tx - sx, ty - sy]","- rst = R(st)","- if rst == 0:","- c = 1","- elif F == [1, 1]:","- c = 1","- elif F == [1, 0] or F == [0, 1]:","- c = 0","+ c = 1","+ if F == [1, 0] or F == [0, 1]:","+ return 0","- c = 0","- else:","- c = 1","- if c == 0:","- return 0","+ return 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.0357080896,"measured_runtime_v1":0.0406210666,"runtime_lift":0.8790534714,"key":["s881556219","s920929630"]} +{"user_id":"u133936772","problem_id":"p03209","language":"python","submission_id_v0":"s553306008","submission_id_v1":"s192747224","cpu_time_v0":30,"cpu_time_v1":25,"memory_v0":9184,"memory_v1":9192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"n,x=list(map(int,input().split()))\n\nl,p=[1],[1]\n\nfor i in range(n):\n\n l+=[l[-1]*2+3]\n\n p+=[p[-1]*2+1]\n\nx-=1\n\na=0\n\nwhile x>0 and n:\n\n t=l[n]\/\/2\n\n if x>=t:\n\n a+=p[n-1]+1\n\n x-=t\n\n x-=1\n\n n-=1\n\nif x>=0 and n==0: a+=1\n\nprint(a)","target":"n,x=list(map(int,input().split()))\n\nl,p=[1],[1]\n\nfor i in range(n):\n\n l+=[l[-1]*2+3]\n\n p+=[p[-1]*2+1]\n\nx-=1\n\na=1\n\nwhile n:\n\n t=l[n]\/\/2\n\n if x>=t:\n\n a+=p[n-1]+1\n\n x-=t\n\n x-=1\n\n n-=1\n\nif x<0: a-=1\n\nprint(a)","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":228,"code_v1_num_chars":210,"code_v0_no_empty_lines":"n, x = list(map(int, input().split()))\nl, p = [1], [1]\nfor i in range(n):\n l += [l[-1] * 2 + 3]\n p += [p[-1] * 2 + 1]\nx -= 1\na = 0\nwhile x > 0 and n:\n t = l[n] \/\/ 2\n if x >= t:\n a += p[n - 1] + 1\n x -= t\n x -= 1\n n -= 1\nif x >= 0 and n == 0:\n a += 1\nprint(a)\n","code_v1_no_empty_lines":"n, x = list(map(int, input().split()))\nl, p = [1], [1]\nfor i in range(n):\n l += [l[-1] * 2 + 3]\n p += [p[-1] * 2 + 1]\nx -= 1\na = 1\nwhile n:\n t = l[n] \/\/ 2\n if x >= t:\n a += p[n - 1] + 1\n x -= t\n x -= 1\n n -= 1\nif x < 0:\n a -= 1\nprint(a)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a = 0","-while x > 0 and n:","+a = 1","+while n:","-if x >= 0 and n == 0:","- a += 1","+if x < 0:","+ a -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0439689262,"measured_runtime_v1":0.0479582126,"runtime_lift":0.9168174497,"key":["s553306008","s192747224"]} +{"user_id":"u493520238","problem_id":"p03222","language":"python","submission_id_v0":"s655676206","submission_id_v1":"s199761524","cpu_time_v0":183,"cpu_time_v1":68,"memory_v0":38256,"memory_v1":62940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.84,"input":"MOD = 10**9+7\n\nh,w,k = list(map(int, input().split()))\n\n\n\npatterns = [1,1,2,3,5,8,13,21]\n\n\n\ndp = [ [0]*w for _ in range(h+1) ]\n\ndp[0][0] = 1\n\nfor i in range(1,h+1):\n\n for wi in range(w):\n\n dp[i][wi] = dp[i-1][wi] * patterns[w-1-wi] * patterns[wi-0]\n\n if wi > 0:\n\n dp[i][wi] += dp[i-1][wi-1] * patterns[w-1-wi] * patterns[wi-1]\n\n if wi < w-1:\n\n dp[i][wi] += dp[i-1][wi+1] * patterns[w-1-wi-1] * patterns[wi-0]\n\n dp[i][wi] %= MOD\n\n\n\nprint((dp[h][k-1]%MOD))","target":"h,w,k = list(map(int, input().split()))\n\nremv = [1,1,2,3,5,8,13,21]\n\n\n\ndp = [ [0]*w for _ in range(h+1) ]\n\ndp[0][0] = 1\n\n\n\nMOD = 10**9+7\n\nfor i in range(h):\n\n for wi in range(w):\n\n left = wi\n\n right = w-wi-1\n\n com = remv[left] * remv[right]\n\n dp[i+1][wi] += dp[i][wi]*com\n\n dp[i+1][wi] %= MOD\n\n\n\n if wi > 0:\n\n left = wi-1\n\n right = w-wi-1\n\n com = remv[left] * remv[right]\n\n dp[i+1][wi-1] += dp[i][wi]*com\n\n dp[i+1][wi-1] %= MOD\n\n\n\n if wi < w-1:\n\n left = wi\n\n right = w-(wi+1)-1\n\n com = remv[left] * remv[right]\n\n dp[i+1][wi+1] += dp[i][wi]*com\n\n dp[i+1][wi+1] %= MOD\n\n\n\n\n\nprint((dp[h][k-1]))\n\n\n","code_v0_loc":17,"code_v1_loc":32,"code_v0_num_chars":499,"code_v1_num_chars":748,"code_v0_no_empty_lines":"MOD = 10**9 + 7\nh, w, k = list(map(int, input().split()))\npatterns = [1, 1, 2, 3, 5, 8, 13, 21]\ndp = [[0] * w for _ in range(h + 1)]\ndp[0][0] = 1\nfor i in range(1, h + 1):\n for wi in range(w):\n dp[i][wi] = dp[i - 1][wi] * patterns[w - 1 - wi] * patterns[wi - 0]\n if wi > 0:\n dp[i][wi] += dp[i - 1][wi - 1] * patterns[w - 1 - wi] * patterns[wi - 1]\n if wi < w - 1:\n dp[i][wi] += dp[i - 1][wi + 1] * patterns[w - 1 - wi - 1] * patterns[wi - 0]\n dp[i][wi] %= MOD\nprint((dp[h][k - 1] % MOD))\n","code_v1_no_empty_lines":"h, w, k = list(map(int, input().split()))\nremv = [1, 1, 2, 3, 5, 8, 13, 21]\ndp = [[0] * w for _ in range(h + 1)]\ndp[0][0] = 1\nMOD = 10**9 + 7\nfor i in range(h):\n for wi in range(w):\n left = wi\n right = w - wi - 1\n com = remv[left] * remv[right]\n dp[i + 1][wi] += dp[i][wi] * com\n dp[i + 1][wi] %= MOD\n if wi > 0:\n left = wi - 1\n right = w - wi - 1\n com = remv[left] * remv[right]\n dp[i + 1][wi - 1] += dp[i][wi] * com\n dp[i + 1][wi - 1] %= MOD\n if wi < w - 1:\n left = wi\n right = w - (wi + 1) - 1\n com = remv[left] * remv[right]\n dp[i + 1][wi + 1] += dp[i][wi] * com\n dp[i + 1][wi + 1] %= MOD\nprint((dp[h][k - 1]))\n","code_same":false,"relative_loc_diff_percent":46.875,"diff":["-MOD = 10**9 + 7","-patterns = [1, 1, 2, 3, 5, 8, 13, 21]","+remv = [1, 1, 2, 3, 5, 8, 13, 21]","-for i in range(1, h + 1):","+MOD = 10**9 + 7","+for i in range(h):","- dp[i][wi] = dp[i - 1][wi] * patterns[w - 1 - wi] * patterns[wi - 0]","+ left = wi","+ right = w - wi - 1","+ com = remv[left] * remv[right]","+ dp[i + 1][wi] += dp[i][wi] * com","+ dp[i + 1][wi] %= MOD","- dp[i][wi] += dp[i - 1][wi - 1] * patterns[w - 1 - wi] * patterns[wi - 1]","+ left = wi - 1","+ right = w - wi - 1","+ com = remv[left] * remv[right]","+ dp[i + 1][wi - 1] += dp[i][wi] * com","+ dp[i + 1][wi - 1] %= MOD","- dp[i][wi] += dp[i - 1][wi + 1] * patterns[w - 1 - wi - 1] * patterns[wi - 0]","- dp[i][wi] %= MOD","-print((dp[h][k - 1] % MOD))","+ left = wi","+ right = w - (wi + 1) - 1","+ com = remv[left] * remv[right]","+ dp[i + 1][wi + 1] += dp[i][wi] * com","+ dp[i + 1][wi + 1] %= MOD","+print((dp[h][k - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0384934679,"measured_runtime_v1":0.0390184516,"runtime_lift":0.9865452455,"key":["s655676206","s199761524"]} +{"user_id":"u156815136","problem_id":"p03252","language":"python","submission_id_v0":"s034211004","submission_id_v1":"s095430766","cpu_time_v0":106,"cpu_time_v1":76,"memory_v0":3632,"memory_v1":3632,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.3,"input":"#from statistics import median\n\n#import collections\n\n#aa = collections.Counter(a) # list to list\n\n#from itertools import combinations # (string,3) 3\u56de\n\n\n\nmod = 10**9 + 7\n\n\n\ndef readInts():\n\n return list(map(int,input().split()))\n\ndef main():\n\n # S: azzel\n\n # T: apple\n\n S = eval(input())\n\n T = eval(input())\n\n ok = True\n\n dic_s = {}\n\n dic_t = {}\n\n for i in range(len(S)):\n\n s = S[i]\n\n t = T[i]\n\n if s in list(dic_s.keys()):\n\n if dic_s[s] != t:\n\n ok = False\n\n if t in list(dic_t.keys()):\n\n if dic_t[t] != s:\n\n ok = False\n\n dic_s[s] = t\n\n dic_t[t] = s\n\n #print(dic_s,dic_t,sep='\\n')\n\n if ok:\n\n print('Yes')\n\n else:\n\n print('No')\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#from statistics import median\n\n#import collections\n\n#aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\n\n#from itertools import combinations # (string,3) 3\u56de\n\n#from collections import deque\n\n#import collections.defaultdict(list)\n\n#import bisect\n\n#\n\n# d = m - k[i] - k[j]\n\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n\n#\n\n#\n\n#\n\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n\n#\n\n#\n\n\n\nmod = 10**9 + 7\n\n\n\ndef readInts():\n\n return list(map(int,input().split()))\n\ndef main():\n\n S = eval(input())\n\n T = eval(input())\n\n dic_s = {}\n\n dic_t = {}\n\n for i in range(len(S)):\n\n s = S[i]\n\n t = T[i]\n\n if s in dic_t:\n\n if dic_t[s] != t:\n\n print('No')\n\n exit()\n\n if t in dic_s:\n\n if dic_s[t] != s:\n\n print('No')\n\n exit()\n\n dic_t[s] = t\n\n dic_s[t] = s\n\n print('Yes')\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":38,"code_v1_loc":42,"code_v0_num_chars":792,"code_v1_num_chars":942,"code_v0_no_empty_lines":"# from statistics import median\n# import collections\n# aa = collections.Counter(a) # list to list\n# from itertools import combinations # (string,3) 3\u56de\nmod = 10**9 + 7\n\n\ndef readInts():\n return list(map(int, input().split()))\n\n\ndef main():\n # S: azzel\n # T: apple\n S = eval(input())\n T = eval(input())\n ok = True\n dic_s = {}\n dic_t = {}\n for i in range(len(S)):\n s = S[i]\n t = T[i]\n if s in list(dic_s.keys()):\n if dic_s[s] != t:\n ok = False\n if t in list(dic_t.keys()):\n if dic_t[t] != s:\n ok = False\n dic_s[s] = t\n dic_t[t] = s\n # print(dic_s,dic_t,sep='\\n')\n if ok:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# from statistics import median\n# import collections\n# aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\n# from itertools import combinations # (string,3) 3\u56de\n# from collections import deque\n# import collections.defaultdict(list)\n# import bisect\n#\n# d = m - k[i] - k[j]\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n#\n#\n#\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n#\n#\nmod = 10**9 + 7\n\n\ndef readInts():\n return list(map(int, input().split()))\n\n\ndef main():\n S = eval(input())\n T = eval(input())\n dic_s = {}\n dic_t = {}\n for i in range(len(S)):\n s = S[i]\n t = T[i]\n if s in dic_t:\n if dic_t[s] != t:\n print(\"No\")\n exit()\n if t in dic_s:\n if dic_s[t] != s:\n print(\"No\")\n exit()\n dic_t[s] = t\n dic_s[t] = s\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":9.5238095238,"diff":["-# aa = collections.Counter(a) # list to list","+# aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]","+# from collections import deque","+# import collections.defaultdict(list)","+# import bisect","+#","+# d = m - k[i] - k[j]","+# if kk[bisect.bisect_right(kk,d) - 1] == d:","+#","+#","+#","+# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01","+#","+#","- # S: azzel","- # T: apple","- ok = True","- if s in list(dic_s.keys()):","- if dic_s[s] != t:","- ok = False","- if t in list(dic_t.keys()):","- if dic_t[t] != s:","- ok = False","- dic_s[s] = t","- dic_t[t] = s","- # print(dic_s,dic_t,sep='\\n')","- if ok:","- print(\"Yes\")","- else:","- print(\"No\")","+ if s in dic_t:","+ if dic_t[s] != t:","+ print(\"No\")","+ exit()","+ if t in dic_s:","+ if dic_s[t] != s:","+ print(\"No\")","+ exit()","+ dic_t[s] = t","+ dic_s[t] = s","+ print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.074007055,"measured_runtime_v1":0.0481195669,"runtime_lift":1.5379825665,"key":["s034211004","s095430766"]} +{"user_id":"u020390084","problem_id":"p03212","language":"python","submission_id_v0":"s176484908","submission_id_v1":"s196100049","cpu_time_v0":95,"cpu_time_v1":53,"memory_v0":3060,"memory_v1":6260,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.21,"input":"import sys\n\nn = int(eval(input()))\n\nif n < 357:\n\n print((0))\n\n sys.exit()\n\n\n\ndef dfs(s): \n\n if int(s) > n:\n\n return 0\n\n ret = 1 if all(s.count(c) > 0 for c in '753') else 0\n\n for c in '753':\n\n ret += dfs(s + c)\n\n return ret\n\n\n\nprint((dfs('0'))) ","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\nimport itertools\n\n\n\ndef solve(N: int):\n\n LEN = len(str(N))\n\n if LEN <= 2:\n\n print((0))\n\n return\n\n\n\n answer = 0\n\n for i in range(3,LEN+1):\n\n for num in list(itertools.product(['3','5','7'], repeat=i)):\n\n\n\n if num.count('3') >= 1 and num.count('5')>=1 and num.count('7') >=1 and int(''.join(num))<=N:\n\n answer +=1\n\n\n\n print(answer)\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n solve(N)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":15,"code_v1_loc":32,"code_v0_num_chars":247,"code_v1_num_chars":708,"code_v0_no_empty_lines":"import sys\n\nn = int(eval(input()))\nif n < 357:\n print((0))\n sys.exit()\n\n\ndef dfs(s):\n if int(s) > n:\n return 0\n ret = 1 if all(s.count(c) > 0 for c in \"753\") else 0\n for c in \"753\":\n ret += dfs(s + c)\n return ret\n\n\nprint((dfs(\"0\")))\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nimport itertools\n\n\ndef solve(N: int):\n LEN = len(str(N))\n if LEN <= 2:\n print((0))\n return\n answer = 0\n for i in range(3, LEN + 1):\n for num in list(itertools.product([\"3\", \"5\", \"7\"], repeat=i)):\n if (\n num.count(\"3\") >= 1\n and num.count(\"5\") >= 1\n and num.count(\"7\") >= 1\n and int(\"\".join(num)) <= N\n ):\n answer += 1\n print(answer)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n solve(N)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":53.125,"diff":["+#!\/usr\/bin\/env python3","-","-n = int(eval(input()))","-if n < 357:","- print((0))","- sys.exit()","+import itertools","-def dfs(s):","- if int(s) > n:","- return 0","- ret = 1 if all(s.count(c) > 0 for c in \"753\") else 0","- for c in \"753\":","- ret += dfs(s + c)","- return ret","+def solve(N: int):","+ LEN = len(str(N))","+ if LEN <= 2:","+ print((0))","+ return","+ answer = 0","+ for i in range(3, LEN + 1):","+ for num in list(itertools.product([\"3\", \"5\", \"7\"], repeat=i)):","+ if (","+ num.count(\"3\") >= 1","+ and num.count(\"5\") >= 1","+ and num.count(\"7\") >= 1","+ and int(\"\".join(num)) <= N","+ ):","+ answer += 1","+ print(answer)","+ return","-print((dfs(\"0\")))","+def main():","+ def iterate_tokens():","+ for line in sys.stdin:","+ for word in line.split():","+ yield word","+","+ tokens = iterate_tokens()","+ N = int(next(tokens)) # type: int","+ solve(N)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0499078553,"measured_runtime_v1":0.046295964,"runtime_lift":1.0780174112,"key":["s176484908","s196100049"]} +{"user_id":"u816631826","problem_id":"p02789","language":"python","submission_id_v0":"s503371866","submission_id_v1":"s218316629","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"NM= input ().split()\n\nN= int (NM[0])\n\nM= int (NM[1])\n\nif (N==M):\n\n print (\"Yes\")\n\nelse:\n\n print (\"No\")","target":"a,b =list(map(int,input().split()))\n\nprint(('Yes' if a==b else 'No'))","code_v0_loc":7,"code_v1_loc":2,"code_v0_num_chars":108,"code_v1_num_chars":61,"code_v0_no_empty_lines":"NM = input().split()\nN = int(NM[0])\nM = int(NM[1])\nif N == M:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nprint((\"Yes\" if a == b else \"No\"))\n","code_same":false,"relative_loc_diff_percent":71.4285714286,"diff":["-NM = input().split()","-N = int(NM[0])","-M = int(NM[1])","-if N == M:","- print(\"Yes\")","-else:","- print(\"No\")","+a, b = list(map(int, input().split()))","+print((\"Yes\" if a == b else \"No\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.041707094,"measured_runtime_v1":0.0389292269,"runtime_lift":1.0713568517,"key":["s503371866","s218316629"]} +{"user_id":"u545368057","problem_id":"p03326","language":"python","submission_id_v0":"s363700071","submission_id_v1":"s741133581","cpu_time_v0":26,"cpu_time_v1":24,"memory_v0":3444,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.69,"input":"N,M = list(map(int, input().split()))\n\nxs,ys,zs = [], [], []\n\n\"\"\"\n\nsum000 +++\n\nsum001 ++-\n\nsum010 +-+\n\nsum011 +--\n\nsum100 -++\n\nsum101 -+-\n\nsum110 --+\n\nsum111 ---\n\n\"\"\"\n\n\n\n\n\nsum000, sum001, sum010,sum011 = [], [], [], []\n\nsum100, sum101, sum110,sum111 = [], [], [], []\n\nsums = [[] for i in range(8)]\n\nfor i in range(N):\n\n x,y,z = list(map(int, input().split()))\n\n sums[0].append(x+y+z)\n\n sums[1].append(x+y-z)\n\n sums[2].append(x-y+z)\n\n sums[3].append(x-y-z)\n\n sums[4].append(-x+y+z)\n\n sums[5].append(-x+y-z)\n\n sums[6].append(-x-y+z)\n\n sums[7].append(-x-y-z)\n\n\n\nans = 0\n\nfor s in sums:\n\n s1 = sorted(s,reverse=False)\n\n s2 = sorted(s,reverse=False)\n\n x = max(abs(sum(s1[:M])),abs(sum(s2[:M])))\n\n ans = max(ans,x)\n\nprint(ans)","target":"N,M = list(map(int, input().split()))\n\n\n\n\"\"\"\n\n xyz\n\n0+++\n\n1++-\n\n2+-+\n\n3+--\n\n4-++\n\n5-+-\n\n6--+\n\n7---\n\n\n\n\"\"\"\n\ndp = [[0]*N for i in range(8)]\n\n\n\n\n\nfor i in range(N):\n\n x,y,z = list(map(int, input().split()))\n\n dp[0][i] = x+y+z\n\n dp[1][i] = x+y-z\n\n dp[2][i] = x-y+z\n\n dp[3][i] = x-y-z\n\n dp[4][i] = -x+y+z\n\n dp[5][i] = -x+y-z\n\n dp[6][i] = -x-y+z\n\n dp[7][i] = -x-y-z\n\n\n\nans = 0\n\nfor i in range(8):\n\n sums = sorted(dp[i], reverse=True)\n\n ans = max(sum(sums[:M]),ans)\n\nprint(ans)","code_v0_loc":35,"code_v1_loc":33,"code_v0_num_chars":747,"code_v1_num_chars":491,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nxs, ys, zs = [], [], []\n\"\"\"\nsum000 +++\nsum001 ++-\nsum010 +-+\nsum011 +--\nsum100 -++\nsum101 -+-\nsum110 --+\nsum111 ---\n\"\"\"\nsum000, sum001, sum010, sum011 = [], [], [], []\nsum100, sum101, sum110, sum111 = [], [], [], []\nsums = [[] for i in range(8)]\nfor i in range(N):\n x, y, z = list(map(int, input().split()))\n sums[0].append(x + y + z)\n sums[1].append(x + y - z)\n sums[2].append(x - y + z)\n sums[3].append(x - y - z)\n sums[4].append(-x + y + z)\n sums[5].append(-x + y - z)\n sums[6].append(-x - y + z)\n sums[7].append(-x - y - z)\nans = 0\nfor s in sums:\n s1 = sorted(s, reverse=False)\n s2 = sorted(s, reverse=False)\n x = max(abs(sum(s1[:M])), abs(sum(s2[:M])))\n ans = max(ans, x)\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\n\"\"\"\n xyz\n0+++\n1++-\n2+-+\n3+--\n4-++\n5-+-\n6--+\n7---\n\"\"\"\ndp = [[0] * N for i in range(8)]\nfor i in range(N):\n x, y, z = list(map(int, input().split()))\n dp[0][i] = x + y + z\n dp[1][i] = x + y - z\n dp[2][i] = x - y + z\n dp[3][i] = x - y - z\n dp[4][i] = -x + y + z\n dp[5][i] = -x + y - z\n dp[6][i] = -x - y + z\n dp[7][i] = -x - y - z\nans = 0\nfor i in range(8):\n sums = sorted(dp[i], reverse=True)\n ans = max(sum(sums[:M]), ans)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.7142857143,"diff":["-xs, ys, zs = [], [], []","-sum001 ++-","-sum010 +-+","-sum011 +--","-sum100 -++","-sum101 -+-","-sum110 --+","+ xyz","+1++-","+2+-+","+3+--","+4-++","+5-+-","+6--+","-sum000, sum001, sum010, sum011 = [], [], [], []","-sum100, sum101, sum110, sum111 = [], [], [], []","-sums = [[] for i in range(8)]","+dp = [[0] * N for i in range(8)]","- sums[0].append(x + y + z)","- sums[1].append(x + y - z)","- sums[2].append(x - y + z)","- sums[3].append(x - y - z)","- sums[4].append(-x + y + z)","- sums[5].append(-x + y - z)","- sums[6].append(-x - y + z)","- sums[7].append(-x - y - z)","+ dp[0][i] = x + y + z","+ dp[1][i] = x + y - z","+ dp[2][i] = x - y + z","+ dp[3][i] = x - y - z","+ dp[4][i] = -x + y + z","+ dp[5][i] = -x + y - z","+ dp[6][i] = -x - y + z","+ dp[7][i] = -x - y - z","-for s in sums:","- s1 = sorted(s, reverse=False)","- s2 = sorted(s, reverse=False)","- x = max(abs(sum(s1[:M])), abs(sum(s2[:M])))","- ans = max(ans, x)","+for i in range(8):","+ sums = sorted(dp[i], reverse=True)","+ ans = max(sum(sums[:M]), ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0442252982,"measured_runtime_v1":0.0390283144,"runtime_lift":1.1331593201,"key":["s363700071","s741133581"]} +{"user_id":"u607563136","problem_id":"p02923","language":"python","submission_id_v0":"s773665522","submission_id_v1":"s003552858","cpu_time_v0":83,"cpu_time_v1":76,"memory_v0":20444,"memory_v1":20568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.43,"input":"N = int(eval(input()))\n\nH = list(map(int,input().split()))\n\n\n\nstp = [0]*(N+1)\n\nstp[0] = 0\n\n\n\nfor i in range(1,N):\n\n if H[i]<=H[i-1]:\n\n stp[i] = stp[i-1] +1\n\n else:\n\n stp[i] = 0\n\n \n\nprint((max(stp)))","target":"N = int(eval(input()))\n\nh = list(map(int,input().split()))\n\nmemo = [0]*N\n\nfor i in range(1,N):\n\n if h[i]<=h[i-1]:\n\n memo[i] = memo[i-1] + 1 \n\nprint((max(memo)))","code_v0_loc":13,"code_v1_loc":7,"code_v0_num_chars":217,"code_v1_num_chars":162,"code_v0_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\nstp = [0] * (N + 1)\nstp[0] = 0\nfor i in range(1, N):\n if H[i] <= H[i - 1]:\n stp[i] = stp[i - 1] + 1\n else:\n stp[i] = 0\nprint((max(stp)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nh = list(map(int, input().split()))\nmemo = [0] * N\nfor i in range(1, N):\n if h[i] <= h[i - 1]:\n memo[i] = memo[i - 1] + 1\nprint((max(memo)))\n","code_same":false,"relative_loc_diff_percent":46.1538461538,"diff":["-H = list(map(int, input().split()))","-stp = [0] * (N + 1)","-stp[0] = 0","+h = list(map(int, input().split()))","+memo = [0] * N","- if H[i] <= H[i - 1]:","- stp[i] = stp[i - 1] + 1","- else:","- stp[i] = 0","-print((max(stp)))","+ if h[i] <= h[i - 1]:","+ memo[i] = memo[i - 1] + 1","+print((max(memo)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.116704035,"measured_runtime_v1":0.101198921,"runtime_lift":1.1532142232,"key":["s773665522","s003552858"]} +{"user_id":"u672475305","problem_id":"p02726","language":"python","submission_id_v0":"s369344432","submission_id_v1":"s605576213","cpu_time_v0":1186,"cpu_time_v1":533,"memory_v0":63964,"memory_v1":49884,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.06,"input":"from collections import deque\n\nn,x,y = list(map(int,input().split()))\n\ncnt = [0]*n\n\nfor i in range(n):\n\n d = [float('inf')]*n\n\n que = deque([(i, 0)])\n\n while que:\n\n idx, c = que.popleft()\n\n if d[idx]!=float('inf'):\n\n d[idx] = min(d[idx], c)\n\n continue\n\n else:\n\n d[idx] = min(d[idx], c)\n\n if idx!=0:\n\n que.append((idx-1, c+1))\n\n if idx!=n-1:\n\n que.append((idx+1, c+1))\n\n if idx==x-1:\n\n que.append((y-1, c+1))\n\n if idx==y-1:\n\n que.append((x-1, c+1))\n\n for j in range(i+1, n):\n\n cnt[d[j]] += 1\n\nfor c in cnt[1:]:\n\n print(c)\n\n\n","target":"from collections import deque\n\nn,x,y = list(map(int,input().split()))\n\nG = [[] for _ in range(n+1)]\n\nfor i in range(1, n):\n\n G[i].append(i+1)\n\n G[i+1].append(i)\n\nG[x].append(y)\n\nG[y].append(x)\n\n\n\ncost = [0]*(n+1)\n\nfor i in range(1, n+1):\n\n visited = [-1]*(n+1)\n\n que = deque([(i, 0)])\n\n while que:\n\n idx, cst = que.popleft()\n\n if visited[idx]!=-1:\n\n continue\n\n visited[idx] = cst\n\n for to in G[idx]:\n\n que.append((to, cst+1))\n\n for j in range(i, n+1):\n\n cost[visited[j]] += 1\n\nfor c in cost[1:-1]:\n\n print(c)","code_v0_loc":26,"code_v1_loc":24,"code_v0_num_chars":697,"code_v1_num_chars":580,"code_v0_no_empty_lines":"from collections import deque\n\nn, x, y = list(map(int, input().split()))\ncnt = [0] * n\nfor i in range(n):\n d = [float(\"inf\")] * n\n que = deque([(i, 0)])\n while que:\n idx, c = que.popleft()\n if d[idx] != float(\"inf\"):\n d[idx] = min(d[idx], c)\n continue\n else:\n d[idx] = min(d[idx], c)\n if idx != 0:\n que.append((idx - 1, c + 1))\n if idx != n - 1:\n que.append((idx + 1, c + 1))\n if idx == x - 1:\n que.append((y - 1, c + 1))\n if idx == y - 1:\n que.append((x - 1, c + 1))\n for j in range(i + 1, n):\n cnt[d[j]] += 1\nfor c in cnt[1:]:\n print(c)\n","code_v1_no_empty_lines":"from collections import deque\n\nn, x, y = list(map(int, input().split()))\nG = [[] for _ in range(n + 1)]\nfor i in range(1, n):\n G[i].append(i + 1)\n G[i + 1].append(i)\nG[x].append(y)\nG[y].append(x)\ncost = [0] * (n + 1)\nfor i in range(1, n + 1):\n visited = [-1] * (n + 1)\n que = deque([(i, 0)])\n while que:\n idx, cst = que.popleft()\n if visited[idx] != -1:\n continue\n visited[idx] = cst\n for to in G[idx]:\n que.append((to, cst + 1))\n for j in range(i, n + 1):\n cost[visited[j]] += 1\nfor c in cost[1:-1]:\n print(c)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-cnt = [0] * n","-for i in range(n):","- d = [float(\"inf\")] * n","+G = [[] for _ in range(n + 1)]","+for i in range(1, n):","+ G[i].append(i + 1)","+ G[i + 1].append(i)","+G[x].append(y)","+G[y].append(x)","+cost = [0] * (n + 1)","+for i in range(1, n + 1):","+ visited = [-1] * (n + 1)","- idx, c = que.popleft()","- if d[idx] != float(\"inf\"):","- d[idx] = min(d[idx], c)","+ idx, cst = que.popleft()","+ if visited[idx] != -1:","- else:","- d[idx] = min(d[idx], c)","- if idx != 0:","- que.append((idx - 1, c + 1))","- if idx != n - 1:","- que.append((idx + 1, c + 1))","- if idx == x - 1:","- que.append((y - 1, c + 1))","- if idx == y - 1:","- que.append((x - 1, c + 1))","- for j in range(i + 1, n):","- cnt[d[j]] += 1","-for c in cnt[1:]:","+ visited[idx] = cst","+ for to in G[idx]:","+ que.append((to, cst + 1))","+ for j in range(i, n + 1):","+ cost[visited[j]] += 1","+for c in cost[1:-1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0360242708,"measured_runtime_v1":0.0364839265,"runtime_lift":0.987401143,"key":["s369344432","s605576213"]} +{"user_id":"u564902833","problem_id":"p02984","language":"python","submission_id_v0":"s694954463","submission_id_v1":"s616869332","cpu_time_v0":251,"cpu_time_v1":123,"memory_v0":84708,"memory_v1":16304,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.0,"input":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nx = [0 for _ in range(N)]\n\nfor i in range(N):\n\n if i % 2 == 0:\n\n x[0] += A[i]\n\n else:\n\n x[0] -= A[i]\n\nx[0] \/\/= 2\n\nfor i in range(1, N):\n\n x[i] = A[i - 1] - x[i - 1]\n\nans = ' '.join(str(2 * X) for X in x)\n\n\n\nprint(ans)\n","target":"from itertools import accumulate\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\n# x_1 = (A_1 - A_2 + A_3 - A_4 + ... + A_N) \/ 2 \u3067\u3042\u308b\n\n# x_2 \u4ee5\u964d\u306f\u4ee3\u5165\u3057\u306a\u304c\u3089\u6c42\u3081\u308c\u3070\u3088\u3044\n\nans = ' '.join(\n\n str(2 * x)\n\n for x in accumulate(\n\n [sum((-1)**i * A[i] for i in range(N)) \/\/ 2] + A[:-1],\n\n lambda acc, a: a - acc\n\n )\n\n)\n\n\n\nprint(ans)\n","code_v0_loc":15,"code_v1_loc":16,"code_v0_num_chars":298,"code_v1_num_chars":347,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nx = [0 for _ in range(N)]\nfor i in range(N):\n if i % 2 == 0:\n x[0] += A[i]\n else:\n x[0] -= A[i]\nx[0] \/\/= 2\nfor i in range(1, N):\n x[i] = A[i - 1] - x[i - 1]\nans = \" \".join(str(2 * X) for X in x)\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import accumulate\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\n# x_1 = (A_1 - A_2 + A_3 - A_4 + ... + A_N) \/ 2 \u3067\u3042\u308b\n# x_2 \u4ee5\u964d\u306f\u4ee3\u5165\u3057\u306a\u304c\u3089\u6c42\u3081\u308c\u3070\u3088\u3044\nans = \" \".join(\n str(2 * x)\n for x in accumulate(\n [sum((-1) ** i * A[i] for i in range(N)) \/\/ 2] + A[:-1], lambda acc, a: a - acc\n )\n)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["+from itertools import accumulate","+","-x = [0 for _ in range(N)]","-for i in range(N):","- if i % 2 == 0:","- x[0] += A[i]","- else:","- x[0] -= A[i]","-x[0] \/\/= 2","-for i in range(1, N):","- x[i] = A[i - 1] - x[i - 1]","-ans = \" \".join(str(2 * X) for X in x)","+# x_1 = (A_1 - A_2 + A_3 - A_4 + ... + A_N) \/ 2 \u3067\u3042\u308b","+# x_2 \u4ee5\u964d\u306f\u4ee3\u5165\u3057\u306a\u304c\u3089\u6c42\u3081\u308c\u3070\u3088\u3044","+ans = \" \".join(","+ str(2 * x)","+ for x in accumulate(","+ [sum((-1) ** i * A[i] for i in range(N)) \/\/ 2] + A[:-1], lambda acc, a: a - acc","+ )","+)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0446917341,"measured_runtime_v1":0.0421890087,"runtime_lift":1.0593217387,"key":["s694954463","s616869332"]} +{"user_id":"u426764965","problem_id":"p02584","language":"python","submission_id_v0":"s570995766","submission_id_v1":"s453960535","cpu_time_v0":36,"cpu_time_v1":28,"memory_v0":9168,"memory_v1":9124,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.22,"input":"x, k, d = list(map(int, input().split()))\n\nx = abs(x)\n\ndiv, mod = divmod(x, d)\n\nc = div - k\n\nif c == 0:\n\n ans = mod\n\nelif c > 0:\n\n ans = x - d * k\n\nelse:\n\n if c%2 == 1: ans = d - mod\n\n else: ans = mod\n\nprint(ans)","target":"x, k, d = list(map(int, input().split()))\n\nx = abs(x)\n\ndiv, mod = divmod(x, d)\n\nc = k - div\n\nif c <= 0:\n\n ans = x - d * k\n\nelse:\n\n if c%2 == 1: ans = d - mod\n\n else: ans = mod\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":10,"code_v0_num_chars":218,"code_v1_num_chars":190,"code_v0_no_empty_lines":"x, k, d = list(map(int, input().split()))\nx = abs(x)\ndiv, mod = divmod(x, d)\nc = div - k\nif c == 0:\n ans = mod\nelif c > 0:\n ans = x - d * k\nelse:\n if c % 2 == 1:\n ans = d - mod\n else:\n ans = mod\nprint(ans)\n","code_v1_no_empty_lines":"x, k, d = list(map(int, input().split()))\nx = abs(x)\ndiv, mod = divmod(x, d)\nc = k - div\nif c <= 0:\n ans = x - d * k\nelse:\n if c % 2 == 1:\n ans = d - mod\n else:\n ans = mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-c = div - k","-if c == 0:","- ans = mod","-elif c > 0:","+c = k - div","+if c <= 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.047657064,"measured_runtime_v1":0.0479213061,"runtime_lift":0.9944859144,"key":["s570995766","s453960535"]} +{"user_id":"u285891772","problem_id":"p02939","language":"python","submission_id_v0":"s521304149","submission_id_v1":"s217392779","cpu_time_v0":95,"cpu_time_v1":80,"memory_v0":11984,"memory_v1":13360,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.79,"input":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\n#from decimal import *\n\n\n\nS = list(eval(input()))\n\nN = len(S)\n\n\n\ncnt = 0\n\nfor i in range(len(S)-1):\n\n\tif S[i]==S[i+1]:\n\n\t\tcnt += 1\n\n\t\tS[min(len(S)-1, i+2)] = \"_\"\n\n\n\nprint((N-cnt))\n","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\n#from decimal import *\n\n\n\nS = list(eval(input())) + [\"\"]\n\n\n\ncnt = 0\n\nfor i in range(len(S)-1):\n\n\tif S[i]==S[i+1]:\n\n\t\tcnt += 1\n\n\t\tS[i+2] = \"_\"\n\n\n\nprint((len(S)-1-cnt))\n","code_v0_loc":31,"code_v1_loc":30,"code_v0_num_chars":1042,"code_v1_num_chars":1029,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n) # , log2\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# from decimal import *\nS = list(eval(input()))\nN = len(S)\ncnt = 0\nfor i in range(len(S) - 1):\n if S[i] == S[i + 1]:\n cnt += 1\n S[min(len(S) - 1, i + 2)] = \"_\"\nprint((N - cnt))\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n) # , log2\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# from decimal import *\nS = list(eval(input())) + [\"\"]\ncnt = 0\nfor i in range(len(S) - 1):\n if S[i] == S[i + 1]:\n cnt += 1\n S[i + 2] = \"_\"\nprint((len(S) - 1 - cnt))\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["-S = list(eval(input()))","-N = len(S)","+S = list(eval(input())) + [\"\"]","- S[min(len(S) - 1, i + 2)] = \"_\"","-print((N - cnt))","+ S[i + 2] = \"_\"","+print((len(S) - 1 - cnt))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0390476587,"measured_runtime_v1":0.0392330371,"runtime_lift":0.9952749413,"key":["s521304149","s217392779"]} +{"user_id":"u596276291","problem_id":"p03803","language":"python","submission_id_v0":"s927165657","submission_id_v1":"s633160868","cpu_time_v0":27,"cpu_time_v1":20,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.93,"input":"from collections import defaultdict\n\n\n\n\n\ndef main():\n\n A, B = list(map(int, input().split()))\n\n d = {1: 14}\n\n\n\n if d.get(A, A) == d.get(B, B):\n\n print(\"Draw\")\n\n elif d.get(A, A) > d.get(B, B):\n\n print(\"Alice\")\n\n else:\n\n print(\"Bob\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"from collections import defaultdict\n\n\n\n\n\ndef main():\n\n A, B = list(map(int, input().split()))\n\n if A == 1:\n\n A = 14\n\n if B == 1:\n\n B = 14\n\n if A == B:\n\n print(\"Draw\")\n\n elif A > B:\n\n print(\"Alice\")\n\n else:\n\n print(\"Bob\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":17,"code_v1_loc":19,"code_v0_num_chars":307,"code_v1_num_chars":312,"code_v0_no_empty_lines":"from collections import defaultdict\n\n\ndef main():\n A, B = list(map(int, input().split()))\n d = {1: 14}\n if d.get(A, A) == d.get(B, B):\n print(\"Draw\")\n elif d.get(A, A) > d.get(B, B):\n print(\"Alice\")\n else:\n print(\"Bob\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import defaultdict\n\n\ndef main():\n A, B = list(map(int, input().split()))\n if A == 1:\n A = 14\n if B == 1:\n B = 14\n if A == B:\n print(\"Draw\")\n elif A > B:\n print(\"Alice\")\n else:\n print(\"Bob\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["- d = {1: 14}","- if d.get(A, A) == d.get(B, B):","+ if A == 1:","+ A = 14","+ if B == 1:","+ B = 14","+ if A == B:","- elif d.get(A, A) > d.get(B, B):","+ elif A > B:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0371846657,"measured_runtime_v1":0.0754817677,"runtime_lift":0.4926310927,"key":["s927165657","s633160868"]} +{"user_id":"u144913062","problem_id":"p03973","language":"python","submission_id_v0":"s331371688","submission_id_v1":"s222948092","cpu_time_v0":235,"cpu_time_v1":92,"memory_v0":44252,"memory_v1":77876,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.85,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nA = [int(eval(input())) for _ in range(N)]\n\nans = A[0] - 1\n\nP = 2\n\nfor i in range(1, N):\n\n if A[i] == P:\n\n P += 1\n\n continue\n\n ans += (A[i]- 1) \/\/ P\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nA = [int(eval(input())) for _ in range(N)]\n\ncur = 1\n\nans = A[0] - 1\n\nfor a in A[1:]:\n\n if a == cur + 1:\n\n cur += 1\n\n elif a % (cur + 1) == 0:\n\n ans += a \/\/ (cur + 1) - 1\n\n else:\n\n ans += a \/\/ (cur + 1)\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":15,"code_v0_num_chars":235,"code_v1_num_chars":297,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nA = [int(eval(input())) for _ in range(N)]\nans = A[0] - 1\nP = 2\nfor i in range(1, N):\n if A[i] == P:\n P += 1\n continue\n ans += (A[i] - 1) \/\/ P\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nA = [int(eval(input())) for _ in range(N)]\ncur = 1\nans = A[0] - 1\nfor a in A[1:]:\n if a == cur + 1:\n cur += 1\n elif a % (cur + 1) == 0:\n ans += a \/\/ (cur + 1) - 1\n else:\n ans += a \/\/ (cur + 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["+cur = 1","-P = 2","-for i in range(1, N):","- if A[i] == P:","- P += 1","- continue","- ans += (A[i] - 1) \/\/ P","+for a in A[1:]:","+ if a == cur + 1:","+ cur += 1","+ elif a % (cur + 1) == 0:","+ ans += a \/\/ (cur + 1) - 1","+ else:","+ ans += a \/\/ (cur + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0371735186,"measured_runtime_v1":0.0370943793,"runtime_lift":1.0021334581,"key":["s331371688","s222948092"]} +{"user_id":"u941753895","problem_id":"p02957","language":"python","submission_id_v0":"s810588888","submission_id_v1":"s532683301","cpu_time_v0":72,"cpu_time_v1":59,"memory_v0":6860,"memory_v1":6480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.06,"input":"import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf=10**20\n\nmod=10**9+7\n\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\n\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS(): return sys.stdin.readline().split()\n\ndef S(): return eval(input())\n\n\n\ndef main():\n\n a,b=LI()\n\n \n\n x=max(a,b)-min(a,b)\n\n\n\n if x%2==1:\n\n return 'IMPOSSIBLE'\n\n\n\n return max(a,b)-x\/\/2\n\n\n\n# main()\n\nprint((main()))\n","target":"import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy\n\n\n\nsys.setrecursionlimit(10**7)\n\ninf=10**20\n\nmod=10**9+7\n\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\n\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS(): return sys.stdin.readline().split()\n\ndef S(): return eval(input())\n\n\n\ndef main():\n\n a,b=LI()\n\n\n\n if a%2!=b%2:\n\n return 'IMPOSSIBLE'\n\n return (a+b)\/\/2\n\n\n\n# main()\n\nprint((main()))\n","code_v0_loc":26,"code_v1_loc":23,"code_v0_num_chars":648,"code_v1_num_chars":616,"code_v0_no_empty_lines":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef S():\n return eval(input())\n\n\ndef main():\n a, b = LI()\n x = max(a, b) - min(a, b)\n if x % 2 == 1:\n return \"IMPOSSIBLE\"\n return max(a, b) - x \/\/ 2\n\n\n# main()\nprint((main()))\n","code_v1_no_empty_lines":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef S():\n return eval(input())\n\n\ndef main():\n a, b = LI()\n if a % 2 != b % 2:\n return \"IMPOSSIBLE\"\n return (a + b) \/\/ 2\n\n\n# main()\nprint((main()))\n","code_same":false,"relative_loc_diff_percent":11.5384615385,"diff":["- x = max(a, b) - min(a, b)","- if x % 2 == 1:","+ if a % 2 != b % 2:","- return max(a, b) - x \/\/ 2","+ return (a + b) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0764526296,"measured_runtime_v1":0.0328124681,"runtime_lift":2.329987169,"key":["s810588888","s532683301"]} +{"user_id":"u875291233","problem_id":"p03332","language":"python","submission_id_v0":"s086577522","submission_id_v1":"s262645557","cpu_time_v0":869,"cpu_time_v1":248,"memory_v0":38656,"memory_v1":47984,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":71.46,"input":"# coding: utf-8\n\n# Your code here!\n\nimport array\n\n\n\nSIZE=300000; MOD= 998244353\n\n#inv = array.array('q',[0]*(SIZE+1))# inv[j] = j^{-1} mod M\n\n#fac = array.array('q',[0]*(SIZE+1))# inv[j] = j! mod M\n\n#finv = array.array('q',[0]*(SIZE+1))# inv[j] = (j!)^{-1} mod M\n\ninv = [0]*(SIZE+1)# inv[j] = j^{-1} mod M\n\nfac = [0]*(SIZE+1)# inv[j] = j! mod M\n\nfinv = [0]*(SIZE+1)# inv[j] = (j!)^{-1} mod M\n\ninv[1] = 1\n\nfac[0] = fac[1] = 1\n\nfinv[0] = finv[1] = 1\n\nfor i in range(2,SIZE+1):\n\n inv[i] = MOD -(MOD\/\/i)*inv[MOD%i]%MOD\n\n fac[i] = fac[i-1]*i%MOD\n\n finv[i]= finv[i-1]*inv[i]%MOD\n\n\n\ndef choose(n,r): # nCk mod MOD \u306e\u8a08\u7b97\n\n if r < 0 or r > n:\n\n return 0\n\n else:\n\n return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD\n\n \n\n\n\nn,a,b,k = [int(i) for i in input().split()]\n\nans=0\n\nfor i in range(n+1):\n\n if (k-i*a)%b == 0:\n\n ans = (ans + choose(n,i)*choose(n,(k-i*a)\/\/b)%MOD)%MOD\n\nprint(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","target":"SIZE=300000; MOD=998244353 #\u3053\u3053\u3092\u5909\u66f4\u3059\u308b\n\n\n\ninv = [0]*(SIZE+1)# inv[j] = j^{-1} mod MOD\n\nfac = [0]*(SIZE+1)# inv[j] = j! mod MOD\n\nfinv = [0]*(SIZE+1)# inv[j] = (j!)^{-1} mod MOD\n\ninv[1] = 1\n\nfac[0] = fac[1] = 1\n\nfinv[0] = finv[1] = 1\n\nfor i in range(2,SIZE+1):\n\n inv[i] = MOD -(MOD\/\/i)*inv[MOD%i]%MOD\n\n fac[i] = fac[i-1]*i%MOD\n\n finv[i]= finv[i-1]*inv[i]%MOD\n\n\n\ndef choose(n,r): # nCk mod MOD \u306e\u8a08\u7b97\n\n if r < 0 or r > n or n < 0:\n\n return 0\n\n else:\n\n return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD\n\n \n\n\n\nn,a,b,k = [int(i) for i in input().split()]\n\nans=0\n\nfor i in range(n+1):\n\n if (k-i*a)%b == 0:\n\n ans = (ans + choose(n,i)*choose(n,(k-i*a)\/\/b)%MOD)%MOD\n\nprint(ans)\n\n\n\n\n","code_v0_loc":42,"code_v1_loc":28,"code_v0_num_chars":926,"code_v1_num_chars":700,"code_v0_no_empty_lines":"# coding: utf-8\n# Your code here!\nimport array\n\nSIZE = 300000\nMOD = 998244353\n# inv = array.array('q',[0]*(SIZE+1))# inv[j] = j^{-1} mod M\n# fac = array.array('q',[0]*(SIZE+1))# inv[j] = j! mod M\n# finv = array.array('q',[0]*(SIZE+1))# inv[j] = (j!)^{-1} mod M\ninv = [0] * (SIZE + 1) # inv[j] = j^{-1} mod M\nfac = [0] * (SIZE + 1) # inv[j] = j! mod M\nfinv = [0] * (SIZE + 1) # inv[j] = (j!)^{-1} mod M\ninv[1] = 1\nfac[0] = fac[1] = 1\nfinv[0] = finv[1] = 1\nfor i in range(2, SIZE + 1):\n inv[i] = MOD - (MOD \/\/ i) * inv[MOD % i] % MOD\n fac[i] = fac[i - 1] * i % MOD\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n\ndef choose(n, r): # nCk mod MOD \u306e\u8a08\u7b97\n if r < 0 or r > n:\n return 0\n else:\n return (fac[n] * finv[r] % MOD) * finv[n - r] % MOD\n\n\nn, a, b, k = [int(i) for i in input().split()]\nans = 0\nfor i in range(n + 1):\n if (k - i * a) % b == 0:\n ans = (ans + choose(n, i) * choose(n, (k - i * a) \/\/ b) % MOD) % MOD\nprint(ans)\n","code_v1_no_empty_lines":"SIZE = 300000\nMOD = 998244353 # \u3053\u3053\u3092\u5909\u66f4\u3059\u308b\ninv = [0] * (SIZE + 1) # inv[j] = j^{-1} mod MOD\nfac = [0] * (SIZE + 1) # inv[j] = j! mod MOD\nfinv = [0] * (SIZE + 1) # inv[j] = (j!)^{-1} mod MOD\ninv[1] = 1\nfac[0] = fac[1] = 1\nfinv[0] = finv[1] = 1\nfor i in range(2, SIZE + 1):\n inv[i] = MOD - (MOD \/\/ i) * inv[MOD % i] % MOD\n fac[i] = fac[i - 1] * i % MOD\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n\ndef choose(n, r): # nCk mod MOD \u306e\u8a08\u7b97\n if r < 0 or r > n or n < 0:\n return 0\n else:\n return (fac[n] * finv[r] % MOD) * finv[n - r] % MOD\n\n\nn, a, b, k = [int(i) for i in input().split()]\nans = 0\nfor i in range(n + 1):\n if (k - i * a) % b == 0:\n ans = (ans + choose(n, i) * choose(n, (k - i * a) \/\/ b) % MOD) % MOD\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-# coding: utf-8","-# Your code here!","-import array","-","-MOD = 998244353","-# inv = array.array('q',[0]*(SIZE+1))# inv[j] = j^{-1} mod M","-# fac = array.array('q',[0]*(SIZE+1))# inv[j] = j! mod M","-# finv = array.array('q',[0]*(SIZE+1))# inv[j] = (j!)^{-1} mod M","-inv = [0] * (SIZE + 1) # inv[j] = j^{-1} mod M","-fac = [0] * (SIZE + 1) # inv[j] = j! mod M","-finv = [0] * (SIZE + 1) # inv[j] = (j!)^{-1} mod M","+MOD = 998244353 # \u3053\u3053\u3092\u5909\u66f4\u3059\u308b","+inv = [0] * (SIZE + 1) # inv[j] = j^{-1} mod MOD","+fac = [0] * (SIZE + 1) # inv[j] = j! mod MOD","+finv = [0] * (SIZE + 1) # inv[j] = (j!)^{-1} mod MOD","- if r < 0 or r > n:","+ if r < 0 or r > n or n < 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.7244626808,"measured_runtime_v1":2.0056502461,"runtime_lift":0.3612108752,"key":["s086577522","s262645557"]} +{"user_id":"u052332717","problem_id":"p03610","language":"python","submission_id_v0":"s818460798","submission_id_v1":"s873612258","cpu_time_v0":45,"cpu_time_v1":41,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.89,"input":"s = eval(input())\n\nx = ''\n\n\n\nfor i in range(len(s)):\n\n if i%2 == 0:\n\n x += s[i:i+1]\n\n\n\nprint(x)","target":"s = eval(input())\n\nans = ''\n\nfor i in range(len(s)):\n\n if i%2 == 0:\n\n ans += s[i]\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":99,"code_v1_num_chars":97,"code_v0_no_empty_lines":"s = eval(input())\nx = \"\"\nfor i in range(len(s)):\n if i % 2 == 0:\n x += s[i : i + 1]\nprint(x)\n","code_v1_no_empty_lines":"s = eval(input())\nans = \"\"\nfor i in range(len(s)):\n if i % 2 == 0:\n ans += s[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-x = \"\"","+ans = \"\"","- x += s[i : i + 1]","-print(x)","+ ans += s[i]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0394807339,"measured_runtime_v1":0.0783398151,"runtime_lift":0.503967667,"key":["s818460798","s873612258"]} +{"user_id":"u867848444","problem_id":"p03168","language":"python","submission_id_v0":"s439661864","submission_id_v1":"s844762831","cpu_time_v0":893,"cpu_time_v1":820,"memory_v0":269320,"memory_v1":269320,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.17,"input":"n=int(eval(input()))\n\np=list(map(float,input().split()))\n\n\n\nmid=(n+2)\/\/2\n\ndp=[[0]*(n+1) for i in range(n)]\n\ndp[0][0]=1-p[0]\n\ndp[0][1]=p[0]\n\n\n\nfor i in range(n-1):\n\n for j in range(n+1):\n\n if dp[i][j]!=0:\n\n #\u8868\u304c\u51fa\u308b\u3068\u304d\n\n dp[i+1][j+1]+=dp[i][j]*p[i+1]\n\n #\u88cf\n\n dp[i+1][j]+=dp[i][j]*(1-p[i+1])\n\nprint((sum(dp[-1][mid:])))","target":"n=int(eval(input()))\n\np=list(map(float,input().split()))\n\n\n\ndp=[[0]*(n+1) for i in range(n)]\n\n\n\nfor i in range(n):\n\n for j in range(n+1):\n\n\n\n if i==0:\n\n dp[0][0]=1-p[i]\n\n dp[0][1]=p[i]\n\n else:\n\n #\u8868\u304c\u51fa\u308b\n\n if dp[i-1][j-1]!=0:\n\n dp[i][j]+=dp[i-1][j-1]*p[i]\n\n #\u88cf\n\n dp[i][j-1]+=dp[i-1][j-1]*(1-p[i])\n\n\n\nprint((sum(dp[-1][int(n\/2)+1:])))\n\n#print(dp)\n","code_v0_loc":16,"code_v1_loc":20,"code_v0_num_chars":358,"code_v1_num_chars":437,"code_v0_no_empty_lines":"n = int(eval(input()))\np = list(map(float, input().split()))\nmid = (n + 2) \/\/ 2\ndp = [[0] * (n + 1) for i in range(n)]\ndp[0][0] = 1 - p[0]\ndp[0][1] = p[0]\nfor i in range(n - 1):\n for j in range(n + 1):\n if dp[i][j] != 0:\n # \u8868\u304c\u51fa\u308b\u3068\u304d\n dp[i + 1][j + 1] += dp[i][j] * p[i + 1]\n # \u88cf\n dp[i + 1][j] += dp[i][j] * (1 - p[i + 1])\nprint((sum(dp[-1][mid:])))\n","code_v1_no_empty_lines":"n = int(eval(input()))\np = list(map(float, input().split()))\ndp = [[0] * (n + 1) for i in range(n)]\nfor i in range(n):\n for j in range(n + 1):\n if i == 0:\n dp[0][0] = 1 - p[i]\n dp[0][1] = p[i]\n else:\n # \u8868\u304c\u51fa\u308b\n if dp[i - 1][j - 1] != 0:\n dp[i][j] += dp[i - 1][j - 1] * p[i]\n # \u88cf\n dp[i][j - 1] += dp[i - 1][j - 1] * (1 - p[i])\nprint((sum(dp[-1][int(n \/ 2) + 1 :])))\n# print(dp)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-mid = (n + 2) \/\/ 2","-dp[0][0] = 1 - p[0]","-dp[0][1] = p[0]","-for i in range(n - 1):","+for i in range(n):","- if dp[i][j] != 0:","- # \u8868\u304c\u51fa\u308b\u3068\u304d","- dp[i + 1][j + 1] += dp[i][j] * p[i + 1]","- # \u88cf","- dp[i + 1][j] += dp[i][j] * (1 - p[i + 1])","-print((sum(dp[-1][mid:])))","+ if i == 0:","+ dp[0][0] = 1 - p[i]","+ dp[0][1] = p[i]","+ else:","+ # \u8868\u304c\u51fa\u308b","+ if dp[i - 1][j - 1] != 0:","+ dp[i][j] += dp[i - 1][j - 1] * p[i]","+ # \u88cf","+ dp[i][j - 1] += dp[i - 1][j - 1] * (1 - p[i])","+print((sum(dp[-1][int(n \/ 2) + 1 :])))","+# print(dp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1028392279,"measured_runtime_v1":0.099365958,"runtime_lift":1.0349543244,"key":["s439661864","s844762831"]} +{"user_id":"u816631826","problem_id":"p02899","language":"python","submission_id_v0":"s803505628","submission_id_v1":"s896044095","cpu_time_v0":358,"cpu_time_v1":200,"memory_v0":68940,"memory_v1":20704,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.13,"input":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\na = list(enumerate(a, 1))\n\na = sorted(a, key=lambda x:x[1])\n\nres = [a[i][0] for i in range(n)]\n\nprint((*res))","target":"n=int(input())\n\narr=[int(i) for i in input().split()]\n\ndic={}\n\nfor i in range(n):\n\n dic[arr[i]]=i+1\n\nans=[]\n\nfor i in range(1,n+1):\n\n ans.append(dic[i])\n\nfor i in ans:\n\n print(i,end=\" \")\n","code_v0_loc":6,"code_v1_loc":10,"code_v0_num_chars":162,"code_v1_num_chars":196,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\na = list(enumerate(a, 1))\na = sorted(a, key=lambda x: x[1])\nres = [a[i][0] for i in range(n)]\nprint((*res))\n","code_v1_no_empty_lines":"n = int(input())\narr = [int(i) for i in input().split()]\ndic = {}\nfor i in range(n):\n dic[arr[i]] = i + 1\nans = []\nfor i in range(1, n + 1):\n ans.append(dic[i])\nfor i in ans:\n print(i, end=\" \")\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-n = int(eval(input()))","-a = list(map(int, input().split()))","-a = list(enumerate(a, 1))","-a = sorted(a, key=lambda x: x[1])","-res = [a[i][0] for i in range(n)]","-print((*res))","+n = int(input())","+arr = [int(i) for i in input().split()]","+dic = {}","+for i in range(n):","+ dic[arr[i]] = i + 1","+ans = []","+for i in range(1, n + 1):","+ ans.append(dic[i])","+for i in ans:","+ print(i, end=\" \")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0475790112,"measured_runtime_v1":0.076403296,"runtime_lift":0.6227350616,"key":["s803505628","s896044095"]} +{"user_id":"u970197315","problem_id":"p03325","language":"python","submission_id_v0":"s781297570","submission_id_v1":"s120766919","cpu_time_v0":76,"cpu_time_v1":66,"memory_v0":4148,"memory_v1":4148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.16,"input":"# ABC100 C - *3 or \/2\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(N):\n\n x = 0\n\n t = 0\n\n x = A[i]\n\n while x%2==0:\n\n x = x\/\/2\n\n t += 1\n\n ans += t\n\nprint(ans)","target":"def count(x):\n\n cnt=0\n\n while x!=0:\n\n if x%2==0:\n\n x\/\/=2\n\n cnt+=1\n\n else:\n\n break\n\n return cnt\n\nn=int(eval(input()))\n\na=list(map(int,input().split()))\n\nans=0\n\nfor aa in a:\n\n if aa%2==0:\n\n ans+=count(aa)\n\nprint(ans)\n\n\n","code_v0_loc":13,"code_v1_loc":17,"code_v0_num_chars":219,"code_v1_num_chars":277,"code_v0_no_empty_lines":"# ABC100 C - *3 or \/2\nN = int(eval(input()))\nA = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n x = 0\n t = 0\n x = A[i]\n while x % 2 == 0:\n x = x \/\/ 2\n t += 1\n ans += t\nprint(ans)\n","code_v1_no_empty_lines":"def count(x):\n cnt = 0\n while x != 0:\n if x % 2 == 0:\n x \/\/= 2\n cnt += 1\n else:\n break\n return cnt\n\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nans = 0\nfor aa in a:\n if aa % 2 == 0:\n ans += count(aa)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":23.5294117647,"diff":["-# ABC100 C - *3 or \/2","-N = int(eval(input()))","-A = list(map(int, input().split()))","+def count(x):","+ cnt = 0","+ while x != 0:","+ if x % 2 == 0:","+ x \/\/= 2","+ cnt += 1","+ else:","+ break","+ return cnt","+","+","+n = int(eval(input()))","+a = list(map(int, input().split()))","-for i in range(N):","- x = 0","- t = 0","- x = A[i]","- while x % 2 == 0:","- x = x \/\/ 2","- t += 1","- ans += t","+for aa in a:","+ if aa % 2 == 0:","+ ans += count(aa)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0309651349,"measured_runtime_v1":0.0394224715,"runtime_lift":0.7854691412,"key":["s781297570","s120766919"]} +{"user_id":"u759412327","problem_id":"p03137","language":"python","submission_id_v0":"s773895276","submission_id_v1":"s889026813","cpu_time_v0":86,"cpu_time_v1":78,"memory_v0":20488,"memory_v1":20300,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.3,"input":"N,M = list(map(int,input().split()))\n\nX = sorted(list(map(int,input().split())))\n\nD = sorted([X[n+1]-X[n] for n in range(M-1)])\n\n\n\nif M<=N:\n\n print((0))\n\nelse:\n\n print((sum(D[:M-N])))","target":"N,M = list(map(int,input().split()))\n\nX = sorted(map(int,input().split()))\n\nD = sorted(x2-x1 for x1,x2 in zip(X,X[1:]))[::-1]\n\nprint((sum(D[N-1:])))","code_v0_loc":8,"code_v1_loc":4,"code_v0_num_chars":175,"code_v1_num_chars":140,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nX = sorted(list(map(int, input().split())))\nD = sorted([X[n + 1] - X[n] for n in range(M - 1)])\nif M <= N:\n print((0))\nelse:\n print((sum(D[: M - N])))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nX = sorted(map(int, input().split()))\nD = sorted(x2 - x1 for x1, x2 in zip(X, X[1:]))[::-1]\nprint((sum(D[N - 1 :])))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-X = sorted(list(map(int, input().split())))","-D = sorted([X[n + 1] - X[n] for n in range(M - 1)])","-if M <= N:","- print((0))","-else:","- print((sum(D[: M - N])))","+X = sorted(map(int, input().split()))","+D = sorted(x2 - x1 for x1, x2 in zip(X, X[1:]))[::-1]","+print((sum(D[N - 1 :])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0361278718,"measured_runtime_v1":0.0886367018,"runtime_lift":0.4075949466,"key":["s773895276","s889026813"]} +{"user_id":"u814265211","problem_id":"p04043","language":"python","submission_id_v0":"s779024163","submission_id_v1":"s725553871","cpu_time_v0":26,"cpu_time_v1":24,"memory_v0":9048,"memory_v1":9096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.69,"input":"ABC = list(map(int, input().split()))\n\nif ABC.count(5) == 2 and ABC.count(7):\n\n print('YES')\n\nelse:\n\n print('NO')","target":"ABC = list(map(int, input().split()))\n\nif ABC.count(5) == 2 and ABC.count(7) == 1:\n\n print('YES')\n\nelse:\n\n print('NO')","code_v0_loc":5,"code_v1_loc":5,"code_v0_num_chars":119,"code_v1_num_chars":124,"code_v0_no_empty_lines":"ABC = list(map(int, input().split()))\nif ABC.count(5) == 2 and ABC.count(7):\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_v1_no_empty_lines":"ABC = list(map(int, input().split()))\nif ABC.count(5) == 2 and ABC.count(7) == 1:\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-if ABC.count(5) == 2 and ABC.count(7):","+if ABC.count(5) == 2 and ABC.count(7) == 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.04410338,"measured_runtime_v1":0.0394286569,"runtime_lift":1.1185615617,"key":["s779024163","s725553871"]} +{"user_id":"u597374218","problem_id":"p03377","language":"python","submission_id_v0":"s586207173","submission_id_v1":"s451158057","cpu_time_v0":23,"cpu_time_v1":18,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.74,"input":"A, B, X = list(map(int, input().split()))\n\nprint((\"YES\" if A <= X and X <= A+B else \"NO\"))","target":"A, B, X = list(map(int, input().split()))\n\nprint((\"YES\" if A <= X <= A+B else \"NO\"))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":82,"code_v1_num_chars":76,"code_v0_no_empty_lines":"A, B, X = list(map(int, input().split()))\nprint((\"YES\" if A <= X and X <= A + B else \"NO\"))\n","code_v1_no_empty_lines":"A, B, X = list(map(int, input().split()))\nprint((\"YES\" if A <= X <= A + B else \"NO\"))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((\"YES\" if A <= X and X <= A + B else \"NO\"))","+print((\"YES\" if A <= X <= A + B else \"NO\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0479968078,"measured_runtime_v1":0.0425129406,"runtime_lift":1.1289928919,"key":["s586207173","s451158057"]} +{"user_id":"u691018832","problem_id":"p02714","language":"python","submission_id_v0":"s395782187","submission_id_v1":"s378569331","cpu_time_v0":1424,"cpu_time_v1":1246,"memory_v0":9288,"memory_v1":9220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nn = int(readline())\n\ns = eval(input())\n\nrgb = [0, 0, 0]\n\nfor i in range(n):\n\n if s[i] == 'R':\n\n rgb[0] += 1\n\n elif s[i] == 'G':\n\n rgb[1] += 1\n\n else:\n\n rgb[2] += 1\n\nans = rgb[0] * rgb[1] * rgb[2]\n\nfor i in range(n):\n\n for j in range(i + 1, n):\n\n k = 2 * j - i\n\n if k >= n:\n\n break\n\n if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:\n\n ans -= 1\n\nprint(ans)\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nn = int(readline())\n\ns = readline().rstrip().decode()\n\nans = s.count('R') * s.count('G') * s.count('B')\n\nfor i, si in enumerate(s):\n\n for j, sj in enumerate(s[i + 1:]):\n\n k = 2 * (j + 1) + i\n\n if k >= n:\n\n break\n\n if si != sj and si != s[k] and sj != s[k]:\n\n ans -= 1\n\nprint(ans)\n","code_v0_loc":25,"code_v1_loc":17,"code_v0_num_chars":581,"code_v1_num_chars":480,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**7)\nn = int(readline())\ns = eval(input())\nrgb = [0, 0, 0]\nfor i in range(n):\n if s[i] == \"R\":\n rgb[0] += 1\n elif s[i] == \"G\":\n rgb[1] += 1\n else:\n rgb[2] += 1\nans = rgb[0] * rgb[1] * rgb[2]\nfor i in range(n):\n for j in range(i + 1, n):\n k = 2 * j - i\n if k >= n:\n break\n if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:\n ans -= 1\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**7)\nn = int(readline())\ns = readline().rstrip().decode()\nans = s.count(\"R\") * s.count(\"G\") * s.count(\"B\")\nfor i, si in enumerate(s):\n for j, sj in enumerate(s[i + 1 :]):\n k = 2 * (j + 1) + i\n if k >= n:\n break\n if si != sj and si != s[k] and sj != s[k]:\n ans -= 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":32.0,"diff":["-s = eval(input())","-rgb = [0, 0, 0]","-for i in range(n):","- if s[i] == \"R\":","- rgb[0] += 1","- elif s[i] == \"G\":","- rgb[1] += 1","- else:","- rgb[2] += 1","-ans = rgb[0] * rgb[1] * rgb[2]","-for i in range(n):","- for j in range(i + 1, n):","- k = 2 * j - i","+s = readline().rstrip().decode()","+ans = s.count(\"R\") * s.count(\"G\") * s.count(\"B\")","+for i, si in enumerate(s):","+ for j, sj in enumerate(s[i + 1 :]):","+ k = 2 * (j + 1) + i","- if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:","+ if si != sj and si != s[k] and sj != s[k]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.046588001,"measured_runtime_v1":0.0452957805,"runtime_lift":1.0285284962,"key":["s395782187","s378569331"]} +{"user_id":"u773077120","problem_id":"p02660","language":"python","submission_id_v0":"s751400228","submission_id_v1":"s166217407","cpu_time_v0":663,"cpu_time_v1":354,"memory_v0":9080,"memory_v1":9228,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.61,"input":"N = int(eval(input()))\n\nn, p, score = N, 2, 0\n\nwhile p ** 2 <= N:\n\n e = 1\n\n while n % (p ** e) == 0:\n\n n \/\/= (p ** e)\n\n score += 1\n\n e += 1\n\n else:\n\n while n % p == 0:\n\n n \/\/= p\n\n p += 1\n\nelse:\n\n if n != 1:\n\n score += 1\n\nprint(score)","target":"N = int(eval(input()))\n\nn, p, score = N, 2, 0\n\nwhile p ** 2 <= N:\n\n e = 1\n\n while n % (p ** e) == 0:\n\n n \/\/= (p ** e)\n\n score += 1\n\n e += 1\n\n else:\n\n while n % p == 0:\n\n n \/\/= p\n\n p = p + 1 if p == 2 else p + 2\n\nelse:\n\n if n != 1:\n\n score += 1\n\nprint(score)","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":254,"code_v1_num_chars":278,"code_v0_no_empty_lines":"N = int(eval(input()))\nn, p, score = N, 2, 0\nwhile p**2 <= N:\n e = 1\n while n % (p**e) == 0:\n n \/\/= p**e\n score += 1\n e += 1\n else:\n while n % p == 0:\n n \/\/= p\n p += 1\nelse:\n if n != 1:\n score += 1\nprint(score)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nn, p, score = N, 2, 0\nwhile p**2 <= N:\n e = 1\n while n % (p**e) == 0:\n n \/\/= p**e\n score += 1\n e += 1\n else:\n while n % p == 0:\n n \/\/= p\n p = p + 1 if p == 2 else p + 2\nelse:\n if n != 1:\n score += 1\nprint(score)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- p += 1","+ p = p + 1 if p == 2 else p + 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.2356546949,"measured_runtime_v1":0.1260519463,"runtime_lift":1.8695046109,"key":["s751400228","s166217407"]} +{"user_id":"u189023301","problem_id":"p02947","language":"python","submission_id_v0":"s501089594","submission_id_v1":"s024018818","cpu_time_v0":789,"cpu_time_v1":223,"memory_v0":20048,"memory_v1":17852,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":71.74,"input":"from collections import Counter\n\nimport sys\n\ninput = sys.stdin.buffer.readline\n\nans = {}\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n for i in range(n):\n\n dic = {}\n\n for a in input().strip():\n\n if a in dic:\n\n dic[a] += 1\n\n else:\n\n dic[a] = 1\n\n dic2 = tuple(sorted(dic.items()))\n\n #print(dic2)\n\n tmp = \"\"\n\n for k, v in dic2:\n\n tmp += str(k) + str(v)\n\n if tmp in ans:\n\n ans[tmp] += 1\n\n else:\n\n ans[tmp] = 1\n\n su = 0\n\n for vv in list(ans.values()):\n\n su += vv * (vv -1) \/\/ 2\n\n print(su)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n dic = {}\n\n for i in range(n):\n\n a = ''.join(sorted(input().rstrip()))\n\n if a in dic:\n\n dic[a] += 1\n\n else:\n\n dic[a] = 1\n\n su = 0\n\n for v in list(dic.values()):\n\n su += v * (v - 1) \/\/ 2\n\n print(su)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":30,"code_v1_loc":19,"code_v0_num_chars":674,"code_v1_num_chars":376,"code_v0_no_empty_lines":"from collections import Counter\nimport sys\n\ninput = sys.stdin.buffer.readline\nans = {}\n\n\ndef main():\n n = int(eval(input()))\n for i in range(n):\n dic = {}\n for a in input().strip():\n if a in dic:\n dic[a] += 1\n else:\n dic[a] = 1\n dic2 = tuple(sorted(dic.items()))\n # print(dic2)\n tmp = \"\"\n for k, v in dic2:\n tmp += str(k) + str(v)\n if tmp in ans:\n ans[tmp] += 1\n else:\n ans[tmp] = 1\n su = 0\n for vv in list(ans.values()):\n su += vv * (vv - 1) \/\/ 2\n print(su)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(eval(input()))\n dic = {}\n for i in range(n):\n a = \"\".join(sorted(input().rstrip()))\n if a in dic:\n dic[a] += 1\n else:\n dic[a] = 1\n su = 0\n for v in list(dic.values()):\n su += v * (v - 1) \/\/ 2\n print(su)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":36.6666666667,"diff":["-from collections import Counter","-input = sys.stdin.buffer.readline","-ans = {}","+input = sys.stdin.readline","+ dic = {}","- dic = {}","- for a in input().strip():","- if a in dic:","- dic[a] += 1","- else:","- dic[a] = 1","- dic2 = tuple(sorted(dic.items()))","- # print(dic2)","- tmp = \"\"","- for k, v in dic2:","- tmp += str(k) + str(v)","- if tmp in ans:","- ans[tmp] += 1","+ a = \"\".join(sorted(input().rstrip()))","+ if a in dic:","+ dic[a] += 1","- ans[tmp] = 1","+ dic[a] = 1","- for vv in list(ans.values()):","- su += vv * (vv - 1) \/\/ 2","+ for v in list(dic.values()):","+ su += v * (v - 1) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0318715708,"measured_runtime_v1":0.0405848715,"runtime_lift":0.7853066824,"key":["s501089594","s024018818"]} +{"user_id":"u560867850","problem_id":"p02713","language":"python","submission_id_v0":"s056439104","submission_id_v1":"s296617766","cpu_time_v0":471,"cpu_time_v1":336,"memory_v0":9572,"memory_v1":9192,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.66,"input":"from math import gcd\n\nfrom functools import lru_cache\n\nfrom itertools import combinations\n\n\n\na = int(eval(input()))\n\n\n\ndef main():\n\n for i in range(1, a+1):\n\n for j in range(i, a+1):\n\n for k in range(j, a+1):\n\n x = len({i, j, k})\n\n if x == 1:\n\n x = 1\n\n elif x == 2:\n\n x = 3\n\n else:\n\n x = 6\n\n yield gcd(gcd(i, j), k) * x\n\n\n\nprint((sum(main())))\n\n\n","target":"from math import gcd\n\n\n\na = int(eval(input()))\n\n\n\ndef main():\n\n for i in range(1, a+1):\n\n for j in range(i, a+1):\n\n ab = gcd(i, j)\n\n for k in range(j, a+1):\n\n x = len({i, j, k})\n\n if x == 1:\n\n x = 1\n\n elif x == 2:\n\n x = 3\n\n else:\n\n x = 6\n\n yield gcd(ab, k) * x\n\n\n\nprint((sum(main())))\n\n\n","code_v0_loc":21,"code_v1_loc":20,"code_v0_num_chars":491,"code_v1_num_chars":443,"code_v0_no_empty_lines":"from math import gcd\nfrom functools import lru_cache\nfrom itertools import combinations\n\na = int(eval(input()))\n\n\ndef main():\n for i in range(1, a + 1):\n for j in range(i, a + 1):\n for k in range(j, a + 1):\n x = len({i, j, k})\n if x == 1:\n x = 1\n elif x == 2:\n x = 3\n else:\n x = 6\n yield gcd(gcd(i, j), k) * x\n\n\nprint((sum(main())))\n","code_v1_no_empty_lines":"from math import gcd\n\na = int(eval(input()))\n\n\ndef main():\n for i in range(1, a + 1):\n for j in range(i, a + 1):\n ab = gcd(i, j)\n for k in range(j, a + 1):\n x = len({i, j, k})\n if x == 1:\n x = 1\n elif x == 2:\n x = 3\n else:\n x = 6\n yield gcd(ab, k) * x\n\n\nprint((sum(main())))\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["-from functools import lru_cache","-from itertools import combinations","+ ab = gcd(i, j)","- yield gcd(gcd(i, j), k) * x","+ yield gcd(ab, k) * x"],"diff_only_import_comment":false,"measured_runtime_v0":0.1360704033,"measured_runtime_v1":0.0528587573,"runtime_lift":2.5742263037,"key":["s056439104","s296617766"]} +{"user_id":"u007270338","problem_id":"p02242","language":"python","submission_id_v0":"s174549709","submission_id_v1":"s321564363","cpu_time_v0":40,"cpu_time_v1":20,"memory_v0":6240,"memory_v1":5732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"#coding:utf-8\n\ninf = 1000000\n\nn = int(eval(input()))\n\nM = [[inf for i in range(n)] for j in range(n)]\n\nvwMtrx = []\n\nfor i in range(n):\n\n data = list(map(int,input().split()))\n\n u = data[0]\n\n k = data[1]\n\n col = []\n\n for j in range(0,2*k,2):\n\n v, w = data[j+2], data[j+3]\n\n M[u][v] = w\n\n col.append([v,w])\n\n vwMtrx.append(col)\n\n\n\ndef dijkstra(s):\n\n color = [\"white\" for i in range(n)]\n\n d = [inf for i in range(n)]\n\n p = [-1 for i in range(n)]\n\n d[s] = 0\n\n Q = [[s,0]]\n\n while Q != []:\n\n u = min(Q, key=lambda x:x[1])\n\n Q = [List for List in Q if List != u]\n\n u = u[0]\n\n color[u] = \"black\"\n\n\n\n vwList = vwMtrx[u]\n\n \n\n for vw in vwList:\n\n v,w = vw[0],vw[1]\n\n if color[v] != \"black\" and M[u][v] != inf:\n\n if d[u] + M[u][v] < d[v]:\n\n d[v] = d[u] + M[u][v]\n\n p[v] = u\n\n color[v] = \"gray\"\n\n Q.append([v, d[v]])\n\n\n\n return d\n\n\n\ndList = dijkstra(0)\n\nfor i, d in enumerate(dList):\n\n print((i,d))\n\n\n","target":"#coding: utf-8\n\n\n\ninf = 1000000000\n\n\n\n\n\ndef dijkstra(s):\n\n d = [inf for i in range(n)]\n\n color = [\"white\" for i in range(n)]\n\n p = [-1 for i in range(n)]\n\n d[s] = 0\n\n\n\n while True:\n\n mincost = inf\n\n for i in range(n):\n\n if color[i] != \"black\" and d[i] < mincost:\n\n mincost = d[i]\n\n u = i\n\n if mincost == inf:\n\n break\n\n\n\n color[u] = \"black\"\n\n\n\n for v in range(n):\n\n if color[v] != \"black\" and mtrx[u][v] != False:\n\n if d[u] + mtrx[u][v] < d[v]:\n\n d[v] = d[u] + mtrx[u][v]\n\n p[v] = u\n\n color[v] = \"gray\"\n\n return d\n\n\n\nn = int(eval(input()))\n\nmtrx = [[False for j in range(n)] for i in range(n)]\n\nfor i in range(n):\n\n data = list(map(int,input().split()))\n\n k = data[1]\n\n for num in range(k):\n\n mtrx[i][data[2+2*num]] = data[2+2*num+1]\n\n\n\nd = dijkstra(0)\n\n\n\nfor i, num in enumerate(d):\n\n print((i,num))\n\n\n","code_v0_loc":45,"code_v1_loc":43,"code_v0_num_chars":1106,"code_v1_num_chars":1001,"code_v0_no_empty_lines":"# coding:utf-8\ninf = 1000000\nn = int(eval(input()))\nM = [[inf for i in range(n)] for j in range(n)]\nvwMtrx = []\nfor i in range(n):\n data = list(map(int, input().split()))\n u = data[0]\n k = data[1]\n col = []\n for j in range(0, 2 * k, 2):\n v, w = data[j + 2], data[j + 3]\n M[u][v] = w\n col.append([v, w])\n vwMtrx.append(col)\n\n\ndef dijkstra(s):\n color = [\"white\" for i in range(n)]\n d = [inf for i in range(n)]\n p = [-1 for i in range(n)]\n d[s] = 0\n Q = [[s, 0]]\n while Q != []:\n u = min(Q, key=lambda x: x[1])\n Q = [List for List in Q if List != u]\n u = u[0]\n color[u] = \"black\"\n vwList = vwMtrx[u]\n for vw in vwList:\n v, w = vw[0], vw[1]\n if color[v] != \"black\" and M[u][v] != inf:\n if d[u] + M[u][v] < d[v]:\n d[v] = d[u] + M[u][v]\n p[v] = u\n color[v] = \"gray\"\n Q.append([v, d[v]])\n return d\n\n\ndList = dijkstra(0)\nfor i, d in enumerate(dList):\n print((i, d))\n","code_v1_no_empty_lines":"# coding: utf-8\ninf = 1000000000\n\n\ndef dijkstra(s):\n d = [inf for i in range(n)]\n color = [\"white\" for i in range(n)]\n p = [-1 for i in range(n)]\n d[s] = 0\n while True:\n mincost = inf\n for i in range(n):\n if color[i] != \"black\" and d[i] < mincost:\n mincost = d[i]\n u = i\n if mincost == inf:\n break\n color[u] = \"black\"\n for v in range(n):\n if color[v] != \"black\" and mtrx[u][v] != False:\n if d[u] + mtrx[u][v] < d[v]:\n d[v] = d[u] + mtrx[u][v]\n p[v] = u\n color[v] = \"gray\"\n return d\n\n\nn = int(eval(input()))\nmtrx = [[False for j in range(n)] for i in range(n)]\nfor i in range(n):\n data = list(map(int, input().split()))\n k = data[1]\n for num in range(k):\n mtrx[i][data[2 + 2 * num]] = data[2 + 2 * num + 1]\nd = dijkstra(0)\nfor i, num in enumerate(d):\n print((i, num))\n","code_same":false,"relative_loc_diff_percent":4.4444444444,"diff":["-# coding:utf-8","-inf = 1000000","-n = int(eval(input()))","-M = [[inf for i in range(n)] for j in range(n)]","-vwMtrx = []","-for i in range(n):","- data = list(map(int, input().split()))","- u = data[0]","- k = data[1]","- col = []","- for j in range(0, 2 * k, 2):","- v, w = data[j + 2], data[j + 3]","- M[u][v] = w","- col.append([v, w])","- vwMtrx.append(col)","+# coding: utf-8","+inf = 1000000000","+ d = [inf for i in range(n)]","- d = [inf for i in range(n)]","- Q = [[s, 0]]","- while Q != []:","- u = min(Q, key=lambda x: x[1])","- Q = [List for List in Q if List != u]","- u = u[0]","+ while True:","+ mincost = inf","+ for i in range(n):","+ if color[i] != \"black\" and d[i] < mincost:","+ mincost = d[i]","+ u = i","+ if mincost == inf:","+ break","- vwList = vwMtrx[u]","- for vw in vwList:","- v, w = vw[0], vw[1]","- if color[v] != \"black\" and M[u][v] != inf:","- if d[u] + M[u][v] < d[v]:","- d[v] = d[u] + M[u][v]","+ for v in range(n):","+ if color[v] != \"black\" and mtrx[u][v] != False:","+ if d[u] + mtrx[u][v] < d[v]:","+ d[v] = d[u] + mtrx[u][v]","- Q.append([v, d[v]])","-dList = dijkstra(0)","-for i, d in enumerate(dList):","- print((i, d))","+n = int(eval(input()))","+mtrx = [[False for j in range(n)] for i in range(n)]","+for i in range(n):","+ data = list(map(int, input().split()))","+ k = data[1]","+ for num in range(k):","+ mtrx[i][data[2 + 2 * num]] = data[2 + 2 * num + 1]","+d = dijkstra(0)","+for i, num in enumerate(d):","+ print((i, num))"],"diff_only_import_comment":false,"measured_runtime_v0":0.047344923,"measured_runtime_v1":0.0369867325,"runtime_lift":1.2800515165,"key":["s174549709","s321564363"]} +{"user_id":"u411203878","problem_id":"p03665","language":"python","submission_id_v0":"s096787264","submission_id_v1":"s818457081","cpu_time_v0":167,"cpu_time_v1":76,"memory_v0":38568,"memory_v1":62112,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.49,"input":"import math\n\n \n\ndef combination(n, k):\n\n return math.factorial(n) \/\/ math.factorial(k) \/\/ math.factorial(n - k)\n\n \n\n\n\nn,p = list(map(int,input().split()))\n\n\n\nt = list(map(int,input().split()))\n\n\n\ngu = 0\n\n\n\nki = 0\n\n\n\nfor i in t:\n\n if i%2==0:\n\n gu += 1\n\n else:\n\n ki += 1\n\n\n\ngukumi = 0\n\n\n\nkikumi = 0\n\n\n\nfor i in range(1,gu+1):\n\n gukumi += combination(gu,i)\n\n\n\nif p == 0:\n\n for i in range(2,ki+1,2):\n\n kikumi += combination(ki,i)\n\n ans = kikumi+1+gukumi\n\nelse:\n\n for i in range(1,ki+1,2):\n\n kikumi += combination(ki,i)\n\n ans = kikumi\n\n \n\n\n\nans += gukumi*kikumi\n\n\n\nprint(ans)","target":"import math\n\n \n\ndef combination(n, k):\n\n return math.factorial(n) \/\/ math.factorial(k) \/\/ math.factorial(n - k) \n\n\n\nN,P = list(map(int,input().split()))\n\n\n\nA = list(map(int,input().split()))\n\n\n\nkisu = 0\n\ngusu = 0\n\n\n\nfor a in A:\n\n if a%2 == 0:\n\n gusu += 1\n\n else:\n\n kisu += 1\n\n\n\nsum_gu = 2**gusu\n\n\n\nif P%2==0:\n\n sum_ki = 0\n\n for i in range(2,kisu+1, 2):\n\n sum_ki += combination(kisu, i)\n\n sum_ki *= sum_gu\n\n print((sum_gu+sum_ki))\n\nelse:\n\n sum_ki = 0\n\n for i in range(1,kisu+1, 2):\n\n sum_ki += combination(kisu, i)\n\n print((sum_gu*sum_ki))","code_v0_loc":40,"code_v1_loc":31,"code_v0_num_chars":619,"code_v1_num_chars":589,"code_v0_no_empty_lines":"import math\n\n\ndef combination(n, k):\n return math.factorial(n) \/\/ math.factorial(k) \/\/ math.factorial(n - k)\n\n\nn, p = list(map(int, input().split()))\nt = list(map(int, input().split()))\ngu = 0\nki = 0\nfor i in t:\n if i % 2 == 0:\n gu += 1\n else:\n ki += 1\ngukumi = 0\nkikumi = 0\nfor i in range(1, gu + 1):\n gukumi += combination(gu, i)\nif p == 0:\n for i in range(2, ki + 1, 2):\n kikumi += combination(ki, i)\n ans = kikumi + 1 + gukumi\nelse:\n for i in range(1, ki + 1, 2):\n kikumi += combination(ki, i)\n ans = kikumi\nans += gukumi * kikumi\nprint(ans)\n","code_v1_no_empty_lines":"import math\n\n\ndef combination(n, k):\n return math.factorial(n) \/\/ math.factorial(k) \/\/ math.factorial(n - k)\n\n\nN, P = list(map(int, input().split()))\nA = list(map(int, input().split()))\nkisu = 0\ngusu = 0\nfor a in A:\n if a % 2 == 0:\n gusu += 1\n else:\n kisu += 1\nsum_gu = 2**gusu\nif P % 2 == 0:\n sum_ki = 0\n for i in range(2, kisu + 1, 2):\n sum_ki += combination(kisu, i)\n sum_ki *= sum_gu\n print((sum_gu + sum_ki))\nelse:\n sum_ki = 0\n for i in range(1, kisu + 1, 2):\n sum_ki += combination(kisu, i)\n print((sum_gu * sum_ki))\n","code_same":false,"relative_loc_diff_percent":22.5,"diff":["-n, p = list(map(int, input().split()))","-t = list(map(int, input().split()))","-gu = 0","-ki = 0","-for i in t:","- if i % 2 == 0:","- gu += 1","+N, P = list(map(int, input().split()))","+A = list(map(int, input().split()))","+kisu = 0","+gusu = 0","+for a in A:","+ if a % 2 == 0:","+ gusu += 1","- ki += 1","-gukumi = 0","-kikumi = 0","-for i in range(1, gu + 1):","- gukumi += combination(gu, i)","-if p == 0:","- for i in range(2, ki + 1, 2):","- kikumi += combination(ki, i)","- ans = kikumi + 1 + gukumi","+ kisu += 1","+sum_gu = 2**gusu","+if P % 2 == 0:","+ sum_ki = 0","+ for i in range(2, kisu + 1, 2):","+ sum_ki += combination(kisu, i)","+ sum_ki *= sum_gu","+ print((sum_gu + sum_ki))","- for i in range(1, ki + 1, 2):","- kikumi += combination(ki, i)","- ans = kikumi","-ans += gukumi * kikumi","-print(ans)","+ sum_ki = 0","+ for i in range(1, kisu + 1, 2):","+ sum_ki += combination(kisu, i)","+ print((sum_gu * sum_ki))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0757302611,"measured_runtime_v1":0.0715153303,"runtime_lift":1.0589374438,"key":["s096787264","s818457081"]} +{"user_id":"u597455618","problem_id":"p03151","language":"python","submission_id_v0":"s648654362","submission_id_v1":"s490996677","cpu_time_v0":100,"cpu_time_v1":85,"memory_v0":24048,"memory_v1":24300,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\ncnt, nega, posi = 0, 0, []\n\nfor x, y in zip(a, b):\n\n if x < y:\n\n nega += y - x\n\n cnt += 1\n\n else:\n\n posi.append(x - y)\n\nif nega > 0:\n\n posi.sort(reverse=True)\n\n for i, x in enumerate(posi):\n\n nega -= x\n\n if nega <= 0:\n\n cnt += i + 1\n\n break\n\n else:\n\n cnt = -1\n\nprint(cnt)","target":"def main():\n\n n = int(eval(input()))\n\n a = list(map(int, input().split()))\n\n b = list(map(int, input().split()))\n\n cnt, nega, posi = 0, 0, []\n\n for x, y in zip(a, b):\n\n if x < y:\n\n nega += y - x\n\n cnt += 1\n\n else:\n\n posi.append(x - y)\n\n if sum(posi) - nega < 0:\n\n print((-1))\n\n exit()\n\n posi.sort(reverse=True)\n\n i = 0\n\n while nega > 0:\n\n nega -= posi[i]\n\n cnt += 1\n\n i += 1\n\n print(cnt)\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":20,"code_v1_loc":24,"code_v0_num_chars":442,"code_v1_num_chars":533,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\ncnt, nega, posi = 0, 0, []\nfor x, y in zip(a, b):\n if x < y:\n nega += y - x\n cnt += 1\n else:\n posi.append(x - y)\nif nega > 0:\n posi.sort(reverse=True)\n for i, x in enumerate(posi):\n nega -= x\n if nega <= 0:\n cnt += i + 1\n break\n else:\n cnt = -1\nprint(cnt)\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n cnt, nega, posi = 0, 0, []\n for x, y in zip(a, b):\n if x < y:\n nega += y - x\n cnt += 1\n else:\n posi.append(x - y)\n if sum(posi) - nega < 0:\n print((-1))\n exit()\n posi.sort(reverse=True)\n i = 0\n while nega > 0:\n nega -= posi[i]\n cnt += 1\n i += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-n = int(eval(input()))","-a = list(map(int, input().split()))","-b = list(map(int, input().split()))","-cnt, nega, posi = 0, 0, []","-for x, y in zip(a, b):","- if x < y:","- nega += y - x","+def main():","+ n = int(eval(input()))","+ a = list(map(int, input().split()))","+ b = list(map(int, input().split()))","+ cnt, nega, posi = 0, 0, []","+ for x, y in zip(a, b):","+ if x < y:","+ nega += y - x","+ cnt += 1","+ else:","+ posi.append(x - y)","+ if sum(posi) - nega < 0:","+ print((-1))","+ exit()","+ posi.sort(reverse=True)","+ i = 0","+ while nega > 0:","+ nega -= posi[i]","- else:","- posi.append(x - y)","-if nega > 0:","- posi.sort(reverse=True)","- for i, x in enumerate(posi):","- nega -= x","- if nega <= 0:","- cnt += i + 1","- break","- else:","- cnt = -1","-print(cnt)","+ i += 1","+ print(cnt)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0493281701,"measured_runtime_v1":0.050160224,"runtime_lift":0.9834120775,"key":["s648654362","s490996677"]} +{"user_id":"u759412327","problem_id":"p04030","language":"python","submission_id_v0":"s328582436","submission_id_v1":"s821991349","cpu_time_v0":29,"cpu_time_v1":24,"memory_v0":8780,"memory_v1":9028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.24,"input":"a = \"\"\n\n\n\nfor s in eval(input()):\n\n if s==\"B\":\n\n if len(a)!=0:\n\n a=a[:-1]\n\n else:\n\n a+=s\n\n\n\nprint(a)","target":"a = \"\"\n\n\n\nfor s in eval(input()):\n\n if s==\"B\":\n\n a=a[:-1]\n\n else:\n\n a+=s\n\n\n\nprint(a)","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":107,"code_v1_num_chars":86,"code_v0_no_empty_lines":"a = \"\"\nfor s in eval(input()):\n if s == \"B\":\n if len(a) != 0:\n a = a[:-1]\n else:\n a += s\nprint(a)\n","code_v1_no_empty_lines":"a = \"\"\nfor s in eval(input()):\n if s == \"B\":\n a = a[:-1]\n else:\n a += s\nprint(a)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["- if len(a) != 0:","- a = a[:-1]","+ a = a[:-1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0594654777,"measured_runtime_v1":0.0582995973,"runtime_lift":1.0199980872,"key":["s328582436","s821991349"]} +{"user_id":"u117980998","problem_id":"p03038","language":"python","submission_id_v0":"s173497467","submission_id_v1":"s527888341","cpu_time_v0":748,"cpu_time_v1":452,"memory_v0":80664,"memory_v1":73496,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.57,"input":"n,m = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\n\n\nbc =[]\n\nfor i in range(m):\n\n b,c = list(map(int,input().split()))\n\n bc.append((b,c))\n\n\n\nbc.sort(key=lambda x:x[1],reverse=True)\n\nnewcard=[]\n\nfor b,c in bc:\n\n newcard.extend([c]*b)\n\n if(len(newcard)>=n):\n\n break\n\n\n\nsize = min(n,len(newcard))\n\na.sort()\n\nfor i in range(size):\n\n if(newcard[i]>a[i]):\n\n a[i]=newcard[i]\n\n else:\n\n break\n\nprint((sum(a)))","target":"import sys\n\ninput = sys.stdin.readline\n\nn,m = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\n\n\nbc =[]\n\nfor i in range(m):\n\n b,c = list(map(int,input().split()))\n\n bc.append((b,c))\n\n\n\nbc.sort(key=lambda x:x[1],reverse=True)\n\nnewcard=[]\n\nfor b,c in bc:\n\n newcard.extend([c]*b)\n\n if(len(newcard)>=n):\n\n break\n\na += newcard\n\na.sort(reverse=True)\n\nprint((sum(a[:n])))","code_v0_loc":23,"code_v1_loc":19,"code_v0_num_chars":448,"code_v1_num_chars":388,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = []\nfor i in range(m):\n b, c = list(map(int, input().split()))\n bc.append((b, c))\nbc.sort(key=lambda x: x[1], reverse=True)\nnewcard = []\nfor b, c in bc:\n newcard.extend([c] * b)\n if len(newcard) >= n:\n break\nsize = min(n, len(newcard))\na.sort()\nfor i in range(size):\n if newcard[i] > a[i]:\n a[i] = newcard[i]\n else:\n break\nprint((sum(a)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = []\nfor i in range(m):\n b, c = list(map(int, input().split()))\n bc.append((b, c))\nbc.sort(key=lambda x: x[1], reverse=True)\nnewcard = []\nfor b, c in bc:\n newcard.extend([c] * b)\n if len(newcard) >= n:\n break\na += newcard\na.sort(reverse=True)\nprint((sum(a[:n])))\n","code_same":false,"relative_loc_diff_percent":17.3913043478,"diff":["+import sys","+","+input = sys.stdin.readline","-size = min(n, len(newcard))","-a.sort()","-for i in range(size):","- if newcard[i] > a[i]:","- a[i] = newcard[i]","- else:","- break","-print((sum(a)))","+a += newcard","+a.sort(reverse=True)","+print((sum(a[:n])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0462789087,"measured_runtime_v1":0.0464881516,"runtime_lift":0.9954990073,"key":["s173497467","s527888341"]} +{"user_id":"u347640436","problem_id":"p02793","language":"python","submission_id_v0":"s137131306","submission_id_v1":"s875056497","cpu_time_v0":480,"cpu_time_v1":425,"memory_v0":14540,"memory_v1":20204,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.46,"input":"# \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9, \u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c0f\u5b9a\u7406\n\nmax_A = 1000000\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nsieve = [0] * (max_A + 1)\n\nsieve[0] = -1\n\nsieve[1] = -1\n\nfor i in range(2, max_A + 1):\n\n if sieve[i] != 0:\n\n continue\n\n sieve[i] = i\n\n for j in range(i * i, max_A + 1, i):\n\n if sieve[j] == 0:\n\n sieve[j] = i\n\n\n\nlcm_factors = {}\n\nfor i in range(N):\n\n t = []\n\n a = A[i]\n\n while a != 1:\n\n if len(t) != 0 and t[-1][0] == sieve[a]:\n\n t[-1][1] += 1\n\n else:\n\n t.append([sieve[a], 1])\n\n a \/\/= sieve[a]\n\n for k, v in t:\n\n if k not in lcm_factors or lcm_factors[k] < v:\n\n lcm_factors[k] = v\n\n\n\nlcm = 1\n\nfor k in lcm_factors:\n\n for i in range(lcm_factors[k]):\n\n lcm *= k\n\n lcm %= 1000000007\n\n\n\nresult = 0\n\nfor i in range(N):\n\n result += lcm * pow(A[i], 1000000007-2, 1000000007)\n\n result %= 1000000007\n\nprint(result)\n","target":"# \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9, \u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c0f\u5b9a\u7406\n\nmax_A = 1000000\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nm = 1000000007\n\n\n\nsieve = [0] * (max_A + 1)\n\nsieve[0] = -1\n\nsieve[1] = -1\n\nfor i in range(2, max_A + 1):\n\n if sieve[i] != 0:\n\n continue\n\n sieve[i] = i\n\n for j in range(i * i, max_A + 1, i):\n\n if sieve[j] == 0:\n\n sieve[j] = i\n\n\n\nlcm_factors = {}\n\nfor i in range(N):\n\n t = []\n\n a = A[i]\n\n while a != 1:\n\n if len(t) != 0 and t[-1][0] == sieve[a]:\n\n t[-1][1] += 1\n\n else:\n\n t.append([sieve[a], 1])\n\n a \/\/= sieve[a]\n\n for k, v in t:\n\n if k not in lcm_factors or lcm_factors[k] < v:\n\n lcm_factors[k] = v\n\n\n\nlcm = 1\n\nfor k in lcm_factors:\n\n for i in range(lcm_factors[k]):\n\n lcm *= k\n\n lcm %= m\n\n\n\nresult = 0\n\nfor i in range(N):\n\n result += lcm * pow(A[i], m - 2, m)\n\n result %= m\n\nprint(result)\n","code_v0_loc":42,"code_v1_loc":44,"code_v0_num_chars":935,"code_v1_num_chars":919,"code_v0_no_empty_lines":"# \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9, \u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c0f\u5b9a\u7406\nmax_A = 1000000\nN = int(eval(input()))\nA = list(map(int, input().split()))\nsieve = [0] * (max_A + 1)\nsieve[0] = -1\nsieve[1] = -1\nfor i in range(2, max_A + 1):\n if sieve[i] != 0:\n continue\n sieve[i] = i\n for j in range(i * i, max_A + 1, i):\n if sieve[j] == 0:\n sieve[j] = i\nlcm_factors = {}\nfor i in range(N):\n t = []\n a = A[i]\n while a != 1:\n if len(t) != 0 and t[-1][0] == sieve[a]:\n t[-1][1] += 1\n else:\n t.append([sieve[a], 1])\n a \/\/= sieve[a]\n for k, v in t:\n if k not in lcm_factors or lcm_factors[k] < v:\n lcm_factors[k] = v\nlcm = 1\nfor k in lcm_factors:\n for i in range(lcm_factors[k]):\n lcm *= k\n lcm %= 1000000007\nresult = 0\nfor i in range(N):\n result += lcm * pow(A[i], 1000000007 - 2, 1000000007)\n result %= 1000000007\nprint(result)\n","code_v1_no_empty_lines":"# \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9, \u30d5\u30a7\u30eb\u30de\u30fc\u306e\u5c0f\u5b9a\u7406\nmax_A = 1000000\nN = int(eval(input()))\nA = list(map(int, input().split()))\nm = 1000000007\nsieve = [0] * (max_A + 1)\nsieve[0] = -1\nsieve[1] = -1\nfor i in range(2, max_A + 1):\n if sieve[i] != 0:\n continue\n sieve[i] = i\n for j in range(i * i, max_A + 1, i):\n if sieve[j] == 0:\n sieve[j] = i\nlcm_factors = {}\nfor i in range(N):\n t = []\n a = A[i]\n while a != 1:\n if len(t) != 0 and t[-1][0] == sieve[a]:\n t[-1][1] += 1\n else:\n t.append([sieve[a], 1])\n a \/\/= sieve[a]\n for k, v in t:\n if k not in lcm_factors or lcm_factors[k] < v:\n lcm_factors[k] = v\nlcm = 1\nfor k in lcm_factors:\n for i in range(lcm_factors[k]):\n lcm *= k\n lcm %= m\nresult = 0\nfor i in range(N):\n result += lcm * pow(A[i], m - 2, m)\n result %= m\nprint(result)\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["+m = 1000000007","- lcm %= 1000000007","+ lcm %= m","- result += lcm * pow(A[i], 1000000007 - 2, 1000000007)","- result %= 1000000007","+ result += lcm * pow(A[i], m - 2, m)","+ result %= m"],"diff_only_import_comment":false,"measured_runtime_v0":0.8176178482,"measured_runtime_v1":4.2003448682,"runtime_lift":0.1946549328,"key":["s137131306","s875056497"]} +{"user_id":"u411203878","problem_id":"p03038","language":"python","submission_id_v0":"s077884883","submission_id_v1":"s637690312","cpu_time_v0":400,"cpu_time_v1":349,"memory_v0":100776,"memory_v1":100052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.75,"input":"import heapq\n\n\n\nn,m = list(map(int,input().split()))\n\n\n\na = list(map(int,input().split()))\n\nbc = []\n\nfor _ in range(m):\n\n b, c = (int(x) for x in input().split())\n\n bc.append([b, c])\n\nbc = sorted(bc, key=lambda x: -x[1])\n\n\n\nheapq.heapify(a)\n\n\n\nfor i in range(m):\n\n count = 0\n\n if bc[i][1] < a[0]:\n\n break\n\n while a[0] < bc[i][1] and count < bc[i][0]:\n\n heapq.heappop(a)\n\n heapq.heappush(a,bc[i][1])\n\n count += 1\n\nprint((sum(a)))","target":"N,M = list(map(int,input().split()))\n\n\n\nA = list(map(int,input().split()))\n\nA.sort(reverse=True)\n\nBC = []\n\nfor _ in range(M):\n\n B, C = (int(x) for x in input().split())\n\n BC.append([B, C])\n\nBC = sorted(BC, key=lambda x: -x[1])\n\n\n\nindex = 0\n\n\n\nans = 0\n\n\n\nwhile index < M and len(A) and A[-1] < BC[index][1]:\n\n b, c = BC[index]\n\n count = 0\n\n while len(A) and A[-1] < c and count < b:\n\n A.pop()\n\n ans += c\n\n count += 1\n\n index += 1\n\nprint((sum(A)+ans))","code_v0_loc":22,"code_v1_loc":23,"code_v0_num_chars":463,"code_v1_num_chars":480,"code_v0_no_empty_lines":"import heapq\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nbc = []\nfor _ in range(m):\n b, c = (int(x) for x in input().split())\n bc.append([b, c])\nbc = sorted(bc, key=lambda x: -x[1])\nheapq.heapify(a)\nfor i in range(m):\n count = 0\n if bc[i][1] < a[0]:\n break\n while a[0] < bc[i][1] and count < bc[i][0]:\n heapq.heappop(a)\n heapq.heappush(a, bc[i][1])\n count += 1\nprint((sum(a)))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nA.sort(reverse=True)\nBC = []\nfor _ in range(M):\n B, C = (int(x) for x in input().split())\n BC.append([B, C])\nBC = sorted(BC, key=lambda x: -x[1])\nindex = 0\nans = 0\nwhile index < M and len(A) and A[-1] < BC[index][1]:\n b, c = BC[index]\n count = 0\n while len(A) and A[-1] < c and count < b:\n A.pop()\n ans += c\n count += 1\n index += 1\nprint((sum(A) + ans))\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["-import heapq","-","-n, m = list(map(int, input().split()))","-a = list(map(int, input().split()))","-bc = []","-for _ in range(m):","- b, c = (int(x) for x in input().split())","- bc.append([b, c])","-bc = sorted(bc, key=lambda x: -x[1])","-heapq.heapify(a)","-for i in range(m):","+N, M = list(map(int, input().split()))","+A = list(map(int, input().split()))","+A.sort(reverse=True)","+BC = []","+for _ in range(M):","+ B, C = (int(x) for x in input().split())","+ BC.append([B, C])","+BC = sorted(BC, key=lambda x: -x[1])","+index = 0","+ans = 0","+while index < M and len(A) and A[-1] < BC[index][1]:","+ b, c = BC[index]","- if bc[i][1] < a[0]:","- break","- while a[0] < bc[i][1] and count < bc[i][0]:","- heapq.heappop(a)","- heapq.heappush(a, bc[i][1])","+ while len(A) and A[-1] < c and count < b:","+ A.pop()","+ ans += c","-print((sum(a)))","+ index += 1","+print((sum(A) + ans))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0746884284,"measured_runtime_v1":0.0437354729,"runtime_lift":1.7077311254,"key":["s077884883","s637690312"]} +{"user_id":"u979823197","problem_id":"p02720","language":"python","submission_id_v0":"s388868369","submission_id_v1":"s114803942","cpu_time_v0":115,"cpu_time_v1":104,"memory_v0":19332,"memory_v1":18972,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.57,"input":"k=int(eval(input()))\n\nL=[]\n\ndef f(d,now,L):\n\n L.append(now)\n\n \n\n if d==10:\n\n return\n\n \n\n for j in range(-1,2):\n\n v=now%10+j\n\n if 0<=v<=9:\n\n f(d+1,now*10+v,L)\n\n\n\nfor l in range(1,10):\n\n f(1,l,L)\n\nL.sort()\n\nprint((L[k-1]))\n\n\n\n ","target":"from collections import deque\n\n\n\nk=int(eval(input()))\n\n\n\nlunlun=deque(i for i in range(1,10))\n\nfor _ in range(k-1):\n\n p=lunlun.popleft()\n\n if p%10!=0:\n\n lunlun.append(10*p+p%10-1)\n\n lunlun.append(10*p+p%10)\n\n if p%10!=9:\n\n lunlun.append(10*p+p%10+1)\n\nprint((lunlun.popleft()))","code_v0_loc":19,"code_v1_loc":13,"code_v0_num_chars":242,"code_v1_num_chars":278,"code_v0_no_empty_lines":"k = int(eval(input()))\nL = []\n\n\ndef f(d, now, L):\n L.append(now)\n if d == 10:\n return\n for j in range(-1, 2):\n v = now % 10 + j\n if 0 <= v <= 9:\n f(d + 1, now * 10 + v, L)\n\n\nfor l in range(1, 10):\n f(1, l, L)\nL.sort()\nprint((L[k - 1]))\n","code_v1_no_empty_lines":"from collections import deque\n\nk = int(eval(input()))\nlunlun = deque(i for i in range(1, 10))\nfor _ in range(k - 1):\n p = lunlun.popleft()\n if p % 10 != 0:\n lunlun.append(10 * p + p % 10 - 1)\n lunlun.append(10 * p + p % 10)\n if p % 10 != 9:\n lunlun.append(10 * p + p % 10 + 1)\nprint((lunlun.popleft()))\n","code_same":false,"relative_loc_diff_percent":31.5789473684,"diff":["+from collections import deque","+","-L = []","-","-","-def f(d, now, L):","- L.append(now)","- if d == 10:","- return","- for j in range(-1, 2):","- v = now % 10 + j","- if 0 <= v <= 9:","- f(d + 1, now * 10 + v, L)","-","-","-for l in range(1, 10):","- f(1, l, L)","-L.sort()","-print((L[k - 1]))","+lunlun = deque(i for i in range(1, 10))","+for _ in range(k - 1):","+ p = lunlun.popleft()","+ if p % 10 != 0:","+ lunlun.append(10 * p + p % 10 - 1)","+ lunlun.append(10 * p + p % 10)","+ if p % 10 != 9:","+ lunlun.append(10 * p + p % 10 + 1)","+print((lunlun.popleft()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3557107821,"measured_runtime_v1":0.0652255189,"runtime_lift":5.4535523483,"key":["s388868369","s114803942"]} +{"user_id":"u418149936","problem_id":"p02658","language":"python","submission_id_v0":"s693993891","submission_id_v1":"s184074380","cpu_time_v0":82,"cpu_time_v1":56,"memory_v0":21500,"memory_v1":21568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.71,"input":"eval(input())\n\nls = list(map(int, input().split(' ')))\n\nls.sort(reverse=True)\n\n\n\ndef main(ls):\n\n if ls.count(0) > 0:\n\n print((0))\n\n return\n\n result = 1\n\n for i in ls:\n\n result *= i\n\n if result > 10 ** 18:\n\n print((-1))\n\n return\n\n\n\n print(result)\n\n\n\nmain(ls)","target":"eval(input())\n\nls = list(map(int, input().split(' ')))\n\n\n\nif ls.count(0) > 0:\n\n result = 0\n\nelse:\n\n result = 1\n\n for i in ls:\n\n result *= i\n\n if result > 10 ** 18:\n\n result = -1\n\n break\n\nprint(result)","code_v0_loc":18,"code_v1_loc":13,"code_v0_num_chars":309,"code_v1_num_chars":239,"code_v0_no_empty_lines":"eval(input())\nls = list(map(int, input().split(\" \")))\nls.sort(reverse=True)\n\n\ndef main(ls):\n if ls.count(0) > 0:\n print((0))\n return\n result = 1\n for i in ls:\n result *= i\n if result > 10**18:\n print((-1))\n return\n print(result)\n\n\nmain(ls)\n","code_v1_no_empty_lines":"eval(input())\nls = list(map(int, input().split(\" \")))\nif ls.count(0) > 0:\n result = 0\nelse:\n result = 1\n for i in ls:\n result *= i\n if result > 10**18:\n result = -1\n break\nprint(result)\n","code_same":false,"relative_loc_diff_percent":27.7777777778,"diff":["-ls.sort(reverse=True)","-","-","-def main(ls):","- if ls.count(0) > 0:","- print((0))","- return","+if ls.count(0) > 0:","+ result = 0","+else:","- print((-1))","- return","- print(result)","-","-","-main(ls)","+ result = -1","+ break","+print(result)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0461332214,"measured_runtime_v1":0.0383909824,"runtime_lift":1.2016681654,"key":["s693993891","s184074380"]} +{"user_id":"u554954744","problem_id":"p02936","language":"python","submission_id_v0":"s078971982","submission_id_v1":"s816899395","cpu_time_v0":1996,"cpu_time_v1":1553,"memory_v0":285892,"memory_v1":232312,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.19,"input":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**6)\n\n\n\nN, Q = list(map(int, input().split()))\n\nAB = [[int(x) for x in input().split()] for _ in range(N-1)]\n\nPX = [[int(x) for x in input().split()] for _ in range(Q)]\n\n \n\ng = [[] for _ in range(N+1)]\n\nfor a,b in AB:\n\n g[a].append(b)\n\n g[b].append(a)\n\n \n\ncnt = [0] * (N+1)\n\nfor p,x in PX:\n\n cnt[p] += x\n\n\n\ndef dfs(v, p, add):\n\n cnt[v] += add\n\n for nv in g[v]:\n\n if nv == p:\n\n continue\n\n dfs(nv, v, cnt[v])\n\n\n\ndfs(1, 0, 0)\n\n\n\nprint((' '.join(map(str, cnt[1:])))) ","target":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**6)\n\n\n\nN, Q = list(map(int, input().split()))\n\n\n\ng = [[] for _ in range(N+1)]\n\nfor i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n g[a].append(b)\n\n g[b].append(a)\n\n\n\ncnt = [0] * (N+1)\n\nfor i in range(Q):\n\n p, x = list(map(int, input().split()))\n\n cnt[p] += x\n\n\n\ndef dfs(v, p, add):\n\n cnt[v] += add\n\n for nv in g[v]:\n\n if nv == p:\n\n continue\n\n dfs(nv, v, cnt[v])\n\n\n\ndfs(1, 0, 0)\n\n\n\nprint((' '.join(map(str, cnt[1:])))) ","code_v0_loc":27,"code_v1_loc":27,"code_v0_num_chars":562,"code_v1_num_chars":525,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\nN, Q = list(map(int, input().split()))\nAB = [[int(x) for x in input().split()] for _ in range(N - 1)]\nPX = [[int(x) for x in input().split()] for _ in range(Q)]\ng = [[] for _ in range(N + 1)]\nfor a, b in AB:\n g[a].append(b)\n g[b].append(a)\ncnt = [0] * (N + 1)\nfor p, x in PX:\n cnt[p] += x\n\n\ndef dfs(v, p, add):\n cnt[v] += add\n for nv in g[v]:\n if nv == p:\n continue\n dfs(nv, v, cnt[v])\n\n\ndfs(1, 0, 0)\nprint((\" \".join(map(str, cnt[1:]))))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\nN, Q = list(map(int, input().split()))\ng = [[] for _ in range(N + 1)]\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n g[a].append(b)\n g[b].append(a)\ncnt = [0] * (N + 1)\nfor i in range(Q):\n p, x = list(map(int, input().split()))\n cnt[p] += x\n\n\ndef dfs(v, p, add):\n cnt[v] += add\n for nv in g[v]:\n if nv == p:\n continue\n dfs(nv, v, cnt[v])\n\n\ndfs(1, 0, 0)\nprint((\" \".join(map(str, cnt[1:]))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-AB = [[int(x) for x in input().split()] for _ in range(N - 1)]","-PX = [[int(x) for x in input().split()] for _ in range(Q)]","-for a, b in AB:","+for i in range(N - 1):","+ a, b = list(map(int, input().split()))","-for p, x in PX:","+for i in range(Q):","+ p, x = list(map(int, input().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0385807214,"measured_runtime_v1":0.0489984123,"runtime_lift":0.7873871737,"key":["s078971982","s816899395"]} +{"user_id":"u625963200","problem_id":"p03160","language":"python","submission_id_v0":"s402504682","submission_id_v1":"s064082210","cpu_time_v0":182,"cpu_time_v1":130,"memory_v0":13980,"memory_v1":13980,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.57,"input":"n=int(eval(input()))\n\nH=list(map(int,input().split()))\n\n\n\ndp=[float('inf')]*n\n\ndp[0]=0\n\ndp[1]=abs(H[1]-H[0])\n\nfor i in range(2,n):\n\n dp[i]=min(dp[i],dp[i-1]+abs(H[i]-H[i-1]))\n\n dp[i]=min(dp[i],dp[i-2]+abs(H[i]-H[i-2]))\n\nprint((dp[-1]))","target":"n=int(eval(input()))\n\nH=list(map(int,input().split()))\n\n\n\ndp=[0]*n\n\ndp[1]=abs(H[1]-H[0])\n\nfor i in range(2,n):\n\n dp[i]=min(dp[i-1]+abs(H[i]-H[i-1]),dp[i-2]+abs(H[i]-H[i-2]))\n\nprint((dp[-1]))","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":229,"code_v1_num_chars":183,"code_v0_no_empty_lines":"n = int(eval(input()))\nH = list(map(int, input().split()))\ndp = [float(\"inf\")] * n\ndp[0] = 0\ndp[1] = abs(H[1] - H[0])\nfor i in range(2, n):\n dp[i] = min(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]))\n dp[i] = min(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]))\nprint((dp[-1]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nH = list(map(int, input().split()))\ndp = [0] * n\ndp[1] = abs(H[1] - H[0])\nfor i in range(2, n):\n dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-dp = [float(\"inf\")] * n","-dp[0] = 0","+dp = [0] * n","- dp[i] = min(dp[i], dp[i - 1] + abs(H[i] - H[i - 1]))","- dp[i] = min(dp[i], dp[i - 2] + abs(H[i] - H[i - 2]))","+ dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0336908863,"measured_runtime_v1":0.0354445889,"runtime_lift":0.9505226974,"key":["s402504682","s064082210"]} +{"user_id":"u815878613","problem_id":"p03945","language":"python","submission_id_v0":"s428901894","submission_id_v1":"s539595030","cpu_time_v0":34,"cpu_time_v1":18,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.06,"input":"def main():\n\n S = eval(input())\n\n if S[0] == \"B\":\n\n K = \"WB\"\n\n else:\n\n K = \"BW\"\n\n\n\n cnt = 0\n\n for i in range(len(S)-1):\n\n if S[i:i+2] == K:\n\n cnt += 1\n\n\n\n if S[0] == S[-1]:\n\n print((2 * cnt))\n\n else:\n\n print((1 + 2 * cnt))\n\n\n\n\n\nmain()\n","target":"def main():\n\n S = eval(input())\n\n if S[0] == \"B\":\n\n K = \"WB\"\n\n else:\n\n K = \"BW\"\n\n cnt = S.count(K)\n\n\n\n if S[0] == S[-1]:\n\n print((2 * cnt))\n\n else:\n\n print((1 + 2 * cnt))\n\n\n\n\n\nmain()\n","code_v0_loc":19,"code_v1_loc":15,"code_v0_num_chars":292,"code_v1_num_chars":219,"code_v0_no_empty_lines":"def main():\n S = eval(input())\n if S[0] == \"B\":\n K = \"WB\"\n else:\n K = \"BW\"\n cnt = 0\n for i in range(len(S) - 1):\n if S[i : i + 2] == K:\n cnt += 1\n if S[0] == S[-1]:\n print((2 * cnt))\n else:\n print((1 + 2 * cnt))\n\n\nmain()\n","code_v1_no_empty_lines":"def main():\n S = eval(input())\n if S[0] == \"B\":\n K = \"WB\"\n else:\n K = \"BW\"\n cnt = S.count(K)\n if S[0] == S[-1]:\n print((2 * cnt))\n else:\n print((1 + 2 * cnt))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":21.0526315789,"diff":["- cnt = 0","- for i in range(len(S) - 1):","- if S[i : i + 2] == K:","- cnt += 1","+ cnt = S.count(K)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1159390097,"measured_runtime_v1":0.1227751253,"runtime_lift":0.9443200274,"key":["s428901894","s539595030"]} +{"user_id":"u022407960","problem_id":"p02238","language":"python","submission_id_v0":"s268738112","submission_id_v1":"s028186729","cpu_time_v0":50,"cpu_time_v1":40,"memory_v0":7936,"memory_v1":7924,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"#!\/usr\/bin\/env python\n\n# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\nUNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2\n\n\n\n\n\ndef generate_adj_matrix(v_info):\n\n for v_detail in v_info:\n\n v_adj_list = v_detail[2:]\n\n assert len(v_adj_list) == int(v_detail[1])\n\n for each in v_adj_list:\n\n init_adj_matrix[int(v_detail[0]) - 1][int(each) - 1] = 1\n\n return init_adj_matrix\n\n\n\n\n\ndef graph_dfs(v_init):\n\n global time\n\n\n\n # init the first node of overall graph iterations(times >= 1)\n\n vertex_visit_stack.append(v_init)\n\n vertex_status_list[v_init] = VISITED_IN_STACK\n\n vertex_d_time[v_init] += time\n\n # init end\n\n\n\n while len(vertex_visit_stack) > 1:\n\n current_vertex = vertex_visit_stack[-1]\n\n next_vertex = get_adj_vertices(vertex=current_vertex)\n\n\n\n if next_vertex:\n\n if vertex_status_list[next_vertex] is UNVISITED:\n\n vertex_status_list[next_vertex] = VISITED_IN_STACK\n\n time += 1\n\n vertex_d_time[next_vertex] += time\n\n vertex_visit_stack.append(next_vertex)\n\n else:\n\n vertex_visit_stack.pop()\n\n vertex_status_list[current_vertex] = POPPED_OUT\n\n time += 1\n\n vertex_f_time[current_vertex] += time\n\n\n\n return None\n\n\n\n\n\ndef get_adj_vertices(vertex):\n\n index = int(vertex) - 1\n\n for j in range(vertex_num):\n\n if adj_matrix[index][j]:\n\n adj_matrix[index][j] = 0\n\n return j + 1\n\n return None\n\n\n\n\n\ndef dfs_start():\n\n global time\n\n for i in range(vertex_num):\n\n if vertex_status_list[i + 1] == UNVISITED:\n\n # print('round', i + 1)\n\n graph_dfs(v_init=i + 1)\n\n time += 1\n\n\n\n\n\nif __name__ == '__main__':\n\n _input = sys.stdin.readlines()\n\n vertex_num = int(_input[0])\n\n vertex_info = list([x.split() for x in _input[1:]])\n\n init_adj_matrix = [[0] * vertex_num for _ in range(vertex_num)]\n\n # assert len(vertex_info) == vertex_num\n\n\n\n # config length = (vertex_num + 1)\n\n vertex_visit_stack = [-1]\n\n vertex_status_list = [UNVISITED] * vertex_num\n\n vertex_status_list.insert(0, -1)\n\n vertex_d_time, vertex_f_time = ([0] * (vertex_num + 1) for _ in range(2))\n\n\n\n adj_matrix = generate_adj_matrix(vertex_info)\n\n # timing start from 1\n\n time = 1\n\n dfs_start()\n\n for k in range(vertex_num):\n\n print((k + 1, vertex_d_time[k + 1], vertex_f_time[k + 1]))","target":"#!\/usr\/bin\/env python\n\n# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\nUNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2\n\n\n\n\n\ndef generate_adj_matrix(v_info):\n\n for v_detail in v_info:\n\n v_adj_list = v_detail[2:]\n\n # assert len(v_adj_list) == int(v_detail[1])\n\n for each in v_adj_list:\n\n init_adj_matrix[int(v_detail[0]) - 1][int(each) - 1] = 1\n\n return init_adj_matrix\n\n\n\n\n\ndef graph_dfs(v_init):\n\n global time\n\n\n\n # init the first node of overall graph iterations(times >= 1)\n\n vertices_visit_stack.append(v_init)\n\n vertices_status_list[v_init] = VISITED_IN_STACK\n\n vertices_d_time[v_init] += time\n\n # init end\n\n\n\n while len(vertices_visit_stack) > 1:\n\n current_vertex = vertices_visit_stack[-1]\n\n next_vertex = get_adj_vertices(vertex=current_vertex)\n\n\n\n if next_vertex:\n\n if vertices_status_list[next_vertex] is UNVISITED:\n\n vertices_status_list[next_vertex] = VISITED_IN_STACK\n\n time += 1\n\n vertices_d_time[next_vertex] += time\n\n vertices_visit_stack.append(next_vertex)\n\n else:\n\n vertices_visit_stack.pop()\n\n vertices_status_list[current_vertex] = POPPED_OUT\n\n time += 1\n\n vertices_f_time[current_vertex] += time\n\n\n\n return None\n\n\n\n\n\ndef get_adj_vertices(vertex):\n\n index = int(vertex) - 1\n\n for j in range(vertices_num):\n\n if adj_matrix[index][j]:\n\n adj_matrix[index][j] = 0\n\n return j + 1\n\n return None\n\n\n\n\n\ndef dfs_start():\n\n global time\n\n for i in range(vertices_num):\n\n if vertices_status_list[i + 1] == UNVISITED:\n\n # print('round: ', i + 1)\n\n graph_dfs(v_init=i + 1)\n\n time += 1\n\n\n\n\n\nif __name__ == '__main__':\n\n _input = sys.stdin.readlines()\n\n vertices_num = int(_input[0])\n\n vertices_info = list([x.split() for x in _input[1:]])\n\n init_adj_matrix = [[0] * vertices_num for _ in range(vertices_num)]\n\n # assert len(vertex_info) == vertex_num\n\n\n\n # config length = (vertex_num + 1)\n\n vertices_visit_stack = [-1]\n\n vertices_status_list = [UNVISITED] * vertices_num\n\n vertices_status_list.insert(0, -1)\n\n vertices_d_time, vertices_f_time = ([0] * (vertices_num + 1) for _ in range(2))\n\n\n\n adj_matrix = generate_adj_matrix(vertices_info)\n\n # timing start from 1\n\n time = 1\n\n dfs_start()\n\n for k in range(vertices_num):\n\n print((k + 1, vertices_d_time[k + 1], vertices_f_time[k + 1]))","code_v0_loc":82,"code_v1_loc":82,"code_v0_num_chars":2467,"code_v1_num_chars":2531,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python\n# -*- coding: utf-8 -*-\nimport sys\n\nUNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2\n\n\ndef generate_adj_matrix(v_info):\n for v_detail in v_info:\n v_adj_list = v_detail[2:]\n assert len(v_adj_list) == int(v_detail[1])\n for each in v_adj_list:\n init_adj_matrix[int(v_detail[0]) - 1][int(each) - 1] = 1\n return init_adj_matrix\n\n\ndef graph_dfs(v_init):\n global time\n # init the first node of overall graph iterations(times >= 1)\n vertex_visit_stack.append(v_init)\n vertex_status_list[v_init] = VISITED_IN_STACK\n vertex_d_time[v_init] += time\n # init end\n while len(vertex_visit_stack) > 1:\n current_vertex = vertex_visit_stack[-1]\n next_vertex = get_adj_vertices(vertex=current_vertex)\n if next_vertex:\n if vertex_status_list[next_vertex] is UNVISITED:\n vertex_status_list[next_vertex] = VISITED_IN_STACK\n time += 1\n vertex_d_time[next_vertex] += time\n vertex_visit_stack.append(next_vertex)\n else:\n vertex_visit_stack.pop()\n vertex_status_list[current_vertex] = POPPED_OUT\n time += 1\n vertex_f_time[current_vertex] += time\n return None\n\n\ndef get_adj_vertices(vertex):\n index = int(vertex) - 1\n for j in range(vertex_num):\n if adj_matrix[index][j]:\n adj_matrix[index][j] = 0\n return j + 1\n return None\n\n\ndef dfs_start():\n global time\n for i in range(vertex_num):\n if vertex_status_list[i + 1] == UNVISITED:\n # print('round', i + 1)\n graph_dfs(v_init=i + 1)\n time += 1\n\n\nif __name__ == \"__main__\":\n _input = sys.stdin.readlines()\n vertex_num = int(_input[0])\n vertex_info = list([x.split() for x in _input[1:]])\n init_adj_matrix = [[0] * vertex_num for _ in range(vertex_num)]\n # assert len(vertex_info) == vertex_num\n # config length = (vertex_num + 1)\n vertex_visit_stack = [-1]\n vertex_status_list = [UNVISITED] * vertex_num\n vertex_status_list.insert(0, -1)\n vertex_d_time, vertex_f_time = ([0] * (vertex_num + 1) for _ in range(2))\n adj_matrix = generate_adj_matrix(vertex_info)\n # timing start from 1\n time = 1\n dfs_start()\n for k in range(vertex_num):\n print((k + 1, vertex_d_time[k + 1], vertex_f_time[k + 1]))\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python\n# -*- coding: utf-8 -*-\nimport sys\n\nUNVISITED, VISITED_IN_STACK, POPPED_OUT = 0, 1, 2\n\n\ndef generate_adj_matrix(v_info):\n for v_detail in v_info:\n v_adj_list = v_detail[2:]\n # assert len(v_adj_list) == int(v_detail[1])\n for each in v_adj_list:\n init_adj_matrix[int(v_detail[0]) - 1][int(each) - 1] = 1\n return init_adj_matrix\n\n\ndef graph_dfs(v_init):\n global time\n # init the first node of overall graph iterations(times >= 1)\n vertices_visit_stack.append(v_init)\n vertices_status_list[v_init] = VISITED_IN_STACK\n vertices_d_time[v_init] += time\n # init end\n while len(vertices_visit_stack) > 1:\n current_vertex = vertices_visit_stack[-1]\n next_vertex = get_adj_vertices(vertex=current_vertex)\n if next_vertex:\n if vertices_status_list[next_vertex] is UNVISITED:\n vertices_status_list[next_vertex] = VISITED_IN_STACK\n time += 1\n vertices_d_time[next_vertex] += time\n vertices_visit_stack.append(next_vertex)\n else:\n vertices_visit_stack.pop()\n vertices_status_list[current_vertex] = POPPED_OUT\n time += 1\n vertices_f_time[current_vertex] += time\n return None\n\n\ndef get_adj_vertices(vertex):\n index = int(vertex) - 1\n for j in range(vertices_num):\n if adj_matrix[index][j]:\n adj_matrix[index][j] = 0\n return j + 1\n return None\n\n\ndef dfs_start():\n global time\n for i in range(vertices_num):\n if vertices_status_list[i + 1] == UNVISITED:\n # print('round: ', i + 1)\n graph_dfs(v_init=i + 1)\n time += 1\n\n\nif __name__ == \"__main__\":\n _input = sys.stdin.readlines()\n vertices_num = int(_input[0])\n vertices_info = list([x.split() for x in _input[1:]])\n init_adj_matrix = [[0] * vertices_num for _ in range(vertices_num)]\n # assert len(vertex_info) == vertex_num\n # config length = (vertex_num + 1)\n vertices_visit_stack = [-1]\n vertices_status_list = [UNVISITED] * vertices_num\n vertices_status_list.insert(0, -1)\n vertices_d_time, vertices_f_time = ([0] * (vertices_num + 1) for _ in range(2))\n adj_matrix = generate_adj_matrix(vertices_info)\n # timing start from 1\n time = 1\n dfs_start()\n for k in range(vertices_num):\n print((k + 1, vertices_d_time[k + 1], vertices_f_time[k + 1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- assert len(v_adj_list) == int(v_detail[1])","+ # assert len(v_adj_list) == int(v_detail[1])","- vertex_visit_stack.append(v_init)","- vertex_status_list[v_init] = VISITED_IN_STACK","- vertex_d_time[v_init] += time","+ vertices_visit_stack.append(v_init)","+ vertices_status_list[v_init] = VISITED_IN_STACK","+ vertices_d_time[v_init] += time","- while len(vertex_visit_stack) > 1:","- current_vertex = vertex_visit_stack[-1]","+ while len(vertices_visit_stack) > 1:","+ current_vertex = vertices_visit_stack[-1]","- if vertex_status_list[next_vertex] is UNVISITED:","- vertex_status_list[next_vertex] = VISITED_IN_STACK","+ if vertices_status_list[next_vertex] is UNVISITED:","+ vertices_status_list[next_vertex] = VISITED_IN_STACK","- vertex_d_time[next_vertex] += time","- vertex_visit_stack.append(next_vertex)","+ vertices_d_time[next_vertex] += time","+ vertices_visit_stack.append(next_vertex)","- vertex_visit_stack.pop()","- vertex_status_list[current_vertex] = POPPED_OUT","+ vertices_visit_stack.pop()","+ vertices_status_list[current_vertex] = POPPED_OUT","- vertex_f_time[current_vertex] += time","+ vertices_f_time[current_vertex] += time","- for j in range(vertex_num):","+ for j in range(vertices_num):","- for i in range(vertex_num):","- if vertex_status_list[i + 1] == UNVISITED:","- # print('round', i + 1)","+ for i in range(vertices_num):","+ if vertices_status_list[i + 1] == UNVISITED:","+ # print('round: ', i + 1)","- vertex_num = int(_input[0])","- vertex_info = list([x.split() for x in _input[1:]])","- init_adj_matrix = [[0] * vertex_num for _ in range(vertex_num)]","+ vertices_num = int(_input[0])","+ vertices_info = list([x.split() for x in _input[1:]])","+ init_adj_matrix = [[0] * vertices_num for _ in range(vertices_num)]","- vertex_visit_stack = [-1]","- vertex_status_list = [UNVISITED] * vertex_num","- vertex_status_list.insert(0, -1)","- vertex_d_time, vertex_f_time = ([0] * (vertex_num + 1) for _ in range(2))","- adj_matrix = generate_adj_matrix(vertex_info)","+ vertices_visit_stack = [-1]","+ vertices_status_list = [UNVISITED] * vertices_num","+ vertices_status_list.insert(0, -1)","+ vertices_d_time, vertices_f_time = ([0] * (vertices_num + 1) for _ in range(2))","+ adj_matrix = generate_adj_matrix(vertices_info)","- for k in range(vertex_num):","- print((k + 1, vertex_d_time[k + 1], vertex_f_time[k + 1]))","+ for k in range(vertices_num):","+ print((k + 1, vertices_d_time[k + 1], vertices_f_time[k + 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0451993175,"measured_runtime_v1":0.0448944688,"runtime_lift":1.0067903407,"key":["s268738112","s028186729"]} +{"user_id":"u852690916","problem_id":"p03053","language":"python","submission_id_v0":"s243545871","submission_id_v1":"s172105690","cpu_time_v0":642,"cpu_time_v1":350,"memory_v0":93660,"memory_v1":185740,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.48,"input":"H,W=list(map(int, input().split()))\n\nA=[list(eval(input())) for _ in range(H)]\n\n\n\n#dp[i][j]=\u6700\u3082\u8fd1\u3044\u9ed2\u30de\u30b9\u307e\u3067\u306e\u6700\u5c0f\u30de\u30f3\u30cf\u30c3\u30bf\u30f3\u8ddd\u96e2\n\nINF=10**9\n\ndp = [[INF] * W for _ in range(H)]\n\n\n\n#\u53f3\n\nfor i in range(H):\n\n c = INF\n\n for j in range(W):\n\n if A[i][j] == '#': c = 0\n\n elif j>=1: c = dp[i][j-1] + 1\n\n dp[i][j] = min(dp[i][j], c)\n\n\n\n#\u4e0b\n\nfor j in range(W):\n\n c = INF\n\n for i in range(H):\n\n if A[i][j] == '#': c = 0\n\n elif i>=1: c = dp[i-1][j] + 1\n\n dp[i][j] = min(dp[i][j], c)\n\n\n\n#\u5de6\n\nfor i in range(H):\n\n c = INF\n\n for j in range(W-1,-1,-1):\n\n if A[i][j] == '#': c = 0\n\n elif j= 0: continue\n\n dist[ni][nj] = d + 1\n\n q.append((ni, nj, d + 1))\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n input = sys.stdin.readline\n\n H, W = list(map(int, input().split()))\n\n A = [input().rstrip() for _ in range(H)]\n\n main(H, W, A)\n","code_v0_loc":44,"code_v1_loc":28,"code_v0_num_chars":957,"code_v1_num_chars":839,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\nA = [list(eval(input())) for _ in range(H)]\n# dp[i][j]=\u6700\u3082\u8fd1\u3044\u9ed2\u30de\u30b9\u307e\u3067\u306e\u6700\u5c0f\u30de\u30f3\u30cf\u30c3\u30bf\u30f3\u8ddd\u96e2\nINF = 10**9\ndp = [[INF] * W for _ in range(H)]\n# \u53f3\nfor i in range(H):\n c = INF\n for j in range(W):\n if A[i][j] == \"#\":\n c = 0\n elif j >= 1:\n c = dp[i][j - 1] + 1\n dp[i][j] = min(dp[i][j], c)\n# \u4e0b\nfor j in range(W):\n c = INF\n for i in range(H):\n if A[i][j] == \"#\":\n c = 0\n elif i >= 1:\n c = dp[i - 1][j] + 1\n dp[i][j] = min(dp[i][j], c)\n# \u5de6\nfor i in range(H):\n c = INF\n for j in range(W - 1, -1, -1):\n if A[i][j] == \"#\":\n c = 0\n elif j < W - 1:\n c = dp[i][j + 1] + 1\n dp[i][j] = min(dp[i][j], c)\n# \u4e0a\nfor j in range(W):\n c = INF\n for i in range(H - 1, -1, -1):\n if A[i][j] == \"#\":\n c = 0\n elif i < H - 1:\n c = dp[i + 1][j] + 1\n dp[i][j] = min(dp[i][j], c)\nans = 0\nfor i in range(H):\n for j in range(W):\n ans = max(ans, dp[i][j])\nprint(ans)\n","code_v1_no_empty_lines":"# \u3067\u3064oO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)\nimport sys\nfrom collections import deque\n\n\ndef main(H, W, A):\n dist = [[-1] * W for _ in range(H)]\n q = deque()\n for i in range(H):\n for j in range(W):\n if A[i][j] == \"#\":\n dist[i][j] = 0\n q.append((i, j, 0))\n ans = 0\n while q:\n i, j, d = q.popleft()\n ans = max(ans, d)\n for ni, nj in [(i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)]:\n if not (0 <= ni < H and 0 <= nj < W):\n continue\n if dist[ni][nj] >= 0:\n continue\n dist[ni][nj] = d + 1\n q.append((ni, nj, d + 1))\n print(ans)\n\n\nif __name__ == \"__main__\":\n input = sys.stdin.readline\n H, W = list(map(int, input().split()))\n A = [input().rstrip() for _ in range(H)]\n main(H, W, A)\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-H, W = list(map(int, input().split()))","-A = [list(eval(input())) for _ in range(H)]","-# dp[i][j]=\u6700\u3082\u8fd1\u3044\u9ed2\u30de\u30b9\u307e\u3067\u306e\u6700\u5c0f\u30de\u30f3\u30cf\u30c3\u30bf\u30f3\u8ddd\u96e2","-INF = 10**9","-dp = [[INF] * W for _ in range(H)]","-# \u53f3","-for i in range(H):","- c = INF","- for j in range(W):","- if A[i][j] == \"#\":","- c = 0","- elif j >= 1:","- c = dp[i][j - 1] + 1","- dp[i][j] = min(dp[i][j], c)","-# \u4e0b","-for j in range(W):","- c = INF","+# \u3067\u3064oO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)","+import sys","+from collections import deque","+","+","+def main(H, W, A):","+ dist = [[-1] * W for _ in range(H)]","+ q = deque()","- if A[i][j] == \"#\":","- c = 0","- elif i >= 1:","- c = dp[i - 1][j] + 1","- dp[i][j] = min(dp[i][j], c)","-# \u5de6","-for i in range(H):","- c = INF","- for j in range(W - 1, -1, -1):","- if A[i][j] == \"#\":","- c = 0","- elif j < W - 1:","- c = dp[i][j + 1] + 1","- dp[i][j] = min(dp[i][j], c)","-# \u4e0a","-for j in range(W):","- c = INF","- for i in range(H - 1, -1, -1):","- if A[i][j] == \"#\":","- c = 0","- elif i < H - 1:","- c = dp[i + 1][j] + 1","- dp[i][j] = min(dp[i][j], c)","-ans = 0","-for i in range(H):","- for j in range(W):","- ans = max(ans, dp[i][j])","-print(ans)","+ for j in range(W):","+ if A[i][j] == \"#\":","+ dist[i][j] = 0","+ q.append((i, j, 0))","+ ans = 0","+ while q:","+ i, j, d = q.popleft()","+ ans = max(ans, d)","+ for ni, nj in [(i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)]:","+ if not (0 <= ni < H and 0 <= nj < W):","+ continue","+ if dist[ni][nj] >= 0:","+ continue","+ dist[ni][nj] = d + 1","+ q.append((ni, nj, d + 1))","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ input = sys.stdin.readline","+ H, W = list(map(int, input().split()))","+ A = [input().rstrip() for _ in range(H)]","+ main(H, W, A)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0419758906,"measured_runtime_v1":0.0359386256,"runtime_lift":1.1679881986,"key":["s243545871","s172105690"]} +{"user_id":"u739360929","problem_id":"p03208","language":"python","submission_id_v0":"s414858461","submission_id_v1":"s727795802","cpu_time_v0":170,"cpu_time_v1":74,"memory_v0":17112,"memory_v1":20160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.47,"input":"def solve():\n\n n, k = list(map(int, input().split()))\n\n h = [int(eval(input())) for _ in range(n)]\n\n h.sort()\n\n hk = [h[i+k-1] - h[i] for i in range(n - k + 1)]\n\n print((min(hk)))\n\n\n\nif __name__ == '__main__':\n\n solve()\n","target":"def solve():\n\n # n, k = map(int, input().split())\n\n # h = [int(input()) for _ in range(n)]\n\n n, k, *h = list(map(int, open(0).read().split()))\n\n h.sort()\n\n hk = [h[i+k-1] - h[i] for i in range(n - k + 1)]\n\n print((min(hk)))\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":224,"code_v1_num_chars":279,"code_v0_no_empty_lines":"def solve():\n n, k = list(map(int, input().split()))\n h = [int(eval(input())) for _ in range(n)]\n h.sort()\n hk = [h[i + k - 1] - h[i] for i in range(n - k + 1)]\n print((min(hk)))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"def solve():\n # n, k = map(int, input().split())\n # h = [int(input()) for _ in range(n)]\n n, k, *h = list(map(int, open(0).read().split()))\n h.sort()\n hk = [h[i + k - 1] - h[i] for i in range(n - k + 1)]\n print((min(hk)))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["- n, k = list(map(int, input().split()))","- h = [int(eval(input())) for _ in range(n)]","+ # n, k = map(int, input().split())","+ # h = [int(input()) for _ in range(n)]","+ n, k, *h = list(map(int, open(0).read().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1970004574,"measured_runtime_v1":0.0377810547,"runtime_lift":5.2142656977,"key":["s414858461","s727795802"]} +{"user_id":"u857605629","problem_id":"p03999","language":"python","submission_id_v0":"s213286185","submission_id_v1":"s689591167","cpu_time_v0":34,"cpu_time_v1":14,"memory_v0":2820,"memory_v1":2568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.82,"input":"from itertools import combinations, chain\nfrom functools import reduce\n\n\n\ndef eval_str(string):\n\n s = string.split(\"+\")\n\n return int(reduce(lambda x,y: int(x)+int(y), s))\n\n\n\nmystr = input()\n\nallsubsets = lambda n: list(chain(*[combinations(list(range(1,n)), ni) for ni in range(n+1)]))\n\nl = allsubsets(len(mystr))\n\n#for i in xrange(len(l)):\n\n# l[i] = list(l[i])\n\nmylist = []\n\n#print l\n\nfor x in l:\n\n s = \"\"\n\n prev = 0\n\n for y in x:\n\n s += mystr[prev:int(y)]\n\n s += \"+\"\n\n prev = int(y)\n\n s += mystr[prev:]\n\n mylist.append(s)\n\n#print mylist\n\ntot = 0\n\nfor x in mylist:\n\n tot += eval_str(x)\n\nprint(tot)","target":"def eval(d,mask):\n\n s = ''\n\n for i in range(len(mask)):\n\n s += d[i]\n\n if mask[i] == '1':\n\n s += '+'\n\n s += d[-1]\n\n l = s.split('+')\n\n res = sum(map(int,l))\n\n return res\n\n\n\nd = list(input())\n\ntot = 0\n\nfor i in range(2**(len(d)-1)):\n\n mask = bin(2**(len(d)-1)+i)[3:]\n\n tot += eval(d,mask)\n\nprint(tot)","code_v0_loc":27,"code_v1_loc":17,"code_v0_num_chars":614,"code_v1_num_chars":352,"code_v0_no_empty_lines":"from itertools import combinations, chain\nfrom functools import reduce\n\n\ndef eval_str(string):\n s = string.split(\"+\")\n return int(reduce(lambda x, y: int(x) + int(y), s))\n\n\nmystr = input()\nallsubsets = lambda n: list(\n chain(*[combinations(list(range(1, n)), ni) for ni in range(n + 1)])\n)\nl = allsubsets(len(mystr))\n# for i in xrange(len(l)):\n# l[i] = list(l[i])\nmylist = []\n# print l\nfor x in l:\n s = \"\"\n prev = 0\n for y in x:\n s += mystr[prev : int(y)]\n s += \"+\"\n prev = int(y)\n s += mystr[prev:]\n mylist.append(s)\n# print mylist\ntot = 0\nfor x in mylist:\n tot += eval_str(x)\nprint(tot)\n","code_v1_no_empty_lines":"def eval(d, mask):\n s = \"\"\n for i in range(len(mask)):\n s += d[i]\n if mask[i] == \"1\":\n s += \"+\"\n s += d[-1]\n l = s.split(\"+\")\n res = sum(map(int, l))\n return res\n\n\nd = list(input())\ntot = 0\nfor i in range(2 ** (len(d) - 1)):\n mask = bin(2 ** (len(d) - 1) + i)[3:]\n tot += eval(d, mask)\nprint(tot)\n","code_same":false,"relative_loc_diff_percent":37.037037037,"diff":["-from itertools import combinations, chain","-from functools import reduce","+def eval(d, mask):","+ s = \"\"","+ for i in range(len(mask)):","+ s += d[i]","+ if mask[i] == \"1\":","+ s += \"+\"","+ s += d[-1]","+ l = s.split(\"+\")","+ res = sum(map(int, l))","+ return res","-def eval_str(string):","- s = string.split(\"+\")","- return int(reduce(lambda x, y: int(x) + int(y), s))","-","-","-mystr = input()","-allsubsets = lambda n: list(","- chain(*[combinations(list(range(1, n)), ni) for ni in range(n + 1)])","-)","-l = allsubsets(len(mystr))","-# for i in xrange(len(l)):","-# l[i] = list(l[i])","-mylist = []","-# print l","-for x in l:","- s = \"\"","- prev = 0","- for y in x:","- s += mystr[prev : int(y)]","- s += \"+\"","- prev = int(y)","- s += mystr[prev:]","- mylist.append(s)","-# print mylist","+d = list(input())","-for x in mylist:","- tot += eval_str(x)","+for i in range(2 ** (len(d) - 1)):","+ mask = bin(2 ** (len(d) - 1) + i)[3:]","+ tot += eval(d, mask)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409475974,"measured_runtime_v1":0.0414418389,"runtime_lift":0.9880738524,"key":["s213286185","s689591167"]} +{"user_id":"u057109575","problem_id":"p02844","language":"python","submission_id_v0":"s889909672","submission_id_v1":"s859656880","cpu_time_v0":1175,"cpu_time_v1":207,"memory_v0":41692,"memory_v1":73948,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.38,"input":"N = int(eval(input()))\n\nS = eval(input())\n\n\n\nans = 0\n\nfor n in range(1000):\n\n c = [n \/\/ 100, (n \/\/ 10) % 10, n % 10]\n\n f = 0\n\n for i in range(N):\n\n if S[i] == str(c[f]):\n\n f += 1\n\n if f == 3:\n\n break\n\n \n\n if f == 3:\n\n ans += 1\n\n \n\nprint(ans)\n","target":"\n\nN = int(eval(input()))\n\nS = eval(input())\n\n\n\nans = 0\n\nfor n in range(1000):\n\n target = \"{:03}\".format(n)\n\n j = 0\n\n for i in range(N):\n\n if S[i] == target[j]:\n\n j += 1\n\n if j == 3:\n\n ans += 1\n\n break\n\n\n\nprint(ans)\n","code_v0_loc":17,"code_v1_loc":16,"code_v0_num_chars":295,"code_v1_num_chars":259,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nans = 0\nfor n in range(1000):\n c = [n \/\/ 100, (n \/\/ 10) % 10, n % 10]\n f = 0\n for i in range(N):\n if S[i] == str(c[f]):\n f += 1\n if f == 3:\n break\n if f == 3:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nans = 0\nfor n in range(1000):\n target = \"{:03}\".format(n)\n j = 0\n for i in range(N):\n if S[i] == target[j]:\n j += 1\n if j == 3:\n ans += 1\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["- c = [n \/\/ 100, (n \/\/ 10) % 10, n % 10]","- f = 0","+ target = \"{:03}\".format(n)","+ j = 0","- if S[i] == str(c[f]):","- f += 1","- if f == 3:","+ if S[i] == target[j]:","+ j += 1","+ if j == 3:","+ ans += 1","- if f == 3:","- ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0927883596,"measured_runtime_v1":0.0375839653,"runtime_lift":2.4688283653,"key":["s889909672","s859656880"]} +{"user_id":"u888092736","problem_id":"p03639","language":"python","submission_id_v0":"s311431841","submission_id_v1":"s354867105","cpu_time_v0":76,"cpu_time_v1":69,"memory_v0":11436,"memory_v1":11436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.21,"input":"from collections import defaultdict\n\n\n\n\n\nN = int(input())\n\ncounter = defaultdict(int)\n\nfor a in map(int, input().split()):\n\n if a % 4 == 0:\n\n counter[2] += 1\n\n elif a % 2 == 0:\n\n counter[1] += 1\n\n else:\n\n counter[0] += 1\n\nif counter[1] == 0:\n\n print('Yes') if counter[0] <= counter[2] + 1 else print('No')\n\nelse:\n\n print('Yes') if counter[0] <= counter[2] else print('No')\n","target":"from collections import Counter\n\n\n\n\n\nN = int(input())\n\nc = Counter(map(lambda x: int(x) % 4, input().split()))\n\nprint('Yes') if sum([c[1], c[2] > 0, c[3]]) <= c[0] + 1 else print('No')\n","code_v0_loc":16,"code_v1_loc":6,"code_v0_num_chars":409,"code_v1_num_chars":185,"code_v0_no_empty_lines":"from collections import defaultdict\n\nN = int(input())\ncounter = defaultdict(int)\nfor a in map(int, input().split()):\n if a % 4 == 0:\n counter[2] += 1\n elif a % 2 == 0:\n counter[1] += 1\n else:\n counter[0] += 1\nif counter[1] == 0:\n print(\"Yes\") if counter[0] <= counter[2] + 1 else print(\"No\")\nelse:\n print(\"Yes\") if counter[0] <= counter[2] else print(\"No\")\n","code_v1_no_empty_lines":"from collections import Counter\n\nN = int(input())\nc = Counter(map(lambda x: int(x) % 4, input().split()))\nprint(\"Yes\") if sum([c[1], c[2] > 0, c[3]]) <= c[0] + 1 else print(\"No\")\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-from collections import defaultdict","+from collections import Counter","-counter = defaultdict(int)","-for a in map(int, input().split()):","- if a % 4 == 0:","- counter[2] += 1","- elif a % 2 == 0:","- counter[1] += 1","- else:","- counter[0] += 1","-if counter[1] == 0:","- print(\"Yes\") if counter[0] <= counter[2] + 1 else print(\"No\")","-else:","- print(\"Yes\") if counter[0] <= counter[2] else print(\"No\")","+c = Counter(map(lambda x: int(x) % 4, input().split()))","+print(\"Yes\") if sum([c[1], c[2] > 0, c[3]]) <= c[0] + 1 else print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0394325733,"measured_runtime_v1":0.1024528503,"runtime_lift":0.3848850782,"key":["s311431841","s354867105"]} +{"user_id":"u333945892","problem_id":"p02993","language":"python","submission_id_v0":"s152411173","submission_id_v1":"s745999801","cpu_time_v0":43,"cpu_time_v1":29,"memory_v0":4336,"memory_v1":3956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.56,"input":"from collections import defaultdict,deque\n\nimport sys,heapq,bisect,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nINF = float('inf')\n\nmod = 10**9+7\n\neps = 10**-7\n\ndef inpl(): return list(map(int, input().split()))\n\ndef inpl_str(): return list(input().split())\n\n\n\nS = eval(input())\n\nbs = -1\n\nfor s in S:\n\n if s == bs:\n\n print('Bad')\n\n break\n\n bs = s\n\nelse:\n\n print('Good')\n","target":"from collections import defaultdict,deque\n\nimport sys,heapq,bisect,math,itertools,string,queue\n\nsys.setrecursionlimit(10**8)\n\nINF = float('inf')\n\nmod = 10**9+7\n\neps = 10**-7\n\ndef inp(): return int(eval(input()))\n\ndef inpl(): return list(map(int, input().split()))\n\ndef inpl_str(): return list(input().split())\n\n\n\nS = eval(input())\n\nif S[0] == S[1] or S[1]==S[2] or S[2]==S[3]:\n\n print('Bad')\n\nelse:\n\n print('Good')\n","code_v0_loc":18,"code_v1_loc":15,"code_v0_num_chars":401,"code_v1_num_chars":409,"code_v0_no_empty_lines":"from collections import defaultdict, deque\nimport sys, heapq, bisect, math, itertools, string, queue\n\nsys.setrecursionlimit(10**8)\nINF = float(\"inf\")\nmod = 10**9 + 7\neps = 10**-7\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\ndef inpl_str():\n return list(input().split())\n\n\nS = eval(input())\nbs = -1\nfor s in S:\n if s == bs:\n print(\"Bad\")\n break\n bs = s\nelse:\n print(\"Good\")\n","code_v1_no_empty_lines":"from collections import defaultdict, deque\nimport sys, heapq, bisect, math, itertools, string, queue\n\nsys.setrecursionlimit(10**8)\nINF = float(\"inf\")\nmod = 10**9 + 7\neps = 10**-7\n\n\ndef inp():\n return int(eval(input()))\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\ndef inpl_str():\n return list(input().split())\n\n\nS = eval(input())\nif S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:\n print(\"Bad\")\nelse:\n print(\"Good\")\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["+","+","+def inp():","+ return int(eval(input()))","-bs = -1","-for s in S:","- if s == bs:","- print(\"Bad\")","- break","- bs = s","+if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:","+ print(\"Bad\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0344286203,"measured_runtime_v1":0.0384899793,"runtime_lift":0.8944826935,"key":["s152411173","s745999801"]} +{"user_id":"u179169725","problem_id":"p03835","language":"python","submission_id_v0":"s401796588","submission_id_v1":"s561366304","cpu_time_v0":303,"cpu_time_v1":102,"memory_v0":40812,"memory_v1":68636,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.34,"input":"import sys\n\nsys.setrecursionlimit(1 << 25)\n\nread = sys.stdin.readline\n\nra = range\n\nenu = enumerate\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\ndef read_a_int():\n\n return int(read())\n\n\n\n\n\ndef read_tuple(H):\n\n '''\n\n H is number of rows\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(tuple(map(int, read().split())))\n\n return ret\n\n\n\n\n\ndef read_col(H):\n\n '''\n\n H is number of rows\n\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n\n ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(list(map(int, read().split())))\n\n return tuple(map(list, list(zip(*ret))))\n\n\n\n\n\ndef read_matrix(H):\n\n '''\n\n H is number of rows\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(list(map(int, read().split())))\n\n return ret\n\n # return [list(map(int, read().split())) for _ in range(H)] # \u5185\u5305\u8868\u8a18\u306fpypy\u3067\u306f\u9045\u3044\u305f\u3081\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\nfrom collections import defaultdict, Counter, deque\n\nfrom operator import itemgetter\n\nfrom itertools import product, permutations, combinations\n\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\n\n\n\n# \u5168\u901a\u308a\u8abf\u3079\u308b\u554f\u984c\n\nK, S = read_ints()\n\nX = list(range(K + 1)) # K\u306f2500\u306a\u306e\u3067K^2\u306f\u9593\u306b\u5408\u3046\n\n# X,Y\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\u3057\u3066Z\u306b\u3064\u3044\u3066\u4e8c\u5206\u63a2\u7d22\u3059\u308c\u3070\u3088\u3044 #\u9023\u7d9a\u306a\u306e\u3067\u7bc4\u56f2\u306b\u5165\u3063\u3066\u308c\u3070\u826f\u3044\uff08\u4e8c\u5206\u63a2\u7d22\u3082\u3044\u3089\u306a\u3044\uff01\uff09\n\nans = 0\n\nfor x in X:\n\n for y in X:\n\n z = S - x - y\n\n if 0 <= z <= K:\n\n ans += 1\n\nprint(ans)\n","target":"import sys\n\nsys.setrecursionlimit(1 << 25)\n\nreadline = sys.stdin.buffer.readline\n\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\n\nra = range\n\nenu = enumerate\n\n\n\n\n\ndef exit(*argv, **kwarg):\n\n print(*argv, **kwarg)\n\n sys.exit()\n\n\n\n\n\ndef mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))\n\n# \u53d7\u3051\u6e21\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u8981\u7d20\u304b\u3089sub\u3060\u3051\u5f15\u304f.\u30ea\u30b9\u30c8\u3092*\u3092\u3064\u3051\u3066\u5c55\u958b\u3057\u3066\u304a\u304f\u3053\u3068\n\n\n\n\n\ndef a_int(): return int(readline())\n\n\n\n\n\ndef ints(): return list(map(int, readline().split()))\n\n\n\n\n\ndef read_col(H):\n\n '''H is number of rows\n\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n\n ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408'''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(list(map(int, readline().split())))\n\n return tuple(map(list, zip(*ret)))\n\n\n\n\n\ndef read_tuple(H):\n\n '''H is number of rows'''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(tuple(map(int, readline().split())))\n\n return ret\n\n\n\n\n\ndef read_matrix(H):\n\n '''H is number of rows'''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(list(map(int, readline().split())))\n\n return ret\n\n # return [list(map(int, read().split())) for _ in range(H)] # \u5185\u5305\u8868\u8a18\u306fpypy\u3067\u306f\u9045\u3044\u305f\u3081\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\nfrom collections import defaultdict, Counter, deque\n\nfrom operator import itemgetter, xor, add\n\nfrom itertools import product, permutations, combinations\n\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\n\nfrom functools import reduce\n\nfrom math import gcd\n\n\n\n\n\ndef lcm(a, b):\n\n # \u6700\u5c0f\u516c\u500d\u6570\n\n g = gcd(a, b)\n\n return a \/\/ g * b\n\n\n\n\n\nK, S = ints()\n\nans = 0\n\nfor x in range(K + 1):\n\n for y in range(K + 1):\n\n z = S - x - y\n\n if 0 <= z <= K:\n\n # print(x, y, z)\n\n ans += 1\n\n\n\nprint(ans)\n","code_v0_loc":67,"code_v1_loc":77,"code_v0_num_chars":1469,"code_v1_num_chars":1747,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1 << 25)\nread = sys.stdin.readline\nra = range\nenu = enumerate\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_a_int():\n return int(read())\n\n\ndef read_tuple(H):\n \"\"\"\n H is number of rows\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, read().split())))\n return ret\n\n\ndef read_col(H):\n \"\"\"\n H is number of rows\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(list(map(int, read().split())))\n return tuple(map(list, list(zip(*ret))))\n\n\ndef read_matrix(H):\n \"\"\"\n H is number of rows\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(list(map(int, read().split())))\n return ret\n # return [list(map(int, read().split())) for _ in range(H)] # \u5185\u5305\u8868\u8a18\u306fpypy\u3067\u306f\u9045\u3044\u305f\u3081\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nfrom collections import defaultdict, Counter, deque\nfrom operator import itemgetter\nfrom itertools import product, permutations, combinations\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\n\n# \u5168\u901a\u308a\u8abf\u3079\u308b\u554f\u984c\nK, S = read_ints()\nX = list(range(K + 1)) # K\u306f2500\u306a\u306e\u3067K^2\u306f\u9593\u306b\u5408\u3046\n# X,Y\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\u3057\u3066Z\u306b\u3064\u3044\u3066\u4e8c\u5206\u63a2\u7d22\u3059\u308c\u3070\u3088\u3044 #\u9023\u7d9a\u306a\u306e\u3067\u7bc4\u56f2\u306b\u5165\u3063\u3066\u308c\u3070\u826f\u3044\uff08\u4e8c\u5206\u63a2\u7d22\u3082\u3044\u3089\u306a\u3044\uff01\uff09\nans = 0\nfor x in X:\n for y in X:\n z = S - x - y\n if 0 <= z <= K:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1 << 25)\nreadline = sys.stdin.buffer.readline\nread = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061\nra = range\nenu = enumerate\n\n\ndef exit(*argv, **kwarg):\n print(*argv, **kwarg)\n sys.exit()\n\n\ndef mina(*argv, sub=1):\n return list(map(lambda x: x - sub, argv))\n\n\n# \u53d7\u3051\u6e21\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u8981\u7d20\u304b\u3089sub\u3060\u3051\u5f15\u304f.\u30ea\u30b9\u30c8\u3092*\u3092\u3064\u3051\u3066\u5c55\u958b\u3057\u3066\u304a\u304f\u3053\u3068\ndef a_int():\n return int(readline())\n\n\ndef ints():\n return list(map(int, readline().split()))\n\n\ndef read_col(H):\n \"\"\"H is number of rows\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408\"\"\"\n ret = []\n for _ in range(H):\n ret.append(list(map(int, readline().split())))\n return tuple(map(list, zip(*ret)))\n\n\ndef read_tuple(H):\n \"\"\"H is number of rows\"\"\"\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, readline().split())))\n return ret\n\n\ndef read_matrix(H):\n \"\"\"H is number of rows\"\"\"\n ret = []\n for _ in range(H):\n ret.append(list(map(int, readline().split())))\n return ret\n # return [list(map(int, read().split())) for _ in range(H)] # \u5185\u5305\u8868\u8a18\u306fpypy\u3067\u306f\u9045\u3044\u305f\u3081\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nfrom collections import defaultdict, Counter, deque\nfrom operator import itemgetter, xor, add\nfrom itertools import product, permutations, combinations\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\nfrom functools import reduce\nfrom math import gcd\n\n\ndef lcm(a, b):\n # \u6700\u5c0f\u516c\u500d\u6570\n g = gcd(a, b)\n return a \/\/ g * b\n\n\nK, S = ints()\nans = 0\nfor x in range(K + 1):\n for y in range(K + 1):\n z = S - x - y\n if 0 <= z <= K:\n # print(x, y, z)\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":12.987012987,"diff":["-read = sys.stdin.readline","+readline = sys.stdin.buffer.readline","+read = sys.stdin.readline # \u6587\u5b57\u5217\u8aad\u307f\u8fbc\u3080\u6642\u306f\u3053\u3063\u3061","-def read_ints():","- return list(map(int, read().split()))","+def exit(*argv, **kwarg):","+ print(*argv, **kwarg)","+ sys.exit()","-def read_a_int():","- return int(read())","+def mina(*argv, sub=1):","+ return list(map(lambda x: x - sub, argv))","+","+","+# \u53d7\u3051\u6e21\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u8981\u7d20\u304b\u3089sub\u3060\u3051\u5f15\u304f.\u30ea\u30b9\u30c8\u3092*\u3092\u3064\u3051\u3066\u5c55\u958b\u3057\u3066\u304a\u304f\u3053\u3068","+def a_int():","+ return int(readline())","+","+","+def ints():","+ return list(map(int, readline().split()))","+","+","+def read_col(H):","+ \"\"\"H is number of rows","+ A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d","+ ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408\"\"\"","+ ret = []","+ for _ in range(H):","+ ret.append(list(map(int, readline().split())))","+ return tuple(map(list, zip(*ret)))","- \"\"\"","- H is number of rows","- \"\"\"","+ \"\"\"H is number of rows\"\"\"","- ret.append(tuple(map(int, read().split())))","+ ret.append(tuple(map(int, readline().split())))","-def read_col(H):","- \"\"\"","- H is number of rows","- A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d","- ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408","- \"\"\"","+def read_matrix(H):","+ \"\"\"H is number of rows\"\"\"","- ret.append(list(map(int, read().split())))","- return tuple(map(list, list(zip(*ret))))","-","-","-def read_matrix(H):","- \"\"\"","- H is number of rows","- \"\"\"","- ret = []","- for _ in range(H):","- ret.append(list(map(int, read().split())))","+ ret.append(list(map(int, readline().split())))","-from operator import itemgetter","+from operator import itemgetter, xor, add","+from functools import reduce","+from math import gcd","-# \u5168\u901a\u308a\u8abf\u3079\u308b\u554f\u984c","-K, S = read_ints()","-X = list(range(K + 1)) # K\u306f2500\u306a\u306e\u3067K^2\u306f\u9593\u306b\u5408\u3046","-# X,Y\u306b\u3064\u3044\u3066\u5168\u63a2\u7d22\u3057\u3066Z\u306b\u3064\u3044\u3066\u4e8c\u5206\u63a2\u7d22\u3059\u308c\u3070\u3088\u3044 #\u9023\u7d9a\u306a\u306e\u3067\u7bc4\u56f2\u306b\u5165\u3063\u3066\u308c\u3070\u826f\u3044\uff08\u4e8c\u5206\u63a2\u7d22\u3082\u3044\u3089\u306a\u3044\uff01\uff09","+","+def lcm(a, b):","+ # \u6700\u5c0f\u516c\u500d\u6570","+ g = gcd(a, b)","+ return a \/\/ g * b","+","+","+K, S = ints()","-for x in X:","- for y in X:","+for x in range(K + 1):","+ for y in range(K + 1):","+ # print(x, y, z)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463401522,"measured_runtime_v1":0.0462353083,"runtime_lift":1.0022676143,"key":["s401796588","s561366304"]} +{"user_id":"u970197315","problem_id":"p03163","language":"python","submission_id_v0":"s110660317","submission_id_v1":"s710784643","cpu_time_v0":498,"cpu_time_v1":307,"memory_v0":120556,"memory_v1":147280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.35,"input":"N,W=list(map(int,input().split()))\n\nw,v=[],[]\n\nfor i in range(N):\n\n a,b=list(map(int,input().split()))\n\n w.append(a)\n\n v.append(b)\n\ndp=[[0]*(W+1) for i in range(N+1)]\n\nfor i in range(N):\n\n for j in range(W+1):\n\n if j-w[i]>=0:\n\n dp[i+1][j]=dp[i][j-w[i]]+v[i]\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\nprint((dp[N][W]))","target":"N,W=list(map(int,input().split()))\n\nw,v=[],[]\n\nfor i in range(N):\n\n ww,vv=list(map(int,input().split()))\n\n w.append(ww)\n\n v.append(vv)\n\ndp=[[0]*(W+1) for i in range(N+1)]\n\n\n\nfor i in range(N):\n\n for j in range(W+1):\n\n if j-w[i]>=0:\n\n dp[i+1][j]=max(dp[i][j-w[i]]+v[i],dp[i+1][j])\n\n dp[i+1][j]=max(dp[i+1][j],dp[i][j])\n\n\n\nprint((dp[-1][-1]))\n","code_v0_loc":13,"code_v1_loc":15,"code_v0_num_chars":323,"code_v1_num_chars":342,"code_v0_no_empty_lines":"N, W = list(map(int, input().split()))\nw, v = [], []\nfor i in range(N):\n a, b = list(map(int, input().split()))\n w.append(a)\n v.append(b)\ndp = [[0] * (W + 1) for i in range(N + 1)]\nfor i in range(N):\n for j in range(W + 1):\n if j - w[i] >= 0:\n dp[i + 1][j] = dp[i][j - w[i]] + v[i]\n dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])\nprint((dp[N][W]))\n","code_v1_no_empty_lines":"N, W = list(map(int, input().split()))\nw, v = [], []\nfor i in range(N):\n ww, vv = list(map(int, input().split()))\n w.append(ww)\n v.append(vv)\ndp = [[0] * (W + 1) for i in range(N + 1)]\nfor i in range(N):\n for j in range(W + 1):\n if j - w[i] >= 0:\n dp[i + 1][j] = max(dp[i][j - w[i]] + v[i], dp[i + 1][j])\n dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])\nprint((dp[-1][-1]))\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["- a, b = list(map(int, input().split()))","- w.append(a)","- v.append(b)","+ ww, vv = list(map(int, input().split()))","+ w.append(ww)","+ v.append(vv)","- dp[i + 1][j] = dp[i][j - w[i]] + v[i]","+ dp[i + 1][j] = max(dp[i][j - w[i]] + v[i], dp[i + 1][j])","-print((dp[N][W]))","+print((dp[-1][-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1182061195,"measured_runtime_v1":0.0456564426,"runtime_lift":2.5890348146,"key":["s110660317","s710784643"]} +{"user_id":"u905203728","problem_id":"p04045","language":"python","submission_id_v0":"s442900040","submission_id_v1":"s156034679","cpu_time_v0":193,"cpu_time_v1":117,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.38,"input":"n,k=list(map(int,input().split()))\n\nD=set(list(map(int,input().split())))\n\n\n\nfor i in range(n,10*n):\n\n num=set(list(map(int,str(i))))\n\n if i>=n and len(D&num)==0:\n\n print(i)\n\n exit()","target":"n,k=list(map(int,input().split()))\n\nD=set(list(map(str,input().split())))\n\n\n\nfor i in range(n,10*n):\n\n num=set(list(str(i)))\n\n if i>=n and len(D&num)==0:\n\n print(i)\n\n exit()","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":196,"code_v1_num_chars":187,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nD = set(list(map(int, input().split())))\nfor i in range(n, 10 * n):\n num = set(list(map(int, str(i))))\n if i >= n and len(D & num) == 0:\n print(i)\n exit()\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nD = set(list(map(str, input().split())))\nfor i in range(n, 10 * n):\n num = set(list(str(i)))\n if i >= n and len(D & num) == 0:\n print(i)\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-D = set(list(map(int, input().split())))","+D = set(list(map(str, input().split())))","- num = set(list(map(int, str(i))))","+ num = set(list(str(i)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0592674732,"measured_runtime_v1":0.0398107052,"runtime_lift":1.4887320617,"key":["s442900040","s156034679"]} +{"user_id":"u068727970","problem_id":"p04001","language":"python","submission_id_v0":"s919915325","submission_id_v1":"s444081538","cpu_time_v0":35,"cpu_time_v1":32,"memory_v0":3700,"memory_v1":8920,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.57,"input":"import copy\n\n\n\ndef culc(array):\n\n summy = 0\n\n indexes = [i for i, x in enumerate(array) if x == '+']\n\n ff = 0\n\n for i in indexes:\n\n summy += int(\"\".join(array[ff:i]))\n\n ff = i+1\n\n summy += int(\"\".join(array[ff:]))\n\n return summy\n\n\n\nnums = list(eval(input()))\n\nans = 0\n\n\n\nfor i in range(2**(len(nums)-1)):\n\n bit = bin(i)\n\n obj = copy.deepcopy(nums)\n\n k = 0\n\n for j in range(len(nums)-1):\n\n if ( i >> j) & 1:\n\n obj.insert(j+1+k,'+')\n\n k += 1\n\n ans += culc(obj)\n\n\n\nprint(ans)","target":"S = list(eval(input()))\n\nans = 0\n\n\n\nfor i in range(2**(len(S)-1)):\n\n tmp = S\n\n p = list(bin(i))\n\n flag = ['0' for _ in range(len(S) - len(p) + 1)] + p[2:]\n\n nums = []\n\n l = 0\n\n for j in range(len(S)-1):\n\n if flag[j] == '1':\n\n nums.append(\"\".join(tmp[l:j+1]))\n\n l = j+1\n\n nums.append(\"\".join(tmp[l:]))\n\n for n in nums:\n\n ans += int(n)\n\n\n\nprint(ans)\n","code_v0_loc":26,"code_v1_loc":18,"code_v0_num_chars":542,"code_v1_num_chars":402,"code_v0_no_empty_lines":"import copy\n\n\ndef culc(array):\n summy = 0\n indexes = [i for i, x in enumerate(array) if x == \"+\"]\n ff = 0\n for i in indexes:\n summy += int(\"\".join(array[ff:i]))\n ff = i + 1\n summy += int(\"\".join(array[ff:]))\n return summy\n\n\nnums = list(eval(input()))\nans = 0\nfor i in range(2 ** (len(nums) - 1)):\n bit = bin(i)\n obj = copy.deepcopy(nums)\n k = 0\n for j in range(len(nums) - 1):\n if (i >> j) & 1:\n obj.insert(j + 1 + k, \"+\")\n k += 1\n ans += culc(obj)\nprint(ans)\n","code_v1_no_empty_lines":"S = list(eval(input()))\nans = 0\nfor i in range(2 ** (len(S) - 1)):\n tmp = S\n p = list(bin(i))\n flag = [\"0\" for _ in range(len(S) - len(p) + 1)] + p[2:]\n nums = []\n l = 0\n for j in range(len(S) - 1):\n if flag[j] == \"1\":\n nums.append(\"\".join(tmp[l : j + 1]))\n l = j + 1\n nums.append(\"\".join(tmp[l:]))\n for n in nums:\n ans += int(n)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.7692307692,"diff":["-import copy","-","-","-def culc(array):","- summy = 0","- indexes = [i for i, x in enumerate(array) if x == \"+\"]","- ff = 0","- for i in indexes:","- summy += int(\"\".join(array[ff:i]))","- ff = i + 1","- summy += int(\"\".join(array[ff:]))","- return summy","-","-","-nums = list(eval(input()))","+S = list(eval(input()))","-for i in range(2 ** (len(nums) - 1)):","- bit = bin(i)","- obj = copy.deepcopy(nums)","- k = 0","- for j in range(len(nums) - 1):","- if (i >> j) & 1:","- obj.insert(j + 1 + k, \"+\")","- k += 1","- ans += culc(obj)","+for i in range(2 ** (len(S) - 1)):","+ tmp = S","+ p = list(bin(i))","+ flag = [\"0\" for _ in range(len(S) - len(p) + 1)] + p[2:]","+ nums = []","+ l = 0","+ for j in range(len(S) - 1):","+ if flag[j] == \"1\":","+ nums.append(\"\".join(tmp[l : j + 1]))","+ l = j + 1","+ nums.append(\"\".join(tmp[l:]))","+ for n in nums:","+ ans += int(n)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0392690659,"measured_runtime_v1":0.038076067,"runtime_lift":1.0313319881,"key":["s919915325","s444081538"]} +{"user_id":"u678167152","problem_id":"p03061","language":"python","submission_id_v0":"s002756347","submission_id_v1":"s841002278","cpu_time_v0":240,"cpu_time_v1":174,"memory_v0":63984,"memory_v1":85296,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.5,"input":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\ndef common_divisor(n):\n\n cd = []\n\n for i in range(1,int(n**0.5)+2):\n\n if n%i==0:\n\n cd.append(i)\n\n if i != n\/\/i:\n\n cd.append(n\/\/i)\n\n return set(cd)\n\n\n\n#print(cd_dic)\n\ncds = common_divisor(A[0]).union(common_divisor(A[1]))\n\nans = 1\n\nfor k in cds:\n\n #print(cd_dic)\n\n cnt = 0\n\n for a in A:\n\n if a%k!=0:\n\n cnt += 1\n\n if cnt == 2:\n\n break\n\n else:\n\n ans = max(ans,k)\n\n\n\nprint(ans)","target":"class SegmentTree():\n\n def __init__(self, n, oper, e):\n\n self.n = n\n\n self.oper = oper\n\n self.e = e\n\n self.log = (n - 1).bit_length()\n\n self.size = 1 << self.log\n\n self.data = [e] * (2 * self.size)\n\n\n\n def update(self, k):\n\n self.data[k] = self.oper(self.data[2 * k], self.data[2 * k + 1])\n\n\n\n def build(self, arr):\n\n #assert len(arr) <= self.n\n\n for i in range(self.n):\n\n self.data[self.size + i] = arr[i]\n\n for i in range(self.size-1,0,-1):\n\n self.update(i)\n\n\n\n def set(self, p, x):\n\n #assert 0 <= p < self.n\n\n p += self.size\n\n self.data[p] = x\n\n for i in range(self.log):\n\n p >>= 1\n\n self.update(p)\n\n\n\n def get(self, p):\n\n #assert 0 <= p < self.n\n\n return self.data[p + self.size]\n\n\n\n def prod(self, l, r):\n\n #assert 0 <= l <= r <= self.n\n\n sml = smr = self.e\n\n l += self.size\n\n r += self.size\n\n while l < r:\n\n if l & 1:\n\n sml = self.oper(sml, self.data[l])\n\n l += 1\n\n if r & 1:\n\n r -= 1\n\n smr = self.oper(self.data[r], smr)\n\n l >>= 1\n\n r >>= 1\n\n return self.oper(sml, smr)\n\n\n\n def all_prod(self):\n\n return self.data[1]\n\n\n\n def max_right(self, l, f):\n\n #assert 0 <= l <= self.n\n\n #assert f(self.)\n\n if l == self.n: return self.n\n\n l += self.size\n\n sm = self.e\n\n while True:\n\n while l % 2 == 0: l >>= 1\n\n if not f(self.oper(sm, self.data[l])):\n\n while l < self.size:\n\n l = 2 * l\n\n if f(self.oper(sm, self.data[l])):\n\n sm = self.oper(sm, self.data[l])\n\n l += 1\n\n return l - self.size\n\n sm = self.oper(sm, self.data[l])\n\n l += 1\n\n if (l & -l) == l: break\n\n return self.n\n\n\n\n def min_left(self, r, f):\n\n #assert 0 <= r <= self.n\n\n #assert f(self.)\n\n if r == 0: return 0\n\n r += self.size\n\n sm = self.e\n\n while True:\n\n r -= 1\n\n while r > 1 and (r % 2): r >>= 1\n\n if not f(self.oper(self.data[r], sm)):\n\n while r < self.size:\n\n r = 2 * r + 1\n\n if f(self.oper(self.data[r], sm)):\n\n sm = self.oper(self.data[r], sm)\n\n r -= 1\n\n return r + 1 - self.size\n\n sm = self.oper(self.data[r], sm)\n\n if (r & -r) == r: break\n\n return 0\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nfrom math import gcd\n\n\n\ne = 0\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nst = SegmentTree(N,gcd,e)\n\nst.build(A)\n\n\n\nans = max(st.prod(1,N),st.prod(0,N-1))\n\nfor i in range(1,N-1):\n\n ans = max(ans, gcd(st.prod(0,i),st.prod(i+1,N)))\n\nprint(ans)","code_v0_loc":27,"code_v1_loc":107,"code_v0_num_chars":546,"code_v1_num_chars":2567,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\n\n\ndef common_divisor(n):\n cd = []\n for i in range(1, int(n**0.5) + 2):\n if n % i == 0:\n cd.append(i)\n if i != n \/\/ i:\n cd.append(n \/\/ i)\n return set(cd)\n\n\n# print(cd_dic)\ncds = common_divisor(A[0]).union(common_divisor(A[1]))\nans = 1\nfor k in cds:\n # print(cd_dic)\n cnt = 0\n for a in A:\n if a % k != 0:\n cnt += 1\n if cnt == 2:\n break\n else:\n ans = max(ans, k)\nprint(ans)\n","code_v1_no_empty_lines":"class SegmentTree:\n def __init__(self, n, oper, e):\n self.n = n\n self.oper = oper\n self.e = e\n self.log = (n - 1).bit_length()\n self.size = 1 << self.log\n self.data = [e] * (2 * self.size)\n\n def update(self, k):\n self.data[k] = self.oper(self.data[2 * k], self.data[2 * k + 1])\n\n def build(self, arr):\n # assert len(arr) <= self.n\n for i in range(self.n):\n self.data[self.size + i] = arr[i]\n for i in range(self.size - 1, 0, -1):\n self.update(i)\n\n def set(self, p, x):\n # assert 0 <= p < self.n\n p += self.size\n self.data[p] = x\n for i in range(self.log):\n p >>= 1\n self.update(p)\n\n def get(self, p):\n # assert 0 <= p < self.n\n return self.data[p + self.size]\n\n def prod(self, l, r):\n # assert 0 <= l <= r <= self.n\n sml = smr = self.e\n l += self.size\n r += self.size\n while l < r:\n if l & 1:\n sml = self.oper(sml, self.data[l])\n l += 1\n if r & 1:\n r -= 1\n smr = self.oper(self.data[r], smr)\n l >>= 1\n r >>= 1\n return self.oper(sml, smr)\n\n def all_prod(self):\n return self.data[1]\n\n def max_right(self, l, f):\n # assert 0 <= l <= self.n\n # assert f(self.)\n if l == self.n:\n return self.n\n l += self.size\n sm = self.e\n while True:\n while l % 2 == 0:\n l >>= 1\n if not f(self.oper(sm, self.data[l])):\n while l < self.size:\n l = 2 * l\n if f(self.oper(sm, self.data[l])):\n sm = self.oper(sm, self.data[l])\n l += 1\n return l - self.size\n sm = self.oper(sm, self.data[l])\n l += 1\n if (l & -l) == l:\n break\n return self.n\n\n def min_left(self, r, f):\n # assert 0 <= r <= self.n\n # assert f(self.)\n if r == 0:\n return 0\n r += self.size\n sm = self.e\n while True:\n r -= 1\n while r > 1 and (r % 2):\n r >>= 1\n if not f(self.oper(self.data[r], sm)):\n while r < self.size:\n r = 2 * r + 1\n if f(self.oper(self.data[r], sm)):\n sm = self.oper(self.data[r], sm)\n r -= 1\n return r + 1 - self.size\n sm = self.oper(self.data[r], sm)\n if (r & -r) == r:\n break\n return 0\n\n\nimport sys\n\ninput = sys.stdin.readline\nfrom math import gcd\n\ne = 0\nN = int(eval(input()))\nA = list(map(int, input().split()))\nst = SegmentTree(N, gcd, e)\nst.build(A)\nans = max(st.prod(1, N), st.prod(0, N - 1))\nfor i in range(1, N - 1):\n ans = max(ans, gcd(st.prod(0, i), st.prod(i + 1, N)))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":74.7663551402,"diff":["+class SegmentTree:","+ def __init__(self, n, oper, e):","+ self.n = n","+ self.oper = oper","+ self.e = e","+ self.log = (n - 1).bit_length()","+ self.size = 1 << self.log","+ self.data = [e] * (2 * self.size)","+","+ def update(self, k):","+ self.data[k] = self.oper(self.data[2 * k], self.data[2 * k + 1])","+","+ def build(self, arr):","+ # assert len(arr) <= self.n","+ for i in range(self.n):","+ self.data[self.size + i] = arr[i]","+ for i in range(self.size - 1, 0, -1):","+ self.update(i)","+","+ def set(self, p, x):","+ # assert 0 <= p < self.n","+ p += self.size","+ self.data[p] = x","+ for i in range(self.log):","+ p >>= 1","+ self.update(p)","+","+ def get(self, p):","+ # assert 0 <= p < self.n","+ return self.data[p + self.size]","+","+ def prod(self, l, r):","+ # assert 0 <= l <= r <= self.n","+ sml = smr = self.e","+ l += self.size","+ r += self.size","+ while l < r:","+ if l & 1:","+ sml = self.oper(sml, self.data[l])","+ l += 1","+ if r & 1:","+ r -= 1","+ smr = self.oper(self.data[r], smr)","+ l >>= 1","+ r >>= 1","+ return self.oper(sml, smr)","+","+ def all_prod(self):","+ return self.data[1]","+","+ def max_right(self, l, f):","+ # assert 0 <= l <= self.n","+ # assert f(self.)","+ if l == self.n:","+ return self.n","+ l += self.size","+ sm = self.e","+ while True:","+ while l % 2 == 0:","+ l >>= 1","+ if not f(self.oper(sm, self.data[l])):","+ while l < self.size:","+ l = 2 * l","+ if f(self.oper(sm, self.data[l])):","+ sm = self.oper(sm, self.data[l])","+ l += 1","+ return l - self.size","+ sm = self.oper(sm, self.data[l])","+ l += 1","+ if (l & -l) == l:","+ break","+ return self.n","+","+ def min_left(self, r, f):","+ # assert 0 <= r <= self.n","+ # assert f(self.)","+ if r == 0:","+ return 0","+ r += self.size","+ sm = self.e","+ while True:","+ r -= 1","+ while r > 1 and (r % 2):","+ r >>= 1","+ if not f(self.oper(self.data[r], sm)):","+ while r < self.size:","+ r = 2 * r + 1","+ if f(self.oper(self.data[r], sm)):","+ sm = self.oper(self.data[r], sm)","+ r -= 1","+ return r + 1 - self.size","+ sm = self.oper(self.data[r], sm)","+ if (r & -r) == r:","+ break","+ return 0","+","+","+import sys","+","+input = sys.stdin.readline","+from math import gcd","+","+e = 0","-","-","-def common_divisor(n):","- cd = []","- for i in range(1, int(n**0.5) + 2):","- if n % i == 0:","- cd.append(i)","- if i != n \/\/ i:","- cd.append(n \/\/ i)","- return set(cd)","-","-","-# print(cd_dic)","-cds = common_divisor(A[0]).union(common_divisor(A[1]))","-ans = 1","-for k in cds:","- # print(cd_dic)","- cnt = 0","- for a in A:","- if a % k != 0:","- cnt += 1","- if cnt == 2:","- break","- else:","- ans = max(ans, k)","+st = SegmentTree(N, gcd, e)","+st.build(A)","+ans = max(st.prod(1, N), st.prod(0, N - 1))","+for i in range(1, N - 1):","+ ans = max(ans, gcd(st.prod(0, i), st.prod(i + 1, N)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0456154492,"measured_runtime_v1":0.0433942792,"runtime_lift":1.0511857779,"key":["s002756347","s841002278"]} +{"user_id":"u077291787","problem_id":"p03559","language":"python","submission_id_v0":"s068810868","submission_id_v1":"s371238791","cpu_time_v0":330,"cpu_time_v1":298,"memory_v0":23244,"memory_v1":22720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.7,"input":"# ABC084C - Snuke Festival\n\n# Binary search\n\nfrom bisect import bisect_left, bisect_right\n\n\n\nn = int(eval(input()))\n\nA, B, C = [sorted(list(map(int, input().rstrip().split()))) for _ in range(3)]\n\nlgth = len(C)\n\nans = 0\n\nfor i in B:\n\n ans += bisect_left(A, i) * (lgth - bisect_right(C, i))\n\nprint(ans)","target":"# ARC084C - Snuke Festival\n\nfrom bisect import bisect_left, bisect_right\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n A, B, C = [sorted(tuple(map(int, input().rstrip().split()))) for _ in range(3)]\n\n l, ans = len(C), 0\n\n for i in B:\n\n ans += bisect_left(A, i) * (l - bisect_right(C, i))\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":298,"code_v1_num_chars":356,"code_v0_no_empty_lines":"# ABC084C - Snuke Festival\n# Binary search\nfrom bisect import bisect_left, bisect_right\n\nn = int(eval(input()))\nA, B, C = [sorted(list(map(int, input().rstrip().split()))) for _ in range(3)]\nlgth = len(C)\nans = 0\nfor i in B:\n ans += bisect_left(A, i) * (lgth - bisect_right(C, i))\nprint(ans)\n","code_v1_no_empty_lines":"# ARC084C - Snuke Festival\nfrom bisect import bisect_left, bisect_right\n\n\ndef main():\n n = int(eval(input()))\n A, B, C = [sorted(tuple(map(int, input().rstrip().split()))) for _ in range(3)]\n l, ans = len(C), 0\n for i in B:\n ans += bisect_left(A, i) * (l - bisect_right(C, i))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-# ABC084C - Snuke Festival","-# Binary search","+# ARC084C - Snuke Festival","-n = int(eval(input()))","-A, B, C = [sorted(list(map(int, input().rstrip().split()))) for _ in range(3)]","-lgth = len(C)","-ans = 0","-for i in B:","- ans += bisect_left(A, i) * (lgth - bisect_right(C, i))","-print(ans)","+","+def main():","+ n = int(eval(input()))","+ A, B, C = [sorted(tuple(map(int, input().rstrip().split()))) for _ in range(3)]","+ l, ans = len(C), 0","+ for i in B:","+ ans += bisect_left(A, i) * (l - bisect_right(C, i))","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0898456032,"measured_runtime_v1":0.0444514611,"runtime_lift":2.0212069757,"key":["s068810868","s371238791"]} +{"user_id":"u476383383","problem_id":"p02971","language":"python","submission_id_v0":"s792797997","submission_id_v1":"s618427802","cpu_time_v0":573,"cpu_time_v1":321,"memory_v0":15712,"memory_v1":14424,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.98,"input":"n = int(eval(input()))\n\na_list = [int(eval(input())) for _ in range(n)]\n\nsorted_a_list = sorted(a_list)\n\nmax_num = sorted_a_list[-1]\n\nsecond_max_num = sorted_a_list[-2]\n\n\n\nresult = [0]*n\n\nfor i in range(n):\n\n if a_list[i] == max_num:\n\n result[i] = second_max_num\n\n else:\n\n result[i] = max_num\n\n\n\nfor i in range(n):\n\n print((result[i]))","target":"import sys\n\nfrom collections import defaultdict\n\nfrom heapq import *\n\nsys.setrecursionlimit(10**8)\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n \"\"\" main \"\"\"\n\n N = int(eval(input()))\n\n AS = [int(eval(input())) for _ in range(N)]\n\n AS_dup = AS[:]\n\n AS.sort()\n\n for i in range(N):\n\n if AS_dup[i] == AS[-1]:\n\n print((AS[-2]))\n\n else:\n\n print((AS[-1]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":15,"code_v1_loc":22,"code_v0_num_chars":344,"code_v1_num_chars":431,"code_v0_no_empty_lines":"n = int(eval(input()))\na_list = [int(eval(input())) for _ in range(n)]\nsorted_a_list = sorted(a_list)\nmax_num = sorted_a_list[-1]\nsecond_max_num = sorted_a_list[-2]\nresult = [0] * n\nfor i in range(n):\n if a_list[i] == max_num:\n result[i] = second_max_num\n else:\n result[i] = max_num\nfor i in range(n):\n print((result[i]))\n","code_v1_no_empty_lines":"import sys\nfrom collections import defaultdict\nfrom heapq import *\n\nsys.setrecursionlimit(10**8)\ninput = sys.stdin.readline\n\n\ndef main():\n \"\"\"main\"\"\"\n N = int(eval(input()))\n AS = [int(eval(input())) for _ in range(N)]\n AS_dup = AS[:]\n AS.sort()\n for i in range(N):\n if AS_dup[i] == AS[-1]:\n print((AS[-2]))\n else:\n print((AS[-1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":31.8181818182,"diff":["-n = int(eval(input()))","-a_list = [int(eval(input())) for _ in range(n)]","-sorted_a_list = sorted(a_list)","-max_num = sorted_a_list[-1]","-second_max_num = sorted_a_list[-2]","-result = [0] * n","-for i in range(n):","- if a_list[i] == max_num:","- result[i] = second_max_num","- else:","- result[i] = max_num","-for i in range(n):","- print((result[i]))","+import sys","+from collections import defaultdict","+from heapq import *","+","+sys.setrecursionlimit(10**8)","+input = sys.stdin.readline","+","+","+def main():","+ \"\"\"main\"\"\"","+ N = int(eval(input()))","+ AS = [int(eval(input())) for _ in range(N)]","+ AS_dup = AS[:]","+ AS.sort()","+ for i in range(N):","+ if AS_dup[i] == AS[-1]:","+ print((AS[-2]))","+ else:","+ print((AS[-1]))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0395452611,"measured_runtime_v1":0.0351907758,"runtime_lift":1.1237393938,"key":["s792797997","s618427802"]} +{"user_id":"u518042385","problem_id":"p03127","language":"python","submission_id_v0":"s260897563","submission_id_v1":"s322028949","cpu_time_v0":732,"cpu_time_v1":110,"memory_v0":14224,"memory_v1":14252,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.97,"input":"n=int(eval(input()))\n\nl=sorted(list(map(int,input().split())))\n\nm=min(l)\n\nl2=[]\n\nl3=[]\n\nfor i in range(1,int(m**(1\/2)+1)):\n\n if m%i==0: \n\n l2.append(i)\n\n if i!=m\/\/i:\n\n l2.append(m\/\/i)\n\nfor i in l2:\n\n b=True\n\n for j in l:\n\n if j%i==0:\n\n pass\n\n else:\n\n b=False\n\n if b:\n\n l3.append(i)\n\nprint((max(l3)))","target":"def gcd(n,m):\n\n a=min(n,m)\n\n b=max(n,m)\n\n while a!=0:\n\n b,a=a,b%a\n\n return b\n\nn=int(eval(input()))\n\nl=list(map(int,input().split()))\n\nans=l[0]\n\nfor i in range(1,n):\n\n ans=gcd(ans,l[i])\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":12,"code_v0_num_chars":343,"code_v1_num_chars":198,"code_v0_no_empty_lines":"n = int(eval(input()))\nl = sorted(list(map(int, input().split())))\nm = min(l)\nl2 = []\nl3 = []\nfor i in range(1, int(m ** (1 \/ 2) + 1)):\n if m % i == 0:\n l2.append(i)\n if i != m \/\/ i:\n l2.append(m \/\/ i)\nfor i in l2:\n b = True\n for j in l:\n if j % i == 0:\n pass\n else:\n b = False\n if b:\n l3.append(i)\nprint((max(l3)))\n","code_v1_no_empty_lines":"def gcd(n, m):\n a = min(n, m)\n b = max(n, m)\n while a != 0:\n b, a = a, b % a\n return b\n\n\nn = int(eval(input()))\nl = list(map(int, input().split()))\nans = l[0]\nfor i in range(1, n):\n ans = gcd(ans, l[i])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["+def gcd(n, m):","+ a = min(n, m)","+ b = max(n, m)","+ while a != 0:","+ b, a = a, b % a","+ return b","+","+","-l = sorted(list(map(int, input().split())))","-m = min(l)","-l2 = []","-l3 = []","-for i in range(1, int(m ** (1 \/ 2) + 1)):","- if m % i == 0:","- l2.append(i)","- if i != m \/\/ i:","- l2.append(m \/\/ i)","-for i in l2:","- b = True","- for j in l:","- if j % i == 0:","- pass","- else:","- b = False","- if b:","- l3.append(i)","-print((max(l3)))","+l = list(map(int, input().split()))","+ans = l[0]","+for i in range(1, n):","+ ans = gcd(ans, l[i])","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370260475,"measured_runtime_v1":0.0412888587,"runtime_lift":0.896756381,"key":["s260897563","s322028949"]} +{"user_id":"u759412327","problem_id":"p03611","language":"python","submission_id_v0":"s859810018","submission_id_v1":"s177125864","cpu_time_v0":88,"cpu_time_v1":80,"memory_v0":11188,"memory_v1":11480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.09,"input":"N = int(eval(input()))\n\nA = (10**5+2)*[0]\n\n\n\nfor a in map(int,input().split()):\n\n A[a-1]+=1\n\n A[a]+=1\n\n A[a+1]+=1\n\n\n\nprint((max(A)))","target":"N = int(eval(input()))\n\nA = 100002*[0]\n\n\n\nfor a in map(int,input().split()):\n\n A[a-1]+=1\n\n A[a]+=1\n\n A[a+1]+=1\n\n\n\nprint((max(A)))","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":127,"code_v1_num_chars":124,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = (10**5 + 2) * [0]\nfor a in map(int, input().split()):\n A[a - 1] += 1\n A[a] += 1\n A[a + 1] += 1\nprint((max(A)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = 100002 * [0]\nfor a in map(int, input().split()):\n A[a - 1] += 1\n A[a] += 1\n A[a + 1] += 1\nprint((max(A)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-A = (10**5 + 2) * [0]","+A = 100002 * [0]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0471559048,"measured_runtime_v1":0.0404098988,"runtime_lift":1.1669394432,"key":["s859810018","s177125864"]} +{"user_id":"u796942881","problem_id":"p03475","language":"python","submission_id_v0":"s938771401","submission_id_v1":"s478845184","cpu_time_v0":80,"cpu_time_v1":53,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.75,"input":"N = int(eval(input()))\n\n\n\nC = []\n\nS = []\n\nF = []\n\n\n\nfor i in range(N - 1):\n\n c, s, f = list(map(int, input().split()))\n\n C.append(c)\n\n S.append(s)\n\n F.append(f)\n\n\n\n\n\ndef next(s, t):\n\n # \u59cb\u767a\n\n if t < S[s]:\n\n t = S[s]\n\n\n\n # \u30bf\u30a4\u30e0\u30e9\u30b0\n\n elif t % F[s]:\n\n t += F[s] - t % F[s]\n\n\n\n # \u5217\u8eca\u306e\u79fb\u52d5\u6642\u9593\n\n t += C[s]\n\n\n\n return t\n\n\n\n\n\ndef main():\n\n # \u51fa\u767a\u99c5\n\n for i in range(N - 1):\n\n t = next(i, 0)\n\n\n\n # \u9014\u4e2d\u99c5\n\n for j in range(i + 1, N - 1):\n\n t = next(j, t)\n\n\n\n print(t)\n\n\n\n print((0))\n\n\n\n return\n\n\n\n\n\nmain()\n","target":"N = int(eval(input()))\n\n\n\nCSFn = [[int(j) for j in input().split()] for i in range(N - 1)]\n\n\n\n\n\ndef next(s):\n\n t = 0\n\n\n\n for Ci, Si, Fi in CSFn[s:]:\n\n # \u59cb\u767a\n\n if t < Si:\n\n t = Si\n\n\n\n # \u30bf\u30a4\u30e0\u30e9\u30b0\n\n elif t % Fi:\n\n t += Fi - t % Fi\n\n\n\n # \u5217\u8eca\u306e\u79fb\u52d5\u6642\u9593\n\n t += Ci\n\n\n\n return t\n\n\n\n\n\ndef main():\n\n # \u51fa\u767a\u99c5\n\n for i in range(N - 1):\n\n t = next(i)\n\n print(t)\n\n\n\n print((0))\n\n\n\n return\n\n\n\n\n\nmain()\n","code_v0_loc":45,"code_v1_loc":35,"code_v0_num_chars":567,"code_v1_num_chars":465,"code_v0_no_empty_lines":"N = int(eval(input()))\nC = []\nS = []\nF = []\nfor i in range(N - 1):\n c, s, f = list(map(int, input().split()))\n C.append(c)\n S.append(s)\n F.append(f)\n\n\ndef next(s, t):\n # \u59cb\u767a\n if t < S[s]:\n t = S[s]\n # \u30bf\u30a4\u30e0\u30e9\u30b0\n elif t % F[s]:\n t += F[s] - t % F[s]\n # \u5217\u8eca\u306e\u79fb\u52d5\u6642\u9593\n t += C[s]\n return t\n\n\ndef main():\n # \u51fa\u767a\u99c5\n for i in range(N - 1):\n t = next(i, 0)\n # \u9014\u4e2d\u99c5\n for j in range(i + 1, N - 1):\n t = next(j, t)\n print(t)\n print((0))\n return\n\n\nmain()\n","code_v1_no_empty_lines":"N = int(eval(input()))\nCSFn = [[int(j) for j in input().split()] for i in range(N - 1)]\n\n\ndef next(s):\n t = 0\n for Ci, Si, Fi in CSFn[s:]:\n # \u59cb\u767a\n if t < Si:\n t = Si\n # \u30bf\u30a4\u30e0\u30e9\u30b0\n elif t % Fi:\n t += Fi - t % Fi\n # \u5217\u8eca\u306e\u79fb\u52d5\u6642\u9593\n t += Ci\n return t\n\n\ndef main():\n # \u51fa\u767a\u99c5\n for i in range(N - 1):\n t = next(i)\n print(t)\n print((0))\n return\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-C = []","-S = []","-F = []","-for i in range(N - 1):","- c, s, f = list(map(int, input().split()))","- C.append(c)","- S.append(s)","- F.append(f)","+CSFn = [[int(j) for j in input().split()] for i in range(N - 1)]","-def next(s, t):","- # \u59cb\u767a","- if t < S[s]:","- t = S[s]","- # \u30bf\u30a4\u30e0\u30e9\u30b0","- elif t % F[s]:","- t += F[s] - t % F[s]","- # \u5217\u8eca\u306e\u79fb\u52d5\u6642\u9593","- t += C[s]","+def next(s):","+ t = 0","+ for Ci, Si, Fi in CSFn[s:]:","+ # \u59cb\u767a","+ if t < Si:","+ t = Si","+ # \u30bf\u30a4\u30e0\u30e9\u30b0","+ elif t % Fi:","+ t += Fi - t % Fi","+ # \u5217\u8eca\u306e\u79fb\u52d5\u6642\u9593","+ t += Ci","- t = next(i, 0)","- # \u9014\u4e2d\u99c5","- for j in range(i + 1, N - 1):","- t = next(j, t)","+ t = next(i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0534402571,"measured_runtime_v1":0.0360499134,"runtime_lift":1.482396267,"key":["s938771401","s478845184"]} +{"user_id":"u677523557","problem_id":"p02863","language":"python","submission_id_v0":"s330048868","submission_id_v1":"s890597070","cpu_time_v0":1112,"cpu_time_v1":686,"memory_v0":194696,"memory_v1":121052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.31,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN, T = list(map(int, input().split()))\n\nAB = [list(map(int, input().split())) for _ in range(N)]\n\n\n\ndp = [[0 for _ in range(N+1)] for _ in range(T+1)]\n\n# \u91cd\u3055w\u307e\u3067\u54c1\u7269n\u307e\u3067\u3067\u3067\u6700\u5927\u306b\u306a\u308b\u4fa1\u5024\n\n\n\nprev = [[0 for _ in range(N+1)] for _ in range(T+1)]\n\n\n\nfor n in range(N): # \u54c1\u7269n\u307e\u3067\u306e\u4e16\u754c\u3067\u6c7a\u3081\u3066\u3044\u304f\n\n a, b = AB[n]\n\n for w in range(T):\n\n if a > w: # \u30ab\u30d0\u30f3\u306b\u5165\u308a\u304d\u3089\u306a\u3044\u306a\u3089\u5165\u308c\u3089\u308c\u306a\u3044\n\n dp[w][n+1] = dp[w][n]\n\n prev[w][n+1] = w\n\n else: #\u30ab\u30d0\u30f3\u306b\u5165\u308c\u3089\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u306a\u3089\n\n if b+dp[w-a][n] >= dp[w][n]:\n\n dp[w][n+1] = dp[w-a][n] + b\n\n prev[w][n+1] = w - a\n\n else:\n\n dp[w][n+1] = dp[w][n]\n\n prev[w][n+1] = w\n\n\n\nans = dp[T-1][N]\n\nused = [False]*N\n\nc = T-1\n\nfor i in reversed(list(range(N))):\n\n if prev[c][i+1] == c - AB[i][0]:\n\n used[i] = True\n\n c = prev[c][i+1]\n\n\n\np = 0\n\nfor i in range(N):\n\n if not used[i] and AB[i][1] > p:\n\n p = AB[i][1]\n\n\n\nprint((ans+p))","target":"import sys\n\ninput = sys.stdin.readline\n\nfrom operator import itemgetter\n\n\n\nN, T = list(map(int, input().split()))\n\nAB = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nAB.sort(key=itemgetter(0))\n\n\n\ndp = [[0 for _ in range(N+1)] for _ in range(T+1)]\n\n# \u91cd\u3055w\u307e\u3067\u54c1\u7269n\u307e\u3067\u3067\u3067\u6700\u5927\u306b\u306a\u308b\u4fa1\u5024\n\nC = []\n\n\n\nfor n in range(N): # \u54c1\u7269n\u307e\u3067\u306e\u4e16\u754c\u3067\u6c7a\u3081\u3066\u3044\u304f\n\n a, b = AB[n]\n\n for w in range(T):\n\n if a > w: # \u30ab\u30d0\u30f3\u306b\u5165\u308a\u304d\u3089\u306a\u3044\u306a\u3089\u5165\u308c\u3089\u308c\u306a\u3044\n\n dp[w][n+1] = dp[w][n]\n\n else: #\u30ab\u30d0\u30f3\u306b\u5165\u308c\u3089\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u306a\u3089\n\n if b+dp[w-a][n] >= dp[w][n]:\n\n dp[w][n+1] = dp[w-a][n] + b\n\n else:\n\n dp[w][n+1] = dp[w][n]\n\n C.append(dp[T-1][n]+b)\n\n\n\nans = max(C)\n\nprint(ans)","code_v0_loc":39,"code_v1_loc":27,"code_v0_num_chars":968,"code_v1_num_chars":671,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, T = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(N)]\ndp = [[0 for _ in range(N + 1)] for _ in range(T + 1)]\n# \u91cd\u3055w\u307e\u3067\u54c1\u7269n\u307e\u3067\u3067\u3067\u6700\u5927\u306b\u306a\u308b\u4fa1\u5024\nprev = [[0 for _ in range(N + 1)] for _ in range(T + 1)]\nfor n in range(N): # \u54c1\u7269n\u307e\u3067\u306e\u4e16\u754c\u3067\u6c7a\u3081\u3066\u3044\u304f\n a, b = AB[n]\n for w in range(T):\n if a > w: # \u30ab\u30d0\u30f3\u306b\u5165\u308a\u304d\u3089\u306a\u3044\u306a\u3089\u5165\u308c\u3089\u308c\u306a\u3044\n dp[w][n + 1] = dp[w][n]\n prev[w][n + 1] = w\n else: # \u30ab\u30d0\u30f3\u306b\u5165\u308c\u3089\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u306a\u3089\n if b + dp[w - a][n] >= dp[w][n]:\n dp[w][n + 1] = dp[w - a][n] + b\n prev[w][n + 1] = w - a\n else:\n dp[w][n + 1] = dp[w][n]\n prev[w][n + 1] = w\nans = dp[T - 1][N]\nused = [False] * N\nc = T - 1\nfor i in reversed(list(range(N))):\n if prev[c][i + 1] == c - AB[i][0]:\n used[i] = True\n c = prev[c][i + 1]\np = 0\nfor i in range(N):\n if not used[i] and AB[i][1] > p:\n p = AB[i][1]\nprint((ans + p))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom operator import itemgetter\n\nN, T = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(N)]\nAB.sort(key=itemgetter(0))\ndp = [[0 for _ in range(N + 1)] for _ in range(T + 1)]\n# \u91cd\u3055w\u307e\u3067\u54c1\u7269n\u307e\u3067\u3067\u3067\u6700\u5927\u306b\u306a\u308b\u4fa1\u5024\nC = []\nfor n in range(N): # \u54c1\u7269n\u307e\u3067\u306e\u4e16\u754c\u3067\u6c7a\u3081\u3066\u3044\u304f\n a, b = AB[n]\n for w in range(T):\n if a > w: # \u30ab\u30d0\u30f3\u306b\u5165\u308a\u304d\u3089\u306a\u3044\u306a\u3089\u5165\u308c\u3089\u308c\u306a\u3044\n dp[w][n + 1] = dp[w][n]\n else: # \u30ab\u30d0\u30f3\u306b\u5165\u308c\u3089\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u306a\u3089\n if b + dp[w - a][n] >= dp[w][n]:\n dp[w][n + 1] = dp[w - a][n] + b\n else:\n dp[w][n + 1] = dp[w][n]\n C.append(dp[T - 1][n] + b)\nans = max(C)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.7692307692,"diff":["+from operator import itemgetter","+","+AB.sort(key=itemgetter(0))","-prev = [[0 for _ in range(N + 1)] for _ in range(T + 1)]","+C = []","- prev[w][n + 1] = w","- prev[w][n + 1] = w - a","- prev[w][n + 1] = w","-ans = dp[T - 1][N]","-used = [False] * N","-c = T - 1","-for i in reversed(list(range(N))):","- if prev[c][i + 1] == c - AB[i][0]:","- used[i] = True","- c = prev[c][i + 1]","-p = 0","-for i in range(N):","- if not used[i] and AB[i][1] > p:","- p = AB[i][1]","-print((ans + p))","+ C.append(dp[T - 1][n] + b)","+ans = max(C)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373475931,"measured_runtime_v1":0.0448886821,"runtime_lift":0.8320046678,"key":["s330048868","s890597070"]} +{"user_id":"u606045429","problem_id":"p03343","language":"python","submission_id_v0":"s567501964","submission_id_v1":"s378343133","cpu_time_v0":1538,"cpu_time_v1":864,"memory_v0":115164,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.82,"input":"n,k,q,*a=list(map(int,open(0).read().split()))\n\ns=sorted\n\nm=1e9\n\nfor b in a:\n\n i=[i for i,t in enumerate(a)if t=q:m=min(m,l[q-1]-b)\n\nprint(m)","target":"def main():\n\n N, K, Q, *A = list(map(int, open(0).read().split()))\n\n\n\n ans = float(\"inf\")\n\n for Y in set(A):\n\n C = []\n\n tmp = []\n\n for a in A:\n\n if a >= Y:\n\n tmp.append(a)\n\n else:\n\n if len(tmp) >= K:\n\n C += sorted(tmp)[:len(tmp) - K + 1]\n\n tmp = []\n\n if len(tmp) >= K:\n\n C += sorted(tmp)[:len(tmp) - K + 1]\n\n\n\n if len(C) >= Q:\n\n C.sort()\n\n X = C[Q - 1]\n\n ans = min(ans, X - Y)\n\n\n\n print(ans)\n\n\n\nmain()","code_v0_loc":8,"code_v1_loc":25,"code_v0_num_chars":229,"code_v1_num_chars":572,"code_v0_no_empty_lines":"n, k, q, *a = list(map(int, open(0).read().split()))\ns = sorted\nm = 1e9\nfor b in a:\n i = [i for i, t in enumerate(a) if t < b]\n l = s(sum([s(a[i + 1 : j])[::-1][k - 1 :] for i, j in zip([-1] + i, i + [n])], []))\n if len(l) >= q:\n m = min(m, l[q - 1] - b)\nprint(m)\n","code_v1_no_empty_lines":"def main():\n N, K, Q, *A = list(map(int, open(0).read().split()))\n ans = float(\"inf\")\n for Y in set(A):\n C = []\n tmp = []\n for a in A:\n if a >= Y:\n tmp.append(a)\n else:\n if len(tmp) >= K:\n C += sorted(tmp)[: len(tmp) - K + 1]\n tmp = []\n if len(tmp) >= K:\n C += sorted(tmp)[: len(tmp) - K + 1]\n if len(C) >= Q:\n C.sort()\n X = C[Q - 1]\n ans = min(ans, X - Y)\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":68.0,"diff":["-n, k, q, *a = list(map(int, open(0).read().split()))","-s = sorted","-m = 1e9","-for b in a:","- i = [i for i, t in enumerate(a) if t < b]","- l = s(sum([s(a[i + 1 : j])[::-1][k - 1 :] for i, j in zip([-1] + i, i + [n])], []))","- if len(l) >= q:","- m = min(m, l[q - 1] - b)","-print(m)","+def main():","+ N, K, Q, *A = list(map(int, open(0).read().split()))","+ ans = float(\"inf\")","+ for Y in set(A):","+ C = []","+ tmp = []","+ for a in A:","+ if a >= Y:","+ tmp.append(a)","+ else:","+ if len(tmp) >= K:","+ C += sorted(tmp)[: len(tmp) - K + 1]","+ tmp = []","+ if len(tmp) >= K:","+ C += sorted(tmp)[: len(tmp) - K + 1]","+ if len(C) >= Q:","+ C.sort()","+ X = C[Q - 1]","+ ans = min(ans, X - Y)","+ print(ans)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0368757896,"measured_runtime_v1":0.0364933269,"runtime_lift":1.010480347,"key":["s567501964","s378343133"]} +{"user_id":"u703180353","problem_id":"p03448","language":"python","submission_id_v0":"s959886337","submission_id_v1":"s500103665","cpu_time_v0":59,"cpu_time_v1":45,"memory_v0":9100,"memory_v1":9148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.73,"input":"A = int(eval(input()))\n\nB = int(eval(input()))\n\nC = int(eval(input()))\n\nX = int(eval(input()))\n\n\n\ncnt = 0\n\nfor a in range(A+1):\n\n for b in range(B+1):\n\n for c in range(C+1):\n\n if (a*500 + b*100 + c*50) == X:\n\n cnt+=1\n\nprint(cnt)","target":"A = int(eval(input()))\n\nB = int(eval(input()))\n\nC = int(eval(input()))\n\nX = int(eval(input()))\n\n\n\ncnt = 0\n\nfor a in range(min([A,-(-X\/\/500)])+1):\n\n _a = a*500\n\n for b in range(min([B,-(-X\/\/100)])+1):\n\n _b = b*100 + _a\n\n if _b > X: break\n\n for c in range(min([C,-(-X\/\/50)])+1):\n\n _c = c*50 + _b\n\n if _c > X: break\n\n if _c == X:\n\n cnt+=1\n\nprint(cnt)","code_v0_loc":12,"code_v1_loc":17,"code_v0_num_chars":240,"code_v1_num_chars":398,"code_v0_no_empty_lines":"A = int(eval(input()))\nB = int(eval(input()))\nC = int(eval(input()))\nX = int(eval(input()))\ncnt = 0\nfor a in range(A + 1):\n for b in range(B + 1):\n for c in range(C + 1):\n if (a * 500 + b * 100 + c * 50) == X:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"A = int(eval(input()))\nB = int(eval(input()))\nC = int(eval(input()))\nX = int(eval(input()))\ncnt = 0\nfor a in range(min([A, -(-X \/\/ 500)]) + 1):\n _a = a * 500\n for b in range(min([B, -(-X \/\/ 100)]) + 1):\n _b = b * 100 + _a\n if _b > X:\n break\n for c in range(min([C, -(-X \/\/ 50)]) + 1):\n _c = c * 50 + _b\n if _c > X:\n break\n if _c == X:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["-for a in range(A + 1):","- for b in range(B + 1):","- for c in range(C + 1):","- if (a * 500 + b * 100 + c * 50) == X:","+for a in range(min([A, -(-X \/\/ 500)]) + 1):","+ _a = a * 500","+ for b in range(min([B, -(-X \/\/ 100)]) + 1):","+ _b = b * 100 + _a","+ if _b > X:","+ break","+ for c in range(min([C, -(-X \/\/ 50)]) + 1):","+ _c = c * 50 + _b","+ if _c > X:","+ break","+ if _c == X:"],"diff_only_import_comment":false,"measured_runtime_v0":0.2307678363,"measured_runtime_v1":0.0391212354,"runtime_lift":5.8987870421,"key":["s959886337","s500103665"]} +{"user_id":"u669819350","problem_id":"p02888","language":"python","submission_id_v0":"s024548867","submission_id_v1":"s365170370","cpu_time_v0":762,"cpu_time_v1":269,"memory_v0":43484,"memory_v1":42460,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.7,"input":"from bisect import *\n\nif __name__ == '__main__':\n\n N = int(eval(input()))\n\n L = sorted(map(int, input().split()))\n\n print((sum(jdx - bisect(L, a - L[jdx], 0, jdx) for idx, a in enumerate(L) for jdx in range(idx))))","target":"if __name__ == '__main__':\n\n N = int(eval(input()))\n\n L = sorted(map(int, input().split()))\n\n ret = 0\n\n for adx in range(N):\n\n cdx = adx\n\n for bdx in range(adx + 1, N):\n\n while cdx < N and L[cdx] < L[bdx] + L[adx]: cdx += 1\n\n ret += cdx - (bdx + 1)\n\n print(ret)","code_v0_loc":5,"code_v1_loc":10,"code_v0_num_chars":215,"code_v1_num_chars":306,"code_v0_no_empty_lines":"from bisect import *\n\nif __name__ == \"__main__\":\n N = int(eval(input()))\n L = sorted(map(int, input().split()))\n print(\n (\n sum(\n jdx - bisect(L, a - L[jdx], 0, jdx)\n for idx, a in enumerate(L)\n for jdx in range(idx)\n )\n )\n )\n","code_v1_no_empty_lines":"if __name__ == \"__main__\":\n N = int(eval(input()))\n L = sorted(map(int, input().split()))\n ret = 0\n for adx in range(N):\n cdx = adx\n for bdx in range(adx + 1, N):\n while cdx < N and L[cdx] < L[bdx] + L[adx]:\n cdx += 1\n ret += cdx - (bdx + 1)\n print(ret)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-from bisect import *","-","- print(","- (","- sum(","- jdx - bisect(L, a - L[jdx], 0, jdx)","- for idx, a in enumerate(L)","- for jdx in range(idx)","- )","- )","- )","+ ret = 0","+ for adx in range(N):","+ cdx = adx","+ for bdx in range(adx + 1, N):","+ while cdx < N and L[cdx] < L[bdx] + L[adx]:","+ cdx += 1","+ ret += cdx - (bdx + 1)","+ print(ret)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443022125,"measured_runtime_v1":0.0367203863,"runtime_lift":1.2064745764,"key":["s024548867","s365170370"]} +{"user_id":"u310381103","problem_id":"p03854","language":"python","submission_id_v0":"s788306993","submission_id_v1":"s428314292","cpu_time_v0":169,"cpu_time_v1":39,"memory_v0":39920,"memory_v1":10124,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.92,"input":"S=eval(input())\n\nS = S.replace('eraser', '')\n\nS = S.replace('erase', '')\n\nS = S.replace('dreamer', '')\n\nS = S.replace('dream', '')\n\nS=len(S)\n\nif S==0:\n\n print('YES')\n\nelse:\n\n print('NO')","target":"import re\n\ns=eval(input())\n\ns=re.sub('eraser','',s)\n\ns=re.sub('erase','',s)\n\ns=re.sub('dreamer','',s)\n\ns=re.sub('dream','',s)\n\nif s=='':\n\n print('YES')\n\nelse:\n\n print('NO')","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":186,"code_v1_num_chars":172,"code_v0_no_empty_lines":"S = eval(input())\nS = S.replace(\"eraser\", \"\")\nS = S.replace(\"erase\", \"\")\nS = S.replace(\"dreamer\", \"\")\nS = S.replace(\"dream\", \"\")\nS = len(S)\nif S == 0:\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_v1_no_empty_lines":"import re\n\ns = eval(input())\ns = re.sub(\"eraser\", \"\", s)\ns = re.sub(\"erase\", \"\", s)\ns = re.sub(\"dreamer\", \"\", s)\ns = re.sub(\"dream\", \"\", s)\nif s == \"\":\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S = eval(input())","-S = S.replace(\"eraser\", \"\")","-S = S.replace(\"erase\", \"\")","-S = S.replace(\"dreamer\", \"\")","-S = S.replace(\"dream\", \"\")","-S = len(S)","-if S == 0:","+import re","+","+s = eval(input())","+s = re.sub(\"eraser\", \"\", s)","+s = re.sub(\"erase\", \"\", s)","+s = re.sub(\"dreamer\", \"\", s)","+s = re.sub(\"dream\", \"\", s)","+if s == \"\":"],"diff_only_import_comment":false,"measured_runtime_v0":0.1558246148,"measured_runtime_v1":0.0482986677,"runtime_lift":3.2262714946,"key":["s788306993","s428314292"]} +{"user_id":"u729133443","problem_id":"p02829","language":"python","submission_id_v0":"s547719920","submission_id_v1":"s605447473","cpu_time_v0":166,"cpu_time_v1":30,"memory_v0":38256,"memory_v1":9116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.93,"input":"a,b=list(map(int,open(0)));print((a^b))","target":"print((6-sum(map(int,open(0)))))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":31,"code_v1_num_chars":30,"code_v0_no_empty_lines":"a, b = list(map(int, open(0)))\nprint((a ^ b))\n","code_v1_no_empty_lines":"print((6 - sum(map(int, open(0)))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a, b = list(map(int, open(0)))","-print((a ^ b))","+print((6 - sum(map(int, open(0)))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0743105213,"measured_runtime_v1":0.0352110068,"runtime_lift":2.1104344356,"key":["s547719920","s605447473"]} +{"user_id":"u482157295","problem_id":"p02975","language":"python","submission_id_v0":"s493386053","submission_id_v1":"s952867359","cpu_time_v0":61,"cpu_time_v1":54,"memory_v0":20628,"memory_v1":21000,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.48,"input":"from collections import Counter\n\nn = int(eval(input()))\n\na = list(map(int,input().split()))\n\na_counter = Counter(a)\n\na_counter_li = list(a_counter)\n\nif sum(a) == 0:\n\n print(\"Yes\")\n\nelif len(a)%3 != 0:\n\n print(\"No\")\n\nelif len(a_counter) > 3 or len(a_counter) <= 1:\n\n print(\"No\")\n\nelif len(a_counter) == 3:\n\n if a_counter[a_counter_li[0]] == n \/\/ 3 and a_counter[a_counter_li[1]] == n \/\/ 3 and a_counter[a_counter_li[2]] == n \/\/ 3:\n\n if a_counter_li[0]^a_counter_li[1]^a_counter_li[2] == 0:\n\n print(\"Yes\")\n\n else:\n\n print('No')\n\n else:\n\n print(\"No\")\n\nelse:\n\n a_counter_li.sort()\n\n if a_counter_li[0] == 0 and a_counter[a_counter_li[0]] == n \/\/ 3:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")","target":"from collections import Counter\n\nn = int(eval(input()))\n\na = list(map(int,input().split()))\n\na_counter = Counter(a)\n\nk = list(a_counter.keys())\n\nv = list(a_counter.values())\n\n\n\nif len(a_counter) == 3 and k[0]^k[1]^k[2] == 0 and v[0] == v[1] == v[2]:\n\n print(\"Yes\")\n\nelif len(a_counter) == 2 and 0 in k and (v[0] == v[1]*2 or v[1] == v[0]*2):\n\n print(\"Yes\")\n\nelif len(a_counter) == 1 and 0 in k:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":25,"code_v1_loc":15,"code_v0_num_chars":756,"code_v1_num_chars":436,"code_v0_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\na = list(map(int, input().split()))\na_counter = Counter(a)\na_counter_li = list(a_counter)\nif sum(a) == 0:\n print(\"Yes\")\nelif len(a) % 3 != 0:\n print(\"No\")\nelif len(a_counter) > 3 or len(a_counter) <= 1:\n print(\"No\")\nelif len(a_counter) == 3:\n if (\n a_counter[a_counter_li[0]] == n \/\/ 3\n and a_counter[a_counter_li[1]] == n \/\/ 3\n and a_counter[a_counter_li[2]] == n \/\/ 3\n ):\n if a_counter_li[0] ^ a_counter_li[1] ^ a_counter_li[2] == 0:\n print(\"Yes\")\n else:\n print(\"No\")\n else:\n print(\"No\")\nelse:\n a_counter_li.sort()\n if a_counter_li[0] == 0 and a_counter[a_counter_li[0]] == n \/\/ 3:\n print(\"Yes\")\n else:\n print(\"No\")\n","code_v1_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\na = list(map(int, input().split()))\na_counter = Counter(a)\nk = list(a_counter.keys())\nv = list(a_counter.values())\nif len(a_counter) == 3 and k[0] ^ k[1] ^ k[2] == 0 and v[0] == v[1] == v[2]:\n print(\"Yes\")\nelif len(a_counter) == 2 and 0 in k and (v[0] == v[1] * 2 or v[1] == v[0] * 2):\n print(\"Yes\")\nelif len(a_counter) == 1 and 0 in k:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-a_counter_li = list(a_counter)","-if sum(a) == 0:","+k = list(a_counter.keys())","+v = list(a_counter.values())","+if len(a_counter) == 3 and k[0] ^ k[1] ^ k[2] == 0 and v[0] == v[1] == v[2]:","-elif len(a) % 3 != 0:","+elif len(a_counter) == 2 and 0 in k and (v[0] == v[1] * 2 or v[1] == v[0] * 2):","+ print(\"Yes\")","+elif len(a_counter) == 1 and 0 in k:","+ print(\"Yes\")","+else:","-elif len(a_counter) > 3 or len(a_counter) <= 1:","- print(\"No\")","-elif len(a_counter) == 3:","- if (","- a_counter[a_counter_li[0]] == n \/\/ 3","- and a_counter[a_counter_li[1]] == n \/\/ 3","- and a_counter[a_counter_li[2]] == n \/\/ 3","- ):","- if a_counter_li[0] ^ a_counter_li[1] ^ a_counter_li[2] == 0:","- print(\"Yes\")","- else:","- print(\"No\")","- else:","- print(\"No\")","-else:","- a_counter_li.sort()","- if a_counter_li[0] == 0 and a_counter[a_counter_li[0]] == n \/\/ 3:","- print(\"Yes\")","- else:","- print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369231132,"measured_runtime_v1":0.0356507418,"runtime_lift":1.0356898986,"key":["s493386053","s952867359"]} +{"user_id":"u242031676","problem_id":"p02993","language":"python","submission_id_v0":"s656995188","submission_id_v1":"s093050770","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"s=eval(input())\n\nif(s[0]==s[1])or(s[1]==s[2])or(s[2]==s[3]):\n\n print(\"Bad\")\n\nelse: print(\"Good\")","target":"def main():\n\n s=eval(input())\n\n if(s[0]==s[1])or(s[1]==s[2])or(s[2]==s[3]):\n\n print(\"Bad\")\n\n else: print(\"Good\")\n\nif __name__==\"__main__\": main()","code_v0_loc":4,"code_v1_loc":6,"code_v0_num_chars":91,"code_v1_num_chars":145,"code_v0_no_empty_lines":"s = eval(input())\nif (s[0] == s[1]) or (s[1] == s[2]) or (s[2] == s[3]):\n print(\"Bad\")\nelse:\n print(\"Good\")\n","code_v1_no_empty_lines":"def main():\n s = eval(input())\n if (s[0] == s[1]) or (s[1] == s[2]) or (s[2] == s[3]):\n print(\"Bad\")\n else:\n print(\"Good\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-s = eval(input())","-if (s[0] == s[1]) or (s[1] == s[2]) or (s[2] == s[3]):","- print(\"Bad\")","-else:","- print(\"Good\")","+def main():","+ s = eval(input())","+ if (s[0] == s[1]) or (s[1] == s[2]) or (s[2] == s[3]):","+ print(\"Bad\")","+ else:","+ print(\"Good\")","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0514566739,"measured_runtime_v1":0.051653048,"runtime_lift":0.9961982072,"key":["s656995188","s093050770"]} +{"user_id":"u554781254","problem_id":"p02723","language":"python","submission_id_v0":"s231479777","submission_id_v1":"s769143494","cpu_time_v0":189,"cpu_time_v1":165,"memory_v0":38384,"memory_v1":38256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.7,"input":"s = eval(input())\n\nif s[2] == s[3] and s[4] == s[5]:\n\n print('Yes')\n\nelse:\n\n print('No')","target":"def main():\n\n s = eval(input())\n\n\n\n if s[2] == s[3] and s[4] == s[5]:\n\n print('Yes')\n\n else:\n\n print('No')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":5,"code_v1_loc":11,"code_v0_num_chars":88,"code_v1_num_chars":167,"code_v0_no_empty_lines":"s = eval(input())\nif s[2] == s[3] and s[4] == s[5]:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"def main():\n s = eval(input())\n if s[2] == s[3] and s[4] == s[5]:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":54.5454545455,"diff":["-s = eval(input())","-if s[2] == s[3] and s[4] == s[5]:","- print(\"Yes\")","-else:","- print(\"No\")","+def main():","+ s = eval(input())","+ if s[2] == s[3] and s[4] == s[5]:","+ print(\"Yes\")","+ else:","+ print(\"No\")","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372818246,"measured_runtime_v1":0.0394763494,"runtime_lift":0.9444091257,"key":["s231479777","s769143494"]} +{"user_id":"u208133431","problem_id":"p03281","language":"python","submission_id_v0":"s681179981","submission_id_v1":"s336937317","cpu_time_v0":73,"cpu_time_v1":66,"memory_v0":63120,"memory_v1":63672,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.59,"input":"N = int(eval(input()))\n\ncount = 0\n\nif N<105:\n\n print((0))\n\nelse:\n\n for i in range(105,N+1):\n\n yaku = 0\n\n if i%2 == 1:\n\n for j in range(1,i+1):\n\n if i%j == 0:\n\n yaku += 1\n\n if yaku == 8:\n\n count += 1\n\n print(count)","target":"N = int(eval(input()))\n\ncount = 0\n\nfor i in range(1,N+1):\n\n yaku = 0\n\n if i%2 == 1:\n\n for j in range(1,i+1):\n\n if i%j == 0:\n\n yaku += 1\n\n if yaku == 8:\n\n count += 1\n\nprint(count)","code_v0_loc":14,"code_v1_loc":11,"code_v0_num_chars":299,"code_v1_num_chars":229,"code_v0_no_empty_lines":"N = int(eval(input()))\ncount = 0\nif N < 105:\n print((0))\nelse:\n for i in range(105, N + 1):\n yaku = 0\n if i % 2 == 1:\n for j in range(1, i + 1):\n if i % j == 0:\n yaku += 1\n if yaku == 8:\n count += 1\n print(count)\n","code_v1_no_empty_lines":"N = int(eval(input()))\ncount = 0\nfor i in range(1, N + 1):\n yaku = 0\n if i % 2 == 1:\n for j in range(1, i + 1):\n if i % j == 0:\n yaku += 1\n if yaku == 8:\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-if N < 105:","- print((0))","-else:","- for i in range(105, N + 1):","- yaku = 0","- if i % 2 == 1:","- for j in range(1, i + 1):","- if i % j == 0:","- yaku += 1","- if yaku == 8:","- count += 1","- print(count)","+for i in range(1, N + 1):","+ yaku = 0","+ if i % 2 == 1:","+ for j in range(1, i + 1):","+ if i % j == 0:","+ yaku += 1","+ if yaku == 8:","+ count += 1","+print(count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1096919334,"measured_runtime_v1":0.1755405198,"runtime_lift":0.6248809877,"key":["s681179981","s336937317"]} +{"user_id":"u350248178","problem_id":"p03045","language":"python","submission_id_v0":"s532172036","submission_id_v1":"s861034570","cpu_time_v0":782,"cpu_time_v1":715,"memory_v0":21880,"memory_v1":21948,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.57,"input":"n,m=list(map(int,input().split()))\n\n\n\n#Union-Find\n\npar=[-1 for i in range(n)]\n\n\n\ndef root(a):\n\n if par[a]<0:\n\n return a\n\n else:\n\n return root(par[a])\n\n\n\ndef size(a):\n\n return -par[root(a)]\n\n\n\ndef connect(a,b):\n\n a=root(a)\n\n b=root(b)\n\n if a==b:\n\n return False\n\n if size(a)r: break\n\n if x and i+xa:break\n\n if SIEVES[(n-e)\/2]!=0:\n\n x+=1\n\n return x\n\n\n\nSIEVES=sieve(50000)\n\nPRIMES=[_f for _f in SIEVES if _f]\n\nfor n in sys.stdin:\n\n n=int(n)\n\n if n==0: break\n\n print(f0056(n))","target":"import sys\n\ndef sieve(m):\n\n N=list(range(1,m+2,2))\n\n r=int(m**.5)\n\n h=len(N)\n\n N[0]=0\n\n for i in range(h):\n\n x=N[i]\n\n if x>r: break\n\n if x and i+xa: break\n\n if S[(n-e)\/2]:\n\n x+=1\n\n return x\n\n\n\nS=sieve(50000)\n\nPRIMES=[_f for _f in S if _f]\n\nfor n in sys.stdin:\n\n n=int(n)\n\n if n==0: break\n\n print(f0056(n))","code_v0_loc":32,"code_v1_loc":32,"code_v0_num_chars":631,"code_v1_num_chars":601,"code_v0_no_empty_lines":"import sys\n\n\ndef sieve(m):\n N = list(range(1, m + 2, 2))\n r = int(m**0.5)\n h = len(N)\n N[0] = 0\n for i in range(h):\n x = N[i]\n if x > r:\n break\n if x and i + x < h:\n N[i + x : h : x] = [0] * ((h - 1 - i - x) \/ x + 1)\n return N\n\n\ndef f0056(n):\n x = 0\n if n < 4:\n x = 0\n elif n == 4:\n x = 1\n elif n % 2 == 1:\n if SIEVES[(n - 2) \/ 2] != 0:\n x = 1\n else:\n a = n \/ 2\n for e in PRIMES:\n if e > a:\n break\n if SIEVES[(n - e) \/ 2] != 0:\n x += 1\n return x\n\n\nSIEVES = sieve(50000)\nPRIMES = [_f for _f in SIEVES if _f]\nfor n in sys.stdin:\n n = int(n)\n if n == 0:\n break\n print(f0056(n))\n","code_v1_no_empty_lines":"import sys\n\n\ndef sieve(m):\n N = list(range(1, m + 2, 2))\n r = int(m**0.5)\n h = len(N)\n N[0] = 0\n for i in range(h):\n x = N[i]\n if x > r:\n break\n if x and i + x < h:\n N[i + x : h : x] = [0] * ((h - 1 - i - x) \/ x + 1)\n return N\n\n\ndef f0056(n):\n x = 0\n if n < 4:\n x = 0\n elif n == 4:\n x = 1\n elif n % 2 == 1:\n if S[(n - 2) \/ 2]:\n x = 1\n else:\n a = n \/ 2\n for e in PRIMES:\n if e > a:\n break\n if S[(n - e) \/ 2]:\n x += 1\n return x\n\n\nS = sieve(50000)\nPRIMES = [_f for _f in S if _f]\nfor n in sys.stdin:\n n = int(n)\n if n == 0:\n break\n print(f0056(n))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if SIEVES[(n - 2) \/ 2] != 0:","+ if S[(n - 2) \/ 2]:","- if SIEVES[(n - e) \/ 2] != 0:","+ if S[(n - e) \/ 2]:","-SIEVES = sieve(50000)","-PRIMES = [_f for _f in SIEVES if _f]","+S = sieve(50000)","+PRIMES = [_f for _f in S if _f]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0461125507,"measured_runtime_v1":0.0452670076,"runtime_lift":1.0186790155,"key":["s630669711","s047359089"]} +{"user_id":"u537892680","problem_id":"p02720","language":"python","submission_id_v0":"s037537786","submission_id_v1":"s786562243","cpu_time_v0":123,"cpu_time_v1":84,"memory_v0":7004,"memory_v1":7160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.71,"input":"# D - Lunlun Number\n\n\n\nK = int(eval(input()))\n\nstack = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\ni = 0\n\nwhile len(stack) < K:\n\n first = int(str(stack[i])[-1:])\n\n if first == 0:\n\n stack.append(int(str(stack[i]) + str(first)))\n\n stack.append(int(str(stack[i]) + str(first + 1)))\n\n elif first == 9:\n\n stack.append(int(str(stack[i]) + str(first - 1)))\n\n stack.append(int(str(stack[i]) + str(first)))\n\n else:\n\n stack.append(int(str(stack[i]) + str(first - 1)))\n\n stack.append(int(str(stack[i]) + str(first)))\n\n stack.append(int(str(stack[i]) + str(first + 1))) \n\n i += 1\n\n\n\nprint((stack[K - 1]))","target":"# D - Lunlun Number\n\n\n\nK = int(eval(input()))\n\n\n\nN = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\ni = 0\n\n\n\nwhile len(N) < K:\n\n n = int(str(N[i]) + str(N[i])[-1:])\n\n if str(n)[-1:] == '0':\n\n N += [n, n + 1]\n\n elif str(n)[-1:] == '9':\n\n N += [n - 1, n]\n\n else:\n\n N += [n - 1, n, n + 1]\n\n i += 1\n\n\n\nprint((N[K - 1]))","code_v0_loc":20,"code_v1_loc":18,"code_v0_num_chars":640,"code_v1_num_chars":325,"code_v0_no_empty_lines":"# D - Lunlun Number\nK = int(eval(input()))\nstack = [1, 2, 3, 4, 5, 6, 7, 8, 9]\ni = 0\nwhile len(stack) < K:\n first = int(str(stack[i])[-1:])\n if first == 0:\n stack.append(int(str(stack[i]) + str(first)))\n stack.append(int(str(stack[i]) + str(first + 1)))\n elif first == 9:\n stack.append(int(str(stack[i]) + str(first - 1)))\n stack.append(int(str(stack[i]) + str(first)))\n else:\n stack.append(int(str(stack[i]) + str(first - 1)))\n stack.append(int(str(stack[i]) + str(first)))\n stack.append(int(str(stack[i]) + str(first + 1)))\n i += 1\nprint((stack[K - 1]))\n","code_v1_no_empty_lines":"# D - Lunlun Number\nK = int(eval(input()))\nN = [1, 2, 3, 4, 5, 6, 7, 8, 9]\ni = 0\nwhile len(N) < K:\n n = int(str(N[i]) + str(N[i])[-1:])\n if str(n)[-1:] == \"0\":\n N += [n, n + 1]\n elif str(n)[-1:] == \"9\":\n N += [n - 1, n]\n else:\n N += [n - 1, n, n + 1]\n i += 1\nprint((N[K - 1]))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-stack = [1, 2, 3, 4, 5, 6, 7, 8, 9]","+N = [1, 2, 3, 4, 5, 6, 7, 8, 9]","-while len(stack) < K:","- first = int(str(stack[i])[-1:])","- if first == 0:","- stack.append(int(str(stack[i]) + str(first)))","- stack.append(int(str(stack[i]) + str(first + 1)))","- elif first == 9:","- stack.append(int(str(stack[i]) + str(first - 1)))","- stack.append(int(str(stack[i]) + str(first)))","+while len(N) < K:","+ n = int(str(N[i]) + str(N[i])[-1:])","+ if str(n)[-1:] == \"0\":","+ N += [n, n + 1]","+ elif str(n)[-1:] == \"9\":","+ N += [n - 1, n]","- stack.append(int(str(stack[i]) + str(first - 1)))","- stack.append(int(str(stack[i]) + str(first)))","- stack.append(int(str(stack[i]) + str(first + 1)))","+ N += [n - 1, n, n + 1]","-print((stack[K - 1]))","+print((N[K - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0523970563,"measured_runtime_v1":0.0992255609,"runtime_lift":0.528060067,"key":["s037537786","s786562243"]} +{"user_id":"u813098295","problem_id":"p03108","language":"python","submission_id_v0":"s787547687","submission_id_v1":"s492203839","cpu_time_v0":984,"cpu_time_v1":871,"memory_v0":36380,"memory_v1":36360,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.48,"input":"class uf_tree:\n\n def __init__(self, n):\n\n self._size = n\n\n self.sizes = [1] * n\n\n self.par = list(range(n))\n\n\n\n def find(self, x):\n\n if x == self.par[x]:\n\n return x\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n\n\n def unite(self, x, y):\n\n self._size -= 1\n\n x, y = self.find(x), self.find(y)\n\n if x == y:\n\n return\n\n if self.sizes[x] < self.sizes[y]:\n\n x, y = y, x\n\n self.par[y] = x\n\n self.sizes[x] += self.sizes[y]\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def size(self, x):\n\n return self.sizes[self.find(x)]\n\n\n\n\n\ndef com(x):\n\n return x*(x-1)\/\/2\n\n\n\nn, m = map(int, input().split())\n\nAB = [ list(map(int, input().split())) for _ in range(m) ]\n\n\n\nans = []\n\nbenri = 0\n\n\n\nuf = uf_tree(n+1)\n\n\n\nbenri = 0\n\n\n\nfor a, b in AB[::-1]:\n\n ans += [ com(n) - benri ] \n\n if uf.same(a, b):\n\n continue\n\n\n\n a_benri = com(uf.size(a) )\n\n b_benri = com(uf.size(b) )\n\n\n\n uf.unite(a, b)\n\n sum_benri = com( uf.size(a) )\n\n benri += sum_benri - a_benri - b_benri\n\n\n\nprint (*ans[::-1], sep=\"\\n\")\n\n\n","target":"import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\nclass uf_tree:\n\n def __init__(self, n):\n\n self._size = n\n\n self.sizes = [1] * n\n\n self.par = list(range(n))\n\n\n\n def find(self, x):\n\n if x == self.par[x]:\n\n return x\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n\n\n def unite(self, x, y):\n\n self._size -= 1\n\n x, y = self.find(x), self.find(y)\n\n if x == y:\n\n return\n\n if self.sizes[x] < self.sizes[y]:\n\n x, y = y, x\n\n self.par[y] = x\n\n self.sizes[x] += self.sizes[y]\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def size(self, x):\n\n return self.sizes[self.find(x)]\n\n\n\n\n\ndef com(x):\n\n return x*(x-1)\/\/2\n\n\n\nn, m = map(int, input().split())\n\nAB = [ list(map(int, input().split())) for _ in range(m) ]\n\n\n\nans = []\n\nbenri = 0\n\n\n\nuf = uf_tree(n+1)\n\n\n\nfor a, b in AB[::-1]:\n\n ans += [ com(n) - benri ] \n\n if uf.same(a, b):\n\n continue\n\n\n\n a_benri = com(uf.size(a) )\n\n b_benri = com(uf.size(b) )\n\n\n\n uf.unite(a, b)\n\n sum_benri = com( uf.size(a) )\n\n benri += sum_benri - a_benri - b_benri\n\n\n\nprint (*ans[::-1], sep=\"\\n\")\n\n\n","code_v0_loc":56,"code_v1_loc":58,"code_v0_num_chars":1191,"code_v1_num_chars":1222,"code_v0_no_empty_lines":"class uf_tree:\n def __init__(self, n):\n self._size = n\n self.sizes = [1] * n\n self.par = list(range(n))\n\n def find(self, x):\n if x == self.par[x]:\n return x\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def unite(self, x, y):\n self._size -= 1\n x, y = self.find(x), self.find(y)\n if x == y:\n return\n if self.sizes[x] < self.sizes[y]:\n x, y = y, x\n self.par[y] = x\n self.sizes[x] += self.sizes[y]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def size(self, x):\n return self.sizes[self.find(x)]\n\n\ndef com(x):\n return x * (x - 1) \/\/ 2\n\n\nn, m = map(int, input().split())\nAB = [list(map(int, input().split())) for _ in range(m)]\nans = []\nbenri = 0\nuf = uf_tree(n + 1)\nbenri = 0\nfor a, b in AB[::-1]:\n ans += [com(n) - benri]\n if uf.same(a, b):\n continue\n a_benri = com(uf.size(a))\n b_benri = com(uf.size(b))\n uf.unite(a, b)\n sum_benri = com(uf.size(a))\n benri += sum_benri - a_benri - b_benri\nprint(*ans[::-1], sep=\"\\n\")\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\nclass uf_tree:\n def __init__(self, n):\n self._size = n\n self.sizes = [1] * n\n self.par = list(range(n))\n\n def find(self, x):\n if x == self.par[x]:\n return x\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def unite(self, x, y):\n self._size -= 1\n x, y = self.find(x), self.find(y)\n if x == y:\n return\n if self.sizes[x] < self.sizes[y]:\n x, y = y, x\n self.par[y] = x\n self.sizes[x] += self.sizes[y]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def size(self, x):\n return self.sizes[self.find(x)]\n\n\ndef com(x):\n return x * (x - 1) \/\/ 2\n\n\nn, m = map(int, input().split())\nAB = [list(map(int, input().split())) for _ in range(m)]\nans = []\nbenri = 0\nuf = uf_tree(n + 1)\nfor a, b in AB[::-1]:\n ans += [com(n) - benri]\n if uf.same(a, b):\n continue\n a_benri = com(uf.size(a))\n b_benri = com(uf.size(b))\n uf.unite(a, b)\n sum_benri = com(uf.size(a))\n benri += sum_benri - a_benri - b_benri\nprint(*ans[::-1], sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":3.4482758621,"diff":["+import sys","+","+input = sys.stdin.readline","+","+","-benri = 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.034715821,"measured_runtime_v1":0.0358812728,"runtime_lift":0.9675192187,"key":["s787547687","s492203839"]} +{"user_id":"u488127128","problem_id":"p03556","language":"python","submission_id_v0":"s214930945","submission_id_v1":"s047451512","cpu_time_v0":29,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.38,"input":"X = int(eval(input()))\n\na = 1\n\nwhile X >= a**2:\n\n a += 1\n\nprint((int((a-1)**2)))","target":"X = int(eval(input()))\n\nprint((int((X**.5))**2))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":75,"code_v1_num_chars":40,"code_v0_no_empty_lines":"X = int(eval(input()))\na = 1\nwhile X >= a**2:\n a += 1\nprint((int((a - 1) ** 2)))\n","code_v1_no_empty_lines":"X = int(eval(input()))\nprint((int((X**0.5)) ** 2))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-a = 1","-while X >= a**2:","- a += 1","-print((int((a - 1) ** 2)))","+print((int((X**0.5)) ** 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1695826485,"measured_runtime_v1":0.0446664135,"runtime_lift":3.7966479736,"key":["s214930945","s047451512"]} +{"user_id":"u680851063","problem_id":"p02630","language":"python","submission_id_v0":"s530999376","submission_id_v1":"s806356138","cpu_time_v0":633,"cpu_time_v1":476,"memory_v0":24960,"memory_v1":21072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.8,"input":"n = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nq = int(eval(input()))\n\ntotal = sum(A)\n\n\n\nl = [[i, 0] for i in range(10**5+1)]\n\nfor _ in range(n):\n\n l[A[_]][1] += 1\n\n\n\nfor i in range(q):\n\n b, c = list(map(int,input().split()))\n\n total -= (l[b][0] * l[b][1])\n\n total += (l[c][0] * l[b][1])\n\n print(total)\n\n l[c][1] += l[b][1]\n\n l[b][1] = 0","target":"n = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nq = int(eval(input()))\n\ntotal = sum(A)\n\n\n\nl = [0 for i in range(10**5+1)]\n\nfor _ in range(n):\n\n l[A[_]] += 1\n\n\n\nfor i in range(q):\n\n b, c = list(map(int,input().split()))\n\n total += (c * l[b])\n\n total -= (b * l[b])\n\n print(total)\n\n l[c] += l[b]\n\n l[b] = 0\n","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":353,"code_v1_num_chars":319,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nq = int(eval(input()))\ntotal = sum(A)\nl = [[i, 0] for i in range(10**5 + 1)]\nfor _ in range(n):\n l[A[_]][1] += 1\nfor i in range(q):\n b, c = list(map(int, input().split()))\n total -= l[b][0] * l[b][1]\n total += l[c][0] * l[b][1]\n print(total)\n l[c][1] += l[b][1]\n l[b][1] = 0\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nq = int(eval(input()))\ntotal = sum(A)\nl = [0 for i in range(10**5 + 1)]\nfor _ in range(n):\n l[A[_]] += 1\nfor i in range(q):\n b, c = list(map(int, input().split()))\n total += c * l[b]\n total -= b * l[b]\n print(total)\n l[c] += l[b]\n l[b] = 0\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-l = [[i, 0] for i in range(10**5 + 1)]","+l = [0 for i in range(10**5 + 1)]","- l[A[_]][1] += 1","+ l[A[_]] += 1","- total -= l[b][0] * l[b][1]","- total += l[c][0] * l[b][1]","+ total += c * l[b]","+ total -= b * l[b]","- l[c][1] += l[b][1]","- l[b][1] = 0","+ l[c] += l[b]","+ l[b] = 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.1449831471,"measured_runtime_v1":0.0412816851,"runtime_lift":3.5120452741,"key":["s530999376","s806356138"]} +{"user_id":"u254871849","problem_id":"p03862","language":"python","submission_id_v0":"s152248652","submission_id_v1":"s893044099","cpu_time_v0":82,"cpu_time_v1":54,"memory_v0":14540,"memory_v1":14092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.15,"input":"n, x = [int(i) for i in input().split()]\n\na = [int(i) for i in input().split()]\n\n\n\ncount = 0\n\nprevious = 0\n\n\n\nfor i in a:\n\n if i + previous > x: \n\n excess = i + previous - x\n\n count += excess\n\n previous = x - previous\n\n else: # if not exceeding x.\n\n previous = i\n\n\n\nprint(count)\n\n\n","target":"import sys\n\n\n\nn, x, *a = list(map(int, sys.stdin.read().split()))\n\n\n\ndef main():\n\n cnt = 0\n\n lim = x\n\n for c in a:\n\n if c > lim:\n\n cnt += c - lim\n\n lim = x - lim\n\n else:\n\n lim = x - c\n\n \n\n return cnt\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":16,"code_v1_loc":19,"code_v0_num_chars":315,"code_v1_num_chars":327,"code_v0_no_empty_lines":"n, x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\ncount = 0\nprevious = 0\nfor i in a:\n if i + previous > x:\n excess = i + previous - x\n count += excess\n previous = x - previous\n else: # if not exceeding x.\n previous = i\nprint(count)\n","code_v1_no_empty_lines":"import sys\n\nn, x, *a = list(map(int, sys.stdin.read().split()))\n\n\ndef main():\n cnt = 0\n lim = x\n for c in a:\n if c > lim:\n cnt += c - lim\n lim = x - lim\n else:\n lim = x - c\n return cnt\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-n, x = [int(i) for i in input().split()]","-a = [int(i) for i in input().split()]","-count = 0","-previous = 0","-for i in a:","- if i + previous > x:","- excess = i + previous - x","- count += excess","- previous = x - previous","- else: # if not exceeding x.","- previous = i","-print(count)","+import sys","+","+n, x, *a = list(map(int, sys.stdin.read().split()))","+","+","+def main():","+ cnt = 0","+ lim = x","+ for c in a:","+ if c > lim:","+ cnt += c - lim","+ lim = x - lim","+ else:","+ lim = x - c","+ return cnt","+","+","+if __name__ == \"__main__\":","+ ans = main()","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0953832176,"measured_runtime_v1":0.0487359064,"runtime_lift":1.9571446326,"key":["s152248652","s893044099"]} +{"user_id":"u419877586","problem_id":"p02948","language":"python","submission_id_v0":"s411956462","submission_id_v1":"s458434435","cpu_time_v0":1200,"cpu_time_v1":915,"memory_v0":87768,"memory_v1":77912,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.75,"input":"import heapq\n\nfrom collections import deque\n\n\n\nN, M=list(map(int, input().split()))\n\nAB=[list(map(int, input().split())) for _ in range(N)]\n\nAB.sort(key=lambda x:(x[0], x[1]))\n\nfor i in range(N):\n\n AB[i][1]=-AB[i][1]\n\nd=deque(AB)\n\nans=0\n\nh=[]\n\nfor i in range(M+1):\n\n if not d and not h:\n\n break\n\n while d and d[0][0]<=i:\n\n heapq.heappush(h, d.popleft()[1])\n\n if h:\n\n ans-=heapq.heappop(h)\n\nprint(ans)","target":"import heapq\n\nfrom collections import deque\n\n\n\nN, M=list(map(int,input().split()))\n\nAB=[list(map(int,input().split())) for _ in range(N)]\n\nAB.sort(key=lambda x:x[0])\n\nd=deque(AB)\n\nh=[]\n\nans=0\n\nfor i in range(M+1):\n\n while d and d[0][0]<=i:\n\n heapq.heappush(h, -d.popleft()[1])\n\n if h:\n\n ans-=heapq.heappop(h)\n\nprint(ans)","code_v0_loc":19,"code_v1_loc":15,"code_v0_num_chars":407,"code_v1_num_chars":334,"code_v0_no_empty_lines":"import heapq\nfrom collections import deque\n\nN, M = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(N)]\nAB.sort(key=lambda x: (x[0], x[1]))\nfor i in range(N):\n AB[i][1] = -AB[i][1]\nd = deque(AB)\nans = 0\nh = []\nfor i in range(M + 1):\n if not d and not h:\n break\n while d and d[0][0] <= i:\n heapq.heappush(h, d.popleft()[1])\n if h:\n ans -= heapq.heappop(h)\nprint(ans)\n","code_v1_no_empty_lines":"import heapq\nfrom collections import deque\n\nN, M = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(N)]\nAB.sort(key=lambda x: x[0])\nd = deque(AB)\nh = []\nans = 0\nfor i in range(M + 1):\n while d and d[0][0] <= i:\n heapq.heappush(h, -d.popleft()[1])\n if h:\n ans -= heapq.heappop(h)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.0526315789,"diff":["-AB.sort(key=lambda x: (x[0], x[1]))","-for i in range(N):","- AB[i][1] = -AB[i][1]","+AB.sort(key=lambda x: x[0])","+h = []","-h = []","- if not d and not h:","- break","- heapq.heappush(h, d.popleft()[1])","+ heapq.heappush(h, -d.popleft()[1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0383608854,"measured_runtime_v1":0.0705394218,"runtime_lift":0.5438219424,"key":["s411956462","s458434435"]} +{"user_id":"u761989513","problem_id":"p03111","language":"python","submission_id_v0":"s374543735","submission_id_v1":"s249441685","cpu_time_v0":105,"cpu_time_v1":62,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.95,"input":"def dfs(i, A, B, C):\n\n global ans\n\n if i == n:\n\n if A and B and C:\n\n ans = min(ans, abs(a - sum(A)) + abs(b - sum(B)) + abs(c - sum(C)) + (len(A) + len(B) + len(C) - 3) * 10)\n\n else:\n\n dfs(i + 1, A, B, C)\n\n dfs(i + 1, A + [L[i]], B, C)\n\n dfs(i + 1, A, B + [L[i]], C)\n\n dfs(i + 1, A, B, C + [L[i]])\n\n\n\nn, a, b, c = list(map(int, input().split()))\n\nL = [int(eval(input())) for i in range(n)]\n\nans = float(\"inf\")\n\ndfs(0, [], [], [])\n\nprint(ans)","target":"def dfs(i, a, b, c, plus):\n\n global ans\n\n\n\n if i == n:\n\n if a and b and c:\n\n mp = abs(a - A) + abs(b - B) + abs(c - C) + (plus - 3) * 10\n\n ans = min(ans, mp)\n\n\n\n else:\n\n dfs(i + 1, a, b, c, plus)\n\n dfs(i + 1, a + l[i], b, c, plus + 1)\n\n dfs(i + 1, a, b + l[i], c, plus + 1)\n\n dfs(i + 1, a, b, c + l[i], plus + 1)\n\n\n\n\n\nn, A, B, C = list(map(int, input().split()))\n\nl = [int(eval(input())) for i in range(n)]\n\n\n\nans = float(\"inf\")\n\n\n\ndfs(0, 0, 0, 0, 0)\n\n\n\nprint(ans)","code_v0_loc":16,"code_v1_loc":23,"code_v0_num_chars":484,"code_v1_num_chars":518,"code_v0_no_empty_lines":"def dfs(i, A, B, C):\n global ans\n if i == n:\n if A and B and C:\n ans = min(\n ans,\n abs(a - sum(A))\n + abs(b - sum(B))\n + abs(c - sum(C))\n + (len(A) + len(B) + len(C) - 3) * 10,\n )\n else:\n dfs(i + 1, A, B, C)\n dfs(i + 1, A + [L[i]], B, C)\n dfs(i + 1, A, B + [L[i]], C)\n dfs(i + 1, A, B, C + [L[i]])\n\n\nn, a, b, c = list(map(int, input().split()))\nL = [int(eval(input())) for i in range(n)]\nans = float(\"inf\")\ndfs(0, [], [], [])\nprint(ans)\n","code_v1_no_empty_lines":"def dfs(i, a, b, c, plus):\n global ans\n if i == n:\n if a and b and c:\n mp = abs(a - A) + abs(b - B) + abs(c - C) + (plus - 3) * 10\n ans = min(ans, mp)\n else:\n dfs(i + 1, a, b, c, plus)\n dfs(i + 1, a + l[i], b, c, plus + 1)\n dfs(i + 1, a, b + l[i], c, plus + 1)\n dfs(i + 1, a, b, c + l[i], plus + 1)\n\n\nn, A, B, C = list(map(int, input().split()))\nl = [int(eval(input())) for i in range(n)]\nans = float(\"inf\")\ndfs(0, 0, 0, 0, 0)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.4347826087,"diff":["-def dfs(i, A, B, C):","+def dfs(i, a, b, c, plus):","- if A and B and C:","- ans = min(","- ans,","- abs(a - sum(A))","- + abs(b - sum(B))","- + abs(c - sum(C))","- + (len(A) + len(B) + len(C) - 3) * 10,","- )","+ if a and b and c:","+ mp = abs(a - A) + abs(b - B) + abs(c - C) + (plus - 3) * 10","+ ans = min(ans, mp)","- dfs(i + 1, A, B, C)","- dfs(i + 1, A + [L[i]], B, C)","- dfs(i + 1, A, B + [L[i]], C)","- dfs(i + 1, A, B, C + [L[i]])","+ dfs(i + 1, a, b, c, plus)","+ dfs(i + 1, a + l[i], b, c, plus + 1)","+ dfs(i + 1, a, b + l[i], c, plus + 1)","+ dfs(i + 1, a, b, c + l[i], plus + 1)","-n, a, b, c = list(map(int, input().split()))","-L = [int(eval(input())) for i in range(n)]","+n, A, B, C = list(map(int, input().split()))","+l = [int(eval(input())) for i in range(n)]","-dfs(0, [], [], [])","+dfs(0, 0, 0, 0, 0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0847650168,"measured_runtime_v1":0.0730863559,"runtime_lift":1.1597926276,"key":["s374543735","s249441685"]} +{"user_id":"u130900604","problem_id":"p02947","language":"python","submission_id_v0":"s459358092","submission_id_v1":"s302339233","cpu_time_v0":362,"cpu_time_v1":247,"memory_v0":19788,"memory_v1":26760,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.77,"input":"n=int(eval(input()))\n\ns=[]\n\nfor i in range(n):\n\n s.append(\"\".join(sorted(eval(input()))))\n\n#sss=set(s)\n\nans=0\n\nimport collections\n\nc=collections.Counter(s)\n\n\n\nfor l in list(c.values()):\n\n ans+=l*(l-1)*(1\/2)\n\nprint((int(ans)))\n","target":"from collections import defaultdict\n\nd=defaultdict(int)\n\nn,*s=open(0).read().split()\n\nfor i in s:d[\"\".join(sorted(list(i)))]+=1\n\nprint((sum(v*(v-1)\/\/2 for v in list(d.values()))))","code_v0_loc":12,"code_v1_loc":5,"code_v0_num_chars":208,"code_v1_num_chars":171,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = []\nfor i in range(n):\n s.append(\"\".join(sorted(eval(input()))))\n# sss=set(s)\nans = 0\nimport collections\n\nc = collections.Counter(s)\nfor l in list(c.values()):\n ans += l * (l - 1) * (1 \/ 2)\nprint((int(ans)))\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nd = defaultdict(int)\nn, *s = open(0).read().split()\nfor i in s:\n d[\"\".join(sorted(list(i)))] += 1\nprint((sum(v * (v - 1) \/\/ 2 for v in list(d.values()))))\n","code_same":false,"relative_loc_diff_percent":58.3333333333,"diff":["-n = int(eval(input()))","-s = []","-for i in range(n):","- s.append(\"\".join(sorted(eval(input()))))","-# sss=set(s)","-ans = 0","-import collections","+from collections import defaultdict","-c = collections.Counter(s)","-for l in list(c.values()):","- ans += l * (l - 1) * (1 \/ 2)","-print((int(ans)))","+d = defaultdict(int)","+n, *s = open(0).read().split()","+for i in s:","+ d[\"\".join(sorted(list(i)))] += 1","+print((sum(v * (v - 1) \/\/ 2 for v in list(d.values()))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0343067698,"measured_runtime_v1":0.0351687491,"runtime_lift":0.9754901929,"key":["s459358092","s302339233"]} +{"user_id":"u309716323","problem_id":"p03160","language":"python","submission_id_v0":"s058254741","submission_id_v1":"s769515592","cpu_time_v0":106,"cpu_time_v1":96,"memory_v0":13924,"memory_v1":13976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.43,"input":"\n\n\n\ndef read_int():\n\n return int(input().strip())\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, input().strip().split(' ')))\n\n\n\n\n\ndef solve():\n\n # dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2])\n\n N = read_int()\n\n h = read_ints()\n\n dp = [0, abs(h[1]-h[0])]\n\n for i in range(2, N):\n\n dp.append(min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2]))\n\n return dp[-1]\n\n\n\n\n\nif __name__ == '__main__':\n\n print((solve()))\n","target":"\n\n\n\ndef read_int():\n\n return int(input().strip())\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, input().strip().split(' ')))\n\n\n\n\n\ndef solve():\n\n # dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2])\n\n N = read_int()\n\n h = read_ints()\n\n a, b = 0, abs(h[1]-h[0])\n\n for i in range(2, N):\n\n b, a = min(abs(h[i]-h[i-1])+b, abs(h[i]-h[i-2])+a), b\n\n return b\n\n\n\n\n\nif __name__ == '__main__':\n\n print((solve()))\n","code_v0_loc":22,"code_v1_loc":22,"code_v0_num_chars":464,"code_v1_num_chars":446,"code_v0_no_empty_lines":"def read_int():\n return int(input().strip())\n\n\ndef read_ints():\n return list(map(int, input().strip().split(\" \")))\n\n\ndef solve():\n # dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2])\n N = read_int()\n h = read_ints()\n dp = [0, abs(h[1] - h[0])]\n for i in range(2, N):\n dp.append(\n min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2])\n )\n return dp[-1]\n\n\nif __name__ == \"__main__\":\n print((solve()))\n","code_v1_no_empty_lines":"def read_int():\n return int(input().strip())\n\n\ndef read_ints():\n return list(map(int, input().strip().split(\" \")))\n\n\ndef solve():\n # dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2])\n N = read_int()\n h = read_ints()\n a, b = 0, abs(h[1] - h[0])\n for i in range(2, N):\n b, a = min(abs(h[i] - h[i - 1]) + b, abs(h[i] - h[i - 2]) + a), b\n return b\n\n\nif __name__ == \"__main__\":\n print((solve()))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dp = [0, abs(h[1] - h[0])]","+ a, b = 0, abs(h[1] - h[0])","- dp.append(","- min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2])","- )","- return dp[-1]","+ b, a = min(abs(h[i] - h[i - 1]) + b, abs(h[i] - h[i - 2]) + a), b","+ return b"],"diff_only_import_comment":false,"measured_runtime_v0":0.0479466441,"measured_runtime_v1":0.0361429901,"runtime_lift":1.3265821092,"key":["s058254741","s769515592"]} +{"user_id":"u790012205","problem_id":"p03861","language":"python","submission_id_v0":"s330299656","submission_id_v1":"s860981159","cpu_time_v0":173,"cpu_time_v1":18,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.6,"input":"import math\n\na, b, x = list(map(int, input().split()))\n\nprint((b \/\/ x - (a - 1) \/\/ x))\n","target":"a, b, x = list(map(int, input().split()))\n\nprint((b \/\/ x - (a - 1) \/\/ x))","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":79,"code_v1_num_chars":65,"code_v0_no_empty_lines":"import math\n\na, b, x = list(map(int, input().split()))\nprint((b \/\/ x - (a - 1) \/\/ x))\n","code_v1_no_empty_lines":"a, b, x = list(map(int, input().split()))\nprint((b \/\/ x - (a - 1) \/\/ x))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-import math","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.0410436723,"measured_runtime_v1":0.0388628893,"runtime_lift":1.0561147939,"key":["s330299656","s860981159"]} +{"user_id":"u097121858","problem_id":"p03352","language":"python","submission_id_v0":"s143089990","submission_id_v1":"s877241755","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"def is_perfect_power(n):\n\n if n == 1:\n\n return True\n\n div = 2\n\n divs = []\n\n while n != 1:\n\n if n % div == 0:\n\n n \/\/= div\n\n divs.append(div)\n\n else:\n\n div += 1\n\n divs_d = {d: 0 for d in set(divs)}\n\n for d in divs:\n\n divs_d[d] += 1\n\n divs_s = {n for n in list(divs_d.values())}\n\n if min(divs_s) > 1:\n\n for d in divs_s:\n\n if d % min(divs_s) != 0:\n\n return False\n\n else:\n\n return False\n\n return True\n\n\n\n\n\nX = int(eval(input()))\n\nfor x in range(X, 0, -1):\n\n if is_perfect_power(x):\n\n print(x)\n\n break\n","target":"def is_perfect_power(n):\n\n return n in {\n\n 1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144,\n\n 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512,\n\n 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000\n\n }\n\n\n\n\n\nX = int(eval(input()))\n\nfor x in range(X, 0, -1):\n\n if is_perfect_power(x):\n\n print(x)\n\n break\n","code_v0_loc":29,"code_v1_loc":13,"code_v0_num_chars":632,"code_v1_num_chars":378,"code_v0_no_empty_lines":"def is_perfect_power(n):\n if n == 1:\n return True\n div = 2\n divs = []\n while n != 1:\n if n % div == 0:\n n \/\/= div\n divs.append(div)\n else:\n div += 1\n divs_d = {d: 0 for d in set(divs)}\n for d in divs:\n divs_d[d] += 1\n divs_s = {n for n in list(divs_d.values())}\n if min(divs_s) > 1:\n for d in divs_s:\n if d % min(divs_s) != 0:\n return False\n else:\n return False\n return True\n\n\nX = int(eval(input()))\nfor x in range(X, 0, -1):\n if is_perfect_power(x):\n print(x)\n break\n","code_v1_no_empty_lines":"def is_perfect_power(n):\n return n in {\n 1,\n 4,\n 8,\n 9,\n 16,\n 25,\n 27,\n 32,\n 36,\n 49,\n 64,\n 81,\n 100,\n 121,\n 125,\n 128,\n 144,\n 169,\n 196,\n 216,\n 225,\n 243,\n 256,\n 289,\n 324,\n 343,\n 361,\n 400,\n 441,\n 484,\n 512,\n 529,\n 576,\n 625,\n 676,\n 729,\n 784,\n 841,\n 900,\n 961,\n 1000,\n }\n\n\nX = int(eval(input()))\nfor x in range(X, 0, -1):\n if is_perfect_power(x):\n print(x)\n break\n","code_same":false,"relative_loc_diff_percent":55.1724137931,"diff":["- if n == 1:","- return True","- div = 2","- divs = []","- while n != 1:","- if n % div == 0:","- n \/\/= div","- divs.append(div)","- else:","- div += 1","- divs_d = {d: 0 for d in set(divs)}","- for d in divs:","- divs_d[d] += 1","- divs_s = {n for n in list(divs_d.values())}","- if min(divs_s) > 1:","- for d in divs_s:","- if d % min(divs_s) != 0:","- return False","- else:","- return False","- return True","+ return n in {","+ 1,","+ 4,","+ 8,","+ 9,","+ 16,","+ 25,","+ 27,","+ 32,","+ 36,","+ 49,","+ 64,","+ 81,","+ 100,","+ 121,","+ 125,","+ 128,","+ 144,","+ 169,","+ 196,","+ 216,","+ 225,","+ 243,","+ 256,","+ 289,","+ 324,","+ 343,","+ 361,","+ 400,","+ 441,","+ 484,","+ 512,","+ 529,","+ 576,","+ 625,","+ 676,","+ 729,","+ 784,","+ 841,","+ 900,","+ 961,","+ 1000,","+ }"],"diff_only_import_comment":false,"measured_runtime_v0":0.0464681697,"measured_runtime_v1":0.1367854936,"runtime_lift":0.3397156267,"key":["s143089990","s877241755"]} +{"user_id":"u076917070","problem_id":"p03503","language":"python","submission_id_v0":"s168554813","submission_id_v1":"s483032239","cpu_time_v0":226,"cpu_time_v1":64,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":71.68,"input":"import sys\n\ninput=sys.stdin.readline\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n F = []\n\n for _ in range(N):\n\n F.append(list(map(int, input().split())))\n\n P = []\n\n for _ in range(N):\n\n P.append(list(map(int, input().split())))\n\n\n\n ans = -10**7*N\n\n for i in range(1, 1<<10):\n\n tmp = 0\n\n for s,f in enumerate(F):\n\n c = 0\n\n for j in range(10):\n\n if (i>>j)&1&f[j]:\n\n c += 1\n\n tmp += P[s][c]\n\n ans = max(ans, tmp)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\ninput=sys.stdin.readline\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n F = [int(input().replace(\" \", \"\"), 2) for _ in range(N)]\n\n P = [list(map(int, input().split())) for _ in range(N)]\n\n\n\n ans = -10**7*N\n\n for i in range(1, 1<<10):\n\n tmp = 0\n\n for j,f in enumerate(F):\n\n c = bin(i&f).count(\"1\")\n\n tmp += P[j][c]\n\n ans = max(ans, tmp)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":26,"code_v1_loc":19,"code_v0_num_chars":582,"code_v1_num_chars":453,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(eval(input()))\n F = []\n for _ in range(N):\n F.append(list(map(int, input().split())))\n P = []\n for _ in range(N):\n P.append(list(map(int, input().split())))\n ans = -(10**7) * N\n for i in range(1, 1 << 10):\n tmp = 0\n for s, f in enumerate(F):\n c = 0\n for j in range(10):\n if (i >> j) & 1 & f[j]:\n c += 1\n tmp += P[s][c]\n ans = max(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(eval(input()))\n F = [int(input().replace(\" \", \"\"), 2) for _ in range(N)]\n P = [list(map(int, input().split())) for _ in range(N)]\n ans = -(10**7) * N\n for i in range(1, 1 << 10):\n tmp = 0\n for j, f in enumerate(F):\n c = bin(i & f).count(\"1\")\n tmp += P[j][c]\n ans = max(ans, tmp)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":26.9230769231,"diff":["- F = []","- for _ in range(N):","- F.append(list(map(int, input().split())))","- P = []","- for _ in range(N):","- P.append(list(map(int, input().split())))","+ F = [int(input().replace(\" \", \"\"), 2) for _ in range(N)]","+ P = [list(map(int, input().split())) for _ in range(N)]","- for s, f in enumerate(F):","- c = 0","- for j in range(10):","- if (i >> j) & 1 & f[j]:","- c += 1","- tmp += P[s][c]","+ for j, f in enumerate(F):","+ c = bin(i & f).count(\"1\")","+ tmp += P[j][c]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0899669759,"measured_runtime_v1":0.0385352252,"runtime_lift":2.3346684896,"key":["s168554813","s483032239"]} +{"user_id":"u888337853","problem_id":"p02685","language":"python","submission_id_v0":"s944290755","submission_id_v1":"s192574808","cpu_time_v0":1124,"cpu_time_v1":659,"memory_v0":42972,"memory_v1":26328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.37,"input":"import sys\n\n\n\n# import re\n\nimport math\n\nimport collections\n\n# import decimal\n\nimport bisect\n\nimport itertools\n\nimport fractions\n\n# import functools\n\nimport copy\n\nimport heapq\n\nimport decimal\n\n# import statistics\n\nimport queue\n\nimport numpy as np\n\n\n\nsys.setrecursionlimit(10000001)\n\nINF = 10 ** 16\n\n# MOD = 10 ** 9 + 7\n\nMOD = 998244353\n\n\n\nni = lambda: int(sys.stdin.readline())\n\nns = lambda: list(map(int, sys.stdin.readline().split()))\n\nna = lambda: list(map(int, sys.stdin.readline().split()))\n\n\n\n\n\n# ===CODE===\n\n\n\n\n\ndef main():\n\n def fast_pow(num, kata, mod):\n\n if kata == 0:\n\n return 1\n\n\n\n res = 1\n\n while kata > 0:\n\n if kata & 1 == 1:\n\n res = res * num % mod\n\n num = num * num % mod\n\n\n\n kata >>= 1\n\n return res\n\n\n\n def prepare(n, MOD):\n\n f = 1\n\n factorials = [1]\n\n for m in range(1, n + 1):\n\n f *= m\n\n f %= MOD\n\n factorials.append(f)\n\n inv = pow(f, MOD - 2, MOD)\n\n invs = [1] * (n + 1)\n\n invs[n] = inv\n\n for m in range(n, 1, -1):\n\n inv *= m\n\n inv %= MOD\n\n invs[m - 1] = inv\n\n return factorials, invs\n\n\n\n n, m, k = ns()\n\n\n\n p, i = prepare(n, MOD)\n\n\n\n result = 0\n\n\n\n for ki in range(k + 1):\n\n ans = 1\n\n ans *= m % MOD\n\n ans *= fast_pow(m - 1, n - 1 - ki, MOD)\n\n ans %= MOD\n\n ans *= p[n - 1] * i[ki] * i[n - 1 - ki]\n\n ans %= MOD\n\n\n\n result += ans\n\n result %= MOD\n\n\n\n print(result)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\n\n\n# import re\n\nimport math\n\nimport collections\n\n# import decimal\n\nimport bisect\n\nimport itertools\n\nimport fractions\n\n# import functools\n\nimport copy\n\nimport heapq\n\nimport decimal\n\n# import statistics\n\nimport queue\n\n# import numpy as np\n\n\n\n# sys.setrecursionlimit(10000001)\n\nINF = 10 ** 16\n\n# MOD = 10 ** 9 + 7\n\nMOD = 998244353\n\n\n\n\n\ndef ni(): return int(sys.stdin.readline())\n\ndef ns(): return list(map(int, sys.stdin.readline().split()))\n\ndef na(): return list(map(int, sys.stdin.readline().split()))\n\n\n\n\n\n# ===CODE===\n\n\n\nclass ModCombination:\n\n # https:\/\/atcoder.jp\/contests\/abc167\/submissions\/13058694\n\n # https:\/\/ikatakos.com\/pot\/programming_algorithm\/number_theory\/mod_combination\n\n\n\n def __init__(self, maxN, MOD):\n\n self._maxN = maxN\n\n self._MOD = MOD\n\n self.facts = [1]\n\n self.invs = [1]*(self._maxN+1)\n\n\n\n fact = 1\n\n for i in range(1, self._maxN+1):\n\n fact *= i\n\n fact %= self._MOD\n\n self.facts.append(fact)\n\n\n\n inv = pow(fact, self._MOD-2, self._MOD)\n\n self.invs[self._maxN] = inv\n\n for i in range(self._maxN, 1, -1):\n\n inv *= i\n\n inv %= self._MOD\n\n self.invs[i-1] = inv\n\n\n\n def nCr(self, n, r):\n\n return self.facts[n]*self.invs[r]*self.invs[n-r] % self._MOD\n\n\n\n\n\ndef main():\n\n\n\n n, m, k = ns()\n\n\n\n mc = ModCombination(n, MOD)\n\n\n\n result = 0\n\n\n\n for ki in range(k + 1):\n\n ans = 1\n\n ans *= m % MOD\n\n ans *= pow(m - 1, n - 1 - ki, MOD)\n\n ans %= MOD\n\n ans *= mc.nCr(n-1, ki)\n\n ans %= MOD\n\n result += ans\n\n result %= MOD\n\n\n\n print(result)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":82,"code_v1_loc":80,"code_v0_num_chars":1606,"code_v1_num_chars":1713,"code_v0_no_empty_lines":"import sys\n\n# import re\nimport math\nimport collections\n\n# import decimal\nimport bisect\nimport itertools\nimport fractions\n\n# import functools\nimport copy\nimport heapq\nimport decimal\n\n# import statistics\nimport queue\nimport numpy as np\n\nsys.setrecursionlimit(10000001)\nINF = 10**16\n# MOD = 10 ** 9 + 7\nMOD = 998244353\nni = lambda: int(sys.stdin.readline())\nns = lambda: list(map(int, sys.stdin.readline().split()))\nna = lambda: list(map(int, sys.stdin.readline().split()))\n# ===CODE===\ndef main():\n def fast_pow(num, kata, mod):\n if kata == 0:\n return 1\n res = 1\n while kata > 0:\n if kata & 1 == 1:\n res = res * num % mod\n num = num * num % mod\n kata >>= 1\n return res\n\n def prepare(n, MOD):\n f = 1\n factorials = [1]\n for m in range(1, n + 1):\n f *= m\n f %= MOD\n factorials.append(f)\n inv = pow(f, MOD - 2, MOD)\n invs = [1] * (n + 1)\n invs[n] = inv\n for m in range(n, 1, -1):\n inv *= m\n inv %= MOD\n invs[m - 1] = inv\n return factorials, invs\n\n n, m, k = ns()\n p, i = prepare(n, MOD)\n result = 0\n for ki in range(k + 1):\n ans = 1\n ans *= m % MOD\n ans *= fast_pow(m - 1, n - 1 - ki, MOD)\n ans %= MOD\n ans *= p[n - 1] * i[ki] * i[n - 1 - ki]\n ans %= MOD\n result += ans\n result %= MOD\n print(result)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n# import re\nimport math\nimport collections\n\n# import decimal\nimport bisect\nimport itertools\nimport fractions\n\n# import functools\nimport copy\nimport heapq\nimport decimal\n\n# import statistics\nimport queue\n\n# import numpy as np\n# sys.setrecursionlimit(10000001)\nINF = 10**16\n# MOD = 10 ** 9 + 7\nMOD = 998244353\n\n\ndef ni():\n return int(sys.stdin.readline())\n\n\ndef ns():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef na():\n return list(map(int, sys.stdin.readline().split()))\n\n\n# ===CODE===\nclass ModCombination:\n # https:\/\/atcoder.jp\/contests\/abc167\/submissions\/13058694\n # https:\/\/ikatakos.com\/pot\/programming_algorithm\/number_theory\/mod_combination\n def __init__(self, maxN, MOD):\n self._maxN = maxN\n self._MOD = MOD\n self.facts = [1]\n self.invs = [1] * (self._maxN + 1)\n fact = 1\n for i in range(1, self._maxN + 1):\n fact *= i\n fact %= self._MOD\n self.facts.append(fact)\n inv = pow(fact, self._MOD - 2, self._MOD)\n self.invs[self._maxN] = inv\n for i in range(self._maxN, 1, -1):\n inv *= i\n inv %= self._MOD\n self.invs[i - 1] = inv\n\n def nCr(self, n, r):\n return self.facts[n] * self.invs[r] * self.invs[n - r] % self._MOD\n\n\ndef main():\n n, m, k = ns()\n mc = ModCombination(n, MOD)\n result = 0\n for ki in range(k + 1):\n ans = 1\n ans *= m % MOD\n ans *= pow(m - 1, n - 1 - ki, MOD)\n ans %= MOD\n ans *= mc.nCr(n - 1, ki)\n ans %= MOD\n result += ans\n result %= MOD\n print(result)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.4390243902,"diff":["-import numpy as np","-sys.setrecursionlimit(10000001)","+# import numpy as np","+# sys.setrecursionlimit(10000001)","-ni = lambda: int(sys.stdin.readline())","-ns = lambda: list(map(int, sys.stdin.readline().split()))","-na = lambda: list(map(int, sys.stdin.readline().split()))","+","+","+def ni():","+ return int(sys.stdin.readline())","+","+","+def ns():","+ return list(map(int, sys.stdin.readline().split()))","+","+","+def na():","+ return list(map(int, sys.stdin.readline().split()))","+","+","+class ModCombination:","+ # https:\/\/atcoder.jp\/contests\/abc167\/submissions\/13058694","+ # https:\/\/ikatakos.com\/pot\/programming_algorithm\/number_theory\/mod_combination","+ def __init__(self, maxN, MOD):","+ self._maxN = maxN","+ self._MOD = MOD","+ self.facts = [1]","+ self.invs = [1] * (self._maxN + 1)","+ fact = 1","+ for i in range(1, self._maxN + 1):","+ fact *= i","+ fact %= self._MOD","+ self.facts.append(fact)","+ inv = pow(fact, self._MOD - 2, self._MOD)","+ self.invs[self._maxN] = inv","+ for i in range(self._maxN, 1, -1):","+ inv *= i","+ inv %= self._MOD","+ self.invs[i - 1] = inv","+","+ def nCr(self, n, r):","+ return self.facts[n] * self.invs[r] * self.invs[n - r] % self._MOD","+","+","- def fast_pow(num, kata, mod):","- if kata == 0:","- return 1","- res = 1","- while kata > 0:","- if kata & 1 == 1:","- res = res * num % mod","- num = num * num % mod","- kata >>= 1","- return res","-","- def prepare(n, MOD):","- f = 1","- factorials = [1]","- for m in range(1, n + 1):","- f *= m","- f %= MOD","- factorials.append(f)","- inv = pow(f, MOD - 2, MOD)","- invs = [1] * (n + 1)","- invs[n] = inv","- for m in range(n, 1, -1):","- inv *= m","- inv %= MOD","- invs[m - 1] = inv","- return factorials, invs","-","- p, i = prepare(n, MOD)","+ mc = ModCombination(n, MOD)","- ans *= fast_pow(m - 1, n - 1 - ki, MOD)","+ ans *= pow(m - 1, n - 1 - ki, MOD)","- ans *= p[n - 1] * i[ki] * i[n - 1 - ki]","+ ans *= mc.nCr(n - 1, ki)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1120512016,"measured_runtime_v1":0.104196965,"runtime_lift":1.0753787463,"key":["s944290755","s192574808"]} +{"user_id":"u968166680","problem_id":"p03488","language":"python","submission_id_v0":"s144977977","submission_id_v1":"s912168356","cpu_time_v0":1031,"cpu_time_v1":843,"memory_v0":93808,"memory_v1":94272,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.23,"input":"import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n\n\ndef check(vec, init_pos, target_pos):\n\n base = 8000\n\n dp = [False] * 16001\n\n dp[init_pos + base] = True\n\n\n\n for i in range(len(vec)):\n\n dp, dp_prev = [False] * 16001, dp\n\n for j in range(16001):\n\n if (\n\n j - vec[i] >= 0\n\n and dp_prev[j - vec[i]]\n\n or j + vec[i] <= 16000\n\n and dp_prev[j + vec[i]]\n\n ):\n\n dp[j] = True\n\n\n\n return dp[target_pos + base]\n\n\n\n\n\ndef main():\n\n S = readline().strip()\n\n x, y = list(map(int, readline().split()))\n\n\n\n idx = len(S)\n\n for i, c in enumerate(S):\n\n if c == 'T':\n\n idx = i\n\n break\n\n\n\n init_x = idx\n\n step = [[0] for _ in range(2)]\n\n i = 0\n\n for c in S[idx:]:\n\n if c == 'T':\n\n i = 1 - i\n\n step[i].append(0)\n\n else:\n\n step[i][-1] += 1\n\n\n\n ok = check(step[0], init_x, x) and check(step[1], 0, y)\n\n\n\n if ok:\n\n print('Yes')\n\n else:\n\n print('No')\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\nMOD = 1000000007\n\n\n\n\n\ndef check(vec, init_pos, target_pos):\n\n base = 8000\n\n dp = [False] * 16001\n\n dp[init_pos + base] = True\n\n\n\n for i in range(len(vec)):\n\n dp, dp_prev = [False] * 16001, dp\n\n for j in range(16001):\n\n if (\n\n j - vec[i] >= 0\n\n and dp_prev[j - vec[i]]\n\n or j + vec[i] <= 16000\n\n and dp_prev[j + vec[i]]\n\n ):\n\n dp[j] = True\n\n\n\n return dp[target_pos + base]\n\n\n\n\n\ndef main():\n\n S = readline().strip()\n\n x, y = list(map(int, readline().split()))\n\n\n\n idx = len(S)\n\n for i, c in enumerate(S):\n\n if c == 'T':\n\n idx = i\n\n break\n\n\n\n init_x = idx\n\n step = [[] for _ in range(2)]\n\n i = 0\n\n for c in S[idx:]:\n\n if c == 'T':\n\n i = 1 - i\n\n step[i].append(0)\n\n else:\n\n step[i][-1] += 1\n\n \n\n for row in step:\n\n row = [v for v in row if v != 0]\n\n if not row:\n\n row = [0]\n\n\n\n ok = check(step[0], init_x, x) and check(step[1], 0, y)\n\n\n\n if ok:\n\n print('Yes')\n\n else:\n\n print('No')\n\n\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":61,"code_v1_loc":66,"code_v0_num_chars":1245,"code_v1_num_chars":1366,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef check(vec, init_pos, target_pos):\n base = 8000\n dp = [False] * 16001\n dp[init_pos + base] = True\n for i in range(len(vec)):\n dp, dp_prev = [False] * 16001, dp\n for j in range(16001):\n if (\n j - vec[i] >= 0\n and dp_prev[j - vec[i]]\n or j + vec[i] <= 16000\n and dp_prev[j + vec[i]]\n ):\n dp[j] = True\n return dp[target_pos + base]\n\n\ndef main():\n S = readline().strip()\n x, y = list(map(int, readline().split()))\n idx = len(S)\n for i, c in enumerate(S):\n if c == \"T\":\n idx = i\n break\n init_x = idx\n step = [[0] for _ in range(2)]\n i = 0\n for c in S[idx:]:\n if c == \"T\":\n i = 1 - i\n step[i].append(0)\n else:\n step[i][-1] += 1\n ok = check(step[0], init_x, x) and check(step[1], 0, y)\n if ok:\n print(\"Yes\")\n else:\n print(\"No\")\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef check(vec, init_pos, target_pos):\n base = 8000\n dp = [False] * 16001\n dp[init_pos + base] = True\n for i in range(len(vec)):\n dp, dp_prev = [False] * 16001, dp\n for j in range(16001):\n if (\n j - vec[i] >= 0\n and dp_prev[j - vec[i]]\n or j + vec[i] <= 16000\n and dp_prev[j + vec[i]]\n ):\n dp[j] = True\n return dp[target_pos + base]\n\n\ndef main():\n S = readline().strip()\n x, y = list(map(int, readline().split()))\n idx = len(S)\n for i, c in enumerate(S):\n if c == \"T\":\n idx = i\n break\n init_x = idx\n step = [[] for _ in range(2)]\n i = 0\n for c in S[idx:]:\n if c == \"T\":\n i = 1 - i\n step[i].append(0)\n else:\n step[i][-1] += 1\n for row in step:\n row = [v for v in row if v != 0]\n if not row:\n row = [0]\n ok = check(step[0], init_x, x) and check(step[1], 0, y)\n if ok:\n print(\"Yes\")\n else:\n print(\"No\")\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":7.5757575758,"diff":["- step = [[0] for _ in range(2)]","+ step = [[] for _ in range(2)]","+ for row in step:","+ row = [v for v in row if v != 0]","+ if not row:","+ row = [0]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0756294727,"measured_runtime_v1":0.1323513985,"runtime_lift":0.5714293434,"key":["s144977977","s912168356"]} +{"user_id":"u227082700","problem_id":"p02631","language":"python","submission_id_v0":"s472917581","submission_id_v1":"s926440854","cpu_time_v0":761,"cpu_time_v1":153,"memory_v0":184388,"memory_v1":31504,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.89,"input":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\nans=[0]*n\n\ndef f(x):\n\n c=[x[i-1]^x[i]for i in range(1,n)]\n\n k=[x[1:].count(1)%2]\n\n for i in c:\n\n k.append(k[-1]^i)\n\n return k\n\nfor i in range(31):\n\n t=1<0:\n\n del motimono[0]\n\n ans.append(sum(motimono))\n\nprint((max(ans)))","target":"n,k,*v=list(map(int,open(0).read().split()))\n\nmotimono=[]\n\nans=[]\n\nv*=2\n\nfor j in range(1,min(n,k)+1):\n\n for i in range(n-j,n+1):\n\n motimono=v[i:i+j]\n\n ans.append(sum(motimono))\n\n motimono.sort()\n\n for i in range(min(k-j,j)):\n\n del motimono[0]\n\n ans.append(sum(motimono))\n\nprint((max(ans)))\n","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":365,"code_v1_num_chars":336,"code_v0_no_empty_lines":"n, k, *v = list(map(int, open(0).read().split()))\nmotimono = []\nans = []\nv *= 2\nfor j in range(1, min(n, k) + 1):\n for i in range(n - j, n + 1):\n motimono = v[i : i + j]\n ans.append(sum(motimono))\n motimono.sort()\n for i in range(k - j):\n if len(motimono) > 0:\n del motimono[0]\n ans.append(sum(motimono))\nprint((max(ans)))\n","code_v1_no_empty_lines":"n, k, *v = list(map(int, open(0).read().split()))\nmotimono = []\nans = []\nv *= 2\nfor j in range(1, min(n, k) + 1):\n for i in range(n - j, n + 1):\n motimono = v[i : i + j]\n ans.append(sum(motimono))\n motimono.sort()\n for i in range(min(k - j, j)):\n del motimono[0]\n ans.append(sum(motimono))\nprint((max(ans)))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["- for i in range(k - j):","- if len(motimono) > 0:","- del motimono[0]","+ for i in range(min(k - j, j)):","+ del motimono[0]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0071441348,"measured_runtime_v1":0.032842633,"runtime_lift":0.2175262488,"key":["s536409149","s941306946"]} +{"user_id":"u537782349","problem_id":"p03416","language":"python","submission_id_v0":"s203784075","submission_id_v1":"s800242049","cpu_time_v0":136,"cpu_time_v1":50,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.24,"input":"a, b = list(map(int, input().split()))\n\n\n\nd = 0\n\nfor i in range(a, b+1):\n\n c = str(i)\n\n e = True\n\n for j in range(len(c)\/\/2):\n\n if c[j] != c[-j-1] and e:\n\n e = not e\n\n if e:\n\n d += 1\n\nprint(d)\n","target":"a, b = list(map(int, input().split()))\n\nd = 0\n\nfor i in range(a, b+1):\n\n c = str(i)\n\n if c[0] == c[-1] and c[1] == c[-2]:\n\n d += 1\n\nprint(d)\n","code_v0_loc":12,"code_v1_loc":7,"code_v0_num_chars":224,"code_v1_num_chars":148,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nd = 0\nfor i in range(a, b + 1):\n c = str(i)\n e = True\n for j in range(len(c) \/\/ 2):\n if c[j] != c[-j - 1] and e:\n e = not e\n if e:\n d += 1\nprint(d)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nd = 0\nfor i in range(a, b + 1):\n c = str(i)\n if c[0] == c[-1] and c[1] == c[-2]:\n d += 1\nprint(d)\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["- e = True","- for j in range(len(c) \/\/ 2):","- if c[j] != c[-j - 1] and e:","- e = not e","- if e:","+ if c[0] == c[-1] and c[1] == c[-2]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1818308883,"measured_runtime_v1":0.1800217121,"runtime_lift":1.0100497662,"key":["s203784075","s800242049"]} +{"user_id":"u581320767","problem_id":"p02732","language":"python","submission_id_v0":"s018409384","submission_id_v1":"s343717568","cpu_time_v0":478,"cpu_time_v1":395,"memory_v0":87756,"memory_v1":90444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.36,"input":"from collections import Counter\n\nN, li = int(eval(input())), list(map(int, input().split()))\n\ncnt_dict, cnt_total = Counter(li), 0\n\nfor i in list(cnt_dict.items()):\n\n cnt_total += i[1] * (i[1]-1) \/\/ 2\n\nfor k in range(N):\n\n buf = cnt_dict[li[k]]\n\n print((cnt_total - buf*(buf-1)\/\/2 + (buf-1)*(buf-2)\/\/2))","target":"from collections import Counter\n\nN, li = int(eval(input())), list(map(int, input().split()))\n\ncnt_dict, cnt_total = Counter(li), 0\n\ncnt_total =sum([i[1] * (i[1]-1) \/\/ 2 for i in list(cnt_dict.items())])\n\nfor k in range(N):\n\n print((cnt_total - cnt_dict[li[k]]*(cnt_dict[li[k]]-1)\/\/2 + (cnt_dict[li[k]]-1)*(cnt_dict[li[k]]-2)\/\/2))","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":298,"code_v1_num_chars":318,"code_v0_no_empty_lines":"from collections import Counter\n\nN, li = int(eval(input())), list(map(int, input().split()))\ncnt_dict, cnt_total = Counter(li), 0\nfor i in list(cnt_dict.items()):\n cnt_total += i[1] * (i[1] - 1) \/\/ 2\nfor k in range(N):\n buf = cnt_dict[li[k]]\n print((cnt_total - buf * (buf - 1) \/\/ 2 + (buf - 1) * (buf - 2) \/\/ 2))\n","code_v1_no_empty_lines":"from collections import Counter\n\nN, li = int(eval(input())), list(map(int, input().split()))\ncnt_dict, cnt_total = Counter(li), 0\ncnt_total = sum([i[1] * (i[1] - 1) \/\/ 2 for i in list(cnt_dict.items())])\nfor k in range(N):\n print(\n (\n cnt_total\n - cnt_dict[li[k]] * (cnt_dict[li[k]] - 1) \/\/ 2\n + (cnt_dict[li[k]] - 1) * (cnt_dict[li[k]] - 2) \/\/ 2\n )\n )\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-for i in list(cnt_dict.items()):","- cnt_total += i[1] * (i[1] - 1) \/\/ 2","+cnt_total = sum([i[1] * (i[1] - 1) \/\/ 2 for i in list(cnt_dict.items())])","- buf = cnt_dict[li[k]]","- print((cnt_total - buf * (buf - 1) \/\/ 2 + (buf - 1) * (buf - 2) \/\/ 2))","+ print(","+ (","+ cnt_total","+ - cnt_dict[li[k]] * (cnt_dict[li[k]] - 1) \/\/ 2","+ + (cnt_dict[li[k]] - 1) * (cnt_dict[li[k]] - 2) \/\/ 2","+ )","+ )"],"diff_only_import_comment":false,"measured_runtime_v0":0.0401179519,"measured_runtime_v1":0.0855531037,"runtime_lift":0.4689245642,"key":["s018409384","s343717568"]} +{"user_id":"u301624971","problem_id":"p03971","language":"python","submission_id_v0":"s130329666","submission_id_v1":"s022240268","cpu_time_v0":118,"cpu_time_v1":95,"memory_v0":4704,"memory_v1":4712,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.49,"input":"\n\nN,A,B = list(map(int,input().split()))\n\n\n\nS = list(eval(input()))\n\ncounter = 0\n\noversea= 1\n\nfor i,s in enumerate(S):\n\n if(s == 'a'):\n\n if(counter < (A + B)):\n\n print(\"Yes\")\n\n counter+=1\n\n else:\n\n print(\"No\")\n\n elif(s == 'b'):\n\n if(counter < (A + B) and oversea <= B):\n\n print(\"Yes\")\n\n counter+=1\n\n oversea +=1\n\n else:\n\n print(\"No\")\n\n else:\n\n print(\"No\")","target":"def myAnswer(A: int, B: int, S: list) -> None:\n\n counter = 0\n\n foreignStu = 1\n\n for i, s in enumerate(S):\n\n if(s == 'a' and counter < (A + B)): #\u56fd\u5185\u306e\u5b66\u751f\u3067\u3001\u30ab\u30a6\u30f3\u30bf\u306e\u5024\u304c(A+B)\u672a\u6e80\u306a\u3089\u901a\u904e\n\n print(\"Yes\")\n\n counter += 1#\u30ab\u30a6\u30f3\u30bf\u306e\u5024\u3092\u66f4\u65b0\n\n elif(s == 'b' and counter < (A + B) and foreignStu <= B): #\u6d77\u5916\u306e\u5b66\u751f\u3067\u3001\u30ab\u30a6\u30f3\u30bf\u306e\u5024\u304c(A+B)\u672a\u6e80\u304b\u3064\u6d77\u5916\u5b66\u751f\u306e\u9806\u4f4d\u304cB\u4ee5\u4e0b\u306a\u3089\u901a\u904e\n\n print(\"Yes\")\n\n counter += 1\n\n foreignStu += 1\n\n else:\n\n print(\"No\")\n\n\n\n\n\ndef main():\n\n N, A, B = list(map(int, input().split()))\n\n S = list(eval(input()))\n\n myAnswer(A, B, S)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":22,"code_v1_loc":23,"code_v0_num_chars":465,"code_v1_num_chars":624,"code_v0_no_empty_lines":"N, A, B = list(map(int, input().split()))\nS = list(eval(input()))\ncounter = 0\noversea = 1\nfor i, s in enumerate(S):\n if s == \"a\":\n if counter < (A + B):\n print(\"Yes\")\n counter += 1\n else:\n print(\"No\")\n elif s == \"b\":\n if counter < (A + B) and oversea <= B:\n print(\"Yes\")\n counter += 1\n oversea += 1\n else:\n print(\"No\")\n else:\n print(\"No\")\n","code_v1_no_empty_lines":"def myAnswer(A: int, B: int, S: list) -> None:\n counter = 0\n foreignStu = 1\n for i, s in enumerate(S):\n if s == \"a\" and counter < (A + B): # \u56fd\u5185\u306e\u5b66\u751f\u3067\u3001\u30ab\u30a6\u30f3\u30bf\u306e\u5024\u304c(A+B)\u672a\u6e80\u306a\u3089\u901a\u904e\n print(\"Yes\")\n counter += 1 # \u30ab\u30a6\u30f3\u30bf\u306e\u5024\u3092\u66f4\u65b0\n elif (\n s == \"b\" and counter < (A + B) and foreignStu <= B\n ): # \u6d77\u5916\u306e\u5b66\u751f\u3067\u3001\u30ab\u30a6\u30f3\u30bf\u306e\u5024\u304c(A+B)\u672a\u6e80\u304b\u3064\u6d77\u5916\u5b66\u751f\u306e\u9806\u4f4d\u304cB\u4ee5\u4e0b\u306a\u3089\u901a\u904e\n print(\"Yes\")\n counter += 1\n foreignStu += 1\n else:\n print(\"No\")\n\n\ndef main():\n N, A, B = list(map(int, input().split()))\n S = list(eval(input()))\n myAnswer(A, B, S)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["-N, A, B = list(map(int, input().split()))","-S = list(eval(input()))","-counter = 0","-oversea = 1","-for i, s in enumerate(S):","- if s == \"a\":","- if counter < (A + B):","+def myAnswer(A: int, B: int, S: list) -> None:","+ counter = 0","+ foreignStu = 1","+ for i, s in enumerate(S):","+ if s == \"a\" and counter < (A + B): # \u56fd\u5185\u306e\u5b66\u751f\u3067\u3001\u30ab\u30a6\u30f3\u30bf\u306e\u5024\u304c(A+B)\u672a\u6e80\u306a\u3089\u901a\u904e","+ print(\"Yes\")","+ counter += 1 # \u30ab\u30a6\u30f3\u30bf\u306e\u5024\u3092\u66f4\u65b0","+ elif (","+ s == \"b\" and counter < (A + B) and foreignStu <= B","+ ): # \u6d77\u5916\u306e\u5b66\u751f\u3067\u3001\u30ab\u30a6\u30f3\u30bf\u306e\u5024\u304c(A+B)\u672a\u6e80\u304b\u3064\u6d77\u5916\u5b66\u751f\u306e\u9806\u4f4d\u304cB\u4ee5\u4e0b\u306a\u3089\u901a\u904e","+ foreignStu += 1","- elif s == \"b\":","- if counter < (A + B) and oversea <= B:","- print(\"Yes\")","- counter += 1","- oversea += 1","- else:","- print(\"No\")","- else:","- print(\"No\")","+","+","+def main():","+ N, A, B = list(map(int, input().split()))","+ S = list(eval(input()))","+ myAnswer(A, B, S)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369936054,"measured_runtime_v1":0.0437300406,"runtime_lift":0.8459540604,"key":["s130329666","s022240268"]} +{"user_id":"u215329188","problem_id":"p03855","language":"python","submission_id_v0":"s474656768","submission_id_v1":"s426765040","cpu_time_v0":1436,"cpu_time_v1":1193,"memory_v0":58196,"memory_v1":51744,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.92,"input":"N,K,L = list(map(int, input().split()))\n\n\n\n#print(N,K,L,D,T)\n\n\n\nclass UnionFind:\n\n def __init__(self, n: int) -> None:\n\n self.par = [i for i in range(n)]\n\n self.rank = [0] * n\n\n\n\n def find(self, x: int) -> int:\n\n if self.par[x] == x:\n\n return x\n\n else:\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n\n\n def unite(self, x: int, y: int) -> None:\n\n x = self.find(x)\n\n y = self.find(y)\n\n if self.rank[x] < self.rank[y]:\n\n self.par[x] = y\n\n else:\n\n self.par[y] = x\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n \n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5224\u5b9a\n\n #def same_check(self, x, y):\n\n # return self.find(x) == self.find(y)\n\n\n\ndef uniteOne(num, uf):\n\n for _ in range(num):\n\n d0, d1 = list(map(int, input().split()))\n\n uf.unite(d0-1, d1-1)\n\n \n\nuf_D = UnionFind(N)\n\nuf_T = UnionFind(N)\n\n\n\nuniteOne(K, uf_D)\n\nuniteOne(L, uf_T)\n\n\n\nfrom collections import Counter\n\n\n\nkeys = []\n\ncounts = Counter()\n\n\n\nfor i in range(N):\n\n key = uf_D.find(i), uf_T.find(i)\n\n keys.append(key)\n\n counts[key] += 1\n\n\n\nprint((*(counts[key] for key in keys)))","target":"N,K,L = list(map(int, input().split()))\n\n\n\n#print(N,K,L,D,T)\n\n\n\nclass UnionFind:\n\n def __init__(self, n: int) -> None:\n\n #\u30de\u30a4\u30ca\u30b9\u306a\u3089\u30eb\u30fc\u30c8\u3067\u305d\u306e\u6df1\u3055\u3092\u8868\u3059\u3002\u30d7\u30e9\u30b9\u306a\u3089\u30eb\u30fc\u30c8\u306e\u30ce\u30fc\u30c9\u3092\u6307\u3059\u3002\n\n self.nodes = [-1]*n\n\n\n\n def find_root(self, x: int) -> int:\n\n if self.nodes[x] < 0:\n\n return x\n\n else:\n\n self.nodes[x] = self.find_root(self.nodes[x])\n\n return self.nodes[x]\n\n\n\n def unite(self, x: int, y: int) -> None:\n\n x, y = self.find_root(x), self.find_root(y)\n\n #\u6d45\u3044\u65b9\u306b\u3064\u306a\u3050\n\n if (x != y):\n\n if (x < y):\n\n self.nodes[y] += self.nodes[x]\n\n self.nodes[x] = y\n\n else:\n\n self.nodes[x] += self.nodes[y]\n\n self.nodes[y] = x\n\n \n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5224\u5b9a\n\n #def same_check(self, x, y):\n\n # return self.find(x) == self.find(y)\n\n\n\ndef uniteOne(num, uf):\n\n for _ in range(num):\n\n d0, d1 = list(map(int, input().split()))\n\n uf.unite(d0-1, d1-1)\n\n \n\nuf_D = UnionFind(N)\n\nuf_T = UnionFind(N)\n\n\n\nuniteOne(K, uf_D)\n\nuniteOne(L, uf_T)\n\n\n\npairs = []\n\nfor i in range(N):\n\n pairs.append((uf_D.find_root(i), uf_T.find_root(i)))\n\n \n\npairs_count = {}\n\nfor p in pairs:\n\n if not p in pairs_count:\n\n pairs_count[p] = 1\n\n else:\n\n pairs_count[p] += 1\n\n \n\nres = [0] * N\n\nfor i in range(N):\n\n res[i] = pairs_count[pairs[i]]\n\n#print(*(res[i] for i in range(N)))\n\nprint((\" \".join([str(i) for i in res])))","code_v0_loc":52,"code_v1_loc":58,"code_v0_num_chars":1208,"code_v1_num_chars":1450,"code_v0_no_empty_lines":"N, K, L = list(map(int, input().split()))\n# print(N,K,L,D,T)\nclass UnionFind:\n def __init__(self, n: int) -> None:\n self.par = [i for i in range(n)]\n self.rank = [0] * n\n\n def find(self, x: int) -> int:\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def unite(self, x: int, y: int) -> None:\n x = self.find(x)\n y = self.find(y)\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n else:\n self.par[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5224\u5b9a\n # def same_check(self, x, y):\n # return self.find(x) == self.find(y)\n\n\ndef uniteOne(num, uf):\n for _ in range(num):\n d0, d1 = list(map(int, input().split()))\n uf.unite(d0 - 1, d1 - 1)\n\n\nuf_D = UnionFind(N)\nuf_T = UnionFind(N)\nuniteOne(K, uf_D)\nuniteOne(L, uf_T)\nfrom collections import Counter\n\nkeys = []\ncounts = Counter()\nfor i in range(N):\n key = uf_D.find(i), uf_T.find(i)\n keys.append(key)\n counts[key] += 1\nprint((*(counts[key] for key in keys)))\n","code_v1_no_empty_lines":"N, K, L = list(map(int, input().split()))\n# print(N,K,L,D,T)\nclass UnionFind:\n def __init__(self, n: int) -> None:\n # \u30de\u30a4\u30ca\u30b9\u306a\u3089\u30eb\u30fc\u30c8\u3067\u305d\u306e\u6df1\u3055\u3092\u8868\u3059\u3002\u30d7\u30e9\u30b9\u306a\u3089\u30eb\u30fc\u30c8\u306e\u30ce\u30fc\u30c9\u3092\u6307\u3059\u3002\n self.nodes = [-1] * n\n\n def find_root(self, x: int) -> int:\n if self.nodes[x] < 0:\n return x\n else:\n self.nodes[x] = self.find_root(self.nodes[x])\n return self.nodes[x]\n\n def unite(self, x: int, y: int) -> None:\n x, y = self.find_root(x), self.find_root(y)\n # \u6d45\u3044\u65b9\u306b\u3064\u306a\u3050\n if x != y:\n if x < y:\n self.nodes[y] += self.nodes[x]\n self.nodes[x] = y\n else:\n self.nodes[x] += self.nodes[y]\n self.nodes[y] = x\n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5224\u5b9a\n # def same_check(self, x, y):\n # return self.find(x) == self.find(y)\n\n\ndef uniteOne(num, uf):\n for _ in range(num):\n d0, d1 = list(map(int, input().split()))\n uf.unite(d0 - 1, d1 - 1)\n\n\nuf_D = UnionFind(N)\nuf_T = UnionFind(N)\nuniteOne(K, uf_D)\nuniteOne(L, uf_T)\npairs = []\nfor i in range(N):\n pairs.append((uf_D.find_root(i), uf_T.find_root(i)))\npairs_count = {}\nfor p in pairs:\n if not p in pairs_count:\n pairs_count[p] = 1\n else:\n pairs_count[p] += 1\nres = [0] * N\nfor i in range(N):\n res[i] = pairs_count[pairs[i]]\n# print(*(res[i] for i in range(N)))\nprint((\" \".join([str(i) for i in res])))\n","code_same":false,"relative_loc_diff_percent":10.3448275862,"diff":["- self.par = [i for i in range(n)]","- self.rank = [0] * n","+ # \u30de\u30a4\u30ca\u30b9\u306a\u3089\u30eb\u30fc\u30c8\u3067\u305d\u306e\u6df1\u3055\u3092\u8868\u3059\u3002\u30d7\u30e9\u30b9\u306a\u3089\u30eb\u30fc\u30c8\u306e\u30ce\u30fc\u30c9\u3092\u6307\u3059\u3002","+ self.nodes = [-1] * n","- def find(self, x: int) -> int:","- if self.par[x] == x:","+ def find_root(self, x: int) -> int:","+ if self.nodes[x] < 0:","- self.par[x] = self.find(self.par[x])","- return self.par[x]","+ self.nodes[x] = self.find_root(self.nodes[x])","+ return self.nodes[x]","- x = self.find(x)","- y = self.find(y)","- if self.rank[x] < self.rank[y]:","- self.par[x] = y","- else:","- self.par[y] = x","- if self.rank[x] == self.rank[y]:","- self.rank[x] += 1","+ x, y = self.find_root(x), self.find_root(y)","+ # \u6d45\u3044\u65b9\u306b\u3064\u306a\u3050","+ if x != y:","+ if x < y:","+ self.nodes[y] += self.nodes[x]","+ self.nodes[x] = y","+ else:","+ self.nodes[x] += self.nodes[y]","+ self.nodes[y] = x","-from collections import Counter","-","-keys = []","-counts = Counter()","+pairs = []","- key = uf_D.find(i), uf_T.find(i)","- keys.append(key)","- counts[key] += 1","-print((*(counts[key] for key in keys)))","+ pairs.append((uf_D.find_root(i), uf_T.find_root(i)))","+pairs_count = {}","+for p in pairs:","+ if not p in pairs_count:","+ pairs_count[p] = 1","+ else:","+ pairs_count[p] += 1","+res = [0] * N","+for i in range(N):","+ res[i] = pairs_count[pairs[i]]","+# print(*(res[i] for i in range(N)))","+print((\" \".join([str(i) for i in res])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0794730663,"measured_runtime_v1":0.0387465,"runtime_lift":2.0511031004,"key":["s474656768","s426765040"]} +{"user_id":"u315078622","problem_id":"p03166","language":"python","submission_id_v0":"s519899605","submission_id_v1":"s020566904","cpu_time_v0":1208,"cpu_time_v1":867,"memory_v0":135884,"memory_v1":65040,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.23,"input":"import sys\n\nsys.setrecursionlimit(2*10**5)\n\n\n\n\n\ndef dfs(v, graph, memo):\n\n if memo[v] != -1:\n\n return memo[v]\n\n ret = 0\n\n for c in graph[v]:\n\n ret = max(ret, dfs(c, graph, memo) + 1)\n\n memo[v] = ret\n\n return ret\n\n\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n graph = [[] for _ in range(N)]\n\n for _ in range(M):\n\n x, y = list(map(int, input().split()))\n\n x, y = x - 1, y - 1\n\n graph[x].append(y)\n\n memo = [-1] * N\n\n ans = 0\n\n for i in range(N):\n\n ans = max(ans, dfs(i, graph, memo))\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import numpy as np\n\nfrom scipy.sparse import csr_matrix\n\nfrom scipy.sparse.csgraph import connected_components\n\n\n\n\n\ndef create_graph(V: int, edges: np.array, dtype=None):\n\n \"\"\"csr_matrix \u3092\u4f5c\u6210\u3059\u308b\n\n\n\n \u3082\u3057\u7cbe\u5ea6\u304c\u8db3\u308a\u306a\u3044\u5834\u5408\u306f dtype=object \u306b\u3059\u308b\u3002\n\n \"\"\"\n\n return csr_matrix((edges[:, 2], (edges[:, 0], edges[:, 1])),\n\n shape=(V, V), dtype=dtype)\n\n\n\n\n\ndef main() -> None:\n\n N, M = list(map(int, input().split()))\n\n edges = []\n\n adj_list = [[] for _ in range(N)]\n\n for _ in range(M):\n\n x, y = list(map(int, input().split()))\n\n edges.append([x-1, y-1, 1])\n\n adj_list[x-1].append(y-1)\n\n graph = create_graph(N, np.asarray(edges))\n\n _, labels = connected_components(\n\n csgraph=graph, directed=True,\n\n connection=\"strong\", return_labels=True)\n\n order = [(x, i) for i, x in enumerate(labels)]\n\n order.sort(reverse=True)\n\n dp = [0] * N\n\n for _, i in order:\n\n for v in adj_list[i]:\n\n dp[v] = max(dp[v], dp[i] + 1)\n\n print((max(dp)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":30,"code_v1_loc":37,"code_v0_num_chars":618,"code_v1_num_chars":1053,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(2 * 10**5)\n\n\ndef dfs(v, graph, memo):\n if memo[v] != -1:\n return memo[v]\n ret = 0\n for c in graph[v]:\n ret = max(ret, dfs(c, graph, memo) + 1)\n memo[v] = ret\n return ret\n\n\ndef main():\n N, M = list(map(int, input().split()))\n graph = [[] for _ in range(N)]\n for _ in range(M):\n x, y = list(map(int, input().split()))\n x, y = x - 1, y - 1\n graph[x].append(y)\n memo = [-1] * N\n ans = 0\n for i in range(N):\n ans = max(ans, dfs(i, graph, memo))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import numpy as np\nfrom scipy.sparse import csr_matrix\nfrom scipy.sparse.csgraph import connected_components\n\n\ndef create_graph(V: int, edges: np.array, dtype=None):\n \"\"\"csr_matrix \u3092\u4f5c\u6210\u3059\u308b\n \u3082\u3057\u7cbe\u5ea6\u304c\u8db3\u308a\u306a\u3044\u5834\u5408\u306f dtype=object \u306b\u3059\u308b\u3002\n \"\"\"\n return csr_matrix(\n (edges[:, 2], (edges[:, 0], edges[:, 1])), shape=(V, V), dtype=dtype\n )\n\n\ndef main() -> None:\n N, M = list(map(int, input().split()))\n edges = []\n adj_list = [[] for _ in range(N)]\n for _ in range(M):\n x, y = list(map(int, input().split()))\n edges.append([x - 1, y - 1, 1])\n adj_list[x - 1].append(y - 1)\n graph = create_graph(N, np.asarray(edges))\n _, labels = connected_components(\n csgraph=graph, directed=True, connection=\"strong\", return_labels=True\n )\n order = [(x, i) for i, x in enumerate(labels)]\n order.sort(reverse=True)\n dp = [0] * N\n for _, i in order:\n for v in adj_list[i]:\n dp[v] = max(dp[v], dp[i] + 1)\n print((max(dp)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":18.9189189189,"diff":["-import sys","-","-sys.setrecursionlimit(2 * 10**5)","+import numpy as np","+from scipy.sparse import csr_matrix","+from scipy.sparse.csgraph import connected_components","-def dfs(v, graph, memo):","- if memo[v] != -1:","- return memo[v]","- ret = 0","- for c in graph[v]:","- ret = max(ret, dfs(c, graph, memo) + 1)","- memo[v] = ret","- return ret","+def create_graph(V: int, edges: np.array, dtype=None):","+ \"\"\"csr_matrix \u3092\u4f5c\u6210\u3059\u308b","+ \u3082\u3057\u7cbe\u5ea6\u304c\u8db3\u308a\u306a\u3044\u5834\u5408\u306f dtype=object \u306b\u3059\u308b\u3002","+ \"\"\"","+ return csr_matrix(","+ (edges[:, 2], (edges[:, 0], edges[:, 1])), shape=(V, V), dtype=dtype","+ )","-def main():","+def main() -> None:","- graph = [[] for _ in range(N)]","+ edges = []","+ adj_list = [[] for _ in range(N)]","- x, y = x - 1, y - 1","- graph[x].append(y)","- memo = [-1] * N","- ans = 0","- for i in range(N):","- ans = max(ans, dfs(i, graph, memo))","- print(ans)","+ edges.append([x - 1, y - 1, 1])","+ adj_list[x - 1].append(y - 1)","+ graph = create_graph(N, np.asarray(edges))","+ _, labels = connected_components(","+ csgraph=graph, directed=True, connection=\"strong\", return_labels=True","+ )","+ order = [(x, i) for i, x in enumerate(labels)]","+ order.sort(reverse=True)","+ dp = [0] * N","+ for _, i in order:","+ for v in adj_list[i]:","+ dp[v] = max(dp[v], dp[i] + 1)","+ print((max(dp)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0482436182,"measured_runtime_v1":0.3166509964,"runtime_lift":0.1523558075,"key":["s519899605","s020566904"]} +{"user_id":"u297574184","problem_id":"p02913","language":"python","submission_id_v0":"s067814073","submission_id_v1":"s239167726","cpu_time_v0":439,"cpu_time_v1":49,"memory_v0":206216,"memory_v1":3528,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.84,"input":"N = int(eval(input()))\n\nSs = eval(input())\n\n\n\ndef isOK(k):\n\n strAs = ['' for _ in range(N)]\n\n strBs = ['' for _ in range(N)]\n\n for L in range(N-k+1):\n\n R = L+k-1\n\n ss = Ss[L:R+1]\n\n strAs[R] = ss\n\n strBs[L] = ss\n\n\n\n strCands = set()\n\n for iEn in range(N-1):\n\n if strAs[iEn] != '':\n\n strCands.add(strAs[iEn])\n\n if strBs[iEn+1] != '' and strBs[iEn+1] in strCands:\n\n return True\n\n\n\n return False\n\n\n\n\n\nng, ok = N\/\/2 + 1, 0\n\nwhile abs(ok-ng) > 1:\n\n mid = (ng+ok) \/\/ 2\n\n if isOK(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n\n\nprint(ok)\n","target":"N = int(eval(input()))\n\nSs = eval(input())\n\n\n\nBASE = 10**9 + 7\n\nMOD = 2**61 - 1\n\n\n\ndef genRollingHash_AllRight(Ss, lenInit, BASE, MOD):\n\n As = [ord(S) for S in Ss]\n\n hashS = 0\n\n for A in As[:lenInit]:\n\n hashS = (hashS*BASE + A) % MOD\n\n yield hashS\n\n\n\n powB_L = pow(BASE, lenInit, MOD)\n\n for Aadd, Asub in zip(As[lenInit:], As[:len(As)-lenInit]):\n\n hashS = (hashS*BASE + Aadd - Asub*powB_L) % MOD\n\n yield hashS\n\n\n\ndef isOK(k):\n\n hashSs = list(genRollingHash_AllRight(Ss, k, BASE, MOD))\n\n setHashS = set()\n\n for i in range(k, N-k+1):\n\n setHashS.add(hashSs[i-k])\n\n if hashSs[i] in setHashS:\n\n return True\n\n return False\n\n\n\nng, ok = N\/\/2 + 1, 0\n\nwhile abs(ok-ng) > 1:\n\n mid = (ng+ok) \/\/ 2\n\n if isOK(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n\n\nprint(ok)\n","code_v0_loc":31,"code_v1_loc":36,"code_v0_num_chars":614,"code_v1_num_chars":831,"code_v0_no_empty_lines":"N = int(eval(input()))\nSs = eval(input())\n\n\ndef isOK(k):\n strAs = [\"\" for _ in range(N)]\n strBs = [\"\" for _ in range(N)]\n for L in range(N - k + 1):\n R = L + k - 1\n ss = Ss[L : R + 1]\n strAs[R] = ss\n strBs[L] = ss\n strCands = set()\n for iEn in range(N - 1):\n if strAs[iEn] != \"\":\n strCands.add(strAs[iEn])\n if strBs[iEn + 1] != \"\" and strBs[iEn + 1] in strCands:\n return True\n return False\n\n\nng, ok = N \/\/ 2 + 1, 0\nwhile abs(ok - ng) > 1:\n mid = (ng + ok) \/\/ 2\n if isOK(mid):\n ok = mid\n else:\n ng = mid\nprint(ok)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nSs = eval(input())\nBASE = 10**9 + 7\nMOD = 2**61 - 1\n\n\ndef genRollingHash_AllRight(Ss, lenInit, BASE, MOD):\n As = [ord(S) for S in Ss]\n hashS = 0\n for A in As[:lenInit]:\n hashS = (hashS * BASE + A) % MOD\n yield hashS\n powB_L = pow(BASE, lenInit, MOD)\n for Aadd, Asub in zip(As[lenInit:], As[: len(As) - lenInit]):\n hashS = (hashS * BASE + Aadd - Asub * powB_L) % MOD\n yield hashS\n\n\ndef isOK(k):\n hashSs = list(genRollingHash_AllRight(Ss, k, BASE, MOD))\n setHashS = set()\n for i in range(k, N - k + 1):\n setHashS.add(hashSs[i - k])\n if hashSs[i] in setHashS:\n return True\n return False\n\n\nng, ok = N \/\/ 2 + 1, 0\nwhile abs(ok - ng) > 1:\n mid = (ng + ok) \/\/ 2\n if isOK(mid):\n ok = mid\n else:\n ng = mid\nprint(ok)\n","code_same":false,"relative_loc_diff_percent":13.8888888889,"diff":["+BASE = 10**9 + 7","+MOD = 2**61 - 1","+","+","+def genRollingHash_AllRight(Ss, lenInit, BASE, MOD):","+ As = [ord(S) for S in Ss]","+ hashS = 0","+ for A in As[:lenInit]:","+ hashS = (hashS * BASE + A) % MOD","+ yield hashS","+ powB_L = pow(BASE, lenInit, MOD)","+ for Aadd, Asub in zip(As[lenInit:], As[: len(As) - lenInit]):","+ hashS = (hashS * BASE + Aadd - Asub * powB_L) % MOD","+ yield hashS","- strAs = [\"\" for _ in range(N)]","- strBs = [\"\" for _ in range(N)]","- for L in range(N - k + 1):","- R = L + k - 1","- ss = Ss[L : R + 1]","- strAs[R] = ss","- strBs[L] = ss","- strCands = set()","- for iEn in range(N - 1):","- if strAs[iEn] != \"\":","- strCands.add(strAs[iEn])","- if strBs[iEn + 1] != \"\" and strBs[iEn + 1] in strCands:","+ hashSs = list(genRollingHash_AllRight(Ss, k, BASE, MOD))","+ setHashS = set()","+ for i in range(k, N - k + 1):","+ setHashS.add(hashSs[i - k])","+ if hashSs[i] in setHashS:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0349445987,"measured_runtime_v1":0.0378257737,"runtime_lift":0.9238303736,"key":["s067814073","s239167726"]} +{"user_id":"u296518383","problem_id":"p02812","language":"python","submission_id_v0":"s310551476","submission_id_v1":"s705813940","cpu_time_v0":177,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.4,"input":"N = int(eval(input()))\n\nS = eval(input())\n\n\n\nanswer = 0\n\nfor i in range(N-2):\n\n if S[i:i+3] == \"ABC\":\n\n answer += 1\n\n\n\nprint(answer)","target":"N = int(eval(input()))\n\nS = eval(input())\n\n\n\nanswer = 0\n\nfor i in range(N):\n\n if i + 3 > N:\n\n break\n\n if S[i: i + 3] == \"ABC\":\n\n answer += 1\n\n\n\nprint(answer)","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":124,"code_v1_num_chars":153,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nanswer = 0\nfor i in range(N - 2):\n if S[i : i + 3] == \"ABC\":\n answer += 1\nprint(answer)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nanswer = 0\nfor i in range(N):\n if i + 3 > N:\n break\n if S[i : i + 3] == \"ABC\":\n answer += 1\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-for i in range(N - 2):","+for i in range(N):","+ if i + 3 > N:","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.0404708593,"measured_runtime_v1":0.0402483308,"runtime_lift":1.0055288864,"key":["s310551476","s705813940"]} +{"user_id":"u628285938","problem_id":"p03565","language":"python","submission_id_v0":"s936829600","submission_id_v1":"s272046936","cpu_time_v0":32,"cpu_time_v1":26,"memory_v0":9104,"memory_v1":9100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.75,"input":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nCreated on Mon Sep 28 02:20:36 2020\n\n\n\n@author: liang\n\n\"\"\"\n\nS = eval(input())\n\nT = eval(input())\n\n\n\nS = S[::-1]\n\nT = T[::-1]\n\n\n\nres = list()\n\n\n\nfor i in range(len(S)-len(T)+1):\n\n flag = True\n\n for j in range(len(T)):\n\n if S[i+j] == \"?\" or S[i+j] == T[j]:\n\n continue\n\n else:\n\n flag = False\n\n if flag == True:\n\n ans = \"\"\n\n for k in range(len(S)):\n\n if i <= k <= i + len(T)-1:\n\n #print(T[k-i])\n\n ans += T[k-i]\n\n elif S[k] != \"?\":\n\n #print(\"B\")\n\n ans += S[k]\n\n else:\n\n #print(\"C\")\n\n ans += \"a\"\n\n ans = ans[::-1]\n\n res.append(ans)\n\n\n\nif res:\n\n res.sort()\n\n print((res[0]))\n\nelse:\n\n print(\"UNRESTORABLE\")\n\n#print(S)\n\n#print(T)","target":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nCreated on Mon Sep 28 02:20:36 2020\n\n\n\n@author: liang\n\n\"\"\"\n\nS = eval(input())\n\nT = eval(input())\n\n\n\nS = S[::-1]\n\nT = T[::-1]\n\n\n\nres = list()\n\n\n\nfor i in range(len(S)-len(T)+1):\n\n flag = True\n\n for j in range(len(T)):\n\n if S[i+j] == \"?\" or S[i+j] == T[j]:\n\n continue\n\n else:\n\n flag = False\n\n if flag == True:\n\n ans = \"\"\n\n for k in range(len(S)):\n\n if i <= k <= i + len(T)-1:\n\n #print(T[k-i])\n\n ans += T[k-i]\n\n elif S[k] != \"?\":\n\n #print(\"B\")\n\n ans += S[k]\n\n else:\n\n #print(\"C\")\n\n ans += \"a\"\n\n ans = ans[::-1]\n\n print(ans)\n\n break\n\n #res.append(ans)\n\nelse:\n\n print(\"UNRESTORABLE\")\n\n\"\"\"\n\nif res:\n\n res.sort()\n\n print(res[0])\n\nelse:\n\n print(\"UNRESTORABLE\")\n\n\"\"\"\n\n#print(S)\n\n#print(T)","code_v0_loc":43,"code_v1_loc":48,"code_v0_num_chars":841,"code_v1_num_chars":919,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Sep 28 02:20:36 2020\n@author: liang\n\"\"\"\nS = eval(input())\nT = eval(input())\nS = S[::-1]\nT = T[::-1]\nres = list()\nfor i in range(len(S) - len(T) + 1):\n flag = True\n for j in range(len(T)):\n if S[i + j] == \"?\" or S[i + j] == T[j]:\n continue\n else:\n flag = False\n if flag == True:\n ans = \"\"\n for k in range(len(S)):\n if i <= k <= i + len(T) - 1:\n # print(T[k-i])\n ans += T[k - i]\n elif S[k] != \"?\":\n # print(\"B\")\n ans += S[k]\n else:\n # print(\"C\")\n ans += \"a\"\n ans = ans[::-1]\n res.append(ans)\nif res:\n res.sort()\n print((res[0]))\nelse:\n print(\"UNRESTORABLE\")\n# print(S)\n# print(T)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Sep 28 02:20:36 2020\n@author: liang\n\"\"\"\nS = eval(input())\nT = eval(input())\nS = S[::-1]\nT = T[::-1]\nres = list()\nfor i in range(len(S) - len(T) + 1):\n flag = True\n for j in range(len(T)):\n if S[i + j] == \"?\" or S[i + j] == T[j]:\n continue\n else:\n flag = False\n if flag == True:\n ans = \"\"\n for k in range(len(S)):\n if i <= k <= i + len(T) - 1:\n # print(T[k-i])\n ans += T[k - i]\n elif S[k] != \"?\":\n # print(\"B\")\n ans += S[k]\n else:\n # print(\"C\")\n ans += \"a\"\n ans = ans[::-1]\n print(ans)\n break\n # res.append(ans)\nelse:\n print(\"UNRESTORABLE\")\n\"\"\"\nif res:\n res.sort()\n print(res[0])\nelse:\n print(\"UNRESTORABLE\")\n\"\"\"\n# print(S)\n# print(T)\n","code_same":false,"relative_loc_diff_percent":10.4166666667,"diff":["- res.append(ans)","+ print(ans)","+ break","+ # res.append(ans)","+else:","+ print(\"UNRESTORABLE\")","+\"\"\"","- print((res[0]))","+ print(res[0])","+\"\"\""],"diff_only_import_comment":false,"measured_runtime_v0":0.0929952928,"measured_runtime_v1":0.0455130661,"runtime_lift":2.043265829,"key":["s936829600","s272046936"]} +{"user_id":"u057109575","problem_id":"p02769","language":"python","submission_id_v0":"s711560991","submission_id_v1":"s978267979","cpu_time_v0":268,"cpu_time_v1":143,"memory_v0":48604,"memory_v1":84668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.64,"input":"N, K = list(map(int, open(0).read().split()))\n\n\n\nMAX = 5 * 10 ** 5\n\nMOD = 10 ** 9 + 7\n\n\n\n# Factorial\n\nfac = [0] * (MAX + 1)\n\nfac[0] = 1\n\nfac[1] = 1\n\nfor i in range(2, MAX + 1):\n\n fac[i] = fac[i - 1] * i % MOD\n\n \n\n# Inverse factorial\n\nfinv = [0] * (MAX + 1)\n\nfinv[MAX] = pow(fac[MAX], MOD - 2, MOD)\n\nfor i in reversed(list(range(1, MAX + 1))):\n\n finv[i - 1] = finv[i] * i % MOD\n\n\n\ndef comb(n, k):\n\n return fac[n] * finv[n - k] * finv[k]\n\n\n\ndef rep_perm(n, k):\n\n return comb(n + k - 1, k)\n\n\n\nans = 0\n\nfor k in range(0, min(N, K + 1)):\n\n ans += comb(N, k) * rep_perm(N - k, k)\n\n ans %= MOD\n\nprint(ans)\n","target":"\n\nN, K = list(map(int, input().split()))\n\n\n\nMAX = 6 * 10 ** 5 + 1\n\nMOD = 10 ** 9 + 7\n\n\n\n# Factorial\n\nfac = [0] * (MAX + 1)\n\nfac[0] = 1\n\nfac[1] = 1\n\n\n\n# Inverse\n\ninv = [0] * (MAX + 1)\n\ninv[1] = 1\n\n\n\n# Inverse factorial\n\nfinv = [0] * (MAX + 1)\n\nfinv[0] = 1\n\nfinv[1] = 1\n\n\n\nfor i in range(2, MAX + 1):\n\n fac[i] = fac[i - 1] * i % MOD\n\n inv[i] = MOD - inv[MOD % i] * (MOD \/\/ i) % MOD\n\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n\n\n\n\ndef comb(n, k):\n\n if n < k or k < 0:\n\n return 0\n\n return (fac[n] * finv[k] * finv[n - k]) % MOD\n\n\n\n\n\ndef comb_rep(n, k):\n\n return comb(n + k - 1, n - 1)\n\n\n\n\n\nif K >= N - 1:\n\n print((comb_rep(N + 1, N - 1)))\n\nelse:\n\n ans = 0\n\n for i in range(K + 1):\n\n ans += comb(N, i) * comb_rep(N - i, i) % MOD\n\n ans %= MOD\n\n print(ans)\n","code_v0_loc":29,"code_v1_loc":44,"code_v0_num_chars":608,"code_v1_num_chars":789,"code_v0_no_empty_lines":"N, K = list(map(int, open(0).read().split()))\nMAX = 5 * 10**5\nMOD = 10**9 + 7\n# Factorial\nfac = [0] * (MAX + 1)\nfac[0] = 1\nfac[1] = 1\nfor i in range(2, MAX + 1):\n fac[i] = fac[i - 1] * i % MOD\n# Inverse factorial\nfinv = [0] * (MAX + 1)\nfinv[MAX] = pow(fac[MAX], MOD - 2, MOD)\nfor i in reversed(list(range(1, MAX + 1))):\n finv[i - 1] = finv[i] * i % MOD\n\n\ndef comb(n, k):\n return fac[n] * finv[n - k] * finv[k]\n\n\ndef rep_perm(n, k):\n return comb(n + k - 1, k)\n\n\nans = 0\nfor k in range(0, min(N, K + 1)):\n ans += comb(N, k) * rep_perm(N - k, k)\n ans %= MOD\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nMAX = 6 * 10**5 + 1\nMOD = 10**9 + 7\n# Factorial\nfac = [0] * (MAX + 1)\nfac[0] = 1\nfac[1] = 1\n# Inverse\ninv = [0] * (MAX + 1)\ninv[1] = 1\n# Inverse factorial\nfinv = [0] * (MAX + 1)\nfinv[0] = 1\nfinv[1] = 1\nfor i in range(2, MAX + 1):\n fac[i] = fac[i - 1] * i % MOD\n inv[i] = MOD - inv[MOD % i] * (MOD \/\/ i) % MOD\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n\ndef comb(n, k):\n if n < k or k < 0:\n return 0\n return (fac[n] * finv[k] * finv[n - k]) % MOD\n\n\ndef comb_rep(n, k):\n return comb(n + k - 1, n - 1)\n\n\nif K >= N - 1:\n print((comb_rep(N + 1, N - 1)))\nelse:\n ans = 0\n for i in range(K + 1):\n ans += comb(N, i) * comb_rep(N - i, i) % MOD\n ans %= MOD\n print(ans)\n","code_same":false,"relative_loc_diff_percent":34.0909090909,"diff":["-N, K = list(map(int, open(0).read().split()))","-MAX = 5 * 10**5","+N, K = list(map(int, input().split()))","+MAX = 6 * 10**5 + 1","+# Inverse","+inv = [0] * (MAX + 1)","+inv[1] = 1","+# Inverse factorial","+finv = [0] * (MAX + 1)","+finv[0] = 1","+finv[1] = 1","-# Inverse factorial","-finv = [0] * (MAX + 1)","-finv[MAX] = pow(fac[MAX], MOD - 2, MOD)","-for i in reversed(list(range(1, MAX + 1))):","- finv[i - 1] = finv[i] * i % MOD","+ inv[i] = MOD - inv[MOD % i] * (MOD \/\/ i) % MOD","+ finv[i] = finv[i - 1] * inv[i] % MOD","- return fac[n] * finv[n - k] * finv[k]","+ if n < k or k < 0:","+ return 0","+ return (fac[n] * finv[k] * finv[n - k]) % MOD","-def rep_perm(n, k):","- return comb(n + k - 1, k)","+def comb_rep(n, k):","+ return comb(n + k - 1, n - 1)","-ans = 0","-for k in range(0, min(N, K + 1)):","- ans += comb(N, k) * rep_perm(N - k, k)","- ans %= MOD","-print(ans)","+if K >= N - 1:","+ print((comb_rep(N + 1, N - 1)))","+else:","+ ans = 0","+ for i in range(K + 1):","+ ans += comb(N, i) * comb_rep(N - i, i) % MOD","+ ans %= MOD","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":1.2494090905,"measured_runtime_v1":2.1459359853,"runtime_lift":0.5822210444,"key":["s711560991","s978267979"]} +{"user_id":"u562935282","problem_id":"p02891","language":"python","submission_id_v0":"s694020154","submission_id_v1":"s921126857","cpu_time_v0":199,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.46,"input":"s = eval(input())\n\nn = len(s)\n\nk = int(eval(input()))\n\n\n\nlis = []\n\nb = None\n\ncont = -1\n\nfor c in s:\n\n if c != b:\n\n if b is not None:\n\n lis.append(cont)\n\n b = c\n\n cont = 1\n\n else:\n\n cont += 1\n\nif b is not None:\n\n lis.append(cont)\n\n\n\n# print(lis)\n\n\n\nif k == 1 or s[-1] != s[0]:\n\n print((sum([x \/\/ 2 for x in lis]) * k))\n\nelse:\n\n if len(lis) == 1:\n\n odd = lis[0] \/\/ 2\n\n even = ((lis[0] % 2) + lis[0]) \/\/ 2\n\n # print(odd, even, k \/\/ 2)\n\n print((even * (k \/\/ 2) + odd * (k - k \/\/ 2)))\n\n else:\n\n top = lis[0] \/\/ 2\n\n mid = sum([x \/\/ 2 for x in lis[1:-1]])\n\n bottom = lis[-1] \/\/ 2\n\n joint = (lis[0] + lis[-1]) \/\/ 2\n\n print((top + bottom + joint * (k - 1) + mid * k))\n","target":"def compress(s):\n\n z = []\n\n cont = 1\n\n for ca, cb in zip(s, s[1:]):\n\n if ca == cb:\n\n cont += 1\n\n else:\n\n z.append(cont)\n\n cont = 1\n\n z.append(cont)\n\n # print(z)\n\n return z\n\n\n\n\n\ndef main():\n\n s = eval(input())\n\n n = len(s)\n\n k = int(eval(input()))\n\n\n\n z1 = compress(s)\n\n if len(z1) == 1:\n\n # like 'aaa'\n\n return n * k \/\/ 2\n\n\n\n k1 = sum([x \/\/ 2 for x in z1])\n\n if s[0] != s[-1]:\n\n # like 'ab'\n\n return k1 * k\n\n else:\n\n # like 'aba' \/ 'abaa'\n\n z2 = compress(s * 2)\n\n k2 = sum([x \/\/ 2 for x in z2])\n\n d = k2 - k1\n\n return k1 + d * (k - 1)\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n","code_v0_loc":34,"code_v1_loc":38,"code_v0_num_chars":771,"code_v1_num_chars":736,"code_v0_no_empty_lines":"s = eval(input())\nn = len(s)\nk = int(eval(input()))\nlis = []\nb = None\ncont = -1\nfor c in s:\n if c != b:\n if b is not None:\n lis.append(cont)\n b = c\n cont = 1\n else:\n cont += 1\nif b is not None:\n lis.append(cont)\n# print(lis)\nif k == 1 or s[-1] != s[0]:\n print((sum([x \/\/ 2 for x in lis]) * k))\nelse:\n if len(lis) == 1:\n odd = lis[0] \/\/ 2\n even = ((lis[0] % 2) + lis[0]) \/\/ 2\n # print(odd, even, k \/\/ 2)\n print((even * (k \/\/ 2) + odd * (k - k \/\/ 2)))\n else:\n top = lis[0] \/\/ 2\n mid = sum([x \/\/ 2 for x in lis[1:-1]])\n bottom = lis[-1] \/\/ 2\n joint = (lis[0] + lis[-1]) \/\/ 2\n print((top + bottom + joint * (k - 1) + mid * k))\n","code_v1_no_empty_lines":"def compress(s):\n z = []\n cont = 1\n for ca, cb in zip(s, s[1:]):\n if ca == cb:\n cont += 1\n else:\n z.append(cont)\n cont = 1\n z.append(cont)\n # print(z)\n return z\n\n\ndef main():\n s = eval(input())\n n = len(s)\n k = int(eval(input()))\n z1 = compress(s)\n if len(z1) == 1:\n # like 'aaa'\n return n * k \/\/ 2\n k1 = sum([x \/\/ 2 for x in z1])\n if s[0] != s[-1]:\n # like 'ab'\n return k1 * k\n else:\n # like 'aba' \/ 'abaa'\n z2 = compress(s * 2)\n k2 = sum([x \/\/ 2 for x in z2])\n d = k2 - k1\n return k1 + d * (k - 1)\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-s = eval(input())","-n = len(s)","-k = int(eval(input()))","-lis = []","-b = None","-cont = -1","-for c in s:","- if c != b:","- if b is not None:","- lis.append(cont)","- b = c","- cont = 1","+def compress(s):","+ z = []","+ cont = 1","+ for ca, cb in zip(s, s[1:]):","+ if ca == cb:","+ cont += 1","+ else:","+ z.append(cont)","+ cont = 1","+ z.append(cont)","+ # print(z)","+ return z","+","+","+def main():","+ s = eval(input())","+ n = len(s)","+ k = int(eval(input()))","+ z1 = compress(s)","+ if len(z1) == 1:","+ # like 'aaa'","+ return n * k \/\/ 2","+ k1 = sum([x \/\/ 2 for x in z1])","+ if s[0] != s[-1]:","+ # like 'ab'","+ return k1 * k","- cont += 1","-if b is not None:","- lis.append(cont)","-# print(lis)","-if k == 1 or s[-1] != s[0]:","- print((sum([x \/\/ 2 for x in lis]) * k))","-else:","- if len(lis) == 1:","- odd = lis[0] \/\/ 2","- even = ((lis[0] % 2) + lis[0]) \/\/ 2","- # print(odd, even, k \/\/ 2)","- print((even * (k \/\/ 2) + odd * (k - k \/\/ 2)))","- else:","- top = lis[0] \/\/ 2","- mid = sum([x \/\/ 2 for x in lis[1:-1]])","- bottom = lis[-1] \/\/ 2","- joint = (lis[0] + lis[-1]) \/\/ 2","- print((top + bottom + joint * (k - 1) + mid * k))","+ # like 'aba' \/ 'abaa'","+ z2 = compress(s * 2)","+ k2 = sum([x \/\/ 2 for x in z2])","+ d = k2 - k1","+ return k1 + d * (k - 1)","+","+","+if __name__ == \"__main__\":","+ print((main()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0813196051,"measured_runtime_v1":0.0389616482,"runtime_lift":2.0871705586,"key":["s694020154","s921126857"]} +{"user_id":"u926412290","problem_id":"p02880","language":"python","submission_id_v0":"s731099423","submission_id_v1":"s603027122","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"N = int(eval(input()))\n\nFLG = False\n\n\n\nfor i in range(1,10):\n\n if 0 < (N\/i) < 10 and (N\/i).is_integer():\n\n FLG = True\n\n break\n\n\n\nif FLG:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","target":"def judge(n):\n\n for i in range(1,10):\n\n for j in range(1,10):\n\n if i*j == n:\n\n return True\n\n return False\n\n\n\n\n\nN = int(eval(input()))\n\n\n\nif judge(N):\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":189,"code_v1_num_chars":224,"code_v0_no_empty_lines":"N = int(eval(input()))\nFLG = False\nfor i in range(1, 10):\n if 0 < (N \/ i) < 10 and (N \/ i).is_integer():\n FLG = True\n break\nif FLG:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"def judge(n):\n for i in range(1, 10):\n for j in range(1, 10):\n if i * j == n:\n return True\n return False\n\n\nN = int(eval(input()))\nif judge(N):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+def judge(n):","+ for i in range(1, 10):","+ for j in range(1, 10):","+ if i * j == n:","+ return True","+ return False","+","+","-FLG = False","-for i in range(1, 10):","- if 0 < (N \/ i) < 10 and (N \/ i).is_integer():","- FLG = True","- break","-if FLG:","+if judge(N):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0682071228,"measured_runtime_v1":0.0677839577,"runtime_lift":1.0062428499,"key":["s731099423","s603027122"]} +{"user_id":"u691501673","problem_id":"p02796","language":"python","submission_id_v0":"s848749326","submission_id_v1":"s726637628","cpu_time_v0":785,"cpu_time_v1":717,"memory_v0":66692,"memory_v1":65752,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.66,"input":"import sys\n\nsys.setrecursionlimit(10**7)\n\n\n\n\n\ndef test(array, index, last_position, count, min_count):\n\n # \u9664\u53bb\u6570\u304c\u591a\u3044\u30d1\u30bf\u30fc\u30f3\u306f\u7834\u68c4\u3059\u308b\n\n if min_count[0] != -1 and count >= min_count[0]:\n\n return\n\n if index + 1 == len(array):\n\n # print(\"count:{}\".format(count))\n\n min_count[0] = count if min_count[0] == - \\\n\n 1 or count < min_count[0] else min_count[0]\n\n return\n\n current = array[index]\n\n\n\n # \u524d\u306e\u3068\u624b\u304c\u3076\u3064\u304b\u308b\u5834\u5408\u306f\u53d6\u308a\u9664\u304f\n\n if last_position >= current[2]:\n\n test(array, index + 1, last_position, count + 1, min_count)\n\n # \u524d\u306e\u3068\u3076\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u53d6\u308a\u9664\u304b\u306a\u3044\u30d1\u30bf\u30fc\u30f3\u3082\n\n else:\n\n test(array, index + 1, index, count, min_count)\n\n\n\n\n\nN = int(input())\n\narray = [list(map(int, input().split())) for i in range(N)]\n\nfor line in array:\n\n line.append(line[0] - line[1])\n\n line.append(line[0] + line[1])\n\narray = sorted(array, key=lambda x: x[3])\n\n\n\ncount = 0\n\nmax_r = -float('inf')\n\nfor i in range(N):\n\n current = array[i]\n\n # print(max_r)\n\n # print(current[2])\n\n if current[2] >= max_r:\n\n # print(\"\u6b8b\u3059\")\n\n count += 1\n\n max_r = current[3]\n\n# test(array, 0, -1, 0, min_count)\n\nprint(count)\n","target":"N = int(eval(input()))\n\narray = [list(map(int, input().split())) for i in range(N)]\n\nfor line in array:\n\n line.append(line[0] - line[1])\n\n line.append(line[0] + line[1])\n\narray = sorted(array, key=lambda x: x[3])\n\n\n\ncount = 0\n\nmax_r = -float('inf')\n\nfor i in range(N):\n\n current = array[i]\n\n if current[2] >= max_r:\n\n count += 1\n\n max_r = current[3]\n\nprint(count)\n","code_v0_loc":42,"code_v1_loc":15,"code_v0_num_chars":1150,"code_v1_num_chars":384,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef test(array, index, last_position, count, min_count):\n # \u9664\u53bb\u6570\u304c\u591a\u3044\u30d1\u30bf\u30fc\u30f3\u306f\u7834\u68c4\u3059\u308b\n if min_count[0] != -1 and count >= min_count[0]:\n return\n if index + 1 == len(array):\n # print(\"count:{}\".format(count))\n min_count[0] = (\n count if min_count[0] == -1 or count < min_count[0] else min_count[0]\n )\n return\n current = array[index]\n # \u524d\u306e\u3068\u624b\u304c\u3076\u3064\u304b\u308b\u5834\u5408\u306f\u53d6\u308a\u9664\u304f\n if last_position >= current[2]:\n test(array, index + 1, last_position, count + 1, min_count)\n # \u524d\u306e\u3068\u3076\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u53d6\u308a\u9664\u304b\u306a\u3044\u30d1\u30bf\u30fc\u30f3\u3082\n else:\n test(array, index + 1, index, count, min_count)\n\n\nN = int(input())\narray = [list(map(int, input().split())) for i in range(N)]\nfor line in array:\n line.append(line[0] - line[1])\n line.append(line[0] + line[1])\narray = sorted(array, key=lambda x: x[3])\ncount = 0\nmax_r = -float(\"inf\")\nfor i in range(N):\n current = array[i]\n # print(max_r)\n # print(current[2])\n if current[2] >= max_r:\n # print(\"\u6b8b\u3059\")\n count += 1\n max_r = current[3]\n# test(array, 0, -1, 0, min_count)\nprint(count)\n","code_v1_no_empty_lines":"N = int(eval(input()))\narray = [list(map(int, input().split())) for i in range(N)]\nfor line in array:\n line.append(line[0] - line[1])\n line.append(line[0] + line[1])\narray = sorted(array, key=lambda x: x[3])\ncount = 0\nmax_r = -float(\"inf\")\nfor i in range(N):\n current = array[i]\n if current[2] >= max_r:\n count += 1\n max_r = current[3]\nprint(count)\n","code_same":false,"relative_loc_diff_percent":64.2857142857,"diff":["-import sys","-","-sys.setrecursionlimit(10**7)","-","-","-def test(array, index, last_position, count, min_count):","- # \u9664\u53bb\u6570\u304c\u591a\u3044\u30d1\u30bf\u30fc\u30f3\u306f\u7834\u68c4\u3059\u308b","- if min_count[0] != -1 and count >= min_count[0]:","- return","- if index + 1 == len(array):","- # print(\"count:{}\".format(count))","- min_count[0] = (","- count if min_count[0] == -1 or count < min_count[0] else min_count[0]","- )","- return","- current = array[index]","- # \u524d\u306e\u3068\u624b\u304c\u3076\u3064\u304b\u308b\u5834\u5408\u306f\u53d6\u308a\u9664\u304f","- if last_position >= current[2]:","- test(array, index + 1, last_position, count + 1, min_count)","- # \u524d\u306e\u3068\u3076\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u53d6\u308a\u9664\u304b\u306a\u3044\u30d1\u30bf\u30fc\u30f3\u3082","- else:","- test(array, index + 1, index, count, min_count)","-","-","-N = int(input())","+N = int(eval(input()))","- # print(max_r)","- # print(current[2])","- # print(\"\u6b8b\u3059\")","-# test(array, 0, -1, 0, min_count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0414193566,"measured_runtime_v1":0.0898898892,"runtime_lift":0.4607788143,"key":["s848749326","s726637628"]} +{"user_id":"u784022244","problem_id":"p03681","language":"python","submission_id_v0":"s193142447","submission_id_v1":"s613597180","cpu_time_v0":140,"cpu_time_v1":84,"memory_v0":15248,"memory_v1":86844,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.0,"input":"N,M=list(map(int,input().split()))\n\n\n\nif abs(N-M)>1:\n\n print((0))\n\n exit()\n\n\n\ndef cmb(n, r, p):\n\n if (r < 0) or (n < r):\n\n return 0\n\n r = min(r, n - r)\n\n return fact[n] * factinv[r] * factinv[n-r] % p\n\n\n\np = 10 ** 9 + 7\n\nn = 10 ** 5 # N \u306f\u5fc5\u8981\u5206\u3060\u3051\u7528\u610f\u3059\u308b\n\nfact = [1, 1] # fact[n] = (n! mod p) \u968e\u4e57\u306emod\n\nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\n\ninv = [0, 1] # factinv \u8a08\u7b97\u7528\n\n \n\nfor i in range(2, n + 1):\n\n fact.append((fact[-1] * i) % p)\n\n inv.append((-inv[p % i] * (p \/\/ i)) % p)\n\n factinv.append((factinv[-1] * inv[-1]) % p)\n\n\n\nans=(fact[N]*fact[M])%p\n\nif N==M:\n\n ans*=2\n\n ans%=p\n\nprint(ans)","target":"N,M=list(map(int, input().split()))\n\n\n\nif abs(N-M)>1:\n\n print((0))\n\n exit()\n\n\n\np = 10 ** 9 + 7\n\nn = 10 ** 5 # N \u306f\u5fc5\u8981\u5206\u3060\u3051\u7528\u610f\u3059\u308b\n\nfact = [1, 1] # fact[n] = (n! mod p) \u968e\u4e57\u306emod\n\nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\n\ninv = [0, 1] # factinv \u8a08\u7b97\u7528\n\nfor i in range(2, n + 1):\n\n fact.append((fact[-1] * i) % p)\n\n inv.append((-inv[p % i] * (p \/\/ i)) % p)\n\n factinv.append((factinv[-1] * inv[-1]) % p)\n\n\n\nif N==M:\n\n ans=2*fact[N]*fact[M] % p\n\nelse:\n\n big = max(N, M)\n\n small = min(N, M)\n\n ans = fact[N]*fact[M] % p\n\n\n\nprint(ans)\n","code_v0_loc":28,"code_v1_loc":24,"code_v0_num_chars":624,"code_v1_num_chars":547,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nif abs(N - M) > 1:\n print((0))\n exit()\n\n\ndef cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n - r] % p\n\n\np = 10**9 + 7\nn = 10**5 # N \u306f\u5fc5\u8981\u5206\u3060\u3051\u7528\u610f\u3059\u308b\nfact = [1, 1] # fact[n] = (n! mod p) \u968e\u4e57\u306emod\nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\ninv = [0, 1] # factinv \u8a08\u7b97\u7528\nfor i in range(2, n + 1):\n fact.append((fact[-1] * i) % p)\n inv.append((-inv[p % i] * (p \/\/ i)) % p)\n factinv.append((factinv[-1] * inv[-1]) % p)\nans = (fact[N] * fact[M]) % p\nif N == M:\n ans *= 2\n ans %= p\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nif abs(N - M) > 1:\n print((0))\n exit()\np = 10**9 + 7\nn = 10**5 # N \u306f\u5fc5\u8981\u5206\u3060\u3051\u7528\u610f\u3059\u308b\nfact = [1, 1] # fact[n] = (n! mod p) \u968e\u4e57\u306emod\nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\ninv = [0, 1] # factinv \u8a08\u7b97\u7528\nfor i in range(2, n + 1):\n fact.append((fact[-1] * i) % p)\n inv.append((-inv[p % i] * (p \/\/ i)) % p)\n factinv.append((factinv[-1] * inv[-1]) % p)\nif N == M:\n ans = 2 * fact[N] * fact[M] % p\nelse:\n big = max(N, M)\n small = min(N, M)\n ans = fact[N] * fact[M] % p\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-","-","-def cmb(n, r, p):","- if (r < 0) or (n < r):","- return 0","- r = min(r, n - r)","- return fact[n] * factinv[r] * factinv[n - r] % p","-","-","-ans = (fact[N] * fact[M]) % p","- ans *= 2","- ans %= p","+ ans = 2 * fact[N] * fact[M] % p","+else:","+ big = max(N, M)","+ small = min(N, M)","+ ans = fact[N] * fact[M] % p"],"diff_only_import_comment":false,"measured_runtime_v0":0.18598423,"measured_runtime_v1":0.1826561451,"runtime_lift":1.0182204926,"key":["s193142447","s613597180"]} +{"user_id":"u254871849","problem_id":"p02821","language":"python","submission_id_v0":"s058317148","submission_id_v1":"s737777668","cpu_time_v0":563,"cpu_time_v1":213,"memory_v0":16740,"memory_v1":22540,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.17,"input":"import sys\n\nfrom itertools import accumulate\n\n\n\nn, m, *a = list(map(int, sys.stdin.read().split()))\n\na.sort()\n\n\n\nma = a[-1]\n\ncnt = [0] * (ma + 1)\n\ncur = ma\n\nfor i in range(n-1, -1, -1):\n\n if a[i] == cur:\n\n cnt[cur] += 1\n\n else:\n\n while True:\n\n cur -= 1\n\n cnt[cur] = cnt[cur+1]\n\n if cur == a[i]:\n\n cnt[cur] += 1\n\n break\n\nfor i in range(cur-1, -1, -1):\n\n cnt[i] = cnt[i+1]\n\n\n\n\n\ndef possible(border):\n\n pair_cnt = 0\n\n for i in range(n):\n\n aj = border - a[i]\n\n if aj < 0:\n\n aj = 0\n\n elif aj > ma:\n\n continue\n\n pair_cnt += cnt[aj]\n\n return pair_cnt >= m\n\n\n\ndef main():\n\n s = [0] + list(accumulate(a[::-1]))\n\n \n\n lo = 1; hi = a[-1] * 2 + 1\n\n while lo + 1 < hi:\n\n border = (lo + hi) \/\/ 2\n\n if possible(border):\n\n lo = border\n\n else:\n\n hi = border\n\n res = lo\n\n ans = 0\n\n minimum = float('inf')\n\n pair_cnt = 0\n\n for i in range(n):\n\n aj = res - a[i]\n\n if aj < 0:\n\n aj = 0\n\n elif aj > ma:\n\n continue\n\n c = cnt[aj]\n\n ans += s[c] + a[i] * c\n\n pair_cnt += c\n\n minimum = min(minimum, a[i] + a[-c])\n\n\n\n ans -= minimum * (pair_cnt - m)\n\n return ans\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","target":"import sys\n\nimport numpy as np \n\n\n\nI = np.array(sys.stdin.read().split(), dtype=np.int64)\n\nn, m = I[:2]\n\na = I[2:]\n\na.sort()\n\nma = a[-1]\n\ncnt = np.bincount(a, minlength=ma+2)\n\ncnt_not_less_than = np.cumsum(cnt[::-1])[::-1]\n\n\n\nright = a[:, None]\n\ndef possible(border):\n\n left = border - right\n\n left = np.maximum(left, 0)\n\n left = np.minimum(left, ma+1)\n\n pair_cnt = np.sum(cnt_not_less_than[left])\n\n return pair_cnt >= m\n\n\n\ndef main():\n\n lo = 1; hi = ma * 2 + 1\n\n while lo + 1 < hi:\n\n border = (lo + hi) \/\/ 2\n\n if possible(border):\n\n lo = border\n\n else:\n\n hi = border\n\n\n\n res = lo\n\n left = res - right\n\n left = np.maximum(left, 0)\n\n left = np.minimum(left, ma+1)\n\n c = cnt_not_less_than[left[left != ma+1]]\n\n pair_cnt = np.sum(c)\n\n minimum = np.amin(right[left != ma + 1] + a[-c])\n\n\n\n s = np.cumsum(a[::-1])\n\n ans = np.sum(s[c-1] + right[left != ma+1] * c) - minimum * (pair_cnt - m)\n\n return ans\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":65,"code_v1_loc":43,"code_v0_num_chars":1381,"code_v1_num_chars":1054,"code_v0_no_empty_lines":"import sys\nfrom itertools import accumulate\n\nn, m, *a = list(map(int, sys.stdin.read().split()))\na.sort()\nma = a[-1]\ncnt = [0] * (ma + 1)\ncur = ma\nfor i in range(n - 1, -1, -1):\n if a[i] == cur:\n cnt[cur] += 1\n else:\n while True:\n cur -= 1\n cnt[cur] = cnt[cur + 1]\n if cur == a[i]:\n cnt[cur] += 1\n break\nfor i in range(cur - 1, -1, -1):\n cnt[i] = cnt[i + 1]\n\n\ndef possible(border):\n pair_cnt = 0\n for i in range(n):\n aj = border - a[i]\n if aj < 0:\n aj = 0\n elif aj > ma:\n continue\n pair_cnt += cnt[aj]\n return pair_cnt >= m\n\n\ndef main():\n s = [0] + list(accumulate(a[::-1]))\n lo = 1\n hi = a[-1] * 2 + 1\n while lo + 1 < hi:\n border = (lo + hi) \/\/ 2\n if possible(border):\n lo = border\n else:\n hi = border\n res = lo\n ans = 0\n minimum = float(\"inf\")\n pair_cnt = 0\n for i in range(n):\n aj = res - a[i]\n if aj < 0:\n aj = 0\n elif aj > ma:\n continue\n c = cnt[aj]\n ans += s[c] + a[i] * c\n pair_cnt += c\n minimum = min(minimum, a[i] + a[-c])\n ans -= minimum * (pair_cnt - m)\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\nI = np.array(sys.stdin.read().split(), dtype=np.int64)\nn, m = I[:2]\na = I[2:]\na.sort()\nma = a[-1]\ncnt = np.bincount(a, minlength=ma + 2)\ncnt_not_less_than = np.cumsum(cnt[::-1])[::-1]\nright = a[:, None]\n\n\ndef possible(border):\n left = border - right\n left = np.maximum(left, 0)\n left = np.minimum(left, ma + 1)\n pair_cnt = np.sum(cnt_not_less_than[left])\n return pair_cnt >= m\n\n\ndef main():\n lo = 1\n hi = ma * 2 + 1\n while lo + 1 < hi:\n border = (lo + hi) \/\/ 2\n if possible(border):\n lo = border\n else:\n hi = border\n res = lo\n left = res - right\n left = np.maximum(left, 0)\n left = np.minimum(left, ma + 1)\n c = cnt_not_less_than[left[left != ma + 1]]\n pair_cnt = np.sum(c)\n minimum = np.amin(right[left != ma + 1] + a[-c])\n s = np.cumsum(a[::-1])\n ans = np.sum(s[c - 1] + right[left != ma + 1] * c) - minimum * (pair_cnt - m)\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":33.8461538462,"diff":["-from itertools import accumulate","+import numpy as np","-n, m, *a = list(map(int, sys.stdin.read().split()))","+I = np.array(sys.stdin.read().split(), dtype=np.int64)","+n, m = I[:2]","+a = I[2:]","-cnt = [0] * (ma + 1)","-cur = ma","-for i in range(n - 1, -1, -1):","- if a[i] == cur:","- cnt[cur] += 1","- else:","- while True:","- cur -= 1","- cnt[cur] = cnt[cur + 1]","- if cur == a[i]:","- cnt[cur] += 1","- break","-for i in range(cur - 1, -1, -1):","- cnt[i] = cnt[i + 1]","+cnt = np.bincount(a, minlength=ma + 2)","+cnt_not_less_than = np.cumsum(cnt[::-1])[::-1]","+right = a[:, None]","- pair_cnt = 0","- for i in range(n):","- aj = border - a[i]","- if aj < 0:","- aj = 0","- elif aj > ma:","- continue","- pair_cnt += cnt[aj]","+ left = border - right","+ left = np.maximum(left, 0)","+ left = np.minimum(left, ma + 1)","+ pair_cnt = np.sum(cnt_not_less_than[left])","- s = [0] + list(accumulate(a[::-1]))","- hi = a[-1] * 2 + 1","+ hi = ma * 2 + 1","- ans = 0","- minimum = float(\"inf\")","- pair_cnt = 0","- for i in range(n):","- aj = res - a[i]","- if aj < 0:","- aj = 0","- elif aj > ma:","- continue","- c = cnt[aj]","- ans += s[c] + a[i] * c","- pair_cnt += c","- minimum = min(minimum, a[i] + a[-c])","- ans -= minimum * (pair_cnt - m)","+ left = res - right","+ left = np.maximum(left, 0)","+ left = np.minimum(left, ma + 1)","+ c = cnt_not_less_than[left[left != ma + 1]]","+ pair_cnt = np.sum(c)","+ minimum = np.amin(right[left != ma + 1] + a[-c])","+ s = np.cumsum(a[::-1])","+ ans = np.sum(s[c - 1] + right[left != ma + 1] * c) - minimum * (pair_cnt - m)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0607918916,"measured_runtime_v1":0.2139920208,"runtime_lift":0.284084852,"key":["s058317148","s737777668"]} +{"user_id":"u764956288","problem_id":"p02686","language":"python","submission_id_v0":"s665483176","submission_id_v1":"s074951197","cpu_time_v0":1613,"cpu_time_v1":725,"memory_v0":80268,"memory_v1":80288,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.05,"input":"# import sys\n\n# input = sys.stdin.readline\n\n\n\n\n\ndef solve():\n\n N = int(eval(input()))\n\n brackets_gen = (eval(input()) for _ in range(N))\n\n\n\n grads_positive = list()\n\n grads_negative = list()\n\n\n\n total = 0\n\n for brackets in brackets_gen:\n\n\n\n elevation, bottom = 0, 0\n\n\n\n for bk in brackets:\n\n\n\n elevation += 1 if bk == '(' else -1\n\n bottom = min(bottom, elevation)\n\n\n\n if elevation >= 0:\n\n grads_positive.append((bottom, elevation))\n\n elif elevation < 0:\n\n grads_negative.append((bottom - elevation, -elevation))\n\n\n\n total += elevation\n\n\n\n if total != 0:\n\n return False\n\n\n\n grads_positive.sort(reverse=True)\n\n grads_negative.sort(reverse=True)\n\n\n\n def is_good(grads):\n\n elevation, bottom = 0, 0\n\n for grad in grads:\n\n bottom = elevation + grad[0]\n\n if bottom < 0:\n\n return False\n\n elevation += grad[1]\n\n\n\n return True\n\n\n\n if is_good(grads_positive) and is_good(grads_negative):\n\n return True\n\n else:\n\n return False\n\n\n\n\n\ndef main():\n\n ok = solve()\n\n if ok:\n\n print('Yes')\n\n else:\n\n print('No')\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"import sys\n\nreadline = sys.stdin.readline\n\n\n\n\n\ndef solve():\n\n N = int(eval(input()))\n\n brackets_gen = (readline().strip() for _ in range(N))\n\n\n\n grads_positive = list()\n\n grads_negative = list()\n\n\n\n total = 0\n\n for brackets in brackets_gen:\n\n\n\n elevation, bottom = 0, 0\n\n\n\n for bk in brackets:\n\n\n\n elevation += 1 if bk == '(' else -1\n\n bottom = min(bottom, elevation)\n\n\n\n if elevation >= 0:\n\n grads_positive.append((bottom, elevation))\n\n elif elevation < 0:\n\n grads_negative.append((bottom - elevation, -elevation))\n\n\n\n total += elevation\n\n\n\n if total != 0:\n\n return False\n\n\n\n grads_positive.sort(reverse=True)\n\n grads_negative.sort(reverse=True)\n\n\n\n def is_good(grads):\n\n elevation, bottom = 0, 0\n\n for grad in grads:\n\n bottom = elevation + grad[0]\n\n if bottom < 0:\n\n return False\n\n elevation += grad[1]\n\n\n\n return True\n\n\n\n if is_good(grads_positive) and is_good(grads_negative):\n\n return True\n\n else:\n\n return False\n\n\n\n\n\ndef main():\n\n ok = solve()\n\n if ok:\n\n print('Yes')\n\n else:\n\n print('No')\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":60,"code_v1_loc":60,"code_v0_num_chars":1252,"code_v1_num_chars":1262,"code_v0_no_empty_lines":"# import sys\n# input = sys.stdin.readline\ndef solve():\n N = int(eval(input()))\n brackets_gen = (eval(input()) for _ in range(N))\n grads_positive = list()\n grads_negative = list()\n total = 0\n for brackets in brackets_gen:\n elevation, bottom = 0, 0\n for bk in brackets:\n elevation += 1 if bk == \"(\" else -1\n bottom = min(bottom, elevation)\n if elevation >= 0:\n grads_positive.append((bottom, elevation))\n elif elevation < 0:\n grads_negative.append((bottom - elevation, -elevation))\n total += elevation\n if total != 0:\n return False\n grads_positive.sort(reverse=True)\n grads_negative.sort(reverse=True)\n\n def is_good(grads):\n elevation, bottom = 0, 0\n for grad in grads:\n bottom = elevation + grad[0]\n if bottom < 0:\n return False\n elevation += grad[1]\n return True\n\n if is_good(grads_positive) and is_good(grads_negative):\n return True\n else:\n return False\n\n\ndef main():\n ok = solve()\n if ok:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\n\n\ndef solve():\n N = int(eval(input()))\n brackets_gen = (readline().strip() for _ in range(N))\n grads_positive = list()\n grads_negative = list()\n total = 0\n for brackets in brackets_gen:\n elevation, bottom = 0, 0\n for bk in brackets:\n elevation += 1 if bk == \"(\" else -1\n bottom = min(bottom, elevation)\n if elevation >= 0:\n grads_positive.append((bottom, elevation))\n elif elevation < 0:\n grads_negative.append((bottom - elevation, -elevation))\n total += elevation\n if total != 0:\n return False\n grads_positive.sort(reverse=True)\n grads_negative.sort(reverse=True)\n\n def is_good(grads):\n elevation, bottom = 0, 0\n for grad in grads:\n bottom = elevation + grad[0]\n if bottom < 0:\n return False\n elevation += grad[1]\n return True\n\n if is_good(grads_positive) and is_good(grads_negative):\n return True\n else:\n return False\n\n\ndef main():\n ok = solve()\n if ok:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-# import sys","-# input = sys.stdin.readline","+import sys","+","+readline = sys.stdin.readline","+","+","- brackets_gen = (eval(input()) for _ in range(N))","+ brackets_gen = (readline().strip() for _ in range(N))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0386284664,"measured_runtime_v1":0.0359835579,"runtime_lift":1.073503249,"key":["s665483176","s074951197"]} +{"user_id":"u374829922","problem_id":"p02983","language":"python","submission_id_v0":"s717506369","submission_id_v1":"s116734835","cpu_time_v0":246,"cpu_time_v1":222,"memory_v0":14436,"memory_v1":12420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.76,"input":"import numpy as np\n\na,b = list(map(int, input().split()))\n\nmod = 2019\n\nmin_score = 2019\n\n\n\nfor i in range(a, b+1):\n\n for j in range(a, b+1):\n\n if i != j:\n\n temp = (i%mod)*(j%mod) %mod\n\n if min_score > temp:\n\n min_score = temp\n\n if min_score == 0:\n\n print(min_score)\n\n exit()\n\n\n\nprint(min_score)","target":"import numpy as np\n\na,b = list(map(int, input().split()))\n\nmod = 2019\n\nmin_score = 2019\n\n\n\nfor i in range(a, b+1):\n\n for j in range(a, b+1):\n\n if i != j:\n\n temp = (i)*(j) %mod\n\n if min_score > temp:\n\n min_score = temp\n\n if min_score == 0:\n\n print(min_score)\n\n exit()\n\n\n\nprint(min_score)","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":376,"code_v1_num_chars":368,"code_v0_no_empty_lines":"import numpy as np\n\na, b = list(map(int, input().split()))\nmod = 2019\nmin_score = 2019\nfor i in range(a, b + 1):\n for j in range(a, b + 1):\n if i != j:\n temp = (i % mod) * (j % mod) % mod\n if min_score > temp:\n min_score = temp\n if min_score == 0:\n print(min_score)\n exit()\nprint(min_score)\n","code_v1_no_empty_lines":"import numpy as np\n\na, b = list(map(int, input().split()))\nmod = 2019\nmin_score = 2019\nfor i in range(a, b + 1):\n for j in range(a, b + 1):\n if i != j:\n temp = (i) * (j) % mod\n if min_score > temp:\n min_score = temp\n if min_score == 0:\n print(min_score)\n exit()\nprint(min_score)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- temp = (i % mod) * (j % mod) % mod","+ temp = (i) * (j) % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.0442426405,"measured_runtime_v1":0.0440543206,"runtime_lift":1.0042747206,"key":["s717506369","s116734835"]} +{"user_id":"u644907318","problem_id":"p02761","language":"python","submission_id_v0":"s951065075","submission_id_v1":"s256434489","cpu_time_v0":168,"cpu_time_v1":67,"memory_v0":38384,"memory_v1":63332,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.12,"input":"N,M = list(map(int,input().split()))\n\nA = [list(map(int,input().split())) for _ in range(M)]\n\nif N==1:\n\n for i in range(10):\n\n flg = 0\n\n for j in range(M):\n\n s,c = A[j]\n\n if str(i)[s-1]==str(c):\n\n continue\n\n else:\n\n flg = 1\n\n break\n\n if flg==0:\n\n print(i)\n\n break\n\n if flg==1:\n\n print((-1))\n\nelse:\n\n for i in range(10**(N-1),10**N):\n\n flg = 0\n\n for j in range(M):\n\n s,c = A[j]\n\n if str(i)[s-1]==str(c):\n\n continue\n\n else:\n\n flg = 1\n\n break\n\n if flg==0:\n\n print(i)\n\n break\n\n if flg==1:\n\n print((-1))","target":"N,M = list(map(int,input().split()))\n\nA = [list(map(int,input().split())) for _ in range(M)]\n\nn = -1\n\nfor x in range(1000):\n\n x = str(x)\n\n if len(x)!=N:continue\n\n ind = 0\n\n for i in range(M):\n\n s,c = A[i]\n\n if x[int(s)-1]!=str(c):\n\n ind=1\n\n break\n\n if ind==0:\n\n n = x\n\n break\n\nprint(n)","code_v0_loc":32,"code_v1_loc":16,"code_v0_num_chars":756,"code_v1_num_chars":344,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nA = [list(map(int, input().split())) for _ in range(M)]\nif N == 1:\n for i in range(10):\n flg = 0\n for j in range(M):\n s, c = A[j]\n if str(i)[s - 1] == str(c):\n continue\n else:\n flg = 1\n break\n if flg == 0:\n print(i)\n break\n if flg == 1:\n print((-1))\nelse:\n for i in range(10 ** (N - 1), 10**N):\n flg = 0\n for j in range(M):\n s, c = A[j]\n if str(i)[s - 1] == str(c):\n continue\n else:\n flg = 1\n break\n if flg == 0:\n print(i)\n break\n if flg == 1:\n print((-1))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nA = [list(map(int, input().split())) for _ in range(M)]\nn = -1\nfor x in range(1000):\n x = str(x)\n if len(x) != N:\n continue\n ind = 0\n for i in range(M):\n s, c = A[i]\n if x[int(s) - 1] != str(c):\n ind = 1\n break\n if ind == 0:\n n = x\n break\nprint(n)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-if N == 1:","- for i in range(10):","- flg = 0","- for j in range(M):","- s, c = A[j]","- if str(i)[s - 1] == str(c):","- continue","- else:","- flg = 1","- break","- if flg == 0:","- print(i)","+n = -1","+for x in range(1000):","+ x = str(x)","+ if len(x) != N:","+ continue","+ ind = 0","+ for i in range(M):","+ s, c = A[i]","+ if x[int(s) - 1] != str(c):","+ ind = 1","- if flg == 1:","- print((-1))","-else:","- for i in range(10 ** (N - 1), 10**N):","- flg = 0","- for j in range(M):","- s, c = A[j]","- if str(i)[s - 1] == str(c):","- continue","- else:","- flg = 1","- break","- if flg == 0:","- print(i)","- break","- if flg == 1:","- print((-1))","+ if ind == 0:","+ n = x","+ break","+print(n)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0571555572,"measured_runtime_v1":0.0526436672,"runtime_lift":1.0857062238,"key":["s951065075","s256434489"]} +{"user_id":"u279266699","problem_id":"p02818","language":"python","submission_id_v0":"s653235405","submission_id_v1":"s676080392","cpu_time_v0":29,"cpu_time_v1":25,"memory_v0":9088,"memory_v1":9164,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.79,"input":"a, b, k = list(map(int, input().split()))\n\nif a + b <= k:\n\n print((0, 0))\n\nelse:\n\n print((0 if a < k else a - k, b + (a - k) if a < k else b))\n","target":"a, b, k = list(map(int, input().split()))\n\nprint((0 if a < k else a - k, max(0, b + (a - k)) if a < k else b))\n","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":139,"code_v1_num_chars":103,"code_v0_no_empty_lines":"a, b, k = list(map(int, input().split()))\nif a + b <= k:\n print((0, 0))\nelse:\n print((0 if a < k else a - k, b + (a - k) if a < k else b))\n","code_v1_no_empty_lines":"a, b, k = list(map(int, input().split()))\nprint((0 if a < k else a - k, max(0, b + (a - k)) if a < k else b))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-if a + b <= k:","- print((0, 0))","-else:","- print((0 if a < k else a - k, b + (a - k) if a < k else b))","+print((0 if a < k else a - k, max(0, b + (a - k)) if a < k else b))"],"diff_only_import_comment":false,"measured_runtime_v0":0.079242437,"measured_runtime_v1":0.0409906395,"runtime_lift":1.9331837185,"key":["s653235405","s676080392"]} +{"user_id":"u600402037","problem_id":"p03017","language":"python","submission_id_v0":"s320252547","submission_id_v1":"s668413046","cpu_time_v0":86,"cpu_time_v1":72,"memory_v0":3572,"memory_v1":3572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.28,"input":"n, a, b, c, d = list(map(int, input().split()))\n\ns = eval(input())\n\nif d > c:\n\n for i in range(a, d-1):\n\n if s[i-1] == s[i] == \"#\":\n\n print(\"No\")\n\n break\n\n else:\n\n print(\"Yes\")\n\nelse:\n\n for i in range(a, c):\n\n if (s[i-1] == \"#\") & (s[i] == \"#\"):\n\n print(\"No\")\n\n break\n\n else:\n\n for j in range(b-1, d):\n\n if (s[j-1] == \".\") & (s[j] == \".\") & (s[j+1] == \".\"):\n\n print(\"Yes\")\n\n break\n\n else:\n\n print(\"No\")","target":"n, a, b, c, d = list(map(int, input().split()))\n\ns = eval(input())\n\nif d > c:\n\n for i in range(a, d-1):\n\n if s[i-1] == s[i] == \"#\":\n\n print(\"No\")\n\n break\n\n else:\n\n print(\"Yes\")\n\nelse:\n\n for i in range(a, c):\n\n if s[i-1] == s[i] == \"#\":\n\n print(\"No\")\n\n break\n\n else:\n\n for j in range(b-1, d):\n\n if s[j-1] == s[j] == s[j+1] == \".\":\n\n print(\"Yes\")\n\n break\n\n else:\n\n print(\"No\")","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":539,"code_v1_num_chars":511,"code_v0_no_empty_lines":"n, a, b, c, d = list(map(int, input().split()))\ns = eval(input())\nif d > c:\n for i in range(a, d - 1):\n if s[i - 1] == s[i] == \"#\":\n print(\"No\")\n break\n else:\n print(\"Yes\")\nelse:\n for i in range(a, c):\n if (s[i - 1] == \"#\") & (s[i] == \"#\"):\n print(\"No\")\n break\n else:\n for j in range(b - 1, d):\n if (s[j - 1] == \".\") & (s[j] == \".\") & (s[j + 1] == \".\"):\n print(\"Yes\")\n break\n else:\n print(\"No\")\n","code_v1_no_empty_lines":"n, a, b, c, d = list(map(int, input().split()))\ns = eval(input())\nif d > c:\n for i in range(a, d - 1):\n if s[i - 1] == s[i] == \"#\":\n print(\"No\")\n break\n else:\n print(\"Yes\")\nelse:\n for i in range(a, c):\n if s[i - 1] == s[i] == \"#\":\n print(\"No\")\n break\n else:\n for j in range(b - 1, d):\n if s[j - 1] == s[j] == s[j + 1] == \".\":\n print(\"Yes\")\n break\n else:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if (s[i - 1] == \"#\") & (s[i] == \"#\"):","+ if s[i - 1] == s[i] == \"#\":","- if (s[j - 1] == \".\") & (s[j] == \".\") & (s[j + 1] == \".\"):","+ if s[j - 1] == s[j] == s[j + 1] == \".\":"],"diff_only_import_comment":false,"measured_runtime_v0":0.0367152538,"measured_runtime_v1":0.083935394,"runtime_lift":0.437422785,"key":["s320252547","s668413046"]} +{"user_id":"u057109575","problem_id":"p02953","language":"python","submission_id_v0":"s312314002","submission_id_v1":"s428381107","cpu_time_v0":224,"cpu_time_v1":90,"memory_v0":71228,"memory_v1":85336,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.82,"input":"N, *H = list(map(int, open(0).read().split()))\n\ncnt = 0\n\nfor i in range(N - 1):\n\n if H[i + 1] - H[i] < -1:\n\n print('No')\n\n break\n\n elif H[i + 1] - H[i] == -1:\n\n cnt += 1\n\n elif H[i + 1] - H[i] == 0:\n\n pass\n\n else:\n\n cnt = 0\n\n \n\n if cnt > 1:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n","target":"\n\nN = int(eval(input()))\n\nX = list(map(int, input().split()))\n\n\n\ncur = 0\n\nflag = True\n\nfor i in range(N):\n\n cur = max(cur, X[i])\n\n if cur - X[i] > 1:\n\n flag = False\n\n\n\nif flag:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n","code_v0_loc":18,"code_v1_loc":15,"code_v0_num_chars":353,"code_v1_num_chars":226,"code_v0_no_empty_lines":"N, *H = list(map(int, open(0).read().split()))\ncnt = 0\nfor i in range(N - 1):\n if H[i + 1] - H[i] < -1:\n print(\"No\")\n break\n elif H[i + 1] - H[i] == -1:\n cnt += 1\n elif H[i + 1] - H[i] == 0:\n pass\n else:\n cnt = 0\n if cnt > 1:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nX = list(map(int, input().split()))\ncur = 0\nflag = True\nfor i in range(N):\n cur = max(cur, X[i])\n if cur - X[i] > 1:\n flag = False\nif flag:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-N, *H = list(map(int, open(0).read().split()))","-cnt = 0","-for i in range(N - 1):","- if H[i + 1] - H[i] < -1:","- print(\"No\")","- break","- elif H[i + 1] - H[i] == -1:","- cnt += 1","- elif H[i + 1] - H[i] == 0:","- pass","- else:","- cnt = 0","- if cnt > 1:","- print(\"No\")","- break","+N = int(eval(input()))","+X = list(map(int, input().split()))","+cur = 0","+flag = True","+for i in range(N):","+ cur = max(cur, X[i])","+ if cur - X[i] > 1:","+ flag = False","+if flag:","+ print(\"Yes\")","- print(\"Yes\")","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0449046359,"measured_runtime_v1":0.0345397007,"runtime_lift":1.3000875781,"key":["s312314002","s428381107"]} +{"user_id":"u615576660","problem_id":"p02681","language":"python","submission_id_v0":"s578014279","submission_id_v1":"s416074787","cpu_time_v0":28,"cpu_time_v1":21,"memory_v0":9808,"memory_v1":9000,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"import re\n\n\n\ns = eval(input())\n\nt = eval(input())\n\n\n\nif len(t) >= len(s) + 1 and re.match(s,t):\n\n print('Yes')\n\nelse:\n\n print('No')","target":"s = eval(input())\n\nt = input()[:-1]\n\n\n\nif s == t:\n\n print('Yes')\n\nelse:\n\n print('No')","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":125,"code_v1_num_chars":85,"code_v0_no_empty_lines":"import re\n\ns = eval(input())\nt = eval(input())\nif len(t) >= len(s) + 1 and re.match(s, t):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"s = eval(input())\nt = input()[:-1]\nif s == t:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-import re","-","-t = eval(input())","-if len(t) >= len(s) + 1 and re.match(s, t):","+t = input()[:-1]","+if s == t:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0404106455,"measured_runtime_v1":0.0349977999,"runtime_lift":1.1546624536,"key":["s578014279","s416074787"]} +{"user_id":"u131264627","problem_id":"p03775","language":"python","submission_id_v0":"s193443415","submission_id_v1":"s017828003","cpu_time_v0":58,"cpu_time_v1":30,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.28,"input":"n = int(eval(input()))\n\nmin_f = 10\n\nfor i in range(1, n + 1):\n\n if i ** 2 > n:\n\n break\n\n if n % i != 0:\n\n continue\n\n min_seq = max(len(str(i)), len(str(n \/\/ i)))\n\n if min_seq < min_f:\n\n min_f = min_seq\n\nprint(min_f)","target":"n = int(eval(input()))\n\nn_sqrt = int(n ** 0.5) + 1\n\nans = float('inf')\n\nfor i in range(1, n_sqrt + 1):\n\n if n % i == 0:\n\n j = int(n \/\/ i)\n\n max_len = max(len(str(i)), len(str(j)))\n\n ans = min(max_len, ans)\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":242,"code_v1_num_chars":235,"code_v0_no_empty_lines":"n = int(eval(input()))\nmin_f = 10\nfor i in range(1, n + 1):\n if i**2 > n:\n break\n if n % i != 0:\n continue\n min_seq = max(len(str(i)), len(str(n \/\/ i)))\n if min_seq < min_f:\n min_f = min_seq\nprint(min_f)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nn_sqrt = int(n**0.5) + 1\nans = float(\"inf\")\nfor i in range(1, n_sqrt + 1):\n if n % i == 0:\n j = int(n \/\/ i)\n max_len = max(len(str(i)), len(str(j)))\n ans = min(max_len, ans)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-min_f = 10","-for i in range(1, n + 1):","- if i**2 > n:","- break","- if n % i != 0:","- continue","- min_seq = max(len(str(i)), len(str(n \/\/ i)))","- if min_seq < min_f:","- min_f = min_seq","-print(min_f)","+n_sqrt = int(n**0.5) + 1","+ans = float(\"inf\")","+for i in range(1, n_sqrt + 1):","+ if n % i == 0:","+ j = int(n \/\/ i)","+ max_len = max(len(str(i)), len(str(j)))","+ ans = min(max_len, ans)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0905856392,"measured_runtime_v1":0.0421939042,"runtime_lift":2.146889249,"key":["s193443415","s017828003"]} +{"user_id":"u981931040","problem_id":"p03043","language":"python","submission_id_v0":"s928594685","submission_id_v1":"s166916499","cpu_time_v0":572,"cpu_time_v1":48,"memory_v0":12484,"memory_v1":9144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.61,"input":"import numpy as np\n\nN , K = list(map(int,input().split()))\n\nans = 0\n\nfor i in range(1 , N + 1):\n\n j = i\n\n idx = 0\n\n while j < K:\n\n j *= 2\n\n idx += 1\n\n ans += 1 \/ N * np.power(1 \/ 2 , idx)\n\nprint(ans)","target":"N, K = list(map(int, input().split()))\n\nans = 0\n\nfor x in range(1, N + 1):\n\n cnt = 0\n\n while x < K:\n\n cnt += 1\n\n x *= 2\n\n ans += (1 \/ N) * (1 \/ 2) ** cnt\n\nprint(ans)\n","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":219,"code_v1_num_chars":183,"code_v0_no_empty_lines":"import numpy as np\n\nN, K = list(map(int, input().split()))\nans = 0\nfor i in range(1, N + 1):\n j = i\n idx = 0\n while j < K:\n j *= 2\n idx += 1\n ans += 1 \/ N * np.power(1 \/ 2, idx)\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nans = 0\nfor x in range(1, N + 1):\n cnt = 0\n while x < K:\n cnt += 1\n x *= 2\n ans += (1 \/ N) * (1 \/ 2) ** cnt\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-import numpy as np","-","-for i in range(1, N + 1):","- j = i","- idx = 0","- while j < K:","- j *= 2","- idx += 1","- ans += 1 \/ N * np.power(1 \/ 2, idx)","+for x in range(1, N + 1):","+ cnt = 0","+ while x < K:","+ cnt += 1","+ x *= 2","+ ans += (1 \/ N) * (1 \/ 2) ** cnt"],"diff_only_import_comment":false,"measured_runtime_v0":0.5169710012,"measured_runtime_v1":0.0505223756,"runtime_lift":10.2325156953,"key":["s928594685","s166916499"]} +{"user_id":"u043048943","problem_id":"p02813","language":"python","submission_id_v0":"s741074224","submission_id_v1":"s400160028","cpu_time_v0":326,"cpu_time_v1":163,"memory_v0":55388,"memory_v1":38256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"#coding:utf-8\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nwrite = sys.stdout.write\n\ndbg = lambda *something : print(*something) if DEBUG else 0\n\nDEBUG = False\n\ndef main(given = sys.stdin.readline):\n\n input = lambda : given().rstrip()\n\n LMIIS = lambda : list(map(int,input().split()))\n\n II = lambda : int(input())\n\n XLMIIS = lambda x : [LMIIS() for _ in range(x)]\n\n\n\n N = II()\n\n P = input().replace(' ','')\n\n Q = input().replace(' ','')\n\n\n\n kouho = set(range(1,N+1))\n\n def kaijo(n):\n\n ans = 1\n\n for i in range(1,n+1):\n\n ans *= i\n\n return ans\n\n numbers = [0] * kaijo(N)\n\n # print(len(numbers))\n\n from copy import copy\n\n def mkp(kouho,i,p):\n\n if i == N-1:\n\n numbers.append(p+kouho[0])\n\n return\n\n\n\n for j in range(len(kouho)):\n\n kouho2 = copy(kouho)\n\n kouho2.remove(kouho[j])\n\n mkp(kouho2,i+1,p+kouho[j])\n\n mkp(list(map(str,range(1,N+1))),0,'')\n\n numbers = numbers[kaijo(N):]\n\n\n\n\n\n print(abs(numbers.index(P)-numbers.index(Q)))\n\n \n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#coding:utf-8\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nwrite = sys.stdout.write\n\ndbg = lambda *something : print(*something) if DEBUG else 0\n\nDEBUG = False\n\ndef main(given = sys.stdin.readline):\n\n input = lambda : given().rstrip()\n\n LMIIS = lambda : list(map(int,input().split()))\n\n II = lambda : int(input())\n\n XLMIIS = lambda x : [LMIIS() for _ in range(x)]\n\n\n\n N = II()\n\n P = LMIIS()\n\n Q = LMIIS()\n\n from math import factorial\n\n\n\n def index(P):\n\n candidates = list(range(1,N+1))\n\n ans = 0\n\n for i in range(N-1):\n\n ans += candidates.index(P[i]) * factorial(N-1-i)\n\n candidates.remove(P[i])\n\n return ans + 1\n\n\n\n print(abs(index(P)-index(Q)))\n\n\n\n \n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":50,"code_v1_loc":38,"code_v0_num_chars":1136,"code_v1_num_chars":791,"code_v0_no_empty_lines":"# coding:utf-8\nimport sys\n\nsys.setrecursionlimit(10**6)\nwrite = sys.stdout.write\ndbg = lambda *something: print(*something) if DEBUG else 0\nDEBUG = False\n\n\ndef main(given=sys.stdin.readline):\n input = lambda: given().rstrip()\n LMIIS = lambda: list(map(int, input().split()))\n II = lambda: int(input())\n XLMIIS = lambda x: [LMIIS() for _ in range(x)]\n N = II()\n P = input().replace(\" \", \"\")\n Q = input().replace(\" \", \"\")\n kouho = set(range(1, N + 1))\n\n def kaijo(n):\n ans = 1\n for i in range(1, n + 1):\n ans *= i\n return ans\n\n numbers = [0] * kaijo(N)\n # print(len(numbers))\n from copy import copy\n\n def mkp(kouho, i, p):\n if i == N - 1:\n numbers.append(p + kouho[0])\n return\n for j in range(len(kouho)):\n kouho2 = copy(kouho)\n kouho2.remove(kouho[j])\n mkp(kouho2, i + 1, p + kouho[j])\n\n mkp(list(map(str, range(1, N + 1))), 0, \"\")\n numbers = numbers[kaijo(N) :]\n print(abs(numbers.index(P) - numbers.index(Q)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# coding:utf-8\nimport sys\n\nsys.setrecursionlimit(10**6)\nwrite = sys.stdout.write\ndbg = lambda *something: print(*something) if DEBUG else 0\nDEBUG = False\n\n\ndef main(given=sys.stdin.readline):\n input = lambda: given().rstrip()\n LMIIS = lambda: list(map(int, input().split()))\n II = lambda: int(input())\n XLMIIS = lambda x: [LMIIS() for _ in range(x)]\n N = II()\n P = LMIIS()\n Q = LMIIS()\n from math import factorial\n\n def index(P):\n candidates = list(range(1, N + 1))\n ans = 0\n for i in range(N - 1):\n ans += candidates.index(P[i]) * factorial(N - 1 - i)\n candidates.remove(P[i])\n return ans + 1\n\n print(abs(index(P) - index(Q)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":24.0,"diff":["- P = input().replace(\" \", \"\")","- Q = input().replace(\" \", \"\")","- kouho = set(range(1, N + 1))","+ P = LMIIS()","+ Q = LMIIS()","+ from math import factorial","- def kaijo(n):","- ans = 1","- for i in range(1, n + 1):","- ans *= i","- return ans","+ def index(P):","+ candidates = list(range(1, N + 1))","+ ans = 0","+ for i in range(N - 1):","+ ans += candidates.index(P[i]) * factorial(N - 1 - i)","+ candidates.remove(P[i])","+ return ans + 1","- numbers = [0] * kaijo(N)","- # print(len(numbers))","- from copy import copy","-","- def mkp(kouho, i, p):","- if i == N - 1:","- numbers.append(p + kouho[0])","- return","- for j in range(len(kouho)):","- kouho2 = copy(kouho)","- kouho2.remove(kouho[j])","- mkp(kouho2, i + 1, p + kouho[j])","-","- mkp(list(map(str, range(1, N + 1))), 0, \"\")","- numbers = numbers[kaijo(N) :]","- print(abs(numbers.index(P) - numbers.index(Q)))","+ print(abs(index(P) - index(Q)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409994602,"measured_runtime_v1":0.0388426781,"runtime_lift":1.0555260926,"key":["s741074224","s400160028"]} +{"user_id":"u969850098","problem_id":"p03681","language":"python","submission_id_v0":"s872891453","submission_id_v1":"s385543023","cpu_time_v0":442,"cpu_time_v1":50,"memory_v0":4096,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.69,"input":"import sys\n\nreadline = sys.stdin.readline\n\nfrom math import factorial\n\nMOD = 10 ** 9 + 7\n\n\n\ndef main():\n\n N, M = list(map(int, readline().rstrip().split()))\n\n if abs(N-M) > 1:\n\n ans = 0\n\n elif N == M:\n\n ans = (factorial(N) % MOD) * (factorial(M) % MOD) * 2\n\n else:\n\n ans = (factorial(N) % MOD) * (factorial(M) % MOD)\n\n\n\n print((ans % MOD))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","target":"import sys\n\nreadline = sys.stdin.readline\n\nMOD = 10 ** 9 + 7\n\n\n\ndef factorial(N, mod=MOD):\n\n res = 1\n\n for i in range(2, N+1):\n\n res *= i\n\n res %= mod\n\n return res\n\n\n\ndef main():\n\n N, M = list(map(int, readline().rstrip().split()))\n\n if abs(N-M) > 1:\n\n ans = 0\n\n elif N == M:\n\n ans = factorial(N) * factorial(M) * 2\n\n else:\n\n ans = factorial(N) * factorial(M)\n\n\n\n print((ans % MOD))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":19,"code_v1_loc":25,"code_v0_num_chars":411,"code_v1_num_chars":477,"code_v0_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nfrom math import factorial\n\nMOD = 10**9 + 7\n\n\ndef main():\n N, M = list(map(int, readline().rstrip().split()))\n if abs(N - M) > 1:\n ans = 0\n elif N == M:\n ans = (factorial(N) % MOD) * (factorial(M) % MOD) * 2\n else:\n ans = (factorial(N) % MOD) * (factorial(M) % MOD)\n print((ans % MOD))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nMOD = 10**9 + 7\n\n\ndef factorial(N, mod=MOD):\n res = 1\n for i in range(2, N + 1):\n res *= i\n res %= mod\n return res\n\n\ndef main():\n N, M = list(map(int, readline().rstrip().split()))\n if abs(N - M) > 1:\n ans = 0\n elif N == M:\n ans = factorial(N) * factorial(M) * 2\n else:\n ans = factorial(N) * factorial(M)\n print((ans % MOD))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":24.0,"diff":["-from math import factorial","+MOD = 10**9 + 7","-MOD = 10**9 + 7","+","+def factorial(N, mod=MOD):","+ res = 1","+ for i in range(2, N + 1):","+ res *= i","+ res %= mod","+ return res","- ans = (factorial(N) % MOD) * (factorial(M) % MOD) * 2","+ ans = factorial(N) * factorial(M) * 2","- ans = (factorial(N) % MOD) * (factorial(M) % MOD)","+ ans = factorial(N) * factorial(M)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422390461,"measured_runtime_v1":0.039756012,"runtime_lift":1.062456821,"key":["s872891453","s385543023"]} +{"user_id":"u814781830","problem_id":"p02759","language":"python","submission_id_v0":"s593602231","submission_id_v1":"s774749494","cpu_time_v0":185,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.81,"input":"import math\n\nN = int(eval(input()))\n\nprint((math.ceil(N\/2)))","target":"n = int(eval(input()))\n\nif n % 2 <= 0 :\n\n print((n\/\/2))\n\nelif n % 2 >= 1 :\n\n print((n\/\/2 +1))\n","code_v0_loc":3,"code_v1_loc":5,"code_v0_num_chars":52,"code_v1_num_chars":90,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nprint((math.ceil(N \/ 2)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nif n % 2 <= 0:\n print((n \/\/ 2))\nelif n % 2 >= 1:\n print((n \/\/ 2 + 1))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-import math","-","-N = int(eval(input()))","-print((math.ceil(N \/ 2)))","+n = int(eval(input()))","+if n % 2 <= 0:","+ print((n \/\/ 2))","+elif n % 2 >= 1:","+ print((n \/\/ 2 + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0364518111,"measured_runtime_v1":0.035516844,"runtime_lift":1.026324609,"key":["s593602231","s774749494"]} +{"user_id":"u905203728","problem_id":"p02844","language":"python","submission_id_v0":"s805801594","submission_id_v1":"s886910616","cpu_time_v0":820,"cpu_time_v1":20,"memory_v0":3828,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":97.56,"input":"n=int(eval(input()))\n\ns=list(eval(input()))\n\ncnt=0\n\nfor i in range(1000):\n\n num=str(i).zfill(3)\n\n base=s\n\n for k,j in enumerate(num):\n\n if j in base:base=base[base.index(j)+1:]\n\n else:break\n\n if k==2:cnt +=1\n\nprint(cnt)","target":"n=int(eval(input()))\n\ns=eval(input())\n\ncnt=0\n\nfor i in range(1000):\n\n num=str(i).zfill(3)\n\n x=s.find(num[0])\n\n y=s.find(num[1],x+1)\n\n z=s.find(num[2],y+1)\n\n if x!=-1 and y!=-1 and z!=-1:\n\n cnt +=1\n\nprint(cnt)","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":237,"code_v1_num_chars":218,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = list(eval(input()))\ncnt = 0\nfor i in range(1000):\n num = str(i).zfill(3)\n base = s\n for k, j in enumerate(num):\n if j in base:\n base = base[base.index(j) + 1 :]\n else:\n break\n if k == 2:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\ncnt = 0\nfor i in range(1000):\n num = str(i).zfill(3)\n x = s.find(num[0])\n y = s.find(num[1], x + 1)\n z = s.find(num[2], y + 1)\n if x != -1 and y != -1 and z != -1:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-s = list(eval(input()))","+s = eval(input())","- base = s","- for k, j in enumerate(num):","- if j in base:","- base = base[base.index(j) + 1 :]","- else:","- break","- if k == 2:","- cnt += 1","+ x = s.find(num[0])","+ y = s.find(num[1], x + 1)","+ z = s.find(num[2], y + 1)","+ if x != -1 and y != -1 and z != -1:","+ cnt += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0348258739,"measured_runtime_v1":0.0364830453,"runtime_lift":0.9545769416,"key":["s805801594","s886910616"]} +{"user_id":"u633068244","problem_id":"p00914","language":"python","submission_id_v0":"s180062219","submission_id_v1":"s487628832","cpu_time_v0":7600,"cpu_time_v1":350,"memory_v0":4212,"memory_v1":4328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.39,"input":"def dfs(i,k,s):\n\n if k == s == 0: return 1\n\n if i > n or s < i*k+k-1: return 0\n\n return dfs(i+1,k,s)+dfs(i+1,k-1,s-i)\n\n \n\nwhile 1:\n\n n,k,s = list(map(int,input().split()))\n\n if n == 0: break\n\n print(dfs(1,k,s))","target":"import itertools\n\nwhile 1:\n\n n,k,s = list(map(int,input().split()))\n\n if n == 0: break\n\n print(sum(sum(ele) == s for ele in itertools.combinations(list(range(1,n+1)),k)))","code_v0_loc":9,"code_v1_loc":5,"code_v0_num_chars":225,"code_v1_num_chars":170,"code_v0_no_empty_lines":"def dfs(i, k, s):\n if k == s == 0:\n return 1\n if i > n or s < i * k + k - 1:\n return 0\n return dfs(i + 1, k, s) + dfs(i + 1, k - 1, s - i)\n\n\nwhile 1:\n n, k, s = list(map(int, input().split()))\n if n == 0:\n break\n print(dfs(1, k, s))\n","code_v1_no_empty_lines":"import itertools\n\nwhile 1:\n n, k, s = list(map(int, input().split()))\n if n == 0:\n break\n print(\n sum(sum(ele) == s for ele in itertools.combinations(list(range(1, n + 1)), k))\n )\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-def dfs(i, k, s):","- if k == s == 0:","- return 1","- if i > n or s < i * k + k - 1:","- return 0","- return dfs(i + 1, k, s) + dfs(i + 1, k - 1, s - i)","-","+import itertools","- print(dfs(1, k, s))","+ print(","+ sum(sum(ele) == s for ele in itertools.combinations(list(range(1, n + 1)), k))","+ )"],"diff_only_import_comment":false,"measured_runtime_v0":2.3041068077,"measured_runtime_v1":0.1725362859,"runtime_lift":13.3543317909,"key":["s180062219","s487628832"]} +{"user_id":"u731807761","problem_id":"p02554","language":"python","submission_id_v0":"s003883512","submission_id_v1":"s586416773","cpu_time_v0":435,"cpu_time_v1":342,"memory_v0":9340,"memory_v1":9260,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.38,"input":"from sys import exit, stdin\n\n\n\ninput = stdin.readline\n\nimport copy\n\n\n\n# from collections import deque,Counter\n\n# import numpy as np\n\n\n\n\n\n(N,) = list(map(int, input().split()))\n\n\n\nmod = 10 ** 9 + 7\n\na, b, c = 1, 1, 2\n\nfor i in range(N):\n\n a = a * 10 % mod\n\n b = b * 8 % mod\n\n c = c * 9 % mod\n\n\n\nans = (a + b - c) % mod\n\n\n\nprint(ans)\n","target":"from sys import exit, stdin\n\n\n\ninput = stdin.readline\n\nimport copy\n\n\n\n# from collections import deque,Counter\n\n# import numpy as np\n\n\n\n\n\ndef pow_mod(a, n, d):\n\n tmp = 1\n\n for _ in range(n):\n\n tmp = (tmp * a) % d\n\n return tmp\n\n\n\n\n\n(N,) = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\nans = (pow_mod(10, N, mod) + pow_mod(8, N, mod) - 2 * pow_mod(9, N, mod)) % mod\n\n\n\nprint(ans)\n","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":341,"code_v1_num_chars":399,"code_v0_no_empty_lines":"from sys import exit, stdin\n\ninput = stdin.readline\nimport copy\n\n# from collections import deque,Counter\n# import numpy as np\n(N,) = list(map(int, input().split()))\nmod = 10**9 + 7\na, b, c = 1, 1, 2\nfor i in range(N):\n a = a * 10 % mod\n b = b * 8 % mod\n c = c * 9 % mod\nans = (a + b - c) % mod\nprint(ans)\n","code_v1_no_empty_lines":"from sys import exit, stdin\n\ninput = stdin.readline\nimport copy\n\n# from collections import deque,Counter\n# import numpy as np\ndef pow_mod(a, n, d):\n tmp = 1\n for _ in range(n):\n tmp = (tmp * a) % d\n return tmp\n\n\n(N,) = list(map(int, input().split()))\nmod = 10**9 + 7\nans = (pow_mod(10, N, mod) + pow_mod(8, N, mod) - 2 * pow_mod(9, N, mod)) % mod\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+def pow_mod(a, n, d):","+ tmp = 1","+ for _ in range(n):","+ tmp = (tmp * a) % d","+ return tmp","+","+","-a, b, c = 1, 1, 2","-for i in range(N):","- a = a * 10 % mod","- b = b * 8 % mod","- c = c * 9 % mod","-ans = (a + b - c) % mod","+ans = (pow_mod(10, N, mod) + pow_mod(8, N, mod) - 2 * pow_mod(9, N, mod)) % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.147819386,"measured_runtime_v1":0.1536970761,"runtime_lift":0.9617579577,"key":["s003883512","s586416773"]} +{"user_id":"u326609687","problem_id":"p02574","language":"python","submission_id_v0":"s267842194","submission_id_v1":"s686965304","cpu_time_v0":1919,"cpu_time_v1":626,"memory_v0":140504,"memory_v1":119728,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.38,"input":"import numpy as np\n\nfrom numba import njit\n\ni4 = np.int32\n\ni8 = np.int64\n\nu4 = np.uint32\n\n\n\n\n\n@njit\n\ndef get_factorization(n):\n\n \"\"\"\n\n n\u307e\u3067\u306e\u5272\u308a\u5207\u308c\u308b\u6700\u5c0f\u306e\u7d20\u6570\u3092\u8fd4\u3059\u3002\n\n \"\"\"\n\n sieve_size = (n - 1) \/\/ 2\n\n sieve = np.zeros(sieve_size, u4)\n\n for i in range(sieve_size):\n\n if sieve[i] == 0:\n\n value_at_i = i*2 + 3\n\n for j in range(i, sieve_size, value_at_i):\n\n if sieve[j] == 0:\n\n sieve[j] = value_at_i\n\n return sieve\n\n\n\n\n\n@njit\n\ndef solve(A):\n\n a = np.sort(A)\n\n p_max = a[-1]\n\n p = get_factorization(p_max)\n\n primes_num = 1\n\n for i in range(p.shape[0]):\n\n if i*2 + 3 == p[i]:\n\n primes_num += 1\n\n a_start = 0\n\n while a[a_start] == 1:\n\n a_start += 1\n\n if a_start == a.shape[0]:\n\n return 0\n\n a = a[a_start:]\n\n if len(a) > primes_num:\n\n return 1\n\n check = np.zeros(p_max + 1, u4)\n\n for d in a:\n\n if d & 1 == 0:\n\n check[2] += 1\n\n d \/\/= 2\n\n while d & 1 == 0:\n\n d \/\/= 2\n\n prev = 2\n\n while d > 1:\n\n i = (d - 3) \/\/ 2\n\n f = p[i]\n\n if f > prev:\n\n check[f] += 1\n\n prev = f\n\n d \/\/= f\n\n\n\n if check.max() > 1:\n\n return 1\n\n else:\n\n return 0\n\n\n\n\n\ndef main(in_file):\n\n stdin = open(in_file)\n\n stdin.readline()\n\n A = np.fromstring(stdin.readline(), u4, sep=' ')\n\n ans = solve(A)\n\n if ans:\n\n g = np.gcd.reduce(A)\n\n if g > 1:\n\n ans = 2\n\n else:\n\n ans = 1\n\n p = ['pairwise coprime', 'setwise coprime', 'not coprime']\n\n print((p[ans]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main('\/dev\/stdin')\n","target":"import numpy as np\n\nfrom numba import njit\n\ni4 = np.int32\n\ni8 = np.int64\n\nu4 = np.uint32\n\n\n\n\n\n@njit\n\ndef get_factorization(n):\n\n \"\"\"\n\n n\u307e\u3067\u306e\u5272\u308a\u5207\u308c\u308b\u6700\u5c0f\u306e\u7d20\u6570\u3092\u8fd4\u3059\u3002\n\n \"\"\"\n\n sieve_size = (n - 1) \/\/ 2\n\n sieve = np.zeros(sieve_size, u4)\n\n for i in range(sieve_size):\n\n if sieve[i] == 0:\n\n value_at_i = i*2 + 3\n\n for j in range(i, sieve_size, value_at_i):\n\n if sieve[j] == 0:\n\n sieve[j] = value_at_i\n\n return sieve\n\n\n\n\n\n@njit('(u4[::-1],)', cache=True)\n\ndef solve(A):\n\n a = np.sort(A)\n\n p_max = a[-1]\n\n p = get_factorization(p_max)\n\n primes_num = 1\n\n for i in range(p.shape[0]):\n\n if i*2 + 3 == p[i]:\n\n primes_num += 1\n\n a_start = 0\n\n while a[a_start] == 1:\n\n a_start += 1\n\n if a_start == a.shape[0]:\n\n return 0\n\n a = a[a_start:]\n\n if len(a) > primes_num:\n\n return 1\n\n check = np.zeros(p_max + 1, u4)\n\n for d in a:\n\n if d & 1 == 0:\n\n check[2] += 1\n\n d \/\/= 2\n\n while d & 1 == 0:\n\n d \/\/= 2\n\n prev = 2\n\n while d > 1:\n\n i = (d - 3) \/\/ 2\n\n f = p[i]\n\n if f > prev:\n\n check[f] += 1\n\n prev = f\n\n d \/\/= f\n\n\n\n if check.max() > 1:\n\n return 1\n\n else:\n\n return 0\n\n\n\n\n\ndef main(in_file):\n\n stdin = open(in_file)\n\n stdin.readline()\n\n A = np.fromstring(stdin.readline(), u4, sep=' ')\n\n ans = solve(A)\n\n if ans:\n\n g = np.gcd.reduce(A)\n\n if g > 1:\n\n ans = 2\n\n else:\n\n ans = 1\n\n p = ['pairwise coprime', 'setwise coprime', 'not coprime']\n\n print((p[ans]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main('\/dev\/stdin')\n","code_v0_loc":79,"code_v1_loc":79,"code_v0_num_chars":1743,"code_v1_num_chars":1770,"code_v0_no_empty_lines":"import numpy as np\nfrom numba import njit\n\ni4 = np.int32\ni8 = np.int64\nu4 = np.uint32\n\n\n@njit\ndef get_factorization(n):\n \"\"\"\n n\u307e\u3067\u306e\u5272\u308a\u5207\u308c\u308b\u6700\u5c0f\u306e\u7d20\u6570\u3092\u8fd4\u3059\u3002\n \"\"\"\n sieve_size = (n - 1) \/\/ 2\n sieve = np.zeros(sieve_size, u4)\n for i in range(sieve_size):\n if sieve[i] == 0:\n value_at_i = i * 2 + 3\n for j in range(i, sieve_size, value_at_i):\n if sieve[j] == 0:\n sieve[j] = value_at_i\n return sieve\n\n\n@njit\ndef solve(A):\n a = np.sort(A)\n p_max = a[-1]\n p = get_factorization(p_max)\n primes_num = 1\n for i in range(p.shape[0]):\n if i * 2 + 3 == p[i]:\n primes_num += 1\n a_start = 0\n while a[a_start] == 1:\n a_start += 1\n if a_start == a.shape[0]:\n return 0\n a = a[a_start:]\n if len(a) > primes_num:\n return 1\n check = np.zeros(p_max + 1, u4)\n for d in a:\n if d & 1 == 0:\n check[2] += 1\n d \/\/= 2\n while d & 1 == 0:\n d \/\/= 2\n prev = 2\n while d > 1:\n i = (d - 3) \/\/ 2\n f = p[i]\n if f > prev:\n check[f] += 1\n prev = f\n d \/\/= f\n if check.max() > 1:\n return 1\n else:\n return 0\n\n\ndef main(in_file):\n stdin = open(in_file)\n stdin.readline()\n A = np.fromstring(stdin.readline(), u4, sep=\" \")\n ans = solve(A)\n if ans:\n g = np.gcd.reduce(A)\n if g > 1:\n ans = 2\n else:\n ans = 1\n p = [\"pairwise coprime\", \"setwise coprime\", \"not coprime\"]\n print((p[ans]))\n\n\nif __name__ == \"__main__\":\n main(\"\/dev\/stdin\")\n","code_v1_no_empty_lines":"import numpy as np\nfrom numba import njit\n\ni4 = np.int32\ni8 = np.int64\nu4 = np.uint32\n\n\n@njit\ndef get_factorization(n):\n \"\"\"\n n\u307e\u3067\u306e\u5272\u308a\u5207\u308c\u308b\u6700\u5c0f\u306e\u7d20\u6570\u3092\u8fd4\u3059\u3002\n \"\"\"\n sieve_size = (n - 1) \/\/ 2\n sieve = np.zeros(sieve_size, u4)\n for i in range(sieve_size):\n if sieve[i] == 0:\n value_at_i = i * 2 + 3\n for j in range(i, sieve_size, value_at_i):\n if sieve[j] == 0:\n sieve[j] = value_at_i\n return sieve\n\n\n@njit(\"(u4[::-1],)\", cache=True)\ndef solve(A):\n a = np.sort(A)\n p_max = a[-1]\n p = get_factorization(p_max)\n primes_num = 1\n for i in range(p.shape[0]):\n if i * 2 + 3 == p[i]:\n primes_num += 1\n a_start = 0\n while a[a_start] == 1:\n a_start += 1\n if a_start == a.shape[0]:\n return 0\n a = a[a_start:]\n if len(a) > primes_num:\n return 1\n check = np.zeros(p_max + 1, u4)\n for d in a:\n if d & 1 == 0:\n check[2] += 1\n d \/\/= 2\n while d & 1 == 0:\n d \/\/= 2\n prev = 2\n while d > 1:\n i = (d - 3) \/\/ 2\n f = p[i]\n if f > prev:\n check[f] += 1\n prev = f\n d \/\/= f\n if check.max() > 1:\n return 1\n else:\n return 0\n\n\ndef main(in_file):\n stdin = open(in_file)\n stdin.readline()\n A = np.fromstring(stdin.readline(), u4, sep=\" \")\n ans = solve(A)\n if ans:\n g = np.gcd.reduce(A)\n if g > 1:\n ans = 2\n else:\n ans = 1\n p = [\"pairwise coprime\", \"setwise coprime\", \"not coprime\"]\n print((p[ans]))\n\n\nif __name__ == \"__main__\":\n main(\"\/dev\/stdin\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-@njit","+@njit(\"(u4[::-1],)\", cache=True)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1956987531,"measured_runtime_v1":0.1721631665,"runtime_lift":1.1367051214,"key":["s267842194","s686965304"]} +{"user_id":"u627234757","problem_id":"p03012","language":"python","submission_id_v0":"s676083342","submission_id_v1":"s854929301","cpu_time_v0":127,"cpu_time_v1":32,"memory_v0":27140,"memory_v1":8908,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.8,"input":"import numpy\n\nimport math\n\nn = int(eval(input()))\n\nw = list(map(int, input().split()))\n\n\n\nsum_w = sum(w)\n\nsum_w = sum_w \/ 2\n\n\n\nres = numpy.cumsum(w)\n\n\n\ndiff = [2.0 * math.fabs(res[i] - sum_w) for i in range(n)]\n\nprint((int(min(diff))))","target":"n = int(eval(input()))\n\nw = list(map(int, input().split()))\n\nres = 10 ** 5\n\nfor i in range(0, n-1):\n\n a = abs(sum(w[:i+1]) - sum(w[i+1:]))\n\n if a < res:\n\n res = a\n\nprint(res)","code_v0_loc":12,"code_v1_loc":8,"code_v0_num_chars":227,"code_v1_num_chars":173,"code_v0_no_empty_lines":"import numpy\nimport math\n\nn = int(eval(input()))\nw = list(map(int, input().split()))\nsum_w = sum(w)\nsum_w = sum_w \/ 2\nres = numpy.cumsum(w)\ndiff = [2.0 * math.fabs(res[i] - sum_w) for i in range(n)]\nprint((int(min(diff))))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nw = list(map(int, input().split()))\nres = 10**5\nfor i in range(0, n - 1):\n a = abs(sum(w[: i + 1]) - sum(w[i + 1 :]))\n if a < res:\n res = a\nprint(res)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-import numpy","-import math","-","-sum_w = sum(w)","-sum_w = sum_w \/ 2","-res = numpy.cumsum(w)","-diff = [2.0 * math.fabs(res[i] - sum_w) for i in range(n)]","-print((int(min(diff))))","+res = 10**5","+for i in range(0, n - 1):","+ a = abs(sum(w[: i + 1]) - sum(w[i + 1 :]))","+ if a < res:","+ res = a","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.166285723,"measured_runtime_v1":0.0377721412,"runtime_lift":4.4023377432,"key":["s676083342","s854929301"]} +{"user_id":"u633068244","problem_id":"p00149","language":"python","submission_id_v0":"s156930379","submission_id_v1":"s674377866","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4240,"memory_v1":4316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"c = [1.1,0.6,0.2,0.0]\n\nr = [0 for i in range(8)]\n\nwhile 1:\n\n try:\n\n e = list(map(float, input().split()))\n\n for i in range(2):\n\n for j in range(4):\n\n if e[i] >= c[j]:\n\n \tr[i+2*j] += 1\n\n \tbreak\n\n except:\n\n break\n\nfor i in range(0,8,2):\n\n\tprint(r[i],r[i+1])","target":"from bisect import bisect\n\nref = [0.2,0.6,1.1]\n\nl,r = [0]*4,[0]*4\n\nwhile 1:\n\n try:\n\n le,re = list(map(float, input().split()))\n\n l[bisect(ref,le)] += 1\n\n r[bisect(ref,re)] += 1\n\n except:\n\n break\n\nfor i in range(1,5):\n\n\tprint(l[-i],r[-i])","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":335,"code_v1_num_chars":268,"code_v0_no_empty_lines":"c = [1.1, 0.6, 0.2, 0.0]\nr = [0 for i in range(8)]\nwhile 1:\n try:\n e = list(map(float, input().split()))\n for i in range(2):\n for j in range(4):\n if e[i] >= c[j]:\n r[i + 2 * j] += 1\n break\n except:\n break\nfor i in range(0, 8, 2):\n print(r[i], r[i + 1])\n","code_v1_no_empty_lines":"from bisect import bisect\n\nref = [0.2, 0.6, 1.1]\nl, r = [0] * 4, [0] * 4\nwhile 1:\n try:\n le, re = list(map(float, input().split()))\n l[bisect(ref, le)] += 1\n r[bisect(ref, re)] += 1\n except:\n break\nfor i in range(1, 5):\n print(l[-i], r[-i])\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-c = [1.1, 0.6, 0.2, 0.0]","-r = [0 for i in range(8)]","+from bisect import bisect","+","+ref = [0.2, 0.6, 1.1]","+l, r = [0] * 4, [0] * 4","- e = list(map(float, input().split()))","- for i in range(2):","- for j in range(4):","- if e[i] >= c[j]:","- r[i + 2 * j] += 1","- break","+ le, re = list(map(float, input().split()))","+ l[bisect(ref, le)] += 1","+ r[bisect(ref, re)] += 1","-for i in range(0, 8, 2):","- print(r[i], r[i + 1])","+for i in range(1, 5):","+ print(l[-i], r[-i])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0354610021,"measured_runtime_v1":0.0350065989,"runtime_lift":1.0129804998,"key":["s156930379","s674377866"]} +{"user_id":"u460375306","problem_id":"p02691","language":"python","submission_id_v0":"s243781970","submission_id_v1":"s400764885","cpu_time_v0":196,"cpu_time_v1":135,"memory_v0":125676,"memory_v1":111352,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.12,"input":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\ndict_diffs1 = dict()\n\ndict_diffs2 = dict()\n\nfor i in range(1, n+1):\n\n dict_diffs1[i+a[i-1]] = dict_diffs1.get(i+a[i-1], 0) + 1\n\n dict_diffs2[i-a[i-1]] = dict_diffs2.get(i-a[i-1], 0) + 1\n\ntotal = 0\n\nfor j in range(1, n+1):\n\n total += dict_diffs1.get(j-a[j-1], 0)\n\n total += dict_diffs2.get(j+a[j-1], 0)\n\ntotal = total\/\/2\n\nprint(total)","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\ndict_diffs = dict()\n\nfor i in range(1, n+1):\n\n dict_diffs[i+a[i-1]] = dict_diffs.get(i+a[i-1], 0) + 1\n\ntotal = 0\n\nfor j in range(1, n+1):\n\n total += dict_diffs.get(j-a[j-1], 0)\n\nprint(total)","code_v0_loc":14,"code_v1_loc":10,"code_v0_num_chars":394,"code_v1_num_chars":249,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\ndict_diffs1 = dict()\ndict_diffs2 = dict()\nfor i in range(1, n + 1):\n dict_diffs1[i + a[i - 1]] = dict_diffs1.get(i + a[i - 1], 0) + 1\n dict_diffs2[i - a[i - 1]] = dict_diffs2.get(i - a[i - 1], 0) + 1\ntotal = 0\nfor j in range(1, n + 1):\n total += dict_diffs1.get(j - a[j - 1], 0)\n total += dict_diffs2.get(j + a[j - 1], 0)\ntotal = total \/\/ 2\nprint(total)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\ndict_diffs = dict()\nfor i in range(1, n + 1):\n dict_diffs[i + a[i - 1]] = dict_diffs.get(i + a[i - 1], 0) + 1\ntotal = 0\nfor j in range(1, n + 1):\n total += dict_diffs.get(j - a[j - 1], 0)\nprint(total)\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-dict_diffs1 = dict()","-dict_diffs2 = dict()","+dict_diffs = dict()","- dict_diffs1[i + a[i - 1]] = dict_diffs1.get(i + a[i - 1], 0) + 1","- dict_diffs2[i - a[i - 1]] = dict_diffs2.get(i - a[i - 1], 0) + 1","+ dict_diffs[i + a[i - 1]] = dict_diffs.get(i + a[i - 1], 0) + 1","- total += dict_diffs1.get(j - a[j - 1], 0)","- total += dict_diffs2.get(j + a[j - 1], 0)","-total = total \/\/ 2","+ total += dict_diffs.get(j - a[j - 1], 0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0380312858,"measured_runtime_v1":0.0380794427,"runtime_lift":0.9987353547,"key":["s243781970","s400764885"]} +{"user_id":"u037430802","problem_id":"p03476","language":"python","submission_id_v0":"s543398247","submission_id_v1":"s493380892","cpu_time_v0":891,"cpu_time_v1":497,"memory_v0":9688,"memory_v1":18932,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.22,"input":"max_num = 10**5+5\n\neratos_thenes_sieve = [0,0] + [1]*max_num\n\nn = 2 #\u7d20\u6570\n\nwhile n*n <= max_num:\n\n if eratos_thenes_sieve[n]:#\n\n for i in range(2*n, max_num, n):\n\n eratos_thenes_sieve[i] = 0\n\n n += 1\n\n \n\nisLike2017 = [0] * max_num\n\ncumulativeSums = [0]\n\nfor i in range(max_num):\n\n if eratos_thenes_sieve[i] and eratos_thenes_sieve[(i+1)\/\/2]:\n\n isLike2017[i] = 1\n\n cumulativeSums.append(cumulativeSums[-1] + isLike2017[i])\n\n \n\n \n\nq = int(eval(input()))\n\n\n\nfor i in range(q):\n\n l, r = list(map(int, input().split()))\n\n print((cumulativeSums[r+1] - cumulativeSums[l]))","target":"Q = int(eval(input()))\n\nlr = [tuple(map(int, input().split())) for _ in range(Q)]\n\n\n\n\n\nN = 10**5\n\nis_prime = [True] * (N+1)\n\nis_prime[0] = False\n\nis_prime[1] = False\n\nfor i in range(2,N+1):\n\n if is_prime[i]:\n\n j = 2\n\n while j * i <= N:\n\n is_prime[i*j] = False\n\n j += 1\n\n\n\ncum_like2017 = [0] * (N+1)\n\nfor i in range(1,N+1):\n\n if is_prime[i] and is_prime[(i+1)\/\/2]:\n\n cum_like2017[i] = cum_like2017[i-1] + 1\n\n else:\n\n cum_like2017[i] = cum_like2017[i-1] \n\n\n\n\n\nfor l, r in lr:\n\n print((cum_like2017[r] - cum_like2017[l-1]))\n","code_v0_loc":22,"code_v1_loc":25,"code_v0_num_chars":569,"code_v1_num_chars":575,"code_v0_no_empty_lines":"max_num = 10**5 + 5\neratos_thenes_sieve = [0, 0] + [1] * max_num\nn = 2 # \u7d20\u6570\nwhile n * n <= max_num:\n if eratos_thenes_sieve[n]: #\n for i in range(2 * n, max_num, n):\n eratos_thenes_sieve[i] = 0\n n += 1\nisLike2017 = [0] * max_num\ncumulativeSums = [0]\nfor i in range(max_num):\n if eratos_thenes_sieve[i] and eratos_thenes_sieve[(i + 1) \/\/ 2]:\n isLike2017[i] = 1\n cumulativeSums.append(cumulativeSums[-1] + isLike2017[i])\nq = int(eval(input()))\nfor i in range(q):\n l, r = list(map(int, input().split()))\n print((cumulativeSums[r + 1] - cumulativeSums[l]))\n","code_v1_no_empty_lines":"Q = int(eval(input()))\nlr = [tuple(map(int, input().split())) for _ in range(Q)]\nN = 10**5\nis_prime = [True] * (N + 1)\nis_prime[0] = False\nis_prime[1] = False\nfor i in range(2, N + 1):\n if is_prime[i]:\n j = 2\n while j * i <= N:\n is_prime[i * j] = False\n j += 1\ncum_like2017 = [0] * (N + 1)\nfor i in range(1, N + 1):\n if is_prime[i] and is_prime[(i + 1) \/\/ 2]:\n cum_like2017[i] = cum_like2017[i - 1] + 1\n else:\n cum_like2017[i] = cum_like2017[i - 1]\nfor l, r in lr:\n print((cum_like2017[r] - cum_like2017[l - 1]))\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["-max_num = 10**5 + 5","-eratos_thenes_sieve = [0, 0] + [1] * max_num","-n = 2 # \u7d20\u6570","-while n * n <= max_num:","- if eratos_thenes_sieve[n]: #","- for i in range(2 * n, max_num, n):","- eratos_thenes_sieve[i] = 0","- n += 1","-isLike2017 = [0] * max_num","-cumulativeSums = [0]","-for i in range(max_num):","- if eratos_thenes_sieve[i] and eratos_thenes_sieve[(i + 1) \/\/ 2]:","- isLike2017[i] = 1","- cumulativeSums.append(cumulativeSums[-1] + isLike2017[i])","-q = int(eval(input()))","-for i in range(q):","- l, r = list(map(int, input().split()))","- print((cumulativeSums[r + 1] - cumulativeSums[l]))","+Q = int(eval(input()))","+lr = [tuple(map(int, input().split())) for _ in range(Q)]","+N = 10**5","+is_prime = [True] * (N + 1)","+is_prime[0] = False","+is_prime[1] = False","+for i in range(2, N + 1):","+ if is_prime[i]:","+ j = 2","+ while j * i <= N:","+ is_prime[i * j] = False","+ j += 1","+cum_like2017 = [0] * (N + 1)","+for i in range(1, N + 1):","+ if is_prime[i] and is_prime[(i + 1) \/\/ 2]:","+ cum_like2017[i] = cum_like2017[i - 1] + 1","+ else:","+ cum_like2017[i] = cum_like2017[i - 1]","+for l, r in lr:","+ print((cum_like2017[r] - cum_like2017[l - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.22096995,"measured_runtime_v1":0.4441264541,"runtime_lift":0.4975383653,"key":["s543398247","s493380892"]} +{"user_id":"u079022693","problem_id":"p03503","language":"python","submission_id_v0":"s218087570","submission_id_v1":"s406177717","cpu_time_v0":151,"cpu_time_v1":67,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.63,"input":"from sys import stdin\n\ndef main():\n\n #\u5165\u529b\n\n readline=stdin.readline\n\n N=int(readline())\n\n F=[]\n\n for i in range(N):\n\n f=list(map(int,readline().split()))\n\n F.append(f)\n\n P=[]\n\n for i in range(N):\n\n p=list(map(int,readline().split()))\n\n P.append(p)\n\n \n\n max_res=-float(\"inf\")\n\n for i in range(1<<10):\n\n if i==0:\n\n continue\n\n else:\n\n output=[]\n\n for j in range(10):\n\n if(i>>j)&1:\n\n output.append(j)\n\n\n\n oc=[0]*10 #open or close\n\n for j in output:\n\n oc[j]=1\n\n \n\n res=0\n\n for j in range(N):\n\n c=0\n\n for k in range(10):\n\n if oc[k]==1 and F[j][k]==1:\n\n c+=1\n\n res+=P[j][c]\n\n max_res=max(res,max_res)\n\n\n\n print(max_res)\n\n \n\nif __name__==\"__main__\":\n\n main()","target":"from sys import stdin\n\ndef main():\n\n #\u5165\u529b\n\n readline=stdin.readline\n\n N=int(readline())\n\n F=[]\n\n for i in range(N):\n\n f=int(\"\".join(readline().strip().split(\" \")),2)\n\n F.append(f)\n\n P=[]\n\n for i in range(N):\n\n p=list(map(int,readline().split()))\n\n P.append(p)\n\n \n\n max_res=float(\"-inf\")\n\n for output in range(1,1<<10):\n\n res=0\n\n for j in range(N):\n\n c=bin(output&F[j]).count(\"1\")\n\n res+=P[j][c]\n\n max_res=max(res,max_res)\n\n\n\n print(max_res)\n\n \n\nif __name__==\"__main__\":\n\n main()","code_v0_loc":41,"code_v1_loc":26,"code_v0_num_chars":966,"code_v1_num_chars":587,"code_v0_no_empty_lines":"from sys import stdin\n\n\ndef main():\n # \u5165\u529b\n readline = stdin.readline\n N = int(readline())\n F = []\n for i in range(N):\n f = list(map(int, readline().split()))\n F.append(f)\n P = []\n for i in range(N):\n p = list(map(int, readline().split()))\n P.append(p)\n max_res = -float(\"inf\")\n for i in range(1 << 10):\n if i == 0:\n continue\n else:\n output = []\n for j in range(10):\n if (i >> j) & 1:\n output.append(j)\n oc = [0] * 10 # open or close\n for j in output:\n oc[j] = 1\n res = 0\n for j in range(N):\n c = 0\n for k in range(10):\n if oc[k] == 1 and F[j][k] == 1:\n c += 1\n res += P[j][c]\n max_res = max(res, max_res)\n print(max_res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from sys import stdin\n\n\ndef main():\n # \u5165\u529b\n readline = stdin.readline\n N = int(readline())\n F = []\n for i in range(N):\n f = int(\"\".join(readline().strip().split(\" \")), 2)\n F.append(f)\n P = []\n for i in range(N):\n p = list(map(int, readline().split()))\n P.append(p)\n max_res = float(\"-inf\")\n for output in range(1, 1 << 10):\n res = 0\n for j in range(N):\n c = bin(output & F[j]).count(\"1\")\n res += P[j][c]\n max_res = max(res, max_res)\n print(max_res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":36.5853658537,"diff":["- f = list(map(int, readline().split()))","+ f = int(\"\".join(readline().strip().split(\" \")), 2)","- max_res = -float(\"inf\")","- for i in range(1 << 10):","- if i == 0:","- continue","- else:","- output = []","- for j in range(10):","- if (i >> j) & 1:","- output.append(j)","- oc = [0] * 10 # open or close","- for j in output:","- oc[j] = 1","- res = 0","- for j in range(N):","- c = 0","- for k in range(10):","- if oc[k] == 1 and F[j][k] == 1:","- c += 1","- res += P[j][c]","- max_res = max(res, max_res)","+ max_res = float(\"-inf\")","+ for output in range(1, 1 << 10):","+ res = 0","+ for j in range(N):","+ c = bin(output & F[j]).count(\"1\")","+ res += P[j][c]","+ max_res = max(res, max_res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1029294124,"measured_runtime_v1":0.0493940351,"runtime_lift":2.0838429607,"key":["s218087570","s406177717"]} +{"user_id":"u935585974","problem_id":"p02881","language":"python","submission_id_v0":"s814237424","submission_id_v1":"s024124233","cpu_time_v0":166,"cpu_time_v1":146,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.05,"input":"N = int(eval(input()))\n\nList_ans = []\n\n\n\nfor i in range(1, int(N**(1\/2))+1):\n\n if N % i == 0:\n\n List_ans.append(i)\n\n \n\nx = max(List_ans)\n\ny = N\/\/x\n\n\n\nAns = (x-1) + (y-1)\n\nprint(Ans)","target":"import math\n\n\n\nN = int(eval(input()))\n\nroot_N = int(math.sqrt(N)) + 1\n\nA = 100000000000000000000000000000000000\n\n\n\nfor i in range(1, root_N):\n\n if N % i == 0:\n\n B = N\/\/i\n\n A = min(A, B)\n\n\n\nans_1 = A\n\nans_2 = N\/\/A\n\nans = ((ans_1)-1) + ((ans_2)-1)\n\n\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":16,"code_v0_num_chars":193,"code_v1_num_chars":270,"code_v0_no_empty_lines":"N = int(eval(input()))\nList_ans = []\nfor i in range(1, int(N ** (1 \/ 2)) + 1):\n if N % i == 0:\n List_ans.append(i)\nx = max(List_ans)\ny = N \/\/ x\nAns = (x - 1) + (y - 1)\nprint(Ans)\n","code_v1_no_empty_lines":"import math\n\nN = int(eval(input()))\nroot_N = int(math.sqrt(N)) + 1\nA = 100000000000000000000000000000000000\nfor i in range(1, root_N):\n if N % i == 0:\n B = N \/\/ i\n A = min(A, B)\nans_1 = A\nans_2 = N \/\/ A\nans = ((ans_1) - 1) + ((ans_2) - 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["+import math","+","-List_ans = []","-for i in range(1, int(N ** (1 \/ 2)) + 1):","+root_N = int(math.sqrt(N)) + 1","+A = 100000000000000000000000000000000000","+for i in range(1, root_N):","- List_ans.append(i)","-x = max(List_ans)","-y = N \/\/ x","-Ans = (x - 1) + (y - 1)","-print(Ans)","+ B = N \/\/ i","+ A = min(A, B)","+ans_1 = A","+ans_2 = N \/\/ A","+ans = ((ans_1) - 1) + ((ans_2) - 1)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0534331765,"measured_runtime_v1":0.0549898047,"runtime_lift":0.9716924211,"key":["s814237424","s024124233"]} +{"user_id":"u359358631","problem_id":"p02714","language":"python","submission_id_v0":"s251578992","submission_id_v1":"s684889523","cpu_time_v0":514,"cpu_time_v1":194,"memory_v0":73920,"memory_v1":73208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.26,"input":"def main():\n\n n = int(eval(input()))\n\n s = eval(input())\n\n r_set, g_set, b_set = set(), set(), set()\n\n\n\n for i, c in enumerate(s):\n\n if c == \"R\":\n\n r_set.add(i)\n\n elif c == \"G\":\n\n g_set.add(i)\n\n elif c == \"B\":\n\n b_set.add(i)\n\n\n\n cnt = 0\n\n for i in range(n):\n\n for j in range(i + 1, n):\n\n k = 2 * j - i\n\n\n\n if i in r_set and j in g_set and k in b_set:\n\n cnt += 1\n\n elif i in r_set and j in b_set and k in g_set:\n\n cnt += 1\n\n elif i in g_set and j in r_set and k in b_set:\n\n cnt += 1\n\n elif i in g_set and j in b_set and k in r_set:\n\n cnt += 1\n\n elif i in b_set and j in r_set and k in g_set:\n\n cnt += 1\n\n elif i in b_set and j in g_set and k in r_set:\n\n cnt += 1\n\n\n\n print((len(r_set) * len(g_set) * len(b_set) - cnt))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"def main():\n\n n = int(eval(input()))\n\n s = eval(input())\n\n r_set, g_set, b_set = set(), set(), set()\n\n\n\n for i, c in enumerate(s):\n\n if c == \"R\":\n\n r_set.add(i)\n\n elif c == \"G\":\n\n g_set.add(i)\n\n elif c == \"B\":\n\n b_set.add(i)\n\n\n\n cnt = 0\n\n for i in range(n):\n\n for j in range(i + 1, n):\n\n k = 2 * j - i\n\n if k >= n:\n\n continue\n\n if s[i] == s[j] or s[j] == s[k] or s[k] == s[i]:\n\n continue\n\n cnt += 1\n\n\n\n print((len(r_set) * len(g_set) * len(b_set) - cnt))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":36,"code_v1_loc":28,"code_v0_num_chars":997,"code_v1_num_chars":641,"code_v0_no_empty_lines":"def main():\n n = int(eval(input()))\n s = eval(input())\n r_set, g_set, b_set = set(), set(), set()\n for i, c in enumerate(s):\n if c == \"R\":\n r_set.add(i)\n elif c == \"G\":\n g_set.add(i)\n elif c == \"B\":\n b_set.add(i)\n cnt = 0\n for i in range(n):\n for j in range(i + 1, n):\n k = 2 * j - i\n if i in r_set and j in g_set and k in b_set:\n cnt += 1\n elif i in r_set and j in b_set and k in g_set:\n cnt += 1\n elif i in g_set and j in r_set and k in b_set:\n cnt += 1\n elif i in g_set and j in b_set and k in r_set:\n cnt += 1\n elif i in b_set and j in r_set and k in g_set:\n cnt += 1\n elif i in b_set and j in g_set and k in r_set:\n cnt += 1\n print((len(r_set) * len(g_set) * len(b_set) - cnt))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n s = eval(input())\n r_set, g_set, b_set = set(), set(), set()\n for i, c in enumerate(s):\n if c == \"R\":\n r_set.add(i)\n elif c == \"G\":\n g_set.add(i)\n elif c == \"B\":\n b_set.add(i)\n cnt = 0\n for i in range(n):\n for j in range(i + 1, n):\n k = 2 * j - i\n if k >= n:\n continue\n if s[i] == s[j] or s[j] == s[k] or s[k] == s[i]:\n continue\n cnt += 1\n print((len(r_set) * len(g_set) * len(b_set) - cnt))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["- if i in r_set and j in g_set and k in b_set:","- cnt += 1","- elif i in r_set and j in b_set and k in g_set:","- cnt += 1","- elif i in g_set and j in r_set and k in b_set:","- cnt += 1","- elif i in g_set and j in b_set and k in r_set:","- cnt += 1","- elif i in b_set and j in r_set and k in g_set:","- cnt += 1","- elif i in b_set and j in g_set and k in r_set:","- cnt += 1","+ if k >= n:","+ continue","+ if s[i] == s[j] or s[j] == s[k] or s[k] == s[i]:","+ continue","+ cnt += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.131819672,"measured_runtime_v1":0.11874853,"runtime_lift":1.1100741376,"key":["s251578992","s684889523"]} +{"user_id":"u254871849","problem_id":"p02791","language":"python","submission_id_v0":"s319842266","submission_id_v1":"s424464360","cpu_time_v0":91,"cpu_time_v1":81,"memory_v0":25116,"memory_v1":25116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.99,"input":"import sys\n\n\n\nn, *p = list(map(int, sys.stdin.read().split()))\n\n\n\ndef main():\n\n mi = float('inf')\n\n res = 0\n\n for i in range(n):\n\n if p[i] <= mi:\n\n res += 1\n\n mi = p[i]\n\n return res\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","target":"import sys\n\n\n\nn, *p = list(map(int, sys.stdin.read().split()))\n\n\n\ndef main():\n\n m = float('inf')\n\n cnt = 0\n\n for x in p:\n\n if x > m: continue\n\n cnt += 1\n\n m = x\n\n print(cnt)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":280,"code_v1_num_chars":243,"code_v0_no_empty_lines":"import sys\n\nn, *p = list(map(int, sys.stdin.read().split()))\n\n\ndef main():\n mi = float(\"inf\")\n res = 0\n for i in range(n):\n if p[i] <= mi:\n res += 1\n mi = p[i]\n return res\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_v1_no_empty_lines":"import sys\n\nn, *p = list(map(int, sys.stdin.read().split()))\n\n\ndef main():\n m = float(\"inf\")\n cnt = 0\n for x in p:\n if x > m:\n continue\n cnt += 1\n m = x\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["- mi = float(\"inf\")","- res = 0","- for i in range(n):","- if p[i] <= mi:","- res += 1","- mi = p[i]","- return res","+ m = float(\"inf\")","+ cnt = 0","+ for x in p:","+ if x > m:","+ continue","+ cnt += 1","+ m = x","+ print(cnt)","- ans = main()","- print(ans)","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0085840144,"measured_runtime_v1":0.042969461,"runtime_lift":0.1997701206,"key":["s319842266","s424464360"]} +{"user_id":"u922449550","problem_id":"p03111","language":"python","submission_id_v0":"s991502004","submission_id_v1":"s191087055","cpu_time_v0":1110,"cpu_time_v1":269,"memory_v0":3828,"memory_v1":10996,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.77,"input":"import itertools\n\n\n\nN, A, B, C = list(map(int, input().split()))\n\nL = [int(eval(input())) for i in range(N)]\n\n\n\ndef min_cost(target, l_list):\n\n if target in l_list:\n\n return 0\n\n else:\n\n res = 1000\n\n for l in l_list:\n\n res = min(res, abs(target - l))\n\n \n\n for i, l in enumerate(l_list):\n\n res = min(res, min_cost(target-l, l_list[:i]+l_list[i+1:]) + 10)\n\n \n\n return res\n\n\n\nans = 1000 * 3\n\ncombs = list(itertools.product([0, 1, 2], repeat=N))\n\nfor comb in combs:\n\n labc = [[], [], []]\n\n for i, idx in enumerate(comb):\n\n labc[idx].append(L[i])\n\n \n\n la, lb, lc = labc\n\n if len(la)*len(lb)*len(lc):\n\n ans = min(ans, min_cost(A, la)+min_cost(B, lb)+min_cost(C, lc))\n\n\n\nprint(ans)","target":"import itertools\n\n\n\nN, A, B, C = list(map(int, input().split()))\n\nL = [int(eval(input())) for i in range(N)]\n\n\n\ndef min_cost(target, l_list):\n\n return 10*(len(l_list) - 1) + abs(target - sum(l_list))\n\n\n\n\n\nans = 1000 * 3\n\ncombs = list(itertools.product([0, 1, 2, 3], repeat=N))\n\nfor comb in combs:\n\n labcn = [[], [], [], []]\n\n for i, idx in enumerate(comb):\n\n labcn[idx].append(L[i])\n\n \n\n la, lb, lc, ln = labcn\n\n if len(la)*len(lb)*len(lc):\n\n ans = min(ans, min_cost(A, la)+min_cost(B, lb)+min_cost(C, lc))\n\n\n\nprint(ans)","code_v0_loc":30,"code_v1_loc":21,"code_v0_num_chars":703,"code_v1_num_chars":520,"code_v0_no_empty_lines":"import itertools\n\nN, A, B, C = list(map(int, input().split()))\nL = [int(eval(input())) for i in range(N)]\n\n\ndef min_cost(target, l_list):\n if target in l_list:\n return 0\n else:\n res = 1000\n for l in l_list:\n res = min(res, abs(target - l))\n for i, l in enumerate(l_list):\n res = min(res, min_cost(target - l, l_list[:i] + l_list[i + 1 :]) + 10)\n return res\n\n\nans = 1000 * 3\ncombs = list(itertools.product([0, 1, 2], repeat=N))\nfor comb in combs:\n labc = [[], [], []]\n for i, idx in enumerate(comb):\n labc[idx].append(L[i])\n la, lb, lc = labc\n if len(la) * len(lb) * len(lc):\n ans = min(ans, min_cost(A, la) + min_cost(B, lb) + min_cost(C, lc))\nprint(ans)\n","code_v1_no_empty_lines":"import itertools\n\nN, A, B, C = list(map(int, input().split()))\nL = [int(eval(input())) for i in range(N)]\n\n\ndef min_cost(target, l_list):\n return 10 * (len(l_list) - 1) + abs(target - sum(l_list))\n\n\nans = 1000 * 3\ncombs = list(itertools.product([0, 1, 2, 3], repeat=N))\nfor comb in combs:\n labcn = [[], [], [], []]\n for i, idx in enumerate(comb):\n labcn[idx].append(L[i])\n la, lb, lc, ln = labcn\n if len(la) * len(lb) * len(lc):\n ans = min(ans, min_cost(A, la) + min_cost(B, lb) + min_cost(C, lc))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["- if target in l_list:","- return 0","- else:","- res = 1000","- for l in l_list:","- res = min(res, abs(target - l))","- for i, l in enumerate(l_list):","- res = min(res, min_cost(target - l, l_list[:i] + l_list[i + 1 :]) + 10)","- return res","+ return 10 * (len(l_list) - 1) + abs(target - sum(l_list))","-combs = list(itertools.product([0, 1, 2], repeat=N))","+combs = list(itertools.product([0, 1, 2, 3], repeat=N))","- labc = [[], [], []]","+ labcn = [[], [], [], []]","- labc[idx].append(L[i])","- la, lb, lc = labc","+ labcn[idx].append(L[i])","+ la, lb, lc, ln = labcn"],"diff_only_import_comment":false,"measured_runtime_v0":0.7181894557,"measured_runtime_v1":0.3141553867,"runtime_lift":2.2860962637,"key":["s991502004","s191087055"]} +{"user_id":"u580697892","problem_id":"p02727","language":"python","submission_id_v0":"s170838224","submission_id_v1":"s765259236","cpu_time_v0":368,"cpu_time_v1":280,"memory_v0":108268,"memory_v1":23328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.91,"input":"# coding: utf-8\n\nX, Y, A, B, C = list(map(int, input().split()))\n\nP = list(map(int, input().split()))\n\nQ = list(map(int, input().split()))\n\nR = list(map(int, input().split()))\n\nP.sort(reverse=True)\n\nQ.sort(reverse=True)\n\nR.sort(reverse=True)\n\nans = 0\n\nL = P[:X] + Q[:Y]\n\nRt = [False for _ in range(C)]\n\nL.sort()\n\nidx = 0\n\nfor i in range(X+Y):\n\n if idx >= C:\n\n break\n\n if L[i] < R[idx]:\n\n L[i] = R[idx]\n\n idx += 1\n\nprint((sum(L)))","target":"# coding: utf-8\n\nX, Y, A, B, C = list(map(int, input().split()))\n\nP = list(map(int, input().split()))\n\nQ = list(map(int, input().split()))\n\nR = list(map(int, input().split()))\n\nP.sort(reverse=True)\n\nQ.sort(reverse=True)\n\nR.sort(reverse=True)\n\nans = 0\n\nL = P[:X] + Q[:Y]\n\nL.sort()\n\nidx = 0\n\nfor i in range(X+Y):\n\n if idx >= C:\n\n break\n\n if L[i] < R[idx]:\n\n L[i] = R[idx]\n\n idx += 1\n\nprint((sum(L)))","code_v0_loc":20,"code_v1_loc":19,"code_v0_num_chars":448,"code_v1_num_chars":416,"code_v0_no_empty_lines":"# coding: utf-8\nX, Y, A, B, C = list(map(int, input().split()))\nP = list(map(int, input().split()))\nQ = list(map(int, input().split()))\nR = list(map(int, input().split()))\nP.sort(reverse=True)\nQ.sort(reverse=True)\nR.sort(reverse=True)\nans = 0\nL = P[:X] + Q[:Y]\nRt = [False for _ in range(C)]\nL.sort()\nidx = 0\nfor i in range(X + Y):\n if idx >= C:\n break\n if L[i] < R[idx]:\n L[i] = R[idx]\n idx += 1\nprint((sum(L)))\n","code_v1_no_empty_lines":"# coding: utf-8\nX, Y, A, B, C = list(map(int, input().split()))\nP = list(map(int, input().split()))\nQ = list(map(int, input().split()))\nR = list(map(int, input().split()))\nP.sort(reverse=True)\nQ.sort(reverse=True)\nR.sort(reverse=True)\nans = 0\nL = P[:X] + Q[:Y]\nL.sort()\nidx = 0\nfor i in range(X + Y):\n if idx >= C:\n break\n if L[i] < R[idx]:\n L[i] = R[idx]\n idx += 1\nprint((sum(L)))\n","code_same":false,"relative_loc_diff_percent":5.0,"diff":["-Rt = [False for _ in range(C)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370173056,"measured_runtime_v1":0.0375056672,"runtime_lift":0.9869789916,"key":["s170838224","s765259236"]} +{"user_id":"u644572490","problem_id":"p02388","language":"python","submission_id_v0":"s343095821","submission_id_v1":"s910445936","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":5572,"memory_v1":4624,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"x = eval(input())\n\nprint((int(x)**3))\n\n\n","target":"n = int(eval(input()))\n\nprint((n*n*n))\n","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":32,"code_v1_num_chars":31,"code_v0_no_empty_lines":"x = eval(input())\nprint((int(x) ** 3))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nprint((n * n * n))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-x = eval(input())","-print((int(x) ** 3))","+n = int(eval(input()))","+print((n * n * n))"],"diff_only_import_comment":false,"measured_runtime_v0":0.039571476,"measured_runtime_v1":0.0457489491,"runtime_lift":0.8649701642,"key":["s343095821","s910445936"]} +{"user_id":"u340781749","problem_id":"p02844","language":"python","submission_id_v0":"s473416876","submission_id_v1":"s867713417","cpu_time_v0":730,"cpu_time_v1":28,"memory_v0":3188,"memory_v1":4456,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":96.16,"input":"n = int(eval(input()))\n\ns = eval(input())\n\nd1 = set()\n\nd2 = set()\n\nd3 = set()\n\nfor c in s:\n\n for t in d2:\n\n d3.add(t + c)\n\n for t in d1:\n\n d2.add(t + c)\n\n d1.add(c)\n\nprint((len(d3)))\n","target":"from bisect import bisect\n\n\n\nn = int(eval(input()))\n\ns = eval(input())\n\nlocation = [[] for _ in range(10)]\n\nfor i, c in enumerate(map(int, s)):\n\n location[c].append(i)\n\nlocation = [loc for loc in location if loc]\n\nlast_indices = [loc[-1] for loc in location]\n\n\n\nans = 0\n\nfor loc_x in location:\n\n i = loc_x[0]\n\n for loc_y in location:\n\n ji = bisect(loc_y, i)\n\n if ji >= len(loc_y):\n\n continue\n\n j = loc_y[ji]\n\n ans += sum(j < li for li in last_indices)\n\nprint(ans)\n","code_v0_loc":12,"code_v1_loc":20,"code_v0_num_chars":192,"code_v1_num_chars":500,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\nd1 = set()\nd2 = set()\nd3 = set()\nfor c in s:\n for t in d2:\n d3.add(t + c)\n for t in d1:\n d2.add(t + c)\n d1.add(c)\nprint((len(d3)))\n","code_v1_no_empty_lines":"from bisect import bisect\n\nn = int(eval(input()))\ns = eval(input())\nlocation = [[] for _ in range(10)]\nfor i, c in enumerate(map(int, s)):\n location[c].append(i)\nlocation = [loc for loc in location if loc]\nlast_indices = [loc[-1] for loc in location]\nans = 0\nfor loc_x in location:\n i = loc_x[0]\n for loc_y in location:\n ji = bisect(loc_y, i)\n if ji >= len(loc_y):\n continue\n j = loc_y[ji]\n ans += sum(j < li for li in last_indices)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["+from bisect import bisect","+","-d1 = set()","-d2 = set()","-d3 = set()","-for c in s:","- for t in d2:","- d3.add(t + c)","- for t in d1:","- d2.add(t + c)","- d1.add(c)","-print((len(d3)))","+location = [[] for _ in range(10)]","+for i, c in enumerate(map(int, s)):","+ location[c].append(i)","+location = [loc for loc in location if loc]","+last_indices = [loc[-1] for loc in location]","+ans = 0","+for loc_x in location:","+ i = loc_x[0]","+ for loc_y in location:","+ ji = bisect(loc_y, i)","+ if ji >= len(loc_y):","+ continue","+ j = loc_y[ji]","+ ans += sum(j < li for li in last_indices)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0362785602,"measured_runtime_v1":0.0353144741,"runtime_lift":1.0273000256,"key":["s473416876","s867713417"]} +{"user_id":"u086503932","problem_id":"p02773","language":"python","submission_id_v0":"s218135085","submission_id_v1":"s805711657","cpu_time_v0":853,"cpu_time_v1":573,"memory_v0":46932,"memory_v1":161784,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.83,"input":"N=int(input())\n\nd={}\n\nfor i in range(N):\n\n tmp = input()\n\n if tmp in d:\n\n d[tmp] += 1\n\n else:\n\n d[tmp] = 1\n\n\n\nmax_v=max(d.values())\n\nans=list(filter(lambda x: x[1] == max_v, d.items()))\n\n[print(i[0]) for i in sorted(ans)]\n","target":"from collections import Counter\n\n\n\nN = int(eval(input()))\n\nS = [eval(input()) for _ in range(N)]\n\nl = Counter(S)\n\nMAXNUM = max(l.values())\n\n\n\nfor s in sorted(list(set(S))):\n\n if l[s] == MAXNUM:\n\n print(s)","code_v0_loc":12,"code_v1_loc":10,"code_v0_num_chars":230,"code_v1_num_chars":202,"code_v0_no_empty_lines":"N = int(input())\nd = {}\nfor i in range(N):\n tmp = input()\n if tmp in d:\n d[tmp] += 1\n else:\n d[tmp] = 1\nmax_v = max(d.values())\nans = list(filter(lambda x: x[1] == max_v, d.items()))\n[print(i[0]) for i in sorted(ans)]\n","code_v1_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\nS = [eval(input()) for _ in range(N)]\nl = Counter(S)\nMAXNUM = max(l.values())\nfor s in sorted(list(set(S))):\n if l[s] == MAXNUM:\n print(s)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-N = int(input())","-d = {}","-for i in range(N):","- tmp = input()","- if tmp in d:","- d[tmp] += 1","- else:","- d[tmp] = 1","-max_v = max(d.values())","-ans = list(filter(lambda x: x[1] == max_v, d.items()))","-[print(i[0]) for i in sorted(ans)]","+from collections import Counter","+","+N = int(eval(input()))","+S = [eval(input()) for _ in range(N)]","+l = Counter(S)","+MAXNUM = max(l.values())","+for s in sorted(list(set(S))):","+ if l[s] == MAXNUM:","+ print(s)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0405672648,"measured_runtime_v1":0.0400820677,"runtime_lift":1.0121050905,"key":["s218135085","s805711657"]} +{"user_id":"u360116509","problem_id":"p03436","language":"python","submission_id_v0":"s789960529","submission_id_v1":"s516233529","cpu_time_v0":332,"cpu_time_v1":25,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.47,"input":"H, W = map(int, input().split())\n\nS = [list(input()) for _ in range(H)]\n\n\n\n\n\ndef bfs():\n\n q = [(0, 0, 1)]\n\n m = []\n\n while len(q) > 0:\n\n x, y, c = q.pop(0)\n\n for xx, yy in [(x + 1, y), (x, y + 1), (x - 1, y), (x, y - 1)]:\n\n if (H, W) == (yy + 1, xx + 1):\n\n return c + 1\n\n if 0 <= yy < H and 0 <= xx < W and S[yy][xx] == '.' and \\\n\n (xx, yy) not in m:\n\n m.append((xx, yy))\n\n q.append((xx, yy, c + 1))\n\n return -1\n\n\n\n\n\ndef main():\n\n dc = 0\n\n for i in range(H):\n\n for j in range(W):\n\n if S[i][j] == '.':\n\n dc += 1\n\n c = bfs()\n\n if c == -1:\n\n print(-1)\n\n else:\n\n print(dc - c)\n\n\n\n\n\nmain()\n","target":"H, W = map(int, input().split())\n\nS = [input() for _ in range(H)]\n\n\n\n\n\ndef bfs():\n\n q = [(0, 0, 1)]\n\n m = [[0 for _ in range(W)] for _ in range(H)]\n\n while len(q) > 0:\n\n x, y, c = q.pop(0)\n\n for xx, yy in [(x + 1, y), (x, y + 1), (x - 1, y), (x, y - 1)]:\n\n if (H, W) == (yy + 1, xx + 1):\n\n return c + 1\n\n if 0 <= yy < H and 0 <= xx < W and S[yy][xx] == '.' and \\\n\n m[yy][xx] == 0:\n\n q.append((xx, yy, c + 1))\n\n m[yy][xx] = 1\n\n return -1\n\n\n\n\n\ndef main():\n\n dc = 0\n\n for i in range(H):\n\n dc += S[i].count('.')\n\n c = bfs()\n\n if c == -1:\n\n print(-1)\n\n else:\n\n print(dc - c)\n\n\n\n\n\nmain()\n","code_v0_loc":33,"code_v1_loc":31,"code_v0_num_chars":759,"code_v1_num_chars":730,"code_v0_no_empty_lines":"H, W = map(int, input().split())\nS = [list(input()) for _ in range(H)]\n\n\ndef bfs():\n q = [(0, 0, 1)]\n m = []\n while len(q) > 0:\n x, y, c = q.pop(0)\n for xx, yy in [(x + 1, y), (x, y + 1), (x - 1, y), (x, y - 1)]:\n if (H, W) == (yy + 1, xx + 1):\n return c + 1\n if 0 <= yy < H and 0 <= xx < W and S[yy][xx] == \".\" and (xx, yy) not in m:\n m.append((xx, yy))\n q.append((xx, yy, c + 1))\n return -1\n\n\ndef main():\n dc = 0\n for i in range(H):\n for j in range(W):\n if S[i][j] == \".\":\n dc += 1\n c = bfs()\n if c == -1:\n print(-1)\n else:\n print(dc - c)\n\n\nmain()\n","code_v1_no_empty_lines":"H, W = map(int, input().split())\nS = [input() for _ in range(H)]\n\n\ndef bfs():\n q = [(0, 0, 1)]\n m = [[0 for _ in range(W)] for _ in range(H)]\n while len(q) > 0:\n x, y, c = q.pop(0)\n for xx, yy in [(x + 1, y), (x, y + 1), (x - 1, y), (x, y - 1)]:\n if (H, W) == (yy + 1, xx + 1):\n return c + 1\n if 0 <= yy < H and 0 <= xx < W and S[yy][xx] == \".\" and m[yy][xx] == 0:\n q.append((xx, yy, c + 1))\n m[yy][xx] = 1\n return -1\n\n\ndef main():\n dc = 0\n for i in range(H):\n dc += S[i].count(\".\")\n c = bfs()\n if c == -1:\n print(-1)\n else:\n print(dc - c)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":6.0606060606,"diff":["-S = [list(input()) for _ in range(H)]","+S = [input() for _ in range(H)]","- m = []","+ m = [[0 for _ in range(W)] for _ in range(H)]","- if 0 <= yy < H and 0 <= xx < W and S[yy][xx] == \".\" and (xx, yy) not in m:","- m.append((xx, yy))","+ if 0 <= yy < H and 0 <= xx < W and S[yy][xx] == \".\" and m[yy][xx] == 0:","+ m[yy][xx] = 1","- for j in range(W):","- if S[i][j] == \".\":","- dc += 1","+ dc += S[i].count(\".\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0757282319,"measured_runtime_v1":0.0354941518,"runtime_lift":2.1335411041,"key":["s789960529","s516233529"]} +{"user_id":"u395816772","problem_id":"p03476","language":"python","submission_id_v0":"s474333282","submission_id_v1":"s368390721","cpu_time_v0":720,"cpu_time_v1":503,"memory_v0":19172,"memory_v1":38264,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.14,"input":"q = int(eval(input()))\n\nl, r = [0] * q, [0] * q\n\nfor i in range(q):\n\n l[i], r[i] = list(map(int, input().split()))\n\n \n\nmini = min(min(l), min(r))\n\nmaxi = max(max(l), max(r))\n\nans = [0] * (maxi + 1)\n\nprime = [0] * (maxi + 1)\n\ndef judge_prime(n):\n\n for i in range(2, int(n ** 0.5) + 1):\n\n if n % i == 0:\n\n return False\n\n \n\n return True if n != 1 else False\n\n \n\nfor i in range((mini + 1) \/\/ 2, maxi + 1):\n\n prime[i] = judge_prime(i)\n\n \n\nfor i in range(mini, maxi + 1, 2):\n\n ans[i] = ans[i - 2] + 1 if prime[i] and prime[(i + 1) \/\/ 2] else ans[i - 2]\n\nfor i in range(q):\n\n print((ans[r[i]] - ans[max(0, l[i] - 2)]))","target":"import math\n\nimport numpy as np\n\ndef get_prime(n):\n\n if n<= 1:\n\n return[]\n\n prime = [2]\n\n limit = int(math.sqrt(n))\n\n \n\n data = [i + 1 for i in range(2,n,2)]\n\n while limit > data[0]:\n\n prime.append(data[0])\n\n data = [j for j in data if j % data[0] != 0]\n\n return prime + data\n\ndef is_prime(n):\n\n if n == 1: return False\n\n\n\n for k in range(2, int(math.sqrt(n)) + 1):\n\n if n % k == 0:\n\n return False\n\n\n\n return True\n\nn = int(eval(input()))\n\nl = []\n\nr = []\n\nfor i in range(n):\n\n l_, r_ =list(map(int,input().split()))\n\n l.append(l_)\n\n r.append(r_)\n\na = get_prime(10**5+1)\n\nb = np.array([0]*(10**5+2))\n\nc =0\n\nd = 0\n\nadd = 0\n\nfor i in range(1,len(a)):\n\n if is_prime((a[i]+1)\/2):\n\n d = a[i] \n\n b[c:d] = add \n\n c = d\n\n add +=1\n\nb[c:] = add \n\nb[0::2] = 0\n\nfor i in range(n):\n\n e = b[max(0, l[i] - 2)]\n\n f = b[r[i]]\n\n print((f - e))","code_v0_loc":23,"code_v1_loc":45,"code_v0_num_chars":636,"code_v1_num_chars":927,"code_v0_no_empty_lines":"q = int(eval(input()))\nl, r = [0] * q, [0] * q\nfor i in range(q):\n l[i], r[i] = list(map(int, input().split()))\nmini = min(min(l), min(r))\nmaxi = max(max(l), max(r))\nans = [0] * (maxi + 1)\nprime = [0] * (maxi + 1)\n\n\ndef judge_prime(n):\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n return True if n != 1 else False\n\n\nfor i in range((mini + 1) \/\/ 2, maxi + 1):\n prime[i] = judge_prime(i)\nfor i in range(mini, maxi + 1, 2):\n ans[i] = ans[i - 2] + 1 if prime[i] and prime[(i + 1) \/\/ 2] else ans[i - 2]\nfor i in range(q):\n print((ans[r[i]] - ans[max(0, l[i] - 2)]))\n","code_v1_no_empty_lines":"import math\nimport numpy as np\n\n\ndef get_prime(n):\n if n <= 1:\n return []\n prime = [2]\n limit = int(math.sqrt(n))\n data = [i + 1 for i in range(2, n, 2)]\n while limit > data[0]:\n prime.append(data[0])\n data = [j for j in data if j % data[0] != 0]\n return prime + data\n\n\ndef is_prime(n):\n if n == 1:\n return False\n for k in range(2, int(math.sqrt(n)) + 1):\n if n % k == 0:\n return False\n return True\n\n\nn = int(eval(input()))\nl = []\nr = []\nfor i in range(n):\n l_, r_ = list(map(int, input().split()))\n l.append(l_)\n r.append(r_)\na = get_prime(10**5 + 1)\nb = np.array([0] * (10**5 + 2))\nc = 0\nd = 0\nadd = 0\nfor i in range(1, len(a)):\n if is_prime((a[i] + 1) \/ 2):\n d = a[i]\n b[c:d] = add\n c = d\n add += 1\nb[c:] = add\nb[0::2] = 0\nfor i in range(n):\n e = b[max(0, l[i] - 2)]\n f = b[r[i]]\n print((f - e))\n","code_same":false,"relative_loc_diff_percent":48.8888888889,"diff":["-q = int(eval(input()))","-l, r = [0] * q, [0] * q","-for i in range(q):","- l[i], r[i] = list(map(int, input().split()))","-mini = min(min(l), min(r))","-maxi = max(max(l), max(r))","-ans = [0] * (maxi + 1)","-prime = [0] * (maxi + 1)","+import math","+import numpy as np","-def judge_prime(n):","- for i in range(2, int(n**0.5) + 1):","- if n % i == 0:","- return False","- return True if n != 1 else False","+def get_prime(n):","+ if n <= 1:","+ return []","+ prime = [2]","+ limit = int(math.sqrt(n))","+ data = [i + 1 for i in range(2, n, 2)]","+ while limit > data[0]:","+ prime.append(data[0])","+ data = [j for j in data if j % data[0] != 0]","+ return prime + data","-for i in range((mini + 1) \/\/ 2, maxi + 1):","- prime[i] = judge_prime(i)","-for i in range(mini, maxi + 1, 2):","- ans[i] = ans[i - 2] + 1 if prime[i] and prime[(i + 1) \/\/ 2] else ans[i - 2]","-for i in range(q):","- print((ans[r[i]] - ans[max(0, l[i] - 2)]))","+def is_prime(n):","+ if n == 1:","+ return False","+ for k in range(2, int(math.sqrt(n)) + 1):","+ if n % k == 0:","+ return False","+ return True","+","+","+n = int(eval(input()))","+l = []","+r = []","+for i in range(n):","+ l_, r_ = list(map(int, input().split()))","+ l.append(l_)","+ r.append(r_)","+a = get_prime(10**5 + 1)","+b = np.array([0] * (10**5 + 2))","+c = 0","+d = 0","+add = 0","+for i in range(1, len(a)):","+ if is_prime((a[i] + 1) \/ 2):","+ d = a[i]","+ b[c:d] = add","+ c = d","+ add += 1","+b[c:] = add","+b[0::2] = 0","+for i in range(n):","+ e = b[max(0, l[i] - 2)]","+ f = b[r[i]]","+ print((f - e))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0398237908,"measured_runtime_v1":0.6123450694,"runtime_lift":0.0650348844,"key":["s474333282","s368390721"]} +{"user_id":"u698693989","problem_id":"p02393","language":"python","submission_id_v0":"s463409697","submission_id_v1":"s612971979","cpu_time_v0":40,"cpu_time_v1":20,"memory_v0":7664,"memory_v1":7660,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"x=input().split()\n\ny=list(map(int,x))\n\na=y[0]\n\nb=y[1]\n\nc=y[2]\n\nd=sorted([a,b,c])\n\nprint((\"{0} {1} {2}\".format(d[0],d[1],d[2])))","target":"a,b,c=list(map(int,input().split()))\n\nd=[a,b,c]\n\nd.sort()\n\nprint((\"{0} {1} {2}\".format(d[0],d[1],d[2]))) ","code_v0_loc":7,"code_v1_loc":4,"code_v0_num_chars":125,"code_v1_num_chars":112,"code_v0_no_empty_lines":"x = input().split()\ny = list(map(int, x))\na = y[0]\nb = y[1]\nc = y[2]\nd = sorted([a, b, c])\nprint((\"{0} {1} {2}\".format(d[0], d[1], d[2])))\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nd = [a, b, c]\nd.sort()\nprint((\"{0} {1} {2}\".format(d[0], d[1], d[2])))\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-x = input().split()","-y = list(map(int, x))","-a = y[0]","-b = y[1]","-c = y[2]","-d = sorted([a, b, c])","+a, b, c = list(map(int, input().split()))","+d = [a, b, c]","+d.sort()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372247219,"measured_runtime_v1":0.037456131,"runtime_lift":0.9938218637,"key":["s463409697","s612971979"]} +{"user_id":"u648212584","problem_id":"p02793","language":"python","submission_id_v0":"s731540997","submission_id_v1":"s925871447","cpu_time_v0":1893,"cpu_time_v1":472,"memory_v0":5852,"memory_v1":4792,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.07,"input":"import sys\n\ninput = sys.stdin.buffer.readline\n\nimport fractions\n\nfrom functools import reduce\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n a = list(map(int,input().split()))\n\n MOD = 10**9+7\n\n \n\n def lcm(x,y):\n\n return((x*y)\/\/fractions.gcd(x,y))\n\n \n\n l = reduce(lcm,a)\n\n ans = 0\n\n for num in a:\n\n ans += l\/\/num\n\n \n\n print((ans%MOD))\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\nfrom collections import defaultdict\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n a = list(map(int,input().split()))\n\n MOD = 10**9+7\n\n \n\n d = defaultdict(int)\n\n \n\n for x in a:\n\n num = x\n\n count = 0\n\n while num%2 == 0:\n\n num \/\/= 2\n\n count += 1\n\n d[2] = max(d[2],count)\n\n for i in range(3,int(x**(1\/2))+1,2):\n\n if num%i == 0:\n\n count = 0\n\n while num%i == 0:\n\n num \/\/= i\n\n count += 1\n\n d[i] = max(d[i],count)\n\n if num != 1:\n\n d[num] = max(d[num],1)\n\n\n\n base = 1\n\n for x,y in list(d.items()):\n\n base *= pow(x,y,MOD)\n\n base %= MOD\n\n \n\n s = 0\n\n for num in a:\n\n inv_a = pow(num,MOD-2,MOD)\n\n s += inv_a\n\n s %= MOD\n\n \n\n print(((base*s)%MOD))\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":22,"code_v1_loc":43,"code_v0_num_chars":421,"code_v1_num_chars":958,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nimport fractions\nfrom functools import reduce\n\n\ndef main():\n N = int(eval(input()))\n a = list(map(int, input().split()))\n MOD = 10**9 + 7\n\n def lcm(x, y):\n return (x * y) \/\/ fractions.gcd(x, y)\n\n l = reduce(lcm, a)\n ans = 0\n for num in a:\n ans += l \/\/ num\n print((ans % MOD))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nfrom collections import defaultdict\n\n\ndef main():\n N = int(eval(input()))\n a = list(map(int, input().split()))\n MOD = 10**9 + 7\n d = defaultdict(int)\n for x in a:\n num = x\n count = 0\n while num % 2 == 0:\n num \/\/= 2\n count += 1\n d[2] = max(d[2], count)\n for i in range(3, int(x ** (1 \/ 2)) + 1, 2):\n if num % i == 0:\n count = 0\n while num % i == 0:\n num \/\/= i\n count += 1\n d[i] = max(d[i], count)\n if num != 1:\n d[num] = max(d[num], 1)\n base = 1\n for x, y in list(d.items()):\n base *= pow(x, y, MOD)\n base %= MOD\n s = 0\n for num in a:\n inv_a = pow(num, MOD - 2, MOD)\n s += inv_a\n s %= MOD\n print(((base * s) % MOD))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":48.8372093023,"diff":["-import fractions","-from functools import reduce","+from collections import defaultdict","-","- def lcm(x, y):","- return (x * y) \/\/ fractions.gcd(x, y)","-","- l = reduce(lcm, a)","- ans = 0","+ d = defaultdict(int)","+ for x in a:","+ num = x","+ count = 0","+ while num % 2 == 0:","+ num \/\/= 2","+ count += 1","+ d[2] = max(d[2], count)","+ for i in range(3, int(x ** (1 \/ 2)) + 1, 2):","+ if num % i == 0:","+ count = 0","+ while num % i == 0:","+ num \/\/= i","+ count += 1","+ d[i] = max(d[i], count)","+ if num != 1:","+ d[num] = max(d[num], 1)","+ base = 1","+ for x, y in list(d.items()):","+ base *= pow(x, y, MOD)","+ base %= MOD","+ s = 0","- ans += l \/\/ num","- print((ans % MOD))","+ inv_a = pow(num, MOD - 2, MOD)","+ s += inv_a","+ s %= MOD","+ print(((base * s) % MOD))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0441471977,"measured_runtime_v1":0.0600406847,"runtime_lift":0.7352880457,"key":["s731540997","s925871447"]} +{"user_id":"u950708010","problem_id":"p03426","language":"python","submission_id_v0":"s047757392","submission_id_v1":"s093032836","cpu_time_v0":343,"cpu_time_v1":296,"memory_v0":18524,"memory_v1":29476,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.7,"input":"from collections import deque\n\nimport sys\n\nsys.setrecursionlimit(10**7)\n\ninput = sys.stdin.readline\n\n\n\ndef solve():\n\n h,w,d = (int(i) for i in input().split())\n\n a = deque([])\n\n for i in range(h):\n\n tmp = list(int(i) for i in input().split())\n\n a.append(tmp)\n\n\n\n query = [False]*(h*w)\n\n distance = [0]*(h*w+1)\n\n for i in range(h):\n\n for j in range(w):\n\n query[a[i][j] - 1] = (i,j)\n\n q = int(eval(input()))\n\n \n\n for i in range(d,h*w):\n\n leftx,lefty = query[i-d]\n\n rightx,righty = query[i]\n\n distance[i] = distance[i-d]+abs(rightx-leftx)+abs(righty-lefty)\n\n #print(distance)\n\n\n\n for i in range(q):\n\n l,r = (int(m) for m in input().split())\n\n print((distance[r-1]-distance[l-1]))\n\n \n\nsolve()","target":"from collections import deque\n\nimport sys\n\nsys.setrecursionlimit(10**7)\n\ninput = sys.stdin.readline\n\n\n\ndef solve():\n\n h,w,d = (int(i) for i in input().split())\n\n a = deque([])\n\n for i in range(h):\n\n tmp = list(int(i) for i in input().split())\n\n a.append(tmp)\n\n\n\n query = [False]*(h*w)\n\n distance = [0]*(h*w+1)\n\n for i in range(h):\n\n for j in range(w):\n\n query[a[i][j] - 1] = (i,j)\n\n q = int(eval(input()))\n\n \n\n for i in range(d,h*w):\n\n leftx,lefty = query[i-d]\n\n rightx,righty = query[i]\n\n distance[i] = distance[i-d]+abs(rightx-leftx)+abs(righty-lefty)\n\n #print(distance)\n\n ans = []\n\n for i in range(q):\n\n l,r = (int(m) for m in input().split())\n\n ans.append(distance[r-1]-distance[l-1])\n\n print((\"\\n\".join(map(str,ans))))\n\nsolve()","code_v0_loc":30,"code_v1_loc":30,"code_v0_num_chars":724,"code_v1_num_chars":767,"code_v0_no_empty_lines":"from collections import deque\nimport sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\n\n\ndef solve():\n h, w, d = (int(i) for i in input().split())\n a = deque([])\n for i in range(h):\n tmp = list(int(i) for i in input().split())\n a.append(tmp)\n query = [False] * (h * w)\n distance = [0] * (h * w + 1)\n for i in range(h):\n for j in range(w):\n query[a[i][j] - 1] = (i, j)\n q = int(eval(input()))\n for i in range(d, h * w):\n leftx, lefty = query[i - d]\n rightx, righty = query[i]\n distance[i] = distance[i - d] + abs(rightx - leftx) + abs(righty - lefty)\n # print(distance)\n for i in range(q):\n l, r = (int(m) for m in input().split())\n print((distance[r - 1] - distance[l - 1]))\n\n\nsolve()\n","code_v1_no_empty_lines":"from collections import deque\nimport sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\n\n\ndef solve():\n h, w, d = (int(i) for i in input().split())\n a = deque([])\n for i in range(h):\n tmp = list(int(i) for i in input().split())\n a.append(tmp)\n query = [False] * (h * w)\n distance = [0] * (h * w + 1)\n for i in range(h):\n for j in range(w):\n query[a[i][j] - 1] = (i, j)\n q = int(eval(input()))\n for i in range(d, h * w):\n leftx, lefty = query[i - d]\n rightx, righty = query[i]\n distance[i] = distance[i - d] + abs(rightx - leftx) + abs(righty - lefty)\n # print(distance)\n ans = []\n for i in range(q):\n l, r = (int(m) for m in input().split())\n ans.append(distance[r - 1] - distance[l - 1])\n print((\"\\n\".join(map(str, ans))))\n\n\nsolve()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+ ans = []","- print((distance[r - 1] - distance[l - 1]))","+ ans.append(distance[r - 1] - distance[l - 1])","+ print((\"\\n\".join(map(str, ans))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0733956208,"measured_runtime_v1":0.0371427367,"runtime_lift":1.9760423538,"key":["s047757392","s093032836"]} +{"user_id":"u519939795","problem_id":"p03610","language":"python","submission_id_v0":"s584514066","submission_id_v1":"s860355155","cpu_time_v0":37,"cpu_time_v1":18,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.35,"input":"s = eval(input())\n\nans = \"\"\n\nfor i in range(len(s)):\n\n if i%2 == 0:\n\n ans = ans + s[i]\n\nprint(ans)","target":"s=eval(input())\n\nprint((s[0::2]))","code_v0_loc":6,"code_v1_loc":2,"code_v0_num_chars":102,"code_v1_num_chars":25,"code_v0_no_empty_lines":"s = eval(input())\nans = \"\"\nfor i in range(len(s)):\n if i % 2 == 0:\n ans = ans + s[i]\nprint(ans)\n","code_v1_no_empty_lines":"s = eval(input())\nprint((s[0::2]))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-ans = \"\"","-for i in range(len(s)):","- if i % 2 == 0:","- ans = ans + s[i]","-print(ans)","+print((s[0::2]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0085242271,"measured_runtime_v1":0.0404430389,"runtime_lift":0.2107711825,"key":["s584514066","s860355155"]} +{"user_id":"u863442865","problem_id":"p02820","language":"python","submission_id_v0":"s792408846","submission_id_v1":"s504467680","cpu_time_v0":261,"cpu_time_v1":50,"memory_v0":53488,"memory_v1":5052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.84,"input":"def main():\n\n import sys\n\n input = sys.stdin.readline\n\n sys.setrecursionlimit(10**7)\n\n from collections import Counter, deque\n\n #from collections import defaultdict\n\n from itertools import combinations, permutations, accumulate, groupby\n\n #from itertools import product\n\n from bisect import bisect_left,bisect_right\n\n from heapq import heapify, heappop, heappush\n\n from math import floor, ceil\n\n #from operator import itemgetter\n\n\n\n #inf = 10**17\n\n #mod = 10**9 + 7\n\n\n\n n,k = list(map(int, input().split()))\n\n s,p,r = list(map(int, input().split()))\n\n t = input().rstrip()\n\n hasi = []\n\n\n\n res = 0\n\n for i in range(n):\n\n if t[i]=='r':\n\n a = r\n\n b = 'p'\n\n if t[i]=='s':\n\n a = s\n\n b = 'r'\n\n if t[i]=='p':\n\n a = p\n\n b = 's'\n\n if it[y]:x,y=y,x\n\n t[x]+=t[y];t[y]=x\n\n[*list(map(u,q))]\n\ni=c=0\n\nk=j=n+~m<<1\n\n*d,=eval('[],'*n)\n\nfor v in a:d[r(i)]+=v,;i+=1\n\nfor p in d:x,*y=sorted(p)+[0];c+=x;b+=y[:-1];j-=p>[]\n\nprint(((c+sum(sorted(b)[:j]),'Impossible')[k>n]*(k>0)))","target":"(n,m,*b),a,*q=[list(map(int,t.split()))for t in open(0)]\n\nt=[-1]*n\n\ndef r(x):\n\n while-1t[y]:x,y=y,x\n\n t[x]+=t[y];t[y]=x\n\n[*list(map(u,q))]\n\ni=c=0\n\nk=j=n+~m<<1\n\n*d,=eval('[],'*n)\n\nfor v in a:d[r(i)]+=v,;i+=1\n\nfor p in d:\n\n if p:x,*y=sorted(p);c+=x;b+=y;j-=1\n\nprint(((c+sum(sorted(b)[:j]),'Impossible')[k>n]*(k>0)))","code_v0_loc":17,"code_v1_loc":18,"code_v0_num_chars":375,"code_v1_num_chars":371,"code_v0_no_empty_lines":"(n, m, *b), a, *q = [list(map(int, t.split())) for t in open(0)]\nt = [-1] * n\n\n\ndef r(x):\n while -1 < t[x]:\n x = t[x]\n return x\n\n\ndef u(x):\n x, y = list(map(r, x))\n if x - y:\n if t[x] > t[y]:\n x, y = y, x\n t[x] += t[y]\n t[y] = x\n\n\n[*list(map(u, q))]\ni = c = 0\nk = j = n + ~m << 1\n(*d,) = eval(\"[],\" * n)\nfor v in a:\n d[r(i)] += (v,)\n i += 1\nfor p in d:\n x, *y = sorted(p) + [0]\n c += x\n b += y[:-1]\n j -= p > []\nprint(((c + sum(sorted(b)[:j]), \"Impossible\")[k > n] * (k > 0)))\n","code_v1_no_empty_lines":"(n, m, *b), a, *q = [list(map(int, t.split())) for t in open(0)]\nt = [-1] * n\n\n\ndef r(x):\n while -1 < t[x]:\n x = t[x]\n return x\n\n\ndef u(x):\n x, y = list(map(r, x))\n if x - y:\n if t[x] > t[y]:\n x, y = y, x\n t[x] += t[y]\n t[y] = x\n\n\n[*list(map(u, q))]\ni = c = 0\nk = j = n + ~m << 1\n(*d,) = eval(\"[],\" * n)\nfor v in a:\n d[r(i)] += (v,)\n i += 1\nfor p in d:\n if p:\n x, *y = sorted(p)\n c += x\n b += y\n j -= 1\nprint(((c + sum(sorted(b)[:j]), \"Impossible\")[k > n] * (k > 0)))\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["- x, *y = sorted(p) + [0]","- c += x","- b += y[:-1]","- j -= p > []","+ if p:","+ x, *y = sorted(p)","+ c += x","+ b += y","+ j -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0355617003,"measured_runtime_v1":0.0620594802,"runtime_lift":0.5730260748,"key":["s079661425","s892479198"]} +{"user_id":"u754022296","problem_id":"p03603","language":"python","submission_id_v0":"s788217758","submission_id_v1":"s762402523","cpu_time_v0":834,"cpu_time_v1":270,"memory_v0":121692,"memory_v1":34296,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.63,"input":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**7)\n\n\n\nn = int(eval(input()))\n\nP = list(map(int, input().split()))\n\nT = [[] for _ in range(n)]\n\nfor i, p in enumerate(P, 1):\n\n T[p-1].append(i)\n\nX = list(map(int, input().split()))\n\nD = [[-1]*n for _ in range(2)]\n\ndef dfs(color, v):\n\n if D[color][v] != -1:\n\n return D[color][v]\n\n l = len(T[v])\n\n x = X[v]\n\n dp = [[float(\"inf\")]*(x+1) for _ in range(l+1)]\n\n dp[0][0] = 0\n\n for i, nv in enumerate(T[v]):\n\n for j in range(x+1):\n\n if j >= X[nv]:\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j-X[nv]]+dfs(color, nv))\n\n if j >= dfs(color^1, nv):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j-dfs(color^1, nv)]+X[nv])\n\n res = min(dp[l])\n\n D[color][v] = res\n\n return res\n\nans = dfs(0, 0)\n\nif ans == float(\"inf\"):\n\n print(\"IMPOSSIBLE\")\n\nelse:\n\n print(\"POSSIBLE\")","target":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**7)\n\nimport numpy as np\n\n\n\nINF = 2**30\n\nn = int(eval(input()))\n\nP = list(map(int, input().split()))\n\nT = [[] for _ in range(n)]\n\nfor i, p in enumerate(P, 1):\n\n T[p-1].append(i)\n\nX = list(map(int, input().split()))\n\nD = [[-1]*n for _ in range(2)]\n\ndef dfs(color, v):\n\n if D[color][v] != -1:\n\n return D[color][v]\n\n l = len(T[v])\n\n x = X[v]\n\n dp = np.full(x+1, INF, dtype=np.int64)\n\n dp[0] = 0\n\n for i, nv in enumerate(T[v]):\n\n k = np.full(x+1, INF, dtype=np.int64)\n\n if x+1 >= X[nv]:\n\n np.minimum(k[X[nv]:], dp[:x+1-X[nv]]+dfs(color, nv), out=k[X[nv]:])\n\n if x+1 >= dfs(color^1, nv):\n\n np.minimum(k[dfs(color^1, nv):], dp[:x+1-dfs(color^1, nv)]+X[nv], out=k[dfs(color^1, nv):])\n\n dp = k.copy()\n\n res = dp.min()\n\n D[color][v] = res\n\n return res\n\nans = dfs(0, 0)\n\nif ans == INF:\n\n print(\"IMPOSSIBLE\")\n\nelse:\n\n print(\"POSSIBLE\")","code_v0_loc":32,"code_v1_loc":35,"code_v0_num_chars":839,"code_v1_num_chars":919,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nn = int(eval(input()))\nP = list(map(int, input().split()))\nT = [[] for _ in range(n)]\nfor i, p in enumerate(P, 1):\n T[p - 1].append(i)\nX = list(map(int, input().split()))\nD = [[-1] * n for _ in range(2)]\n\n\ndef dfs(color, v):\n if D[color][v] != -1:\n return D[color][v]\n l = len(T[v])\n x = X[v]\n dp = [[float(\"inf\")] * (x + 1) for _ in range(l + 1)]\n dp[0][0] = 0\n for i, nv in enumerate(T[v]):\n for j in range(x + 1):\n if j >= X[nv]:\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - X[nv]] + dfs(color, nv))\n if j >= dfs(color ^ 1, nv):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - dfs(color ^ 1, nv)] + X[nv])\n res = min(dp[l])\n D[color][v] = res\n return res\n\n\nans = dfs(0, 0)\nif ans == float(\"inf\"):\n print(\"IMPOSSIBLE\")\nelse:\n print(\"POSSIBLE\")\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nimport numpy as np\n\nINF = 2**30\nn = int(eval(input()))\nP = list(map(int, input().split()))\nT = [[] for _ in range(n)]\nfor i, p in enumerate(P, 1):\n T[p - 1].append(i)\nX = list(map(int, input().split()))\nD = [[-1] * n for _ in range(2)]\n\n\ndef dfs(color, v):\n if D[color][v] != -1:\n return D[color][v]\n l = len(T[v])\n x = X[v]\n dp = np.full(x + 1, INF, dtype=np.int64)\n dp[0] = 0\n for i, nv in enumerate(T[v]):\n k = np.full(x + 1, INF, dtype=np.int64)\n if x + 1 >= X[nv]:\n np.minimum(k[X[nv] :], dp[: x + 1 - X[nv]] + dfs(color, nv), out=k[X[nv] :])\n if x + 1 >= dfs(color ^ 1, nv):\n np.minimum(\n k[dfs(color ^ 1, nv) :],\n dp[: x + 1 - dfs(color ^ 1, nv)] + X[nv],\n out=k[dfs(color ^ 1, nv) :],\n )\n dp = k.copy()\n res = dp.min()\n D[color][v] = res\n return res\n\n\nans = dfs(0, 0)\nif ans == INF:\n print(\"IMPOSSIBLE\")\nelse:\n print(\"POSSIBLE\")\n","code_same":false,"relative_loc_diff_percent":8.5714285714,"diff":["+import numpy as np","+","+INF = 2**30","- dp = [[float(\"inf\")] * (x + 1) for _ in range(l + 1)]","- dp[0][0] = 0","+ dp = np.full(x + 1, INF, dtype=np.int64)","+ dp[0] = 0","- for j in range(x + 1):","- if j >= X[nv]:","- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - X[nv]] + dfs(color, nv))","- if j >= dfs(color ^ 1, nv):","- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - dfs(color ^ 1, nv)] + X[nv])","- res = min(dp[l])","+ k = np.full(x + 1, INF, dtype=np.int64)","+ if x + 1 >= X[nv]:","+ np.minimum(k[X[nv] :], dp[: x + 1 - X[nv]] + dfs(color, nv), out=k[X[nv] :])","+ if x + 1 >= dfs(color ^ 1, nv):","+ np.minimum(","+ k[dfs(color ^ 1, nv) :],","+ dp[: x + 1 - dfs(color ^ 1, nv)] + X[nv],","+ out=k[dfs(color ^ 1, nv) :],","+ )","+ dp = k.copy()","+ res = dp.min()","-if ans == float(\"inf\"):","+if ans == INF:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0470453351,"measured_runtime_v1":0.2671677058,"runtime_lift":0.1760891531,"key":["s788217758","s762402523"]} +{"user_id":"u083960235","problem_id":"p03425","language":"python","submission_id_v0":"s548990447","submission_id_v1":"s589530501","cpu_time_v0":103,"cpu_time_v1":84,"memory_v0":11840,"memory_v1":18700,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.45,"input":"import sys, re, os\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import permutations, combinations, product, accumulate\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom fractions import gcd\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef S_MAP(): return list(map(str, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef S_LIST(): return list(map(str, input().split()))\n\n \n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nN = INT()\n\nS = [eval(input()) for i in range(N)]\n\n\n\ndic = defaultdict(int)\n\nfor s in S:\n\n if s[0] in \"MARCH\":\n\n dic[s[0]] += 1\n\n\n\nmarch = list(\"MARCH\")\n\ncomb = list(combinations(march, 3))\n\n\n\nans = 0\n\nfor a, b, c in comb:\n\n ans += dic[a] * dic[b] * dic[c]\n\nprint(ans)\n\n\n\n\n\n\n\n\n","target":"import sys, re, os\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import permutations, combinations, product, accumulate\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom fractions import gcd\n\nfrom bisect import bisect, bisect_left, bisect_right\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef S_MAP(): return list(map(str, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef S_LIST(): return list(map(str, input().split()))\n\n \n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nN = INT()\n\nS = [eval(input()) for i in range(N)]\n\ndic = defaultdict(list)\n\n\n\nfor s in S:\n\n dic[s[0]].append(s)\n\n\n\nL = list(combinations(list(\"MARCH\"), 3))\n\n# print(L)\n\n\n\ncnt = 0\n\nfor l in L:\n\n # print(l)\n\n cnt += len(dic[l[0]]) * len(dic[l[1]]) * len(dic[l[2]])\n\nprint(cnt)","code_v0_loc":39,"code_v1_loc":36,"code_v0_num_chars":1008,"code_v1_num_chars":1055,"code_v0_no_empty_lines":"import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef S_MAP():\n return list(map(str, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef S_LIST():\n return list(map(str, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nN = INT()\nS = [eval(input()) for i in range(N)]\ndic = defaultdict(int)\nfor s in S:\n if s[0] in \"MARCH\":\n dic[s[0]] += 1\nmarch = list(\"MARCH\")\ncomb = list(combinations(march, 3))\nans = 0\nfor a, b, c in comb:\n ans += dic[a] * dic[b] * dic[c]\nprint(ans)\n","code_v1_no_empty_lines":"import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\nfrom bisect import bisect, bisect_left, bisect_right\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef S_MAP():\n return list(map(str, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef S_LIST():\n return list(map(str, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nN = INT()\nS = [eval(input()) for i in range(N)]\ndic = defaultdict(list)\nfor s in S:\n dic[s[0]].append(s)\nL = list(combinations(list(\"MARCH\"), 3))\n# print(L)\ncnt = 0\nfor l in L:\n # print(l)\n cnt += len(dic[l[0]]) * len(dic[l[1]]) * len(dic[l[2]])\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["+from bisect import bisect, bisect_left, bisect_right","-dic = defaultdict(int)","+dic = defaultdict(list)","- if s[0] in \"MARCH\":","- dic[s[0]] += 1","-march = list(\"MARCH\")","-comb = list(combinations(march, 3))","-ans = 0","-for a, b, c in comb:","- ans += dic[a] * dic[b] * dic[c]","-print(ans)","+ dic[s[0]].append(s)","+L = list(combinations(list(\"MARCH\"), 3))","+# print(L)","+cnt = 0","+for l in L:","+ # print(l)","+ cnt += len(dic[l[0]]) * len(dic[l[1]]) * len(dic[l[2]])","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.045905149,"measured_runtime_v1":0.0661633694,"runtime_lift":0.6938151636,"key":["s548990447","s589530501"]} +{"user_id":"u426534722","problem_id":"p02244","language":"python","submission_id_v0":"s533166857","submission_id_v1":"s641782485","cpu_time_v0":390,"cpu_time_v1":340,"memory_v0":6512,"memory_v1":6512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.82,"input":"from copy import deepcopy, copy\n\nclass QueenMAP():\n\n __slots__ = [\"yoko\", \"tate\", \"naname1\", \"naname2\", \"MAP\"]\n\n def __init__(self):\n\n self.yoko = set()\n\n self.tate = set()\n\n self.naname1 = set()\n\n self.naname2 = set()\n\n self.MAP = [[\".\"] * 8 for _ in range(8)]\n\n def add(self, y, x):\n\n self.MAP[y][x] = \"Q\"\n\n self.yoko.add(y)\n\n self.tate.add(x)\n\n self.naname1.add(y - x)\n\n self.naname2.add(x + y)\n\n def check(self, y, x):\n\n if x in self.tate or (y - x) in self.naname1 or (x + y) in self.naname2:\n\n return False\n\n return True\n\n def allcheck(self):\n\n for i in range(8):\n\n if not \"Q\" in self.MAP[i]:\n\n return False\n\n return True\n\ndef MAIN():\n\n f = lambda M: \"\\n\".join(\"\".join(map(str, m)) for m in M)\n\n QM = QueenMAP()\n\n n = int(eval(input()))\n\n for _ in range(n):\n\n a, b = list(map(int, input().split()))\n\n QM.add(a, b)\n\n dp = [(deepcopy(QM), n)]\n\n while dp:\n\n Q, cnt = dp.pop()\n\n if cnt == 8:\n\n if Q.allcheck():\n\n print((f(Q.MAP)))\n\n break\n\n continue\n\n cnt += 1\n\n for i in range(8):\n\n if i in Q.yoko:\n\n continue\n\n for j in range(8):\n\n if Q.check(i, j):\n\n CQ = deepcopy(Q)\n\n CQ.add(i, j)\n\n dp.append((CQ, cnt))\n\nMAIN()\n\n\n","target":"from copy import deepcopy, copy\n\nclass QueenMAP():\n\n __slots__ = [\"yoko\", \"tate\", \"naname1\", \"naname2\", \"MAP\"]\n\n def __init__(self):\n\n self.yoko = set()\n\n self.tate = set()\n\n self.naname1 = set()\n\n self.naname2 = set()\n\n self.MAP = [[\".\"] * 8 for _ in range(8)]\n\n def add(self, y, x):\n\n self.MAP[y][x] = \"Q\"\n\n self.yoko.add(y)\n\n self.tate.add(x)\n\n self.naname1.add(y - x)\n\n self.naname2.add(x + y)\n\n def check(self, y, x):\n\n if y in self.yoko or x in self.tate or (y - x) in self.naname1 or (x + y) in self.naname2:\n\n return False\n\n return True\n\n def allcheck(self):\n\n for i in range(8):\n\n if not \"Q\" in self.MAP[i]:\n\n return False\n\n return True\n\ndef MAIN():\n\n f = lambda M: \"\\n\".join(\"\".join(m) for m in M)\n\n QM = QueenMAP()\n\n n = int(eval(input()))\n\n for _ in range(n):\n\n a, b = list(map(int, input().split()))\n\n QM.add(a, b)\n\n dp = [(deepcopy(QM), n)]\n\n while dp:\n\n Q, cnt = dp.pop()\n\n if cnt == 8:\n\n if Q.allcheck():\n\n print((f(Q.MAP)))\n\n break\n\n continue\n\n cnt += 1\n\n for i in range(8):\n\n for j in range(8):\n\n if Q.check(i, j):\n\n CQ = deepcopy(Q)\n\n CQ.add(i, j)\n\n dp.append((CQ, cnt))\n\nMAIN()\n\n\n","code_v0_loc":50,"code_v1_loc":48,"code_v0_num_chars":1478,"code_v1_num_chars":1431,"code_v0_no_empty_lines":"from copy import deepcopy, copy\n\n\nclass QueenMAP:\n __slots__ = [\"yoko\", \"tate\", \"naname1\", \"naname2\", \"MAP\"]\n\n def __init__(self):\n self.yoko = set()\n self.tate = set()\n self.naname1 = set()\n self.naname2 = set()\n self.MAP = [[\".\"] * 8 for _ in range(8)]\n\n def add(self, y, x):\n self.MAP[y][x] = \"Q\"\n self.yoko.add(y)\n self.tate.add(x)\n self.naname1.add(y - x)\n self.naname2.add(x + y)\n\n def check(self, y, x):\n if x in self.tate or (y - x) in self.naname1 or (x + y) in self.naname2:\n return False\n return True\n\n def allcheck(self):\n for i in range(8):\n if not \"Q\" in self.MAP[i]:\n return False\n return True\n\n\ndef MAIN():\n f = lambda M: \"\\n\".join(\"\".join(map(str, m)) for m in M)\n QM = QueenMAP()\n n = int(eval(input()))\n for _ in range(n):\n a, b = list(map(int, input().split()))\n QM.add(a, b)\n dp = [(deepcopy(QM), n)]\n while dp:\n Q, cnt = dp.pop()\n if cnt == 8:\n if Q.allcheck():\n print((f(Q.MAP)))\n break\n continue\n cnt += 1\n for i in range(8):\n if i in Q.yoko:\n continue\n for j in range(8):\n if Q.check(i, j):\n CQ = deepcopy(Q)\n CQ.add(i, j)\n dp.append((CQ, cnt))\n\n\nMAIN()\n","code_v1_no_empty_lines":"from copy import deepcopy, copy\n\n\nclass QueenMAP:\n __slots__ = [\"yoko\", \"tate\", \"naname1\", \"naname2\", \"MAP\"]\n\n def __init__(self):\n self.yoko = set()\n self.tate = set()\n self.naname1 = set()\n self.naname2 = set()\n self.MAP = [[\".\"] * 8 for _ in range(8)]\n\n def add(self, y, x):\n self.MAP[y][x] = \"Q\"\n self.yoko.add(y)\n self.tate.add(x)\n self.naname1.add(y - x)\n self.naname2.add(x + y)\n\n def check(self, y, x):\n if (\n y in self.yoko\n or x in self.tate\n or (y - x) in self.naname1\n or (x + y) in self.naname2\n ):\n return False\n return True\n\n def allcheck(self):\n for i in range(8):\n if not \"Q\" in self.MAP[i]:\n return False\n return True\n\n\ndef MAIN():\n f = lambda M: \"\\n\".join(\"\".join(m) for m in M)\n QM = QueenMAP()\n n = int(eval(input()))\n for _ in range(n):\n a, b = list(map(int, input().split()))\n QM.add(a, b)\n dp = [(deepcopy(QM), n)]\n while dp:\n Q, cnt = dp.pop()\n if cnt == 8:\n if Q.allcheck():\n print((f(Q.MAP)))\n break\n continue\n cnt += 1\n for i in range(8):\n for j in range(8):\n if Q.check(i, j):\n CQ = deepcopy(Q)\n CQ.add(i, j)\n dp.append((CQ, cnt))\n\n\nMAIN()\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["- if x in self.tate or (y - x) in self.naname1 or (x + y) in self.naname2:","+ if (","+ y in self.yoko","+ or x in self.tate","+ or (y - x) in self.naname1","+ or (x + y) in self.naname2","+ ):","- f = lambda M: \"\\n\".join(\"\".join(map(str, m)) for m in M)","+ f = lambda M: \"\\n\".join(\"\".join(m) for m in M)","- if i in Q.yoko:","- continue"],"diff_only_import_comment":false,"measured_runtime_v0":0.2471229775,"measured_runtime_v1":0.1669647574,"runtime_lift":1.4800906566,"key":["s533166857","s641782485"]} +{"user_id":"u691896522","problem_id":"p02756","language":"python","submission_id_v0":"s754653548","submission_id_v1":"s155677374","cpu_time_v0":1673,"cpu_time_v1":543,"memory_v0":5912,"memory_v1":6580,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.54,"input":"s = eval(input())\n\nq = int(eval(input()))\n\nreverse_now = 0\n\nfirst = \"\"\n\nlatter = \"\"\n\nfor i in range(q):\n\n k = list(input().split())\n\n if k[0] == \"1\":\n\n reverse_now = 1 - reverse_now\n\n else:\n\n f,c = k[1], k[2]\n\n if f == \"1\" and reverse_now == 0:\n\n first = c + first\n\n if f == \"1\" and reverse_now == 1:\n\n latter += c\n\n if f == \"2\" and reverse_now == 0:\n\n latter += c\n\n if f == \"2\" and reverse_now == 1:\n\n first = c + first\n\nif reverse_now == 1:\n\n ans = list(first + s + latter)\n\n ans.reverse()\n\n ans = \"\".join(ans)\n\nelse:\n\n ans = first + s + latter\n\nprint(ans)","target":"from collections import deque\n\ns = eval(input())\n\nq = int(eval(input()))\n\nreverse_now = 0\n\nfirst = deque([])\n\nlatter = \"\"\n\nfor i in range(q):\n\n k = list(input().split())\n\n if k[0] == \"1\":\n\n reverse_now = 1 - reverse_now\n\n else:\n\n f,c = k[1], k[2]\n\n if f == \"1\" and reverse_now == 0:\n\n first.appendleft(c)\n\n if f == \"1\" and reverse_now == 1:\n\n latter += c\n\n if f == \"2\" and reverse_now == 0:\n\n latter += c\n\n if f == \"2\" and reverse_now == 1:\n\n first.appendleft(c)\n\nfirst = \"\".join(first)\n\nif reverse_now == 1:\n\n ans = list(first + s + latter)\n\n ans.reverse()\n\n ans = \"\".join(ans)\n\nelse:\n\n ans = first + s + latter\n\nprint(ans)","code_v0_loc":26,"code_v1_loc":28,"code_v0_num_chars":654,"code_v1_num_chars":720,"code_v0_no_empty_lines":"s = eval(input())\nq = int(eval(input()))\nreverse_now = 0\nfirst = \"\"\nlatter = \"\"\nfor i in range(q):\n k = list(input().split())\n if k[0] == \"1\":\n reverse_now = 1 - reverse_now\n else:\n f, c = k[1], k[2]\n if f == \"1\" and reverse_now == 0:\n first = c + first\n if f == \"1\" and reverse_now == 1:\n latter += c\n if f == \"2\" and reverse_now == 0:\n latter += c\n if f == \"2\" and reverse_now == 1:\n first = c + first\nif reverse_now == 1:\n ans = list(first + s + latter)\n ans.reverse()\n ans = \"\".join(ans)\nelse:\n ans = first + s + latter\nprint(ans)\n","code_v1_no_empty_lines":"from collections import deque\n\ns = eval(input())\nq = int(eval(input()))\nreverse_now = 0\nfirst = deque([])\nlatter = \"\"\nfor i in range(q):\n k = list(input().split())\n if k[0] == \"1\":\n reverse_now = 1 - reverse_now\n else:\n f, c = k[1], k[2]\n if f == \"1\" and reverse_now == 0:\n first.appendleft(c)\n if f == \"1\" and reverse_now == 1:\n latter += c\n if f == \"2\" and reverse_now == 0:\n latter += c\n if f == \"2\" and reverse_now == 1:\n first.appendleft(c)\nfirst = \"\".join(first)\nif reverse_now == 1:\n ans = list(first + s + latter)\n ans.reverse()\n ans = \"\".join(ans)\nelse:\n ans = first + s + latter\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["+from collections import deque","+","-first = \"\"","+first = deque([])","- first = c + first","+ first.appendleft(c)","- first = c + first","+ first.appendleft(c)","+first = \"\".join(first)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0441294346,"measured_runtime_v1":0.0685538919,"runtime_lift":0.643718881,"key":["s754653548","s155677374"]} +{"user_id":"u207799478","problem_id":"p02923","language":"python","submission_id_v0":"s157413273","submission_id_v1":"s210465346","cpu_time_v0":232,"cpu_time_v1":131,"memory_v0":64112,"memory_v1":90644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.53,"input":"import math\n\nimport string\n\nimport collections\n\nfrom collections import Counter\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)\/\/(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\nn = int(eval(input()))\n\nh = readints()\n\ncnt = 0\n\nans = 0\n\nfor i in range(n-1):\n\n if h[i] >= h[i+1]:\n\n cnt += 1\n\n else:\n\n ans = max(cnt, ans)\n\n cnt = 0\n\nprint((max(ans, cnt)))\n","target":"from copy import deepcopy\n\nimport math\n\nimport string\n\nimport collections\n\nfrom collections import Counter\n\nfrom collections import deque\n\nfrom decimal import Decimal\n\nimport sys\n\nimport fractions\n\nfrom operator import itemgetter\n\nimport itertools\n\nimport copy\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)\/\/(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\n\nn = int(eval(input()))\n\nh = readints()\n\n# print(h)\n\ncnt = 0\n\nans = -1\n\nfor i in range(n-1):\n\n if h[i] >= h[i+1]:\n\n cnt += 1\n\n else:\n\n ans = max(cnt, ans)\n\n cnt = 0\n\nprint((max(ans, cnt)))\n","code_v0_loc":44,"code_v1_loc":54,"code_v0_num_chars":825,"code_v1_num_chars":1021,"code_v0_no_empty_lines":"import math\nimport string\nimport collections\nfrom collections import Counter\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not (item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n + 1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\nn = int(eval(input()))\nh = readints()\ncnt = 0\nans = 0\nfor i in range(n - 1):\n if h[i] >= h[i + 1]:\n cnt += 1\n else:\n ans = max(cnt, ans)\n cnt = 0\nprint((max(ans, cnt)))\n","code_v1_no_empty_lines":"from copy import deepcopy\nimport math\nimport string\nimport collections\nfrom collections import Counter\nfrom collections import deque\nfrom decimal import Decimal\nimport sys\nimport fractions\nfrom operator import itemgetter\nimport itertools\nimport copy\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not (item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n + 1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\nn = int(eval(input()))\nh = readints()\n# print(h)\ncnt = 0\nans = -1\nfor i in range(n - 1):\n if h[i] >= h[i + 1]:\n cnt += 1\n else:\n ans = max(cnt, ans)\n cnt = 0\nprint((max(ans, cnt)))\n","code_same":false,"relative_loc_diff_percent":18.5185185185,"diff":["+from copy import deepcopy","+from collections import deque","+from decimal import Decimal","+import sys","+import fractions","+from operator import itemgetter","+import itertools","+import copy","+# print(h)","-ans = 0","+ans = -1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0447762833,"measured_runtime_v1":0.0384102077,"runtime_lift":1.1657391583,"key":["s157413273","s210465346"]} +{"user_id":"u466330895","problem_id":"p04044","language":"python","submission_id_v0":"s186462603","submission_id_v1":"s079486677","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"n, l = list(map(int, input().split()))\n\ns_list = []\n\nfor i in range(n):\n\n s_list.append(eval(input()))\n\n\n\n# \u30ea\u30b9\u30c8\u306e\u5404\u8981\u7d20\u3092\u7a7a\u6587\u5b57\u3067join\n\ns_str = ''.join(sorted(s_list))\n\nprint(s_str)","target":"n, length = list(map(int, input().split()))\n\ns_list = [eval(input()) for i in range(n)]\n\n\n\n# \u30ea\u30b9\u30c8\u306e\u5404\u8981\u7d20\u3092\u7a7a\u6587\u5b57\u3067join\n\ns_str = ''.join(sorted(s_list))\n\nprint(s_str)","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":162,"code_v1_num_chars":144,"code_v0_no_empty_lines":"n, l = list(map(int, input().split()))\ns_list = []\nfor i in range(n):\n s_list.append(eval(input()))\n# \u30ea\u30b9\u30c8\u306e\u5404\u8981\u7d20\u3092\u7a7a\u6587\u5b57\u3067join\ns_str = \"\".join(sorted(s_list))\nprint(s_str)\n","code_v1_no_empty_lines":"n, length = list(map(int, input().split()))\ns_list = [eval(input()) for i in range(n)]\n# \u30ea\u30b9\u30c8\u306e\u5404\u8981\u7d20\u3092\u7a7a\u6587\u5b57\u3067join\ns_str = \"\".join(sorted(s_list))\nprint(s_str)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-n, l = list(map(int, input().split()))","-s_list = []","-for i in range(n):","- s_list.append(eval(input()))","+n, length = list(map(int, input().split()))","+s_list = [eval(input()) for i in range(n)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0460345566,"measured_runtime_v1":0.046386812,"runtime_lift":0.9924061314,"key":["s186462603","s079486677"]} +{"user_id":"u411203878","problem_id":"p03048","language":"python","submission_id_v0":"s447540312","submission_id_v1":"s233299810","cpu_time_v0":213,"cpu_time_v1":73,"memory_v0":40556,"memory_v1":67400,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.73,"input":"r,g,b,n = list(map(int,input().split()))\n\nr1 = 0\n\ncount = 0\n\n\n\nwhile r*r1 <= n:\n\n g1 = 0\n\n while r*r1+g*g1 <= n:\n\n if (n-(r*r1+g*g1))%b==0:\n\n count += 1\n\n g1 += 1\n\n r1 += 1\n\nprint(count)\n","target":"R,G,B,N = list(map(int,input().split()))\n\n\n\nans = 0\n\n\n\nfor r in range(1+N\/\/R):\n\n for g in range(1+N\/\/G):\n\n #print(N-(r*R+g*G),r*R, g*G)\n\n if N-(r*R+g*G) < 0:\n\n break\n\n if (N-(r*R+g*G))%B==0:\n\n ans += 1\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":215,"code_v1_num_chars":253,"code_v0_no_empty_lines":"r, g, b, n = list(map(int, input().split()))\nr1 = 0\ncount = 0\nwhile r * r1 <= n:\n g1 = 0\n while r * r1 + g * g1 <= n:\n if (n - (r * r1 + g * g1)) % b == 0:\n count += 1\n g1 += 1\n r1 += 1\nprint(count)\n","code_v1_no_empty_lines":"R, G, B, N = list(map(int, input().split()))\nans = 0\nfor r in range(1 + N \/\/ R):\n for g in range(1 + N \/\/ G):\n # print(N-(r*R+g*G),r*R, g*G)\n if N - (r * R + g * G) < 0:\n break\n if (N - (r * R + g * G)) % B == 0:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-r, g, b, n = list(map(int, input().split()))","-r1 = 0","-count = 0","-while r * r1 <= n:","- g1 = 0","- while r * r1 + g * g1 <= n:","- if (n - (r * r1 + g * g1)) % b == 0:","- count += 1","- g1 += 1","- r1 += 1","-print(count)","+R, G, B, N = list(map(int, input().split()))","+ans = 0","+for r in range(1 + N \/\/ R):","+ for g in range(1 + N \/\/ G):","+ # print(N-(r*R+g*G),r*R, g*G)","+ if N - (r * R + g * G) < 0:","+ break","+ if (N - (r * R + g * G)) % B == 0:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3160479824,"measured_runtime_v1":0.1127765163,"runtime_lift":2.8024272497,"key":["s447540312","s233299810"]} +{"user_id":"u339199690","problem_id":"p03103","language":"python","submission_id_v0":"s574159718","submission_id_v1":"s245892754","cpu_time_v0":410,"cpu_time_v1":237,"memory_v0":16988,"memory_v1":27500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.2,"input":"N, M = list(map(int, input().split()))\n\nAB = [tuple(map(int, input().split())) for _ in range(N)]\n\nAB.sort()\n\n\n\nres = 0\n\ncnt = 0\n\nfor a, b in AB:\n\n tmp = M - cnt\n\n if tmp <= b:\n\n res += a * tmp\n\n break\n\n res += a * b\n\n cnt += b\n\n\n\nprint(res)\n","target":"import sys\n\n\n\nN, M = list(map(int, input().split()))\n\nAB = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(N)]\n\n\n\nAB.sort()\n\n\n\nres = 0\n\nfor a, b in AB:\n\n if M > b:\n\n M -= b\n\n res += a * b\n\n else:\n\n res += a * M\n\n break\n\nprint(res)\n","code_v0_loc":15,"code_v1_loc":16,"code_v0_num_chars":262,"code_v1_num_chars":273,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nAB = [tuple(map(int, input().split())) for _ in range(N)]\nAB.sort()\nres = 0\ncnt = 0\nfor a, b in AB:\n tmp = M - cnt\n if tmp <= b:\n res += a * tmp\n break\n res += a * b\n cnt += b\nprint(res)\n","code_v1_no_empty_lines":"import sys\n\nN, M = list(map(int, input().split()))\nAB = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(N)]\nAB.sort()\nres = 0\nfor a, b in AB:\n if M > b:\n M -= b\n res += a * b\n else:\n res += a * M\n break\nprint(res)\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["+import sys","+","-AB = [tuple(map(int, input().split())) for _ in range(N)]","+AB = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(N)]","-cnt = 0","- tmp = M - cnt","- if tmp <= b:","- res += a * tmp","+ if M > b:","+ M -= b","+ res += a * b","+ else:","+ res += a * M","- res += a * b","- cnt += b"],"diff_only_import_comment":false,"measured_runtime_v0":0.0459373896,"measured_runtime_v1":0.0444002202,"runtime_lift":1.0346207618,"key":["s574159718","s245892754"]} +{"user_id":"u880480312","problem_id":"p02707","language":"python","submission_id_v0":"s260243704","submission_id_v1":"s468264430","cpu_time_v0":402,"cpu_time_v1":134,"memory_v0":110116,"memory_v1":93636,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.67,"input":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\nans=[0]*n\n\nfor i in a:\n\n ans[i-1]+=1\n\nfor k in ans:\n\n print(k)\n\n\n","target":"n=int(input())\n\na=list(map(int,input().split()))\n\nans=[0]*n\n\nfor i in a:\n\n ans[i-1]+=1\n\nprint(*ans,sep=\"\\n\")\n\n\n","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":121,"code_v1_num_chars":114,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nans = [0] * n\nfor i in a:\n ans[i - 1] += 1\nfor k in ans:\n print(k)\n","code_v1_no_empty_lines":"n = int(input())\na = list(map(int, input().split()))\nans = [0] * n\nfor i in a:\n ans[i - 1] += 1\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-n = int(eval(input()))","+n = int(input())","-for k in ans:","- print(k)","+print(*ans, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0428719823,"measured_runtime_v1":0.0367420533,"runtime_lift":1.166836867,"key":["s260243704","s468264430"]} +{"user_id":"u896451538","problem_id":"p03162","language":"python","submission_id_v0":"s255156073","submission_id_v1":"s469962092","cpu_time_v0":1047,"cpu_time_v1":279,"memory_v0":47368,"memory_v1":101596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.35,"input":"def MAP(): return list(map(int,input().split()))\n\ndef INT(): return int(eval(input()))\n\ndef FLOAT(): return float(eval(input()))\n\nMOD = 10**9+7\n\n\n\nn = INT()\n\na = [MAP() for _ in range(n)]\n\ndp = [[0,0,0] for _ in range(n+1)]\n\n\n\nfor i in range(n):\n\n for j in range(3):\n\n for k in range(3):\n\n if j==k:\n\n continue\n\n dp[i+1][k] = max(dp[i+1][k],dp[i][j]+a[i][k])\n\n\n\nprint((max(dp[n])))","target":"n = int(eval(input()))\n\n\n\ndp = [[0]*3 for i in range(n+1)]\n\na = []\n\n\n\nfor i in range(n):\n\n a.append(list(map(int,input().split())))\n\n\n\nfor i in range(n):\n\n for j in range(3):\n\n for k in range(3):\n\n if j==k:\n\n continue\n\n dp[i+1][j] = max(dp[i+1][j],dp[i][k] + a[i][j])\n\n\n\nprint((max(dp[n])))\n","code_v0_loc":17,"code_v1_loc":16,"code_v0_num_chars":413,"code_v1_num_chars":333,"code_v0_no_empty_lines":"def MAP():\n return list(map(int, input().split()))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef FLOAT():\n return float(eval(input()))\n\n\nMOD = 10**9 + 7\nn = INT()\na = [MAP() for _ in range(n)]\ndp = [[0, 0, 0] for _ in range(n + 1)]\nfor i in range(n):\n for j in range(3):\n for k in range(3):\n if j == k:\n continue\n dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + a[i][k])\nprint((max(dp[n])))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ndp = [[0] * 3 for i in range(n + 1)]\na = []\nfor i in range(n):\n a.append(list(map(int, input().split())))\nfor i in range(n):\n for j in range(3):\n for k in range(3):\n if j == k:\n continue\n dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + a[i][j])\nprint((max(dp[n])))\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-def MAP():","- return list(map(int, input().split()))","-","-","-def INT():","- return int(eval(input()))","-","-","-def FLOAT():","- return float(eval(input()))","-","-","-MOD = 10**9 + 7","-n = INT()","-a = [MAP() for _ in range(n)]","-dp = [[0, 0, 0] for _ in range(n + 1)]","+n = int(eval(input()))","+dp = [[0] * 3 for i in range(n + 1)]","+a = []","+for i in range(n):","+ a.append(list(map(int, input().split())))","- dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + a[i][k])","+ dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + a[i][j])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0431330652,"measured_runtime_v1":0.0852707155,"runtime_lift":0.5058367926,"key":["s255156073","s469962092"]} +{"user_id":"u814265211","problem_id":"p03563","language":"python","submission_id_v0":"s300505131","submission_id_v1":"s634348299","cpu_time_v0":173,"cpu_time_v1":31,"memory_v0":38384,"memory_v1":9048,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.08,"input":"r = int(eval(input()))\n\ng = int(eval(input()))\n\nprint((g*2 - r))","target":"r, g = list(map(int, [eval(input()) for _ in range(2)]))\n\nprint((g*2 - r))","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":50,"code_v1_num_chars":66,"code_v0_no_empty_lines":"r = int(eval(input()))\ng = int(eval(input()))\nprint((g * 2 - r))\n","code_v1_no_empty_lines":"r, g = list(map(int, [eval(input()) for _ in range(2)]))\nprint((g * 2 - r))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-r = int(eval(input()))","-g = int(eval(input()))","+r, g = list(map(int, [eval(input()) for _ in range(2)]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0366525756,"measured_runtime_v1":0.0356333611,"runtime_lift":1.0286028157,"key":["s300505131","s634348299"]} +{"user_id":"u953237709","problem_id":"p03059","language":"python","submission_id_v0":"s685209622","submission_id_v1":"s003742020","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"a, b, t = list(map(int, input().split()))\n\nret = 0\n\nfor i in range(a, t + 1, a):\n\n ret += b\n\nprint(ret)\n","target":"a, b, t = list(map(int, input().split()))\n\nprint((b * (t \/\/ a)))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":101,"code_v1_num_chars":56,"code_v0_no_empty_lines":"a, b, t = list(map(int, input().split()))\nret = 0\nfor i in range(a, t + 1, a):\n ret += b\nprint(ret)\n","code_v1_no_empty_lines":"a, b, t = list(map(int, input().split()))\nprint((b * (t \/\/ a)))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-ret = 0","-for i in range(a, t + 1, a):","- ret += b","-print(ret)","+print((b * (t \/\/ a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0419515941,"measured_runtime_v1":0.0424595172,"runtime_lift":0.9880374727,"key":["s685209622","s003742020"]} +{"user_id":"u857759499","problem_id":"p04045","language":"python","submission_id_v0":"s274321094","submission_id_v1":"s292707444","cpu_time_v0":50,"cpu_time_v1":25,"memory_v0":2940,"memory_v1":3956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"n,k = list(map(int,input().split()))\n\nd = input().replace(\" \",\"\")\n\nfor i in range(n,10**9):\n\n check = True\n\n for j in str(i):\n\n if j in d:\n\n check = False\n\n break\n\n if check:\n\n print(i)\n\n break","target":"import copy\n\nn,k = list(map(int,input().split()))\n\nd = input().split()\n\nnd = list(map(str,list(range(10))))\n\nfor i in d:\n\n nd.remove(i)\n\nl = len(str(n))\n\nif \"0\" in nd:\n\n a1 = 1\n\nelse:\n\n a1 = 0\n\nalist = nd[a1:]\n\nfor _ in range(l-1):\n\n tlist = []\n\n for i in alist:\n\n for j in nd:\n\n tlist.append(i+j)\n\n alist = copy.copy(tlist)\n\nalist.append(nd[a1]+nd[0]*l)\n\nfor i in alist:\n\n if n <= int(i):\n\n print(i)\n\n exit()","code_v0_loc":11,"code_v1_loc":23,"code_v0_num_chars":209,"code_v1_num_chars":418,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nd = input().replace(\" \", \"\")\nfor i in range(n, 10**9):\n check = True\n for j in str(i):\n if j in d:\n check = False\n break\n if check:\n print(i)\n break\n","code_v1_no_empty_lines":"import copy\n\nn, k = list(map(int, input().split()))\nd = input().split()\nnd = list(map(str, list(range(10))))\nfor i in d:\n nd.remove(i)\nl = len(str(n))\nif \"0\" in nd:\n a1 = 1\nelse:\n a1 = 0\nalist = nd[a1:]\nfor _ in range(l - 1):\n tlist = []\n for i in alist:\n for j in nd:\n tlist.append(i + j)\n alist = copy.copy(tlist)\nalist.append(nd[a1] + nd[0] * l)\nfor i in alist:\n if n <= int(i):\n print(i)\n exit()\n","code_same":false,"relative_loc_diff_percent":52.1739130435,"diff":["+import copy","+","-d = input().replace(\" \", \"\")","-for i in range(n, 10**9):","- check = True","- for j in str(i):","- if j in d:","- check = False","- break","- if check:","+d = input().split()","+nd = list(map(str, list(range(10))))","+for i in d:","+ nd.remove(i)","+l = len(str(n))","+if \"0\" in nd:","+ a1 = 1","+else:","+ a1 = 0","+alist = nd[a1:]","+for _ in range(l - 1):","+ tlist = []","+ for i in alist:","+ for j in nd:","+ tlist.append(i + j)","+ alist = copy.copy(tlist)","+alist.append(nd[a1] + nd[0] * l)","+for i in alist:","+ if n <= int(i):","- break","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0453500748,"measured_runtime_v1":0.0507419586,"runtime_lift":0.8937391459,"key":["s274321094","s292707444"]} +{"user_id":"u256678932","problem_id":"p02419","language":"python","submission_id_v0":"s049850794","submission_id_v1":"s783927785","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":6236,"memory_v1":5560,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"from functools import reduce\n\n\n\ndef match_word(w1, w2):\n\n return w1 == w2 or w1+'.' == w2\n\n\n\ndef count_if(f, lst):\n\n count = 0\n\n\n\n for l in lst:\n\n count += 1 if f(l) else 0\n\n\n\n return count\n\n\n\ndef main():\n\n count = 0\n\n\n\n word = input().lower()\n\n\n\n while True:\n\n line = eval(input());\n\n\n\n if line == 'END_OF_TEXT':\n\n break\n\n\n\n count += count_if(lambda w: match_word(word, w.lower()), line.split())\n\n\n\n print(count)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def count_if(f, lst):\n\n count = 0\n\n\n\n for l in lst:\n\n count += 1 if f(l) else 0\n\n\n\n return count\n\n\n\ndef main():\n\n count = 0\n\n\n\n word = input().lower()\n\n\n\n while True:\n\n line = eval(input());\n\n\n\n if line == 'END_OF_TEXT':\n\n break\n\n\n\n count += count_if(lambda w: word == w.lower(), line.split())\n\n\n\n print(count)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":30,"code_v1_loc":25,"code_v0_num_chars":513,"code_v1_num_chars":407,"code_v0_no_empty_lines":"from functools import reduce\n\n\ndef match_word(w1, w2):\n return w1 == w2 or w1 + \".\" == w2\n\n\ndef count_if(f, lst):\n count = 0\n for l in lst:\n count += 1 if f(l) else 0\n return count\n\n\ndef main():\n count = 0\n word = input().lower()\n while True:\n line = eval(input())\n if line == \"END_OF_TEXT\":\n break\n count += count_if(lambda w: match_word(word, w.lower()), line.split())\n print(count)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def count_if(f, lst):\n count = 0\n for l in lst:\n count += 1 if f(l) else 0\n return count\n\n\ndef main():\n count = 0\n word = input().lower()\n while True:\n line = eval(input())\n if line == \"END_OF_TEXT\":\n break\n count += count_if(lambda w: word == w.lower(), line.split())\n print(count)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-from functools import reduce","-","-","-def match_word(w1, w2):","- return w1 == w2 or w1 + \".\" == w2","-","-","- count += count_if(lambda w: match_word(word, w.lower()), line.split())","+ count += count_if(lambda w: word == w.lower(), line.split())"],"diff_only_import_comment":false,"measured_runtime_v0":0.046127526,"measured_runtime_v1":0.0671268606,"runtime_lift":0.6871694224,"key":["s049850794","s783927785"]} +{"user_id":"u094191970","problem_id":"p02559","language":"python","submission_id_v0":"s173428217","submission_id_v1":"s705641811","cpu_time_v0":4454,"cpu_time_v1":3069,"memory_v0":65076,"memory_v1":65032,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.1,"input":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\n\nclass BIT:\n\n def __init__(self, n):\n\n self.bit = [0] * n\n\n\n\n def add(self, i, x):\n\n i += 1\n\n while i <= len(self.bit):\n\n self.bit[i-1] += x\n\n i += i & -i\n\n\n\n def sum_sub(self, i):\n\n a = 0\n\n i += 1\n\n while i:\n\n a += self.bit[i-1]\n\n i -= i & -i\n\n return a\n\n\n\n def sum(self, i, j):\n\n a = 0\n\n if j != 0:\n\n a += self.sum_sub(j-1)\n\n if i != 0:\n\n a -= self.sum_sub(i-1)\n\n return a\n\n\n\nn,q=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\nBit=BIT(n)\n\nfor i in range(n):\n\n Bit.add(i,a[i])\n\nfor i in range(q):\n\n t,a,b=list(map(int,input().split()))\n\n if t==0:\n\n Bit.add(a,b)\n\n else:\n\n print((Bit.sum(a,b)))","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\n\n\nclass BIT():\n\n def __init__(self, n, data=None):\n\n self.n = n\n\n self.bit = [0] * (self.n + 1)\n\n self.data = [0] * (self.n + 1)\n\n if data:\n\n self.build(data)\n\n\n\n def build(self, data):\n\n for i in range(self.n):\n\n self.bit[i + 1] = self.data[i + 1] = data[i]\n\n for i in range(1, self.n):\n\n j = i + (i & (-i))\n\n if j <= self.n:\n\n self.bit[j] += self.bit[i]\n\n\n\n def add(self, idx, x):\n\n self.data[idx] += x\n\n while idx <= self.n:\n\n self.bit[idx] += x\n\n idx += (idx & (-idx))\n\n\n\n def sum(self, idx):\n\n s = 0\n\n while idx:\n\n s += self.bit[idx]\n\n idx -= (idx & (-idx))\n\n return s\n\n\n\n\n\nn,q=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\nbit=BIT(n,a)\n\nfor i in range(q):\n\n t,x,y=list(map(int,input().split()))\n\n if t==0:\n\n bit.add(x+1,y)\n\n else:\n\n print((bit.sum(y)-bit.sum(x)))","code_v0_loc":40,"code_v1_loc":43,"code_v0_num_chars":736,"code_v1_num_chars":1032,"code_v0_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\nclass BIT:\n def __init__(self, n):\n self.bit = [0] * n\n\n def add(self, i, x):\n i += 1\n while i <= len(self.bit):\n self.bit[i - 1] += x\n i += i & -i\n\n def sum_sub(self, i):\n a = 0\n i += 1\n while i:\n a += self.bit[i - 1]\n i -= i & -i\n return a\n\n def sum(self, i, j):\n a = 0\n if j != 0:\n a += self.sum_sub(j - 1)\n if i != 0:\n a -= self.sum_sub(i - 1)\n return a\n\n\nn, q = list(map(int, input().split()))\na = list(map(int, input().split()))\nBit = BIT(n)\nfor i in range(n):\n Bit.add(i, a[i])\nfor i in range(q):\n t, a, b = list(map(int, input().split()))\n if t == 0:\n Bit.add(a, b)\n else:\n print((Bit.sum(a, b)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\nclass BIT:\n def __init__(self, n, data=None):\n self.n = n\n self.bit = [0] * (self.n + 1)\n self.data = [0] * (self.n + 1)\n if data:\n self.build(data)\n\n def build(self, data):\n for i in range(self.n):\n self.bit[i + 1] = self.data[i + 1] = data[i]\n for i in range(1, self.n):\n j = i + (i & (-i))\n if j <= self.n:\n self.bit[j] += self.bit[i]\n\n def add(self, idx, x):\n self.data[idx] += x\n while idx <= self.n:\n self.bit[idx] += x\n idx += idx & (-idx)\n\n def sum(self, idx):\n s = 0\n while idx:\n s += self.bit[idx]\n idx -= idx & (-idx)\n return s\n\n\nn, q = list(map(int, input().split()))\na = list(map(int, input().split()))\nbit = BIT(n, a)\nfor i in range(q):\n t, x, y = list(map(int, input().split()))\n if t == 0:\n bit.add(x + 1, y)\n else:\n print((bit.sum(y) - bit.sum(x)))\n","code_same":false,"relative_loc_diff_percent":6.976744186,"diff":["-input = lambda: sys.stdin.readline().rstrip()","+input = sys.stdin.readline","- def __init__(self, n):","- self.bit = [0] * n","+ def __init__(self, n, data=None):","+ self.n = n","+ self.bit = [0] * (self.n + 1)","+ self.data = [0] * (self.n + 1)","+ if data:","+ self.build(data)","- def add(self, i, x):","- i += 1","- while i <= len(self.bit):","- self.bit[i - 1] += x","- i += i & -i","+ def build(self, data):","+ for i in range(self.n):","+ self.bit[i + 1] = self.data[i + 1] = data[i]","+ for i in range(1, self.n):","+ j = i + (i & (-i))","+ if j <= self.n:","+ self.bit[j] += self.bit[i]","- def sum_sub(self, i):","- a = 0","- i += 1","- while i:","- a += self.bit[i - 1]","- i -= i & -i","- return a","+ def add(self, idx, x):","+ self.data[idx] += x","+ while idx <= self.n:","+ self.bit[idx] += x","+ idx += idx & (-idx)","- def sum(self, i, j):","- a = 0","- if j != 0:","- a += self.sum_sub(j - 1)","- if i != 0:","- a -= self.sum_sub(i - 1)","- return a","+ def sum(self, idx):","+ s = 0","+ while idx:","+ s += self.bit[idx]","+ idx -= idx & (-idx)","+ return s","-Bit = BIT(n)","-for i in range(n):","- Bit.add(i, a[i])","+bit = BIT(n, a)","- t, a, b = list(map(int, input().split()))","+ t, x, y = list(map(int, input().split()))","- Bit.add(a, b)","+ bit.add(x + 1, y)","- print((Bit.sum(a, b)))","+ print((bit.sum(y) - bit.sum(x)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0416535699,"measured_runtime_v1":0.0369151089,"runtime_lift":1.1283610192,"key":["s173428217","s705641811"]} +{"user_id":"u991567869","problem_id":"p03457","language":"python","submission_id_v0":"s794997645","submission_id_v1":"s003818043","cpu_time_v0":421,"cpu_time_v1":256,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.19,"input":"n = int(eval(input()))\n\nt = 0\n\nx = 0\n\ny = 0\n\njudge = True\n\n\n\nfor i in range(n):\n\n t1, x1, y1 = list(map(int, input().split()))\n\n if (abs(x1 - x) + abs(y1 - y))\/(t1 - t) > 1 or (abs(x1 - x) + abs(y1 - y))%2 != (t1 - t)%2:\n\n judge = False\n\n x = x1\n\n y = y1\n\n t = t1\n\n\n\nif judge == True:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(eval(input()))\n\nt = 0\n\nx = 0\n\ny = 0\n\njudge = True\n\n\n\nfor i in range(n):\n\n t1, x1, y1 = list(map(int, input().split()))\n\n if (abs(x1 - x) + abs(y1 - y))\/(t1 - t) > 1 or (abs(x1 - x) + abs(y1 - y))%2 != (t1 - t)%2:\n\n judge = False\n\n x = x1\n\n y = y1\n\n t = t1\n\n\n\nif judge == True:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":18,"code_v1_loc":21,"code_v0_num_chars":336,"code_v1_num_chars":378,"code_v0_no_empty_lines":"n = int(eval(input()))\nt = 0\nx = 0\ny = 0\njudge = True\nfor i in range(n):\n t1, x1, y1 = list(map(int, input().split()))\n if (abs(x1 - x) + abs(y1 - y)) \/ (t1 - t) > 1 or (\n abs(x1 - x) + abs(y1 - y)\n ) % 2 != (t1 - t) % 2:\n judge = False\n x = x1\n y = y1\n t = t1\nif judge == True:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn = int(eval(input()))\nt = 0\nx = 0\ny = 0\njudge = True\nfor i in range(n):\n t1, x1, y1 = list(map(int, input().split()))\n if (abs(x1 - x) + abs(y1 - y)) \/ (t1 - t) > 1 or (\n abs(x1 - x) + abs(y1 - y)\n ) % 2 != (t1 - t) % 2:\n judge = False\n x = x1\n y = y1\n t = t1\nif judge == True:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.0486112199,"measured_runtime_v1":0.0480859191,"runtime_lift":1.0109242111,"key":["s794997645","s003818043"]} +{"user_id":"u813098295","problem_id":"p03633","language":"python","submission_id_v0":"s162307886","submission_id_v1":"s262913267","cpu_time_v0":32,"cpu_time_v1":10,"memory_v0":4392,"memory_v1":2568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.75,"input":"import fractions\n\n\n\nN = int(input())\n\nT = [int(input()) for _ in range(N)]\n\n\n\nans = 1\n\n\n\nfor i in T:\n\n ans = ans \/ fractions.gcd(ans, i) * i\n\n\n\nprint(ans)","target":"def gcd(x, y):\n\n if y == 0:\n\n return x\n\n else:\n\n return gcd(y, x%y)\n\n\n\n\n\ndef lcm(x,y):\n\n return x\/gcd(x, y)*y\n\n\n\n\n\nN = int(input())\n\nT = [int(input()) for _ in range(N)]\n\n \n\nans = 1\n\n \n\nfor i in T:\n\n ans = lcm(ans, i)\n\n \n\nprint(ans)\n","code_v0_loc":11,"code_v1_loc":20,"code_v0_num_chars":165,"code_v1_num_chars":267,"code_v0_no_empty_lines":"import fractions\n\nN = int(input())\nT = [int(input()) for _ in range(N)]\nans = 1\nfor i in T:\n ans = ans \/ fractions.gcd(ans, i) * i\nprint(ans)\n","code_v1_no_empty_lines":"def gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\n\ndef lcm(x, y):\n return x \/ gcd(x, y) * y\n\n\nN = int(input())\nT = [int(input()) for _ in range(N)]\nans = 1\nfor i in T:\n ans = lcm(ans, i)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":45.0,"diff":["-import fractions","+def gcd(x, y):","+ if y == 0:","+ return x","+ else:","+ return gcd(y, x % y)","+","+","+def lcm(x, y):","+ return x \/ gcd(x, y) * y","+","- ans = ans \/ fractions.gcd(ans, i) * i","+ ans = lcm(ans, i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0497034151,"measured_runtime_v1":0.0443915308,"runtime_lift":1.119659857,"key":["s162307886","s262913267"]} +{"user_id":"u796942881","problem_id":"p03212","language":"python","submission_id_v0":"s723509920","submission_id_v1":"s970837024","cpu_time_v0":41,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.1,"input":"class Main:\n\n def __init__(self):\n\n self.N = int(eval(input()))\n\n\n\n def dfs(self, ret, cur, f1, f2, f3):\n\n if self.N < cur:\n\n return ret\n\n\n\n ret += 1 if f1 and f2 and f3 else 0\n\n\n\n ret = self.dfs(ret, cur * 10 + 7, True, f2, f3)\n\n ret = self.dfs(ret, cur * 10 + 5, f1, True, f3)\n\n ret = self.dfs(ret, cur * 10 + 3, f1, f2, True)\n\n\n\n return ret\n\n\n\n @staticmethod\n\n def main():\n\n main = Main()\n\n print((main.dfs(0, 0, False, False, False)))\n\n\n\n\n\nMain.main()\n","target":"N = eval(input())\n\n\n\n\n\ndef f(d, used, next):\n\n num = len(used | set(next))\n\n if d == 0:\n\n if num == 3:\n\n return 1\n\n else:\n\n return 0\n\n elif num == 3:\n\n return 3 ** d\n\n elif num == 2:\n\n return 3 ** d - 2 ** d\n\n else:\n\n return 3 ** d - 2 * (2 ** d) + 1\n\n\n\n\n\ndef high(N, used, ret):\n\n if N:\n\n if int(N[0]) > 3:\n\n ret += f(len(N) - 1, used, \"3\")\n\n if int(N[0]) > 5:\n\n ret += f(len(N) - 1, used, \"5\")\n\n if int(N[0]) > 7:\n\n ret += f(len(N) - 1, used, \"7\")\n\n else:\n\n if len(used) == 3:\n\n ret += 1\n\n return ret\n\n\n\n if N[0] in [\"3\", \"5\", \"7\"]:\n\n ret = high(N[1:], used | set(N[0]), ret)\n\n\n\n return ret\n\n\n\n\n\ndef low():\n\n d = 0\n\n ret = 0\n\n for i in range(len(N) - 1):\n\n ret += 3 * (3 ** d - 2 ** (d + 1) + 1)\n\n d += 1\n\n return ret\n\n\n\n\n\ndef main():\n\n print((high(N, set(), low())))\n\n return\n\n\n\n\n\nmain()\n","code_v0_loc":23,"code_v1_loc":52,"code_v0_num_chars":534,"code_v1_num_chars":985,"code_v0_no_empty_lines":"class Main:\n def __init__(self):\n self.N = int(eval(input()))\n\n def dfs(self, ret, cur, f1, f2, f3):\n if self.N < cur:\n return ret\n ret += 1 if f1 and f2 and f3 else 0\n ret = self.dfs(ret, cur * 10 + 7, True, f2, f3)\n ret = self.dfs(ret, cur * 10 + 5, f1, True, f3)\n ret = self.dfs(ret, cur * 10 + 3, f1, f2, True)\n return ret\n\n @staticmethod\n def main():\n main = Main()\n print((main.dfs(0, 0, False, False, False)))\n\n\nMain.main()\n","code_v1_no_empty_lines":"N = eval(input())\n\n\ndef f(d, used, next):\n num = len(used | set(next))\n if d == 0:\n if num == 3:\n return 1\n else:\n return 0\n elif num == 3:\n return 3**d\n elif num == 2:\n return 3**d - 2**d\n else:\n return 3**d - 2 * (2**d) + 1\n\n\ndef high(N, used, ret):\n if N:\n if int(N[0]) > 3:\n ret += f(len(N) - 1, used, \"3\")\n if int(N[0]) > 5:\n ret += f(len(N) - 1, used, \"5\")\n if int(N[0]) > 7:\n ret += f(len(N) - 1, used, \"7\")\n else:\n if len(used) == 3:\n ret += 1\n return ret\n if N[0] in [\"3\", \"5\", \"7\"]:\n ret = high(N[1:], used | set(N[0]), ret)\n return ret\n\n\ndef low():\n d = 0\n ret = 0\n for i in range(len(N) - 1):\n ret += 3 * (3**d - 2 ** (d + 1) + 1)\n d += 1\n return ret\n\n\ndef main():\n print((high(N, set(), low())))\n return\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":55.7692307692,"diff":["-class Main:","- def __init__(self):","- self.N = int(eval(input()))","-","- def dfs(self, ret, cur, f1, f2, f3):","- if self.N < cur:","- return ret","- ret += 1 if f1 and f2 and f3 else 0","- ret = self.dfs(ret, cur * 10 + 7, True, f2, f3)","- ret = self.dfs(ret, cur * 10 + 5, f1, True, f3)","- ret = self.dfs(ret, cur * 10 + 3, f1, f2, True)","- return ret","-","- @staticmethod","- def main():","- main = Main()","- print((main.dfs(0, 0, False, False, False)))","+N = eval(input())","-Main.main()","+def f(d, used, next):","+ num = len(used | set(next))","+ if d == 0:","+ if num == 3:","+ return 1","+ else:","+ return 0","+ elif num == 3:","+ return 3**d","+ elif num == 2:","+ return 3**d - 2**d","+ else:","+ return 3**d - 2 * (2**d) + 1","+","+","+def high(N, used, ret):","+ if N:","+ if int(N[0]) > 3:","+ ret += f(len(N) - 1, used, \"3\")","+ if int(N[0]) > 5:","+ ret += f(len(N) - 1, used, \"5\")","+ if int(N[0]) > 7:","+ ret += f(len(N) - 1, used, \"7\")","+ else:","+ if len(used) == 3:","+ ret += 1","+ return ret","+ if N[0] in [\"3\", \"5\", \"7\"]:","+ ret = high(N[1:], used | set(N[0]), ret)","+ return ret","+","+","+def low():","+ d = 0","+ ret = 0","+ for i in range(len(N) - 1):","+ ret += 3 * (3**d - 2 ** (d + 1) + 1)","+ d += 1","+ return ret","+","+","+def main():","+ print((high(N, set(), low())))","+ return","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0472678921,"measured_runtime_v1":0.0366414127,"runtime_lift":1.2900128183,"key":["s723509920","s970837024"]} +{"user_id":"u513081876","problem_id":"p03457","language":"python","submission_id_v0":"s032333354","submission_id_v1":"s387493697","cpu_time_v0":411,"cpu_time_v1":364,"memory_v0":21156,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.44,"input":"N = int(eval(input()))\n\ntxy = [0]*(N+1)\n\ntxy[0] = [0, 0, 0]\n\nfor i in range(1, N + 1):\n\n txy[i] = [int(i) for i in input().split()]\n\n\n\nfor i in range(1, N + 1):\n\n dis = abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2])\n\n time = txy[i][0] - txy[i-1][0]\n\n if time < dis or (time - dis) % 2 != 0:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')","target":"N = int(eval(input()))\n\nnow = [0, 0, 0]\n\n\n\nfor i in range(N):\n\n t, x, y = list(map(int, input().split()))\n\n dis = abs(x-now[0]) + abs(y - now[1])\n\n if (t - now[2]) < dis:\n\n print('No')\n\n break\n\n elif ((t - now[2]) - dis) % 2 != 0:\n\n print('No')\n\n break\n\nelse:\n\n print('Yes')\n","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":370,"code_v1_num_chars":306,"code_v0_no_empty_lines":"N = int(eval(input()))\ntxy = [0] * (N + 1)\ntxy[0] = [0, 0, 0]\nfor i in range(1, N + 1):\n txy[i] = [int(i) for i in input().split()]\nfor i in range(1, N + 1):\n dis = abs(txy[i][1] - txy[i - 1][1]) + abs(txy[i][2] - txy[i - 1][2])\n time = txy[i][0] - txy[i - 1][0]\n if time < dis or (time - dis) % 2 != 0:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nnow = [0, 0, 0]\nfor i in range(N):\n t, x, y = list(map(int, input().split()))\n dis = abs(x - now[0]) + abs(y - now[1])\n if (t - now[2]) < dis:\n print(\"No\")\n break\n elif ((t - now[2]) - dis) % 2 != 0:\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-txy = [0] * (N + 1)","-txy[0] = [0, 0, 0]","-for i in range(1, N + 1):","- txy[i] = [int(i) for i in input().split()]","-for i in range(1, N + 1):","- dis = abs(txy[i][1] - txy[i - 1][1]) + abs(txy[i][2] - txy[i - 1][2])","- time = txy[i][0] - txy[i - 1][0]","- if time < dis or (time - dis) % 2 != 0:","+now = [0, 0, 0]","+for i in range(N):","+ t, x, y = list(map(int, input().split()))","+ dis = abs(x - now[0]) + abs(y - now[1])","+ if (t - now[2]) < dis:","+ print(\"No\")","+ break","+ elif ((t - now[2]) - dis) % 2 != 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370270429,"measured_runtime_v1":0.0653060815,"runtime_lift":0.566976949,"key":["s032333354","s387493697"]} +{"user_id":"u049420296","problem_id":"p03944","language":"python","submission_id_v0":"s878163343","submission_id_v1":"s528982595","cpu_time_v0":79,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.48,"input":"w, h, n = list(map(int, input().split()))\n\n\n\narea = [[0 for i in range(w)] for j in range(h)]\n\n\n\nfor i in range(n):\n\n x, y, a = list(map(int, input().split()))\n\n\n\n if a == 1:\n\n for j in range(0, h):\n\n for k in range(0, x):\n\n area[j][k] = 1\n\n elif a == 2:\n\n for j in range(0, h):\n\n for k in range(x, w):\n\n area[j][k] = 1\n\n elif a == 3:\n\n for j in range(0, y):\n\n for k in range(0, w):\n\n area[j][k] = 1\n\n else:\n\n for j in range(y, h):\n\n for k in range(0, w):\n\n area[j][k] = 1\n\n\n\nans = 0\n\nfor i in range(h):\n\n for j in range(w):\n\n if area[i][j] == 0: ans += 1\n\n\n\nprint(ans)","target":"w, h, n = list(map(int, input().split()))\n\n\n\nl = 0\n\nr = w\n\nd = 0\n\nu = h\n\n\n\nfor i in range(n):\n\n x, y, a = list(map(int, input().split()))\n\n if a == 1: l = max(l, x)\n\n if a == 2: r = min(r, x)\n\n if a == 3: d = max(d, y)\n\n if a == 4: u = min(u, y)\n\n\n\nans = max(0, r - l) * max(0, u - d)\n\n\n\nprint(ans)","code_v0_loc":30,"code_v1_loc":17,"code_v0_num_chars":714,"code_v1_num_chars":301,"code_v0_no_empty_lines":"w, h, n = list(map(int, input().split()))\narea = [[0 for i in range(w)] for j in range(h)]\nfor i in range(n):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n for j in range(0, h):\n for k in range(0, x):\n area[j][k] = 1\n elif a == 2:\n for j in range(0, h):\n for k in range(x, w):\n area[j][k] = 1\n elif a == 3:\n for j in range(0, y):\n for k in range(0, w):\n area[j][k] = 1\n else:\n for j in range(y, h):\n for k in range(0, w):\n area[j][k] = 1\nans = 0\nfor i in range(h):\n for j in range(w):\n if area[i][j] == 0:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"w, h, n = list(map(int, input().split()))\nl = 0\nr = w\nd = 0\nu = h\nfor i in range(n):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n l = max(l, x)\n if a == 2:\n r = min(r, x)\n if a == 3:\n d = max(d, y)\n if a == 4:\n u = min(u, y)\nans = max(0, r - l) * max(0, u - d)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":43.3333333333,"diff":["-area = [[0 for i in range(w)] for j in range(h)]","+l = 0","+r = w","+d = 0","+u = h","- for j in range(0, h):","- for k in range(0, x):","- area[j][k] = 1","- elif a == 2:","- for j in range(0, h):","- for k in range(x, w):","- area[j][k] = 1","- elif a == 3:","- for j in range(0, y):","- for k in range(0, w):","- area[j][k] = 1","- else:","- for j in range(y, h):","- for k in range(0, w):","- area[j][k] = 1","-ans = 0","-for i in range(h):","- for j in range(w):","- if area[i][j] == 0:","- ans += 1","+ l = max(l, x)","+ if a == 2:","+ r = min(r, x)","+ if a == 3:","+ d = max(d, y)","+ if a == 4:","+ u = min(u, y)","+ans = max(0, r - l) * max(0, u - d)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373903382,"measured_runtime_v1":0.2045436459,"runtime_lift":0.1827988253,"key":["s878163343","s528982595"]} +{"user_id":"u525065967","problem_id":"p02597","language":"python","submission_id_v0":"s024306964","submission_id_v1":"s631850174","cpu_time_v0":84,"cpu_time_v1":50,"memory_v0":10680,"memory_v1":10624,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.48,"input":"n = int(eval(input()))\n\nC = list(eval(input()))\n\nl, r, c = 0, n-1, 0\n\nwhile l < r:\n\n if C[l] == 'W' and C[r] == 'R':\n\n l += 1\n\n r -= 1\n\n c += 1\n\n elif C[l] != 'W': l += 1\n\n elif C[r] != 'R': r -= 1\n\nprint(c)\n","target":"n = int(eval(input()))\n\nC = list(eval(input()))\n\nr = C.count('R')\n\nc = 0\n\nfor i in range(r, n):\n\n if C[i] == 'R': c += 1\n\nprint(c)\n","code_v0_loc":11,"code_v1_loc":7,"code_v0_num_chars":226,"code_v1_num_chars":122,"code_v0_no_empty_lines":"n = int(eval(input()))\nC = list(eval(input()))\nl, r, c = 0, n - 1, 0\nwhile l < r:\n if C[l] == \"W\" and C[r] == \"R\":\n l += 1\n r -= 1\n c += 1\n elif C[l] != \"W\":\n l += 1\n elif C[r] != \"R\":\n r -= 1\nprint(c)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nC = list(eval(input()))\nr = C.count(\"R\")\nc = 0\nfor i in range(r, n):\n if C[i] == \"R\":\n c += 1\nprint(c)\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-l, r, c = 0, n - 1, 0","-while l < r:","- if C[l] == \"W\" and C[r] == \"R\":","- l += 1","- r -= 1","+r = C.count(\"R\")","+c = 0","+for i in range(r, n):","+ if C[i] == \"R\":","- elif C[l] != \"W\":","- l += 1","- elif C[r] != \"R\":","- r -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0696158571,"measured_runtime_v1":0.0399643173,"runtime_lift":1.741950364,"key":["s024306964","s631850174"]} +{"user_id":"u262566745","problem_id":"p02265","language":"python","submission_id_v0":"s541593497","submission_id_v1":"s546681364","cpu_time_v0":4050,"cpu_time_v1":1810,"memory_v0":71924,"memory_v1":71828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.31,"input":"from collections import deque\n\n\n\nqueue = deque()\n\n\n\nfor _ in range(int(eval(input()))):\n\n commands = input().split(\" \")\n\n if commands[0] == \"insert\":\n\n queue.appendleft(commands[1])\n\n elif commands[0] == \"delete\":\n\n try:\n\n queue.remove(commands[1])\n\n except ValueError:\n\n pass\n\n elif commands[0] == \"deleteFirst\":\n\n queue.popleft()\n\n elif commands[0] == \"deleteLast\":\n\n queue.pop()\n\n\n\nprint((\" \".join(queue)))","target":"import sys\n\nfrom collections import deque\n\nn = int(eval(input()))\n\nq = deque()\n\nfor i in range(n):\n\n c = sys.stdin.readline()[:-1]\n\n if c[0] == 'i':\n\n q.appendleft(c[7:])\n\n elif c[6] == ' ':\n\n try:\n\n q.remove(c[7:])\n\n except:\n\n pass\n\n elif c[6] == 'F':\n\n q.popleft()\n\n else:\n\n q.pop()\n\nprint((*q))","code_v0_loc":19,"code_v1_loc":18,"code_v0_num_chars":473,"code_v1_num_chars":361,"code_v0_no_empty_lines":"from collections import deque\n\nqueue = deque()\nfor _ in range(int(eval(input()))):\n commands = input().split(\" \")\n if commands[0] == \"insert\":\n queue.appendleft(commands[1])\n elif commands[0] == \"delete\":\n try:\n queue.remove(commands[1])\n except ValueError:\n pass\n elif commands[0] == \"deleteFirst\":\n queue.popleft()\n elif commands[0] == \"deleteLast\":\n queue.pop()\nprint((\" \".join(queue)))\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque\n\nn = int(eval(input()))\nq = deque()\nfor i in range(n):\n c = sys.stdin.readline()[:-1]\n if c[0] == \"i\":\n q.appendleft(c[7:])\n elif c[6] == \" \":\n try:\n q.remove(c[7:])\n except:\n pass\n elif c[6] == \"F\":\n q.popleft()\n else:\n q.pop()\nprint((*q))\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["+import sys","-queue = deque()","-for _ in range(int(eval(input()))):","- commands = input().split(\" \")","- if commands[0] == \"insert\":","- queue.appendleft(commands[1])","- elif commands[0] == \"delete\":","+n = int(eval(input()))","+q = deque()","+for i in range(n):","+ c = sys.stdin.readline()[:-1]","+ if c[0] == \"i\":","+ q.appendleft(c[7:])","+ elif c[6] == \" \":","- queue.remove(commands[1])","- except ValueError:","+ q.remove(c[7:])","+ except:","- elif commands[0] == \"deleteFirst\":","- queue.popleft()","- elif commands[0] == \"deleteLast\":","- queue.pop()","-print((\" \".join(queue)))","+ elif c[6] == \"F\":","+ q.popleft()","+ else:","+ q.pop()","+print((*q))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0361119258,"measured_runtime_v1":0.0414488452,"runtime_lift":0.8712408183,"key":["s541593497","s546681364"]} +{"user_id":"u118642796","problem_id":"p03310","language":"python","submission_id_v0":"s863565074","submission_id_v1":"s795616523","cpu_time_v0":1089,"cpu_time_v1":907,"memory_v0":29012,"memory_v1":31044,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.71,"input":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nS = [0]\n\nfor i in range(N):\n\n S.append(S[i]+A[i])\n\n\n\na_before = 1\n\nc_before = 3\n\nans_tmp = []\n\nfor b in range(2,N-1):\n\n if S[a_before] > S[b] - S[a_before]:\n\n a=a_before\n\n else:\n\n for i in range(a_before,b):\n\n if S[i] > S[b] - S[i]:\n\n if abs(S[b]-S[i-1]-S[i-1]) < abs(S[b]-S[i]-S[i]):\n\n a=i-1\n\n a_before = i-1\n\n break\n\n else:\n\n a=i\n\n a_before = i\n\n break\n\n else:\n\n a=b-1\n\n a_before = b-1\n\n\n\n if S[c_before] - S[b] > S[N] - S[c_before]:\n\n c=c_before\n\n else:\n\n for i in range(c_before,N):\n\n if S[i] - S[b] > S[N] - S[i]:\n\n if abs((S[N]-S[i-1]) - (S[i-1]-S[b])) < abs((S[N]-S[i]) - (S[i]-S[b])):\n\n c=i-1\n\n c_before = i-1\n\n break\n\n else:\n\n c=i\n\n c_before = i\n\n break\n\n else:\n\n c=N-1\n\n c_before = N-1\n\n\n\n ans_tmp.append(max(S[N]-S[c],S[c]-S[b],S[b]-S[a],S[a]-S[0])-min(S[N]-S[c],S[c]-S[b],S[b]-S[a],S[a]-S[0]))\n\n\n\nprint((min(ans_tmp)))","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nS = [0]\n\nfor i in range(N):\n\n S.append(S[i]+A[i])\n\n\n\na = 1\n\nc = 3\n\nans_tmp = []\n\nfor b in range(2,N-1):\n\n while abs(S[b]-S[a]-S[a]) > abs(S[b]-S[a+1]-S[a+1]):\n\n a += 1\n\n\n\n while abs((S[N]-S[c]) - (S[c]-S[b])) > abs((S[N]-S[c+1]) - (S[c+1]-S[b])):\n\n c += 1\n\n\n\n ans_tmp.append(max(S[N]-S[c],S[c]-S[b],S[b]-S[a],S[a]-S[0])-min(S[N]-S[c],S[c]-S[b],S[b]-S[a],S[a]-S[0]))\n\n\n\nprint((min(ans_tmp)))","code_v0_loc":48,"code_v1_loc":20,"code_v0_num_chars":1746,"code_v1_num_chars":502,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nS = [0]\nfor i in range(N):\n S.append(S[i] + A[i])\na_before = 1\nc_before = 3\nans_tmp = []\nfor b in range(2, N - 1):\n if S[a_before] > S[b] - S[a_before]:\n a = a_before\n else:\n for i in range(a_before, b):\n if S[i] > S[b] - S[i]:\n if abs(S[b] - S[i - 1] - S[i - 1]) < abs(S[b] - S[i] - S[i]):\n a = i - 1\n a_before = i - 1\n break\n else:\n a = i\n a_before = i\n break\n else:\n a = b - 1\n a_before = b - 1\n if S[c_before] - S[b] > S[N] - S[c_before]:\n c = c_before\n else:\n for i in range(c_before, N):\n if S[i] - S[b] > S[N] - S[i]:\n if abs((S[N] - S[i - 1]) - (S[i - 1] - S[b])) < abs(\n (S[N] - S[i]) - (S[i] - S[b])\n ):\n c = i - 1\n c_before = i - 1\n break\n else:\n c = i\n c_before = i\n break\n else:\n c = N - 1\n c_before = N - 1\n ans_tmp.append(\n max(S[N] - S[c], S[c] - S[b], S[b] - S[a], S[a] - S[0])\n - min(S[N] - S[c], S[c] - S[b], S[b] - S[a], S[a] - S[0])\n )\nprint((min(ans_tmp)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nS = [0]\nfor i in range(N):\n S.append(S[i] + A[i])\na = 1\nc = 3\nans_tmp = []\nfor b in range(2, N - 1):\n while abs(S[b] - S[a] - S[a]) > abs(S[b] - S[a + 1] - S[a + 1]):\n a += 1\n while abs((S[N] - S[c]) - (S[c] - S[b])) > abs(\n (S[N] - S[c + 1]) - (S[c + 1] - S[b])\n ):\n c += 1\n ans_tmp.append(\n max(S[N] - S[c], S[c] - S[b], S[b] - S[a], S[a] - S[0])\n - min(S[N] - S[c], S[c] - S[b], S[b] - S[a], S[a] - S[0])\n )\nprint((min(ans_tmp)))\n","code_same":false,"relative_loc_diff_percent":58.3333333333,"diff":["-a_before = 1","-c_before = 3","+a = 1","+c = 3","- if S[a_before] > S[b] - S[a_before]:","- a = a_before","- else:","- for i in range(a_before, b):","- if S[i] > S[b] - S[i]:","- if abs(S[b] - S[i - 1] - S[i - 1]) < abs(S[b] - S[i] - S[i]):","- a = i - 1","- a_before = i - 1","- break","- else:","- a = i","- a_before = i","- break","- else:","- a = b - 1","- a_before = b - 1","- if S[c_before] - S[b] > S[N] - S[c_before]:","- c = c_before","- else:","- for i in range(c_before, N):","- if S[i] - S[b] > S[N] - S[i]:","- if abs((S[N] - S[i - 1]) - (S[i - 1] - S[b])) < abs(","- (S[N] - S[i]) - (S[i] - S[b])","- ):","- c = i - 1","- c_before = i - 1","- break","- else:","- c = i","- c_before = i","- break","- else:","- c = N - 1","- c_before = N - 1","+ while abs(S[b] - S[a] - S[a]) > abs(S[b] - S[a + 1] - S[a + 1]):","+ a += 1","+ while abs((S[N] - S[c]) - (S[c] - S[b])) > abs(","+ (S[N] - S[c + 1]) - (S[c + 1] - S[b])","+ ):","+ c += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0378454208,"measured_runtime_v1":0.0396442413,"runtime_lift":0.9546259319,"key":["s863565074","s795616523"]} +{"user_id":"u864197622","problem_id":"p02704","language":"python","submission_id_v0":"s864115672","submission_id_v1":"s162142944","cpu_time_v0":739,"cpu_time_v1":609,"memory_v0":191692,"memory_v1":183312,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.59,"input":"N = int(eval(input()))\n\nS = [int(a) for a in input().split()]\n\nT = [int(a) for a in input().split()]\n\nU = [int(a) for a in input().split()]\n\nV = [int(a) for a in input().split()]\n\nX = [[0] * N for _ in range(N)]\n\nm = (1 << 64) - 1\n\n\n\nfor i in range(N):\n\n for j in range(N):\n\n if not S[i]:\n\n X[i][j] |= U[i]\n\n if not T[j]:\n\n X[i][j] |= V[j]\n\n X[i][j] |= U[i] & V[j]\n\n\n\nA1 = [[m] * N for _ in range(N)]\n\nA2 = [[m] * N for _ in range(N)]\n\nfor i in range(N-1)[::-1]:\n\n for j in range(N):\n\n A2[i][j] = A2[i+1][j] & X[i+1][j]\n\n\n\nfor i in range(N):\n\n a = 0\n\n for j in range(N):\n\n a |= X[i][j]\n\n for j in range(N):\n\n if i:\n\n A1[i][j] = A1[i-1][j] & X[i-1][j]\n\n if S[i] and not T[j]:\n\n X[i][j] |= U[i] & ~((A1[i][j] & A2[i][j]) | a)\n\n a |= X[i][j]\n\n\n\nA1 = [[m] * N for _ in range(N)]\n\nA2 = [[m] * N for _ in range(N)]\n\nfor j in range(N-1)[::-1]:\n\n for i in range(N):\n\n A2[i][j] = A2[i][j+1] & X[i][j+1]\n\n\n\nfor j in range(N):\n\n a = 0\n\n for i in range(N):\n\n a |= X[i][j]\n\n for i in range(N):\n\n if j:\n\n A1[i][j] = A1[i][j-1] & X[i][j-1]\n\n if T[j] and not S[i]:\n\n X[i][j] |= V[j] & ~((A1[i][j] & A2[i][j]) | a)\n\n a |= X[i][j]\n\n\n\nfor i in range(N):\n\n if S[i] == 0:\n\n s = m\n\n for j in range(N):\n\n s &= X[i][j]\n\n if s != U[i]:\n\n print((-1))\n\n exit()\n\n else:\n\n s = 0\n\n for j in range(N):\n\n s |= X[i][j]\n\n if s != U[i]:\n\n print((-1))\n\n exit()\n\n\n\nfor j in range(N):\n\n if T[j] == 0:\n\n s = m\n\n for i in range(N):\n\n s &= X[i][j]\n\n if s != V[j]:\n\n print((-1))\n\n exit()\n\n else:\n\n s = 0\n\n for i in range(N):\n\n s |= X[i][j]\n\n if s != V[j]:\n\n print((-1))\n\n exit()\n\n\n\nfor x in X:\n\n print((*x))","target":"from functools import reduce\n\nfrom operator import and_, or_\n\n\n\nN = int(eval(input()))\n\nS, T, U, V = [[int(a) for a in input().split()] for _ in range(4)]\n\nX = [[U[i] & V[j] if S[i] and T[j] else U[i] if T[j] else V[j] if S[i] else U[i] | V[j] for j in range(N)] for i in range(N)]\n\nm = (1 << 64) - 1\n\n\n\nfor _ in range(2):\n\n A1 = [[m] * N for _ in range(N)]\n\n A2 = [[m] * N for _ in range(N)]\n\n for i in range(N-1)[::-1]:\n\n for j in range(N):\n\n A2[i][j] = A2[i+1][j] & X[i+1][j]\n\n\n\n for i in range(N):\n\n a = ~U[i] | reduce(or_, X[i])\n\n for j in range(N):\n\n if i:\n\n A1[i][j] = A1[i-1][j] & X[i-1][j]\n\n if S[i] and not T[j]:\n\n X[i][j] |= ~(A1[i][j] & A2[i][j] | a)\n\n a |= X[i][j]\n\n \n\n X = [[X[j][i] for j in range(N)] for i in range(N)]\n\n S, T, U, V = T, S, V, U\n\n\n\nif [reduce(or_ if S[i] else and_, x) for i, x in enumerate(X)] != U or [reduce(or_ if T[j] else and_, x) for j, x in enumerate(zip(*X))] != V:\n\n print((-1))\n\n exit()\n\n\n\nfor x in X:\n\n print((*x))","code_v0_loc":84,"code_v1_loc":33,"code_v0_num_chars":1964,"code_v1_num_chars":1073,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = [int(a) for a in input().split()]\nT = [int(a) for a in input().split()]\nU = [int(a) for a in input().split()]\nV = [int(a) for a in input().split()]\nX = [[0] * N for _ in range(N)]\nm = (1 << 64) - 1\nfor i in range(N):\n for j in range(N):\n if not S[i]:\n X[i][j] |= U[i]\n if not T[j]:\n X[i][j] |= V[j]\n X[i][j] |= U[i] & V[j]\nA1 = [[m] * N for _ in range(N)]\nA2 = [[m] * N for _ in range(N)]\nfor i in range(N - 1)[::-1]:\n for j in range(N):\n A2[i][j] = A2[i + 1][j] & X[i + 1][j]\nfor i in range(N):\n a = 0\n for j in range(N):\n a |= X[i][j]\n for j in range(N):\n if i:\n A1[i][j] = A1[i - 1][j] & X[i - 1][j]\n if S[i] and not T[j]:\n X[i][j] |= U[i] & ~((A1[i][j] & A2[i][j]) | a)\n a |= X[i][j]\nA1 = [[m] * N for _ in range(N)]\nA2 = [[m] * N for _ in range(N)]\nfor j in range(N - 1)[::-1]:\n for i in range(N):\n A2[i][j] = A2[i][j + 1] & X[i][j + 1]\nfor j in range(N):\n a = 0\n for i in range(N):\n a |= X[i][j]\n for i in range(N):\n if j:\n A1[i][j] = A1[i][j - 1] & X[i][j - 1]\n if T[j] and not S[i]:\n X[i][j] |= V[j] & ~((A1[i][j] & A2[i][j]) | a)\n a |= X[i][j]\nfor i in range(N):\n if S[i] == 0:\n s = m\n for j in range(N):\n s &= X[i][j]\n if s != U[i]:\n print((-1))\n exit()\n else:\n s = 0\n for j in range(N):\n s |= X[i][j]\n if s != U[i]:\n print((-1))\n exit()\nfor j in range(N):\n if T[j] == 0:\n s = m\n for i in range(N):\n s &= X[i][j]\n if s != V[j]:\n print((-1))\n exit()\n else:\n s = 0\n for i in range(N):\n s |= X[i][j]\n if s != V[j]:\n print((-1))\n exit()\nfor x in X:\n print((*x))\n","code_v1_no_empty_lines":"from functools import reduce\nfrom operator import and_, or_\n\nN = int(eval(input()))\nS, T, U, V = [[int(a) for a in input().split()] for _ in range(4)]\nX = [\n [\n U[i] & V[j]\n if S[i] and T[j]\n else U[i]\n if T[j]\n else V[j]\n if S[i]\n else U[i] | V[j]\n for j in range(N)\n ]\n for i in range(N)\n]\nm = (1 << 64) - 1\nfor _ in range(2):\n A1 = [[m] * N for _ in range(N)]\n A2 = [[m] * N for _ in range(N)]\n for i in range(N - 1)[::-1]:\n for j in range(N):\n A2[i][j] = A2[i + 1][j] & X[i + 1][j]\n for i in range(N):\n a = ~U[i] | reduce(or_, X[i])\n for j in range(N):\n if i:\n A1[i][j] = A1[i - 1][j] & X[i - 1][j]\n if S[i] and not T[j]:\n X[i][j] |= ~(A1[i][j] & A2[i][j] | a)\n a |= X[i][j]\n X = [[X[j][i] for j in range(N)] for i in range(N)]\n S, T, U, V = T, S, V, U\nif [reduce(or_ if S[i] else and_, x) for i, x in enumerate(X)] != U or [\n reduce(or_ if T[j] else and_, x) for j, x in enumerate(zip(*X))\n] != V:\n print((-1))\n exit()\nfor x in X:\n print((*x))\n","code_same":false,"relative_loc_diff_percent":60.7142857143,"diff":["+from functools import reduce","+from operator import and_, or_","+","-S = [int(a) for a in input().split()]","-T = [int(a) for a in input().split()]","-U = [int(a) for a in input().split()]","-V = [int(a) for a in input().split()]","-X = [[0] * N for _ in range(N)]","+S, T, U, V = [[int(a) for a in input().split()] for _ in range(4)]","+X = [","+ [","+ U[i] & V[j]","+ if S[i] and T[j]","+ else U[i]","+ if T[j]","+ else V[j]","+ if S[i]","+ else U[i] | V[j]","+ for j in range(N)","+ ]","+ for i in range(N)","+]","-for i in range(N):","- for j in range(N):","- if not S[i]:","- X[i][j] |= U[i]","- if not T[j]:","- X[i][j] |= V[j]","- X[i][j] |= U[i] & V[j]","-A1 = [[m] * N for _ in range(N)]","-A2 = [[m] * N for _ in range(N)]","-for i in range(N - 1)[::-1]:","- for j in range(N):","- A2[i][j] = A2[i + 1][j] & X[i + 1][j]","-for i in range(N):","- a = 0","- for j in range(N):","- a |= X[i][j]","- for j in range(N):","- if i:","- A1[i][j] = A1[i - 1][j] & X[i - 1][j]","- if S[i] and not T[j]:","- X[i][j] |= U[i] & ~((A1[i][j] & A2[i][j]) | a)","- a |= X[i][j]","-A1 = [[m] * N for _ in range(N)]","-A2 = [[m] * N for _ in range(N)]","-for j in range(N - 1)[::-1]:","+for _ in range(2):","+ A1 = [[m] * N for _ in range(N)]","+ A2 = [[m] * N for _ in range(N)]","+ for i in range(N - 1)[::-1]:","+ for j in range(N):","+ A2[i][j] = A2[i + 1][j] & X[i + 1][j]","- A2[i][j] = A2[i][j + 1] & X[i][j + 1]","-for j in range(N):","- a = 0","- for i in range(N):","- a |= X[i][j]","- for i in range(N):","- if j:","- A1[i][j] = A1[i][j - 1] & X[i][j - 1]","- if T[j] and not S[i]:","- X[i][j] |= V[j] & ~((A1[i][j] & A2[i][j]) | a)","- a |= X[i][j]","-for i in range(N):","- if S[i] == 0:","- s = m","+ a = ~U[i] | reduce(or_, X[i])","- s &= X[i][j]","- if s != U[i]:","- print((-1))","- exit()","- else:","- s = 0","- for j in range(N):","- s |= X[i][j]","- if s != U[i]:","- print((-1))","- exit()","-for j in range(N):","- if T[j] == 0:","- s = m","- for i in range(N):","- s &= X[i][j]","- if s != V[j]:","- print((-1))","- exit()","- else:","- s = 0","- for i in range(N):","- s |= X[i][j]","- if s != V[j]:","- print((-1))","- exit()","+ if i:","+ A1[i][j] = A1[i - 1][j] & X[i - 1][j]","+ if S[i] and not T[j]:","+ X[i][j] |= ~(A1[i][j] & A2[i][j] | a)","+ a |= X[i][j]","+ X = [[X[j][i] for j in range(N)] for i in range(N)]","+ S, T, U, V = T, S, V, U","+if [reduce(or_ if S[i] else and_, x) for i, x in enumerate(X)] != U or [","+ reduce(or_ if T[j] else and_, x) for j, x in enumerate(zip(*X))","+] != V:","+ print((-1))","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0781061779,"measured_runtime_v1":0.1034998296,"runtime_lift":0.754650304,"key":["s864115672","s162142944"]} +{"user_id":"u815763296","problem_id":"p02678","language":"python","submission_id_v0":"s214907717","submission_id_v1":"s820089047","cpu_time_v0":718,"cpu_time_v1":633,"memory_v0":34092,"memory_v1":34132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.84,"input":"from collections import deque\n\nN, M = list(map(int, input().split()))\n\nMlist = [[] for _ in range(N+1)]\n\nfor i in range(M):\n\n a, b = list(map(int, input().split()))\n\n Mlist[a].append(b)\n\n Mlist[b].append(a)\n\n\n\nans = [0] * (N+1)\n\n\n\nd = deque()\n\nd.append(1)\n\ncount = 0\n\nwhile count != N:\n\n Q = d.popleft()\n\n for i in Mlist[Q]:\n\n if ans[i] == 0:\n\n ans[i] = Q\n\n d.append(i)\n\n count = count+1\n\nprint('Yes')\n\nfor i in range(N-1):\n\n print((ans[i+2]))\n","target":"from collections import deque\n\nN, M = list(map(int, input().split()))\n\nroad = [[] for _ in range(N+1)]\n\nans = [-1]*(N+1)\n\nd = deque()\n\nfor i in range(M):\n\n A, B = list(map(int, input().split()))\n\n road[A].append(B)\n\n road[B].append(A)\n\nd.append(1)\n\nwhile len(d) != 0:\n\n look = d.popleft()\n\n for i in road[look]:\n\n if ans[i] == -1:\n\n d.append(i)\n\n ans[i] = look\n\n\n\nprint(\"Yes\")\n\nfor i in range(2, N+1):\n\n print((ans[i]))\n","code_v0_loc":23,"code_v1_loc":20,"code_v0_num_chars":488,"code_v1_num_chars":453,"code_v0_no_empty_lines":"from collections import deque\n\nN, M = list(map(int, input().split()))\nMlist = [[] for _ in range(N + 1)]\nfor i in range(M):\n a, b = list(map(int, input().split()))\n Mlist[a].append(b)\n Mlist[b].append(a)\nans = [0] * (N + 1)\nd = deque()\nd.append(1)\ncount = 0\nwhile count != N:\n Q = d.popleft()\n for i in Mlist[Q]:\n if ans[i] == 0:\n ans[i] = Q\n d.append(i)\n count = count + 1\nprint(\"Yes\")\nfor i in range(N - 1):\n print((ans[i + 2]))\n","code_v1_no_empty_lines":"from collections import deque\n\nN, M = list(map(int, input().split()))\nroad = [[] for _ in range(N + 1)]\nans = [-1] * (N + 1)\nd = deque()\nfor i in range(M):\n A, B = list(map(int, input().split()))\n road[A].append(B)\n road[B].append(A)\nd.append(1)\nwhile len(d) != 0:\n look = d.popleft()\n for i in road[look]:\n if ans[i] == -1:\n d.append(i)\n ans[i] = look\nprint(\"Yes\")\nfor i in range(2, N + 1):\n print((ans[i]))\n","code_same":false,"relative_loc_diff_percent":13.0434782609,"diff":["-Mlist = [[] for _ in range(N + 1)]","+road = [[] for _ in range(N + 1)]","+ans = [-1] * (N + 1)","+d = deque()","- a, b = list(map(int, input().split()))","- Mlist[a].append(b)","- Mlist[b].append(a)","-ans = [0] * (N + 1)","-d = deque()","+ A, B = list(map(int, input().split()))","+ road[A].append(B)","+ road[B].append(A)","-count = 0","-while count != N:","- Q = d.popleft()","- for i in Mlist[Q]:","- if ans[i] == 0:","- ans[i] = Q","+while len(d) != 0:","+ look = d.popleft()","+ for i in road[look]:","+ if ans[i] == -1:","- count = count + 1","+ ans[i] = look","-for i in range(N - 1):","- print((ans[i + 2]))","+for i in range(2, N + 1):","+ print((ans[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.097682735,"measured_runtime_v1":0.1034411479,"runtime_lift":0.9443315059,"key":["s214907717","s820089047"]} +{"user_id":"u887207211","problem_id":"p03623","language":"python","submission_id_v0":"s415603893","submission_id_v1":"s123480619","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"x, a, b = list(map(int,input().split()))\n\nA = abs(x - a)\n\nB = abs(x - b)\n\nif(A < B):\n\n print('A')\n\nelse:\n\n print('B')","target":"x, a, b = list(map(int,input().split()))\n\nif(abs(x-a) < abs(x-b)):\n\n print('A')\n\nelse:\n\n print('B')","code_v0_loc":7,"code_v1_loc":5,"code_v0_num_chars":113,"code_v1_num_chars":95,"code_v0_no_empty_lines":"x, a, b = list(map(int, input().split()))\nA = abs(x - a)\nB = abs(x - b)\nif A < B:\n print(\"A\")\nelse:\n print(\"B\")\n","code_v1_no_empty_lines":"x, a, b = list(map(int, input().split()))\nif abs(x - a) < abs(x - b):\n print(\"A\")\nelse:\n print(\"B\")\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-A = abs(x - a)","-B = abs(x - b)","-if A < B:","+if abs(x - a) < abs(x - b):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0680725009,"measured_runtime_v1":0.0520828063,"runtime_lift":1.3070052408,"key":["s415603893","s123480619"]} +{"user_id":"u499381410","problem_id":"p02851","language":"python","submission_id_v0":"s531395097","submission_id_v1":"s400560886","cpu_time_v0":319,"cpu_time_v1":289,"memory_v0":85952,"memory_v1":86472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.4,"input":"from collections import defaultdict, deque, Counter\n\nfrom heapq import heappush, heappop, heapify\n\nimport math\n\nimport bisect\n\nimport random\n\nfrom itertools import permutations, accumulate, combinations, product\n\nimport sys\n\nimport string\n\nfrom bisect import bisect_left, bisect_right\n\nfrom math import factorial, ceil, floor\n\nfrom operator import mul\n\nfrom functools import reduce\n\n\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = 10 ** 20\n\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\n\ndef I(): return int(sys.stdin.buffer.readline())\n\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\n\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\n\ndef IR(n): return [I() for i in range(n)]\n\ndef LIR(n): return [LI() for i in range(n)]\n\ndef SR(n): return [S() for i in range(n)]\n\ndef LSR(n): return [LS() for i in range(n)]\n\ndef SRL(n): return [list(S()) for i in range(n)]\n\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\n\nmod = 1000000007\n\n\n\n\n\nn, k = LI()\n\nA = [0] + LI()\n\n\n\n\n\n\n\nfor i in range(1, n + 1):\n\n A[i] = (A[i] + A[i - 1]) % k\n\n\n\n\n\nfor i in range(n + 1):\n\n A[i] = (A[i] - i) % k\n\n\n\n\n\n\n\nans = 0\n\nD = defaultdict(int)\n\nfor j in range(n, -1, -1):\n\n ans += D[A[j]]\n\n D[A[j]] += 1\n\n if j + k - 1 < n + 1:\n\n D[A[j + k - 1]] -= 1\n\n\n\n\n\nif k == 1:\n\n print((0))\n\nelse:\n\n print(ans)","target":"from collections import defaultdict, deque, Counter\n\nfrom heapq import heappush, heappop, heapify\n\nimport math\n\nimport bisect\n\nimport random\n\nfrom itertools import permutations, accumulate, combinations, product\n\nimport sys\n\nimport string\n\nfrom bisect import bisect_left, bisect_right\n\nfrom math import factorial, ceil, floor\n\nfrom operator import mul\n\nfrom functools import reduce\n\n\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = 10 ** 20\n\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\n\ndef I(): return int(sys.stdin.buffer.readline())\n\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\n\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\n\ndef IR(n): return [I() for i in range(n)]\n\ndef LIR(n): return [LI() for i in range(n)]\n\ndef SR(n): return [S() for i in range(n)]\n\ndef LSR(n): return [LS() for i in range(n)]\n\ndef SRL(n): return [list(S()) for i in range(n)]\n\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\n\nmod = 1000000007\n\n\n\n\n\nn, k = LI()\n\nA = [0] + LI()\n\n\n\nfor i in range(1, n + 1):\n\n A[i] = (A[i] + A[i - 1] - 1) % k\n\n\n\n\n\nans = 0\n\nD = defaultdict(int)\n\nfor j in range(n, -1, -1):\n\n ans += D[A[j]]\n\n D[A[j]] += 1\n\n if j + k - 1 < n + 1:\n\n D[A[j + k - 1]] -= 1\n\n\n\n\n\nif k == 1:\n\n print((0))\n\nelse:\n\n print(ans)\n","code_v0_loc":56,"code_v1_loc":49,"code_v0_num_chars":1386,"code_v1_num_chars":1330,"code_v0_no_empty_lines":"from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor\nfrom operator import mul\nfrom functools import reduce\n\nsys.setrecursionlimit(2147483647)\nINF = 10**20\n\n\ndef LI():\n return list(map(int, sys.stdin.buffer.readline().split()))\n\n\ndef I():\n return int(sys.stdin.buffer.readline())\n\n\ndef LS():\n return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\").split()\n\n\ndef S():\n return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\ndef SRL(n):\n return [list(S()) for i in range(n)]\n\n\ndef MSRL(n):\n return [[int(j) for j in list(S())] for i in range(n)]\n\n\nmod = 1000000007\nn, k = LI()\nA = [0] + LI()\nfor i in range(1, n + 1):\n A[i] = (A[i] + A[i - 1]) % k\nfor i in range(n + 1):\n A[i] = (A[i] - i) % k\nans = 0\nD = defaultdict(int)\nfor j in range(n, -1, -1):\n ans += D[A[j]]\n D[A[j]] += 1\n if j + k - 1 < n + 1:\n D[A[j + k - 1]] -= 1\nif k == 1:\n print((0))\nelse:\n print(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor\nfrom operator import mul\nfrom functools import reduce\n\nsys.setrecursionlimit(2147483647)\nINF = 10**20\n\n\ndef LI():\n return list(map(int, sys.stdin.buffer.readline().split()))\n\n\ndef I():\n return int(sys.stdin.buffer.readline())\n\n\ndef LS():\n return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\").split()\n\n\ndef S():\n return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\ndef SRL(n):\n return [list(S()) for i in range(n)]\n\n\ndef MSRL(n):\n return [[int(j) for j in list(S())] for i in range(n)]\n\n\nmod = 1000000007\nn, k = LI()\nA = [0] + LI()\nfor i in range(1, n + 1):\n A[i] = (A[i] + A[i - 1] - 1) % k\nans = 0\nD = defaultdict(int)\nfor j in range(n, -1, -1):\n ans += D[A[j]]\n D[A[j]] += 1\n if j + k - 1 < n + 1:\n D[A[j + k - 1]] -= 1\nif k == 1:\n print((0))\nelse:\n print(ans)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["- A[i] = (A[i] + A[i - 1]) % k","-for i in range(n + 1):","- A[i] = (A[i] - i) % k","+ A[i] = (A[i] + A[i - 1] - 1) % k"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450167286,"measured_runtime_v1":0.0496839287,"runtime_lift":0.9060621771,"key":["s531395097","s400560886"]} +{"user_id":"u084865106","problem_id":"p02683","language":"python","submission_id_v0":"s859664451","submission_id_v1":"s340534422","cpu_time_v0":1364,"cpu_time_v1":185,"memory_v0":27488,"memory_v1":27264,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":86.44,"input":"from sys import stdin\n\nimport numpy as np\n\n\n\ndef main():\n\n readline = stdin.readline\n\n n, m, x = map(int, readline().split())\n\n a = [list(map(int, readline().split())) for _ in range(n)]\n\n res = []\n\n for i in range(2 ** n):\n\n price = 0\n\n skill = []\n\n\n\n for j in range(1 << n):\n\n if ((i >> j) & 1) == 1:\n\n price += a[j][0]\n\n skill.append(a[j][1:])\n\n np_skill = np.array(skill)\n\n skill_sum = np.sum(np_skill, axis=0)\\\n\n if np_skill.shape[0] > 1 else np_skill\n\n\n\n if skill_sum.size != 0 and (skill_sum >= x).all():\n\n res.append(price)\n\n\n\n if not res: return print('-1')\n\n\n\n return print(min(res))\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"from sys import stdin\n\nimport numpy as np\n\n\n\ndef bit_search(a, n, m, x):\n\n res = []\n\n for i in range(2 ** n):\n\n price = 0\n\n skill = np.zeros((n, m))\n\n for j in range(n):\n\n if (i >> j) & 1:\n\n price += a[j][0]\n\n skill[j] = a[j][1:]\n\n skill_sum = np.sum(skill, axis=0)\\\n\n if skill.shape[0] > 1 else skill\n\n if (skill_sum >= x).all(): res.append(price)\n\n return res\n\n\n\ndef main():\n\n readline = stdin.readline\n\n n, m, x = map(int, readline().split())\n\n a = [list(map(int, readline().split())) for _ in range(n)]\n\n res = bit_search(a, n, m, x)\n\n print('-1' if not res else min(res))\n\n return\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":29,"code_v1_loc":27,"code_v0_num_chars":774,"code_v1_num_chars":754,"code_v0_no_empty_lines":"from sys import stdin\nimport numpy as np\n\n\ndef main():\n readline = stdin.readline\n n, m, x = map(int, readline().split())\n a = [list(map(int, readline().split())) for _ in range(n)]\n res = []\n for i in range(2**n):\n price = 0\n skill = []\n for j in range(1 << n):\n if ((i >> j) & 1) == 1:\n price += a[j][0]\n skill.append(a[j][1:])\n np_skill = np.array(skill)\n skill_sum = np.sum(np_skill, axis=0) if np_skill.shape[0] > 1 else np_skill\n if skill_sum.size != 0 and (skill_sum >= x).all():\n res.append(price)\n if not res:\n return print(\"-1\")\n return print(min(res))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from sys import stdin\nimport numpy as np\n\n\ndef bit_search(a, n, m, x):\n res = []\n for i in range(2**n):\n price = 0\n skill = np.zeros((n, m))\n for j in range(n):\n if (i >> j) & 1:\n price += a[j][0]\n skill[j] = a[j][1:]\n skill_sum = np.sum(skill, axis=0) if skill.shape[0] > 1 else skill\n if (skill_sum >= x).all():\n res.append(price)\n return res\n\n\ndef main():\n readline = stdin.readline\n n, m, x = map(int, readline().split())\n a = [list(map(int, readline().split())) for _ in range(n)]\n res = bit_search(a, n, m, x)\n print(\"-1\" if not res else min(res))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.8965517241,"diff":["+","+","+def bit_search(a, n, m, x):","+ res = []","+ for i in range(2**n):","+ price = 0","+ skill = np.zeros((n, m))","+ for j in range(n):","+ if (i >> j) & 1:","+ price += a[j][0]","+ skill[j] = a[j][1:]","+ skill_sum = np.sum(skill, axis=0) if skill.shape[0] > 1 else skill","+ if (skill_sum >= x).all():","+ res.append(price)","+ return res","- res = []","- for i in range(2**n):","- price = 0","- skill = []","- for j in range(1 << n):","- if ((i >> j) & 1) == 1:","- price += a[j][0]","- skill.append(a[j][1:])","- np_skill = np.array(skill)","- skill_sum = np.sum(np_skill, axis=0) if np_skill.shape[0] > 1 else np_skill","- if skill_sum.size != 0 and (skill_sum >= x).all():","- res.append(price)","- if not res:","- return print(\"-1\")","- return print(min(res))","+ res = bit_search(a, n, m, x)","+ print(\"-1\" if not res else min(res))","+ return"],"diff_only_import_comment":false,"measured_runtime_v0":0.2042025547,"measured_runtime_v1":0.0801990645,"runtime_lift":2.5461962177,"key":["s859664451","s340534422"]} +{"user_id":"u873915460","problem_id":"p02560","language":"python","submission_id_v0":"s605734523","submission_id_v1":"s876596273","cpu_time_v0":389,"cpu_time_v1":209,"memory_v0":71132,"memory_v1":77852,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.27,"input":"def floor_sum(n,m,a,b):\n\n r=0\n\n x,y,z=0,0,0\n\n while 1:\n\n if b>=m:\n\n x=b\/\/m\n\n else:\n\n x=0\n\n if a>=m:\n\n y=a\/\/m\n\n else:\n\n y=0\n\n r+=x*n\n\n b-=x*m\n\n r+=(y*n*(n-1))>>1\n\n a-=y*m\n\n x=(a*n+b)\/\/m\n\n if x==0:\n\n break\n\n y=b-x*m\n\n z=y\/\/a\n\n r+=(n+z)*x\n\n a,b,n,m=m,y-z*a,x,a\n\n return r\n\n\n\nfor i in range(int(eval(input()))):\n\n print((floor_sum(*list(map(int,input().split())))))","target":"import sys\n\nS=sys.stdin.readlines()\n\ndef floor_sum(n,m,a,b):\n\n r=0\n\n x,y,z=0,0,0\n\n while 1:\n\n if b>=m:\n\n x=b\/\/m\n\n else:\n\n x=0\n\n if a>=m:\n\n y=a\/\/m\n\n else:\n\n y=0\n\n r+=x*n\n\n b-=x*m\n\n r+=(y*n*(n-1))>>1\n\n a-=y*m\n\n x=(a*n+b)\/\/m\n\n if x==0:\n\n break\n\n y=b-x*m\n\n z=y\/\/a\n\n r+=(n+z)*x\n\n a,b,n,m=m,y-z*a,x,a\n\n return r\n\n\n\nfor i in range(int(S[0])):\n\n print((floor_sum(*list(map(int,S[i+1].split())))))","code_v0_loc":27,"code_v1_loc":29,"code_v0_num_chars":425,"code_v1_num_chars":458,"code_v0_no_empty_lines":"def floor_sum(n, m, a, b):\n r = 0\n x, y, z = 0, 0, 0\n while 1:\n if b >= m:\n x = b \/\/ m\n else:\n x = 0\n if a >= m:\n y = a \/\/ m\n else:\n y = 0\n r += x * n\n b -= x * m\n r += (y * n * (n - 1)) >> 1\n a -= y * m\n x = (a * n + b) \/\/ m\n if x == 0:\n break\n y = b - x * m\n z = y \/\/ a\n r += (n + z) * x\n a, b, n, m = m, y - z * a, x, a\n return r\n\n\nfor i in range(int(eval(input()))):\n print((floor_sum(*list(map(int, input().split())))))\n","code_v1_no_empty_lines":"import sys\n\nS = sys.stdin.readlines()\n\n\ndef floor_sum(n, m, a, b):\n r = 0\n x, y, z = 0, 0, 0\n while 1:\n if b >= m:\n x = b \/\/ m\n else:\n x = 0\n if a >= m:\n y = a \/\/ m\n else:\n y = 0\n r += x * n\n b -= x * m\n r += (y * n * (n - 1)) >> 1\n a -= y * m\n x = (a * n + b) \/\/ m\n if x == 0:\n break\n y = b - x * m\n z = y \/\/ a\n r += (n + z) * x\n a, b, n, m = m, y - z * a, x, a\n return r\n\n\nfor i in range(int(S[0])):\n print((floor_sum(*list(map(int, S[i + 1].split())))))\n","code_same":false,"relative_loc_diff_percent":6.8965517241,"diff":["+import sys","+","+S = sys.stdin.readlines()","+","+","-for i in range(int(eval(input()))):","- print((floor_sum(*list(map(int, input().split())))))","+for i in range(int(S[0])):","+ print((floor_sum(*list(map(int, S[i + 1].split())))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0349896486,"measured_runtime_v1":0.0347996716,"runtime_lift":1.0054591584,"key":["s605734523","s876596273"]} +{"user_id":"u345483150","problem_id":"p02915","language":"python","submission_id_v0":"s108382225","submission_id_v1":"s360959811","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"n=int(eval(input()))\n\ns = 1\n\nprint((s*n*n*n))","target":"n=int(eval(input()))\n\nprint((n*n*n))","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":37,"code_v1_num_chars":28,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = 1\nprint((s * n * n * n))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nprint((n * n * n))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-s = 1","-print((s * n * n * n))","+print((n * n * n))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0693360937,"measured_runtime_v1":0.0698919127,"runtime_lift":0.9920474495,"key":["s108382225","s360959811"]} +{"user_id":"u968404618","problem_id":"p02686","language":"python","submission_id_v0":"s535327150","submission_id_v1":"s523161738","cpu_time_v0":1983,"cpu_time_v1":1713,"memory_v0":171008,"memory_v1":170772,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.62,"input":"def CNT(A):\n\n tmp, Min = 0, 0\n\n for a in A:\n\n if a == '(': tmp += 1\n\n else: tmp -= 1\n\n Min = min(Min, tmp)\n\n return (-Min, tmp-Min)\n\n\n\nN = int(eval(input()))\n\nS = [eval(input()) for _ in range(N)]\n\nT = [CNT(s) for s in S]\n\n\n\npls = []\n\nmis = []\n\nfor l, r in T:\n\n if l <= r: pls.append((l, r))\n\n else: mis.append((l, r))\n\n\n\npls.sort(key=lambda a: a[0])\n\nmis.sort(key=lambda a: a[1], reverse=True)\n\ntotl= pls + mis\n\n\n\nlevl = 0\n\nfor l, r in totl:\n\n levl -= l\n\n if levl < 0:\n\n print('No')\n\n exit()\n\n levl += r\n\n\n\nprint(('Yes' if levl==0 else 'No'))","target":"def main():\n\n ## IMPORT MODULE\n\n #import sys\n\n\n\n #sys.setrecursionlimit(100000)\n\n #input=lambda :sys.stdin.readline().rstrip()\n\n\n\n #f_inf=float(\"inf\")\n\n #MOD=10**9+7\n\n \n\n if 'get_ipython' in globals(): \n\n ## SAMPLE INPUT\n\n n = 4\n\n S = ['((()))', '((((((', '))))))', '()()()']\n\n\n\n else:\n\n ## INPUT \n\n n = int(eval(input()))\n\n #a, b = map(int, input().split())\n\n S = [eval(input()) for _ in range(n)]\n\n\n\n ## SUBMITION CODES HERE\n\n def CNT(A):\n\n tmp, Min = 0, 0\n\n for a in A:\n\n if a == '(': tmp += 1\n\n else: tmp -= 1\n\n Min = min(Min, tmp)\n\n return (-Min, tmp-Min)\n\n \n\n T = [CNT(s) for s in S]\n\n\n\n pls = []\n\n mis = []\n\n for l, r in T:\n\n if l <= r: pls.append((l, r))\n\n else: mis.append((l, r))\n\n\n\n pls.sort(key=lambda a: a[0])\n\n mis.sort(key=lambda a: a[1], reverse=True)\n\n total = pls + mis\n\n\n\n levl = 0\n\n for l, r in total:\n\n levl -= l\n\n if levl < 0:\n\n print('No')\n\n exit()\n\n levl += r\n\n\n\n print(('Yes' if levl == 0 else 'No'))\n\n \n\nmain()","code_v0_loc":31,"code_v1_loc":53,"code_v0_num_chars":588,"code_v1_num_chars":1027,"code_v0_no_empty_lines":"def CNT(A):\n tmp, Min = 0, 0\n for a in A:\n if a == \"(\":\n tmp += 1\n else:\n tmp -= 1\n Min = min(Min, tmp)\n return (-Min, tmp - Min)\n\n\nN = int(eval(input()))\nS = [eval(input()) for _ in range(N)]\nT = [CNT(s) for s in S]\npls = []\nmis = []\nfor l, r in T:\n if l <= r:\n pls.append((l, r))\n else:\n mis.append((l, r))\npls.sort(key=lambda a: a[0])\nmis.sort(key=lambda a: a[1], reverse=True)\ntotl = pls + mis\nlevl = 0\nfor l, r in totl:\n levl -= l\n if levl < 0:\n print(\"No\")\n exit()\n levl += r\nprint((\"Yes\" if levl == 0 else \"No\"))\n","code_v1_no_empty_lines":"def main():\n ## IMPORT MODULE\n # import sys\n # sys.setrecursionlimit(100000)\n # input=lambda :sys.stdin.readline().rstrip()\n # f_inf=float(\"inf\")\n # MOD=10**9+7\n if \"get_ipython\" in globals():\n ## SAMPLE INPUT\n n = 4\n S = [\"((()))\", \"((((((\", \"))))))\", \"()()()\"]\n else:\n ## INPUT\n n = int(eval(input()))\n # a, b = map(int, input().split())\n S = [eval(input()) for _ in range(n)]\n ## SUBMITION CODES HERE\n def CNT(A):\n tmp, Min = 0, 0\n for a in A:\n if a == \"(\":\n tmp += 1\n else:\n tmp -= 1\n Min = min(Min, tmp)\n return (-Min, tmp - Min)\n\n T = [CNT(s) for s in S]\n pls = []\n mis = []\n for l, r in T:\n if l <= r:\n pls.append((l, r))\n else:\n mis.append((l, r))\n pls.sort(key=lambda a: a[0])\n mis.sort(key=lambda a: a[1], reverse=True)\n total = pls + mis\n levl = 0\n for l, r in total:\n levl -= l\n if levl < 0:\n print(\"No\")\n exit()\n levl += r\n print((\"Yes\" if levl == 0 else \"No\"))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":41.5094339623,"diff":["-def CNT(A):","- tmp, Min = 0, 0","- for a in A:","- if a == \"(\":","- tmp += 1","+def main():","+ ## IMPORT MODULE","+ # import sys","+ # sys.setrecursionlimit(100000)","+ # input=lambda :sys.stdin.readline().rstrip()","+ # f_inf=float(\"inf\")","+ # MOD=10**9+7","+ if \"get_ipython\" in globals():","+ ## SAMPLE INPUT","+ n = 4","+ S = [\"((()))\", \"((((((\", \"))))))\", \"()()()\"]","+ else:","+ ## INPUT","+ n = int(eval(input()))","+ # a, b = map(int, input().split())","+ S = [eval(input()) for _ in range(n)]","+ ## SUBMITION CODES HERE","+ def CNT(A):","+ tmp, Min = 0, 0","+ for a in A:","+ if a == \"(\":","+ tmp += 1","+ else:","+ tmp -= 1","+ Min = min(Min, tmp)","+ return (-Min, tmp - Min)","+","+ T = [CNT(s) for s in S]","+ pls = []","+ mis = []","+ for l, r in T:","+ if l <= r:","+ pls.append((l, r))","- tmp -= 1","- Min = min(Min, tmp)","- return (-Min, tmp - Min)","+ mis.append((l, r))","+ pls.sort(key=lambda a: a[0])","+ mis.sort(key=lambda a: a[1], reverse=True)","+ total = pls + mis","+ levl = 0","+ for l, r in total:","+ levl -= l","+ if levl < 0:","+ print(\"No\")","+ exit()","+ levl += r","+ print((\"Yes\" if levl == 0 else \"No\"))","-N = int(eval(input()))","-S = [eval(input()) for _ in range(N)]","-T = [CNT(s) for s in S]","-pls = []","-mis = []","-for l, r in T:","- if l <= r:","- pls.append((l, r))","- else:","- mis.append((l, r))","-pls.sort(key=lambda a: a[0])","-mis.sort(key=lambda a: a[1], reverse=True)","-totl = pls + mis","-levl = 0","-for l, r in totl:","- levl -= l","- if levl < 0:","- print(\"No\")","- exit()","- levl += r","-print((\"Yes\" if levl == 0 else \"No\"))","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0479677446,"measured_runtime_v1":0.0477597055,"runtime_lift":1.0043559531,"key":["s535327150","s523161738"]} +{"user_id":"u077291787","problem_id":"p02928","language":"python","submission_id_v0":"s790711786","submission_id_v1":"s944391440","cpu_time_v0":358,"cpu_time_v1":166,"memory_v0":3564,"memory_v1":3564,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.63,"input":"# jsc2019-qualB - Kleene Inversion\n\nfrom collections import Counter\n\n\n\n\n\ndef main():\n\n N, K = tuple(map(int, input().split()))\n\n A = tuple(map(int, input().split()))\n\n MOD = 10 ** 9 + 7\n\n C = Counter(A)\n\n x = sum(sum(j > i for j in A) * c for i, c in list(C.items()))\n\n y = sum(sum(b > a for b in A[i + 1 :]) for i, a in enumerate(A[:-1]))\n\n ans = (x * K * (1 + K) \/\/ 2) % MOD\n\n ans = (ans - y * K) % MOD\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"# jsc2019-qualB - Kleene Inversion\n\nfrom collections import Counter\n\nfrom itertools import accumulate\n\n\n\n\n\ndef main():\n\n N, K = tuple(map(int, input().split()))\n\n A = tuple(map(int, input().split()))\n\n MOD = 10 ** 9 + 7\n\n C = list(Counter(A).values())\n\n ac = list(accumulate(C[:-1]))\n\n x = sum(i * j for i, j in zip(C[1:], ac)) % MOD\n\n y = 0\n\n for i, a in enumerate(A[:-1]):\n\n y += sum(b > a for b in A[i + 1 :])\n\n ans = (x * (1 + K) * K \/\/ 2) % MOD\n\n ans = (ans - y * K) % MOD\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":18,"code_v1_loc":22,"code_v0_num_chars":482,"code_v1_num_chars":574,"code_v0_no_empty_lines":"# jsc2019-qualB - Kleene Inversion\nfrom collections import Counter\n\n\ndef main():\n N, K = tuple(map(int, input().split()))\n A = tuple(map(int, input().split()))\n MOD = 10**9 + 7\n C = Counter(A)\n x = sum(sum(j > i for j in A) * c for i, c in list(C.items()))\n y = sum(sum(b > a for b in A[i + 1 :]) for i, a in enumerate(A[:-1]))\n ans = (x * K * (1 + K) \/\/ 2) % MOD\n ans = (ans - y * K) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# jsc2019-qualB - Kleene Inversion\nfrom collections import Counter\nfrom itertools import accumulate\n\n\ndef main():\n N, K = tuple(map(int, input().split()))\n A = tuple(map(int, input().split()))\n MOD = 10**9 + 7\n C = list(Counter(A).values())\n ac = list(accumulate(C[:-1]))\n x = sum(i * j for i, j in zip(C[1:], ac)) % MOD\n y = 0\n for i, a in enumerate(A[:-1]):\n y += sum(b > a for b in A[i + 1 :])\n ans = (x * (1 + K) * K \/\/ 2) % MOD\n ans = (ans - y * K) % MOD\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["+from itertools import accumulate","- C = Counter(A)","- x = sum(sum(j > i for j in A) * c for i, c in list(C.items()))","- y = sum(sum(b > a for b in A[i + 1 :]) for i, a in enumerate(A[:-1]))","- ans = (x * K * (1 + K) \/\/ 2) % MOD","+ C = list(Counter(A).values())","+ ac = list(accumulate(C[:-1]))","+ x = sum(i * j for i, j in zip(C[1:], ac)) % MOD","+ y = 0","+ for i, a in enumerate(A[:-1]):","+ y += sum(b > a for b in A[i + 1 :])","+ ans = (x * (1 + K) * K \/\/ 2) % MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.0762487712,"measured_runtime_v1":0.0343103509,"runtime_lift":2.2223256009,"key":["s790711786","s944391440"]} +{"user_id":"u480138356","problem_id":"p03244","language":"python","submission_id_v0":"s387358089","submission_id_v1":"s237148094","cpu_time_v0":288,"cpu_time_v1":84,"memory_v0":34280,"memory_v1":17912,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.83,"input":"import sys\n\nimport numpy as np\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n v = np.array(list(map(int, input().split())))\n\n\n\n len1 = n\/\/2 + n&1\n\n len2 = n\/\/2\n\n\n\n d1 = {0:0}\n\n d2 = {0:0}\n\n for i in range(0,n,2):\n\n if v[i] in d1:\n\n d1[v[i]] += 1\n\n else:\n\n d1[v[i]] = 1\n\n for i in range(1,n,2):\n\n if v[i] in d2:\n\n d2[v[i]] += 1\n\n else:\n\n d2[v[i]] = 1\n\n\n\n a = sorted(list(d1.items()), key = lambda x: (x[1], x[0]) , reverse=True)\n\n b = sorted(list(d2.items()), key = lambda x: (x[1], -x[0]), reverse=True)\n\n a1_key, a1_val = a[0]\n\n a2_key, a2_val = a[1]\n\n b1_key, b1_val = b[0]\n\n b2_key, b2_val = b[1]\n\n if a1_key != b1_key:\n\n print((n - a1_val - b1_val))\n\n else:\n\n print((min(n - a1_val - b2_val, n - a2_val - b1_val)))\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"def main():\n\n n = int(eval(input()))\n\n v = list(map(int, input().split()))\n\n\n\n dic1 = {0:0}\n\n for i in range(0, n, 2):\n\n if v[i] in dic1:\n\n dic1[v[i]] += 1\n\n else:\n\n dic1[v[i]] = 1\n\n \n\n dic2 = {0:0}\n\n for i in range(1, n, 2):\n\n if v[i] in dic2:\n\n dic2[v[i]] += 1\n\n else:\n\n dic2[v[i]] = 1\n\n \n\n dic1 = sorted(list(dic1.items()), key=lambda x: -x[1])\n\n dic2 = sorted(list(dic2.items()), key=lambda x: -x[1])\n\n # print(dic1)\n\n # print(dic2)\n\n if dic1[0][0] != dic2[0][0]:\n\n print((n-dic1[0][1]-dic2[0][1]))\n\n else:\n\n print((min(n-dic1[0][1]-dic2[1][1], n-dic1[1][1]-dic2[0][1])))\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":39,"code_v1_loc":29,"code_v0_num_chars":900,"code_v1_num_chars":735,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(eval(input()))\n v = np.array(list(map(int, input().split())))\n len1 = n \/\/ 2 + n & 1\n len2 = n \/\/ 2\n d1 = {0: 0}\n d2 = {0: 0}\n for i in range(0, n, 2):\n if v[i] in d1:\n d1[v[i]] += 1\n else:\n d1[v[i]] = 1\n for i in range(1, n, 2):\n if v[i] in d2:\n d2[v[i]] += 1\n else:\n d2[v[i]] = 1\n a = sorted(list(d1.items()), key=lambda x: (x[1], x[0]), reverse=True)\n b = sorted(list(d2.items()), key=lambda x: (x[1], -x[0]), reverse=True)\n a1_key, a1_val = a[0]\n a2_key, a2_val = a[1]\n b1_key, b1_val = b[0]\n b2_key, b2_val = b[1]\n if a1_key != b1_key:\n print((n - a1_val - b1_val))\n else:\n print((min(n - a1_val - b2_val, n - a2_val - b1_val)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n v = list(map(int, input().split()))\n dic1 = {0: 0}\n for i in range(0, n, 2):\n if v[i] in dic1:\n dic1[v[i]] += 1\n else:\n dic1[v[i]] = 1\n dic2 = {0: 0}\n for i in range(1, n, 2):\n if v[i] in dic2:\n dic2[v[i]] += 1\n else:\n dic2[v[i]] = 1\n dic1 = sorted(list(dic1.items()), key=lambda x: -x[1])\n dic2 = sorted(list(dic2.items()), key=lambda x: -x[1])\n # print(dic1)\n # print(dic2)\n if dic1[0][0] != dic2[0][0]:\n print((n - dic1[0][1] - dic2[0][1]))\n else:\n print((min(n - dic1[0][1] - dic2[1][1], n - dic1[1][1] - dic2[0][1])))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":25.641025641,"diff":["-import sys","-import numpy as np","-","-input = sys.stdin.readline","-","-","- v = np.array(list(map(int, input().split())))","- len1 = n \/\/ 2 + n & 1","- len2 = n \/\/ 2","- d1 = {0: 0}","- d2 = {0: 0}","+ v = list(map(int, input().split()))","+ dic1 = {0: 0}","- if v[i] in d1:","- d1[v[i]] += 1","+ if v[i] in dic1:","+ dic1[v[i]] += 1","- d1[v[i]] = 1","+ dic1[v[i]] = 1","+ dic2 = {0: 0}","- if v[i] in d2:","- d2[v[i]] += 1","+ if v[i] in dic2:","+ dic2[v[i]] += 1","- d2[v[i]] = 1","- a = sorted(list(d1.items()), key=lambda x: (x[1], x[0]), reverse=True)","- b = sorted(list(d2.items()), key=lambda x: (x[1], -x[0]), reverse=True)","- a1_key, a1_val = a[0]","- a2_key, a2_val = a[1]","- b1_key, b1_val = b[0]","- b2_key, b2_val = b[1]","- if a1_key != b1_key:","- print((n - a1_val - b1_val))","+ dic2[v[i]] = 1","+ dic1 = sorted(list(dic1.items()), key=lambda x: -x[1])","+ dic2 = sorted(list(dic2.items()), key=lambda x: -x[1])","+ # print(dic1)","+ # print(dic2)","+ if dic1[0][0] != dic2[0][0]:","+ print((n - dic1[0][1] - dic2[0][1]))","- print((min(n - a1_val - b2_val, n - a2_val - b1_val)))","+ print((min(n - dic1[0][1] - dic2[1][1], n - dic1[1][1] - dic2[0][1])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2616982758,"measured_runtime_v1":0.149584132,"runtime_lift":1.749505595,"key":["s387358089","s237148094"]} +{"user_id":"u645250356","problem_id":"p02863","language":"python","submission_id_v0":"s753600962","submission_id_v1":"s067376939","cpu_time_v0":1620,"cpu_time_v1":925,"memory_v0":332268,"memory_v1":188788,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.9,"input":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,fractions,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn,t = inpl()\n\nwv = [inpl() for _ in range(n)]\n\nwv.sort(key = lambda x:x[1],reverse = True)\n\nres = 0\n\ntmp = min(n,5)\n\nfor i in range(tmp):\n\n dp = [[0] * (t+5) for _ in range(n+5)]\n\n for j in range(n):\n\n w,v = wv[j]\n\n for k in range(t):\n\n if k < w or i == j:\n\n dp[j+1][k] = dp[j][k]\n\n else:\n\n dp[j+1][k] = max(dp[j][k], dp[j][k-w] + v)\n\n # print(dp[n][t-1])\n\n res = max(dp[n][t-1] + wv[i][1], res)\n\nprint(res)","target":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,fractions,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nn,t = inpl()\n\nwv = [inpl() for _ in range(n)]\n\nrwv = wv[::-1]\n\nudp = [[0] * t for _ in range(n)]\n\nddp = [[0] * t for _ in range(n)]\n\n\n\nfor i in range(n-1):\n\n w,v = wv[i]\n\n for j in range(t):\n\n if j < w:\n\n udp[i+1][j] = udp[i][j]\n\n else:\n\n udp[i+1][j] = max(udp[i][j], udp[i][j-w] + v)\n\nres = udp[n-1][t-1] + wv[n-1][1]\n\n\n\nfor i in range(n-1):\n\n w,v = rwv[i]\n\n for j in range(t):\n\n if j < w:\n\n ddp[i+1][j] = ddp[i][j]\n\n else:\n\n ddp[i+1][j] = max(ddp[i][j], ddp[i][j-w] + v)\n\n res = max(res,ddp[n-1][t-1] + wv[0][1])\n\n# print(res)\n\nfor i in range(1,n-1):\n\n u = i; d = n-i-1\n\n mx = 0\n\n for j in range(t):\n\n tmp = udp[u][j] + ddp[d][t-1-j]\n\n mx = max(mx, tmp)\n\n res = max(res, mx + wv[i][1])\n\nprint(res)","code_v0_loc":26,"code_v1_loc":41,"code_v0_num_chars":808,"code_v1_num_chars":1135,"code_v0_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, fractions, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn, t = inpl()\nwv = [inpl() for _ in range(n)]\nwv.sort(key=lambda x: x[1], reverse=True)\nres = 0\ntmp = min(n, 5)\nfor i in range(tmp):\n dp = [[0] * (t + 5) for _ in range(n + 5)]\n for j in range(n):\n w, v = wv[j]\n for k in range(t):\n if k < w or i == j:\n dp[j + 1][k] = dp[j][k]\n else:\n dp[j + 1][k] = max(dp[j][k], dp[j][k - w] + v)\n # print(dp[n][t-1])\n res = max(dp[n][t - 1] + wv[i][1], res)\nprint(res)\n","code_v1_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, fractions, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nn, t = inpl()\nwv = [inpl() for _ in range(n)]\nrwv = wv[::-1]\nudp = [[0] * t for _ in range(n)]\nddp = [[0] * t for _ in range(n)]\nfor i in range(n - 1):\n w, v = wv[i]\n for j in range(t):\n if j < w:\n udp[i + 1][j] = udp[i][j]\n else:\n udp[i + 1][j] = max(udp[i][j], udp[i][j - w] + v)\nres = udp[n - 1][t - 1] + wv[n - 1][1]\nfor i in range(n - 1):\n w, v = rwv[i]\n for j in range(t):\n if j < w:\n ddp[i + 1][j] = ddp[i][j]\n else:\n ddp[i + 1][j] = max(ddp[i][j], ddp[i][j - w] + v)\n res = max(res, ddp[n - 1][t - 1] + wv[0][1])\n# print(res)\nfor i in range(1, n - 1):\n u = i\n d = n - i - 1\n mx = 0\n for j in range(t):\n tmp = udp[u][j] + ddp[d][t - 1 - j]\n mx = max(mx, tmp)\n res = max(res, mx + wv[i][1])\nprint(res)\n","code_same":false,"relative_loc_diff_percent":36.5853658537,"diff":["-wv.sort(key=lambda x: x[1], reverse=True)","-res = 0","-tmp = min(n, 5)","-for i in range(tmp):","- dp = [[0] * (t + 5) for _ in range(n + 5)]","- for j in range(n):","- w, v = wv[j]","- for k in range(t):","- if k < w or i == j:","- dp[j + 1][k] = dp[j][k]","- else:","- dp[j + 1][k] = max(dp[j][k], dp[j][k - w] + v)","- # print(dp[n][t-1])","- res = max(dp[n][t - 1] + wv[i][1], res)","+rwv = wv[::-1]","+udp = [[0] * t for _ in range(n)]","+ddp = [[0] * t for _ in range(n)]","+for i in range(n - 1):","+ w, v = wv[i]","+ for j in range(t):","+ if j < w:","+ udp[i + 1][j] = udp[i][j]","+ else:","+ udp[i + 1][j] = max(udp[i][j], udp[i][j - w] + v)","+res = udp[n - 1][t - 1] + wv[n - 1][1]","+for i in range(n - 1):","+ w, v = rwv[i]","+ for j in range(t):","+ if j < w:","+ ddp[i + 1][j] = ddp[i][j]","+ else:","+ ddp[i + 1][j] = max(ddp[i][j], ddp[i][j - w] + v)","+ res = max(res, ddp[n - 1][t - 1] + wv[0][1])","+# print(res)","+for i in range(1, n - 1):","+ u = i","+ d = n - i - 1","+ mx = 0","+ for j in range(t):","+ tmp = udp[u][j] + ddp[d][t - 1 - j]","+ mx = max(mx, tmp)","+ res = max(res, mx + wv[i][1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0880503047,"measured_runtime_v1":0.0464947093,"runtime_lift":1.8937704106,"key":["s753600962","s067376939"]} +{"user_id":"u863370423","problem_id":"p04044","language":"python","submission_id_v0":"s938062603","submission_id_v1":"s809428925","cpu_time_v0":166,"cpu_time_v1":28,"memory_v0":38384,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.13,"input":"n,l = list(map(int,input().split()))\n\ns=[]\n\nfor _ in range(n):\n\n\ts.append(eval(input()))\n\ns.sort()\n\nprint((''.join(s)))","target":"n, m = map(int, input().split())\n\nli = []\n\nfor i in range(n):\n\n s = input()\n\n li.append(s)\n\nli.sort()\n\nfor i in li:\n\n print(i, end=\"\")\n","code_v0_loc":6,"code_v1_loc":8,"code_v0_num_chars":105,"code_v1_num_chars":144,"code_v0_no_empty_lines":"n, l = list(map(int, input().split()))\ns = []\nfor _ in range(n):\n s.append(eval(input()))\ns.sort()\nprint((\"\".join(s)))\n","code_v1_no_empty_lines":"n, m = map(int, input().split())\nli = []\nfor i in range(n):\n s = input()\n li.append(s)\nli.sort()\nfor i in li:\n print(i, end=\"\")\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-n, l = list(map(int, input().split()))","-s = []","-for _ in range(n):","- s.append(eval(input()))","-s.sort()","-print((\"\".join(s)))","+n, m = map(int, input().split())","+li = []","+for i in range(n):","+ s = input()","+ li.append(s)","+li.sort()","+for i in li:","+ print(i, end=\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0438298409,"measured_runtime_v1":0.0373610375,"runtime_lift":1.1731430342,"key":["s938062603","s809428925"]} +{"user_id":"u186838327","problem_id":"p02788","language":"python","submission_id_v0":"s874528128","submission_id_v1":"s670839535","cpu_time_v0":930,"cpu_time_v1":740,"memory_v0":61276,"memory_v1":120708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.43,"input":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\ndef main():\n\n n, d, a = list(map(int, input().split()))\n\n XH = []\n\n for i in range(n):\n\n x, h = list(map(int, input().split()))\n\n XH.append((x, h))\n\n\n\n XH.sort()\n\n from collections import deque\n\n q = deque()\n\n\n\n ans = 0\n\n t = 0\n\n import copy\n\n for x, h in XH:\n\n while q:\n\n r, s = q.popleft()\n\n if r+d < x:\n\n t -= s\n\n else:\n\n q.appendleft((r, s))\n\n break\n\n h -= t\n\n if h > 0:\n\n if h%a == 0:\n\n b = h\/\/a\n\n ans += b\n\n t += a*b\n\n q.append((x+d, a*b))\n\n else:\n\n b = h\/\/a+1\n\n ans += b\n\n t += a*b\n\n q.append((x+d, a*b))\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"class BIT:\n\n def __init__(self, n):\n\n self.n = n\n\n self.bit = [0]*(self.n+1) # 1-indexed\n\n\n\n def init(self, init_val):\n\n for i, v in enumerate(init_val):\n\n self.add(i, v)\n\n\n\n def add(self, i, x):\n\n # i: 0-indexed\n\n i += 1 # to 1-indexed\n\n while i <= self.n:\n\n self.bit[i] += x\n\n i += (i & -i)\n\n\n\n def sum(self, i, j):\n\n # return sum of [i, j)\n\n # i, j: 0-indexed\n\n return self._sum(j) - self._sum(i)\n\n\n\n def _sum(self, i):\n\n # return sum of [0, i)\n\n # i: 0-indexed\n\n res = 0\n\n while i > 0:\n\n res += self.bit[i]\n\n i -= i & (-i)\n\n return res\n\n\n\nclass RangeAddBIT:\n\n def __init__(self, n):\n\n self.n = n\n\n self.bit1 = BIT(n)\n\n self.bit2 = BIT(n)\n\n\n\n def init(self, init_val):\n\n self.bit2.init(init_val)\n\n\n\n def add(self, l, r, x):\n\n # add x to [l, r)\n\n # l, r: 0-indexed\n\n self.bit1.add(l, x)\n\n self.bit1.add(r, -x)\n\n self.bit2.add(l, -x*l)\n\n self.bit2.add(r, x*r)\n\n\n\n def sum(self, l, r):\n\n # return sum of [l, r)\n\n # l, r: 0-indexed\n\n return self._sum(r) - self._sum(l)\n\n\n\n def _sum(self, i):\n\n # return sum of [0, i)\n\n # i: 0-indexed\n\n return self.bit1._sum(i)*i + self.bit2._sum(i)\n\n\n\nimport sys\n\nimport io, os\n\n#input = sys.stdin.buffer.readline\n\ninput = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline\n\n\n\nn, d, a = list(map(int, input().split()))\n\nXH = []\n\nfor i in range(n):\n\n x, h = list(map(int, input().split()))\n\n XH.append((x-d, h))\n\nXH.sort()\n\nX = []\n\nH = []\n\nfor x, h in XH:\n\n X.append(x)\n\n H.append(h)\n\n\n\nbit = RangeAddBIT(n+1)\n\nbit.init(H)\n\nimport bisect\n\nans = 0\n\nfor i in range(n):\n\n h = bit.sum(i, i+1)\n\n if h > 0:\n\n q = (h+a-1)\/\/a\n\n ans += q\n\n j = bisect.bisect_right(X, X[i]+2*d)\n\n bit.add(i, j, -q*a)\n\nprint(ans)\n","code_v0_loc":41,"code_v1_loc":86,"code_v0_num_chars":892,"code_v1_num_chars":1964,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\ndef main():\n n, d, a = list(map(int, input().split()))\n XH = []\n for i in range(n):\n x, h = list(map(int, input().split()))\n XH.append((x, h))\n XH.sort()\n from collections import deque\n\n q = deque()\n ans = 0\n t = 0\n import copy\n\n for x, h in XH:\n while q:\n r, s = q.popleft()\n if r + d < x:\n t -= s\n else:\n q.appendleft((r, s))\n break\n h -= t\n if h > 0:\n if h % a == 0:\n b = h \/\/ a\n ans += b\n t += a * b\n q.append((x + d, a * b))\n else:\n b = h \/\/ a + 1\n ans += b\n t += a * b\n q.append((x + d, a * b))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"class BIT:\n def __init__(self, n):\n self.n = n\n self.bit = [0] * (self.n + 1) # 1-indexed\n\n def init(self, init_val):\n for i, v in enumerate(init_val):\n self.add(i, v)\n\n def add(self, i, x):\n # i: 0-indexed\n i += 1 # to 1-indexed\n while i <= self.n:\n self.bit[i] += x\n i += i & -i\n\n def sum(self, i, j):\n # return sum of [i, j)\n # i, j: 0-indexed\n return self._sum(j) - self._sum(i)\n\n def _sum(self, i):\n # return sum of [0, i)\n # i: 0-indexed\n res = 0\n while i > 0:\n res += self.bit[i]\n i -= i & (-i)\n return res\n\n\nclass RangeAddBIT:\n def __init__(self, n):\n self.n = n\n self.bit1 = BIT(n)\n self.bit2 = BIT(n)\n\n def init(self, init_val):\n self.bit2.init(init_val)\n\n def add(self, l, r, x):\n # add x to [l, r)\n # l, r: 0-indexed\n self.bit1.add(l, x)\n self.bit1.add(r, -x)\n self.bit2.add(l, -x * l)\n self.bit2.add(r, x * r)\n\n def sum(self, l, r):\n # return sum of [l, r)\n # l, r: 0-indexed\n return self._sum(r) - self._sum(l)\n\n def _sum(self, i):\n # return sum of [0, i)\n # i: 0-indexed\n return self.bit1._sum(i) * i + self.bit2._sum(i)\n\n\nimport sys\nimport io, os\n\n# input = sys.stdin.buffer.readline\ninput = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\nn, d, a = list(map(int, input().split()))\nXH = []\nfor i in range(n):\n x, h = list(map(int, input().split()))\n XH.append((x - d, h))\nXH.sort()\nX = []\nH = []\nfor x, h in XH:\n X.append(x)\n H.append(h)\nbit = RangeAddBIT(n + 1)\nbit.init(H)\nimport bisect\n\nans = 0\nfor i in range(n):\n h = bit.sum(i, i + 1)\n if h > 0:\n q = (h + a - 1) \/\/ a\n ans += q\n j = bisect.bisect_right(X, X[i] + 2 * d)\n bit.add(i, j, -q * a)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":52.3255813953,"diff":["-import sys","+class BIT:","+ def __init__(self, n):","+ self.n = n","+ self.bit = [0] * (self.n + 1) # 1-indexed","-input = sys.stdin.buffer.readline","+ def init(self, init_val):","+ for i, v in enumerate(init_val):","+ self.add(i, v)","+","+ def add(self, i, x):","+ # i: 0-indexed","+ i += 1 # to 1-indexed","+ while i <= self.n:","+ self.bit[i] += x","+ i += i & -i","+","+ def sum(self, i, j):","+ # return sum of [i, j)","+ # i, j: 0-indexed","+ return self._sum(j) - self._sum(i)","+","+ def _sum(self, i):","+ # return sum of [0, i)","+ # i: 0-indexed","+ res = 0","+ while i > 0:","+ res += self.bit[i]","+ i -= i & (-i)","+ return res","-def main():","- n, d, a = list(map(int, input().split()))","- XH = []","- for i in range(n):","- x, h = list(map(int, input().split()))","- XH.append((x, h))","- XH.sort()","- from collections import deque","+class RangeAddBIT:","+ def __init__(self, n):","+ self.n = n","+ self.bit1 = BIT(n)","+ self.bit2 = BIT(n)","- q = deque()","- ans = 0","- t = 0","- import copy","+ def init(self, init_val):","+ self.bit2.init(init_val)","- for x, h in XH:","- while q:","- r, s = q.popleft()","- if r + d < x:","- t -= s","- else:","- q.appendleft((r, s))","- break","- h -= t","- if h > 0:","- if h % a == 0:","- b = h \/\/ a","- ans += b","- t += a * b","- q.append((x + d, a * b))","- else:","- b = h \/\/ a + 1","- ans += b","- t += a * b","- q.append((x + d, a * b))","- print(ans)","+ def add(self, l, r, x):","+ # add x to [l, r)","+ # l, r: 0-indexed","+ self.bit1.add(l, x)","+ self.bit1.add(r, -x)","+ self.bit2.add(l, -x * l)","+ self.bit2.add(r, x * r)","+","+ def sum(self, l, r):","+ # return sum of [l, r)","+ # l, r: 0-indexed","+ return self._sum(r) - self._sum(l)","+","+ def _sum(self, i):","+ # return sum of [0, i)","+ # i: 0-indexed","+ return self.bit1._sum(i) * i + self.bit2._sum(i)","-if __name__ == \"__main__\":","- main()","+import sys","+import io, os","+","+# input = sys.stdin.buffer.readline","+input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline","+n, d, a = list(map(int, input().split()))","+XH = []","+for i in range(n):","+ x, h = list(map(int, input().split()))","+ XH.append((x - d, h))","+XH.sort()","+X = []","+H = []","+for x, h in XH:","+ X.append(x)","+ H.append(h)","+bit = RangeAddBIT(n + 1)","+bit.init(H)","+import bisect","+","+ans = 0","+for i in range(n):","+ h = bit.sum(i, i + 1)","+ if h > 0:","+ q = (h + a - 1) \/\/ a","+ ans += q","+ j = bisect.bisect_right(X, X[i] + 2 * d)","+ bit.add(i, j, -q * a)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450303166,"measured_runtime_v1":0.135680057,"runtime_lift":0.3318860381,"key":["s874528128","s670839535"]} +{"user_id":"u141610915","problem_id":"p02580","language":"python","submission_id_v0":"s747947694","submission_id_v1":"s746661258","cpu_time_v0":1062,"cpu_time_v1":315,"memory_v0":111408,"memory_v1":166208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.34,"input":"import sys\n\nfrom bisect import bisect_left as bl\n\ninput = sys.stdin.readline\n\nH, W, N = list(map(int, input().split()))\n\nys = [0] * (H + 1)\n\nxs = [0] * (W + 1)\n\na = []\n\nbase = 10 ** 6\n\nfor i in range(N):\n\n y, x = list(map(int, input().split()))\n\n ys[y] += 1\n\n xs[x] += 1\n\n a.append((y, x))\n\nsy = sorted(ys[1: ])\n\nsx = sorted(xs[1: ])\n\n#print(sy, sx)\n\ndef check(k):\n\n res = 0\n\n for y, x in a:\n\n res -= (ys[y] + xs[x]) == k\n\n res += (ys[y] + xs[x]) > k\n\n\n\n #print(res, k)\n\n for y in sy:\n\n i = bl(sx, k - y)\n\n res += W - i\n\n #print(W - i, y, k, res)\n\n return res > 0\n\n\n\nok = 0\n\nng = N + 1\n\nwhile ng - ok > 1:\n\n m = (ok + ng) \/\/ 2\n\n if check(m): ok = m\n\n else: ng = m\n\nprint(ok)","target":"import sys\n\ninput = sys.stdin.readline\n\nH, W, M = list(map(int, input().split()))\n\ns = set()\n\nys = [0] * (H + 1)\n\nxs = [0] * (W + 1)\n\nfor _ in range(M):\n\n y, x = list(map(int, input().split()))\n\n s.add((y, x))\n\n ys[y] += 1\n\n xs[x] += 1\n\n\n\nres = 0\n\nmxy = []\n\nmx = max(ys)\n\nfor i in range(H + 1):\n\n if ys[i] == mx: mxy.append(i)\n\nres += mx\n\n\n\nmxx = []\n\nmx = max(xs)\n\nfor i in range(W + 1):\n\n if xs[i] == mx: mxx.append(i)\n\nres += mx - 1\n\n\n\nfor x in mxx:\n\n for y in mxy:\n\n if (y, x) in s: continue\n\n res += 1\n\n break\n\n else: continue\n\n break\n\nprint(res)","code_v0_loc":36,"code_v1_loc":33,"code_v0_num_chars":689,"code_v1_num_chars":556,"code_v0_no_empty_lines":"import sys\nfrom bisect import bisect_left as bl\n\ninput = sys.stdin.readline\nH, W, N = list(map(int, input().split()))\nys = [0] * (H + 1)\nxs = [0] * (W + 1)\na = []\nbase = 10**6\nfor i in range(N):\n y, x = list(map(int, input().split()))\n ys[y] += 1\n xs[x] += 1\n a.append((y, x))\nsy = sorted(ys[1:])\nsx = sorted(xs[1:])\n# print(sy, sx)\ndef check(k):\n res = 0\n for y, x in a:\n res -= (ys[y] + xs[x]) == k\n res += (ys[y] + xs[x]) > k\n # print(res, k)\n for y in sy:\n i = bl(sx, k - y)\n res += W - i\n # print(W - i, y, k, res)\n return res > 0\n\n\nok = 0\nng = N + 1\nwhile ng - ok > 1:\n m = (ok + ng) \/\/ 2\n if check(m):\n ok = m\n else:\n ng = m\nprint(ok)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nH, W, M = list(map(int, input().split()))\ns = set()\nys = [0] * (H + 1)\nxs = [0] * (W + 1)\nfor _ in range(M):\n y, x = list(map(int, input().split()))\n s.add((y, x))\n ys[y] += 1\n xs[x] += 1\nres = 0\nmxy = []\nmx = max(ys)\nfor i in range(H + 1):\n if ys[i] == mx:\n mxy.append(i)\nres += mx\nmxx = []\nmx = max(xs)\nfor i in range(W + 1):\n if xs[i] == mx:\n mxx.append(i)\nres += mx - 1\nfor x in mxx:\n for y in mxy:\n if (y, x) in s:\n continue\n res += 1\n break\n else:\n continue\n break\nprint(res)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-from bisect import bisect_left as bl","-H, W, N = list(map(int, input().split()))","+H, W, M = list(map(int, input().split()))","+s = set()","-a = []","-base = 10**6","-for i in range(N):","+for _ in range(M):","+ s.add((y, x))","- a.append((y, x))","-sy = sorted(ys[1:])","-sx = sorted(xs[1:])","-# print(sy, sx)","-def check(k):","- res = 0","- for y, x in a:","- res -= (ys[y] + xs[x]) == k","- res += (ys[y] + xs[x]) > k","- # print(res, k)","- for y in sy:","- i = bl(sx, k - y)","- res += W - i","- # print(W - i, y, k, res)","- return res > 0","-","-","-ok = 0","-ng = N + 1","-while ng - ok > 1:","- m = (ok + ng) \/\/ 2","- if check(m):","- ok = m","+res = 0","+mxy = []","+mx = max(ys)","+for i in range(H + 1):","+ if ys[i] == mx:","+ mxy.append(i)","+res += mx","+mxx = []","+mx = max(xs)","+for i in range(W + 1):","+ if xs[i] == mx:","+ mxx.append(i)","+res += mx - 1","+for x in mxx:","+ for y in mxy:","+ if (y, x) in s:","+ continue","+ res += 1","+ break","- ng = m","-print(ok)","+ continue","+ break","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0416007228,"measured_runtime_v1":0.0527052503,"runtime_lift":0.7893088938,"key":["s747947694","s746661258"]} +{"user_id":"u546285759","problem_id":"p00424","language":"python","submission_id_v0":"s456190171","submission_id_v1":"s991075342","cpu_time_v0":260,"cpu_time_v1":240,"memory_v0":7868,"memory_v1":8644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.69,"input":"while True:\n\n n = int(eval(input()))\n\n if n == 0:\n\n break\n\n d = {}\n\n for _ in range(n):\n\n a, b = input().split()\n\n d[a] = b\n\n m = int(eval(input()))\n\n ans = \"\"\n\n for _ in range(m):\n\n a = input().strip()\n\n ans += d.get(a, a)\n\n print(ans)","target":"while True:\n\n n = int(eval(input()))\n\n if n == 0:\n\n break\n\n d = {}\n\n for _ in range(n):\n\n a, b = input().split()\n\n d[a] = b\n\n m = int(eval(input()))\n\n ans = []\n\n for _ in range(m):\n\n a = input().strip()\n\n ans.append(d.get(a, a))\n\n print((\"\".join(ans)))","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":283,"code_v1_num_chars":297,"code_v0_no_empty_lines":"while True:\n n = int(eval(input()))\n if n == 0:\n break\n d = {}\n for _ in range(n):\n a, b = input().split()\n d[a] = b\n m = int(eval(input()))\n ans = \"\"\n for _ in range(m):\n a = input().strip()\n ans += d.get(a, a)\n print(ans)\n","code_v1_no_empty_lines":"while True:\n n = int(eval(input()))\n if n == 0:\n break\n d = {}\n for _ in range(n):\n a, b = input().split()\n d[a] = b\n m = int(eval(input()))\n ans = []\n for _ in range(m):\n a = input().strip()\n ans.append(d.get(a, a))\n print((\"\".join(ans)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- ans = \"\"","+ ans = []","- ans += d.get(a, a)","- print(ans)","+ ans.append(d.get(a, a))","+ print((\"\".join(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0357020695,"measured_runtime_v1":0.0432727768,"runtime_lift":0.8250468798,"key":["s456190171","s991075342"]} +{"user_id":"u072717685","problem_id":"p02768","language":"python","submission_id_v0":"s233956964","submission_id_v1":"s060725280","cpu_time_v0":1505,"cpu_time_v1":116,"memory_v0":5424,"memory_v1":9132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.29,"input":"def main():\n\n from math import factorial\n\n n, a, b = list(map(int, input().split()))\n\n p = 1000000007\n\n\n\n # 1:\u82b1\u675f\u306e\u7d44\u307f\u5408\u308f\u305b\u7dcf\u6570\u306e(mod p)\n\n n_all = pow(2, n, p) -1\n\n\n\n # 2:a\u3068b\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\u306e(mod p)\u3092\u51fa\u3059\u3002\n\n a_comb = 0 # a\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\n\n a_comb_x = 1 # a\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\u8a08\u7b97\u306e\u5206\u5b50\u3002n*(n-1)*\u2026*(n-r+1)\u306emod p\n\n a_comb_y = 1 # a\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\u8a08\u7b97\u306e\u5206\u6bcd\u3002r!\u306emod p\u306b\u304a\u3051\u308b\u9006\u5143\n\n for i in range(n, n-a ,-1):\n\n a_comb_x *= i\n\n a_comb_x %= p\n\n a_comb_y = factorial(a)\n\n a_comb_y = pow(a_comb_y, p-2,p)\n\n a_comb = (a_comb_x * a_comb_y) % p\n\n\n\n b_comb = 0 \n\n b_comb_x = 1 \n\n b_comb_y = 1 \n\n for i in range(n, n-b ,-1):\n\n b_comb_x *= i\n\n b_comb_x %= p\n\n b_comb_y = factorial(b)\n\n b_comb_y = pow(b_comb_y, p-2,p)\n\n b_comb = (b_comb_x * b_comb_y) % p\n\n\n\n # 3: 1\u306e\u7d50\u679c\u304b\u3089\uff12\u306e\u305d\u308c\u3092\u30de\u30a4\u30ca\u30b9\u3059\u308b\u3002\u7d50\u679c\u304c\u8ca0\u306b\u306a\u3063\u305f\u3089+p\n\n r = n_all - a_comb\n\n if r < 0:\n\n r += p\n\n r -= b_comb\n\n if r < 0:\n\n r += p\n\n print(r)\n\n\n\nmain()","target":"def main():\n\n n, a, b = list(map(int, input().split()))\n\n p = 10 ** 9 + 7\n\n r = pow(2, n, p) - 1\n\n if (n - a) < a:\n\n a = n - a\n\n if (n - b) < b:\n\n b = n - b\n\n fac_na = 1\n\n for i1 in range(n, n - a, -1):\n\n fac_na = (fac_na * i1) % p\n\n fac_nb = 1\n\n for i1 in range(n, n - b, -1):\n\n fac_nb = (fac_nb * i1) % p\n\n fac_a = 1\n\n for i1 in range(1, a+1):\n\n fac_a = (fac_a * i1) % p\n\n fac_b = 1\n\n for i1 in range(1, b+1):\n\n fac_b = (fac_b * i1) % p\n\n\n\n an = fac_na * pow(fac_a, p-2, p)\n\n bn = fac_nb * pow(fac_b, p-2, p)\n\n an = an % p\n\n bn = bn % p\n\n r -= an\n\n if r < 0:\n\n r += p\n\n r -= bn\n\n if r < 0:\n\n r += p\n\n if r < 0:\n\n r += p\n\n print((int(r)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":39,"code_v1_loc":38,"code_v0_num_chars":949,"code_v1_num_chars":807,"code_v0_no_empty_lines":"def main():\n from math import factorial\n\n n, a, b = list(map(int, input().split()))\n p = 1000000007\n # 1:\u82b1\u675f\u306e\u7d44\u307f\u5408\u308f\u305b\u7dcf\u6570\u306e(mod p)\n n_all = pow(2, n, p) - 1\n # 2:a\u3068b\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\u306e(mod p)\u3092\u51fa\u3059\u3002\n a_comb = 0 # a\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\n a_comb_x = 1 # a\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\u8a08\u7b97\u306e\u5206\u5b50\u3002n*(n-1)*\u2026*(n-r+1)\u306emod p\n a_comb_y = 1 # a\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\u8a08\u7b97\u306e\u5206\u6bcd\u3002r!\u306emod p\u306b\u304a\u3051\u308b\u9006\u5143\n for i in range(n, n - a, -1):\n a_comb_x *= i\n a_comb_x %= p\n a_comb_y = factorial(a)\n a_comb_y = pow(a_comb_y, p - 2, p)\n a_comb = (a_comb_x * a_comb_y) % p\n b_comb = 0\n b_comb_x = 1\n b_comb_y = 1\n for i in range(n, n - b, -1):\n b_comb_x *= i\n b_comb_x %= p\n b_comb_y = factorial(b)\n b_comb_y = pow(b_comb_y, p - 2, p)\n b_comb = (b_comb_x * b_comb_y) % p\n # 3: 1\u306e\u7d50\u679c\u304b\u3089\uff12\u306e\u305d\u308c\u3092\u30de\u30a4\u30ca\u30b9\u3059\u308b\u3002\u7d50\u679c\u304c\u8ca0\u306b\u306a\u3063\u305f\u3089+p\n r = n_all - a_comb\n if r < 0:\n r += p\n r -= b_comb\n if r < 0:\n r += p\n print(r)\n\n\nmain()\n","code_v1_no_empty_lines":"def main():\n n, a, b = list(map(int, input().split()))\n p = 10**9 + 7\n r = pow(2, n, p) - 1\n if (n - a) < a:\n a = n - a\n if (n - b) < b:\n b = n - b\n fac_na = 1\n for i1 in range(n, n - a, -1):\n fac_na = (fac_na * i1) % p\n fac_nb = 1\n for i1 in range(n, n - b, -1):\n fac_nb = (fac_nb * i1) % p\n fac_a = 1\n for i1 in range(1, a + 1):\n fac_a = (fac_a * i1) % p\n fac_b = 1\n for i1 in range(1, b + 1):\n fac_b = (fac_b * i1) % p\n an = fac_na * pow(fac_a, p - 2, p)\n bn = fac_nb * pow(fac_b, p - 2, p)\n an = an % p\n bn = bn % p\n r -= an\n if r < 0:\n r += p\n r -= bn\n if r < 0:\n r += p\n if r < 0:\n r += p\n print((int(r)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.5641025641,"diff":["- from math import factorial","-","- p = 1000000007","- # 1:\u82b1\u675f\u306e\u7d44\u307f\u5408\u308f\u305b\u7dcf\u6570\u306e(mod p)","- n_all = pow(2, n, p) - 1","- # 2:a\u3068b\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\u306e(mod p)\u3092\u51fa\u3059\u3002","- a_comb = 0 # a\u306e\u7d44\u307f\u5408\u308f\u305b\u6570","- a_comb_x = 1 # a\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\u8a08\u7b97\u306e\u5206\u5b50\u3002n*(n-1)*\u2026*(n-r+1)\u306emod p","- a_comb_y = 1 # a\u306e\u7d44\u307f\u5408\u308f\u305b\u6570\u8a08\u7b97\u306e\u5206\u6bcd\u3002r!\u306emod p\u306b\u304a\u3051\u308b\u9006\u5143","- for i in range(n, n - a, -1):","- a_comb_x *= i","- a_comb_x %= p","- a_comb_y = factorial(a)","- a_comb_y = pow(a_comb_y, p - 2, p)","- a_comb = (a_comb_x * a_comb_y) % p","- b_comb = 0","- b_comb_x = 1","- b_comb_y = 1","- for i in range(n, n - b, -1):","- b_comb_x *= i","- b_comb_x %= p","- b_comb_y = factorial(b)","- b_comb_y = pow(b_comb_y, p - 2, p)","- b_comb = (b_comb_x * b_comb_y) % p","- # 3: 1\u306e\u7d50\u679c\u304b\u3089\uff12\u306e\u305d\u308c\u3092\u30de\u30a4\u30ca\u30b9\u3059\u308b\u3002\u7d50\u679c\u304c\u8ca0\u306b\u306a\u3063\u305f\u3089+p","- r = n_all - a_comb","+ p = 10**9 + 7","+ r = pow(2, n, p) - 1","+ if (n - a) < a:","+ a = n - a","+ if (n - b) < b:","+ b = n - b","+ fac_na = 1","+ for i1 in range(n, n - a, -1):","+ fac_na = (fac_na * i1) % p","+ fac_nb = 1","+ for i1 in range(n, n - b, -1):","+ fac_nb = (fac_nb * i1) % p","+ fac_a = 1","+ for i1 in range(1, a + 1):","+ fac_a = (fac_a * i1) % p","+ fac_b = 1","+ for i1 in range(1, b + 1):","+ fac_b = (fac_b * i1) % p","+ an = fac_na * pow(fac_a, p - 2, p)","+ bn = fac_nb * pow(fac_b, p - 2, p)","+ an = an % p","+ bn = bn % p","+ r -= an","- r -= b_comb","+ r -= bn","- print(r)","+ if r < 0:","+ r += p","+ print((int(r)))","-main()","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.8616614916,"measured_runtime_v1":0.0773292824,"runtime_lift":11.1427581416,"key":["s233956964","s060725280"]} +{"user_id":"u688319022","problem_id":"p02888","language":"python","submission_id_v0":"s907084451","submission_id_v1":"s004454923","cpu_time_v0":1939,"cpu_time_v1":877,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.77,"input":"N=int(eval(input()))\n\nS=list(map(int,input().split( )))\n\nS = sorted(S)\n\ntri_num=0\n\nfor i in range(N-2):\n\n k = i+2\n\n for j in range(i+1,N-1):\n\n while k < N:\n\n if S[i] + S[j] <= S[k]:\n\n tri_num = tri_num + k-j-1\n\n if k == i+2:\n\n k+=1\n\n break\n\n if k == N-1:\n\n tri_num = tri_num + k-j\n\n break\n\n k+=1\n\nprint(tri_num)","target":"N=int(eval(input()))\n\nS=list(map(int,input().split( )))\n\nS = sorted(S,reverse=True)\n\ntri_num=0\n\nfor i in range(N-2):\n\n j = i+1\n\n k = N-1\n\n while k > j:\n\n if S[i] < S[j] + S[k]:\n\n tri_num += k-j\n\n j+=1\n\n else:\n\n k-=1\n\nprint(tri_num)\n","code_v0_loc":18,"code_v1_loc":14,"code_v0_num_chars":445,"code_v1_num_chars":282,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = list(map(int, input().split()))\nS = sorted(S)\ntri_num = 0\nfor i in range(N - 2):\n k = i + 2\n for j in range(i + 1, N - 1):\n while k < N:\n if S[i] + S[j] <= S[k]:\n tri_num = tri_num + k - j - 1\n if k == i + 2:\n k += 1\n break\n if k == N - 1:\n tri_num = tri_num + k - j\n break\n k += 1\nprint(tri_num)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = list(map(int, input().split()))\nS = sorted(S, reverse=True)\ntri_num = 0\nfor i in range(N - 2):\n j = i + 1\n k = N - 1\n while k > j:\n if S[i] < S[j] + S[k]:\n tri_num += k - j\n j += 1\n else:\n k -= 1\nprint(tri_num)\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-S = sorted(S)","+S = sorted(S, reverse=True)","- k = i + 2","- for j in range(i + 1, N - 1):","- while k < N:","- if S[i] + S[j] <= S[k]:","- tri_num = tri_num + k - j - 1","- if k == i + 2:","- k += 1","- break","- if k == N - 1:","- tri_num = tri_num + k - j","- break","- k += 1","+ j = i + 1","+ k = N - 1","+ while k > j:","+ if S[i] < S[j] + S[k]:","+ tri_num += k - j","+ j += 1","+ else:","+ k -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0358415129,"measured_runtime_v1":0.0329593251,"runtime_lift":1.0874468098,"key":["s907084451","s004454923"]} +{"user_id":"u844789719","problem_id":"p02579","language":"python","submission_id_v0":"s674557350","submission_id_v1":"s847695301","cpu_time_v0":1144,"cpu_time_v1":820,"memory_v0":166320,"memory_v1":118308,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.32,"input":"import collections, itertools\n\nH, W, ch, cw, dh, dw, *S = open(0).read().split()\n\nH, W, ch, cw, dh, dw = [int(_) + 1 for _ in [H, W, ch, cw, dh, dw]]\n\nH += 3\n\nW += 3\n\nS = ['#' * W] + ['#' * W] + ['##' + s + '##'\n\n for s in S] + ['#' * W] + ['#' * W]\n\nDist = [[None] * W for _ in range(H)]\n\nQ = collections.deque([(0, ch, cw)])\n\nwhile Q:\n\n d, ox, oy = Q.popleft()\n\n if Dist[ox][oy] is not None:\n\n continue\n\n stack = [[ox, oy]]\n\n warp = set()\n\n while stack:\n\n x, y = stack.pop()\n\n if (x, y) == (dh, dw):\n\n print(d)\n\n exit()\n\n Dist[x][y] = d\n\n for dx, dy in [[-1, 0], [1, 0], [0, -1], [0, 1]]:\n\n nx, ny = x + dx, y + dy\n\n if Dist[nx][ny] is None:\n\n if S[nx][ny] == '.':\n\n stack += [[nx, ny]]\n\n else:\n\n warp.add((x, y))\n\n for x, y in warp:\n\n for dx, dy in itertools.product(list(range(-2, 3)), repeat=2):\n\n nx, ny = x + dx, y + dy\n\n if Dist[nx][ny] is None and S[nx][ny] == '.':\n\n Q += [(d + 1, nx, ny)]\n\nprint((-1))\n","target":"H, W, ch, cw, dh, dw, *S = open(0).read().split()\n\nH, W, ch, cw, dh, dw = [int(_) for _ in [H, W, ch, cw, dh, dw]]\n\nch -= 1\n\ncw -= 1\n\ndh -= 1\n\ndw -= 1\n\n\n\nstack = [[ch, cw]]\n\ndist = [[None] * W for _ in range(H)]\n\nd = 0\n\nwhile True:\n\n stack2 = []\n\n warp = set()\n\n while stack:\n\n x, y = stack.pop()\n\n if (x, y) == (dh, dw):\n\n print(d)\n\n exit()\n\n if dist[x][y] is not None:\n\n continue\n\n dist[x][y] = d\n\n for dx, dy in [[-1, 0], [1, 0], [0, 1], [0, -1]]:\n\n nx, ny = x + dx, y + dy\n\n if 0 <= nx < H and 0 <= ny < W and dist[nx][ny] is None:\n\n if S[nx][ny] == '.':\n\n stack += [[nx, ny]]\n\n else:\n\n warp.add((x, y))\n\n for x, y in warp:\n\n for dx in range(-2, 3):\n\n for dy in range(-2, 3):\n\n nx, ny = x + dx, y + dy\n\n if 0 <= nx < H and 0 <= ny < W and dist[nx][ny] is None and S[\n\n nx][ny] == '.':\n\n stack2 += [[nx, ny]]\n\n if stack2 == []:\n\n break\n\n else:\n\n d += 1\n\n stack = stack2\n\nprint((-1))\n","code_v0_loc":34,"code_v1_loc":41,"code_v0_num_chars":1142,"code_v1_num_chars":1171,"code_v0_no_empty_lines":"import collections, itertools\n\nH, W, ch, cw, dh, dw, *S = open(0).read().split()\nH, W, ch, cw, dh, dw = [int(_) + 1 for _ in [H, W, ch, cw, dh, dw]]\nH += 3\nW += 3\nS = [\"#\" * W] + [\"#\" * W] + [\"##\" + s + \"##\" for s in S] + [\"#\" * W] + [\"#\" * W]\nDist = [[None] * W for _ in range(H)]\nQ = collections.deque([(0, ch, cw)])\nwhile Q:\n d, ox, oy = Q.popleft()\n if Dist[ox][oy] is not None:\n continue\n stack = [[ox, oy]]\n warp = set()\n while stack:\n x, y = stack.pop()\n if (x, y) == (dh, dw):\n print(d)\n exit()\n Dist[x][y] = d\n for dx, dy in [[-1, 0], [1, 0], [0, -1], [0, 1]]:\n nx, ny = x + dx, y + dy\n if Dist[nx][ny] is None:\n if S[nx][ny] == \".\":\n stack += [[nx, ny]]\n else:\n warp.add((x, y))\n for x, y in warp:\n for dx, dy in itertools.product(list(range(-2, 3)), repeat=2):\n nx, ny = x + dx, y + dy\n if Dist[nx][ny] is None and S[nx][ny] == \".\":\n Q += [(d + 1, nx, ny)]\nprint((-1))\n","code_v1_no_empty_lines":"H, W, ch, cw, dh, dw, *S = open(0).read().split()\nH, W, ch, cw, dh, dw = [int(_) for _ in [H, W, ch, cw, dh, dw]]\nch -= 1\ncw -= 1\ndh -= 1\ndw -= 1\nstack = [[ch, cw]]\ndist = [[None] * W for _ in range(H)]\nd = 0\nwhile True:\n stack2 = []\n warp = set()\n while stack:\n x, y = stack.pop()\n if (x, y) == (dh, dw):\n print(d)\n exit()\n if dist[x][y] is not None:\n continue\n dist[x][y] = d\n for dx, dy in [[-1, 0], [1, 0], [0, 1], [0, -1]]:\n nx, ny = x + dx, y + dy\n if 0 <= nx < H and 0 <= ny < W and dist[nx][ny] is None:\n if S[nx][ny] == \".\":\n stack += [[nx, ny]]\n else:\n warp.add((x, y))\n for x, y in warp:\n for dx in range(-2, 3):\n for dy in range(-2, 3):\n nx, ny = x + dx, y + dy\n if (\n 0 <= nx < H\n and 0 <= ny < W\n and dist[nx][ny] is None\n and S[nx][ny] == \".\"\n ):\n stack2 += [[nx, ny]]\n if stack2 == []:\n break\n else:\n d += 1\n stack = stack2\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":17.0731707317,"diff":["-import collections, itertools","-","-H, W, ch, cw, dh, dw = [int(_) + 1 for _ in [H, W, ch, cw, dh, dw]]","-H += 3","-W += 3","-S = [\"#\" * W] + [\"#\" * W] + [\"##\" + s + \"##\" for s in S] + [\"#\" * W] + [\"#\" * W]","-Dist = [[None] * W for _ in range(H)]","-Q = collections.deque([(0, ch, cw)])","-while Q:","- d, ox, oy = Q.popleft()","- if Dist[ox][oy] is not None:","- continue","- stack = [[ox, oy]]","+H, W, ch, cw, dh, dw = [int(_) for _ in [H, W, ch, cw, dh, dw]]","+ch -= 1","+cw -= 1","+dh -= 1","+dw -= 1","+stack = [[ch, cw]]","+dist = [[None] * W for _ in range(H)]","+d = 0","+while True:","+ stack2 = []","- Dist[x][y] = d","- for dx, dy in [[-1, 0], [1, 0], [0, -1], [0, 1]]:","+ if dist[x][y] is not None:","+ continue","+ dist[x][y] = d","+ for dx, dy in [[-1, 0], [1, 0], [0, 1], [0, -1]]:","- if Dist[nx][ny] is None:","+ if 0 <= nx < H and 0 <= ny < W and dist[nx][ny] is None:","- for dx, dy in itertools.product(list(range(-2, 3)), repeat=2):","- nx, ny = x + dx, y + dy","- if Dist[nx][ny] is None and S[nx][ny] == \".\":","- Q += [(d + 1, nx, ny)]","+ for dx in range(-2, 3):","+ for dy in range(-2, 3):","+ nx, ny = x + dx, y + dy","+ if (","+ 0 <= nx < H","+ and 0 <= ny < W","+ and dist[nx][ny] is None","+ and S[nx][ny] == \".\"","+ ):","+ stack2 += [[nx, ny]]","+ if stack2 == []:","+ break","+ else:","+ d += 1","+ stack = stack2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0336253452,"measured_runtime_v1":0.0379726326,"runtime_lift":0.8855152482,"key":["s674557350","s847695301"]} +{"user_id":"u217627525","problem_id":"p03545","language":"python","submission_id_v0":"s114422864","submission_id_v1":"s742435813","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"n=eval(input())\n\nnum=[]\n\nfor i in range(4):\n\n num.append(int(n[i]))\n\no=[\"+\",\"+\",\"+\"]\n\nop=[1,1,1]\n\ndef ans():\n\n return num[0]+op[0]*num[1]+op[1]*num[2]+op[2]*num[3]\n\nif ans()!=7:\n\n for i in range(3):\n\n op[i]=-1\n\n if ans()==7:\n\n break\n\n op[i]=1\n\nif ans()!=7: \n\n for i in range(-1,2):\n\n op[i]=-1\n\n op[i+1]=-1\n\n if ans()==7:\n\n break\n\n op[i]=1\n\n op[i+1]=1\n\nif ans()!=7:\n\n for i in range(3):\n\n op[i]=-1\n\nfor i in range(3):\n\n if op[i]==-1:\n\n o[i]=\"-\"\n\nprint((n[0]+o[0]+n[1]+o[1]+n[2]+o[2]+n[3]+\"=7\"))","target":"n=eval(input())\n\na=int(n[0])\n\nb=int(n[1])\n\nc=int(n[2])\n\nd=int(n[3])\n\n\n\nif a+b+c+d==7:\n\n print((\"%d+%d+%d+%d=7\"%(a,b,c,d)))\n\nelif a+b+c-d==7:\n\n print((\"%d+%d+%d-%d=7\"%(a,b,c,d)))\n\nelif a+b-c+d==7:\n\n print((\"%d+%d-%d+%d=7\"%(a,b,c,d)))\n\nelif a+b-c-d==7:\n\n print((\"%d+%d-%d-%d=7\"%(a,b,c,d)))\n\nelif a-b+c+d==7:\n\n print((\"%d-%d+%d+%d=7\"%(a,b,c,d)))\n\nelif a-b+c-d==7:\n\n print((\"%d-%d+%d-%d=7\"%(a,b,c,d)))\n\nelif a-b-c+d==7:\n\n print((\"%d-%d-%d+%d=7\"%(a,b,c,d)))\n\nelse:\n\n print((\"%d-%d-%d-%d=7\"%(a,b,c,d)))","code_v0_loc":29,"code_v1_loc":22,"code_v0_num_chars":596,"code_v1_num_chars":498,"code_v0_no_empty_lines":"n = eval(input())\nnum = []\nfor i in range(4):\n num.append(int(n[i]))\no = [\"+\", \"+\", \"+\"]\nop = [1, 1, 1]\n\n\ndef ans():\n return num[0] + op[0] * num[1] + op[1] * num[2] + op[2] * num[3]\n\n\nif ans() != 7:\n for i in range(3):\n op[i] = -1\n if ans() == 7:\n break\n op[i] = 1\nif ans() != 7:\n for i in range(-1, 2):\n op[i] = -1\n op[i + 1] = -1\n if ans() == 7:\n break\n op[i] = 1\n op[i + 1] = 1\nif ans() != 7:\n for i in range(3):\n op[i] = -1\nfor i in range(3):\n if op[i] == -1:\n o[i] = \"-\"\nprint((n[0] + o[0] + n[1] + o[1] + n[2] + o[2] + n[3] + \"=7\"))\n","code_v1_no_empty_lines":"n = eval(input())\na = int(n[0])\nb = int(n[1])\nc = int(n[2])\nd = int(n[3])\nif a + b + c + d == 7:\n print((\"%d+%d+%d+%d=7\" % (a, b, c, d)))\nelif a + b + c - d == 7:\n print((\"%d+%d+%d-%d=7\" % (a, b, c, d)))\nelif a + b - c + d == 7:\n print((\"%d+%d-%d+%d=7\" % (a, b, c, d)))\nelif a + b - c - d == 7:\n print((\"%d+%d-%d-%d=7\" % (a, b, c, d)))\nelif a - b + c + d == 7:\n print((\"%d-%d+%d+%d=7\" % (a, b, c, d)))\nelif a - b + c - d == 7:\n print((\"%d-%d+%d-%d=7\" % (a, b, c, d)))\nelif a - b - c + d == 7:\n print((\"%d-%d-%d+%d=7\" % (a, b, c, d)))\nelse:\n print((\"%d-%d-%d-%d=7\" % (a, b, c, d)))\n","code_same":false,"relative_loc_diff_percent":24.1379310345,"diff":["-num = []","-for i in range(4):","- num.append(int(n[i]))","-o = [\"+\", \"+\", \"+\"]","-op = [1, 1, 1]","-","-","-def ans():","- return num[0] + op[0] * num[1] + op[1] * num[2] + op[2] * num[3]","-","-","-if ans() != 7:","- for i in range(3):","- op[i] = -1","- if ans() == 7:","- break","- op[i] = 1","-if ans() != 7:","- for i in range(-1, 2):","- op[i] = -1","- op[i + 1] = -1","- if ans() == 7:","- break","- op[i] = 1","- op[i + 1] = 1","-if ans() != 7:","- for i in range(3):","- op[i] = -1","-for i in range(3):","- if op[i] == -1:","- o[i] = \"-\"","-print((n[0] + o[0] + n[1] + o[1] + n[2] + o[2] + n[3] + \"=7\"))","+a = int(n[0])","+b = int(n[1])","+c = int(n[2])","+d = int(n[3])","+if a + b + c + d == 7:","+ print((\"%d+%d+%d+%d=7\" % (a, b, c, d)))","+elif a + b + c - d == 7:","+ print((\"%d+%d+%d-%d=7\" % (a, b, c, d)))","+elif a + b - c + d == 7:","+ print((\"%d+%d-%d+%d=7\" % (a, b, c, d)))","+elif a + b - c - d == 7:","+ print((\"%d+%d-%d-%d=7\" % (a, b, c, d)))","+elif a - b + c + d == 7:","+ print((\"%d-%d+%d+%d=7\" % (a, b, c, d)))","+elif a - b + c - d == 7:","+ print((\"%d-%d+%d-%d=7\" % (a, b, c, d)))","+elif a - b - c + d == 7:","+ print((\"%d-%d-%d+%d=7\" % (a, b, c, d)))","+else:","+ print((\"%d-%d-%d-%d=7\" % (a, b, c, d)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0722663233,"measured_runtime_v1":0.0682989376,"runtime_lift":1.0580885428,"key":["s114422864","s742435813"]} +{"user_id":"u596276291","problem_id":"p04000","language":"python","submission_id_v0":"s614720651","submission_id_v1":"s266024754","cpu_time_v0":2093,"cpu_time_v1":1496,"memory_v0":167008,"memory_v1":166904,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.52,"input":"from collections import defaultdict\n\n\n\n\n\ndef main():\n\n H, W, N = map(int, input().split())\n\n\n\n d = defaultdict(int)\n\n for _ in range(N):\n\n a, b = map(int, input().split())\n\n for y in range(-2, 1):\n\n for x in range(-2, 1):\n\n n_y, n_x = y + a, x + b\n\n if 0 < n_y <= H - 2 and 0 < n_x <= W - 2:\n\n d[(n_y, n_x)] += 1\n\n\n\n ans = [0] * 10\n\n for k, v in d.items():\n\n ans[v] += 1\n\n ans[0] = (H - 2) * (W - 2) - sum(ans)\n\n\n\n print(*ans, sep=\"\\n\")\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"from collections import defaultdict\n\n\n\n\n\ndef main():\n\n H, W, N = map(int, input().split())\n\n d = defaultdict(int)\n\n for _ in range(N):\n\n a, b = map(int, input().split())\n\n a, b = a - 1, b - 1\n\n for y in range(-2, 1):\n\n for x in range(-2, 1):\n\n ny, nx = a + y, b + x\n\n if 0 <= ny < H - 2 and 0 <= nx < W - 2:\n\n d[(ny, nx)] += 1\n\n ans = [0] * 10\n\n for v in d.values():\n\n ans[v] += 1\n\n ans[0] = (H - 2) * (W - 2) - sum(ans)\n\n\n\n print(*ans, sep=\"\\n\")\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":24,"code_v1_loc":23,"code_v0_num_chars":581,"code_v1_num_chars":598,"code_v0_no_empty_lines":"from collections import defaultdict\n\n\ndef main():\n H, W, N = map(int, input().split())\n d = defaultdict(int)\n for _ in range(N):\n a, b = map(int, input().split())\n for y in range(-2, 1):\n for x in range(-2, 1):\n n_y, n_x = y + a, x + b\n if 0 < n_y <= H - 2 and 0 < n_x <= W - 2:\n d[(n_y, n_x)] += 1\n ans = [0] * 10\n for k, v in d.items():\n ans[v] += 1\n ans[0] = (H - 2) * (W - 2) - sum(ans)\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import defaultdict\n\n\ndef main():\n H, W, N = map(int, input().split())\n d = defaultdict(int)\n for _ in range(N):\n a, b = map(int, input().split())\n a, b = a - 1, b - 1\n for y in range(-2, 1):\n for x in range(-2, 1):\n ny, nx = a + y, b + x\n if 0 <= ny < H - 2 and 0 <= nx < W - 2:\n d[(ny, nx)] += 1\n ans = [0] * 10\n for v in d.values():\n ans[v] += 1\n ans[0] = (H - 2) * (W - 2) - sum(ans)\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":4.1666666667,"diff":["+ a, b = a - 1, b - 1","- n_y, n_x = y + a, x + b","- if 0 < n_y <= H - 2 and 0 < n_x <= W - 2:","- d[(n_y, n_x)] += 1","+ ny, nx = a + y, b + x","+ if 0 <= ny < H - 2 and 0 <= nx < W - 2:","+ d[(ny, nx)] += 1","- for k, v in d.items():","+ for v in d.values():"],"diff_only_import_comment":false,"measured_runtime_v0":0.0722925146,"measured_runtime_v1":0.0478363018,"runtime_lift":1.5112479816,"key":["s614720651","s266024754"]} +{"user_id":"u869790980","problem_id":"p03815","language":"python","submission_id_v0":"s889022058","submission_id_v1":"s815383629","cpu_time_v0":302,"cpu_time_v1":59,"memory_v0":85028,"memory_v1":64280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.46,"input":"n = int(input())\n\n\n\n\n\nc = 2 * (n \/ 11)\n\nh = {0:0}\n\nfor i in range(1, 6+1):\n\n\th[i] = 1\n\nfor i in range(7, 12):\n\n\th[i] = 2\n\nif n in h:\n\n\tprint(h[n])\n\nelse:\n\n\tprint(h[n % 11] + c)\n","target":"n = int(input())\n\nh = {0:0}\n\nfor i in range(1, 6+1): h[i] = 1\n\nfor i in range(7, 12): h[i] = 2\n\nprint(2 * (n \/ 11) + h[n % 11])","code_v0_loc":13,"code_v1_loc":5,"code_v0_num_chars":179,"code_v1_num_chars":130,"code_v0_no_empty_lines":"n = int(input())\nc = 2 * (n \/ 11)\nh = {0: 0}\nfor i in range(1, 6 + 1):\n h[i] = 1\nfor i in range(7, 12):\n h[i] = 2\nif n in h:\n print(h[n])\nelse:\n print(h[n % 11] + c)\n","code_v1_no_empty_lines":"n = int(input())\nh = {0: 0}\nfor i in range(1, 6 + 1):\n h[i] = 1\nfor i in range(7, 12):\n h[i] = 2\nprint(2 * (n \/ 11) + h[n % 11])\n","code_same":false,"relative_loc_diff_percent":61.5384615385,"diff":["-c = 2 * (n \/ 11)","-if n in h:","- print(h[n])","-else:","- print(h[n % 11] + c)","+print(2 * (n \/ 11) + h[n % 11])"],"diff_only_import_comment":false,"measured_runtime_v0":0.272963811,"measured_runtime_v1":0.0417449652,"runtime_lift":6.5388439041,"key":["s889022058","s815383629"]} +{"user_id":"u254871849","problem_id":"p02850","language":"python","submission_id_v0":"s679751811","submission_id_v1":"s124235762","cpu_time_v0":348,"cpu_time_v1":278,"memory_v0":38204,"memory_v1":38204,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.11,"input":"# 2019-11-24 20:59:47(JST)\n\nimport sys\n\n\n\ndef main():\n\n n = int(sys.stdin.readline().rstrip())\n\n m = list(map(int, sys.stdin.read().split()))\n\n ab = list(zip(m, m))\n\n\n\n graph = [[] for _ in range(n + 1)]\n\n for a, b in ab:\n\n graph[a].append(b)\n\n graph[b].append(a)\n\n\n\n root = 1\n\n parent = [0] * (n + 1)\n\n order = []\n\n stack = [root]\n\n\n\n while stack:\n\n x = stack.pop()\n\n order.append(x)\n\n for y in graph[x]:\n\n if y == parent[x]:\n\n continue\n\n parent[y] = x\n\n stack.append(y)\n\n\n\n color = [-1] * (n + 1)\n\n for x in order:\n\n ng = color[x]\n\n c = 1\n\n for y in graph[x]:\n\n if y == parent[x]:\n\n continue\n\n if c == ng:\n\n c += 1\n\n color[y] = c\n\n c += 1\n\n\n\n res = []\n\n for a, b in ab:\n\n if parent[a] == b:\n\n res.append(color[a])\n\n else:\n\n res.append(color[b])\n\n\n\n print((max(res)))\n\n print(('\\n'.join(map(str, res))))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"# 2019-11-24 20:59:47(JST)\n\nimport sys\n\n\n\ndef main():\n\n n = int(sys.stdin.readline().rstrip())\n\n m = list(map(int, sys.stdin.read().split()))\n\n ab = list(zip(m, m)) # 2\u56de\u4ee5\u4e0a\u4f7f\u3048\u308b\u3088\u3046\u306blist\u5316\n\n\n\n graph = [[] for _ in range(n + 1)]\n\n for a, b in ab:\n\n graph[a].append(b)\n\n graph[b].append(a)\n\n\n\n root = 1\n\n parent = [None] * (n + 1)\n\n # tree\u306a\u306e\u3067\u30eb\u30fc\u30d7\u304c\u306a\u3044\u305f\u3081\u3001parent\u304c\u5b9a\u7fa9\u3067\u304d\u308b\n\n checked = []\n\n to_check = [root]\n\n # dfs: depth first search \u3067\u306f stack\n\n # bfs: breadth first search \u3067\u306f queue\u3092\u4f7f\u3046\n\n # \u4eca\u56de\u306f stack\n\n\n\n while to_check:\n\n x = to_check.pop()\n\n # stack\u304b\u3089\u8981\u7d20\u3092\u53d6\u308a\u9664\u304d\u3001x\u306bset\n\n for y in graph[x]: # x\u304b\u3089\u76f4\u63a5\u3064\u306a\u304c\u3063\u3066\u3044\u308bvertices\u306b\u3064\u3044\u3066\n\n if y == parent[x]: \n\n continue\n\n # y\u304cx\u306e\u89aa\u3067\u306a\u3051\u308c\u3070\n\n parent[y] = x # x\u3092\u89aa\u306b\u3057\u3066\n\n to_check.append(y) # \u5b50\u3067\u3042\u308by\u3092to_check\u306bstack\u3057\u3066\u3044\u304f\n\n checked.append(x) # \u63a2\u7d22\u304c\u7d42\u308f\u3063\u305f\u3089vertex\u3092\u8a18\u9332\n\n\n\n color = [-1] * (n + 1) # \u521d\u671f\u306f0\u3067\u3082\u3044\u3044\u304c\u3001\u3042\u3048\u3066ng\u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u3084\u3059\u3044\u3088\u3046\u306b-1\u306b\u3057\u3066\u3044\u308b\n\n for x in checked: # check\u3055\u308c\u305f\u9806\u306b\u306a\u3063\u3066\u3044\u308b\n\n ng = color[x] # \u6700\u521d\u306f-1, color\u306f1\u304b\u3089\u306a\u306e\u3067\u6700\u521d\u306fng\u306b\u306f\u306a\u3089\u306a\u3044\n\n c = 1\n\n for y in graph[x]:\n\n if y == parent[x]:\n\n continue\n\n if c == ng:\n\n c += 1\n\n color[y] = c\n\n c += 1\n\n\n\n res = []\n\n for a, b in ab:\n\n if a == parent[b]:\n\n res.append(color[b])\n\n else: # \u6728\u306a\u306e\u3067 parent[a] == b\n\n res.append(color[a])\n\n\n\n print((max(res)))\n\n print(('\\n'.join(map(str, res))))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":52,"code_v1_loc":58,"code_v0_num_chars":1101,"code_v1_num_chars":1533,"code_v0_no_empty_lines":"# 2019-11-24 20:59:47(JST)\nimport sys\n\n\ndef main():\n n = int(sys.stdin.readline().rstrip())\n m = list(map(int, sys.stdin.read().split()))\n ab = list(zip(m, m))\n graph = [[] for _ in range(n + 1)]\n for a, b in ab:\n graph[a].append(b)\n graph[b].append(a)\n root = 1\n parent = [0] * (n + 1)\n order = []\n stack = [root]\n while stack:\n x = stack.pop()\n order.append(x)\n for y in graph[x]:\n if y == parent[x]:\n continue\n parent[y] = x\n stack.append(y)\n color = [-1] * (n + 1)\n for x in order:\n ng = color[x]\n c = 1\n for y in graph[x]:\n if y == parent[x]:\n continue\n if c == ng:\n c += 1\n color[y] = c\n c += 1\n res = []\n for a, b in ab:\n if parent[a] == b:\n res.append(color[a])\n else:\n res.append(color[b])\n print((max(res)))\n print((\"\\n\".join(map(str, res))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# 2019-11-24 20:59:47(JST)\nimport sys\n\n\ndef main():\n n = int(sys.stdin.readline().rstrip())\n m = list(map(int, sys.stdin.read().split()))\n ab = list(zip(m, m)) # 2\u56de\u4ee5\u4e0a\u4f7f\u3048\u308b\u3088\u3046\u306blist\u5316\n graph = [[] for _ in range(n + 1)]\n for a, b in ab:\n graph[a].append(b)\n graph[b].append(a)\n root = 1\n parent = [None] * (n + 1)\n # tree\u306a\u306e\u3067\u30eb\u30fc\u30d7\u304c\u306a\u3044\u305f\u3081\u3001parent\u304c\u5b9a\u7fa9\u3067\u304d\u308b\n checked = []\n to_check = [root]\n # dfs: depth first search \u3067\u306f stack\n # bfs: breadth first search \u3067\u306f queue\u3092\u4f7f\u3046\n # \u4eca\u56de\u306f stack\n while to_check:\n x = to_check.pop()\n # stack\u304b\u3089\u8981\u7d20\u3092\u53d6\u308a\u9664\u304d\u3001x\u306bset\n for y in graph[x]: # x\u304b\u3089\u76f4\u63a5\u3064\u306a\u304c\u3063\u3066\u3044\u308bvertices\u306b\u3064\u3044\u3066\n if y == parent[x]:\n continue\n # y\u304cx\u306e\u89aa\u3067\u306a\u3051\u308c\u3070\n parent[y] = x # x\u3092\u89aa\u306b\u3057\u3066\n to_check.append(y) # \u5b50\u3067\u3042\u308by\u3092to_check\u306bstack\u3057\u3066\u3044\u304f\n checked.append(x) # \u63a2\u7d22\u304c\u7d42\u308f\u3063\u305f\u3089vertex\u3092\u8a18\u9332\n color = [-1] * (n + 1) # \u521d\u671f\u306f0\u3067\u3082\u3044\u3044\u304c\u3001\u3042\u3048\u3066ng\u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u3084\u3059\u3044\u3088\u3046\u306b-1\u306b\u3057\u3066\u3044\u308b\n for x in checked: # check\u3055\u308c\u305f\u9806\u306b\u306a\u3063\u3066\u3044\u308b\n ng = color[x] # \u6700\u521d\u306f-1, color\u306f1\u304b\u3089\u306a\u306e\u3067\u6700\u521d\u306fng\u306b\u306f\u306a\u3089\u306a\u3044\n c = 1\n for y in graph[x]:\n if y == parent[x]:\n continue\n if c == ng:\n c += 1\n color[y] = c\n c += 1\n res = []\n for a, b in ab:\n if a == parent[b]:\n res.append(color[b])\n else: # \u6728\u306a\u306e\u3067 parent[a] == b\n res.append(color[a])\n print((max(res)))\n print((\"\\n\".join(map(str, res))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":10.3448275862,"diff":["- ab = list(zip(m, m))","+ ab = list(zip(m, m)) # 2\u56de\u4ee5\u4e0a\u4f7f\u3048\u308b\u3088\u3046\u306blist\u5316","- parent = [0] * (n + 1)","- order = []","- stack = [root]","- while stack:","- x = stack.pop()","- order.append(x)","- for y in graph[x]:","+ parent = [None] * (n + 1)","+ # tree\u306a\u306e\u3067\u30eb\u30fc\u30d7\u304c\u306a\u3044\u305f\u3081\u3001parent\u304c\u5b9a\u7fa9\u3067\u304d\u308b","+ checked = []","+ to_check = [root]","+ # dfs: depth first search \u3067\u306f stack","+ # bfs: breadth first search \u3067\u306f queue\u3092\u4f7f\u3046","+ # \u4eca\u56de\u306f stack","+ while to_check:","+ x = to_check.pop()","+ # stack\u304b\u3089\u8981\u7d20\u3092\u53d6\u308a\u9664\u304d\u3001x\u306bset","+ for y in graph[x]: # x\u304b\u3089\u76f4\u63a5\u3064\u306a\u304c\u3063\u3066\u3044\u308bvertices\u306b\u3064\u3044\u3066","- parent[y] = x","- stack.append(y)","- color = [-1] * (n + 1)","- for x in order:","- ng = color[x]","+ # y\u304cx\u306e\u89aa\u3067\u306a\u3051\u308c\u3070","+ parent[y] = x # x\u3092\u89aa\u306b\u3057\u3066","+ to_check.append(y) # \u5b50\u3067\u3042\u308by\u3092to_check\u306bstack\u3057\u3066\u3044\u304f","+ checked.append(x) # \u63a2\u7d22\u304c\u7d42\u308f\u3063\u305f\u3089vertex\u3092\u8a18\u9332","+ color = [-1] * (n + 1) # \u521d\u671f\u306f0\u3067\u3082\u3044\u3044\u304c\u3001\u3042\u3048\u3066ng\u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u3084\u3059\u3044\u3088\u3046\u306b-1\u306b\u3057\u3066\u3044\u308b","+ for x in checked: # check\u3055\u308c\u305f\u9806\u306b\u306a\u3063\u3066\u3044\u308b","+ ng = color[x] # \u6700\u521d\u306f-1, color\u306f1\u304b\u3089\u306a\u306e\u3067\u6700\u521d\u306fng\u306b\u306f\u306a\u3089\u306a\u3044","- if parent[a] == b:","+ if a == parent[b]:","+ res.append(color[b])","+ else: # \u6728\u306a\u306e\u3067 parent[a] == b","- else:","- res.append(color[b])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0803492751,"measured_runtime_v1":0.0423249233,"runtime_lift":1.898391512,"key":["s679751811","s124235762"]} +{"user_id":"u207799478","problem_id":"p03721","language":"python","submission_id_v0":"s735237691","submission_id_v1":"s021918262","cpu_time_v0":828,"cpu_time_v1":645,"memory_v0":62040,"memory_v1":66260,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.1,"input":"import itertools\n\nimport math\n\nimport string\n\nimport collections\n\nfrom collections import Counter\n\nfrom collections import deque\n\nfrom operator import itemgetter\n\nimport sys\n\nsys.setrecursionlimit(2*10**5)\n\nINF = 2**60\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)\/\/(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\n\nn, k = list(map(int, input().split()))\n\nab = [readints() for _ in range(n)]\n\n# print(ab)\n\nabab = sorted(ab)\n\n# print(abab)\n\ntmp = 0\n\nfor i in range(n):\n\n tmp += abab[i][1]\n\n if tmp >= k:\n\n print((abab[i][0]))\n\n break\n","target":"import math\n\nimport string\n\nimport collections\n\nfrom collections import Counter\n\nfrom collections import deque\n\nfrom decimal import Decimal\n\nimport sys\n\nimport fractions\n\n\n\n\n\ndef readints():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef nCr(n, r):\n\n return math.factorial(n)\/\/(math.factorial(n-r)*math.factorial(r))\n\n\n\n\n\ndef has_duplicates2(seq):\n\n seen = []\n\n for item in seq:\n\n if not(item in seen):\n\n seen.append(item)\n\n return len(seq) != len(seen)\n\n\n\n\n\ndef divisor(n):\n\n divisor = []\n\n for i in range(1, n+1):\n\n if n % i == 0:\n\n divisor.append(i)\n\n return divisor\n\n\n\n\n\n# coordinates\n\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\nn, k = list(map(int, input().split()))\n\nx = [0]*((10**5)+1)\n\nfor i in range(n):\n\n a, b = list(map(int, input().split()))\n\n x[a] += b\n\ny = 0\n\nfor i in range(len(x)):\n\n y += x[i]\n\n if y >= k:\n\n print(i)\n\n exit()\n","code_v0_loc":51,"code_v1_loc":48,"code_v0_num_chars":1001,"code_v1_num_chars":945,"code_v0_no_empty_lines":"import itertools\nimport math\nimport string\nimport collections\nfrom collections import Counter\nfrom collections import deque\nfrom operator import itemgetter\nimport sys\n\nsys.setrecursionlimit(2 * 10**5)\nINF = 2**60\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not (item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n + 1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\nn, k = list(map(int, input().split()))\nab = [readints() for _ in range(n)]\n# print(ab)\nabab = sorted(ab)\n# print(abab)\ntmp = 0\nfor i in range(n):\n tmp += abab[i][1]\n if tmp >= k:\n print((abab[i][0]))\n break\n","code_v1_no_empty_lines":"import math\nimport string\nimport collections\nfrom collections import Counter\nfrom collections import deque\nfrom decimal import Decimal\nimport sys\nimport fractions\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n) \/\/ (math.factorial(n - r) * math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not (item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n + 1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\nn, k = list(map(int, input().split()))\nx = [0] * ((10**5) + 1)\nfor i in range(n):\n a, b = list(map(int, input().split()))\n x[a] += b\ny = 0\nfor i in range(len(x)):\n y += x[i]\n if y >= k:\n print(i)\n exit()\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-import itertools","-from operator import itemgetter","+from decimal import Decimal","-","-sys.setrecursionlimit(2 * 10**5)","-INF = 2**60","+import fractions","-ab = [readints() for _ in range(n)]","-# print(ab)","-abab = sorted(ab)","-# print(abab)","-tmp = 0","+x = [0] * ((10**5) + 1)","- tmp += abab[i][1]","- if tmp >= k:","- print((abab[i][0]))","- break","+ a, b = list(map(int, input().split()))","+ x[a] += b","+y = 0","+for i in range(len(x)):","+ y += x[i]","+ if y >= k:","+ print(i)","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0459768209,"measured_runtime_v1":0.0775597967,"runtime_lift":0.5927919205,"key":["s735237691","s021918262"]} +{"user_id":"u561231954","problem_id":"p02775","language":"python","submission_id_v0":"s253971492","submission_id_v1":"s562523993","cpu_time_v0":1809,"cpu_time_v1":472,"memory_v0":183996,"memory_v1":21356,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.91,"input":"def main():\n\n n=list(eval(input()))\n\n n=[int(i) for i in n]\n\n l=len(n)\n\n \n\n dp=[[0]*2 for _ in range(l+1)]\n\n if n[0]>=5:\n\n dp[0][1]=1\n\n \n\n for i in range(l):\n\n dp[i+1][0]=min(dp[i][0]+n[i],dp[i][1]+10-n[i])\n\n dp[i+1][1]=min(dp[i][0]+n[i]+1,dp[i][1]+9-n[i])\n\n \n\n #print(dp)\n\n print((dp[l][0]))\n\n\n\nif __name__=='__main__':\n\n main()\n","target":"def main():\n\n n=list(eval(input()))\n\n n=[int(i) for i in reversed(n)]\n\n l=len(n)\n\n n.append(0)\n\n \n\n ans=0\n\n for i in range(l):\n\n if n[i]<=4:\n\n a=n[i]\n\n elif n[i]==5:\n\n if n[i+1]<=4:\n\n a=n[i]\n\n else:\n\n a=10-n[i]\n\n n[i+1]+=1\n\n else:\n\n n[i+1]+=1\n\n a=10-n[i]\n\n ans+=a\n\n ans+=n[l]\n\n print(ans) \n\nif __name__=='__main__':\n\n main()\n","code_v0_loc":18,"code_v1_loc":24,"code_v0_num_chars":355,"code_v1_num_chars":390,"code_v0_no_empty_lines":"def main():\n n = list(eval(input()))\n n = [int(i) for i in n]\n l = len(n)\n dp = [[0] * 2 for _ in range(l + 1)]\n if n[0] >= 5:\n dp[0][1] = 1\n for i in range(l):\n dp[i + 1][0] = min(dp[i][0] + n[i], dp[i][1] + 10 - n[i])\n dp[i + 1][1] = min(dp[i][0] + n[i] + 1, dp[i][1] + 9 - n[i])\n # print(dp)\n print((dp[l][0]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n = list(eval(input()))\n n = [int(i) for i in reversed(n)]\n l = len(n)\n n.append(0)\n ans = 0\n for i in range(l):\n if n[i] <= 4:\n a = n[i]\n elif n[i] == 5:\n if n[i + 1] <= 4:\n a = n[i]\n else:\n a = 10 - n[i]\n n[i + 1] += 1\n else:\n n[i + 1] += 1\n a = 10 - n[i]\n ans += a\n ans += n[l]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["- n = [int(i) for i in n]","+ n = [int(i) for i in reversed(n)]","- dp = [[0] * 2 for _ in range(l + 1)]","- if n[0] >= 5:","- dp[0][1] = 1","+ n.append(0)","+ ans = 0","- dp[i + 1][0] = min(dp[i][0] + n[i], dp[i][1] + 10 - n[i])","- dp[i + 1][1] = min(dp[i][0] + n[i] + 1, dp[i][1] + 9 - n[i])","- # print(dp)","- print((dp[l][0]))","+ if n[i] <= 4:","+ a = n[i]","+ elif n[i] == 5:","+ if n[i + 1] <= 4:","+ a = n[i]","+ else:","+ a = 10 - n[i]","+ n[i + 1] += 1","+ else:","+ n[i + 1] += 1","+ a = 10 - n[i]","+ ans += a","+ ans += n[l]","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0553980179,"measured_runtime_v1":0.0731788745,"runtime_lift":0.7570219993,"key":["s253971492","s562523993"]} +{"user_id":"u707124227","problem_id":"p03162","language":"python","submission_id_v0":"s974150804","submission_id_v1":"s786290046","cpu_time_v0":1345,"cpu_time_v1":1115,"memory_v0":41916,"memory_v1":41792,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.1,"input":"import numpy as np\n\nn=int(eval(input()))\n\nabc=[]\n\nfor _ in range(n):\n\n abc.append(list(map(int,input().split())))\n\ndp=np.zeros((n+1,3),np.int64)\n\n# dp[i][0]:i\u65e5\u76ee\u3067a\u3092\u3068\u3063\u305f\u6642\u306e\u6700\u5927\u3002dp[0]=[0,0,0]\u3002\u6c42\u3081\u308b\u306e\u306fmax(dp[n])\n\ndp[1]=np.array(abc[0])\n\nfor i in range(2,n+1):\n\n dp[i][0]=abc[i-1][0]+max(dp[i-1][1],dp[i-1][2])\n\n dp[i][1]=abc[i-1][1]+max(dp[i-1][0],dp[i-1][2])\n\n dp[i][2]=abc[i-1][2]+max(dp[i-1][0],dp[i-1][1])\n\n\n\nprint((int(np.max(dp[-1]))))\n","target":"import numpy as np\n\nn=int(eval(input()))\n\nabc=np.array([list(map(int,input().split())) for _ in range(n)])\n\ndp=np.zeros((n+1,3),np.int64)\n\n# dp[i+1][j]:i\u65e5\u76ee\u306bj\u3067\u904a\u3093\u3060\u6642\u306e\u6700\u5927\u306e\u5e78\u798f\u5ea6\n\n# dp[0][j]=0,dp[1][j]=abc[0][j]\n\ndp[1]=abc[0]\n\nfor i in range(1,n):\n\n dp[i+1][0]=abc[i][0]+max(dp[i][1],dp[i][2])\n\n dp[i+1][1]=abc[i][1]+max(dp[i][0],dp[i][2])\n\n dp[i+1][2]=abc[i][2]+max(dp[i][0],dp[i][1])\n\nprint((np.max(dp[-1])))","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":443,"code_v1_num_chars":408,"code_v0_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nabc = []\nfor _ in range(n):\n abc.append(list(map(int, input().split())))\ndp = np.zeros((n + 1, 3), np.int64)\n# dp[i][0]:i\u65e5\u76ee\u3067a\u3092\u3068\u3063\u305f\u6642\u306e\u6700\u5927\u3002dp[0]=[0,0,0]\u3002\u6c42\u3081\u308b\u306e\u306fmax(dp[n])\ndp[1] = np.array(abc[0])\nfor i in range(2, n + 1):\n dp[i][0] = abc[i - 1][0] + max(dp[i - 1][1], dp[i - 1][2])\n dp[i][1] = abc[i - 1][1] + max(dp[i - 1][0], dp[i - 1][2])\n dp[i][2] = abc[i - 1][2] + max(dp[i - 1][0], dp[i - 1][1])\nprint((int(np.max(dp[-1]))))\n","code_v1_no_empty_lines":"import numpy as np\n\nn = int(eval(input()))\nabc = np.array([list(map(int, input().split())) for _ in range(n)])\ndp = np.zeros((n + 1, 3), np.int64)\n# dp[i+1][j]:i\u65e5\u76ee\u306bj\u3067\u904a\u3093\u3060\u6642\u306e\u6700\u5927\u306e\u5e78\u798f\u5ea6\n# dp[0][j]=0,dp[1][j]=abc[0][j]\ndp[1] = abc[0]\nfor i in range(1, n):\n dp[i + 1][0] = abc[i][0] + max(dp[i][1], dp[i][2])\n dp[i + 1][1] = abc[i][1] + max(dp[i][0], dp[i][2])\n dp[i + 1][2] = abc[i][2] + max(dp[i][0], dp[i][1])\nprint((np.max(dp[-1])))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-abc = []","-for _ in range(n):","- abc.append(list(map(int, input().split())))","+abc = np.array([list(map(int, input().split())) for _ in range(n)])","-# dp[i][0]:i\u65e5\u76ee\u3067a\u3092\u3068\u3063\u305f\u6642\u306e\u6700\u5927\u3002dp[0]=[0,0,0]\u3002\u6c42\u3081\u308b\u306e\u306fmax(dp[n])","-dp[1] = np.array(abc[0])","-for i in range(2, n + 1):","- dp[i][0] = abc[i - 1][0] + max(dp[i - 1][1], dp[i - 1][2])","- dp[i][1] = abc[i - 1][1] + max(dp[i - 1][0], dp[i - 1][2])","- dp[i][2] = abc[i - 1][2] + max(dp[i - 1][0], dp[i - 1][1])","-print((int(np.max(dp[-1]))))","+# dp[i+1][j]:i\u65e5\u76ee\u306bj\u3067\u904a\u3093\u3060\u6642\u306e\u6700\u5927\u306e\u5e78\u798f\u5ea6","+# dp[0][j]=0,dp[1][j]=abc[0][j]","+dp[1] = abc[0]","+for i in range(1, n):","+ dp[i + 1][0] = abc[i][0] + max(dp[i][1], dp[i][2])","+ dp[i + 1][1] = abc[i][1] + max(dp[i][0], dp[i][2])","+ dp[i + 1][2] = abc[i][2] + max(dp[i][0], dp[i][1])","+print((np.max(dp[-1])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3045470078,"measured_runtime_v1":0.2087178466,"runtime_lift":1.4591325692,"key":["s974150804","s786290046"]} +{"user_id":"u357751375","problem_id":"p02786","language":"python","submission_id_v0":"s186244575","submission_id_v1":"s300360921","cpu_time_v0":31,"cpu_time_v1":28,"memory_v0":9144,"memory_v1":9104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.68,"input":"h = int(eval(input()))\n\np = 1\n\ni = 1\n\n\n\nwhile h > 1:\n\n h = h \/\/ 2\n\n p += 2 ** i\n\n i += 1\n\n\n\nprint(p)","target":"h = int(eval(input()))\n\nans = 1\n\ni = 1\n\nwhile h > 1:\n\n h = h \/\/ 2\n\n ans += 2 ** i\n\n i += 1\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":103,"code_v1_num_chars":105,"code_v0_no_empty_lines":"h = int(eval(input()))\np = 1\ni = 1\nwhile h > 1:\n h = h \/\/ 2\n p += 2**i\n i += 1\nprint(p)\n","code_v1_no_empty_lines":"h = int(eval(input()))\nans = 1\ni = 1\nwhile h > 1:\n h = h \/\/ 2\n ans += 2**i\n i += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-p = 1","+ans = 1","- p += 2**i","+ ans += 2**i","-print(p)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0457392275,"measured_runtime_v1":0.1045134892,"runtime_lift":0.4376394651,"key":["s186244575","s300360921"]} +{"user_id":"u554784585","problem_id":"p03254","language":"python","submission_id_v0":"s116423640","submission_id_v1":"s391145352","cpu_time_v0":33,"cpu_time_v1":27,"memory_v0":9168,"memory_v1":8960,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"N,x=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\ntemp=x\n\nans=0\n\na.sort()\n\ni=-1\n\nwhile True:\n\n i+=1\n\n x-=a[i]\n\n if x<0:\n\n break\n\n ans+=1\n\n if ans==N:\n\n break\n\nif sum(a) 1: # duplicate\n\n candidates[key] = False\n\n for i in range(key * 2, maximum, key):\n\n candidates[i] = False\n\n\n\n ans = sum(candidates[x] for x in array)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n eval(input())\n\n array = sorted(int(x) for x in input().split())\n\n maximum = array[-1] + 1\n\n counter = [0] * maximum\n\n\n\n for x in array:\n\n if counter[x] != 0:\n\n counter[x] = 2\n\n continue\n\n else:\n\n for multiple in range(x, maximum, x):\n\n counter[multiple] += 1\n\n ans = 0\n\n for x in array:\n\n if counter[x] == 1:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":25,"code_v1_loc":22,"code_v0_num_chars":589,"code_v1_num_chars":489,"code_v0_no_empty_lines":"from collections import defaultdict\n\n\ndef main():\n eval(input())\n array = sorted(int(x) for x in input().split())\n maximum = 1000003\n counter = defaultdict(int)\n for x in array:\n counter[x] += 1\n maximum = array[-1] + 1\n candidates = [True] * maximum\n for key, value in list(counter.items()):\n if value > 1: # duplicate\n candidates[key] = False\n for i in range(key * 2, maximum, key):\n candidates[i] = False\n ans = sum(candidates[x] for x in array)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n eval(input())\n array = sorted(int(x) for x in input().split())\n maximum = array[-1] + 1\n counter = [0] * maximum\n for x in array:\n if counter[x] != 0:\n counter[x] = 2\n continue\n else:\n for multiple in range(x, maximum, x):\n counter[multiple] += 1\n ans = 0\n for x in array:\n if counter[x] == 1:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["-from collections import defaultdict","-","-","- maximum = 1000003","- counter = defaultdict(int)","+ maximum = array[-1] + 1","+ counter = [0] * maximum","- counter[x] += 1","- maximum = array[-1] + 1","- candidates = [True] * maximum","- for key, value in list(counter.items()):","- if value > 1: # duplicate","- candidates[key] = False","- for i in range(key * 2, maximum, key):","- candidates[i] = False","- ans = sum(candidates[x] for x in array)","+ if counter[x] != 0:","+ counter[x] = 2","+ continue","+ else:","+ for multiple in range(x, maximum, x):","+ counter[multiple] += 1","+ ans = 0","+ for x in array:","+ if counter[x] == 1:","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0362458196,"measured_runtime_v1":0.0341855688,"runtime_lift":1.0602666804,"key":["s754064026","s012722677"]} +{"user_id":"u861466636","problem_id":"p03252","language":"python","submission_id_v0":"s988717685","submission_id_v1":"s962582491","cpu_time_v0":111,"cpu_time_v1":28,"memory_v0":3776,"memory_v1":3632,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.77,"input":"s = eval(input())\n\nt = eval(input())\n\n\n\nfrom collections import defaultdict\n\n\n\ntd = defaultdict(set)\n\nsd = defaultdict(set)\n\nfor i in range(len(s)):\n\n td[t[i]].add(s[i])\n\n sd[s[i]].add(t[i])\n\n\n\nfor tv, sv in zip(list(td.values()), list(sd.values())):\n\n if (len(tv) > 1) or (len(sv) > 1):\n\n print(\"No\")\n\n break\n\nelse:\n\n print('Yes')","target":"s = eval(input())\n\nt = eval(input())\n\nsl = []\n\ntl = []\n\nfor c in \"abcdefghijklmnopqrstuvwxyz\":\n\n sl.append(s.count(c))\n\n tl.append(t.count(c))\n\nif sorted(sl)==sorted(tl):\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":17,"code_v1_loc":11,"code_v0_num_chars":341,"code_v1_num_chars":206,"code_v0_no_empty_lines":"s = eval(input())\nt = eval(input())\nfrom collections import defaultdict\n\ntd = defaultdict(set)\nsd = defaultdict(set)\nfor i in range(len(s)):\n td[t[i]].add(s[i])\n sd[s[i]].add(t[i])\nfor tv, sv in zip(list(td.values()), list(sd.values())):\n if (len(tv) > 1) or (len(sv) > 1):\n print(\"No\")\n break\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"s = eval(input())\nt = eval(input())\nsl = []\ntl = []\nfor c in \"abcdefghijklmnopqrstuvwxyz\":\n sl.append(s.count(c))\n tl.append(t.count(c))\nif sorted(sl) == sorted(tl):\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":35.2941176471,"diff":["-from collections import defaultdict","-","-td = defaultdict(set)","-sd = defaultdict(set)","-for i in range(len(s)):","- td[t[i]].add(s[i])","- sd[s[i]].add(t[i])","-for tv, sv in zip(list(td.values()), list(sd.values())):","- if (len(tv) > 1) or (len(sv) > 1):","- print(\"No\")","- break","+sl = []","+tl = []","+for c in \"abcdefghijklmnopqrstuvwxyz\":","+ sl.append(s.count(c))","+ tl.append(t.count(c))","+if sorted(sl) == sorted(tl):","+ print(\"Yes\")","- print(\"Yes\")","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0786018729,"measured_runtime_v1":0.0387291017,"runtime_lift":2.0295299797,"key":["s988717685","s962582491"]} +{"user_id":"u562935282","problem_id":"p03607","language":"python","submission_id_v0":"s311783459","submission_id_v1":"s691686388","cpu_time_v0":239,"cpu_time_v1":77,"memory_v0":16256,"memory_v1":16640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.78,"input":"n = int(eval(input()))\n\na = list(int(eval(input())) for _ in range(n))\n\nd = {}\n\nfor i in range(n):\n\n d[a[i]] = d.get(a[i], 0) + 1\n\nans = 0\n\nfor v in list(d.values()):\n\n if v % 2 == 1:\n\n ans += 1\n\nprint(ans)","target":"def main():\n\n from collections import Counter\n\n import sys\n\n\n\n input = sys.stdin.readline\n\n\n\n N = int(eval(input())) # <= 10**5\n\n a = [int(eval(input())) for _ in range(N)]\n\n ctr = Counter(a)\n\n\n\n ans = 0\n\n for cnt in list(ctr.values()):\n\n ans += cnt % 2\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n# import sys\n\n#\n\n# sys.setrecursionlimit(10 ** 7)\n\n#\n\n# input = sys.stdin.readline\n\n# rstrip()\n\n# int(input())\n\n# map(int, input().split())\n","code_v0_loc":10,"code_v1_loc":27,"code_v0_num_chars":201,"code_v1_num_chars":471,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(int(eval(input())) for _ in range(n))\nd = {}\nfor i in range(n):\n d[a[i]] = d.get(a[i], 0) + 1\nans = 0\nfor v in list(d.values()):\n if v % 2 == 1:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n from collections import Counter\n import sys\n\n input = sys.stdin.readline\n N = int(eval(input())) # <= 10**5\n a = [int(eval(input())) for _ in range(N)]\n ctr = Counter(a)\n ans = 0\n for cnt in list(ctr.values()):\n ans += cnt % 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n# import sys\n#\n# sys.setrecursionlimit(10 ** 7)\n#\n# input = sys.stdin.readline\n# rstrip()\n# int(input())\n# map(int, input().split())\n","code_same":false,"relative_loc_diff_percent":62.962962963,"diff":["-n = int(eval(input()))","-a = list(int(eval(input())) for _ in range(n))","-d = {}","-for i in range(n):","- d[a[i]] = d.get(a[i], 0) + 1","-ans = 0","-for v in list(d.values()):","- if v % 2 == 1:","- ans += 1","-print(ans)","+def main():","+ from collections import Counter","+ import sys","+","+ input = sys.stdin.readline","+ N = int(eval(input())) # <= 10**5","+ a = [int(eval(input())) for _ in range(N)]","+ ctr = Counter(a)","+ ans = 0","+ for cnt in list(ctr.values()):","+ ans += cnt % 2","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()","+# import sys","+#","+# sys.setrecursionlimit(10 ** 7)","+#","+# input = sys.stdin.readline","+# rstrip()","+# int(input())","+# map(int, input().split())"],"diff_only_import_comment":false,"measured_runtime_v0":0.0465752788,"measured_runtime_v1":0.0622129471,"runtime_lift":0.7486428613,"key":["s311783459","s691686388"]} +{"user_id":"u796942881","problem_id":"p03262","language":"python","submission_id_v0":"s166444279","submission_id_v1":"s153130531","cpu_time_v0":76,"cpu_time_v1":68,"memory_v0":14212,"memory_v1":14052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"def gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n\n\n\n\ndef gcd_n(numbers):\n\n ret = numbers[0]\n\n for i in range(len(numbers)):\n\n ret = gcd(ret, numbers[i])\n\n return ret\n\n\n\n\n\ndef main():\n\n N, X = list(map(int, input().split()))\n\n x = [abs(X - int(i)) for i in input().split()]\n\n print((gcd_n(x)))\n\n return\n\n\n\n\n\nmain()\n","target":"def gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n\n\n\n\ndef main():\n\n N, X, *xn = list(map(int, open(0).read().split()))\n\n ans = None\n\n for x in xn:\n\n if ans is not None:\n\n ans = gcd(ans, abs(X - x))\n\n else:\n\n ans = abs(X - xn[0])\n\n print(ans)\n\n return\n\n\n\n\n\nmain()\n","code_v0_loc":21,"code_v1_loc":19,"code_v0_num_chars":354,"code_v1_num_chars":327,"code_v0_no_empty_lines":"def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef gcd_n(numbers):\n ret = numbers[0]\n for i in range(len(numbers)):\n ret = gcd(ret, numbers[i])\n return ret\n\n\ndef main():\n N, X = list(map(int, input().split()))\n x = [abs(X - int(i)) for i in input().split()]\n print((gcd_n(x)))\n return\n\n\nmain()\n","code_v1_no_empty_lines":"def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef main():\n N, X, *xn = list(map(int, open(0).read().split()))\n ans = None\n for x in xn:\n if ans is not None:\n ans = gcd(ans, abs(X - x))\n else:\n ans = abs(X - xn[0])\n print(ans)\n return\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":9.5238095238,"diff":["-def gcd_n(numbers):","- ret = numbers[0]","- for i in range(len(numbers)):","- ret = gcd(ret, numbers[i])","- return ret","-","-","- N, X = list(map(int, input().split()))","- x = [abs(X - int(i)) for i in input().split()]","- print((gcd_n(x)))","+ N, X, *xn = list(map(int, open(0).read().split()))","+ ans = None","+ for x in xn:","+ if ans is not None:","+ ans = gcd(ans, abs(X - x))","+ else:","+ ans = abs(X - xn[0])","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0506485188,"measured_runtime_v1":0.046786324,"runtime_lift":1.082549652,"key":["s166444279","s153130531"]} +{"user_id":"u057109575","problem_id":"p02955","language":"python","submission_id_v0":"s998716912","submission_id_v1":"s891475063","cpu_time_v0":308,"cpu_time_v1":145,"memory_v0":43936,"memory_v1":75212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.92,"input":"from itertools import accumulate\n\nN, K, *A = list(map(int, open(0).read().split()))\n\n\n\ndef check(d):\n\n r = sorted([v % d for v in A])\n\n r_inv = [d - v for v in r] \n\n r_cs = [0] + list(accumulate(r))\n\n r_inv_cs = list(accumulate(r_inv[::-1]))[::-1] + [0]\n\n\n\n ret = False\n\n for i in range(N + 1):\n\n flg1 = r_cs[i] <= K\n\n flg2 = r_cs[i] == r_inv_cs[i]\n\n ret = (flg1 and flg2) or ret\n\n \n\n return ret\n\n\n\nM = sum(A)\n\nans = 0\n\nfor i in reversed(list(range(1, int(M ** 0.5) + 1))):\n\n if M % i == 0 and check(i):\n\n ans = max(ans, i)\n\n if M % (M \/\/ i) == 0 and check(M \/\/ i):\n\n ans = max(ans, M \/\/ i)\n\n \n\nprint(ans)\n","target":"from itertools import accumulate\n\n\n\nN, K, *A = list(map(int, open(0).read().split()))\n\n\n\ns = sum(A)\n\ndivisor = []\n\nfor i in range(1, int(s ** 0.5) + 1):\n\n if s % i == 0:\n\n divisor.append(i)\n\n if i != s \/\/ i:\n\n divisor.append(s \/\/ i)\n\n\n\nans = 0\n\nfor d in divisor:\n\n x = sorted(v % d for v in A)\n\n y = [d - r for r in x]\n\n x_s = [0] + list(accumulate(x))\n\n y_s = list(accumulate(y[::-1]))[::-1] + [0]\n\n\n\n for i in range(N + 1):\n\n if x_s[i] <= K and x_s[i] == y_s[i]:\n\n ans = max(ans, d)\n\n break\n\n\n\nprint(ans)\n","code_v0_loc":26,"code_v1_loc":25,"code_v0_num_chars":669,"code_v1_num_chars":573,"code_v0_no_empty_lines":"from itertools import accumulate\n\nN, K, *A = list(map(int, open(0).read().split()))\n\n\ndef check(d):\n r = sorted([v % d for v in A])\n r_inv = [d - v for v in r]\n r_cs = [0] + list(accumulate(r))\n r_inv_cs = list(accumulate(r_inv[::-1]))[::-1] + [0]\n ret = False\n for i in range(N + 1):\n flg1 = r_cs[i] <= K\n flg2 = r_cs[i] == r_inv_cs[i]\n ret = (flg1 and flg2) or ret\n return ret\n\n\nM = sum(A)\nans = 0\nfor i in reversed(list(range(1, int(M**0.5) + 1))):\n if M % i == 0 and check(i):\n ans = max(ans, i)\n if M % (M \/\/ i) == 0 and check(M \/\/ i):\n ans = max(ans, M \/\/ i)\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import accumulate\n\nN, K, *A = list(map(int, open(0).read().split()))\ns = sum(A)\ndivisor = []\nfor i in range(1, int(s**0.5) + 1):\n if s % i == 0:\n divisor.append(i)\n if i != s \/\/ i:\n divisor.append(s \/\/ i)\nans = 0\nfor d in divisor:\n x = sorted(v % d for v in A)\n y = [d - r for r in x]\n x_s = [0] + list(accumulate(x))\n y_s = list(accumulate(y[::-1]))[::-1] + [0]\n for i in range(N + 1):\n if x_s[i] <= K and x_s[i] == y_s[i]:\n ans = max(ans, d)\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":3.8461538462,"diff":["-","-","-def check(d):","- r = sorted([v % d for v in A])","- r_inv = [d - v for v in r]","- r_cs = [0] + list(accumulate(r))","- r_inv_cs = list(accumulate(r_inv[::-1]))[::-1] + [0]","- ret = False","+s = sum(A)","+divisor = []","+for i in range(1, int(s**0.5) + 1):","+ if s % i == 0:","+ divisor.append(i)","+ if i != s \/\/ i:","+ divisor.append(s \/\/ i)","+ans = 0","+for d in divisor:","+ x = sorted(v % d for v in A)","+ y = [d - r for r in x]","+ x_s = [0] + list(accumulate(x))","+ y_s = list(accumulate(y[::-1]))[::-1] + [0]","- flg1 = r_cs[i] <= K","- flg2 = r_cs[i] == r_inv_cs[i]","- ret = (flg1 and flg2) or ret","- return ret","-","-","-M = sum(A)","-ans = 0","-for i in reversed(list(range(1, int(M**0.5) + 1))):","- if M % i == 0 and check(i):","- ans = max(ans, i)","- if M % (M \/\/ i) == 0 and check(M \/\/ i):","- ans = max(ans, M \/\/ i)","+ if x_s[i] <= K and x_s[i] == y_s[i]:","+ ans = max(ans, d)","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.0371098957,"measured_runtime_v1":0.0784477799,"runtime_lift":0.4730522107,"key":["s998716912","s891475063"]} +{"user_id":"u227082700","problem_id":"p03994","language":"python","submission_id_v0":"s265798665","submission_id_v1":"s030644331","cpu_time_v0":810,"cpu_time_v1":82,"memory_v0":4980,"memory_v1":4212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.88,"input":"s=eval(input())\n\nk=int(eval(input()))\n\nt=\"abcdefghijklmnopqrstuvwxyz\"\n\na=[t.index(i)for i in s]\n\ni=0\n\nwhile k:\n\n if i==len(s)-1:a[i]+=k;a[i]%=26;k=0\n\n if a[i]==0 or 26-a[i]>k:i+=1\n\n else:a[i]+=1;a[i]%=26;k-=1\n\nprint((\"\".join([t[i]for i in a])))","target":"t=\"abcdefghijklmnopqrstuvwxyz\"\n\ns=eval(input())\n\nk=int(eval(input()))\n\na=[t.index(i)for i in s]\n\nans=\"\"\n\nfor i in a:\n\n j=i\n\n if i==0:\n\n ans+=\"a\"\n\n continue\n\n if k>=26-i:\n\n k-=26-i\n\n j=0\n\n ans+=t[j]\n\nj+=k\n\nj%=26\n\nans=ans[:-1]+t[j]\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":18,"code_v0_num_chars":233,"code_v1_num_chars":245,"code_v0_no_empty_lines":"s = eval(input())\nk = int(eval(input()))\nt = \"abcdefghijklmnopqrstuvwxyz\"\na = [t.index(i) for i in s]\ni = 0\nwhile k:\n if i == len(s) - 1:\n a[i] += k\n a[i] %= 26\n k = 0\n if a[i] == 0 or 26 - a[i] > k:\n i += 1\n else:\n a[i] += 1\n a[i] %= 26\n k -= 1\nprint((\"\".join([t[i] for i in a])))\n","code_v1_no_empty_lines":"t = \"abcdefghijklmnopqrstuvwxyz\"\ns = eval(input())\nk = int(eval(input()))\na = [t.index(i) for i in s]\nans = \"\"\nfor i in a:\n j = i\n if i == 0:\n ans += \"a\"\n continue\n if k >= 26 - i:\n k -= 26 - i\n j = 0\n ans += t[j]\nj += k\nj %= 26\nans = ans[:-1] + t[j]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["+t = \"abcdefghijklmnopqrstuvwxyz\"","-t = \"abcdefghijklmnopqrstuvwxyz\"","-i = 0","-while k:","- if i == len(s) - 1:","- a[i] += k","- a[i] %= 26","- k = 0","- if a[i] == 0 or 26 - a[i] > k:","- i += 1","- else:","- a[i] += 1","- a[i] %= 26","- k -= 1","-print((\"\".join([t[i] for i in a])))","+ans = \"\"","+for i in a:","+ j = i","+ if i == 0:","+ ans += \"a\"","+ continue","+ if k >= 26 - i:","+ k -= 26 - i","+ j = 0","+ ans += t[j]","+j += k","+j %= 26","+ans = ans[:-1] + t[j]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0377553546,"measured_runtime_v1":0.0387195504,"runtime_lift":0.9750979614,"key":["s265798665","s030644331"]} +{"user_id":"u075012704","problem_id":"p02722","language":"python","submission_id_v0":"s212212763","submission_id_v1":"s312382928","cpu_time_v0":648,"cpu_time_v1":294,"memory_v0":3188,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.63,"input":"N = int(eval(input()))\n\n\n\nif N == 2:\n\n print((1))\n\n exit()\n\n\n\nif N == 3:\n\n print((2))\n\n exit()\n\n\n\nans = []\n\nfor n in range(1, int(N ** 0.5) + 1):\n\n if (N - 1) % n == 0:\n\n ans.append(n)\n\n ans.append((N - 1) \/\/ n)\n\n\n\nfor k in range(2, int(N ** 0.5) + 1):\n\n x = N\n\n while x % k == 0:\n\n x \/\/= k\n\n\n\n if 1 in (x % k - k, x % k):\n\n ans.append(k)\n\n\n\nprint((len(set(ans))))\n","target":"N = int(eval(input()))\n\n\n\nans = []\n\nfor n in range(1, int(N ** 0.5) + 1):\n\n if (N - 1) % n == 0:\n\n ans.append(n)\n\n ans.append((N - 1) \/\/ n)\n\n\n\nfor k in range(2, int(N ** 0.5) + 1):\n\n if N % k != 0:\n\n continue\n\n\n\n x = N\n\n while x % k == 0:\n\n x \/\/= k\n\n\n\n if x % k == 1:\n\n ans.append(k)\n\n\n\nprint((len(set(ans))))\n","code_v0_loc":25,"code_v1_loc":20,"code_v0_num_chars":405,"code_v1_num_chars":352,"code_v0_no_empty_lines":"N = int(eval(input()))\nif N == 2:\n print((1))\n exit()\nif N == 3:\n print((2))\n exit()\nans = []\nfor n in range(1, int(N**0.5) + 1):\n if (N - 1) % n == 0:\n ans.append(n)\n ans.append((N - 1) \/\/ n)\nfor k in range(2, int(N**0.5) + 1):\n x = N\n while x % k == 0:\n x \/\/= k\n if 1 in (x % k - k, x % k):\n ans.append(k)\nprint((len(set(ans))))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nans = []\nfor n in range(1, int(N**0.5) + 1):\n if (N - 1) % n == 0:\n ans.append(n)\n ans.append((N - 1) \/\/ n)\nfor k in range(2, int(N**0.5) + 1):\n if N % k != 0:\n continue\n x = N\n while x % k == 0:\n x \/\/= k\n if x % k == 1:\n ans.append(k)\nprint((len(set(ans))))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-if N == 2:","- print((1))","- exit()","-if N == 3:","- print((2))","- exit()","+ if N % k != 0:","+ continue","- if 1 in (x % k - k, x % k):","+ if x % k == 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0971899285,"measured_runtime_v1":0.0881948574,"runtime_lift":1.1019908805,"key":["s212212763","s312382928"]} +{"user_id":"u729133443","problem_id":"p03426","language":"python","submission_id_v0":"s658449706","submission_id_v1":"s434347704","cpu_time_v0":1199,"cpu_time_v1":949,"memory_v0":71164,"memory_v1":19436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.85,"input":"h,w,d=list(map(int,input().split()))\n\nl=[[0,0]]+[[]for _ in range(h*w)]\n\nfor i in range(h):\n\n for j,a in enumerate(map(int,input().split())):\n\n l[a]=[i,j]\n\nfor i in range(h*w+1):\n\n if i int:\n\n res = 1\n\n for i in range(1, N+1):\n\n res *= i\n\n res %= mod\n\n return res\n\n\n\n\n\nN = int(eval(input()))\n\nS = eval(input())\n\nmod = 10**9+7\n\n\n\nif S[0] == 'W' or S[-1] == 'W':\n\n print((0))\n\n sys.exit()\n\n\n\nop = [0]*(2*N)\n\nop[0] = False\n\nfor i in range(1, 2*N):\n\n if S[i] == S[i-1]:\n\n op[i] = True if op[i-1] is False else False\n\n else:\n\n op[i] = True if op[i-1] is True else False\n\n\n\nif op.count(True) != N:\n\n print((0))\n\n sys.exit()\n\n\n\nans = 1\n\nL_ct = 0\n\nR_ct = 0\n\nfor i in op:\n\n if i:\n\n ans *= L_ct\n\n L_ct -= 1\n\n else:\n\n L_ct += 1\n\n ans %= mod\n\n\n\nprint((factorial(N, mod) * ans % mod))\n","code_v0_loc":34,"code_v1_loc":43,"code_v0_num_chars":549,"code_v1_num_chars":704,"code_v0_no_empty_lines":"import sys\nfrom math import factorial\n\nN = int(eval(input()))\nS = eval(input())\nmod = 10**9 + 7\nif S[0] == \"W\" or S[-1] == \"W\":\n print((0))\n sys.exit()\nop = \"L\"\nfor i in range(1, 2 * N):\n if S[i] == S[i - 1]:\n op += \"R\" if op[i - 1] == \"L\" else \"L\"\n else:\n op += \"R\" if op[i - 1] == \"R\" else \"L\"\nif op.count(\"L\") != N:\n print((0))\n sys.exit()\nct_L, ans = 0, 1\nfor i in op:\n if i == \"L\":\n ct_L += 1\n else:\n ans *= ct_L\n ct_L -= 1\n ans %= mod\nprint((factorial(N) * ans % mod))\n","code_v1_no_empty_lines":"import sys\n\n\ndef factorial(N: int, mod: int) -> int:\n res = 1\n for i in range(1, N + 1):\n res *= i\n res %= mod\n return res\n\n\nN = int(eval(input()))\nS = eval(input())\nmod = 10**9 + 7\nif S[0] == \"W\" or S[-1] == \"W\":\n print((0))\n sys.exit()\nop = [0] * (2 * N)\nop[0] = False\nfor i in range(1, 2 * N):\n if S[i] == S[i - 1]:\n op[i] = True if op[i - 1] is False else False\n else:\n op[i] = True if op[i - 1] is True else False\nif op.count(True) != N:\n print((0))\n sys.exit()\nans = 1\nL_ct = 0\nR_ct = 0\nfor i in op:\n if i:\n ans *= L_ct\n L_ct -= 1\n else:\n L_ct += 1\n ans %= mod\nprint((factorial(N, mod) * ans % mod))\n","code_same":false,"relative_loc_diff_percent":20.9302325581,"diff":["-from math import factorial","+","+","+def factorial(N: int, mod: int) -> int:","+ res = 1","+ for i in range(1, N + 1):","+ res *= i","+ res %= mod","+ return res","+","-op = \"L\"","+op = [0] * (2 * N)","+op[0] = False","- op += \"R\" if op[i - 1] == \"L\" else \"L\"","+ op[i] = True if op[i - 1] is False else False","- op += \"R\" if op[i - 1] == \"R\" else \"L\"","-if op.count(\"L\") != N:","+ op[i] = True if op[i - 1] is True else False","+if op.count(True) != N:","-ct_L, ans = 0, 1","+ans = 1","+L_ct = 0","+R_ct = 0","- if i == \"L\":","- ct_L += 1","+ if i:","+ ans *= L_ct","+ L_ct -= 1","- ans *= ct_L","- ct_L -= 1","+ L_ct += 1","-print((factorial(N) * ans % mod))","+print((factorial(N, mod) * ans % mod))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0391660528,"measured_runtime_v1":0.0370618768,"runtime_lift":1.0567746757,"key":["s557481461","s323376435"]} +{"user_id":"u418149936","problem_id":"p02641","language":"python","submission_id_v0":"s388472876","submission_id_v1":"s742961440","cpu_time_v0":32,"cpu_time_v1":29,"memory_v0":9200,"memory_v1":8980,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.38,"input":"x, n = list(map(int, input().split(' ')))\n\nmin_num = 100\n\n\n\nls = [0] * 201\n\nfor i in range(0, 201):\n\n ls[i] = i\n\n\n\nls_in = [0] * n\n\nif n > 0:\n\n ls_in = list(map(int, input().split(' ')))\n\n for i in ls_in:\n\n ls.remove(i)\n\n ls.reverse()\n\n for i in ls:\n\n min_num = min(abs(x-i), min_num)\n\n if abs(x-i) == min_num:\n\n ans = i \n\n print(ans)\n\nelse:\n\n print(x)","target":"x, n = list(map(int, input().split(' ')))\n\ndiff = x\n\nresult = 0\n\n\n\nif n != 0:\n\n ls = list(map(int, input().split(' ')))\n\n ls_remaind = []\n\n for i in range(1, 102):\n\n if i not in ls:\n\n ls_remaind.append(i)\n\n for j in ls_remaind:\n\n if abs(x-j) == diff:\n\n result = min(result, j)\n\n elif abs(x-j) < diff:\n\n diff = abs(x-j)\n\n result = j\n\nelse:\n\n result = x\n\n\n\nprint(result)","code_v0_loc":20,"code_v1_loc":20,"code_v0_num_chars":399,"code_v1_num_chars":442,"code_v0_no_empty_lines":"x, n = list(map(int, input().split(\" \")))\nmin_num = 100\nls = [0] * 201\nfor i in range(0, 201):\n ls[i] = i\nls_in = [0] * n\nif n > 0:\n ls_in = list(map(int, input().split(\" \")))\n for i in ls_in:\n ls.remove(i)\n ls.reverse()\n for i in ls:\n min_num = min(abs(x - i), min_num)\n if abs(x - i) == min_num:\n ans = i\n print(ans)\nelse:\n print(x)\n","code_v1_no_empty_lines":"x, n = list(map(int, input().split(\" \")))\ndiff = x\nresult = 0\nif n != 0:\n ls = list(map(int, input().split(\" \")))\n ls_remaind = []\n for i in range(1, 102):\n if i not in ls:\n ls_remaind.append(i)\n for j in ls_remaind:\n if abs(x - j) == diff:\n result = min(result, j)\n elif abs(x - j) < diff:\n diff = abs(x - j)\n result = j\nelse:\n result = x\nprint(result)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-min_num = 100","-ls = [0] * 201","-for i in range(0, 201):","- ls[i] = i","-ls_in = [0] * n","-if n > 0:","- ls_in = list(map(int, input().split(\" \")))","- for i in ls_in:","- ls.remove(i)","- ls.reverse()","- for i in ls:","- min_num = min(abs(x - i), min_num)","- if abs(x - i) == min_num:","- ans = i","- print(ans)","+diff = x","+result = 0","+if n != 0:","+ ls = list(map(int, input().split(\" \")))","+ ls_remaind = []","+ for i in range(1, 102):","+ if i not in ls:","+ ls_remaind.append(i)","+ for j in ls_remaind:","+ if abs(x - j) == diff:","+ result = min(result, j)","+ elif abs(x - j) < diff:","+ diff = abs(x - j)","+ result = j","- print(x)","+ result = x","+print(result)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0755160661,"measured_runtime_v1":0.0360507615,"runtime_lift":2.0947148685,"key":["s388472876","s742961440"]} +{"user_id":"u562935282","problem_id":"p02861","language":"python","submission_id_v0":"s778342314","submission_id_v1":"s143049071","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3444,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"def main():\n\n from collections import namedtuple\n\n from itertools import combinations\n\n\n\n City = namedtuple('City', 'x y')\n\n\n\n def dist(a: City, b: City) -> float:\n\n dx = a.x - b.x\n\n dy = a.y - b.y\n\n return (dx * dx + dy * dy) ** 0.5\n\n\n\n N = int(eval(input()))\n\n\n\n cities = []\n\n for _ in range(N):\n\n x, y = list(map(int, input().split()))\n\n c = City(x=x, y=y)\n\n cities.append(c)\n\n\n\n total = 0\n\n for comb in combinations(cities, r=2):\n\n total += dist(*comb)\n\n\n\n ans = total * 2 \/ N\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n\n# \u7279\u5b9a\u306e2\u70b9\u3092\u56fa\u5b9a\u3057\u3001\u305d\u308c\u4ee5\u5916\u3092\u4e26\u3079\u308b + \u56fa\u5b9a\u9806\u3092\u9006\u306b\u3059\u308b\n\n# [oo]ooo... \u3053\u308c\u30924\u500b\u306e\u8981\u7d20\u306e\u4e26\u3073\u66ff\u3048\u3092\u898b\u306a\u3059\n\n# (n-1)! * 2!\n\n# \u3053\u306e2\u70b9\u9593\u306e\u79fb\u52d5\u304c\u542b\u307e\u308c\u308b\u4e26\u3073\u9806\u306f\u3001(n-1)! * 2!\u901a\u308a\n\n# \u54042\u70b9\u9593\u306e\u8ddd\u96e2\u306e\u7dcf\u548c*(n-1)! * 2!\u901a\u308a \/ n!\n\n# \u54042\u70b9\u9593\u306e\u8ddd\u96e2\u306e\u7dcf\u548c*2\/n\n","target":"def main():\n\n from itertools import permutations\n\n from math import hypot\n\n\n\n N = int(eval(input()))\n\n cities = [tuple(map(int, input().split())) for _ in range(N)]\n\n\n\n def dist(c1, c2):\n\n return hypot(c1[0] - c2[0], c1[1] - c2[1])\n\n\n\n ans = 0\n\n for perm in permutations(cities, r=2):\n\n ans += dist(*perm)\n\n ans \/= N\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":36,"code_v1_loc":20,"code_v0_num_chars":776,"code_v1_num_chars":411,"code_v0_no_empty_lines":"def main():\n from collections import namedtuple\n from itertools import combinations\n\n City = namedtuple(\"City\", \"x y\")\n\n def dist(a: City, b: City) -> float:\n dx = a.x - b.x\n dy = a.y - b.y\n return (dx * dx + dy * dy) ** 0.5\n\n N = int(eval(input()))\n cities = []\n for _ in range(N):\n x, y = list(map(int, input().split()))\n c = City(x=x, y=y)\n cities.append(c)\n total = 0\n for comb in combinations(cities, r=2):\n total += dist(*comb)\n ans = total * 2 \/ N\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n# \u7279\u5b9a\u306e2\u70b9\u3092\u56fa\u5b9a\u3057\u3001\u305d\u308c\u4ee5\u5916\u3092\u4e26\u3079\u308b + \u56fa\u5b9a\u9806\u3092\u9006\u306b\u3059\u308b\n# [oo]ooo... \u3053\u308c\u30924\u500b\u306e\u8981\u7d20\u306e\u4e26\u3073\u66ff\u3048\u3092\u898b\u306a\u3059\n# (n-1)! * 2!\n# \u3053\u306e2\u70b9\u9593\u306e\u79fb\u52d5\u304c\u542b\u307e\u308c\u308b\u4e26\u3073\u9806\u306f\u3001(n-1)! * 2!\u901a\u308a\n# \u54042\u70b9\u9593\u306e\u8ddd\u96e2\u306e\u7dcf\u548c*(n-1)! * 2!\u901a\u308a \/ n!\n# \u54042\u70b9\u9593\u306e\u8ddd\u96e2\u306e\u7dcf\u548c*2\/n\n","code_v1_no_empty_lines":"def main():\n from itertools import permutations\n from math import hypot\n\n N = int(eval(input()))\n cities = [tuple(map(int, input().split())) for _ in range(N)]\n\n def dist(c1, c2):\n return hypot(c1[0] - c2[0], c1[1] - c2[1])\n\n ans = 0\n for perm in permutations(cities, r=2):\n ans += dist(*perm)\n ans \/= N\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["- from collections import namedtuple","- from itertools import combinations","-","- City = namedtuple(\"City\", \"x y\")","-","- def dist(a: City, b: City) -> float:","- dx = a.x - b.x","- dy = a.y - b.y","- return (dx * dx + dy * dy) ** 0.5","+ from itertools import permutations","+ from math import hypot","- cities = []","- for _ in range(N):","- x, y = list(map(int, input().split()))","- c = City(x=x, y=y)","- cities.append(c)","- total = 0","- for comb in combinations(cities, r=2):","- total += dist(*comb)","- ans = total * 2 \/ N","+ cities = [tuple(map(int, input().split())) for _ in range(N)]","+","+ def dist(c1, c2):","+ return hypot(c1[0] - c2[0], c1[1] - c2[1])","+","+ ans = 0","+ for perm in permutations(cities, r=2):","+ ans += dist(*perm)","+ ans \/= N","-# \u7279\u5b9a\u306e2\u70b9\u3092\u56fa\u5b9a\u3057\u3001\u305d\u308c\u4ee5\u5916\u3092\u4e26\u3079\u308b + \u56fa\u5b9a\u9806\u3092\u9006\u306b\u3059\u308b","-# [oo]ooo... \u3053\u308c\u30924\u500b\u306e\u8981\u7d20\u306e\u4e26\u3073\u66ff\u3048\u3092\u898b\u306a\u3059","-# (n-1)! * 2!","-# \u3053\u306e2\u70b9\u9593\u306e\u79fb\u52d5\u304c\u542b\u307e\u308c\u308b\u4e26\u3073\u9806\u306f\u3001(n-1)! * 2!\u901a\u308a","-# \u54042\u70b9\u9593\u306e\u8ddd\u96e2\u306e\u7dcf\u548c*(n-1)! * 2!\u901a\u308a \/ n!","-# \u54042\u70b9\u9593\u306e\u8ddd\u96e2\u306e\u7dcf\u548c*2\/n"],"diff_only_import_comment":false,"measured_runtime_v0":0.0406607628,"measured_runtime_v1":0.0470601082,"runtime_lift":0.8640176223,"key":["s778342314","s143049071"]} +{"user_id":"u364774090","problem_id":"p02713","language":"python","submission_id_v0":"s486856715","submission_id_v1":"s077135330","cpu_time_v0":1352,"cpu_time_v1":1155,"memory_v0":73900,"memory_v1":9204,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.57,"input":"K = int(eval(input()))\n\n\n\ndef gcd(x, y):\n\n while y:\n\n x, y = y, x % y\n\n return x\n\n\n\nans = 0\n\nfor a in range(1, K + 1):\n\n for b in range(1, K + 1):\n\n for c in range(1, K + 1):\n\n ans += gcd(gcd(a, b), c)\n\n\n\nprint(ans)","target":"K = int(eval(input()))\n\n\n\nfrom math import gcd\n\n\n\nans = 0\n\n\n\nfor a in range(1, K + 1):\n\n\tfor b in range(1, K + 1):\n\n\t\tt = gcd(a, b)\n\n\t\tfor c in range(1, K + 1):\n\n\t\t\tans += gcd(t, c)\n\nprint(ans)\n","code_v0_loc":14,"code_v1_loc":12,"code_v0_num_chars":243,"code_v1_num_chars":188,"code_v0_no_empty_lines":"K = int(eval(input()))\n\n\ndef gcd(x, y):\n while y:\n x, y = y, x % y\n return x\n\n\nans = 0\nfor a in range(1, K + 1):\n for b in range(1, K + 1):\n for c in range(1, K + 1):\n ans += gcd(gcd(a, b), c)\nprint(ans)\n","code_v1_no_empty_lines":"K = int(eval(input()))\nfrom math import gcd\n\nans = 0\nfor a in range(1, K + 1):\n for b in range(1, K + 1):\n t = gcd(a, b)\n for c in range(1, K + 1):\n ans += gcd(t, c)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-","-","-def gcd(x, y):","- while y:","- x, y = y, x % y","- return x","-","+from math import gcd","+ t = gcd(a, b)","- ans += gcd(gcd(a, b), c)","+ ans += gcd(t, c)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0491826057,"measured_runtime_v1":0.1963243058,"runtime_lift":0.2505171509,"key":["s486856715","s077135330"]} +{"user_id":"u694665829","problem_id":"p02936","language":"python","submission_id_v0":"s105203149","submission_id_v1":"s317370090","cpu_time_v0":1708,"cpu_time_v1":1575,"memory_v0":299740,"memory_v1":349632,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.79,"input":"import sys\n\nsys.setrecursionlimit(10**6)\n\ndef dfs(tree, n, ans):\n\n for i in tree[n]:\n\n ans[i] += ans[n]\n\n tree[i].remove(n)\n\n dfs(tree, i, ans)\n\n \n\nn, q = list(map(int,input().split()))\n\nab = [list(map(int,input().split())) for _ in range(n-1)]\n\npx = [list(map(int,input().split())) for _ in range(q)]\n\n \n\ng = [[] for _ in range(n)]\n\nfor i in range(n-1):\n\n g[ab[i][0]-1].append(ab[i][1]-1)\n\n g[ab[i][1]-1].append(ab[i][0]-1)\n\n \n\nans = [0]*n\n\nfor i in range(q):\n\n ans[px[i-1][0]-1] += px[i-1][1]\n\ndfs(g, 0, ans)\n\n \n\nprint((*ans))","target":"def solve():\n\n import sys\n\n sys.setrecursionlimit(10**6)\n\n def dfs(tree, n, ans):\n\n for i in tree[n]:\n\n ans[i] += ans[n]\n\n tree[i].remove(n)\n\n dfs(tree, i, ans) #\u518d\u5e30\u95a2\u6570\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u6b21\u306e\u6728\u306e\u4e2d\u3092\u63a2\u7d22\n\n \n\n n, q = list(map(int,input().split()))\n\n ab = [list(map(int,input().split())) for _ in range(n-1)]\n\n px = [list(map(int,input().split())) for _ in range(q)]\n\n \n\n g = [[] for _ in range(n)]\n\n for i in range(n-1):\n\n g[ab[i][0]-1].append(ab[i][1]-1)\n\n g[ab[i][1]-1].append(ab[i][0]-1)\n\n \n\n ans = [0]*n\n\n for i in range(q):\n\n ans[px[i-1][0]-1] += px[i-1][1]\n\n dfs(g, 0, ans)\n\n \n\n print((*ans))\n\n \n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":23,"code_v1_loc":27,"code_v0_num_chars":553,"code_v1_num_chars":726,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef dfs(tree, n, ans):\n for i in tree[n]:\n ans[i] += ans[n]\n tree[i].remove(n)\n dfs(tree, i, ans)\n\n\nn, q = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(n - 1)]\npx = [list(map(int, input().split())) for _ in range(q)]\ng = [[] for _ in range(n)]\nfor i in range(n - 1):\n g[ab[i][0] - 1].append(ab[i][1] - 1)\n g[ab[i][1] - 1].append(ab[i][0] - 1)\nans = [0] * n\nfor i in range(q):\n ans[px[i - 1][0] - 1] += px[i - 1][1]\ndfs(g, 0, ans)\nprint((*ans))\n","code_v1_no_empty_lines":"def solve():\n import sys\n\n sys.setrecursionlimit(10**6)\n\n def dfs(tree, n, ans):\n for i in tree[n]:\n ans[i] += ans[n]\n tree[i].remove(n)\n dfs(tree, i, ans) # \u518d\u5e30\u95a2\u6570\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u6b21\u306e\u6728\u306e\u4e2d\u3092\u63a2\u7d22\n\n n, q = list(map(int, input().split()))\n ab = [list(map(int, input().split())) for _ in range(n - 1)]\n px = [list(map(int, input().split())) for _ in range(q)]\n g = [[] for _ in range(n)]\n for i in range(n - 1):\n g[ab[i][0] - 1].append(ab[i][1] - 1)\n g[ab[i][1] - 1].append(ab[i][0] - 1)\n ans = [0] * n\n for i in range(q):\n ans[px[i - 1][0] - 1] += px[i - 1][1]\n dfs(g, 0, ans)\n print((*ans))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":14.8148148148,"diff":["-import sys","+def solve():","+ import sys","-sys.setrecursionlimit(10**6)","+ sys.setrecursionlimit(10**6)","+","+ def dfs(tree, n, ans):","+ for i in tree[n]:","+ ans[i] += ans[n]","+ tree[i].remove(n)","+ dfs(tree, i, ans) # \u518d\u5e30\u95a2\u6570\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u6b21\u306e\u6728\u306e\u4e2d\u3092\u63a2\u7d22","+","+ n, q = list(map(int, input().split()))","+ ab = [list(map(int, input().split())) for _ in range(n - 1)]","+ px = [list(map(int, input().split())) for _ in range(q)]","+ g = [[] for _ in range(n)]","+ for i in range(n - 1):","+ g[ab[i][0] - 1].append(ab[i][1] - 1)","+ g[ab[i][1] - 1].append(ab[i][0] - 1)","+ ans = [0] * n","+ for i in range(q):","+ ans[px[i - 1][0] - 1] += px[i - 1][1]","+ dfs(g, 0, ans)","+ print((*ans))","-def dfs(tree, n, ans):","- for i in tree[n]:","- ans[i] += ans[n]","- tree[i].remove(n)","- dfs(tree, i, ans)","-","-","-n, q = list(map(int, input().split()))","-ab = [list(map(int, input().split())) for _ in range(n - 1)]","-px = [list(map(int, input().split())) for _ in range(q)]","-g = [[] for _ in range(n)]","-for i in range(n - 1):","- g[ab[i][0] - 1].append(ab[i][1] - 1)","- g[ab[i][1] - 1].append(ab[i][0] - 1)","-ans = [0] * n","-for i in range(q):","- ans[px[i - 1][0] - 1] += px[i - 1][1]","-dfs(g, 0, ans)","-print((*ans))","+if __name__ == \"__main__\":","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0356764557,"measured_runtime_v1":0.0411059973,"runtime_lift":0.8679136391,"key":["s105203149","s317370090"]} +{"user_id":"u547608423","problem_id":"p02881","language":"python","submission_id_v0":"s776880005","submission_id_v1":"s097231918","cpu_time_v0":167,"cpu_time_v1":139,"memory_v0":3060,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.77,"input":"import math \n\n\n\nN=int(eval(input()))\n\n\n\nli=[]\n\nl=0\n\nm=0\n\n\n\nfor i in range(math.floor(math.sqrt(N))):\n\n if N%(i+1)==0:\n\n l=i\n\n m=N\/(i+1)-1\n\n li.append(l+m)\n\n else:\n\n pass\n\n\n\nprint((int(min(li))))\n\n\n","target":"N=int(eval(input()))\n\n\n\nanswer=0\n\n\n\nfor i in range(int(pow(N,1\/2)),0,-1):\n\n if N%i==0:\n\n answer=(i-1)+(N\/\/i-1)\n\n break\n\nprint(answer)\n","code_v0_loc":18,"code_v1_loc":9,"code_v0_num_chars":203,"code_v1_num_chars":145,"code_v0_no_empty_lines":"import math\n\nN = int(eval(input()))\nli = []\nl = 0\nm = 0\nfor i in range(math.floor(math.sqrt(N))):\n if N % (i + 1) == 0:\n l = i\n m = N \/ (i + 1) - 1\n li.append(l + m)\n else:\n pass\nprint((int(min(li))))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nanswer = 0\nfor i in range(int(pow(N, 1 \/ 2)), 0, -1):\n if N % i == 0:\n answer = (i - 1) + (N \/\/ i - 1)\n break\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import math","-","-li = []","-l = 0","-m = 0","-for i in range(math.floor(math.sqrt(N))):","- if N % (i + 1) == 0:","- l = i","- m = N \/ (i + 1) - 1","- li.append(l + m)","- else:","- pass","-print((int(min(li))))","+answer = 0","+for i in range(int(pow(N, 1 \/ 2)), 0, -1):","+ if N % i == 0:","+ answer = (i - 1) + (N \/\/ i - 1)","+ break","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0860591571,"measured_runtime_v1":0.2171121163,"runtime_lift":0.3963811812,"key":["s776880005","s097231918"]} +{"user_id":"u860002137","problem_id":"p02609","language":"python","submission_id_v0":"s939242044","submission_id_v1":"s827686990","cpu_time_v0":1262,"cpu_time_v1":1146,"memory_v0":40964,"memory_v1":23364,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.19,"input":"from functools import lru_cache\n\n\n\n\n\ndef popcnt(x):\n\n return bin(x).count(\"1\")\n\n\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(n):\n\n if n == 0:\n\n return 0\n\n else:\n\n return rec(n % popcnt(n)) + 1\n\n\n\n\n\nret = [rec(x) for x in range(2 * 10**5 + 1)]\n\n\n\n\n\nn = int(input())\n\narr = input()\n\n\n\nALL_ARR = int(arr, 2)\n\n\n\ncnt = popcnt(int(arr, 2))\n\ninit_big = ALL_ARR % (cnt + 1)\n\nif cnt == 1:\n\n init_small = 0\n\nelse:\n\n init_small = ALL_ARR % (cnt - 1)\n\n\n\n\n\nli = [0] * n\n\nfor i in range(n):\n\n if arr[i] == \"0\":\n\n li[i] = (init_big + pow(2, n - i - 1, cnt + 1)) % (cnt + 1)\n\n elif ALL_ARR - (1 << (n - i - 1)) == 0 or cnt - 1 == 0:\n\n li[i] = \"flg\"\n\n else:\n\n li[i] = (init_small - pow(2, n - i - 1, cnt - 1)) % (cnt - 1)\n\n\n\n\n\nans = []\n\n\n\nfor x in li:\n\n if x == \"flg\":\n\n ans.append(0)\n\n else:\n\n ans.append(ret[x] + 1)\n\n\n\nprint(*ans, sep=\"\\n\")\n","target":"from functools import lru_cache\n\n\n\n\n\ndef popcnt(x):\n\n return bin(x).count(\"1\")\n\n\n\n\n\n@lru_cache(maxsize=None)\n\ndef rec(n):\n\n if n == 0:\n\n return 0\n\n else:\n\n return rec(n % popcnt(n)) + 1\n\n\n\n\n\nn = int(input())\n\narr = input()\n\n\n\nALL_ARR = int(arr, 2)\n\n\n\ncnt = popcnt(int(arr, 2))\n\ninit_big = ALL_ARR % (cnt + 1)\n\nif cnt == 1:\n\n init_small = 0\n\nelse:\n\n init_small = ALL_ARR % (cnt - 1)\n\n\n\n\n\nli = [0] * n\n\nfor i in range(n):\n\n if arr[i] == \"0\":\n\n li[i] = (init_big + pow(2, n - i - 1, cnt + 1)) % (cnt + 1)\n\n elif ALL_ARR - (1 << (n - i - 1)) == 0 or cnt - 1 == 0:\n\n li[i] = \"flg\"\n\n else:\n\n li[i] = (init_small - pow(2, n - i - 1, cnt - 1)) % (cnt - 1)\n\n\n\n\n\nans = []\n\n\n\nfor x in li:\n\n if x == \"flg\":\n\n ans.append(0)\n\n else:\n\n ans.append(rec(x) + 1)\n\n\n\nprint(*ans, sep=\"\\n\")\n","code_v0_loc":50,"code_v1_loc":47,"code_v0_num_chars":897,"code_v1_num_chars":847,"code_v0_no_empty_lines":"from functools import lru_cache\n\n\ndef popcnt(x):\n return bin(x).count(\"1\")\n\n\n@lru_cache(maxsize=None)\ndef rec(n):\n if n == 0:\n return 0\n else:\n return rec(n % popcnt(n)) + 1\n\n\nret = [rec(x) for x in range(2 * 10**5 + 1)]\nn = int(input())\narr = input()\nALL_ARR = int(arr, 2)\ncnt = popcnt(int(arr, 2))\ninit_big = ALL_ARR % (cnt + 1)\nif cnt == 1:\n init_small = 0\nelse:\n init_small = ALL_ARR % (cnt - 1)\nli = [0] * n\nfor i in range(n):\n if arr[i] == \"0\":\n li[i] = (init_big + pow(2, n - i - 1, cnt + 1)) % (cnt + 1)\n elif ALL_ARR - (1 << (n - i - 1)) == 0 or cnt - 1 == 0:\n li[i] = \"flg\"\n else:\n li[i] = (init_small - pow(2, n - i - 1, cnt - 1)) % (cnt - 1)\nans = []\nfor x in li:\n if x == \"flg\":\n ans.append(0)\n else:\n ans.append(ret[x] + 1)\nprint(*ans, sep=\"\\n\")\n","code_v1_no_empty_lines":"from functools import lru_cache\n\n\ndef popcnt(x):\n return bin(x).count(\"1\")\n\n\n@lru_cache(maxsize=None)\ndef rec(n):\n if n == 0:\n return 0\n else:\n return rec(n % popcnt(n)) + 1\n\n\nn = int(input())\narr = input()\nALL_ARR = int(arr, 2)\ncnt = popcnt(int(arr, 2))\ninit_big = ALL_ARR % (cnt + 1)\nif cnt == 1:\n init_small = 0\nelse:\n init_small = ALL_ARR % (cnt - 1)\nli = [0] * n\nfor i in range(n):\n if arr[i] == \"0\":\n li[i] = (init_big + pow(2, n - i - 1, cnt + 1)) % (cnt + 1)\n elif ALL_ARR - (1 << (n - i - 1)) == 0 or cnt - 1 == 0:\n li[i] = \"flg\"\n else:\n li[i] = (init_small - pow(2, n - i - 1, cnt - 1)) % (cnt - 1)\nans = []\nfor x in li:\n if x == \"flg\":\n ans.append(0)\n else:\n ans.append(rec(x) + 1)\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":6.0,"diff":["-ret = [rec(x) for x in range(2 * 10**5 + 1)]","- ans.append(ret[x] + 1)","+ ans.append(rec(x) + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.8479995107,"measured_runtime_v1":0.0440232369,"runtime_lift":19.2625433749,"key":["s939242044","s827686990"]} +{"user_id":"u062147869","problem_id":"p03225","language":"python","submission_id_v0":"s944546395","submission_id_v1":"s507387407","cpu_time_v0":1351,"cpu_time_v1":1235,"memory_v0":58972,"memory_v1":55516,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.59,"input":"H,W=list(map(int,input().split()))\n\nS=[list(eval(input())) for i in range(H)]\n\ntable=[[0]*(H+W-1) for i in range(H+W-1)]\n\nfor j in range(H):\n\n for i in range(W):\n\n if S[j][i]=='#':\n\n table[i+j][i-j+H-1]=1\n\nyoko=[[0]*(H+W) for i in range(H+W-1)]\n\nfor j in range(H+W-1):\n\n for i in range(1,H+W):\n\n yoko[j][i]=yoko[j][i-1]+table[j][i-1]\n\ntate=[[0]*(H+W-1) for i in range(H+W)]\n\nfor j in range(1,H+W):\n\n for i in range(H+W-1):\n\n tate[j][i]=tate[j-1][i]+table[j-1][i]\n\n\n\nans=0\n\nfor y in range(H+W-1):\n\n for x in range((y+H-1)%2,H+W-1,2):\n\n if table[y][x]!=1:\n\n continue\n\n for z in range(x+2,H+W-1,2):\n\n if table[y][z]==1:\n\n d=z-x\n\n if y+d=0:\n\n ans+=yoko[y-d][z+1]-yoko[y-d][x]\n\n #print(2,'.',ans,':',x,y,z)\n\n for w in range(y+2,H+W-1,2):\n\n if table[w][x]==1:\n\n e=w-y\n\n if x+e=0:\n\n ans+=tate[w][x-e]-tate[y+1][x-e]\n\n #print(4,'.',ans,':',x,y,w)\n\n\n\nprint(ans)\n\n\n\n\n","target":"H,W=list(map(int,input().split()))\n\nS=[eval(input()) for i in range(H)]\n\ntable=[[0]*(H+W-1) for i in range(H+W-1)]\n\nfor j in range(H):\n\n for i in range(W):\n\n if S[j][i]=='#':\n\n table[i+j][i-j+H-1]=1\n\nyoko=[[0]*(H+W) for i in range(H+W-1)]\n\nfor j in range(H+W-1):\n\n for i in range(1,H+W):\n\n yoko[j][i]=yoko[j][i-1]+table[j][i-1]\n\ntate=[[0]*(H+W-1) for i in range(H+W)]\n\nfor j in range(1,H+W):\n\n for i in range(H+W-1):\n\n tate[j][i]=tate[j-1][i]+table[j-1][i]\n\n\n\nans=0\n\nfor y in range(H+W-1):\n\n for x in range((y+H-1)%2,H+W-1,2):\n\n if table[y][x]!=1:\n\n continue\n\n for z in range(x+2,H+W-1,2):\n\n if table[y][z]==1:\n\n d=z-x\n\n if y+d=0:\n\n ans+=yoko[y-d][z+1]-yoko[y-d][x]\n\n #print(2,'.',ans,':',x,y,z)\n\n for w in range(y+2,H+W-1,2):\n\n if table[w][x]==1:\n\n e=w-y\n\n if x+e=0:\n\n ans+=tate[w][x-e]-tate[y+1][x-e]\n\n #print(4,'.',ans,':',x,y,w)\n\n\n\nprint(ans)\n\n\n\n\n","code_v0_loc":43,"code_v1_loc":43,"code_v0_num_chars":1353,"code_v1_num_chars":1347,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\nS = [list(eval(input())) for i in range(H)]\ntable = [[0] * (H + W - 1) for i in range(H + W - 1)]\nfor j in range(H):\n for i in range(W):\n if S[j][i] == \"#\":\n table[i + j][i - j + H - 1] = 1\nyoko = [[0] * (H + W) for i in range(H + W - 1)]\nfor j in range(H + W - 1):\n for i in range(1, H + W):\n yoko[j][i] = yoko[j][i - 1] + table[j][i - 1]\ntate = [[0] * (H + W - 1) for i in range(H + W)]\nfor j in range(1, H + W):\n for i in range(H + W - 1):\n tate[j][i] = tate[j - 1][i] + table[j - 1][i]\nans = 0\nfor y in range(H + W - 1):\n for x in range((y + H - 1) % 2, H + W - 1, 2):\n if table[y][x] != 1:\n continue\n for z in range(x + 2, H + W - 1, 2):\n if table[y][z] == 1:\n d = z - x\n if y + d < H + W - 1:\n ans += yoko[y + d][z + 1] - yoko[y + d][x]\n # print(1,'.',ans,':',x,y,z)\n if y - d >= 0:\n ans += yoko[y - d][z + 1] - yoko[y - d][x]\n # print(2,'.',ans,':',x,y,z)\n for w in range(y + 2, H + W - 1, 2):\n if table[w][x] == 1:\n e = w - y\n if x + e < H + W - 1:\n ans += tate[w][x + e] - tate[y + 1][x + e]\n # print(3,'.',ans,':',x,y,w)\n if x - e >= 0:\n ans += tate[w][x - e] - tate[y + 1][x - e]\n # print(4,'.',ans,':',x,y,w)\nprint(ans)\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nS = [eval(input()) for i in range(H)]\ntable = [[0] * (H + W - 1) for i in range(H + W - 1)]\nfor j in range(H):\n for i in range(W):\n if S[j][i] == \"#\":\n table[i + j][i - j + H - 1] = 1\nyoko = [[0] * (H + W) for i in range(H + W - 1)]\nfor j in range(H + W - 1):\n for i in range(1, H + W):\n yoko[j][i] = yoko[j][i - 1] + table[j][i - 1]\ntate = [[0] * (H + W - 1) for i in range(H + W)]\nfor j in range(1, H + W):\n for i in range(H + W - 1):\n tate[j][i] = tate[j - 1][i] + table[j - 1][i]\nans = 0\nfor y in range(H + W - 1):\n for x in range((y + H - 1) % 2, H + W - 1, 2):\n if table[y][x] != 1:\n continue\n for z in range(x + 2, H + W - 1, 2):\n if table[y][z] == 1:\n d = z - x\n if y + d < H + W - 1:\n ans += yoko[y + d][z + 1] - yoko[y + d][x]\n # print(1,'.',ans,':',x,y,z)\n if y - d >= 0:\n ans += yoko[y - d][z + 1] - yoko[y - d][x]\n # print(2,'.',ans,':',x,y,z)\n for w in range(y + 2, H + W - 1, 2):\n if table[w][x] == 1:\n e = w - y\n if x + e < H + W - 1:\n ans += tate[w][x + e] - tate[y + 1][x + e]\n # print(3,'.',ans,':',x,y,w)\n if x - e >= 0:\n ans += tate[w][x - e] - tate[y + 1][x - e]\n # print(4,'.',ans,':',x,y,w)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S = [list(eval(input())) for i in range(H)]","+S = [eval(input()) for i in range(H)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0362432077,"measured_runtime_v1":0.0410587378,"runtime_lift":0.8827160713,"key":["s944546395","s507387407"]} +{"user_id":"u867848444","problem_id":"p02727","language":"python","submission_id_v0":"s987908942","submission_id_v1":"s649036057","cpu_time_v0":257,"cpu_time_v1":157,"memory_v0":23328,"memory_v1":29212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.91,"input":"x,y,a,b,c=list(map(int,input().split()))\n\np=list(map(int,input().split()))\n\nq=list(map(int,input().split()))\n\nr=list(map(int,input().split()))\n\n\n\nl=sorted(p,reverse=True)[:x]+sorted(q,reverse=True)[:y]+r\n\nl.sort(reverse=True)\n\nprint((sum(l[:x+y])))","target":"x, y, a, b, c = list(map(int,input().split()))\n\np = list(map(int,input().split()))\n\nq = list(map(int,input().split()))\n\nr = list(map(int,input().split()))\n\n\n\np.sort(reverse=True)\n\nq.sort(reverse=True)\n\ncand = p[:x] + q[:y] + r\n\ncand.sort(reverse=True)\n\nprint((sum(cand[:x + y])))","code_v0_loc":8,"code_v1_loc":10,"code_v0_num_chars":240,"code_v1_num_chars":271,"code_v0_no_empty_lines":"x, y, a, b, c = list(map(int, input().split()))\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\nl = sorted(p, reverse=True)[:x] + sorted(q, reverse=True)[:y] + r\nl.sort(reverse=True)\nprint((sum(l[: x + y])))\n","code_v1_no_empty_lines":"x, y, a, b, c = list(map(int, input().split()))\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\ncand = p[:x] + q[:y] + r\ncand.sort(reverse=True)\nprint((sum(cand[: x + y])))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-l = sorted(p, reverse=True)[:x] + sorted(q, reverse=True)[:y] + r","-l.sort(reverse=True)","-print((sum(l[: x + y])))","+p.sort(reverse=True)","+q.sort(reverse=True)","+cand = p[:x] + q[:y] + r","+cand.sort(reverse=True)","+print((sum(cand[: x + y])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0414088683,"measured_runtime_v1":0.0909360948,"runtime_lift":0.4553622895,"key":["s987908942","s649036057"]} +{"user_id":"u347640436","problem_id":"p02787","language":"python","submission_id_v0":"s684679705","submission_id_v1":"s174482959","cpu_time_v0":1832,"cpu_time_v1":492,"memory_v0":3800,"memory_v1":42972,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.14,"input":"def main():\n\n from sys import stdin\n\n readline = stdin.readline\n\n H, N = list(map(int, readline().split()))\n\n AB = [list(map(int, readline().split())) for _ in range(N)]\n\n\n\n dp = [100000000] * (H + 10 ** 4 + 1)\n\n dp[0] = 0\n\n for i in range(H):\n\n if dp[i] == 100000000:\n\n continue\n\n for a, b in AB:\n\n t = dp[i] + b\n\n if t < dp[i + a]:\n\n dp[i + a] = t\n\n print((min(dp[H:])))\n\n\n\n\n\nmain()\n","target":"H, N = list(map(int, input().split()))\n\nAB = [list(map(int, input().split())) for _ in range(N)]\n\n\n\nA_max = 10 ** 4\n\nINF = float('inf')\n\n\n\ndp = [INF] * (H + A_max + 1)\n\ndp[0] = 0\n\nfor i in range(H):\n\n if dp[i] == INF:\n\n continue\n\n for a, b in AB:\n\n if dp[i] + b < dp[i + a]:\n\n dp[i + a] = dp[i] + b\n\nprint((min(dp[H:])))\n","code_v0_loc":19,"code_v1_loc":15,"code_v0_num_chars":463,"code_v1_num_chars":344,"code_v0_no_empty_lines":"def main():\n from sys import stdin\n\n readline = stdin.readline\n H, N = list(map(int, readline().split()))\n AB = [list(map(int, readline().split())) for _ in range(N)]\n dp = [100000000] * (H + 10**4 + 1)\n dp[0] = 0\n for i in range(H):\n if dp[i] == 100000000:\n continue\n for a, b in AB:\n t = dp[i] + b\n if t < dp[i + a]:\n dp[i + a] = t\n print((min(dp[H:])))\n\n\nmain()\n","code_v1_no_empty_lines":"H, N = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(N)]\nA_max = 10**4\nINF = float(\"inf\")\ndp = [INF] * (H + A_max + 1)\ndp[0] = 0\nfor i in range(H):\n if dp[i] == INF:\n continue\n for a, b in AB:\n if dp[i] + b < dp[i + a]:\n dp[i + a] = dp[i] + b\nprint((min(dp[H:])))\n","code_same":false,"relative_loc_diff_percent":21.0526315789,"diff":["-def main():","- from sys import stdin","-","- readline = stdin.readline","- H, N = list(map(int, readline().split()))","- AB = [list(map(int, readline().split())) for _ in range(N)]","- dp = [100000000] * (H + 10**4 + 1)","- dp[0] = 0","- for i in range(H):","- if dp[i] == 100000000:","- continue","- for a, b in AB:","- t = dp[i] + b","- if t < dp[i + a]:","- dp[i + a] = t","- print((min(dp[H:])))","-","-","-main()","+H, N = list(map(int, input().split()))","+AB = [list(map(int, input().split())) for _ in range(N)]","+A_max = 10**4","+INF = float(\"inf\")","+dp = [INF] * (H + A_max + 1)","+dp[0] = 0","+for i in range(H):","+ if dp[i] == INF:","+ continue","+ for a, b in AB:","+ if dp[i] + b < dp[i + a]:","+ dp[i + a] = dp[i] + b","+print((min(dp[H:])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0632978032,"measured_runtime_v1":0.0569755852,"runtime_lift":1.110963633,"key":["s684679705","s174482959"]} +{"user_id":"u546968095","problem_id":"p02397","language":"python","submission_id_v0":"s951220500","submission_id_v1":"s638340395","cpu_time_v0":60,"cpu_time_v1":50,"memory_v0":5620,"memory_v1":5612,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"def ex(x, y):\n\n if x > y:\n\n tmp = x\n\n x = y\n\n y = tmp\n\n\n\n return x, y\n\n\n\ndef ex2num():\n\n r1, r2 = input().split(\" \")\n\n r1 = int(r1)\n\n r2 = int(r2)\n\n while (0 != r1) or (0 != r2):\n\n r1, r2 = ex(r1, r2)\n\n print((r1, r2))\n\n r1, r2 = input().split(\" \")\n\n r1 = int(r1)\n\n r2 = int(r2)\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n ret = ex2num()\n","target":"def ex2num():\n\n while (True):\n\n r1, r2 = input().split(\" \")\n\n r1 = int(r1)\n\n r2 = int(r2)\n\n if (0 == r1) and (0 == r2):\n\n break\n\n if r1 < r2:\n\n print((r1, r2))\n\n else:\n\n print((r2, r1))\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n ret = ex2num()\n","code_v0_loc":23,"code_v1_loc":16,"code_v0_num_chars":417,"code_v1_num_chars":326,"code_v0_no_empty_lines":"def ex(x, y):\n if x > y:\n tmp = x\n x = y\n y = tmp\n return x, y\n\n\ndef ex2num():\n r1, r2 = input().split(\" \")\n r1 = int(r1)\n r2 = int(r2)\n while (0 != r1) or (0 != r2):\n r1, r2 = ex(r1, r2)\n print((r1, r2))\n r1, r2 = input().split(\" \")\n r1 = int(r1)\n r2 = int(r2)\n return 0\n\n\nif __name__ == \"__main__\":\n ret = ex2num()\n","code_v1_no_empty_lines":"def ex2num():\n while True:\n r1, r2 = input().split(\" \")\n r1 = int(r1)\n r2 = int(r2)\n if (0 == r1) and (0 == r2):\n break\n if r1 < r2:\n print((r1, r2))\n else:\n print((r2, r1))\n return 0\n\n\nif __name__ == \"__main__\":\n ret = ex2num()\n","code_same":false,"relative_loc_diff_percent":30.4347826087,"diff":["-def ex(x, y):","- if x > y:","- tmp = x","- x = y","- y = tmp","- return x, y","-","-","- r1, r2 = input().split(\" \")","- r1 = int(r1)","- r2 = int(r2)","- while (0 != r1) or (0 != r2):","- r1, r2 = ex(r1, r2)","- print((r1, r2))","+ while True:","+ if (0 == r1) and (0 == r2):","+ break","+ if r1 < r2:","+ print((r1, r2))","+ else:","+ print((r2, r1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376052604,"measured_runtime_v1":0.0653955059,"runtime_lift":0.5750434964,"key":["s951220500","s638340395"]} +{"user_id":"u599114793","problem_id":"p03103","language":"python","submission_id_v0":"s214064855","submission_id_v1":"s313711587","cpu_time_v0":474,"cpu_time_v1":374,"memory_v0":20064,"memory_v1":83220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.1,"input":"n,m = list(map(int,input().split()))\n\ncost = []\n\nfor i in range(n):\n\n a,b = list(map(int,input().split()))\n\n cost.append([a,b])\n\ncost.sort()\n\ncnt = 0\n\nprice = 0\n\nfor i in range(n):\n\n if cnt + cost[i][1] <= m:\n\n price += cost[i][0] * cost[i][1]\n\n cnt += cost[i][1]\n\n else:\n\n price += (m-cnt)*cost[i][0]\n\n print(price)\n\n exit()\n\nprint(price)\n","target":"n,m = list(map(int,input().split()))\n\ndrink = []\n\nfor i in range(n):\n\n a,b = list(map(int,input().split()))\n\n drink.append((a,b))\n\ndrink.sort()\n\nans = 0\n\nfor i in range(n):\n\n if m == 0:\n\n break\n\n if m >= drink[i][1]:\n\n ans += drink[i][0] * drink[i][1]\n\n m -= drink[i][1]\n\n else:\n\n ans += m*drink[i][0]\n\n m = 0\n\nprint(ans)\n","code_v0_loc":17,"code_v1_loc":17,"code_v0_num_chars":375,"code_v1_num_chars":360,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\ncost = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n cost.append([a, b])\ncost.sort()\ncnt = 0\nprice = 0\nfor i in range(n):\n if cnt + cost[i][1] <= m:\n price += cost[i][0] * cost[i][1]\n cnt += cost[i][1]\n else:\n price += (m - cnt) * cost[i][0]\n print(price)\n exit()\nprint(price)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\ndrink = []\nfor i in range(n):\n a, b = list(map(int, input().split()))\n drink.append((a, b))\ndrink.sort()\nans = 0\nfor i in range(n):\n if m == 0:\n break\n if m >= drink[i][1]:\n ans += drink[i][0] * drink[i][1]\n m -= drink[i][1]\n else:\n ans += m * drink[i][0]\n m = 0\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-cost = []","+drink = []","- cost.append([a, b])","-cost.sort()","-cnt = 0","-price = 0","+ drink.append((a, b))","+drink.sort()","+ans = 0","- if cnt + cost[i][1] <= m:","- price += cost[i][0] * cost[i][1]","- cnt += cost[i][1]","+ if m == 0:","+ break","+ if m >= drink[i][1]:","+ ans += drink[i][0] * drink[i][1]","+ m -= drink[i][1]","- price += (m - cnt) * cost[i][0]","- print(price)","- exit()","-print(price)","+ ans += m * drink[i][0]","+ m = 0","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0571660383,"measured_runtime_v1":0.0730669363,"runtime_lift":0.7823790239,"key":["s214064855","s313711587"]} +{"user_id":"u186838327","problem_id":"p02991","language":"python","submission_id_v0":"s773846251","submission_id_v1":"s289199974","cpu_time_v0":686,"cpu_time_v1":414,"memory_v0":38104,"memory_v1":78116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.65,"input":"from collections import deque\n\nn, m = list(map(int, input().split()))\n\n\n\ng = [[] for i in range(n)]\n\n\n\nfor i in range(m):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n g[u].append(v)\n\n# print(g)\n\n\n\ns, t = list(map(int, input().split()))\n\ns, t = s-1, t-1\n\n\n\nvisited = [[-1]*3 for j in range(n)]\n\n\n\nl = 0\n\nqueue = deque([[s, l]])\n\nvisited[s][l] = 0\n\nwhile queue:\n\n x, l = queue.popleft()\n\n if [x, l] == [t, 0]:\n\n print((visited[x][l]\/\/3))\n\n exit()\n\n for x_ in g[x]:\n\n new_x, new_l = x_, (l+1)%3\n\n if visited[new_x][new_l] == -1:\n\n visited[new_x][new_l] = visited[x][l]+1\n\n queue.append([new_x, new_l])\n\n \n\nprint((visited[t][0]))","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nn, m = list(map(int, input().split()))\n\ng = [[] for _ in range(3*n)]\n\nfor i in range(m):\n\n u, v = list(map(int, input().split()))\n\n u, v = u-1, v-1\n\n g[u].append(v+n)\n\n g[u+n].append(v+2*n)\n\n g[u+2*n].append(v)\n\ns, t = list(map(int, input().split()))\n\ns, t = s-1, t-1\n\n\n\nfrom collections import deque\n\nq = deque()\n\nvisit = [-1]*(3*n)\n\nq.append(s)\n\nvisit[s] = 0\n\nwhile q:\n\n u = q.popleft()\n\n for v in g[u]:\n\n if visit[v] == -1:\n\n visit[v] = visit[u]+1\n\n q.append(v)\n\nif visit[t] == -1:\n\n print((-1))\n\nelse:\n\n print((visit[t]\/\/3))\n","code_v0_loc":31,"code_v1_loc":29,"code_v0_num_chars":650,"code_v1_num_chars":612,"code_v0_no_empty_lines":"from collections import deque\n\nn, m = list(map(int, input().split()))\ng = [[] for i in range(n)]\nfor i in range(m):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n g[u].append(v)\n# print(g)\ns, t = list(map(int, input().split()))\ns, t = s - 1, t - 1\nvisited = [[-1] * 3 for j in range(n)]\nl = 0\nqueue = deque([[s, l]])\nvisited[s][l] = 0\nwhile queue:\n x, l = queue.popleft()\n if [x, l] == [t, 0]:\n print((visited[x][l] \/\/ 3))\n exit()\n for x_ in g[x]:\n new_x, new_l = x_, (l + 1) % 3\n if visited[new_x][new_l] == -1:\n visited[new_x][new_l] = visited[x][l] + 1\n queue.append([new_x, new_l])\nprint((visited[t][0]))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nn, m = list(map(int, input().split()))\ng = [[] for _ in range(3 * n)]\nfor i in range(m):\n u, v = list(map(int, input().split()))\n u, v = u - 1, v - 1\n g[u].append(v + n)\n g[u + n].append(v + 2 * n)\n g[u + 2 * n].append(v)\ns, t = list(map(int, input().split()))\ns, t = s - 1, t - 1\nfrom collections import deque\n\nq = deque()\nvisit = [-1] * (3 * n)\nq.append(s)\nvisit[s] = 0\nwhile q:\n u = q.popleft()\n for v in g[u]:\n if visit[v] == -1:\n visit[v] = visit[u] + 1\n q.append(v)\nif visit[t] == -1:\n print((-1))\nelse:\n print((visit[t] \/\/ 3))\n","code_same":false,"relative_loc_diff_percent":6.4516129032,"diff":["-from collections import deque","+import sys","+input = sys.stdin.buffer.readline","-g = [[] for i in range(n)]","+g = [[] for _ in range(3 * n)]","- g[u].append(v)","-# print(g)","+ g[u].append(v + n)","+ g[u + n].append(v + 2 * n)","+ g[u + 2 * n].append(v)","-visited = [[-1] * 3 for j in range(n)]","-l = 0","-queue = deque([[s, l]])","-visited[s][l] = 0","-while queue:","- x, l = queue.popleft()","- if [x, l] == [t, 0]:","- print((visited[x][l] \/\/ 3))","- exit()","- for x_ in g[x]:","- new_x, new_l = x_, (l + 1) % 3","- if visited[new_x][new_l] == -1:","- visited[new_x][new_l] = visited[x][l] + 1","- queue.append([new_x, new_l])","-print((visited[t][0]))","+from collections import deque","+","+q = deque()","+visit = [-1] * (3 * n)","+q.append(s)","+visit[s] = 0","+while q:","+ u = q.popleft()","+ for v in g[u]:","+ if visit[v] == -1:","+ visit[v] = visit[u] + 1","+ q.append(v)","+if visit[t] == -1:","+ print((-1))","+else:","+ print((visit[t] \/\/ 3))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0915906024,"measured_runtime_v1":0.038521584,"runtime_lift":2.3776437203,"key":["s773846251","s289199974"]} +{"user_id":"u046158516","problem_id":"p03282","language":"python","submission_id_v0":"s325156269","submission_id_v1":"s126481462","cpu_time_v0":168,"cpu_time_v1":63,"memory_v0":38324,"memory_v1":61704,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.5,"input":"n=eval(input())\n\nk=int(eval(input()))\n\ncounter=0\n\nnex=0\n\nfor i in range(len(n)):\n\n if n[i]=='1':\n\n counter+=1\n\n else:\n\n nex=n[i]\n\n break\n\nif nex==0:\n\n nex='1'\n\nif k>counter:\n\n print(nex)\n\nelse:\n\n print((1))","target":"import sys\n\ns=eval(input())\n\nk=int(eval(input()))\n\nfor i in range(min(len(s),k)):\n\n if s[i]!='1':\n\n print((s[i]))\n\n sys.exit()\n\nprint((1))","code_v0_loc":16,"code_v1_loc":8,"code_v0_num_chars":206,"code_v1_num_chars":129,"code_v0_no_empty_lines":"n = eval(input())\nk = int(eval(input()))\ncounter = 0\nnex = 0\nfor i in range(len(n)):\n if n[i] == \"1\":\n counter += 1\n else:\n nex = n[i]\n break\nif nex == 0:\n nex = \"1\"\nif k > counter:\n print(nex)\nelse:\n print((1))\n","code_v1_no_empty_lines":"import sys\n\ns = eval(input())\nk = int(eval(input()))\nfor i in range(min(len(s), k)):\n if s[i] != \"1\":\n print((s[i]))\n sys.exit()\nprint((1))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-n = eval(input())","+import sys","+","+s = eval(input())","-counter = 0","-nex = 0","-for i in range(len(n)):","- if n[i] == \"1\":","- counter += 1","- else:","- nex = n[i]","- break","-if nex == 0:","- nex = \"1\"","-if k > counter:","- print(nex)","-else:","- print((1))","+for i in range(min(len(s), k)):","+ if s[i] != \"1\":","+ print((s[i]))","+ sys.exit()","+print((1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0346541266,"measured_runtime_v1":0.0356118736,"runtime_lift":0.9731059645,"key":["s325156269","s126481462"]} +{"user_id":"u046187684","problem_id":"p02923","language":"python","submission_id_v0":"s045098151","submission_id_v1":"s179961765","cpu_time_v0":77,"cpu_time_v1":60,"memory_v0":14224,"memory_v1":14252,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.08,"input":"N = int(eval(input()))\n\nH = list(map(int, input().split()))\n\n \n\nif N == 1:\n\n print((0))\n\n quit()\n\n\n\nstart = 0\n\nmoves = []\n\nfor i in range(N-1):\n\n moves.append(i - start)\n\n if H[i] < H[i+1]:\n\n start = i + 1\n\nif H[N-2] >= H[N-1]:\n\n moves.append(i - start + 1)\n\nprint((max(moves)))","target":"N = int(eval(input()))\n\nH = list(map(int, input().split()))\n\n \n\nif N == 1:\n\n print((0))\n\n quit()\n\n\n\ncount = 0\n\nmoves = []\n\nfor h0, h1 in zip(H,H[1:]):\n\n if h0 >= h1:\n\n count += 1\n\n else:\n\n moves.append(count)\n\n count = 0\n\nprint((max(moves + [count])))\n","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":290,"code_v1_num_chars":275,"code_v0_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\nif N == 1:\n print((0))\n quit()\nstart = 0\nmoves = []\nfor i in range(N - 1):\n moves.append(i - start)\n if H[i] < H[i + 1]:\n start = i + 1\nif H[N - 2] >= H[N - 1]:\n moves.append(i - start + 1)\nprint((max(moves)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\nif N == 1:\n print((0))\n quit()\ncount = 0\nmoves = []\nfor h0, h1 in zip(H, H[1:]):\n if h0 >= h1:\n count += 1\n else:\n moves.append(count)\n count = 0\nprint((max(moves + [count])))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-start = 0","+count = 0","-for i in range(N - 1):","- moves.append(i - start)","- if H[i] < H[i + 1]:","- start = i + 1","-if H[N - 2] >= H[N - 1]:","- moves.append(i - start + 1)","-print((max(moves)))","+for h0, h1 in zip(H, H[1:]):","+ if h0 >= h1:","+ count += 1","+ else:","+ moves.append(count)","+ count = 0","+print((max(moves + [count])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0346468897,"measured_runtime_v1":0.0364086752,"runtime_lift":0.9516108316,"key":["s045098151","s179961765"]} +{"user_id":"u638282348","problem_id":"p03266","language":"python","submission_id_v0":"s799859744","submission_id_v1":"s775657592","cpu_time_v0":39,"cpu_time_v1":17,"memory_v0":4632,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.41,"input":"N, K = list(map(int, input().split()))\n\ndiv, rem = divmod(N, K)\n\nmods = [div + (0 < i <= rem) for i in range(K)]\n\ntotal = mods[0] ** 3\n\nif not K & 1:\n\n total += mods[K >> 1] ** 3\n\nprint(total)","target":"N, K = list(map(int, input().split()))\n\ndiv, rem = divmod(N, K)\n\ntotal = div ** 3\n\nif not K & 1:\n\n total += (div + (0 < K <= (rem << 1))) ** 3\n\nprint(total)","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":189,"code_v1_num_chars":153,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\ndiv, rem = divmod(N, K)\nmods = [div + (0 < i <= rem) for i in range(K)]\ntotal = mods[0] ** 3\nif not K & 1:\n total += mods[K >> 1] ** 3\nprint(total)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\ndiv, rem = divmod(N, K)\ntotal = div**3\nif not K & 1:\n total += (div + (0 < K <= (rem << 1))) ** 3\nprint(total)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-mods = [div + (0 < i <= rem) for i in range(K)]","-total = mods[0] ** 3","+total = div**3","- total += mods[K >> 1] ** 3","+ total += (div + (0 < K <= (rem << 1))) ** 3"],"diff_only_import_comment":false,"measured_runtime_v0":0.0421742439,"measured_runtime_v1":0.0402562618,"runtime_lift":1.0476443168,"key":["s799859744","s775657592"]} +{"user_id":"u912237403","problem_id":"p00049","language":"python","submission_id_v0":"s233198544","submission_id_v1":"s479363334","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4208,"memory_v1":4188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"import sys\n\n\n\nL=[\"A\",\"B\",\"AB\",\"O\"]\n\nb={}\n\nfor e in L:\n\n b[e]=0\n\nfor s in sys.stdin:\n\n i = s[s.index(',')+1:-1]\n\n b[i]+=1\n\nfor e in L:\n\n print(b[e])","target":"import sys\n\n\n\nb=[s.split(',')[1][:-1] for s in sys.stdin]\n\nfor e in [\"A\",\"B\",\"AB\",\"O\"]:\n\n print(b.count(e))","code_v0_loc":11,"code_v1_loc":5,"code_v0_num_chars":158,"code_v1_num_chars":109,"code_v0_no_empty_lines":"import sys\n\nL = [\"A\", \"B\", \"AB\", \"O\"]\nb = {}\nfor e in L:\n b[e] = 0\nfor s in sys.stdin:\n i = s[s.index(\",\") + 1 : -1]\n b[i] += 1\nfor e in L:\n print(b[e])\n","code_v1_no_empty_lines":"import sys\n\nb = [s.split(\",\")[1][:-1] for s in sys.stdin]\nfor e in [\"A\", \"B\", \"AB\", \"O\"]:\n print(b.count(e))\n","code_same":false,"relative_loc_diff_percent":54.5454545455,"diff":["-L = [\"A\", \"B\", \"AB\", \"O\"]","-b = {}","-for e in L:","- b[e] = 0","-for s in sys.stdin:","- i = s[s.index(\",\") + 1 : -1]","- b[i] += 1","-for e in L:","- print(b[e])","+b = [s.split(\",\")[1][:-1] for s in sys.stdin]","+for e in [\"A\", \"B\", \"AB\", \"O\"]:","+ print(b.count(e))"],"diff_only_import_comment":false,"measured_runtime_v0":0.043733614,"measured_runtime_v1":0.1613265204,"runtime_lift":0.2710875673,"key":["s233198544","s479363334"]} +{"user_id":"u539367121","problem_id":"p02955","language":"python","submission_id_v0":"s156428054","submission_id_v1":"s284123084","cpu_time_v0":216,"cpu_time_v1":169,"memory_v0":9380,"memory_v1":9516,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.76,"input":"n,k=list(map(int,input().split()))\n\na=[int(x) for x in input().split()]\n\ns=sum(a)\n\n\n\ncandidates=set()\n\nfor i in range(1,int(s**0.5)+1):\n\n if s%i==0:\n\n candidates.add(i)\n\n candidates.add(s\/\/i)\n\n\n\nans=0\n\nfor cdd in candidates:\n\n div_cdd=[0]*n\n\n for i in range(n):\n\n div_cdd[i]=a[i]%cdd\n\n div_cdd=sorted(div_cdd)\n\n pstv,ngtv=0,-sum(div_cdd)\n\n # calc need\n\n if pstv==-ngtv:\n\n ans=max(ans,cdd)\n\n continue\n\n for i in range(n):\n\n pstv+=cdd-div_cdd[-1-i]\n\n ngtv+=div_cdd[-1-i]\n\n if pstv==-ngtv: break\n\n ans=max(ans,cdd) if pstv<=k else ans\n\n \n\nprint(ans)","target":"n,k=list(map(int,input().split()))\n\na=[int(x) for x in input().split()]\n\ns=sum(a)\n\n\n\ncandidates=set()\n\nfor i in range(1,int(s**0.5)+1):\n\n if s%i==0:\n\n candidates.add(i)\n\n candidates.add(s\/\/i)\n\n\n\nans=0\n\nfor cdd in candidates:\n\n div_cdd=[0]*n\n\n for i in range(n):\n\n div_cdd[i]=a[i]%cdd\n\n div_cdd=sorted(div_cdd)\n\n # calc need\n\n idx=n-sum(div_cdd)\/\/cdd\n\n need=0\n\n for i in range(idx):\n\n need+=div_cdd[i]\n\n ans=max(ans,cdd) if need<=k else ans\n\n \n\nprint(ans)","code_v0_loc":28,"code_v1_loc":24,"code_v0_num_chars":576,"code_v1_num_chars":472,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\na = [int(x) for x in input().split()]\ns = sum(a)\ncandidates = set()\nfor i in range(1, int(s**0.5) + 1):\n if s % i == 0:\n candidates.add(i)\n candidates.add(s \/\/ i)\nans = 0\nfor cdd in candidates:\n div_cdd = [0] * n\n for i in range(n):\n div_cdd[i] = a[i] % cdd\n div_cdd = sorted(div_cdd)\n pstv, ngtv = 0, -sum(div_cdd)\n # calc need\n if pstv == -ngtv:\n ans = max(ans, cdd)\n continue\n for i in range(n):\n pstv += cdd - div_cdd[-1 - i]\n ngtv += div_cdd[-1 - i]\n if pstv == -ngtv:\n break\n ans = max(ans, cdd) if pstv <= k else ans\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\na = [int(x) for x in input().split()]\ns = sum(a)\ncandidates = set()\nfor i in range(1, int(s**0.5) + 1):\n if s % i == 0:\n candidates.add(i)\n candidates.add(s \/\/ i)\nans = 0\nfor cdd in candidates:\n div_cdd = [0] * n\n for i in range(n):\n div_cdd[i] = a[i] % cdd\n div_cdd = sorted(div_cdd)\n # calc need\n idx = n - sum(div_cdd) \/\/ cdd\n need = 0\n for i in range(idx):\n need += div_cdd[i]\n ans = max(ans, cdd) if need <= k else ans\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["- pstv, ngtv = 0, -sum(div_cdd)","- if pstv == -ngtv:","- ans = max(ans, cdd)","- continue","- for i in range(n):","- pstv += cdd - div_cdd[-1 - i]","- ngtv += div_cdd[-1 - i]","- if pstv == -ngtv:","- break","- ans = max(ans, cdd) if pstv <= k else ans","+ idx = n - sum(div_cdd) \/\/ cdd","+ need = 0","+ for i in range(idx):","+ need += div_cdd[i]","+ ans = max(ans, cdd) if need <= k else ans"],"diff_only_import_comment":false,"measured_runtime_v0":0.0457488191,"measured_runtime_v1":0.0376339765,"runtime_lift":1.2156254376,"key":["s156428054","s284123084"]} +{"user_id":"u019685451","problem_id":"p02555","language":"python","submission_id_v0":"s006820739","submission_id_v1":"s928322463","cpu_time_v0":76,"cpu_time_v1":63,"memory_v0":73456,"memory_v1":63636,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.11,"input":"N = int(eval(input()))\n\nM = 10**9 + 7\n\n\n\nif N < 3:\n\n print((0))\n\nelif N < 6:\n\n print((1))\n\nelse:\n\n dp = [0] * (N + 1)\n\n\n\n dp[3] = 1\n\n dp[4] = 1\n\n dp[5] = 1\n\n for i in range(6, N + 1):\n\n dp[i] = sum(dp[3:i - 3 + 1]) + 1\n\n dp[i] %= M\n\n\n\n print((dp[-1] % M))","target":"N = int(eval(input()))\n\nM = 10**9 + 7\n\n\n\nif N < 3:\n\n print((0))\n\nelif N < 6:\n\n print((1))\n\nelse:\n\n dp = [0] * (N + 1)\n\n dp[3] = 1\n\n dp[4] = 1\n\n dp[5] = 1\n\n P = dp[3]\n\n for i in range(6, N + 1):\n\n dp[i] = (P + 1) % M\n\n P = (P + dp[i - 2]) % M\n\n print((dp[-1] % M))","code_v0_loc":18,"code_v1_loc":17,"code_v0_num_chars":281,"code_v1_num_chars":292,"code_v0_no_empty_lines":"N = int(eval(input()))\nM = 10**9 + 7\nif N < 3:\n print((0))\nelif N < 6:\n print((1))\nelse:\n dp = [0] * (N + 1)\n dp[3] = 1\n dp[4] = 1\n dp[5] = 1\n for i in range(6, N + 1):\n dp[i] = sum(dp[3 : i - 3 + 1]) + 1\n dp[i] %= M\n print((dp[-1] % M))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nM = 10**9 + 7\nif N < 3:\n print((0))\nelif N < 6:\n print((1))\nelse:\n dp = [0] * (N + 1)\n dp[3] = 1\n dp[4] = 1\n dp[5] = 1\n P = dp[3]\n for i in range(6, N + 1):\n dp[i] = (P + 1) % M\n P = (P + dp[i - 2]) % M\n print((dp[-1] % M))\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["+ P = dp[3]","- dp[i] = sum(dp[3 : i - 3 + 1]) + 1","- dp[i] %= M","+ dp[i] = (P + 1) % M","+ P = (P + dp[i - 2]) % M"],"diff_only_import_comment":false,"measured_runtime_v0":0.0389034591,"measured_runtime_v1":0.0365702822,"runtime_lift":1.0637998041,"key":["s006820739","s928322463"]} +{"user_id":"u576432509","problem_id":"p03043","language":"python","submission_id_v0":"s753601135","submission_id_v1":"s453835803","cpu_time_v0":52,"cpu_time_v1":43,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.31,"input":"n,k=list(map(int,input().split()))\n\n\n\np=0.0\n\nfor i in range(1,n+1):\n\n m=0\n\n# print(k,i,m,i*2**m)\n\n while k>i*2**m:\n\n# print(k,i,m,i*2**m)\n\n m=m+1\n\n# print(m)\n\n p=p+(0.5)**m\/n\n\nprint(p)","target":"n,k=list(map(int,input().split()))\n\n\n\nret=0\n\nfor i in range(1,n+1):\n\n now=i\n\n tmp=1\/n\n\n while now i * 2**m:\n # print(k,i,m,i*2**m)\n m = m + 1\n # print(m)\n p = p + (0.5) ** m \/ n\nprint(p)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nret = 0\nfor i in range(1, n + 1):\n now = i\n tmp = 1 \/ n\n while now < k:\n now *= 2\n tmp \/= 2\n ret += tmp\nprint(ret)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-p = 0.0","+ret = 0","- m = 0","- # print(k,i,m,i*2**m)","- while k > i * 2**m:","- # print(k,i,m,i*2**m)","- m = m + 1","- # print(m)","- p = p + (0.5) ** m \/ n","-print(p)","+ now = i","+ tmp = 1 \/ n","+ while now < k:","+ now *= 2","+ tmp \/= 2","+ ret += tmp","+print(ret)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0691940901,"measured_runtime_v1":0.0612832116,"runtime_lift":1.1290872048,"key":["s753601135","s453835803"]} +{"user_id":"u112067694","problem_id":"p02388","language":"python","submission_id_v0":"s516675602","submission_id_v1":"s798970758","cpu_time_v0":10,"cpu_time_v1":0,"memory_v0":4628,"memory_v1":4628,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":100.0,"input":"a = eval(input(''))\n\nprint((a**3))\n","target":"y = eval(input())\n\nprint((y * y *y ))\n","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":27,"code_v1_num_chars":31,"code_v0_no_empty_lines":"a = eval(input(\"\"))\nprint((a**3))\n","code_v1_no_empty_lines":"y = eval(input())\nprint((y * y * y))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a = eval(input(\"\"))","-print((a**3))","+y = eval(input())","+print((y * y * y))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0465798378,"measured_runtime_v1":0.0490091801,"runtime_lift":0.9504308728,"key":["s516675602","s798970758"]} +{"user_id":"u729133443","problem_id":"p02883","language":"python","submission_id_v0":"s673137687","submission_id_v1":"s389574734","cpu_time_v0":1388,"cpu_time_v1":659,"memory_v0":37252,"memory_v1":124648,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.52,"input":"from numpy import*\n\nk,A,F=[int64(t.split())for t in open(0)]\n\nl=-1\n\nr=10**12\n\nwhile~l+r:\n\n m=l+r>>1\n\n if sum(A-minimum(sort(A),m\/\/sort(F)[::-1]))>k[1]:l=m\n\n else:r=m\n\nprint(r)","target":"(_,k),*t=[list(map(int,t.split()))for t in open(0)]\n\nA,F=list(map(sorted,t))\n\no=10**12\n\ng=-1\n\nwhile~g+o:\n\n m,l=o+g>>1,k\n\n for a,f in zip(A,F[::-1]):l-=max(0,a-m\/\/f)\n\n if l<0:g=m\n\n else:o=m\n\nprint(o)","code_v0_loc":9,"code_v1_loc":10,"code_v0_num_chars":175,"code_v1_num_chars":186,"code_v0_no_empty_lines":"from numpy import *\n\nk, A, F = [int64(t.split()) for t in open(0)]\nl = -1\nr = 10**12\nwhile ~l + r:\n m = l + r >> 1\n if sum(A - minimum(sort(A), m \/\/ sort(F)[::-1])) > k[1]:\n l = m\n else:\n r = m\nprint(r)\n","code_v1_no_empty_lines":"(_, k), *t = [list(map(int, t.split())) for t in open(0)]\nA, F = list(map(sorted, t))\no = 10**12\ng = -1\nwhile ~g + o:\n m, l = o + g >> 1, k\n for a, f in zip(A, F[::-1]):\n l -= max(0, a - m \/\/ f)\n if l < 0:\n g = m\n else:\n o = m\nprint(o)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-from numpy import *","-","-k, A, F = [int64(t.split()) for t in open(0)]","-l = -1","-r = 10**12","-while ~l + r:","- m = l + r >> 1","- if sum(A - minimum(sort(A), m \/\/ sort(F)[::-1])) > k[1]:","- l = m","+(_, k), *t = [list(map(int, t.split())) for t in open(0)]","+A, F = list(map(sorted, t))","+o = 10**12","+g = -1","+while ~g + o:","+ m, l = o + g >> 1, k","+ for a, f in zip(A, F[::-1]):","+ l -= max(0, a - m \/\/ f)","+ if l < 0:","+ g = m","- r = m","-print(r)","+ o = m","+print(o)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2129065468,"measured_runtime_v1":0.0403286424,"runtime_lift":5.2792887208,"key":["s673137687","s389574734"]} +{"user_id":"u867848444","problem_id":"p03108","language":"python","submission_id_v0":"s715865771","submission_id_v1":"s354143191","cpu_time_v0":1015,"cpu_time_v1":877,"memory_v0":96984,"memory_v1":37816,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.6,"input":"from sys import setrecursionlimit\n\n#setrecursionlimit(10**5)\n\nclass UnionFind:\n\n def __init__(self, n):\n\n # \u89aa\u8981\u7d20\u306e\u30ce\u30fc\u30c9\u756a\u53f7\u3092\u683c\u7d0d\n\n # par[x]=x\u306e\u6642\u305d\u306e\u30ce\u30fc\u30c9\u306f\u6839\u3000\n\n self.par = [i for i in range(n + 1)]\n\n # rank\n\n self.rank = [0] * (n + 1)\n\n self.size = [1] * (n + 1)\n\n\n\n def find(self, x):\n\n # \u6839\u306e\u756a\u53f7\u3092\u8fd4\u3059(\u6240\u5c5e\u3059\u308b\u96c6\u5408\u3092\u78ba\u8a8d\u3059\u308b)\n\n if self.par[x] == x:\n\n return x\n\n else:\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n\n\n def check(self, x, y):\n\n # x,y\u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u8abf\u3079\u308b\n\n return self.find(x) == self.find(y)\n\n\n\n\n\n def union(self, x, y):\n\n # \u6839\u3092\u63a2\u3059\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:return -1\n\n # rank\u306e\u5c0f\u3055\u3044\u3082\u306e\u3092\u5927\u304d\u3044\u307b\u3046\u306b\u304f\u3063\u3064\u3051\u308b\n\n if self.rank[x] < self.rank[y]:\n\n self.par[x] = y\n\n temp = self.size[x]\n\n self.size[y] += temp\n\n temp1 = self.size[y]\n\n else:\n\n self.par[y] = x\n\n temp = self.size[y]\n\n self.size[x] += temp\n\n temp1 = self.size[x]\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n return (temp, temp1)\n\n\n\n def count_group(self):\n\n return len({self.find(x) for x in range(1, n + 1)})\n\n\n\nn, m = map(int,input().split())\n\nab = [list(map(int,input().split())) for i in range(m)]\n\n\n\nuf = UnionFind(n)\n\ninc = [n * (n - 1) \/\/ 2] * m\n\nfor i in range(m - 1):\n\n a, b = ab[- i - 1]\n\n rec = uf.union(a, b)\n\n if rec == -1:\n\n inc[-i-2] = inc[-i-1]\n\n continue\n\n\n\n temp = rec[1] - rec[0]\n\n inc[-i-2] = max(inc[-i-1] - temp * rec[0], 0)\n\n\n\n #print(uf.size,inc,rec,temp)\n\nprint(*inc, sep = '\\n')\n","target":"from sys import setrecursionlimit\n\n#setrecursionlimit(10**5)\n\nclass UnionFind:\n\n def __init__(self, n):\n\n # \u89aa\u8981\u7d20\u306e\u30ce\u30fc\u30c9\u756a\u53f7\u3092\u683c\u7d0d\n\n # par[x]=x\u306e\u6642\u305d\u306e\u30ce\u30fc\u30c9\u306f\u6839\u3000\n\n self.par = [i for i in range(n + 1)]\n\n # rank\n\n self.rank = [0] * (n + 1)\n\n self.size = [1] * (n + 1)\n\n\n\n def find(self, x):\n\n # \u6839\u306e\u756a\u53f7\u3092\u8fd4\u3059(\u6240\u5c5e\u3059\u308b\u96c6\u5408\u3092\u78ba\u8a8d\u3059\u308b)\n\n if self.par[x] == x:\n\n return x\n\n else:\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n\n\n def check(self, x, y):\n\n # x,y\u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u8abf\u3079\u308b\n\n return self.find(x) == self.find(y)\n\n\n\n\n\n def union(self, x, y):\n\n # \u6839\u3092\u63a2\u3059\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:return\n\n # rank\u306e\u5c0f\u3055\u3044\u3082\u306e\u3092\u5927\u304d\u3044\u307b\u3046\u306b\u304f\u3063\u3064\u3051\u308b\n\n if self.rank[x] < self.rank[y]:\n\n self.par[x] = y\n\n self.size[y] += self.size[x]\n\n else:\n\n self.par[y] = x\n\n self.size[x] += self.size[y]\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n\n\n def count_group(self, n):\n\n return len({self.find(x) for x in range(1, n + 1)})\n\n\n\ndef com_2(n):\n\n if n == 1:return 0\n\n return n * (n - 1) \/\/ 2\n\n\n\nn, m = map(int,input().split())\n\nab = [list(map(int,input().split())) for i in range(m)]\n\nab = ab[::-1]\n\nuf = UnionFind(n)\n\n\n\nrec = [n * (n - 1) \/\/ 2] * m\n\nfor i in range(m - 1):\n\n a, b = ab[i]\n\n if uf.check(a, b):\n\n rec[i + 1] = rec[i]\n\n continue\n\n a_size = uf.size[uf.find(a)]\n\n b_size = uf.size[uf.find(b)]\n\n temp = com_2(a_size) + com_2(b_size) - com_2(a_size + b_size)\n\n rec[i + 1] = rec[i] + temp\n\n uf.union(a, b)\n\n\n\nrec = rec[::-1]\n\nprint(*rec, sep='\\n')\n","code_v0_loc":64,"code_v1_loc":65,"code_v0_num_chars":1714,"code_v1_num_chars":1708,"code_v0_no_empty_lines":"from sys import setrecursionlimit\n\n# setrecursionlimit(10**5)\nclass UnionFind:\n def __init__(self, n):\n # \u89aa\u8981\u7d20\u306e\u30ce\u30fc\u30c9\u756a\u53f7\u3092\u683c\u7d0d\n # par[x]=x\u306e\u6642\u305d\u306e\u30ce\u30fc\u30c9\u306f\u6839\n self.par = [i for i in range(n + 1)]\n # rank\n self.rank = [0] * (n + 1)\n self.size = [1] * (n + 1)\n\n def find(self, x):\n # \u6839\u306e\u756a\u53f7\u3092\u8fd4\u3059(\u6240\u5c5e\u3059\u308b\u96c6\u5408\u3092\u78ba\u8a8d\u3059\u308b)\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def check(self, x, y):\n # x,y\u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u8abf\u3079\u308b\n return self.find(x) == self.find(y)\n\n def union(self, x, y):\n # \u6839\u3092\u63a2\u3059\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return -1\n # rank\u306e\u5c0f\u3055\u3044\u3082\u306e\u3092\u5927\u304d\u3044\u307b\u3046\u306b\u304f\u3063\u3064\u3051\u308b\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n temp = self.size[x]\n self.size[y] += temp\n temp1 = self.size[y]\n else:\n self.par[y] = x\n temp = self.size[y]\n self.size[x] += temp\n temp1 = self.size[x]\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n return (temp, temp1)\n\n def count_group(self):\n return len({self.find(x) for x in range(1, n + 1)})\n\n\nn, m = map(int, input().split())\nab = [list(map(int, input().split())) for i in range(m)]\nuf = UnionFind(n)\ninc = [n * (n - 1) \/\/ 2] * m\nfor i in range(m - 1):\n a, b = ab[-i - 1]\n rec = uf.union(a, b)\n if rec == -1:\n inc[-i - 2] = inc[-i - 1]\n continue\n temp = rec[1] - rec[0]\n inc[-i - 2] = max(inc[-i - 1] - temp * rec[0], 0)\n # print(uf.size,inc,rec,temp)\nprint(*inc, sep=\"\\n\")\n","code_v1_no_empty_lines":"from sys import setrecursionlimit\n\n# setrecursionlimit(10**5)\nclass UnionFind:\n def __init__(self, n):\n # \u89aa\u8981\u7d20\u306e\u30ce\u30fc\u30c9\u756a\u53f7\u3092\u683c\u7d0d\n # par[x]=x\u306e\u6642\u305d\u306e\u30ce\u30fc\u30c9\u306f\u6839\n self.par = [i for i in range(n + 1)]\n # rank\n self.rank = [0] * (n + 1)\n self.size = [1] * (n + 1)\n\n def find(self, x):\n # \u6839\u306e\u756a\u53f7\u3092\u8fd4\u3059(\u6240\u5c5e\u3059\u308b\u96c6\u5408\u3092\u78ba\u8a8d\u3059\u308b)\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def check(self, x, y):\n # x,y\u304c\u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u8abf\u3079\u308b\n return self.find(x) == self.find(y)\n\n def union(self, x, y):\n # \u6839\u3092\u63a2\u3059\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n # rank\u306e\u5c0f\u3055\u3044\u3082\u306e\u3092\u5927\u304d\u3044\u307b\u3046\u306b\u304f\u3063\u3064\u3051\u308b\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n self.size[y] += self.size[x]\n else:\n self.par[y] = x\n self.size[x] += self.size[y]\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n def count_group(self, n):\n return len({self.find(x) for x in range(1, n + 1)})\n\n\ndef com_2(n):\n if n == 1:\n return 0\n return n * (n - 1) \/\/ 2\n\n\nn, m = map(int, input().split())\nab = [list(map(int, input().split())) for i in range(m)]\nab = ab[::-1]\nuf = UnionFind(n)\nrec = [n * (n - 1) \/\/ 2] * m\nfor i in range(m - 1):\n a, b = ab[i]\n if uf.check(a, b):\n rec[i + 1] = rec[i]\n continue\n a_size = uf.size[uf.find(a)]\n b_size = uf.size[uf.find(b)]\n temp = com_2(a_size) + com_2(b_size) - com_2(a_size + b_size)\n rec[i + 1] = rec[i] + temp\n uf.union(a, b)\nrec = rec[::-1]\nprint(*rec, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":1.5384615385,"diff":["- return -1","+ return","- temp = self.size[x]","- self.size[y] += temp","- temp1 = self.size[y]","+ self.size[y] += self.size[x]","- temp = self.size[y]","- self.size[x] += temp","- temp1 = self.size[x]","+ self.size[x] += self.size[y]","- return (temp, temp1)","- def count_group(self):","+ def count_group(self, n):","+","+","+def com_2(n):","+ if n == 1:","+ return 0","+ return n * (n - 1) \/\/ 2","+ab = ab[::-1]","-inc = [n * (n - 1) \/\/ 2] * m","+rec = [n * (n - 1) \/\/ 2] * m","- a, b = ab[-i - 1]","- rec = uf.union(a, b)","- if rec == -1:","- inc[-i - 2] = inc[-i - 1]","+ a, b = ab[i]","+ if uf.check(a, b):","+ rec[i + 1] = rec[i]","- temp = rec[1] - rec[0]","- inc[-i - 2] = max(inc[-i - 1] - temp * rec[0], 0)","- # print(uf.size,inc,rec,temp)","-print(*inc, sep=\"\\n\")","+ a_size = uf.size[uf.find(a)]","+ b_size = uf.size[uf.find(b)]","+ temp = com_2(a_size) + com_2(b_size) - com_2(a_size + b_size)","+ rec[i + 1] = rec[i] + temp","+ uf.union(a, b)","+rec = rec[::-1]","+print(*rec, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0928357437,"measured_runtime_v1":0.0905337048,"runtime_lift":1.025427424,"key":["s715865771","s354143191"]} +{"user_id":"u062691227","problem_id":"p03986","language":"python","submission_id_v0":"s285049816","submission_id_v1":"s908009755","cpu_time_v0":146,"cpu_time_v1":73,"memory_v0":72708,"memory_v1":67364,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"s = input().rstrip()\n\n\n\nremoved = 0\n\ncnt_s = cnt_t = 0\n\n\n\nfor c in s:\n\n if c == 'S':\n\n cnt_s += 1\n\n else:\n\n cnt_t += 1\n\n if cnt_t > cnt_s:\n\n removed += cnt_s\n\n cnt_s = cnt_t = 0\n\n# print(cnt_s,cnt_t)\n\nremoved += min(cnt_s,cnt_t)\n\nprint((len(s) - removed*2))","target":"s = input().rstrip()\n\nn = len(s)\n\n\n\nremoved = 0\n\ncnt_s = cnt_t = 0\n\n\n\nfor i in range(n):\n\n if s[i] == 'S':\n\n cnt_s += 1\n\n else:\n\n cnt_t += 1\n\n if i == n-1:\n\n removed += min(cnt_s,cnt_t)\n\n elif cnt_t > cnt_s:\n\n removed += cnt_s\n\n cnt_s = cnt_t = 0\n\n# print(cnt_s,cnt_t)\n\nprint((len(s) - removed*2))","code_v0_loc":16,"code_v1_loc":18,"code_v0_num_chars":296,"code_v1_num_chars":346,"code_v0_no_empty_lines":"s = input().rstrip()\nremoved = 0\ncnt_s = cnt_t = 0\nfor c in s:\n if c == \"S\":\n cnt_s += 1\n else:\n cnt_t += 1\n if cnt_t > cnt_s:\n removed += cnt_s\n cnt_s = cnt_t = 0\n# print(cnt_s,cnt_t)\nremoved += min(cnt_s, cnt_t)\nprint((len(s) - removed * 2))\n","code_v1_no_empty_lines":"s = input().rstrip()\nn = len(s)\nremoved = 0\ncnt_s = cnt_t = 0\nfor i in range(n):\n if s[i] == \"S\":\n cnt_s += 1\n else:\n cnt_t += 1\n if i == n - 1:\n removed += min(cnt_s, cnt_t)\n elif cnt_t > cnt_s:\n removed += cnt_s\n cnt_s = cnt_t = 0\n# print(cnt_s,cnt_t)\nprint((len(s) - removed * 2))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["+n = len(s)","-for c in s:","- if c == \"S\":","+for i in range(n):","+ if s[i] == \"S\":","- if cnt_t > cnt_s:","+ if i == n - 1:","+ removed += min(cnt_s, cnt_t)","+ elif cnt_t > cnt_s:","-removed += min(cnt_s, cnt_t)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0479621551,"measured_runtime_v1":0.0477036893,"runtime_lift":1.0054181503,"key":["s285049816","s908009755"]} +{"user_id":"u270467412","problem_id":"p02972","language":"python","submission_id_v0":"s585501396","submission_id_v1":"s762270652","cpu_time_v0":1075,"cpu_time_v1":581,"memory_v0":14136,"memory_v1":14136,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.95,"input":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nB = [0]*N\n\n\n\nfor i in range(N-1, -1, -1):\n\n count = 0\n\n for j in range(i, N, i+1):\n\n count += B[j]\n\n if count%2 == A[i]:\n\n B[i] = 0\n\n else:\n\n B[i] = 1\n\n\n\nsum = sum(B)\n\nif sum == 0:\n\n print((0))\n\nelse:\n\n print(sum)\n\n ans = []\n\n for i in range(N):\n\n if B[i] == 1:\n\n ans.append(i+1)\n\n print((*ans))\n","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nB = [0]*N\n\n\n\nfor i in range(N-1, -1, -1):\n\n count = 0\n\n for j in range(i, N, i+1):\n\n count += B[j]\n\n if count%2 == A[i]:\n\n B[i] = 0\n\n else:\n\n B[i] = 1\n\n\n\nsum = sum(B)\n\nif sum == 0:\n\n print((0))\n\nelse:\n\n print(sum)\n\n ans = []\n\n for i in range(N):\n\n if B[i] == 1:\n\n ans.append(i+1)\n\n print((*ans))\n","code_v0_loc":24,"code_v1_loc":24,"code_v0_num_chars":383,"code_v1_num_chars":375,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nB = [0] * N\nfor i in range(N - 1, -1, -1):\n count = 0\n for j in range(i, N, i + 1):\n count += B[j]\n if count % 2 == A[i]:\n B[i] = 0\n else:\n B[i] = 1\nsum = sum(B)\nif sum == 0:\n print((0))\nelse:\n print(sum)\n ans = []\n for i in range(N):\n if B[i] == 1:\n ans.append(i + 1)\n print((*ans))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nB = [0] * N\nfor i in range(N - 1, -1, -1):\n count = 0\n for j in range(i, N, i + 1):\n count += B[j]\n if count % 2 == A[i]:\n B[i] = 0\n else:\n B[i] = 1\nsum = sum(B)\nif sum == 0:\n print((0))\nelse:\n print(sum)\n ans = []\n for i in range(N):\n if B[i] == 1:\n ans.append(i + 1)\n print((*ans))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if count % 2 == A[i]:","- B[i] = 0","- else:","- B[i] = 1","+ if count % 2 == A[i]:","+ B[i] = 0","+ else:","+ B[i] = 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0392880753,"measured_runtime_v1":0.0386568695,"runtime_lift":1.0163284233,"key":["s585501396","s762270652"]} +{"user_id":"u119148115","problem_id":"p03001","language":"python","submission_id_v0":"s840001435","submission_id_v1":"s446628333","cpu_time_v0":286,"cpu_time_v1":65,"memory_v0":80068,"memory_v1":61820,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":77.27,"input":"import sys\n\n\n\nsys.setrecursionlimit(10**7)\n\ndef I(): return int(sys.stdin.readline().rstrip())\n\ndef MI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #\u7a7a\u767d\u3042\u308a\n\ndef LI2(): return list(map(int,sys.stdin.readline().rstrip())) #\u7a7a\u767d\u306a\u3057\n\ndef S(): return sys.stdin.readline().rstrip()\n\ndef LS(): return list(sys.stdin.readline().rstrip().split()) #\u7a7a\u767d\u3042\u308a\n\ndef LS2(): return list(sys.stdin.readline().rstrip()) #\u7a7a\u767d\u306a\u3057\n\n\n\nW,H,x,y = MI()\n\nif 2*x == W and 2*y == H:\n\n print((H*W\/2,1))\n\nelse:\n\n print((H*W\/2,0))\n\n\n","target":"import sys\n\ndef MI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\n\n\nW,H,x,y = MI()\n\n\n\n# \u9577\u65b9\u5f62\u306e\u4e2d\u5fc3\n\n\n\nif 2*x == W and 2*y == H:\n\n print((H*W\/2,1))\n\nelse:\n\n print((H*W\/2,0))\n","code_v0_loc":17,"code_v1_loc":11,"code_v0_num_chars":581,"code_v1_num_chars":182,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef I():\n return int(sys.stdin.readline().rstrip())\n\n\ndef MI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().rstrip().split())) # \u7a7a\u767d\u3042\u308a\n\n\ndef LI2():\n return list(map(int, sys.stdin.readline().rstrip())) # \u7a7a\u767d\u306a\u3057\n\n\ndef S():\n return sys.stdin.readline().rstrip()\n\n\ndef LS():\n return list(sys.stdin.readline().rstrip().split()) # \u7a7a\u767d\u3042\u308a\n\n\ndef LS2():\n return list(sys.stdin.readline().rstrip()) # \u7a7a\u767d\u306a\u3057\n\n\nW, H, x, y = MI()\nif 2 * x == W and 2 * y == H:\n print((H * W \/ 2, 1))\nelse:\n print((H * W \/ 2, 0))\n","code_v1_no_empty_lines":"import sys\n\n\ndef MI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\nW, H, x, y = MI()\n# \u9577\u65b9\u5f62\u306e\u4e2d\u5fc3\nif 2 * x == W and 2 * y == H:\n print((H * W \/ 2, 1))\nelse:\n print((H * W \/ 2, 0))\n","code_same":false,"relative_loc_diff_percent":35.2941176471,"diff":["-","-sys.setrecursionlimit(10**7)","-","-","-def I():","- return int(sys.stdin.readline().rstrip())","-def LI():","- return list(map(int, sys.stdin.readline().rstrip().split())) # \u7a7a\u767d\u3042\u308a","-","-","-def LI2():","- return list(map(int, sys.stdin.readline().rstrip())) # \u7a7a\u767d\u306a\u3057","-","-","-def S():","- return sys.stdin.readline().rstrip()","-","-","-def LS():","- return list(sys.stdin.readline().rstrip().split()) # \u7a7a\u767d\u3042\u308a","-","-","-def LS2():","- return list(sys.stdin.readline().rstrip()) # \u7a7a\u767d\u306a\u3057","-","-","+# \u9577\u65b9\u5f62\u306e\u4e2d\u5fc3"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409073348,"measured_runtime_v1":0.0690183616,"runtime_lift":0.5927022008,"key":["s840001435","s446628333"]} +{"user_id":"u968404618","problem_id":"p02573","language":"python","submission_id_v0":"s802335691","submission_id_v1":"s947232689","cpu_time_v0":751,"cpu_time_v1":631,"memory_v0":49780,"memory_v1":49884,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.98,"input":"# Union find\n\n# \u304b\u3063\u3064\u3071\u3055\u3093\u306e\u89e3\u8aac\u3068\u516c\u5f0f\u306e\u30b9\u30e9\u30a4\u30c9\u307f\u305f\n\n# https:\/\/www.youtube.com\/watch?time_continue=916&v=zxor0DdwoXA&feature=emb_logo\n\n# https:\/\/www.slideshare.net\/chokudai\/union-find-49066733\n\n\n\nimport sys\n\nsys.setrecursionlimit(10 ** 9)\n\n\n\nn, m = list(map(int, input().split()))\n\nAB = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nroot = [-1]*n\n\n\n\ndef find(x):\n\n if root[x] < 0:\n\n return x\n\n else:\n\n root[x] = find(root[x])\n\n return root[x]\n\n\n\ndef unite(x, y):\n\n gx = find(x)\n\n gy = find(y)\n\n \n\n if gx == gy:\n\n return\n\n \n\n if root[gx] > root[gy]:\n\n gx, gy = gy, gx\n\n \n\n root[gx] += root[gy]\n\n root[gy] = gx\n\n\n\ndef size(x):\n\n x = find(x)\n\n return -root[x]\n\n\n\nfor a, b in AB:\n\n a -= 1\n\n b -= 1\n\n unite(a, b)\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans = max(ans, size(i))\n\nprint(ans)","target":"import sys\n\nsys.setrecursionlimit(10**9)\n\n\n\nn, m = list(map(int, input().split()))\n\nAB = [list(map(int, input().split())) for _ in range(m)]\n\n\n\nroot = [-1] * n\n\n\n\ndef find(x):\n\n if root[x] < 0:\n\n return x\n\n else:\n\n return find(root[x])\n\n\n\ndef unity(x, y):\n\n gx = find(x)\n\n gy = find(y)\n\n\n\n if gx == gy:\n\n return\n\n\n\n if root[gx] > root[gy]:\n\n gx, gy = gy, gx\n\n\n\n root[gx] += root[gy]\n\n root[gy] = gx\n\n\n\nfor a, b in AB:\n\n a -= 1\n\n b -= 1\n\n unity(a, b)\n\n\n\nprint((-min(root)))","code_v0_loc":46,"code_v1_loc":33,"code_v0_num_chars":855,"code_v1_num_chars":525,"code_v0_no_empty_lines":"# Union find\n# \u304b\u3063\u3064\u3071\u3055\u3093\u306e\u89e3\u8aac\u3068\u516c\u5f0f\u306e\u30b9\u30e9\u30a4\u30c9\u307f\u305f\n# https:\/\/www.youtube.com\/watch?time_continue=916&v=zxor0DdwoXA&feature=emb_logo\n# https:\/\/www.slideshare.net\/chokudai\/union-find-49066733\nimport sys\n\nsys.setrecursionlimit(10**9)\nn, m = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(m)]\nroot = [-1] * n\n\n\ndef find(x):\n if root[x] < 0:\n return x\n else:\n root[x] = find(root[x])\n return root[x]\n\n\ndef unite(x, y):\n gx = find(x)\n gy = find(y)\n if gx == gy:\n return\n if root[gx] > root[gy]:\n gx, gy = gy, gx\n root[gx] += root[gy]\n root[gy] = gx\n\n\ndef size(x):\n x = find(x)\n return -root[x]\n\n\nfor a, b in AB:\n a -= 1\n b -= 1\n unite(a, b)\nans = 0\nfor i in range(n):\n ans = max(ans, size(i))\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nn, m = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(m)]\nroot = [-1] * n\n\n\ndef find(x):\n if root[x] < 0:\n return x\n else:\n return find(root[x])\n\n\ndef unity(x, y):\n gx = find(x)\n gy = find(y)\n if gx == gy:\n return\n if root[gx] > root[gy]:\n gx, gy = gy, gx\n root[gx] += root[gy]\n root[gy] = gx\n\n\nfor a, b in AB:\n a -= 1\n b -= 1\n unity(a, b)\nprint((-min(root)))\n","code_same":false,"relative_loc_diff_percent":28.2608695652,"diff":["-# Union find","-# \u304b\u3063\u3064\u3071\u3055\u3093\u306e\u89e3\u8aac\u3068\u516c\u5f0f\u306e\u30b9\u30e9\u30a4\u30c9\u307f\u305f","-# https:\/\/www.youtube.com\/watch?time_continue=916&v=zxor0DdwoXA&feature=emb_logo","-# https:\/\/www.slideshare.net\/chokudai\/union-find-49066733","- root[x] = find(root[x])","- return root[x]","+ return find(root[x])","-def unite(x, y):","+def unity(x, y):","-def size(x):","- x = find(x)","- return -root[x]","-","-","- unite(a, b)","-ans = 0","-for i in range(n):","- ans = max(ans, size(i))","-print(ans)","+ unity(a, b)","+print((-min(root)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1740593214,"measured_runtime_v1":0.0476550515,"runtime_lift":3.6524841753,"key":["s802335691","s947232689"]} +{"user_id":"u922449550","problem_id":"p02696","language":"python","submission_id_v0":"s535035162","submission_id_v1":"s513303133","cpu_time_v0":22,"cpu_time_v1":20,"memory_v0":9160,"memory_v1":9060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.09,"input":"A, B, N = list(map(int, input().split()))\n\nalpha = A \/\/ B\n\nbeta = A % B\n\nq = min(N, B - 1)\n\n\n\nans = alpha * q + (beta*q\/\/B)\n\nprint(ans)","target":"A, B, N = list(map(int, input().split()))\n\nx = min(N, B-1)\n\nprint((A*x\/\/B - A*(x\/\/B)))","code_v0_loc":7,"code_v1_loc":3,"code_v0_num_chars":129,"code_v1_num_chars":78,"code_v0_no_empty_lines":"A, B, N = list(map(int, input().split()))\nalpha = A \/\/ B\nbeta = A % B\nq = min(N, B - 1)\nans = alpha * q + (beta * q \/\/ B)\nprint(ans)\n","code_v1_no_empty_lines":"A, B, N = list(map(int, input().split()))\nx = min(N, B - 1)\nprint((A * x \/\/ B - A * (x \/\/ B)))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-alpha = A \/\/ B","-beta = A % B","-q = min(N, B - 1)","-ans = alpha * q + (beta * q \/\/ B)","-print(ans)","+x = min(N, B - 1)","+print((A * x \/\/ B - A * (x \/\/ B)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.088148486,"measured_runtime_v1":0.0365528526,"runtime_lift":2.4115350732,"key":["s535035162","s513303133"]} +{"user_id":"u729133443","problem_id":"p03311","language":"python","submission_id_v0":"s019441964","submission_id_v1":"s646554556","cpu_time_v0":299,"cpu_time_v1":213,"memory_v0":90196,"memory_v1":27224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.76,"input":"n=int(eval(input()));a=sorted(int(x)-i for i,x in enumerate(input().split()));print((sum(abs(i-a[n\/\/2])for i in a)))","target":"_,a=open(0);a=sorted(int(x)-i for i,x in enumerate(a.split()));print((sum(abs(i-a[len(a)\/\/2])for i in a)))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":108,"code_v1_num_chars":104,"code_v0_no_empty_lines":"n = int(eval(input()))\na = sorted(int(x) - i for i, x in enumerate(input().split()))\nprint((sum(abs(i - a[n \/\/ 2]) for i in a)))\n","code_v1_no_empty_lines":"_, a = open(0)\na = sorted(int(x) - i for i, x in enumerate(a.split()))\nprint((sum(abs(i - a[len(a) \/\/ 2]) for i in a)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-n = int(eval(input()))","-a = sorted(int(x) - i for i, x in enumerate(input().split()))","-print((sum(abs(i - a[n \/\/ 2]) for i in a)))","+_, a = open(0)","+a = sorted(int(x) - i for i, x in enumerate(a.split()))","+print((sum(abs(i - a[len(a) \/\/ 2]) for i in a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0533716679,"measured_runtime_v1":0.0491206169,"runtime_lift":1.0865431097,"key":["s019441964","s646554556"]} +{"user_id":"u095021077","problem_id":"p03001","language":"python","submission_id_v0":"s776342420","submission_id_v1":"s080804922","cpu_time_v0":169,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.94,"input":"temp=input().split()\n\nW=int(temp[0])\n\nH=int(temp[1])\n\nx=int(temp[2])\n\ny=int(temp[3])\n\n\n\nS=W*H\/2\n\nif W\/2==x and H\/2==y:\n\n w=int(1)\n\nelse:\n\n w=int(0)\n\n \n\nprint((S, w))","target":"W, H, x, y=list(map(int, input().split()))\n\n\n\nS=W*H\/2\n\noutput='0'\n\nif x==W\/2 and y==H\/2:\n\n output='1'\n\n \n\nprint((' '.join([str(S), output])))","code_v0_loc":13,"code_v1_loc":8,"code_v0_num_chars":166,"code_v1_num_chars":135,"code_v0_no_empty_lines":"temp = input().split()\nW = int(temp[0])\nH = int(temp[1])\nx = int(temp[2])\ny = int(temp[3])\nS = W * H \/ 2\nif W \/ 2 == x and H \/ 2 == y:\n w = int(1)\nelse:\n w = int(0)\nprint((S, w))\n","code_v1_no_empty_lines":"W, H, x, y = list(map(int, input().split()))\nS = W * H \/ 2\noutput = \"0\"\nif x == W \/ 2 and y == H \/ 2:\n output = \"1\"\nprint((\" \".join([str(S), output])))\n","code_same":false,"relative_loc_diff_percent":38.4615384615,"diff":["-temp = input().split()","-W = int(temp[0])","-H = int(temp[1])","-x = int(temp[2])","-y = int(temp[3])","+W, H, x, y = list(map(int, input().split()))","-if W \/ 2 == x and H \/ 2 == y:","- w = int(1)","-else:","- w = int(0)","-print((S, w))","+output = \"0\"","+if x == W \/ 2 and y == H \/ 2:","+ output = \"1\"","+print((\" \".join([str(S), output])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463254279,"measured_runtime_v1":0.0450881341,"runtime_lift":1.027441672,"key":["s776342420","s080804922"]} +{"user_id":"u147077748","problem_id":"p03166","language":"python","submission_id_v0":"s772801182","submission_id_v1":"s454435670","cpu_time_v0":324,"cpu_time_v1":291,"memory_v0":23028,"memory_v1":23052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.19,"input":"import sys\n\nimport collections\n\n\n\n# input\u51e6\u7406\u3092\u9ad8\u901f\u5316\u3059\u308b\n\ninput = sys.stdin.readline\n\n\n\ndef chmax(a, b):\n\n \"\"\" \u6700\u5927\u5024\u3092\u8fd4\u3059\u95a2\u6570 \"\"\"\n\n if a >= b:\n\n return a\n\n else:\n\n return b\n\n\n\ndef main(): \n\n # \u5165\u529b\n\n N, M = list(map(int, input().split()))\n\n # \u96a3\u63a5\u95a2\u4fc2\u306f\u96a3\u63a5\u30ea\u30b9\u30c8\u3067\u7ba1\u7406\u3059\u308b\n\n lst_edge = [[] for _ in range(N)]\n\n # \u5404\u9802\u70b9\u306e\u5165\u529b\u8fba\u306e\u672c\u6570\n\n deg = [0] * N \n\n for _ in range(M):\n\n x, y = list(map(int, input().split()))\n\n # \u6700\u521d\u306eindex\u3092\u30bc\u30ed\u306b\u3059\u308b\n\n lst_edge[x-1].append(y-1)\n\n deg[y-1] += 1\n\n \n\n # \u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u3044\u9802\u70b9\u3092queue\u306b\u5165\u308c\u308b\n\n que = collections.deque()\n\n for v in range(N):\n\n if deg[v] == 0:\n\n que.append(v)\n\n\n\n # \u5404\u9802\u70b9\u306e\u6700\u521d\u306b\u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u304b\u3063\u305f\u70b9\u304b\u3089\u306e\u8ddd\u96e2\n\n dp = [0] * N \n\n\n\n while len(que) > 0:\n\n v = que.popleft()\n\n lst_nv = lst_edge[v]\n\n for nv in lst_nv:\n\n # \u30a8\u30c3\u30b8(v, nv)\u3092\u30b0\u30e9\u30d5\u304b\u3089\u524a\u9664\u3059\u308b\n\n deg[nv] -= 1\n\n if deg[nv] == 0:\n\n # \u30a8\u30c3\u30b8\u304c\u306a\u304f\u306a\u3063\u305f\u3053\u3068\u3067\u3001\u5165\u529b\u8fba\u304c\u306a\u304f\u306a\u3063\u305f\u3089queue\u306b\u5165\u308c\u308b\n\n que.append(nv)\n\n # \u6700\u521d\u306b\u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u304b\u3063\u305f\u70b9\u304b\u3089\u306e\u8ddd\u96e2\n\n dp[nv] = chmax(dp[nv], dp[v] + 1)\n\n \n\n print((max(dp)))\n\n\n\n\n\nmain()","target":"import sys\n\nimport collections\n\n\n\n# input\u51e6\u7406\u3092\u9ad8\u901f\u5316\u3059\u308b\n\ninput = sys.stdin.readline\n\n\n\ndef chmax(a, b):\n\n \"\"\" \u6700\u5927\u5024\u3092\u8fd4\u3059\u95a2\u6570 \"\"\"\n\n if a >= b:\n\n return a\n\n return b\n\n\n\ndef main():\n\n # \u5165\u529b\n\n N, M = list(map(int, input().split()))\n\n # \u96a3\u63a5\u95a2\u4fc2\u306f\u96a3\u63a5\u30ea\u30b9\u30c8\u3067\u7ba1\u7406\u3059\u308b\n\n lst_edge = [[] for _ in range(N)]\n\n # \u5404\u9802\u70b9\u306e\u5165\u529b\u8fba\u306e\u672c\u6570\n\n deg = [0] * N\n\n for _ in range(M):\n\n x, y = list(map(int, input().split()))\n\n # \u6700\u521d\u306eindex\u3092\u30bc\u30ed\u306b\u3059\u308b\n\n lst_edge[x-1].append(y-1)\n\n deg[y-1] += 1\n\n\n\n # \u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u3044\u9802\u70b9\u3092queue\u306b\u5165\u308c\u308b\n\n que = collections.deque()\n\n for v in range(N):\n\n if deg[v] == 0:\n\n que.append(v)\n\n\n\n # \u5404\u9802\u70b9\u306e\u6700\u521d\u306b\u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u304b\u3063\u305f\u70b9\u304b\u3089\u306e\u8ddd\u96e2\n\n dp = [0] * N\n\n\n\n while que:\n\n v = que.popleft()\n\n lst_nv = lst_edge[v]\n\n for nv in lst_nv:\n\n # \u30a8\u30c3\u30b8(v, nv)\u3092\u30b0\u30e9\u30d5\u304b\u3089\u524a\u9664\u3059\u308b\n\n deg[nv] -= 1\n\n if deg[nv] == 0:\n\n # \u30a8\u30c3\u30b8\u304c\u306a\u304f\u306a\u3063\u305f\u3053\u3068\u3067\u3001\u5165\u529b\u8fba\u304c\u306a\u304f\u306a\u3063\u305f\u3089queue\u306b\u5165\u308c\u308b\n\n que.append(nv)\n\n # \u6700\u521d\u306b\u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u304b\u3063\u305f\u70b9\u304b\u3089\u306e\u8ddd\u96e2\n\n dp[nv] = chmax(dp[nv], dp[v] + 1)\n\n\n\n print((max(dp)))\n\n\n\nmain()\n","code_v0_loc":51,"code_v1_loc":49,"code_v0_num_chars":1107,"code_v1_num_chars":1068,"code_v0_no_empty_lines":"import sys\nimport collections\n\n# input\u51e6\u7406\u3092\u9ad8\u901f\u5316\u3059\u308b\ninput = sys.stdin.readline\n\n\ndef chmax(a, b):\n \"\"\"\u6700\u5927\u5024\u3092\u8fd4\u3059\u95a2\u6570\"\"\"\n if a >= b:\n return a\n else:\n return b\n\n\ndef main():\n # \u5165\u529b\n N, M = list(map(int, input().split()))\n # \u96a3\u63a5\u95a2\u4fc2\u306f\u96a3\u63a5\u30ea\u30b9\u30c8\u3067\u7ba1\u7406\u3059\u308b\n lst_edge = [[] for _ in range(N)]\n # \u5404\u9802\u70b9\u306e\u5165\u529b\u8fba\u306e\u672c\u6570\n deg = [0] * N\n for _ in range(M):\n x, y = list(map(int, input().split()))\n # \u6700\u521d\u306eindex\u3092\u30bc\u30ed\u306b\u3059\u308b\n lst_edge[x - 1].append(y - 1)\n deg[y - 1] += 1\n # \u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u3044\u9802\u70b9\u3092queue\u306b\u5165\u308c\u308b\n que = collections.deque()\n for v in range(N):\n if deg[v] == 0:\n que.append(v)\n # \u5404\u9802\u70b9\u306e\u6700\u521d\u306b\u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u304b\u3063\u305f\u70b9\u304b\u3089\u306e\u8ddd\u96e2\n dp = [0] * N\n while len(que) > 0:\n v = que.popleft()\n lst_nv = lst_edge[v]\n for nv in lst_nv:\n # \u30a8\u30c3\u30b8(v, nv)\u3092\u30b0\u30e9\u30d5\u304b\u3089\u524a\u9664\u3059\u308b\n deg[nv] -= 1\n if deg[nv] == 0:\n # \u30a8\u30c3\u30b8\u304c\u306a\u304f\u306a\u3063\u305f\u3053\u3068\u3067\u3001\u5165\u529b\u8fba\u304c\u306a\u304f\u306a\u3063\u305f\u3089queue\u306b\u5165\u308c\u308b\n que.append(nv)\n # \u6700\u521d\u306b\u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u304b\u3063\u305f\u70b9\u304b\u3089\u306e\u8ddd\u96e2\n dp[nv] = chmax(dp[nv], dp[v] + 1)\n print((max(dp)))\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\nimport collections\n\n# input\u51e6\u7406\u3092\u9ad8\u901f\u5316\u3059\u308b\ninput = sys.stdin.readline\n\n\ndef chmax(a, b):\n \"\"\"\u6700\u5927\u5024\u3092\u8fd4\u3059\u95a2\u6570\"\"\"\n if a >= b:\n return a\n return b\n\n\ndef main():\n # \u5165\u529b\n N, M = list(map(int, input().split()))\n # \u96a3\u63a5\u95a2\u4fc2\u306f\u96a3\u63a5\u30ea\u30b9\u30c8\u3067\u7ba1\u7406\u3059\u308b\n lst_edge = [[] for _ in range(N)]\n # \u5404\u9802\u70b9\u306e\u5165\u529b\u8fba\u306e\u672c\u6570\n deg = [0] * N\n for _ in range(M):\n x, y = list(map(int, input().split()))\n # \u6700\u521d\u306eindex\u3092\u30bc\u30ed\u306b\u3059\u308b\n lst_edge[x - 1].append(y - 1)\n deg[y - 1] += 1\n # \u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u3044\u9802\u70b9\u3092queue\u306b\u5165\u308c\u308b\n que = collections.deque()\n for v in range(N):\n if deg[v] == 0:\n que.append(v)\n # \u5404\u9802\u70b9\u306e\u6700\u521d\u306b\u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u304b\u3063\u305f\u70b9\u304b\u3089\u306e\u8ddd\u96e2\n dp = [0] * N\n while que:\n v = que.popleft()\n lst_nv = lst_edge[v]\n for nv in lst_nv:\n # \u30a8\u30c3\u30b8(v, nv)\u3092\u30b0\u30e9\u30d5\u304b\u3089\u524a\u9664\u3059\u308b\n deg[nv] -= 1\n if deg[nv] == 0:\n # \u30a8\u30c3\u30b8\u304c\u306a\u304f\u306a\u3063\u305f\u3053\u3068\u3067\u3001\u5165\u529b\u8fba\u304c\u306a\u304f\u306a\u3063\u305f\u3089queue\u306b\u5165\u308c\u308b\n que.append(nv)\n # \u6700\u521d\u306b\u5165\u529b\u8fba\u3092\u6301\u305f\u306a\u304b\u3063\u305f\u70b9\u304b\u3089\u306e\u8ddd\u96e2\n dp[nv] = chmax(dp[nv], dp[v] + 1)\n print((max(dp)))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":3.9215686275,"diff":["- else:","- return b","+ return b","- while len(que) > 0:","+ while que:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0366989124,"measured_runtime_v1":0.0359372437,"runtime_lift":1.0211944099,"key":["s772801182","s454435670"]} +{"user_id":"u891635666","problem_id":"p03001","language":"python","submission_id_v0":"s310051223","submission_id_v1":"s852022613","cpu_time_v0":175,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.29,"input":"w, h, x, y = list(map(int, input().split()))\n\n\n\narea = w * h \/ 2\n\nif 2 * x == w and 2 * y == h:\n\n print((area, 1))\n\nelse:\n\n print((area, 0))","target":"import sys\n\n\n\ninput = sys.stdin.readline\n\n\n\nri = lambda: int(eval(input()))\n\nrs = lambda: input().rstrip()\n\nril = lambda: list(map(int, input().split()))\n\nrsl = lambda: input().rstrip().split()\n\nris = lambda n: [ri() for _ in range(n)]\n\nrss = lambda n: [rs() for _ in range(n)]\n\nrils = lambda n: [ril() for _ in range(n)]\n\nrsls = lambda n: [rsl() for _ in range(n)]\n\n\n\nw, h, x, y = ril()\n\ns = w * h \/ 2\n\nif w == 2 * x and h == 2 * y:\n\n print((s, 1))\n\nelse:\n\n print((s, 0))","code_v0_loc":7,"code_v1_loc":19,"code_v0_num_chars":136,"code_v1_num_chars":468,"code_v0_no_empty_lines":"w, h, x, y = list(map(int, input().split()))\narea = w * h \/ 2\nif 2 * x == w and 2 * y == h:\n print((area, 1))\nelse:\n print((area, 0))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nri = lambda: int(eval(input()))\nrs = lambda: input().rstrip()\nril = lambda: list(map(int, input().split()))\nrsl = lambda: input().rstrip().split()\nris = lambda n: [ri() for _ in range(n)]\nrss = lambda n: [rs() for _ in range(n)]\nrils = lambda n: [ril() for _ in range(n)]\nrsls = lambda n: [rsl() for _ in range(n)]\nw, h, x, y = ril()\ns = w * h \/ 2\nif w == 2 * x and h == 2 * y:\n print((s, 1))\nelse:\n print((s, 0))\n","code_same":false,"relative_loc_diff_percent":63.1578947368,"diff":["-w, h, x, y = list(map(int, input().split()))","-area = w * h \/ 2","-if 2 * x == w and 2 * y == h:","- print((area, 1))","+import sys","+","+input = sys.stdin.readline","+ri = lambda: int(eval(input()))","+rs = lambda: input().rstrip()","+ril = lambda: list(map(int, input().split()))","+rsl = lambda: input().rstrip().split()","+ris = lambda n: [ri() for _ in range(n)]","+rss = lambda n: [rs() for _ in range(n)]","+rils = lambda n: [ril() for _ in range(n)]","+rsls = lambda n: [rsl() for _ in range(n)]","+w, h, x, y = ril()","+s = w * h \/ 2","+if w == 2 * x and h == 2 * y:","+ print((s, 1))","- print((area, 0))","+ print((s, 0))"],"diff_only_import_comment":false,"measured_runtime_v0":0.120801302,"measured_runtime_v1":0.0417125454,"runtime_lift":2.8960424463,"key":["s310051223","s852022613"]} +{"user_id":"u098012509","problem_id":"p03229","language":"python","submission_id_v0":"s343106717","submission_id_v1":"s821938854","cpu_time_v0":153,"cpu_time_v1":73,"memory_v0":13968,"memory_v1":13716,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.29,"input":"import sys\n\nimport collections\n\n\n\nsys.setrecursionlimit(10 ** 8)\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = [int(eval(input())) for _ in range(N)]\n\n\n\n if N == 2:\n\n print((abs(A[0] - A[1])))\n\n return\n\n\n\n A.sort()\n\n\n\n q = collections.deque(A)\n\n\n\n ans = 0\n\n i = 0\n\n c = [q.popleft(), q.pop()]\n\n ans += abs(c[0] - c[1])\n\n while q:\n\n if len(q) >= 2:\n\n a = q.popleft()\n\n b = q.pop()\n\n al = abs(a - c[0])\n\n ar = abs(a - c[1])\n\n bl = abs(b - c[0])\n\n br = abs(b - c[1])\n\n ma = max([al, ar, bl, br])\n\n ans += ma\n\n if ma == al:\n\n c[0] = a\n\n q.append(b)\n\n elif ma == ar:\n\n c[1] = a\n\n q.append(b)\n\n elif ma == bl:\n\n c[0] = b\n\n q.appendleft(a)\n\n else:\n\n c[1] = b\n\n q.appendleft(a)\n\n else:\n\n a = q.pop()\n\n ans += max(abs(c[0] - a), abs(c[1] - a))\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nimport collections\n\n\n\nsys.setrecursionlimit(10 ** 8)\n\n\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = [int(eval(input())) for _ in range(N)]\n\n\n\n A.sort()\n\n\n\n if N % 2 == 0:\n\n ans = sum(A[N \/\/ 2:]) * 2 - A[N \/\/ 2] - sum(A[:N \/\/ 2]) * 2 + A[N \/\/ 2 - 1]\n\n else:\n\n ans = sum(A[N \/\/ 2:]) * 2 - A[N \/\/ 2] - A[N \/\/ 2 + 1] - sum(A[:N \/\/ 2]) * 2\n\n ans = max(ans, sum(A[N \/\/ 2 + 1:]) * 2 - sum(A[:N \/\/ 2 + 1]) * 2 + A[N \/\/ 2] + A[N \/\/ 2 - 1])\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":55,"code_v1_loc":24,"code_v0_num_chars":1147,"code_v1_num_chars":558,"code_v0_no_empty_lines":"import sys\nimport collections\n\nsys.setrecursionlimit(10**8)\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(eval(input()))\n A = [int(eval(input())) for _ in range(N)]\n if N == 2:\n print((abs(A[0] - A[1])))\n return\n A.sort()\n q = collections.deque(A)\n ans = 0\n i = 0\n c = [q.popleft(), q.pop()]\n ans += abs(c[0] - c[1])\n while q:\n if len(q) >= 2:\n a = q.popleft()\n b = q.pop()\n al = abs(a - c[0])\n ar = abs(a - c[1])\n bl = abs(b - c[0])\n br = abs(b - c[1])\n ma = max([al, ar, bl, br])\n ans += ma\n if ma == al:\n c[0] = a\n q.append(b)\n elif ma == ar:\n c[1] = a\n q.append(b)\n elif ma == bl:\n c[0] = b\n q.appendleft(a)\n else:\n c[1] = b\n q.appendleft(a)\n else:\n a = q.pop()\n ans += max(abs(c[0] - a), abs(c[1] - a))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport collections\n\nsys.setrecursionlimit(10**8)\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(eval(input()))\n A = [int(eval(input())) for _ in range(N)]\n A.sort()\n if N % 2 == 0:\n ans = sum(A[N \/\/ 2 :]) * 2 - A[N \/\/ 2] - sum(A[: N \/\/ 2]) * 2 + A[N \/\/ 2 - 1]\n else:\n ans = sum(A[N \/\/ 2 :]) * 2 - A[N \/\/ 2] - A[N \/\/ 2 + 1] - sum(A[: N \/\/ 2]) * 2\n ans = max(\n ans,\n sum(A[N \/\/ 2 + 1 :]) * 2\n - sum(A[: N \/\/ 2 + 1]) * 2\n + A[N \/\/ 2]\n + A[N \/\/ 2 - 1],\n )\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":56.3636363636,"diff":["- if N == 2:","- print((abs(A[0] - A[1])))","- return","- q = collections.deque(A)","- ans = 0","- i = 0","- c = [q.popleft(), q.pop()]","- ans += abs(c[0] - c[1])","- while q:","- if len(q) >= 2:","- a = q.popleft()","- b = q.pop()","- al = abs(a - c[0])","- ar = abs(a - c[1])","- bl = abs(b - c[0])","- br = abs(b - c[1])","- ma = max([al, ar, bl, br])","- ans += ma","- if ma == al:","- c[0] = a","- q.append(b)","- elif ma == ar:","- c[1] = a","- q.append(b)","- elif ma == bl:","- c[0] = b","- q.appendleft(a)","- else:","- c[1] = b","- q.appendleft(a)","- else:","- a = q.pop()","- ans += max(abs(c[0] - a), abs(c[1] - a))","+ if N % 2 == 0:","+ ans = sum(A[N \/\/ 2 :]) * 2 - A[N \/\/ 2] - sum(A[: N \/\/ 2]) * 2 + A[N \/\/ 2 - 1]","+ else:","+ ans = sum(A[N \/\/ 2 :]) * 2 - A[N \/\/ 2] - A[N \/\/ 2 + 1] - sum(A[: N \/\/ 2]) * 2","+ ans = max(","+ ans,","+ sum(A[N \/\/ 2 + 1 :]) * 2","+ - sum(A[: N \/\/ 2 + 1]) * 2","+ + A[N \/\/ 2]","+ + A[N \/\/ 2 - 1],","+ )"],"diff_only_import_comment":false,"measured_runtime_v0":0.0441878366,"measured_runtime_v1":0.0371851692,"runtime_lift":1.1883188261,"key":["s343106717","s821938854"]} +{"user_id":"u766684188","problem_id":"p03033","language":"python","submission_id_v0":"s787919075","submission_id_v1":"s277585232","cpu_time_v0":1370,"cpu_time_v1":1240,"memory_v0":127324,"memory_v1":110684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.49,"input":"import sys\n\ninput=sys.stdin.readline\n\nfrom bisect import bisect_left\n\nclass SegmentTree():\n\n def __init__(self,size,func,default):\n\n self.leaf=2**(size-1).bit_length()\n\n self.data=[default]*(2*self.leaf-1)\n\n self.f=func; self.d=default\n\n def rangeupdate(self,l,r,x):\n\n l+=self.leaf-1; r+=self.leaf-1\n\n while l>=1; r>>=1\n\n def getvalue(self,i):\n\n k=i+self.leaf-1\n\n ret=self.d\n\n while k>=0:\n\n ret=self.f(ret,self.data[k])\n\n k=(k-1)>>1\n\n return ret\n\n\n\nn,q=list(map(int,input().split()))\n\nseg=SegmentTree(q,min,float('inf'))\n\nSTX=[list(map(int,input().split())) for _ in range(n)]\n\nD=[int(eval(input())) for _ in range(q)]\n\nfor s,t,x in STX:\n\n seg.rangeupdate(bisect_left(D,s-x),bisect_left(D,t-x),x)\n\nfor i in range(q):\n\n print((-1 if seg.getvalue(i)==float('inf') else seg.getvalue(i)))","target":"import sys\n\ninput=sys.stdin.readline\n\nfrom bisect import bisect_left\n\nn,q=map(int,input().split())\n\nSTX=[tuple(map(int,input().split())) for _ in range(n)]\n\nSTX.sort(key=lambda x: x[2])\n\nD=[int(input()) for _ in range(q)]\n\nAns=[-1]*q; Jump=[-1]*q\n\nfor s,t,x in STX:\n\n l=bisect_left(D,s-x)\n\n r=bisect_left(D,t-x)\n\n while l>= 1\n r >>= 1\n\n def getvalue(self, i):\n k = i + self.leaf - 1\n ret = self.d\n while k >= 0:\n ret = self.f(ret, self.data[k])\n k = (k - 1) >> 1\n return ret\n\n\nn, q = list(map(int, input().split()))\nseg = SegmentTree(q, min, float(\"inf\"))\nSTX = [list(map(int, input().split())) for _ in range(n)]\nD = [int(eval(input())) for _ in range(q)]\nfor s, t, x in STX:\n seg.rangeupdate(bisect_left(D, s - x), bisect_left(D, t - x), x)\nfor i in range(q):\n print((-1 if seg.getvalue(i) == float(\"inf\") else seg.getvalue(i)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom bisect import bisect_left\n\nn, q = map(int, input().split())\nSTX = [tuple(map(int, input().split())) for _ in range(n)]\nSTX.sort(key=lambda x: x[2])\nD = [int(input()) for _ in range(q)]\nAns = [-1] * q\nJump = [-1] * q\nfor s, t, x in STX:\n l = bisect_left(D, s - x)\n r = bisect_left(D, t - x)\n while l < r:\n s = Jump[l]\n if s == -1:\n Ans[l] = x\n Jump[l] = r\n l += 1\n else:\n l = s\nprint(*Ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":41.1764705882,"diff":["-","-class SegmentTree:","- def __init__(self, size, func, default):","- self.leaf = 2 ** (size - 1).bit_length()","- self.data = [default] * (2 * self.leaf - 1)","- self.f = func","- self.d = default","-","- def rangeupdate(self, l, r, x):","- l += self.leaf - 1","- r += self.leaf - 1","- while l < r:","- if not l & 1:","- self.data[l] = self.f(self.data[l], x)","- l += 1","- if not r & 1:","- r -= 1","- self.data[r] = self.f(self.data[r], x)","- l >>= 1","- r >>= 1","-","- def getvalue(self, i):","- k = i + self.leaf - 1","- ret = self.d","- while k >= 0:","- ret = self.f(ret, self.data[k])","- k = (k - 1) >> 1","- return ret","-","-","-n, q = list(map(int, input().split()))","-seg = SegmentTree(q, min, float(\"inf\"))","-STX = [list(map(int, input().split())) for _ in range(n)]","-D = [int(eval(input())) for _ in range(q)]","+n, q = map(int, input().split())","+STX = [tuple(map(int, input().split())) for _ in range(n)]","+STX.sort(key=lambda x: x[2])","+D = [int(input()) for _ in range(q)]","+Ans = [-1] * q","+Jump = [-1] * q","- seg.rangeupdate(bisect_left(D, s - x), bisect_left(D, t - x), x)","-for i in range(q):","- print((-1 if seg.getvalue(i) == float(\"inf\") else seg.getvalue(i)))","+ l = bisect_left(D, s - x)","+ r = bisect_left(D, t - x)","+ while l < r:","+ s = Jump[l]","+ if s == -1:","+ Ans[l] = x","+ Jump[l] = r","+ l += 1","+ else:","+ l = s","+print(*Ans, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0427777925,"measured_runtime_v1":0.0427438135,"runtime_lift":1.0007949438,"key":["s787919075","s277585232"]} +{"user_id":"u280552586","problem_id":"p02899","language":"python","submission_id_v0":"s538736872","submission_id_v1":"s366231687","cpu_time_v0":229,"cpu_time_v1":99,"memory_v0":25564,"memory_v1":13880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.77,"input":"n = int(input())\n\nls = list(map(int, input().split()))\n\nmenber = list(range(1, n+1))\n\n\n\ndict1 = dict(zip(ls, menber))\n\ndict1 = sorted(dict1.items(), key=lambda x: x[0])\n\n\n\nfor i in range(len(dict1)):\n\n print(dict1[i][1], end=' ')\n","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\nans = [0]*n\n\n\n\nfor i, item in enumerate(a):\n\n ans[item-1] = i+1\n\n\n\nprint((*ans))\n","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":233,"code_v1_num_chars":139,"code_v0_no_empty_lines":"n = int(input())\nls = list(map(int, input().split()))\nmenber = list(range(1, n + 1))\ndict1 = dict(zip(ls, menber))\ndict1 = sorted(dict1.items(), key=lambda x: x[0])\nfor i in range(len(dict1)):\n print(dict1[i][1], end=\" \")\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nans = [0] * n\nfor i, item in enumerate(a):\n ans[item - 1] = i + 1\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-n = int(input())","-ls = list(map(int, input().split()))","-menber = list(range(1, n + 1))","-dict1 = dict(zip(ls, menber))","-dict1 = sorted(dict1.items(), key=lambda x: x[0])","-for i in range(len(dict1)):","- print(dict1[i][1], end=\" \")","+n = int(eval(input()))","+a = list(map(int, input().split()))","+ans = [0] * n","+for i, item in enumerate(a):","+ ans[item - 1] = i + 1","+print((*ans))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0367414248,"measured_runtime_v1":0.0365265956,"runtime_lift":1.0058814457,"key":["s538736872","s366231687"]} +{"user_id":"u787456042","problem_id":"p04020","language":"python","submission_id_v0":"s273767501","submission_id_v1":"s730471833","cpu_time_v0":111,"cpu_time_v1":90,"memory_v0":7840,"memory_v1":7072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.92,"input":"N,*A=list(map(int,open(0)));p=f=0\n\nfor a,b in zip(A,A[1:]):d,m=divmod(a-f,2);f=min(m,b);p+=d+f\n\nprint((p+(A[-1]-f)\/\/2))","target":"N,*A=list(map(int,open(0)));p=f=0\n\nfor a in A:d,m=divmod(a+f,2);p+=d;f=m&(a>0)\n\nprint(p)","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":111,"code_v1_num_chars":82,"code_v0_no_empty_lines":"N, *A = list(map(int, open(0)))\np = f = 0\nfor a, b in zip(A, A[1:]):\n d, m = divmod(a - f, 2)\n f = min(m, b)\n p += d + f\nprint((p + (A[-1] - f) \/\/ 2))\n","code_v1_no_empty_lines":"N, *A = list(map(int, open(0)))\np = f = 0\nfor a in A:\n d, m = divmod(a + f, 2)\n p += d\n f = m & (a > 0)\nprint(p)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for a, b in zip(A, A[1:]):","- d, m = divmod(a - f, 2)","- f = min(m, b)","- p += d + f","-print((p + (A[-1] - f) \/\/ 2))","+for a in A:","+ d, m = divmod(a + f, 2)","+ p += d","+ f = m & (a > 0)","+print(p)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0396353997,"measured_runtime_v1":0.0381547489,"runtime_lift":1.0388064599,"key":["s273767501","s730471833"]} +{"user_id":"u412177362","problem_id":"p02617","language":"python","submission_id_v0":"s890074408","submission_id_v1":"s812636363","cpu_time_v0":678,"cpu_time_v1":264,"memory_v0":37568,"memory_v1":97932,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.06,"input":"n = int(eval(input()))\n\nd = [0] * n\n\npresent = [[] for i in range(n)]\n\nfor i in range(n - 1):\n\n u, v = list(map(int, input().split()))\n\n u -= 1\n\n v -= 1\n\n if u > v:\n\n u, v = v, u\n\n d[v] += 1\n\n present[u].append(v)\n\nans = 0\n\ncur = 0\n\nfor v in range(n):\n\n cur += (n - v) * d[v]\n\nfor l in range(n):\n\n ans += (l + 1) * (l + 2) \/\/ 2\n\n ans -= cur\n\n for v in present[l]:\n\n cur -= (n - v)\n\nprint(ans)\n","target":"import sys\n\n\n\n\n\ndef read():\n\n return sys.stdin.readline()\n\n\n\n\n\ndef main():\n\n n = int(read())\n\n d = [0] * n\n\n present = [[] for i in range(n)]\n\n for i in range(n - 1):\n\n u, v = sorted([int(x) - 1 for x in read().split()])\n\n d[v] += 1\n\n present[u].append(v)\n\n ans, cur = 0, 0\n\n for v in range(n):\n\n cur += (n - v) * d[v]\n\n for L in range(n):\n\n ans += (L + 1) * (L + 2) \/\/ 2 - cur\n\n for v in present[L]:\n\n cur -= (n - v)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":21,"code_v1_loc":27,"code_v0_num_chars":425,"code_v1_num_chars":560,"code_v0_no_empty_lines":"n = int(eval(input()))\nd = [0] * n\npresent = [[] for i in range(n)]\nfor i in range(n - 1):\n u, v = list(map(int, input().split()))\n u -= 1\n v -= 1\n if u > v:\n u, v = v, u\n d[v] += 1\n present[u].append(v)\nans = 0\ncur = 0\nfor v in range(n):\n cur += (n - v) * d[v]\nfor l in range(n):\n ans += (l + 1) * (l + 2) \/\/ 2\n ans -= cur\n for v in present[l]:\n cur -= n - v\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\n\ndef read():\n return sys.stdin.readline()\n\n\ndef main():\n n = int(read())\n d = [0] * n\n present = [[] for i in range(n)]\n for i in range(n - 1):\n u, v = sorted([int(x) - 1 for x in read().split()])\n d[v] += 1\n present[u].append(v)\n ans, cur = 0, 0\n for v in range(n):\n cur += (n - v) * d[v]\n for L in range(n):\n ans += (L + 1) * (L + 2) \/\/ 2 - cur\n for v in present[L]:\n cur -= n - v\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-n = int(eval(input()))","-d = [0] * n","-present = [[] for i in range(n)]","-for i in range(n - 1):","- u, v = list(map(int, input().split()))","- u -= 1","- v -= 1","- if u > v:","- u, v = v, u","- d[v] += 1","- present[u].append(v)","-ans = 0","-cur = 0","-for v in range(n):","- cur += (n - v) * d[v]","-for l in range(n):","- ans += (l + 1) * (l + 2) \/\/ 2","- ans -= cur","- for v in present[l]:","- cur -= n - v","-print(ans)","+import sys","+","+","+def read():","+ return sys.stdin.readline()","+","+","+def main():","+ n = int(read())","+ d = [0] * n","+ present = [[] for i in range(n)]","+ for i in range(n - 1):","+ u, v = sorted([int(x) - 1 for x in read().split()])","+ d[v] += 1","+ present[u].append(v)","+ ans, cur = 0, 0","+ for v in range(n):","+ cur += (n - v) * d[v]","+ for L in range(n):","+ ans += (L + 1) * (L + 2) \/\/ 2 - cur","+ for v in present[L]:","+ cur -= n - v","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0403822634,"measured_runtime_v1":0.0375034082,"runtime_lift":1.0767624959,"key":["s890074408","s812636363"]} +{"user_id":"u359358631","problem_id":"p03030","language":"python","submission_id_v0":"s512729788","submission_id_v1":"s394531658","cpu_time_v0":75,"cpu_time_v1":64,"memory_v0":62760,"memory_v1":62772,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.67,"input":"def main():\n\n N = int(eval(input()))\n\n sp_lst = [0 for _ in range(N)]\n\n\n\n for i in range(N):\n\n S, P = input().split()\n\n sp_lst[i] = [i + 1, S, int(P)]\n\n\n\n sp_lst.sort(key=lambda x: x[2], reverse=True)\n\n sp_lst.sort(key=lambda x: x[1])\n\n\n\n for i, _, _ in sp_lst:\n\n print(i)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"def main():\n\n N = int(eval(input()))\n\n s_dict = dict()\n\n\n\n for i in range(1, N + 1):\n\n S, P = input().split()\n\n if S in s_dict:\n\n s_dict[S].append((i, int(P)))\n\n else:\n\n s_dict[S] = [(i, int(P))]\n\n\n\n s_dict_keys = sorted(list(s_dict.keys()))\n\n\n\n for key in s_dict_keys:\n\n s_dict[key].sort(key=lambda x: x[1], reverse=True)\n\n for i, _ in s_dict[key]:\n\n print(i)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":17,"code_v1_loc":21,"code_v0_num_chars":350,"code_v1_num_chars":482,"code_v0_no_empty_lines":"def main():\n N = int(eval(input()))\n sp_lst = [0 for _ in range(N)]\n for i in range(N):\n S, P = input().split()\n sp_lst[i] = [i + 1, S, int(P)]\n sp_lst.sort(key=lambda x: x[2], reverse=True)\n sp_lst.sort(key=lambda x: x[1])\n for i, _, _ in sp_lst:\n print(i)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n s_dict = dict()\n for i in range(1, N + 1):\n S, P = input().split()\n if S in s_dict:\n s_dict[S].append((i, int(P)))\n else:\n s_dict[S] = [(i, int(P))]\n s_dict_keys = sorted(list(s_dict.keys()))\n for key in s_dict_keys:\n s_dict[key].sort(key=lambda x: x[1], reverse=True)\n for i, _ in s_dict[key]:\n print(i)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":19.0476190476,"diff":["- sp_lst = [0 for _ in range(N)]","- for i in range(N):","+ s_dict = dict()","+ for i in range(1, N + 1):","- sp_lst[i] = [i + 1, S, int(P)]","- sp_lst.sort(key=lambda x: x[2], reverse=True)","- sp_lst.sort(key=lambda x: x[1])","- for i, _, _ in sp_lst:","- print(i)","+ if S in s_dict:","+ s_dict[S].append((i, int(P)))","+ else:","+ s_dict[S] = [(i, int(P))]","+ s_dict_keys = sorted(list(s_dict.keys()))","+ for key in s_dict_keys:","+ s_dict[key].sort(key=lambda x: x[1], reverse=True)","+ for i, _ in s_dict[key]:","+ print(i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0360180552,"measured_runtime_v1":0.0327791518,"runtime_lift":1.0988098611,"key":["s512729788","s394531658"]} +{"user_id":"u729133443","problem_id":"p02614","language":"python","submission_id_v0":"s943140481","submission_id_v1":"s831116055","cpu_time_v0":86,"cpu_time_v1":78,"memory_v0":74284,"memory_v1":9076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.3,"input":"h,*c=open(0)\n\nh,w,k=list(map(int,h.split()))\n\nprint((sum(k==sum(y>>w+z\/\/w&y>>z%w&1and'.'>c[z\/\/w][z%w]for z in range(h*w))for y in range(1<>w+z\/\/w&y>>z%w&('.'>c[z\/\/w][z%w])for z in range(h*w))for y in range(1<> w + z \/\/ w & y >> z % w & 1 and \".\" > c[z \/\/ w][z % w]\n for z in range(h * w)\n )\n for y in range(1 << h + w)\n )\n )\n)\n","code_v1_no_empty_lines":"h, *c = open(0)\nh, w, k = list(map(int, h.split()))\nprint(\n (\n sum(\n k\n == sum(\n y >> w + z \/\/ w & y >> z % w & (\".\" > c[z \/\/ w][z % w])\n for z in range(h * w)\n )\n for y in range(1 << h + w)\n )\n )\n)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- y >> w + z \/\/ w & y >> z % w & 1 and \".\" > c[z \/\/ w][z % w]","+ y >> w + z \/\/ w & y >> z % w & (\".\" > c[z \/\/ w][z % w])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0426076174,"measured_runtime_v1":0.040907383,"runtime_lift":1.0415630206,"key":["s943140481","s831116055"]} +{"user_id":"u046187684","problem_id":"p02820","language":"python","submission_id_v0":"s362765646","submission_id_v1":"s759846784","cpu_time_v0":88,"cpu_time_v1":70,"memory_v0":4980,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.45,"input":"def solve(string):\n\n *nkrsp, t = string.split()\n\n *t, = list(map(int, t.replace(\"r\", \"2\").replace(\"s\", \"0\").replace(\"p\", \"1\")))\n\n n, k, *rsp = list(map(int, nkrsp))\n\n ans = 0\n\n for s in range(k):\n\n u = t[s::k]\n\n i = 0\n\n while i < len(u):\n\n c = 1\n\n while i < len(u) - 1 and u[i] == u[i + 1]:\n\n i += 1\n\n c += 1\n\n ans += (c + 1) \/\/ 2 * rsp[u[i]]\n\n i += 1\n\n return str(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","target":"def solve(string):\n\n *nkrsp, t = string.split()\n\n n, k, *rsp = list(map(int, nkrsp))\n\n table = {k: v for k, v in zip(\"spr\", rsp)}\n\n ans = 0\n\n for s in range(k):\n\n u = t[s::k]\n\n i = 0\n\n while i < len(u):\n\n c = 1\n\n while i < len(u) - 1 and u[i] == u[i + 1]:\n\n i += 1\n\n c += 1\n\n ans += (c + 1) \/\/ 2 * table[u[i]]\n\n i += 1\n\n return str(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":563,"code_v1_num_chars":536,"code_v0_no_empty_lines":"def solve(string):\n *nkrsp, t = string.split()\n (*t,) = list(map(int, t.replace(\"r\", \"2\").replace(\"s\", \"0\").replace(\"p\", \"1\")))\n n, k, *rsp = list(map(int, nkrsp))\n ans = 0\n for s in range(k):\n u = t[s::k]\n i = 0\n while i < len(u):\n c = 1\n while i < len(u) - 1 and u[i] == u[i + 1]:\n i += 1\n c += 1\n ans += (c + 1) \/\/ 2 * rsp[u[i]]\n i += 1\n return str(ans)\n\n\nif __name__ == \"__main__\":\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","code_v1_no_empty_lines":"def solve(string):\n *nkrsp, t = string.split()\n n, k, *rsp = list(map(int, nkrsp))\n table = {k: v for k, v in zip(\"spr\", rsp)}\n ans = 0\n for s in range(k):\n u = t[s::k]\n i = 0\n while i < len(u):\n c = 1\n while i < len(u) - 1 and u[i] == u[i + 1]:\n i += 1\n c += 1\n ans += (c + 1) \/\/ 2 * table[u[i]]\n i += 1\n return str(ans)\n\n\nif __name__ == \"__main__\":\n import sys\n\n print((solve(sys.stdin.read().strip())))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- (*t,) = list(map(int, t.replace(\"r\", \"2\").replace(\"s\", \"0\").replace(\"p\", \"1\")))","+ table = {k: v for k, v in zip(\"spr\", rsp)}","- ans += (c + 1) \/\/ 2 * rsp[u[i]]","+ ans += (c + 1) \/\/ 2 * table[u[i]]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0829008543,"measured_runtime_v1":0.0381894979,"runtime_lift":2.1707762286,"key":["s362765646","s759846784"]} +{"user_id":"u583276018","problem_id":"p03160","language":"python","submission_id_v0":"s333771313","submission_id_v1":"s711347298","cpu_time_v0":182,"cpu_time_v1":129,"memory_v0":13928,"memory_v1":13980,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.12,"input":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\ndp = [1e9]*n\n\ndp[0] = 0\n\nfor i in range(1, n):\n\n dp[i] = min(dp[i], dp[i-1] + abs(a[i] - a[i-1]))\n\n if i > 1:\n\n dp[i] = min(dp[i], dp[i-2] + abs(a[i] - a[i-2]))\n\nprint((dp[n-1]))\n","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\ndp = [1e9 for _ in range(n)]\n\n#dp[i]...\u30b3\u30b9\u30c8\u306e\u6700\u5c0f\n\ndp[0] = 0\n\ndp[1] = abs(a[1] - a[0])\n\nfor i in range(n-2):\n\n dp[i+2] = min(dp[i+1] + abs(a[i+2] - a[i+1]), dp[i] + abs(a[i+2] - a[i]))\n\nprint((dp[n-1]))\n","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":237,"code_v1_num_chars":253,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\ndp = [1e9] * n\ndp[0] = 0\nfor i in range(1, n):\n dp[i] = min(dp[i], dp[i - 1] + abs(a[i] - a[i - 1]))\n if i > 1:\n dp[i] = min(dp[i], dp[i - 2] + abs(a[i] - a[i - 2]))\nprint((dp[n - 1]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\ndp = [1e9 for _ in range(n)]\n# dp[i]...\u30b3\u30b9\u30c8\u306e\u6700\u5c0f\ndp[0] = 0\ndp[1] = abs(a[1] - a[0])\nfor i in range(n - 2):\n dp[i + 2] = min(dp[i + 1] + abs(a[i + 2] - a[i + 1]), dp[i] + abs(a[i + 2] - a[i]))\nprint((dp[n - 1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-dp = [1e9] * n","+dp = [1e9 for _ in range(n)]","+# dp[i]...\u30b3\u30b9\u30c8\u306e\u6700\u5c0f","-for i in range(1, n):","- dp[i] = min(dp[i], dp[i - 1] + abs(a[i] - a[i - 1]))","- if i > 1:","- dp[i] = min(dp[i], dp[i - 2] + abs(a[i] - a[i - 2]))","+dp[1] = abs(a[1] - a[0])","+for i in range(n - 2):","+ dp[i + 2] = min(dp[i + 1] + abs(a[i + 2] - a[i + 1]), dp[i] + abs(a[i + 2] - a[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0890294425,"measured_runtime_v1":0.0371160614,"runtime_lift":2.3986769891,"key":["s333771313","s711347298"]} +{"user_id":"u620868411","problem_id":"p03436","language":"python","submission_id_v0":"s432095887","submission_id_v1":"s808760844","cpu_time_v0":129,"cpu_time_v1":54,"memory_v0":3064,"memory_v1":4080,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.14,"input":"# -*- coding: utf-8 -*-\n\nh,w = list(map(int, input().split()))\n\ninf = 10**6\n\nfield = []\n\nd = []\n\nres = 0\n\nfor _ in range(h):\n\n line = list(eval(input()))\n\n field.append(line)\n\n d.append([inf]*w)\n\n for s in line:\n\n if s==\".\":\n\n res += 1\n\n\n\nd[0][0] = 0\n\ndiff = [\n\n [1,0]\n\n ,[0,1]\n\n ,[-1,0]\n\n ,[0,-1]\n\n]\n\n\n\nflag = True\n\nwhile flag:\n\n flag = False\n\n for hi in range(h):\n\n for wi in range(w):\n\n if d[hi][wi]hi+dh>=0 and w>wi+dw>=0 and field[hi+dh][wi+dw]==\".\" and d[hi+dh][wi+dw]>d[hi][wi]+1:\n\n d[hi+dh][wi+dw] = d[hi][wi]+1\n\n flag = True\n\n\n\nif d[h-1][w-1]dh+hi>=0 and w>dw+wi>=0 and d[dh+hi][dw+wi]==\".\":\n\n if cost[dh+hi][dw+wi]==0 or cost[dh+hi][dw+wi]>cost[hi][wi]+1:\n\n cost[dh+hi][dw+wi] = cost[hi][wi]+1\n\n q.put((dh+hi, dw+wi))\n\n\n\nif cost[h-1][w-1]==0:\n\n print((-1))\n\n exit()\n\n\n\nres = 0\n\nfor hi in range(h):\n\n for wi in range(w):\n\n if (hi==0 and wi==0) or (hi==h-1 and wi==-1):\n\n continue\n\n if d[hi][wi]==\".\":\n\n res += 1\n\n\n\nprint((res - cost[h-1][w-1]))\n","code_v0_loc":37,"code_v1_loc":34,"code_v0_num_chars":779,"code_v1_num_chars":831,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nh, w = list(map(int, input().split()))\ninf = 10**6\nfield = []\nd = []\nres = 0\nfor _ in range(h):\n line = list(eval(input()))\n field.append(line)\n d.append([inf] * w)\n for s in line:\n if s == \".\":\n res += 1\nd[0][0] = 0\ndiff = [[1, 0], [0, 1], [-1, 0], [0, -1]]\nflag = True\nwhile flag:\n flag = False\n for hi in range(h):\n for wi in range(w):\n if d[hi][wi] < inf:\n for (dh, dw) in diff:\n if (\n h > hi + dh >= 0\n and w > wi + dw >= 0\n and field[hi + dh][wi + dw] == \".\"\n and d[hi + dh][wi + dw] > d[hi][wi] + 1\n ):\n d[hi + dh][wi + dw] = d[hi][wi] + 1\n flag = True\nif d[h - 1][w - 1] < inf:\n print((res - d[h - 1][w - 1] - 1))\nelse:\n print((-1))\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nfrom queue import Queue\n\nh, w = list(map(int, input().split()))\nd = []\nfor _ in range(h):\n d.append(eval(input()))\ncost = [[0] * w for _ in range(h)]\nq = Queue()\nq.put((0, 0))\nwhile not q.empty():\n hi, wi = q.get()\n if hi == h - 1 and wi == w - 1:\n break\n for dh, dw in [[0, 1], [1, 0], [0, -1], [-1, 0]]:\n if h > dh + hi >= 0 and w > dw + wi >= 0 and d[dh + hi][dw + wi] == \".\":\n if cost[dh + hi][dw + wi] == 0 or cost[dh + hi][dw + wi] > cost[hi][wi] + 1:\n cost[dh + hi][dw + wi] = cost[hi][wi] + 1\n q.put((dh + hi, dw + wi))\nif cost[h - 1][w - 1] == 0:\n print((-1))\n exit()\nres = 0\nfor hi in range(h):\n for wi in range(w):\n if (hi == 0 and wi == 0) or (hi == h - 1 and wi == -1):\n continue\n if d[hi][wi] == \".\":\n res += 1\nprint((res - cost[h - 1][w - 1]))\n","code_same":false,"relative_loc_diff_percent":8.1081081081,"diff":["+from queue import Queue","+","-inf = 10**6","-field = []","+for _ in range(h):","+ d.append(eval(input()))","+cost = [[0] * w for _ in range(h)]","+q = Queue()","+q.put((0, 0))","+while not q.empty():","+ hi, wi = q.get()","+ if hi == h - 1 and wi == w - 1:","+ break","+ for dh, dw in [[0, 1], [1, 0], [0, -1], [-1, 0]]:","+ if h > dh + hi >= 0 and w > dw + wi >= 0 and d[dh + hi][dw + wi] == \".\":","+ if cost[dh + hi][dw + wi] == 0 or cost[dh + hi][dw + wi] > cost[hi][wi] + 1:","+ cost[dh + hi][dw + wi] = cost[hi][wi] + 1","+ q.put((dh + hi, dw + wi))","+if cost[h - 1][w - 1] == 0:","+ print((-1))","+ exit()","-for _ in range(h):","- line = list(eval(input()))","- field.append(line)","- d.append([inf] * w)","- for s in line:","- if s == \".\":","+for hi in range(h):","+ for wi in range(w):","+ if (hi == 0 and wi == 0) or (hi == h - 1 and wi == -1):","+ continue","+ if d[hi][wi] == \".\":","-d[0][0] = 0","-diff = [[1, 0], [0, 1], [-1, 0], [0, -1]]","-flag = True","-while flag:","- flag = False","- for hi in range(h):","- for wi in range(w):","- if d[hi][wi] < inf:","- for (dh, dw) in diff:","- if (","- h > hi + dh >= 0","- and w > wi + dw >= 0","- and field[hi + dh][wi + dw] == \".\"","- and d[hi + dh][wi + dw] > d[hi][wi] + 1","- ):","- d[hi + dh][wi + dw] = d[hi][wi] + 1","- flag = True","-if d[h - 1][w - 1] < inf:","- print((res - d[h - 1][w - 1] - 1))","-else:","- print((-1))","+print((res - cost[h - 1][w - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0383534257,"measured_runtime_v1":0.0388779788,"runtime_lift":0.9865077073,"key":["s432095887","s808760844"]} +{"user_id":"u714878632","problem_id":"p03588","language":"python","submission_id_v0":"s287381679","submission_id_v1":"s080913145","cpu_time_v0":338,"cpu_time_v1":210,"memory_v0":21172,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.87,"input":"def main():\n\n n = int(eval(input()))\n\n ab = [] # type:[[int]] \n\n for i in range(n):\n\n ab.append([int(x) for x in input().split()])\n\n a, b = max(ab, key=lambda x: x[0])\n\n print((a + b))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"def main():\n\n n = int(eval(input()))\n\n max_a, max_b = 0, 0 # type:int\n\n for _ in range(n):\n\n a, b = input().split()\n\n a = int(a)\n\n if max_a < a:\n\n max_a = a\n\n max_b = int(b)\n\n print((max_a + max_b))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":242,"code_v1_num_chars":289,"code_v0_no_empty_lines":"def main():\n n = int(eval(input()))\n ab = [] # type:[[int]]\n for i in range(n):\n ab.append([int(x) for x in input().split()])\n a, b = max(ab, key=lambda x: x[0])\n print((a + b))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n max_a, max_b = 0, 0 # type:int\n for _ in range(n):\n a, b = input().split()\n a = int(a)\n if max_a < a:\n max_a = a\n max_b = int(b)\n print((max_a + max_b))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["- ab = [] # type:[[int]]","- for i in range(n):","- ab.append([int(x) for x in input().split()])","- a, b = max(ab, key=lambda x: x[0])","- print((a + b))","+ max_a, max_b = 0, 0 # type:int","+ for _ in range(n):","+ a, b = input().split()","+ a = int(a)","+ if max_a < a:","+ max_a = a","+ max_b = int(b)","+ print((max_a + max_b))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0364806399,"measured_runtime_v1":0.0420495205,"runtime_lift":0.8675637557,"key":["s287381679","s080913145"]} +{"user_id":"u150984829","problem_id":"p02235","language":"python","submission_id_v0":"s136375738","submission_id_v1":"s935009371","cpu_time_v0":3470,"cpu_time_v1":2360,"memory_v0":5612,"memory_v1":5616,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.99,"input":"for _ in[0]*int(eval(input())):\n\n X,z=eval(input()),[]\n\n for y in eval(input()):\n\n s=i=0\n\n for k in z:\n\n t=X.find(y,s)+1\n\n if t<1:break\n\n z[i]=min(t,k)\n\n s=k;i+=1\n\n else:\n\n t=X.find(y,s)+1\n\n if t:z+=[t]\n\n print((len(z)))\n","target":"for _ in[0]*int(eval(input())):\n\n X,z=eval(input()),[]\n\n for y in eval(input()):\n\n s=i=0\n\n for k in z:\n\n t=X.find(y,s)+1\n\n if not t:break\n\n if t list:\n\n # return a list of primes <= n\n\n n += 1 # include n itself\n\n sieve = [1] * n\n\n for i in range(3, int(n ** 0.5) + 1, 2):\n\n if sieve[i]:\n\n sieve[i * i :: 2 * i] = [0] * ((n - i * i - 1) \/\/ (2 * i) + 1)\n\n return [2] + [i for i in range(3, n, 2) if sieve[i]]\n\n\n\n\n\ndef main():\n\n Q = int(input())\n\n A = tuple(tuple(map(int, input().split())) for _ in range(Q))\n\n P = get_primes(10 ** 5)\n\n S = set(P)\n\n selected_P = [p for p in P if (p + 1) \/\/ 2 in S]\n\n ans = []\n\n bsr, bsl = bisect_right, bisect_left\n\n for l, r in A:\n\n x = bsr(selected_P, r) - bsl(selected_P, l)\n\n ans += [x]\n\n print(*ans, sep=\"\\n\")\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":34,"code_v1_loc":33,"code_v0_num_chars":865,"code_v1_num_chars":869,"code_v0_no_empty_lines":"# ABC084D - 2017-like Number\nimport sys\n\ninput = sys.stdin.readline\nfrom bisect import bisect_left, bisect_right\n\n\ndef get_primes(n):\n # return a list of primes <= n\n n += 1 # include n itself\n sieve = [1] * n\n for i in range(3, int(n**0.5) + 1, 2):\n if sieve[i]:\n sieve[i * i :: 2 * i] = [0] * ((n - i * i - 1) \/\/ (2 * i) + 1)\n return [2] + [i for i in range(3, n, 2) if sieve[i]]\n\n\ndef main():\n Q = int(input())\n A = tuple(tuple(map(int, input().split())) for _ in range(Q))\n _, R = zip(*A)\n lim = max(R)\n P = get_primes(lim)\n S = set(P)\n selected_P = [p for p in P if (p + 1) \/\/ 2 in S]\n ans = []\n for l, r in A:\n x = bisect_right(selected_P, r) - bisect_left(selected_P, l)\n ans += [x]\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# ABC084D - 2017-like Number\nimport sys\n\ninput = sys.stdin.readline\nfrom bisect import bisect_left, bisect_right\n\n\ndef get_primes(n: int) -> list:\n # return a list of primes <= n\n n += 1 # include n itself\n sieve = [1] * n\n for i in range(3, int(n**0.5) + 1, 2):\n if sieve[i]:\n sieve[i * i :: 2 * i] = [0] * ((n - i * i - 1) \/\/ (2 * i) + 1)\n return [2] + [i for i in range(3, n, 2) if sieve[i]]\n\n\ndef main():\n Q = int(input())\n A = tuple(tuple(map(int, input().split())) for _ in range(Q))\n P = get_primes(10**5)\n S = set(P)\n selected_P = [p for p in P if (p + 1) \/\/ 2 in S]\n ans = []\n bsr, bsl = bisect_right, bisect_left\n for l, r in A:\n x = bsr(selected_P, r) - bsl(selected_P, l)\n ans += [x]\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.9411764706,"diff":["-def get_primes(n):","+def get_primes(n: int) -> list:","- _, R = zip(*A)","- lim = max(R)","- P = get_primes(lim)","+ P = get_primes(10**5)","+ bsr, bsl = bisect_right, bisect_left","- x = bisect_right(selected_P, r) - bisect_left(selected_P, l)","+ x = bsr(selected_P, r) - bsl(selected_P, l)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0440107012,"measured_runtime_v1":0.0818154862,"runtime_lift":0.5379262927,"key":["s578155358","s644008715"]} +{"user_id":"u089230684","problem_id":"p02754","language":"python","submission_id_v0":"s271648555","submission_id_v1":"s632776867","cpu_time_v0":20,"cpu_time_v1":18,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"N, A, B = [int(x) for x in input().strip().split()]\n\np = N \/\/ (A + B) * A\n\nq = N % (A + B)\n\nif q > A:\n\n q = A\n\nprint((p + q))\n","target":"\"\"\"\n\n Author: _YL_\n\n\"\"\"\n\n# b:blue, r:red\n\nn, b, r = list(map(int, input().split()))\n\n\n\nif b == 0:\n\n print(\"0\")\n\nelif r == 0:\n\n print(n)\n\nelse:\n\n remainder = n % (b+r)\n\n if remainder > b:\n\n remainder = b\n\n\n\n print((n\/\/(b+r)*b+remainder))","code_v0_loc":6,"code_v1_loc":16,"code_v0_num_chars":127,"code_v1_num_chars":253,"code_v0_no_empty_lines":"N, A, B = [int(x) for x in input().strip().split()]\np = N \/\/ (A + B) * A\nq = N % (A + B)\nif q > A:\n q = A\nprint((p + q))\n","code_v1_no_empty_lines":"\"\"\"\n Author: _YL_\n\"\"\"\n# b:blue, r:red\nn, b, r = list(map(int, input().split()))\nif b == 0:\n print(\"0\")\nelif r == 0:\n print(n)\nelse:\n remainder = n % (b + r)\n if remainder > b:\n remainder = b\n print((n \/\/ (b + r) * b + remainder))\n","code_same":false,"relative_loc_diff_percent":62.5,"diff":["-N, A, B = [int(x) for x in input().strip().split()]","-p = N \/\/ (A + B) * A","-q = N % (A + B)","-if q > A:","- q = A","-print((p + q))","+\"\"\"","+ Author: _YL_","+\"\"\"","+# b:blue, r:red","+n, b, r = list(map(int, input().split()))","+if b == 0:","+ print(\"0\")","+elif r == 0:","+ print(n)","+else:","+ remainder = n % (b + r)","+ if remainder > b:","+ remainder = b","+ print((n \/\/ (b + r) * b + remainder))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0357562706,"measured_runtime_v1":0.0367541227,"runtime_lift":0.9728506077,"key":["s271648555","s632776867"]} +{"user_id":"u886297662","problem_id":"p03361","language":"python","submission_id_v0":"s531303748","submission_id_v1":"s262492773","cpu_time_v0":22,"cpu_time_v1":19,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.64,"input":"H, W = list(map(int, input().split()))\n\ns = [list(eval(input())) for i in range(H)]\n\ndh = [-1, 0, 0, 1]\n\ndw = [0, -1, 1, 0]\n\ncnt = 0\n\n\n\nfor h in range(H):\n\n for w in range(W):\n\n # Check only black cell\n\n if s[h][w] == '.':\n\n continue\n\n for k in range(4):\n\n nh = h + dh[k]\n\n nw = w + dw[k]\n\n if nh < 0 or nw < 0 or H <= nh or W <= nw:\n\n continue\n\n # ok\n\n if s[nh][nw] == '#':\n\n break\n\n # failed\n\n else:\n\n cnt += 1\n\n\n\nif cnt == 0:\n\n print('Yes')\n\nelse:\n\n print('No')","target":"H, W = list(map(int, input().split()))\n\ns = [list(eval(input())) for i in range(H)]\n\ndh = [-1, 0, 0, 1]\n\ndw = [0, -1, 1, 0]\n\ncnt = 0\n\n\n\nfor h in range(H):\n\n for w in range(W):\n\n # Check only black cell\n\n if s[h][w] == '.':\n\n continue\n\n for k in range(4):\n\n nh = h + dh[k]\n\n nw = w + dw[k]\n\n if nh < 0 or nw < 0 or H <= nh or W <= nw:\n\n continue\n\n # ok\n\n if s[nh][nw] == '#':\n\n break\n\n # failed\n\n else:\n\n print('No')\n\n break\n\n else:\n\n continue\n\n break\n\nelse:\n\n print('Yes')\n\n\n\n \n\n ","code_v0_loc":27,"code_v1_loc":31,"code_v0_num_chars":519,"code_v1_num_chars":550,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\ns = [list(eval(input())) for i in range(H)]\ndh = [-1, 0, 0, 1]\ndw = [0, -1, 1, 0]\ncnt = 0\nfor h in range(H):\n for w in range(W):\n # Check only black cell\n if s[h][w] == \".\":\n continue\n for k in range(4):\n nh = h + dh[k]\n nw = w + dw[k]\n if nh < 0 or nw < 0 or H <= nh or W <= nw:\n continue\n # ok\n if s[nh][nw] == \"#\":\n break\n # failed\n else:\n cnt += 1\nif cnt == 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\ns = [list(eval(input())) for i in range(H)]\ndh = [-1, 0, 0, 1]\ndw = [0, -1, 1, 0]\ncnt = 0\nfor h in range(H):\n for w in range(W):\n # Check only black cell\n if s[h][w] == \".\":\n continue\n for k in range(4):\n nh = h + dh[k]\n nw = w + dw[k]\n if nh < 0 or nw < 0 or H <= nh or W <= nw:\n continue\n # ok\n if s[nh][nw] == \"#\":\n break\n # failed\n else:\n print(\"No\")\n break\n else:\n continue\n break\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":12.9032258065,"diff":["- cnt += 1","-if cnt == 0:","+ print(\"No\")","+ break","+ else:","+ continue","+ break","+else:","-else:","- print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363817422,"measured_runtime_v1":0.0379832377,"runtime_lift":0.9578367825,"key":["s531303748","s262492773"]} +{"user_id":"u063596417","problem_id":"p03624","language":"python","submission_id_v0":"s876345056","submission_id_v1":"s053417167","cpu_time_v0":84,"cpu_time_v1":57,"memory_v0":71448,"memory_v1":10008,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.14,"input":"s = eval(input())\n\ns = sorted(s)\n\nascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'\n\nans = 'None'\n\nfor chr_alpha in ascii_lowercase:\n\n if chr_alpha not in s:\n\n ans = chr_alpha\n\n break\n\nprint(ans)","target":"def main():\n\n s = eval(input())\n\n s = sorted(s)\n\n ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'\n\n ans = 'None'\n\n for chr_alpha in ascii_lowercase:\n\n if chr_alpha not in s:\n\n ans = chr_alpha\n\n break\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":9,"code_v1_loc":14,"code_v0_num_chars":193,"code_v1_num_chars":297,"code_v0_no_empty_lines":"s = eval(input())\ns = sorted(s)\nascii_lowercase = \"abcdefghijklmnopqrstuvwxyz\"\nans = \"None\"\nfor chr_alpha in ascii_lowercase:\n if chr_alpha not in s:\n ans = chr_alpha\n break\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n s = eval(input())\n s = sorted(s)\n ascii_lowercase = \"abcdefghijklmnopqrstuvwxyz\"\n ans = \"None\"\n for chr_alpha in ascii_lowercase:\n if chr_alpha not in s:\n ans = chr_alpha\n break\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-s = eval(input())","-s = sorted(s)","-ascii_lowercase = \"abcdefghijklmnopqrstuvwxyz\"","-ans = \"None\"","-for chr_alpha in ascii_lowercase:","- if chr_alpha not in s:","- ans = chr_alpha","- break","-print(ans)","+def main():","+ s = eval(input())","+ s = sorted(s)","+ ascii_lowercase = \"abcdefghijklmnopqrstuvwxyz\"","+ ans = \"None\"","+ for chr_alpha in ascii_lowercase:","+ if chr_alpha not in s:","+ ans = chr_alpha","+ break","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0389670372,"measured_runtime_v1":0.0449897289,"runtime_lift":0.866131851,"key":["s876345056","s053417167"]} +{"user_id":"u571969099","problem_id":"p03549","language":"python","submission_id_v0":"s497365603","submission_id_v1":"s521227134","cpu_time_v0":164,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.63,"input":"n,m=[int(i) for i in input().split()]\n\nans=(n-m)*100\n\nans=(ans+1900*m)*2**m\n\nprint(ans)","target":"n,m=list(map(int,input().split()))\n\nprint(((m*1900+(n-m)*100)*2**m))","code_v0_loc":4,"code_v1_loc":2,"code_v0_num_chars":87,"code_v1_num_chars":66,"code_v0_no_empty_lines":"n, m = [int(i) for i in input().split()]\nans = (n - m) * 100\nans = (ans + 1900 * m) * 2**m\nprint(ans)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nprint(((m * 1900 + (n - m) * 100) * 2**m))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-n, m = [int(i) for i in input().split()]","-ans = (n - m) * 100","-ans = (ans + 1900 * m) * 2**m","-print(ans)","+n, m = list(map(int, input().split()))","+print(((m * 1900 + (n - m) * 100) * 2**m))"],"diff_only_import_comment":false,"measured_runtime_v0":0.08161062,"measured_runtime_v1":0.0375935092,"runtime_lift":2.1708699651,"key":["s497365603","s521227134"]} +{"user_id":"u263830634","problem_id":"p03504","language":"python","submission_id_v0":"s512479073","submission_id_v1":"s417197327","cpu_time_v0":892,"cpu_time_v1":560,"memory_v0":85268,"memory_v1":60964,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.22,"input":"# \u8a08\u7b97\u91cf O(NC) = O(3 * 10 ** 6)\n\nimport sys\n\ninput = sys.stdin.readline\n\nimport numpy as np\n\n\n\nN, C = list(map(int, input().split()))\n\n\n\n# \u5165\u529b\n\nlst = [[0] * (10 ** 5 + 10) for _ in range(C + 1)]\n\nlst_max = [[1] * (10 ** 5 + 10) for _ in range(C + 1)]\n\n\n\n# lst = [[0] * (10) for _ in range(C + 1)]\n\n# lst_max = [[1] * (10) for _ in range(C + 1)]\n\n\n\nfor _ in range(N):\n\n s, t, c = list(map(int, input().split()))\n\n lst[c][s] += 1\n\n lst[c][t + 1] -= 1\n\n\n\nlst = np.array(lst)\n\nnp.cumsum(lst, axis = 1, out = lst)\n\nnp.minimum(lst, lst_max, out = lst)\n\nnp.cumsum(lst, axis = 0, out = lst)\n\n\n\nprint((np.max(lst[-1])))","target":"# \u8a08\u7b97\u91cf O(NC) = O(3 * 10 ** 6)\n\nimport sys\n\ninput = sys.stdin.readline\n\nimport numpy as np\n\n\n\nN, C = list(map(int, input().split()))\n\n\n\n# \u5165\u529b\n\nlst = [[0] * (10 ** 5 + 10) for _ in range(C + 1)]\n\n# lst_max = [[1] * (10 ** 5 + 10) for _ in range(C + 1)]\n\n\n\n# lst = [[0] * (10) for _ in range(C + 1)]\n\n# lst_max = [[1] * (10) for _ in range(C + 1)]\n\n\n\nfor _ in range(N):\n\n s, t, c = list(map(int, input().split()))\n\n lst[c][s] += 1\n\n lst[c][t + 1] -= 1\n\n\n\nlst = np.array(lst)\n\nnp.cumsum(lst, axis = 1, out = lst)\n\nnp.minimum(lst, 1, out = lst)\n\nnp.cumsum(lst, axis = 0, out = lst)\n\n\n\nprint((np.max(lst[-1])))","code_v0_loc":25,"code_v1_loc":25,"code_v0_num_chars":602,"code_v1_num_chars":598,"code_v0_no_empty_lines":"# \u8a08\u7b97\u91cf O(NC) = O(3 * 10 ** 6)\nimport sys\n\ninput = sys.stdin.readline\nimport numpy as np\n\nN, C = list(map(int, input().split()))\n# \u5165\u529b\nlst = [[0] * (10**5 + 10) for _ in range(C + 1)]\nlst_max = [[1] * (10**5 + 10) for _ in range(C + 1)]\n# lst = [[0] * (10) for _ in range(C + 1)]\n# lst_max = [[1] * (10) for _ in range(C + 1)]\nfor _ in range(N):\n s, t, c = list(map(int, input().split()))\n lst[c][s] += 1\n lst[c][t + 1] -= 1\nlst = np.array(lst)\nnp.cumsum(lst, axis=1, out=lst)\nnp.minimum(lst, lst_max, out=lst)\nnp.cumsum(lst, axis=0, out=lst)\nprint((np.max(lst[-1])))\n","code_v1_no_empty_lines":"# \u8a08\u7b97\u91cf O(NC) = O(3 * 10 ** 6)\nimport sys\n\ninput = sys.stdin.readline\nimport numpy as np\n\nN, C = list(map(int, input().split()))\n# \u5165\u529b\nlst = [[0] * (10**5 + 10) for _ in range(C + 1)]\n# lst_max = [[1] * (10 ** 5 + 10) for _ in range(C + 1)]\n# lst = [[0] * (10) for _ in range(C + 1)]\n# lst_max = [[1] * (10) for _ in range(C + 1)]\nfor _ in range(N):\n s, t, c = list(map(int, input().split()))\n lst[c][s] += 1\n lst[c][t + 1] -= 1\nlst = np.array(lst)\nnp.cumsum(lst, axis=1, out=lst)\nnp.minimum(lst, 1, out=lst)\nnp.cumsum(lst, axis=0, out=lst)\nprint((np.max(lst[-1])))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-lst_max = [[1] * (10**5 + 10) for _ in range(C + 1)]","+# lst_max = [[1] * (10 ** 5 + 10) for _ in range(C + 1)]","-np.minimum(lst, lst_max, out=lst)","+np.minimum(lst, 1, out=lst)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4304216185,"measured_runtime_v1":0.290087713,"runtime_lift":1.4837637003,"key":["s512479073","s417197327"]} +{"user_id":"u592248346","problem_id":"p02899","language":"python","submission_id_v0":"s804338509","submission_id_v1":"s909207170","cpu_time_v0":189,"cpu_time_v1":112,"memory_v0":13812,"memory_v1":13880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.74,"input":"n = int(input())\n\na = list(map(int,input().split()))\n\nb = [0]*n\n\nfor i in range(n):\n\n b[a[i]-1] = i+1\n\nfor i in range(n):\n\n print(b[i],end=\" \")\n","target":"n = int(eval(input()))\n\na = list(map(int,input().split()))\n\nb = [0]*n\n\nfor i in range(n):\n\n b[a[i]-1] = i+1\n\nprint((*b))","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":149,"code_v1_num_chars":115,"code_v0_no_empty_lines":"n = int(input())\na = list(map(int, input().split()))\nb = [0] * n\nfor i in range(n):\n b[a[i] - 1] = i + 1\nfor i in range(n):\n print(b[i], end=\" \")\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nb = [0] * n\nfor i in range(n):\n b[a[i] - 1] = i + 1\nprint((*b))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-n = int(input())","+n = int(eval(input()))","-for i in range(n):","- print(b[i], end=\" \")","+print((*b))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0612787418,"measured_runtime_v1":0.0883789284,"runtime_lift":0.693363711,"key":["s804338509","s909207170"]} +{"user_id":"u520276780","problem_id":"p02559","language":"python","submission_id_v0":"s920030469","submission_id_v1":"s420697664","cpu_time_v0":4498,"cpu_time_v1":3353,"memory_v0":65032,"memory_v1":65204,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.46,"input":"n,q=list(map(int, input().split()))\n\n*a,=list(map(int, input().split()))\n\nbit=[0]*(2*n+1)\n\n\n\ndef add(t,x):\n\n while t<=n:\n\n bit[t]+=x\n\n t+=t&(-t)\n\n\n\ndef que(t):\n\n res=0\n\n while t:\n\n res+=bit[t]\n\n t-=t&(-t)\n\n return res\n\n\n\nfor i in range(n):\n\n add(i+1,a[i])\n\n\n\n\n\nfor _ in range(q):\n\n i,p,x=list(map(int, input().split()))\n\n if i:\n\n ans=que(x)-que(p)\n\n print(ans)\n\n else:\n\n add(p+1,x)\n","target":"import sys\n\ninput=sys.stdin.readline\n\nn,q=list(map(int, input().split()))\n\n*a,=list(map(int, input().split()))\n\nbit=[0]*(n+1)\n\n\n\ndef add(t,x):\n\n while t<=n:\n\n bit[t]+=x\n\n t+=t&(-t)\n\n\n\ndef que(t):\n\n res=0\n\n while t:\n\n res+=bit[t]\n\n t-=t&(-t)\n\n return res\n\n\n\nfor i in range(n):\n\n add(i+1,a[i])\n\n\n\n\n\nfor _ in range(q):\n\n i,p,x=list(map(int, input().split()))\n\n if i:\n\n ans=que(x)-que(p)\n\n print(ans)\n\n else:\n\n add(p+1,x)\n","code_v0_loc":27,"code_v1_loc":29,"code_v0_num_chars":437,"code_v1_num_chars":473,"code_v0_no_empty_lines":"n, q = list(map(int, input().split()))\n(*a,) = list(map(int, input().split()))\nbit = [0] * (2 * n + 1)\n\n\ndef add(t, x):\n while t <= n:\n bit[t] += x\n t += t & (-t)\n\n\ndef que(t):\n res = 0\n while t:\n res += bit[t]\n t -= t & (-t)\n return res\n\n\nfor i in range(n):\n add(i + 1, a[i])\nfor _ in range(q):\n i, p, x = list(map(int, input().split()))\n if i:\n ans = que(x) - que(p)\n print(ans)\n else:\n add(p + 1, x)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn, q = list(map(int, input().split()))\n(*a,) = list(map(int, input().split()))\nbit = [0] * (n + 1)\n\n\ndef add(t, x):\n while t <= n:\n bit[t] += x\n t += t & (-t)\n\n\ndef que(t):\n res = 0\n while t:\n res += bit[t]\n t -= t & (-t)\n return res\n\n\nfor i in range(n):\n add(i + 1, a[i])\nfor _ in range(q):\n i, p, x = list(map(int, input().split()))\n if i:\n ans = que(x) - que(p)\n print(ans)\n else:\n add(p + 1, x)\n","code_same":false,"relative_loc_diff_percent":6.8965517241,"diff":["+import sys","+","+input = sys.stdin.readline","-bit = [0] * (2 * n + 1)","+bit = [0] * (n + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0368613291,"measured_runtime_v1":0.0451741545,"runtime_lift":0.815982711,"key":["s920030469","s420697664"]} +{"user_id":"u368249389","problem_id":"p03324","language":"python","submission_id_v0":"s755079211","submission_id_v1":"s067636951","cpu_time_v0":201,"cpu_time_v1":17,"memory_v0":40300,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.54,"input":"d, n = list(map(int, input().split()))\n\n\n\n\n\nfor i in range(1, 100000000):\n\n if i % (100 ** d) == 0 and i % (100 * 100 ** d) != 0:\n\n n -= 1\n\n if n == 0:\n\n print(i)\n\n exit()\n","target":"# Problem B - Ringo's Favorite Numbers\n\n\n\n# input\n\nD, N = list(map(int, input().split()))\n\n\n\n# initialization\n\nans = 0\n\ntmp = 100**D\n\n\n\n# count\n\ni = 1\n\nwhile i<=N:\n\n if i==100:\n\n ans = tmp * (i + 1)\n\n break\n\n ans = tmp * i\n\n i += 1\n\n\n\n# output\n\nprint(ans)\n","code_v0_loc":9,"code_v1_loc":20,"code_v0_num_chars":193,"code_v1_num_chars":273,"code_v0_no_empty_lines":"d, n = list(map(int, input().split()))\nfor i in range(1, 100000000):\n if i % (100**d) == 0 and i % (100 * 100**d) != 0:\n n -= 1\n if n == 0:\n print(i)\n exit()\n","code_v1_no_empty_lines":"# Problem B - Ringo's Favorite Numbers\n# input\nD, N = list(map(int, input().split()))\n# initialization\nans = 0\ntmp = 100**D\n# count\ni = 1\nwhile i <= N:\n if i == 100:\n ans = tmp * (i + 1)\n break\n ans = tmp * i\n i += 1\n# output\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":55.0,"diff":["-d, n = list(map(int, input().split()))","-for i in range(1, 100000000):","- if i % (100**d) == 0 and i % (100 * 100**d) != 0:","- n -= 1","- if n == 0:","- print(i)","- exit()","+# Problem B - Ringo's Favorite Numbers","+# input","+D, N = list(map(int, input().split()))","+# initialization","+ans = 0","+tmp = 100**D","+# count","+i = 1","+while i <= N:","+ if i == 100:","+ ans = tmp * (i + 1)","+ break","+ ans = tmp * i","+ i += 1","+# output","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1711217761,"measured_runtime_v1":0.0347066135,"runtime_lift":4.9305235688,"key":["s755079211","s067636951"]} +{"user_id":"u989345508","problem_id":"p03475","language":"python","submission_id_v0":"s525114766","submission_id_v1":"s461763752","cpu_time_v0":110,"cpu_time_v1":98,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.91,"input":"import math\n\nn=int(eval(input()))\n\nc=[]\n\ns=[]\n\nf=[]\n\nfor i in range(n-1):\n\n C,S,F=list(map(int,input().split()))\n\n c.append(C)\n\n s.append(S)\n\n f.append(F)\n\n\n\n\n\nfor j in range(n-1):\n\n t=s[j]\n\n for i in range(j,n-1):\n\n\n\n if t<=s[i]:\n\n t=s[i]+c[i]\n\n else:\n\n k=t-s[i]\n\n t=s[i]+math.ceil(k\/f[i])*f[i]+c[i]\n\n print( t)\n\n\n\nprint((0))\n","target":"import math\n\nn=int(eval(input()))\n\ncsf=[list(map(int,input().split())) for i in range(n-1)]\n\n\n\nfor j in range(n-1):\n\n now=0\n\n for i in range(j,n-1):\n\n if csf[i][1]>=now:\n\n now=csf[i][1]+csf[i][0]\n\n else:\n\n now=csf[i][1]-((csf[i][1]-now)\/\/csf[i][2])*csf[i][2]+csf[i][0]\n\n print(now)\n\nprint((0))\n\n\n","code_v0_loc":24,"code_v1_loc":14,"code_v0_num_chars":381,"code_v1_num_chars":333,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nc = []\ns = []\nf = []\nfor i in range(n - 1):\n C, S, F = list(map(int, input().split()))\n c.append(C)\n s.append(S)\n f.append(F)\nfor j in range(n - 1):\n t = s[j]\n for i in range(j, n - 1):\n if t <= s[i]:\n t = s[i] + c[i]\n else:\n k = t - s[i]\n t = s[i] + math.ceil(k \/ f[i]) * f[i] + c[i]\n print(t)\nprint((0))\n","code_v1_no_empty_lines":"import math\n\nn = int(eval(input()))\ncsf = [list(map(int, input().split())) for i in range(n - 1)]\nfor j in range(n - 1):\n now = 0\n for i in range(j, n - 1):\n if csf[i][1] >= now:\n now = csf[i][1] + csf[i][0]\n else:\n now = csf[i][1] - ((csf[i][1] - now) \/\/ csf[i][2]) * csf[i][2] + csf[i][0]\n print(now)\nprint((0))\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["-c = []","-s = []","-f = []","-for i in range(n - 1):","- C, S, F = list(map(int, input().split()))","- c.append(C)","- s.append(S)","- f.append(F)","+csf = [list(map(int, input().split())) for i in range(n - 1)]","- t = s[j]","+ now = 0","- if t <= s[i]:","- t = s[i] + c[i]","+ if csf[i][1] >= now:","+ now = csf[i][1] + csf[i][0]","- k = t - s[i]","- t = s[i] + math.ceil(k \/ f[i]) * f[i] + c[i]","- print(t)","+ now = csf[i][1] - ((csf[i][1] - now) \/\/ csf[i][2]) * csf[i][2] + csf[i][0]","+ print(now)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363126652,"measured_runtime_v1":0.0704049752,"runtime_lift":0.5157684543,"key":["s525114766","s461763752"]} +{"user_id":"u768993705","problem_id":"p02888","language":"python","submission_id_v0":"s478195417","submission_id_v1":"s256218480","cpu_time_v0":1488,"cpu_time_v1":1261,"memory_v0":3316,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.26,"input":"import bisect\n\nn = int(eval(input()))\n\nl = sorted(list(map(int, input().split())))\n\ns = 0\n\nfor i in range(0,n-2):\n\n a = l[i]\n\n for j in range(i+1,n-1):\n\n b = l[j]\n\n s += bisect.bisect_left(l,a+b,j+1)-j-1\n\nprint(s)","target":"import bisect\n\nn = int(eval(input()))\n\nl = sorted(list(map(int, input().split())))\n\ns = 0\n\nfor i in range(0,n-2):\n\n a = l[i]\n\n for j in range(i+1,n-1):\n\n b = l[j]\n\n s += bisect.bisect_left(l,a+b)-j-1\n\nprint(s)","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":215,"code_v1_num_chars":211,"code_v0_no_empty_lines":"import bisect\n\nn = int(eval(input()))\nl = sorted(list(map(int, input().split())))\ns = 0\nfor i in range(0, n - 2):\n a = l[i]\n for j in range(i + 1, n - 1):\n b = l[j]\n s += bisect.bisect_left(l, a + b, j + 1) - j - 1\nprint(s)\n","code_v1_no_empty_lines":"import bisect\n\nn = int(eval(input()))\nl = sorted(list(map(int, input().split())))\ns = 0\nfor i in range(0, n - 2):\n a = l[i]\n for j in range(i + 1, n - 1):\n b = l[j]\n s += bisect.bisect_left(l, a + b) - j - 1\nprint(s)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- s += bisect.bisect_left(l, a + b, j + 1) - j - 1","+ s += bisect.bisect_left(l, a + b) - j - 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443262074,"measured_runtime_v1":0.1029754744,"runtime_lift":0.4304540248,"key":["s478195417","s256218480"]} +{"user_id":"u347640436","problem_id":"p02844","language":"python","submission_id_v0":"s075041419","submission_id_v1":"s220388084","cpu_time_v0":28,"cpu_time_v1":18,"memory_v0":3444,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.71,"input":"N = int(eval(input()))\n\nS = eval(input())\n\n\n\nt = [S[0]]\n\np = S[0]\n\nr = 1\n\nfor i in range(1, N):\n\n if S[i] == p:\n\n r += 1\n\n if r < 4:\n\n t.append(S[i])\n\n else:\n\n r = 1\n\n t.append(S[i])\n\nT = ''.join(t)\n\n\n\nresult = 0\n\nfor i in range(10):\n\n a = T.find(str(i))\n\n if a == -1:\n\n continue\n\n for j in range(10):\n\n b = T.find(str(j), a + 1)\n\n if b == -1:\n\n continue\n\n for k in range(10):\n\n if T.find(str(k), b + 1) != -1:\n\n result += 1\n\nprint(result)","target":"N = int(eval(input()))\n\nS = eval(input())\n\n\n\nresult = 0\n\nfor i in range(10):\n\n a = S.find(str(i))\n\n if a == -1:\n\n continue\n\n for j in range(10):\n\n b = S.find(str(j), a + 1)\n\n if b == -1:\n\n continue\n\n for k in range(10):\n\n if S.find(str(k), b + 1) != -1:\n\n result += 1\n\nprint(result)","code_v0_loc":29,"code_v1_loc":16,"code_v0_num_chars":478,"code_v1_num_chars":302,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nt = [S[0]]\np = S[0]\nr = 1\nfor i in range(1, N):\n if S[i] == p:\n r += 1\n if r < 4:\n t.append(S[i])\n else:\n r = 1\n t.append(S[i])\nT = \"\".join(t)\nresult = 0\nfor i in range(10):\n a = T.find(str(i))\n if a == -1:\n continue\n for j in range(10):\n b = T.find(str(j), a + 1)\n if b == -1:\n continue\n for k in range(10):\n if T.find(str(k), b + 1) != -1:\n result += 1\nprint(result)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nresult = 0\nfor i in range(10):\n a = S.find(str(i))\n if a == -1:\n continue\n for j in range(10):\n b = S.find(str(j), a + 1)\n if b == -1:\n continue\n for k in range(10):\n if S.find(str(k), b + 1) != -1:\n result += 1\nprint(result)\n","code_same":false,"relative_loc_diff_percent":44.8275862069,"diff":["-t = [S[0]]","-p = S[0]","-r = 1","-for i in range(1, N):","- if S[i] == p:","- r += 1","- if r < 4:","- t.append(S[i])","- else:","- r = 1","- t.append(S[i])","-T = \"\".join(t)","- a = T.find(str(i))","+ a = S.find(str(i))","- b = T.find(str(j), a + 1)","+ b = S.find(str(j), a + 1)","- if T.find(str(k), b + 1) != -1:","+ if S.find(str(k), b + 1) != -1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373872569,"measured_runtime_v1":0.0448443239,"runtime_lift":0.8337121317,"key":["s075041419","s220388084"]} +{"user_id":"u439396449","problem_id":"p03660","language":"python","submission_id_v0":"s140139248","submission_id_v1":"s670523540","cpu_time_v0":1329,"cpu_time_v1":1117,"memory_v0":77692,"memory_v1":77720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.95,"input":"from collections import defaultdict\n\nfrom heapq import heappop, heappush\n\n\n\nN = int(eval(input()))\n\n\n\n\n\nclass Graph(object):\n\n def __init__(self):\n\n self.graph = defaultdict(list)\n\n\n\n def __len__(self):\n\n return len(self.graph)\n\n\n\n def add_edge(self, src, dst, weight=1):\n\n self.graph[src].append((dst, weight))\n\n\n\n def get_nodes(self):\n\n return list(self.graph.keys())\n\n\n\n\n\nclass Dijkstra(object):\n\n def __init__(self, graph, start):\n\n g = graph.graph\n\n\n\n self.dist = defaultdict(lambda: float('inf'))\n\n self.dist[start] = 0\n\n self.prev = defaultdict(lambda: None)\n\n\n\n Q = []\n\n heappush(Q, (self.dist[start], start))\n\n\n\n while Q:\n\n dist_u, u = heappop(Q)\n\n if self.dist[u] < dist_u:\n\n continue\n\n for v, weight in g[u]:\n\n alt = dist_u + weight\n\n if self.dist[v] > alt:\n\n self.dist[v] = alt\n\n self.prev[v] = u\n\n heappush(Q, (alt, v))\n\n\n\n def shortest_distance(self, goal):\n\n return self.dist[goal]\n\n\n\n def shortest_path(self, goal):\n\n path = []\n\n node = goal\n\n while node is not None:\n\n path.append(node)\n\n node = self.prev[node]\n\n return path[::-1]\n\n\n\ng = Graph()\n\nfor _ in range(N - 1):\n\n a, b = list(map(int, input().split()))\n\n g.add_edge(a - 1, b - 1)\n\n g.add_edge(b - 1, a - 1)\n\n\n\nd1 = Dijkstra(g, 0)\n\nd2 = Dijkstra(g, N - 1)\n\nc1, c2 = 0, 0\n\nfor i in range(N):\n\n if d1.shortest_distance(i) <= d2.shortest_distance(i):\n\n c1 += 1\n\n else:\n\n c2 += 1\n\n\n\nif c1 > c2:\n\n print('Fennec')\n\nelse:\n\n print('Snuke')\n","target":"import sys\n\nfrom collections import defaultdict\n\nfrom heapq import heappop, heappush\n\n\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\n\n\n\n\nclass Graph(object):\n\n def __init__(self):\n\n self.graph = defaultdict(list)\n\n\n\n def __len__(self):\n\n return len(self.graph)\n\n\n\n def add_edge(self, src, dst, weight=1):\n\n self.graph[src].append((dst, weight))\n\n\n\n def get_nodes(self):\n\n return list(self.graph.keys())\n\n\n\n\n\nclass Dijkstra(object):\n\n def __init__(self, graph, start):\n\n g = graph.graph\n\n\n\n self.dist = defaultdict(lambda: float('inf'))\n\n self.dist[start] = 0\n\n self.prev = defaultdict(lambda: None)\n\n\n\n Q = []\n\n heappush(Q, (self.dist[start], start))\n\n\n\n while Q:\n\n dist_u, u = heappop(Q)\n\n if self.dist[u] < dist_u:\n\n continue\n\n for v, weight in g[u]:\n\n alt = dist_u + weight\n\n if self.dist[v] > alt:\n\n self.dist[v] = alt\n\n self.prev[v] = u\n\n heappush(Q, (alt, v))\n\n\n\n def shortest_distance(self, goal):\n\n return self.dist[goal]\n\n\n\n\n\ng = Graph()\n\nfor _ in range(N - 1):\n\n a, b = list(map(int, input().split()))\n\n g.add_edge(a - 1, b - 1)\n\n g.add_edge(b - 1, a - 1)\n\n\n\nd1 = Dijkstra(g, 0)\n\nd2 = Dijkstra(g, N - 1)\n\n\n\ncnt1, cnt2 = 0, 0\n\nfor i in range(1, N - 1):\n\n x = d1.shortest_distance(i)\n\n y = d2.shortest_distance(i)\n\n if x <= y:\n\n cnt1 += 1\n\n else:\n\n cnt2 += 1\n\n\n\nif cnt1 > cnt2:\n\n print('Fennec')\n\nelse:\n\n print('Snuke')\n","code_v0_loc":72,"code_v1_loc":71,"code_v0_num_chars":1715,"code_v1_num_chars":1597,"code_v0_no_empty_lines":"from collections import defaultdict\nfrom heapq import heappop, heappush\n\nN = int(eval(input()))\n\n\nclass Graph(object):\n def __init__(self):\n self.graph = defaultdict(list)\n\n def __len__(self):\n return len(self.graph)\n\n def add_edge(self, src, dst, weight=1):\n self.graph[src].append((dst, weight))\n\n def get_nodes(self):\n return list(self.graph.keys())\n\n\nclass Dijkstra(object):\n def __init__(self, graph, start):\n g = graph.graph\n self.dist = defaultdict(lambda: float(\"inf\"))\n self.dist[start] = 0\n self.prev = defaultdict(lambda: None)\n Q = []\n heappush(Q, (self.dist[start], start))\n while Q:\n dist_u, u = heappop(Q)\n if self.dist[u] < dist_u:\n continue\n for v, weight in g[u]:\n alt = dist_u + weight\n if self.dist[v] > alt:\n self.dist[v] = alt\n self.prev[v] = u\n heappush(Q, (alt, v))\n\n def shortest_distance(self, goal):\n return self.dist[goal]\n\n def shortest_path(self, goal):\n path = []\n node = goal\n while node is not None:\n path.append(node)\n node = self.prev[node]\n return path[::-1]\n\n\ng = Graph()\nfor _ in range(N - 1):\n a, b = list(map(int, input().split()))\n g.add_edge(a - 1, b - 1)\n g.add_edge(b - 1, a - 1)\nd1 = Dijkstra(g, 0)\nd2 = Dijkstra(g, N - 1)\nc1, c2 = 0, 0\nfor i in range(N):\n if d1.shortest_distance(i) <= d2.shortest_distance(i):\n c1 += 1\n else:\n c2 += 1\nif c1 > c2:\n print(\"Fennec\")\nelse:\n print(\"Snuke\")\n","code_v1_no_empty_lines":"import sys\nfrom collections import defaultdict\nfrom heapq import heappop, heappush\n\ninput = sys.stdin.readline\nN = int(eval(input()))\n\n\nclass Graph(object):\n def __init__(self):\n self.graph = defaultdict(list)\n\n def __len__(self):\n return len(self.graph)\n\n def add_edge(self, src, dst, weight=1):\n self.graph[src].append((dst, weight))\n\n def get_nodes(self):\n return list(self.graph.keys())\n\n\nclass Dijkstra(object):\n def __init__(self, graph, start):\n g = graph.graph\n self.dist = defaultdict(lambda: float(\"inf\"))\n self.dist[start] = 0\n self.prev = defaultdict(lambda: None)\n Q = []\n heappush(Q, (self.dist[start], start))\n while Q:\n dist_u, u = heappop(Q)\n if self.dist[u] < dist_u:\n continue\n for v, weight in g[u]:\n alt = dist_u + weight\n if self.dist[v] > alt:\n self.dist[v] = alt\n self.prev[v] = u\n heappush(Q, (alt, v))\n\n def shortest_distance(self, goal):\n return self.dist[goal]\n\n\ng = Graph()\nfor _ in range(N - 1):\n a, b = list(map(int, input().split()))\n g.add_edge(a - 1, b - 1)\n g.add_edge(b - 1, a - 1)\nd1 = Dijkstra(g, 0)\nd2 = Dijkstra(g, N - 1)\ncnt1, cnt2 = 0, 0\nfor i in range(1, N - 1):\n x = d1.shortest_distance(i)\n y = d2.shortest_distance(i)\n if x <= y:\n cnt1 += 1\n else:\n cnt2 += 1\nif cnt1 > cnt2:\n print(\"Fennec\")\nelse:\n print(\"Snuke\")\n","code_same":false,"relative_loc_diff_percent":1.3888888889,"diff":["+import sys","+input = sys.stdin.readline","- def shortest_path(self, goal):","- path = []","- node = goal","- while node is not None:","- path.append(node)","- node = self.prev[node]","- return path[::-1]","-","-c1, c2 = 0, 0","-for i in range(N):","- if d1.shortest_distance(i) <= d2.shortest_distance(i):","- c1 += 1","+cnt1, cnt2 = 0, 0","+for i in range(1, N - 1):","+ x = d1.shortest_distance(i)","+ y = d2.shortest_distance(i)","+ if x <= y:","+ cnt1 += 1","- c2 += 1","-if c1 > c2:","+ cnt2 += 1","+if cnt1 > cnt2:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1749745846,"measured_runtime_v1":0.04252038,"runtime_lift":4.1150757462,"key":["s140139248","s670523540"]} +{"user_id":"u969850098","problem_id":"p02996","language":"python","submission_id_v0":"s370228849","submission_id_v1":"s085849456","cpu_time_v0":563,"cpu_time_v1":463,"memory_v0":53704,"memory_v1":31832,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.76,"input":"import sys\n\nreadline = sys.stdin.readline\n\nfrom operator import itemgetter\n\n\n\ndef main():\n\n N = int(readline())\n\n AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]\n\n AB.sort(key=itemgetter(1))\n\n t = 0\n\n for a, b in AB:\n\n t += a\n\n if t > b:\n\n print('No')\n\n return\n\n \n\n print('Yes')\n\n\n\nif __name__ == '__main__':\n\n main()","target":"import sys\n\nreadline = sys.stdin.readline\n\nfrom operator import itemgetter\n\n\n\ndef main():\n\n N = int(readline())\n\n AB = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]\n\n AB.sort(key=itemgetter(1))\n\n t = 0\n\n for a, b in AB:\n\n t += a\n\n if t > b:\n\n print('No')\n\n return\n\n \n\n print('Yes')\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":402,"code_v1_num_chars":403,"code_v0_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nfrom operator import itemgetter\n\n\ndef main():\n N = int(readline())\n AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]\n AB.sort(key=itemgetter(1))\n t = 0\n for a, b in AB:\n t += a\n if t > b:\n print(\"No\")\n return\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nfrom operator import itemgetter\n\n\ndef main():\n N = int(readline())\n AB = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]\n AB.sort(key=itemgetter(1))\n t = 0\n for a, b in AB:\n t += a\n if t > b:\n print(\"No\")\n return\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]","+ AB = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0838607781,"measured_runtime_v1":0.0925250783,"runtime_lift":0.9063572777,"key":["s370228849","s085849456"]} +{"user_id":"u821624310","problem_id":"p02382","language":"python","submission_id_v0":"s545306352","submission_id_v1":"s659017018","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7828,"memory_v1":7888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"n = int(eval(input()))\n\nx = list(map(int, input().split()))\n\ny = list(map(int, input().split()))\n\np = 0\n\nq = 0\n\np1 = 0\n\np2 = 0\n\np3 = 0\n\nmax = 0\n\nimport math\n\nfor i, j in zip(x, y):\n\n p1 += abs(i - j)\n\n p += abs((i - j) ** 2)\n\n p2 = math.sqrt(p)\n\n q += abs((i - j) ** 3)\n\n p3 = math.pow(q, 1.0\/3.0)\n\n if abs(i - j) > max:\n\n max = abs(i - j)\n\n\n\nprint(p1)\n\nprint(p2)\n\nprint(p3)\n\nprint(max)","target":"import math\n\n\n\nn = int(eval(input()))\n\nx = [float(x) for x in input().split()]\n\ny = [float(y) for y in input().split()]\n\nd = 0\n\nfor i in range(n):\n\n d += abs(x[i] - y[i])\n\n\n\nprint(d)\n\n\n\nd = 0\n\nfor i in range(n):\n\n d += abs((x[i] - y[i])**2)\n\n\n\nd = math.sqrt(d)\n\nprint(d)\n\n\n\nd = 0\n\nfor i in range(n):\n\n d += abs((x[i] - y[i])**3)\n\n\n\nd = math.pow(d, 1.0\/3.0)\n\nprint(d)\n\n\n\nd = 0\n\nfor i in range(n):\n\n if d <= abs(x[i] - y[i]):\n\n d = abs(x[i] - y[i])\n\n\n\nprint(d)","code_v0_loc":23,"code_v1_loc":31,"code_v0_num_chars":405,"code_v1_num_chars":471,"code_v0_no_empty_lines":"n = int(eval(input()))\nx = list(map(int, input().split()))\ny = list(map(int, input().split()))\np = 0\nq = 0\np1 = 0\np2 = 0\np3 = 0\nmax = 0\nimport math\n\nfor i, j in zip(x, y):\n p1 += abs(i - j)\n p += abs((i - j) ** 2)\n p2 = math.sqrt(p)\n q += abs((i - j) ** 3)\n p3 = math.pow(q, 1.0 \/ 3.0)\n if abs(i - j) > max:\n max = abs(i - j)\nprint(p1)\nprint(p2)\nprint(p3)\nprint(max)\n","code_v1_no_empty_lines":"import math\n\nn = int(eval(input()))\nx = [float(x) for x in input().split()]\ny = [float(y) for y in input().split()]\nd = 0\nfor i in range(n):\n d += abs(x[i] - y[i])\nprint(d)\nd = 0\nfor i in range(n):\n d += abs((x[i] - y[i]) ** 2)\nd = math.sqrt(d)\nprint(d)\nd = 0\nfor i in range(n):\n d += abs((x[i] - y[i]) ** 3)\nd = math.pow(d, 1.0 \/ 3.0)\nprint(d)\nd = 0\nfor i in range(n):\n if d <= abs(x[i] - y[i]):\n d = abs(x[i] - y[i])\nprint(d)\n","code_same":false,"relative_loc_diff_percent":25.8064516129,"diff":["-n = int(eval(input()))","-x = list(map(int, input().split()))","-y = list(map(int, input().split()))","-p = 0","-q = 0","-p1 = 0","-p2 = 0","-p3 = 0","-max = 0","-for i, j in zip(x, y):","- p1 += abs(i - j)","- p += abs((i - j) ** 2)","- p2 = math.sqrt(p)","- q += abs((i - j) ** 3)","- p3 = math.pow(q, 1.0 \/ 3.0)","- if abs(i - j) > max:","- max = abs(i - j)","-print(p1)","-print(p2)","-print(p3)","-print(max)","+n = int(eval(input()))","+x = [float(x) for x in input().split()]","+y = [float(y) for y in input().split()]","+d = 0","+for i in range(n):","+ d += abs(x[i] - y[i])","+print(d)","+d = 0","+for i in range(n):","+ d += abs((x[i] - y[i]) ** 2)","+d = math.sqrt(d)","+print(d)","+d = 0","+for i in range(n):","+ d += abs((x[i] - y[i]) ** 3)","+d = math.pow(d, 1.0 \/ 3.0)","+print(d)","+d = 0","+for i in range(n):","+ if d <= abs(x[i] - y[i]):","+ d = abs(x[i] - y[i])","+print(d)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0424753301,"measured_runtime_v1":0.037000741,"runtime_lift":1.1479589043,"key":["s545306352","s659017018"]} +{"user_id":"u581187895","problem_id":"p02814","language":"python","submission_id_v0":"s312755863","submission_id_v1":"s952833085","cpu_time_v0":706,"cpu_time_v1":479,"memory_v0":13028,"memory_v1":13024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.15,"input":"import sys\n\nsys.setrecursionlimit(10 ** 7)\n\nread = sys.stdin.buffer.read \n\ninput = sys.stdin.buffer.readline\n\ndef inputS(): return input().rstrip().decode()\n\nreadlines = sys.stdin.buffer.readlines \n\n\n\nfrom functools import reduce\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a%b\n\n return a\n\n\n\ndef lcm(a, b):\n\n return a*b \/\/ gcd(a, b)\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n# 2\u3067\u5272\u3063\u305f\u3082\u306e\u306b\u7f6e\u304d\u63db\u3048 a -> a'\n\nAd = [a\/\/2 for a in A]\n\n\n\n# \u5404\u8981\u7d20\u306b\u3064\u3044\u3066\u30012\u3067\u5272\u308a\u5207\u308c\u308b\u56de\u6570\u304c\u7b49\u3057\u3044\u304b\u30c1\u30a7\u30c3\u30af\n\ndiv2 = None\n\nfor a in Ad:\n\n cnt = 0\n\n while a%2 == 0:\n\n a \/\/= 2\n\n cnt += 1\n\n if div2 is None:\n\n div2 = cnt\n\n elif div2 != cnt:\n\n print((0))\n\n exit()\n\n \n\n# LCM\n\n_lcm = reduce(lcm, Ad)\n\nif _lcm > M:\n\n print((0))\n\n exit()\n\n \n\nprint(((M\/\/_lcm + 1) \/\/ 2)) # \u5207\u308a\u4e0a\u3052\n\n\n","target":"import sys\n\nsys.setrecursionlimit(10 ** 7)\n\nread = sys.stdin.buffer.read \n\ninput = sys.stdin.buffer.readline\n\ndef inputS(): return input().rstrip().decode()\n\nreadlines = sys.stdin.buffer.readlines \n\n\n\nfrom functools import reduce\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a%b\n\n return a\n\n\n\ndef lcm(a, b):\n\n return a*b \/\/ gcd(a, b)\n\n\n\ndef div2cnt(a):\n\n cnt = 0\n\n while a%2 == 0:\n\n a \/\/= 2\n\n cnt += 1\n\n return cnt\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n# 2\u3067\u5272\u3063\u305f\u3082\u306e\u306b\u7f6e\u304d\u63db\u3048 a -> a'\n\nAd = [a\/\/2 for a in A]\n\n\n\n# \u5404\u8981\u7d20\u306b\u3064\u3044\u3066\u30012\u3067\u5272\u308a\u5207\u308c\u308b\u56de\u6570\u304c\u7b49\u3057\u3044\u304b\u30c1\u30a7\u30c3\u30af\n\ndiv2 = div2cnt(Ad[0])\n\nfor a in Ad:\n\n if div2cnt(a) != div2:\n\n print((0))\n\n exit()\n\n \n\n# LCM\n\n_lcm = reduce(lcm, Ad)\n\nif _lcm > M:\n\n print((0))\n\n exit()\n\n \n\nprint(((M\/\/_lcm + 1) \/\/ 2)) # \u5207\u308a\u4e0a\u3052\n\n\n","code_v0_loc":43,"code_v1_loc":44,"code_v0_num_chars":771,"code_v1_num_chars":783,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nread = sys.stdin.buffer.read\ninput = sys.stdin.buffer.readline\n\n\ndef inputS():\n return input().rstrip().decode()\n\n\nreadlines = sys.stdin.buffer.readlines\nfrom functools import reduce\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return a * b \/\/ gcd(a, b)\n\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\n# 2\u3067\u5272\u3063\u305f\u3082\u306e\u306b\u7f6e\u304d\u63db\u3048 a -> a'\nAd = [a \/\/ 2 for a in A]\n# \u5404\u8981\u7d20\u306b\u3064\u3044\u3066\u30012\u3067\u5272\u308a\u5207\u308c\u308b\u56de\u6570\u304c\u7b49\u3057\u3044\u304b\u30c1\u30a7\u30c3\u30af\ndiv2 = None\nfor a in Ad:\n cnt = 0\n while a % 2 == 0:\n a \/\/= 2\n cnt += 1\n if div2 is None:\n div2 = cnt\n elif div2 != cnt:\n print((0))\n exit()\n# LCM\n_lcm = reduce(lcm, Ad)\nif _lcm > M:\n print((0))\n exit()\nprint(((M \/\/ _lcm + 1) \/\/ 2)) # \u5207\u308a\u4e0a\u3052\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nread = sys.stdin.buffer.read\ninput = sys.stdin.buffer.readline\n\n\ndef inputS():\n return input().rstrip().decode()\n\n\nreadlines = sys.stdin.buffer.readlines\nfrom functools import reduce\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return a * b \/\/ gcd(a, b)\n\n\ndef div2cnt(a):\n cnt = 0\n while a % 2 == 0:\n a \/\/= 2\n cnt += 1\n return cnt\n\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\n# 2\u3067\u5272\u3063\u305f\u3082\u306e\u306b\u7f6e\u304d\u63db\u3048 a -> a'\nAd = [a \/\/ 2 for a in A]\n# \u5404\u8981\u7d20\u306b\u3064\u3044\u3066\u30012\u3067\u5272\u308a\u5207\u308c\u308b\u56de\u6570\u304c\u7b49\u3057\u3044\u304b\u30c1\u30a7\u30c3\u30af\ndiv2 = div2cnt(Ad[0])\nfor a in Ad:\n if div2cnt(a) != div2:\n print((0))\n exit()\n# LCM\n_lcm = reduce(lcm, Ad)\nif _lcm > M:\n print((0))\n exit()\nprint(((M \/\/ _lcm + 1) \/\/ 2)) # \u5207\u308a\u4e0a\u3052\n","code_same":false,"relative_loc_diff_percent":2.2727272727,"diff":["+def div2cnt(a):","+ cnt = 0","+ while a % 2 == 0:","+ a \/\/= 2","+ cnt += 1","+ return cnt","+","+","-div2 = None","+div2 = div2cnt(Ad[0])","- cnt = 0","- while a % 2 == 0:","- a \/\/= 2","- cnt += 1","- if div2 is None:","- div2 = cnt","- elif div2 != cnt:","+ if div2cnt(a) != div2:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0371641383,"measured_runtime_v1":0.0384524796,"runtime_lift":0.966495235,"key":["s312755863","s952833085"]} +{"user_id":"u036104576","problem_id":"p03108","language":"python","submission_id_v0":"s862459810","submission_id_v1":"s548199324","cpu_time_v0":812,"cpu_time_v1":542,"memory_v0":19424,"memory_v1":29976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.25,"input":"import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nfrom collections import defaultdict\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nclass UnionFind(object):\n\n def __init__(self, n = 1):\n\n self.link = [i for i in range(n)]\n\n self.size = [1 for _ in range(n)]\n\n\n\n def find(self, x):\n\n if self.link[x] == x:\n\n return x\n\n\n\n # re-connect union find to make the height of tree lower\n\n # you can use while, but recursion makes it easier to reconnect\n\n self.link[x] = self.find(self.link[x])\n\n return self.link[x]\n\n\n\n def is_same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def unite(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:\n\n return\n\n\n\n if self.size[x] < self.size[y]:\n\n x, y = y, x\n\n self.link[y] = x\n\n self.size[x] += self.size[y]\n\n \n\n def get_size(self, x):\n\n x = self.find(x)\n\n return self.size[x]\n\n\n\n# from union_find import *\n\n\n\n# n, m = map(int, readline().split())\n\n\n\n# u = UnionFind(n)\n\n\n\n# a = [0 for _ in range(m)]\n\n# b = [0 for _ in range(m)]\n\n\n\n# for i in range(m):\n\n# a[i], b[i] = map(lambda x: int(x) - 1, readline().split())\n\n\n\n# ans = [None for _ in range(m)]\n\n\n\n# ans[-1] = n * (n - 1) \/\/ 2\n\n\n\n# for i in range(m - 1, 0, -1):\n\n# x = a[i]\n\n# y = b[i]\n\n# if u.is_same(x, y):\n\n# ans[i - 1] = ans[i]\n\n# else:\n\n# ans[i - 1] = ans[i] - (u.get_size(x) * u.get_size(y))\n\n# u.unite(x, y)\n\n\n\n# for a in ans:\n\n# print(a)\n\n\n\nN, M = list(map(int, input().split()))\n\nA, B = [None] * M, [None] * M\n\nfor i in range(M):\n\n A[i], B[i] = list(map(int, input().split()))\n\n\n\nuf = UnionFind(N)\n\nans = [None] * M\n\nans[M - 1] = N * (N - 1) \/\/ 2\n\nfor i in range(M - 1, 0, -1):\n\n x, y = A[i] - 1, B[i] - 1\n\n if uf.is_same(x, y):\n\n ans[i - 1] = ans[i]\n\n else:\n\n ans[i - 1] = ans[i] - (uf.get_size(x) * uf.get_size(y))\n\n uf.unite(x, y)\n\n\n\nfor a in ans:\n\n print(a)","target":"import sys\n\nimport itertools\n\n# import numpy as np\n\nimport time\n\nimport math\n\n \n\nsys.setrecursionlimit(10 ** 7)\n\n \n\nfrom collections import defaultdict\n\n \n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\n\n\nclass UnionFind(object):\n\n def __init__(self, n = 1):\n\n self.link = [i for i in range(n)]\n\n self.size = [1 for _ in range(n)]\n\n\n\n def find(self, x):\n\n if self.link[x] == x:\n\n return x\n\n\n\n # re-connect union find to make the height of tree lower\n\n # you can use while, but recursion makes it easier to reconnect\n\n self.link[x] = self.find(self.link[x])\n\n return self.link[x]\n\n\n\n def is_same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def unite(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:\n\n return\n\n\n\n if self.size[x] < self.size[y]:\n\n x, y = y, x\n\n self.link[y] = x\n\n self.size[x] += self.size[y]\n\n \n\n def get_size(self, x):\n\n x = self.find(x)\n\n return self.size[x]\n\n\n\nes = [0] * M\n\nfor i in range(M):\n\n a, b = list(map(int, input().split()))\n\n es[i] = (a - 1, b - 1)\n\n\n\nu = UnionFind(N)\n\nans = []\n\npair = N * (N - 1) \/\/ 2\n\nans.append(pair)\n\nfor i in range(M - 1, -1, -1):\n\n a, b = es[i]\n\n if u.is_same(a, b):\n\n ans.append(pair)\n\n continue\n\n pair -= (u.get_size(a) * u.get_size(b))\n\n u.unite(a ,b)\n\n if pair < 0:\n\n pair = 0\n\n ans.append(pair)\n\n\n\nfor i in list(reversed(ans))[1:]:\n\n print(i)","code_v0_loc":91,"code_v1_loc":71,"code_v0_num_chars":2124,"code_v1_num_chars":1630,"code_v0_no_empty_lines":"import sys\nimport itertools\n\n# import numpy as np\nimport time\n\nsys.setrecursionlimit(10**7)\nfrom collections import defaultdict\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\nclass UnionFind(object):\n def __init__(self, n=1):\n self.link = [i for i in range(n)]\n self.size = [1 for _ in range(n)]\n\n def find(self, x):\n if self.link[x] == x:\n return x\n # re-connect union find to make the height of tree lower\n # you can use while, but recursion makes it easier to reconnect\n self.link[x] = self.find(self.link[x])\n return self.link[x]\n\n def is_same(self, x, y):\n return self.find(x) == self.find(y)\n\n def unite(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.size[x] < self.size[y]:\n x, y = y, x\n self.link[y] = x\n self.size[x] += self.size[y]\n\n def get_size(self, x):\n x = self.find(x)\n return self.size[x]\n\n\n# from union_find import *\n# n, m = map(int, readline().split())\n# u = UnionFind(n)\n# a = [0 for _ in range(m)]\n# b = [0 for _ in range(m)]\n# for i in range(m):\n# a[i], b[i] = map(lambda x: int(x) - 1, readline().split())\n# ans = [None for _ in range(m)]\n# ans[-1] = n * (n - 1) \/\/ 2\n# for i in range(m - 1, 0, -1):\n# x = a[i]\n# y = b[i]\n# if u.is_same(x, y):\n# ans[i - 1] = ans[i]\n# else:\n# ans[i - 1] = ans[i] - (u.get_size(x) * u.get_size(y))\n# u.unite(x, y)\n# for a in ans:\n# print(a)\nN, M = list(map(int, input().split()))\nA, B = [None] * M, [None] * M\nfor i in range(M):\n A[i], B[i] = list(map(int, input().split()))\nuf = UnionFind(N)\nans = [None] * M\nans[M - 1] = N * (N - 1) \/\/ 2\nfor i in range(M - 1, 0, -1):\n x, y = A[i] - 1, B[i] - 1\n if uf.is_same(x, y):\n ans[i - 1] = ans[i]\n else:\n ans[i - 1] = ans[i] - (uf.get_size(x) * uf.get_size(y))\n uf.unite(x, y)\nfor a in ans:\n print(a)\n","code_v1_no_empty_lines":"import sys\nimport itertools\n\n# import numpy as np\nimport time\nimport math\n\nsys.setrecursionlimit(10**7)\nfrom collections import defaultdict\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN, M = list(map(int, input().split()))\n\n\nclass UnionFind(object):\n def __init__(self, n=1):\n self.link = [i for i in range(n)]\n self.size = [1 for _ in range(n)]\n\n def find(self, x):\n if self.link[x] == x:\n return x\n # re-connect union find to make the height of tree lower\n # you can use while, but recursion makes it easier to reconnect\n self.link[x] = self.find(self.link[x])\n return self.link[x]\n\n def is_same(self, x, y):\n return self.find(x) == self.find(y)\n\n def unite(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.size[x] < self.size[y]:\n x, y = y, x\n self.link[y] = x\n self.size[x] += self.size[y]\n\n def get_size(self, x):\n x = self.find(x)\n return self.size[x]\n\n\nes = [0] * M\nfor i in range(M):\n a, b = list(map(int, input().split()))\n es[i] = (a - 1, b - 1)\nu = UnionFind(N)\nans = []\npair = N * (N - 1) \/\/ 2\nans.append(pair)\nfor i in range(M - 1, -1, -1):\n a, b = es[i]\n if u.is_same(a, b):\n ans.append(pair)\n continue\n pair -= u.get_size(a) * u.get_size(b)\n u.unite(a, b)\n if pair < 0:\n pair = 0\n ans.append(pair)\nfor i in list(reversed(ans))[1:]:\n print(i)\n","code_same":false,"relative_loc_diff_percent":21.978021978,"diff":["+import math","+N, M = list(map(int, input().split()))","-# from union_find import *","-# n, m = map(int, readline().split())","-# u = UnionFind(n)","-# a = [0 for _ in range(m)]","-# b = [0 for _ in range(m)]","-# for i in range(m):","-# a[i], b[i] = map(lambda x: int(x) - 1, readline().split())","-# ans = [None for _ in range(m)]","-# ans[-1] = n * (n - 1) \/\/ 2","-# for i in range(m - 1, 0, -1):","-# x = a[i]","-# y = b[i]","-# if u.is_same(x, y):","-# ans[i - 1] = ans[i]","-# else:","-# ans[i - 1] = ans[i] - (u.get_size(x) * u.get_size(y))","-# u.unite(x, y)","-# for a in ans:","-# print(a)","-N, M = list(map(int, input().split()))","-A, B = [None] * M, [None] * M","+es = [0] * M","- A[i], B[i] = list(map(int, input().split()))","-uf = UnionFind(N)","-ans = [None] * M","-ans[M - 1] = N * (N - 1) \/\/ 2","-for i in range(M - 1, 0, -1):","- x, y = A[i] - 1, B[i] - 1","- if uf.is_same(x, y):","- ans[i - 1] = ans[i]","- else:","- ans[i - 1] = ans[i] - (uf.get_size(x) * uf.get_size(y))","- uf.unite(x, y)","-for a in ans:","- print(a)","+ a, b = list(map(int, input().split()))","+ es[i] = (a - 1, b - 1)","+u = UnionFind(N)","+ans = []","+pair = N * (N - 1) \/\/ 2","+ans.append(pair)","+for i in range(M - 1, -1, -1):","+ a, b = es[i]","+ if u.is_same(a, b):","+ ans.append(pair)","+ continue","+ pair -= u.get_size(a) * u.get_size(b)","+ u.unite(a, b)","+ if pair < 0:","+ pair = 0","+ ans.append(pair)","+for i in list(reversed(ans))[1:]:","+ print(i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0491566985,"measured_runtime_v1":0.04923809,"runtime_lift":0.9983469793,"key":["s862459810","s548199324"]} +{"user_id":"u352394527","problem_id":"p00069","language":"python","submission_id_v0":"s202903440","submission_id_v1":"s701649998","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":5612,"memory_v1":5616,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"def main():\n\n while True:\n\n n = int(eval(input()))\n\n if not n:\n\n break\n\n \n\n start = int(eval(input())) - 1 #\u958b\u59cb\u306e\u4f4d\u7f6e\n\n goal = int(eval(input())) - 1 #\u3042\u305f\u308a\u306e\u4f4d\u7f6e\n\n d = int(eval(input()))\n\n \n\n nums = [[i for i in range(n)]] #\u5404\u6bb5\u3067\u306e\u6570\u5b57\u306e\u4e26\u3073\n\n bars = [] #\u6a2a\u68d2\u30ea\u30b9\u30c8\n\n \n\n for i in range(d):\n\n s = eval(input())\n\n bars.append(s)\n\n new = nums[-1][:]\n\n \n\n for j in range(n - 1):\n\n if s[j] == \"1\": #\u6a2a\u68d2\u304c\u3042\u308c\u3070\u5165\u308c\u66ff\u3048\n\n new[j], new[j + 1] = new[j + 1], new[j]\n\n \n\n nums.append(new)\n\n \n\n to_goal = nums[-1][goal] #\u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u521d\u671f\u4f4d\u7f6e\n\n \n\n if to_goal == start: #\u5143\u304b\u3089\u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u5834\u5408\n\n print((0))\n\n \n\n else: #\u5404\u6bb5\u306b\u3064\u3044\u3066\u3001to_goal\u3068\u30b9\u30bf\u30fc\u30c8\u304c\u96a3\u308a\u5408\u3046\u304b\u30c1\u30a7\u30c3\u30af\n\n for i, status in enumerate(nums[1:]):\n\n to_goal_ind = status.index(to_goal) #to_goal\u306e\u4f4d\u7f6e\n\n start_ind = status.index(start) #start\u306e\u4f4d\u7f6e\n\n ind1, ind2 = min(to_goal_ind, start_ind), max(to_goal_ind, start_ind)\n\n \n\n if ind2 - ind1 == 1: #\u96a3\u3042\u3063\u3066\u3044\u305f\u5834\u5408\n\n if (bars[i][ind1] == \"0\") and (ind1 == 0 or bars[i][ind1 - 1] == \"0\") and (ind2 == n - 1 or bars[i][ind2] == \"0\"): #\u96a3\u308a\u5408\u3046\u6a2a\u68d2\u304c\u306a\u3051\u308c\u3070(\u5165\u308c\u66ff\u3048\u53ef\u80fd\u306a\u3089\u3070)\u51fa\u529b\n\n print((i + 1, ind1 + 1))\n\n break\n\n else:\n\n print((1))\n\n\n\nmain()\n","target":"while True:\n\n n = int(eval(input()))\n\n if not n:\n\n break\n\n\n\n start = int(eval(input())) - 1 #\u958b\u59cb\u306e\u4f4d\u7f6e\n\n goal = int(eval(input())) - 1 #\u3042\u305f\u308a\u306e\u4f4d\u7f6e\n\n d = int(eval(input()))\n\n \n\n nums = [[i for i in range(n)]] #\u5404\u6bb5\u3067\u306e\u6570\u5b57\u306e\u4e26\u3073\n\n bars = [] #\u6a2a\u68d2\u30ea\u30b9\u30c8\n\n \n\n for i in range(d):\n\n s = eval(input())\n\n bars.append(s)\n\n new = nums[-1][:]\n\n\n\n for j in range(n - 1):\n\n if s[j] == \"1\": #\u6a2a\u68d2\u304c\u3042\u308c\u3070\u5165\u308c\u66ff\u3048\n\n new[j], new[j + 1] = new[j + 1], new[j]\n\n\n\n nums.append(new)\n\n \n\n to_goal = nums[-1][goal] #\u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u521d\u671f\u4f4d\u7f6e\n\n \n\n if to_goal == start: #\u5143\u304b\u3089\u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u5834\u5408\n\n print((0))\n\n\n\n else: #\u5404\u6bb5\u306b\u3064\u3044\u3066\u3001to_goal\u3068\u30b9\u30bf\u30fc\u30c8\u304c\u96a3\u308a\u5408\u3046\u304b\u30c1\u30a7\u30c3\u30af\n\n for i, status in enumerate(nums[1:]):\n\n to_goal_ind = status.index(to_goal) #to_goal\u306e\u4f4d\u7f6e\n\n start_ind = status.index(start) #start\u306e\u4f4d\u7f6e\n\n ind1, ind2 = min(to_goal_ind, start_ind), max(to_goal_ind, start_ind)\n\n \n\n if (ind2 - ind1 == 1 #\u96a3\u308a\u5408\u3063\u3066\u3044\u3066\u3001 \n\n and bars[i][ind1] == \"0\" #\u8a72\u5f53\u4f4d\u7f6e\u3068\n\n and (ind1 == 0 or bars[i][ind1 - 1] == \"0\") #\u5de6\u3068\n\n and (ind2 == n - 1 or bars[i][ind2] == \"0\")): #\u53f3\u306b\u3001\u8fba\u304c\u306a\u3051\u308c\u3070\u51fa\u529b\n\n print((i + 1, ind1 + 1))\n\n break\n\n else:\n\n print((1))\n\n\n","code_v0_loc":43,"code_v1_loc":43,"code_v0_num_chars":1194,"code_v1_num_chars":1170,"code_v0_no_empty_lines":"def main():\n while True:\n n = int(eval(input()))\n if not n:\n break\n start = int(eval(input())) - 1 # \u958b\u59cb\u306e\u4f4d\u7f6e\n goal = int(eval(input())) - 1 # \u3042\u305f\u308a\u306e\u4f4d\u7f6e\n d = int(eval(input()))\n nums = [[i for i in range(n)]] # \u5404\u6bb5\u3067\u306e\u6570\u5b57\u306e\u4e26\u3073\n bars = [] # \u6a2a\u68d2\u30ea\u30b9\u30c8\n for i in range(d):\n s = eval(input())\n bars.append(s)\n new = nums[-1][:]\n for j in range(n - 1):\n if s[j] == \"1\": # \u6a2a\u68d2\u304c\u3042\u308c\u3070\u5165\u308c\u66ff\u3048\n new[j], new[j + 1] = new[j + 1], new[j]\n nums.append(new)\n to_goal = nums[-1][goal] # \u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u521d\u671f\u4f4d\u7f6e\n if to_goal == start: # \u5143\u304b\u3089\u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u5834\u5408\n print((0))\n else: # \u5404\u6bb5\u306b\u3064\u3044\u3066\u3001to_goal\u3068\u30b9\u30bf\u30fc\u30c8\u304c\u96a3\u308a\u5408\u3046\u304b\u30c1\u30a7\u30c3\u30af\n for i, status in enumerate(nums[1:]):\n to_goal_ind = status.index(to_goal) # to_goal\u306e\u4f4d\u7f6e\n start_ind = status.index(start) # start\u306e\u4f4d\u7f6e\n ind1, ind2 = min(to_goal_ind, start_ind), max(to_goal_ind, start_ind)\n if ind2 - ind1 == 1: # \u96a3\u3042\u3063\u3066\u3044\u305f\u5834\u5408\n if (\n (bars[i][ind1] == \"0\")\n and (ind1 == 0 or bars[i][ind1 - 1] == \"0\")\n and (ind2 == n - 1 or bars[i][ind2] == \"0\")\n ): # \u96a3\u308a\u5408\u3046\u6a2a\u68d2\u304c\u306a\u3051\u308c\u3070(\u5165\u308c\u66ff\u3048\u53ef\u80fd\u306a\u3089\u3070)\u51fa\u529b\n print((i + 1, ind1 + 1))\n break\n else:\n print((1))\n\n\nmain()\n","code_v1_no_empty_lines":"while True:\n n = int(eval(input()))\n if not n:\n break\n start = int(eval(input())) - 1 # \u958b\u59cb\u306e\u4f4d\u7f6e\n goal = int(eval(input())) - 1 # \u3042\u305f\u308a\u306e\u4f4d\u7f6e\n d = int(eval(input()))\n nums = [[i for i in range(n)]] # \u5404\u6bb5\u3067\u306e\u6570\u5b57\u306e\u4e26\u3073\n bars = [] # \u6a2a\u68d2\u30ea\u30b9\u30c8\n for i in range(d):\n s = eval(input())\n bars.append(s)\n new = nums[-1][:]\n for j in range(n - 1):\n if s[j] == \"1\": # \u6a2a\u68d2\u304c\u3042\u308c\u3070\u5165\u308c\u66ff\u3048\n new[j], new[j + 1] = new[j + 1], new[j]\n nums.append(new)\n to_goal = nums[-1][goal] # \u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u521d\u671f\u4f4d\u7f6e\n if to_goal == start: # \u5143\u304b\u3089\u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u5834\u5408\n print((0))\n else: # \u5404\u6bb5\u306b\u3064\u3044\u3066\u3001to_goal\u3068\u30b9\u30bf\u30fc\u30c8\u304c\u96a3\u308a\u5408\u3046\u304b\u30c1\u30a7\u30c3\u30af\n for i, status in enumerate(nums[1:]):\n to_goal_ind = status.index(to_goal) # to_goal\u306e\u4f4d\u7f6e\n start_ind = status.index(start) # start\u306e\u4f4d\u7f6e\n ind1, ind2 = min(to_goal_ind, start_ind), max(to_goal_ind, start_ind)\n if (\n ind2 - ind1 == 1 # \u96a3\u308a\u5408\u3063\u3066\u3044\u3066\u3001\n and bars[i][ind1] == \"0\" # \u8a72\u5f53\u4f4d\u7f6e\u3068\n and (ind1 == 0 or bars[i][ind1 - 1] == \"0\") # \u5de6\u3068\n and (ind2 == n - 1 or bars[i][ind2] == \"0\")\n ): # \u53f3\u306b\u3001\u8fba\u304c\u306a\u3051\u308c\u3070\u51fa\u529b\n print((i + 1, ind1 + 1))\n break\n else:\n print((1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-def main():","- while True:","- n = int(eval(input()))","- if not n:","- break","- start = int(eval(input())) - 1 # \u958b\u59cb\u306e\u4f4d\u7f6e","- goal = int(eval(input())) - 1 # \u3042\u305f\u308a\u306e\u4f4d\u7f6e","- d = int(eval(input()))","- nums = [[i for i in range(n)]] # \u5404\u6bb5\u3067\u306e\u6570\u5b57\u306e\u4e26\u3073","- bars = [] # \u6a2a\u68d2\u30ea\u30b9\u30c8","- for i in range(d):","- s = eval(input())","- bars.append(s)","- new = nums[-1][:]","- for j in range(n - 1):","- if s[j] == \"1\": # \u6a2a\u68d2\u304c\u3042\u308c\u3070\u5165\u308c\u66ff\u3048","- new[j], new[j + 1] = new[j + 1], new[j]","- nums.append(new)","- to_goal = nums[-1][goal] # \u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u521d\u671f\u4f4d\u7f6e","- if to_goal == start: # \u5143\u304b\u3089\u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u5834\u5408","- print((0))","- else: # \u5404\u6bb5\u306b\u3064\u3044\u3066\u3001to_goal\u3068\u30b9\u30bf\u30fc\u30c8\u304c\u96a3\u308a\u5408\u3046\u304b\u30c1\u30a7\u30c3\u30af","- for i, status in enumerate(nums[1:]):","- to_goal_ind = status.index(to_goal) # to_goal\u306e\u4f4d\u7f6e","- start_ind = status.index(start) # start\u306e\u4f4d\u7f6e","- ind1, ind2 = min(to_goal_ind, start_ind), max(to_goal_ind, start_ind)","- if ind2 - ind1 == 1: # \u96a3\u3042\u3063\u3066\u3044\u305f\u5834\u5408","- if (","- (bars[i][ind1] == \"0\")","- and (ind1 == 0 or bars[i][ind1 - 1] == \"0\")","- and (ind2 == n - 1 or bars[i][ind2] == \"0\")","- ): # \u96a3\u308a\u5408\u3046\u6a2a\u68d2\u304c\u306a\u3051\u308c\u3070(\u5165\u308c\u66ff\u3048\u53ef\u80fd\u306a\u3089\u3070)\u51fa\u529b","- print((i + 1, ind1 + 1))","- break","- else:","- print((1))","-","-","-main()","+while True:","+ n = int(eval(input()))","+ if not n:","+ break","+ start = int(eval(input())) - 1 # \u958b\u59cb\u306e\u4f4d\u7f6e","+ goal = int(eval(input())) - 1 # \u3042\u305f\u308a\u306e\u4f4d\u7f6e","+ d = int(eval(input()))","+ nums = [[i for i in range(n)]] # \u5404\u6bb5\u3067\u306e\u6570\u5b57\u306e\u4e26\u3073","+ bars = [] # \u6a2a\u68d2\u30ea\u30b9\u30c8","+ for i in range(d):","+ s = eval(input())","+ bars.append(s)","+ new = nums[-1][:]","+ for j in range(n - 1):","+ if s[j] == \"1\": # \u6a2a\u68d2\u304c\u3042\u308c\u3070\u5165\u308c\u66ff\u3048","+ new[j], new[j + 1] = new[j + 1], new[j]","+ nums.append(new)","+ to_goal = nums[-1][goal] # \u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u521d\u671f\u4f4d\u7f6e","+ if to_goal == start: # \u5143\u304b\u3089\u3042\u305f\u308a\u306b\u305f\u3069\u308a\u7740\u304f\u5834\u5408","+ print((0))","+ else: # \u5404\u6bb5\u306b\u3064\u3044\u3066\u3001to_goal\u3068\u30b9\u30bf\u30fc\u30c8\u304c\u96a3\u308a\u5408\u3046\u304b\u30c1\u30a7\u30c3\u30af","+ for i, status in enumerate(nums[1:]):","+ to_goal_ind = status.index(to_goal) # to_goal\u306e\u4f4d\u7f6e","+ start_ind = status.index(start) # start\u306e\u4f4d\u7f6e","+ ind1, ind2 = min(to_goal_ind, start_ind), max(to_goal_ind, start_ind)","+ if (","+ ind2 - ind1 == 1 # \u96a3\u308a\u5408\u3063\u3066\u3044\u3066\u3001","+ and bars[i][ind1] == \"0\" # \u8a72\u5f53\u4f4d\u7f6e\u3068","+ and (ind1 == 0 or bars[i][ind1 - 1] == \"0\") # \u5de6\u3068","+ and (ind2 == n - 1 or bars[i][ind2] == \"0\")","+ ): # \u53f3\u306b\u3001\u8fba\u304c\u306a\u3051\u308c\u3070\u51fa\u529b","+ print((i + 1, ind1 + 1))","+ break","+ else:","+ print((1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0495740714,"measured_runtime_v1":0.0727737999,"runtime_lift":0.6812076801,"key":["s202903440","s701649998"]} +{"user_id":"u192908410","problem_id":"p03317","language":"python","submission_id_v0":"s273015659","submission_id_v1":"s749431376","cpu_time_v0":43,"cpu_time_v1":18,"memory_v0":13812,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.14,"input":"import math\n\nn,k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nm = a.index(min(a))\n\nprint((math.ceil((len(a)-1)\/(k-1))))","target":"import math\n\nprint(((lambda x:math.ceil((int(x[0])-1)\/(int(x[1])-1)))(input().split())))","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":144,"code_v1_num_chars":86,"code_v0_no_empty_lines":"import math\n\nn, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nm = a.index(min(a))\nprint((math.ceil((len(a) - 1) \/ (k - 1))))\n","code_v1_no_empty_lines":"import math\n\nprint(((lambda x: math.ceil((int(x[0]) - 1) \/ (int(x[1]) - 1)))(input().split())))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-n, k = list(map(int, input().split()))","-a = list(map(int, input().split()))","-m = a.index(min(a))","-print((math.ceil((len(a) - 1) \/ (k - 1))))","+print(((lambda x: math.ceil((int(x[0]) - 1) \/ (int(x[1]) - 1)))(input().split())))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0996729434,"measured_runtime_v1":0.0380255234,"runtime_lift":2.6212116061,"key":["s273015659","s749431376"]} +{"user_id":"u278057806","problem_id":"p02623","language":"python","submission_id_v0":"s502252116","submission_id_v1":"s413882139","cpu_time_v0":479,"cpu_time_v1":339,"memory_v0":41412,"memory_v1":49412,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.23,"input":"from sys import stdin\n\nfrom bisect import bisect\n\ninput = stdin.readline\n\n\n\nN, M, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\n\n\nfor i in range(1, N):\n\n A[i] += A[i - 1]\n\n\n\nfor i in range(1, M):\n\n B[i] += B[i - 1]\n\n\n\nans = 0\n\n\n\nfor i, a in enumerate(A):\n\n time = K - a\n\n if time < 0:\n\n break\n\n cnt = i + 1\n\n if time != 0:\n\n tmp = bisect(B, time)\n\n cnt += tmp\n\n ans = max(ans, cnt)\n\n\n\nfor i, b in enumerate(B):\n\n time = K - b\n\n if time < 0:\n\n break\n\n cnt = i + 1\n\n if time != 0:\n\n tmp = bisect(A, time)\n\n cnt += tmp\n\n ans = max(ans, cnt)\n\n\n\nprint(ans)\n","target":"from sys import stdin\n\ninput = stdin.readline\n\n\n\nN, M, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\n\n\nsumA = [0]\n\nsumB = [0]\n\n\n\n\n\nfor i in range(N):\n\n sumA.append(sumA[i] + A[i])\n\n\n\nfor i in range(M):\n\n sumB.append(sumB[i] + B[i])\n\n\n\nans = 0\n\nt = M\n\n\n\nfor i in range(N + 1):\n\n for j in range(t, -1, -1):\n\n if K < sumA[i] + sumB[j]:\n\n t -= 1\n\n continue\n\n else:\n\n ans = max(ans, i + j)\n\n break\n\n\n\nprint(ans)\n","code_v0_loc":37,"code_v1_loc":30,"code_v0_num_chars":689,"code_v1_num_chars":533,"code_v0_no_empty_lines":"from sys import stdin\nfrom bisect import bisect\n\ninput = stdin.readline\nN, M, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nfor i in range(1, N):\n A[i] += A[i - 1]\nfor i in range(1, M):\n B[i] += B[i - 1]\nans = 0\nfor i, a in enumerate(A):\n time = K - a\n if time < 0:\n break\n cnt = i + 1\n if time != 0:\n tmp = bisect(B, time)\n cnt += tmp\n ans = max(ans, cnt)\nfor i, b in enumerate(B):\n time = K - b\n if time < 0:\n break\n cnt = i + 1\n if time != 0:\n tmp = bisect(A, time)\n cnt += tmp\n ans = max(ans, cnt)\nprint(ans)\n","code_v1_no_empty_lines":"from sys import stdin\n\ninput = stdin.readline\nN, M, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nsumA = [0]\nsumB = [0]\nfor i in range(N):\n sumA.append(sumA[i] + A[i])\nfor i in range(M):\n sumB.append(sumB[i] + B[i])\nans = 0\nt = M\nfor i in range(N + 1):\n for j in range(t, -1, -1):\n if K < sumA[i] + sumB[j]:\n t -= 1\n continue\n else:\n ans = max(ans, i + j)\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.9189189189,"diff":["-from bisect import bisect","-for i in range(1, N):","- A[i] += A[i - 1]","-for i in range(1, M):","- B[i] += B[i - 1]","+sumA = [0]","+sumB = [0]","+for i in range(N):","+ sumA.append(sumA[i] + A[i])","+for i in range(M):","+ sumB.append(sumB[i] + B[i])","-for i, a in enumerate(A):","- time = K - a","- if time < 0:","- break","- cnt = i + 1","- if time != 0:","- tmp = bisect(B, time)","- cnt += tmp","- ans = max(ans, cnt)","-for i, b in enumerate(B):","- time = K - b","- if time < 0:","- break","- cnt = i + 1","- if time != 0:","- tmp = bisect(A, time)","- cnt += tmp","- ans = max(ans, cnt)","+t = M","+for i in range(N + 1):","+ for j in range(t, -1, -1):","+ if K < sumA[i] + sumB[j]:","+ t -= 1","+ continue","+ else:","+ ans = max(ans, i + j)","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.0745096734,"measured_runtime_v1":0.2044781072,"runtime_lift":0.3643894907,"key":["s502252116","s413882139"]} +{"user_id":"u676707608","problem_id":"p03470","language":"python","submission_id_v0":"s492838566","submission_id_v1":"s899987384","cpu_time_v0":20,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"n=int(eval(input()))\n\nx=set()\n\nfor i in range(n):\n\n x.add(int(eval(input())))\n\nprint((len(x)))","target":"n=int(eval(input()))\n\nprint((len(set(eval(input()) for i in range(n)))))\n","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":83,"code_v1_num_chars":59,"code_v0_no_empty_lines":"n = int(eval(input()))\nx = set()\nfor i in range(n):\n x.add(int(eval(input())))\nprint((len(x)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nprint((len(set(eval(input()) for i in range(n)))))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-x = set()","-for i in range(n):","- x.add(int(eval(input())))","-print((len(x)))","+print((len(set(eval(input()) for i in range(n)))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0725538189,"measured_runtime_v1":0.0716870999,"runtime_lift":1.0120903063,"key":["s492838566","s899987384"]} +{"user_id":"u021019433","problem_id":"p02658","language":"python","submission_id_v0":"s238190522","submission_id_v1":"s967279073","cpu_time_v0":77,"cpu_time_v1":51,"memory_v0":19204,"memory_v1":19316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.77,"input":"eval(input())\n\nr = 1\n\nfor x in input().split():\n\n r = max(-1, r * int(x))\n\n if r > 1e18:\n\n r = -1\n\nprint(r)\n","target":"eval(input())\n\nr = 1\n\nfor x in map(int, input().split()):\n\n if x == 0:\n\n r = 0\n\n break\n\n if r > 0:\n\n r *= x\n\n if r > 1e18:\n\n r = -1\n\nprint(r)","code_v0_loc":7,"code_v1_loc":11,"code_v0_num_chars":107,"code_v1_num_chars":154,"code_v0_no_empty_lines":"eval(input())\nr = 1\nfor x in input().split():\n r = max(-1, r * int(x))\n if r > 1e18:\n r = -1\nprint(r)\n","code_v1_no_empty_lines":"eval(input())\nr = 1\nfor x in map(int, input().split()):\n if x == 0:\n r = 0\n break\n if r > 0:\n r *= x\n if r > 1e18:\n r = -1\nprint(r)\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-for x in input().split():","- r = max(-1, r * int(x))","- if r > 1e18:","- r = -1","+for x in map(int, input().split()):","+ if x == 0:","+ r = 0","+ break","+ if r > 0:","+ r *= x","+ if r > 1e18:","+ r = -1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0431110907,"measured_runtime_v1":0.0427957923,"runtime_lift":1.0073675072,"key":["s238190522","s967279073"]} +{"user_id":"u360515075","problem_id":"p02726","language":"python","submission_id_v0":"s414835832","submission_id_v1":"s141494532","cpu_time_v0":1974,"cpu_time_v1":1760,"memory_v0":67796,"memory_v1":3444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.84,"input":"from collections import Counter\n\nN,X,Y = list(map(int, input().split()))\n\nX -= 1\n\nY -= 1\n\nL = []\n\nfor i in range(N-1):\n\n for j in range(i+1,N):\n\n L.append(min(abs(i-j),abs(X-i)+abs(Y-j)+1,abs(Y-i)+abs(X-j)+1))\n\nD = Counter(L)\n\nfor k in range(1,N):\n\n print((D[k]))","target":"N,X,Y = map(int, input().split())\n\nD = [0] * N\n\nfor i in range(1,N):\n\n for j in range(i+1,N+1):\n\n D[min(abs(i-j),abs(X-i)+abs(Y-j)+1,abs(Y-i)+abs(X-j)+1)] += 1 \n\nprint (*D[1:], sep=\"\\n\")\n","code_v0_loc":11,"code_v1_loc":6,"code_v0_num_chars":261,"code_v1_num_chars":190,"code_v0_no_empty_lines":"from collections import Counter\n\nN, X, Y = list(map(int, input().split()))\nX -= 1\nY -= 1\nL = []\nfor i in range(N - 1):\n for j in range(i + 1, N):\n L.append(\n min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(Y - i) + abs(X - j) + 1)\n )\nD = Counter(L)\nfor k in range(1, N):\n print((D[k]))\n","code_v1_no_empty_lines":"N, X, Y = map(int, input().split())\nD = [0] * N\nfor i in range(1, N):\n for j in range(i + 1, N + 1):\n D[\n min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(Y - i) + abs(X - j) + 1)\n ] += 1\nprint(*D[1:], sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-from collections import Counter","-","-N, X, Y = list(map(int, input().split()))","-X -= 1","-Y -= 1","-L = []","-for i in range(N - 1):","- for j in range(i + 1, N):","- L.append(","+N, X, Y = map(int, input().split())","+D = [0] * N","+for i in range(1, N):","+ for j in range(i + 1, N + 1):","+ D[","- )","-D = Counter(L)","-for k in range(1, N):","- print((D[k]))","+ ] += 1","+print(*D[1:], sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0382250392,"measured_runtime_v1":0.0365661416,"runtime_lift":1.0453670405,"key":["s414835832","s141494532"]} +{"user_id":"u368780724","problem_id":"p03184","language":"python","submission_id_v0":"s569074541","submission_id_v1":"s831391747","cpu_time_v0":1587,"cpu_time_v1":1292,"memory_v0":55292,"memory_v1":54860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.59,"input":"mod = 10**9+7\n\nfrac = [1]*200001\n\nfor i in range(2,200001):\n\n frac[i] = i * frac[i-1]%mod\n\nfraci = [None]*200001\n\nfraci[-1] = pow(frac[-1], mod -2, mod)\n\nfor i in range(-2, -200001-1, -1):\n\n fraci[i] = fraci[i+1] * (200001 + i + 1) % mod\n\ndef comb(a, b):\n\n if not a >= b >= 0:\n\n return 0\n\n return frac[a]*fraci[b]*fraci[a-b]%mod\n\n\n\ndef count(a, b):\n\n (r1, c1), (r2, c2) = RC[a], RC[b]\n\n if c2 < c1:\n\n return 0\n\n return comb(r2-r1 + c2-c1, r2-r1)\n\n\n\nH, W, N = list(map(int, input().split()))\n\n\n\nRC = [list(map(int, input().split())) for _ in range(N)] + [[1, 1], [H, W]]\n\nRC.sort()\n\n\n\ndpe = [0]*(N+2)\n\ndpo = [0]*(N+2)\n\ndpe[0] += 1\n\n\n\nfor i in range(1, N+2):\n\n rese = 0\n\n reso = 0\n\n for k in range(i):\n\n t = count(k, i)\n\n if not t:\n\n continue\n\n rese = (rese + t*dpo[k]) % mod\n\n reso = (reso + t*dpe[k]) % mod\n\n dpe[i] = rese\n\n dpo[i] = reso\n\n\n\nprint(((dpo[-1] - dpe[-1]) % mod))\n","target":"mod = 10**9+7\n\nfrac = [1]*200001\n\nfor i in range(2,200001):\n\n frac[i] = i * frac[i-1]%mod\n\nfraci = [None]*200001\n\nfraci[-1] = pow(frac[-1], mod -2, mod)\n\nfor i in range(-2, -200001-1, -1):\n\n fraci[i] = fraci[i+1] * (200001 + i + 1) % mod\n\ndef comb(a, b):\n\n if not a >= b >= 0:\n\n return 0\n\n return frac[a]*fraci[b]*fraci[a-b]%mod\n\n\n\ndef count(a, b):\n\n (r1, c1), (r2, c2) = RC[a], RC[b]\n\n if c2 < c1:\n\n return 0\n\n return comb(r2-r1 + c2-c1, r2-r1)\n\n\n\nH, W, N = list(map(int, input().split()))\n\n\n\nRC = [list(map(int, input().split())) for _ in range(N)] + [[1, 1], [H, W]]\n\nRC.sort()\n\n\n\ndp = [0]*(N+2)\n\ndp[0] += 1\n\n\n\nfor i in range(1, N+2):\n\n res = count(0, i)\n\n for k in range(1, i):\n\n res = (res - count(k, i)*dp[k]) % mod\n\n dp[i] = res\n\n\n\nprint((dp[-1]))\n","code_v0_loc":41,"code_v1_loc":34,"code_v0_num_chars":958,"code_v1_num_chars":798,"code_v0_no_empty_lines":"mod = 10**9 + 7\nfrac = [1] * 200001\nfor i in range(2, 200001):\n frac[i] = i * frac[i - 1] % mod\nfraci = [None] * 200001\nfraci[-1] = pow(frac[-1], mod - 2, mod)\nfor i in range(-2, -200001 - 1, -1):\n fraci[i] = fraci[i + 1] * (200001 + i + 1) % mod\n\n\ndef comb(a, b):\n if not a >= b >= 0:\n return 0\n return frac[a] * fraci[b] * fraci[a - b] % mod\n\n\ndef count(a, b):\n (r1, c1), (r2, c2) = RC[a], RC[b]\n if c2 < c1:\n return 0\n return comb(r2 - r1 + c2 - c1, r2 - r1)\n\n\nH, W, N = list(map(int, input().split()))\nRC = [list(map(int, input().split())) for _ in range(N)] + [[1, 1], [H, W]]\nRC.sort()\ndpe = [0] * (N + 2)\ndpo = [0] * (N + 2)\ndpe[0] += 1\nfor i in range(1, N + 2):\n rese = 0\n reso = 0\n for k in range(i):\n t = count(k, i)\n if not t:\n continue\n rese = (rese + t * dpo[k]) % mod\n reso = (reso + t * dpe[k]) % mod\n dpe[i] = rese\n dpo[i] = reso\nprint(((dpo[-1] - dpe[-1]) % mod))\n","code_v1_no_empty_lines":"mod = 10**9 + 7\nfrac = [1] * 200001\nfor i in range(2, 200001):\n frac[i] = i * frac[i - 1] % mod\nfraci = [None] * 200001\nfraci[-1] = pow(frac[-1], mod - 2, mod)\nfor i in range(-2, -200001 - 1, -1):\n fraci[i] = fraci[i + 1] * (200001 + i + 1) % mod\n\n\ndef comb(a, b):\n if not a >= b >= 0:\n return 0\n return frac[a] * fraci[b] * fraci[a - b] % mod\n\n\ndef count(a, b):\n (r1, c1), (r2, c2) = RC[a], RC[b]\n if c2 < c1:\n return 0\n return comb(r2 - r1 + c2 - c1, r2 - r1)\n\n\nH, W, N = list(map(int, input().split()))\nRC = [list(map(int, input().split())) for _ in range(N)] + [[1, 1], [H, W]]\nRC.sort()\ndp = [0] * (N + 2)\ndp[0] += 1\nfor i in range(1, N + 2):\n res = count(0, i)\n for k in range(1, i):\n res = (res - count(k, i) * dp[k]) % mod\n dp[i] = res\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":17.0731707317,"diff":["-dpe = [0] * (N + 2)","-dpo = [0] * (N + 2)","-dpe[0] += 1","+dp = [0] * (N + 2)","+dp[0] += 1","- rese = 0","- reso = 0","- for k in range(i):","- t = count(k, i)","- if not t:","- continue","- rese = (rese + t * dpo[k]) % mod","- reso = (reso + t * dpe[k]) % mod","- dpe[i] = rese","- dpo[i] = reso","-print(((dpo[-1] - dpe[-1]) % mod))","+ res = count(0, i)","+ for k in range(1, i):","+ res = (res - count(k, i) * dp[k]) % mod","+ dp[i] = res","+print((dp[-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5887010884,"measured_runtime_v1":0.8069332411,"runtime_lift":0.7295536463,"key":["s569074541","s831391747"]} +{"user_id":"u998435601","problem_id":"p02398","language":"python","submission_id_v0":"s791688237","submission_id_v1":"s430246833","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":6572,"memory_v1":6576,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"a,b,c = list(map(int, input().split()))\n\nt = 0\n\nfor n in range(a,b+1):\n\n if c%n == 0:\n\n \tt += 1\n\nprint(t)","target":"a,b,c = list(map(int, input().split()))\n\nt = 0\n\nfor n in range(a,b+1):\n\n if c%n == 0:\n\n \tt += 1\n\nprint(str(t))","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":102,"code_v1_num_chars":107,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nt = 0\nfor n in range(a, b + 1):\n if c % n == 0:\n t += 1\nprint(t)\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nt = 0\nfor n in range(a, b + 1):\n if c % n == 0:\n t += 1\nprint(str(t))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print(t)","+print(str(t))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0395276043,"measured_runtime_v1":0.0379598303,"runtime_lift":1.0413008708,"key":["s791688237","s430246833"]} +{"user_id":"u427344224","problem_id":"p03019","language":"python","submission_id_v0":"s684137829","submission_id_v1":"s847167566","cpu_time_v0":1254,"cpu_time_v1":1140,"memory_v0":77528,"memory_v1":77144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.09,"input":"N, X = list(map(int, input().split()))\n\nitems = []\n\nfor i in range(N):\n\n b, l, u = list(map(int, input().split()))\n\n items.append((b, l, u, u * (X - b), - b * l))\n\n\n\nitems = sorted(items, key=lambda x: -(x[3] - x[4]))\n\n\n\n\n\ndef f(num):\n\n cnt = num \/\/ X\n\n mod = num % X\n\n point = 0\n\n for i in range(cnt):\n\n point += items[i][3]\n\n for i in range(cnt, N):\n\n point += items[i][4]\n\n\n\n if mod == 0:\n\n if point >= 0:\n\n return True\n\n else:\n\n return False\n\n else:\n\n tmp = -float(\"inf\")\n\n for i, tmp2 in enumerate(items):\n\n b, l, u, d1, d2 = tmp2\n\n if mod >= b:\n\n mul = u * (mod - b)\n\n else:\n\n mul = l * (mod - b)\n\n\n\n if i < cnt:\n\n tmp = max(tmp, point - d1 + mul + items[cnt][3] - items[cnt][4])\n\n else:\n\n tmp = max(tmp, point - d2 + mul)\n\n if tmp >= 0:\n\n return True\n\n else:\n\n return False\n\n\n\nok = N * X + 1\n\nng = - 1\n\nwhile (ok - ng) > 1:\n\n mid = (ok + ng) \/\/ 2\n\n if f(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\nprint(ok)\n","target":"N, X = list(map(int, input().split()))\n\nitems = []\n\nfor i in range(N):\n\n b, l, u = list(map(int, input().split()))\n\n items.append((b, l, u, u * (X - b), - b * l))\n\n\n\nitems = sorted(items, key=lambda x: -(x[3] - x[4]))\n\n\n\n\n\ndef f(num):\n\n cnt = num \/\/ X\n\n mod = num % X\n\n point = 0\n\n for i in range(cnt):\n\n point += items[i][3]\n\n for i in range(cnt, N):\n\n point += items[i][4]\n\n\n\n if mod == 0:\n\n if point >= 0:\n\n return True\n\n else:\n\n return False\n\n else:\n\n tmp = -float(\"inf\")\n\n for i in range(N):\n\n b, l, u, d1, d2 = items[i]\n\n if mod >= b:\n\n mul = u * (mod - b)\n\n else:\n\n mul = l * (mod - b)\n\n\n\n if i < cnt:\n\n tmp = max(tmp, point - d1 + mul + items[cnt][3] - items[cnt][4])\n\n else:\n\n tmp = max(tmp, point - d2 + mul)\n\n if tmp >= 0:\n\n return True\n\n else:\n\n return False\n\n\n\nok = N * X + 1\n\nng = - 1\n\nwhile (ok - ng) > 1:\n\n mid = (ok + ng) \/\/ 2\n\n if f(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\nprint(ok)\n","code_v0_loc":50,"code_v1_loc":50,"code_v0_num_chars":1161,"code_v1_num_chars":1151,"code_v0_no_empty_lines":"N, X = list(map(int, input().split()))\nitems = []\nfor i in range(N):\n b, l, u = list(map(int, input().split()))\n items.append((b, l, u, u * (X - b), -b * l))\nitems = sorted(items, key=lambda x: -(x[3] - x[4]))\n\n\ndef f(num):\n cnt = num \/\/ X\n mod = num % X\n point = 0\n for i in range(cnt):\n point += items[i][3]\n for i in range(cnt, N):\n point += items[i][4]\n if mod == 0:\n if point >= 0:\n return True\n else:\n return False\n else:\n tmp = -float(\"inf\")\n for i, tmp2 in enumerate(items):\n b, l, u, d1, d2 = tmp2\n if mod >= b:\n mul = u * (mod - b)\n else:\n mul = l * (mod - b)\n if i < cnt:\n tmp = max(tmp, point - d1 + mul + items[cnt][3] - items[cnt][4])\n else:\n tmp = max(tmp, point - d2 + mul)\n if tmp >= 0:\n return True\n else:\n return False\n\n\nok = N * X + 1\nng = -1\nwhile (ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n if f(mid):\n ok = mid\n else:\n ng = mid\nprint(ok)\n","code_v1_no_empty_lines":"N, X = list(map(int, input().split()))\nitems = []\nfor i in range(N):\n b, l, u = list(map(int, input().split()))\n items.append((b, l, u, u * (X - b), -b * l))\nitems = sorted(items, key=lambda x: -(x[3] - x[4]))\n\n\ndef f(num):\n cnt = num \/\/ X\n mod = num % X\n point = 0\n for i in range(cnt):\n point += items[i][3]\n for i in range(cnt, N):\n point += items[i][4]\n if mod == 0:\n if point >= 0:\n return True\n else:\n return False\n else:\n tmp = -float(\"inf\")\n for i in range(N):\n b, l, u, d1, d2 = items[i]\n if mod >= b:\n mul = u * (mod - b)\n else:\n mul = l * (mod - b)\n if i < cnt:\n tmp = max(tmp, point - d1 + mul + items[cnt][3] - items[cnt][4])\n else:\n tmp = max(tmp, point - d2 + mul)\n if tmp >= 0:\n return True\n else:\n return False\n\n\nok = N * X + 1\nng = -1\nwhile (ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n if f(mid):\n ok = mid\n else:\n ng = mid\nprint(ok)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for i, tmp2 in enumerate(items):","- b, l, u, d1, d2 = tmp2","+ for i in range(N):","+ b, l, u, d1, d2 = items[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0375958269,"measured_runtime_v1":0.0409741831,"runtime_lift":0.9175491499,"key":["s684137829","s847167566"]} +{"user_id":"u233588813","problem_id":"p02936","language":"python","submission_id_v0":"s001498556","submission_id_v1":"s651001485","cpu_time_v0":1347,"cpu_time_v1":835,"memory_v0":105236,"memory_v1":101452,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.01,"input":"from collections import deque\n\nimport sys\n\ndef main():\n\n a,b=list(map(int,sys.stdin.readline().split()))\n\n e=[[]for i in range(a)]\n\n\n\n for i in range(a-1):\n\n c1,c2=list(map(int,sys.stdin.readline().split()))\n\n e[c1-1].append(c2-1)\n\n e[c2-1].append(c1-1)\n\n\n\n g=[[]for i in range(a)]\n\n f=deque([(0,-1)])\n\n ans=[0 for _ in range(a)]\n\n for i in range(b):\n\n ten,p=list(map(int,input().split()))\n\n ans[ten-1]+=p\n\n i=0\n\n while len(f)!=0:\n\n i,fr=f.pop()\n\n for j in e[i]:\n\n if j==fr:\n\n continue\n\n else:\n\n ans[j]+=ans[i]\n\n f.append((j,i)) \n\n print((*ans))\n\nif __name__ == '__main__': \n\n main()\n\n \n\n \n\n\n\n \n\n \n","target":"from collections import deque\n\nimport sys\n\ninput=sys.stdin.readline\n\na,b=list(map(int,input().split()))\n\ne=[[]for i in range(a)]\n\n\n\nfor i in range(a-1):\n\n c1,c2=list(map(int,input().split()))\n\n e[c1-1].append(c2-1)\n\n e[c2-1].append(c1-1)\n\n\n\ng=[[]for i in range(a)]\n\nf=deque([(0,-1)])\n\nans=[0 for _ in range(a)]\n\nfor i in range(b):\n\n ten,p=list(map(int,input().split()))\n\n ans[ten-1]+=p\n\ni=0\n\nwhile len(f)!=0:\n\n i,fr=f.pop()\n\n for j in e[i]:\n\n if j==fr:\n\n continue\n\n else:\n\n ans[j]+=ans[i]\n\n f.append((j,i)) \n\nprint((*ans))\n\n\n\n \n\n \n\n\n\n \n\n \n","code_v0_loc":34,"code_v1_loc":33,"code_v0_num_chars":648,"code_v1_num_chars":553,"code_v0_no_empty_lines":"from collections import deque\nimport sys\n\n\ndef main():\n a, b = list(map(int, sys.stdin.readline().split()))\n e = [[] for i in range(a)]\n for i in range(a - 1):\n c1, c2 = list(map(int, sys.stdin.readline().split()))\n e[c1 - 1].append(c2 - 1)\n e[c2 - 1].append(c1 - 1)\n g = [[] for i in range(a)]\n f = deque([(0, -1)])\n ans = [0 for _ in range(a)]\n for i in range(b):\n ten, p = list(map(int, input().split()))\n ans[ten - 1] += p\n i = 0\n while len(f) != 0:\n i, fr = f.pop()\n for j in e[i]:\n if j == fr:\n continue\n else:\n ans[j] += ans[i]\n f.append((j, i))\n print((*ans))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import deque\nimport sys\n\ninput = sys.stdin.readline\na, b = list(map(int, input().split()))\ne = [[] for i in range(a)]\nfor i in range(a - 1):\n c1, c2 = list(map(int, input().split()))\n e[c1 - 1].append(c2 - 1)\n e[c2 - 1].append(c1 - 1)\ng = [[] for i in range(a)]\nf = deque([(0, -1)])\nans = [0 for _ in range(a)]\nfor i in range(b):\n ten, p = list(map(int, input().split()))\n ans[ten - 1] += p\ni = 0\nwhile len(f) != 0:\n i, fr = f.pop()\n for j in e[i]:\n if j == fr:\n continue\n else:\n ans[j] += ans[i]\n f.append((j, i))\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":2.9411764706,"diff":["-","-def main():","- a, b = list(map(int, sys.stdin.readline().split()))","- e = [[] for i in range(a)]","- for i in range(a - 1):","- c1, c2 = list(map(int, sys.stdin.readline().split()))","- e[c1 - 1].append(c2 - 1)","- e[c2 - 1].append(c1 - 1)","- g = [[] for i in range(a)]","- f = deque([(0, -1)])","- ans = [0 for _ in range(a)]","- for i in range(b):","- ten, p = list(map(int, input().split()))","- ans[ten - 1] += p","- i = 0","- while len(f) != 0:","- i, fr = f.pop()","- for j in e[i]:","- if j == fr:","- continue","- else:","- ans[j] += ans[i]","- f.append((j, i))","- print((*ans))","-","-","-if __name__ == \"__main__\":","- main()","+input = sys.stdin.readline","+a, b = list(map(int, input().split()))","+e = [[] for i in range(a)]","+for i in range(a - 1):","+ c1, c2 = list(map(int, input().split()))","+ e[c1 - 1].append(c2 - 1)","+ e[c2 - 1].append(c1 - 1)","+g = [[] for i in range(a)]","+f = deque([(0, -1)])","+ans = [0 for _ in range(a)]","+for i in range(b):","+ ten, p = list(map(int, input().split()))","+ ans[ten - 1] += p","+i = 0","+while len(f) != 0:","+ i, fr = f.pop()","+ for j in e[i]:","+ if j == fr:","+ continue","+ else:","+ ans[j] += ans[i]","+ f.append((j, i))","+print((*ans))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0871476301,"measured_runtime_v1":0.0641856805,"runtime_lift":1.3577425572,"key":["s001498556","s651001485"]} +{"user_id":"u936985471","problem_id":"p02918","language":"python","submission_id_v0":"s629435171","submission_id_v1":"s378723437","cpu_time_v0":48,"cpu_time_v1":37,"memory_v0":3956,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.92,"input":"n,k=list(map(int,input().split()))\n\ns=eval(input())\n\nhappy=0\n\nseq=[]\n\ncur=s[0]\n\nseq.append(cur)\n\nfor i in range(1,n):\n\n if s[i]!=cur:\n\n seq.append(s[i])\n\n cur=s[i]\n\n else:\n\n happy=happy+1\n\n\n\nif len(seq)%2==1:\n\n rev=len(seq)\/\/2\n\n print((happy+min(rev,k)*2))\n\nelse:\n\n rev=len(seq)\/\/2\n\n if rev>k:\n\n print((happy+k*2))\n\n else:\n\n print((happy+(rev-1)*2+1))\n","target":"n,k=list(map(int,input().split()))\n\ns=eval(input())\n\nhappy=0\n\ncur=s[0]\n\nfor i in range(1,n):\n\n if s[i]==cur:\n\n happy=happy+1\n\n else:\n\n cur=s[i]\n\n\n\nprint((min(happy+2*k,n-1)))","code_v0_loc":22,"code_v1_loc":11,"code_v0_num_chars":356,"code_v1_num_chars":168,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\ns = eval(input())\nhappy = 0\nseq = []\ncur = s[0]\nseq.append(cur)\nfor i in range(1, n):\n if s[i] != cur:\n seq.append(s[i])\n cur = s[i]\n else:\n happy = happy + 1\nif len(seq) % 2 == 1:\n rev = len(seq) \/\/ 2\n print((happy + min(rev, k) * 2))\nelse:\n rev = len(seq) \/\/ 2\n if rev > k:\n print((happy + k * 2))\n else:\n print((happy + (rev - 1) * 2 + 1))\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\ns = eval(input())\nhappy = 0\ncur = s[0]\nfor i in range(1, n):\n if s[i] == cur:\n happy = happy + 1\n else:\n cur = s[i]\nprint((min(happy + 2 * k, n - 1)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-seq = []","-seq.append(cur)","- if s[i] != cur:","- seq.append(s[i])","+ if s[i] == cur:","+ happy = happy + 1","+ else:","- else:","- happy = happy + 1","-if len(seq) % 2 == 1:","- rev = len(seq) \/\/ 2","- print((happy + min(rev, k) * 2))","-else:","- rev = len(seq) \/\/ 2","- if rev > k:","- print((happy + k * 2))","- else:","- print((happy + (rev - 1) * 2 + 1))","+print((min(happy + 2 * k, n - 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1018342619,"measured_runtime_v1":0.0464803445,"runtime_lift":2.1909102201,"key":["s629435171","s378723437"]} +{"user_id":"u281610856","problem_id":"p02762","language":"python","submission_id_v0":"s035712424","submission_id_v1":"s457934413","cpu_time_v0":1421,"cpu_time_v1":567,"memory_v0":55836,"memory_v1":64608,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.1,"input":"from heapq import heappush, heappop\n\nfrom itertools import permutations, accumulate, combinations\n\nimport math\n\nimport bisect\n\nimport numpy as np\n\nfrom collections import defaultdict, deque\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 6)\n\n# MOD = 10 ** 9 + 7\n\nINF = float(\"inf\")\n\n\n\n\n\nclass UnionFind:\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n # \u5404\u8981\u7d20\u306e\u89aa\u8981\u7d20\u306e\u756a\u53f7\u3092\u683c\u7d0d\u3059\u308b\u30ea\u30b9\u30c8\n\n\n\n def find(self, x): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u6839\u3092\u8fd4\u3059\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u8981\u7d20y\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u3092\u4f75\u5408\u3059\u308b\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:\n\n return\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n def size(self, x): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u30b5\u30a4\u30ba\uff08\u8981\u7d20\u6570\uff09\u3092\u8fd4\u3059\n\n return -self.parents[self.find(x)]\n\n\n\n def same(self, x, y): # \u8981\u7d20x, y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u8fd4\u3059\n\n return self.find(x) == self.find(y)\n\n\n\n def members(self, x): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n\n root = self.find(x)\n\n return [i for i in range(self.n) if self.find(i) == root]\n\n\n\n def roots(self): # \u3059\u3079\u3066\u306e\u6839\u306e\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n\n\n def group_count(self): # \u30b0\u30eb\u30fc\u30d7\u306e\u6570\u3092\u8fd4\u3059\n\n return len(self.roots())\n\n\n\n def all_group_members(self): # {\u30eb\u30fc\u30c8\u8981\u7d20: [\u305d\u306e\u30b0\u30eb\u30fc\u30d7\u306b\u542b\u307e\u308c\u308b\u8981\u7d20\u306e\u30ea\u30b9\u30c8], ...}\u306e\u8f9e\u66f8\u3092\u8fd4\u3059\n\n return {r: self.members(r) for r in self.roots()}\n\n\n\n def __str__(self):\n\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\n\n\n\n\ndef main():\n\n N, M, K = list(map(int, input().split()))\n\n graph_friends =[[] for _ in range(N)]\n\n uf_friends = UnionFind(N)\n\n for _ in range(M):\n\n a, b = [int(i) - 1 for i in input().split()]\n\n graph_friends[a].append(b)\n\n graph_friends[b].append(a)\n\n uf_friends.union(a, b)\n\n\n\n graph_block = [[] for _ in range(N)]\n\n for _ in range(K):\n\n c, d = [int(i) - 1 for i in input().split()]\n\n graph_block[c].append(d)\n\n graph_block[d].append(c)\n\n\n\n ans = [0] * N\n\n for i in range(N):\n\n size = uf_friends.size(i) - 1\n\n for f in graph_friends[i]: # \u300c\u53cb\u9054\u95a2\u4fc2\u300d\u306e\u6642\u306f\u5916\u3059\n\n if uf_friends.same(i, f): # \u96a3\u63a5\u3057\u3066\u7d75\u3044\u308b\u304b\u3064\u89aa\u304c\u540c\u3058\n\n size -= 1\n\n for b in graph_block[i]: # \u300c\u30d6\u30e9\u30c3\u30af\u95a2\u4fc2\u300d\u306e\u6642\u306f\u5916\u3059\n\n if uf_friends.same(i, b): # \u96a3\u63a5\u3057\u3066\u308b\u304b\u3064\u89aa\u304c\u540c\u3058\n\n size -= 1\n\n ans[i] = size\n\n print((*ans))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"from collections import defaultdict, deque\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef main():\n\n N, M, K = list(map(int, input().split()))\n\n gf = [[] for _ in range(N)]\n\n gb = []\n\n for _ in range(M):\n\n a, b = [int(i) - 1 for i in input().split()]\n\n gf[a].append(b)\n\n gf[b].append(a)\n\n for _ in range(K):\n\n c, d = [int(i) - 1 for i in input().split()]\n\n gb.append((c, d))\n\n friend = defaultdict(int)\n\n ans = [0] * N\n\n par = [None] * N\n\n \n\n def dfs(v):\n\n if par[v] is None: # \u5b64\u7acb\u3057\u3066\u3044\u308b\u6642\u306f\u81ea\u5206\u304c\u89aa\u306b\u306a\u308b\n\n par[v] = v\n\n friend[par[v]] += 1\n\n for u in gf[v]: # \u96a3\u63a5\u9802\u70b9\u306e\u63a2\u7d22\n\n if par[u] is None: # \u5b64\u7acb\u3057\u3066\u3044\u305f\u3089\u89aa\u3092\u4e00\u7dd2\u306b\u3059\u308b\n\n par[u] = par[v]\n\n friend[par[v]] += 1\n\n dfs(u) # \u518d\u5ea6\u63a2\u7d22\u3059\u308b\n\n \n\n for i in range(N):\n\n if par[i] is None:\n\n dfs(i)\n\n for i in range(N): # \u30b0\u30e9\u30d5\u30b5\u30a4\u30ba - \u96a3\u63a5\u9802\u70b9\u6570 - \u81ea\u5206\u81ea\u8eab\n\n ans[i] += friend[par[i]] - len(gf[i]) - 1\n\n for c, d in gb:\n\n if par[c] == par[d]: # \u300c\u30d6\u30ed\u30c3\u30af\u95a2\u4fc2\u300d\u3067\u89aa\u304c\u4e00\u7dd2\u306e\u6642\u306f-1\n\n ans[c] -= 1\n\n ans[d] -= 1\n\n print((*ans))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":89,"code_v1_loc":45,"code_v0_num_chars":2662,"code_v1_num_chars":1202,"code_v0_no_empty_lines":"from heapq import heappush, heappop\nfrom itertools import permutations, accumulate, combinations\nimport math\nimport bisect\nimport numpy as np\nfrom collections import defaultdict, deque\nimport sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\n# MOD = 10 ** 9 + 7\nINF = float(\"inf\")\n\n\nclass UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n # \u5404\u8981\u7d20\u306e\u89aa\u8981\u7d20\u306e\u756a\u53f7\u3092\u683c\u7d0d\u3059\u308b\u30ea\u30b9\u30c8\n\n def find(self, x): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u6839\u3092\u8fd4\u3059\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u8981\u7d20y\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u3092\u4f75\u5408\u3059\u308b\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u30b5\u30a4\u30ba\uff08\u8981\u7d20\u6570\uff09\u3092\u8fd4\u3059\n return -self.parents[self.find(x)]\n\n def same(self, x, y): # \u8981\u7d20x, y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u8fd4\u3059\n return self.find(x) == self.find(y)\n\n def members(self, x): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self): # \u3059\u3079\u3066\u306e\u6839\u306e\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self): # \u30b0\u30eb\u30fc\u30d7\u306e\u6570\u3092\u8fd4\u3059\n return len(self.roots())\n\n def all_group_members(self): # {\u30eb\u30fc\u30c8\u8981\u7d20: [\u305d\u306e\u30b0\u30eb\u30fc\u30d7\u306b\u542b\u307e\u308c\u308b\u8981\u7d20\u306e\u30ea\u30b9\u30c8], ...}\u306e\u8f9e\u66f8\u3092\u8fd4\u3059\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())\n\n\ndef main():\n N, M, K = list(map(int, input().split()))\n graph_friends = [[] for _ in range(N)]\n uf_friends = UnionFind(N)\n for _ in range(M):\n a, b = [int(i) - 1 for i in input().split()]\n graph_friends[a].append(b)\n graph_friends[b].append(a)\n uf_friends.union(a, b)\n graph_block = [[] for _ in range(N)]\n for _ in range(K):\n c, d = [int(i) - 1 for i in input().split()]\n graph_block[c].append(d)\n graph_block[d].append(c)\n ans = [0] * N\n for i in range(N):\n size = uf_friends.size(i) - 1\n for f in graph_friends[i]: # \u300c\u53cb\u9054\u95a2\u4fc2\u300d\u306e\u6642\u306f\u5916\u3059\n if uf_friends.same(i, f): # \u96a3\u63a5\u3057\u3066\u7d75\u3044\u308b\u304b\u3064\u89aa\u304c\u540c\u3058\n size -= 1\n for b in graph_block[i]: # \u300c\u30d6\u30e9\u30c3\u30af\u95a2\u4fc2\u300d\u306e\u6642\u306f\u5916\u3059\n if uf_friends.same(i, b): # \u96a3\u63a5\u3057\u3066\u308b\u304b\u3064\u89aa\u304c\u540c\u3058\n size -= 1\n ans[i] = size\n print((*ans))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import defaultdict, deque\nimport sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\n\n\ndef main():\n N, M, K = list(map(int, input().split()))\n gf = [[] for _ in range(N)]\n gb = []\n for _ in range(M):\n a, b = [int(i) - 1 for i in input().split()]\n gf[a].append(b)\n gf[b].append(a)\n for _ in range(K):\n c, d = [int(i) - 1 for i in input().split()]\n gb.append((c, d))\n friend = defaultdict(int)\n ans = [0] * N\n par = [None] * N\n\n def dfs(v):\n if par[v] is None: # \u5b64\u7acb\u3057\u3066\u3044\u308b\u6642\u306f\u81ea\u5206\u304c\u89aa\u306b\u306a\u308b\n par[v] = v\n friend[par[v]] += 1\n for u in gf[v]: # \u96a3\u63a5\u9802\u70b9\u306e\u63a2\u7d22\n if par[u] is None: # \u5b64\u7acb\u3057\u3066\u3044\u305f\u3089\u89aa\u3092\u4e00\u7dd2\u306b\u3059\u308b\n par[u] = par[v]\n friend[par[v]] += 1\n dfs(u) # \u518d\u5ea6\u63a2\u7d22\u3059\u308b\n\n for i in range(N):\n if par[i] is None:\n dfs(i)\n for i in range(N): # \u30b0\u30e9\u30d5\u30b5\u30a4\u30ba - \u96a3\u63a5\u9802\u70b9\u6570 - \u81ea\u5206\u81ea\u8eab\n ans[i] += friend[par[i]] - len(gf[i]) - 1\n for c, d in gb:\n if par[c] == par[d]: # \u300c\u30d6\u30ed\u30c3\u30af\u95a2\u4fc2\u300d\u3067\u89aa\u304c\u4e00\u7dd2\u306e\u6642\u306f-1\n ans[c] -= 1\n ans[d] -= 1\n print((*ans))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":49.4382022472,"diff":["-from heapq import heappush, heappop","-from itertools import permutations, accumulate, combinations","-import math","-import bisect","-import numpy as np","-# MOD = 10 ** 9 + 7","-INF = float(\"inf\")","-","-","-class UnionFind:","- def __init__(self, n):","- self.n = n","- self.parents = [-1] * n # \u5404\u8981\u7d20\u306e\u89aa\u8981\u7d20\u306e\u756a\u53f7\u3092\u683c\u7d0d\u3059\u308b\u30ea\u30b9\u30c8","-","- def find(self, x): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u6839\u3092\u8fd4\u3059","- if self.parents[x] < 0:","- return x","- else:","- self.parents[x] = self.find(self.parents[x])","- return self.parents[x]","-","- def union(self, x, y): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u8981\u7d20y\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u3068\u3092\u4f75\u5408\u3059\u308b","- x = self.find(x)","- y = self.find(y)","- if x == y:","- return","- if self.parents[x] > self.parents[y]:","- x, y = y, x","- self.parents[x] += self.parents[y]","- self.parents[y] = x","-","- def size(self, x): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306e\u30b5\u30a4\u30ba\uff08\u8981\u7d20\u6570\uff09\u3092\u8fd4\u3059","- return -self.parents[self.find(x)]","-","- def same(self, x, y): # \u8981\u7d20x, y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u8fd4\u3059","- return self.find(x) == self.find(y)","-","- def members(self, x): # \u8981\u7d20x\u304c\u5c5e\u3059\u308b\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059","- root = self.find(x)","- return [i for i in range(self.n) if self.find(i) == root]","-","- def roots(self): # \u3059\u3079\u3066\u306e\u6839\u306e\u8981\u7d20\u3092\u30ea\u30b9\u30c8\u3067\u8fd4\u3059","- return [i for i, x in enumerate(self.parents) if x < 0]","-","- def group_count(self): # \u30b0\u30eb\u30fc\u30d7\u306e\u6570\u3092\u8fd4\u3059","- return len(self.roots())","-","- def all_group_members(self): # {\u30eb\u30fc\u30c8\u8981\u7d20: [\u305d\u306e\u30b0\u30eb\u30fc\u30d7\u306b\u542b\u307e\u308c\u308b\u8981\u7d20\u306e\u30ea\u30b9\u30c8], ...}\u306e\u8f9e\u66f8\u3092\u8fd4\u3059","- return {r: self.members(r) for r in self.roots()}","-","- def __str__(self):","- return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())","- graph_friends = [[] for _ in range(N)]","- uf_friends = UnionFind(N)","+ gf = [[] for _ in range(N)]","+ gb = []","- graph_friends[a].append(b)","- graph_friends[b].append(a)","- uf_friends.union(a, b)","- graph_block = [[] for _ in range(N)]","+ gf[a].append(b)","+ gf[b].append(a)","- graph_block[c].append(d)","- graph_block[d].append(c)","+ gb.append((c, d))","+ friend = defaultdict(int)","+ par = [None] * N","+","+ def dfs(v):","+ if par[v] is None: # \u5b64\u7acb\u3057\u3066\u3044\u308b\u6642\u306f\u81ea\u5206\u304c\u89aa\u306b\u306a\u308b","+ par[v] = v","+ friend[par[v]] += 1","+ for u in gf[v]: # \u96a3\u63a5\u9802\u70b9\u306e\u63a2\u7d22","+ if par[u] is None: # \u5b64\u7acb\u3057\u3066\u3044\u305f\u3089\u89aa\u3092\u4e00\u7dd2\u306b\u3059\u308b","+ par[u] = par[v]","+ friend[par[v]] += 1","+ dfs(u) # \u518d\u5ea6\u63a2\u7d22\u3059\u308b","+","- size = uf_friends.size(i) - 1","- for f in graph_friends[i]: # \u300c\u53cb\u9054\u95a2\u4fc2\u300d\u306e\u6642\u306f\u5916\u3059","- if uf_friends.same(i, f): # \u96a3\u63a5\u3057\u3066\u7d75\u3044\u308b\u304b\u3064\u89aa\u304c\u540c\u3058","- size -= 1","- for b in graph_block[i]: # \u300c\u30d6\u30e9\u30c3\u30af\u95a2\u4fc2\u300d\u306e\u6642\u306f\u5916\u3059","- if uf_friends.same(i, b): # \u96a3\u63a5\u3057\u3066\u308b\u304b\u3064\u89aa\u304c\u540c\u3058","- size -= 1","- ans[i] = size","+ if par[i] is None:","+ dfs(i)","+ for i in range(N): # \u30b0\u30e9\u30d5\u30b5\u30a4\u30ba - \u96a3\u63a5\u9802\u70b9\u6570 - \u81ea\u5206\u81ea\u8eab","+ ans[i] += friend[par[i]] - len(gf[i]) - 1","+ for c, d in gb:","+ if par[c] == par[d]: # \u300c\u30d6\u30ed\u30c3\u30af\u95a2\u4fc2\u300d\u3067\u89aa\u304c\u4e00\u7dd2\u306e\u6642\u306f-1","+ ans[c] -= 1","+ ans[d] -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0486174939,"measured_runtime_v1":0.0768544562,"runtime_lift":0.632591736,"key":["s035712424","s457934413"]} +{"user_id":"u864197622","problem_id":"p02763","language":"python","submission_id_v0":"s857295724","submission_id_v1":"s418919384","cpu_time_v0":678,"cpu_time_v1":610,"memory_v0":80280,"memory_v1":77976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.03,"input":"NN = 19\n\nX = [0] * ((1<> 1) & 0x55555555\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x += x >> 8\n\n x += x >> 16\n\n return x & 0x3f\n\n\n\ndef update(a, x):\n\n i = (1<>= 1\n\n r >>= 1\n\n return x\n\n\n\nN = int(eval(input()))\n\nA = [ord(a) - 97 for a in eval(input())]\n\nfor i, a in enumerate(A):\n\n X[(1<> 1) & 0x55555555\n\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n\n x = (x + (x >> 4)) & 0x0f0f0f0f\n\n x += x >> 8\n\n x += x >> 16\n\n return x & 0x3f\n\n\n\ndef update(a, x):\n\n i = (1<>= 1\n\n r >>= 1\n\n return x\n\n\n\nN = int(eval(input()))\n\nA = [ord(a) - 97 for a in eval(input())]\n\nfor i, a in enumerate(A):\n\n X[(1<> 1) & 0x55555555\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0F0F0F0F\n x += x >> 8\n x += x >> 16\n return x & 0x3F\n\n\ndef update(a, x):\n i = (1 << NN) - 1 + a\n X[i] = x\n while True:\n i = (i - 1) \/\/ 2\n X[i] = X[2 * i + 1] | X[2 * i + 2]\n if i == 0:\n break\n\n\ndef rangeor(a, b):\n l = a + (1 << NN)\n r = b + (1 << NN)\n x = 0\n while l < r:\n if l % 2:\n x |= X[l - 1]\n l += 1\n if r % 2:\n r -= 1\n x |= X[r - 1]\n l >>= 1\n r >>= 1\n return x\n\n\nN = int(eval(input()))\nA = [ord(a) - 97 for a in eval(input())]\nfor i, a in enumerate(A):\n X[(1 << NN) + i] = 1 << a\nfor i in range((1 << NN) - 1)[::-1]:\n X[i] = X[i * 2 + 1] | X[i * 2 + 2]\nQ = int(eval(input()))\nfor _ in range(Q):\n a, b, c = input().rstrip().split()\n if a == \"1\":\n b = int(b)\n c = ord(c) - 97\n update(b, 1 << c)\n else:\n b, c = int(b), int(c)\n print((popcount(rangeor(b, c + 1))))\n","code_v1_no_empty_lines":"NN = 19\nX = [0] * ((1 << NN + 1) - 1)\n\n\ndef popcount(x):\n x -= (x >> 1) & 0x55555555\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\n x = (x + (x >> 4)) & 0x0F0F0F0F\n x += x >> 8\n x += x >> 16\n return x & 0x3F\n\n\ndef update(a, x):\n i = (1 << NN) - 1 + a\n X[i] = x\n while i:\n i = (i - 1) \/\/ 2\n X[i] = X[2 * i + 1] | X[2 * i + 2]\n\n\ndef rangeor(a, b):\n l = a + (1 << NN)\n r = b + (1 << NN)\n x = 0\n while l < r:\n if l % 2:\n x |= X[l - 1]\n l += 1\n if r % 2:\n r -= 1\n x |= X[r - 1]\n l >>= 1\n r >>= 1\n return x\n\n\nN = int(eval(input()))\nA = [ord(a) - 97 for a in eval(input())]\nfor i, a in enumerate(A):\n X[(1 << NN) + i] = 1 << a\nfor i in range((1 << NN) - 1)[::-1]:\n X[i] = X[i * 2 + 1] | X[i * 2 + 2]\nQ = int(eval(input()))\nfor _ in range(Q):\n a, b, c = input().rstrip().split()\n if a == \"1\":\n b = int(b)\n c = ord(c) - 97\n update(b, 1 << c)\n else:\n b, c = int(b), int(c)\n print((popcount(rangeor(b, c + 1))))\n","code_same":false,"relative_loc_diff_percent":3.8461538462,"diff":["- while True:","+ while i:","- if i == 0:","- break"],"diff_only_import_comment":false,"measured_runtime_v0":0.0702671254,"measured_runtime_v1":0.0582441027,"runtime_lift":1.2064247208,"key":["s857295724","s418919384"]} +{"user_id":"u941407962","problem_id":"p03173","language":"python","submission_id_v0":"s056214417","submission_id_v1":"s696143640","cpu_time_v0":618,"cpu_time_v1":408,"memory_v0":47196,"memory_v1":44148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.98,"input":"N = int(eval(input()))\n\nAs = list(map(int, input().split()))\n\nma = sum(As)\n\no = dict()\n\nINF = 10**19\n\nfrom itertools import accumulate\n\naa = [0] + list(accumulate(As))\n\n\n\nfor i in range(N):\n\n for j in range(N-i):\n\n span = i*N+j\n\n # \u9577\u3055i+1, \u958b\u59cb\u4f4d\u7f6ej\u306e\u5408\u6210\u30b3\u30b9\u30c8+\u69cb\u6210\u8981\u7d20\u306e\u548c\n\n if i == 0:\n\n o[span] = As[j]\n\n continue\n\n C = INF\n\n# print(i,j,o)\n\n for k in range(i):\n\n # \u9577\u3055k+1\u3068i+1-(k+1)=i-k\u306b\u5206\u5272\n\n# print(i,j,k*N+j, (i-k-1)*N+j+k, o)\n\n C = min(C, o[k*N+j]+o[(i-k-1)*N+j+k+1])\n\n# o[span] = C + sum(As[j:j+i+1])\n\n o[span] = C + aa[j+i+1] - aa[j]\n\n\n\nprint((o[span]-ma))\n","target":"N = int(eval(input()))\n\nAs = list(map(int, input().split()))\n\no = [0]*(N**2)\n\nINF = 10**19\n\nfrom itertools import accumulate\n\naa = [0] + list(accumulate(As))\n\n\n\nfor i in range(1, N+1):\n\n for j in range(N-i+1):\n\n span = (i-1)*N+j\n\n # \u9577\u3055i, \u958b\u59cb\u4f4d\u7f6ej\u306e\u5408\u6210\u30b3\u30b9\u30c8+\u69cb\u6210\u8981\u7d20\u306e\u548c\n\n if i == 1:\n\n o[span] = As[j]\n\n continue\n\n C = INF\n\n for k in range(1, i):\n\n # \u9577\u3055,\u958b\u59cb\u4f4d\u7f6e=(k,j)\u3068(i-k,j+k)\n\n span1, span2 = (k-1)*N+j, (i-k-1)*N+j+k\n\n C = min(C, o[span1]+o[span2])\n\n o[span] = C + aa[(j+i-1)+1] - aa[(j-1)+1]\n\nprint((o[span]-aa[-1]))","code_v0_loc":25,"code_v1_loc":21,"code_v0_num_chars":651,"code_v1_num_chars":595,"code_v0_no_empty_lines":"N = int(eval(input()))\nAs = list(map(int, input().split()))\nma = sum(As)\no = dict()\nINF = 10**19\nfrom itertools import accumulate\n\naa = [0] + list(accumulate(As))\nfor i in range(N):\n for j in range(N - i):\n span = i * N + j\n # \u9577\u3055i+1, \u958b\u59cb\u4f4d\u7f6ej\u306e\u5408\u6210\u30b3\u30b9\u30c8+\u69cb\u6210\u8981\u7d20\u306e\u548c\n if i == 0:\n o[span] = As[j]\n continue\n C = INF\n # print(i,j,o)\n for k in range(i):\n # \u9577\u3055k+1\u3068i+1-(k+1)=i-k\u306b\u5206\u5272\n # print(i,j,k*N+j, (i-k-1)*N+j+k, o)\n C = min(C, o[k * N + j] + o[(i - k - 1) * N + j + k + 1])\n # o[span] = C + sum(As[j:j+i+1])\n o[span] = C + aa[j + i + 1] - aa[j]\nprint((o[span] - ma))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nAs = list(map(int, input().split()))\no = [0] * (N**2)\nINF = 10**19\nfrom itertools import accumulate\n\naa = [0] + list(accumulate(As))\nfor i in range(1, N + 1):\n for j in range(N - i + 1):\n span = (i - 1) * N + j\n # \u9577\u3055i, \u958b\u59cb\u4f4d\u7f6ej\u306e\u5408\u6210\u30b3\u30b9\u30c8+\u69cb\u6210\u8981\u7d20\u306e\u548c\n if i == 1:\n o[span] = As[j]\n continue\n C = INF\n for k in range(1, i):\n # \u9577\u3055,\u958b\u59cb\u4f4d\u7f6e=(k,j)\u3068(i-k,j+k)\n span1, span2 = (k - 1) * N + j, (i - k - 1) * N + j + k\n C = min(C, o[span1] + o[span2])\n o[span] = C + aa[(j + i - 1) + 1] - aa[(j - 1) + 1]\nprint((o[span] - aa[-1]))\n","code_same":false,"relative_loc_diff_percent":16.0,"diff":["-ma = sum(As)","-o = dict()","+o = [0] * (N**2)","-for i in range(N):","- for j in range(N - i):","- span = i * N + j","- # \u9577\u3055i+1, \u958b\u59cb\u4f4d\u7f6ej\u306e\u5408\u6210\u30b3\u30b9\u30c8+\u69cb\u6210\u8981\u7d20\u306e\u548c","- if i == 0:","+for i in range(1, N + 1):","+ for j in range(N - i + 1):","+ span = (i - 1) * N + j","+ # \u9577\u3055i, \u958b\u59cb\u4f4d\u7f6ej\u306e\u5408\u6210\u30b3\u30b9\u30c8+\u69cb\u6210\u8981\u7d20\u306e\u548c","+ if i == 1:","- # print(i,j,o)","- for k in range(i):","- # \u9577\u3055k+1\u3068i+1-(k+1)=i-k\u306b\u5206\u5272","- # print(i,j,k*N+j, (i-k-1)*N+j+k, o)","- C = min(C, o[k * N + j] + o[(i - k - 1) * N + j + k + 1])","- # o[span] = C + sum(As[j:j+i+1])","- o[span] = C + aa[j + i + 1] - aa[j]","-print((o[span] - ma))","+ for k in range(1, i):","+ # \u9577\u3055,\u958b\u59cb\u4f4d\u7f6e=(k,j)\u3068(i-k,j+k)","+ span1, span2 = (k - 1) * N + j, (i - k - 1) * N + j + k","+ C = min(C, o[span1] + o[span2])","+ o[span] = C + aa[(j + i - 1) + 1] - aa[(j - 1) + 1]","+print((o[span] - aa[-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0360587161,"measured_runtime_v1":0.0375748191,"runtime_lift":0.9596510888,"key":["s056214417","s696143640"]} +{"user_id":"u595289165","problem_id":"p03112","language":"python","submission_id_v0":"s013761747","submission_id_v1":"s025574586","cpu_time_v0":1871,"cpu_time_v1":1672,"memory_v0":12816,"memory_v1":12804,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.64,"input":"from bisect import bisect_left, bisect_right\n\na, b, q = list(map(int, input().split()))\n\ninf = 10**18\n\nshrine = [-inf] + [int(eval(input())) for _ in range(a)] + [inf]\n\ntemple = [-inf] + [int(eval(input())) for _ in range(b)] + [inf]\n\n\n\nfor _ in range(q):\n\n ans = inf\n\n x = int(eval(input()))\n\n index_s = bisect_left(shrine, x)\n\n index_t = bisect_right(temple, x)\n\n for i in range(index_s-1, index_s+1):\n\n s = shrine[i]\n\n i_t = index_t\n\n t0, t1 = temple[i_t-1], temple[i_t]\n\n ans = min(\n\n ans,\n\n abs(x - s) + abs(s - t0),\n\n abs(x - s) + abs(s - t1),\n\n )\n\n\n\n for i in range(index_t-1, index_t+1):\n\n t = temple[i]\n\n i_s = index_s\n\n s0 = shrine[i_s - 1]\n\n s1 = shrine[i_s]\n\n ans = min(\n\n ans,\n\n abs(x - t) + abs(t - s0),\n\n abs(x - t) + abs(t - s1),\n\n )\n\n\n\n print(ans)\n","target":"from bisect import bisect_left, bisect_right\n\na, b, q = list(map(int, input().split()))\n\ninf = 10**18\n\nshrine = [-inf] + [int(eval(input())) for _ in range(a)] + [inf]\n\ntemple = [-inf] + [int(eval(input())) for _ in range(b)] + [inf]\n\n\n\nfor _ in range(q):\n\n ans = inf\n\n x = int(eval(input()))\n\n index_s = bisect_left(shrine, x)\n\n index_t = bisect_right(temple, x)\n\n \n\n for s in [shrine[index_s-1], shrine[index_s]]:\n\n for t in [temple[index_t-1], temple[index_t]]:\n\n ans = min(\n\n ans,\n\n abs(x-s) + abs(s-t),\n\n abs(x-t) + abs(s-t)\n\n )\n\n\n\n print(ans)","code_v0_loc":33,"code_v1_loc":21,"code_v0_num_chars":905,"code_v1_num_chars":619,"code_v0_no_empty_lines":"from bisect import bisect_left, bisect_right\n\na, b, q = list(map(int, input().split()))\ninf = 10**18\nshrine = [-inf] + [int(eval(input())) for _ in range(a)] + [inf]\ntemple = [-inf] + [int(eval(input())) for _ in range(b)] + [inf]\nfor _ in range(q):\n ans = inf\n x = int(eval(input()))\n index_s = bisect_left(shrine, x)\n index_t = bisect_right(temple, x)\n for i in range(index_s - 1, index_s + 1):\n s = shrine[i]\n i_t = index_t\n t0, t1 = temple[i_t - 1], temple[i_t]\n ans = min(\n ans,\n abs(x - s) + abs(s - t0),\n abs(x - s) + abs(s - t1),\n )\n for i in range(index_t - 1, index_t + 1):\n t = temple[i]\n i_s = index_s\n s0 = shrine[i_s - 1]\n s1 = shrine[i_s]\n ans = min(\n ans,\n abs(x - t) + abs(t - s0),\n abs(x - t) + abs(t - s1),\n )\n print(ans)\n","code_v1_no_empty_lines":"from bisect import bisect_left, bisect_right\n\na, b, q = list(map(int, input().split()))\ninf = 10**18\nshrine = [-inf] + [int(eval(input())) for _ in range(a)] + [inf]\ntemple = [-inf] + [int(eval(input())) for _ in range(b)] + [inf]\nfor _ in range(q):\n ans = inf\n x = int(eval(input()))\n index_s = bisect_left(shrine, x)\n index_t = bisect_right(temple, x)\n for s in [shrine[index_s - 1], shrine[index_s]]:\n for t in [temple[index_t - 1], temple[index_t]]:\n ans = min(ans, abs(x - s) + abs(s - t), abs(x - t) + abs(s - t))\n print(ans)\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["- for i in range(index_s - 1, index_s + 1):","- s = shrine[i]","- i_t = index_t","- t0, t1 = temple[i_t - 1], temple[i_t]","- ans = min(","- ans,","- abs(x - s) + abs(s - t0),","- abs(x - s) + abs(s - t1),","- )","- for i in range(index_t - 1, index_t + 1):","- t = temple[i]","- i_s = index_s","- s0 = shrine[i_s - 1]","- s1 = shrine[i_s]","- ans = min(","- ans,","- abs(x - t) + abs(t - s0),","- abs(x - t) + abs(t - s1),","- )","+ for s in [shrine[index_s - 1], shrine[index_s]]:","+ for t in [temple[index_t - 1], temple[index_t]]:","+ ans = min(ans, abs(x - s) + abs(s - t), abs(x - t) + abs(s - t))"],"diff_only_import_comment":false,"measured_runtime_v0":0.04413406,"measured_runtime_v1":0.0668838627,"runtime_lift":0.6598611111,"key":["s013761747","s025574586"]} +{"user_id":"u864197622","problem_id":"p03232","language":"python","submission_id_v0":"s971072619","submission_id_v1":"s622778922","cpu_time_v0":609,"cpu_time_v1":496,"memory_v0":19328,"memory_v1":62576,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.56,"input":"def mod_inv(n,p):\n\n if n<0:\n\n return - mod_inv(-n,p) % p\n\n if n>p:\n\n return mod_inv(n % p, p)\n\n \n\n def mod_inv_calc(a,b):\n\n if b==0:\n\n return (a,1)\n\n else:\n\n s,t = mod_inv_calc(b, a % b)\n\n d = a\/\/b\n\n return (t, -t*d+s)\n\n\n\n return mod_inv_calc(p,n)[1] % p\n\n\n\nN = int(eval(input()))\n\nA = [int(a) for a in input().split()]\n\np = 10**9+7\n\ninv_list = [mod_inv(i+1,p) for i in range(N+2)]\n\n\n\nfact_list = [1]\n\nfor i in range(N):\n\n fact_list.append(fact_list[i] * (i+1) % p)\n\ns = 0\n\nsum_list = [inv_list[i] * fact_list[N] % p for i in range(N+2)]\n\n\n\nfor i in range(N):\n\n s += inv_list[i]\n\n \n\ns *= fact_list[N]\n\ns %= p\n\nans = 0\n\nfor i in range(N):\n\n ans += A[i]*s\n\n ans %= p\n\n s += (sum_list[i+1] - sum_list[N-i-1])\n\n s %= p\n\n \n\nprint (ans)","target":"N = int(eval(input()))\n\nA = [int(a) for a in input().split()]\n\nP = 10**9+7\n\n\n\ndef inv(a):\n\n return pow(a, P-2, P)\n\n\n\ns = 0\n\nfor i in range(N):\n\n s += inv(i+1)\n\n \n\nans = 0\n\nfor i in range(N):\n\n ans += s * A[i]\n\n ans %= P\n\n s += inv(i+2) - inv(N-i)\n\n \n\nfor i in range(1, N+1):\n\n ans = ans * i % P\n\n \n\nprint(ans)","code_v0_loc":40,"code_v1_loc":21,"code_v0_num_chars":835,"code_v1_num_chars":330,"code_v0_no_empty_lines":"def mod_inv(n, p):\n if n < 0:\n return -mod_inv(-n, p) % p\n if n > p:\n return mod_inv(n % p, p)\n\n def mod_inv_calc(a, b):\n if b == 0:\n return (a, 1)\n else:\n s, t = mod_inv_calc(b, a % b)\n d = a \/\/ b\n return (t, -t * d + s)\n\n return mod_inv_calc(p, n)[1] % p\n\n\nN = int(eval(input()))\nA = [int(a) for a in input().split()]\np = 10**9 + 7\ninv_list = [mod_inv(i + 1, p) for i in range(N + 2)]\nfact_list = [1]\nfor i in range(N):\n fact_list.append(fact_list[i] * (i + 1) % p)\ns = 0\nsum_list = [inv_list[i] * fact_list[N] % p for i in range(N + 2)]\nfor i in range(N):\n s += inv_list[i]\ns *= fact_list[N]\ns %= p\nans = 0\nfor i in range(N):\n ans += A[i] * s\n ans %= p\n s += sum_list[i + 1] - sum_list[N - i - 1]\n s %= p\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(a) for a in input().split()]\nP = 10**9 + 7\n\n\ndef inv(a):\n return pow(a, P - 2, P)\n\n\ns = 0\nfor i in range(N):\n s += inv(i + 1)\nans = 0\nfor i in range(N):\n ans += s * A[i]\n ans %= P\n s += inv(i + 2) - inv(N - i)\nfor i in range(1, N + 1):\n ans = ans * i % P\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":47.5,"diff":["-def mod_inv(n, p):","- if n < 0:","- return -mod_inv(-n, p) % p","- if n > p:","- return mod_inv(n % p, p)","-","- def mod_inv_calc(a, b):","- if b == 0:","- return (a, 1)","- else:","- s, t = mod_inv_calc(b, a % b)","- d = a \/\/ b","- return (t, -t * d + s)","-","- return mod_inv_calc(p, n)[1] % p","+N = int(eval(input()))","+A = [int(a) for a in input().split()]","+P = 10**9 + 7","-N = int(eval(input()))","-A = [int(a) for a in input().split()]","-p = 10**9 + 7","-inv_list = [mod_inv(i + 1, p) for i in range(N + 2)]","-fact_list = [1]","+def inv(a):","+ return pow(a, P - 2, P)","+","+","+s = 0","- fact_list.append(fact_list[i] * (i + 1) % p)","-s = 0","-sum_list = [inv_list[i] * fact_list[N] % p for i in range(N + 2)]","-for i in range(N):","- s += inv_list[i]","-s *= fact_list[N]","-s %= p","+ s += inv(i + 1)","- ans += A[i] * s","- ans %= p","- s += sum_list[i + 1] - sum_list[N - i - 1]","- s %= p","+ ans += s * A[i]","+ ans %= P","+ s += inv(i + 2) - inv(N - i)","+for i in range(1, N + 1):","+ ans = ans * i % P"],"diff_only_import_comment":false,"measured_runtime_v0":0.0868356752,"measured_runtime_v1":0.0796335044,"runtime_lift":1.0904414655,"key":["s971072619","s622778922"]} +{"user_id":"u567380442","problem_id":"p00227","language":"python","submission_id_v0":"s903668524","submission_id_v1":"s281092798","cpu_time_v0":70,"cpu_time_v1":60,"memory_v0":6784,"memory_v1":6776,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"import sys\n\nf = sys.stdin\n\n\n\n\n\nwhile True:\n\n n, m = list(map(int, f.readline().split()))\n\n if n == 0:\n\n break\n\n vegitables = sorted(map(int, f.readline().split()), reverse=True)\n\n discount = sum(vi for i, vi in enumerate(vegitables) if (i + 1) % m == 0)\n\n print((sum(vegitables) - discount))","target":"while True:\n\n n, m = list(map(int, input().split()))\n\n if n == 0:\n\n break\n\n price = sorted(map(int, input().split()), reverse=True)\n\n print((sum(price) - sum(price[m - 1::m])))","code_v0_loc":11,"code_v1_loc":6,"code_v0_num_chars":305,"code_v1_num_chars":187,"code_v0_no_empty_lines":"import sys\n\nf = sys.stdin\nwhile True:\n n, m = list(map(int, f.readline().split()))\n if n == 0:\n break\n vegitables = sorted(map(int, f.readline().split()), reverse=True)\n discount = sum(vi for i, vi in enumerate(vegitables) if (i + 1) % m == 0)\n print((sum(vegitables) - discount))\n","code_v1_no_empty_lines":"while True:\n n, m = list(map(int, input().split()))\n if n == 0:\n break\n price = sorted(map(int, input().split()), reverse=True)\n print((sum(price) - sum(price[m - 1 :: m])))\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-import sys","-","-f = sys.stdin","- n, m = list(map(int, f.readline().split()))","+ n, m = list(map(int, input().split()))","- vegitables = sorted(map(int, f.readline().split()), reverse=True)","- discount = sum(vi for i, vi in enumerate(vegitables) if (i + 1) % m == 0)","- print((sum(vegitables) - discount))","+ price = sorted(map(int, input().split()), reverse=True)","+ print((sum(price) - sum(price[m - 1 :: m])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463676372,"measured_runtime_v1":0.044786309,"runtime_lift":1.0353082935,"key":["s903668524","s281092798"]} +{"user_id":"u547001323","problem_id":"p03013","language":"python","submission_id_v0":"s924187521","submission_id_v1":"s770452600","cpu_time_v0":218,"cpu_time_v1":197,"memory_v0":7416,"memory_v1":8056,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.63,"input":"from collections import deque\n\n \n\nN, M = list(map(int, input().split()))\n\n \n\na = []\n\naindex = 0\n\nfor _ in range(M):\n\n a.append(int(eval(input())))\n\n \n\nbefore1 = 1\n\nbefore2 = 0\n\nai=0\n\nif len(a)>0:\n\n ai = a[aindex]\n\n \n\nfor i in range(1, N+1):\n\n if i == ai:\n\n before2 = before1\n\n before1 = 0\n\n if aindex < len(a)-1:\n\n aindex += 1\n\n ai = a[aindex]\n\n else:\n\n current = divmod(before1 + before2, 10**9+7)[1]\n\n before2 = before1\n\n before1 = current\n\n \n\n \n\nprint(before1)","target":"from collections import deque\n\n\n\nN, M = list(map(int, input().split()))\n\na = deque([int(eval(input())) for _ in range(M)])\n\n\n\nbefore1 = 1\n\nbefore2 = 0\n\nai = a.popleft() if len(a) else 0\n\n\n\nfor i in range(1, N+1):\n\n if i == ai:\n\n before2 = before1\n\n before1 = 0\n\n ai = a.popleft() if len(a) else ai\n\n else:\n\n current = divmod(before1 + before2, 10**9+7)[1]\n\n before2 = before1\n\n before1 = current\n\n\n\nprint(before1)\n","code_v0_loc":29,"code_v1_loc":20,"code_v0_num_chars":527,"code_v1_num_chars":450,"code_v0_no_empty_lines":"from collections import deque\n\nN, M = list(map(int, input().split()))\na = []\naindex = 0\nfor _ in range(M):\n a.append(int(eval(input())))\nbefore1 = 1\nbefore2 = 0\nai = 0\nif len(a) > 0:\n ai = a[aindex]\nfor i in range(1, N + 1):\n if i == ai:\n before2 = before1\n before1 = 0\n if aindex < len(a) - 1:\n aindex += 1\n ai = a[aindex]\n else:\n current = divmod(before1 + before2, 10**9 + 7)[1]\n before2 = before1\n before1 = current\nprint(before1)\n","code_v1_no_empty_lines":"from collections import deque\n\nN, M = list(map(int, input().split()))\na = deque([int(eval(input())) for _ in range(M)])\nbefore1 = 1\nbefore2 = 0\nai = a.popleft() if len(a) else 0\nfor i in range(1, N + 1):\n if i == ai:\n before2 = before1\n before1 = 0\n ai = a.popleft() if len(a) else ai\n else:\n current = divmod(before1 + before2, 10**9 + 7)[1]\n before2 = before1\n before1 = current\nprint(before1)\n","code_same":false,"relative_loc_diff_percent":31.0344827586,"diff":["-a = []","-aindex = 0","-for _ in range(M):","- a.append(int(eval(input())))","+a = deque([int(eval(input())) for _ in range(M)])","-ai = 0","-if len(a) > 0:","- ai = a[aindex]","+ai = a.popleft() if len(a) else 0","- if aindex < len(a) - 1:","- aindex += 1","- ai = a[aindex]","+ ai = a.popleft() if len(a) else ai"],"diff_only_import_comment":false,"measured_runtime_v0":0.0474757688,"measured_runtime_v1":0.046655834,"runtime_lift":1.0175741116,"key":["s924187521","s770452600"]} +{"user_id":"u119148115","problem_id":"p02570","language":"python","submission_id_v0":"s858890436","submission_id_v1":"s284802608","cpu_time_v0":94,"cpu_time_v1":65,"memory_v0":61756,"memory_v1":61796,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.85,"input":"import sys\n\n\n\nsys.setrecursionlimit(10**7)\n\ndef I(): return int(sys.stdin.readline().rstrip())\n\ndef MI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #\u7a7a\u767d\u3042\u308a\n\ndef LI2(): return list(map(int,sys.stdin.readline().rstrip())) #\u7a7a\u767d\u306a\u3057\n\ndef S(): return sys.stdin.readline().rstrip()\n\ndef LS(): return list(sys.stdin.readline().rstrip().split()) #\u7a7a\u767d\u3042\u308a\n\ndef LS2(): return list(sys.stdin.readline().rstrip()) #\u7a7a\u767d\u306a\u3057\n\n\n\n\n\nD,T,S = MI()\n\nprint(('Yes' if S*T >= D else 'No'))\n","target":"import sys\n\ndef MI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\n\n\n\n\nD,T,S = MI()\n\nprint(('Yes' if S*T >= D else 'No'))\n","code_v0_loc":14,"code_v1_loc":6,"code_v0_num_chars":541,"code_v1_num_chars":130,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\n\n\ndef I():\n return int(sys.stdin.readline().rstrip())\n\n\ndef MI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().rstrip().split())) # \u7a7a\u767d\u3042\u308a\n\n\ndef LI2():\n return list(map(int, sys.stdin.readline().rstrip())) # \u7a7a\u767d\u306a\u3057\n\n\ndef S():\n return sys.stdin.readline().rstrip()\n\n\ndef LS():\n return list(sys.stdin.readline().rstrip().split()) # \u7a7a\u767d\u3042\u308a\n\n\ndef LS2():\n return list(sys.stdin.readline().rstrip()) # \u7a7a\u767d\u306a\u3057\n\n\nD, T, S = MI()\nprint((\"Yes\" if S * T >= D else \"No\"))\n","code_v1_no_empty_lines":"import sys\n\n\ndef MI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\nD, T, S = MI()\nprint((\"Yes\" if S * T >= D else \"No\"))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-","-sys.setrecursionlimit(10**7)","-","-","-def I():","- return int(sys.stdin.readline().rstrip())","-def LI():","- return list(map(int, sys.stdin.readline().rstrip().split())) # \u7a7a\u767d\u3042\u308a","-","-","-def LI2():","- return list(map(int, sys.stdin.readline().rstrip())) # \u7a7a\u767d\u306a\u3057","-","-","-def S():","- return sys.stdin.readline().rstrip()","-","-","-def LS():","- return list(sys.stdin.readline().rstrip().split()) # \u7a7a\u767d\u3042\u308a","-","-","-def LS2():","- return list(sys.stdin.readline().rstrip()) # \u7a7a\u767d\u306a\u3057","-","-"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422115631,"measured_runtime_v1":0.0453781111,"runtime_lift":0.9302186022,"key":["s858890436","s284802608"]} +{"user_id":"u043048943","problem_id":"p03044","language":"python","submission_id_v0":"s380229285","submission_id_v1":"s710524795","cpu_time_v0":577,"cpu_time_v1":454,"memory_v0":93676,"memory_v1":64800,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.32,"input":"import sys\n\nsys.setrecursionlimit(2**31-1)\n\ninput = sys.stdin.readline\n\nwrite = lambda x: sys.stdout.write(str(x))\n\nLMIIS = lambda : list(map(int,input().split()))\n\nII = lambda : int(input())\n\ndbg = lambda *something : print(*something) if DEBUG is True else 0\n\nDEBUG = False\n\n\n\ndef main():\n\n\n\n N = II()\n\n t = [-1] * N\n\n\n\n\n\n E = [ [] for _ in range(N)]\n\n \n\n reached = [False] * N\n\n for _ in range(N-1):\n\n u,v,w = LMIIS()\n\n u -=1\n\n v -=1\n\n E[u].append((v,w))\n\n E[v].append((u,w))\n\n dbg(E)\n\n t[E[0][0][0]] = 0\n\n\n\n \n\n def search(u):\n\n for v,w in E[u]:\n\n if t[v] == -1:\n\n t[v] = t[u] if w % 2 == 0 else t[u]^1\n\n search(v)\n\n \n\n\n\n search(E[0][0][0])\n\n\n\n for i in t:\n\n write(i)\n\n write(' ')\n\n\n\n\n\n\n\n\n\n\n\n\n\n pass\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nsys.setrecursionlimit(2**31-1)\n\ninput = sys.stdin.readline\n\nwrite = lambda x: sys.stdout.write(str(x))\n\nLMIIS = lambda : list(map(int,input().split()))\n\nII = lambda : int(input())\n\ndbg = lambda *something : print(*something) if DEBUG is True else 0\n\nDEBUG = False\n\n\n\ndef main():\n\n\n\n N = II()\n\n t = [-1] * N\n\n\n\n\n\n E = [ [] for _ in range(N)]\n\n \n\n reached = [False] * N\n\n for _ in range(N-1):\n\n u,v,w = LMIIS()\n\n u -=1\n\n v -=1\n\n E[u].append((v,w))\n\n E[v].append((u,w))\n\n dbg(E)\n\n t[E[0][0][0]] = 0\n\n\n\n \n\n # def search(u):\n\n # for v,w in E[u]:\n\n # if t[v] == -1:\n\n # t[v] = t[u] if w % 2 == 0 else t[u]^1\n\n # search(v)\n\n \n\n\n\n # search(E[0][0][0])\n\n reached = [False] * N\n\n q = [E[0][0][0]]\n\n while q:\n\n u = q.pop()\n\n reached[u] = True\n\n for v,w in E[u]:\n\n if reached[v] != True and t[v] == -1:\n\n t[v] = t[u] if w % 2 == 0 else t[u]^1\n\n q.append(v)\n\n\n\n \n\n\n\n\n\n\n\n for i in t:\n\n write(i)\n\n write(' ')\n\n\n\n\n\n\n\n\n\n\n\n\n\n pass\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":49,"code_v1_loc":62,"code_v0_num_chars":892,"code_v1_num_chars":1201,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(2**31 - 1)\ninput = sys.stdin.readline\nwrite = lambda x: sys.stdout.write(str(x))\nLMIIS = lambda: list(map(int, input().split()))\nII = lambda: int(input())\ndbg = lambda *something: print(*something) if DEBUG is True else 0\nDEBUG = False\n\n\ndef main():\n N = II()\n t = [-1] * N\n E = [[] for _ in range(N)]\n reached = [False] * N\n for _ in range(N - 1):\n u, v, w = LMIIS()\n u -= 1\n v -= 1\n E[u].append((v, w))\n E[v].append((u, w))\n dbg(E)\n t[E[0][0][0]] = 0\n\n def search(u):\n for v, w in E[u]:\n if t[v] == -1:\n t[v] = t[u] if w % 2 == 0 else t[u] ^ 1\n search(v)\n\n search(E[0][0][0])\n for i in t:\n write(i)\n write(\" \")\n pass\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(2**31 - 1)\ninput = sys.stdin.readline\nwrite = lambda x: sys.stdout.write(str(x))\nLMIIS = lambda: list(map(int, input().split()))\nII = lambda: int(input())\ndbg = lambda *something: print(*something) if DEBUG is True else 0\nDEBUG = False\n\n\ndef main():\n N = II()\n t = [-1] * N\n E = [[] for _ in range(N)]\n reached = [False] * N\n for _ in range(N - 1):\n u, v, w = LMIIS()\n u -= 1\n v -= 1\n E[u].append((v, w))\n E[v].append((u, w))\n dbg(E)\n t[E[0][0][0]] = 0\n # def search(u):\n # for v,w in E[u]:\n # if t[v] == -1:\n # t[v] = t[u] if w % 2 == 0 else t[u]^1\n # search(v)\n # search(E[0][0][0])\n reached = [False] * N\n q = [E[0][0][0]]\n while q:\n u = q.pop()\n reached[u] = True\n for v, w in E[u]:\n if reached[v] != True and t[v] == -1:\n t[v] = t[u] if w % 2 == 0 else t[u] ^ 1\n q.append(v)\n for i in t:\n write(i)\n write(\" \")\n pass\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":20.9677419355,"diff":["-","- def search(u):","+ # def search(u):","+ # for v,w in E[u]:","+ # if t[v] == -1:","+ # t[v] = t[u] if w % 2 == 0 else t[u]^1","+ # search(v)","+ # search(E[0][0][0])","+ reached = [False] * N","+ q = [E[0][0][0]]","+ while q:","+ u = q.pop()","+ reached[u] = True","- if t[v] == -1:","+ if reached[v] != True and t[v] == -1:","- search(v)","-","- search(E[0][0][0])","+ q.append(v)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0576597493,"measured_runtime_v1":0.0439640545,"runtime_lift":1.3115202841,"key":["s380229285","s710524795"]} +{"user_id":"u171366497","problem_id":"p03829","language":"python","submission_id_v0":"s391874467","submission_id_v1":"s274136047","cpu_time_v0":103,"cpu_time_v1":76,"memory_v0":14252,"memory_v1":11480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.21,"input":"N,A,B=list(map(int,input().split()))\n\nX=list(map(int,input().split()))\n\nfrom collections import deque\n\nX=deque(X)\n\ncost=0\n\nnow=X.popleft()\n\nwhile len(X)>0:\n\n if (X[0]-now)*A<=B:\n\n cost+=(X[0]-now)*A\n\n else:cost+=B\n\n now=X.popleft()\n\nprint(cost)","target":"N,A,B=list(map(int,input().split()))\n\nnow=0\n\nans=0\n\nfor x in map(int,input().split()):\n\n if now!=0:\n\n if (x-now)*A>B:\n\n ans+=B\n\n else:\n\n ans+=(x-now)*A\n\n now=x\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":254,"code_v1_num_chars":207,"code_v0_no_empty_lines":"N, A, B = list(map(int, input().split()))\nX = list(map(int, input().split()))\nfrom collections import deque\n\nX = deque(X)\ncost = 0\nnow = X.popleft()\nwhile len(X) > 0:\n if (X[0] - now) * A <= B:\n cost += (X[0] - now) * A\n else:\n cost += B\n now = X.popleft()\nprint(cost)\n","code_v1_no_empty_lines":"N, A, B = list(map(int, input().split()))\nnow = 0\nans = 0\nfor x in map(int, input().split()):\n if now != 0:\n if (x - now) * A > B:\n ans += B\n else:\n ans += (x - now) * A\n now = x\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-X = list(map(int, input().split()))","-from collections import deque","-","-X = deque(X)","-cost = 0","-now = X.popleft()","-while len(X) > 0:","- if (X[0] - now) * A <= B:","- cost += (X[0] - now) * A","- else:","- cost += B","- now = X.popleft()","-print(cost)","+now = 0","+ans = 0","+for x in map(int, input().split()):","+ if now != 0:","+ if (x - now) * A > B:","+ ans += B","+ else:","+ ans += (x - now) * A","+ now = x","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373803191,"measured_runtime_v1":0.0384925504,"runtime_lift":0.9711052852,"key":["s391874467","s274136047"]} +{"user_id":"u667084803","problem_id":"p03426","language":"python","submission_id_v0":"s016186361","submission_id_v1":"s029577170","cpu_time_v0":1205,"cpu_time_v1":1100,"memory_v0":29616,"memory_v1":29692,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.71,"input":"H, W, D = list(map(int,input().split()))\n\ndist = [0]*(H*W+1)#dist[i]\u306fi\u304b\u3089i+D\u307e\u3067\u306e\u8ddd\u96e2\n\npos = [[0,0] for i in range(H*W+1)]\n\nfor i in range(H):\n\n A = list(map(int,input().split()))\n\n for j in range(W):\n\n pos[A[j]] = [i+1, j+1]\n\nfor i in range(H*W+1-D):\n\n dist[i] = abs(pos[i][0]-pos[i+D][0])+abs(pos[i][1]-pos[i+D][1])\n\ndistances = [[] for i in range(D)]#\u3042\u307e\u308a\u304ci\u306e\u8ddd\u96e2\n\nfor i in range(1,H*W+1-D):\n\n d = dist[i]\n\n distances[i%D]+=[d]\n\ndistances2 = [[0] for i in range(D)]#\u7d2f\u7a4d\u548c\u306b\u76f4\u3059\n\nfor i in range(D):\n\n for j in range(len(distances[i])):\n\n distances2[i]+=[distances2[i][-1]+distances[i][j]]\n\nQ = int(eval(input()))\n\nfor i in range(Q):\n\n L, R = list(map(int, input().split()))\n\n q = L%D\n\n l, r = (L-1)\/\/D, (R-1)\/\/D\n\n print((distances2[q][r]-distances2[q][l]))","target":"H, W, D = list(map(int,input().split()))\n\ndist = [0]*(H*W+1)#dist[i]\u306fi\u304b\u3089i+D\u307e\u3067\u306e\u8ddd\u96e2\n\npos = [[0,0] for i in range(H*W+1)]\n\nfor i in range(H):\n\n A = list(map(int,input().split()))\n\n for j in range(W):\n\n pos[A[j]] = [i+1, j+1]\n\n \n\nfor i in range(H*W+1-D):\n\n dist[i] = abs(pos[i][0]-pos[i+D][0])+abs(pos[i][1]-pos[i+D][1])\n\n\n\ndistances = [[] for i in range(D)]#\u3042\u307e\u308a\u304ci\u306e\u8ddd\u96e2\n\nfor i in range(1,H*W+1-D):\n\n distances[i%D]+=[dist[i]]\n\ndistances2 = [[0] for i in range(D)]#\u7d2f\u7a4d\u548c\u306b\u76f4\u3059\n\nfor i in range(D):\n\n for j in range(len(distances[i])):\n\n distances2[i]+=[distances2[i][-1]+distances[i][j]]\n\n\n\nQ = int(eval(input()))\n\nfor i in range(Q):\n\n L, R = list(map(int, input().split()))\n\n l, r = (L-1)\/\/D, (R-1)\/\/D\n\n print((distances2[L%D][r]-distances2[L%D][l]))","code_v0_loc":23,"code_v1_loc":24,"code_v0_num_chars":740,"code_v1_num_chars":734,"code_v0_no_empty_lines":"H, W, D = list(map(int, input().split()))\ndist = [0] * (H * W + 1) # dist[i]\u306fi\u304b\u3089i+D\u307e\u3067\u306e\u8ddd\u96e2\npos = [[0, 0] for i in range(H * W + 1)]\nfor i in range(H):\n A = list(map(int, input().split()))\n for j in range(W):\n pos[A[j]] = [i + 1, j + 1]\nfor i in range(H * W + 1 - D):\n dist[i] = abs(pos[i][0] - pos[i + D][0]) + abs(pos[i][1] - pos[i + D][1])\ndistances = [[] for i in range(D)] # \u3042\u307e\u308a\u304ci\u306e\u8ddd\u96e2\nfor i in range(1, H * W + 1 - D):\n d = dist[i]\n distances[i % D] += [d]\ndistances2 = [[0] for i in range(D)] # \u7d2f\u7a4d\u548c\u306b\u76f4\u3059\nfor i in range(D):\n for j in range(len(distances[i])):\n distances2[i] += [distances2[i][-1] + distances[i][j]]\nQ = int(eval(input()))\nfor i in range(Q):\n L, R = list(map(int, input().split()))\n q = L % D\n l, r = (L - 1) \/\/ D, (R - 1) \/\/ D\n print((distances2[q][r] - distances2[q][l]))\n","code_v1_no_empty_lines":"H, W, D = list(map(int, input().split()))\ndist = [0] * (H * W + 1) # dist[i]\u306fi\u304b\u3089i+D\u307e\u3067\u306e\u8ddd\u96e2\npos = [[0, 0] for i in range(H * W + 1)]\nfor i in range(H):\n A = list(map(int, input().split()))\n for j in range(W):\n pos[A[j]] = [i + 1, j + 1]\nfor i in range(H * W + 1 - D):\n dist[i] = abs(pos[i][0] - pos[i + D][0]) + abs(pos[i][1] - pos[i + D][1])\ndistances = [[] for i in range(D)] # \u3042\u307e\u308a\u304ci\u306e\u8ddd\u96e2\nfor i in range(1, H * W + 1 - D):\n distances[i % D] += [dist[i]]\ndistances2 = [[0] for i in range(D)] # \u7d2f\u7a4d\u548c\u306b\u76f4\u3059\nfor i in range(D):\n for j in range(len(distances[i])):\n distances2[i] += [distances2[i][-1] + distances[i][j]]\nQ = int(eval(input()))\nfor i in range(Q):\n L, R = list(map(int, input().split()))\n l, r = (L - 1) \/\/ D, (R - 1) \/\/ D\n print((distances2[L % D][r] - distances2[L % D][l]))\n","code_same":false,"relative_loc_diff_percent":4.1666666667,"diff":["- d = dist[i]","- distances[i % D] += [d]","+ distances[i % D] += [dist[i]]","- q = L % D","- print((distances2[q][r] - distances2[q][l]))","+ print((distances2[L % D][r] - distances2[L % D][l]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0364811523,"measured_runtime_v1":0.0582941263,"runtime_lift":0.6258118034,"key":["s016186361","s029577170"]} +{"user_id":"u360116509","problem_id":"p02861","language":"python","submission_id_v0":"s975410569","submission_id_v1":"s485051290","cpu_time_v0":328,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.82,"input":"N = int(eval(input()))\n\nP = [list(map(int, input().split())) for _ in range(N)]\n\nans = 0\n\nc = 0\n\n\n\ndef dfs(i, dis, passed):\n\n if len(passed) == N:\n\n global c, ans\n\n c += 1\n\n ans += dis\n\n return\n\n x = P[i][0]\n\n y = P[i][1]\n\n for ii in range(N):\n\n if P[ii] in passed:\n\n continue\n\n xx = P[ii][0]\n\n yy = P[ii][1]\n\n passed.append([xx, yy])\n\n dfs(ii, dis + ((x - xx)**2 + (y - yy)**2)**0.5, passed)\n\n passed.pop(-1)\n\n\n\nfor i in range(N):\n\n dfs(i, 0, [P[i]])\n\nprint((ans \/ c))","target":"import math\n\n\n\nN = int(eval(input()))\n\nP = [list(map(int, input().split())) for _ in range(N)]\n\ndis = 0\n\nc = 0\n\n\n\nfor i in range(N):\n\n xi = P[i][0]\n\n yi = P[i][1]\n\n for ii in range(i + 1, N):\n\n xj = P[ii][0]\n\n yj = P[ii][1]\n\n dis += ((xi - xj)**2 + (yi - yj)**2)**0.5\n\n c += 1\n\nprint((dis \/ c * (N - 1)))\n\n \n\n \n\n ","code_v0_loc":25,"code_v1_loc":19,"code_v0_num_chars":557,"code_v1_num_chars":355,"code_v0_no_empty_lines":"N = int(eval(input()))\nP = [list(map(int, input().split())) for _ in range(N)]\nans = 0\nc = 0\n\n\ndef dfs(i, dis, passed):\n if len(passed) == N:\n global c, ans\n c += 1\n ans += dis\n return\n x = P[i][0]\n y = P[i][1]\n for ii in range(N):\n if P[ii] in passed:\n continue\n xx = P[ii][0]\n yy = P[ii][1]\n passed.append([xx, yy])\n dfs(ii, dis + ((x - xx) ** 2 + (y - yy) ** 2) ** 0.5, passed)\n passed.pop(-1)\n\n\nfor i in range(N):\n dfs(i, 0, [P[i]])\nprint((ans \/ c))\n","code_v1_no_empty_lines":"import math\n\nN = int(eval(input()))\nP = [list(map(int, input().split())) for _ in range(N)]\ndis = 0\nc = 0\nfor i in range(N):\n xi = P[i][0]\n yi = P[i][1]\n for ii in range(i + 1, N):\n xj = P[ii][0]\n yj = P[ii][1]\n dis += ((xi - xj) ** 2 + (yi - yj) ** 2) ** 0.5\n c += 1\nprint((dis \/ c * (N - 1)))\n","code_same":false,"relative_loc_diff_percent":24.0,"diff":["+import math","+","-ans = 0","+dis = 0","-","-","-def dfs(i, dis, passed):","- if len(passed) == N:","- global c, ans","+for i in range(N):","+ xi = P[i][0]","+ yi = P[i][1]","+ for ii in range(i + 1, N):","+ xj = P[ii][0]","+ yj = P[ii][1]","+ dis += ((xi - xj) ** 2 + (yi - yj) ** 2) ** 0.5","- ans += dis","- return","- x = P[i][0]","- y = P[i][1]","- for ii in range(N):","- if P[ii] in passed:","- continue","- xx = P[ii][0]","- yy = P[ii][1]","- passed.append([xx, yy])","- dfs(ii, dis + ((x - xx) ** 2 + (y - yy) ** 2) ** 0.5, passed)","- passed.pop(-1)","-","-","-for i in range(N):","- dfs(i, 0, [P[i]])","-print((ans \/ c))","+print((dis \/ c * (N - 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0754516602,"measured_runtime_v1":0.0376939297,"runtime_lift":2.0016926012,"key":["s975410569","s485051290"]} +{"user_id":"u078042885","problem_id":"p00687","language":"python","submission_id_v0":"s608838603","submission_id_v1":"s584373157","cpu_time_v0":1620,"cpu_time_v1":530,"memory_v0":54344,"memory_v1":15520,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.28,"input":"while 1:\n\n n,a,b=list(map(int,input().split()))\n\n if n==a==b==0:break\n\n c=0;d=[1]+[0]*2000000\n\n for i in range(0,n+1):\n\n if d[i]:d[i+a]=d[i+b]=1\n\n else:c+=1\n\n print(c)","target":"while 1:\n\n n,a,b=list(map(int,input().split()))\n\n if n==a==b==0:break\n\n c=0;d=[1]*(n+1)\n\n for x in range(a):\n\n for i in range(x*b,n+1,a):d[i]=0\n\n print((sum(d)))","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":190,"code_v1_num_chars":175,"code_v0_no_empty_lines":"while 1:\n n, a, b = list(map(int, input().split()))\n if n == a == b == 0:\n break\n c = 0\n d = [1] + [0] * 2000000\n for i in range(0, n + 1):\n if d[i]:\n d[i + a] = d[i + b] = 1\n else:\n c += 1\n print(c)\n","code_v1_no_empty_lines":"while 1:\n n, a, b = list(map(int, input().split()))\n if n == a == b == 0:\n break\n c = 0\n d = [1] * (n + 1)\n for x in range(a):\n for i in range(x * b, n + 1, a):\n d[i] = 0\n print((sum(d)))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["- d = [1] + [0] * 2000000","- for i in range(0, n + 1):","- if d[i]:","- d[i + a] = d[i + b] = 1","- else:","- c += 1","- print(c)","+ d = [1] * (n + 1)","+ for x in range(a):","+ for i in range(x * b, n + 1, a):","+ d[i] = 0","+ print((sum(d)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.173348192,"measured_runtime_v1":0.0386442285,"runtime_lift":4.4857459664,"key":["s608838603","s584373157"]} +{"user_id":"u983918956","problem_id":"p03576","language":"python","submission_id_v0":"s401538057","submission_id_v1":"s233639663","cpu_time_v0":1570,"cpu_time_v1":1300,"memory_v0":48476,"memory_v1":48604,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.2,"input":"inf = float('inf')\n\n\n\nN,K = list(map(int,input().split()))\n\nans = inf\n\nX = []\n\nY = []\n\nXY = []\n\nfor _ in range(N):\n\n x,y = list(map(int,input().split()))\n\n X.append(x)\n\n Y.append(y)\n\n XY.append((x,y))\n\n\n\nX = sorted(X)\n\nY = sorted(Y)\n\n\n\nfor i in range(N):\n\n for j in range(i+1,N):\n\n for k in range(N):\n\n for l in range(k+1,N):\n\n cnt = 0\n\n for x, y in XY:\n\n if X[i] <= x <= X[j] and Y[k] <= y <= Y[l]:\n\n cnt += 1\n\n if cnt < K: continue\n\n S = (Y[l]-Y[k])*(X[j]-X[i])\n\n if S < ans:\n\n ans = S\n\n\n\nprint(ans)","target":"inf = float('inf')\n\n\n\nN,K = list(map(int,input().split()))\n\nans = inf\n\nX = []\n\nY = []\n\nXY = []\n\nfor _ in range(N):\n\n x,y = list(map(int,input().split()))\n\n X.append(x)\n\n Y.append(y)\n\n XY.append((x,y))\n\n\n\nX = sorted(X)\n\nY = sorted(Y)\n\n\n\nfor i, left in enumerate(X):\n\n for right in X[i+1:]:\n\n for j, bottom in enumerate(Y):\n\n for top in Y[j+1:]:\n\n cnt = 0\n\n for x, y in XY:\n\n if left <= x <= right and bottom <= y <= top:\n\n cnt += 1\n\n if cnt < K: continue\n\n S = (right-left)*(top-bottom)\n\n if S < ans:\n\n ans = S\n\n\n\nprint(ans)","code_v0_loc":30,"code_v1_loc":30,"code_v0_num_chars":658,"code_v1_num_chars":680,"code_v0_no_empty_lines":"inf = float(\"inf\")\nN, K = list(map(int, input().split()))\nans = inf\nX = []\nY = []\nXY = []\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n X.append(x)\n Y.append(y)\n XY.append((x, y))\nX = sorted(X)\nY = sorted(Y)\nfor i in range(N):\n for j in range(i + 1, N):\n for k in range(N):\n for l in range(k + 1, N):\n cnt = 0\n for x, y in XY:\n if X[i] <= x <= X[j] and Y[k] <= y <= Y[l]:\n cnt += 1\n if cnt < K:\n continue\n S = (Y[l] - Y[k]) * (X[j] - X[i])\n if S < ans:\n ans = S\nprint(ans)\n","code_v1_no_empty_lines":"inf = float(\"inf\")\nN, K = list(map(int, input().split()))\nans = inf\nX = []\nY = []\nXY = []\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n X.append(x)\n Y.append(y)\n XY.append((x, y))\nX = sorted(X)\nY = sorted(Y)\nfor i, left in enumerate(X):\n for right in X[i + 1 :]:\n for j, bottom in enumerate(Y):\n for top in Y[j + 1 :]:\n cnt = 0\n for x, y in XY:\n if left <= x <= right and bottom <= y <= top:\n cnt += 1\n if cnt < K:\n continue\n S = (right - left) * (top - bottom)\n if S < ans:\n ans = S\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(N):","- for j in range(i + 1, N):","- for k in range(N):","- for l in range(k + 1, N):","+for i, left in enumerate(X):","+ for right in X[i + 1 :]:","+ for j, bottom in enumerate(Y):","+ for top in Y[j + 1 :]:","- if X[i] <= x <= X[j] and Y[k] <= y <= Y[l]:","+ if left <= x <= right and bottom <= y <= top:","- S = (Y[l] - Y[k]) * (X[j] - X[i])","+ S = (right - left) * (top - bottom)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0405538273,"measured_runtime_v1":0.0473454385,"runtime_lift":0.856551942,"key":["s401538057","s233639663"]} +{"user_id":"u579699847","problem_id":"p03164","language":"python","submission_id_v0":"s972242150","submission_id_v1":"s965726767","cpu_time_v0":1319,"cpu_time_v1":1100,"memory_v0":316488,"memory_v1":314920,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.6,"input":"import itertools,sys\n\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\nN,W = LI()\n\nwv = [LI() for _ in range(N)]\n\nV = 10**5\n\ndp = [[float('INF')]*(V+1) for _ in range(N+1)]\n\ndp[0][0] = 0\n\nfor i,j in itertools.product(list(range(1,N+1)),list(range(V+1))):\n\n w,v = wv[i-1]\n\n if j-v>=0 and dp[i-1][j-v]+w<=W:\n\n dp[i][j] = min(dp[i][j],dp[i-1][j-v]+w)\n\n dp[i][j] = min(dp[i][j],dp[i-1][j])\n\nprint((max([i for i in range(V+1) if dp[-1][i]<=W])))\n","target":"import sys\n\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\nN,W = LI()\n\nwv = [LI() for _ in range(N)]\n\nV = N*10**3\n\ndp = [[float('INF')]*(V+1) for _ in range(N+1)]\n\ndp[0][0] = 0\n\nfor i in range(1,N+1):\n\n w,v = wv[i-1]\n\n for j in range(V+1):\n\n if j-v>=0 and dp[i-1][j-v]+w<=W:\n\n dp[i][j] = min(dp[i][j],dp[i-1][j-v]+w)\n\n dp[i][j] = min(dp[i][j],dp[i-1][j])\n\nprint((max([i for i in range(V+1) if dp[-1][i]<=W])))\n","code_v0_loc":13,"code_v1_loc":14,"code_v0_num_chars":465,"code_v1_num_chars":463,"code_v0_no_empty_lines":"import itertools, sys\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\nN, W = LI()\nwv = [LI() for _ in range(N)]\nV = 10**5\ndp = [[float(\"INF\")] * (V + 1) for _ in range(N + 1)]\ndp[0][0] = 0\nfor i, j in itertools.product(list(range(1, N + 1)), list(range(V + 1))):\n w, v = wv[i - 1]\n if j - v >= 0 and dp[i - 1][j - v] + w <= W:\n dp[i][j] = min(dp[i][j], dp[i - 1][j - v] + w)\n dp[i][j] = min(dp[i][j], dp[i - 1][j])\nprint((max([i for i in range(V + 1) if dp[-1][i] <= W])))\n","code_v1_no_empty_lines":"import sys\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\nN, W = LI()\nwv = [LI() for _ in range(N)]\nV = N * 10**3\ndp = [[float(\"INF\")] * (V + 1) for _ in range(N + 1)]\ndp[0][0] = 0\nfor i in range(1, N + 1):\n w, v = wv[i - 1]\n for j in range(V + 1):\n if j - v >= 0 and dp[i - 1][j - v] + w <= W:\n dp[i][j] = min(dp[i][j], dp[i - 1][j - v] + w)\n dp[i][j] = min(dp[i][j], dp[i - 1][j])\nprint((max([i for i in range(V + 1) if dp[-1][i] <= W])))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-import itertools, sys","+import sys","-V = 10**5","+V = N * 10**3","-for i, j in itertools.product(list(range(1, N + 1)), list(range(V + 1))):","+for i in range(1, N + 1):","- if j - v >= 0 and dp[i - 1][j - v] + w <= W:","- dp[i][j] = min(dp[i][j], dp[i - 1][j - v] + w)","- dp[i][j] = min(dp[i][j], dp[i - 1][j])","+ for j in range(V + 1):","+ if j - v >= 0 and dp[i - 1][j - v] + w <= W:","+ dp[i][j] = min(dp[i][j], dp[i - 1][j - v] + w)","+ dp[i][j] = min(dp[i][j], dp[i - 1][j])"],"diff_only_import_comment":false,"measured_runtime_v0":1.0372286065,"measured_runtime_v1":0.0492881937,"runtime_lift":21.0441594291,"key":["s972242150","s965726767"]} +{"user_id":"u309977459","problem_id":"p03816","language":"python","submission_id_v0":"s812111215","submission_id_v1":"s281693361","cpu_time_v0":54,"cpu_time_v1":48,"memory_v0":18656,"memory_v1":14396,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"from collections import Counter\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nC = Counter(A)\n\nans = len(C)\n\nif (N-ans) % 2 == 1:\n\n ans -= 1\n\nprint(ans)\n","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nS = set(A)\n\nans = len(S)\n\nif (N-ans) % 2 == 1:\n\n ans -= 1\n\nprint(ans)\n","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":167,"code_v1_num_chars":128,"code_v0_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nC = Counter(A)\nans = len(C)\nif (N - ans) % 2 == 1:\n ans -= 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nS = set(A)\nans = len(S)\nif (N - ans) % 2 == 1:\n ans -= 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-from collections import Counter","-","-C = Counter(A)","-ans = len(C)","+S = set(A)","+ans = len(S)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0366122578,"measured_runtime_v1":0.0367668682,"runtime_lift":0.9957948443,"key":["s812111215","s281693361"]} +{"user_id":"u216928054","problem_id":"p02624","language":"python","submission_id_v0":"s743105433","submission_id_v1":"s935676754","cpu_time_v0":1565,"cpu_time_v1":33,"memory_v0":9628,"memory_v1":9568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":97.89,"input":"#!\/usr\/bin\/env python3\n\n\n\nfrom functools import reduce\n\nfrom operator import mul\n\nfrom collections import defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nfrom math import sqrt, floor\n\n\n\nsys.setrecursionlimit(10**6)\n\ninput = sys.stdin.buffer.readline\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\n\n\n\n\ndef debug(*x):\n\n print((*x))\n\n\n\n\n\ndef solve(N):\n\n ret = 0\n\n for i in range(1, N + 1):\n\n num = N \/\/ i\n\n end = num * i\n\n ret += (i + end) * num \/\/ 2\n\n print(ret)\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n solve(N)\n\n\n\n\n\ndef _test():\n\n \"\"\"\n\n >>> solve(4)\n\n 23\n\n\n\n >>> solve(100)\n\n 26879\n\n\n\n >>> solve(10000000)\n\n 838627288460105\n\n \"\"\"\n\n import doctest\n\n doctest.testmod()\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n global read, input\n\n f = io.StringIO(s.strip())\n\n input = f.readline\n\n read = f.read\n\n\n\n\n\nUSE_NUMBA = False\n\nif (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':\n\n print(\"compiling\")\n\n from numba.pycc import CC\n\n cc = CC('my_module')\n\n cc.export('solve', solve.__doc__.strip().split()[0])(solve)\n\n cc.compile()\n\n exit()\n\nelse:\n\n input = sys.stdin.buffer.readline\n\n read = sys.stdin.buffer.read\n\n\n\n if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == \"--numba\":\n\n # -p: pure python mode\n\n # if not -p, import compiled module\n\n from my_module import solve # pylint: disable=all\n\n elif sys.argv[-1] == \"-t\":\n\n _test()\n\n sys.exit()\n\n elif sys.argv[-1] != '-p' and len(sys.argv) == 2:\n\n # input given as file\n\n input_as_file = open(sys.argv[1])\n\n input = input_as_file.buffer.readline\n\n read = input_as_file.buffer.read\n\n\n\n main()\n","target":"#!\/usr\/bin\/env python3\n\n\n\nfrom functools import reduce\n\nfrom operator import mul\n\nfrom collections import defaultdict, Counter\n\nfrom heapq import heappush, heappop\n\nimport sys\n\nfrom math import sqrt, floor\n\n\n\nsys.setrecursionlimit(10**6)\n\ninput = sys.stdin.buffer.readline\n\nINF = 10 ** 9 + 1 # sys.maxsize # float(\"inf\")\n\n\n\n\n\ndef debug(*x):\n\n print((*x))\n\n\n\n\n\ndef solve(N):\n\n ret = 0\n\n i = 2\n\n while True:\n\n step = i \/\/ 2\n\n start = (i + 1) \/\/ 2 * step\n\n if start > N:\n\n break\n\n end = N \/\/ step * step\n\n ret += (start + end) * ((end - start) \/\/ step + 1) \/\/ 2\n\n i += 1\n\n print(ret)\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n solve(N)\n\n\n\n\n\ndef _test():\n\n \"\"\"\n\n >>> solve(4)\n\n 23\n\n\n\n >>> solve(100)\n\n 26879\n\n\n\n >>> solve(10000000)\n\n 838627288460105\n\n \"\"\"\n\n import doctest\n\n doctest.testmod()\n\n\n\n\n\ndef as_input(s):\n\n \"use in test, use given string as input file\"\n\n import io\n\n global read, input\n\n f = io.StringIO(s.strip())\n\n input = f.readline\n\n read = f.read\n\n\n\n\n\nUSE_NUMBA = False\n\nif (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':\n\n print(\"compiling\")\n\n from numba.pycc import CC\n\n cc = CC('my_module')\n\n cc.export('solve', solve.__doc__.strip().split()[0])(solve)\n\n cc.compile()\n\n exit()\n\nelse:\n\n input = sys.stdin.buffer.readline\n\n read = sys.stdin.buffer.read\n\n\n\n if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == \"--numba\":\n\n # -p: pure python mode\n\n # if not -p, import compiled module\n\n from my_module import solve # pylint: disable=all\n\n elif sys.argv[-1] == \"-t\":\n\n _test()\n\n sys.exit()\n\n elif sys.argv[-1] != '-p' and len(sys.argv) == 2:\n\n # input given as file\n\n input_as_file = open(sys.argv[1])\n\n input = input_as_file.buffer.readline\n\n read = input_as_file.buffer.read\n\n\n\n main()\n","code_v0_loc":82,"code_v1_loc":87,"code_v0_num_chars":1814,"code_v1_num_chars":1944,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nfrom functools import reduce\nfrom operator import mul\nfrom collections import defaultdict, Counter\nfrom heapq import heappush, heappop\nimport sys\nfrom math import sqrt, floor\n\nsys.setrecursionlimit(10**6)\ninput = sys.stdin.buffer.readline\nINF = 10**9 + 1 # sys.maxsize # float(\"inf\")\n\n\ndef debug(*x):\n print((*x))\n\n\ndef solve(N):\n ret = 0\n for i in range(1, N + 1):\n num = N \/\/ i\n end = num * i\n ret += (i + end) * num \/\/ 2\n print(ret)\n\n\ndef main():\n N = int(eval(input()))\n solve(N)\n\n\ndef _test():\n \"\"\"\n >>> solve(4)\n 23\n >>> solve(100)\n 26879\n >>> solve(10000000)\n 838627288460105\n \"\"\"\n import doctest\n\n doctest.testmod()\n\n\ndef as_input(s):\n \"use in test, use given string as input file\"\n import io\n\n global read, input\n f = io.StringIO(s.strip())\n input = f.readline\n read = f.read\n\n\nUSE_NUMBA = False\nif (USE_NUMBA and sys.argv[-1] == \"ONLINE_JUDGE\") or sys.argv[-1] == \"-c\":\n print(\"compiling\")\n from numba.pycc import CC\n\n cc = CC(\"my_module\")\n cc.export(\"solve\", solve.__doc__.strip().split()[0])(solve)\n cc.compile()\n exit()\nelse:\n input = sys.stdin.buffer.readline\n read = sys.stdin.buffer.read\n if (USE_NUMBA and sys.argv[-1] != \"-p\") or sys.argv[-1] == \"--numba\":\n # -p: pure python mode\n # if not -p, import compiled module\n from my_module import solve # pylint: disable=all\n elif sys.argv[-1] == \"-t\":\n _test()\n sys.exit()\n elif sys.argv[-1] != \"-p\" and len(sys.argv) == 2:\n # input given as file\n input_as_file = open(sys.argv[1])\n input = input_as_file.buffer.readline\n read = input_as_file.buffer.read\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nfrom functools import reduce\nfrom operator import mul\nfrom collections import defaultdict, Counter\nfrom heapq import heappush, heappop\nimport sys\nfrom math import sqrt, floor\n\nsys.setrecursionlimit(10**6)\ninput = sys.stdin.buffer.readline\nINF = 10**9 + 1 # sys.maxsize # float(\"inf\")\n\n\ndef debug(*x):\n print((*x))\n\n\ndef solve(N):\n ret = 0\n i = 2\n while True:\n step = i \/\/ 2\n start = (i + 1) \/\/ 2 * step\n if start > N:\n break\n end = N \/\/ step * step\n ret += (start + end) * ((end - start) \/\/ step + 1) \/\/ 2\n i += 1\n print(ret)\n\n\ndef main():\n N = int(eval(input()))\n solve(N)\n\n\ndef _test():\n \"\"\"\n >>> solve(4)\n 23\n >>> solve(100)\n 26879\n >>> solve(10000000)\n 838627288460105\n \"\"\"\n import doctest\n\n doctest.testmod()\n\n\ndef as_input(s):\n \"use in test, use given string as input file\"\n import io\n\n global read, input\n f = io.StringIO(s.strip())\n input = f.readline\n read = f.read\n\n\nUSE_NUMBA = False\nif (USE_NUMBA and sys.argv[-1] == \"ONLINE_JUDGE\") or sys.argv[-1] == \"-c\":\n print(\"compiling\")\n from numba.pycc import CC\n\n cc = CC(\"my_module\")\n cc.export(\"solve\", solve.__doc__.strip().split()[0])(solve)\n cc.compile()\n exit()\nelse:\n input = sys.stdin.buffer.readline\n read = sys.stdin.buffer.read\n if (USE_NUMBA and sys.argv[-1] != \"-p\") or sys.argv[-1] == \"--numba\":\n # -p: pure python mode\n # if not -p, import compiled module\n from my_module import solve # pylint: disable=all\n elif sys.argv[-1] == \"-t\":\n _test()\n sys.exit()\n elif sys.argv[-1] != \"-p\" and len(sys.argv) == 2:\n # input given as file\n input_as_file = open(sys.argv[1])\n input = input_as_file.buffer.readline\n read = input_as_file.buffer.read\n main()\n","code_same":false,"relative_loc_diff_percent":5.7471264368,"diff":["- for i in range(1, N + 1):","- num = N \/\/ i","- end = num * i","- ret += (i + end) * num \/\/ 2","+ i = 2","+ while True:","+ step = i \/\/ 2","+ start = (i + 1) \/\/ 2 * step","+ if start > N:","+ break","+ end = N \/\/ step * step","+ ret += (start + end) * ((end - start) \/\/ step + 1) \/\/ 2","+ i += 1"],"diff_only_import_comment":false,"measured_runtime_v0":1.2514929175,"measured_runtime_v1":0.0448847055,"runtime_lift":27.8823911643,"key":["s743105433","s935676754"]} +{"user_id":"u311379832","problem_id":"p02983","language":"python","submission_id_v0":"s731750775","submission_id_v1":"s098585967","cpu_time_v0":994,"cpu_time_v1":842,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.29,"input":"inf = 2019\n\nL, R = list(map(int, input().split()))\n\nans = 0\n\ndf = R - L\n\nif df < 2019:\n\n L = L % inf\n\n R = L + df\n\n ans = 2019\n\n for i in range(L, R):\n\n for j in range(i + 1, R + 1):\n\n tmp = int((i * j) % inf)\n\n ans = min(ans, tmp)\n\n\n\nprint(ans)","target":"l, r = list(map(int, input().split()))\n\nMOD = 2019\n\ndiff = r - l\n\nans = 0\n\nif diff < 2019:\n\n l = l % MOD\n\n r = l + diff\n\n ans = 2018\n\n for i in range(l, r):\n\n for j in range(i + 1, r + 1):\n\n ans = min(ans, (i % MOD * j % MOD) % MOD)\n\n\n\nprint(ans)\n","code_v0_loc":14,"code_v1_loc":13,"code_v0_num_chars":280,"code_v1_num_chars":277,"code_v0_no_empty_lines":"inf = 2019\nL, R = list(map(int, input().split()))\nans = 0\ndf = R - L\nif df < 2019:\n L = L % inf\n R = L + df\n ans = 2019\n for i in range(L, R):\n for j in range(i + 1, R + 1):\n tmp = int((i * j) % inf)\n ans = min(ans, tmp)\nprint(ans)\n","code_v1_no_empty_lines":"l, r = list(map(int, input().split()))\nMOD = 2019\ndiff = r - l\nans = 0\nif diff < 2019:\n l = l % MOD\n r = l + diff\n ans = 2018\n for i in range(l, r):\n for j in range(i + 1, r + 1):\n ans = min(ans, (i % MOD * j % MOD) % MOD)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["-inf = 2019","-L, R = list(map(int, input().split()))","+l, r = list(map(int, input().split()))","+MOD = 2019","+diff = r - l","-df = R - L","-if df < 2019:","- L = L % inf","- R = L + df","- ans = 2019","- for i in range(L, R):","- for j in range(i + 1, R + 1):","- tmp = int((i * j) % inf)","- ans = min(ans, tmp)","+if diff < 2019:","+ l = l % MOD","+ r = l + diff","+ ans = 2018","+ for i in range(l, r):","+ for j in range(i + 1, r + 1):","+ ans = min(ans, (i % MOD * j % MOD) % MOD)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0661064799,"measured_runtime_v1":0.0564998748,"runtime_lift":1.1700287845,"key":["s731750775","s098585967"]} +{"user_id":"u888092736","problem_id":"p03137","language":"python","submission_id_v0":"s005023174","submission_id_v1":"s171241064","cpu_time_v0":110,"cpu_time_v1":90,"memory_v0":13968,"memory_v1":19988,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"N, M = list(map(int, input().split()))\n\nX = sorted(map(int, input().split()))\n\ndiff = [0] * (M - 1)\n\nfor i in range(M - 1):\n\n diff[i] = X[i + 1] - X[i]\n\nprint((sum(sorted(diff)[: max(0, M - N)])))\n","target":"N, M, *X = list(map(int, open(0).read().split()))\n\n\n\nif N >= M:\n\n print((0))\n\n exit()\n\n\n\nX.sort()\n\ndiff = []\n\nfor i in range(M - 1):\n\n diff.append(X[i + 1] - X[i])\n\ndiff.sort()\n\nprint((sum(diff[: M - N])))\n\n\n","code_v0_loc":6,"code_v1_loc":13,"code_v0_num_chars":192,"code_v1_num_chars":207,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nX = sorted(map(int, input().split()))\ndiff = [0] * (M - 1)\nfor i in range(M - 1):\n diff[i] = X[i + 1] - X[i]\nprint((sum(sorted(diff)[: max(0, M - N)])))\n","code_v1_no_empty_lines":"N, M, *X = list(map(int, open(0).read().split()))\nif N >= M:\n print((0))\n exit()\nX.sort()\ndiff = []\nfor i in range(M - 1):\n diff.append(X[i + 1] - X[i])\ndiff.sort()\nprint((sum(diff[: M - N])))\n","code_same":false,"relative_loc_diff_percent":53.8461538462,"diff":["-N, M = list(map(int, input().split()))","-X = sorted(map(int, input().split()))","-diff = [0] * (M - 1)","+N, M, *X = list(map(int, open(0).read().split()))","+if N >= M:","+ print((0))","+ exit()","+X.sort()","+diff = []","- diff[i] = X[i + 1] - X[i]","-print((sum(sorted(diff)[: max(0, M - N)])))","+ diff.append(X[i + 1] - X[i])","+diff.sort()","+print((sum(diff[: M - N])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0458179269,"measured_runtime_v1":0.0460033975,"runtime_lift":0.9959683284,"key":["s005023174","s171241064"]} +{"user_id":"u994988729","problem_id":"p03426","language":"python","submission_id_v0":"s485992582","submission_id_v1":"s629397833","cpu_time_v0":1081,"cpu_time_v1":547,"memory_v0":26812,"memory_v1":51168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.4,"input":"import numpy as np\n\nh, w, d = map(int, input().split())\n\nX = np.zeros(h*w, dtype=int)\n\nY = np.zeros(h*w, dtype=int)\n\nscore = np.zeros(h*w, dtype=int)\n\nfor x in range(h):\n\n inp = tuple(map(int, input().split()))\n\n for y in range(w):\n\n i = int(inp[y]) - 1\n\n X[i] = x\n\n Y[i] = y\n\n\n\nscore[d:] += np.abs(X[d:] - X[:-d]) + np.abs(Y[d:] - Y[:-d])\n\nfor i in range(len(score) - d):\n\n score[i+d] += score[i]\n\n\n\nq = int(input())\n\nans = []\n\nfor _ in range(q):\n\n l, r = map(int, input().split())\n\n l -= 1\n\n r -= 1\n\n ans.append(score[r]-score[l])\n\n\n\nprint(*ans, sep=\"\\n\")\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(10 ** 7)\n\n\n\nH, W, D = map(int, readline().split())\n\nA = [list(map(int, readline().split())) for _ in range(H)]\n\nQ = int(readline())\n\nquery = [tuple(map(int, readline().split())) for _ in range(Q)]\n\n\n\npath = [[(-1, -1)]*((H*W)\/\/D+1) for _ in range(D)]\n\nfor i in range(H):\n\n for j in range(W):\n\n a = A[i][j]\n\n div, mod = divmod(a, D)\n\n path[mod][div] = (i, j)\n\npath[0][0] = path[0][1]\n\n\n\ncost = []\n\nfor i in range(D):\n\n tmp = [0]\n\n for l, r in zip(path[i][:-1], path[i][1:]):\n\n x, y = l\n\n z, w = r\n\n tmp.append(tmp[-1] + abs(z - x) + abs(w - y))\n\n cost.append(tmp)\n\n\n\nans = []\n\nfor L, R in query:\n\n vl, md = divmod(L, D)\n\n vr = R \/\/ D\n\n\n\n tmp = cost[md][vr] - cost[md][vl]\n\n ans.append(tmp)\n\n\n\nprint(*ans, sep=\"\\n\")\n","code_v0_loc":25,"code_v1_loc":37,"code_v0_num_chars":600,"code_v1_num_chars":922,"code_v0_no_empty_lines":"import numpy as np\n\nh, w, d = map(int, input().split())\nX = np.zeros(h * w, dtype=int)\nY = np.zeros(h * w, dtype=int)\nscore = np.zeros(h * w, dtype=int)\nfor x in range(h):\n inp = tuple(map(int, input().split()))\n for y in range(w):\n i = int(inp[y]) - 1\n X[i] = x\n Y[i] = y\nscore[d:] += np.abs(X[d:] - X[:-d]) + np.abs(Y[d:] - Y[:-d])\nfor i in range(len(score) - d):\n score[i + d] += score[i]\nq = int(input())\nans = []\nfor _ in range(q):\n l, r = map(int, input().split())\n l -= 1\n r -= 1\n ans.append(score[r] - score[l])\nprint(*ans, sep=\"\\n\")\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**7)\nH, W, D = map(int, readline().split())\nA = [list(map(int, readline().split())) for _ in range(H)]\nQ = int(readline())\nquery = [tuple(map(int, readline().split())) for _ in range(Q)]\npath = [[(-1, -1)] * ((H * W) \/\/ D + 1) for _ in range(D)]\nfor i in range(H):\n for j in range(W):\n a = A[i][j]\n div, mod = divmod(a, D)\n path[mod][div] = (i, j)\npath[0][0] = path[0][1]\ncost = []\nfor i in range(D):\n tmp = [0]\n for l, r in zip(path[i][:-1], path[i][1:]):\n x, y = l\n z, w = r\n tmp.append(tmp[-1] + abs(z - x) + abs(w - y))\n cost.append(tmp)\nans = []\nfor L, R in query:\n vl, md = divmod(L, D)\n vr = R \/\/ D\n tmp = cost[md][vr] - cost[md][vl]\n ans.append(tmp)\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":32.4324324324,"diff":["-import numpy as np","+import sys","-h, w, d = map(int, input().split())","-X = np.zeros(h * w, dtype=int)","-Y = np.zeros(h * w, dtype=int)","-score = np.zeros(h * w, dtype=int)","-for x in range(h):","- inp = tuple(map(int, input().split()))","- for y in range(w):","- i = int(inp[y]) - 1","- X[i] = x","- Y[i] = y","-score[d:] += np.abs(X[d:] - X[:-d]) + np.abs(Y[d:] - Y[:-d])","-for i in range(len(score) - d):","- score[i + d] += score[i]","-q = int(input())","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+sys.setrecursionlimit(10**7)","+H, W, D = map(int, readline().split())","+A = [list(map(int, readline().split())) for _ in range(H)]","+Q = int(readline())","+query = [tuple(map(int, readline().split())) for _ in range(Q)]","+path = [[(-1, -1)] * ((H * W) \/\/ D + 1) for _ in range(D)]","+for i in range(H):","+ for j in range(W):","+ a = A[i][j]","+ div, mod = divmod(a, D)","+ path[mod][div] = (i, j)","+path[0][0] = path[0][1]","+cost = []","+for i in range(D):","+ tmp = [0]","+ for l, r in zip(path[i][:-1], path[i][1:]):","+ x, y = l","+ z, w = r","+ tmp.append(tmp[-1] + abs(z - x) + abs(w - y))","+ cost.append(tmp)","-for _ in range(q):","- l, r = map(int, input().split())","- l -= 1","- r -= 1","- ans.append(score[r] - score[l])","+for L, R in query:","+ vl, md = divmod(L, D)","+ vr = R \/\/ D","+ tmp = cost[md][vr] - cost[md][vl]","+ ans.append(tmp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1589611537,"measured_runtime_v1":0.0360875115,"runtime_lift":4.4048798856,"key":["s485992582","s629397833"]} +{"user_id":"u997641430","problem_id":"p02574","language":"python","submission_id_v0":"s540803392","submission_id_v1":"s573960211","cpu_time_v0":1703,"cpu_time_v1":940,"memory_v0":301756,"memory_v1":127544,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.8,"input":"n = int(eval(input()))\n\n*A, = list(map(int, input().split()))\n\nm = max(2, max(A))\n\nP = {p: True for p in range(2, m + 1)}\n\nfor i in range(2, m + 1):\n\n for j in range(2 * i, m + 1, i):\n\n P[j] = False\n\nPmap = {p: 0 for p in P if P[p]}\n\nAmap = {a: 0 for a in range(1, m + 1)}\n\nfor a in A:\n\n Amap[a] += 1\n\nfor p in Pmap:\n\n for a in range(p, m + 1, p):\n\n Pmap[p] += Amap[a]\n\ns = max(Pmap.values())\n\nif s < 2:\n\n print('pairwise coprime')\n\nelif s < n:\n\n print('setwise coprime')\n\nelse:\n\n print('not coprime')\n","target":"n = int(eval(input()))\n\n*A, = list(map(int, input().split()))\n\nm = max(A)\n\nC = [0 for a in range(m + 1)]\n\nfor a in A:\n\n C[a] += 1\n\ns = 0\n\nfor a in range(2, m + 1):\n\n s = max(s, sum(C[a::a]))\n\nif s < 2:\n\n print('pairwise coprime')\n\nelif s < n:\n\n print('setwise coprime')\n\nelse:\n\n print('not coprime')\n","code_v0_loc":21,"code_v1_loc":15,"code_v0_num_chars":522,"code_v1_num_chars":303,"code_v0_no_empty_lines":"n = int(eval(input()))\n(*A,) = list(map(int, input().split()))\nm = max(2, max(A))\nP = {p: True for p in range(2, m + 1)}\nfor i in range(2, m + 1):\n for j in range(2 * i, m + 1, i):\n P[j] = False\nPmap = {p: 0 for p in P if P[p]}\nAmap = {a: 0 for a in range(1, m + 1)}\nfor a in A:\n Amap[a] += 1\nfor p in Pmap:\n for a in range(p, m + 1, p):\n Pmap[p] += Amap[a]\ns = max(Pmap.values())\nif s < 2:\n print(\"pairwise coprime\")\nelif s < n:\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\n(*A,) = list(map(int, input().split()))\nm = max(A)\nC = [0 for a in range(m + 1)]\nfor a in A:\n C[a] += 1\ns = 0\nfor a in range(2, m + 1):\n s = max(s, sum(C[a::a]))\nif s < 2:\n print(\"pairwise coprime\")\nelif s < n:\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-m = max(2, max(A))","-P = {p: True for p in range(2, m + 1)}","-for i in range(2, m + 1):","- for j in range(2 * i, m + 1, i):","- P[j] = False","-Pmap = {p: 0 for p in P if P[p]}","-Amap = {a: 0 for a in range(1, m + 1)}","+m = max(A)","+C = [0 for a in range(m + 1)]","- Amap[a] += 1","-for p in Pmap:","- for a in range(p, m + 1, p):","- Pmap[p] += Amap[a]","-s = max(Pmap.values())","+ C[a] += 1","+s = 0","+for a in range(2, m + 1):","+ s = max(s, sum(C[a::a]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0438258257,"measured_runtime_v1":0.0435450721,"runtime_lift":1.0064474254,"key":["s540803392","s573960211"]} +{"user_id":"u573234244","problem_id":"p02755","language":"python","submission_id_v0":"s806537759","submission_id_v1":"s879820758","cpu_time_v0":21,"cpu_time_v1":19,"memory_v0":2940,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.52,"input":"a,b = list(map(int, input().split()))\n\n\n\nans = -1\n\nfor i in range(10,12501):\n\n if int(i*0.08) == a and int(i * 0.1) == b:\n\n ans = i\n\n break\n\n \n\nprint(ans)","target":"a,b = list(map(int, input().split()))\n\n\n\nimport math\n\n\n\nif math.ceil((a+1)*12.5) <= math.ceil(b*10) or math.ceil(a*12.5) >= math.ceil((b+1)*10):\n\n print((-1))\n\nelse:\n\n print((max(math.ceil(a*12.5),math.ceil(b*10))))","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":172,"code_v1_num_chars":211,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nans = -1\nfor i in range(10, 12501):\n if int(i * 0.08) == a and int(i * 0.1) == b:\n ans = i\n break\nprint(ans)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nimport math\n\nif math.ceil((a + 1) * 12.5) <= math.ceil(b * 10) or math.ceil(a * 12.5) >= math.ceil(\n (b + 1) * 10\n):\n print((-1))\nelse:\n print((max(math.ceil(a * 12.5), math.ceil(b * 10))))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-ans = -1","-for i in range(10, 12501):","- if int(i * 0.08) == a and int(i * 0.1) == b:","- ans = i","- break","-print(ans)","+import math","+","+if math.ceil((a + 1) * 12.5) <= math.ceil(b * 10) or math.ceil(a * 12.5) >= math.ceil(","+ (b + 1) * 10","+):","+ print((-1))","+else:","+ print((max(math.ceil(a * 12.5), math.ceil(b * 10))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0519189532,"measured_runtime_v1":0.0921727731,"runtime_lift":0.5632786279,"key":["s806537759","s879820758"]} +{"user_id":"u690536347","problem_id":"p03732","language":"python","submission_id_v0":"s549552876","submission_id_v1":"s885481588","cpu_time_v0":935,"cpu_time_v1":224,"memory_v0":10096,"memory_v1":42732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":76.04,"input":"from collections import defaultdict as dd\n\nfrom itertools import accumulate as ac\n\nfrom itertools import product as pr\n\n\n\nN,W=list(map(int,input().split()))\n\nd=dd(list)\n\nfor _ in range(N):\n\n w,v=list(map(int,input().split()))\n\n d[w].extend([v])\n\nd=dict(d)\n\nfor i in list(d.keys()):\n\n d[i].sort(reverse=True)\n\n d[i]=[0]+list(ac(d[i]))\n\n\n\nl=[]\n\nkey=list(d.keys())\n\nfor val in pr(*list(map(enumerate,list(d.values())))):\n\n weight=sum(map(lambda x,y:x*y[0],key,val))\n\n value=sum([x[1] for x in val])\n\n if weight<=W:\n\n l.extend([value])\n\n\n\nprint((max(l)))","target":"from collections import defaultdict\n\nfrom itertools import accumulate,product\n\n\n\nN,W=list(map(int,input().split()))\n\nd={}\n\nfor i in range(N):\n\n w,v=list(map(int,input().split()))\n\n if not i:\n\n for j in range(w,w+4):\n\n d[j]=[]\n\n d[w].append(v)\n\n\n\nfor i in list(d.keys()):\n\n d[i].sort(reverse=True)\n\n *d[i],=accumulate([0]+d[i])\n\n\n\nans=0\n\ni,j,k,l=list(d.keys())\n\nfor ai,bi in enumerate(d[i]):\n\n for aj,bj in enumerate(d[j]):\n\n for ak,bk in enumerate(d[k]):\n\n for al,bl in enumerate(d[l]):\n\n if i*ai+j*aj+k*ak+l*al<=W:\n\n ans=max(ans,bi+bj+bk+bl)\n\n\n\nprint(ans)\n","code_v0_loc":23,"code_v1_loc":26,"code_v0_num_chars":531,"code_v1_num_chars":621,"code_v0_no_empty_lines":"from collections import defaultdict as dd\nfrom itertools import accumulate as ac\nfrom itertools import product as pr\n\nN, W = list(map(int, input().split()))\nd = dd(list)\nfor _ in range(N):\n w, v = list(map(int, input().split()))\n d[w].extend([v])\nd = dict(d)\nfor i in list(d.keys()):\n d[i].sort(reverse=True)\n d[i] = [0] + list(ac(d[i]))\nl = []\nkey = list(d.keys())\nfor val in pr(*list(map(enumerate, list(d.values())))):\n weight = sum(map(lambda x, y: x * y[0], key, val))\n value = sum([x[1] for x in val])\n if weight <= W:\n l.extend([value])\nprint((max(l)))\n","code_v1_no_empty_lines":"from collections import defaultdict\nfrom itertools import accumulate, product\n\nN, W = list(map(int, input().split()))\nd = {}\nfor i in range(N):\n w, v = list(map(int, input().split()))\n if not i:\n for j in range(w, w + 4):\n d[j] = []\n d[w].append(v)\nfor i in list(d.keys()):\n d[i].sort(reverse=True)\n (*d[i],) = accumulate([0] + d[i])\nans = 0\ni, j, k, l = list(d.keys())\nfor ai, bi in enumerate(d[i]):\n for aj, bj in enumerate(d[j]):\n for ak, bk in enumerate(d[k]):\n for al, bl in enumerate(d[l]):\n if i * ai + j * aj + k * ak + l * al <= W:\n ans = max(ans, bi + bj + bk + bl)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.5384615385,"diff":["-from collections import defaultdict as dd","-from itertools import accumulate as ac","-from itertools import product as pr","+from collections import defaultdict","+from itertools import accumulate, product","-d = dd(list)","-for _ in range(N):","+d = {}","+for i in range(N):","- d[w].extend([v])","-d = dict(d)","+ if not i:","+ for j in range(w, w + 4):","+ d[j] = []","+ d[w].append(v)","- d[i] = [0] + list(ac(d[i]))","-l = []","-key = list(d.keys())","-for val in pr(*list(map(enumerate, list(d.values())))):","- weight = sum(map(lambda x, y: x * y[0], key, val))","- value = sum([x[1] for x in val])","- if weight <= W:","- l.extend([value])","-print((max(l)))","+ (*d[i],) = accumulate([0] + d[i])","+ans = 0","+i, j, k, l = list(d.keys())","+for ai, bi in enumerate(d[i]):","+ for aj, bj in enumerate(d[j]):","+ for ak, bk in enumerate(d[k]):","+ for al, bl in enumerate(d[l]):","+ if i * ai + j * aj + k * ak + l * al <= W:","+ ans = max(ans, bi + bj + bk + bl)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0411226273,"measured_runtime_v1":0.0521438599,"runtime_lift":0.7886379596,"key":["s549552876","s885481588"]} +{"user_id":"u761320129","problem_id":"p03331","language":"python","submission_id_v0":"s392690369","submission_id_v1":"s458088889","cpu_time_v0":363,"cpu_time_v1":295,"memory_v0":3316,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.73,"input":"N = int(eval(input()))\n\nans = 9999999\n\nfor a in range(1,N):\n\n b = N-a\n\n tmp = 0\n\n for ac in str(a):\n\n tmp += int(ac)\n\n for bc in str(b):\n\n tmp += int(bc)\n\n ans = min(ans, tmp)\n\nprint(ans)\n","target":"N = int(eval(input()))\n\n\n\nans = 9999\n\nfor a in range(1,N):\n\n b = N-a\n\n x = sum(map(int,str(a)))\n\n y = sum(map(int,str(b)))\n\n ans = min(ans, x+y)\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":211,"code_v1_num_chars":162,"code_v0_no_empty_lines":"N = int(eval(input()))\nans = 9999999\nfor a in range(1, N):\n b = N - a\n tmp = 0\n for ac in str(a):\n tmp += int(ac)\n for bc in str(b):\n tmp += int(bc)\n ans = min(ans, tmp)\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nans = 9999\nfor a in range(1, N):\n b = N - a\n x = sum(map(int, str(a)))\n y = sum(map(int, str(b)))\n ans = min(ans, x + y)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-ans = 9999999","+ans = 9999","- tmp = 0","- for ac in str(a):","- tmp += int(ac)","- for bc in str(b):","- tmp += int(bc)","- ans = min(ans, tmp)","+ x = sum(map(int, str(a)))","+ y = sum(map(int, str(b)))","+ ans = min(ans, x + y)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1397704283,"measured_runtime_v1":0.1202064927,"runtime_lift":1.1627527361,"key":["s392690369","s458088889"]} +{"user_id":"u131984977","problem_id":"p02399","language":"python","submission_id_v0":"s335446404","submission_id_v1":"s210166779","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":6744,"memory_v1":7700,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"(a, b) = [int(x) for x in input().split()]\n\n\n\nx = a \/\/ b\n\ny = a % b\n\nz = a \/ b\n\n\n\nprint(('{0} {1} {2:.6f}'.format(x,y,z)))","target":"a, b = [int(i) for i in input().split()]\n\n\n\nd = a \/\/ b\n\nr = a % b\n\nf = a \/ b\n\n\n\nprint((\"{0} {1} {2:.5f}\".format(d, r, f)))","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":120,"code_v1_num_chars":120,"code_v0_no_empty_lines":"(a, b) = [int(x) for x in input().split()]\nx = a \/\/ b\ny = a % b\nz = a \/ b\nprint((\"{0} {1} {2:.6f}\".format(x, y, z)))\n","code_v1_no_empty_lines":"a, b = [int(i) for i in input().split()]\nd = a \/\/ b\nr = a % b\nf = a \/ b\nprint((\"{0} {1} {2:.5f}\".format(d, r, f)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-(a, b) = [int(x) for x in input().split()]","-x = a \/\/ b","-y = a % b","-z = a \/ b","-print((\"{0} {1} {2:.6f}\".format(x, y, z)))","+a, b = [int(i) for i in input().split()]","+d = a \/\/ b","+r = a % b","+f = a \/ b","+print((\"{0} {1} {2:.5f}\".format(d, r, f)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1114623406,"measured_runtime_v1":0.0406035893,"runtime_lift":2.7451351592,"key":["s335446404","s210166779"]} +{"user_id":"u525589885","problem_id":"p02676","language":"python","submission_id_v0":"s552817680","submission_id_v1":"s301566435","cpu_time_v0":23,"cpu_time_v1":21,"memory_v0":9164,"memory_v1":9164,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.7,"input":"k = int(eval(input()))\n\ns = eval(input())\n\nif len(s) <= k:\n\n print(s)\n\nelse:\n\n print((s[:k] + '...'))","target":"k = int(eval(input()))\n\ns = eval(input())\n\nl = len(s)\n\nif l<=k:\n\n print (s)\n\nelse : \n\n print((s[:k] + '...'))","code_v0_loc":6,"code_v1_loc":7,"code_v0_num_chars":89,"code_v1_num_chars":98,"code_v0_no_empty_lines":"k = int(eval(input()))\ns = eval(input())\nif len(s) <= k:\n print(s)\nelse:\n print((s[:k] + \"...\"))\n","code_v1_no_empty_lines":"k = int(eval(input()))\ns = eval(input())\nl = len(s)\nif l <= k:\n print(s)\nelse:\n print((s[:k] + \"...\"))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-if len(s) <= k:","+l = len(s)","+if l <= k:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0471821014,"measured_runtime_v1":0.040891765,"runtime_lift":1.1538289275,"key":["s552817680","s301566435"]} +{"user_id":"u852690916","problem_id":"p03733","language":"python","submission_id_v0":"s147194994","submission_id_v1":"s176806045","cpu_time_v0":259,"cpu_time_v1":144,"memory_v0":85456,"memory_v1":30808,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.4,"input":"N, T = list(map(int, input().split()))\n\nt = list(map(int, input().split()))\n\nlastOn = t[0]\n\nans = 0\n\nfor i in range(1,N):\n\n ti = t[i]\n\n ans += min(T, ti-lastOn)\n\n lastOn = ti\n\nans += T\n\nprint(ans)\n","target":"N, T = list(map(int, input().split()))\n\n*t, = list(map(int, input().split()))\n\nans = 0\n\nlast = -10**10\n\nfor a in t:\n\n ans += T - max(last + T - a, 0)\n\n last = a\n\nprint(ans)\n","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":200,"code_v1_num_chars":167,"code_v0_no_empty_lines":"N, T = list(map(int, input().split()))\nt = list(map(int, input().split()))\nlastOn = t[0]\nans = 0\nfor i in range(1, N):\n ti = t[i]\n ans += min(T, ti - lastOn)\n lastOn = ti\nans += T\nprint(ans)\n","code_v1_no_empty_lines":"N, T = list(map(int, input().split()))\n(*t,) = list(map(int, input().split()))\nans = 0\nlast = -(10**10)\nfor a in t:\n ans += T - max(last + T - a, 0)\n last = a\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-t = list(map(int, input().split()))","-lastOn = t[0]","+(*t,) = list(map(int, input().split()))","-for i in range(1, N):","- ti = t[i]","- ans += min(T, ti - lastOn)","- lastOn = ti","-ans += T","+last = -(10**10)","+for a in t:","+ ans += T - max(last + T - a, 0)","+ last = a"],"diff_only_import_comment":false,"measured_runtime_v0":0.0449007884,"measured_runtime_v1":0.0375527933,"runtime_lift":1.1956710666,"key":["s147194994","s176806045"]} +{"user_id":"u472696272","problem_id":"p03086","language":"python","submission_id_v0":"s866442753","submission_id_v1":"s305853509","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"s = list(eval(input()))\n\nkey = ['A','T','G','C']\n\ncount = 0\n\nflag = False\n\nans = 0\n\nfor i in range(len(s)):\n\n if s[i] in key:\n\n count += 1\n\n flag = True\n\n if flag==True and (s[i] not in key):\n\n ans = max(ans,count)\n\n count = 0\n\n flag = False\n\nans = max(ans,count)\n\nprint(ans)","target":"s = list(eval(input()))\n\nkey = ['A','T','G','C']\n\n\n\ncount = 0\n\nans = 0\n\nfor i in range(len(s)):\n\n if s[i] in key: count += 1\n\n else: count = 0\n\n ans = max(ans,count)\n\nprint(ans)\n","code_v0_loc":15,"code_v1_loc":10,"code_v0_num_chars":286,"code_v1_num_chars":175,"code_v0_no_empty_lines":"s = list(eval(input()))\nkey = [\"A\", \"T\", \"G\", \"C\"]\ncount = 0\nflag = False\nans = 0\nfor i in range(len(s)):\n if s[i] in key:\n count += 1\n flag = True\n if flag == True and (s[i] not in key):\n ans = max(ans, count)\n count = 0\n flag = False\nans = max(ans, count)\nprint(ans)\n","code_v1_no_empty_lines":"s = list(eval(input()))\nkey = [\"A\", \"T\", \"G\", \"C\"]\ncount = 0\nans = 0\nfor i in range(len(s)):\n if s[i] in key:\n count += 1\n else:\n count = 0\n ans = max(ans, count)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-flag = False","- flag = True","- if flag == True and (s[i] not in key):","- ans = max(ans, count)","+ else:","- flag = False","-ans = max(ans, count)","+ ans = max(ans, count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0362350228,"measured_runtime_v1":0.0378019025,"runtime_lift":0.9585502408,"key":["s866442753","s305853509"]} +{"user_id":"u156815136","problem_id":"p02873","language":"python","submission_id_v0":"s491245726","submission_id_v1":"s925086917","cpu_time_v0":398,"cpu_time_v1":301,"memory_v0":23724,"memory_v1":30332,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.37,"input":"#from statistics import median\n\nimport collections\n\n#aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\n\n#from fractions import gcd\n\n#from itertools import combinations # (string,3) 3\u56de\n\n#from collections import deque\n\n#from collections import deque,defaultdict\n\n#import bisect\n\n#\n\n# d = m - k[i] - k[j]\n\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n\n#\n\n#\n\n#\n\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n\n#\n\n#\n\n\n\nimport sys\n\nsys.setrecursionlimit(10000000)\n\nmod = 10**9 + 7\n\n#mod = 9982443453\n\ndef readInts():\n\n return list(map(int,input().split()))\n\ndef I():\n\n return int(eval(input()))\n\n\n\nS = eval(input())\n\nln = len(S)\n\nans = [0] * (ln+1)\n\n# \u524d\u304b\u3089\n\nfor i in range(ln):\n\n if S[i] == '<':\n\n ans[i+1] = max(ans[i+1],ans[i]+1)\n\n#print(ans)\n\n# \u5f8c\u308d\u304b\u3089\n\nfor i in range(ln-1,-1,-1):\n\n if S[i] == '>':\n\n ans[i] = max(ans[i],ans[i+1]+1)\n\n#print(ans)\n\nprint((sum(ans)))\n","target":"#from statistics import median\n\n#import collections\n\n#aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\n\nfrom math import gcd\n\nfrom itertools import combinations,permutations,accumulate, product # (string,3) 3\u56de\n\n#from collections import deque\n\nfrom collections import deque,defaultdict,Counter\n\nimport decimal\n\nimport re\n\nimport math\n\nimport bisect\n\nimport heapq\n\n#\n\n#\n\n#\n\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n\n#\n\n#\n\n# my_round_int = lambda x:np.round((x*2 + 1)\/\/2)\n\n# \u56db\u6368\u4e94\u5165g\n\n#\n\n# \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u7cfb\n\n# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);\n\n# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);\n\n#\n\n#\n\nimport sys\n\nsys.setrecursionlimit(10000000)\n\nmod = 10**9 + 7\n\n#mod = 9982443453\n\n#mod = 998244353\n\nINF = float('inf')\n\nfrom sys import stdin\n\nreadline = stdin.readline\n\ndef readInts():\n\n return list(map(int,readline().split()))\n\ndef readTuples():\n\n return tuple(map(int,readline().split()))\n\ndef I():\n\n return int(readline())\n\nS = eval(input())\n\nn = len(S)\n\nlis = [0] * (len(S)+1)\n\nfor i in range(n):\n\n if S[i] == '<':\n\n lis[i+1] = max(lis[i+1],lis[i] + 1)\n\nfor i in range(n-1,-1,-1):\n\n if S[i] == '>':\n\n lis[i] = max(lis[i], lis[i+1]+1)\n\nprint((sum(lis)))\n","code_v0_loc":41,"code_v1_loc":50,"code_v0_num_chars":891,"code_v1_num_chars":1214,"code_v0_no_empty_lines":"# from statistics import median\nimport collections\n\n# aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\n# from fractions import gcd\n# from itertools import combinations # (string,3) 3\u56de\n# from collections import deque\n# from collections import deque,defaultdict\n# import bisect\n#\n# d = m - k[i] - k[j]\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n#\n#\n#\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n#\n#\nimport sys\n\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n# mod = 9982443453\ndef readInts():\n return list(map(int, input().split()))\n\n\ndef I():\n return int(eval(input()))\n\n\nS = eval(input())\nln = len(S)\nans = [0] * (ln + 1)\n# \u524d\u304b\u3089\nfor i in range(ln):\n if S[i] == \"<\":\n ans[i + 1] = max(ans[i + 1], ans[i] + 1)\n# print(ans)\n# \u5f8c\u308d\u304b\u3089\nfor i in range(ln - 1, -1, -1):\n if S[i] == \">\":\n ans[i] = max(ans[i], ans[i + 1] + 1)\n# print(ans)\nprint((sum(ans)))\n","code_v1_no_empty_lines":"# from statistics import median\n# import collections\n# aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\nfrom math import gcd\nfrom itertools import combinations, permutations, accumulate, product # (string,3) 3\u56de\n\n# from collections import deque\nfrom collections import deque, defaultdict, Counter\nimport decimal\nimport re\nimport math\nimport bisect\nimport heapq\n\n#\n#\n#\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n#\n#\n# my_round_int = lambda x:np.round((x*2 + 1)\/\/2)\n# \u56db\u6368\u4e94\u5165g\n#\n# \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u7cfb\n# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);\n# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);\n#\n#\nimport sys\n\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n# mod = 9982443453\n# mod = 998244353\nINF = float(\"inf\")\nfrom sys import stdin\n\nreadline = stdin.readline\n\n\ndef readInts():\n return list(map(int, readline().split()))\n\n\ndef readTuples():\n return tuple(map(int, readline().split()))\n\n\ndef I():\n return int(readline())\n\n\nS = eval(input())\nn = len(S)\nlis = [0] * (len(S) + 1)\nfor i in range(n):\n if S[i] == \"<\":\n lis[i + 1] = max(lis[i + 1], lis[i] + 1)\nfor i in range(n - 1, -1, -1):\n if S[i] == \">\":\n lis[i] = max(lis[i], lis[i + 1] + 1)\nprint((sum(lis)))\n","code_same":false,"relative_loc_diff_percent":18.0,"diff":["-import collections","+# import collections","+# aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]","+from math import gcd","+from itertools import combinations, permutations, accumulate, product # (string,3) 3\u56de","-# aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]","-# from fractions import gcd","-# from itertools import combinations # (string,3) 3\u56de","-# from collections import deque,defaultdict","-# import bisect","-#","-# d = m - k[i] - k[j]","-# if kk[bisect.bisect_right(kk,d) - 1] == d:","+from collections import deque, defaultdict, Counter","+import decimal","+import re","+import math","+import bisect","+import heapq","+","+#","+#","+# my_round_int = lambda x:np.round((x*2 + 1)\/\/2)","+# \u56db\u6368\u4e94\u5165g","+#","+# \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u7cfb","+# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);","+# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);","+# mod = 998244353","+INF = float(\"inf\")","+from sys import stdin","+","+readline = stdin.readline","+","+","- return list(map(int, input().split()))","+ return list(map(int, readline().split()))","+","+","+def readTuples():","+ return tuple(map(int, readline().split()))","- return int(eval(input()))","+ return int(readline())","-ln = len(S)","-ans = [0] * (ln + 1)","-# \u524d\u304b\u3089","-for i in range(ln):","+n = len(S)","+lis = [0] * (len(S) + 1)","+for i in range(n):","- ans[i + 1] = max(ans[i + 1], ans[i] + 1)","-# print(ans)","-# \u5f8c\u308d\u304b\u3089","-for i in range(ln - 1, -1, -1):","+ lis[i + 1] = max(lis[i + 1], lis[i] + 1)","+for i in range(n - 1, -1, -1):","- ans[i] = max(ans[i], ans[i + 1] + 1)","-# print(ans)","-print((sum(ans)))","+ lis[i] = max(lis[i], lis[i + 1] + 1)","+print((sum(lis)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0407960303,"measured_runtime_v1":0.0715756168,"runtime_lift":0.5699710611,"key":["s491245726","s925086917"]} +{"user_id":"u548303713","problem_id":"p02659","language":"python","submission_id_v0":"s766484033","submission_id_v1":"s950138053","cpu_time_v0":65,"cpu_time_v1":59,"memory_v0":62044,"memory_v1":62024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.23,"input":"import math\n\na,b=input().split()\n\na=int(a)\n\nc=int(b[0]+b[2]+b[3])\n\nprint((int(a*c)\/\/100))\n\n#print(a*b)","target":"import math\n\na,b=input().split()\n\na=int(a)\n\nc=int(b[0]+b[2]+b[3])\n\nprint((a*c\/\/100))\n\n#print(a*b)","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":100,"code_v1_num_chars":95,"code_v0_no_empty_lines":"import math\n\na, b = input().split()\na = int(a)\nc = int(b[0] + b[2] + b[3])\nprint((int(a * c) \/\/ 100))\n# print(a*b)\n","code_v1_no_empty_lines":"import math\n\na, b = input().split()\na = int(a)\nc = int(b[0] + b[2] + b[3])\nprint((a * c \/\/ 100))\n# print(a*b)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((int(a * c) \/\/ 100))","+print((a * c \/\/ 100))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0449002905,"measured_runtime_v1":0.0441139119,"runtime_lift":1.0178260911,"key":["s766484033","s950138053"]} +{"user_id":"u411203878","problem_id":"p04020","language":"python","submission_id_v0":"s611686752","submission_id_v1":"s435900112","cpu_time_v0":534,"cpu_time_v1":178,"memory_v0":51672,"memory_v1":80696,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.67,"input":"n=int(eval(input()))\n\nab = []\n\nfor _ in range(n):\n\n a=int(eval(input()))\n\n ab.append(a)\n\n\n\nans = 0\n\n\n\nfor i in range(n):\n\n ans += ab[i]\/\/2\n\n if i == n-1:\n\n break\n\n elif ab[i]%2 == 1 and ab[i+1] > 0:\n\n ans += 1\n\n ab[i+1] -= 1\n\nprint(ans)","target":"N = int(eval(input()))\n\nA = [int(eval(input())) for _ in range(N)]\n\n\n\nans = 0\n\nfor key,val in enumerate(A):\n\n ans += int(val\/2)\n\n\n\n if key < N-1 and int(val\/2)*2 != val and A[key+1] != 0:\n\n A[key+1] -= 1\n\n ans += 1\n\nprint(ans)","code_v0_loc":16,"code_v1_loc":11,"code_v0_num_chars":260,"code_v1_num_chars":234,"code_v0_no_empty_lines":"n = int(eval(input()))\nab = []\nfor _ in range(n):\n a = int(eval(input()))\n ab.append(a)\nans = 0\nfor i in range(n):\n ans += ab[i] \/\/ 2\n if i == n - 1:\n break\n elif ab[i] % 2 == 1 and ab[i + 1] > 0:\n ans += 1\n ab[i + 1] -= 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(eval(input())) for _ in range(N)]\nans = 0\nfor key, val in enumerate(A):\n ans += int(val \/ 2)\n if key < N - 1 and int(val \/ 2) * 2 != val and A[key + 1] != 0:\n A[key + 1] -= 1\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":31.25,"diff":["-n = int(eval(input()))","-ab = []","-for _ in range(n):","- a = int(eval(input()))","- ab.append(a)","+N = int(eval(input()))","+A = [int(eval(input())) for _ in range(N)]","-for i in range(n):","- ans += ab[i] \/\/ 2","- if i == n - 1:","- break","- elif ab[i] % 2 == 1 and ab[i + 1] > 0:","+for key, val in enumerate(A):","+ ans += int(val \/ 2)","+ if key < N - 1 and int(val \/ 2) * 2 != val and A[key + 1] != 0:","+ A[key + 1] -= 1","- ab[i + 1] -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372780119,"measured_runtime_v1":0.0454277668,"runtime_lift":0.8205997014,"key":["s611686752","s435900112"]} +{"user_id":"u314050667","problem_id":"p03557","language":"python","submission_id_v0":"s590258180","submission_id_v1":"s131257975","cpu_time_v0":1054,"cpu_time_v1":847,"memory_v0":56024,"memory_v1":24832,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.64,"input":"import numpy as np\n\nimport sys\n\n\n\nN = int(eval(input()))\n\nI = np.array(sys.stdin.read().split(), np.int64)\n\nA = I[:N]\n\nB = I[N:2*N]\n\nC = I[2*N:]\n\n\n\nA.sort()\n\nC.sort()\n\n\n\nans = 0\n\nfor i in range(N):\n\n\tb = B[i]\n\n\tA_cnt = np.searchsorted(A, b, side='left')\n\n\tC_cnt = np.searchsorted(C, b, side='right')\n\n\tans += A_cnt * (N-C_cnt)\n\n\n\nprint(ans)","target":"import numpy as np\n\nimport sys\n\n\n\nN = int(eval(input()))\n\n#I = np.array(sys.stdin.read().split(), np.int64)\n\n#A = I[:N]\n\n#B = I[N:2*N]\n\n#C = I[2*N:]\n\n\n\nA = np.array(list(map(int,input().split())))\n\nB = np.array(list(map(int,input().split())))\n\nC = np.array(list(map(int,input().split())))\n\n\n\nA.sort()\n\nC.sort()\n\n\n\nans = 0\n\nfor i in range(N):\n\n\tb = B[i]\n\n\tA_cnt = np.searchsorted(A, b, side='left')\n\n\tC_cnt = np.searchsorted(C, b, side='right')\n\n\tans += A_cnt * (N-C_cnt)\n\n\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":24,"code_v0_num_chars":334,"code_v1_num_chars":478,"code_v0_no_empty_lines":"import numpy as np\nimport sys\n\nN = int(eval(input()))\nI = np.array(sys.stdin.read().split(), np.int64)\nA = I[:N]\nB = I[N : 2 * N]\nC = I[2 * N :]\nA.sort()\nC.sort()\nans = 0\nfor i in range(N):\n b = B[i]\n A_cnt = np.searchsorted(A, b, side=\"left\")\n C_cnt = np.searchsorted(C, b, side=\"right\")\n ans += A_cnt * (N - C_cnt)\nprint(ans)\n","code_v1_no_empty_lines":"import numpy as np\nimport sys\n\nN = int(eval(input()))\n# I = np.array(sys.stdin.read().split(), np.int64)\n# A = I[:N]\n# B = I[N:2*N]\n# C = I[2*N:]\nA = np.array(list(map(int, input().split())))\nB = np.array(list(map(int, input().split())))\nC = np.array(list(map(int, input().split())))\nA.sort()\nC.sort()\nans = 0\nfor i in range(N):\n b = B[i]\n A_cnt = np.searchsorted(A, b, side=\"left\")\n C_cnt = np.searchsorted(C, b, side=\"right\")\n ans += A_cnt * (N - C_cnt)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-I = np.array(sys.stdin.read().split(), np.int64)","-A = I[:N]","-B = I[N : 2 * N]","-C = I[2 * N :]","+# I = np.array(sys.stdin.read().split(), np.int64)","+# A = I[:N]","+# B = I[N:2*N]","+# C = I[2*N:]","+A = np.array(list(map(int, input().split())))","+B = np.array(list(map(int, input().split())))","+C = np.array(list(map(int, input().split())))"],"diff_only_import_comment":false,"measured_runtime_v0":0.8533554554,"measured_runtime_v1":0.7116684437,"runtime_lift":1.1990913226,"key":["s590258180","s131257975"]} +{"user_id":"u893063840","problem_id":"p04013","language":"python","submission_id_v0":"s290327636","submission_id_v1":"s598607417","cpu_time_v0":1245,"cpu_time_v1":89,"memory_v0":54080,"memory_v1":5620,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.85,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef main():\n\n n, a = list(map(int, input().split()))\n\n x = tuple(map(int, input().split()))\n\n\n\n sm_mx = sum(x)\n\n\n\n dp = [[[0] * (sm_mx + 1) for _ in range(n + 1)] for _ in range(n + 1)]\n\n\n\n dp[0][0][0] = 1\n\n\n\n for i, e in enumerate(x, 1):\n\n for j in range(n + 1):\n\n for sm in range(sum(x[:i]) + 1):\n\n if sm < e:\n\n dp[i][j][sm] = dp[i-1][j][sm]\n\n elif j >= 1 and sm >= e:\n\n dp[i][j][sm] = dp[i-1][j][sm] + dp[i-1][j-1][sm-e]\n\n\n\n ans = 0\n\n for i in range(1, n + 1):\n\n if i > sm_mx \/ a:\n\n break\n\n ans += dp[n][i][i*a]\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"def main():\n\n n, a = list(map(int, input().split()))\n\n x = list(map(int, input().split()))\n\n\n\n mx = max(x + [a])\n\n\n\n for i in range(n):\n\n x[i] -= a\n\n\n\n sm = 2 * n * mx\n\n\n\n dp = [[0] * (sm + 1) for _ in range(n + 1)]\n\n\n\n dp[0][n*mx] = 1\n\n\n\n for i, e in enumerate(x, 1):\n\n for j in range(sm + 1):\n\n if 0 <= j - e <= sm:\n\n dp[i][j] = dp[i-1][j] + dp[i-1][j-e]\n\n else:\n\n dp[i][j] = dp[i-1][j]\n\n\n\n ans = dp[n][n*mx] - 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":33,"code_v1_loc":29,"code_v0_num_chars":750,"code_v1_num_chars":564,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, a = list(map(int, input().split()))\n x = tuple(map(int, input().split()))\n sm_mx = sum(x)\n dp = [[[0] * (sm_mx + 1) for _ in range(n + 1)] for _ in range(n + 1)]\n dp[0][0][0] = 1\n for i, e in enumerate(x, 1):\n for j in range(n + 1):\n for sm in range(sum(x[:i]) + 1):\n if sm < e:\n dp[i][j][sm] = dp[i - 1][j][sm]\n elif j >= 1 and sm >= e:\n dp[i][j][sm] = dp[i - 1][j][sm] + dp[i - 1][j - 1][sm - e]\n ans = 0\n for i in range(1, n + 1):\n if i > sm_mx \/ a:\n break\n ans += dp[n][i][i * a]\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n, a = list(map(int, input().split()))\n x = list(map(int, input().split()))\n mx = max(x + [a])\n for i in range(n):\n x[i] -= a\n sm = 2 * n * mx\n dp = [[0] * (sm + 1) for _ in range(n + 1)]\n dp[0][n * mx] = 1\n for i, e in enumerate(x, 1):\n for j in range(sm + 1):\n if 0 <= j - e <= sm:\n dp[i][j] = dp[i - 1][j] + dp[i - 1][j - e]\n else:\n dp[i][j] = dp[i - 1][j]\n ans = dp[n][n * mx] - 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":12.1212121212,"diff":["-import sys","-","-input = sys.stdin.readline","-","-","- x = tuple(map(int, input().split()))","- sm_mx = sum(x)","- dp = [[[0] * (sm_mx + 1) for _ in range(n + 1)] for _ in range(n + 1)]","- dp[0][0][0] = 1","+ x = list(map(int, input().split()))","+ mx = max(x + [a])","+ for i in range(n):","+ x[i] -= a","+ sm = 2 * n * mx","+ dp = [[0] * (sm + 1) for _ in range(n + 1)]","+ dp[0][n * mx] = 1","- for j in range(n + 1):","- for sm in range(sum(x[:i]) + 1):","- if sm < e:","- dp[i][j][sm] = dp[i - 1][j][sm]","- elif j >= 1 and sm >= e:","- dp[i][j][sm] = dp[i - 1][j][sm] + dp[i - 1][j - 1][sm - e]","- ans = 0","- for i in range(1, n + 1):","- if i > sm_mx \/ a:","- break","- ans += dp[n][i][i * a]","+ for j in range(sm + 1):","+ if 0 <= j - e <= sm:","+ dp[i][j] = dp[i - 1][j] + dp[i - 1][j - e]","+ else:","+ dp[i][j] = dp[i - 1][j]","+ ans = dp[n][n * mx] - 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0615608692,"measured_runtime_v1":0.0427172661,"runtime_lift":1.4411238089,"key":["s290327636","s598607417"]} +{"user_id":"u715435591","problem_id":"p02612","language":"python","submission_id_v0":"s982558436","submission_id_v1":"s685236285","cpu_time_v0":35,"cpu_time_v1":28,"memory_v0":9076,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"N = int(eval(input()))\n\n\n\nr = N % 1000\n\n\n\nif r == 0:\n\n print((0))\n\nelse:\n\n q = (N \/\/ 1000) + 1\n\n print((q*1000 - N))","target":"N = int(eval(input()))\n\n\n\nr = N % 1000\n\n\n\nif not r:\n\n print((0))\n\nelse:\n\n q = N \/\/ 1000\n\n print(((q+1) * 1000 - N))","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":109,"code_v1_num_chars":108,"code_v0_no_empty_lines":"N = int(eval(input()))\nr = N % 1000\nif r == 0:\n print((0))\nelse:\n q = (N \/\/ 1000) + 1\n print((q * 1000 - N))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nr = N % 1000\nif not r:\n print((0))\nelse:\n q = N \/\/ 1000\n print(((q + 1) * 1000 - N))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-if r == 0:","+if not r:","- q = (N \/\/ 1000) + 1","- print((q * 1000 - N))","+ q = N \/\/ 1000","+ print(((q + 1) * 1000 - N))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0447892481,"measured_runtime_v1":0.044837348,"runtime_lift":0.9989272353,"key":["s982558436","s685236285"]} +{"user_id":"u968166680","problem_id":"p03283","language":"python","submission_id_v0":"s960967315","submission_id_v1":"s275590206","cpu_time_v0":1395,"cpu_time_v1":377,"memory_v0":69720,"memory_v1":54236,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.97,"input":"import sys\n\nfrom itertools import accumulate\n\n\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\nN, M, Q = map(int, input().split())\n\nG = [[0] * N for _ in range(N)]\n\nfor _ in range(M):\n\n l, r = map(int, input().split())\n\n G[l - 1][r - 1] += 1\n\n\n\ncsum = [[0] * (N + 1) for _ in range(N + 1)]\n\nfor i in range(N):\n\n for j in range(N):\n\n csum[i + 1][j + 1] = csum[i + 1][j] + csum[i][j + 1] - csum[i][j] + G[i][j]\n\n\n\nans = []\n\nfor _ in range(Q):\n\n p, q = map(int, input().split())\n\n ans.append(csum[q][q] - csum[q][p - 1] - csum[p - 1][q] + csum[p - 1][p - 1])\n\n\n\nprint(*ans, sep='\\n')\n","target":"import sys\n\nfrom itertools import accumulate\n\n\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\nN, M, Q = map(int, readline().split())\n\nG = [[0] * N for _ in range(N)]\n\nfor _ in range(M):\n\n l, r = map(int, readline().split())\n\n G[l - 1][r - 1] += 1\n\n\n\ncsum = [[0] * (N + 1) for _ in range(N + 1)]\n\nfor i in range(N):\n\n for j in range(N):\n\n csum[i + 1][j + 1] = csum[i + 1][j] + csum[i][j + 1] - csum[i][j] + G[i][j]\n\n\n\nans = []\n\nfor _ in range(Q):\n\n p, q = map(int, readline().split())\n\n ans.append(csum[q][q] - csum[q][p - 1] - csum[p - 1][q] + csum[p - 1][p - 1])\n\n\n\nprint(*ans, sep='\\n')\n","code_v0_loc":23,"code_v1_loc":26,"code_v0_num_chars":605,"code_v1_num_chars":722,"code_v0_no_empty_lines":"import sys\nfrom itertools import accumulate\n\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nN, M, Q = map(int, input().split())\nG = [[0] * N for _ in range(N)]\nfor _ in range(M):\n l, r = map(int, input().split())\n G[l - 1][r - 1] += 1\ncsum = [[0] * (N + 1) for _ in range(N + 1)]\nfor i in range(N):\n for j in range(N):\n csum[i + 1][j + 1] = csum[i + 1][j] + csum[i][j + 1] - csum[i][j] + G[i][j]\nans = []\nfor _ in range(Q):\n p, q = map(int, input().split())\n ans.append(csum[q][q] - csum[q][p - 1] - csum[p - 1][q] + csum[p - 1][p - 1])\nprint(*ans, sep=\"\\n\")\n","code_v1_no_empty_lines":"import sys\nfrom itertools import accumulate\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\nN, M, Q = map(int, readline().split())\nG = [[0] * N for _ in range(N)]\nfor _ in range(M):\n l, r = map(int, readline().split())\n G[l - 1][r - 1] += 1\ncsum = [[0] * (N + 1) for _ in range(N + 1)]\nfor i in range(N):\n for j in range(N):\n csum[i + 1][j + 1] = csum[i + 1][j] + csum[i][j + 1] - csum[i][j] + G[i][j]\nans = []\nfor _ in range(Q):\n p, q = map(int, readline().split())\n ans.append(csum[q][q] - csum[q][p - 1] - csum[p - 1][q] + csum[p - 1][p - 1])\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":11.5384615385,"diff":["+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","-N, M, Q = map(int, input().split())","+N, M, Q = map(int, readline().split())","- l, r = map(int, input().split())","+ l, r = map(int, readline().split())","- p, q = map(int, input().split())","+ p, q = map(int, readline().split())"],"diff_only_import_comment":false,"measured_runtime_v0":0.0586372409,"measured_runtime_v1":0.0364900191,"runtime_lift":1.606939167,"key":["s960967315","s275590206"]} +{"user_id":"u391875425","problem_id":"p03424","language":"python","submission_id_v0":"s614214614","submission_id_v1":"s619408658","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"n=int(eval(input()))\n\na=list(map(str,input().split()))\n\nf=True\n\nfor i in range(n):\n\n if a[i] == \"Y\":\n\n f=False\n\n print(\"Four\")\n\n break\n\nif f :\n\n print(\"Three\")\n\n ","target":"import sys\n\nn = int(eval(input()))\n\ns = sys.stdin.readline().rstrip().split()\n\nprint(('Three' if len(set(s)) == 3 else 'Four'))","code_v0_loc":11,"code_v1_loc":4,"code_v0_num_chars":170,"code_v1_num_chars":119,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(str, input().split()))\nf = True\nfor i in range(n):\n if a[i] == \"Y\":\n f = False\n print(\"Four\")\n break\nif f:\n print(\"Three\")\n","code_v1_no_empty_lines":"import sys\n\nn = int(eval(input()))\ns = sys.stdin.readline().rstrip().split()\nprint((\"Three\" if len(set(s)) == 3 else \"Four\"))\n","code_same":false,"relative_loc_diff_percent":63.6363636364,"diff":["+import sys","+","-a = list(map(str, input().split()))","-f = True","-for i in range(n):","- if a[i] == \"Y\":","- f = False","- print(\"Four\")","- break","-if f:","- print(\"Three\")","+s = sys.stdin.readline().rstrip().split()","+print((\"Three\" if len(set(s)) == 3 else \"Four\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0357671888,"measured_runtime_v1":0.0368215592,"runtime_lift":0.9713654056,"key":["s614214614","s619408658"]} +{"user_id":"u044220565","problem_id":"p02781","language":"python","submission_id_v0":"s081116107","submission_id_v1":"s615536539","cpu_time_v0":569,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":96.84,"input":"# coding: utf-8\n\nimport sys\n\n#from operator import itemgetter\n\nsysread = sys.stdin.readline\n\nread = sys.stdin.read\n\n#from heapq import heappop, heappush\n\n#from collections import defaultdict\n\nsys.setrecursionlimit(10**7)\n\nimport math\n\nfrom itertools import combinations, product\n\n#import bisect# lower_bound etc\n\n#import numpy as np\n\ndef run():\n\n N,K = list(map(int, read().split()))\n\n k = int(math.log(N, 10))\n\n s = N \/\/ (10 ** k)\n\n\n\n tmp1, tmp2, div = 1, 1, 1\n\n for i in range(K-1):\n\n tmp1 *= k-i\n\n div *= i+1\n\n tmp2 *= 9\n\n ret = tmp1\/\/div * tmp2\n\n ret *= s-1\n\n\n\n tmp1 *= k - (K-1)\n\n tmp2 *= 9\n\n div *= K\n\n\n\n ret += tmp1 * tmp2 \/\/ div\n\n lis = list(range(k))\n\n nums = list(range(1,10))\n\n base = s * 10 ** k\n\n\n\n for A in combinations(lis, K-1):\n\n for X in product(nums, repeat = K-1):\n\n tmp = base\n\n for a,x in zip(A,X):\n\n tmp += 10 ** a * x\n\n if tmp <= N:\n\n ret += 1\n\n print(ret)\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n run()","target":"# coding: utf-8\n\nimport sys\n\n#from operator import itemgetter\n\nsysread = sys.stdin.readline\n\nread = sys.stdin.read\n\n#from heapq import heappop, heappush\n\n#from collections import defaultdict\n\nsys.setrecursionlimit(10**7)\n\nimport math\n\nfrom itertools import combinations, product\n\n#import bisect# lower_bound etc\n\n#import numpy as np\n\ndef run():\n\n N,K = read().split()\n\n\n\n N = list(map(int,N))\n\n K = int(K)\n\n max_i = len(N)\n\n dp2 = [0] * max_i\n\n r = 0\n\n for i, v in enumerate(N):\n\n if v != 0:\n\n r += 1\n\n dp2[i] = r\n\n\n\n dp1 = [[0] * (K+1) for _ in range(max_i)]\n\n\n\n dp1[0][1] = int(N[0]-1)\n\n dp1[0][0] = 1\n\n for i in range(1, max_i):\n\n for j in range(0, K+1):\n\n if j == 0:\n\n dp1[i][j] += dp1[i - 1][j]\n\n else:\n\n dp1[i][j] += dp1[i - 1][j] + dp1[i - 1][j - 1] * 9\n\n if N[i] == 0:continue\n\n if dp2[i-1] <= K:\n\n dp1[i][dp2[i-1]] += 1\n\n if dp2[i-1] < K:\n\n dp1[i][dp2[i-1]+1] += N[i] - 1\n\n plus = 0\n\n if dp2[-1] == K:\n\n plus = 1\n\n print((dp1[max_i-1][K] + plus))\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n run()","code_v0_loc":47,"code_v1_loc":50,"code_v0_num_chars":1046,"code_v1_num_chars":1176,"code_v0_no_empty_lines":"# coding: utf-8\nimport sys\n\n# from operator import itemgetter\nsysread = sys.stdin.readline\nread = sys.stdin.read\n# from heapq import heappop, heappush\n# from collections import defaultdict\nsys.setrecursionlimit(10**7)\nimport math\nfrom itertools import combinations, product\n\n# import bisect# lower_bound etc\n# import numpy as np\ndef run():\n N, K = list(map(int, read().split()))\n k = int(math.log(N, 10))\n s = N \/\/ (10**k)\n tmp1, tmp2, div = 1, 1, 1\n for i in range(K - 1):\n tmp1 *= k - i\n div *= i + 1\n tmp2 *= 9\n ret = tmp1 \/\/ div * tmp2\n ret *= s - 1\n tmp1 *= k - (K - 1)\n tmp2 *= 9\n div *= K\n ret += tmp1 * tmp2 \/\/ div\n lis = list(range(k))\n nums = list(range(1, 10))\n base = s * 10**k\n for A in combinations(lis, K - 1):\n for X in product(nums, repeat=K - 1):\n tmp = base\n for a, x in zip(A, X):\n tmp += 10**a * x\n if tmp <= N:\n ret += 1\n print(ret)\n\n\nif __name__ == \"__main__\":\n run()\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\n\n# from operator import itemgetter\nsysread = sys.stdin.readline\nread = sys.stdin.read\n# from heapq import heappop, heappush\n# from collections import defaultdict\nsys.setrecursionlimit(10**7)\nimport math\nfrom itertools import combinations, product\n\n# import bisect# lower_bound etc\n# import numpy as np\ndef run():\n N, K = read().split()\n N = list(map(int, N))\n K = int(K)\n max_i = len(N)\n dp2 = [0] * max_i\n r = 0\n for i, v in enumerate(N):\n if v != 0:\n r += 1\n dp2[i] = r\n dp1 = [[0] * (K + 1) for _ in range(max_i)]\n dp1[0][1] = int(N[0] - 1)\n dp1[0][0] = 1\n for i in range(1, max_i):\n for j in range(0, K + 1):\n if j == 0:\n dp1[i][j] += dp1[i - 1][j]\n else:\n dp1[i][j] += dp1[i - 1][j] + dp1[i - 1][j - 1] * 9\n if N[i] == 0:\n continue\n if dp2[i - 1] <= K:\n dp1[i][dp2[i - 1]] += 1\n if dp2[i - 1] < K:\n dp1[i][dp2[i - 1] + 1] += N[i] - 1\n plus = 0\n if dp2[-1] == K:\n plus = 1\n print((dp1[max_i - 1][K] + plus))\n\n\nif __name__ == \"__main__\":\n run()\n","code_same":false,"relative_loc_diff_percent":6.0,"diff":["- N, K = list(map(int, read().split()))","- k = int(math.log(N, 10))","- s = N \/\/ (10**k)","- tmp1, tmp2, div = 1, 1, 1","- for i in range(K - 1):","- tmp1 *= k - i","- div *= i + 1","- tmp2 *= 9","- ret = tmp1 \/\/ div * tmp2","- ret *= s - 1","- tmp1 *= k - (K - 1)","- tmp2 *= 9","- div *= K","- ret += tmp1 * tmp2 \/\/ div","- lis = list(range(k))","- nums = list(range(1, 10))","- base = s * 10**k","- for A in combinations(lis, K - 1):","- for X in product(nums, repeat=K - 1):","- tmp = base","- for a, x in zip(A, X):","- tmp += 10**a * x","- if tmp <= N:","- ret += 1","- print(ret)","+ N, K = read().split()","+ N = list(map(int, N))","+ K = int(K)","+ max_i = len(N)","+ dp2 = [0] * max_i","+ r = 0","+ for i, v in enumerate(N):","+ if v != 0:","+ r += 1","+ dp2[i] = r","+ dp1 = [[0] * (K + 1) for _ in range(max_i)]","+ dp1[0][1] = int(N[0] - 1)","+ dp1[0][0] = 1","+ for i in range(1, max_i):","+ for j in range(0, K + 1):","+ if j == 0:","+ dp1[i][j] += dp1[i - 1][j]","+ else:","+ dp1[i][j] += dp1[i - 1][j] + dp1[i - 1][j - 1] * 9","+ if N[i] == 0:","+ continue","+ if dp2[i - 1] <= K:","+ dp1[i][dp2[i - 1]] += 1","+ if dp2[i - 1] < K:","+ dp1[i][dp2[i - 1] + 1] += N[i] - 1","+ plus = 0","+ if dp2[-1] == K:","+ plus = 1","+ print((dp1[max_i - 1][K] + plus))"],"diff_only_import_comment":false,"measured_runtime_v0":0.086502507,"measured_runtime_v1":0.0351078389,"runtime_lift":2.4639086236,"key":["s081116107","s615536539"]} +{"user_id":"u847467233","problem_id":"p00226","language":"python","submission_id_v0":"s284801315","submission_id_v1":"s686796212","cpu_time_v0":200,"cpu_time_v1":180,"memory_v0":5580,"memory_v1":5576,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"# AOJ 0226: Hit and Blow\n\n# Python3 2018.6.23 bal4u\n\n\n\nwhile 1:\n\n\tr, a = input().split()\n\n\tif r == '0': break\n\n\th, sr, sa = 0, set(), set()\n\n\tfor i in range(4):\n\n\t\tif r[i] == a[i]: h += 1\n\n\t\telse:\n\n\t\t\tsr.add(r[i])\n\n\t\t\tsa.add(a[i])\n\n\tprint((h, len(sr & sa)))\n","target":"# AOJ 0226: Hit and Blow\n\n# Python3 2018.6.25 bal4u\n\n\n\nwhile 1:\n\n\tr, a = input().split()\n\n\tif r == '0': break\n\n\th = 0\n\n\tfor i in range(4):\n\n\t\tif r[i] == a[i]: h += 1\n\n\tprint((h, len(set(r) & set(a))-h))\n","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":256,"code_v1_num_chars":201,"code_v0_no_empty_lines":"# AOJ 0226: Hit and Blow\n# Python3 2018.6.23 bal4u\nwhile 1:\n r, a = input().split()\n if r == \"0\":\n break\n h, sr, sa = 0, set(), set()\n for i in range(4):\n if r[i] == a[i]:\n h += 1\n else:\n sr.add(r[i])\n sa.add(a[i])\n print((h, len(sr & sa)))\n","code_v1_no_empty_lines":"# AOJ 0226: Hit and Blow\n# Python3 2018.6.25 bal4u\nwhile 1:\n r, a = input().split()\n if r == \"0\":\n break\n h = 0\n for i in range(4):\n if r[i] == a[i]:\n h += 1\n print((h, len(set(r) & set(a)) - h))\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-# Python3 2018.6.23 bal4u","+# Python3 2018.6.25 bal4u","- h, sr, sa = 0, set(), set()","+ h = 0","- else:","- sr.add(r[i])","- sa.add(a[i])","- print((h, len(sr & sa)))","+ print((h, len(set(r) & set(a)) - h))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0408841815,"measured_runtime_v1":0.041138366,"runtime_lift":0.9938212302,"key":["s284801315","s686796212"]} +{"user_id":"u537142137","problem_id":"p02624","language":"python","submission_id_v0":"s375059845","submission_id_v1":"s663655488","cpu_time_v0":2228,"cpu_time_v1":1214,"memory_v0":9108,"memory_v1":8988,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.51,"input":"N = int(eval(input()))\n\n\n\nt = 0\n\nfor j in range(1,N+1):\n\n m = N\/\/j\n\n t += (1+m)*m\/\/2 * j\n\n#\n\nprint(t)\n","target":"N = int(eval(input()))\n\n\n\nnn = N\/\/2\n\nt = 0\n\nfor j in range(1,nn+1):\n\n m = N\/\/j\n\n t += (1+m)*m\/\/2 * j\n\n#\n\nt += ((nn+1)+N)*(N-nn)\/\/2\n\nprint(t)\n","code_v0_loc":8,"code_v1_loc":10,"code_v0_num_chars":98,"code_v1_num_chars":137,"code_v0_no_empty_lines":"N = int(eval(input()))\nt = 0\nfor j in range(1, N + 1):\n m = N \/\/ j\n t += (1 + m) * m \/\/ 2 * j\n#\nprint(t)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nnn = N \/\/ 2\nt = 0\nfor j in range(1, nn + 1):\n m = N \/\/ j\n t += (1 + m) * m \/\/ 2 * j\n#\nt += ((nn + 1) + N) * (N - nn) \/\/ 2\nprint(t)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["+nn = N \/\/ 2","-for j in range(1, N + 1):","+for j in range(1, nn + 1):","+t += ((nn + 1) + N) * (N - nn) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.8208891153,"measured_runtime_v1":0.4422878742,"runtime_lift":1.8560063777,"key":["s375059845","s663655488"]} +{"user_id":"u903005414","problem_id":"p02730","language":"python","submission_id_v0":"s061710890","submission_id_v1":"s786892533","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"S = eval(input())\n\nN = len(S)\n\n\n\n\n\ndef f1(S):\n\n N = len(S)\n\n subset3 = S[0:(N - 2) \/\/ 2 + 1]\n\n subset4 = S[(N + 2) \/\/ 2:]\n\n return subset3, subset4\n\n\n\n\n\nsubset1, subset2 = f1(S)\n\n_subset2 = ''.join(list(reversed(subset2)))\n\nif subset1 != _subset2:\n\n print('No')\n\n exit()\n\n\n\nif (N - 1) % 4 == 0:\n\n # print('subset1 2', subset1, subset2)\n\n subset3 = subset1[:((N - 1) \/\/ 4)]\n\n subset4 = subset1[((N - 1) \/\/ 4):]\n\n _subset4 = ''.join(list(reversed(subset4)))\n\n # print('subset3 4', subset3, subset4)\n\n subset5 = subset2[:((N - 1) \/\/ 4)]\n\n subset6 = subset2[((N - 1) \/\/ 4):]\n\n _subset6 = ''.join(list(reversed(subset6)))\n\n # print('subset5 6', subset5, subset6)\n\nelse:\n\n subset3, subset4 = f1(subset1)\n\n _subset4 = ''.join(list(reversed(subset4)))\n\n subset5, subset6 = f1(subset2)\n\n _subset6 = ''.join(list(reversed(subset6)))\n\nif subset3 != _subset4:\n\n print('No')\n\n exit()\n\nif subset5 != _subset6:\n\n print('No')\n\n exit()\n\nprint('Yes')\n","target":"S = eval(input())\n\nN = len(S)\n\n\n\n\n\ndef is_kaibun(s):\n\n _s = ''.join(list(reversed(s)))\n\n return s == _s\n\n\n\n\n\nsubset0 = S[0:(N - 2) \/\/ 2 + 1]\n\nsubset1 = S[(N + 2) \/\/ 2:]\n\n\n\nans = 'Yes' if is_kaibun(S) and is_kaibun(subset0) and is_kaibun(\n\n subset1) else 'No'\n\nprint(ans)\n","code_v0_loc":39,"code_v1_loc":15,"code_v0_num_chars":996,"code_v1_num_chars":274,"code_v0_no_empty_lines":"S = eval(input())\nN = len(S)\n\n\ndef f1(S):\n N = len(S)\n subset3 = S[0 : (N - 2) \/\/ 2 + 1]\n subset4 = S[(N + 2) \/\/ 2 :]\n return subset3, subset4\n\n\nsubset1, subset2 = f1(S)\n_subset2 = \"\".join(list(reversed(subset2)))\nif subset1 != _subset2:\n print(\"No\")\n exit()\nif (N - 1) % 4 == 0:\n # print('subset1 2', subset1, subset2)\n subset3 = subset1[: ((N - 1) \/\/ 4)]\n subset4 = subset1[((N - 1) \/\/ 4) :]\n _subset4 = \"\".join(list(reversed(subset4)))\n # print('subset3 4', subset3, subset4)\n subset5 = subset2[: ((N - 1) \/\/ 4)]\n subset6 = subset2[((N - 1) \/\/ 4) :]\n _subset6 = \"\".join(list(reversed(subset6)))\n # print('subset5 6', subset5, subset6)\nelse:\n subset3, subset4 = f1(subset1)\n _subset4 = \"\".join(list(reversed(subset4)))\n subset5, subset6 = f1(subset2)\n _subset6 = \"\".join(list(reversed(subset6)))\nif subset3 != _subset4:\n print(\"No\")\n exit()\nif subset5 != _subset6:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"S = eval(input())\nN = len(S)\n\n\ndef is_kaibun(s):\n _s = \"\".join(list(reversed(s)))\n return s == _s\n\n\nsubset0 = S[0 : (N - 2) \/\/ 2 + 1]\nsubset1 = S[(N + 2) \/\/ 2 :]\nans = \"Yes\" if is_kaibun(S) and is_kaibun(subset0) and is_kaibun(subset1) else \"No\"\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":61.5384615385,"diff":["-def f1(S):","- N = len(S)","- subset3 = S[0 : (N - 2) \/\/ 2 + 1]","- subset4 = S[(N + 2) \/\/ 2 :]","- return subset3, subset4","+def is_kaibun(s):","+ _s = \"\".join(list(reversed(s)))","+ return s == _s","-subset1, subset2 = f1(S)","-_subset2 = \"\".join(list(reversed(subset2)))","-if subset1 != _subset2:","- print(\"No\")","- exit()","-if (N - 1) % 4 == 0:","- # print('subset1 2', subset1, subset2)","- subset3 = subset1[: ((N - 1) \/\/ 4)]","- subset4 = subset1[((N - 1) \/\/ 4) :]","- _subset4 = \"\".join(list(reversed(subset4)))","- # print('subset3 4', subset3, subset4)","- subset5 = subset2[: ((N - 1) \/\/ 4)]","- subset6 = subset2[((N - 1) \/\/ 4) :]","- _subset6 = \"\".join(list(reversed(subset6)))","- # print('subset5 6', subset5, subset6)","-else:","- subset3, subset4 = f1(subset1)","- _subset4 = \"\".join(list(reversed(subset4)))","- subset5, subset6 = f1(subset2)","- _subset6 = \"\".join(list(reversed(subset6)))","-if subset3 != _subset4:","- print(\"No\")","- exit()","-if subset5 != _subset6:","- print(\"No\")","- exit()","-print(\"Yes\")","+subset0 = S[0 : (N - 2) \/\/ 2 + 1]","+subset1 = S[(N + 2) \/\/ 2 :]","+ans = \"Yes\" if is_kaibun(S) and is_kaibun(subset0) and is_kaibun(subset1) else \"No\"","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1601170673,"measured_runtime_v1":0.0633054543,"runtime_lift":2.5292775986,"key":["s061710890","s786892533"]} +{"user_id":"u442877951","problem_id":"p02947","language":"python","submission_id_v0":"s841265192","submission_id_v1":"s549231600","cpu_time_v0":477,"cpu_time_v1":354,"memory_v0":24560,"memory_v1":26960,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.79,"input":"from collections import Counter\n\nN = int(eval(input()))\n\nS = [str(sorted(eval(input()))) for _ in range(N)]\n\ncount = 0\n\nfor i in list(Counter(S).values()):\n\n count += i*(i-1)\/\/2\n\nprint(count)","target":"from collections import Counter\n\nN = int(eval(input()))\n\nS = [eval(input()) for _ in range(N)]\n\nans = 0\n\ncheck_box = []\n\nfor s in S:\n\n s = sorted(s)\n\n s = ''.join(s)\n\n check_box.append(s)\n\nC = Counter(check_box)\n\nfor i in C:\n\n ans += C[i]*(C[i]-1)\/\/2\n\nprint(ans)","code_v0_loc":7,"code_v1_loc":13,"code_v0_num_chars":174,"code_v1_num_chars":254,"code_v0_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\nS = [str(sorted(eval(input()))) for _ in range(N)]\ncount = 0\nfor i in list(Counter(S).values()):\n count += i * (i - 1) \/\/ 2\nprint(count)\n","code_v1_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\nS = [eval(input()) for _ in range(N)]\nans = 0\ncheck_box = []\nfor s in S:\n s = sorted(s)\n s = \"\".join(s)\n check_box.append(s)\nC = Counter(check_box)\nfor i in C:\n ans += C[i] * (C[i] - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":46.1538461538,"diff":["-S = [str(sorted(eval(input()))) for _ in range(N)]","-count = 0","-for i in list(Counter(S).values()):","- count += i * (i - 1) \/\/ 2","-print(count)","+S = [eval(input()) for _ in range(N)]","+ans = 0","+check_box = []","+for s in S:","+ s = sorted(s)","+ s = \"\".join(s)","+ check_box.append(s)","+C = Counter(check_box)","+for i in C:","+ ans += C[i] * (C[i] - 1) \/\/ 2","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0392979212,"measured_runtime_v1":0.0363565068,"runtime_lift":1.0809047569,"key":["s841265192","s549231600"]} +{"user_id":"u729133443","problem_id":"p03073","language":"python","submission_id_v0":"s413882097","submission_id_v1":"s877053259","cpu_time_v0":66,"cpu_time_v1":48,"memory_v0":3188,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.27,"input":"a=0\n\nfor i,s in enumerate(eval(input())):a+=i%2^int(s)\n\nprint((min(a,i-a+1)))","target":"import sys\n\ns=sys.stdin.buffer.readline().rstrip()\n\nn=len(s)\n\na=0\n\nfor i in range(n):\n\n a+=s[i]%2==i%2\n\nprint((min(a,n-a)))","code_v0_loc":3,"code_v1_loc":7,"code_v0_num_chars":69,"code_v1_num_chars":124,"code_v0_no_empty_lines":"a = 0\nfor i, s in enumerate(eval(input())):\n a += i % 2 ^ int(s)\nprint((min(a, i - a + 1)))\n","code_v1_no_empty_lines":"import sys\n\ns = sys.stdin.buffer.readline().rstrip()\nn = len(s)\na = 0\nfor i in range(n):\n a += s[i] % 2 == i % 2\nprint((min(a, n - a)))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["+import sys","+","+s = sys.stdin.buffer.readline().rstrip()","+n = len(s)","-for i, s in enumerate(eval(input())):","- a += i % 2 ^ int(s)","-print((min(a, i - a + 1)))","+for i in range(n):","+ a += s[i] % 2 == i % 2","+print((min(a, n - a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0878481889,"measured_runtime_v1":0.0356432755,"runtime_lift":2.4646497164,"key":["s413882097","s877053259"]} +{"user_id":"u888092736","problem_id":"p02936","language":"python","submission_id_v0":"s239233553","submission_id_v1":"s524080422","cpu_time_v0":1527,"cpu_time_v1":1220,"memory_v0":99396,"memory_v1":99288,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.1,"input":"import sys\n\n\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef dfs(v):\n\n print(counter)\n\n for nv in g[v]:\n\n if nv in visited:\n\n continue\n\n visited.add(nv)\n\n counter[nv] += counter[v]\n\n dfs(nv)\n\n\n\n\n\ndef input():\n\n return sys.stdin.readline().strip()\n\n\n\n\n\nN, Q = list(map(int, input().split()))\n\ng = [set() for _ in range(N)]\n\nfor _ in range(N - 1):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n g[a].add(b)\n\n g[b].add(a)\n\ncounter = [0] * N\n\nfor _ in range(Q):\n\n p, x = list(map(int, input().split()))\n\n p -= 1\n\n counter[p] += x\n\n\n\nstack = [0]\n\nvisited = {0}\n\nwhile stack:\n\n v = stack.pop()\n\n for nv in g[v]:\n\n if nv in visited:\n\n continue\n\n stack.append(nv)\n\n visited.add(nv)\n\n counter[nv] += counter[v]\n\nprint((\" \".join(map(str, counter))))\n","target":"import sys\n\n\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\n\n\n\n\ndef solve():\n\n def dfs(v):\n\n print(counter)\n\n for nv in g[v]:\n\n if nv in visited:\n\n continue\n\n visited.add(nv)\n\n counter[nv] += counter[v]\n\n dfs(nv)\n\n\n\n def input():\n\n return sys.stdin.readline().strip()\n\n\n\n N, Q = list(map(int, input().split()))\n\n g = [set() for _ in range(N)]\n\n for _ in range(N - 1):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n g[a].add(b)\n\n g[b].add(a)\n\n counter = [0] * N\n\n for _ in range(Q):\n\n p, x = list(map(int, input().split()))\n\n p -= 1\n\n counter[p] += x\n\n\n\n stack = [0]\n\n visited = {0}\n\n while stack:\n\n v = stack.pop()\n\n for nv in g[v]:\n\n if nv in visited:\n\n continue\n\n stack.append(nv)\n\n visited.add(nv)\n\n counter[nv] += counter[v]\n\n return counter\n\n\n\n\n\nprint((\" \".join(map(str, solve()))))\n","code_v0_loc":45,"code_v1_loc":47,"code_v0_num_chars":846,"code_v1_num_chars":1012,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef dfs(v):\n print(counter)\n for nv in g[v]:\n if nv in visited:\n continue\n visited.add(nv)\n counter[nv] += counter[v]\n dfs(nv)\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\nN, Q = list(map(int, input().split()))\ng = [set() for _ in range(N)]\nfor _ in range(N - 1):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n g[a].add(b)\n g[b].add(a)\ncounter = [0] * N\nfor _ in range(Q):\n p, x = list(map(int, input().split()))\n p -= 1\n counter[p] += x\nstack = [0]\nvisited = {0}\nwhile stack:\n v = stack.pop()\n for nv in g[v]:\n if nv in visited:\n continue\n stack.append(nv)\n visited.add(nv)\n counter[nv] += counter[v]\nprint((\" \".join(map(str, counter))))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef solve():\n def dfs(v):\n print(counter)\n for nv in g[v]:\n if nv in visited:\n continue\n visited.add(nv)\n counter[nv] += counter[v]\n dfs(nv)\n\n def input():\n return sys.stdin.readline().strip()\n\n N, Q = list(map(int, input().split()))\n g = [set() for _ in range(N)]\n for _ in range(N - 1):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n g[a].add(b)\n g[b].add(a)\n counter = [0] * N\n for _ in range(Q):\n p, x = list(map(int, input().split()))\n p -= 1\n counter[p] += x\n stack = [0]\n visited = {0}\n while stack:\n v = stack.pop()\n for nv in g[v]:\n if nv in visited:\n continue\n stack.append(nv)\n visited.add(nv)\n counter[nv] += counter[v]\n return counter\n\n\nprint((\" \".join(map(str, solve()))))\n","code_same":false,"relative_loc_diff_percent":4.2553191489,"diff":["-def dfs(v):","- print(counter)","- for nv in g[v]:","- if nv in visited:","- continue","- visited.add(nv)","- counter[nv] += counter[v]","- dfs(nv)","+def solve():","+ def dfs(v):","+ print(counter)","+ for nv in g[v]:","+ if nv in visited:","+ continue","+ visited.add(nv)","+ counter[nv] += counter[v]","+ dfs(nv)","+","+ def input():","+ return sys.stdin.readline().strip()","+","+ N, Q = list(map(int, input().split()))","+ g = [set() for _ in range(N)]","+ for _ in range(N - 1):","+ a, b = list(map(int, input().split()))","+ a -= 1","+ b -= 1","+ g[a].add(b)","+ g[b].add(a)","+ counter = [0] * N","+ for _ in range(Q):","+ p, x = list(map(int, input().split()))","+ p -= 1","+ counter[p] += x","+ stack = [0]","+ visited = {0}","+ while stack:","+ v = stack.pop()","+ for nv in g[v]:","+ if nv in visited:","+ continue","+ stack.append(nv)","+ visited.add(nv)","+ counter[nv] += counter[v]","+ return counter","-def input():","- return sys.stdin.readline().strip()","-","-","-N, Q = list(map(int, input().split()))","-g = [set() for _ in range(N)]","-for _ in range(N - 1):","- a, b = list(map(int, input().split()))","- a -= 1","- b -= 1","- g[a].add(b)","- g[b].add(a)","-counter = [0] * N","-for _ in range(Q):","- p, x = list(map(int, input().split()))","- p -= 1","- counter[p] += x","-stack = [0]","-visited = {0}","-while stack:","- v = stack.pop()","- for nv in g[v]:","- if nv in visited:","- continue","- stack.append(nv)","- visited.add(nv)","- counter[nv] += counter[v]","-print((\" \".join(map(str, counter))))","+print((\" \".join(map(str, solve()))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0460893071,"measured_runtime_v1":0.0430690911,"runtime_lift":1.0701249063,"key":["s239233553","s524080422"]} +{"user_id":"u163320134","problem_id":"p02574","language":"python","submission_id_v0":"s101948848","submission_id_v1":"s686686749","cpu_time_v0":758,"cpu_time_v1":639,"memory_v0":212388,"memory_v1":179748,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.7,"input":"#!\/usr\/bin\/env python3\n\n\n\nimport collections\n\nimport sys\n\ninput=sys.stdin.readline\n\n\n\ndef gcd(a,b):\n\n if b==0:\n\n return a\n\n else:\n\n return gcd(b,a%b)\n\n\n\ndef judge(n,arr):\n\n MAX=10**6\n\n table=[i for i in range(MAX+1)]\n\n for i in range(2,MAX+1):\n\n if table[i]=2:\n\n return False\n\n return True\n\n \n\nn=int(eval(input()))\n\narr=list(map(int,input().split()))\n\ntmp=arr[0]\n\nfor val in arr:\n\n tmp=gcd(tmp,val)\n\nif tmp==1:\n\n is_setwise=True\n\nelse:\n\n is_setwise=False\n\nis_pairwise=judge(n,arr)\n\nif is_pairwise==True:\n\n print('pairwise coprime')\n\nelif is_setwise==True:\n\n print('setwise coprime')\n\nelse:\n\n print('not coprime')","target":"import collections\n\nimport sys\n\ninput=sys.stdin.readline\n\n\n\ndef divisors(n):\n\n ret=[]\n\n for i in range(2,int(n**0.5)+1):\n\n if n%i==0:\n\n ret.append(i)\n\n while n%i==0:\n\n n\/\/=i\n\n if n!=1:\n\n ret.append(n)\n\n return ret\n\n\n\ndef gcd(a,b):\n\n if b==0:\n\n return a\n\n else:\n\n return gcd(b,a%b)\n\n\n\nn=int(eval(input()))\n\narr=list(map(int,input().split()))\n\ncnt=[False]*(max(arr)+1)\n\nis_pairwise=True\n\ntmp=arr[0]\n\nfor val in arr:\n\n tmp=gcd(tmp,val)\n\n if is_pairwise==False:\n\n continue\n\n divisor=divisors(val)\n\n for val2 in divisor:\n\n if cnt[val2]==True:\n\n is_pairwise=False\n\n break\n\n cnt[val2]=True\n\nif tmp==1:\n\n is_setwise=True\n\nelse:\n\n is_setwise=False\n\nif is_pairwise==True:\n\n print('pairwise coprime')\n\nelif is_setwise==True:\n\n print('setwise coprime')\n\nelse:\n\n print('not coprime')","code_v0_loc":50,"code_v1_loc":46,"code_v0_num_chars":1037,"code_v1_num_chars":827,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport collections\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\n\n\ndef judge(n, arr):\n MAX = 10**6\n table = [i for i in range(MAX + 1)]\n for i in range(2, MAX + 1):\n if table[i] < i:\n continue\n for j in range(i, MAX + 1, i):\n table[j] = i\n cnt = collections.defaultdict(int)\n for val in arr:\n s = set()\n while val != 1:\n prime = table[val]\n s.add(prime)\n val \/\/= prime\n for tmp in s:\n cnt[tmp] += 1\n for val in list(cnt.values()):\n if val >= 2:\n return False\n return True\n\n\nn = int(eval(input()))\narr = list(map(int, input().split()))\ntmp = arr[0]\nfor val in arr:\n tmp = gcd(tmp, val)\nif tmp == 1:\n is_setwise = True\nelse:\n is_setwise = False\nis_pairwise = judge(n, arr)\nif is_pairwise == True:\n print(\"pairwise coprime\")\nelif is_setwise == True:\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n","code_v1_no_empty_lines":"import collections\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef divisors(n):\n ret = []\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n ret.append(i)\n while n % i == 0:\n n \/\/= i\n if n != 1:\n ret.append(n)\n return ret\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\n\n\nn = int(eval(input()))\narr = list(map(int, input().split()))\ncnt = [False] * (max(arr) + 1)\nis_pairwise = True\ntmp = arr[0]\nfor val in arr:\n tmp = gcd(tmp, val)\n if is_pairwise == False:\n continue\n divisor = divisors(val)\n for val2 in divisor:\n if cnt[val2] == True:\n is_pairwise = False\n break\n cnt[val2] = True\nif tmp == 1:\n is_setwise = True\nelse:\n is_setwise = False\nif is_pairwise == True:\n print(\"pairwise coprime\")\nelif is_setwise == True:\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n","code_same":false,"relative_loc_diff_percent":8.0,"diff":["-#!\/usr\/bin\/env python3","+","+","+def divisors(n):","+ ret = []","+ for i in range(2, int(n**0.5) + 1):","+ if n % i == 0:","+ ret.append(i)","+ while n % i == 0:","+ n \/\/= i","+ if n != 1:","+ ret.append(n)","+ return ret","-def judge(n, arr):","- MAX = 10**6","- table = [i for i in range(MAX + 1)]","- for i in range(2, MAX + 1):","- if table[i] < i:","- continue","- for j in range(i, MAX + 1, i):","- table[j] = i","- cnt = collections.defaultdict(int)","- for val in arr:","- s = set()","- while val != 1:","- prime = table[val]","- s.add(prime)","- val \/\/= prime","- for tmp in s:","- cnt[tmp] += 1","- for val in list(cnt.values()):","- if val >= 2:","- return False","- return True","-","-","+cnt = [False] * (max(arr) + 1)","+is_pairwise = True","+ if is_pairwise == False:","+ continue","+ divisor = divisors(val)","+ for val2 in divisor:","+ if cnt[val2] == True:","+ is_pairwise = False","+ break","+ cnt[val2] = True","-is_pairwise = judge(n, arr)"],"diff_only_import_comment":false,"measured_runtime_v0":1.1682755942,"measured_runtime_v1":0.0402388442,"runtime_lift":29.0335276383,"key":["s101948848","s686686749"]} +{"user_id":"u990566513","problem_id":"p02773","language":"python","submission_id_v0":"s622795537","submission_id_v1":"s697658043","cpu_time_v0":665,"cpu_time_v1":539,"memory_v0":32988,"memory_v1":35672,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.95,"input":"n = int(eval(input()))\n\narr = {}\n\n\n\nfor i in range(n):\n\n s = eval(input())\n\n if not s in arr:\n\n arr[s] = 1\n\n else:\n\n arr[s] += 1\n\n\n\nmax_count = max(arr.values())\n\ndic = [key[0] for key in list(arr.items()) if key[1] == max_count]\n\n\n\nout_sort = sorted(dic)\n\nfor i in out_sort:\n\n print(i)\n","target":"n = int(eval(input()))\n\narr = {}\n\n\n\nfor i in range(n):\n\n s = eval(input())\n\n if not s in arr:\n\n arr[s] = 1\n\n else:\n\n arr[s] += 1\n\n\n\nmax_count = max(arr.values())\n\ndic = [key[0] for key in list(arr.items()) if key[1] == max_count]\n\n\n\nout_sort = sorted(dic)\n\nprint((\"\\n\".join(out_sort)))","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":295,"code_v1_num_chars":288,"code_v0_no_empty_lines":"n = int(eval(input()))\narr = {}\nfor i in range(n):\n s = eval(input())\n if not s in arr:\n arr[s] = 1\n else:\n arr[s] += 1\nmax_count = max(arr.values())\ndic = [key[0] for key in list(arr.items()) if key[1] == max_count]\nout_sort = sorted(dic)\nfor i in out_sort:\n print(i)\n","code_v1_no_empty_lines":"n = int(eval(input()))\narr = {}\nfor i in range(n):\n s = eval(input())\n if not s in arr:\n arr[s] = 1\n else:\n arr[s] += 1\nmax_count = max(arr.values())\ndic = [key[0] for key in list(arr.items()) if key[1] == max_count]\nout_sort = sorted(dic)\nprint((\"\\n\".join(out_sort)))\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["-for i in out_sort:","- print(i)","+print((\"\\n\".join(out_sort)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0431381087,"measured_runtime_v1":0.0436756737,"runtime_lift":0.9876918899,"key":["s622795537","s697658043"]} +{"user_id":"u785989355","problem_id":"p02788","language":"python","submission_id_v0":"s685090257","submission_id_v1":"s082038496","cpu_time_v0":1443,"cpu_time_v1":1102,"memory_v0":91868,"memory_v1":88204,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.63,"input":"import sys\n\n\n\nsys.setrecursionlimit(500000)\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\n\n\nclass BIT:\n\n \n\n def __init__(self, L):\n\n self.N = len(L)\n\n self.bit = [0]*self.N\n\n for i,l in enumerate(L):\n\n self.add(i,l)\n\n\n\n def add(self, a, w):\n\n x = a + 1\n\n for i in range(1000):\n\n self.bit[x-1] += w\n\n x += x & -x\n\n if x > self.N:\n\n break\n\n\n\n def sum(self, a):\n\n x = a+1\n\n ret = 0\n\n for i in range(1000):\n\n ret += self.bit[x-1]\n\n x -= x & -x\n\n if x <= 0:\n\n break \n\n return ret\n\n\n\n\n\n\n\n\n\ndef main():\n\n N,D,A = list(map(int,input().split()))\n\n\n\n enemy = []\n\n for i in range(N):\n\n x,h = list(map(int,input().split()))\n\n if h%A==0:\n\n enemy.append([x,h\/\/A])\n\n else:\n\n enemy.append([x,h\/\/A+1])\n\n\n\n enemy.sort(key=lambda x:x[0])\n\n def bisect(index):\n\n x = enemy[index][0]\n\n if enemy[N-1][0] <= x + 2*D:\n\n return N-1\n\n l = index\n\n r = N-1\n\n while r-l>1:\n\n if enemy[(r+l)\/\/2][0] <= x + 2*D:\n\n l = (r+l)\/\/2\n\n else:\n\n r = (r+l)\/\/2\n\n return l\n\n\n\n bit = BIT([0]*N)\n\n\n\n count1 = 0\n\n for i in range(N):\n\n if i>0:\n\n v = bit.sum(N-1) - bit.sum(i-1)\n\n else:\n\n v=0\n\n if enemy[i][1] - v>0:\n\n count1 += enemy[i][1] - v\n\n j = bisect(i)\n\n bit.add(j,enemy[i][1] - v)\n\n\n\n enemy = enemy[::-1]\n\n for i in range(N):\n\n enemy[i][0] = -enemy[i][0]\n\n\n\n bit = BIT([0]*N)\n\n\n\n count2 = 0\n\n for i in range(N):\n\n if i>0:\n\n v = bit.sum(N-1) - bit.sum(i-1)\n\n else:\n\n v = 0\n\n if enemy[i][1] - v>0:\n\n count2 += enemy[i][1] - v\n\n j = bisect(i)\n\n bit.add(j,enemy[i][1] - v)\n\n\n\n\n\n print((min(count1,count2)))\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n","target":"import sys\n\n\n\nsys.setrecursionlimit(500000)\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\n\n\nclass DualSegmentTree:\n\n def __init__(self, n) :\n\n self.n = n\n\n self.N0 = 1 << n.bit_length()\n\n self.data = [0] * (self.N0*2)\n\n\n\n def update(self, l, r, val) :\n\n l += self.N0\n\n r += self.N0\n\n while l < r:\n\n if l & 1:\n\n self.data[l] = self.data[l] + val\n\n l += 1\n\n if r & 1:\n\n self.data[r-1] = self.data[r-1] + val\n\n r -= 1\n\n l \/\/= 2\n\n r \/\/= 2\n\n\n\n def query(self, i):\n\n i += len(self.data) \/\/ 2\n\n ret = self.data[i]\n\n while i > 0:\n\n i \/\/= 2\n\n ret = ret + self.data[i]\n\n return ret\n\n\n\n\n\n\n\n\n\ndef main():\n\n N,D,A = list(map(int,input().split()))\n\n\n\n enemy = []\n\n for i in range(N):\n\n x,h = list(map(int,input().split()))\n\n if h%A==0:\n\n enemy.append([x,h\/\/A])\n\n else:\n\n enemy.append([x,h\/\/A+1])\n\n\n\n enemy.sort(key=lambda x:x[0])\n\n def bisect(index):\n\n x = enemy[index][0]\n\n if enemy[N-1][0] <= x + 2*D:\n\n return N-1\n\n l = index\n\n r = N-1\n\n while r-l>1:\n\n if enemy[(r+l)\/\/2][0] <= x + 2*D:\n\n l = (r+l)\/\/2\n\n else:\n\n r = (r+l)\/\/2\n\n return l\n\n ST = DualSegmentTree(N)\n\n\n\n for i in range(N):\n\n ST.update(i,i+1,enemy[i][1])\n\n\n\n count = 0\n\n for i in range(N):\n\n v = ST.query(i)\n\n if v>0:\n\n count += v\n\n j = bisect(i)\n\n ST.update(i,j+1,-v) \n\n\n\n print(count)\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n","code_v0_loc":96,"code_v1_loc":78,"code_v0_num_chars":2057,"code_v1_num_chars":1725,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(500000)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nclass BIT:\n def __init__(self, L):\n self.N = len(L)\n self.bit = [0] * self.N\n for i, l in enumerate(L):\n self.add(i, l)\n\n def add(self, a, w):\n x = a + 1\n for i in range(1000):\n self.bit[x - 1] += w\n x += x & -x\n if x > self.N:\n break\n\n def sum(self, a):\n x = a + 1\n ret = 0\n for i in range(1000):\n ret += self.bit[x - 1]\n x -= x & -x\n if x <= 0:\n break\n return ret\n\n\ndef main():\n N, D, A = list(map(int, input().split()))\n enemy = []\n for i in range(N):\n x, h = list(map(int, input().split()))\n if h % A == 0:\n enemy.append([x, h \/\/ A])\n else:\n enemy.append([x, h \/\/ A + 1])\n enemy.sort(key=lambda x: x[0])\n\n def bisect(index):\n x = enemy[index][0]\n if enemy[N - 1][0] <= x + 2 * D:\n return N - 1\n l = index\n r = N - 1\n while r - l > 1:\n if enemy[(r + l) \/\/ 2][0] <= x + 2 * D:\n l = (r + l) \/\/ 2\n else:\n r = (r + l) \/\/ 2\n return l\n\n bit = BIT([0] * N)\n count1 = 0\n for i in range(N):\n if i > 0:\n v = bit.sum(N - 1) - bit.sum(i - 1)\n else:\n v = 0\n if enemy[i][1] - v > 0:\n count1 += enemy[i][1] - v\n j = bisect(i)\n bit.add(j, enemy[i][1] - v)\n enemy = enemy[::-1]\n for i in range(N):\n enemy[i][0] = -enemy[i][0]\n bit = BIT([0] * N)\n count2 = 0\n for i in range(N):\n if i > 0:\n v = bit.sum(N - 1) - bit.sum(i - 1)\n else:\n v = 0\n if enemy[i][1] - v > 0:\n count2 += enemy[i][1] - v\n j = bisect(i)\n bit.add(j, enemy[i][1] - v)\n print((min(count1, count2)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(500000)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nclass DualSegmentTree:\n def __init__(self, n):\n self.n = n\n self.N0 = 1 << n.bit_length()\n self.data = [0] * (self.N0 * 2)\n\n def update(self, l, r, val):\n l += self.N0\n r += self.N0\n while l < r:\n if l & 1:\n self.data[l] = self.data[l] + val\n l += 1\n if r & 1:\n self.data[r - 1] = self.data[r - 1] + val\n r -= 1\n l \/\/= 2\n r \/\/= 2\n\n def query(self, i):\n i += len(self.data) \/\/ 2\n ret = self.data[i]\n while i > 0:\n i \/\/= 2\n ret = ret + self.data[i]\n return ret\n\n\ndef main():\n N, D, A = list(map(int, input().split()))\n enemy = []\n for i in range(N):\n x, h = list(map(int, input().split()))\n if h % A == 0:\n enemy.append([x, h \/\/ A])\n else:\n enemy.append([x, h \/\/ A + 1])\n enemy.sort(key=lambda x: x[0])\n\n def bisect(index):\n x = enemy[index][0]\n if enemy[N - 1][0] <= x + 2 * D:\n return N - 1\n l = index\n r = N - 1\n while r - l > 1:\n if enemy[(r + l) \/\/ 2][0] <= x + 2 * D:\n l = (r + l) \/\/ 2\n else:\n r = (r + l) \/\/ 2\n return l\n\n ST = DualSegmentTree(N)\n for i in range(N):\n ST.update(i, i + 1, enemy[i][1])\n count = 0\n for i in range(N):\n v = ST.query(i)\n if v > 0:\n count += v\n j = bisect(i)\n ST.update(i, j + 1, -v)\n print(count)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-class BIT:","- def __init__(self, L):","- self.N = len(L)","- self.bit = [0] * self.N","- for i, l in enumerate(L):","- self.add(i, l)","+class DualSegmentTree:","+ def __init__(self, n):","+ self.n = n","+ self.N0 = 1 << n.bit_length()","+ self.data = [0] * (self.N0 * 2)","- def add(self, a, w):","- x = a + 1","- for i in range(1000):","- self.bit[x - 1] += w","- x += x & -x","- if x > self.N:","- break","+ def update(self, l, r, val):","+ l += self.N0","+ r += self.N0","+ while l < r:","+ if l & 1:","+ self.data[l] = self.data[l] + val","+ l += 1","+ if r & 1:","+ self.data[r - 1] = self.data[r - 1] + val","+ r -= 1","+ l \/\/= 2","+ r \/\/= 2","- def sum(self, a):","- x = a + 1","- ret = 0","- for i in range(1000):","- ret += self.bit[x - 1]","- x -= x & -x","- if x <= 0:","- break","+ def query(self, i):","+ i += len(self.data) \/\/ 2","+ ret = self.data[i]","+ while i > 0:","+ i \/\/= 2","+ ret = ret + self.data[i]","- bit = BIT([0] * N)","- count1 = 0","+ ST = DualSegmentTree(N)","- if i > 0:","- v = bit.sum(N - 1) - bit.sum(i - 1)","- else:","- v = 0","- if enemy[i][1] - v > 0:","- count1 += enemy[i][1] - v","+ ST.update(i, i + 1, enemy[i][1])","+ count = 0","+ for i in range(N):","+ v = ST.query(i)","+ if v > 0:","+ count += v","- bit.add(j, enemy[i][1] - v)","- enemy = enemy[::-1]","- for i in range(N):","- enemy[i][0] = -enemy[i][0]","- bit = BIT([0] * N)","- count2 = 0","- for i in range(N):","- if i > 0:","- v = bit.sum(N - 1) - bit.sum(i - 1)","- else:","- v = 0","- if enemy[i][1] - v > 0:","- count2 += enemy[i][1] - v","- j = bisect(i)","- bit.add(j, enemy[i][1] - v)","- print((min(count1, count2)))","+ ST.update(i, j + 1, -v)","+ print(count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0462536752,"measured_runtime_v1":0.0369505785,"runtime_lift":1.2517713429,"key":["s685090257","s082038496"]} +{"user_id":"u312025627","problem_id":"p03156","language":"python","submission_id_v0":"s659223407","submission_id_v1":"s992417082","cpu_time_v0":165,"cpu_time_v1":97,"memory_v0":38384,"memory_v1":61752,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.21,"input":"def main():\n\n N = int(eval(input()))\n\n A, B = (int(i) for i in input().split())\n\n P = [int(i) for i in input().split()]\n\n cnt = [0, 0, 0]\n\n for p in P:\n\n if p <= A:\n\n cnt[0] += 1\n\n elif p <= B:\n\n cnt[1] += 1\n\n else:\n\n cnt[2] += 1\n\n print((min(cnt)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n N = int(eval(input()))\n\n A, B = (int(i) for i in input().split())\n\n P = [int(i) for i in input().split()]\n\n\n\n cnt = [0]*3\n\n for p in P:\n\n if p <= A:\n\n cnt[0] += 1\n\n elif p <= B:\n\n cnt[1] += 1\n\n else:\n\n cnt[2] += 1\n\n\n\n print((min(cnt)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":17,"code_v1_loc":19,"code_v0_num_chars":358,"code_v1_num_chars":358,"code_v0_no_empty_lines":"def main():\n N = int(eval(input()))\n A, B = (int(i) for i in input().split())\n P = [int(i) for i in input().split()]\n cnt = [0, 0, 0]\n for p in P:\n if p <= A:\n cnt[0] += 1\n elif p <= B:\n cnt[1] += 1\n else:\n cnt[2] += 1\n print((min(cnt)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n A, B = (int(i) for i in input().split())\n P = [int(i) for i in input().split()]\n cnt = [0] * 3\n for p in P:\n if p <= A:\n cnt[0] += 1\n elif p <= B:\n cnt[1] += 1\n else:\n cnt[2] += 1\n print((min(cnt)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["- cnt = [0, 0, 0]","+ cnt = [0] * 3"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370734293,"measured_runtime_v1":0.037404238,"runtime_lift":0.9911558511,"key":["s659223407","s992417082"]} +{"user_id":"u983918956","problem_id":"p03714","language":"python","submission_id_v0":"s125911017","submission_id_v1":"s899319459","cpu_time_v0":557,"cpu_time_v1":510,"memory_v0":43308,"memory_v1":37212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.44,"input":"from heapq import heappop, heappush\n\n\n\ninf = float('inf')\n\n\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\n# sum_max[k] : [0,k)\u306e\u3046\u3061N\u500b\u307e\u3067\u306e\u7dcf\u548c\u306e\u6700\u5927\u5024\n\n# sum_min[k] : (3N-1-k,3N-1]\u306e\u3046\u3061N\u500b\u307e\u3067\u306e\u7dcf\u548c\u306e\u6700\u5c0f\u5024\n\nsum_max = [0]*(3*N+1)\n\nsum_min = [0]*(3*N+1)\n\n\n\ndef init_max():\n\n res = 0\n\n hq = []\n\n for i, a in enumerate(A):\n\n if len(hq) < N:\n\n heappush(hq,a)\n\n res += a\n\n else:\n\n if hq[0] < a:\n\n res -= heappop(hq)\n\n heappush(hq,a)\n\n res += a\n\n sum_max[i+1] = res\n\n\n\ndef init_min():\n\n res = 0\n\n hq = []\n\n for i, a in enumerate(A[::-1]):\n\n if len(hq) < N:\n\n heappush(hq,-a)\n\n res += a\n\n else:\n\n if -hq[0] > a:\n\n res -= -heappop(hq) \n\n heappush(hq,-a)\n\n res += a\n\n sum_min[i+1] = res\n\n\n\ninit_max()\n\ninit_min()\n\n\n\nans = -inf\n\n\n\nfor k in range(N,2*N+1):\n\n res = sum_max[k] - sum_min[3*N-k]\n\n ans = max(ans, res)\n\n\n\nprint(ans)","target":"from heapq import heappop, heappush\n\ninf = float('inf')\n\n\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nl = []\n\nres = 0\n\nfor i in range(N):\n\n heappush(l, A[i])\n\n res += A[i]\n\nls = []\n\nls.append(res)\n\n\n\nfor i in range(N, 2*N):\n\n heappush(l, A[i])\n\n res += A[i]\n\n res -= heappop(l)\n\n ls.append(res)\n\n\n\nA.reverse()\n\n\n\ns = []\n\nres = 0\n\nfor i in range(N):\n\n heappush(s, -A[i])\n\n res += A[i]\n\nss = []\n\nss.append(res)\n\n\n\nfor i in range(N, 2*N):\n\n heappush(s, -A[i])\n\n res += A[i]\n\n res -= -heappop(s)\n\n ss.append(res)\n\n\n\nss.reverse()\n\n\n\nans = -inf\n\n\n\nfor i in range(N+1):\n\n score = ls[i] - ss[i]\n\n ans = max(ans, score)\n\n\n\nprint(ans)","code_v0_loc":50,"code_v1_loc":45,"code_v0_num_chars":1028,"code_v1_num_chars":679,"code_v0_no_empty_lines":"from heapq import heappop, heappush\n\ninf = float(\"inf\")\nN = int(eval(input()))\nA = list(map(int, input().split()))\n# sum_max[k] : [0,k)\u306e\u3046\u3061N\u500b\u307e\u3067\u306e\u7dcf\u548c\u306e\u6700\u5927\u5024\n# sum_min[k] : (3N-1-k,3N-1]\u306e\u3046\u3061N\u500b\u307e\u3067\u306e\u7dcf\u548c\u306e\u6700\u5c0f\u5024\nsum_max = [0] * (3 * N + 1)\nsum_min = [0] * (3 * N + 1)\n\n\ndef init_max():\n res = 0\n hq = []\n for i, a in enumerate(A):\n if len(hq) < N:\n heappush(hq, a)\n res += a\n else:\n if hq[0] < a:\n res -= heappop(hq)\n heappush(hq, a)\n res += a\n sum_max[i + 1] = res\n\n\ndef init_min():\n res = 0\n hq = []\n for i, a in enumerate(A[::-1]):\n if len(hq) < N:\n heappush(hq, -a)\n res += a\n else:\n if -hq[0] > a:\n res -= -heappop(hq)\n heappush(hq, -a)\n res += a\n sum_min[i + 1] = res\n\n\ninit_max()\ninit_min()\nans = -inf\nfor k in range(N, 2 * N + 1):\n res = sum_max[k] - sum_min[3 * N - k]\n ans = max(ans, res)\nprint(ans)\n","code_v1_no_empty_lines":"from heapq import heappop, heappush\n\ninf = float(\"inf\")\nN = int(eval(input()))\nA = list(map(int, input().split()))\nl = []\nres = 0\nfor i in range(N):\n heappush(l, A[i])\n res += A[i]\nls = []\nls.append(res)\nfor i in range(N, 2 * N):\n heappush(l, A[i])\n res += A[i]\n res -= heappop(l)\n ls.append(res)\nA.reverse()\ns = []\nres = 0\nfor i in range(N):\n heappush(s, -A[i])\n res += A[i]\nss = []\nss.append(res)\nfor i in range(N, 2 * N):\n heappush(s, -A[i])\n res += A[i]\n res -= -heappop(s)\n ss.append(res)\nss.reverse()\nans = -inf\nfor i in range(N + 1):\n score = ls[i] - ss[i]\n ans = max(ans, score)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-# sum_max[k] : [0,k)\u306e\u3046\u3061N\u500b\u307e\u3067\u306e\u7dcf\u548c\u306e\u6700\u5927\u5024","-# sum_min[k] : (3N-1-k,3N-1]\u306e\u3046\u3061N\u500b\u307e\u3067\u306e\u7dcf\u548c\u306e\u6700\u5c0f\u5024","-sum_max = [0] * (3 * N + 1)","-sum_min = [0] * (3 * N + 1)","-","-","-def init_max():","- res = 0","- hq = []","- for i, a in enumerate(A):","- if len(hq) < N:","- heappush(hq, a)","- res += a","- else:","- if hq[0] < a:","- res -= heappop(hq)","- heappush(hq, a)","- res += a","- sum_max[i + 1] = res","-","-","-def init_min():","- res = 0","- hq = []","- for i, a in enumerate(A[::-1]):","- if len(hq) < N:","- heappush(hq, -a)","- res += a","- else:","- if -hq[0] > a:","- res -= -heappop(hq)","- heappush(hq, -a)","- res += a","- sum_min[i + 1] = res","-","-","-init_max()","-init_min()","+l = []","+res = 0","+for i in range(N):","+ heappush(l, A[i])","+ res += A[i]","+ls = []","+ls.append(res)","+for i in range(N, 2 * N):","+ heappush(l, A[i])","+ res += A[i]","+ res -= heappop(l)","+ ls.append(res)","+A.reverse()","+s = []","+res = 0","+for i in range(N):","+ heappush(s, -A[i])","+ res += A[i]","+ss = []","+ss.append(res)","+for i in range(N, 2 * N):","+ heappush(s, -A[i])","+ res += A[i]","+ res -= -heappop(s)","+ ss.append(res)","+ss.reverse()","-for k in range(N, 2 * N + 1):","- res = sum_max[k] - sum_min[3 * N - k]","- ans = max(ans, res)","+for i in range(N + 1):","+ score = ls[i] - ss[i]","+ ans = max(ans, score)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0381510155,"measured_runtime_v1":0.037418819,"runtime_lift":1.0195676021,"key":["s125911017","s899319459"]} +{"user_id":"u021019433","problem_id":"p02887","language":"python","submission_id_v0":"s004909013","submission_id_v1":"s198206840","cpu_time_v0":34,"cpu_time_v1":29,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.71,"input":"from itertools import groupby\n\n\n\neval(input())\n\nprint((sum(map(bool, groupby(eval(input()))))))\n","target":"from itertools import groupby\n\n\n\neval(input())\n\nprint((sum(1 for _ in groupby(eval(input())))))\n","code_v0_loc":4,"code_v1_loc":4,"code_v0_num_chars":82,"code_v1_num_chars":82,"code_v0_no_empty_lines":"from itertools import groupby\n\neval(input())\nprint((sum(map(bool, groupby(eval(input()))))))\n","code_v1_no_empty_lines":"from itertools import groupby\n\neval(input())\nprint((sum(1 for _ in groupby(eval(input())))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((sum(map(bool, groupby(eval(input()))))))","+print((sum(1 for _ in groupby(eval(input())))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0469325216,"measured_runtime_v1":0.0445061324,"runtime_lift":1.0545180872,"key":["s004909013","s198206840"]} +{"user_id":"u685684561","problem_id":"p02695","language":"python","submission_id_v0":"s873513308","submission_id_v1":"s657384630","cpu_time_v0":365,"cpu_time_v1":328,"memory_v0":9184,"memory_v1":9148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.14,"input":"#\u5b9f\u9a13\n\n# -*- coding: utf-8 -*-\n\nn, m, q = list(map(int, input().split()))\n\ninteger_set = [list(map(int, input().split())) for _ in range(q)]\n\na = [1]\n\nscore = 0\n\n \n\n# \u6df1\u3055\u512a\u5148\u63a2\u7d22(Depth First Search)\n\ndef dfs(seq):\n\n if len(seq) == n:\n\n global score\n\n tmp_score = 0\n\n for a, b, c, d in integer_set:\n\n if seq[b-1] - seq[a-1] == c:\n\n tmp_score += d\n\n else:\n\n tmp_score += 0\n\n score = max(score, tmp_score)\n\n else:\n\n for i in range(seq[-1], m+1):\n\n tmp_seq = seq.copy()\n\n tmp_seq.append(i)\n\n dfs(tmp_seq)\n\n \n\ndfs(a)\n\nprint(score)","target":"N,M,Q=list(map(int,input().split()))\n\nR=[list(map(int,input().split())) for i in range(Q)]\n\nS=[1]*N#1\u304cN\u3053\u5165\u3063\u305f\u914d\u5217\u3000\n\n \n\ndef dfs(d):\n\n if d==N-1:\n\n t=0\n\n for a,b,c,d in R:\n\n if S[b-1]-S[a-1]==c:\n\n t+=d\n\n return t\n\n else:\n\n m=0\n\n for i in range(S[d],M+1):\n\n S[d+1]=i\n\n m=max(m,dfs(d+1))\n\n return m\n\n\n\nprint((dfs(0)))","code_v0_loc":26,"code_v1_loc":19,"code_v0_num_chars":638,"code_v1_num_chars":397,"code_v0_no_empty_lines":"# \u5b9f\u9a13\n# -*- coding: utf-8 -*-\nn, m, q = list(map(int, input().split()))\ninteger_set = [list(map(int, input().split())) for _ in range(q)]\na = [1]\nscore = 0\n# \u6df1\u3055\u512a\u5148\u63a2\u7d22(Depth First Search)\ndef dfs(seq):\n if len(seq) == n:\n global score\n tmp_score = 0\n for a, b, c, d in integer_set:\n if seq[b - 1] - seq[a - 1] == c:\n tmp_score += d\n else:\n tmp_score += 0\n score = max(score, tmp_score)\n else:\n for i in range(seq[-1], m + 1):\n tmp_seq = seq.copy()\n tmp_seq.append(i)\n dfs(tmp_seq)\n\n\ndfs(a)\nprint(score)\n","code_v1_no_empty_lines":"N, M, Q = list(map(int, input().split()))\nR = [list(map(int, input().split())) for i in range(Q)]\nS = [1] * N # 1\u304cN\u3053\u5165\u3063\u305f\u914d\u5217\n\n\ndef dfs(d):\n if d == N - 1:\n t = 0\n for a, b, c, d in R:\n if S[b - 1] - S[a - 1] == c:\n t += d\n return t\n else:\n m = 0\n for i in range(S[d], M + 1):\n S[d + 1] = i\n m = max(m, dfs(d + 1))\n return m\n\n\nprint((dfs(0)))\n","code_same":false,"relative_loc_diff_percent":26.9230769231,"diff":["-# \u5b9f\u9a13","-# -*- coding: utf-8 -*-","-n, m, q = list(map(int, input().split()))","-integer_set = [list(map(int, input().split())) for _ in range(q)]","-a = [1]","-score = 0","-# \u6df1\u3055\u512a\u5148\u63a2\u7d22(Depth First Search)","-def dfs(seq):","- if len(seq) == n:","- global score","- tmp_score = 0","- for a, b, c, d in integer_set:","- if seq[b - 1] - seq[a - 1] == c:","- tmp_score += d","- else:","- tmp_score += 0","- score = max(score, tmp_score)","- else:","- for i in range(seq[-1], m + 1):","- tmp_seq = seq.copy()","- tmp_seq.append(i)","- dfs(tmp_seq)","+N, M, Q = list(map(int, input().split()))","+R = [list(map(int, input().split())) for i in range(Q)]","+S = [1] * N # 1\u304cN\u3053\u5165\u3063\u305f\u914d\u5217","-dfs(a)","-print(score)","+def dfs(d):","+ if d == N - 1:","+ t = 0","+ for a, b, c, d in R:","+ if S[b - 1] - S[a - 1] == c:","+ t += d","+ return t","+ else:","+ m = 0","+ for i in range(S[d], M + 1):","+ S[d + 1] = i","+ m = max(m, dfs(d + 1))","+ return m","+","+","+print((dfs(0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0603011813,"measured_runtime_v1":0.0607633944,"runtime_lift":0.9923932319,"key":["s873513308","s657384630"]} +{"user_id":"u994988729","problem_id":"p03045","language":"python","submission_id_v0":"s469351307","submission_id_v1":"s400859117","cpu_time_v0":592,"cpu_time_v1":543,"memory_v0":13992,"memory_v1":23892,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.28,"input":"class UnionFind:\n\n def __init__(self, n):\n\n self.root = [i for i in range(n + 1)]\n\n self.rank = [0] * (n + 1)\n\n\n\n def find(self, x):\n\n if self.root[x] == x:\n\n return x\n\n else:\n\n self.root[x] = self.find(self.root[x])\n\n return self.root[x]\n\n\n\n def isSame(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if self.rank[x] < self.rank[y]:\n\n self.root[x] = y\n\n else:\n\n self.root[y] = x\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n\n\n\n\nn, m = list(map(int, input().split()))\n\nuf = UnionFind(n)\n\nfor _ in range(m):\n\n x, y, z = list(map(int, input().split()))\n\n uf.union(x, y)\n\n\n\nfor i in range(1, n + 1):\n\n uf.find(i)\n\n\n\nn_tree = set(uf.root)\n\nans = len(n_tree) - 1\n\nprint(ans)\n","target":"from collections import deque\n\n\n\nn, m = list(map(int, input().split()))\n\ngraph = [[] * n for _ in range(n)]\n\nfor _ in range(m):\n\n x, y, z = list(map(int, input().split()))\n\n x -= 1\n\n y -= 1\n\n z %= 2\n\n graph[x].append((y))\n\n graph[y].append((x))\n\n\n\nseen = [False] * n\n\nans = 0\n\nfor i in range(n):\n\n if not seen[i]:\n\n seen[i] = True\n\n node = deque(graph[i])\n\n while node:\n\n v = node.popleft()\n\n if seen[v]:\n\n continue\n\n seen[v] = True\n\n node.extend(graph[v])\n\n ans += 1\n\n\n\nprint(ans)\n","code_v0_loc":38,"code_v1_loc":27,"code_v0_num_chars":904,"code_v1_num_chars":578,"code_v0_no_empty_lines":"class UnionFind:\n def __init__(self, n):\n self.root = [i for i in range(n + 1)]\n self.rank = [0] * (n + 1)\n\n def find(self, x):\n if self.root[x] == x:\n return x\n else:\n self.root[x] = self.find(self.root[x])\n return self.root[x]\n\n def isSame(self, x, y):\n return self.find(x) == self.find(y)\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if self.rank[x] < self.rank[y]:\n self.root[x] = y\n else:\n self.root[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n\nn, m = list(map(int, input().split()))\nuf = UnionFind(n)\nfor _ in range(m):\n x, y, z = list(map(int, input().split()))\n uf.union(x, y)\nfor i in range(1, n + 1):\n uf.find(i)\nn_tree = set(uf.root)\nans = len(n_tree) - 1\nprint(ans)\n","code_v1_no_empty_lines":"from collections import deque\n\nn, m = list(map(int, input().split()))\ngraph = [[] * n for _ in range(n)]\nfor _ in range(m):\n x, y, z = list(map(int, input().split()))\n x -= 1\n y -= 1\n z %= 2\n graph[x].append((y))\n graph[y].append((x))\nseen = [False] * n\nans = 0\nfor i in range(n):\n if not seen[i]:\n seen[i] = True\n node = deque(graph[i])\n while node:\n v = node.popleft()\n if seen[v]:\n continue\n seen[v] = True\n node.extend(graph[v])\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":28.9473684211,"diff":["-class UnionFind:","- def __init__(self, n):","- self.root = [i for i in range(n + 1)]","- self.rank = [0] * (n + 1)","-","- def find(self, x):","- if self.root[x] == x:","- return x","- else:","- self.root[x] = self.find(self.root[x])","- return self.root[x]","-","- def isSame(self, x, y):","- return self.find(x) == self.find(y)","-","- def union(self, x, y):","- x = self.find(x)","- y = self.find(y)","- if self.rank[x] < self.rank[y]:","- self.root[x] = y","- else:","- self.root[y] = x","- if self.rank[x] == self.rank[y]:","- self.rank[x] += 1","-","+from collections import deque","-uf = UnionFind(n)","+graph = [[] * n for _ in range(n)]","- uf.union(x, y)","-for i in range(1, n + 1):","- uf.find(i)","-n_tree = set(uf.root)","-ans = len(n_tree) - 1","+ x -= 1","+ y -= 1","+ z %= 2","+ graph[x].append((y))","+ graph[y].append((x))","+seen = [False] * n","+ans = 0","+for i in range(n):","+ if not seen[i]:","+ seen[i] = True","+ node = deque(graph[i])","+ while node:","+ v = node.popleft()","+ if seen[v]:","+ continue","+ seen[v] = True","+ node.extend(graph[v])","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0460146878,"measured_runtime_v1":0.050084528,"runtime_lift":0.9187405699,"key":["s469351307","s400859117"]} +{"user_id":"u554133763","problem_id":"p02719","language":"python","submission_id_v0":"s505013870","submission_id_v1":"s049276183","cpu_time_v0":72,"cpu_time_v1":59,"memory_v0":61752,"memory_v1":61860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.06,"input":"n,k = list(map(int, input().split()))\n\nn = (n - (n\/\/k-1)*k) if n > k else n\n\nn_min = 0\n\nwhile n_min <= n:\n\n n_min = abs(n-k)\n\n if n_min >= n and n < k:\n\n print((min(n_min, n)))\n\n break\n\n n = n_min","target":"n,k = list(map(int, input().split()))\n\nn = n%k\n\nif abs(n-k) > n:\n\n print(n)\n\nelse:\n\n print((abs(n-k)))","code_v0_loc":9,"code_v1_loc":6,"code_v0_num_chars":211,"code_v1_num_chars":100,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nn = (n - (n \/\/ k - 1) * k) if n > k else n\nn_min = 0\nwhile n_min <= n:\n n_min = abs(n - k)\n if n_min >= n and n < k:\n print((min(n_min, n)))\n break\n n = n_min\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nn = n % k\nif abs(n - k) > n:\n print(n)\nelse:\n print((abs(n - k)))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-n = (n - (n \/\/ k - 1) * k) if n > k else n","-n_min = 0","-while n_min <= n:","- n_min = abs(n - k)","- if n_min >= n and n < k:","- print((min(n_min, n)))","- break","- n = n_min","+n = n % k","+if abs(n - k) > n:","+ print(n)","+else:","+ print((abs(n - k)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369313765,"measured_runtime_v1":0.0584332259,"runtime_lift":0.6320270001,"key":["s505013870","s049276183"]} +{"user_id":"u844789719","problem_id":"p03142","language":"python","submission_id_v0":"s731895445","submission_id_v1":"s819166146","cpu_time_v0":617,"cpu_time_v1":533,"memory_v0":54680,"memory_v1":86828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.61,"input":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\n\nN, M = [int(_) for _ in input().split()]\n\nAB = [[int(_) for _ in input().split()] for _ in range(N - 1 + M)]\n\n\n\nG = [set() for _ in range(N + 1)]\n\ncount = [0] * (N + 1)\n\nans = [0] * (N + 1)\n\nfor a, b in AB:\n\n G[a].add(b)\n\n count[b] += 1\n\nfor i in range(1, N):\n\n if count[i] == 0:\n\n root = collections.deque([i])\n\n break\n\nwhile root:\n\n p = root.popleft()\n\n for c in G[p]:\n\n count[c] -= 1\n\n if count[c] == 0:\n\n ans[c] = p\n\n root.append(c)\n\nprint(*ans[1:], sep='\\n')\n","target":"import collections\n\nN, M, *AB = [int(_) for _ in open(0).read().split()]\n\nparent_children = collections.defaultdict(set)\n\nchild_parents = collections.defaultdict(set)\n\nfor a, b in zip(AB[::2], AB[1::2]):\n\n parent_children[a].add(b)\n\n child_parents[b].add(a)\n\nroot = (set(range(1, N + 1)) - set(child_parents.keys())).pop()\n\n\n\n\n\ndef bfs(root):\n\n Q = collections.deque([root])\n\n while Q:\n\n cur = Q.pop()\n\n for to in parent_children[cur]:\n\n if len(child_parents[to]) > 1:\n\n child_parents[to].remove(cur)\n\n else:\n\n Q += [to]\n\n\n\n\n\nbfs(root)\n\nchild_parents[root] = {0}\n\nfor i in range(1, N + 1):\n\n print((child_parents[i].pop()))\n","code_v0_loc":22,"code_v1_loc":25,"code_v0_num_chars":647,"code_v1_num_chars":703,"code_v0_no_empty_lines":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools\n\nN, M = [int(_) for _ in input().split()]\nAB = [[int(_) for _ in input().split()] for _ in range(N - 1 + M)]\nG = [set() for _ in range(N + 1)]\ncount = [0] * (N + 1)\nans = [0] * (N + 1)\nfor a, b in AB:\n G[a].add(b)\n count[b] += 1\nfor i in range(1, N):\n if count[i] == 0:\n root = collections.deque([i])\n break\nwhile root:\n p = root.popleft()\n for c in G[p]:\n count[c] -= 1\n if count[c] == 0:\n ans[c] = p\n root.append(c)\nprint(*ans[1:], sep=\"\\n\")\n","code_v1_no_empty_lines":"import collections\n\nN, M, *AB = [int(_) for _ in open(0).read().split()]\nparent_children = collections.defaultdict(set)\nchild_parents = collections.defaultdict(set)\nfor a, b in zip(AB[::2], AB[1::2]):\n parent_children[a].add(b)\n child_parents[b].add(a)\nroot = (set(range(1, N + 1)) - set(child_parents.keys())).pop()\n\n\ndef bfs(root):\n Q = collections.deque([root])\n while Q:\n cur = Q.pop()\n for to in parent_children[cur]:\n if len(child_parents[to]) > 1:\n child_parents[to].remove(cur)\n else:\n Q += [to]\n\n\nbfs(root)\nchild_parents[root] = {0}\nfor i in range(1, N + 1):\n print((child_parents[i].pop()))\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["-import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools","+import collections","-N, M = [int(_) for _ in input().split()]","-AB = [[int(_) for _ in input().split()] for _ in range(N - 1 + M)]","-G = [set() for _ in range(N + 1)]","-count = [0] * (N + 1)","-ans = [0] * (N + 1)","-for a, b in AB:","- G[a].add(b)","- count[b] += 1","-for i in range(1, N):","- if count[i] == 0:","- root = collections.deque([i])","- break","-while root:","- p = root.popleft()","- for c in G[p]:","- count[c] -= 1","- if count[c] == 0:","- ans[c] = p","- root.append(c)","-print(*ans[1:], sep=\"\\n\")","+N, M, *AB = [int(_) for _ in open(0).read().split()]","+parent_children = collections.defaultdict(set)","+child_parents = collections.defaultdict(set)","+for a, b in zip(AB[::2], AB[1::2]):","+ parent_children[a].add(b)","+ child_parents[b].add(a)","+root = (set(range(1, N + 1)) - set(child_parents.keys())).pop()","+","+","+def bfs(root):","+ Q = collections.deque([root])","+ while Q:","+ cur = Q.pop()","+ for to in parent_children[cur]:","+ if len(child_parents[to]) > 1:","+ child_parents[to].remove(cur)","+ else:","+ Q += [to]","+","+","+bfs(root)","+child_parents[root] = {0}","+for i in range(1, N + 1):","+ print((child_parents[i].pop()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0449047365,"measured_runtime_v1":0.1567764256,"runtime_lift":0.2864253114,"key":["s731895445","s819166146"]} +{"user_id":"u260216890","problem_id":"p03503","language":"python","submission_id_v0":"s133961895","submission_id_v1":"s235247019","cpu_time_v0":132,"cpu_time_v1":91,"memory_v0":68552,"memory_v1":73916,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.06,"input":"n=int(eval(input()))\n\nf=[]\n\nfor i in range(n):\n\n tmp=0\n\n op=list(map(int,input().split()))\n\n for j in range(10):\n\n tmp+=op[j]<>k)%2:\n\n cnt+=1\n\n tmp+=p[j][cnt]\n\n ans=max(ans,tmp)\n\nprint(ans)","code_v0_loc":25,"code_v1_loc":25,"code_v0_num_chars":495,"code_v1_num_chars":490,"code_v0_no_empty_lines":"n = int(eval(input()))\nf = []\nfor i in range(n):\n tmp = 0\n op = list(map(int, input().split()))\n for j in range(10):\n tmp += op[j] << j\n f.append(tmp)\np = []\nfor i in range(n):\n p.append(list(map(int, input().split())))\nans = -(10**12)\nfor i in range(1, 1 << 10):\n tmp = 0\n for j in range(n):\n consist = list(bin(f[j] & i)[2:])\n cnt = 0\n for k in consist:\n if k == \"1\":\n cnt += 1\n tmp += p[j][cnt]\n ans = max(ans, tmp)\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nf = []\nfor i in range(n):\n tmp = 0\n op = list(map(int, input().split()))\n for j in range(10):\n tmp += op[j] << j\n f.append(tmp)\np = []\nfor i in range(n):\n p.append(list(map(int, input().split())))\nans = -(10**12)\nfor i in range(1, 1 << 10):\n tmp = 0\n for j in range(n):\n consist = f[j] & i\n cnt = 0\n for k in range(10):\n if (consist >> k) % 2:\n cnt += 1\n tmp += p[j][cnt]\n ans = max(ans, tmp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- consist = list(bin(f[j] & i)[2:])","+ consist = f[j] & i","- for k in consist:","- if k == \"1\":","+ for k in range(10):","+ if (consist >> k) % 2:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0744477289,"measured_runtime_v1":0.0387096002,"runtime_lift":1.9232368314,"key":["s133961895","s235247019"]} +{"user_id":"u968166680","problem_id":"p02814","language":"python","submission_id_v0":"s763838142","submission_id_v1":"s230126684","cpu_time_v0":505,"cpu_time_v1":42,"memory_v0":16804,"memory_v1":12068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.68,"input":"import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n\n\n\n\ndef lcm(a, b):\n\n return a * b \/\/ gcd(a, b)\n\n\n\n\n\ndef main():\n\n N, M = list(map(int, readline().split()))\n\n A = list(map(int, readline().split()))\n\n B = A.copy()\n\n\n\n while not any(b % 2 for b in B):\n\n B = [b \/\/ 2 for b in B]\n\n\n\n if not all(b % 2 for b in B):\n\n print((0))\n\n return\n\n\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a \/\/ 2)\n\n\n\n print(((M \/\/ semi_lcm + 1) \/\/ 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\n\n\nread = sys.stdin.read\n\nreadline = sys.stdin.readline\n\nreadlines = sys.stdin.readlines\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 1 << 60\n\n\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a % b\n\n return a\n\n\n\n\n\ndef lcm(a, b):\n\n return a * b \/\/ gcd(a, b)\n\n\n\n\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n A = list(set(map(int, input().split(\" \"))))\n\n B = A.copy()\n\n\n\n while not any(b % 2 for b in B):\n\n B = [b \/\/ 2 for b in B]\n\n\n\n if not all(b % 2 for b in B):\n\n print((0))\n\n return\n\n\n\n semi_lcm = 1\n\n for a in A:\n\n semi_lcm = lcm(semi_lcm, a \/\/ 2)\n\n\n\n print(((M \/\/ semi_lcm + 1) \/\/ 2))\n\n return\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":41,"code_v1_loc":41,"code_v0_num_chars":709,"code_v1_num_chars":711,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return a * b \/\/ gcd(a, b)\n\n\ndef main():\n N, M = list(map(int, readline().split()))\n A = list(map(int, readline().split()))\n B = A.copy()\n while not any(b % 2 for b in B):\n B = [b \/\/ 2 for b in B]\n if not all(b % 2 for b in B):\n print((0))\n return\n semi_lcm = 1\n for a in A:\n semi_lcm = lcm(semi_lcm, a \/\/ 2)\n print(((M \/\/ semi_lcm + 1) \/\/ 2))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10**9)\nINF = 1 << 60\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return a * b \/\/ gcd(a, b)\n\n\ndef main():\n N, M = list(map(int, input().split()))\n A = list(set(map(int, input().split(\" \"))))\n B = A.copy()\n while not any(b % 2 for b in B):\n B = [b \/\/ 2 for b in B]\n if not all(b % 2 for b in B):\n print((0))\n return\n semi_lcm = 1\n for a in A:\n semi_lcm = lcm(semi_lcm, a \/\/ 2)\n print(((M \/\/ semi_lcm + 1) \/\/ 2))\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- N, M = list(map(int, readline().split()))","- A = list(map(int, readline().split()))","+ N, M = list(map(int, input().split()))","+ A = list(set(map(int, input().split(\" \"))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0603445919,"measured_runtime_v1":0.0390047536,"runtime_lift":1.5471086544,"key":["s763838142","s230126684"]} +{"user_id":"u137226361","problem_id":"p02756","language":"python","submission_id_v0":"s222038357","submission_id_v1":"s081475572","cpu_time_v0":383,"cpu_time_v1":200,"memory_v0":12188,"memory_v1":12072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.78,"input":"def main():\n\n s = eval(input())\n\n q =int(eval(input()))\n\n ten = 0\n\n r = []\n\n l = []\n\n for _ in range(q):\n\n ls = tuple(map(str, input().split()))\n\n if len(ls)==1:\n\n ten +=1\n\n else:\n\n if ls[1] =='1':\n\n if ten%2 ==0:\n\n l.append(ls[2])\n\n else:\n\n r.append(ls[2])\n\n else:\n\n if ten%2 ==1:\n\n l.append(ls[2])\n\n else:\n\n r.append(ls[2])\n\n s = ''.join(reversed(l))+s+''.join(r)\n\n if ten%2 ==1:\n\n s = s[::-1]\n\n print(s)\n\nif __name__ == '__main__':\n\n main()","target":"def main():\n\n import sys\n\n s = eval(input())\n\n q =int(eval(input()))\n\n ten = 0\n\n r = []\n\n l = []\n\n for _ in range(q):\n\n ls = tuple(map(str, sys.stdin.readline().split()))\n\n if len(ls)==1:\n\n ten +=1\n\n else:\n\n if ls[1] =='1':\n\n if ten%2 ==0:\n\n l.append(ls[2])\n\n else:\n\n r.append(ls[2])\n\n else:\n\n if ten%2 ==1:\n\n l.append(ls[2])\n\n else:\n\n r.append(ls[2])\n\n s = ''.join(reversed(l))+s+''.join(r)\n\n if ten%2 ==1:\n\n s = s[::-1]\n\n print(s)\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":27,"code_v1_loc":28,"code_v0_num_chars":658,"code_v1_num_chars":687,"code_v0_no_empty_lines":"def main():\n s = eval(input())\n q = int(eval(input()))\n ten = 0\n r = []\n l = []\n for _ in range(q):\n ls = tuple(map(str, input().split()))\n if len(ls) == 1:\n ten += 1\n else:\n if ls[1] == \"1\":\n if ten % 2 == 0:\n l.append(ls[2])\n else:\n r.append(ls[2])\n else:\n if ten % 2 == 1:\n l.append(ls[2])\n else:\n r.append(ls[2])\n s = \"\".join(reversed(l)) + s + \"\".join(r)\n if ten % 2 == 1:\n s = s[::-1]\n print(s)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n import sys\n\n s = eval(input())\n q = int(eval(input()))\n ten = 0\n r = []\n l = []\n for _ in range(q):\n ls = tuple(map(str, sys.stdin.readline().split()))\n if len(ls) == 1:\n ten += 1\n else:\n if ls[1] == \"1\":\n if ten % 2 == 0:\n l.append(ls[2])\n else:\n r.append(ls[2])\n else:\n if ten % 2 == 1:\n l.append(ls[2])\n else:\n r.append(ls[2])\n s = \"\".join(reversed(l)) + s + \"\".join(r)\n if ten % 2 == 1:\n s = s[::-1]\n print(s)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.5714285714,"diff":["+ import sys","+","- ls = tuple(map(str, input().split()))","+ ls = tuple(map(str, sys.stdin.readline().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.045359863,"measured_runtime_v1":0.0470550599,"runtime_lift":0.9639741851,"key":["s222038357","s081475572"]} +{"user_id":"u761529120","problem_id":"p03806","language":"python","submission_id_v0":"s233764344","submission_id_v1":"s432789473","cpu_time_v0":1500,"cpu_time_v1":986,"memory_v0":59500,"memory_v1":59472,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.27,"input":"N , Ma, Mb = list(map(int, input().split()))\n\n\n\n# \u5165\u529b\u5024\u306e\u53d7\u3051\u53d6\u308a\u65b9\u3092\u5909\u3048\u308b\n\n\n\narr=[list(map(int,input().split())) for _ in range(N)]\n\n\n\n#a = [0] * N\n\n#b = [0] * N\n\n#c = [0] * N\n\n\n\n#for i in range(N):\n\n# a[i], b[i], c[i] = map(int, input().split())\n\n\n\n\n\n\n\n# TLE\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u305f\u3081inf\u30925000\u3068\u304b\u3067\u8a2d\u5b9a\u3059\u308b\n\nINF = 5000\n\n# \u3055\u3089\u306b\u8a08\u7b97\u91cf\u3092\u843d\u3068\u3059\u305f\u308110 * N + 1\u306a\u3069\u3092\u5b9a\u6570\u3067\u8a2d\u5b9a\u3059\u308b \u2192\u3000\u95a2\u4fc2\u306a\u304b\u3063\u305f\u305f\u3081\u623b\u3059\n\n\n\n# \u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\u554f\u984c\u306a\u306e\u3067inf\u3067\u521d\u671f\u5316\n\n# dp[i][sun_a][sum_b]\u3067\u8003\u3048\u3066\u3044\u304f\n\ndp = [[[INF] * (10 * N + 1) for _ in range(10 * N + 1)] for _ in range(N+1)]\n\n\n\n# \u521d\u671f\u9078\u629e\u72b6\u614b\u30920\u3068\u3059\u308b\n\n\n\ndp[0][0][0] = 0\n\nfor i in range(N):\n\n a,b,c=arr[i]\n\n for j in range(10*N+1):\n\n for k in range(10*N+1):\n\n if dp[i][j][k] == INF:\n\n continue\n\n \n\n # \u9078\u3070\u306a\u304b\u3063\u305f\u5834\u5408\n\n dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])\n\n # \u9078\u3093\u3060\u5834\u5408\n\n dp[i+1][j+a][k+b] = min(dp[i+1][j+a][k+b], dp[i][j][k] + c)\n\n\n\n\n\nans = INF\n\n# 0\u30b9\u30bf\u30fc\u30c8\u306f\u4f55\u3092\u9078\u3093\u3067\u3044\u306a\u3044\u72b6\u614b\u3068\u306a\u308a\u6700\u5c0f\u5024\u304c0\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u305f\u30811\u304b\u3089\u958b\u59cb\u3059\u308b\n\n\n\n# TLE\u306b\u306a\u3063\u305f\u305f\u3081\u5909\u66f4\n\n#for i in range(1,10 * N + 1):\n\n# for j in range(1,10 * N + 1):\n\n# if i * Mb != j * Ma:\n\n# continue\n\n# ans = min(ans, dp[N][i][j])\n\n#\n\n\n\nfor i in range(1, 10*N+1):\n\n if i*Ma>10*N or i*Mb>10*N:\n\n break\n\n ans = min(ans, dp[N][i*Ma][i*Mb])\n\n\n\nif ans == INF:\n\n print((-1))\n\nelse:\n\n print(ans)","target":"def calc():\n\n n,ma,mb=list(map(int,input().split()))\n\n dp=[[[5000]*401 for _ in range(401)] for _ in range(41)]\n\n arr=[list(map(int,input().split())) for _ in range(n)]\n\n dp[0][0][0]=0\n\n for t in range(n):\n\n a,b,c=arr[t]\n\n for i in range(401):\n\n for j in range(401):\n\n if dp[t][i][j]==5000:\n\n continue\n\n dp[t+1][i][j]=min(dp[t+1][i][j],dp[t][i][j])\n\n dp[t+1][i+a][j+b]=min(dp[t+1][i+a][j+b],dp[t][i][j]+c)\n\n ans=5000\n\n for i in range(1,401):\n\n if i*ma>400 or i*mb>400:\n\n break\n\n ans=min(ans,dp[n][i*ma][i*mb])\n\n if ans==5000:\n\n print((-1))\n\n else:\n\n print(ans)\n\n \n\ncalc()","code_v0_loc":59,"code_v1_loc":24,"code_v0_num_chars":1277,"code_v1_num_chars":633,"code_v0_no_empty_lines":"N, Ma, Mb = list(map(int, input().split()))\n# \u5165\u529b\u5024\u306e\u53d7\u3051\u53d6\u308a\u65b9\u3092\u5909\u3048\u308b\narr = [list(map(int, input().split())) for _ in range(N)]\n# a = [0] * N\n# b = [0] * N\n# c = [0] * N\n# for i in range(N):\n# a[i], b[i], c[i] = map(int, input().split())\n# TLE\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u305f\u3081inf\u30925000\u3068\u304b\u3067\u8a2d\u5b9a\u3059\u308b\nINF = 5000\n# \u3055\u3089\u306b\u8a08\u7b97\u91cf\u3092\u843d\u3068\u3059\u305f\u308110 * N + 1\u306a\u3069\u3092\u5b9a\u6570\u3067\u8a2d\u5b9a\u3059\u308b \u2192\u3000\u95a2\u4fc2\u306a\u304b\u3063\u305f\u305f\u3081\u623b\u3059\n# \u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\u554f\u984c\u306a\u306e\u3067inf\u3067\u521d\u671f\u5316\n# dp[i][sun_a][sum_b]\u3067\u8003\u3048\u3066\u3044\u304f\ndp = [[[INF] * (10 * N + 1) for _ in range(10 * N + 1)] for _ in range(N + 1)]\n# \u521d\u671f\u9078\u629e\u72b6\u614b\u30920\u3068\u3059\u308b\ndp[0][0][0] = 0\nfor i in range(N):\n a, b, c = arr[i]\n for j in range(10 * N + 1):\n for k in range(10 * N + 1):\n if dp[i][j][k] == INF:\n continue\n # \u9078\u3070\u306a\u304b\u3063\u305f\u5834\u5408\n dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k])\n # \u9078\u3093\u3060\u5834\u5408\n dp[i + 1][j + a][k + b] = min(dp[i + 1][j + a][k + b], dp[i][j][k] + c)\nans = INF\n# 0\u30b9\u30bf\u30fc\u30c8\u306f\u4f55\u3092\u9078\u3093\u3067\u3044\u306a\u3044\u72b6\u614b\u3068\u306a\u308a\u6700\u5c0f\u5024\u304c0\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u305f\u30811\u304b\u3089\u958b\u59cb\u3059\u308b\n# TLE\u306b\u306a\u3063\u305f\u305f\u3081\u5909\u66f4\n# for i in range(1,10 * N + 1):\n# for j in range(1,10 * N + 1):\n# if i * Mb != j * Ma:\n# continue\n# ans = min(ans, dp[N][i][j])\n#\nfor i in range(1, 10 * N + 1):\n if i * Ma > 10 * N or i * Mb > 10 * N:\n break\n ans = min(ans, dp[N][i * Ma][i * Mb])\nif ans == INF:\n print((-1))\nelse:\n print(ans)\n","code_v1_no_empty_lines":"def calc():\n n, ma, mb = list(map(int, input().split()))\n dp = [[[5000] * 401 for _ in range(401)] for _ in range(41)]\n arr = [list(map(int, input().split())) for _ in range(n)]\n dp[0][0][0] = 0\n for t in range(n):\n a, b, c = arr[t]\n for i in range(401):\n for j in range(401):\n if dp[t][i][j] == 5000:\n continue\n dp[t + 1][i][j] = min(dp[t + 1][i][j], dp[t][i][j])\n dp[t + 1][i + a][j + b] = min(dp[t + 1][i + a][j + b], dp[t][i][j] + c)\n ans = 5000\n for i in range(1, 401):\n if i * ma > 400 or i * mb > 400:\n break\n ans = min(ans, dp[n][i * ma][i * mb])\n if ans == 5000:\n print((-1))\n else:\n print(ans)\n\n\ncalc()\n","code_same":false,"relative_loc_diff_percent":59.3220338983,"diff":["-N, Ma, Mb = list(map(int, input().split()))","-# \u5165\u529b\u5024\u306e\u53d7\u3051\u53d6\u308a\u65b9\u3092\u5909\u3048\u308b","-arr = [list(map(int, input().split())) for _ in range(N)]","-# a = [0] * N","-# b = [0] * N","-# c = [0] * N","-# for i in range(N):","-# a[i], b[i], c[i] = map(int, input().split())","-# TLE\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u305f\u3081inf\u30925000\u3068\u304b\u3067\u8a2d\u5b9a\u3059\u308b","-INF = 5000","-# \u3055\u3089\u306b\u8a08\u7b97\u91cf\u3092\u843d\u3068\u3059\u305f\u308110 * N + 1\u306a\u3069\u3092\u5b9a\u6570\u3067\u8a2d\u5b9a\u3059\u308b \u2192\u3000\u95a2\u4fc2\u306a\u304b\u3063\u305f\u305f\u3081\u623b\u3059","-# \u6700\u5c0f\u5024\u3092\u6c42\u3081\u308b\u554f\u984c\u306a\u306e\u3067inf\u3067\u521d\u671f\u5316","-# dp[i][sun_a][sum_b]\u3067\u8003\u3048\u3066\u3044\u304f","-dp = [[[INF] * (10 * N + 1) for _ in range(10 * N + 1)] for _ in range(N + 1)]","-# \u521d\u671f\u9078\u629e\u72b6\u614b\u30920\u3068\u3059\u308b","-dp[0][0][0] = 0","-for i in range(N):","- a, b, c = arr[i]","- for j in range(10 * N + 1):","- for k in range(10 * N + 1):","- if dp[i][j][k] == INF:","- continue","- # \u9078\u3070\u306a\u304b\u3063\u305f\u5834\u5408","- dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k])","- # \u9078\u3093\u3060\u5834\u5408","- dp[i + 1][j + a][k + b] = min(dp[i + 1][j + a][k + b], dp[i][j][k] + c)","-ans = INF","-# 0\u30b9\u30bf\u30fc\u30c8\u306f\u4f55\u3092\u9078\u3093\u3067\u3044\u306a\u3044\u72b6\u614b\u3068\u306a\u308a\u6700\u5c0f\u5024\u304c0\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u305f\u30811\u304b\u3089\u958b\u59cb\u3059\u308b","-# TLE\u306b\u306a\u3063\u305f\u305f\u3081\u5909\u66f4","-# for i in range(1,10 * N + 1):","-# for j in range(1,10 * N + 1):","-# if i * Mb != j * Ma:","-# continue","-# ans = min(ans, dp[N][i][j])","-#","-for i in range(1, 10 * N + 1):","- if i * Ma > 10 * N or i * Mb > 10 * N:","- break","- ans = min(ans, dp[N][i * Ma][i * Mb])","-if ans == INF:","- print((-1))","-else:","- print(ans)","+def calc():","+ n, ma, mb = list(map(int, input().split()))","+ dp = [[[5000] * 401 for _ in range(401)] for _ in range(41)]","+ arr = [list(map(int, input().split())) for _ in range(n)]","+ dp[0][0][0] = 0","+ for t in range(n):","+ a, b, c = arr[t]","+ for i in range(401):","+ for j in range(401):","+ if dp[t][i][j] == 5000:","+ continue","+ dp[t + 1][i][j] = min(dp[t + 1][i][j], dp[t][i][j])","+ dp[t + 1][i + a][j + b] = min(dp[t + 1][i + a][j + b], dp[t][i][j] + c)","+ ans = 5000","+ for i in range(1, 401):","+ if i * ma > 400 or i * mb > 400:","+ break","+ ans = min(ans, dp[n][i * ma][i * mb])","+ if ans == 5000:","+ print((-1))","+ else:","+ print(ans)","+","+","+calc()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0712403878,"measured_runtime_v1":0.8502697937,"runtime_lift":0.083785627,"key":["s233764344","s432789473"]} +{"user_id":"u980753441","problem_id":"p03853","language":"python","submission_id_v0":"s472145258","submission_id_v1":"s288870720","cpu_time_v0":27,"cpu_time_v1":24,"memory_v0":9196,"memory_v1":9036,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.11,"input":"h, w = list(map(int, input().split()))\n\nc = []\n\nfor _ in range(h):\n\n s = eval(input())\n\n c.append(s)\n\n c.append(s)\n\nprint((\"\\n\".join(c)))","target":"h, w = list(map(int, input().split()))\n\nc = []\n\nfor i in range(h):\n\n s = eval(input())\n\n c.append(s)\n\n c.append(s)\n\nprint((\"\\n\".join(c)))\n","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":132,"code_v1_num_chars":133,"code_v0_no_empty_lines":"h, w = list(map(int, input().split()))\nc = []\nfor _ in range(h):\n s = eval(input())\n c.append(s)\n c.append(s)\nprint((\"\\n\".join(c)))\n","code_v1_no_empty_lines":"h, w = list(map(int, input().split()))\nc = []\nfor i in range(h):\n s = eval(input())\n c.append(s)\n c.append(s)\nprint((\"\\n\".join(c)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for _ in range(h):","+for i in range(h):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0362500925,"measured_runtime_v1":0.0367152236,"runtime_lift":0.9873313844,"key":["s472145258","s288870720"]} +{"user_id":"u065099501","problem_id":"p03713","language":"python","submission_id_v0":"s855955166","submission_id_v1":"s558193843","cpu_time_v0":417,"cpu_time_v1":337,"memory_v0":9156,"memory_v1":9256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.18,"input":"H, W = list(map(int, input().split()))\n\nans = float('inf')\n\nfor h in range(1,H):\n\n S = [h * W]\n\n w = W \/\/ 2\n\n S += [(H-h) * w]\n\n S += [(H-h) * (W-w)]\n\n ans = min(ans,max(S)-min(S))\n\n\n\nfor h in range(1,H):\n\n S = [h * W]\n\n hb = (H-h) \/\/ 2\n\n S += [hb * W]\n\n S += [(H-h-hb) * W]\n\n ans = min(ans,max(S)-min(S))\n\n\n\nfor w in range(1,W):\n\n S = [H * w]\n\n h = H \/\/ 2\n\n S += [h * (W-w)]\n\n S += [(H-h) * (W-w)]\n\n ans = min(ans,max(S)-min(S))\n\n\n\nfor w in range(1,W):\n\n S = [w * H]\n\n wb = (W-w) \/\/ 2\n\n S += [wb * H]\n\n S += [(W-w-wb) * H]\n\n ans = min(ans,max(S)-min(S))\n\n\n\nprint(ans)","target":"H, W = list(map(int, input().split()))\n\nS = H * W\n\nans = S\n\n\n\nfor h in range(1,H):\n\n s1 = h * W\n\n s2 = W \/\/ 2 * (H-h)\n\n s3 = S-s1-s2\n\n ans = min(ans,max(s1,s2,s3)-min(s1,s2,s3))\n\n\n\n s2 = (H-h) \/\/ 2 * W\n\n s3 = S-s1-s2\n\n ans = min(ans,max(s1,s2,s3)-min(s1,s2,s3))\n\n\n\nfor w in range(1,W):\n\n s1 = H * w\n\n s2 = H \/\/ 2 * (W-w)\n\n s3 = S-s1-s2\n\n ans = min(ans,max(s1,s2,s3)-min(s1,s2,s3))\n\n\n\n s2 = (W-w) \/\/ 2 * H\n\n s3 = S-s1-s2\n\n ans = min(ans,max(s1,s2,s3)-min(s1,s2,s3))\n\n\n\nprint(ans)","code_v0_loc":31,"code_v1_loc":25,"code_v0_num_chars":622,"code_v1_num_chars":514,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\nans = float(\"inf\")\nfor h in range(1, H):\n S = [h * W]\n w = W \/\/ 2\n S += [(H - h) * w]\n S += [(H - h) * (W - w)]\n ans = min(ans, max(S) - min(S))\nfor h in range(1, H):\n S = [h * W]\n hb = (H - h) \/\/ 2\n S += [hb * W]\n S += [(H - h - hb) * W]\n ans = min(ans, max(S) - min(S))\nfor w in range(1, W):\n S = [H * w]\n h = H \/\/ 2\n S += [h * (W - w)]\n S += [(H - h) * (W - w)]\n ans = min(ans, max(S) - min(S))\nfor w in range(1, W):\n S = [w * H]\n wb = (W - w) \/\/ 2\n S += [wb * H]\n S += [(W - w - wb) * H]\n ans = min(ans, max(S) - min(S))\nprint(ans)\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nS = H * W\nans = S\nfor h in range(1, H):\n s1 = h * W\n s2 = W \/\/ 2 * (H - h)\n s3 = S - s1 - s2\n ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))\n s2 = (H - h) \/\/ 2 * W\n s3 = S - s1 - s2\n ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))\nfor w in range(1, W):\n s1 = H * w\n s2 = H \/\/ 2 * (W - w)\n s3 = S - s1 - s2\n ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))\n s2 = (W - w) \/\/ 2 * H\n s3 = S - s1 - s2\n ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":19.3548387097,"diff":["-ans = float(\"inf\")","+S = H * W","+ans = S","- S = [h * W]","- w = W \/\/ 2","- S += [(H - h) * w]","- S += [(H - h) * (W - w)]","- ans = min(ans, max(S) - min(S))","-for h in range(1, H):","- S = [h * W]","- hb = (H - h) \/\/ 2","- S += [hb * W]","- S += [(H - h - hb) * W]","- ans = min(ans, max(S) - min(S))","+ s1 = h * W","+ s2 = W \/\/ 2 * (H - h)","+ s3 = S - s1 - s2","+ ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))","+ s2 = (H - h) \/\/ 2 * W","+ s3 = S - s1 - s2","+ ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))","- S = [H * w]","- h = H \/\/ 2","- S += [h * (W - w)]","- S += [(H - h) * (W - w)]","- ans = min(ans, max(S) - min(S))","-for w in range(1, W):","- S = [w * H]","- wb = (W - w) \/\/ 2","- S += [wb * H]","- S += [(W - w - wb) * H]","- ans = min(ans, max(S) - min(S))","+ s1 = H * w","+ s2 = H \/\/ 2 * (W - w)","+ s3 = S - s1 - s2","+ ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))","+ s2 = (W - w) \/\/ 2 * H","+ s3 = S - s1 - s2","+ ans = min(ans, max(s1, s2, s3) - min(s1, s2, s3))"],"diff_only_import_comment":false,"measured_runtime_v0":0.5311425606,"measured_runtime_v1":0.3794306378,"runtime_lift":1.3998409927,"key":["s855955166","s558193843"]} +{"user_id":"u408262366","problem_id":"p02553","language":"python","submission_id_v0":"s065002609","submission_id_v1":"s181757836","cpu_time_v0":129,"cpu_time_v1":118,"memory_v0":27148,"memory_v1":27136,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.53,"input":"import numpy as np\n\na, b, c, d = list(map(int, input().split()))\n\n\n\nhoge = []\n\nhoge.append(a*c)\n\nhoge.append(a*d)\n\nhoge.append(b*c)\n\nhoge.append(b*d)\n\n\n\nif max(hoge) < 0:\n\n if np.sign(a) != np.sign(b) or np.sign(c) != np.sign(d):\n\n print((0))\n\n else:\n\n print((max(hoge)))\n\nelse:\n\n print((max(hoge)))","target":"import numpy as np\n\na, b, c, d = list(map(int, input().split()))\n\n\n\nhoge = []\n\nhoge.append(a*c)\n\nhoge.append(a*d)\n\nhoge.append(b*c)\n\nhoge.append(b*d)\n\n\n\nprint((max(hoge)))","code_v0_loc":16,"code_v1_loc":10,"code_v0_num_chars":296,"code_v1_num_chars":163,"code_v0_no_empty_lines":"import numpy as np\n\na, b, c, d = list(map(int, input().split()))\nhoge = []\nhoge.append(a * c)\nhoge.append(a * d)\nhoge.append(b * c)\nhoge.append(b * d)\nif max(hoge) < 0:\n if np.sign(a) != np.sign(b) or np.sign(c) != np.sign(d):\n print((0))\n else:\n print((max(hoge)))\nelse:\n print((max(hoge)))\n","code_v1_no_empty_lines":"import numpy as np\n\na, b, c, d = list(map(int, input().split()))\nhoge = []\nhoge.append(a * c)\nhoge.append(a * d)\nhoge.append(b * c)\nhoge.append(b * d)\nprint((max(hoge)))\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-if max(hoge) < 0:","- if np.sign(a) != np.sign(b) or np.sign(c) != np.sign(d):","- print((0))","- else:","- print((max(hoge)))","-else:","- print((max(hoge)))","+print((max(hoge)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2083916514,"measured_runtime_v1":0.0401681323,"runtime_lift":5.1879845883,"key":["s065002609","s181757836"]} +{"user_id":"u836311327","problem_id":"p02683","language":"python","submission_id_v0":"s451986492","submission_id_v1":"s573651070","cpu_time_v0":152,"cpu_time_v1":134,"memory_v0":27484,"memory_v1":27612,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.84,"input":"import sys\n\nfrom itertools import combinations_with_replacement, product\n\nimport numpy as np\n\ndef input(): return sys.stdin.readline().rstrip()\n\n\n\ndef main():\n\n n, m, x = list(map(int, input().split()))\n\n data = np.zeros((n,m),int)\n\n clist = np.zeros(n, int)\n\n ans=10**10\n\n for i in range(n):\n\n ca = list(map(int, input().split()))\n\n clist[i]=ca[0]\n\n data[i]=np.array(ca[1:])\n\n for bit in list(product([0,1],repeat=n)):\n\n if all(np.dot(np.array(bit), data)>=x):\n\n ans=min(ans,np.dot(np.array(bit),clist.T))\n\n \n\n if ans==10**10:\n\n print((-1))\n\n else:\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","target":"import sys\n\nfrom itertools import combinations_with_replacement, product\n\nimport numpy as np\n\ndef input(): return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef main():\n\n n, m, x = list(map(int, input().split()))\n\n data = np.zeros((n,m+1),int)\n\n ans=10**10\n\n for i in range(n):\n\n data[i]=np.array(list(map(int, input().split())))\n\n for bit in list(product([0,1],repeat=n)):\n\n calc=np.dot(np.array(bit), data)\n\n if all(calc[1:]>=x):\n\n ans=min(ans,calc[0])\n\n \n\n if ans==10**10:\n\n print((-1))\n\n else:\n\n print(ans)\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":26,"code_v1_loc":27,"code_v0_num_chars":678,"code_v1_num_chars":612,"code_v0_no_empty_lines":"import sys\nfrom itertools import combinations_with_replacement, product\nimport numpy as np\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n n, m, x = list(map(int, input().split()))\n data = np.zeros((n, m), int)\n clist = np.zeros(n, int)\n ans = 10**10\n for i in range(n):\n ca = list(map(int, input().split()))\n clist[i] = ca[0]\n data[i] = np.array(ca[1:])\n for bit in list(product([0, 1], repeat=n)):\n if all(np.dot(np.array(bit), data) >= x):\n ans = min(ans, np.dot(np.array(bit), clist.T))\n if ans == 10**10:\n print((-1))\n else:\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nfrom itertools import combinations_with_replacement, product\nimport numpy as np\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n n, m, x = list(map(int, input().split()))\n data = np.zeros((n, m + 1), int)\n ans = 10**10\n for i in range(n):\n data[i] = np.array(list(map(int, input().split())))\n for bit in list(product([0, 1], repeat=n)):\n calc = np.dot(np.array(bit), data)\n if all(calc[1:] >= x):\n ans = min(ans, calc[0])\n if ans == 10**10:\n print((-1))\n else:\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":3.7037037037,"diff":["- data = np.zeros((n, m), int)","- clist = np.zeros(n, int)","+ data = np.zeros((n, m + 1), int)","- ca = list(map(int, input().split()))","- clist[i] = ca[0]","- data[i] = np.array(ca[1:])","+ data[i] = np.array(list(map(int, input().split())))","- if all(np.dot(np.array(bit), data) >= x):","- ans = min(ans, np.dot(np.array(bit), clist.T))","+ calc = np.dot(np.array(bit), data)","+ if all(calc[1:] >= x):","+ ans = min(ans, calc[0])"],"diff_only_import_comment":false,"measured_runtime_v0":0.3055933352,"measured_runtime_v1":0.3215595505,"runtime_lift":0.9503475628,"key":["s451986492","s573651070"]} +{"user_id":"u782001565","problem_id":"p02658","language":"python","submission_id_v0":"s475674360","submission_id_v1":"s019316093","cpu_time_v0":59,"cpu_time_v1":54,"memory_v0":21640,"memory_v1":21636,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.47,"input":"N = int(input())\n\nA = list(map(int, input().split()))\n\n\n\n\n\ndef ans():\n\n if 0 in A:\n\n return print(0)\n\n product = 1\n\n for num in A:\n\n product = product * num\n\n if product > 10 ** 18:\n\n return print(-1)\n\n\n\n print(product)\n\n\n\n\n\nans()\n","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nif 0 in A:\n\n print((0))\n\n exit()\n\nproduct = 1\n\nfor num in A:\n\n product = product * num\n\n if product > 10 ** 18:\n\n print((-1))\n\n exit()\n\n\n\nprint(product)","code_v0_loc":17,"code_v1_loc":14,"code_v0_num_chars":274,"code_v1_num_chars":231,"code_v0_no_empty_lines":"N = int(input())\nA = list(map(int, input().split()))\n\n\ndef ans():\n if 0 in A:\n return print(0)\n product = 1\n for num in A:\n product = product * num\n if product > 10**18:\n return print(-1)\n print(product)\n\n\nans()\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nif 0 in A:\n print((0))\n exit()\nproduct = 1\nfor num in A:\n product = product * num\n if product > 10**18:\n print((-1))\n exit()\nprint(product)\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["-N = int(input())","+N = int(eval(input()))","-","-","-def ans():","- if 0 in A:","- return print(0)","- product = 1","- for num in A:","- product = product * num","- if product > 10**18:","- return print(-1)","- print(product)","-","-","-ans()","+if 0 in A:","+ print((0))","+ exit()","+product = 1","+for num in A:","+ product = product * num","+ if product > 10**18:","+ print((-1))","+ exit()","+print(product)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0483317604,"measured_runtime_v1":0.0481834493,"runtime_lift":1.0030780513,"key":["s475674360","s019316093"]} +{"user_id":"u250583425","problem_id":"p02733","language":"python","submission_id_v0":"s698753735","submission_id_v1":"s077003787","cpu_time_v0":1829,"cpu_time_v1":1079,"memory_v0":48856,"memory_v1":43100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.01,"input":"import sys\n\nfrom collections import defaultdict\n\ndef input(): return sys.stdin.readline().rstrip()\n\n\n\ndef main():\n\n H, W, K = list(map(int, input().split()))\n\n S = [eval(input()) for _ in range(H)]\n\n\n\n ans = 10 ** 9\n\n\n\n for bit in range(1 << (H-1)):\n\n canSolve = True\n\n ord = defaultdict(int)\n\n N = 0\n\n for i in range(H):\n\n if bit & 1 << i:\n\n ord[i+1] = ord[i] + 1\n\n N += 1\n\n else:\n\n ord[i+1] = ord[i]\n\n nums = defaultdict(int)\n\n for w in range(W):\n\n one = defaultdict(int)\n\n overK = False\n\n for h in range(H):\n\n one[ord[h]] += int(S[h][w])\n\n nums[ord[h]] += int(S[h][w])\n\n if one[ord[h]] > K:\n\n canSolve = False\n\n if nums[ord[h]] > K:\n\n overK = True\n\n if not canSolve:\n\n break\n\n if overK:\n\n N += 1\n\n nums = one\n\n if canSolve and ans > N:\n\n ans = N\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\ndef input(): return sys.stdin.readline().rstrip()\n\n\n\ndef main():\n\n H, W, K = list(map(int, input().split()))\n\n S = [eval(input()) for _ in range(H)]\n\n\n\n ans = 10 ** 9\n\n\n\n for bit in range(1 << (H-1)):\n\n canSolve = True\n\n ord = [0] * (H + 1)\n\n N = 0\n\n for i in range(H):\n\n if bit & 1 << i:\n\n ord[i+1] = ord[i] + 1\n\n N += 1\n\n else:\n\n ord[i+1] = ord[i]\n\n nums = [0] * (H + 1)\n\n for w in range(W):\n\n one = [0] * (H + 1)\n\n overK = False\n\n for h in range(H):\n\n one[ord[h]] += int(S[h][w])\n\n nums[ord[h]] += int(S[h][w])\n\n if one[ord[h]] > K:\n\n canSolve = False\n\n if nums[ord[h]] > K:\n\n overK = True\n\n if not canSolve:\n\n break\n\n if overK:\n\n N += 1\n\n nums = one\n\n if canSolve and ans > N:\n\n ans = N\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":42,"code_v1_loc":41,"code_v0_num_chars":1132,"code_v1_num_chars":1086,"code_v0_no_empty_lines":"import sys\nfrom collections import defaultdict\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n H, W, K = list(map(int, input().split()))\n S = [eval(input()) for _ in range(H)]\n ans = 10**9\n for bit in range(1 << (H - 1)):\n canSolve = True\n ord = defaultdict(int)\n N = 0\n for i in range(H):\n if bit & 1 << i:\n ord[i + 1] = ord[i] + 1\n N += 1\n else:\n ord[i + 1] = ord[i]\n nums = defaultdict(int)\n for w in range(W):\n one = defaultdict(int)\n overK = False\n for h in range(H):\n one[ord[h]] += int(S[h][w])\n nums[ord[h]] += int(S[h][w])\n if one[ord[h]] > K:\n canSolve = False\n if nums[ord[h]] > K:\n overK = True\n if not canSolve:\n break\n if overK:\n N += 1\n nums = one\n if canSolve and ans > N:\n ans = N\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef main():\n H, W, K = list(map(int, input().split()))\n S = [eval(input()) for _ in range(H)]\n ans = 10**9\n for bit in range(1 << (H - 1)):\n canSolve = True\n ord = [0] * (H + 1)\n N = 0\n for i in range(H):\n if bit & 1 << i:\n ord[i + 1] = ord[i] + 1\n N += 1\n else:\n ord[i + 1] = ord[i]\n nums = [0] * (H + 1)\n for w in range(W):\n one = [0] * (H + 1)\n overK = False\n for h in range(H):\n one[ord[h]] += int(S[h][w])\n nums[ord[h]] += int(S[h][w])\n if one[ord[h]] > K:\n canSolve = False\n if nums[ord[h]] > K:\n overK = True\n if not canSolve:\n break\n if overK:\n N += 1\n nums = one\n if canSolve and ans > N:\n ans = N\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.380952381,"diff":["-from collections import defaultdict","- ord = defaultdict(int)","+ ord = [0] * (H + 1)","- nums = defaultdict(int)","+ nums = [0] * (H + 1)","- one = defaultdict(int)","+ one = [0] * (H + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0420848489,"measured_runtime_v1":0.0796421752,"runtime_lift":0.5284241518,"key":["s698753735","s077003787"]} +{"user_id":"u540761833","problem_id":"p03713","language":"python","submission_id_v0":"s234254795","submission_id_v1":"s323315240","cpu_time_v0":413,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.88,"input":"H,W = list(map(int,input().split()))\n\n#l = sorted([int(input()) for i in range(N)],reverse=True)\n\ndef three(h,w):\n\n ans = h*w\n\n for i in range(1,h):\n\n A = w*i\n\n B = w*((h-i)\/\/2)\n\n C = w*((h-i+1)\/\/2)\n\n ans = min(ans,max(A,B,C)-min(A,B,C))\n\n return ans\n\ndef onetwo(h,w):\n\n ans = h*w\n\n for i in range(1,h):\n\n A = w*i\n\n B = (h-i)*(w\/\/2)\n\n C = (h-i)*((w+1)\/\/2)\n\n ans = min(ans,max(A,B,C)-min(A,B,C))\n\n return ans\n\nprint((min(three(H,W),three(W,H),onetwo(H,W),onetwo(W,H))))","target":"H,W = list(map(int,input().split()))\n\n#l = sorted([int(input()) for i in range(N)],reverse=True)\n\ndef three(h,w):\n\n ans = h*w\n\n for i in range(h\/\/3,h\/\/3+2):\n\n A = w*i\n\n B = w*((h-i)\/\/2)\n\n C = w*((h-i+1)\/\/2)\n\n ans = min(ans,max(A,B,C)-min(A,B,C))\n\n return ans\n\ndef onetwo(h,w):\n\n ans = h*w\n\n for i in range(h\/\/3,h\/\/3+2):\n\n A = w*i\n\n B = (h-i)*(w\/\/2)\n\n C = (h-i)*((w+1)\/\/2)\n\n ans = min(ans,max(A,B,C)-min(A,B,C))\n\n return ans\n\nprint((min(three(H,W),three(W,H),onetwo(H,W),onetwo(W,H))))","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":534,"code_v1_num_chars":550,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\n# l = sorted([int(input()) for i in range(N)],reverse=True)\ndef three(h, w):\n ans = h * w\n for i in range(1, h):\n A = w * i\n B = w * ((h - i) \/\/ 2)\n C = w * ((h - i + 1) \/\/ 2)\n ans = min(ans, max(A, B, C) - min(A, B, C))\n return ans\n\n\ndef onetwo(h, w):\n ans = h * w\n for i in range(1, h):\n A = w * i\n B = (h - i) * (w \/\/ 2)\n C = (h - i) * ((w + 1) \/\/ 2)\n ans = min(ans, max(A, B, C) - min(A, B, C))\n return ans\n\n\nprint((min(three(H, W), three(W, H), onetwo(H, W), onetwo(W, H))))\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\n# l = sorted([int(input()) for i in range(N)],reverse=True)\ndef three(h, w):\n ans = h * w\n for i in range(h \/\/ 3, h \/\/ 3 + 2):\n A = w * i\n B = w * ((h - i) \/\/ 2)\n C = w * ((h - i + 1) \/\/ 2)\n ans = min(ans, max(A, B, C) - min(A, B, C))\n return ans\n\n\ndef onetwo(h, w):\n ans = h * w\n for i in range(h \/\/ 3, h \/\/ 3 + 2):\n A = w * i\n B = (h - i) * (w \/\/ 2)\n C = (h - i) * ((w + 1) \/\/ 2)\n ans = min(ans, max(A, B, C) - min(A, B, C))\n return ans\n\n\nprint((min(three(H, W), three(W, H), onetwo(H, W), onetwo(W, H))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for i in range(1, h):","+ for i in range(h \/\/ 3, h \/\/ 3 + 2):","- for i in range(1, h):","+ for i in range(h \/\/ 3, h \/\/ 3 + 2):"],"diff_only_import_comment":false,"measured_runtime_v0":0.5206402724,"measured_runtime_v1":0.0380296803,"runtime_lift":13.6903667794,"key":["s234254795","s323315240"]} +{"user_id":"u121698457","problem_id":"p02996","language":"python","submission_id_v0":"s480401479","submission_id_v1":"s224316990","cpu_time_v0":1196,"cpu_time_v1":1004,"memory_v0":55384,"memory_v1":53720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.05,"input":"N = int(eval(input()))\n\nlis = []\n\nfor i in range(N):\n\n lis.append(list(map(int,input().split())))\n\nlis = sorted(lis, key = lambda x:x[1])\n\na = 0\n\nfor j in range(N):\n\n a += lis[j][0]\n\n if a > lis[j][1]:\n\n print('No')\n\n exit()\n\nprint('Yes')","target":"N = int(eval(input()))\n\nlis = []\n\nfor i in range(N):\n\n lis.append(list(map(int,input().split())))\n\nlis.sort(key = lambda x:x[1])\n\na = 0\n\nfor j in range(N):\n\n a += lis[j][0]\n\n if a > lis[j][1]:\n\n print('No')\n\n exit()\n\nprint('Yes')","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":255,"code_v1_num_chars":246,"code_v0_no_empty_lines":"N = int(eval(input()))\nlis = []\nfor i in range(N):\n lis.append(list(map(int, input().split())))\nlis = sorted(lis, key=lambda x: x[1])\na = 0\nfor j in range(N):\n a += lis[j][0]\n if a > lis[j][1]:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nlis = []\nfor i in range(N):\n lis.append(list(map(int, input().split())))\nlis.sort(key=lambda x: x[1])\na = 0\nfor j in range(N):\n a += lis[j][0]\n if a > lis[j][1]:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-lis = sorted(lis, key=lambda x: x[1])","+lis.sort(key=lambda x: x[1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0420378265,"measured_runtime_v1":0.0377238109,"runtime_lift":1.1143578952,"key":["s480401479","s224316990"]} +{"user_id":"u367130284","problem_id":"p03425","language":"python","submission_id_v0":"s331708601","submission_id_v1":"s315083962","cpu_time_v0":173,"cpu_time_v1":49,"memory_v0":3828,"memory_v1":11580,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":71.68,"input":"import itertools as i;d=[0]*91\n\nfor _ in[0]*int(eval(input())):d[ord(input()[0])]+=1\n\nprint((sum(d[p]*d[q]*d[r]for p,q,r in i.combinations(list(map(ord,'MARCH')),3))))","target":"import itertools as i,collections as c\n\nn,*a=open(0).read().split()\n\nb=c.Counter(s[0]for s in a if s[0]in\"MARCH\")\n\nprint((sum(p*q*r for p,q,r in i.combinations(list(b.values()),3))))","code_v0_loc":3,"code_v1_loc":4,"code_v0_num_chars":153,"code_v1_num_chars":174,"code_v0_no_empty_lines":"import itertools as i\n\nd = [0] * 91\nfor _ in [0] * int(eval(input())):\n d[ord(input()[0])] += 1\nprint(\n (sum(d[p] * d[q] * d[r] for p, q, r in i.combinations(list(map(ord, \"MARCH\")), 3)))\n)\n","code_v1_no_empty_lines":"import itertools as i, collections as c\n\nn, *a = open(0).read().split()\nb = c.Counter(s[0] for s in a if s[0] in \"MARCH\")\nprint((sum(p * q * r for p, q, r in i.combinations(list(b.values()), 3))))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import itertools as i","+import itertools as i, collections as c","-d = [0] * 91","-for _ in [0] * int(eval(input())):","- d[ord(input()[0])] += 1","-print(","- (sum(d[p] * d[q] * d[r] for p, q, r in i.combinations(list(map(ord, \"MARCH\")), 3)))","-)","+n, *a = open(0).read().split()","+b = c.Counter(s[0] for s in a if s[0] in \"MARCH\")","+print((sum(p * q * r for p, q, r in i.combinations(list(b.values()), 3))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0383187282,"measured_runtime_v1":0.036700701,"runtime_lift":1.0440870925,"key":["s331708601","s315083962"]} +{"user_id":"u797673668","problem_id":"p02243","language":"python","submission_id_v0":"s816893031","submission_id_v1":"s415378456","cpu_time_v0":1490,"cpu_time_v1":800,"memory_v0":121888,"memory_v1":122308,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.31,"input":"import heapq\n\n\n\nn = int(eval(input()))\n\nedges = [None] * n\n\nfor _ in range(n):\n\n l = list(map(int, input().split()))\n\n edges[l[0]] = set((c, j) for j, c in (l[i:i + 2] for i in range(2, l[1] * 2 + 2, 2)))\n\n\n\nmin_costs = [0] * n\n\nvisited = [False] * n\n\nvisited[0] = True\n\nqueue = list(edges[0])\n\nheapq.heapify(queue)\n\n\n\nwhile queue:\n\n total_cost, vertex = heapq.heappop(queue)\n\n if visited[vertex]:\n\n continue\n\n visited[vertex] = True\n\n min_costs[vertex] = total_cost\n\n for cost, vertex2 in edges[vertex]:\n\n if not visited[vertex2]:\n\n heapq.heappush(queue, (total_cost + cost, vertex2))\n\n\n\nfor r in enumerate(min_costs):\n\n print((*r))","target":"import heapq\n\n\n\nn = int(eval(input()))\n\nedges = [None] * n\n\nfor _ in range(n):\n\n l = list(map(int, input().split()))\n\n edges[l[0]] = set((c, j) for j, c in (l[i:i + 2] for i in range(2, l[1] * 2 + 2, 2)))\n\n\n\nmin_costs = [0] * n\n\nvisited = [False] * n\n\nvisited[0] = True\n\nqueue = list(edges[0])\n\nheapq.heapify(queue)\n\nremains = n - 1\n\n\n\nwhile True:\n\n total_cost, vertex = heapq.heappop(queue)\n\n if visited[vertex]:\n\n continue\n\n visited[vertex] = True\n\n min_costs[vertex] = total_cost\n\n remains -= 1\n\n if not remains:\n\n break\n\n for cost, vertex2 in edges[vertex]:\n\n if not visited[vertex2]:\n\n heapq.heappush(queue, (total_cost + cost, vertex2))\n\n\n\nfor r in enumerate(min_costs):\n\n print((*r))","code_v0_loc":26,"code_v1_loc":30,"code_v0_num_chars":674,"code_v1_num_chars":744,"code_v0_no_empty_lines":"import heapq\n\nn = int(eval(input()))\nedges = [None] * n\nfor _ in range(n):\n l = list(map(int, input().split()))\n edges[l[0]] = set(\n (c, j) for j, c in (l[i : i + 2] for i in range(2, l[1] * 2 + 2, 2))\n )\nmin_costs = [0] * n\nvisited = [False] * n\nvisited[0] = True\nqueue = list(edges[0])\nheapq.heapify(queue)\nwhile queue:\n total_cost, vertex = heapq.heappop(queue)\n if visited[vertex]:\n continue\n visited[vertex] = True\n min_costs[vertex] = total_cost\n for cost, vertex2 in edges[vertex]:\n if not visited[vertex2]:\n heapq.heappush(queue, (total_cost + cost, vertex2))\nfor r in enumerate(min_costs):\n print((*r))\n","code_v1_no_empty_lines":"import heapq\n\nn = int(eval(input()))\nedges = [None] * n\nfor _ in range(n):\n l = list(map(int, input().split()))\n edges[l[0]] = set(\n (c, j) for j, c in (l[i : i + 2] for i in range(2, l[1] * 2 + 2, 2))\n )\nmin_costs = [0] * n\nvisited = [False] * n\nvisited[0] = True\nqueue = list(edges[0])\nheapq.heapify(queue)\nremains = n - 1\nwhile True:\n total_cost, vertex = heapq.heappop(queue)\n if visited[vertex]:\n continue\n visited[vertex] = True\n min_costs[vertex] = total_cost\n remains -= 1\n if not remains:\n break\n for cost, vertex2 in edges[vertex]:\n if not visited[vertex2]:\n heapq.heappush(queue, (total_cost + cost, vertex2))\nfor r in enumerate(min_costs):\n print((*r))\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-while queue:","+remains = n - 1","+while True:","+ remains -= 1","+ if not remains:","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.0628131049,"measured_runtime_v1":0.0381145747,"runtime_lift":1.6480074983,"key":["s816893031","s415378456"]} +{"user_id":"u982591663","problem_id":"p02900","language":"python","submission_id_v0":"s285187390","submission_id_v1":"s871571236","cpu_time_v0":639,"cpu_time_v1":117,"memory_v0":5688,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.69,"input":"from fractions import gcd\n\ndef f(n):\n\n tmp = n\n\n cnt = 0\n\n i = 2\n\n while i <= n**0.5 + 1:\n\n if tmp < i:\n\n break\n\n if tmp % i == 0:\n\n cnt += 1\n\n while tmp % i == 0:\n\n tmp \/\/= i\n\n i += 1\n\n if tmp != 1:\n\n cnt += 1\n\n return cnt\n\n\n\nA, B = list(map(int, input().split()))\n\ng = gcd(A, B)\n\nans = f(g) + 1\n\nprint(ans)","target":"A, B = list(map(int, input().split()))\n\n# https:\/\/www.iandprogram.net\/entry\/2015\/03\/18\/003511\n\ndef gcd(x, y):\n\n if y == 0:\n\n return x\n\n else:\n\n return gcd(y, x%y)\n\n# https:\/\/qiita.com\/kageyasai2\/items\/48ef81f39b4e31c6d396\n\ndef factorize(n):\n\n factor = []\n\n for num in range(2, int(n**0.5+1)):\n\n while n % num == 0:\n\n n \/\/= num\n\n factor.append(num)\n\n if n != 1:\n\n factor.append(n)\n\n return set(factor)\n\n \n\ng = gcd(A, B)\n\nf = factorize(g)\n\nprint((len(f) + 1))","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":396,"code_v1_num_chars":520,"code_v0_no_empty_lines":"from fractions import gcd\n\n\ndef f(n):\n tmp = n\n cnt = 0\n i = 2\n while i <= n**0.5 + 1:\n if tmp < i:\n break\n if tmp % i == 0:\n cnt += 1\n while tmp % i == 0:\n tmp \/\/= i\n i += 1\n if tmp != 1:\n cnt += 1\n return cnt\n\n\nA, B = list(map(int, input().split()))\ng = gcd(A, B)\nans = f(g) + 1\nprint(ans)\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\n# https:\/\/www.iandprogram.net\/entry\/2015\/03\/18\/003511\ndef gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\n\n# https:\/\/qiita.com\/kageyasai2\/items\/48ef81f39b4e31c6d396\ndef factorize(n):\n factor = []\n for num in range(2, int(n**0.5 + 1)):\n while n % num == 0:\n n \/\/= num\n factor.append(num)\n if n != 1:\n factor.append(n)\n return set(factor)\n\n\ng = gcd(A, B)\nf = factorize(g)\nprint((len(f) + 1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-from fractions import gcd","+A, B = list(map(int, input().split()))","+# https:\/\/www.iandprogram.net\/entry\/2015\/03\/18\/003511","+def gcd(x, y):","+ if y == 0:","+ return x","+ else:","+ return gcd(y, x % y)","-def f(n):","- tmp = n","- cnt = 0","- i = 2","- while i <= n**0.5 + 1:","- if tmp < i:","- break","- if tmp % i == 0:","- cnt += 1","- while tmp % i == 0:","- tmp \/\/= i","- i += 1","- if tmp != 1:","- cnt += 1","- return cnt","+# https:\/\/qiita.com\/kageyasai2\/items\/48ef81f39b4e31c6d396","+def factorize(n):","+ factor = []","+ for num in range(2, int(n**0.5 + 1)):","+ while n % num == 0:","+ n \/\/= num","+ factor.append(num)","+ if n != 1:","+ factor.append(n)","+ return set(factor)","-A, B = list(map(int, input().split()))","-ans = f(g) + 1","-print(ans)","+f = factorize(g)","+print((len(f) + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.057505877,"measured_runtime_v1":0.0353397956,"runtime_lift":1.6272272106,"key":["s285187390","s871571236"]} +{"user_id":"u186838327","problem_id":"p02715","language":"python","submission_id_v0":"s034544092","submission_id_v1":"s086961760","cpu_time_v0":598,"cpu_time_v1":145,"memory_v0":11216,"memory_v1":69544,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.75,"input":"n, k = list(map(int, input().split()))\n\nmod = 10**9+7\n\n\n\ndef power(a, n, mod):\n\n bi=str(format(n,\"b\")) #2\u9032\u6570\n\n res=1\n\n for i in range(len(bi)):\n\n res=(res*res) %mod\n\n if bi[i]==\"1\":\n\n res=(res*a) %mod\n\n return res\n\n\n\nD = [0]*(k+1)\n\nans = 0\n\nfor i in reversed(list(range(1, k+1))):\n\n a = k\/\/i\n\n d = power(a, n, mod)\n\n j = 1\n\n while i*j <= k:\n\n d -= D[i*j]\n\n j += 1\n\n D[i] = d\n\n ans += (d*i)%mod\n\n\n\nprint((ans%mod))","target":"n, k = list(map(int, input().split()))\n\n\n\nmod = 10**9+7\n\n\n\ndef power(a, n, mod):\n\n bi=str(format(n,\"b\")) #2\u9032\u6570\n\n res=1\n\n for i in range(len(bi)):\n\n res=(res*res) %mod\n\n if bi[i]==\"1\":\n\n res=(res*a) %mod\n\n return res\n\n\n\n\n\nX = [0]*(k+1)\n\nans = 0\n\nfor i in reversed(list(range(1, k+1))):\n\n temp = power(k\/\/i, n, mod)\n\n j = i+i\n\n while j <= k:\n\n temp -= X[j]\n\n j += i\n\n X[i] = temp\n\n ans += (temp*i)%mod\n\nprint((ans%mod))\n","code_v0_loc":25,"code_v1_loc":25,"code_v0_num_chars":467,"code_v1_num_chars":447,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nmod = 10**9 + 7\n\n\ndef power(a, n, mod):\n bi = str(format(n, \"b\")) # 2\u9032\u6570\n res = 1\n for i in range(len(bi)):\n res = (res * res) % mod\n if bi[i] == \"1\":\n res = (res * a) % mod\n return res\n\n\nD = [0] * (k + 1)\nans = 0\nfor i in reversed(list(range(1, k + 1))):\n a = k \/\/ i\n d = power(a, n, mod)\n j = 1\n while i * j <= k:\n d -= D[i * j]\n j += 1\n D[i] = d\n ans += (d * i) % mod\nprint((ans % mod))\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nmod = 10**9 + 7\n\n\ndef power(a, n, mod):\n bi = str(format(n, \"b\")) # 2\u9032\u6570\n res = 1\n for i in range(len(bi)):\n res = (res * res) % mod\n if bi[i] == \"1\":\n res = (res * a) % mod\n return res\n\n\nX = [0] * (k + 1)\nans = 0\nfor i in reversed(list(range(1, k + 1))):\n temp = power(k \/\/ i, n, mod)\n j = i + i\n while j <= k:\n temp -= X[j]\n j += i\n X[i] = temp\n ans += (temp * i) % mod\nprint((ans % mod))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-D = [0] * (k + 1)","+X = [0] * (k + 1)","- a = k \/\/ i","- d = power(a, n, mod)","- j = 1","- while i * j <= k:","- d -= D[i * j]","- j += 1","- D[i] = d","- ans += (d * i) % mod","+ temp = power(k \/\/ i, n, mod)","+ j = i + i","+ while j <= k:","+ temp -= X[j]","+ j += i","+ X[i] = temp","+ ans += (temp * i) % mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.1448335476,"measured_runtime_v1":0.1253803043,"runtime_lift":1.1551539003,"key":["s034544092","s086961760"]} +{"user_id":"u642874916","problem_id":"p02787","language":"python","submission_id_v0":"s204653012","submission_id_v1":"s535774655","cpu_time_v0":535,"cpu_time_v1":384,"memory_v0":119916,"memory_v1":44008,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.22,"input":"from heapq import heappush, heappop, heapify\n\nfrom collections import deque, defaultdict, Counter\n\nimport itertools\n\nfrom itertools import permutations, combinations, accumulate\n\nimport sys\n\nimport bisect\n\nimport string\n\nimport math\n\nimport time\n\n\n\n\n\ndef I(): return int(input())\n\n\n\n\n\ndef MI(): return map(int, input().split())\n\n\n\n\n\ndef S(): return input()\n\n\n\n\n\ndef MS(): return map(str, input().split())\n\n\n\n\n\ndef LI(): return [int(i) for i in input().split()]\n\n\n\n\n\ndef LI_(): return [int(i)-1 for i in input().split()]\n\n\n\n\n\ndef StoI(): return [ord(i)-97 for i in input()]\n\n\n\n\n\ndef ItoS(nn): return chr(nn+97)\n\n\n\n\n\ndef input(): return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef show(*inp, end='\\n'):\n\n if show_flg:\n\n print(*inp, end=end)\n\n\n\n\n\nYN = {False: 'No', True: 'Yes'}\n\nMOD = 10**9+7\n\ninf = float('inf')\n\nIINF = 10**10\n\nl_alp = string.ascii_lowercase\n\nu_alp = string.ascii_uppercase\n\nts = time.time()\n\nsys.setrecursionlimit(10**6)\n\nnums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']\n\n\n\n\n\nshow_flg = True\n\nshow_flg = False\n\n\n\n\n\ndef main():\n\n H, N = MI()\n\n A = [0] * N\n\n B = [0] * N\n\n dp = [[IINF] * (H+2) for i in range(N+1)]\n\n dp[0][0] = 0\n\n\n\n for i in range(N):\n\n A[i], B[i] = MI()\n\n # AB[i] = (A \/ B, A, B)\n\n\n\n # print(dp)\n\n for i in range(N):\n\n for j in range(H+1):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n max_h = min(H, j+A[i])\n\n dp[i+1][max_h] = min(dp[i+1][max_h], dp[i+1][j] + B[i])\n\n print(dp[N][H])\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"from heapq import heappush, heappop, heapify\n\nfrom collections import deque, defaultdict, Counter\n\nimport itertools\n\nfrom itertools import permutations, combinations, accumulate\n\nimport sys\n\nimport bisect\n\nimport string\n\nimport math\n\nimport time\n\n\n\n\n\ndef I(): return int(input())\n\n\n\n\n\ndef MI(): return map(int, input().split())\n\n\n\n\n\ndef S(): return input()\n\n\n\n\n\ndef MS(): return map(str, input().split())\n\n\n\n\n\ndef LI(): return [int(i) for i in input().split()]\n\n\n\n\n\ndef LI_(): return [int(i)-1 for i in input().split()]\n\n\n\n\n\ndef StoI(): return [ord(i)-97 for i in input()]\n\n\n\n\n\ndef ItoS(nn): return chr(nn+97)\n\n\n\n\n\ndef input(): return sys.stdin.readline().rstrip()\n\n\n\n\n\ndef show(*inp, end='\\n'):\n\n if show_flg:\n\n print(*inp, end=end)\n\n\n\n\n\nYN = {False: 'No', True: 'Yes'}\n\nMOD = 10**9+7\n\ninf = float('inf')\n\nIINF = 10**10\n\nl_alp = string.ascii_lowercase\n\nu_alp = string.ascii_uppercase\n\nts = time.time()\n\nsys.setrecursionlimit(10**6)\n\nnums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']\n\n\n\n\n\nshow_flg = True\n\nshow_flg = False\n\n\n\n\n\ndef main():\n\n H, N = MI()\n\n A = [0] * N\n\n B = [0] * N\n\n dp = [IINF] * (H+1)\n\n dp[0] = 0\n\n\n\n for i in range(N):\n\n A[i], B[i] = MI()\n\n # AB[i] = (A \/ B, A, B)\n\n\n\n for i in range(N):\n\n dp_next = [IINF] * (H + 1)\n\n for j in range(H+1):\n\n dp_next[j] = min(dp[j], dp_next[j])\n\n if j + A[i] <= H:\n\n dp_next[j+A[i]] = min(dp_next[j+A[i]], dp_next[j] + B[i])\n\n else:\n\n # print(i, j, dp_next[j] + B[i], dp_next[j])\n\n dp_next[H] = min(dp_next[H], dp_next[j] + B[i])\n\n # print(dp_next[H])\n\n dp = dp_next\n\n # print(dp)\n\n\n\n print(dp[H])\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":80,"code_v1_loc":87,"code_v0_num_chars":1556,"code_v1_num_chars":1773,"code_v0_no_empty_lines":"from heapq import heappush, heappop, heapify\nfrom collections import deque, defaultdict, Counter\nimport itertools\nfrom itertools import permutations, combinations, accumulate\nimport sys\nimport bisect\nimport string\nimport math\nimport time\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return map(int, input().split())\n\n\ndef S():\n return input()\n\n\ndef MS():\n return map(str, input().split())\n\n\ndef LI():\n return [int(i) for i in input().split()]\n\n\ndef LI_():\n return [int(i) - 1 for i in input().split()]\n\n\ndef StoI():\n return [ord(i) - 97 for i in input()]\n\n\ndef ItoS(nn):\n return chr(nn + 97)\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef show(*inp, end=\"\\n\"):\n if show_flg:\n print(*inp, end=end)\n\n\nYN = {False: \"No\", True: \"Yes\"}\nMOD = 10**9 + 7\ninf = float(\"inf\")\nIINF = 10**10\nl_alp = string.ascii_lowercase\nu_alp = string.ascii_uppercase\nts = time.time()\nsys.setrecursionlimit(10**6)\nnums = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\"]\nshow_flg = True\nshow_flg = False\n\n\ndef main():\n H, N = MI()\n A = [0] * N\n B = [0] * N\n dp = [[IINF] * (H + 2) for i in range(N + 1)]\n dp[0][0] = 0\n for i in range(N):\n A[i], B[i] = MI()\n # AB[i] = (A \/ B, A, B)\n # print(dp)\n for i in range(N):\n for j in range(H + 1):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n max_h = min(H, j + A[i])\n dp[i + 1][max_h] = min(dp[i + 1][max_h], dp[i + 1][j] + B[i])\n print(dp[N][H])\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from heapq import heappush, heappop, heapify\nfrom collections import deque, defaultdict, Counter\nimport itertools\nfrom itertools import permutations, combinations, accumulate\nimport sys\nimport bisect\nimport string\nimport math\nimport time\n\n\ndef I():\n return int(input())\n\n\ndef MI():\n return map(int, input().split())\n\n\ndef S():\n return input()\n\n\ndef MS():\n return map(str, input().split())\n\n\ndef LI():\n return [int(i) for i in input().split()]\n\n\ndef LI_():\n return [int(i) - 1 for i in input().split()]\n\n\ndef StoI():\n return [ord(i) - 97 for i in input()]\n\n\ndef ItoS(nn):\n return chr(nn + 97)\n\n\ndef input():\n return sys.stdin.readline().rstrip()\n\n\ndef show(*inp, end=\"\\n\"):\n if show_flg:\n print(*inp, end=end)\n\n\nYN = {False: \"No\", True: \"Yes\"}\nMOD = 10**9 + 7\ninf = float(\"inf\")\nIINF = 10**10\nl_alp = string.ascii_lowercase\nu_alp = string.ascii_uppercase\nts = time.time()\nsys.setrecursionlimit(10**6)\nnums = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\"]\nshow_flg = True\nshow_flg = False\n\n\ndef main():\n H, N = MI()\n A = [0] * N\n B = [0] * N\n dp = [IINF] * (H + 1)\n dp[0] = 0\n for i in range(N):\n A[i], B[i] = MI()\n # AB[i] = (A \/ B, A, B)\n for i in range(N):\n dp_next = [IINF] * (H + 1)\n for j in range(H + 1):\n dp_next[j] = min(dp[j], dp_next[j])\n if j + A[i] <= H:\n dp_next[j + A[i]] = min(dp_next[j + A[i]], dp_next[j] + B[i])\n else:\n # print(i, j, dp_next[j] + B[i], dp_next[j])\n dp_next[H] = min(dp_next[H], dp_next[j] + B[i])\n # print(dp_next[H])\n dp = dp_next\n # print(dp)\n print(dp[H])\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":8.0459770115,"diff":["- dp = [[IINF] * (H + 2) for i in range(N + 1)]","- dp[0][0] = 0","+ dp = [IINF] * (H + 1)","+ dp[0] = 0","- # print(dp)","+ dp_next = [IINF] * (H + 1)","- dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])","- max_h = min(H, j + A[i])","- dp[i + 1][max_h] = min(dp[i + 1][max_h], dp[i + 1][j] + B[i])","- print(dp[N][H])","+ dp_next[j] = min(dp[j], dp_next[j])","+ if j + A[i] <= H:","+ dp_next[j + A[i]] = min(dp_next[j + A[i]], dp_next[j] + B[i])","+ else:","+ # print(i, j, dp_next[j] + B[i], dp_next[j])","+ dp_next[H] = min(dp_next[H], dp_next[j] + B[i])","+ # print(dp_next[H])","+ dp = dp_next","+ # print(dp)","+ print(dp[H])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0073936563,"measured_runtime_v1":0.095261487,"runtime_lift":0.0776143275,"key":["s204653012","s535774655"]} +{"user_id":"u097317219","problem_id":"p03044","language":"python","submission_id_v0":"s124484487","submission_id_v1":"s080081006","cpu_time_v0":823,"cpu_time_v1":624,"memory_v0":70816,"memory_v1":208876,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.18,"input":"n = int(eval(input()))\n\ng =[[] for _ in range(n)]\n\nfor i in range(n-1):\n\n u,v,w = list(map(int,input().split()))\n\n g[u-1].append((v-1,w))\n\n g[v-1].append((u-1,w))\n\ndistance = [-1]*n\n\ndistance[0] = 0\n\nq = [0]\n\nwhile q:\n\n p = q.pop()\n\n for a,b in g[p]:\n\n if distance[a] == -1:\n\n distance[a] = distance[p]+b\n\n q.append(a)\n\nfor i in range(n):\n\n print(((distance[i])%2))","target":"import sys\n\nimport copy\n\nsys.setrecursionlimit(10**7)\n\ndef dfs(graph,v,dist_mod):\n\n color[v] = dist_mod\n\n for next_v,dist in graph[v]:\n\n if color[next_v] != -1:\n\n continue\n\n dfs(graph,next_v,(dist_mod+dist)%2)\n\nn = int(eval(input()))\n\nuvw = [list(map(int,input().split())) for _ in range(n-1)]\n\ng = [[] for _ in range(n)]\n\ncolor = [-1]*n\n\nfor i in range(n-1):\n\n g[uvw[i][0]-1].append([uvw[i][1]-1,uvw[i][2]])\n\n g[uvw[i][1]-1].append([uvw[i][0]-1,uvw[i][2]])\n\ndfs(g,0,0)\n\nfor i in range(n):\n\n print((color[i]))","code_v0_loc":17,"code_v1_loc":19,"code_v0_num_chars":370,"code_v1_num_chars":541,"code_v0_no_empty_lines":"n = int(eval(input()))\ng = [[] for _ in range(n)]\nfor i in range(n - 1):\n u, v, w = list(map(int, input().split()))\n g[u - 1].append((v - 1, w))\n g[v - 1].append((u - 1, w))\ndistance = [-1] * n\ndistance[0] = 0\nq = [0]\nwhile q:\n p = q.pop()\n for a, b in g[p]:\n if distance[a] == -1:\n distance[a] = distance[p] + b\n q.append(a)\nfor i in range(n):\n print(((distance[i]) % 2))\n","code_v1_no_empty_lines":"import sys\nimport copy\n\nsys.setrecursionlimit(10**7)\n\n\ndef dfs(graph, v, dist_mod):\n color[v] = dist_mod\n for next_v, dist in graph[v]:\n if color[next_v] != -1:\n continue\n dfs(graph, next_v, (dist_mod + dist) % 2)\n\n\nn = int(eval(input()))\nuvw = [list(map(int, input().split())) for _ in range(n - 1)]\ng = [[] for _ in range(n)]\ncolor = [-1] * n\nfor i in range(n - 1):\n g[uvw[i][0] - 1].append([uvw[i][1] - 1, uvw[i][2]])\n g[uvw[i][1] - 1].append([uvw[i][0] - 1, uvw[i][2]])\ndfs(g, 0, 0)\nfor i in range(n):\n print((color[i]))\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["+import sys","+import copy","+","+sys.setrecursionlimit(10**7)","+","+","+def dfs(graph, v, dist_mod):","+ color[v] = dist_mod","+ for next_v, dist in graph[v]:","+ if color[next_v] != -1:","+ continue","+ dfs(graph, next_v, (dist_mod + dist) % 2)","+","+","+uvw = [list(map(int, input().split())) for _ in range(n - 1)]","+color = [-1] * n","- u, v, w = list(map(int, input().split()))","- g[u - 1].append((v - 1, w))","- g[v - 1].append((u - 1, w))","-distance = [-1] * n","-distance[0] = 0","-q = [0]","-while q:","- p = q.pop()","- for a, b in g[p]:","- if distance[a] == -1:","- distance[a] = distance[p] + b","- q.append(a)","+ g[uvw[i][0] - 1].append([uvw[i][1] - 1, uvw[i][2]])","+ g[uvw[i][1] - 1].append([uvw[i][0] - 1, uvw[i][2]])","+dfs(g, 0, 0)","- print(((distance[i]) % 2))","+ print((color[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.044736498,"measured_runtime_v1":0.0515033637,"runtime_lift":0.8686131302,"key":["s124484487","s080081006"]} +{"user_id":"u969190727","problem_id":"p02990","language":"python","submission_id_v0":"s925858282","submission_id_v1":"s215011695","cpu_time_v0":858,"cpu_time_v1":172,"memory_v0":3316,"memory_v1":19188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.95,"input":"import math\n\nmod=10**9+7\n\nn,k=list(map(int,input().split()))\n\ndef f(x):\n\n if x<0:\n\n return 1\n\n else:\n\n return math.factorial(x)\n\ndef c(x,y):\n\n if x 0:\n\n heapq.heappush(A, -(-heapq.heappop(A) \/\/ 2))\n\n M -= 1\n\n\n\nprint((-sum(A)))\n","target":"import heapq\n\ndef f(str):\n\n return -int(str)\n\n\n\nN, M = list(map(int, input().split()))\n\nA = list(map(f, input().split()))\n\nheapq.heapify(A)\n\n\n\nwhile M > 0:\n\n heapq.heappush(A, -(-heapq.heappop(A) \/\/ 2))\n\n M -= 1\n\n\n\nprint((-sum(A)))\n","code_v0_loc":11,"code_v1_loc":13,"code_v0_num_chars":230,"code_v1_num_chars":233,"code_v0_no_empty_lines":"import heapq\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nA = list([-x for x in A])\nheapq.heapify(A)\nwhile M > 0:\n heapq.heappush(A, -(-heapq.heappop(A) \/\/ 2))\n M -= 1\nprint((-sum(A)))\n","code_v1_no_empty_lines":"import heapq\n\n\ndef f(str):\n return -int(str)\n\n\nN, M = list(map(int, input().split()))\nA = list(map(f, input().split()))\nheapq.heapify(A)\nwhile M > 0:\n heapq.heappush(A, -(-heapq.heappop(A) \/\/ 2))\n M -= 1\nprint((-sum(A)))\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["+","+def f(str):","+ return -int(str)","+","+","-A = list(map(int, input().split()))","-A = list([-x for x in A])","+A = list(map(f, input().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370306633,"measured_runtime_v1":0.0475253103,"runtime_lift":0.7791777271,"key":["s476491972","s487606273"]} +{"user_id":"u746849814","problem_id":"p03339","language":"python","submission_id_v0":"s347002699","submission_id_v1":"s972875643","cpu_time_v0":286,"cpu_time_v1":231,"memory_v0":33108,"memory_v1":15264,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.23,"input":"n = int(eval(input()))\n\ns = eval(input())\n\n\n\na, b = [], []\n\nfor i in range(n):\n\n if s[i] == 'W':\n\n a.append(1)\n\n b.append(0)\n\n else:\n\n a.append(0)\n\n b.append(1) \n\n \n\nimport itertools\n\naccum_a = [0] + list(itertools.accumulate(a))\n\naccum_b = list(itertools.accumulate(b))\n\n\n\nans = float('inf')\n\nfor i in range(n):\n\n ans = min(ans, accum_a[i] + abs((accum_b[-1] - accum_b[i])))\n\nprint(ans)","target":"n = int(eval(input()))\n\ns = eval(input())\n\n\n\nchg = [0]*n\n\n\n\ncnt = 0\n\nfor i in range(1, n): # \u5de6\u5074\u304b\u3089\n\n if s[i-1] == 'W':\n\n cnt += 1\n\n chg[i] += cnt\n\n\n\ncnt = 0\n\nfor i in range(1, n): # \u53f3\u5074\u304b\u3089\n\n if s[-i] == 'E':\n\n cnt += 1\n\n chg[-1-i] += cnt\n\n \n\nprint((min(chg)))","code_v0_loc":20,"code_v1_loc":18,"code_v0_num_chars":426,"code_v1_num_chars":273,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\na, b = [], []\nfor i in range(n):\n if s[i] == \"W\":\n a.append(1)\n b.append(0)\n else:\n a.append(0)\n b.append(1)\nimport itertools\n\naccum_a = [0] + list(itertools.accumulate(a))\naccum_b = list(itertools.accumulate(b))\nans = float(\"inf\")\nfor i in range(n):\n ans = min(ans, accum_a[i] + abs((accum_b[-1] - accum_b[i])))\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\nchg = [0] * n\ncnt = 0\nfor i in range(1, n): # \u5de6\u5074\u304b\u3089\n if s[i - 1] == \"W\":\n cnt += 1\n chg[i] += cnt\ncnt = 0\nfor i in range(1, n): # \u53f3\u5074\u304b\u3089\n if s[-i] == \"E\":\n cnt += 1\n chg[-1 - i] += cnt\nprint((min(chg)))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-a, b = [], []","-for i in range(n):","- if s[i] == \"W\":","- a.append(1)","- b.append(0)","- else:","- a.append(0)","- b.append(1)","-import itertools","-","-accum_a = [0] + list(itertools.accumulate(a))","-accum_b = list(itertools.accumulate(b))","-ans = float(\"inf\")","-for i in range(n):","- ans = min(ans, accum_a[i] + abs((accum_b[-1] - accum_b[i])))","-print(ans)","+chg = [0] * n","+cnt = 0","+for i in range(1, n): # \u5de6\u5074\u304b\u3089","+ if s[i - 1] == \"W\":","+ cnt += 1","+ chg[i] += cnt","+cnt = 0","+for i in range(1, n): # \u53f3\u5074\u304b\u3089","+ if s[-i] == \"E\":","+ cnt += 1","+ chg[-1 - i] += cnt","+print((min(chg)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0750472069,"measured_runtime_v1":0.033288002,"runtime_lift":2.2544821652,"key":["s347002699","s972875643"]} +{"user_id":"u699089116","problem_id":"p03449","language":"python","submission_id_v0":"s247813941","submission_id_v1":"s589433498","cpu_time_v0":184,"cpu_time_v1":168,"memory_v0":38384,"memory_v1":38384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.7,"input":"n = int(eval(input()))\n\na1 = list(map(int, input().split()))\n\na2 = list(map(int, input().split()))\n\n\n\nans = [0] * n\n\nfor i in range(n):\n\n ans[i] = sum(a1[:i+1]) + sum(a2[i:])\n\n\n\nprint((max(ans)))","target":"n = int(eval(input()))\n\na1 = list(map(int, input().split()))\n\na2 = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor i in range(n):\n\n ans = max(ans, sum(a1[:i+1]) + sum(a2[i:]))\n\n\n\nprint(ans)","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":190,"code_v1_num_chars":186,"code_v0_no_empty_lines":"n = int(eval(input()))\na1 = list(map(int, input().split()))\na2 = list(map(int, input().split()))\nans = [0] * n\nfor i in range(n):\n ans[i] = sum(a1[: i + 1]) + sum(a2[i:])\nprint((max(ans)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na1 = list(map(int, input().split()))\na2 = list(map(int, input().split()))\nans = 0\nfor i in range(n):\n ans = max(ans, sum(a1[: i + 1]) + sum(a2[i:]))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-ans = [0] * n","+ans = 0","- ans[i] = sum(a1[: i + 1]) + sum(a2[i:])","-print((max(ans)))","+ ans = max(ans, sum(a1[: i + 1]) + sum(a2[i:]))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0456349208,"measured_runtime_v1":0.0425447681,"runtime_lift":1.0726329668,"key":["s247813941","s589433498"]} +{"user_id":"u881590806","problem_id":"p02242","language":"python","submission_id_v0":"s702101761","submission_id_v1":"s118232345","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":6792,"memory_v1":8416,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"INFTY = 100000000000000000000000000\n\nn = int(input())\n\ngraph = {}\n\nfor i in range(n):\n\n entry = list(map(int, input().split(' ')))\n\n u = entry[0]\n\n k = entry[1]\n\n graph[u] = {}\n\n for j in range(k):\n\n v = entry[2+j*2]\n\n c = entry[2+j*2+1]\n\n graph[u][v] = c\n\n\n\nd = {}\n\nvisited = {}\n\nfor i in range(n):\n\n d[i] = INFTY\n\n visited[i] = False\n\ns = 0\n\nd[s] = 0\n\nvisited[s] = True\n\n\n\nwhile True:\n\n for i in range(n):\n\n if not visited[i] and i in graph[s] and d[i] > d[s] + graph[s][i]:\n\n d[i] = d[s] + graph[s][i]\n\n mincost = INFTY\n\n minnode = -1\n\n for i in range(n):\n\n if not visited[i] and d[i] < mincost:\n\n mincost = d[i]\n\n minnode = i\n\n if mincost == INFTY: break\n\n visited[minnode] = True\n\n s = minnode\n\n\n\n\n\nfor i in range(n):\n\n print(i,d[i])","target":"from collections import defaultdict\n\n\n\ndef dijkstra(G, s):\n\n heap = Heap()\n\n heap.push((s, 0))\n\n fixed = set()\n\n d = defaultdict(lambda: 999999999999999999999)\n\n d[s] = 0\n\n while len(heap.data) > 0:\n\n v = heap.pop()\n\n if v in fixed:\n\n continue\n\n for u in G[v]:\n\n if u in fixed:\n\n continue\n\n c = G[v][u]\n\n if d[v] + c < d[u]:\n\n d[u] = d[v] + c\n\n heap.push((u, d[u]))\n\n fixed.add(v)\n\n return d\n\n\n\n\n\nclass Heap:\n\n def __init__(self):\n\n self.data = []\n\n\n\n def push(self,x):\n\n self.data.append(x)\n\n i = len(self.data)-1\n\n while self._p(i) >= 0:\n\n if self.data[i][1] < self.data[self._p(i)][1]:\n\n tmp = self.data[i]\n\n self.data[i] = self.data[self._p(i)]\n\n self.data[self._p(i)] = tmp\n\n i = self._p(i)\n\n else:\n\n break\n\n\n\n def pop(self):\n\n ret = self.top()\n\n n = self.data.pop()\n\n if len(self.data) > 0:\n\n self.data[0] = n\n\n i = 0\n\n while True:\n\n if self._l(i) < len(self.data):\n\n l = self.data[self._l(i)]\n\n else:\n\n l = (-1, 999999999999999999999)\n\n if self._r(i) < len(self.data):\n\n r = self.data[self._r(i)]\n\n else:\n\n r = (-1, 999999999999999999999)\n\n if l[1] > r[1]:\n\n if r[1] < self.data[i][1]:\n\n tmp = self.data[i]\n\n self.data[i] = self.data[self._r(i)]\n\n self.data[self._r(i)] = tmp\n\n i = self._r(i)\n\n else:\n\n break\n\n else:\n\n if l[1] < self.data[i][1]:\n\n tmp = self.data[i]\n\n self.data[i] = self.data[self._l(i)]\n\n self.data[self._l(i)] = tmp\n\n i = self._l(i)\n\n else:\n\n break\n\n return ret[0]\n\n\n\n def top(self):\n\n return self.data[0]\n\n\n\n def _p(self, i):\n\n i = i+1\n\n return i\/\/2-1\n\n\n\n def _l(self, i):\n\n i = i+1\n\n return i*2-1\n\n\n\n def _r(self, i):\n\n i = i+1\n\n return i*2\n\n\n\n\n\nG = {}\n\n\n\nn = int(eval(input()))\n\nfor _ in range(n):\n\n entry = [int(v) for v in input().strip().split(' ')]\n\n u = entry[0]\n\n k = entry[1]\n\n G[u] = {}\n\n for i in range(k):\n\n v = entry[2+i*2]\n\n c = entry[3+i*2]\n\n G[u][v] = c\n\n\n\nd = dijkstra(G, 0)\n\n\n\nfor i in range(n):\n\n print((i, d[i]))","code_v0_loc":39,"code_v1_loc":105,"code_v0_num_chars":852,"code_v1_num_chars":2263,"code_v0_no_empty_lines":"INFTY = 100000000000000000000000000\nn = int(input())\ngraph = {}\nfor i in range(n):\n entry = list(map(int, input().split(\" \")))\n u = entry[0]\n k = entry[1]\n graph[u] = {}\n for j in range(k):\n v = entry[2 + j * 2]\n c = entry[2 + j * 2 + 1]\n graph[u][v] = c\nd = {}\nvisited = {}\nfor i in range(n):\n d[i] = INFTY\n visited[i] = False\ns = 0\nd[s] = 0\nvisited[s] = True\nwhile True:\n for i in range(n):\n if not visited[i] and i in graph[s] and d[i] > d[s] + graph[s][i]:\n d[i] = d[s] + graph[s][i]\n mincost = INFTY\n minnode = -1\n for i in range(n):\n if not visited[i] and d[i] < mincost:\n mincost = d[i]\n minnode = i\n if mincost == INFTY:\n break\n visited[minnode] = True\n s = minnode\nfor i in range(n):\n print(i, d[i])\n","code_v1_no_empty_lines":"from collections import defaultdict\n\n\ndef dijkstra(G, s):\n heap = Heap()\n heap.push((s, 0))\n fixed = set()\n d = defaultdict(lambda: 999999999999999999999)\n d[s] = 0\n while len(heap.data) > 0:\n v = heap.pop()\n if v in fixed:\n continue\n for u in G[v]:\n if u in fixed:\n continue\n c = G[v][u]\n if d[v] + c < d[u]:\n d[u] = d[v] + c\n heap.push((u, d[u]))\n fixed.add(v)\n return d\n\n\nclass Heap:\n def __init__(self):\n self.data = []\n\n def push(self, x):\n self.data.append(x)\n i = len(self.data) - 1\n while self._p(i) >= 0:\n if self.data[i][1] < self.data[self._p(i)][1]:\n tmp = self.data[i]\n self.data[i] = self.data[self._p(i)]\n self.data[self._p(i)] = tmp\n i = self._p(i)\n else:\n break\n\n def pop(self):\n ret = self.top()\n n = self.data.pop()\n if len(self.data) > 0:\n self.data[0] = n\n i = 0\n while True:\n if self._l(i) < len(self.data):\n l = self.data[self._l(i)]\n else:\n l = (-1, 999999999999999999999)\n if self._r(i) < len(self.data):\n r = self.data[self._r(i)]\n else:\n r = (-1, 999999999999999999999)\n if l[1] > r[1]:\n if r[1] < self.data[i][1]:\n tmp = self.data[i]\n self.data[i] = self.data[self._r(i)]\n self.data[self._r(i)] = tmp\n i = self._r(i)\n else:\n break\n else:\n if l[1] < self.data[i][1]:\n tmp = self.data[i]\n self.data[i] = self.data[self._l(i)]\n self.data[self._l(i)] = tmp\n i = self._l(i)\n else:\n break\n return ret[0]\n\n def top(self):\n return self.data[0]\n\n def _p(self, i):\n i = i + 1\n return i \/\/ 2 - 1\n\n def _l(self, i):\n i = i + 1\n return i * 2 - 1\n\n def _r(self, i):\n i = i + 1\n return i * 2\n\n\nG = {}\nn = int(eval(input()))\nfor _ in range(n):\n entry = [int(v) for v in input().strip().split(\" \")]\n u = entry[0]\n k = entry[1]\n G[u] = {}\n for i in range(k):\n v = entry[2 + i * 2]\n c = entry[3 + i * 2]\n G[u][v] = c\nd = dijkstra(G, 0)\nfor i in range(n):\n print((i, d[i]))\n","code_same":false,"relative_loc_diff_percent":62.8571428571,"diff":["-INFTY = 100000000000000000000000000","-n = int(input())","-graph = {}","-for i in range(n):","- entry = list(map(int, input().split(\" \")))","+from collections import defaultdict","+","+","+def dijkstra(G, s):","+ heap = Heap()","+ heap.push((s, 0))","+ fixed = set()","+ d = defaultdict(lambda: 999999999999999999999)","+ d[s] = 0","+ while len(heap.data) > 0:","+ v = heap.pop()","+ if v in fixed:","+ continue","+ for u in G[v]:","+ if u in fixed:","+ continue","+ c = G[v][u]","+ if d[v] + c < d[u]:","+ d[u] = d[v] + c","+ heap.push((u, d[u]))","+ fixed.add(v)","+ return d","+","+","+class Heap:","+ def __init__(self):","+ self.data = []","+","+ def push(self, x):","+ self.data.append(x)","+ i = len(self.data) - 1","+ while self._p(i) >= 0:","+ if self.data[i][1] < self.data[self._p(i)][1]:","+ tmp = self.data[i]","+ self.data[i] = self.data[self._p(i)]","+ self.data[self._p(i)] = tmp","+ i = self._p(i)","+ else:","+ break","+","+ def pop(self):","+ ret = self.top()","+ n = self.data.pop()","+ if len(self.data) > 0:","+ self.data[0] = n","+ i = 0","+ while True:","+ if self._l(i) < len(self.data):","+ l = self.data[self._l(i)]","+ else:","+ l = (-1, 999999999999999999999)","+ if self._r(i) < len(self.data):","+ r = self.data[self._r(i)]","+ else:","+ r = (-1, 999999999999999999999)","+ if l[1] > r[1]:","+ if r[1] < self.data[i][1]:","+ tmp = self.data[i]","+ self.data[i] = self.data[self._r(i)]","+ self.data[self._r(i)] = tmp","+ i = self._r(i)","+ else:","+ break","+ else:","+ if l[1] < self.data[i][1]:","+ tmp = self.data[i]","+ self.data[i] = self.data[self._l(i)]","+ self.data[self._l(i)] = tmp","+ i = self._l(i)","+ else:","+ break","+ return ret[0]","+","+ def top(self):","+ return self.data[0]","+","+ def _p(self, i):","+ i = i + 1","+ return i \/\/ 2 - 1","+","+ def _l(self, i):","+ i = i + 1","+ return i * 2 - 1","+","+ def _r(self, i):","+ i = i + 1","+ return i * 2","+","+","+G = {}","+n = int(eval(input()))","+for _ in range(n):","+ entry = [int(v) for v in input().strip().split(\" \")]","- graph[u] = {}","- for j in range(k):","- v = entry[2 + j * 2]","- c = entry[2 + j * 2 + 1]","- graph[u][v] = c","-d = {}","-visited = {}","+ G[u] = {}","+ for i in range(k):","+ v = entry[2 + i * 2]","+ c = entry[3 + i * 2]","+ G[u][v] = c","+d = dijkstra(G, 0)","- d[i] = INFTY","- visited[i] = False","-s = 0","-d[s] = 0","-visited[s] = True","-while True:","- for i in range(n):","- if not visited[i] and i in graph[s] and d[i] > d[s] + graph[s][i]:","- d[i] = d[s] + graph[s][i]","- mincost = INFTY","- minnode = -1","- for i in range(n):","- if not visited[i] and d[i] < mincost:","- mincost = d[i]","- minnode = i","- if mincost == INFTY:","- break","- visited[minnode] = True","- s = minnode","-for i in range(n):","- print(i, d[i])","+ print((i, d[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0423411846,"measured_runtime_v1":0.0424024105,"runtime_lift":0.998556075,"key":["s702101761","s118232345"]} +{"user_id":"u370331385","problem_id":"p03111","language":"python","submission_id_v0":"s620250796","submission_id_v1":"s663191774","cpu_time_v0":669,"cpu_time_v1":330,"memory_v0":10976,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.67,"input":"import itertools\n\n\n\nN,A,B,C = list(map(int,input().split()))\n\ncomb = [] #0:\u4f7f\u7528\u3057\u306a\u3044,1:\u7af9A\u306e\u6750\u6599,2:\u7af9B\u306e\u6750\u6599,3:\u7af9C\u306e\u6750\u6599\n\nL = []\n\nfor i in range(N):\n\n l = int(eval(input()))\n\n L.append(l)\n\n comb.append([0,1,2,3])\n\n\n\nAll_comb = list(itertools.product(*comb))\n\nmin_MP = float('inf')\n\nfor i in range(len(All_comb)):\n\n tmp = All_comb[i]\n\n Non_material = []\n\n A_material = []\n\n B_material = []\n\n C_material = []\n\n for j in range(len(tmp)):\n\n if(tmp[j] == 0): Non_material.append(L[j])\n\n elif(tmp[j] == 1): A_material.append(L[j])\n\n elif(tmp[j] == 2): B_material.append(L[j])\n\n elif(tmp[j] == 3): C_material.append(L[j])\n\n a,b,c = len(A_material),len(B_material),len(C_material)\n\n if((a>=1)and(b>=1)and(c>=1)):\n\n sum_A,sum_B,sum_C = sum(A_material),sum(B_material),sum(C_material)\n\n MP = abs(A-sum_A)+abs(B-sum_B)+abs(C-sum_C) +10*(a+b+c-3)\n\n min_MP = min(MP,min_MP)\n\n\n\nprint(min_MP)\n\n ","target":"import itertools\n\n\n\nN,A,B,C = list(map(int,input().split()))\n\nComb = itertools.product([0,1,2,3],repeat=N)\n\n\n\nL = []\n\nfor i in range(N):\n\n l = int(eval(input()))\n\n L.append(l)\n\n \n\n# \u5404\u7af9\u306b\u3064\u3044\u3066 \n\n# 0 : \u4f7f\u7528\u3057\u306a\u3044\n\n# 1 : \u7af9A\u306e\u6750\u6599\u306b\u3059\u308b \n\n# 2 : \u7af9B\u306e\u6750\u6599\u306b\u3059\u308b \n\n# 3 : \u7af9C\u306e\u6750\u6599\u306b\u3059\u308b\n\n# \u7af9A,B,C\u306e\u4f5c\u6210\u6cd5 :\n\n# \u3068\u308a\u3042\u3048\u305a\u5168\u90e8\u5408\u6210 \u2192 \u76ee\u7684\u306e\u9577\u3055\u306b\u5408\u308f\u305b\u308b\n\n\n\nans = float('inf')\n\nfor X in Comb:\n\n tmp = 0\n\n m_A,m_B,m_C = [],[],[]\n\n for i in range(N):\n\n if(X[i] == 1): m_A.append(L[i])\n\n elif(X[i] == 2): m_B.append(L[i])\n\n elif(X[i] == 3): m_C.append(L[i])\n\n # \u7a7a\u306e\u7af9\u30ea\u30b9\u30c8\u304c\u306a\u3044\u306a\u3089 \n\n if(len(m_A)*len(m_B)*len(m_C) != 0): \n\n for take_list,take_len in zip([m_A,m_B,m_C],[A,B,C]):\n\n tmp += (len(take_list)-1)*10 # \u5408\u6210\n\n tmp += (abs(take_len-sum(take_list)))*1 # \u5ef6\u9577or\u77ed\u7e2e\n\n ans = min(ans,tmp)\n\n \n\nprint(ans) ","code_v0_loc":31,"code_v1_loc":34,"code_v0_num_chars":895,"code_v1_num_chars":764,"code_v0_no_empty_lines":"import itertools\n\nN, A, B, C = list(map(int, input().split()))\ncomb = [] # 0:\u4f7f\u7528\u3057\u306a\u3044,1:\u7af9A\u306e\u6750\u6599,2:\u7af9B\u306e\u6750\u6599,3:\u7af9C\u306e\u6750\u6599\nL = []\nfor i in range(N):\n l = int(eval(input()))\n L.append(l)\n comb.append([0, 1, 2, 3])\nAll_comb = list(itertools.product(*comb))\nmin_MP = float(\"inf\")\nfor i in range(len(All_comb)):\n tmp = All_comb[i]\n Non_material = []\n A_material = []\n B_material = []\n C_material = []\n for j in range(len(tmp)):\n if tmp[j] == 0:\n Non_material.append(L[j])\n elif tmp[j] == 1:\n A_material.append(L[j])\n elif tmp[j] == 2:\n B_material.append(L[j])\n elif tmp[j] == 3:\n C_material.append(L[j])\n a, b, c = len(A_material), len(B_material), len(C_material)\n if (a >= 1) and (b >= 1) and (c >= 1):\n sum_A, sum_B, sum_C = sum(A_material), sum(B_material), sum(C_material)\n MP = abs(A - sum_A) + abs(B - sum_B) + abs(C - sum_C) + 10 * (a + b + c - 3)\n min_MP = min(MP, min_MP)\nprint(min_MP)\n","code_v1_no_empty_lines":"import itertools\n\nN, A, B, C = list(map(int, input().split()))\nComb = itertools.product([0, 1, 2, 3], repeat=N)\nL = []\nfor i in range(N):\n l = int(eval(input()))\n L.append(l)\n# \u5404\u7af9\u306b\u3064\u3044\u3066\n# 0 : \u4f7f\u7528\u3057\u306a\u3044\n# 1 : \u7af9A\u306e\u6750\u6599\u306b\u3059\u308b\n# 2 : \u7af9B\u306e\u6750\u6599\u306b\u3059\u308b\n# 3 : \u7af9C\u306e\u6750\u6599\u306b\u3059\u308b\n# \u7af9A,B,C\u306e\u4f5c\u6210\u6cd5 :\n# \u3068\u308a\u3042\u3048\u305a\u5168\u90e8\u5408\u6210 \u2192 \u76ee\u7684\u306e\u9577\u3055\u306b\u5408\u308f\u305b\u308b\nans = float(\"inf\")\nfor X in Comb:\n tmp = 0\n m_A, m_B, m_C = [], [], []\n for i in range(N):\n if X[i] == 1:\n m_A.append(L[i])\n elif X[i] == 2:\n m_B.append(L[i])\n elif X[i] == 3:\n m_C.append(L[i])\n # \u7a7a\u306e\u7af9\u30ea\u30b9\u30c8\u304c\u306a\u3044\u306a\u3089\n if len(m_A) * len(m_B) * len(m_C) != 0:\n for take_list, take_len in zip([m_A, m_B, m_C], [A, B, C]):\n tmp += (len(take_list) - 1) * 10 # \u5408\u6210\n tmp += (abs(take_len - sum(take_list))) * 1 # \u5ef6\u9577or\u77ed\u7e2e\n ans = min(ans, tmp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.8235294118,"diff":["-comb = [] # 0:\u4f7f\u7528\u3057\u306a\u3044,1:\u7af9A\u306e\u6750\u6599,2:\u7af9B\u306e\u6750\u6599,3:\u7af9C\u306e\u6750\u6599","+Comb = itertools.product([0, 1, 2, 3], repeat=N)","- comb.append([0, 1, 2, 3])","-All_comb = list(itertools.product(*comb))","-min_MP = float(\"inf\")","-for i in range(len(All_comb)):","- tmp = All_comb[i]","- Non_material = []","- A_material = []","- B_material = []","- C_material = []","- for j in range(len(tmp)):","- if tmp[j] == 0:","- Non_material.append(L[j])","- elif tmp[j] == 1:","- A_material.append(L[j])","- elif tmp[j] == 2:","- B_material.append(L[j])","- elif tmp[j] == 3:","- C_material.append(L[j])","- a, b, c = len(A_material), len(B_material), len(C_material)","- if (a >= 1) and (b >= 1) and (c >= 1):","- sum_A, sum_B, sum_C = sum(A_material), sum(B_material), sum(C_material)","- MP = abs(A - sum_A) + abs(B - sum_B) + abs(C - sum_C) + 10 * (a + b + c - 3)","- min_MP = min(MP, min_MP)","-print(min_MP)","+# \u5404\u7af9\u306b\u3064\u3044\u3066","+# 0 : \u4f7f\u7528\u3057\u306a\u3044","+# 1 : \u7af9A\u306e\u6750\u6599\u306b\u3059\u308b","+# 2 : \u7af9B\u306e\u6750\u6599\u306b\u3059\u308b","+# 3 : \u7af9C\u306e\u6750\u6599\u306b\u3059\u308b","+# \u7af9A,B,C\u306e\u4f5c\u6210\u6cd5 :","+# \u3068\u308a\u3042\u3048\u305a\u5168\u90e8\u5408\u6210 \u2192 \u76ee\u7684\u306e\u9577\u3055\u306b\u5408\u308f\u305b\u308b","+ans = float(\"inf\")","+for X in Comb:","+ tmp = 0","+ m_A, m_B, m_C = [], [], []","+ for i in range(N):","+ if X[i] == 1:","+ m_A.append(L[i])","+ elif X[i] == 2:","+ m_B.append(L[i])","+ elif X[i] == 3:","+ m_C.append(L[i])","+ # \u7a7a\u306e\u7af9\u30ea\u30b9\u30c8\u304c\u306a\u3044\u306a\u3089","+ if len(m_A) * len(m_B) * len(m_C) != 0:","+ for take_list, take_len in zip([m_A, m_B, m_C], [A, B, C]):","+ tmp += (len(take_list) - 1) * 10 # \u5408\u6210","+ tmp += (abs(take_len - sum(take_list))) * 1 # \u5ef6\u9577or\u77ed\u7e2e","+ ans = min(ans, tmp)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.7804096222,"measured_runtime_v1":0.274462527,"runtime_lift":2.843410467,"key":["s620250796","s663191774"]} +{"user_id":"u608088992","problem_id":"p03487","language":"python","submission_id_v0":"s923819095","submission_id_v1":"s861520480","cpu_time_v0":121,"cpu_time_v1":80,"memory_v0":18676,"memory_v1":17700,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.88,"input":"from collections import defaultdict\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nD = defaultdict(int)\n\n\n\nfor i in range(N):\n\n D[A[i]] += 1\n\n\n\ndelete = 0\n\nfor d in D:\n\n if d < D[d]:\n\n delete += D[d] - d\n\n elif d > D[d]:\n\n delete += D[d]\n\nprint(delete)\n","target":"import sys\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n N = int(eval(input()))\n\n A = [int(a) for a in input().split()]\n\n AD = dict()\n\n for a in A:\n\n if a in AD: AD[a] += 1\n\n else: AD[a] = 1\n\n\n\n count = 0\n\n for key in AD:\n\n if AD[key] == key: continue\n\n elif AD[key] > key: count += AD[key] - key\n\n else: count += AD[key]\n\n print(count)\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":15,"code_v1_loc":22,"code_v0_num_chars":287,"code_v1_num_chars":449,"code_v0_no_empty_lines":"from collections import defaultdict\n\nN = int(eval(input()))\nA = [int(i) for i in input().split()]\nD = defaultdict(int)\nfor i in range(N):\n D[A[i]] += 1\ndelete = 0\nfor d in D:\n if d < D[d]:\n delete += D[d] - d\n elif d > D[d]:\n delete += D[d]\nprint(delete)\n","code_v1_no_empty_lines":"import sys\n\n\ndef solve():\n input = sys.stdin.readline\n N = int(eval(input()))\n A = [int(a) for a in input().split()]\n AD = dict()\n for a in A:\n if a in AD:\n AD[a] += 1\n else:\n AD[a] = 1\n count = 0\n for key in AD:\n if AD[key] == key:\n continue\n elif AD[key] > key:\n count += AD[key] - key\n else:\n count += AD[key]\n print(count)\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":31.8181818182,"diff":["-from collections import defaultdict","+import sys","-N = int(eval(input()))","-A = [int(i) for i in input().split()]","-D = defaultdict(int)","-for i in range(N):","- D[A[i]] += 1","-delete = 0","-for d in D:","- if d < D[d]:","- delete += D[d] - d","- elif d > D[d]:","- delete += D[d]","-print(delete)","+","+def solve():","+ input = sys.stdin.readline","+ N = int(eval(input()))","+ A = [int(a) for a in input().split()]","+ AD = dict()","+ for a in A:","+ if a in AD:","+ AD[a] += 1","+ else:","+ AD[a] = 1","+ count = 0","+ for key in AD:","+ if AD[key] == key:","+ continue","+ elif AD[key] > key:","+ count += AD[key] - key","+ else:","+ count += AD[key]","+ print(count)","+ return 0","+","+","+if __name__ == \"__main__\":","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0401390076,"measured_runtime_v1":0.0414435863,"runtime_lift":0.9685215758,"key":["s923819095","s861520480"]} +{"user_id":"u203843959","problem_id":"p03326","language":"python","submission_id_v0":"s194020817","submission_id_v1":"s665352117","cpu_time_v0":341,"cpu_time_v1":28,"memory_v0":45680,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.79,"input":"import sys\n\nN,M=list(map(int,input().split()))\n\n\n\nif M==0:\n\n print((0))\n\n sys.exit(0)\n\n\n\nxyzlist=[]\n\nfor i in range(N):\n\n x,y,z=list(map(int,input().split()))\n\n xyzlist.append((x,y,z))\n\n#print(xyzlist)\n\n\n\nselected_list1=[False]*N\n\npt_list=[0,0,0]\n\nfor _ in range(M):\n\n max_ind=-1\n\n max_point=-10**20\n\n for i in range(N):\n\n if selected_list1[i]:\n\n continue\n\n \n\n x,y,z=xyzlist[i] \n\n point=abs(pt_list[0]+x)-abs(pt_list[0])+abs(pt_list[1]+y)-abs(pt_list[1])+abs(pt_list[2]+z)-abs(pt_list[2])\n\n if max_pointmaxabs[0]:\n\n maxabs_ind[0]=i\n\n maxabs[0]=abs(x)\n\n if abs(y)>maxabs[1]:\n\n maxabs_ind[1]=i\n\n maxabs[1]=abs(y)\n\n if abs(z)>maxabs[2]:\n\n maxabs_ind[2]=i\n\n maxabs[2]=abs(z)\n\n#print(maxabs_ind)\n\n \n\nselected_list2=[False]*N\n\nselected_list2[maxabs_ind[0]]=True\n\npt_list=list(xyzlist[maxabs_ind[0]])\n\n#print(pt_list)\n\nfor _ in range(M-1):\n\n max_ind=-1\n\n max_point=-10**20\n\n for i in range(N):\n\n if selected_list2[i]:\n\n continue\n\n \n\n x,y,z=xyzlist[i] \n\n point=abs(pt_list[0]+x)-abs(pt_list[0])+abs(pt_list[1]+y)-abs(pt_list[1])+abs(pt_list[2]+z)-abs(pt_list[2])\n\n if max_point maxabs[0]:\n maxabs_ind[0] = i\n maxabs[0] = abs(x)\n if abs(y) > maxabs[1]:\n maxabs_ind[1] = i\n maxabs[1] = abs(y)\n if abs(z) > maxabs[2]:\n maxabs_ind[2] = i\n maxabs[2] = abs(z)\n# print(maxabs_ind)\nselected_list2 = [False] * N\nselected_list2[maxabs_ind[0]] = True\npt_list = list(xyzlist[maxabs_ind[0]])\n# print(pt_list)\nfor _ in range(M - 1):\n max_ind = -1\n max_point = -(10**20)\n for i in range(N):\n if selected_list2[i]:\n continue\n x, y, z = xyzlist[i]\n point = (\n abs(pt_list[0] + x)\n - abs(pt_list[0])\n + abs(pt_list[1] + y)\n - abs(pt_list[1])\n + abs(pt_list[2] + z)\n - abs(pt_list[2])\n )\n if max_point < point:\n max_ind = i\n max_point = point\n # print(max_ind+1,xyzlist[max_ind])\n selected_list2[max_ind] = True\n mx, my, mz = xyzlist[max_ind]\n pt_list = [pt_list[0] + mx, pt_list[1] + my, pt_list[2] + mz]\n # print(pt_list)\n# print(selected_list2)\n# print(pt_list)\nanswer2 = 0\nfor i in range(3):\n answer2 += abs(pt_list[i])\n# print(answer2)\nselected_list3 = [False] * N\nselected_list3[maxabs_ind[1]] = True\npt_list = list(xyzlist[maxabs_ind[1]])\n# print(pt_list)\nfor _ in range(M - 1):\n max_ind = -1\n max_point = -(10**20)\n for i in range(N):\n if selected_list3[i]:\n continue\n x, y, z = xyzlist[i]\n point = (\n abs(pt_list[0] + x)\n - abs(pt_list[0])\n + abs(pt_list[1] + y)\n - abs(pt_list[1])\n + abs(pt_list[2] + z)\n - abs(pt_list[2])\n )\n if max_point < point:\n max_ind = i\n max_point = point\n # print(max_ind+1,xyzlist[max_ind])\n selected_list3[max_ind] = True\n mx, my, mz = xyzlist[max_ind]\n pt_list = [pt_list[0] + mx, pt_list[1] + my, pt_list[2] + mz]\n # print(pt_list)\n# print(selected_list3)\n# print(pt_list)\nanswer3 = 0\nfor i in range(3):\n answer3 += abs(pt_list[i])\n# print(answer3)\nselected_list4 = [False] * N\nselected_list4[maxabs_ind[2]] = True\npt_list = list(xyzlist[maxabs_ind[2]])\n# print(pt_list)\nfor _ in range(M - 1):\n max_ind = -1\n max_point = -(10**20)\n for i in range(N):\n if selected_list4[i]:\n continue\n x, y, z = xyzlist[i]\n point = (\n abs(pt_list[0] + x)\n - abs(pt_list[0])\n + abs(pt_list[1] + y)\n - abs(pt_list[1])\n + abs(pt_list[2] + z)\n - abs(pt_list[2])\n )\n if max_point < point:\n max_ind = i\n max_point = point\n # print(max_ind+1,xyzlist[max_ind])\n selected_list4[max_ind] = True\n mx, my, mz = xyzlist[max_ind]\n pt_list = [pt_list[0] + mx, pt_list[1] + my, pt_list[2] + mz]\n # print(pt_list)\n# print(selected_list3)\n# print(pt_list)\nanswer4 = 0\nfor i in range(3):\n answer4 += abs(pt_list[i])\n# print(answer4)\n# print(answer1,answer2,answer3,answer4)\nprint((max(answer1, answer2, answer3, answer4)))\n","code_v1_no_empty_lines":"import sys\n\nN, M = list(map(int, input().split()))\nxyzlist = []\nfor i in range(N):\n x, y, z = list(map(int, input().split()))\n xyzlist.append((x, y, z))\n# print(xyzlist)\nanswer = 0\nfor b in range(2**3):\n bit = [0] * 3\n for i in range(3):\n bit[i] = b % 2\n b \/\/= 2\n # print(bit)\n slist = []\n for x, y, z in xyzlist:\n if bit[0] == 1:\n x = -x\n if bit[1] == 1:\n y = -y\n if bit[2] == 1:\n z = -z\n slist.append(x + y + z)\n slist.sort(reverse=True)\n answer = max(answer, sum(slist[:M]))\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":78.3783783784,"diff":["-if M == 0:","- print((0))","- sys.exit(0)","-selected_list1 = [False] * N","-pt_list = [0, 0, 0]","-for _ in range(M):","- max_ind = -1","- max_point = -(10**20)","- for i in range(N):","- if selected_list1[i]:","- continue","- x, y, z = xyzlist[i]","- point = (","- abs(pt_list[0] + x)","- - abs(pt_list[0])","- + abs(pt_list[1] + y)","- - abs(pt_list[1])","- + abs(pt_list[2] + z)","- - abs(pt_list[2])","- )","- if max_point < point:","- max_ind = i","- max_point = point","- # print(max_ind+1,xyzlist[max_ind])","- selected_list1[max_ind] = True","- mx, my, mz = xyzlist[max_ind]","- pt_list = [pt_list[0] + mx, pt_list[1] + my, pt_list[2] + mz]","- # print(pt_list)","-# print(selected_list1)","-# print(pt_list)","-answer1 = 0","-for i in range(3):","- answer1 += abs(pt_list[i])","-# print(answer1)","-maxabs_ind = [-1, -1, -1]","-maxabs = [-1, -1, -1]","-for i in range(N):","- x, y, z = xyzlist[i]","- if abs(x) > maxabs[0]:","- maxabs_ind[0] = i","- maxabs[0] = abs(x)","- if abs(y) > maxabs[1]:","- maxabs_ind[1] = i","- maxabs[1] = abs(y)","- if abs(z) > maxabs[2]:","- maxabs_ind[2] = i","- maxabs[2] = abs(z)","-# print(maxabs_ind)","-selected_list2 = [False] * N","-selected_list2[maxabs_ind[0]] = True","-pt_list = list(xyzlist[maxabs_ind[0]])","-# print(pt_list)","-for _ in range(M - 1):","- max_ind = -1","- max_point = -(10**20)","- for i in range(N):","- if selected_list2[i]:","- continue","- x, y, z = xyzlist[i]","- point = (","- abs(pt_list[0] + x)","- - abs(pt_list[0])","- + abs(pt_list[1] + y)","- - abs(pt_list[1])","- + abs(pt_list[2] + z)","- - abs(pt_list[2])","- )","- if max_point < point:","- max_ind = i","- max_point = point","- # print(max_ind+1,xyzlist[max_ind])","- selected_list2[max_ind] = True","- mx, my, mz = xyzlist[max_ind]","- pt_list = [pt_list[0] + mx, pt_list[1] + my, pt_list[2] + mz]","- # print(pt_list)","-# print(selected_list2)","-# print(pt_list)","-answer2 = 0","-for i in range(3):","- answer2 += abs(pt_list[i])","-# print(answer2)","-selected_list3 = [False] * N","-selected_list3[maxabs_ind[1]] = True","-pt_list = list(xyzlist[maxabs_ind[1]])","-# print(pt_list)","-for _ in range(M - 1):","- max_ind = -1","- max_point = -(10**20)","- for i in range(N):","- if selected_list3[i]:","- continue","- x, y, z = xyzlist[i]","- point = (","- abs(pt_list[0] + x)","- - abs(pt_list[0])","- + abs(pt_list[1] + y)","- - abs(pt_list[1])","- + abs(pt_list[2] + z)","- - abs(pt_list[2])","- )","- if max_point < point:","- max_ind = i","- max_point = point","- # print(max_ind+1,xyzlist[max_ind])","- selected_list3[max_ind] = True","- mx, my, mz = xyzlist[max_ind]","- pt_list = [pt_list[0] + mx, pt_list[1] + my, pt_list[2] + mz]","- # print(pt_list)","-# print(selected_list3)","-# print(pt_list)","-answer3 = 0","-for i in range(3):","- answer3 += abs(pt_list[i])","-# print(answer3)","-selected_list4 = [False] * N","-selected_list4[maxabs_ind[2]] = True","-pt_list = list(xyzlist[maxabs_ind[2]])","-# print(pt_list)","-for _ in range(M - 1):","- max_ind = -1","- max_point = -(10**20)","- for i in range(N):","- if selected_list4[i]:","- continue","- x, y, z = xyzlist[i]","- point = (","- abs(pt_list[0] + x)","- - abs(pt_list[0])","- + abs(pt_list[1] + y)","- - abs(pt_list[1])","- + abs(pt_list[2] + z)","- - abs(pt_list[2])","- )","- if max_point < point:","- max_ind = i","- max_point = point","- # print(max_ind+1,xyzlist[max_ind])","- selected_list4[max_ind] = True","- mx, my, mz = xyzlist[max_ind]","- pt_list = [pt_list[0] + mx, pt_list[1] + my, pt_list[2] + mz]","- # print(pt_list)","-# print(selected_list3)","-# print(pt_list)","-answer4 = 0","-for i in range(3):","- answer4 += abs(pt_list[i])","-# print(answer4)","-# print(answer1,answer2,answer3,answer4)","-print((max(answer1, answer2, answer3, answer4)))","+answer = 0","+for b in range(2**3):","+ bit = [0] * 3","+ for i in range(3):","+ bit[i] = b % 2","+ b \/\/= 2","+ # print(bit)","+ slist = []","+ for x, y, z in xyzlist:","+ if bit[0] == 1:","+ x = -x","+ if bit[1] == 1:","+ y = -y","+ if bit[2] == 1:","+ z = -z","+ slist.append(x + y + z)","+ slist.sort(reverse=True)","+ answer = max(answer, sum(slist[:M]))","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.043759321,"measured_runtime_v1":0.007167407,"runtime_lift":6.105321031,"key":["s194020817","s665352117"]} +{"user_id":"u186838327","problem_id":"p02763","language":"python","submission_id_v0":"s654703731","submission_id_v1":"s174967827","cpu_time_v0":1549,"cpu_time_v1":1030,"memory_v0":477876,"memory_v1":448456,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.51,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\nn = int(eval(input()))\n\ns = str(eval(input()))\n\nA = list(s)\n\nA = A[0:n]\n\n\n\nA = [{ord(c)-ord('a')} for c in A]\n\n#print(A)\n\n\n\ndef segfunc(x, y):\n\n return x | y\n\n\n\ndef init(init_val):\n\n # set_val\n\n for i in range(n):\n\n seg[i+num-1] = init_val[i]\n\n # built\n\n for i in range(num-2, -1, -1):\n\n seg[i] = segfunc(seg[2*i+1], seg[2*i+2])\n\n\n\ndef update(k, x):\n\n k += num - 1\n\n seg[k] = x\n\n while k:\n\n k = (k-1)\/\/2\n\n seg[k] = segfunc(seg[2*k+1], seg[2*k+2])\n\n\n\ndef query(p, q):\n\n if q <= p:\n\n return ide_ele\n\n p += num - 1\n\n q += num - 2\n\n res = ide_ele\n\n while q-p>1:\n\n if p%2 == 0:\n\n res = segfunc(res, seg[p])\n\n if q%2 == 1:\n\n res = segfunc(res, seg[q])\n\n q -= 1\n\n p = p\/\/2\n\n q = (q-1)\/\/2\n\n if p == q:\n\n res = segfunc(res, seg[p])\n\n else:\n\n res = segfunc(segfunc(res, seg[p]), seg[q])\n\n return res\n\n\n\n# identity element\n\nide_ele = set()\n\n\n\n# num: n\u4ee5\u4e0a\u306e\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\n\nnum = 2**(n-1).bit_length()\n\nseg = [ide_ele]*2*num\n\n\n\ninit(A)\n\n\n\nq = int(eval(input()))\n\n\n\nfor _ in range(q):\n\n c, x, y = list(map(str, input().split()))\n\n if c == '1':\n\n x = int(x)-1\n\n y = {ord(y)-ord('a')}\n\n update(x, y)\n\n else:\n\n l = int(x)-1\n\n r = int(y)-1\n\n print((len(query(l, r+1))))","target":"n = int(eval(input()))\n\nS = list(str(eval(input())))\n\nS = [{ord(c)-ord('a')} for c in S]\n\n\n\ndef segfunc(x, y):\n\n return x | y\n\n\n\ndef init(init_val):\n\n # set_val\n\n for i in range(n):\n\n seg[i+num-1] = init_val[i]\n\n # built\n\n for i in range(num-2, -1, -1):\n\n seg[i] = segfunc(seg[2*i+1], seg[2*i+2])\n\n\n\ndef update(k, x):\n\n k += num - 1\n\n seg[k] = x\n\n while k:\n\n k = (k-1)\/\/2\n\n seg[k] = segfunc(seg[2*k+1], seg[2*k+2])\n\n\n\ndef query(p, q):\n\n if q <= p:\n\n return ide_ele\n\n p += num - 1\n\n q += num - 2\n\n res = ide_ele\n\n while q-p>1:\n\n if p&1 == 0:\n\n res = segfunc(res, seg[p])\n\n if q&1 == 1:\n\n res = segfunc(res, seg[q])\n\n q -= 1\n\n p = p\/\/2\n\n q = (q-1)\/\/2\n\n if p == q:\n\n res = segfunc(res, seg[p])\n\n else:\n\n res = segfunc(segfunc(res, seg[p]), seg[q])\n\n return res\n\n\n\n# identity element\n\nide_ele = set()\n\n\n\n# num: n\u4ee5\u4e0a\u306e\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\n\nnum = 2**(n-1).bit_length()\n\nseg = [ide_ele]*2*num\n\n\n\ninit(S)\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\nq = int(eval(input()))\n\nfor i in range(q):\n\n t, x, y = list(map(str, input().split()))\n\n if t == '1':\n\n x = int(x)\n\n y = ord(y)-ord('a')\n\n update(x-1, {y})\n\n else:\n\n x = int(x)\n\n y = int(y)\n\n print((len(query(x-1, y))))\n","code_v0_loc":70,"code_v1_loc":64,"code_v0_num_chars":1368,"code_v1_num_chars":1329,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nn = int(eval(input()))\ns = str(eval(input()))\nA = list(s)\nA = A[0:n]\nA = [{ord(c) - ord(\"a\")} for c in A]\n# print(A)\ndef segfunc(x, y):\n return x | y\n\n\ndef init(init_val):\n # set_val\n for i in range(n):\n seg[i + num - 1] = init_val[i]\n # built\n for i in range(num - 2, -1, -1):\n seg[i] = segfunc(seg[2 * i + 1], seg[2 * i + 2])\n\n\ndef update(k, x):\n k += num - 1\n seg[k] = x\n while k:\n k = (k - 1) \/\/ 2\n seg[k] = segfunc(seg[2 * k + 1], seg[2 * k + 2])\n\n\ndef query(p, q):\n if q <= p:\n return ide_ele\n p += num - 1\n q += num - 2\n res = ide_ele\n while q - p > 1:\n if p % 2 == 0:\n res = segfunc(res, seg[p])\n if q % 2 == 1:\n res = segfunc(res, seg[q])\n q -= 1\n p = p \/\/ 2\n q = (q - 1) \/\/ 2\n if p == q:\n res = segfunc(res, seg[p])\n else:\n res = segfunc(segfunc(res, seg[p]), seg[q])\n return res\n\n\n# identity element\nide_ele = set()\n# num: n\u4ee5\u4e0a\u306e\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\nnum = 2 ** (n - 1).bit_length()\nseg = [ide_ele] * 2 * num\ninit(A)\nq = int(eval(input()))\nfor _ in range(q):\n c, x, y = list(map(str, input().split()))\n if c == \"1\":\n x = int(x) - 1\n y = {ord(y) - ord(\"a\")}\n update(x, y)\n else:\n l = int(x) - 1\n r = int(y) - 1\n print((len(query(l, r + 1))))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nS = list(str(eval(input())))\nS = [{ord(c) - ord(\"a\")} for c in S]\n\n\ndef segfunc(x, y):\n return x | y\n\n\ndef init(init_val):\n # set_val\n for i in range(n):\n seg[i + num - 1] = init_val[i]\n # built\n for i in range(num - 2, -1, -1):\n seg[i] = segfunc(seg[2 * i + 1], seg[2 * i + 2])\n\n\ndef update(k, x):\n k += num - 1\n seg[k] = x\n while k:\n k = (k - 1) \/\/ 2\n seg[k] = segfunc(seg[2 * k + 1], seg[2 * k + 2])\n\n\ndef query(p, q):\n if q <= p:\n return ide_ele\n p += num - 1\n q += num - 2\n res = ide_ele\n while q - p > 1:\n if p & 1 == 0:\n res = segfunc(res, seg[p])\n if q & 1 == 1:\n res = segfunc(res, seg[q])\n q -= 1\n p = p \/\/ 2\n q = (q - 1) \/\/ 2\n if p == q:\n res = segfunc(res, seg[p])\n else:\n res = segfunc(segfunc(res, seg[p]), seg[q])\n return res\n\n\n# identity element\nide_ele = set()\n# num: n\u4ee5\u4e0a\u306e\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\nnum = 2 ** (n - 1).bit_length()\nseg = [ide_ele] * 2 * num\ninit(S)\nimport sys\n\ninput = sys.stdin.readline\nq = int(eval(input()))\nfor i in range(q):\n t, x, y = list(map(str, input().split()))\n if t == \"1\":\n x = int(x)\n y = ord(y) - ord(\"a\")\n update(x - 1, {y})\n else:\n x = int(x)\n y = int(y)\n print((len(query(x - 1, y))))\n","code_same":false,"relative_loc_diff_percent":8.5714285714,"diff":["-import sys","+n = int(eval(input()))","+S = list(str(eval(input())))","+S = [{ord(c) - ord(\"a\")} for c in S]","-input = sys.stdin.readline","-n = int(eval(input()))","-s = str(eval(input()))","-A = list(s)","-A = A[0:n]","-A = [{ord(c) - ord(\"a\")} for c in A]","-# print(A)","+","- if p % 2 == 0:","+ if p & 1 == 0:","- if q % 2 == 1:","+ if q & 1 == 1:","-init(A)","+init(S)","+import sys","+","+input = sys.stdin.readline","-for _ in range(q):","- c, x, y = list(map(str, input().split()))","- if c == \"1\":","- x = int(x) - 1","- y = {ord(y) - ord(\"a\")}","- update(x, y)","+for i in range(q):","+ t, x, y = list(map(str, input().split()))","+ if t == \"1\":","+ x = int(x)","+ y = ord(y) - ord(\"a\")","+ update(x - 1, {y})","- l = int(x) - 1","- r = int(y) - 1","- print((len(query(l, r + 1))))","+ x = int(x)","+ y = int(y)","+ print((len(query(x - 1, y))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0366335261,"measured_runtime_v1":0.0363338609,"runtime_lift":1.0082475464,"key":["s654703731","s174967827"]} +{"user_id":"u724687935","problem_id":"p02837","language":"python","submission_id_v0":"s566118230","submission_id_v1":"s125691668","cpu_time_v0":1159,"cpu_time_v1":294,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":74.63,"input":"N = int(eval(input()))\n\nA = [[] for _ in range(N)]\n\nfor i in range(N):\n\n Ai = int(eval(input()))\n\n for _ in range(Ai):\n\n x, y = list(map(int, input().split()))\n\n A[i].append((x - 1, y))\n\n\n\n\n\ndef countBit(x):\n\n if x == 0:\n\n return 0\n\n else:\n\n return countBit(x >> 1) + (x & 1)\n\n\n\n\n\nres = 0\n\nfor bits in range(2 ** N):\n\n bits_ = bin(bits)\n\n consistency = True\n\n for i, testimony in enumerate(A):\n\n if not ((bits >> i) & 1):\n\n continue\n\n for t in testimony:\n\n if ((bits >> t[0]) & 1) ^ t[1]:\n\n consistency = False\n\n\n\n if consistency:\n\n res = max(res, countBit(bits))\n\n\n\nprint(res)\n","target":"N = int(eval(input()))\n\nA = [[set() for _ in range(2)] for _ in range(N)]\n\nfor i in range(N):\n\n Ai = int(eval(input()))\n\n for _ in range(Ai):\n\n x, y = list(map(int, input().split()))\n\n A[i][y].add(x - 1)\n\n\n\nans = 0\n\nfor bit in range(1 << N):\n\n truth = set()\n\n false = set()\n\n ppl_truth = set()\n\n ppl_false = set()\n\n for i in range(N):\n\n if (bit >> i) & 1:\n\n ppl_truth.add(i)\n\n truth |= A[i][1]\n\n false |= A[i][0]\n\n else:\n\n ppl_false.add(i)\n\n if ppl_truth >= truth and ppl_false >= false:\n\n ans = max(ans, len(ppl_truth))\n\n\n\nprint(ans)\n","code_v0_loc":31,"code_v1_loc":25,"code_v0_num_chars":670,"code_v1_num_chars":620,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [[] for _ in range(N)]\nfor i in range(N):\n Ai = int(eval(input()))\n for _ in range(Ai):\n x, y = list(map(int, input().split()))\n A[i].append((x - 1, y))\n\n\ndef countBit(x):\n if x == 0:\n return 0\n else:\n return countBit(x >> 1) + (x & 1)\n\n\nres = 0\nfor bits in range(2**N):\n bits_ = bin(bits)\n consistency = True\n for i, testimony in enumerate(A):\n if not ((bits >> i) & 1):\n continue\n for t in testimony:\n if ((bits >> t[0]) & 1) ^ t[1]:\n consistency = False\n if consistency:\n res = max(res, countBit(bits))\nprint(res)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [[set() for _ in range(2)] for _ in range(N)]\nfor i in range(N):\n Ai = int(eval(input()))\n for _ in range(Ai):\n x, y = list(map(int, input().split()))\n A[i][y].add(x - 1)\nans = 0\nfor bit in range(1 << N):\n truth = set()\n false = set()\n ppl_truth = set()\n ppl_false = set()\n for i in range(N):\n if (bit >> i) & 1:\n ppl_truth.add(i)\n truth |= A[i][1]\n false |= A[i][0]\n else:\n ppl_false.add(i)\n if ppl_truth >= truth and ppl_false >= false:\n ans = max(ans, len(ppl_truth))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":19.3548387097,"diff":["-A = [[] for _ in range(N)]","+A = [[set() for _ in range(2)] for _ in range(N)]","- A[i].append((x - 1, y))","-","-","-def countBit(x):","- if x == 0:","- return 0","- else:","- return countBit(x >> 1) + (x & 1)","-","-","-res = 0","-for bits in range(2**N):","- bits_ = bin(bits)","- consistency = True","- for i, testimony in enumerate(A):","- if not ((bits >> i) & 1):","- continue","- for t in testimony:","- if ((bits >> t[0]) & 1) ^ t[1]:","- consistency = False","- if consistency:","- res = max(res, countBit(bits))","-print(res)","+ A[i][y].add(x - 1)","+ans = 0","+for bit in range(1 << N):","+ truth = set()","+ false = set()","+ ppl_truth = set()","+ ppl_false = set()","+ for i in range(N):","+ if (bit >> i) & 1:","+ ppl_truth.add(i)","+ truth |= A[i][1]","+ false |= A[i][0]","+ else:","+ ppl_false.add(i)","+ if ppl_truth >= truth and ppl_false >= false:","+ ans = max(ans, len(ppl_truth))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0920707312,"measured_runtime_v1":0.0437688911,"runtime_lift":2.1035655425,"key":["s566118230","s125691668"]} +{"user_id":"u729939940","problem_id":"p02802","language":"python","submission_id_v0":"s880563768","submission_id_v1":"s685816279","cpu_time_v0":131,"cpu_time_v1":89,"memory_v0":4596,"memory_v1":17992,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.06,"input":"from sys import stdin\n\ninput = stdin.readline\n\nN, M = list(map(int, input().split()))\n\nac = [False] * N\n\nwa = [0] * N\n\nwa_cnt = 0\n\nfor i in range(M):\n\n p, s = input().split()\n\n p = int(p) - 1\n\n if ac[p] is False and s == \"AC\":\n\n wa_cnt += wa[p]\n\n ac[p] = True\n\n elif s == \"WA\":\n\n wa[p] += 1\n\nprint((ac.count(True), wa_cnt))","target":"import sys\n\nN, M, *PS = sys.stdin.read().strip().split()\n\nN = int(N)\n\nac = [0] * N\n\nwa = [0] * N\n\nfor p, s in zip(*[iter(PS)] * 2):\n\n p = int(p) - 1\n\n if s == \"AC\":\n\n ac[p] = 1\n\n elif ac[p] == 0:\n\n wa[p] += 1\n\npenalties = sum([w * a for a, w in zip(ac, wa)])\n\nprint((\"{} {}\".format(sum(ac), penalties)))","code_v0_loc":15,"code_v1_loc":13,"code_v0_num_chars":328,"code_v1_num_chars":310,"code_v0_no_empty_lines":"from sys import stdin\n\ninput = stdin.readline\nN, M = list(map(int, input().split()))\nac = [False] * N\nwa = [0] * N\nwa_cnt = 0\nfor i in range(M):\n p, s = input().split()\n p = int(p) - 1\n if ac[p] is False and s == \"AC\":\n wa_cnt += wa[p]\n ac[p] = True\n elif s == \"WA\":\n wa[p] += 1\nprint((ac.count(True), wa_cnt))\n","code_v1_no_empty_lines":"import sys\n\nN, M, *PS = sys.stdin.read().strip().split()\nN = int(N)\nac = [0] * N\nwa = [0] * N\nfor p, s in zip(*[iter(PS)] * 2):\n p = int(p) - 1\n if s == \"AC\":\n ac[p] = 1\n elif ac[p] == 0:\n wa[p] += 1\npenalties = sum([w * a for a, w in zip(ac, wa)])\nprint((\"{} {}\".format(sum(ac), penalties)))\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-from sys import stdin","+import sys","-input = stdin.readline","-N, M = list(map(int, input().split()))","-ac = [False] * N","+N, M, *PS = sys.stdin.read().strip().split()","+N = int(N)","+ac = [0] * N","-wa_cnt = 0","-for i in range(M):","- p, s = input().split()","+for p, s in zip(*[iter(PS)] * 2):","- if ac[p] is False and s == \"AC\":","- wa_cnt += wa[p]","- ac[p] = True","- elif s == \"WA\":","+ if s == \"AC\":","+ ac[p] = 1","+ elif ac[p] == 0:","-print((ac.count(True), wa_cnt))","+penalties = sum([w * a for a, w in zip(ac, wa)])","+print((\"{} {}\".format(sum(ac), penalties)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0801337988,"measured_runtime_v1":0.0775251083,"runtime_lift":1.0336496207,"key":["s880563768","s685816279"]} +{"user_id":"u145950990","problem_id":"p04033","language":"python","submission_id_v0":"s964867981","submission_id_v1":"s547547209","cpu_time_v0":174,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.23,"input":"a,b = list(map(int,input().split()))\n\nif 00:\n\n print('Positive')\n\nelif b<0:\n\n if (a-b+1)%2==0:\n\n print('Positive')\n\n else:\n\n print('Negative')\n\nelse:\n\n print('Zero')","code_v0_loc":8,"code_v1_loc":10,"code_v0_num_chars":161,"code_v1_num_chars":186,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nif 0 < a:\n ans = \"Positive\"\nelif b < 0:\n ans = \"Positive\" if (b - a) % 2 == 1 else \"Negative\"\nelse:\n ans = \"Zero\"\nprint(ans)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nif a > 0:\n print(\"Positive\")\nelif b < 0:\n if (a - b + 1) % 2 == 0:\n print(\"Positive\")\n else:\n print(\"Negative\")\nelse:\n print(\"Zero\")\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-if 0 < a:","- ans = \"Positive\"","+if a > 0:","+ print(\"Positive\")","- ans = \"Positive\" if (b - a) % 2 == 1 else \"Negative\"","+ if (a - b + 1) % 2 == 0:","+ print(\"Positive\")","+ else:","+ print(\"Negative\")","- ans = \"Zero\"","-print(ans)","+ print(\"Zero\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0592636108,"measured_runtime_v1":0.0409391403,"runtime_lift":1.4476027186,"key":["s964867981","s547547209"]} +{"user_id":"u312025627","problem_id":"p02862","language":"python","submission_id_v0":"s994651952","submission_id_v1":"s170082921","cpu_time_v0":255,"cpu_time_v1":225,"memory_v0":62064,"memory_v1":54384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.76,"input":"def main():\n\n X, Y = (int(i) for i in input().split())\n\n fac = [0] * max(X, Y)\n\n finv = [0] * max(X, Y)\n\n inv = [0] * max(X, Y)\n\n MOD = (10**9) + 7\n\n\n\n def COMinit(m):\n\n fac[0] = 1\n\n finv[0] = 1\n\n if m > 1:\n\n fac[1] = 1\n\n finv[1] = 1\n\n inv[1] = 1\n\n for i in range(2, m):\n\n fac[i] = fac[i-1] * i % MOD\n\n inv[i] = MOD - inv[MOD % i] * (MOD \/\/ i) % MOD\n\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n\n\n def COM(n, k):\n\n if n < k:\n\n return 0\n\n if n < 0 or k < 0:\n\n return 0\n\n return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD\n\n\n\n COMinit(max(X, Y))\n\n if (X+Y) % 3 != 0:\n\n return print(0)\n\n n = (2*Y - X) \/\/ 3\n\n m = (2*X - Y) \/\/ 3\n\n print(COM(n+m, m))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n X, Y = (int(i) for i in input().split())\n\n if (X+Y) % 3 != 0:\n\n return print(0)\n\n m = (X + Y)\/\/3 + 3\n\n fac = [0] * m\n\n finv = [0] * m\n\n inv = [0] * m\n\n MOD = 10**9 + 7\n\n\n\n def COMBinitialize(m):\n\n fac[0] = 1\n\n finv[0] = 1\n\n if m > 1:\n\n fac[1] = 1\n\n finv[1] = 1\n\n inv[1] = 1\n\n for i in range(2, m):\n\n fac[i] = fac[i-1] * i % MOD\n\n inv[i] = MOD - inv[MOD % i] * (MOD \/\/ i) % MOD\n\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n\n\n def COMB(n, k):\n\n if n < k:\n\n return 0\n\n if n < 0 or k < 0:\n\n return 0\n\n return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD\n\n\n\n COMBinitialize(m)\n\n n = (X+Y)\/\/3\n\n k = X - n\n\n print(COMB(n, k))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":36,"code_v1_loc":37,"code_v0_num_chars":882,"code_v1_num_chars":871,"code_v0_no_empty_lines":"def main():\n X, Y = (int(i) for i in input().split())\n fac = [0] * max(X, Y)\n finv = [0] * max(X, Y)\n inv = [0] * max(X, Y)\n MOD = (10**9) + 7\n\n def COMinit(m):\n fac[0] = 1\n finv[0] = 1\n if m > 1:\n fac[1] = 1\n finv[1] = 1\n inv[1] = 1\n for i in range(2, m):\n fac[i] = fac[i - 1] * i % MOD\n inv[i] = MOD - inv[MOD % i] * (MOD \/\/ i) % MOD\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n def COM(n, k):\n if n < k:\n return 0\n if n < 0 or k < 0:\n return 0\n return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD\n\n COMinit(max(X, Y))\n if (X + Y) % 3 != 0:\n return print(0)\n n = (2 * Y - X) \/\/ 3\n m = (2 * X - Y) \/\/ 3\n print(COM(n + m, m))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n X, Y = (int(i) for i in input().split())\n if (X + Y) % 3 != 0:\n return print(0)\n m = (X + Y) \/\/ 3 + 3\n fac = [0] * m\n finv = [0] * m\n inv = [0] * m\n MOD = 10**9 + 7\n\n def COMBinitialize(m):\n fac[0] = 1\n finv[0] = 1\n if m > 1:\n fac[1] = 1\n finv[1] = 1\n inv[1] = 1\n for i in range(2, m):\n fac[i] = fac[i - 1] * i % MOD\n inv[i] = MOD - inv[MOD % i] * (MOD \/\/ i) % MOD\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n def COMB(n, k):\n if n < k:\n return 0\n if n < 0 or k < 0:\n return 0\n return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD\n\n COMBinitialize(m)\n n = (X + Y) \/\/ 3\n k = X - n\n print(COMB(n, k))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.7027027027,"diff":["- fac = [0] * max(X, Y)","- finv = [0] * max(X, Y)","- inv = [0] * max(X, Y)","- MOD = (10**9) + 7","+ if (X + Y) % 3 != 0:","+ return print(0)","+ m = (X + Y) \/\/ 3 + 3","+ fac = [0] * m","+ finv = [0] * m","+ inv = [0] * m","+ MOD = 10**9 + 7","- def COMinit(m):","+ def COMBinitialize(m):","- def COM(n, k):","+ def COMB(n, k):","- COMinit(max(X, Y))","- if (X + Y) % 3 != 0:","- return print(0)","- n = (2 * Y - X) \/\/ 3","- m = (2 * X - Y) \/\/ 3","- print(COM(n + m, m))","+ COMBinitialize(m)","+ n = (X + Y) \/\/ 3","+ k = X - n","+ print(COMB(n, k))"],"diff_only_import_comment":false,"measured_runtime_v0":0.514114511,"measured_runtime_v1":0.374924181,"runtime_lift":1.3712492741,"key":["s994651952","s170082921"]} +{"user_id":"u905203728","problem_id":"p03634","language":"python","submission_id_v0":"s173983963","submission_id_v1":"s822165239","cpu_time_v0":1509,"cpu_time_v1":1124,"memory_v0":126680,"memory_v1":123612,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.51,"input":"import heapq\n\n\n\n\n\ndef dijkstra(s):\n\n inf=float(\"inf\")\n\n color=[\"white\" for _ in range(n)]\n\n D=[inf for _ in range(n)]\n\n\n\n M=[[] for _ in range(n)]\n\n for a,b,c in ABC:\n\n M[a-1].append([b-1,c])\n\n M[b-1].append([a-1,c])\n\n\n\n D[s]=0\n\n\n\n H=[(0,s)]\n\n heapq.heapify(H)\n\n\n\n while len(H)>=1:\n\n u=heapq.heappop(H)[1]\n\n if color[u]==\"black\":continue\n\n color[u]=\"black\"\n\n\n\n V=[(i,j) for i,j in M[u] if color[i]!=\"black\"]\n\n while len(V)!=0:\n\n for i,j in V:\n\n if D[u]+j=1:\n\n u=heapq.heappop(H)[1]\n\n if color[u]==\"black\":continue\n\n color[u]=\"black\"\n\n\n\n V=[(i,j) for i,j in M[u] if color[i]!=\"black\"]\n\n while len(V)!=0:\n\n for i,j in V:\n\n if D[u]+j= 1:\n u = heapq.heappop(H)[1]\n if color[u] == \"black\":\n continue\n color[u] = \"black\"\n V = [(i, j) for i, j in M[u] if color[i] != \"black\"]\n while len(V) != 0:\n for i, j in V:\n if D[u] + j < D[i]:\n D[i] = D[u] + j\n color[i] = \"gray\"\n heapq.heappush(H, (D[i], i))\n break\n return D\n\n\nn = int(eval(input()))\nABC = [list(map(int, input().split())) for _ in range(n - 1)]\nq, k = list(map(int, input().split()))\nXY = [list(map(int, input().split())) for _ in range(q)]\nD = dijkstra(k - 1)\nfor x, y in XY:\n print((D[x - 1] + D[y - 1]))\n","code_v1_no_empty_lines":"import heapq\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef dijkstra(s):\n inf = float(\"inf\")\n color = [\"white\" for _ in range(n)]\n D = [inf for _ in range(n)]\n M = [[] for _ in range(n)]\n for a, b, c in ABC:\n M[a - 1].append([b - 1, c])\n M[b - 1].append([a - 1, c])\n D[s] = 0\n H = [(0, s)]\n heapq.heapify(H)\n while len(H) >= 1:\n u = heapq.heappop(H)[1]\n if color[u] == \"black\":\n continue\n color[u] = \"black\"\n V = [(i, j) for i, j in M[u] if color[i] != \"black\"]\n while len(V) != 0:\n for i, j in V:\n if D[u] + j < D[i]:\n D[i] = D[u] + j\n color[i] = \"gray\"\n heapq.heappush(H, (D[i], i))\n break\n return D\n\n\nn = int(eval(input()))\nABC = [list(map(int, input().split())) for _ in range(n - 1)]\nq, k = list(map(int, input().split()))\nXY = [list(map(int, input().split())) for _ in range(q)]\nD = dijkstra(k - 1)\nfor x, y in XY:\n print((D[x - 1] + D[y - 1]))\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.0714920664,"measured_runtime_v1":0.0388417161,"runtime_lift":1.8406000979,"key":["s173983963","s822165239"]} +{"user_id":"u285891772","problem_id":"p02939","language":"python","submission_id_v0":"s992723355","submission_id_v1":"s546099631","cpu_time_v0":268,"cpu_time_v1":207,"memory_v0":40784,"memory_v1":40852,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.76,"input":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\n#from decimal import *\n\n\n\nS = eval(input())\n\nN = len(S)\n\n\n\ndp = [[0, 0] for _ in range(N+1)]\n\ndp[1][0] = 1\n\n\n\nfor i in range(2, N+1):\n\n\tif S[i-1] != S[i-2]:\n\n\t\tdp[i][0] = dp[i-1][0] + 1\n\n\n\n\tdp[i][0] = max(dp[i][0], dp[i-1][1] + 1)\n\n\tdp[i][1] = dp[i-2][0] + 1\n\n\n\nprint((dp[-1][0]))","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\n#from decimal import *\n\n\n\nS = eval(input())\n\nN = len(S)\n\n\n\ndp = [[0, 0] for _ in range(N+1)]\n\ndp[1][0] = 1\n\n \n\nfor i in range(2, N+1):\n\n\tif S[i-1] != S[i-2]:\n\n\t\tdp[i][0] = dp[i-1][0] + 1\n\n\telse:\n\n\t\tdp[i][0] = dp[i-1][1] + 1\n\n\n\n\tdp[i][1] = dp[i-2][0] + 1\n\n\t#print(dp)\n\n\n\nprint((dp[-1][0]))","code_v0_loc":35,"code_v1_loc":37,"code_v0_num_chars":1142,"code_v1_num_chars":1150,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n) # , log2\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# from decimal import *\nS = eval(input())\nN = len(S)\ndp = [[0, 0] for _ in range(N + 1)]\ndp[1][0] = 1\nfor i in range(2, N + 1):\n if S[i - 1] != S[i - 2]:\n dp[i][0] = dp[i - 1][0] + 1\n dp[i][0] = max(dp[i][0], dp[i - 1][1] + 1)\n dp[i][1] = dp[i - 2][0] + 1\nprint((dp[-1][0]))\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n) # , log2\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# from decimal import *\nS = eval(input())\nN = len(S)\ndp = [[0, 0] for _ in range(N + 1)]\ndp[1][0] = 1\nfor i in range(2, N + 1):\n if S[i - 1] != S[i - 2]:\n dp[i][0] = dp[i - 1][0] + 1\n else:\n dp[i][0] = dp[i - 1][1] + 1\n dp[i][1] = dp[i - 2][0] + 1\n # print(dp)\nprint((dp[-1][0]))\n","code_same":false,"relative_loc_diff_percent":5.4054054054,"diff":["- dp[i][0] = max(dp[i][0], dp[i - 1][1] + 1)","+ else:","+ dp[i][0] = dp[i - 1][1] + 1","+ # print(dp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443127043,"measured_runtime_v1":0.0477780617,"runtime_lift":0.9274696949,"key":["s992723355","s546099631"]} +{"user_id":"u475503988","problem_id":"p02624","language":"python","submission_id_v0":"s757582473","submission_id_v1":"s032091018","cpu_time_v0":2230,"cpu_time_v1":585,"memory_v0":9148,"memory_v1":109120,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.77,"input":"n = int(eval(input()))\n\nans = 0\n\nfor i in range(1,n+1):\n\n tmp = n\/\/i\n\n ans += (tmp*(tmp+1)\/\/2)*i\n\nprint(ans)","target":"import numba\n\n\n\n@numba.njit\n\ndef main(n):\n\n ans = 0\n\n for k in range(1, n+1):\n\n for f in range(1,n\/\/k+1):\n\n ans += k*f\n\n return ans\n\n\n\nn = int(eval(input()))\n\nprint((main(n)))","code_v0_loc":6,"code_v1_loc":12,"code_v0_num_chars":108,"code_v1_num_chars":194,"code_v0_no_empty_lines":"n = int(eval(input()))\nans = 0\nfor i in range(1, n + 1):\n tmp = n \/\/ i\n ans += (tmp * (tmp + 1) \/\/ 2) * i\nprint(ans)\n","code_v1_no_empty_lines":"import numba\n\n\n@numba.njit\ndef main(n):\n ans = 0\n for k in range(1, n + 1):\n for f in range(1, n \/\/ k + 1):\n ans += k * f\n return ans\n\n\nn = int(eval(input()))\nprint((main(n)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["+import numba","+","+","+@numba.njit","+def main(n):","+ ans = 0","+ for k in range(1, n + 1):","+ for f in range(1, n \/\/ k + 1):","+ ans += k * f","+ return ans","+","+","-ans = 0","-for i in range(1, n + 1):","- tmp = n \/\/ i","- ans += (tmp * (tmp + 1) \/\/ 2) * i","-print(ans)","+print((main(n)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.7486971855,"measured_runtime_v1":0.0377235892,"runtime_lift":19.846923412,"key":["s757582473","s032091018"]} +{"user_id":"u316386814","problem_id":"p03108","language":"python","submission_id_v0":"s722199230","submission_id_v1":"s963642780","cpu_time_v0":1203,"cpu_time_v1":851,"memory_v0":37676,"memory_v1":27428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.26,"input":"from collections import Counter, defaultdict, deque\n\n\n\nclass UnionFind(object):\n\n \"\"\"Union find tree.\"\"\"\n\n def __init__(self, nodes):\n\n self.par = list(range(nodes + 1))\n\n self.sizes = [1] * (nodes + 1)\n\n\n\n def root(self, key):\n\n if key != self.par[key]:\n\n k0 = key\n\n while k0 != self.par[k0]:\n\n k0 = self.par[k0]\n\n self.par[key] = k0\n\n return self.par[key]\n\n\n\n def merge(self, a, b):\n\n ra = self.root(a)\n\n rb = self.root(b)\n\n if ra != rb:\n\n sa = self.sizes[ra]\n\n sb = self.sizes[rb]\n\n self.par[ra] = rb\n\n self.sizes[rb] += sa\n\n return sa * sb\n\n return 0\n\n\n\nN, M = list(map(int, input().split()))\n\nAB = []\n\nfor _ in range(M):\n\n AB.append(list(map(int, input().split())))\n\n\n\nuni = UnionFind(N)\n\ncomb = N * (N - 1) \/\/ 2\n\nanses = [comb]\n\nfor a, b in AB[-1:0:-1]:\n\n red = uni.merge(a, b)\n\n comb -= red\n\n anses.append(comb)\n\n\n\nfor ans in reversed(anses):\n\n print(ans)","target":"from collections import Counter, defaultdict, deque\n\n\n\nclass UnionFind(object):\n\n \"\"\"Union find tree.\"\"\"\n\n def __init__(self, nodes):\n\n self.par = [-1] * nodes\n\n\n\n def root(self, key):\n\n if self.par[key] < 0:\n\n return key\n\n self.par[key] = self.root(self.par[key])\n\n return self.par[key]\n\n\n\n def size(self, key):\n\n return -self.par[self.root(key)]\n\n\n\n def merge(self, a, b):\n\n a = self.root(a)\n\n b = self.root(b)\n\n if a == b:\n\n return\n\n if self.size(a) < self.size(b):\n\n a, b = b, a\n\n self.par[a] += self.par[b]\n\n self.par[b] = a\n\n\n\nN, M = map(int, input().split())\n\nAB = []\n\nfor _ in range(M):\n\n a, b = map(int, input().split())\n\n a -= 1\n\n b -= 1\n\n AB.append([a, b])\n\n\n\nuni = UnionFind(N)\n\nans = [0] * M\n\nans[-1] = N * (N - 1) \/\/ 2\n\nfor i, (a, b) in enumerate(AB[-1:0:-1], 1):\n\n ans[-i - 1] = ans[-i]\n\n if uni.root(a) != uni.root(b):\n\n ans[-i - 1] -= uni.size(a) * uni.size(b)\n\n uni.merge(a, b)\n\n\n\nprint(*ans, sep='\\n')\n","code_v0_loc":42,"code_v1_loc":44,"code_v0_num_chars":1042,"code_v1_num_chars":1077,"code_v0_no_empty_lines":"from collections import Counter, defaultdict, deque\n\n\nclass UnionFind(object):\n \"\"\"Union find tree.\"\"\"\n\n def __init__(self, nodes):\n self.par = list(range(nodes + 1))\n self.sizes = [1] * (nodes + 1)\n\n def root(self, key):\n if key != self.par[key]:\n k0 = key\n while k0 != self.par[k0]:\n k0 = self.par[k0]\n self.par[key] = k0\n return self.par[key]\n\n def merge(self, a, b):\n ra = self.root(a)\n rb = self.root(b)\n if ra != rb:\n sa = self.sizes[ra]\n sb = self.sizes[rb]\n self.par[ra] = rb\n self.sizes[rb] += sa\n return sa * sb\n return 0\n\n\nN, M = list(map(int, input().split()))\nAB = []\nfor _ in range(M):\n AB.append(list(map(int, input().split())))\nuni = UnionFind(N)\ncomb = N * (N - 1) \/\/ 2\nanses = [comb]\nfor a, b in AB[-1:0:-1]:\n red = uni.merge(a, b)\n comb -= red\n anses.append(comb)\nfor ans in reversed(anses):\n print(ans)\n","code_v1_no_empty_lines":"from collections import Counter, defaultdict, deque\n\n\nclass UnionFind(object):\n \"\"\"Union find tree.\"\"\"\n\n def __init__(self, nodes):\n self.par = [-1] * nodes\n\n def root(self, key):\n if self.par[key] < 0:\n return key\n self.par[key] = self.root(self.par[key])\n return self.par[key]\n\n def size(self, key):\n return -self.par[self.root(key)]\n\n def merge(self, a, b):\n a = self.root(a)\n b = self.root(b)\n if a == b:\n return\n if self.size(a) < self.size(b):\n a, b = b, a\n self.par[a] += self.par[b]\n self.par[b] = a\n\n\nN, M = map(int, input().split())\nAB = []\nfor _ in range(M):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n AB.append([a, b])\nuni = UnionFind(N)\nans = [0] * M\nans[-1] = N * (N - 1) \/\/ 2\nfor i, (a, b) in enumerate(AB[-1:0:-1], 1):\n ans[-i - 1] = ans[-i]\n if uni.root(a) != uni.root(b):\n ans[-i - 1] -= uni.size(a) * uni.size(b)\n uni.merge(a, b)\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["- self.par = list(range(nodes + 1))","- self.sizes = [1] * (nodes + 1)","+ self.par = [-1] * nodes","- if key != self.par[key]:","- k0 = key","- while k0 != self.par[k0]:","- k0 = self.par[k0]","- self.par[key] = k0","+ if self.par[key] < 0:","+ return key","+ self.par[key] = self.root(self.par[key])","+ def size(self, key):","+ return -self.par[self.root(key)]","+","- ra = self.root(a)","- rb = self.root(b)","- if ra != rb:","- sa = self.sizes[ra]","- sb = self.sizes[rb]","- self.par[ra] = rb","- self.sizes[rb] += sa","- return sa * sb","- return 0","+ a = self.root(a)","+ b = self.root(b)","+ if a == b:","+ return","+ if self.size(a) < self.size(b):","+ a, b = b, a","+ self.par[a] += self.par[b]","+ self.par[b] = a","-N, M = list(map(int, input().split()))","+N, M = map(int, input().split())","- AB.append(list(map(int, input().split())))","+ a, b = map(int, input().split())","+ a -= 1","+ b -= 1","+ AB.append([a, b])","-comb = N * (N - 1) \/\/ 2","-anses = [comb]","-for a, b in AB[-1:0:-1]:","- red = uni.merge(a, b)","- comb -= red","- anses.append(comb)","-for ans in reversed(anses):","- print(ans)","+ans = [0] * M","+ans[-1] = N * (N - 1) \/\/ 2","+for i, (a, b) in enumerate(AB[-1:0:-1], 1):","+ ans[-i - 1] = ans[-i]","+ if uni.root(a) != uni.root(b):","+ ans[-i - 1] -= uni.size(a) * uni.size(b)","+ uni.merge(a, b)","+print(*ans, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0359763319,"measured_runtime_v1":0.0800325072,"runtime_lift":0.4495214909,"key":["s722199230","s963642780"]} +{"user_id":"u952708174","problem_id":"p03044","language":"python","submission_id_v0":"s483724582","submission_id_v1":"s974437802","cpu_time_v0":701,"cpu_time_v1":595,"memory_v0":109680,"memory_v1":67068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.12,"input":"def d_even_relation_dfs(N, Nodes): # DFS\u306b\u3088\u308b\n\n import sys\n\n sys.setrecursionlimit(10**6)\n\n graph = [[] for _ in range(N)]\n\n for u, v, w in Nodes: # 0-based\u3068\u3059\u308b\n\n graph[u - 1].append((v - 1, w))\n\n graph[v - 1].append((u - 1, w))\n\n\n\n def distance_from_root(parent, current, distance, ret=[0] * N): # \u6839(\u9802\u70b90)\u304b\u3089\u5404\u9802\u70b9\u3078\u306e\u8ddd\u96e2\n\n def dfs(p, c, d):\n\n ret[c] = d\n\n for next_edge, dist in graph[c]:\n\n if next_edge != p: # \u6728\u3092\u300c\u9006\u623b\u308a\u300d\u3057\u306a\u3044\u9802\u70b9\u3060\u3051\u8abf\u3079\u308b\n\n dfs(c, next_edge, d + dist)\n\n dfs(parent, current, distance)\n\n return ret\n\n ans = (1 if d % 2 == 0 else 0 for d in distance_from_root(-1, 0, 0)) # \u6839\u306e\u89aa\u306f-1\u756a\u3068\u3059\u308b\n\n return ' '.join(map(str, ans))\n\n\n\nN = int(eval(input()))\n\nNodes = [[int(i) for i in input().split()] for j in range(N - 1)]\n\nprint((d_even_relation_dfs(N, Nodes)))","target":"def d_even_relation_bfs():\n\n from collections import deque\n\n N = int(eval(input()))\n\n Edges = [[int(i) for i in input().split()] for j in range(N - 1)]\n\n\n\n graph = [[] for _ in range(N)]\n\n for u, v, w in Edges: # \u9802\u70b9\u306f 0-indexed \u3068\u3059\u308b\n\n graph[u - 1].append((v - 1, w))\n\n graph[v - 1].append((u - 1, w))\n\n distance_from_root = [0] * N # \u6839\u306f\u9802\u70b9 0 \u3068\u3059\u308b\n\n\n\n queue = deque([(-1, 0, 0)]) # \u89aa\u3068\u73fe\u5728\u306e\u9802\u70b9\u756a\u53f7\uff0c\u6839\u304b\u3089\u89aa\u307e\u3067\u306e\u8ddd\u96e2\n\n while queue:\n\n parent, current, distance = queue.pop()\n\n distance_from_root[current] = distance\n\n for next_vertex, dist in graph[current]:\n\n if parent != next_vertex: # \u6728\u3092\u300c\u9006\u623b\u308a\u300d\u3057\u306a\u3044\u9802\u70b9\u3060\u3051\u8abf\u3079\u308b\n\n queue.appendleft((current, next_vertex, distance + dist))\n\n ans = (1 if d % 2 == 0 else 0 for d in distance_from_root)\n\n return ' '.join(map(str, ans))\n\n\n\nprint((d_even_relation_bfs()))","code_v0_loc":22,"code_v1_loc":22,"code_v0_num_chars":855,"code_v1_num_chars":860,"code_v0_no_empty_lines":"def d_even_relation_dfs(N, Nodes): # DFS\u306b\u3088\u308b\n import sys\n\n sys.setrecursionlimit(10**6)\n graph = [[] for _ in range(N)]\n for u, v, w in Nodes: # 0-based\u3068\u3059\u308b\n graph[u - 1].append((v - 1, w))\n graph[v - 1].append((u - 1, w))\n\n def distance_from_root(parent, current, distance, ret=[0] * N): # \u6839(\u9802\u70b90)\u304b\u3089\u5404\u9802\u70b9\u3078\u306e\u8ddd\u96e2\n def dfs(p, c, d):\n ret[c] = d\n for next_edge, dist in graph[c]:\n if next_edge != p: # \u6728\u3092\u300c\u9006\u623b\u308a\u300d\u3057\u306a\u3044\u9802\u70b9\u3060\u3051\u8abf\u3079\u308b\n dfs(c, next_edge, d + dist)\n\n dfs(parent, current, distance)\n return ret\n\n ans = (1 if d % 2 == 0 else 0 for d in distance_from_root(-1, 0, 0)) # \u6839\u306e\u89aa\u306f-1\u756a\u3068\u3059\u308b\n return \" \".join(map(str, ans))\n\n\nN = int(eval(input()))\nNodes = [[int(i) for i in input().split()] for j in range(N - 1)]\nprint((d_even_relation_dfs(N, Nodes)))\n","code_v1_no_empty_lines":"def d_even_relation_bfs():\n from collections import deque\n\n N = int(eval(input()))\n Edges = [[int(i) for i in input().split()] for j in range(N - 1)]\n graph = [[] for _ in range(N)]\n for u, v, w in Edges: # \u9802\u70b9\u306f 0-indexed \u3068\u3059\u308b\n graph[u - 1].append((v - 1, w))\n graph[v - 1].append((u - 1, w))\n distance_from_root = [0] * N # \u6839\u306f\u9802\u70b9 0 \u3068\u3059\u308b\n queue = deque([(-1, 0, 0)]) # \u89aa\u3068\u73fe\u5728\u306e\u9802\u70b9\u756a\u53f7\uff0c\u6839\u304b\u3089\u89aa\u307e\u3067\u306e\u8ddd\u96e2\n while queue:\n parent, current, distance = queue.pop()\n distance_from_root[current] = distance\n for next_vertex, dist in graph[current]:\n if parent != next_vertex: # \u6728\u3092\u300c\u9006\u623b\u308a\u300d\u3057\u306a\u3044\u9802\u70b9\u3060\u3051\u8abf\u3079\u308b\n queue.appendleft((current, next_vertex, distance + dist))\n ans = (1 if d % 2 == 0 else 0 for d in distance_from_root)\n return \" \".join(map(str, ans))\n\n\nprint((d_even_relation_bfs()))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-def d_even_relation_dfs(N, Nodes): # DFS\u306b\u3088\u308b","- import sys","+def d_even_relation_bfs():","+ from collections import deque","- sys.setrecursionlimit(10**6)","+ N = int(eval(input()))","+ Edges = [[int(i) for i in input().split()] for j in range(N - 1)]","- for u, v, w in Nodes: # 0-based\u3068\u3059\u308b","+ for u, v, w in Edges: # \u9802\u70b9\u306f 0-indexed \u3068\u3059\u308b","-","- def distance_from_root(parent, current, distance, ret=[0] * N): # \u6839(\u9802\u70b90)\u304b\u3089\u5404\u9802\u70b9\u3078\u306e\u8ddd\u96e2","- def dfs(p, c, d):","- ret[c] = d","- for next_edge, dist in graph[c]:","- if next_edge != p: # \u6728\u3092\u300c\u9006\u623b\u308a\u300d\u3057\u306a\u3044\u9802\u70b9\u3060\u3051\u8abf\u3079\u308b","- dfs(c, next_edge, d + dist)","-","- dfs(parent, current, distance)","- return ret","-","- ans = (1 if d % 2 == 0 else 0 for d in distance_from_root(-1, 0, 0)) # \u6839\u306e\u89aa\u306f-1\u756a\u3068\u3059\u308b","+ distance_from_root = [0] * N # \u6839\u306f\u9802\u70b9 0 \u3068\u3059\u308b","+ queue = deque([(-1, 0, 0)]) # \u89aa\u3068\u73fe\u5728\u306e\u9802\u70b9\u756a\u53f7\uff0c\u6839\u304b\u3089\u89aa\u307e\u3067\u306e\u8ddd\u96e2","+ while queue:","+ parent, current, distance = queue.pop()","+ distance_from_root[current] = distance","+ for next_vertex, dist in graph[current]:","+ if parent != next_vertex: # \u6728\u3092\u300c\u9006\u623b\u308a\u300d\u3057\u306a\u3044\u9802\u70b9\u3060\u3051\u8abf\u3079\u308b","+ queue.appendleft((current, next_vertex, distance + dist))","+ ans = (1 if d % 2 == 0 else 0 for d in distance_from_root)","-N = int(eval(input()))","-Nodes = [[int(i) for i in input().split()] for j in range(N - 1)]","-print((d_even_relation_dfs(N, Nodes)))","+print((d_even_relation_bfs()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.085111255,"measured_runtime_v1":0.0394264573,"runtime_lift":2.1587345342,"key":["s483724582","s974437802"]} +{"user_id":"u127157764","problem_id":"p02615","language":"python","submission_id_v0":"s074318738","submission_id_v1":"s066492551","cpu_time_v0":155,"cpu_time_v1":127,"memory_v0":32684,"memory_v1":31668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.06,"input":"import math\n\n\n\nn = int(eval(input()))\n\nf = list(map(int,input().split()))\n\nf.sort()\n\nans = 0\n\n\n\nfor i in range(1,n):\n\n ans += f[n-math.floor(i\/2)-1]\n\n\n\nprint(ans)","target":"n = int(eval(input()))\n\nf = list(map(int,input().split()))\n\nf.sort(reverse = True)\n\nans = 0\n\nif n%2 == 0:\n\n for i in range(n\/\/2):\n\n ans += f[i] * 2\n\n ans -= f[0]\n\nelse:\n\n for i in range(n\/\/2):\n\n ans += f[i] * 2\n\n ans += f[n\/\/2]-f[0]\n\n\n\nprint(ans)\n","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":159,"code_v1_num_chars":267,"code_v0_no_empty_lines":"import math\n\nn = int(eval(input()))\nf = list(map(int, input().split()))\nf.sort()\nans = 0\nfor i in range(1, n):\n ans += f[n - math.floor(i \/ 2) - 1]\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nf = list(map(int, input().split()))\nf.sort(reverse=True)\nans = 0\nif n % 2 == 0:\n for i in range(n \/\/ 2):\n ans += f[i] * 2\n ans -= f[0]\nelse:\n for i in range(n \/\/ 2):\n ans += f[i] * 2\n ans += f[n \/\/ 2] - f[0]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-import math","-","-f.sort()","+f.sort(reverse=True)","-for i in range(1, n):","- ans += f[n - math.floor(i \/ 2) - 1]","+if n % 2 == 0:","+ for i in range(n \/\/ 2):","+ ans += f[i] * 2","+ ans -= f[0]","+else:","+ for i in range(n \/\/ 2):","+ ans += f[i] * 2","+ ans += f[n \/\/ 2] - f[0]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0366725402,"measured_runtime_v1":0.0365077913,"runtime_lift":1.0045127051,"key":["s074318738","s066492551"]} +{"user_id":"u281303342","problem_id":"p03107","language":"python","submission_id_v0":"s655477241","submission_id_v1":"s110342702","cpu_time_v0":30,"cpu_time_v1":18,"memory_v0":3316,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.0,"input":"S = eval(input())\n\ncnt0,cnt1 = 0,0\n\nfor s in S:\n\n if s==\"0\":\n\n cnt0 += 1\n\n else:\n\n cnt1 += 1\n\nprint((min(cnt0,cnt1)*2))","target":"# Python3 (3.4.3)\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\n# -------------------------------------------------------------\n\n# function\n\n# -------------------------------------------------------------\n\n\n\n\n\n# -------------------------------------------------------------\n\n# main\n\n# -------------------------------------------------------------\n\nS = input().rstrip()\n\n\n\nr = S.count(\"0\")\n\nb = S.count(\"1\")\n\n\n\nprint((min(r,b)*2))","code_v0_loc":8,"code_v1_loc":18,"code_v0_num_chars":131,"code_v1_num_chars":424,"code_v0_no_empty_lines":"S = eval(input())\ncnt0, cnt1 = 0, 0\nfor s in S:\n if s == \"0\":\n cnt0 += 1\n else:\n cnt1 += 1\nprint((min(cnt0, cnt1) * 2))\n","code_v1_no_empty_lines":"# Python3 (3.4.3)\nimport sys\n\ninput = sys.stdin.readline\n# -------------------------------------------------------------\n# function\n# -------------------------------------------------------------\n# -------------------------------------------------------------\n# main\n# -------------------------------------------------------------\nS = input().rstrip()\nr = S.count(\"0\")\nb = S.count(\"1\")\nprint((min(r, b) * 2))\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-S = eval(input())","-cnt0, cnt1 = 0, 0","-for s in S:","- if s == \"0\":","- cnt0 += 1","- else:","- cnt1 += 1","-print((min(cnt0, cnt1) * 2))","+# Python3 (3.4.3)","+import sys","+","+input = sys.stdin.readline","+# function","+# main","+S = input().rstrip()","+r = S.count(\"0\")","+b = S.count(\"1\")","+print((min(r, b) * 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0318013895,"measured_runtime_v1":0.035420893,"runtime_lift":0.8978144478,"key":["s655477241","s110342702"]} +{"user_id":"u186838327","problem_id":"p03578","language":"python","submission_id_v0":"s660682431","submission_id_v1":"s535398496","cpu_time_v0":290,"cpu_time_v1":194,"memory_v0":56672,"memory_v1":137680,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.1,"input":"n = int(eval(input()))\n\nD = list(map(int, input().split()))\n\nm = int(eval(input()))\n\nT = list(map(int, input().split()))\n\n\n\nd1 = {}\n\nfor d in D:\n\n if d not in d1:\n\n d1[d] = 1\n\n else:\n\n d1[d] += 1\n\nd2 = {}\n\nfor t in T:\n\n if t not in d2:\n\n d2[t] = 1\n\n else:\n\n d2[t] += 1\n\n\n\nfor k2, v2 in list(d2.items()):\n\n if k2 not in d1:\n\n print('NO')\n\n exit()\n\n else:\n\n v1 = d1[k2]\n\n if v1 < v2:\n\n print('NO')\n\n exit()\n\nelse:\n\n print('YES')\n","target":"n= int(eval(input()))\n\nD = list(map(int, input().split()))\n\nm = int(eval(input()))\n\nT = list(map(int, input().split()))\n\n\n\nfrom collections import Counter\n\nC = Counter(D)\n\nfor t in T:\n\n if t not in C:\n\n print('NO')\n\n exit()\n\n else:\n\n if C[t] == 0:\n\n print('NO')\n\n exit()\n\n else:\n\n C[t] -= 1\n\nelse:\n\n print('YES')\n","code_v0_loc":29,"code_v1_loc":19,"code_v0_num_chars":508,"code_v1_num_chars":371,"code_v0_no_empty_lines":"n = int(eval(input()))\nD = list(map(int, input().split()))\nm = int(eval(input()))\nT = list(map(int, input().split()))\nd1 = {}\nfor d in D:\n if d not in d1:\n d1[d] = 1\n else:\n d1[d] += 1\nd2 = {}\nfor t in T:\n if t not in d2:\n d2[t] = 1\n else:\n d2[t] += 1\nfor k2, v2 in list(d2.items()):\n if k2 not in d1:\n print(\"NO\")\n exit()\n else:\n v1 = d1[k2]\n if v1 < v2:\n print(\"NO\")\n exit()\nelse:\n print(\"YES\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\nD = list(map(int, input().split()))\nm = int(eval(input()))\nT = list(map(int, input().split()))\nfrom collections import Counter\n\nC = Counter(D)\nfor t in T:\n if t not in C:\n print(\"NO\")\n exit()\n else:\n if C[t] == 0:\n print(\"NO\")\n exit()\n else:\n C[t] -= 1\nelse:\n print(\"YES\")\n","code_same":false,"relative_loc_diff_percent":34.4827586207,"diff":["-d1 = {}","-for d in D:","- if d not in d1:","- d1[d] = 1","- else:","- d1[d] += 1","-d2 = {}","+from collections import Counter","+","+C = Counter(D)","- if t not in d2:","- d2[t] = 1","- else:","- d2[t] += 1","-for k2, v2 in list(d2.items()):","- if k2 not in d1:","+ if t not in C:","- v1 = d1[k2]","- if v1 < v2:","+ if C[t] == 0:","+ else:","+ C[t] -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0716374366,"measured_runtime_v1":0.0670320961,"runtime_lift":1.0687035127,"key":["s660682431","s535398496"]} +{"user_id":"u945405878","problem_id":"p02899","language":"python","submission_id_v0":"s805905113","submission_id_v1":"s615780042","cpu_time_v0":762,"cpu_time_v1":230,"memory_v0":23504,"memory_v1":30320,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.82,"input":"import numpy as np\n\n\n\nN = int(eval(input()))\n\nA = [int(_) for _ in input().split(\" \")]\n\n\n\nans = np.argsort(A)\n\n\n\nfor i in range(N):\n\n print((ans[i] + 1))","target":"import numpy as np\n\n\n\nN = int(eval(input()))\n\nA = [int(_) for _ in input().split(\" \")]\n\n\n\ntmp = np.argsort(A)\n\ntmp2= tmp + np.ones(N)\n\ntmp3 = [int(_) for _ in tmp2.tolist()]\n\nans = [str(_) for _ in tmp3]\n\n\n\nprint((\" \".join(ans)))","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":148,"code_v1_num_chars":221,"code_v0_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = [int(_) for _ in input().split(\" \")]\nans = np.argsort(A)\nfor i in range(N):\n print((ans[i] + 1))\n","code_v1_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = [int(_) for _ in input().split(\" \")]\ntmp = np.argsort(A)\ntmp2 = tmp + np.ones(N)\ntmp3 = [int(_) for _ in tmp2.tolist()]\nans = [str(_) for _ in tmp3]\nprint((\" \".join(ans)))\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-ans = np.argsort(A)","-for i in range(N):","- print((ans[i] + 1))","+tmp = np.argsort(A)","+tmp2 = tmp + np.ones(N)","+tmp3 = [int(_) for _ in tmp2.tolist()]","+ans = [str(_) for _ in tmp3]","+print((\" \".join(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1579349376,"measured_runtime_v1":0.3006343268,"runtime_lift":0.5253390031,"key":["s805905113","s615780042"]} +{"user_id":"u785220618","problem_id":"p03014","language":"python","submission_id_v0":"s710876818","submission_id_v1":"s958988841","cpu_time_v0":1810,"cpu_time_v1":1078,"memory_v0":309512,"memory_v1":179844,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.44,"input":"h, w = list(map(int, input().split()))\n\nS = [list(eval(input())) for _ in range(h)]\n\nL = [[0] * w for _ in range(h)]\n\nR = [[0] * w for _ in range(h)]\n\nU = [[0] * w for _ in range(h)]\n\nD = [[0] * w for _ in range(h)]\n\nfor i in range(h):\n\n for j in range(w):\n\n if S[i][j] == '.':\n\n if j == 0:\n\n L[i][j] = 1\n\n else:\n\n L[i][j] = L[i][j-1] + 1\n\n for j in reversed(list(range(w))):\n\n if S[i][j] == '.':\n\n if j == w-1:\n\n R[i][j] = 1\n\n else:\n\n R[i][j] = R[i][j+1] + 1\n\nfor j in range(w):\n\n for i in range(h):\n\n if S[i][j] == '.':\n\n if i == 0:\n\n U[i][j] = 1\n\n else:\n\n U[i][j] = U[i-1][j] + 1\n\n for i in reversed(list(range(h))):\n\n if S[i][j] == '.':\n\n if i == h-1:\n\n D[i][j] = 1\n\n else:\n\n D[i][j] = D[i+1][j] + 1\n\nans = 0\n\nfor i in range(h):\n\n for j in range(w):\n\n ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)\n\nprint(ans)\n","target":"h, w = list(map(int, input().split()))\n\nS = [eval(input()) for _ in range(h)]\n\nL = [[0] * w for _ in range(h)]\n\nR = [[0] * w for _ in range(h)]\n\nU = [[0] * w for _ in range(h)]\n\nD = [[0] * w for _ in range(h)]\n\nfor i in range(h):\n\n for j in range(w):\n\n if S[i][j] == '.':\n\n if j == 0:\n\n L[i][j] = 1\n\n else:\n\n L[i][j] = L[i][j-1] + 1\n\n for j in reversed(list(range(w))):\n\n if S[i][j] == '.':\n\n if j == w-1:\n\n R[i][j] = 1\n\n else:\n\n R[i][j] = R[i][j+1] + 1\n\nfor j in range(w):\n\n for i in range(h):\n\n if S[i][j] == '.':\n\n if i == 0:\n\n U[i][j] = 1\n\n else:\n\n U[i][j] = U[i-1][j] + 1\n\n for i in reversed(list(range(h))):\n\n if S[i][j] == '.':\n\n if i == h-1:\n\n D[i][j] = 1\n\n else:\n\n D[i][j] = D[i+1][j] + 1\n\nans = 0\n\nfor i in range(h):\n\n for j in range(w):\n\n ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)\n\nprint(ans)\n","code_v0_loc":37,"code_v1_loc":37,"code_v0_num_chars":1060,"code_v1_num_chars":1054,"code_v0_no_empty_lines":"h, w = list(map(int, input().split()))\nS = [list(eval(input())) for _ in range(h)]\nL = [[0] * w for _ in range(h)]\nR = [[0] * w for _ in range(h)]\nU = [[0] * w for _ in range(h)]\nD = [[0] * w for _ in range(h)]\nfor i in range(h):\n for j in range(w):\n if S[i][j] == \".\":\n if j == 0:\n L[i][j] = 1\n else:\n L[i][j] = L[i][j - 1] + 1\n for j in reversed(list(range(w))):\n if S[i][j] == \".\":\n if j == w - 1:\n R[i][j] = 1\n else:\n R[i][j] = R[i][j + 1] + 1\nfor j in range(w):\n for i in range(h):\n if S[i][j] == \".\":\n if i == 0:\n U[i][j] = 1\n else:\n U[i][j] = U[i - 1][j] + 1\n for i in reversed(list(range(h))):\n if S[i][j] == \".\":\n if i == h - 1:\n D[i][j] = 1\n else:\n D[i][j] = D[i + 1][j] + 1\nans = 0\nfor i in range(h):\n for j in range(w):\n ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)\nprint(ans)\n","code_v1_no_empty_lines":"h, w = list(map(int, input().split()))\nS = [eval(input()) for _ in range(h)]\nL = [[0] * w for _ in range(h)]\nR = [[0] * w for _ in range(h)]\nU = [[0] * w for _ in range(h)]\nD = [[0] * w for _ in range(h)]\nfor i in range(h):\n for j in range(w):\n if S[i][j] == \".\":\n if j == 0:\n L[i][j] = 1\n else:\n L[i][j] = L[i][j - 1] + 1\n for j in reversed(list(range(w))):\n if S[i][j] == \".\":\n if j == w - 1:\n R[i][j] = 1\n else:\n R[i][j] = R[i][j + 1] + 1\nfor j in range(w):\n for i in range(h):\n if S[i][j] == \".\":\n if i == 0:\n U[i][j] = 1\n else:\n U[i][j] = U[i - 1][j] + 1\n for i in reversed(list(range(h))):\n if S[i][j] == \".\":\n if i == h - 1:\n D[i][j] = 1\n else:\n D[i][j] = D[i + 1][j] + 1\nans = 0\nfor i in range(h):\n for j in range(w):\n ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S = [list(eval(input())) for _ in range(h)]","+S = [eval(input()) for _ in range(h)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0520044265,"measured_runtime_v1":0.0414664497,"runtime_lift":1.2541326011,"key":["s710876818","s958988841"]} +{"user_id":"u506689504","problem_id":"p03107","language":"python","submission_id_v0":"s140054264","submission_id_v1":"s427882079","cpu_time_v0":50,"cpu_time_v1":18,"memory_v0":3964,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.0,"input":"s = [int(i) for i in eval(input())]\n\n\n\ncnt = [0,0]\n\nfor i in s:\n\n if i==0:\n\n cnt[0] += 1\n\n else:\n\n cnt[1] += 1\n\nprint((min(cnt)*2))","target":"s = eval(input())\n\ncnt = [0,0]\n\ncnt[0] = s.count('0')\n\ncnt[1] = s.count('1')\n\nprint((min(cnt)*2))","code_v0_loc":9,"code_v1_loc":5,"code_v0_num_chars":143,"code_v1_num_chars":89,"code_v0_no_empty_lines":"s = [int(i) for i in eval(input())]\ncnt = [0, 0]\nfor i in s:\n if i == 0:\n cnt[0] += 1\n else:\n cnt[1] += 1\nprint((min(cnt) * 2))\n","code_v1_no_empty_lines":"s = eval(input())\ncnt = [0, 0]\ncnt[0] = s.count(\"0\")\ncnt[1] = s.count(\"1\")\nprint((min(cnt) * 2))\n","code_same":false,"relative_loc_diff_percent":44.4444444444,"diff":["-s = [int(i) for i in eval(input())]","+s = eval(input())","-for i in s:","- if i == 0:","- cnt[0] += 1","- else:","- cnt[1] += 1","+cnt[0] = s.count(\"0\")","+cnt[1] = s.count(\"1\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0738658972,"measured_runtime_v1":0.0440145621,"runtime_lift":1.6782149722,"key":["s140054264","s427882079"]} +{"user_id":"u562016607","problem_id":"p02958","language":"python","submission_id_v0":"s243527737","submission_id_v1":"s305122826","cpu_time_v0":197,"cpu_time_v1":20,"memory_v0":40432,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.85,"input":"N=int(eval(input()))\n\np=[int(i) for i in input().split()]\n\nflag=1\n\nfor k in range(N-1):\n\n if p[k]>p[k+1]:\n\n flag=0\n\n break\n\nif flag==1:\n\n print(\"YES\")\n\n exit()\n\nfor i in range(N):\n\n for j in range(N):\n\n if i>=j:\n\n continue\n\n q=[p[i] for i in range(N)]\n\n q[i],q[j]=q[j],q[i]\n\n flag=1\n\n for k in range(N-1):\n\n if q[k]>q[k+1]:\n\n flag=0\n\n break\n\n if flag==1:\n\n print(\"YES\")\n\n exit()\n\nprint(\"NO\")\n","target":"N=int(eval(input()))\n\np=[int(i) for i in input().split()]\n\ntmp=0\n\nfor i in range(N):\n\n if p[i]!=i+1:\n\n tmp+=1\n\nif tmp<=2:\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")\n","code_v0_loc":25,"code_v1_loc":10,"code_v0_num_chars":528,"code_v1_num_chars":168,"code_v0_no_empty_lines":"N = int(eval(input()))\np = [int(i) for i in input().split()]\nflag = 1\nfor k in range(N - 1):\n if p[k] > p[k + 1]:\n flag = 0\n break\nif flag == 1:\n print(\"YES\")\n exit()\nfor i in range(N):\n for j in range(N):\n if i >= j:\n continue\n q = [p[i] for i in range(N)]\n q[i], q[j] = q[j], q[i]\n flag = 1\n for k in range(N - 1):\n if q[k] > q[k + 1]:\n flag = 0\n break\n if flag == 1:\n print(\"YES\")\n exit()\nprint(\"NO\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\np = [int(i) for i in input().split()]\ntmp = 0\nfor i in range(N):\n if p[i] != i + 1:\n tmp += 1\nif tmp <= 2:\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-flag = 1","-for k in range(N - 1):","- if p[k] > p[k + 1]:","- flag = 0","- break","-if flag == 1:","+tmp = 0","+for i in range(N):","+ if p[i] != i + 1:","+ tmp += 1","+if tmp <= 2:","- exit()","-for i in range(N):","- for j in range(N):","- if i >= j:","- continue","- q = [p[i] for i in range(N)]","- q[i], q[j] = q[j], q[i]","- flag = 1","- for k in range(N - 1):","- if q[k] > q[k + 1]:","- flag = 0","- break","- if flag == 1:","- print(\"YES\")","- exit()","-print(\"NO\")","+else:","+ print(\"NO\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0432236195,"measured_runtime_v1":0.0439990835,"runtime_lift":0.9823754495,"key":["s243527737","s305122826"]} +{"user_id":"u079022693","problem_id":"p03212","language":"python","submission_id_v0":"s351896968","submission_id_v1":"s695049924","cpu_time_v0":93,"cpu_time_v1":47,"memory_v0":3060,"memory_v1":3564,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.46,"input":"N=int(eval(input()))\n\n\n\ndef dfs(s):\n\n if int(s)>N:\n\n return 0\n\n else:\n\n if all(s.count(c)>=1 for c in \"753\"):\n\n res=1\n\n else:\n\n res=0\n\n for c in \"753\":\n\n res+=dfs(s+c)\n\n return res\n\n\n\nprint((dfs(\"0\")))","target":"from sys import stdin\n\nfrom collections import deque\n\ndef main():\n\n #\u5165\u529b\n\n readline=stdin.readline\n\n N=int(readline())\n\n\n\n #dfs\n\n count=0\n\n stack=deque([\"0\"])\n\n while len(stack)>=1:\n\n t=stack.pop()\n\n for s in \"357\":\n\n now=t+s\n\n if int(now)>N:\n\n break\n\n if (\"7\" in now) and (\"5\" in now) and (\"3\" in now):\n\n count+=1\n\n stack.append(now)\n\n \n\n print(count)\n\n\n\nif __name__==\"__main__\":\n\n main()","code_v0_loc":15,"code_v1_loc":24,"code_v0_num_chars":267,"code_v1_num_chars":506,"code_v0_no_empty_lines":"N = int(eval(input()))\n\n\ndef dfs(s):\n if int(s) > N:\n return 0\n else:\n if all(s.count(c) >= 1 for c in \"753\"):\n res = 1\n else:\n res = 0\n for c in \"753\":\n res += dfs(s + c)\n return res\n\n\nprint((dfs(\"0\")))\n","code_v1_no_empty_lines":"from sys import stdin\nfrom collections import deque\n\n\ndef main():\n # \u5165\u529b\n readline = stdin.readline\n N = int(readline())\n # dfs\n count = 0\n stack = deque([\"0\"])\n while len(stack) >= 1:\n t = stack.pop()\n for s in \"357\":\n now = t + s\n if int(now) > N:\n break\n if (\"7\" in now) and (\"5\" in now) and (\"3\" in now):\n count += 1\n stack.append(now)\n print(count)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-N = int(eval(input()))","+from sys import stdin","+from collections import deque","-def dfs(s):","- if int(s) > N:","- return 0","- else:","- if all(s.count(c) >= 1 for c in \"753\"):","- res = 1","- else:","- res = 0","- for c in \"753\":","- res += dfs(s + c)","- return res","+def main():","+ # \u5165\u529b","+ readline = stdin.readline","+ N = int(readline())","+ # dfs","+ count = 0","+ stack = deque([\"0\"])","+ while len(stack) >= 1:","+ t = stack.pop()","+ for s in \"357\":","+ now = t + s","+ if int(now) > N:","+ break","+ if (\"7\" in now) and (\"5\" in now) and (\"3\" in now):","+ count += 1","+ stack.append(now)","+ print(count)","-print((dfs(\"0\")))","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0512116792,"measured_runtime_v1":0.0411471956,"runtime_lift":1.2445970737,"key":["s351896968","s695049924"]} +{"user_id":"u499381410","problem_id":"p02920","language":"python","submission_id_v0":"s436040128","submission_id_v1":"s599677385","cpu_time_v0":437,"cpu_time_v1":215,"memory_v0":107596,"memory_v1":129184,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.8,"input":"from collections import defaultdict, deque, Counter\n\nfrom heapq import heappush, heappop, heapify\n\nimport math\n\nimport bisect\n\nimport random\n\nfrom itertools import permutations, accumulate, combinations, product\n\nimport sys\n\nimport string\n\nfrom bisect import bisect_left, bisect_right\n\nfrom math import factorial, ceil, floor\n\nfrom operator import mul\n\nfrom functools import reduce\n\n\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = 10 ** 20\n\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\n\ndef I(): return int(sys.stdin.buffer.readline())\n\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\n\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\n\ndef IR(n): return [I() for i in range(n)]\n\ndef LIR(n): return [LI() for i in range(n)]\n\ndef SR(n): return [S() for i in range(n)]\n\ndef LSR(n): return [LS() for i in range(n)]\n\ndef SRL(n): return [list(S()) for i in range(n)]\n\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\n\nmod = 1000000007\n\n\n\n\n\nfrom collections import defaultdict, deque, Counter\n\nfrom heapq import heappush, heappop, heapify\n\nimport math\n\nimport bisect\n\nimport random\n\nfrom itertools import permutations, accumulate, combinations\n\nimport sys\n\nimport string\n\nfrom bisect import bisect_left\n\n\n\n\n\nINF = float('inf')\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LIM(): return list([int(x) - 1 for x in sys.stdin.readline().split()])\n\ndef LS(): return sys.stdin.readline().split()\n\ndef S(): return sys.stdin.readline().strip()\n\ndef IR(n): return [I() for i in range(n)]\n\ndef LIR(n): return [LI() for i in range(n)]\n\ndef LIRM(n): return [LIM() for i in range(n)]\n\ndef SR(n): return [S() for i in range(n)]\n\ndef LSR(n): return [LS() for i in range(n)]\n\ndef SRL(n): return [list(S()) for i in range(n)]\n\nmod = 1000000007\n\n\n\n\n\n\n\n\n\nn = I()\n\nfinal_slime = sorted(LI(), reverse=True)\n\nnow_slime = [final_slime[0]]\n\nmade_or_not = [0] * (2 ** n)\n\nmade_or_not[0] = 1\n\nfor i in range(n):\n\n k = 0\n\n for j in range(len(now_slime)):\n\n flag = 1\n\n while flag:\n\n if k == 2 ** n:\n\n print('No')\n\n exit(0)\n\n if made_or_not[k] == 0 and now_slime[j] - 1 >= final_slime[k]:\n\n now_slime += [final_slime[k]]\n\n made_or_not[k] = 1\n\n flag = 0\n\n k += 1\n\n now_slime.sort(reverse=True)\n\nprint('Yes')\n\n\n\n\n","target":"from collections import defaultdict, deque, Counter\n\nfrom heapq import heappush, heappop, heapify\n\nfrom math import gcd\n\nimport bisect\n\nimport random\n\nfrom itertools import permutations, accumulate, combinations, product\n\nimport sys\n\nimport string\n\nfrom bisect import bisect_left, bisect_right\n\nfrom math import factorial, ceil, floor, gcd\n\nfrom operator import mul\n\nfrom functools import reduce\n\n\n\n\n\nsys.setrecursionlimit(2147483647)\n\nINF = 10 ** 13\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef I(): return int(sys.stdin.readline())\n\ndef LS(): return sys.stdin.readline().rstrip().split()\n\ndef S(): return sys.stdin.readline().rstrip()\n\ndef IR(n): return [I() for i in range(n)]\n\ndef LIR(n): return [LI() for i in range(n)]\n\ndef SR(n): return [S() for i in range(n)]\n\ndef LSR(n): return [LS() for i in range(n)]\n\ndef SRL(n): return [list(S()) for i in range(n)]\n\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\n\n\n\nmod=10**9+7\n\n\n\nn=I()\n\nF=sorted(LI(),reverse=True)\n\nflg=[0]*len(F)\n\nflg[0]=1\n\na=1\n\nflg[0]=1\n\nnow=[F[0]]\n\nfor i in range(n):\n\n cnt=0\n\n for j in range(len(F)):\n\n if flg[j]==0 and F[j]= final_slime[k]:\n now_slime += [final_slime[k]]\n made_or_not[k] = 1\n flag = 0\n k += 1\n now_slime.sort(reverse=True)\nprint(\"Yes\")\n","code_v1_no_empty_lines":"from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nfrom math import gcd\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor, gcd\nfrom operator import mul\nfrom functools import reduce\n\nsys.setrecursionlimit(2147483647)\nINF = 10**13\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LS():\n return sys.stdin.readline().rstrip().split()\n\n\ndef S():\n return sys.stdin.readline().rstrip()\n\n\ndef IR(n):\n return [I() for i in range(n)]\n\n\ndef LIR(n):\n return [LI() for i in range(n)]\n\n\ndef SR(n):\n return [S() for i in range(n)]\n\n\ndef LSR(n):\n return [LS() for i in range(n)]\n\n\ndef SRL(n):\n return [list(S()) for i in range(n)]\n\n\ndef MSRL(n):\n return [[int(j) for j in list(S())] for i in range(n)]\n\n\nmod = 10**9 + 7\nn = I()\nF = sorted(LI(), reverse=True)\nflg = [0] * len(F)\nflg[0] = 1\na = 1\nflg[0] = 1\nnow = [F[0]]\nfor i in range(n):\n cnt = 0\n for j in range(len(F)):\n if flg[j] == 0 and F[j] < now[cnt]:\n cnt += 1\n flg[j] = 1\n now += [F[j]]\n if cnt == a:\n now.sort(reverse=True)\n a *= 2\n break\n else:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":10.1265822785,"diff":["-import math","+from math import gcd","-from math import factorial, ceil, floor","+from math import factorial, ceil, floor, gcd","-INF = 10**20","+INF = 10**13","- return list(map(int, sys.stdin.buffer.readline().split()))","+ return list(map(int, sys.stdin.readline().split()))","- return int(sys.stdin.buffer.readline())","+ return int(sys.stdin.readline())","- return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\").split()","+ return sys.stdin.readline().rstrip().split()","- return sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")","+ return sys.stdin.readline().rstrip()","-mod = 1000000007","-from collections import defaultdict, deque, Counter","-from heapq import heappush, heappop, heapify","-import math","-import bisect","-import random","-from itertools import permutations, accumulate, combinations","-import sys","-import string","-from bisect import bisect_left","-","-INF = float(\"inf\")","-","-","-def LI():","- return list(map(int, sys.stdin.readline().split()))","-","-","-def I():","- return int(sys.stdin.readline())","-","-","-def LIM():","- return list([int(x) - 1 for x in sys.stdin.readline().split()])","-","-","-def LS():","- return sys.stdin.readline().split()","-","-","-def S():","- return sys.stdin.readline().strip()","-","-","-def IR(n):","- return [I() for i in range(n)]","-","-","-def LIR(n):","- return [LI() for i in range(n)]","-","-","-def LIRM(n):","- return [LIM() for i in range(n)]","-","-","-def SR(n):","- return [S() for i in range(n)]","-","-","-def LSR(n):","- return [LS() for i in range(n)]","-","-","-def SRL(n):","- return [list(S()) for i in range(n)]","-","-","-mod = 1000000007","+mod = 10**9 + 7","-final_slime = sorted(LI(), reverse=True)","-now_slime = [final_slime[0]]","-made_or_not = [0] * (2**n)","-made_or_not[0] = 1","+F = sorted(LI(), reverse=True)","+flg = [0] * len(F)","+flg[0] = 1","+a = 1","+flg[0] = 1","+now = [F[0]]","- k = 0","- for j in range(len(now_slime)):","- flag = 1","- while flag:","- if k == 2**n:","- print(\"No\")","- exit(0)","- if made_or_not[k] == 0 and now_slime[j] - 1 >= final_slime[k]:","- now_slime += [final_slime[k]]","- made_or_not[k] = 1","- flag = 0","- k += 1","- now_slime.sort(reverse=True)","+ cnt = 0","+ for j in range(len(F)):","+ if flg[j] == 0 and F[j] < now[cnt]:","+ cnt += 1","+ flg[j] = 1","+ now += [F[j]]","+ if cnt == a:","+ now.sort(reverse=True)","+ a *= 2","+ break","+ else:","+ print(\"No\")","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0416223049,"measured_runtime_v1":0.0401607037,"runtime_lift":1.0363938157,"key":["s436040128","s599677385"]} +{"user_id":"u767432305","problem_id":"p02996","language":"python","submission_id_v0":"s642802298","submission_id_v1":"s977784776","cpu_time_v0":1158,"cpu_time_v1":932,"memory_v0":42836,"memory_v1":42716,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.52,"input":"N=int(eval(input()))\n\ntask=[]\n\nfor _ in range(N):\n\n task.append([int(i) for i in input().split()])\n\n\n\ntask=sorted(task, key=lambda x: x[1])\n\n\n\nspent_time1=0\n\nspent_time2=0\n\nfor i in range(N):\n\n spent_time2+=task[i][0]\n\nans='Yes'\n\n\n\nfor i in range(N):\n\n spent_time1+=task[i][0]\n\n deadline1=task[i][1]\n\n if i!=0:\n\n spent_time2-=task[N-i][0]\n\n deadline2=task[N-1-i][1]\n\n if deadline1 self.rnk[y]):\n\n self.root[x] += self.root[y]\n\n self.root[y] = x\n\n\n\n else:\n\n self.root[y] += self.root[x]\n\n self.root[x] = y\n\n # rnk\u304c\u540c\u3058\uff08\u6df1\u3055\u306b\u5dee\u304c\u306a\u3044\u5834\u5408\uff09\u306f1\u5897\u3084\u3059\n\n if(self.rnk[x] == self.rnk[y]):\n\n self.rnk[y] += 1\n\n\n\n # x\u3068y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u5224\u65ad\n\n def isSameGroup(self, x, y):\n\n return self.Find_Root(x) == self.Find_Root(y)\n\n\n\n # \u30ce\u30fc\u30c9x\u304c\u5c5e\u3059\u308b\u6728\u306e\u30b5\u30a4\u30ba\u3092\u8fd4\u3059\n\n def Count(self, x):\n\n return -self.root[self.Find_Root(x)]\n\n\n\nuni=UnionFind(N)\n\n\n\nfor i in range(M):\n\n a,b=list(map(int, input().split()))\n\n a-=1\n\n b-=1\n\n uni.Unite(a,b)\n\n\n\nans=0\n\nfor i in range(N):\n\n ans=max(ans, uni.Count(i))\n\n\n\nprint(ans)\n","target":"class UnionFind():\n\n # \u4f5c\u308a\u305f\u3044\u8981\u7d20\u6570n\u3067\u521d\u671f\u5316\n\n # \u4f7f\u7528\u3059\u308b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u306e\u521d\u671f\u5316\n\n def __init__(self, n):\n\n self.n = n\n\n # root[x]<0\u306a\u3089\u305d\u306e\u30ce\u30fc\u30c9\u304c\u6839\u304b\u3064\u305d\u306e\u5024\u304c\u6728\u306e\u8981\u7d20\u6570\n\n # root\u30ce\u30fc\u30c9\u3067\u305d\u306e\u6728\u306e\u8981\u7d20\u6570\u3092\u8a18\u9332\u3059\u308b\n\n self.root = [-1]*(n+1)\n\n # \u6728\u3092\u304f\u3063\u3064\u3051\u308b\u6642\u306b\u30a2\u30f3\u30d0\u30e9\u30f3\u30b9\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u8abf\u6574\u3059\u308b\n\n self.rnk = [0]*(n+1)\n\n\n\n # \u30ce\u30fc\u30c9x\u306eroot\u30ce\u30fc\u30c9\u3092\u898b\u3064\u3051\u308b\n\n def Find_Root(self, x):\n\n if(self.root[x] < 0):\n\n return x\n\n else:\n\n # \u3053\u3053\u3067\u4ee3\u5165\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u3001\u5f8c\u306e\u7e70\u308a\u8fd4\u3057\u3092\u907f\u3051\u308b\n\n self.root[x] = self.Find_Root(self.root[x])\n\n return self.root[x]\n\n\n\n # \u6728\u306e\u4f75\u5408\u3001\u5165\u529b\u306f\u4f75\u5408\u3057\u305f\u3044\u5404\u30ce\u30fc\u30c9\n\n def Unite(self, x, y):\n\n # \u5165\u529b\u30ce\u30fc\u30c9\u306eroot\u30ce\u30fc\u30c9\u3092\u898b\u3064\u3051\u308b\n\n x = self.Find_Root(x)\n\n y = self.Find_Root(y)\n\n # \u3059\u3067\u306b\u540c\u3058\u6728\u306b\u5c5e\u3057\u3066\u3044\u305f\u5834\u5408\n\n if (x == y):\n\n return \n\n # \u9055\u3046\u6728\u306b\u5c5e\u3057\u3066\u3044\u305f\u5834\u5408rnk\u3092\u898b\u3066\u304f\u3063\u3064\u3051\u308b\u65b9\u3092\u6c7a\u3081\u308b\n\n #rnk\u304c\u5927\u304d\u3044\u65b9\u306b\u7d50\u5408\n\n elif (self.rnk[x] > self.rnk[y]):\n\n self.root[x] += self.root[y]\n\n self.root[y] = x\n\n\n\n else:\n\n self.root[y] += self.root[x]\n\n self.root[x] = y\n\n # rnk\u304c\u540c\u3058\uff08\u6df1\u3055\u306b\u5dee\u304c\u306a\u3044\u5834\u5408\uff09\u306f1\u5897\u3084\u3059\n\n if(self.rnk[x] == self.rnk[y]):\n\n self.rnk[y] += 1\n\n\n\n # x\u3068y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u5224\u65ad\n\n def isSameGroup(self, x, y):\n\n return self.Find_Root(x) == self.Find_Root(y)\n\n\n\n # \u30ce\u30fc\u30c9x\u304c\u5c5e\u3059\u308b\u6728\u306e\u30b5\u30a4\u30ba\u3092\u8fd4\u3059\n\n def Count(self, x):\n\n return -self.root[self.Find_Root(x)]\n\n\n\n\n\nN, M=list(map(int, input().split()))\n\n\n\nuni=UnionFind(N)\n\nfor i in range(M):\n\n a,b=list(map(int, input().split()))\n\n uni.Unite(a-1,b-1)\n\nans=0\n\nfor i in range(N):\n\n ans=max(ans, uni.Count(i))\n\nprint(ans)\n","code_v0_loc":64,"code_v1_loc":60,"code_v0_num_chars":1558,"code_v1_num_chars":1539,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\n\n\nclass UnionFind:\n # \u4f5c\u308a\u305f\u3044\u8981\u7d20\u6570n\u3067\u521d\u671f\u5316\n # \u4f7f\u7528\u3059\u308b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u306e\u521d\u671f\u5316\n def __init__(self, n):\n self.n = n\n # root[x]<0\u306a\u3089\u305d\u306e\u30ce\u30fc\u30c9\u304c\u6839\u304b\u3064\u305d\u306e\u5024\u304c\u6728\u306e\u8981\u7d20\u6570\n # root\u30ce\u30fc\u30c9\u3067\u305d\u306e\u6728\u306e\u8981\u7d20\u6570\u3092\u8a18\u9332\u3059\u308b\n self.root = [-1] * (n + 1)\n # \u6728\u3092\u304f\u3063\u3064\u3051\u308b\u6642\u306b\u30a2\u30f3\u30d0\u30e9\u30f3\u30b9\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u8abf\u6574\u3059\u308b\n self.rnk = [0] * (n + 1)\n\n # \u30ce\u30fc\u30c9x\u306eroot\u30ce\u30fc\u30c9\u3092\u898b\u3064\u3051\u308b\n def Find_Root(self, x):\n if self.root[x] < 0:\n return x\n else:\n # \u3053\u3053\u3067\u4ee3\u5165\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u3001\u5f8c\u306e\u7e70\u308a\u8fd4\u3057\u3092\u907f\u3051\u308b\n self.root[x] = self.Find_Root(self.root[x])\n return self.root[x]\n\n # \u6728\u306e\u4f75\u5408\u3001\u5165\u529b\u306f\u4f75\u5408\u3057\u305f\u3044\u5404\u30ce\u30fc\u30c9\n def Unite(self, x, y):\n # \u5165\u529b\u30ce\u30fc\u30c9\u306eroot\u30ce\u30fc\u30c9\u3092\u898b\u3064\u3051\u308b\n x = self.Find_Root(x)\n y = self.Find_Root(y)\n # \u3059\u3067\u306b\u540c\u3058\u6728\u306b\u5c5e\u3057\u3066\u3044\u305f\u5834\u5408\n if x == y:\n return\n # \u9055\u3046\u6728\u306b\u5c5e\u3057\u3066\u3044\u305f\u5834\u5408rnk\u3092\u898b\u3066\u304f\u3063\u3064\u3051\u308b\u65b9\u3092\u6c7a\u3081\u308b\n # rnk\u304c\u5927\u304d\u3044\u65b9\u306b\u7d50\u5408\n elif self.rnk[x] > self.rnk[y]:\n self.root[x] += self.root[y]\n self.root[y] = x\n else:\n self.root[y] += self.root[x]\n self.root[x] = y\n # rnk\u304c\u540c\u3058\uff08\u6df1\u3055\u306b\u5dee\u304c\u306a\u3044\u5834\u5408\uff09\u306f1\u5897\u3084\u3059\n if self.rnk[x] == self.rnk[y]:\n self.rnk[y] += 1\n\n # x\u3068y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u5224\u65ad\n def isSameGroup(self, x, y):\n return self.Find_Root(x) == self.Find_Root(y)\n\n # \u30ce\u30fc\u30c9x\u304c\u5c5e\u3059\u308b\u6728\u306e\u30b5\u30a4\u30ba\u3092\u8fd4\u3059\n def Count(self, x):\n return -self.root[self.Find_Root(x)]\n\n\nuni = UnionFind(N)\nfor i in range(M):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n uni.Unite(a, b)\nans = 0\nfor i in range(N):\n ans = max(ans, uni.Count(i))\nprint(ans)\n","code_v1_no_empty_lines":"class UnionFind:\n # \u4f5c\u308a\u305f\u3044\u8981\u7d20\u6570n\u3067\u521d\u671f\u5316\n # \u4f7f\u7528\u3059\u308b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u306e\u521d\u671f\u5316\n def __init__(self, n):\n self.n = n\n # root[x]<0\u306a\u3089\u305d\u306e\u30ce\u30fc\u30c9\u304c\u6839\u304b\u3064\u305d\u306e\u5024\u304c\u6728\u306e\u8981\u7d20\u6570\n # root\u30ce\u30fc\u30c9\u3067\u305d\u306e\u6728\u306e\u8981\u7d20\u6570\u3092\u8a18\u9332\u3059\u308b\n self.root = [-1] * (n + 1)\n # \u6728\u3092\u304f\u3063\u3064\u3051\u308b\u6642\u306b\u30a2\u30f3\u30d0\u30e9\u30f3\u30b9\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u8abf\u6574\u3059\u308b\n self.rnk = [0] * (n + 1)\n\n # \u30ce\u30fc\u30c9x\u306eroot\u30ce\u30fc\u30c9\u3092\u898b\u3064\u3051\u308b\n def Find_Root(self, x):\n if self.root[x] < 0:\n return x\n else:\n # \u3053\u3053\u3067\u4ee3\u5165\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u3001\u5f8c\u306e\u7e70\u308a\u8fd4\u3057\u3092\u907f\u3051\u308b\n self.root[x] = self.Find_Root(self.root[x])\n return self.root[x]\n\n # \u6728\u306e\u4f75\u5408\u3001\u5165\u529b\u306f\u4f75\u5408\u3057\u305f\u3044\u5404\u30ce\u30fc\u30c9\n def Unite(self, x, y):\n # \u5165\u529b\u30ce\u30fc\u30c9\u306eroot\u30ce\u30fc\u30c9\u3092\u898b\u3064\u3051\u308b\n x = self.Find_Root(x)\n y = self.Find_Root(y)\n # \u3059\u3067\u306b\u540c\u3058\u6728\u306b\u5c5e\u3057\u3066\u3044\u305f\u5834\u5408\n if x == y:\n return\n # \u9055\u3046\u6728\u306b\u5c5e\u3057\u3066\u3044\u305f\u5834\u5408rnk\u3092\u898b\u3066\u304f\u3063\u3064\u3051\u308b\u65b9\u3092\u6c7a\u3081\u308b\n # rnk\u304c\u5927\u304d\u3044\u65b9\u306b\u7d50\u5408\n elif self.rnk[x] > self.rnk[y]:\n self.root[x] += self.root[y]\n self.root[y] = x\n else:\n self.root[y] += self.root[x]\n self.root[x] = y\n # rnk\u304c\u540c\u3058\uff08\u6df1\u3055\u306b\u5dee\u304c\u306a\u3044\u5834\u5408\uff09\u306f1\u5897\u3084\u3059\n if self.rnk[x] == self.rnk[y]:\n self.rnk[y] += 1\n\n # x\u3068y\u304c\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u306b\u5c5e\u3059\u308b\u304b\u5224\u65ad\n def isSameGroup(self, x, y):\n return self.Find_Root(x) == self.Find_Root(y)\n\n # \u30ce\u30fc\u30c9x\u304c\u5c5e\u3059\u308b\u6728\u306e\u30b5\u30a4\u30ba\u3092\u8fd4\u3059\n def Count(self, x):\n return -self.root[self.Find_Root(x)]\n\n\nN, M = list(map(int, input().split()))\nuni = UnionFind(N)\nfor i in range(M):\n a, b = list(map(int, input().split()))\n uni.Unite(a - 1, b - 1)\nans = 0\nfor i in range(N):\n ans = max(ans, uni.Count(i))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["-N, M = list(map(int, input().split()))","-","-","+N, M = list(map(int, input().split()))","- a -= 1","- b -= 1","- uni.Unite(a, b)","+ uni.Unite(a - 1, b - 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1275597608,"measured_runtime_v1":0.0405155389,"runtime_lift":3.1484157472,"key":["s421847182","s308311361"]} +{"user_id":"u498487134","problem_id":"p02651","language":"python","submission_id_v0":"s741808639","submission_id_v1":"s574480822","cpu_time_v0":264,"cpu_time_v1":216,"memory_v0":70180,"memory_v1":75328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"\n\n\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n T=I()\n\n M=60\n\n \n\n\n\n\n\n \n\n def pipo(x):\n\n cnt=0\n\n for i in range(M):\n\n if x==0:\n\n return cnt\n\n else:\n\n x=x\/\/2\n\n cnt+=1\n\n \n\n\n\n \n\n \n\n for _ in range(T):\n\n N=I()\n\n A=LI()\n\n S=list(eval(input()))\n\n #\u5f8c\u308d\u304b\u3089\u898b\u3066\u3044\u304d\uff0cS=0\u306e\u6570\u3060\u3051\u3067\u4f5c\u308c\u306a\u3044\u6570\u304c(S=1\u306e\u6642\u306b)\u51fa\u3066\u304d\u305f\u3089NG\n\n Vec=[]\n\n flag=1\n\n for i in range(N-1,-1,-1):\n\n #print(i,S[i]) \n\n if S[i]==\"0\":\n\n if Vec==[]:\n\n Vec.append((A[i],pipo(A[i])))\n\n else:\n\n now=A[i]\n\n p=pipo(A[i])\n\n for v in Vec:\n\n if v[1]==p:\n\n now=now^v[0]\n\n p=pipo(now)\n\n if now!=0:\n\n Vec.append((now,pipo(now)))\n\n Vec.sort(reverse=True)\n\n \n\n \n\n else:\n\n #print(Vec)\n\n now=A[i]\n\n for v in Vec:\n\n if v[1]==pipo(now):\n\n now=now^v[0]\n\n if now!=0:\n\n flag=0\n\n\n\n \n\n \n\n if flag:\n\n print((0))\n\n else:\n\n print((1))\n\n \n\n \n\n \n\n \n\n \n\n \n\n\n\nmain()\n","target":"\n\n\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n T=I()\n\n M=60#60\u6841\u307e\u3067\n\n \n\n #S=1\u3068\u306a\u308b\u5168\u3066\u306e\u6570\u5b57\u304c\uff0c\u305d\u308c\u3088\u308a\u5f8c\u308d\u306eS=0\u306e\u3082\u306e\u3067\u69cb\u6210\u3067\u304d\u308c\u3070\u826f\u3044\uff08\u305d\u308c\u3089\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3082\uff0cS=0\u5074\u3082\u540c\u3058\u7d44\u307f\u5408\u308f\u305b\u65b9\u3067\u5bfe\u5fdc\u3067\u304d\u308b\uff09\uff0e\n\n #S=0\u306e\u3082\u306e\u3092\u57fa\u5e95\u30d9\u30af\u30c8\u30eb(\u307d\u3044\u3082\u306e)\u3068\u3057\u3066\u6301\u3063\u3066\u304a\u304f\n\n #\u3053\u306e\u3068\u304d\u884c\u5217\u306e\u6a19\u6e96\u5f62\u3092\u69cb\u6210\u3059\u308b\u30d9\u30af\u30c8\u30eb\u3092\u30a4\u30e1\u30fc\u30b8\n\n #\u4e0a\u4f4d\u6841\u304c\u7b49\u3057\u3044\u3082\u306e\u304c\u3042\u308b\u5834\u5408\uff0c\u305d\u308c\u3068xor\u3057\u3066\u304a\u3051\u3070\u826f\u3044\uff0c\u3053\u308c\u306b\u3088\u3063\u3066\u4e0a\u4f4d\u6841\u304c\u540c\u3058\u57fa\u5e95\u30d9\u30af\u30c8\u30eb(\u307d\u3044\u3082\u306e)\u304c\u306a\u304f\u306a\u308b\n\n \n\n \n\n def pipo(x):\n\n #\u6700\u4e0a\u4f4d\u6841\u304c\u4f55\u51e6\u304b\n\n cnt=0\n\n for i in range(M):\n\n if x==0:\n\n return cnt\n\n else:\n\n x=x\/\/2\n\n cnt+=1\n\n \n\n\n\n \n\n \n\n for _ in range(T):\n\n N=I()\n\n A=LI()\n\n S=list(eval(input()))\n\n #\u5f8c\u308d\u304b\u3089\u898b\u3066\u3044\u304d\uff0cS=1\u306e\u6642\u306b\u300cS=0\u306e\u6570\u3060\u3051\u3067\u4f5c\u308c\u306a\u3044\u6570\u300d\u304c\u51fa\u3066\u304d\u305f\u3089NG\n\n Vec=[]#\u57fa\u5e95\u7ba1\u7406\n\n flag=1#\u30c0\u30e1\u306a\u30890\u306b\u306a\u308b\n\n for i in range(N-1,-1,-1):\n\n #print(i,S[i]) \n\n if S[i]==\"0\":\n\n\n\n now=A[i]\n\n p=pipo(A[i])\n\n for v in Vec:\n\n if v[1]==p:\n\n now=now^v[0]\n\n p=pipo(now)\n\n if now!=0:\n\n Vec.append((now,pipo(now)))\n\n Vec.sort(reverse=True)\n\n \n\n \n\n else:\n\n #print(Vec)\n\n now=A[i]\n\n for v in Vec:\n\n if v[1]==pipo(now):\n\n now=now^v[0]\n\n if now!=0:\n\n flag=0\n\n\n\n \n\n \n\n if flag:\n\n print((0))\n\n else:\n\n print((1))\n\n \n\n \n\n \n\n \n\n \n\n \n\n\n\nmain()\n","code_v0_loc":73,"code_v1_loc":75,"code_v0_num_chars":1591,"code_v1_num_chars":1701,"code_v0_no_empty_lines":"def I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n T = I()\n M = 60\n\n def pipo(x):\n cnt = 0\n for i in range(M):\n if x == 0:\n return cnt\n else:\n x = x \/\/ 2\n cnt += 1\n\n for _ in range(T):\n N = I()\n A = LI()\n S = list(eval(input()))\n # \u5f8c\u308d\u304b\u3089\u898b\u3066\u3044\u304d\uff0cS=0\u306e\u6570\u3060\u3051\u3067\u4f5c\u308c\u306a\u3044\u6570\u304c(S=1\u306e\u6642\u306b)\u51fa\u3066\u304d\u305f\u3089NG\n Vec = []\n flag = 1\n for i in range(N - 1, -1, -1):\n # print(i,S[i])\n if S[i] == \"0\":\n if Vec == []:\n Vec.append((A[i], pipo(A[i])))\n else:\n now = A[i]\n p = pipo(A[i])\n for v in Vec:\n if v[1] == p:\n now = now ^ v[0]\n p = pipo(now)\n if now != 0:\n Vec.append((now, pipo(now)))\n Vec.sort(reverse=True)\n else:\n # print(Vec)\n now = A[i]\n for v in Vec:\n if v[1] == pipo(now):\n now = now ^ v[0]\n if now != 0:\n flag = 0\n if flag:\n print((0))\n else:\n print((1))\n\n\nmain()\n","code_v1_no_empty_lines":"def I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n T = I()\n M = 60 # 60\u6841\u307e\u3067\n # S=1\u3068\u306a\u308b\u5168\u3066\u306e\u6570\u5b57\u304c\uff0c\u305d\u308c\u3088\u308a\u5f8c\u308d\u306eS=0\u306e\u3082\u306e\u3067\u69cb\u6210\u3067\u304d\u308c\u3070\u826f\u3044\uff08\u305d\u308c\u3089\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3082\uff0cS=0\u5074\u3082\u540c\u3058\u7d44\u307f\u5408\u308f\u305b\u65b9\u3067\u5bfe\u5fdc\u3067\u304d\u308b\uff09\uff0e\n # S=0\u306e\u3082\u306e\u3092\u57fa\u5e95\u30d9\u30af\u30c8\u30eb(\u307d\u3044\u3082\u306e)\u3068\u3057\u3066\u6301\u3063\u3066\u304a\u304f\n # \u3053\u306e\u3068\u304d\u884c\u5217\u306e\u6a19\u6e96\u5f62\u3092\u69cb\u6210\u3059\u308b\u30d9\u30af\u30c8\u30eb\u3092\u30a4\u30e1\u30fc\u30b8\n # \u4e0a\u4f4d\u6841\u304c\u7b49\u3057\u3044\u3082\u306e\u304c\u3042\u308b\u5834\u5408\uff0c\u305d\u308c\u3068xor\u3057\u3066\u304a\u3051\u3070\u826f\u3044\uff0c\u3053\u308c\u306b\u3088\u3063\u3066\u4e0a\u4f4d\u6841\u304c\u540c\u3058\u57fa\u5e95\u30d9\u30af\u30c8\u30eb(\u307d\u3044\u3082\u306e)\u304c\u306a\u304f\u306a\u308b\n def pipo(x):\n # \u6700\u4e0a\u4f4d\u6841\u304c\u4f55\u51e6\u304b\n cnt = 0\n for i in range(M):\n if x == 0:\n return cnt\n else:\n x = x \/\/ 2\n cnt += 1\n\n for _ in range(T):\n N = I()\n A = LI()\n S = list(eval(input()))\n # \u5f8c\u308d\u304b\u3089\u898b\u3066\u3044\u304d\uff0cS=1\u306e\u6642\u306b\u300cS=0\u306e\u6570\u3060\u3051\u3067\u4f5c\u308c\u306a\u3044\u6570\u300d\u304c\u51fa\u3066\u304d\u305f\u3089NG\n Vec = [] # \u57fa\u5e95\u7ba1\u7406\n flag = 1 # \u30c0\u30e1\u306a\u30890\u306b\u306a\u308b\n for i in range(N - 1, -1, -1):\n # print(i,S[i])\n if S[i] == \"0\":\n now = A[i]\n p = pipo(A[i])\n for v in Vec:\n if v[1] == p:\n now = now ^ v[0]\n p = pipo(now)\n if now != 0:\n Vec.append((now, pipo(now)))\n Vec.sort(reverse=True)\n else:\n # print(Vec)\n now = A[i]\n for v in Vec:\n if v[1] == pipo(now):\n now = now ^ v[0]\n if now != 0:\n flag = 0\n if flag:\n print((0))\n else:\n print((1))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":2.6666666667,"diff":["- M = 60","-","+ M = 60 # 60\u6841\u307e\u3067","+ # S=1\u3068\u306a\u308b\u5168\u3066\u306e\u6570\u5b57\u304c\uff0c\u305d\u308c\u3088\u308a\u5f8c\u308d\u306eS=0\u306e\u3082\u306e\u3067\u69cb\u6210\u3067\u304d\u308c\u3070\u826f\u3044\uff08\u305d\u308c\u3089\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3082\uff0cS=0\u5074\u3082\u540c\u3058\u7d44\u307f\u5408\u308f\u305b\u65b9\u3067\u5bfe\u5fdc\u3067\u304d\u308b\uff09\uff0e","+ # S=0\u306e\u3082\u306e\u3092\u57fa\u5e95\u30d9\u30af\u30c8\u30eb(\u307d\u3044\u3082\u306e)\u3068\u3057\u3066\u6301\u3063\u3066\u304a\u304f","+ # \u3053\u306e\u3068\u304d\u884c\u5217\u306e\u6a19\u6e96\u5f62\u3092\u69cb\u6210\u3059\u308b\u30d9\u30af\u30c8\u30eb\u3092\u30a4\u30e1\u30fc\u30b8","+ # \u4e0a\u4f4d\u6841\u304c\u7b49\u3057\u3044\u3082\u306e\u304c\u3042\u308b\u5834\u5408\uff0c\u305d\u308c\u3068xor\u3057\u3066\u304a\u3051\u3070\u826f\u3044\uff0c\u3053\u308c\u306b\u3088\u3063\u3066\u4e0a\u4f4d\u6841\u304c\u540c\u3058\u57fa\u5e95\u30d9\u30af\u30c8\u30eb(\u307d\u3044\u3082\u306e)\u304c\u306a\u304f\u306a\u308b","+ # \u6700\u4e0a\u4f4d\u6841\u304c\u4f55\u51e6\u304b","- # \u5f8c\u308d\u304b\u3089\u898b\u3066\u3044\u304d\uff0cS=0\u306e\u6570\u3060\u3051\u3067\u4f5c\u308c\u306a\u3044\u6570\u304c(S=1\u306e\u6642\u306b)\u51fa\u3066\u304d\u305f\u3089NG","- Vec = []","- flag = 1","+ # \u5f8c\u308d\u304b\u3089\u898b\u3066\u3044\u304d\uff0cS=1\u306e\u6642\u306b\u300cS=0\u306e\u6570\u3060\u3051\u3067\u4f5c\u308c\u306a\u3044\u6570\u300d\u304c\u51fa\u3066\u304d\u305f\u3089NG","+ Vec = [] # \u57fa\u5e95\u7ba1\u7406","+ flag = 1 # \u30c0\u30e1\u306a\u30890\u306b\u306a\u308b","- if Vec == []:","- Vec.append((A[i], pipo(A[i])))","- else:","- now = A[i]","- p = pipo(A[i])","- for v in Vec:","- if v[1] == p:","- now = now ^ v[0]","- p = pipo(now)","- if now != 0:","- Vec.append((now, pipo(now)))","- Vec.sort(reverse=True)","+ now = A[i]","+ p = pipo(A[i])","+ for v in Vec:","+ if v[1] == p:","+ now = now ^ v[0]","+ p = pipo(now)","+ if now != 0:","+ Vec.append((now, pipo(now)))","+ Vec.sort(reverse=True)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0326905012,"measured_runtime_v1":0.0337590098,"runtime_lift":0.9683489344,"key":["s741808639","s574480822"]} +{"user_id":"u077291787","problem_id":"p03835","language":"python","submission_id_v0":"s897097623","submission_id_v1":"s724260461","cpu_time_v0":1227,"cpu_time_v1":722,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.16,"input":"# ABC051B - Sum of Three Integers\n\nk, s = list(map(int, input().rstrip().split()))\n\ncount = 0\n\nfor i in range(k + 1):\n\n for j in range(k + 1):\n\n if 0 <= s - i - j <= k:\n\n count += 1\n\nprint(count)","target":"# ABC051B - Sum of Three Integers\n\ndef main():\n\n K, S = tuple(map(int, input().split()))\n\n ans = 0\n\n for x in range(K + 1):\n\n for y in range(K + 1):\n\n z = S - x - y\n\n if z < 0:\n\n break\n\n if z <= K:\n\n ans += 1\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":8,"code_v1_loc":16,"code_v0_num_chars":216,"code_v1_num_chars":347,"code_v0_no_empty_lines":"# ABC051B - Sum of Three Integers\nk, s = list(map(int, input().rstrip().split()))\ncount = 0\nfor i in range(k + 1):\n for j in range(k + 1):\n if 0 <= s - i - j <= k:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"# ABC051B - Sum of Three Integers\ndef main():\n K, S = tuple(map(int, input().split()))\n ans = 0\n for x in range(K + 1):\n for y in range(K + 1):\n z = S - x - y\n if z < 0:\n break\n if z <= K:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-k, s = list(map(int, input().rstrip().split()))","-count = 0","-for i in range(k + 1):","- for j in range(k + 1):","- if 0 <= s - i - j <= k:","- count += 1","-print(count)","+def main():","+ K, S = tuple(map(int, input().split()))","+ ans = 0","+ for x in range(K + 1):","+ for y in range(K + 1):","+ z = S - x - y","+ if z < 0:","+ break","+ if z <= K:","+ ans += 1","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0501781478,"measured_runtime_v1":0.0355859582,"runtime_lift":1.410054703,"key":["s897097623","s724260461"]} +{"user_id":"u002539468","problem_id":"p02842","language":"python","submission_id_v0":"s546195518","submission_id_v1":"s868182747","cpu_time_v0":39,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.41,"input":"n = int(eval(input()))\n\nxx = (100 * n \/\/ 108) + 1\n\n# print(xx)\n\nfor x in range(xx + 1):\n\n nn = int(x * 1.08 \/\/ 1)\n\n if n == nn:\n\n print(x)\n\n exit(0)\n\nprint(':(')\n","target":"import math\n\n\n\nn = int(eval(input()))\n\nx = math.ceil(n \/ 1.08)\n\n\n\nif n == int(x * 1.08):\n\n print(x)\n\nelse:\n\n print(':(')\n","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":176,"code_v1_num_chars":117,"code_v0_no_empty_lines":"n = int(eval(input()))\nxx = (100 * n \/\/ 108) + 1\n# print(xx)\nfor x in range(xx + 1):\n nn = int(x * 1.08 \/\/ 1)\n if n == nn:\n print(x)\n exit(0)\nprint(\":(\")\n","code_v1_no_empty_lines":"import math\n\nn = int(eval(input()))\nx = math.ceil(n \/ 1.08)\nif n == int(x * 1.08):\n print(x)\nelse:\n print(\":(\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+import math","+","-xx = (100 * n \/\/ 108) + 1","-# print(xx)","-for x in range(xx + 1):","- nn = int(x * 1.08 \/\/ 1)","- if n == nn:","- print(x)","- exit(0)","-print(\":(\")","+x = math.ceil(n \/ 1.08)","+if n == int(x * 1.08):","+ print(x)","+else:","+ print(\":(\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0466182749,"measured_runtime_v1":0.0473819737,"runtime_lift":0.9838820808,"key":["s546195518","s868182747"]} +{"user_id":"u576917603","problem_id":"p04030","language":"python","submission_id_v0":"s459584157","submission_id_v1":"s298556364","cpu_time_v0":23,"cpu_time_v1":20,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.04,"input":"a=list(eval(input()))\n\nfrom collections import deque\n\nd=deque()\n\nfor i in a:\n\n if i==\"0\" or i==\"1\":\n\n d.append(i)\n\n else:\n\n if len(d)==0:\n\n continue\n\n d.pop()\n\nprint((''.join(list(d))))","target":"s=list(eval(input()))\n\nfrom collections import deque\n\nd=deque()\n\nfor i in s:\n\n if i==\"0\":\n\n d.append(i)\n\n elif i==\"1\":\n\n d.append(i)\n\n else:\n\n if len(d)>0:\n\n d.pop()\n\nprint((''.join(list(d))))","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":215,"code_v1_num_chars":225,"code_v0_no_empty_lines":"a = list(eval(input()))\nfrom collections import deque\n\nd = deque()\nfor i in a:\n if i == \"0\" or i == \"1\":\n d.append(i)\n else:\n if len(d) == 0:\n continue\n d.pop()\nprint((\"\".join(list(d))))\n","code_v1_no_empty_lines":"s = list(eval(input()))\nfrom collections import deque\n\nd = deque()\nfor i in s:\n if i == \"0\":\n d.append(i)\n elif i == \"1\":\n d.append(i)\n else:\n if len(d) > 0:\n d.pop()\nprint((\"\".join(list(d))))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-a = list(eval(input()))","+s = list(eval(input()))","-for i in a:","- if i == \"0\" or i == \"1\":","+for i in s:","+ if i == \"0\":","+ d.append(i)","+ elif i == \"1\":","- if len(d) == 0:","- continue","- d.pop()","+ if len(d) > 0:","+ d.pop()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0356281374,"measured_runtime_v1":0.0364471197,"runtime_lift":0.9775295744,"key":["s459584157","s298556364"]} +{"user_id":"u141610915","problem_id":"p03700","language":"python","submission_id_v0":"s103278318","submission_id_v1":"s567304934","cpu_time_v0":298,"cpu_time_v1":203,"memory_v0":44892,"memory_v1":179032,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.88,"input":"import sys\n\ninput = sys.stdin.readline\n\nN, A, B = list(map(int, input().split()))\n\nh = []\n\nfor _ in range(N):\n\n h.append(int(eval(input())))\n\nh.sort()\n\ndef explosive(x):\n\n c = 0\n\n for i in range(N):\n\n if h[i] > x * B:\n\n c += -(-(h[i] - x * B) \/\/ (A - B))\n\n if c <= x: return True\n\n else: return False\n\nng = 0\n\nok = 10 ** 9\n\nm = 0\n\nwhile ok - ng > 1:\n\n m = (ng + ok) \/\/ 2\n\n #print(m, explosive(m))\n\n if explosive(m):\n\n ok = m\n\n else:\n\n ng = m\n\nprint(ok)","target":"import sys\n\ninput = sys.stdin.readline\n\nN, A, B = list(map(int, input().split()))\n\nh = [0] * N\n\nfor i in range(N): h[i] = int(eval(input()))\n\nh.sort()\n\n\n\ndef check(x):\n\n t = [h[i] - x * B for i in range(N)]\n\n for i in range(N):\n\n if t[i] > 0:\n\n x -= -(-t[i] \/\/ (A - B))\n\n if x < 0: return False\n\n return x >= 0\n\n\n\nok = 10 ** 9\n\nng = 0\n\nwhile ok - ng > 1:\n\n m = (ok + ng) \/\/ 2\n\n if check(m): ok = m\n\n else: ng = m\n\nprint(ok)","code_v0_loc":25,"code_v1_loc":22,"code_v0_num_chars":463,"code_v1_num_chars":430,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, A, B = list(map(int, input().split()))\nh = []\nfor _ in range(N):\n h.append(int(eval(input())))\nh.sort()\n\n\ndef explosive(x):\n c = 0\n for i in range(N):\n if h[i] > x * B:\n c += -(-(h[i] - x * B) \/\/ (A - B))\n if c <= x:\n return True\n else:\n return False\n\n\nng = 0\nok = 10**9\nm = 0\nwhile ok - ng > 1:\n m = (ng + ok) \/\/ 2\n # print(m, explosive(m))\n if explosive(m):\n ok = m\n else:\n ng = m\nprint(ok)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, A, B = list(map(int, input().split()))\nh = [0] * N\nfor i in range(N):\n h[i] = int(eval(input()))\nh.sort()\n\n\ndef check(x):\n t = [h[i] - x * B for i in range(N)]\n for i in range(N):\n if t[i] > 0:\n x -= -(-t[i] \/\/ (A - B))\n if x < 0:\n return False\n return x >= 0\n\n\nok = 10**9\nng = 0\nwhile ok - ng > 1:\n m = (ok + ng) \/\/ 2\n if check(m):\n ok = m\n else:\n ng = m\nprint(ok)\n","code_same":false,"relative_loc_diff_percent":12.0,"diff":["-h = []","-for _ in range(N):","- h.append(int(eval(input())))","+h = [0] * N","+for i in range(N):","+ h[i] = int(eval(input()))","-def explosive(x):","- c = 0","+def check(x):","+ t = [h[i] - x * B for i in range(N)]","- if h[i] > x * B:","- c += -(-(h[i] - x * B) \/\/ (A - B))","- if c <= x:","- return True","- else:","- return False","+ if t[i] > 0:","+ x -= -(-t[i] \/\/ (A - B))","+ if x < 0:","+ return False","+ return x >= 0","+ok = 10**9","-ok = 10**9","-m = 0","- m = (ng + ok) \/\/ 2","- # print(m, explosive(m))","- if explosive(m):","+ m = (ok + ng) \/\/ 2","+ if check(m):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0320409245,"measured_runtime_v1":0.0358263736,"runtime_lift":0.8943390397,"key":["s103278318","s567304934"]} +{"user_id":"u077536797","problem_id":"p02625","language":"python","submission_id_v0":"s530222988","submission_id_v1":"s499491949","cpu_time_v0":347,"cpu_time_v1":290,"memory_v0":28728,"memory_v1":28644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.43,"input":"n,m=list(map(int,input().split()))\n\na,M,d=1,10**9+7,[1]\n\nfor i in range(1,n+1):\n\n d.append(((m-n+i-1)*d[i-1]+(i-1)*d[i-2])%M)\n\n a=a*(m-i+1)%M\n\nprint((a*d[-1]%M))","target":"n,m=list(map(int,input().split()))\n\na,M,d=1,10**9+7,[1]\n\nfor i in range(n):\n\n d.append(((m-n+i)*d[i]+i*d[i-1])%M)\n\n a=a*(m-i)%M\n\nprint((a*d[-1]%M))","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":155,"code_v1_num_chars":141,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\na, M, d = 1, 10**9 + 7, [1]\nfor i in range(1, n + 1):\n d.append(((m - n + i - 1) * d[i - 1] + (i - 1) * d[i - 2]) % M)\n a = a * (m - i + 1) % M\nprint((a * d[-1] % M))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\na, M, d = 1, 10**9 + 7, [1]\nfor i in range(n):\n d.append(((m - n + i) * d[i] + i * d[i - 1]) % M)\n a = a * (m - i) % M\nprint((a * d[-1] % M))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(1, n + 1):","- d.append(((m - n + i - 1) * d[i - 1] + (i - 1) * d[i - 2]) % M)","- a = a * (m - i + 1) % M","+for i in range(n):","+ d.append(((m - n + i) * d[i] + i * d[i - 1]) % M)","+ a = a * (m - i) % M"],"diff_only_import_comment":false,"measured_runtime_v0":0.0702434773,"measured_runtime_v1":0.0728320687,"runtime_lift":0.9644580829,"key":["s530222988","s499491949"]} +{"user_id":"u537782349","problem_id":"p03680","language":"python","submission_id_v0":"s739182030","submission_id_v1":"s035490999","cpu_time_v0":257,"cpu_time_v1":232,"memory_v0":16372,"memory_v1":19064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.73,"input":"a = int(eval(input()))\n\nb = [[int(eval(input())), False]for i in range(a)]\n\nc = 1\n\nd = 0\n\nwhile True:\n\n d += 1\n\n if b[c-1][0] == 2:\n\n print(d)\n\n exit()\n\n else:\n\n b[c-1][1] = not b[c-1][1]\n\n if b[c-1][1]:\n\n c = b[c-1][0]\n\n else:\n\n print((-1))\n\n exit()\n","target":"a = int(eval(input()))\n\nb = [int(eval(input())) for _ in range(a)]\n\nc = 1\n\nd = 0\n\ne = {}\n\nwhile True:\n\n d += 1\n\n if b[c-1] == 2:\n\n print(d)\n\n exit()\n\n else:\n\n if (c-1) not in e:\n\n e.setdefault((c-1), \"\")\n\n else:\n\n print((-1))\n\n exit()\n\n c = b[c - 1]\n","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":314,"code_v1_num_chars":313,"code_v0_no_empty_lines":"a = int(eval(input()))\nb = [[int(eval(input())), False] for i in range(a)]\nc = 1\nd = 0\nwhile True:\n d += 1\n if b[c - 1][0] == 2:\n print(d)\n exit()\n else:\n b[c - 1][1] = not b[c - 1][1]\n if b[c - 1][1]:\n c = b[c - 1][0]\n else:\n print((-1))\n exit()\n","code_v1_no_empty_lines":"a = int(eval(input()))\nb = [int(eval(input())) for _ in range(a)]\nc = 1\nd = 0\ne = {}\nwhile True:\n d += 1\n if b[c - 1] == 2:\n print(d)\n exit()\n else:\n if (c - 1) not in e:\n e.setdefault((c - 1), \"\")\n else:\n print((-1))\n exit()\n c = b[c - 1]\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["-b = [[int(eval(input())), False] for i in range(a)]","+b = [int(eval(input())) for _ in range(a)]","+e = {}","- if b[c - 1][0] == 2:","+ if b[c - 1] == 2:","- b[c - 1][1] = not b[c - 1][1]","- if b[c - 1][1]:","- c = b[c - 1][0]","+ if (c - 1) not in e:","+ e.setdefault((c - 1), \"\")","+ c = b[c - 1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.1525077565,"measured_runtime_v1":0.1056877158,"runtime_lift":1.4430036201,"key":["s739182030","s035490999"]} +{"user_id":"u600402037","problem_id":"p03332","language":"python","submission_id_v0":"s036375250","submission_id_v1":"s272303703","cpu_time_v0":914,"cpu_time_v1":820,"memory_v0":26364,"memory_v1":26492,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.28,"input":"# coding: utf-8\n\nimport sys\n\nimport numpy as np\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nMOD = 998244353\n\nN, A, B, K = lr()\n\nanswer = 0\n\n# A * x + B * y = K\n\n# nCx * nCy\n\n\n\ndef F(x, y):\n\n return comb[x] * comb[y]\n\n\n\ndef cumprod(arr, MOD):\n\n L = len(arr); Lsq = int(L**.5+1)\n\n arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)\n\n for n in range(1, Lsq):\n\n arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD\n\n for n in range(1, Lsq):\n\n arr[n] *= arr[n-1, -1]; arr[n] %= MOD\n\n return arr.ravel()[:L]\n\n\n\ndef make_fact(U, MOD):\n\n x = np.arange(U, dtype=np.int64); x[0] = 1\n\n fact = cumprod(x, MOD)\n\n x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)\n\n fact_inv = cumprod(x, MOD)[::-1]\n\n return fact, fact_inv\n\n\n\nU = N + 1 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650\n\nfact, fact_inv = make_fact(U, MOD)\n\nfact_N = fact[N]\n\ncomb = fact_N * fact_inv % MOD * fact_inv[::-1] % MOD\n\n\n\nfor x in range(N+1):\n\n temp = K-A*x\n\n q, r = divmod(temp, B)\n\n if r != 0:\n\n continue\n\n if q > N:\n\n continue\n\n if q < 0:\n\n break\n\n answer += F(x, q)\n\n answer %= MOD\n\n\n\nprint((answer % MOD))\n","target":"# coding: utf-8\n\nimport sys\n\nimport numpy as np\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\nMOD = 998244353\n\nN, A, B, K = lr()\n\nanswer = 0\n\n# A * x + B * y = K\n\n# nCx * nCy\n\n\n\ndef F(x, y):\n\n return comb[x] * comb[y] % MOD\n\n\n\ndef cumprod(arr, MOD):\n\n L = len(arr); Lsq = int(L**.5+1)\n\n arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)\n\n for n in range(1, Lsq):\n\n arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD\n\n for n in range(1, Lsq):\n\n arr[n] *= arr[n-1, -1]; arr[n] %= MOD\n\n return arr.ravel()[:L]\n\n\n\ndef make_fact(U, MOD):\n\n x = np.arange(U, dtype=np.int64); x[0] = 1\n\n fact = cumprod(x, MOD)\n\n x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)\n\n fact_inv = cumprod(x, MOD)[::-1]\n\n return fact, fact_inv\n\n\n\nU = N + 1 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650\n\nfact, fact_inv = make_fact(U, MOD)\n\nfact_N = fact[N]\n\ncomb = fact_N * fact_inv % MOD * fact_inv[::-1] % MOD\n\n\n\nfor x in range(N+1):\n\n temp = K-A*x\n\n q, r = divmod(temp, B)\n\n if r != 0:\n\n continue\n\n if q > N:\n\n continue\n\n if q < 0:\n\n break\n\n answer += F(x, q)\n\n\n\nprint((answer % MOD))\n","code_v0_loc":51,"code_v1_loc":50,"code_v0_num_chars":1209,"code_v1_num_chars":1196,"code_v0_no_empty_lines":"# coding: utf-8\nimport sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nMOD = 998244353\nN, A, B, K = lr()\nanswer = 0\n# A * x + B * y = K\n# nCx * nCy\ndef F(x, y):\n return comb[x] * comb[y]\n\n\ndef cumprod(arr, MOD):\n L = len(arr)\n Lsq = int(L**0.5 + 1)\n arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)\n for n in range(1, Lsq):\n arr[:, n] *= arr[:, n - 1]\n arr[:, n] %= MOD\n for n in range(1, Lsq):\n arr[n] *= arr[n - 1, -1]\n arr[n] %= MOD\n return arr.ravel()[:L]\n\n\ndef make_fact(U, MOD):\n x = np.arange(U, dtype=np.int64)\n x[0] = 1\n fact = cumprod(x, MOD)\n x = np.arange(U, 0, -1, dtype=np.int64)\n x[0] = pow(int(fact[-1]), MOD - 2, MOD)\n fact_inv = cumprod(x, MOD)[::-1]\n return fact, fact_inv\n\n\nU = N + 1 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650\nfact, fact_inv = make_fact(U, MOD)\nfact_N = fact[N]\ncomb = fact_N * fact_inv % MOD * fact_inv[::-1] % MOD\nfor x in range(N + 1):\n temp = K - A * x\n q, r = divmod(temp, B)\n if r != 0:\n continue\n if q > N:\n continue\n if q < 0:\n break\n answer += F(x, q)\n answer %= MOD\nprint((answer % MOD))\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\nMOD = 998244353\nN, A, B, K = lr()\nanswer = 0\n# A * x + B * y = K\n# nCx * nCy\ndef F(x, y):\n return comb[x] * comb[y] % MOD\n\n\ndef cumprod(arr, MOD):\n L = len(arr)\n Lsq = int(L**0.5 + 1)\n arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)\n for n in range(1, Lsq):\n arr[:, n] *= arr[:, n - 1]\n arr[:, n] %= MOD\n for n in range(1, Lsq):\n arr[n] *= arr[n - 1, -1]\n arr[n] %= MOD\n return arr.ravel()[:L]\n\n\ndef make_fact(U, MOD):\n x = np.arange(U, dtype=np.int64)\n x[0] = 1\n fact = cumprod(x, MOD)\n x = np.arange(U, 0, -1, dtype=np.int64)\n x[0] = pow(int(fact[-1]), MOD - 2, MOD)\n fact_inv = cumprod(x, MOD)[::-1]\n return fact, fact_inv\n\n\nU = N + 1 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650\nfact, fact_inv = make_fact(U, MOD)\nfact_N = fact[N]\ncomb = fact_N * fact_inv % MOD * fact_inv[::-1] % MOD\nfor x in range(N + 1):\n temp = K - A * x\n q, r = divmod(temp, B)\n if r != 0:\n continue\n if q > N:\n continue\n if q < 0:\n break\n answer += F(x, q)\nprint((answer % MOD))\n","code_same":false,"relative_loc_diff_percent":1.9607843137,"diff":["- return comb[x] * comb[y]","+ return comb[x] * comb[y] % MOD","- answer %= MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.3380507927,"measured_runtime_v1":0.5576097305,"runtime_lift":0.6062498092,"key":["s036375250","s272303703"]} +{"user_id":"u497046426","problem_id":"p02647","language":"python","submission_id_v0":"s060332478","submission_id_v1":"s301830492","cpu_time_v0":486,"cpu_time_v1":353,"memory_v0":180900,"memory_v1":170764,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.37,"input":"N, K = list(map(int, input().split()))\n\n*A, = list(map(int, input().split()))\n\nfor k in range(41):\n\n B = [0] * N\n\n for i, a in enumerate(A):\n\n l = max(0, i - a)\n\n r = min(N - 1, i + a)\n\n B[l] += 1\n\n if r + 1 < N: B[r + 1] -= 1\n\n for i in range(1, N): B[i] += B[i-1]\n\n A = B\n\n if k == K - 1: break\n\nprint((*A))","target":"N, K = list(map(int, input().split()))\n\n*A, = list(map(int, input().split()))\n\nfor _ in range(min(K, 50)):\n\n counter = [0] * (N+2)\n\n for i, a in enumerate(A, 1):\n\n counter[max(0, i - a)] += 1\n\n counter[min(N + 1, i + a + 1)] += -1\n\n for i in range(1, len(counter) - 1):\n\n counter[i] += counter[i-1]\n\n A = counter[1:N+1]\n\nprint((*A))\n","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":338,"code_v1_num_chars":352,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\n(*A,) = list(map(int, input().split()))\nfor k in range(41):\n B = [0] * N\n for i, a in enumerate(A):\n l = max(0, i - a)\n r = min(N - 1, i + a)\n B[l] += 1\n if r + 1 < N:\n B[r + 1] -= 1\n for i in range(1, N):\n B[i] += B[i - 1]\n A = B\n if k == K - 1:\n break\nprint((*A))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\n(*A,) = list(map(int, input().split()))\nfor _ in range(min(K, 50)):\n counter = [0] * (N + 2)\n for i, a in enumerate(A, 1):\n counter[max(0, i - a)] += 1\n counter[min(N + 1, i + a + 1)] += -1\n for i in range(1, len(counter) - 1):\n counter[i] += counter[i - 1]\n A = counter[1 : N + 1]\nprint((*A))\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-for k in range(41):","- B = [0] * N","- for i, a in enumerate(A):","- l = max(0, i - a)","- r = min(N - 1, i + a)","- B[l] += 1","- if r + 1 < N:","- B[r + 1] -= 1","- for i in range(1, N):","- B[i] += B[i - 1]","- A = B","- if k == K - 1:","- break","+for _ in range(min(K, 50)):","+ counter = [0] * (N + 2)","+ for i, a in enumerate(A, 1):","+ counter[max(0, i - a)] += 1","+ counter[min(N + 1, i + a + 1)] += -1","+ for i in range(1, len(counter) - 1):","+ counter[i] += counter[i - 1]","+ A = counter[1 : N + 1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0411268446,"measured_runtime_v1":0.0395070632,"runtime_lift":1.0409997928,"key":["s060332478","s301830492"]} +{"user_id":"u847467233","problem_id":"p00445","language":"python","submission_id_v0":"s651720371","submission_id_v1":"s137188982","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":6536,"memory_v1":5888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"# AOJ 0522: JOI and IOI\n\n# Python3 2018.6.30 bal4u\n\n\n\nimport re\n\n\n\nmatch = re.findall(r'[0-9]+', 'xxxx1aaaa22cc333ssss')\n\nwhile True:\n\n\ttry: s = input()\n\n\texcept: break\n\n\tjoi = ioi = 0\n\n\tfor i in range(len(s)-2):\n\n\t\tif s[i+1] == 'O' and s[i+2] == 'I':\n\n\t\t\tif s[i] == 'J': joi += 1\n\n\t\t\tif s[i] == 'I': ioi += 1\n\n\tprint(joi, ioi, sep='\\n')\n","target":"# AOJ 0522: JOI and IOI\n\n# Python3 2018.6.30 bal4u\n\n\n\nwhile True:\n\n\ttry: s = input()\n\n\texcept: break\n\n\tc = [s[i:i+3] for i in range(len(s)-2)]\n\n\tprint(*[c.count(a) for a in [\"JOI\", \"IOI\"]], sep='\\n')\n","code_v0_loc":15,"code_v1_loc":8,"code_v0_num_chars":338,"code_v1_num_chars":200,"code_v0_no_empty_lines":"# AOJ 0522: JOI and IOI\n# Python3 2018.6.30 bal4u\nimport re\n\nmatch = re.findall(r\"[0-9]+\", \"xxxx1aaaa22cc333ssss\")\nwhile True:\n try:\n s = input()\n except:\n break\n joi = ioi = 0\n for i in range(len(s) - 2):\n if s[i + 1] == \"O\" and s[i + 2] == \"I\":\n if s[i] == \"J\":\n joi += 1\n if s[i] == \"I\":\n ioi += 1\n print(joi, ioi, sep=\"\\n\")\n","code_v1_no_empty_lines":"# AOJ 0522: JOI and IOI\n# Python3 2018.6.30 bal4u\nwhile True:\n try:\n s = input()\n except:\n break\n c = [s[i : i + 3] for i in range(len(s) - 2)]\n print(*[c.count(a) for a in [\"JOI\", \"IOI\"]], sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":46.6666666667,"diff":["-import re","-","-match = re.findall(r\"[0-9]+\", \"xxxx1aaaa22cc333ssss\")","- joi = ioi = 0","- for i in range(len(s) - 2):","- if s[i + 1] == \"O\" and s[i + 2] == \"I\":","- if s[i] == \"J\":","- joi += 1","- if s[i] == \"I\":","- ioi += 1","- print(joi, ioi, sep=\"\\n\")","+ c = [s[i : i + 3] for i in range(len(s) - 2)]","+ print(*[c.count(a) for a in [\"JOI\", \"IOI\"]], sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0532096533,"measured_runtime_v1":0.0075870691,"runtime_lift":7.0132026515,"key":["s651720371","s137188982"]} +{"user_id":"u222668979","problem_id":"p03215","language":"python","submission_id_v0":"s625479681","submission_id_v1":"s093076930","cpu_time_v0":2214,"cpu_time_v1":1230,"memory_v0":28820,"memory_v1":28824,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.44,"input":"from itertools import accumulate\n\nn, k = list(map(int, input().split()))\n\na = [0] + list(accumulate(list(map(int, input().split()))))\n\n\n\nbtfl = []\n\nfor i in range(0, n):\n\n for j in range(i + 1, n + 1):\n\n btfl.append(a[j] - a[i])\n\n\n\n# \u89e3\u8aacAC\n\nans = 0\n\nfor i in range(50)[::-1]:\n\n num, cnt = ans + pow(2, i), 0\n\n for b in btfl:\n\n if num == num & b:\n\n cnt += 1\n\n if cnt >= k:\n\n ans = num\n\nprint(ans)\n","target":"from itertools import accumulate\n\n\n\ndef main():\n\n n, k = list(map(int, input().split()))\n\n a = [0] + list(accumulate(list(map(int, input().split()))))\n\n\n\n btfl = []\n\n for i in range(0, n):\n\n for j in range(i + 1, n + 1):\n\n btfl.append(a[j] - a[i])\n\n\n\n # \u89e3\u8aacAC\n\n ans = 0\n\n for i in range(50)[::-1]:\n\n num, cnt = ans + pow(2, i), 0\n\n for b in btfl:\n\n if num == num & b:\n\n cnt += 1\n\n if cnt >= k:\n\n ans = num\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":19,"code_v1_loc":24,"code_v0_num_chars":427,"code_v1_num_chars":548,"code_v0_no_empty_lines":"from itertools import accumulate\n\nn, k = list(map(int, input().split()))\na = [0] + list(accumulate(list(map(int, input().split()))))\nbtfl = []\nfor i in range(0, n):\n for j in range(i + 1, n + 1):\n btfl.append(a[j] - a[i])\n# \u89e3\u8aacAC\nans = 0\nfor i in range(50)[::-1]:\n num, cnt = ans + pow(2, i), 0\n for b in btfl:\n if num == num & b:\n cnt += 1\n if cnt >= k:\n ans = num\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import accumulate\n\n\ndef main():\n n, k = list(map(int, input().split()))\n a = [0] + list(accumulate(list(map(int, input().split()))))\n btfl = []\n for i in range(0, n):\n for j in range(i + 1, n + 1):\n btfl.append(a[j] - a[i])\n # \u89e3\u8aacAC\n ans = 0\n for i in range(50)[::-1]:\n num, cnt = ans + pow(2, i), 0\n for b in btfl:\n if num == num & b:\n cnt += 1\n if cnt >= k:\n ans = num\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":20.8333333333,"diff":["-n, k = list(map(int, input().split()))","-a = [0] + list(accumulate(list(map(int, input().split()))))","-btfl = []","-for i in range(0, n):","- for j in range(i + 1, n + 1):","- btfl.append(a[j] - a[i])","-# \u89e3\u8aacAC","-ans = 0","-for i in range(50)[::-1]:","- num, cnt = ans + pow(2, i), 0","- for b in btfl:","- if num == num & b:","- cnt += 1","- if cnt >= k:","- ans = num","-print(ans)","+","+def main():","+ n, k = list(map(int, input().split()))","+ a = [0] + list(accumulate(list(map(int, input().split()))))","+ btfl = []","+ for i in range(0, n):","+ for j in range(i + 1, n + 1):","+ btfl.append(a[j] - a[i])","+ # \u89e3\u8aacAC","+ ans = 0","+ for i in range(50)[::-1]:","+ num, cnt = ans + pow(2, i), 0","+ for b in btfl:","+ if num == num & b:","+ cnt += 1","+ if cnt >= k:","+ ans = num","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0380746087,"measured_runtime_v1":0.0536582812,"runtime_lift":0.709575631,"key":["s625479681","s093076930"]} +{"user_id":"u073852194","problem_id":"p03007","language":"python","submission_id_v0":"s842435390","submission_id_v1":"s771114713","cpu_time_v0":260,"cpu_time_v1":158,"memory_v0":14260,"memory_v1":93888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.23,"input":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nS = sum(map(abs,A))\n\n\n\nif all([a>0 for a in A]):\n\n print((S-2*min(A)))\n\n A = sorted(A)\n\n B = [A[0]]\n\n for i in range(1,N):\n\n B.append(B[-1]-A[i])\n\n for i in range(N-2):\n\n print((B[i],A[i+1]))\n\n print((A[N-1],B[N-2]))\n\n\n\nelif all([a<0 for a in A]):\n\n print((S+2*max(A)))\n\n A = sorted(A)\n\n B = [A[-1]]\n\n for i in range(N-1):\n\n B.append(B[-1]-A[i])\n\n for i in range(N-1):\n\n print((B[i],A[i]))\n\n\n\nelse:\n\n print(S)\n\n A = sorted(A)\n\n B = [A[0]]\n\n for i in range(N):\n\n if N-1-2-i<0 or A[-2-i]<0:\n\n print((A[-1-i],B[-1]))\n\n B.append(A[-1-i]-B[-1])\n\n break\n\n print((B[-1],A[-1-i]))\n\n B.append(B[-1]-A[-1-i])\n\n C = [B[-1]]\n\n for i in range(1,N):\n\n if A[i]>=0:\n\n break\n\n print((C[-1],A[i]))\n\n C.append(C[-1]-A[i])","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nA.sort()\n\nS = sum(A)\n\n\n\nif A[0] >= 0:\n\n print((S - A[0] * 2))\n\n tmp = A[0]\n\n for i in range(1, N - 1):\n\n print((tmp, A[i]))\n\n tmp -= A[i]\n\n print((A[-1], tmp))\n\n\n\nelif A[-1] <= 0:\n\n print((-S + A[-1] * 2))\n\n tmp = A[-1]\n\n for i in range(1, N):\n\n print((tmp, A[~i]))\n\n tmp -= A[~i]\n\n\n\nelse:\n\n op = []\n\n tmp1 = A[-1]\n\n i = 1\n\n while A[i] < 0:\n\n op.append((tmp1, A[i]))\n\n tmp1 -= A[i]\n\n i += 1\n\n tmp2 = A[0]\n\n i = 1\n\n while A[~i] >= 0:\n\n op.append((tmp2, A[~i]))\n\n tmp2 -= A[~i]\n\n i += 1\n\n print((tmp1 - tmp2))\n\n for x, y in op:\n\n print((x, y))\n\n print((tmp1, tmp2))","code_v0_loc":41,"code_v1_loc":39,"code_v0_num_chars":907,"code_v1_num_chars":732,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nS = sum(map(abs, A))\nif all([a > 0 for a in A]):\n print((S - 2 * min(A)))\n A = sorted(A)\n B = [A[0]]\n for i in range(1, N):\n B.append(B[-1] - A[i])\n for i in range(N - 2):\n print((B[i], A[i + 1]))\n print((A[N - 1], B[N - 2]))\nelif all([a < 0 for a in A]):\n print((S + 2 * max(A)))\n A = sorted(A)\n B = [A[-1]]\n for i in range(N - 1):\n B.append(B[-1] - A[i])\n for i in range(N - 1):\n print((B[i], A[i]))\nelse:\n print(S)\n A = sorted(A)\n B = [A[0]]\n for i in range(N):\n if N - 1 - 2 - i < 0 or A[-2 - i] < 0:\n print((A[-1 - i], B[-1]))\n B.append(A[-1 - i] - B[-1])\n break\n print((B[-1], A[-1 - i]))\n B.append(B[-1] - A[-1 - i])\n C = [B[-1]]\n for i in range(1, N):\n if A[i] >= 0:\n break\n print((C[-1], A[i]))\n C.append(C[-1] - A[i])\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nA.sort()\nS = sum(A)\nif A[0] >= 0:\n print((S - A[0] * 2))\n tmp = A[0]\n for i in range(1, N - 1):\n print((tmp, A[i]))\n tmp -= A[i]\n print((A[-1], tmp))\nelif A[-1] <= 0:\n print((-S + A[-1] * 2))\n tmp = A[-1]\n for i in range(1, N):\n print((tmp, A[~i]))\n tmp -= A[~i]\nelse:\n op = []\n tmp1 = A[-1]\n i = 1\n while A[i] < 0:\n op.append((tmp1, A[i]))\n tmp1 -= A[i]\n i += 1\n tmp2 = A[0]\n i = 1\n while A[~i] >= 0:\n op.append((tmp2, A[~i]))\n tmp2 -= A[~i]\n i += 1\n print((tmp1 - tmp2))\n for x, y in op:\n print((x, y))\n print((tmp1, tmp2))\n","code_same":false,"relative_loc_diff_percent":4.8780487805,"diff":["-S = sum(map(abs, A))","-if all([a > 0 for a in A]):","- print((S - 2 * min(A)))","- A = sorted(A)","- B = [A[0]]","+A.sort()","+S = sum(A)","+if A[0] >= 0:","+ print((S - A[0] * 2))","+ tmp = A[0]","+ for i in range(1, N - 1):","+ print((tmp, A[i]))","+ tmp -= A[i]","+ print((A[-1], tmp))","+elif A[-1] <= 0:","+ print((-S + A[-1] * 2))","+ tmp = A[-1]","- B.append(B[-1] - A[i])","- for i in range(N - 2):","- print((B[i], A[i + 1]))","- print((A[N - 1], B[N - 2]))","-elif all([a < 0 for a in A]):","- print((S + 2 * max(A)))","- A = sorted(A)","- B = [A[-1]]","- for i in range(N - 1):","- B.append(B[-1] - A[i])","- for i in range(N - 1):","- print((B[i], A[i]))","+ print((tmp, A[~i]))","+ tmp -= A[~i]","- print(S)","- A = sorted(A)","- B = [A[0]]","- for i in range(N):","- if N - 1 - 2 - i < 0 or A[-2 - i] < 0:","- print((A[-1 - i], B[-1]))","- B.append(A[-1 - i] - B[-1])","- break","- print((B[-1], A[-1 - i]))","- B.append(B[-1] - A[-1 - i])","- C = [B[-1]]","- for i in range(1, N):","- if A[i] >= 0:","- break","- print((C[-1], A[i]))","- C.append(C[-1] - A[i])","+ op = []","+ tmp1 = A[-1]","+ i = 1","+ while A[i] < 0:","+ op.append((tmp1, A[i]))","+ tmp1 -= A[i]","+ i += 1","+ tmp2 = A[0]","+ i = 1","+ while A[~i] >= 0:","+ op.append((tmp2, A[~i]))","+ tmp2 -= A[~i]","+ i += 1","+ print((tmp1 - tmp2))","+ for x, y in op:","+ print((x, y))","+ print((tmp1, tmp2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373317069,"measured_runtime_v1":0.0371464168,"runtime_lift":1.0049881012,"key":["s842435390","s771114713"]} +{"user_id":"u613920660","problem_id":"p03436","language":"python","submission_id_v0":"s615718634","submission_id_v1":"s734450828","cpu_time_v0":341,"cpu_time_v1":27,"memory_v0":3572,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.08,"input":"from collections import deque\n\n\n\ndef bfs(S,W,H):\n\n dx=(-1,0,1,0)\n\n dy=(0,1,0,-1)\n\n queue=deque([[0,0]])\n\n visited=[]\n\n goal=False\n\n cnt=deque([0])\n\n while queue and goal==False:\n\n exe=queue.popleft()\n\n C=cnt.popleft()\n\n for i in range(len(dx)):\n\n x=exe[0]+dx[i]\n\n y=exe[1]+dy[i]\n\n if [x,y]==[W-1,H-1]:\n\n goal=True\n\n elif 0<=x<=W-1 and 0<=y<=H-1 and S[y][x]==\".\":\n\n if [x,y] not in visited:\n\n queue.append([x,y])\n\n visited.append([x,y])\n\n cnt.append(C+1) \n\n return goal,C+1\n\n\n\ndef main():\n\n H,W=list(map(int,input().strip().split()))\n\n S=[list(eval(input())) for _ in range(H)]\n\n # number of dot\n\n num_sharp=0\n\n for i in range(H):\n\n for j in range(W):\n\n if S[i][j]==\"#\":\n\n num_sharp+=1\n\n goal,num=bfs(S,W,H)\n\n if goal:\n\n return W*H-num_sharp-(num+1)\n\n else:\n\n return -1\n\n\n\nif __name__==\"__main__\":\n\n print((main()))\n","target":"from collections import deque\n\n\n\ndef n_bfs(S,W,H):\n\n dx=(-1,0,1,0)\n\n dy=(0,1,0,-1)\n\n queue=deque([[0,0]])\n\n d=[[0]*W for _ in range(H)]\n\n d[0][0]=1\n\n while queue:\n\n x,y=queue.popleft()\n\n for n in range(4):\n\n nx,ny=x+dx[n],y+dy[n]\n\n if 0<=nx<=W-1 and 0<=ny<=H-1 and S[ny][nx]==\".\" and d[ny][nx]==0:\n\n queue.append([nx,ny])\n\n d[ny][nx]=d[y][x]+1\n\n return d[-1][-1]\n\n\n\ndef n_main():\n\n H,W=list(map(int,input().strip().split()))\n\n S=[list(eval(input())) for _ in range(H)]\n\n ans=n_bfs(S,W,H)\n\n num_dot=sum(s.count(\".\") for s in S)\n\n \n\n return num_dot-ans if ans!=0 else -1\n\n\n\nif __name__==\"__main__\":\n\n print((n_main()))","code_v0_loc":41,"code_v1_loc":27,"code_v0_num_chars":1051,"code_v1_num_chars":710,"code_v0_no_empty_lines":"from collections import deque\n\n\ndef bfs(S, W, H):\n dx = (-1, 0, 1, 0)\n dy = (0, 1, 0, -1)\n queue = deque([[0, 0]])\n visited = []\n goal = False\n cnt = deque([0])\n while queue and goal == False:\n exe = queue.popleft()\n C = cnt.popleft()\n for i in range(len(dx)):\n x = exe[0] + dx[i]\n y = exe[1] + dy[i]\n if [x, y] == [W - 1, H - 1]:\n goal = True\n elif 0 <= x <= W - 1 and 0 <= y <= H - 1 and S[y][x] == \".\":\n if [x, y] not in visited:\n queue.append([x, y])\n visited.append([x, y])\n cnt.append(C + 1)\n return goal, C + 1\n\n\ndef main():\n H, W = list(map(int, input().strip().split()))\n S = [list(eval(input())) for _ in range(H)]\n # number of dot\n num_sharp = 0\n for i in range(H):\n for j in range(W):\n if S[i][j] == \"#\":\n num_sharp += 1\n goal, num = bfs(S, W, H)\n if goal:\n return W * H - num_sharp - (num + 1)\n else:\n return -1\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_v1_no_empty_lines":"from collections import deque\n\n\ndef n_bfs(S, W, H):\n dx = (-1, 0, 1, 0)\n dy = (0, 1, 0, -1)\n queue = deque([[0, 0]])\n d = [[0] * W for _ in range(H)]\n d[0][0] = 1\n while queue:\n x, y = queue.popleft()\n for n in range(4):\n nx, ny = x + dx[n], y + dy[n]\n if (\n 0 <= nx <= W - 1\n and 0 <= ny <= H - 1\n and S[ny][nx] == \".\"\n and d[ny][nx] == 0\n ):\n queue.append([nx, ny])\n d[ny][nx] = d[y][x] + 1\n return d[-1][-1]\n\n\ndef n_main():\n H, W = list(map(int, input().strip().split()))\n S = [list(eval(input())) for _ in range(H)]\n ans = n_bfs(S, W, H)\n num_dot = sum(s.count(\".\") for s in S)\n return num_dot - ans if ans != 0 else -1\n\n\nif __name__ == \"__main__\":\n print((n_main()))\n","code_same":false,"relative_loc_diff_percent":34.1463414634,"diff":["-def bfs(S, W, H):","+def n_bfs(S, W, H):","- visited = []","- goal = False","- cnt = deque([0])","- while queue and goal == False:","- exe = queue.popleft()","- C = cnt.popleft()","- for i in range(len(dx)):","- x = exe[0] + dx[i]","- y = exe[1] + dy[i]","- if [x, y] == [W - 1, H - 1]:","- goal = True","- elif 0 <= x <= W - 1 and 0 <= y <= H - 1 and S[y][x] == \".\":","- if [x, y] not in visited:","- queue.append([x, y])","- visited.append([x, y])","- cnt.append(C + 1)","- return goal, C + 1","+ d = [[0] * W for _ in range(H)]","+ d[0][0] = 1","+ while queue:","+ x, y = queue.popleft()","+ for n in range(4):","+ nx, ny = x + dx[n], y + dy[n]","+ if (","+ 0 <= nx <= W - 1","+ and 0 <= ny <= H - 1","+ and S[ny][nx] == \".\"","+ and d[ny][nx] == 0","+ ):","+ queue.append([nx, ny])","+ d[ny][nx] = d[y][x] + 1","+ return d[-1][-1]","-def main():","+def n_main():","- # number of dot","- num_sharp = 0","- for i in range(H):","- for j in range(W):","- if S[i][j] == \"#\":","- num_sharp += 1","- goal, num = bfs(S, W, H)","- if goal:","- return W * H - num_sharp - (num + 1)","- else:","- return -1","+ ans = n_bfs(S, W, H)","+ num_dot = sum(s.count(\".\") for s in S)","+ return num_dot - ans if ans != 0 else -1","- print((main()))","+ print((n_main()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0424755168,"measured_runtime_v1":0.0642669895,"runtime_lift":0.6609227714,"key":["s615718634","s734450828"]} +{"user_id":"u186838327","problem_id":"p02630","language":"python","submission_id_v0":"s906063107","submission_id_v1":"s710107696","cpu_time_v0":233,"cpu_time_v1":153,"memory_v0":92676,"memory_v1":84692,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.33,"input":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nn = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nq = int(eval(input()))\n\n\n\nfrom collections import Counter\n\nC = Counter(A)\n\nC = dict(C)\n\nS = sum(A)\n\nfor i in range(q):\n\n b, c = list(map(int, input().split()))\n\n if b in C:\n\n vb = C[b]\n\n C[b] = 0\n\n S -= b*vb\n\n S += c*vb\n\n print(S)\n\n if c in C:\n\n C[c] += vb\n\n else:\n\n C[c] = vb\n\n else:\n\n print(S)\n","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nn = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nS = sum(A)\n\n\n\nD = [0]*(10**5+1)\n\nfor a in A:\n\n D[a] += 1\n\n\n\nq = int(eval(input()))\n\nfor i in range(q):\n\n b, c = list(map(int, input().split()))\n\n S -= D[b]*b\n\n S += D[b]*c\n\n D[c] += D[b]\n\n D[b] = 0\n\n print(S)\n","code_v0_loc":25,"code_v1_loc":19,"code_v0_num_chars":475,"code_v1_num_chars":322,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nn = int(eval(input()))\nA = list(map(int, input().split()))\nq = int(eval(input()))\nfrom collections import Counter\n\nC = Counter(A)\nC = dict(C)\nS = sum(A)\nfor i in range(q):\n b, c = list(map(int, input().split()))\n if b in C:\n vb = C[b]\n C[b] = 0\n S -= b * vb\n S += c * vb\n print(S)\n if c in C:\n C[c] += vb\n else:\n C[c] = vb\n else:\n print(S)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nn = int(eval(input()))\nA = list(map(int, input().split()))\nS = sum(A)\nD = [0] * (10**5 + 1)\nfor a in A:\n D[a] += 1\nq = int(eval(input()))\nfor i in range(q):\n b, c = list(map(int, input().split()))\n S -= D[b] * b\n S += D[b] * c\n D[c] += D[b]\n D[b] = 0\n print(S)\n","code_same":false,"relative_loc_diff_percent":24.0,"diff":["+S = sum(A)","+D = [0] * (10**5 + 1)","+for a in A:","+ D[a] += 1","-from collections import Counter","-","-C = Counter(A)","-C = dict(C)","-S = sum(A)","- if b in C:","- vb = C[b]","- C[b] = 0","- S -= b * vb","- S += c * vb","- print(S)","- if c in C:","- C[c] += vb","- else:","- C[c] = vb","- else:","- print(S)","+ S -= D[b] * b","+ S += D[b] * c","+ D[c] += D[b]","+ D[b] = 0","+ print(S)"],"diff_only_import_comment":false,"measured_runtime_v0":0.083178782,"measured_runtime_v1":0.0469821846,"runtime_lift":1.7704324009,"key":["s906063107","s710107696"]} +{"user_id":"u588341295","problem_id":"p03634","language":"python","submission_id_v0":"s252345603","submission_id_v1":"s958136397","cpu_time_v0":1332,"cpu_time_v1":804,"memory_v0":188080,"memory_v1":43904,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.64,"input":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\n# \u518d\u5e30\u547c\u3073\u51fa\u3057\u306e\u56de\u6570\u5236\u9650(\u30c7\u30d5\u30a9\u30eb\u30c81000)\n\nsys.setrecursionlimit(10 ** 9)\n\n\n\nN = int(eval(input()))\n\nnodes = [[] for _ in range(N+1)]\n\nfor i in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n # nodes[\u51fa\u767a\u30ce\u30fc\u30c9](\u5230\u7740\u30ce\u30fc\u30c9, \u30b3\u30b9\u30c8))\n\n nodes[a].append((b, c))\n\n # \u7121\u5411\u30b0\u30e9\u30d5\u306a\u306e\u3067\u3053\u3063\u3061\u3082\u5165\u308c\u308b\n\n nodes[b].append((a, c))\n\n\n\nmemo = [0] * (N+1)\n\ndef dfs(cur, prev, dist):\n\n memo[cur] = dist\n\n for nxt, cost in nodes[cur]:\n\n if nxt == prev:\n\n continue\n\n dfs(nxt, cur, dist+cost)\n\n\n\nQ, K = list(map(int, input().split()))\n\ndfs(K, -1, 0)\n\n\n\nfor i in range(Q):\n\n x, y = list(map(int, input().split()))\n\n # \u4eca\u56de\u306f\u5168\u3066K\u3092\u7d4c\u7531\u3059\u308b\u306e\u3067\u3001K\u304b\u3089\u306e\u8ddd\u96e2\u3055\u3048\u5206\u304b\u308c\u3070\u5168\u90e8\u51fa\u308b\n\n print((memo[x] + memo[y]))\n","target":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\n\n\ndef dijkstra(N: int, nodes: list, src: int) -> list:\n\n \"\"\" \u30c0\u30a4\u30af\u30b9\u30c8\u30e9\u9ad8\u901f\u5316\u7248(\u9802\u70b9\u6570, \u96a3\u63a5\u30ea\u30b9\u30c8(0-indexed), \u59cb\u70b9) \"\"\"\n\n from heapq import heappush, heappop\n\n\n\n # \u9802\u70b9[\u3042\u308b\u59cb\u70b9\u304b\u3089\u306e\u6700\u77ed\u8ddd\u96e2]\n\n res = [INF] * N\n\n # \u30b9\u30bf\u30fc\u30c8\u4f4d\u7f6e\n\n que = [src]\n\n res[src] = 0\n\n # \u30ad\u30e5\u30fc\u304c\u7a7a\u306b\u306a\u308b\u307e\u3067\n\n while len(que) != 0:\n\n # \u8ddd\u96e2*N + \u73fe\u5728\u306e\u30ce\u30fc\u30c9\n\n cur = heappop(que)\n\n # \u8ddd\u96e2\u3068\u30ce\u30fc\u30c9\u306b\u5206\u3051\u308b\n\n dist = cur \/\/ N\n\n cur %= N\n\n # \u51fa\u767a\u30ce\u30fc\u30c9cur\u306e\u5230\u7740\u30ce\u30fc\u30c9\u3067\u30eb\u30fc\u30d7\n\n for nxt, cost in nodes[cur]:\n\n # \u4eca\u56de\u306e\u7d4c\u8def\u306e\u304c\u77ed\u3044\u6642\n\n if dist + cost < res[nxt]:\n\n res[nxt] = dist + cost\n\n # \u8ddd\u96e2*N+\u30ce\u30fc\u30c9\u756a\u53f7 \u306e\u5f62\u3067\u30ad\u30e5\u30fc\u306b\u8a70\u3081\u308b\n\n heappush(que, (dist+cost)*N+nxt)\n\n # \u30ce\u30fc\u30c9src\u304b\u3089\u306e\u6700\u77ed\u8ddd\u96e2\u30ea\u30b9\u30c8\u3092\u8fd4\u5374\n\n return res\n\n\n\nN = INT()\n\nnodes = [[] for i in range(N)]\n\nfor i in range(N-1):\n\n a, b, c = MAP()\n\n a -= 1; b -= 1\n\n nodes[a].append((b, c))\n\n nodes[b].append((a, c))\n\n\n\nQ, K = MAP()\n\nK -= 1\n\nres = dijkstra(N, nodes, K)\n\nfor i in range(Q):\n\n x, y = MAP()\n\n x -= 1; y -= 1\n\n ans = res[x] + res[y]\n\n print(ans)\n","code_v0_loc":32,"code_v1_loc":62,"code_v0_num_chars":744,"code_v1_num_chars":1727,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\n# \u518d\u5e30\u547c\u3073\u51fa\u3057\u306e\u56de\u6570\u5236\u9650(\u30c7\u30d5\u30a9\u30eb\u30c81000)\nsys.setrecursionlimit(10**9)\nN = int(eval(input()))\nnodes = [[] for _ in range(N + 1)]\nfor i in range(N - 1):\n a, b, c = list(map(int, input().split()))\n # nodes[\u51fa\u767a\u30ce\u30fc\u30c9](\u5230\u7740\u30ce\u30fc\u30c9, \u30b3\u30b9\u30c8))\n nodes[a].append((b, c))\n # \u7121\u5411\u30b0\u30e9\u30d5\u306a\u306e\u3067\u3053\u3063\u3061\u3082\u5165\u308c\u308b\n nodes[b].append((a, c))\nmemo = [0] * (N + 1)\n\n\ndef dfs(cur, prev, dist):\n memo[cur] = dist\n for nxt, cost in nodes[cur]:\n if nxt == prev:\n continue\n dfs(nxt, cur, dist + cost)\n\n\nQ, K = list(map(int, input().split()))\ndfs(K, -1, 0)\nfor i in range(Q):\n x, y = list(map(int, input().split()))\n # \u4eca\u56de\u306f\u5168\u3066K\u3092\u7d4c\u7531\u3059\u308b\u306e\u3067\u3001K\u304b\u3089\u306e\u8ddd\u96e2\u3055\u3048\u5206\u304b\u308c\u3070\u5168\u90e8\u51fa\u308b\n print((memo[x] + memo[y]))\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef list4d(a, b, c, d, e):\n return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x \/\/ y))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST(N=None):\n return list(MAP()) if N is None else [INT() for i in range(N)]\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = 10**18\nMOD = 10**9 + 7\n\n\ndef dijkstra(N: int, nodes: list, src: int) -> list:\n \"\"\"\u30c0\u30a4\u30af\u30b9\u30c8\u30e9\u9ad8\u901f\u5316\u7248(\u9802\u70b9\u6570, \u96a3\u63a5\u30ea\u30b9\u30c8(0-indexed), \u59cb\u70b9)\"\"\"\n from heapq import heappush, heappop\n\n # \u9802\u70b9[\u3042\u308b\u59cb\u70b9\u304b\u3089\u306e\u6700\u77ed\u8ddd\u96e2]\n res = [INF] * N\n # \u30b9\u30bf\u30fc\u30c8\u4f4d\u7f6e\n que = [src]\n res[src] = 0\n # \u30ad\u30e5\u30fc\u304c\u7a7a\u306b\u306a\u308b\u307e\u3067\n while len(que) != 0:\n # \u8ddd\u96e2*N + \u73fe\u5728\u306e\u30ce\u30fc\u30c9\n cur = heappop(que)\n # \u8ddd\u96e2\u3068\u30ce\u30fc\u30c9\u306b\u5206\u3051\u308b\n dist = cur \/\/ N\n cur %= N\n # \u51fa\u767a\u30ce\u30fc\u30c9cur\u306e\u5230\u7740\u30ce\u30fc\u30c9\u3067\u30eb\u30fc\u30d7\n for nxt, cost in nodes[cur]:\n # \u4eca\u56de\u306e\u7d4c\u8def\u306e\u304c\u77ed\u3044\u6642\n if dist + cost < res[nxt]:\n res[nxt] = dist + cost\n # \u8ddd\u96e2*N+\u30ce\u30fc\u30c9\u756a\u53f7 \u306e\u5f62\u3067\u30ad\u30e5\u30fc\u306b\u8a70\u3081\u308b\n heappush(que, (dist + cost) * N + nxt)\n # \u30ce\u30fc\u30c9src\u304b\u3089\u306e\u6700\u77ed\u8ddd\u96e2\u30ea\u30b9\u30c8\u3092\u8fd4\u5374\n return res\n\n\nN = INT()\nnodes = [[] for i in range(N)]\nfor i in range(N - 1):\n a, b, c = MAP()\n a -= 1\n b -= 1\n nodes[a].append((b, c))\n nodes[b].append((a, c))\nQ, K = MAP()\nK -= 1\nres = dijkstra(N, nodes, K)\nfor i in range(Q):\n x, y = MAP()\n x -= 1\n y -= 1\n ans = res[x] + res[y]\n print(ans)\n","code_same":false,"relative_loc_diff_percent":48.3870967742,"diff":["-# \u518d\u5e30\u547c\u3073\u51fa\u3057\u306e\u56de\u6570\u5236\u9650(\u30c7\u30d5\u30a9\u30eb\u30c81000)","-sys.setrecursionlimit(10**9)","-N = int(eval(input()))","-nodes = [[] for _ in range(N + 1)]","-for i in range(N - 1):","- a, b, c = list(map(int, input().split()))","- # nodes[\u51fa\u767a\u30ce\u30fc\u30c9](\u5230\u7740\u30ce\u30fc\u30c9, \u30b3\u30b9\u30c8))","- nodes[a].append((b, c))","- # \u7121\u5411\u30b0\u30e9\u30d5\u306a\u306e\u3067\u3053\u3063\u3061\u3082\u5165\u308c\u308b","- nodes[b].append((a, c))","-memo = [0] * (N + 1)","+def list2d(a, b, c):","+ return [[c] * b for i in range(a)]","-def dfs(cur, prev, dist):","- memo[cur] = dist","- for nxt, cost in nodes[cur]:","- if nxt == prev:","- continue","- dfs(nxt, cur, dist + cost)","+def list3d(a, b, c, d):","+ return [[[d] * c for j in range(b)] for i in range(a)]","-Q, K = list(map(int, input().split()))","-dfs(K, -1, 0)","+def list4d(a, b, c, d, e):","+ return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]","+","+","+def ceil(x, y=1):","+ return int(-(-x \/\/ y))","+","+","+def INT():","+ return int(eval(input()))","+","+","+def MAP():","+ return list(map(int, input().split()))","+","+","+def LIST(N=None):","+ return list(MAP()) if N is None else [INT() for i in range(N)]","+","+","+def Yes():","+ print(\"Yes\")","+","+","+def No():","+ print(\"No\")","+","+","+def YES():","+ print(\"YES\")","+","+","+def NO():","+ print(\"NO\")","+","+","+sys.setrecursionlimit(10**9)","+INF = 10**18","+MOD = 10**9 + 7","+","+","+def dijkstra(N: int, nodes: list, src: int) -> list:","+ \"\"\"\u30c0\u30a4\u30af\u30b9\u30c8\u30e9\u9ad8\u901f\u5316\u7248(\u9802\u70b9\u6570, \u96a3\u63a5\u30ea\u30b9\u30c8(0-indexed), \u59cb\u70b9)\"\"\"","+ from heapq import heappush, heappop","+","+ # \u9802\u70b9[\u3042\u308b\u59cb\u70b9\u304b\u3089\u306e\u6700\u77ed\u8ddd\u96e2]","+ res = [INF] * N","+ # \u30b9\u30bf\u30fc\u30c8\u4f4d\u7f6e","+ que = [src]","+ res[src] = 0","+ # \u30ad\u30e5\u30fc\u304c\u7a7a\u306b\u306a\u308b\u307e\u3067","+ while len(que) != 0:","+ # \u8ddd\u96e2*N + \u73fe\u5728\u306e\u30ce\u30fc\u30c9","+ cur = heappop(que)","+ # \u8ddd\u96e2\u3068\u30ce\u30fc\u30c9\u306b\u5206\u3051\u308b","+ dist = cur \/\/ N","+ cur %= N","+ # \u51fa\u767a\u30ce\u30fc\u30c9cur\u306e\u5230\u7740\u30ce\u30fc\u30c9\u3067\u30eb\u30fc\u30d7","+ for nxt, cost in nodes[cur]:","+ # \u4eca\u56de\u306e\u7d4c\u8def\u306e\u304c\u77ed\u3044\u6642","+ if dist + cost < res[nxt]:","+ res[nxt] = dist + cost","+ # \u8ddd\u96e2*N+\u30ce\u30fc\u30c9\u756a\u53f7 \u306e\u5f62\u3067\u30ad\u30e5\u30fc\u306b\u8a70\u3081\u308b","+ heappush(que, (dist + cost) * N + nxt)","+ # \u30ce\u30fc\u30c9src\u304b\u3089\u306e\u6700\u77ed\u8ddd\u96e2\u30ea\u30b9\u30c8\u3092\u8fd4\u5374","+ return res","+","+","+N = INT()","+nodes = [[] for i in range(N)]","+for i in range(N - 1):","+ a, b, c = MAP()","+ a -= 1","+ b -= 1","+ nodes[a].append((b, c))","+ nodes[b].append((a, c))","+Q, K = MAP()","+K -= 1","+res = dijkstra(N, nodes, K)","- x, y = list(map(int, input().split()))","- # \u4eca\u56de\u306f\u5168\u3066K\u3092\u7d4c\u7531\u3059\u308b\u306e\u3067\u3001K\u304b\u3089\u306e\u8ddd\u96e2\u3055\u3048\u5206\u304b\u308c\u3070\u5168\u90e8\u51fa\u308b","- print((memo[x] + memo[y]))","+ x, y = MAP()","+ x -= 1","+ y -= 1","+ ans = res[x] + res[y]","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0410365794,"measured_runtime_v1":0.0379800377,"runtime_lift":1.0804775839,"key":["s252345603","s958136397"]} +{"user_id":"u438662618","problem_id":"p03435","language":"python","submission_id_v0":"s801500884","submission_id_v1":"s992591340","cpu_time_v0":449,"cpu_time_v1":21,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.32,"input":"c = [list(map(int, input().split())) for i in range(3) ]\n\n\n\nans = False\n\n\n\nfor i in range(101) :\n\n for j in range(101) :\n\n for k in range(101) :\n\n b1 = c[0][0] - i\n\n b2 = c[1][0] - i\n\n b3 = c[2][0] - i\n\n if j + b1 != c[0][1] :\n\n continue\n\n elif j + b2 != c[1][1] :\n\n continue\n\n elif j + b3 != c[2][1] :\n\n continue\n\n elif k + b1 != c[0][2] :\n\n continue\n\n elif k + b2 != c[1][2] :\n\n continue\n\n elif k + b3 != c[2][2] :\n\n continue\n\n ans = True\n\n\n\nif ans :\n\n print('Yes')\n\nelse :\n\n print('No')\n","target":"c = [list(map(int, input().split())) for i in range(3) ]\n\n\n\nans = False\n\n\n\nfor i in range(101) :\n\n a1 = 0\n\n b1 = c[0][0]\n\n b2 = c[0][1]\n\n b3 = c[0][2]\n\n a2 = c[1][0] - b1\n\n a3 = c[2][0] - b1\n\n a = []\n\n a.append(a1)\n\n a.append(a2)\n\n a.append(a3)\n\n if a2 + b2 != c[1][1] :\n\n continue\n\n elif a3 + b2 != c[2][1] :\n\n continue\n\n elif a2 + b3 != c[1][2] :\n\n continue\n\n elif a3 + b3 != c[2][2] :\n\n continue\n\n ans = True\n\n break\n\n\n\nif ans :\n\n print('Yes')\n\nelse :\n\n print('No')\n","code_v0_loc":28,"code_v1_loc":30,"code_v0_num_chars":706,"code_v1_num_chars":551,"code_v0_no_empty_lines":"c = [list(map(int, input().split())) for i in range(3)]\nans = False\nfor i in range(101):\n for j in range(101):\n for k in range(101):\n b1 = c[0][0] - i\n b2 = c[1][0] - i\n b3 = c[2][0] - i\n if j + b1 != c[0][1]:\n continue\n elif j + b2 != c[1][1]:\n continue\n elif j + b3 != c[2][1]:\n continue\n elif k + b1 != c[0][2]:\n continue\n elif k + b2 != c[1][2]:\n continue\n elif k + b3 != c[2][2]:\n continue\n ans = True\nif ans:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"c = [list(map(int, input().split())) for i in range(3)]\nans = False\nfor i in range(101):\n a1 = 0\n b1 = c[0][0]\n b2 = c[0][1]\n b3 = c[0][2]\n a2 = c[1][0] - b1\n a3 = c[2][0] - b1\n a = []\n a.append(a1)\n a.append(a2)\n a.append(a3)\n if a2 + b2 != c[1][1]:\n continue\n elif a3 + b2 != c[2][1]:\n continue\n elif a2 + b3 != c[1][2]:\n continue\n elif a3 + b3 != c[2][2]:\n continue\n ans = True\n break\nif ans:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["- for j in range(101):","- for k in range(101):","- b1 = c[0][0] - i","- b2 = c[1][0] - i","- b3 = c[2][0] - i","- if j + b1 != c[0][1]:","- continue","- elif j + b2 != c[1][1]:","- continue","- elif j + b3 != c[2][1]:","- continue","- elif k + b1 != c[0][2]:","- continue","- elif k + b2 != c[1][2]:","- continue","- elif k + b3 != c[2][2]:","- continue","- ans = True","+ a1 = 0","+ b1 = c[0][0]","+ b2 = c[0][1]","+ b3 = c[0][2]","+ a2 = c[1][0] - b1","+ a3 = c[2][0] - b1","+ a = []","+ a.append(a1)","+ a.append(a2)","+ a.append(a3)","+ if a2 + b2 != c[1][1]:","+ continue","+ elif a3 + b2 != c[2][1]:","+ continue","+ elif a2 + b3 != c[1][2]:","+ continue","+ elif a3 + b3 != c[2][2]:","+ continue","+ ans = True","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":3.0740164757,"measured_runtime_v1":0.0377429328,"runtime_lift":81.4461475858,"key":["s801500884","s992591340"]} +{"user_id":"u469254913","problem_id":"p03854","language":"python","submission_id_v0":"s645842570","submission_id_v1":"s351721030","cpu_time_v0":266,"cpu_time_v1":106,"memory_v0":3428,"memory_v1":3448,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.15,"input":"S = eval(input())\n\n\n\nwords = ['dream','dreamer','erase','eraser']\n\n\n\ndamm = True\n\n\n\nT = ''\n\n\n\nwhile damm:\n\n damm = False\n\n for test in words:\n\n if S.endswith(test+T):\n\n T = test + T\n\n damm = True\n\n break\n\n if S == T:\n\n damm = True\n\n break\n\n\n\nif damm:\n\n print('YES')\n\nelse:\n\n print('NO')\n","target":"# import numpy as np\n\n# import math\n\n# import copy\n\n# from collections import deque\n\nimport sys\n\ninput = sys.stdin.readline\n\n# sys.setrecursionlimit(10000)\n\n\n\n\n\ndef main():\n\n S = input().rstrip()\n\n\n\n words = ['dream','dreamer','erase','eraser']\n\n\n\n res = 'YES'\n\n\n\n pre = S\n\n now = S\n\n\n\n while True:\n\n for i in range(4):\n\n word = words[i]\n\n N = len(word)\n\n M = len(now)\n\n if N <= M:\n\n r = now[M-N:]\n\n if r == word:\n\n now = now[:M-N]\n\n if now == '':\n\n break\n\n elif now == pre:\n\n res = 'NO'\n\n break\n\n else:\n\n pre = now\n\n\n\n print(res)\n\n\n\n\n\n\n\nmain()\n","code_v0_loc":23,"code_v1_loc":41,"code_v0_num_chars":350,"code_v1_num_chars":731,"code_v0_no_empty_lines":"S = eval(input())\nwords = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\ndamm = True\nT = \"\"\nwhile damm:\n damm = False\n for test in words:\n if S.endswith(test + T):\n T = test + T\n damm = True\n break\n if S == T:\n damm = True\n break\nif damm:\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_v1_no_empty_lines":"# import numpy as np\n# import math\n# import copy\n# from collections import deque\nimport sys\n\ninput = sys.stdin.readline\n# sys.setrecursionlimit(10000)\ndef main():\n S = input().rstrip()\n words = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\n res = \"YES\"\n pre = S\n now = S\n while True:\n for i in range(4):\n word = words[i]\n N = len(word)\n M = len(now)\n if N <= M:\n r = now[M - N :]\n if r == word:\n now = now[: M - N]\n if now == \"\":\n break\n elif now == pre:\n res = \"NO\"\n break\n else:\n pre = now\n print(res)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":43.9024390244,"diff":["-S = eval(input())","-words = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]","-damm = True","-T = \"\"","-while damm:","- damm = False","- for test in words:","- if S.endswith(test + T):","- T = test + T","- damm = True","+# import numpy as np","+# import math","+# import copy","+# from collections import deque","+import sys","+","+input = sys.stdin.readline","+# sys.setrecursionlimit(10000)","+def main():","+ S = input().rstrip()","+ words = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]","+ res = \"YES\"","+ pre = S","+ now = S","+ while True:","+ for i in range(4):","+ word = words[i]","+ N = len(word)","+ M = len(now)","+ if N <= M:","+ r = now[M - N :]","+ if r == word:","+ now = now[: M - N]","+ if now == \"\":","- if S == T:","- damm = True","- break","-if damm:","- print(\"YES\")","-else:","- print(\"NO\")","+ elif now == pre:","+ res = \"NO\"","+ break","+ else:","+ pre = now","+ print(res)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0381059961,"measured_runtime_v1":0.0347753334,"runtime_lift":1.0957765862,"key":["s645842570","s351721030"]} +{"user_id":"u150984829","problem_id":"p02258","language":"python","submission_id_v0":"s941650986","submission_id_v1":"s180411285","cpu_time_v0":630,"cpu_time_v1":210,"memory_v0":5636,"memory_v1":19840,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.67,"input":"b,s=-1e10,1e10\n\nfor _ in range(int(eval(input()))):\n\n r=int(eval(input()))\n\n b,s=max(b,r-s),min(s,r)\n\nprint(b)\n","target":"import sys\n\nb,s=-1e10,1e10\n\neval(input())\n\nfor r in map(int, sys.stdin.readlines()):\n\n b,s=max(b,r-s),min(s,r)\n\nprint(b)\n","code_v0_loc":5,"code_v1_loc":6,"code_v0_num_chars":99,"code_v1_num_chars":115,"code_v0_no_empty_lines":"b, s = -1e10, 1e10\nfor _ in range(int(eval(input()))):\n r = int(eval(input()))\n b, s = max(b, r - s), min(s, r)\nprint(b)\n","code_v1_no_empty_lines":"import sys\n\nb, s = -1e10, 1e10\neval(input())\nfor r in map(int, sys.stdin.readlines()):\n b, s = max(b, r - s), min(s, r)\nprint(b)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["+import sys","+","-for _ in range(int(eval(input()))):","- r = int(eval(input()))","+eval(input())","+for r in map(int, sys.stdin.readlines()):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363980343,"measured_runtime_v1":0.0368848302,"runtime_lift":0.9868022732,"key":["s941650986","s180411285"]} +{"user_id":"u078042885","problem_id":"p01809","language":"python","submission_id_v0":"s793402755","submission_id_v1":"s014163647","cpu_time_v0":80,"cpu_time_v1":30,"memory_v0":10252,"memory_v1":7640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.5,"input":"import fractions\n\na,b=list(map(int,input().split()))\n\nb\/\/=fractions.gcd(a,b)\n\na,c=2,1\n\nwhile a**2<=b:\n\n if b%a==0:\n\n c*=a\n\n while b%a==0: b\/\/=a\n\n a+=1\n\nprint((c*b))","target":"def gcd(a, b):\n\n while b: a, b = b, a % b\n\n return a\n\n\n\na,b=list(map(int,input().split()))\n\nb\/\/=gcd(a,b)\n\na,c=2,1\n\nwhile a*a<=b:\n\n if b%a==0:\n\n c*=a\n\n while b%a==0:b\/\/=a\n\n a+=1\n\nprint(([c*b,c][b==1]))","code_v0_loc":10,"code_v1_loc":13,"code_v0_num_chars":176,"code_v1_num_chars":218,"code_v0_no_empty_lines":"import fractions\n\na, b = list(map(int, input().split()))\nb \/\/= fractions.gcd(a, b)\na, c = 2, 1\nwhile a**2 <= b:\n if b % a == 0:\n c *= a\n while b % a == 0:\n b \/\/= a\n a += 1\nprint((c * b))\n","code_v1_no_empty_lines":"def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\na, b = list(map(int, input().split()))\nb \/\/= gcd(a, b)\na, c = 2, 1\nwhile a * a <= b:\n if b % a == 0:\n c *= a\n while b % a == 0:\n b \/\/= a\n a += 1\nprint(([c * b, c][b == 1]))\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-import fractions","+def gcd(a, b):","+ while b:","+ a, b = b, a % b","+ return a","+","-b \/\/= fractions.gcd(a, b)","+b \/\/= gcd(a, b)","-while a**2 <= b:","+while a * a <= b:","-print((c * b))","+print(([c * b, c][b == 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.108417681,"measured_runtime_v1":0.0362893107,"runtime_lift":2.987592734,"key":["s793402755","s014163647"]} +{"user_id":"u671060652","problem_id":"p03221","language":"python","submission_id_v0":"s863985285","submission_id_v1":"s672495524","cpu_time_v0":1189,"cpu_time_v1":596,"memory_v0":108244,"memory_v1":106776,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.87,"input":"import itertools\n\nimport math\n\nimport fractions\n\nimport functools\n\nimport copy\n\nn, m = list(map(int, input().split()))\n\npyi = []\n\nfor i in range(m):\n\n p,y= list(map(int, input().split()))\n\n pyi.append([p,y,i])\n\n\n\npyi.sort(key=lambda x: x[1])\n\npyi.sort(key=lambda x: x[0])\n\n\n\nken = 0\n\nfor i in range(m):\n\n if pyi[i][0] != ken:\n\n ken = pyi[i][0]\n\n x = 1\n\n else:\n\n x += 1\n\n pyi[i].append(x)\n\n\n\n\n\npyi.sort(key=lambda x: x[2])\n\nfor i in range(m):\n\n print((str(pyi[i][0]).zfill(6)+str(pyi[i][3]).zfill(6)))","target":"def main():\n\n # n = int(input())\n\n n, m = list(map(int, input().split()))\n\n # v = list(map(int, input().split()))\n\n # s = input()\n\n py = []\n\n for i in range(m):\n\n p, y = list(map(int, input().split()))\n\n py.append([i, p, y])\n\n\n\n py.sort(key=lambda x: (x[1], x[2]))\n\n\n\n num = 1\n\n for i in range(0, m):\n\n if i == 0:\n\n py[i].append(num)\n\n else:\n\n if py[i][1] == py[i-1][1]:\n\n num += 1\n\n else:\n\n num = 1\n\n py[i].append(num)\n\n\n\n py.sort(key=lambda x: x[0])\n\n\n\n for i in range(m):\n\n print((str(py[i][1]).zfill(6) + str(py[i][3]).zfill(6)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":27,"code_v1_loc":31,"code_v0_num_chars":525,"code_v1_num_chars":706,"code_v0_no_empty_lines":"import itertools\nimport math\nimport fractions\nimport functools\nimport copy\n\nn, m = list(map(int, input().split()))\npyi = []\nfor i in range(m):\n p, y = list(map(int, input().split()))\n pyi.append([p, y, i])\npyi.sort(key=lambda x: x[1])\npyi.sort(key=lambda x: x[0])\nken = 0\nfor i in range(m):\n if pyi[i][0] != ken:\n ken = pyi[i][0]\n x = 1\n else:\n x += 1\n pyi[i].append(x)\npyi.sort(key=lambda x: x[2])\nfor i in range(m):\n print((str(pyi[i][0]).zfill(6) + str(pyi[i][3]).zfill(6)))\n","code_v1_no_empty_lines":"def main():\n # n = int(input())\n n, m = list(map(int, input().split()))\n # v = list(map(int, input().split()))\n # s = input()\n py = []\n for i in range(m):\n p, y = list(map(int, input().split()))\n py.append([i, p, y])\n py.sort(key=lambda x: (x[1], x[2]))\n num = 1\n for i in range(0, m):\n if i == 0:\n py[i].append(num)\n else:\n if py[i][1] == py[i - 1][1]:\n num += 1\n else:\n num = 1\n py[i].append(num)\n py.sort(key=lambda x: x[0])\n for i in range(m):\n print((str(py[i][1]).zfill(6) + str(py[i][3]).zfill(6)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":12.9032258065,"diff":["-import itertools","-import math","-import fractions","-import functools","-import copy","+def main():","+ # n = int(input())","+ n, m = list(map(int, input().split()))","+ # v = list(map(int, input().split()))","+ # s = input()","+ py = []","+ for i in range(m):","+ p, y = list(map(int, input().split()))","+ py.append([i, p, y])","+ py.sort(key=lambda x: (x[1], x[2]))","+ num = 1","+ for i in range(0, m):","+ if i == 0:","+ py[i].append(num)","+ else:","+ if py[i][1] == py[i - 1][1]:","+ num += 1","+ else:","+ num = 1","+ py[i].append(num)","+ py.sort(key=lambda x: x[0])","+ for i in range(m):","+ print((str(py[i][1]).zfill(6) + str(py[i][3]).zfill(6)))","-n, m = list(map(int, input().split()))","-pyi = []","-for i in range(m):","- p, y = list(map(int, input().split()))","- pyi.append([p, y, i])","-pyi.sort(key=lambda x: x[1])","-pyi.sort(key=lambda x: x[0])","-ken = 0","-for i in range(m):","- if pyi[i][0] != ken:","- ken = pyi[i][0]","- x = 1","- else:","- x += 1","- pyi[i].append(x)","-pyi.sort(key=lambda x: x[2])","-for i in range(m):","- print((str(pyi[i][0]).zfill(6) + str(pyi[i][3]).zfill(6)))","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0361358117,"measured_runtime_v1":0.0376430409,"runtime_lift":0.9599599516,"key":["s863985285","s672495524"]} +{"user_id":"u535803878","problem_id":"p03855","language":"python","submission_id_v0":"s222669114","submission_id_v1":"s187826323","cpu_time_v0":635,"cpu_time_v1":473,"memory_v0":254804,"memory_v1":190540,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.51,"input":"import sys\n\ninput = lambda : sys.stdin.readline().rstrip()\n\nsys.setrecursionlimit(max(1000, 10**9))\n\nwrite = lambda x: sys.stdout.write(x+\"\\n\")\n\n\n\n\n\nn,k,l = list(map(int, input().split()))\n\nfrom collections import defaultdict\n\nns0 = defaultdict(list)\n\nns1 = defaultdict(list)\n\nfor i in range(k):\n\n p,q = list(map(int, input().split()))\n\n p-=1;q-=1\n\n ns0[p].append(q)\n\n ns0[q].append(p)\n\nfor i in range(l):\n\n p,q = list(map(int, input().split()))\n\n p-=1;q-=1\n\n ns1[p].append(q)\n\n ns1[q].append(p)\n\ndef sub(ns):\n\n seen = [None]*n\n\n num = 1\n\n for i in range(n):\n\n if seen[i] is not None:\n\n continue\n\n q = [i]\n\n seen[i] = num\n\n while q:\n\n u = q.pop()\n\n for v in ns[u]:\n\n if seen[v] is not None:\n\n continue\n\n seen[v] = num\n\n q.append(v)\n\n num += 1\n\n return seen\n\n\n\ns1 = sub(ns0)\n\ns2 = sub(ns1)\n\n\n\nimport gc\n\ndel ns0, ns1\n\ngc.collect()\n\n\n\nd1 = [None]*(max(s1)+1)\n\nd2 = [None]*(max(s2)+1)\n\ndef update(d,ind,i):\n\n if d[ind] is None:\n\n d[ind] = set([i])\n\n else:\n\n d[ind].add(i)\n\nfor i in range(n):\n\n update(d1,s1[i],i)\n\n update(d2,s2[i],i)\n\n# d1[s1[i]].add(i)\n\n# d2[s2[i]].add(i)\n\nd = {}\n\nans = [None]*n\n\nfor i in range(n):\n\n u,v = s1.pop(), s2.pop()\n\n if (u,v) not in d:\n\n d[u,v] = len(d1[u] & d2[v])\n\n ans[-(i+1)] = d[u,v]\n\nwrite(\" \".join(map(str, ans)))","target":"import sys\n\ninput = lambda : sys.stdin.readline().rstrip()\n\nsys.setrecursionlimit(max(1000, 10**9))\n\nwrite = lambda x: sys.stdout.write(x+\"\\n\")\n\n\n\n\n\nn,k,l = list(map(int, input().split()))\n\nfrom collections import defaultdict\n\nns0 = defaultdict(list)\n\nns1 = defaultdict(list)\n\nfor i in range(k):\n\n p,q = list(map(int, input().split()))\n\n p-=1;q-=1\n\n ns0[p].append(q)\n\n ns0[q].append(p)\n\nfor i in range(l):\n\n p,q = list(map(int, input().split()))\n\n p-=1;q-=1\n\n ns1[p].append(q)\n\n ns1[q].append(p)\n\ndef sub(ns):\n\n seen = [None]*n\n\n num = 1\n\n for i in range(n):\n\n if seen[i] is not None:\n\n continue\n\n q = [i]\n\n seen[i] = num\n\n while q:\n\n u = q.pop()\n\n for v in ns[u]:\n\n if seen[v] is not None:\n\n continue\n\n seen[v] = num\n\n q.append(v)\n\n num += 1\n\n return seen\n\n\n\ns1 = sub(ns0)\n\ns2 = sub(ns1)\n\n\n\nimport gc\n\ndel ns0, ns1\n\ngc.collect()\n\n\n\nfrom collections import Counter\n\nc = Counter([(s1[i], s2[i]) for i in range(n)])\n\nans = [(c[s1[i],s2[i]]) for i in range(n)]\n\nwrite(\" \".join(map(str, ans)))","code_v0_loc":65,"code_v1_loc":49,"code_v0_num_chars":1453,"code_v1_num_chars":1145,"code_v0_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\nsys.setrecursionlimit(max(1000, 10**9))\nwrite = lambda x: sys.stdout.write(x + \"\\n\")\nn, k, l = list(map(int, input().split()))\nfrom collections import defaultdict\n\nns0 = defaultdict(list)\nns1 = defaultdict(list)\nfor i in range(k):\n p, q = list(map(int, input().split()))\n p -= 1\n q -= 1\n ns0[p].append(q)\n ns0[q].append(p)\nfor i in range(l):\n p, q = list(map(int, input().split()))\n p -= 1\n q -= 1\n ns1[p].append(q)\n ns1[q].append(p)\n\n\ndef sub(ns):\n seen = [None] * n\n num = 1\n for i in range(n):\n if seen[i] is not None:\n continue\n q = [i]\n seen[i] = num\n while q:\n u = q.pop()\n for v in ns[u]:\n if seen[v] is not None:\n continue\n seen[v] = num\n q.append(v)\n num += 1\n return seen\n\n\ns1 = sub(ns0)\ns2 = sub(ns1)\nimport gc\n\ndel ns0, ns1\ngc.collect()\nd1 = [None] * (max(s1) + 1)\nd2 = [None] * (max(s2) + 1)\n\n\ndef update(d, ind, i):\n if d[ind] is None:\n d[ind] = set([i])\n else:\n d[ind].add(i)\n\n\nfor i in range(n):\n update(d1, s1[i], i)\n update(d2, s2[i], i)\n# d1[s1[i]].add(i)\n# d2[s2[i]].add(i)\nd = {}\nans = [None] * n\nfor i in range(n):\n u, v = s1.pop(), s2.pop()\n if (u, v) not in d:\n d[u, v] = len(d1[u] & d2[v])\n ans[-(i + 1)] = d[u, v]\nwrite(\" \".join(map(str, ans)))\n","code_v1_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\nsys.setrecursionlimit(max(1000, 10**9))\nwrite = lambda x: sys.stdout.write(x + \"\\n\")\nn, k, l = list(map(int, input().split()))\nfrom collections import defaultdict\n\nns0 = defaultdict(list)\nns1 = defaultdict(list)\nfor i in range(k):\n p, q = list(map(int, input().split()))\n p -= 1\n q -= 1\n ns0[p].append(q)\n ns0[q].append(p)\nfor i in range(l):\n p, q = list(map(int, input().split()))\n p -= 1\n q -= 1\n ns1[p].append(q)\n ns1[q].append(p)\n\n\ndef sub(ns):\n seen = [None] * n\n num = 1\n for i in range(n):\n if seen[i] is not None:\n continue\n q = [i]\n seen[i] = num\n while q:\n u = q.pop()\n for v in ns[u]:\n if seen[v] is not None:\n continue\n seen[v] = num\n q.append(v)\n num += 1\n return seen\n\n\ns1 = sub(ns0)\ns2 = sub(ns1)\nimport gc\n\ndel ns0, ns1\ngc.collect()\nfrom collections import Counter\n\nc = Counter([(s1[i], s2[i]) for i in range(n)])\nans = [(c[s1[i], s2[i]]) for i in range(n)]\nwrite(\" \".join(map(str, ans)))\n","code_same":false,"relative_loc_diff_percent":24.6153846154,"diff":["-d1 = [None] * (max(s1) + 1)","-d2 = [None] * (max(s2) + 1)","+from collections import Counter","-","-def update(d, ind, i):","- if d[ind] is None:","- d[ind] = set([i])","- else:","- d[ind].add(i)","-","-","-for i in range(n):","- update(d1, s1[i], i)","- update(d2, s2[i], i)","-# d1[s1[i]].add(i)","-# d2[s2[i]].add(i)","-d = {}","-ans = [None] * n","-for i in range(n):","- u, v = s1.pop(), s2.pop()","- if (u, v) not in d:","- d[u, v] = len(d1[u] & d2[v])","- ans[-(i + 1)] = d[u, v]","+c = Counter([(s1[i], s2[i]) for i in range(n)])","+ans = [(c[s1[i], s2[i]]) for i in range(n)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0458105087,"measured_runtime_v1":0.0452374935,"runtime_lift":1.0126668203,"key":["s222669114","s187826323"]} +{"user_id":"u367130284","problem_id":"p03634","language":"python","submission_id_v0":"s412087687","submission_id_v1":"s010457954","cpu_time_v0":823,"cpu_time_v1":674,"memory_v0":92576,"memory_v1":87200,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.1,"input":"\n\nfrom heapq import*\n\nimport sys\n\ninput=sys.stdin.readline\n\n \n\ndef DIJKSTRA(point,d):\n\n cost = [1e18]*(n+1)\n\n Q = [] #\u9802\u70b9\u306e\u30ea\u30b9\u30c8\n\n cost[point]=0 #\u958b\u59cb\u5730\u70b9\u306e\u30b3\u30b9\u30c8\u3092\u30bc\u30ed\u3068\u3059\u308b\uff08\u5f53\u305f\u308a\u524d\n\n heappush(Q,(point,cost[point]))\n\n while Q:\n\n prefnd,tmpC=heappop(Q)\n\n if cost[prefnd]altC:\n\n cost[node]=altC\n\n heappush(Q,(node,altC))\n\n return cost\n\n\n\nn=int(eval(input()))\n\nd=[[]for i in range(n+1)]\n\nfor i in range(n-1):\n\n a,b,c=list(map(int,input().split()))\n\n d[a].append([b,c])\n\n d[b].append([a,c])\n\n\n\nq,k=list(map(int,input().split()))\n\ny=DIJKSTRA(k,d)\n\n \n\nfor i in range(q):\n\n a,b=list(map(int,input().split()))\n\n print((y[a]+y[b]))\n","target":"from collections import*\n\nfrom heapq import*\n\nimport sys\n\ninput=sys.stdin.readline\n\n \n\ndef BFS(point,d):\n\n cost=[1e18]*(n+1)\n\n cost[point]=0\n\n Q=deque()\n\n Q.appendleft((0,point))\n\n \n\n while Q:\n\n c,p=Q.pop()\n\n for np,co in d[p]:\n\n if cost[np]==1e18:\n\n cost[np]=c+co\n\n Q.appendleft((c+co,np))\n\n return cost\n\n\n\nn=int(eval(input()))\n\nd=[[]for i in range(n+1)]\n\nfor i in range(n-1):\n\n a,b,c=list(map(int,input().split()))\n\n d[a].append([b,c])\n\n d[b].append([a,c])\n\n#print(d)\n\nq,k=list(map(int,input().split()))\n\ny=BFS(k,d)\n\n \n\nfor i in range(q):\n\n a,b=list(map(int,input().split()))\n\n print((y[a]+y[b]))\n","code_v0_loc":34,"code_v1_loc":32,"code_v0_num_chars":784,"code_v1_num_chars":664,"code_v0_no_empty_lines":"from heapq import *\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef DIJKSTRA(point, d):\n cost = [1e18] * (n + 1)\n Q = [] # \u9802\u70b9\u306e\u30ea\u30b9\u30c8\n cost[point] = 0 # \u958b\u59cb\u5730\u70b9\u306e\u30b3\u30b9\u30c8\u3092\u30bc\u30ed\u3068\u3059\u308b\uff08\u5f53\u305f\u308a\u524d\n heappush(Q, (point, cost[point]))\n while Q:\n prefnd, tmpC = heappop(Q)\n if cost[prefnd] < tmpC:\n continue\n for node, c in d[prefnd]:\n altC = c + tmpC\n if cost[node] > altC:\n cost[node] = altC\n heappush(Q, (node, altC))\n return cost\n\n\nn = int(eval(input()))\nd = [[] for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n d[a].append([b, c])\n d[b].append([a, c])\nq, k = list(map(int, input().split()))\ny = DIJKSTRA(k, d)\nfor i in range(q):\n a, b = list(map(int, input().split()))\n print((y[a] + y[b]))\n","code_v1_no_empty_lines":"from collections import *\nfrom heapq import *\nimport sys\n\ninput = sys.stdin.readline\n\n\ndef BFS(point, d):\n cost = [1e18] * (n + 1)\n cost[point] = 0\n Q = deque()\n Q.appendleft((0, point))\n while Q:\n c, p = Q.pop()\n for np, co in d[p]:\n if cost[np] == 1e18:\n cost[np] = c + co\n Q.appendleft((c + co, np))\n return cost\n\n\nn = int(eval(input()))\nd = [[] for i in range(n + 1)]\nfor i in range(n - 1):\n a, b, c = list(map(int, input().split()))\n d[a].append([b, c])\n d[b].append([a, c])\n# print(d)\nq, k = list(map(int, input().split()))\ny = BFS(k, d)\nfor i in range(q):\n a, b = list(map(int, input().split()))\n print((y[a] + y[b]))\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["+from collections import *","-def DIJKSTRA(point, d):","+def BFS(point, d):","- Q = [] # \u9802\u70b9\u306e\u30ea\u30b9\u30c8","- cost[point] = 0 # \u958b\u59cb\u5730\u70b9\u306e\u30b3\u30b9\u30c8\u3092\u30bc\u30ed\u3068\u3059\u308b\uff08\u5f53\u305f\u308a\u524d","- heappush(Q, (point, cost[point]))","+ cost[point] = 0","+ Q = deque()","+ Q.appendleft((0, point))","- prefnd, tmpC = heappop(Q)","- if cost[prefnd] < tmpC:","- continue","- for node, c in d[prefnd]:","- altC = c + tmpC","- if cost[node] > altC:","- cost[node] = altC","- heappush(Q, (node, altC))","+ c, p = Q.pop()","+ for np, co in d[p]:","+ if cost[np] == 1e18:","+ cost[np] = c + co","+ Q.appendleft((c + co, np))","+# print(d)","-y = DIJKSTRA(k, d)","+y = BFS(k, d)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0375001831,"measured_runtime_v1":0.036507802,"runtime_lift":1.0271827125,"key":["s412087687","s010457954"]} +{"user_id":"u285891772","problem_id":"p03347","language":"python","submission_id_v0":"s165648283","submission_id_v1":"s697932220","cpu_time_v0":198,"cpu_time_v1":174,"memory_v0":18196,"memory_v1":18364,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.12,"input":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nN = INT()\n\nA = [INT() for _ in range(N)]\n\n\n\ntmp = 0\n\ncnt = 0\n\nfor i in range(N-1, -1, -1):\n\n\ttmp -= 1\n\n\tif i < A[i]:\n\n\t\tprint((-1))\n\n\t\texit()\n\n\telif A[i] < tmp:\n\n\t\tprint((-1))\n\n\t\texit()\n\n\telif tmp < A[i]:\n\n\t\tcnt += A[i]\n\n\t\ttmp = A[i]\n\n\n\nprint(cnt)\n","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef TUPLE(): return tuple(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7 \n\n#mod = 998244353\n\nfrom decimal import *\n\n#import numpy as np\n\n#decimal.getcontext().prec = 10\n\n\n\nN = INT()\n\nA = [INT() for _ in range(N)]\n\n\n\nans = 0\n\ntmp = A[0]\n\nfor i, a in enumerate(A):\n\n\tif i < a or tmp+1 < a:\n\n\t\tprint((-1))\n\n\t\tbreak\n\n\tif a != tmp+1:\n\n\t\tans += tmp\n\n\ttmp = a\n\n\n\nelse:\n\n\tans += tmp\n\n\tprint(ans)\n","code_v0_loc":42,"code_v1_loc":40,"code_v0_num_chars":1245,"code_v1_num_chars":1215,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nN = INT()\nA = [INT() for _ in range(N)]\ntmp = 0\ncnt = 0\nfor i in range(N - 1, -1, -1):\n tmp -= 1\n if i < A[i]:\n print((-1))\n exit()\n elif A[i] < tmp:\n print((-1))\n exit()\n elif tmp < A[i]:\n cnt += A[i]\n tmp = A[i]\nprint(cnt)\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n gcd,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef TUPLE():\n return tuple(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# mod = 998244353\nfrom decimal import *\n\n# import numpy as np\n# decimal.getcontext().prec = 10\nN = INT()\nA = [INT() for _ in range(N)]\nans = 0\ntmp = A[0]\nfor i, a in enumerate(A):\n if i < a or tmp + 1 < a:\n print((-1))\n break\n if a != tmp + 1:\n ans += tmp\n tmp = a\nelse:\n ans += tmp\n print(ans)\n","code_same":false,"relative_loc_diff_percent":4.7619047619,"diff":["-tmp = 0","-cnt = 0","-for i in range(N - 1, -1, -1):","- tmp -= 1","- if i < A[i]:","+ans = 0","+tmp = A[0]","+for i, a in enumerate(A):","+ if i < a or tmp + 1 < a:","- exit()","- elif A[i] < tmp:","- print((-1))","- exit()","- elif tmp < A[i]:","- cnt += A[i]","- tmp = A[i]","-print(cnt)","+ break","+ if a != tmp + 1:","+ ans += tmp","+ tmp = a","+else:","+ ans += tmp","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0487100985,"measured_runtime_v1":0.0484537199,"runtime_lift":1.0052912066,"key":["s165648283","s697932220"]} +{"user_id":"u888337853","problem_id":"p03105","language":"python","submission_id_v0":"s914173940","submission_id_v1":"s146478847","cpu_time_v0":167,"cpu_time_v1":19,"memory_v0":38384,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.62,"input":"import math\n\n\n\n# inputList=[]\n\n# for i in range(6):\n\n# inputNum = input()\n\n# inputList.append(inputNum)\n\ninputa = input().split()\n\n# inputb = input().split()\n\n\n\na = int(inputa[0])\n\nb = int(inputa[1])\n\nc = int(inputa[2])\n\n\n\n# x = int(inputb[0])\n\n# y = int(inputb[1])\n\n\n\nans = int(math.floor(float(b)\/float(a)))\n\n\n\nif ans > c:\n\n ans = c\n\n\n\nprint(ans)","target":"import sys\n\nimport re\n\nimport math\n\n\n\n# import bisect\n\n\n\n# import copy\n\n# import heapq\n\n# from collections import deque\n\n# import decimal\n\n\n\n# sys.setrecursionlimit(100001)\n\nINF = sys.maxsize\n\n# MOD = 10 ** 9 + 7\n\n\n\nni = lambda: int(sys.stdin.readline())\n\nns = lambda: list(map(int, sys.stdin.readline().split()))\n\nna = lambda: list(map(int, sys.stdin.readline().split()))\n\n\n\n\n\n# ===CODE===\n\n\n\n\n\ndef main():\n\n a,b,c=ns()\n\n print((min(c, b\/\/a)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":22,"code_v1_loc":30,"code_v0_num_chars":359,"code_v1_num_chars":487,"code_v0_no_empty_lines":"import math\n\n# inputList=[]\n# for i in range(6):\n# inputNum = input()\n# inputList.append(inputNum)\ninputa = input().split()\n# inputb = input().split()\na = int(inputa[0])\nb = int(inputa[1])\nc = int(inputa[2])\n# x = int(inputb[0])\n# y = int(inputb[1])\nans = int(math.floor(float(b) \/ float(a)))\nif ans > c:\n ans = c\nprint(ans)\n","code_v1_no_empty_lines":"import sys\nimport re\nimport math\n\n# import bisect\n# import copy\n# import heapq\n# from collections import deque\n# import decimal\n# sys.setrecursionlimit(100001)\nINF = sys.maxsize\n# MOD = 10 ** 9 + 7\nni = lambda: int(sys.stdin.readline())\nns = lambda: list(map(int, sys.stdin.readline().split()))\nna = lambda: list(map(int, sys.stdin.readline().split()))\n# ===CODE===\ndef main():\n a, b, c = ns()\n print((min(c, b \/\/ a)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["+import sys","+import re","-# inputList=[]","-# for i in range(6):","-# inputNum = input()","-# inputList.append(inputNum)","-inputa = input().split()","-# inputb = input().split()","-a = int(inputa[0])","-b = int(inputa[1])","-c = int(inputa[2])","-# x = int(inputb[0])","-# y = int(inputb[1])","-ans = int(math.floor(float(b) \/ float(a)))","-if ans > c:","- ans = c","-print(ans)","+# import bisect","+# import copy","+# import heapq","+# from collections import deque","+# import decimal","+# sys.setrecursionlimit(100001)","+INF = sys.maxsize","+# MOD = 10 ** 9 + 7","+ni = lambda: int(sys.stdin.readline())","+ns = lambda: list(map(int, sys.stdin.readline().split()))","+na = lambda: list(map(int, sys.stdin.readline().split()))","+# ===CODE===","+def main():","+ a, b, c = ns()","+ print((min(c, b \/\/ a)))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0378691025,"measured_runtime_v1":0.1610643148,"runtime_lift":0.2351178938,"key":["s914173940","s146478847"]} +{"user_id":"u979667682","problem_id":"p02678","language":"python","submission_id_v0":"s280558332","submission_id_v1":"s467062227","cpu_time_v0":452,"cpu_time_v1":370,"memory_v0":111520,"memory_v1":111600,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.14,"input":"from sys import stdin\n\nimport math\n\nimport fractions\n\nfrom collections import deque\n\nfrom collections import Counter\n\nimport itertools\n\n\n\nINF = 10 ** 10\n\n\n\n\n\n# N\u500b\u306e\u90e8\u5c4b\u3068M\u672c\u306e\u901a\u8def\n\nN, M = [int(x) for x in stdin.readline().rstrip().split()]\n\n\n\nroute = [[] for _ in range(N+1)]\n\n\n\nfor _ in range(M):\n\n A, B = [int(x) for x in stdin.readline().rstrip().split()]\n\n route[A].append(B)\n\n route[B].append(A)\n\n\n\n\n\nkyori_to_1 = [INF for _ in range(N+1)]\n\nkyori_to_1[1] = 0\n\n\n\nmiti = [0 for _ in range(N+1)]\n\nmiti[0] = -1\n\nmiti[1] = -1\n\n\n\nis_visited = [False for _ in range(N+1)]\n\n\n\n# \u5e45\u512a\u5148\u63a2\u7d22\n\n# \u8a66\u3059\u3079\u304d\u4f4d\u7f6e\u3092\u30ad\u30e5\u30fc\u3067\u7ba1\u7406\n\nque = deque([1])\n\n\n\n# \u30ad\u30e5\u30fc\u304c\u7a7a\u3058\u3083\u306a\u3051\u308c\u3070\n\nwhile len(que) != 0:\n\n now = que.popleft()\n\n \n\n if is_visited[now]:\n\n continue\n\n\n\n is_visited[now] = True\n\n\n\n for place in route[now]:\n\n que.append(place)\n\n\n\n if kyori_to_1[now]+1 < kyori_to_1[place]:\n\n kyori_to_1[place] = kyori_to_1[now]+1\n\n miti[place] = now\n\n\n\nif 0 in miti:\n\n print(\"No\")\n\nelse:\n\n for i in range(1, N+1):\n\n if i == 1:\n\n print(\"Yes\")\n\n else:\n\n print((miti[i]))\n","target":"from sys import stdin\n\nimport math\n\nimport fractions\n\nfrom collections import deque\n\nfrom collections import Counter\n\nimport itertools\n\n\n\nINF = 10 ** 10\n\n\n\n# N\u500b\u306e\u90e8\u5c4b\u3068M\u672c\u306e\u901a\u8def\n\nN, M = [int(x) for x in stdin.readline().rstrip().split()]\n\n\n\nroute = [[] for _ in range(N+1)]\n\n\n\n# A->B \u3068 B->A \u3092\u30ea\u30b9\u30c8\u306b\u4fdd\u5b58\u3057\u3066\u3044\u304f\n\n# A\u3068B\u306f \"1\u4ee5\u4e0a\" \u3092\u60f3\u5b9a\n\nfor _ in range(M):\n\n A, B = [int(x) for x in stdin.readline().rstrip().split()]\n\n route[A].append(B)\n\n route[B].append(A)\n\n\n\n# \u5834\u62401\u307e\u3067\u306e\u8ddd\u96e2\n\ndist_to_1 = [INF for _ in range(N+1)]\n\ndist_to_1[1] = 0\n\n\n\n# next_route[i] = j: \u5834\u6240i\u304c\u30b4\u30fc\u30eb\u306b\u6700\u77ed\u3067\u305f\u3069\u308a\u7740\u304f\u305f\u3081\u306b\u5411\u304b\u3046\u5834\u6240j\n\nnext_route = [0 for _ in range(N+1)]\n\n\n\n# \u5834\u6240i\u306b\u8a2a\u308c\u305f\u304b\u3069\u3046\u304b\n\nis_visited = [False for _ in range(N+1)]\n\n\n\n# \u5e45\u512a\u5148\u63a2\u7d22\n\n# \u8a66\u3059\u3079\u304d\u4f4d\u7f6e\u3092\u30ad\u30e5\u30fc\u3067\u7ba1\u7406\n\nque = deque([1])\n\n\n\n# \u30ad\u30e5\u30fc\u304c\u7a7a\u3058\u3083\u306a\u3051\u308c\u3070\n\nwhile len(que) != 0:\n\n now = que.popleft()\n\n \n\n # \u904e\u53bb\u306b\u8a2a\u308c\u3066\u3044\u308c\u3070\u7121\u8996\n\n if is_visited[now]:\n\n continue\n\n\n\n is_visited[now] = True\n\n\n\n # \u305d\u3053\u304b\u3089\u3044\u3051\u308b\u5834\u6240\u3092\u5e45\u512a\u5148\u63a2\u7d22\u3067\n\n for place in route[now]:\n\n que.append(place)\n\n\n\n # \u8ddd\u96e2\u3068\u30eb\u30fc\u30c8\u306e\u66f4\u65b0\n\n if dist_to_1[now]+1 < dist_to_1[place]:\n\n dist_to_1[place] = dist_to_1[now]+1\n\n next_route[place] = now\n\n\n\n# \u5834\u62402\u4ee5\u964d\u306b\u304a\u3044\u3066\u3001\u3069\u3053\u304b\u6b21\u306e\u9053\u304c\u898b\u3064\u304b\u3063\u3066\u306a\u3044\u5834\u5408\u306f\n\n# \u30b4\u30fc\u30eb\u306b\u3044\u3051\u306a\u3044\u3068\u3044\u3046\u3053\u3068\n\nif 0 in next_route[2:]:\n\n print(\"No\")\n\nelse:\n\n print(\"Yes\")\n\n for i in range(2, N+1):\n\n print((next_route[i]))","code_v0_loc":58,"code_v1_loc":62,"code_v0_num_chars":1113,"code_v1_num_chars":1287,"code_v0_no_empty_lines":"from sys import stdin\nimport math\nimport fractions\nfrom collections import deque\nfrom collections import Counter\nimport itertools\n\nINF = 10**10\n# N\u500b\u306e\u90e8\u5c4b\u3068M\u672c\u306e\u901a\u8def\nN, M = [int(x) for x in stdin.readline().rstrip().split()]\nroute = [[] for _ in range(N + 1)]\nfor _ in range(M):\n A, B = [int(x) for x in stdin.readline().rstrip().split()]\n route[A].append(B)\n route[B].append(A)\nkyori_to_1 = [INF for _ in range(N + 1)]\nkyori_to_1[1] = 0\nmiti = [0 for _ in range(N + 1)]\nmiti[0] = -1\nmiti[1] = -1\nis_visited = [False for _ in range(N + 1)]\n# \u5e45\u512a\u5148\u63a2\u7d22\n# \u8a66\u3059\u3079\u304d\u4f4d\u7f6e\u3092\u30ad\u30e5\u30fc\u3067\u7ba1\u7406\nque = deque([1])\n# \u30ad\u30e5\u30fc\u304c\u7a7a\u3058\u3083\u306a\u3051\u308c\u3070\nwhile len(que) != 0:\n now = que.popleft()\n if is_visited[now]:\n continue\n is_visited[now] = True\n for place in route[now]:\n que.append(place)\n if kyori_to_1[now] + 1 < kyori_to_1[place]:\n kyori_to_1[place] = kyori_to_1[now] + 1\n miti[place] = now\nif 0 in miti:\n print(\"No\")\nelse:\n for i in range(1, N + 1):\n if i == 1:\n print(\"Yes\")\n else:\n print((miti[i]))\n","code_v1_no_empty_lines":"from sys import stdin\nimport math\nimport fractions\nfrom collections import deque\nfrom collections import Counter\nimport itertools\n\nINF = 10**10\n# N\u500b\u306e\u90e8\u5c4b\u3068M\u672c\u306e\u901a\u8def\nN, M = [int(x) for x in stdin.readline().rstrip().split()]\nroute = [[] for _ in range(N + 1)]\n# A->B \u3068 B->A \u3092\u30ea\u30b9\u30c8\u306b\u4fdd\u5b58\u3057\u3066\u3044\u304f\n# A\u3068B\u306f \"1\u4ee5\u4e0a\" \u3092\u60f3\u5b9a\nfor _ in range(M):\n A, B = [int(x) for x in stdin.readline().rstrip().split()]\n route[A].append(B)\n route[B].append(A)\n# \u5834\u62401\u307e\u3067\u306e\u8ddd\u96e2\ndist_to_1 = [INF for _ in range(N + 1)]\ndist_to_1[1] = 0\n# next_route[i] = j: \u5834\u6240i\u304c\u30b4\u30fc\u30eb\u306b\u6700\u77ed\u3067\u305f\u3069\u308a\u7740\u304f\u305f\u3081\u306b\u5411\u304b\u3046\u5834\u6240j\nnext_route = [0 for _ in range(N + 1)]\n# \u5834\u6240i\u306b\u8a2a\u308c\u305f\u304b\u3069\u3046\u304b\nis_visited = [False for _ in range(N + 1)]\n# \u5e45\u512a\u5148\u63a2\u7d22\n# \u8a66\u3059\u3079\u304d\u4f4d\u7f6e\u3092\u30ad\u30e5\u30fc\u3067\u7ba1\u7406\nque = deque([1])\n# \u30ad\u30e5\u30fc\u304c\u7a7a\u3058\u3083\u306a\u3051\u308c\u3070\nwhile len(que) != 0:\n now = que.popleft()\n # \u904e\u53bb\u306b\u8a2a\u308c\u3066\u3044\u308c\u3070\u7121\u8996\n if is_visited[now]:\n continue\n is_visited[now] = True\n # \u305d\u3053\u304b\u3089\u3044\u3051\u308b\u5834\u6240\u3092\u5e45\u512a\u5148\u63a2\u7d22\u3067\n for place in route[now]:\n que.append(place)\n # \u8ddd\u96e2\u3068\u30eb\u30fc\u30c8\u306e\u66f4\u65b0\n if dist_to_1[now] + 1 < dist_to_1[place]:\n dist_to_1[place] = dist_to_1[now] + 1\n next_route[place] = now\n# \u5834\u62402\u4ee5\u964d\u306b\u304a\u3044\u3066\u3001\u3069\u3053\u304b\u6b21\u306e\u9053\u304c\u898b\u3064\u304b\u3063\u3066\u306a\u3044\u5834\u5408\u306f\n# \u30b4\u30fc\u30eb\u306b\u3044\u3051\u306a\u3044\u3068\u3044\u3046\u3053\u3068\nif 0 in next_route[2:]:\n print(\"No\")\nelse:\n print(\"Yes\")\n for i in range(2, N + 1):\n print((next_route[i]))\n","code_same":false,"relative_loc_diff_percent":6.4516129032,"diff":["+# A->B \u3068 B->A \u3092\u30ea\u30b9\u30c8\u306b\u4fdd\u5b58\u3057\u3066\u3044\u304f","+# A\u3068B\u306f \"1\u4ee5\u4e0a\" \u3092\u60f3\u5b9a","-kyori_to_1 = [INF for _ in range(N + 1)]","-kyori_to_1[1] = 0","-miti = [0 for _ in range(N + 1)]","-miti[0] = -1","-miti[1] = -1","+# \u5834\u62401\u307e\u3067\u306e\u8ddd\u96e2","+dist_to_1 = [INF for _ in range(N + 1)]","+dist_to_1[1] = 0","+# next_route[i] = j: \u5834\u6240i\u304c\u30b4\u30fc\u30eb\u306b\u6700\u77ed\u3067\u305f\u3069\u308a\u7740\u304f\u305f\u3081\u306b\u5411\u304b\u3046\u5834\u6240j","+next_route = [0 for _ in range(N + 1)]","+# \u5834\u6240i\u306b\u8a2a\u308c\u305f\u304b\u3069\u3046\u304b","+ # \u904e\u53bb\u306b\u8a2a\u308c\u3066\u3044\u308c\u3070\u7121\u8996","+ # \u305d\u3053\u304b\u3089\u3044\u3051\u308b\u5834\u6240\u3092\u5e45\u512a\u5148\u63a2\u7d22\u3067","- if kyori_to_1[now] + 1 < kyori_to_1[place]:","- kyori_to_1[place] = kyori_to_1[now] + 1","- miti[place] = now","-if 0 in miti:","+ # \u8ddd\u96e2\u3068\u30eb\u30fc\u30c8\u306e\u66f4\u65b0","+ if dist_to_1[now] + 1 < dist_to_1[place]:","+ dist_to_1[place] = dist_to_1[now] + 1","+ next_route[place] = now","+# \u5834\u62402\u4ee5\u964d\u306b\u304a\u3044\u3066\u3001\u3069\u3053\u304b\u6b21\u306e\u9053\u304c\u898b\u3064\u304b\u3063\u3066\u306a\u3044\u5834\u5408\u306f","+# \u30b4\u30fc\u30eb\u306b\u3044\u3051\u306a\u3044\u3068\u3044\u3046\u3053\u3068","+if 0 in next_route[2:]:","- for i in range(1, N + 1):","- if i == 1:","- print(\"Yes\")","- else:","- print((miti[i]))","+ print(\"Yes\")","+ for i in range(2, N + 1):","+ print((next_route[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0365626189,"measured_runtime_v1":0.0362374256,"runtime_lift":1.008973963,"key":["s280558332","s467062227"]} +{"user_id":"u550633907","problem_id":"p02725","language":"python","submission_id_v0":"s349512931","submission_id_v1":"s213716729","cpu_time_v0":1496,"cpu_time_v1":109,"memory_v0":24012,"memory_v1":26436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":92.71,"input":"from collections import deque\n\nK, N = list(map(int, input().split()))\n\nA = deque(list(map(int, input().split())))\n\nA.appendleft(K - A[-1] + A[0])\n\nsa_max = A[0]\n\nfor i in range(1, N):\n\n sa = A[i + 1] - A[i]\n\n if sa_max < sa:\n\n sa_max = sa\n\nprint((A[-1] + A[0] - (sa_max + A[1])))\n","target":"K, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nA.append(K - A[-1] + A[0])\n\nsa_max = A[-1]\n\nfor i in range(N - 1):\n\n sa = A[i + 1] - A[i]\n\n if sa_max < sa:\n\n sa_max = sa\n\nprint(((A[-2] - A[0]) + A[-1] - sa_max))\n","code_v0_loc":10,"code_v1_loc":9,"code_v0_num_chars":279,"code_v1_num_chars":246,"code_v0_no_empty_lines":"from collections import deque\n\nK, N = list(map(int, input().split()))\nA = deque(list(map(int, input().split())))\nA.appendleft(K - A[-1] + A[0])\nsa_max = A[0]\nfor i in range(1, N):\n sa = A[i + 1] - A[i]\n if sa_max < sa:\n sa_max = sa\nprint((A[-1] + A[0] - (sa_max + A[1])))\n","code_v1_no_empty_lines":"K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\nA.append(K - A[-1] + A[0])\nsa_max = A[-1]\nfor i in range(N - 1):\n sa = A[i + 1] - A[i]\n if sa_max < sa:\n sa_max = sa\nprint(((A[-2] - A[0]) + A[-1] - sa_max))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["-from collections import deque","-","-A = deque(list(map(int, input().split())))","-A.appendleft(K - A[-1] + A[0])","-sa_max = A[0]","-for i in range(1, N):","+A = list(map(int, input().split()))","+A.append(K - A[-1] + A[0])","+sa_max = A[-1]","+for i in range(N - 1):","-print((A[-1] + A[0] - (sa_max + A[1])))","+print(((A[-2] - A[0]) + A[-1] - sa_max))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0354817789,"measured_runtime_v1":0.0349821687,"runtime_lift":1.0142818526,"key":["s349512931","s213716729"]} +{"user_id":"u780475861","problem_id":"p03037","language":"python","submission_id_v0":"s043211783","submission_id_v1":"s692664900","cpu_time_v0":273,"cpu_time_v1":67,"memory_v0":3060,"memory_v1":25076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.46,"input":"n, m = list(map(int, input().split()))\n\nleft, right = 1, n\n\nfor _ in range(m):\n\n l, r = list(map(int, input().split()))\n\n if l > left:\n\n left = l\n\n if r < right:\n\n right = r\n\n if left > right:\n\n print((0))\n\n quit()\n\nprint((right - left + 1))","target":"import sys\n\nn, m, *lst = list(map(int, sys.stdin.read().split()))\n\nl = max(lst[::2])\n\nr = min(lst[1::2])\n\nif l > r:\n\n print((0))\n\nelse:\n\n print((r - l + 1))\n","code_v0_loc":12,"code_v1_loc":8,"code_v0_num_chars":241,"code_v1_num_chars":149,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nleft, right = 1, n\nfor _ in range(m):\n l, r = list(map(int, input().split()))\n if l > left:\n left = l\n if r < right:\n right = r\n if left > right:\n print((0))\n quit()\nprint((right - left + 1))\n","code_v1_no_empty_lines":"import sys\n\nn, m, *lst = list(map(int, sys.stdin.read().split()))\nl = max(lst[::2])\nr = min(lst[1::2])\nif l > r:\n print((0))\nelse:\n print((r - l + 1))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-n, m = list(map(int, input().split()))","-left, right = 1, n","-for _ in range(m):","- l, r = list(map(int, input().split()))","- if l > left:","- left = l","- if r < right:","- right = r","- if left > right:","- print((0))","- quit()","-print((right - left + 1))","+import sys","+","+n, m, *lst = list(map(int, sys.stdin.read().split()))","+l = max(lst[::2])","+r = min(lst[1::2])","+if l > r:","+ print((0))","+else:","+ print((r - l + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372824645,"measured_runtime_v1":0.0441086931,"runtime_lift":0.8452407418,"key":["s043211783","s692664900"]} +{"user_id":"u079022693","problem_id":"p02624","language":"python","submission_id_v0":"s021420022","submission_id_v1":"s029424021","cpu_time_v0":2009,"cpu_time_v1":672,"memory_v0":9112,"memory_v1":339660,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.55,"input":"from sys import stdin\n\ndef main():\n\n #\u5165\u529b\n\n readline=stdin.readline\n\n n=int(readline())\n\n\n\n ans=0\n\n for i in range(1,n+1):\n\n n_min=i\n\n n_max=n\/\/i*i\n\n ans+=(n\/\/i)*(n_min+n_max)\/\/2\n\n\n\n print(ans)\n\n\n\nif __name__==\"__main__\":\n\n main()","target":"from sys import stdin\n\nimport numpy as np\n\ndef main():\n\n #\u5165\u529b\n\n readline=stdin.readline\n\n n=int(readline())\n\n\n\n ans=0\n\n n_min=np.arange(1,n+1,dtype=np.int64)\n\n n_max=n\/\/n_min*n_min\n\n kousu=n\/\/n_min\n\n ans=(kousu*(n_min+n_max)\/\/2).sum()\n\n\n\n print(ans)\n\n\n\nif __name__==\"__main__\":\n\n main()","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":271,"code_v1_num_chars":315,"code_v0_no_empty_lines":"from sys import stdin\n\n\ndef main():\n # \u5165\u529b\n readline = stdin.readline\n n = int(readline())\n ans = 0\n for i in range(1, n + 1):\n n_min = i\n n_max = n \/\/ i * i\n ans += (n \/\/ i) * (n_min + n_max) \/\/ 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from sys import stdin\nimport numpy as np\n\n\ndef main():\n # \u5165\u529b\n readline = stdin.readline\n n = int(readline())\n ans = 0\n n_min = np.arange(1, n + 1, dtype=np.int64)\n n_max = n \/\/ n_min * n_min\n kousu = n \/\/ n_min\n ans = (kousu * (n_min + n_max) \/\/ 2).sum()\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["+import numpy as np","- for i in range(1, n + 1):","- n_min = i","- n_max = n \/\/ i * i","- ans += (n \/\/ i) * (n_min + n_max) \/\/ 2","+ n_min = np.arange(1, n + 1, dtype=np.int64)","+ n_max = n \/\/ n_min * n_min","+ kousu = n \/\/ n_min","+ ans = (kousu * (n_min + n_max) \/\/ 2).sum()"],"diff_only_import_comment":false,"measured_runtime_v0":0.5651744723,"measured_runtime_v1":0.405889894,"runtime_lift":1.3924329742,"key":["s021420022","s029424021"]} +{"user_id":"u832039789","problem_id":"p03326","language":"python","submission_id_v0":"s800205351","submission_id_v1":"s604018104","cpu_time_v0":242,"cpu_time_v1":27,"memory_v0":42576,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.84,"input":"N, M = list(map(int,input().split()))\n\nmax = -float('inf')\n\nx = []\n\ny = []\n\nz = []\n\nfor i in range(N):\n\n\txx,yy,zz = list(map(int,input().split()))\n\n\tx.append(xx)\n\n\ty.append(yy)\n\n\tz.append(zz)\n\nfor i in range(-1,2,2):\n\n\tfor j in range(-1,2,2):\n\n\t\tfor k in range(-1,2,2):\n\n\t\t\ts = []\n\n\t\t\tfor m in range(N):\n\n\t\t\t\ts.append(i*x[m]+j*y[m]+k*z[m])\n\n\t\t\ts = sorted(s)\n\n\t\t\ttmp = sum(s[-1*M:])\n\n\t\t\tif tmp > max:\n\n\t\t\t\tmax = tmp\n\nif M==0:\n\n\tprint((0))\n\nelse:\n\n\tprint(max)","target":"n,m = list(map(int,input().split()))\n\nxyz = [list(map(int,input().split())) for _ in range(n)]\n\nres = 0\n\nfor a in (1,-1):\n\n for b in (1,-1):\n\n for c in (1,-1):\n\n l = []\n\n for (x,y,z) in xyz:\n\n l.append(x*a+y*b+z*c)\n\n l = sorted(l,reverse=True)\n\n res = max(res, sum(l[:m]))\n\nprint(res)\n","code_v0_loc":24,"code_v1_loc":12,"code_v0_num_chars":455,"code_v1_num_chars":348,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nmax = -float(\"inf\")\nx = []\ny = []\nz = []\nfor i in range(N):\n xx, yy, zz = list(map(int, input().split()))\n x.append(xx)\n y.append(yy)\n z.append(zz)\nfor i in range(-1, 2, 2):\n for j in range(-1, 2, 2):\n for k in range(-1, 2, 2):\n s = []\n for m in range(N):\n s.append(i * x[m] + j * y[m] + k * z[m])\n s = sorted(s)\n tmp = sum(s[-1 * M :])\n if tmp > max:\n max = tmp\nif M == 0:\n print((0))\nelse:\n print(max)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nxyz = [list(map(int, input().split())) for _ in range(n)]\nres = 0\nfor a in (1, -1):\n for b in (1, -1):\n for c in (1, -1):\n l = []\n for (x, y, z) in xyz:\n l.append(x * a + y * b + z * c)\n l = sorted(l, reverse=True)\n res = max(res, sum(l[:m]))\nprint(res)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-N, M = list(map(int, input().split()))","-max = -float(\"inf\")","-x = []","-y = []","-z = []","-for i in range(N):","- xx, yy, zz = list(map(int, input().split()))","- x.append(xx)","- y.append(yy)","- z.append(zz)","-for i in range(-1, 2, 2):","- for j in range(-1, 2, 2):","- for k in range(-1, 2, 2):","- s = []","- for m in range(N):","- s.append(i * x[m] + j * y[m] + k * z[m])","- s = sorted(s)","- tmp = sum(s[-1 * M :])","- if tmp > max:","- max = tmp","-if M == 0:","- print((0))","-else:","- print(max)","+n, m = list(map(int, input().split()))","+xyz = [list(map(int, input().split())) for _ in range(n)]","+res = 0","+for a in (1, -1):","+ for b in (1, -1):","+ for c in (1, -1):","+ l = []","+ for (x, y, z) in xyz:","+ l.append(x * a + y * b + z * c)","+ l = sorted(l, reverse=True)","+ res = max(res, sum(l[:m]))","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0456037822,"measured_runtime_v1":0.03767751,"runtime_lift":1.2103714427,"key":["s800205351","s604018104"]} +{"user_id":"u926412290","problem_id":"p03031","language":"python","submission_id_v0":"s247240399","submission_id_v1":"s858904561","cpu_time_v0":42,"cpu_time_v1":30,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.57,"input":"N, M = list(map(int, input().split()))\n\nconnected = [list(map(int,input().split())) for _ in range(M)]\n\ncondition = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor i in range(1<>(s-1)) & 1:\n\n count2 += 1\n\n if count2 % 2 == condition[j]:\n\n count1 += 1\n\n if count1 == M:\n\n ans += 1\n\n\n\nprint(ans)","target":"N, M = list(map(int, input().split()))\n\nconnected = [list(map(int,input().split())) for _ in range(M)]\n\ncondition = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor i in range(1<>(s-1)) & 1:\n\n count2 += 1\n\n if count2 % 2 != condition[j]:\n\n FLG = False\n\n break\n\n if FLG:\n\n ans += 1\n\n\n\nprint(ans)","code_v0_loc":18,"code_v1_loc":19,"code_v0_num_chars":457,"code_v1_num_chars":468,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nconnected = [list(map(int, input().split())) for _ in range(M)]\ncondition = list(map(int, input().split()))\nans = 0\nfor i in range(1 << N):\n count1 = 0\n for j, lst in enumerate(connected):\n count2 = 0\n for s in lst[1:]:\n if (i >> (s - 1)) & 1:\n count2 += 1\n if count2 % 2 == condition[j]:\n count1 += 1\n if count1 == M:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nconnected = [list(map(int, input().split())) for _ in range(M)]\ncondition = list(map(int, input().split()))\nans = 0\nfor i in range(1 << N):\n FLG = True\n for j, lst in enumerate(connected):\n count2 = 0\n for s in lst[1:]:\n if (i >> (s - 1)) & 1:\n count2 += 1\n if count2 % 2 != condition[j]:\n FLG = False\n break\n if FLG:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["- count1 = 0","+ FLG = True","- if count2 % 2 == condition[j]:","- count1 += 1","- if count1 == M:","+ if count2 % 2 != condition[j]:","+ FLG = False","+ break","+ if FLG:"],"diff_only_import_comment":false,"measured_runtime_v0":0.080380074,"measured_runtime_v1":0.0396125798,"runtime_lift":2.0291552422,"key":["s247240399","s858904561"]} +{"user_id":"u186838327","problem_id":"p02972","language":"python","submission_id_v0":"s762989573","submission_id_v1":"s474352153","cpu_time_v0":337,"cpu_time_v1":156,"memory_v0":66780,"memory_v1":92980,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.71,"input":"n = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nB = [0]*n\n\n\n\nfor i in reversed(list(range(n))):\n\n j = i+1\n\n cnt = 0\n\n while j <= n:\n\n cnt += B[j-1]\n\n j += i+1\n\n if cnt%2 != A[i]:\n\n B[i] = 1\n\n\n\nm = 0\n\nans = []\n\nfor i, b in enumerate(B):\n\n if b != 0:\n\n m += 1\n\n ans.append(i+1)\n\nprint(m)\n\nif len(ans) > 0:\n\n print((*ans))","target":"n =int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nans = [0]*n\n\nfor i in reversed(list(range(n))):\n\n j = i+1\n\n b = 0\n\n while j <= n:\n\n b += ans[j-1]\n\n j += (i+1)\n\n if b%2 == A[i]:\n\n ans[i] = 0\n\n else:\n\n ans[i] = 1\n\nprint((sum(ans)))\n\nB = []\n\nfor i in range(len(ans)):\n\n if ans[i] != 0:\n\n B.append(i+1)\n\nprint((*B))","code_v0_loc":23,"code_v1_loc":20,"code_v0_num_chars":373,"code_v1_num_chars":362,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nB = [0] * n\nfor i in reversed(list(range(n))):\n j = i + 1\n cnt = 0\n while j <= n:\n cnt += B[j - 1]\n j += i + 1\n if cnt % 2 != A[i]:\n B[i] = 1\nm = 0\nans = []\nfor i, b in enumerate(B):\n if b != 0:\n m += 1\n ans.append(i + 1)\nprint(m)\nif len(ans) > 0:\n print((*ans))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nans = [0] * n\nfor i in reversed(list(range(n))):\n j = i + 1\n b = 0\n while j <= n:\n b += ans[j - 1]\n j += i + 1\n if b % 2 == A[i]:\n ans[i] = 0\n else:\n ans[i] = 1\nprint((sum(ans)))\nB = []\nfor i in range(len(ans)):\n if ans[i] != 0:\n B.append(i + 1)\nprint((*B))\n","code_same":false,"relative_loc_diff_percent":13.0434782609,"diff":["-B = [0] * n","+ans = [0] * n","- cnt = 0","+ b = 0","- cnt += B[j - 1]","+ b += ans[j - 1]","- if cnt % 2 != A[i]:","- B[i] = 1","-m = 0","-ans = []","-for i, b in enumerate(B):","- if b != 0:","- m += 1","- ans.append(i + 1)","-print(m)","-if len(ans) > 0:","- print((*ans))","+ if b % 2 == A[i]:","+ ans[i] = 0","+ else:","+ ans[i] = 1","+print((sum(ans)))","+B = []","+for i in range(len(ans)):","+ if ans[i] != 0:","+ B.append(i + 1)","+print((*B))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0458246032,"measured_runtime_v1":0.0757892807,"runtime_lift":0.6046317209,"key":["s762989573","s474352153"]} +{"user_id":"u020390084","problem_id":"p03291","language":"python","submission_id_v0":"s003460064","submission_id_v1":"s082880295","cpu_time_v0":363,"cpu_time_v1":227,"memory_v0":27692,"memory_v1":54236,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.47,"input":"#!\/usr\/bin\/env python3\n\nimport sys\n\n\n\nMOD = 1000000007 # type: int\n\n\n\n\n\ndef solve(S: str):\n\n N = len(S)\n\n # 0:\u6587\u5b57\u5217\u306e\u7dcf\u6570 1:A\u306e\u6570 2:AB\u306e\u6570 3:ABC\u306e\u6570\n\n ## dp[i][j] = i\u6587\u5b57\u76ee\u307e\u3067\u898b\u305f\u3068\u304d\u306b\u72b6\u614bj\u306e\u6570\n\n ## answer: dp[N][3]\n\n\n\n dp = [[0]*4 for _ in range(N+1)]\n\n dp[0][0] = 1\n\n for i in range(N):\n\n for j in (0,1,2,3):\n\n if S[i] == \"?\":\n\n dp[i+1][j] += dp[i][j]*3\n\n else:\n\n dp[i+1][j] += dp[i][j]\n\n\n\n dp[i+1][j]%=MOD\n\n \n\n ## \u30ab\u30a6\u30f3\u30c8\u9032\u3081\u308b\u5834\u5408\n\n if S[i] == \"A\" or S[i] == \"?\":\n\n dp[i+1][1] += dp[i][0]\n\n dp[i+1][1] %= MOD\n\n \n\n if S[i] == \"B\" or S[i] == \"?\":\n\n dp[i+1][2] += dp[i][1]\n\n dp[i+1][2] %= MOD\n\n\n\n if S[i] == \"C\" or S[i] == \"?\":\n\n dp[i+1][3] += dp[i][2]\n\n dp[i+1][3] %= MOD\n\n\n\n print((dp[N][3]%MOD))\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n S = next(tokens) # type: str\n\n solve(S)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#!\/usr\/bin\/env python3\n\nimport sys\n\n\n\nMOD = 1000000007 # type: int\n\n\n\n\n\ndef solve(S: str):\n\n N = len(S)\n\n # 0:\u6587\u5b57\u5217\u306e\u7dcf\u6570 1:A\u306e\u6570 2:AB\u306e\u6570 3:ABC\u306e\u6570\n\n ## dp[i][j] = i\u6587\u5b57\u76ee\u307e\u3067\u898b\u305f\u3068\u304d\u306b\u72b6\u614bj\u306e\u6570\n\n ## answer: dp[N][3]\n\n\n\n dp = [[0]*4 for _ in range(N+1)]\n\n dp[0][0] = 1\n\n for i in range(N):\n\n for j in (0,1,2,3):\n\n if S[i] == \"?\":\n\n dp[i+1][j] += dp[i][j]*3\n\n else:\n\n dp[i+1][j] += dp[i][j]\n\n\n\n dp[i+1][j]%=MOD\n\n \n\n ## \u30ab\u30a6\u30f3\u30c8\u9032\u3081\u308b\u5834\u5408\n\n if S[i] == \"A\" or S[i] == \"?\":\n\n dp[i+1][1] += dp[i][0]\n\n # dp[i+1][1] %= MOD\n\n \n\n if S[i] == \"B\" or S[i] == \"?\":\n\n dp[i+1][2] += dp[i][1]\n\n # dp[i+1][2] %= MOD\n\n\n\n if S[i] == \"C\" or S[i] == \"?\":\n\n dp[i+1][3] += dp[i][2]\n\n # dp[i+1][3] %= MOD\n\n\n\n print((dp[N][3]%MOD))\n\n return\n\n\n\n\n\ndef main():\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n S = next(tokens) # type: str\n\n solve(S)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":51,"code_v1_loc":51,"code_v0_num_chars":1152,"code_v1_num_chars":1158,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\nMOD = 1000000007 # type: int\n\n\ndef solve(S: str):\n N = len(S)\n # 0:\u6587\u5b57\u5217\u306e\u7dcf\u6570 1:A\u306e\u6570 2:AB\u306e\u6570 3:ABC\u306e\u6570\n ## dp[i][j] = i\u6587\u5b57\u76ee\u307e\u3067\u898b\u305f\u3068\u304d\u306b\u72b6\u614bj\u306e\u6570\n ## answer: dp[N][3]\n dp = [[0] * 4 for _ in range(N + 1)]\n dp[0][0] = 1\n for i in range(N):\n for j in (0, 1, 2, 3):\n if S[i] == \"?\":\n dp[i + 1][j] += dp[i][j] * 3\n else:\n dp[i + 1][j] += dp[i][j]\n dp[i + 1][j] %= MOD\n ## \u30ab\u30a6\u30f3\u30c8\u9032\u3081\u308b\u5834\u5408\n if S[i] == \"A\" or S[i] == \"?\":\n dp[i + 1][1] += dp[i][0]\n dp[i + 1][1] %= MOD\n if S[i] == \"B\" or S[i] == \"?\":\n dp[i + 1][2] += dp[i][1]\n dp[i + 1][2] %= MOD\n if S[i] == \"C\" or S[i] == \"?\":\n dp[i + 1][3] += dp[i][2]\n dp[i + 1][3] %= MOD\n print((dp[N][3] % MOD))\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n S = next(tokens) # type: str\n solve(S)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\nMOD = 1000000007 # type: int\n\n\ndef solve(S: str):\n N = len(S)\n # 0:\u6587\u5b57\u5217\u306e\u7dcf\u6570 1:A\u306e\u6570 2:AB\u306e\u6570 3:ABC\u306e\u6570\n ## dp[i][j] = i\u6587\u5b57\u76ee\u307e\u3067\u898b\u305f\u3068\u304d\u306b\u72b6\u614bj\u306e\u6570\n ## answer: dp[N][3]\n dp = [[0] * 4 for _ in range(N + 1)]\n dp[0][0] = 1\n for i in range(N):\n for j in (0, 1, 2, 3):\n if S[i] == \"?\":\n dp[i + 1][j] += dp[i][j] * 3\n else:\n dp[i + 1][j] += dp[i][j]\n dp[i + 1][j] %= MOD\n ## \u30ab\u30a6\u30f3\u30c8\u9032\u3081\u308b\u5834\u5408\n if S[i] == \"A\" or S[i] == \"?\":\n dp[i + 1][1] += dp[i][0]\n # dp[i+1][1] %= MOD\n if S[i] == \"B\" or S[i] == \"?\":\n dp[i + 1][2] += dp[i][1]\n # dp[i+1][2] %= MOD\n if S[i] == \"C\" or S[i] == \"?\":\n dp[i + 1][3] += dp[i][2]\n # dp[i+1][3] %= MOD\n print((dp[N][3] % MOD))\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n S = next(tokens) # type: str\n solve(S)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dp[i + 1][1] %= MOD","+ # dp[i+1][1] %= MOD","- dp[i + 1][2] %= MOD","+ # dp[i+1][2] %= MOD","- dp[i + 1][3] %= MOD","+ # dp[i+1][3] %= MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.0675330231,"measured_runtime_v1":0.0389715812,"runtime_lift":1.7328787025,"key":["s003460064","s082880295"]} +{"user_id":"u860002137","problem_id":"p03786","language":"python","submission_id_v0":"s200292785","submission_id_v1":"s098342458","cpu_time_v0":329,"cpu_time_v1":97,"memory_v0":23116,"memory_v1":21104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.52,"input":"import numpy as np\n\nimport sys\n\n\n\nn = int(eval(input()))\n\narr = np.array(list(map(int, input().split())))\n\n\n\narr.sort()\n\narr_cs = arr.cumsum()\n\n\n\nans = 0\n\nfor i in range(n - 1):\n\n if arr_cs[i] * 2 < arr[i + 1]:\n\n ans = i + 1\n\nelse:\n\n print((n - ans))","target":"from itertools import accumulate\n\n\n\nn = int(eval(input()))\n\narr = list(map(int, input().split()))\n\n\n\narr.sort()\n\n\n\n# 1\u3064\u524d\u307e\u3067\u306e\u7d2f\u7a4d\u548c\u306e2\u500d\u304c\u305d\u306e\u6642\u70b9\u306e\u8981\u7d20\u306e\u5927\u304d\u3055\u306b\u9054\u3057\u3066\u3044\u308b\u304b\u3069\u3046\u304b\n\ncumsum = list(accumulate(arr))\n\n\n\nresult = []\n\nfor x, y in zip(arr[1:], cumsum[:-1]):\n\n if x <= y * 2:\n\n result.append(True)\n\n else:\n\n result.append(False)\n\n\n\nif all(result):\n\n ans = n\n\nelse:\n\n ans = result[::-1].index(False) + 1\n\n\n\nprint(ans)","code_v0_loc":15,"code_v1_loc":23,"code_v0_num_chars":255,"code_v1_num_chars":416,"code_v0_no_empty_lines":"import numpy as np\nimport sys\n\nn = int(eval(input()))\narr = np.array(list(map(int, input().split())))\narr.sort()\narr_cs = arr.cumsum()\nans = 0\nfor i in range(n - 1):\n if arr_cs[i] * 2 < arr[i + 1]:\n ans = i + 1\nelse:\n print((n - ans))\n","code_v1_no_empty_lines":"from itertools import accumulate\n\nn = int(eval(input()))\narr = list(map(int, input().split()))\narr.sort()\n# 1\u3064\u524d\u307e\u3067\u306e\u7d2f\u7a4d\u548c\u306e2\u500d\u304c\u305d\u306e\u6642\u70b9\u306e\u8981\u7d20\u306e\u5927\u304d\u3055\u306b\u9054\u3057\u3066\u3044\u308b\u304b\u3069\u3046\u304b\ncumsum = list(accumulate(arr))\nresult = []\nfor x, y in zip(arr[1:], cumsum[:-1]):\n if x <= y * 2:\n result.append(True)\n else:\n result.append(False)\nif all(result):\n ans = n\nelse:\n ans = result[::-1].index(False) + 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":34.7826086957,"diff":["-import numpy as np","-import sys","+from itertools import accumulate","-arr = np.array(list(map(int, input().split())))","+arr = list(map(int, input().split()))","-arr_cs = arr.cumsum()","-ans = 0","-for i in range(n - 1):","- if arr_cs[i] * 2 < arr[i + 1]:","- ans = i + 1","+# 1\u3064\u524d\u307e\u3067\u306e\u7d2f\u7a4d\u548c\u306e2\u500d\u304c\u305d\u306e\u6642\u70b9\u306e\u8981\u7d20\u306e\u5927\u304d\u3055\u306b\u9054\u3057\u3066\u3044\u308b\u304b\u3069\u3046\u304b","+cumsum = list(accumulate(arr))","+result = []","+for x, y in zip(arr[1:], cumsum[:-1]):","+ if x <= y * 2:","+ result.append(True)","+ else:","+ result.append(False)","+if all(result):","+ ans = n","- print((n - ans))","+ ans = result[::-1].index(False) + 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.3604239726,"measured_runtime_v1":0.059652513,"runtime_lift":6.042058486,"key":["s200292785","s098342458"]} +{"user_id":"u830054172","problem_id":"p03044","language":"python","submission_id_v0":"s730838256","submission_id_v1":"s398866381","cpu_time_v0":672,"cpu_time_v1":489,"memory_v0":85168,"memory_v1":79512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.23,"input":"import sys\n\ninput=sys.stdin.buffer.readline\n\nsys.setrecursionlimit(10**9)\n\nn=int(input())\n\nedges=[[] for i in range(n)]\n\nfor i in range(n-1):\n\n a,s,w=map(int,input().split())\n\n edges[a-1].append([s-1,w]);edges[s-1].append([a-1,w])\n\ncolors=[-1]*n\n\ncolors[0]=1\n\ndef dfs(now):\n\n for to,cost in edges[now]:\n\n if colors[to]==-1:\n\n colors[to]=(cost+colors[now])%2\n\n dfs(to)\n\n\n\ndfs(0)\n\nprint(*colors,sep=\"\\n\")\n","target":"import sys\n\ninput=sys.stdin.buffer.readline\n\nsys.setrecursionlimit(10**9)\n\n\n\nN = int(input())\n\n# v = [list(map(int, input().split())) for _ in range(N-1)]\n\n\n\nedge = [[] for _ in range(N)]\n\n\n\nfor i in range(N-1):\n\n v1, v2, w = map(int, input().split())\n\n edge[v1-1].append((v2-1, w))\n\n edge[v2-1].append((v1-1, w))\n\n\n\ncolor = [-1 for _ in range(N)]\n\ncolor[0] = 1\n\n\n\ndef dfs(x):\n\n for v, w in edge[x]:\n\n if color[v] == -1:\n\n color[v] = (w + color[x])%2\n\n dfs(v)\n\n\n\n\n\n\n\ndfs(0)\n\nprint(*color, sep=\"\\n\")\n","code_v0_loc":18,"code_v1_loc":27,"code_v0_num_chars":441,"code_v1_num_chars":539,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nsys.setrecursionlimit(10**9)\nn = int(input())\nedges = [[] for i in range(n)]\nfor i in range(n - 1):\n a, s, w = map(int, input().split())\n edges[a - 1].append([s - 1, w])\n edges[s - 1].append([a - 1, w])\ncolors = [-1] * n\ncolors[0] = 1\n\n\ndef dfs(now):\n for to, cost in edges[now]:\n if colors[to] == -1:\n colors[to] = (cost + colors[now]) % 2\n dfs(to)\n\n\ndfs(0)\nprint(*colors, sep=\"\\n\")\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nsys.setrecursionlimit(10**9)\nN = int(input())\n# v = [list(map(int, input().split())) for _ in range(N-1)]\nedge = [[] for _ in range(N)]\nfor i in range(N - 1):\n v1, v2, w = map(int, input().split())\n edge[v1 - 1].append((v2 - 1, w))\n edge[v2 - 1].append((v1 - 1, w))\ncolor = [-1 for _ in range(N)]\ncolor[0] = 1\n\n\ndef dfs(x):\n for v, w in edge[x]:\n if color[v] == -1:\n color[v] = (w + color[x]) % 2\n dfs(v)\n\n\ndfs(0)\nprint(*color, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-n = int(input())","-edges = [[] for i in range(n)]","-for i in range(n - 1):","- a, s, w = map(int, input().split())","- edges[a - 1].append([s - 1, w])","- edges[s - 1].append([a - 1, w])","-colors = [-1] * n","-colors[0] = 1","+N = int(input())","+# v = [list(map(int, input().split())) for _ in range(N-1)]","+edge = [[] for _ in range(N)]","+for i in range(N - 1):","+ v1, v2, w = map(int, input().split())","+ edge[v1 - 1].append((v2 - 1, w))","+ edge[v2 - 1].append((v1 - 1, w))","+color = [-1 for _ in range(N)]","+color[0] = 1","-def dfs(now):","- for to, cost in edges[now]:","- if colors[to] == -1:","- colors[to] = (cost + colors[now]) % 2","- dfs(to)","+def dfs(x):","+ for v, w in edge[x]:","+ if color[v] == -1:","+ color[v] = (w + color[x]) % 2","+ dfs(v)","-print(*colors, sep=\"\\n\")","+print(*color, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0360964077,"measured_runtime_v1":0.0368841434,"runtime_lift":0.9786429734,"key":["s730838256","s398866381"]} +{"user_id":"u426649993","problem_id":"p03200","language":"python","submission_id_v0":"s535635160","submission_id_v1":"s288165601","cpu_time_v0":63,"cpu_time_v1":43,"memory_v0":3500,"memory_v1":3500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.75,"input":"if __name__ == \"__main__\":\n\n S = eval(input())\n\n ans = 0\n\n bcount = 0\n\n for i in range(len(S)):\n\n if S[i] == 'B':\n\n bcount += 1\n\n else:\n\n ans += bcount\n\n\n\n print(ans)\n","target":"if __name__ == \"__main__\":\n\n s = eval(input())\n\n\n\n bcount = 0\n\n ans = 0\n\n\n\n for ss in s:\n\n if ss == 'B':\n\n bcount += 1\n\n else:\n\n ans += bcount\n\n\n\n print(ans)\n","code_v0_loc":11,"code_v1_loc":13,"code_v0_num_chars":212,"code_v1_num_chars":203,"code_v0_no_empty_lines":"if __name__ == \"__main__\":\n S = eval(input())\n ans = 0\n bcount = 0\n for i in range(len(S)):\n if S[i] == \"B\":\n bcount += 1\n else:\n ans += bcount\n print(ans)\n","code_v1_no_empty_lines":"if __name__ == \"__main__\":\n s = eval(input())\n bcount = 0\n ans = 0\n for ss in s:\n if ss == \"B\":\n bcount += 1\n else:\n ans += bcount\n print(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["- S = eval(input())","+ s = eval(input())","+ bcount = 0","- bcount = 0","- for i in range(len(S)):","- if S[i] == \"B\":","+ for ss in s:","+ if ss == \"B\":"],"diff_only_import_comment":false,"measured_runtime_v0":0.0425244588,"measured_runtime_v1":0.0451866946,"runtime_lift":0.9410836343,"key":["s535635160","s288165601"]} +{"user_id":"u332906195","problem_id":"p02780","language":"python","submission_id_v0":"s461243640","submission_id_v1":"s454822118","cpu_time_v0":288,"cpu_time_v1":211,"memory_v0":24548,"memory_v1":24812,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.74,"input":"N, K = list(map(int, input().split()))\n\nP = list(map(int, input().split()))\n\ntmp = sum([(p * (p + 1) \/\/ 2) \/ p for p in P[:K]])\n\nans = tmp\n\nfor i in range(N - K):\n\n tmp -= (P[i] * (P[i] + 1) \/\/ 2) \/ P[i]\n\n tmp += (P[K + i] * (P[K + i] + 1) \/\/ 2) \/ P[K + i]\n\n ans = max(ans, tmp)\n\nprint(ans)\n","target":"N, K = list(map(int, input().split()))\n\nP = list(map(int, input().split()))\n\ntmp = sum([(p + 1) \/ 2 for p in P[:K]])\n\nans = tmp\n\nfor i in range(N - K):\n\n tmp = tmp - (P[i] + 1) \/ 2 + (P[K + i] + 1) \/ 2\n\n ans = max(ans, tmp)\n\nprint(ans)\n","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":294,"code_v1_num_chars":236,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nP = list(map(int, input().split()))\ntmp = sum([(p * (p + 1) \/\/ 2) \/ p for p in P[:K]])\nans = tmp\nfor i in range(N - K):\n tmp -= (P[i] * (P[i] + 1) \/\/ 2) \/ P[i]\n tmp += (P[K + i] * (P[K + i] + 1) \/\/ 2) \/ P[K + i]\n ans = max(ans, tmp)\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nP = list(map(int, input().split()))\ntmp = sum([(p + 1) \/ 2 for p in P[:K]])\nans = tmp\nfor i in range(N - K):\n tmp = tmp - (P[i] + 1) \/ 2 + (P[K + i] + 1) \/ 2\n ans = max(ans, tmp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-tmp = sum([(p * (p + 1) \/\/ 2) \/ p for p in P[:K]])","+tmp = sum([(p + 1) \/ 2 for p in P[:K]])","- tmp -= (P[i] * (P[i] + 1) \/\/ 2) \/ P[i]","- tmp += (P[K + i] * (P[K + i] + 1) \/\/ 2) \/ P[K + i]","+ tmp = tmp - (P[i] + 1) \/ 2 + (P[K + i] + 1) \/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.039721782,"measured_runtime_v1":0.0346190901,"runtime_lift":1.1473953205,"key":["s461243640","s454822118"]} +{"user_id":"u724687935","problem_id":"p03262","language":"python","submission_id_v0":"s098109525","submission_id_v1":"s097976325","cpu_time_v0":127,"cpu_time_v1":98,"memory_v0":16208,"memory_v1":16280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.83,"input":"from fractions import gcd\n\n\n\nN, X = list(map(int, input().split()))\n\nP = list(map(int, input().split()))\n\nP.append(X)\n\nP.sort()\n\nx0 = P[0]\n\nP = [x - x0 for x in P]\n\nans = 0\n\nfor x in P:\n\n ans = gcd(ans, x)\n\n\n\nprint(ans)\n","target":"from fractions import gcd\n\n\n\nN, X = list(map(int, input().split()))\n\nP = list(map(int, input().split()))\n\nx0 = min(min(P), X)\n\nP = [x - x0 for x in P]\n\nans = X - x0\n\nfor x in P:\n\n ans = gcd(ans, x)\n\n\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":217,"code_v1_num_chars":209,"code_v0_no_empty_lines":"from fractions import gcd\n\nN, X = list(map(int, input().split()))\nP = list(map(int, input().split()))\nP.append(X)\nP.sort()\nx0 = P[0]\nP = [x - x0 for x in P]\nans = 0\nfor x in P:\n ans = gcd(ans, x)\nprint(ans)\n","code_v1_no_empty_lines":"from fractions import gcd\n\nN, X = list(map(int, input().split()))\nP = list(map(int, input().split()))\nx0 = min(min(P), X)\nP = [x - x0 for x in P]\nans = X - x0\nfor x in P:\n ans = gcd(ans, x)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-P.append(X)","-P.sort()","-x0 = P[0]","+x0 = min(min(P), X)","-ans = 0","+ans = X - x0"],"diff_only_import_comment":false,"measured_runtime_v0":0.0601221659,"measured_runtime_v1":0.0651465671,"runtime_lift":0.9228754266,"key":["s098109525","s097976325"]} +{"user_id":"u057964173","problem_id":"p03970","language":"python","submission_id_v0":"s025671075","submission_id_v1":"s289439019","cpu_time_v0":171,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.06,"input":"\n\nimport sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n s=eval(input())\n\n t='CODEFESTIVAL2016'\n\n cnt=0\n\n for i in range(16):\n\n if s[i]!=t[i]:\n\n cnt+=1\n\n print(cnt)\n\nresolve()","target":"import sys\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef resolve():\n\n s=eval(input())\n\n t='CODEFESTIVAL2016'\n\n cnt=0\n\n for ss,tt in zip(s,t):\n\n if ss!=tt:\n\n cnt+=1\n\n print(cnt)\n\nresolve()","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":228,"code_v1_num_chars":225,"code_v0_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n s = eval(input())\n t = \"CODEFESTIVAL2016\"\n cnt = 0\n for i in range(16):\n if s[i] != t[i]:\n cnt += 1\n print(cnt)\n\n\nresolve()\n","code_v1_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef resolve():\n s = eval(input())\n t = \"CODEFESTIVAL2016\"\n cnt = 0\n for ss, tt in zip(s, t):\n if ss != tt:\n cnt += 1\n print(cnt)\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["- for i in range(16):","- if s[i] != t[i]:","+ for ss, tt in zip(s, t):","+ if ss != tt:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1203783789,"measured_runtime_v1":0.0363368526,"runtime_lift":3.3128455054,"key":["s025671075","s289439019"]} +{"user_id":"u412197640","problem_id":"p02579","language":"python","submission_id_v0":"s812493273","submission_id_v1":"s374447089","cpu_time_v0":918,"cpu_time_v1":772,"memory_v0":130864,"memory_v1":93024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.9,"input":"from sys import *\n\nfrom collections import deque\n\nH, W = list(map(int, stdin.readline().split()))\n\npersonY, personX = list(map(int, stdin.readline().split()))\n\ngH, gW = list(map(int, stdin.readline().split()))\n\n\n\ngrid = [list(stdin.readline().strip()) for x in range(H)]\n\nvisited = [ [10**10] * W for i in range(H)]\n\noptions = deque([[personY-1, personX-1]])\n\n\n\nvisited[personY-1][personX-1] = 0\n\nwhile(options):\n\n y,x = options.popleft()\n\n if y+1 < H and grid[y+1][x] == \".\":\n\n if visited[y+1][x] > visited[y][x]:\n\n options.appendleft((y+1, x))\n\n visited[y+1][x] = visited[y][x]\n\n\n\n if y-1 >= 0 and grid[y-1][x] == \".\":\n\n if visited[y-1][x] > visited[y][x]:\n\n options.appendleft((y-1, x))\n\n visited[y-1][x] = visited[y][x]\n\n\n\n if x+1 < W and grid[y][x+1] == \".\":\n\n if visited[y][x+1] > visited[y][x]:\n\n options.appendleft((y, x+1))\n\n visited[y][x+1] = visited[y][x]\n\n\n\n if x-1 >= 0 and grid[y][x-1] == \".\":\n\n if visited[y][x-1] > visited[y][x]:\n\n options.appendleft((y, x-1))\n\n visited[y][x-1] = visited[y][x]\n\n #-------------------------------------------\n\n for Y,X in [(2,-2),(2,-1),(2,0),(2,1),(2,2), (1,-2),(1,-1),(1,1),(1,2), (0,-2),(0,2), (-1,-2),(-1,-1),(-1,1),(-1,2), (-2,-2),(-2,-1),(-2,0),(-2,1),(-2,2)]:\n\n if x+X >= 0 and x+X < W and y+Y >= 0 and y+Y < H and grid[y+Y][x+X] == \".\":\n\n if visited[y+Y][x+X] > visited[y][x] +1:\n\n options.append((y+Y, x+X))\n\n visited[y+Y][x+X] = visited[y][x]+1\n\n\n\nprint((-1 if visited[gH-1][gW-1] == 10**10 else visited[gH-1][gW-1] ))\n","target":"from sys import *\n\nfrom collections import deque\n\nH, W = list(map(int, stdin.readline().split()))\n\npersonY, personX = list(map(int, stdin.readline().split()))\n\ngH, gW = list(map(int, stdin.readline().split()))\n\n\n\ngrid = [eval(input()) for x in range(H)]\n\nvisited = [[10**10] * W for i in range(H)]\n\noptions = deque([[personY-1, personX-1]])\n\n\n\nvisited[personY-1][personX-1] = 0\n\nwhile(options):\n\n y,x = options.popleft()\n\n if y+1 < H and grid[y+1][x] == \".\":\n\n if visited[y+1][x] > visited[y][x]:\n\n options.appendleft((y+1, x))\n\n visited[y+1][x] = visited[y][x]\n\n\n\n if y-1 >= 0 and grid[y-1][x] == \".\":\n\n if visited[y-1][x] > visited[y][x]:\n\n options.appendleft((y-1, x))\n\n visited[y-1][x] = visited[y][x]\n\n\n\n if x+1 < W and grid[y][x+1] == \".\":\n\n if visited[y][x+1] > visited[y][x]:\n\n options.appendleft((y, x+1))\n\n visited[y][x+1] = visited[y][x]\n\n\n\n if x-1 >= 0 and grid[y][x-1] == \".\":\n\n if visited[y][x-1] > visited[y][x]:\n\n options.appendleft((y, x-1))\n\n visited[y][x-1] = visited[y][x]\n\n #-------------------------------------------\n\n for Y,X in [(2,-2),(2,-1),(2,0),(2,1),(2,2), (1,-2),(1,-1),(1,1),(1,2), (0,-2),(0,2), (-1,-2),(-1,-1),(-1,1),(-1,2), (-2,-2),(-2,-1),(-2,0),(-2,1),(-2,2)]:\n\n if x+X >= 0 and x+X < W and y+Y >= 0 and y+Y < H and grid[y+Y][x+X] == \".\":\n\n if visited[y+Y][x+X] > visited[y][x] +1:\n\n options.append((y+Y, x+X))\n\n visited[y+Y][x+X] = visited[y][x]+1\n\n\n\nprint((-1 if visited[gH-1][gW-1] == 10**10 else visited[gH-1][gW-1] ))\n","code_v0_loc":40,"code_v1_loc":40,"code_v0_num_chars":1640,"code_v1_num_chars":1616,"code_v0_no_empty_lines":"from sys import *\nfrom collections import deque\n\nH, W = list(map(int, stdin.readline().split()))\npersonY, personX = list(map(int, stdin.readline().split()))\ngH, gW = list(map(int, stdin.readline().split()))\ngrid = [list(stdin.readline().strip()) for x in range(H)]\nvisited = [[10**10] * W for i in range(H)]\noptions = deque([[personY - 1, personX - 1]])\nvisited[personY - 1][personX - 1] = 0\nwhile options:\n y, x = options.popleft()\n if y + 1 < H and grid[y + 1][x] == \".\":\n if visited[y + 1][x] > visited[y][x]:\n options.appendleft((y + 1, x))\n visited[y + 1][x] = visited[y][x]\n if y - 1 >= 0 and grid[y - 1][x] == \".\":\n if visited[y - 1][x] > visited[y][x]:\n options.appendleft((y - 1, x))\n visited[y - 1][x] = visited[y][x]\n if x + 1 < W and grid[y][x + 1] == \".\":\n if visited[y][x + 1] > visited[y][x]:\n options.appendleft((y, x + 1))\n visited[y][x + 1] = visited[y][x]\n if x - 1 >= 0 and grid[y][x - 1] == \".\":\n if visited[y][x - 1] > visited[y][x]:\n options.appendleft((y, x - 1))\n visited[y][x - 1] = visited[y][x]\n # -------------------------------------------\n for Y, X in [\n (2, -2),\n (2, -1),\n (2, 0),\n (2, 1),\n (2, 2),\n (1, -2),\n (1, -1),\n (1, 1),\n (1, 2),\n (0, -2),\n (0, 2),\n (-1, -2),\n (-1, -1),\n (-1, 1),\n (-1, 2),\n (-2, -2),\n (-2, -1),\n (-2, 0),\n (-2, 1),\n (-2, 2),\n ]:\n if (\n x + X >= 0\n and x + X < W\n and y + Y >= 0\n and y + Y < H\n and grid[y + Y][x + X] == \".\"\n ):\n if visited[y + Y][x + X] > visited[y][x] + 1:\n options.append((y + Y, x + X))\n visited[y + Y][x + X] = visited[y][x] + 1\nprint((-1 if visited[gH - 1][gW - 1] == 10**10 else visited[gH - 1][gW - 1]))\n","code_v1_no_empty_lines":"from sys import *\nfrom collections import deque\n\nH, W = list(map(int, stdin.readline().split()))\npersonY, personX = list(map(int, stdin.readline().split()))\ngH, gW = list(map(int, stdin.readline().split()))\ngrid = [eval(input()) for x in range(H)]\nvisited = [[10**10] * W for i in range(H)]\noptions = deque([[personY - 1, personX - 1]])\nvisited[personY - 1][personX - 1] = 0\nwhile options:\n y, x = options.popleft()\n if y + 1 < H and grid[y + 1][x] == \".\":\n if visited[y + 1][x] > visited[y][x]:\n options.appendleft((y + 1, x))\n visited[y + 1][x] = visited[y][x]\n if y - 1 >= 0 and grid[y - 1][x] == \".\":\n if visited[y - 1][x] > visited[y][x]:\n options.appendleft((y - 1, x))\n visited[y - 1][x] = visited[y][x]\n if x + 1 < W and grid[y][x + 1] == \".\":\n if visited[y][x + 1] > visited[y][x]:\n options.appendleft((y, x + 1))\n visited[y][x + 1] = visited[y][x]\n if x - 1 >= 0 and grid[y][x - 1] == \".\":\n if visited[y][x - 1] > visited[y][x]:\n options.appendleft((y, x - 1))\n visited[y][x - 1] = visited[y][x]\n # -------------------------------------------\n for Y, X in [\n (2, -2),\n (2, -1),\n (2, 0),\n (2, 1),\n (2, 2),\n (1, -2),\n (1, -1),\n (1, 1),\n (1, 2),\n (0, -2),\n (0, 2),\n (-1, -2),\n (-1, -1),\n (-1, 1),\n (-1, 2),\n (-2, -2),\n (-2, -1),\n (-2, 0),\n (-2, 1),\n (-2, 2),\n ]:\n if (\n x + X >= 0\n and x + X < W\n and y + Y >= 0\n and y + Y < H\n and grid[y + Y][x + X] == \".\"\n ):\n if visited[y + Y][x + X] > visited[y][x] + 1:\n options.append((y + Y, x + X))\n visited[y + Y][x + X] = visited[y][x] + 1\nprint((-1 if visited[gH - 1][gW - 1] == 10**10 else visited[gH - 1][gW - 1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-grid = [list(stdin.readline().strip()) for x in range(H)]","+grid = [eval(input()) for x in range(H)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0809016287,"measured_runtime_v1":0.0450711615,"runtime_lift":1.7949754567,"key":["s812493273","s374447089"]} +{"user_id":"u624696727","problem_id":"p03168","language":"python","submission_id_v0":"s528935887","submission_id_v1":"s536424783","cpu_time_v0":1460,"cpu_time_v1":814,"memory_v0":483080,"memory_v1":256776,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.25,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nprob_table = list(map(float, input().split()))\n\n\n\ndp = [[0 for _ in range(2*N+2)] for _ in range(N)]\n\n\n\n\n\ndp[0][N-1] = 1 - prob_table[0]\n\ndp[0][N+1] = prob_table[0]\n\n\n\nfor i in range(1,N):\n\n\tfor j in range(N-i-1,N+i+2):\n\n\t\tif(j > 0 and j < 2*N+1):\n\n\t\t\tdp[i][j] = dp[i-1][j-1]*prob_table[i] + dp[i-1][j+1]*(1-prob_table[i])\n\n\t\telif(j <= 0):\n\n\t\t\tdp[i][j] = dp[i-1][j+1]*(1-prob_table[i])\n\n\t\telse : \n\n\t\t\tdp[i][j] = dp[i-1][j-1]*prob_table[i]\n\nprint((sum(dp[N-1][N+1:])))","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nprob_table = list(map(float, input().split()))\n\n\n\ndp = [[0 for _ in range(N+1)] for _ in range(N+1)]\n\ndp[0][0] = 1\n\nfor i in range(0,N):\n\n\tfor j in range(i+1):\n\n\t\tdp[i+1][j+1] += dp[i][j]*prob_table[i]\n\n\t\tdp[i+1][j] += dp[i][j]*(1-prob_table[i])\n\n\n\nprint((sum(dp[N][N\/\/2+1:])))","code_v0_loc":21,"code_v1_loc":14,"code_v0_num_chars":527,"code_v1_num_chars":335,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nprob_table = list(map(float, input().split()))\ndp = [[0 for _ in range(2 * N + 2)] for _ in range(N)]\ndp[0][N - 1] = 1 - prob_table[0]\ndp[0][N + 1] = prob_table[0]\nfor i in range(1, N):\n for j in range(N - i - 1, N + i + 2):\n if j > 0 and j < 2 * N + 1:\n dp[i][j] = dp[i - 1][j - 1] * prob_table[i] + dp[i - 1][j + 1] * (\n 1 - prob_table[i]\n )\n elif j <= 0:\n dp[i][j] = dp[i - 1][j + 1] * (1 - prob_table[i])\n else:\n dp[i][j] = dp[i - 1][j - 1] * prob_table[i]\nprint((sum(dp[N - 1][N + 1 :])))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nprob_table = list(map(float, input().split()))\ndp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]\ndp[0][0] = 1\nfor i in range(0, N):\n for j in range(i + 1):\n dp[i + 1][j + 1] += dp[i][j] * prob_table[i]\n dp[i + 1][j] += dp[i][j] * (1 - prob_table[i])\nprint((sum(dp[N][N \/\/ 2 + 1 :])))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-dp = [[0 for _ in range(2 * N + 2)] for _ in range(N)]","-dp[0][N - 1] = 1 - prob_table[0]","-dp[0][N + 1] = prob_table[0]","-for i in range(1, N):","- for j in range(N - i - 1, N + i + 2):","- if j > 0 and j < 2 * N + 1:","- dp[i][j] = dp[i - 1][j - 1] * prob_table[i] + dp[i - 1][j + 1] * (","- 1 - prob_table[i]","- )","- elif j <= 0:","- dp[i][j] = dp[i - 1][j + 1] * (1 - prob_table[i])","- else:","- dp[i][j] = dp[i - 1][j - 1] * prob_table[i]","-print((sum(dp[N - 1][N + 1 :])))","+dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]","+dp[0][0] = 1","+for i in range(0, N):","+ for j in range(i + 1):","+ dp[i + 1][j + 1] += dp[i][j] * prob_table[i]","+ dp[i + 1][j] += dp[i][j] * (1 - prob_table[i])","+print((sum(dp[N][N \/\/ 2 + 1 :])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0488555243,"measured_runtime_v1":0.0400828273,"runtime_lift":1.2188642255,"key":["s528935887","s536424783"]} +{"user_id":"u777283665","problem_id":"p02780","language":"python","submission_id_v0":"s434735868","submission_id_v1":"s512843288","cpu_time_v0":1855,"cpu_time_v1":162,"memory_v0":75408,"memory_v1":23616,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.27,"input":"def main():\n\n import sys\n\n input = sys.stdin.readline\n\n from itertools import accumulate\n\n\n\n def e(dice):\n\n ans = 0\n\n for r in range(1, dice+1):\n\n ans += r \/dice\n\n return ans\n\n\n\n n, k = list(map(int, input().split()))\n\n p = list(map(int, input().split()))\n\n\n\n p_cum = [0] + list(accumulate(p))\n\n\n\n ma = 0\n\n ind = 0\n\n for i in range(k, n+1):\n\n temp = p_cum[i] - p_cum[i-k]\n\n if ma < temp:\n\n ma = temp\n\n ind = i\n\n\n\n x = p[ind-k:ind]\n\n\n\n print((sum(e(d) for d in x)))\n\n\n\nif __name__ == '__main__':\n\n main()","target":"from itertools import accumulate\n\n\n\nn, k = list(map(int, input().split()))\n\np = [0] + list(accumulate([(int(d) + 1) \/ 2 for d in input().split()]))\n\n\n\nans = 0\n\nfor i in range(k, n+1):\n\n ans = max(ans, p[i] - p[i-k])\n\n\n\nprint(ans)","code_v0_loc":30,"code_v1_loc":10,"code_v0_num_chars":602,"code_v1_num_chars":232,"code_v0_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.readline\n from itertools import accumulate\n\n def e(dice):\n ans = 0\n for r in range(1, dice + 1):\n ans += r \/ dice\n return ans\n\n n, k = list(map(int, input().split()))\n p = list(map(int, input().split()))\n p_cum = [0] + list(accumulate(p))\n ma = 0\n ind = 0\n for i in range(k, n + 1):\n temp = p_cum[i] - p_cum[i - k]\n if ma < temp:\n ma = temp\n ind = i\n x = p[ind - k : ind]\n print((sum(e(d) for d in x)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from itertools import accumulate\n\nn, k = list(map(int, input().split()))\np = [0] + list(accumulate([(int(d) + 1) \/ 2 for d in input().split()]))\nans = 0\nfor i in range(k, n + 1):\n ans = max(ans, p[i] - p[i - k])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-def main():","- import sys","+from itertools import accumulate","- input = sys.stdin.readline","- from itertools import accumulate","-","- def e(dice):","- ans = 0","- for r in range(1, dice + 1):","- ans += r \/ dice","- return ans","-","- n, k = list(map(int, input().split()))","- p = list(map(int, input().split()))","- p_cum = [0] + list(accumulate(p))","- ma = 0","- ind = 0","- for i in range(k, n + 1):","- temp = p_cum[i] - p_cum[i - k]","- if ma < temp:","- ma = temp","- ind = i","- x = p[ind - k : ind]","- print((sum(e(d) for d in x)))","-","-","-if __name__ == \"__main__\":","- main()","+n, k = list(map(int, input().split()))","+p = [0] + list(accumulate([(int(d) + 1) \/ 2 for d in input().split()]))","+ans = 0","+for i in range(k, n + 1):","+ ans = max(ans, p[i] - p[i - k])","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0417598932,"measured_runtime_v1":0.0340448074,"runtime_lift":1.2266156373,"key":["s434735868","s512843288"]} +{"user_id":"u798803522","problem_id":"p02283","language":"python","submission_id_v0":"s278047451","submission_id_v1":"s805186780","cpu_time_v0":8640,"cpu_time_v1":7880,"memory_v0":117928,"memory_v1":113116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.8,"input":"import sys\n\nclass BinaryTree:\n\n def __init__(self):\n\n self.root = None\n\n def b_insert(self,x):\n\n if self.root is None:\n\n self.root = Node(x)\n\n return\n\n node = None\n\n root = self.root\n\n while root is not None:\n\n node = root\n\n if x == root.data:\n\n return\n\n elif x < root.data:\n\n root = root.left\n\n else:\n\n root = root.right\n\n if node is None:\n\n # print(\"center\",x)\n\n node = Node(x)\n\n elif node.data < x:\n\n # print(\"right\",x)\n\n node.right = Node(x)\n\n else:\n\n # print(\"left\",x)\n\n node.left = Node(x)\n\n def b_inorder(self):\n\n return inorder(self.root)\n\n def b_preorder(self):\n\n return preorder(self.root)\n\n \n\nclass Node:\n\n def __init__(self,x):\n\n self.data = x\n\n self.left = None\n\n self.right = None\n\n \n\n\n\ndef inorder(node):\n\n nodelist = []\n\n if node.left:\n\n nodelist += inorder(node.left)\n\n nodelist += [node.data]\n\n if node.right:\n\n nodelist += inorder(node.right)\n\n return nodelist\n\ndef preorder(node):\n\n nodelist = [node.data]\n\n if node.left:\n\n nodelist += preorder(node.left)\n\n if node.right:\n\n nodelist += preorder(node.right)\n\n return nodelist\n\n \n\nline = sys.stdin.readline()\n\nbfs = BinaryTree()\n\n \n\nfor temp in sys.stdin:\n\n if temp[0] == 'i':\n\n command,num = (n for n in temp.split(\" \"))\n\n bfs.b_insert(int(num))\n\n else:\n\n print(\"\",end=\" \")\n\n print(*bfs.b_inorder())\n\n print(\"\",end=\" \")\n\n print(*bfs.b_preorder())\n","target":"class BinarySearchTree:\n\n def __init__(self):\n\n self.root = None\n\n\n\n def insert(self, x):\n\n node = self.Node(x)\n\n if self.root is None:\n\n self.root = node\n\n else:\n\n here = self.root\n\n #\n\n temp = None\n\n while here is not None:\n\n temp = here\n\n if x < here.node:\n\n here = here.left\n\n elif x > here.node:\n\n here = here.right\n\n if x < temp.node:\n\n temp.left = node\n\n elif x > temp.node:\n\n temp.right = node\n\n\n\n def inorder(self, answer, address = \"root\"):\n\n if address is \"root\":\n\n address = self.root\n\n elif address is None:\n\n return\n\n self.inorder(answer, address.left)\n\n answer.append(address.node)\n\n self.inorder(answer, address.right)\n\n\n\n def preorder(self, answer, address = \"root\"):\n\n if address is \"root\":\n\n address = self.root\n\n elif address is None:\n\n return\n\n answer.append(address.node)\n\n self.preorder(answer, address.left)\n\n self.preorder(answer, address.right)\n\n\n\n class Node:\n\n def __init__(self, x):\n\n self.node = x\n\n self.left = None\n\n self.right = None\n\n\n\nquery = int(input())\n\nbt = BinarySearchTree()\n\nfor _ in range(query):\n\n command = input()\n\n if command[0] == \"i\":\n\n bt.insert(int(command.split(\" \")[1]))\n\n else:\n\n a = []\n\n bt.inorder(a)\n\n print(\" \", end = \"\")\n\n print(*a)\n\n a = []\n\n bt.preorder(a)\n\n print(\" \", end = \"\")\n\n print(*a)\n","code_v0_loc":67,"code_v1_loc":62,"code_v0_num_chars":1722,"code_v1_num_chars":1711,"code_v0_no_empty_lines":"import sys\n\n\nclass BinaryTree:\n def __init__(self):\n self.root = None\n\n def b_insert(self, x):\n if self.root is None:\n self.root = Node(x)\n return\n node = None\n root = self.root\n while root is not None:\n node = root\n if x == root.data:\n return\n elif x < root.data:\n root = root.left\n else:\n root = root.right\n if node is None:\n # print(\"center\",x)\n node = Node(x)\n elif node.data < x:\n # print(\"right\",x)\n node.right = Node(x)\n else:\n # print(\"left\",x)\n node.left = Node(x)\n\n def b_inorder(self):\n return inorder(self.root)\n\n def b_preorder(self):\n return preorder(self.root)\n\n\nclass Node:\n def __init__(self, x):\n self.data = x\n self.left = None\n self.right = None\n\n\ndef inorder(node):\n nodelist = []\n if node.left:\n nodelist += inorder(node.left)\n nodelist += [node.data]\n if node.right:\n nodelist += inorder(node.right)\n return nodelist\n\n\ndef preorder(node):\n nodelist = [node.data]\n if node.left:\n nodelist += preorder(node.left)\n if node.right:\n nodelist += preorder(node.right)\n return nodelist\n\n\nline = sys.stdin.readline()\nbfs = BinaryTree()\nfor temp in sys.stdin:\n if temp[0] == \"i\":\n command, num = (n for n in temp.split(\" \"))\n bfs.b_insert(int(num))\n else:\n print(\"\", end=\" \")\n print(*bfs.b_inorder())\n print(\"\", end=\" \")\n print(*bfs.b_preorder())\n","code_v1_no_empty_lines":"class BinarySearchTree:\n def __init__(self):\n self.root = None\n\n def insert(self, x):\n node = self.Node(x)\n if self.root is None:\n self.root = node\n else:\n here = self.root\n #\n temp = None\n while here is not None:\n temp = here\n if x < here.node:\n here = here.left\n elif x > here.node:\n here = here.right\n if x < temp.node:\n temp.left = node\n elif x > temp.node:\n temp.right = node\n\n def inorder(self, answer, address=\"root\"):\n if address is \"root\":\n address = self.root\n elif address is None:\n return\n self.inorder(answer, address.left)\n answer.append(address.node)\n self.inorder(answer, address.right)\n\n def preorder(self, answer, address=\"root\"):\n if address is \"root\":\n address = self.root\n elif address is None:\n return\n answer.append(address.node)\n self.preorder(answer, address.left)\n self.preorder(answer, address.right)\n\n class Node:\n def __init__(self, x):\n self.node = x\n self.left = None\n self.right = None\n\n\nquery = int(input())\nbt = BinarySearchTree()\nfor _ in range(query):\n command = input()\n if command[0] == \"i\":\n bt.insert(int(command.split(\" \")[1]))\n else:\n a = []\n bt.inorder(a)\n print(\" \", end=\"\")\n print(*a)\n a = []\n bt.preorder(a)\n print(\" \", end=\"\")\n print(*a)\n","code_same":false,"relative_loc_diff_percent":7.4626865672,"diff":["-import sys","-","-","-class BinaryTree:","+class BinarySearchTree:","- def b_insert(self, x):","+ def insert(self, x):","+ node = self.Node(x)","- self.root = Node(x)","+ self.root = node","+ else:","+ here = self.root","+ #","+ temp = None","+ while here is not None:","+ temp = here","+ if x < here.node:","+ here = here.left","+ elif x > here.node:","+ here = here.right","+ if x < temp.node:","+ temp.left = node","+ elif x > temp.node:","+ temp.right = node","+","+ def inorder(self, answer, address=\"root\"):","+ if address is \"root\":","+ address = self.root","+ elif address is None:","- node = None","- root = self.root","- while root is not None:","- node = root","- if x == root.data:","- return","- elif x < root.data:","- root = root.left","- else:","- root = root.right","- if node is None:","- # print(\"center\",x)","- node = Node(x)","- elif node.data < x:","- # print(\"right\",x)","- node.right = Node(x)","- else:","- # print(\"left\",x)","- node.left = Node(x)","+ self.inorder(answer, address.left)","+ answer.append(address.node)","+ self.inorder(answer, address.right)","- def b_inorder(self):","- return inorder(self.root)","+ def preorder(self, answer, address=\"root\"):","+ if address is \"root\":","+ address = self.root","+ elif address is None:","+ return","+ answer.append(address.node)","+ self.preorder(answer, address.left)","+ self.preorder(answer, address.right)","- def b_preorder(self):","- return preorder(self.root)","+ class Node:","+ def __init__(self, x):","+ self.node = x","+ self.left = None","+ self.right = None","-class Node:","- def __init__(self, x):","- self.data = x","- self.left = None","- self.right = None","-","-","-def inorder(node):","- nodelist = []","- if node.left:","- nodelist += inorder(node.left)","- nodelist += [node.data]","- if node.right:","- nodelist += inorder(node.right)","- return nodelist","-","-","-def preorder(node):","- nodelist = [node.data]","- if node.left:","- nodelist += preorder(node.left)","- if node.right:","- nodelist += preorder(node.right)","- return nodelist","-","-","-line = sys.stdin.readline()","-bfs = BinaryTree()","-for temp in sys.stdin:","- if temp[0] == \"i\":","- command, num = (n for n in temp.split(\" \"))","- bfs.b_insert(int(num))","+query = int(input())","+bt = BinarySearchTree()","+for _ in range(query):","+ command = input()","+ if command[0] == \"i\":","+ bt.insert(int(command.split(\" \")[1]))","- print(\"\", end=\" \")","- print(*bfs.b_inorder())","- print(\"\", end=\" \")","- print(*bfs.b_preorder())","+ a = []","+ bt.inorder(a)","+ print(\" \", end=\"\")","+ print(*a)","+ a = []","+ bt.preorder(a)","+ print(\" \", end=\"\")","+ print(*a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0469481387,"measured_runtime_v1":0.1337728603,"runtime_lift":0.3509541368,"key":["s278047451","s805186780"]} +{"user_id":"u815878613","problem_id":"p03037","language":"python","submission_id_v0":"s120994164","submission_id_v1":"s149287838","cpu_time_v0":195,"cpu_time_v1":178,"memory_v0":9100,"memory_v1":9144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.72,"input":"N, M = list(map(int, input().split()))\n\n\n\nleft = 1\n\nright = N\n\n\n\nfor _ in range(M):\n\n l, r = list(map(int, input().split()))\n\n\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\nans = right - left\n\n\n\nprint((ans + 1 if ans >= 0 else 0))\n","target":"def main():\n\n N, M = list(map(int, input().split()))\n\n\n\n left = 1\n\n right = N\n\n\n\n for _ in range(M):\n\n l, r = list(map(int, input().split()))\n\n\n\n if left < l:\n\n left = l\n\n if right > r:\n\n right = r\n\n\n\n ans = right - left\n\n\n\n print((ans + 1 if ans >= 0 else 0))\n\n\n\n\n\nmain()\n","code_v0_loc":16,"code_v1_loc":20,"code_v0_num_chars":251,"code_v1_num_chars":320,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nleft = 1\nright = N\nfor _ in range(M):\n l, r = list(map(int, input().split()))\n if left < l:\n left = l\n if right > r:\n right = r\nans = right - left\nprint((ans + 1 if ans >= 0 else 0))\n","code_v1_no_empty_lines":"def main():\n N, M = list(map(int, input().split()))\n left = 1\n right = N\n for _ in range(M):\n l, r = list(map(int, input().split()))\n if left < l:\n left = l\n if right > r:\n right = r\n ans = right - left\n print((ans + 1 if ans >= 0 else 0))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-N, M = list(map(int, input().split()))","-left = 1","-right = N","-for _ in range(M):","- l, r = list(map(int, input().split()))","- if left < l:","- left = l","- if right > r:","- right = r","-ans = right - left","-print((ans + 1 if ans >= 0 else 0))","+def main():","+ N, M = list(map(int, input().split()))","+ left = 1","+ right = N","+ for _ in range(M):","+ l, r = list(map(int, input().split()))","+ if left < l:","+ left = l","+ if right > r:","+ right = r","+ ans = right - left","+ print((ans + 1 if ans >= 0 else 0))","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0468322206,"measured_runtime_v1":0.0375424411,"runtime_lift":1.2474473991,"key":["s120994164","s149287838"]} +{"user_id":"u816872429","problem_id":"p02994","language":"python","submission_id_v0":"s035369410","submission_id_v1":"s713635815","cpu_time_v0":177,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.4,"input":"n, l = list(map(int, input().split()))\n\nif l > 0:\n\n c = l\n\nelif l + n - 1 < 0:\n\n c = l + n - 1\n\nelse:\n\n c = 0\n\nprint((l * n + n * (n - 1) \/\/ 2 - c))","target":"n, l = list(map(int, input().split()))\n\na, b = sorted([l, l + n - 1])\n\nprint((sum(range((a + 1 if a > 0 else a),\n\n (b - 1 if b < 0 else b) + 1))))","code_v0_loc":8,"code_v1_loc":4,"code_v0_num_chars":149,"code_v1_num_chars":153,"code_v0_no_empty_lines":"n, l = list(map(int, input().split()))\nif l > 0:\n c = l\nelif l + n - 1 < 0:\n c = l + n - 1\nelse:\n c = 0\nprint((l * n + n * (n - 1) \/\/ 2 - c))\n","code_v1_no_empty_lines":"n, l = list(map(int, input().split()))\na, b = sorted([l, l + n - 1])\nprint((sum(range((a + 1 if a > 0 else a), (b - 1 if b < 0 else b) + 1))))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-if l > 0:","- c = l","-elif l + n - 1 < 0:","- c = l + n - 1","-else:","- c = 0","-print((l * n + n * (n - 1) \/\/ 2 - c))","+a, b = sorted([l, l + n - 1])","+print((sum(range((a + 1 if a > 0 else a), (b - 1 if b < 0 else b) + 1))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1009738352,"measured_runtime_v1":0.0413535805,"runtime_lift":2.4417192912,"key":["s035369410","s713635815"]} +{"user_id":"u088552457","problem_id":"p03319","language":"python","submission_id_v0":"s278586782","submission_id_v1":"s127625175","cpu_time_v0":305,"cpu_time_v1":219,"memory_v0":78232,"memory_v1":52780,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.2,"input":"def main():\n\n n,k = input_list()\n\n a = input_list()\n\n ans = 0\n\n r = 1\n\n while True:\n\n r += k-1\n\n ans += 1\n\n if r >= n:\n\n break\n\n print(ans)\n\n \n\ndef input_list():\n\n return list(map(int, input().split()))\n\n\n\ndef input_list_str():\n\n return list(map(str, input().split()))\n\n\n\ndef lcm_base(x, y):\n\n return (x * y) \/\/ fractions.gcd(x, y)\n\n\n\ndef lcm_list(numbers):\n\n return reduce(lcm_base, numbers, 1)\n\n\n\ndef gcd(*numbers):\n\n return reduce(fractions.gcd, numbers)\n\n\n\ndef gcd_list(numbers):\n\n return reduce(fractions.gcd, numbers)\n\n\n\n# 2\u3067\u5272\u308a\u5207\u308c\u308b\u56de\u6570\n\ndef divide_two(arg):\n\n c = 0\n\n while True:\n\n if c >= 2:\n\n break\n\n if arg % 2 != 0:\n\n break\n\n arg \/\/= 2\n\n c += 1\n\n return c \n\n\n\nimport math\n\nimport fractions\n\nimport collections\n\nfrom functools import reduce\n\nmain()","target":"import math\n\n\n\n\n\ndef main():\n\n n, k = input_list()\n\n a = input_list()\n\n a = math.ceil((n-k)\/(k-1))\n\n print((1+a))\n\n\n\n\n\ndef input_list():\n\n return list(map(int, input().split()))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":47,"code_v1_loc":16,"code_v0_num_chars":808,"code_v1_num_chars":235,"code_v0_no_empty_lines":"def main():\n n, k = input_list()\n a = input_list()\n ans = 0\n r = 1\n while True:\n r += k - 1\n ans += 1\n if r >= n:\n break\n print(ans)\n\n\ndef input_list():\n return list(map(int, input().split()))\n\n\ndef input_list_str():\n return list(map(str, input().split()))\n\n\ndef lcm_base(x, y):\n return (x * y) \/\/ fractions.gcd(x, y)\n\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\n\ndef gcd(*numbers):\n return reduce(fractions.gcd, numbers)\n\n\ndef gcd_list(numbers):\n return reduce(fractions.gcd, numbers)\n\n\n# 2\u3067\u5272\u308a\u5207\u308c\u308b\u56de\u6570\ndef divide_two(arg):\n c = 0\n while True:\n if c >= 2:\n break\n if arg % 2 != 0:\n break\n arg \/\/= 2\n c += 1\n return c\n\n\nimport math\nimport fractions\nimport collections\nfrom functools import reduce\n\nmain()\n","code_v1_no_empty_lines":"import math\n\n\ndef main():\n n, k = input_list()\n a = input_list()\n a = math.ceil((n - k) \/ (k - 1))\n print((1 + a))\n\n\ndef input_list():\n return list(map(int, input().split()))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":65.9574468085,"diff":["+import math","+","+","- ans = 0","- r = 1","- while True:","- r += k - 1","- ans += 1","- if r >= n:","- break","- print(ans)","+ a = math.ceil((n - k) \/ (k - 1))","+ print((1 + a))","-def input_list_str():","- return list(map(str, input().split()))","-","-","-def lcm_base(x, y):","- return (x * y) \/\/ fractions.gcd(x, y)","-","-","-def lcm_list(numbers):","- return reduce(lcm_base, numbers, 1)","-","-","-def gcd(*numbers):","- return reduce(fractions.gcd, numbers)","-","-","-def gcd_list(numbers):","- return reduce(fractions.gcd, numbers)","-","-","-# 2\u3067\u5272\u308a\u5207\u308c\u308b\u56de\u6570","-def divide_two(arg):","- c = 0","- while True:","- if c >= 2:","- break","- if arg % 2 != 0:","- break","- arg \/\/= 2","- c += 1","- return c","-","-","-import math","-import fractions","-import collections","-from functools import reduce","-","-main()","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.1467084885,"measured_runtime_v1":0.0540026188,"runtime_lift":2.716692111,"key":["s278586782","s127625175"]} +{"user_id":"u940102677","problem_id":"p03107","language":"python","submission_id_v0":"s345100185","submission_id_v1":"s753402231","cpu_time_v0":22,"cpu_time_v1":18,"memory_v0":3956,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"s = list(eval(input()))\n\nprint((2*min(s.count('0'),s.count('1'))))","target":"s = eval(input())\n\nprint((2*min(s.count('0'),s.count('1'))))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":58,"code_v1_num_chars":52,"code_v0_no_empty_lines":"s = list(eval(input()))\nprint((2 * min(s.count(\"0\"), s.count(\"1\"))))\n","code_v1_no_empty_lines":"s = eval(input())\nprint((2 * min(s.count(\"0\"), s.count(\"1\"))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-s = list(eval(input()))","+s = eval(input())"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463445516,"measured_runtime_v1":0.0450690351,"runtime_lift":1.0283013936,"key":["s345100185","s753402231"]} +{"user_id":"u226108478","problem_id":"p02995","language":"python","submission_id_v0":"s525599579","submission_id_v1":"s361870450","cpu_time_v0":38,"cpu_time_v1":35,"memory_v0":5296,"memory_v1":5096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.89,"input":"# -*- coding: utf-8 -*-\n\n'''Snippets for lcm.\n\nAvailable functions:\n\n- lcm: Compute least common multiple of a and b.\n\n'''\n\n\n\n\n\ndef lcm(a: int, b: int) -> int:\n\n '''Compute least common multiple of a and b.\n\n Args:\n\n a: Int of number (greater than 0).\n\n b: Int of number (greater than 0).\n\n Returns:\n\n least common multiple.\n\n Landau notation: O(log n)\n\n See:\n\n https:\/\/gist.github.com\/endolith\/114336\/eff2dc13535f139d0d6a2db68597fad2826b53c3\n\n https:\/\/docs.python.org\/3\/library\/sys.html#sys.version_info\n\n '''\n\n\n\n from sys import version_info\n\n\n\n if version_info.major == 3 and version_info.minor >= 5:\n\n from math import gcd\n\n else:\n\n from fractions import gcd\n\n\n\n return a * b \/\/ gcd(a, b)\n\n\n\n\n\ndef main():\n\n a, b, c, d = list(map(int, input().split()))\n\n l = lcm(c, d)\n\n x = b \/\/ c - (a - 1) \/\/ c\n\n y = b \/\/ d - (a - 1) \/\/ d\n\n z = b \/\/ l - (a - 1) \/\/ l\n\n w = b - a + 1\n\n\n\n if c % d == 0 or d % c == 0:\n\n print((w - x))\n\n else:\n\n print((w - (x + y - z)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"# -*- coding: utf-8 -*-\n\n'''Snippets for lcm.\n\nAvailable functions:\n\n- lcm: Compute least common multiple of a and b.\n\n'''\n\n\n\n\n\ndef lcm(a: int, b: int) -> int:\n\n '''Compute least common multiple of a and b.\n\n Args:\n\n a: Int of number (greater than 0).\n\n b: Int of number (greater than 0).\n\n Returns:\n\n least common multiple.\n\n Landau notation: O(log n)\n\n See:\n\n https:\/\/gist.github.com\/endolith\/114336\/eff2dc13535f139d0d6a2db68597fad2826b53c3\n\n https:\/\/docs.python.org\/3\/library\/sys.html#sys.version_info\n\n '''\n\n\n\n from sys import version_info\n\n\n\n if version_info.major == 3 and version_info.minor >= 5:\n\n from math import gcd\n\n else:\n\n from fractions import gcd\n\n\n\n return a * b \/\/ gcd(a, b)\n\n\n\n\n\ndef main():\n\n a, b, c, d = list(map(int, input().split()))\n\n l = lcm(c, d)\n\n x = b \/\/ c - (a - 1) \/\/ c\n\n y = b \/\/ d - (a - 1) \/\/ d\n\n z = b \/\/ l - (a - 1) \/\/ l\n\n w = b - a + 1\n\n\n\n print((w - (x + y - z)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":46,"code_v1_loc":43,"code_v0_num_chars":1101,"code_v1_num_chars":1030,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"Snippets for lcm.\nAvailable functions:\n- lcm: Compute least common multiple of a and b.\n\"\"\"\n\n\ndef lcm(a: int, b: int) -> int:\n \"\"\"Compute least common multiple of a and b.\n Args:\n a: Int of number (greater than 0).\n b: Int of number (greater than 0).\n Returns:\n least common multiple.\n Landau notation: O(log n)\n See:\n https:\/\/gist.github.com\/endolith\/114336\/eff2dc13535f139d0d6a2db68597fad2826b53c3\n https:\/\/docs.python.org\/3\/library\/sys.html#sys.version_info\n \"\"\"\n from sys import version_info\n\n if version_info.major == 3 and version_info.minor >= 5:\n from math import gcd\n else:\n from fractions import gcd\n return a * b \/\/ gcd(a, b)\n\n\ndef main():\n a, b, c, d = list(map(int, input().split()))\n l = lcm(c, d)\n x = b \/\/ c - (a - 1) \/\/ c\n y = b \/\/ d - (a - 1) \/\/ d\n z = b \/\/ l - (a - 1) \/\/ l\n w = b - a + 1\n if c % d == 0 or d % c == 0:\n print((w - x))\n else:\n print((w - (x + y - z)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"Snippets for lcm.\nAvailable functions:\n- lcm: Compute least common multiple of a and b.\n\"\"\"\n\n\ndef lcm(a: int, b: int) -> int:\n \"\"\"Compute least common multiple of a and b.\n Args:\n a: Int of number (greater than 0).\n b: Int of number (greater than 0).\n Returns:\n least common multiple.\n Landau notation: O(log n)\n See:\n https:\/\/gist.github.com\/endolith\/114336\/eff2dc13535f139d0d6a2db68597fad2826b53c3\n https:\/\/docs.python.org\/3\/library\/sys.html#sys.version_info\n \"\"\"\n from sys import version_info\n\n if version_info.major == 3 and version_info.minor >= 5:\n from math import gcd\n else:\n from fractions import gcd\n return a * b \/\/ gcd(a, b)\n\n\ndef main():\n a, b, c, d = list(map(int, input().split()))\n l = lcm(c, d)\n x = b \/\/ c - (a - 1) \/\/ c\n y = b \/\/ d - (a - 1) \/\/ d\n z = b \/\/ l - (a - 1) \/\/ l\n w = b - a + 1\n print((w - (x + y - z)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.5217391304,"diff":["- if c % d == 0 or d % c == 0:","- print((w - x))","- else:","- print((w - (x + y - z)))","+ print((w - (x + y - z)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0396458185,"measured_runtime_v1":0.0412214599,"runtime_lift":0.9617761863,"key":["s525599579","s361870450"]} +{"user_id":"u498487134","problem_id":"p02821","language":"python","submission_id_v0":"s579259734","submission_id_v1":"s955256525","cpu_time_v0":700,"cpu_time_v1":480,"memory_v0":33548,"memory_v1":84524,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.43,"input":"import numpy as np\n\n\n\nN,M = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nAmax=max(A)\n\n\n\nn0 = 2**int(np.ceil(np.log2(2*Amax+1)))#Amax+1\u4ee5\u4e0a\u3068\u306a\u308b\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\u6570\n\n\n\nAfre=np.zeros(n0).astype(int)#\u30d1\u30ef\u30fc\u306e\u983b\u5ea6(1~Amax+1)\n\nfor i in range(N):\n\n Afre[A[i]]+=1\n\n\n\n#astype(int)\u306f\u5207\u308a\u6368\u3066\u306a\u306e\u3067\uff0crint\u3067\u56db\u6368\u4e94\u5165\u3057\u3066\u304b\u3089\uff0e\n\nS = np.rint(np.fft.irfft(np.fft.rfft(Afre)*np.fft.rfft(Afre))).astype(int)\n\nScum =S.cumsum()#\u7d2f\u7a4d\u548c\n\nbd = N*N-M#\u4e0a\u304b\u3089M\u500b\u3092\u53d6\u308a\u51fa\u3057\u305f\u3044\n\ni=np.searchsorted(Scum,bd)#\u4fa1\u5024i\u3092\u751f\u307f\u51fa\u305b\u308b\u7d44\u307f\u304cM\u500b\u4ee5\u4e0a\u3042\u308b\n\n#\u4fa1\u5024i\u304c\u751f\u307f\u51fa\u305b\u308b\u9078\u3073\u65b9\u306e\u4f59\u5206\u306a\u3082\u306e\u3092\u5f15\u304d\u305f\u3044\n\nremove=((Scum[-1]-Scum[i])-M)*i\n\nans=0\n\nfor j in range(i+1,n0):\n\n ans+=S[j]*j\n\nprint((ans-remove))","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\n\n\n\"\"\"\n\n\u300c1\u56de\u306e\u63e1\u624b\u3067X\u4ee5\u4e0a\u5e78\u798f\u5ea6\u304c\u4e0a\u304c\u308b\u306a\u3089\u3070\u63a1\u7528\u300d\u3068\u3057\u305f\u3068\u304d\u306b\uff0c\u4f55\u500b\u63a1\u7528\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u304b\uff1f\n\n\u6b64\u306e\u5024\u304c\u521d\u3081\u3066M\u4ee5\u4e0a\u306b\u306a\u3063\u305f\u3068\u3053\u308d\u306eX\u3092\u5229\u7528\u3059\u308c\u3070\u7b54\u3048\u304c\u51fa\u308b\uff0e\n\n\u4f8b\u3048\u3070M+2\u958b\u50ac\u6d88\u3057\u3066\u3057\u307e\u3063\u305f\u3089\uff0c2*X\u5f15\u3051\u3070\u826f\u3044\n\n\n\n\u300cX\u4ee5\u4e0a\u306a\u3089\u63a1\u7528\u300d\u306f\u5de6\u624b\u3054\u3068\u306b\uff0c\u53f3\u624b\u3092\u4e8c\u5206\u63a2\u7d22\n\n\n\n\"\"\"\n\ndef main():\n\n import bisect\n\n \n\n mod=10**9+7\n\n N,M=MI()\n\n A=LI()\n\n A.sort()\n\n \n\n def ch(X):\n\n temp=0\n\n \n\n for i in range(N):#\u5de6\u624b\n\n l=A[i]\n\n t=X-l\n\n num=bisect.bisect_left(A,t)\n\n temp+=N-num\n\n \n\n return temp>=M\n\n \n\n \n\n ok=0\n\n ng=2*(10**5) + 1\n\n \n\n while ng - ok > 1:\n\n med=(ok+ng)\/\/2\n\n if ch(med):\n\n ok=med\n\n else:\n\n ng=med\n\n \n\n # \u7dcf\u548c\u306e\u8a08\u7b97\u30d1\u30fc\u30c8\uff0c\u7d2f\u7a4d\u548c\u3067\n\n S=[0]*(N+1)\n\n for i in range(N):\n\n S[i+1]=S[i]+A[i]\n\n \n\n ans=0\n\n temp=0\n\n X=ok\n\n for i in range(N):#\u5de6\u624b\n\n l=A[i]\n\n t=X-l\n\n num=bisect.bisect_left(A,t)\n\n temp+=N-num\n\n ans+=S[-1] - S[num] + (N-num)*l\n\n # print(i,num,S[-1]-S[num],(N-num)*l)\n\n\n\n \n\n if temp>M:\n\n ans-=X*(temp-M)\n\n \n\n print(ans)\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n\n\nmain()\n","code_v0_loc":23,"code_v1_loc":79,"code_v0_num_chars":590,"code_v1_num_chars":1338,"code_v0_no_empty_lines":"import numpy as np\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nAmax = max(A)\nn0 = 2 ** int(np.ceil(np.log2(2 * Amax + 1))) # Amax+1\u4ee5\u4e0a\u3068\u306a\u308b\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\u6570\nAfre = np.zeros(n0).astype(int) # \u30d1\u30ef\u30fc\u306e\u983b\u5ea6(1~Amax+1)\nfor i in range(N):\n Afre[A[i]] += 1\n# astype(int)\u306f\u5207\u308a\u6368\u3066\u306a\u306e\u3067\uff0crint\u3067\u56db\u6368\u4e94\u5165\u3057\u3066\u304b\u3089\uff0e\nS = np.rint(np.fft.irfft(np.fft.rfft(Afre) * np.fft.rfft(Afre))).astype(int)\nScum = S.cumsum() # \u7d2f\u7a4d\u548c\nbd = N * N - M # \u4e0a\u304b\u3089M\u500b\u3092\u53d6\u308a\u51fa\u3057\u305f\u3044\ni = np.searchsorted(Scum, bd) # \u4fa1\u5024i\u3092\u751f\u307f\u51fa\u305b\u308b\u7d44\u307f\u304cM\u500b\u4ee5\u4e0a\u3042\u308b\n# \u4fa1\u5024i\u304c\u751f\u307f\u51fa\u305b\u308b\u9078\u3073\u65b9\u306e\u4f59\u5206\u306a\u3082\u306e\u3092\u5f15\u304d\u305f\u3044\nremove = ((Scum[-1] - Scum[i]) - M) * i\nans = 0\nfor j in range(i + 1, n0):\n ans += S[j] * j\nprint((ans - remove))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\n\"\"\"\n\u300c1\u56de\u306e\u63e1\u624b\u3067X\u4ee5\u4e0a\u5e78\u798f\u5ea6\u304c\u4e0a\u304c\u308b\u306a\u3089\u3070\u63a1\u7528\u300d\u3068\u3057\u305f\u3068\u304d\u306b\uff0c\u4f55\u500b\u63a1\u7528\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u304b\uff1f\n\u6b64\u306e\u5024\u304c\u521d\u3081\u3066M\u4ee5\u4e0a\u306b\u306a\u3063\u305f\u3068\u3053\u308d\u306eX\u3092\u5229\u7528\u3059\u308c\u3070\u7b54\u3048\u304c\u51fa\u308b\uff0e\n\u4f8b\u3048\u3070M+2\u958b\u50ac\u6d88\u3057\u3066\u3057\u307e\u3063\u305f\u3089\uff0c2*X\u5f15\u3051\u3070\u826f\u3044\n\u300cX\u4ee5\u4e0a\u306a\u3089\u63a1\u7528\u300d\u306f\u5de6\u624b\u3054\u3068\u306b\uff0c\u53f3\u624b\u3092\u4e8c\u5206\u63a2\u7d22\n\"\"\"\n\n\ndef main():\n import bisect\n\n mod = 10**9 + 7\n N, M = MI()\n A = LI()\n A.sort()\n\n def ch(X):\n temp = 0\n for i in range(N): # \u5de6\u624b\n l = A[i]\n t = X - l\n num = bisect.bisect_left(A, t)\n temp += N - num\n return temp >= M\n\n ok = 0\n ng = 2 * (10**5) + 1\n while ng - ok > 1:\n med = (ok + ng) \/\/ 2\n if ch(med):\n ok = med\n else:\n ng = med\n # \u7dcf\u548c\u306e\u8a08\u7b97\u30d1\u30fc\u30c8\uff0c\u7d2f\u7a4d\u548c\u3067\n S = [0] * (N + 1)\n for i in range(N):\n S[i + 1] = S[i] + A[i]\n ans = 0\n temp = 0\n X = ok\n for i in range(N): # \u5de6\u624b\n l = A[i]\n t = X - l\n num = bisect.bisect_left(A, t)\n temp += N - num\n ans += S[-1] - S[num] + (N - num) * l\n # print(i,num,S[-1]-S[num],(N-num)*l)\n if temp > M:\n ans -= X * (temp - M)\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":70.8860759494,"diff":["-import numpy as np","+import sys","-N, M = list(map(int, input().split()))","-A = list(map(int, input().split()))","-Amax = max(A)","-n0 = 2 ** int(np.ceil(np.log2(2 * Amax + 1))) # Amax+1\u4ee5\u4e0a\u3068\u306a\u308b\u6700\u5c0f\u306e2\u306e\u3079\u304d\u4e57\u6570","-Afre = np.zeros(n0).astype(int) # \u30d1\u30ef\u30fc\u306e\u983b\u5ea6(1~Amax+1)","-for i in range(N):","- Afre[A[i]] += 1","-# astype(int)\u306f\u5207\u308a\u6368\u3066\u306a\u306e\u3067\uff0crint\u3067\u56db\u6368\u4e94\u5165\u3057\u3066\u304b\u3089\uff0e","-S = np.rint(np.fft.irfft(np.fft.rfft(Afre) * np.fft.rfft(Afre))).astype(int)","-Scum = S.cumsum() # \u7d2f\u7a4d\u548c","-bd = N * N - M # \u4e0a\u304b\u3089M\u500b\u3092\u53d6\u308a\u51fa\u3057\u305f\u3044","-i = np.searchsorted(Scum, bd) # \u4fa1\u5024i\u3092\u751f\u307f\u51fa\u305b\u308b\u7d44\u307f\u304cM\u500b\u4ee5\u4e0a\u3042\u308b","-# \u4fa1\u5024i\u304c\u751f\u307f\u51fa\u305b\u308b\u9078\u3073\u65b9\u306e\u4f59\u5206\u306a\u3082\u306e\u3092\u5f15\u304d\u305f\u3044","-remove = ((Scum[-1] - Scum[i]) - M) * i","-ans = 0","-for j in range(i + 1, n0):","- ans += S[j] * j","-print((ans - remove))","+input = sys.stdin.readline","+","+","+def I():","+ return int(eval(input()))","+","+","+def MI():","+ return list(map(int, input().split()))","+","+","+def LI():","+ return list(map(int, input().split()))","+","+","+\"\"\"","+\u300c1\u56de\u306e\u63e1\u624b\u3067X\u4ee5\u4e0a\u5e78\u798f\u5ea6\u304c\u4e0a\u304c\u308b\u306a\u3089\u3070\u63a1\u7528\u300d\u3068\u3057\u305f\u3068\u304d\u306b\uff0c\u4f55\u500b\u63a1\u7528\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u304b\uff1f","+\u6b64\u306e\u5024\u304c\u521d\u3081\u3066M\u4ee5\u4e0a\u306b\u306a\u3063\u305f\u3068\u3053\u308d\u306eX\u3092\u5229\u7528\u3059\u308c\u3070\u7b54\u3048\u304c\u51fa\u308b\uff0e","+\u4f8b\u3048\u3070M+2\u958b\u50ac\u6d88\u3057\u3066\u3057\u307e\u3063\u305f\u3089\uff0c2*X\u5f15\u3051\u3070\u826f\u3044","+\u300cX\u4ee5\u4e0a\u306a\u3089\u63a1\u7528\u300d\u306f\u5de6\u624b\u3054\u3068\u306b\uff0c\u53f3\u624b\u3092\u4e8c\u5206\u63a2\u7d22","+\"\"\"","+","+","+def main():","+ import bisect","+","+ mod = 10**9 + 7","+ N, M = MI()","+ A = LI()","+ A.sort()","+","+ def ch(X):","+ temp = 0","+ for i in range(N): # \u5de6\u624b","+ l = A[i]","+ t = X - l","+ num = bisect.bisect_left(A, t)","+ temp += N - num","+ return temp >= M","+","+ ok = 0","+ ng = 2 * (10**5) + 1","+ while ng - ok > 1:","+ med = (ok + ng) \/\/ 2","+ if ch(med):","+ ok = med","+ else:","+ ng = med","+ # \u7dcf\u548c\u306e\u8a08\u7b97\u30d1\u30fc\u30c8\uff0c\u7d2f\u7a4d\u548c\u3067","+ S = [0] * (N + 1)","+ for i in range(N):","+ S[i + 1] = S[i] + A[i]","+ ans = 0","+ temp = 0","+ X = ok","+ for i in range(N): # \u5de6\u624b","+ l = A[i]","+ t = X - l","+ num = bisect.bisect_left(A, t)","+ temp += N - num","+ ans += S[-1] - S[num] + (N - num) * l","+ # print(i,num,S[-1]-S[num],(N-num)*l)","+ if temp > M:","+ ans -= X * (temp - M)","+ print(ans)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2099461925,"measured_runtime_v1":0.038143496,"runtime_lift":5.5041150986,"key":["s579259734","s955256525"]} +{"user_id":"u520843951","problem_id":"p02887","language":"python","submission_id_v0":"s811674385","submission_id_v1":"s402267385","cpu_time_v0":49,"cpu_time_v1":43,"memory_v0":4652,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.24,"input":"n = int(eval(input()))\n\ns= list(eval(input()))\n\nans = []\n\ntmp = s[0]\n\n\n\nif len(set(s)) == 1:\n\n print((1))\n\n exit()\n\n\n\nfor i in range(1, n):\n\n if s[i] == tmp:\n\n continue\n\n else:\n\n ans.append(tmp)\n\n tmp = s[i]\n\n\n\nif ans[-1] == s[-1]:\n\n print((len(ans)))\n\nelse:\n\n ans.append(s[-1])\n\n print((len(ans)))","target":"n = int(eval(input()))\n\ns = eval(input())\n\nans = 1\n\n\n\nfor i in range(n-1):\n\n ans += (s[i] != s[i+1])\n\n \n\nprint(ans)","code_v0_loc":21,"code_v1_loc":8,"code_v0_num_chars":322,"code_v1_num_chars":105,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = list(eval(input()))\nans = []\ntmp = s[0]\nif len(set(s)) == 1:\n print((1))\n exit()\nfor i in range(1, n):\n if s[i] == tmp:\n continue\n else:\n ans.append(tmp)\n tmp = s[i]\nif ans[-1] == s[-1]:\n print((len(ans)))\nelse:\n ans.append(s[-1])\n print((len(ans)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\nans = 1\nfor i in range(n - 1):\n ans += s[i] != s[i + 1]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":61.9047619048,"diff":["-s = list(eval(input()))","-ans = []","-tmp = s[0]","-if len(set(s)) == 1:","- print((1))","- exit()","-for i in range(1, n):","- if s[i] == tmp:","- continue","- else:","- ans.append(tmp)","- tmp = s[i]","-if ans[-1] == s[-1]:","- print((len(ans)))","-else:","- ans.append(s[-1])","- print((len(ans)))","+s = eval(input())","+ans = 1","+for i in range(n - 1):","+ ans += s[i] != s[i + 1]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1012266192,"measured_runtime_v1":0.0951628904,"runtime_lift":1.0637194685,"key":["s811674385","s402267385"]} +{"user_id":"u713218261","problem_id":"p02412","language":"python","submission_id_v0":"s160875781","submission_id_v1":"s310156226","cpu_time_v0":600,"cpu_time_v1":500,"memory_v0":6728,"memory_v1":6724,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for a in range(1, n+1):\n\n for b in range(a+1, n+1):\n\n for c in range(b+1, n+1):\n\n if (a + b + c) == x:\n\n count += 1\n\n print(count)","target":"while True:\n\n (n, x) = [int(i) for i in input().split()]\n\n if n == x == 0:\n\n break\n\n\n\n count = 0\n\n for a in range(1, n+1):\n\n for b in range(a+1, n+1):\n\n for c in range(b+1, n+1):\n\n if (a + b + c) == x:\n\n count += 1\n\n elif (a + b + c) > x:\n\n break\n\n print(count)","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":304,"code_v1_num_chars":370,"code_v0_no_empty_lines":"while True:\n (n, x) = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for a in range(1, n + 1):\n for b in range(a + 1, n + 1):\n for c in range(b + 1, n + 1):\n if (a + b + c) == x:\n count += 1\n print(count)\n","code_v1_no_empty_lines":"while True:\n (n, x) = [int(i) for i in input().split()]\n if n == x == 0:\n break\n count = 0\n for a in range(1, n + 1):\n for b in range(a + 1, n + 1):\n for c in range(b + 1, n + 1):\n if (a + b + c) == x:\n count += 1\n elif (a + b + c) > x:\n break\n print(count)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+ elif (a + b + c) > x:","+ break"],"diff_only_import_comment":false,"measured_runtime_v0":0.039180228,"measured_runtime_v1":0.0388945999,"runtime_lift":1.0073436434,"key":["s160875781","s310156226"]} +{"user_id":"u312025627","problem_id":"p02744","language":"python","submission_id_v0":"s125220362","submission_id_v1":"s882894416","cpu_time_v0":350,"cpu_time_v1":184,"memory_v0":71900,"memory_v1":73880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.43,"input":"def main():\n\n from string import ascii_lowercase\n\n dic = {i: s for i, s in enumerate(ascii_lowercase)}\n\n N = int(input())\n\n ans = []\n\n\n\n def dfs(s, mx):\n\n if len(s) == N:\n\n ans.append(s)\n\n return\n\n else:\n\n for i in range(mx+2):\n\n mx = max(mx, i)\n\n dfs(s + dic[i], mx)\n\n dfs(\"a\", 0)\n\n print(*ans, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n from string import ascii_lowercase\n\n N = int(eval(input()))\n\n ascii_dic = {i: a for i, a in enumerate(ascii_lowercase)}\n\n ascii_rdic = {a: i for i, a in enumerate(ascii_lowercase)}\n\n # ans = []\n\n\n\n def dfs(A):\n\n if len(A) == N:\n\n # ans.append(\"\".join(A))\n\n print((\"\".join(A)))\n\n return\n\n if not A:\n\n dfs([\"a\"])\n\n else:\n\n s = max(ascii_rdic[a] for a in A)\n\n for i in range(s+2):\n\n dfs(A + [ascii_dic[i]])\n\n\n\n dfs([])\n\n\n\n # for i in range(len(ans)):\n\n # for j in range(i+1, len(ans)):\n\n # S = ans[i]\n\n # T = ans[j]\n\n # same = True # \u540c\u578b\u3067\u3042\u308b\n\n # for k in range(N):\n\n # for m in range(k, N):\n\n # if not ((S[k] == S[m] and T[k] == T[m]) or\n\n # (S[k] != S[m] and T[k] != T[m])):\n\n # same = False\n\n # if same: # \u540c\u578b\u3067\u3042\u308b\n\n # print(S, T)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":20,"code_v1_loc":37,"code_v0_num_chars":448,"code_v1_num_chars":1064,"code_v0_no_empty_lines":"def main():\n from string import ascii_lowercase\n\n dic = {i: s for i, s in enumerate(ascii_lowercase)}\n N = int(input())\n ans = []\n\n def dfs(s, mx):\n if len(s) == N:\n ans.append(s)\n return\n else:\n for i in range(mx + 2):\n mx = max(mx, i)\n dfs(s + dic[i], mx)\n\n dfs(\"a\", 0)\n print(*ans, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n from string import ascii_lowercase\n\n N = int(eval(input()))\n ascii_dic = {i: a for i, a in enumerate(ascii_lowercase)}\n ascii_rdic = {a: i for i, a in enumerate(ascii_lowercase)}\n # ans = []\n def dfs(A):\n if len(A) == N:\n # ans.append(\"\".join(A))\n print((\"\".join(A)))\n return\n if not A:\n dfs([\"a\"])\n else:\n s = max(ascii_rdic[a] for a in A)\n for i in range(s + 2):\n dfs(A + [ascii_dic[i]])\n\n dfs([])\n # for i in range(len(ans)):\n # for j in range(i+1, len(ans)):\n # S = ans[i]\n # T = ans[j]\n # same = True # \u540c\u578b\u3067\u3042\u308b\n # for k in range(N):\n # for m in range(k, N):\n # if not ((S[k] == S[m] and T[k] == T[m]) or\n # (S[k] != S[m] and T[k] != T[m])):\n # same = False\n # if same: # \u540c\u578b\u3067\u3042\u308b\n # print(S, T)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":45.9459459459,"diff":["- dic = {i: s for i, s in enumerate(ascii_lowercase)}","- N = int(input())","- ans = []","+ N = int(eval(input()))","+ ascii_dic = {i: a for i, a in enumerate(ascii_lowercase)}","+ ascii_rdic = {a: i for i, a in enumerate(ascii_lowercase)}","+ # ans = []","+ def dfs(A):","+ if len(A) == N:","+ # ans.append(\"\".join(A))","+ print((\"\".join(A)))","+ return","+ if not A:","+ dfs([\"a\"])","+ else:","+ s = max(ascii_rdic[a] for a in A)","+ for i in range(s + 2):","+ dfs(A + [ascii_dic[i]])","- def dfs(s, mx):","- if len(s) == N:","- ans.append(s)","- return","- else:","- for i in range(mx + 2):","- mx = max(mx, i)","- dfs(s + dic[i], mx)","-","- dfs(\"a\", 0)","- print(*ans, sep=\"\\n\")","+ dfs([])","+ # for i in range(len(ans)):","+ # for j in range(i+1, len(ans)):","+ # S = ans[i]","+ # T = ans[j]","+ # same = True # \u540c\u578b\u3067\u3042\u308b","+ # for k in range(N):","+ # for m in range(k, N):","+ # if not ((S[k] == S[m] and T[k] == T[m]) or","+ # (S[k] != S[m] and T[k] != T[m])):","+ # same = False","+ # if same: # \u540c\u578b\u3067\u3042\u308b","+ # print(S, T)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0439408898,"measured_runtime_v1":0.0676887731,"runtime_lift":0.6491606781,"key":["s125220362","s882894416"]} +{"user_id":"u393486651","problem_id":"p02696","language":"python","submission_id_v0":"s237897142","submission_id_v1":"s014061882","cpu_time_v0":24,"cpu_time_v1":21,"memory_v0":9116,"memory_v1":9016,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"import math\n\nA,B,N = list(map(int, input().split()))\n\n\n\n\n\nif(N < B):\n\n print((math.floor(A * N \/ B) - A * math.floor(N \/ B)))\n\nelse:\n\n print((math.floor(A * (B-1) \/ B) - A * math.floor((B-1) \/ B)))","target":"import math\n\nA,B,N = list(map(int, input().split()))\n\n\n\nx = min(N, B-1)\n\n\n\nprint((math.floor(A * x \/ B) - A * math.floor(x \/ B)))","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":195,"code_v1_num_chars":127,"code_v0_no_empty_lines":"import math\n\nA, B, N = list(map(int, input().split()))\nif N < B:\n print((math.floor(A * N \/ B) - A * math.floor(N \/ B)))\nelse:\n print((math.floor(A * (B - 1) \/ B) - A * math.floor((B - 1) \/ B)))\n","code_v1_no_empty_lines":"import math\n\nA, B, N = list(map(int, input().split()))\nx = min(N, B - 1)\nprint((math.floor(A * x \/ B) - A * math.floor(x \/ B)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-if N < B:","- print((math.floor(A * N \/ B) - A * math.floor(N \/ B)))","-else:","- print((math.floor(A * (B - 1) \/ B) - A * math.floor((B - 1) \/ B)))","+x = min(N, B - 1)","+print((math.floor(A * x \/ B) - A * math.floor(x \/ B)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1086735614,"measured_runtime_v1":0.0403781374,"runtime_lift":2.6913960947,"key":["s237897142","s014061882"]} +{"user_id":"u753803401","problem_id":"p03037","language":"python","submission_id_v0":"s904988534","submission_id_v1":"s940849199","cpu_time_v0":296,"cpu_time_v1":227,"memory_v0":57052,"memory_v1":4080,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.31,"input":"def slove():\n\n import sys\n\n input = sys.stdin.readline\n\n n, m = list(map(int, input().rstrip('\\n').split()))\n\n lr = [list(map(int, input().rstrip('\\n').split())) for _ in range(m)]\n\n a = [0] * (n + 2)\n\n for l, r in lr:\n\n a[l] += 1\n\n a[r + 1] -= 1\n\n t = 0\n\n cnt = 0\n\n for i in range(1, n + 1):\n\n t += a[i]\n\n if t == m:\n\n cnt += 1\n\n print(cnt)\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n","target":"def slove():\n\n import sys\n\n input = sys.stdin.readline\n\n n, m = list(map(int, input().rstrip('\\n').split()))\n\n x = [0] * (n + 2)\n\n for i in range(m):\n\n l, r = list(map(int, input().rstrip('\\n').split()))\n\n x[l] += 1\n\n x[r+1] -= 1\n\n t = 0\n\n cnt = 0\n\n for i in range(n + 2):\n\n t += x[i]\n\n if t == m:\n\n cnt += 1\n\n print(cnt)\n\n\n\n\n\nif __name__ == '__main__':\n\n slove()\n","code_v0_loc":20,"code_v1_loc":20,"code_v0_num_chars":456,"code_v1_num_chars":440,"code_v0_no_empty_lines":"def slove():\n import sys\n\n input = sys.stdin.readline\n n, m = list(map(int, input().rstrip(\"\\n\").split()))\n lr = [list(map(int, input().rstrip(\"\\n\").split())) for _ in range(m)]\n a = [0] * (n + 2)\n for l, r in lr:\n a[l] += 1\n a[r + 1] -= 1\n t = 0\n cnt = 0\n for i in range(1, n + 1):\n t += a[i]\n if t == m:\n cnt += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n slove()\n","code_v1_no_empty_lines":"def slove():\n import sys\n\n input = sys.stdin.readline\n n, m = list(map(int, input().rstrip(\"\\n\").split()))\n x = [0] * (n + 2)\n for i in range(m):\n l, r = list(map(int, input().rstrip(\"\\n\").split()))\n x[l] += 1\n x[r + 1] -= 1\n t = 0\n cnt = 0\n for i in range(n + 2):\n t += x[i]\n if t == m:\n cnt += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n slove()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- lr = [list(map(int, input().rstrip(\"\\n\").split())) for _ in range(m)]","- a = [0] * (n + 2)","- for l, r in lr:","- a[l] += 1","- a[r + 1] -= 1","+ x = [0] * (n + 2)","+ for i in range(m):","+ l, r = list(map(int, input().rstrip(\"\\n\").split()))","+ x[l] += 1","+ x[r + 1] -= 1","- for i in range(1, n + 1):","- t += a[i]","+ for i in range(n + 2):","+ t += x[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0392873993,"measured_runtime_v1":0.144811306,"runtime_lift":0.2713006351,"key":["s904988534","s940849199"]} +{"user_id":"u729133443","problem_id":"p02741","language":"python","submission_id_v0":"s658144189","submission_id_v1":"s711960463","cpu_time_v0":179,"cpu_time_v1":10,"memory_v0":38256,"memory_v1":2568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.41,"input":"print((b'\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005'[int(eval(input()))%14]))","target":"print(ord('\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005'[eval(input())%14]))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":41,"code_v1_num_chars":39,"code_v0_no_empty_lines":"print((b\"\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005\"[int(eval(input())) % 14]))\n","code_v1_no_empty_lines":"print(ord(\"\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005\"[eval(input()) % 14]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((b\"\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005\"[int(eval(input())) % 14]))","+print(ord(\"\u0004\u0001\u000e 3\u0001\u0002 \u0005 \u000f \u0005\"[eval(input()) % 14]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.076380119,"measured_runtime_v1":0.0353459497,"runtime_lift":2.1609298813,"key":["s658144189","s711960463"]} +{"user_id":"u498487134","problem_id":"p02726","language":"python","submission_id_v0":"s350118777","submission_id_v1":"s662233468","cpu_time_v0":1100,"cpu_time_v1":121,"memory_v0":89180,"memory_v1":74360,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.0,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N,X,Y=MI()\n\n X-=1\n\n Y-=1\n\n \n\n ##########################################\n\n import heapq\n\n class Dijkstra():\n\n \"\"\"\n\n \u30fb\u6709\u5411 \/ \u7121\u5411\u306f\u554f\u308f\u306a\u3044(\u7121\u5411\u306e\u5834\u5408\u306f\uff0c\u9006\u5411\u304d\u306e\u8fba\u3082\u305f\u3059)\n\n \u30fb\u8ca0\u306e\u30b3\u30b9\u30c8\u304c\u306a\u3044\u5834\u5408\u306e\u307f\n\n \u30fb\u8a08\u7b97\u91cf\u306fO(E log|V|)\u3000\n\n \u30fbheap\u3092\u4f7f\u3046\u3053\u3068\u3067\u9802\u70b9\u3092\u8d70\u67fb\u3059\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u308b\uff08\u4ee3\u308f\u308a\u306b\uff0c\u8ddd\u96e2\u66f4\u65b0\u3057\u305f\u3082\u306e\u306f\u78ba\u5b9a\u3067\u306a\u304f\u3068\u3082que\u306b\u5165\u308c\u3066\u304a\u304f\uff09\n\n \"\"\"\n\n \n\n #\u6700\u77ed\u306epath\u3092\u305f\u3059\n\n \n\n \n\n class Edge():\n\n #\u91cd\u307f\u4ed8\u304d\u6709\u5411\u8fba\n\n \n\n def __init__(self, _to, _cost):\n\n self.to =_to\n\n self.cost = _cost\n\n \n\n def __init__(self, V):\n\n #\u5f15\u6570V\u306f\u9802\u70b9\u6570\n\n self.G = [[] for _ in range(V)] #\u96a3\u63a5\u30ea\u30b9\u30c8G[u][i]\u304c\u9802\u70b9u\u306ei\u756a\u76ee\u306e\u8fba\n\n self. _E = 0 #\u8fba\u306e\u6570\n\n self._V = V #\u9802\u70b9\u6570\n\n \n\n #proparty - \u8fba\u306e\u6570\n\n def E(self):\n\n return self._E\n\n \n\n #proparty - \u9802\u70b9\u6570\n\n def V(self):\n\n return self._V\n\n \n\n def add(self, _from, _to, _cost):\n\n #2\u9802\u70b9\u3068\u8fba\u306e\u30b3\u30b9\u30c8\u3092\u8ffd\u52a0\n\n self.G[_from].append(self.Edge(_to,_cost))\n\n self._E +=1\n\n \n\n def add2(self, _from, _to, _cost):\n\n #2\u9802\u70b9\u3068\u8fba\u306e\u30b3\u30b9\u30c8\uff08\u7121\u5411\uff09\u3092\u8ffd\u52a0\n\n self.G[_from].append(self.Edge(_to, _cost))\n\n self.G[_to].append(self.Edge(_from, _cost))\n\n self._E +=1\n\n \n\n def shortest_path(self,s):\n\n #\u59cb\u70b9s\u304b\u3089\u9802\u70b9i\u307e\u3067\u306e\u6700\u77ed\u7d4c\u8def\u9577\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n\n \n\n que = [] #priority queue\n\n d = [float(\"inf\")] * self.V()\n\n prev = [None]*self.V() #prev[j]\u306f\uff0cs\u304b\u3089j\u3078\u6700\u77ed\u7d4c\u8def\u3067\u884c\u304f\u3068\u304d\u306ej\u306e\u4e00\u3064\u524d\u306e\u5834\u6240\n\n d[s] = 0\n\n heapq.heappush(que,(0,s)) #\u59cb\u70b9\u306e\u8ddd\u96e2\u3068\u9802\u70b9\u756a\u53f7\u3092\u30d2\u30fc\u30d7\u306b\u8ffd\u52a0\n\n \n\n while len(que)!=0:\n\n #\u30ad\u30e5\u30fc\u306b\u683c\u7d0d\u3055\u308c\u3066\u3042\u308b\u4e2d\u3067\u4e00\u756a\u30b3\u30b9\u30c8\u304c\u5c0f\u3055\u3044\u9802\u70b9\u3092\u53d6\u308a\u51fa\u3059\n\n cost,v = heapq.heappop(que)\n\n \n\n #\u30ad\u30e5\u30fc\u306b\u683c\u7d0d\u3055\u308c\u305f\u6700\u77ed\u7d4c\u8def\u9577\u5019\u88dc\u304cd\u306e\u8ddd\u96e2\u3088\u308a\u3082\u5927\u304d\u3044\u5834\u5408\u306b\u51e6\u7406\u3092\u30b9\u30ad\u30c3\u30d7\n\n if d[v] < cost:\n\n continue\n\n \n\n #\u9802\u70b9v\u306b\u96a3\u63a5\u3059\u308b\u5404\u9802\u70b9i\u306b\u5bfe\u3057\u3066\uff0cv\u3092\u7d4c\u7531\u3057\u305f\u5834\u5408\u306e\u8ddd\u96e2\u3092\u8a08\u7b97\u3057\u3066\uff0c\u3053\u308c\u304cd[i]\u3088\u308a\u3082\u5c0f\u3055\u3044\u5834\u5408\u306b\u66f4\u65b0\n\n for i in range(len(self.G[v])):\n\n e = self.G[v][i] #v\u306ei\u500b\u76ee\u306e\u96a3\u63a5\u8fba\n\n if d[e.to] > d[v] + e.cost:\n\n d[e.to] = d[v] + e.cost #\u66f4\u65b0\n\n prev[e.to] = v\n\n heapq.heappush(que,(d[e.to],e.to)) #que\u306b\u65b0\u305f\u306a\u6700\u77ed\u7d4c\u8def\u9577\u5019\u88dc\u3092\u8ffd\u52a0\n\n \n\n \n\n return d\n\n ########################\n\n \n\n djk = Dijkstra(N) \n\n for i in range(N-1):\n\n djk.add2(i,i+1,1)\n\n djk.add2(X,Y,1)\n\n \n\n ans=[0]*(N+1)\n\n \n\n for i in range(N):\n\n d=djk.shortest_path(i)\n\n for j in range(N):\n\n ans[d[j]]+=1\n\n \n\n for i in range(N-1):\n\n print((ans[i+1]\/\/2))\n\n \n\n \n\n\n\nmain()\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\ndef main():\n\n mod=10**9+7\n\n N,X,Y=MI()\n\n X-=1\n\n Y-=1\n\n \n\n ans=[0]*N\n\n \n\n for i in range(N):\n\n for j in range(i+1,N):\n\n d=min(j-i,abs(X-i)+1+abs(Y-j))\n\n\n\n \n\n ans[d-1]+=1\n\n \n\n for i in range(N-1):\n\n print((ans[i]))\n\n \n\n\n\n \n\n \n\n\n\nmain()\n","code_v0_loc":105,"code_v1_loc":30,"code_v0_num_chars":2947,"code_v1_num_chars":521,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, X, Y = MI()\n X -= 1\n Y -= 1\n ##########################################\n import heapq\n\n class Dijkstra:\n \"\"\"\n \u30fb\u6709\u5411 \/ \u7121\u5411\u306f\u554f\u308f\u306a\u3044(\u7121\u5411\u306e\u5834\u5408\u306f\uff0c\u9006\u5411\u304d\u306e\u8fba\u3082\u305f\u3059)\n \u30fb\u8ca0\u306e\u30b3\u30b9\u30c8\u304c\u306a\u3044\u5834\u5408\u306e\u307f\n \u30fb\u8a08\u7b97\u91cf\u306fO(E log|V|)\n \u30fbheap\u3092\u4f7f\u3046\u3053\u3068\u3067\u9802\u70b9\u3092\u8d70\u67fb\u3059\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u308b\uff08\u4ee3\u308f\u308a\u306b\uff0c\u8ddd\u96e2\u66f4\u65b0\u3057\u305f\u3082\u306e\u306f\u78ba\u5b9a\u3067\u306a\u304f\u3068\u3082que\u306b\u5165\u308c\u3066\u304a\u304f\uff09\n \"\"\"\n\n # \u6700\u77ed\u306epath\u3092\u305f\u3059\n class Edge:\n # \u91cd\u307f\u4ed8\u304d\u6709\u5411\u8fba\n def __init__(self, _to, _cost):\n self.to = _to\n self.cost = _cost\n\n def __init__(self, V):\n # \u5f15\u6570V\u306f\u9802\u70b9\u6570\n self.G = [[] for _ in range(V)] # \u96a3\u63a5\u30ea\u30b9\u30c8G[u][i]\u304c\u9802\u70b9u\u306ei\u756a\u76ee\u306e\u8fba\n self._E = 0 # \u8fba\u306e\u6570\n self._V = V # \u9802\u70b9\u6570\n\n # proparty - \u8fba\u306e\u6570\n def E(self):\n return self._E\n\n # proparty - \u9802\u70b9\u6570\n def V(self):\n return self._V\n\n def add(self, _from, _to, _cost):\n # 2\u9802\u70b9\u3068\u8fba\u306e\u30b3\u30b9\u30c8\u3092\u8ffd\u52a0\n self.G[_from].append(self.Edge(_to, _cost))\n self._E += 1\n\n def add2(self, _from, _to, _cost):\n # 2\u9802\u70b9\u3068\u8fba\u306e\u30b3\u30b9\u30c8\uff08\u7121\u5411\uff09\u3092\u8ffd\u52a0\n self.G[_from].append(self.Edge(_to, _cost))\n self.G[_to].append(self.Edge(_from, _cost))\n self._E += 1\n\n def shortest_path(self, s):\n # \u59cb\u70b9s\u304b\u3089\u9802\u70b9i\u307e\u3067\u306e\u6700\u77ed\u7d4c\u8def\u9577\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n que = [] # priority queue\n d = [float(\"inf\")] * self.V()\n prev = [None] * self.V() # prev[j]\u306f\uff0cs\u304b\u3089j\u3078\u6700\u77ed\u7d4c\u8def\u3067\u884c\u304f\u3068\u304d\u306ej\u306e\u4e00\u3064\u524d\u306e\u5834\u6240\n d[s] = 0\n heapq.heappush(que, (0, s)) # \u59cb\u70b9\u306e\u8ddd\u96e2\u3068\u9802\u70b9\u756a\u53f7\u3092\u30d2\u30fc\u30d7\u306b\u8ffd\u52a0\n while len(que) != 0:\n # \u30ad\u30e5\u30fc\u306b\u683c\u7d0d\u3055\u308c\u3066\u3042\u308b\u4e2d\u3067\u4e00\u756a\u30b3\u30b9\u30c8\u304c\u5c0f\u3055\u3044\u9802\u70b9\u3092\u53d6\u308a\u51fa\u3059\n cost, v = heapq.heappop(que)\n # \u30ad\u30e5\u30fc\u306b\u683c\u7d0d\u3055\u308c\u305f\u6700\u77ed\u7d4c\u8def\u9577\u5019\u88dc\u304cd\u306e\u8ddd\u96e2\u3088\u308a\u3082\u5927\u304d\u3044\u5834\u5408\u306b\u51e6\u7406\u3092\u30b9\u30ad\u30c3\u30d7\n if d[v] < cost:\n continue\n # \u9802\u70b9v\u306b\u96a3\u63a5\u3059\u308b\u5404\u9802\u70b9i\u306b\u5bfe\u3057\u3066\uff0cv\u3092\u7d4c\u7531\u3057\u305f\u5834\u5408\u306e\u8ddd\u96e2\u3092\u8a08\u7b97\u3057\u3066\uff0c\u3053\u308c\u304cd[i]\u3088\u308a\u3082\u5c0f\u3055\u3044\u5834\u5408\u306b\u66f4\u65b0\n for i in range(len(self.G[v])):\n e = self.G[v][i] # v\u306ei\u500b\u76ee\u306e\u96a3\u63a5\u8fba\n if d[e.to] > d[v] + e.cost:\n d[e.to] = d[v] + e.cost # \u66f4\u65b0\n prev[e.to] = v\n heapq.heappush(que, (d[e.to], e.to)) # que\u306b\u65b0\u305f\u306a\u6700\u77ed\u7d4c\u8def\u9577\u5019\u88dc\u3092\u8ffd\u52a0\n return d\n\n ########################\n djk = Dijkstra(N)\n for i in range(N - 1):\n djk.add2(i, i + 1, 1)\n djk.add2(X, Y, 1)\n ans = [0] * (N + 1)\n for i in range(N):\n d = djk.shortest_path(i)\n for j in range(N):\n ans[d[j]] += 1\n for i in range(N - 1):\n print((ans[i + 1] \/\/ 2))\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\ndef main():\n mod = 10**9 + 7\n N, X, Y = MI()\n X -= 1\n Y -= 1\n ans = [0] * N\n for i in range(N):\n for j in range(i + 1, N):\n d = min(j - i, abs(X - i) + 1 + abs(Y - j))\n ans[d - 1] += 1\n for i in range(N - 1):\n print((ans[i]))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":71.4285714286,"diff":["- ##########################################","- import heapq","-","- class Dijkstra:","- \"\"\"","- \u30fb\u6709\u5411 \/ \u7121\u5411\u306f\u554f\u308f\u306a\u3044(\u7121\u5411\u306e\u5834\u5408\u306f\uff0c\u9006\u5411\u304d\u306e\u8fba\u3082\u305f\u3059)","- \u30fb\u8ca0\u306e\u30b3\u30b9\u30c8\u304c\u306a\u3044\u5834\u5408\u306e\u307f","- \u30fb\u8a08\u7b97\u91cf\u306fO(E log|V|)","- \u30fbheap\u3092\u4f7f\u3046\u3053\u3068\u3067\u9802\u70b9\u3092\u8d70\u67fb\u3059\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u308b\uff08\u4ee3\u308f\u308a\u306b\uff0c\u8ddd\u96e2\u66f4\u65b0\u3057\u305f\u3082\u306e\u306f\u78ba\u5b9a\u3067\u306a\u304f\u3068\u3082que\u306b\u5165\u308c\u3066\u304a\u304f\uff09","- \"\"\"","-","- # \u6700\u77ed\u306epath\u3092\u305f\u3059","- class Edge:","- # \u91cd\u307f\u4ed8\u304d\u6709\u5411\u8fba","- def __init__(self, _to, _cost):","- self.to = _to","- self.cost = _cost","-","- def __init__(self, V):","- # \u5f15\u6570V\u306f\u9802\u70b9\u6570","- self.G = [[] for _ in range(V)] # \u96a3\u63a5\u30ea\u30b9\u30c8G[u][i]\u304c\u9802\u70b9u\u306ei\u756a\u76ee\u306e\u8fba","- self._E = 0 # \u8fba\u306e\u6570","- self._V = V # \u9802\u70b9\u6570","-","- # proparty - \u8fba\u306e\u6570","- def E(self):","- return self._E","-","- # proparty - \u9802\u70b9\u6570","- def V(self):","- return self._V","-","- def add(self, _from, _to, _cost):","- # 2\u9802\u70b9\u3068\u8fba\u306e\u30b3\u30b9\u30c8\u3092\u8ffd\u52a0","- self.G[_from].append(self.Edge(_to, _cost))","- self._E += 1","-","- def add2(self, _from, _to, _cost):","- # 2\u9802\u70b9\u3068\u8fba\u306e\u30b3\u30b9\u30c8\uff08\u7121\u5411\uff09\u3092\u8ffd\u52a0","- self.G[_from].append(self.Edge(_to, _cost))","- self.G[_to].append(self.Edge(_from, _cost))","- self._E += 1","-","- def shortest_path(self, s):","- # \u59cb\u70b9s\u304b\u3089\u9802\u70b9i\u307e\u3067\u306e\u6700\u77ed\u7d4c\u8def\u9577\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059","- que = [] # priority queue","- d = [float(\"inf\")] * self.V()","- prev = [None] * self.V() # prev[j]\u306f\uff0cs\u304b\u3089j\u3078\u6700\u77ed\u7d4c\u8def\u3067\u884c\u304f\u3068\u304d\u306ej\u306e\u4e00\u3064\u524d\u306e\u5834\u6240","- d[s] = 0","- heapq.heappush(que, (0, s)) # \u59cb\u70b9\u306e\u8ddd\u96e2\u3068\u9802\u70b9\u756a\u53f7\u3092\u30d2\u30fc\u30d7\u306b\u8ffd\u52a0","- while len(que) != 0:","- # \u30ad\u30e5\u30fc\u306b\u683c\u7d0d\u3055\u308c\u3066\u3042\u308b\u4e2d\u3067\u4e00\u756a\u30b3\u30b9\u30c8\u304c\u5c0f\u3055\u3044\u9802\u70b9\u3092\u53d6\u308a\u51fa\u3059","- cost, v = heapq.heappop(que)","- # \u30ad\u30e5\u30fc\u306b\u683c\u7d0d\u3055\u308c\u305f\u6700\u77ed\u7d4c\u8def\u9577\u5019\u88dc\u304cd\u306e\u8ddd\u96e2\u3088\u308a\u3082\u5927\u304d\u3044\u5834\u5408\u306b\u51e6\u7406\u3092\u30b9\u30ad\u30c3\u30d7","- if d[v] < cost:","- continue","- # \u9802\u70b9v\u306b\u96a3\u63a5\u3059\u308b\u5404\u9802\u70b9i\u306b\u5bfe\u3057\u3066\uff0cv\u3092\u7d4c\u7531\u3057\u305f\u5834\u5408\u306e\u8ddd\u96e2\u3092\u8a08\u7b97\u3057\u3066\uff0c\u3053\u308c\u304cd[i]\u3088\u308a\u3082\u5c0f\u3055\u3044\u5834\u5408\u306b\u66f4\u65b0","- for i in range(len(self.G[v])):","- e = self.G[v][i] # v\u306ei\u500b\u76ee\u306e\u96a3\u63a5\u8fba","- if d[e.to] > d[v] + e.cost:","- d[e.to] = d[v] + e.cost # \u66f4\u65b0","- prev[e.to] = v","- heapq.heappush(que, (d[e.to], e.to)) # que\u306b\u65b0\u305f\u306a\u6700\u77ed\u7d4c\u8def\u9577\u5019\u88dc\u3092\u8ffd\u52a0","- return d","-","- ########################","- djk = Dijkstra(N)","+ ans = [0] * N","+ for i in range(N):","+ for j in range(i + 1, N):","+ d = min(j - i, abs(X - i) + 1 + abs(Y - j))","+ ans[d - 1] += 1","- djk.add2(i, i + 1, 1)","- djk.add2(X, Y, 1)","- ans = [0] * (N + 1)","- for i in range(N):","- d = djk.shortest_path(i)","- for j in range(N):","- ans[d[j]] += 1","- for i in range(N - 1):","- print((ans[i + 1] \/\/ 2))","+ print((ans[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0478950541,"measured_runtime_v1":0.0372489607,"runtime_lift":1.2858091379,"key":["s350118777","s662233468"]} +{"user_id":"u885634168","problem_id":"p02642","language":"python","submission_id_v0":"s577645304","submission_id_v1":"s017652823","cpu_time_v0":182,"cpu_time_v1":162,"memory_v0":195464,"memory_v1":171208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.99,"input":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nma = max(A)\n\nEr = [0 for _ in range(ma + 5)]\n\n\n\nfor i in range(N):\n\n temp = A[i]\n\n if Er[temp] != 2:\n\n a = 0\n\n while(1):\n\n a += 1\n\n tt = a * temp\n\n if tt >= ma + 5:\n\n break\n\n Er[tt] += 1\n\n \n\nans = 0\n\nfor i in range(N):\n\n temp = A[i]\n\n if Er[temp] == 1: ans += 1\n\n \n\nprint(ans)","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nma = max(A)\n\nl = [0 for _ in range(ma + 10)]\n\nfor i in range(N):\n\n temp = A[i]\n\n while(temp <= ma + 5):\n\n l[temp] += 1\n\n temp += A[i]\n\nans = 0\n\nfor i in range(N):\n\n if l[A[i]] == 1: ans += 1\n\nprint(ans)","code_v0_loc":23,"code_v1_loc":13,"code_v0_num_chars":432,"code_v1_num_chars":280,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nma = max(A)\nEr = [0 for _ in range(ma + 5)]\nfor i in range(N):\n temp = A[i]\n if Er[temp] != 2:\n a = 0\n while 1:\n a += 1\n tt = a * temp\n if tt >= ma + 5:\n break\n Er[tt] += 1\nans = 0\nfor i in range(N):\n temp = A[i]\n if Er[temp] == 1:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nma = max(A)\nl = [0 for _ in range(ma + 10)]\nfor i in range(N):\n temp = A[i]\n while temp <= ma + 5:\n l[temp] += 1\n temp += A[i]\nans = 0\nfor i in range(N):\n if l[A[i]] == 1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":43.4782608696,"diff":["-Er = [0 for _ in range(ma + 5)]","+l = [0 for _ in range(ma + 10)]","- if Er[temp] != 2:","- a = 0","- while 1:","- a += 1","- tt = a * temp","- if tt >= ma + 5:","- break","- Er[tt] += 1","+ while temp <= ma + 5:","+ l[temp] += 1","+ temp += A[i]","- temp = A[i]","- if Er[temp] == 1:","+ if l[A[i]] == 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0429084027,"measured_runtime_v1":0.1401025798,"runtime_lift":0.3062641868,"key":["s577645304","s017652823"]} +{"user_id":"u729133443","problem_id":"p03211","language":"python","submission_id_v0":"s206926785","submission_id_v1":"s625176094","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"s=eval(input());print((min(abs(int('0'+s[i:i+3])-753)for i in range(9))))","target":"s=eval(input());print((min(abs(eval(s[i:i+3]+'-753'))for i in range(9))))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":65,"code_v1_num_chars":65,"code_v0_no_empty_lines":"s = eval(input())\nprint((min(abs(int(\"0\" + s[i : i + 3]) - 753) for i in range(9))))\n","code_v1_no_empty_lines":"s = eval(input())\nprint((min(abs(eval(s[i : i + 3] + \"-753\")) for i in range(9))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((min(abs(int(\"0\" + s[i : i + 3]) - 753) for i in range(9))))","+print((min(abs(eval(s[i : i + 3] + \"-753\")) for i in range(9))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0736543748,"measured_runtime_v1":0.0489522626,"runtime_lift":1.5046163517,"key":["s206926785","s625176094"]} +{"user_id":"u583507988","problem_id":"p03037","language":"python","submission_id_v0":"s002523650","submission_id_v1":"s799804353","cpu_time_v0":317,"cpu_time_v1":219,"memory_v0":3060,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.91,"input":"n, m = list(map(int, input().split()))\n\n\n\na=0\n\nb=n\n\nfor i in range(m):\n\n l, r = list(map(int, input().split()))\n\n a = max(a, l)\n\n b = min(b, r)\n\nif b-a+1 >= 0:\n\n print((b-a+1))\n\nelse:\n\n print((0))","target":"n, m = list(map(int, input().split()))\n\nl = 1\n\nr = 10**5\n\nfor _ in range(m):\n\n l_, r_ = list(map(int, input().split()))\n\n l = max(l, l_)\n\n r = min(r, r_)\n\n \n\nif r>=l:\n\n print((r-l+1))\n\nelse:\n\n print((0))","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":185,"code_v1_num_chars":193,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\na = 0\nb = n\nfor i in range(m):\n l, r = list(map(int, input().split()))\n a = max(a, l)\n b = min(b, r)\nif b - a + 1 >= 0:\n print((b - a + 1))\nelse:\n print((0))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nl = 1\nr = 10**5\nfor _ in range(m):\n l_, r_ = list(map(int, input().split()))\n l = max(l, l_)\n r = min(r, r_)\nif r >= l:\n print((r - l + 1))\nelse:\n print((0))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a = 0","-b = n","-for i in range(m):","- l, r = list(map(int, input().split()))","- a = max(a, l)","- b = min(b, r)","-if b - a + 1 >= 0:","- print((b - a + 1))","+l = 1","+r = 10**5","+for _ in range(m):","+ l_, r_ = list(map(int, input().split()))","+ l = max(l, l_)","+ r = min(r, r_)","+if r >= l:","+ print((r - l + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409112582,"measured_runtime_v1":0.0410221732,"runtime_lift":0.9972962194,"key":["s002523650","s799804353"]} +{"user_id":"u257974487","problem_id":"p02623","language":"python","submission_id_v0":"s538427367","submission_id_v1":"s016723761","cpu_time_v0":452,"cpu_time_v1":275,"memory_v0":40804,"memory_v1":40404,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.16,"input":"n, m, k = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\n\n\ntotal = 0\n\ncount = 0\n\nflag = n-1\n\nfor i in range(n):\n\n total += a[i]\n\n if total > k:\n\n total -= a[i]\n\n flag = i-1\n\n break\n\n count += 1\n\nans = count\n\nfor i in range(m):\n\n if b[i] > k:\n\n break\n\n total += b[i]\n\n count += 1\n\n while total > k:\n\n if flag == -1:\n\n break\n\n else:\n\n total -= a[flag]\n\n flag -= 1\n\n count -= 1\n\n if total > k: \n\n break\n\n ans = max(ans, count)\n\n\n\ntotal = 0\n\ncount = 0\n\nflag = m-1\n\nfor i in range(m):\n\n total += b[i]\n\n if total > k:\n\n total -= b[i]\n\n flag = i-1\n\n break\n\n count += 1\n\nfor i in range(n):\n\n if a[i] > k:\n\n break\n\n total += a[i]\n\n count += 1\n\n while total > k:\n\n if flag == -1:\n\n break\n\n else:\n\n total -= b[flag]\n\n flag -= 1\n\n count -= 1\n\n if total > k: \n\n break\n\n ans = max(ans, count)\n\n\n\n\n\nprint(ans)","target":"n, m, k = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\n\n\ntotal = 0\n\ncount = 0\n\nflag = n-1\n\nfor i in range(n):\n\n total += a[i]\n\n if total > k:\n\n total -= a[i]\n\n flag = i-1\n\n break\n\n count += 1\n\nans = count\n\nfor i in range(m):\n\n if b[i] > k:\n\n break\n\n total += b[i]\n\n count += 1\n\n while total > k:\n\n if flag == -1:\n\n break\n\n else:\n\n total -= a[flag]\n\n flag -= 1\n\n count -= 1\n\n if total > k: \n\n break\n\n ans = max(ans, count)\n\n\n\nprint(ans)","code_v0_loc":59,"code_v1_loc":32,"code_v0_num_chars":1085,"code_v1_num_chars":608,"code_v0_no_empty_lines":"n, m, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\ntotal = 0\ncount = 0\nflag = n - 1\nfor i in range(n):\n total += a[i]\n if total > k:\n total -= a[i]\n flag = i - 1\n break\n count += 1\nans = count\nfor i in range(m):\n if b[i] > k:\n break\n total += b[i]\n count += 1\n while total > k:\n if flag == -1:\n break\n else:\n total -= a[flag]\n flag -= 1\n count -= 1\n if total > k:\n break\n ans = max(ans, count)\ntotal = 0\ncount = 0\nflag = m - 1\nfor i in range(m):\n total += b[i]\n if total > k:\n total -= b[i]\n flag = i - 1\n break\n count += 1\nfor i in range(n):\n if a[i] > k:\n break\n total += a[i]\n count += 1\n while total > k:\n if flag == -1:\n break\n else:\n total -= b[flag]\n flag -= 1\n count -= 1\n if total > k:\n break\n ans = max(ans, count)\nprint(ans)\n","code_v1_no_empty_lines":"n, m, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\ntotal = 0\ncount = 0\nflag = n - 1\nfor i in range(n):\n total += a[i]\n if total > k:\n total -= a[i]\n flag = i - 1\n break\n count += 1\nans = count\nfor i in range(m):\n if b[i] > k:\n break\n total += b[i]\n count += 1\n while total > k:\n if flag == -1:\n break\n else:\n total -= a[flag]\n flag -= 1\n count -= 1\n if total > k:\n break\n ans = max(ans, count)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":45.7627118644,"diff":["-total = 0","-count = 0","-flag = m - 1","-for i in range(m):","- total += b[i]","- if total > k:","- total -= b[i]","- flag = i - 1","- break","- count += 1","-for i in range(n):","- if a[i] > k:","- break","- total += a[i]","- count += 1","- while total > k:","- if flag == -1:","- break","- else:","- total -= b[flag]","- flag -= 1","- count -= 1","- if total > k:","- break","- ans = max(ans, count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.047921663,"measured_runtime_v1":0.0487226377,"runtime_lift":0.9835605243,"key":["s538427367","s016723761"]} +{"user_id":"u693391925","problem_id":"p02727","language":"python","submission_id_v0":"s956035761","submission_id_v1":"s778158470","cpu_time_v0":300,"cpu_time_v1":233,"memory_v0":22560,"memory_v1":23328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.33,"input":"x, y, a, b, c = list(map(int, input().split()))\n\narrayP = list(map(int, input().split()))\n\narrayQ = list(map(int, input().split()))\n\narrayR = list(map(int, input().split()))\n\narrayP.sort(reverse=True)\n\narrayQ.sort(reverse=True)\n\narrayR.sort(reverse=True)\n\narrayAns = []\n\nfor i in range(x):\n\n arrayAns.append(int(arrayP[i]))\n\nfor i in range(y):\n\n arrayAns.append(int(arrayQ[i]))\n\narrayAns.sort()\n\nfor i in range(min(len(arrayR), len(arrayAns))):\n\n if arrayAns[i] <= int(arrayR[i]):\n\n arrayAns[i] = int(arrayR[i])\n\n else:\n\n break\n\nprint((sum(arrayAns)))","target":"X,Y,A,B,C = list(map(int, input().split()))\n\n\n\np = list(map(int, input().split()))\n\nq = list(map(int, input().split()))\n\nr = list(map(int, input().split()))\n\n\n\np.sort(reverse=True)\n\nq.sort(reverse=True)\n\n\n\nhoge=p[:X]+q[:Y]+r\n\nhoge.sort(reverse=True)\n\nprint((sum(hoge[:X+Y])))\n\n\n\n\n","code_v0_loc":19,"code_v1_loc":14,"code_v0_num_chars":569,"code_v1_num_chars":272,"code_v0_no_empty_lines":"x, y, a, b, c = list(map(int, input().split()))\narrayP = list(map(int, input().split()))\narrayQ = list(map(int, input().split()))\narrayR = list(map(int, input().split()))\narrayP.sort(reverse=True)\narrayQ.sort(reverse=True)\narrayR.sort(reverse=True)\narrayAns = []\nfor i in range(x):\n arrayAns.append(int(arrayP[i]))\nfor i in range(y):\n arrayAns.append(int(arrayQ[i]))\narrayAns.sort()\nfor i in range(min(len(arrayR), len(arrayAns))):\n if arrayAns[i] <= int(arrayR[i]):\n arrayAns[i] = int(arrayR[i])\n else:\n break\nprint((sum(arrayAns)))\n","code_v1_no_empty_lines":"X, Y, A, B, C = list(map(int, input().split()))\np = list(map(int, input().split()))\nq = list(map(int, input().split()))\nr = list(map(int, input().split()))\np.sort(reverse=True)\nq.sort(reverse=True)\nhoge = p[:X] + q[:Y] + r\nhoge.sort(reverse=True)\nprint((sum(hoge[: X + Y])))\n","code_same":false,"relative_loc_diff_percent":26.3157894737,"diff":["-x, y, a, b, c = list(map(int, input().split()))","-arrayP = list(map(int, input().split()))","-arrayQ = list(map(int, input().split()))","-arrayR = list(map(int, input().split()))","-arrayP.sort(reverse=True)","-arrayQ.sort(reverse=True)","-arrayR.sort(reverse=True)","-arrayAns = []","-for i in range(x):","- arrayAns.append(int(arrayP[i]))","-for i in range(y):","- arrayAns.append(int(arrayQ[i]))","-arrayAns.sort()","-for i in range(min(len(arrayR), len(arrayAns))):","- if arrayAns[i] <= int(arrayR[i]):","- arrayAns[i] = int(arrayR[i])","- else:","- break","-print((sum(arrayAns)))","+X, Y, A, B, C = list(map(int, input().split()))","+p = list(map(int, input().split()))","+q = list(map(int, input().split()))","+r = list(map(int, input().split()))","+p.sort(reverse=True)","+q.sort(reverse=True)","+hoge = p[:X] + q[:Y] + r","+hoge.sort(reverse=True)","+print((sum(hoge[: X + Y])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0844536145,"measured_runtime_v1":0.0448362398,"runtime_lift":1.8836016313,"key":["s956035761","s778158470"]} +{"user_id":"u764600134","problem_id":"p03161","language":"python","submission_id_v0":"s698140173","submission_id_v1":"s090584853","cpu_time_v0":455,"cpu_time_v1":361,"memory_v0":55392,"memory_v1":53216,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.66,"input":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nB - Frog 2\n\nhttps:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_b\n\nAC\n\n\"\"\"\n\nimport sys\n\nfrom sys import stdin\n\n\n\n\n\ndef solve(ashiba, N, K):\n\n dp = [float('inf')] * N\n\n dp[0] = 0\n\n for i in range(1, len(ashiba)):\n\n paths = [dp[j]+abs(ashiba[j]-ashiba[i]) for j in range(max(0, i-K), i)]\n\n dp[i] = min(paths)\n\n return dp[-1]\n\n\n\n\n\ndef main(args):\n\n N, K = list(map(int, input().split()))\n\n ashiba = [int(i) for i in input().split()]\n\n ans = solve(ashiba, N, K)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main(sys.argv[1:])\n","target":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\n\n\n\n\n\"\"\"\n\n\n\n\n\ndef chmin(i, j):\n\n a, b = dp[i+j], dp[i]+abs(h[i]-h[i+j])\n\n if a > b:\n\n dp[i+j] = b\n\n\n\n\n\nn, k = list(map(int, (input().split())))\n\nh = list(input().split())\n\nh = [int(i) for i in h]\n\ndp = [10**10]*n\n\ndp[0] = 0\n\nfor i in range(0, n):\n\n for j in range(1, k+1):\n\n if i+j < n:\n\n chmin(i, j)\n\nprint((dp[n-1]))","code_v0_loc":28,"code_v1_loc":23,"code_v0_num_chars":577,"code_v1_num_chars":373,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nB - Frog 2\nhttps:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_b\nAC\n\"\"\"\nimport sys\nfrom sys import stdin\n\n\ndef solve(ashiba, N, K):\n dp = [float(\"inf\")] * N\n dp[0] = 0\n for i in range(1, len(ashiba)):\n paths = [dp[j] + abs(ashiba[j] - ashiba[i]) for j in range(max(0, i - K), i)]\n dp[i] = min(paths)\n return dp[-1]\n\n\ndef main(args):\n N, K = list(map(int, input().split()))\n ashiba = [int(i) for i in input().split()]\n ans = solve(ashiba, N, K)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main(sys.argv[1:])\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\n\"\"\"\n\n\ndef chmin(i, j):\n a, b = dp[i + j], dp[i] + abs(h[i] - h[i + j])\n if a > b:\n dp[i + j] = b\n\n\nn, k = list(map(int, (input().split())))\nh = list(input().split())\nh = [int(i) for i in h]\ndp = [10**10] * n\ndp[0] = 0\nfor i in range(0, n):\n for j in range(1, k + 1):\n if i + j < n:\n chmin(i, j)\nprint((dp[n - 1]))\n","code_same":false,"relative_loc_diff_percent":17.8571428571,"diff":["-B - Frog 2","-https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_b","-AC","-import sys","-from sys import stdin","-def solve(ashiba, N, K):","- dp = [float(\"inf\")] * N","- dp[0] = 0","- for i in range(1, len(ashiba)):","- paths = [dp[j] + abs(ashiba[j] - ashiba[i]) for j in range(max(0, i - K), i)]","- dp[i] = min(paths)","- return dp[-1]","+def chmin(i, j):","+ a, b = dp[i + j], dp[i] + abs(h[i] - h[i + j])","+ if a > b:","+ dp[i + j] = b","-def main(args):","- N, K = list(map(int, input().split()))","- ashiba = [int(i) for i in input().split()]","- ans = solve(ashiba, N, K)","- print(ans)","-","-","-if __name__ == \"__main__\":","- main(sys.argv[1:])","+n, k = list(map(int, (input().split())))","+h = list(input().split())","+h = [int(i) for i in h]","+dp = [10**10] * n","+dp[0] = 0","+for i in range(0, n):","+ for j in range(1, k + 1):","+ if i + j < n:","+ chmin(i, j)","+print((dp[n - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0418059528,"measured_runtime_v1":0.036513556,"runtime_lift":1.1449433403,"key":["s698140173","s090584853"]} +{"user_id":"u201856486","problem_id":"p03286","language":"python","submission_id_v0":"s740196550","submission_id_v1":"s652454700","cpu_time_v0":657,"cpu_time_v1":19,"memory_v0":25920,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":97.11,"input":"# coding: utf-8\n\nimport sys\n\nimport bisect\n\n\n\n\n\n\"\"\"Template\"\"\"\n\n\n\n\n\nclass IP:\n\n \"\"\"\n\n \u5165\u529b\u3092\u53d6\u5f97\u3059\u308b\u30af\u30e9\u30b9\n\n \"\"\"\n\n def __init__(self):\n\n self.input = sys.stdin.readline\n\n\n\n def I(self):\n\n \"\"\"\n\n 1\u6587\u5b57\u306e\u53d6\u5f97\u306b\u4f7f\u3044\u307e\u3059\n\n :return: \u6570\n\n \"\"\"\n\n return int(eval(input()))\n\n\n\n def IL(self):\n\n \"\"\"\n\n 1\u884c\u3092\u7a7a\u767d\u3067\u533a\u5207\u308a\u30ea\u30b9\u30c8\u306b\u3057\u307e\u3059(int\n\n :return: \u30ea\u30b9\u30c8\n\n \"\"\"\n\n return list(map(int, self.input().split()))\n\n\n\n def SL(self):\n\n \"\"\"\n\n 1\u884c\u306e\u6587\u5b57\u5217\u3092\u7a7a\u767d\u533a\u5207\u308a\u3067\u30ea\u30b9\u30c8\u306b\u3057\u307e\u3059\n\n :return: \u30ea\u30b9\u30c8\n\n \"\"\"\n\n return list(map(str, self.input().split()))\n\n\n\n def ILS(self, n):\n\n \"\"\"\n\n 1\u5217\u4e38\u3005\u53d6\u5f97\u3057\u307e\u3059(int\n\n :param n: \u884c\u6570\n\n :return: \u30ea\u30b9\u30c8\n\n \"\"\"\n\n return [int(self.input()) for _ in range(n)]\n\n\n\n def SLS(self, n):\n\n \"\"\"\n\n 1\u5217\u4e38\u3005\u53d6\u5f97\u3057\u307e\u3059\uff08str\n\n :param n: \u884c\u6570\n\n :return: \u30ea\u30b9\u30c8\n\n \"\"\"\n\n return [self.input() for _ in range(n)]\n\n\n\n\n\nclass Idea:\n\n def __init__(self):\n\n pass\n\n\n\n def HF(self, p):\n\n \"\"\"\n\n Half enumeration\n\n \u534a\u5206\u5168\u5217\u6319\u3067\u3059\n\n p\u306e\u8981\u7d20\u306e\u548c\u306e\u7d44\u307f\u5408\u308f\u305b\u3092\u4f5c\u308a\u307e\u3059\u3002\n\n \u30bd\u30fc\u30c8\u3001\u91cd\u8907\u524a\u9664\u884c\u3044\u307e\u3059\n\n :param p: list : \u5143\u3068\u306a\u308b\u30ea\u30b9\u30c8\n\n :return: list : \u7d44\u307f\u5408\u308f\u305b\u3089\u308c\u305f\u548c\u306e\u30ea\u30b9\u30c8\n\n \"\"\"\n\n return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))\n\n\n\n def Bfs2(self, a):\n\n \"\"\"\n\n bit_full_search2\n\n bit\u5168\u63a2\u7d22\u306e\u6539\u826f\u7248\n\n \u5168\u63a2\u7d22\u3055\u305b\u305f\u30892\u9032\u6570\u306e\u30ea\u30b9\u30c8\u306810\u9032\u6570\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n\n :return: list\uff12\u3064 : \uff11\u500b\u76ee 2\u9032\u6570(16\u6841) 2\u500b\u76ee 10\u9032\u6570\u3067\u5408\u8a08\n\n \"\"\"\n\n # \u53c2\u8003\n\n # https:\/\/blog.rossywhite.com\/2018\/08\/06\/bit-search\/\n\n # https:\/\/atcoder.jp\/contests\/abc105\/submissions\/4088632\n\n value = []\n\n for i in range(1 << len(a)):\n\n output = []\n\n\n\n for j in range(len(a)):\n\n if ((i >> j) & 1) == 1:\n\n \"\"\"\u53f3\u304b\u3089j+1\u756a\u76ee\u306ei\u304c1\u304b\u3069\u3046\u304b\u5224\u5b9a\"\"\"\n\n # output.append(a[j])\n\n output.append(a[j])\n\n value.append([format(i, 'b').zfill(16), sum(output)])\n\n\n\n value.sort(key=lambda x: x[1])\n\n bin = [value[k][0] for k in range(len(value))]\n\n val = [value[k][1] for k in range(len(value))]\n\n return bin, val\n\n\n\n\n\n\"\"\"\u3053\u3053\u304b\u3089\u30e1\u30a4\u30f3\u30b3\u30fc\u30c9\"\"\"\n\n\n\n\n\ndef main():\n\n # 1\u6587\u5b57\u306b\u7701\u7565\n\n r, e = range, enumerate\n\n ip = IP()\n\n id = Idea()\n\n\n\n \"\"\"\u30b3\u30d4\u30fc\u30b3\u30fc\u30c9\u3067\u3059\u3002https:\/\/atcoder.jp\/contests\/abc105\/submissions\/4088632 \n\n \u3053\u3061\u3089\u3092\u53c2\u8003\u306b\u30c6\u30b9\u30c8\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002\"\"\"\n\n n = ip.I()\n\n # \u305d\u308c\u305e\u308c\u534a\u5206\u5168\u5217\u6319\n\n list1 = [(-2) ** i for i in r(16)]\n\n list2 = [(-2) ** (i + 16) for i in r(16)]\n\n list1_bin, list1_val = id.Bfs2(list1)\n\n list2_bin, list2_val = id.Bfs2(list2)\n\n\n\n # 2\u5206\u63a2\u7d22\n\n ans = 0\n\n for i in r(len(list1_val)):\n\n j = bisect.bisect_left(list2_val, n - list1_val[i])\n\n\n\n if j < len(list2_val) and list1_val[i] + list2_val[j] == n:\n\n ans = list2_bin[j] + list1_bin[i]\n\n break\n\n print((int(ans)))\n\n\n\n\n\nmain()","target":"# coding: utf-8\n\nimport sys\n\nimport bisect\n\n\n\n\n\n\"\"\"Template\"\"\"\n\n\n\n\n\nclass IP:\n\n \"\"\"\n\n \u5165\u529b\u3092\u53d6\u5f97\u3059\u308b\u30af\u30e9\u30b9\n\n \"\"\"\n\n def __init__(self):\n\n self.input = sys.stdin.readline\n\n\n\n def I(self):\n\n \"\"\"\n\n 1\u6587\u5b57\u306e\u53d6\u5f97\u306b\u4f7f\u3044\u307e\u3059\n\n :return: \u6570\n\n \"\"\"\n\n return int(eval(input()))\n\n\n\n def IL(self):\n\n \"\"\"\n\n 1\u884c\u3092\u7a7a\u767d\u3067\u533a\u5207\u308a\u30ea\u30b9\u30c8\u306b\u3057\u307e\u3059(int\n\n :return: \u30ea\u30b9\u30c8\n\n \"\"\"\n\n return list(map(int, self.input().split()))\n\n\n\n def SL(self):\n\n \"\"\"\n\n 1\u884c\u306e\u6587\u5b57\u5217\u3092\u7a7a\u767d\u533a\u5207\u308a\u3067\u30ea\u30b9\u30c8\u306b\u3057\u307e\u3059\n\n :return: \u30ea\u30b9\u30c8\n\n \"\"\"\n\n return list(map(str, self.input().split()))\n\n\n\n def ILS(self, n):\n\n \"\"\"\n\n 1\u5217\u4e38\u3005\u53d6\u5f97\u3057\u307e\u3059(int\n\n :param n: \u884c\u6570\n\n :return: \u30ea\u30b9\u30c8\n\n \"\"\"\n\n return [int(self.input()) for _ in range(n)]\n\n\n\n def SLS(self, n):\n\n \"\"\"\n\n 1\u5217\u4e38\u3005\u53d6\u5f97\u3057\u307e\u3059\uff08str\n\n :param n: \u884c\u6570\n\n :return: \u30ea\u30b9\u30c8\n\n \"\"\"\n\n return [self.input() for _ in range(n)]\n\n\n\n\n\nclass Idea:\n\n def __init__(self):\n\n pass\n\n\n\n def HF(self, p):\n\n \"\"\"\n\n Half enumeration\n\n \u534a\u5206\u5168\u5217\u6319\u3067\u3059\n\n p\u306e\u8981\u7d20\u306e\u548c\u306e\u7d44\u307f\u5408\u308f\u305b\u3092\u4f5c\u308a\u307e\u3059\u3002\n\n \u30bd\u30fc\u30c8\u3001\u91cd\u8907\u524a\u9664\u884c\u3044\u307e\u3059\n\n :param p: list : \u5143\u3068\u306a\u308b\u30ea\u30b9\u30c8\n\n :return: list : \u7d44\u307f\u5408\u308f\u305b\u3089\u308c\u305f\u548c\u306e\u30ea\u30b9\u30c8\n\n \"\"\"\n\n return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))\n\n\n\n def Bfs2(self, a):\n\n \"\"\"\n\n bit_full_search2\n\n bit\u5168\u63a2\u7d22\u306e\u6539\u826f\u7248\n\n \u5168\u63a2\u7d22\u3055\u305b\u305f\u30892\u9032\u6570\u306e\u30ea\u30b9\u30c8\u306810\u9032\u6570\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n\n :return: list\uff12\u3064 : \uff11\u500b\u76ee 2\u9032\u6570(16\u6841) 2\u500b\u76ee 10\u9032\u6570\u3067\u5408\u8a08\n\n \"\"\"\n\n # \u53c2\u8003\n\n # https:\/\/blog.rossywhite.com\/2018\/08\/06\/bit-search\/\n\n # https:\/\/atcoder.jp\/contests\/abc105\/submissions\/4088632\n\n value = []\n\n for i in range(1 << len(a)):\n\n output = []\n\n\n\n for j in range(len(a)):\n\n if ((i >> j) & 1) == 1:\n\n \"\"\"\u53f3\u304b\u3089j+1\u756a\u76ee\u306ei\u304c1\u304b\u3069\u3046\u304b\u5224\u5b9a\"\"\"\n\n # output.append(a[j])\n\n output.append(a[j])\n\n value.append([format(i, 'b').zfill(16), sum(output)])\n\n\n\n value.sort(key=lambda x: x[1])\n\n bin = [value[k][0] for k in range(len(value))]\n\n val = [value[k][1] for k in range(len(value))]\n\n return bin, val\n\n\n\n\n\n\"\"\"\u3053\u3053\u304b\u3089\u30e1\u30a4\u30f3\u30b3\u30fc\u30c9\"\"\"\n\n\n\n\n\ndef main():\n\n \"\"\"\u30af\u30e9\u30b9\u547c\u3073\u51fa\u3057\u7b49\u884c\u3046\u3088\"\"\"\n\n # 1\u6587\u5b57\u306b\u7701\u7565\n\n r, e = range, enumerate\n\n ip = IP()\n\n id = Idea()\n\n\n\n \"\"\"\u3053\u306e\u4e0b\u304b\u3089\u66f8\u3044\u3066\u306d\"\"\"\n\n\n\n \"\"\"\u30b3\u30d4\u30fc\u30b3\u30fc\u30c9\u3067\u3059\u3002\"\"\"\n\n n = ip.I()\n\n s = ''\n\n while True:\n\n r = n % (-2)\n\n n \/\/= -2\n\n if r < 0:\n\n r += 2\n\n n += 1\n\n s += str(r)\n\n if n == 0: break\n\n print((s[::-1]))\n\n\n\n\n\nmain()\n","code_v0_loc":125,"code_v1_loc":122,"code_v0_num_chars":2879,"code_v1_num_chars":2573,"code_v0_no_empty_lines":"# coding: utf-8\nimport sys\nimport bisect\n\n\"\"\"Template\"\"\"\n\n\nclass IP:\n \"\"\"\n \u5165\u529b\u3092\u53d6\u5f97\u3059\u308b\u30af\u30e9\u30b9\n \"\"\"\n\n def __init__(self):\n self.input = sys.stdin.readline\n\n def I(self):\n \"\"\"\n 1\u6587\u5b57\u306e\u53d6\u5f97\u306b\u4f7f\u3044\u307e\u3059\n :return: \u6570\n \"\"\"\n return int(eval(input()))\n\n def IL(self):\n \"\"\"\n 1\u884c\u3092\u7a7a\u767d\u3067\u533a\u5207\u308a\u30ea\u30b9\u30c8\u306b\u3057\u307e\u3059(int\n :return: \u30ea\u30b9\u30c8\n \"\"\"\n return list(map(int, self.input().split()))\n\n def SL(self):\n \"\"\"\n 1\u884c\u306e\u6587\u5b57\u5217\u3092\u7a7a\u767d\u533a\u5207\u308a\u3067\u30ea\u30b9\u30c8\u306b\u3057\u307e\u3059\n :return: \u30ea\u30b9\u30c8\n \"\"\"\n return list(map(str, self.input().split()))\n\n def ILS(self, n):\n \"\"\"\n 1\u5217\u4e38\u3005\u53d6\u5f97\u3057\u307e\u3059(int\n :param n: \u884c\u6570\n :return: \u30ea\u30b9\u30c8\n \"\"\"\n return [int(self.input()) for _ in range(n)]\n\n def SLS(self, n):\n \"\"\"\n 1\u5217\u4e38\u3005\u53d6\u5f97\u3057\u307e\u3059\uff08str\n :param n: \u884c\u6570\n :return: \u30ea\u30b9\u30c8\n \"\"\"\n return [self.input() for _ in range(n)]\n\n\nclass Idea:\n def __init__(self):\n pass\n\n def HF(self, p):\n \"\"\"\n Half enumeration\n \u534a\u5206\u5168\u5217\u6319\u3067\u3059\n p\u306e\u8981\u7d20\u306e\u548c\u306e\u7d44\u307f\u5408\u308f\u305b\u3092\u4f5c\u308a\u307e\u3059\u3002\n \u30bd\u30fc\u30c8\u3001\u91cd\u8907\u524a\u9664\u884c\u3044\u307e\u3059\n :param p: list : \u5143\u3068\u306a\u308b\u30ea\u30b9\u30c8\n :return: list : \u7d44\u307f\u5408\u308f\u305b\u3089\u308c\u305f\u548c\u306e\u30ea\u30b9\u30c8\n \"\"\"\n return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))\n\n def Bfs2(self, a):\n \"\"\"\n bit_full_search2\n bit\u5168\u63a2\u7d22\u306e\u6539\u826f\u7248\n \u5168\u63a2\u7d22\u3055\u305b\u305f\u30892\u9032\u6570\u306e\u30ea\u30b9\u30c8\u306810\u9032\u6570\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n :return: list\uff12\u3064 : \uff11\u500b\u76ee 2\u9032\u6570(16\u6841) 2\u500b\u76ee 10\u9032\u6570\u3067\u5408\u8a08\n \"\"\"\n # \u53c2\u8003\n # https:\/\/blog.rossywhite.com\/2018\/08\/06\/bit-search\/\n # https:\/\/atcoder.jp\/contests\/abc105\/submissions\/4088632\n value = []\n for i in range(1 << len(a)):\n output = []\n for j in range(len(a)):\n if ((i >> j) & 1) == 1:\n \"\"\"\u53f3\u304b\u3089j+1\u756a\u76ee\u306ei\u304c1\u304b\u3069\u3046\u304b\u5224\u5b9a\"\"\"\n # output.append(a[j])\n output.append(a[j])\n value.append([format(i, \"b\").zfill(16), sum(output)])\n value.sort(key=lambda x: x[1])\n bin = [value[k][0] for k in range(len(value))]\n val = [value[k][1] for k in range(len(value))]\n return bin, val\n\n\n\"\"\"\u3053\u3053\u304b\u3089\u30e1\u30a4\u30f3\u30b3\u30fc\u30c9\"\"\"\n\n\ndef main():\n # 1\u6587\u5b57\u306b\u7701\u7565\n r, e = range, enumerate\n ip = IP()\n id = Idea()\n \"\"\"\u30b3\u30d4\u30fc\u30b3\u30fc\u30c9\u3067\u3059\u3002https:\/\/atcoder.jp\/contests\/abc105\/submissions\/4088632 \n \u3053\u3061\u3089\u3092\u53c2\u8003\u306b\u30c6\u30b9\u30c8\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002\"\"\"\n n = ip.I()\n # \u305d\u308c\u305e\u308c\u534a\u5206\u5168\u5217\u6319\n list1 = [(-2) ** i for i in r(16)]\n list2 = [(-2) ** (i + 16) for i in r(16)]\n list1_bin, list1_val = id.Bfs2(list1)\n list2_bin, list2_val = id.Bfs2(list2)\n # 2\u5206\u63a2\u7d22\n ans = 0\n for i in r(len(list1_val)):\n j = bisect.bisect_left(list2_val, n - list1_val[i])\n if j < len(list2_val) and list1_val[i] + list2_val[j] == n:\n ans = list2_bin[j] + list1_bin[i]\n break\n print((int(ans)))\n\n\nmain()\n","code_v1_no_empty_lines":"# coding: utf-8\nimport sys\nimport bisect\n\n\"\"\"Template\"\"\"\n\n\nclass IP:\n \"\"\"\n \u5165\u529b\u3092\u53d6\u5f97\u3059\u308b\u30af\u30e9\u30b9\n \"\"\"\n\n def __init__(self):\n self.input = sys.stdin.readline\n\n def I(self):\n \"\"\"\n 1\u6587\u5b57\u306e\u53d6\u5f97\u306b\u4f7f\u3044\u307e\u3059\n :return: \u6570\n \"\"\"\n return int(eval(input()))\n\n def IL(self):\n \"\"\"\n 1\u884c\u3092\u7a7a\u767d\u3067\u533a\u5207\u308a\u30ea\u30b9\u30c8\u306b\u3057\u307e\u3059(int\n :return: \u30ea\u30b9\u30c8\n \"\"\"\n return list(map(int, self.input().split()))\n\n def SL(self):\n \"\"\"\n 1\u884c\u306e\u6587\u5b57\u5217\u3092\u7a7a\u767d\u533a\u5207\u308a\u3067\u30ea\u30b9\u30c8\u306b\u3057\u307e\u3059\n :return: \u30ea\u30b9\u30c8\n \"\"\"\n return list(map(str, self.input().split()))\n\n def ILS(self, n):\n \"\"\"\n 1\u5217\u4e38\u3005\u53d6\u5f97\u3057\u307e\u3059(int\n :param n: \u884c\u6570\n :return: \u30ea\u30b9\u30c8\n \"\"\"\n return [int(self.input()) for _ in range(n)]\n\n def SLS(self, n):\n \"\"\"\n 1\u5217\u4e38\u3005\u53d6\u5f97\u3057\u307e\u3059\uff08str\n :param n: \u884c\u6570\n :return: \u30ea\u30b9\u30c8\n \"\"\"\n return [self.input() for _ in range(n)]\n\n\nclass Idea:\n def __init__(self):\n pass\n\n def HF(self, p):\n \"\"\"\n Half enumeration\n \u534a\u5206\u5168\u5217\u6319\u3067\u3059\n p\u306e\u8981\u7d20\u306e\u548c\u306e\u7d44\u307f\u5408\u308f\u305b\u3092\u4f5c\u308a\u307e\u3059\u3002\n \u30bd\u30fc\u30c8\u3001\u91cd\u8907\u524a\u9664\u884c\u3044\u307e\u3059\n :param p: list : \u5143\u3068\u306a\u308b\u30ea\u30b9\u30c8\n :return: list : \u7d44\u307f\u5408\u308f\u305b\u3089\u308c\u305f\u548c\u306e\u30ea\u30b9\u30c8\n \"\"\"\n return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))\n\n def Bfs2(self, a):\n \"\"\"\n bit_full_search2\n bit\u5168\u63a2\u7d22\u306e\u6539\u826f\u7248\n \u5168\u63a2\u7d22\u3055\u305b\u305f\u30892\u9032\u6570\u306e\u30ea\u30b9\u30c8\u306810\u9032\u6570\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n :return: list\uff12\u3064 : \uff11\u500b\u76ee 2\u9032\u6570(16\u6841) 2\u500b\u76ee 10\u9032\u6570\u3067\u5408\u8a08\n \"\"\"\n # \u53c2\u8003\n # https:\/\/blog.rossywhite.com\/2018\/08\/06\/bit-search\/\n # https:\/\/atcoder.jp\/contests\/abc105\/submissions\/4088632\n value = []\n for i in range(1 << len(a)):\n output = []\n for j in range(len(a)):\n if ((i >> j) & 1) == 1:\n \"\"\"\u53f3\u304b\u3089j+1\u756a\u76ee\u306ei\u304c1\u304b\u3069\u3046\u304b\u5224\u5b9a\"\"\"\n # output.append(a[j])\n output.append(a[j])\n value.append([format(i, \"b\").zfill(16), sum(output)])\n value.sort(key=lambda x: x[1])\n bin = [value[k][0] for k in range(len(value))]\n val = [value[k][1] for k in range(len(value))]\n return bin, val\n\n\n\"\"\"\u3053\u3053\u304b\u3089\u30e1\u30a4\u30f3\u30b3\u30fc\u30c9\"\"\"\n\n\ndef main():\n \"\"\"\u30af\u30e9\u30b9\u547c\u3073\u51fa\u3057\u7b49\u884c\u3046\u3088\"\"\"\n # 1\u6587\u5b57\u306b\u7701\u7565\n r, e = range, enumerate\n ip = IP()\n id = Idea()\n \"\"\"\u3053\u306e\u4e0b\u304b\u3089\u66f8\u3044\u3066\u306d\"\"\"\n \"\"\"\u30b3\u30d4\u30fc\u30b3\u30fc\u30c9\u3067\u3059\u3002\"\"\"\n n = ip.I()\n s = \"\"\n while True:\n r = n % (-2)\n n \/\/= -2\n if r < 0:\n r += 2\n n += 1\n s += str(r)\n if n == 0:\n break\n print((s[::-1]))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":2.4,"diff":["+ \"\"\"\u30af\u30e9\u30b9\u547c\u3073\u51fa\u3057\u7b49\u884c\u3046\u3088\"\"\"","- \"\"\"\u30b3\u30d4\u30fc\u30b3\u30fc\u30c9\u3067\u3059\u3002https:\/\/atcoder.jp\/contests\/abc105\/submissions\/4088632","- \u3053\u3061\u3089\u3092\u53c2\u8003\u306b\u30c6\u30b9\u30c8\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002\"\"\"","+ \"\"\"\u3053\u306e\u4e0b\u304b\u3089\u66f8\u3044\u3066\u306d\"\"\"","+ \"\"\"\u30b3\u30d4\u30fc\u30b3\u30fc\u30c9\u3067\u3059\u3002\"\"\"","- # \u305d\u308c\u305e\u308c\u534a\u5206\u5168\u5217\u6319","- list1 = [(-2) ** i for i in r(16)]","- list2 = [(-2) ** (i + 16) for i in r(16)]","- list1_bin, list1_val = id.Bfs2(list1)","- list2_bin, list2_val = id.Bfs2(list2)","- # 2\u5206\u63a2\u7d22","- ans = 0","- for i in r(len(list1_val)):","- j = bisect.bisect_left(list2_val, n - list1_val[i])","- if j < len(list2_val) and list1_val[i] + list2_val[j] == n:","- ans = list2_bin[j] + list1_bin[i]","+ s = \"\"","+ while True:","+ r = n % (-2)","+ n \/\/= -2","+ if r < 0:","+ r += 2","+ n += 1","+ s += str(r)","+ if n == 0:","- print((int(ans)))","+ print((s[::-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.1641480892,"measured_runtime_v1":0.0379909937,"runtime_lift":30.6427385629,"key":["s740196550","s652454700"]} +{"user_id":"u017415492","problem_id":"p03212","language":"python","submission_id_v0":"s005702126","submission_id_v1":"s521017452","cpu_time_v0":105,"cpu_time_v1":69,"memory_v0":10108,"memory_v1":9176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.29,"input":"n=int(eval(input()))\n\nnum=[3,5,7]\n\n#a[0]=3,a[1]=5,a[7]=5\n\nans=[3,5,7]\n\nansw=[]\n\nfor i1 in range(3):\n\n for i2 in range(3):\n\n for i3 in range(3):\n\n a=set([i1,i2,i3])\n\n if len(a)>2:\n\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])))\n\n for i4 in range(3):\n\n a=set([i1,i2,i3,i4])\n\n if len(a)>2:\n\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i4])))\n\n for i5 in range(3):\n\n a=set([i1,i2,i3,i4,i5])\n\n if len(a)>2:\n\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i5])+str(num[i4])))\n\n for i6 in range(3):\n\n a=set([i1,i2,i3,i4,i5,i6])\n\n if len(a)>2:\n\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i6])+str(num[i5])+str(num[i4])))\n\n for i7 in range(3):\n\n a=set([i1,i2,i3,i4,i5,i6,i7])\n\n if len(a)>2:\n\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i7])+str(num[i6])+str(num[i5])+str(num[i4])))\n\n for i8 in range(3):\n\n a=set([i1,i2,i3,i4,i5,i6,i7,i8])\n\n if len(a)>2:\n\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i8])+str(num[i7])+str(num[i6])+str(num[i5])+str(num[i4])))\n\n for i9 in range(3):\n\n a=set([i1,i2,i3,i4,i5,i6,i7,i8,i9])\n\n if len(a)>2:\n\n answ.append(int(str(num[i1])+str(num[i2])+str(num[i3])+str(num[i9])+str(num[i8])+str(num[i7])+str(num[i6])+str(num[i5])+str(num[i4])))\n\nansw.sort()\n\nleft=0\n\nright=len(answ)\n\nwhile right-left>1:\n\n mid=(left+right)\/\/2\n\n \n\n if nn:\n\n print((0))\n\nelse:\n\n print((left+1))\n\n \n\n ","target":"n=int(eval(input()))\n\n\n\ndef dfs(s):\n\n if s!=\"\" and int(s)>n:\n\n return 0\n\n \n\n if len(set(list(s)))<3:\n\n ret=0\n\n else:\n\n ret=1\n\n \n\n for i in \"753\":\n\n ret+=dfs(s+i)\n\n \n\n return ret\n\n\n\nprint((dfs(\"\")))","code_v0_loc":51,"code_v1_loc":17,"code_v0_num_chars":1802,"code_v1_num_chars":209,"code_v0_no_empty_lines":"n = int(eval(input()))\nnum = [3, 5, 7]\n# a[0]=3,a[1]=5,a[7]=5\nans = [3, 5, 7]\nansw = []\nfor i1 in range(3):\n for i2 in range(3):\n for i3 in range(3):\n a = set([i1, i2, i3])\n if len(a) > 2:\n answ.append(int(str(num[i1]) + str(num[i2]) + str(num[i3])))\n for i4 in range(3):\n a = set([i1, i2, i3, i4])\n if len(a) > 2:\n answ.append(\n int(str(num[i1]) + str(num[i2]) + str(num[i3]) + str(num[i4]))\n )\n for i5 in range(3):\n a = set([i1, i2, i3, i4, i5])\n if len(a) > 2:\n answ.append(\n int(\n str(num[i1])\n + str(num[i2])\n + str(num[i3])\n + str(num[i5])\n + str(num[i4])\n )\n )\n for i6 in range(3):\n a = set([i1, i2, i3, i4, i5, i6])\n if len(a) > 2:\n answ.append(\n int(\n str(num[i1])\n + str(num[i2])\n + str(num[i3])\n + str(num[i6])\n + str(num[i5])\n + str(num[i4])\n )\n )\n for i7 in range(3):\n a = set([i1, i2, i3, i4, i5, i6, i7])\n if len(a) > 2:\n answ.append(\n int(\n str(num[i1])\n + str(num[i2])\n + str(num[i3])\n + str(num[i7])\n + str(num[i6])\n + str(num[i5])\n + str(num[i4])\n )\n )\n for i8 in range(3):\n a = set([i1, i2, i3, i4, i5, i6, i7, i8])\n if len(a) > 2:\n answ.append(\n int(\n str(num[i1])\n + str(num[i2])\n + str(num[i3])\n + str(num[i8])\n + str(num[i7])\n + str(num[i6])\n + str(num[i5])\n + str(num[i4])\n )\n )\n for i9 in range(3):\n a = set([i1, i2, i3, i4, i5, i6, i7, i8, i9])\n if len(a) > 2:\n answ.append(\n int(\n str(num[i1])\n + str(num[i2])\n + str(num[i3])\n + str(num[i9])\n + str(num[i8])\n + str(num[i7])\n + str(num[i6])\n + str(num[i5])\n + str(num[i4])\n )\n )\nansw.sort()\nleft = 0\nright = len(answ)\nwhile right - left > 1:\n mid = (left + right) \/\/ 2\n if n < answ[mid]:\n right = mid\n else:\n left = mid\nif 357 > n:\n print((0))\nelse:\n print((left + 1))\n","code_v1_no_empty_lines":"n = int(eval(input()))\n\n\ndef dfs(s):\n if s != \"\" and int(s) > n:\n return 0\n if len(set(list(s))) < 3:\n ret = 0\n else:\n ret = 1\n for i in \"753\":\n ret += dfs(s + i)\n return ret\n\n\nprint((dfs(\"\")))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-num = [3, 5, 7]","-# a[0]=3,a[1]=5,a[7]=5","-ans = [3, 5, 7]","-answ = []","-for i1 in range(3):","- for i2 in range(3):","- for i3 in range(3):","- a = set([i1, i2, i3])","- if len(a) > 2:","- answ.append(int(str(num[i1]) + str(num[i2]) + str(num[i3])))","- for i4 in range(3):","- a = set([i1, i2, i3, i4])","- if len(a) > 2:","- answ.append(","- int(str(num[i1]) + str(num[i2]) + str(num[i3]) + str(num[i4]))","- )","- for i5 in range(3):","- a = set([i1, i2, i3, i4, i5])","- if len(a) > 2:","- answ.append(","- int(","- str(num[i1])","- + str(num[i2])","- + str(num[i3])","- + str(num[i5])","- + str(num[i4])","- )","- )","- for i6 in range(3):","- a = set([i1, i2, i3, i4, i5, i6])","- if len(a) > 2:","- answ.append(","- int(","- str(num[i1])","- + str(num[i2])","- + str(num[i3])","- + str(num[i6])","- + str(num[i5])","- + str(num[i4])","- )","- )","- for i7 in range(3):","- a = set([i1, i2, i3, i4, i5, i6, i7])","- if len(a) > 2:","- answ.append(","- int(","- str(num[i1])","- + str(num[i2])","- + str(num[i3])","- + str(num[i7])","- + str(num[i6])","- + str(num[i5])","- + str(num[i4])","- )","- )","- for i8 in range(3):","- a = set([i1, i2, i3, i4, i5, i6, i7, i8])","- if len(a) > 2:","- answ.append(","- int(","- str(num[i1])","- + str(num[i2])","- + str(num[i3])","- + str(num[i8])","- + str(num[i7])","- + str(num[i6])","- + str(num[i5])","- + str(num[i4])","- )","- )","- for i9 in range(3):","- a = set([i1, i2, i3, i4, i5, i6, i7, i8, i9])","- if len(a) > 2:","- answ.append(","- int(","- str(num[i1])","- + str(num[i2])","- + str(num[i3])","- + str(num[i9])","- + str(num[i8])","- + str(num[i7])","- + str(num[i6])","- + str(num[i5])","- + str(num[i4])","- )","- )","-answ.sort()","-left = 0","-right = len(answ)","-while right - left > 1:","- mid = (left + right) \/\/ 2","- if n < answ[mid]:","- right = mid","+","+","+def dfs(s):","+ if s != \"\" and int(s) > n:","+ return 0","+ if len(set(list(s))) < 3:","+ ret = 0","- left = mid","-if 357 > n:","- print((0))","-else:","- print((left + 1))","+ ret = 1","+ for i in \"753\":","+ ret += dfs(s + i)","+ return ret","+","+","+print((dfs(\"\")))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2099792464,"measured_runtime_v1":0.1365943425,"runtime_lift":1.5372470233,"key":["s005702126","s521017452"]} +{"user_id":"u796942881","problem_id":"p02923","language":"python","submission_id_v0":"s854560577","submission_id_v1":"s797044584","cpu_time_v0":54,"cpu_time_v1":49,"memory_v0":11312,"memory_v1":11200,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.26,"input":"from sys import stdin\n\n\n\nreadline = stdin.readline\n\n\n\ndef main():\n\n eval(input())\n\n H = list(map(int, readline().split()))\n\n ans = 0\n\n prev = int(1e9+7)\n\n cnt = -1\n\n for cur in H:\n\n if prev >= cur:\n\n cnt += 1\n\n else:\n\n if ans < cnt:\n\n ans = cnt\n\n cnt = 0\n\n prev = cur\n\n if ans < cnt:\n\n ans = cnt\n\n print(ans)\n\n return\n\n\n\n\n\nmain()\n","target":"def main():\n\n H = list(map(int, open(0).read().split()[1:]))\n\n ans = 0\n\n prev = int(1e9+7)\n\n cnt = -1\n\n for cur in H:\n\n if prev >= cur:\n\n cnt += 1\n\n else:\n\n if ans < cnt:\n\n ans = cnt\n\n cnt = 0\n\n prev = cur\n\n if ans < cnt:\n\n ans = cnt\n\n print(ans)\n\n return\n\n\n\n\n\nmain()\n","code_v0_loc":25,"code_v1_loc":20,"code_v0_num_chars":421,"code_v1_num_chars":362,"code_v0_no_empty_lines":"from sys import stdin\n\nreadline = stdin.readline\n\n\ndef main():\n eval(input())\n H = list(map(int, readline().split()))\n ans = 0\n prev = int(1e9 + 7)\n cnt = -1\n for cur in H:\n if prev >= cur:\n cnt += 1\n else:\n if ans < cnt:\n ans = cnt\n cnt = 0\n prev = cur\n if ans < cnt:\n ans = cnt\n print(ans)\n return\n\n\nmain()\n","code_v1_no_empty_lines":"def main():\n H = list(map(int, open(0).read().split()[1:]))\n ans = 0\n prev = int(1e9 + 7)\n cnt = -1\n for cur in H:\n if prev >= cur:\n cnt += 1\n else:\n if ans < cnt:\n ans = cnt\n cnt = 0\n prev = cur\n if ans < cnt:\n ans = cnt\n print(ans)\n return\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-from sys import stdin","-","-readline = stdin.readline","-","-","- eval(input())","- H = list(map(int, readline().split()))","+ H = list(map(int, open(0).read().split()[1:]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.107591361,"measured_runtime_v1":0.1031979573,"runtime_lift":1.0425725845,"key":["s854560577","s797044584"]} +{"user_id":"u477977638","problem_id":"p03043","language":"python","submission_id_v0":"s705572321","submission_id_v1":"s054958769","cpu_time_v0":779,"cpu_time_v1":47,"memory_v0":20528,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.97,"input":"import sys\n\n\n\nread = sys.stdin.buffer.read\n\ninput = sys.stdin.buffer.readline\n\ninputs = sys.stdin.buffer.readlines\n\n\n\n\n\n# rstrip().decode('utf-8')\n\n# INF=float(\"inf\")\n\n# MOD=10**9+7\n\n# sys.setrecursionlimit(2147483647)\n\n# import math\n\nimport numpy as np\n\n# import operator\n\n# import bisect\n\n# from heapq import heapify,heappop,heappush\n\n# from math import gcd\n\n# from fractions import gcd\n\n# from collections import deque\n\n# from collections import defaultdict\n\n# from collections import Counter\n\n# from itertools import accumulate\n\n# from itertools import groupby\n\n# from itertools import permutations\n\n# from itertools import combinations\n\n# from scipy.sparse import csr_matrix\n\n# from scipy.sparse.csgraph import floyd_warshall\n\n# from scipy.sparse.csgraph import csgraph_from_dense\n\n# from scipy.sparse.csgraph import dijkstra\n\n# map(int,input().split())\n\n\n\n\n\ndef main():\n\n\tN, K = list(map(int, input().split()))\n\n\tans=0\n\n\tfor i in range(1,N+1):\n\n\t\tx=max(0,np.ceil(np.log2(K\/i)))\n\n\t\tans+=2**(-x)\n\n\tprint((ans\/N))\n\n\t\n\n\t\n\n\t\n\n\t\n\n\t\n\n\t\n\nif __name__ == '__main__':\n\n\tmain()\n","target":"import sys\n\n\n\nread = sys.stdin.buffer.read\n\ninput = sys.stdin.buffer.readline\n\ninputs = sys.stdin.buffer.readlines\n\n\n\n\n\n# rstrip().decode('utf-8')\n\n# INF=float(\"inf\")\n\n# MOD=10**9+7\n\n# sys.setrecursionlimit(2147483647)\n\n# import math\n\n#import numpy as np\n\n# import operator\n\n# import bisect\n\n# from heapq import heapify,heappop,heappush\n\n# from math import gcd\n\n# from fractions import gcd\n\n# from collections import deque\n\n# from collections import defaultdict\n\n# from collections import Counter\n\n# from itertools import accumulate\n\n# from itertools import groupby\n\n# from itertools import permutations\n\n# from itertools import combinations\n\n# from scipy.sparse import csr_matrix\n\n# from scipy.sparse.csgraph import floyd_warshall\n\n# from scipy.sparse.csgraph import csgraph_from_dense\n\n# from scipy.sparse.csgraph import dijkstra\n\n# map(int,input().split())\n\n\n\n\n\ndef main():\n\n\tN, K = list(map(int, input().split()))\n\n\tans=0\n\n\tfor i in range(1,N+1):\n\n\t\ta=0\n\n\t\twhile i*(2**a) 1:\n\n print((0))\n\n else:\n\n print((1))\n\n exit()\n\n\n\nif a[0] == 1: #\uff11\u3060\u3051\u306f\u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\u3068\u304d\u306b\u30d0\u30b0\u308b\u306e\u3067\u5225\u3067\u51e6\u7406\n\n if a[0] == a[1]:\n\n print((0))\n\n else:\n\n print((1))\n\n exit()\n\n \n\ndef divisorize(fct): # \u7d04\u6570\u306e\u30ea\u30b9\u30c8\u3064\u304f\u308b\u3084\u3064\n\n b, e = fct.pop()\n\n pre_div = divisorize(fct) if fct else [[]]\n\n suf_div = [[(b, k)] for k in range(e + 1)]\n\n return [pre + suf for pre in pre_div for suf in suf_div]\n\n\n\ndef factorize(n): #\u7d20\u56e0\u6570\u5206\u89e3\n\n fct = []\n\n b, e = 2, 0\n\n while b * b <= n:\n\n while n % b == 0:\n\n n = n \/\/ b\n\n e = e + 1\n\n if e > 0:\n\n fct.append((b, e))\n\n b, e = b + 1, 0\n\n if n > 1:\n\n fct.append((n, 1))\n\n return fct\n\n \n\n \n\ndef num(fct):\n\n a = 1\n\n for base, exponent in fct:\n\n a = a * base**exponent\n\n return a\n\n \n\ns = set()\n\nans = 0\n\nfor nm,i in enumerate(a):\n\n c = set()\n\n fct = factorize(i)\n\n for div in divisorize(fct): # \u7d04\u6570\u306e\u96c6\u5408\u3092\u4f5c\u308b\n\n c.add(num(div))\n\n\n\n# \u7a4d\u96c6\u5408\u3092\u3068\u308a\u3001\u305d\u308c\u304c\u7a7a\u3067\u304b\u3064\u540c\u3058\u6570\u5b57\u304c\u4e26\u3093\u3067\u306a\u3044\u6642\u306b\u7b54\u3048\u3092\u52a0\u7b97\n\n if c&s == set() and ((nm < n-1 and a[nm+1] != i) or nm == n-1): \n\n ans += 1\n\n s.add(i) #\u4eca\u307e\u3067\u898b\u305f\u6570\u306e\u96c6\u5408\u3092\u66f4\u65b0\n\n\n\nprint(ans)","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nn = int(readline())\n\na = list(map(int,readline().split()))\n\na.sort()\n\n\n\nif a[0] == a[-1]:\n\n if n > 1:\n\n print((0))\n\n else:\n\n print((1))\n\n exit()\n\n\n\ndef gcd(a, b):\n\n while b: a, b = b, a % b\n\n return a\n\ndef isPrimeMR(n):\n\n d = n - 1\n\n d = d \/\/ (d & -d)\n\n L = [2, 7, 61] if n < 1<<32 else [2, 3, 5, 7, 11, 13, 17] if n < 1<<48 else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]\n\n for a in L:\n\n t = d\n\n y = pow(a, t, n)\n\n if y == 1: continue\n\n while y != n - 1:\n\n y = y * y % n\n\n if y == 1 or t == n - 1: return 0\n\n t <<= 1\n\n return 1\n\ndef findFactorRho(n):\n\n m = 1 << n.bit_length() \/\/ 8\n\n for c in range(1, 99):\n\n f = lambda x: (x * x + c) % n\n\n y, r, q, g = 2, 1, 1, 1\n\n while g == 1:\n\n x = y\n\n for i in range(r):\n\n y = f(y)\n\n k = 0\n\n while k < r and g == 1:\n\n ys = y\n\n for i in range(min(m, r - k)):\n\n y = f(y)\n\n q = q * abs(x - y) % n\n\n g = gcd(q, n)\n\n k += m\n\n r <<= 1\n\n if g == n:\n\n g = 1\n\n while g == 1:\n\n ys = f(ys)\n\n g = gcd(abs(x - ys), n)\n\n if g < n:\n\n if isPrimeMR(g): return g\n\n elif isPrimeMR(n \/\/ g): return n \/\/ g\n\n return findFactorRho(g)\n\ndef primeFactor(n):\n\n i = 2\n\n ret = {}\n\n rhoFlg = 0\n\n while i * i <= n:\n\n k = 0\n\n while n % i == 0:\n\n n \/\/= i\n\n k += 1\n\n if k: ret[i] = k\n\n i += i % 2 + (3 if i % 3 == 1 else 1)\n\n if i == 101 and n >= 2 ** 20:\n\n while n > 1:\n\n if isPrimeMR(n):\n\n ret[n], n = 1, 1\n\n else:\n\n rhoFlg = 1\n\n j = findFactorRho(n)\n\n k = 0\n\n while n % j == 0:\n\n n \/\/= j\n\n k += 1\n\n ret[j] = k\n\n \n\n if n > 1: ret[n] = 1\n\n if rhoFlg: ret = {x: ret[x] for x in sorted(ret)}\n\n return ret\n\n\n\ndef divisors(N):\n\n pf = primeFactor(N)\n\n ret = [1]\n\n for p in pf:\n\n ret_prev = ret\n\n ret = []\n\n for i in range(pf[p]+1):\n\n for r in ret_prev:\n\n ret.append(r * (p ** i))\n\n return ret\n\n \n\ns = set()\n\nans = 0\n\nfor nm,i in enumerate(a):\n\n c = set(divisors(i))\n\n if c&s == set() and ((nm < n-1 and a[nm+1] != i) or nm == n-1): \n\n ans += 1\n\n s.add(i)\n\n\n\nprint(ans)","code_v0_loc":65,"code_v1_loc":107,"code_v0_num_chars":1342,"code_v1_num_chars":2722,"code_v0_no_empty_lines":"# ABC170 D\nimport sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nn = int(readline())\na = list(map(int, readline().split()))\na.sort()\nif a[0] == a[-1]: # n=1 \u3084\u30b5\u30f3\u30d7\u30eb\uff12\u306e\u3088\u3046\u306a\u6642\n if n > 1:\n print((0))\n else:\n print((1))\n exit()\nif a[0] == 1: # \uff11\u3060\u3051\u306f\u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\u3068\u304d\u306b\u30d0\u30b0\u308b\u306e\u3067\u5225\u3067\u51e6\u7406\n if a[0] == a[1]:\n print((0))\n else:\n print((1))\n exit()\n\n\ndef divisorize(fct): # \u7d04\u6570\u306e\u30ea\u30b9\u30c8\u3064\u304f\u308b\u3084\u3064\n b, e = fct.pop()\n pre_div = divisorize(fct) if fct else [[]]\n suf_div = [[(b, k)] for k in range(e + 1)]\n return [pre + suf for pre in pre_div for suf in suf_div]\n\n\ndef factorize(n): # \u7d20\u56e0\u6570\u5206\u89e3\n fct = []\n b, e = 2, 0\n while b * b <= n:\n while n % b == 0:\n n = n \/\/ b\n e = e + 1\n if e > 0:\n fct.append((b, e))\n b, e = b + 1, 0\n if n > 1:\n fct.append((n, 1))\n return fct\n\n\ndef num(fct):\n a = 1\n for base, exponent in fct:\n a = a * base**exponent\n return a\n\n\ns = set()\nans = 0\nfor nm, i in enumerate(a):\n c = set()\n fct = factorize(i)\n for div in divisorize(fct): # \u7d04\u6570\u306e\u96c6\u5408\u3092\u4f5c\u308b\n c.add(num(div))\n # \u7a4d\u96c6\u5408\u3092\u3068\u308a\u3001\u305d\u308c\u304c\u7a7a\u3067\u304b\u3064\u540c\u3058\u6570\u5b57\u304c\u4e26\u3093\u3067\u306a\u3044\u6642\u306b\u7b54\u3048\u3092\u52a0\u7b97\n if c & s == set() and ((nm < n - 1 and a[nm + 1] != i) or nm == n - 1):\n ans += 1\n s.add(i) # \u4eca\u307e\u3067\u898b\u305f\u6570\u306e\u96c6\u5408\u3092\u66f4\u65b0\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nn = int(readline())\na = list(map(int, readline().split()))\na.sort()\nif a[0] == a[-1]:\n if n > 1:\n print((0))\n else:\n print((1))\n exit()\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\ndef isPrimeMR(n):\n d = n - 1\n d = d \/\/ (d & -d)\n L = (\n [2, 7, 61]\n if n < 1 << 32\n else [2, 3, 5, 7, 11, 13, 17]\n if n < 1 << 48\n else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]\n )\n for a in L:\n t = d\n y = pow(a, t, n)\n if y == 1:\n continue\n while y != n - 1:\n y = y * y % n\n if y == 1 or t == n - 1:\n return 0\n t <<= 1\n return 1\n\n\ndef findFactorRho(n):\n m = 1 << n.bit_length() \/\/ 8\n for c in range(1, 99):\n f = lambda x: (x * x + c) % n\n y, r, q, g = 2, 1, 1, 1\n while g == 1:\n x = y\n for i in range(r):\n y = f(y)\n k = 0\n while k < r and g == 1:\n ys = y\n for i in range(min(m, r - k)):\n y = f(y)\n q = q * abs(x - y) % n\n g = gcd(q, n)\n k += m\n r <<= 1\n if g == n:\n g = 1\n while g == 1:\n ys = f(ys)\n g = gcd(abs(x - ys), n)\n if g < n:\n if isPrimeMR(g):\n return g\n elif isPrimeMR(n \/\/ g):\n return n \/\/ g\n return findFactorRho(g)\n\n\ndef primeFactor(n):\n i = 2\n ret = {}\n rhoFlg = 0\n while i * i <= n:\n k = 0\n while n % i == 0:\n n \/\/= i\n k += 1\n if k:\n ret[i] = k\n i += i % 2 + (3 if i % 3 == 1 else 1)\n if i == 101 and n >= 2**20:\n while n > 1:\n if isPrimeMR(n):\n ret[n], n = 1, 1\n else:\n rhoFlg = 1\n j = findFactorRho(n)\n k = 0\n while n % j == 0:\n n \/\/= j\n k += 1\n ret[j] = k\n if n > 1:\n ret[n] = 1\n if rhoFlg:\n ret = {x: ret[x] for x in sorted(ret)}\n return ret\n\n\ndef divisors(N):\n pf = primeFactor(N)\n ret = [1]\n for p in pf:\n ret_prev = ret\n ret = []\n for i in range(pf[p] + 1):\n for r in ret_prev:\n ret.append(r * (p**i))\n return ret\n\n\ns = set()\nans = 0\nfor nm, i in enumerate(a):\n c = set(divisors(i))\n if c & s == set() and ((nm < n - 1 and a[nm + 1] != i) or nm == n - 1):\n ans += 1\n s.add(i)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":39.2523364486,"diff":["-# ABC170 D","-if a[0] == a[-1]: # n=1 \u3084\u30b5\u30f3\u30d7\u30eb\uff12\u306e\u3088\u3046\u306a\u6642","+if a[0] == a[-1]:","- print((0))","- else:","- print((1))","- exit()","-if a[0] == 1: # \uff11\u3060\u3051\u306f\u7d20\u56e0\u6570\u5206\u89e3\u3059\u308b\u3068\u304d\u306b\u30d0\u30b0\u308b\u306e\u3067\u5225\u3067\u51e6\u7406","- if a[0] == a[1]:","-def divisorize(fct): # \u7d04\u6570\u306e\u30ea\u30b9\u30c8\u3064\u304f\u308b\u3084\u3064","- b, e = fct.pop()","- pre_div = divisorize(fct) if fct else [[]]","- suf_div = [[(b, k)] for k in range(e + 1)]","- return [pre + suf for pre in pre_div for suf in suf_div]","+def gcd(a, b):","+ while b:","+ a, b = b, a % b","+ return a","-def factorize(n): # \u7d20\u56e0\u6570\u5206\u89e3","- fct = []","- b, e = 2, 0","- while b * b <= n:","- while n % b == 0:","- n = n \/\/ b","- e = e + 1","- if e > 0:","- fct.append((b, e))","- b, e = b + 1, 0","- if n > 1:","- fct.append((n, 1))","- return fct","+def isPrimeMR(n):","+ d = n - 1","+ d = d \/\/ (d & -d)","+ L = (","+ [2, 7, 61]","+ if n < 1 << 32","+ else [2, 3, 5, 7, 11, 13, 17]","+ if n < 1 << 48","+ else [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]","+ )","+ for a in L:","+ t = d","+ y = pow(a, t, n)","+ if y == 1:","+ continue","+ while y != n - 1:","+ y = y * y % n","+ if y == 1 or t == n - 1:","+ return 0","+ t <<= 1","+ return 1","-def num(fct):","- a = 1","- for base, exponent in fct:","- a = a * base**exponent","- return a","+def findFactorRho(n):","+ m = 1 << n.bit_length() \/\/ 8","+ for c in range(1, 99):","+ f = lambda x: (x * x + c) % n","+ y, r, q, g = 2, 1, 1, 1","+ while g == 1:","+ x = y","+ for i in range(r):","+ y = f(y)","+ k = 0","+ while k < r and g == 1:","+ ys = y","+ for i in range(min(m, r - k)):","+ y = f(y)","+ q = q * abs(x - y) % n","+ g = gcd(q, n)","+ k += m","+ r <<= 1","+ if g == n:","+ g = 1","+ while g == 1:","+ ys = f(ys)","+ g = gcd(abs(x - ys), n)","+ if g < n:","+ if isPrimeMR(g):","+ return g","+ elif isPrimeMR(n \/\/ g):","+ return n \/\/ g","+ return findFactorRho(g)","+","+","+def primeFactor(n):","+ i = 2","+ ret = {}","+ rhoFlg = 0","+ while i * i <= n:","+ k = 0","+ while n % i == 0:","+ n \/\/= i","+ k += 1","+ if k:","+ ret[i] = k","+ i += i % 2 + (3 if i % 3 == 1 else 1)","+ if i == 101 and n >= 2**20:","+ while n > 1:","+ if isPrimeMR(n):","+ ret[n], n = 1, 1","+ else:","+ rhoFlg = 1","+ j = findFactorRho(n)","+ k = 0","+ while n % j == 0:","+ n \/\/= j","+ k += 1","+ ret[j] = k","+ if n > 1:","+ ret[n] = 1","+ if rhoFlg:","+ ret = {x: ret[x] for x in sorted(ret)}","+ return ret","+","+","+def divisors(N):","+ pf = primeFactor(N)","+ ret = [1]","+ for p in pf:","+ ret_prev = ret","+ ret = []","+ for i in range(pf[p] + 1):","+ for r in ret_prev:","+ ret.append(r * (p**i))","+ return ret","- c = set()","- fct = factorize(i)","- for div in divisorize(fct): # \u7d04\u6570\u306e\u96c6\u5408\u3092\u4f5c\u308b","- c.add(num(div))","- # \u7a4d\u96c6\u5408\u3092\u3068\u308a\u3001\u305d\u308c\u304c\u7a7a\u3067\u304b\u3064\u540c\u3058\u6570\u5b57\u304c\u4e26\u3093\u3067\u306a\u3044\u6642\u306b\u7b54\u3048\u3092\u52a0\u7b97","+ c = set(divisors(i))","- s.add(i) # \u4eca\u307e\u3067\u898b\u305f\u6570\u306e\u96c6\u5408\u3092\u66f4\u65b0","+ s.add(i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0377314634,"measured_runtime_v1":0.0889533176,"runtime_lift":0.4241715141,"key":["s100405668","s093320770"]} +{"user_id":"u869790980","problem_id":"p02918","language":"python","submission_id_v0":"s247815671","submission_id_v1":"s958874016","cpu_time_v0":71,"cpu_time_v1":55,"memory_v0":46316,"memory_v1":32540,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.54,"input":"n,k = list(map(int, input().split()))\n\ns = input()\n\ncd = 0\n\nd = None\n\nfor l in s:\n\n\tif d != l:\n\n\t\tcd +=1\n\n\t\td = l\n\nscore = 0\n\nfor u,v in zip(s,s[1:]):\n\n\tif u == v:\n\n\t\tscore +=1\n\n\n\nif cd > 2:\n\n\tt = min(k,((cd - 2)+1)\/2)\n\n\tk -= t\n\n\tscore += 2 * t \n\n\tcd -= 2 * t\n\nif cd == 2 and k:\n\n\tscore +=1\n\n\tcd -= 1\n\nprint(score)","target":"n,k = list(map(int, input().split()))\n\nscore,d,cd = 0,None,0\n\ns = input()\n\nfor i,l in enumerate(s):\n\n\tif d != l:\n\n\t\tcd +=1\n\n\t\td = l\n\n\tif i and s[i-1] == s[i]: score += 1\n\n\n\n\n\nif cd > 2:\n\n\tt = min(k,((cd - 2)+1)\/2)\n\n\tk -= t\n\n\tscore += 2 * t \n\n\tcd -= 2 * t\n\nif cd == 2 and k:\n\n\tscore +=1\n\n\tcd -= 1\n\nprint(score)\n","code_v0_loc":22,"code_v1_loc":19,"code_v0_num_chars":315,"code_v1_num_chars":312,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\ns = input()\ncd = 0\nd = None\nfor l in s:\n if d != l:\n cd += 1\n d = l\nscore = 0\nfor u, v in zip(s, s[1:]):\n if u == v:\n score += 1\nif cd > 2:\n t = min(k, ((cd - 2) + 1) \/ 2)\n k -= t\n score += 2 * t\n cd -= 2 * t\nif cd == 2 and k:\n score += 1\n cd -= 1\nprint(score)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nscore, d, cd = 0, None, 0\ns = input()\nfor i, l in enumerate(s):\n if d != l:\n cd += 1\n d = l\n if i and s[i - 1] == s[i]:\n score += 1\nif cd > 2:\n t = min(k, ((cd - 2) + 1) \/ 2)\n k -= t\n score += 2 * t\n cd -= 2 * t\nif cd == 2 and k:\n score += 1\n cd -= 1\nprint(score)\n","code_same":false,"relative_loc_diff_percent":13.6363636364,"diff":["+score, d, cd = 0, None, 0","-cd = 0","-d = None","-for l in s:","+for i, l in enumerate(s):","-score = 0","-for u, v in zip(s, s[1:]):","- if u == v:","+ if i and s[i - 1] == s[i]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0424674575,"measured_runtime_v1":0.0341674216,"runtime_lift":1.2429225138,"key":["s247815671","s958874016"]} +{"user_id":"u461833298","problem_id":"p03476","language":"python","submission_id_v0":"s943410739","submission_id_v1":"s121324240","cpu_time_v0":669,"cpu_time_v1":454,"memory_v0":36464,"memory_v1":26656,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.14,"input":"import numpy as np\n\nimport itertools\n\nQ = int(eval(input()))\n\nLR = [[int(x) for x in input().split()] for _ in range(Q)]\n\n\n\n\n\n## \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\n\nMAX = 10**5\n\nis_prime = np.full(MAX, True)\n\nis_prime[0] = is_prime[1] = False\n\nfor i in range(2, int(MAX**.5)+1):\n\n if is_prime[i]:\n\n is_prime[i*i::i] = False\n\n \n\nNUM = np.zeros(MAX)\n\nfor p in range(MAX):\n\n if is_prime[p] and is_prime[(p+1)\/\/2]:\n\n NUM[p] += 1\n\n\n\nNUMcum = [0] + list(itertools.accumulate(NUM))\n\n\n\nfor l, r in LR:\n\n print((int(NUMcum[r+1] - NUMcum[l])))","target":"import itertools\n\nQ = int(eval(input()))\n\nLR = [[int(x) for x in input().split()] for _ in range(Q)]\n\n\n\nMAX = 10**5\n\nis_prime = [True] * MAX\n\nis_prime[0] = is_prime[1] = False\n\nfor i in range(2, int(MAX**.5)+1):\n\n if is_prime[i]:\n\n for j in range(i*i, MAX, i):\n\n is_prime[j] = False\n\n\n\nNUM = [0] * MAX\n\nfor p in range(MAX):\n\n if is_prime[p] and is_prime[(p+1)\/\/2]:\n\n NUM[p] += 1\n\nNUMcum = [0] + list(itertools.accumulate(NUM))\n\nfor l, r in LR:\n\n print((int(NUMcum[r+1] - NUMcum[l])))","code_v0_loc":23,"code_v1_loc":19,"code_v0_num_chars":530,"code_v1_num_chars":509,"code_v0_no_empty_lines":"import numpy as np\nimport itertools\n\nQ = int(eval(input()))\nLR = [[int(x) for x in input().split()] for _ in range(Q)]\n## \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9\nMAX = 10**5\nis_prime = np.full(MAX, True)\nis_prime[0] = is_prime[1] = False\nfor i in range(2, int(MAX**0.5) + 1):\n if is_prime[i]:\n is_prime[i * i :: i] = False\nNUM = np.zeros(MAX)\nfor p in range(MAX):\n if is_prime[p] and is_prime[(p + 1) \/\/ 2]:\n NUM[p] += 1\nNUMcum = [0] + list(itertools.accumulate(NUM))\nfor l, r in LR:\n print((int(NUMcum[r + 1] - NUMcum[l])))\n","code_v1_no_empty_lines":"import itertools\n\nQ = int(eval(input()))\nLR = [[int(x) for x in input().split()] for _ in range(Q)]\nMAX = 10**5\nis_prime = [True] * MAX\nis_prime[0] = is_prime[1] = False\nfor i in range(2, int(MAX**0.5) + 1):\n if is_prime[i]:\n for j in range(i * i, MAX, i):\n is_prime[j] = False\nNUM = [0] * MAX\nfor p in range(MAX):\n if is_prime[p] and is_prime[(p + 1) \/\/ 2]:\n NUM[p] += 1\nNUMcum = [0] + list(itertools.accumulate(NUM))\nfor l, r in LR:\n print((int(NUMcum[r + 1] - NUMcum[l])))\n","code_same":false,"relative_loc_diff_percent":17.3913043478,"diff":["-import numpy as np","-## \u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9","-is_prime = np.full(MAX, True)","+is_prime = [True] * MAX","- is_prime[i * i :: i] = False","-NUM = np.zeros(MAX)","+ for j in range(i * i, MAX, i):","+ is_prime[j] = False","+NUM = [0] * MAX"],"diff_only_import_comment":false,"measured_runtime_v0":0.6050167177,"measured_runtime_v1":0.2679086847,"runtime_lift":2.2582945314,"key":["s943410739","s121324240"]} +{"user_id":"u312025627","problem_id":"p03328","language":"python","submission_id_v0":"s477000286","submission_id_v1":"s567496648","cpu_time_v0":182,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.66,"input":"a, b = (int(i) for i in input().split())\n\nprint((sum(range(b-a))-a))","target":"a, b = (int(i) for i in input().split())\n\nc = b - a\n\nd = c*(c+1)\/\/2\n\nprint((d - b))\n","code_v0_loc":2,"code_v1_loc":4,"code_v0_num_chars":66,"code_v1_num_chars":82,"code_v0_no_empty_lines":"a, b = (int(i) for i in input().split())\nprint((sum(range(b - a)) - a))\n","code_v1_no_empty_lines":"a, b = (int(i) for i in input().split())\nc = b - a\nd = c * (c + 1) \/\/ 2\nprint((d - b))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-print((sum(range(b - a)) - a))","+c = b - a","+d = c * (c + 1) \/\/ 2","+print((d - b))"],"diff_only_import_comment":false,"measured_runtime_v0":0.047668213,"measured_runtime_v1":0.0896907634,"runtime_lift":0.5314729317,"key":["s477000286","s567496648"]} +{"user_id":"u935254309","problem_id":"p02971","language":"python","submission_id_v0":"s941428782","submission_id_v1":"s317882952","cpu_time_v0":558,"cpu_time_v1":468,"memory_v0":14092,"memory_v1":20112,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.13,"input":"N = int(eval(input()))\n\n\n\nA = [0]*N\n\n\n\nfor i in range(N):\n\n A[i] = int(eval(input()))\n\n \n\n \n\na = sorted(A)\n\n\n\nMax = a[len(a)-1]\n\nPreMax = a[len(a)-2]\n\n\n\nfor i in range(N):\n\n \n\n if A[i] < Max:\n\n print(Max)\n\n else:\n\n print(PreMax)","target":"N = int(eval(input()))\n\nA=[0] * N\n\n\n\nfor i in range(N):\n\n A[i] = int(eval(input()))\n\n\n\nright = [0]\n\nleft =[0]\n\n\n\nfor a in A:\n\n left.append(max(a,left[-1]))\n\n \n\nfor a in reversed(A):\n\n right.append(max(a,right[-1]))\n\n\n\n \n\nfor i in range(N):\n\n ans = max(left[i], right[N-i-1] )\n\n print(ans)\n","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":248,"code_v1_num_chars":299,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [0] * N\nfor i in range(N):\n A[i] = int(eval(input()))\na = sorted(A)\nMax = a[len(a) - 1]\nPreMax = a[len(a) - 2]\nfor i in range(N):\n if A[i] < Max:\n print(Max)\n else:\n print(PreMax)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [0] * N\nfor i in range(N):\n A[i] = int(eval(input()))\nright = [0]\nleft = [0]\nfor a in A:\n left.append(max(a, left[-1]))\nfor a in reversed(A):\n right.append(max(a, right[-1]))\nfor i in range(N):\n ans = max(left[i], right[N - i - 1])\n print(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a = sorted(A)","-Max = a[len(a) - 1]","-PreMax = a[len(a) - 2]","+right = [0]","+left = [0]","+for a in A:","+ left.append(max(a, left[-1]))","+for a in reversed(A):","+ right.append(max(a, right[-1]))","- if A[i] < Max:","- print(Max)","- else:","- print(PreMax)","+ ans = max(left[i], right[N - i - 1])","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0397907221,"measured_runtime_v1":0.0393832108,"runtime_lift":1.0103473357,"key":["s941428782","s317882952"]} +{"user_id":"u078042885","problem_id":"p00534","language":"python","submission_id_v0":"s138458281","submission_id_v1":"s185584799","cpu_time_v0":1140,"cpu_time_v1":1030,"memory_v0":31284,"memory_v1":23208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.65,"input":"dp=[[1<<30 for _ in range(1001)] for _ in range(1001)]\n\ndp[0][0]=0\n\nn,m=list(map(int,input().split()))\n\nd=[int(eval(input())) for _ in range(n)]+[0]\n\nc=[int(eval(input())) for _ in range(m)]+[0]\n\nfor i in range(m):\n\n for j in range(n+1):\n\n if dp[i][j]< dp[i+1][j]:dp[i+1][j]=dp[i][j]\n\n e=d[j]*c[i]\n\n if dp[i][j]+e=3: raw_input=input\n\n\n\ndef insertionSort(a,g):\n\n global cnt\n\n for i in range(g,len(a)):\n\n v = a[i]\n\n j = i - g\n\n while j >= 0 and a[j] > v:\n\n a[j+g] = a[j]\n\n j = j - g\n\n cnt+=1\n\n a[j+g] = v\n\n\n\n\n\ndef shellSort(a):\n\n global cnt\n\n cnt = 0\n\n g = []\n\n h = 1\n\n while h <= len(a):\n\n g.append(h)\n\n h = 3*h+1\n\n g.reverse()\n\n m = len(g)\n\n print(m)\n\n print((' '.join(map(str,g))))\n\n for i in range(m):\n\n insertionSort(a,g[i])\n\n\n\n\n\na=[int(input()) for i in range(int(input()))]\n\nshellSort(a)\n\nprint(cnt)\n\nfor e in a: print(e)","target":"import math\n\n\n\n\n\ndef insertionsort(a, n, g):\n\n cnt = 0\n\n for i in range(g, n):\n\n v = a[i]\n\n j = i - g\n\n while j >= 0 and a[j] > v:\n\n a[j + g] = a[j]\n\n j = j - g\n\n cnt += 1\n\n a[j + g] = v\n\n return cnt\n\n\n\n\n\ndef shellsort(a, n):\n\n g = []\n\n gap = 1\n\n while gap <= math.ceil(n \/ 3):\n\n g.append(gap)\n\n gap = 3 * gap + 1\n\n g = g[::-1]\n\n m = len(g)\n\n print(m)\n\n print((*g))\n\n cnt = 0\n\n for i in range(m):\n\n cnt += insertionsort(a, n, g[i])\n\n print(cnt)\n\n\n\nn = int(eval(input()))\n\na = []\n\nfor i in range(n):\n\n a.append(int(eval(input())))\n\nshellsort(a, n)\n\nprint((\"\\n\".join(map(str, a))))","code_v0_loc":35,"code_v1_loc":37,"code_v0_num_chars":676,"code_v1_num_chars":687,"code_v0_no_empty_lines":"import sys\n\nif sys.version_info[0] >= 3:\n raw_input = input\n\n\ndef insertionSort(a, g):\n global cnt\n for i in range(g, len(a)):\n v = a[i]\n j = i - g\n while j >= 0 and a[j] > v:\n a[j + g] = a[j]\n j = j - g\n cnt += 1\n a[j + g] = v\n\n\ndef shellSort(a):\n global cnt\n cnt = 0\n g = []\n h = 1\n while h <= len(a):\n g.append(h)\n h = 3 * h + 1\n g.reverse()\n m = len(g)\n print(m)\n print((\" \".join(map(str, g))))\n for i in range(m):\n insertionSort(a, g[i])\n\n\na = [int(input()) for i in range(int(input()))]\nshellSort(a)\nprint(cnt)\nfor e in a:\n print(e)\n","code_v1_no_empty_lines":"import math\n\n\ndef insertionsort(a, n, g):\n cnt = 0\n for i in range(g, n):\n v = a[i]\n j = i - g\n while j >= 0 and a[j] > v:\n a[j + g] = a[j]\n j = j - g\n cnt += 1\n a[j + g] = v\n return cnt\n\n\ndef shellsort(a, n):\n g = []\n gap = 1\n while gap <= math.ceil(n \/ 3):\n g.append(gap)\n gap = 3 * gap + 1\n g = g[::-1]\n m = len(g)\n print(m)\n print((*g))\n cnt = 0\n for i in range(m):\n cnt += insertionsort(a, n, g[i])\n print(cnt)\n\n\nn = int(eval(input()))\na = []\nfor i in range(n):\n a.append(int(eval(input())))\nshellsort(a, n)\nprint((\"\\n\".join(map(str, a))))\n","code_same":false,"relative_loc_diff_percent":5.4054054054,"diff":["-import sys","-","-if sys.version_info[0] >= 3:","- raw_input = input","+import math","-def insertionSort(a, g):","- global cnt","- for i in range(g, len(a)):","+def insertionsort(a, n, g):","+ cnt = 0","+ for i in range(g, n):","- a[j + g] = v","+ a[j + g] = v","+ return cnt","-def shellSort(a):","- global cnt","- cnt = 0","+def shellsort(a, n):","- h = 1","- while h <= len(a):","- g.append(h)","- h = 3 * h + 1","- g.reverse()","+ gap = 1","+ while gap <= math.ceil(n \/ 3):","+ g.append(gap)","+ gap = 3 * gap + 1","+ g = g[::-1]","- print((\" \".join(map(str, g))))","+ print((*g))","+ cnt = 0","- insertionSort(a, g[i])","+ cnt += insertionsort(a, n, g[i])","+ print(cnt)","-a = [int(input()) for i in range(int(input()))]","-shellSort(a)","-print(cnt)","-for e in a:","- print(e)","+n = int(eval(input()))","+a = []","+for i in range(n):","+ a.append(int(eval(input())))","+shellsort(a, n)","+print((\"\\n\".join(map(str, a))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0358654294,"measured_runtime_v1":0.0403513192,"runtime_lift":0.8888291653,"key":["s687751126","s573683398"]} +{"user_id":"u991567869","problem_id":"p02844","language":"python","submission_id_v0":"s815502519","submission_id_v1":"s437406181","cpu_time_v0":33,"cpu_time_v1":28,"memory_v0":9284,"memory_v1":9248,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.15,"input":"from itertools import product\n\n\n\nn = int(eval(input()))\n\ns = eval(input())\n\nans = 0\n\n\n\nfor i in product(list(range(10)), repeat = 3):\n\n a = s.find(str(i[0]))\n\n if a != -1 and a != n - 1:\n\n b = s[a + 1:].find(str(i[1]))\n\n if b != -1:\n\n b += a + 1\n\n if b != n - 1:\n\n c = s[b + 1:].find(str(i[2]))\n\n if c != -1:\n\n ans += 1\n\nprint(ans)","target":"n = int(eval(input()))\n\ns = eval(input())\n\nans = 0\n\n\n\nfor i in range(1000):\n\n i = str(i).zfill(3)\n\n a = s.find(i[0])\n\n if a != -1:\n\n b = s.find(i[1], a + 1)\n\n if b != -1:\n\n c = s.find(i[2], b + 1)\n\n if c != -1:\n\n ans += 1\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":14,"code_v0_num_chars":404,"code_v1_num_chars":281,"code_v0_no_empty_lines":"from itertools import product\n\nn = int(eval(input()))\ns = eval(input())\nans = 0\nfor i in product(list(range(10)), repeat=3):\n a = s.find(str(i[0]))\n if a != -1 and a != n - 1:\n b = s[a + 1 :].find(str(i[1]))\n if b != -1:\n b += a + 1\n if b != n - 1:\n c = s[b + 1 :].find(str(i[2]))\n if c != -1:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\nans = 0\nfor i in range(1000):\n i = str(i).zfill(3)\n a = s.find(i[0])\n if a != -1:\n b = s.find(i[1], a + 1)\n if b != -1:\n c = s.find(i[2], b + 1)\n if c != -1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":17.6470588235,"diff":["-from itertools import product","-","-for i in product(list(range(10)), repeat=3):","- a = s.find(str(i[0]))","- if a != -1 and a != n - 1:","- b = s[a + 1 :].find(str(i[1]))","+for i in range(1000):","+ i = str(i).zfill(3)","+ a = s.find(i[0])","+ if a != -1:","+ b = s.find(i[1], a + 1)","- b += a + 1","- if b != n - 1:","- c = s[b + 1 :].find(str(i[2]))","- if c != -1:","- ans += 1","+ c = s.find(i[2], b + 1)","+ if c != -1:","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373061769,"measured_runtime_v1":0.0819390016,"runtime_lift":0.455292061,"key":["s815502519","s437406181"]} +{"user_id":"u255943004","problem_id":"p02647","language":"python","submission_id_v0":"s955523454","submission_id_v1":"s252186747","cpu_time_v0":388,"cpu_time_v1":266,"memory_v0":171928,"memory_v1":152388,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.44,"input":"N,K = list(map(int,input().split()))\n\nA = [int(i) for i in input().split()]\n\nloop = min(41,K)\n\nfor _ in range(loop):\n\n B = [0]*N\n\n for n in range(N):\n\n l = max(0,n-A[n])\n\n r = min(N-1,n+A[n])\n\n B[l]+=1\n\n if r+1= 0 and D[i][j] <= L:\n\n G2[i][j] = 1\n\n\n\n g2 = csgraph_from_dense(G2, null_value=-1)\n\n D = dijkstra(g2)\n\n\n\n\n\n Q = int(eval(input()))\n\n for _ in range(Q):\n\n s, t = list(map(int, input().split()))\n\n s -= 1\n\n t -= 1\n\n if D[s][t] <= N**2:\n\n print((int(D[s][t])-1))\n\n else:\n\n print((-1))\n\n\n\n\n\nmain()\n","target":"from scipy.sparse.csgraph import csgraph_from_dense, shortest_path\n\n\n\n\n\ndef main():\n\n import heapq\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n N, M, L = list(map(int, input().split()))\n\n\n\n G = [[-1]*N for i in range(N)]\n\n\n\n for i in range(M):\n\n A, B, C = list(map(int, input().split()))\n\n A -= 1\n\n B -= 1\n\n G[A][B] = C\n\n G[B][A] = C\n\n g = csgraph_from_dense(G, null_value=-1)\n\n D = shortest_path(g)\n\n G2 = [[-1]*N for i in range(N)]\n\n for i in range(N):\n\n for j in range(N):\n\n if D[i][j] >= 0 and D[i][j] <= L:\n\n G2[i][j] = 1\n\n\n\n g2 = csgraph_from_dense(G2, null_value=-1)\n\n D = shortest_path(g2)\n\n\n\n Q = int(eval(input()))\n\n for _ in range(Q):\n\n s, t = list(map(int, input().split()))\n\n s -= 1\n\n t -= 1\n\n if D[s][t] <= N**2:\n\n print((int(D[s][t])-1))\n\n else:\n\n print((-1))\n\n\n\n\n\nmain()\n","code_v0_loc":41,"code_v1_loc":40,"code_v0_num_chars":919,"code_v1_num_chars":932,"code_v0_no_empty_lines":"from scipy.sparse.csgraph import csgraph_from_dense, dijkstra\n\n\ndef main():\n import heapq\n import sys\n\n input = sys.stdin.buffer.readline\n N, M, L = list(map(int, input().split()))\n G = [[-1] * N for i in range(N)]\n for i in range(M):\n A, B, C = list(map(int, input().split()))\n A -= 1\n B -= 1\n G[A][B] = C\n G[B][A] = C\n g = csgraph_from_dense(G, null_value=-1)\n D = dijkstra(g)\n G2 = [[-1] * N for i in range(N)]\n for i in range(N):\n for j in range(N):\n if D[i][j] >= 0 and D[i][j] <= L:\n G2[i][j] = 1\n g2 = csgraph_from_dense(G2, null_value=-1)\n D = dijkstra(g2)\n Q = int(eval(input()))\n for _ in range(Q):\n s, t = list(map(int, input().split()))\n s -= 1\n t -= 1\n if D[s][t] <= N**2:\n print((int(D[s][t]) - 1))\n else:\n print((-1))\n\n\nmain()\n","code_v1_no_empty_lines":"from scipy.sparse.csgraph import csgraph_from_dense, shortest_path\n\n\ndef main():\n import heapq\n import sys\n\n input = sys.stdin.buffer.readline\n N, M, L = list(map(int, input().split()))\n G = [[-1] * N for i in range(N)]\n for i in range(M):\n A, B, C = list(map(int, input().split()))\n A -= 1\n B -= 1\n G[A][B] = C\n G[B][A] = C\n g = csgraph_from_dense(G, null_value=-1)\n D = shortest_path(g)\n G2 = [[-1] * N for i in range(N)]\n for i in range(N):\n for j in range(N):\n if D[i][j] >= 0 and D[i][j] <= L:\n G2[i][j] = 1\n g2 = csgraph_from_dense(G2, null_value=-1)\n D = shortest_path(g2)\n Q = int(eval(input()))\n for _ in range(Q):\n s, t = list(map(int, input().split()))\n s -= 1\n t -= 1\n if D[s][t] <= N**2:\n print((int(D[s][t]) - 1))\n else:\n print((-1))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":2.4390243902,"diff":["-from scipy.sparse.csgraph import csgraph_from_dense, dijkstra","+from scipy.sparse.csgraph import csgraph_from_dense, shortest_path","- D = dijkstra(g)","+ D = shortest_path(g)","- D = dijkstra(g2)","+ D = shortest_path(g2)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2994745347,"measured_runtime_v1":0.3136769259,"runtime_lift":0.9547228693,"key":["s312198596","s938595488"]} +{"user_id":"u826263061","problem_id":"p03805","language":"python","submission_id_v0":"s713514378","submission_id_v1":"s527299958","cpu_time_v0":45,"cpu_time_v1":25,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.44,"input":"# -*- coding: utf-8 -*-\n\n\"\"\"\n\nCreated on Sun Aug 26 11:59:46 2018\n\n\n\n@author: maezawa\n\n\"\"\"\n\n\n\nn, m = list(map(int, input().split()))\n\narray = [[0]*n for _ in range(n)]\n\nfor i in range(m):\n\n ai, bi = list(map(int, input().split()))\n\n array[ai-1][bi-1] = 1\n\n array[bi-1][ai-1] = 1\n\n\n\n#print(array)\n\n#dp = [[-1]*n for _ in range(n)]\n\ndone = []\n\n\n\ndef f(i,done):\n\n if i in done:\n\n return 0\n\n if len(done) == n-1:\n\n return 1\n\n if sum(array[i]) == 1 and i != 0:\n\n return 0\n\n #if dp[i][j] != -1:\n\n # return dp[i][j]\n\n donecopy = done + [i]\n\n #print(donecopy)\n\n ans = sum([f(bi,donecopy) for bi in range(n) if array[i][bi] != 0])\n\n return ans\n\n\n\nprint((f(0,done)))","target":"import itertools as it\n\n\n\nn, m = list(map(int,input().split()))\n\nnodes = [[] for _ in range(n)] \n\nfor i in range(m):\n\n ai, bi = list(map(int, input().split()))\n\n nodes[ai-1].append(bi-1)\n\n nodes[bi-1].append(ai-1)\n\ncnt = 0\n\nfor perm in it.permutations(list(range(1,n)),n-1):\n\n i = 0\n\n ok = True\n\n for j in perm:\n\n if j not in nodes[i]:\n\n ok = False\n\n break\n\n i = j\n\n if ok:\n\n cnt += 1\n\n \n\nprint(cnt)","code_v0_loc":33,"code_v1_loc":21,"code_v0_num_chars":714,"code_v1_num_chars":468,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Aug 26 11:59:46 2018\n@author: maezawa\n\"\"\"\nn, m = list(map(int, input().split()))\narray = [[0] * n for _ in range(n)]\nfor i in range(m):\n ai, bi = list(map(int, input().split()))\n array[ai - 1][bi - 1] = 1\n array[bi - 1][ai - 1] = 1\n# print(array)\n# dp = [[-1]*n for _ in range(n)]\ndone = []\n\n\ndef f(i, done):\n if i in done:\n return 0\n if len(done) == n - 1:\n return 1\n if sum(array[i]) == 1 and i != 0:\n return 0\n # if dp[i][j] != -1:\n # return dp[i][j]\n donecopy = done + [i]\n # print(donecopy)\n ans = sum([f(bi, donecopy) for bi in range(n) if array[i][bi] != 0])\n return ans\n\n\nprint((f(0, done)))\n","code_v1_no_empty_lines":"import itertools as it\n\nn, m = list(map(int, input().split()))\nnodes = [[] for _ in range(n)]\nfor i in range(m):\n ai, bi = list(map(int, input().split()))\n nodes[ai - 1].append(bi - 1)\n nodes[bi - 1].append(ai - 1)\ncnt = 0\nfor perm in it.permutations(list(range(1, n)), n - 1):\n i = 0\n ok = True\n for j in perm:\n if j not in nodes[i]:\n ok = False\n break\n i = j\n if ok:\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-# -*- coding: utf-8 -*-","-\"\"\"","-Created on Sun Aug 26 11:59:46 2018","-@author: maezawa","-\"\"\"","+import itertools as it","+","-array = [[0] * n for _ in range(n)]","+nodes = [[] for _ in range(n)]","- array[ai - 1][bi - 1] = 1","- array[bi - 1][ai - 1] = 1","-# print(array)","-# dp = [[-1]*n for _ in range(n)]","-done = []","-","-","-def f(i, done):","- if i in done:","- return 0","- if len(done) == n - 1:","- return 1","- if sum(array[i]) == 1 and i != 0:","- return 0","- # if dp[i][j] != -1:","- # return dp[i][j]","- donecopy = done + [i]","- # print(donecopy)","- ans = sum([f(bi, donecopy) for bi in range(n) if array[i][bi] != 0])","- return ans","-","-","-print((f(0, done)))","+ nodes[ai - 1].append(bi - 1)","+ nodes[bi - 1].append(ai - 1)","+cnt = 0","+for perm in it.permutations(list(range(1, n)), n - 1):","+ i = 0","+ ok = True","+ for j in perm:","+ if j not in nodes[i]:","+ ok = False","+ break","+ i = j","+ if ok:","+ cnt += 1","+print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0381479652,"measured_runtime_v1":0.0482484034,"runtime_lift":0.7906575659,"key":["s713514378","s527299958"]} +{"user_id":"u163783894","problem_id":"p03112","language":"python","submission_id_v0":"s529376929","submission_id_v1":"s426080477","cpu_time_v0":520,"cpu_time_v1":469,"memory_v0":37300,"memory_v1":37540,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.81,"input":"import sys\n\nimport bisect\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\n\n\nin_n = lambda: int(readline())\n\nin_nn = lambda: list(map(int, readline().split()))\n\nin_s = lambda: readline().rstrip().decode('utf-8')\n\n\n\nINF = 10**12\n\nd = lambda a, b: abs(a - b)\n\n\n\n\n\ndef main():\n\n\n\n A, B, Q = in_nn()\n\n tmp = list(map(int, read().split()))\n\n s = tmp[:A]\n\n t = tmp[A:A + B]\n\n x = tmp[A + B:]\n\n\n\n a = [0] * Q\n\n\n\n for i in range(Q):\n\n\n\n n = x[i]\n\n\n\n if n <= s[0]:\n\n a1 = -INF\n\n a2 = s[0]\n\n elif n >= s[-1]:\n\n a1 = s[-1]\n\n a2 = INF\n\n else:\n\n si = bisect.bisect_right(s, n)\n\n a1 = s[si - 1]\n\n a2 = s[si]\n\n\n\n if n <= t[0]:\n\n b1 = -INF\n\n b2 = t[0]\n\n elif n >= t[-1]:\n\n b1 = t[-1]\n\n b2 = INF\n\n else:\n\n ti = bisect.bisect_right(t, n)\n\n b1 = t[ti - 1]\n\n b2 = t[ti]\n\n\n\n # print(a1, a2, b1, b2)\n\n ans = d(n, a1) + min(d(a1, b1), d(a1, b2))\n\n ans = min(ans, d(n, a2) + min(d(a2, b1), d(a2, b2)))\n\n ans = min(ans, d(n, b1) + min(d(b1, a1), d(b1, a2)))\n\n ans = min(ans, d(n, b2) + min(d(b2, a1), d(b2, a2)))\n\n a[i] = ans\n\n\n\n print(('\\n'.join(map(str, a))))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nimport bisect\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\n\n\nin_n = lambda: int(readline())\n\nin_nn = lambda: list(map(int, readline().split()))\n\nin_s = lambda: readline().rstrip().decode('utf-8')\n\n\n\nINF = 10**12\n\n\n\n\n\ndef main():\n\n\n\n A, B, Q = in_nn()\n\n tmp = list(map(int, read().split()))\n\n s = [-INF] + tmp[:A] + [INF]\n\n t = [-INF] + tmp[A:A + B] + [INF]\n\n x = tmp[A + B:]\n\n\n\n a = [0] * Q\n\n d = lambda a, b: abs(a - b)\n\n\n\n for i in range(Q):\n\n\n\n n = x[i]\n\n\n\n si = bisect.bisect_right(s, n)\n\n a1 = s[si - 1]\n\n a2 = s[si]\n\n\n\n ti = bisect.bisect_right(t, n)\n\n b1 = t[ti - 1]\n\n b2 = t[ti]\n\n\n\n ans = d(n, a1) + min(d(a1, b1), d(a1, b2))\n\n ans = min(ans, d(n, a2) + min(d(a2, b1), d(a2, b2)))\n\n ans = min(ans, d(n, b1) + min(d(b1, a1), d(b1, a2)))\n\n ans = min(ans, d(n, b2) + min(d(b2, a1), d(b2, a2)))\n\n a[i] = ans\n\n\n\n print(('\\n'.join(map(str, a))))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":61,"code_v1_loc":46,"code_v0_num_chars":1362,"code_v1_num_chars":1031,"code_v0_no_empty_lines":"import sys\nimport bisect\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nin_n = lambda: int(readline())\nin_nn = lambda: list(map(int, readline().split()))\nin_s = lambda: readline().rstrip().decode(\"utf-8\")\nINF = 10**12\nd = lambda a, b: abs(a - b)\n\n\ndef main():\n A, B, Q = in_nn()\n tmp = list(map(int, read().split()))\n s = tmp[:A]\n t = tmp[A : A + B]\n x = tmp[A + B :]\n a = [0] * Q\n for i in range(Q):\n n = x[i]\n if n <= s[0]:\n a1 = -INF\n a2 = s[0]\n elif n >= s[-1]:\n a1 = s[-1]\n a2 = INF\n else:\n si = bisect.bisect_right(s, n)\n a1 = s[si - 1]\n a2 = s[si]\n if n <= t[0]:\n b1 = -INF\n b2 = t[0]\n elif n >= t[-1]:\n b1 = t[-1]\n b2 = INF\n else:\n ti = bisect.bisect_right(t, n)\n b1 = t[ti - 1]\n b2 = t[ti]\n # print(a1, a2, b1, b2)\n ans = d(n, a1) + min(d(a1, b1), d(a1, b2))\n ans = min(ans, d(n, a2) + min(d(a2, b1), d(a2, b2)))\n ans = min(ans, d(n, b1) + min(d(b1, a1), d(b1, a2)))\n ans = min(ans, d(n, b2) + min(d(b2, a1), d(b2, a2)))\n a[i] = ans\n print((\"\\n\".join(map(str, a))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport bisect\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nin_n = lambda: int(readline())\nin_nn = lambda: list(map(int, readline().split()))\nin_s = lambda: readline().rstrip().decode(\"utf-8\")\nINF = 10**12\n\n\ndef main():\n A, B, Q = in_nn()\n tmp = list(map(int, read().split()))\n s = [-INF] + tmp[:A] + [INF]\n t = [-INF] + tmp[A : A + B] + [INF]\n x = tmp[A + B :]\n a = [0] * Q\n d = lambda a, b: abs(a - b)\n for i in range(Q):\n n = x[i]\n si = bisect.bisect_right(s, n)\n a1 = s[si - 1]\n a2 = s[si]\n ti = bisect.bisect_right(t, n)\n b1 = t[ti - 1]\n b2 = t[ti]\n ans = d(n, a1) + min(d(a1, b1), d(a1, b2))\n ans = min(ans, d(n, a2) + min(d(a2, b1), d(a2, b2)))\n ans = min(ans, d(n, b1) + min(d(b1, a1), d(b1, a2)))\n ans = min(ans, d(n, b2) + min(d(b2, a1), d(b2, a2)))\n a[i] = ans\n print((\"\\n\".join(map(str, a))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":24.5901639344,"diff":["-d = lambda a, b: abs(a - b)","- s = tmp[:A]","- t = tmp[A : A + B]","+ s = [-INF] + tmp[:A] + [INF]","+ t = [-INF] + tmp[A : A + B] + [INF]","+ d = lambda a, b: abs(a - b)","- if n <= s[0]:","- a1 = -INF","- a2 = s[0]","- elif n >= s[-1]:","- a1 = s[-1]","- a2 = INF","- else:","- si = bisect.bisect_right(s, n)","- a1 = s[si - 1]","- a2 = s[si]","- if n <= t[0]:","- b1 = -INF","- b2 = t[0]","- elif n >= t[-1]:","- b1 = t[-1]","- b2 = INF","- else:","- ti = bisect.bisect_right(t, n)","- b1 = t[ti - 1]","- b2 = t[ti]","- # print(a1, a2, b1, b2)","+ si = bisect.bisect_right(s, n)","+ a1 = s[si - 1]","+ a2 = s[si]","+ ti = bisect.bisect_right(t, n)","+ b1 = t[ti - 1]","+ b2 = t[ti]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422716996,"measured_runtime_v1":0.0411461262,"runtime_lift":1.0273555129,"key":["s529376929","s426080477"]} +{"user_id":"u179169725","problem_id":"p03293","language":"python","submission_id_v0":"s018313502","submission_id_v1":"s088688816","cpu_time_v0":174,"cpu_time_v1":22,"memory_v0":38256,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.36,"input":"import sys\n\nsys.setrecursionlimit(1 << 25)\n\nread = sys.stdin.readline\n\nra = range\n\nenu = enumerate\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\ndef read_a_int():\n\n return int(read())\n\n\n\n\n\ndef read_tuple(H):\n\n '''\n\n H is number of rows\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(tuple(map(int, read().split())))\n\n return ret\n\n\n\n\n\ndef read_col(H):\n\n '''\n\n H is number of rows\n\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n\n ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(list(map(int, read().split())))\n\n return tuple(map(list, list(zip(*ret))))\n\n\n\n\n\ndef read_matrix(H):\n\n '''\n\n H is number of rows\n\n '''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(list(map(int, read().split())))\n\n return ret\n\n # return [list(map(int, read().split())) for _ in range(H)] # \u5185\u5305\u8868\u8a18\u306fpypy\u3067\u306f\u9045\u3044\u305f\u3081\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\nfrom collections import defaultdict, Counter, deque\n\nfrom operator import itemgetter\n\nfrom itertools import product, permutations, combinations\n\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\n\n\n\n# https:\/\/atcoder.jp\/contests\/abc103\/tasks\/abc103_b\n\nS = eval(input())\n\nT = eval(input())\n\nS = S + S\n\nprint(('Yes' if S.count(T) else 'No'))\n","target":"import sys\n\nsys.setrecursionlimit(1 << 25)\n\nread = sys.stdin.readline\n\nra = range\n\nenu = enumerate\n\n\n\n\n\ndef mina(*argv, sub=1): return list([x - sub for x in argv])\n\n# \u53d7\u3051\u6e21\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u8981\u7d20\u304b\u3089sub\u3060\u3051\u5f15\u304f.\u30ea\u30b9\u30c8\u3092*\u3092\u3064\u3051\u3066\u5c55\u958b\u3057\u3066\u304a\u304f\u3053\u3068\n\n\n\n\n\ndef read_a_int(): return int(read())\n\n\n\n\n\ndef read_ints(): return list(map(int, read().split()))\n\n\n\n\n\ndef read_col(H):\n\n '''H is number of rows\n\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n\n ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408'''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(list(map(int, read().split())))\n\n return tuple(map(list, list(zip(*ret))))\n\n\n\n\n\ndef read_tuple(H):\n\n '''H is number of rows'''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(tuple(map(int, read().split())))\n\n return ret\n\n\n\n\n\ndef read_matrix(H):\n\n '''H is number of rows'''\n\n ret = []\n\n for _ in range(H):\n\n ret.append(list(map(int, read().split())))\n\n return ret\n\n # return [list(map(int, read().split())) for _ in range(H)] # \u5185\u5305\u8868\u8a18\u306fpypy\u3067\u306f\u9045\u3044\u305f\u3081\n\n\n\n\n\nMOD = 10**9 + 7\n\nINF = 2**31 # 2147483648 > 10**9\n\n# default import\n\nfrom collections import defaultdict, Counter, deque\n\nfrom operator import itemgetter\n\nfrom itertools import product, permutations, combinations\n\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\n\n\n\n# https:\/\/atcoder.jp\/contests\/abc103\/tasks\/abc103_b\n\nS = eval(input())\n\nT = eval(input())\n\nS += S\n\n\n\nprint(('Yes' if S.count(T) else 'No'))\n","code_v0_loc":61,"code_v1_loc":58,"code_v0_num_chars":1340,"code_v1_num_chars":1407,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1 << 25)\nread = sys.stdin.readline\nra = range\nenu = enumerate\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_a_int():\n return int(read())\n\n\ndef read_tuple(H):\n \"\"\"\n H is number of rows\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, read().split())))\n return ret\n\n\ndef read_col(H):\n \"\"\"\n H is number of rows\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(list(map(int, read().split())))\n return tuple(map(list, list(zip(*ret))))\n\n\ndef read_matrix(H):\n \"\"\"\n H is number of rows\n \"\"\"\n ret = []\n for _ in range(H):\n ret.append(list(map(int, read().split())))\n return ret\n # return [list(map(int, read().split())) for _ in range(H)] # \u5185\u5305\u8868\u8a18\u306fpypy\u3067\u306f\u9045\u3044\u305f\u3081\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nfrom collections import defaultdict, Counter, deque\nfrom operator import itemgetter\nfrom itertools import product, permutations, combinations\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\n\n# https:\/\/atcoder.jp\/contests\/abc103\/tasks\/abc103_b\nS = eval(input())\nT = eval(input())\nS = S + S\nprint((\"Yes\" if S.count(T) else \"No\"))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1 << 25)\nread = sys.stdin.readline\nra = range\nenu = enumerate\n\n\ndef mina(*argv, sub=1):\n return list([x - sub for x in argv])\n\n\n# \u53d7\u3051\u6e21\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u8981\u7d20\u304b\u3089sub\u3060\u3051\u5f15\u304f.\u30ea\u30b9\u30c8\u3092*\u3092\u3064\u3051\u3066\u5c55\u958b\u3057\u3066\u304a\u304f\u3053\u3068\ndef read_a_int():\n return int(read())\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\ndef read_col(H):\n \"\"\"H is number of rows\n A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d\n ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408\"\"\"\n ret = []\n for _ in range(H):\n ret.append(list(map(int, read().split())))\n return tuple(map(list, list(zip(*ret))))\n\n\ndef read_tuple(H):\n \"\"\"H is number of rows\"\"\"\n ret = []\n for _ in range(H):\n ret.append(tuple(map(int, read().split())))\n return ret\n\n\ndef read_matrix(H):\n \"\"\"H is number of rows\"\"\"\n ret = []\n for _ in range(H):\n ret.append(list(map(int, read().split())))\n return ret\n # return [list(map(int, read().split())) for _ in range(H)] # \u5185\u5305\u8868\u8a18\u306fpypy\u3067\u306f\u9045\u3044\u305f\u3081\n\n\nMOD = 10**9 + 7\nINF = 2**31 # 2147483648 > 10**9\n# default import\nfrom collections import defaultdict, Counter, deque\nfrom operator import itemgetter\nfrom itertools import product, permutations, combinations\nfrom bisect import bisect_left, bisect_right # , insort_left, insort_right\n\n# https:\/\/atcoder.jp\/contests\/abc103\/tasks\/abc103_b\nS = eval(input())\nT = eval(input())\nS += S\nprint((\"Yes\" if S.count(T) else \"No\"))\n","code_same":false,"relative_loc_diff_percent":4.9180327869,"diff":["+def mina(*argv, sub=1):","+ return list([x - sub for x in argv])","+","+","+# \u53d7\u3051\u6e21\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u8981\u7d20\u304b\u3089sub\u3060\u3051\u5f15\u304f.\u30ea\u30b9\u30c8\u3092*\u3092\u3064\u3051\u3066\u5c55\u958b\u3057\u3066\u304a\u304f\u3053\u3068","+def read_a_int():","+ return int(read())","+","+","-def read_a_int():","- return int(read())","+def read_col(H):","+ \"\"\"H is number of rows","+ A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d","+ ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408\"\"\"","+ ret = []","+ for _ in range(H):","+ ret.append(list(map(int, read().split())))","+ return tuple(map(list, list(zip(*ret))))","- \"\"\"","- H is number of rows","- \"\"\"","+ \"\"\"H is number of rows\"\"\"","-def read_col(H):","- \"\"\"","- H is number of rows","- A\u5217\u3001B\u5217\u304c\u4e0e\u3048\u3089\u308c\u308b\u3088\u3046\u306a\u3068\u304d","- ex1)A,B=read_col(H) ex2) A,=read_col(H) #\u4e00\u5217\u306e\u5834\u5408","- \"\"\"","- ret = []","- for _ in range(H):","- ret.append(list(map(int, read().split())))","- return tuple(map(list, list(zip(*ret))))","-","-","- \"\"\"","- H is number of rows","- \"\"\"","+ \"\"\"H is number of rows\"\"\"","-S = S + S","+S += S"],"diff_only_import_comment":false,"measured_runtime_v0":0.0851501815,"measured_runtime_v1":0.0814010334,"runtime_lift":1.046057746,"key":["s018313502","s088688816"]} +{"user_id":"u562935282","problem_id":"p02726","language":"python","submission_id_v0":"s697368103","submission_id_v1":"s342506028","cpu_time_v0":1806,"cpu_time_v1":1299,"memory_v0":3444,"memory_v1":3444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.07,"input":"def dist(a, b):\n\n return min(\n\n abs(a - b),\n\n abs(a - x) + 1 + abs(y - b),\n\n abs(a - y) + 1 + abs(x - b)\n\n )\n\n\n\n\n\nn, x, y = map(int, input().split())\n\nx -= 1\n\ny -= 1\n\n\n\nd = [0] * n\n\n\n\nfor j in range(n):\n\n for i in range(j):\n\n d[dist(i, j)] += 1\n\n\n\nit = iter(d)\n\nnext(it)\n\n\n\nprint(*it, sep='\\n')\n","target":"def main():\n\n N, X, Y = map(int, input().split())\n\n X -= 1\n\n Y -= 1\n\n\n\n ans = [0] * N\n\n for j in range(N):\n\n for i in range(j):\n\n d = min(\n\n j - i,\n\n abs(j - X) + 1 + abs(Y - i),\n\n abs(j - Y) + 1 + abs(X - i)\n\n )\n\n ans[d] += 1\n\n\n\n print(*ans[1:], sep='\\n')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":22,"code_v1_loc":20,"code_v0_num_chars":332,"code_v1_num_chars":404,"code_v0_no_empty_lines":"def dist(a, b):\n return min(abs(a - b), abs(a - x) + 1 + abs(y - b), abs(a - y) + 1 + abs(x - b))\n\n\nn, x, y = map(int, input().split())\nx -= 1\ny -= 1\nd = [0] * n\nfor j in range(n):\n for i in range(j):\n d[dist(i, j)] += 1\nit = iter(d)\nnext(it)\nprint(*it, sep=\"\\n\")\n","code_v1_no_empty_lines":"def main():\n N, X, Y = map(int, input().split())\n X -= 1\n Y -= 1\n ans = [0] * N\n for j in range(N):\n for i in range(j):\n d = min(j - i, abs(j - X) + 1 + abs(Y - i), abs(j - Y) + 1 + abs(X - i))\n ans[d] += 1\n print(*ans[1:], sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-def dist(a, b):","- return min(abs(a - b), abs(a - x) + 1 + abs(y - b), abs(a - y) + 1 + abs(x - b))","+def main():","+ N, X, Y = map(int, input().split())","+ X -= 1","+ Y -= 1","+ ans = [0] * N","+ for j in range(N):","+ for i in range(j):","+ d = min(j - i, abs(j - X) + 1 + abs(Y - i), abs(j - Y) + 1 + abs(X - i))","+ ans[d] += 1","+ print(*ans[1:], sep=\"\\n\")","-n, x, y = map(int, input().split())","-x -= 1","-y -= 1","-d = [0] * n","-for j in range(n):","- for i in range(j):","- d[dist(i, j)] += 1","-it = iter(d)","-next(it)","-print(*it, sep=\"\\n\")","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0399299407,"measured_runtime_v1":0.0440870562,"runtime_lift":0.905706667,"key":["s697368103","s342506028"]} +{"user_id":"u928784113","problem_id":"p03160","language":"python","submission_id_v0":"s859984812","submission_id_v1":"s538766065","cpu_time_v0":345,"cpu_time_v1":238,"memory_v0":78420,"memory_v1":23960,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.01,"input":"import itertools\n\nfrom collections import deque,defaultdict,Counter\n\nfrom itertools import accumulate\n\nimport bisect\n\nfrom heapq import heappop,heappush\n\nfrom fractions import gcd\n\nfrom copy import deepcopy\n\nimport math\n\nimport queue\n\n#import numpy as np\n\n#import sympy as syp(\u7d20\u56e0\u6570\u5206\u89e3\u3068\u304b)\n\nMod = 1000000007\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(1000000) \n\n \n\ndef sieve_of_eratosthenes(n):\n\n if not isinstance(n,int):\n\n raise TypeError(\"n is not int\")\n\n if n<2:\n\n raise ValueError(\"n is not effective\")\n\n prime = [1]*(n+1)\n\n for i in range(2,int(math.sqrt(n))+1):\n\n if prime[i] == 1:\n\n for j in range(2*i,n+1):\n\n if j%i == 0:\n\n prime[j] = 0\n\n res = []\n\n for i in range(2,n+1):\n\n if prime[i] == 1:\n\n res.append(i)\n\n return res\n\n\n\ndef factorial(i):\n\n if i == 1:\n\n return 1\n\n else:\n\n return i*factorial(i-1)\n\n \n\nclass UnionFind:\n\n def __init__(self,n):\n\n self.parent = [i for i in range(n+1)]\n\n self.rank = [0 for i in range(n+1)]\n\n \n\n def findroot(self,x):\n\n if x == self.parent[x]:\n\n return x\n\n else:\n\n y = self.parent[x]\n\n y = self.findroot(self.parent[x])\n\n return y\n\n \n\n def union(self,x,y):\n\n px = self.findroot(x)\n\n py = self.findroot(y)\n\n if px < py:\n\n self.parent[py] = px\n\n else:\n\n self.parent[px] = py\n\n \n\n def same_group_or_no(self,x,y):\n\n return self.findroot(x) == self.findroot(y)\n\n\n\n\n\n\n\n \n\ndef main(): #startline--------------------------------------------\n\n n = int(eval(input()))\n\n h = list(map(int,input().split()))\n\n\n\n dp = [0]*n\n\n dp[1] = abs(h[1]-h[0])\n\n for i in range(1,n-1):\n\n dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]),dp[i-1]+abs(h[i+1]-h[i-1]))\n\n print((dp[n-1]))\n\nif __name__ == \"__main__\":\n\n main() #endline===============================================\n\n ","target":"import itertools\n\nfrom collections import deque,defaultdict,Counter\n\nfrom itertools import accumulate\n\nimport bisect\n\nfrom heapq import heappop,heappush,heapify\n\nfrom fractions import gcd\n\nfrom copy import deepcopy\n\nimport math\n\nimport queue\n\nimport numpy as np\n\n#import sympy as syp(\u7d20\u56e0\u6570\u5206\u89e3\u3068\u304b)\n\nMod = 1000000007\n\nimport sys\n\nsys.setrecursionlimit(100000) \n\n \n\ndef sieve_of_eratosthenes(n):\n\n if not isinstance(n,int):\n\n raise TypeError(\"n is not int\")\n\n if n<2:\n\n raise ValueError(\"n is not effective\")\n\n prime = [1]*(n+1)\n\n for i in range(2,int(math.sqrt(n))+1):\n\n if prime[i] == 1:\n\n for j in range(2*i,n+1):\n\n if j%i == 0:\n\n prime[j] = 0\n\n res = []\n\n for i in range(2,n+1):\n\n if prime[i] == 1:\n\n res.append(i)\n\n return res\n\n\n\n \n\nclass UnionFind:\n\n def __init__(self,n):\n\n self.parent = [i for i in range(n+1)]\n\n self.rank = [0 for i in range(n+1)]\n\n \n\n def findroot(self,x):\n\n if x == self.parent[x]:\n\n return x\n\n else:\n\n y = self.parent[x]\n\n y = self.findroot(self.parent[x])\n\n return y\n\n \n\n def union(self,x,y):\n\n px = self.findroot(x)\n\n py = self.findroot(y)\n\n if px < py:\n\n self.parent[py] = px\n\n else:\n\n self.parent[px] = py\n\n \n\n def same_group_or_no(self,x,y):\n\n return self.findroot(x) == self.findroot(y)\n\n\n\ndef main(): #startline-------------------------------------------\n\n n = int(eval(input()))\n\n h = list(map(int,input().split()))\n\n dp = [0]*(n)\n\n dp[1] = abs(h[1]-h[0])\n\n for i in range(2,n):\n\n dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))\n\n print((dp[n-1]))\n\nif __name__ == \"__main__\":\n\n main() #endline===============================================","code_v0_loc":78,"code_v1_loc":67,"code_v0_num_chars":2002,"code_v1_num_chars":1858,"code_v0_no_empty_lines":"import itertools\nfrom collections import deque, defaultdict, Counter\nfrom itertools import accumulate\nimport bisect\nfrom heapq import heappop, heappush\nfrom fractions import gcd\nfrom copy import deepcopy\nimport math\nimport queue\n\n# import numpy as np\n# import sympy as syp(\u7d20\u56e0\u6570\u5206\u89e3\u3068\u304b)\nMod = 1000000007\nimport sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(1000000)\n\n\ndef sieve_of_eratosthenes(n):\n if not isinstance(n, int):\n raise TypeError(\"n is not int\")\n if n < 2:\n raise ValueError(\"n is not effective\")\n prime = [1] * (n + 1)\n for i in range(2, int(math.sqrt(n)) + 1):\n if prime[i] == 1:\n for j in range(2 * i, n + 1):\n if j % i == 0:\n prime[j] = 0\n res = []\n for i in range(2, n + 1):\n if prime[i] == 1:\n res.append(i)\n return res\n\n\ndef factorial(i):\n if i == 1:\n return 1\n else:\n return i * factorial(i - 1)\n\n\nclass UnionFind:\n def __init__(self, n):\n self.parent = [i for i in range(n + 1)]\n self.rank = [0 for i in range(n + 1)]\n\n def findroot(self, x):\n if x == self.parent[x]:\n return x\n else:\n y = self.parent[x]\n y = self.findroot(self.parent[x])\n return y\n\n def union(self, x, y):\n px = self.findroot(x)\n py = self.findroot(y)\n if px < py:\n self.parent[py] = px\n else:\n self.parent[px] = py\n\n def same_group_or_no(self, x, y):\n return self.findroot(x) == self.findroot(y)\n\n\ndef main(): # startline--------------------------------------------\n n = int(eval(input()))\n h = list(map(int, input().split()))\n dp = [0] * n\n dp[1] = abs(h[1] - h[0])\n for i in range(1, n - 1):\n dp[i + 1] = min(\n dp[i] + abs(h[i + 1] - h[i]), dp[i - 1] + abs(h[i + 1] - h[i - 1])\n )\n print((dp[n - 1]))\n\n\nif __name__ == \"__main__\":\n main() # endline===============================================\n","code_v1_no_empty_lines":"import itertools\nfrom collections import deque, defaultdict, Counter\nfrom itertools import accumulate\nimport bisect\nfrom heapq import heappop, heappush, heapify\nfrom fractions import gcd\nfrom copy import deepcopy\nimport math\nimport queue\nimport numpy as np\n\n# import sympy as syp(\u7d20\u56e0\u6570\u5206\u89e3\u3068\u304b)\nMod = 1000000007\nimport sys\n\nsys.setrecursionlimit(100000)\n\n\ndef sieve_of_eratosthenes(n):\n if not isinstance(n, int):\n raise TypeError(\"n is not int\")\n if n < 2:\n raise ValueError(\"n is not effective\")\n prime = [1] * (n + 1)\n for i in range(2, int(math.sqrt(n)) + 1):\n if prime[i] == 1:\n for j in range(2 * i, n + 1):\n if j % i == 0:\n prime[j] = 0\n res = []\n for i in range(2, n + 1):\n if prime[i] == 1:\n res.append(i)\n return res\n\n\nclass UnionFind:\n def __init__(self, n):\n self.parent = [i for i in range(n + 1)]\n self.rank = [0 for i in range(n + 1)]\n\n def findroot(self, x):\n if x == self.parent[x]:\n return x\n else:\n y = self.parent[x]\n y = self.findroot(self.parent[x])\n return y\n\n def union(self, x, y):\n px = self.findroot(x)\n py = self.findroot(y)\n if px < py:\n self.parent[py] = px\n else:\n self.parent[px] = py\n\n def same_group_or_no(self, x, y):\n return self.findroot(x) == self.findroot(y)\n\n\ndef main(): # startline-------------------------------------------\n n = int(eval(input()))\n h = list(map(int, input().split()))\n dp = [0] * (n)\n dp[1] = abs(h[1] - h[0])\n for i in range(2, n):\n dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))\n print((dp[n - 1]))\n\n\nif __name__ == \"__main__\":\n main() # endline===============================================\n","code_same":false,"relative_loc_diff_percent":14.1025641026,"diff":["-from heapq import heappop, heappush","+from heapq import heappop, heappush, heapify","+import numpy as np","-# import numpy as np","-input = sys.stdin.readline","-sys.setrecursionlimit(1000000)","+sys.setrecursionlimit(100000)","-","-","-def factorial(i):","- if i == 1:","- return 1","- else:","- return i * factorial(i - 1)","- dp = [0] * n","+ dp = [0] * (n)","- for i in range(1, n - 1):","- dp[i + 1] = min(","- dp[i] + abs(h[i + 1] - h[i]), dp[i - 1] + abs(h[i + 1] - h[i - 1])","- )","+ for i in range(2, n):","+ dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0862286036,"measured_runtime_v1":0.0458903823,"runtime_lift":1.8790125355,"key":["s859984812","s538766065"]} +{"user_id":"u761320129","problem_id":"p03440","language":"python","submission_id_v0":"s384158209","submission_id_v1":"s157077348","cpu_time_v0":785,"cpu_time_v1":543,"memory_v0":29072,"memory_v1":50256,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.83,"input":"N,M = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nXY = [tuple(map(int,input().split())) for i in range(M)]\n\n\n\nclass UnionFind:\n\n def __init__(self,N):\n\n self.parent = [i for i in range(N)]\n\n self.rank = [0] * N\n\n self.count = 0\n\n def root(self,a):\n\n if self.parent[a] == a:\n\n return a\n\n else:\n\n self.parent[a] = self.root(self.parent[a])\n\n return self.parent[a]\n\n def is_same(self,a,b):\n\n return self.root(a) == self.root(b)\n\n def unite(self,a,b):\n\n ra = self.root(a)\n\n rb = self.root(b)\n\n if ra == rb: return\n\n if self.rank[ra] < self.rank[rb]:\n\n self.parent[ra] = rb\n\n else:\n\n self.parent[rb] = ra\n\n if self.rank[ra] == self.rank[rb]: self.rank[ra] += 1\n\n self.count += 1\n\n\n\nuf = UnionFind(N)\n\nfor x,y in XY:\n\n if uf.is_same(x,y): continue\n\n uf.unite(x,y)\n\nfor i in range(N):\n\n uf.root(i)\n\n\n\nc = N - uf.count\n\nif c==1:\n\n print((0))\n\n exit()\n\nex = c-2\n\nif c+ex > N:\n\n print('Impossible')\n\n exit()\n\n\n\nfrom collections import defaultdict\n\nd = defaultdict(lambda: [])\n\nfor i,a in enumerate(A):\n\n r = uf.root(i)\n\n d[r].append(a)\n\n\n\nans = 0\n\nhq = []\n\nfor k in list(d.keys()):\n\n s = sorted(d[k])\n\n ans += s[0]\n\n for v in s[1:]:\n\n hq.append(v)\n\n\n\nimport heapq\n\nheapq.heapify(hq)\n\nfor _ in range(ex):\n\n v = heapq.heappop(hq)\n\n ans += v\n\nprint(ans)","target":"N,M = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nXY = [tuple(map(int,input().split())) for i in range(M)]\n\n\n\nif M==N-1:\n\n print((0))\n\n exit()\n\n\n\nclass UnionFind:\n\n def __init__(self,N):\n\n self.parent = [i for i in range(N)]\n\n self._size = [1] * N\n\n self.count = 0\n\n def root(self,a):\n\n if self.parent[a] == a:\n\n return a\n\n else:\n\n self.parent[a] = self.root(self.parent[a])\n\n return self.parent[a]\n\n def is_same(self,a,b):\n\n return self.root(a) == self.root(b)\n\n def unite(self,a,b):\n\n ra = self.root(a)\n\n rb = self.root(b)\n\n if ra == rb: return\n\n if self._size[ra] < self._size[rb]: ra,rb = rb,ra\n\n self._size[ra] += self._size[rb]\n\n self.parent[rb] = ra\n\n self.count += 1\n\n def size(self,a):\n\n return self._size[self.root(a)]\n\n\n\nuf = UnionFind(N)\n\nfor x,y in XY:\n\n if uf.is_same(x,y): continue\n\n uf.unite(x,y)\n\nfor i in range(N):\n\n uf.root(i)\n\n\n\nfrom collections import defaultdict\n\ndic = defaultdict(lambda: set())\n\nfor i in range(N):\n\n dic[uf.root(i)].add(i)\n\n\n\nneed = (len(dic)-1)*2\n\nif need > N:\n\n print('Impossible')\n\n exit()\n\n\n\nans = used = 0\n\nimport heapq\n\nhq = []\n\nheapq.heapify(hq)\n\nfor r,vs in list(dic.items()):\n\n mini = -1\n\n mina = 10**9+1\n\n for i in vs:\n\n if A[i] < mina:\n\n mina = A[i]\n\n mini = i\n\n ans += mina\n\n used += 1\n\n for i in vs:\n\n if i==mini: continue\n\n heapq.heappush(hq, A[i])\n\n\n\nfor _ in range(need - used):\n\n ans += heapq.heappop(hq)\n\nprint(ans)","code_v0_loc":64,"code_v1_loc":69,"code_v0_num_chars":1461,"code_v1_num_chars":1618,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nXY = [tuple(map(int, input().split())) for i in range(M)]\n\n\nclass UnionFind:\n def __init__(self, N):\n self.parent = [i for i in range(N)]\n self.rank = [0] * N\n self.count = 0\n\n def root(self, a):\n if self.parent[a] == a:\n return a\n else:\n self.parent[a] = self.root(self.parent[a])\n return self.parent[a]\n\n def is_same(self, a, b):\n return self.root(a) == self.root(b)\n\n def unite(self, a, b):\n ra = self.root(a)\n rb = self.root(b)\n if ra == rb:\n return\n if self.rank[ra] < self.rank[rb]:\n self.parent[ra] = rb\n else:\n self.parent[rb] = ra\n if self.rank[ra] == self.rank[rb]:\n self.rank[ra] += 1\n self.count += 1\n\n\nuf = UnionFind(N)\nfor x, y in XY:\n if uf.is_same(x, y):\n continue\n uf.unite(x, y)\nfor i in range(N):\n uf.root(i)\nc = N - uf.count\nif c == 1:\n print((0))\n exit()\nex = c - 2\nif c + ex > N:\n print(\"Impossible\")\n exit()\nfrom collections import defaultdict\n\nd = defaultdict(lambda: [])\nfor i, a in enumerate(A):\n r = uf.root(i)\n d[r].append(a)\nans = 0\nhq = []\nfor k in list(d.keys()):\n s = sorted(d[k])\n ans += s[0]\n for v in s[1:]:\n hq.append(v)\nimport heapq\n\nheapq.heapify(hq)\nfor _ in range(ex):\n v = heapq.heappop(hq)\n ans += v\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nXY = [tuple(map(int, input().split())) for i in range(M)]\nif M == N - 1:\n print((0))\n exit()\n\n\nclass UnionFind:\n def __init__(self, N):\n self.parent = [i for i in range(N)]\n self._size = [1] * N\n self.count = 0\n\n def root(self, a):\n if self.parent[a] == a:\n return a\n else:\n self.parent[a] = self.root(self.parent[a])\n return self.parent[a]\n\n def is_same(self, a, b):\n return self.root(a) == self.root(b)\n\n def unite(self, a, b):\n ra = self.root(a)\n rb = self.root(b)\n if ra == rb:\n return\n if self._size[ra] < self._size[rb]:\n ra, rb = rb, ra\n self._size[ra] += self._size[rb]\n self.parent[rb] = ra\n self.count += 1\n\n def size(self, a):\n return self._size[self.root(a)]\n\n\nuf = UnionFind(N)\nfor x, y in XY:\n if uf.is_same(x, y):\n continue\n uf.unite(x, y)\nfor i in range(N):\n uf.root(i)\nfrom collections import defaultdict\n\ndic = defaultdict(lambda: set())\nfor i in range(N):\n dic[uf.root(i)].add(i)\nneed = (len(dic) - 1) * 2\nif need > N:\n print(\"Impossible\")\n exit()\nans = used = 0\nimport heapq\n\nhq = []\nheapq.heapify(hq)\nfor r, vs in list(dic.items()):\n mini = -1\n mina = 10**9 + 1\n for i in vs:\n if A[i] < mina:\n mina = A[i]\n mini = i\n ans += mina\n used += 1\n for i in vs:\n if i == mini:\n continue\n heapq.heappush(hq, A[i])\nfor _ in range(need - used):\n ans += heapq.heappop(hq)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":7.2463768116,"diff":["+if M == N - 1:","+ print((0))","+ exit()","- self.rank = [0] * N","+ self._size = [1] * N","- if self.rank[ra] < self.rank[rb]:","- self.parent[ra] = rb","- else:","- self.parent[rb] = ra","- if self.rank[ra] == self.rank[rb]:","- self.rank[ra] += 1","+ if self._size[ra] < self._size[rb]:","+ ra, rb = rb, ra","+ self._size[ra] += self._size[rb]","+ self.parent[rb] = ra","+","+ def size(self, a):","+ return self._size[self.root(a)]","-c = N - uf.count","-if c == 1:","- print((0))","- exit()","-ex = c - 2","-if c + ex > N:","+from collections import defaultdict","+","+dic = defaultdict(lambda: set())","+for i in range(N):","+ dic[uf.root(i)].add(i)","+need = (len(dic) - 1) * 2","+if need > N:","-from collections import defaultdict","-","-d = defaultdict(lambda: [])","-for i, a in enumerate(A):","- r = uf.root(i)","- d[r].append(a)","-ans = 0","-hq = []","-for k in list(d.keys()):","- s = sorted(d[k])","- ans += s[0]","- for v in s[1:]:","- hq.append(v)","+ans = used = 0","+hq = []","-for _ in range(ex):","- v = heapq.heappop(hq)","- ans += v","+for r, vs in list(dic.items()):","+ mini = -1","+ mina = 10**9 + 1","+ for i in vs:","+ if A[i] < mina:","+ mina = A[i]","+ mini = i","+ ans += mina","+ used += 1","+ for i in vs:","+ if i == mini:","+ continue","+ heapq.heappush(hq, A[i])","+for _ in range(need - used):","+ ans += heapq.heappop(hq)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0457453682,"measured_runtime_v1":0.0376542792,"runtime_lift":1.2148783395,"key":["s384158209","s157077348"]} +{"user_id":"u898999125","problem_id":"p02756","language":"python","submission_id_v0":"s115728488","submission_id_v1":"s365397687","cpu_time_v0":1873,"cpu_time_v1":742,"memory_v0":4412,"memory_v1":4468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.38,"input":"s=eval(input())\n\nq=int(eval(input()))\n\nhead=''\n\nfoot=''\n\n\n\na=0\n\nfor i in range(q):\n\n t=eval(input())\n\n if t=='1':\n\n a=a^1\n\n else:\n\n t, f, c = list(map(str, t.split()))\n\n f=int(f)\n\n if (f^a)&1==0:\n\n foot+=c\n\n else:\n\n head=c+head\n\ns=head+s+foot\n\nif a==1:\n\n s=s[::-1]\n\nprint(s)","target":"s=eval(input())\n\nq=int(eval(input()))\n\nhead=''\n\nfoot=''\n\n\n\na=0\n\nfor i in range(q):\n\n t=eval(input())\n\n if t=='1':\n\n a=a^1\n\n else:\n\n t, f, c = list(map(str, t.split()))\n\n f=int(f)\n\n if (f^a)&1==0:\n\n foot+=c\n\n else:\n\n head+=c\n\ns=head[::-1]+s+foot\n\nif a==1:\n\n s=s[::-1]\n\nprint(s)","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":279,"code_v1_num_chars":281,"code_v0_no_empty_lines":"s = eval(input())\nq = int(eval(input()))\nhead = \"\"\nfoot = \"\"\na = 0\nfor i in range(q):\n t = eval(input())\n if t == \"1\":\n a = a ^ 1\n else:\n t, f, c = list(map(str, t.split()))\n f = int(f)\n if (f ^ a) & 1 == 0:\n foot += c\n else:\n head = c + head\ns = head + s + foot\nif a == 1:\n s = s[::-1]\nprint(s)\n","code_v1_no_empty_lines":"s = eval(input())\nq = int(eval(input()))\nhead = \"\"\nfoot = \"\"\na = 0\nfor i in range(q):\n t = eval(input())\n if t == \"1\":\n a = a ^ 1\n else:\n t, f, c = list(map(str, t.split()))\n f = int(f)\n if (f ^ a) & 1 == 0:\n foot += c\n else:\n head += c\ns = head[::-1] + s + foot\nif a == 1:\n s = s[::-1]\nprint(s)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- head = c + head","-s = head + s + foot","+ head += c","+s = head[::-1] + s + foot"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363035886,"measured_runtime_v1":0.0341972106,"runtime_lift":1.0615950259,"key":["s115728488","s365397687"]} +{"user_id":"u043048943","problem_id":"p02733","language":"python","submission_id_v0":"s005395275","submission_id_v1":"s184025700","cpu_time_v0":449,"cpu_time_v1":411,"memory_v0":71384,"memory_v1":47708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.46,"input":"#coding:utf-8\n\nimport sys,os\n\nfrom collections import defaultdict, deque\n\nfrom fractions import gcd\n\nfrom math import ceil, floor\n\nsys.setrecursionlimit(10**6)\n\nwrite = sys.stdout.write\n\ndbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0\n\ndef main(given=sys.stdin.readline):\n\n input = lambda: given().rstrip()\n\n LMIIS = lambda: list(map(int,input().split()))\n\n II = lambda: int(input())\n\n XLMIIS = lambda x: [LMIIS() for _ in range(x)]\n\n YN = lambda c : print('Yes') if c else print('No')\n\n MOD = 10**9+7\n\n H,W,K = LMIIS()\n\n from itertools import accumulate\n\n S = [list(accumulate(map(int,input()))) for _ in range(H)]\n\n \n\n\n\n\n\n def divide(pattern):\n\n lenP = len(pattern)\n\n divided = [0]*lenP\n\n count = lenP - 1\n\n for i in range(lenP):\n\n if K < pattern[i][0]:\n\n return H+W\n\n for i in range(1,W):\n\n # print('divided=',divided)\n\n for j in range(lenP):\n\n if K < pattern[j][i] - divided[j]:\n\n for l in range(lenP):\n\n divided[l] = pattern[l][i-1]\n\n count += 1\n\n break\n\n # print('count=',count)\n\n return count\n\n \n\n\n\n \n\n \n\n\n\n\n\n\n\n ans = H+W\n\n\n\n for i in range(2**H):\n\n pattern = []\n\n line = [0] * W\n\n for j in range(H):\n\n for k in range(W):\n\n line[k] += S[j][k]\n\n if 2**j & i:\n\n pattern.append(line)\n\n line = [0] * W\n\n pattern.append(line)\n\n # print(pattern)\n\n ans = min(divide(pattern),ans)\n\n print(ans)\n\n return\n\n \n\n \n\n\n\n \n\n\n\n \n\n \n\n\n\n \n\n\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"H,W,K = list(map(int,input().split()))\n\nfrom itertools import accumulate\n\nS = [list(accumulate(list(map(int,eval(input()))))) for _ in range(H)]\n\n\n\ndef divide(pattern):\n\n lenP = len(pattern)\n\n divided = [0]*lenP\n\n count = lenP - 1\n\n for i in range(lenP):\n\n if K < pattern[i][0]:\n\n return H+W\n\n for i in range(1,W):\n\n for j in range(lenP):\n\n if K < pattern[j][i] - divided[j]:\n\n for l in range(lenP):\n\n divided[l] = pattern[l][i-1]\n\n count += 1\n\n break\n\n return count\n\n\n\nans = H+W\n\nfor i in range(2**H):\n\n pattern = []\n\n line = [0] * W\n\n for j in range(H):\n\n for k in range(W):\n\n line[k] += S[j][k]\n\n if 2**j & i:\n\n pattern.append(line)\n\n line = [0] * W\n\n pattern.append(line)\n\n ans = min(divide(pattern),ans)\n\nprint(ans)\n\n\n","code_v0_loc":75,"code_v1_loc":34,"code_v0_num_chars":1863,"code_v1_num_chars":885,"code_v0_no_empty_lines":"# coding:utf-8\nimport sys, os\nfrom collections import defaultdict, deque\nfrom fractions import gcd\nfrom math import ceil, floor\n\nsys.setrecursionlimit(10**6)\nwrite = sys.stdout.write\ndbg = (\n (lambda *something: print(*something))\n if \"TERM_PROGRAM\" in os.environ\n else lambda *x: 0\n)\n\n\ndef main(given=sys.stdin.readline):\n input = lambda: given().rstrip()\n LMIIS = lambda: list(map(int, input().split()))\n II = lambda: int(input())\n XLMIIS = lambda x: [LMIIS() for _ in range(x)]\n YN = lambda c: print(\"Yes\") if c else print(\"No\")\n MOD = 10**9 + 7\n H, W, K = LMIIS()\n from itertools import accumulate\n\n S = [list(accumulate(map(int, input()))) for _ in range(H)]\n\n def divide(pattern):\n lenP = len(pattern)\n divided = [0] * lenP\n count = lenP - 1\n for i in range(lenP):\n if K < pattern[i][0]:\n return H + W\n for i in range(1, W):\n # print('divided=',divided)\n for j in range(lenP):\n if K < pattern[j][i] - divided[j]:\n for l in range(lenP):\n divided[l] = pattern[l][i - 1]\n count += 1\n break\n # print('count=',count)\n return count\n\n ans = H + W\n for i in range(2**H):\n pattern = []\n line = [0] * W\n for j in range(H):\n for k in range(W):\n line[k] += S[j][k]\n if 2**j & i:\n pattern.append(line)\n line = [0] * W\n pattern.append(line)\n # print(pattern)\n ans = min(divide(pattern), ans)\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"H, W, K = list(map(int, input().split()))\nfrom itertools import accumulate\n\nS = [list(accumulate(list(map(int, eval(input()))))) for _ in range(H)]\n\n\ndef divide(pattern):\n lenP = len(pattern)\n divided = [0] * lenP\n count = lenP - 1\n for i in range(lenP):\n if K < pattern[i][0]:\n return H + W\n for i in range(1, W):\n for j in range(lenP):\n if K < pattern[j][i] - divided[j]:\n for l in range(lenP):\n divided[l] = pattern[l][i - 1]\n count += 1\n break\n return count\n\n\nans = H + W\nfor i in range(2**H):\n pattern = []\n line = [0] * W\n for j in range(H):\n for k in range(W):\n line[k] += S[j][k]\n if 2**j & i:\n pattern.append(line)\n line = [0] * W\n pattern.append(line)\n ans = min(divide(pattern), ans)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":54.6666666667,"diff":["-# coding:utf-8","-import sys, os","-from collections import defaultdict, deque","-from fractions import gcd","-from math import ceil, floor","+H, W, K = list(map(int, input().split()))","+from itertools import accumulate","-sys.setrecursionlimit(10**6)","-write = sys.stdout.write","-dbg = (","- (lambda *something: print(*something))","- if \"TERM_PROGRAM\" in os.environ","- else lambda *x: 0","-)","+S = [list(accumulate(list(map(int, eval(input()))))) for _ in range(H)]","-def main(given=sys.stdin.readline):","- input = lambda: given().rstrip()","- LMIIS = lambda: list(map(int, input().split()))","- II = lambda: int(input())","- XLMIIS = lambda x: [LMIIS() for _ in range(x)]","- YN = lambda c: print(\"Yes\") if c else print(\"No\")","- MOD = 10**9 + 7","- H, W, K = LMIIS()","- from itertools import accumulate","-","- S = [list(accumulate(map(int, input()))) for _ in range(H)]","-","- def divide(pattern):","- lenP = len(pattern)","- divided = [0] * lenP","- count = lenP - 1","- for i in range(lenP):","- if K < pattern[i][0]:","- return H + W","- for i in range(1, W):","- # print('divided=',divided)","- for j in range(lenP):","- if K < pattern[j][i] - divided[j]:","- for l in range(lenP):","- divided[l] = pattern[l][i - 1]","- count += 1","- break","- # print('count=',count)","- return count","-","- ans = H + W","- for i in range(2**H):","- pattern = []","- line = [0] * W","- for j in range(H):","- for k in range(W):","- line[k] += S[j][k]","- if 2**j & i:","- pattern.append(line)","- line = [0] * W","- pattern.append(line)","- # print(pattern)","- ans = min(divide(pattern), ans)","- print(ans)","- return","+def divide(pattern):","+ lenP = len(pattern)","+ divided = [0] * lenP","+ count = lenP - 1","+ for i in range(lenP):","+ if K < pattern[i][0]:","+ return H + W","+ for i in range(1, W):","+ for j in range(lenP):","+ if K < pattern[j][i] - divided[j]:","+ for l in range(lenP):","+ divided[l] = pattern[l][i - 1]","+ count += 1","+ break","+ return count","-if __name__ == \"__main__\":","- main()","+ans = H + W","+for i in range(2**H):","+ pattern = []","+ line = [0] * W","+ for j in range(H):","+ for k in range(W):","+ line[k] += S[j][k]","+ if 2**j & i:","+ pattern.append(line)","+ line = [0] * W","+ pattern.append(line)","+ ans = min(divide(pattern), ans)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0499267945,"measured_runtime_v1":0.0490688171,"runtime_lift":1.0174851857,"key":["s005395275","s184025700"]} +{"user_id":"u346812984","problem_id":"p02954","language":"python","submission_id_v0":"s019553325","submission_id_v1":"s413893390","cpu_time_v0":132,"cpu_time_v1":121,"memory_v0":6400,"memory_v1":9392,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.33,"input":"S = eval(input())\n\nans = [0] * len(S)\n\n\n\n\n\n# R \u3068 L\u3092\u5225\u3005\u306b\u8003\u3048\u308b\n\ncnt = 0\n\nfor i in range(len(S) - 1):\n\n if S[i] == \"R\":\n\n cnt += 1\n\n if S[i + 1] == \"L\":\n\n ans[i] += (cnt + 1) \/\/ 2\n\n ans[i + 1] += cnt \/\/ 2\n\n else:\n\n cnt = 0\n\n\n\ncnt = 0\n\nfor i in range(len(S) - 1, 0, -1):\n\n if S[i] == \"L\":\n\n cnt += 1\n\n if S[i - 1] == \"R\":\n\n ans[i] += (cnt + 1) \/\/ 2\n\n ans[i - 1] += cnt \/\/ 2\n\n else:\n\n cnt = 0\n\n\n\nprint((*ans))\n","target":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nINF = float(\"inf\")\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef input():\n\n return sys.stdin.readline().strip()\n\n\n\n\n\ndef main():\n\n S = input().replace(\"LR\", \"L R\")\n\n S = S.split()\n\n ans = []\n\n for s in S:\n\n N = len(s)\n\n tmp = [0] * N\n\n cnt = 0\n\n for i in range(N):\n\n if s[i] == \"R\":\n\n cnt += 1\n\n else:\n\n break\n\n tmp[i] += cnt \/\/ 2\n\n tmp[i - 1] += (cnt + 1) \/\/ 2\n\n\n\n cnt = N - cnt\n\n tmp[i] += (cnt + 1) \/\/ 2\n\n tmp[i - 1] += cnt \/\/ 2\n\n\n\n ans += tmp\n\n\n\n print(*ans, sep=\" \")\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":26,"code_v1_loc":38,"code_v0_num_chars":492,"code_v1_num_chars":684,"code_v0_no_empty_lines":"S = eval(input())\nans = [0] * len(S)\n# R \u3068 L\u3092\u5225\u3005\u306b\u8003\u3048\u308b\ncnt = 0\nfor i in range(len(S) - 1):\n if S[i] == \"R\":\n cnt += 1\n if S[i + 1] == \"L\":\n ans[i] += (cnt + 1) \/\/ 2\n ans[i + 1] += cnt \/\/ 2\n else:\n cnt = 0\ncnt = 0\nfor i in range(len(S) - 1, 0, -1):\n if S[i] == \"L\":\n cnt += 1\n if S[i - 1] == \"R\":\n ans[i] += (cnt + 1) \/\/ 2\n ans[i - 1] += cnt \/\/ 2\n else:\n cnt = 0\nprint((*ans))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\nINF = float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n S = input().replace(\"LR\", \"L R\")\n S = S.split()\n ans = []\n for s in S:\n N = len(s)\n tmp = [0] * N\n cnt = 0\n for i in range(N):\n if s[i] == \"R\":\n cnt += 1\n else:\n break\n tmp[i] += cnt \/\/ 2\n tmp[i - 1] += (cnt + 1) \/\/ 2\n cnt = N - cnt\n tmp[i] += (cnt + 1) \/\/ 2\n tmp[i - 1] += cnt \/\/ 2\n ans += tmp\n print(*ans, sep=\" \")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":31.5789473684,"diff":["-S = eval(input())","-ans = [0] * len(S)","-# R \u3068 L\u3092\u5225\u3005\u306b\u8003\u3048\u308b","-cnt = 0","-for i in range(len(S) - 1):","- if S[i] == \"R\":","- cnt += 1","- if S[i + 1] == \"L\":","- ans[i] += (cnt + 1) \/\/ 2","- ans[i + 1] += cnt \/\/ 2","- else:","+import sys","+","+sys.setrecursionlimit(10**6)","+INF = float(\"inf\")","+MOD = 10**9 + 7","+","+","+def input():","+ return sys.stdin.readline().strip()","+","+","+def main():","+ S = input().replace(\"LR\", \"L R\")","+ S = S.split()","+ ans = []","+ for s in S:","+ N = len(s)","+ tmp = [0] * N","-cnt = 0","-for i in range(len(S) - 1, 0, -1):","- if S[i] == \"L\":","- cnt += 1","- if S[i - 1] == \"R\":","- ans[i] += (cnt + 1) \/\/ 2","- ans[i - 1] += cnt \/\/ 2","- else:","- cnt = 0","-print((*ans))","+ for i in range(N):","+ if s[i] == \"R\":","+ cnt += 1","+ else:","+ break","+ tmp[i] += cnt \/\/ 2","+ tmp[i - 1] += (cnt + 1) \/\/ 2","+ cnt = N - cnt","+ tmp[i] += (cnt + 1) \/\/ 2","+ tmp[i - 1] += cnt \/\/ 2","+ ans += tmp","+ print(*ans, sep=\" \")","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0345616119,"measured_runtime_v1":0.0413709466,"runtime_lift":0.8354078087,"key":["s019553325","s413893390"]} +{"user_id":"u347640436","problem_id":"p03061","language":"python","submission_id_v0":"s399342351","submission_id_v1":"s108142402","cpu_time_v0":1719,"cpu_time_v1":756,"memory_v0":16140,"memory_v1":80580,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.02,"input":"from fractions import gcd\n\n\n\n\n\nclass SegmentTree():\n\n _data = []\n\n _offset = 0\n\n _size = 0\n\n\n\n def __init__(self, size):\n\n _size = size\n\n t = 1\n\n while t <= size:\n\n t *= 2\n\n self._offset = t - 1\n\n self._data = [0] * (t * 2 - 1)\n\n\n\n def update_all(self, iterable):\n\n self._data[self._offset:self._offset+self._size] = iterable\n\n for i in range(self._offset - 1, -1, -1):\n\n self._data[i] = gcd(self._data[i * 2 + 1], self._data[i * 2 + 2])\n\n\n\n def update(self, index, value):\n\n i = self._offset + index\n\n self._data[i] = value\n\n while i >= 1:\n\n i = (i - 1) \/\/ 2\n\n self._data[i] = gcd(self._data[i * 2 + 1], self._data[i * 2 + 2])\n\n\n\n def query(self, start, stop):\n\n result = 0\n\n l = start + self._offset\n\n r = stop + self._offset\n\n while l < r:\n\n if l & 1 == 0:\n\n result = gcd(result, self._data[l])\n\n if r & 1 == 0:\n\n result = gcd(result, self._data[r - 1])\n\n l = l \/\/ 2\n\n r = (r - 1) \/\/ 2\n\n return result\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nst = SegmentTree(N)\n\nst.update_all(A)\n\n\n\nresult = st.query(1, N)\n\nfor i in range(1, N - 1):\n\n result = max(result, gcd(st.query(0, i), st.query(i + 1, N)))\n\nresult = max(result, st.query(0, N - 1))\n\nprint(result)\n","target":"# Sparse table (GCD)\n\nfrom math import gcd\n\n\n\n\n\nclass SparseTable():\n\n _data = None\n\n _lookup = None\n\n _f = None\n\n\n\n def __init__(self, a):\n\n data = []\n\n lookup = []\n\n f = gcd\n\n b = 0\n\n while (1 << b) <= len(a):\n\n b += 1\n\n for _ in range(b):\n\n data.append([0] * (1 << b))\n\n data[0][:len(a)] = a\n\n for i in range(1, b):\n\n j = 0\n\n di = data[i]\n\n di1 = data[i - 1]\n\n while j + (1 << i) <= (1 << b):\n\n di[j] = f(di1[j], di1[j + (1 << (i - 1))])\n\n j += 1\n\n lookup = [0] * (len(a) + 1)\n\n for i in range(2, len(lookup)):\n\n lookup[i] = lookup[i >> 1] + 1\n\n self._data = data\n\n self._lookup = lookup\n\n self._f = f\n\n\n\n def query(self, start, stop):\n\n b = self._lookup[stop - start]\n\n db = self._data[b]\n\n return self._f(db[start], db[stop - (1 << b)])\n\n\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nst = SparseTable(A)\n\n\n\nresult = st.query(1, N)\n\nfor i in range(1, N - 1):\n\n result = max(result, gcd(st.query(0, i), st.query(i + 1, N)))\n\nresult = max(result, st.query(0, N - 1))\n\nprint(result)\n","code_v0_loc":52,"code_v1_loc":49,"code_v0_num_chars":1425,"code_v1_num_chars":1236,"code_v0_no_empty_lines":"from fractions import gcd\n\n\nclass SegmentTree:\n _data = []\n _offset = 0\n _size = 0\n\n def __init__(self, size):\n _size = size\n t = 1\n while t <= size:\n t *= 2\n self._offset = t - 1\n self._data = [0] * (t * 2 - 1)\n\n def update_all(self, iterable):\n self._data[self._offset : self._offset + self._size] = iterable\n for i in range(self._offset - 1, -1, -1):\n self._data[i] = gcd(self._data[i * 2 + 1], self._data[i * 2 + 2])\n\n def update(self, index, value):\n i = self._offset + index\n self._data[i] = value\n while i >= 1:\n i = (i - 1) \/\/ 2\n self._data[i] = gcd(self._data[i * 2 + 1], self._data[i * 2 + 2])\n\n def query(self, start, stop):\n result = 0\n l = start + self._offset\n r = stop + self._offset\n while l < r:\n if l & 1 == 0:\n result = gcd(result, self._data[l])\n if r & 1 == 0:\n result = gcd(result, self._data[r - 1])\n l = l \/\/ 2\n r = (r - 1) \/\/ 2\n return result\n\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nst = SegmentTree(N)\nst.update_all(A)\nresult = st.query(1, N)\nfor i in range(1, N - 1):\n result = max(result, gcd(st.query(0, i), st.query(i + 1, N)))\nresult = max(result, st.query(0, N - 1))\nprint(result)\n","code_v1_no_empty_lines":"# Sparse table (GCD)\nfrom math import gcd\n\n\nclass SparseTable:\n _data = None\n _lookup = None\n _f = None\n\n def __init__(self, a):\n data = []\n lookup = []\n f = gcd\n b = 0\n while (1 << b) <= len(a):\n b += 1\n for _ in range(b):\n data.append([0] * (1 << b))\n data[0][: len(a)] = a\n for i in range(1, b):\n j = 0\n di = data[i]\n di1 = data[i - 1]\n while j + (1 << i) <= (1 << b):\n di[j] = f(di1[j], di1[j + (1 << (i - 1))])\n j += 1\n lookup = [0] * (len(a) + 1)\n for i in range(2, len(lookup)):\n lookup[i] = lookup[i >> 1] + 1\n self._data = data\n self._lookup = lookup\n self._f = f\n\n def query(self, start, stop):\n b = self._lookup[stop - start]\n db = self._data[b]\n return self._f(db[start], db[stop - (1 << b)])\n\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nst = SparseTable(A)\nresult = st.query(1, N)\nfor i in range(1, N - 1):\n result = max(result, gcd(st.query(0, i), st.query(i + 1, N)))\nresult = max(result, st.query(0, N - 1))\nprint(result)\n","code_same":false,"relative_loc_diff_percent":5.7692307692,"diff":["-from fractions import gcd","+# Sparse table (GCD)","+from math import gcd","-class SegmentTree:","- _data = []","- _offset = 0","- _size = 0","+class SparseTable:","+ _data = None","+ _lookup = None","+ _f = None","- def __init__(self, size):","- _size = size","- t = 1","- while t <= size:","- t *= 2","- self._offset = t - 1","- self._data = [0] * (t * 2 - 1)","-","- def update_all(self, iterable):","- self._data[self._offset : self._offset + self._size] = iterable","- for i in range(self._offset - 1, -1, -1):","- self._data[i] = gcd(self._data[i * 2 + 1], self._data[i * 2 + 2])","-","- def update(self, index, value):","- i = self._offset + index","- self._data[i] = value","- while i >= 1:","- i = (i - 1) \/\/ 2","- self._data[i] = gcd(self._data[i * 2 + 1], self._data[i * 2 + 2])","+ def __init__(self, a):","+ data = []","+ lookup = []","+ f = gcd","+ b = 0","+ while (1 << b) <= len(a):","+ b += 1","+ for _ in range(b):","+ data.append([0] * (1 << b))","+ data[0][: len(a)] = a","+ for i in range(1, b):","+ j = 0","+ di = data[i]","+ di1 = data[i - 1]","+ while j + (1 << i) <= (1 << b):","+ di[j] = f(di1[j], di1[j + (1 << (i - 1))])","+ j += 1","+ lookup = [0] * (len(a) + 1)","+ for i in range(2, len(lookup)):","+ lookup[i] = lookup[i >> 1] + 1","+ self._data = data","+ self._lookup = lookup","+ self._f = f","- result = 0","- l = start + self._offset","- r = stop + self._offset","- while l < r:","- if l & 1 == 0:","- result = gcd(result, self._data[l])","- if r & 1 == 0:","- result = gcd(result, self._data[r - 1])","- l = l \/\/ 2","- r = (r - 1) \/\/ 2","- return result","+ b = self._lookup[stop - start]","+ db = self._data[b]","+ return self._f(db[start], db[stop - (1 << b)])","-st = SegmentTree(N)","-st.update_all(A)","+st = SparseTable(A)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2937561944,"measured_runtime_v1":0.0381277747,"runtime_lift":7.7045197751,"key":["s399342351","s108142402"]} +{"user_id":"u285891772","problem_id":"p03588","language":"python","submission_id_v0":"s635845913","submission_id_v1":"s888153602","cpu_time_v0":277,"cpu_time_v1":198,"memory_v0":30072,"memory_v1":30056,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.52,"input":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\n#from decimal import *\n\n\n\nN = INT()\n\nAB = [LIST() for _ in range(N)]\n\n\n\nAB.extend([[0, INF], [INF, 0]])\n\n\n\nAB.sort(key = lambda x:x[0])\n\n\n\nans = 0\n\nfor i in range(1, N+2):\n\n\tans += min(AB[i][0]-AB[i-1][0], AB[i-1][1]-AB[i][1])\n\n\n\nprint(ans)","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\n#from decimal import *\n\n\n\nN = INT()\n\nAB = [LIST() for _ in range(N)]\n\nAB.sort(key = lambda x: x[0])\n\nprint((AB[-1][0] + AB[-1][1]))","code_v0_loc":33,"code_v1_loc":25,"code_v0_num_chars":1110,"code_v1_num_chars":999,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n) # , log2\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# from decimal import *\nN = INT()\nAB = [LIST() for _ in range(N)]\nAB.extend([[0, INF], [INF, 0]])\nAB.sort(key=lambda x: x[0])\nans = 0\nfor i in range(1, N + 2):\n ans += min(AB[i][0] - AB[i - 1][0], AB[i - 1][1] - AB[i][1])\nprint(ans)\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n) # , log2\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\n# from decimal import *\nN = INT()\nAB = [LIST() for _ in range(N)]\nAB.sort(key=lambda x: x[0])\nprint((AB[-1][0] + AB[-1][1]))\n","code_same":false,"relative_loc_diff_percent":24.2424242424,"diff":["-AB.extend([[0, INF], [INF, 0]])","-ans = 0","-for i in range(1, N + 2):","- ans += min(AB[i][0] - AB[i - 1][0], AB[i - 1][1] - AB[i][1])","-print(ans)","+print((AB[-1][0] + AB[-1][1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0458477836,"measured_runtime_v1":0.0451355882,"runtime_lift":1.0157790208,"key":["s635845913","s888153602"]} +{"user_id":"u687159441","problem_id":"p02947","language":"python","submission_id_v0":"s110022785","submission_id_v1":"s309777685","cpu_time_v0":391,"cpu_time_v1":347,"memory_v0":17848,"memory_v1":19760,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.25,"input":"n = int(eval(input()))\n\n \n\nwords = {}\n\nanagrams = 0\n\n \n\nfor i in range(n):\n\n word = \"\".join(sorted(eval(input())))\n\n if word not in words:\n\n words[word] = 1\n\n else:\n\n anagrams += words[word]\n\n words[word] += 1\n\n \n\nprint(anagrams)","target":"# \u30bd\u30fc\u30c8\u3057\u305f\u72b6\u614b\u3067\u6587\u5b57\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3001\u30a2\u30ca\u30b0\u30e9\u30e0\u306e\u6587\u5b57\u3068\u51fa\u3066\u304f\u308b\u56de\u6570\u3092\u53d6\u5f97\u3059\u308b\n\n# \u3042\u308b\u30a2\u30ca\u30b0\u30e9\u30e0\u6587\u5b57\u304cn\u56de\u51fa\u3066\u304f\u308b\u306a\u3089\u3070\u3001\u30da\u30a2\u306e\u9078\u3073\u65b9\u306fnC2\u3067\u3001n*(n-1)\/2\n\n# \u5168\u3066\u306e\u30a2\u30ca\u30b0\u30e9\u30e0\u6587\u5b57\u306b\u95a2\u3057\u3066\u8db3\u3057\u5408\u308f\u305b\n\nimport collections\n\n\n\nn = int(eval(input()))\n\n# \u30bd\u30fc\u30c8\u3057\u3066\u6587\u5b57\u8aad\u307f\u8fbc\u307f\n\ns_sorted = [''.join(sorted(eval(input()))) for i in range(n)]\n\n\n\n# \u30a2\u30ca\u30b0\u30e9\u30e0\u6587\u5b57\u5217\u3068\u51fa\u73fe\u56de\u6570\u3092\u53d6\u5f97\n\nanagram_list = collections.Counter(s_sorted)\n\n\n\ncount = 0\n\n\n\n# \u51fa\u73fe\u56de\u6570\u306e\u30ea\u30b9\u30c8\u304b\u3089\u30da\u30a2\u306e\u9078\u3073\u65b9\u3092\u8a08\u7b97\u3057\u3066\u3001\u8db3\u3057\u5408\u308f\u305b\n\nfor i in list(anagram_list.values()):\n\n count += i*(i-1)\/\/2\n\n\n\nprint(count)","code_v0_loc":14,"code_v1_loc":19,"code_v0_num_chars":247,"code_v1_num_chars":407,"code_v0_no_empty_lines":"n = int(eval(input()))\nwords = {}\nanagrams = 0\nfor i in range(n):\n word = \"\".join(sorted(eval(input())))\n if word not in words:\n words[word] = 1\n else:\n anagrams += words[word]\n words[word] += 1\nprint(anagrams)\n","code_v1_no_empty_lines":"# \u30bd\u30fc\u30c8\u3057\u305f\u72b6\u614b\u3067\u6587\u5b57\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3001\u30a2\u30ca\u30b0\u30e9\u30e0\u306e\u6587\u5b57\u3068\u51fa\u3066\u304f\u308b\u56de\u6570\u3092\u53d6\u5f97\u3059\u308b\n# \u3042\u308b\u30a2\u30ca\u30b0\u30e9\u30e0\u6587\u5b57\u304cn\u56de\u51fa\u3066\u304f\u308b\u306a\u3089\u3070\u3001\u30da\u30a2\u306e\u9078\u3073\u65b9\u306fnC2\u3067\u3001n*(n-1)\/2\n# \u5168\u3066\u306e\u30a2\u30ca\u30b0\u30e9\u30e0\u6587\u5b57\u306b\u95a2\u3057\u3066\u8db3\u3057\u5408\u308f\u305b\nimport collections\n\nn = int(eval(input()))\n# \u30bd\u30fc\u30c8\u3057\u3066\u6587\u5b57\u8aad\u307f\u8fbc\u307f\ns_sorted = [\"\".join(sorted(eval(input()))) for i in range(n)]\n# \u30a2\u30ca\u30b0\u30e9\u30e0\u6587\u5b57\u5217\u3068\u51fa\u73fe\u56de\u6570\u3092\u53d6\u5f97\nanagram_list = collections.Counter(s_sorted)\ncount = 0\n# \u51fa\u73fe\u56de\u6570\u306e\u30ea\u30b9\u30c8\u304b\u3089\u30da\u30a2\u306e\u9078\u3073\u65b9\u3092\u8a08\u7b97\u3057\u3066\u3001\u8db3\u3057\u5408\u308f\u305b\nfor i in list(anagram_list.values()):\n count += i * (i - 1) \/\/ 2\nprint(count)\n","code_same":false,"relative_loc_diff_percent":26.3157894737,"diff":["+# \u30bd\u30fc\u30c8\u3057\u305f\u72b6\u614b\u3067\u6587\u5b57\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3001\u30a2\u30ca\u30b0\u30e9\u30e0\u306e\u6587\u5b57\u3068\u51fa\u3066\u304f\u308b\u56de\u6570\u3092\u53d6\u5f97\u3059\u308b","+# \u3042\u308b\u30a2\u30ca\u30b0\u30e9\u30e0\u6587\u5b57\u304cn\u56de\u51fa\u3066\u304f\u308b\u306a\u3089\u3070\u3001\u30da\u30a2\u306e\u9078\u3073\u65b9\u306fnC2\u3067\u3001n*(n-1)\/2","+# \u5168\u3066\u306e\u30a2\u30ca\u30b0\u30e9\u30e0\u6587\u5b57\u306b\u95a2\u3057\u3066\u8db3\u3057\u5408\u308f\u305b","+import collections","+","-words = {}","-anagrams = 0","-for i in range(n):","- word = \"\".join(sorted(eval(input())))","- if word not in words:","- words[word] = 1","- else:","- anagrams += words[word]","- words[word] += 1","-print(anagrams)","+# \u30bd\u30fc\u30c8\u3057\u3066\u6587\u5b57\u8aad\u307f\u8fbc\u307f","+s_sorted = [\"\".join(sorted(eval(input()))) for i in range(n)]","+# \u30a2\u30ca\u30b0\u30e9\u30e0\u6587\u5b57\u5217\u3068\u51fa\u73fe\u56de\u6570\u3092\u53d6\u5f97","+anagram_list = collections.Counter(s_sorted)","+count = 0","+# \u51fa\u73fe\u56de\u6570\u306e\u30ea\u30b9\u30c8\u304b\u3089\u30da\u30a2\u306e\u9078\u3073\u65b9\u3092\u8a08\u7b97\u3057\u3066\u3001\u8db3\u3057\u5408\u308f\u305b","+for i in list(anagram_list.values()):","+ count += i * (i - 1) \/\/ 2","+print(count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0435114131,"measured_runtime_v1":0.0370510631,"runtime_lift":1.1743634188,"key":["s110022785","s309777685"]} +{"user_id":"u620084012","problem_id":"p03244","language":"python","submission_id_v0":"s421385649","submission_id_v1":"s904124884","cpu_time_v0":260,"cpu_time_v1":99,"memory_v0":65388,"memory_v1":21084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.92,"input":"from collections import Counter\n\nN = int(eval(input()))\n\na = list(map(int,input().split()))\n\nE = []\n\nO = []\n\nfor k in range(N):\n\n if k%2 == 0:\n\n E.append(a[k])\n\n else:\n\n O.append(a[k])\n\ne = Counter(E).most_common()\n\no = Counter(O).most_common()\n\n\n\nif e[0][0] != o[0][0]:\n\n print((N-e[0][1]-o[0][1]))\n\nelse:\n\n if len(e) >= 2 and len(o) >= 2:\n\n print((N-e[0][1]-max(e[1][1],o[1][1])))\n\n elif len(e) >= 2 and len(o) == 1:\n\n print((N\/\/2-e[1][1]))\n\n elif len(e) == 1 and len(o) >= 2:\n\n print((N\/\/2-o[1][1]))\n\n else:\n\n print((N\/\/2))\n","target":"from collections import Counter\n\nn = int(eval(input()))\n\na = list(map(int,input().split()))\n\ne = [a[k] for k in range(0,n,2)]\n\no = [a[k] for k in range(1,n,2)]\n\nC = Counter(e).most_common()\n\nD = Counter(o).most_common()\n\nif C[0][0] != D[0][0]:\n\n print((n-C[0][1]-D[0][1]))\n\nelse:\n\n if len(C) == len(D) == 1:\n\n print((n\/\/2))\n\n elif len(C) == 1 and len(D) > 1:\n\n print((n-C[0][1]-D[1][1]))\n\n elif len(D) == 1 and len(C) > 1:\n\n print((n-D[0][1]-C[1][1]))\n\n else:\n\n print((n-max(D[0][1]+C[1][1],C[0][1]+D[1][1])))\n","code_v0_loc":24,"code_v1_loc":18,"code_v0_num_chars":574,"code_v1_num_chars":537,"code_v0_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\na = list(map(int, input().split()))\nE = []\nO = []\nfor k in range(N):\n if k % 2 == 0:\n E.append(a[k])\n else:\n O.append(a[k])\ne = Counter(E).most_common()\no = Counter(O).most_common()\nif e[0][0] != o[0][0]:\n print((N - e[0][1] - o[0][1]))\nelse:\n if len(e) >= 2 and len(o) >= 2:\n print((N - e[0][1] - max(e[1][1], o[1][1])))\n elif len(e) >= 2 and len(o) == 1:\n print((N \/\/ 2 - e[1][1]))\n elif len(e) == 1 and len(o) >= 2:\n print((N \/\/ 2 - o[1][1]))\n else:\n print((N \/\/ 2))\n","code_v1_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\na = list(map(int, input().split()))\ne = [a[k] for k in range(0, n, 2)]\no = [a[k] for k in range(1, n, 2)]\nC = Counter(e).most_common()\nD = Counter(o).most_common()\nif C[0][0] != D[0][0]:\n print((n - C[0][1] - D[0][1]))\nelse:\n if len(C) == len(D) == 1:\n print((n \/\/ 2))\n elif len(C) == 1 and len(D) > 1:\n print((n - C[0][1] - D[1][1]))\n elif len(D) == 1 and len(C) > 1:\n print((n - D[0][1] - C[1][1]))\n else:\n print((n - max(D[0][1] + C[1][1], C[0][1] + D[1][1])))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-N = int(eval(input()))","+n = int(eval(input()))","-E = []","-O = []","-for k in range(N):","- if k % 2 == 0:","- E.append(a[k])","+e = [a[k] for k in range(0, n, 2)]","+o = [a[k] for k in range(1, n, 2)]","+C = Counter(e).most_common()","+D = Counter(o).most_common()","+if C[0][0] != D[0][0]:","+ print((n - C[0][1] - D[0][1]))","+else:","+ if len(C) == len(D) == 1:","+ print((n \/\/ 2))","+ elif len(C) == 1 and len(D) > 1:","+ print((n - C[0][1] - D[1][1]))","+ elif len(D) == 1 and len(C) > 1:","+ print((n - D[0][1] - C[1][1]))","- O.append(a[k])","-e = Counter(E).most_common()","-o = Counter(O).most_common()","-if e[0][0] != o[0][0]:","- print((N - e[0][1] - o[0][1]))","-else:","- if len(e) >= 2 and len(o) >= 2:","- print((N - e[0][1] - max(e[1][1], o[1][1])))","- elif len(e) >= 2 and len(o) == 1:","- print((N \/\/ 2 - e[1][1]))","- elif len(e) == 1 and len(o) >= 2:","- print((N \/\/ 2 - o[1][1]))","- else:","- print((N \/\/ 2))","+ print((n - max(D[0][1] + C[1][1], C[0][1] + D[1][1])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0379999113,"measured_runtime_v1":0.042017127,"runtime_lift":0.9043909943,"key":["s421385649","s904124884"]} +{"user_id":"u426534722","problem_id":"p02371","language":"python","submission_id_v0":"s702507049","submission_id_v1":"s538865454","cpu_time_v0":750,"cpu_time_v1":690,"memory_v0":52912,"memory_v1":52868,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.0,"input":"import sys\n\nreadline = sys.stdin.readline\n\ndef dfs(root):\n\n visited = [False] * n\n\n queue = [(0, root)]\n\n longest = (-1, -1)\n\n while queue:\n\n total_weight, node = queue.pop()\n\n if visited[node]: continue\n\n visited[node] = True\n\n longest = max(longest, (total_weight, node))\n\n queue.extend((total_weight + w, t) for w, t in edges[node] if not visited[t])\n\n return longest\n\nn = int(readline())\n\nedges = [set() for _ in range(n)]\n\nfor _ in range(n - 1):\n\n s, t, w = list(map(int, readline().split()))\n\n edges[s].add((w, t))\n\n edges[t].add((w, s))\n\n_, ln = dfs(0)\n\nld, _ = dfs(ln)\n\nprint(ld)","target":"import sys\n\nreadline = sys.stdin.readline\n\ndef dfs(root):\n\n visited = [False] * n\n\n queue = [(0, root)]\n\n longest = (-1, -1)\n\n while queue:\n\n total_weight, node = queue.pop()\n\n if visited[node]: continue\n\n visited[node] = True\n\n longest = max(longest, (total_weight, node))\n\n queue += [(total_weight + w, t) for w, t in edges[node] if not visited[t]]\n\n return longest\n\nn = int(readline())\n\nedges = [set() for _ in range(n)]\n\nfor _ in range(n - 1):\n\n s, t, w = list(map(int, readline().split()))\n\n edges[s].add((w, t))\n\n edges[t].add((w, s))\n\n_, ln = dfs(0)\n\nld, _ = dfs(ln)\n\nprint(ld)","code_v0_loc":22,"code_v1_loc":22,"code_v0_num_chars":640,"code_v1_num_chars":637,"code_v0_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\n\n\ndef dfs(root):\n visited = [False] * n\n queue = [(0, root)]\n longest = (-1, -1)\n while queue:\n total_weight, node = queue.pop()\n if visited[node]:\n continue\n visited[node] = True\n longest = max(longest, (total_weight, node))\n queue.extend((total_weight + w, t) for w, t in edges[node] if not visited[t])\n return longest\n\n\nn = int(readline())\nedges = [set() for _ in range(n)]\nfor _ in range(n - 1):\n s, t, w = list(map(int, readline().split()))\n edges[s].add((w, t))\n edges[t].add((w, s))\n_, ln = dfs(0)\nld, _ = dfs(ln)\nprint(ld)\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\n\n\ndef dfs(root):\n visited = [False] * n\n queue = [(0, root)]\n longest = (-1, -1)\n while queue:\n total_weight, node = queue.pop()\n if visited[node]:\n continue\n visited[node] = True\n longest = max(longest, (total_weight, node))\n queue += [(total_weight + w, t) for w, t in edges[node] if not visited[t]]\n return longest\n\n\nn = int(readline())\nedges = [set() for _ in range(n)]\nfor _ in range(n - 1):\n s, t, w = list(map(int, readline().split()))\n edges[s].add((w, t))\n edges[t].add((w, s))\n_, ln = dfs(0)\nld, _ = dfs(ln)\nprint(ld)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- queue.extend((total_weight + w, t) for w, t in edges[node] if not visited[t])","+ queue += [(total_weight + w, t) for w, t in edges[node] if not visited[t]]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0364107788,"measured_runtime_v1":0.1082427984,"runtime_lift":0.3363806119,"key":["s702507049","s538865454"]} +{"user_id":"u657361950","problem_id":"p02274","language":"python","submission_id_v0":"s198172694","submission_id_v1":"s534786001","cpu_time_v0":1760,"cpu_time_v1":1530,"memory_v0":27484,"memory_v1":27480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.07,"input":"import sys\n\ncnt = 0\n\n\n\ndef merge_sort(a, left, right):\n\n\tif left + 1 < right:\n\n\t\tmid = int(left + (right - left) \/ 2)\n\n\t\tmerge_sort(a, left, mid)\n\n\t\tmerge_sort(a, mid, right)\n\n\t\tmerge(a, left, mid, right)\n\n\n\ndef merge(a, left, mid, right):\n\n\tn1 = mid - left\n\n\tn2 = right - mid\n\n\tL = a[left:left+n1]\n\n\tR = a[mid:mid+n2]\n\n\tL.append(sys.maxsize)\n\n\tR.append(sys.maxsize)\n\n\ti = j = 0\n\n\ttmp = n1\n\n\tfor k in range(left, right):\n\n\t\tif L[i] <= R[j]:\n\n\t\t\tif R[j] != sys.maxsize:\n\n\t\t\t\ttmp -= 1\n\n\t\t\ta[k] = L[i]\n\n\t\t\ti += 1\n\n\t\telse:\n\n\t\t\tif L[i] != sys.maxsize:\n\n\t\t\t\tglobal cnt\n\n\t\t\t\tcnt += tmp\n\n\t\t\ta[k] = R[j]\n\n\t\t\tj += 1\t\t\n\n\t\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\nmerge_sort(a, 0, len(a))\n\nprint(cnt)\n\n\n","target":"import sys\n\ncnt = 0\n\n\n\ndef merge_sort(a, left, right):\n\n\tif left + 1 < right:\n\n\t\tmid = int(left + (right - left) \/ 2)\n\n\t\tmerge_sort(a, left, mid)\n\n\t\tmerge_sort(a, mid, right)\n\n\t\tmerge(a, left, mid, right)\n\n\n\ndef merge(a, left, mid, right):\n\n\tn1 = mid - left\n\n\tn2 = right - mid\n\n\tL = a[left:left + n1]\n\n\tR = a[mid:mid + n2]\n\n\tL.append(sys.maxsize)\n\n\tR.append(sys.maxsize)\n\n\ti = j = 0\n\n\tfor k in range(left, right):\n\n\t\tif L[i] <= R[j]:\n\n\t\t\ta[k] = L[i]\n\n\t\t\ti += 1\n\n\t\telse:\n\n\t\t\tif L[i] != sys.maxsize:\n\n\t\t\t\tglobal cnt\n\n\t\t\t\tcnt += n1 - i\n\n\t\t\ta[k] = R[j]\n\n\t\t\tj += 1\n\n\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\nmerge_sort(a, 0, len(a))\n\nprint(cnt)\n","code_v0_loc":37,"code_v1_loc":33,"code_v0_num_chars":706,"code_v1_num_chars":655,"code_v0_no_empty_lines":"import sys\n\ncnt = 0\n\n\ndef merge_sort(a, left, right):\n if left + 1 < right:\n mid = int(left + (right - left) \/ 2)\n merge_sort(a, left, mid)\n merge_sort(a, mid, right)\n merge(a, left, mid, right)\n\n\ndef merge(a, left, mid, right):\n n1 = mid - left\n n2 = right - mid\n L = a[left : left + n1]\n R = a[mid : mid + n2]\n L.append(sys.maxsize)\n R.append(sys.maxsize)\n i = j = 0\n tmp = n1\n for k in range(left, right):\n if L[i] <= R[j]:\n if R[j] != sys.maxsize:\n tmp -= 1\n a[k] = L[i]\n i += 1\n else:\n if L[i] != sys.maxsize:\n global cnt\n cnt += tmp\n a[k] = R[j]\n j += 1\n\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nmerge_sort(a, 0, len(a))\nprint(cnt)\n","code_v1_no_empty_lines":"import sys\n\ncnt = 0\n\n\ndef merge_sort(a, left, right):\n if left + 1 < right:\n mid = int(left + (right - left) \/ 2)\n merge_sort(a, left, mid)\n merge_sort(a, mid, right)\n merge(a, left, mid, right)\n\n\ndef merge(a, left, mid, right):\n n1 = mid - left\n n2 = right - mid\n L = a[left : left + n1]\n R = a[mid : mid + n2]\n L.append(sys.maxsize)\n R.append(sys.maxsize)\n i = j = 0\n for k in range(left, right):\n if L[i] <= R[j]:\n a[k] = L[i]\n i += 1\n else:\n if L[i] != sys.maxsize:\n global cnt\n cnt += n1 - i\n a[k] = R[j]\n j += 1\n\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nmerge_sort(a, 0, len(a))\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":10.8108108108,"diff":["- tmp = n1","- if R[j] != sys.maxsize:","- tmp -= 1","- cnt += tmp","+ cnt += n1 - i"],"diff_only_import_comment":false,"measured_runtime_v0":0.0706821941,"measured_runtime_v1":0.0901731687,"runtime_lift":0.78384951,"key":["s198172694","s534786001"]} +{"user_id":"u625007136","problem_id":"p02659","language":"python","submission_id_v0":"s234797181","submission_id_v1":"s265305511","cpu_time_v0":24,"cpu_time_v1":21,"memory_v0":9000,"memory_v1":9144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\nif __name__ == \"__main__\":\n\n a,b = input().split()\n\n ai = int(a)\n\n bf = round(float(b)*100)\n\n print((ai*bf\/\/100))\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nif __name__ == \"__main__\":\n\n a,b = input().split()\n\n print((int(a) * round(float(b)*100)\/\/100))\n","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":166,"code_v1_num_chars":142,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nif __name__ == \"__main__\":\n a, b = input().split()\n ai = int(a)\n bf = round(float(b) * 100)\n print((ai * bf \/\/ 100))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nif __name__ == \"__main__\":\n a, b = input().split()\n print((int(a) * round(float(b) * 100) \/\/ 100))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["- ai = int(a)","- bf = round(float(b) * 100)","- print((ai * bf \/\/ 100))","+ print((int(a) * round(float(b) * 100) \/\/ 100))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0391915092,"measured_runtime_v1":0.0387243464,"runtime_lift":1.0120638017,"key":["s234797181","s265305511"]} +{"user_id":"u724687935","problem_id":"p02625","language":"python","submission_id_v0":"s873835622","submission_id_v1":"s405472573","cpu_time_v0":1246,"cpu_time_v1":191,"memory_v0":48320,"memory_v1":95528,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.67,"input":"def prepare(n):\n\n global MOD\n\n modFacts = [0] * (n + 1)\n\n modFacts[0] = 1\n\n for i in range(n):\n\n modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD\n\n\n\n invs = [1] * (n + 1)\n\n invs[n] = pow(modFacts[n], MOD - 2, MOD)\n\n for i in range(n, 1, -1):\n\n invs[i - 1] = (invs[i] * i) % MOD\n\n\n\n return modFacts, invs\n\n \n\n\n\nMOD = 10 ** 9 + 7\n\nN, M = list(map(int, input().split()))\n\nmodFacts, invs = prepare(max(N, M))\n\n\n\nans = 0\n\nfor i in range(N + 1):\n\n cnt = (modFacts[N] * invs[i] * invs[N - i]) % MOD\n\n cnt *= (modFacts[M] * invs[M - i]) % MOD\n\n cnt %= MOD\n\n cnt *= pow(modFacts[M - i] * invs[(M - i) - (N - i)], 2, MOD)\n\n cnt %= MOD\n\n ans += pow(-1, i) * cnt\n\n ans %= MOD\n\n\n\nprint(ans)\n","target":"MOD = 10 ** 9 + 7\n\n\n\n\n\ndef prepare(n):\n\n global MOD\n\n modFacts = [0] * (n + 1)\n\n modFacts[0] = 1\n\n for i in range(n):\n\n modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD\n\n\n\n invs = [1] * (n + 1)\n\n invs[n] = pow(modFacts[n], MOD - 2, MOD)\n\n for i in range(n, 1, -1):\n\n invs[i - 1] = (invs[i] * i) % MOD\n\n\n\n return modFacts, invs\n\n\n\n\n\ndef comb(n, r):\n\n global MOD, modFacts, invs\n\n return (modFacts[n] * invs[n - r] * invs[r]) % MOD\n\n\n\n\n\ndef perm(n, r):\n\n global MOD, modFacts, invs\n\n return (modFacts[n] * invs[n - r]) % MOD\n\n\n\n\n\nN, M = list(map(int, input().split()))\n\nmodFacts, invs = prepare(M)\n\nans = 0\n\nflag = 1\n\nfor i in range(N + 1):\n\n a = comb(N, i)\n\n b = perm(M, i)\n\n c = pow(perm(M - i, N - i), 2, MOD)\n\n cnt = (a * b * c) % MOD\n\n ans = (ans + flag * cnt) % MOD\n\n flag *= -1\n\nprint(ans)\n","code_v0_loc":30,"code_v1_loc":40,"code_v0_num_chars":737,"code_v1_num_chars":856,"code_v0_no_empty_lines":"def prepare(n):\n global MOD\n modFacts = [0] * (n + 1)\n modFacts[0] = 1\n for i in range(n):\n modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD\n invs = [1] * (n + 1)\n invs[n] = pow(modFacts[n], MOD - 2, MOD)\n for i in range(n, 1, -1):\n invs[i - 1] = (invs[i] * i) % MOD\n return modFacts, invs\n\n\nMOD = 10**9 + 7\nN, M = list(map(int, input().split()))\nmodFacts, invs = prepare(max(N, M))\nans = 0\nfor i in range(N + 1):\n cnt = (modFacts[N] * invs[i] * invs[N - i]) % MOD\n cnt *= (modFacts[M] * invs[M - i]) % MOD\n cnt %= MOD\n cnt *= pow(modFacts[M - i] * invs[(M - i) - (N - i)], 2, MOD)\n cnt %= MOD\n ans += pow(-1, i) * cnt\n ans %= MOD\nprint(ans)\n","code_v1_no_empty_lines":"MOD = 10**9 + 7\n\n\ndef prepare(n):\n global MOD\n modFacts = [0] * (n + 1)\n modFacts[0] = 1\n for i in range(n):\n modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD\n invs = [1] * (n + 1)\n invs[n] = pow(modFacts[n], MOD - 2, MOD)\n for i in range(n, 1, -1):\n invs[i - 1] = (invs[i] * i) % MOD\n return modFacts, invs\n\n\ndef comb(n, r):\n global MOD, modFacts, invs\n return (modFacts[n] * invs[n - r] * invs[r]) % MOD\n\n\ndef perm(n, r):\n global MOD, modFacts, invs\n return (modFacts[n] * invs[n - r]) % MOD\n\n\nN, M = list(map(int, input().split()))\nmodFacts, invs = prepare(M)\nans = 0\nflag = 1\nfor i in range(N + 1):\n a = comb(N, i)\n b = perm(M, i)\n c = pow(perm(M - i, N - i), 2, MOD)\n cnt = (a * b * c) % MOD\n ans = (ans + flag * cnt) % MOD\n flag *= -1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["+MOD = 10**9 + 7","+","+","-MOD = 10**9 + 7","+def comb(n, r):","+ global MOD, modFacts, invs","+ return (modFacts[n] * invs[n - r] * invs[r]) % MOD","+","+","+def perm(n, r):","+ global MOD, modFacts, invs","+ return (modFacts[n] * invs[n - r]) % MOD","+","+","-modFacts, invs = prepare(max(N, M))","+modFacts, invs = prepare(M)","+flag = 1","- cnt = (modFacts[N] * invs[i] * invs[N - i]) % MOD","- cnt *= (modFacts[M] * invs[M - i]) % MOD","- cnt %= MOD","- cnt *= pow(modFacts[M - i] * invs[(M - i) - (N - i)], 2, MOD)","- cnt %= MOD","- ans += pow(-1, i) * cnt","- ans %= MOD","+ a = comb(N, i)","+ b = perm(M, i)","+ c = pow(perm(M - i, N - i), 2, MOD)","+ cnt = (a * b * c) % MOD","+ ans = (ans + flag * cnt) % MOD","+ flag *= -1"],"diff_only_import_comment":false,"measured_runtime_v0":0.1826912222,"measured_runtime_v1":0.2212742841,"runtime_lift":0.8256324177,"key":["s873835622","s405472573"]} +{"user_id":"u692746605","problem_id":"p03061","language":"python","submission_id_v0":"s343280336","submission_id_v1":"s574923946","cpu_time_v0":265,"cpu_time_v1":184,"memory_v0":15688,"memory_v1":14428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.57,"input":"import sys\n\n\n\ndef gcd(a, b):\n\n while b:\n\n a, b = b, a%b\n\n return a\n\n\n\nn=int(eval(input()))\n\nal=input().split()\n\nal_i = [int(s) for s in al]\n\n\n\nif (n == 2):\n\n print((max(al_i[0],al_i[1])))\n\n sys.exit()\n\n\n\nfg = [0] * n\n\nbg = [0] * n\n\n\n\nfor x in range(n):\n\n if (x == 0):\n\n fg[0] = al_i[0]\n\n y = 1\n\n else:\n\n while y <= x:\n\n fg[y] = gcd(fg[y-1], al_i[y])\n\n y += 1\n\n\n\nfor x in range(n):\n\n if (x == 0):\n\n bg[0] = al_i[n-1]\n\n y = 1\n\n else:\n\n while y <= x:\n\n bg[y] = gcd(bg[y-1], al_i[n-1-y])\n\n y += 1\n\n\n\nm = 0\n\ngm = 0\n\n\n\nfor x in range(n):\n\n if (x == 0):\n\n g = bg[n-2]\n\n elif (x == n-1):\n\n g = fg[n-2]\n\n else:\n\n g = gcd(fg[x-1],bg[n-2-x])\n\n if (g > gm):\n\n gm = g\n\n\n\nprint(gm)\n","target":"def gcd(a, b):\n\n while b:\n\n a, b = b, a%b\n\n return a\n\n\n\nn=int(eval(input()))\n\nal=[int(x) for x in input().split()]\n\n\n\nfg = [0] * n\n\nbg = [0] * n\n\n\n\nfg[0] = al[0]\n\nbg[0] = al[n-1]\n\n\n\nfor x in range(1,n):\n\n fg[x] = gcd(fg[x-1], al[x])\n\n bg[x] = gcd(bg[x-1], al[n-1-x])\n\n\n\ngm = max(bg[n-2], fg[n-2])\n\n\n\nfor x in range(1,n-1):\n\n g = gcd(fg[x-1],bg[n-2-x])\n\n if (g > gm):\n\n gm = g\n\n\n\nprint(gm)","code_v0_loc":50,"code_v1_loc":26,"code_v0_num_chars":777,"code_v1_num_chars":410,"code_v0_no_empty_lines":"import sys\n\n\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\nn = int(eval(input()))\nal = input().split()\nal_i = [int(s) for s in al]\nif n == 2:\n print((max(al_i[0], al_i[1])))\n sys.exit()\nfg = [0] * n\nbg = [0] * n\nfor x in range(n):\n if x == 0:\n fg[0] = al_i[0]\n y = 1\n else:\n while y <= x:\n fg[y] = gcd(fg[y - 1], al_i[y])\n y += 1\nfor x in range(n):\n if x == 0:\n bg[0] = al_i[n - 1]\n y = 1\n else:\n while y <= x:\n bg[y] = gcd(bg[y - 1], al_i[n - 1 - y])\n y += 1\nm = 0\ngm = 0\nfor x in range(n):\n if x == 0:\n g = bg[n - 2]\n elif x == n - 1:\n g = fg[n - 2]\n else:\n g = gcd(fg[x - 1], bg[n - 2 - x])\n if g > gm:\n gm = g\nprint(gm)\n","code_v1_no_empty_lines":"def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\n\nn = int(eval(input()))\nal = [int(x) for x in input().split()]\nfg = [0] * n\nbg = [0] * n\nfg[0] = al[0]\nbg[0] = al[n - 1]\nfor x in range(1, n):\n fg[x] = gcd(fg[x - 1], al[x])\n bg[x] = gcd(bg[x - 1], al[n - 1 - x])\ngm = max(bg[n - 2], fg[n - 2])\nfor x in range(1, n - 1):\n g = gcd(fg[x - 1], bg[n - 2 - x])\n if g > gm:\n gm = g\nprint(gm)\n","code_same":false,"relative_loc_diff_percent":48.0,"diff":["-import sys","-","-","-al = input().split()","-al_i = [int(s) for s in al]","-if n == 2:","- print((max(al_i[0], al_i[1])))","- sys.exit()","+al = [int(x) for x in input().split()]","-for x in range(n):","- if x == 0:","- fg[0] = al_i[0]","- y = 1","- else:","- while y <= x:","- fg[y] = gcd(fg[y - 1], al_i[y])","- y += 1","-for x in range(n):","- if x == 0:","- bg[0] = al_i[n - 1]","- y = 1","- else:","- while y <= x:","- bg[y] = gcd(bg[y - 1], al_i[n - 1 - y])","- y += 1","-m = 0","-gm = 0","-for x in range(n):","- if x == 0:","- g = bg[n - 2]","- elif x == n - 1:","- g = fg[n - 2]","- else:","- g = gcd(fg[x - 1], bg[n - 2 - x])","+fg[0] = al[0]","+bg[0] = al[n - 1]","+for x in range(1, n):","+ fg[x] = gcd(fg[x - 1], al[x])","+ bg[x] = gcd(bg[x - 1], al[n - 1 - x])","+gm = max(bg[n - 2], fg[n - 2])","+for x in range(1, n - 1):","+ g = gcd(fg[x - 1], bg[n - 2 - x])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363157794,"measured_runtime_v1":0.0381148002,"runtime_lift":0.9527999421,"key":["s343280336","s574923946"]} +{"user_id":"u848427364","problem_id":"p03160","language":"python","submission_id_v0":"s149076708","submission_id_v1":"s704310635","cpu_time_v0":135,"cpu_time_v1":108,"memory_v0":14236,"memory_v1":14108,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"n = int(eval(input()))\n\nh = tuple(int(i) for i in input().split())\n\nx, y = 0, abs(h[0]-h[1])\n\nfor i in range(2, n):\n\n v = min(x+abs(h[i-2]-h[i]), y+abs(h[i-1]-h[i]))\n\n x, y = y, v\n\nprint(y)","target":"n = int(eval(input()))\n\nh = tuple(map(int, input().split()))\n\nx, y = 0, abs(h[0]-h[1])\n\nfor i in range(2, n):\n\n d1 = x+abs(h[i-2]-h[i])\n\n d2 = y+abs(h[i-1]-h[i])\n\n x, y = y, d1 if d1 < d2 else d2\n\nprint(y)","code_v0_loc":7,"code_v1_loc":8,"code_v0_num_chars":189,"code_v1_num_chars":208,"code_v0_no_empty_lines":"n = int(eval(input()))\nh = tuple(int(i) for i in input().split())\nx, y = 0, abs(h[0] - h[1])\nfor i in range(2, n):\n v = min(x + abs(h[i - 2] - h[i]), y + abs(h[i - 1] - h[i]))\n x, y = y, v\nprint(y)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nh = tuple(map(int, input().split()))\nx, y = 0, abs(h[0] - h[1])\nfor i in range(2, n):\n d1 = x + abs(h[i - 2] - h[i])\n d2 = y + abs(h[i - 1] - h[i])\n x, y = y, d1 if d1 < d2 else d2\nprint(y)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-h = tuple(int(i) for i in input().split())","+h = tuple(map(int, input().split()))","- v = min(x + abs(h[i - 2] - h[i]), y + abs(h[i - 1] - h[i]))","- x, y = y, v","+ d1 = x + abs(h[i - 2] - h[i])","+ d2 = y + abs(h[i - 1] - h[i])","+ x, y = y, d1 if d1 < d2 else d2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0453630922,"measured_runtime_v1":0.0366008856,"runtime_lift":1.2393987575,"key":["s149076708","s704310635"]} +{"user_id":"u887207211","problem_id":"p03574","language":"python","submission_id_v0":"s772836122","submission_id_v1":"s725421291","cpu_time_v0":27,"cpu_time_v1":22,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.52,"input":"H, W = list(map(int,input().split()))\n\nS = [eval(input()) for _ in range(H)]\n\n\n\nfor i in range(H):\n\n rs = ''\n\n for j in range(W):\n\n if(S[i][j] == '#'):\n\n rs += '#'\n\n else:\n\n tmp = 0\n\n for s in S[max(0, i-1): min(H, i+2)]:\n\n tmp += s[max(0, j-1): min(W, j+2)].count('#')\n\n rs += str(tmp)\n\n print(rs)","target":"H, W = list(map(int,input().split()))\n\nS = [eval(input()) for _ in range(H)]\n\n\n\nresult = [[0 for _ in range(W+1)]for _ in range(H+1)]\n\nfor i in range(H):\n\n for j in range(W):\n\n if(S[i][j] == '#'):\n\n result[i][j] = '#'\n\n if(result[i-1][j-1] != '#'):\n\n result[i-1][j-1] += 1\n\n if(result[i-1][j] != '#'):\n\n result[i-1][j] += 1\n\n if(result[i-1][j+1] != '#'):\n\n result[i-1][j+1] += 1\n\n if(result[i][j-1] != '#'):\n\n result[i][j-1] += 1\n\n if(result[i][j+1] != '#'):\n\n result[i][j+1] += 1\n\n if(result[i+1][j-1] != '#'):\n\n result[i+1][j-1] += 1\n\n if(result[i+1][j] != '#'):\n\n result[i+1][j] += 1\n\n if(result[i+1][j+1] != '#'):\n\n result[i+1][j+1] += 1\n\n\n\nfor r in result[:-1]:\n\n print((''.join(list(map(str,r[:W])))))","code_v0_loc":14,"code_v1_loc":27,"code_v0_num_chars":322,"code_v1_num_chars":799,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\nS = [eval(input()) for _ in range(H)]\nfor i in range(H):\n rs = \"\"\n for j in range(W):\n if S[i][j] == \"#\":\n rs += \"#\"\n else:\n tmp = 0\n for s in S[max(0, i - 1) : min(H, i + 2)]:\n tmp += s[max(0, j - 1) : min(W, j + 2)].count(\"#\")\n rs += str(tmp)\n print(rs)\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nS = [eval(input()) for _ in range(H)]\nresult = [[0 for _ in range(W + 1)] for _ in range(H + 1)]\nfor i in range(H):\n for j in range(W):\n if S[i][j] == \"#\":\n result[i][j] = \"#\"\n if result[i - 1][j - 1] != \"#\":\n result[i - 1][j - 1] += 1\n if result[i - 1][j] != \"#\":\n result[i - 1][j] += 1\n if result[i - 1][j + 1] != \"#\":\n result[i - 1][j + 1] += 1\n if result[i][j - 1] != \"#\":\n result[i][j - 1] += 1\n if result[i][j + 1] != \"#\":\n result[i][j + 1] += 1\n if result[i + 1][j - 1] != \"#\":\n result[i + 1][j - 1] += 1\n if result[i + 1][j] != \"#\":\n result[i + 1][j] += 1\n if result[i + 1][j + 1] != \"#\":\n result[i + 1][j + 1] += 1\nfor r in result[:-1]:\n print((\"\".join(list(map(str, r[:W])))))\n","code_same":false,"relative_loc_diff_percent":48.1481481481,"diff":["+result = [[0 for _ in range(W + 1)] for _ in range(H + 1)]","- rs = \"\"","- rs += \"#\"","- else:","- tmp = 0","- for s in S[max(0, i - 1) : min(H, i + 2)]:","- tmp += s[max(0, j - 1) : min(W, j + 2)].count(\"#\")","- rs += str(tmp)","- print(rs)","+ result[i][j] = \"#\"","+ if result[i - 1][j - 1] != \"#\":","+ result[i - 1][j - 1] += 1","+ if result[i - 1][j] != \"#\":","+ result[i - 1][j] += 1","+ if result[i - 1][j + 1] != \"#\":","+ result[i - 1][j + 1] += 1","+ if result[i][j - 1] != \"#\":","+ result[i][j - 1] += 1","+ if result[i][j + 1] != \"#\":","+ result[i][j + 1] += 1","+ if result[i + 1][j - 1] != \"#\":","+ result[i + 1][j - 1] += 1","+ if result[i + 1][j] != \"#\":","+ result[i + 1][j] += 1","+ if result[i + 1][j + 1] != \"#\":","+ result[i + 1][j + 1] += 1","+for r in result[:-1]:","+ print((\"\".join(list(map(str, r[:W])))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0469183264,"measured_runtime_v1":0.0481542411,"runtime_lift":0.9743342499,"key":["s772836122","s725421291"]} +{"user_id":"u525065967","problem_id":"p02695","language":"python","submission_id_v0":"s770632039","submission_id_v1":"s932883401","cpu_time_v0":698,"cpu_time_v1":629,"memory_v0":9172,"memory_v1":9136,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.89,"input":"n,m,q = list(map(int,input().split()))\n\nabcd = [[*list(map(int,input().split()))] for _ in range(q)]\n\nfrom itertools import *\n\nans = 0\n\nfor A in combinations_with_replacement(list(range(1, m+1)), n): # nHr\n\n now = sum(d if A[b-1] - A[a-1] == c else 0 for a,b,c,d in abcd)\n\n ans = max(ans, now)\n\nprint(ans)\n","target":"n,m,q = list(map(int,input().split()))\n\nabcd = [[*list(map(int,input().split()))] for _ in range(q)]\n\n\n\ndef dfs(A=[1]): # A:1 origin\n\n if n+1 <= len(A):\n\n return sum(d if A[b]-A[a]==c else 0 for a,b,c,d in abcd)\n\n A.append(A[-1])\n\n ret = 0\n\n while A[-1] <= m:\n\n ret = max(ret, dfs(A))\n\n A[-1] += 1\n\n A.pop()\n\n return ret\n\n\n\nans = dfs()\n\nprint(ans)\n","code_v0_loc":8,"code_v1_loc":16,"code_v0_num_chars":294,"code_v1_num_chars":375,"code_v0_no_empty_lines":"n, m, q = list(map(int, input().split()))\nabcd = [[*list(map(int, input().split()))] for _ in range(q)]\nfrom itertools import *\n\nans = 0\nfor A in combinations_with_replacement(list(range(1, m + 1)), n): # nHr\n now = sum(d if A[b - 1] - A[a - 1] == c else 0 for a, b, c, d in abcd)\n ans = max(ans, now)\nprint(ans)\n","code_v1_no_empty_lines":"n, m, q = list(map(int, input().split()))\nabcd = [[*list(map(int, input().split()))] for _ in range(q)]\n\n\ndef dfs(A=[1]): # A:1 origin\n if n + 1 <= len(A):\n return sum(d if A[b] - A[a] == c else 0 for a, b, c, d in abcd)\n A.append(A[-1])\n ret = 0\n while A[-1] <= m:\n ret = max(ret, dfs(A))\n A[-1] += 1\n A.pop()\n return ret\n\n\nans = dfs()\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-from itertools import *","-ans = 0","-for A in combinations_with_replacement(list(range(1, m + 1)), n): # nHr","- now = sum(d if A[b - 1] - A[a - 1] == c else 0 for a, b, c, d in abcd)","- ans = max(ans, now)","+","+def dfs(A=[1]): # A:1 origin","+ if n + 1 <= len(A):","+ return sum(d if A[b] - A[a] == c else 0 for a, b, c, d in abcd)","+ A.append(A[-1])","+ ret = 0","+ while A[-1] <= m:","+ ret = max(ret, dfs(A))","+ A[-1] += 1","+ A.pop()","+ return ret","+","+","+ans = dfs()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0577102175,"measured_runtime_v1":0.0667320631,"runtime_lift":0.8648049352,"key":["s770632039","s932883401"]} +{"user_id":"u678167152","problem_id":"p02588","language":"python","submission_id_v0":"s548406249","submission_id_v1":"s131216921","cpu_time_v0":1774,"cpu_time_v1":431,"memory_v0":277540,"memory_v1":100148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.7,"input":"from decimal import Decimal\n\ndef waru(N,num):\n\n cnt = 0\n\n while N%num==0:\n\n N \/\/= num\n\n cnt += 1\n\n return cnt\n\ndef solve():\n\n N = int(eval(input()))\n\n num = [[0]*101 for _ in range(101)]\n\n lis = [0]*N\n\n for i in range(N):\n\n a = int(Decimal(eval(input()))*10**9)\n\n two,five = waru(a,2)-9,waru(a,5)-9\n\n two -= 50\n\n five -= 50\n\n num[two][five] += 1\n\n lis[i] = [two,five]\n\n cum2 = [[0]*101 for _ in range(101)]\n\n for i in range(99,-1,-1):\n\n for j in range(99,-1,-1):\n\n cum2[i][j] = cum2[i+1][j]+cum2[i][j+1]-cum2[i+1][j+1]+num[i][j]\n\n ans = 0\n\n for i in range(N):\n\n two,five = lis[i]\n\n two2,five2 = -(two+50)-50,-(five+50)-50\n\n ans += cum2[two2][five2]\n\n if two+50>=0 and five+50>=0:\n\n ans -= 1\n\n return ans\/\/2\n\nprint((solve()))","target":"from decimal import Decimal\n\ndef waru(N,num):\n\n cnt = 0\n\n while N%num==0:\n\n N \/\/= num\n\n cnt += 1\n\n return cnt\n\ndef solve():\n\n N = int(eval(input()))\n\n num = [[0]*101 for _ in range(101)]\n\n lis = [0]*N\n\n for i in range(N):\n\n a = eval(input())\n\n b = a.split(\".\")\n\n if len(b)==1:\n\n a = int(a)*(10**9)\n\n else:\n\n a = int(b[0] + b[1] + (9-len(b[1]))*\"0\")\n\n two,five = waru(a,2)-9,waru(a,5)-9\n\n two -= 50\n\n five -= 50\n\n num[two][five] += 1\n\n lis[i] = [two,five]\n\n cum2 = [[0]*101 for _ in range(101)]\n\n for i in range(99,-1,-1):\n\n for j in range(99,-1,-1):\n\n cum2[i][j] = cum2[i+1][j]+cum2[i][j+1]-cum2[i+1][j+1]+num[i][j]\n\n ans = 0\n\n for i in range(N):\n\n two,five = lis[i]\n\n two2,five2 = -(two+50)-50,-(five+50)-50\n\n ans += cum2[two2][five2]\n\n if two+50>=0 and five+50>=0:\n\n ans -= 1\n\n return ans\/\/2\n\nprint((solve()))","code_v0_loc":31,"code_v1_loc":36,"code_v0_num_chars":771,"code_v1_num_chars":881,"code_v0_no_empty_lines":"from decimal import Decimal\n\n\ndef waru(N, num):\n cnt = 0\n while N % num == 0:\n N \/\/= num\n cnt += 1\n return cnt\n\n\ndef solve():\n N = int(eval(input()))\n num = [[0] * 101 for _ in range(101)]\n lis = [0] * N\n for i in range(N):\n a = int(Decimal(eval(input())) * 10**9)\n two, five = waru(a, 2) - 9, waru(a, 5) - 9\n two -= 50\n five -= 50\n num[two][five] += 1\n lis[i] = [two, five]\n cum2 = [[0] * 101 for _ in range(101)]\n for i in range(99, -1, -1):\n for j in range(99, -1, -1):\n cum2[i][j] = (\n cum2[i + 1][j] + cum2[i][j + 1] - cum2[i + 1][j + 1] + num[i][j]\n )\n ans = 0\n for i in range(N):\n two, five = lis[i]\n two2, five2 = -(two + 50) - 50, -(five + 50) - 50\n ans += cum2[two2][five2]\n if two + 50 >= 0 and five + 50 >= 0:\n ans -= 1\n return ans \/\/ 2\n\n\nprint((solve()))\n","code_v1_no_empty_lines":"from decimal import Decimal\n\n\ndef waru(N, num):\n cnt = 0\n while N % num == 0:\n N \/\/= num\n cnt += 1\n return cnt\n\n\ndef solve():\n N = int(eval(input()))\n num = [[0] * 101 for _ in range(101)]\n lis = [0] * N\n for i in range(N):\n a = eval(input())\n b = a.split(\".\")\n if len(b) == 1:\n a = int(a) * (10**9)\n else:\n a = int(b[0] + b[1] + (9 - len(b[1])) * \"0\")\n two, five = waru(a, 2) - 9, waru(a, 5) - 9\n two -= 50\n five -= 50\n num[two][five] += 1\n lis[i] = [two, five]\n cum2 = [[0] * 101 for _ in range(101)]\n for i in range(99, -1, -1):\n for j in range(99, -1, -1):\n cum2[i][j] = (\n cum2[i + 1][j] + cum2[i][j + 1] - cum2[i + 1][j + 1] + num[i][j]\n )\n ans = 0\n for i in range(N):\n two, five = lis[i]\n two2, five2 = -(two + 50) - 50, -(five + 50) - 50\n ans += cum2[two2][five2]\n if two + 50 >= 0 and five + 50 >= 0:\n ans -= 1\n return ans \/\/ 2\n\n\nprint((solve()))\n","code_same":false,"relative_loc_diff_percent":13.8888888889,"diff":["- a = int(Decimal(eval(input())) * 10**9)","+ a = eval(input())","+ b = a.split(\".\")","+ if len(b) == 1:","+ a = int(a) * (10**9)","+ else:","+ a = int(b[0] + b[1] + (9 - len(b[1])) * \"0\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.083796521,"measured_runtime_v1":0.0374629227,"runtime_lift":2.2367854687,"key":["s548406249","s131216921"]} +{"user_id":"u133936772","problem_id":"p03031","language":"python","submission_id_v0":"s948294592","submission_id_v1":"s175514569","cpu_time_v0":33,"cpu_time_v1":26,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.21,"input":"f = lambda : list(map(int, input().split()))\n\n\n\nn, m = f()\n\nll = [[0]*n for i in range(m)]\n\nfor i in range(m):\n\n _, *t = f()\n\n for j in t:\n\n ll[i][j-1] = 1\n\nlp = list(f())\n\n\n\nimport itertools as it\n\nans = 0\n\n\n\nfor p in it.product([0,1], repeat=n):\n\n if lp == [sum(a*b for a, b in zip(p,l))%2 for l in ll]:\n\n ans += 1\n\n\n\nprint(ans)","target":"f=lambda:list(map(int,input().split()))\n\nn,m=f()\n\nll=[[0]*n for _ in range(m)]\n\nfor l in ll:\n\n k,*s=f()\n\n for i in s: l[i-1]=1\n\np=list(f())\n\nimport itertools as it\n\nprint((sum(all(sum(a*b for a,b in zip(l,t))%2==p[i] for i,l in enumerate(ll)) for t in it.product([0,1],repeat=n))))","code_v0_loc":18,"code_v1_loc":9,"code_v0_num_chars":333,"code_v1_num_chars":275,"code_v0_no_empty_lines":"f = lambda: list(map(int, input().split()))\nn, m = f()\nll = [[0] * n for i in range(m)]\nfor i in range(m):\n _, *t = f()\n for j in t:\n ll[i][j - 1] = 1\nlp = list(f())\nimport itertools as it\n\nans = 0\nfor p in it.product([0, 1], repeat=n):\n if lp == [sum(a * b for a, b in zip(p, l)) % 2 for l in ll]:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"f = lambda: list(map(int, input().split()))\nn, m = f()\nll = [[0] * n for _ in range(m)]\nfor l in ll:\n k, *s = f()\n for i in s:\n l[i - 1] = 1\np = list(f())\nimport itertools as it\n\nprint(\n (\n sum(\n all(sum(a * b for a, b in zip(l, t)) % 2 == p[i] for i, l in enumerate(ll))\n for t in it.product([0, 1], repeat=n)\n )\n )\n)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-ll = [[0] * n for i in range(m)]","-for i in range(m):","- _, *t = f()","- for j in t:","- ll[i][j - 1] = 1","-lp = list(f())","+ll = [[0] * n for _ in range(m)]","+for l in ll:","+ k, *s = f()","+ for i in s:","+ l[i - 1] = 1","+p = list(f())","-ans = 0","-for p in it.product([0, 1], repeat=n):","- if lp == [sum(a * b for a, b in zip(p, l)) % 2 for l in ll]:","- ans += 1","-print(ans)","+print(","+ (","+ sum(","+ all(sum(a * b for a, b in zip(l, t)) % 2 == p[i] for i, l in enumerate(ll))","+ for t in it.product([0, 1], repeat=n)","+ )","+ )","+)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0760593934,"measured_runtime_v1":0.040454469,"runtime_lift":1.8801233914,"key":["s948294592","s175514569"]} +{"user_id":"u163320134","problem_id":"p02615","language":"python","submission_id_v0":"s252863830","submission_id_v1":"s350631795","cpu_time_v0":281,"cpu_time_v1":137,"memory_v0":31644,"memory_v1":31548,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.25,"input":"import heapq\n\n\n\nn=int(eval(input()))\n\narr=list(map(int,input().split()))\n\narr=sorted(arr,reverse=True)\n\nans=0\n\nq=[]\n\nheapq.heappush(q,-arr[0])\n\nfor i in range(1,n):\n\n tmp=heapq.heappop(q)\n\n tmp*=-1\n\n ans+=tmp\n\n heapq.heappush(q,-arr[i])\n\n heapq.heappush(q,-arr[i])\n\nprint(ans)","target":"n=int(eval(input()))\n\narr=list(map(int,input().split()))\n\narr=sorted(arr,reverse=True)\n\nans=0\n\nfor i in range(1,n):\n\n ans+=arr[i\/\/2]\n\nprint(ans)","code_v0_loc":15,"code_v1_loc":7,"code_v0_num_chars":275,"code_v1_num_chars":139,"code_v0_no_empty_lines":"import heapq\n\nn = int(eval(input()))\narr = list(map(int, input().split()))\narr = sorted(arr, reverse=True)\nans = 0\nq = []\nheapq.heappush(q, -arr[0])\nfor i in range(1, n):\n tmp = heapq.heappop(q)\n tmp *= -1\n ans += tmp\n heapq.heappush(q, -arr[i])\n heapq.heappush(q, -arr[i])\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\narr = list(map(int, input().split()))\narr = sorted(arr, reverse=True)\nans = 0\nfor i in range(1, n):\n ans += arr[i \/\/ 2]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":53.3333333333,"diff":["-import heapq","-","-q = []","-heapq.heappush(q, -arr[0])","- tmp = heapq.heappop(q)","- tmp *= -1","- ans += tmp","- heapq.heappush(q, -arr[i])","- heapq.heappush(q, -arr[i])","+ ans += arr[i \/\/ 2]"],"diff_only_import_comment":false,"measured_runtime_v0":0.1132078525,"measured_runtime_v1":0.0429372405,"runtime_lift":2.6365889173,"key":["s252863830","s350631795"]} +{"user_id":"u761320129","problem_id":"p03745","language":"python","submission_id_v0":"s671657680","submission_id_v1":"s438687486","cpu_time_v0":82,"cpu_time_v1":71,"memory_v0":14224,"memory_v1":15020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.41,"input":"N = int(eval(input()))\n\nsrc = list(map(int,input().split()))\n\nasc = None\n\nans = 1\n\nfor i in range(N-1):\n\n d = src[i+1] - src[i]\n\n if d == 0: continue\n\n if asc is None:\n\n asc = d > 0\n\n elif (asc and d < 0) or (not asc and d > 0):\n\n ans += 1\n\n asc = None\n\nprint(ans)","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nans = 1\n\nup = None\n\nfor a,b in zip(A,A[1:]):\n\n if a==b: continue\n\n if a 0\n elif (asc and d < 0) or (not asc and d > 0):\n ans += 1\n asc = None\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nans = 1\nup = None\nfor a, b in zip(A, A[1:]):\n if a == b:\n continue\n if a < b:\n if up is None:\n up = True\n elif not up:\n ans += 1\n up = None\n else:\n if up is None:\n up = False\n elif up:\n ans += 1\n up = None\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":35.0,"diff":["-src = list(map(int, input().split()))","-asc = None","+A = list(map(int, input().split()))","-for i in range(N - 1):","- d = src[i + 1] - src[i]","- if d == 0:","+up = None","+for a, b in zip(A, A[1:]):","+ if a == b:","- if asc is None:","- asc = d > 0","- elif (asc and d < 0) or (not asc and d > 0):","- ans += 1","- asc = None","+ if a < b:","+ if up is None:","+ up = True","+ elif not up:","+ ans += 1","+ up = None","+ else:","+ if up is None:","+ up = False","+ elif up:","+ ans += 1","+ up = None"],"diff_only_import_comment":false,"measured_runtime_v0":0.0425197573,"measured_runtime_v1":0.0434406407,"runtime_lift":0.9788013387,"key":["s671657680","s438687486"]} +{"user_id":"u634079249","problem_id":"p02881","language":"python","submission_id_v0":"s606398429","submission_id_v1":"s033374434","cpu_time_v0":1963,"cpu_time_v1":202,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.71,"input":"import sys\n\nimport os\n\n\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = int(sys.stdin.readline().rstrip())\n\n\n\n ret = float('inf')\n\n for i in range(1, 10000000):\n\n q, mod = divmod(N, i)\n\n if mod == 0:\n\n j = N \/\/ i\n\n ret = min(ret, ((j-1)+(i-1)))\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","target":"import sys\n\nimport os\n\nimport math\n\n\n\ndef main():\n\n if os.getenv(\"LOCAL\"):\n\n sys.stdin = open(\"input.txt\", \"r\")\n\n\n\n N = int(sys.stdin.readline().rstrip())\n\n\n\n max = int(math.sqrt(N) + 1)\n\n ret = float('inf')\n\n for i in range(1, max):\n\n q, mod = divmod(N, i)\n\n if mod == 0:\n\n j = N \/\/ i\n\n ret = min(ret, ((j-1)+(i-1)))\n\n\n\n print(ret)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":22,"code_v1_loc":23,"code_v0_num_chars":398,"code_v1_num_chars":438,"code_v0_no_empty_lines":"import sys\nimport os\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = int(sys.stdin.readline().rstrip())\n ret = float(\"inf\")\n for i in range(1, 10000000):\n q, mod = divmod(N, i)\n if mod == 0:\n j = N \/\/ i\n ret = min(ret, ((j - 1) + (i - 1)))\n print(ret)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport os\nimport math\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n N = int(sys.stdin.readline().rstrip())\n max = int(math.sqrt(N) + 1)\n ret = float(\"inf\")\n for i in range(1, max):\n q, mod = divmod(N, i)\n if mod == 0:\n j = N \/\/ i\n ret = min(ret, ((j - 1) + (i - 1)))\n print(ret)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["+import math","+ max = int(math.sqrt(N) + 1)","- for i in range(1, 10000000):","+ for i in range(1, max):"],"diff_only_import_comment":false,"measured_runtime_v0":1.6952660084,"measured_runtime_v1":0.0369840903,"runtime_lift":45.8377100227,"key":["s606398429","s033374434"]} +{"user_id":"u732844340","problem_id":"p03779","language":"python","submission_id_v0":"s071501038","submission_id_v1":"s851187448","cpu_time_v0":30,"cpu_time_v1":25,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"if __name__ == '__main__':\n\n x = abs(int(eval(input())))\n\n\n\n s = 0\n\n for i in range(0,10 ** 9):\n\n if s > x: \n\n print((i - 1))\n\n break\n\n elif s == x:\n\n print((i - 1))\n\n break\n\n s += i","target":"if __name__ == '__main__':\n\n x = abs(int(eval(input())))\n\n\n\n s = 0\n\n for i in range(0,10 ** 9):\n\n if s >= x: \n\n print((i - 1))\n\n break\n\n s += i","code_v0_loc":12,"code_v1_loc":9,"code_v0_num_chars":246,"code_v1_num_chars":180,"code_v0_no_empty_lines":"if __name__ == \"__main__\":\n x = abs(int(eval(input())))\n s = 0\n for i in range(0, 10**9):\n if s > x:\n print((i - 1))\n break\n elif s == x:\n print((i - 1))\n break\n s += i\n","code_v1_no_empty_lines":"if __name__ == \"__main__\":\n x = abs(int(eval(input())))\n s = 0\n for i in range(0, 10**9):\n if s >= x:\n print((i - 1))\n break\n s += i\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["- if s > x:","- print((i - 1))","- break","- elif s == x:","+ if s >= x:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0464967251,"measured_runtime_v1":0.0086567879,"runtime_lift":5.371129074,"key":["s071501038","s851187448"]} +{"user_id":"u072053884","problem_id":"p02245","language":"python","submission_id_v0":"s574135174","submission_id_v1":"s696240934","cpu_time_v0":1190,"cpu_time_v1":120,"memory_v0":37408,"memory_v1":10724,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.92,"input":"import sys\n\n\n\ninit = ''.join(sys.stdin.read().split())\n\n\n\ngenerated_state = {init: 0}\n\n\n\ndef bfs(root):\n\n s = 0\n\n configure = [root]\n\n while '123456780' not in configure:\n\n q = iter(configure)\n\n configure = []\n\n s += 1\n\n for c in q:\n\n i = c.find('0')\n\n if 0 <= i <= 5:\n\n t = str.maketrans('0' + c[i+3], c[i+3] + '0')\n\n t_c = c.translate(t)\n\n if t_c not in generated_state:\n\n generated_state[t_c] = s\n\n configure.append(t_c)\n\n if i >= 3:\n\n t = str.maketrans('0' + c[i-3], c[i-3] + '0')\n\n t_c = c.translate(t)\n\n if t_c not in generated_state:\n\n generated_state[t_c] = s\n\n configure.append(t_c)\n\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n\n t = str.maketrans('0' + c[i+1], c[i+1] + '0')\n\n t_c = c.translate(t)\n\n if t_c not in generated_state:\n\n generated_state[t_c] = s\n\n configure.append(t_c)\n\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n\n t = str.maketrans('0' + c[i-1], c[i-1] + '0')\n\n t_c = c.translate(t)\n\n if t_c not in generated_state:\n\n generated_state[t_c] = s\n\n configure.append(t_c)\n\n if '123456780' in generated_state:\n\n break\n\n print(s)\n\n\n\nbfs(init)","target":"import sys\n\n\n\ninit = ''.join(sys.stdin.read().split())\n\n\n\n# Bidirectional search using breadth-first search\n\ndef solve(start, goal):\n\n if start == goal:\n\n return 0\n\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n\n step = {start: 0, goal: 0}\n\n s = 0\n\n c_d = [(start, 0), (goal, 1)] # configure and direction\n\n while True:\n\n q = iter(c_d)\n\n c_d = []\n\n s += 1\n\n for c, d in q:\n\n i = c.find('0')\n\n if 0 <= i <= 5:\n\n t = str.maketrans('0' + c[i+3], c[i+3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i >= 3:\n\n t = str.maketrans('0' + c[i-3], c[i-3] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n\n t = str.maketrans('0' + c[i+1], c[i+1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n\n t = str.maketrans('0' + c[i-1], c[i-1] + '0')\n\n t_c = c.translate(t)\n\n if t_c in generated_state:\n\n if generated_state[t_c] != d:\n\n return s + step[t_c]\n\n else:\n\n generated_state[t_c] = d\n\n step[t_c] = s\n\n c_d.append((t_c, d))\n\n\n\nprint((solve(init, '123456780')))","code_v0_loc":44,"code_v1_loc":60,"code_v0_num_chars":1549,"code_v1_num_chars":2264,"code_v0_no_empty_lines":"import sys\n\ninit = \"\".join(sys.stdin.read().split())\ngenerated_state = {init: 0}\n\n\ndef bfs(root):\n s = 0\n configure = [root]\n while \"123456780\" not in configure:\n q = iter(configure)\n configure = []\n s += 1\n for c in q:\n i = c.find(\"0\")\n if 0 <= i <= 5:\n t = str.maketrans(\"0\" + c[i + 3], c[i + 3] + \"0\")\n t_c = c.translate(t)\n if t_c not in generated_state:\n generated_state[t_c] = s\n configure.append(t_c)\n if i >= 3:\n t = str.maketrans(\"0\" + c[i - 3], c[i - 3] + \"0\")\n t_c = c.translate(t)\n if t_c not in generated_state:\n generated_state[t_c] = s\n configure.append(t_c)\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n t = str.maketrans(\"0\" + c[i + 1], c[i + 1] + \"0\")\n t_c = c.translate(t)\n if t_c not in generated_state:\n generated_state[t_c] = s\n configure.append(t_c)\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n t = str.maketrans(\"0\" + c[i - 1], c[i - 1] + \"0\")\n t_c = c.translate(t)\n if t_c not in generated_state:\n generated_state[t_c] = s\n configure.append(t_c)\n if \"123456780\" in generated_state:\n break\n print(s)\n\n\nbfs(init)\n","code_v1_no_empty_lines":"import sys\n\ninit = \"\".join(sys.stdin.read().split())\n# Bidirectional search using breadth-first search\ndef solve(start, goal):\n if start == goal:\n return 0\n generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward\n step = {start: 0, goal: 0}\n s = 0\n c_d = [(start, 0), (goal, 1)] # configure and direction\n while True:\n q = iter(c_d)\n c_d = []\n s += 1\n for c, d in q:\n i = c.find(\"0\")\n if 0 <= i <= 5:\n t = str.maketrans(\"0\" + c[i + 3], c[i + 3] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i >= 3:\n t = str.maketrans(\"0\" + c[i - 3], c[i - 3] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i == 0 or i == 1 or i == 3 or i == 4 or i == 6 or i == 7:\n t = str.maketrans(\"0\" + c[i + 1], c[i + 1] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n if i == 1 or i == 2 or i == 4 or i == 5 or i == 7 or i == 8:\n t = str.maketrans(\"0\" + c[i - 1], c[i - 1] + \"0\")\n t_c = c.translate(t)\n if t_c in generated_state:\n if generated_state[t_c] != d:\n return s + step[t_c]\n else:\n generated_state[t_c] = d\n step[t_c] = s\n c_d.append((t_c, d))\n\n\nprint((solve(init, \"123456780\")))\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["-generated_state = {init: 0}","-","-","-def bfs(root):","+# Bidirectional search using breadth-first search","+def solve(start, goal):","+ if start == goal:","+ return 0","+ generated_state = {start: 0, goal: 1} # 0: foreward, 1: backward","+ step = {start: 0, goal: 0}","- configure = [root]","- while \"123456780\" not in configure:","- q = iter(configure)","- configure = []","+ c_d = [(start, 0), (goal, 1)] # configure and direction","+ while True:","+ q = iter(c_d)","+ c_d = []","- for c in q:","+ for c, d in q:","- if t_c not in generated_state:","- generated_state[t_c] = s","- configure.append(t_c)","+ if t_c in generated_state:","+ if generated_state[t_c] != d:","+ return s + step[t_c]","+ else:","+ generated_state[t_c] = d","+ step[t_c] = s","+ c_d.append((t_c, d))","- if t_c not in generated_state:","- generated_state[t_c] = s","- configure.append(t_c)","+ if t_c in generated_state:","+ if generated_state[t_c] != d:","+ return s + step[t_c]","+ else:","+ generated_state[t_c] = d","+ step[t_c] = s","+ c_d.append((t_c, d))","- if t_c not in generated_state:","- generated_state[t_c] = s","- configure.append(t_c)","+ if t_c in generated_state:","+ if generated_state[t_c] != d:","+ return s + step[t_c]","+ else:","+ generated_state[t_c] = d","+ step[t_c] = s","+ c_d.append((t_c, d))","- if t_c not in generated_state:","- generated_state[t_c] = s","- configure.append(t_c)","- if \"123456780\" in generated_state:","- break","- print(s)","+ if t_c in generated_state:","+ if generated_state[t_c] != d:","+ return s + step[t_c]","+ else:","+ generated_state[t_c] = d","+ step[t_c] = s","+ c_d.append((t_c, d))","-bfs(init)","+print((solve(init, \"123456780\")))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1405226946,"measured_runtime_v1":0.0434279084,"runtime_lift":3.2357693397,"key":["s574135174","s696240934"]} +{"user_id":"u576917603","problem_id":"p02861","language":"python","submission_id_v0":"s604516022","submission_id_v1":"s619746320","cpu_time_v0":486,"cpu_time_v1":446,"memory_v0":8052,"memory_v1":8100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.23,"input":"n=int(eval(input()))\n\na=[[int(i)for i in input().split()]for i in range(n)]\n\nimport itertools as it\n\nli=list(it.permutations(list(range(n))))\n\ntotal=0\n\nfor i in li:\n\n tmp=0\n\n for j in range(n-1):\n\n x1,x2=a[i[j]][0],a[i[j+1]][0]\n\n y1,y2=a[i[j]][1],a[i[j+1]][1]\n\n tmp=(x1-x2)**2+(y1-y2)**2\n\n total+=tmp**0.5\n\nprint((total\/len(li)))","target":"n=int(eval(input()))\n\na=[[int(i) for i in input().split()] for i in range(n)]\n\n\n\nimport itertools\n\nimport math\n\npe=itertools.permutations(list(range(n)))\n\npe=list(pe)\n\nans=0\n\n\n\nfor i in pe:\n\n tmp=0\n\n for j in range(n-1):\n\n tmp+=((a[i[j]][0]-a[i[j+1]][0])**2+(a[i[j]][1]-a[i[j+1]][1])**2)**0.5\n\n ans+=tmp\n\nprint((ans\/math.factorial(n)))","code_v0_loc":13,"code_v1_loc":15,"code_v0_num_chars":349,"code_v1_num_chars":337,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [[int(i) for i in input().split()] for i in range(n)]\nimport itertools as it\n\nli = list(it.permutations(list(range(n))))\ntotal = 0\nfor i in li:\n tmp = 0\n for j in range(n - 1):\n x1, x2 = a[i[j]][0], a[i[j + 1]][0]\n y1, y2 = a[i[j]][1], a[i[j + 1]][1]\n tmp = (x1 - x2) ** 2 + (y1 - y2) ** 2\n total += tmp**0.5\nprint((total \/ len(li)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = [[int(i) for i in input().split()] for i in range(n)]\nimport itertools\nimport math\n\npe = itertools.permutations(list(range(n)))\npe = list(pe)\nans = 0\nfor i in pe:\n tmp = 0\n for j in range(n - 1):\n tmp += (\n (a[i[j]][0] - a[i[j + 1]][0]) ** 2 + (a[i[j]][1] - a[i[j + 1]][1]) ** 2\n ) ** 0.5\n ans += tmp\nprint((ans \/ math.factorial(n)))\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-import itertools as it","+import itertools","+import math","-li = list(it.permutations(list(range(n))))","-total = 0","-for i in li:","+pe = itertools.permutations(list(range(n)))","+pe = list(pe)","+ans = 0","+for i in pe:","- x1, x2 = a[i[j]][0], a[i[j + 1]][0]","- y1, y2 = a[i[j]][1], a[i[j + 1]][1]","- tmp = (x1 - x2) ** 2 + (y1 - y2) ** 2","- total += tmp**0.5","-print((total \/ len(li)))","+ tmp += (","+ (a[i[j]][0] - a[i[j + 1]][0]) ** 2 + (a[i[j]][1] - a[i[j + 1]][1]) ** 2","+ ) ** 0.5","+ ans += tmp","+print((ans \/ math.factorial(n)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0380586624,"measured_runtime_v1":0.0323830605,"runtime_lift":1.1752645324,"key":["s604516022","s619746320"]} +{"user_id":"u992465933","problem_id":"p03632","language":"python","submission_id_v0":"s455936640","submission_id_v1":"s093727314","cpu_time_v0":206,"cpu_time_v1":63,"memory_v0":62752,"memory_v1":62840,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.42,"input":"import sys\n\nsys.setrecursionlimit(4100000)\n\nimport math\n\nimport itertools\n\nINF = float('inf')\n\nfrom heapq import heapify, heappop, heappush\n\n\n\ndef main():\n\n a,b,c,d = list(map(int, input().split()))\n\n\n\n tmp = set(list(range(a,b+1))) & set(list(range(c, d+1)))\n\n print((max(0, len(tmp)-1)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nsys.setrecursionlimit(4100000)\n\nimport math\n\nimport itertools\n\nINF = float('inf')\n\nfrom heapq import heapify, heappop, heappush\n\n\n\ndef main():\n\n a,b,c,d = list(map(int, input().split()))\n\n\n\n print((max(0, min(b,d)-max(a,c))))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":335,"code_v1_num_chars":280,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(4100000)\nimport math\nimport itertools\n\nINF = float(\"inf\")\nfrom heapq import heapify, heappop, heappush\n\n\ndef main():\n a, b, c, d = list(map(int, input().split()))\n tmp = set(list(range(a, b + 1))) & set(list(range(c, d + 1)))\n print((max(0, len(tmp) - 1)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(4100000)\nimport math\nimport itertools\n\nINF = float(\"inf\")\nfrom heapq import heapify, heappop, heappush\n\n\ndef main():\n a, b, c, d = list(map(int, input().split()))\n print((max(0, min(b, d) - max(a, c))))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["- tmp = set(list(range(a, b + 1))) & set(list(range(c, d + 1)))","- print((max(0, len(tmp) - 1)))","+ print((max(0, min(b, d) - max(a, c))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0845842688,"measured_runtime_v1":0.0881591206,"runtime_lift":0.9594500066,"key":["s455936640","s093727314"]} +{"user_id":"u150984829","problem_id":"p02271","language":"python","submission_id_v0":"s636158904","submission_id_v1":"s083804445","cpu_time_v0":4790,"cpu_time_v1":1080,"memory_v0":51252,"memory_v1":5660,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":77.45,"input":"n=int(eval(input()))\n\nA=list(map(int,input().split()))\n\nr=[]\n\ndef f(s,k):\n\n if k>=0:\n\n global r\n\n r+=[s]\n\n f(s+A[k-1],k-1)\n\n f(s,k-1)\n\nf(0,n)\n\neval(input())\n\nfor e in map(int,input().split()):print((['no','yes'][e in r]))\n","target":"n=int(eval(input()))\n\nA=list(map(int,input().split()))\n\nr=set()\n\ndef f(s,k):\n\n if k>=0:\n\n global r\n\n r.add(s)\n\n f(s+A[k-1],k-1)\n\n f(s,k-1)\n\nf(0,n)\n\neval(input())\n\nfor e in map(int,input().split()):print((['no','yes'][e in r]))\n","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":239,"code_v1_num_chars":244,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nr = []\n\n\ndef f(s, k):\n if k >= 0:\n global r\n r += [s]\n f(s + A[k - 1], k - 1)\n f(s, k - 1)\n\n\nf(0, n)\neval(input())\nfor e in map(int, input().split()):\n print(([\"no\", \"yes\"][e in r]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nr = set()\n\n\ndef f(s, k):\n if k >= 0:\n global r\n r.add(s)\n f(s + A[k - 1], k - 1)\n f(s, k - 1)\n\n\nf(0, n)\neval(input())\nfor e in map(int, input().split()):\n print(([\"no\", \"yes\"][e in r]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-r = []","+r = set()","- r += [s]","+ r.add(s)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0365554373,"measured_runtime_v1":0.0362488654,"runtime_lift":1.008457422,"key":["s636158904","s083804445"]} +{"user_id":"u223663729","problem_id":"p02759","language":"python","submission_id_v0":"s865779974","submission_id_v1":"s861461292","cpu_time_v0":177,"cpu_time_v1":18,"memory_v0":38384,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.83,"input":"N = int(eval(input()))\n\n\n\nprint(((N+1)>>1))","target":"print(((int(eval(input()))+1)\/\/2))","code_v0_loc":3,"code_v1_loc":1,"code_v0_num_chars":35,"code_v1_num_chars":26,"code_v0_no_empty_lines":"N = int(eval(input()))\nprint(((N + 1) >> 1))\n","code_v1_no_empty_lines":"print(((int(eval(input())) + 1) \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-N = int(eval(input()))","-print(((N + 1) >> 1))","+print(((int(eval(input())) + 1) \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0433238015,"measured_runtime_v1":0.0389340446,"runtime_lift":1.1127485457,"key":["s865779974","s861461292"]} +{"user_id":"u631277801","problem_id":"p03699","language":"python","submission_id_v0":"s486965186","submission_id_v1":"s932542430","cpu_time_v0":288,"cpu_time_v1":18,"memory_v0":5388,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":93.75,"input":"from collections import Counter\n\n\n\nn = int(eval(input()))\n\ns = []\n\nfor _ in range(n):\n\n s.append(int(eval(input())))\n\n \n\ncnt = Counter([0, s[0]])\n\n\n\nif len(s) > 1:\n\n for si in s[1:]:\n\n tmp = Counter([])\n\n for k,v in list(cnt.items()):\n\n tmp[k + si] = v\n\n \n\n cnt += tmp\n\n\n\nkey_list = sorted(list(cnt.keys()), reverse=True)\n\n\n\nfor k in key_list:\n\n if k == 0:\n\n print(k)\n\n break\n\n \n\n elif k%10 == 0:\n\n continue\n\n \n\n print(k)\n\n break","target":"n = int(eval(input()))\n\ns = []\n\nfor _ in range(n):\n\n s.append(int(eval(input())))\n\n\n\ntotal = sum(s)\n\n\n\nif total % 10 != 0:\n\n print(total)\n\n\n\nelse:\n\n s.sort() \n\n min_s = total\n\n \n\n for si in s:\n\n if si % 10 != 0:\n\n min_s = si\n\n break\n\n \n\n print((total - min_s))","code_v0_loc":29,"code_v1_loc":20,"code_v0_num_chars":502,"code_v1_num_chars":306,"code_v0_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\ns = []\nfor _ in range(n):\n s.append(int(eval(input())))\ncnt = Counter([0, s[0]])\nif len(s) > 1:\n for si in s[1:]:\n tmp = Counter([])\n for k, v in list(cnt.items()):\n tmp[k + si] = v\n cnt += tmp\nkey_list = sorted(list(cnt.keys()), reverse=True)\nfor k in key_list:\n if k == 0:\n print(k)\n break\n elif k % 10 == 0:\n continue\n print(k)\n break\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = []\nfor _ in range(n):\n s.append(int(eval(input())))\ntotal = sum(s)\nif total % 10 != 0:\n print(total)\nelse:\n s.sort()\n min_s = total\n for si in s:\n if si % 10 != 0:\n min_s = si\n break\n print((total - min_s))\n","code_same":false,"relative_loc_diff_percent":31.0344827586,"diff":["-from collections import Counter","-","-cnt = Counter([0, s[0]])","-if len(s) > 1:","- for si in s[1:]:","- tmp = Counter([])","- for k, v in list(cnt.items()):","- tmp[k + si] = v","- cnt += tmp","-key_list = sorted(list(cnt.keys()), reverse=True)","-for k in key_list:","- if k == 0:","- print(k)","- break","- elif k % 10 == 0:","- continue","- print(k)","- break","+total = sum(s)","+if total % 10 != 0:","+ print(total)","+else:","+ s.sort()","+ min_s = total","+ for si in s:","+ if si % 10 != 0:","+ min_s = si","+ break","+ print((total - min_s))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0430911157,"measured_runtime_v1":0.0365128102,"runtime_lift":1.1801643157,"key":["s486965186","s932542430"]} +{"user_id":"u729133443","problem_id":"p02573","language":"python","submission_id_v0":"s853094621","submission_id_v1":"s140417434","cpu_time_v0":42,"cpu_time_v1":38,"memory_v0":9700,"memory_v1":9900,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.52,"input":"import sys\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n import os, zlib, base64\n\n open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode(\"c$`&I!ES>v480@q58h!atm#yy9VRsPBOM1P1R4zjN;6H{*Uu)DfG;HPJ=@O?ts4jEja1J!?~Lt0nPD28hd~cF?bD=Xf%^5=(LPV;uc^(s~w9Rs`V`us@O@LyhqyPmKoCExGHNA#n5phT&7e`qhVbc=x4zF(|NT=~DGF(lOmEsIX(ws;WNT>a`v!FJr_}w?$Cy;51zfTT$iwsPi>V!e5yk9-B{lpk>lD|KRh>h5\")))\n\n os.system('cythonize -i -3 -b solve.pyx')\n\nimport solve","target":"import sys\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n import os, zlib, base64\n\n open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode(\"c${TY%Wi`(5WFMt58Fc(Xq*VD9x7D&BPj>l7_bTkIj*Ai>${5yulNExGoBr{aRttH)I;%|$Qg=gd9dxR@Di;P73FNP9dUGDQNlrr!HyueleslJL(9LLK>v^G%;rmuCIg#qB2DZxNO4vB|vjcygBlZci;a!M4%3#=<-KH%*=17Q{aUKnzd7$r^Mh?)~>JZY8tu?FNSSF3obEX4)B&4>QOg%{W&$?iM3r$#)#@1-i>2bH|?5DKSQZ$O1|v2Wz}2I=r-M5)Wxd_@vZhgv>n8k$Q*}~?$i?{b`*|*!&44o)o(qXPyC2tN78cW$sb`#As%5$;I{B+f6Pb!JtGS5K99vu#l*|yora61crqIw#8`%bf6>w5x%@H*ya+t$KlVq{`2\")))\n\n os.system('cythonize -i -3 -b solve.pyx')\n\nimport solve","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":662,"code_v1_num_chars":667,"code_v0_no_empty_lines":"import sys\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n import os, zlib, base64\n\n open(\"solve.pyx\", \"wb\").write(\n zlib.decompress(\n base64.b85decode(\n \"c$`&I!ES>v480@q58h!atm#yy9VRsPBOM1P1R4zjN;6H{*Uu)DfG;HPJ=@O?ts4jEja1J!?~Lt0nPD28hd~cF?bD=Xf%^5=(LPV;uc^(s~w9Rs`V`us@O@LyhqyPmKoCExGHNA#n5phT&7e`qhVbc=x4zF(|NT=~DGF(lOmEsIX(ws;WNT>a`v!FJr_}w?$Cy;51zfTT$iwsPi>V!e5yk9-B{lpk>lD|KRh>h5\"\n )\n )\n )\n os.system(\"cythonize -i -3 -b solve.pyx\")\nimport solve\n","code_v1_no_empty_lines":"import sys\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n import os, zlib, base64\n\n open(\"solve.pyx\", \"wb\").write(\n zlib.decompress(\n base64.b85decode(\n \"c${TY%Wi`(5WFMt58Fc(Xq*VD9x7D&BPj>l7_bTkIj*Ai>${5yulNExGoBr{aRttH)I;%|$Qg=gd9dxR@Di;P73FNP9dUGDQNlrr!HyueleslJL(9LLK>v^G%;rmuCIg#qB2DZxNO4vB|vjcygBlZci;a!M4%3#=<-KH%*=17Q{aUKnzd7$r^Mh?)~>JZY8tu?FNSSF3obEX4)B&4>QOg%{W&$?iM3r$#)#@1-i>2bH|?5DKSQZ$O1|v2Wz}2I=r-M5)Wxd_@vZhgv>n8k$Q*}~?$i?{b`*|*!&44o)o(qXPyC2tN78cW$sb`#As%5$;I{B+f6Pb!JtGS5K99vu#l*|yora61crqIw#8`%bf6>w5x%@H*ya+t$KlVq{`2\"\n )\n )\n )\n os.system(\"cythonize -i -3 -b solve.pyx\")\nimport solve\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- \"c$`&I!ES>v480@q58h!atm#yy9VRsPBOM1P1R4zjN;6H{*Uu)DfG;HPJ=@O?ts4jEja1J!?~Lt0nPD28hd~cF?bD=Xf%^5=(LPV;uc^(s~w9Rs`V`us@O@LyhqyPmKoCExGHNA#n5phT&7e`qhVbc=x4zF(|NT=~DGF(lOmEsIX(ws;WNT>a`v!FJr_}w?$Cy;51zfTT$iwsPi>V!e5yk9-B{lpk>lD|KRh>h5\"","+ \"c${TY%Wi`(5WFMt58Fc(Xq*VD9x7D&BPj>l7_bTkIj*Ai>${5yulNExGoBr{aRttH)I;%|$Qg=gd9dxR@Di;P73FNP9dUGDQNlrr!HyueleslJL(9LLK>v^G%;rmuCIg#qB2DZxNO4vB|vjcygBlZci;a!M4%3#=<-KH%*=17Q{aUKnzd7$r^Mh?)~>JZY8tu?FNSSF3obEX4)B&4>QOg%{W&$?iM3r$#)#@1-i>2bH|?5DKSQZ$O1|v2Wz}2I=r-M5)Wxd_@vZhgv>n8k$Q*}~?$i?{b`*|*!&44o)o(qXPyC2tN78cW$sb`#As%5$;I{B+f6Pb!JtGS5K99vu#l*|yora61crqIw#8`%bf6>w5x%@H*ya+t$KlVq{`2\""],"diff_only_import_comment":false,"measured_runtime_v0":0.0946963763,"measured_runtime_v1":0.1011563256,"runtime_lift":0.936138949,"key":["s853094621","s140417434"]} +{"user_id":"u606045429","problem_id":"p02863","language":"python","submission_id_v0":"s039470229","submission_id_v1":"s453174169","cpu_time_v0":366,"cpu_time_v1":310,"memory_v0":42972,"memory_v1":41836,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.3,"input":"N, T, *AB = list(map(int, open(0).read().split()))\n\n\n\ndp = [0] * (T + max(AB[::2]))\n\nfor w, v in sorted(zip(*[iter(AB)] * 2)):\n\n for i in reversed(list(range(T))):\n\n dp[i + w] = max(dp[i + w], dp[i] + v)\n\n\n\nprint((max(dp)))\n","target":"def main():\n\n N, T, *AB = list(map(int, open(0).read().split()))\n\n\n\n dp = [0] * (T + max(AB[::2]))\n\n for w, v in sorted(zip(*[iter(AB)] * 2)):\n\n for i in reversed(list(range(T))):\n\n dp[i + w] = max(dp[i + w], dp[i] + v)\n\n\n\n print((max(dp)))\n\n\n\nmain()","code_v0_loc":8,"code_v1_loc":11,"code_v0_num_chars":220,"code_v1_num_chars":266,"code_v0_no_empty_lines":"N, T, *AB = list(map(int, open(0).read().split()))\ndp = [0] * (T + max(AB[::2]))\nfor w, v in sorted(zip(*[iter(AB)] * 2)):\n for i in reversed(list(range(T))):\n dp[i + w] = max(dp[i + w], dp[i] + v)\nprint((max(dp)))\n","code_v1_no_empty_lines":"def main():\n N, T, *AB = list(map(int, open(0).read().split()))\n dp = [0] * (T + max(AB[::2]))\n for w, v in sorted(zip(*[iter(AB)] * 2)):\n for i in reversed(list(range(T))):\n dp[i + w] = max(dp[i + w], dp[i] + v)\n print((max(dp)))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-N, T, *AB = list(map(int, open(0).read().split()))","-dp = [0] * (T + max(AB[::2]))","-for w, v in sorted(zip(*[iter(AB)] * 2)):","- for i in reversed(list(range(T))):","- dp[i + w] = max(dp[i + w], dp[i] + v)","-print((max(dp)))","+def main():","+ N, T, *AB = list(map(int, open(0).read().split()))","+ dp = [0] * (T + max(AB[::2]))","+ for w, v in sorted(zip(*[iter(AB)] * 2)):","+ for i in reversed(list(range(T))):","+ dp[i + w] = max(dp[i + w], dp[i] + v)","+ print((max(dp)))","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.1597620912,"measured_runtime_v1":0.0466823013,"runtime_lift":3.4223268077,"key":["s039470229","s453174169"]} +{"user_id":"u994988729","problem_id":"p02558","language":"python","submission_id_v0":"s451233251","submission_id_v1":"s980553192","cpu_time_v0":544,"cpu_time_v1":196,"memory_v0":10360,"memory_v1":10848,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.97,"input":"code = r\"\"\"\n\n# distutils: language=c++\n\n# distutils: include_dirs=\/home\/contestant\/.local\/lib\/python3.8\/site-packages\/numpy\/core\/include\n\nfrom libcpp cimport *\n\nfrom libcpp.vector cimport vector\n\n\n\n\n\ncdef extern from \"\/opt\/atcoder-stl\/atcoder\/dsu.hpp\" namespace \"atcoder\":\n\n cdef cppclass dsu:\n\n dsu()\n\n dsu(int n)\n\n int merge(int a, int b)\n\n bool same(int a, int b)\n\n int leader(int a)\n\n int size(int a)\n\n vector[vector[int]] groups()\n\n\n\n\n\nN, Q = map(int, input().split())\n\ncdef dsu uf = dsu(N)\n\nfor _ in range(Q):\n\n t, u, v = map(int, input().split())\n\n if t == 0:\n\n uf.merge(u, v)\n\n else:\n\n if uf.same(u, v):\n\n print(1)\n\n else:\n\n print(0)\n\n\n\n\"\"\"\n\nimport os\n\nimport sys\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n open('solve.pyx', 'w').write(code)\n\n os.system('cythonize -i -3 -b solve.pyx')\n\nimport solve","target":"code = r\"\"\"\n\n# distutils: language=c++\n\n# distutils: include_dirs=\/home\/contestant\/.local\/lib\/python3.8\/site-packages\/numpy\/core\/include\n\nfrom libcpp cimport *\n\nfrom libcpp.vector cimport vector\n\n\n\n\n\ncdef extern from \"\/opt\/atcoder-stl\/atcoder\/dsu.hpp\" namespace \"atcoder\":\n\n cdef cppclass dsu:\n\n dsu()\n\n dsu(int n)\n\n int merge(int a, int b)\n\n bool same(int a, int b)\n\n int leader(int a)\n\n int size(int a)\n\n vector[vector[int]] groups()\n\n\n\nimport sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, Q = map(int, input().split())\n\ncdef dsu uf = dsu(N)\n\nfor _ in range(Q):\n\n t, u, v = map(int, input().split())\n\n if t == 0:\n\n uf.merge(u, v)\n\n else:\n\n if uf.same(u, v):\n\n print(1)\n\n else:\n\n print(0)\n\n\n\n\"\"\"\n\nimport os\n\nimport sys\n\nif sys.argv[-1] == 'ONLINE_JUDGE':\n\n open('solve.pyx', 'w').write(code)\n\n os.system('cythonize -i -3 -b solve.pyx')\n\nimport solve\n","code_v0_loc":37,"code_v1_loc":39,"code_v0_num_chars":912,"code_v1_num_chars":960,"code_v0_no_empty_lines":"code = r\"\"\"\n# distutils: language=c++\n# distutils: include_dirs=\/home\/contestant\/.local\/lib\/python3.8\/site-packages\/numpy\/core\/include\nfrom libcpp cimport *\nfrom libcpp.vector cimport vector\ncdef extern from \"\/opt\/atcoder-stl\/atcoder\/dsu.hpp\" namespace \"atcoder\":\n cdef cppclass dsu:\n dsu()\n dsu(int n)\n int merge(int a, int b)\n bool same(int a, int b)\n int leader(int a)\n int size(int a)\n vector[vector[int]] groups()\nN, Q = map(int, input().split())\ncdef dsu uf = dsu(N)\nfor _ in range(Q):\n t, u, v = map(int, input().split())\n if t == 0:\n uf.merge(u, v)\n else:\n if uf.same(u, v):\n print(1)\n else:\n print(0)\n\"\"\"\nimport os\nimport sys\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n open(\"solve.pyx\", \"w\").write(code)\n os.system(\"cythonize -i -3 -b solve.pyx\")\nimport solve\n","code_v1_no_empty_lines":"code = r\"\"\"\n# distutils: language=c++\n# distutils: include_dirs=\/home\/contestant\/.local\/lib\/python3.8\/site-packages\/numpy\/core\/include\nfrom libcpp cimport *\nfrom libcpp.vector cimport vector\ncdef extern from \"\/opt\/atcoder-stl\/atcoder\/dsu.hpp\" namespace \"atcoder\":\n cdef cppclass dsu:\n dsu()\n dsu(int n)\n int merge(int a, int b)\n bool same(int a, int b)\n int leader(int a)\n int size(int a)\n vector[vector[int]] groups()\nimport sys\ninput = sys.stdin.buffer.readline\nN, Q = map(int, input().split())\ncdef dsu uf = dsu(N)\nfor _ in range(Q):\n t, u, v = map(int, input().split())\n if t == 0:\n uf.merge(u, v)\n else:\n if uf.same(u, v):\n print(1)\n else:\n print(0)\n\"\"\"\nimport os\nimport sys\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n open(\"solve.pyx\", \"w\").write(code)\n os.system(\"cythonize -i -3 -b solve.pyx\")\nimport solve\n","code_same":false,"relative_loc_diff_percent":5.1282051282,"diff":["+import sys","+input = sys.stdin.buffer.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.1011338387,"measured_runtime_v1":0.0431664989,"runtime_lift":2.3428779542,"key":["s451233251","s980553192"]} +{"user_id":"u839188633","problem_id":"p02617","language":"python","submission_id_v0":"s237300978","submission_id_v1":"s041886255","cpu_time_v0":275,"cpu_time_v1":120,"memory_v0":74484,"memory_v1":73912,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.36,"input":"N = int(eval(input()))\n\nans = N * (N + 1) * (N + 2) \/\/ 6\n\nfor _ in range(N - 1):\n\n u, v = list(map(int, input().split()))\n\n if u > v:\n\n u, v = v, u\n\n ans -= u * (N + 1 - v)\n\nprint(ans)\n","target":"import sys\n\n\n\ninput = sys.stdin.readline\n\nN = int(eval(input()))\n\nans = N * (N + 1) * (N + 2) \/\/ 6\n\nfor _ in range(N - 1):\n\n u, v = list(map(int, input().split()))\n\n if u > v:\n\n u, v = v, u\n\n ans -= u * (N + 1 - v)\n\nprint(ans)\n","code_v0_loc":8,"code_v1_loc":11,"code_v0_num_chars":189,"code_v1_num_chars":231,"code_v0_no_empty_lines":"N = int(eval(input()))\nans = N * (N + 1) * (N + 2) \/\/ 6\nfor _ in range(N - 1):\n u, v = list(map(int, input().split()))\n if u > v:\n u, v = v, u\n ans -= u * (N + 1 - v)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nans = N * (N + 1) * (N + 2) \/\/ 6\nfor _ in range(N - 1):\n u, v = list(map(int, input().split()))\n if u > v:\n u, v = v, u\n ans -= u * (N + 1 - v)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.1249729676,"measured_runtime_v1":0.0614445848,"runtime_lift":2.0339134509,"key":["s237300978","s041886255"]} +{"user_id":"u788137651","problem_id":"p03044","language":"python","submission_id_v0":"s183217425","submission_id_v1":"s190636869","cpu_time_v0":756,"cpu_time_v1":445,"memory_v0":70432,"memory_v1":65328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.14,"input":"def main():\n\n N=int(input())\n\n edge = [[]for _ in range(N)]\n\n for _ in range(N-1):\n\n u,v,w = map(int,input().split())\n\n u,v = u-1,v-1\n\n edge[u].append((v,w))\n\n edge[v].append((u,w))\n\n color = [-1]*N\n\n color[0]=0\n\n stack = [(0,0)]\n\n while stack:\n\n v,col = stack.pop()\n\n for to,dist in edge[v]:\n\n if color[to]!=-1:\n\n continue\n\n c = (col+dist)%2 # \u8272\n\n color[to] = c\n\n stack.append((to,c))\n\n print(*color,sep=\"\\n\")\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\ninput = sys.stdin.readline\n\ndef main():\n\n N=int(input())\n\n edge = [[]for _ in range(N)]\n\n for _ in range(N-1):\n\n u,v,w = map(int,input().split())\n\n u,v = u-1,v-1\n\n edge[u].append((v,w))\n\n edge[v].append((u,w))\n\n color = [-1]*N\n\n color[0]=0\n\n stack = [(0,0)]\n\n while stack:\n\n v,col = stack.pop()\n\n for to,dist in edge[v]:\n\n if color[to]!=-1:\n\n continue\n\n c = (col+dist)%2 # \u8272\n\n color[to] = c\n\n stack.append((to,c))\n\n print(*color,sep=\"\\n\")\n\n \n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":24,"code_v1_loc":26,"code_v0_num_chars":593,"code_v1_num_chars":633,"code_v0_no_empty_lines":"def main():\n N = int(input())\n edge = [[] for _ in range(N)]\n for _ in range(N - 1):\n u, v, w = map(int, input().split())\n u, v = u - 1, v - 1\n edge[u].append((v, w))\n edge[v].append((u, w))\n color = [-1] * N\n color[0] = 0\n stack = [(0, 0)]\n while stack:\n v, col = stack.pop()\n for to, dist in edge[v]:\n if color[to] != -1:\n continue\n c = (col + dist) % 2 # \u8272\n color[to] = c\n stack.append((to, c))\n print(*color, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(input())\n edge = [[] for _ in range(N)]\n for _ in range(N - 1):\n u, v, w = map(int, input().split())\n u, v = u - 1, v - 1\n edge[u].append((v, w))\n edge[v].append((u, w))\n color = [-1] * N\n color[0] = 0\n stack = [(0, 0)]\n while stack:\n v, col = stack.pop()\n for to, dist in edge[v]:\n if color[to] != -1:\n continue\n c = (col + dist) % 2 # \u8272\n color[to] = c\n stack.append((to, c))\n print(*color, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["+import sys","+","+input = sys.stdin.readline","+","+"],"diff_only_import_comment":false,"measured_runtime_v0":0.102543542,"measured_runtime_v1":0.0370698382,"runtime_lift":2.7662257761,"key":["s183217425","s190636869"]} +{"user_id":"u246401133","problem_id":"p02578","language":"python","submission_id_v0":"s392883265","submission_id_v1":"s098428604","cpu_time_v0":131,"cpu_time_v1":110,"memory_v0":32380,"memory_v1":32208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.03,"input":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\nx = 0\n\nM = a[0]\n\nif n != 1:\n\n for i in range(n - 1):\n\n if M > a[i + 1]:\n\n x += (M - a[i + 1])\n\n else:\n\n M = a[i + 1]\n\nprint(x)","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\nx = 0\n\nh = a[0]\n\nfor i in range(n):\n\n if a[i] > h:\n\n h = a[i]\n\n else:\n\n x += (h - a[i])\n\nprint(x)","code_v0_loc":11,"code_v1_loc":10,"code_v0_num_chars":220,"code_v1_num_chars":172,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nx = 0\nM = a[0]\nif n != 1:\n for i in range(n - 1):\n if M > a[i + 1]:\n x += M - a[i + 1]\n else:\n M = a[i + 1]\nprint(x)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nx = 0\nh = a[0]\nfor i in range(n):\n if a[i] > h:\n h = a[i]\n else:\n x += h - a[i]\nprint(x)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-M = a[0]","-if n != 1:","- for i in range(n - 1):","- if M > a[i + 1]:","- x += M - a[i + 1]","- else:","- M = a[i + 1]","+h = a[0]","+for i in range(n):","+ if a[i] > h:","+ h = a[i]","+ else:","+ x += h - a[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0480824829,"measured_runtime_v1":0.0475469869,"runtime_lift":1.0112624589,"key":["s392883265","s098428604"]} +{"user_id":"u062147869","problem_id":"p02984","language":"python","submission_id_v0":"s371061267","submission_id_v1":"s097568098","cpu_time_v0":411,"cpu_time_v1":334,"memory_v0":66660,"memory_v1":66020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.73,"input":"N=int(input())\n\nA=[int(i) for i in input().split()]\n\na=sum(A)\/\/2#sumx\n\nP=[0]*(N+1)\n\nQ=[0]*(N+1)\n\nfor i in range(1,N+1):\n\n if i%2==1:\n\n P[i]+=P[i-1]+A[i-1]\n\n Q[i] += Q[i - 1]\n\n else:\n\n Q[i]+=Q[i-1]+A[i-1]\n\n P[i] += P[i - 1]\n\n#print(a,P,Q)\n\nans=[]\n\nfor i in range(1,N+1):\n\n x=0\n\n if i%2==1:\n\n x+=P[N]-P[i-1]\n\n x+=Q[i]-Q[0]\n\n else:\n\n x += Q[N] - Q[i - 1]\n\n x += P[i] - P[0]\n\n print(2*(x-a),end=' ')\n\n #ans.append(2*(x-a))\n\n#print(ans,end=' ')\n","target":"N=int(input())\n\nA=[int(i) for i in input().split()]\n\na=sum(A)\/\/2#sumx\n\nP=[0]*(N+1)\n\nQ=[0]*(N+1)\n\nfor i in range(1,N+1):\n\n if i%2==1:\n\n P[i]+=P[i-1]+A[i-1]\n\n else:\n\n P[i] += P[i - 1]\n\nT=[0]*N\n\nT[0]=P[-1]-a\n\nfor i in range(1,N):\n\n T[i]=A[i-1]-T[i-1]\n\nfor t in T:\n\n print(2*t,end=' ')\n","code_v0_loc":25,"code_v1_loc":16,"code_v0_num_chars":517,"code_v1_num_chars":307,"code_v0_no_empty_lines":"N = int(input())\nA = [int(i) for i in input().split()]\na = sum(A) \/\/ 2 # sumx\nP = [0] * (N + 1)\nQ = [0] * (N + 1)\nfor i in range(1, N + 1):\n if i % 2 == 1:\n P[i] += P[i - 1] + A[i - 1]\n Q[i] += Q[i - 1]\n else:\n Q[i] += Q[i - 1] + A[i - 1]\n P[i] += P[i - 1]\n# print(a,P,Q)\nans = []\nfor i in range(1, N + 1):\n x = 0\n if i % 2 == 1:\n x += P[N] - P[i - 1]\n x += Q[i] - Q[0]\n else:\n x += Q[N] - Q[i - 1]\n x += P[i] - P[0]\n print(2 * (x - a), end=\" \")\n # ans.append(2*(x-a))\n# print(ans,end=' ')\n","code_v1_no_empty_lines":"N = int(input())\nA = [int(i) for i in input().split()]\na = sum(A) \/\/ 2 # sumx\nP = [0] * (N + 1)\nQ = [0] * (N + 1)\nfor i in range(1, N + 1):\n if i % 2 == 1:\n P[i] += P[i - 1] + A[i - 1]\n else:\n P[i] += P[i - 1]\nT = [0] * N\nT[0] = P[-1] - a\nfor i in range(1, N):\n T[i] = A[i - 1] - T[i - 1]\nfor t in T:\n print(2 * t, end=\" \")\n","code_same":false,"relative_loc_diff_percent":36.0,"diff":["- Q[i] += Q[i - 1]","- Q[i] += Q[i - 1] + A[i - 1]","-# print(a,P,Q)","-ans = []","-for i in range(1, N + 1):","- x = 0","- if i % 2 == 1:","- x += P[N] - P[i - 1]","- x += Q[i] - Q[0]","- else:","- x += Q[N] - Q[i - 1]","- x += P[i] - P[0]","- print(2 * (x - a), end=\" \")","- # ans.append(2*(x-a))","-# print(ans,end=' ')","+T = [0] * N","+T[0] = P[-1] - a","+for i in range(1, N):","+ T[i] = A[i - 1] - T[i - 1]","+for t in T:","+ print(2 * t, end=\" \")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0392109039,"measured_runtime_v1":0.0645062838,"runtime_lift":0.6078617708,"key":["s371061267","s097568098"]} +{"user_id":"u562016607","problem_id":"p03548","language":"python","submission_id_v0":"s151478528","submission_id_v1":"s440430314","cpu_time_v0":30,"cpu_time_v1":18,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.0,"input":"X,Y,Z=list(map(int,input().split()))\n\nans=0\n\nK=Z\n\nwhile(True):\n\n if K+Y+Z>X:\n\n break\n\n K+=Y+Z\n\n ans+=1\n\nprint(ans)","target":"X,Y,Z=list(map(int,input().split()))\n\nA=X-Z\n\nans=A\/\/(Y+Z)\n\nprint(ans)\n","code_v0_loc":9,"code_v1_loc":4,"code_v0_num_chars":124,"code_v1_num_chars":64,"code_v0_no_empty_lines":"X, Y, Z = list(map(int, input().split()))\nans = 0\nK = Z\nwhile True:\n if K + Y + Z > X:\n break\n K += Y + Z\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"X, Y, Z = list(map(int, input().split()))\nA = X - Z\nans = A \/\/ (Y + Z)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-ans = 0","-K = Z","-while True:","- if K + Y + Z > X:","- break","- K += Y + Z","- ans += 1","+A = X - Z","+ans = A \/\/ (Y + Z)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0433420102,"measured_runtime_v1":0.0416967306,"runtime_lift":1.0394582389,"key":["s151478528","s440430314"]} +{"user_id":"u594956556","problem_id":"p03805","language":"python","submission_id_v0":"s756899363","submission_id_v1":"s338182848","cpu_time_v0":43,"cpu_time_v1":24,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.19,"input":"#DFS\n\nfrom collections import deque\n\n\n\nN, M = list(map(int, input().split()))\n\nG = [[] for _ in range(N)]\n\nfor i in range(M):\n\n a, b = list(map(int, input().split()))\n\n G[a-1].append(b-1)\n\n G[b-1].append(a-1)\n\n \n\nstack = deque([(0, 0)])\n\nvisited = [0] * N\n\ndepth = 0\n\nans = 0\n\nwhile stack:\n\n now, depth = stack.pop()\n\n if depth == N-1:\n\n ans += 1\n\n continue\n\n visited[depth] = now\n\n for nxt in G[now]:\n\n if nxt not in visited[:depth+1]:\n\n stack.append((nxt, depth+1))\n\n \n\nprint(ans)","target":"#\u9806\u5217\u5168\u63a2\u7d22\n\n\n\nfrom itertools import permutations\n\n\n\nN, M = list(map(int, input().split()))\n\nG = [[0]*N for _ in range(N)]\n\nfor i in range(M):\n\n a, b = list(map(int, input().split()))\n\n G[a-1][b-1] = 1\n\n G[b-1][a-1] = 1\n\n\n\nperms = permutations(list(range(1, N)))\n\nans = 0\n\n\n\nfor perm in perms:\n\n now = 0\n\n for v in perm:\n\n if G[now][v] == 0:\n\n break\n\n now = v\n\n else:\n\n ans += 1\n\n \n\nprint(ans)","code_v0_loc":25,"code_v1_loc":24,"code_v0_num_chars":495,"code_v1_num_chars":393,"code_v0_no_empty_lines":"# DFS\nfrom collections import deque\n\nN, M = list(map(int, input().split()))\nG = [[] for _ in range(N)]\nfor i in range(M):\n a, b = list(map(int, input().split()))\n G[a - 1].append(b - 1)\n G[b - 1].append(a - 1)\nstack = deque([(0, 0)])\nvisited = [0] * N\ndepth = 0\nans = 0\nwhile stack:\n now, depth = stack.pop()\n if depth == N - 1:\n ans += 1\n continue\n visited[depth] = now\n for nxt in G[now]:\n if nxt not in visited[: depth + 1]:\n stack.append((nxt, depth + 1))\nprint(ans)\n","code_v1_no_empty_lines":"# \u9806\u5217\u5168\u63a2\u7d22\nfrom itertools import permutations\n\nN, M = list(map(int, input().split()))\nG = [[0] * N for _ in range(N)]\nfor i in range(M):\n a, b = list(map(int, input().split()))\n G[a - 1][b - 1] = 1\n G[b - 1][a - 1] = 1\nperms = permutations(list(range(1, N)))\nans = 0\nfor perm in perms:\n now = 0\n for v in perm:\n if G[now][v] == 0:\n break\n now = v\n else:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["-# DFS","-from collections import deque","+# \u9806\u5217\u5168\u63a2\u7d22","+from itertools import permutations","-G = [[] for _ in range(N)]","+G = [[0] * N for _ in range(N)]","- G[a - 1].append(b - 1)","- G[b - 1].append(a - 1)","-stack = deque([(0, 0)])","-visited = [0] * N","-depth = 0","+ G[a - 1][b - 1] = 1","+ G[b - 1][a - 1] = 1","+perms = permutations(list(range(1, N)))","-while stack:","- now, depth = stack.pop()","- if depth == N - 1:","+for perm in perms:","+ now = 0","+ for v in perm:","+ if G[now][v] == 0:","+ break","+ now = v","+ else:","- continue","- visited[depth] = now","- for nxt in G[now]:","- if nxt not in visited[: depth + 1]:","- stack.append((nxt, depth + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.047038825,"measured_runtime_v1":0.0399019526,"runtime_lift":1.1788602306,"key":["s756899363","s338182848"]} +{"user_id":"u272028993","problem_id":"p03801","language":"python","submission_id_v0":"s478917894","submission_id_v1":"s338809042","cpu_time_v0":323,"cpu_time_v1":175,"memory_v0":22380,"memory_v1":96932,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.82,"input":"n=int(input())\n\na=[]\n\nfor i,j in enumerate(map(int,input().split())):\n\n a.append([j,i])\n\na.sort(reverse=True)\n\nnow=0\n\nnx=0\n\nans=[0]*n\n\ncnt=0\n\nidx=10**6\n\nwhile now0:\n\n ret+=self.node[idx]\n\n idx-=idx&(-idx)\n\n return ret\n\n\n\n def add(self,idx,x):\n\n while idx<=self.size:\n\n self.node[idx]+=x\n\n idx+=idx&(-idx)\n\n\n\nn=int(input())\n\na=list(map(int,input().split()))\n\ncheck=[]\n\nd=defaultdict(int)\n\nli=set([])\n\nnow=0\n\nfor i in range(n):\n\n if now 0:\n ret += self.node[idx]\n idx -= idx & (-idx)\n return ret\n\n def add(self, idx, x):\n while idx <= self.size:\n self.node[idx] += x\n idx += idx & (-idx)\n\n\nn = int(input())\na = list(map(int, input().split()))\ncheck = []\nd = defaultdict(int)\nli = set([])\nnow = 0\nfor i in range(n):\n if now < a[i]:\n now = a[i]\n check.append(i)\n d[a[i]] += 1\n li.add(a[i])\nli = sorted(list(li))\nb = [0] * (n + 5)\ni = 0\nidx = dict()\nfor key in li:\n b[i] = d[key]\n idx[key] = i\n i += 1\nans = [0] * (n + 1)\nfor i in range(len(check) - 2, -1, -1):\n cnt = 0\n for j in range(idx[a[check[i]]] + 1, idx[a[check[i + 1]]] + 1):\n ans[check[i + 1]] += b[j] * (li[j] - a[check[i]])\n cnt += b[j]\n b[idx[a[check[i]]]] += cnt\nfor i in range(1, n):\n if a[0] < a[i]:\n a[i] = a[0]\nans[0] = sum(a)\nfor i in range(n):\n print(ans[i])\n","code_same":false,"relative_loc_diff_percent":56.862745098,"diff":["+from collections import defaultdict","+","+","+class BIT:","+ def __init__(self, size):","+ self.size = size","+ self.node = [0] * (size + 1)","+","+ def sum(self, idx):","+ ret = 0","+ while idx > 0:","+ ret += self.node[idx]","+ idx -= idx & (-idx)","+ return ret","+","+ def add(self, idx, x):","+ while idx <= self.size:","+ self.node[idx] += x","+ idx += idx & (-idx)","+","+","-a = []","-for i, j in enumerate(map(int, input().split())):","- a.append([j, i])","-a.sort(reverse=True)","+a = list(map(int, input().split()))","+check = []","+d = defaultdict(int)","+li = set([])","-nx = 0","-ans = [0] * n","-cnt = 0","-idx = 10**6","-while now < n:","- while nx < n and a[now][0] == a[nx][0]:","- idx = min(idx, a[nx][1])","- cnt += 1","- nx += 1","- if nx == n:","- ans[idx] += cnt * a[now][0]","- else:","- ans[idx] += (a[now][0] - a[nx][0]) * cnt","- now = nx","+for i in range(n):","+ if now < a[i]:","+ now = a[i]","+ check.append(i)","+ d[a[i]] += 1","+ li.add(a[i])","+li = sorted(list(li))","+b = [0] * (n + 5)","+i = 0","+idx = dict()","+for key in li:","+ b[i] = d[key]","+ idx[key] = i","+ i += 1","+ans = [0] * (n + 1)","+for i in range(len(check) - 2, -1, -1):","+ cnt = 0","+ for j in range(idx[a[check[i]]] + 1, idx[a[check[i + 1]]] + 1):","+ ans[check[i + 1]] += b[j] * (li[j] - a[check[i]])","+ cnt += b[j]","+ b[idx[a[check[i]]]] += cnt","+for i in range(1, n):","+ if a[0] < a[i]:","+ a[i] = a[0]","+ans[0] = sum(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0464672294,"measured_runtime_v1":0.0389861635,"runtime_lift":1.1918902815,"key":["s478917894","s338809042"]} +{"user_id":"u952708174","problem_id":"p03435","language":"python","submission_id_v0":"s192997609","submission_id_v1":"s843082178","cpu_time_v0":179,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.5,"input":"def c_takahashi_information(C):\n\n a = [min(C[0]), min(C[1]), min(C[2])]\n\n tmp = [[C[i][j] - a[i] for j in range(3)] for i in range(3)]\n\n b = list(map(list, set(map(tuple, tmp))))\n\n for bb in b:\n\n f = True\n\n for i in range(3):\n\n for j in range(3):\n\n if a[i] + bb[j] != C[i][j]:\n\n f = False\n\n break\n\n if not f:\n\n break\n\n if f:\n\n\n\n return 'Yes'\n\n return 'No'\n\n \n\nC = [[int(i) for i in input().split()] for j in range(3)]\n\nprint((c_takahashi_information(C)))","target":"def c_takahashi_information(C):\n\n b = [C[0][i] - 0 for i in range(3)]\n\n a = [0] + [C[i][0] - b[0] for i in range(1, 3)] # a_1=0\u3068\u4eee\u5b9a\u3057\u3066\u3088\u3044\n\n for i in range(3):\n\n for j in range(3):\n\n if a[i] + b[j] != C[i][j]:\n\n return 'No'\n\n return 'Yes'\n\n\n\nC = [[int(i) for i in input().split()] for j in range(3)]\n\nprint((c_takahashi_information(C)))","code_v0_loc":20,"code_v1_loc":11,"code_v0_num_chars":590,"code_v1_num_chars":376,"code_v0_no_empty_lines":"def c_takahashi_information(C):\n a = [min(C[0]), min(C[1]), min(C[2])]\n tmp = [[C[i][j] - a[i] for j in range(3)] for i in range(3)]\n b = list(map(list, set(map(tuple, tmp))))\n for bb in b:\n f = True\n for i in range(3):\n for j in range(3):\n if a[i] + bb[j] != C[i][j]:\n f = False\n break\n if not f:\n break\n if f:\n return \"Yes\"\n return \"No\"\n\n\nC = [[int(i) for i in input().split()] for j in range(3)]\nprint((c_takahashi_information(C)))\n","code_v1_no_empty_lines":"def c_takahashi_information(C):\n b = [C[0][i] - 0 for i in range(3)]\n a = [0] + [C[i][0] - b[0] for i in range(1, 3)] # a_1=0\u3068\u4eee\u5b9a\u3057\u3066\u3088\u3044\n for i in range(3):\n for j in range(3):\n if a[i] + b[j] != C[i][j]:\n return \"No\"\n return \"Yes\"\n\n\nC = [[int(i) for i in input().split()] for j in range(3)]\nprint((c_takahashi_information(C)))\n","code_same":false,"relative_loc_diff_percent":45.0,"diff":["- a = [min(C[0]), min(C[1]), min(C[2])]","- tmp = [[C[i][j] - a[i] for j in range(3)] for i in range(3)]","- b = list(map(list, set(map(tuple, tmp))))","- for bb in b:","- f = True","- for i in range(3):","- for j in range(3):","- if a[i] + bb[j] != C[i][j]:","- f = False","- break","- if not f:","- break","- if f:","- return \"Yes\"","- return \"No\"","+ b = [C[0][i] - 0 for i in range(3)]","+ a = [0] + [C[i][0] - b[0] for i in range(1, 3)] # a_1=0\u3068\u4eee\u5b9a\u3057\u3066\u3088\u3044","+ for i in range(3):","+ for j in range(3):","+ if a[i] + b[j] != C[i][j]:","+ return \"No\"","+ return \"Yes\""],"diff_only_import_comment":false,"measured_runtime_v0":0.0787016847,"measured_runtime_v1":0.0351432297,"runtime_lift":2.2394550903,"key":["s192997609","s843082178"]} +{"user_id":"u803617136","problem_id":"p03011","language":"python","submission_id_v0":"s206224353","submission_id_v1":"s679068144","cpu_time_v0":165,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.7,"input":"pqr = list(map(int, input().split()))\n\npqr.sort()\n\n\n\nprint((sum(pqr[:2])))\n","target":"nums = list(map(int, input().split()))\n\nnums.sort()\n\nprint((sum(nums[:2])))","code_v0_loc":4,"code_v1_loc":3,"code_v0_num_chars":73,"code_v1_num_chars":73,"code_v0_no_empty_lines":"pqr = list(map(int, input().split()))\npqr.sort()\nprint((sum(pqr[:2])))\n","code_v1_no_empty_lines":"nums = list(map(int, input().split()))\nnums.sort()\nprint((sum(nums[:2])))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-pqr = list(map(int, input().split()))","-pqr.sort()","-print((sum(pqr[:2])))","+nums = list(map(int, input().split()))","+nums.sort()","+print((sum(nums[:2])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0469594479,"measured_runtime_v1":0.0071056093,"runtime_lift":6.6087855621,"key":["s206224353","s679068144"]} +{"user_id":"u011621222","problem_id":"p02400","language":"python","submission_id_v0":"s737935480","submission_id_v1":"s371741952","cpu_time_v0":20,"cpu_time_v1":0,"memory_v0":5640,"memory_v1":4728,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":100.0,"input":"import math\n\nr = float(eval(input()))\n\nprint(f'{math.pi*r*r:.12f} {2*math.pi*r:.12f}')\n","target":"import math\n\nrad = float(eval(input()))\n\n\n\nprint((\"%.10f %.10f\"%(rad*rad*math.pi,2.0*math.pi*rad)))\n","code_v0_loc":3,"code_v1_loc":4,"code_v0_num_chars":81,"code_v1_num_chars":92,"code_v0_no_empty_lines":"import math\n\nr = float(eval(input()))\nprint(f\"{math.pi*r*r:.12f} {2*math.pi*r:.12f}\")\n","code_v1_no_empty_lines":"import math\n\nrad = float(eval(input()))\nprint((\"%.10f %.10f\" % (rad * rad * math.pi, 2.0 * math.pi * rad)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-r = float(eval(input()))","-print(f\"{math.pi*r*r:.12f} {2*math.pi*r:.12f}\")","+rad = float(eval(input()))","+print((\"%.10f %.10f\" % (rad * rad * math.pi, 2.0 * math.pi * rad)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0681864794,"measured_runtime_v1":0.0635051157,"runtime_lift":1.0737163248,"key":["s737935480","s371741952"]} +{"user_id":"u145950990","problem_id":"p03261","language":"python","submission_id_v0":"s397513864","submission_id_v1":"s190913357","cpu_time_v0":186,"cpu_time_v1":30,"memory_v0":38384,"memory_v1":9180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.87,"input":"n = int(eval(input()))\n\ns = eval(input())\n\ndup = [s]\n\nans = 'Yes'\n\nfor i in range(n-1):\n\n next = eval(input())\n\n if s[-1]!=next[0] or next in dup:\n\n ans = 'No'\n\n else:dup.append(next)\n\n s = next\n\nprint(ans)","target":"n = int(eval(input()))\n\nbefore = ''\n\nsaid = set([])\n\nf = True\n\nfor i in range(n):\n\n if i==0:\n\n before = eval(input())\n\n said.add(before)\n\n continue\n\n s = eval(input())\n\n if before[-1] != s[0] or s in said:\n\n f = False\n\n before = s\n\n said.add(s)\n\nprint(('Yes' if f else 'No'))\n\n\n","code_v0_loc":11,"code_v1_loc":16,"code_v0_num_chars":207,"code_v1_num_chars":301,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\ndup = [s]\nans = \"Yes\"\nfor i in range(n - 1):\n next = eval(input())\n if s[-1] != next[0] or next in dup:\n ans = \"No\"\n else:\n dup.append(next)\n s = next\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nbefore = \"\"\nsaid = set([])\nf = True\nfor i in range(n):\n if i == 0:\n before = eval(input())\n said.add(before)\n continue\n s = eval(input())\n if before[-1] != s[0] or s in said:\n f = False\n before = s\n said.add(s)\nprint((\"Yes\" if f else \"No\"))\n","code_same":false,"relative_loc_diff_percent":31.25,"diff":["-s = eval(input())","-dup = [s]","-ans = \"Yes\"","-for i in range(n - 1):","- next = eval(input())","- if s[-1] != next[0] or next in dup:","- ans = \"No\"","- else:","- dup.append(next)","- s = next","-print(ans)","+before = \"\"","+said = set([])","+f = True","+for i in range(n):","+ if i == 0:","+ before = eval(input())","+ said.add(before)","+ continue","+ s = eval(input())","+ if before[-1] != s[0] or s in said:","+ f = False","+ before = s","+ said.add(s)","+print((\"Yes\" if f else \"No\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0375889552,"measured_runtime_v1":0.036599221,"runtime_lift":1.0270424926,"key":["s397513864","s190913357"]} +{"user_id":"u970197315","problem_id":"p03760","language":"python","submission_id_v0":"s153189978","submission_id_v1":"s062184399","cpu_time_v0":21,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.05,"input":"# ABC058 B - \u2235\u2234\u2235\n\nfrom collections import deque\n\nsi = lambda: eval(input())\n\nni = lambda: int(eval(input()))\n\nnm = lambda: list(map(int, input().split()))\n\nnl = lambda: list(map(int, input().split()))\n\n\n\nO = si()\n\nE = si()\n\nN = len(O) + len(E)\n\n\n\nO = [ o for o in O]\n\nE = [ e for e in E]\n\nO = deque(O)\n\nE = deque(E)\n\nans = ''\n\n\n\nfor i in range(N):\n\n if i%2==0:\n\n ans += O.popleft()\n\n else:\n\n ans += E.popleft()\n\nprint(ans)\n","target":"o=eval(input())\n\ne=eval(input())\n\nn=len(o)+len(e)\n\nans=''\n\nfor i in range(n):\n\n if i%2==0:\n\n ans+=o[i\/\/2]\n\n else:\n\n ans+=e[i\/\/2]\n\nprint(ans)\n","code_v0_loc":23,"code_v1_loc":10,"code_v0_num_chars":425,"code_v1_num_chars":149,"code_v0_no_empty_lines":"# ABC058 B - \u2235\u2234\u2235\nfrom collections import deque\n\nsi = lambda: eval(input())\nni = lambda: int(eval(input()))\nnm = lambda: list(map(int, input().split()))\nnl = lambda: list(map(int, input().split()))\nO = si()\nE = si()\nN = len(O) + len(E)\nO = [o for o in O]\nE = [e for e in E]\nO = deque(O)\nE = deque(E)\nans = \"\"\nfor i in range(N):\n if i % 2 == 0:\n ans += O.popleft()\n else:\n ans += E.popleft()\nprint(ans)\n","code_v1_no_empty_lines":"o = eval(input())\ne = eval(input())\nn = len(o) + len(e)\nans = \"\"\nfor i in range(n):\n if i % 2 == 0:\n ans += o[i \/\/ 2]\n else:\n ans += e[i \/\/ 2]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":56.5217391304,"diff":["-# ABC058 B - \u2235\u2234\u2235","-from collections import deque","-","-si = lambda: eval(input())","-ni = lambda: int(eval(input()))","-nm = lambda: list(map(int, input().split()))","-nl = lambda: list(map(int, input().split()))","-O = si()","-E = si()","-N = len(O) + len(E)","-O = [o for o in O]","-E = [e for e in E]","-O = deque(O)","-E = deque(E)","+o = eval(input())","+e = eval(input())","+n = len(o) + len(e)","-for i in range(N):","+for i in range(n):","- ans += O.popleft()","+ ans += o[i \/\/ 2]","- ans += E.popleft()","+ ans += e[i \/\/ 2]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463665768,"measured_runtime_v1":0.0431824093,"runtime_lift":1.0737376053,"key":["s153189978","s062184399"]} +{"user_id":"u340781749","problem_id":"p03189","language":"python","submission_id_v0":"s262407951","submission_id_v1":"s332032168","cpu_time_v0":1854,"cpu_time_v1":956,"memory_v0":117212,"memory_v1":233288,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":48.44,"input":"import sys\n\n\n\nn, q = list(map(int, input().split()))\n\nMOD = 10 ** 9 + 7\n\nINV2 = (MOD + 1) \/\/ 2\n\nlines = sys.stdin.readlines()\n\naaa = list(map(int, lines[:n]))\n\nmat = [[0] * n for _ in [0] * n]\n\nfor i in range(n):\n\n for j in range(n):\n\n mat[i][j] = int(aaa[i] < aaa[j])\n\n# print(*mat, sep='\\n')\n\nfor line in lines[n:]:\n\n x, y = list(map(int, line.split()))\n\n x -= 1\n\n y -= 1\n\n mat[x][y] = mat[y][x] = (mat[x][y] + mat[y][x]) * INV2 % MOD\n\n for i in range(n):\n\n if i == x or i == y:\n\n continue\n\n mat[x][i] = mat[y][i] = (mat[x][i] + mat[y][i]) * INV2 % MOD\n\n mat[i][x] = mat[i][y] = (mat[i][x] + mat[i][y]) * INV2 % MOD\n\n # print(x, y)\n\n # print(*mat, sep='\\n')\n\n\n\nans = sum(sum(row[:i]) for i, row in enumerate(mat)) % MOD\n\nans = (ans << q) % MOD\n\nprint(ans)\n","target":"import sys\n\nimport numpy as np\n\n\n\nn, q = list(map(int, input().split()))\n\nMOD = 10 ** 9 + 7\n\nINV2 = (MOD + 1) \/\/ 2\n\nlines = sys.stdin.readlines()\n\naaa = np.fromiter(list(map(int, lines[:n])), dtype=np.int)\n\nmat = (aaa.reshape(1, -1) < aaa.reshape(-1, 1)).astype(np.int64)\n\n# print(mat)\n\nfor line in lines[n:]:\n\n x, y = list(map(int, line.split()))\n\n x -= 1\n\n y -= 1\n\n tmp = (mat[x, y] + mat[y, x]) * INV2 % MOD\n\n mat[x] = mat[y] = (mat[x] + mat[y]) * INV2 % MOD\n\n mat[:, x] = mat[:, y] = (mat[:, x] + mat[:, y]) * INV2 % MOD\n\n mat[x, x] = mat[y, y] = 0\n\n mat[x, y] = mat[y, x] = tmp\n\n\n\nans = int(np.triu(mat).sum() % MOD)\n\nans = (ans << q) % MOD\n\nprint(ans)\n","code_v0_loc":28,"code_v1_loc":23,"code_v0_num_chars":815,"code_v1_num_chars":670,"code_v0_no_empty_lines":"import sys\n\nn, q = list(map(int, input().split()))\nMOD = 10**9 + 7\nINV2 = (MOD + 1) \/\/ 2\nlines = sys.stdin.readlines()\naaa = list(map(int, lines[:n]))\nmat = [[0] * n for _ in [0] * n]\nfor i in range(n):\n for j in range(n):\n mat[i][j] = int(aaa[i] < aaa[j])\n# print(*mat, sep='\\n')\nfor line in lines[n:]:\n x, y = list(map(int, line.split()))\n x -= 1\n y -= 1\n mat[x][y] = mat[y][x] = (mat[x][y] + mat[y][x]) * INV2 % MOD\n for i in range(n):\n if i == x or i == y:\n continue\n mat[x][i] = mat[y][i] = (mat[x][i] + mat[y][i]) * INV2 % MOD\n mat[i][x] = mat[i][y] = (mat[i][x] + mat[i][y]) * INV2 % MOD\n # print(x, y)\n # print(*mat, sep='\\n')\nans = sum(sum(row[:i]) for i, row in enumerate(mat)) % MOD\nans = (ans << q) % MOD\nprint(ans)\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\nn, q = list(map(int, input().split()))\nMOD = 10**9 + 7\nINV2 = (MOD + 1) \/\/ 2\nlines = sys.stdin.readlines()\naaa = np.fromiter(list(map(int, lines[:n])), dtype=np.int)\nmat = (aaa.reshape(1, -1) < aaa.reshape(-1, 1)).astype(np.int64)\n# print(mat)\nfor line in lines[n:]:\n x, y = list(map(int, line.split()))\n x -= 1\n y -= 1\n tmp = (mat[x, y] + mat[y, x]) * INV2 % MOD\n mat[x] = mat[y] = (mat[x] + mat[y]) * INV2 % MOD\n mat[:, x] = mat[:, y] = (mat[:, x] + mat[:, y]) * INV2 % MOD\n mat[x, x] = mat[y, y] = 0\n mat[x, y] = mat[y, x] = tmp\nans = int(np.triu(mat).sum() % MOD)\nans = (ans << q) % MOD\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":17.8571428571,"diff":["+import numpy as np","-aaa = list(map(int, lines[:n]))","-mat = [[0] * n for _ in [0] * n]","-for i in range(n):","- for j in range(n):","- mat[i][j] = int(aaa[i] < aaa[j])","-# print(*mat, sep='\\n')","+aaa = np.fromiter(list(map(int, lines[:n])), dtype=np.int)","+mat = (aaa.reshape(1, -1) < aaa.reshape(-1, 1)).astype(np.int64)","+# print(mat)","- mat[x][y] = mat[y][x] = (mat[x][y] + mat[y][x]) * INV2 % MOD","- for i in range(n):","- if i == x or i == y:","- continue","- mat[x][i] = mat[y][i] = (mat[x][i] + mat[y][i]) * INV2 % MOD","- mat[i][x] = mat[i][y] = (mat[i][x] + mat[i][y]) * INV2 % MOD","- # print(x, y)","- # print(*mat, sep='\\n')","-ans = sum(sum(row[:i]) for i, row in enumerate(mat)) % MOD","+ tmp = (mat[x, y] + mat[y, x]) * INV2 % MOD","+ mat[x] = mat[y] = (mat[x] + mat[y]) * INV2 % MOD","+ mat[:, x] = mat[:, y] = (mat[:, x] + mat[:, y]) * INV2 % MOD","+ mat[x, x] = mat[y, y] = 0","+ mat[x, y] = mat[y, x] = tmp","+ans = int(np.triu(mat).sum() % MOD)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0362315698,"measured_runtime_v1":0.3629613109,"runtime_lift":0.0998221262,"key":["s262407951","s332032168"]} +{"user_id":"u302789073","problem_id":"p03814","language":"python","submission_id_v0":"s719468538","submission_id_v1":"s956957991","cpu_time_v0":32,"cpu_time_v1":27,"memory_v0":9128,"memory_v1":9244,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.62,"input":"s=eval(input())\n\n\n\n#A\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\n\nnum_a=s.index(\"A\")\n\n\n\n#Z\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\n\nnum_z=len(s)-1-s[::-1].index(\"Z\")\n\n\n\nprint((num_z-num_a+1))","target":"s=eval(input())\n\nr_s=s[::-1]\n\nc_a=s.find(\"A\")\n\nc_rz=r_s.find(\"Z\")\n\nc_z=len(s)-1-c_rz\n\n\n\nprint((c_z-c_a+1))","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":114,"code_v1_num_chars":98,"code_v0_no_empty_lines":"s = eval(input())\n# A\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\nnum_a = s.index(\"A\")\n# Z\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\nnum_z = len(s) - 1 - s[::-1].index(\"Z\")\nprint((num_z - num_a + 1))\n","code_v1_no_empty_lines":"s = eval(input())\nr_s = s[::-1]\nc_a = s.find(\"A\")\nc_rz = r_s.find(\"Z\")\nc_z = len(s) - 1 - c_rz\nprint((c_z - c_a + 1))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-# A\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9","-num_a = s.index(\"A\")","-# Z\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9","-num_z = len(s) - 1 - s[::-1].index(\"Z\")","-print((num_z - num_a + 1))","+r_s = s[::-1]","+c_a = s.find(\"A\")","+c_rz = r_s.find(\"Z\")","+c_z = len(s) - 1 - c_rz","+print((c_z - c_a + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.036755018,"measured_runtime_v1":0.0378469615,"runtime_lift":0.9711484497,"key":["s719468538","s956957991"]} +{"user_id":"u794544096","problem_id":"p03135","language":"python","submission_id_v0":"s860923091","submission_id_v1":"s228201826","cpu_time_v0":399,"cpu_time_v1":68,"memory_v0":95028,"memory_v1":61836,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.96,"input":"from decimal import Decimal\n\nt, x = input().split()\n\nprint((Decimal(t)\/Decimal(x)))","target":"t, x = list(map(int, input().split()))\n\nprint((t \/ x))","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":81,"code_v1_num_chars":46,"code_v0_no_empty_lines":"from decimal import Decimal\n\nt, x = input().split()\nprint((Decimal(t) \/ Decimal(x)))\n","code_v1_no_empty_lines":"t, x = list(map(int, input().split()))\nprint((t \/ x))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-from decimal import Decimal","-","-t, x = input().split()","-print((Decimal(t) \/ Decimal(x)))","+t, x = list(map(int, input().split()))","+print((t \/ x))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0443657396,"measured_runtime_v1":0.0372059405,"runtime_lift":1.192436987,"key":["s860923091","s228201826"]} +{"user_id":"u271752821","problem_id":"p02755","language":"python","submission_id_v0":"s060162557","submission_id_v1":"s913804279","cpu_time_v0":97,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.44,"input":"a, b = list(map(int, input().split()))\n\nb = b\/0.1\n\nb_list = [i+b for i in range(10)]\n\nfor i in b_list:\n\n if int(i*0.08) == a:\n\n print((int(i)))\n\n exit()\n\nprint(\"-1\")","target":"a, b = list(map(int, input().split()))\n\nfor i in range(1,1009):\n\n if int(i*0.08) == a and int(i*0.1) == b:\n\n print((int(i)))\n\n exit()\n\nprint(\"-1\")","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":174,"code_v1_num_chars":155,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nb = b \/ 0.1\nb_list = [i + b for i in range(10)]\nfor i in b_list:\n if int(i * 0.08) == a:\n print((int(i)))\n exit()\nprint(\"-1\")\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nfor i in range(1, 1009):\n if int(i * 0.08) == a and int(i * 0.1) == b:\n print((int(i)))\n exit()\nprint(\"-1\")\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-b = b \/ 0.1","-b_list = [i + b for i in range(10)]","-for i in b_list:","- if int(i * 0.08) == a:","+for i in range(1, 1009):","+ if int(i * 0.08) == a and int(i * 0.1) == b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0452755063,"measured_runtime_v1":0.0471383605,"runtime_lift":0.9604811404,"key":["s060162557","s913804279"]} +{"user_id":"u761529120","problem_id":"p04020","language":"python","submission_id_v0":"s987377977","submission_id_v1":"s409755339","cpu_time_v0":545,"cpu_time_v1":461,"memory_v0":51672,"memory_v1":92652,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.41,"input":"from collections import defaultdict\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = [int(eval(input())) for _ in range(N)] + [0]\n\n\n\n ans = 0\n\n for i in range(N):\n\n ans += A[i] \/\/ 2\n\n if A[i] % 2 == 1:\n\n if A[i+1] >= 1:\n\n ans += 1\n\n A[i+1] -= 1\n\n\n\n print(ans)\n\n\n\n\n\n\n\n \n\n \n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"def main():\n\n N = int(eval(input()))\n\n A = list(int(eval(input())) for _ in range(N))\n\n cnt = 0\n\n for i in range(N):\n\n if i == N-1:\n\n cnt += A[i] \/\/ 2\n\n break\n\n cnt += A[i] \/\/ 2\n\n mod = A[i] % 2\n\n if A[i+1] >= mod:\n\n cnt += mod\n\n A[i+1] -= mod\n\n\n\n print(cnt)\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":24,"code_v1_loc":20,"code_v0_num_chars":376,"code_v1_num_chars":379,"code_v0_no_empty_lines":"from collections import defaultdict\n\n\ndef main():\n N = int(eval(input()))\n A = [int(eval(input())) for _ in range(N)] + [0]\n ans = 0\n for i in range(N):\n ans += A[i] \/\/ 2\n if A[i] % 2 == 1:\n if A[i + 1] >= 1:\n ans += 1\n A[i + 1] -= 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n A = list(int(eval(input())) for _ in range(N))\n cnt = 0\n for i in range(N):\n if i == N - 1:\n cnt += A[i] \/\/ 2\n break\n cnt += A[i] \/\/ 2\n mod = A[i] % 2\n if A[i + 1] >= mod:\n cnt += mod\n A[i + 1] -= mod\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-from collections import defaultdict","-","-","- A = [int(eval(input())) for _ in range(N)] + [0]","- ans = 0","+ A = list(int(eval(input())) for _ in range(N))","+ cnt = 0","- ans += A[i] \/\/ 2","- if A[i] % 2 == 1:","- if A[i + 1] >= 1:","- ans += 1","- A[i + 1] -= 1","- print(ans)","+ if i == N - 1:","+ cnt += A[i] \/\/ 2","+ break","+ cnt += A[i] \/\/ 2","+ mod = A[i] % 2","+ if A[i + 1] >= mod:","+ cnt += mod","+ A[i + 1] -= mod","+ print(cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0388988428,"measured_runtime_v1":0.031517489,"runtime_lift":1.234198662,"key":["s987377977","s409755339"]} +{"user_id":"u130900604","problem_id":"p03424","language":"python","submission_id_v0":"s801311503","submission_id_v1":"s227252263","cpu_time_v0":176,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.34,"input":"n=eval(input())\n\narare=list(map(str,input().split()))\n\nif \"Y\" in arare:\n\n print(\"Four\")\n\nelse:\n\n print(\"Three\")","target":"n,*s=list(map(str,open(0).read().split()))\n\nif \"Y\" in s:\n\n print(\"Four\")\n\nelse:\n\n print(\"Three\")","code_v0_loc":6,"code_v1_loc":5,"code_v0_num_chars":107,"code_v1_num_chars":92,"code_v0_no_empty_lines":"n = eval(input())\narare = list(map(str, input().split()))\nif \"Y\" in arare:\n print(\"Four\")\nelse:\n print(\"Three\")\n","code_v1_no_empty_lines":"n, *s = list(map(str, open(0).read().split()))\nif \"Y\" in s:\n print(\"Four\")\nelse:\n print(\"Three\")\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-n = eval(input())","-arare = list(map(str, input().split()))","-if \"Y\" in arare:","+n, *s = list(map(str, open(0).read().split()))","+if \"Y\" in s:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0650191274,"measured_runtime_v1":0.0672520533,"runtime_lift":0.9667976546,"key":["s801311503","s227252263"]} +{"user_id":"u143492911","problem_id":"p03862","language":"python","submission_id_v0":"s969558052","submission_id_v1":"s809421553","cpu_time_v0":122,"cpu_time_v1":83,"memory_v0":14540,"memory_v1":14156,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.97,"input":"N, X = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nans = 0\n\n \n\nif A[0] > X:\n\n ans += A[0] - X\n\n A[0] = X\n\n \n\nfor i in range(N-1):\n\n if A[i] + A[i+1] > X:\n\n ans -= X - (A[i] + A[i + 1])\n\n A[i+1] += X - (A[i] + A[i+1])\n\n \n\nprint(ans)","target":"n,k=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\nv=sum(a)\n\nif k X:\n ans += A[0] - X\n A[0] = X\nfor i in range(N - 1):\n if A[i] + A[i + 1] > X:\n ans -= X - (A[i] + A[i + 1])\n A[i + 1] += X - (A[i] + A[i + 1])\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nv = sum(a)\nif k < a[0]:\n a[0] = k\nfor i in range(n - 1):\n if k < a[i] + a[i + 1]:\n a[i + 1] = k - a[i]\nprint((v - sum(a)))\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-N, X = list(map(int, input().split()))","-A = list(map(int, input().split()))","-ans = 0","-if A[0] > X:","- ans += A[0] - X","- A[0] = X","-for i in range(N - 1):","- if A[i] + A[i + 1] > X:","- ans -= X - (A[i] + A[i + 1])","- A[i + 1] += X - (A[i] + A[i + 1])","-print(ans)","+n, k = list(map(int, input().split()))","+a = list(map(int, input().split()))","+v = sum(a)","+if k < a[0]:","+ a[0] = k","+for i in range(n - 1):","+ if k < a[i] + a[i + 1]:","+ a[i + 1] = k - a[i]","+print((v - sum(a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0454174221,"measured_runtime_v1":0.0459429502,"runtime_lift":0.9885612874,"key":["s969558052","s809421553"]} +{"user_id":"u599547273","problem_id":"p03545","language":"python","submission_id_v0":"s066075678","submission_id_v1":"s126730529","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"from itertools import zip_longest\n\n\n\nabcd = eval(input())\n\n\n\nfor i in range(0, 8):\n\n\tsigns = bin(i)[2:].zfill(3).replace(\"1\", \"+\").replace(\"0\", \"-\")\n\n\tformula = \"\".join(\"\".join(s) for s in zip_longest(abcd, signs, fillvalue=\"\"))\n\n\tif eval(formula) == 7:\n\n\t\tprint((formula+\"=7\"))\n\n\t\texit()\n","target":"abcd = eval(input())\n\n\n\nfor i in range(1<<3):\n\n\tformula = abcd[0]\n\n\tfor j in range(3):\n\n\t\tformula += \"+-\"[(i>>j)%2]\n\n\t\tformula += abcd[j+1]\n\n\tif eval(formula) == 7:\n\n\t\tprint((formula + \"=7\"))\n\n\t\texit()","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":281,"code_v1_num_chars":193,"code_v0_no_empty_lines":"from itertools import zip_longest\n\nabcd = eval(input())\nfor i in range(0, 8):\n signs = bin(i)[2:].zfill(3).replace(\"1\", \"+\").replace(\"0\", \"-\")\n formula = \"\".join(\"\".join(s) for s in zip_longest(abcd, signs, fillvalue=\"\"))\n if eval(formula) == 7:\n print((formula + \"=7\"))\n exit()\n","code_v1_no_empty_lines":"abcd = eval(input())\nfor i in range(1 << 3):\n formula = abcd[0]\n for j in range(3):\n formula += \"+-\"[(i >> j) % 2]\n formula += abcd[j + 1]\n if eval(formula) == 7:\n print((formula + \"=7\"))\n exit()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-from itertools import zip_longest","-","-for i in range(0, 8):","- signs = bin(i)[2:].zfill(3).replace(\"1\", \"+\").replace(\"0\", \"-\")","- formula = \"\".join(\"\".join(s) for s in zip_longest(abcd, signs, fillvalue=\"\"))","+for i in range(1 << 3):","+ formula = abcd[0]","+ for j in range(3):","+ formula += \"+-\"[(i >> j) % 2]","+ formula += abcd[j + 1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0796475453,"measured_runtime_v1":0.0521764507,"runtime_lift":1.5265037044,"key":["s066075678","s126730529"]} +{"user_id":"u707498674","problem_id":"p02603","language":"python","submission_id_v0":"s608777707","submission_id_v1":"s007115100","cpu_time_v0":32,"cpu_time_v1":29,"memory_v0":9264,"memory_v1":9248,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.38,"input":"from bisect import bisect_right\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n INF = 10 ** 18\n\n last_max = A[0]\n\n last_min = A[0]\n\n\n\n money = 1000\n\n stock = 0\n\n old_trend = 0\n\n trend = A[1] - A[0]\n\n buy_point = []\n\n bought_point = []\n\n\n\n for i in range(N-1):\n\n trend = A[i+1] - A[i]\n\n if trend * old_trend > 0 or trend == 0:\n\n continue\n\n else:\n\n if trend > 0:\n\n buy_point.append(i)\n\n if trend < 0:\n\n bought_point.append(i)\n\n old_trend = trend\n\n\n\n if len(buy_point) > len(bought_point):\n\n bought_point.append(N-1)\n\n\n\n for i in range(N):\n\n if i in buy_point:\n\n buy = money\/\/A[i]\n\n stock += buy\n\n money -= buy*A[i]\n\n\n\n nx_bought_idx = bisect_right(bought_point,i)\n\n bought_value = A[nx_bought_idx]\n\n j = i - 1\n\n while j >= 0 and money >= 100:\n\n if A[j] < bought_value and money >= A[i]:\n\n money -= A[j]\n\n stock += 1\n\n break\n\n j -= 1\n\n \n\n if i in bought_point:\n\n bought = stock\n\n stock = 0\n\n money += bought * A[i]\n\n print(money)\n\n \n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"from bisect import bisect_right\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n\n\n money = 1000\n\n stock = 0\n\n old_trend = 0\n\n trend = A[1] - A[0]\n\n buy_point = []\n\n bought_point = []\n\n\n\n for i in range(N-1):\n\n trend = A[i+1] - A[i]\n\n if trend * old_trend > 0 or trend == 0:\n\n continue\n\n else:\n\n if trend > 0:\n\n buy_point.append(i)\n\n if trend < 0:\n\n bought_point.append(i)\n\n old_trend = trend\n\n\n\n if len(buy_point) > len(bought_point):\n\n bought_point.append(N-1)\n\n\n\n for i in range(N):\n\n if i in buy_point:\n\n buy = money\/\/A[i]\n\n stock += buy\n\n money -= buy*A[i]\n\n\n\n \n\n if i in bought_point:\n\n bought = stock\n\n stock = 0\n\n money += bought * A[i]\n\n print(money)\n\n \n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":56,"code_v1_loc":44,"code_v0_num_chars":1363,"code_v1_num_chars":954,"code_v0_no_empty_lines":"from bisect import bisect_right\n\n\ndef main():\n N = int(eval(input()))\n A = list(map(int, input().split()))\n INF = 10**18\n last_max = A[0]\n last_min = A[0]\n money = 1000\n stock = 0\n old_trend = 0\n trend = A[1] - A[0]\n buy_point = []\n bought_point = []\n for i in range(N - 1):\n trend = A[i + 1] - A[i]\n if trend * old_trend > 0 or trend == 0:\n continue\n else:\n if trend > 0:\n buy_point.append(i)\n if trend < 0:\n bought_point.append(i)\n old_trend = trend\n if len(buy_point) > len(bought_point):\n bought_point.append(N - 1)\n for i in range(N):\n if i in buy_point:\n buy = money \/\/ A[i]\n stock += buy\n money -= buy * A[i]\n nx_bought_idx = bisect_right(bought_point, i)\n bought_value = A[nx_bought_idx]\n j = i - 1\n while j >= 0 and money >= 100:\n if A[j] < bought_value and money >= A[i]:\n money -= A[j]\n stock += 1\n break\n j -= 1\n if i in bought_point:\n bought = stock\n stock = 0\n money += bought * A[i]\n print(money)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from bisect import bisect_right\n\n\ndef main():\n N = int(eval(input()))\n A = list(map(int, input().split()))\n money = 1000\n stock = 0\n old_trend = 0\n trend = A[1] - A[0]\n buy_point = []\n bought_point = []\n for i in range(N - 1):\n trend = A[i + 1] - A[i]\n if trend * old_trend > 0 or trend == 0:\n continue\n else:\n if trend > 0:\n buy_point.append(i)\n if trend < 0:\n bought_point.append(i)\n old_trend = trend\n if len(buy_point) > len(bought_point):\n bought_point.append(N - 1)\n for i in range(N):\n if i in buy_point:\n buy = money \/\/ A[i]\n stock += buy\n money -= buy * A[i]\n if i in bought_point:\n bought = stock\n stock = 0\n money += bought * A[i]\n print(money)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["- INF = 10**18","- last_max = A[0]","- last_min = A[0]","- nx_bought_idx = bisect_right(bought_point, i)","- bought_value = A[nx_bought_idx]","- j = i - 1","- while j >= 0 and money >= 100:","- if A[j] < bought_value and money >= A[i]:","- money -= A[j]","- stock += 1","- break","- j -= 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463826866,"measured_runtime_v1":0.0454644766,"runtime_lift":1.0201962079,"key":["s608777707","s007115100"]} +{"user_id":"u768896740","problem_id":"p03361","language":"python","submission_id_v0":"s070831085","submission_id_v1":"s084764928","cpu_time_v0":20,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"h, w = list(map(int, input().split()))\n\n\n\narea = []\n\nfor i in range(h):\n\n array = eval(input())\n\n area.append(array)\n\n\n\n\n\ndef check(i, j):\n\n x_1 = max(0, j-1)\n\n x_2 = min(j+1, w-1)\n\n y_1 = max(0, i-1)\n\n y_2 = min(i+1, h-1)\n\n if area[y_1][j] == '#' or area[y_2][j] == '#' or area[i][x_1] == '#' or area[i][x_2] == '#':\n\n a = 0\n\n else:\n\n print('No')\n\n exit()\n\n\n\nfor i in range(h):\n\n for j in range(w):\n\n if area[i][j] == '#':\n\n check(i, j)\n\n\n\nprint('Yes')\n","target":"h, w = list(map(int, input().split()))\n\n\n\narea = []\n\n\n\nfor i in range(h+2):\n\n if i == 0 or i == h+1:\n\n array = '.' * (w+2)\n\n else:\n\n array = eval(input())\n\n array = '.' + array + '.'\n\n area.append(array)\n\n\n\ndef check(i, j):\n\n if area[i][j-1] == '#' or area[i][j+1] == '#' or area[i-1][j] == '#' or area[i+1][j] == '#':\n\n return True\n\n else:\n\n return False\n\n\n\nfor i in range(1, h+1):\n\n for j in range(1, w+1):\n\n if area[i][j] == '#':\n\n if not check(i, j):\n\n print('No')\n\n exit()\n\nprint('Yes')","code_v0_loc":25,"code_v1_loc":25,"code_v0_num_chars":508,"code_v1_num_chars":580,"code_v0_no_empty_lines":"h, w = list(map(int, input().split()))\narea = []\nfor i in range(h):\n array = eval(input())\n area.append(array)\n\n\ndef check(i, j):\n x_1 = max(0, j - 1)\n x_2 = min(j + 1, w - 1)\n y_1 = max(0, i - 1)\n y_2 = min(i + 1, h - 1)\n if (\n area[y_1][j] == \"#\"\n or area[y_2][j] == \"#\"\n or area[i][x_1] == \"#\"\n or area[i][x_2] == \"#\"\n ):\n a = 0\n else:\n print(\"No\")\n exit()\n\n\nfor i in range(h):\n for j in range(w):\n if area[i][j] == \"#\":\n check(i, j)\nprint(\"Yes\")\n","code_v1_no_empty_lines":"h, w = list(map(int, input().split()))\narea = []\nfor i in range(h + 2):\n if i == 0 or i == h + 1:\n array = \".\" * (w + 2)\n else:\n array = eval(input())\n array = \".\" + array + \".\"\n area.append(array)\n\n\ndef check(i, j):\n if (\n area[i][j - 1] == \"#\"\n or area[i][j + 1] == \"#\"\n or area[i - 1][j] == \"#\"\n or area[i + 1][j] == \"#\"\n ):\n return True\n else:\n return False\n\n\nfor i in range(1, h + 1):\n for j in range(1, w + 1):\n if area[i][j] == \"#\":\n if not check(i, j):\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(h):","- array = eval(input())","+for i in range(h + 2):","+ if i == 0 or i == h + 1:","+ array = \".\" * (w + 2)","+ else:","+ array = eval(input())","+ array = \".\" + array + \".\"","- x_1 = max(0, j - 1)","- x_2 = min(j + 1, w - 1)","- y_1 = max(0, i - 1)","- y_2 = min(i + 1, h - 1)","- area[y_1][j] == \"#\"","- or area[y_2][j] == \"#\"","- or area[i][x_1] == \"#\"","- or area[i][x_2] == \"#\"","+ area[i][j - 1] == \"#\"","+ or area[i][j + 1] == \"#\"","+ or area[i - 1][j] == \"#\"","+ or area[i + 1][j] == \"#\"","- a = 0","+ return True","- print(\"No\")","- exit()","+ return False","-for i in range(h):","- for j in range(w):","+for i in range(1, h + 1):","+ for j in range(1, w + 1):","- check(i, j)","+ if not check(i, j):","+ print(\"No\")","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0353864911,"measured_runtime_v1":0.036120466,"runtime_lift":0.9796798041,"key":["s070831085","s084764928"]} +{"user_id":"u810288681","problem_id":"p03478","language":"python","submission_id_v0":"s483011708","submission_id_v1":"s148428925","cpu_time_v0":34,"cpu_time_v1":31,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.82,"input":"n,a,b = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(1,n+1):\n\n ns = str(i)\n\n t = 0\n\n for j in ns:\n\n t+= int(j)\n\n if t >= a and t <= b:\n\n ans+=i\n\nprint(ans) ","target":"n,a,b = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(1,n+1):\n\n ti = 0\n\n tmp = i\n\n while tmp!=0:\n\n ti += tmp%10\n\n tmp = tmp\/\/10\n\n if ti>=a and ti<=b:\n\n ans+=i\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":11,"code_v0_num_chars":191,"code_v1_num_chars":208,"code_v0_no_empty_lines":"n, a, b = list(map(int, input().split()))\nans = 0\nfor i in range(1, n + 1):\n ns = str(i)\n t = 0\n for j in ns:\n t += int(j)\n if t >= a and t <= b:\n ans += i\nprint(ans)\n","code_v1_no_empty_lines":"n, a, b = list(map(int, input().split()))\nans = 0\nfor i in range(1, n + 1):\n ti = 0\n tmp = i\n while tmp != 0:\n ti += tmp % 10\n tmp = tmp \/\/ 10\n if ti >= a and ti <= b:\n ans += i\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["- ns = str(i)","- t = 0","- for j in ns:","- t += int(j)","- if t >= a and t <= b:","+ ti = 0","+ tmp = i","+ while tmp != 0:","+ ti += tmp % 10","+ tmp = tmp \/\/ 10","+ if ti >= a and ti <= b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0463002,"measured_runtime_v1":0.039114573,"runtime_lift":1.1837071562,"key":["s483011708","s148428925"]} +{"user_id":"u296518383","problem_id":"p03262","language":"python","submission_id_v0":"s177880486","submission_id_v1":"s343029675","cpu_time_v0":229,"cpu_time_v1":110,"memory_v0":63640,"memory_v1":14212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.97,"input":"N, X = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\ndef gcd(x, y):\n\n return x if y == 0 else gcd(y, x % y)\n\n\n\nD = []\n\nfor a in A:\n\n D.append(abs(X - a))\n\n\n\nanswer = 0\n\nfor d in D:\n\n answer = gcd(answer, d)\n\n\n\nprint(answer)","target":"N, X = list(map(int, input().split()))\n\nA = list([abs(X - int(x)) for x in input().split()])\n\n\n\ndef gcd(x, y):\n\n return x if y == 0 else gcd(y, x % y)\n\n\n\nanswer = 0\n\nfor a in A:\n\n answer = gcd(answer, a)\n\n\n\nprint(answer)","code_v0_loc":15,"code_v1_loc":11,"code_v0_num_chars":246,"code_v1_num_chars":221,"code_v0_no_empty_lines":"N, X = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\n\ndef gcd(x, y):\n return x if y == 0 else gcd(y, x % y)\n\n\nD = []\nfor a in A:\n D.append(abs(X - a))\nanswer = 0\nfor d in D:\n answer = gcd(answer, d)\nprint(answer)\n","code_v1_no_empty_lines":"N, X = list(map(int, input().split()))\nA = list([abs(X - int(x)) for x in input().split()])\n\n\ndef gcd(x, y):\n return x if y == 0 else gcd(y, x % y)\n\n\nanswer = 0\nfor a in A:\n answer = gcd(answer, a)\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["-A = list(map(int, input().split()))","+A = list([abs(X - int(x)) for x in input().split()])","-D = []","+answer = 0","- D.append(abs(X - a))","-answer = 0","-for d in D:","- answer = gcd(answer, d)","+ answer = gcd(answer, a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.085079556,"measured_runtime_v1":0.0859977283,"runtime_lift":0.9893232951,"key":["s177880486","s343029675"]} +{"user_id":"u416011173","problem_id":"p02594","language":"python","submission_id_v0":"s384729572","submission_id_v1":"s958958864","cpu_time_v0":36,"cpu_time_v1":28,"memory_v0":9144,"memory_v1":9104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.22,"input":"# -*- coding: utf-8 -*-\n\n# \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\n\nX = int(eval(input()))\n\n\n\n# \u6c42\u89e3\u51e6\u7406\n\nans = str()\n\nif X >= 30:\n\n ans = \"Yes\"\n\nelse:\n\n ans = \"No\"\n\n\n\n# \u7d50\u679c\u51fa\u529b\n\nprint(ans)\n","target":"# -*- coding: utf-8 -*-\n\n\n\ndef get_input() -> int:\n\n \"\"\"\n\n \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\u3059\u308b.\n\n\n\n Returns:\\n\n\n int: \u5ba4\u6e29\n\n \"\"\"\n\n X = int(eval(input()))\n\n\n\n return X\n\n\n\n\n\ndef main(X: int) -> None:\n\n \"\"\"\n\n \u30e1\u30a4\u30f3\u51e6\u7406.\n\n\n\n Args:\\n\n\n X (int): \u5ba4\u6e29\uff08-40 <= X <= 40, \u6574\u6570\uff09\n\n \"\"\"\n\n # \u6c42\u89e3\u51e6\u7406\n\n ans = str()\n\n if X >= 30:\n\n ans = \"Yes\"\n\n else:\n\n ans = \"No\"\n\n\n\n # \u7d50\u679c\u51fa\u529b\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n # \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\n\n X = get_input()\n\n\n\n # \u30e1\u30a4\u30f3\u51e6\u7406\n\n main(X)\n","code_v0_loc":13,"code_v1_loc":38,"code_v0_num_chars":151,"code_v1_num_chars":499,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\n# \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\nX = int(eval(input()))\n# \u6c42\u89e3\u51e6\u7406\nans = str()\nif X >= 30:\n ans = \"Yes\"\nelse:\n ans = \"No\"\n# \u7d50\u679c\u51fa\u529b\nprint(ans)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\ndef get_input() -> int:\n \"\"\"\n \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\u3059\u308b.\n Returns:\\n\n int: \u5ba4\u6e29\n \"\"\"\n X = int(eval(input()))\n return X\n\n\ndef main(X: int) -> None:\n \"\"\"\n \u30e1\u30a4\u30f3\u51e6\u7406.\n Args:\\n\n X (int): \u5ba4\u6e29\uff08-40 <= X <= 40, \u6574\u6570\uff09\n \"\"\"\n # \u6c42\u89e3\u51e6\u7406\n ans = str()\n if X >= 30:\n ans = \"Yes\"\n else:\n ans = \"No\"\n # \u7d50\u679c\u51fa\u529b\n print(ans)\n\n\nif __name__ == \"__main__\":\n # \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\n X = get_input()\n # \u30e1\u30a4\u30f3\u51e6\u7406\n main(X)\n","code_same":false,"relative_loc_diff_percent":65.7894736842,"diff":["-# \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97","-X = int(eval(input()))","-# \u6c42\u89e3\u51e6\u7406","-ans = str()","-if X >= 30:","- ans = \"Yes\"","-else:","- ans = \"No\"","-# \u7d50\u679c\u51fa\u529b","-print(ans)","+def get_input() -> int:","+ \"\"\"","+ \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97\u3059\u308b.","+ Returns:\\n","+ int: \u5ba4\u6e29","+ \"\"\"","+ X = int(eval(input()))","+ return X","+","+","+def main(X: int) -> None:","+ \"\"\"","+ \u30e1\u30a4\u30f3\u51e6\u7406.","+ Args:\\n","+ X (int): \u5ba4\u6e29\uff08-40 <= X <= 40, \u6574\u6570\uff09","+ \"\"\"","+ # \u6c42\u89e3\u51e6\u7406","+ ans = str()","+ if X >= 30:","+ ans = \"Yes\"","+ else:","+ ans = \"No\"","+ # \u7d50\u679c\u51fa\u529b","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ # \u6a19\u6e96\u5165\u529b\u3092\u53d6\u5f97","+ X = get_input()","+ # \u30e1\u30a4\u30f3\u51e6\u7406","+ main(X)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0398117371,"measured_runtime_v1":0.0395391115,"runtime_lift":1.0068950865,"key":["s384729572","s958958864"]} +{"user_id":"u114628916","problem_id":"p02263","language":"python","submission_id_v0":"s118434914","submission_id_v1":"s732509545","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":6600,"memory_v1":6592,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"import re\n\n\n\ndef revPolish(f):\n\n f = re.sub(r'(\\-?\\d+\\.?\\d*)\\s(\\-?\\d+\\.?\\d*)\\s([\\+\\-\\*\/])(?!\\d)',\n\n lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),\n\n f)\n\n if f[-1] in ('+','-','*','\/'):\n\n return revPolish(f)\n\n else:\n\n return f\n\n\n\nif __name__=='__main__':\n\n print((revPolish(eval(input()))))\n","target":"import re\n\npat = re.compile(r'(\\-?\\d+\\.?\\d*)\\s(\\-?\\d+\\.?\\d*)\\s([\\+\\-\\*\/])(?!\\d)')\n\n\n\ndef revPolish(f):\n\n global pat\n\n f = pat.sub(lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),f)\n\n if f[-1] in '+-*\/':\n\n return revPolish(f)\n\n else:\n\n return f\n\n\n\nprint((revPolish(eval(input()))))\n","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":334,"code_v1_num_chars":309,"code_v0_no_empty_lines":"import re\n\n\ndef revPolish(f):\n f = re.sub(\n r\"(\\-?\\d+\\.?\\d*)\\s(\\-?\\d+\\.?\\d*)\\s([\\+\\-\\*\/])(?!\\d)\",\n lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),\n f,\n )\n if f[-1] in (\"+\", \"-\", \"*\", \"\/\"):\n return revPolish(f)\n else:\n return f\n\n\nif __name__ == \"__main__\":\n print((revPolish(eval(input()))))\n","code_v1_no_empty_lines":"import re\n\npat = re.compile(r\"(\\-?\\d+\\.?\\d*)\\s(\\-?\\d+\\.?\\d*)\\s([\\+\\-\\*\/])(?!\\d)\")\n\n\ndef revPolish(f):\n global pat\n f = pat.sub(lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))), f)\n if f[-1] in \"+-*\/\":\n return revPolish(f)\n else:\n return f\n\n\nprint((revPolish(eval(input()))))\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["+","+pat = re.compile(r\"(\\-?\\d+\\.?\\d*)\\s(\\-?\\d+\\.?\\d*)\\s([\\+\\-\\*\/])(?!\\d)\")","- f = re.sub(","- r\"(\\-?\\d+\\.?\\d*)\\s(\\-?\\d+\\.?\\d*)\\s([\\+\\-\\*\/])(?!\\d)\",","- lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),","- f,","- )","- if f[-1] in (\"+\", \"-\", \"*\", \"\/\"):","+ global pat","+ f = pat.sub(lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))), f)","+ if f[-1] in \"+-*\/\":","-if __name__ == \"__main__\":","- print((revPolish(eval(input()))))","+print((revPolish(eval(input()))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0459973961,"measured_runtime_v1":0.1142881403,"runtime_lift":0.4024686721,"key":["s118434914","s732509545"]} +{"user_id":"u657913472","problem_id":"p03183","language":"python","submission_id_v0":"s003633081","submission_id_v1":"s013745137","cpu_time_v0":365,"cpu_time_v1":335,"memory_v0":42604,"memory_v1":42604,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.22,"input":"n=int(eval(input()));\n\nans=0;\n\np=[0]*22222;\n\nfor w,s,v in sorted([list(map(int,input().split()))for _ in[0]*n],key=lambda a:a[0]+a[1]):\n\n for j in range(s,-1,-1):\n\n p[j+w]=max(p[j+w],p[j]+v);\n\n ans=max(ans,p[j+w]);\n\nprint(ans)\n","target":"p=[0]*6**6\n\nfor w,s,v in sorted([list(map(int,input().split()))for _ in[0]*int(eval(input()))],key=lambda a:a[0]+a[1]):\n\n for j in range(s,-1,-1):p[j+w]=max(p[j+w],p[j]+v)\n\nprint((max(p)))","code_v0_loc":8,"code_v1_loc":4,"code_v0_num_chars":223,"code_v1_num_chars":180,"code_v0_no_empty_lines":"n = int(eval(input()))\nans = 0\np = [0] * 22222\nfor w, s, v in sorted(\n [list(map(int, input().split())) for _ in [0] * n], key=lambda a: a[0] + a[1]\n):\n for j in range(s, -1, -1):\n p[j + w] = max(p[j + w], p[j] + v)\n ans = max(ans, p[j + w])\nprint(ans)\n","code_v1_no_empty_lines":"p = [0] * 6**6\nfor w, s, v in sorted(\n [list(map(int, input().split())) for _ in [0] * int(eval(input()))],\n key=lambda a: a[0] + a[1],\n):\n for j in range(s, -1, -1):\n p[j + w] = max(p[j + w], p[j] + v)\nprint((max(p)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-n = int(eval(input()))","-ans = 0","-p = [0] * 22222","+p = [0] * 6**6","- [list(map(int, input().split())) for _ in [0] * n], key=lambda a: a[0] + a[1]","+ [list(map(int, input().split())) for _ in [0] * int(eval(input()))],","+ key=lambda a: a[0] + a[1],","- ans = max(ans, p[j + w])","-print(ans)","+print((max(p)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0685224576,"measured_runtime_v1":0.0683959694,"runtime_lift":1.0018493516,"key":["s003633081","s013745137"]} +{"user_id":"u021548497","problem_id":"p03168","language":"python","submission_id_v0":"s488087838","submission_id_v1":"s505739242","cpu_time_v0":750,"cpu_time_v1":461,"memory_v0":253960,"memory_v1":147884,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.53,"input":"import sys\n\nsys.setrecursionlimit(4000)\n\n\n\nn = int(eval(input()))\n\np = [float(x) for x in input().split()]\n\n\n\ndp = [[0]*(n+1) for i in range(n)]\n\n\n\ndp[0][0] = 1-p[0]\n\ndp[0][1] = p[0]\n\n\n\nfor i in range(n-1):\n\n for j in range(i+2):\n\n dp[i+1][j] += dp[i][j]*(1-p[i+1])\n\n dp[i+1][j+1] += dp[i][j]*p[i+1]\n\n\n\nans = 0\n\nfor i in range(n\/\/2+1, n+1):\n\n ans += dp[n-1][i]\n\nprint(ans)","target":"n = int(eval(input()))\n\np = [float(x) for x in input().split()]\n\n\n\ndp = [[0]*(i+2) for i in range(n)]\n\ndp[0][0] = 1-p[0]\n\ndp[0][1] = p[0]\n\n\n\nfor i in range(1, n):\n\n for j in range(i+2):\n\n if j == 0:\n\n dp[i][j] = dp[i-1][j]*(1-p[i])\n\n continue\n\n if j == i+1:\n\n dp[i][j] = dp[i-1][j-1]*p[i]\n\n continue\n\n dp[i][j] = dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i])\n\nans = 0\n\nfor i in range(n\/\/2+1, n+1):\n\n ans += dp[n-1][i]\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":20,"code_v0_num_chars":374,"code_v1_num_chars":446,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(4000)\nn = int(eval(input()))\np = [float(x) for x in input().split()]\ndp = [[0] * (n + 1) for i in range(n)]\ndp[0][0] = 1 - p[0]\ndp[0][1] = p[0]\nfor i in range(n - 1):\n for j in range(i + 2):\n dp[i + 1][j] += dp[i][j] * (1 - p[i + 1])\n dp[i + 1][j + 1] += dp[i][j] * p[i + 1]\nans = 0\nfor i in range(n \/\/ 2 + 1, n + 1):\n ans += dp[n - 1][i]\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\np = [float(x) for x in input().split()]\ndp = [[0] * (i + 2) for i in range(n)]\ndp[0][0] = 1 - p[0]\ndp[0][1] = p[0]\nfor i in range(1, n):\n for j in range(i + 2):\n if j == 0:\n dp[i][j] = dp[i - 1][j] * (1 - p[i])\n continue\n if j == i + 1:\n dp[i][j] = dp[i - 1][j - 1] * p[i]\n continue\n dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i])\nans = 0\nfor i in range(n \/\/ 2 + 1, n + 1):\n ans += dp[n - 1][i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import sys","-","-sys.setrecursionlimit(4000)","-dp = [[0] * (n + 1) for i in range(n)]","+dp = [[0] * (i + 2) for i in range(n)]","-for i in range(n - 1):","+for i in range(1, n):","- dp[i + 1][j] += dp[i][j] * (1 - p[i + 1])","- dp[i + 1][j + 1] += dp[i][j] * p[i + 1]","+ if j == 0:","+ dp[i][j] = dp[i - 1][j] * (1 - p[i])","+ continue","+ if j == i + 1:","+ dp[i][j] = dp[i - 1][j - 1] * p[i]","+ continue","+ dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i])"],"diff_only_import_comment":false,"measured_runtime_v0":0.044781307,"measured_runtime_v1":0.0371099207,"runtime_lift":1.2067206309,"key":["s488087838","s505739242"]} +{"user_id":"u281303342","problem_id":"p03660","language":"python","submission_id_v0":"s709457319","submission_id_v1":"s405574163","cpu_time_v0":512,"cpu_time_v1":472,"memory_v0":22908,"memory_v1":22896,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.81,"input":"N = int(eval(input()))\n\nG = [[] for _ in range(N)]\n\nvisited = [0]*N\n\nvisited[0],visited[N-1] = 1,1\n\nvisited_all = [1]*N\n\nfor i in range(N-1):\n\n a,b = list(map(int,input().split()))\n\n G[a-1].append(b-1)\n\n G[b-1].append(a-1)\n\nnextA,nextB = G[0],G[N-1]\n\nscoreA,scoreB = 1,1\n\nwhile visited != visited_all:\n\n l = []\n\n for a in nextA:\n\n if visited[a] == 0:\n\n visited[a] = 1\n\n scoreA += 1\n\n for x in G[a]:\n\n l.append(x)\n\n nextA = l\n\n l = []\n\n for b in nextB:\n\n if visited[b] == 0:\n\n visited[b] = 1\n\n scoreB += 1\n\n for x in G[b]:\n\n l.append(x)\n\n nextB = l\n\nprint((\"Fennec\" if scoreA > scoreB else \"Snuke\"))\n","target":"N = int(eval(input()))\n\nA = [[] for _ in range(N)]\n\nfor i in range(N-1):\n\n a,b = list(map(int,input().split()))\n\n A[a-1].append(b-1)\n\n A[b-1].append(a-1)\n\n\n\nB = [False]*N\n\nvisited = [True]*N\n\n\n\nFp,Sp = 0,0\n\nFi,Si = [0],[N-1]\n\n\n\nwhile B != visited:\n\n # Fennec\n\n nextXi = []\n\n for i in Fi:\n\n if not B[i]:\n\n B[i] = True\n\n Fp += 1\n\n nextXi.extend(A[i])\n\n Fi = nextXi\n\n # Snuke\n\n nextXi = []\n\n for i in Si:\n\n if not B[i]:\n\n B[i] = True\n\n Sp += 1\n\n nextXi.extend(A[i])\n\n Si = nextXi\n\n\n\nprint((\"Fennec\" if Fp>Sp else \"Snuke\"))","code_v0_loc":29,"code_v1_loc":32,"code_v0_num_chars":722,"code_v1_num_chars":618,"code_v0_no_empty_lines":"N = int(eval(input()))\nG = [[] for _ in range(N)]\nvisited = [0] * N\nvisited[0], visited[N - 1] = 1, 1\nvisited_all = [1] * N\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n G[a - 1].append(b - 1)\n G[b - 1].append(a - 1)\nnextA, nextB = G[0], G[N - 1]\nscoreA, scoreB = 1, 1\nwhile visited != visited_all:\n l = []\n for a in nextA:\n if visited[a] == 0:\n visited[a] = 1\n scoreA += 1\n for x in G[a]:\n l.append(x)\n nextA = l\n l = []\n for b in nextB:\n if visited[b] == 0:\n visited[b] = 1\n scoreB += 1\n for x in G[b]:\n l.append(x)\n nextB = l\nprint((\"Fennec\" if scoreA > scoreB else \"Snuke\"))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [[] for _ in range(N)]\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n A[a - 1].append(b - 1)\n A[b - 1].append(a - 1)\nB = [False] * N\nvisited = [True] * N\nFp, Sp = 0, 0\nFi, Si = [0], [N - 1]\nwhile B != visited:\n # Fennec\n nextXi = []\n for i in Fi:\n if not B[i]:\n B[i] = True\n Fp += 1\n nextXi.extend(A[i])\n Fi = nextXi\n # Snuke\n nextXi = []\n for i in Si:\n if not B[i]:\n B[i] = True\n Sp += 1\n nextXi.extend(A[i])\n Si = nextXi\nprint((\"Fennec\" if Fp > Sp else \"Snuke\"))\n","code_same":false,"relative_loc_diff_percent":9.375,"diff":["-G = [[] for _ in range(N)]","-visited = [0] * N","-visited[0], visited[N - 1] = 1, 1","-visited_all = [1] * N","+A = [[] for _ in range(N)]","- G[a - 1].append(b - 1)","- G[b - 1].append(a - 1)","-nextA, nextB = G[0], G[N - 1]","-scoreA, scoreB = 1, 1","-while visited != visited_all:","- l = []","- for a in nextA:","- if visited[a] == 0:","- visited[a] = 1","- scoreA += 1","- for x in G[a]:","- l.append(x)","- nextA = l","- l = []","- for b in nextB:","- if visited[b] == 0:","- visited[b] = 1","- scoreB += 1","- for x in G[b]:","- l.append(x)","- nextB = l","-print((\"Fennec\" if scoreA > scoreB else \"Snuke\"))","+ A[a - 1].append(b - 1)","+ A[b - 1].append(a - 1)","+B = [False] * N","+visited = [True] * N","+Fp, Sp = 0, 0","+Fi, Si = [0], [N - 1]","+while B != visited:","+ # Fennec","+ nextXi = []","+ for i in Fi:","+ if not B[i]:","+ B[i] = True","+ Fp += 1","+ nextXi.extend(A[i])","+ Fi = nextXi","+ # Snuke","+ nextXi = []","+ for i in Si:","+ if not B[i]:","+ B[i] = True","+ Sp += 1","+ nextXi.extend(A[i])","+ Si = nextXi","+print((\"Fennec\" if Fp > Sp else \"Snuke\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1657465458,"measured_runtime_v1":0.0478161812,"runtime_lift":3.4663275414,"key":["s709457319","s405574163"]} +{"user_id":"u654470292","problem_id":"p02819","language":"python","submission_id_v0":"s388359672","submission_id_v1":"s037355240","cpu_time_v0":169,"cpu_time_v1":81,"memory_v0":38640,"memory_v1":69464,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.07,"input":"import sys\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\nx=int(eval(input()))\n\nwhile 1:\n\n flag=0\n\n for i in range(2,int(x**(1\/2))):\n\n if x%i==0:\n\n flag=1\n\n break\n\n if flag==0:\n\n break\n\n x+=1\n\nprint(x)","target":"import bisect, copy, heapq, math, sys\n\nfrom collections import *\n\nfrom functools import lru_cache\n\nfrom itertools import accumulate, combinations, permutations, product\n\ndef input():\n\n return sys.stdin.readline()[:-1]\n\ndef ruiseki(lst):\n\n return [0]+list(accumulate(lst))\n\ndef celi(a,b):\n\n return -(-a\/\/b)\n\nsys.setrecursionlimit(5000000)\n\nmod=pow(10,9)+7\n\nal=[chr(ord('a') + i) for i in range(26)]\n\ndirection=[[1,0],[0,1],[-1,0],[0,-1]]\n\n\n\nx=int(eval(input()))\n\ndef is_prime(n):\n\n if n == 1: return False\n\n for k in range(2, int(math.sqrt(n)) + 1):\n\n if n % k == 0:\n\n return False\n\n return True\n\n\n\nans=x\n\nwhile not is_prime(ans):\n\n ans+=1\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":27,"code_v0_num_chars":249,"code_v1_num_chars":683,"code_v0_no_empty_lines":"import sys\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\nx = int(eval(input()))\nwhile 1:\n flag = 0\n for i in range(2, int(x ** (1 \/ 2))):\n if x % i == 0:\n flag = 1\n break\n if flag == 0:\n break\n x += 1\nprint(x)\n","code_v1_no_empty_lines":"import bisect, copy, heapq, math, sys\nfrom collections import *\nfrom functools import lru_cache\nfrom itertools import accumulate, combinations, permutations, product\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\ndef ruiseki(lst):\n return [0] + list(accumulate(lst))\n\n\ndef celi(a, b):\n return -(-a \/\/ b)\n\n\nsys.setrecursionlimit(5000000)\nmod = pow(10, 9) + 7\nal = [chr(ord(\"a\") + i) for i in range(26)]\ndirection = [[1, 0], [0, 1], [-1, 0], [0, -1]]\nx = int(eval(input()))\n\n\ndef is_prime(n):\n if n == 1:\n return False\n for k in range(2, int(math.sqrt(n)) + 1):\n if n % k == 0:\n return False\n return True\n\n\nans = x\nwhile not is_prime(ans):\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":48.1481481481,"diff":["-import sys","+import bisect, copy, heapq, math, sys","+from collections import *","+from functools import lru_cache","+from itertools import accumulate, combinations, permutations, product","+def ruiseki(lst):","+ return [0] + list(accumulate(lst))","+","+","+def celi(a, b):","+ return -(-a \/\/ b)","+","+","+sys.setrecursionlimit(5000000)","+mod = pow(10, 9) + 7","+al = [chr(ord(\"a\") + i) for i in range(26)]","+direction = [[1, 0], [0, 1], [-1, 0], [0, -1]]","-while 1:","- flag = 0","- for i in range(2, int(x ** (1 \/ 2))):","- if x % i == 0:","- flag = 1","- break","- if flag == 0:","- break","- x += 1","-print(x)","+","+","+def is_prime(n):","+ if n == 1:","+ return False","+ for k in range(2, int(math.sqrt(n)) + 1):","+ if n % k == 0:","+ return False","+ return True","+","+","+ans = x","+while not is_prime(ans):","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0865487938,"measured_runtime_v1":0.042667074,"runtime_lift":2.0284679902,"key":["s388359672","s037355240"]} +{"user_id":"u894258749","problem_id":"p03212","language":"python","submission_id_v0":"s317490787","submission_id_v1":"s678944128","cpu_time_v0":370,"cpu_time_v1":313,"memory_v0":20148,"memory_v1":18896,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.41,"input":"import numpy as np\n\n\n\ndef count(n,s):\n\n if s == 0:\n\n return 3**n - 3*(2**n) + 3\n\n elif s == 1:\n\n return 3**n - 2**(n+1) + 1\n\n elif s == 2:\n\n return 3**n - 2**n\n\n else:\n\n return 3**n\n\n\n\ndef num753(Nlist, appeared):\n\n n = len(Nlist)\n\n if n == 0:\n\n if appeared == 7:\n\n return 1\n\n else:\n\n return 0\n\n \n\n top = Nlist[-1]\n\n \n\n ap3 = appeared|1\n\n s3 = ap3 % 2 + (ap3 % 4)\/\/2 + ap3 \/\/ 4\n\n ap5 = appeared|2\n\n s5 = ap5 % 2 + (ap5 % 4)\/\/2 + ap5 \/\/ 4\n\n ap7 = appeared|4\n\n s7 = ap7 % 2 + (ap7 % 4)\/\/2 + ap7 \/\/ 4\n\n\n\n if appeared == 0:\n\n ans = sum([count(i,0) for i in range(3,n)])\n\n else:\n\n ans = 0\n\n\n\n if top < 3:\n\n pass\n\n elif top == 3:\n\n ans = ans + num753(Nlist[:-1],ap3)\n\n elif top == 4:\n\n ans = ans + count(n-1,s3)\n\n elif top == 5:\n\n ans = ans + count(n-1,s3) + num753(Nlist[:-1],ap5)\n\n elif top == 6:\n\n ans = ans + count(n-1,s3) + count(n-1,s5)\n\n elif top == 7:\n\n ans = ans + count(n-1,s3) + count(n-1,s5) + num753(Nlist[:-1],ap7)\n\n else: # top == 8,9\n\n ans = ans + count(n-1,s3) + count(n-1,s5) + count(n-1,s7)\n\n \n\n return ans\n\n\n\nN = int(eval(input()))\n\nNlist=[]\n\nwhile N > 0:\n\n Nlist.append(N % 10)\n\n N = N \/\/ 10\n\nNlist = np.array(Nlist,dtype=np.int)\n\n\n\nprint((num753(Nlist,0)))","target":"import numpy as np\n\n\n\ndef list753(n):\n\n if n == 1:\n\n return np.array([3,5,7],dtype=np.int)\n\n else:\n\n prev = list753(n-1)\n\n return np.concatenate((10*prev+3,10*prev+5,10*prev+7))\n\n\n\ndef all_list753(n):\n\n return np.concatenate(tuple([list753(i) for i in range(1,n+1)]))\n\n\n\nNstr = eval(input())\n\nN = int(Nstr)\n\nNlen = len(Nstr)\n\n\n\ncandidates = all_list753(Nlen)\n\nans = 0\n\n\n\nfor c in candidates:\n\n if c > N:\n\n continue\n\n cstr = str(c)\n\n if '3' in cstr and '5' in cstr and '7' in cstr:\n\n ans += 1\n\n\n\nprint(ans)","code_v0_loc":59,"code_v1_loc":27,"code_v0_num_chars":1375,"code_v1_num_chars":552,"code_v0_no_empty_lines":"import numpy as np\n\n\ndef count(n, s):\n if s == 0:\n return 3**n - 3 * (2**n) + 3\n elif s == 1:\n return 3**n - 2 ** (n + 1) + 1\n elif s == 2:\n return 3**n - 2**n\n else:\n return 3**n\n\n\ndef num753(Nlist, appeared):\n n = len(Nlist)\n if n == 0:\n if appeared == 7:\n return 1\n else:\n return 0\n top = Nlist[-1]\n ap3 = appeared | 1\n s3 = ap3 % 2 + (ap3 % 4) \/\/ 2 + ap3 \/\/ 4\n ap5 = appeared | 2\n s5 = ap5 % 2 + (ap5 % 4) \/\/ 2 + ap5 \/\/ 4\n ap7 = appeared | 4\n s7 = ap7 % 2 + (ap7 % 4) \/\/ 2 + ap7 \/\/ 4\n if appeared == 0:\n ans = sum([count(i, 0) for i in range(3, n)])\n else:\n ans = 0\n if top < 3:\n pass\n elif top == 3:\n ans = ans + num753(Nlist[:-1], ap3)\n elif top == 4:\n ans = ans + count(n - 1, s3)\n elif top == 5:\n ans = ans + count(n - 1, s3) + num753(Nlist[:-1], ap5)\n elif top == 6:\n ans = ans + count(n - 1, s3) + count(n - 1, s5)\n elif top == 7:\n ans = ans + count(n - 1, s3) + count(n - 1, s5) + num753(Nlist[:-1], ap7)\n else: # top == 8,9\n ans = ans + count(n - 1, s3) + count(n - 1, s5) + count(n - 1, s7)\n return ans\n\n\nN = int(eval(input()))\nNlist = []\nwhile N > 0:\n Nlist.append(N % 10)\n N = N \/\/ 10\nNlist = np.array(Nlist, dtype=np.int)\nprint((num753(Nlist, 0)))\n","code_v1_no_empty_lines":"import numpy as np\n\n\ndef list753(n):\n if n == 1:\n return np.array([3, 5, 7], dtype=np.int)\n else:\n prev = list753(n - 1)\n return np.concatenate((10 * prev + 3, 10 * prev + 5, 10 * prev + 7))\n\n\ndef all_list753(n):\n return np.concatenate(tuple([list753(i) for i in range(1, n + 1)]))\n\n\nNstr = eval(input())\nN = int(Nstr)\nNlen = len(Nstr)\ncandidates = all_list753(Nlen)\nans = 0\nfor c in candidates:\n if c > N:\n continue\n cstr = str(c)\n if \"3\" in cstr and \"5\" in cstr and \"7\" in cstr:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":54.2372881356,"diff":["-def count(n, s):","- if s == 0:","- return 3**n - 3 * (2**n) + 3","- elif s == 1:","- return 3**n - 2 ** (n + 1) + 1","- elif s == 2:","- return 3**n - 2**n","+def list753(n):","+ if n == 1:","+ return np.array([3, 5, 7], dtype=np.int)","- return 3**n","+ prev = list753(n - 1)","+ return np.concatenate((10 * prev + 3, 10 * prev + 5, 10 * prev + 7))","-def num753(Nlist, appeared):","- n = len(Nlist)","- if n == 0:","- if appeared == 7:","- return 1","- else:","- return 0","- top = Nlist[-1]","- ap3 = appeared | 1","- s3 = ap3 % 2 + (ap3 % 4) \/\/ 2 + ap3 \/\/ 4","- ap5 = appeared | 2","- s5 = ap5 % 2 + (ap5 % 4) \/\/ 2 + ap5 \/\/ 4","- ap7 = appeared | 4","- s7 = ap7 % 2 + (ap7 % 4) \/\/ 2 + ap7 \/\/ 4","- if appeared == 0:","- ans = sum([count(i, 0) for i in range(3, n)])","- else:","- ans = 0","- if top < 3:","- pass","- elif top == 3:","- ans = ans + num753(Nlist[:-1], ap3)","- elif top == 4:","- ans = ans + count(n - 1, s3)","- elif top == 5:","- ans = ans + count(n - 1, s3) + num753(Nlist[:-1], ap5)","- elif top == 6:","- ans = ans + count(n - 1, s3) + count(n - 1, s5)","- elif top == 7:","- ans = ans + count(n - 1, s3) + count(n - 1, s5) + num753(Nlist[:-1], ap7)","- else: # top == 8,9","- ans = ans + count(n - 1, s3) + count(n - 1, s5) + count(n - 1, s7)","- return ans","+def all_list753(n):","+ return np.concatenate(tuple([list753(i) for i in range(1, n + 1)]))","-N = int(eval(input()))","-Nlist = []","-while N > 0:","- Nlist.append(N % 10)","- N = N \/\/ 10","-Nlist = np.array(Nlist, dtype=np.int)","-print((num753(Nlist, 0)))","+Nstr = eval(input())","+N = int(Nstr)","+Nlen = len(Nstr)","+candidates = all_list753(Nlen)","+ans = 0","+for c in candidates:","+ if c > N:","+ continue","+ cstr = str(c)","+ if \"3\" in cstr and \"5\" in cstr and \"7\" in cstr:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2056194179,"measured_runtime_v1":0.21619064,"runtime_lift":0.9511023138,"key":["s317490787","s678944128"]} +{"user_id":"u513434790","problem_id":"p03612","language":"python","submission_id_v0":"s407033791","submission_id_v1":"s372502019","cpu_time_v0":144,"cpu_time_v1":130,"memory_v0":14008,"memory_v1":14132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.72,"input":"N = int(eval(input()))\n\np = tuple(map(int, input().split()))\n\na = list(p)\n\nb = list(p)\n\n\n\nc = 0\n\nfor i in range(N):\n\n if i+1 == a[i] and i == N-1:\n\n c += 1\n\n elif i+1 == a[i]:\n\n a[i], a[i+1] = a[i+1], a[i]\n\n c += 1\n\ncc = 0 \n\nfor i in range(N)[::-1]:\n\n if i+1 == b[i] and i == 0:\n\n cc += 1\n\n if i+1 == b[i]:\n\n b[i], b[i-1] = b[i-1], b[i]\n\n cc += 1\n\n \n\nprint((min(c,cc)))","target":"N = int(eval(input()))\n\np = tuple(map(int, input().split()))\n\na = list(p)\n\nb = list(p)\n\n\n\nc = 0\n\nfor i in range(N):\n\n if i+1 == a[i] and i == N-1:\n\n c += 1\n\n elif i+1 == a[i]:\n\n a[i], a[i+1] = a[i+1], a[i]\n\n c += 1\n\ncc = 0 \n\nfor i in range(N)[::-1]:\n\n if i+1 == b[i] and i == 0:\n\n cc += 1\n\n elif i+1 == b[i]:\n\n b[i], b[i-1] = b[i-1], b[i]\n\n cc += 1\n\n \n\nprint((min(c,cc)))","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":429,"code_v1_num_chars":431,"code_v0_no_empty_lines":"N = int(eval(input()))\np = tuple(map(int, input().split()))\na = list(p)\nb = list(p)\nc = 0\nfor i in range(N):\n if i + 1 == a[i] and i == N - 1:\n c += 1\n elif i + 1 == a[i]:\n a[i], a[i + 1] = a[i + 1], a[i]\n c += 1\ncc = 0\nfor i in range(N)[::-1]:\n if i + 1 == b[i] and i == 0:\n cc += 1\n if i + 1 == b[i]:\n b[i], b[i - 1] = b[i - 1], b[i]\n cc += 1\nprint((min(c, cc)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\np = tuple(map(int, input().split()))\na = list(p)\nb = list(p)\nc = 0\nfor i in range(N):\n if i + 1 == a[i] and i == N - 1:\n c += 1\n elif i + 1 == a[i]:\n a[i], a[i + 1] = a[i + 1], a[i]\n c += 1\ncc = 0\nfor i in range(N)[::-1]:\n if i + 1 == b[i] and i == 0:\n cc += 1\n elif i + 1 == b[i]:\n b[i], b[i - 1] = b[i - 1], b[i]\n cc += 1\nprint((min(c, cc)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if i + 1 == b[i]:","+ elif i + 1 == b[i]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0388107524,"measured_runtime_v1":0.0389473572,"runtime_lift":0.9964925786,"key":["s407033791","s372502019"]} +{"user_id":"u489959379","problem_id":"p02820","language":"python","submission_id_v0":"s374067471","submission_id_v1":"s792015765","cpu_time_v0":67,"cpu_time_v1":41,"memory_v0":4212,"memory_v1":4084,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.81,"input":"n, k = list(map(int, input().split()))\n\nr, s, p = list(map(int, input().split()))\n\nt = str(eval(input()))\n\n\n\nans = 0\n\nte = [\"\" for _ in range(n)]\n\nfor i in range(n):\n\n\tif t[i] == \"r\" and te[i - k] != \"p\":\n\n\t\tans += p\n\n\t\tte[i] = \"p\"\n\n\telif t[i] == \"s\" and te[i - k] != \"r\":\n\n\t\tans += r\n\n\t\tte[i] = \"r\"\n\n\telif t[i] == \"p\" and te[i - k] != \"s\":\n\n\t\tans += s\n\n\t\tte[i] = \"s\"\n\n\n\nprint(ans)","target":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n n, k = list(map(int, input().split()))\n\n r, s, p = list(map(int, input().split()))\n\n t = list(eval(input()))\n\n\n\n res = 0\n\n for i in range(n):\n\n if i < k:\n\n res += p if t[i] == \"r\" else r if t[i] == \"s\" else s\n\n else:\n\n if t[i - k] != t[i]:\n\n res += p if t[i] == \"r\" else r if t[i] == \"s\" else s\n\n else:\n\n t[i] = \"e\"\n\n\n\n print(res)\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","code_v0_loc":18,"code_v1_loc":27,"code_v0_num_chars":363,"code_v1_num_chars":563,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nr, s, p = list(map(int, input().split()))\nt = str(eval(input()))\nans = 0\nte = [\"\" for _ in range(n)]\nfor i in range(n):\n if t[i] == \"r\" and te[i - k] != \"p\":\n ans += p\n te[i] = \"p\"\n elif t[i] == \"s\" and te[i - k] != \"r\":\n ans += r\n te[i] = \"r\"\n elif t[i] == \"p\" and te[i - k] != \"s\":\n ans += s\n te[i] = \"s\"\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef resolve():\n n, k = list(map(int, input().split()))\n r, s, p = list(map(int, input().split()))\n t = list(eval(input()))\n res = 0\n for i in range(n):\n if i < k:\n res += p if t[i] == \"r\" else r if t[i] == \"s\" else s\n else:\n if t[i - k] != t[i]:\n res += p if t[i] == \"r\" else r if t[i] == \"s\" else s\n else:\n t[i] = \"e\"\n print(res)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-n, k = list(map(int, input().split()))","-r, s, p = list(map(int, input().split()))","-t = str(eval(input()))","-ans = 0","-te = [\"\" for _ in range(n)]","-for i in range(n):","- if t[i] == \"r\" and te[i - k] != \"p\":","- ans += p","- te[i] = \"p\"","- elif t[i] == \"s\" and te[i - k] != \"r\":","- ans += r","- te[i] = \"r\"","- elif t[i] == \"p\" and te[i - k] != \"s\":","- ans += s","- te[i] = \"s\"","-print(ans)","+import sys","+","+sys.setrecursionlimit(10**7)","+f_inf = float(\"inf\")","+mod = 10**9 + 7","+","+","+def resolve():","+ n, k = list(map(int, input().split()))","+ r, s, p = list(map(int, input().split()))","+ t = list(eval(input()))","+ res = 0","+ for i in range(n):","+ if i < k:","+ res += p if t[i] == \"r\" else r if t[i] == \"s\" else s","+ else:","+ if t[i - k] != t[i]:","+ res += p if t[i] == \"r\" else r if t[i] == \"s\" else s","+ else:","+ t[i] = \"e\"","+ print(res)","+","+","+if __name__ == \"__main__\":","+ resolve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.109433444,"measured_runtime_v1":0.0566186318,"runtime_lift":1.932816821,"key":["s374067471","s792015765"]} +{"user_id":"u179169725","problem_id":"p03829","language":"python","submission_id_v0":"s768940234","submission_id_v1":"s156149220","cpu_time_v0":439,"cpu_time_v1":90,"memory_v0":23120,"memory_v1":14172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.5,"input":"# https:\/\/atcoder.jp\/contests\/abc052\/tasks\/arc067_b\n\n# \u6b69\u3044\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u304b\u30c6\u30ec\u30dd\u30fc\u30c8\u3057\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u304b\u8caa\u6b32\u306b\u9078\u629e\u3057\u3066\u3044\u304f\u3060\u3051\u3067\u306f\uff1f\n\n\n\nimport sys\n\nread = sys.stdin.readline\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\nimport numpy as np\n\nN, A, B = read_ints()\n\nX = read_ints()\n\n\n\n# \u9762\u5012\u306a\u306e\u3067numpy\u82b8\u3057\u3066\u3048\u3048\u304b\uff1f\n\nX_diff = np.diff(X)\n\nans = 0\n\nfor d in X_diff:\n\n ans += min(B, d * A)\n\nprint(ans)\n","target":"# https:\/\/atcoder.jp\/contests\/abc052\/tasks\/arc067_b\n\n# \u6b69\u3044\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u304b\u30c6\u30ec\u30dd\u30fc\u30c8\u3057\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u304b\u8caa\u6b32\u306b\u9078\u629e\u3057\u3066\u3044\u304f\u3060\u3051\u3067\u306f\uff1f\n\n\n\nimport sys\n\nread = sys.stdin.readline\n\n\n\n\n\ndef read_ints():\n\n return list(map(int, read().split()))\n\n\n\n\n\n\n\nN, A, B = read_ints()\n\nX = read_ints()\n\n\n\n# \u9762\u5012\u306a\u306e\u3067numpy\u82b8\u3057\u3066\u3048\u3048\u304b\uff1f\n\nX_diff = [x-y for x,y in zip(X[1:],X[:-1])]\n\nans = 0\n\nfor d in X_diff:\n\n ans += min(B, d * A)\n\nprint(ans)\n","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":373,"code_v1_num_chars":379,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc052\/tasks\/arc067_b\n# \u6b69\u3044\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u304b\u30c6\u30ec\u30dd\u30fc\u30c8\u3057\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u304b\u8caa\u6b32\u306b\u9078\u629e\u3057\u3066\u3044\u304f\u3060\u3051\u3067\u306f\uff1f\nimport sys\n\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\nimport numpy as np\n\nN, A, B = read_ints()\nX = read_ints()\n# \u9762\u5012\u306a\u306e\u3067numpy\u82b8\u3057\u3066\u3048\u3048\u304b\uff1f\nX_diff = np.diff(X)\nans = 0\nfor d in X_diff:\n ans += min(B, d * A)\nprint(ans)\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/abc052\/tasks\/arc067_b\n# \u6b69\u3044\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u304b\u30c6\u30ec\u30dd\u30fc\u30c8\u3057\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u304b\u8caa\u6b32\u306b\u9078\u629e\u3057\u3066\u3044\u304f\u3060\u3051\u3067\u306f\uff1f\nimport sys\n\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\nN, A, B = read_ints()\nX = read_ints()\n# \u9762\u5012\u306a\u306e\u3067numpy\u82b8\u3057\u3066\u3048\u3048\u304b\uff1f\nX_diff = [x - y for x, y in zip(X[1:], X[:-1])]\nans = 0\nfor d in X_diff:\n ans += min(B, d * A)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy as np","-","-X_diff = np.diff(X)","+X_diff = [x - y for x, y in zip(X[1:], X[:-1])]"],"diff_only_import_comment":false,"measured_runtime_v0":0.5113875096,"measured_runtime_v1":0.0366919072,"runtime_lift":13.9373379288,"key":["s768940234","s156149220"]} +{"user_id":"u077291787","problem_id":"p03319","language":"python","submission_id_v0":"s256079667","submission_id_v1":"s586067892","cpu_time_v0":40,"cpu_time_v1":17,"memory_v0":13812,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.5,"input":"# ABC099C - Minimization\n\nfrom math import ceil\n\n\n\nN, K = list(map(int, input().rstrip().split()))\n\n_ = list(map(int, input().rstrip().split()))\n\nprint((1 + ceil((N - K) \/ (K - 1))))","target":"# ARC099C - Minimization\n\nfrom math import ceil\n\n\n\nN, K = list(map(int, input().rstrip().split()))\n\nprint((1 + ceil((N - K) \/ (K - 1))))","code_v0_loc":6,"code_v1_loc":5,"code_v0_num_chars":180,"code_v1_num_chars":134,"code_v0_no_empty_lines":"# ABC099C - Minimization\nfrom math import ceil\n\nN, K = list(map(int, input().rstrip().split()))\n_ = list(map(int, input().rstrip().split()))\nprint((1 + ceil((N - K) \/ (K - 1))))\n","code_v1_no_empty_lines":"# ARC099C - Minimization\nfrom math import ceil\n\nN, K = list(map(int, input().rstrip().split()))\nprint((1 + ceil((N - K) \/ (K - 1))))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-# ABC099C - Minimization","+# ARC099C - Minimization","-_ = list(map(int, input().rstrip().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0392168999,"measured_runtime_v1":0.0392498016,"runtime_lift":0.999161734,"key":["s256079667","s586067892"]} +{"user_id":"u048238198","problem_id":"p03478","language":"python","submission_id_v0":"s611433100","submission_id_v1":"s907874457","cpu_time_v0":1524,"cpu_time_v1":38,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":97.51,"input":"n,a,b = list(map(int,input().split()))\n\nans = 0\n\n\n\nfor i in range(n+1):\n\n keta_wa = 0\n\n x = i\n\n while x != 0:\n\n keta_wa += int(x % 10)\n\n x \/= 10\n\n #print(keta_wa,x)\n\n \n\n if a <= keta_wa <= b:\n\n ans += i \n\n\n\nprint(ans)","target":"n,a,b = list(map(int,input().split()))\n\nans = 0\n\n\n\nfor i in range(n+1):\n\n keta_wa = 0\n\n x = i\n\n while x != 0:\n\n keta_wa += int(x % 10)\n\n x = int(x \/10)\n\n #print(keta_wa,x)\n\n \n\n if a <= keta_wa <= b:\n\n ans += i \n\n\n\nprint(ans)","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":254,"code_v1_num_chars":261,"code_v0_no_empty_lines":"n, a, b = list(map(int, input().split()))\nans = 0\nfor i in range(n + 1):\n keta_wa = 0\n x = i\n while x != 0:\n keta_wa += int(x % 10)\n x \/= 10\n # print(keta_wa,x)\n if a <= keta_wa <= b:\n ans += i\nprint(ans)\n","code_v1_no_empty_lines":"n, a, b = list(map(int, input().split()))\nans = 0\nfor i in range(n + 1):\n keta_wa = 0\n x = i\n while x != 0:\n keta_wa += int(x % 10)\n x = int(x \/ 10)\n # print(keta_wa,x)\n if a <= keta_wa <= b:\n ans += i\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- x \/= 10","+ x = int(x \/ 10)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1136601982,"measured_runtime_v1":0.0354564629,"runtime_lift":3.205627099,"key":["s611433100","s907874457"]} +{"user_id":"u537976628","problem_id":"p03470","language":"python","submission_id_v0":"s297202930","submission_id_v1":"s930179094","cpu_time_v0":32,"cpu_time_v1":28,"memory_v0":9124,"memory_v1":9060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"n = int(eval(input()))\n\nD = set(int(eval(input())) for _ in range(n))\n\nprint((len(D)))","target":"n = int(eval(input()))\n\nprint((len(set(eval(input()) for _ in range(n)))))","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":72,"code_v1_num_chars":60,"code_v0_no_empty_lines":"n = int(eval(input()))\nD = set(int(eval(input())) for _ in range(n))\nprint((len(D)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nprint((len(set(eval(input()) for _ in range(n)))))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-D = set(int(eval(input())) for _ in range(n))","-print((len(D)))","+print((len(set(eval(input()) for _ in range(n)))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0449590282,"measured_runtime_v1":0.0483347311,"runtime_lift":0.9301598914,"key":["s297202930","s930179094"]} +{"user_id":"u114366889","problem_id":"p03161","language":"python","submission_id_v0":"s635435514","submission_id_v1":"s278593254","cpu_time_v0":1974,"cpu_time_v1":403,"memory_v0":22824,"memory_v1":54752,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":79.58,"input":"import numpy as np\n\n\n\nN,K = list(map(int, input().split()))\n\nh = np.array(list(map(int, input().split())))\n\ndp = np.full(N,10**10)\n\ndp[0] = 0\n\nfor i in range(1,N):\n\n start = max(0,i-K)\n\n dp[i] = np.min(dp[start:i]+np.abs(h[i]-h[start:i]))\n\nprint((int(dp[-1])))\n","target":"N,K = list(map(int, input().split()))\n\nh = list(map(int, input().split()))\n\n\n\nINF = float('inf')\n\ndp = [INF] * (N)\n\ndp[0] = 0\n\n\n\nfor i in range(1,N):\n\n cost = INF\n\n for j in range(max(0,i-K),i):\n\n # print(h[j],':',h[i])\n\n dp[i] = min(dp[i], dp[j]+abs(h[j]-h[i]))\n\n # print(dp)\n\nprint((dp[-1]))\n","code_v0_loc":10,"code_v1_loc":14,"code_v0_num_chars":259,"code_v1_num_chars":309,"code_v0_no_empty_lines":"import numpy as np\n\nN, K = list(map(int, input().split()))\nh = np.array(list(map(int, input().split())))\ndp = np.full(N, 10**10)\ndp[0] = 0\nfor i in range(1, N):\n start = max(0, i - K)\n dp[i] = np.min(dp[start:i] + np.abs(h[i] - h[start:i]))\nprint((int(dp[-1])))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nh = list(map(int, input().split()))\nINF = float(\"inf\")\ndp = [INF] * (N)\ndp[0] = 0\nfor i in range(1, N):\n cost = INF\n for j in range(max(0, i - K), i):\n # print(h[j],':',h[i])\n dp[i] = min(dp[i], dp[j] + abs(h[j] - h[i]))\n # print(dp)\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-import numpy as np","-","-h = np.array(list(map(int, input().split())))","-dp = np.full(N, 10**10)","+h = list(map(int, input().split()))","+INF = float(\"inf\")","+dp = [INF] * (N)","- start = max(0, i - K)","- dp[i] = np.min(dp[start:i] + np.abs(h[i] - h[start:i]))","-print((int(dp[-1])))","+ cost = INF","+ for j in range(max(0, i - K), i):","+ # print(h[j],':',h[i])","+ dp[i] = min(dp[i], dp[j] + abs(h[j] - h[i]))","+ # print(dp)","+print((dp[-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":1.2200977058,"measured_runtime_v1":0.0354037781,"runtime_lift":34.4623588723,"key":["s635435514","s278593254"]} +{"user_id":"u866769581","problem_id":"p03038","language":"python","submission_id_v0":"s489781457","submission_id_v1":"s399931235","cpu_time_v0":582,"cpu_time_v1":483,"memory_v0":43336,"memory_v1":23260,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.01,"input":"n,m = list(map(int,input().split()))\n\nalis = list(map(int,input().split()))\n\nlis = [list(map(int,input().split())) for x in range(m)]\n\nfor x in alis:\n\n lis.append([1,x])\n\nlis.sort(reverse=True,key=lambda x:x[1])\n\nans = 0\n\nfor x in lis:\n\n (number,point) = x\n\n if number >= n:\n\n number = n\n\n ans += number * point\n\n #print(n)\n\n #print(ans,'+=',number,'*',point)\n\n break\n\n ans += number * point\n\n n -= number\n\n #print(n)\n\n #print(ans,'+=',number,'*',point)\n\nprint(ans)\n\n#print(lis)\n","target":"n,m = list(map(int,input().split()))\n\nalis = sorted(list(map(int,input().split())))\n\nBC = []\n\nclis = []\n\n\n\nfor x in range(m):\n\n b,c = list(map(int,input().split()))\n\n BC.append((b,c))\n\nBC = sorted(BC,reverse=True,key=lambda x:x[1])\n\nbk_flg = 1\n\nfor b,c in BC:\n\n for x in range(b):\n\n if len(clis) > n:\n\n bk_flg = 0\n\n break\n\n clis.append(c)\n\n if bk_flg == 0:break;\n\n\n\nfor i in range(min(len(clis),n)):\n\n if alis[i] < clis[i]:\n\n alis[i] = clis[i]\n\nprint((sum(alis)))\n","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":529,"code_v1_num_chars":508,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nalis = list(map(int, input().split()))\nlis = [list(map(int, input().split())) for x in range(m)]\nfor x in alis:\n lis.append([1, x])\nlis.sort(reverse=True, key=lambda x: x[1])\nans = 0\nfor x in lis:\n (number, point) = x\n if number >= n:\n number = n\n ans += number * point\n # print(n)\n # print(ans,'+=',number,'*',point)\n break\n ans += number * point\n n -= number\n # print(n)\n # print(ans,'+=',number,'*',point)\nprint(ans)\n# print(lis)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nalis = sorted(list(map(int, input().split())))\nBC = []\nclis = []\nfor x in range(m):\n b, c = list(map(int, input().split()))\n BC.append((b, c))\nBC = sorted(BC, reverse=True, key=lambda x: x[1])\nbk_flg = 1\nfor b, c in BC:\n for x in range(b):\n if len(clis) > n:\n bk_flg = 0\n break\n clis.append(c)\n if bk_flg == 0:\n break\nfor i in range(min(len(clis), n)):\n if alis[i] < clis[i]:\n alis[i] = clis[i]\nprint((sum(alis)))\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-alis = list(map(int, input().split()))","-lis = [list(map(int, input().split())) for x in range(m)]","-for x in alis:","- lis.append([1, x])","-lis.sort(reverse=True, key=lambda x: x[1])","-ans = 0","-for x in lis:","- (number, point) = x","- if number >= n:","- number = n","- ans += number * point","- # print(n)","- # print(ans,'+=',number,'*',point)","+alis = sorted(list(map(int, input().split())))","+BC = []","+clis = []","+for x in range(m):","+ b, c = list(map(int, input().split()))","+ BC.append((b, c))","+BC = sorted(BC, reverse=True, key=lambda x: x[1])","+bk_flg = 1","+for b, c in BC:","+ for x in range(b):","+ if len(clis) > n:","+ bk_flg = 0","+ break","+ clis.append(c)","+ if bk_flg == 0:","- ans += number * point","- n -= number","- # print(n)","- # print(ans,'+=',number,'*',point)","-print(ans)","-# print(lis)","+for i in range(min(len(clis), n)):","+ if alis[i] < clis[i]:","+ alis[i] = clis[i]","+print((sum(alis)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0385991249,"measured_runtime_v1":0.0379668581,"runtime_lift":1.0166531228,"key":["s489781457","s399931235"]} +{"user_id":"u209989098","problem_id":"p02317","language":"python","submission_id_v0":"s628792652","submission_id_v1":"s871864446","cpu_time_v0":340,"cpu_time_v1":280,"memory_v0":11144,"memory_v1":11140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.65,"input":"import bisect\n\nN = int(eval(input()))\n\nA = [int(eval(input())) for _ in range(N)]\n\nL = [A[0]]\n\nfor a in A[1:]:\n\n if L[-1] < a:\n\n L.append(a)\n\n else:\n\n L[bisect.bisect_left(L, a)] = a\n\nprint((len(L)))\n","target":"import bisect\n\na = int(eval(input()))\n\nb = [int(eval(input())) for d in range(a)]\n\nc = [b[0]]\n\nfor i in b[1:]:\n\n if c[-1] < i:\n\n c.append(i)\n\n else:\n\n c[bisect.bisect_left(c,i)] = i\n\n \n\nprint((len(c)))\n","code_v0_loc":10,"code_v1_loc":11,"code_v0_num_chars":206,"code_v1_num_chars":215,"code_v0_no_empty_lines":"import bisect\n\nN = int(eval(input()))\nA = [int(eval(input())) for _ in range(N)]\nL = [A[0]]\nfor a in A[1:]:\n if L[-1] < a:\n L.append(a)\n else:\n L[bisect.bisect_left(L, a)] = a\nprint((len(L)))\n","code_v1_no_empty_lines":"import bisect\n\na = int(eval(input()))\nb = [int(eval(input())) for d in range(a)]\nc = [b[0]]\nfor i in b[1:]:\n if c[-1] < i:\n c.append(i)\n else:\n c[bisect.bisect_left(c, i)] = i\nprint((len(c)))\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-N = int(eval(input()))","-A = [int(eval(input())) for _ in range(N)]","-L = [A[0]]","-for a in A[1:]:","- if L[-1] < a:","- L.append(a)","+a = int(eval(input()))","+b = [int(eval(input())) for d in range(a)]","+c = [b[0]]","+for i in b[1:]:","+ if c[-1] < i:","+ c.append(i)","- L[bisect.bisect_left(L, a)] = a","-print((len(L)))","+ c[bisect.bisect_left(c, i)] = i","+print((len(c)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.048407654,"measured_runtime_v1":0.0429157883,"runtime_lift":1.1279684199,"key":["s628792652","s871864446"]} +{"user_id":"u936985471","problem_id":"p02762","language":"python","submission_id_v0":"s852140637","submission_id_v1":"s073516051","cpu_time_v0":1536,"cpu_time_v1":1194,"memory_v0":124292,"memory_v1":55640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.27,"input":"# UnionFind\u3067\u3064\u306a\u3052\u3066\u3044\u304f\n\n# [\u6240\u5c5e\u3059\u308b\u6728\u306e\u9802\u70b9\u6570]-[1\uff08\u81ea\u5206\uff09]-[\u81ea\u5206\u3068\u30d6\u30ed\u30c3\u30af\u95a2\u4fc2\u306b\u3042\u308b\u4eba\u306e\u6570]\n\n\n\n# UnionFind\n\nclass UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n \n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n \n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n \n\n if x == y:\n\n return\n\n \n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n \n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n \n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n \n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n \n\n def members(self, x):\n\n root = self.find(x)\n\n return [i for i in range(self.n) if self.find(i) == root]\n\n \n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n \n\n def group_count(self):\n\n return len(self.roots())\n\n \n\n def all_group_members(self):\n\n return {r: self.members(r) for r in self.roots()}\n\n \n\n def __str__(self):\n\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\n \n\n def show_parents(self):\n\n print((self.parents))\n\n\n\n# \u3053\u3053\u307e\u3067UnionFind\n\nN,M,K=list(map(int,input().split()))\n\n\n\nUF=UnionFind(N)\n\nfrom collections import defaultdict\n\ndic=defaultdict(set)\n\nfriends=[0]*N\n\nfor i in range(M):\n\n a,b=list(map(int,input().split()))\n\n UF.union(a-1,b-1)\n\n friends[a-1]+=1\n\n friends[b-1]+=1\n\n\n\nfor i in range(N):\n\n dic[UF.find(i)].add(i)\n\n\n\nblock=defaultdict(set)\n\nfor i in range(K):\n\n c,d=list(map(int,input().split()))\n\n block[c-1].add(d-1)\n\n block[d-1].add(c-1)\n\n\n\n# UF.show_parents()\n\n# \u540c\u3058\u6728\u306b\u6240\u5c5e\u3059\u308b\u4eba\u6570\u306e\u3046\u3061\u3001\u30d6\u30ed\u30c3\u30af\u95a2\u4fc2\u306b\u306a\u3044\u4eba\u6570\n\nans=[0]*N\n\nfor i in range(N):\n\n candi=dic[UF.find(i)]\n\n #print(\"i\",candi,\"block\",block[i])\n\n ans[i]=len(candi)-friends[i]-1\n\n for b in block[i]:\n\n if UF.same(i,b):\n\n ans[i]-=1\n\n if ans[i]<0:\n\n ans[i]=0\n\nprint((*ans))\n","target":"import sys\n\nread=sys.stdin.buffer.read\n\nreadline=sys.stdin.readline\n\nreadlines=sys.stdin.buffer.readlines\n\n\n\n# 0-indexed\n\nclass UnionFind:\n\n N=0\n\n parent=None\n\n size=None\n\n def __init__(self,N):\n\n self.N=N\n\n self.parent=[i for i in range(self.N)]\n\n self.size=[1]*self.N\n\n \n\n def root(self,x):\n\n while x!=self.parent[x]:\n\n self.parent[x]=self.parent[self.parent[x]]\n\n x=self.parent[x]\n\n return x\n\n \n\n def same(self,x,y):\n\n return self.root(x)==self.root(y)\n\n \n\n def unite(self,x,y):\n\n x=self.root(x)\n\n y=self.root(y)\n\n if x==y:\n\n return\n\n if self.size[x]>self.size[y]:\n\n # \u5927\u304d\u3044\u65b9\u306b\u304f\u3063\u3064\u3051\u308b\n\n self.parent[y]=x\n\n self.size[x]+=self.size[y]\n\n else:\n\n self.parent[x]=y\n\n self.size[y]+=self.size[x]\n\n \n\n def get_group_size(self,x):\n\n return self.size[self.root(x)]\n\n \n\n def get_roots(self):\n\n r=set()\n\n for i in range(self.N):\n\n r.add(root(i))\n\n return r\n\n \n\n def show_parent(self):\n\n print((self.parent))\n\n \n\n def show_size(self):\n\n print((self.size))\n\n \n\nN,M,K=list(map(int,readline().split()))\n\nUF=UnionFind(N)\n\nfriends=[0]*N\n\nfor i in range(M):\n\n a,b=list(map(int,readline().split()))\n\n UF.unite(a-1,b-1)\n\n friends[a-1]+=1\n\n friends[b-1]+=1\n\n\n\nfrom collections import defaultdict\n\nblock=defaultdict(set)\n\nfor i in range(K):\n\n c,d=list(map(int,readline().split()))\n\n block[c-1].add(d-1)\n\n block[d-1].add(c-1)\n\n\n\nans=[0]*N\n\nfor i in range(N):\n\n ans[i]=UF.get_group_size(i)-friends[i]-1\n\n for b in block[i]:\n\n if UF.same(i,b):\n\n ans[i]-=1\n\n if ans[i]<0:\n\n ans[i]=0\n\nprint((*ans))","code_v0_loc":89,"code_v1_loc":77,"code_v0_num_chars":2052,"code_v1_num_chars":1590,"code_v0_no_empty_lines":"# UnionFind\u3067\u3064\u306a\u3052\u3066\u3044\u304f\n# [\u6240\u5c5e\u3059\u308b\u6728\u306e\u9802\u70b9\u6570]-[1\uff08\u81ea\u5206\uff09]-[\u81ea\u5206\u3068\u30d6\u30ed\u30c3\u30af\u95a2\u4fc2\u306b\u3042\u308b\u4eba\u306e\u6570]\n# UnionFind\nclass UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())\n\n def show_parents(self):\n print((self.parents))\n\n\n# \u3053\u3053\u307e\u3067UnionFind\nN, M, K = list(map(int, input().split()))\nUF = UnionFind(N)\nfrom collections import defaultdict\n\ndic = defaultdict(set)\nfriends = [0] * N\nfor i in range(M):\n a, b = list(map(int, input().split()))\n UF.union(a - 1, b - 1)\n friends[a - 1] += 1\n friends[b - 1] += 1\nfor i in range(N):\n dic[UF.find(i)].add(i)\nblock = defaultdict(set)\nfor i in range(K):\n c, d = list(map(int, input().split()))\n block[c - 1].add(d - 1)\n block[d - 1].add(c - 1)\n# UF.show_parents()\n# \u540c\u3058\u6728\u306b\u6240\u5c5e\u3059\u308b\u4eba\u6570\u306e\u3046\u3061\u3001\u30d6\u30ed\u30c3\u30af\u95a2\u4fc2\u306b\u306a\u3044\u4eba\u6570\nans = [0] * N\nfor i in range(N):\n candi = dic[UF.find(i)]\n # print(\"i\",candi,\"block\",block[i])\n ans[i] = len(candi) - friends[i] - 1\n for b in block[i]:\n if UF.same(i, b):\n ans[i] -= 1\n if ans[i] < 0:\n ans[i] = 0\nprint((*ans))\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.buffer.readlines\n# 0-indexed\nclass UnionFind:\n N = 0\n parent = None\n size = None\n\n def __init__(self, N):\n self.N = N\n self.parent = [i for i in range(self.N)]\n self.size = [1] * self.N\n\n def root(self, x):\n while x != self.parent[x]:\n self.parent[x] = self.parent[self.parent[x]]\n x = self.parent[x]\n return x\n\n def same(self, x, y):\n return self.root(x) == self.root(y)\n\n def unite(self, x, y):\n x = self.root(x)\n y = self.root(y)\n if x == y:\n return\n if self.size[x] > self.size[y]:\n # \u5927\u304d\u3044\u65b9\u306b\u304f\u3063\u3064\u3051\u308b\n self.parent[y] = x\n self.size[x] += self.size[y]\n else:\n self.parent[x] = y\n self.size[y] += self.size[x]\n\n def get_group_size(self, x):\n return self.size[self.root(x)]\n\n def get_roots(self):\n r = set()\n for i in range(self.N):\n r.add(root(i))\n return r\n\n def show_parent(self):\n print((self.parent))\n\n def show_size(self):\n print((self.size))\n\n\nN, M, K = list(map(int, readline().split()))\nUF = UnionFind(N)\nfriends = [0] * N\nfor i in range(M):\n a, b = list(map(int, readline().split()))\n UF.unite(a - 1, b - 1)\n friends[a - 1] += 1\n friends[b - 1] += 1\nfrom collections import defaultdict\n\nblock = defaultdict(set)\nfor i in range(K):\n c, d = list(map(int, readline().split()))\n block[c - 1].add(d - 1)\n block[d - 1].add(c - 1)\nans = [0] * N\nfor i in range(N):\n ans[i] = UF.get_group_size(i) - friends[i] - 1\n for b in block[i]:\n if UF.same(i, b):\n ans[i] -= 1\n if ans[i] < 0:\n ans[i] = 0\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":13.4831460674,"diff":["-# UnionFind\u3067\u3064\u306a\u3052\u3066\u3044\u304f","-# [\u6240\u5c5e\u3059\u308b\u6728\u306e\u9802\u70b9\u6570]-[1\uff08\u81ea\u5206\uff09]-[\u81ea\u5206\u3068\u30d6\u30ed\u30c3\u30af\u95a2\u4fc2\u306b\u3042\u308b\u4eba\u306e\u6570]","-# UnionFind","+import sys","+","+read = sys.stdin.buffer.read","+readline = sys.stdin.readline","+readlines = sys.stdin.buffer.readlines","+# 0-indexed","- def __init__(self, n):","- self.n = n","- self.parents = [-1] * n","+ N = 0","+ parent = None","+ size = None","- def find(self, x):","- if self.parents[x] < 0:","- return x","- else:","- self.parents[x] = self.find(self.parents[x])","- return self.parents[x]","+ def __init__(self, N):","+ self.N = N","+ self.parent = [i for i in range(self.N)]","+ self.size = [1] * self.N","- def union(self, x, y):","- x = self.find(x)","- y = self.find(y)","+ def root(self, x):","+ while x != self.parent[x]:","+ self.parent[x] = self.parent[self.parent[x]]","+ x = self.parent[x]","+ return x","+","+ def same(self, x, y):","+ return self.root(x) == self.root(y)","+","+ def unite(self, x, y):","+ x = self.root(x)","+ y = self.root(y)","- if self.parents[x] > self.parents[y]:","- x, y = y, x","- self.parents[x] += self.parents[y]","- self.parents[y] = x","+ if self.size[x] > self.size[y]:","+ # \u5927\u304d\u3044\u65b9\u306b\u304f\u3063\u3064\u3051\u308b","+ self.parent[y] = x","+ self.size[x] += self.size[y]","+ else:","+ self.parent[x] = y","+ self.size[y] += self.size[x]","- def size(self, x):","- return -self.parents[self.find(x)]","+ def get_group_size(self, x):","+ return self.size[self.root(x)]","- def same(self, x, y):","- return self.find(x) == self.find(y)","+ def get_roots(self):","+ r = set()","+ for i in range(self.N):","+ r.add(root(i))","+ return r","- def members(self, x):","- root = self.find(x)","- return [i for i in range(self.n) if self.find(i) == root]","+ def show_parent(self):","+ print((self.parent))","- def roots(self):","- return [i for i, x in enumerate(self.parents) if x < 0]","-","- def group_count(self):","- return len(self.roots())","-","- def all_group_members(self):","- return {r: self.members(r) for r in self.roots()}","-","- def __str__(self):","- return \"\\n\".join(\"{}: {}\".format(r, self.members(r)) for r in self.roots())","-","- def show_parents(self):","- print((self.parents))","+ def show_size(self):","+ print((self.size))","-# \u3053\u3053\u307e\u3067UnionFind","-N, M, K = list(map(int, input().split()))","+N, M, K = list(map(int, readline().split()))","+friends = [0] * N","+for i in range(M):","+ a, b = list(map(int, readline().split()))","+ UF.unite(a - 1, b - 1)","+ friends[a - 1] += 1","+ friends[b - 1] += 1","-dic = defaultdict(set)","-friends = [0] * N","-for i in range(M):","- a, b = list(map(int, input().split()))","- UF.union(a - 1, b - 1)","- friends[a - 1] += 1","- friends[b - 1] += 1","-for i in range(N):","- dic[UF.find(i)].add(i)","- c, d = list(map(int, input().split()))","+ c, d = list(map(int, readline().split()))","-# UF.show_parents()","-# \u540c\u3058\u6728\u306b\u6240\u5c5e\u3059\u308b\u4eba\u6570\u306e\u3046\u3061\u3001\u30d6\u30ed\u30c3\u30af\u95a2\u4fc2\u306b\u306a\u3044\u4eba\u6570","- candi = dic[UF.find(i)]","- # print(\"i\",candi,\"block\",block[i])","- ans[i] = len(candi) - friends[i] - 1","+ ans[i] = UF.get_group_size(i) - friends[i] - 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0724869785,"measured_runtime_v1":0.0793643882,"runtime_lift":0.9133438831,"key":["s852140637","s073516051"]} +{"user_id":"u263753244","problem_id":"p03171","language":"python","submission_id_v0":"s449879773","submission_id_v1":"s089016234","cpu_time_v0":1865,"cpu_time_v1":1639,"memory_v0":308360,"memory_v1":307336,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.12,"input":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\ndp=[[float(\"inf\")]*(n+1) for _ in range(n)]\n\nz=0\n\nfor l in range(n):\n\n dp[l][l]=0\n\nfor k in range(1,n+1):\n\n for i in range(n):\n\n j=i+k\n\n if 0<=i<=n-2 and 1<=j<=n:\n\n if (n-(i+j))%2==0: #\u5148\u624b\n\n dp[i][j]=max(dp[i+1][j]+a[i],dp[i][j-1]+a[j-1])\n\n else:\n\n dp[i][j]=min(dp[i+1][j]-a[i],dp[i][j-1]-a[j-1])\n\n elif 0<=i<=n-2 and 0<=j<=n:\n\n dp[i][j]=dp[i+1][j]+a[i]\n\n elif 0<=i<=n-1 and 1<=j<=n:\n\n dp[i][j]=dp[i][j-1]+a[j-1]\n\n else:\n\n z=1\n\n\n\nprint((dp[0][n]))","target":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\ndp=[[float(\"inf\")]*(n+1) for _ in range(n)]\n\nz=0\n\nfor l in range(n):\n\n dp[l][l]=0\n\nfor k in range(1,n+1):\n\n for i in range(n-k+1):\n\n j=i+k\n\n if 0<=i<=n-2 and 1<=j<=n:\n\n if (n-(i+j))%2==0: #\u5148\u624b\n\n dp[i][j]=max(dp[i+1][j]+a[i],dp[i][j-1]+a[j-1])\n\n else:\n\n dp[i][j]=min(dp[i+1][j]-a[i],dp[i][j-1]-a[j-1])\n\n else:\n\n dp[i][j]=dp[i][j-1]+a[j-1]\n\nprint((dp[0][n]))","code_v0_loc":22,"code_v1_loc":17,"code_v0_num_chars":620,"code_v1_num_chars":493,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\ndp = [[float(\"inf\")] * (n + 1) for _ in range(n)]\nz = 0\nfor l in range(n):\n dp[l][l] = 0\nfor k in range(1, n + 1):\n for i in range(n):\n j = i + k\n if 0 <= i <= n - 2 and 1 <= j <= n:\n if (n - (i + j)) % 2 == 0: # \u5148\u624b\n dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j - 1])\n else:\n dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j - 1])\n elif 0 <= i <= n - 2 and 0 <= j <= n:\n dp[i][j] = dp[i + 1][j] + a[i]\n elif 0 <= i <= n - 1 and 1 <= j <= n:\n dp[i][j] = dp[i][j - 1] + a[j - 1]\n else:\n z = 1\nprint((dp[0][n]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\ndp = [[float(\"inf\")] * (n + 1) for _ in range(n)]\nz = 0\nfor l in range(n):\n dp[l][l] = 0\nfor k in range(1, n + 1):\n for i in range(n - k + 1):\n j = i + k\n if 0 <= i <= n - 2 and 1 <= j <= n:\n if (n - (i + j)) % 2 == 0: # \u5148\u624b\n dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j - 1])\n else:\n dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j - 1])\n else:\n dp[i][j] = dp[i][j - 1] + a[j - 1]\nprint((dp[0][n]))\n","code_same":false,"relative_loc_diff_percent":22.7272727273,"diff":["- for i in range(n):","+ for i in range(n - k + 1):","- elif 0 <= i <= n - 2 and 0 <= j <= n:","- dp[i][j] = dp[i + 1][j] + a[i]","- elif 0 <= i <= n - 1 and 1 <= j <= n:","+ else:","- else:","- z = 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0385557857,"measured_runtime_v1":0.0385921695,"runtime_lift":0.9990572213,"key":["s449879773","s089016234"]} +{"user_id":"u305125957","problem_id":"p02627","language":"python","submission_id_v0":"s388950313","submission_id_v1":"s045992139","cpu_time_v0":102,"cpu_time_v1":82,"memory_v0":61548,"memory_v1":61572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.61,"input":"ch = eval(input())\n\nprint(('A' if 65<=ord(ch)<=91 else 'a'))\n","target":"print(('A' if 65<=ord(eval(input()))<=91 else 'a'))\n","code_v0_loc":2,"code_v1_loc":1,"code_v0_num_chars":53,"code_v1_num_chars":44,"code_v0_no_empty_lines":"ch = eval(input())\nprint((\"A\" if 65 <= ord(ch) <= 91 else \"a\"))\n","code_v1_no_empty_lines":"print((\"A\" if 65 <= ord(eval(input())) <= 91 else \"a\"))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-ch = eval(input())","-print((\"A\" if 65 <= ord(ch) <= 91 else \"a\"))","+print((\"A\" if 65 <= ord(eval(input())) <= 91 else \"a\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0453574897,"measured_runtime_v1":0.0409502676,"runtime_lift":1.1076237679,"key":["s388950313","s045992139"]} +{"user_id":"u434630332","problem_id":"p02657","language":"python","submission_id_v0":"s668073582","submission_id_v1":"s046025340","cpu_time_v0":29,"cpu_time_v1":24,"memory_v0":9076,"memory_v1":9140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.24,"input":"a, b = list(map(int, input().split()))\n\nanser = a * b\n\nprint(anser)","target":"# \u5165\u529b\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u6271\u3048\u308b\u3088\u3046\u306b\u53d7\u3051\u53d6\u308b\u3053\u3068\n\na, b = list(map(int, input().split()))\n\n# print(a, b)\n\n \n\n# \u53d7\u3051\u53d6\u3063\u305f\u5165\u529b\u5024\u3092\u4f7f\u3044\u3001\u9069\u5207\u306b\u51e6\u7406\uff08\u8a08\u7b97\uff09\u3059\u308b\n\nanswer = a * b\n\n \n\n# \u8a08\u7b97\u3057\u305f\u7d50\u679c\u3092\u51fa\u529b\u3059\u308b\n\nprint(answer)","code_v0_loc":3,"code_v1_loc":9,"code_v0_num_chars":61,"code_v1_num_chars":151,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nanser = a * b\nprint(anser)\n","code_v1_no_empty_lines":"# \u5165\u529b\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u6271\u3048\u308b\u3088\u3046\u306b\u53d7\u3051\u53d6\u308b\u3053\u3068\na, b = list(map(int, input().split()))\n# print(a, b)\n# \u53d7\u3051\u53d6\u3063\u305f\u5165\u529b\u5024\u3092\u4f7f\u3044\u3001\u9069\u5207\u306b\u51e6\u7406\uff08\u8a08\u7b97\uff09\u3059\u308b\nanswer = a * b\n# \u8a08\u7b97\u3057\u305f\u7d50\u679c\u3092\u51fa\u529b\u3059\u308b\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["+# \u5165\u529b\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u6271\u3048\u308b\u3088\u3046\u306b\u53d7\u3051\u53d6\u308b\u3053\u3068","-anser = a * b","-print(anser)","+# print(a, b)","+# \u53d7\u3051\u53d6\u3063\u305f\u5165\u529b\u5024\u3092\u4f7f\u3044\u3001\u9069\u5207\u306b\u51e6\u7406\uff08\u8a08\u7b97\uff09\u3059\u308b","+answer = a * b","+# \u8a08\u7b97\u3057\u305f\u7d50\u679c\u3092\u51fa\u529b\u3059\u308b","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0361250598,"measured_runtime_v1":0.0444790077,"runtime_lift":0.8121822317,"key":["s668073582","s046025340"]} +{"user_id":"u592248346","problem_id":"p02628","language":"python","submission_id_v0":"s887404422","submission_id_v1":"s741489813","cpu_time_v0":34,"cpu_time_v1":26,"memory_v0":9296,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.53,"input":"x,y = list(map(int,input().split()))\n\nn = sorted(list(map(int,input().split())))\n\nprint((sum(n[:y])))","target":"n,k = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\na.sort()\n\nprint((sum(a[:k])))","code_v0_loc":3,"code_v1_loc":4,"code_v0_num_chars":93,"code_v1_num_chars":95,"code_v0_no_empty_lines":"x, y = list(map(int, input().split()))\nn = sorted(list(map(int, input().split())))\nprint((sum(n[:y])))\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\na = list(map(int, input().split()))\na.sort()\nprint((sum(a[:k])))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-x, y = list(map(int, input().split()))","-n = sorted(list(map(int, input().split())))","-print((sum(n[:y])))","+n, k = list(map(int, input().split()))","+a = list(map(int, input().split()))","+a.sort()","+print((sum(a[:k])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1348592733,"measured_runtime_v1":0.038795353,"runtime_lift":3.4761707977,"key":["s887404422","s741489813"]} +{"user_id":"u315078622","problem_id":"p02889","language":"python","submission_id_v0":"s502394176","submission_id_v1":"s108714358","cpu_time_v0":942,"cpu_time_v1":859,"memory_v0":23340,"memory_v1":24728,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.81,"input":"def io_tmp():\n\n global input\n\n import io, sys\n\n f = io.StringIO(open(0).read())\n\n input = f.readline\n\n\n\nio_tmp()\n\n\n\n\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\n\n\nN, M, L = list(map(int, input().split()))\n\ngraph = [[0] * N for _ in range(N)]\n\nfor _ in range(M):\n\n s, t, w = list(map(int, input().split()))\n\n graph[s-1][t-1] = graph[t-1][s-1] = w\n\ndist = floyd_warshall(graph, directed=False)\n\ngraph = [[0] * N for _ in range(N)]\n\nfor i in range(N):\n\n for j in range(i+1, N):\n\n if dist[i][j] <= L:\n\n graph[i][j] = graph[i][j] = 1\n\ndist = floyd_warshall(graph, directed=False)\n\n\n\nQ = int(eval(input()))\n\nfor _ in range(Q):\n\n s, t = list(map(int, input().split()))\n\n ans = dist[s-1][t-1]\n\n if ans == float(\"inf\"):\n\n print((-1))\n\n else:\n\n print((int(ans - 1)))\n","target":"def io_tmp():\n\n global input\n\n import io\n\n f = io.StringIO(open(0).read())\n\n input = f.readline\n\n\n\nio_tmp()\n\n\n\n\n\nfrom scipy.sparse.csgraph import floyd_warshall\n\n\n\n\n\nN, M, L = map(int, input().split())\n\ngraph = [[0] * N for _ in range(N)]\n\nfor _ in range(M):\n\n s, t, w = map(int, input().split())\n\n graph[s-1][t-1] = graph[t-1][s-1] = w\n\ndist = floyd_warshall(graph, directed=False)\n\ngraph = [[0] * N for _ in range(N)]\n\nfor i in range(N):\n\n for j in range(i+1, N):\n\n if dist[i][j] <= L:\n\n graph[i][j] = graph[i][j] = 1\n\ndist = floyd_warshall(graph, directed=False)\n\n\n\nQ = int(input())\n\nans = []\n\nfor _ in range(Q):\n\n s, t = map(int, input().split())\n\n d = dist[s-1][t-1]\n\n if d == float(\"inf\"):\n\n ans.append(-1)\n\n else:\n\n ans.append(int(d - 1))\n\nprint(*ans, sep='\\n')\n","code_v0_loc":33,"code_v1_loc":35,"code_v0_num_chars":802,"code_v1_num_chars":834,"code_v0_no_empty_lines":"def io_tmp():\n global input\n import io, sys\n\n f = io.StringIO(open(0).read())\n input = f.readline\n\n\nio_tmp()\nfrom scipy.sparse.csgraph import floyd_warshall\n\nN, M, L = list(map(int, input().split()))\ngraph = [[0] * N for _ in range(N)]\nfor _ in range(M):\n s, t, w = list(map(int, input().split()))\n graph[s - 1][t - 1] = graph[t - 1][s - 1] = w\ndist = floyd_warshall(graph, directed=False)\ngraph = [[0] * N for _ in range(N)]\nfor i in range(N):\n for j in range(i + 1, N):\n if dist[i][j] <= L:\n graph[i][j] = graph[i][j] = 1\ndist = floyd_warshall(graph, directed=False)\nQ = int(eval(input()))\nfor _ in range(Q):\n s, t = list(map(int, input().split()))\n ans = dist[s - 1][t - 1]\n if ans == float(\"inf\"):\n print((-1))\n else:\n print((int(ans - 1)))\n","code_v1_no_empty_lines":"def io_tmp():\n global input\n import io\n\n f = io.StringIO(open(0).read())\n input = f.readline\n\n\nio_tmp()\nfrom scipy.sparse.csgraph import floyd_warshall\n\nN, M, L = map(int, input().split())\ngraph = [[0] * N for _ in range(N)]\nfor _ in range(M):\n s, t, w = map(int, input().split())\n graph[s - 1][t - 1] = graph[t - 1][s - 1] = w\ndist = floyd_warshall(graph, directed=False)\ngraph = [[0] * N for _ in range(N)]\nfor i in range(N):\n for j in range(i + 1, N):\n if dist[i][j] <= L:\n graph[i][j] = graph[i][j] = 1\ndist = floyd_warshall(graph, directed=False)\nQ = int(input())\nans = []\nfor _ in range(Q):\n s, t = map(int, input().split())\n d = dist[s - 1][t - 1]\n if d == float(\"inf\"):\n ans.append(-1)\n else:\n ans.append(int(d - 1))\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":5.7142857143,"diff":["- import io, sys","+ import io","-N, M, L = list(map(int, input().split()))","+N, M, L = map(int, input().split())","- s, t, w = list(map(int, input().split()))","+ s, t, w = map(int, input().split())","-Q = int(eval(input()))","+Q = int(input())","+ans = []","- s, t = list(map(int, input().split()))","- ans = dist[s - 1][t - 1]","- if ans == float(\"inf\"):","- print((-1))","+ s, t = map(int, input().split())","+ d = dist[s - 1][t - 1]","+ if d == float(\"inf\"):","+ ans.append(-1)","- print((int(ans - 1)))","+ ans.append(int(d - 1))","+print(*ans, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.3129055343,"measured_runtime_v1":0.3424218054,"runtime_lift":0.9138014266,"key":["s502394176","s108714358"]} +{"user_id":"u729133443","problem_id":"p03076","language":"python","submission_id_v0":"s223587212","submission_id_v1":"s039804275","cpu_time_v0":166,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.76,"input":"a=eval('int(input()),'*5);print((min(~-i%10for i in a)-sum(-i\/\/10*10for i in a)-9))","target":"*a,=list(map(int,open(0)));print((min(~-i%10for i in a)-sum(-i\/\/10*10for i in a)-9))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":81,"code_v1_num_chars":76,"code_v0_no_empty_lines":"a = eval(\"int(input()),\" * 5)\nprint((min(~-i % 10 for i in a) - sum(-i \/\/ 10 * 10 for i in a) - 9))\n","code_v1_no_empty_lines":"(*a,) = list(map(int, open(0)))\nprint((min(~-i % 10 for i in a) - sum(-i \/\/ 10 * 10 for i in a) - 9))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a = eval(\"int(input()),\" * 5)","+(*a,) = list(map(int, open(0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0437555273,"measured_runtime_v1":0.0465187845,"runtime_lift":0.9405991084,"key":["s223587212","s039804275"]} +{"user_id":"u433532588","problem_id":"p03013","language":"python","submission_id_v0":"s338112681","submission_id_v1":"s320236781","cpu_time_v0":450,"cpu_time_v1":68,"memory_v0":460020,"memory_v1":6900,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.89,"input":"\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**6)\n\n##############################\n\n\n\nN, M = list(map(int, input().split()))\n\nA = [0] * M\n\ndp = [-1] * (N+1)\n\n\n\nfor i in range(M):\n\n a = int(eval(input()))\n\n dp[a] = 0\n\n\n\ndp[0] = 1\n\nif dp[1] != 0:\n\n dp[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n if dp[i] != 0:\n\n dp[i] = dp[i-1] + dp[i-2]\n\n\n\nprint((dp[N] % 1000000007))","target":"\n\nimport sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10**6)\n\n##############################\n\n\n\nN, M = list(map(int, input().split()))\n\nA = [0] * M\n\ndp = [-1] * (N+1)\n\n\n\nfor i in range(M):\n\n a = int(eval(input()))\n\n dp[a] = 0\n\n\n\ndp[0] = 1\n\nif dp[1] != 0:\n\n dp[1] = 1\n\n\n\nfor i in range(2, N+1):\n\n if dp[i] != 0:\n\n dp[i] = (dp[i-1] + dp[i-2]) % 1000000007\n\n\n\nprint((dp[N]))\n","code_v0_loc":23,"code_v1_loc":23,"code_v0_num_chars":384,"code_v1_num_chars":387,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\n##############################\nN, M = list(map(int, input().split()))\nA = [0] * M\ndp = [-1] * (N + 1)\nfor i in range(M):\n a = int(eval(input()))\n dp[a] = 0\ndp[0] = 1\nif dp[1] != 0:\n dp[1] = 1\nfor i in range(2, N + 1):\n if dp[i] != 0:\n dp[i] = dp[i - 1] + dp[i - 2]\nprint((dp[N] % 1000000007))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\n##############################\nN, M = list(map(int, input().split()))\nA = [0] * M\ndp = [-1] * (N + 1)\nfor i in range(M):\n a = int(eval(input()))\n dp[a] = 0\ndp[0] = 1\nif dp[1] != 0:\n dp[1] = 1\nfor i in range(2, N + 1):\n if dp[i] != 0:\n dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007\nprint((dp[N]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dp[i] = dp[i - 1] + dp[i - 2]","-print((dp[N] % 1000000007))","+ dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007","+print((dp[N]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0863132608,"measured_runtime_v1":0.04569822,"runtime_lift":1.8887663622,"key":["s338112681","s320236781"]} +{"user_id":"u227082700","problem_id":"p02973","language":"python","submission_id_v0":"s288766241","submission_id_v1":"s420303772","cpu_time_v0":571,"cpu_time_v1":246,"memory_v0":56152,"memory_v1":7068,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.92,"input":"import bisect\n\nn=int(eval(input()))\n\nx=[int(eval(input()))for _ in range(n)]\n\na=[-x[0]]\n\nl=1\n\nfor i in range(1,n):\n\n b=-x[i]\n\n if a[-1]>b:\n\n if a[0]>b:a[0]=b;continue\n\n a[bisect.bisect_right(a,b)]=b\n\n else:a.append(b);l+=1\n\nprint(l)","target":"import bisect;n,a,l=int(eval(input())),[-int(eval(input()))],1\n\nfor i in range(n-1):\n\n b=-int(eval(input()))\n\n if a[-1]>b:a[bisect.bisect_right(a,b)]=b\n\n else:a.append(b);l+=1\n\nprint(l)","code_v0_loc":12,"code_v1_loc":6,"code_v0_num_chars":229,"code_v1_num_chars":170,"code_v0_no_empty_lines":"import bisect\n\nn = int(eval(input()))\nx = [int(eval(input())) for _ in range(n)]\na = [-x[0]]\nl = 1\nfor i in range(1, n):\n b = -x[i]\n if a[-1] > b:\n if a[0] > b:\n a[0] = b\n continue\n a[bisect.bisect_right(a, b)] = b\n else:\n a.append(b)\n l += 1\nprint(l)\n","code_v1_no_empty_lines":"import bisect\n\nn, a, l = int(eval(input())), [-int(eval(input()))], 1\nfor i in range(n - 1):\n b = -int(eval(input()))\n if a[-1] > b:\n a[bisect.bisect_right(a, b)] = b\n else:\n a.append(b)\n l += 1\nprint(l)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-n = int(eval(input()))","-x = [int(eval(input())) for _ in range(n)]","-a = [-x[0]]","-l = 1","-for i in range(1, n):","- b = -x[i]","+n, a, l = int(eval(input())), [-int(eval(input()))], 1","+for i in range(n - 1):","+ b = -int(eval(input()))","- if a[0] > b:","- a[0] = b","- continue"],"diff_only_import_comment":false,"measured_runtime_v0":0.045958516,"measured_runtime_v1":0.0390089472,"runtime_lift":1.1781532011,"key":["s288766241","s420303772"]} +{"user_id":"u083960235","problem_id":"p02947","language":"python","submission_id_v0":"s720645333","submission_id_v1":"s217758042","cpu_time_v0":771,"cpu_time_v1":315,"memory_v0":31444,"memory_v1":25716,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.14,"input":"import sys, re, os\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import permutations, combinations, product, accumulate\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom fractions import gcd\n\n \n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef S_MAP(): return list(map(str, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef S_LIST(): return list(map(str, input().split()))\n\n\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nn = INT()\n\ns = []\n\nfor i in range(n):\n\n m = list(eval(input()))\n\n m.sort()\n\n s.append(m)\n\ns.sort()\n\n# print(s)\n\n# print(s)\n\ncount = 0\n\nren = 1\n\nr = []\n\nrsum = [0] * n\n\nfor i in range(n-1):\n\n if s[i] == s[i+1]:\n\n count += 1\n\n ren += 1\n\n # print(ren)\n\n rsum[i+1] +=rsum[i]+1\n\n else:\n\n r.append(ren)\n\n ren = 1\n\n # print(ren)\n\nr.append(ren)\n\n \n\nfor i in range(n):\n\n rsum[i] = rsum[i] + 1\n\n \n\n\n\ndef P(n, r):\n\n return factorial(n)\/\/factorial(n-r)\n\n\n\ndef C(n, r):\n\n return P(n, r)\/\/factorial(r)\n\n# print(r)\n\n\n\n# print(count)\n\n# print(\"rsum:\", rsum)\n\nb = []\n\nrsum.append(1)\n\n\n\nfor i in range(n):\n\n if rsum[i]>rsum[i+1]:\n\n b.append(rsum[i])\n\n # continue\n\n # else:\n\n # print(rsum[i+1])\n\n # b.append(rsum[i+1])\n\n# print(\"b\", b)\n\ncount2 = 0\n\nfor i in b:\n\n # print(i)\n\n # print(C(i,2))\n\n count2 += C(i, 2)\n\nprint(count2)\n\n # if b[i]>=3:\n\n\n\n\n\n# for i in range(n):\n\n# for j in range(n):\n\n# # if i != j:\n\n# if i < j:\n\n# # print(s[i])\n\n# # print(s[j])\n\n# if s[i] == s[j]:\n\n# count += 1\n\n# # for i in range(n):\n\n \n\n# print(count)","target":"import sys, re, os\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n\nfrom itertools import permutations, combinations, product, accumulate\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom heapq import heapify, heappop, heappush\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef S_MAP(): return list(map(str, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef S_LIST(): return list(map(str, input().split()))\n\n \n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\nN = INT()\n\nS = [eval(input()) for i in range(N)]\n\n\n\nmemo = defaultdict(int)\n\nL = []\n\nfor i in range(N):\n\n l = list(S[i])\n\n l.sort()\n\n l = \"\".join(l)\n\n memo[str(l)] += 1\n\n# print(memo)\n\nans = 0\n\nfor m in list(memo.values()):\n\n ans += m * (m - 1)\/\/2\n\nprint(ans)\n","code_v0_loc":89,"code_v1_loc":35,"code_v0_num_chars":1930,"code_v1_num_chars":1007,"code_v0_no_empty_lines":"import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef S_MAP():\n return list(map(str, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef S_LIST():\n return list(map(str, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nn = INT()\ns = []\nfor i in range(n):\n m = list(eval(input()))\n m.sort()\n s.append(m)\ns.sort()\n# print(s)\n# print(s)\ncount = 0\nren = 1\nr = []\nrsum = [0] * n\nfor i in range(n - 1):\n if s[i] == s[i + 1]:\n count += 1\n ren += 1\n # print(ren)\n rsum[i + 1] += rsum[i] + 1\n else:\n r.append(ren)\n ren = 1\n # print(ren)\nr.append(ren)\nfor i in range(n):\n rsum[i] = rsum[i] + 1\n\n\ndef P(n, r):\n return factorial(n) \/\/ factorial(n - r)\n\n\ndef C(n, r):\n return P(n, r) \/\/ factorial(r)\n\n\n# print(r)\n# print(count)\n# print(\"rsum:\", rsum)\nb = []\nrsum.append(1)\nfor i in range(n):\n if rsum[i] > rsum[i + 1]:\n b.append(rsum[i])\n # continue\n # else:\n # print(rsum[i+1])\n # b.append(rsum[i+1])\n# print(\"b\", b)\ncount2 = 0\nfor i in b:\n # print(i)\n # print(C(i,2))\n count2 += C(i, 2)\nprint(count2)\n# if b[i]>=3:\n# for i in range(n):\n# for j in range(n):\n# # if i != j:\n# if i < j:\n# # print(s[i])\n# # print(s[j])\n# if s[i] == s[j]:\n# count += 1\n# # for i in range(n):\n# print(count)\n","code_v1_no_empty_lines":"import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom heapq import heapify, heappop, heappush\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef S_MAP():\n return list(map(str, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef S_LIST():\n return list(map(str, input().split()))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nN = INT()\nS = [eval(input()) for i in range(N)]\nmemo = defaultdict(int)\nL = []\nfor i in range(N):\n l = list(S[i])\n l.sort()\n l = \"\".join(l)\n memo[str(l)] += 1\n# print(memo)\nans = 0\nfor m in list(memo.values()):\n ans += m * (m - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":60.6741573034,"diff":["-from fractions import gcd","+from heapq import heapify, heappop, heappush","-n = INT()","-s = []","-for i in range(n):","- m = list(eval(input()))","- m.sort()","- s.append(m)","-s.sort()","-# print(s)","-# print(s)","-count = 0","-ren = 1","-r = []","-rsum = [0] * n","-for i in range(n - 1):","- if s[i] == s[i + 1]:","- count += 1","- ren += 1","- # print(ren)","- rsum[i + 1] += rsum[i] + 1","- else:","- r.append(ren)","- ren = 1","- # print(ren)","-r.append(ren)","-for i in range(n):","- rsum[i] = rsum[i] + 1","-","-","-def P(n, r):","- return factorial(n) \/\/ factorial(n - r)","-","-","-def C(n, r):","- return P(n, r) \/\/ factorial(r)","-","-","-# print(r)","-# print(count)","-# print(\"rsum:\", rsum)","-b = []","-rsum.append(1)","-for i in range(n):","- if rsum[i] > rsum[i + 1]:","- b.append(rsum[i])","- # continue","- # else:","- # print(rsum[i+1])","- # b.append(rsum[i+1])","-# print(\"b\", b)","-count2 = 0","-for i in b:","- # print(i)","- # print(C(i,2))","- count2 += C(i, 2)","-print(count2)","-# if b[i]>=3:","-# for i in range(n):","-# for j in range(n):","-# # if i != j:","-# if i < j:","-# # print(s[i])","-# # print(s[j])","-# if s[i] == s[j]:","-# count += 1","-# # for i in range(n):","-# print(count)","+N = INT()","+S = [eval(input()) for i in range(N)]","+memo = defaultdict(int)","+L = []","+for i in range(N):","+ l = list(S[i])","+ l.sort()","+ l = \"\".join(l)","+ memo[str(l)] += 1","+# print(memo)","+ans = 0","+for m in list(memo.values()):","+ ans += m * (m - 1) \/\/ 2","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0987670028,"measured_runtime_v1":0.0452128818,"runtime_lift":2.1844881118,"key":["s720645333","s217758042"]} +{"user_id":"u911622131","problem_id":"p03835","language":"python","submission_id_v0":"s109855735","submission_id_v1":"s461532993","cpu_time_v0":1169,"cpu_time_v1":27,"memory_v0":9128,"memory_v1":9208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":97.69,"input":"# coding = SJIS\n\n\n\nk, s = list(map(int, input().split()))\n\nans = 0\n\n\n\nfor x in range(0, k + 1):\n\n for y in range(0, k + 1):\n\n z = s - x - y\n\n if 0 <= z and z <= k:\n\n ans += 1\n\n\n\nprint(ans)","target":"# coding = SJIS\n\nk, s = list(map(int, input().split()))\n\nif s < k:\n\n ans = (s + 1) * (s + 2) \/ 2\n\nelif s <= 2 * k:\n\n t = 2 * k - s\n\n ans = ((k + 1) * (k + 2) \/ 2) - ((2 * k - s) * ((2 * k - s) + 1) \/ 2) + (t * (2 * k - ((2 * k - s) - 1)) \/ 2)\n\nelif s <= 3 * k:\n\n ans = (3 * k - s + 1) * ((3 * k - s + 1) + 1) \/ 2\n\nprint((int(ans)))","code_v0_loc":12,"code_v1_loc":10,"code_v0_num_chars":210,"code_v1_num_chars":335,"code_v0_no_empty_lines":"# coding = SJIS\nk, s = list(map(int, input().split()))\nans = 0\nfor x in range(0, k + 1):\n for y in range(0, k + 1):\n z = s - x - y\n if 0 <= z and z <= k:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"# coding = SJIS\nk, s = list(map(int, input().split()))\nif s < k:\n ans = (s + 1) * (s + 2) \/ 2\nelif s <= 2 * k:\n t = 2 * k - s\n ans = (\n ((k + 1) * (k + 2) \/ 2)\n - ((2 * k - s) * ((2 * k - s) + 1) \/ 2)\n + (t * (2 * k - ((2 * k - s) - 1)) \/ 2)\n )\nelif s <= 3 * k:\n ans = (3 * k - s + 1) * ((3 * k - s + 1) + 1) \/ 2\nprint((int(ans)))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-ans = 0","-for x in range(0, k + 1):","- for y in range(0, k + 1):","- z = s - x - y","- if 0 <= z and z <= k:","- ans += 1","-print(ans)","+if s < k:","+ ans = (s + 1) * (s + 2) \/ 2","+elif s <= 2 * k:","+ t = 2 * k - s","+ ans = (","+ ((k + 1) * (k + 2) \/ 2)","+ - ((2 * k - s) * ((2 * k - s) + 1) \/ 2)","+ + (t * (2 * k - ((2 * k - s) - 1)) \/ 2)","+ )","+elif s <= 3 * k:","+ ans = (3 * k - s + 1) * ((3 * k - s + 1) + 1) \/ 2","+print((int(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1146666329,"measured_runtime_v1":0.0344053534,"runtime_lift":3.3328136923,"key":["s109855735","s461532993"]} +{"user_id":"u227082700","problem_id":"p02949","language":"python","submission_id_v0":"s622514139","submission_id_v1":"s446954860","cpu_time_v0":1633,"cpu_time_v1":907,"memory_v0":5404,"memory_v1":54872,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.46,"input":"import sys\n\ninput=sys.stdin.readline\n\nsys.setrecursionlimit(10000000)\n\n\n\ndef find_negative_loop(n,e):\n\n d=n*[10**20];d[0]=0\n\n for h in range(n):\n\n for i,j,k in e:\n\n if d[j]>d[i]+k:\n\n d[j]=d[i]+k\n\n if h==n-1:return -1\n\n return max(-d[n-1],0)\n\n\n\nfrom collections import deque\n\ndef find_loop(n,e,flag):\n\n x=[0]*n\n\n d=deque()\n\n t=[]\n\n c=0\n\n for i in range(n):\n\n for j in e[i]:x[j]+=1\n\n for i in range(n):\n\n if x[i]==0:\n\n d.append(i)\n\n t.append(i)\n\n c+=1\n\n while d:\n\n i=d.popleft()\n\n for j in e[i]:\n\n x[j]-=1\n\n if x[j]==0:\n\n d.append(j)\n\n t.append(j)\n\n c+=1\n\n if flag==0:return c==n\n\n else:return t\n\n\n\ndef glaph_bfs(s,n,e):\n\n ans=[0]*n\n\n Q=[s]\n\n visited={s}\n\n while Q:\n\n P=[]\n\n for i in Q:\n\n ans[i]=1\n\n for j in e[i]:\n\n if j in visited:continue\n\n visited.add(j)\n\n P.append(j)\n\n Q=P\n\n return ans\n\n\n\nn,m,p=list(map(int,input().split()))\n\nef=[[]for _ in range(n)]\n\nee=[[]for _ in range(n)]\n\ne=[]\n\nfor _ in range(m):\n\n a,b,c=list(map(int,input().split()))\n\n a-=1\n\n b-=1\n\n c-=p\n\n ef[a].append(b)\n\n ee[b].append(a)\n\n e.append((a,b,c))\n\neff=glaph_bfs(0,n,ef)\n\neef=glaph_bfs(n-1,n,ee)\n\nee=[]\n\nfor a,b,c in e:\n\n if eff[a]==1 and eef[a]==1 and eff[b]==1 and eef[b]==1:\n\n ee.append((a,b,-c))\n\nprint((find_negative_loop(n,ee)))","target":"#\u30b0\u30e9\u30d5\u4e0a\u3067\u306eBFS\n\n#s=\u59cb\u70b9 n=\u9802\u70b9\u6570 e=\u96a3\u63a5\u30ea\u30b9\u30c8\n\ndef glaph_bfs(s,n,e):\n\n Q=[s]\n\n visited={s}\n\n while Q:\n\n P=[]\n\n for i in Q:\n\n for j,_ in e[i]:\n\n if j in visited:continue\n\n visited.add(j)\n\n P.append(j)\n\n Q=P\n\n return visited\n\n \n\n\n\n#\u8ca0\u306e\u9589\u8def\u691c\u51fa\n\n#n=\u9802\u70b9\u6570 e=[[a,b,c],[]...](a~b\u306e\u8ddd\u96e2\u304cc)\n\ndef find_negative_loop(n,e):\n\n\td=n*[10**20];d[0]=0\n\n\tfor h in range(n):\n\n\t\tfor i,j,k in e:\n\n\t\t\tif d[j]>d[i]+k:\n\n\t\t\t\td[j]=d[i]+k\n\n\t\t\t\tif h==n-1:return True\n\n\treturn False\n\n\n\n#\u30d9\u30eb\u30de\u30f3\u30d5\u30a9\u30fc\u30c9(d[i]=\u9802\u70b9s\u304b\u3089\u9802\u70b9i\u306e\u6700\u77ed\u8ddd\u96e2)\n\n#\u5358\u4e00\u59cb\u70b9\u6700\u77ed\u7d4c\u8def(\u8ca0\u306e\u8fba\u5bfe\u5fdc)\n\n#s=\u59cb\u70b9 n=\u9802\u70b9\u6570 e=[[a,b,c],[]...](a~b\u306e\u8ddd\u96e2\u304cc)\n\ndef bellman_ford(s,n,e):\n\n inf=10**20;d=[inf]*n;d[s]=0\n\n while 1:\n\n f=True\n\n for i,j,k in e:\n\n if d[i]!=inf and d[j]>d[i]+k:d[j]=d[i]+k;f=False\n\n if f:break\n\n return d\n\n\n\nn,m,p=list(map(int,input().split()))\n\nedge=[[]for _ in range(n)]\n\nedger=[[]for _ in range(n)]\n\nfor _ in range(m):\n\n a,b,c=list(map(int,input().split()))\n\n c-=p\n\n a-=1\n\n b-=1\n\n edge[a].append((b,c))\n\n edger[b].append((a,c))\n\nvisited=glaph_bfs(0,n,edge)\n\nvisitedr=glaph_bfs(n-1,n,edger)\n\nfor i in range(n):\n\n if not(i in visited and i in visitedr):edge[i]=[]\n\ne=[]\n\nfor i in range(n):\n\n for j in range(len(edge[i])):e.append((i,edge[i][j][0],-edge[i][j][1]))\n\nif find_negative_loop(n,e):print((-1));exit()\n\nprint((max(-bellman_ford(0,n,e)[n-1],0)))","code_v0_loc":71,"code_v1_loc":58,"code_v0_num_chars":1344,"code_v1_num_chars":1289,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10000000)\n\n\ndef find_negative_loop(n, e):\n d = n * [10**20]\n d[0] = 0\n for h in range(n):\n for i, j, k in e:\n if d[j] > d[i] + k:\n d[j] = d[i] + k\n if h == n - 1:\n return -1\n return max(-d[n - 1], 0)\n\n\nfrom collections import deque\n\n\ndef find_loop(n, e, flag):\n x = [0] * n\n d = deque()\n t = []\n c = 0\n for i in range(n):\n for j in e[i]:\n x[j] += 1\n for i in range(n):\n if x[i] == 0:\n d.append(i)\n t.append(i)\n c += 1\n while d:\n i = d.popleft()\n for j in e[i]:\n x[j] -= 1\n if x[j] == 0:\n d.append(j)\n t.append(j)\n c += 1\n if flag == 0:\n return c == n\n else:\n return t\n\n\ndef glaph_bfs(s, n, e):\n ans = [0] * n\n Q = [s]\n visited = {s}\n while Q:\n P = []\n for i in Q:\n ans[i] = 1\n for j in e[i]:\n if j in visited:\n continue\n visited.add(j)\n P.append(j)\n Q = P\n return ans\n\n\nn, m, p = list(map(int, input().split()))\nef = [[] for _ in range(n)]\nee = [[] for _ in range(n)]\ne = []\nfor _ in range(m):\n a, b, c = list(map(int, input().split()))\n a -= 1\n b -= 1\n c -= p\n ef[a].append(b)\n ee[b].append(a)\n e.append((a, b, c))\neff = glaph_bfs(0, n, ef)\neef = glaph_bfs(n - 1, n, ee)\nee = []\nfor a, b, c in e:\n if eff[a] == 1 and eef[a] == 1 and eff[b] == 1 and eef[b] == 1:\n ee.append((a, b, -c))\nprint((find_negative_loop(n, ee)))\n","code_v1_no_empty_lines":"# \u30b0\u30e9\u30d5\u4e0a\u3067\u306eBFS\n# s=\u59cb\u70b9 n=\u9802\u70b9\u6570 e=\u96a3\u63a5\u30ea\u30b9\u30c8\ndef glaph_bfs(s, n, e):\n Q = [s]\n visited = {s}\n while Q:\n P = []\n for i in Q:\n for j, _ in e[i]:\n if j in visited:\n continue\n visited.add(j)\n P.append(j)\n Q = P\n return visited\n\n\n# \u8ca0\u306e\u9589\u8def\u691c\u51fa\n# n=\u9802\u70b9\u6570 e=[[a,b,c],[]...](a~b\u306e\u8ddd\u96e2\u304cc)\ndef find_negative_loop(n, e):\n d = n * [10**20]\n d[0] = 0\n for h in range(n):\n for i, j, k in e:\n if d[j] > d[i] + k:\n d[j] = d[i] + k\n if h == n - 1:\n return True\n return False\n\n\n# \u30d9\u30eb\u30de\u30f3\u30d5\u30a9\u30fc\u30c9(d[i]=\u9802\u70b9s\u304b\u3089\u9802\u70b9i\u306e\u6700\u77ed\u8ddd\u96e2)\n# \u5358\u4e00\u59cb\u70b9\u6700\u77ed\u7d4c\u8def(\u8ca0\u306e\u8fba\u5bfe\u5fdc)\n# s=\u59cb\u70b9 n=\u9802\u70b9\u6570 e=[[a,b,c],[]...](a~b\u306e\u8ddd\u96e2\u304cc)\ndef bellman_ford(s, n, e):\n inf = 10**20\n d = [inf] * n\n d[s] = 0\n while 1:\n f = True\n for i, j, k in e:\n if d[i] != inf and d[j] > d[i] + k:\n d[j] = d[i] + k\n f = False\n if f:\n break\n return d\n\n\nn, m, p = list(map(int, input().split()))\nedge = [[] for _ in range(n)]\nedger = [[] for _ in range(n)]\nfor _ in range(m):\n a, b, c = list(map(int, input().split()))\n c -= p\n a -= 1\n b -= 1\n edge[a].append((b, c))\n edger[b].append((a, c))\nvisited = glaph_bfs(0, n, edge)\nvisitedr = glaph_bfs(n - 1, n, edger)\nfor i in range(n):\n if not (i in visited and i in visitedr):\n edge[i] = []\ne = []\nfor i in range(n):\n for j in range(len(edge[i])):\n e.append((i, edge[i][j][0], -edge[i][j][1]))\nif find_negative_loop(n, e):\n print((-1))\n exit()\nprint((max(-bellman_ford(0, n, e)[n - 1], 0)))\n","code_same":false,"relative_loc_diff_percent":18.3098591549,"diff":["-import sys","-","-input = sys.stdin.readline","-sys.setrecursionlimit(10000000)","+# \u30b0\u30e9\u30d5\u4e0a\u3067\u306eBFS","+# s=\u59cb\u70b9 n=\u9802\u70b9\u6570 e=\u96a3\u63a5\u30ea\u30b9\u30c8","+def glaph_bfs(s, n, e):","+ Q = [s]","+ visited = {s}","+ while Q:","+ P = []","+ for i in Q:","+ for j, _ in e[i]:","+ if j in visited:","+ continue","+ visited.add(j)","+ P.append(j)","+ Q = P","+ return visited","+# \u8ca0\u306e\u9589\u8def\u691c\u51fa","+# n=\u9802\u70b9\u6570 e=[[a,b,c],[]...](a~b\u306e\u8ddd\u96e2\u304cc)","- return -1","- return max(-d[n - 1], 0)","+ return True","+ return False","-from collections import deque","-","-","-def find_loop(n, e, flag):","- x = [0] * n","- d = deque()","- t = []","- c = 0","- for i in range(n):","- for j in e[i]:","- x[j] += 1","- for i in range(n):","- if x[i] == 0:","- d.append(i)","- t.append(i)","- c += 1","- while d:","- i = d.popleft()","- for j in e[i]:","- x[j] -= 1","- if x[j] == 0:","- d.append(j)","- t.append(j)","- c += 1","- if flag == 0:","- return c == n","- else:","- return t","-","-","-def glaph_bfs(s, n, e):","- ans = [0] * n","- Q = [s]","- visited = {s}","- while Q:","- P = []","- for i in Q:","- ans[i] = 1","- for j in e[i]:","- if j in visited:","- continue","- visited.add(j)","- P.append(j)","- Q = P","- return ans","+# \u30d9\u30eb\u30de\u30f3\u30d5\u30a9\u30fc\u30c9(d[i]=\u9802\u70b9s\u304b\u3089\u9802\u70b9i\u306e\u6700\u77ed\u8ddd\u96e2)","+# \u5358\u4e00\u59cb\u70b9\u6700\u77ed\u7d4c\u8def(\u8ca0\u306e\u8fba\u5bfe\u5fdc)","+# s=\u59cb\u70b9 n=\u9802\u70b9\u6570 e=[[a,b,c],[]...](a~b\u306e\u8ddd\u96e2\u304cc)","+def bellman_ford(s, n, e):","+ inf = 10**20","+ d = [inf] * n","+ d[s] = 0","+ while 1:","+ f = True","+ for i, j, k in e:","+ if d[i] != inf and d[j] > d[i] + k:","+ d[j] = d[i] + k","+ f = False","+ if f:","+ break","+ return d","-ef = [[] for _ in range(n)]","-ee = [[] for _ in range(n)]","-e = []","+edge = [[] for _ in range(n)]","+edger = [[] for _ in range(n)]","+ c -= p","- c -= p","- ef[a].append(b)","- ee[b].append(a)","- e.append((a, b, c))","-eff = glaph_bfs(0, n, ef)","-eef = glaph_bfs(n - 1, n, ee)","-ee = []","-for a, b, c in e:","- if eff[a] == 1 and eef[a] == 1 and eff[b] == 1 and eef[b] == 1:","- ee.append((a, b, -c))","-print((find_negative_loop(n, ee)))","+ edge[a].append((b, c))","+ edger[b].append((a, c))","+visited = glaph_bfs(0, n, edge)","+visitedr = glaph_bfs(n - 1, n, edger)","+for i in range(n):","+ if not (i in visited and i in visitedr):","+ edge[i] = []","+e = []","+for i in range(n):","+ for j in range(len(edge[i])):","+ e.append((i, edge[i][j][0], -edge[i][j][1]))","+if find_negative_loop(n, e):","+ print((-1))","+ exit()","+print((max(-bellman_ford(0, n, e)[n - 1], 0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0780336642,"measured_runtime_v1":0.120862009,"runtime_lift":0.6456426203,"key":["s622514139","s446954860"]} +{"user_id":"u745087332","problem_id":"p03426","language":"python","submission_id_v0":"s248458125","submission_id_v1":"s774256546","cpu_time_v0":544,"cpu_time_v1":477,"memory_v0":39132,"memory_v1":19968,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.32,"input":"# coding:utf-8\n\n\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\n\n\ndef inpl(): return list(map(int, input().split()))\n\n\n\n\n\nH, W, D = inpl()\n\n\n\nnum_coordinate = {}\n\nfor i in range(H):\n\n w = inpl()\n\n for j in range(W):\n\n num_coordinate[w[j]] = (i, j)\n\n\n\nc_sum = {}\n\nfor d in range(1, D + 1):\n\n c_sum[d] = [0]\n\n\n\nfor d in range(1, D + 1):\n\n for n in range(d + D, H * W + 1, D):\n\n c_sum[d].append(c_sum[d][-1] + abs(num_coordinate[n][0] - num_coordinate[n - D][0])\n\n + abs(num_coordinate[n][1] - num_coordinate[n - D][1]))\n\n\n\nQ = int(eval(input()))\n\nfor _ in range(Q):\n\n l, r = inpl()\n\n index = (l - 1) % D + 1\n\n index_l, index_r = (l - 1) \/\/ D, (r - 1) \/\/ D\n\n\n\n print((c_sum[index][index_r] - c_sum[index][index_l]))\n","target":"# coding:utf-8\n\n\n\nimport sys\n\n\n\nINF = float('inf')\n\nMOD = 10 ** 9 + 7\n\n\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\ndef LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]\n\ndef LS(): return sys.stdin.readline().split()\n\ndef II(): return int(sys.stdin.readline())\n\ndef SI(): return eval(input())\n\n\n\n\n\nh, w, d = LI()\n\ncoord = [0] * (h * w)\n\nfor y in range(h):\n\n for x, n in enumerate(LI_()):\n\n coord[n] = (y, x)\n\n\n\nC = [[0] for _ in range(d)]\n\nfor i in range(d, h * w):\n\n diff = abs(coord[i][0] - coord[i - d][0]) + abs(coord[i][1] - coord[i - d][1])\n\n C[i % d].append(C[i % d][-1] + diff)\n\n\n\nq = II()\n\nfor _ in range(q):\n\n l, r = LI_()\n\n n = l % d\n\n print((C[n][r \/\/ d] - C[n][l \/\/ d]))\n","code_v0_loc":36,"code_v1_loc":30,"code_v0_num_chars":803,"code_v1_num_chars":738,"code_v0_no_empty_lines":"# coding:utf-8\nimport sys\n\ninput = sys.stdin.readline\nINF = float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\nH, W, D = inpl()\nnum_coordinate = {}\nfor i in range(H):\n w = inpl()\n for j in range(W):\n num_coordinate[w[j]] = (i, j)\nc_sum = {}\nfor d in range(1, D + 1):\n c_sum[d] = [0]\nfor d in range(1, D + 1):\n for n in range(d + D, H * W + 1, D):\n c_sum[d].append(\n c_sum[d][-1]\n + abs(num_coordinate[n][0] - num_coordinate[n - D][0])\n + abs(num_coordinate[n][1] - num_coordinate[n - D][1])\n )\nQ = int(eval(input()))\nfor _ in range(Q):\n l, r = inpl()\n index = (l - 1) % D + 1\n index_l, index_r = (l - 1) \/\/ D, (r - 1) \/\/ D\n print((c_sum[index][index_r] - c_sum[index][index_l]))\n","code_v1_no_empty_lines":"# coding:utf-8\nimport sys\n\nINF = float(\"inf\")\nMOD = 10**9 + 7\n\n\ndef LI():\n return [int(x) for x in sys.stdin.readline().split()]\n\n\ndef LI_():\n return [int(x) - 1 for x in sys.stdin.readline().split()]\n\n\ndef LS():\n return sys.stdin.readline().split()\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef SI():\n return eval(input())\n\n\nh, w, d = LI()\ncoord = [0] * (h * w)\nfor y in range(h):\n for x, n in enumerate(LI_()):\n coord[n] = (y, x)\nC = [[0] for _ in range(d)]\nfor i in range(d, h * w):\n diff = abs(coord[i][0] - coord[i - d][0]) + abs(coord[i][1] - coord[i - d][1])\n C[i % d].append(C[i % d][-1] + diff)\nq = II()\nfor _ in range(q):\n l, r = LI_()\n n = l % d\n print((C[n][r \/\/ d] - C[n][l \/\/ d]))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-input = sys.stdin.readline","-def inpl():","- return list(map(int, input().split()))","+def LI():","+ return [int(x) for x in sys.stdin.readline().split()]","-H, W, D = inpl()","-num_coordinate = {}","-for i in range(H):","- w = inpl()","- for j in range(W):","- num_coordinate[w[j]] = (i, j)","-c_sum = {}","-for d in range(1, D + 1):","- c_sum[d] = [0]","-for d in range(1, D + 1):","- for n in range(d + D, H * W + 1, D):","- c_sum[d].append(","- c_sum[d][-1]","- + abs(num_coordinate[n][0] - num_coordinate[n - D][0])","- + abs(num_coordinate[n][1] - num_coordinate[n - D][1])","- )","-Q = int(eval(input()))","-for _ in range(Q):","- l, r = inpl()","- index = (l - 1) % D + 1","- index_l, index_r = (l - 1) \/\/ D, (r - 1) \/\/ D","- print((c_sum[index][index_r] - c_sum[index][index_l]))","+def LI_():","+ return [int(x) - 1 for x in sys.stdin.readline().split()]","+","+","+def LS():","+ return sys.stdin.readline().split()","+","+","+def II():","+ return int(sys.stdin.readline())","+","+","+def SI():","+ return eval(input())","+","+","+h, w, d = LI()","+coord = [0] * (h * w)","+for y in range(h):","+ for x, n in enumerate(LI_()):","+ coord[n] = (y, x)","+C = [[0] for _ in range(d)]","+for i in range(d, h * w):","+ diff = abs(coord[i][0] - coord[i - d][0]) + abs(coord[i][1] - coord[i - d][1])","+ C[i % d].append(C[i % d][-1] + diff)","+q = II()","+for _ in range(q):","+ l, r = LI_()","+ n = l % d","+ print((C[n][r \/\/ d] - C[n][l \/\/ d]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0384400272,"measured_runtime_v1":0.0378135488,"runtime_lift":1.0165675649,"key":["s248458125","s774256546"]} +{"user_id":"u075595666","problem_id":"p02821","language":"python","submission_id_v0":"s977653050","submission_id_v1":"s777303050","cpu_time_v0":1162,"cpu_time_v1":936,"memory_v0":12488,"memory_v1":51644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.45,"input":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\nfrom bisect import bisect_left\n\n\n\nn,m = list(map(int,readline().split()))\n\na = list(map(int,readline().split()))\n\n\n\nb = [0]*(n+1)\n\na.sort()\n\nfor i in range(n):\n\n b[i+1] = b[i]+a[i]\n\n\n\ndef is_ok(arg):\n\n c = 0\n\n f = False\n\n for i in a:\n\n if c >= m:\n\n break\n\n c += (n-bisect_left(a,arg-i))\n\n if c >= m:\n\n f = True\n\n return f\n\n\n\ndef bisect_ok(ng, ok):\n\n while (abs(ok - ng) > 1):\n\n mid = (ok + ng) \/\/ 2\n\n if is_ok(mid):\n\n ok = mid\n\n else:\n\n ng = mid\n\n return ok\n\n\n\nx = bisect_ok(2*a[-1]+1,1)\n\nans = 0\n\ncnt = 0\n\nfor i in a:\n\n ind = n-bisect_left(a,x-i)\n\n cnt += ind\n\n ans += i*ind+(b[-1]-b[n-ind])\n\nif cnt > m:\n\n ans -= x*(cnt-m)\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nmm = 10**10\n\nk = mm.bit_length()\n\nK = 1< 0:\n\n p = min(m,c[i])\n\n m -= p\n\n ans += i*p\n\n if m == 0:\n\n break\n\nprint(ans)","code_v0_loc":44,"code_v1_loc":27,"code_v0_num_chars":841,"code_v1_num_chars":592,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom bisect import bisect_left\n\nn, m = list(map(int, readline().split()))\na = list(map(int, readline().split()))\nb = [0] * (n + 1)\na.sort()\nfor i in range(n):\n b[i + 1] = b[i] + a[i]\n\n\ndef is_ok(arg):\n c = 0\n f = False\n for i in a:\n if c >= m:\n break\n c += n - bisect_left(a, arg - i)\n if c >= m:\n f = True\n return f\n\n\ndef bisect_ok(ng, ok):\n while abs(ok - ng) > 1:\n mid = (ok + ng) \/\/ 2\n if is_ok(mid):\n ok = mid\n else:\n ng = mid\n return ok\n\n\nx = bisect_ok(2 * a[-1] + 1, 1)\nans = 0\ncnt = 0\nfor i in a:\n ind = n - bisect_left(a, x - i)\n cnt += ind\n ans += i * ind + (b[-1] - b[n - ind])\nif cnt > m:\n ans -= x * (cnt - m)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nmm = 10**10\nk = mm.bit_length()\nK = 1 << k\nnu = lambda L: int(\"\".join([bin(K + a)[-k:] for a in L[::-1]]), 2)\nst = lambda n: bin(n)[2:] + \"0\"\nli = lambda s: [\n int(a, 2) if len(a) else 0\n for a in [s[-(i + 1) * k - 1 : -i * k - 1] for i in range(200001)]\n]\nn, m = list(map(int, input().split()))\na = [int(i) for i in input().split()]\nb = [0] * 100001\nfor i in a:\n b[i] += 1\nc = li(st(nu(b) * nu(b)))\nans = 0\nfor i in range(200001)[::-1]:\n if c[i] > 0:\n p = min(m, c[i])\n m -= p\n ans += i * p\n if m == 0:\n break\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":38.6363636364,"diff":["-read = sys.stdin.buffer.read","-readline = sys.stdin.buffer.readline","-readlines = sys.stdin.buffer.readlines","-from bisect import bisect_left","-","-n, m = list(map(int, readline().split()))","-a = list(map(int, readline().split()))","-b = [0] * (n + 1)","-a.sort()","-for i in range(n):","- b[i + 1] = b[i] + a[i]","-","-","-def is_ok(arg):","- c = 0","- f = False","- for i in a:","- if c >= m:","+input = sys.stdin.readline","+mm = 10**10","+k = mm.bit_length()","+K = 1 << k","+nu = lambda L: int(\"\".join([bin(K + a)[-k:] for a in L[::-1]]), 2)","+st = lambda n: bin(n)[2:] + \"0\"","+li = lambda s: [","+ int(a, 2) if len(a) else 0","+ for a in [s[-(i + 1) * k - 1 : -i * k - 1] for i in range(200001)]","+]","+n, m = list(map(int, input().split()))","+a = [int(i) for i in input().split()]","+b = [0] * 100001","+for i in a:","+ b[i] += 1","+c = li(st(nu(b) * nu(b)))","+ans = 0","+for i in range(200001)[::-1]:","+ if c[i] > 0:","+ p = min(m, c[i])","+ m -= p","+ ans += i * p","+ if m == 0:","- c += n - bisect_left(a, arg - i)","- if c >= m:","- f = True","- return f","-","-","-def bisect_ok(ng, ok):","- while abs(ok - ng) > 1:","- mid = (ok + ng) \/\/ 2","- if is_ok(mid):","- ok = mid","- else:","- ng = mid","- return ok","-","-","-x = bisect_ok(2 * a[-1] + 1, 1)","-ans = 0","-cnt = 0","-for i in a:","- ind = n - bisect_left(a, x - i)","- cnt += ind","- ans += i * ind + (b[-1] - b[n - ind])","-if cnt > m:","- ans -= x * (cnt - m)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1067846377,"measured_runtime_v1":0.8264725716,"runtime_lift":0.1292053014,"key":["s977653050","s777303050"]} +{"user_id":"u806976856","problem_id":"p02573","language":"python","submission_id_v0":"s852198539","submission_id_v1":"s242929712","cpu_time_v0":485,"cpu_time_v1":438,"memory_v0":96180,"memory_v1":75020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.69,"input":"import sys\n\nsys.setrecursionlimit(10**9)\n\nn,m=list(map(int,input().split()))\n\nroot=[-1]*(n+1)\n\ndef r(x):\n\n if root[x]<0:\n\n return x\n\n else:\n\n root[x]=r(root[x])\n\n return root[x]\n\ndef unite(x,y):\n\n x=r(x)\n\n y=r(y)\n\n if x==y:\n\n return\n\n root[x]+=root[y]\n\n root[y]=x\n\ndef size(x):\n\n x=r(x)\n\n return -root[x]\n\nfor i in range(m):\n\n x,y=list(map(int,input().split()))\n\n\n\n unite(x,y)\n\nans=0\n\nfor i in range(n):\n\n ans=max(ans,size(i+1))\n\nprint(ans)\n\n\n","target":"import sys\n\nsys.setrecursionlimit(10**9)\n\nn,m=list(map(int,input().split()))\n\nroot=[-1]*(n+1)\n\ndef r(x):\n\n if root[x]<0:\n\n return x\n\n else:\n\n root[x]=r(root[x])\n\n return root[x]\n\ndef unite(x,y):\n\n x=r(x)\n\n y=r(y)\n\n if x==y:\n\n return\n\n if root[x]>root[y]:\n\n x,y=y,x\n\n\n\n root[x]+=root[y]\n\n root[y]=x\n\ndef size(x):\n\n x=r(x)\n\n return -root[x]\n\nfor i in range(m):\n\n x,y=list(map(int,input().split()))\n\n\n\n unite(x,y)\n\nans=0\n\nfor i in range(n):\n\n ans=max(ans,size(i+1))\n\nprint(ans)\n","code_v0_loc":29,"code_v1_loc":31,"code_v0_num_chars":495,"code_v1_num_chars":537,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nn, m = list(map(int, input().split()))\nroot = [-1] * (n + 1)\n\n\ndef r(x):\n if root[x] < 0:\n return x\n else:\n root[x] = r(root[x])\n return root[x]\n\n\ndef unite(x, y):\n x = r(x)\n y = r(y)\n if x == y:\n return\n root[x] += root[y]\n root[y] = x\n\n\ndef size(x):\n x = r(x)\n return -root[x]\n\n\nfor i in range(m):\n x, y = list(map(int, input().split()))\n unite(x, y)\nans = 0\nfor i in range(n):\n ans = max(ans, size(i + 1))\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\nn, m = list(map(int, input().split()))\nroot = [-1] * (n + 1)\n\n\ndef r(x):\n if root[x] < 0:\n return x\n else:\n root[x] = r(root[x])\n return root[x]\n\n\ndef unite(x, y):\n x = r(x)\n y = r(y)\n if x == y:\n return\n if root[x] > root[y]:\n x, y = y, x\n root[x] += root[y]\n root[y] = x\n\n\ndef size(x):\n x = r(x)\n return -root[x]\n\n\nfor i in range(m):\n x, y = list(map(int, input().split()))\n unite(x, y)\nans = 0\nfor i in range(n):\n ans = max(ans, size(i + 1))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.4516129032,"diff":["+ if root[x] > root[y]:","+ x, y = y, x"],"diff_only_import_comment":false,"measured_runtime_v0":0.0459178216,"measured_runtime_v1":0.0460580842,"runtime_lift":0.9969546581,"key":["s852198539","s242929712"]} +{"user_id":"u814986259","problem_id":"p02743","language":"python","submission_id_v0":"s689649642","submission_id_v1":"s415659807","cpu_time_v0":34,"cpu_time_v1":17,"memory_v0":5076,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"from decimal import *\n\n\n\ngetcontext().prec = 20 # \u30c7\u30d5\u30a9\u30eb\u30c828\u6841\u306e\u3068\u3053\u308d\u309220\u6841\u306b\u3059\u308b\n\n\n\na, b, c = list(map(int, input().split()))\n\n\n\nA = Decimal(a).sqrt()\n\nB = Decimal(b).sqrt()\n\nC = Decimal(c).sqrt()\n\nif A+B < C:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n","target":"a, b, c = list(map(int, input().split()))\n\nif c - a - b >= 0 and 4*(a*b) < (c - a - b)**2:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n","code_v0_loc":13,"code_v1_loc":5,"code_v0_num_chars":240,"code_v1_num_chars":127,"code_v0_no_empty_lines":"from decimal import *\n\ngetcontext().prec = 20 # \u30c7\u30d5\u30a9\u30eb\u30c828\u6841\u306e\u3068\u3053\u308d\u309220\u6841\u306b\u3059\u308b\na, b, c = list(map(int, input().split()))\nA = Decimal(a).sqrt()\nB = Decimal(b).sqrt()\nC = Decimal(c).sqrt()\nif A + B < C:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nif c - a - b >= 0 and 4 * (a * b) < (c - a - b) ** 2:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":61.5384615385,"diff":["-from decimal import *","-","-getcontext().prec = 20 # \u30c7\u30d5\u30a9\u30eb\u30c828\u6841\u306e\u3068\u3053\u308d\u309220\u6841\u306b\u3059\u308b","-A = Decimal(a).sqrt()","-B = Decimal(b).sqrt()","-C = Decimal(c).sqrt()","-if A + B < C:","+if c - a - b >= 0 and 4 * (a * b) < (c - a - b) ** 2:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0457191831,"measured_runtime_v1":0.0457855185,"runtime_lift":0.9985511714,"key":["s689649642","s415659807"]} +{"user_id":"u535719732","problem_id":"p02412","language":"python","submission_id_v0":"s148683251","submission_id_v1":"s307325820","cpu_time_v0":510,"cpu_time_v1":60,"memory_v0":5596,"memory_v1":5596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.24,"input":"while True:\n\n num = list(map(int,input().split()))\n\n if(num[0] == 0 and num[1] == 0): break\n\n c = 0\n\n for i in range(1,num[0] - 1):\n\n for j in range(i+1,num[0]):\n\n for k in range(j+1,num[0]+1):\n\n if(i+j+k == num[1]): c += 1\n\n \n\n print(c)\n","target":"while True:\n\n num = list(map(int,input().split()))\n\n if(num[0] == 0 and num[1] == 0): break\n\n c = 0\n\n for i in range(1,num[0]+1):\n\n for j in range(i+1,num[0]+1):\n\n if j <= i:\n\n continue\n\n k = num[1]-(i+j)\n\n if k > j and k <= num[0]:\n\n c+= 1\n\n print(c)\n","code_v0_loc":10,"code_v1_loc":12,"code_v0_num_chars":289,"code_v1_num_chars":337,"code_v0_no_empty_lines":"while True:\n num = list(map(int, input().split()))\n if num[0] == 0 and num[1] == 0:\n break\n c = 0\n for i in range(1, num[0] - 1):\n for j in range(i + 1, num[0]):\n for k in range(j + 1, num[0] + 1):\n if i + j + k == num[1]:\n c += 1\n print(c)\n","code_v1_no_empty_lines":"while True:\n num = list(map(int, input().split()))\n if num[0] == 0 and num[1] == 0:\n break\n c = 0\n for i in range(1, num[0] + 1):\n for j in range(i + 1, num[0] + 1):\n if j <= i:\n continue\n k = num[1] - (i + j)\n if k > j and k <= num[0]:\n c += 1\n print(c)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["- for i in range(1, num[0] - 1):","- for j in range(i + 1, num[0]):","- for k in range(j + 1, num[0] + 1):","- if i + j + k == num[1]:","- c += 1","+ for i in range(1, num[0] + 1):","+ for j in range(i + 1, num[0] + 1):","+ if j <= i:","+ continue","+ k = num[1] - (i + j)","+ if k > j and k <= num[0]:","+ c += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0791075666,"measured_runtime_v1":0.0456156471,"runtime_lift":1.7342199803,"key":["s148683251","s307325820"]} +{"user_id":"u936985471","problem_id":"p03193","language":"python","submission_id_v0":"s787102353","submission_id_v1":"s618666807","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"n,h,w=list(map(int,input().split()))\n\nans=0\n\nfor i in range(n):\n\n a,b=list(map(int,input().split()))\n\n if a>=h and b>=w:\n\n ans+=1\n\nprint(ans)\n","target":"import sys\n\nreadline = sys.stdin.readline\n\n\n\nN,H,W = list(map(int,readline().split()))\n\nans = 0\n\nfor i in range(N):\n\n a,b = list(map(int,readline().split()))\n\n if a >= H and b >= W:\n\n ans += 1\n\nprint(ans)","code_v0_loc":7,"code_v1_loc":10,"code_v0_num_chars":135,"code_v1_num_chars":197,"code_v0_no_empty_lines":"n, h, w = list(map(int, input().split()))\nans = 0\nfor i in range(n):\n a, b = list(map(int, input().split()))\n if a >= h and b >= w:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\nN, H, W = list(map(int, readline().split()))\nans = 0\nfor i in range(N):\n a, b = list(map(int, readline().split()))\n if a >= H and b >= W:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-n, h, w = list(map(int, input().split()))","+import sys","+","+readline = sys.stdin.readline","+N, H, W = list(map(int, readline().split()))","-for i in range(n):","- a, b = list(map(int, input().split()))","- if a >= h and b >= w:","+for i in range(N):","+ a, b = list(map(int, readline().split()))","+ if a >= H and b >= W:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0403501034,"measured_runtime_v1":0.0434232235,"runtime_lift":0.9292286505,"key":["s787102353","s618666807"]} +{"user_id":"u105608888","problem_id":"p02861","language":"python","submission_id_v0":"s161372389","submission_id_v1":"s722243016","cpu_time_v0":122,"cpu_time_v1":30,"memory_v0":27140,"memory_v1":9444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.41,"input":"N = int(eval(input()))\n\nA = [tuple(map(int, input().split())) for _ in range(N)]\n\nans = []\n\nimport numpy as np\n\nfor i in range(len(A)-1):\n\n for k in range(i+1,len(A)):\n\n ans.append(np.sqrt(((A[i][0]-A[k][0])**2)+(A[i][1]-A[k][1])**2))\n\nprint((sum(ans)*2\/N))","target":"N = int(eval(input()))\n\nA = [tuple(map(int, input().split())) for _ in range(N)]\n\nans = []\n\nfor i in range(len(A)-1):\n\n for k in range(i+1,len(A)):\n\n ans.append((((A[i][0]-A[k][0])**2)+(A[i][1]-A[k][1])**2)**0.5)\n\nprint((sum(ans)*2\/N))","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":259,"code_v1_num_chars":237,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [tuple(map(int, input().split())) for _ in range(N)]\nans = []\nimport numpy as np\n\nfor i in range(len(A) - 1):\n for k in range(i + 1, len(A)):\n ans.append(np.sqrt(((A[i][0] - A[k][0]) ** 2) + (A[i][1] - A[k][1]) ** 2))\nprint((sum(ans) * 2 \/ N))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [tuple(map(int, input().split())) for _ in range(N)]\nans = []\nfor i in range(len(A) - 1):\n for k in range(i + 1, len(A)):\n ans.append((((A[i][0] - A[k][0]) ** 2) + (A[i][1] - A[k][1]) ** 2) ** 0.5)\nprint((sum(ans) * 2 \/ N))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-import numpy as np","-","- ans.append(np.sqrt(((A[i][0] - A[k][0]) ** 2) + (A[i][1] - A[k][1]) ** 2))","+ ans.append((((A[i][0] - A[k][0]) ** 2) + (A[i][1] - A[k][1]) ** 2) ** 0.5)"],"diff_only_import_comment":false,"measured_runtime_v0":1.2157114983,"measured_runtime_v1":0.040333128,"runtime_lift":30.1417608547,"key":["s161372389","s722243016"]} +{"user_id":"u816587940","problem_id":"p02586","language":"python","submission_id_v0":"s463371996","submission_id_v1":"s872461120","cpu_time_v0":1149,"cpu_time_v1":1040,"memory_v0":430212,"memory_v1":428792,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.49,"input":"import sys\n\ninput=sys.stdin.readline\n\n\n\nclass list2D:\n\n def __init__(self, H, W, num):\n\n self.__H = H\n\n self.__W = W\n\n self.__dat = [num] * (H * W)\n\n\n\n def __getitem__(self, a):\n\n return self.__dat[a[0]*self.__W+a[1]]\n\n\n\n def __setitem__(self, a, b):\n\n self.__dat[a[0]*self.__W+a[1]] = b\n\n\n\n def debug(self):\n\n print(self.__dat)\n\n\n\nclass list3D:\n\n def __init__(self, H, W, D, num):\n\n self.__H = H\n\n self.__W = W\n\n self.__D = D\n\n self.__X = W * D\n\n self.__dat = [num] * (H * W * D)\n\n\n\n def __getitem__(self, a):\n\n return self.__dat[a[0]*self.__X+a[1]*self.__D + a[2]]\n\n\n\n def __setitem__(self, a, b):\n\n self.__dat[a[0]*self.__X+a[1]*self.__D + a[2]] = b\n\n\n\n def debug(self):\n\n print(self.__dat)\n\n\n\ndef main():\n\n r,c,k=map(int,input().split())\n\n v = list2D(r, c, 0)\n\n\n\n for _ in range(k):\n\n ri,ci,a=map(int,input().split())\n\n v[ri-1, ci-1] = a\n\n\n\n dp = list3D(r, c, 4, 0)\n\n #print(dp)\n\n if v[0, 0]>0: dp[0, 0, 1]=v[0, 0]\n\n\n\n for i in range(r):\n\n for j in range(c):\n\n val = v[i, j]\n\n if i>0:\n\n x = max(dp[i-1, j, 0], dp[i-1, j, 1], dp[i-1, j, 2], dp[i-1, j, 3])\n\n dp[i, j, 1]=max(dp[i, j, 1],x+val)\n\n dp[i, j, 0]=max(dp[i, j, 0],x)\n\n\n\n if j>0:\n\n X = dp[i, j-1, 0]\n\n Y = dp[i, j-1, 1]\n\n V = dp[i, j-1, 2]\n\n Z = dp[i, j-1, 3]\n\n dp[i, j, 0]=max(dp[i, j, 0],X)\n\n dp[i, j, 1]=max(dp[i, j, 1],X+val,Y)\n\n dp[i, j, 2]=max(dp[i, j, 2],Y+val,V)\n\n dp[i, j, 3]=max(dp[i, j, 3],V+val,Z)\n\n\n\n #print(dp)\n\n ans=0\n\n for i in range(4): ans=max(dp[r-1, c-1, i],ans)\n\n return print(ans)\n\nif __name__==\"__main__\":\n\n main()\n","target":"import sys\n\ninput=sys.stdin.readline\n\n\n\nclass list2D:\n\n def __init__(self, H, W, num):\n\n self.__H = H\n\n self.__W = W\n\n self.__dat = [num] * (H * W)\n\n\n\n def __getitem__(self, a):\n\n return self.__dat[a[0]*self.__W+a[1]]\n\n\n\n def __setitem__(self, a, b):\n\n self.__dat[a[0]*self.__W+a[1]] = b\n\n\n\n def debug(self):\n\n print(self.__dat)\n\n\n\nclass list3D:\n\n def __init__(self, H, W, D, num):\n\n self.__H = H\n\n self.__W = W\n\n self.__D = D\n\n self.__X = W * D\n\n self.__dat = [num] * (H * W * D)\n\n\n\n def __getitem__(self, a):\n\n return self.__dat[a[0]*self.__X+a[1]*self.__D + a[2]]\n\n\n\n def __setitem__(self, a, b):\n\n self.__dat[a[0]*self.__X+a[1]*self.__D + a[2]] = b\n\n\n\n def debug(self):\n\n print(self.__dat)\n\n\n\ndef main():\n\n r,c,k=map(int,input().split())\n\n v = list2D(r, c, 0)\n\n\n\n for _ in range(k):\n\n ri,ci,a=map(int,input().split())\n\n v[ri-1, ci-1] = a\n\n\n\n dp = list3D(r, c, 4, 0)\n\n #print(dp)\n\n if v[0, 0]>0: dp[0, 0, 1] = v[0, 0]\n\n\n\n for i in range(r):\n\n for j in range(c):\n\n val = v[i, j]\n\n if i>0:\n\n x = max(dp[i-1, j, 0], dp[i-1, j, 1], dp[i-1, j, 2], dp[i-1, j, 3])\n\n dp[i, j, 1]=x+val\n\n dp[i, j, 0]=x\n\n\n\n if j>0:\n\n X = dp[i, j-1, 0]\n\n Y = dp[i, j-1, 1]\n\n V = dp[i, j-1, 2]\n\n Z = dp[i, j-1, 3]\n\n dp[i, j, 0]=max(dp[i, j, 0],X)\n\n dp[i, j, 1]=max(dp[i, j, 1],X+val,Y)\n\n dp[i, j, 2]=max(Y+val,V)\n\n dp[i, j, 3]=max(V+val,Z)\n\n\n\n #print(dp)\n\n ans=0\n\n for i in range(4): ans=max(dp[r-1, c-1, i],ans)\n\n return print(ans)\n\nif __name__==\"__main__\":\n\n main()\n","code_v0_loc":71,"code_v1_loc":71,"code_v0_num_chars":1876,"code_v1_num_chars":1820,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\nclass list2D:\n def __init__(self, H, W, num):\n self.__H = H\n self.__W = W\n self.__dat = [num] * (H * W)\n\n def __getitem__(self, a):\n return self.__dat[a[0] * self.__W + a[1]]\n\n def __setitem__(self, a, b):\n self.__dat[a[0] * self.__W + a[1]] = b\n\n def debug(self):\n print(self.__dat)\n\n\nclass list3D:\n def __init__(self, H, W, D, num):\n self.__H = H\n self.__W = W\n self.__D = D\n self.__X = W * D\n self.__dat = [num] * (H * W * D)\n\n def __getitem__(self, a):\n return self.__dat[a[0] * self.__X + a[1] * self.__D + a[2]]\n\n def __setitem__(self, a, b):\n self.__dat[a[0] * self.__X + a[1] * self.__D + a[2]] = b\n\n def debug(self):\n print(self.__dat)\n\n\ndef main():\n r, c, k = map(int, input().split())\n v = list2D(r, c, 0)\n for _ in range(k):\n ri, ci, a = map(int, input().split())\n v[ri - 1, ci - 1] = a\n dp = list3D(r, c, 4, 0)\n # print(dp)\n if v[0, 0] > 0:\n dp[0, 0, 1] = v[0, 0]\n for i in range(r):\n for j in range(c):\n val = v[i, j]\n if i > 0:\n x = max(\n dp[i - 1, j, 0], dp[i - 1, j, 1], dp[i - 1, j, 2], dp[i - 1, j, 3]\n )\n dp[i, j, 1] = max(dp[i, j, 1], x + val)\n dp[i, j, 0] = max(dp[i, j, 0], x)\n if j > 0:\n X = dp[i, j - 1, 0]\n Y = dp[i, j - 1, 1]\n V = dp[i, j - 1, 2]\n Z = dp[i, j - 1, 3]\n dp[i, j, 0] = max(dp[i, j, 0], X)\n dp[i, j, 1] = max(dp[i, j, 1], X + val, Y)\n dp[i, j, 2] = max(dp[i, j, 2], Y + val, V)\n dp[i, j, 3] = max(dp[i, j, 3], V + val, Z)\n # print(dp)\n ans = 0\n for i in range(4):\n ans = max(dp[r - 1, c - 1, i], ans)\n return print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\nclass list2D:\n def __init__(self, H, W, num):\n self.__H = H\n self.__W = W\n self.__dat = [num] * (H * W)\n\n def __getitem__(self, a):\n return self.__dat[a[0] * self.__W + a[1]]\n\n def __setitem__(self, a, b):\n self.__dat[a[0] * self.__W + a[1]] = b\n\n def debug(self):\n print(self.__dat)\n\n\nclass list3D:\n def __init__(self, H, W, D, num):\n self.__H = H\n self.__W = W\n self.__D = D\n self.__X = W * D\n self.__dat = [num] * (H * W * D)\n\n def __getitem__(self, a):\n return self.__dat[a[0] * self.__X + a[1] * self.__D + a[2]]\n\n def __setitem__(self, a, b):\n self.__dat[a[0] * self.__X + a[1] * self.__D + a[2]] = b\n\n def debug(self):\n print(self.__dat)\n\n\ndef main():\n r, c, k = map(int, input().split())\n v = list2D(r, c, 0)\n for _ in range(k):\n ri, ci, a = map(int, input().split())\n v[ri - 1, ci - 1] = a\n dp = list3D(r, c, 4, 0)\n # print(dp)\n if v[0, 0] > 0:\n dp[0, 0, 1] = v[0, 0]\n for i in range(r):\n for j in range(c):\n val = v[i, j]\n if i > 0:\n x = max(\n dp[i - 1, j, 0], dp[i - 1, j, 1], dp[i - 1, j, 2], dp[i - 1, j, 3]\n )\n dp[i, j, 1] = x + val\n dp[i, j, 0] = x\n if j > 0:\n X = dp[i, j - 1, 0]\n Y = dp[i, j - 1, 1]\n V = dp[i, j - 1, 2]\n Z = dp[i, j - 1, 3]\n dp[i, j, 0] = max(dp[i, j, 0], X)\n dp[i, j, 1] = max(dp[i, j, 1], X + val, Y)\n dp[i, j, 2] = max(Y + val, V)\n dp[i, j, 3] = max(V + val, Z)\n # print(dp)\n ans = 0\n for i in range(4):\n ans = max(dp[r - 1, c - 1, i], ans)\n return print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- dp[i, j, 1] = max(dp[i, j, 1], x + val)","- dp[i, j, 0] = max(dp[i, j, 0], x)","+ dp[i, j, 1] = x + val","+ dp[i, j, 0] = x","- dp[i, j, 2] = max(dp[i, j, 2], Y + val, V)","- dp[i, j, 3] = max(dp[i, j, 3], V + val, Z)","+ dp[i, j, 2] = max(Y + val, V)","+ dp[i, j, 3] = max(V + val, Z)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1120307715,"measured_runtime_v1":0.0439383917,"runtime_lift":2.5497239924,"key":["s463371996","s872461120"]} +{"user_id":"u829908012","problem_id":"p03416","language":"python","submission_id_v0":"s245880158","submission_id_v1":"s252974742","cpu_time_v0":143,"cpu_time_v1":109,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.78,"input":"A,B=list(map(int,input().split()))\n\ncount=0\n\nfor i in range(A,B+1):\n\n if list(str(i)) == list(reversed(str(i))):\n\n\n\n count+=1\n\n\n\n \n\nprint(count)\n","target":"A,B=list(map(int,input().split()))\n\ncount=0\n\nfor i in range(A,B+1):\n\n if str(i) == ''.join(reversed(str(i))):\n\n\n\n count+=1\n\n\n\n \n\nprint(count)\n","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":156,"code_v1_num_chars":153,"code_v0_no_empty_lines":"A, B = list(map(int, input().split()))\ncount = 0\nfor i in range(A, B + 1):\n if list(str(i)) == list(reversed(str(i))):\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\ncount = 0\nfor i in range(A, B + 1):\n if str(i) == \"\".join(reversed(str(i))):\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if list(str(i)) == list(reversed(str(i))):","+ if str(i) == \"\".join(reversed(str(i))):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0617753321,"measured_runtime_v1":0.0562413793,"runtime_lift":1.0983964612,"key":["s245880158","s252974742"]} +{"user_id":"u312025627","problem_id":"p03476","language":"python","submission_id_v0":"s736487904","submission_id_v1":"s806726554","cpu_time_v0":655,"cpu_time_v1":343,"memory_v0":72676,"memory_v1":67172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.63,"input":"def main():\n\n from itertools import accumulate\n\n\n\n def Eratosthenes(x: int) -> set:\n\n from math import sqrt\n\n sup = int(x)\n\n primes = {i for i in range(2, sup+1)}\n\n for i in range(2, int(sqrt(sup+1))+1):\n\n if i in primes:\n\n mul = 2\n\n while i*mul <= sup:\n\n primes.discard(i*mul)\n\n mul += 1\n\n return primes\n\n P = Eratosthenes(10**5+5)\n\n A = [0]*(10**5+5)\n\n for i in range(3, 10**5+5):\n\n if i in P and (i+1)\/\/2 in P:\n\n A[i] += 1\n\n S = list(accumulate(A))\n\n\n\n Q = int(eval(input()))\n\n LR = [[int(i) for i in input().split()] for j in range(Q)]\n\n for le, ri in LR:\n\n print((S[ri] - S[le-1]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def Eratosthenes(x: int) -> set:\n\n from math import sqrt\n\n sup = int(x)\n\n primes = {i for i in range(2, sup+1)}\n\n for i in range(2, int(sqrt(sup+1))+1):\n\n if i in primes:\n\n mul = 2\n\n while i*mul <= sup:\n\n primes.discard(i*mul)\n\n mul += 1\n\n return primes\n\n\n\n\n\ndef main():\n\n import sys\n\n input = sys.stdin.buffer.readline\n\n P = Eratosthenes(10**5+5)\n\n A = [0]*(10**5+5)\n\n for i in range(3, 10**5+5):\n\n if i in P and (i+1)\/\/2 in P:\n\n A[i] = 1\n\n from itertools import accumulate\n\n S = list(accumulate(A))\n\n Q = int(eval(input()))\n\n LR = [[int(i) for i in input().split()] for j in range(Q)]\n\n for le, ri in LR:\n\n print((S[ri] - S[le-1]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":29,"code_v1_loc":31,"code_v0_num_chars":789,"code_v1_num_chars":799,"code_v0_no_empty_lines":"def main():\n from itertools import accumulate\n\n def Eratosthenes(x: int) -> set:\n from math import sqrt\n\n sup = int(x)\n primes = {i for i in range(2, sup + 1)}\n for i in range(2, int(sqrt(sup + 1)) + 1):\n if i in primes:\n mul = 2\n while i * mul <= sup:\n primes.discard(i * mul)\n mul += 1\n return primes\n\n P = Eratosthenes(10**5 + 5)\n A = [0] * (10**5 + 5)\n for i in range(3, 10**5 + 5):\n if i in P and (i + 1) \/\/ 2 in P:\n A[i] += 1\n S = list(accumulate(A))\n Q = int(eval(input()))\n LR = [[int(i) for i in input().split()] for j in range(Q)]\n for le, ri in LR:\n print((S[ri] - S[le - 1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def Eratosthenes(x: int) -> set:\n from math import sqrt\n\n sup = int(x)\n primes = {i for i in range(2, sup + 1)}\n for i in range(2, int(sqrt(sup + 1)) + 1):\n if i in primes:\n mul = 2\n while i * mul <= sup:\n primes.discard(i * mul)\n mul += 1\n return primes\n\n\ndef main():\n import sys\n\n input = sys.stdin.buffer.readline\n P = Eratosthenes(10**5 + 5)\n A = [0] * (10**5 + 5)\n for i in range(3, 10**5 + 5):\n if i in P and (i + 1) \/\/ 2 in P:\n A[i] = 1\n from itertools import accumulate\n\n S = list(accumulate(A))\n Q = int(eval(input()))\n LR = [[int(i) for i in input().split()] for j in range(Q)]\n for le, ri in LR:\n print((S[ri] - S[le - 1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.4516129032,"diff":["+def Eratosthenes(x: int) -> set:","+ from math import sqrt","+","+ sup = int(x)","+ primes = {i for i in range(2, sup + 1)}","+ for i in range(2, int(sqrt(sup + 1)) + 1):","+ if i in primes:","+ mul = 2","+ while i * mul <= sup:","+ primes.discard(i * mul)","+ mul += 1","+ return primes","+","+","- from itertools import accumulate","+ import sys","- def Eratosthenes(x: int) -> set:","- from math import sqrt","-","- sup = int(x)","- primes = {i for i in range(2, sup + 1)}","- for i in range(2, int(sqrt(sup + 1)) + 1):","- if i in primes:","- mul = 2","- while i * mul <= sup:","- primes.discard(i * mul)","- mul += 1","- return primes","-","+ input = sys.stdin.buffer.readline","- A[i] += 1","+ A[i] = 1","+ from itertools import accumulate","+"],"diff_only_import_comment":false,"measured_runtime_v0":0.1170805905,"measured_runtime_v1":0.2278856459,"runtime_lift":0.5137690443,"key":["s736487904","s806726554"]} +{"user_id":"u017810624","problem_id":"p03044","language":"python","submission_id_v0":"s741658191","submission_id_v1":"s699682762","cpu_time_v0":1043,"cpu_time_v1":837,"memory_v0":159832,"memory_v1":105432,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.75,"input":"import sys\n\nsys.setrecursionlimit(1000000)\n\n \n\ndef dfs(l,d,k):\n\n for i in l[k]:\n\n if d[i[0]]==-1:\n\n d[i[0]]=d[k]+i[1]\n\n dfs(l,d,i[0])\n\n\n\nn=int(eval(input()))\n\nl=[list(map(int,input().split())) for i in range(n-1)]\n\nconnection=[[] for i in range(n)]\n\nfor i in range(n-1):\n\n connection[l[i][0]-1].append([l[i][1]-1,l[i][2]])\n\n connection[l[i][1]-1].append([l[i][0]-1,l[i][2]])\n\ndistance=[-1 for i in range(n)]\n\nx=-1\n\nfor i in range(n-1):\n\n if len(connection[i])==1:\n\n x=i\n\n break\n\ndistance[x]=0\n\ndfs(connection,distance,x)\n\nfor i in range(n):\n\n print((distance[i]%2))","target":"n=int(eval(input()))\n\nl=[list(map(int,input().split())) for i in range(n-1)]\n\nconnection=[[] for i in range(n)]\n\nfor i in range(n-1):\n\n connection[l[i][0]-1].append(l[i][1]-1)\n\n connection[l[i][1]-1].append(l[i][0]-1)\n\nd={}\n\nfor i in range(n-1):\n\n d[(l[i][0]-1,l[i][1]-1)]=l[i][2]\n\n d[(l[i][1]-1,l[i][0]-1)]=l[i][2]\n\n\n\ndef bfs(v):\n\n distance=[-1]*n\n\n distance[v]=0\n\n next=[v]\n\n next2=set()\n\n visited=[-1]*n\n\n visitct=0\n\n while len(next)!=0 and visitct!=n:\n\n for i in range(len(next)):\n\n if visited[next[i]]==-1:\n\n visited[next[i]]=1\n\n visitct+=1\n\n for j in range(len(connection[next[i]])):\n\n if visited[connection[next[i]][j]]==-1:\n\n distance[connection[next[i]][j]]=distance[next[i]]+d[(next[i],connection[next[i]][j])]\n\n next2.add(connection[next[i]][j])\n\n next=list(next2)\n\n next2=set()\n\n return distance\n\n\n\nans=bfs(0)\n\nfor i in range(n):\n\n print((ans[i]%2))","code_v0_loc":25,"code_v1_loc":34,"code_v0_num_chars":581,"code_v1_num_chars":932,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(1000000)\n\n\ndef dfs(l, d, k):\n for i in l[k]:\n if d[i[0]] == -1:\n d[i[0]] = d[k] + i[1]\n dfs(l, d, i[0])\n\n\nn = int(eval(input()))\nl = [list(map(int, input().split())) for i in range(n - 1)]\nconnection = [[] for i in range(n)]\nfor i in range(n - 1):\n connection[l[i][0] - 1].append([l[i][1] - 1, l[i][2]])\n connection[l[i][1] - 1].append([l[i][0] - 1, l[i][2]])\ndistance = [-1 for i in range(n)]\nx = -1\nfor i in range(n - 1):\n if len(connection[i]) == 1:\n x = i\n break\ndistance[x] = 0\ndfs(connection, distance, x)\nfor i in range(n):\n print((distance[i] % 2))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nl = [list(map(int, input().split())) for i in range(n - 1)]\nconnection = [[] for i in range(n)]\nfor i in range(n - 1):\n connection[l[i][0] - 1].append(l[i][1] - 1)\n connection[l[i][1] - 1].append(l[i][0] - 1)\nd = {}\nfor i in range(n - 1):\n d[(l[i][0] - 1, l[i][1] - 1)] = l[i][2]\n d[(l[i][1] - 1, l[i][0] - 1)] = l[i][2]\n\n\ndef bfs(v):\n distance = [-1] * n\n distance[v] = 0\n next = [v]\n next2 = set()\n visited = [-1] * n\n visitct = 0\n while len(next) != 0 and visitct != n:\n for i in range(len(next)):\n if visited[next[i]] == -1:\n visited[next[i]] = 1\n visitct += 1\n for j in range(len(connection[next[i]])):\n if visited[connection[next[i]][j]] == -1:\n distance[connection[next[i]][j]] = (\n distance[next[i]] + d[(next[i], connection[next[i]][j])]\n )\n next2.add(connection[next[i]][j])\n next = list(next2)\n next2 = set()\n return distance\n\n\nans = bfs(0)\nfor i in range(n):\n print((ans[i] % 2))\n","code_same":false,"relative_loc_diff_percent":26.4705882353,"diff":["-import sys","-","-sys.setrecursionlimit(1000000)","-","-","-def dfs(l, d, k):","- for i in l[k]:","- if d[i[0]] == -1:","- d[i[0]] = d[k] + i[1]","- dfs(l, d, i[0])","-","-","- connection[l[i][0] - 1].append([l[i][1] - 1, l[i][2]])","- connection[l[i][1] - 1].append([l[i][0] - 1, l[i][2]])","-distance = [-1 for i in range(n)]","-x = -1","+ connection[l[i][0] - 1].append(l[i][1] - 1)","+ connection[l[i][1] - 1].append(l[i][0] - 1)","+d = {}","- if len(connection[i]) == 1:","- x = i","- break","-distance[x] = 0","-dfs(connection, distance, x)","+ d[(l[i][0] - 1, l[i][1] - 1)] = l[i][2]","+ d[(l[i][1] - 1, l[i][0] - 1)] = l[i][2]","+","+","+def bfs(v):","+ distance = [-1] * n","+ distance[v] = 0","+ next = [v]","+ next2 = set()","+ visited = [-1] * n","+ visitct = 0","+ while len(next) != 0 and visitct != n:","+ for i in range(len(next)):","+ if visited[next[i]] == -1:","+ visited[next[i]] = 1","+ visitct += 1","+ for j in range(len(connection[next[i]])):","+ if visited[connection[next[i]][j]] == -1:","+ distance[connection[next[i]][j]] = (","+ distance[next[i]] + d[(next[i], connection[next[i]][j])]","+ )","+ next2.add(connection[next[i]][j])","+ next = list(next2)","+ next2 = set()","+ return distance","+","+","+ans = bfs(0)","- print((distance[i] % 2))","+ print((ans[i] % 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0461290789,"measured_runtime_v1":0.0467002649,"runtime_lift":0.9877691059,"key":["s741658191","s699682762"]} +{"user_id":"u901582103","problem_id":"p03478","language":"python","submission_id_v0":"s371973980","submission_id_v1":"s081852774","cpu_time_v0":34,"cpu_time_v1":27,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.59,"input":"n,a,b=list(map(int,input().split()))\n\nr=0\n\nfor i in range(n+1):\n\n if a<=sum([int(j) for j in str(i)])<=b:\n\n r+=i\n\nprint(r)","target":"n,a,b=list(map(int,input().split()))\n\ns=0\n\nfor i in range(1,n+1):\n\n k=0\n\n m=i\n\n while m>0:\n\n k+=m%10\n\n m=m\/\/10\n\n if a<=k<=b:\n\n s+=i\n\nprint(s)","code_v0_loc":6,"code_v1_loc":11,"code_v0_num_chars":126,"code_v1_num_chars":168,"code_v0_no_empty_lines":"n, a, b = list(map(int, input().split()))\nr = 0\nfor i in range(n + 1):\n if a <= sum([int(j) for j in str(i)]) <= b:\n r += i\nprint(r)\n","code_v1_no_empty_lines":"n, a, b = list(map(int, input().split()))\ns = 0\nfor i in range(1, n + 1):\n k = 0\n m = i\n while m > 0:\n k += m % 10\n m = m \/\/ 10\n if a <= k <= b:\n s += i\nprint(s)\n","code_same":false,"relative_loc_diff_percent":45.4545454545,"diff":["-r = 0","-for i in range(n + 1):","- if a <= sum([int(j) for j in str(i)]) <= b:","- r += i","-print(r)","+s = 0","+for i in range(1, n + 1):","+ k = 0","+ m = i","+ while m > 0:","+ k += m % 10","+ m = m \/\/ 10","+ if a <= k <= b:","+ s += i","+print(s)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0393275802,"measured_runtime_v1":0.039881731,"runtime_lift":0.986105146,"key":["s371973980","s081852774"]} +{"user_id":"u623601489","problem_id":"p03308","language":"python","submission_id_v0":"s709157929","submission_id_v1":"s388338246","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"eval(input())\n\nlst=list(map(int,input().split()))\n\nlst.sort()\n\nprint((lst[-1]-lst[0]))","target":"eval(input())\n\nlst=sorted(list(map(int,input().split())))\n\nprint((lst[-1]-lst[0]))","code_v0_loc":4,"code_v1_loc":3,"code_v0_num_chars":78,"code_v1_num_chars":74,"code_v0_no_empty_lines":"eval(input())\nlst = list(map(int, input().split()))\nlst.sort()\nprint((lst[-1] - lst[0]))\n","code_v1_no_empty_lines":"eval(input())\nlst = sorted(list(map(int, input().split())))\nprint((lst[-1] - lst[0]))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-lst = list(map(int, input().split()))","-lst.sort()","+lst = sorted(list(map(int, input().split())))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0495688915,"measured_runtime_v1":0.0856575012,"runtime_lift":0.5786871064,"key":["s709157929","s388338246"]} +{"user_id":"u962423738","problem_id":"p02718","language":"python","submission_id_v0":"s512992225","submission_id_v1":"s502044933","cpu_time_v0":38,"cpu_time_v1":30,"memory_v0":10348,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.05,"input":"from fractions import Fraction\n\nn,m=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\n\n\ncnt=0\n\n\n\nfor i in a:\n\n\tif (sum(a))*(Fraction(1,4*m))<=i:\n\n\t\tcnt+=1\n\n\t\tif cnt==m:\n\n\t\t\tprint(\"Yes\")\n\n \n\nif cntL:\n\n print((0))\n\n import sys\n\n sys.exit()\n\nif K==1:\n\n s = ['0']*L\n\n cnt = 0\n\n for i in range(L):\n\n for j in range(1,10):\n\n s[i] = str(j)\n\n x = ''.join(s)\n\n x = int(x)\n\n if x<=N:\n\n cnt += 1\n\n s[i] = '0'\n\nelif K==2:\n\n s = ['0']*L\n\n cnt = 0\n\n for i in range(L-1):\n\n for j in range(i+1,L):\n\n for a in range(1,10):\n\n for b in range(1,10):\n\n s[i] = str(a)\n\n s[j] = str(b)\n\n x = ''.join(s)\n\n x = int(x)\n\n if x<=N:\n\n cnt += 1\n\n s[i] = '0'\n\n s[j] = '0'\n\nelse:\n\n s = ['0']*L\n\n cnt = 0\n\n cnt += cmb(L-1,3)*(9**3) if L>3 else 0\n\n g = int(S[0])\n\n s[0] = S[0]\n\n for i in range(1,L-1):\n\n for j in range(i+1,L):\n\n for a in range(1,10):\n\n for b in range(1,10):\n\n s[j] = str(a)\n\n s[i] = str(b)\n\n x = ''.join(s)\n\n x = int(x)\n\n# print(x)\n\n if x<=N:\n\n cnt += g\n\n else:\n\n cnt += g-1\n\n s[i] = '0'\n\n s[j] = '0'\n\nprint(cnt)","target":"from functools import lru_cache\n\nN = int(eval(input()))\n\nK = int(eval(input()))\n\n\n\n@lru_cache(None)\n\n\n\ndef F(N,K):\n\n assert N>=0\n\n if N<10:\n\n if K==0:\n\n return 1\n\n if K==1:\n\n return N\n\n return 0\n\n q,r = divmod(N,10)\n\n ret = 0\n\n if K>=1:\n\n ret += F(q,K-1)*r\n\n ret += F(q-1,K-1)*(9-r)\n\n ret += F(q,K)\n\n return ret\n\n\n\nprint((F(N,K)))","code_v0_loc":65,"code_v1_loc":23,"code_v0_num_chars":1353,"code_v1_num_chars":348,"code_v0_no_empty_lines":"from operator import mul\nfrom functools import reduce\n\n\ndef cmb(n, r):\n r = min(n - r, r)\n if r == 0:\n return 1\n over = reduce(mul, list(range(n, n - r, -1)))\n under = reduce(mul, list(range(1, r + 1)))\n return over \/\/ under\n\n\nN = int(eval(input()))\nK = int(eval(input()))\nL = len(str(N))\nS = str(N)\nif K > L:\n print((0))\n import sys\n\n sys.exit()\nif K == 1:\n s = [\"0\"] * L\n cnt = 0\n for i in range(L):\n for j in range(1, 10):\n s[i] = str(j)\n x = \"\".join(s)\n x = int(x)\n if x <= N:\n cnt += 1\n s[i] = \"0\"\nelif K == 2:\n s = [\"0\"] * L\n cnt = 0\n for i in range(L - 1):\n for j in range(i + 1, L):\n for a in range(1, 10):\n for b in range(1, 10):\n s[i] = str(a)\n s[j] = str(b)\n x = \"\".join(s)\n x = int(x)\n if x <= N:\n cnt += 1\n s[i] = \"0\"\n s[j] = \"0\"\nelse:\n s = [\"0\"] * L\n cnt = 0\n cnt += cmb(L - 1, 3) * (9**3) if L > 3 else 0\n g = int(S[0])\n s[0] = S[0]\n for i in range(1, L - 1):\n for j in range(i + 1, L):\n for a in range(1, 10):\n for b in range(1, 10):\n s[j] = str(a)\n s[i] = str(b)\n x = \"\".join(s)\n x = int(x)\n # print(x)\n if x <= N:\n cnt += g\n else:\n cnt += g - 1\n s[i] = \"0\"\n s[j] = \"0\"\nprint(cnt)\n","code_v1_no_empty_lines":"from functools import lru_cache\n\nN = int(eval(input()))\nK = int(eval(input()))\n\n\n@lru_cache(None)\ndef F(N, K):\n assert N >= 0\n if N < 10:\n if K == 0:\n return 1\n if K == 1:\n return N\n return 0\n q, r = divmod(N, 10)\n ret = 0\n if K >= 1:\n ret += F(q, K - 1) * r\n ret += F(q - 1, K - 1) * (9 - r)\n ret += F(q, K)\n return ret\n\n\nprint((F(N, K)))\n","code_same":false,"relative_loc_diff_percent":64.6153846154,"diff":["-from operator import mul","-from functools import reduce","-","-","-def cmb(n, r):","- r = min(n - r, r)","- if r == 0:","- return 1","- over = reduce(mul, list(range(n, n - r, -1)))","- under = reduce(mul, list(range(1, r + 1)))","- return over \/\/ under","-","+from functools import lru_cache","-L = len(str(N))","-S = str(N)","-if K > L:","- print((0))","- import sys","- sys.exit()","-if K == 1:","- s = [\"0\"] * L","- cnt = 0","- for i in range(L):","- for j in range(1, 10):","- s[i] = str(j)","- x = \"\".join(s)","- x = int(x)","- if x <= N:","- cnt += 1","- s[i] = \"0\"","-elif K == 2:","- s = [\"0\"] * L","- cnt = 0","- for i in range(L - 1):","- for j in range(i + 1, L):","- for a in range(1, 10):","- for b in range(1, 10):","- s[i] = str(a)","- s[j] = str(b)","- x = \"\".join(s)","- x = int(x)","- if x <= N:","- cnt += 1","- s[i] = \"0\"","- s[j] = \"0\"","-else:","- s = [\"0\"] * L","- cnt = 0","- cnt += cmb(L - 1, 3) * (9**3) if L > 3 else 0","- g = int(S[0])","- s[0] = S[0]","- for i in range(1, L - 1):","- for j in range(i + 1, L):","- for a in range(1, 10):","- for b in range(1, 10):","- s[j] = str(a)","- s[i] = str(b)","- x = \"\".join(s)","- x = int(x)","- # print(x)","- if x <= N:","- cnt += g","- else:","- cnt += g - 1","- s[i] = \"0\"","- s[j] = \"0\"","-print(cnt)","+","+@lru_cache(None)","+def F(N, K):","+ assert N >= 0","+ if N < 10:","+ if K == 0:","+ return 1","+ if K == 1:","+ return N","+ return 0","+ q, r = divmod(N, 10)","+ ret = 0","+ if K >= 1:","+ ret += F(q, K - 1) * r","+ ret += F(q - 1, K - 1) * (9 - r)","+ ret += F(q, K)","+ return ret","+","+","+print((F(N, K)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2031704996,"measured_runtime_v1":0.039880873,"runtime_lift":5.0944346101,"key":["s687699980","s829956079"]} +{"user_id":"u777923818","problem_id":"p03162","language":"python","submission_id_v0":"s908003424","submission_id_v1":"s681967587","cpu_time_v0":668,"cpu_time_v1":474,"memory_v0":64216,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.04,"input":"def inpl(): return list(map(int, input().split()))\n\nN = int(eval(input()))\n\nA, B, C = [0]*N, [0]*N, [0]*N\n\n\n\nfor i in range(N):\n\n A[i], B[i], C[i] = inpl()\n\n\n\nDP = [[0]*3 for _ in range(N)]\n\nDP[0] = [A[0], B[0], C[0]]\n\n\n\nfor i in range(1, N):\n\n DP[i][0] = max(DP[i-1][1] + A[i], DP[i-1][2] + A[i])\n\n DP[i][1] = max(DP[i-1][0] + B[i], DP[i-1][2] + B[i])\n\n DP[i][2] = max(DP[i-1][0] + C[i], DP[i-1][1] + C[i])\n\n\n\nprint((max(DP[-1])))","target":"def inpl(): return list(map(int, input().split()))\n\nN = int(eval(input()))\n\nsa, sb, sc = 0, 0, 0\n\nfor i in range(N):\n\n a, b, c = inpl()\n\n sa, sb, sc = max(sb+a, sc+a), max(sa+b, sc+b), max(sa+c, sb+c)\n\nprint((max(sa, sb, sc)))\n","code_v0_loc":16,"code_v1_loc":7,"code_v0_num_chars":435,"code_v1_num_chars":225,"code_v0_no_empty_lines":"def inpl():\n return list(map(int, input().split()))\n\n\nN = int(eval(input()))\nA, B, C = [0] * N, [0] * N, [0] * N\nfor i in range(N):\n A[i], B[i], C[i] = inpl()\nDP = [[0] * 3 for _ in range(N)]\nDP[0] = [A[0], B[0], C[0]]\nfor i in range(1, N):\n DP[i][0] = max(DP[i - 1][1] + A[i], DP[i - 1][2] + A[i])\n DP[i][1] = max(DP[i - 1][0] + B[i], DP[i - 1][2] + B[i])\n DP[i][2] = max(DP[i - 1][0] + C[i], DP[i - 1][1] + C[i])\nprint((max(DP[-1])))\n","code_v1_no_empty_lines":"def inpl():\n return list(map(int, input().split()))\n\n\nN = int(eval(input()))\nsa, sb, sc = 0, 0, 0\nfor i in range(N):\n a, b, c = inpl()\n sa, sb, sc = max(sb + a, sc + a), max(sa + b, sc + b), max(sa + c, sb + c)\nprint((max(sa, sb, sc)))\n","code_same":false,"relative_loc_diff_percent":56.25,"diff":["-A, B, C = [0] * N, [0] * N, [0] * N","+sa, sb, sc = 0, 0, 0","- A[i], B[i], C[i] = inpl()","-DP = [[0] * 3 for _ in range(N)]","-DP[0] = [A[0], B[0], C[0]]","-for i in range(1, N):","- DP[i][0] = max(DP[i - 1][1] + A[i], DP[i - 1][2] + A[i])","- DP[i][1] = max(DP[i - 1][0] + B[i], DP[i - 1][2] + B[i])","- DP[i][2] = max(DP[i - 1][0] + C[i], DP[i - 1][1] + C[i])","-print((max(DP[-1])))","+ a, b, c = inpl()","+ sa, sb, sc = max(sb + a, sc + a), max(sa + b, sc + b), max(sa + c, sb + c)","+print((max(sa, sb, sc)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0380855277,"measured_runtime_v1":0.0381500838,"runtime_lift":0.9983078377,"key":["s908003424","s681967587"]} +{"user_id":"u608088992","problem_id":"p03043","language":"python","submission_id_v0":"s635997368","submission_id_v1":"s326853267","cpu_time_v0":53,"cpu_time_v1":27,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":49.06,"input":"import sys\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n N, K = list(map(int, input().split()))\n\n P = 0\n\n for i in range(1, N + 1):\n\n coins = 0\n\n k = i\n\n while k < K:\n\n coins += 1\n\n k *= 2\n\n P += pow(0.5, coins) \/ N\n\n print(P)\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","target":"import sys\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n N, K = list(map(int, input().split()))\n\n possible = 0\n\n for i in range(1, N + 1):\n\n this_poss = 1\n\n if i < K:\n\n t = i\n\n while t < K:\n\n this_poss *= 0.5\n\n t *= 2\n\n possible += this_poss \/ N\n\n print(possible)\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":19,"code_v1_loc":20,"code_v0_num_chars":345,"code_v1_num_chars":405,"code_v0_no_empty_lines":"import sys\n\n\ndef solve():\n input = sys.stdin.readline\n N, K = list(map(int, input().split()))\n P = 0\n for i in range(1, N + 1):\n coins = 0\n k = i\n while k < K:\n coins += 1\n k *= 2\n P += pow(0.5, coins) \/ N\n print(P)\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys\n\n\ndef solve():\n input = sys.stdin.readline\n N, K = list(map(int, input().split()))\n possible = 0\n for i in range(1, N + 1):\n this_poss = 1\n if i < K:\n t = i\n while t < K:\n this_poss *= 0.5\n t *= 2\n possible += this_poss \/ N\n print(possible)\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":5.0,"diff":["- P = 0","+ possible = 0","- coins = 0","- k = i","- while k < K:","- coins += 1","- k *= 2","- P += pow(0.5, coins) \/ N","- print(P)","+ this_poss = 1","+ if i < K:","+ t = i","+ while t < K:","+ this_poss *= 0.5","+ t *= 2","+ possible += this_poss \/ N","+ print(possible)"],"diff_only_import_comment":false,"measured_runtime_v0":0.045133187,"measured_runtime_v1":0.0495730213,"runtime_lift":0.9104384957,"key":["s635997368","s326853267"]} +{"user_id":"u852690916","problem_id":"p02957","language":"python","submission_id_v0":"s577139058","submission_id_v1":"s045482371","cpu_time_v0":167,"cpu_time_v1":31,"memory_v0":38384,"memory_v1":9060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.44,"input":"A,B=list(map(int, input().split()))\n\nprint(((A+B)\/\/2 if (A+B)&1==0 else 'IMPOSSIBLE'))","target":"A, B = list(map(int, input().split()))\n\nif A > B: A, B = B, A\n\nif (B - A) & 1:\n\n print('IMPOSSIBLE')\n\n exit()\n\nprint((A + (B - A) \/\/ 2))\n","code_v0_loc":2,"code_v1_loc":6,"code_v0_num_chars":78,"code_v1_num_chars":135,"code_v0_no_empty_lines":"A, B = list(map(int, input().split()))\nprint(((A + B) \/\/ 2 if (A + B) & 1 == 0 else \"IMPOSSIBLE\"))\n","code_v1_no_empty_lines":"A, B = list(map(int, input().split()))\nif A > B:\n A, B = B, A\nif (B - A) & 1:\n print(\"IMPOSSIBLE\")\n exit()\nprint((A + (B - A) \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-print(((A + B) \/\/ 2 if (A + B) & 1 == 0 else \"IMPOSSIBLE\"))","+if A > B:","+ A, B = B, A","+if (B - A) & 1:","+ print(\"IMPOSSIBLE\")","+ exit()","+print((A + (B - A) \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0414699671,"measured_runtime_v1":0.1194000852,"runtime_lift":0.3473194098,"key":["s577139058","s045482371"]} +{"user_id":"u638282348","problem_id":"p03476","language":"python","submission_id_v0":"s171586546","submission_id_v1":"s123753034","cpu_time_v0":1301,"cpu_time_v1":1078,"memory_v0":56992,"memory_v1":52896,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.14,"input":"from bisect import bisect_left, bisect\n\ndef sieve_of_eratosthenes_2017(N):\n\n numbers = [n & 1 for n in range(N + 1)]\n\n numbers[1] = 0\n\n numbers[2] = 1\n\n like2017 = []\n\n p = 1\n\n while True:\n\n while not numbers[p]:\n\n p += 2\n\n if p * p > N:\n\n for i in range(p, N + 1, 2):\n\n if numbers[i] & numbers[(i + 1) >> 1]:\n\n like2017.append(i)\n\n return like2017\n\n if numbers[(p + 1) >> 1]:\n\n like2017.append(p)\n\n for i in range(p * 2, N + 1, p):\n\n numbers[i] = 0\n\n p += 2\n\n\n\nlike2017 = sieve_of_eratosthenes_2017(10 ** 5)\n\nQ = int(eval(input()))\n\nfor _ in range(Q):\n\n l, r = list(map(int, input().split()))\n\n lindex = bisect_left(like2017, l)\n\n rindex = bisect(like2017, r)\n\n print((rindex - lindex))","target":"from itertools import accumulate\n\ndef sieve_of_eratosthenes_2017(N):\n\n numbers = [n & 1 for n in range(N + 1)]\n\n numbers[1] = 0\n\n numbers[2] = 1\n\n like2017 = [0] * (N + 1)\n\n p = 1\n\n while True:\n\n while not numbers[p]:\n\n p += 2\n\n if p * p > N:\n\n for i in range(p, N + 1, 2):\n\n if numbers[i] & numbers[(i + 1) >> 1]:\n\n like2017[i] = 1\n\n return like2017\n\n if numbers[(p + 1) >> 1]:\n\n like2017[p] = 1\n\n for i in range(p * 2, N + 1, p):\n\n numbers[i] = 0\n\n p += 2\n\n\n\nlike2017 = sieve_of_eratosthenes_2017(10 ** 5)\n\nlike2017_sum = list(accumulate(like2017))\n\nQ = int(eval(input()))\n\nfor _ in range(Q):\n\n l, r = list(map(int, input().split()))\n\n print((like2017_sum[r] - like2017_sum[l] + like2017[l]))\n","code_v0_loc":28,"code_v1_loc":27,"code_v0_num_chars":827,"code_v1_num_chars":829,"code_v0_no_empty_lines":"from bisect import bisect_left, bisect\n\n\ndef sieve_of_eratosthenes_2017(N):\n numbers = [n & 1 for n in range(N + 1)]\n numbers[1] = 0\n numbers[2] = 1\n like2017 = []\n p = 1\n while True:\n while not numbers[p]:\n p += 2\n if p * p > N:\n for i in range(p, N + 1, 2):\n if numbers[i] & numbers[(i + 1) >> 1]:\n like2017.append(i)\n return like2017\n if numbers[(p + 1) >> 1]:\n like2017.append(p)\n for i in range(p * 2, N + 1, p):\n numbers[i] = 0\n p += 2\n\n\nlike2017 = sieve_of_eratosthenes_2017(10**5)\nQ = int(eval(input()))\nfor _ in range(Q):\n l, r = list(map(int, input().split()))\n lindex = bisect_left(like2017, l)\n rindex = bisect(like2017, r)\n print((rindex - lindex))\n","code_v1_no_empty_lines":"from itertools import accumulate\n\n\ndef sieve_of_eratosthenes_2017(N):\n numbers = [n & 1 for n in range(N + 1)]\n numbers[1] = 0\n numbers[2] = 1\n like2017 = [0] * (N + 1)\n p = 1\n while True:\n while not numbers[p]:\n p += 2\n if p * p > N:\n for i in range(p, N + 1, 2):\n if numbers[i] & numbers[(i + 1) >> 1]:\n like2017[i] = 1\n return like2017\n if numbers[(p + 1) >> 1]:\n like2017[p] = 1\n for i in range(p * 2, N + 1, p):\n numbers[i] = 0\n p += 2\n\n\nlike2017 = sieve_of_eratosthenes_2017(10**5)\nlike2017_sum = list(accumulate(like2017))\nQ = int(eval(input()))\nfor _ in range(Q):\n l, r = list(map(int, input().split()))\n print((like2017_sum[r] - like2017_sum[l] + like2017[l]))\n","code_same":false,"relative_loc_diff_percent":3.5714285714,"diff":["-from bisect import bisect_left, bisect","+from itertools import accumulate","- like2017 = []","+ like2017 = [0] * (N + 1)","- like2017.append(i)","+ like2017[i] = 1","- like2017.append(p)","+ like2017[p] = 1","+like2017_sum = list(accumulate(like2017))","- lindex = bisect_left(like2017, l)","- rindex = bisect(like2017, r)","- print((rindex - lindex))","+ print((like2017_sum[r] - like2017_sum[l] + like2017[l]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.068875869,"measured_runtime_v1":0.0801369514,"runtime_lift":0.8594770301,"key":["s171586546","s123753034"]} +{"user_id":"u191874006","problem_id":"p03252","language":"python","submission_id_v0":"s783849075","submission_id_v1":"s959934877","cpu_time_v0":222,"cpu_time_v1":197,"memory_v0":70348,"memory_v1":41712,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.26,"input":"#!\/usr\/bin\/env python3\n\n#ABC110 C\n\n\n\ns = list(eval(input()))\n\nt = list(eval(input()))\n\n\n\nif len(set(s)) != len(set(t)):\n\n print('No')\n\n quit()\n\n\n\ndif = {}\n\nfor x,y in zip(s,t):\n\n if x not in dif:\n\n dif[x] = y\n\n elif dif[x] != y:\n\n print('No')\n\n quit()\n\nprint('Yes')\n","target":"#!\/usr\/bin\/env python3\n\n\n\nimport sys\n\nimport math\n\nfrom bisect import bisect_right as br\n\nfrom bisect import bisect_left as bl\n\nsys.setrecursionlimit(2147483647)\n\nfrom heapq import heappush, heappop,heappushpop\n\nfrom collections import defaultdict\n\nfrom itertools import accumulate\n\nfrom collections import Counter\n\nfrom collections import deque\n\nfrom operator import itemgetter\n\nfrom itertools import permutations\n\nmod = 10**9 + 7\n\ninf = float('inf')\n\ndef I(): return int(sys.stdin.readline())\n\ndef LI(): return list(map(int,sys.stdin.readline().split()))\n\n\n\ns = eval(input())\n\nt = eval(input())\n\nif len(list(Counter(s).values())) != len(list(Counter(t).values())):\n\n print('No')\n\n quit()\n\nn = len(s)\n\nS = [-1]*26\n\nfor i in range(n):\n\n sidx = ord(s[i]) - ord(\"a\")\n\n tidx = ord(t[i]) - ord(\"a\")\n\n if S[tidx] < 0:\n\n S[tidx] = sidx\n\n else:\n\n if S[tidx] != sidx:\n\n print('No')\n\n quit()\n\nprint('Yes')","code_v0_loc":18,"code_v1_loc":36,"code_v0_num_chars":287,"code_v1_num_chars":938,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\n# ABC110 C\ns = list(eval(input()))\nt = list(eval(input()))\nif len(set(s)) != len(set(t)):\n print(\"No\")\n quit()\ndif = {}\nfor x, y in zip(s, t):\n if x not in dif:\n dif[x] = y\n elif dif[x] != y:\n print(\"No\")\n quit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\nimport math\nfrom bisect import bisect_right as br\nfrom bisect import bisect_left as bl\n\nsys.setrecursionlimit(2147483647)\nfrom heapq import heappush, heappop, heappushpop\nfrom collections import defaultdict\nfrom itertools import accumulate\nfrom collections import Counter\nfrom collections import deque\nfrom operator import itemgetter\nfrom itertools import permutations\n\nmod = 10**9 + 7\ninf = float(\"inf\")\n\n\ndef I():\n return int(sys.stdin.readline())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\ns = eval(input())\nt = eval(input())\nif len(list(Counter(s).values())) != len(list(Counter(t).values())):\n print(\"No\")\n quit()\nn = len(s)\nS = [-1] * 26\nfor i in range(n):\n sidx = ord(s[i]) - ord(\"a\")\n tidx = ord(t[i]) - ord(\"a\")\n if S[tidx] < 0:\n S[tidx] = sidx\n else:\n if S[tidx] != sidx:\n print(\"No\")\n quit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-# ABC110 C","-s = list(eval(input()))","-t = list(eval(input()))","-if len(set(s)) != len(set(t)):","+import sys","+import math","+from bisect import bisect_right as br","+from bisect import bisect_left as bl","+","+sys.setrecursionlimit(2147483647)","+from heapq import heappush, heappop, heappushpop","+from collections import defaultdict","+from itertools import accumulate","+from collections import Counter","+from collections import deque","+from operator import itemgetter","+from itertools import permutations","+","+mod = 10**9 + 7","+inf = float(\"inf\")","+","+","+def I():","+ return int(sys.stdin.readline())","+","+","+def LI():","+ return list(map(int, sys.stdin.readline().split()))","+","+","+s = eval(input())","+t = eval(input())","+if len(list(Counter(s).values())) != len(list(Counter(t).values())):","-dif = {}","-for x, y in zip(s, t):","- if x not in dif:","- dif[x] = y","- elif dif[x] != y:","- print(\"No\")","- quit()","+n = len(s)","+S = [-1] * 26","+for i in range(n):","+ sidx = ord(s[i]) - ord(\"a\")","+ tidx = ord(t[i]) - ord(\"a\")","+ if S[tidx] < 0:","+ S[tidx] = sidx","+ else:","+ if S[tidx] != sidx:","+ print(\"No\")","+ quit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.035816808,"measured_runtime_v1":0.036979126,"runtime_lift":0.9685682674,"key":["s783849075","s959934877"]} +{"user_id":"u150984829","problem_id":"p00099","language":"python","submission_id_v0":"s876977704","submission_id_v1":"s594461639","cpu_time_v0":2620,"cpu_time_v1":430,"memory_v0":28868,"memory_v1":13712,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":83.59,"input":"import queue\n\nn,q=list(map(int,input().split()))\n\np=queue.PriorityQueue()\n\ns=[0]*-~n\n\nfor _ in[0]*q:\n\n a,v=list(map(int,input().split()))\n\n s[a]+=v;p.put((-s[a],a))\n\n while 1:\n\n t=p.get()\n\n if -t[0]==s[t[1]]:print((t[1],-t[0]));p.put(t);break\n","target":"import sys\n\nn,q=list(map(int,input().split()))\n\ns=[0]*-~n\n\nw=m=0\n\nfor e in sys.stdin:\n\n a,v=list(map(int,e.split()))\n\n s[a]+=v\n\n if v<0 and a==w:m=max(s);w=s.index(m)\n\n elif s[a]>m:w,m=a,s[a]\n\n elif s[a]==m:w=min(w,a)\n\n print((w,m))\n","code_v0_loc":10,"code_v1_loc":11,"code_v0_num_chars":231,"code_v1_num_chars":219,"code_v0_no_empty_lines":"import queue\n\nn, q = list(map(int, input().split()))\np = queue.PriorityQueue()\ns = [0] * -~n\nfor _ in [0] * q:\n a, v = list(map(int, input().split()))\n s[a] += v\n p.put((-s[a], a))\n while 1:\n t = p.get()\n if -t[0] == s[t[1]]:\n print((t[1], -t[0]))\n p.put(t)\n break\n","code_v1_no_empty_lines":"import sys\n\nn, q = list(map(int, input().split()))\ns = [0] * -~n\nw = m = 0\nfor e in sys.stdin:\n a, v = list(map(int, e.split()))\n s[a] += v\n if v < 0 and a == w:\n m = max(s)\n w = s.index(m)\n elif s[a] > m:\n w, m = a, s[a]\n elif s[a] == m:\n w = min(w, a)\n print((w, m))\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-import queue","+import sys","-p = queue.PriorityQueue()","-for _ in [0] * q:","- a, v = list(map(int, input().split()))","+w = m = 0","+for e in sys.stdin:","+ a, v = list(map(int, e.split()))","- p.put((-s[a], a))","- while 1:","- t = p.get()","- if -t[0] == s[t[1]]:","- print((t[1], -t[0]))","- p.put(t)","- break","+ if v < 0 and a == w:","+ m = max(s)","+ w = s.index(m)","+ elif s[a] > m:","+ w, m = a, s[a]","+ elif s[a] == m:","+ w = min(w, a)","+ print((w, m))"],"diff_only_import_comment":false,"measured_runtime_v0":0.138565084,"measured_runtime_v1":0.0352071249,"runtime_lift":3.9357114261,"key":["s876977704","s594461639"]} +{"user_id":"u699296734","problem_id":"p03449","language":"python","submission_id_v0":"s247417277","submission_id_v1":"s166861080","cpu_time_v0":30,"cpu_time_v1":23,"memory_v0":9192,"memory_v1":9168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.33,"input":"n = int(eval(input()))\n\na1 = list(map(int, input().split()))\n\na2 = list(map(int, input().split()))\n\n\n\nfor i in range(1, n):\n\n a1[i] += a1[i - 1]\n\n\n\nfor i in range(n - 2, -1, -1):\n\n a2[i] += a2[i + 1]\n\n\n\nres = 0\n\nfor i in range(n):\n\n tmp = a1[i] + a2[i]\n\n res = max(tmp, res)\n\n\n\nprint(res)\n","target":"n = int(eval(input()))\n\ndp = [[0 for i in range(n)] for i in range(2)]\n\na1 = list(map(int, input().split()))\n\na2 = list(map(int, input().split()))\n\n\n\ndp[0][0] = a1[0]\n\nfor i in range(1, n):\n\n dp[0][i] = dp[0][i - 1] + a1[i]\n\ndp[1][0] = dp[0][0] + a2[0]\n\n\n\nfor i in range(1, n):\n\n dp[1][i] = max(dp[0][i] + a2[i], dp[1][i - 1] + a2[i])\n\n\n\nprint((dp[1][-1]))\n","code_v0_loc":16,"code_v1_loc":14,"code_v0_num_chars":295,"code_v1_num_chars":355,"code_v0_no_empty_lines":"n = int(eval(input()))\na1 = list(map(int, input().split()))\na2 = list(map(int, input().split()))\nfor i in range(1, n):\n a1[i] += a1[i - 1]\nfor i in range(n - 2, -1, -1):\n a2[i] += a2[i + 1]\nres = 0\nfor i in range(n):\n tmp = a1[i] + a2[i]\n res = max(tmp, res)\nprint(res)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ndp = [[0 for i in range(n)] for i in range(2)]\na1 = list(map(int, input().split()))\na2 = list(map(int, input().split()))\ndp[0][0] = a1[0]\nfor i in range(1, n):\n dp[0][i] = dp[0][i - 1] + a1[i]\ndp[1][0] = dp[0][0] + a2[0]\nfor i in range(1, n):\n dp[1][i] = max(dp[0][i] + a2[i], dp[1][i - 1] + a2[i])\nprint((dp[1][-1]))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["+dp = [[0 for i in range(n)] for i in range(2)]","+dp[0][0] = a1[0]","- a1[i] += a1[i - 1]","-for i in range(n - 2, -1, -1):","- a2[i] += a2[i + 1]","-res = 0","-for i in range(n):","- tmp = a1[i] + a2[i]","- res = max(tmp, res)","-print(res)","+ dp[0][i] = dp[0][i - 1] + a1[i]","+dp[1][0] = dp[0][0] + a2[0]","+for i in range(1, n):","+ dp[1][i] = max(dp[0][i] + a2[i], dp[1][i - 1] + a2[i])","+print((dp[1][-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0356570046,"measured_runtime_v1":0.0353478243,"runtime_lift":1.0087467972,"key":["s247417277","s166861080"]} +{"user_id":"u025501820","problem_id":"p03061","language":"python","submission_id_v0":"s301099816","submission_id_v1":"s712018366","cpu_time_v0":466,"cpu_time_v1":225,"memory_v0":114152,"memory_v1":16120,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.72,"input":"from fractions import gcd\n\nfrom functools import reduce\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nmy_gcd = reduce(gcd, A)\n\nA = [a \/\/ my_gcd for a in A]\n\n\n\nflag = False\n\nmy_gcd_2 = 0\n\nmy_gcd_3 = 0\n\n\n\ndef make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n \/\/ i:\n\n divisors.append(n\/\/i)\n\n\n\n return divisors\n\n\n\nfor i in range(N):\n\n a = A[i]\n\n if my_gcd_2 == 0:\n\n my_gcd_2 = a\n\n else:\n\n if gcd(my_gcd_2, a) == 1:\n\n if flag is False:\n\n if i == 1:\n\n my_gcd_3 = a\n\n else:\n\n divisors = make_divisors(a)\n\n for d in divisors[::-1]:\n\n if len([j for j in A[:i] if j % d]) == 1:\n\n my_gcd_3 = d\n\n break\n\n flag = True\n\n continue\n\n else:\n\n my_gcd_2 = -1\n\n if my_gcd_3 and gcd(my_gcd_3, a) == 1:\n\n my_gcd_3 = -1\n\n if my_gcd_2:\n\n my_gcd_2 = gcd(my_gcd_2, a)\n\n if my_gcd_3:\n\n my_gcd_3 = gcd(my_gcd_3, a)\n\n\n\nelse:\n\n ans_1 = my_gcd * my_gcd_2\n\n ans_2 = my_gcd * my_gcd_3\n\n print((max(ans_1, ans_2, my_gcd)))","target":"from fractions import gcd\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\ngcd_from_left = [0] * (N + 1) \n\ngcd_from_right = [0] * (N + 1)\n\ngcd_from_left[1] = A[0]\n\nfor i in range(2, N + 1):\n\n gcd_from_left[i] = gcd(A[i - 1], gcd_from_left[i - 1])\n\nA = A[::-1]\n\ngcd_from_right[1] = A[0]\n\nfor i in range(2, N + 1):\n\n gcd_from_right[i] = gcd(A[i - 1], gcd_from_right[i - 1])\n\n\n\nans = 0\n\nfor i in range(1, N + 1): # \u629c\u304b\u3059\u3084\u3064\u306eindex\n\n if i == 1:\n\n ans = max(ans, gcd_from_right[N - i])\n\n elif i == N:\n\n ans = max(ans, gcd_from_left[i - 1])\n\n else:\n\n ans = max(ans, gcd(gcd_from_left[i - 1], gcd_from_right[N - i]))\n\nprint(ans)","code_v0_loc":53,"code_v1_loc":24,"code_v0_num_chars":1340,"code_v1_num_chars":664,"code_v0_no_empty_lines":"from fractions import gcd\nfrom functools import reduce\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nmy_gcd = reduce(gcd, A)\nA = [a \/\/ my_gcd for a in A]\nflag = False\nmy_gcd_2 = 0\nmy_gcd_3 = 0\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n \/\/ i:\n divisors.append(n \/\/ i)\n return divisors\n\n\nfor i in range(N):\n a = A[i]\n if my_gcd_2 == 0:\n my_gcd_2 = a\n else:\n if gcd(my_gcd_2, a) == 1:\n if flag is False:\n if i == 1:\n my_gcd_3 = a\n else:\n divisors = make_divisors(a)\n for d in divisors[::-1]:\n if len([j for j in A[:i] if j % d]) == 1:\n my_gcd_3 = d\n break\n flag = True\n continue\n else:\n my_gcd_2 = -1\n if my_gcd_3 and gcd(my_gcd_3, a) == 1:\n my_gcd_3 = -1\n if my_gcd_2:\n my_gcd_2 = gcd(my_gcd_2, a)\n if my_gcd_3:\n my_gcd_3 = gcd(my_gcd_3, a)\nelse:\n ans_1 = my_gcd * my_gcd_2\n ans_2 = my_gcd * my_gcd_3\n print((max(ans_1, ans_2, my_gcd)))\n","code_v1_no_empty_lines":"from fractions import gcd\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\ngcd_from_left = [0] * (N + 1)\ngcd_from_right = [0] * (N + 1)\ngcd_from_left[1] = A[0]\nfor i in range(2, N + 1):\n gcd_from_left[i] = gcd(A[i - 1], gcd_from_left[i - 1])\nA = A[::-1]\ngcd_from_right[1] = A[0]\nfor i in range(2, N + 1):\n gcd_from_right[i] = gcd(A[i - 1], gcd_from_right[i - 1])\nans = 0\nfor i in range(1, N + 1): # \u629c\u304b\u3059\u3084\u3064\u306eindex\n if i == 1:\n ans = max(ans, gcd_from_right[N - i])\n elif i == N:\n ans = max(ans, gcd_from_left[i - 1])\n else:\n ans = max(ans, gcd(gcd_from_left[i - 1], gcd_from_right[N - i]))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":54.7169811321,"diff":["-from functools import reduce","-my_gcd = reduce(gcd, A)","-A = [a \/\/ my_gcd for a in A]","-flag = False","-my_gcd_2 = 0","-my_gcd_3 = 0","-","-","-def make_divisors(n):","- divisors = []","- for i in range(1, int(n**0.5) + 1):","- if n % i == 0:","- divisors.append(i)","- if i != n \/\/ i:","- divisors.append(n \/\/ i)","- return divisors","-","-","-for i in range(N):","- a = A[i]","- if my_gcd_2 == 0:","- my_gcd_2 = a","+gcd_from_left = [0] * (N + 1)","+gcd_from_right = [0] * (N + 1)","+gcd_from_left[1] = A[0]","+for i in range(2, N + 1):","+ gcd_from_left[i] = gcd(A[i - 1], gcd_from_left[i - 1])","+A = A[::-1]","+gcd_from_right[1] = A[0]","+for i in range(2, N + 1):","+ gcd_from_right[i] = gcd(A[i - 1], gcd_from_right[i - 1])","+ans = 0","+for i in range(1, N + 1): # \u629c\u304b\u3059\u3084\u3064\u306eindex","+ if i == 1:","+ ans = max(ans, gcd_from_right[N - i])","+ elif i == N:","+ ans = max(ans, gcd_from_left[i - 1])","- if gcd(my_gcd_2, a) == 1:","- if flag is False:","- if i == 1:","- my_gcd_3 = a","- else:","- divisors = make_divisors(a)","- for d in divisors[::-1]:","- if len([j for j in A[:i] if j % d]) == 1:","- my_gcd_3 = d","- break","- flag = True","- continue","- else:","- my_gcd_2 = -1","- if my_gcd_3 and gcd(my_gcd_3, a) == 1:","- my_gcd_3 = -1","- if my_gcd_2:","- my_gcd_2 = gcd(my_gcd_2, a)","- if my_gcd_3:","- my_gcd_3 = gcd(my_gcd_3, a)","-else:","- ans_1 = my_gcd * my_gcd_2","- ans_2 = my_gcd * my_gcd_3","- print((max(ans_1, ans_2, my_gcd)))","+ ans = max(ans, gcd(gcd_from_left[i - 1], gcd_from_right[N - i]))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1196417351,"measured_runtime_v1":0.1201107209,"runtime_lift":0.9960953876,"key":["s301099816","s712018366"]} +{"user_id":"u936985471","problem_id":"p03049","language":"python","submission_id_v0":"s920842402","submission_id_v1":"s967584073","cpu_time_v0":37,"cpu_time_v1":26,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.73,"input":"n=int(eval(input()))\n\nans=0\n\naend=0\n\nbstart=0\n\naendbstart=0\n\nfor i in range(n):\n\n s=eval(input())\n\n ans+=s.count(\"AB\")\n\n if s[0]==\"B\" and s[-1]==\"A\":\n\n aendbstart+=1\n\n elif s[0]==\"B\":\n\n bstart+=1\n\n elif s[-1]==\"A\":\n\n aend+=1\n\nanow=False\n\nif aend>0:\n\n aend-=1\n\n anow=True\n\nelif aendbstart>0:\n\n aendbstart-=1\n\n anow=True\n\nif anow:\n\n ans+=aendbstart\n\nif anow and bstart>0:\n\n bstart-=1\n\n ans+=1\n\n anow=False\n\nif aend>0 and bstart>0:\n\n ans+=min(aend,bstart)\n\nprint(ans)","target":"# (1)AB\u304c\u542b\u307e\u308c\u308b\u500b\u6570\u30fb\u30fb\u30fb\u307e\u305a\u5358\u7d14\u306b\u30ab\u30a6\u30f3\u30c8\n\n# (2)A\u3067\u7d42\u308f\u308b\u3051\u3069B\u3067\u59cb\u307e\u3089\u306a\u3044\u3082\u306e\u306e\u500b\u6570\n\n# (3)B\u3067\u59cb\u307e\u308b\u3082\u306eA\u3067\u7d42\u308f\u3089\u306a\u3044\u3082\u306e\u306e\u306e\u500b\u6570\n\n# (4)B\u3067\u59cb\u307e\u3063\u3066A\u3067\u7d42\u308f\u308b\u3082\u306e\u306e\u500b\u6570 \u306e\u500b\u6570 - 1\n\n# (4)\u304c1\u4ee5\u4e0a\u3042\u308b\u5834\u5408\u3001(2),(3)\u3092\u4e00\u3064\u305a\u3064\u4f7f\u3046\u3053\u3068\u3067\u305d\u308c\u305e\u308c+1\n\n# \u305d\u308c\u3067\u3082(2)(3)\u306e\u30da\u30a2\u304c\u4f5c\u308c\u308c\u3070\u30da\u30a2\u3054\u3068\u306b+1\n\n\n\nimport sys\n\nreadline = sys.stdin.readline\n\n\n\nN = int(readline())\n\nans = 0\n\na_end = 0\n\nb_start = 0\n\na_end_b_start = 0\n\n\n\nfor i in range(N):\n\n s = readline().rstrip()\n\n ans += s.count(\"AB\")\n\n if s[-1] == \"A\" and s[0] == \"B\":\n\n a_end_b_start += 1\n\n elif s[-1] == \"A\":\n\n a_end += 1\n\n elif s[0] == \"B\":\n\n b_start += 1\n\n\n\nif a_end_b_start > 0:\n\n ans += a_end_b_start - 1\n\n if a_end > 0:\n\n a_end -= 1\n\n ans += 1\n\n if b_start > 0:\n\n b_start -= 1\n\n ans += 1\n\n\n\nans += min(a_end,b_start)\n\nprint(ans)","code_v0_loc":30,"code_v1_loc":37,"code_v0_num_chars":475,"code_v1_num_chars":700,"code_v0_no_empty_lines":"n = int(eval(input()))\nans = 0\naend = 0\nbstart = 0\naendbstart = 0\nfor i in range(n):\n s = eval(input())\n ans += s.count(\"AB\")\n if s[0] == \"B\" and s[-1] == \"A\":\n aendbstart += 1\n elif s[0] == \"B\":\n bstart += 1\n elif s[-1] == \"A\":\n aend += 1\nanow = False\nif aend > 0:\n aend -= 1\n anow = True\nelif aendbstart > 0:\n aendbstart -= 1\n anow = True\nif anow:\n ans += aendbstart\nif anow and bstart > 0:\n bstart -= 1\n ans += 1\n anow = False\nif aend > 0 and bstart > 0:\n ans += min(aend, bstart)\nprint(ans)\n","code_v1_no_empty_lines":"# (1)AB\u304c\u542b\u307e\u308c\u308b\u500b\u6570\u30fb\u30fb\u30fb\u307e\u305a\u5358\u7d14\u306b\u30ab\u30a6\u30f3\u30c8\n# (2)A\u3067\u7d42\u308f\u308b\u3051\u3069B\u3067\u59cb\u307e\u3089\u306a\u3044\u3082\u306e\u306e\u500b\u6570\n# (3)B\u3067\u59cb\u307e\u308b\u3082\u306eA\u3067\u7d42\u308f\u3089\u306a\u3044\u3082\u306e\u306e\u306e\u500b\u6570\n# (4)B\u3067\u59cb\u307e\u3063\u3066A\u3067\u7d42\u308f\u308b\u3082\u306e\u306e\u500b\u6570 \u306e\u500b\u6570 - 1\n# (4)\u304c1\u4ee5\u4e0a\u3042\u308b\u5834\u5408\u3001(2),(3)\u3092\u4e00\u3064\u305a\u3064\u4f7f\u3046\u3053\u3068\u3067\u305d\u308c\u305e\u308c+1\n# \u305d\u308c\u3067\u3082(2)(3)\u306e\u30da\u30a2\u304c\u4f5c\u308c\u308c\u3070\u30da\u30a2\u3054\u3068\u306b+1\nimport sys\n\nreadline = sys.stdin.readline\nN = int(readline())\nans = 0\na_end = 0\nb_start = 0\na_end_b_start = 0\nfor i in range(N):\n s = readline().rstrip()\n ans += s.count(\"AB\")\n if s[-1] == \"A\" and s[0] == \"B\":\n a_end_b_start += 1\n elif s[-1] == \"A\":\n a_end += 1\n elif s[0] == \"B\":\n b_start += 1\nif a_end_b_start > 0:\n ans += a_end_b_start - 1\n if a_end > 0:\n a_end -= 1\n ans += 1\n if b_start > 0:\n b_start -= 1\n ans += 1\nans += min(a_end, b_start)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":18.9189189189,"diff":["-n = int(eval(input()))","+# (1)AB\u304c\u542b\u307e\u308c\u308b\u500b\u6570\u30fb\u30fb\u30fb\u307e\u305a\u5358\u7d14\u306b\u30ab\u30a6\u30f3\u30c8","+# (2)A\u3067\u7d42\u308f\u308b\u3051\u3069B\u3067\u59cb\u307e\u3089\u306a\u3044\u3082\u306e\u306e\u500b\u6570","+# (3)B\u3067\u59cb\u307e\u308b\u3082\u306eA\u3067\u7d42\u308f\u3089\u306a\u3044\u3082\u306e\u306e\u306e\u500b\u6570","+# (4)B\u3067\u59cb\u307e\u3063\u3066A\u3067\u7d42\u308f\u308b\u3082\u306e\u306e\u500b\u6570 \u306e\u500b\u6570 - 1","+# (4)\u304c1\u4ee5\u4e0a\u3042\u308b\u5834\u5408\u3001(2),(3)\u3092\u4e00\u3064\u305a\u3064\u4f7f\u3046\u3053\u3068\u3067\u305d\u308c\u305e\u308c+1","+# \u305d\u308c\u3067\u3082(2)(3)\u306e\u30da\u30a2\u304c\u4f5c\u308c\u308c\u3070\u30da\u30a2\u3054\u3068\u306b+1","+import sys","+","+readline = sys.stdin.readline","+N = int(readline())","-aend = 0","-bstart = 0","-aendbstart = 0","-for i in range(n):","- s = eval(input())","+a_end = 0","+b_start = 0","+a_end_b_start = 0","+for i in range(N):","+ s = readline().rstrip()","- if s[0] == \"B\" and s[-1] == \"A\":","- aendbstart += 1","+ if s[-1] == \"A\" and s[0] == \"B\":","+ a_end_b_start += 1","+ elif s[-1] == \"A\":","+ a_end += 1","- bstart += 1","- elif s[-1] == \"A\":","- aend += 1","-anow = False","-if aend > 0:","- aend -= 1","- anow = True","-elif aendbstart > 0:","- aendbstart -= 1","- anow = True","-if anow:","- ans += aendbstart","-if anow and bstart > 0:","- bstart -= 1","- ans += 1","- anow = False","-if aend > 0 and bstart > 0:","- ans += min(aend, bstart)","+ b_start += 1","+if a_end_b_start > 0:","+ ans += a_end_b_start - 1","+ if a_end > 0:","+ a_end -= 1","+ ans += 1","+ if b_start > 0:","+ b_start -= 1","+ ans += 1","+ans += min(a_end, b_start)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1475211895,"measured_runtime_v1":0.0726525578,"runtime_lift":2.0305023498,"key":["s920842402","s967584073"]} +{"user_id":"u886747123","problem_id":"p03178","language":"python","submission_id_v0":"s947929347","submission_id_v1":"s438857270","cpu_time_v0":1772,"cpu_time_v1":1591,"memory_v0":59740,"memory_v1":61788,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.21,"input":"K = int(eval(input()))\n\nD = int(eval(input()))\n\nMOD = 10**9 + 7\n\n\n\ndp = [[[0]*(int(len(str(K)))+1) for _ in range(D)] for _ in range(2)]\n\ndp[0][0][0] = 1\n\n\n\nfor digit in range(int(len(str(K)))):\n\n for smaller_flg in [0,1]:\n\n lim = 9 if smaller_flg else int(str(K)[digit])\n\n for digit_num in range(lim+1):\n\n new_smaller_flg = smaller_flg or digit_num < lim\n\n for mod_d in range(D):\n\n new_mod_d = (mod_d + digit_num)%D\n\n dp[new_smaller_flg][new_mod_d][digit+1] += dp[smaller_flg][mod_d][digit]\n\n dp[new_smaller_flg][new_mod_d][digit+1] %= MOD\n\n\n\nprint(((dp[1][0][int(len(str(K)))] + dp[0][0][int(len(str(K)))] - 1) % MOD))","target":"K = int(eval(input()))\n\nD = int(eval(input()))\n\nMOD = 10**9 + 7\n\n\n\ndp = [[[0]*D for _ in range(2)] for _ in range(int(len(str(K)))+1)]\n\ndp[0][0][0] = 1\n\n\n\n# \u5916\u5074\u306e\u8981\u7d20\u304b\u3089\u5916\u5074\u306e\u30eb\u30fc\u30d7\u306b\u7f6e\u304f\u3068\u53c2\u7167\u304c\u901f\u304f\u306a\u308b\n\nfor digit in range(int(len(str(K)))):\n\n for smaller_flg in [0,1]:\n\n lim = 9 if smaller_flg else int(str(K)[digit])\n\n for digit_num in range(lim+1):\n\n new_smaller_flg = smaller_flg or digit_num < lim\n\n for mod_d in range(D):\n\n new_mod_d = (mod_d + digit_num)%D\n\n dp[digit+1][new_smaller_flg][new_mod_d] += dp[digit][smaller_flg][mod_d]\n\n dp[digit+1][new_smaller_flg][new_mod_d] %= MOD\n\n\n\nprint(((dp[int(len(str(K)))][1][0] + dp[int(len(str(K)))][0][0] - 1) % MOD))","code_v0_loc":18,"code_v1_loc":19,"code_v0_num_chars":690,"code_v1_num_chars":716,"code_v0_no_empty_lines":"K = int(eval(input()))\nD = int(eval(input()))\nMOD = 10**9 + 7\ndp = [[[0] * (int(len(str(K))) + 1) for _ in range(D)] for _ in range(2)]\ndp[0][0][0] = 1\nfor digit in range(int(len(str(K)))):\n for smaller_flg in [0, 1]:\n lim = 9 if smaller_flg else int(str(K)[digit])\n for digit_num in range(lim + 1):\n new_smaller_flg = smaller_flg or digit_num < lim\n for mod_d in range(D):\n new_mod_d = (mod_d + digit_num) % D\n dp[new_smaller_flg][new_mod_d][digit + 1] += dp[smaller_flg][mod_d][\n digit\n ]\n dp[new_smaller_flg][new_mod_d][digit + 1] %= MOD\nprint(((dp[1][0][int(len(str(K)))] + dp[0][0][int(len(str(K)))] - 1) % MOD))\n","code_v1_no_empty_lines":"K = int(eval(input()))\nD = int(eval(input()))\nMOD = 10**9 + 7\ndp = [[[0] * D for _ in range(2)] for _ in range(int(len(str(K))) + 1)]\ndp[0][0][0] = 1\n# \u5916\u5074\u306e\u8981\u7d20\u304b\u3089\u5916\u5074\u306e\u30eb\u30fc\u30d7\u306b\u7f6e\u304f\u3068\u53c2\u7167\u304c\u901f\u304f\u306a\u308b\nfor digit in range(int(len(str(K)))):\n for smaller_flg in [0, 1]:\n lim = 9 if smaller_flg else int(str(K)[digit])\n for digit_num in range(lim + 1):\n new_smaller_flg = smaller_flg or digit_num < lim\n for mod_d in range(D):\n new_mod_d = (mod_d + digit_num) % D\n dp[digit + 1][new_smaller_flg][new_mod_d] += dp[digit][smaller_flg][\n mod_d\n ]\n dp[digit + 1][new_smaller_flg][new_mod_d] %= MOD\nprint(((dp[int(len(str(K)))][1][0] + dp[int(len(str(K)))][0][0] - 1) % MOD))\n","code_same":false,"relative_loc_diff_percent":5.2631578947,"diff":["-dp = [[[0] * (int(len(str(K))) + 1) for _ in range(D)] for _ in range(2)]","+dp = [[[0] * D for _ in range(2)] for _ in range(int(len(str(K))) + 1)]","+# \u5916\u5074\u306e\u8981\u7d20\u304b\u3089\u5916\u5074\u306e\u30eb\u30fc\u30d7\u306b\u7f6e\u304f\u3068\u53c2\u7167\u304c\u901f\u304f\u306a\u308b","- dp[new_smaller_flg][new_mod_d][digit + 1] += dp[smaller_flg][mod_d][","- digit","+ dp[digit + 1][new_smaller_flg][new_mod_d] += dp[digit][smaller_flg][","+ mod_d","- dp[new_smaller_flg][new_mod_d][digit + 1] %= MOD","-print(((dp[1][0][int(len(str(K)))] + dp[0][0][int(len(str(K)))] - 1) % MOD))","+ dp[digit + 1][new_smaller_flg][new_mod_d] %= MOD","+print(((dp[int(len(str(K)))][1][0] + dp[int(len(str(K)))][0][0] - 1) % MOD))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0423235524,"measured_runtime_v1":0.0414524541,"runtime_lift":1.0210143956,"key":["s947929347","s438857270"]} +{"user_id":"u991567869","problem_id":"p03103","language":"python","submission_id_v0":"s879058358","submission_id_v1":"s371477652","cpu_time_v0":393,"cpu_time_v1":246,"memory_v0":16980,"memory_v1":16920,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.4,"input":"def main():\n\n n, m = list(map(int, input().split()))\n\n\n\n ab = [tuple(map(int, input().split())) for _ in range(n)]\n\n ab.sort()\n\n ans = 0\n\n\n\n for i, j in ab:\n\n if m < j:\n\n ans += i*m\n\n break\n\n m -= j\n\n ans += i*j\n\n \n\n\n\n print(ans)\n\n\n\nmain()","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n, m = list(map(int, input().split()))\n\n\n\n ab = [tuple(map(int, input().split())) for _ in range(n)]\n\n ab.sort()\n\n ans = 0\n\n\n\n for i, j in ab:\n\n if m < j:\n\n ans += i*m\n\n break\n\n m -= j\n\n ans += i*j\n\n \n\n\n\n print(ans)\n\n\n\nmain()","code_v0_loc":18,"code_v1_loc":21,"code_v0_num_chars":301,"code_v1_num_chars":343,"code_v0_no_empty_lines":"def main():\n n, m = list(map(int, input().split()))\n ab = [tuple(map(int, input().split())) for _ in range(n)]\n ab.sort()\n ans = 0\n for i, j in ab:\n if m < j:\n ans += i * m\n break\n m -= j\n ans += i * j\n print(ans)\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, m = list(map(int, input().split()))\n ab = [tuple(map(int, input().split())) for _ in range(n)]\n ab.sort()\n ans = 0\n for i, j in ab:\n if m < j:\n ans += i * m\n break\n m -= j\n ans += i * j\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+import sys","+","+input = sys.stdin.readline","+","+"],"diff_only_import_comment":false,"measured_runtime_v0":0.0412075615,"measured_runtime_v1":0.0379588151,"runtime_lift":1.0855860852,"key":["s879058358","s371477652"]} +{"user_id":"u952708174","problem_id":"p03816","language":"python","submission_id_v0":"s545598383","submission_id_v1":"s190011133","cpu_time_v0":84,"cpu_time_v1":54,"memory_v0":21276,"memory_v1":14500,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.71,"input":"def d_CardEater(N, A):\n\n from collections import Counter, defaultdict\n\n a = Counter(A) # a[i]\u306f\u6570\u5217\u306e\u4e2d\u306bi\u304c\u4f55\u56de\u51fa\u305f\u304b\n\n a = sorted(list(a.items()), key=lambda x: x[0])\n\n d = defaultdict(int) # a\u306e\u3046\u30612\u56de\u4ee5\u4e0a\u51fa\u305f\u5024\u306e\u4e00\u89a7\n\n for k, v in a:\n\n if v >= 2:\n\n d[k] = v - 1 # \u3042\u3068\u306e\u8a08\u7b97\u306e\u4fbf\u5b9c\u306e\u305f\u3081\u30011\u5f15\u3044\u3066\u304a\u304f\n\n n = sum(d.values()) # \u5c11\u306a\u304f\u3068\u3082\u5024\u304c\u91cd\u8907\u3057\u305fn\u679a\u5206\u306f\u6368\u3066\u308b\u3053\u3068\u306b\u306a\u308b\n\n if n % 2 == 0:\n\n ans = N - n\n\n else:\n\n # n\u304c\u5947\u6570\u3060\u3068\u3001\u5c71\u672dd\u306e\u4e2d\u306e\u30ab\u30fc\u30c9\u306e\u3046\u30611\u679a\u3092\u3001\u5024\u306e\u91cd\u8907\u304c\u306a\u3044\u30ab\u30fc\u30c9\u304b\u3089\u306a\u308b\n\n # \u5c71\u306e\u4e2d\u306e1\u679a\u3092\u9053\u9023\u308c\u306b\u3057\u3066\u6368\u3066\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u3001\u3055\u3089\u306b1\u5f15\u304f\n\n ans = N - n - 1\n\n return ans\n\n\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nprint((d_CardEater(N, A)))","target":"def d_card_eater(N, A):\n\n # \u89e3\u8aac\u3069\u304a\u308a\n\n from collections import Counter\n\n kind = len(set(A)) # \u6570\u5217\u306b\u73fe\u308c\u308b\u5024\u306e\u7a2e\u985e\u306e\u6570\n\n ans = kind if kind % 2 == 1 else kind - 1\n\n return ans\n\n\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nprint((d_card_eater(N, A)))","code_v0_loc":20,"code_v1_loc":10,"code_v0_num_chars":613,"code_v1_num_chars":262,"code_v0_no_empty_lines":"def d_CardEater(N, A):\n from collections import Counter, defaultdict\n\n a = Counter(A) # a[i]\u306f\u6570\u5217\u306e\u4e2d\u306bi\u304c\u4f55\u56de\u51fa\u305f\u304b\n a = sorted(list(a.items()), key=lambda x: x[0])\n d = defaultdict(int) # a\u306e\u3046\u30612\u56de\u4ee5\u4e0a\u51fa\u305f\u5024\u306e\u4e00\u89a7\n for k, v in a:\n if v >= 2:\n d[k] = v - 1 # \u3042\u3068\u306e\u8a08\u7b97\u306e\u4fbf\u5b9c\u306e\u305f\u3081\u30011\u5f15\u3044\u3066\u304a\u304f\n n = sum(d.values()) # \u5c11\u306a\u304f\u3068\u3082\u5024\u304c\u91cd\u8907\u3057\u305fn\u679a\u5206\u306f\u6368\u3066\u308b\u3053\u3068\u306b\u306a\u308b\n if n % 2 == 0:\n ans = N - n\n else:\n # n\u304c\u5947\u6570\u3060\u3068\u3001\u5c71\u672dd\u306e\u4e2d\u306e\u30ab\u30fc\u30c9\u306e\u3046\u30611\u679a\u3092\u3001\u5024\u306e\u91cd\u8907\u304c\u306a\u3044\u30ab\u30fc\u30c9\u304b\u3089\u306a\u308b\n # \u5c71\u306e\u4e2d\u306e1\u679a\u3092\u9053\u9023\u308c\u306b\u3057\u3066\u6368\u3066\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u3001\u3055\u3089\u306b1\u5f15\u304f\n ans = N - n - 1\n return ans\n\n\nN = int(eval(input()))\nA = [int(i) for i in input().split()]\nprint((d_CardEater(N, A)))\n","code_v1_no_empty_lines":"def d_card_eater(N, A):\n # \u89e3\u8aac\u3069\u304a\u308a\n from collections import Counter\n\n kind = len(set(A)) # \u6570\u5217\u306b\u73fe\u308c\u308b\u5024\u306e\u7a2e\u985e\u306e\u6570\n ans = kind if kind % 2 == 1 else kind - 1\n return ans\n\n\nN = int(eval(input()))\nA = [int(i) for i in input().split()]\nprint((d_card_eater(N, A)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-def d_CardEater(N, A):","- from collections import Counter, defaultdict","+def d_card_eater(N, A):","+ # \u89e3\u8aac\u3069\u304a\u308a","+ from collections import Counter","- a = Counter(A) # a[i]\u306f\u6570\u5217\u306e\u4e2d\u306bi\u304c\u4f55\u56de\u51fa\u305f\u304b","- a = sorted(list(a.items()), key=lambda x: x[0])","- d = defaultdict(int) # a\u306e\u3046\u30612\u56de\u4ee5\u4e0a\u51fa\u305f\u5024\u306e\u4e00\u89a7","- for k, v in a:","- if v >= 2:","- d[k] = v - 1 # \u3042\u3068\u306e\u8a08\u7b97\u306e\u4fbf\u5b9c\u306e\u305f\u3081\u30011\u5f15\u3044\u3066\u304a\u304f","- n = sum(d.values()) # \u5c11\u306a\u304f\u3068\u3082\u5024\u304c\u91cd\u8907\u3057\u305fn\u679a\u5206\u306f\u6368\u3066\u308b\u3053\u3068\u306b\u306a\u308b","- if n % 2 == 0:","- ans = N - n","- else:","- # n\u304c\u5947\u6570\u3060\u3068\u3001\u5c71\u672dd\u306e\u4e2d\u306e\u30ab\u30fc\u30c9\u306e\u3046\u30611\u679a\u3092\u3001\u5024\u306e\u91cd\u8907\u304c\u306a\u3044\u30ab\u30fc\u30c9\u304b\u3089\u306a\u308b","- # \u5c71\u306e\u4e2d\u306e1\u679a\u3092\u9053\u9023\u308c\u306b\u3057\u3066\u6368\u3066\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u3001\u3055\u3089\u306b1\u5f15\u304f","- ans = N - n - 1","+ kind = len(set(A)) # \u6570\u5217\u306b\u73fe\u308c\u308b\u5024\u306e\u7a2e\u985e\u306e\u6570","+ ans = kind if kind % 2 == 1 else kind - 1","-print((d_CardEater(N, A)))","+print((d_card_eater(N, A)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0377722023,"measured_runtime_v1":0.0379533687,"runtime_lift":0.9952266071,"key":["s545598383","s190011133"]} +{"user_id":"u777283665","problem_id":"p03556","language":"python","submission_id_v0":"s426014153","submission_id_v1":"s407006439","cpu_time_v0":114,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.09,"input":"n = int(eval(input()))\n\n\n\nfor i in range(n, 0, -1):\n\n if str(i ** 0.5)[-1] == \"0\":\n\n print(i)\n\n exit()","target":"import math\n\nn = int(eval(input()))\n\nprint((math.floor(n**0.5)**2))","code_v0_loc":6,"code_v1_loc":3,"code_v0_num_chars":103,"code_v1_num_chars":61,"code_v0_no_empty_lines":"n = int(eval(input()))\nfor i in range(n, 0, -1):\n if str(i**0.5)[-1] == \"0\":\n print(i)\n exit()\n","code_v1_no_empty_lines":"import math\n\nn = int(eval(input()))\nprint((math.floor(n**0.5) ** 2))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["+import math","+","-for i in range(n, 0, -1):","- if str(i**0.5)[-1] == \"0\":","- print(i)","- exit()","+print((math.floor(n**0.5) ** 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0562601099,"measured_runtime_v1":0.0779884007,"runtime_lift":0.7213907375,"key":["s426014153","s407006439"]} +{"user_id":"u677121387","problem_id":"p03013","language":"python","submission_id_v0":"s703427225","submission_id_v1":"s311250018","cpu_time_v0":1665,"cpu_time_v1":190,"memory_v0":7080,"memory_v1":7848,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.59,"input":"n,m = list(map(int,input().split()))\n\naa = [int(eval(input())) for i in range(m)]\n\n\n\ncnt2 = 0\n\ncnt1 = 1\n\naa.append(-1)\n\na = aa.pop(0)\n\n\n\n\n\nfor i in range(1,n):\n\n if i == a:\n\n cnt2, cnt1 = cnt1, 0\n\n a = aa.pop(0)\n\n else:\n\n cnt2, cnt1 = cnt1, cnt2+cnt1\n\nelse:\n\n ans = (cnt2+cnt1)%1000000007\n\n\n\nprint(ans)","target":"n,m = list(map(int,input().split()))\n\na = [int(eval(input())) for _ in range(m)]\n\na.append(-1)\n\nidx = 0\n\nmod = 10**9+7\n\ndp = [0]*(n+1)\n\n\n\ndp[0] = 1\n\nif a[idx] == 1: idx += 1\n\nelse: dp[1] = 1\n\n\n\nfor i in range(2,n+1):\n\n if i == a[idx]:\n\n dp[i] = 0\n\n idx += 1\n\n else:\n\n dp[i] = (dp[i-1] + dp[i-2])%mod\n\n \n\nprint((dp[n]))","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":320,"code_v1_num_chars":338,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\naa = [int(eval(input())) for i in range(m)]\ncnt2 = 0\ncnt1 = 1\naa.append(-1)\na = aa.pop(0)\nfor i in range(1, n):\n if i == a:\n cnt2, cnt1 = cnt1, 0\n a = aa.pop(0)\n else:\n cnt2, cnt1 = cnt1, cnt2 + cnt1\nelse:\n ans = (cnt2 + cnt1) % 1000000007\nprint(ans)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\na = [int(eval(input())) for _ in range(m)]\na.append(-1)\nidx = 0\nmod = 10**9 + 7\ndp = [0] * (n + 1)\ndp[0] = 1\nif a[idx] == 1:\n idx += 1\nelse:\n dp[1] = 1\nfor i in range(2, n + 1):\n if i == a[idx]:\n dp[i] = 0\n idx += 1\n else:\n dp[i] = (dp[i - 1] + dp[i - 2]) % mod\nprint((dp[n]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-aa = [int(eval(input())) for i in range(m)]","-cnt2 = 0","-cnt1 = 1","-aa.append(-1)","-a = aa.pop(0)","-for i in range(1, n):","- if i == a:","- cnt2, cnt1 = cnt1, 0","- a = aa.pop(0)","+a = [int(eval(input())) for _ in range(m)]","+a.append(-1)","+idx = 0","+mod = 10**9 + 7","+dp = [0] * (n + 1)","+dp[0] = 1","+if a[idx] == 1:","+ idx += 1","+else:","+ dp[1] = 1","+for i in range(2, n + 1):","+ if i == a[idx]:","+ dp[i] = 0","+ idx += 1","- cnt2, cnt1 = cnt1, cnt2 + cnt1","-else:","- ans = (cnt2 + cnt1) % 1000000007","-print(ans)","+ dp[i] = (dp[i - 1] + dp[i - 2]) % mod","+print((dp[n]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0384787159,"measured_runtime_v1":0.0367817531,"runtime_lift":1.0461359963,"key":["s703427225","s311250018"]} +{"user_id":"u847467233","problem_id":"p00084","language":"python","submission_id_v0":"s126792154","submission_id_v1":"s100463996","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":6508,"memory_v1":6504,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"# AOJ 0084 Search Engine\n\n# Python3 2018.6.15 bal4u\n\n\n\nimport re\n\n\n\ns = re.split('[., ]', eval(input()))\n\nans = []\n\nfor i in s:\n\n\tif len(i) >= 3 and len(i) <= 6:\n\n\t\tans.append(i)\n\nprint((*ans))\n\n\n","target":"# AOJ 0084 Search Engine\n\n# Python3 2018.6.15 bal4u\n\n\n\nimport re\n\n\n\ns = re.split('[., ]', eval(input()))\n\nans = []\n\nfor i in s:\n\n\tif 3 <= len(i) <= 6:\n\n\t\tans.append(i)\n\nprint((*ans))\n\n\n","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":188,"code_v1_num_chars":177,"code_v0_no_empty_lines":"# AOJ 0084 Search Engine\n# Python3 2018.6.15 bal4u\nimport re\n\ns = re.split(\"[., ]\", eval(input()))\nans = []\nfor i in s:\n if len(i) >= 3 and len(i) <= 6:\n ans.append(i)\nprint((*ans))\n","code_v1_no_empty_lines":"# AOJ 0084 Search Engine\n# Python3 2018.6.15 bal4u\nimport re\n\ns = re.split(\"[., ]\", eval(input()))\nans = []\nfor i in s:\n if 3 <= len(i) <= 6:\n ans.append(i)\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if len(i) >= 3 and len(i) <= 6:","+ if 3 <= len(i) <= 6:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0532229825,"measured_runtime_v1":0.1195193503,"runtime_lift":0.445308499,"key":["s126792154","s100463996"]} +{"user_id":"u043048943","problem_id":"p02659","language":"python","submission_id_v0":"s482373151","submission_id_v1":"s971994617","cpu_time_v0":71,"cpu_time_v1":65,"memory_v0":65504,"memory_v1":65376,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.45,"input":"def main():\n\n from sys import setrecursionlimit, stdin\n\n from os import environ\n\n from collections import defaultdict, deque, Counter\n\n from math import ceil, floor, gcd\n\n from itertools import accumulate, combinations, combinations_with_replacement\n\n setrecursionlimit(10**6)\n\n dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0\n\n input = lambda: stdin.readline().rstrip()\n\n LMIIS = lambda: list(map(int,input().split()))\n\n II = lambda: int(input())\n\n P = 10**9+7\n\n INF = 10**9+10\n\n\n\n sa,sb = input().split()\n\n a = int(sa)\n\n sb = sb.split('.')\n\n b100 = int(sb[0])*100\n\n if len(sb) ==2:\n\n b100 += int(sb[1])\n\n print(a*b100\/\/100)\n\n # print(int(a*(b*10**2))\/\/10**2)\n\n # print(int(a),int(b*10**2))\n\n # print(int(a)*int(b*10**2)\/\/10**2)\n\n \n\nmain()\n\n#999999999999999 9.99\n","target":"def main():\n\n from sys import setrecursionlimit, stdin\n\n from os import environ\n\n from collections import defaultdict, deque, Counter\n\n from math import ceil, floor, gcd\n\n from itertools import accumulate, combinations, combinations_with_replacement\n\n setrecursionlimit(10**6)\n\n dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0\n\n input = lambda: stdin.readline().rstrip()\n\n LMIIS = lambda: list(map(int,input().split()))\n\n II = lambda: int(input())\n\n P = 10**9+7\n\n INF = 10**9+10\n\n sa,sb = input().split()\n\n a = int(sa)\n\n b = int(float(sb)*100+0.5)\n\n print(a*b\/\/100)\n\n\n\n \n\nmain()\n","code_v0_loc":27,"code_v1_loc":20,"code_v0_num_chars":880,"code_v1_num_chars":674,"code_v0_no_empty_lines":"def main():\n from sys import setrecursionlimit, stdin\n from os import environ\n from collections import defaultdict, deque, Counter\n from math import ceil, floor, gcd\n from itertools import accumulate, combinations, combinations_with_replacement\n\n setrecursionlimit(10**6)\n dbg = (\n (lambda *something: print(*something))\n if \"TERM_PROGRAM\" in environ\n else lambda *x: 0\n )\n input = lambda: stdin.readline().rstrip()\n LMIIS = lambda: list(map(int, input().split()))\n II = lambda: int(input())\n P = 10**9 + 7\n INF = 10**9 + 10\n sa, sb = input().split()\n a = int(sa)\n sb = sb.split(\".\")\n b100 = int(sb[0]) * 100\n if len(sb) == 2:\n b100 += int(sb[1])\n print(a * b100 \/\/ 100)\n # print(int(a*(b*10**2))\/\/10**2)\n # print(int(a),int(b*10**2))\n # print(int(a)*int(b*10**2)\/\/10**2)\n\n\nmain()\n# 999999999999999 9.99\n","code_v1_no_empty_lines":"def main():\n from sys import setrecursionlimit, stdin\n from os import environ\n from collections import defaultdict, deque, Counter\n from math import ceil, floor, gcd\n from itertools import accumulate, combinations, combinations_with_replacement\n\n setrecursionlimit(10**6)\n dbg = (\n (lambda *something: print(*something))\n if \"TERM_PROGRAM\" in environ\n else lambda *x: 0\n )\n input = lambda: stdin.readline().rstrip()\n LMIIS = lambda: list(map(int, input().split()))\n II = lambda: int(input())\n P = 10**9 + 7\n INF = 10**9 + 10\n sa, sb = input().split()\n a = int(sa)\n b = int(float(sb) * 100 + 0.5)\n print(a * b \/\/ 100)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":25.9259259259,"diff":["- sb = sb.split(\".\")","- b100 = int(sb[0]) * 100","- if len(sb) == 2:","- b100 += int(sb[1])","- print(a * b100 \/\/ 100)","- # print(int(a*(b*10**2))\/\/10**2)","- # print(int(a),int(b*10**2))","- # print(int(a)*int(b*10**2)\/\/10**2)","+ b = int(float(sb) * 100 + 0.5)","+ print(a * b \/\/ 100)","-# 999999999999999 9.99"],"diff_only_import_comment":false,"measured_runtime_v0":0.0534128504,"measured_runtime_v1":0.0493831997,"runtime_lift":1.081599627,"key":["s482373151","s971994617"]} +{"user_id":"u189023301","problem_id":"p03244","language":"python","submission_id_v0":"s846799035","submission_id_v1":"s783203690","cpu_time_v0":106,"cpu_time_v1":98,"memory_v0":21184,"memory_v1":21184,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.55,"input":"from collections import Counter\n\nn = int(eval(input()))\n\nlis = list(map(int, input().split()))\n\n\n\na = Counter(lis[::2])\n\nb = Counter(lis[1::2])\n\n\n\naa = sorted(list(a.items()), key=lambda x:x[1], reverse=True)\n\nbb = sorted(list(b.items()), key=lambda x:x[1], reverse=True)\n\n\n\nif aa[0][0] == bb[0][0]:\n\n if len(aa) > 1 and len(bb) > 1:\n\n res = n - max(aa[0][1]+bb[1][1], aa[1][1]+bb[0][1])\n\n elif len(aa) == 1 and len(bb) > 1:\n\n res = n - aa[0][1] - bb[1][1]\n\n elif len(aa) > 1 and len(bb) == 1:\n\n res = n - aa[1][1] - bb[0][1]\n\n else:\n\n res = n - aa[0][1]\n\nelse:\n\n res = n - aa[0][1] - bb[0][1]\n\n\n\nprint(res)\n","target":"from collections import Counter\n\nn = int(eval(input()))\n\nlis = list(map(int, input().split()))\n\n\n\na = Counter(lis[::2])\n\nb = Counter(lis[1::2])\n\n\n\naa = sorted(list(a.items()), key=lambda x:x[1], reverse=True)\n\nbb = sorted(list(b.items()), key=lambda x:x[1], reverse=True)\n\n\n\naa.append((0, 0))\n\nbb.append((0, 0))\n\n\n\nif aa[0][0] == bb[0][0]:\n\n res = n - max(aa[0][1]+bb[1][1], aa[1][1]+bb[0][1])\n\nelse:\n\n res = n - aa[0][1] - bb[0][1]\n\nprint(res)\n","code_v0_loc":23,"code_v1_loc":18,"code_v0_num_chars":633,"code_v1_num_chars":433,"code_v0_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\nlis = list(map(int, input().split()))\na = Counter(lis[::2])\nb = Counter(lis[1::2])\naa = sorted(list(a.items()), key=lambda x: x[1], reverse=True)\nbb = sorted(list(b.items()), key=lambda x: x[1], reverse=True)\nif aa[0][0] == bb[0][0]:\n if len(aa) > 1 and len(bb) > 1:\n res = n - max(aa[0][1] + bb[1][1], aa[1][1] + bb[0][1])\n elif len(aa) == 1 and len(bb) > 1:\n res = n - aa[0][1] - bb[1][1]\n elif len(aa) > 1 and len(bb) == 1:\n res = n - aa[1][1] - bb[0][1]\n else:\n res = n - aa[0][1]\nelse:\n res = n - aa[0][1] - bb[0][1]\nprint(res)\n","code_v1_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\nlis = list(map(int, input().split()))\na = Counter(lis[::2])\nb = Counter(lis[1::2])\naa = sorted(list(a.items()), key=lambda x: x[1], reverse=True)\nbb = sorted(list(b.items()), key=lambda x: x[1], reverse=True)\naa.append((0, 0))\nbb.append((0, 0))\nif aa[0][0] == bb[0][0]:\n res = n - max(aa[0][1] + bb[1][1], aa[1][1] + bb[0][1])\nelse:\n res = n - aa[0][1] - bb[0][1]\nprint(res)\n","code_same":false,"relative_loc_diff_percent":21.7391304348,"diff":["+aa.append((0, 0))","+bb.append((0, 0))","- if len(aa) > 1 and len(bb) > 1:","- res = n - max(aa[0][1] + bb[1][1], aa[1][1] + bb[0][1])","- elif len(aa) == 1 and len(bb) > 1:","- res = n - aa[0][1] - bb[1][1]","- elif len(aa) > 1 and len(bb) == 1:","- res = n - aa[1][1] - bb[0][1]","- else:","- res = n - aa[0][1]","+ res = n - max(aa[0][1] + bb[1][1], aa[1][1] + bb[0][1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0739126174,"measured_runtime_v1":0.0449351468,"runtime_lift":1.6448731712,"key":["s846799035","s783203690"]} +{"user_id":"u190405389","problem_id":"p03317","language":"python","submission_id_v0":"s012562698","submission_id_v1":"s831320423","cpu_time_v0":39,"cpu_time_v1":17,"memory_v0":13812,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.41,"input":"import math\n\n\n\nn,k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\n\n\nans = math.ceil((n-1)\/(k-1))\n\n\n\nprint(ans)","target":"n,k = list(map(int, input().split()))\n\n\n\nif (n-1)%(k-1)==0:\n\n print(((n-1)\/\/(k-1)))\n\nelse:\n\n print(((n-1)\/\/(k-1)+1))\n","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":129,"code_v1_num_chars":113,"code_v0_no_empty_lines":"import math\n\nn, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nans = math.ceil((n - 1) \/ (k - 1))\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nif (n - 1) % (k - 1) == 0:\n print(((n - 1) \/\/ (k - 1)))\nelse:\n print(((n - 1) \/\/ (k - 1) + 1))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import math","-","-a = list(map(int, input().split()))","-ans = math.ceil((n - 1) \/ (k - 1))","-print(ans)","+if (n - 1) % (k - 1) == 0:","+ print(((n - 1) \/\/ (k - 1)))","+else:","+ print(((n - 1) \/\/ (k - 1) + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1017833889,"measured_runtime_v1":0.0357276499,"runtime_lift":2.8488688462,"key":["s012562698","s831320423"]} +{"user_id":"u699547221","problem_id":"p02718","language":"python","submission_id_v0":"s494701467","submission_id_v1":"s783721199","cpu_time_v0":167,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.82,"input":"n,m=list(map(int,input().split()))\n\nb=list(map(int,input().split()))\n\ns=sum(b)\n\na=[i for i in b if i>=s\/(4*m)]\n\nprint((\"Yes\" if len(a)>=m else \"No\"))","target":"a = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\n\n\ncnt = 0\n\nfor i in b:\n\n if i >= sum(b)\/(4*a[1]):\n\n cnt +=1\n\n else:\n\n pass\n\n \n\nif cnt >= a[1]:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":5,"code_v1_loc":14,"code_v0_num_chars":141,"code_v1_num_chars":233,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nb = list(map(int, input().split()))\ns = sum(b)\na = [i for i in b if i >= s \/ (4 * m)]\nprint((\"Yes\" if len(a) >= m else \"No\"))\n","code_v1_no_empty_lines":"a = list(map(int, input().split()))\nb = list(map(int, input().split()))\ncnt = 0\nfor i in b:\n if i >= sum(b) \/ (4 * a[1]):\n cnt += 1\n else:\n pass\nif cnt >= a[1]:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":64.2857142857,"diff":["-n, m = list(map(int, input().split()))","+a = list(map(int, input().split()))","-s = sum(b)","-a = [i for i in b if i >= s \/ (4 * m)]","-print((\"Yes\" if len(a) >= m else \"No\"))","+cnt = 0","+for i in b:","+ if i >= sum(b) \/ (4 * a[1]):","+ cnt += 1","+ else:","+ pass","+if cnt >= a[1]:","+ print(\"Yes\")","+else:","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0415764661,"measured_runtime_v1":0.0383280671,"runtime_lift":1.0847524871,"key":["s494701467","s783721199"]} +{"user_id":"u631277801","problem_id":"p03246","language":"python","submission_id_v0":"s745620423","submission_id_v1":"s873171026","cpu_time_v0":109,"cpu_time_v1":82,"memory_v0":20736,"memory_v1":18720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.77,"input":"import sys\n\nstdin = sys.stdin\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x)-1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nfrom collections import Counter\n\n\n\nn = ni()\n\na = list(li())\n\n\n\neven = Counter(a[::2])\n\nodd = Counter(a[1::2])\n\n\n\nes = [(0,0)]\n\nfor ek,ev in list(even.items()):\n\n es.append((ev,ek))\n\n \n\nes.sort()\n\n \n\n \n\nos = [(0,0)]\n\nfor ok,ov in list(odd.items()):\n\n os.append((ov,ok))\n\n \n\nos.sort()\n\n \n\n\n\nif es[-1][1] != os[-1][1]:\n\n print(((n\/\/2-es[-1][0]) + (n\/\/2-os[-1][0])))\n\nelse:\n\n print((min((n\/\/2-es[-1][0]) + (n\/\/2-os[-2][0]),\n\n (n\/\/2-es[-2][0]) + (n\/\/2-os[-1][0]))))","target":"import sys\n\nstdin = sys.stdin\n\n\n\ndef li(): return list(map(int, stdin.readline().split()))\n\ndef li_(): return [int(x)-1 for x in stdin.readline().split()]\n\ndef lf(): return list(map(float, stdin.readline().split()))\n\ndef ls(): return stdin.readline().split()\n\ndef ns(): return stdin.readline().rstrip()\n\ndef lc(): return list(ns())\n\ndef ni(): return int(stdin.readline())\n\ndef nf(): return float(stdin.readline())\n\n\n\nfrom collections import Counter\n\n\n\nn = ni()\n\na = list(li())\n\n\n\neven = Counter(a[::2])\n\nodd = Counter(a[1::2])\n\n\n\nes = even.most_common(2)\n\nos = odd.most_common(2)\n\n\n\nes = es + [(0,0)]\n\nos = os + [(0,0)]\n\n\n\nif es[0][0] != os[0][0]:\n\n print(((n\/\/2-es[0][1]) + (n\/\/2-os[0][1])))\n\nelse:\n\n print((min((n\/\/2-es[1][1]) + (n\/\/2-os[0][1]),\n\n (n\/\/2-es[0][1]) + (n\/\/2-os[1][1]))))","code_v0_loc":39,"code_v1_loc":31,"code_v0_num_chars":894,"code_v1_num_chars":794,"code_v0_no_empty_lines":"import sys\n\nstdin = sys.stdin\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nfrom collections import Counter\n\nn = ni()\na = list(li())\neven = Counter(a[::2])\nodd = Counter(a[1::2])\nes = [(0, 0)]\nfor ek, ev in list(even.items()):\n es.append((ev, ek))\nes.sort()\nos = [(0, 0)]\nfor ok, ov in list(odd.items()):\n os.append((ov, ok))\nos.sort()\nif es[-1][1] != os[-1][1]:\n print(((n \/\/ 2 - es[-1][0]) + (n \/\/ 2 - os[-1][0])))\nelse:\n print(\n (\n min(\n (n \/\/ 2 - es[-1][0]) + (n \/\/ 2 - os[-2][0]),\n (n \/\/ 2 - es[-2][0]) + (n \/\/ 2 - os[-1][0]),\n )\n )\n )\n","code_v1_no_empty_lines":"import sys\n\nstdin = sys.stdin\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef li_():\n return [int(x) - 1 for x in stdin.readline().split()]\n\n\ndef lf():\n return list(map(float, stdin.readline().split()))\n\n\ndef ls():\n return stdin.readline().split()\n\n\ndef ns():\n return stdin.readline().rstrip()\n\n\ndef lc():\n return list(ns())\n\n\ndef ni():\n return int(stdin.readline())\n\n\ndef nf():\n return float(stdin.readline())\n\n\nfrom collections import Counter\n\nn = ni()\na = list(li())\neven = Counter(a[::2])\nodd = Counter(a[1::2])\nes = even.most_common(2)\nos = odd.most_common(2)\nes = es + [(0, 0)]\nos = os + [(0, 0)]\nif es[0][0] != os[0][0]:\n print(((n \/\/ 2 - es[0][1]) + (n \/\/ 2 - os[0][1])))\nelse:\n print(\n (\n min(\n (n \/\/ 2 - es[1][1]) + (n \/\/ 2 - os[0][1]),\n (n \/\/ 2 - es[0][1]) + (n \/\/ 2 - os[1][1]),\n )\n )\n )\n","code_same":false,"relative_loc_diff_percent":20.5128205128,"diff":["-es = [(0, 0)]","-for ek, ev in list(even.items()):","- es.append((ev, ek))","-es.sort()","-os = [(0, 0)]","-for ok, ov in list(odd.items()):","- os.append((ov, ok))","-os.sort()","-if es[-1][1] != os[-1][1]:","- print(((n \/\/ 2 - es[-1][0]) + (n \/\/ 2 - os[-1][0])))","+es = even.most_common(2)","+os = odd.most_common(2)","+es = es + [(0, 0)]","+os = os + [(0, 0)]","+if es[0][0] != os[0][0]:","+ print(((n \/\/ 2 - es[0][1]) + (n \/\/ 2 - os[0][1])))","- (n \/\/ 2 - es[-1][0]) + (n \/\/ 2 - os[-2][0]),","- (n \/\/ 2 - es[-2][0]) + (n \/\/ 2 - os[-1][0]),","+ (n \/\/ 2 - es[1][1]) + (n \/\/ 2 - os[0][1]),","+ (n \/\/ 2 - es[0][1]) + (n \/\/ 2 - os[1][1]),"],"diff_only_import_comment":false,"measured_runtime_v0":0.0418525696,"measured_runtime_v1":0.0763627529,"runtime_lift":0.5480757042,"key":["s745620423","s873171026"]} +{"user_id":"u941284420","problem_id":"p03107","language":"python","submission_id_v0":"s389692455","submission_id_v1":"s578563376","cpu_time_v0":42,"cpu_time_v1":19,"memory_v0":3956,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.76,"input":"#!\/usr\/bin\/env python3\n\n\n\ndef solve(S: str):\n\n stack = []\n\n N = len(S)\n\n for i, s in enumerate(S):\n\n if i == 0:\n\n stack.append(s)\n\n else:\n\n if len(stack) == 0:\n\n stack.append(s)\n\n else:\n\n if s != stack[-1]:\n\n tmp = stack.pop()\n\n else:\n\n stack.append(s)\n\n print((N - len(stack)))\n\n\n\n# Generated by 1.1.6 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n S = str(eval(input()))\n\n solve(S)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"#!\/usr\/bin\/env python3\n\n\n\ndef solve_short(S: str):\n\n print((2*min(S.count('0'), S.count('1'))))\n\n\n\ndef solve(S: str):\n\n stack = []\n\n N = len(S)\n\n for i, s in enumerate(S):\n\n if i == 0:\n\n stack.append(s)\n\n else:\n\n if len(stack) == 0:\n\n stack.append(s)\n\n else:\n\n if s != stack[-1]:\n\n tmp = stack.pop()\n\n else:\n\n stack.append(s)\n\n print((N - len(stack)))\n\n\n\n# Generated by 1.1.6 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n\ndef main():\n\n S = str(eval(input()))\n\n solve_short(S)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":25,"code_v1_loc":28,"code_v0_num_chars":679,"code_v1_num_chars":759,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\ndef solve(S: str):\n stack = []\n N = len(S)\n for i, s in enumerate(S):\n if i == 0:\n stack.append(s)\n else:\n if len(stack) == 0:\n stack.append(s)\n else:\n if s != stack[-1]:\n tmp = stack.pop()\n else:\n stack.append(s)\n print((N - len(stack)))\n\n\n# Generated by 1.1.6 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n S = str(eval(input()))\n solve(S)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\ndef solve_short(S: str):\n print((2 * min(S.count(\"0\"), S.count(\"1\"))))\n\n\ndef solve(S: str):\n stack = []\n N = len(S)\n for i, s in enumerate(S):\n if i == 0:\n stack.append(s)\n else:\n if len(stack) == 0:\n stack.append(s)\n else:\n if s != stack[-1]:\n tmp = stack.pop()\n else:\n stack.append(s)\n print((N - len(stack)))\n\n\n# Generated by 1.1.6 https:\/\/github.com\/kyuridenamida\/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n S = str(eval(input()))\n solve_short(S)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":10.7142857143,"diff":["+def solve_short(S: str):","+ print((2 * min(S.count(\"0\"), S.count(\"1\"))))","+","+","- solve(S)","+ solve_short(S)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0329264112,"measured_runtime_v1":0.0359351201,"runtime_lift":0.9162738582,"key":["s389692455","s578563376"]} +{"user_id":"u070201429","problem_id":"p02540","language":"python","submission_id_v0":"s272154145","submission_id_v1":"s871199269","cpu_time_v0":1318,"cpu_time_v1":329,"memory_v0":118544,"memory_v1":88272,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.04,"input":"# Reference: https:\/\/note.nkmk.me\/python-union-find\/\n\nclass UnionFind:\n\n # if x is root: self.parents[x] = -(the number of the group nodes)\n\n # else: self.parents[x] = the parent of x\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n # return the parent of x\n\n def find(self, x):\n\n history = []\n\n while self.parents[x] >= 0:\n\n history.append(x)\n\n x = self.parents[x]\n\n for node in history:\n\n self.parents[node] = x\n\n return x\n\n\n\n # merge the group of x and the group of y\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:\n\n return\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n # return the size of the group of x\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n\n\n # return whether x and y in a same group\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n # return [all nodes which is in the group of x]\n\n # O(n)\n\n def members(self, x):\n\n root = self.find(x)\n\n return [i for i in range(self.n) if self.find(i) == root]\n\n\n\n # return [all roots]\n\n # O(n)\n\n def roots(self):\n\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n\n\n # return {root: members of the group}\n\n # O(n * n)\n\n def all_group_members(self):\n\n return {r: self.members(r) for r in self.roots()}\n\n\n\nfrom bisect import bisect\n\nfrom sys import stdin\n\ninput = stdin.buffer.readline\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n\n\n l = [0] * n\n\n for i in range(n):\n\n x, y = list(map(int, input().split()))\n\n l[x-1] = (y - 1, i)\n\n\n\n # i\u3067\u7ba1\u7406\n\n uf = UnionFind(n)\n\n roots = []\n\n\n\n for y, i in l:\n\n if len(roots) == 0 or -roots[-1][0] > y:\n\n roots.append((-y, i))\n\n else:\n\n ind = bisect(roots, (-y, i))\n\n new_y = roots[-1][0]\n\n for old_y, old_i in roots[ind:]:\n\n uf.union(i, old_i)\n\n roots = roots[:ind]\n\n roots.append((new_y, i))\n\n\n\n for i in range(n):\n\n print((uf.size(i)))\n\n\n\nmain()","target":"# Reference: https:\/\/note.nkmk.me\/python-union-find\/\n\nclass UnionFind:\n\n # if x is root: self.parents[x] = -(the number of the group nodes)\n\n # else: self.parents[x] = the parent of x\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n # return the parent of x\n\n def find(self, x):\n\n history = []\n\n while self.parents[x] >= 0:\n\n history.append(x)\n\n x = self.parents[x]\n\n for node in history:\n\n self.parents[node] = x\n\n return x\n\n\n\n # merge the group of x and the group of y\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n if x == y:\n\n return\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n # return the size of the group of x\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n\n\nfrom sys import stdin\n\ninput = stdin.buffer.readline\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n\n\n l = [0] * n\n\n for i in range(n):\n\n x, y = list(map(int, input().split()))\n\n l[x-1] = (y-1, i)\n\n\n\n uf = UnionFind(n)\n\n roots = []\n\n\n\n for y, i in l:\n\n if len(roots) == 0 or roots[-1][0] > y:\n\n roots.append((y, i))\n\n else:\n\n new_y = roots[-1][0]\n\n while len(roots) > 0 and roots[-1][0] < y:\n\n old_y, old_i = roots.pop()\n\n uf.union(i, old_i)\n\n roots.append((new_y, i))\n\n\n\n # O(uf.size(i)) = 1\n\n for i in range(n):\n\n print((uf.size(i)))\n\n\n\nmain()\n","code_v0_loc":84,"code_v1_loc":62,"code_v0_num_chars":2250,"code_v1_num_chars":1621,"code_v0_no_empty_lines":"# Reference: https:\/\/note.nkmk.me\/python-union-find\/\nclass UnionFind:\n # if x is root: self.parents[x] = -(the number of the group nodes)\n # else: self.parents[x] = the parent of x\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n # return the parent of x\n def find(self, x):\n history = []\n while self.parents[x] >= 0:\n history.append(x)\n x = self.parents[x]\n for node in history:\n self.parents[node] = x\n return x\n\n # merge the group of x and the group of y\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n # return the size of the group of x\n def size(self, x):\n return -self.parents[self.find(x)]\n\n # return whether x and y in a same group\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n # return [all nodes which is in the group of x]\n # O(n)\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n # return [all roots]\n # O(n)\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n # return {root: members of the group}\n # O(n * n)\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n\nfrom bisect import bisect\nfrom sys import stdin\n\ninput = stdin.buffer.readline\n\n\ndef main():\n n = int(eval(input()))\n l = [0] * n\n for i in range(n):\n x, y = list(map(int, input().split()))\n l[x - 1] = (y - 1, i)\n # i\u3067\u7ba1\u7406\n uf = UnionFind(n)\n roots = []\n for y, i in l:\n if len(roots) == 0 or -roots[-1][0] > y:\n roots.append((-y, i))\n else:\n ind = bisect(roots, (-y, i))\n new_y = roots[-1][0]\n for old_y, old_i in roots[ind:]:\n uf.union(i, old_i)\n roots = roots[:ind]\n roots.append((new_y, i))\n for i in range(n):\n print((uf.size(i)))\n\n\nmain()\n","code_v1_no_empty_lines":"# Reference: https:\/\/note.nkmk.me\/python-union-find\/\nclass UnionFind:\n # if x is root: self.parents[x] = -(the number of the group nodes)\n # else: self.parents[x] = the parent of x\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n # return the parent of x\n def find(self, x):\n history = []\n while self.parents[x] >= 0:\n history.append(x)\n x = self.parents[x]\n for node in history:\n self.parents[node] = x\n return x\n\n # merge the group of x and the group of y\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n # return the size of the group of x\n def size(self, x):\n return -self.parents[self.find(x)]\n\n\nfrom sys import stdin\n\ninput = stdin.buffer.readline\n\n\ndef main():\n n = int(eval(input()))\n l = [0] * n\n for i in range(n):\n x, y = list(map(int, input().split()))\n l[x - 1] = (y - 1, i)\n uf = UnionFind(n)\n roots = []\n for y, i in l:\n if len(roots) == 0 or roots[-1][0] > y:\n roots.append((y, i))\n else:\n new_y = roots[-1][0]\n while len(roots) > 0 and roots[-1][0] < y:\n old_y, old_i = roots.pop()\n uf.union(i, old_i)\n roots.append((new_y, i))\n # O(uf.size(i)) = 1\n for i in range(n):\n print((uf.size(i)))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":26.1904761905,"diff":["- # return whether x and y in a same group","- def same(self, x, y):","- return self.find(x) == self.find(y)","- # return [all nodes which is in the group of x]","- # O(n)","- def members(self, x):","- root = self.find(x)","- return [i for i in range(self.n) if self.find(i) == root]","-","- # return [all roots]","- # O(n)","- def roots(self):","- return [i for i, x in enumerate(self.parents) if x < 0]","-","- # return {root: members of the group}","- # O(n * n)","- def all_group_members(self):","- return {r: self.members(r) for r in self.roots()}","-","-","-from bisect import bisect","- # i\u3067\u7ba1\u7406","- if len(roots) == 0 or -roots[-1][0] > y:","- roots.append((-y, i))","+ if len(roots) == 0 or roots[-1][0] > y:","+ roots.append((y, i))","- ind = bisect(roots, (-y, i))","- for old_y, old_i in roots[ind:]:","+ while len(roots) > 0 and roots[-1][0] < y:","+ old_y, old_i = roots.pop()","- roots = roots[:ind]","+ # O(uf.size(i)) = 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0893021425,"measured_runtime_v1":0.0457384803,"runtime_lift":1.9524510181,"key":["s272154145","s871199269"]} +{"user_id":"u133936772","problem_id":"p03073","language":"python","submission_id_v0":"s224392837","submission_id_v1":"s258366854","cpu_time_v0":79,"cpu_time_v1":58,"memory_v0":9244,"memory_v1":9240,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.58,"input":"s=eval(input())\n\nb=l=r=0\n\nfor i in s:\n\n l+=(int(i)==b)\n\n r+=(int(i)!=b)\n\n b^=1\n\nprint((min(l,r)))","target":"s=eval(input())\n\nb=c=0\n\nfor i in s:\n\n c+=(int(i)==b)\n\n b^=1\n\nprint((min(c,len(s)-c)))","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":92,"code_v1_num_chars":79,"code_v0_no_empty_lines":"s = eval(input())\nb = l = r = 0\nfor i in s:\n l += int(i) == b\n r += int(i) != b\n b ^= 1\nprint((min(l, r)))\n","code_v1_no_empty_lines":"s = eval(input())\nb = c = 0\nfor i in s:\n c += int(i) == b\n b ^= 1\nprint((min(c, len(s) - c)))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-b = l = r = 0","+b = c = 0","- l += int(i) == b","- r += int(i) != b","+ c += int(i) == b","-print((min(l, r)))","+print((min(c, len(s) - c)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376292529,"measured_runtime_v1":0.0431017866,"runtime_lift":0.8730323232,"key":["s224392837","s258366854"]} +{"user_id":"u079022693","problem_id":"p02848","language":"python","submission_id_v0":"s119892942","submission_id_v1":"s826166519","cpu_time_v0":187,"cpu_time_v1":171,"memory_v0":39536,"memory_v1":39152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.56,"input":"N=int(eval(input()))\n\nS=eval(input())\n\nAlp={\"A\":0,\"B\":1,\"C\":2,\"D\":3,\"E\":4,\"F\":5,\"G\":6,\"H\":7,\"I\":8,\"J\":9,\"K\":10,\"L\":11,\"M\":12,\"N\":13,\"O\":14,\"P\":15,\"Q\":16,\"R\":17,\"S\":18,\"T\":19,\"U\":20,\"V\":21,\"W\":22,\"X\":23,\"Y\":24,\"Z\":25}\n\nnew_Alp=[]\n\n\n\nfor i in range(len(S)):\n\n num=Alp[S[i]]\n\n num+=N\n\n num%=26\n\n \n\n for key,atai in list(Alp.items()):\n\n if atai==num:\n\n new_Alp.append(key)\n\n\n\nnew_alp=\"\".join(new_Alp)\n\nprint(new_alp)","target":"N=int(eval(input()))\n\nS=eval(input())\n\nalp=list(S)\n\n\n\ndef func(mozi):\n\n ord_mozi=ord(mozi)\n\n new_ord_mozi=(ord_mozi-65+N)%26+65\n\n new_chr_mozi=chr(new_ord_mozi)\n\n return new_chr_mozi\n\n\n\nnew_alp=list(map(func,alp))\n\nprint((\"\".join(new_alp)))","code_v0_loc":16,"code_v1_loc":12,"code_v0_num_chars":407,"code_v1_num_chars":224,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nAlp = {\n \"A\": 0,\n \"B\": 1,\n \"C\": 2,\n \"D\": 3,\n \"E\": 4,\n \"F\": 5,\n \"G\": 6,\n \"H\": 7,\n \"I\": 8,\n \"J\": 9,\n \"K\": 10,\n \"L\": 11,\n \"M\": 12,\n \"N\": 13,\n \"O\": 14,\n \"P\": 15,\n \"Q\": 16,\n \"R\": 17,\n \"S\": 18,\n \"T\": 19,\n \"U\": 20,\n \"V\": 21,\n \"W\": 22,\n \"X\": 23,\n \"Y\": 24,\n \"Z\": 25,\n}\nnew_Alp = []\nfor i in range(len(S)):\n num = Alp[S[i]]\n num += N\n num %= 26\n for key, atai in list(Alp.items()):\n if atai == num:\n new_Alp.append(key)\nnew_alp = \"\".join(new_Alp)\nprint(new_alp)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nalp = list(S)\n\n\ndef func(mozi):\n ord_mozi = ord(mozi)\n new_ord_mozi = (ord_mozi - 65 + N) % 26 + 65\n new_chr_mozi = chr(new_ord_mozi)\n return new_chr_mozi\n\n\nnew_alp = list(map(func, alp))\nprint((\"\".join(new_alp)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-Alp = {","- \"A\": 0,","- \"B\": 1,","- \"C\": 2,","- \"D\": 3,","- \"E\": 4,","- \"F\": 5,","- \"G\": 6,","- \"H\": 7,","- \"I\": 8,","- \"J\": 9,","- \"K\": 10,","- \"L\": 11,","- \"M\": 12,","- \"N\": 13,","- \"O\": 14,","- \"P\": 15,","- \"Q\": 16,","- \"R\": 17,","- \"S\": 18,","- \"T\": 19,","- \"U\": 20,","- \"V\": 21,","- \"W\": 22,","- \"X\": 23,","- \"Y\": 24,","- \"Z\": 25,","-}","-new_Alp = []","-for i in range(len(S)):","- num = Alp[S[i]]","- num += N","- num %= 26","- for key, atai in list(Alp.items()):","- if atai == num:","- new_Alp.append(key)","-new_alp = \"\".join(new_Alp)","-print(new_alp)","+alp = list(S)","+","+","+def func(mozi):","+ ord_mozi = ord(mozi)","+ new_ord_mozi = (ord_mozi - 65 + N) % 26 + 65","+ new_chr_mozi = chr(new_ord_mozi)","+ return new_chr_mozi","+","+","+new_alp = list(map(func, alp))","+print((\"\".join(new_alp)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1104344623,"measured_runtime_v1":0.0062223232,"runtime_lift":17.7481077325,"key":["s119892942","s826166519"]} +{"user_id":"u747602774","problem_id":"p02701","language":"python","submission_id_v0":"s020407275","submission_id_v1":"s388190325","cpu_time_v0":303,"cpu_time_v1":256,"memory_v0":49520,"memory_v1":35648,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.51,"input":"N = int(eval(input()))\n\nS = [eval(input()) for i in range(N)]\n\nfrom collections import Counter\n\nSc = Counter(S).most_common()\n\nprint((len(Sc)))\n","target":"N = int(eval(input()))\n\nS = [eval(input()) for i in range(N)]\n\nprint((len(set(S))))\n","code_v0_loc":5,"code_v1_loc":3,"code_v0_num_chars":130,"code_v1_num_chars":70,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = [eval(input()) for i in range(N)]\nfrom collections import Counter\n\nSc = Counter(S).most_common()\nprint((len(Sc)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = [eval(input()) for i in range(N)]\nprint((len(set(S))))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-from collections import Counter","-","-Sc = Counter(S).most_common()","-print((len(Sc)))","+print((len(set(S))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0351893873,"measured_runtime_v1":0.0393967452,"runtime_lift":0.8932054445,"key":["s020407275","s388190325"]} +{"user_id":"u970197315","problem_id":"p03252","language":"python","submission_id_v0":"s429251395","submission_id_v1":"s639980495","cpu_time_v0":131,"cpu_time_v1":71,"memory_v0":3632,"memory_v1":3888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.8,"input":"# ABC120 C - String Transformation\n\nsi = lambda: eval(input())\n\nni = lambda: int(eval(input()))\n\nnm = lambda: list(map(int, input().split()))\n\nnl = lambda: list(map(int, input().split()))\n\n\n\nS = si()\n\nT = si()\n\n \n\ndict_S = {}\n\ndict_T = {}\n\n \n\nfor i in range(len(S)):\n\n if S[i] in dict_S:\n\n if dict_S[S[i]] != T[i]:\n\n print(\"No\")\n\n exit()\n\n else:\n\n dict_S[S[i]] = T[i]\n\n \n\n if T[i] in dict_T:\n\n if dict_T[T[i]] != S[i]:\n\n print(\"No\")\n\n exit()\n\n else:\n\n dict_T[T[i]] = S[i]\n\n \n\nprint(\"Yes\")","target":"from collections import defaultdict as dd\n\ns=eval(input())\n\nt=eval(input())\n\nds=dd(int)\n\ndt=dd(int)\n\nfor ss in s:\n\n ds[ss]+=1\n\nfor tt in t:\n\n dt[tt]+=1\n\n# print(ds)\n\n# print(dt)\n\nls,lt=[],[]\n\nfor k,v in list(ds.items()):\n\n ls.append(v)\n\nfor k,v in list(dt.items()):\n\n lt.append(v)\n\n# print(ls)\n\n# print(lt)\n\nls.sort()\n\nlt.sort()\n\nfor a,b in zip(ls,lt):\n\n if a!=b:\n\n print('No')\n\n exit()\n\nprint('Yes')","code_v0_loc":28,"code_v1_loc":25,"code_v0_num_chars":568,"code_v1_num_chars":405,"code_v0_no_empty_lines":"# ABC120 C - String Transformation\nsi = lambda: eval(input())\nni = lambda: int(eval(input()))\nnm = lambda: list(map(int, input().split()))\nnl = lambda: list(map(int, input().split()))\nS = si()\nT = si()\ndict_S = {}\ndict_T = {}\nfor i in range(len(S)):\n if S[i] in dict_S:\n if dict_S[S[i]] != T[i]:\n print(\"No\")\n exit()\n else:\n dict_S[S[i]] = T[i]\n if T[i] in dict_T:\n if dict_T[T[i]] != S[i]:\n print(\"No\")\n exit()\n else:\n dict_T[T[i]] = S[i]\nprint(\"Yes\")\n","code_v1_no_empty_lines":"from collections import defaultdict as dd\n\ns = eval(input())\nt = eval(input())\nds = dd(int)\ndt = dd(int)\nfor ss in s:\n ds[ss] += 1\nfor tt in t:\n dt[tt] += 1\n# print(ds)\n# print(dt)\nls, lt = [], []\nfor k, v in list(ds.items()):\n ls.append(v)\nfor k, v in list(dt.items()):\n lt.append(v)\n# print(ls)\n# print(lt)\nls.sort()\nlt.sort()\nfor a, b in zip(ls, lt):\n if a != b:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":10.7142857143,"diff":["-# ABC120 C - String Transformation","-si = lambda: eval(input())","-ni = lambda: int(eval(input()))","-nm = lambda: list(map(int, input().split()))","-nl = lambda: list(map(int, input().split()))","-S = si()","-T = si()","-dict_S = {}","-dict_T = {}","-for i in range(len(S)):","- if S[i] in dict_S:","- if dict_S[S[i]] != T[i]:","- print(\"No\")","- exit()","- else:","- dict_S[S[i]] = T[i]","- if T[i] in dict_T:","- if dict_T[T[i]] != S[i]:","- print(\"No\")","- exit()","- else:","- dict_T[T[i]] = S[i]","+from collections import defaultdict as dd","+","+s = eval(input())","+t = eval(input())","+ds = dd(int)","+dt = dd(int)","+for ss in s:","+ ds[ss] += 1","+for tt in t:","+ dt[tt] += 1","+# print(ds)","+# print(dt)","+ls, lt = [], []","+for k, v in list(ds.items()):","+ ls.append(v)","+for k, v in list(dt.items()):","+ lt.append(v)","+# print(ls)","+# print(lt)","+ls.sort()","+lt.sort()","+for a, b in zip(ls, lt):","+ if a != b:","+ print(\"No\")","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0356731856,"measured_runtime_v1":0.036256701,"runtime_lift":0.9839059981,"key":["s429251395","s639980495"]} +{"user_id":"u992541367","problem_id":"p02753","language":"python","submission_id_v0":"s523569644","submission_id_v1":"s556027485","cpu_time_v0":170,"cpu_time_v1":18,"memory_v0":40460,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.41,"input":"S = eval(input())\n\nif len(set(S)) == 1:\n\n print(\"No\")\n\nelse:\n\n print(\"Yes\")","target":"S = eval(input())\n\nans = \"Yes\" if len(set(S)) == 2 else \"No\"\n\nprint(ans)","code_v0_loc":5,"code_v1_loc":3,"code_v0_num_chars":75,"code_v1_num_chars":66,"code_v0_no_empty_lines":"S = eval(input())\nif len(set(S)) == 1:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"S = eval(input())\nans = \"Yes\" if len(set(S)) == 2 else \"No\"\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-if len(set(S)) == 1:","- print(\"No\")","-else:","- print(\"Yes\")","+ans = \"Yes\" if len(set(S)) == 2 else \"No\"","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0408345389,"measured_runtime_v1":0.0402103901,"runtime_lift":1.0155220786,"key":["s523569644","s556027485"]} +{"user_id":"u028347703","problem_id":"p00044","language":"python","submission_id_v0":"s558148357","submission_id_v1":"s671795969","cpu_time_v0":4770,"cpu_time_v1":70,"memory_v0":5704,"memory_v1":6656,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":98.53,"input":"import sys\n\nimport math\n\n\n\nprimes = [2]\n\nfor line in sys.stdin:\n\n try:\n\n n = int(line)\n\n for i in range(max(primes) + 1, n):\n\n if i % 2 == 0:\n\n continue\n\n elif math.sqrt(i) == 0:\n\n continue\n\n elif len([j for j in primes if i % j == 0]) > 0:\n\n continue\n\n primes.append(i)\n\n if n == 3:\n\n print(2, end=\" \")\n\n else:\n\n for i in range(n - 1, 1, -1):\n\n if i % 2 == 0:\n\n continue\n\n elif math.sqrt(i) == 0:\n\n continue\n\n elif len([j for j in primes if i % j == 0 and i != j]) > 0:\n\n continue\n\n print(i, end=\" \")\n\n break\n\n for i in range(n + 1, n + 1000):\n\n if i % 2 == 0:\n\n continue\n\n elif math.sqrt(i) == 0:\n\n continue\n\n elif len([j for j in primes if i % j == 0 and i != j]) > 0:\n\n continue\n\n print(i)\n\n break\n\n except:\n\n break\n","target":"# 04.77 sec -> Time Limit Exceeded?\n\nimport sys\n\nimport math\n\n\n\n# Sieve of Eratosthenes\n\nN = 50021\n\nsearchList = list(range(3, N + 1, 2))\n\nprimes = [2]\n\nwhile True:\n\n top = searchList.pop(0)\n\n primes.append(top)\n\n if top > math.sqrt(N):\n\n break\n\n searchList = [s for s in searchList if s % top != 0]\n\nprimes.extend(searchList)\n\n\n\n# solve\n\nfor line in sys.stdin:\n\n try:\n\n n = int(line)\n\n pre = 2\n\n for p in primes:\n\n if p < n:\n\n pre = p\n\n if p > n:\n\n print((pre, p))\n\n break\n\n except:\n\n break","code_v0_loc":38,"code_v1_loc":29,"code_v0_num_chars":898,"code_v1_num_chars":541,"code_v0_no_empty_lines":"import sys\nimport math\n\nprimes = [2]\nfor line in sys.stdin:\n try:\n n = int(line)\n for i in range(max(primes) + 1, n):\n if i % 2 == 0:\n continue\n elif math.sqrt(i) == 0:\n continue\n elif len([j for j in primes if i % j == 0]) > 0:\n continue\n primes.append(i)\n if n == 3:\n print(2, end=\" \")\n else:\n for i in range(n - 1, 1, -1):\n if i % 2 == 0:\n continue\n elif math.sqrt(i) == 0:\n continue\n elif len([j for j in primes if i % j == 0 and i != j]) > 0:\n continue\n print(i, end=\" \")\n break\n for i in range(n + 1, n + 1000):\n if i % 2 == 0:\n continue\n elif math.sqrt(i) == 0:\n continue\n elif len([j for j in primes if i % j == 0 and i != j]) > 0:\n continue\n print(i)\n break\n except:\n break\n","code_v1_no_empty_lines":"# 04.77 sec -> Time Limit Exceeded?\nimport sys\nimport math\n\n# Sieve of Eratosthenes\nN = 50021\nsearchList = list(range(3, N + 1, 2))\nprimes = [2]\nwhile True:\n top = searchList.pop(0)\n primes.append(top)\n if top > math.sqrt(N):\n break\n searchList = [s for s in searchList if s % top != 0]\nprimes.extend(searchList)\n# solve\nfor line in sys.stdin:\n try:\n n = int(line)\n pre = 2\n for p in primes:\n if p < n:\n pre = p\n if p > n:\n print((pre, p))\n break\n except:\n break\n","code_same":false,"relative_loc_diff_percent":23.6842105263,"diff":["+# 04.77 sec -> Time Limit Exceeded?","+# Sieve of Eratosthenes","+N = 50021","+searchList = list(range(3, N + 1, 2))","+while True:","+ top = searchList.pop(0)","+ primes.append(top)","+ if top > math.sqrt(N):","+ break","+ searchList = [s for s in searchList if s % top != 0]","+primes.extend(searchList)","+# solve","- for i in range(max(primes) + 1, n):","- if i % 2 == 0:","- continue","- elif math.sqrt(i) == 0:","- continue","- elif len([j for j in primes if i % j == 0]) > 0:","- continue","- primes.append(i)","- if n == 3:","- print(2, end=\" \")","- else:","- for i in range(n - 1, 1, -1):","- if i % 2 == 0:","- continue","- elif math.sqrt(i) == 0:","- continue","- elif len([j for j in primes if i % j == 0 and i != j]) > 0:","- continue","- print(i, end=\" \")","+ pre = 2","+ for p in primes:","+ if p < n:","+ pre = p","+ if p > n:","+ print((pre, p))","- for i in range(n + 1, n + 1000):","- if i % 2 == 0:","- continue","- elif math.sqrt(i) == 0:","- continue","- elif len([j for j in primes if i % j == 0 and i != j]) > 0:","- continue","- print(i)","- break"],"diff_only_import_comment":false,"measured_runtime_v0":0.1132977486,"measured_runtime_v1":0.1131648469,"runtime_lift":1.0011744076,"key":["s558148357","s671795969"]} +{"user_id":"u525065967","problem_id":"p02579","language":"python","submission_id_v0":"s599268775","submission_id_v1":"s824441892","cpu_time_v0":583,"cpu_time_v1":535,"memory_v0":92024,"memory_v1":88568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.23,"input":"dhw = [(1,0),(0,-1),(0,1),(-1,0),\n\n( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2),\n\n( 1,-2),( 1,-1), ( 1, 1),( 1, 2),\n\n( 0,-2), ( 0, 2),\n\n(-1,-2),(-1,-1), (-1, 1),(-1, 2),\n\n(-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)]\n\n\n\nH, W = list(map(int, input().split()))\n\nsh, sw = [int(x)-1 for x in input().split()]\n\neh, ew = [int(x)-1 for x in input().split()]\n\nS = [eval(input()) for _ in range(H)]\n\n\n\ndst = [[-1]*W for _ in range(H)]\n\ndst[sh][sw] = 0\n\n\n\nfrom collections import deque\n\ndq = deque([[sh, sw]])\n\nwhile dq:\n\n h, w = dq.popleft()\n\n\n\n for i in range(4):\n\n nh = h + dhw[i][0]; nw = w + dhw[i][1]\n\n if nh < 0 or H <= nh : continue\n\n if nw < 0 or W <= nw : continue\n\n if S[nh][nw] == '#': continue\n\n if dst[nh][nw] == -1 or dst[h][w] < dst[nh][nw]:\n\n dst[nh][nw] = dst[h][w]\n\n dq.appendleft([nh, nw])\n\n\n\n for i in range(4, 24):\n\n nh = h + dhw[i][0]; nw = w + dhw[i][1]\n\n if nh < 0 or H <= nh : continue\n\n if nw < 0 or W <= nw : continue\n\n if S[nh][nw] == '#': continue\n\n if dst[nh][nw] >= 0: continue\n\n if dst[nh][nw] == -1 or dst[h][w] + 1 < dst[nh][nw]:\n\n dst[nh][nw] = dst[h][w] + 1\n\n dq.append([nh, nw])\n\n\n\nprint((dst[eh][ew]))\n","target":"dhw = [(1,0),(0,-1),(0,1),(-1,0),\n\n( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2),\n\n( 1,-2),( 1,-1), ( 1, 1),( 1, 2),\n\n( 0,-2), ( 0, 2),\n\n(-1,-2),(-1,-1), (-1, 1),(-1, 2),\n\n(-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)]\n\n\n\nH, W = list(map(int, input().split()))\n\nsh, sw = [int(x)-1 for x in input().split()]\n\neh, ew = [int(x)-1 for x in input().split()]\n\nS = [eval(input()) for _ in range(H)]\n\n\n\ndst = [[-1]*W for _ in range(H)]\n\ndst[sh][sw] = 0\n\n\n\nfrom collections import deque\n\ndq = deque([(sh, sw)])\n\nwhile dq:\n\n h, w = dq.popleft()\n\n\n\n for i in range(4):\n\n nh = h + dhw[i][0]; nw = w + dhw[i][1]\n\n if nh < 0 or H <= nh : continue\n\n if nw < 0 or W <= nw : continue\n\n if S[nh][nw] == '#': continue\n\n if dst[nh][nw] == -1 or dst[h][w] < dst[nh][nw]:\n\n dst[nh][nw] = dst[h][w]\n\n dq.appendleft((nh, nw))\n\n\n\n for i in range(4, 24):\n\n nh = h + dhw[i][0]; nw = w + dhw[i][1]\n\n if nh < 0 or H <= nh : continue\n\n if nw < 0 or W <= nw : continue\n\n if S[nh][nw] == '#': continue\n\n if dst[nh][nw] >= 0: continue\n\n if dst[nh][nw] == -1:\n\n dst[nh][nw] = dst[h][w] + 1\n\n elif dst[h][w] + 1 < dst[nh][nw]:\n\n dst[nh][nw] = min(dst[nh][nw], dst[h][w] + 1)\n\n else: continue\n\n dq.append((nh, nw))\n\n\n\nprint((dst[eh][ew]))\n","code_v0_loc":40,"code_v1_loc":43,"code_v0_num_chars":1282,"code_v1_num_chars":1373,"code_v0_no_empty_lines":"dhw = [\n (1, 0),\n (0, -1),\n (0, 1),\n (-1, 0),\n (2, -2),\n (2, -1),\n (2, 0),\n (2, 1),\n (2, 2),\n (1, -2),\n (1, -1),\n (1, 1),\n (1, 2),\n (0, -2),\n (0, 2),\n (-1, -2),\n (-1, -1),\n (-1, 1),\n (-1, 2),\n (-2, -2),\n (-2, -1),\n (-2, 0),\n (-2, 1),\n (-2, 2),\n]\nH, W = list(map(int, input().split()))\nsh, sw = [int(x) - 1 for x in input().split()]\neh, ew = [int(x) - 1 for x in input().split()]\nS = [eval(input()) for _ in range(H)]\ndst = [[-1] * W for _ in range(H)]\ndst[sh][sw] = 0\nfrom collections import deque\n\ndq = deque([[sh, sw]])\nwhile dq:\n h, w = dq.popleft()\n for i in range(4):\n nh = h + dhw[i][0]\n nw = w + dhw[i][1]\n if nh < 0 or H <= nh:\n continue\n if nw < 0 or W <= nw:\n continue\n if S[nh][nw] == \"#\":\n continue\n if dst[nh][nw] == -1 or dst[h][w] < dst[nh][nw]:\n dst[nh][nw] = dst[h][w]\n dq.appendleft([nh, nw])\n for i in range(4, 24):\n nh = h + dhw[i][0]\n nw = w + dhw[i][1]\n if nh < 0 or H <= nh:\n continue\n if nw < 0 or W <= nw:\n continue\n if S[nh][nw] == \"#\":\n continue\n if dst[nh][nw] >= 0:\n continue\n if dst[nh][nw] == -1 or dst[h][w] + 1 < dst[nh][nw]:\n dst[nh][nw] = dst[h][w] + 1\n dq.append([nh, nw])\nprint((dst[eh][ew]))\n","code_v1_no_empty_lines":"dhw = [\n (1, 0),\n (0, -1),\n (0, 1),\n (-1, 0),\n (2, -2),\n (2, -1),\n (2, 0),\n (2, 1),\n (2, 2),\n (1, -2),\n (1, -1),\n (1, 1),\n (1, 2),\n (0, -2),\n (0, 2),\n (-1, -2),\n (-1, -1),\n (-1, 1),\n (-1, 2),\n (-2, -2),\n (-2, -1),\n (-2, 0),\n (-2, 1),\n (-2, 2),\n]\nH, W = list(map(int, input().split()))\nsh, sw = [int(x) - 1 for x in input().split()]\neh, ew = [int(x) - 1 for x in input().split()]\nS = [eval(input()) for _ in range(H)]\ndst = [[-1] * W for _ in range(H)]\ndst[sh][sw] = 0\nfrom collections import deque\n\ndq = deque([(sh, sw)])\nwhile dq:\n h, w = dq.popleft()\n for i in range(4):\n nh = h + dhw[i][0]\n nw = w + dhw[i][1]\n if nh < 0 or H <= nh:\n continue\n if nw < 0 or W <= nw:\n continue\n if S[nh][nw] == \"#\":\n continue\n if dst[nh][nw] == -1 or dst[h][w] < dst[nh][nw]:\n dst[nh][nw] = dst[h][w]\n dq.appendleft((nh, nw))\n for i in range(4, 24):\n nh = h + dhw[i][0]\n nw = w + dhw[i][1]\n if nh < 0 or H <= nh:\n continue\n if nw < 0 or W <= nw:\n continue\n if S[nh][nw] == \"#\":\n continue\n if dst[nh][nw] >= 0:\n continue\n if dst[nh][nw] == -1:\n dst[nh][nw] = dst[h][w] + 1\n elif dst[h][w] + 1 < dst[nh][nw]:\n dst[nh][nw] = min(dst[nh][nw], dst[h][w] + 1)\n else:\n continue\n dq.append((nh, nw))\nprint((dst[eh][ew]))\n","code_same":false,"relative_loc_diff_percent":6.976744186,"diff":["-dq = deque([[sh, sw]])","+dq = deque([(sh, sw)])","- dq.appendleft([nh, nw])","+ dq.appendleft((nh, nw))","- if dst[nh][nw] == -1 or dst[h][w] + 1 < dst[nh][nw]:","+ if dst[nh][nw] == -1:","- dq.append([nh, nw])","+ elif dst[h][w] + 1 < dst[nh][nw]:","+ dst[nh][nw] = min(dst[nh][nw], dst[h][w] + 1)","+ else:","+ continue","+ dq.append((nh, nw))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0439938328,"measured_runtime_v1":0.1088418946,"runtime_lift":0.4041994397,"key":["s599268775","s824441892"]} +{"user_id":"u022579771","problem_id":"p02397","language":"python","submission_id_v0":"s204163736","submission_id_v1":"s548171818","cpu_time_v0":40,"cpu_time_v1":30,"memory_v0":7844,"memory_v1":7760,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"import sys\n\n \n\nff = sys.stdin\n\n \n\nwhile True :\n\n a, b = list(map(int, ff.readline().split()))\n\n if (a == 0) & (b == 0) :\n\n break\n\n \n\n if a < b : print((a, b))\n\n else : print((b, a))\n\n \n\nexit()","target":"import sys\n\n \n\nff = sys.stdin\n\n \n\nwhile True :\n\n a, b = list(map(int, ff.readline().split()))\n\n if (a == 0) & (b == 0) :\n\n break\n\n \n\n if a < b : print((a, b))\n\n else : print((b, a))","code_v0_loc":13,"code_v1_loc":11,"code_v0_num_chars":201,"code_v1_num_chars":190,"code_v0_no_empty_lines":"import sys\n\nff = sys.stdin\nwhile True:\n a, b = list(map(int, ff.readline().split()))\n if (a == 0) & (b == 0):\n break\n if a < b:\n print((a, b))\n else:\n print((b, a))\nexit()\n","code_v1_no_empty_lines":"import sys\n\nff = sys.stdin\nwhile True:\n a, b = list(map(int, ff.readline().split()))\n if (a == 0) & (b == 0):\n break\n if a < b:\n print((a, b))\n else:\n print((b, a))\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0848202446,"measured_runtime_v1":0.0473735182,"runtime_lift":1.790456941,"key":["s204163736","s548171818"]} +{"user_id":"u539367121","problem_id":"p02701","language":"python","submission_id_v0":"s418377739","submission_id_v1":"s443507316","cpu_time_v0":296,"cpu_time_v1":268,"memory_v0":35188,"memory_v1":35504,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.46,"input":"N = int(eval(input()))\n\nGACHA={}\n\nfor n in range(N):\n\n g=eval(input())\n\n GACHA[g]=GACHA.get(g,0)\n\nprint((len(GACHA)))","target":"N = int(eval(input()))\n\nGACHA=[eval(input()) for n in range(N)]\n\nprint((len(set(GACHA))))\n","code_v0_loc":6,"code_v1_loc":3,"code_v0_num_chars":105,"code_v1_num_chars":76,"code_v0_no_empty_lines":"N = int(eval(input()))\nGACHA = {}\nfor n in range(N):\n g = eval(input())\n GACHA[g] = GACHA.get(g, 0)\nprint((len(GACHA)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nGACHA = [eval(input()) for n in range(N)]\nprint((len(set(GACHA))))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-GACHA = {}","-for n in range(N):","- g = eval(input())","- GACHA[g] = GACHA.get(g, 0)","-print((len(GACHA)))","+GACHA = [eval(input()) for n in range(N)]","+print((len(set(GACHA))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.046718637,"measured_runtime_v1":0.0491895962,"runtime_lift":0.9497666298,"key":["s418377739","s443507316"]} +{"user_id":"u592547545","problem_id":"p02861","language":"python","submission_id_v0":"s755036833","submission_id_v1":"s256578087","cpu_time_v0":395,"cpu_time_v1":305,"memory_v0":7972,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.78,"input":"from itertools import permutations\n\nfrom math import sqrt\n\n\n\nn=int(eval(input()))\n\npermlist = list(permutations(list(range(n))))\n\n#print('permlist: {}'.format(permlist))\n\n\n\nx = []\n\ny = []\n\nfor i in range(n):\n\n xi,yi = list(map(int,input().split()))\n\n x.append(xi)\n\n y.append(yi)\n\n\n\nlengths = 0.0\n\nfor p in permlist:\n\n length = 0.0\n\n for _ in range(len(p)-1):\n\n i = p[_]\n\n j = p[_+1]\n\n #print('i: {} j:{}'.format(i,j))\n\n length += sqrt( (x[i]-x[j])**2 + (y[i]-y[j])**2 )\n\n #print('length: {}'.format(length))\n\n lengths += length\n\n\n\nprint((lengths\/len(permlist)))\n","target":"from itertools import permutations\n\nfrom math import sqrt\n\n\n\ndef readinput():\n\n n=int(eval(input()))\n\n xyList=[]\n\n for _ in range(n):\n\n x,y=list(map(int,input().split()))\n\n xyList.append((x,y))\n\n return n,xyList\n\n\n\ndef main(n,xyList):\n\n sum=0.0\n\n factn=0\n\n for tup in permutations(list(range(n))):\n\n #print(tup)\n\n factn+=1\n\n x0=xyList[tup[0]][0]\n\n y0=xyList[tup[0]][1]\n\n for i in tup:\n\n x=xyList[i][0]\n\n y=xyList[i][1]\n\n sum+=sqrt((x-x0)**2+(y-y0)**2)\n\n x0=x\n\n y0=y\n\n ans=sum\/factn\n\n return ans\n\n\n\nif __name__=='__main__':\n\n n,xyList=readinput()\n\n #print(xyList)\n\n ans=main(n,xyList)\n\n print(ans)\n\n\n","code_v0_loc":26,"code_v1_loc":34,"code_v0_num_chars":597,"code_v1_num_chars":730,"code_v0_no_empty_lines":"from itertools import permutations\nfrom math import sqrt\n\nn = int(eval(input()))\npermlist = list(permutations(list(range(n))))\n# print('permlist: {}'.format(permlist))\nx = []\ny = []\nfor i in range(n):\n xi, yi = list(map(int, input().split()))\n x.append(xi)\n y.append(yi)\nlengths = 0.0\nfor p in permlist:\n length = 0.0\n for _ in range(len(p) - 1):\n i = p[_]\n j = p[_ + 1]\n # print('i: {} j:{}'.format(i,j))\n length += sqrt((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2)\n # print('length: {}'.format(length))\n lengths += length\nprint((lengths \/ len(permlist)))\n","code_v1_no_empty_lines":"from itertools import permutations\nfrom math import sqrt\n\n\ndef readinput():\n n = int(eval(input()))\n xyList = []\n for _ in range(n):\n x, y = list(map(int, input().split()))\n xyList.append((x, y))\n return n, xyList\n\n\ndef main(n, xyList):\n sum = 0.0\n factn = 0\n for tup in permutations(list(range(n))):\n # print(tup)\n factn += 1\n x0 = xyList[tup[0]][0]\n y0 = xyList[tup[0]][1]\n for i in tup:\n x = xyList[i][0]\n y = xyList[i][1]\n sum += sqrt((x - x0) ** 2 + (y - y0) ** 2)\n x0 = x\n y0 = y\n ans = sum \/ factn\n return ans\n\n\nif __name__ == \"__main__\":\n n, xyList = readinput()\n # print(xyList)\n ans = main(n, xyList)\n print(ans)\n","code_same":false,"relative_loc_diff_percent":23.5294117647,"diff":["-n = int(eval(input()))","-permlist = list(permutations(list(range(n))))","-# print('permlist: {}'.format(permlist))","-x = []","-y = []","-for i in range(n):","- xi, yi = list(map(int, input().split()))","- x.append(xi)","- y.append(yi)","-lengths = 0.0","-for p in permlist:","- length = 0.0","- for _ in range(len(p) - 1):","- i = p[_]","- j = p[_ + 1]","- # print('i: {} j:{}'.format(i,j))","- length += sqrt((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2)","- # print('length: {}'.format(length))","- lengths += length","-print((lengths \/ len(permlist)))","+","+def readinput():","+ n = int(eval(input()))","+ xyList = []","+ for _ in range(n):","+ x, y = list(map(int, input().split()))","+ xyList.append((x, y))","+ return n, xyList","+","+","+def main(n, xyList):","+ sum = 0.0","+ factn = 0","+ for tup in permutations(list(range(n))):","+ # print(tup)","+ factn += 1","+ x0 = xyList[tup[0]][0]","+ y0 = xyList[tup[0]][1]","+ for i in tup:","+ x = xyList[i][0]","+ y = xyList[i][1]","+ sum += sqrt((x - x0) ** 2 + (y - y0) ** 2)","+ x0 = x","+ y0 = y","+ ans = sum \/ factn","+ return ans","+","+","+if __name__ == \"__main__\":","+ n, xyList = readinput()","+ # print(xyList)","+ ans = main(n, xyList)","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0920967102,"measured_runtime_v1":0.0473668575,"runtime_lift":1.9443280595,"key":["s755036833","s256578087"]} +{"user_id":"u211706121","problem_id":"p02665","language":"python","submission_id_v0":"s394231072","submission_id_v1":"s456742970","cpu_time_v0":1266,"cpu_time_v1":1143,"memory_v0":702168,"memory_v1":701808,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.72,"input":"\n\nn=int(eval(input()))\n\nA=list(map(int,input().split()))\n\n\n\ns=0\n\ncap=[]\n\nflag=False\n\nans=2**(n+1)-1\n\nfor i,a in enumerate(A):\n\n s*=2\n\n s+=a\n\n cap.append(2**i-s)\n\n #if i!=n:\n\n # ans-=a*(2**(n+1-i)-2)\n\n if s>2**i:\n\n flag=True\n\n break\n\n\n\nif flag:\n\n print((-1))\n\nelse:\n\n remain=2**n-s\n\n ans=0\n\n node=0\n\n for i in range(n,-1,-1):\n\n a=A[i]\n\n c=cap[i]\n\n node=min(c,node)+a\n\n ans+=node\n\n print(ans)","target":"n=int(eval(input()))\n\nA=list(map(int,input().split()))\n\n\n\ns=0\n\ncap=[]\n\nflag=False\n\nfor i,a in enumerate(A):\n\n s*=2\n\n s+=a\n\n cap.append(min(2**i-s,(n+1-i)*10**8))\n\n if s>2**i:\n\n flag=True\n\n break\n\n\n\nif flag:\n\n print((-1))\n\nelse:\n\n remain=2**n-s\n\n ans=0\n\n node=0\n\n for i in range(n,-1,-1):\n\n a=A[i]\n\n c=cap[i]\n\n node=min(c,node)+a\n\n ans+=node\n\n print(ans)\n","code_v0_loc":30,"code_v1_loc":26,"code_v0_num_chars":463,"code_v1_num_chars":418,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\ns = 0\ncap = []\nflag = False\nans = 2 ** (n + 1) - 1\nfor i, a in enumerate(A):\n s *= 2\n s += a\n cap.append(2**i - s)\n # if i!=n:\n # ans-=a*(2**(n+1-i)-2)\n if s > 2**i:\n flag = True\n break\nif flag:\n print((-1))\nelse:\n remain = 2**n - s\n ans = 0\n node = 0\n for i in range(n, -1, -1):\n a = A[i]\n c = cap[i]\n node = min(c, node) + a\n ans += node\n print(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\ns = 0\ncap = []\nflag = False\nfor i, a in enumerate(A):\n s *= 2\n s += a\n cap.append(min(2**i - s, (n + 1 - i) * 10**8))\n if s > 2**i:\n flag = True\n break\nif flag:\n print((-1))\nelse:\n remain = 2**n - s\n ans = 0\n node = 0\n for i in range(n, -1, -1):\n a = A[i]\n c = cap[i]\n node = min(c, node) + a\n ans += node\n print(ans)\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-ans = 2 ** (n + 1) - 1","- cap.append(2**i - s)","- # if i!=n:","- # ans-=a*(2**(n+1-i)-2)","+ cap.append(min(2**i - s, (n + 1 - i) * 10**8))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1559975568,"measured_runtime_v1":0.0973336222,"runtime_lift":1.6027098681,"key":["s394231072","s456742970"]} +{"user_id":"u463068683","problem_id":"p02659","language":"python","submission_id_v0":"s884854785","submission_id_v1":"s680168003","cpu_time_v0":30,"cpu_time_v1":26,"memory_v0":10000,"memory_v1":9184,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.33,"input":"import decimal\n\na, b = (decimal.Decimal(x) for x in input().split())\n\nprint((int(a*b)))","target":"a, b = input().split()\n\na = int(a)\n\nb = int(b.replace(\".\", \"\"))\n\nprint((a*b\/\/100))","code_v0_loc":3,"code_v1_loc":4,"code_v0_num_chars":85,"code_v1_num_chars":80,"code_v0_no_empty_lines":"import decimal\n\na, b = (decimal.Decimal(x) for x in input().split())\nprint((int(a * b)))\n","code_v1_no_empty_lines":"a, b = input().split()\na = int(a)\nb = int(b.replace(\".\", \"\"))\nprint((a * b \/\/ 100))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import decimal","-","-a, b = (decimal.Decimal(x) for x in input().split())","-print((int(a * b)))","+a, b = input().split()","+a = int(a)","+b = int(b.replace(\".\", \"\"))","+print((a * b \/\/ 100))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1758611522,"measured_runtime_v1":0.1197939341,"runtime_lift":1.4680305265,"key":["s884854785","s680168003"]} +{"user_id":"u766477342","problem_id":"p00009","language":"python","submission_id_v0":"s675936846","submission_id_v1":"s838174276","cpu_time_v0":1120,"cpu_time_v1":820,"memory_v0":24288,"memory_v1":24296,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.79,"input":"def mk_table(n):\n\n res = [1] * (n + 1)\n\n res[:2] = [0, 0]\n\n\n\n for i in range(2, n):\n\n if i ** 2 > n:\n\n break\n\n\n\n if res[i] == 1:\n\n j = 2\n\n while i * j <= n:\n\n res[i * j] = 0\n\n j += 1\n\n\n\n return res\n\n\n\n\n\ntbl = mk_table(999999)\n\ntry:\n\n while 1:\n\n print((len([x for x in tbl[:int(eval(input()))+1] if x == 1])))\n\nexcept Exception:\n\n pass","target":"def mk_table(n):\n\n res = [1] * (n + 1)\n\n res[:2] = 0, 0\n\n\n\n for i in range(2, n):\n\n if i ** 2 > n:\n\n break\n\n\n\n if res[i] == 1:\n\n for j in range(i*2, n + 1, i):\n\n res[j] = 0\n\n\n\n return res\n\n\n\n\n\ntbl = mk_table(999999)\n\ntry:\n\n while 1:\n\n print((len([x for x in tbl[:int(eval(input()))+1] if x == 1])))\n\nexcept Exception:\n\n pass","code_v0_loc":23,"code_v1_loc":21,"code_v0_num_chars":428,"code_v1_num_chars":392,"code_v0_no_empty_lines":"def mk_table(n):\n res = [1] * (n + 1)\n res[:2] = [0, 0]\n for i in range(2, n):\n if i**2 > n:\n break\n if res[i] == 1:\n j = 2\n while i * j <= n:\n res[i * j] = 0\n j += 1\n return res\n\n\ntbl = mk_table(999999)\ntry:\n while 1:\n print((len([x for x in tbl[: int(eval(input())) + 1] if x == 1])))\nexcept Exception:\n pass\n","code_v1_no_empty_lines":"def mk_table(n):\n res = [1] * (n + 1)\n res[:2] = 0, 0\n for i in range(2, n):\n if i**2 > n:\n break\n if res[i] == 1:\n for j in range(i * 2, n + 1, i):\n res[j] = 0\n return res\n\n\ntbl = mk_table(999999)\ntry:\n while 1:\n print((len([x for x in tbl[: int(eval(input())) + 1] if x == 1])))\nexcept Exception:\n pass\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["- res[:2] = [0, 0]","+ res[:2] = 0, 0","- j = 2","- while i * j <= n:","- res[i * j] = 0","- j += 1","+ for j in range(i * 2, n + 1, i):","+ res[j] = 0"],"diff_only_import_comment":false,"measured_runtime_v0":1.7555844471,"measured_runtime_v1":0.3404784431,"runtime_lift":5.1562278976,"key":["s675936846","s838174276"]} +{"user_id":"u147077748","problem_id":"p03162","language":"python","submission_id_v0":"s250896957","submission_id_v1":"s906157200","cpu_time_v0":1076,"cpu_time_v1":822,"memory_v0":133304,"memory_v1":44800,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.61,"input":"import sys\n\n# \u8a31\u5bb9\u3059\u308b\u518d\u5e30\u51e6\u7406\u306e\u56de\u6570\u3092\u5909\u66f4\n\nsys.setrecursionlimit(10**5+10)\n\n\n\n# input\u3092\u9ad8\u901f\u5316\u3059\u308b\u3002\n\ninput = sys.stdin.readline\n\n\n\n# \u5165\u529b\n\nvacation = int(eval(input()))\n\nlst_happiness = [list(map(int, input().split())) for i in range(vacation)]\n\n\n\n# DP\u30c6\u30fc\u30d6\u30eb\n\n# \u6700\u5927\u5316\u554f\u984c\u306a\u306e\u30670\u3067\u521d\u671f\u5316\n\ndp = [[0 for i in range(3)] for j in range(vacation+1)]\n\n\n\n# dp\u306e\u6700\u5927\u5024\u3092\u66f4\u65b0\u3059\u308b\u305f\u3081\u306e\u95a2\u6570\n\ndef chmax(a, b):\n\n if a > b:\n\n return a\n\n else:\n\n return b\n\n\n\n# \u30e1\u30e2\u5316\u518d\u5e30\u306e\u95a2\u6570\n\ndef rec(i):\n\n # DP\u306e\u5024\u304c\u65e2\u306b\u66f4\u65b0\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u305d\u306e\u5024\u3092\u8fd4\u3059\n\n for j in range(3):\n\n if dp[i][j] > 0:\n\n break\n\n \n\n # \u518d\u5e30\u306e\u7d42\u4e86\u6761\u4ef6\n\n if i == 0:\n\n dp[i][j] = 0\n\n break\n\n \n\n # i-1 \u3092\u518d\u5e30\n\n res = 0\n\n for k in range(3):\n\n if j == k:\n\n continue\n\n res = chmax(res, rec(i-1)[k] + lst_happiness[i-1][k])\n\n # \u7d50\u679c\u3092\u30e1\u30e2\u3059\u308b\n\n dp[i][j] = res\n\n \n\n return dp[i]\n\n\n\nans = rec(vacation)\n\nans = max(ans)\n\nprint(ans)","target":"import sys\n\nimport numpy as np\n\n\n\n# input\u3092\u9ad8\u901f\u5316\u3059\u308b\u3002\n\ninput = sys.stdin.readline\n\n\n\n# \u5165\u529b\n\nvacation = int(eval(input()))\n\nlst_happiness = [list(map(int, input().split())) for i in range(vacation)]\n\n\n\n# lst_happiness\u3092ndarray\u306b\u3059\u308b\u3002\n\narr_happiness_a = np.array([lst_happiness[i][0] for i in range(vacation)])\n\narr_happiness_b = np.array([lst_happiness[i][1] for i in range(vacation)])\n\narr_happiness_c = np.array([lst_happiness[i][2] for i in range(vacation)])\n\n\n\n# DP\u306endarray\u3092\u4f5c\u308b\u3002\n\ndp_a = np.zeros(vacation, dtype=int)\n\ndp_b = np.zeros(vacation, dtype=int)\n\ndp_c = np.zeros(vacation, dtype=int)\n\n\n\n# dp\u306b\u521d\u671f\u5024\u3092\u5165\u308c\u308b\u3002\n\ndp_a[0] = arr_happiness_a[0]\n\ndp_b[0] = arr_happiness_b[0]\n\ndp_c[0] = arr_happiness_c[0]\n\n\n\nfor i in range(1, vacation):\n\n dp_a[i] += max(dp_b[i-1], dp_c[i-1]) + arr_happiness_a[i]\n\n dp_b[i] += max(dp_a[i-1], dp_c[i-1]) + arr_happiness_b[i]\n\n dp_c[i] += max(dp_a[i-1], dp_b[i-1]) + arr_happiness_c[i]\n\n\n\nans = max(dp_a[vacation-1], dp_b[vacation-1], dp_c[vacation-1])\n\nprint(ans)","code_v0_loc":48,"code_v1_loc":32,"code_v0_num_chars":942,"code_v1_num_chars":985,"code_v0_no_empty_lines":"import sys\n\n# \u8a31\u5bb9\u3059\u308b\u518d\u5e30\u51e6\u7406\u306e\u56de\u6570\u3092\u5909\u66f4\nsys.setrecursionlimit(10**5 + 10)\n# input\u3092\u9ad8\u901f\u5316\u3059\u308b\u3002\ninput = sys.stdin.readline\n# \u5165\u529b\nvacation = int(eval(input()))\nlst_happiness = [list(map(int, input().split())) for i in range(vacation)]\n# DP\u30c6\u30fc\u30d6\u30eb\n# \u6700\u5927\u5316\u554f\u984c\u306a\u306e\u30670\u3067\u521d\u671f\u5316\ndp = [[0 for i in range(3)] for j in range(vacation + 1)]\n# dp\u306e\u6700\u5927\u5024\u3092\u66f4\u65b0\u3059\u308b\u305f\u3081\u306e\u95a2\u6570\ndef chmax(a, b):\n if a > b:\n return a\n else:\n return b\n\n\n# \u30e1\u30e2\u5316\u518d\u5e30\u306e\u95a2\u6570\ndef rec(i):\n # DP\u306e\u5024\u304c\u65e2\u306b\u66f4\u65b0\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u305d\u306e\u5024\u3092\u8fd4\u3059\n for j in range(3):\n if dp[i][j] > 0:\n break\n # \u518d\u5e30\u306e\u7d42\u4e86\u6761\u4ef6\n if i == 0:\n dp[i][j] = 0\n break\n # i-1 \u3092\u518d\u5e30\n res = 0\n for k in range(3):\n if j == k:\n continue\n res = chmax(res, rec(i - 1)[k] + lst_happiness[i - 1][k])\n # \u7d50\u679c\u3092\u30e1\u30e2\u3059\u308b\n dp[i][j] = res\n return dp[i]\n\n\nans = rec(vacation)\nans = max(ans)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\n# input\u3092\u9ad8\u901f\u5316\u3059\u308b\u3002\ninput = sys.stdin.readline\n# \u5165\u529b\nvacation = int(eval(input()))\nlst_happiness = [list(map(int, input().split())) for i in range(vacation)]\n# lst_happiness\u3092ndarray\u306b\u3059\u308b\u3002\narr_happiness_a = np.array([lst_happiness[i][0] for i in range(vacation)])\narr_happiness_b = np.array([lst_happiness[i][1] for i in range(vacation)])\narr_happiness_c = np.array([lst_happiness[i][2] for i in range(vacation)])\n# DP\u306endarray\u3092\u4f5c\u308b\u3002\ndp_a = np.zeros(vacation, dtype=int)\ndp_b = np.zeros(vacation, dtype=int)\ndp_c = np.zeros(vacation, dtype=int)\n# dp\u306b\u521d\u671f\u5024\u3092\u5165\u308c\u308b\u3002\ndp_a[0] = arr_happiness_a[0]\ndp_b[0] = arr_happiness_b[0]\ndp_c[0] = arr_happiness_c[0]\nfor i in range(1, vacation):\n dp_a[i] += max(dp_b[i - 1], dp_c[i - 1]) + arr_happiness_a[i]\n dp_b[i] += max(dp_a[i - 1], dp_c[i - 1]) + arr_happiness_b[i]\n dp_c[i] += max(dp_a[i - 1], dp_b[i - 1]) + arr_happiness_c[i]\nans = max(dp_a[vacation - 1], dp_b[vacation - 1], dp_c[vacation - 1])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["+import numpy as np","-# \u8a31\u5bb9\u3059\u308b\u518d\u5e30\u51e6\u7406\u306e\u56de\u6570\u3092\u5909\u66f4","-sys.setrecursionlimit(10**5 + 10)","-# DP\u30c6\u30fc\u30d6\u30eb","-# \u6700\u5927\u5316\u554f\u984c\u306a\u306e\u30670\u3067\u521d\u671f\u5316","-dp = [[0 for i in range(3)] for j in range(vacation + 1)]","-# dp\u306e\u6700\u5927\u5024\u3092\u66f4\u65b0\u3059\u308b\u305f\u3081\u306e\u95a2\u6570","-def chmax(a, b):","- if a > b:","- return a","- else:","- return b","-","-","-# \u30e1\u30e2\u5316\u518d\u5e30\u306e\u95a2\u6570","-def rec(i):","- # DP\u306e\u5024\u304c\u65e2\u306b\u66f4\u65b0\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u305d\u306e\u5024\u3092\u8fd4\u3059","- for j in range(3):","- if dp[i][j] > 0:","- break","- # \u518d\u5e30\u306e\u7d42\u4e86\u6761\u4ef6","- if i == 0:","- dp[i][j] = 0","- break","- # i-1 \u3092\u518d\u5e30","- res = 0","- for k in range(3):","- if j == k:","- continue","- res = chmax(res, rec(i - 1)[k] + lst_happiness[i - 1][k])","- # \u7d50\u679c\u3092\u30e1\u30e2\u3059\u308b","- dp[i][j] = res","- return dp[i]","-","-","-ans = rec(vacation)","-ans = max(ans)","+# lst_happiness\u3092ndarray\u306b\u3059\u308b\u3002","+arr_happiness_a = np.array([lst_happiness[i][0] for i in range(vacation)])","+arr_happiness_b = np.array([lst_happiness[i][1] for i in range(vacation)])","+arr_happiness_c = np.array([lst_happiness[i][2] for i in range(vacation)])","+# DP\u306endarray\u3092\u4f5c\u308b\u3002","+dp_a = np.zeros(vacation, dtype=int)","+dp_b = np.zeros(vacation, dtype=int)","+dp_c = np.zeros(vacation, dtype=int)","+# dp\u306b\u521d\u671f\u5024\u3092\u5165\u308c\u308b\u3002","+dp_a[0] = arr_happiness_a[0]","+dp_b[0] = arr_happiness_b[0]","+dp_c[0] = arr_happiness_c[0]","+for i in range(1, vacation):","+ dp_a[i] += max(dp_b[i - 1], dp_c[i - 1]) + arr_happiness_a[i]","+ dp_b[i] += max(dp_a[i - 1], dp_c[i - 1]) + arr_happiness_b[i]","+ dp_c[i] += max(dp_a[i - 1], dp_b[i - 1]) + arr_happiness_c[i]","+ans = max(dp_a[vacation - 1], dp_b[vacation - 1], dp_c[vacation - 1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.043738404,"measured_runtime_v1":0.2773720129,"runtime_lift":0.1576885987,"key":["s250896957","s906157200"]} +{"user_id":"u095021077","problem_id":"p02987","language":"python","submission_id_v0":"s728022565","submission_id_v1":"s248638508","cpu_time_v0":167,"cpu_time_v1":18,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.22,"input":"S=eval(input())\n\n\n\njudge=True\n\nfor i in range(4):\n\n counter=int(0)\n\n for j in range(4):\n\n if S[i]==S[j]:\n\n counter+=1\n\n \n\n if counter!=2:\n\n judge=False\n\n \n\nif judge:\n\n print('Yes')\n\nelse:\n\n print('No')","target":"s=eval(input())\n\noutput='Yes'\n\nfor i in range(4):\n\n counter=0\n\n for j in range(4):\n\n if s[i]==s[j]:\n\n counter+=1\n\n \n\n if counter!=2:\n\n output='No'\n\n \n\nprint(output)","code_v0_loc":16,"code_v1_loc":12,"code_v0_num_chars":219,"code_v1_num_chars":180,"code_v0_no_empty_lines":"S = eval(input())\njudge = True\nfor i in range(4):\n counter = int(0)\n for j in range(4):\n if S[i] == S[j]:\n counter += 1\n if counter != 2:\n judge = False\nif judge:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"s = eval(input())\noutput = \"Yes\"\nfor i in range(4):\n counter = 0\n for j in range(4):\n if s[i] == s[j]:\n counter += 1\n if counter != 2:\n output = \"No\"\nprint(output)\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-S = eval(input())","-judge = True","+s = eval(input())","+output = \"Yes\"","- counter = int(0)","+ counter = 0","- if S[i] == S[j]:","+ if s[i] == s[j]:","- judge = False","-if judge:","- print(\"Yes\")","-else:","- print(\"No\")","+ output = \"No\"","+print(output)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0356609478,"measured_runtime_v1":0.0342091162,"runtime_lift":1.0424399028,"key":["s728022565","s248638508"]} +{"user_id":"u977661421","problem_id":"p02785","language":"python","submission_id_v0":"s614799621","submission_id_v1":"s237165269","cpu_time_v0":195,"cpu_time_v1":179,"memory_v0":26180,"memory_v1":26764,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.21,"input":"# -*- coding: utf-8 -*-\n\nn, k = list(map(int,input().split()))\n\nh = [int(i) for i in input().split()]\n\n\n\nif k >= n:\n\n ans = 0\n\nelse:\n\n h.sort()\n\n tmp = 0\n\n for i in range(n-k, n):\n\n tmp += h[i]\n\n ans = (sum(h) - tmp)\n\nprint(ans)\n","target":"# -*- coding: utf-8 -*-\n\nn, k = list(map(int,input().split()))\n\nh = [int(i) for i in input().split()]\n\n\"\"\"\n\nif k >= n:\n\n ans = 0\n\nelse:\n\n h.sort()\n\n tmp = 0\n\n for i in range(n-k, n):\n\n tmp += h[i]\n\n ans = (sum(h) - tmp)\n\nprint(ans)\n\n\"\"\"\n\n\n\nif k >= n:\n\n ans = 0\n\nelse:\n\n h.sort()\n\n ans = 0\n\n for i in range(n - k):\n\n ans += h[i]\n\nprint(ans)\n","code_v0_loc":13,"code_v1_loc":23,"code_v0_num_chars":245,"code_v1_num_chars":375,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nn, k = list(map(int, input().split()))\nh = [int(i) for i in input().split()]\nif k >= n:\n ans = 0\nelse:\n h.sort()\n tmp = 0\n for i in range(n - k, n):\n tmp += h[i]\n ans = sum(h) - tmp\nprint(ans)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nn, k = list(map(int, input().split()))\nh = [int(i) for i in input().split()]\n\"\"\"\nif k >= n:\n ans = 0\nelse:\n h.sort()\n tmp = 0\n for i in range(n-k, n):\n tmp += h[i]\n ans = (sum(h) - tmp)\nprint(ans)\n\"\"\"\nif k >= n:\n ans = 0\nelse:\n h.sort()\n ans = 0\n for i in range(n - k):\n ans += h[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":43.4782608696,"diff":["+\"\"\"","- for i in range(n - k, n):","+ for i in range(n-k, n):","- ans = sum(h) - tmp","+ ans = (sum(h) - tmp)","+\"\"\"","+if k >= n:","+ ans = 0","+else:","+ h.sort()","+ ans = 0","+ for i in range(n - k):","+ ans += h[i]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0650238235,"measured_runtime_v1":0.0921836607,"runtime_lift":0.7053725461,"key":["s614799621","s237165269"]} +{"user_id":"u600402037","problem_id":"p03048","language":"python","submission_id_v0":"s491296665","submission_id_v1":"s578949746","cpu_time_v0":1487,"cpu_time_v1":168,"memory_v0":3060,"memory_v1":12496,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.7,"input":"import sys\n\n\n\nstdin = sys.stdin\n\n \n\nri = lambda: int(rs())\n\nrl = lambda: list(map(int, stdin.readline().split()))\n\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\n\n\nR, G, B, N = rl()\n\nanswer = 0\n\nfor r in range(N\/\/R + 1):\n\n sum = r * R\n\n for g in range((N-sum)\/\/G + 1):\n\n sum2 = sum + g * G\n\n if (N-sum2)%B == 0:\n\n answer += 1\n\n\n\nprint(answer)\n\n#45\n","target":"import sys\n\nimport numpy as np\n\n\n\nstdin = sys.stdin\n\n \n\nri = lambda: int(rs())\n\nrl = lambda: list(map(int, stdin.readline().split()))\n\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\n\n\nR, G, B, N = rl()\n\nUP = 3000\n\nA = np.zeros(UP+1, dtype=np.int32)\n\n\n\nfor r in range(UP+1):\n\n if r * R > UP:\n\n break\n\n A[r*R::G] += 1\n\n\n\nanswer = A[N::-B].sum()\n\nprint(answer)\n\n#08\n","code_v0_loc":19,"code_v1_loc":21,"code_v0_num_chars":398,"code_v1_num_chars":395,"code_v0_no_empty_lines":"import sys\n\nstdin = sys.stdin\nri = lambda: int(rs())\nrl = lambda: list(map(int, stdin.readline().split()))\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\nR, G, B, N = rl()\nanswer = 0\nfor r in range(N \/\/ R + 1):\n sum = r * R\n for g in range((N - sum) \/\/ G + 1):\n sum2 = sum + g * G\n if (N - sum2) % B == 0:\n answer += 1\nprint(answer)\n# 45\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\nstdin = sys.stdin\nri = lambda: int(rs())\nrl = lambda: list(map(int, stdin.readline().split()))\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\nR, G, B, N = rl()\nUP = 3000\nA = np.zeros(UP + 1, dtype=np.int32)\nfor r in range(UP + 1):\n if r * R > UP:\n break\n A[r * R :: G] += 1\nanswer = A[N::-B].sum()\nprint(answer)\n# 08\n","code_same":false,"relative_loc_diff_percent":9.5238095238,"diff":["+import numpy as np","-answer = 0","-for r in range(N \/\/ R + 1):","- sum = r * R","- for g in range((N - sum) \/\/ G + 1):","- sum2 = sum + g * G","- if (N - sum2) % B == 0:","- answer += 1","+UP = 3000","+A = np.zeros(UP + 1, dtype=np.int32)","+for r in range(UP + 1):","+ if r * R > UP:","+ break","+ A[r * R :: G] += 1","+answer = A[N::-B].sum()","-# 45","+# 08"],"diff_only_import_comment":false,"measured_runtime_v0":0.1531891193,"measured_runtime_v1":0.239875202,"runtime_lift":0.6386200743,"key":["s491296665","s578949746"]} +{"user_id":"u466335531","problem_id":"p03162","language":"python","submission_id_v0":"s203506187","submission_id_v1":"s191262611","cpu_time_v0":510,"cpu_time_v1":381,"memory_v0":22796,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.29,"input":"N=int(eval(input()))\n\ndp=[list(map(int,input().split()))]\n\nfor _ in range(1,N):\n\n a,b,c=list(map(int,input().split()))\n\n dp.append([a+max(dp[-1][1:]),b+max(dp[-1][0],dp[-1][2]),c+max(dp[-1][:2])])\n\nprint((max(dp[-1])))","target":"N=int(eval(input()))\n\na0,b0,c0=list(map(int,input().split()))\n\nfor _ in range(1,N):\n\n a,b,c=list(map(int,input().split()))\n\n a0,b0,c0=a+max(b0,c0),b+max(a0,c0),c+max(a0,b0)\n\nprint((max(a0,b0,c0)))","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":210,"code_v1_num_chars":182,"code_v0_no_empty_lines":"N = int(eval(input()))\ndp = [list(map(int, input().split()))]\nfor _ in range(1, N):\n a, b, c = list(map(int, input().split()))\n dp.append([a + max(dp[-1][1:]), b + max(dp[-1][0], dp[-1][2]), c + max(dp[-1][:2])])\nprint((max(dp[-1])))\n","code_v1_no_empty_lines":"N = int(eval(input()))\na0, b0, c0 = list(map(int, input().split()))\nfor _ in range(1, N):\n a, b, c = list(map(int, input().split()))\n a0, b0, c0 = a + max(b0, c0), b + max(a0, c0), c + max(a0, b0)\nprint((max(a0, b0, c0)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-dp = [list(map(int, input().split()))]","+a0, b0, c0 = list(map(int, input().split()))","- dp.append([a + max(dp[-1][1:]), b + max(dp[-1][0], dp[-1][2]), c + max(dp[-1][:2])])","-print((max(dp[-1])))","+ a0, b0, c0 = a + max(b0, c0), b + max(a0, c0), c + max(a0, b0)","+print((max(a0, b0, c0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0404474187,"measured_runtime_v1":0.0397388048,"runtime_lift":1.017831786,"key":["s203506187","s191262611"]} +{"user_id":"u912237403","problem_id":"p00150","language":"python","submission_id_v0":"s779918801","submission_id_v1":"s637886311","cpu_time_v0":100,"cpu_time_v1":40,"memory_v0":4516,"memory_v1":4660,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.0,"input":"import bisect as bs\n\ndef prime(m):\n\n N = list(range(1,m+1, 2))\n\n N[0] = 2\n\n for i in range(1, int(m**.5)+1):\n\n x = N[i]\n\n if x: N[i+x::x] = [0] * len(N[i+x::x])\n\n return [_f for _f in N if _f]\n\n\n\nP = prime(10000)\n\nx = [a for a,b in zip(P[1:],P[:-1]) if a-b==2]\n\nwhile 1:\n\n n = eval(input())\n\n if n==0: break\n\n a = x[bs.bisect_right(x, n)-1]\n\n print(a-2, a)","target":"import bisect as bs\n\ndef prime(m):\n\n N = list(range(1,m+1, 2))\n\n N[0] = 2\n\n n = len(N)\n\n for i in range(1, n):\n\n x = N[i]\n\n if x: N[i+x::x] = [0]*len(N[i+x::x])\n\n return [_f for _f in N if _f]\n\n\n\nP = prime(10000)\n\nx = []\n\na = P[0]\n\nfor b in P[1:]:\n\n if b-a==2: x.append(b)\n\n a=b\n\nwhile 1:\n\n n = int(input())\n\n if n==0: break\n\n a = x[bs.bisect_right(x, n)-1]\n\n print(a-2, a)","code_v0_loc":16,"code_v1_loc":21,"code_v0_num_chars":350,"code_v1_num_chars":380,"code_v0_no_empty_lines":"import bisect as bs\n\n\ndef prime(m):\n N = list(range(1, m + 1, 2))\n N[0] = 2\n for i in range(1, int(m**0.5) + 1):\n x = N[i]\n if x:\n N[i + x :: x] = [0] * len(N[i + x :: x])\n return [_f for _f in N if _f]\n\n\nP = prime(10000)\nx = [a for a, b in zip(P[1:], P[:-1]) if a - b == 2]\nwhile 1:\n n = eval(input())\n if n == 0:\n break\n a = x[bs.bisect_right(x, n) - 1]\n print(a - 2, a)\n","code_v1_no_empty_lines":"import bisect as bs\n\n\ndef prime(m):\n N = list(range(1, m + 1, 2))\n N[0] = 2\n n = len(N)\n for i in range(1, n):\n x = N[i]\n if x:\n N[i + x :: x] = [0] * len(N[i + x :: x])\n return [_f for _f in N if _f]\n\n\nP = prime(10000)\nx = []\na = P[0]\nfor b in P[1:]:\n if b - a == 2:\n x.append(b)\n a = b\nwhile 1:\n n = int(input())\n if n == 0:\n break\n a = x[bs.bisect_right(x, n) - 1]\n print(a - 2, a)\n","code_same":false,"relative_loc_diff_percent":23.8095238095,"diff":["- for i in range(1, int(m**0.5) + 1):","+ n = len(N)","+ for i in range(1, n):","-x = [a for a, b in zip(P[1:], P[:-1]) if a - b == 2]","+x = []","+a = P[0]","+for b in P[1:]:","+ if b - a == 2:","+ x.append(b)","+ a = b","- n = eval(input())","+ n = int(input())"],"diff_only_import_comment":false,"measured_runtime_v0":0.0484493985,"measured_runtime_v1":0.0911892047,"runtime_lift":0.5313062953,"key":["s779918801","s637886311"]} +{"user_id":"u722318795","problem_id":"p03574","language":"python","submission_id_v0":"s250033187","submission_id_v1":"s366600641","cpu_time_v0":24,"cpu_time_v1":20,"memory_v0":3572,"memory_v1":2696,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.67,"input":"import sys\n\ndef main():\n\n in1 = input()\n\n nums, length = in1.split(' ')\n\n nums= int(nums)\n\n length = int(length)\n\n bombs = []\n\n\n\n for i in range(nums):\n\n\n\n bombs.append(input())\n\n checked = [['']*length for i in range(nums)]\n\n for i in range(nums):\n\n for j in range(length):\n\n if bombs[i][j] == '#':\n\n checked[i][j] = '#'\n\n else:\n\n bombnum = 0\n\n if i != 0:\n\n if j != 0:\n\n if bombs[i-1][j-1] == '#':\n\n bombnum += 1\n\n\n\n if j != length -1:\n\n if bombs[i-1][j+1] == '#':\n\n bombnum += 1\n\n\n\n if bombs[i-1][j] == '#':\n\n bombnum += 1\n\n\n\n\n\n if j != 0:\n\n if bombs[i][j-1] == '#':\n\n bombnum += 1\n\n\n\n if j != length-1:\n\n if bombs[i][j+1] == '#':\n\n bombnum += 1\n\n\n\n\n\n if i != nums-1:\n\n if j != 0:\n\n if bombs[i+1][j-1] == '#':\n\n bombnum += 1\n\n\n\n if j != length -1:\n\n if bombs[i+1][j+1] == '#':\n\n bombnum += 1\n\n\n\n if bombs[i+1][j] == '#':\n\n bombnum += 1\n\n\n\n checked[i][j] = bombnum\n\n for i in checked:\n\n for j in i:\n\n print(j, end = '')\n\n print('')\n\nif __name__ == '__main__':\n\n main()\n","target":"def check(b, i, j, x, y):\n\n if i < 0 or j < 0 or i == x or j == y:\n\n return 0\n\n if b[i][j] == \"#\":\n\n return 1\n\n return 0\n\n\n\nbounds = input().split(\" \")\n\nx = int(bounds[0])\n\ny = int(bounds[1])\n\nboard = [None] * x\n\nfor i in range(0, x):\n\n k = input()\n\n board[i] = [None] * y\n\n for j in range(0, y):\n\n board[i][j] = k[j]\n\n\n\nfor i in range(0, x):\n\n for j in range(0, y):\n\n if board[i][j] == \".\":\n\n p = 0\n\n p += check(board, i-1, j-1, x, y)\n\n p += check(board, i-1, j , x, y)\n\n p += check(board, i-1, j+1, x, y)\n\n p += check(board, i , j-1, x, y)\n\n p += check(board, i , j+1, x, y)\n\n p += check(board, i+1, j-1, x, y)\n\n p += check(board, i+1, j , x, y)\n\n p += check(board, i+1, j+1, x, y)\n\n board[i][j] = p\n\n z = \"\"\n\n for j in range(0, y):\n\n z += str(board[i][j])\n\n print(z)","code_v0_loc":59,"code_v1_loc":34,"code_v0_num_chars":1609,"code_v1_num_chars":806,"code_v0_no_empty_lines":"import sys\n\n\ndef main():\n in1 = input()\n nums, length = in1.split(\" \")\n nums = int(nums)\n length = int(length)\n bombs = []\n for i in range(nums):\n bombs.append(input())\n checked = [[\"\"] * length for i in range(nums)]\n for i in range(nums):\n for j in range(length):\n if bombs[i][j] == \"#\":\n checked[i][j] = \"#\"\n else:\n bombnum = 0\n if i != 0:\n if j != 0:\n if bombs[i - 1][j - 1] == \"#\":\n bombnum += 1\n if j != length - 1:\n if bombs[i - 1][j + 1] == \"#\":\n bombnum += 1\n if bombs[i - 1][j] == \"#\":\n bombnum += 1\n if j != 0:\n if bombs[i][j - 1] == \"#\":\n bombnum += 1\n if j != length - 1:\n if bombs[i][j + 1] == \"#\":\n bombnum += 1\n if i != nums - 1:\n if j != 0:\n if bombs[i + 1][j - 1] == \"#\":\n bombnum += 1\n if j != length - 1:\n if bombs[i + 1][j + 1] == \"#\":\n bombnum += 1\n if bombs[i + 1][j] == \"#\":\n bombnum += 1\n checked[i][j] = bombnum\n for i in checked:\n for j in i:\n print(j, end=\"\")\n print(\"\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def check(b, i, j, x, y):\n if i < 0 or j < 0 or i == x or j == y:\n return 0\n if b[i][j] == \"#\":\n return 1\n return 0\n\n\nbounds = input().split(\" \")\nx = int(bounds[0])\ny = int(bounds[1])\nboard = [None] * x\nfor i in range(0, x):\n k = input()\n board[i] = [None] * y\n for j in range(0, y):\n board[i][j] = k[j]\nfor i in range(0, x):\n for j in range(0, y):\n if board[i][j] == \".\":\n p = 0\n p += check(board, i - 1, j - 1, x, y)\n p += check(board, i - 1, j, x, y)\n p += check(board, i - 1, j + 1, x, y)\n p += check(board, i, j - 1, x, y)\n p += check(board, i, j + 1, x, y)\n p += check(board, i + 1, j - 1, x, y)\n p += check(board, i + 1, j, x, y)\n p += check(board, i + 1, j + 1, x, y)\n board[i][j] = p\n z = \"\"\n for j in range(0, y):\n z += str(board[i][j])\n print(z)\n","code_same":false,"relative_loc_diff_percent":42.3728813559,"diff":["-import sys","+def check(b, i, j, x, y):","+ if i < 0 or j < 0 or i == x or j == y:","+ return 0","+ if b[i][j] == \"#\":","+ return 1","+ return 0","-def main():","- in1 = input()","- nums, length = in1.split(\" \")","- nums = int(nums)","- length = int(length)","- bombs = []","- for i in range(nums):","- bombs.append(input())","- checked = [[\"\"] * length for i in range(nums)]","- for i in range(nums):","- for j in range(length):","- if bombs[i][j] == \"#\":","- checked[i][j] = \"#\"","- else:","- bombnum = 0","- if i != 0:","- if j != 0:","- if bombs[i - 1][j - 1] == \"#\":","- bombnum += 1","- if j != length - 1:","- if bombs[i - 1][j + 1] == \"#\":","- bombnum += 1","- if bombs[i - 1][j] == \"#\":","- bombnum += 1","- if j != 0:","- if bombs[i][j - 1] == \"#\":","- bombnum += 1","- if j != length - 1:","- if bombs[i][j + 1] == \"#\":","- bombnum += 1","- if i != nums - 1:","- if j != 0:","- if bombs[i + 1][j - 1] == \"#\":","- bombnum += 1","- if j != length - 1:","- if bombs[i + 1][j + 1] == \"#\":","- bombnum += 1","- if bombs[i + 1][j] == \"#\":","- bombnum += 1","- checked[i][j] = bombnum","- for i in checked:","- for j in i:","- print(j, end=\"\")","- print(\"\")","-","-","-if __name__ == \"__main__\":","- main()","+bounds = input().split(\" \")","+x = int(bounds[0])","+y = int(bounds[1])","+board = [None] * x","+for i in range(0, x):","+ k = input()","+ board[i] = [None] * y","+ for j in range(0, y):","+ board[i][j] = k[j]","+for i in range(0, x):","+ for j in range(0, y):","+ if board[i][j] == \".\":","+ p = 0","+ p += check(board, i - 1, j - 1, x, y)","+ p += check(board, i - 1, j, x, y)","+ p += check(board, i - 1, j + 1, x, y)","+ p += check(board, i, j - 1, x, y)","+ p += check(board, i, j + 1, x, y)","+ p += check(board, i + 1, j - 1, x, y)","+ p += check(board, i + 1, j, x, y)","+ p += check(board, i + 1, j + 1, x, y)","+ board[i][j] = p","+ z = \"\"","+ for j in range(0, y):","+ z += str(board[i][j])","+ print(z)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0382227316,"measured_runtime_v1":0.0370086741,"runtime_lift":1.0328046725,"key":["s250033187","s366600641"]} +{"user_id":"u775681539","problem_id":"p02947","language":"python","submission_id_v0":"s251001634","submission_id_v1":"s492692789","cpu_time_v0":343,"cpu_time_v1":219,"memory_v0":19800,"memory_v1":19724,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.15,"input":"#python3\n\nimport collections as cl\n\nn=int(eval(input()))\n\na=[''.join(sorted(eval(input()))) for _ in range(n)]\n\nsum=0\n\nfor i in list(cl.Counter(a).values()):\n\n sum+=i*(i-1)\/\/2\n\nprint(sum)\n\n\n\n\n\n\n\n\n","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nfrom collections import Counter\n\ndef main():\n\n n = int(readline())\n\n S = []\n\n for i in range(n):\n\n S.append(''.join(sorted(readline().rstrip().decode())))\n\n ans = 0\n\n for v in list(Counter(S).values()):\n\n ans += v*(v-1)\/\/2\n\n print(ans)\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":12,"code_v1_loc":17,"code_v0_num_chars":179,"code_v1_num_chars":424,"code_v0_no_empty_lines":"# python3\nimport collections as cl\n\nn = int(eval(input()))\na = [\"\".join(sorted(eval(input()))) for _ in range(n)]\nsum = 0\nfor i in list(cl.Counter(a).values()):\n sum += i * (i - 1) \/\/ 2\nprint(sum)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nfrom collections import Counter\n\n\ndef main():\n n = int(readline())\n S = []\n for i in range(n):\n S.append(\"\".join(sorted(readline().rstrip().decode())))\n ans = 0\n for v in list(Counter(S).values()):\n ans += v * (v - 1) \/\/ 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["-# python3","-import collections as cl","+import sys","-n = int(eval(input()))","-a = [\"\".join(sorted(eval(input()))) for _ in range(n)]","-sum = 0","-for i in list(cl.Counter(a).values()):","- sum += i * (i - 1) \/\/ 2","-print(sum)","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+from collections import Counter","+","+","+def main():","+ n = int(readline())","+ S = []","+ for i in range(n):","+ S.append(\"\".join(sorted(readline().rstrip().decode())))","+ ans = 0","+ for v in list(Counter(S).values()):","+ ans += v * (v - 1) \/\/ 2","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.037547667,"measured_runtime_v1":0.0403966365,"runtime_lift":0.9294750822,"key":["s251001634","s492692789"]} +{"user_id":"u991542950","problem_id":"p03478","language":"python","submission_id_v0":"s525108170","submission_id_v1":"s659645995","cpu_time_v0":40,"cpu_time_v1":36,"memory_v0":8980,"memory_v1":8944,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"n, a, b = list(map(int, input().split()))\n\n\n\nf = 0\n\nfor i in range(1, n+1):\n\n s = sum(map(int, list(str(i))))\n\n if s >= a and s <= b:\n\n f += i\n\nprint(f)","target":"def sumofdigits(n):\n\n s = 0\n\n while n > 0:\n\n s += n % 10\n\n n = n \/\/ 10\n\n return s\n\n\n\nn, a, b = list(map(int, input().split()))\n\n\n\nf = 0\n\nfor i in range(1, n+1):\n\n s = sumofdigits(i)\n\n if s >= a and s <= b:\n\n f += i\n\nprint(f)","code_v0_loc":8,"code_v1_loc":15,"code_v0_num_chars":151,"code_v1_num_chars":232,"code_v0_no_empty_lines":"n, a, b = list(map(int, input().split()))\nf = 0\nfor i in range(1, n + 1):\n s = sum(map(int, list(str(i))))\n if s >= a and s <= b:\n f += i\nprint(f)\n","code_v1_no_empty_lines":"def sumofdigits(n):\n s = 0\n while n > 0:\n s += n % 10\n n = n \/\/ 10\n return s\n\n\nn, a, b = list(map(int, input().split()))\nf = 0\nfor i in range(1, n + 1):\n s = sumofdigits(i)\n if s >= a and s <= b:\n f += i\nprint(f)\n","code_same":false,"relative_loc_diff_percent":46.6666666667,"diff":["+def sumofdigits(n):","+ s = 0","+ while n > 0:","+ s += n % 10","+ n = n \/\/ 10","+ return s","+","+","- s = sum(map(int, list(str(i))))","+ s = sumofdigits(i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0466295967,"measured_runtime_v1":0.0468488002,"runtime_lift":0.9953210438,"key":["s525108170","s659645995"]} +{"user_id":"u391589398","problem_id":"p03284","language":"python","submission_id_v0":"s192948361","submission_id_v1":"s778351176","cpu_time_v0":22,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.73,"input":"n, k = list(map(int, input().split()))\n\nif n%k > 0:\n\n print((1))\n\nelse:\n\n print((0))\n","target":"n, k = list(map(int, input().split()))\n\nif n%k == 0:\n\n print((0))\n\nelse:\n\n print((1))","code_v0_loc":5,"code_v1_loc":5,"code_v0_num_chars":81,"code_v1_num_chars":77,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nif n % k > 0:\n print((1))\nelse:\n print((0))\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nif n % k == 0:\n print((0))\nelse:\n print((1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-if n % k > 0:","+if n % k == 0:","+ print((0))","+else:","-else:","- print((0))"],"diff_only_import_comment":false,"measured_runtime_v0":0.104146064,"measured_runtime_v1":0.0477566416,"runtime_lift":2.1807660772,"key":["s192948361","s778351176"]} +{"user_id":"u581603131","problem_id":"p03338","language":"python","submission_id_v0":"s780135100","submission_id_v1":"s405712986","cpu_time_v0":25,"cpu_time_v1":20,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"N = int(eval(input()))\n\nS = list(eval(input()))\n\ns = set(S)\n\ncount = 0\n\nmaxx = 0\n\nfor i in range(N): #\u5207\u65ad\u5834\u6240\n\n for k in range(i):\n\n if S[k] in S[:i] and S[k] in S[i:] and S[k] not in S[:k]:\n\n count += 1\n\n maxx = max(maxx, count)\n\n count = 0\n\nprint(maxx)","target":"N = int(eval(input()))\n\nS = eval(input())\n\ns = set(S)\n\ncount = 0\n\nmaxx = 0\n\nfor i in range(N): #\u5207\u65ad\u5834\u6240\n\n for k in range(i):\n\n if S[k] in S[:i] and S[k] in S[i:] and S[k] not in S[:k]:\n\n count += 1\n\n maxx = max(maxx, count)\n\n count = 0\n\nprint(maxx)","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":266,"code_v1_num_chars":260,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = list(eval(input()))\ns = set(S)\ncount = 0\nmaxx = 0\nfor i in range(N): # \u5207\u65ad\u5834\u6240\n for k in range(i):\n if S[k] in S[:i] and S[k] in S[i:] and S[k] not in S[:k]:\n count += 1\n maxx = max(maxx, count)\n count = 0\nprint(maxx)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\ns = set(S)\ncount = 0\nmaxx = 0\nfor i in range(N): # \u5207\u65ad\u5834\u6240\n for k in range(i):\n if S[k] in S[:i] and S[k] in S[i:] and S[k] not in S[:k]:\n count += 1\n maxx = max(maxx, count)\n count = 0\nprint(maxx)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S = list(eval(input()))","+S = eval(input())"],"diff_only_import_comment":false,"measured_runtime_v0":0.0719108989,"measured_runtime_v1":0.0618648188,"runtime_lift":1.1623876105,"key":["s780135100","s405712986"]} +{"user_id":"u628335443","problem_id":"p02713","language":"python","submission_id_v0":"s270839112","submission_id_v1":"s630822930","cpu_time_v0":434,"cpu_time_v1":196,"memory_v0":78720,"memory_v1":68724,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.84,"input":"k = int(eval(input()))\n\n\n\nsum = 0\n\n\n\ndef gcd(a, b):\n\n if b == 0:\n\n return a\n\n \n\n return gcd(b, a % b)\n\n\n\n\n\nfor a in range(1, k + 1):\n\n for b in range(1, k + 1):\n\n ab_gcd = gcd(a, b)\n\n for c in range(1, k + 1):\n\n abc_gcd = gcd(c, ab_gcd)\n\n sum += abc_gcd\n\n \n\nprint(sum)\n","target":"import math\n\n\n\nK = int(eval(input()))\n\nans = 0\n\nfor a in range(1, K+1):\n\n for b in range(1, K + 1):\n\n ab_gcd = math.gcd(a, b)\n\n for c in range(1, K + 1):\n\n ans += math.gcd(ab_gcd, c)\n\nprint(ans)\n","code_v0_loc":19,"code_v1_loc":10,"code_v0_num_chars":325,"code_v1_num_chars":217,"code_v0_no_empty_lines":"k = int(eval(input()))\nsum = 0\n\n\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\nfor a in range(1, k + 1):\n for b in range(1, k + 1):\n ab_gcd = gcd(a, b)\n for c in range(1, k + 1):\n abc_gcd = gcd(c, ab_gcd)\n sum += abc_gcd\nprint(sum)\n","code_v1_no_empty_lines":"import math\n\nK = int(eval(input()))\nans = 0\nfor a in range(1, K + 1):\n for b in range(1, K + 1):\n ab_gcd = math.gcd(a, b)\n for c in range(1, K + 1):\n ans += math.gcd(ab_gcd, c)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":47.3684210526,"diff":["-k = int(eval(input()))","-sum = 0","+import math","-","-def gcd(a, b):","- if b == 0:","- return a","- return gcd(b, a % b)","-","-","-for a in range(1, k + 1):","- for b in range(1, k + 1):","- ab_gcd = gcd(a, b)","- for c in range(1, k + 1):","- abc_gcd = gcd(c, ab_gcd)","- sum += abc_gcd","-print(sum)","+K = int(eval(input()))","+ans = 0","+for a in range(1, K + 1):","+ for b in range(1, K + 1):","+ ab_gcd = math.gcd(a, b)","+ for c in range(1, K + 1):","+ ans += math.gcd(ab_gcd, c)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1471249745,"measured_runtime_v1":0.1039737713,"runtime_lift":1.4150200824,"key":["s270839112","s630822930"]} +{"user_id":"u254871849","problem_id":"p04013","language":"python","submission_id_v0":"s728309990","submission_id_v1":"s796553860","cpu_time_v0":1543,"cpu_time_v1":136,"memory_v0":54080,"memory_v1":5604,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.19,"input":"import sys\n\n\n\nn, a, *x = list(map(int, sys.stdin.read().split()))\n\n\n\ndef main():\n\n ma = a * n\n\n res = [[[0] * (ma + 1) for _ in range(n + 1)] for _ in range(n + 1)]\n\n res[0][0][0] = 1\n\n for i in range(n):\n\n cur = x[i]\n\n for j in range(i+2):\n\n for k in range(ma + 1):\n\n res[i+1][j][k] += res[i][j][k]\n\n if k >= cur:\n\n res[i+1][j][k] += res[i][j-1][k-cur]\n\n \n\n ans = 0\n\n for j in range(1, n+1):\n\n ans += res[n][j][j*a]\n\n\n\n return ans\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","target":"import sys\n\n\n\nn, a, *x = list(map(int, sys.stdin.read().split()))\n\n\n\ndef main():\n\n for i in range(n):\n\n x[i] -= a\n\n x.sort()\n\n\n\n res = [[0] * 99*n for _ in range(n+1)]\n\n # res[i][49*n]\u3092\u4e2d\u5fc3\u3068\u3059\u308b\u3002\n\n res[0][49*n] = 1\n\n for i in range(n):\n\n for j in range(99*n):\n\n res[i+1][j] += res[i][j]\n\n cur = x[i]\n\n if cur >= 0:\n\n if j >= cur:\n\n res[i+1][j] += res[i][j-cur]\n\n else:\n\n if j - cur <= 99 * n - 1:\n\n res[i+1][j] += res[i][j-cur]\n\n \n\n ans = res[n][49*n] - 1\n\n return ans\n\n \n\nif __name__ == '__main__':\n\n ans = main()\n\n print(ans)","code_v0_loc":25,"code_v1_loc":29,"code_v0_num_chars":594,"code_v1_num_chars":679,"code_v0_no_empty_lines":"import sys\n\nn, a, *x = list(map(int, sys.stdin.read().split()))\n\n\ndef main():\n ma = a * n\n res = [[[0] * (ma + 1) for _ in range(n + 1)] for _ in range(n + 1)]\n res[0][0][0] = 1\n for i in range(n):\n cur = x[i]\n for j in range(i + 2):\n for k in range(ma + 1):\n res[i + 1][j][k] += res[i][j][k]\n if k >= cur:\n res[i + 1][j][k] += res[i][j - 1][k - cur]\n ans = 0\n for j in range(1, n + 1):\n ans += res[n][j][j * a]\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_v1_no_empty_lines":"import sys\n\nn, a, *x = list(map(int, sys.stdin.read().split()))\n\n\ndef main():\n for i in range(n):\n x[i] -= a\n x.sort()\n res = [[0] * 99 * n for _ in range(n + 1)]\n # res[i][49*n]\u3092\u4e2d\u5fc3\u3068\u3059\u308b\u3002\n res[0][49 * n] = 1\n for i in range(n):\n for j in range(99 * n):\n res[i + 1][j] += res[i][j]\n cur = x[i]\n if cur >= 0:\n if j >= cur:\n res[i + 1][j] += res[i][j - cur]\n else:\n if j - cur <= 99 * n - 1:\n res[i + 1][j] += res[i][j - cur]\n ans = res[n][49 * n] - 1\n return ans\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(ans)\n","code_same":false,"relative_loc_diff_percent":13.7931034483,"diff":["- ma = a * n","- res = [[[0] * (ma + 1) for _ in range(n + 1)] for _ in range(n + 1)]","- res[0][0][0] = 1","- cur = x[i]","- for j in range(i + 2):","- for k in range(ma + 1):","- res[i + 1][j][k] += res[i][j][k]","- if k >= cur:","- res[i + 1][j][k] += res[i][j - 1][k - cur]","- ans = 0","- for j in range(1, n + 1):","- ans += res[n][j][j * a]","+ x[i] -= a","+ x.sort()","+ res = [[0] * 99 * n for _ in range(n + 1)]","+ # res[i][49*n]\u3092\u4e2d\u5fc3\u3068\u3059\u308b\u3002","+ res[0][49 * n] = 1","+ for i in range(n):","+ for j in range(99 * n):","+ res[i + 1][j] += res[i][j]","+ cur = x[i]","+ if cur >= 0:","+ if j >= cur:","+ res[i + 1][j] += res[i][j - cur]","+ else:","+ if j - cur <= 99 * n - 1:","+ res[i + 1][j] += res[i][j - cur]","+ ans = res[n][49 * n] - 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0861020565,"measured_runtime_v1":0.0401827335,"runtime_lift":2.1427625476,"key":["s728309990","s796553860"]} +{"user_id":"u310381103","problem_id":"p03470","language":"python","submission_id_v0":"s634483476","submission_id_v1":"s937785987","cpu_time_v0":163,"cpu_time_v1":25,"memory_v0":38384,"memory_v1":9056,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.66,"input":"N=int(eval(input()))\n\nA=[]\n\nfor i in range(N):\n\n A.append(eval(input())) \n\nA=list(set(A))\n\nprint((len(A)))","target":"n=int(eval(input()))\n\na=set(int(eval(input())) for i in range(n))\n\nprint((len(a)))","code_v0_loc":6,"code_v1_loc":3,"code_v0_num_chars":94,"code_v1_num_chars":68,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = []\nfor i in range(N):\n A.append(eval(input()))\nA = list(set(A))\nprint((len(A)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = set(int(eval(input())) for i in range(n))\nprint((len(a)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-N = int(eval(input()))","-A = []","-for i in range(N):","- A.append(eval(input()))","-A = list(set(A))","-print((len(A)))","+n = int(eval(input()))","+a = set(int(eval(input())) for i in range(n))","+print((len(a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0457827859,"measured_runtime_v1":0.0371694543,"runtime_lift":1.2317314499,"key":["s634483476","s937785987"]} +{"user_id":"u871999682","problem_id":"p03711","language":"python","submission_id_v0":"s652791572","submission_id_v1":"s381170043","cpu_time_v0":11,"cpu_time_v1":10,"memory_v0":2692,"memory_v1":2568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.09,"input":"#coding: utf-8\n\n\n\ngroup={'a':[1,3,5,7,8,10,12],'b':[4,6,9,11],'c':[2]}\n\n\n\ninput_lines=input()\n\ninput_numbers=input_lines.split()\n\nn=list(map(int,input_numbers))#n[0]\u3068n[1]\u306b\u6570\u5b57\n\n\n\nfirst_group = False\n\nsecond_group = False\n\n\n\nfor i in group:\n\n for j in range(0,len(group[i])):\n\n if group[i][j] == n[0]:\n\n first_group = True\n\n if group[i][j] == n[1]:\n\n second_group = True\n\n if first_group == True and second_group==False or first_group == False and second_group == True:\n\n print(\"No\")\n\n break\n\n\n\nif first_group and second_group:\n\n print(\"Yes\")","target":"group =[0,1,3,1,2,1,2,1,1,2,1,2,1]\n\n\n\ninput_lines=input()\n\ninput_numbers=input_lines.split()\n\nn=list(map(int,input_numbers))\n\n\n\nif group[n[0]] == group[n[1]]:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":23,"code_v1_loc":10,"code_v0_num_chars":594,"code_v1_num_chars":196,"code_v0_no_empty_lines":"# coding: utf-8\ngroup = {\"a\": [1, 3, 5, 7, 8, 10, 12], \"b\": [4, 6, 9, 11], \"c\": [2]}\ninput_lines = input()\ninput_numbers = input_lines.split()\nn = list(map(int, input_numbers)) # n[0]\u3068n[1]\u306b\u6570\u5b57\nfirst_group = False\nsecond_group = False\nfor i in group:\n for j in range(0, len(group[i])):\n if group[i][j] == n[0]:\n first_group = True\n if group[i][j] == n[1]:\n second_group = True\n if (\n first_group == True\n and second_group == False\n or first_group == False\n and second_group == True\n ):\n print(\"No\")\n break\nif first_group and second_group:\n print(\"Yes\")\n","code_v1_no_empty_lines":"group = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]\ninput_lines = input()\ninput_numbers = input_lines.split()\nn = list(map(int, input_numbers))\nif group[n[0]] == group[n[1]]:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":56.5217391304,"diff":["-# coding: utf-8","-group = {\"a\": [1, 3, 5, 7, 8, 10, 12], \"b\": [4, 6, 9, 11], \"c\": [2]}","+group = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]","-n = list(map(int, input_numbers)) # n[0]\u3068n[1]\u306b\u6570\u5b57","-first_group = False","-second_group = False","-for i in group:","- for j in range(0, len(group[i])):","- if group[i][j] == n[0]:","- first_group = True","- if group[i][j] == n[1]:","- second_group = True","- if (","- first_group == True","- and second_group == False","- or first_group == False","- and second_group == True","- ):","- print(\"No\")","- break","-if first_group and second_group:","+n = list(map(int, input_numbers))","+if group[n[0]] == group[n[1]]:","+else:","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0335672512,"measured_runtime_v1":0.0325096725,"runtime_lift":1.0325312017,"key":["s652791572","s381170043"]} +{"user_id":"u254871849","problem_id":"p03695","language":"python","submission_id_v0":"s571560200","submission_id_v1":"s984367341","cpu_time_v0":150,"cpu_time_v1":17,"memory_v0":12508,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.67,"input":"import sys\n\nimport numpy as np\n\n\n\nn = int(sys.stdin.readline().rstrip())\n\na = np.array(sys.stdin.readline().split(), dtype=np.int64)\n\n\n\ndef main():\n\n res = np.bincount(np.minimum(a \/\/ 400, 8), minlength=9)\n\n \n\n ans_min = np.count_nonzero(res[:8])\n\n ans_max = ans_min + res[8]\n\n if ans_min == 0:\n\n ans_min = 1\n\n \n\n return ans_min, ans_max\n\n\n\nif __name__ == '__main__':\n\n ans = main()\n\n print(*ans, sep=' ')\n","target":"import sys\n\n\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\n\n\ndef main():\n\n cnt = [0] * 9\n\n for x in a:\n\n cnt[min(x, 3200) \/\/ 400] += 1\n\n mi = 0\n\n for x in cnt[:8]: \n\n if x: mi += 1\n\n ma = mi + cnt[8]\n\n mi = max(1, mi)\n\n print((mi, ma))\n\n \n\nif __name__ == '__main__':\n\n main()","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":436,"code_v1_num_chars":287,"code_v0_no_empty_lines":"import sys\nimport numpy as np\n\nn = int(sys.stdin.readline().rstrip())\na = np.array(sys.stdin.readline().split(), dtype=np.int64)\n\n\ndef main():\n res = np.bincount(np.minimum(a \/\/ 400, 8), minlength=9)\n ans_min = np.count_nonzero(res[:8])\n ans_max = ans_min + res[8]\n if ans_min == 0:\n ans_min = 1\n return ans_min, ans_max\n\n\nif __name__ == \"__main__\":\n ans = main()\n print(*ans, sep=\" \")\n","code_v1_no_empty_lines":"import sys\n\nn, *a = list(map(int, sys.stdin.read().split()))\n\n\ndef main():\n cnt = [0] * 9\n for x in a:\n cnt[min(x, 3200) \/\/ 400] += 1\n mi = 0\n for x in cnt[:8]:\n if x:\n mi += 1\n ma = mi + cnt[8]\n mi = max(1, mi)\n print((mi, ma))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-import numpy as np","-n = int(sys.stdin.readline().rstrip())","-a = np.array(sys.stdin.readline().split(), dtype=np.int64)","+n, *a = list(map(int, sys.stdin.read().split()))","- res = np.bincount(np.minimum(a \/\/ 400, 8), minlength=9)","- ans_min = np.count_nonzero(res[:8])","- ans_max = ans_min + res[8]","- if ans_min == 0:","- ans_min = 1","- return ans_min, ans_max","+ cnt = [0] * 9","+ for x in a:","+ cnt[min(x, 3200) \/\/ 400] += 1","+ mi = 0","+ for x in cnt[:8]:","+ if x:","+ mi += 1","+ ma = mi + cnt[8]","+ mi = max(1, mi)","+ print((mi, ma))","- ans = main()","- print(*ans, sep=\" \")","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.1646936336,"measured_runtime_v1":0.0360554304,"runtime_lift":4.567789973,"key":["s571560200","s984367341"]} +{"user_id":"u287500079","problem_id":"p02787","language":"python","submission_id_v0":"s785932410","submission_id_v1":"s990394055","cpu_time_v0":1870,"cpu_time_v1":424,"memory_v0":3820,"memory_v1":42476,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":77.33,"input":"import math\n\nh,n = list(map(int,input().split()))\n\n\n\n\n\na = [0 for _ in range(n)]\n\nb = [0 for _ in range(n)]\n\nfor i in range(n):\n\n a[i], b[i] = list(map(int,input().split()))\n\n\n\ndp = []\n\nfor i in range(h + max(a)):\n\n dp.append(pow(2, 31) - 1)\n\ndp[0] = 0\n\n\n\nfor i in range(1, len(dp)):\n\n '''\n\n tmp = dp[i]\n\n for j in range(n):\n\n tmp = min(tmp, dp[max(0, i-a[j])] + b[j])\n\n dp[i] = tmp\n\n '''\n\n dp[i] = min(dp[i - A] + B for A, B in zip(a, b))\n\n\n\nprint((min(dp[h:])))","target":"import sys\n\ninf = sys.maxsize\n\n\n\nh,n = list(map(int,input().split()))\n\na = [0 for _ in range(n)]\n\nb = [0 for _ in range(n)]\n\nfor i in range(n):\n\n a[i], b[i] = list(map(int,input().split()))\n\n\n\ndp = [inf for _ in range(h + max([a[i] for i in range(n)]) + 10)] #dp[\u4f53\u529bi\u524a\u308b\u306e\u306b\u5fc5\u8981\u306a\u9b54\u529b]\n\ndp[0] = 0\n\n\n\nfor i in range(1, len(dp)):\n\n for j in range(n):\n\n dp[i] = min(dp[i], dp[max(0, i-a[j])] + b[j])\n\n\n\n#print(dp)\n\nprint((min(dp[h:])))","code_v0_loc":24,"code_v1_loc":18,"code_v0_num_chars":480,"code_v1_num_chars":422,"code_v0_no_empty_lines":"import math\n\nh, n = list(map(int, input().split()))\na = [0 for _ in range(n)]\nb = [0 for _ in range(n)]\nfor i in range(n):\n a[i], b[i] = list(map(int, input().split()))\ndp = []\nfor i in range(h + max(a)):\n dp.append(pow(2, 31) - 1)\ndp[0] = 0\nfor i in range(1, len(dp)):\n \"\"\"\n tmp = dp[i]\n for j in range(n):\n tmp = min(tmp, dp[max(0, i-a[j])] + b[j])\n dp[i] = tmp\n \"\"\"\n dp[i] = min(dp[i - A] + B for A, B in zip(a, b))\nprint((min(dp[h:])))\n","code_v1_no_empty_lines":"import sys\n\ninf = sys.maxsize\nh, n = list(map(int, input().split()))\na = [0 for _ in range(n)]\nb = [0 for _ in range(n)]\nfor i in range(n):\n a[i], b[i] = list(map(int, input().split()))\ndp = [inf for _ in range(h + max([a[i] for i in range(n)]) + 10)] # dp[\u4f53\u529bi\u524a\u308b\u306e\u306b\u5fc5\u8981\u306a\u9b54\u529b]\ndp[0] = 0\nfor i in range(1, len(dp)):\n for j in range(n):\n dp[i] = min(dp[i], dp[max(0, i - a[j])] + b[j])\n# print(dp)\nprint((min(dp[h:])))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import math","+import sys","+inf = sys.maxsize","-dp = []","-for i in range(h + max(a)):","- dp.append(pow(2, 31) - 1)","+dp = [inf for _ in range(h + max([a[i] for i in range(n)]) + 10)] # dp[\u4f53\u529bi\u524a\u308b\u306e\u306b\u5fc5\u8981\u306a\u9b54\u529b]","- \"\"\"","- tmp = dp[i]","- tmp = min(tmp, dp[max(0, i-a[j])] + b[j])","- dp[i] = tmp","- \"\"\"","- dp[i] = min(dp[i - A] + B for A, B in zip(a, b))","+ dp[i] = min(dp[i], dp[max(0, i - a[j])] + b[j])","+# print(dp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0968268223,"measured_runtime_v1":0.0872339873,"runtime_lift":1.109966714,"key":["s785932410","s990394055"]} +{"user_id":"u388927326","problem_id":"p02781","language":"python","submission_id_v0":"s468743276","submission_id_v1":"s180045899","cpu_time_v0":25,"cpu_time_v1":17,"memory_v0":3440,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.0,"input":"#!\/usr\/bin\/env python3\n\n\n\nfrom copy import deepcopy\n\n\n\ndef main():\n\n n = eval(input())\n\n l = len(n)\n\n k = int(eval(input()))\n\n dp0 = [0 for j in range(4)]\n\n dp1 = [0 for j in range(4)]\n\n dp1[0] = 1\n\n for i in range(l):\n\n dppre0 = deepcopy(dp0)\n\n dppre1 = deepcopy(dp1)\n\n d = int(n[i])\n\n if d == 0:\n\n for j in [1, 2, 3]:\n\n dp0[j] += dppre0[j - 1] * 9\n\n else:\n\n for j in [1, 2, 3]:\n\n dp0[j] += dppre0[j - 1] * 9\n\n dp0[j] += dppre1[j - 1] * max(0, d - 1)\n\n for j in [0, 1, 2, 3]:\n\n dp0[j] += dppre1[j]\n\n dp1 = [0 for j in range(4)]\n\n for j in [1, 2, 3]:\n\n dp1[j] = dppre1[j - 1]\n\n print((dp0[k] + dp1[k]))\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"#!\/usr\/bin\/env python3\n\n\n\ndef main():\n\n n = eval(input())\n\n l = len(n)\n\n k = int(eval(input()))\n\n dp0 = [0 for j in range(4)]\n\n dp1 = [0 for j in range(4)]\n\n dp1[0] = 1\n\n for i in range(l):\n\n d = int(n[i])\n\n if d == 0:\n\n for j in [3, 2, 1]:\n\n dp0[j] += dp0[j - 1] * 9\n\n else:\n\n for j in [3, 2, 1]:\n\n dp0[j] += dp0[j - 1] * 9\n\n dp0[j] += dp1[j - 1] * max(0, d - 1)\n\n dp0[j] += dp1[j]\n\n dp0[0] += dp1[0]\n\n dp1 = [0] + dp1[0:3]\n\n print((dp0[k] + dp1[k]))\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":31,"code_v1_loc":25,"code_v0_num_chars":820,"code_v1_num_chars":629,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nfrom copy import deepcopy\n\n\ndef main():\n n = eval(input())\n l = len(n)\n k = int(eval(input()))\n dp0 = [0 for j in range(4)]\n dp1 = [0 for j in range(4)]\n dp1[0] = 1\n for i in range(l):\n dppre0 = deepcopy(dp0)\n dppre1 = deepcopy(dp1)\n d = int(n[i])\n if d == 0:\n for j in [1, 2, 3]:\n dp0[j] += dppre0[j - 1] * 9\n else:\n for j in [1, 2, 3]:\n dp0[j] += dppre0[j - 1] * 9\n dp0[j] += dppre1[j - 1] * max(0, d - 1)\n for j in [0, 1, 2, 3]:\n dp0[j] += dppre1[j]\n dp1 = [0 for j in range(4)]\n for j in [1, 2, 3]:\n dp1[j] = dppre1[j - 1]\n print((dp0[k] + dp1[k]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\ndef main():\n n = eval(input())\n l = len(n)\n k = int(eval(input()))\n dp0 = [0 for j in range(4)]\n dp1 = [0 for j in range(4)]\n dp1[0] = 1\n for i in range(l):\n d = int(n[i])\n if d == 0:\n for j in [3, 2, 1]:\n dp0[j] += dp0[j - 1] * 9\n else:\n for j in [3, 2, 1]:\n dp0[j] += dp0[j - 1] * 9\n dp0[j] += dp1[j - 1] * max(0, d - 1)\n dp0[j] += dp1[j]\n dp0[0] += dp1[0]\n dp1 = [0] + dp1[0:3]\n print((dp0[k] + dp1[k]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":19.3548387097,"diff":["-from copy import deepcopy","-","-","- dppre0 = deepcopy(dp0)","- dppre1 = deepcopy(dp1)","- for j in [1, 2, 3]:","- dp0[j] += dppre0[j - 1] * 9","+ for j in [3, 2, 1]:","+ dp0[j] += dp0[j - 1] * 9","- for j in [1, 2, 3]:","- dp0[j] += dppre0[j - 1] * 9","- dp0[j] += dppre1[j - 1] * max(0, d - 1)","- for j in [0, 1, 2, 3]:","- dp0[j] += dppre1[j]","- dp1 = [0 for j in range(4)]","- for j in [1, 2, 3]:","- dp1[j] = dppre1[j - 1]","+ for j in [3, 2, 1]:","+ dp0[j] += dp0[j - 1] * 9","+ dp0[j] += dp1[j - 1] * max(0, d - 1)","+ dp0[j] += dp1[j]","+ dp0[0] += dp1[0]","+ dp1 = [0] + dp1[0:3]"],"diff_only_import_comment":false,"measured_runtime_v0":0.1173117256,"measured_runtime_v1":0.1199881895,"runtime_lift":0.9776939392,"key":["s468743276","s180045899"]} +{"user_id":"u443512298","problem_id":"p03944","language":"python","submission_id_v0":"s690655957","submission_id_v1":"s267060510","cpu_time_v0":25,"cpu_time_v1":23,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.0,"input":"# coding: utf-8\n\n\n\nw, h, N = list(map(int, input().split()))\n\n\n\nrect = [0, w, 0, h]\n\nfor i in range(N):\n\n x, y, a = list(map(int, input().split()))\n\n rect[a - 1] = (lambda c, r, p: [r, c][p * (c - r) < 0])([x, y][a > 2], rect[a - 1], int(not a % 2) - int(a % 2))\n\n\n\nlength = lambda x: [x, 0][x < 0]\n\nprint((length(rect[1] - rect[0]) * length(rect[3] - rect[2])))","target":"# coding: utf-8\n\n\n\nw, h, N = list(map(int, input().split()))\n\n\n\nrect = [0, w, 0, h]\n\nfor i in range(N):\n\n x, y, a = list(map(int, input().split()))\n\n rect[a - 1] = (lambda c, r, p: [r, c][p * (c - r) < 0])([x, y][a > 2], rect[a - 1], [1, -1][a % 2])\n\n\n\nlength = lambda x: [x, 0][x < 0]\n\nprint((length(rect[1] - rect[0]) * length(rect[3] - rect[2])))","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":366,"code_v1_num_chars":353,"code_v0_no_empty_lines":"# coding: utf-8\nw, h, N = list(map(int, input().split()))\nrect = [0, w, 0, h]\nfor i in range(N):\n x, y, a = list(map(int, input().split()))\n rect[a - 1] = (lambda c, r, p: [r, c][p * (c - r) < 0])(\n [x, y][a > 2], rect[a - 1], int(not a % 2) - int(a % 2)\n )\nlength = lambda x: [x, 0][x < 0]\nprint((length(rect[1] - rect[0]) * length(rect[3] - rect[2])))\n","code_v1_no_empty_lines":"# coding: utf-8\nw, h, N = list(map(int, input().split()))\nrect = [0, w, 0, h]\nfor i in range(N):\n x, y, a = list(map(int, input().split()))\n rect[a - 1] = (lambda c, r, p: [r, c][p * (c - r) < 0])(\n [x, y][a > 2], rect[a - 1], [1, -1][a % 2]\n )\nlength = lambda x: [x, 0][x < 0]\nprint((length(rect[1] - rect[0]) * length(rect[3] - rect[2])))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- [x, y][a > 2], rect[a - 1], int(not a % 2) - int(a % 2)","+ [x, y][a > 2], rect[a - 1], [1, -1][a % 2]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0408769174,"measured_runtime_v1":0.03618507,"runtime_lift":1.1296625185,"key":["s690655957","s267060510"]} +{"user_id":"u648212584","problem_id":"p02936","language":"python","submission_id_v0":"s145162124","submission_id_v1":"s327111554","cpu_time_v0":1479,"cpu_time_v1":1305,"memory_v0":141168,"memory_v1":143784,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.76,"input":"import sys\n\ninput=sys.stdin.readline\n\ndef main():\n\n N,Q = list(map(int,input().split()))\n\n X = [list(map(int,input().split())) for _ in range(N-1)]\n\n Y = [list(map(int,input().split())) for _ in range(Q)]\n\n\n\n con = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n con[X[i][0]-1]+=[X[i][1]-1]\n\n con[X[i][1]-1]+=[X[i][0]-1]\n\n\n\n dif = [0]*N\n\n for i in range(Q):\n\n dif[Y[i][0]-1] += Y[i][1]\n\n\n\n root = [0]\n\n while root:\n\n cur = root.pop()\n\n for i in con[cur]:\n\n dif[i] += dif[cur]\n\n con[i].remove(cur)\n\n root.append(i) \n\n print((*dif))\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"import sys\n\ninput=sys.stdin.readline\n\nfrom collections import deque\n\n\n\ndef main():\n\n N,Q = list(map(int,input().split()))\n\n X = [list(map(int,input().split())) for _ in range(N-1)]\n\n Y = [list(map(int,input().split())) for _ in range(Q)]\n\n\n\n con = [[] for _ in range(N)]\n\n for i in range(N-1):\n\n con[X[i][0]-1]+=[X[i][1]-1]\n\n con[X[i][1]-1]+=[X[i][0]-1]\n\n\n\n dif = [0]*N\n\n for i in range(Q):\n\n dif[Y[i][0]-1] += Y[i][1]\n\n\n\n root = deque([0])\n\n go = [True for _ in range(N)]\n\n go[0] = False\n\n while root:\n\n cur = root.pop()\n\n for fol in con[cur]:\n\n if go[fol]:\n\n dif[fol] += dif[cur]\n\n go[fol] = False\n\n root.append(fol)\n\n\n\n print((*dif))\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":27,"code_v1_loc":33,"code_v0_num_chars":662,"code_v1_num_chars":798,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n N, Q = list(map(int, input().split()))\n X = [list(map(int, input().split())) for _ in range(N - 1)]\n Y = [list(map(int, input().split())) for _ in range(Q)]\n con = [[] for _ in range(N)]\n for i in range(N - 1):\n con[X[i][0] - 1] += [X[i][1] - 1]\n con[X[i][1] - 1] += [X[i][0] - 1]\n dif = [0] * N\n for i in range(Q):\n dif[Y[i][0] - 1] += Y[i][1]\n root = [0]\n while root:\n cur = root.pop()\n for i in con[cur]:\n dif[i] += dif[cur]\n con[i].remove(cur)\n root.append(i)\n print((*dif))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nfrom collections import deque\n\n\ndef main():\n N, Q = list(map(int, input().split()))\n X = [list(map(int, input().split())) for _ in range(N - 1)]\n Y = [list(map(int, input().split())) for _ in range(Q)]\n con = [[] for _ in range(N)]\n for i in range(N - 1):\n con[X[i][0] - 1] += [X[i][1] - 1]\n con[X[i][1] - 1] += [X[i][0] - 1]\n dif = [0] * N\n for i in range(Q):\n dif[Y[i][0] - 1] += Y[i][1]\n root = deque([0])\n go = [True for _ in range(N)]\n go[0] = False\n while root:\n cur = root.pop()\n for fol in con[cur]:\n if go[fol]:\n dif[fol] += dif[cur]\n go[fol] = False\n root.append(fol)\n print((*dif))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["+from collections import deque","- root = [0]","+ root = deque([0])","+ go = [True for _ in range(N)]","+ go[0] = False","- for i in con[cur]:","- dif[i] += dif[cur]","- con[i].remove(cur)","- root.append(i)","+ for fol in con[cur]:","+ if go[fol]:","+ dif[fol] += dif[cur]","+ go[fol] = False","+ root.append(fol)"],"diff_only_import_comment":false,"measured_runtime_v0":0.080446775,"measured_runtime_v1":0.0470156031,"runtime_lift":1.7110654714,"key":["s145162124","s327111554"]} +{"user_id":"u506858457","problem_id":"p02762","language":"python","submission_id_v0":"s124577186","submission_id_v1":"s988871285","cpu_time_v0":1274,"cpu_time_v1":743,"memory_v0":116828,"memory_v1":66768,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.68,"input":"#@YottyPG\u3000Qiita\n\nfrom collections import deque\n\n\n\nN,M,K = list(map(int,input().split()))\n\nfriend = [list(map(int,input().split())) for _ in range(M)]\n\nblock = [list(map(int,input().split())) for _ in range(K)]\n\n\n\nf = [set() for _ in range(N+1)]\n\nb = [set() for _ in range(N+1)]\n\n\n\nfor i,j in friend:\n\n f[i].add(j)\n\n f[j].add(i)\n\nfor i,j in block:\n\n b[i].add(j)\n\n b[j].add(i)\n\n\n\nstack=deque()\n\nans = [0]*(N+1)\n\nvisited = [0]*(N+1)\n\n\n\nfor i in range(1,N+1):\n\n if visited[i]:\n\n continue\n\n link = {i}\n\n visited[i] = 1 \n\n stack.append(i)\n\n while stack:\n\n n = stack.pop()\n\n for j in f[n]:\n\n if visited[j]==0:\n\n stack.append(j)\n\n visited[j] = 1\n\n link.add(j)\n\n for i in link:\n\n ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1\n\nprint((*ans[1:]))","target":"#id:KabukiMining\n\nimport sys\n\nfrom math import *\n\nfrom collections import deque, Counter, defaultdict\n\nfrom fractions import gcd\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\n\ndef eprint(s):\n\n sys.stderr.write('DEBUG: {}'.format(s))\n\n return\n\n\n\ndef main():\n\n n, m, k = list(map(int, input().split()))\n\n fgraph = [list() for i in range(n)]\n\n bgraph = [list() for i in range(n)]\n\n cgraph = [list() for i in range(n)]\n\n \n\n rks = [None] *n\n\n sys.setrecursionlimit(10**9)\n\n # r: \u3069\u306e\u9023\u7d50\u6210\u5206\u306b\u5b58\u5728\u3059\u308b\u304b\u3092\u30e1\u30e2\u3059\u308bid\n\n def dfs(graph,s,r):\n\n if rks[s] is None:\n\n rks[s] = r\n\n for i in range(len(graph[s])):\n\n if rks[graph[s][i]-1] is not None:\n\n continue\n\n dfs(graph, graph[s][i]-1,r)\n\n\n\n for i in range(m):\n\n a,b = list(map(int, input().split()))\n\n fgraph[a-1].append(b)\n\n fgraph[b-1].append(a)\n\n\n\n # print(fgraph)\n\n #print(bgraph)\n\n # \u9023\u7d50\u6210\u5206\u306b\u5bfe\u3057\u3066id\u7684\u306aindex\u3092\u3064\u3051\u308b\n\n c = -1\n\n for i in range(n):\n\n if rks[i] is None:\n\n c += 1\n\n dfs(fgraph, i, c)\n\n \n\n for i in range(k):\n\n c,d = list(map(int, input().split()))\n\n if rks[c-1] == rks[d-1]:\n\n bgraph[d-1].append(c)\n\n bgraph[c-1].append(d)\n\n\n\n counter = Counter(rks)\n\n for i in range(n):\n\n # counter[rks[i]] \u9023\u7d50\u6210\u5206\u306e\u30b5\u30a4\u30ba\n\n # len(fgraph[i]) \u53cb\u9054\u306e\u6570\n\n # len(bgraph[i]) \u9023\u7d50\u6210\u5206\u5185\u306e\u30d6\u30ed\u30c3\u30af\u306e\u6570\n\n # 1 \u81ea\u5206\n\n print((counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1))\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":37,"code_v1_loc":58,"code_v0_num_chars":856,"code_v1_num_chars":1531,"code_v0_no_empty_lines":"# @YottyPG\u3000Qiita\nfrom collections import deque\n\nN, M, K = list(map(int, input().split()))\nfriend = [list(map(int, input().split())) for _ in range(M)]\nblock = [list(map(int, input().split())) for _ in range(K)]\nf = [set() for _ in range(N + 1)]\nb = [set() for _ in range(N + 1)]\nfor i, j in friend:\n f[i].add(j)\n f[j].add(i)\nfor i, j in block:\n b[i].add(j)\n b[j].add(i)\nstack = deque()\nans = [0] * (N + 1)\nvisited = [0] * (N + 1)\nfor i in range(1, N + 1):\n if visited[i]:\n continue\n link = {i}\n visited[i] = 1\n stack.append(i)\n while stack:\n n = stack.pop()\n for j in f[n]:\n if visited[j] == 0:\n stack.append(j)\n visited[j] = 1\n link.add(j)\n for i in link:\n ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1\nprint((*ans[1:]))\n","code_v1_no_empty_lines":"# id:KabukiMining\nimport sys\nfrom math import *\nfrom collections import deque, Counter, defaultdict\nfrom fractions import gcd\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\ndef eprint(s):\n sys.stderr.write(\"DEBUG: {}\".format(s))\n return\n\n\ndef main():\n n, m, k = list(map(int, input().split()))\n fgraph = [list() for i in range(n)]\n bgraph = [list() for i in range(n)]\n cgraph = [list() for i in range(n)]\n rks = [None] * n\n sys.setrecursionlimit(10**9)\n # r: \u3069\u306e\u9023\u7d50\u6210\u5206\u306b\u5b58\u5728\u3059\u308b\u304b\u3092\u30e1\u30e2\u3059\u308bid\n def dfs(graph, s, r):\n if rks[s] is None:\n rks[s] = r\n for i in range(len(graph[s])):\n if rks[graph[s][i] - 1] is not None:\n continue\n dfs(graph, graph[s][i] - 1, r)\n\n for i in range(m):\n a, b = list(map(int, input().split()))\n fgraph[a - 1].append(b)\n fgraph[b - 1].append(a)\n # print(fgraph)\n # print(bgraph)\n # \u9023\u7d50\u6210\u5206\u306b\u5bfe\u3057\u3066id\u7684\u306aindex\u3092\u3064\u3051\u308b\n c = -1\n for i in range(n):\n if rks[i] is None:\n c += 1\n dfs(fgraph, i, c)\n for i in range(k):\n c, d = list(map(int, input().split()))\n if rks[c - 1] == rks[d - 1]:\n bgraph[d - 1].append(c)\n bgraph[c - 1].append(d)\n counter = Counter(rks)\n for i in range(n):\n # counter[rks[i]] \u9023\u7d50\u6210\u5206\u306e\u30b5\u30a4\u30ba\n # len(fgraph[i]) \u53cb\u9054\u306e\u6570\n # len(bgraph[i]) \u9023\u7d50\u6210\u5206\u5185\u306e\u30d6\u30ed\u30c3\u30af\u306e\u6570\n # 1 \u81ea\u5206\n print((counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":36.2068965517,"diff":["-# @YottyPG\u3000Qiita","-from collections import deque","+# id:KabukiMining","+import sys","+from math import *","+from collections import deque, Counter, defaultdict","+from fractions import gcd","-N, M, K = list(map(int, input().split()))","-friend = [list(map(int, input().split())) for _ in range(M)]","-block = [list(map(int, input().split())) for _ in range(K)]","-f = [set() for _ in range(N + 1)]","-b = [set() for _ in range(N + 1)]","-for i, j in friend:","- f[i].add(j)","- f[j].add(i)","-for i, j in block:","- b[i].add(j)","- b[j].add(i)","-stack = deque()","-ans = [0] * (N + 1)","-visited = [0] * (N + 1)","-for i in range(1, N + 1):","- if visited[i]:","- continue","- link = {i}","- visited[i] = 1","- stack.append(i)","- while stack:","- n = stack.pop()","- for j in f[n]:","- if visited[j] == 0:","- stack.append(j)","- visited[j] = 1","- link.add(j)","- for i in link:","- ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1","-print((*ans[1:]))","+input = lambda: sys.stdin.readline().rstrip()","+","+","+def eprint(s):","+ sys.stderr.write(\"DEBUG: {}\".format(s))","+ return","+","+","+def main():","+ n, m, k = list(map(int, input().split()))","+ fgraph = [list() for i in range(n)]","+ bgraph = [list() for i in range(n)]","+ cgraph = [list() for i in range(n)]","+ rks = [None] * n","+ sys.setrecursionlimit(10**9)","+ # r: \u3069\u306e\u9023\u7d50\u6210\u5206\u306b\u5b58\u5728\u3059\u308b\u304b\u3092\u30e1\u30e2\u3059\u308bid","+ def dfs(graph, s, r):","+ if rks[s] is None:","+ rks[s] = r","+ for i in range(len(graph[s])):","+ if rks[graph[s][i] - 1] is not None:","+ continue","+ dfs(graph, graph[s][i] - 1, r)","+","+ for i in range(m):","+ a, b = list(map(int, input().split()))","+ fgraph[a - 1].append(b)","+ fgraph[b - 1].append(a)","+ # print(fgraph)","+ # print(bgraph)","+ # \u9023\u7d50\u6210\u5206\u306b\u5bfe\u3057\u3066id\u7684\u306aindex\u3092\u3064\u3051\u308b","+ c = -1","+ for i in range(n):","+ if rks[i] is None:","+ c += 1","+ dfs(fgraph, i, c)","+ for i in range(k):","+ c, d = list(map(int, input().split()))","+ if rks[c - 1] == rks[d - 1]:","+ bgraph[d - 1].append(c)","+ bgraph[c - 1].append(d)","+ counter = Counter(rks)","+ for i in range(n):","+ # counter[rks[i]] \u9023\u7d50\u6210\u5206\u306e\u30b5\u30a4\u30ba","+ # len(fgraph[i]) \u53cb\u9054\u306e\u6570","+ # len(bgraph[i]) \u9023\u7d50\u6210\u5206\u5185\u306e\u30d6\u30ed\u30c3\u30af\u306e\u6570","+ # 1 \u81ea\u5206","+ print((counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0400581417,"measured_runtime_v1":0.0381592669,"runtime_lift":1.0497618246,"key":["s124577186","s988871285"]} +{"user_id":"u992910889","problem_id":"p03624","language":"python","submission_id_v0":"s000286870","submission_id_v1":"s495022492","cpu_time_v0":201,"cpu_time_v1":170,"memory_v0":49264,"memory_v1":45936,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.42,"input":"# import bisect\n\n# import copy\n\n# import fractions\n\n# import math\n\n# import numpy as np\n\n# from collections import Counter, deque\n\n# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product\n\n\n\ndef resolve():\n\n s=list(eval(input()))\n\n\n\n # \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u5c0f\u6587\u5b57\u2192(97, 123)\n\n # \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u5927\u6587\u5b57\u2192(65, 91)\n\n # \u534a\u89d2\u6570\u5b57\u2192(48, 58)\n\n # \u3072\u3089\u304c\u306a\u2192(12353, 12436)\n\n # \u30ab\u30bf\u30ab\u30ca\u2192(12449, 12532+1)\n\n # \u5168\u89d2\u6570\u5b57\u2192(65296, 65306)\n\n\n\n def moji_list(*args):\n\n moji = []\n\n for i in range(len(args)):\n\n moji.extend([chr(j) for j in range(args[i][0], args[i][1])])\n\n return moji\n\n\n\n lowercase = moji_list((97,123))\n\n\n\n for i in s:\n\n if i in lowercase:\n\n lowercase.remove(i)\n\n print((lowercase[0] if len(lowercase)!=0 else 'None'))\n\n\n\nresolve()","target":"# import bisect\n\n# import copy\n\n# import fractions\n\n# import math\n\n# import numpy as np\n\n# from collections import Counter, deque\n\n# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product\n\n\n\ndef resolve():\n\n s=list(eval(input()))\n\n\n\n# \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u5c0f\u6587\u5b57\u2192(97, 123)\u3092\u5165\u529b\u306b\u5165\u308c\u308b\n\n# \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u5927\u6587\u5b57\u2192(65, 91)\n\n# \u534a\u89d2\u6570\u5b57\u2192(48, 58)\n\n# \u3072\u3089\u304c\u306a\u2192(12353, 12436)\n\n# \u30ab\u30bf\u30ab\u30ca\u2192(12449, 12532+1)\n\n# \u5168\u89d2\u6570\u5b57\u2192(65296, 65306)\n\n\n\n\n\n\n\n def moji_list(*args):\n\n moji = []\n\n for i in range(len(args)):\n\n moji.extend([chr(j) for j in range(args[i][0], args[i][1])])\n\n return moji\n\n\n\n lowercase = moji_list((97,123))\n\n\n\n print((min(set(lowercase)-set(s) or ['None'])))\n\n\n\nresolve()","code_v0_loc":32,"code_v1_loc":31,"code_v0_num_chars":799,"code_v1_num_chars":701,"code_v0_no_empty_lines":"# import bisect\n# import copy\n# import fractions\n# import math\n# import numpy as np\n# from collections import Counter, deque\n# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product\ndef resolve():\n s = list(eval(input()))\n # \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u5c0f\u6587\u5b57\u2192(97, 123)\n # \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u5927\u6587\u5b57\u2192(65, 91)\n # \u534a\u89d2\u6570\u5b57\u2192(48, 58)\n # \u3072\u3089\u304c\u306a\u2192(12353, 12436)\n # \u30ab\u30bf\u30ab\u30ca\u2192(12449, 12532+1)\n # \u5168\u89d2\u6570\u5b57\u2192(65296, 65306)\n def moji_list(*args):\n moji = []\n for i in range(len(args)):\n moji.extend([chr(j) for j in range(args[i][0], args[i][1])])\n return moji\n\n lowercase = moji_list((97, 123))\n for i in s:\n if i in lowercase:\n lowercase.remove(i)\n print((lowercase[0] if len(lowercase) != 0 else \"None\"))\n\n\nresolve()\n","code_v1_no_empty_lines":"# import bisect\n# import copy\n# import fractions\n# import math\n# import numpy as np\n# from collections import Counter, deque\n# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product\ndef resolve():\n s = list(eval(input()))\n # \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u5c0f\u6587\u5b57\u2192(97, 123)\u3092\u5165\u529b\u306b\u5165\u308c\u308b\n # \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u5927\u6587\u5b57\u2192(65, 91)\n # \u534a\u89d2\u6570\u5b57\u2192(48, 58)\n # \u3072\u3089\u304c\u306a\u2192(12353, 12436)\n # \u30ab\u30bf\u30ab\u30ca\u2192(12449, 12532+1)\n # \u5168\u89d2\u6570\u5b57\u2192(65296, 65306)\n def moji_list(*args):\n moji = []\n for i in range(len(args)):\n moji.extend([chr(j) for j in range(args[i][0], args[i][1])])\n return moji\n\n lowercase = moji_list((97, 123))\n print((min(set(lowercase) - set(s) or [\"None\"])))\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":3.125,"diff":["- # \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u5c0f\u6587\u5b57\u2192(97, 123)","+ # \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u5c0f\u6587\u5b57\u2192(97, 123)\u3092\u5165\u529b\u306b\u5165\u308c\u308b","- for i in s:","- if i in lowercase:","- lowercase.remove(i)","- print((lowercase[0] if len(lowercase) != 0 else \"None\"))","+ print((min(set(lowercase) - set(s) or [\"None\"])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0383276463,"measured_runtime_v1":0.0416891575,"runtime_lift":0.9193672542,"key":["s000286870","s495022492"]} +{"user_id":"u759412327","problem_id":"p03835","language":"python","submission_id_v0":"s720716987","submission_id_v1":"s244863460","cpu_time_v0":1510,"cpu_time_v1":1135,"memory_v0":2940,"memory_v1":9164,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.83,"input":"k,s = list(map(int,input().split()))\n\nn = 0\n\n\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n z = s-x-y\n\n if 0<=z<=k:\n\n n+=1\n\n\n\nprint(n)","target":"K,S = list(map(int,input().split()))\n\na = 0\n\n\n\nfor X in range(K+1):\n\n for Y in range(K+1):\n\n Z = S-X-Y\n\n if 0<=Z<=K:\n\n a+=1\n\n\n\nprint(a)","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":157,"code_v1_num_chars":141,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\nn = 0\nfor x in range(k + 1):\n for y in range(k + 1):\n z = s - x - y\n if 0 <= z <= k:\n n += 1\nprint(n)\n","code_v1_no_empty_lines":"K, S = list(map(int, input().split()))\na = 0\nfor X in range(K + 1):\n for Y in range(K + 1):\n Z = S - X - Y\n if 0 <= Z <= K:\n a += 1\nprint(a)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-k, s = list(map(int, input().split()))","-n = 0","-for x in range(k + 1):","- for y in range(k + 1):","- z = s - x - y","- if 0 <= z <= k:","- n += 1","-print(n)","+K, S = list(map(int, input().split()))","+a = 0","+for X in range(K + 1):","+ for Y in range(K + 1):","+ Z = S - X - Y","+ if 0 <= Z <= K:","+ a += 1","+print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0428333879,"measured_runtime_v1":0.1608966957,"runtime_lift":0.266216703,"key":["s720716987","s244863460"]} +{"user_id":"u197300773","problem_id":"p03476","language":"python","submission_id_v0":"s483960683","submission_id_v1":"s046561794","cpu_time_v0":815,"cpu_time_v1":269,"memory_v0":5168,"memory_v1":5468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.99,"input":"import math\n\nimport sys\n\ndef sieve(n):\n\n if n < 2:\n\n is_prime = [False for _ in range(n+1)]\n\n return is_prime\n\n \n\n is_prime = [True for _ in range(n+1)]\n\n is_prime[0] = False\n\n is_prime[1] = False\n\n \n\n for i in range(2, int(n**0.5)+1):\n\n if is_prime[i]:\n\n for j in range(i*2, n+1, i):\n\n is_prime[j] = False\n\n \n\n return is_prime\n\n\n\ndef main():\n\n\tN=10**5\n\n\tprime=sieve(N)\n\n\ta=[0 for i in range(N+1)]\n\n\tfor i in range(3,N+1):\n\n\t\tif prime[i] and prime[(i+1)\/\/2]: a[i]=a[i-1]+1\n\n\t\telse: a[i]=a[i-1]\n\n\n\n\tQ=int(eval(input()))\n\n\tfor i in range(Q):\n\n\t\tl,r=list(map(int,input().split()))\n\n\t\tprint((a[r]-a[l-1]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()","target":"import math\n\nimport sys\n\ndef sieve(n):\n\n if n < 2:\n\n is_prime = [False for _ in range(n+1)]\n\n return is_prime\n\n \n\n is_prime = [True for _ in range(n+1)]\n\n is_prime[0] = False\n\n is_prime[1] = False\n\n \n\n for i in range(2, int(n**0.5)+1):\n\n if is_prime[i]:\n\n for j in range(i*2, n+1, i):\n\n is_prime[j] = False\n\n \n\n return is_prime\n\n\n\ninput = sys.stdin.readline\n\nN=10**5\n\nprime=sieve(N)\n\na=[0 for i in range(N+1)]\n\nfor i in range(3,N+1):\n\n\tif prime[i] and prime[(i+1)\/\/2]: a[i]=a[i-1]+1\n\n\telse: a[i]=a[i-1]\n\n\n\nfor i in range(int(eval(input()))):\n\n\tl,r=list(map(int,input().split()))\n\n\tprint((a[r]-a[l-1]))","code_v0_loc":34,"code_v1_loc":29,"code_v0_num_chars":696,"code_v1_num_chars":652,"code_v0_no_empty_lines":"import math\nimport sys\n\n\ndef sieve(n):\n if n < 2:\n is_prime = [False for _ in range(n + 1)]\n return is_prime\n is_prime = [True for _ in range(n + 1)]\n is_prime[0] = False\n is_prime[1] = False\n for i in range(2, int(n**0.5) + 1):\n if is_prime[i]:\n for j in range(i * 2, n + 1, i):\n is_prime[j] = False\n return is_prime\n\n\ndef main():\n N = 10**5\n prime = sieve(N)\n a = [0 for i in range(N + 1)]\n for i in range(3, N + 1):\n if prime[i] and prime[(i + 1) \/\/ 2]:\n a[i] = a[i - 1] + 1\n else:\n a[i] = a[i - 1]\n Q = int(eval(input()))\n for i in range(Q):\n l, r = list(map(int, input().split()))\n print((a[r] - a[l - 1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import math\nimport sys\n\n\ndef sieve(n):\n if n < 2:\n is_prime = [False for _ in range(n + 1)]\n return is_prime\n is_prime = [True for _ in range(n + 1)]\n is_prime[0] = False\n is_prime[1] = False\n for i in range(2, int(n**0.5) + 1):\n if is_prime[i]:\n for j in range(i * 2, n + 1, i):\n is_prime[j] = False\n return is_prime\n\n\ninput = sys.stdin.readline\nN = 10**5\nprime = sieve(N)\na = [0 for i in range(N + 1)]\nfor i in range(3, N + 1):\n if prime[i] and prime[(i + 1) \/\/ 2]:\n a[i] = a[i - 1] + 1\n else:\n a[i] = a[i - 1]\nfor i in range(int(eval(input()))):\n l, r = list(map(int, input().split()))\n print((a[r] - a[l - 1]))\n","code_same":false,"relative_loc_diff_percent":14.7058823529,"diff":["-def main():","- N = 10**5","- prime = sieve(N)","- a = [0 for i in range(N + 1)]","- for i in range(3, N + 1):","- if prime[i] and prime[(i + 1) \/\/ 2]:","- a[i] = a[i - 1] + 1","- else:","- a[i] = a[i - 1]","- Q = int(eval(input()))","- for i in range(Q):","- l, r = list(map(int, input().split()))","- print((a[r] - a[l - 1]))","-","-","-if __name__ == \"__main__\":","- main()","+input = sys.stdin.readline","+N = 10**5","+prime = sieve(N)","+a = [0 for i in range(N + 1)]","+for i in range(3, N + 1):","+ if prime[i] and prime[(i + 1) \/\/ 2]:","+ a[i] = a[i - 1] + 1","+ else:","+ a[i] = a[i - 1]","+for i in range(int(eval(input()))):","+ l, r = list(map(int, input().split()))","+ print((a[r] - a[l - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1073239405,"measured_runtime_v1":0.2761183546,"runtime_lift":0.3886881793,"key":["s483960683","s046561794"]} +{"user_id":"u579699847","problem_id":"p03163","language":"python","submission_id_v0":"s689206264","submission_id_v1":"s794464789","cpu_time_v0":799,"cpu_time_v1":514,"memory_v0":121200,"memory_v1":120940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.67,"input":"import collections,itertools,sys\n\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\nN,W = LI()\n\nwv = [LI() for _ in range(N)]\n\ndp = [[0]*(W+1) for _ in range(N+1)] #1_indexed\n\nfor i,j in itertools.product(list(range(1,N+1)),list(range(W+1))):\n\n w,v = wv[i-1]\n\n if j-w>=0:\n\n dp[i][j] = max(dp[i][j],dp[i-1][j-w]+v)\n\n dp[i][j] = max(dp[i][j],dp[i-1][j])\n\nprint((dp[-1][-1]))\n","target":"import sys\n\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\nN,W = LI()\n\nwv = [LI() for _ in range(N)]\n\ndp = [[0]*(W+1) for _ in range(N+1)] #1_indexed\n\nfor i in range(1,N+1):\n\n w,v = wv[i-1]\n\n for j in range(W+1):\n\n if j-w>=0:\n\n dp[i][j] = max(dp[i][j],dp[i-1][j-w]+v)\n\n dp[i][j] = max(dp[i][j],dp[i-1][j])\n\nprint((dp[-1][-1]))\n","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":396,"code_v1_num_chars":380,"code_v0_no_empty_lines":"import collections, itertools, sys\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\nN, W = LI()\nwv = [LI() for _ in range(N)]\ndp = [[0] * (W + 1) for _ in range(N + 1)] # 1_indexed\nfor i, j in itertools.product(list(range(1, N + 1)), list(range(W + 1))):\n w, v = wv[i - 1]\n if j - w >= 0:\n dp[i][j] = max(dp[i][j], dp[i - 1][j - w] + v)\n dp[i][j] = max(dp[i][j], dp[i - 1][j])\nprint((dp[-1][-1]))\n","code_v1_no_empty_lines":"import sys\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().rstrip().split()))\n\n\nN, W = LI()\nwv = [LI() for _ in range(N)]\ndp = [[0] * (W + 1) for _ in range(N + 1)] # 1_indexed\nfor i in range(1, N + 1):\n w, v = wv[i - 1]\n for j in range(W + 1):\n if j - w >= 0:\n dp[i][j] = max(dp[i][j], dp[i - 1][j - w] + v)\n dp[i][j] = max(dp[i][j], dp[i - 1][j])\nprint((dp[-1][-1]))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import collections, itertools, sys","+import sys","-for i, j in itertools.product(list(range(1, N + 1)), list(range(W + 1))):","+for i in range(1, N + 1):","- if j - w >= 0:","- dp[i][j] = max(dp[i][j], dp[i - 1][j - w] + v)","- dp[i][j] = max(dp[i][j], dp[i - 1][j])","+ for j in range(W + 1):","+ if j - w >= 0:","+ dp[i][j] = max(dp[i][j], dp[i - 1][j - w] + v)","+ dp[i][j] = max(dp[i][j], dp[i - 1][j])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0557591438,"measured_runtime_v1":0.0640889168,"runtime_lift":0.870027871,"key":["s689206264","s794464789"]} +{"user_id":"u761320129","problem_id":"p02959","language":"python","submission_id_v0":"s545748826","submission_id_v1":"s010054310","cpu_time_v0":197,"cpu_time_v1":168,"memory_v0":19116,"memory_v1":18476,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.72,"input":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor i in range(N):\n\n p = min(A[i], B[i])\n\n ans += p\n\n B[i] -= p\n\n p = min(A[i+1],B[i])\n\n ans += p\n\n A[i+1] -= p\n\nprint(ans)","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nB = list(map(int,input().split()))\n\n\n\nans = 0\n\nfor i,b in enumerate(B):\n\n x = min(A[i], b)\n\n ans += x\n\n b -= x\n\n y = min(A[i+1], b)\n\n ans += y\n\n A[i+1] -= y\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":242,"code_v1_num_chars":240,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n p = min(A[i], B[i])\n ans += p\n B[i] -= p\n p = min(A[i + 1], B[i])\n ans += p\n A[i + 1] -= p\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nans = 0\nfor i, b in enumerate(B):\n x = min(A[i], b)\n ans += x\n b -= x\n y = min(A[i + 1], b)\n ans += y\n A[i + 1] -= y\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(N):","- p = min(A[i], B[i])","- ans += p","- B[i] -= p","- p = min(A[i + 1], B[i])","- ans += p","- A[i + 1] -= p","+for i, b in enumerate(B):","+ x = min(A[i], b)","+ ans += x","+ b -= x","+ y = min(A[i + 1], b)","+ ans += y","+ A[i + 1] -= y"],"diff_only_import_comment":false,"measured_runtime_v0":0.0761402645,"measured_runtime_v1":0.0847665176,"runtime_lift":0.898235136,"key":["s545748826","s010054310"]} +{"user_id":"u794544096","problem_id":"p02682","language":"python","submission_id_v0":"s850460452","submission_id_v1":"s935596596","cpu_time_v0":72,"cpu_time_v1":66,"memory_v0":61880,"memory_v1":61684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.33,"input":"a, b, c, k = list(map(int, input().split()))\n\n\n\nif a >= k:\n\n print(k)\n\nelif a + b >= k:\n\n print(a)\n\nelse:\n\n print((a - (k -(a+b))))","target":"a, b, c, k = list(map(int, input().split()))\n\n\n\nif k <= a:\n\n print(k)\n\nelif k <= a+b:\n\n print(a)\n\nelif k > a+b:\n\n print((a- (k-(a+b))))","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":132,"code_v1_num_chars":136,"code_v0_no_empty_lines":"a, b, c, k = list(map(int, input().split()))\nif a >= k:\n print(k)\nelif a + b >= k:\n print(a)\nelse:\n print((a - (k - (a + b))))\n","code_v1_no_empty_lines":"a, b, c, k = list(map(int, input().split()))\nif k <= a:\n print(k)\nelif k <= a + b:\n print(a)\nelif k > a + b:\n print((a - (k - (a + b))))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-if a >= k:","+if k <= a:","-elif a + b >= k:","+elif k <= a + b:","-else:","+elif k > a + b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369213064,"measured_runtime_v1":0.0462850294,"runtime_lift":0.7976943481,"key":["s850460452","s935596596"]} +{"user_id":"u173148629","problem_id":"p02762","language":"python","submission_id_v0":"s790866976","submission_id_v1":"s664304098","cpu_time_v0":1156,"cpu_time_v1":1066,"memory_v0":6428,"memory_v1":6396,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.79,"input":"N,M,K=map(int,input().split())\n\n\n\npar=[-1]*N\n\nnum=[0]*N\n\n\n\ndef find(x):\n\n if par[x-1]<0:\n\n return x\n\n else:\n\n par[x-1]=find(par[x-1])\n\n return par[x-1]\n\n\n\ndef union(x,y):\n\n p,q=find(x),find(y)\n\n if p==q:\n\n return\n\n if p>q:\n\n p,q=q,p\n\n par[p-1]+=par[q-1]\n\n par[q-1]=p \n\n\n\ndef size(x):\n\n return -par[find(x)-1]\n\n\n\ndef same(x,y):\n\n return find(x)==find(y)\n\n \n\n\n\nfor _ in range(M):\n\n a,b=map(int,input().split())\n\n union(a,b)\n\n num[a-1]+=1\n\n num[b-1]+=1\n\n\n\nfor _ in range(K):\n\n c,d=map(int,input().split())\n\n if same(c,d):\n\n num[c-1]+=1\n\n num[d-1]+=1\n\n\n\nfor i in range(N):\n\n print(size(i+1)-1-num[i],end=\" \")\n","target":"N,M,K=map(int,input().split())\n\n\n\npar=[-1]*N\n\nnum=[0]*N\n\n\n\ndef find(x):\n\n if par[x]<0:\n\n return x\n\n else:\n\n par[x]=find(par[x])\n\n return par[x]\n\n\n\ndef union(x,y):\n\n p,q=find(x),find(y)\n\n if p==q:\n\n return\n\n if p>q:\n\n p,q=q,p\n\n par[p]+=par[q]\n\n par[q]=p \n\n\n\ndef size(x):\n\n return -par[find(x)]\n\n\n\ndef same(x,y):\n\n return find(x)==find(y)\n\n \n\n\n\nfor _ in range(M):\n\n a,b=map(int,input().split())\n\n a-=1\n\n b-=1\n\n union(a,b)\n\n num[a]+=1\n\n num[b]+=1\n\n\n\nfor _ in range(K):\n\n c,d=map(int,input().split())\n\n c-=1\n\n d-=1\n\n if same(c,d):\n\n num[c]+=1\n\n num[d]+=1\n\n\n\nfor i in range(N):\n\n print(size(i)-1-num[i],end=\" \")\n","code_v0_loc":42,"code_v1_loc":46,"code_v0_num_chars":710,"code_v1_num_chars":725,"code_v0_no_empty_lines":"N, M, K = map(int, input().split())\npar = [-1] * N\nnum = [0] * N\n\n\ndef find(x):\n if par[x - 1] < 0:\n return x\n else:\n par[x - 1] = find(par[x - 1])\n return par[x - 1]\n\n\ndef union(x, y):\n p, q = find(x), find(y)\n if p == q:\n return\n if p > q:\n p, q = q, p\n par[p - 1] += par[q - 1]\n par[q - 1] = p\n\n\ndef size(x):\n return -par[find(x) - 1]\n\n\ndef same(x, y):\n return find(x) == find(y)\n\n\nfor _ in range(M):\n a, b = map(int, input().split())\n union(a, b)\n num[a - 1] += 1\n num[b - 1] += 1\nfor _ in range(K):\n c, d = map(int, input().split())\n if same(c, d):\n num[c - 1] += 1\n num[d - 1] += 1\nfor i in range(N):\n print(size(i + 1) - 1 - num[i], end=\" \")\n","code_v1_no_empty_lines":"N, M, K = map(int, input().split())\npar = [-1] * N\nnum = [0] * N\n\n\ndef find(x):\n if par[x] < 0:\n return x\n else:\n par[x] = find(par[x])\n return par[x]\n\n\ndef union(x, y):\n p, q = find(x), find(y)\n if p == q:\n return\n if p > q:\n p, q = q, p\n par[p] += par[q]\n par[q] = p\n\n\ndef size(x):\n return -par[find(x)]\n\n\ndef same(x, y):\n return find(x) == find(y)\n\n\nfor _ in range(M):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n union(a, b)\n num[a] += 1\n num[b] += 1\nfor _ in range(K):\n c, d = map(int, input().split())\n c -= 1\n d -= 1\n if same(c, d):\n num[c] += 1\n num[d] += 1\nfor i in range(N):\n print(size(i) - 1 - num[i], end=\" \")\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["- if par[x - 1] < 0:","+ if par[x] < 0:","- par[x - 1] = find(par[x - 1])","- return par[x - 1]","+ par[x] = find(par[x])","+ return par[x]","- par[p - 1] += par[q - 1]","- par[q - 1] = p","+ par[p] += par[q]","+ par[q] = p","- return -par[find(x) - 1]","+ return -par[find(x)]","+ a -= 1","+ b -= 1","- num[a - 1] += 1","- num[b - 1] += 1","+ num[a] += 1","+ num[b] += 1","+ c -= 1","+ d -= 1","- num[c - 1] += 1","- num[d - 1] += 1","+ num[c] += 1","+ num[d] += 1","- print(size(i + 1) - 1 - num[i], end=\" \")","+ print(size(i) - 1 - num[i], end=\" \")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0378828719,"measured_runtime_v1":0.0369249494,"runtime_lift":1.0259424174,"key":["s790866976","s664304098"]} +{"user_id":"u466917094","problem_id":"p03291","language":"python","submission_id_v0":"s040144980","submission_id_v1":"s538585772","cpu_time_v0":1354,"cpu_time_v1":1209,"memory_v0":21408,"memory_v1":14668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.71,"input":"import numpy as np\n\ns=eval(input())\n\nn=len(s)\n\nMOD=1000000007\n\nwayA=np.array([0,0,0,0],dtype=np.int64)\n\nwayB=np.array([0,0,0,0],dtype=np.int64)\n\nwayC=np.array([0,0,0,0],dtype=np.int64)\n\nMOD2=np.array([MOD,MOD,MOD,MOD],dtype=np.int32)\n\nhatena=0\n\nfor c in s:\n\n\tif c==\"A\":\n\n\t\twayA[0]+=1\n\n\tif c==\"B\":\n\n\t\twayB+=wayA\n\n\tif c=='C':\n\n\t\twayC+=wayB\n\n\tif c=='?':\n\n\t\twayC[1]=wayC[1]+wayB[0]\n\n\t\twayC[2]=wayC[2]+wayB[1]\n\n\t\twayC[3]=wayC[3]+wayB[2]\n\n\t\twayB[1]=wayB[1]+wayA[0]\n\n\t\twayB[2]=wayB[2]+wayA[1]\n\n\t\twayA[1]=wayA[1]+1\n\n\t\thatena+=1\n\n\twayA%=MOD2\n\n\twayB%=MOD2\n\n\twayC%=MOD2\n\nans=0\n\nfor i in range(0,4):\n\n\tp3=1\n\n\tfor k in range(0,hatena-i):\n\n\t\tp3=p3*3\n\n\t\tp3=p3%MOD\n\n\tans=ans+p3*wayC[i]\n\n\tans=ans%MOD\n\nprint((int(ans)))","target":"import numpy as np\n\ns=eval(input())\n\nn=len(s)\n\nMOD=1000000007\n\nwayA=np.array([0,0,0,0],dtype=np.int64)\n\nwayB=np.array([0,0,0,0],dtype=np.int64)\n\nwayC=np.array([0,0,0,0],dtype=np.int64)\n\nMOD2=np.array([MOD,MOD,MOD,MOD],dtype=np.int32)\n\nhatena=0\n\nfor c in s:\n\n\tif c==\"A\":\n\n\t\twayA[0]+=1\n\n\tif c==\"B\":\n\n\t\twayB+=wayA\n\n\tif c=='C':\n\n\t\twayC+=wayB\n\n\tif c=='?':\n\n\t\twayC[1]=wayC[1]+wayB[0]\n\n\t\twayC[2]=wayC[2]+wayB[1]\n\n\t\twayC[3]=wayC[3]+wayB[2]\n\n\t\twayB[1]=wayB[1]+wayA[0]\n\n\t\twayB[2]=wayB[2]+wayA[1]\n\n\t\twayA[1]=wayA[1]+1\n\n\t\thatena+=1\n\n\twayA%=MOD2\n\n\twayB%=MOD2\n\n\twayC%=MOD2\n\nans=0\n\nfor i in range(0,4):\n\n\tans=ans+pow(3,hatena-i)*wayC[i]\n\n\tans=ans%MOD\n\nprint((int(ans)))","code_v0_loc":36,"code_v1_loc":32,"code_v0_num_chars":694,"code_v1_num_chars":646,"code_v0_no_empty_lines":"import numpy as np\n\ns = eval(input())\nn = len(s)\nMOD = 1000000007\nwayA = np.array([0, 0, 0, 0], dtype=np.int64)\nwayB = np.array([0, 0, 0, 0], dtype=np.int64)\nwayC = np.array([0, 0, 0, 0], dtype=np.int64)\nMOD2 = np.array([MOD, MOD, MOD, MOD], dtype=np.int32)\nhatena = 0\nfor c in s:\n if c == \"A\":\n wayA[0] += 1\n if c == \"B\":\n wayB += wayA\n if c == \"C\":\n wayC += wayB\n if c == \"?\":\n wayC[1] = wayC[1] + wayB[0]\n wayC[2] = wayC[2] + wayB[1]\n wayC[3] = wayC[3] + wayB[2]\n wayB[1] = wayB[1] + wayA[0]\n wayB[2] = wayB[2] + wayA[1]\n wayA[1] = wayA[1] + 1\n hatena += 1\n wayA %= MOD2\n wayB %= MOD2\n wayC %= MOD2\nans = 0\nfor i in range(0, 4):\n p3 = 1\n for k in range(0, hatena - i):\n p3 = p3 * 3\n p3 = p3 % MOD\n ans = ans + p3 * wayC[i]\n ans = ans % MOD\nprint((int(ans)))\n","code_v1_no_empty_lines":"import numpy as np\n\ns = eval(input())\nn = len(s)\nMOD = 1000000007\nwayA = np.array([0, 0, 0, 0], dtype=np.int64)\nwayB = np.array([0, 0, 0, 0], dtype=np.int64)\nwayC = np.array([0, 0, 0, 0], dtype=np.int64)\nMOD2 = np.array([MOD, MOD, MOD, MOD], dtype=np.int32)\nhatena = 0\nfor c in s:\n if c == \"A\":\n wayA[0] += 1\n if c == \"B\":\n wayB += wayA\n if c == \"C\":\n wayC += wayB\n if c == \"?\":\n wayC[1] = wayC[1] + wayB[0]\n wayC[2] = wayC[2] + wayB[1]\n wayC[3] = wayC[3] + wayB[2]\n wayB[1] = wayB[1] + wayA[0]\n wayB[2] = wayB[2] + wayA[1]\n wayA[1] = wayA[1] + 1\n hatena += 1\n wayA %= MOD2\n wayB %= MOD2\n wayC %= MOD2\nans = 0\nfor i in range(0, 4):\n ans = ans + pow(3, hatena - i) * wayC[i]\n ans = ans % MOD\nprint((int(ans)))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["- p3 = 1","- for k in range(0, hatena - i):","- p3 = p3 * 3","- p3 = p3 % MOD","- ans = ans + p3 * wayC[i]","+ ans = ans + pow(3, hatena - i) * wayC[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.3438969681,"measured_runtime_v1":0.3105503571,"runtime_lift":1.107379078,"key":["s040144980","s538585772"]} +{"user_id":"u663767599","problem_id":"p02803","language":"python","submission_id_v0":"s412199738","submission_id_v1":"s480227124","cpu_time_v0":500,"cpu_time_v1":308,"memory_v0":3316,"memory_v1":48732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.4,"input":"from collections import deque\n\nfrom itertools import chain\n\n\n\nH, W = list(map(int, input().split()))\n\nM = [list(eval(input())) for _ in range(H)]\n\ninf = float('inf')\n\n\n\n\n\ndef flatten(list_of_lists):\n\n return chain.from_iterable(list_of_lists)\n\n\n\n\n\ndef bfs(start, end):\n\n distance = [[inf for i in range(W)] for j in range(H)]\n\n queue = deque([(end, start)])\n\n distance[end][start] = 0\n\n\n\n while queue:\n\n y, x = queue.pop()\n\n for i in range(0, 4):\n\n nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]\n\n if 0 <= nx < W and 0 <= ny < H and M[ny][nx] != '#' and distance[ny][nx] == inf:\n\n queue.appendleft((ny, nx))\n\n distance[ny][nx] = distance[y][x] + 1\n\n return distance\n\n\n\n\n\nm = 0\n\nfor i in range(W):\n\n for j in range(H):\n\n if M[j][i] != \"#\":\n\n\n\n for length in list(flatten(bfs(i, j))):\n\n if length != inf and m < length:\n\n m = length\n\n\n\nprint(m)\n","target":"from collections import deque\n\nfrom itertools import chain\n\n\n\nH, W = list(map(int, input().split()))\n\nM = [list(eval(input())) for _ in range(H)]\n\ninf = float('inf')\n\n\n\n\n\ndef flatten(list_of_lists):\n\n return chain.from_iterable(list_of_lists)\n\n\n\n\n\ndef bfs(start, end):\n\n distance = [[inf for _ in range(W)] for _ in range(H)]\n\n queue = deque([(end, start)])\n\n distance[end][start] = 0\n\n\n\n while queue:\n\n y, x = queue.pop()\n\n for i in range(0, 4):\n\n nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]\n\n if 0 <= nx < W and 0 <= ny < H and M[ny][nx] != '#' and distance[ny][nx] == inf:\n\n queue.appendleft((ny, nx))\n\n distance[ny][nx] = distance[y][x] + 1\n\n return distance\n\n\n\n\n\nm = 0\n\nfor i in range(W):\n\n for j in range(H):\n\n if M[j][i] != \"#\":\n\n\n\n for length in list(flatten(bfs(i, j))):\n\n if length != inf and m < length:\n\n m = length\n\n\n\nprint(m)\n","code_v0_loc":37,"code_v1_loc":37,"code_v0_num_chars":975,"code_v1_num_chars":975,"code_v0_no_empty_lines":"from collections import deque\nfrom itertools import chain\n\nH, W = list(map(int, input().split()))\nM = [list(eval(input())) for _ in range(H)]\ninf = float(\"inf\")\n\n\ndef flatten(list_of_lists):\n return chain.from_iterable(list_of_lists)\n\n\ndef bfs(start, end):\n distance = [[inf for i in range(W)] for j in range(H)]\n queue = deque([(end, start)])\n distance[end][start] = 0\n while queue:\n y, x = queue.pop()\n for i in range(0, 4):\n nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]\n if (\n 0 <= nx < W\n and 0 <= ny < H\n and M[ny][nx] != \"#\"\n and distance[ny][nx] == inf\n ):\n queue.appendleft((ny, nx))\n distance[ny][nx] = distance[y][x] + 1\n return distance\n\n\nm = 0\nfor i in range(W):\n for j in range(H):\n if M[j][i] != \"#\":\n for length in list(flatten(bfs(i, j))):\n if length != inf and m < length:\n m = length\nprint(m)\n","code_v1_no_empty_lines":"from collections import deque\nfrom itertools import chain\n\nH, W = list(map(int, input().split()))\nM = [list(eval(input())) for _ in range(H)]\ninf = float(\"inf\")\n\n\ndef flatten(list_of_lists):\n return chain.from_iterable(list_of_lists)\n\n\ndef bfs(start, end):\n distance = [[inf for _ in range(W)] for _ in range(H)]\n queue = deque([(end, start)])\n distance[end][start] = 0\n while queue:\n y, x = queue.pop()\n for i in range(0, 4):\n nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]\n if (\n 0 <= nx < W\n and 0 <= ny < H\n and M[ny][nx] != \"#\"\n and distance[ny][nx] == inf\n ):\n queue.appendleft((ny, nx))\n distance[ny][nx] = distance[y][x] + 1\n return distance\n\n\nm = 0\nfor i in range(W):\n for j in range(H):\n if M[j][i] != \"#\":\n for length in list(flatten(bfs(i, j))):\n if length != inf and m < length:\n m = length\nprint(m)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- distance = [[inf for i in range(W)] for j in range(H)]","+ distance = [[inf for _ in range(W)] for _ in range(H)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0371157377,"measured_runtime_v1":0.0401553821,"runtime_lift":0.9243029389,"key":["s412199738","s480227124"]} +{"user_id":"u804800128","problem_id":"p02631","language":"python","submission_id_v0":"s429861089","submission_id_v1":"s152744813","cpu_time_v0":186,"cpu_time_v1":160,"memory_v0":31636,"memory_v1":31312,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.98,"input":"import sys\n\nfrom collections import deque\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n n = int( input() )\n\n input_a = list ( map( int, input().split() ) )\n\n a = deque( input_a )\n\n\n\n while( len(a) != 1 ):\n\n x = a.popleft()\n\n y = a.popleft()\n\n z = x ^ y\n\n a.append(z)\n\n sum = a.popleft()\n\n ans = []\n\n for i in input_a:\n\n x = i ^ sum\n\n ans.append(x)\n\n\n\n for i in ans:\n\n print( i , end = ' ' )\n\n\n\n\n\n\n\nmain()\n","target":"n = int( eval(input()) )\n\na = list( map(int, input().split()) )\n\nx = 0\n\nfor i in a:\n\n x ^= i\n\nprint(( * list( [x^y for y in a] ) ))","code_v0_loc":26,"code_v1_loc":6,"code_v0_num_chars":476,"code_v1_num_chars":134,"code_v0_no_empty_lines":"import sys\nfrom collections import deque\n\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(input())\n input_a = list(map(int, input().split()))\n a = deque(input_a)\n while len(a) != 1:\n x = a.popleft()\n y = a.popleft()\n z = x ^ y\n a.append(z)\n sum = a.popleft()\n ans = []\n for i in input_a:\n x = i ^ sum\n ans.append(x)\n for i in ans:\n print(i, end=\" \")\n\n\nmain()\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nx = 0\nfor i in a:\n x ^= i\nprint((*list([x ^ y for y in a])))\n","code_same":false,"relative_loc_diff_percent":76.9230769231,"diff":["-import sys","-from collections import deque","-","-input = sys.stdin.readline","-","-","-def main():","- n = int(input())","- input_a = list(map(int, input().split()))","- a = deque(input_a)","- while len(a) != 1:","- x = a.popleft()","- y = a.popleft()","- z = x ^ y","- a.append(z)","- sum = a.popleft()","- ans = []","- for i in input_a:","- x = i ^ sum","- ans.append(x)","- for i in ans:","- print(i, end=\" \")","-","-","-main()","+n = int(eval(input()))","+a = list(map(int, input().split()))","+x = 0","+for i in a:","+ x ^= i","+print((*list([x ^ y for y in a])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0461662049,"measured_runtime_v1":0.1094975245,"runtime_lift":0.4216187091,"key":["s429861089","s152744813"]} +{"user_id":"u241159583","problem_id":"p02861","language":"python","submission_id_v0":"s981147822","submission_id_v1":"s921556421","cpu_time_v0":439,"cpu_time_v1":333,"memory_v0":4504,"memory_v1":10844,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.15,"input":"import itertools\n\nn = int(eval(input()))\n\nxy = [list(map(int, input().split())) for _ in range(n)]\n\n\n\nans = []\n\nX = 0\n\nfor v in itertools.permutations(list(range(n))):\n\n cnt = 0\n\n X += 1\n\n for i in range(n-1):\n\n x1,y1 = xy[v[0]][0], xy[v[0]][1]\n\n x2,y2 = xy[v[1]][0], xy[v[1]][1]\n\n cnt += ((x1-x2)**2 + (y1-y2)**2)**0.5\n\n ans.append(cnt)\n\nprint((sum(ans)\/X))","target":"import itertools\n\nn = int(eval(input()))\n\nxy = [list(map(int, input().split())) for _ in range(n)]\n\n\n\nans = []\n\nfor v in itertools.permutations(list(range(n)), n):\n\n a = 0\n\n for i in range(len(v)-1):\n\n x1,y1 = xy[v[i]][0], xy[v[i]][1]\n\n x2,y2 = xy[v[i+1]][0], xy[v[i+1]][1]\n\n a += ((x1-x2)**2+(y1-y2)**2)**0.5\n\n ans.append(a)\n\nprint((sum(ans)\/len(ans)))","code_v0_loc":15,"code_v1_loc":13,"code_v0_num_chars":363,"code_v1_num_chars":375,"code_v0_no_empty_lines":"import itertools\n\nn = int(eval(input()))\nxy = [list(map(int, input().split())) for _ in range(n)]\nans = []\nX = 0\nfor v in itertools.permutations(list(range(n))):\n cnt = 0\n X += 1\n for i in range(n - 1):\n x1, y1 = xy[v[0]][0], xy[v[0]][1]\n x2, y2 = xy[v[1]][0], xy[v[1]][1]\n cnt += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5\n ans.append(cnt)\nprint((sum(ans) \/ X))\n","code_v1_no_empty_lines":"import itertools\n\nn = int(eval(input()))\nxy = [list(map(int, input().split())) for _ in range(n)]\nans = []\nfor v in itertools.permutations(list(range(n)), n):\n a = 0\n for i in range(len(v) - 1):\n x1, y1 = xy[v[i]][0], xy[v[i]][1]\n x2, y2 = xy[v[i + 1]][0], xy[v[i + 1]][1]\n a += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5\n ans.append(a)\nprint((sum(ans) \/ len(ans)))\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["-X = 0","-for v in itertools.permutations(list(range(n))):","- cnt = 0","- X += 1","- for i in range(n - 1):","- x1, y1 = xy[v[0]][0], xy[v[0]][1]","- x2, y2 = xy[v[1]][0], xy[v[1]][1]","- cnt += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5","- ans.append(cnt)","-print((sum(ans) \/ X))","+for v in itertools.permutations(list(range(n)), n):","+ a = 0","+ for i in range(len(v) - 1):","+ x1, y1 = xy[v[i]][0], xy[v[i]][1]","+ x2, y2 = xy[v[i + 1]][0], xy[v[i + 1]][1]","+ a += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5","+ ans.append(a)","+print((sum(ans) \/ len(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0516696453,"measured_runtime_v1":0.038425827,"runtime_lift":1.3446592902,"key":["s981147822","s921556421"]} +{"user_id":"u127499732","problem_id":"p02732","language":"python","submission_id_v0":"s820462455","submission_id_v1":"s887270549","cpu_time_v0":299,"cpu_time_v1":187,"memory_v0":32488,"memory_v1":34152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.46,"input":"def main():\n\n\n\n from collections import Counter\n\n import sys\n\n\n\n n = int(eval(input()))\n\n a = list(map(int, sys.stdin.readline().split()))\n\n\n\n d = Counter(a)\n\n\n\n base = sum(v * (v - 1) \/\/ 2 for v in list(d.values()))\n\n e = {k: base - (v >= 2) * (v - 1) for k, v in list(d.items())}\n\n for i in a:\n\n print((e[i]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n from collections import Counter\n\n import sys\n\n\n\n eval(input())\n\n a = list(map(int, sys.stdin.readline().split()))\n\n\n\n d = Counter(a)\n\n\n\n base = sum(v * (v - 1) \/\/ 2 for v in list(d.values()))\n\n e = [str(base - (d[v] - 1)) for v in a]\n\n print(('\\n'.join(e)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":18,"code_v1_loc":16,"code_v0_num_chars":367,"code_v1_num_chars":326,"code_v0_no_empty_lines":"def main():\n from collections import Counter\n import sys\n\n n = int(eval(input()))\n a = list(map(int, sys.stdin.readline().split()))\n d = Counter(a)\n base = sum(v * (v - 1) \/\/ 2 for v in list(d.values()))\n e = {k: base - (v >= 2) * (v - 1) for k, v in list(d.items())}\n for i in a:\n print((e[i]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n from collections import Counter\n import sys\n\n eval(input())\n a = list(map(int, sys.stdin.readline().split()))\n d = Counter(a)\n base = sum(v * (v - 1) \/\/ 2 for v in list(d.values()))\n e = [str(base - (d[v] - 1)) for v in a]\n print((\"\\n\".join(e)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["- n = int(eval(input()))","+ eval(input())","- e = {k: base - (v >= 2) * (v - 1) for k, v in list(d.items())}","- for i in a:","- print((e[i]))","+ e = [str(base - (d[v] - 1)) for v in a]","+ print((\"\\n\".join(e)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0541500018,"measured_runtime_v1":0.0363922925,"runtime_lift":1.4879524765,"key":["s820462455","s887270549"]} +{"user_id":"u057109575","problem_id":"p03253","language":"python","submission_id_v0":"s853052049","submission_id_v1":"s183918253","cpu_time_v0":931,"cpu_time_v1":82,"memory_v0":39408,"memory_v1":72908,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.19,"input":"from collections import defaultdict\n\nN, M = list(map(int, input().split()))\n\nMOD = 10 ** 9 + 7\n\nprime = defaultdict(int)\n\n\n\nfor i in range(2, M + 1):\n\n if i * i > M:\n\n break\n\n \n\n while M % i == 0:\n\n prime[i] += 1\n\n M \/\/= i\n\n \n\nif M != 1:\n\n prime[M] = 1\n\n \n\ndef comb(n, k):\n\n ret = 1\n\n for i in range(1, k + 1):\n\n ret = ret * (n - i + 1) % MOD\n\n ret = ret * pow(i, MOD - 2, MOD) % MOD\n\n \n\n return ret\n\n\n\nans = 1\n\nfor v in list(prime.values()):\n\n ans = ans * comb(N + v - 1, N - 1) % MOD\n\n \n\nprint(ans)\n","target":"\n\nfrom collections import defaultdict\n\n\n\n\n\ndef prime_factor(n):\n\n # O(sqrt(N))\n\n d = defaultdict(int)\n\n for i in range(2, n + 1):\n\n if i * i > n:\n\n break\n\n\n\n while n % i == 0:\n\n d[i] += 1\n\n n \/\/= i\n\n\n\n if n != 1:\n\n d[n] += 1\n\n\n\n return d\n\n\n\n\n\nMAX = 2 * 10 ** 5 + 10\n\nMOD = 10 ** 9 + 7\n\n\n\n# Factorial\n\nfac = [0] * (MAX + 1)\n\nfac[0] = 1\n\nfac[1] = 1\n\n\n\n# Inverse\n\ninv = [0] * (MAX + 1)\n\ninv[1] = 1\n\n\n\n# Inverse factorial\n\nfinv = [0] * (MAX + 1)\n\nfinv[0] = 1\n\nfinv[1] = 1\n\n\n\nfor i in range(2, MAX + 1):\n\n fac[i] = fac[i - 1] * i % MOD\n\n inv[i] = MOD - inv[MOD % i] * (MOD \/\/ i) % MOD\n\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n\n\n\n\ndef comb(n, k):\n\n if n < k or k < 0:\n\n return 0\n\n return (fac[n] * finv[k] * finv[n - k]) % MOD\n\n\n\n\n\ndef comb_rep(n, k):\n\n return comb(n + k - 1, n - 1)\n\n\n\n\n\nN, M = list(map(int, input().split()))\n\nprimes = prime_factor(M)\n\nres = 1\n\nfor k in list(primes.values()):\n\n res *= comb_rep(N, k)\n\n res %= MOD\n\n\n\nprint(res)\n","code_v0_loc":29,"code_v1_loc":62,"code_v0_num_chars":572,"code_v1_num_chars":1028,"code_v0_no_empty_lines":"from collections import defaultdict\n\nN, M = list(map(int, input().split()))\nMOD = 10**9 + 7\nprime = defaultdict(int)\nfor i in range(2, M + 1):\n if i * i > M:\n break\n while M % i == 0:\n prime[i] += 1\n M \/\/= i\nif M != 1:\n prime[M] = 1\n\n\ndef comb(n, k):\n ret = 1\n for i in range(1, k + 1):\n ret = ret * (n - i + 1) % MOD\n ret = ret * pow(i, MOD - 2, MOD) % MOD\n return ret\n\n\nans = 1\nfor v in list(prime.values()):\n ans = ans * comb(N + v - 1, N - 1) % MOD\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\n\ndef prime_factor(n):\n # O(sqrt(N))\n d = defaultdict(int)\n for i in range(2, n + 1):\n if i * i > n:\n break\n while n % i == 0:\n d[i] += 1\n n \/\/= i\n if n != 1:\n d[n] += 1\n return d\n\n\nMAX = 2 * 10**5 + 10\nMOD = 10**9 + 7\n# Factorial\nfac = [0] * (MAX + 1)\nfac[0] = 1\nfac[1] = 1\n# Inverse\ninv = [0] * (MAX + 1)\ninv[1] = 1\n# Inverse factorial\nfinv = [0] * (MAX + 1)\nfinv[0] = 1\nfinv[1] = 1\nfor i in range(2, MAX + 1):\n fac[i] = fac[i - 1] * i % MOD\n inv[i] = MOD - inv[MOD % i] * (MOD \/\/ i) % MOD\n finv[i] = finv[i - 1] * inv[i] % MOD\n\n\ndef comb(n, k):\n if n < k or k < 0:\n return 0\n return (fac[n] * finv[k] * finv[n - k]) % MOD\n\n\ndef comb_rep(n, k):\n return comb(n + k - 1, n - 1)\n\n\nN, M = list(map(int, input().split()))\nprimes = prime_factor(M)\nres = 1\nfor k in list(primes.values()):\n res *= comb_rep(N, k)\n res %= MOD\nprint(res)\n","code_same":false,"relative_loc_diff_percent":53.2258064516,"diff":["-N, M = list(map(int, input().split()))","+","+def prime_factor(n):","+ # O(sqrt(N))","+ d = defaultdict(int)","+ for i in range(2, n + 1):","+ if i * i > n:","+ break","+ while n % i == 0:","+ d[i] += 1","+ n \/\/= i","+ if n != 1:","+ d[n] += 1","+ return d","+","+","+MAX = 2 * 10**5 + 10","-prime = defaultdict(int)","-for i in range(2, M + 1):","- if i * i > M:","- break","- while M % i == 0:","- prime[i] += 1","- M \/\/= i","-if M != 1:","- prime[M] = 1","+# Factorial","+fac = [0] * (MAX + 1)","+fac[0] = 1","+fac[1] = 1","+# Inverse","+inv = [0] * (MAX + 1)","+inv[1] = 1","+# Inverse factorial","+finv = [0] * (MAX + 1)","+finv[0] = 1","+finv[1] = 1","+for i in range(2, MAX + 1):","+ fac[i] = fac[i - 1] * i % MOD","+ inv[i] = MOD - inv[MOD % i] * (MOD \/\/ i) % MOD","+ finv[i] = finv[i - 1] * inv[i] % MOD","- ret = 1","- for i in range(1, k + 1):","- ret = ret * (n - i + 1) % MOD","- ret = ret * pow(i, MOD - 2, MOD) % MOD","- return ret","+ if n < k or k < 0:","+ return 0","+ return (fac[n] * finv[k] * finv[n - k]) % MOD","-ans = 1","-for v in list(prime.values()):","- ans = ans * comb(N + v - 1, N - 1) % MOD","-print(ans)","+def comb_rep(n, k):","+ return comb(n + k - 1, n - 1)","+","+","+N, M = list(map(int, input().split()))","+primes = prime_factor(M)","+res = 1","+for k in list(primes.values()):","+ res *= comb_rep(N, k)","+ res %= MOD","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4196368694,"measured_runtime_v1":0.4773658943,"runtime_lift":0.8790675547,"key":["s853052049","s183918253"]} +{"user_id":"u588341295","problem_id":"p03074","language":"python","submission_id_v0":"s679173682","submission_id_v1":"s992853250","cpu_time_v0":118,"cpu_time_v1":101,"memory_v0":4724,"memory_v1":4760,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.41,"input":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\n\n\nN, K = MAP()\n\nS = eval(input())\n\n\n\n# \u30e9\u30f3\u30ec\u30f3\u30b0\u30b9\u5727\u7e2e\n\nA = []\n\n# \u756a\u5175\n\nif S[0] == '0':\n\n A.append(0)\n\ncur = S[0]\n\ncnt = 1\n\nfor i, s in enumerate(S[1:], 1):\n\n if s != cur:\n\n A.append(cnt)\n\n cnt = 1\n\n cur = s\n\n else:\n\n cnt += 1\n\nA.append(cnt)\n\n\n\n# \u4f8b\u5916\u51e6\u7406\n\nif len(A) == 1:\n\n print(N)\n\n exit()\n\n\n\n# \u756a\u5175\n\nif S[-1] == '0':\n\n A.append(0)\n\n\n\nM = len(A)\n\nans = sm = sum(A[:K*2+1])\n\nfor i in range(K*2+1, M):\n\n sm += A[i]\n\n # \u4eca\u56de\u5897\u3084\u3059\u306e\u304c0\u306e\u533a\u9593\u306a\u3089\u3001\u5f8c\u308d2\u3064\u6e1b\u308b\n\n if i % 2 == 1:\n\n if i-K*2 >= 0:\n\n sm -= A[i-K*2]\n\n if i-K*2-1 >= 0:\n\n sm -= A[i-K*2-1]\n\n ans = max(ans, sm)\n\nprint(ans)\n","target":"# -*- coding: utf-8 -*-\n\n\n\nimport sys\n\n\n\ndef input(): return sys.stdin.readline().strip()\n\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\n\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1): return int(-(-x \/\/ y))\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef Yes(): print('Yes')\n\ndef No(): print('No')\n\ndef YES(): print('YES')\n\ndef NO(): print('NO')\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = 10 ** 18\n\nMOD = 10 ** 9 + 7\n\n\n\nN, K = MAP()\n\nS = eval(input())\n\n\n\n# \u30e9\u30f3\u30ec\u30f3\u30b0\u30b9\u5727\u7e2e\n\n# (\u5f8c\u306e\u51e6\u7406\u304c\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u3001\u5e38\u306b1\u306e\u533a\u9593\u304b\u3089\u59cb\u307e\u3063\u30661\u306e\u533a\u9593\u3067\u7d42\u308f\u308b\u5f62\u306b\u3059\u308b)\n\nA = []\n\n# \u756a\u5175\n\nif S[0] == '0':\n\n A.append(0)\n\ncnt = 1\n\ncur = S[0]\n\nfor i, s in enumerate(S[1:], 1):\n\n if s != cur:\n\n A.append(cnt)\n\n cnt = 1\n\n cur = s\n\n else:\n\n cnt += 1\n\nA.append(cnt)\n\n\n\n# \u4f8b\u5916\u51e6\u7406\n\nif len(A) == 1:\n\n print(N)\n\n exit()\n\n\n\n# \u756a\u5175\n\nif S[-1] == '0':\n\n A.append(0)\n\n\n\nM = len(A)\n\nans = sm = sum(A[:K*2+1])\n\n# \u5e38\u306b1\u306e\u533a\u9593\u307e\u3067\u53d6\u3063\u305f\u65b9\u304c\u5f97\u306a\u306e\u3067\u3001index\u30922\u305a\u3064\u9032\u3081\u308b\n\nfor i in range(K*2+2, M, 2):\n\n # \u524d\u306e0\u306e\u533a\u9593\u30681\u306e\u533a\u9593\u3092\u5897\u3084\u3059\n\n sm += A[i-1] + A[i]\n\n # \u5f8c\u308d\u306e0\u306e\u533a\u9593\u30681\u306e\u533a\u9593\u3092\u6e1b\u3089\u3059\n\n if i-K*2-2 >= 0:\n\n sm -= A[i-K*2-2]\n\n if i-K*2-1 >= 0:\n\n sm -= A[i-K*2-1]\n\n ans = max(ans, sm)\n\nprint(ans)\n","code_v0_loc":60,"code_v1_loc":62,"code_v0_num_chars":1331,"code_v1_num_chars":1407,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef list4d(a, b, c, d, e):\n return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x \/\/ y))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST(N=None):\n return list(MAP()) if N is None else [INT() for i in range(N)]\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = 10**18\nMOD = 10**9 + 7\nN, K = MAP()\nS = eval(input())\n# \u30e9\u30f3\u30ec\u30f3\u30b0\u30b9\u5727\u7e2e\nA = []\n# \u756a\u5175\nif S[0] == \"0\":\n A.append(0)\ncur = S[0]\ncnt = 1\nfor i, s in enumerate(S[1:], 1):\n if s != cur:\n A.append(cnt)\n cnt = 1\n cur = s\n else:\n cnt += 1\nA.append(cnt)\n# \u4f8b\u5916\u51e6\u7406\nif len(A) == 1:\n print(N)\n exit()\n# \u756a\u5175\nif S[-1] == \"0\":\n A.append(0)\nM = len(A)\nans = sm = sum(A[: K * 2 + 1])\nfor i in range(K * 2 + 1, M):\n sm += A[i]\n # \u4eca\u56de\u5897\u3084\u3059\u306e\u304c0\u306e\u533a\u9593\u306a\u3089\u3001\u5f8c\u308d2\u3064\u6e1b\u308b\n if i % 2 == 1:\n if i - K * 2 >= 0:\n sm -= A[i - K * 2]\n if i - K * 2 - 1 >= 0:\n sm -= A[i - K * 2 - 1]\n ans = max(ans, sm)\nprint(ans)\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef list2d(a, b, c):\n return [[c] * b for i in range(a)]\n\n\ndef list3d(a, b, c, d):\n return [[[d] * c for j in range(b)] for i in range(a)]\n\n\ndef list4d(a, b, c, d, e):\n return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\n\ndef ceil(x, y=1):\n return int(-(-x \/\/ y))\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST(N=None):\n return list(MAP()) if N is None else [INT() for i in range(N)]\n\n\ndef Yes():\n print(\"Yes\")\n\n\ndef No():\n print(\"No\")\n\n\ndef YES():\n print(\"YES\")\n\n\ndef NO():\n print(\"NO\")\n\n\nsys.setrecursionlimit(10**9)\nINF = 10**18\nMOD = 10**9 + 7\nN, K = MAP()\nS = eval(input())\n# \u30e9\u30f3\u30ec\u30f3\u30b0\u30b9\u5727\u7e2e\n# (\u5f8c\u306e\u51e6\u7406\u304c\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u3001\u5e38\u306b1\u306e\u533a\u9593\u304b\u3089\u59cb\u307e\u3063\u30661\u306e\u533a\u9593\u3067\u7d42\u308f\u308b\u5f62\u306b\u3059\u308b)\nA = []\n# \u756a\u5175\nif S[0] == \"0\":\n A.append(0)\ncnt = 1\ncur = S[0]\nfor i, s in enumerate(S[1:], 1):\n if s != cur:\n A.append(cnt)\n cnt = 1\n cur = s\n else:\n cnt += 1\nA.append(cnt)\n# \u4f8b\u5916\u51e6\u7406\nif len(A) == 1:\n print(N)\n exit()\n# \u756a\u5175\nif S[-1] == \"0\":\n A.append(0)\nM = len(A)\nans = sm = sum(A[: K * 2 + 1])\n# \u5e38\u306b1\u306e\u533a\u9593\u307e\u3067\u53d6\u3063\u305f\u65b9\u304c\u5f97\u306a\u306e\u3067\u3001index\u30922\u305a\u3064\u9032\u3081\u308b\nfor i in range(K * 2 + 2, M, 2):\n # \u524d\u306e0\u306e\u533a\u9593\u30681\u306e\u533a\u9593\u3092\u5897\u3084\u3059\n sm += A[i - 1] + A[i]\n # \u5f8c\u308d\u306e0\u306e\u533a\u9593\u30681\u306e\u533a\u9593\u3092\u6e1b\u3089\u3059\n if i - K * 2 - 2 >= 0:\n sm -= A[i - K * 2 - 2]\n if i - K * 2 - 1 >= 0:\n sm -= A[i - K * 2 - 1]\n ans = max(ans, sm)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":3.2258064516,"diff":["+# (\u5f8c\u306e\u51e6\u7406\u304c\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u3001\u5e38\u306b1\u306e\u533a\u9593\u304b\u3089\u59cb\u307e\u3063\u30661\u306e\u533a\u9593\u3067\u7d42\u308f\u308b\u5f62\u306b\u3059\u308b)","+cnt = 1","-cnt = 1","-for i in range(K * 2 + 1, M):","- sm += A[i]","- # \u4eca\u56de\u5897\u3084\u3059\u306e\u304c0\u306e\u533a\u9593\u306a\u3089\u3001\u5f8c\u308d2\u3064\u6e1b\u308b","- if i % 2 == 1:","- if i - K * 2 >= 0:","- sm -= A[i - K * 2]","- if i - K * 2 - 1 >= 0:","- sm -= A[i - K * 2 - 1]","+# \u5e38\u306b1\u306e\u533a\u9593\u307e\u3067\u53d6\u3063\u305f\u65b9\u304c\u5f97\u306a\u306e\u3067\u3001index\u30922\u305a\u3064\u9032\u3081\u308b","+for i in range(K * 2 + 2, M, 2):","+ # \u524d\u306e0\u306e\u533a\u9593\u30681\u306e\u533a\u9593\u3092\u5897\u3084\u3059","+ sm += A[i - 1] + A[i]","+ # \u5f8c\u308d\u306e0\u306e\u533a\u9593\u30681\u306e\u533a\u9593\u3092\u6e1b\u3089\u3059","+ if i - K * 2 - 2 >= 0:","+ sm -= A[i - K * 2 - 2]","+ if i - K * 2 - 1 >= 0:","+ sm -= A[i - K * 2 - 1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0382369051,"measured_runtime_v1":0.0357620072,"runtime_lift":1.0692046684,"key":["s679173682","s992853250"]} +{"user_id":"u317423698","problem_id":"p02658","language":"python","submission_id_v0":"s085814902","submission_id_v1":"s866464243","cpu_time_v0":80,"cpu_time_v1":52,"memory_v0":20148,"memory_v1":20088,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.0,"input":"import sys\n\nreadline = sys.stdin.buffer.readline\n\nn = int(readline())\n\na = list(map(int, readline().split()))\n\na.sort()\n\nv = 1\n\nfor i in a:\n\n v *= i\n\n if v > 1000000000000000000:\n\n print((-1))\n\n break\n\n elif v == 0:\n\n print((0))\n\n break\n\nelse:\n\n print(v)","target":"import sys\n\nreadline = sys.stdin.buffer.readline\n\nn = int(readline())\n\na = list(map(int, readline().split()))\n\nv = 1\n\n\n\nif min(a) == 0:\n\n print((0))\n\nelse:\n\n for i in a:\n\n v *= i\n\n if v > 1000000000000000000:\n\n print((-1))\n\n break\n\n else:\n\n print(v)","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":266,"code_v1_num_chars":267,"code_v0_no_empty_lines":"import sys\n\nreadline = sys.stdin.buffer.readline\nn = int(readline())\na = list(map(int, readline().split()))\na.sort()\nv = 1\nfor i in a:\n v *= i\n if v > 1000000000000000000:\n print((-1))\n break\n elif v == 0:\n print((0))\n break\nelse:\n print(v)\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.buffer.readline\nn = int(readline())\na = list(map(int, readline().split()))\nv = 1\nif min(a) == 0:\n print((0))\nelse:\n for i in a:\n v *= i\n if v > 1000000000000000000:\n print((-1))\n break\n else:\n print(v)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a.sort()","-for i in a:","- v *= i","- if v > 1000000000000000000:","- print((-1))","- break","- elif v == 0:","- print((0))","- break","+if min(a) == 0:","+ print((0))","- print(v)","+ for i in a:","+ v *= i","+ if v > 1000000000000000000:","+ print((-1))","+ break","+ else:","+ print(v)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0653339143,"measured_runtime_v1":0.0368879778,"runtime_lift":1.7711438276,"key":["s085814902","s866464243"]} +{"user_id":"u444660909","problem_id":"p02546","language":"python","submission_id_v0":"s963221476","submission_id_v1":"s048762887","cpu_time_v0":30,"cpu_time_v1":27,"memory_v0":9076,"memory_v1":8900,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"S = eval(input())\n\n\n\nif S.endswith('s'):\n\n S = S + 'es'\n\nelse:\n\n S = S + 's'\n\n\n\nprint(S)\n","target":"S = eval(input())\n\n\n\nif S[-1] == \"s\":\n\n print((S + \"es\"))\n\nelse:\n\n print((S + \"s\"))\n","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":85,"code_v1_num_chars":76,"code_v0_no_empty_lines":"S = eval(input())\nif S.endswith(\"s\"):\n S = S + \"es\"\nelse:\n S = S + \"s\"\nprint(S)\n","code_v1_no_empty_lines":"S = eval(input())\nif S[-1] == \"s\":\n print((S + \"es\"))\nelse:\n print((S + \"s\"))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-if S.endswith(\"s\"):","- S = S + \"es\"","+if S[-1] == \"s\":","+ print((S + \"es\"))","- S = S + \"s\"","-print(S)","+ print((S + \"s\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.047651408,"measured_runtime_v1":0.0479985592,"runtime_lift":0.9927674644,"key":["s963221476","s048762887"]} +{"user_id":"u252828980","problem_id":"p03262","language":"python","submission_id_v0":"s815638146","submission_id_v1":"s498777667","cpu_time_v0":91,"cpu_time_v1":83,"memory_v0":14956,"memory_v1":20748,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.79,"input":"n, x = list(map(int,input().split()))\n\nli = list(input().split())\n\nli = [abs(int(a)-x) for a in li]\n\n\n\ndef gcd(a,b):\n\n while a%b!=0:\n\n a,b = b,a%b\n\n return b\n\n \n\nif n == 1:\n\n print((abs(li[0])))\n\n \n\nelif n == 2:\n\n print((gcd(li[0],li[1])))\n\n \n\nelif n >= 3:\n\n\n\n c = gcd(li[0],li[1])\n\n #print(c)\n\n for i in range(2,len(li)-1):\n\n c = gcd(c,li[i])\n\n print(c)","target":"n, x = list(map(int,input().split()))\n\nli = list(input().split())\n\nli = [abs(int(a)-x) for a in li]\n\n\n\ndef gcd(a,b):\n\n while a%b!=0:\n\n a,b = b,a%b\n\n return b\n\n \n\nfrom functools import reduce\n\n\n\na = reduce(gcd,li)\n\nprint(a)","code_v0_loc":22,"code_v1_loc":13,"code_v0_num_chars":391,"code_v1_num_chars":232,"code_v0_no_empty_lines":"n, x = list(map(int, input().split()))\nli = list(input().split())\nli = [abs(int(a) - x) for a in li]\n\n\ndef gcd(a, b):\n while a % b != 0:\n a, b = b, a % b\n return b\n\n\nif n == 1:\n print((abs(li[0])))\nelif n == 2:\n print((gcd(li[0], li[1])))\nelif n >= 3:\n c = gcd(li[0], li[1])\n # print(c)\n for i in range(2, len(li) - 1):\n c = gcd(c, li[i])\n print(c)\n","code_v1_no_empty_lines":"n, x = list(map(int, input().split()))\nli = list(input().split())\nli = [abs(int(a) - x) for a in li]\n\n\ndef gcd(a, b):\n while a % b != 0:\n a, b = b, a % b\n return b\n\n\nfrom functools import reduce\n\na = reduce(gcd, li)\nprint(a)\n","code_same":false,"relative_loc_diff_percent":40.9090909091,"diff":["-if n == 1:","- print((abs(li[0])))","-elif n == 2:","- print((gcd(li[0], li[1])))","-elif n >= 3:","- c = gcd(li[0], li[1])","- # print(c)","- for i in range(2, len(li) - 1):","- c = gcd(c, li[i])","- print(c)","+from functools import reduce","+","+a = reduce(gcd, li)","+print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0467990234,"measured_runtime_v1":0.0488752549,"runtime_lift":0.9575197818,"key":["s815638146","s498777667"]} +{"user_id":"u489959379","problem_id":"p03049","language":"python","submission_id_v0":"s572082243","submission_id_v1":"s418149819","cpu_time_v0":272,"cpu_time_v1":34,"memory_v0":44760,"memory_v1":9260,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.5,"input":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n n = int(eval(input()))\n\n S = list(eval(input()) for _ in range(n))\n\n\n\n cnt_AB = 0\n\n cnt_A = 0\n\n cnt_B = 0\n\n res = 0\n\n for s in S:\n\n res += s.count(\"AB\")\n\n if s[0] == \"B\" and s[-1] == \"A\":\n\n cnt_AB += 1\n\n elif s[0] == \"B\":\n\n cnt_B += 1\n\n elif s[-1] == \"A\":\n\n cnt_A += 1\n\n\n\n if cnt_A + cnt_B > 0:\n\n print((res + cnt_AB + min(cnt_A, cnt_B)))\n\n else:\n\n print((res + max(0, cnt_AB - 1)))\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","target":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\ninput = sys.stdin.readline\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef resolve():\n\n n = int(eval(input()))\n\n\n\n cnt_BA = cnt_A = cnt_B = cnt_AB = 0\n\n for _ in range(n):\n\n s = input().rstrip()\n\n cnt_AB += s.count(\"AB\")\n\n\n\n if s[0] == \"B\" and s[-1] == \"A\":\n\n cnt_BA += 1\n\n elif s[0] == \"B\":\n\n cnt_B += 1\n\n elif s[-1] == \"A\":\n\n cnt_A += 1\n\n\n\n res = cnt_AB + max(0, (cnt_BA - 1)) + min(cnt_A, cnt_B)\n\n cnt_BA = 1 if cnt_BA >= 1 else 0\n\n cnt_A = cnt_A - min(cnt_A, cnt_B)\n\n cnt_B = cnt_B - min(cnt_A, cnt_B)\n\n if cnt_A != 0 and cnt_BA != 0:\n\n res += min(cnt_A, cnt_BA)\n\n elif cnt_B != 0 and cnt_BA != 0:\n\n res += min(cnt_B, cnt_BA)\n\n print(res)\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","code_v0_loc":32,"code_v1_loc":36,"code_v0_num_chars":624,"code_v1_num_chars":844,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef resolve():\n n = int(eval(input()))\n S = list(eval(input()) for _ in range(n))\n cnt_AB = 0\n cnt_A = 0\n cnt_B = 0\n res = 0\n for s in S:\n res += s.count(\"AB\")\n if s[0] == \"B\" and s[-1] == \"A\":\n cnt_AB += 1\n elif s[0] == \"B\":\n cnt_B += 1\n elif s[-1] == \"A\":\n cnt_A += 1\n if cnt_A + cnt_B > 0:\n print((res + cnt_AB + min(cnt_A, cnt_B)))\n else:\n print((res + max(0, cnt_AB - 1)))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef resolve():\n n = int(eval(input()))\n cnt_BA = cnt_A = cnt_B = cnt_AB = 0\n for _ in range(n):\n s = input().rstrip()\n cnt_AB += s.count(\"AB\")\n if s[0] == \"B\" and s[-1] == \"A\":\n cnt_BA += 1\n elif s[0] == \"B\":\n cnt_B += 1\n elif s[-1] == \"A\":\n cnt_A += 1\n res = cnt_AB + max(0, (cnt_BA - 1)) + min(cnt_A, cnt_B)\n cnt_BA = 1 if cnt_BA >= 1 else 0\n cnt_A = cnt_A - min(cnt_A, cnt_B)\n cnt_B = cnt_B - min(cnt_A, cnt_B)\n if cnt_A != 0 and cnt_BA != 0:\n res += min(cnt_A, cnt_BA)\n elif cnt_B != 0 and cnt_BA != 0:\n res += min(cnt_B, cnt_BA)\n print(res)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["+input = sys.stdin.readline","- S = list(eval(input()) for _ in range(n))","- cnt_AB = 0","- cnt_A = 0","- cnt_B = 0","- res = 0","- for s in S:","- res += s.count(\"AB\")","+ cnt_BA = cnt_A = cnt_B = cnt_AB = 0","+ for _ in range(n):","+ s = input().rstrip()","+ cnt_AB += s.count(\"AB\")","- cnt_AB += 1","+ cnt_BA += 1","- if cnt_A + cnt_B > 0:","- print((res + cnt_AB + min(cnt_A, cnt_B)))","- else:","- print((res + max(0, cnt_AB - 1)))","+ res = cnt_AB + max(0, (cnt_BA - 1)) + min(cnt_A, cnt_B)","+ cnt_BA = 1 if cnt_BA >= 1 else 0","+ cnt_A = cnt_A - min(cnt_A, cnt_B)","+ cnt_B = cnt_B - min(cnt_A, cnt_B)","+ if cnt_A != 0 and cnt_BA != 0:","+ res += min(cnt_A, cnt_BA)","+ elif cnt_B != 0 and cnt_BA != 0:","+ res += min(cnt_B, cnt_BA)","+ print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0385890148,"measured_runtime_v1":0.03872997,"runtime_lift":0.9963605647,"key":["s572082243","s418149819"]} +{"user_id":"u196579381","problem_id":"p02901","language":"python","submission_id_v0":"s172191155","submission_id_v1":"s445101100","cpu_time_v0":454,"cpu_time_v1":348,"memory_v0":58076,"memory_v1":48732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.35,"input":"import sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int, input().split()))\n\nA = [0]*M\n\nB = [0]*M\n\nC = [0]*M\n\nfor i in range(M):\n\n A[i], B[i] = list(map(int, input().split()))\n\n for c in [int(i) for i in input().split()]:\n\n C[i] |= 1 << (c - 1)\n\n\n\ndp = [[float(\"inf\")] * 2 ** N for _ in range(2)]\n\ndp[0][0] = 0\n\nfor i, c in enumerate(C):\n\n for bit in range(2 ** N):\n\n if c & bit == bit:\n\n dp[1][bit] = min(dp[1][bit], dp[0][bit], A[i])\n\n else:\n\n dp[1][bit] = min(dp[1][bit], dp[0][bit])\n\n dp[1][c | bit] = min(dp[0][c | bit], dp[0][bit] + A[i], dp[1][c | bit])\n\n dp[0], dp[1] = dp[1], dp[0]\n\nprint((dp[0][-1] if dp[0][-1] < float(\"inf\") else - 1))","target":"import sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int, input().split()))\n\nA = [0]*M\n\nB = [0]*M\n\nC = [0]*M\n\nfor i in range(M):\n\n A[i], B[i] = list(map(int, input().split()))\n\n for c in [int(i) for i in input().split()]:\n\n C[i] |= 1 << (c - 1)\n\n\n\ndp = [[float(\"inf\")] * 2 ** N for _ in range(2)]\n\ndp[0][0] = 0\n\nfor i, c in enumerate(C):\n\n for bit in range(2 ** N):\n\n dp[1][bit] = min(dp[1][bit], dp[0][bit])\n\n dp[1][c | bit] = min(dp[0][bit] + A[i], dp[1][c | bit])\n\n dp[0], dp[1] = dp[1], dp[0]\n\nprint((dp[0][-1] if dp[0][-1] < float(\"inf\") else - 1))","code_v0_loc":22,"code_v1_loc":19,"code_v0_num_chars":698,"code_v1_num_chars":575,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nA = [0] * M\nB = [0] * M\nC = [0] * M\nfor i in range(M):\n A[i], B[i] = list(map(int, input().split()))\n for c in [int(i) for i in input().split()]:\n C[i] |= 1 << (c - 1)\ndp = [[float(\"inf\")] * 2**N for _ in range(2)]\ndp[0][0] = 0\nfor i, c in enumerate(C):\n for bit in range(2**N):\n if c & bit == bit:\n dp[1][bit] = min(dp[1][bit], dp[0][bit], A[i])\n else:\n dp[1][bit] = min(dp[1][bit], dp[0][bit])\n dp[1][c | bit] = min(dp[0][c | bit], dp[0][bit] + A[i], dp[1][c | bit])\n dp[0], dp[1] = dp[1], dp[0]\nprint((dp[0][-1] if dp[0][-1] < float(\"inf\") else -1))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nA = [0] * M\nB = [0] * M\nC = [0] * M\nfor i in range(M):\n A[i], B[i] = list(map(int, input().split()))\n for c in [int(i) for i in input().split()]:\n C[i] |= 1 << (c - 1)\ndp = [[float(\"inf\")] * 2**N for _ in range(2)]\ndp[0][0] = 0\nfor i, c in enumerate(C):\n for bit in range(2**N):\n dp[1][bit] = min(dp[1][bit], dp[0][bit])\n dp[1][c | bit] = min(dp[0][bit] + A[i], dp[1][c | bit])\n dp[0], dp[1] = dp[1], dp[0]\nprint((dp[0][-1] if dp[0][-1] < float(\"inf\") else -1))\n","code_same":false,"relative_loc_diff_percent":13.6363636364,"diff":["- if c & bit == bit:","- dp[1][bit] = min(dp[1][bit], dp[0][bit], A[i])","- else:","- dp[1][bit] = min(dp[1][bit], dp[0][bit])","- dp[1][c | bit] = min(dp[0][c | bit], dp[0][bit] + A[i], dp[1][c | bit])","+ dp[1][bit] = min(dp[1][bit], dp[0][bit])","+ dp[1][c | bit] = min(dp[0][bit] + A[i], dp[1][c | bit])"],"diff_only_import_comment":false,"measured_runtime_v0":0.037392206,"measured_runtime_v1":0.0383411684,"runtime_lift":0.9752495164,"key":["s172191155","s445101100"]} +{"user_id":"u396495667","problem_id":"p03433","language":"python","submission_id_v0":"s232112597","submission_id_v1":"s057518525","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"n = int(eval(input()))\n\na = int(eval(input()))\n\n\n\nq = n % 500\n\n\n\nif a >= q:\n\n print('Yes')\n\nelse:\n\n print('No')","target":"n =int(eval(input()))\n\na =int(eval(input()))\n\nprint(('Yes' if n %500<=a else 'No'))","code_v0_loc":9,"code_v1_loc":3,"code_v0_num_chars":101,"code_v1_num_chars":69,"code_v0_no_empty_lines":"n = int(eval(input()))\na = int(eval(input()))\nq = n % 500\nif a >= q:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = int(eval(input()))\nprint((\"Yes\" if n % 500 <= a else \"No\"))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-q = n % 500","-if a >= q:","- print(\"Yes\")","-else:","- print(\"No\")","+print((\"Yes\" if n % 500 <= a else \"No\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0418295219,"measured_runtime_v1":0.047285898,"runtime_lift":0.884608809,"key":["s232112597","s057518525"]} +{"user_id":"u387774811","problem_id":"p02936","language":"python","submission_id_v0":"s022691694","submission_id_v1":"s674001177","cpu_time_v0":1738,"cpu_time_v1":1058,"memory_v0":66848,"memory_v1":66840,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.13,"input":"N,Q=list(map(int,input().split()))\n\nans=[0]*N\n\nki=[[] for _ in range(N)]\n\nfor i in range(N-1):\n\n a,b=list(map(int,input().split()))\n\n ki[a-1].append(b-1)\n\n ki[b-1].append(a-1)\n\nfor i in range(Q):\n\n p,q=list(map(int,input().split()))\n\n ans[p-1]+=q\n\n# dfs\n\nstack = [0]\n\nvisited = [\"False\"] * N\n\nwhile stack:\n\n ne = stack.pop()\n\n if visited[ne] == \"False\":\n\n visited[ne] = \"True\"\n\n for j in ki[ne]:\n\n if visited[j] == \"False\":\n\n ans[j]+=ans[ne]\n\n stack.append(j)\n\nL=[str(a) for a in ans]\n\nL=' '.join(L)\n\nprint(L)","target":"import sys\n\ninput = sys.stdin.readline\n\nN,Q=list(map(int,input().split()))\n\nans=[0]*N\n\nki=[[] for _ in range(N)]\n\nfor i in range(N-1):\n\n a,b=list(map(int,input().split()))\n\n ki[a-1].append(b-1)\n\n ki[b-1].append(a-1)\n\nfor i in range(Q):\n\n p,q=list(map(int,input().split()))\n\n ans[p-1]+=q\n\n# dfs\n\nstack = [0]\n\nvisited = [\"False\"] * N\n\nwhile stack:\n\n ne = stack.pop()\n\n if visited[ne] == \"False\":\n\n visited[ne] = \"True\"\n\n for j in ki[ne]:\n\n if visited[j] == \"False\":\n\n ans[j]+=ans[ne]\n\n stack.append(j)\n\nL=[str(a) for a in ans]\n\nL=' '.join(L)\n\nprint(L)","code_v0_loc":24,"code_v1_loc":26,"code_v0_num_chars":501,"code_v1_num_chars":541,"code_v0_no_empty_lines":"N, Q = list(map(int, input().split()))\nans = [0] * N\nki = [[] for _ in range(N)]\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n ki[a - 1].append(b - 1)\n ki[b - 1].append(a - 1)\nfor i in range(Q):\n p, q = list(map(int, input().split()))\n ans[p - 1] += q\n# dfs\nstack = [0]\nvisited = [\"False\"] * N\nwhile stack:\n ne = stack.pop()\n if visited[ne] == \"False\":\n visited[ne] = \"True\"\n for j in ki[ne]:\n if visited[j] == \"False\":\n ans[j] += ans[ne]\n stack.append(j)\nL = [str(a) for a in ans]\nL = \" \".join(L)\nprint(L)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN, Q = list(map(int, input().split()))\nans = [0] * N\nki = [[] for _ in range(N)]\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n ki[a - 1].append(b - 1)\n ki[b - 1].append(a - 1)\nfor i in range(Q):\n p, q = list(map(int, input().split()))\n ans[p - 1] += q\n# dfs\nstack = [0]\nvisited = [\"False\"] * N\nwhile stack:\n ne = stack.pop()\n if visited[ne] == \"False\":\n visited[ne] = \"True\"\n for j in ki[ne]:\n if visited[j] == \"False\":\n ans[j] += ans[ne]\n stack.append(j)\nL = [str(a) for a in ans]\nL = \" \".join(L)\nprint(L)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.0438793592,"measured_runtime_v1":0.1398714798,"runtime_lift":0.3137119826,"key":["s022691694","s674001177"]} +{"user_id":"u474925961","problem_id":"p03137","language":"python","submission_id_v0":"s980173284","submission_id_v1":"s922168540","cpu_time_v0":250,"cpu_time_v1":219,"memory_v0":23048,"memory_v1":23040,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.4,"input":"import numpy as np\n\nn,m=list(map(int,input().split()))\n\nx=list(map(int,input().split()))\n\n\n\narr=np.array(sorted(x))\n\ndif=np.diff(arr)\n\n\n\nlis=dif.tolist()\n\nlis=sorted(lis)\n\n\n\nfor i in range(n-1):\n\n if len(lis)>0:\n\n lis.pop()\n\n\n\nprint((sum(lis)))","target":"import numpy as np\n\nn,m=list(map(int,input().split()))\n\nx=list(map(int,input().split()))\n\n\n\narr=np.sort(np.array(x))\n\ndif=np.diff(arr)\n\n\n\nlis=dif.tolist()\n\nlis=sorted(lis)\n\n\n\nfor i in range(n-1):\n\n if len(lis)>0:\n\n lis.pop()\n\n\n\nprint((sum(lis)))","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":246,"code_v1_num_chars":247,"code_v0_no_empty_lines":"import numpy as np\n\nn, m = list(map(int, input().split()))\nx = list(map(int, input().split()))\narr = np.array(sorted(x))\ndif = np.diff(arr)\nlis = dif.tolist()\nlis = sorted(lis)\nfor i in range(n - 1):\n if len(lis) > 0:\n lis.pop()\nprint((sum(lis)))\n","code_v1_no_empty_lines":"import numpy as np\n\nn, m = list(map(int, input().split()))\nx = list(map(int, input().split()))\narr = np.sort(np.array(x))\ndif = np.diff(arr)\nlis = dif.tolist()\nlis = sorted(lis)\nfor i in range(n - 1):\n if len(lis) > 0:\n lis.pop()\nprint((sum(lis)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-arr = np.array(sorted(x))","+arr = np.sort(np.array(x))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2188198442,"measured_runtime_v1":0.3343979294,"runtime_lift":0.6543696147,"key":["s980173284","s922168540"]} +{"user_id":"u729133443","problem_id":"p03038","language":"python","submission_id_v0":"s479590350","submission_id_v1":"s563529506","cpu_time_v0":614,"cpu_time_v1":292,"memory_v0":108580,"memory_v1":35420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.44,"input":"n,m,*t=list(map(int,open(0).read().split()))\n\na=sorted(t[:n])[::-1]\n\nm=0\n\nfor c,b in sorted(zip(t[n+1::2],t[n::2]))[::-1]:\n\n while a and b and c>a[-1]:m+=c;b-=1;a.pop()\n\nprint((m+sum(a)))","target":"n,m,*t=list(map(int,open(0).read().split()))\n\na=sorted(t[:n])[::-1]\n\nm=0\n\nfor c,b in sorted(zip(t[n+1::2],t[n::2]))[::-1]:\n\n while a and c>a[-1]and b:m+=c;b-=1;a.pop()\n\nprint((m+sum(a)))","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":179,"code_v1_num_chars":178,"code_v0_no_empty_lines":"n, m, *t = list(map(int, open(0).read().split()))\na = sorted(t[:n])[::-1]\nm = 0\nfor c, b in sorted(zip(t[n + 1 :: 2], t[n::2]))[::-1]:\n while a and b and c > a[-1]:\n m += c\n b -= 1\n a.pop()\nprint((m + sum(a)))\n","code_v1_no_empty_lines":"n, m, *t = list(map(int, open(0).read().split()))\na = sorted(t[:n])[::-1]\nm = 0\nfor c, b in sorted(zip(t[n + 1 :: 2], t[n::2]))[::-1]:\n while a and c > a[-1] and b:\n m += c\n b -= 1\n a.pop()\nprint((m + sum(a)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- while a and b and c > a[-1]:","+ while a and c > a[-1] and b:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0364769049,"measured_runtime_v1":0.0383112872,"runtime_lift":0.9521190114,"key":["s479590350","s563529506"]} +{"user_id":"u887207211","problem_id":"p03325","language":"python","submission_id_v0":"s457580349","submission_id_v1":"s299230800","cpu_time_v0":80,"cpu_time_v1":28,"memory_v0":4148,"memory_v1":4148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.0,"input":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\ncnt = 0\n\nfor a in A:\n\n while a%2 == 0:\n\n a \/\/= 2\n\n cnt += 1\n\nprint(cnt)","target":"N = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\ncnt = 0\n\nfor a in A:\n\n #print(format(a,'b')[::-1])\n\n #print(format(a,'b')[::-1].index('1'))\n\n cnt += format(a,'b')[::-1].index('1')\n\nprint(cnt)","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":134,"code_v1_num_chars":202,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\ncnt = 0\nfor a in A:\n while a % 2 == 0:\n a \/\/= 2\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\ncnt = 0\nfor a in A:\n # print(format(a,'b')[::-1])\n # print(format(a,'b')[::-1].index('1'))\n cnt += format(a, \"b\")[::-1].index(\"1\")\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- while a % 2 == 0:","- a \/\/= 2","- cnt += 1","+ # print(format(a,'b')[::-1])","+ # print(format(a,'b')[::-1].index('1'))","+ cnt += format(a, \"b\")[::-1].index(\"1\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0455464871,"measured_runtime_v1":0.0373934205,"runtime_lift":1.2180347912,"key":["s457580349","s299230800"]} +{"user_id":"u477977638","problem_id":"p03281","language":"python","submission_id_v0":"s456382625","submission_id_v1":"s593284081","cpu_time_v0":166,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.76,"input":"import sys\n\n\n\nread = sys.stdin.buffer.read\n\ninput = sys.stdin.buffer.readline\n\ninputs = sys.stdin.buffer.readlines\n\n\n\n# mod=10**9+7\n\n# rstrip().decode('utf-8')\n\n# map(int,input().split())\n\n# import numpy as np\n\n\n\ndef main():\n\n\tn=int(eval(input()))\n\n\tans=0\n\n\tif n>=105:\n\n\t\tans+=1\n\n\tif n>=135:\n\n\t\tans+=1\n\n\tif n>=165:\n\n\t\tans+=1\n\n\tif n>=189:\n\n\t\tans+=1\n\n\tif n>=195:\n\n\t\tans+=1\n\n\t\n\n\tprint(ans)\n\n\t\n\n\t\n\nif __name__ == \"__main__\":\n\n\tmain()\n","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\n#input = sys.stdin.readline\n\n\n\ndef II(): return int(eval(input()))\n\ndef MI(): return list(map(int,input().split()))\n\ndef LI(): return list(map(int,input().split()))\n\n\n\n# mod=10**9+7\n\n# rstrip().decode('utf-8')\n\n# map(int,input().split())\n\n\n\ndef main():\n\n\tn=II()\n\n\tli=[105,135,165,189,195]\n\n\tans=0\n\n\tfor i in range(n+1):\n\n\t\tif i in li:\n\n\t\t\tans+=1\n\n\tprint(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n\tmain()\n","code_v0_loc":30,"code_v1_loc":37,"code_v0_num_chars":424,"code_v1_num_chars":461,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\ninput = sys.stdin.buffer.readline\ninputs = sys.stdin.buffer.readlines\n# mod=10**9+7\n# rstrip().decode('utf-8')\n# map(int,input().split())\n# import numpy as np\ndef main():\n n = int(eval(input()))\n ans = 0\n if n >= 105:\n ans += 1\n if n >= 135:\n ans += 1\n if n >= 165:\n ans += 1\n if n >= 189:\n ans += 1\n if n >= 195:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\n# input = sys.stdin.readline\ndef II():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\n# mod=10**9+7\n# rstrip().decode('utf-8')\n# map(int,input().split())\ndef main():\n n = II()\n li = [105, 135, 165, 189, 195]\n ans = 0\n for i in range(n + 1):\n if i in li:\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":18.9189189189,"diff":["-read = sys.stdin.buffer.read","-inputs = sys.stdin.buffer.readlines","+# input = sys.stdin.readline","+def II():","+ return int(eval(input()))","+","+","+def MI():","+ return list(map(int, input().split()))","+","+","+def LI():","+ return list(map(int, input().split()))","+","+","-# import numpy as np","- n = int(eval(input()))","+ n = II()","+ li = [105, 135, 165, 189, 195]","- if n >= 105:","- ans += 1","- if n >= 135:","- ans += 1","- if n >= 165:","- ans += 1","- if n >= 189:","- ans += 1","- if n >= 195:","- ans += 1","+ for i in range(n + 1):","+ if i in li:","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0380476799,"measured_runtime_v1":0.039852719,"runtime_lift":0.9547072535,"key":["s456382625","s593284081"]} +{"user_id":"u596276291","problem_id":"p03556","language":"python","submission_id_v0":"s146709915","submission_id_v1":"s910937845","cpu_time_v0":32,"cpu_time_v1":29,"memory_v0":3444,"memory_v1":3956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.38,"input":"from collections import defaultdict, Counter\n\nfrom itertools import product, groupby, count, permutations, combinations\n\nfrom math import pi, sqrt\n\nfrom collections import deque\n\nfrom bisect import bisect, bisect_left, bisect_right\n\nINF = float(\"inf\")\n\n \n\n \n\ndef main():\n\n N = int(eval(input()))\n\n ans = 0\n\n for i in range(10**9):\n\n if i * i <= N:\n\n ans = max(ans, i * i)\n\n else:\n\n break\n\n print(ans)\n\n \n\n \n\nif __name__ == '__main__':\n\n main()","target":"from collections import defaultdict, Counter\n\nfrom itertools import product, groupby, count, permutations, combinations\n\nfrom math import pi, sqrt\n\nfrom collections import deque\n\nfrom bisect import bisect, bisect_left, bisect_right\n\nfrom string import ascii_lowercase\n\nfrom functools import lru_cache\n\nimport sys\n\nsys.setrecursionlimit(10000)\n\nINF = float(\"inf\")\n\nYES, Yes, yes, NO, No, no = \"YES\", \"Yes\", \"yes\", \"NO\", \"No\", \"no\"\n\ndy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]\n\n\n\n\n\ndef inside(y, x, H, W):\n\n return 0 <= y < H and 0 <= x < W\n\n\n\n\n\ndef ceil(a, b):\n\n return (a + b - 1) \/\/ b\n\n\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n i = 1\n\n while i * i <= N:\n\n i += 1\n\n print(((i - 1) * (i - 1)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":21,"code_v1_loc":32,"code_v0_num_chars":488,"code_v1_num_chars":751,"code_v0_no_empty_lines":"from collections import defaultdict, Counter\nfrom itertools import product, groupby, count, permutations, combinations\nfrom math import pi, sqrt\nfrom collections import deque\nfrom bisect import bisect, bisect_left, bisect_right\n\nINF = float(\"inf\")\n\n\ndef main():\n N = int(eval(input()))\n ans = 0\n for i in range(10**9):\n if i * i <= N:\n ans = max(ans, i * i)\n else:\n break\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import defaultdict, Counter\nfrom itertools import product, groupby, count, permutations, combinations\nfrom math import pi, sqrt\nfrom collections import deque\nfrom bisect import bisect, bisect_left, bisect_right\nfrom string import ascii_lowercase\nfrom functools import lru_cache\nimport sys\n\nsys.setrecursionlimit(10000)\nINF = float(\"inf\")\nYES, Yes, yes, NO, No, no = \"YES\", \"Yes\", \"yes\", \"NO\", \"No\", \"no\"\ndy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]\n\n\ndef inside(y, x, H, W):\n return 0 <= y < H and 0 <= x < W\n\n\ndef ceil(a, b):\n return (a + b - 1) \/\/ b\n\n\ndef main():\n N = int(eval(input()))\n i = 1\n while i * i <= N:\n i += 1\n print(((i - 1) * (i - 1)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":34.375,"diff":["+from string import ascii_lowercase","+from functools import lru_cache","+import sys","+sys.setrecursionlimit(10000)","+YES, Yes, yes, NO, No, no = \"YES\", \"Yes\", \"yes\", \"NO\", \"No\", \"no\"","+dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]","+","+","+def inside(y, x, H, W):","+ return 0 <= y < H and 0 <= x < W","+","+","+def ceil(a, b):","+ return (a + b - 1) \/\/ b","- ans = 0","- for i in range(10**9):","- if i * i <= N:","- ans = max(ans, i * i)","- else:","- break","- print(ans)","+ i = 1","+ while i * i <= N:","+ i += 1","+ print(((i - 1) * (i - 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0482814555,"measured_runtime_v1":0.0466237144,"runtime_lift":1.0355557484,"key":["s146709915","s910937845"]} +{"user_id":"u047796752","problem_id":"p03380","language":"python","submission_id_v0":"s473741355","submission_id_v1":"s304548278","cpu_time_v0":233,"cpu_time_v1":143,"memory_v0":62704,"memory_v1":95284,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.63,"input":"N = int(eval(input()))\n\na = list(map(int, input().split()))\n\na.sort()\n\nn = a[-1]\n\ndiff = 10**18\n\nr = -1\n\n\n\nfor ai in a:\n\n if abs(n-2*ai) 0 else \"No\"\n\n print(msg)","target":"n, k, q, *a = list(map(int, open(0).read().split()))\n\nout = [k-q for _ in range(n)]\n\nfor i in range(q):\n\n out[a[i]-1] += 1\n\nfor i in out:\n\n msg = \"Yes\" if i > 0 else \"No\"\n\n print(msg)","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":204,"code_v1_num_chars":186,"code_v0_no_empty_lines":"n, k, q = list(map(int, input().split()))\nout = [k - q for _ in range(n)]\nfor _ in range(q):\n a = int(eval(input())) - 1\n out[a] += 1\nfor i in range(n):\n msg = \"Yes\" if out[i] > 0 else \"No\"\n print(msg)\n","code_v1_no_empty_lines":"n, k, q, *a = list(map(int, open(0).read().split()))\nout = [k - q for _ in range(n)]\nfor i in range(q):\n out[a[i] - 1] += 1\nfor i in out:\n msg = \"Yes\" if i > 0 else \"No\"\n print(msg)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-n, k, q = list(map(int, input().split()))","+n, k, q, *a = list(map(int, open(0).read().split()))","-for _ in range(q):","- a = int(eval(input())) - 1","- out[a] += 1","-for i in range(n):","- msg = \"Yes\" if out[i] > 0 else \"No\"","+for i in range(q):","+ out[a[i] - 1] += 1","+for i in out:","+ msg = \"Yes\" if i > 0 else \"No\""],"diff_only_import_comment":false,"measured_runtime_v0":0.0411306889,"measured_runtime_v1":0.0331804974,"runtime_lift":1.2396043491,"key":["s842946889","s025211739"]} +{"user_id":"u921168761","problem_id":"p03574","language":"python","submission_id_v0":"s083161514","submission_id_v1":"s026222027","cpu_time_v0":30,"cpu_time_v1":24,"memory_v0":3188,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"H, W = list(map(int, input().split()))\n\nS = []\n\nfor _ in range(H):\n\n S.append(list(eval(input())))\n\n\n\nd = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]\n\nfor i in range(H):\n\n for j in range(W):\n\n if S[i][j] == '.':\n\n cnt = 0\n\n for r in range(8):\n\n y = i + d[r][0]\n\n x = j + d[r][1]\n\n if 0 <= x < W and 0 <= y < H and S[y][x] == '#':\n\n cnt = cnt + 1\n\n S[i][j] = str(cnt)\n\n\n\nfor i in range(H):\n\n print((''.join(S[i])))\n","target":"H,W=list(map(int,input().split()))\n\nS=[[0 for i in range(W)] for j in range(H)]\n\nfor i in range(H):\n\n a=list(map(str,eval(input())))\n\n for j in range(W):\n\n S[i][j]=a[j]\n\n a=[]\n\n#print(S)\n\nV=[[0 for i in range(W)] for j in range(H)]\n\nfor m in range(H):\n\n for n in range(W):\n\n if S[m][n]==\"#\":\n\n V[m][n]=\"#\"\n\n continue\n\n \n\n if m > 0 and n > 0 and S[m-1][n-1]==\"#\":\n\n V[m][n] += 1\n\n if m > 0 and S[m-1][n]==\"#\":\n\n V[m][n] += 1\n\n if m > 0 and n < W - 1 and S[m-1][n+1]==\"#\":\n\n V[m][n] += 1\n\n if n > 0 and S[m][n-1]==\"#\":\n\n V[m][n] += 1\n\n if n < W - 1 and S[m][n+1]==\"#\":\n\n V[m][n] += 1\n\n if m < H - 1 and n > 0 and S[m+1][n-1]==\"#\":\n\n V[m][n] += 1\n\n if m < H - 1 and S[m+1][n]==\"#\":\n\n V[m][n] += 1\n\n if m < H - 1 and n < W - 1 and S[m+1][n+1]==\"#\":\n\n V[m][n] += 1\n\n\n\na=[]\n\n#print(V)\n\nfor k in range(H):\n\n for l in range(W):\n\n a.append(V[k][l])\n\n print((\"\".join(map(str,a))))\n\n a=[]","code_v0_loc":19,"code_v1_loc":39,"code_v0_num_chars":544,"code_v1_num_chars":958,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\nS = []\nfor _ in range(H):\n S.append(list(eval(input())))\nd = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]\nfor i in range(H):\n for j in range(W):\n if S[i][j] == \".\":\n cnt = 0\n for r in range(8):\n y = i + d[r][0]\n x = j + d[r][1]\n if 0 <= x < W and 0 <= y < H and S[y][x] == \"#\":\n cnt = cnt + 1\n S[i][j] = str(cnt)\nfor i in range(H):\n print((\"\".join(S[i])))\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nS = [[0 for i in range(W)] for j in range(H)]\nfor i in range(H):\n a = list(map(str, eval(input())))\n for j in range(W):\n S[i][j] = a[j]\n a = []\n# print(S)\nV = [[0 for i in range(W)] for j in range(H)]\nfor m in range(H):\n for n in range(W):\n if S[m][n] == \"#\":\n V[m][n] = \"#\"\n continue\n if m > 0 and n > 0 and S[m - 1][n - 1] == \"#\":\n V[m][n] += 1\n if m > 0 and S[m - 1][n] == \"#\":\n V[m][n] += 1\n if m > 0 and n < W - 1 and S[m - 1][n + 1] == \"#\":\n V[m][n] += 1\n if n > 0 and S[m][n - 1] == \"#\":\n V[m][n] += 1\n if n < W - 1 and S[m][n + 1] == \"#\":\n V[m][n] += 1\n if m < H - 1 and n > 0 and S[m + 1][n - 1] == \"#\":\n V[m][n] += 1\n if m < H - 1 and S[m + 1][n] == \"#\":\n V[m][n] += 1\n if m < H - 1 and n < W - 1 and S[m + 1][n + 1] == \"#\":\n V[m][n] += 1\na = []\n# print(V)\nfor k in range(H):\n for l in range(W):\n a.append(V[k][l])\n print((\"\".join(map(str, a))))\n a = []\n","code_same":false,"relative_loc_diff_percent":51.2820512821,"diff":["-S = []","-for _ in range(H):","- S.append(list(eval(input())))","-d = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]","+S = [[0 for i in range(W)] for j in range(H)]","+ a = list(map(str, eval(input())))","- if S[i][j] == \".\":","- cnt = 0","- for r in range(8):","- y = i + d[r][0]","- x = j + d[r][1]","- if 0 <= x < W and 0 <= y < H and S[y][x] == \"#\":","- cnt = cnt + 1","- S[i][j] = str(cnt)","-for i in range(H):","- print((\"\".join(S[i])))","+ S[i][j] = a[j]","+ a = []","+# print(S)","+V = [[0 for i in range(W)] for j in range(H)]","+for m in range(H):","+ for n in range(W):","+ if S[m][n] == \"#\":","+ V[m][n] = \"#\"","+ continue","+ if m > 0 and n > 0 and S[m - 1][n - 1] == \"#\":","+ V[m][n] += 1","+ if m > 0 and S[m - 1][n] == \"#\":","+ V[m][n] += 1","+ if m > 0 and n < W - 1 and S[m - 1][n + 1] == \"#\":","+ V[m][n] += 1","+ if n > 0 and S[m][n - 1] == \"#\":","+ V[m][n] += 1","+ if n < W - 1 and S[m][n + 1] == \"#\":","+ V[m][n] += 1","+ if m < H - 1 and n > 0 and S[m + 1][n - 1] == \"#\":","+ V[m][n] += 1","+ if m < H - 1 and S[m + 1][n] == \"#\":","+ V[m][n] += 1","+ if m < H - 1 and n < W - 1 and S[m + 1][n + 1] == \"#\":","+ V[m][n] += 1","+a = []","+# print(V)","+for k in range(H):","+ for l in range(W):","+ a.append(V[k][l])","+ print((\"\".join(map(str, a))))","+ a = []"],"diff_only_import_comment":false,"measured_runtime_v0":0.0599560692,"measured_runtime_v1":0.0417613184,"runtime_lift":1.4356842995,"key":["s083161514","s026222027"]} +{"user_id":"u467736898","problem_id":"p04022","language":"python","submission_id_v0":"s046325228","submission_id_v1":"s888686548","cpu_time_v0":4229,"cpu_time_v1":525,"memory_v0":38732,"memory_v1":49760,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.59,"input":"import sys\n\nfrom collections import Counter\n\n\n\ndef make_prime_checker(n):\n\n # n\u307e\u3067\u306e\u81ea\u7136\u6570\u304c\u7d20\u6570\u304b\u3069\u3046\u304b\u3092\u8868\u3059\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(nloglogn)\n\n is_prime = [False, True, False, False, False, True] * (n\/\/6+1)\n\n del is_prime[n+1:]\n\n is_prime[1:4] = False, True, True\n\n for i in range(5, int(n**0.5)+1):\n\n if is_prime[i]:\n\n is_prime[i*i::i] = [False] * (n\/\/i-i+1)\n\n return is_prime\n\n\n\ndef main():\n\n Primes = [p for p, is_p in enumerate(make_prime_checker(2200)) if is_p]\n\n def decomp(n):\n\n res1 = res2 = 1\n\n for p in Primes:\n\n cnt = 0\n\n while n % p == 0:\n\n n \/\/= p\n\n cnt += 1\n\n cnt %= 3\n\n if cnt == 1:\n\n res1 *= p\n\n elif cnt == 2:\n\n res2 *= p\n\n if int(n**0.5)**2 == n:\n\n res2 *= int(n**0.5)\n\n else:\n\n res1 *= n\n\n return res1 * res2 * res2, res1 * res1 * res2\n\n\n\n N, *S = list(map(int, sys.stdin.buffer.read().split()))\n\n T = []\n\n inv_dict = {}\n\n for s in S:\n\n t, t_inv = decomp(s)\n\n T.append(t)\n\n inv_dict[t] = t_inv\n\n\n\n counter_T = Counter(T)\n\n ans = 0\n\n for t, t_cnt in list(counter_T.items()):\n\n if t == 1:\n\n ans += 1\n\n continue\n\n t_inv = inv_dict[t]\n\n t_inv_cnt = counter_T[t_inv]\n\n if t_cnt > t_inv_cnt or (t_cnt == t_inv_cnt and t > t_inv):\n\n ans += t_cnt\n\n print(ans)\n\n\n\nmain()\n","target":"import sys\n\nfrom subprocess import Popen, PIPE\n\nfrom itertools import groupby\n\nfrom collections import Counter\n\n\n\ndef main():\n\n sys.stdin.readline()\n\n S = sys.stdin.read().split()\n\n T = []\n\n inv_dict = {}\n\n Factors = Popen([\"factor\"] + S, stdout=PIPE).communicate()[0].split(b\"\\n\")\n\n for factors in Factors[:-1]:\n\n factors = list(map(int, factors.split()[1:]))\n\n t = 1\n\n t_inv = 1\n\n for f, group in groupby(factors):\n\n n = len(list(group)) % 3\n\n if n == 1:\n\n t *= f\n\n elif n == 2:\n\n t_inv *= f\n\n t, t_inv = t * t_inv * t_inv, t * t * t_inv\n\n T.append(t)\n\n inv_dict[t] = t_inv\n\n\n\n counter_T = Counter(T)\n\n ans = 0\n\n for t, t_cnt in list(counter_T.items()):\n\n if t == 1:\n\n ans += 1\n\n continue\n\n t_inv = inv_dict[t]\n\n t_inv_cnt = counter_T[t_inv]\n\n if t_cnt > t_inv_cnt or (t_cnt == t_inv_cnt and t > t_inv):\n\n ans += t_cnt\n\n print(ans)\n\n\n\nmain()\n","code_v0_loc":54,"code_v1_loc":38,"code_v0_num_chars":1462,"code_v1_num_chars":1035,"code_v0_no_empty_lines":"import sys\nfrom collections import Counter\n\n\ndef make_prime_checker(n):\n # n\u307e\u3067\u306e\u81ea\u7136\u6570\u304c\u7d20\u6570\u304b\u3069\u3046\u304b\u3092\u8868\u3059\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(nloglogn)\n is_prime = [False, True, False, False, False, True] * (n \/\/ 6 + 1)\n del is_prime[n + 1 :]\n is_prime[1:4] = False, True, True\n for i in range(5, int(n**0.5) + 1):\n if is_prime[i]:\n is_prime[i * i :: i] = [False] * (n \/\/ i - i + 1)\n return is_prime\n\n\ndef main():\n Primes = [p for p, is_p in enumerate(make_prime_checker(2200)) if is_p]\n\n def decomp(n):\n res1 = res2 = 1\n for p in Primes:\n cnt = 0\n while n % p == 0:\n n \/\/= p\n cnt += 1\n cnt %= 3\n if cnt == 1:\n res1 *= p\n elif cnt == 2:\n res2 *= p\n if int(n**0.5) ** 2 == n:\n res2 *= int(n**0.5)\n else:\n res1 *= n\n return res1 * res2 * res2, res1 * res1 * res2\n\n N, *S = list(map(int, sys.stdin.buffer.read().split()))\n T = []\n inv_dict = {}\n for s in S:\n t, t_inv = decomp(s)\n T.append(t)\n inv_dict[t] = t_inv\n counter_T = Counter(T)\n ans = 0\n for t, t_cnt in list(counter_T.items()):\n if t == 1:\n ans += 1\n continue\n t_inv = inv_dict[t]\n t_inv_cnt = counter_T[t_inv]\n if t_cnt > t_inv_cnt or (t_cnt == t_inv_cnt and t > t_inv):\n ans += t_cnt\n print(ans)\n\n\nmain()\n","code_v1_no_empty_lines":"import sys\nfrom subprocess import Popen, PIPE\nfrom itertools import groupby\nfrom collections import Counter\n\n\ndef main():\n sys.stdin.readline()\n S = sys.stdin.read().split()\n T = []\n inv_dict = {}\n Factors = Popen([\"factor\"] + S, stdout=PIPE).communicate()[0].split(b\"\\n\")\n for factors in Factors[:-1]:\n factors = list(map(int, factors.split()[1:]))\n t = 1\n t_inv = 1\n for f, group in groupby(factors):\n n = len(list(group)) % 3\n if n == 1:\n t *= f\n elif n == 2:\n t_inv *= f\n t, t_inv = t * t_inv * t_inv, t * t * t_inv\n T.append(t)\n inv_dict[t] = t_inv\n counter_T = Counter(T)\n ans = 0\n for t, t_cnt in list(counter_T.items()):\n if t == 1:\n ans += 1\n continue\n t_inv = inv_dict[t]\n t_inv_cnt = counter_T[t_inv]\n if t_cnt > t_inv_cnt or (t_cnt == t_inv_cnt and t > t_inv):\n ans += t_cnt\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":29.6296296296,"diff":["+from subprocess import Popen, PIPE","+from itertools import groupby","-def make_prime_checker(n):","- # n\u307e\u3067\u306e\u81ea\u7136\u6570\u304c\u7d20\u6570\u304b\u3069\u3046\u304b\u3092\u8868\u3059\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(nloglogn)","- is_prime = [False, True, False, False, False, True] * (n \/\/ 6 + 1)","- del is_prime[n + 1 :]","- is_prime[1:4] = False, True, True","- for i in range(5, int(n**0.5) + 1):","- if is_prime[i]:","- is_prime[i * i :: i] = [False] * (n \/\/ i - i + 1)","- return is_prime","-","-","- Primes = [p for p, is_p in enumerate(make_prime_checker(2200)) if is_p]","-","- def decomp(n):","- res1 = res2 = 1","- for p in Primes:","- cnt = 0","- while n % p == 0:","- n \/\/= p","- cnt += 1","- cnt %= 3","- if cnt == 1:","- res1 *= p","- elif cnt == 2:","- res2 *= p","- if int(n**0.5) ** 2 == n:","- res2 *= int(n**0.5)","- else:","- res1 *= n","- return res1 * res2 * res2, res1 * res1 * res2","-","- N, *S = list(map(int, sys.stdin.buffer.read().split()))","+ sys.stdin.readline()","+ S = sys.stdin.read().split()","- for s in S:","- t, t_inv = decomp(s)","+ Factors = Popen([\"factor\"] + S, stdout=PIPE).communicate()[0].split(b\"\\n\")","+ for factors in Factors[:-1]:","+ factors = list(map(int, factors.split()[1:]))","+ t = 1","+ t_inv = 1","+ for f, group in groupby(factors):","+ n = len(list(group)) % 3","+ if n == 1:","+ t *= f","+ elif n == 2:","+ t_inv *= f","+ t, t_inv = t * t_inv * t_inv, t * t * t_inv"],"diff_only_import_comment":false,"measured_runtime_v0":0.0366732609,"measured_runtime_v1":0.0465678134,"runtime_lift":0.7875237905,"key":["s046325228","s888686548"]} +{"user_id":"u705857261","problem_id":"p03575","language":"python","submission_id_v0":"s152404537","submission_id_v1":"s010463256","cpu_time_v0":212,"cpu_time_v1":103,"memory_v0":42988,"memory_v1":75764,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.42,"input":"#!\/usr\/bin\/env python3\n\n\n\nfrom pprint import pprint\n\nfrom collections import deque, defaultdict\n\nimport itertools\n\nimport math\n\nimport sys\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\ninput = sys.stdin.buffer.readline\n\nINF = float('inf')\n\n\n\nn_nodes, m_edges = list(map(int, input().split()))\n\nedges = []\n\nfor _ in range(m_edges):\n\n u, v = list(map(int, input().split()))\n\n edges.append([u - 1, v - 1])\n\n# pprint(edges)\n\n\n\n\n\ndef find_root(v):\n\n if v != parents[v]:\n\n parents[v] = find_root(parents[v])\n\n return parents[v]\n\n\n\n\n\ndef has_same_root(u, v):\n\n return find_root(u) == find_root(v)\n\n\n\n\n\ndef unite(u, v):\n\n root_u, root_v = find_root(u), find_root(v)\n\n if root_u == root_v:\n\n return\n\n if rank[root_u] < rank[root_v]:\n\n root_u, root_v = root_v, root_u\n\n parents[root_v] = root_u\n\n rank[root_u] += rank[root_v]\n\n\n\n\n\nres = 0\n\nfor i in range(m_edges):\n\n parents = [i for i in range(n_nodes)]\n\n rank = [1] * n_nodes\n\n for j in range(m_edges):\n\n if i == j:\n\n continue\n\n u, v = edges[j]\n\n if not has_same_root(u, v):\n\n unite(u, v)\n\n # pprint(parents)\n\n count = 0\n\n for v in range(n_nodes):\n\n if parents[v] == v:\n\n count += 1\n\n if count > 1:\n\n res += 1\n\n\n\nprint(res)\n","target":"#!\/usr\/bin\/env python3\n\n\n\nfrom pprint import pprint\n\nimport sys\n\n\n\nsys.setrecursionlimit(10 ** 6)\n\nINF = float('inf')\n\n\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\nedges = []\n\nfor _ in range(M):\n\n u, v = list(map(int, input().split()))\n\n edges.append([u-1, v-1])\n\n# pprint(edges)\n\n\n\n\n\n# \u3042\u308b\u8fbai\u3092\u9664\u3044\u305f\u6b8b\u308a\u306e\u8fba\u306b\u305d\u308c\u305e\u308c\u306b\u5bfe\u3057\u3066unite\u306e\u64cd\u4f5c\u3092\u884c\u3063\u305f\u306e\u3061\u3001\u7570\u306a\u308bparents\u306e\u6570\u3092\u6570\u3048\u308b\n\n# \u9023\u7d50\u30b0\u30e9\u30d5\u3067\u3042\u308c\u3070\u3001\u7570\u306a\u308bparents\u306e\u6570\u306f1\u306b\u306a\u308b\n\n# \u975e\u9023\u7d50\u30b0\u30e9\u30d5\u3067\u3042\u308c\u3070\u3001\u7570\u306a\u308bparents\u306e\u6570\u306f2\u4ee5\u4e0a\u306b\u306a\u308b\n\n\n\n\n\ndef root(v):\n\n if parents[v] == v:\n\n return v\n\n parents[v] = root(parents[v])\n\n return parents[v]\n\n\n\n\n\ndef unite(u, v):\n\n u_root = root(u)\n\n v_root = root(v)\n\n if u_root == v_root:\n\n return\n\n parents[u_root] = v_root\n\n\n\n\n\ndef same(u, v):\n\n return root(u) == root(v)\n\n\n\n\n\nans = 0\n\nfor e_i in edges:\n\n parents = [i for i in range(N)]\n\n for e_j in edges:\n\n if e_i == e_j:\n\n continue\n\n u, v = e_j\n\n if not same(u, v):\n\n unite(u, v)\n\n count = 0\n\n for v in range(N):\n\n if parents[v] == v:\n\n count += 1\n\n if count > 1:\n\n ans += 1\n\n\n\nprint(ans)\n","code_v0_loc":59,"code_v1_loc":59,"code_v0_num_chars":1283,"code_v1_num_chars":1063,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nfrom pprint import pprint\nfrom collections import deque, defaultdict\nimport itertools\nimport math\nimport sys\n\nsys.setrecursionlimit(10**6)\ninput = sys.stdin.buffer.readline\nINF = float(\"inf\")\nn_nodes, m_edges = list(map(int, input().split()))\nedges = []\nfor _ in range(m_edges):\n u, v = list(map(int, input().split()))\n edges.append([u - 1, v - 1])\n# pprint(edges)\ndef find_root(v):\n if v != parents[v]:\n parents[v] = find_root(parents[v])\n return parents[v]\n\n\ndef has_same_root(u, v):\n return find_root(u) == find_root(v)\n\n\ndef unite(u, v):\n root_u, root_v = find_root(u), find_root(v)\n if root_u == root_v:\n return\n if rank[root_u] < rank[root_v]:\n root_u, root_v = root_v, root_u\n parents[root_v] = root_u\n rank[root_u] += rank[root_v]\n\n\nres = 0\nfor i in range(m_edges):\n parents = [i for i in range(n_nodes)]\n rank = [1] * n_nodes\n for j in range(m_edges):\n if i == j:\n continue\n u, v = edges[j]\n if not has_same_root(u, v):\n unite(u, v)\n # pprint(parents)\n count = 0\n for v in range(n_nodes):\n if parents[v] == v:\n count += 1\n if count > 1:\n res += 1\nprint(res)\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\nfrom pprint import pprint\nimport sys\n\nsys.setrecursionlimit(10**6)\nINF = float(\"inf\")\nN, M = list(map(int, input().split()))\nedges = []\nfor _ in range(M):\n u, v = list(map(int, input().split()))\n edges.append([u - 1, v - 1])\n# pprint(edges)\n# \u3042\u308b\u8fbai\u3092\u9664\u3044\u305f\u6b8b\u308a\u306e\u8fba\u306b\u305d\u308c\u305e\u308c\u306b\u5bfe\u3057\u3066unite\u306e\u64cd\u4f5c\u3092\u884c\u3063\u305f\u306e\u3061\u3001\u7570\u306a\u308bparents\u306e\u6570\u3092\u6570\u3048\u308b\n# \u9023\u7d50\u30b0\u30e9\u30d5\u3067\u3042\u308c\u3070\u3001\u7570\u306a\u308bparents\u306e\u6570\u306f1\u306b\u306a\u308b\n# \u975e\u9023\u7d50\u30b0\u30e9\u30d5\u3067\u3042\u308c\u3070\u3001\u7570\u306a\u308bparents\u306e\u6570\u306f2\u4ee5\u4e0a\u306b\u306a\u308b\ndef root(v):\n if parents[v] == v:\n return v\n parents[v] = root(parents[v])\n return parents[v]\n\n\ndef unite(u, v):\n u_root = root(u)\n v_root = root(v)\n if u_root == v_root:\n return\n parents[u_root] = v_root\n\n\ndef same(u, v):\n return root(u) == root(v)\n\n\nans = 0\nfor e_i in edges:\n parents = [i for i in range(N)]\n for e_j in edges:\n if e_i == e_j:\n continue\n u, v = e_j\n if not same(u, v):\n unite(u, v)\n count = 0\n for v in range(N):\n if parents[v] == v:\n count += 1\n if count > 1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-from collections import deque, defaultdict","-import itertools","-import math","-input = sys.stdin.buffer.readline","-n_nodes, m_edges = list(map(int, input().split()))","+N, M = list(map(int, input().split()))","-for _ in range(m_edges):","+for _ in range(M):","-def find_root(v):","- if v != parents[v]:","- parents[v] = find_root(parents[v])","+# \u3042\u308b\u8fbai\u3092\u9664\u3044\u305f\u6b8b\u308a\u306e\u8fba\u306b\u305d\u308c\u305e\u308c\u306b\u5bfe\u3057\u3066unite\u306e\u64cd\u4f5c\u3092\u884c\u3063\u305f\u306e\u3061\u3001\u7570\u306a\u308bparents\u306e\u6570\u3092\u6570\u3048\u308b","+# \u9023\u7d50\u30b0\u30e9\u30d5\u3067\u3042\u308c\u3070\u3001\u7570\u306a\u308bparents\u306e\u6570\u306f1\u306b\u306a\u308b","+# \u975e\u9023\u7d50\u30b0\u30e9\u30d5\u3067\u3042\u308c\u3070\u3001\u7570\u306a\u308bparents\u306e\u6570\u306f2\u4ee5\u4e0a\u306b\u306a\u308b","+def root(v):","+ if parents[v] == v:","+ return v","+ parents[v] = root(parents[v])","-def has_same_root(u, v):","- return find_root(u) == find_root(v)","+def unite(u, v):","+ u_root = root(u)","+ v_root = root(v)","+ if u_root == v_root:","+ return","+ parents[u_root] = v_root","-def unite(u, v):","- root_u, root_v = find_root(u), find_root(v)","- if root_u == root_v:","- return","- if rank[root_u] < rank[root_v]:","- root_u, root_v = root_v, root_u","- parents[root_v] = root_u","- rank[root_u] += rank[root_v]","+def same(u, v):","+ return root(u) == root(v)","-res = 0","-for i in range(m_edges):","- parents = [i for i in range(n_nodes)]","- rank = [1] * n_nodes","- for j in range(m_edges):","- if i == j:","+ans = 0","+for e_i in edges:","+ parents = [i for i in range(N)]","+ for e_j in edges:","+ if e_i == e_j:","- u, v = edges[j]","- if not has_same_root(u, v):","+ u, v = e_j","+ if not same(u, v):","- # pprint(parents)","- for v in range(n_nodes):","+ for v in range(N):","- res += 1","-print(res)","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0403564739,"measured_runtime_v1":0.0395487559,"runtime_lift":1.0204233486,"key":["s152404537","s010463256"]} +{"user_id":"u997641430","problem_id":"p02762","language":"python","submission_id_v0":"s688141847","submission_id_v1":"s951546500","cpu_time_v0":1896,"cpu_time_v1":1409,"memory_v0":26480,"memory_v1":13852,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.69,"input":"class UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n # \u89aa\u306e\u540d(\u3044\u306a\u3044\u5834\u5408\u306f\u81ea\u5206)\n\n self.parent = list(range(n))\n\n # \u5b50\u306e\u6570\n\n self.count = [0] * n\n\n\n\n def root(self, x):\n\n # x\u306e\u6839\u3092\u8fd4\u3059\n\n if self.parent[x] == x:\n\n return x\n\n else:\n\n return self.root(self.parent[x])\n\n\n\n def union(self, x, y):\n\n # x\u3068y\u3092\u307e\u3068\u3081\u308b\n\n x0 = self.root(x)\n\n y0 = self.root(y)\n\n if x0 == y0:\n\n return\n\n if x0 > y0:\n\n x0, y0 = y0, x0\n\n self.parent[y0] = x0\n\n self.count[x0] += self.count[y0] + 1\n\n\n\n def size(self, x):\n\n # x\u306e\u5c5e\u3059\u308b\u6728\u306e\u5927\u304d\u3055\n\n return self.count[self.root(x)] + 1\n\n\n\n def same(self, x, y):\n\n return self.root(x) == self.root(y)\n\n\n\n\n\nN, M, K = list(map(int, input().split()))\n\ntree = UnionFind(N)\n\n# \u540c\u3058\u30b0\u30eb\u30fc\u30d7\u3067\u306e\u53cb\u9054\u306e\u6570\u3068\u30d6\u30ed\u30c3\u30af\u306e\u6570\n\nF, B = [0] * N, [0] * N\n\nlst = []\n\nfor m in range(M):\n\n a, b = list(map(int, input().split()))\n\n tree.union(a - 1, b - 1)\n\n lst.append((a, b))\n\nfor a, b in lst:\n\n if tree.same(a - 1, b - 1):\n\n F[a - 1] += 1\n\n F[b - 1] += 1\n\nfor k in range(K):\n\n c, d = list(map(int, input().split()))\n\n if tree.same(c - 1, d - 1):\n\n B[c - 1] += 1\n\n B[d - 1] += 1\n\n# n\u304c\u5c5e\u3059\u308b\u6728\u306e\u5927\u304d\u3055\u304b\u3089\u53cb\u9054\u306e\u6570\u3068\u30d6\u30ed\u30c3\u30af\u306e\u6570\u3068\u81ea\u5206\u3092\u9664\u3044\u305f\u306e\u304c\u7b54\u3048\n\nprint((*[tree.size(n) - F[n] - B[n] - 1 for n in range(N)]))","target":"class UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n # \u89aa\u306e\u540d(\u3044\u306a\u3044\u5834\u5408\u306fNone)\n\n self.parent = [None]*n\n\n # \u5b50\u306e\u6570\n\n self.count = [0] * n\n\n\n\n def root(self, x):\n\n # x\u306e\u6839\u3092\u8fd4\u3059\n\n if self.parent[x] == None:\n\n return x\n\n else:\n\n return self.root(self.parent[x])\n\n\n\n def union(self, x, y):\n\n # x\u3068y\u3092\u307e\u3068\u3081\u308b\n\n x0 = self.root(x)\n\n y0 = self.root(y)\n\n if x0 == y0:\n\n return\n\n if x0 > y0:\n\n x0, y0 = y0, x0\n\n self.parent[y0] = x0\n\n self.count[x0] += self.count[y0] + 1\n\n\n\n def size(self, x):\n\n # x\u306e\u5c5e\u3059\u308b\u6728\u306e\u5927\u304d\u3055\n\n return self.count[self.root(x)] + 1\n\n\n\n def same(self, x, y):\n\n return self.root(x) == self.root(y)\n\n\n\n\n\nn, m, k = list(map(int, input().split()))\n\nuf = UnionFind(n)\n\n# F[i]=i\u306e\u53cb\u9054\u306e\u6570\n\nF = [0]*n\n\n# B[i]=i\u3068\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u3067\u30d6\u30ed\u30c3\u30af\u3057\u3066\u3044\u308b\u6570\n\nB = [0]*n\n\nfor i in range(m):\n\n a, b = list(map(int, input().split()))\n\n uf.union(a-1, b-1)\n\n F[a-1] += 1\n\n F[b-1] += 1\n\nfor j in range(k):\n\n a, b = list(map(int, input().split()))\n\n if uf.same(a-1, b-1):\n\n B[a-1] += 1\n\n B[b-1] += 1\n\nL = [uf.size(i)-1-F[i]-B[i] for i in range(n)]\n\nprint((*L))\n","code_v0_loc":54,"code_v1_loc":52,"code_v0_num_chars":1337,"code_v1_num_chars":1199,"code_v0_no_empty_lines":"class UnionFind:\n def __init__(self, n):\n self.n = n\n # \u89aa\u306e\u540d(\u3044\u306a\u3044\u5834\u5408\u306f\u81ea\u5206)\n self.parent = list(range(n))\n # \u5b50\u306e\u6570\n self.count = [0] * n\n\n def root(self, x):\n # x\u306e\u6839\u3092\u8fd4\u3059\n if self.parent[x] == x:\n return x\n else:\n return self.root(self.parent[x])\n\n def union(self, x, y):\n # x\u3068y\u3092\u307e\u3068\u3081\u308b\n x0 = self.root(x)\n y0 = self.root(y)\n if x0 == y0:\n return\n if x0 > y0:\n x0, y0 = y0, x0\n self.parent[y0] = x0\n self.count[x0] += self.count[y0] + 1\n\n def size(self, x):\n # x\u306e\u5c5e\u3059\u308b\u6728\u306e\u5927\u304d\u3055\n return self.count[self.root(x)] + 1\n\n def same(self, x, y):\n return self.root(x) == self.root(y)\n\n\nN, M, K = list(map(int, input().split()))\ntree = UnionFind(N)\n# \u540c\u3058\u30b0\u30eb\u30fc\u30d7\u3067\u306e\u53cb\u9054\u306e\u6570\u3068\u30d6\u30ed\u30c3\u30af\u306e\u6570\nF, B = [0] * N, [0] * N\nlst = []\nfor m in range(M):\n a, b = list(map(int, input().split()))\n tree.union(a - 1, b - 1)\n lst.append((a, b))\nfor a, b in lst:\n if tree.same(a - 1, b - 1):\n F[a - 1] += 1\n F[b - 1] += 1\nfor k in range(K):\n c, d = list(map(int, input().split()))\n if tree.same(c - 1, d - 1):\n B[c - 1] += 1\n B[d - 1] += 1\n# n\u304c\u5c5e\u3059\u308b\u6728\u306e\u5927\u304d\u3055\u304b\u3089\u53cb\u9054\u306e\u6570\u3068\u30d6\u30ed\u30c3\u30af\u306e\u6570\u3068\u81ea\u5206\u3092\u9664\u3044\u305f\u306e\u304c\u7b54\u3048\nprint((*[tree.size(n) - F[n] - B[n] - 1 for n in range(N)]))\n","code_v1_no_empty_lines":"class UnionFind:\n def __init__(self, n):\n self.n = n\n # \u89aa\u306e\u540d(\u3044\u306a\u3044\u5834\u5408\u306fNone)\n self.parent = [None] * n\n # \u5b50\u306e\u6570\n self.count = [0] * n\n\n def root(self, x):\n # x\u306e\u6839\u3092\u8fd4\u3059\n if self.parent[x] == None:\n return x\n else:\n return self.root(self.parent[x])\n\n def union(self, x, y):\n # x\u3068y\u3092\u307e\u3068\u3081\u308b\n x0 = self.root(x)\n y0 = self.root(y)\n if x0 == y0:\n return\n if x0 > y0:\n x0, y0 = y0, x0\n self.parent[y0] = x0\n self.count[x0] += self.count[y0] + 1\n\n def size(self, x):\n # x\u306e\u5c5e\u3059\u308b\u6728\u306e\u5927\u304d\u3055\n return self.count[self.root(x)] + 1\n\n def same(self, x, y):\n return self.root(x) == self.root(y)\n\n\nn, m, k = list(map(int, input().split()))\nuf = UnionFind(n)\n# F[i]=i\u306e\u53cb\u9054\u306e\u6570\nF = [0] * n\n# B[i]=i\u3068\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u3067\u30d6\u30ed\u30c3\u30af\u3057\u3066\u3044\u308b\u6570\nB = [0] * n\nfor i in range(m):\n a, b = list(map(int, input().split()))\n uf.union(a - 1, b - 1)\n F[a - 1] += 1\n F[b - 1] += 1\nfor j in range(k):\n a, b = list(map(int, input().split()))\n if uf.same(a - 1, b - 1):\n B[a - 1] += 1\n B[b - 1] += 1\nL = [uf.size(i) - 1 - F[i] - B[i] for i in range(n)]\nprint((*L))\n","code_same":false,"relative_loc_diff_percent":3.7037037037,"diff":["- # \u89aa\u306e\u540d(\u3044\u306a\u3044\u5834\u5408\u306f\u81ea\u5206)","- self.parent = list(range(n))","+ # \u89aa\u306e\u540d(\u3044\u306a\u3044\u5834\u5408\u306fNone)","+ self.parent = [None] * n","- if self.parent[x] == x:","+ if self.parent[x] == None:","-N, M, K = list(map(int, input().split()))","-tree = UnionFind(N)","-# \u540c\u3058\u30b0\u30eb\u30fc\u30d7\u3067\u306e\u53cb\u9054\u306e\u6570\u3068\u30d6\u30ed\u30c3\u30af\u306e\u6570","-F, B = [0] * N, [0] * N","-lst = []","-for m in range(M):","+n, m, k = list(map(int, input().split()))","+uf = UnionFind(n)","+# F[i]=i\u306e\u53cb\u9054\u306e\u6570","+F = [0] * n","+# B[i]=i\u3068\u540c\u3058\u30b0\u30eb\u30fc\u30d7\u3067\u30d6\u30ed\u30c3\u30af\u3057\u3066\u3044\u308b\u6570","+B = [0] * n","+for i in range(m):","- tree.union(a - 1, b - 1)","- lst.append((a, b))","-for a, b in lst:","- if tree.same(a - 1, b - 1):","- F[a - 1] += 1","- F[b - 1] += 1","-for k in range(K):","- c, d = list(map(int, input().split()))","- if tree.same(c - 1, d - 1):","- B[c - 1] += 1","- B[d - 1] += 1","-# n\u304c\u5c5e\u3059\u308b\u6728\u306e\u5927\u304d\u3055\u304b\u3089\u53cb\u9054\u306e\u6570\u3068\u30d6\u30ed\u30c3\u30af\u306e\u6570\u3068\u81ea\u5206\u3092\u9664\u3044\u305f\u306e\u304c\u7b54\u3048","-print((*[tree.size(n) - F[n] - B[n] - 1 for n in range(N)]))","+ uf.union(a - 1, b - 1)","+ F[a - 1] += 1","+ F[b - 1] += 1","+for j in range(k):","+ a, b = list(map(int, input().split()))","+ if uf.same(a - 1, b - 1):","+ B[a - 1] += 1","+ B[b - 1] += 1","+L = [uf.size(i) - 1 - F[i] - B[i] for i in range(n)]","+print((*L))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0732718832,"measured_runtime_v1":0.1088296769,"runtime_lift":0.6732711642,"key":["s688141847","s951546500"]} +{"user_id":"u069699931","problem_id":"p02622","language":"python","submission_id_v0":"s749118577","submission_id_v1":"s211389782","cpu_time_v0":69,"cpu_time_v1":61,"memory_v0":12528,"memory_v1":9480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.59,"input":"S=list(eval(input()))\n\nT=list(eval(input()))\n\ncounter=0\n\nfor i in range(len(S)):\n\n if S[i]!=T[i]:\n\n counter+=1\n\nprint(counter)","target":"S=eval(input())\n\nT=eval(input())\n\ncounter=0\n\nfor i in range(len(S)):\n\n if S[i]!=T[i]:\n\n counter+=1\n\nprint(counter)","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":124,"code_v1_num_chars":112,"code_v0_no_empty_lines":"S = list(eval(input()))\nT = list(eval(input()))\ncounter = 0\nfor i in range(len(S)):\n if S[i] != T[i]:\n counter += 1\nprint(counter)\n","code_v1_no_empty_lines":"S = eval(input())\nT = eval(input())\ncounter = 0\nfor i in range(len(S)):\n if S[i] != T[i]:\n counter += 1\nprint(counter)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S = list(eval(input()))","-T = list(eval(input()))","+S = eval(input())","+T = eval(input())"],"diff_only_import_comment":false,"measured_runtime_v0":0.1052058039,"measured_runtime_v1":0.0557503779,"runtime_lift":1.8870868293,"key":["s749118577","s211389782"]} +{"user_id":"u075012704","problem_id":"p03700","language":"python","submission_id_v0":"s347160739","submission_id_v1":"s906427407","cpu_time_v0":1858,"cpu_time_v1":1618,"memory_v0":15900,"memory_v1":11832,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.92,"input":"import math\n\n\n\nN, A, B = list(map(int, input().split()))\n\nH = [int(eval(input())) for i in range(N)]\n\n\n\nadd_damage = A-B\n\nleft = 1\n\nright = 10**9\n\nans = float('inf')\n\n\n\nfor i in range(int(math.log(10**9, 2)+1)):\n\n T = (left+right) \/\/ 2\n\n h = H.copy()\n\n h = list([max(0, x-T*B) for x in h])\n\n h = list([math.ceil(x \/ add_damage) for x in h])\n\n need = sum(h)\n\n \n\n if need <= T:\n\n right = T\n\n ans = min(ans, T)\n\n else:\n\n left = T\n\n\n\nprint((int(ans)))","target":"import math\n\n\n\nN, A, B = list(map(int, input().split()))\n\nH = [int(eval(input())) for i in range(N)]\n\n\n\nadd_damage = A-B\n\nleft = 1\n\nright = 10**9\n\nans = float('inf')\n\n\n\nfor i in range(int(math.log(10**9, 2)+1)):\n\n T = (left+right) \/\/ 2\n\n h = H.copy()\n\n h = list([math.ceil(max(0, x-T*B) \/ add_damage) for x in h])\n\n need = sum(h)\n\n \n\n if need <= T:\n\n right = T\n\n ans = min(ans, T)\n\n else:\n\n left = T\n\n\n\nprint(ans)","code_v0_loc":24,"code_v1_loc":23,"code_v0_num_chars":488,"code_v1_num_chars":448,"code_v0_no_empty_lines":"import math\n\nN, A, B = list(map(int, input().split()))\nH = [int(eval(input())) for i in range(N)]\nadd_damage = A - B\nleft = 1\nright = 10**9\nans = float(\"inf\")\nfor i in range(int(math.log(10**9, 2) + 1)):\n T = (left + right) \/\/ 2\n h = H.copy()\n h = list([max(0, x - T * B) for x in h])\n h = list([math.ceil(x \/ add_damage) for x in h])\n need = sum(h)\n if need <= T:\n right = T\n ans = min(ans, T)\n else:\n left = T\nprint((int(ans)))\n","code_v1_no_empty_lines":"import math\n\nN, A, B = list(map(int, input().split()))\nH = [int(eval(input())) for i in range(N)]\nadd_damage = A - B\nleft = 1\nright = 10**9\nans = float(\"inf\")\nfor i in range(int(math.log(10**9, 2) + 1)):\n T = (left + right) \/\/ 2\n h = H.copy()\n h = list([math.ceil(max(0, x - T * B) \/ add_damage) for x in h])\n need = sum(h)\n if need <= T:\n right = T\n ans = min(ans, T)\n else:\n left = T\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":4.1666666667,"diff":["- h = list([max(0, x - T * B) for x in h])","- h = list([math.ceil(x \/ add_damage) for x in h])","+ h = list([math.ceil(max(0, x - T * B) \/ add_damage) for x in h])","-print((int(ans)))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0473889771,"measured_runtime_v1":0.0421239343,"runtime_lift":1.1249893407,"key":["s347160739","s906427407"]} +{"user_id":"u202560873","problem_id":"p02595","language":"python","submission_id_v0":"s608112208","submission_id_v1":"s699112524","cpu_time_v0":521,"cpu_time_v1":392,"memory_v0":24580,"memory_v1":9132,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.76,"input":"import math\n\n\n\nN,D =[int(x) for x in input().split()]\n\n\n\nX = []\n\nY = []\n\n\n\nfor i in range(N):\n\n x,y = [int(x) for x in input().split()]\n\n X.append(x)\n\n Y.append(y)\n\n\n\nans = 0\n\n\n\nfor i in range(N):\n\n r = math.sqrt(X[i] ** 2 + Y[i] ** 2)\n\n if r <= D:\n\n ans += 1\n\n\n\nprint(ans)","target":"N,D =[int(x) for x in input().split()]\n\n\n\nans = 0\n\n\n\nfor i in range(N):\n\n x,y = [int(x) for x in input().split()]\n\n if x * x + y * y <= D * D:\n\n ans += 1\n\n\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":10,"code_v0_num_chars":295,"code_v1_num_chars":180,"code_v0_no_empty_lines":"import math\n\nN, D = [int(x) for x in input().split()]\nX = []\nY = []\nfor i in range(N):\n x, y = [int(x) for x in input().split()]\n X.append(x)\n Y.append(y)\nans = 0\nfor i in range(N):\n r = math.sqrt(X[i] ** 2 + Y[i] ** 2)\n if r <= D:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N, D = [int(x) for x in input().split()]\nans = 0\nfor i in range(N):\n x, y = [int(x) for x in input().split()]\n if x * x + y * y <= D * D:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import math","-","-X = []","-Y = []","+ans = 0","- X.append(x)","- Y.append(y)","-ans = 0","-for i in range(N):","- r = math.sqrt(X[i] ** 2 + Y[i] ** 2)","- if r <= D:","+ if x * x + y * y <= D * D:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363779404,"measured_runtime_v1":0.0441806622,"runtime_lift":0.8233905658,"key":["s608112208","s699112524"]} +{"user_id":"u173148629","problem_id":"p02609","language":"python","submission_id_v0":"s055544254","submission_id_v1":"s771662991","cpu_time_v0":1069,"cpu_time_v1":887,"memory_v0":9220,"memory_v1":9380,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.03,"input":"N=int(eval(input()))\n\nX=eval(input())\n\n\n\ndef pop(x): #10\u9032\u6570\n\n ret=0\n\n while x>0:\n\n ret+=x%2\n\n x\/\/=2\n\n return ret\n\n\n\ndef solve(x): #10\u9032\u6570\n\n ret=0\n\n while x>0:\n\n pop_c=pop(x)\n\n x%=pop_c\n\n ret+=1\n\n return ret\n\n\n\nmod=X.count(\"1\") #>0\n\noriginal_plus=0\n\noriginal_minus=0\n\nfor i in range(N):\n\n if X[N-1-i]==\"1\":\n\n if mod>1:\n\n original_minus+=pow(2,i,mod-1)\n\n original_plus+=pow(2,i,mod+1)\n\nfor i in range(N):\n\n if X[i]==\"0\":\n\n tmp=original_plus+pow(2,N-1-i,mod+1)\n\n tmp%=mod+1\n\n print((solve(tmp)+1))\n\n else:\n\n if mod==1:\n\n print((0))\n\n continue\n\n tmp=original_minus-pow(2,N-1-i,mod-1)\n\n tmp%=mod-1\n\n print((solve(tmp)+1))\n","target":"N=int(eval(input()))\n\nX=eval(input())\n\n\n\ndef solve(x): #10\u9032\u6570\n\n ret=0\n\n while x>0:\n\n pop=bin(x).count(\"1\")\n\n x%=pop\n\n ret+=1\n\n return ret\n\n\n\nmod=X.count(\"1\") #>0\n\noriginal_plus=0\n\noriginal_minus=0\n\nfor i in range(N):\n\n if X[N-1-i]==\"1\":\n\n if mod>1:\n\n original_minus+=pow(2,i,mod-1)\n\n original_plus+=pow(2,i,mod+1)\n\nfor i in range(N):\n\n if X[i]==\"0\":\n\n tmp=original_plus+pow(2,N-1-i,mod+1)\n\n tmp%=mod+1\n\n print((solve(tmp)+1))\n\n else:\n\n if mod==1:\n\n print((0))\n\n continue\n\n tmp=original_minus-pow(2,N-1-i,mod-1)\n\n tmp%=mod-1\n\n print((solve(tmp)+1))\n","code_v0_loc":38,"code_v1_loc":31,"code_v0_num_chars":754,"code_v1_num_chars":664,"code_v0_no_empty_lines":"N = int(eval(input()))\nX = eval(input())\n\n\ndef pop(x): # 10\u9032\u6570\n ret = 0\n while x > 0:\n ret += x % 2\n x \/\/= 2\n return ret\n\n\ndef solve(x): # 10\u9032\u6570\n ret = 0\n while x > 0:\n pop_c = pop(x)\n x %= pop_c\n ret += 1\n return ret\n\n\nmod = X.count(\"1\") # >0\noriginal_plus = 0\noriginal_minus = 0\nfor i in range(N):\n if X[N - 1 - i] == \"1\":\n if mod > 1:\n original_minus += pow(2, i, mod - 1)\n original_plus += pow(2, i, mod + 1)\nfor i in range(N):\n if X[i] == \"0\":\n tmp = original_plus + pow(2, N - 1 - i, mod + 1)\n tmp %= mod + 1\n print((solve(tmp) + 1))\n else:\n if mod == 1:\n print((0))\n continue\n tmp = original_minus - pow(2, N - 1 - i, mod - 1)\n tmp %= mod - 1\n print((solve(tmp) + 1))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nX = eval(input())\n\n\ndef solve(x): # 10\u9032\u6570\n ret = 0\n while x > 0:\n pop = bin(x).count(\"1\")\n x %= pop\n ret += 1\n return ret\n\n\nmod = X.count(\"1\") # >0\noriginal_plus = 0\noriginal_minus = 0\nfor i in range(N):\n if X[N - 1 - i] == \"1\":\n if mod > 1:\n original_minus += pow(2, i, mod - 1)\n original_plus += pow(2, i, mod + 1)\nfor i in range(N):\n if X[i] == \"0\":\n tmp = original_plus + pow(2, N - 1 - i, mod + 1)\n tmp %= mod + 1\n print((solve(tmp) + 1))\n else:\n if mod == 1:\n print((0))\n continue\n tmp = original_minus - pow(2, N - 1 - i, mod - 1)\n tmp %= mod - 1\n print((solve(tmp) + 1))\n","code_same":false,"relative_loc_diff_percent":18.4210526316,"diff":["-","-","-def pop(x): # 10\u9032\u6570","- ret = 0","- while x > 0:","- ret += x % 2","- x \/\/= 2","- return ret","- pop_c = pop(x)","- x %= pop_c","+ pop = bin(x).count(\"1\")","+ x %= pop"],"diff_only_import_comment":false,"measured_runtime_v0":0.0838352756,"measured_runtime_v1":0.1231928078,"runtime_lift":0.6805208603,"key":["s055544254","s771662991"]} +{"user_id":"u441175813","problem_id":"p03448","language":"python","submission_id_v0":"s999875236","submission_id_v1":"s976068620","cpu_time_v0":180,"cpu_time_v1":73,"memory_v0":39536,"memory_v1":67188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.44,"input":"a, b, c, x = list(map(int, [eval(input()) for _ in range(4)]))\n\nans = 0\n\nfor i in range(a+1):\n\n for j in range(b+1):\n\n for k in range(c+1):\n\n if i * 500 + j * 100 + k * 50 == x:\n\n ans += 1\n\nprint(ans)","target":"A, B, C, X = list(map(int, [eval(input()) for _ in range(4)]))\n\nans = 0\n\n\n\nfor a in range(A+1):\n\n for b in range(B+1):\n\n for c in range(C+1):\n\n if 500*a + 100*b + 50*c == X:\n\n ans += 1\n\n\n\nprint(ans)\n","code_v0_loc":8,"code_v1_loc":10,"code_v0_num_chars":224,"code_v1_num_chars":223,"code_v0_no_empty_lines":"a, b, c, x = list(map(int, [eval(input()) for _ in range(4)]))\nans = 0\nfor i in range(a + 1):\n for j in range(b + 1):\n for k in range(c + 1):\n if i * 500 + j * 100 + k * 50 == x:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"A, B, C, X = list(map(int, [eval(input()) for _ in range(4)]))\nans = 0\nfor a in range(A + 1):\n for b in range(B + 1):\n for c in range(C + 1):\n if 500 * a + 100 * b + 50 * c == X:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-a, b, c, x = list(map(int, [eval(input()) for _ in range(4)]))","+A, B, C, X = list(map(int, [eval(input()) for _ in range(4)]))","-for i in range(a + 1):","- for j in range(b + 1):","- for k in range(c + 1):","- if i * 500 + j * 100 + k * 50 == x:","+for a in range(A + 1):","+ for b in range(B + 1):","+ for c in range(C + 1):","+ if 500 * a + 100 * b + 50 * c == X:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1905303087,"measured_runtime_v1":0.0912607872,"runtime_lift":2.0877565759,"key":["s999875236","s976068620"]} +{"user_id":"u512212329","problem_id":"p02574","language":"python","submission_id_v0":"s933164687","submission_id_v1":"s428033834","cpu_time_v0":1086,"cpu_time_v1":795,"memory_v0":127180,"memory_v1":133200,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.8,"input":"from math import gcd\n\n\n\n\n\ndef main():\n\n eval(input()) # N\n\n array = [int(x) for x in input().split()]\n\n MAX_A = 10 ** 6 + 2\n\n histgram = [0] * MAX_A\n\n for x in array:\n\n histgram[int(x)] += 1\n\n pairwise = True\n\n for divider in range(2, MAX_A):\n\n count = 0\n\n for counted in histgram[divider::divider]:\n\n count += counted\n\n if count > 1:\n\n pairwise = False\n\n if pairwise:\n\n return 'pairwise coprime'\n\n gcd_now = 0\n\n for x in array:\n\n gcd_now = gcd(x, gcd_now)\n\n if gcd_now == 1:\n\n return 'setwise coprime'\n\n else:\n\n return 'not coprime'\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n","target":"from math import gcd\n\n\n\n\n\ndef main():\n\n eval(input()) # N\n\n array = [int(x) for x in input().split()]\n\n MAX_A = 10 ** 6 + 1\n\n histogram = [0] * MAX_A\n\n for x in array:\n\n histogram[int(x)] += 1\n\n for divider in range(2, MAX_A):\n\n count = 0\n\n for counted in histogram[divider::divider]:\n\n count += counted\n\n if count > 1:\n\n break\n\n else:\n\n return 'pairwise coprime'\n\n gcd_now = 0\n\n for x in array:\n\n gcd_now = gcd(x, gcd_now)\n\n if gcd_now == 1:\n\n return 'setwise coprime'\n\n else:\n\n return 'not coprime'\n\n\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n","code_v0_loc":30,"code_v1_loc":29,"code_v0_num_chars":694,"code_v1_num_chars":658,"code_v0_no_empty_lines":"from math import gcd\n\n\ndef main():\n eval(input()) # N\n array = [int(x) for x in input().split()]\n MAX_A = 10**6 + 2\n histgram = [0] * MAX_A\n for x in array:\n histgram[int(x)] += 1\n pairwise = True\n for divider in range(2, MAX_A):\n count = 0\n for counted in histgram[divider::divider]:\n count += counted\n if count > 1:\n pairwise = False\n if pairwise:\n return \"pairwise coprime\"\n gcd_now = 0\n for x in array:\n gcd_now = gcd(x, gcd_now)\n if gcd_now == 1:\n return \"setwise coprime\"\n else:\n return \"not coprime\"\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_v1_no_empty_lines":"from math import gcd\n\n\ndef main():\n eval(input()) # N\n array = [int(x) for x in input().split()]\n MAX_A = 10**6 + 1\n histogram = [0] * MAX_A\n for x in array:\n histogram[int(x)] += 1\n for divider in range(2, MAX_A):\n count = 0\n for counted in histogram[divider::divider]:\n count += counted\n if count > 1:\n break\n else:\n return \"pairwise coprime\"\n gcd_now = 0\n for x in array:\n gcd_now = gcd(x, gcd_now)\n if gcd_now == 1:\n return \"setwise coprime\"\n else:\n return \"not coprime\"\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_same":false,"relative_loc_diff_percent":3.3333333333,"diff":["- MAX_A = 10**6 + 2","- histgram = [0] * MAX_A","+ MAX_A = 10**6 + 1","+ histogram = [0] * MAX_A","- histgram[int(x)] += 1","- pairwise = True","+ histogram[int(x)] += 1","- for counted in histgram[divider::divider]:","+ for counted in histogram[divider::divider]:","- pairwise = False","- if pairwise:","+ break","+ else:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0059670823,"measured_runtime_v1":0.8763811543,"runtime_lift":0.0068087752,"key":["s933164687","s428033834"]} +{"user_id":"u197300773","problem_id":"p03958","language":"python","submission_id_v0":"s371127812","submission_id_v1":"s100811956","cpu_time_v0":71,"cpu_time_v1":19,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.24,"input":"import sys\n\n\n\nk,n=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na=[[a[i],i] for i in range(n)]\n\n\n\nif n==1: print((a[0][0]-1));sys.exit()\n\n\n\npre=-1\n\nans=0\n\nfor _ in range(k):\n\n a.sort(reverse=True)\n\n if a[0][1]!=pre:\n\n a[0][0]-=1\n\n pre=a[0][1]\n\n elif a[1][0]>0:\n\n a[1][0]-=1\n\n pre=a[1][1]\n\n else:\n\n ans=a[0][0]\n\n break\n\nprint(ans)","target":"import sys\n\n\n\nk,n=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\nif n==1: print((a[0]-1));sys.exit()\n\n\n\na.sort(reverse=True)\n\nans=max(0,a[0]-1-sum(a[1:]))\n\nprint(ans)","code_v0_loc":22,"code_v1_loc":9,"code_v0_num_chars":395,"code_v1_num_chars":177,"code_v0_no_empty_lines":"import sys\n\nk, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na = [[a[i], i] for i in range(n)]\nif n == 1:\n print((a[0][0] - 1))\n sys.exit()\npre = -1\nans = 0\nfor _ in range(k):\n a.sort(reverse=True)\n if a[0][1] != pre:\n a[0][0] -= 1\n pre = a[0][1]\n elif a[1][0] > 0:\n a[1][0] -= 1\n pre = a[1][1]\n else:\n ans = a[0][0]\n break\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nk, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nif n == 1:\n print((a[0] - 1))\n sys.exit()\na.sort(reverse=True)\nans = max(0, a[0] - 1 - sum(a[1:]))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":59.0909090909,"diff":["-a = [[a[i], i] for i in range(n)]","- print((a[0][0] - 1))","+ print((a[0] - 1))","-pre = -1","-ans = 0","-for _ in range(k):","- a.sort(reverse=True)","- if a[0][1] != pre:","- a[0][0] -= 1","- pre = a[0][1]","- elif a[1][0] > 0:","- a[1][0] -= 1","- pre = a[1][1]","- else:","- ans = a[0][0]","- break","+a.sort(reverse=True)","+ans = max(0, a[0] - 1 - sum(a[1:]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0454239199,"measured_runtime_v1":0.0443985417,"runtime_lift":1.0230948625,"key":["s371127812","s100811956"]} +{"user_id":"u492910842","problem_id":"p03146","language":"python","submission_id_v0":"s888668483","submission_id_v1":"s696279897","cpu_time_v0":967,"cpu_time_v1":78,"memory_v0":70128,"memory_v1":69424,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.93,"input":"a = [0]*1000000\n\na[0] = int(eval(input()))\n\n\n\nfor i in range(1,1000000):\n\n if a[i-1]%2 == 0:\n\n if a[i-1]\/2 in a:\n\n print((i+1))\n\n break\n\n a[i] = a[i-1]\/2\n\n else:\n\n if 3*a[i-1]+1 in a:\n\n print((i+1))\n\n break\n\n a[i] = 3*a[i-1]+1\n","target":"import sys\n\ns=int(eval(input()))\n\ndp=[0]*1000001\n\ndp[s]=1\n\ncnt=1\n\nfor i in range(1000001):\n\n if s%2==1:\n\n s=3*s+1\n\n else:\n\n s\/\/=2\n\n cnt+=1\n\n if dp[s]==1:\n\n print(cnt)\n\n sys.exit()\n\n else:\n\n dp[s]=1","code_v0_loc":14,"code_v1_loc":16,"code_v0_num_chars":251,"code_v1_num_chars":211,"code_v0_no_empty_lines":"a = [0] * 1000000\na[0] = int(eval(input()))\nfor i in range(1, 1000000):\n if a[i - 1] % 2 == 0:\n if a[i - 1] \/ 2 in a:\n print((i + 1))\n break\n a[i] = a[i - 1] \/ 2\n else:\n if 3 * a[i - 1] + 1 in a:\n print((i + 1))\n break\n a[i] = 3 * a[i - 1] + 1\n","code_v1_no_empty_lines":"import sys\n\ns = int(eval(input()))\ndp = [0] * 1000001\ndp[s] = 1\ncnt = 1\nfor i in range(1000001):\n if s % 2 == 1:\n s = 3 * s + 1\n else:\n s \/\/= 2\n cnt += 1\n if dp[s] == 1:\n print(cnt)\n sys.exit()\n else:\n dp[s] = 1\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-a = [0] * 1000000","-a[0] = int(eval(input()))","-for i in range(1, 1000000):","- if a[i - 1] % 2 == 0:","- if a[i - 1] \/ 2 in a:","- print((i + 1))","- break","- a[i] = a[i - 1] \/ 2","+import sys","+","+s = int(eval(input()))","+dp = [0] * 1000001","+dp[s] = 1","+cnt = 1","+for i in range(1000001):","+ if s % 2 == 1:","+ s = 3 * s + 1","- if 3 * a[i - 1] + 1 in a:","- print((i + 1))","- break","- a[i] = 3 * a[i - 1] + 1","+ s \/\/= 2","+ cnt += 1","+ if dp[s] == 1:","+ print(cnt)","+ sys.exit()","+ else:","+ dp[s] = 1"],"diff_only_import_comment":false,"measured_runtime_v0":1.102338624,"measured_runtime_v1":0.0533815892,"runtime_lift":20.6501649884,"key":["s888668483","s696279897"]} +{"user_id":"u525065967","problem_id":"p02621","language":"python","submission_id_v0":"s712064172","submission_id_v1":"s747242538","cpu_time_v0":32,"cpu_time_v1":28,"memory_v0":9136,"memory_v1":9040,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"a = int(eval(input()))\n\nprint((a+a**2+a**3))\n","target":"a = int(eval(input()))\n\nprint((a + a*a + a**3))\n","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":37,"code_v1_num_chars":40,"code_v0_no_empty_lines":"a = int(eval(input()))\nprint((a + a**2 + a**3))\n","code_v1_no_empty_lines":"a = int(eval(input()))\nprint((a + a * a + a**3))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((a + a**2 + a**3))","+print((a + a * a + a**3))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0692313229,"measured_runtime_v1":0.0556255456,"runtime_lift":1.2445958451,"key":["s712064172","s747242538"]} +{"user_id":"u188827677","problem_id":"p02887","language":"python","submission_id_v0":"s273487771","submission_id_v1":"s736230174","cpu_time_v0":56,"cpu_time_v1":42,"memory_v0":3316,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"n = int(eval(input()))\n\ns = eval(input())\n\n\n\np = s[0]\n\nx = s[0]\n\nfor i in range(1, n):\n\n if x == s[i]:\n\n continue\n\n else:\n\n p += s[i]\n\n x = s[i]\n\n\n\nprint((len(p)))","target":"n = int(eval(input()))\n\ns = eval(input())\n\n\n\nt = s[0]\n\nans = 1\n\nfor i in range(1,n):\n\n if t != s[i]:\n\n ans += 1\n\n t = s[i]\n\nprint(ans)","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":160,"code_v1_num_chars":129,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\np = s[0]\nx = s[0]\nfor i in range(1, n):\n if x == s[i]:\n continue\n else:\n p += s[i]\n x = s[i]\nprint((len(p)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\nt = s[0]\nans = 1\nfor i in range(1, n):\n if t != s[i]:\n ans += 1\n t = s[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-p = s[0]","-x = s[0]","+t = s[0]","+ans = 1","- if x == s[i]:","- continue","- else:","- p += s[i]","- x = s[i]","-print((len(p)))","+ if t != s[i]:","+ ans += 1","+ t = s[i]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1284602263,"measured_runtime_v1":0.0455863652,"runtime_lift":2.8179528164,"key":["s273487771","s736230174"]} +{"user_id":"u608088992","problem_id":"p02792","language":"python","submission_id_v0":"s476206417","submission_id_v1":"s874976479","cpu_time_v0":497,"cpu_time_v1":297,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.24,"input":"import sys\n\nfrom collections import deque\n\nfrom heapq import heapify, heappop, heappush\n\nfrom itertools import combinations, permutations\n\nfrom bisect import bisect, bisect_left\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n N = int(eval(input()))\n\n strN = str(N)\n\n maxDig = len(strN)\n\n count = 0\n\n for i in range(1, N + 1):\n\n a = str(i)\n\n low = int(a[-1])\n\n if low == 0: continue\n\n high = int(a[0])\n\n if low == high: count += 1 #\u4e00\u756a\u4e0a\u4f4d\u3068\u4e0b\u4f4d\u306e\u6841\u306e\u6570\u5b57\u304c\u540c\u3058\n\n digb = 2\n\n while digb < maxDig:\n\n count += 10 ** (digb - 2)\n\n digb += 1\n\n if N >= 10:\n\n if low > int(strN[0]): continue\n\n elif low < int(strN[0]): count += 10 ** (digb - 2)\n\n elif N >= 10:\n\n DP = [[0, 0] for _ in range(maxDig)]\n\n DP[0][0] = 1\n\n for j in range(1, maxDig - 1):\n\n DP[j][0] = 1\n\n DP[j][1] = DP[j-1][1] * 10 + DP[j-1][0] * (int(strN[j]))\n\n\n\n count += DP[maxDig - 2][1] \n\n #print(i, DP)\n\n if int(strN[maxDig - 1]) >= high: count += 1\n\n\n\n print(count)\n\n \n\n \n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","target":"import sys\n\n\n\ndef solve():\n\n N = int(eval(input()))\n\n D = dict()\n\n for i in range(1, N + 1):\n\n front = i % 10\n\n back = i\n\n while back >= 10: back \/\/= 10\n\n if front > 0:\n\n if (front, back) in D: D[(front, back)] += 1\n\n else: D[(front, back)] = 1\n\n Ans = 0\n\n for i in range(1, N + 1):\n\n back = i % 10\n\n if back > 0:\n\n front = i\n\n while front >= 10: front \/\/= 10\n\n if (front, back) in D: Ans += D[(front, back)]\n\n print(Ans)\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":44,"code_v1_loc":25,"code_v0_num_chars":1242,"code_v1_num_chars":589,"code_v0_no_empty_lines":"import sys\nfrom collections import deque\nfrom heapq import heapify, heappop, heappush\nfrom itertools import combinations, permutations\nfrom bisect import bisect, bisect_left\n\n\ndef solve():\n input = sys.stdin.readline\n N = int(eval(input()))\n strN = str(N)\n maxDig = len(strN)\n count = 0\n for i in range(1, N + 1):\n a = str(i)\n low = int(a[-1])\n if low == 0:\n continue\n high = int(a[0])\n if low == high:\n count += 1 # \u4e00\u756a\u4e0a\u4f4d\u3068\u4e0b\u4f4d\u306e\u6841\u306e\u6570\u5b57\u304c\u540c\u3058\n digb = 2\n while digb < maxDig:\n count += 10 ** (digb - 2)\n digb += 1\n if N >= 10:\n if low > int(strN[0]):\n continue\n elif low < int(strN[0]):\n count += 10 ** (digb - 2)\n elif N >= 10:\n DP = [[0, 0] for _ in range(maxDig)]\n DP[0][0] = 1\n for j in range(1, maxDig - 1):\n DP[j][0] = 1\n DP[j][1] = DP[j - 1][1] * 10 + DP[j - 1][0] * (int(strN[j]))\n count += DP[maxDig - 2][1]\n # print(i, DP)\n if int(strN[maxDig - 1]) >= high:\n count += 1\n print(count)\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys\n\n\ndef solve():\n N = int(eval(input()))\n D = dict()\n for i in range(1, N + 1):\n front = i % 10\n back = i\n while back >= 10:\n back \/\/= 10\n if front > 0:\n if (front, back) in D:\n D[(front, back)] += 1\n else:\n D[(front, back)] = 1\n Ans = 0\n for i in range(1, N + 1):\n back = i % 10\n if back > 0:\n front = i\n while front >= 10:\n front \/\/= 10\n if (front, back) in D:\n Ans += D[(front, back)]\n print(Ans)\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":43.1818181818,"diff":["-from collections import deque","-from heapq import heapify, heappop, heappush","-from itertools import combinations, permutations","-from bisect import bisect, bisect_left","- input = sys.stdin.readline","- strN = str(N)","- maxDig = len(strN)","- count = 0","+ D = dict()","- a = str(i)","- low = int(a[-1])","- if low == 0:","- continue","- high = int(a[0])","- if low == high:","- count += 1 # \u4e00\u756a\u4e0a\u4f4d\u3068\u4e0b\u4f4d\u306e\u6841\u306e\u6570\u5b57\u304c\u540c\u3058","- digb = 2","- while digb < maxDig:","- count += 10 ** (digb - 2)","- digb += 1","- if N >= 10:","- if low > int(strN[0]):","- continue","- elif low < int(strN[0]):","- count += 10 ** (digb - 2)","- elif N >= 10:","- DP = [[0, 0] for _ in range(maxDig)]","- DP[0][0] = 1","- for j in range(1, maxDig - 1):","- DP[j][0] = 1","- DP[j][1] = DP[j - 1][1] * 10 + DP[j - 1][0] * (int(strN[j]))","- count += DP[maxDig - 2][1]","- # print(i, DP)","- if int(strN[maxDig - 1]) >= high:","- count += 1","- print(count)","+ front = i % 10","+ back = i","+ while back >= 10:","+ back \/\/= 10","+ if front > 0:","+ if (front, back) in D:","+ D[(front, back)] += 1","+ else:","+ D[(front, back)] = 1","+ Ans = 0","+ for i in range(1, N + 1):","+ back = i % 10","+ if back > 0:","+ front = i","+ while front >= 10:","+ front \/\/= 10","+ if (front, back) in D:","+ Ans += D[(front, back)]","+ print(Ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1110315235,"measured_runtime_v1":0.0534380713,"runtime_lift":2.0777606835,"key":["s476206417","s874976479"]} +{"user_id":"u935558307","problem_id":"p03526","language":"python","submission_id_v0":"s959263709","submission_id_v1":"s373608699","cpu_time_v0":408,"cpu_time_v1":262,"memory_v0":70480,"memory_v1":70420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.78,"input":"N = int(eval(input()))\n\n\"\"\"\n\ndp[i][j] -> i\u756a\u76ee\u306e\u4eba\u9593\u307e\u3067\u307f\u308b\u3002j\u4eba\u304c\u7a4d\u3080\u3068\u304d\u306e\u6700\u5c0f\u5024\u3002\n\n\n\n\"\"\"\n\nHP = [list(map(int,input().split())) for _ in range(N)]\n\nHP.sort(key=lambda x:x[0]+x[1])\n\ndp = [float(\"INF\")]*(N+1)\n\ndp[0] = 0\n\nfor i in range(1,N+1):\n\n for j in range(N,0,-1):\n\n if dp[j-1] <= HP[i-1][0]:\n\n dp[j] = min(dp[j],dp[j-1]+HP[i-1][1])\n\nfor j in range(N,-1,-1):\n\n if dp[j] != float(\"INF\"):\n\n print(j)\n\n break\n","target":"\"\"\"\n\nA\u3055\u3093\uff1a\u8eab\u9577Ha , \u30d1\u30ef\u30fcPa\n\nB\u3055\u3093\uff1a\u8eab\u9577Hb , \u30d1\u30ef\u30fcPb\n\n\u4e8c\u4eba\u3069\u3061\u3089\u3082\u7a4d\u3081\u308b\u306e\u306b\u9806\u756a\u3092\u9593\u9055\u3048\u305f\u3070\u304b\u308a\u306b\u4e00\u4eba\u3057\u304b\u7a4d\u3081\u306a\u3044\u3001\u3068\u3044\u3046\u4e8b\u614b\u3092\u907f\u3051\u305f\u3044\u3002\n\nA\u3055\u3093\u304c\u5148\u306b\u7a4d\u3080\u3079\u304d\uff1fB\u3055\u3093\u304c\u5148\u306b\u7a4d\u3080\u3079\u304d\uff1f\n\nA\u3055\u3093\u3001B\u3055\u3093\u306e\u624b\u524d\u307e\u3067\u306e\u6642\u70b9\u3067\u9ad8\u3055S\u307e\u3067\u7a4d\u307f\u3042\u304c\u3063\u3066\u3044\u308b\u3068\u3059\u308b\u3002S <= min(Hb,Ha)\u3068\u3059\u308b\u3002\n\n\n\nS+Pa > Hb\u3000\u304b\u3064 S+Pb <= Ha\u306a\u3089B\u304c\u5148\n\nS+Pb > Ha\u3000\u304b\u3064 S+Pa <= Hb\u306a\u3089A\u304c\u5148\n\n\n\nPa-Hb > Pb-Ha \u306a\u3089B\u304c\u5148\u3067A\u304c\u5f8c\n\n\u66f8\u304d\u63db\u3048\u308b\u3068Pa+Ha > Pb+Hb\u306a\u3089B\u304c\u5148\u3067A\u304c\u5f8c\n\n\u3064\u307e\u308a\u3001P+H\u9806\u306b\u30bd\u30fc\u30c8\u3057\u3066\u30ca\u30c3\u30d7\u30b5\u30c3\u30af\u3059\u308c\u3070\u3088\u3044\n\n\"\"\"\n\n\n\n\n\nN = int(eval(input()))\n\nHP = [list(map(int,input().split())) for _ in range(N)]\n\nHP.sort(key = lambda x:x[0]+x[1])\n\n#dp[i][j] -> j\u4eba\u7a4d\u3080\u5834\u5408\u306e\u5ea7\u5e03\u56e3\u306e\u6700\u5c0f\u679a\u6570\n\ndp = [float(\"INF\")]*(N+1)\n\ndp[0] = 0\n\nfor h,p in HP:\n\n for j in range(N,0,-1):\n\n if dp[j-1] <= h:\n\n dp[j] = min(dp[j],dp[j-1]+p)\n\n\n\nfor j in range(N,-1,-1):\n\n if dp[j] != float(\"INF\"):\n\n print(j)\n\n break","code_v0_loc":17,"code_v1_loc":31,"code_v0_num_chars":423,"code_v1_num_chars":699,"code_v0_no_empty_lines":"N = int(eval(input()))\n\"\"\"\ndp[i][j] -> i\u756a\u76ee\u306e\u4eba\u9593\u307e\u3067\u307f\u308b\u3002j\u4eba\u304c\u7a4d\u3080\u3068\u304d\u306e\u6700\u5c0f\u5024\u3002\n\"\"\"\nHP = [list(map(int, input().split())) for _ in range(N)]\nHP.sort(key=lambda x: x[0] + x[1])\ndp = [float(\"INF\")] * (N + 1)\ndp[0] = 0\nfor i in range(1, N + 1):\n for j in range(N, 0, -1):\n if dp[j - 1] <= HP[i - 1][0]:\n dp[j] = min(dp[j], dp[j - 1] + HP[i - 1][1])\nfor j in range(N, -1, -1):\n if dp[j] != float(\"INF\"):\n print(j)\n break\n","code_v1_no_empty_lines":"\"\"\"\nA\u3055\u3093\uff1a\u8eab\u9577Ha , \u30d1\u30ef\u30fcPa\nB\u3055\u3093\uff1a\u8eab\u9577Hb , \u30d1\u30ef\u30fcPb\n\u4e8c\u4eba\u3069\u3061\u3089\u3082\u7a4d\u3081\u308b\u306e\u306b\u9806\u756a\u3092\u9593\u9055\u3048\u305f\u3070\u304b\u308a\u306b\u4e00\u4eba\u3057\u304b\u7a4d\u3081\u306a\u3044\u3001\u3068\u3044\u3046\u4e8b\u614b\u3092\u907f\u3051\u305f\u3044\u3002\nA\u3055\u3093\u304c\u5148\u306b\u7a4d\u3080\u3079\u304d\uff1fB\u3055\u3093\u304c\u5148\u306b\u7a4d\u3080\u3079\u304d\uff1f\nA\u3055\u3093\u3001B\u3055\u3093\u306e\u624b\u524d\u307e\u3067\u306e\u6642\u70b9\u3067\u9ad8\u3055S\u307e\u3067\u7a4d\u307f\u3042\u304c\u3063\u3066\u3044\u308b\u3068\u3059\u308b\u3002S <= min(Hb,Ha)\u3068\u3059\u308b\u3002\nS+Pa > Hb\u3000\u304b\u3064 S+Pb <= Ha\u306a\u3089B\u304c\u5148\nS+Pb > Ha\u3000\u304b\u3064 S+Pa <= Hb\u306a\u3089A\u304c\u5148\nPa-Hb > Pb-Ha \u306a\u3089B\u304c\u5148\u3067A\u304c\u5f8c\n\u66f8\u304d\u63db\u3048\u308b\u3068Pa+Ha > Pb+Hb\u306a\u3089B\u304c\u5148\u3067A\u304c\u5f8c\n\u3064\u307e\u308a\u3001P+H\u9806\u306b\u30bd\u30fc\u30c8\u3057\u3066\u30ca\u30c3\u30d7\u30b5\u30c3\u30af\u3059\u308c\u3070\u3088\u3044\n\"\"\"\nN = int(eval(input()))\nHP = [list(map(int, input().split())) for _ in range(N)]\nHP.sort(key=lambda x: x[0] + x[1])\n# dp[i][j] -> j\u4eba\u7a4d\u3080\u5834\u5408\u306e\u5ea7\u5e03\u56e3\u306e\u6700\u5c0f\u679a\u6570\ndp = [float(\"INF\")] * (N + 1)\ndp[0] = 0\nfor h, p in HP:\n for j in range(N, 0, -1):\n if dp[j - 1] <= h:\n dp[j] = min(dp[j], dp[j - 1] + p)\nfor j in range(N, -1, -1):\n if dp[j] != float(\"INF\"):\n print(j)\n break\n","code_same":false,"relative_loc_diff_percent":45.1612903226,"diff":["+\"\"\"","+A\u3055\u3093\uff1a\u8eab\u9577Ha , \u30d1\u30ef\u30fcPa","+B\u3055\u3093\uff1a\u8eab\u9577Hb , \u30d1\u30ef\u30fcPb","+\u4e8c\u4eba\u3069\u3061\u3089\u3082\u7a4d\u3081\u308b\u306e\u306b\u9806\u756a\u3092\u9593\u9055\u3048\u305f\u3070\u304b\u308a\u306b\u4e00\u4eba\u3057\u304b\u7a4d\u3081\u306a\u3044\u3001\u3068\u3044\u3046\u4e8b\u614b\u3092\u907f\u3051\u305f\u3044\u3002","+A\u3055\u3093\u304c\u5148\u306b\u7a4d\u3080\u3079\u304d\uff1fB\u3055\u3093\u304c\u5148\u306b\u7a4d\u3080\u3079\u304d\uff1f","+A\u3055\u3093\u3001B\u3055\u3093\u306e\u624b\u524d\u307e\u3067\u306e\u6642\u70b9\u3067\u9ad8\u3055S\u307e\u3067\u7a4d\u307f\u3042\u304c\u3063\u3066\u3044\u308b\u3068\u3059\u308b\u3002S <= min(Hb,Ha)\u3068\u3059\u308b\u3002","+S+Pa > Hb\u3000\u304b\u3064 S+Pb <= Ha\u306a\u3089B\u304c\u5148","+S+Pb > Ha\u3000\u304b\u3064 S+Pa <= Hb\u306a\u3089A\u304c\u5148","+Pa-Hb > Pb-Ha \u306a\u3089B\u304c\u5148\u3067A\u304c\u5f8c","+\u66f8\u304d\u63db\u3048\u308b\u3068Pa+Ha > Pb+Hb\u306a\u3089B\u304c\u5148\u3067A\u304c\u5f8c","+\u3064\u307e\u308a\u3001P+H\u9806\u306b\u30bd\u30fc\u30c8\u3057\u3066\u30ca\u30c3\u30d7\u30b5\u30c3\u30af\u3059\u308c\u3070\u3088\u3044","+\"\"\"","-\"\"\"","-dp[i][j] -> i\u756a\u76ee\u306e\u4eba\u9593\u307e\u3067\u307f\u308b\u3002j\u4eba\u304c\u7a4d\u3080\u3068\u304d\u306e\u6700\u5c0f\u5024\u3002","-\"\"\"","+# dp[i][j] -> j\u4eba\u7a4d\u3080\u5834\u5408\u306e\u5ea7\u5e03\u56e3\u306e\u6700\u5c0f\u679a\u6570","-for i in range(1, N + 1):","+for h, p in HP:","- if dp[j - 1] <= HP[i - 1][0]:","- dp[j] = min(dp[j], dp[j - 1] + HP[i - 1][1])","+ if dp[j - 1] <= h:","+ dp[j] = min(dp[j], dp[j - 1] + p)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1102650933,"measured_runtime_v1":0.0601084707,"runtime_lift":1.8344351813,"key":["s959263709","s373608699"]} +{"user_id":"u116002573","problem_id":"p02717","language":"python","submission_id_v0":"s936851538","submission_id_v1":"s505207457","cpu_time_v0":171,"cpu_time_v1":71,"memory_v0":38384,"memory_v1":61664,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.48,"input":"def main():\n\n\n\n A, B, C = list(map(int, input().split()))\n\n return \" \".join(map(str, [C, A, B]))\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n","target":"def main():\n\n\n\n X, Y, Z = list(map(int, input().split()))\n\n return \" \".join(map(str, [Z, X, Y]))\n\n\n\nif __name__ == '__main__':\n\n print((main()))\n","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":146,"code_v1_num_chars":146,"code_v0_no_empty_lines":"def main():\n A, B, C = list(map(int, input().split()))\n return \" \".join(map(str, [C, A, B]))\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_v1_no_empty_lines":"def main():\n X, Y, Z = list(map(int, input().split()))\n return \" \".join(map(str, [Z, X, Y]))\n\n\nif __name__ == \"__main__\":\n print((main()))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- A, B, C = list(map(int, input().split()))","- return \" \".join(map(str, [C, A, B]))","+ X, Y, Z = list(map(int, input().split()))","+ return \" \".join(map(str, [Z, X, Y]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0313070865,"measured_runtime_v1":0.0316174574,"runtime_lift":0.9901835581,"key":["s936851538","s505207457"]} +{"user_id":"u786020649","problem_id":"p03476","language":"python","submission_id_v0":"s834206932","submission_id_v1":"s369239687","cpu_time_v0":1692,"cpu_time_v1":303,"memory_v0":23036,"memory_v1":24104,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.09,"input":"from math import gcd\n\nfrom collections import deque\n\nfrom bisect import bisect_left,bisect_right\n\n\n\nq=int(eval(input()))\n\nlr=[tuple(map(int,input().split())) for _ in range(q)]\n\n\n\nrmax=max(e[1] for e in lr)\n\nanslst=[]\n\ncandlst=deque([2])\n\npprod=2\n\nfor i in range(3,rmax+1,2):\n\n tmp=2*candlst[0]-1\n\n if gcd(pprod,i)==1: \n\n candlst.append(i)\n\n pprod*=i\n\n if tmp==i:\n\n anslst.append(tmp)\n\n if tmp==i:\n\n candlst.popleft()\n\n\n\nfor e in lr:\n\n print((bisect_right(anslst,e[1])-bisect_left(anslst,e[0])))","target":"q=int(eval(input()))\n\nlr=[tuple(map(int,input().split())) for _ in range(q)]\n\n\n\nn=10**5\n\nansl=[]\n\nsieve=[1]*(n+1)\n\nsieve[0],sieve[1]=0,0\n\nfor i in range(2,n):\n\n if sieve[i]:\n\n for j in range(2*i,n+1,i):\n\n sieve[j]=0\n\nans=[0]*(n+1)\n\nfor i in range(3,n):\n\n if sieve[i]==1 and sieve[(i+1)\/\/2]==1:\n\n ans[i]=ans[i-1]+1\n\n else:\n\n ans[i]=ans[i-1]\n\n\n\nfor e in lr:\n\n print((ans[e[1]]-ans[e[0]-1]))\n","code_v0_loc":23,"code_v1_loc":20,"code_v0_num_chars":508,"code_v1_num_chars":399,"code_v0_no_empty_lines":"from math import gcd\nfrom collections import deque\nfrom bisect import bisect_left, bisect_right\n\nq = int(eval(input()))\nlr = [tuple(map(int, input().split())) for _ in range(q)]\nrmax = max(e[1] for e in lr)\nanslst = []\ncandlst = deque([2])\npprod = 2\nfor i in range(3, rmax + 1, 2):\n tmp = 2 * candlst[0] - 1\n if gcd(pprod, i) == 1:\n candlst.append(i)\n pprod *= i\n if tmp == i:\n anslst.append(tmp)\n if tmp == i:\n candlst.popleft()\nfor e in lr:\n print((bisect_right(anslst, e[1]) - bisect_left(anslst, e[0])))\n","code_v1_no_empty_lines":"q = int(eval(input()))\nlr = [tuple(map(int, input().split())) for _ in range(q)]\nn = 10**5\nansl = []\nsieve = [1] * (n + 1)\nsieve[0], sieve[1] = 0, 0\nfor i in range(2, n):\n if sieve[i]:\n for j in range(2 * i, n + 1, i):\n sieve[j] = 0\nans = [0] * (n + 1)\nfor i in range(3, n):\n if sieve[i] == 1 and sieve[(i + 1) \/\/ 2] == 1:\n ans[i] = ans[i - 1] + 1\n else:\n ans[i] = ans[i - 1]\nfor e in lr:\n print((ans[e[1]] - ans[e[0] - 1]))\n","code_same":false,"relative_loc_diff_percent":13.0434782609,"diff":["-from math import gcd","-from collections import deque","-from bisect import bisect_left, bisect_right","-","-rmax = max(e[1] for e in lr)","-anslst = []","-candlst = deque([2])","-pprod = 2","-for i in range(3, rmax + 1, 2):","- tmp = 2 * candlst[0] - 1","- if gcd(pprod, i) == 1:","- candlst.append(i)","- pprod *= i","- if tmp == i:","- anslst.append(tmp)","- if tmp == i:","- candlst.popleft()","+n = 10**5","+ansl = []","+sieve = [1] * (n + 1)","+sieve[0], sieve[1] = 0, 0","+for i in range(2, n):","+ if sieve[i]:","+ for j in range(2 * i, n + 1, i):","+ sieve[j] = 0","+ans = [0] * (n + 1)","+for i in range(3, n):","+ if sieve[i] == 1 and sieve[(i + 1) \/\/ 2] == 1:","+ ans[i] = ans[i - 1] + 1","+ else:","+ ans[i] = ans[i - 1]","- print((bisect_right(anslst, e[1]) - bisect_left(anslst, e[0])))","+ print((ans[e[1]] - ans[e[0] - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0378720829,"measured_runtime_v1":0.0921598549,"runtime_lift":0.4109390471,"key":["s834206932","s369239687"]} +{"user_id":"u583507988","problem_id":"p02576","language":"python","submission_id_v0":"s291692451","submission_id_v1":"s458634222","cpu_time_v0":28,"cpu_time_v1":25,"memory_v0":9152,"memory_v1":9144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.71,"input":"n, x, t = list(map(int, input().split()))\n\nm = n\/\/x\n\nif n%x==0:\n\n print((m*t))\n\nelse:\n\n print((m*t+t))","target":"n, x, t = list(map(int, input().split()))\n\nif n%x==0:\n\n print((n\/\/x*t))\n\nelse:\n\n print((n\/\/x*t + t))","code_v0_loc":6,"code_v1_loc":5,"code_v0_num_chars":94,"code_v1_num_chars":92,"code_v0_no_empty_lines":"n, x, t = list(map(int, input().split()))\nm = n \/\/ x\nif n % x == 0:\n print((m * t))\nelse:\n print((m * t + t))\n","code_v1_no_empty_lines":"n, x, t = list(map(int, input().split()))\nif n % x == 0:\n print((n \/\/ x * t))\nelse:\n print((n \/\/ x * t + t))\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-m = n \/\/ x","- print((m * t))","+ print((n \/\/ x * t))","- print((m * t + t))","+ print((n \/\/ x * t + t))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0446235715,"measured_runtime_v1":0.0361290807,"runtime_lift":1.2351150543,"key":["s291692451","s458634222"]} +{"user_id":"u761320129","problem_id":"p03805","language":"python","submission_id_v0":"s933472272","submission_id_v1":"s199886578","cpu_time_v0":34,"cpu_time_v1":25,"memory_v0":2696,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.47,"input":"def dfs():\n\n stack = [[0]]\n\n count = 0\n\n while stack:\n\n route = stack.pop()\n\n if len(route) == N:\n\n #print 'route=',route\n\n count += 1\n\n continue\n\n now = route[-1]\n\n for next in [x for x in range(N) if EDGES[now][x] == 1]:\n\n #print 'now,next',now,next\n\n if next in route:\n\n continue\n\n newroute = route[:]\n\n newroute.append(next)\n\n stack.append(newroute)\n\n return count\n\n\n\nN,M = list(map(int, input().split()))\n\nEDGES = [[0 for i in range(N)] for i in range(N)]\n\nfor i in range(M):\n\n a,b = list(map(int, input().split()))\n\n EDGES[a-1][b-1] = 1\n\n EDGES[b-1][a-1] = 1\n\n\n\nprint(dfs())","target":"import itertools\n\nN,M = list(map(int,input().split()))\n\nes = [[0 for j in range(N)] for i in range(N)]\n\nfor i in range(M):\n\n a,b = list(map(int,input().split()))\n\n a,b = a-1,b-1\n\n es[a][b] = es[b][a] = 1\n\n\n\nans = 0\n\nfor ptn in itertools.permutations(list(range(1,N))):\n\n prev = 0\n\n for v in ptn:\n\n if not es[prev][v]:\n\n break\n\n prev = v\n\n else:\n\n ans += 1\n\nprint(ans)","code_v0_loc":27,"code_v1_loc":18,"code_v0_num_chars":644,"code_v1_num_chars":399,"code_v0_no_empty_lines":"def dfs():\n stack = [[0]]\n count = 0\n while stack:\n route = stack.pop()\n if len(route) == N:\n # print 'route=',route\n count += 1\n continue\n now = route[-1]\n for next in [x for x in range(N) if EDGES[now][x] == 1]:\n # print 'now,next',now,next\n if next in route:\n continue\n newroute = route[:]\n newroute.append(next)\n stack.append(newroute)\n return count\n\n\nN, M = list(map(int, input().split()))\nEDGES = [[0 for i in range(N)] for i in range(N)]\nfor i in range(M):\n a, b = list(map(int, input().split()))\n EDGES[a - 1][b - 1] = 1\n EDGES[b - 1][a - 1] = 1\nprint(dfs())\n","code_v1_no_empty_lines":"import itertools\n\nN, M = list(map(int, input().split()))\nes = [[0 for j in range(N)] for i in range(N)]\nfor i in range(M):\n a, b = list(map(int, input().split()))\n a, b = a - 1, b - 1\n es[a][b] = es[b][a] = 1\nans = 0\nfor ptn in itertools.permutations(list(range(1, N))):\n prev = 0\n for v in ptn:\n if not es[prev][v]:\n break\n prev = v\n else:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-def dfs():","- stack = [[0]]","- count = 0","- while stack:","- route = stack.pop()","- if len(route) == N:","- # print 'route=',route","- count += 1","- continue","- now = route[-1]","- for next in [x for x in range(N) if EDGES[now][x] == 1]:","- # print 'now,next',now,next","- if next in route:","- continue","- newroute = route[:]","- newroute.append(next)","- stack.append(newroute)","- return count","-","+import itertools","-EDGES = [[0 for i in range(N)] for i in range(N)]","+es = [[0 for j in range(N)] for i in range(N)]","- EDGES[a - 1][b - 1] = 1","- EDGES[b - 1][a - 1] = 1","-print(dfs())","+ a, b = a - 1, b - 1","+ es[a][b] = es[b][a] = 1","+ans = 0","+for ptn in itertools.permutations(list(range(1, N))):","+ prev = 0","+ for v in ptn:","+ if not es[prev][v]:","+ break","+ prev = v","+ else:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0444682638,"measured_runtime_v1":0.0481000051,"runtime_lift":0.9244960294,"key":["s933472272","s199886578"]} +{"user_id":"u391731808","problem_id":"p03732","language":"python","submission_id_v0":"s828773422","submission_id_v1":"s537616925","cpu_time_v0":1380,"cpu_time_v1":112,"memory_v0":53876,"memory_v1":10912,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.88,"input":"N,W = list(map(int,input().split()))\n\nWV = [list(map(int,input().split())) for _ in [0]*N]\n\n\n\n#dp[i][n:\u5165\u308c\u305f\u6570][dW:w1\u304b\u3089\u306e\u5dee\u5206\u306e\u5408\u8a08]\n\ndp = [[[0]*(3*N+1) for _ in [0]*(N+1)] for _ in [0]*(N+1)]\n\nw0 = WV[0][0]\n\nfor i,wv in enumerate(WV,1):\n\n w,v = wv\n\n w -= w0\n\n for n in range(1,i+1):\n\n for dW in range(3*N+1):\n\n if n*w0 + dW > W:break\n\n if w>dW:\n\n dp[i][n][dW] = dp[i-1][n][dW]\n\n continue\n\n dp[i][n][dW] = max(dp[i-1][n][dW],dp[i-1][n-1][dW-w]+v)\n\nprint((max(max(row) for row in dp[-1])))","target":"#\u30e1\u30e2\u5316\u518d\u5e30\n\nN,W = list(map(int,input().split()))\n\nWV = [list(map(int,input().split())) for _ in [0]*N]\n\nmemo = [{} for _ in [0]*(N+1)]\n\ndef dp(i,j):\n\n if j<=0 or i<=0: return 0\n\n if j in memo[i]:return memo[i][j]\n\n w,v = WV[i-1]\n\n ret = dp(i-1,j)\n\n if j-w>=0: ret = max(ret,dp(i-1,j-w)+v)\n\n memo[i][j] = ret\n\n return ret\n\nprint((dp(N,W)))","code_v0_loc":17,"code_v1_loc":13,"code_v0_num_chars":550,"code_v1_num_chars":347,"code_v0_no_empty_lines":"N, W = list(map(int, input().split()))\nWV = [list(map(int, input().split())) for _ in [0] * N]\n# dp[i][n:\u5165\u308c\u305f\u6570][dW:w1\u304b\u3089\u306e\u5dee\u5206\u306e\u5408\u8a08]\ndp = [[[0] * (3 * N + 1) for _ in [0] * (N + 1)] for _ in [0] * (N + 1)]\nw0 = WV[0][0]\nfor i, wv in enumerate(WV, 1):\n w, v = wv\n w -= w0\n for n in range(1, i + 1):\n for dW in range(3 * N + 1):\n if n * w0 + dW > W:\n break\n if w > dW:\n dp[i][n][dW] = dp[i - 1][n][dW]\n continue\n dp[i][n][dW] = max(dp[i - 1][n][dW], dp[i - 1][n - 1][dW - w] + v)\nprint((max(max(row) for row in dp[-1])))\n","code_v1_no_empty_lines":"# \u30e1\u30e2\u5316\u518d\u5e30\nN, W = list(map(int, input().split()))\nWV = [list(map(int, input().split())) for _ in [0] * N]\nmemo = [{} for _ in [0] * (N + 1)]\n\n\ndef dp(i, j):\n if j <= 0 or i <= 0:\n return 0\n if j in memo[i]:\n return memo[i][j]\n w, v = WV[i - 1]\n ret = dp(i - 1, j)\n if j - w >= 0:\n ret = max(ret, dp(i - 1, j - w) + v)\n memo[i][j] = ret\n return ret\n\n\nprint((dp(N, W)))\n","code_same":false,"relative_loc_diff_percent":23.5294117647,"diff":["+# \u30e1\u30e2\u5316\u518d\u5e30","-# dp[i][n:\u5165\u308c\u305f\u6570][dW:w1\u304b\u3089\u306e\u5dee\u5206\u306e\u5408\u8a08]","-dp = [[[0] * (3 * N + 1) for _ in [0] * (N + 1)] for _ in [0] * (N + 1)]","-w0 = WV[0][0]","-for i, wv in enumerate(WV, 1):","- w, v = wv","- w -= w0","- for n in range(1, i + 1):","- for dW in range(3 * N + 1):","- if n * w0 + dW > W:","- break","- if w > dW:","- dp[i][n][dW] = dp[i - 1][n][dW]","- continue","- dp[i][n][dW] = max(dp[i - 1][n][dW], dp[i - 1][n - 1][dW - w] + v)","-print((max(max(row) for row in dp[-1])))","+memo = [{} for _ in [0] * (N + 1)]","+","+","+def dp(i, j):","+ if j <= 0 or i <= 0:","+ return 0","+ if j in memo[i]:","+ return memo[i][j]","+ w, v = WV[i - 1]","+ ret = dp(i - 1, j)","+ if j - w >= 0:","+ ret = max(ret, dp(i - 1, j - w) + v)","+ memo[i][j] = ret","+ return ret","+","+","+print((dp(N, W)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0788831711,"measured_runtime_v1":0.0416521072,"runtime_lift":1.8938578692,"key":["s828773422","s537616925"]} +{"user_id":"u379142263","problem_id":"p02631","language":"python","submission_id_v0":"s745944372","submission_id_v1":"s959186876","cpu_time_v0":183,"cpu_time_v1":154,"memory_v0":31996,"memory_v1":32024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.85,"input":"import sys\n\nimport itertools\n\nsys.setrecursionlimit(1000000000)\n\nfrom heapq import heapify,heappop,heappush,heappushpop\n\nimport math\n\nimport collections\n\nimport copy\n\n\n\n\n\nif __name__ == \"__main__\":\n\n n = int(eval(input()))\n\n a = list(map(int,input().split()))\n\n b = a[0]\n\n for i in range(1,n):\n\n b = b^a[i]\n\n for i in range(n):\n\n print((a[i]^b))","target":"import sys\n\nimport itertools\n\nsys.setrecursionlimit(1000000000)\n\nfrom heapq import heapify,heappop,heappush,heappushpop\n\nimport math\n\nimport collections\n\nimport copy\n\n\n\ndef main():\n\n n = int(eval(input()))\n\n a = list(map(int,input().split()))\n\n b = a[0]\n\n for i in range(1,n):\n\n b = b^a[i]\n\n ans = []\n\n for i in range(n):\n\n ans.append(b^a[i])\n\n print((*ans))\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":17,"code_v1_loc":20,"code_v0_num_chars":366,"code_v1_num_chars":425,"code_v0_no_empty_lines":"import sys\nimport itertools\n\nsys.setrecursionlimit(1000000000)\nfrom heapq import heapify, heappop, heappush, heappushpop\nimport math\nimport collections\nimport copy\n\nif __name__ == \"__main__\":\n n = int(eval(input()))\n a = list(map(int, input().split()))\n b = a[0]\n for i in range(1, n):\n b = b ^ a[i]\n for i in range(n):\n print((a[i] ^ b))\n","code_v1_no_empty_lines":"import sys\nimport itertools\n\nsys.setrecursionlimit(1000000000)\nfrom heapq import heapify, heappop, heappush, heappushpop\nimport math\nimport collections\nimport copy\n\n\ndef main():\n n = int(eval(input()))\n a = list(map(int, input().split()))\n b = a[0]\n for i in range(1, n):\n b = b ^ a[i]\n ans = []\n for i in range(n):\n ans.append(b ^ a[i])\n print((*ans))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-if __name__ == \"__main__\":","+","+def main():","+ ans = []","- print((a[i] ^ b))","+ ans.append(b ^ a[i])","+ print((*ans))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0358955681,"measured_runtime_v1":0.075813355,"runtime_lift":0.473472888,"key":["s745944372","s959186876"]} +{"user_id":"u393253137","problem_id":"p03273","language":"python","submission_id_v0":"s378585744","submission_id_v1":"s552860260","cpu_time_v0":33,"cpu_time_v1":18,"memory_v0":4468,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.45,"input":"h,w=map(int,input().split())\n\nM=list(input() for _ in range(h))\n\nc=[]\n\nfor i in range(h):\n\n if \"#\" not in M[i]:\n\n c.append(i)\n\nfor dot in c[::-1]:\n\n M.pop(dot)\n\n\n\nc=[]\n\ncol=[]\n\nfor i in range(len(M[0])):\n\n flag=1\n\n for j in range(len(M)):\n\n if \"#\" in M[j][i]:flag=0\n\n if flag==1:c.append(i)\n\n\n\nfor i in c[::-1]:\n\n for row in M:\n\n list(row).pop(i)\n\nfor i in range(len(M)):\n\n flag=0\n\n for j in range(len(M[0])):\n\n if j not in c:\n\n print(*M[i][j],end=\"\")\n\n flag=1\n\n if i 0:\n\n s = max(s, self.tree[i])\n\n i -= i & -i\n\n return s\n\n\n\n def add(self, i, x):\n\n while i <= self.size:\n\n self.tree[i] = max(self.tree[i], x)\n\n i += i & -i\n\n\n\n\n\nclass MinBit:\n\n def __init__(self, n):\n\n self.size = n\n\n self.tree = [n-1] * (n + 1)\n\n\n\n def sum(self, i):\n\n s = self.size-1\n\n while i > 0:\n\n s = min(s, self.tree[i])\n\n i -= i & -i\n\n return s\n\n\n\n def add(self, i, x):\n\n while i <= self.size:\n\n self.tree[i] = min(self.tree[i], x)\n\n i += i & -i\n\n\n\n\n\ndef solve(N: int, P: \"List[int]\"):\n\n\n\n prev = MaxBit(N+2)\n\n foll = MinBit(N+2)\n\n seq = [0]*(N+2)\n\n\n\n inv = {p: i for i, p in enumerate(P)}\n\n # print(inv)\n\n # c = Counter()\n\n\n\n ans = 0\n\n for i in range(N, 0, -1):\n\n prev.add(inv[i]+2, inv[i]+1)\n\n foll.add(N-inv[i]+1, inv[i]+1)\n\n seq[inv[i]+1] = i\n\n\n\n # print(\"\")\n\n # print(\"{}\u756a\u76ee\u306b{}\u3092\u8ffd\u52a0\".format(inv[i]+1, i))\n\n # print(\"seq : \", seq)\n\n # print(\"prev: \", [prev.sum(j) for j in range(N+2)])\n\n # print(\"foll: \", [foll.sum(j) for j in range(N+2)][::-1])\n\n p = prev.sum(inv[i]+1)\n\n pp = prev.sum(p)\n\n f = foll.sum(N-inv[i])\n\n ff = foll.sum(N-f+1)\n\n # \u524d\u306e\u6570\u5b57\u3068\u306e\u7d44\u307f\u5408\u308f\u305b\n\n if p > 0:\n\n # (\u524d\u3001\u4eca) \u524d\u306b\u4f38\u3070\u3059 * \u5f8c\u308d\u306b\u4f38\u3070\u3059\n\n ans += i*(p-pp)*(f-(inv[i]+1))\n\n # print(\"+ (A): \", i*(p-pp)*(f-(inv[i]+1)))\n\n # c[i] += (p - pp) * (f - (inv[i]+1))\n\n # \u5f8c\u308d\u306e\u6570\u5b57\u3068\u306e\u7d44\u307f\u5408\u308f\u305b\n\n if f < N+1:\n\n # (\u4eca\u3001\u5f8c) \u524d\u306b\u4f38\u3070\u3059 * \u5f8c\u306b\u4f38\u3070\u3059\n\n ans += i*(inv[i]+1 - p) * (ff - f)\n\n # print(\"+ (B): \", i*(inv[i]+1 - p)*(ff-f))\n\n # c[i] += (ff - f) * ((inv[i]+1) - p)\n\n print(ans)\n\n # print([(i+1, c[i+1]) for i in range(N)])\n\n\n\n # guchoku = Counter()\n\n # for i in range(N):\n\n # for j in range(i+1, N):\n\n # guchoku[sorted(P[i:j+1])[-2]] += 1\n\n # print(sorted(P[i:j+1])[-2], P[i:j+1])\n\n # print([(i+1, guchoku[i+1]) for i in range(N)])\n\n return\n\n\n\n\n\ndef main():\n\n\n\n def iterate_tokens():\n\n for line in sys.stdin:\n\n for word in line.split():\n\n yield word\n\n tokens = iterate_tokens()\n\n N = int(next(tokens)) # type: int\n\n P = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n\n solve(N, P)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"N = int(eval(input()))\n\nP = list(map(int, input().split()))\n\n\n\npos = {}\n\nfor i, p in enumerate(P):\n\n pos[p] = i+1\n\n\n\nfoll = [i+1 for i in range(N+1)]+[N+1]\n\nprev = [0]+[i for i in range(N+1)]\n\n\n\nans = 0\n\nfor i in range(1, N+1):\n\n curr = pos[i]\n\n r = foll[curr]\n\n rr = foll[r]\n\n l = prev[curr]\n\n ll = prev[l]\n\n ans += (l-ll)*(r-curr)*i\n\n ans += (rr-r)*(curr-l)*i\n\n\n\n foll[l] = foll[curr]\n\n prev[r] = prev[curr]\n\n # print(*foll)\n\n # print(*prev)\n\nprint(ans)\n","code_v0_loc":105,"code_v1_loc":25,"code_v0_num_chars":2700,"code_v1_num_chars":480,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\nimport sys\n\n# from collections import Counter\nINF = float(\"inf\")\n\n\nclass MaxBit:\n def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n\n def sum(self, i):\n s = 0\n while i > 0:\n s = max(s, self.tree[i])\n i -= i & -i\n return s\n\n def add(self, i, x):\n while i <= self.size:\n self.tree[i] = max(self.tree[i], x)\n i += i & -i\n\n\nclass MinBit:\n def __init__(self, n):\n self.size = n\n self.tree = [n - 1] * (n + 1)\n\n def sum(self, i):\n s = self.size - 1\n while i > 0:\n s = min(s, self.tree[i])\n i -= i & -i\n return s\n\n def add(self, i, x):\n while i <= self.size:\n self.tree[i] = min(self.tree[i], x)\n i += i & -i\n\n\ndef solve(N: int, P: \"List[int]\"):\n prev = MaxBit(N + 2)\n foll = MinBit(N + 2)\n seq = [0] * (N + 2)\n inv = {p: i for i, p in enumerate(P)}\n # print(inv)\n # c = Counter()\n ans = 0\n for i in range(N, 0, -1):\n prev.add(inv[i] + 2, inv[i] + 1)\n foll.add(N - inv[i] + 1, inv[i] + 1)\n seq[inv[i] + 1] = i\n # print(\"\")\n # print(\"{}\u756a\u76ee\u306b{}\u3092\u8ffd\u52a0\".format(inv[i]+1, i))\n # print(\"seq : \", seq)\n # print(\"prev: \", [prev.sum(j) for j in range(N+2)])\n # print(\"foll: \", [foll.sum(j) for j in range(N+2)][::-1])\n p = prev.sum(inv[i] + 1)\n pp = prev.sum(p)\n f = foll.sum(N - inv[i])\n ff = foll.sum(N - f + 1)\n # \u524d\u306e\u6570\u5b57\u3068\u306e\u7d44\u307f\u5408\u308f\u305b\n if p > 0:\n # (\u524d\u3001\u4eca) \u524d\u306b\u4f38\u3070\u3059 * \u5f8c\u308d\u306b\u4f38\u3070\u3059\n ans += i * (p - pp) * (f - (inv[i] + 1))\n # print(\"+ (A): \", i*(p-pp)*(f-(inv[i]+1)))\n # c[i] += (p - pp) * (f - (inv[i]+1))\n # \u5f8c\u308d\u306e\u6570\u5b57\u3068\u306e\u7d44\u307f\u5408\u308f\u305b\n if f < N + 1:\n # (\u4eca\u3001\u5f8c) \u524d\u306b\u4f38\u3070\u3059 * \u5f8c\u306b\u4f38\u3070\u3059\n ans += i * (inv[i] + 1 - p) * (ff - f)\n # print(\"+ (B): \", i*(inv[i]+1 - p)*(ff-f))\n # c[i] += (ff - f) * ((inv[i]+1) - p)\n print(ans)\n # print([(i+1, c[i+1]) for i in range(N)])\n # guchoku = Counter()\n # for i in range(N):\n # for j in range(i+1, N):\n # guchoku[sorted(P[i:j+1])[-2]] += 1\n # print(sorted(P[i:j+1])[-2], P[i:j+1])\n # print([(i+1, guchoku[i+1]) for i in range(N)])\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n P = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, P)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"N = int(eval(input()))\nP = list(map(int, input().split()))\npos = {}\nfor i, p in enumerate(P):\n pos[p] = i + 1\nfoll = [i + 1 for i in range(N + 1)] + [N + 1]\nprev = [0] + [i for i in range(N + 1)]\nans = 0\nfor i in range(1, N + 1):\n curr = pos[i]\n r = foll[curr]\n rr = foll[r]\n l = prev[curr]\n ll = prev[l]\n ans += (l - ll) * (r - curr) * i\n ans += (rr - r) * (curr - l) * i\n foll[l] = foll[curr]\n prev[r] = prev[curr]\n # print(*foll)\n # print(*prev)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":76.1904761905,"diff":["-#!\/usr\/bin\/env python3","-import sys","-","-# from collections import Counter","-INF = float(\"inf\")","-","-","-class MaxBit:","- def __init__(self, n):","- self.size = n","- self.tree = [0] * (n + 1)","-","- def sum(self, i):","- s = 0","- while i > 0:","- s = max(s, self.tree[i])","- i -= i & -i","- return s","-","- def add(self, i, x):","- while i <= self.size:","- self.tree[i] = max(self.tree[i], x)","- i += i & -i","-","-","-class MinBit:","- def __init__(self, n):","- self.size = n","- self.tree = [n - 1] * (n + 1)","-","- def sum(self, i):","- s = self.size - 1","- while i > 0:","- s = min(s, self.tree[i])","- i -= i & -i","- return s","-","- def add(self, i, x):","- while i <= self.size:","- self.tree[i] = min(self.tree[i], x)","- i += i & -i","-","-","-def solve(N: int, P: \"List[int]\"):","- prev = MaxBit(N + 2)","- foll = MinBit(N + 2)","- seq = [0] * (N + 2)","- inv = {p: i for i, p in enumerate(P)}","- # print(inv)","- # c = Counter()","- ans = 0","- for i in range(N, 0, -1):","- prev.add(inv[i] + 2, inv[i] + 1)","- foll.add(N - inv[i] + 1, inv[i] + 1)","- seq[inv[i] + 1] = i","- # print(\"\")","- # print(\"{}\u756a\u76ee\u306b{}\u3092\u8ffd\u52a0\".format(inv[i]+1, i))","- # print(\"seq : \", seq)","- # print(\"prev: \", [prev.sum(j) for j in range(N+2)])","- # print(\"foll: \", [foll.sum(j) for j in range(N+2)][::-1])","- p = prev.sum(inv[i] + 1)","- pp = prev.sum(p)","- f = foll.sum(N - inv[i])","- ff = foll.sum(N - f + 1)","- # \u524d\u306e\u6570\u5b57\u3068\u306e\u7d44\u307f\u5408\u308f\u305b","- if p > 0:","- # (\u524d\u3001\u4eca) \u524d\u306b\u4f38\u3070\u3059 * \u5f8c\u308d\u306b\u4f38\u3070\u3059","- ans += i * (p - pp) * (f - (inv[i] + 1))","- # print(\"+ (A): \", i*(p-pp)*(f-(inv[i]+1)))","- # c[i] += (p - pp) * (f - (inv[i]+1))","- # \u5f8c\u308d\u306e\u6570\u5b57\u3068\u306e\u7d44\u307f\u5408\u308f\u305b","- if f < N + 1:","- # (\u4eca\u3001\u5f8c) \u524d\u306b\u4f38\u3070\u3059 * \u5f8c\u306b\u4f38\u3070\u3059","- ans += i * (inv[i] + 1 - p) * (ff - f)","- # print(\"+ (B): \", i*(inv[i]+1 - p)*(ff-f))","- # c[i] += (ff - f) * ((inv[i]+1) - p)","- print(ans)","- # print([(i+1, c[i+1]) for i in range(N)])","- # guchoku = Counter()","- # for i in range(N):","- # for j in range(i+1, N):","- # guchoku[sorted(P[i:j+1])[-2]] += 1","- # print(sorted(P[i:j+1])[-2], P[i:j+1])","- # print([(i+1, guchoku[i+1]) for i in range(N)])","- return","-","-","-def main():","- def iterate_tokens():","- for line in sys.stdin:","- for word in line.split():","- yield word","-","- tokens = iterate_tokens()","- N = int(next(tokens)) # type: int","- P = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"","- solve(N, P)","-","-","-if __name__ == \"__main__\":","- main()","+N = int(eval(input()))","+P = list(map(int, input().split()))","+pos = {}","+for i, p in enumerate(P):","+ pos[p] = i + 1","+foll = [i + 1 for i in range(N + 1)] + [N + 1]","+prev = [0] + [i for i in range(N + 1)]","+ans = 0","+for i in range(1, N + 1):","+ curr = pos[i]","+ r = foll[curr]","+ rr = foll[r]","+ l = prev[curr]","+ ll = prev[l]","+ ans += (l - ll) * (r - curr) * i","+ ans += (rr - r) * (curr - l) * i","+ foll[l] = foll[curr]","+ prev[r] = prev[curr]","+ # print(*foll)","+ # print(*prev)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0436410312,"measured_runtime_v1":0.0427167411,"runtime_lift":1.0216376556,"key":["s407632595","s356854712"]} +{"user_id":"u392319141","problem_id":"p02720","language":"python","submission_id_v0":"s286651000","submission_id_v1":"s850780120","cpu_time_v0":812,"cpu_time_v1":222,"memory_v0":25940,"memory_v1":17012,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":72.66,"input":"from heapq import heappop, heappush, heapify\n\nK = int(eval(input()))\n\nM = K\n\n\n\nque = list(range(1, 10))\n\nV = set()\n\nheapify(que)\n\n\n\nwhile M + 100 >= 0:\n\n top = heappop(que)\n\n if top in V:\n\n continue\n\n V.add(top)\n\n M -= 1\n\n\n\n top = str(top)\n\n L = int(top[0])\n\n R = int(top[-1])\n\n\n\n for i in (L - 1, L, L + 1):\n\n if 1 <= i <= 9:\n\n heappush(que, int(str(i) + top))\n\n for i in (R - 1, R, R + 1):\n\n if 0 <= i <= 9:\n\n heappush(que, int(top + str(i)))\n\n\n\nV = [int(d) for d in V]\n\nV.sort()\n\nprint((V[K - 1]))\n","target":"from collections import deque\n\nK = int(eval(input()))\n\n\n\nque = deque(list(map(str, list(range(1, 10)))))\n\nwhile K > 1:\n\n n = que.popleft()\n\n K -= 1\n\n R = int(n[-1])\n\n for r in (R - 1, R, R + 1):\n\n if 0 <= r <= 9:\n\n que.append(n + str(r))\n\n\n\nprint((que[0]))\n","code_v0_loc":29,"code_v1_loc":13,"code_v0_num_chars":563,"code_v1_num_chars":267,"code_v0_no_empty_lines":"from heapq import heappop, heappush, heapify\n\nK = int(eval(input()))\nM = K\nque = list(range(1, 10))\nV = set()\nheapify(que)\nwhile M + 100 >= 0:\n top = heappop(que)\n if top in V:\n continue\n V.add(top)\n M -= 1\n top = str(top)\n L = int(top[0])\n R = int(top[-1])\n for i in (L - 1, L, L + 1):\n if 1 <= i <= 9:\n heappush(que, int(str(i) + top))\n for i in (R - 1, R, R + 1):\n if 0 <= i <= 9:\n heappush(que, int(top + str(i)))\nV = [int(d) for d in V]\nV.sort()\nprint((V[K - 1]))\n","code_v1_no_empty_lines":"from collections import deque\n\nK = int(eval(input()))\nque = deque(list(map(str, list(range(1, 10)))))\nwhile K > 1:\n n = que.popleft()\n K -= 1\n R = int(n[-1])\n for r in (R - 1, R, R + 1):\n if 0 <= r <= 9:\n que.append(n + str(r))\nprint((que[0]))\n","code_same":false,"relative_loc_diff_percent":55.1724137931,"diff":["-from heapq import heappop, heappush, heapify","+from collections import deque","-M = K","-que = list(range(1, 10))","-V = set()","-heapify(que)","-while M + 100 >= 0:","- top = heappop(que)","- if top in V:","- continue","- V.add(top)","- M -= 1","- top = str(top)","- L = int(top[0])","- R = int(top[-1])","- for i in (L - 1, L, L + 1):","- if 1 <= i <= 9:","- heappush(que, int(str(i) + top))","- for i in (R - 1, R, R + 1):","- if 0 <= i <= 9:","- heappush(que, int(top + str(i)))","-V = [int(d) for d in V]","-V.sort()","-print((V[K - 1]))","+que = deque(list(map(str, list(range(1, 10)))))","+while K > 1:","+ n = que.popleft()","+ K -= 1","+ R = int(n[-1])","+ for r in (R - 1, R, R + 1):","+ if 0 <= r <= 9:","+ que.append(n + str(r))","+print((que[0]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1158699698,"measured_runtime_v1":0.0541008387,"runtime_lift":2.1417407325,"key":["s286651000","s850780120"]} +{"user_id":"u790710233","problem_id":"p03283","language":"python","submission_id_v0":"s530240188","submission_id_v1":"s939461646","cpu_time_v0":2624,"cpu_time_v1":1646,"memory_v0":22428,"memory_v1":26252,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.27,"input":"import numpy as np\n\nn, m, q = list(map(int, input().split()))\n\ncnt = [[0]*(n+1)for _ in range(n+1)]\n\nfor _ in range(m):\n\n L, R = list(map(int, input().split()))\n\n cnt[L][R] += 1\n\n\n\nS = np.cumsum(cnt, axis=0).cumsum(axis=1)\n\n\n\nfor _ in range(q):\n\n L, R = list(map(int, input().split()))\n\n ans = S[R][R]-S[R][L-1]-S[L-1][R]+S[L-1][L-1]\n\n print(ans)\n","target":"import numpy as np\n\nn, m, q = list(map(int, input().split()))\n\ncnt = [[0]*(n+1)for _ in range(n+1)]\n\nfor _ in range(m):\n\n L, R = list(map(int, input().split()))\n\n cnt[L][R] += 1\n\n\n\nS = np.cumsum(cnt, axis=0).cumsum(axis=1).tolist()\n\n\n\nfor _ in range(q):\n\n L, R = list(map(int, input().split()))\n\n ans = S[R][R]-S[R][L-1]-S[L-1][R]+S[L-1][L-1]\n\n print(ans)","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":344,"code_v1_num_chars":352,"code_v0_no_empty_lines":"import numpy as np\n\nn, m, q = list(map(int, input().split()))\ncnt = [[0] * (n + 1) for _ in range(n + 1)]\nfor _ in range(m):\n L, R = list(map(int, input().split()))\n cnt[L][R] += 1\nS = np.cumsum(cnt, axis=0).cumsum(axis=1)\nfor _ in range(q):\n L, R = list(map(int, input().split()))\n ans = S[R][R] - S[R][L - 1] - S[L - 1][R] + S[L - 1][L - 1]\n print(ans)\n","code_v1_no_empty_lines":"import numpy as np\n\nn, m, q = list(map(int, input().split()))\ncnt = [[0] * (n + 1) for _ in range(n + 1)]\nfor _ in range(m):\n L, R = list(map(int, input().split()))\n cnt[L][R] += 1\nS = np.cumsum(cnt, axis=0).cumsum(axis=1).tolist()\nfor _ in range(q):\n L, R = list(map(int, input().split()))\n ans = S[R][R] - S[R][L - 1] - S[L - 1][R] + S[L - 1][L - 1]\n print(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-S = np.cumsum(cnt, axis=0).cumsum(axis=1)","+S = np.cumsum(cnt, axis=0).cumsum(axis=1).tolist()"],"diff_only_import_comment":false,"measured_runtime_v0":0.2906143358,"measured_runtime_v1":0.383709517,"runtime_lift":0.7573810992,"key":["s530240188","s939461646"]} +{"user_id":"u790012205","problem_id":"p02796","language":"python","submission_id_v0":"s214908389","submission_id_v1":"s934885642","cpu_time_v0":756,"cpu_time_v1":576,"memory_v0":41416,"memory_v1":41652,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.81,"input":"N = int(eval(input()))\n\nR = sorted([list(map(int, input().split())) for i in range(N)])\n\nT = []\n\nfor i in range(N):\n\n T.append([R[i][0] + R[i][1], R[i][0] - R[i][1]])\n\nT.sort(reverse=True)\n\nwhile len(T) - 1 > 0:\n\n t = T.pop()\n\n i = 1\n\n while len(T) and t[0] > T[-1][1]:\n\n N -= 1\n\n i += 1\n\n T.pop()\n\nprint(N)","target":"N = int(eval(input()))\n\nXL = [list(map(int, input().split())) for _ in range(N)]\n\nA = []\n\nfor x, l in XL:\n\n A.append([x + l, x - l])\n\nA.sort()\n\nB = []\n\ni = 0\n\nwhile True:\n\n B.append(A[i])\n\n if i == N - 1:\n\n break\n\n j = 1\n\n while True:\n\n if A[i][0] > A[i + j][1]:\n\n j += 1\n\n if i + j == N:\n\n break\n\n continue\n\n else:\n\n break\n\n if i + j == N:\n\n break\n\n i = i + j\n\nprint((len(B)))","code_v0_loc":14,"code_v1_loc":25,"code_v0_num_chars":334,"code_v1_num_chars":477,"code_v0_no_empty_lines":"N = int(eval(input()))\nR = sorted([list(map(int, input().split())) for i in range(N)])\nT = []\nfor i in range(N):\n T.append([R[i][0] + R[i][1], R[i][0] - R[i][1]])\nT.sort(reverse=True)\nwhile len(T) - 1 > 0:\n t = T.pop()\n i = 1\n while len(T) and t[0] > T[-1][1]:\n N -= 1\n i += 1\n T.pop()\nprint(N)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nXL = [list(map(int, input().split())) for _ in range(N)]\nA = []\nfor x, l in XL:\n A.append([x + l, x - l])\nA.sort()\nB = []\ni = 0\nwhile True:\n B.append(A[i])\n if i == N - 1:\n break\n j = 1\n while True:\n if A[i][0] > A[i + j][1]:\n j += 1\n if i + j == N:\n break\n continue\n else:\n break\n if i + j == N:\n break\n i = i + j\nprint((len(B)))\n","code_same":false,"relative_loc_diff_percent":44.0,"diff":["-R = sorted([list(map(int, input().split())) for i in range(N)])","-T = []","-for i in range(N):","- T.append([R[i][0] + R[i][1], R[i][0] - R[i][1]])","-T.sort(reverse=True)","-while len(T) - 1 > 0:","- t = T.pop()","- i = 1","- while len(T) and t[0] > T[-1][1]:","- N -= 1","- i += 1","- T.pop()","-print(N)","+XL = [list(map(int, input().split())) for _ in range(N)]","+A = []","+for x, l in XL:","+ A.append([x + l, x - l])","+A.sort()","+B = []","+i = 0","+while True:","+ B.append(A[i])","+ if i == N - 1:","+ break","+ j = 1","+ while True:","+ if A[i][0] > A[i + j][1]:","+ j += 1","+ if i + j == N:","+ break","+ continue","+ else:","+ break","+ if i + j == N:","+ break","+ i = i + j","+print((len(B)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0367033801,"measured_runtime_v1":0.0363281512,"runtime_lift":1.0103288733,"key":["s214908389","s934885642"]} +{"user_id":"u602740328","problem_id":"p03378","language":"python","submission_id_v0":"s580952173","submission_id_v1":"s292785556","cpu_time_v0":17,"cpu_time_v1":11,"memory_v0":3060,"memory_v1":2820,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.29,"input":"N, M, X = list(map(int, input().split(\" \")))\n\nA = list(map(int, input().split(\" \")))\n\nleft, right = 0,0\n\nfor ai in A:\n\n if ai < X: left+=1\n\n else: right+=1\n\nprint((min(right, left)))","target":"N, M, X = list(map(int, input().split(\" \")))\n\nA = list(map(int, input().split(\" \")))\n\nr = len([ai for ai in A if ai < X])\n\nl = len([ai for ai in A if ai > X])\n\nprint((min((r,l))))","code_v0_loc":7,"code_v1_loc":5,"code_v0_num_chars":170,"code_v1_num_chars":173,"code_v0_no_empty_lines":"N, M, X = list(map(int, input().split(\" \")))\nA = list(map(int, input().split(\" \")))\nleft, right = 0, 0\nfor ai in A:\n if ai < X:\n left += 1\n else:\n right += 1\nprint((min(right, left)))\n","code_v1_no_empty_lines":"N, M, X = list(map(int, input().split(\" \")))\nA = list(map(int, input().split(\" \")))\nr = len([ai for ai in A if ai < X])\nl = len([ai for ai in A if ai > X])\nprint((min((r, l))))\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-left, right = 0, 0","-for ai in A:","- if ai < X:","- left += 1","- else:","- right += 1","-print((min(right, left)))","+r = len([ai for ai in A if ai < X])","+l = len([ai for ai in A if ai > X])","+print((min((r, l))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450485706,"measured_runtime_v1":0.0456194401,"runtime_lift":0.9874862678,"key":["s580952173","s292785556"]} +{"user_id":"u011621222","problem_id":"p00029","language":"python","submission_id_v0":"s136888325","submission_id_v1":"s115964187","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":7340,"memory_v1":6352,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"x=input().split()\n\nlongestWord= \"\"\n\nmostWord=0\n\ncurrentCount=0\n\nTHEmostWord=\"\"\n\n\n\n\n\nfor r in range (len(x)):\n\n if len(x[r])> len(longestWord):\n\n longestWord=x[r]\n\n\n\nfor j in range (len(x)):\n\n thing= x[j]\n\n currentCount=x.count(thing)\n\n if currentCount > mostWord:\n\n mostWord= currentCount\n\n THEmostWord=thing\n\n \n\n\n\n\n\nprint((THEmostWord, longestWord))","target":"a=input().split()\n\ndawa=''\n\nd={}\n\nfor w in a:\n\n\tif len(w)>len(dawa): dawa=w\n\n\td[a.count(w)]=w\n\nm=max(d.keys())\n\nakeh=d.get(m)\n\nprint('%s %s' % (akeh,dawa))","code_v0_loc":21,"code_v1_loc":9,"code_v0_num_chars":388,"code_v1_num_chars":158,"code_v0_no_empty_lines":"x = input().split()\nlongestWord = \"\"\nmostWord = 0\ncurrentCount = 0\nTHEmostWord = \"\"\nfor r in range(len(x)):\n if len(x[r]) > len(longestWord):\n longestWord = x[r]\nfor j in range(len(x)):\n thing = x[j]\n currentCount = x.count(thing)\n if currentCount > mostWord:\n mostWord = currentCount\n THEmostWord = thing\nprint((THEmostWord, longestWord))\n","code_v1_no_empty_lines":"a = input().split()\ndawa = \"\"\nd = {}\nfor w in a:\n if len(w) > len(dawa):\n dawa = w\n d[a.count(w)] = w\nm = max(d.keys())\nakeh = d.get(m)\nprint(\"%s %s\" % (akeh, dawa))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-x = input().split()","-longestWord = \"\"","-mostWord = 0","-currentCount = 0","-THEmostWord = \"\"","-for r in range(len(x)):","- if len(x[r]) > len(longestWord):","- longestWord = x[r]","-for j in range(len(x)):","- thing = x[j]","- currentCount = x.count(thing)","- if currentCount > mostWord:","- mostWord = currentCount","- THEmostWord = thing","-print((THEmostWord, longestWord))","+a = input().split()","+dawa = \"\"","+d = {}","+for w in a:","+ if len(w) > len(dawa):","+ dawa = w","+ d[a.count(w)] = w","+m = max(d.keys())","+akeh = d.get(m)","+print(\"%s %s\" % (akeh, dawa))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0465321267,"measured_runtime_v1":0.0460925236,"runtime_lift":1.0095374053,"key":["s136888325","s115964187"]} +{"user_id":"u539367121","problem_id":"p02861","language":"python","submission_id_v0":"s410150506","submission_id_v1":"s543176023","cpu_time_v0":310,"cpu_time_v1":28,"memory_v0":9108,"memory_v1":9416,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.97,"input":"import math\n\nimport itertools\n\n\n\nn=int(eval(input()))\n\nd=[list(map(int,input().split())) for _ in range(n)]\n\n\n\nans=cnt=0\n\nfor i in itertools.permutations([_ for _ in range(n)]):\n\n for j in range(n-1):\n\n x1,x2=d[i[j]][0],d[i[j+1]][0]\n\n y1,y2=d[i[j]][1],d[i[j+1]][1]\n\n ans+=math.sqrt((x1-x2)**2+(y1-y2)**2)\n\n cnt+=1\n\n #print(j,ans,cnt)\n\nprint((ans\/cnt))","target":"n=int(eval(input()))\n\nd=[list(map(int,input().split())) for _ in range(n)]\n\n\n\nans=cnt=0\n\nfor i in range(n):\n\n for j in range(i+1,n):\n\n ans+=((d[i][0]-d[j][0])**2+(d[i][1]-d[j][1])**2)**0.5\n\nprint((2*ans\/n))","code_v0_loc":15,"code_v1_loc":8,"code_v0_num_chars":355,"code_v1_num_chars":202,"code_v0_no_empty_lines":"import math\nimport itertools\n\nn = int(eval(input()))\nd = [list(map(int, input().split())) for _ in range(n)]\nans = cnt = 0\nfor i in itertools.permutations([_ for _ in range(n)]):\n for j in range(n - 1):\n x1, x2 = d[i[j]][0], d[i[j + 1]][0]\n y1, y2 = d[i[j]][1], d[i[j + 1]][1]\n ans += math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)\n cnt += 1\n # print(j,ans,cnt)\nprint((ans \/ cnt))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nd = [list(map(int, input().split())) for _ in range(n)]\nans = cnt = 0\nfor i in range(n):\n for j in range(i + 1, n):\n ans += ((d[i][0] - d[j][0]) ** 2 + (d[i][1] - d[j][1]) ** 2) ** 0.5\nprint((2 * ans \/ n))\n","code_same":false,"relative_loc_diff_percent":46.6666666667,"diff":["-import math","-import itertools","-","-for i in itertools.permutations([_ for _ in range(n)]):","- for j in range(n - 1):","- x1, x2 = d[i[j]][0], d[i[j + 1]][0]","- y1, y2 = d[i[j]][1], d[i[j + 1]][1]","- ans += math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)","- cnt += 1","- # print(j,ans,cnt)","-print((ans \/ cnt))","+for i in range(n):","+ for j in range(i + 1, n):","+ ans += ((d[i][0] - d[j][0]) ** 2 + (d[i][1] - d[j][1]) ** 2) ** 0.5","+print((2 * ans \/ n))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0879781723,"measured_runtime_v1":0.0395608902,"runtime_lift":2.2238673559,"key":["s410150506","s543176023"]} +{"user_id":"u562935282","problem_id":"p03854","language":"python","submission_id_v0":"s711147479","submission_id_v1":"s201008156","cpu_time_v0":80,"cpu_time_v1":53,"memory_v0":3316,"memory_v1":35624,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.75,"input":"def main():\n\n s = eval(input())\n\n\n\n st = [s]\n\n while st:\n\n x = st.pop()\n\n if x == '':\n\n print('YES')\n\n return\n\n\n\n for w in ('dream', 'dreamer', 'erase', 'eraser'):\n\n if x.endswith(w):\n\n st.append(x[:-len(w)])\n\n\n\n print('NO')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n from functools import lru_cache\n\n import sys\n\n sys.setrecursionlimit(10 ** 7)\n\n\n\n WORDS = 'dream', 'dreamer', 'erase', 'eraser'\n\n\n\n S = eval(input())\n\n N = len(S)\n\n\n\n @lru_cache(maxsize=None)\n\n def dfs(cur=N):\n\n if cur == 0:\n\n return True\n\n\n\n for word in WORDS:\n\n if S[cur - len(word):cur] == word:\n\n if dfs(cur - len(word)):\n\n return True\n\n\n\n return False\n\n\n\n cond = dfs()\n\n print(('YES' if cond else 'NO'))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":19,"code_v1_loc":28,"code_v0_num_chars":344,"code_v1_num_chars":566,"code_v0_no_empty_lines":"def main():\n s = eval(input())\n st = [s]\n while st:\n x = st.pop()\n if x == \"\":\n print(\"YES\")\n return\n for w in (\"dream\", \"dreamer\", \"erase\", \"eraser\"):\n if x.endswith(w):\n st.append(x[: -len(w)])\n print(\"NO\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n from functools import lru_cache\n import sys\n\n sys.setrecursionlimit(10**7)\n WORDS = \"dream\", \"dreamer\", \"erase\", \"eraser\"\n S = eval(input())\n N = len(S)\n\n @lru_cache(maxsize=None)\n def dfs(cur=N):\n if cur == 0:\n return True\n for word in WORDS:\n if S[cur - len(word) : cur] == word:\n if dfs(cur - len(word)):\n return True\n return False\n\n cond = dfs()\n print((\"YES\" if cond else \"NO\"))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":32.1428571429,"diff":["- s = eval(input())","- st = [s]","- while st:","- x = st.pop()","- if x == \"\":","- print(\"YES\")","- return","- for w in (\"dream\", \"dreamer\", \"erase\", \"eraser\"):","- if x.endswith(w):","- st.append(x[: -len(w)])","- print(\"NO\")","+ from functools import lru_cache","+ import sys","+","+ sys.setrecursionlimit(10**7)","+ WORDS = \"dream\", \"dreamer\", \"erase\", \"eraser\"","+ S = eval(input())","+ N = len(S)","+","+ @lru_cache(maxsize=None)","+ def dfs(cur=N):","+ if cur == 0:","+ return True","+ for word in WORDS:","+ if S[cur - len(word) : cur] == word:","+ if dfs(cur - len(word)):","+ return True","+ return False","+","+ cond = dfs()","+ print((\"YES\" if cond else \"NO\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.076183372,"measured_runtime_v1":0.0397850959,"runtime_lift":1.9148721455,"key":["s711147479","s201008156"]} +{"user_id":"u992910889","problem_id":"p03634","language":"python","submission_id_v0":"s519582331","submission_id_v1":"s925322010","cpu_time_v0":580,"cpu_time_v1":508,"memory_v0":98772,"memory_v1":77360,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.41,"input":"import sys\n\nfrom collections import deque\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n N = int(eval(input()))\n\n Edge = [[] for _ in range(N)]\n\n for _ in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n Edge[a-1].append((b-1, c))\n\n Edge[b-1].append((a-1, c))\n\n Q, K = list(map(int, input().split()))\n\n q = deque()\n\n Dist = [-1] * N\n\n q.append((K-1, K-1, 0))\n\n while q:\n\n nowN, preN, nD = q.popleft()\n\n if Dist[nowN] == -1:\n\n Dist[nowN] = nD\n\n for e, add in Edge[nowN]:\n\n if e != preN: q.append((e, nowN, nD + add))\n\n Ans = [None] * Q\n\n for i in range(Q):\n\n x, y = list(map(int, input().split()))\n\n Ans[i] = str(Dist[x-1] + Dist[y-1])\n\n print((\"\\n\".join(Ans)))\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()\n","target":"mod = 1000000007\n\neps = 10**-9\n\n\n\n\n\ndef main():\n\n import sys\n\n from collections import deque\n\n input = sys.stdin.buffer.readline\n\n\n\n N = int(eval(input()))\n\n adj = [[] for _ in range(N+1)]\n\n for _ in range(N-1):\n\n a, b, c = list(map(int, input().split()))\n\n adj[a].append((b, c))\n\n adj[b].append((a, c))\n\n Q, root = list(map(int, input().split()))\n\n\n\n que = deque()\n\n que.append(root)\n\n seen = [-1] * (N+1)\n\n seen[root] = 0\n\n par = [0] * (N+1)\n\n child = [[] for _ in range(N+1)]\n\n seq = []\n\n while que:\n\n v = que.popleft()\n\n seq.append(v)\n\n for u, c in adj[v]:\n\n if seen[u] == -1:\n\n seen[u] = seen[v] + c\n\n par[u] = v\n\n child[v].append(u)\n\n que.append(u)\n\n seq.reverse()\n\n\n\n for _ in range(Q):\n\n x, y = list(map(int, input().split()))\n\n print((seen[x] + seen[y]))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":31,"code_v1_loc":42,"code_v0_num_chars":825,"code_v1_num_chars":960,"code_v0_no_empty_lines":"import sys\nfrom collections import deque\n\n\ndef solve():\n input = sys.stdin.readline\n N = int(eval(input()))\n Edge = [[] for _ in range(N)]\n for _ in range(N - 1):\n a, b, c = list(map(int, input().split()))\n Edge[a - 1].append((b - 1, c))\n Edge[b - 1].append((a - 1, c))\n Q, K = list(map(int, input().split()))\n q = deque()\n Dist = [-1] * N\n q.append((K - 1, K - 1, 0))\n while q:\n nowN, preN, nD = q.popleft()\n if Dist[nowN] == -1:\n Dist[nowN] = nD\n for e, add in Edge[nowN]:\n if e != preN:\n q.append((e, nowN, nD + add))\n Ans = [None] * Q\n for i in range(Q):\n x, y = list(map(int, input().split()))\n Ans[i] = str(Dist[x - 1] + Dist[y - 1])\n print((\"\\n\".join(Ans)))\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"mod = 1000000007\neps = 10**-9\n\n\ndef main():\n import sys\n from collections import deque\n\n input = sys.stdin.buffer.readline\n N = int(eval(input()))\n adj = [[] for _ in range(N + 1)]\n for _ in range(N - 1):\n a, b, c = list(map(int, input().split()))\n adj[a].append((b, c))\n adj[b].append((a, c))\n Q, root = list(map(int, input().split()))\n que = deque()\n que.append(root)\n seen = [-1] * (N + 1)\n seen[root] = 0\n par = [0] * (N + 1)\n child = [[] for _ in range(N + 1)]\n seq = []\n while que:\n v = que.popleft()\n seq.append(v)\n for u, c in adj[v]:\n if seen[u] == -1:\n seen[u] = seen[v] + c\n par[u] = v\n child[v].append(u)\n que.append(u)\n seq.reverse()\n for _ in range(Q):\n x, y = list(map(int, input().split()))\n print((seen[x] + seen[y]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":26.1904761905,"diff":["-import sys","-from collections import deque","+mod = 1000000007","+eps = 10**-9","-def solve():","- input = sys.stdin.readline","+def main():","+ import sys","+ from collections import deque","+","+ input = sys.stdin.buffer.readline","- Edge = [[] for _ in range(N)]","+ adj = [[] for _ in range(N + 1)]","- Edge[a - 1].append((b - 1, c))","- Edge[b - 1].append((a - 1, c))","- Q, K = list(map(int, input().split()))","- q = deque()","- Dist = [-1] * N","- q.append((K - 1, K - 1, 0))","- while q:","- nowN, preN, nD = q.popleft()","- if Dist[nowN] == -1:","- Dist[nowN] = nD","- for e, add in Edge[nowN]:","- if e != preN:","- q.append((e, nowN, nD + add))","- Ans = [None] * Q","- for i in range(Q):","+ adj[a].append((b, c))","+ adj[b].append((a, c))","+ Q, root = list(map(int, input().split()))","+ que = deque()","+ que.append(root)","+ seen = [-1] * (N + 1)","+ seen[root] = 0","+ par = [0] * (N + 1)","+ child = [[] for _ in range(N + 1)]","+ seq = []","+ while que:","+ v = que.popleft()","+ seq.append(v)","+ for u, c in adj[v]:","+ if seen[u] == -1:","+ seen[u] = seen[v] + c","+ par[u] = v","+ child[v].append(u)","+ que.append(u)","+ seq.reverse()","+ for _ in range(Q):","- Ans[i] = str(Dist[x - 1] + Dist[y - 1])","- print((\"\\n\".join(Ans)))","- return 0","+ print((seen[x] + seen[y]))","- solve()","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0944904618,"measured_runtime_v1":0.0676542301,"runtime_lift":1.3966674611,"key":["s519582331","s925322010"]} +{"user_id":"u597374218","problem_id":"p02848","language":"python","submission_id_v0":"s597240442","submission_id_v1":"s063147796","cpu_time_v0":30,"cpu_time_v1":27,"memory_v0":9104,"memory_v1":9172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"N=int(eval(input()))\n\nS=eval(input())\n\nprint((\"\".join(chr(65+(ord(s)-65+N)%26) for s in S)))","target":"N=int(eval(input()))\n\nS=eval(input())\n\nprint((bytes((s-65+N)%26+65 for s in S.encode()).decode()))","code_v0_loc":3,"code_v1_loc":3,"code_v0_num_chars":78,"code_v1_num_chars":84,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nprint((\"\".join(chr(65 + (ord(s) - 65 + N) % 26) for s in S)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nprint((bytes((s - 65 + N) % 26 + 65 for s in S.encode()).decode()))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((\"\".join(chr(65 + (ord(s) - 65 + N) % 26) for s in S)))","+print((bytes((s - 65 + N) % 26 + 65 for s in S.encode()).decode()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0379454126,"measured_runtime_v1":0.0420645714,"runtime_lift":0.9020753423,"key":["s597240442","s063147796"]} +{"user_id":"u024807881","problem_id":"p03102","language":"python","submission_id_v0":"s165892199","submission_id_v1":"s812460456","cpu_time_v0":25,"cpu_time_v1":20,"memory_v0":3572,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.0,"input":"from functools import reduce\n\n\n\nn, _, c = list(map(int, input().split()))\n\nbs = tuple(map(int, input().split()))\n\n\n\ncount = 0\n\nfor i in range(n):\n\n if reduce(\n\n lambda x, y: x + y[0] * y[1],\n\n list(zip(bs, list(map(int, input().split())))),\n\n 0,\n\n ) + c > 0:\n\n count += 1\n\n\n\nprint(count)\n","target":"n, _, c = list(map(int, input().split()))\n\nbs = tuple(map(int, input().split()))\n\n\n\ncount = 0\n\nfor _ in range(n):\n\n if sum(x * bs[i] for i, x in enumerate(map(int, input().split()))) + c > 0:\n\n count += 1\n\n\n\nprint(count)\n","code_v0_loc":15,"code_v1_loc":9,"code_v0_num_chars":304,"code_v1_num_chars":225,"code_v0_no_empty_lines":"from functools import reduce\n\nn, _, c = list(map(int, input().split()))\nbs = tuple(map(int, input().split()))\ncount = 0\nfor i in range(n):\n if (\n reduce(\n lambda x, y: x + y[0] * y[1],\n list(zip(bs, list(map(int, input().split())))),\n 0,\n )\n + c\n > 0\n ):\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"n, _, c = list(map(int, input().split()))\nbs = tuple(map(int, input().split()))\ncount = 0\nfor _ in range(n):\n if sum(x * bs[i] for i, x in enumerate(map(int, input().split()))) + c > 0:\n count += 1\nprint(count)\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-from functools import reduce","-","-for i in range(n):","- if (","- reduce(","- lambda x, y: x + y[0] * y[1],","- list(zip(bs, list(map(int, input().split())))),","- 0,","- )","- + c","- > 0","- ):","+for _ in range(n):","+ if sum(x * bs[i] for i, x in enumerate(map(int, input().split()))) + c > 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1007375989,"measured_runtime_v1":0.0387005715,"runtime_lift":2.6030002883,"key":["s165892199","s812460456"]} +{"user_id":"u014333473","problem_id":"p03759","language":"python","submission_id_v0":"s104241444","submission_id_v1":"s151176899","cpu_time_v0":31,"cpu_time_v1":25,"memory_v0":9140,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.35,"input":"a,b,c=list(map(int,input().split()));print((['NO','YES'][b-a==c-b]))","target":"a,b,c=list(map(int,input().split()));print(('YNEOS'[b-a!=c-b::2]))","code_v0_loc":1,"code_v1_loc":1,"code_v0_num_chars":60,"code_v1_num_chars":58,"code_v0_no_empty_lines":"a, b, c = list(map(int, input().split()))\nprint(([\"NO\", \"YES\"][b - a == c - b]))\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nprint((\"YNEOS\"[b - a != c - b :: 2]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print(([\"NO\", \"YES\"][b - a == c - b]))","+print((\"YNEOS\"[b - a != c - b :: 2]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0365421779,"measured_runtime_v1":0.0443790112,"runtime_lift":0.8234112694,"key":["s104241444","s151176899"]} +{"user_id":"u617515020","problem_id":"p03031","language":"python","submission_id_v0":"s620076963","submission_id_v1":"s110986143","cpu_time_v0":57,"cpu_time_v1":46,"memory_v0":9084,"memory_v1":9212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.3,"input":"N,M=list(map(int,input().split()))\n\nS=[list(map(int,input().split())) for _ in range(M)]\n\nP=list(map(int,input().split()))\n\n\n\nans=0\n\nfor i in range(1<>(S[j][k]-1))&1:\n\n cnt+=1\n\n else:\n\n flag=0\n\n if cnt%2==P[j]:\n\n sw[j]=True\n\n if all(sw):\n\n ans+=1\n\nprint(ans)","target":"N,M=list(map(int,input().split()))\n\nKS=[list(map(int,input().split())) for _ in range(M)]\n\np=list(map(int,input().split()))\n\nans=0\n\nfor i in range(1<>(k-1)&1:\n\n cnt+=1\n\n if (cnt%2)!=p[j]:\n\n judge=0\n\n if judge==1:\n\n ans+=1\n\nprint(ans)","code_v0_loc":19,"code_v1_loc":16,"code_v0_num_chars":384,"code_v1_num_chars":332,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nS = [list(map(int, input().split())) for _ in range(M)]\nP = list(map(int, input().split()))\nans = 0\nfor i in range(1 << N):\n sw = [False] * M\n for j in range(M):\n cnt = 0\n for k in range(1, len(S[j])):\n if (i >> (S[j][k] - 1)) & 1:\n cnt += 1\n else:\n flag = 0\n if cnt % 2 == P[j]:\n sw[j] = True\n if all(sw):\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nKS = [list(map(int, input().split())) for _ in range(M)]\np = list(map(int, input().split()))\nans = 0\nfor i in range(1 << N):\n judge = 1\n for j in range(M):\n cnt = 0\n for k in KS[j][1:]:\n if i >> (k - 1) & 1:\n cnt += 1\n if (cnt % 2) != p[j]:\n judge = 0\n if judge == 1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-S = [list(map(int, input().split())) for _ in range(M)]","-P = list(map(int, input().split()))","+KS = [list(map(int, input().split())) for _ in range(M)]","+p = list(map(int, input().split()))","- sw = [False] * M","+ judge = 1","- for k in range(1, len(S[j])):","- if (i >> (S[j][k] - 1)) & 1:","+ for k in KS[j][1:]:","+ if i >> (k - 1) & 1:","- else:","- flag = 0","- if cnt % 2 == P[j]:","- sw[j] = True","- if all(sw):","+ if (cnt % 2) != p[j]:","+ judge = 0","+ if judge == 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0845643005,"measured_runtime_v1":0.0973776131,"runtime_lift":0.8684162393,"key":["s620076963","s110986143"]} +{"user_id":"u811434779","problem_id":"p00516","language":"python","submission_id_v0":"s359721458","submission_id_v1":"s339368429","cpu_time_v0":140,"cpu_time_v1":100,"memory_v0":6588,"memory_v1":6468,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.57,"input":"n, k = list(map(int, input().split()))\n\na = [eval(input()) for i in range(n+k)]\n\ncnt = {i:0 for i in range(n)}\n\nfor i in range(n,n+k):\n\n for j in range(n):\n\n if a[i] >= a[j]:\n\n cnt[j] += 1\n\n break\n\nprint(sorted(list(cnt.items()), key = lambda x:x[1], reverse = True)[0][0] + 1)","target":"n, k = list(map(int, input().split()))\n\na = [eval(input()) for i in range(n+k)]\n\nc = [0]*n\n\nfor i in range(n,n+k):\n\n for j in range(n):\n\n if a[i] >= a[j]:\n\n c[j] += 1\n\n break\n\nprint(c.index(max(c)) + 1)","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":294,"code_v1_num_chars":225,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\na = [eval(input()) for i in range(n + k)]\ncnt = {i: 0 for i in range(n)}\nfor i in range(n, n + k):\n for j in range(n):\n if a[i] >= a[j]:\n cnt[j] += 1\n break\nprint(sorted(list(cnt.items()), key=lambda x: x[1], reverse=True)[0][0] + 1)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\na = [eval(input()) for i in range(n + k)]\nc = [0] * n\nfor i in range(n, n + k):\n for j in range(n):\n if a[i] >= a[j]:\n c[j] += 1\n break\nprint(c.index(max(c)) + 1)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-cnt = {i: 0 for i in range(n)}","+c = [0] * n","- cnt[j] += 1","+ c[j] += 1","-print(sorted(list(cnt.items()), key=lambda x: x[1], reverse=True)[0][0] + 1)","+print(c.index(max(c)) + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0342574596,"measured_runtime_v1":0.0407306671,"runtime_lift":0.8410728834,"key":["s359721458","s339368429"]} +{"user_id":"u759412327","problem_id":"p03210","language":"python","submission_id_v0":"s471939839","submission_id_v1":"s767358428","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"print((\" YNEOS\"[eval(input()) in \"357\"::2]))","target":"if eval(input()) in \"357\":\n\n print(\"YES\")\n\nelse:\n\n print(\"NO\")","code_v0_loc":1,"code_v1_loc":4,"code_v0_num_chars":36,"code_v1_num_chars":58,"code_v0_no_empty_lines":"print((\" YNEOS\"[eval(input()) in \"357\" :: 2]))\n","code_v1_no_empty_lines":"if eval(input()) in \"357\":\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":75.0,"diff":["-print((\" YNEOS\"[eval(input()) in \"357\" :: 2]))","+if eval(input()) in \"357\":","+ print(\"YES\")","+else:","+ print(\"NO\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0340122608,"measured_runtime_v1":0.0368168666,"runtime_lift":0.9238228001,"key":["s471939839","s767358428"]} +{"user_id":"u308684517","problem_id":"p03804","language":"python","submission_id_v0":"s731642701","submission_id_v1":"s940859817","cpu_time_v0":32,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.75,"input":"n, m = list(map(int, input().split()))\n\nnn = []\n\nmm = []\n\nfor i in range(n):\n\n nn.append(list(eval(input())))\n\nfor i in range(m):\n\n mm.append(list(eval(input())))\n\nfor i in range(n-m+1):\n\n for j in range(n-m+1):\n\n count = 0\n\n for k in range(m):\n\n for l in range(m):\n\n if nn[i+k][j+l] != mm[k][l]:\n\n break\n\n else:\n\n count += 1\n\n if count == m*m:\n\n print(\"Yes\")\n\n exit()\n\nprint(\"No\") ","target":"n, m = list(map(int, input().split()))\n\na = [eval(input()) for i in range(n)]\n\nb = [eval(input()) for i in range(m)]\n\nans = 'Yes'\n\nfor i in range(n):\n\n for j in range(m):\n\n if b[j] not in a[i]:\n\n ans = 'No'\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":9,"code_v0_num_chars":506,"code_v1_num_chars":221,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nnn = []\nmm = []\nfor i in range(n):\n nn.append(list(eval(input())))\nfor i in range(m):\n mm.append(list(eval(input())))\nfor i in range(n - m + 1):\n for j in range(n - m + 1):\n count = 0\n for k in range(m):\n for l in range(m):\n if nn[i + k][j + l] != mm[k][l]:\n break\n else:\n count += 1\n if count == m * m:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\na = [eval(input()) for i in range(n)]\nb = [eval(input()) for i in range(m)]\nans = \"Yes\"\nfor i in range(n):\n for j in range(m):\n if b[j] not in a[i]:\n ans = \"No\"\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":55.0,"diff":["-nn = []","-mm = []","+a = [eval(input()) for i in range(n)]","+b = [eval(input()) for i in range(m)]","+ans = \"Yes\"","- nn.append(list(eval(input())))","-for i in range(m):","- mm.append(list(eval(input())))","-for i in range(n - m + 1):","- for j in range(n - m + 1):","- count = 0","- for k in range(m):","- for l in range(m):","- if nn[i + k][j + l] != mm[k][l]:","- break","- else:","- count += 1","- if count == m * m:","- print(\"Yes\")","- exit()","-print(\"No\")","+ for j in range(m):","+ if b[j] not in a[i]:","+ ans = \"No\"","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0988815453,"measured_runtime_v1":0.148780195,"runtime_lift":0.6646149731,"key":["s731642701","s940859817"]} +{"user_id":"u454022848","problem_id":"p02399","language":"python","submission_id_v0":"s197254143","submission_id_v1":"s754528501","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":6328,"memory_v1":6428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"# encoding:utf-8\n\n\n\ninput = list(map(int, input().split()))\n\na, b = input\n\n\n\nd = a \/ b\n\nr = a % b\n\nf = float(a) \/ b\n\n\n\nprint((d), end=' ')\n\nprint((r), end=' ')\n\nprint(('%03.9f' % f))","target":"# encoding:utf-8\n\n\n\ninput = list(map(int, input().split()))\n\na, b = input\n\n\n\nd = a \/ b\n\nr = a % b\n\nf = float(a) \/ b\n\n\n\nprint((d), end=' ')\n\nprint((r), end=' ')\n\nprint(('%03.8f' % f))","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":160,"code_v1_num_chars":160,"code_v0_no_empty_lines":"# encoding:utf-8\ninput = list(map(int, input().split()))\na, b = input\nd = a \/ b\nr = a % b\nf = float(a) \/ b\nprint((d), end=\" \")\nprint((r), end=\" \")\nprint((\"%03.9f\" % f))\n","code_v1_no_empty_lines":"# encoding:utf-8\ninput = list(map(int, input().split()))\na, b = input\nd = a \/ b\nr = a % b\nf = float(a) \/ b\nprint((d), end=\" \")\nprint((r), end=\" \")\nprint((\"%03.8f\" % f))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((\"%03.9f\" % f))","+print((\"%03.8f\" % f))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0739264188,"measured_runtime_v1":0.0396516957,"runtime_lift":1.8643948866,"key":["s197254143","s754528501"]} +{"user_id":"u072053884","problem_id":"p02412","language":"python","submission_id_v0":"s342631121","submission_id_v1":"s995659345","cpu_time_v0":350,"cpu_time_v1":30,"memory_v0":7668,"memory_v1":7648,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.43,"input":"while True:\n\n n, x = list(map(int, input().split()))\n\n if n == x == 0:\n\n break\n\n cnt = 0\n\n upper_max_value = min(x - 3, n)\n\n lower_max_value = max(int(x \/ 3), 3)\n\n for i in range(upper_max_value, lower_max_value - 1, -1):\n\n for j in range(i - 1, 1, -1):\n\n for k in range(j - 1, 0, -1):\n\n if (i + j + k) == x:\n\n cnt += 1\n\n print(cnt)","target":"while True:\n\n n, x = list(map(int, input().split()))\n\n if n == x == 0:\n\n break\n\n max_a = min(x - 3, n)\n\n min_a = max(x \/\/ 3 + 1, 3)\n\n cnt = 0\n\n for i in range(min_a, max_a + 1):\n\n max_b = min(i - 1, x - i - 1)\n\n min_b = (x - i) \/\/ 2 + 1\n\n cnt += (max_b - min_b + 1)\n\n print(cnt)","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":406,"code_v1_num_chars":321,"code_v0_no_empty_lines":"while True:\n n, x = list(map(int, input().split()))\n if n == x == 0:\n break\n cnt = 0\n upper_max_value = min(x - 3, n)\n lower_max_value = max(int(x \/ 3), 3)\n for i in range(upper_max_value, lower_max_value - 1, -1):\n for j in range(i - 1, 1, -1):\n for k in range(j - 1, 0, -1):\n if (i + j + k) == x:\n cnt += 1\n print(cnt)\n","code_v1_no_empty_lines":"while True:\n n, x = list(map(int, input().split()))\n if n == x == 0:\n break\n max_a = min(x - 3, n)\n min_a = max(x \/\/ 3 + 1, 3)\n cnt = 0\n for i in range(min_a, max_a + 1):\n max_b = min(i - 1, x - i - 1)\n min_b = (x - i) \/\/ 2 + 1\n cnt += max_b - min_b + 1\n print(cnt)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["+ max_a = min(x - 3, n)","+ min_a = max(x \/\/ 3 + 1, 3)","- upper_max_value = min(x - 3, n)","- lower_max_value = max(int(x \/ 3), 3)","- for i in range(upper_max_value, lower_max_value - 1, -1):","- for j in range(i - 1, 1, -1):","- for k in range(j - 1, 0, -1):","- if (i + j + k) == x:","- cnt += 1","+ for i in range(min_a, max_a + 1):","+ max_b = min(i - 1, x - i - 1)","+ min_b = (x - i) \/\/ 2 + 1","+ cnt += max_b - min_b + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0816725361,"measured_runtime_v1":0.0365899482,"runtime_lift":2.2321030824,"key":["s342631121","s995659345"]} +{"user_id":"u236677506","problem_id":"p03365","language":"python","submission_id_v0":"s969476701","submission_id_v1":"s869849543","cpu_time_v0":541,"cpu_time_v1":478,"memory_v0":175020,"memory_v1":174616,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.65,"input":"Md,MN=1000000007,1000006\n\nfac,ifac,a,res,inv=[1,1],[1,1],[0],0,[1,1]\n\nfor i in range(2,MN):\n\n inv.append(inv[Md%i]*(Md-Md\/\/i)%Md)\n\n fac.append(fac[-1]*i%Md)\n\n ifac.append(ifac[-1]*inv[i]%Md)\n\ndef C(x,y):\n\n if(x=0:\n\n a.append(D(n-3,n-i-1)*fac[i]*fac[n-i-1]%Md)\n\n else:\n\n a.append(0)\n\nfor i in range(n-1,0,-1):\n\n a[i]=(a[i]-a[i-1])%Md\n\n res=res+a[i]*i\n\nres=res%Md\n\nprint(res)\n","target":"Md,MN=1000000007,1000006\n\nfac,ifac,a,res,inv=[1,1],[1,1],[0],0,[1,1]\n\nfor i in range(2,MN):\n\n inv.append(inv[Md%i]*(Md-Md\/\/i)%Md)\n\n fac.append(fac[-1]*i%Md)\n\n ifac.append(ifac[-1]*inv[i]%Md)\n\nn=int(eval(input()))\n\nfor i in range(1,n):\n\n if i*2-n>=0:\n\n a.append(fac[i-1]*ifac[i+i-n]*fac[i]%Md)\n\n else:\n\n a.append(0)\n\nfor i in range(n-1,0,-1):\n\n a[i]=(a[i]-a[i-1])%Md\n\n res+=a[i]*i\n\nres=res%Md\n\nprint(res)\n","code_v0_loc":24,"code_v1_loc":17,"code_v0_num_chars":559,"code_v1_num_chars":433,"code_v0_no_empty_lines":"Md, MN = 1000000007, 1000006\nfac, ifac, a, res, inv = [1, 1], [1, 1], [0], 0, [1, 1]\nfor i in range(2, MN):\n inv.append(inv[Md % i] * (Md - Md \/\/ i) % Md)\n fac.append(fac[-1] * i % Md)\n ifac.append(ifac[-1] * inv[i] % Md)\n\n\ndef C(x, y):\n if x < y:\n return 0\n return fac[x] * ifac[y] * ifac[x - y]\n\n\ndef D(x, y):\n return C(x - y + 1, y)\n\n\nn = int(eval(input()))\nfor i in range(1, n):\n if i * 2 - n >= 0:\n a.append(D(n - 3, n - i - 1) * fac[i] * fac[n - i - 1] % Md)\n else:\n a.append(0)\nfor i in range(n - 1, 0, -1):\n a[i] = (a[i] - a[i - 1]) % Md\n res = res + a[i] * i\nres = res % Md\nprint(res)\n","code_v1_no_empty_lines":"Md, MN = 1000000007, 1000006\nfac, ifac, a, res, inv = [1, 1], [1, 1], [0], 0, [1, 1]\nfor i in range(2, MN):\n inv.append(inv[Md % i] * (Md - Md \/\/ i) % Md)\n fac.append(fac[-1] * i % Md)\n ifac.append(ifac[-1] * inv[i] % Md)\nn = int(eval(input()))\nfor i in range(1, n):\n if i * 2 - n >= 0:\n a.append(fac[i - 1] * ifac[i + i - n] * fac[i] % Md)\n else:\n a.append(0)\nfor i in range(n - 1, 0, -1):\n a[i] = (a[i] - a[i - 1]) % Md\n res += a[i] * i\nres = res % Md\nprint(res)\n","code_same":false,"relative_loc_diff_percent":29.1666666667,"diff":["-","-","-def C(x, y):","- if x < y:","- return 0","- return fac[x] * ifac[y] * ifac[x - y]","-","-","-def D(x, y):","- return C(x - y + 1, y)","-","-","- a.append(D(n - 3, n - i - 1) * fac[i] * fac[n - i - 1] % Md)","+ a.append(fac[i - 1] * ifac[i + i - n] * fac[i] % Md)","- res = res + a[i] * i","+ res += a[i] * i"],"diff_only_import_comment":false,"measured_runtime_v0":1.7527797604,"measured_runtime_v1":1.6572048187,"runtime_lift":1.0576723773,"key":["s969476701","s869849543"]} +{"user_id":"u312025627","problem_id":"p02901","language":"python","submission_id_v0":"s193141675","submission_id_v1":"s827366183","cpu_time_v0":574,"cpu_time_v1":364,"memory_v0":78056,"memory_v1":78552,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.59,"input":"INF = 2*10**7\n\n\n\n\n\ndef main():\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n C.append({int(i) for i in input().split()})\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j\n\n for bit in C[i]:\n\n next_bit |= (1 << (bit-1))\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"INF = 2*10**7\n\n\n\n\n\ndef main():\n\n N, M = (int(i) for i in input().split())\n\n A = []\n\n B = []\n\n C = []\n\n for _ in range(M):\n\n a, b = (int(i) for i in input().split())\n\n A.append(a)\n\n B.append(b)\n\n bit = 0\n\n for i in input().split():\n\n bit |= (1 << (int(i)-1))\n\n C.append(bit)\n\n dp = [[INF]*(1 << N) for _ in range(M+1)]\n\n dp[0][0] = 0\n\n for i in range(M):\n\n for j in range(1 << N):\n\n dp[i+1][j] = min(dp[i+1][j], dp[i][j])\n\n if dp[i][j] != INF:\n\n next_bit = j | C[i]\n\n dp[i+1][next_bit] = min(dp[i+1][next_bit], dp[i][j] + A[i])\n\n ans = dp[-1][-1]\n\n if ans == INF:\n\n print((-1))\n\n else:\n\n print(ans)\n\n # print(*dp, sep=\"\\n\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":33,"code_v1_loc":34,"code_v0_num_chars":842,"code_v1_num_chars":827,"code_v0_no_empty_lines":"INF = 2 * 10**7\n\n\ndef main():\n N, M = (int(i) for i in input().split())\n A = []\n B = []\n C = []\n for _ in range(M):\n a, b = (int(i) for i in input().split())\n A.append(a)\n B.append(b)\n C.append({int(i) for i in input().split()})\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n if dp[i][j] != INF:\n next_bit = j\n for bit in C[i]:\n next_bit |= 1 << (bit - 1)\n dp[i + 1][next_bit] = min(dp[i + 1][next_bit], dp[i][j] + A[i])\n ans = dp[-1][-1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n # print(*dp, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"INF = 2 * 10**7\n\n\ndef main():\n N, M = (int(i) for i in input().split())\n A = []\n B = []\n C = []\n for _ in range(M):\n a, b = (int(i) for i in input().split())\n A.append(a)\n B.append(b)\n bit = 0\n for i in input().split():\n bit |= 1 << (int(i) - 1)\n C.append(bit)\n dp = [[INF] * (1 << N) for _ in range(M + 1)]\n dp[0][0] = 0\n for i in range(M):\n for j in range(1 << N):\n dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])\n if dp[i][j] != INF:\n next_bit = j | C[i]\n dp[i + 1][next_bit] = min(dp[i + 1][next_bit], dp[i][j] + A[i])\n ans = dp[-1][-1]\n if ans == INF:\n print((-1))\n else:\n print(ans)\n # print(*dp, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":2.9411764706,"diff":["- C.append({int(i) for i in input().split()})","+ bit = 0","+ for i in input().split():","+ bit |= 1 << (int(i) - 1)","+ C.append(bit)","- next_bit = j","- for bit in C[i]:","- next_bit |= 1 << (bit - 1)","+ next_bit = j | C[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.046775481,"measured_runtime_v1":0.0473847291,"runtime_lift":0.9871425208,"key":["s193141675","s827366183"]} +{"user_id":"u506858457","problem_id":"p02936","language":"python","submission_id_v0":"s273574085","submission_id_v1":"s611704048","cpu_time_v0":1393,"cpu_time_v1":1260,"memory_v0":283160,"memory_v1":56420,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.55,"input":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\n\ndef MI(): return list(map(int, input().split()))\n\n\n\nN,Q=MI()\n\nEdge=[[] for _ in range(N)]\n\nPoint=[0]*N\n\n\n\nfor i in range(N-1):\n\n a,b=MI()\n\n Edge[a-1].append(b-1)\n\n Edge[b-1].append(a-1)\n\n\n\nfor i in range(Q):\n\n p,x=MI()\n\n Point[p-1]+=x\n\n\n\ndef dfs(now,pre=-1):\n\n for nxt in Edge[now]:\n\n if nxt==pre:\n\n continue\n\n Point[nxt]+=Point[now]\n\n dfs(nxt,now)\n\ndfs(0)\n\nprint((*Point))","target":"from collections import deque\n\ndef MI(): return list(map(int, input().split()))\n\nN,Q=MI()\n\ngraph=[[] for i in range(N)]\n\nPoint=[0]*N\n\nfor i in range(N-1):\n\n a,b=MI()\n\n graph[a-1].append(b-1)\n\n graph[b-1].append(a-1)\n\nfor i in range(Q):\n\n p,x=MI()\n\n Point[p-1]+=x\n\nque=deque([])\n\nque.append(0)\n\ncheck=[0]*N\n\nwhile que:\n\n v=que.pop()\n\n check[v]=1\n\n for u in graph[v]:\n\n if check[u]!=1:\n\n #continue\n\n Point[u]+=Point[v]\n\n que.append(u)\n\nprint((*Point))","code_v0_loc":26,"code_v1_loc":24,"code_v0_num_chars":429,"code_v1_num_chars":467,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\nN, Q = MI()\nEdge = [[] for _ in range(N)]\nPoint = [0] * N\nfor i in range(N - 1):\n a, b = MI()\n Edge[a - 1].append(b - 1)\n Edge[b - 1].append(a - 1)\nfor i in range(Q):\n p, x = MI()\n Point[p - 1] += x\n\n\ndef dfs(now, pre=-1):\n for nxt in Edge[now]:\n if nxt == pre:\n continue\n Point[nxt] += Point[now]\n dfs(nxt, now)\n\n\ndfs(0)\nprint((*Point))\n","code_v1_no_empty_lines":"from collections import deque\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\nN, Q = MI()\ngraph = [[] for i in range(N)]\nPoint = [0] * N\nfor i in range(N - 1):\n a, b = MI()\n graph[a - 1].append(b - 1)\n graph[b - 1].append(a - 1)\nfor i in range(Q):\n p, x = MI()\n Point[p - 1] += x\nque = deque([])\nque.append(0)\ncheck = [0] * N\nwhile que:\n v = que.pop()\n check[v] = 1\n for u in graph[v]:\n if check[u] != 1:\n # continue\n Point[u] += Point[v]\n que.append(u)\nprint((*Point))\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-import sys","-","-sys.setrecursionlimit(10**6)","+from collections import deque","-Edge = [[] for _ in range(N)]","+graph = [[] for i in range(N)]","- Edge[a - 1].append(b - 1)","- Edge[b - 1].append(a - 1)","+ graph[a - 1].append(b - 1)","+ graph[b - 1].append(a - 1)","-","-","-def dfs(now, pre=-1):","- for nxt in Edge[now]:","- if nxt == pre:","- continue","- Point[nxt] += Point[now]","- dfs(nxt, now)","-","-","-dfs(0)","+que = deque([])","+que.append(0)","+check = [0] * N","+while que:","+ v = que.pop()","+ check[v] = 1","+ for u in graph[v]:","+ if check[u] != 1:","+ # continue","+ Point[u] += Point[v]","+ que.append(u)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0458459438,"measured_runtime_v1":0.046439229,"runtime_lift":0.987224481,"key":["s273574085","s611704048"]} +{"user_id":"u223646582","problem_id":"p02990","language":"python","submission_id_v0":"s358513442","submission_id_v1":"s750740512","cpu_time_v0":419,"cpu_time_v1":22,"memory_v0":25072,"memory_v1":3572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.75,"input":"from scipy.misc import comb\n\nmod = 1000000007\n\n\n\nN,K=list(map(int,input().split()))\n\n\n\nfor i in range(1,K+1):\n\n if N-K+1 n):\n\n return 0\n\n r = min(r, n-r)\n\n return g1[n] * g2[r] * g2[n-r] % mod\n\n\n\n\n\nmod = 10**9+7 # \u51fa\u529b\u306e\u5236\u9650\n\nn = 2*10**3\n\ng1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\n\ng2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\n\ninverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\n\n\n\nfor i in range(2, n + 1):\n\n g1.append((g1[-1] * i) % mod)\n\n inverse.append((-inverse[mod % i] * (mod\/\/i)) % mod)\n\n g2.append((g2[-1] * inverse[-1]) % mod)\n\n\n\nfor i in range(1, K+1):\n\n print((cmb(N-K+1, i, mod) * cmb(K-1, i-1, mod) % mod))\n","code_v0_loc":11,"code_v1_loc":23,"code_v0_num_chars":222,"code_v1_num_chars":538,"code_v0_no_empty_lines":"from scipy.misc import comb\n\nmod = 1000000007\nN, K = list(map(int, input().split()))\nfor i in range(1, K + 1):\n if N - K + 1 < i:\n print((0))\n else:\n print((comb(N - K + 1, i, exact=True) * comb(K - 1, i - 1, exact=True) % mod))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\n\n\ndef cmb(n, r, mod):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return g1[n] * g2[r] * g2[n - r] % mod\n\n\nmod = 10**9 + 7 # \u51fa\u529b\u306e\u5236\u9650\nn = 2 * 10**3\ng1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb\ng2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\ninverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb\nfor i in range(2, n + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\nfor i in range(1, K + 1):\n print((cmb(N - K + 1, i, mod) * cmb(K - 1, i - 1, mod) % mod))\n","code_same":false,"relative_loc_diff_percent":52.1739130435,"diff":["-from scipy.misc import comb","+N, K = list(map(int, input().split()))","-mod = 1000000007","-N, K = list(map(int, input().split()))","+","+def cmb(n, r, mod):","+ if r < 0 or r > n:","+ return 0","+ r = min(r, n - r)","+ return g1[n] * g2[r] * g2[n - r] % mod","+","+","+mod = 10**9 + 7 # \u51fa\u529b\u306e\u5236\u9650","+n = 2 * 10**3","+g1 = [1, 1] # \u5143\u30c6\u30fc\u30d6\u30eb","+g2 = [1, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb","+inverse = [0, 1] # \u9006\u5143\u30c6\u30fc\u30d6\u30eb\u8a08\u7b97\u7528\u30c6\u30fc\u30d6\u30eb","+for i in range(2, n + 1):","+ g1.append((g1[-1] * i) % mod)","+ inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)","+ g2.append((g2[-1] * inverse[-1]) % mod)","- if N - K + 1 < i:","- print((0))","- else:","- print((comb(N - K + 1, i, exact=True) * comb(K - 1, i - 1, exact=True) % mod))","+ print((cmb(N - K + 1, i, mod) * cmb(K - 1, i - 1, mod) % mod))"],"diff_only_import_comment":false,"measured_runtime_v0":1.0088491815,"measured_runtime_v1":0.0371906922,"runtime_lift":27.1263889407,"key":["s358513442","s750740512"]} +{"user_id":"u533039576","problem_id":"p03611","language":"python","submission_id_v0":"s041465412","submission_id_v1":"s512669509","cpu_time_v0":158,"cpu_time_v1":126,"memory_v0":13964,"memory_v1":14564,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.25,"input":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\na.sort()\n\na.append(a[-1] + 1)\n\n\n\nb = [a[0]]\n\nc = [1]\n\nans = 0\n\nfor i in range(1, n+1):\n\n if a[i] == b[-1]:\n\n c[-1] += 1\n\n else:\n\n cand = c[-1]\n\n if len(b) >= 2 and b[-2] == b[-1] - 1:\n\n cand += c[-2]\n\n if len(b) >= 3 and b[-3] == b[-1] - 2:\n\n cand += c[-3]\n\n ans = max(ans, cand)\n\n b.append(a[i])\n\n c.append(1)\n\n\n\nprint(ans)\n","target":"from collections import defaultdict\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\nd = defaultdict(int)\n\nfor i in range(n):\n\n d[a[i]] += 1\n\n\n\nans = 0\n\nfor x in d:\n\n cand = d[x]\n\n if x - 1 in d:\n\n cand += d[x - 1]\n\n if x + 1 in d:\n\n cand += d[x + 1]\n\n \n\n ans = max(ans, cand)\n\n\n\nprint(ans)\n","code_v0_loc":22,"code_v1_loc":19,"code_v0_num_chars":457,"code_v1_num_chars":332,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\na.sort()\na.append(a[-1] + 1)\nb = [a[0]]\nc = [1]\nans = 0\nfor i in range(1, n + 1):\n if a[i] == b[-1]:\n c[-1] += 1\n else:\n cand = c[-1]\n if len(b) >= 2 and b[-2] == b[-1] - 1:\n cand += c[-2]\n if len(b) >= 3 and b[-3] == b[-1] - 2:\n cand += c[-3]\n ans = max(ans, cand)\n b.append(a[i])\n c.append(1)\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nd = defaultdict(int)\nfor i in range(n):\n d[a[i]] += 1\nans = 0\nfor x in d:\n cand = d[x]\n if x - 1 in d:\n cand += d[x - 1]\n if x + 1 in d:\n cand += d[x + 1]\n ans = max(ans, cand)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":13.6363636364,"diff":["+from collections import defaultdict","+","-a.sort()","-a.append(a[-1] + 1)","-b = [a[0]]","-c = [1]","+d = defaultdict(int)","+for i in range(n):","+ d[a[i]] += 1","-for i in range(1, n + 1):","- if a[i] == b[-1]:","- c[-1] += 1","- else:","- cand = c[-1]","- if len(b) >= 2 and b[-2] == b[-1] - 1:","- cand += c[-2]","- if len(b) >= 3 and b[-3] == b[-1] - 2:","- cand += c[-3]","- ans = max(ans, cand)","- b.append(a[i])","- c.append(1)","+for x in d:","+ cand = d[x]","+ if x - 1 in d:","+ cand += d[x - 1]","+ if x + 1 in d:","+ cand += d[x + 1]","+ ans = max(ans, cand)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1115166187,"measured_runtime_v1":0.0825858593,"runtime_lift":1.3503112962,"key":["s041465412","s512669509"]} +{"user_id":"u994988729","problem_id":"p03476","language":"python","submission_id_v0":"s260487808","submission_id_v1":"s264971715","cpu_time_v0":874,"cpu_time_v1":357,"memory_v0":5144,"memory_v1":15172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.15,"input":"def get_isPrime(n): #1~n\u307e\u3067\u306e\u6570\u3067\u3001\u7d20\u6570\u306f1\u3001\u305d\u308c\u4ee5\u5916\u306f0\u3068\u306a\u308b\u3088\u3046\u306a\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n\n isprime=[1]*(n+1)\n\n isprime[0]=0\n\n isprime[1]=0\n\n for i in range(2, int(n**0.5)+1):\n\n if not isprime[i]:\n\n continue\n\n for j in range(i*2, n+1, i):\n\n isprime[j]=0\n\n return isprime\n\n\n\nmax_n=100000\n\nisprime=get_isPrime(max_n)\n\n\n\nruiseki=[]\n\nfor i in range(max_n+1):\n\n if i==0 or i==1 or i==2:\n\n ruiseki.append(0)\n\n else:\n\n if i%2==0:\n\n ruiseki.append(ruiseki[i-1])\n\n else:\n\n if isprime[i] and isprime[int((i+1)\/2)]:\n\n ruiseki.append(ruiseki[i-1]+1)\n\n else:\n\n ruiseki.append(ruiseki[i-1])\n\n\n\nq=int(eval(input()))\n\nfor _ in range(q):\n\n left, right=list(map(int,input().split()))\n\n print((ruiseki[right]-ruiseki[left-1]))","target":"from itertools import chain, accumulate\n\n\n\n\n\ndef prime_set(N):\n\n \"\"\"\n\n N\u307e\u3067\u306e\u7d20\u6570\u306eset\u3092\u8fd4\u3059\n\n \"\"\"\n\n if N < 4:\n\n return ({}, {}, {2}, {2, 3})[N]\n\n Nsq = int(N ** 0.5 + 0.5) + 1\n\n primes = {2, 3} | set(chain(range(5, N + 1, 6), range(7, N + 1, 6)))\n\n for i in range(5, Nsq, 2):\n\n if i in primes:\n\n primes -= set(range(i * i, N + 1, i * 2))\n\n return primes\n\n\n\n\n\nU = 10 ** 5 + 10\n\nprimes = prime_set(U)\n\nmemo = [0] * U\n\nfor i in range(1, U, 2):\n\n if i in primes and (i + 1) \/\/ 2 in primes:\n\n memo[i] = 1\n\nmemo = list(accumulate(memo))\n\n\n\nQ = int(input())\n\nans = []\n\nfor _ in range(Q):\n\n l, r = map(int, input().split())\n\n ans.append(memo[r] - memo[l - 1])\n\nprint(*ans, sep=\"\\n\")\n","code_v0_loc":31,"code_v1_loc":31,"code_v0_num_chars":812,"code_v1_num_chars":732,"code_v0_no_empty_lines":"def get_isPrime(n): # 1~n\u307e\u3067\u306e\u6570\u3067\u3001\u7d20\u6570\u306f1\u3001\u305d\u308c\u4ee5\u5916\u306f0\u3068\u306a\u308b\u3088\u3046\u306a\u30ea\u30b9\u30c8\u3092\u8fd4\u3059\n isprime = [1] * (n + 1)\n isprime[0] = 0\n isprime[1] = 0\n for i in range(2, int(n**0.5) + 1):\n if not isprime[i]:\n continue\n for j in range(i * 2, n + 1, i):\n isprime[j] = 0\n return isprime\n\n\nmax_n = 100000\nisprime = get_isPrime(max_n)\nruiseki = []\nfor i in range(max_n + 1):\n if i == 0 or i == 1 or i == 2:\n ruiseki.append(0)\n else:\n if i % 2 == 0:\n ruiseki.append(ruiseki[i - 1])\n else:\n if isprime[i] and isprime[int((i + 1) \/ 2)]:\n ruiseki.append(ruiseki[i - 1] + 1)\n else:\n ruiseki.append(ruiseki[i - 1])\nq = int(eval(input()))\nfor _ in range(q):\n left, right = list(map(int, input().split()))\n print((ruiseki[right] - ruiseki[left - 1]))\n","code_v1_no_empty_lines":"from itertools import chain, accumulate\n\n\ndef prime_set(N):\n \"\"\"\n N\u307e\u3067\u306e\u7d20\u6570\u306eset\u3092\u8fd4\u3059\n \"\"\"\n if N < 4:\n return ({}, {}, {2}, {2, 3})[N]\n Nsq = int(N**0.5 + 0.5) + 1\n primes = {2, 3} | set(chain(range(5, N + 1, 6), range(7, N + 1, 6)))\n for i in range(5, Nsq, 2):\n if i in primes:\n primes -= set(range(i * i, N + 1, i * 2))\n return primes\n\n\nU = 10**5 + 10\nprimes = prime_set(U)\nmemo = [0] * U\nfor i in range(1, U, 2):\n if i in primes and (i + 1) \/\/ 2 in primes:\n memo[i] = 1\nmemo = list(accumulate(memo))\nQ = int(input())\nans = []\nfor _ in range(Q):\n l, r = map(int, input().split())\n ans.append(memo[r] - memo[l - 1])\nprint(*ans, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-def get_isPrime(n): # 1~n\u307e\u3067\u306e\u6570\u3067\u3001\u7d20\u6570\u306f1\u3001\u305d\u308c\u4ee5\u5916\u306f0\u3068\u306a\u308b\u3088\u3046\u306a\u30ea\u30b9\u30c8\u3092\u8fd4\u3059","- isprime = [1] * (n + 1)","- isprime[0] = 0","- isprime[1] = 0","- for i in range(2, int(n**0.5) + 1):","- if not isprime[i]:","- continue","- for j in range(i * 2, n + 1, i):","- isprime[j] = 0","- return isprime","+from itertools import chain, accumulate","-max_n = 100000","-isprime = get_isPrime(max_n)","-ruiseki = []","-for i in range(max_n + 1):","- if i == 0 or i == 1 or i == 2:","- ruiseki.append(0)","- else:","- if i % 2 == 0:","- ruiseki.append(ruiseki[i - 1])","- else:","- if isprime[i] and isprime[int((i + 1) \/ 2)]:","- ruiseki.append(ruiseki[i - 1] + 1)","- else:","- ruiseki.append(ruiseki[i - 1])","-q = int(eval(input()))","-for _ in range(q):","- left, right = list(map(int, input().split()))","- print((ruiseki[right] - ruiseki[left - 1]))","+def prime_set(N):","+ \"\"\"","+ N\u307e\u3067\u306e\u7d20\u6570\u306eset\u3092\u8fd4\u3059","+ \"\"\"","+ if N < 4:","+ return ({}, {}, {2}, {2, 3})[N]","+ Nsq = int(N**0.5 + 0.5) + 1","+ primes = {2, 3} | set(chain(range(5, N + 1, 6), range(7, N + 1, 6)))","+ for i in range(5, Nsq, 2):","+ if i in primes:","+ primes -= set(range(i * i, N + 1, i * 2))","+ return primes","+","+","+U = 10**5 + 10","+primes = prime_set(U)","+memo = [0] * U","+for i in range(1, U, 2):","+ if i in primes and (i + 1) \/\/ 2 in primes:","+ memo[i] = 1","+memo = list(accumulate(memo))","+Q = int(input())","+ans = []","+for _ in range(Q):","+ l, r = map(int, input().split())","+ ans.append(memo[r] - memo[l - 1])","+print(*ans, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.143240756,"measured_runtime_v1":0.0706324069,"runtime_lift":2.0279750075,"key":["s260487808","s264971715"]} +{"user_id":"u802963389","problem_id":"p03013","language":"python","submission_id_v0":"s042015238","submission_id_v1":"s685488174","cpu_time_v0":448,"cpu_time_v1":183,"memory_v0":460020,"memory_v1":13216,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.15,"input":"N, M = list(map(int, input().split()))\n\na = [-1]\n\nfor i in range(M):\n\n a.append(int(eval(input())))\n\n\n\n# a = [int(input()) for i in range(M)]\n\na.append(N+1)\n\n# print(N,M)\n\n# print(a)\n\n\n\ndiff = []\n\ndiffmax = 0\n\nfor i, v in enumerate(a):\n\n if i != len(a)-1:\n\n steps = a[i+1] - a[i]\n\n diff.append(steps)\n\n if diffmax < steps:\n\n diffmax = steps\n\n\n\n#print(diff)\n\n \n\nactptn = [0,1]\n\nfor i in range(2,diffmax):\n\n actptn.append(actptn[i-1] + actptn[i-2])\n\n#print(len(actptn))\n\n\n\nans = 1\n\nfor i in diff:\n\n ans = (ans* actptn[i-1]) % 1000000007\n\nprint(ans)\n\n ","target":"n, m = list(map(int, input().split()))\n\nA = set([int(eval(input())) for _ in range(m)])\n\n\n\nMOD = 10 ** 9 + 7\n\ndp = [0] * (n + 1)\n\n\n\ndp[0] = 1\n\nif 1 not in A:\n\n dp[1] = 1\n\n\n\nfor i in range(2, n + 1):\n\n if i not in A:\n\n dp[i] = (dp[i - 1] + dp[i - 2]) % MOD\n\n\n\nprint((dp[-1]))","code_v0_loc":31,"code_v1_loc":15,"code_v0_num_chars":560,"code_v1_num_chars":265,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\na = [-1]\nfor i in range(M):\n a.append(int(eval(input())))\n# a = [int(input()) for i in range(M)]\na.append(N + 1)\n# print(N,M)\n# print(a)\ndiff = []\ndiffmax = 0\nfor i, v in enumerate(a):\n if i != len(a) - 1:\n steps = a[i + 1] - a[i]\n diff.append(steps)\n if diffmax < steps:\n diffmax = steps\n# print(diff)\nactptn = [0, 1]\nfor i in range(2, diffmax):\n actptn.append(actptn[i - 1] + actptn[i - 2])\n# print(len(actptn))\nans = 1\nfor i in diff:\n ans = (ans * actptn[i - 1]) % 1000000007\nprint(ans)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nA = set([int(eval(input())) for _ in range(m)])\nMOD = 10**9 + 7\ndp = [0] * (n + 1)\ndp[0] = 1\nif 1 not in A:\n dp[1] = 1\nfor i in range(2, n + 1):\n if i not in A:\n dp[i] = (dp[i - 1] + dp[i - 2]) % MOD\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":51.6129032258,"diff":["-N, M = list(map(int, input().split()))","-a = [-1]","-for i in range(M):","- a.append(int(eval(input())))","-# a = [int(input()) for i in range(M)]","-a.append(N + 1)","-# print(N,M)","-# print(a)","-diff = []","-diffmax = 0","-for i, v in enumerate(a):","- if i != len(a) - 1:","- steps = a[i + 1] - a[i]","- diff.append(steps)","- if diffmax < steps:","- diffmax = steps","-# print(diff)","-actptn = [0, 1]","-for i in range(2, diffmax):","- actptn.append(actptn[i - 1] + actptn[i - 2])","-# print(len(actptn))","-ans = 1","-for i in diff:","- ans = (ans * actptn[i - 1]) % 1000000007","-print(ans)","+n, m = list(map(int, input().split()))","+A = set([int(eval(input())) for _ in range(m)])","+MOD = 10**9 + 7","+dp = [0] * (n + 1)","+dp[0] = 1","+if 1 not in A:","+ dp[1] = 1","+for i in range(2, n + 1):","+ if i not in A:","+ dp[i] = (dp[i - 1] + dp[i - 2]) % MOD","+print((dp[-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0408625963,"measured_runtime_v1":0.0403776016,"runtime_lift":1.0120114772,"key":["s042015238","s685488174"]} +{"user_id":"u077291787","problem_id":"p03608","language":"python","submission_id_v0":"s331626751","submission_id_v1":"s667317308","cpu_time_v0":1773,"cpu_time_v1":1185,"memory_v0":18884,"memory_v1":13292,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.16,"input":"# ABC073D - joisino's travel\n\nfrom itertools import permutations\n\nfrom scipy.sparse.csgraph import dijkstra\n\n\n\n\n\ndef main():\n\n N, M, R, *RABC = list(map(int, open(0).read().split()))\n\n visit, ABC = RABC[:R], RABC[R:]\n\n G = [[float(\"inf\")] * (N + 1) for _ in range(N + 1)]\n\n for v, u, c in zip(*[iter(ABC)] * 3):\n\n G[v][u] = G[u][v] = c\n\n dist = [None] * (N + 1)\n\n for i in range(1, N + 1):\n\n dist[i] = dijkstra(G, directed=0, indices=i)\n\n ans = float(\"inf\")\n\n for perm in permutations(visit):\n\n cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))\n\n ans = min(ans, cur)\n\n print((int(ans)))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"# ABC073D - joisino's travel\n\nfrom heapq import heapify, heappop, heappush\n\nfrom itertools import permutations\n\n\n\n\n\ndef dijkstra(G: \"Array[Array[int]]\", size: int, start: int) -> list:\n\n dist = [float(\"inf\")] * size\n\n queue = [(start, 0)]\n\n heapify(queue)\n\n while queue:\n\n v, cost = heappop(queue)\n\n if cost > dist[v]:\n\n continue\n\n dist[v] = cost\n\n for u, next_cost in G[v]:\n\n if cost + next_cost < dist[u]:\n\n heappush(queue, (u, cost + next_cost))\n\n return dist\n\n\n\n\n\ndef main():\n\n global G, N\n\n N, M, R, *RABC = list(map(int, open(0).read().split()))\n\n visit, ABC = RABC[:R], RABC[R:]\n\n G = [[] for _ in range(N + 1)]\n\n for v, u, c in zip(*[iter(ABC)] * 3):\n\n G[v].append((u, c)), G[u].append((v, c))\n\n dist = {v: dijkstra(G, N + 1, v) for v in visit}\n\n ans = float(\"inf\")\n\n for perm in permutations(visit):\n\n cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))\n\n ans = min(ans, cur)\n\n print(ans)\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":23,"code_v1_loc":37,"code_v0_num_chars":681,"code_v1_num_chars":1065,"code_v0_no_empty_lines":"# ABC073D - joisino's travel\nfrom itertools import permutations\nfrom scipy.sparse.csgraph import dijkstra\n\n\ndef main():\n N, M, R, *RABC = list(map(int, open(0).read().split()))\n visit, ABC = RABC[:R], RABC[R:]\n G = [[float(\"inf\")] * (N + 1) for _ in range(N + 1)]\n for v, u, c in zip(*[iter(ABC)] * 3):\n G[v][u] = G[u][v] = c\n dist = [None] * (N + 1)\n for i in range(1, N + 1):\n dist[i] = dijkstra(G, directed=0, indices=i)\n ans = float(\"inf\")\n for perm in permutations(visit):\n cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))\n ans = min(ans, cur)\n print((int(ans)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# ABC073D - joisino's travel\nfrom heapq import heapify, heappop, heappush\nfrom itertools import permutations\n\n\ndef dijkstra(G: \"Array[Array[int]]\", size: int, start: int) -> list:\n dist = [float(\"inf\")] * size\n queue = [(start, 0)]\n heapify(queue)\n while queue:\n v, cost = heappop(queue)\n if cost > dist[v]:\n continue\n dist[v] = cost\n for u, next_cost in G[v]:\n if cost + next_cost < dist[u]:\n heappush(queue, (u, cost + next_cost))\n return dist\n\n\ndef main():\n global G, N\n N, M, R, *RABC = list(map(int, open(0).read().split()))\n visit, ABC = RABC[:R], RABC[R:]\n G = [[] for _ in range(N + 1)]\n for v, u, c in zip(*[iter(ABC)] * 3):\n G[v].append((u, c)), G[u].append((v, c))\n dist = {v: dijkstra(G, N + 1, v) for v in visit}\n ans = float(\"inf\")\n for perm in permutations(visit):\n cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))\n ans = min(ans, cur)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":37.8378378378,"diff":["+from heapq import heapify, heappop, heappush","-from scipy.sparse.csgraph import dijkstra","+","+","+def dijkstra(G: \"Array[Array[int]]\", size: int, start: int) -> list:","+ dist = [float(\"inf\")] * size","+ queue = [(start, 0)]","+ heapify(queue)","+ while queue:","+ v, cost = heappop(queue)","+ if cost > dist[v]:","+ continue","+ dist[v] = cost","+ for u, next_cost in G[v]:","+ if cost + next_cost < dist[u]:","+ heappush(queue, (u, cost + next_cost))","+ return dist","+ global G, N","- G = [[float(\"inf\")] * (N + 1) for _ in range(N + 1)]","+ G = [[] for _ in range(N + 1)]","- G[v][u] = G[u][v] = c","- dist = [None] * (N + 1)","- for i in range(1, N + 1):","- dist[i] = dijkstra(G, directed=0, indices=i)","+ G[v].append((u, c)), G[u].append((v, c))","+ dist = {v: dijkstra(G, N + 1, v) for v in visit}","- print((int(ans)))","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4201774907,"measured_runtime_v1":0.045252347,"runtime_lift":9.2852088023,"key":["s331626751","s667317308"]} +{"user_id":"u797994565","problem_id":"p03457","language":"python","submission_id_v0":"s858693620","submission_id_v1":"s956335503","cpu_time_v0":358,"cpu_time_v1":214,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.22,"input":"N = int(eval(input()))\n\nt,x,y = 0,0,0\n\nfor i in range(N):\n\n T,X,Y = list(map(int,input().split()))\n\n d = abs(x-X)+abs(y-Y)\n\n if (T-t)-d >= 0 and ((T-t)-d)%2 == 0:\n\n t,x,y = T,X,Y\n\n continue\n\n else:\n\n print('No')\n\n exit()\n\nprint('Yes')","target":"import sys\n\ninput = sys.stdin.readline\n\nN = int(eval(input()))\n\nt,x,y = 0,0,0\n\nfor i in range(N):\n\n T,X,Y = list(map(int,input().split()))\n\n d = abs(x-X)+abs(y-Y)\n\n if (T-t)-d >= 0 and ((T-t)-d)%2 == 0:\n\n t,x,y = T,X,Y\n\n continue\n\n else:\n\n print('No')\n\n exit()\n\nprint('Yes')","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":262,"code_v1_num_chars":302,"code_v0_no_empty_lines":"N = int(eval(input()))\nt, x, y = 0, 0, 0\nfor i in range(N):\n T, X, Y = list(map(int, input().split()))\n d = abs(x - X) + abs(y - Y)\n if (T - t) - d >= 0 and ((T - t) - d) % 2 == 0:\n t, x, y = T, X, Y\n continue\n else:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nt, x, y = 0, 0, 0\nfor i in range(N):\n T, X, Y = list(map(int, input().split()))\n d = abs(x - X) + abs(y - Y)\n if (T - t) - d >= 0 and ((T - t) - d) % 2 == 0:\n t, x, y = T, X, Y\n continue\n else:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.0797367477,"measured_runtime_v1":0.0959208226,"runtime_lift":0.8312767297,"key":["s858693620","s956335503"]} +{"user_id":"u296518383","problem_id":"p04045","language":"python","submission_id_v0":"s991558160","submission_id_v1":"s964529910","cpu_time_v0":211,"cpu_time_v1":154,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.01,"input":"N,K=list(map(int,input().split()))\n\nD=list(map(int,input().split()))\n\nC=[]\n\n\n\nfor i in range(0,10):\n\n if i not in D:\n\n C.append(i)\n\n#print(C)\n\n\n\nfor i in range(N,10**10):\n\n cnt=0\n\n for j in list(map(int,list(str(i)))):\n\n if j in C:\n\n cnt+=1\n\n if len(str(i))==cnt:\n\n print(i)\n\n exit()","target":"N, K = list(map(int, input().split()))\n\nD = list(map(int, input().split()))\n\n\n\nfor i in range(N, 10 * N + 1):\n\n A = list(map(int, str(i)))\n\n flag = 1\n\n for a in A:\n\n if a in D:\n\n flag = 0\n\n break\n\n if flag:\n\n print(i)\n\n exit()","code_v0_loc":17,"code_v1_loc":13,"code_v0_num_chars":298,"code_v1_num_chars":243,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nD = list(map(int, input().split()))\nC = []\nfor i in range(0, 10):\n if i not in D:\n C.append(i)\n# print(C)\nfor i in range(N, 10**10):\n cnt = 0\n for j in list(map(int, list(str(i)))):\n if j in C:\n cnt += 1\n if len(str(i)) == cnt:\n print(i)\n exit()\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nD = list(map(int, input().split()))\nfor i in range(N, 10 * N + 1):\n A = list(map(int, str(i)))\n flag = 1\n for a in A:\n if a in D:\n flag = 0\n break\n if flag:\n print(i)\n exit()\n","code_same":false,"relative_loc_diff_percent":23.5294117647,"diff":["-C = []","-for i in range(0, 10):","- if i not in D:","- C.append(i)","-# print(C)","-for i in range(N, 10**10):","- cnt = 0","- for j in list(map(int, list(str(i)))):","- if j in C:","- cnt += 1","- if len(str(i)) == cnt:","+for i in range(N, 10 * N + 1):","+ A = list(map(int, str(i)))","+ flag = 1","+ for a in A:","+ if a in D:","+ flag = 0","+ break","+ if flag:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0419983864,"measured_runtime_v1":0.0431452751,"runtime_lift":0.9734179759,"key":["s991558160","s964529910"]} +{"user_id":"u699296734","problem_id":"p03681","language":"python","submission_id_v0":"s646258133","submission_id_v1":"s596757981","cpu_time_v0":447,"cpu_time_v1":51,"memory_v0":11024,"memory_v1":9152,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.59,"input":"from math import factorial as f\n\nn, m = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\nif abs(n - m) == 1:\n\n res = f(n) * f(m)\n\n print((res % mod))\n\nelif n == m:\n\n res = f(n) * f(m) * 2\n\n print((res % mod))\n\nelse:\n\n print((0))\n","target":"n, m = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef permitation(x):\n\n res = 1\n\n for i in range(1, x + 1):\n\n res = res * i % mod\n\n return res\n\n\n\n\n\npn = permitation(n)\n\npm = permitation(m)\n\n\n\nif n == m:\n\n res = pn * pm * 2 % mod\n\n print(res)\n\nelif n == m - 1 or n == m + 1:\n\n res = pn * pm % mod\n\n print(res)\n\nelse:\n\n print((0))\n","code_v0_loc":11,"code_v1_loc":22,"code_v0_num_chars":235,"code_v1_num_chars":365,"code_v0_no_empty_lines":"from math import factorial as f\n\nn, m = list(map(int, input().split()))\nmod = 10**9 + 7\nif abs(n - m) == 1:\n res = f(n) * f(m)\n print((res % mod))\nelif n == m:\n res = f(n) * f(m) * 2\n print((res % mod))\nelse:\n print((0))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nmod = 10**9 + 7\n\n\ndef permitation(x):\n res = 1\n for i in range(1, x + 1):\n res = res * i % mod\n return res\n\n\npn = permitation(n)\npm = permitation(m)\nif n == m:\n res = pn * pm * 2 % mod\n print(res)\nelif n == m - 1 or n == m + 1:\n res = pn * pm % mod\n print(res)\nelse:\n print((0))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-from math import factorial as f","-","-if abs(n - m) == 1:","- res = f(n) * f(m)","- print((res % mod))","-elif n == m:","- res = f(n) * f(m) * 2","- print((res % mod))","+","+","+def permitation(x):","+ res = 1","+ for i in range(1, x + 1):","+ res = res * i % mod","+ return res","+","+","+pn = permitation(n)","+pm = permitation(m)","+if n == m:","+ res = pn * pm * 2 % mod","+ print(res)","+elif n == m - 1 or n == m + 1:","+ res = pn * pm % mod","+ print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0781289101,"measured_runtime_v1":0.1285696983,"runtime_lift":0.6076774782,"key":["s646258133","s596757981"]} +{"user_id":"u909514237","problem_id":"p02555","language":"python","submission_id_v0":"s681314432","submission_id_v1":"s521589208","cpu_time_v0":29,"cpu_time_v1":26,"memory_v0":9060,"memory_v1":9144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.34,"input":"S = int(eval(input()))\n\nmod = 10**9 + 7\n\n\n\ndp = [0] * (S+1)\n\ndp[0] = 1\n\nx = 0\n\nfor i in range(1,S+1):\n\n if i-3 >= 0:\n\n x += dp[i-3]\n\n x %= mod\n\n dp[i] = x\n\nprint((dp[S]))","target":"S = int(eval(input()))\n\nmod = 10**9 + 7\n\n\n\ndp = [0] * (S+1)\n\ndp[0] = 1\n\nx = 0\n\nfor i in range(1,S+1):\n\n if i >= 3:\n\n x += dp[i-3]\n\n x %= mod\n\n dp[i] = x\n\nprint((dp[S]))","code_v0_loc":12,"code_v1_loc":12,"code_v0_num_chars":170,"code_v1_num_chars":168,"code_v0_no_empty_lines":"S = int(eval(input()))\nmod = 10**9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\nx = 0\nfor i in range(1, S + 1):\n if i - 3 >= 0:\n x += dp[i - 3]\n x %= mod\n dp[i] = x\nprint((dp[S]))\n","code_v1_no_empty_lines":"S = int(eval(input()))\nmod = 10**9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\nx = 0\nfor i in range(1, S + 1):\n if i >= 3:\n x += dp[i - 3]\n x %= mod\n dp[i] = x\nprint((dp[S]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if i - 3 >= 0:","+ if i >= 3:"],"diff_only_import_comment":false,"measured_runtime_v0":0.035307256,"measured_runtime_v1":0.0567672267,"runtime_lift":0.6219654902,"key":["s681314432","s521589208"]} +{"user_id":"u790710233","problem_id":"p03244","language":"python","submission_id_v0":"s877614534","submission_id_v1":"s988912856","cpu_time_v0":102,"cpu_time_v1":77,"memory_v0":21944,"memory_v1":18656,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.51,"input":"from collections import Counter\n\nn = int(eval(input()))\n\n*v, = list(map(int, input().split()))\n\n\n\nodds = v[1::2]\n\nevens = v[::2]\n\no = Counter(odds)\n\ne = Counter(evens)\n\nomx, *ol = sorted(list(o.items()), reverse=True, key=lambda x: x[1])\n\nemx, *el = sorted(list(e.items()), reverse=True, key=lambda x: x[1])\n\n\n\nif omx[0] != emx[0]:\n\n ans = n - omx[1] - emx[1]\n\nelse:\n\n if ol:\n\n ol = ol[0]\n\n else:\n\n ol = (0, 0)\n\n\n\n if el:\n\n el = el[0]\n\n else:\n\n el = (0, 0)\n\n\n\n a = n - omx[1] - el[1]\n\n b = n - emx[1] - ol[1]\n\n ans = min(a, b)\n\n\n\nprint(ans)","target":"from collections import Counter\n\nfrom itertools import product\n\nn = int(eval(input()))\n\n*v, = list(map(int, input().split()))\n\no = Counter(v[1::2])\n\ne = Counter(v[::2])\n\no[0] = 0\n\ne[0] = 0\n\no_ls = o.most_common(2)\n\ne_ls = e.most_common(2)\n\n\n\n\n\nans = n\n\nfor (k1, v1), (k2, v2) in product(o_ls, e_ls):\n\n if k1 == k2:\n\n continue\n\n x = n - v1 - v2\n\n if ans > x:\n\n ans = x\n\n\n\nprint(ans)","code_v0_loc":29,"code_v1_loc":21,"code_v0_num_chars":568,"code_v1_num_chars":392,"code_v0_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\n(*v,) = list(map(int, input().split()))\nodds = v[1::2]\nevens = v[::2]\no = Counter(odds)\ne = Counter(evens)\nomx, *ol = sorted(list(o.items()), reverse=True, key=lambda x: x[1])\nemx, *el = sorted(list(e.items()), reverse=True, key=lambda x: x[1])\nif omx[0] != emx[0]:\n ans = n - omx[1] - emx[1]\nelse:\n if ol:\n ol = ol[0]\n else:\n ol = (0, 0)\n if el:\n el = el[0]\n else:\n el = (0, 0)\n a = n - omx[1] - el[1]\n b = n - emx[1] - ol[1]\n ans = min(a, b)\nprint(ans)\n","code_v1_no_empty_lines":"from collections import Counter\nfrom itertools import product\n\nn = int(eval(input()))\n(*v,) = list(map(int, input().split()))\no = Counter(v[1::2])\ne = Counter(v[::2])\no[0] = 0\ne[0] = 0\no_ls = o.most_common(2)\ne_ls = e.most_common(2)\nans = n\nfor (k1, v1), (k2, v2) in product(o_ls, e_ls):\n if k1 == k2:\n continue\n x = n - v1 - v2\n if ans > x:\n ans = x\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":27.5862068966,"diff":["+from itertools import product","-odds = v[1::2]","-evens = v[::2]","-o = Counter(odds)","-e = Counter(evens)","-omx, *ol = sorted(list(o.items()), reverse=True, key=lambda x: x[1])","-emx, *el = sorted(list(e.items()), reverse=True, key=lambda x: x[1])","-if omx[0] != emx[0]:","- ans = n - omx[1] - emx[1]","-else:","- if ol:","- ol = ol[0]","- else:","- ol = (0, 0)","- if el:","- el = el[0]","- else:","- el = (0, 0)","- a = n - omx[1] - el[1]","- b = n - emx[1] - ol[1]","- ans = min(a, b)","+o = Counter(v[1::2])","+e = Counter(v[::2])","+o[0] = 0","+e[0] = 0","+o_ls = o.most_common(2)","+e_ls = e.most_common(2)","+ans = n","+for (k1, v1), (k2, v2) in product(o_ls, e_ls):","+ if k1 == k2:","+ continue","+ x = n - v1 - v2","+ if ans > x:","+ ans = x"],"diff_only_import_comment":false,"measured_runtime_v0":0.0379666605,"measured_runtime_v1":0.0363541913,"runtime_lift":1.0443544232,"key":["s877614534","s988912856"]} +{"user_id":"u316268279","problem_id":"p02268","language":"python","submission_id_v0":"s527269043","submission_id_v1":"s216158543","cpu_time_v0":320,"cpu_time_v1":50,"memory_v0":18592,"memory_v1":20904,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.38,"input":"#!\/usr\/bin\/env python\n\n# -*- coding: utf-8 -*-\n\n\n\ndef find(S, x):\n\n left = 0\n\n right = n\n\n\n\n while right - left >= 1:\n\n mid = (left + right)\/\/2\n\n\n\n if S[mid] == x:\n\n return True \n\n\n\n if S[mid] < x:\n\n left = mid + 1\n\n else:\n\n right = mid\n\n\n\n return False\n\n\n\nn = int(eval(input()))\n\nS = sorted(map(int,input().split()))\n\nq = int(eval(input()))\n\nT = list(map(int,input().split()))\n\n\n\ncount = 0\n\nfor t in T:\n\n if find(S, t):\n\n count += 1\n\nprint(count)","target":"#!\/usr\/bin\/env python\n\n# -*- coding: utf-8 -*-\n\n\n\nn = int(eval(input()))\n\nS = sorted(map(int,input().split()))\n\nq = int(eval(input()))\n\nT = list(map(int,input().split()))\n\n\n\nprint((len(set(S) & set(T))))","code_v0_loc":30,"code_v1_loc":9,"code_v0_num_chars":512,"code_v1_num_chars":183,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python\n# -*- coding: utf-8 -*-\ndef find(S, x):\n left = 0\n right = n\n while right - left >= 1:\n mid = (left + right) \/\/ 2\n if S[mid] == x:\n return True\n if S[mid] < x:\n left = mid + 1\n else:\n right = mid\n return False\n\n\nn = int(eval(input()))\nS = sorted(map(int, input().split()))\nq = int(eval(input()))\nT = list(map(int, input().split()))\ncount = 0\nfor t in T:\n if find(S, t):\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python\n# -*- coding: utf-8 -*-\nn = int(eval(input()))\nS = sorted(map(int, input().split()))\nq = int(eval(input()))\nT = list(map(int, input().split()))\nprint((len(set(S) & set(T))))\n","code_same":false,"relative_loc_diff_percent":70.0,"diff":["-def find(S, x):","- left = 0","- right = n","- while right - left >= 1:","- mid = (left + right) \/\/ 2","- if S[mid] == x:","- return True","- if S[mid] < x:","- left = mid + 1","- else:","- right = mid","- return False","-","-","-count = 0","-for t in T:","- if find(S, t):","- count += 1","-print(count)","+print((len(set(S) & set(T))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0362614765,"measured_runtime_v1":0.0411433311,"runtime_lift":0.8813451799,"key":["s527269043","s216158543"]} +{"user_id":"u282228874","problem_id":"p03043","language":"python","submission_id_v0":"s010735866","submission_id_v1":"s927618937","cpu_time_v0":63,"cpu_time_v1":40,"memory_v0":3188,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.51,"input":"n,k = list(map(int,input().split()))\n\nm = n\n\nl = n\n\nres = 0\n\ncnt = 0\n\ntmp = m\n\nwhile m < k:\n\n m *= 2\n\n cnt += 1\n\nres += (1\/n)*(0.5)**cnt\n\nfor i in range(1,n):\n\n cnt = 0\n\n l = n\n\n l -= i\n\n cnt = 0\n\n while l < k:\n\n l *= 2\n\n cnt += 1\n\n res += (1\/n)*(0.5)**cnt\n\nprint(res)","target":"N,K = list(map(int,input().split()))\n\nres = 0\n\nfor i in range(1,N+1):\n\n prob = 1\/N\n\n while i < K:\n\n i *= 2\n\n prob *= 0.5\n\n res += prob\n\nprint(res)\n\n\n","code_v0_loc":20,"code_v1_loc":10,"code_v0_num_chars":300,"code_v1_num_chars":166,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\nm = n\nl = n\nres = 0\ncnt = 0\ntmp = m\nwhile m < k:\n m *= 2\n cnt += 1\nres += (1 \/ n) * (0.5) ** cnt\nfor i in range(1, n):\n cnt = 0\n l = n\n l -= i\n cnt = 0\n while l < k:\n l *= 2\n cnt += 1\n res += (1 \/ n) * (0.5) ** cnt\nprint(res)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nres = 0\nfor i in range(1, N + 1):\n prob = 1 \/ N\n while i < K:\n i *= 2\n prob *= 0.5\n res += prob\nprint(res)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-n, k = list(map(int, input().split()))","-m = n","-l = n","+N, K = list(map(int, input().split()))","-cnt = 0","-tmp = m","-while m < k:","- m *= 2","- cnt += 1","-res += (1 \/ n) * (0.5) ** cnt","-for i in range(1, n):","- cnt = 0","- l = n","- l -= i","- cnt = 0","- while l < k:","- l *= 2","- cnt += 1","- res += (1 \/ n) * (0.5) ** cnt","+for i in range(1, N + 1):","+ prob = 1 \/ N","+ while i < K:","+ i *= 2","+ prob *= 0.5","+ res += prob"],"diff_only_import_comment":false,"measured_runtime_v0":0.1220318476,"measured_runtime_v1":0.1643134507,"runtime_lift":0.7426771645,"key":["s010735866","s927618937"]} +{"user_id":"u377989038","problem_id":"p03111","language":"python","submission_id_v0":"s659762784","submission_id_v1":"s059197522","cpu_time_v0":619,"cpu_time_v1":329,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.85,"input":"from itertools import product\n\nfrom collections import Counter as ct\n\n\n\nn, a, b, c = list(map(int, input().split()))\n\nl = [int(eval(input())) for _ in range(n)]\n\n\n\nans = 10 ** 10\n\nfor bit in product([0, 1, 2, 3], repeat=n):\n\n if len(set(bit) - {0}) != 3:\n\n continue\n\n tmpa = 0\n\n tmpb = 0\n\n tmpc = 0\n\n for i, j in enumerate(bit):\n\n if j == 1:\n\n tmpa += l[i]\n\n elif j == 2:\n\n tmpb += l[i]\n\n elif j == 3:\n\n tmpc += l[i]\n\n mp = abs(a - tmpa) + abs(b - tmpb) + abs(c - tmpc)\n\n tmp = ct(bit)\n\n for i in range(1, 4):\n\n mp += max(0, tmp[i] - 1) * 10\n\n ans = min(ans, mp)\n\nprint(ans)","target":"from itertools import product\n\n\n\nn, a, b, c = list(map(int, input().split()))\n\nl = [int(eval(input())) for _ in range(n)]\n\n\n\nans = 10 ** 10\n\nfor bit in product([0, 1, 2, 3], repeat=n):\n\n tmp = [0] * 4\n\n mp = 0\n\n for i, j in enumerate(bit):\n\n if j != 3 and tmp[j] != 0:\n\n mp += 10\n\n tmp[j] += l[i]\n\n if any([i == 0 for i in tmp[:3]]):\n\n continue\n\n mp += abs(a - tmp[0]) + abs(b - tmp[1]) + abs(c - tmp[2])\n\n ans = min(ans, mp)\n\nprint(ans)\n","code_v0_loc":26,"code_v1_loc":18,"code_v0_num_chars":657,"code_v1_num_chars":476,"code_v0_no_empty_lines":"from itertools import product\nfrom collections import Counter as ct\n\nn, a, b, c = list(map(int, input().split()))\nl = [int(eval(input())) for _ in range(n)]\nans = 10**10\nfor bit in product([0, 1, 2, 3], repeat=n):\n if len(set(bit) - {0}) != 3:\n continue\n tmpa = 0\n tmpb = 0\n tmpc = 0\n for i, j in enumerate(bit):\n if j == 1:\n tmpa += l[i]\n elif j == 2:\n tmpb += l[i]\n elif j == 3:\n tmpc += l[i]\n mp = abs(a - tmpa) + abs(b - tmpb) + abs(c - tmpc)\n tmp = ct(bit)\n for i in range(1, 4):\n mp += max(0, tmp[i] - 1) * 10\n ans = min(ans, mp)\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import product\n\nn, a, b, c = list(map(int, input().split()))\nl = [int(eval(input())) for _ in range(n)]\nans = 10**10\nfor bit in product([0, 1, 2, 3], repeat=n):\n tmp = [0] * 4\n mp = 0\n for i, j in enumerate(bit):\n if j != 3 and tmp[j] != 0:\n mp += 10\n tmp[j] += l[i]\n if any([i == 0 for i in tmp[:3]]):\n continue\n mp += abs(a - tmp[0]) + abs(b - tmp[1]) + abs(c - tmp[2])\n ans = min(ans, mp)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.7692307692,"diff":["-from collections import Counter as ct","- if len(set(bit) - {0}) != 3:","+ tmp = [0] * 4","+ mp = 0","+ for i, j in enumerate(bit):","+ if j != 3 and tmp[j] != 0:","+ mp += 10","+ tmp[j] += l[i]","+ if any([i == 0 for i in tmp[:3]]):","- tmpa = 0","- tmpb = 0","- tmpc = 0","- for i, j in enumerate(bit):","- if j == 1:","- tmpa += l[i]","- elif j == 2:","- tmpb += l[i]","- elif j == 3:","- tmpc += l[i]","- mp = abs(a - tmpa) + abs(b - tmpb) + abs(c - tmpc)","- tmp = ct(bit)","- for i in range(1, 4):","- mp += max(0, tmp[i] - 1) * 10","+ mp += abs(a - tmp[0]) + abs(b - tmp[1]) + abs(c - tmp[2])"],"diff_only_import_comment":false,"measured_runtime_v0":0.3210858734,"measured_runtime_v1":0.6835773847,"runtime_lift":0.4697140083,"key":["s659762784","s059197522"]} +{"user_id":"u496280557","problem_id":"p02657","language":"python","submission_id_v0":"s165262324","submission_id_v1":"s956438735","cpu_time_v0":32,"cpu_time_v1":26,"memory_v0":9064,"memory_v1":9024,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.75,"input":"a, b = list(map(int, input().split()))\n\n\n\nanswer = a * b\n\n\n\nprint(answer)\n","target":"a,b = list(map(int,input().split()))\n\n\n\nprint((a * b))","code_v0_loc":5,"code_v1_loc":3,"code_v0_num_chars":68,"code_v1_num_chars":46,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nanswer = a * b\nprint(answer)\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nprint((a * b))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-answer = a * b","-print(answer)","+print((a * b))"],"diff_only_import_comment":false,"measured_runtime_v0":0.034084796,"measured_runtime_v1":0.0357798367,"runtime_lift":0.9526258141,"key":["s165262324","s956438735"]} +{"user_id":"u690536347","problem_id":"p03778","language":"python","submission_id_v0":"s937090147","submission_id_v1":"s813490370","cpu_time_v0":40,"cpu_time_v1":27,"memory_v0":24296,"memory_v1":9176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.5,"input":"W,a,b=list(map(int,input().split()))\n\ns={i for i in range(a,a+W+1)}&{i for i in range(b,b+W+1)}\n\nif s:\n\n print((0))\n\nelse:\n\n print((min(abs(b-a-W),abs(b+W-a))))","target":"W, a, b = list(map(int, input().split()))\n\na, b = (a, b) if aS\/\/2:\n\n check=sd[nv]-num[nv]*hosei\n\n node=nv\n\n if not check:\n\n return S\/\/2\n\n else:\n\n minus=dfs2(node,v)\n\n if check-2*minus<=S-check:\n\n return S\/\/2\n\n else:\n\n return S-check+minus\n\n else:\n\n check=0\n\n node=-1\n\n k=S\/\/2\n\n for nv in edge[v]:\n\n if nv!=pv:\n\n if sd[nv]-num[nv]*hosei>k+1:\n\n check=sd[nv]-num[nv]*hosei\n\n node=nv\n\n if not check:\n\n return k\n\n else:\n\n minus=dfs2(node,v)\n\n if check-2*minus<=S-check:\n\n return k\n\n else:\n\n return S-check+minus\n\n\n\n\n\nans=10**18\n\n\n\nfor i in range(N):\n\n depth[i]=0\n\n dfs(i,-1)\n\n #print(i,depth)\n\n test=dfs2(i,-1)\n\n if test*2==sd[i]:\n\n ans=min(ans,test)\n\n\n\nif ans==10**18:\n\n print((-1))\n\nelse:\n\n print(ans)\n","target":"from collections import deque\n\n\n\nN=int(eval(input()))\n\nS=eval(input())\n\nedge=[[] for i in range(N)]\n\nfor i in range(N-1):\n\n a,b=list(map(int,input().split()))\n\n edge[a-1].append(b-1)\n\n edge[b-1].append(a-1)\n\n\n\ndepth=[0]*N\n\nnum=[0]*N\n\nsd=[0]*N\n\n\n\na=10**18\n\n\n\nfor i in range(N):\n\n depth=[0]*N\n\n num=[0]*N\n\n sd=[0]*N\n\n parent=[-1]*N\n\n\n\n que=deque([(i,-1)])\n\n ans=[i]\n\n while que:\n\n v,pv=que.popleft()\n\n for nv in edge[v]:\n\n if nv!=pv:\n\n depth[nv]=depth[v]+1\n\n parent[nv]=v\n\n que.append((nv,v))\n\n ans.append(nv)\n\n ans=ans[::-1]\n\n #print(depth)\n\n\n\n for v in ans:\n\n res=depth[v]*(S[v]==\"1\")\n\n n=int(S[v])\n\n for nv in edge[v]:\n\n if nv!=parent[v]:\n\n res+=sd[nv]\n\n n+=num[nv]\n\n sd[v],num[v]=res,n\n\n\n\n res=[0]*N\n\n\n\n for v in ans:\n\n hosei=depth[v]\n\n s=sd[v]-num[v]*hosei\n\n if s%2==0:\n\n check=0\n\n node=-1\n\n for nv in edge[v]:\n\n if nv!=parent[v]:\n\n if sd[nv]-num[nv]*hosei>s\/\/2:\n\n check=sd[nv]-num[nv]*hosei\n\n node=nv\n\n if not check:\n\n res[v]=s\/\/2\n\n else:\n\n minus=res[node]\n\n if check-2*minus<=s-check:\n\n res[v]=s\/\/2\n\n else:\n\n res[v]=s-check+minus\n\n else:\n\n check=0\n\n node=-1\n\n k=s\/\/2\n\n for nv in edge[v]:\n\n if nv!=parent[v]:\n\n if sd[nv]-num[nv]*hosei>k+1:\n\n check=sd[nv]-num[nv]*hosei\n\n node=nv\n\n if not check:\n\n res[v]=k\n\n else:\n\n minus=res[node]\n\n if check-2*minus<=s-check:\n\n res[v]=k\n\n else:\n\n res[v]=s-check+minus\n\n\n\n test=res[i]\n\n #print(i,test,sd[i],sd)\n\n if 2*test==sd[i]:\n\n a=min(a,test)\n\n\n\nif a==10**18:\n\n print((-1))\n\nelse:\n\n print(a)\n","code_v0_loc":79,"code_v1_loc":92,"code_v0_num_chars":1670,"code_v1_num_chars":2140,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**4)\nN = int(eval(input()))\nS = eval(input())\nedge = [[] for i in range(N)]\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n edge[a - 1].append(b - 1)\n edge[b - 1].append(a - 1)\ndepth = [0] * N\nnum = [0] * N\nsd = [0] * N\n\n\ndef dfs(v, pv):\n res = depth[v] * (S[v] == \"1\")\n n = int(S[v])\n for nv in edge[v]:\n if nv != pv:\n depth[nv] = depth[v] + 1\n dfs(nv, v)\n res += sd[nv]\n n += num[nv]\n sd[v] = res\n num[v] = n\n\n\ndef dfs2(v, pv):\n hosei = depth[v]\n S = sd[v] - num[v] * hosei\n if S % 2 == 0:\n check = 0\n node = -1\n for nv in edge[v]:\n if nv != pv:\n if sd[nv] - num[nv] * hosei > S \/\/ 2:\n check = sd[nv] - num[nv] * hosei\n node = nv\n if not check:\n return S \/\/ 2\n else:\n minus = dfs2(node, v)\n if check - 2 * minus <= S - check:\n return S \/\/ 2\n else:\n return S - check + minus\n else:\n check = 0\n node = -1\n k = S \/\/ 2\n for nv in edge[v]:\n if nv != pv:\n if sd[nv] - num[nv] * hosei > k + 1:\n check = sd[nv] - num[nv] * hosei\n node = nv\n if not check:\n return k\n else:\n minus = dfs2(node, v)\n if check - 2 * minus <= S - check:\n return k\n else:\n return S - check + minus\n\n\nans = 10**18\nfor i in range(N):\n depth[i] = 0\n dfs(i, -1)\n # print(i,depth)\n test = dfs2(i, -1)\n if test * 2 == sd[i]:\n ans = min(ans, test)\nif ans == 10**18:\n print((-1))\nelse:\n print(ans)\n","code_v1_no_empty_lines":"from collections import deque\n\nN = int(eval(input()))\nS = eval(input())\nedge = [[] for i in range(N)]\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n edge[a - 1].append(b - 1)\n edge[b - 1].append(a - 1)\ndepth = [0] * N\nnum = [0] * N\nsd = [0] * N\na = 10**18\nfor i in range(N):\n depth = [0] * N\n num = [0] * N\n sd = [0] * N\n parent = [-1] * N\n que = deque([(i, -1)])\n ans = [i]\n while que:\n v, pv = que.popleft()\n for nv in edge[v]:\n if nv != pv:\n depth[nv] = depth[v] + 1\n parent[nv] = v\n que.append((nv, v))\n ans.append(nv)\n ans = ans[::-1]\n # print(depth)\n for v in ans:\n res = depth[v] * (S[v] == \"1\")\n n = int(S[v])\n for nv in edge[v]:\n if nv != parent[v]:\n res += sd[nv]\n n += num[nv]\n sd[v], num[v] = res, n\n res = [0] * N\n for v in ans:\n hosei = depth[v]\n s = sd[v] - num[v] * hosei\n if s % 2 == 0:\n check = 0\n node = -1\n for nv in edge[v]:\n if nv != parent[v]:\n if sd[nv] - num[nv] * hosei > s \/\/ 2:\n check = sd[nv] - num[nv] * hosei\n node = nv\n if not check:\n res[v] = s \/\/ 2\n else:\n minus = res[node]\n if check - 2 * minus <= s - check:\n res[v] = s \/\/ 2\n else:\n res[v] = s - check + minus\n else:\n check = 0\n node = -1\n k = s \/\/ 2\n for nv in edge[v]:\n if nv != parent[v]:\n if sd[nv] - num[nv] * hosei > k + 1:\n check = sd[nv] - num[nv] * hosei\n node = nv\n if not check:\n res[v] = k\n else:\n minus = res[node]\n if check - 2 * minus <= s - check:\n res[v] = k\n else:\n res[v] = s - check + minus\n test = res[i]\n # print(i,test,sd[i],sd)\n if 2 * test == sd[i]:\n a = min(a, test)\nif a == 10**18:\n print((-1))\nelse:\n print(a)\n","code_same":false,"relative_loc_diff_percent":14.1304347826,"diff":["-import sys","+from collections import deque","-sys.setrecursionlimit(10**4)","-","-","-def dfs(v, pv):","- res = depth[v] * (S[v] == \"1\")","- n = int(S[v])","- for nv in edge[v]:","- if nv != pv:","- depth[nv] = depth[v] + 1","- dfs(nv, v)","- res += sd[nv]","- n += num[nv]","- sd[v] = res","- num[v] = n","-","-","-def dfs2(v, pv):","- hosei = depth[v]","- S = sd[v] - num[v] * hosei","- if S % 2 == 0:","- check = 0","- node = -1","+a = 10**18","+for i in range(N):","+ depth = [0] * N","+ num = [0] * N","+ sd = [0] * N","+ parent = [-1] * N","+ que = deque([(i, -1)])","+ ans = [i]","+ while que:","+ v, pv = que.popleft()","- if sd[nv] - num[nv] * hosei > S \/\/ 2:","- check = sd[nv] - num[nv] * hosei","- node = nv","- if not check:","- return S \/\/ 2","+ depth[nv] = depth[v] + 1","+ parent[nv] = v","+ que.append((nv, v))","+ ans.append(nv)","+ ans = ans[::-1]","+ # print(depth)","+ for v in ans:","+ res = depth[v] * (S[v] == \"1\")","+ n = int(S[v])","+ for nv in edge[v]:","+ if nv != parent[v]:","+ res += sd[nv]","+ n += num[nv]","+ sd[v], num[v] = res, n","+ res = [0] * N","+ for v in ans:","+ hosei = depth[v]","+ s = sd[v] - num[v] * hosei","+ if s % 2 == 0:","+ check = 0","+ node = -1","+ for nv in edge[v]:","+ if nv != parent[v]:","+ if sd[nv] - num[nv] * hosei > s \/\/ 2:","+ check = sd[nv] - num[nv] * hosei","+ node = nv","+ if not check:","+ res[v] = s \/\/ 2","+ else:","+ minus = res[node]","+ if check - 2 * minus <= s - check:","+ res[v] = s \/\/ 2","+ else:","+ res[v] = s - check + minus","- minus = dfs2(node, v)","- if check - 2 * minus <= S - check:","- return S \/\/ 2","+ check = 0","+ node = -1","+ k = s \/\/ 2","+ for nv in edge[v]:","+ if nv != parent[v]:","+ if sd[nv] - num[nv] * hosei > k + 1:","+ check = sd[nv] - num[nv] * hosei","+ node = nv","+ if not check:","+ res[v] = k","- return S - check + minus","- else:","- check = 0","- node = -1","- k = S \/\/ 2","- for nv in edge[v]:","- if nv != pv:","- if sd[nv] - num[nv] * hosei > k + 1:","- check = sd[nv] - num[nv] * hosei","- node = nv","- if not check:","- return k","- else:","- minus = dfs2(node, v)","- if check - 2 * minus <= S - check:","- return k","- else:","- return S - check + minus","-","-","-ans = 10**18","-for i in range(N):","- depth[i] = 0","- dfs(i, -1)","- # print(i,depth)","- test = dfs2(i, -1)","- if test * 2 == sd[i]:","- ans = min(ans, test)","-if ans == 10**18:","+ minus = res[node]","+ if check - 2 * minus <= s - check:","+ res[v] = k","+ else:","+ res[v] = s - check + minus","+ test = res[i]","+ # print(i,test,sd[i],sd)","+ if 2 * test == sd[i]:","+ a = min(a, test)","+if a == 10**18:","- print(ans)","+ print(a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0423114228,"measured_runtime_v1":0.0393096075,"runtime_lift":1.0763634007,"key":["s138692793","s432164511"]} +{"user_id":"u692453235","problem_id":"p02727","language":"python","submission_id_v0":"s829315068","submission_id_v1":"s339578939","cpu_time_v0":761,"cpu_time_v1":163,"memory_v0":117664,"memory_v1":108436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.58,"input":"X, Y, A, B, C = list(map(int, input().split()))\n\nAp = list([(int(x), 0) for x in input().split()])\n\nBq = list([(int(x), 1) for x in input().split()])\n\nCr = list([(int(x), 2) for x in input().split()])\n\n\n\nINF = 2 * 10**5 + 1\n\n\n\nL = Ap + Bq + Cr\n\nL.sort(reverse = True)\n\n\n\ncnt = [0, 0, 0]\n\ncntM = [X, Y, INF]\n\ns = 0\n\n\n\nans = 0\n\n\n\nfor x, i in L:\n\n if s == X + Y:\n\n break\n\n elif cnt[i] < cntM[i]:\n\n ans += x\n\n cnt[i] += 1\n\n s += 1\n\n else:\n\n pass\n\n\n\nprint(ans)","target":"X, Y, A, B, C = list(map(int, input().split()))\n\nAp = list(map(int, input().split()))\n\nBq = list(map(int, input().split()))\n\nCr = list(map(int, input().split()))\n\n\n\nAp.sort(reverse = True)\n\nBq.sort(reverse = True)\n\n\n\nL = sorted(Ap[:X] + Bq[:Y] + Cr, reverse = True)\n\n\n\nprint((sum(L[:X+Y])))","code_v0_loc":27,"code_v1_loc":11,"code_v0_num_chars":482,"code_v1_num_chars":282,"code_v0_no_empty_lines":"X, Y, A, B, C = list(map(int, input().split()))\nAp = list([(int(x), 0) for x in input().split()])\nBq = list([(int(x), 1) for x in input().split()])\nCr = list([(int(x), 2) for x in input().split()])\nINF = 2 * 10**5 + 1\nL = Ap + Bq + Cr\nL.sort(reverse=True)\ncnt = [0, 0, 0]\ncntM = [X, Y, INF]\ns = 0\nans = 0\nfor x, i in L:\n if s == X + Y:\n break\n elif cnt[i] < cntM[i]:\n ans += x\n cnt[i] += 1\n s += 1\n else:\n pass\nprint(ans)\n","code_v1_no_empty_lines":"X, Y, A, B, C = list(map(int, input().split()))\nAp = list(map(int, input().split()))\nBq = list(map(int, input().split()))\nCr = list(map(int, input().split()))\nAp.sort(reverse=True)\nBq.sort(reverse=True)\nL = sorted(Ap[:X] + Bq[:Y] + Cr, reverse=True)\nprint((sum(L[: X + Y])))\n","code_same":false,"relative_loc_diff_percent":59.2592592593,"diff":["-Ap = list([(int(x), 0) for x in input().split()])","-Bq = list([(int(x), 1) for x in input().split()])","-Cr = list([(int(x), 2) for x in input().split()])","-INF = 2 * 10**5 + 1","-L = Ap + Bq + Cr","-L.sort(reverse=True)","-cnt = [0, 0, 0]","-cntM = [X, Y, INF]","-s = 0","-ans = 0","-for x, i in L:","- if s == X + Y:","- break","- elif cnt[i] < cntM[i]:","- ans += x","- cnt[i] += 1","- s += 1","- else:","- pass","-print(ans)","+Ap = list(map(int, input().split()))","+Bq = list(map(int, input().split()))","+Cr = list(map(int, input().split()))","+Ap.sort(reverse=True)","+Bq.sort(reverse=True)","+L = sorted(Ap[:X] + Bq[:Y] + Cr, reverse=True)","+print((sum(L[: X + Y])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.039538363,"measured_runtime_v1":0.040704371,"runtime_lift":0.9713542311,"key":["s829315068","s339578939"]} +{"user_id":"u736443076","problem_id":"p02583","language":"python","submission_id_v0":"s982496112","submission_id_v1":"s984451798","cpu_time_v0":141,"cpu_time_v1":64,"memory_v0":9196,"memory_v1":9144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.61,"input":"n = int(eval(input()))\n\nl = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n-2):\n\n for j in range(i + 1, n-1):\n\n for k in range(j + 1, n):\n\n if len({l[i], l[j], l[k]}) != 3:\n\n continue\n\n if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[j] + l[k] > l[i]:\n\n ans += 1\n\nprint(ans)\n","target":"from itertools import combinations\n\n\n\nn = int(eval(input()))\n\nl = list(map(int, input().split()))\n\nl.sort()\n\nans = 0\n\n\n\nfor li, lj, lk in combinations(l, 3):\n\n if li < lj < lk < li + lj:\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":11,"code_v1_loc":11,"code_v0_num_chars":345,"code_v1_num_chars":214,"code_v0_no_empty_lines":"n = int(eval(input()))\nl = list(map(int, input().split()))\nans = 0\nfor i in range(n - 2):\n for j in range(i + 1, n - 1):\n for k in range(j + 1, n):\n if len({l[i], l[j], l[k]}) != 3:\n continue\n if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[j] + l[k] > l[i]:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import combinations\n\nn = int(eval(input()))\nl = list(map(int, input().split()))\nl.sort()\nans = 0\nfor li, lj, lk in combinations(l, 3):\n if li < lj < lk < li + lj:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+from itertools import combinations","+","+l.sort()","-for i in range(n - 2):","- for j in range(i + 1, n - 1):","- for k in range(j + 1, n):","- if len({l[i], l[j], l[k]}) != 3:","- continue","- if l[i] + l[j] > l[k] and l[i] + l[k] > l[j] and l[j] + l[k] > l[i]:","- ans += 1","+for li, lj, lk in combinations(l, 3):","+ if li < lj < lk < li + lj:","+ ans += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.037775249,"measured_runtime_v1":0.1028147304,"runtime_lift":0.3674108647,"key":["s982496112","s984451798"]} +{"user_id":"u562935282","problem_id":"p03994","language":"python","submission_id_v0":"s206497318","submission_id_v1":"s283120271","cpu_time_v0":70,"cpu_time_v1":61,"memory_v0":4092,"memory_v1":4088,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.86,"input":"from string import ascii_lowercase\n\n\n\ns = eval(input())\n\nk = int(eval(input()))\n\n\n\nb = ord('a')\n\n\n\nret = ''\n\nfor c in s[:-1]:\n\n if c == 'a':\n\n ret += 'a'\n\n continue\n\n need = 26 - (ord(c) - b)\n\n if k >= need:\n\n k -= need\n\n ret += 'a'\n\n else:\n\n ret += c\n\n\n\nk %= 26\n\n\n\nc = s[-1]\n\nret += chr((ord(c) - b + k) % 26 + b)\n\n\n\nprint(ret)\n","target":"from string import ascii_lowercase\n\n\n\ns = eval(input())\n\nk = int(eval(input()))\n\n\n\nd = {c: (26 - i) % 26 for i, c in enumerate(ascii_lowercase)}\n\n\n\nret = ''\n\nfor c in s[:-1]:\n\n if d[c] <= k:\n\n k -= d[c]\n\n ret += 'a'\n\n else:\n\n ret += c\n\n\n\nk %= 26\n\nidx = (ascii_lowercase.index(s[-1]) + k) % 26\n\nc = ascii_lowercase[idx]\n\nret += c\n\n\n\nprint(ret)\n","code_v0_loc":25,"code_v1_loc":21,"code_v0_num_chars":364,"code_v1_num_chars":358,"code_v0_no_empty_lines":"from string import ascii_lowercase\n\ns = eval(input())\nk = int(eval(input()))\nb = ord(\"a\")\nret = \"\"\nfor c in s[:-1]:\n if c == \"a\":\n ret += \"a\"\n continue\n need = 26 - (ord(c) - b)\n if k >= need:\n k -= need\n ret += \"a\"\n else:\n ret += c\nk %= 26\nc = s[-1]\nret += chr((ord(c) - b + k) % 26 + b)\nprint(ret)\n","code_v1_no_empty_lines":"from string import ascii_lowercase\n\ns = eval(input())\nk = int(eval(input()))\nd = {c: (26 - i) % 26 for i, c in enumerate(ascii_lowercase)}\nret = \"\"\nfor c in s[:-1]:\n if d[c] <= k:\n k -= d[c]\n ret += \"a\"\n else:\n ret += c\nk %= 26\nidx = (ascii_lowercase.index(s[-1]) + k) % 26\nc = ascii_lowercase[idx]\nret += c\nprint(ret)\n","code_same":false,"relative_loc_diff_percent":16.0,"diff":["-b = ord(\"a\")","+d = {c: (26 - i) % 26 for i, c in enumerate(ascii_lowercase)}","- if c == \"a\":","- ret += \"a\"","- continue","- need = 26 - (ord(c) - b)","- if k >= need:","- k -= need","+ if d[c] <= k:","+ k -= d[c]","-c = s[-1]","-ret += chr((ord(c) - b + k) % 26 + b)","+idx = (ascii_lowercase.index(s[-1]) + k) % 26","+c = ascii_lowercase[idx]","+ret += c"],"diff_only_import_comment":false,"measured_runtime_v0":0.04391219,"measured_runtime_v1":0.047738405,"runtime_lift":0.9198503796,"key":["s206497318","s283120271"]} +{"user_id":"u340781749","problem_id":"p02840","language":"python","submission_id_v0":"s531656560","submission_id_v1":"s836215151","cpu_time_v0":474,"cpu_time_v1":342,"memory_v0":42184,"memory_v1":69148,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.85,"input":"from fractions import gcd\n\nfrom itertools import accumulate\n\n\n\nn, x, d = list(map(int, input().split()))\n\n\n\nif d == 0:\n\n if x == 0:\n\n print((1))\n\n else:\n\n print((n + 1))\n\n exit()\n\nelif d < 0:\n\n x, d = -x, -d\n\n\n\ng = gcd(x, d)\n\nback_k = d \/\/ g\n\noffset = x \/\/ g\n\n\n\nlowers = [0] + list(accumulate(list(range(n))))\n\nuppers = [0] + list(accumulate(list(range(n - 1, -1, -1))))\n\nmin_memo = [10 ** 18] * min(n + 1, back_k)\n\nmax_memo = [-(10 ** 18)] * min(n + 1, back_k)\n\n# print(n, x, d, g, back_k, offset)\n\n# print(lowers)\n\n# print(uppers)\n\n\n\nans = 0\n\nfor k in range(n + 1):\n\n min_acc = lowers[k]\n\n max_acc = uppers[k]\n\n\n\n if k < back_k:\n\n min_memo[k] = min_acc - offset\n\n max_memo[k] = max_acc - offset\n\n ans += max_acc - min_acc + 1\n\n # print(k, ans, min_acc, max_acc, max_acc - min_acc + 1)\n\n continue\n\n\n\n kk = k % back_k\n\n back_min = min_memo[kk]\n\n back_max = max_memo[kk]\n\n\n\n if back_max < min_acc or max_acc < back_min:\n\n min_memo[kk] = min_acc - offset\n\n max_memo[kk] = max_acc - offset\n\n ans += max_acc - min_acc + 1\n\n else:\n\n current = max_acc - min_acc + 1\n\n duplicated = min(max_acc, back_max) - max(min_acc, back_min) + 1\n\n ans += current - duplicated\n\n min_memo[kk] = min(min_acc, back_min) - offset\n\n max_memo[kk] = max(max_acc, back_max) - offset\n\n\n\n # print(k, ans, min_acc, max_acc, back_min, back_max)\n\n\n\nprint(ans)\n","target":"from fractions import gcd\n\nfrom itertools import accumulate\n\n\n\n\n\ndef solve(n, x, d):\n\n if d == 0:\n\n return 1 if x == 0 else n + 1\n\n elif d < 0:\n\n x, d = -x, -d\n\n\n\n g = gcd(x, d)\n\n x \/\/= g\n\n d \/\/= g\n\n\n\n lowers = [0] + list(accumulate(list(range(n))))\n\n uppers = [0] + list(accumulate(list(range(n - 1, -1, -1))))\n\n ans = 0\n\n for k_mod in range(min(n + 1, d)):\n\n k = k_mod\n\n offset = 0\n\n endpoints = []\n\n while k <= n:\n\n endpoints.append((lowers[k] + offset, 0))\n\n endpoints.append((uppers[k] + offset, 1))\n\n k += d\n\n offset += x\n\n endpoints.sort()\n\n opening = 0\n\n current_left = 0\n\n for s, t in endpoints:\n\n if t == 0:\n\n if opening == 0:\n\n current_left = s\n\n opening += 1\n\n else:\n\n opening -= 1\n\n if opening == 0:\n\n ans += s - current_left + 1\n\n\n\n return ans\n\n\n\n\n\nn, x, d = list(map(int, input().split()))\n\nprint((solve(n, x, d)))\n","code_v0_loc":56,"code_v1_loc":44,"code_v0_num_chars":1449,"code_v1_num_chars":1074,"code_v0_no_empty_lines":"from fractions import gcd\nfrom itertools import accumulate\n\nn, x, d = list(map(int, input().split()))\nif d == 0:\n if x == 0:\n print((1))\n else:\n print((n + 1))\n exit()\nelif d < 0:\n x, d = -x, -d\ng = gcd(x, d)\nback_k = d \/\/ g\noffset = x \/\/ g\nlowers = [0] + list(accumulate(list(range(n))))\nuppers = [0] + list(accumulate(list(range(n - 1, -1, -1))))\nmin_memo = [10**18] * min(n + 1, back_k)\nmax_memo = [-(10**18)] * min(n + 1, back_k)\n# print(n, x, d, g, back_k, offset)\n# print(lowers)\n# print(uppers)\nans = 0\nfor k in range(n + 1):\n min_acc = lowers[k]\n max_acc = uppers[k]\n if k < back_k:\n min_memo[k] = min_acc - offset\n max_memo[k] = max_acc - offset\n ans += max_acc - min_acc + 1\n # print(k, ans, min_acc, max_acc, max_acc - min_acc + 1)\n continue\n kk = k % back_k\n back_min = min_memo[kk]\n back_max = max_memo[kk]\n if back_max < min_acc or max_acc < back_min:\n min_memo[kk] = min_acc - offset\n max_memo[kk] = max_acc - offset\n ans += max_acc - min_acc + 1\n else:\n current = max_acc - min_acc + 1\n duplicated = min(max_acc, back_max) - max(min_acc, back_min) + 1\n ans += current - duplicated\n min_memo[kk] = min(min_acc, back_min) - offset\n max_memo[kk] = max(max_acc, back_max) - offset\n # print(k, ans, min_acc, max_acc, back_min, back_max)\nprint(ans)\n","code_v1_no_empty_lines":"from fractions import gcd\nfrom itertools import accumulate\n\n\ndef solve(n, x, d):\n if d == 0:\n return 1 if x == 0 else n + 1\n elif d < 0:\n x, d = -x, -d\n g = gcd(x, d)\n x \/\/= g\n d \/\/= g\n lowers = [0] + list(accumulate(list(range(n))))\n uppers = [0] + list(accumulate(list(range(n - 1, -1, -1))))\n ans = 0\n for k_mod in range(min(n + 1, d)):\n k = k_mod\n offset = 0\n endpoints = []\n while k <= n:\n endpoints.append((lowers[k] + offset, 0))\n endpoints.append((uppers[k] + offset, 1))\n k += d\n offset += x\n endpoints.sort()\n opening = 0\n current_left = 0\n for s, t in endpoints:\n if t == 0:\n if opening == 0:\n current_left = s\n opening += 1\n else:\n opening -= 1\n if opening == 0:\n ans += s - current_left + 1\n return ans\n\n\nn, x, d = list(map(int, input().split()))\nprint((solve(n, x, d)))\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["+","+def solve(n, x, d):","+ if d == 0:","+ return 1 if x == 0 else n + 1","+ elif d < 0:","+ x, d = -x, -d","+ g = gcd(x, d)","+ x \/\/= g","+ d \/\/= g","+ lowers = [0] + list(accumulate(list(range(n))))","+ uppers = [0] + list(accumulate(list(range(n - 1, -1, -1))))","+ ans = 0","+ for k_mod in range(min(n + 1, d)):","+ k = k_mod","+ offset = 0","+ endpoints = []","+ while k <= n:","+ endpoints.append((lowers[k] + offset, 0))","+ endpoints.append((uppers[k] + offset, 1))","+ k += d","+ offset += x","+ endpoints.sort()","+ opening = 0","+ current_left = 0","+ for s, t in endpoints:","+ if t == 0:","+ if opening == 0:","+ current_left = s","+ opening += 1","+ else:","+ opening -= 1","+ if opening == 0:","+ ans += s - current_left + 1","+ return ans","+","+","-if d == 0:","- if x == 0:","- print((1))","- else:","- print((n + 1))","- exit()","-elif d < 0:","- x, d = -x, -d","-g = gcd(x, d)","-back_k = d \/\/ g","-offset = x \/\/ g","-lowers = [0] + list(accumulate(list(range(n))))","-uppers = [0] + list(accumulate(list(range(n - 1, -1, -1))))","-min_memo = [10**18] * min(n + 1, back_k)","-max_memo = [-(10**18)] * min(n + 1, back_k)","-# print(n, x, d, g, back_k, offset)","-# print(lowers)","-# print(uppers)","-ans = 0","-for k in range(n + 1):","- min_acc = lowers[k]","- max_acc = uppers[k]","- if k < back_k:","- min_memo[k] = min_acc - offset","- max_memo[k] = max_acc - offset","- ans += max_acc - min_acc + 1","- # print(k, ans, min_acc, max_acc, max_acc - min_acc + 1)","- continue","- kk = k % back_k","- back_min = min_memo[kk]","- back_max = max_memo[kk]","- if back_max < min_acc or max_acc < back_min:","- min_memo[kk] = min_acc - offset","- max_memo[kk] = max_acc - offset","- ans += max_acc - min_acc + 1","- else:","- current = max_acc - min_acc + 1","- duplicated = min(max_acc, back_max) - max(min_acc, back_min) + 1","- ans += current - duplicated","- min_memo[kk] = min(min_acc, back_min) - offset","- max_memo[kk] = max(max_acc, back_max) - offset","- # print(k, ans, min_acc, max_acc, back_min, back_max)","-print(ans)","+print((solve(n, x, d)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0637724419,"measured_runtime_v1":0.0577899997,"runtime_lift":1.1035203696,"key":["s531656560","s836215151"]} +{"user_id":"u349449706","problem_id":"p02585","language":"python","submission_id_v0":"s933477039","submission_id_v1":"s729930821","cpu_time_v0":735,"cpu_time_v1":629,"memory_v0":282212,"memory_v1":95900,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.42,"input":"N, K = list(map(int, input().split()))\n\nP, C = [list(map(int, input().split())) for _ in range(2)]\n\nc = [1] * N\n\nm = [[0] * (N+1) for i in range(N)]\n\nfor i in range(N):\n\n m[i][1] = (C[P[i]-1])\n\nans = max(C)\n\nfor i in range(N):\n\n j = i\n\n while P[j]-1 != i:\n\n j = P[j]-1\n\n c[i] += 1\n\n m[i][c[i]] = m[i][c[i]-1] + C[P[j]-1]\n\n if m[i][c[i]] > 0:\n\n ans = max(ans, m[i][c[i]] * (K\/\/c[i]-1) + max(m[i] + [m[i][c[i]] + m[i][j+1] for j in range(K%c[i])]))\n\n else:\n\n ans = max(ans, max(m[i][1:min(c[i],K)+1]))\n\nprint(ans)\n","target":"N, K = list(map(int, input().split()))\n\nP, C = [list(map(int, input().split())) for _ in range(2)]\n\nans = max(C)\n\nfor i in range(N):\n\n m = [0] * (N+1)\n\n k = i\n\n for j in range(N):\n\n m[j+1] = m[j] + C[k]\n\n k = P[k]-1\n\n if k == i:\n\n break\n\n if m[j+1] > 0:\n\n ans = max(ans, m[j+1] * (K\/\/(j+1)-1) + max(m + [m[j+1] + m[k+1] for k in range(K%(j+1))]))\n\n else:\n\n ans = max(ans, max(m[1:min(j+1,K)+1]))\n\nprint(ans)\n","code_v0_loc":18,"code_v1_loc":16,"code_v0_num_chars":556,"code_v1_num_chars":463,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nP, C = [list(map(int, input().split())) for _ in range(2)]\nc = [1] * N\nm = [[0] * (N + 1) for i in range(N)]\nfor i in range(N):\n m[i][1] = C[P[i] - 1]\nans = max(C)\nfor i in range(N):\n j = i\n while P[j] - 1 != i:\n j = P[j] - 1\n c[i] += 1\n m[i][c[i]] = m[i][c[i] - 1] + C[P[j] - 1]\n if m[i][c[i]] > 0:\n ans = max(\n ans,\n m[i][c[i]] * (K \/\/ c[i] - 1)\n + max(m[i] + [m[i][c[i]] + m[i][j + 1] for j in range(K % c[i])]),\n )\n else:\n ans = max(ans, max(m[i][1 : min(c[i], K) + 1]))\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nP, C = [list(map(int, input().split())) for _ in range(2)]\nans = max(C)\nfor i in range(N):\n m = [0] * (N + 1)\n k = i\n for j in range(N):\n m[j + 1] = m[j] + C[k]\n k = P[k] - 1\n if k == i:\n break\n if m[j + 1] > 0:\n ans = max(\n ans,\n m[j + 1] * (K \/\/ (j + 1) - 1)\n + max(m + [m[j + 1] + m[k + 1] for k in range(K % (j + 1))]),\n )\n else:\n ans = max(ans, max(m[1 : min(j + 1, K) + 1]))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-c = [1] * N","-m = [[0] * (N + 1) for i in range(N)]","-for i in range(N):","- m[i][1] = C[P[i] - 1]","- j = i","- while P[j] - 1 != i:","- j = P[j] - 1","- c[i] += 1","- m[i][c[i]] = m[i][c[i] - 1] + C[P[j] - 1]","- if m[i][c[i]] > 0:","+ m = [0] * (N + 1)","+ k = i","+ for j in range(N):","+ m[j + 1] = m[j] + C[k]","+ k = P[k] - 1","+ if k == i:","+ break","+ if m[j + 1] > 0:","- m[i][c[i]] * (K \/\/ c[i] - 1)","- + max(m[i] + [m[i][c[i]] + m[i][j + 1] for j in range(K % c[i])]),","+ m[j + 1] * (K \/\/ (j + 1) - 1)","+ + max(m + [m[j + 1] + m[k + 1] for k in range(K % (j + 1))]),","- ans = max(ans, max(m[i][1 : min(c[i], K) + 1]))","+ ans = max(ans, max(m[1 : min(j + 1, K) + 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0755715852,"measured_runtime_v1":0.1005495689,"runtime_lift":0.7515853723,"key":["s933477039","s729930821"]} +{"user_id":"u690536347","problem_id":"p02661","language":"python","submission_id_v0":"s031312527","submission_id_v1":"s093402731","cpu_time_v0":599,"cpu_time_v1":464,"memory_v0":48884,"memory_v1":25336,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.54,"input":"N = int(eval(input()))\n\nl = []\n\nfor _ in range(N):\n\n A, B = list(map(int, input().split()))\n\n l.append((A, B))\n\n\n\nt = N\/\/2\n\ntl = sorted(l)\n\ntr = sorted(l, key=lambda x:-x[1])\n\n\n\nif N%2:\n\n print((tr[t][1]-tl[t][0]+1))\n\nelse:\n\n a1, a2 = tl[t-1][0], tr[t][1]\n\n a3, a4 = tl[t][0], tr[t-1][1]\n\n print((a4-a3+a2-a1+1))\n","target":"N = int(eval(input()))\n\nt = N\/\/2\n\nla, lb = [], []\n\nfor _ in range(N):\n\n A, B = list(map(int, input().split()))\n\n la.append(A)\n\n lb.append(B)\n\nla.sort()\n\nlb.sort()\n\nprint((lb[t]-la[t]+1 if N%2 else lb[t-1]-la[t]+lb[t]-la[t-1]+1))\n","code_v0_loc":16,"code_v1_loc":10,"code_v0_num_chars":315,"code_v1_num_chars":224,"code_v0_no_empty_lines":"N = int(eval(input()))\nl = []\nfor _ in range(N):\n A, B = list(map(int, input().split()))\n l.append((A, B))\nt = N \/\/ 2\ntl = sorted(l)\ntr = sorted(l, key=lambda x: -x[1])\nif N % 2:\n print((tr[t][1] - tl[t][0] + 1))\nelse:\n a1, a2 = tl[t - 1][0], tr[t][1]\n a3, a4 = tl[t][0], tr[t - 1][1]\n print((a4 - a3 + a2 - a1 + 1))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nt = N \/\/ 2\nla, lb = [], []\nfor _ in range(N):\n A, B = list(map(int, input().split()))\n la.append(A)\n lb.append(B)\nla.sort()\nlb.sort()\nprint((lb[t] - la[t] + 1 if N % 2 else lb[t - 1] - la[t] + lb[t] - la[t - 1] + 1))\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-l = []","+t = N \/\/ 2","+la, lb = [], []","- l.append((A, B))","-t = N \/\/ 2","-tl = sorted(l)","-tr = sorted(l, key=lambda x: -x[1])","-if N % 2:","- print((tr[t][1] - tl[t][0] + 1))","-else:","- a1, a2 = tl[t - 1][0], tr[t][1]","- a3, a4 = tl[t][0], tr[t - 1][1]","- print((a4 - a3 + a2 - a1 + 1))","+ la.append(A)","+ lb.append(B)","+la.sort()","+lb.sort()","+print((lb[t] - la[t] + 1 if N % 2 else lb[t - 1] - la[t] + lb[t] - la[t - 1] + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0940483857,"measured_runtime_v1":0.0458626451,"runtime_lift":2.0506533266,"key":["s031312527","s093402731"]} +{"user_id":"u423665486","problem_id":"p02684","language":"python","submission_id_v0":"s882379844","submission_id_v1":"s981093962","cpu_time_v0":373,"cpu_time_v1":134,"memory_v0":230492,"memory_v1":32380,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.08,"input":"import sys\n\nfrom io import StringIO\n\nimport unittest\n\n\n\nsys.setrecursionlimit(10**6)\n\ndef search(n, step, rec, seq, k):\n\n\tif rec[n] != -1:\n\n\t\tc = step - rec[n]\n\n\t\tsim = (k - rec[n]) % c\n\n\t\tv = n\n\n\t\tfor i in range(sim):\n\n\t\t\tv = seq[v-1]\n\n\t\tprint(v)\n\n\t\treturn\n\n\trec[n] = step\n\n\tif step == k:\n\n\t\tprint(n)\n\n\t\treturn\n\n\tsearch(seq[n-1], step + 1, rec, seq, k)\n\ndef resolve():\n\n\tn, k = list(map(int, input().split()))\n\n\tseq = list(map(int, input().split()))\n\n\trec = [-1]*(n+1)\n\n\tsearch(1, 0, rec, seq, k)\n\n\n\nresolve()","target":"def resolve():\n\n\tn, k = list(map(int, input().split()))\n\n\ta = list(map(int, input().split()))\n\n\trec = [True]*(n+2)\n\n\tnow = 0\n\n\tstp = [1]\n\n\n\n\twhile rec[now]:\n\n\t\trec[now] = False\n\n\t\tnow = a[now] - 1\n\n\t\tstp.append(now+1)\n\n\tbefore_loop = stp.index(now+1)\n\n\tloop = stp[before_loop:-1]\n\n\tif k <= (before_loop + 1):\n\n\t\tprint((stp[k]))\n\n\telse:\n\n\t\tr = (k - before_loop) % len(loop)\n\n\t\tprint((loop[r]))\n\nresolve()","code_v0_loc":26,"code_v1_loc":19,"code_v0_num_chars":504,"code_v1_num_chars":393,"code_v0_no_empty_lines":"import sys\nfrom io import StringIO\nimport unittest\n\nsys.setrecursionlimit(10**6)\n\n\ndef search(n, step, rec, seq, k):\n if rec[n] != -1:\n c = step - rec[n]\n sim = (k - rec[n]) % c\n v = n\n for i in range(sim):\n v = seq[v - 1]\n print(v)\n return\n rec[n] = step\n if step == k:\n print(n)\n return\n search(seq[n - 1], step + 1, rec, seq, k)\n\n\ndef resolve():\n n, k = list(map(int, input().split()))\n seq = list(map(int, input().split()))\n rec = [-1] * (n + 1)\n search(1, 0, rec, seq, k)\n\n\nresolve()\n","code_v1_no_empty_lines":"def resolve():\n n, k = list(map(int, input().split()))\n a = list(map(int, input().split()))\n rec = [True] * (n + 2)\n now = 0\n stp = [1]\n while rec[now]:\n rec[now] = False\n now = a[now] - 1\n stp.append(now + 1)\n before_loop = stp.index(now + 1)\n loop = stp[before_loop:-1]\n if k <= (before_loop + 1):\n print((stp[k]))\n else:\n r = (k - before_loop) % len(loop)\n print((loop[r]))\n\n\nresolve()\n","code_same":false,"relative_loc_diff_percent":26.9230769231,"diff":["-import sys","-from io import StringIO","-import unittest","-","-sys.setrecursionlimit(10**6)","-","-","-def search(n, step, rec, seq, k):","- if rec[n] != -1:","- c = step - rec[n]","- sim = (k - rec[n]) % c","- v = n","- for i in range(sim):","- v = seq[v - 1]","- print(v)","- return","- rec[n] = step","- if step == k:","- print(n)","- return","- search(seq[n - 1], step + 1, rec, seq, k)","-","-","- seq = list(map(int, input().split()))","- rec = [-1] * (n + 1)","- search(1, 0, rec, seq, k)","+ a = list(map(int, input().split()))","+ rec = [True] * (n + 2)","+ now = 0","+ stp = [1]","+ while rec[now]:","+ rec[now] = False","+ now = a[now] - 1","+ stp.append(now + 1)","+ before_loop = stp.index(now + 1)","+ loop = stp[before_loop:-1]","+ if k <= (before_loop + 1):","+ print((stp[k]))","+ else:","+ r = (k - before_loop) % len(loop)","+ print((loop[r]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0417376314,"measured_runtime_v1":0.0354771054,"runtime_lift":1.176466652,"key":["s882379844","s981093962"]} +{"user_id":"u270144704","problem_id":"p02792","language":"python","submission_id_v0":"s572342709","submission_id_v1":"s953995290","cpu_time_v0":251,"cpu_time_v1":220,"memory_v0":41964,"memory_v1":40428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.35,"input":"N = int(eval(input()))\n\nN_ = str(N)\n\nf_N, l_N = int(N_[0]), int(N_[-1])\n\ndigit = len(N_)\n\nif digit > 2:\n\n inter_N = int(N_[1:digit-1])\n\ncnt = 0\n\nfor num in range(1, N+1):\n\n num = str(num)\n\n f, l = int(num[-1]), int(num[0])\n\n if f == 0:\n\n continue\n\n for i in range(1, digit+1):\n\n if i == 1:\n\n if f == l:\n\n cnt += 1\n\n else:\n\n continue\n\n else:\n\n if i != digit:\n\n cnt += 10**(i-2)\n\n elif digit == 2 and i == digit:\n\n if f*10+l <= N:\n\n cnt += 1\n\n else:\n\n continue\n\n else:\n\n if f > f_N:\n\n continue\n\n elif f == f_N:\n\n if l > l_N:\n\n cnt += inter_N\n\n elif l <= l_N:\n\n cnt += (inter_N+1)\n\n else:\n\n cnt += 10**(i-2)\n\nprint(cnt)","target":"N = int(eval(input()))\n\ncnt = [[0] * 10 for i in range(10)]\n\nfor n in range(1, N + 1):\n\n cnt[int(str(n)[0])][int(str(n)[-1])] += 1\n\n\n\nans = 0\n\nfor i in range(10):\n\n for j in range(10):\n\n ans += cnt[i][j] * cnt[j][i]\n\n\n\nprint(ans)","code_v0_loc":37,"code_v1_loc":11,"code_v0_num_chars":981,"code_v1_num_chars":236,"code_v0_no_empty_lines":"N = int(eval(input()))\nN_ = str(N)\nf_N, l_N = int(N_[0]), int(N_[-1])\ndigit = len(N_)\nif digit > 2:\n inter_N = int(N_[1 : digit - 1])\ncnt = 0\nfor num in range(1, N + 1):\n num = str(num)\n f, l = int(num[-1]), int(num[0])\n if f == 0:\n continue\n for i in range(1, digit + 1):\n if i == 1:\n if f == l:\n cnt += 1\n else:\n continue\n else:\n if i != digit:\n cnt += 10 ** (i - 2)\n elif digit == 2 and i == digit:\n if f * 10 + l <= N:\n cnt += 1\n else:\n continue\n else:\n if f > f_N:\n continue\n elif f == f_N:\n if l > l_N:\n cnt += inter_N\n elif l <= l_N:\n cnt += inter_N + 1\n else:\n cnt += 10 ** (i - 2)\nprint(cnt)\n","code_v1_no_empty_lines":"N = int(eval(input()))\ncnt = [[0] * 10 for i in range(10)]\nfor n in range(1, N + 1):\n cnt[int(str(n)[0])][int(str(n)[-1])] += 1\nans = 0\nfor i in range(10):\n for j in range(10):\n ans += cnt[i][j] * cnt[j][i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":70.2702702703,"diff":["-N_ = str(N)","-f_N, l_N = int(N_[0]), int(N_[-1])","-digit = len(N_)","-if digit > 2:","- inter_N = int(N_[1 : digit - 1])","-cnt = 0","-for num in range(1, N + 1):","- num = str(num)","- f, l = int(num[-1]), int(num[0])","- if f == 0:","- continue","- for i in range(1, digit + 1):","- if i == 1:","- if f == l:","- cnt += 1","- else:","- continue","- else:","- if i != digit:","- cnt += 10 ** (i - 2)","- elif digit == 2 and i == digit:","- if f * 10 + l <= N:","- cnt += 1","- else:","- continue","- else:","- if f > f_N:","- continue","- elif f == f_N:","- if l > l_N:","- cnt += inter_N","- elif l <= l_N:","- cnt += inter_N + 1","- else:","- cnt += 10 ** (i - 2)","-print(cnt)","+cnt = [[0] * 10 for i in range(10)]","+for n in range(1, N + 1):","+ cnt[int(str(n)[0])][int(str(n)[-1])] += 1","+ans = 0","+for i in range(10):","+ for j in range(10):","+ ans += cnt[i][j] * cnt[j][i]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1333454591,"measured_runtime_v1":0.0667267487,"runtime_lift":1.9983808837,"key":["s572342709","s953995290"]} +{"user_id":"u489124637","problem_id":"p02954","language":"python","submission_id_v0":"s815578042","submission_id_v1":"s170692344","cpu_time_v0":250,"cpu_time_v1":206,"memory_v0":47684,"memory_v1":49264,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.6,"input":"li=eval(input())\n\nn=len(li)\n\nchild_li=[0]*n\n\n\n\nruiseki=0\n\n#\u307e\u305a\u3001RRRRRRRL\u306e\u3088\u3046\u306bR\u304c\u9023\u7d9a\u3057\u3066L\u304c\u6700\u5f8c\u306b\u6765\u308b\u5834\u5408\u306eRL\u3092\u8003\u3048\u308b\u3002\u5de6\u304b\u3089\n\nfor i in range(n-1):\n\n if li[i]=='R':\n\n ruiseki+=1\n\n if li[i+1]=='L':\n\n child_li[i+1]=ruiseki\/\/2#------L\u306b\u3064\u3044\u3066\u3001R\u304c\u9023\u7d9a\u306e\u5206\u306e\u534a\u5206\uff08\u3053\u3063\u3061\u306f\u5207\u308a\u6368\u3066\uff09\n\n child_li[i]=(ruiseki+1)\/\/2#----R\u306b\u3064\u3044\u3066\u3001R\u304c\u9023\u7d9a\u306e\u5206\u306e\u534a\u5206\uff08\u3053\u3063\u3061\u306f\u5947\u6570\u306e\u5834\u5408\u5207\u308a\u4e0a\u3052\uff09\n\n else:\n\n ruiseki=0\n\n\n\n#\u540c\u69d8\u306b\u3001LLLLLLR\u306e\u3088\u3046\u306bL\u304c\u9023\u7d9a\u3057\u3066L\u304c\u6700\u5f8c\u306b\u6765\u308b\u5834\u5408\u306eRL\u3092\u8003\u3048\u308b\u3002\u53f3\u304b\u3089\n\nruiseki=0\n\nfor i in range(n-1, 0, -1):\n\n if li[i]=='L':\n\n ruiseki+=1\n\n if li[i-1]=='R':\n\n child_li[i-1]+=ruiseki\/\/2#-----R\u306b\u3064\u3044\u3066\u3001L\u304c\u9023\u7d9a\u306e\u5206\u306e\u534a\u5206\uff08\u3053\u3063\u3061\u306f\u5207\u308a\u6368\u3066\uff09\n\n child_li[i]+=(ruiseki+1)\/\/2#---L\u306b\u3064\u3044\u3066\u3001L\u304c\u9023\u7d9a\u306e\u5206\u306e\u534a\u5206\uff08\u3053\u3063\u3061\u306f\u5947\u6570\u306e\u5834\u5408\u5207\u308a\u4e0a\u3052\uff09\n\n else:\n\n ruiseki=0\n\n\n\nprint((*child_li))","target":"S = eval(input())\n\nN = len(S)\n\nans = [0]*N\n\ncnt = 0\n\nfor i in range(N):\n\n if S[i] == \"L\":\n\n if cnt % 2 ==0:\n\n ans[i] += cnt\/\/2\n\n ans[i-1] += cnt\/\/2\n\n cnt = 0\n\n else:\n\n ans[i] += (cnt-1)\/\/2\n\n ans[i-1] += (cnt+1)\/\/2\n\n cnt = 0\n\n else:\n\n cnt += 1\n\ncnt = 0\n\nfor i in reversed(list(range(N))):\n\n if S[i] == \"R\":\n\n if cnt % 2 ==0:\n\n ans[i] += cnt\/\/2\n\n ans[i+1] += cnt\/\/2\n\n cnt = 0\n\n else:\n\n ans[i] += (cnt-1)\/\/2\n\n ans[i+1] += (cnt+1)\/\/2\n\n cnt = 0\n\n else:\n\n cnt += 1\n\n\n\nans = [str(a) for a in ans]\n\nprint((\" \".join(ans)))","code_v0_loc":27,"code_v1_loc":32,"code_v0_num_chars":704,"code_v1_num_chars":685,"code_v0_no_empty_lines":"li = eval(input())\nn = len(li)\nchild_li = [0] * n\nruiseki = 0\n# \u307e\u305a\u3001RRRRRRRL\u306e\u3088\u3046\u306bR\u304c\u9023\u7d9a\u3057\u3066L\u304c\u6700\u5f8c\u306b\u6765\u308b\u5834\u5408\u306eRL\u3092\u8003\u3048\u308b\u3002\u5de6\u304b\u3089\nfor i in range(n - 1):\n if li[i] == \"R\":\n ruiseki += 1\n if li[i + 1] == \"L\":\n child_li[i + 1] = ruiseki \/\/ 2 # ------L\u306b\u3064\u3044\u3066\u3001R\u304c\u9023\u7d9a\u306e\u5206\u306e\u534a\u5206\uff08\u3053\u3063\u3061\u306f\u5207\u308a\u6368\u3066\uff09\n child_li[i] = (ruiseki + 1) \/\/ 2 # ----R\u306b\u3064\u3044\u3066\u3001R\u304c\u9023\u7d9a\u306e\u5206\u306e\u534a\u5206\uff08\u3053\u3063\u3061\u306f\u5947\u6570\u306e\u5834\u5408\u5207\u308a\u4e0a\u3052\uff09\n else:\n ruiseki = 0\n# \u540c\u69d8\u306b\u3001LLLLLLR\u306e\u3088\u3046\u306bL\u304c\u9023\u7d9a\u3057\u3066L\u304c\u6700\u5f8c\u306b\u6765\u308b\u5834\u5408\u306eRL\u3092\u8003\u3048\u308b\u3002\u53f3\u304b\u3089\nruiseki = 0\nfor i in range(n - 1, 0, -1):\n if li[i] == \"L\":\n ruiseki += 1\n if li[i - 1] == \"R\":\n child_li[i - 1] += ruiseki \/\/ 2 # -----R\u306b\u3064\u3044\u3066\u3001L\u304c\u9023\u7d9a\u306e\u5206\u306e\u534a\u5206\uff08\u3053\u3063\u3061\u306f\u5207\u308a\u6368\u3066\uff09\n child_li[i] += (ruiseki + 1) \/\/ 2 # ---L\u306b\u3064\u3044\u3066\u3001L\u304c\u9023\u7d9a\u306e\u5206\u306e\u534a\u5206\uff08\u3053\u3063\u3061\u306f\u5947\u6570\u306e\u5834\u5408\u5207\u308a\u4e0a\u3052\uff09\n else:\n ruiseki = 0\nprint((*child_li))\n","code_v1_no_empty_lines":"S = eval(input())\nN = len(S)\nans = [0] * N\ncnt = 0\nfor i in range(N):\n if S[i] == \"L\":\n if cnt % 2 == 0:\n ans[i] += cnt \/\/ 2\n ans[i - 1] += cnt \/\/ 2\n cnt = 0\n else:\n ans[i] += (cnt - 1) \/\/ 2\n ans[i - 1] += (cnt + 1) \/\/ 2\n cnt = 0\n else:\n cnt += 1\ncnt = 0\nfor i in reversed(list(range(N))):\n if S[i] == \"R\":\n if cnt % 2 == 0:\n ans[i] += cnt \/\/ 2\n ans[i + 1] += cnt \/\/ 2\n cnt = 0\n else:\n ans[i] += (cnt - 1) \/\/ 2\n ans[i + 1] += (cnt + 1) \/\/ 2\n cnt = 0\n else:\n cnt += 1\nans = [str(a) for a in ans]\nprint((\" \".join(ans)))\n","code_same":false,"relative_loc_diff_percent":15.625,"diff":["-li = eval(input())","-n = len(li)","-child_li = [0] * n","-ruiseki = 0","-# \u307e\u305a\u3001RRRRRRRL\u306e\u3088\u3046\u306bR\u304c\u9023\u7d9a\u3057\u3066L\u304c\u6700\u5f8c\u306b\u6765\u308b\u5834\u5408\u306eRL\u3092\u8003\u3048\u308b\u3002\u5de6\u304b\u3089","-for i in range(n - 1):","- if li[i] == \"R\":","- ruiseki += 1","- if li[i + 1] == \"L\":","+S = eval(input())","+N = len(S)","+ans = [0] * N","+cnt = 0","+for i in range(N):","+ if S[i] == \"L\":","+ if cnt % 2 == 0:","+ ans[i] += cnt \/\/ 2","+ ans[i - 1] += cnt \/\/ 2","+ cnt = 0","+ else:","+ ans[i] += (cnt - 1) \/\/ 2","+ ans[i - 1] += (cnt + 1) \/\/ 2","+ cnt = 0","- ruiseki = 0","-# \u540c\u69d8\u306b\u3001LLLLLLR\u306e\u3088\u3046\u306bL\u304c\u9023\u7d9a\u3057\u3066L\u304c\u6700\u5f8c\u306b\u6765\u308b\u5834\u5408\u306eRL\u3092\u8003\u3048\u308b\u3002\u53f3\u304b\u3089","-ruiseki = 0","-for i in range(n - 1, 0, -1):","- if li[i] == \"L\":","- ruiseki += 1","- if li[i - 1] == \"R\":","+ cnt += 1","+cnt = 0","+for i in reversed(list(range(N))):","+ if S[i] == \"R\":","+ if cnt % 2 == 0:","+ ans[i] += cnt \/\/ 2","+ ans[i + 1] += cnt \/\/ 2","+ cnt = 0","+ else:","+ ans[i] += (cnt - 1) \/\/ 2","+ ans[i + 1] += (cnt + 1) \/\/ 2","+ cnt = 0","- ruiseki = 0","-print((*child_li))","+ cnt += 1","+ans = [str(a) for a in ans]","+print((\" \".join(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0370223274,"measured_runtime_v1":0.0484497299,"runtime_lift":0.7641389844,"key":["s815578042","s170692344"]} +{"user_id":"u150984829","problem_id":"p02279","language":"python","submission_id_v0":"s804221677","submission_id_v1":"s682758602","cpu_time_v0":620,"cpu_time_v1":410,"memory_v0":65328,"memory_v1":65316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.87,"input":"def q(a,h):\n\n d[a]=str(h)\n\n for b in t[a]:q(b,h+1)\n\nt,p,d={},{},{}\n\nfor _ in[0]*int(eval(input())):\n\n e=input().split()\n\n t[e[0]]=e[2:]\n\n for i in e[2:]:p[i]=e[0]\n\nr=(set(t)-set(p)).pop()\n\np[r]='-1'\n\nq(r,0)\n\nprint(('\\n'.join(f\"node {i}: parent = {p[i]}, depth = {d[i]}, {'root'if'-1'==p[i]else'internal node'if t[i]else'leaf'}, [{', '.join(t[i])}]\"for i in map(str,sorted(map(int,t))))))\n","target":"import sys\n\ndef q(a,h):\n\n d[a]=str(h)\n\n for b in t[a]:q(b,h+1)\n\nt,p,d={},{},{}\n\neval(input())\n\nfor e in sys.stdin:\n\n e=e.split()\n\n t[e[0]]=e[2:]\n\n for i in e[2:]:p[i]=e[0]\n\nr=(set(t)-set(p)).pop()\n\np[r]='-1'\n\nq(r,0)\n\nprint(('\\n'.join(f\"node {i}: parent = {p[i]}, depth = {d[i]}, {'root'if'-1'==p[i]else'internal node'if t[i]else'leaf'}, [{', '.join(t[i])}]\"for i in map(str,sorted(map(int,t))))))\n","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":380,"code_v1_num_chars":389,"code_v0_no_empty_lines":"def q(a, h):\n d[a] = str(h)\n for b in t[a]:\n q(b, h + 1)\n\n\nt, p, d = {}, {}, {}\nfor _ in [0] * int(eval(input())):\n e = input().split()\n t[e[0]] = e[2:]\n for i in e[2:]:\n p[i] = e[0]\nr = (set(t) - set(p)).pop()\np[r] = \"-1\"\nq(r, 0)\nprint(\n (\n \"\\n\".join(\n f\"node {i}: parent = {p[i]}, depth = {d[i]}, {'root'if'-1'==p[i]else'internal node'if t[i]else'leaf'}, [{', '.join(t[i])}]\"\n for i in map(str, sorted(map(int, t)))\n )\n )\n)\n","code_v1_no_empty_lines":"import sys\n\n\ndef q(a, h):\n d[a] = str(h)\n for b in t[a]:\n q(b, h + 1)\n\n\nt, p, d = {}, {}, {}\neval(input())\nfor e in sys.stdin:\n e = e.split()\n t[e[0]] = e[2:]\n for i in e[2:]:\n p[i] = e[0]\nr = (set(t) - set(p)).pop()\np[r] = \"-1\"\nq(r, 0)\nprint(\n (\n \"\\n\".join(\n f\"node {i}: parent = {p[i]}, depth = {d[i]}, {'root'if'-1'==p[i]else'internal node'if t[i]else'leaf'}, [{', '.join(t[i])}]\"\n for i in map(str, sorted(map(int, t)))\n )\n )\n)\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["+import sys","+","+","-for _ in [0] * int(eval(input())):","- e = input().split()","+eval(input())","+for e in sys.stdin:","+ e = e.split()"],"diff_only_import_comment":false,"measured_runtime_v0":0.1245468934,"measured_runtime_v1":0.0448562145,"runtime_lift":2.7765805638,"key":["s804221677","s682758602"]} +{"user_id":"u300968187","problem_id":"p03244","language":"python","submission_id_v0":"s260249239","submission_id_v1":"s511085992","cpu_time_v0":166,"cpu_time_v1":74,"memory_v0":25184,"memory_v1":15588,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.42,"input":"n = int(eval(input()))\n\nv = list(map(int, input().split()))\n\n\n\napp = {}\n\nfor i, j in zip(v[::2], v[1::2]):\n\n if i not in app:\n\n app[i] = [1, 0]\n\n else:\n\n app[i][0] += 1\n\n if j not in app:\n\n app[j] = [0, 1]\n\n else:\n\n app[j][1] += 1\n\n\n\nmax_o = [0, 0]\n\nsecmax_o = [0, 0]\n\nmax_e = [0, 0]\n\nsecmax_e = [0, 0]\n\nfor i in app:\n\n if app[i][0] > max_o[1]:\n\n secmax_o = max_o[:]\n\n max_o = [i, app[i][0]]\n\n elif app[i][0] > secmax_o[1]:\n\n secmax_o = [i, app[i][0]]\n\n if app[i][1] > max_e[1]:\n\n secmax_e = max_e[:]\n\n max_e = [i, app[i][1]]\n\n elif app[i][1] > secmax_e[1]:\n\n secmax_e = [i, app[i][1]]\n\n\n\nif max_o[0] != max_e[0]:\n\n print((n - max_o[1] - max_e[1]))\n\nelse:\n\n del0 = max_o[1] - secmax_o[1]\n\n del1 = max_e[1] - secmax_e[1]\n\n print((n + min(del0, del1) - max_o[1] - max_e[1]))","target":"from collections import Counter\n\n\n\nn = int(eval(input()))\n\nv = list(map(int, input().split()))\n\ncnt_o = Counter(v[::2]).most_common(2)\n\ncnt_e = Counter(v[1::2]).most_common(2)\n\ncnt_o.append((0, 0))\n\ncnt_e.append((0, 0))\n\n\n\nif cnt_o[0][0] != cnt_e[0][0]:\n\n print((n - cnt_o[0][1] - cnt_e[0][1]))\n\nelse:\n\n del1 = cnt_o[0][1] - cnt_o[1][1]\n\n del2 = cnt_e[0][1] - cnt_e[1][1]\n\n print((n - cnt_o[0][1] - cnt_e[0][1] + min(del1, del2)))","code_v0_loc":36,"code_v1_loc":15,"code_v0_num_chars":868,"code_v1_num_chars":432,"code_v0_no_empty_lines":"n = int(eval(input()))\nv = list(map(int, input().split()))\napp = {}\nfor i, j in zip(v[::2], v[1::2]):\n if i not in app:\n app[i] = [1, 0]\n else:\n app[i][0] += 1\n if j not in app:\n app[j] = [0, 1]\n else:\n app[j][1] += 1\nmax_o = [0, 0]\nsecmax_o = [0, 0]\nmax_e = [0, 0]\nsecmax_e = [0, 0]\nfor i in app:\n if app[i][0] > max_o[1]:\n secmax_o = max_o[:]\n max_o = [i, app[i][0]]\n elif app[i][0] > secmax_o[1]:\n secmax_o = [i, app[i][0]]\n if app[i][1] > max_e[1]:\n secmax_e = max_e[:]\n max_e = [i, app[i][1]]\n elif app[i][1] > secmax_e[1]:\n secmax_e = [i, app[i][1]]\nif max_o[0] != max_e[0]:\n print((n - max_o[1] - max_e[1]))\nelse:\n del0 = max_o[1] - secmax_o[1]\n del1 = max_e[1] - secmax_e[1]\n print((n + min(del0, del1) - max_o[1] - max_e[1]))\n","code_v1_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\nv = list(map(int, input().split()))\ncnt_o = Counter(v[::2]).most_common(2)\ncnt_e = Counter(v[1::2]).most_common(2)\ncnt_o.append((0, 0))\ncnt_e.append((0, 0))\nif cnt_o[0][0] != cnt_e[0][0]:\n print((n - cnt_o[0][1] - cnt_e[0][1]))\nelse:\n del1 = cnt_o[0][1] - cnt_o[1][1]\n del2 = cnt_e[0][1] - cnt_e[1][1]\n print((n - cnt_o[0][1] - cnt_e[0][1] + min(del1, del2)))\n","code_same":false,"relative_loc_diff_percent":58.3333333333,"diff":["+from collections import Counter","+","-app = {}","-for i, j in zip(v[::2], v[1::2]):","- if i not in app:","- app[i] = [1, 0]","- else:","- app[i][0] += 1","- if j not in app:","- app[j] = [0, 1]","- else:","- app[j][1] += 1","-max_o = [0, 0]","-secmax_o = [0, 0]","-max_e = [0, 0]","-secmax_e = [0, 0]","-for i in app:","- if app[i][0] > max_o[1]:","- secmax_o = max_o[:]","- max_o = [i, app[i][0]]","- elif app[i][0] > secmax_o[1]:","- secmax_o = [i, app[i][0]]","- if app[i][1] > max_e[1]:","- secmax_e = max_e[:]","- max_e = [i, app[i][1]]","- elif app[i][1] > secmax_e[1]:","- secmax_e = [i, app[i][1]]","-if max_o[0] != max_e[0]:","- print((n - max_o[1] - max_e[1]))","+cnt_o = Counter(v[::2]).most_common(2)","+cnt_e = Counter(v[1::2]).most_common(2)","+cnt_o.append((0, 0))","+cnt_e.append((0, 0))","+if cnt_o[0][0] != cnt_e[0][0]:","+ print((n - cnt_o[0][1] - cnt_e[0][1]))","- del0 = max_o[1] - secmax_o[1]","- del1 = max_e[1] - secmax_e[1]","- print((n + min(del0, del1) - max_o[1] - max_e[1]))","+ del1 = cnt_o[0][1] - cnt_o[1][1]","+ del2 = cnt_e[0][1] - cnt_e[1][1]","+ print((n - cnt_o[0][1] - cnt_e[0][1] + min(del1, del2)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0464891956,"measured_runtime_v1":0.0459905136,"runtime_lift":1.0108431495,"key":["s260249239","s511085992"]} +{"user_id":"u075012704","problem_id":"p03700","language":"python","submission_id_v0":"s906427407","submission_id_v1":"s725623603","cpu_time_v0":1618,"cpu_time_v1":1368,"memory_v0":11832,"memory_v1":15736,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.45,"input":"import math\n\n\n\nN, A, B = list(map(int, input().split()))\n\nH = [int(eval(input())) for i in range(N)]\n\n\n\nadd_damage = A-B\n\nleft = 1\n\nright = 10**9\n\nans = float('inf')\n\n\n\nfor i in range(int(math.log(10**9, 2)+1)):\n\n T = (left+right) \/\/ 2\n\n h = H.copy()\n\n h = list([math.ceil(max(0, x-T*B) \/ add_damage) for x in h])\n\n need = sum(h)\n\n \n\n if need <= T:\n\n right = T\n\n ans = min(ans, T)\n\n else:\n\n left = T\n\n\n\nprint(ans)","target":"from math import ceil\n\nN, A, B = list(map(int, input().split()))\n\nH = sorted([int(eval(input())) for i in range(N)])\n\nC = A - B\n\n\n\nlo, hi = -1, 10**9\n\nwhile hi - lo > 1:\n\n X = (hi + lo) \/\/ 2\n\n H2 = [max(0, h - (X * B)) for h in H]\n\n need = sum([ceil(h \/ C) for h in H2])\n\n if need > X:\n\n lo = X\n\n else:\n\n hi = X\n\n\n\nprint(hi)\n","code_v0_loc":23,"code_v1_loc":16,"code_v0_num_chars":448,"code_v1_num_chars":342,"code_v0_no_empty_lines":"import math\n\nN, A, B = list(map(int, input().split()))\nH = [int(eval(input())) for i in range(N)]\nadd_damage = A - B\nleft = 1\nright = 10**9\nans = float(\"inf\")\nfor i in range(int(math.log(10**9, 2) + 1)):\n T = (left + right) \/\/ 2\n h = H.copy()\n h = list([math.ceil(max(0, x - T * B) \/ add_damage) for x in h])\n need = sum(h)\n if need <= T:\n right = T\n ans = min(ans, T)\n else:\n left = T\nprint(ans)\n","code_v1_no_empty_lines":"from math import ceil\n\nN, A, B = list(map(int, input().split()))\nH = sorted([int(eval(input())) for i in range(N)])\nC = A - B\nlo, hi = -1, 10**9\nwhile hi - lo > 1:\n X = (hi + lo) \/\/ 2\n H2 = [max(0, h - (X * B)) for h in H]\n need = sum([ceil(h \/ C) for h in H2])\n if need > X:\n lo = X\n else:\n hi = X\nprint(hi)\n","code_same":false,"relative_loc_diff_percent":30.4347826087,"diff":["-import math","+from math import ceil","-H = [int(eval(input())) for i in range(N)]","-add_damage = A - B","-left = 1","-right = 10**9","-ans = float(\"inf\")","-for i in range(int(math.log(10**9, 2) + 1)):","- T = (left + right) \/\/ 2","- h = H.copy()","- h = list([math.ceil(max(0, x - T * B) \/ add_damage) for x in h])","- need = sum(h)","- if need <= T:","- right = T","- ans = min(ans, T)","+H = sorted([int(eval(input())) for i in range(N)])","+C = A - B","+lo, hi = -1, 10**9","+while hi - lo > 1:","+ X = (hi + lo) \/\/ 2","+ H2 = [max(0, h - (X * B)) for h in H]","+ need = sum([ceil(h \/ C) for h in H2])","+ if need > X:","+ lo = X","- left = T","-print(ans)","+ hi = X","+print(hi)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0421239343,"measured_runtime_v1":0.1382410533,"runtime_lift":0.3047136379,"key":["s906427407","s725623603"]} +{"user_id":"u072053884","problem_id":"p00277","language":"python","submission_id_v0":"s938636003","submission_id_v1":"s761038908","cpu_time_v0":2380,"cpu_time_v1":2130,"memory_v0":89508,"memory_v1":85332,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.5,"input":"import sys\n\nfrom heapq import heappush, heappop, heapreplace\n\n\n\ndef solve():\n\n file_input = sys.stdin\n\n N, R, L = list(map(int, file_input.readline().split()))\n\n \n\n pq = [[0, i, 0] for i in range(1, N + 1)]\n\n m = dict(list(zip(list(range(1, N + 1)), pq)))\n\n \n\n pre_t = 0\n\n for line in file_input:\n\n d, t, x = list(map(int, line.split()))\n\n team = pq[0]\n\n team[2] += t - pre_t\n\n pre_t = t\n\n \n\n if team[1] == d:\n\n team[0] -= x\n\n if x < 0:\n\n heapreplace(pq, team)\n\n else:\n\n scored_team = m[d][:]\n\n scored_team[0] -= x\n\n heappush(pq, scored_team)\n\n m[d][2] = -1\n\n m[d] = scored_team\n\n \n\n while pq[0][2] == -1:\n\n heappop(pq)\n\n pq[0][2] += L - pre_t\n\n ans_team = max(pq, key = lambda x: (x[2], -x[1]))\n\n print((ans_team[1]))\n\n\n\nsolve()\n","target":"import sys\n\nfrom heapq import heappush, heappop, heapreplace\n\n\n\ndef solve():\n\n file_input = sys.stdin\n\n N, R, L = list(map(int, file_input.readline().split()))\n\n \n\n pq = [[0, i] for i in range(1, N + 1)]\n\n m = dict(list(zip(list(range(1, N + 1)), pq)))\n\n time = [0] * (N + 1)\n\n INVALID = -1\n\n \n\n pre_t = 0\n\n for line in file_input:\n\n d, t, x = list(map(int, line.split()))\n\n top_team = pq[0]\n\n time[top_team[1]] += t - pre_t\n\n pre_t = t\n\n \n\n if top_team[1] == d:\n\n top_team[0] -= x\n\n if x < 0:\n\n heapreplace(pq, top_team)\n\n else:\n\n scored_team = m[d][:]\n\n scored_team[0] -= x\n\n heappush(pq, scored_team)\n\n m[d][1] = INVALID\n\n m[d] = scored_team\n\n \n\n while pq[0][1] == INVALID:\n\n heappop(pq)\n\n time[pq[0][1]] += L - pre_t\n\n print((time.index(max(time))))\n\n\n\nsolve()\n","code_v0_loc":35,"code_v1_loc":36,"code_v0_num_chars":903,"code_v1_num_chars":941,"code_v0_no_empty_lines":"import sys\nfrom heapq import heappush, heappop, heapreplace\n\n\ndef solve():\n file_input = sys.stdin\n N, R, L = list(map(int, file_input.readline().split()))\n pq = [[0, i, 0] for i in range(1, N + 1)]\n m = dict(list(zip(list(range(1, N + 1)), pq)))\n pre_t = 0\n for line in file_input:\n d, t, x = list(map(int, line.split()))\n team = pq[0]\n team[2] += t - pre_t\n pre_t = t\n if team[1] == d:\n team[0] -= x\n if x < 0:\n heapreplace(pq, team)\n else:\n scored_team = m[d][:]\n scored_team[0] -= x\n heappush(pq, scored_team)\n m[d][2] = -1\n m[d] = scored_team\n while pq[0][2] == -1:\n heappop(pq)\n pq[0][2] += L - pre_t\n ans_team = max(pq, key=lambda x: (x[2], -x[1]))\n print((ans_team[1]))\n\n\nsolve()\n","code_v1_no_empty_lines":"import sys\nfrom heapq import heappush, heappop, heapreplace\n\n\ndef solve():\n file_input = sys.stdin\n N, R, L = list(map(int, file_input.readline().split()))\n pq = [[0, i] for i in range(1, N + 1)]\n m = dict(list(zip(list(range(1, N + 1)), pq)))\n time = [0] * (N + 1)\n INVALID = -1\n pre_t = 0\n for line in file_input:\n d, t, x = list(map(int, line.split()))\n top_team = pq[0]\n time[top_team[1]] += t - pre_t\n pre_t = t\n if top_team[1] == d:\n top_team[0] -= x\n if x < 0:\n heapreplace(pq, top_team)\n else:\n scored_team = m[d][:]\n scored_team[0] -= x\n heappush(pq, scored_team)\n m[d][1] = INVALID\n m[d] = scored_team\n while pq[0][1] == INVALID:\n heappop(pq)\n time[pq[0][1]] += L - pre_t\n print((time.index(max(time))))\n\n\nsolve()\n","code_same":false,"relative_loc_diff_percent":2.7777777778,"diff":["- pq = [[0, i, 0] for i in range(1, N + 1)]","+ pq = [[0, i] for i in range(1, N + 1)]","+ time = [0] * (N + 1)","+ INVALID = -1","- team = pq[0]","- team[2] += t - pre_t","+ top_team = pq[0]","+ time[top_team[1]] += t - pre_t","- if team[1] == d:","- team[0] -= x","+ if top_team[1] == d:","+ top_team[0] -= x","- heapreplace(pq, team)","+ heapreplace(pq, top_team)","- m[d][2] = -1","+ m[d][1] = INVALID","- while pq[0][2] == -1:","+ while pq[0][1] == INVALID:","- pq[0][2] += L - pre_t","- ans_team = max(pq, key=lambda x: (x[2], -x[1]))","- print((ans_team[1]))","+ time[pq[0][1]] += L - pre_t","+ print((time.index(max(time))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0444574862,"measured_runtime_v1":0.0715511632,"runtime_lift":0.6213384124,"key":["s938636003","s761038908"]} +{"user_id":"u285891772","problem_id":"p02850","language":"python","submission_id_v0":"s864771262","submission_id_v1":"s393913817","cpu_time_v0":633,"cpu_time_v1":507,"memory_v0":72908,"memory_v1":95596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.91,"input":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\nfrom decimal import Decimal\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\nfrom decimal import *\n\n \n\nN = INT()\n\nab = [LIST() for _ in range(N-1)]\n\ngraph = [[] for _ in range(N)]\n\n\n\nfor a, b in ab:\n\n\tgraph[a-1].append(b-1)\n\n\tgraph[b-1].append(a-1)\n\n\n\nlength = [len(x) for x in graph]\n\nans = max(length)\n\n\n\ncolor = defaultdict(int)\n\n\n\nq = deque([])\n\ncnt = 1\n\nfor x in graph[0]:\n\n\tq.append((x, 0, cnt))\n\n\tcnt += 1\n\n\n\nwhile q:\n\n\tn, previous, col = q.popleft()\n\n\tcnt = 1\n\n\tfor x in graph[n]:\n\n\t\tif x == previous:\n\n\t\t\tcolor[(n, x)] = col\n\n\t\t\tcolor[(x, n)] = col\n\n\t\telse:\n\n\t\t\tif cnt == col:\n\n\t\t\t\tcnt += 1\n\n\t\t\tcolor[(n, x)] = cnt\n\n\t\t\tcolor[(x, n)] = cnt\n\n\t\t\tq.append((x, n, cnt))\n\n\t\t\tcnt += 1\n\n\n\nprint(ans)\n\nfor a, b in ab:\n\n\tprint((color[(a-1, b-1)]))","target":"import sys, re\n\nfrom collections import deque, defaultdict, Counter\n\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log\n\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\n\nfrom operator import itemgetter, mul\n\nfrom copy import deepcopy\n\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\nfrom bisect import bisect, bisect_left, insort, insort_left\n\nfrom fractions import gcd\n\nfrom heapq import heappush, heappop\n\nfrom functools import reduce\n\nfrom decimal import Decimal\n\ndef input(): return sys.stdin.readline().strip()\n\ndef INT(): return int(eval(input()))\n\ndef MAP(): return list(map(int, input().split()))\n\ndef LIST(): return list(map(int, input().split()))\n\ndef ZIP(n): return list(zip(*(MAP() for _ in range(n))))\n\nsys.setrecursionlimit(10 ** 9)\n\nINF = float('inf')\n\nmod = 10**9 + 7\n\nfrom decimal import *\n\n \n\nN = INT()\n\nab = [LIST() for _ in range(N-1)]\n\ngraph = [[] for _ in range(N)]\n\n\n\nfor a, b in ab:\n\n\tgraph[a-1].append(b-1)\n\n\tgraph[b-1].append(a-1)\n\n\n\nlength = [len(x) for x in graph]\n\nans = max(length)\n\n\n\ncolor = defaultdict(int)\n\n\n\ndef coloring(n, previous, col): #\u9802\u70b9n\u306bprevious\u304b\u3089\u8272col\u3067\u8fbf\u3063\u3066\u304d\u305f\u3002\n\n\tcnt = 1\n\n\tfor x in graph[n]:\n\n\t\tif x == previous:\n\n\t\t\tcolor[(n, x)] = col\n\n\t\t\tcolor[(x, n)] = col #\u3084\u3063\u3066\u304d\u305f\u9802\u70b9\u3068\u306e\u9593\u306b\u304a\u3051\u308b\u8272\n\n\t\telse:\n\n\t\t\tif cnt == col:\n\n\t\t\t\tcnt += 1\n\n\t\t\tcolor[(x, n)] = cnt\n\n\t\t\tcolor[(n, x)] = cnt\n\n\t\t\tcoloring(x, n, cnt)\n\n\t\t\tcnt += 1\n\n\n\ncoloring(0, -1, 0)\n\n\n\nprint(ans)\n\nfor a, b in ab:\n\n\tprint((color[(a-1, b-1)]))","code_v0_loc":59,"code_v1_loc":54,"code_v0_num_chars":1570,"code_v1_num_chars":1543,"code_v0_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n log,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\nfrom decimal import Decimal\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nfrom decimal import *\n\nN = INT()\nab = [LIST() for _ in range(N - 1)]\ngraph = [[] for _ in range(N)]\nfor a, b in ab:\n graph[a - 1].append(b - 1)\n graph[b - 1].append(a - 1)\nlength = [len(x) for x in graph]\nans = max(length)\ncolor = defaultdict(int)\nq = deque([])\ncnt = 1\nfor x in graph[0]:\n q.append((x, 0, cnt))\n cnt += 1\nwhile q:\n n, previous, col = q.popleft()\n cnt = 1\n for x in graph[n]:\n if x == previous:\n color[(n, x)] = col\n color[(x, n)] = col\n else:\n if cnt == col:\n cnt += 1\n color[(n, x)] = cnt\n color[(x, n)] = cnt\n q.append((x, n, cnt))\n cnt += 1\nprint(ans)\nfor a, b in ab:\n print((color[(a - 1, b - 1)]))\n","code_v1_no_empty_lines":"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import (\n ceil,\n sqrt,\n hypot,\n factorial,\n pi,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n radians,\n degrees,\n log2,\n log,\n)\nfrom itertools import (\n accumulate,\n permutations,\n combinations,\n combinations_with_replacement,\n product,\n groupby,\n)\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom functools import reduce\nfrom decimal import Decimal\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef INT():\n return int(eval(input()))\n\n\ndef MAP():\n return list(map(int, input().split()))\n\n\ndef LIST():\n return list(map(int, input().split()))\n\n\ndef ZIP(n):\n return list(zip(*(MAP() for _ in range(n))))\n\n\nsys.setrecursionlimit(10**9)\nINF = float(\"inf\")\nmod = 10**9 + 7\nfrom decimal import *\n\nN = INT()\nab = [LIST() for _ in range(N - 1)]\ngraph = [[] for _ in range(N)]\nfor a, b in ab:\n graph[a - 1].append(b - 1)\n graph[b - 1].append(a - 1)\nlength = [len(x) for x in graph]\nans = max(length)\ncolor = defaultdict(int)\n\n\ndef coloring(n, previous, col): # \u9802\u70b9n\u306bprevious\u304b\u3089\u8272col\u3067\u8fbf\u3063\u3066\u304d\u305f\u3002\n cnt = 1\n for x in graph[n]:\n if x == previous:\n color[(n, x)] = col\n color[(x, n)] = col # \u3084\u3063\u3066\u304d\u305f\u9802\u70b9\u3068\u306e\u9593\u306b\u304a\u3051\u308b\u8272\n else:\n if cnt == col:\n cnt += 1\n color[(x, n)] = cnt\n color[(n, x)] = cnt\n coloring(x, n, cnt)\n cnt += 1\n\n\ncoloring(0, -1, 0)\nprint(ans)\nfor a, b in ab:\n print((color[(a - 1, b - 1)]))\n","code_same":false,"relative_loc_diff_percent":8.4745762712,"diff":["-q = deque([])","-cnt = 1","-for x in graph[0]:","- q.append((x, 0, cnt))","- cnt += 1","-while q:","- n, previous, col = q.popleft()","+","+","+def coloring(n, previous, col): # \u9802\u70b9n\u306bprevious\u304b\u3089\u8272col\u3067\u8fbf\u3063\u3066\u304d\u305f\u3002","- color[(x, n)] = col","+ color[(x, n)] = col # \u3084\u3063\u3066\u304d\u305f\u9802\u70b9\u3068\u306e\u9593\u306b\u304a\u3051\u308b\u8272","+ color[(x, n)] = cnt","- color[(x, n)] = cnt","- q.append((x, n, cnt))","+ coloring(x, n, cnt)","+","+","+coloring(0, -1, 0)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0494522758,"measured_runtime_v1":0.0513982975,"runtime_lift":0.9621383996,"key":["s864771262","s393913817"]} +{"user_id":"u384657160","problem_id":"p03107","language":"python","submission_id_v0":"s077115895","submission_id_v1":"s847766531","cpu_time_v0":30,"cpu_time_v1":21,"memory_v0":3956,"memory_v1":3956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.0,"input":"n = list(str(eval(input())))\n\na = 0\n\nb = 0\n\nfor i in n:\n\n if i == \"1\":\n\n a += 1\n\n else:\n\n b += 1\n\n\n\nc = min(a,b)\n\n\n\nprint((2 * c))","target":"n = list(str(eval(input())))\n\na = n.count(\"1\")\n\nb = n.count(\"0\")\n\n\n\nc = min(a,b)\n\n\n\nprint((2 * c))","code_v0_loc":12,"code_v1_loc":7,"code_v0_num_chars":142,"code_v1_num_chars":90,"code_v0_no_empty_lines":"n = list(str(eval(input())))\na = 0\nb = 0\nfor i in n:\n if i == \"1\":\n a += 1\n else:\n b += 1\nc = min(a, b)\nprint((2 * c))\n","code_v1_no_empty_lines":"n = list(str(eval(input())))\na = n.count(\"1\")\nb = n.count(\"0\")\nc = min(a, b)\nprint((2 * c))\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["-a = 0","-b = 0","-for i in n:","- if i == \"1\":","- a += 1","- else:","- b += 1","+a = n.count(\"1\")","+b = n.count(\"0\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0421536195,"measured_runtime_v1":0.0343441885,"runtime_lift":1.2273872645,"key":["s077115895","s847766531"]} +{"user_id":"u633068244","problem_id":"p00058","language":"python","submission_id_v0":"s759133868","submission_id_v1":"s419110266","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4228,"memory_v1":4232,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"while True:\n\n try:\n\n xA,yA,xB,yB,xC,yC,xD,yD = list(map(float, input().split()))\n\n if abs((yB-yA)*(yD-yC) + (xB-xA)*(xD-xC)) < 1.e-12:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n except:\n\n break","target":"while True:\n\n try:\n\n xA,yA,xB,yB,xC,yC,xD,yD = list(map(float, input().split()))\n\n if abs((yB-yA)*(yD-yC) + (xB-xA)*(xD-xC)) < 1.e-10:\n\n print(\"YES\")\n\n else:\n\n print(\"NO\")\n\n except:\n\n break","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":245,"code_v1_num_chars":245,"code_v0_no_empty_lines":"while True:\n try:\n xA, yA, xB, yB, xC, yC, xD, yD = list(map(float, input().split()))\n if abs((yB - yA) * (yD - yC) + (xB - xA) * (xD - xC)) < 1.0e-12:\n print(\"YES\")\n else:\n print(\"NO\")\n except:\n break\n","code_v1_no_empty_lines":"while True:\n try:\n xA, yA, xB, yB, xC, yC, xD, yD = list(map(float, input().split()))\n if abs((yB - yA) * (yD - yC) + (xB - xA) * (xD - xC)) < 1.0e-10:\n print(\"YES\")\n else:\n print(\"NO\")\n except:\n break\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if abs((yB - yA) * (yD - yC) + (xB - xA) * (xD - xC)) < 1.0e-12:","+ if abs((yB - yA) * (yD - yC) + (xB - xA) * (xD - xC)) < 1.0e-10:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0453898804,"measured_runtime_v1":0.0389183717,"runtime_lift":1.1662841597,"key":["s759133868","s419110266"]} +{"user_id":"u845643816","problem_id":"p02241","language":"python","submission_id_v0":"s029476324","submission_id_v1":"s596958893","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":5864,"memory_v1":6116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"n = int(eval(input()))\n\nedgeList = []\n\nrootList = [-1 for i in range(n)]\n\n\n\ndef getRoot(x):\n\n r = rootList[x]\n\n if r < 0:\n\n rootList[x] = x\n\n elif r != x:\n\n rootList[x] = getRoot(r)\n\n return rootList[x]\n\n \n\nfor i in range(n):\n\n a = list(map(int, input().split()))\n\n for j in range(i):\n\n if a[j] != -1:\n\n edgeList.append([a[j], getRoot(i), getRoot(j)])\n\nsumLength = 0\n\nedgeList.sort(key=lambda x: x[0])\n\nfor e in edgeList:\n\n x = getRoot(e[1])\n\n y = getRoot(e[2])\n\n if x != y:\n\n sumLength += e[0]\n\n rootList[x] = rootList[y] = min(x, y)\n\nprint(sumLength)","target":"n = int(eval(input()))\n\nedgeList = []\n\nfor i in range(n):\n\n a = list(map(int, input().split()))\n\n for j in range(i):\n\n if a[j] != -1:\n\n edgeList.append([a[j], i, j])\n\nrootList = [-1]*n\n\nsumLength = 0\n\n\n\ndef getRoot(x):\n\n r = rootList[x]\n\n if r < 0:\n\n rootList[x] = x\n\n elif r != x:\n\n rootList[x] = getRoot(r)\n\n return rootList[x]\n\n \n\n\n\nedgeList.sort(key=lambda x: x[0])\n\nfor e in edgeList:\n\n x = getRoot(e[1])\n\n y = getRoot(e[2])\n\n if x != y:\n\n sumLength += e[0]\n\n rootList[x] = rootList[y] = min(x, y)\n\nprint(sumLength)","code_v0_loc":26,"code_v1_loc":27,"code_v0_num_chars":626,"code_v1_num_chars":594,"code_v0_no_empty_lines":"n = int(eval(input()))\nedgeList = []\nrootList = [-1 for i in range(n)]\n\n\ndef getRoot(x):\n r = rootList[x]\n if r < 0:\n rootList[x] = x\n elif r != x:\n rootList[x] = getRoot(r)\n return rootList[x]\n\n\nfor i in range(n):\n a = list(map(int, input().split()))\n for j in range(i):\n if a[j] != -1:\n edgeList.append([a[j], getRoot(i), getRoot(j)])\nsumLength = 0\nedgeList.sort(key=lambda x: x[0])\nfor e in edgeList:\n x = getRoot(e[1])\n y = getRoot(e[2])\n if x != y:\n sumLength += e[0]\n rootList[x] = rootList[y] = min(x, y)\nprint(sumLength)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nedgeList = []\nfor i in range(n):\n a = list(map(int, input().split()))\n for j in range(i):\n if a[j] != -1:\n edgeList.append([a[j], i, j])\nrootList = [-1] * n\nsumLength = 0\n\n\ndef getRoot(x):\n r = rootList[x]\n if r < 0:\n rootList[x] = x\n elif r != x:\n rootList[x] = getRoot(r)\n return rootList[x]\n\n\nedgeList.sort(key=lambda x: x[0])\nfor e in edgeList:\n x = getRoot(e[1])\n y = getRoot(e[2])\n if x != y:\n sumLength += e[0]\n rootList[x] = rootList[y] = min(x, y)\nprint(sumLength)\n","code_same":false,"relative_loc_diff_percent":3.7037037037,"diff":["-rootList = [-1 for i in range(n)]","+for i in range(n):","+ a = list(map(int, input().split()))","+ for j in range(i):","+ if a[j] != -1:","+ edgeList.append([a[j], i, j])","+rootList = [-1] * n","+sumLength = 0","-for i in range(n):","- a = list(map(int, input().split()))","- for j in range(i):","- if a[j] != -1:","- edgeList.append([a[j], getRoot(i), getRoot(j)])","-sumLength = 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.0483397484,"measured_runtime_v1":0.1226129532,"runtime_lift":0.3942466691,"key":["s029476324","s596958893"]} +{"user_id":"u608088992","problem_id":"p03700","language":"python","submission_id_v0":"s831006681","submission_id_v1":"s103396568","cpu_time_v0":1950,"cpu_time_v1":1146,"memory_v0":7072,"memory_v1":7072,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.23,"input":"def roof(a, b):\n\n if a%b == 0:\n\n return a\/\/b\n\n else:\n\n return a\/\/b + 1\n\n\n\nN, A, B = list(map(int, input().split()))\n\nH = [int(eval(input())) for i in range(N)]\n\n\n\nlow, high = 0, 10**9\n\nwhile high - low > 1:\n\n mid = (low + high)\/\/2\n\n count = 0\n\n for i in range(N):\n\n if H[i] - (B * mid) > 0:\n\n count += roof(H[i]-(B*mid), A-B)\n\n if count > mid:\n\n low = mid\n\n else:\n\n high = mid\n\nprint(high)","target":"import sys\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n N, A, B = list(map(int, input().split()))\n\n H = [int(eval(input())) for _ in range(N)]\n\n low = 0; high = 10 ** 20\n\n while high - low > 1:\n\n mid = (low + high) \/\/ 2\n\n explosion = B * mid\n\n direct = 0\n\n for h in H:\n\n if h - explosion > 0:\n\n direct += (h - explosion) \/\/ (A - B)\n\n if (h - explosion) % (A - B) > 0: direct += 1\n\n if direct <= mid: high = mid\n\n else: low = mid\n\n print(high)\n\n\n\n return 0\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":21,"code_v1_loc":23,"code_v0_num_chars":444,"code_v1_num_chars":592,"code_v0_no_empty_lines":"def roof(a, b):\n if a % b == 0:\n return a \/\/ b\n else:\n return a \/\/ b + 1\n\n\nN, A, B = list(map(int, input().split()))\nH = [int(eval(input())) for i in range(N)]\nlow, high = 0, 10**9\nwhile high - low > 1:\n mid = (low + high) \/\/ 2\n count = 0\n for i in range(N):\n if H[i] - (B * mid) > 0:\n count += roof(H[i] - (B * mid), A - B)\n if count > mid:\n low = mid\n else:\n high = mid\nprint(high)\n","code_v1_no_empty_lines":"import sys\n\n\ndef solve():\n input = sys.stdin.readline\n N, A, B = list(map(int, input().split()))\n H = [int(eval(input())) for _ in range(N)]\n low = 0\n high = 10**20\n while high - low > 1:\n mid = (low + high) \/\/ 2\n explosion = B * mid\n direct = 0\n for h in H:\n if h - explosion > 0:\n direct += (h - explosion) \/\/ (A - B)\n if (h - explosion) % (A - B) > 0:\n direct += 1\n if direct <= mid:\n high = mid\n else:\n low = mid\n print(high)\n return 0\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["-def roof(a, b):","- if a % b == 0:","- return a \/\/ b","- else:","- return a \/\/ b + 1","+import sys","-N, A, B = list(map(int, input().split()))","-H = [int(eval(input())) for i in range(N)]","-low, high = 0, 10**9","-while high - low > 1:","- mid = (low + high) \/\/ 2","- count = 0","- for i in range(N):","- if H[i] - (B * mid) > 0:","- count += roof(H[i] - (B * mid), A - B)","- if count > mid:","- low = mid","- else:","- high = mid","-print(high)","+def solve():","+ input = sys.stdin.readline","+ N, A, B = list(map(int, input().split()))","+ H = [int(eval(input())) for _ in range(N)]","+ low = 0","+ high = 10**20","+ while high - low > 1:","+ mid = (low + high) \/\/ 2","+ explosion = B * mid","+ direct = 0","+ for h in H:","+ if h - explosion > 0:","+ direct += (h - explosion) \/\/ (A - B)","+ if (h - explosion) % (A - B) > 0:","+ direct += 1","+ if direct <= mid:","+ high = mid","+ else:","+ low = mid","+ print(high)","+ return 0","+","+","+if __name__ == \"__main__\":","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0586034083,"measured_runtime_v1":0.0372007725,"runtime_lift":1.5753277243,"key":["s831006681","s103396568"]} +{"user_id":"u057109575","problem_id":"p03044","language":"python","submission_id_v0":"s940966406","submission_id_v1":"s789994501","cpu_time_v0":1032,"cpu_time_v1":319,"memory_v0":85208,"memory_v1":111992,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.09,"input":"N = int(input())\n\nedges = [list(map(int, input().split())) for _ in range(N - 1)]\n\n\n\ngraph = [[] for _ in range(N + 1)]\n\nfor u, v, w in edges:\n\n graph[u].append((v, w))\n\n graph[v].append((u, w))\n\n\n\nedges.sort()\n\ncolor = [-1] * (N + 1)\n\ncolor[1] = 0\n\nque = [1]\n\n\n\nwhile que:\n\n u = que.pop()\n\n \n\n for v, w in graph[u]:\n\n if color[v] != -1:\n\n continue\n\n\n\n if w % 2 == 0:\n\n color[v] = color[u]\n\n else:\n\n color[v] = color[u] ^ 1\n\n \n\n que.append(v)\n\n \n\nprint(*color[1:], sep='\\n')\n\n\n\n\n","target":"\n\nfrom collections import deque\n\n\n\nN = int(input())\n\nX = [list(map(int, input().split())) for _ in range(N - 1)]\n\n\n\ngraph = [[] for _ in range(N + 1)]\n\nfor u, v, w in X:\n\n graph[u].append((v, w))\n\n graph[v].append((u, w))\n\n\n\ncolors = [-1] * (N + 1)\n\ncolors[1] = 0\n\nq = deque([1])\n\nwhile q:\n\n u = q.popleft()\n\n for v, w in graph[u]:\n\n if colors[v] >= 0:\n\n continue\n\n\n\n if w % 2 == 0:\n\n colors[v] = colors[u]\n\n else:\n\n colors[v] = 1 - colors[u]\n\n q.append(v)\n\n\n\nprint(*colors[1:], sep=\"\\n\")\n","code_v0_loc":30,"code_v1_loc":27,"code_v0_num_chars":573,"code_v1_num_chars":562,"code_v0_no_empty_lines":"N = int(input())\nedges = [list(map(int, input().split())) for _ in range(N - 1)]\ngraph = [[] for _ in range(N + 1)]\nfor u, v, w in edges:\n graph[u].append((v, w))\n graph[v].append((u, w))\nedges.sort()\ncolor = [-1] * (N + 1)\ncolor[1] = 0\nque = [1]\nwhile que:\n u = que.pop()\n for v, w in graph[u]:\n if color[v] != -1:\n continue\n if w % 2 == 0:\n color[v] = color[u]\n else:\n color[v] = color[u] ^ 1\n que.append(v)\nprint(*color[1:], sep=\"\\n\")\n","code_v1_no_empty_lines":"from collections import deque\n\nN = int(input())\nX = [list(map(int, input().split())) for _ in range(N - 1)]\ngraph = [[] for _ in range(N + 1)]\nfor u, v, w in X:\n graph[u].append((v, w))\n graph[v].append((u, w))\ncolors = [-1] * (N + 1)\ncolors[1] = 0\nq = deque([1])\nwhile q:\n u = q.popleft()\n for v, w in graph[u]:\n if colors[v] >= 0:\n continue\n if w % 2 == 0:\n colors[v] = colors[u]\n else:\n colors[v] = 1 - colors[u]\n q.append(v)\nprint(*colors[1:], sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["+from collections import deque","+","-edges = [list(map(int, input().split())) for _ in range(N - 1)]","+X = [list(map(int, input().split())) for _ in range(N - 1)]","-for u, v, w in edges:","+for u, v, w in X:","-edges.sort()","-color = [-1] * (N + 1)","-color[1] = 0","-que = [1]","-while que:","- u = que.pop()","+colors = [-1] * (N + 1)","+colors[1] = 0","+q = deque([1])","+while q:","+ u = q.popleft()","- if color[v] != -1:","+ if colors[v] >= 0:","- color[v] = color[u]","+ colors[v] = colors[u]","- color[v] = color[u] ^ 1","- que.append(v)","-print(*color[1:], sep=\"\\n\")","+ colors[v] = 1 - colors[u]","+ q.append(v)","+print(*colors[1:], sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.075241015,"measured_runtime_v1":0.0787712806,"runtime_lift":0.9551833415,"key":["s940966406","s789994501"]} +{"user_id":"u729133443","problem_id":"p03725","language":"python","submission_id_v0":"s550271310","submission_id_v1":"s703542319","cpu_time_v0":1728,"cpu_time_v1":422,"memory_v0":26228,"memory_v1":58972,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":75.58,"input":"def solve():\n\n from collections import deque\n\n h, w, k = list(map(int, input().split()))\n\n maze = [eval(input()) for _ in range(h)]\n\n visited = [[-1]*w for _ in range(h)]\n\n for i in range(h):\n\n if 'S' in maze[i]:\n\n sy, sx = i, maze[i].index('S')\n\n break\n\n queue = deque([[sy, sx]])\n\n visited[sy][sx] = 0\n\n r = 10**18\n\n while queue:\n\n y, x = queue.popleft()\n\n r = min(r, y, h-1-y, x, w-1-x)\n\n if visited[y][x] == k: continue\n\n for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):\n\n new_y, new_x = y+i, x+j\n\n if new_y < 0 or new_y >= h or new_x < 0 or new_x >= w: continue\n\n if maze[new_y][new_x] == '.' and visited[new_y][new_x] == -1:\n\n visited[new_y][new_x] = visited[y][x] + 1\n\n queue.append([new_y, new_x])\n\n print((1 -(-r \/\/ k)))\n\nif __name__ == '__main__':\n\n solve()\n","target":"from collections import deque;h,w,k=list(map(int,input().split()));m=[eval(input())for _ in[0]*h];v=[[-1]*w for _ in[0]*h];r=9**20\n\nfor i in range(h):\n\n if'S'in m[i]:j=m[i].index('S');q=deque([[i,j]]);v[i][j]=0\n\nwhile q:\n\n y,x=q.popleft()\n\n r=min(r,y,x,h-1-y,w-1-x)\n\n if v[y][x]==k:continue\n\n for i,j in([1,0],[-1,0],[0,1],[0,-1]):\n\n t,u=y+i,x+j\n\n if t>=0and t=0and u= h or new_x < 0 or new_x >= w:\n continue\n if maze[new_y][new_x] == \".\" and visited[new_y][new_x] == -1:\n visited[new_y][new_x] = visited[y][x] + 1\n queue.append([new_y, new_x])\n print((1 - (-r \/\/ k)))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"from collections import deque\n\nh, w, k = list(map(int, input().split()))\nm = [eval(input()) for _ in [0] * h]\nv = [[-1] * w for _ in [0] * h]\nr = 9**20\nfor i in range(h):\n if \"S\" in m[i]:\n j = m[i].index(\"S\")\n q = deque([[i, j]])\n v[i][j] = 0\nwhile q:\n y, x = q.popleft()\n r = min(r, y, x, h - 1 - y, w - 1 - x)\n if v[y][x] == k:\n continue\n for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):\n t, u = y + i, x + j\n if t >= 0 and t < h and u >= 0 and u < w and m[t][u] == \".\" and v[t][u] < 0:\n v[t][u] = v[y][x] + 1\n q.append([t, u])\nprint((1 - (-r \/\/ k)))\n","code_same":false,"relative_loc_diff_percent":56.0,"diff":["-def solve():","- from collections import deque","+from collections import deque","- h, w, k = list(map(int, input().split()))","- maze = [eval(input()) for _ in range(h)]","- visited = [[-1] * w for _ in range(h)]","- for i in range(h):","- if \"S\" in maze[i]:","- sy, sx = i, maze[i].index(\"S\")","- break","- queue = deque([[sy, sx]])","- visited[sy][sx] = 0","- r = 10**18","- while queue:","- y, x = queue.popleft()","- r = min(r, y, h - 1 - y, x, w - 1 - x)","- if visited[y][x] == k:","- continue","- for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):","- new_y, new_x = y + i, x + j","- if new_y < 0 or new_y >= h or new_x < 0 or new_x >= w:","- continue","- if maze[new_y][new_x] == \".\" and visited[new_y][new_x] == -1:","- visited[new_y][new_x] = visited[y][x] + 1","- queue.append([new_y, new_x])","- print((1 - (-r \/\/ k)))","-","-","-if __name__ == \"__main__\":","- solve()","+h, w, k = list(map(int, input().split()))","+m = [eval(input()) for _ in [0] * h]","+v = [[-1] * w for _ in [0] * h]","+r = 9**20","+for i in range(h):","+ if \"S\" in m[i]:","+ j = m[i].index(\"S\")","+ q = deque([[i, j]])","+ v[i][j] = 0","+while q:","+ y, x = q.popleft()","+ r = min(r, y, x, h - 1 - y, w - 1 - x)","+ if v[y][x] == k:","+ continue","+ for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):","+ t, u = y + i, x + j","+ if t >= 0 and t < h and u >= 0 and u < w and m[t][u] == \".\" and v[t][u] < 0:","+ v[t][u] = v[y][x] + 1","+ q.append([t, u])","+print((1 - (-r \/\/ k)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1105581951,"measured_runtime_v1":0.0361988437,"runtime_lift":3.0541913423,"key":["s550271310","s703542319"]} +{"user_id":"u133936772","problem_id":"p03072","language":"python","submission_id_v0":"s513104780","submission_id_v1":"s293768553","cpu_time_v0":29,"cpu_time_v1":25,"memory_v0":9156,"memory_v1":9136,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.79,"input":"n=int(eval(input()))\n\nl=list(map(int,input().split()))\n\nm=c=0\n\nfor i in l:\n\n if m<=i:\n\n m=i\n\n c+=1\n\nprint(c)","target":"_,*l=list(map(int,open(0).read().split()))\n\nm=c=0\n\nfor i in l:\n\n if m<=i: m=i; c+=1\n\nprint(c)","code_v0_loc":8,"code_v1_loc":5,"code_v0_num_chars":103,"code_v1_num_chars":88,"code_v0_no_empty_lines":"n = int(eval(input()))\nl = list(map(int, input().split()))\nm = c = 0\nfor i in l:\n if m <= i:\n m = i\n c += 1\nprint(c)\n","code_v1_no_empty_lines":"_, *l = list(map(int, open(0).read().split()))\nm = c = 0\nfor i in l:\n if m <= i:\n m = i\n c += 1\nprint(c)\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-n = int(eval(input()))","-l = list(map(int, input().split()))","+_, *l = list(map(int, open(0).read().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0792029228,"measured_runtime_v1":0.1394134676,"runtime_lift":0.5681152915,"key":["s513104780","s293768553"]} +{"user_id":"u190866453","problem_id":"p03285","language":"python","submission_id_v0":"s213345525","submission_id_v1":"s343358777","cpu_time_v0":29,"cpu_time_v1":26,"memory_v0":9028,"memory_v1":9064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.34,"input":"n = int(eval(input()))\n\n\n\ncount = 0\n\n\n\nfor i in range(26):\n\n for j in range(15):\n\n if 4 * i + 7 * j == n:\n\n count += 1\n\n break\n\n else:\n\n pass\n\n\n\nif count == 0:\n\n print(\"No\")\n\nelse:\n\n print(\"Yes\")","target":"n = int(eval(input()))\n\n\n\nf = False\n\n\n\nfor i in range(26):\n\n for j in range(15):\n\n if 4 * i + 7 * j == n:\n\n f = True\n\n break\n\n else:\n\n pass\n\n\n\nif f:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")","code_v0_loc":16,"code_v1_loc":16,"code_v0_num_chars":245,"code_v1_num_chars":234,"code_v0_no_empty_lines":"n = int(eval(input()))\ncount = 0\nfor i in range(26):\n for j in range(15):\n if 4 * i + 7 * j == n:\n count += 1\n break\n else:\n pass\nif count == 0:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\nf = False\nfor i in range(26):\n for j in range(15):\n if 4 * i + 7 * j == n:\n f = True\n break\n else:\n pass\nif f:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-count = 0","+f = False","- count += 1","+ f = True","-if count == 0:","+if f:","+ print(\"Yes\")","+else:","-else:","- print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0375028665,"measured_runtime_v1":0.0384930112,"runtime_lift":0.9742772855,"key":["s213345525","s343358777"]} +{"user_id":"u852690916","problem_id":"p02888","language":"python","submission_id_v0":"s819782065","submission_id_v1":"s788371840","cpu_time_v0":1659,"cpu_time_v1":709,"memory_v0":3188,"memory_v1":42716,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":57.26,"input":"N=int(eval(input()))\n\n*L,=list(map(int, input().split()))\n\nL.sort()\n\n\n\nans=0\n\nfrom bisect import bisect_right\n\nfor i in range(N-1,-1,-1):\n\n li = L[i]\n\n for j in range(i-1,-1,-1):\n\n lj = L[j]\n\n k = bisect_right(L, li-lj)\n\n ans += max(0, j-k)\n\nprint(ans)","target":"from bisect import bisect_right\n\nimport sys\n\ndef main():\n\n input = sys.stdin.readline\n\n N = int(eval(input()))\n\n *L, = list(map(int, input().split()))\n\n L.sort()\n\n ans = 0\n\n for i in range(2, N):\n\n for j in range(i):\n\n k = bisect_right(L, L[i] - L[j], j + 1, i)\n\n ans += i - k\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":13,"code_v1_loc":16,"code_v0_num_chars":267,"code_v1_num_chars":370,"code_v0_no_empty_lines":"N = int(eval(input()))\n(*L,) = list(map(int, input().split()))\nL.sort()\nans = 0\nfrom bisect import bisect_right\n\nfor i in range(N - 1, -1, -1):\n li = L[i]\n for j in range(i - 1, -1, -1):\n lj = L[j]\n k = bisect_right(L, li - lj)\n ans += max(0, j - k)\nprint(ans)\n","code_v1_no_empty_lines":"from bisect import bisect_right\nimport sys\n\n\ndef main():\n input = sys.stdin.readline\n N = int(eval(input()))\n (*L,) = list(map(int, input().split()))\n L.sort()\n ans = 0\n for i in range(2, N):\n for j in range(i):\n k = bisect_right(L, L[i] - L[j], j + 1, i)\n ans += i - k\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["-N = int(eval(input()))","-(*L,) = list(map(int, input().split()))","-L.sort()","-ans = 0","+import sys","-for i in range(N - 1, -1, -1):","- li = L[i]","- for j in range(i - 1, -1, -1):","- lj = L[j]","- k = bisect_right(L, li - lj)","- ans += max(0, j - k)","-print(ans)","+","+def main():","+ input = sys.stdin.readline","+ N = int(eval(input()))","+ (*L,) = list(map(int, input().split()))","+ L.sort()","+ ans = 0","+ for i in range(2, N):","+ for j in range(i):","+ k = bisect_right(L, L[i] - L[j], j + 1, i)","+ ans += i - k","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0453254764,"measured_runtime_v1":0.0437583437,"runtime_lift":1.035813346,"key":["s819782065","s788371840"]} +{"user_id":"u197615397","problem_id":"p02368","language":"python","submission_id_v0":"s974543153","submission_id_v1":"s290620114","cpu_time_v0":1060,"cpu_time_v1":920,"memory_v0":24328,"memory_v1":24260,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.21,"input":"def solve():\n\n N, M = list(map(int, input().split()))\n\n edges = [[] for _ in [0]*N]\n\n r_edges = [[] for _ in [0]*N]\n\n\n\n for _ in [0]*M:\n\n a, b = list(map(int, input().split()))\n\n edges[a].append(b)\n\n r_edges[b].append(a)\n\n \n\n c = get_strongly_connected_components(edges, r_edges)\n\n group = [0]*N\n\n for i in range(len(c)):\n\n for v in c[i]:\n\n group[v] = i\n\n\n\n result = []\n\n append = result.append\n\n for _ in [0]*int(eval(input())):\n\n a, b = list(map(int, input().split()))\n\n append(\"1\" if group[a] == group[b] else \"0\")\n\n\n\n print((\"\\n\".join(result)))\n\n\n\n\n\ndef get_strongly_connected_components(edges, r_edges):\n\n import sys\n\n sys.setrecursionlimit(10**7)\n\n v_count = len(edges)\n\n order = [0]*v_count\n\n k = 1\n\n\n\n def get_order(v):\n\n order[v] = 1\n\n nonlocal k\n\n for dest in edges[v]:\n\n if order[dest] == 0:\n\n get_order(dest)\n\n order[v] = k\n\n k += 1\n\n\n\n def get_components(v):\n\n order[v] = 0\n\n return [v] + [_v for dest in r_edges[v] if order[dest] > 0 for _v in get_components(dest)]\n\n\n\n [None for v in range(v_count) if order[v] == 0 and get_order(v)]\n\n return [get_components(v) for v, _ in sorted(enumerate(order), key=lambda x: x[1], reverse=True) if order[v] > 0]\n\n\n\nif __name__ == \"__main__\":\n\n solve()","target":"def solve():\n\n N, M = list(map(int, input().split()))\n\n edges = [[] for _ in [0]*N]\n\n r_edges = [[] for _ in [0]*N]\n\n\n\n for _ in [0]*M:\n\n a, b = list(map(int, input().split()))\n\n edges[a].append(b)\n\n r_edges[b].append(a)\n\n\n\n c = get_strongly_connected_components(edges, r_edges)\n\n group = [0]*N\n\n for i in range(len(c)):\n\n for v in c[i]:\n\n group[v] = i\n\n\n\n result = []\n\n append = result.append\n\n for _ in [0]*int(eval(input())):\n\n a, b = list(map(int, input().split()))\n\n append(\"1\" if group[a] == group[b] else \"0\")\n\n\n\n print((\"\\n\".join(result)))\n\n\n\n\n\ndef get_strongly_connected_components(edges, r_edges):\n\n import sys\n\n sys.setrecursionlimit(10**7)\n\n v_count = len(edges)\n\n order = [0]*v_count\n\n k = [1]\n\n\n\n def get_order(v):\n\n order[v] = 1\n\n for dest in edges[v]:\n\n if order[dest] == 0:\n\n get_order(dest)\n\n order[v] = k[0]\n\n k[0] += 1\n\n\n\n def get_components(v):\n\n order[v] = 0\n\n return [v] + [_v for dest in r_edges[v] if order[dest] > 0 for _v in get_components(dest)]\n\n\n\n [None for v in range(v_count) if order[v] == 0 and get_order(v)]\n\n return [get_components(v) for v, _ in sorted(enumerate(order), key=lambda x: x[1], reverse=True) if order[v] > 0]\n\n\n\nif __name__ == \"__main__\":\n\n solve()","code_v0_loc":50,"code_v1_loc":49,"code_v0_num_chars":1376,"code_v1_num_chars":1356,"code_v0_no_empty_lines":"def solve():\n N, M = list(map(int, input().split()))\n edges = [[] for _ in [0] * N]\n r_edges = [[] for _ in [0] * N]\n for _ in [0] * M:\n a, b = list(map(int, input().split()))\n edges[a].append(b)\n r_edges[b].append(a)\n c = get_strongly_connected_components(edges, r_edges)\n group = [0] * N\n for i in range(len(c)):\n for v in c[i]:\n group[v] = i\n result = []\n append = result.append\n for _ in [0] * int(eval(input())):\n a, b = list(map(int, input().split()))\n append(\"1\" if group[a] == group[b] else \"0\")\n print((\"\\n\".join(result)))\n\n\ndef get_strongly_connected_components(edges, r_edges):\n import sys\n\n sys.setrecursionlimit(10**7)\n v_count = len(edges)\n order = [0] * v_count\n k = 1\n\n def get_order(v):\n order[v] = 1\n nonlocal k\n for dest in edges[v]:\n if order[dest] == 0:\n get_order(dest)\n order[v] = k\n k += 1\n\n def get_components(v):\n order[v] = 0\n return [v] + [\n _v for dest in r_edges[v] if order[dest] > 0 for _v in get_components(dest)\n ]\n\n [None for v in range(v_count) if order[v] == 0 and get_order(v)]\n return [\n get_components(v)\n for v, _ in sorted(enumerate(order), key=lambda x: x[1], reverse=True)\n if order[v] > 0\n ]\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"def solve():\n N, M = list(map(int, input().split()))\n edges = [[] for _ in [0] * N]\n r_edges = [[] for _ in [0] * N]\n for _ in [0] * M:\n a, b = list(map(int, input().split()))\n edges[a].append(b)\n r_edges[b].append(a)\n c = get_strongly_connected_components(edges, r_edges)\n group = [0] * N\n for i in range(len(c)):\n for v in c[i]:\n group[v] = i\n result = []\n append = result.append\n for _ in [0] * int(eval(input())):\n a, b = list(map(int, input().split()))\n append(\"1\" if group[a] == group[b] else \"0\")\n print((\"\\n\".join(result)))\n\n\ndef get_strongly_connected_components(edges, r_edges):\n import sys\n\n sys.setrecursionlimit(10**7)\n v_count = len(edges)\n order = [0] * v_count\n k = [1]\n\n def get_order(v):\n order[v] = 1\n for dest in edges[v]:\n if order[dest] == 0:\n get_order(dest)\n order[v] = k[0]\n k[0] += 1\n\n def get_components(v):\n order[v] = 0\n return [v] + [\n _v for dest in r_edges[v] if order[dest] > 0 for _v in get_components(dest)\n ]\n\n [None for v in range(v_count) if order[v] == 0 and get_order(v)]\n return [\n get_components(v)\n for v, _ in sorted(enumerate(order), key=lambda x: x[1], reverse=True)\n if order[v] > 0\n ]\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":2.0,"diff":["- k = 1","+ k = [1]","- nonlocal k","- order[v] = k","- k += 1","+ order[v] = k[0]","+ k[0] += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0420265083,"measured_runtime_v1":0.0618951223,"runtime_lift":0.6789954809,"key":["s974543153","s290620114"]} +{"user_id":"u094191970","problem_id":"p03221","language":"python","submission_id_v0":"s177819200","submission_id_v1":"s860221956","cpu_time_v0":826,"cpu_time_v1":671,"memory_v0":44112,"memory_v1":49984,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.77,"input":"n,m=list(map(int,input().split()))\n\n\n\nans=[[] for i in range(m)]\n\np_list=[[] for i in range(n+1)]\n\n\n\nfor i in range(m):\n\n p,y=list(map(int,input().split()))\n\n\n\n ans[i]=str(p).zfill(6)\n\n\n\n p_list[p].append([i,y])\n\n\n\nfor pp in p_list:\n\n pp=sorted(pp,key=lambda x:x[1])\n\n num=0\n\n for ppp in pp:\n\n num+=1\n\n ans[ppp[0]]+=str(num).zfill(6)\n\n num=0\n\n\n\nfor i in ans:\n\n print(i)","target":"from sys import stdin\n\nnii=lambda:list(map(int,stdin.readline().split()))\n\nlnii=lambda:list(map(int,stdin.readline()).split())\n\n\n\nn,m=nii()\n\n\n\nlist=[[] for i in range(n+1)]\n\n\n\nfor i in range(m):\n\n p,y=nii()\n\n list[p].append([y,i])\n\n\n\nans=[]\n\nfor i in range(1,n+1):\n\n tl=list[i]\n\n s_tl=sorted(tl,key=lambda x:x[0])\n\n for j in range(len(tl)):\n\n town=s_tl[j][1]\n\n s1=str(i).zfill(6)\n\n s2=str(j+1).zfill(6)\n\n s=s1+s2\n\n ans.append([town,s])\n\n\n\nans.sort(key=lambda x:x[0])\n\nfor i,j in ans:\n\n print(j)","code_v0_loc":22,"code_v1_loc":26,"code_v0_num_chars":359,"code_v1_num_chars":509,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nans = [[] for i in range(m)]\np_list = [[] for i in range(n + 1)]\nfor i in range(m):\n p, y = list(map(int, input().split()))\n ans[i] = str(p).zfill(6)\n p_list[p].append([i, y])\nfor pp in p_list:\n pp = sorted(pp, key=lambda x: x[1])\n num = 0\n for ppp in pp:\n num += 1\n ans[ppp[0]] += str(num).zfill(6)\n num = 0\nfor i in ans:\n print(i)\n","code_v1_no_empty_lines":"from sys import stdin\n\nnii = lambda: list(map(int, stdin.readline().split()))\nlnii = lambda: list(map(int, stdin.readline()).split())\nn, m = nii()\nlist = [[] for i in range(n + 1)]\nfor i in range(m):\n p, y = nii()\n list[p].append([y, i])\nans = []\nfor i in range(1, n + 1):\n tl = list[i]\n s_tl = sorted(tl, key=lambda x: x[0])\n for j in range(len(tl)):\n town = s_tl[j][1]\n s1 = str(i).zfill(6)\n s2 = str(j + 1).zfill(6)\n s = s1 + s2\n ans.append([town, s])\nans.sort(key=lambda x: x[0])\nfor i, j in ans:\n print(j)\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["-n, m = list(map(int, input().split()))","-ans = [[] for i in range(m)]","-p_list = [[] for i in range(n + 1)]","+from sys import stdin","+","+nii = lambda: list(map(int, stdin.readline().split()))","+lnii = lambda: list(map(int, stdin.readline()).split())","+n, m = nii()","+list = [[] for i in range(n + 1)]","- p, y = list(map(int, input().split()))","- ans[i] = str(p).zfill(6)","- p_list[p].append([i, y])","-for pp in p_list:","- pp = sorted(pp, key=lambda x: x[1])","- num = 0","- for ppp in pp:","- num += 1","- ans[ppp[0]] += str(num).zfill(6)","- num = 0","-for i in ans:","- print(i)","+ p, y = nii()","+ list[p].append([y, i])","+ans = []","+for i in range(1, n + 1):","+ tl = list[i]","+ s_tl = sorted(tl, key=lambda x: x[0])","+ for j in range(len(tl)):","+ town = s_tl[j][1]","+ s1 = str(i).zfill(6)","+ s2 = str(j + 1).zfill(6)","+ s = s1 + s2","+ ans.append([town, s])","+ans.sort(key=lambda x: x[0])","+for i, j in ans:","+ print(j)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0958441173,"measured_runtime_v1":0.0707408342,"runtime_lift":1.3548626949,"key":["s177819200","s860221956"]} +{"user_id":"u272557899","problem_id":"p03001","language":"python","submission_id_v0":"s101643668","submission_id_v1":"s725166664","cpu_time_v0":42,"cpu_time_v1":17,"memory_v0":5464,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.52,"input":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random\n\nimport sys\n\nfrom collections import deque, defaultdict, Counter; from heapq import heappush, heappop\n\nfrom itertools import permutations, combinations, product, accumulate, groupby\n\nfrom bisect import bisect_left, bisect_right, insort_left, insort_right\n\nfrom operator import itemgetter as ig\n\nsys.setrecursionlimit(10 ** 7)\n\ninf = 10 ** 20; INF = float(\"INF\"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []\n\neps = 1.0 \/ 10 ** 10; mod = 10 ** 9 + 7\n\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]\n\n\"\"\"for dx, dy in dd:\n\n nx = j + dx; ny = i + dy\n\n if 0 <= nx < w and 0 <= ny < h:\"\"\"\n\ndef wi(): return list(map(int, sys.stdin.readline().split()))\n\ndef wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint\n\ndef ws(): return sys.stdin.readline().split()\n\ndef i(): return int(sys.stdin.readline())\n\ndef s(): return eval(input())\n\ndef hi(n): return [i() for _ in range(n)]\n\ndef hs(n): return [s() for _ in range(n)]#HeightString\n\ndef mi(n): return [wi() for _ in range(n)]#MatrixInt\n\ndef mip(n): return [wip() for _ in range(n)]\n\ndef ms(n): return [ws() for _ in range(n)]\n\n\n\nW, H, x, y = wi()\n\nans = (H * W) \/ 2\n\nif x == W \/ 2 and y == H \/ 2:\n\n print((ans, 1))\n\nelse:\n\n print((ans, 0))\n","target":"import sys\n\ndef wi(): return list(map(int, sys.stdin.readline().split()))\n\nW, H, x, y = wi()\n\nans = (H * W) \/ 2\n\nif x == W \/ 2 and y == H \/ 2:\n\n print((ans, 1))\n\nelse:\n\n print((ans, 0))","code_v0_loc":30,"code_v1_loc":8,"code_v0_num_chars":1402,"code_v1_num_chars":187,"code_v0_no_empty_lines":"import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random\nimport sys\nfrom collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop\nfrom itertools import permutations, combinations, product, accumulate, groupby\nfrom bisect import bisect_left, bisect_right, insort_left, insort_right\nfrom operator import itemgetter as ig\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\nINF = float(\"INF\")\nans = 0\ntmp = 0\nansli = []\ntmpli = []\ncandili = []\neps = 1.0 \/ 10**10\nmod = 10**9 + 7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]\nddn9 = ddn + [(0, 0)]\n\"\"\"for dx, dy in dd:\n nx = j + dx; ny = i + dy\n if 0 <= nx < w and 0 <= ny < h:\"\"\"\n\n\ndef wi():\n return list(map(int, sys.stdin.readline().split()))\n\n\ndef wip():\n return [int(x) - 1 for x in sys.stdin.readline().split()] # WideIntPoint\n\n\ndef ws():\n return sys.stdin.readline().split()\n\n\ndef i():\n return int(sys.stdin.readline())\n\n\ndef s():\n return eval(input())\n\n\ndef hi(n):\n return [i() for _ in range(n)]\n\n\ndef hs(n):\n return [s() for _ in range(n)] # HeightString\n\n\ndef mi(n):\n return [wi() for _ in range(n)] # MatrixInt\n\n\ndef mip(n):\n return [wip() for _ in range(n)]\n\n\ndef ms(n):\n return [ws() for _ in range(n)]\n\n\nW, H, x, y = wi()\nans = (H * W) \/ 2\nif x == W \/ 2 and y == H \/ 2:\n print((ans, 1))\nelse:\n print((ans, 0))\n","code_v1_no_empty_lines":"import sys\n\n\ndef wi():\n return list(map(int, sys.stdin.readline().split()))\n\n\nW, H, x, y = wi()\nans = (H * W) \/ 2\nif x == W \/ 2 and y == H \/ 2:\n print((ans, 1))\nelse:\n print((ans, 0))\n","code_same":false,"relative_loc_diff_percent":73.3333333333,"diff":["-import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random","-from collections import deque, defaultdict, Counter","-from heapq import heappush, heappop","-from itertools import permutations, combinations, product, accumulate, groupby","-from bisect import bisect_left, bisect_right, insort_left, insort_right","-from operator import itemgetter as ig","-","-sys.setrecursionlimit(10**7)","-inf = 10**20","-INF = float(\"INF\")","-ans = 0","-tmp = 0","-ansli = []","-tmpli = []","-candili = []","-eps = 1.0 \/ 10**10","-mod = 10**9 + 7","-dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]","-ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]","-ddn9 = ddn + [(0, 0)]","-\"\"\"for dx, dy in dd:","- nx = j + dx; ny = i + dy","- if 0 <= nx < w and 0 <= ny < h:\"\"\"","-","-","-def wip():","- return [int(x) - 1 for x in sys.stdin.readline().split()] # WideIntPoint","-","-","-def ws():","- return sys.stdin.readline().split()","-","-","-def i():","- return int(sys.stdin.readline())","-","-","-def s():","- return eval(input())","-","-","-def hi(n):","- return [i() for _ in range(n)]","-","-","-def hs(n):","- return [s() for _ in range(n)] # HeightString","-","-","-def mi(n):","- return [wi() for _ in range(n)] # MatrixInt","-","-","-def mip(n):","- return [wip() for _ in range(n)]","-","-","-def ms(n):","- return [ws() for _ in range(n)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0381112305,"measured_runtime_v1":0.0434171325,"runtime_lift":0.8777924355,"key":["s101643668","s725166664"]} +{"user_id":"u597622207","problem_id":"p02689","language":"python","submission_id_v0":"s094989099","submission_id_v1":"s954161480","cpu_time_v0":494,"cpu_time_v1":436,"memory_v0":51272,"memory_v1":41180,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.74,"input":"N, M = list(map(int, input().split()))\n\nH = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\n\n\n\n\ngraph = [[] for _ in range(N+1)]\n\nfor edge in edges:\n\n graph[edge[0]].append(edge[1])\n\n graph[edge[1]].append(edge[0])\n\n\n\nans = []\n\n\n\nfor i in range(1,N+1):\n\n can = graph[i]\n\n hights = []\n\n for j in can:\n\n hights.append(H[j-1])\n\n if len(hights) == 0:\n\n ans.append(i)\n\n else:\n\n h = max(hights)\n\n if H[i-1] > h:\n\n ans.append(i)\n\n\n\nprint((len(set(ans))))","target":"N, M = list(map(int, input().split()))\n\nH = list(map(int, input().split()))\n\nedges = [list(map(int, input().split())) for _ in range(M)]\n\n\n\ngraph = [[] for _ in range(N+1)]\n\nfor edge in edges:\n\n graph[edge[0]].append(edge[1])\n\n graph[edge[1]].append(edge[0])\n\n\n\n\n\nans = 0\n\nfor i in range(1,N+1):\n\n highest = True\n\n for j in graph[i]:\n\n if H[i-1] <= H[j-1]:\n\n highest = False\n\n if highest:\n\n ans += 1\n\n\n\nprint(ans)","code_v0_loc":26,"code_v1_loc":20,"code_v0_num_chars":547,"code_v1_num_chars":447,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nH = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N + 1)]\nfor edge in edges:\n graph[edge[0]].append(edge[1])\n graph[edge[1]].append(edge[0])\nans = []\nfor i in range(1, N + 1):\n can = graph[i]\n hights = []\n for j in can:\n hights.append(H[j - 1])\n if len(hights) == 0:\n ans.append(i)\n else:\n h = max(hights)\n if H[i - 1] > h:\n ans.append(i)\nprint((len(set(ans))))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nH = list(map(int, input().split()))\nedges = [list(map(int, input().split())) for _ in range(M)]\ngraph = [[] for _ in range(N + 1)]\nfor edge in edges:\n graph[edge[0]].append(edge[1])\n graph[edge[1]].append(edge[0])\nans = 0\nfor i in range(1, N + 1):\n highest = True\n for j in graph[i]:\n if H[i - 1] <= H[j - 1]:\n highest = False\n if highest:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-ans = []","+ans = 0","- can = graph[i]","- hights = []","- for j in can:","- hights.append(H[j - 1])","- if len(hights) == 0:","- ans.append(i)","- else:","- h = max(hights)","- if H[i - 1] > h:","- ans.append(i)","-print((len(set(ans))))","+ highest = True","+ for j in graph[i]:","+ if H[i - 1] <= H[j - 1]:","+ highest = False","+ if highest:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0350211586,"measured_runtime_v1":0.0360137379,"runtime_lift":0.97243887,"key":["s094989099","s954161480"]} +{"user_id":"u645250356","problem_id":"p02804","language":"python","submission_id_v0":"s277598114","submission_id_v1":"s603613694","cpu_time_v0":378,"cpu_time_v1":154,"memory_v0":98968,"memory_v1":96232,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.26,"input":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush,heapify\n\nimport sys,bisect,math,itertools,fractions,pprint\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nclass Combination:\n\n \"\"\"\n\n comb = Combination(1000000)\n\n print(comb(5, 3)) # 10\n\n \"\"\"\n\n def __init__(self, n_max, mod=10**9+7):\n\n self.mod = mod\n\n self.modinv = self.make_modinv_list(n_max)\n\n self.fac, self.facinv = self.make_factorial_list(n_max)\n\n\n\n def __call__(self, n, r):\n\n return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod\n\n\n\n def make_factorial_list(self, n):\n\n # \u968e\u4e57\u306e\u30ea\u30b9\u30c8\u3068\u968e\u4e57\u306emod\u9006\u5143\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(n)\n\n # self.make_modinv_list()\u304c\u5148\u306b\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308b\n\n fac = [1]\n\n facinv = [1]\n\n for i in range(1, n+1):\n\n fac.append(fac[i-1] * i % self.mod)\n\n facinv.append(facinv[i-1] * self.modinv[i] % self.mod)\n\n return fac, facinv\n\n\n\n def make_modinv_list(self, n):\n\n # 0\u304b\u3089n\u307e\u3067\u306emod\u9006\u5143\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(n)\n\n modinv = [0] * (n+1)\n\n modinv[1] = 1\n\n for i in range(2, n+1):\n\n modinv[i] = self.mod - self.mod\/\/i * modinv[self.mod%i] % self.mod\n\n return modinv\n\nn,k = inpl()\n\na = sorted(inpl())\n\nres = 0\n\ncomb = Combination(10**5+10)\n\nfor i in range(n):\n\n if n-i-1 < k-1: continue\n\n p = comb(n-i-1,k-1)\n\n res -= a[i] * p\n\n res += a[-1-i] * p\n\n res %= mod\n\nprint(res)","target":"from collections import Counter,defaultdict,deque\n\nfrom heapq import heappop,heappush\n\nfrom bisect import bisect_left,bisect_right \n\nimport sys,math,itertools,fractions\n\nsys.setrecursionlimit(10**8)\n\nmod = 10**9+7\n\nINF = float('inf')\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\n\n\nclass Combination:\n\n \"\"\"\n\n comb = Combination(1000000)\n\n print(comb(5, 3)) # 10\n\n \"\"\"\n\n def __init__(self, n_max, mod=10**9+7):\n\n self.mod = mod\n\n self.modinv = self.make_modinv_list(n_max)\n\n self.fac, self.facinv = self.make_factorial_list(n_max)\n\n\n\n def __call__(self, n, r):\n\n return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod\n\n\n\n def make_factorial_list(self, n):\n\n # \u968e\u4e57\u306e\u30ea\u30b9\u30c8\u3068\u968e\u4e57\u306emod\u9006\u5143\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(n)\n\n # self.make_modinv_list()\u304c\u5148\u306b\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308b\n\n fac = [1]\n\n facinv = [1]\n\n for i in range(1, n+1):\n\n fac.append(fac[i-1] * i % self.mod)\n\n facinv.append(facinv[i-1] * self.modinv[i] % self.mod)\n\n return fac, facinv\n\n\n\n def make_modinv_list(self, n):\n\n # 0\u304b\u3089n\u307e\u3067\u306emod\u9006\u5143\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(n)\n\n modinv = [0] * (n+1)\n\n modinv[1] = 1\n\n for i in range(2, n+1):\n\n modinv[i] = self.mod - self.mod\/\/i * modinv[self.mod%i] % self.mod\n\n return modinv\n\n\n\ncomb = Combination(100010)\n\nn,k = inpl()\n\na = inpl()\n\na.sort()\n\nmx = 0\n\nfor i in range(n):\n\n if n-i-1 < k-1: continue\n\n tmp = comb(n-i-1,k-1)\n\n # print(tmp)\n\n mx += tmp*a[-i-1] - tmp*a[i]\n\n mx %= mod\n\nprint(mx) ","code_v0_loc":50,"code_v1_loc":53,"code_v0_num_chars":1559,"code_v1_num_chars":1592,"code_v0_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, fractions, pprint\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nclass Combination:\n \"\"\"\n comb = Combination(1000000)\n print(comb(5, 3)) # 10\n \"\"\"\n\n def __init__(self, n_max, mod=10**9 + 7):\n self.mod = mod\n self.modinv = self.make_modinv_list(n_max)\n self.fac, self.facinv = self.make_factorial_list(n_max)\n\n def __call__(self, n, r):\n return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod\n\n def make_factorial_list(self, n):\n # \u968e\u4e57\u306e\u30ea\u30b9\u30c8\u3068\u968e\u4e57\u306emod\u9006\u5143\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(n)\n # self.make_modinv_list()\u304c\u5148\u306b\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308b\n fac = [1]\n facinv = [1]\n for i in range(1, n + 1):\n fac.append(fac[i - 1] * i % self.mod)\n facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)\n return fac, facinv\n\n def make_modinv_list(self, n):\n # 0\u304b\u3089n\u307e\u3067\u306emod\u9006\u5143\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(n)\n modinv = [0] * (n + 1)\n modinv[1] = 1\n for i in range(2, n + 1):\n modinv[i] = self.mod - self.mod \/\/ i * modinv[self.mod % i] % self.mod\n return modinv\n\n\nn, k = inpl()\na = sorted(inpl())\nres = 0\ncomb = Combination(10**5 + 10)\nfor i in range(n):\n if n - i - 1 < k - 1:\n continue\n p = comb(n - i - 1, k - 1)\n res -= a[i] * p\n res += a[-1 - i] * p\n res %= mod\nprint(res)\n","code_v1_no_empty_lines":"from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush\nfrom bisect import bisect_left, bisect_right\nimport sys, math, itertools, fractions\n\nsys.setrecursionlimit(10**8)\nmod = 10**9 + 7\nINF = float(\"inf\")\n\n\ndef inp():\n return int(sys.stdin.readline())\n\n\ndef inpl():\n return list(map(int, sys.stdin.readline().split()))\n\n\nclass Combination:\n \"\"\"\n comb = Combination(1000000)\n print(comb(5, 3)) # 10\n \"\"\"\n\n def __init__(self, n_max, mod=10**9 + 7):\n self.mod = mod\n self.modinv = self.make_modinv_list(n_max)\n self.fac, self.facinv = self.make_factorial_list(n_max)\n\n def __call__(self, n, r):\n return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod\n\n def make_factorial_list(self, n):\n # \u968e\u4e57\u306e\u30ea\u30b9\u30c8\u3068\u968e\u4e57\u306emod\u9006\u5143\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(n)\n # self.make_modinv_list()\u304c\u5148\u306b\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308b\n fac = [1]\n facinv = [1]\n for i in range(1, n + 1):\n fac.append(fac[i - 1] * i % self.mod)\n facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)\n return fac, facinv\n\n def make_modinv_list(self, n):\n # 0\u304b\u3089n\u307e\u3067\u306emod\u9006\u5143\u306e\u30ea\u30b9\u30c8\u3092\u8fd4\u3059 O(n)\n modinv = [0] * (n + 1)\n modinv[1] = 1\n for i in range(2, n + 1):\n modinv[i] = self.mod - self.mod \/\/ i * modinv[self.mod % i] % self.mod\n return modinv\n\n\ncomb = Combination(100010)\nn, k = inpl()\na = inpl()\na.sort()\nmx = 0\nfor i in range(n):\n if n - i - 1 < k - 1:\n continue\n tmp = comb(n - i - 1, k - 1)\n # print(tmp)\n mx += tmp * a[-i - 1] - tmp * a[i]\n mx %= mod\nprint(mx)\n","code_same":false,"relative_loc_diff_percent":5.6603773585,"diff":["-from heapq import heappop, heappush, heapify","-import sys, bisect, math, itertools, fractions, pprint","+from heapq import heappop, heappush","+from bisect import bisect_left, bisect_right","+import sys, math, itertools, fractions","+comb = Combination(100010)","-a = sorted(inpl())","-res = 0","-comb = Combination(10**5 + 10)","+a = inpl()","+a.sort()","+mx = 0","- p = comb(n - i - 1, k - 1)","- res -= a[i] * p","- res += a[-1 - i] * p","- res %= mod","-print(res)","+ tmp = comb(n - i - 1, k - 1)","+ # print(tmp)","+ mx += tmp * a[-i - 1] - tmp * a[i]","+ mx %= mod","+print(mx)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1604995315,"measured_runtime_v1":0.1613639197,"runtime_lift":0.9946432372,"key":["s277598114","s603613694"]} +{"user_id":"u583507988","problem_id":"p03814","language":"python","submission_id_v0":"s498207142","submission_id_v1":"s145534601","cpu_time_v0":57,"cpu_time_v1":49,"memory_v0":3516,"memory_v1":9188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.04,"input":"s = eval(input())\n\n\n\nstart = min(i for i, x in enumerate(s) if x == 'A')\n\nend = max(j for j, y in enumerate(s) if y == 'Z')\n\n\n\nprint((end-start+1))","target":"s = eval(input())\n\n\n\na = s.find('A')\n\n#print(a)\n\nz = 0\n\nfor i in range(len(s)):\n\n if s[i] == 'Z':\n\n z = i\n\n#print(z)\n\nprint((z-a+1))","code_v0_loc":6,"code_v1_loc":10,"code_v0_num_chars":139,"code_v1_num_chars":128,"code_v0_no_empty_lines":"s = eval(input())\nstart = min(i for i, x in enumerate(s) if x == \"A\")\nend = max(j for j, y in enumerate(s) if y == \"Z\")\nprint((end - start + 1))\n","code_v1_no_empty_lines":"s = eval(input())\na = s.find(\"A\")\n# print(a)\nz = 0\nfor i in range(len(s)):\n if s[i] == \"Z\":\n z = i\n# print(z)\nprint((z - a + 1))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-start = min(i for i, x in enumerate(s) if x == \"A\")","-end = max(j for j, y in enumerate(s) if y == \"Z\")","-print((end - start + 1))","+a = s.find(\"A\")","+# print(a)","+z = 0","+for i in range(len(s)):","+ if s[i] == \"Z\":","+ z = i","+# print(z)","+print((z - a + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1158024395,"measured_runtime_v1":0.0460484838,"runtime_lift":2.514793751,"key":["s498207142","s145534601"]} +{"user_id":"u989345508","problem_id":"p03137","language":"python","submission_id_v0":"s681735256","submission_id_v1":"s633085461","cpu_time_v0":110,"cpu_time_v1":101,"memory_v0":13832,"memory_v1":13960,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.18,"input":"n,m=list(map(int,input().split()))\n\nx=sorted([int(i) for i in input().split()])\n\nxbet=sorted([abs(x[i+1]-x[i]) for i in range(m-1)],reverse=True)\n\ny=sum(xbet)\n\nif n>=m:\n\n print((0))\n\nelse:\n\n print((y-sum(xbet[:n-1])))\n","target":"n,m=list(map(int,input().split()))\n\nx=list(map(int,input().split()))\n\nx.sort()\n\ny=[x[i]-x[i-1] for i in range(1,m)]\n\ny.sort()\n\nprint((0 if n>=m else sum(y[:(m-n)])))","code_v0_loc":8,"code_v1_loc":6,"code_v0_num_chars":214,"code_v1_num_chars":157,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nx = sorted([int(i) for i in input().split()])\nxbet = sorted([abs(x[i + 1] - x[i]) for i in range(m - 1)], reverse=True)\ny = sum(xbet)\nif n >= m:\n print((0))\nelse:\n print((y - sum(xbet[: n - 1])))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nx = list(map(int, input().split()))\nx.sort()\ny = [x[i] - x[i - 1] for i in range(1, m)]\ny.sort()\nprint((0 if n >= m else sum(y[: (m - n)])))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-x = sorted([int(i) for i in input().split()])","-xbet = sorted([abs(x[i + 1] - x[i]) for i in range(m - 1)], reverse=True)","-y = sum(xbet)","-if n >= m:","- print((0))","-else:","- print((y - sum(xbet[: n - 1])))","+x = list(map(int, input().split()))","+x.sort()","+y = [x[i] - x[i - 1] for i in range(1, m)]","+y.sort()","+print((0 if n >= m else sum(y[: (m - n)])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.142125849,"measured_runtime_v1":0.1001149194,"runtime_lift":1.4196270627,"key":["s681735256","s633085461"]} +{"user_id":"u968404618","problem_id":"p02642","language":"python","submission_id_v0":"s271599871","submission_id_v1":"s025418462","cpu_time_v0":641,"cpu_time_v1":444,"memory_v0":32376,"memory_v1":32208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.73,"input":"n = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nMAX_N = max(A)+1\n\ncnt = [0] * MAX_N \n\n\n\nfor a in A:\n\n for i in range(a, MAX_N, a):\n\n if cnt[i] <= 2: cnt[i] += 1\n\n\n\nans = 0\n\nfor a in A:\n\n if cnt[a] == 1: ans += 1\n\nprint(ans)","target":"def main():\n\n ## IMPORT MODULE\n\n #import sys\n\n\n\n #sys.setrecursionlimit(100000)\n\n #input=lambda :sys.stdin.readline().rstrip()\n\n\n\n #f_inf=float(\"inf\")\n\n #MOD=10**9+7\n\n \n\n if 'get_ipython' in globals(): \n\n ## SAMPLE INPUT\n\n n = 5\n\n A = [24, 11, 8, 3, 16]\n\n\n\n else:\n\n ##INPUT \n\n n = int(eval(input()))\n\n A = list(map(int, input().split()))\n\n\n\n ## SUBMITION CODES HERE\n\n MAX_N = max(A)+1\n\n cnt = [0] * MAX_N \n\n\n\n for a in A:\n\n for i in range(a, MAX_N, a):\n\n if cnt[i] <= 2: cnt[i] += 1\n\n\n\n ans = 0\n\n for a in A:\n\n if cnt[a] == 1: ans += 1\n\n print(ans)\n\n \n\nmain()","code_v0_loc":14,"code_v1_loc":34,"code_v0_num_chars":237,"code_v1_num_chars":599,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nMAX_N = max(A) + 1\ncnt = [0] * MAX_N\nfor a in A:\n for i in range(a, MAX_N, a):\n if cnt[i] <= 2:\n cnt[i] += 1\nans = 0\nfor a in A:\n if cnt[a] == 1:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n ## IMPORT MODULE\n # import sys\n # sys.setrecursionlimit(100000)\n # input=lambda :sys.stdin.readline().rstrip()\n # f_inf=float(\"inf\")\n # MOD=10**9+7\n if \"get_ipython\" in globals():\n ## SAMPLE INPUT\n n = 5\n A = [24, 11, 8, 3, 16]\n else:\n ##INPUT\n n = int(eval(input()))\n A = list(map(int, input().split()))\n ## SUBMITION CODES HERE\n MAX_N = max(A) + 1\n cnt = [0] * MAX_N\n for a in A:\n for i in range(a, MAX_N, a):\n if cnt[i] <= 2:\n cnt[i] += 1\n ans = 0\n for a in A:\n if cnt[a] == 1:\n ans += 1\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":58.8235294118,"diff":["-n = int(eval(input()))","-A = list(map(int, input().split()))","-MAX_N = max(A) + 1","-cnt = [0] * MAX_N","-for a in A:","- for i in range(a, MAX_N, a):","- if cnt[i] <= 2:","- cnt[i] += 1","-ans = 0","-for a in A:","- if cnt[a] == 1:","- ans += 1","-print(ans)","+def main():","+ ## IMPORT MODULE","+ # import sys","+ # sys.setrecursionlimit(100000)","+ # input=lambda :sys.stdin.readline().rstrip()","+ # f_inf=float(\"inf\")","+ # MOD=10**9+7","+ if \"get_ipython\" in globals():","+ ## SAMPLE INPUT","+ n = 5","+ A = [24, 11, 8, 3, 16]","+ else:","+ ##INPUT","+ n = int(eval(input()))","+ A = list(map(int, input().split()))","+ ## SUBMITION CODES HERE","+ MAX_N = max(A) + 1","+ cnt = [0] * MAX_N","+ for a in A:","+ for i in range(a, MAX_N, a):","+ if cnt[i] <= 2:","+ cnt[i] += 1","+ ans = 0","+ for a in A:","+ if cnt[a] == 1:","+ ans += 1","+ print(ans)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0371642926,"measured_runtime_v1":0.105367857,"runtime_lift":0.3527099595,"key":["s271599871","s025418462"]} +{"user_id":"u021548497","problem_id":"p02588","language":"python","submission_id_v0":"s635922228","submission_id_v1":"s511368177","cpu_time_v0":1067,"cpu_time_v1":690,"memory_v0":9232,"memory_v1":23212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.33,"input":"def divide(n, p):\n\n c = 0\n\n while n%p == 0 and c < 18:\n\n c += 1\n\n n \/\/= p\n\n return c\n\n\n\nn = int(eval(input()))\n\ntable = [[0]*19 for _ in range(19)]\n\nfor i in range(n):\n\n sub = eval(input())\n\n key = float(sub)\n\n if \".\" in sub:\n\n a, b = list(map(str, sub.split(\".\")))\n\n s = int(a)*1000000000+10**(9-len(b))*int(b)\n\n else:\n\n s = int(sub)\n\n s *= 1000000000\n\n if key != s\/1000000000:\n\n while True:\n\n pass\n\n c2, c5 = divide(s, 2), divide(s, 5)\n\n table[c2][c5] += 1\n\n\n\nans = 0\n\nfor i in range(19):\n\n for j in range(19):\n\n for k in range(19):\n\n for l in range(19):\n\n if i+k < 18 or j+l < 18:\n\n continue;\n\n if i == k and j == l:\n\n ans += table[i][j]*(table[k][l]-1)\n\n else:\n\n ans += table[i][j]*table[k][l]\n\n\n\nans \/\/= 2\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\n\n\ndef divide(n):\n\n c1, c2 = 0, 0\n\n while (n%2 == 0):\n\n c1 += 1\n\n n \/\/= 2\n\n while (n%5 == 0):\n\n c2 += 1\n\n n \/\/= 5\n\n return (c1, c2)\n\n \n\n\n\ndef main():\n\n n = int(eval(input()))\n\n a = [None]*n\n\n for i in range(n):\n\n sub = input().replace(\"\\n\", \"\")\n\n if \".\" in sub:\n\n x, y = list(map(str, sub.split(\".\")))\n\n s = int(x)*1000000000+10**(9-len(y))*int(y)\n\n else:\n\n s = int(sub)\n\n s *= 1000000000\n\n a[i] = divide(s)\n\n\n\n dp = [[0]*100 for _ in range(100)]\n\n for i in range(n):\n\n c1, c2 = a[i]\n\n dp[c1][c2] += 1\n\n \n\n for i in range(98, -1, -1):\n\n for j in range(98, -1, -1):\n\n dp[i][j] += dp[i+1][j]+dp[i][j+1]-dp[i+1][j+1]\n\n\n\n ans = 0\n\n for i in range(n):\n\n c1, c2 = a[i]\n\n if (c1 >= 9 and c2 >= 9):\n\n ans -= 1\n\n if c1 >= 18 and c2 >= 18:\n\n ans += dp[0][0]\n\n continue\n\n if c1 >= 18:\n\n ans += dp[0][18-c2]\n\n continue\n\n if c2 >= 18:\n\n ans += dp[18-c1][0]\n\n continue\n\n ans += dp[18-c1][18-c2]\n\n \n\n print((ans\/\/2))\n\n \n\n \n\n \n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":38,"code_v1_loc":59,"code_v0_num_chars":917,"code_v1_num_chars":1290,"code_v0_no_empty_lines":"def divide(n, p):\n c = 0\n while n % p == 0 and c < 18:\n c += 1\n n \/\/= p\n return c\n\n\nn = int(eval(input()))\ntable = [[0] * 19 for _ in range(19)]\nfor i in range(n):\n sub = eval(input())\n key = float(sub)\n if \".\" in sub:\n a, b = list(map(str, sub.split(\".\")))\n s = int(a) * 1000000000 + 10 ** (9 - len(b)) * int(b)\n else:\n s = int(sub)\n s *= 1000000000\n if key != s \/ 1000000000:\n while True:\n pass\n c2, c5 = divide(s, 2), divide(s, 5)\n table[c2][c5] += 1\nans = 0\nfor i in range(19):\n for j in range(19):\n for k in range(19):\n for l in range(19):\n if i + k < 18 or j + l < 18:\n continue\n if i == k and j == l:\n ans += table[i][j] * (table[k][l] - 1)\n else:\n ans += table[i][j] * table[k][l]\nans \/\/= 2\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef divide(n):\n c1, c2 = 0, 0\n while n % 2 == 0:\n c1 += 1\n n \/\/= 2\n while n % 5 == 0:\n c2 += 1\n n \/\/= 5\n return (c1, c2)\n\n\ndef main():\n n = int(eval(input()))\n a = [None] * n\n for i in range(n):\n sub = input().replace(\"\\n\", \"\")\n if \".\" in sub:\n x, y = list(map(str, sub.split(\".\")))\n s = int(x) * 1000000000 + 10 ** (9 - len(y)) * int(y)\n else:\n s = int(sub)\n s *= 1000000000\n a[i] = divide(s)\n dp = [[0] * 100 for _ in range(100)]\n for i in range(n):\n c1, c2 = a[i]\n dp[c1][c2] += 1\n for i in range(98, -1, -1):\n for j in range(98, -1, -1):\n dp[i][j] += dp[i + 1][j] + dp[i][j + 1] - dp[i + 1][j + 1]\n ans = 0\n for i in range(n):\n c1, c2 = a[i]\n if c1 >= 9 and c2 >= 9:\n ans -= 1\n if c1 >= 18 and c2 >= 18:\n ans += dp[0][0]\n continue\n if c1 >= 18:\n ans += dp[0][18 - c2]\n continue\n if c2 >= 18:\n ans += dp[18 - c1][0]\n continue\n ans += dp[18 - c1][18 - c2]\n print((ans \/\/ 2))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":35.593220339,"diff":["-def divide(n, p):","- c = 0","- while n % p == 0 and c < 18:","- c += 1","- n \/\/= p","- return c","+import sys","+","+input = sys.stdin.readline","-n = int(eval(input()))","-table = [[0] * 19 for _ in range(19)]","-for i in range(n):","- sub = eval(input())","- key = float(sub)","- if \".\" in sub:","- a, b = list(map(str, sub.split(\".\")))","- s = int(a) * 1000000000 + 10 ** (9 - len(b)) * int(b)","- else:","- s = int(sub)","- s *= 1000000000","- if key != s \/ 1000000000:","- while True:","- pass","- c2, c5 = divide(s, 2), divide(s, 5)","- table[c2][c5] += 1","-ans = 0","-for i in range(19):","- for j in range(19):","- for k in range(19):","- for l in range(19):","- if i + k < 18 or j + l < 18:","- continue","- if i == k and j == l:","- ans += table[i][j] * (table[k][l] - 1)","- else:","- ans += table[i][j] * table[k][l]","-ans \/\/= 2","-print(ans)","+def divide(n):","+ c1, c2 = 0, 0","+ while n % 2 == 0:","+ c1 += 1","+ n \/\/= 2","+ while n % 5 == 0:","+ c2 += 1","+ n \/\/= 5","+ return (c1, c2)","+","+","+def main():","+ n = int(eval(input()))","+ a = [None] * n","+ for i in range(n):","+ sub = input().replace(\"\\n\", \"\")","+ if \".\" in sub:","+ x, y = list(map(str, sub.split(\".\")))","+ s = int(x) * 1000000000 + 10 ** (9 - len(y)) * int(y)","+ else:","+ s = int(sub)","+ s *= 1000000000","+ a[i] = divide(s)","+ dp = [[0] * 100 for _ in range(100)]","+ for i in range(n):","+ c1, c2 = a[i]","+ dp[c1][c2] += 1","+ for i in range(98, -1, -1):","+ for j in range(98, -1, -1):","+ dp[i][j] += dp[i + 1][j] + dp[i][j + 1] - dp[i + 1][j + 1]","+ ans = 0","+ for i in range(n):","+ c1, c2 = a[i]","+ if c1 >= 9 and c2 >= 9:","+ ans -= 1","+ if c1 >= 18 and c2 >= 18:","+ ans += dp[0][0]","+ continue","+ if c1 >= 18:","+ ans += dp[0][18 - c2]","+ continue","+ if c2 >= 18:","+ ans += dp[18 - c1][0]","+ continue","+ ans += dp[18 - c1][18 - c2]","+ print((ans \/\/ 2))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0579058996,"measured_runtime_v1":0.0688883785,"runtime_lift":0.8405757375,"key":["s635922228","s511368177"]} +{"user_id":"u336624604","problem_id":"p03457","language":"python","submission_id_v0":"s190376535","submission_id_v1":"s223919934","cpu_time_v0":391,"cpu_time_v1":324,"memory_v0":27380,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.14,"input":"N=int(eval(input()))\n\ntxy=[list(map(int,input().split())) for i in range(N)]\n\nans=0\n\nfor i in range(N):\n\n t,x,y=txy[i][0],txy[i][1],txy[i][2]\n\n if x+y<=t and t%2==(x+y)%2:ans+=1\n\nprint((\"Yes\" if ans==N else \"No\"))","target":"n = int(eval(input()))\n\n \n\nfor _ in range(n):\n\n t, x, y = list(map(int, input().split()))\n\n if x + y > t or (t - x - y) % 2:\n\n print(\"No\")\n\n exit()\n\nprint(\"Yes\")","code_v0_loc":7,"code_v1_loc":8,"code_v0_num_chars":211,"code_v1_num_chars":170,"code_v0_no_empty_lines":"N = int(eval(input()))\ntxy = [list(map(int, input().split())) for i in range(N)]\nans = 0\nfor i in range(N):\n t, x, y = txy[i][0], txy[i][1], txy[i][2]\n if x + y <= t and t % 2 == (x + y) % 2:\n ans += 1\nprint((\"Yes\" if ans == N else \"No\"))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nfor _ in range(n):\n t, x, y = list(map(int, input().split()))\n if x + y > t or (t - x - y) % 2:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-N = int(eval(input()))","-txy = [list(map(int, input().split())) for i in range(N)]","-ans = 0","-for i in range(N):","- t, x, y = txy[i][0], txy[i][1], txy[i][2]","- if x + y <= t and t % 2 == (x + y) % 2:","- ans += 1","-print((\"Yes\" if ans == N else \"No\"))","+n = int(eval(input()))","+for _ in range(n):","+ t, x, y = list(map(int, input().split()))","+ if x + y > t or (t - x - y) % 2:","+ print(\"No\")","+ exit()","+print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0420545409,"measured_runtime_v1":0.0379808736,"runtime_lift":1.1072557551,"key":["s190376535","s223919934"]} +{"user_id":"u677523557","problem_id":"p02850","language":"python","submission_id_v0":"s505131678","submission_id_v1":"s463478397","cpu_time_v0":608,"cpu_time_v1":468,"memory_v0":46800,"memory_v1":66304,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.03,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\ngraph = [[] for _ in range(N)]\n\nEd = {}\n\nfor i in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n graph[a-1].append(b-1)\n\n graph[b-1].append(a-1)\n\n Ed[(a-1)*N+b-1] = i\n\n Ed[(b-1)*N+a-1] = i\n\n\n\nq = [0]\n\nchecked = [False]*N\n\nchecked[0] = True\n\n\n\nV_color = [None]*N\n\nV_color[0] = 0\n\n\n\nans = [None]*(N-1)\n\nwhile q:\n\n qq = []\n\n for p in q:\n\n c = V_color[p]\n\n t = 1\n\n for np in graph[p]:\n\n if not checked[np]:\n\n checked[np] = True\n\n qq.append(np)\n\n ind = Ed[p*N+np]\n\n if t == c:\n\n t += 1\n\n ans[ind] = t\n\n V_color[np] = t\n\n t += 1\n\n q = qq\n\n\n\nprint((max(ans)))\n\nfor a in ans:\n\n print(a)","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\ngraph = [[] for _ in range(N)]\n\nEdges = []\n\nfor _ in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n graph[a-1].append(b-1)\n\n graph[b-1].append(a-1)\n\n Edges.append((a-1, b-1))\n\n\n\nCol = 0\n\nfor n in range(N):\n\n Col = max(Col, len(graph[n]))\n\n\n\nColor = dict()\n\nchecked = [-1]*N\n\nq = [0]\n\nchecked[0] = Col+1\n\nwhile q:\n\n qq = []\n\n for p in q:\n\n c = checked[p]\n\n t = 0\n\n for np in graph[p]:\n\n if checked[np] == -1:\n\n if t == c:\n\n t += 1\n\n checked[np] = t\n\n Color[(p, np)] = t\n\n Color[(np, p)] = t\n\n t += 1\n\n qq.append(np)\n\n q = qq\n\n\n\nprint(Col)\n\nfor a, b in Edges:\n\n print((Color[(a, b)]+1))","code_v0_loc":41,"code_v1_loc":39,"code_v0_num_chars":821,"code_v1_num_chars":812,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\ngraph = [[] for _ in range(N)]\nEd = {}\nfor i in range(N - 1):\n a, b = list(map(int, input().split()))\n graph[a - 1].append(b - 1)\n graph[b - 1].append(a - 1)\n Ed[(a - 1) * N + b - 1] = i\n Ed[(b - 1) * N + a - 1] = i\nq = [0]\nchecked = [False] * N\nchecked[0] = True\nV_color = [None] * N\nV_color[0] = 0\nans = [None] * (N - 1)\nwhile q:\n qq = []\n for p in q:\n c = V_color[p]\n t = 1\n for np in graph[p]:\n if not checked[np]:\n checked[np] = True\n qq.append(np)\n ind = Ed[p * N + np]\n if t == c:\n t += 1\n ans[ind] = t\n V_color[np] = t\n t += 1\n q = qq\nprint((max(ans)))\nfor a in ans:\n print(a)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\ngraph = [[] for _ in range(N)]\nEdges = []\nfor _ in range(N - 1):\n a, b = list(map(int, input().split()))\n graph[a - 1].append(b - 1)\n graph[b - 1].append(a - 1)\n Edges.append((a - 1, b - 1))\nCol = 0\nfor n in range(N):\n Col = max(Col, len(graph[n]))\nColor = dict()\nchecked = [-1] * N\nq = [0]\nchecked[0] = Col + 1\nwhile q:\n qq = []\n for p in q:\n c = checked[p]\n t = 0\n for np in graph[p]:\n if checked[np] == -1:\n if t == c:\n t += 1\n checked[np] = t\n Color[(p, np)] = t\n Color[(np, p)] = t\n t += 1\n qq.append(np)\n q = qq\nprint(Col)\nfor a, b in Edges:\n print((Color[(a, b)] + 1))\n","code_same":false,"relative_loc_diff_percent":4.8780487805,"diff":["-Ed = {}","-for i in range(N - 1):","+Edges = []","+for _ in range(N - 1):","- Ed[(a - 1) * N + b - 1] = i","- Ed[(b - 1) * N + a - 1] = i","+ Edges.append((a - 1, b - 1))","+Col = 0","+for n in range(N):","+ Col = max(Col, len(graph[n]))","+Color = dict()","+checked = [-1] * N","-checked = [False] * N","-checked[0] = True","-V_color = [None] * N","-V_color[0] = 0","-ans = [None] * (N - 1)","+checked[0] = Col + 1","- c = V_color[p]","- t = 1","+ c = checked[p]","+ t = 0","- if not checked[np]:","- checked[np] = True","- qq.append(np)","- ind = Ed[p * N + np]","+ if checked[np] == -1:","- ans[ind] = t","- V_color[np] = t","+ checked[np] = t","+ Color[(p, np)] = t","+ Color[(np, p)] = t","+ qq.append(np)","-print((max(ans)))","-for a in ans:","- print(a)","+print(Col)","+for a, b in Edges:","+ print((Color[(a, b)] + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0448012428,"measured_runtime_v1":0.0448886034,"runtime_lift":0.998053835,"key":["s505131678","s463478397"]} +{"user_id":"u576917603","problem_id":"p02899","language":"python","submission_id_v0":"s247678683","submission_id_v1":"s436966107","cpu_time_v0":179,"cpu_time_v1":108,"memory_v0":14008,"memory_v1":13880,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.66,"input":"n=int(input())\n\na=list(map(int,input().split()))\n\nd=[None]*n\n\nfor x,i in enumerate(a):\n\n d[i-1]=x+1\n\nfor i in d:\n\n print(i,end=\" \")\n","target":"n=int(eval(input()))\n\na=list(map(int,input().split()))\n\nl=[0]*n\n\nfor x,i in enumerate(a):\n\n l[i-1]=x+1\n\nprint((*l))","code_v0_loc":7,"code_v1_loc":6,"code_v0_num_chars":137,"code_v1_num_chars":110,"code_v0_no_empty_lines":"n = int(input())\na = list(map(int, input().split()))\nd = [None] * n\nfor x, i in enumerate(a):\n d[i - 1] = x + 1\nfor i in d:\n print(i, end=\" \")\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\nl = [0] * n\nfor x, i in enumerate(a):\n l[i - 1] = x + 1\nprint((*l))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-n = int(input())","+n = int(eval(input()))","-d = [None] * n","+l = [0] * n","- d[i - 1] = x + 1","-for i in d:","- print(i, end=\" \")","+ l[i - 1] = x + 1","+print((*l))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450277035,"measured_runtime_v1":0.1154057851,"runtime_lift":0.3901685124,"key":["s247678683","s436966107"]} +{"user_id":"u127499732","problem_id":"p03426","language":"python","submission_id_v0":"s485833367","submission_id_v1":"s682582622","cpu_time_v0":412,"cpu_time_v1":278,"memory_v0":138412,"memory_v1":31268,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.52,"input":"def main():\n\n import sys\n\n sys.setrecursionlimit(1000000)\n\n h, w, d = list(map(int, input().split()))\n\n p = []\n\n for i in range(1, h + 1):\n\n l = list(map(int, input().split()))\n\n for j, k in enumerate(l, 1):\n\n p.append((k, (i, j)))\n\n p.sort(key=lambda x: x[0])\n\n\n\n q = int(eval(input()))\n\n\n\n dist = [0] * (w * h + 1)\n\n\n\n def Q(i, c, x, y):\n\n if i + d > w * h:\n\n return\n\n _, (nx, ny) = p[i + d - 1]\n\n nc = c + abs(nx - x) + abs(ny - y)\n\n dist[i + d] = nc\n\n Q(i + d, nc, nx, ny)\n\n\n\n for i in range(d):\n\n n, (x, y) = p[i]\n\n Q(n, 0, x, y)\n\n\n\n res = []\n\n for _ in range(q):\n\n l, r = list(map(int, input().split()))\n\n res.append(dist[r] - dist[l])\n\n\n\n ans = '\\n'.join(map(str, res))\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n h, w, d = list(map(int, input().split()))\n\n\n\n a = [None] * (h * w + 1)\n\n for i in range(1, h + 1):\n\n l = list(map(int, input().split()))\n\n for j, k in enumerate(l, 1):\n\n a[k] = (i, j)\n\n\n\n c = [0] * (h * w + 1)\n\n for i in range(d + 1, h * w + 1):\n\n xb, yb = a[i-d]\n\n xn, yn = a[i]\n\n c[i] = c[i - d] + abs(xn - xb) + abs(yn - yb)\n\n\n\n q = int(eval(input()))\n\n res = []\n\n for _ in range(q):\n\n l, r = list(map(int, input().split()))\n\n res.append(c[r] - c[l])\n\n\n\n ans = '\\n'.join(map(str, res))\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":38,"code_v1_loc":27,"code_v0_num_chars":851,"code_v1_num_chars":626,"code_v0_no_empty_lines":"def main():\n import sys\n\n sys.setrecursionlimit(1000000)\n h, w, d = list(map(int, input().split()))\n p = []\n for i in range(1, h + 1):\n l = list(map(int, input().split()))\n for j, k in enumerate(l, 1):\n p.append((k, (i, j)))\n p.sort(key=lambda x: x[0])\n q = int(eval(input()))\n dist = [0] * (w * h + 1)\n\n def Q(i, c, x, y):\n if i + d > w * h:\n return\n _, (nx, ny) = p[i + d - 1]\n nc = c + abs(nx - x) + abs(ny - y)\n dist[i + d] = nc\n Q(i + d, nc, nx, ny)\n\n for i in range(d):\n n, (x, y) = p[i]\n Q(n, 0, x, y)\n res = []\n for _ in range(q):\n l, r = list(map(int, input().split()))\n res.append(dist[r] - dist[l])\n ans = \"\\n\".join(map(str, res))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n h, w, d = list(map(int, input().split()))\n a = [None] * (h * w + 1)\n for i in range(1, h + 1):\n l = list(map(int, input().split()))\n for j, k in enumerate(l, 1):\n a[k] = (i, j)\n c = [0] * (h * w + 1)\n for i in range(d + 1, h * w + 1):\n xb, yb = a[i - d]\n xn, yn = a[i]\n c[i] = c[i - d] + abs(xn - xb) + abs(yn - yb)\n q = int(eval(input()))\n res = []\n for _ in range(q):\n l, r = list(map(int, input().split()))\n res.append(c[r] - c[l])\n ans = \"\\n\".join(map(str, res))\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":28.9473684211,"diff":["- import sys","-","- sys.setrecursionlimit(1000000)","- p = []","+ a = [None] * (h * w + 1)","- p.append((k, (i, j)))","- p.sort(key=lambda x: x[0])","+ a[k] = (i, j)","+ c = [0] * (h * w + 1)","+ for i in range(d + 1, h * w + 1):","+ xb, yb = a[i - d]","+ xn, yn = a[i]","+ c[i] = c[i - d] + abs(xn - xb) + abs(yn - yb)","- dist = [0] * (w * h + 1)","-","- def Q(i, c, x, y):","- if i + d > w * h:","- return","- _, (nx, ny) = p[i + d - 1]","- nc = c + abs(nx - x) + abs(ny - y)","- dist[i + d] = nc","- Q(i + d, nc, nx, ny)","-","- for i in range(d):","- n, (x, y) = p[i]","- Q(n, 0, x, y)","- res.append(dist[r] - dist[l])","+ res.append(c[r] - c[l])"],"diff_only_import_comment":false,"measured_runtime_v0":0.079453459,"measured_runtime_v1":0.0369352427,"runtime_lift":2.1511557336,"key":["s485833367","s682582622"]} +{"user_id":"u225388820","problem_id":"p03078","language":"python","submission_id_v0":"s313852931","submission_id_v1":"s244775949","cpu_time_v0":327,"cpu_time_v1":158,"memory_v0":152476,"memory_v1":76640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.68,"input":"import sys\n\nfrom heapq import heappush,heapify,heappop\n\ninput = sys.stdin.readline\n\nx, y, z, k = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\nd = [i + j for i in a for j in b]\n\nd.sort(reverse=1)\n\nc.sort(reverse=1)\n\nq = [(-d[0] - c[0], 0, 0)]\n\nfor _ in range(k):\n\n v, s, t = heappop(q)\n\n print((-v))\n\n if t + 1 < z:\n\n heappush(q, (-d[s] - c[t + 1], s, t + 1))\n\n if t == 0 and s + 1 < x * y:\n\n heappush(q, (-d[s + 1] - c[0], s + 1, 0))","target":"# O(klog(k))\u89e3\u6cd5 \u591a\u5206...\n\nimport sys\n\nfrom heapq import heappush,heapify,heappop\n\ninput = sys.stdin.readline\n\nx, y, z, k = map(int, input().split())\n\na = list(map(int, input().split()))\n\nb = list(map(int, input().split()))\n\nc = list(map(int, input().split()))\n\n\n\ndef make_kth(A, B):\n\n n, m = len(A), len(B)\n\n A.sort(reverse=1)\n\n B.sort(reverse=1)\n\n q = [(-A[0] - B[0], 0, 0)]\n\n r=[]\n\n for _ in range(min(k, n * m)):\n\n v, s, t = heappop(q)\n\n r.append(-v)\n\n if t + 1 < m:\n\n heappush(q, (-A[s] - B[t + 1], s, t + 1))\n\n if t == 0 and s + 1 < n:\n\n heappush(q, (-A[s + 1] - B[0], s + 1, 0))\n\n return r\n\n\n\nr = make_kth(a, b)\n\nr = make_kth(c, r)\n\nprint(*r,sep=\"\\n\")\n","code_v0_loc":18,"code_v1_loc":27,"code_v0_num_chars":550,"code_v1_num_chars":724,"code_v0_no_empty_lines":"import sys\nfrom heapq import heappush, heapify, heappop\n\ninput = sys.stdin.readline\nx, y, z, k = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\nd = [i + j for i in a for j in b]\nd.sort(reverse=1)\nc.sort(reverse=1)\nq = [(-d[0] - c[0], 0, 0)]\nfor _ in range(k):\n v, s, t = heappop(q)\n print((-v))\n if t + 1 < z:\n heappush(q, (-d[s] - c[t + 1], s, t + 1))\n if t == 0 and s + 1 < x * y:\n heappush(q, (-d[s + 1] - c[0], s + 1, 0))\n","code_v1_no_empty_lines":"# O(klog(k))\u89e3\u6cd5 \u591a\u5206...\nimport sys\nfrom heapq import heappush, heapify, heappop\n\ninput = sys.stdin.readline\nx, y, z, k = map(int, input().split())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\n\ndef make_kth(A, B):\n n, m = len(A), len(B)\n A.sort(reverse=1)\n B.sort(reverse=1)\n q = [(-A[0] - B[0], 0, 0)]\n r = []\n for _ in range(min(k, n * m)):\n v, s, t = heappop(q)\n r.append(-v)\n if t + 1 < m:\n heappush(q, (-A[s] - B[t + 1], s, t + 1))\n if t == 0 and s + 1 < n:\n heappush(q, (-A[s + 1] - B[0], s + 1, 0))\n return r\n\n\nr = make_kth(a, b)\nr = make_kth(c, r)\nprint(*r, sep=\"\\n\")\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["+# O(klog(k))\u89e3\u6cd5 \u591a\u5206...","-x, y, z, k = list(map(int, input().split()))","+x, y, z, k = map(int, input().split())","-d = [i + j for i in a for j in b]","-d.sort(reverse=1)","-c.sort(reverse=1)","-q = [(-d[0] - c[0], 0, 0)]","-for _ in range(k):","- v, s, t = heappop(q)","- print((-v))","- if t + 1 < z:","- heappush(q, (-d[s] - c[t + 1], s, t + 1))","- if t == 0 and s + 1 < x * y:","- heappush(q, (-d[s + 1] - c[0], s + 1, 0))","+","+","+def make_kth(A, B):","+ n, m = len(A), len(B)","+ A.sort(reverse=1)","+ B.sort(reverse=1)","+ q = [(-A[0] - B[0], 0, 0)]","+ r = []","+ for _ in range(min(k, n * m)):","+ v, s, t = heappop(q)","+ r.append(-v)","+ if t + 1 < m:","+ heappush(q, (-A[s] - B[t + 1], s, t + 1))","+ if t == 0 and s + 1 < n:","+ heappush(q, (-A[s + 1] - B[0], s + 1, 0))","+ return r","+","+","+r = make_kth(a, b)","+r = make_kth(c, r)","+print(*r, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1303700554,"measured_runtime_v1":0.0870834155,"runtime_lift":1.4970709941,"key":["s313852931","s244775949"]} +{"user_id":"u798818115","problem_id":"p03732","language":"python","submission_id_v0":"s955982948","submission_id_v1":"s911486468","cpu_time_v0":250,"cpu_time_v1":28,"memory_v0":42988,"memory_v1":3436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.8,"input":"# coding: utf-8\n\n# Your code here!\n\nN,W=list(map(int,input().split()))\n\ndp=[[-1]*301 for i in range(N+1)]\n\ndp[0][0]=0\n\n\n\nfor i in range(N):\n\n w,v=list(map(int,input().split()))\n\n if i==0:\n\n base=w\n\n for i in range(N)[::-1]:\n\n for j in range(301)[::-1]:\n\n if dp[i][j]!=-1:\n\n dp[i+1][j+w-base]=max(dp[i][j]+v,dp[i+1][j+w-base])\n\n\n\nans=0\n\nfor index,item in enumerate(dp):\n\n if W-index*base+1<=0:\n\n break\n\n ans=max(max(item[:W-index*base+1]),ans)\n\n #print(item[:W-index*base+1])\n\n\n\nprint(ans)\n","target":"# coding: utf-8\n\n# Your code here!\n\ndef saiki(value,HP,num):\n\n if num==0:\n\n #print(HP\/\/base)\n\n value+=wa[0][min(HP\/\/base,len(wa[0])-1)]\n\n ans.append(value)\n\n else:\n\n for i in range(len(wa[num])):\n\n if HP-(num+base)*i>=0:\n\n saiki(value+wa[num][i],HP-(num+base)*i,num-1)\n\n else:\n\n break\n\n return\n\n\n\n\n\nN,W=list(map(int,input().split()))\n\n\n\nlis=[[] for i in range(4)]\n\n\n\nfor i in range(N):\n\n w,v=list(map(int,input().split()))\n\n if i==0:\n\n base=w\n\n lis[w-base].append(v)\n\n\n\nlis=list([sorted(x, reverse=True) for x in lis])\n\n\n\nwa=[[0] for i in range(4)]\n\n\n\nfor i in range(len(wa)):\n\n for item in lis[i]:\n\n wa[i].append(wa[i][-1]+item)\n\n\n\n#print(wa)\n\n\n\nans=[]\n\nsaiki(0,W,3)\n\n \n\n\n\nprint((max(ans)))\n\n ","code_v0_loc":23,"code_v1_loc":42,"code_v0_num_chars":542,"code_v1_num_chars":804,"code_v0_no_empty_lines":"# coding: utf-8\n# Your code here!\nN, W = list(map(int, input().split()))\ndp = [[-1] * 301 for i in range(N + 1)]\ndp[0][0] = 0\nfor i in range(N):\n w, v = list(map(int, input().split()))\n if i == 0:\n base = w\n for i in range(N)[::-1]:\n for j in range(301)[::-1]:\n if dp[i][j] != -1:\n dp[i + 1][j + w - base] = max(dp[i][j] + v, dp[i + 1][j + w - base])\nans = 0\nfor index, item in enumerate(dp):\n if W - index * base + 1 <= 0:\n break\n ans = max(max(item[: W - index * base + 1]), ans)\n # print(item[:W-index*base+1])\nprint(ans)\n","code_v1_no_empty_lines":"# coding: utf-8\n# Your code here!\ndef saiki(value, HP, num):\n if num == 0:\n # print(HP\/\/base)\n value += wa[0][min(HP \/\/ base, len(wa[0]) - 1)]\n ans.append(value)\n else:\n for i in range(len(wa[num])):\n if HP - (num + base) * i >= 0:\n saiki(value + wa[num][i], HP - (num + base) * i, num - 1)\n else:\n break\n return\n\n\nN, W = list(map(int, input().split()))\nlis = [[] for i in range(4)]\nfor i in range(N):\n w, v = list(map(int, input().split()))\n if i == 0:\n base = w\n lis[w - base].append(v)\nlis = list([sorted(x, reverse=True) for x in lis])\nwa = [[0] for i in range(4)]\nfor i in range(len(wa)):\n for item in lis[i]:\n wa[i].append(wa[i][-1] + item)\n# print(wa)\nans = []\nsaiki(0, W, 3)\nprint((max(ans)))\n","code_same":false,"relative_loc_diff_percent":45.2380952381,"diff":["+def saiki(value, HP, num):","+ if num == 0:","+ # print(HP\/\/base)","+ value += wa[0][min(HP \/\/ base, len(wa[0]) - 1)]","+ ans.append(value)","+ else:","+ for i in range(len(wa[num])):","+ if HP - (num + base) * i >= 0:","+ saiki(value + wa[num][i], HP - (num + base) * i, num - 1)","+ else:","+ break","+ return","+","+","-dp = [[-1] * 301 for i in range(N + 1)]","-dp[0][0] = 0","+lis = [[] for i in range(4)]","- for i in range(N)[::-1]:","- for j in range(301)[::-1]:","- if dp[i][j] != -1:","- dp[i + 1][j + w - base] = max(dp[i][j] + v, dp[i + 1][j + w - base])","-ans = 0","-for index, item in enumerate(dp):","- if W - index * base + 1 <= 0:","- break","- ans = max(max(item[: W - index * base + 1]), ans)","- # print(item[:W-index*base+1])","-print(ans)","+ lis[w - base].append(v)","+lis = list([sorted(x, reverse=True) for x in lis])","+wa = [[0] for i in range(4)]","+for i in range(len(wa)):","+ for item in lis[i]:","+ wa[i].append(wa[i][-1] + item)","+# print(wa)","+ans = []","+saiki(0, W, 3)","+print((max(ans)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.15582304,"measured_runtime_v1":0.0391460419,"runtime_lift":3.9805567185,"key":["s955982948","s911486468"]} +{"user_id":"u367701763","problem_id":"p03297","language":"python","submission_id_v0":"s137011591","submission_id_v1":"s046450102","cpu_time_v0":72,"cpu_time_v1":66,"memory_v0":65548,"memory_v1":66888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.33,"input":"def solve(P):\n\n A, B, C, D = P\n\n if A= B-1:\n\n return True\n\n g = gcd(B,D)\n\n return B + A%g - g <= C\n\n\n\nfrom math import gcd\n\n\n\nT = int(eval(input()))\n\nfor _ in range(T):\n\n P = list(map(int, input().split()))\n\n print((\"Yes\" if solve(P) else \"No\"))","target":"def solve(P):\n\n A, B, C, D = P\n\n if A= B-1:\n\n return True\n\n g = gcd(B,D)\n\n return A%g + ((B-A%g-1)\/\/g)*g <= C\n\n\n\nfrom math import gcd\n\n\n\nT = int(eval(input()))\n\nfor _ in range(T):\n\n P = list(map(int, input().split()))\n\n print((\"Yes\" if solve(P) else \"No\"))","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":300,"code_v1_num_chars":311,"code_v0_no_empty_lines":"def solve(P):\n A, B, C, D = P\n if A < B or D < B:\n return False\n if C >= B - 1:\n return True\n g = gcd(B, D)\n return B + A % g - g <= C\n\n\nfrom math import gcd\n\nT = int(eval(input()))\nfor _ in range(T):\n P = list(map(int, input().split()))\n print((\"Yes\" if solve(P) else \"No\"))\n","code_v1_no_empty_lines":"def solve(P):\n A, B, C, D = P\n if A < B or D < B:\n return False\n if C >= B - 1:\n return True\n g = gcd(B, D)\n return A % g + ((B - A % g - 1) \/\/ g) * g <= C\n\n\nfrom math import gcd\n\nT = int(eval(input()))\nfor _ in range(T):\n P = list(map(int, input().split()))\n print((\"Yes\" if solve(P) else \"No\"))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- return B + A % g - g <= C","+ return A % g + ((B - A % g - 1) \/\/ g) * g <= C"],"diff_only_import_comment":false,"measured_runtime_v0":0.0388019214,"measured_runtime_v1":0.0370016695,"runtime_lift":1.0486532607,"key":["s137011591","s046450102"]} +{"user_id":"u502389123","problem_id":"p02725","language":"python","submission_id_v0":"s943757065","submission_id_v1":"s851257916","cpu_time_v0":281,"cpu_time_v1":114,"memory_v0":26444,"memory_v1":25840,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.43,"input":"K, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\nans = A[N-1] - A[0]\n\nfor i in range(N):\n\n ans = min(ans, min(A[(i+N-1)%N] + K - A[i], A[i] + K - A[(i+1)%N]))\n\n\n\nprint(ans)","target":"K, N = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\n\n\ndist = [K - A[N-1] + A[0]]\n\nfor i in range(N-1):\n\n dist.append(A[i+1] - A[i])\n\n\n\nprint((K - max(dist)))","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":199,"code_v1_num_chars":177,"code_v0_no_empty_lines":"K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\nans = A[N - 1] - A[0]\nfor i in range(N):\n ans = min(ans, min(A[(i + N - 1) % N] + K - A[i], A[i] + K - A[(i + 1) % N]))\nprint(ans)\n","code_v1_no_empty_lines":"K, N = list(map(int, input().split()))\nA = list(map(int, input().split()))\ndist = [K - A[N - 1] + A[0]]\nfor i in range(N - 1):\n dist.append(A[i + 1] - A[i])\nprint((K - max(dist)))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-ans = A[N - 1] - A[0]","-for i in range(N):","- ans = min(ans, min(A[(i + N - 1) % N] + K - A[i], A[i] + K - A[(i + 1) % N]))","-print(ans)","+dist = [K - A[N - 1] + A[0]]","+for i in range(N - 1):","+ dist.append(A[i + 1] - A[i])","+print((K - max(dist)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0743160074,"measured_runtime_v1":0.0913418949,"runtime_lift":0.8136026462,"key":["s943757065","s851257916"]} +{"user_id":"u863370423","problem_id":"p02639","language":"python","submission_id_v0":"s779313091","submission_id_v1":"s733343316","cpu_time_v0":71,"cpu_time_v1":23,"memory_v0":65308,"memory_v1":9016,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.61,"input":"from sys import stdin,stdout\n\nfrom math import gcd,sqrt\n\nfrom collections import deque\n\ninput=stdin.readline\n\nR=lambda:list(map(int,input().split()))\n\nI=lambda:int(eval(input()))\n\nS=lambda:input().rstrip('\\n')\n\nL=lambda:list(R())\n\nP=lambda x:stdout.write(x)\n\nhg=lambda x,y:((y+x-1)\/\/x)*x\n\npw=lambda x:1 if x==1 else 1+pw(x\/\/2)\n\nchk=lambda x:chk(x\/\/2) if not x%2 else True if x==1 else False\n\nprint((list(map(int,input().split())).index(0)+1))","target":"data = []\n\nk = eval(input())\n\nn=1\n\nfor i in k:\n\n\t#print(i,n)\n\n\tif i is '0':\n\n\t\tprint(n)\n\n\t\tbreak\n\n\tif i is not ' ':\n\n\t\tn+=1\n","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":428,"code_v1_num_chars":118,"code_v0_no_empty_lines":"from sys import stdin, stdout\nfrom math import gcd, sqrt\nfrom collections import deque\n\ninput = stdin.readline\nR = lambda: list(map(int, input().split()))\nI = lambda: int(eval(input()))\nS = lambda: input().rstrip(\"\\n\")\nL = lambda: list(R())\nP = lambda x: stdout.write(x)\nhg = lambda x, y: ((y + x - 1) \/\/ x) * x\npw = lambda x: 1 if x == 1 else 1 + pw(x \/\/ 2)\nchk = lambda x: chk(x \/\/ 2) if not x % 2 else True if x == 1 else False\nprint((list(map(int, input().split())).index(0) + 1))\n","code_v1_no_empty_lines":"data = []\nk = eval(input())\nn = 1\nfor i in k:\n # print(i,n)\n if i is \"0\":\n print(n)\n break\n if i is not \" \":\n n += 1\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-from sys import stdin, stdout","-from math import gcd, sqrt","-from collections import deque","-","-input = stdin.readline","-R = lambda: list(map(int, input().split()))","-I = lambda: int(eval(input()))","-S = lambda: input().rstrip(\"\\n\")","-L = lambda: list(R())","-P = lambda x: stdout.write(x)","-hg = lambda x, y: ((y + x - 1) \/\/ x) * x","-pw = lambda x: 1 if x == 1 else 1 + pw(x \/\/ 2)","-chk = lambda x: chk(x \/\/ 2) if not x % 2 else True if x == 1 else False","-print((list(map(int, input().split())).index(0) + 1))","+data = []","+k = eval(input())","+n = 1","+for i in k:","+ # print(i,n)","+ if i is \"0\":","+ print(n)","+ break","+ if i is not \" \":","+ n += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0410024643,"measured_runtime_v1":0.0560543537,"runtime_lift":0.7314768893,"key":["s779313091","s733343316"]} +{"user_id":"u993435350","problem_id":"p02862","language":"python","submission_id_v0":"s574528085","submission_id_v1":"s080205977","cpu_time_v0":705,"cpu_time_v1":124,"memory_v0":82232,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.41,"input":"def cmb(n, k, mod, fac, infac):\n\n k = min(k,n-k)\n\n return fac[n] * infac[k] * infac[n-k] % mod\n\n\n\ndef tables(mod, n):\n\n fac = [1, 1] \n\n infac = [1, 1] \n\n inverse = [0, 1] \n\n for i in range(2, n+1):\n\n fac.append((fac[-1] * i) % mod)\n\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n\n infac.append((infac[-1] * inverse[-1]) % mod)\n\n return fac,infac\n\n\n\nX,Y = list(map(int, input().split()))\n\n\n\nif X > Y:\n\n X, Y = Y, X\n\n\n\nmove = X + Y\n\n\n\nif move % 3 != 0:\n\n print((0))\n\nelse:\n\n total = move \/\/ 3\n\n n = X - total\n\n \n\n if n < 0:\n\n print((0))\n\n \n\n else:\n\n MOD = 10 ** 9 + 7\n\n fac, infac = tables(MOD, total)\n\n ans = cmb(total, n, MOD, fac, infac)\n\n \n\n print(ans)","target":"X,Y = list(map(int,input().split()))\n\nM = max(X,Y)\n\nm = min(X,Y)\n\nmod = 10 ** 9 + 7\n\n\n\ncon = (X + Y) \/\/ 3\n\ndif = M - m\n\nn = (con - dif) \/\/ 2\n\n\n\nif (X + Y) % 3 != 0 or n < 0:\n\n print((0))\n\n \n\nelse:\n\n def comb(n, r):\n\n n += 1\n\n over = 1\n\n under = 1\n\n for i in range(1,r + 1):\n\n over = over * (n - i) % mod\n\n under = under * i % mod\n\n #pow\u3067under ** (mod - 2) % mod\u3092\u5b9f\u73fe\u3001\u9006\u5143\u3092\u6c42\u3081\u3066\u3044\u308b\n\n return over * pow(under,mod - 2,mod) % mod\n\n \n\n ans = comb(con,n)\n\n \n\n print(ans)","code_v0_loc":36,"code_v1_loc":26,"code_v0_num_chars":698,"code_v1_num_chars":484,"code_v0_no_empty_lines":"def cmb(n, k, mod, fac, infac):\n k = min(k, n - k)\n return fac[n] * infac[k] * infac[n - k] % mod\n\n\ndef tables(mod, n):\n fac = [1, 1]\n infac = [1, 1]\n inverse = [0, 1]\n for i in range(2, n + 1):\n fac.append((fac[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n infac.append((infac[-1] * inverse[-1]) % mod)\n return fac, infac\n\n\nX, Y = list(map(int, input().split()))\nif X > Y:\n X, Y = Y, X\nmove = X + Y\nif move % 3 != 0:\n print((0))\nelse:\n total = move \/\/ 3\n n = X - total\n if n < 0:\n print((0))\n else:\n MOD = 10**9 + 7\n fac, infac = tables(MOD, total)\n ans = cmb(total, n, MOD, fac, infac)\n print(ans)\n","code_v1_no_empty_lines":"X, Y = list(map(int, input().split()))\nM = max(X, Y)\nm = min(X, Y)\nmod = 10**9 + 7\ncon = (X + Y) \/\/ 3\ndif = M - m\nn = (con - dif) \/\/ 2\nif (X + Y) % 3 != 0 or n < 0:\n print((0))\nelse:\n\n def comb(n, r):\n n += 1\n over = 1\n under = 1\n for i in range(1, r + 1):\n over = over * (n - i) % mod\n under = under * i % mod\n # pow\u3067under ** (mod - 2) % mod\u3092\u5b9f\u73fe\u3001\u9006\u5143\u3092\u6c42\u3081\u3066\u3044\u308b\n return over * pow(under, mod - 2, mod) % mod\n\n ans = comb(con, n)\n print(ans)\n","code_same":false,"relative_loc_diff_percent":27.7777777778,"diff":["-def cmb(n, k, mod, fac, infac):","- k = min(k, n - k)","- return fac[n] * infac[k] * infac[n - k] % mod","-","-","-def tables(mod, n):","- fac = [1, 1]","- infac = [1, 1]","- inverse = [0, 1]","- for i in range(2, n + 1):","- fac.append((fac[-1] * i) % mod)","- inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)","- infac.append((infac[-1] * inverse[-1]) % mod)","- return fac, infac","-","-","-if X > Y:","- X, Y = Y, X","-move = X + Y","-if move % 3 != 0:","+M = max(X, Y)","+m = min(X, Y)","+mod = 10**9 + 7","+con = (X + Y) \/\/ 3","+dif = M - m","+n = (con - dif) \/\/ 2","+if (X + Y) % 3 != 0 or n < 0:","- total = move \/\/ 3","- n = X - total","- if n < 0:","- print((0))","- else:","- MOD = 10**9 + 7","- fac, infac = tables(MOD, total)","- ans = cmb(total, n, MOD, fac, infac)","- print(ans)","+","+ def comb(n, r):","+ n += 1","+ over = 1","+ under = 1","+ for i in range(1, r + 1):","+ over = over * (n - i) % mod","+ under = under * i % mod","+ # pow\u3067under ** (mod - 2) % mod\u3092\u5b9f\u73fe\u3001\u9006\u5143\u3092\u6c42\u3081\u3066\u3044\u308b","+ return over * pow(under, mod - 2, mod) % mod","+","+ ans = comb(con, n)","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.2086619489,"measured_runtime_v1":0.0513384192,"runtime_lift":4.0644404743,"key":["s574528085","s080205977"]} +{"user_id":"u621100542","problem_id":"p03241","language":"python","submission_id_v0":"s093909602","submission_id_v1":"s598967920","cpu_time_v0":1876,"cpu_time_v1":20,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":98.93,"input":"N,T = list(map(int,input().split()))\n\nd = int(T \/ N)\n\ndef ans():\n\n for i in range(d+1,0,-1): \n\n if T % i ==0:\n\n print(i)\n\n break\n\nif T % N == 0:\n\n print (d)\n\nelse:\n\n ans()","target":"import math\n\nN,T = list(map(int,input().split()))\n\n#d = int(T \/ N)\n\nm = []\n\n\n\ndef ans():\n\n ans = 1\n\n for i in range(1,int(math.sqrt(T))): \n\n if T % i ==0:\n\n m.append(i)\n\n m.append(T\/\/i)\n\n for p in m:\n\n if p <= T \/\/ N:\n\n ans = max(ans,p)\n\n print (ans)\n\n \n\nif T % N == 0:\n\n print((int(T \/ N)))\n\nelse:\n\n ans()","code_v0_loc":11,"code_v1_loc":20,"code_v0_num_chars":225,"code_v1_num_chars":389,"code_v0_no_empty_lines":"N, T = list(map(int, input().split()))\nd = int(T \/ N)\n\n\ndef ans():\n for i in range(d + 1, 0, -1):\n if T % i == 0:\n print(i)\n break\n\n\nif T % N == 0:\n print(d)\nelse:\n ans()\n","code_v1_no_empty_lines":"import math\n\nN, T = list(map(int, input().split()))\n# d = int(T \/ N)\nm = []\n\n\ndef ans():\n ans = 1\n for i in range(1, int(math.sqrt(T))):\n if T % i == 0:\n m.append(i)\n m.append(T \/\/ i)\n for p in m:\n if p <= T \/\/ N:\n ans = max(ans, p)\n print(ans)\n\n\nif T % N == 0:\n print((int(T \/ N)))\nelse:\n ans()\n","code_same":false,"relative_loc_diff_percent":45.0,"diff":["+import math","+","-d = int(T \/ N)","+# d = int(T \/ N)","+m = []","- for i in range(d + 1, 0, -1):","+ ans = 1","+ for i in range(1, int(math.sqrt(T))):","- print(i)","- break","+ m.append(i)","+ m.append(T \/\/ i)","+ for p in m:","+ if p <= T \/\/ N:","+ ans = max(ans, p)","+ print(ans)","- print(d)","+ print((int(T \/ N)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0900649946,"measured_runtime_v1":0.0646909041,"runtime_lift":1.3922358291,"key":["s093909602","s598967920"]} +{"user_id":"u130860911","problem_id":"p02867","language":"python","submission_id_v0":"s801106787","submission_id_v1":"s259275527","cpu_time_v0":366,"cpu_time_v1":329,"memory_v0":24052,"memory_v1":24048,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.11,"input":"import numpy as np\n\n\n\nN = int(eval(input()))\n\nA = np.array(list(map(int,input().split())))\n\nB = np.array(list(map(int,input().split())))\n\nBsi = np.argsort(B)\n\nA2 = A[Bsi]\n\nBs = B[Bsi]\n\nA2si = np.argsort(A2)\n\nAs = A2[A2si]\n\nC = Bs-As\n\nif any(C[C<0]):\n\n ans = 'No'\n\nelse:\n\n D = A2-As\n\n if any(D == 0):\n\n ans = 'Yes'\n\n elif all(As[1::]-Bs[:-1:] > 0):\n\n pi = 0\n\n i = 0\n\n while i 0):\n\n pi = 0\n\n i = 0\n\n while i 0):\n pi = 0\n i = 0\n while i < N - 1:\n pi = A2si[pi]\n if pi == 0:\n ans = \"Yes\"\n break\n else:\n i += 1\n else:\n ans = \"No\"\n else:\n ans = \"Yes\"\nprint(ans)\n","code_v1_no_empty_lines":"import numpy as np\n\nN = int(eval(input()))\nA = np.array(list(map(int, input().split())))\nB = np.array(list(map(int, input().split())))\nBsi = np.argsort(B)\nA2 = A[Bsi]\nBs = B[Bsi]\nA2si = np.argsort(A2)\nAs = A2[A2si]\nC = Bs - As\nif any(C[C < 0]):\n ans = \"No\"\nelse:\n if all(As[1::] - Bs[:-1:] > 0):\n pi = 0\n i = 0\n while i < N - 1:\n pi = A2si[pi]\n if pi == 0:\n ans = \"Yes\"\n break\n else:\n i += 1\n else:\n ans = \"No\"\n else:\n ans = \"Yes\"\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["- D = A2 - As","- if any(D == 0):","- ans = \"Yes\"","- elif all(As[1::] - Bs[:-1:] > 0):","+ if all(As[1::] - Bs[:-1:] > 0):"],"diff_only_import_comment":false,"measured_runtime_v0":1.124221283,"measured_runtime_v1":1.1072593784,"runtime_lift":1.0153188177,"key":["s801106787","s259275527"]} +{"user_id":"u972591645","problem_id":"p02584","language":"python","submission_id_v0":"s159094595","submission_id_v1":"s452362854","cpu_time_v0":34,"cpu_time_v1":25,"memory_v0":9188,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.47,"input":"x, k, d = list(map(int, input().split()))\n\n\n\npm = 1 if x >= 0 else -1\n\na = abs(x)\/\/d\n\nb = a if abs(x-pm*a*d) < abs(x-pm*(a+1)*d) else a+1\n\nc = min(b, k)\n\ne = x-pm*c*d\n\nif k < b or (k-b) % 2 == 0:\n\n print((abs(e)))\n\nelse:\n\n print((min(abs(e+d), abs(e-d))))","target":"x, k, d = list(map(int, input().split()))\n\n\n\nt = min(abs(x)\/\/d, k)\n\nu = abs(x)-d*t\n\nprint((abs(u-d*((k-t)%2))))\n","code_v0_loc":11,"code_v1_loc":5,"code_v0_num_chars":251,"code_v1_num_chars":104,"code_v0_no_empty_lines":"x, k, d = list(map(int, input().split()))\npm = 1 if x >= 0 else -1\na = abs(x) \/\/ d\nb = a if abs(x - pm * a * d) < abs(x - pm * (a + 1) * d) else a + 1\nc = min(b, k)\ne = x - pm * c * d\nif k < b or (k - b) % 2 == 0:\n print((abs(e)))\nelse:\n print((min(abs(e + d), abs(e - d))))\n","code_v1_no_empty_lines":"x, k, d = list(map(int, input().split()))\nt = min(abs(x) \/\/ d, k)\nu = abs(x) - d * t\nprint((abs(u - d * ((k - t) % 2))))\n","code_same":false,"relative_loc_diff_percent":54.5454545455,"diff":["-pm = 1 if x >= 0 else -1","-a = abs(x) \/\/ d","-b = a if abs(x - pm * a * d) < abs(x - pm * (a + 1) * d) else a + 1","-c = min(b, k)","-e = x - pm * c * d","-if k < b or (k - b) % 2 == 0:","- print((abs(e)))","-else:","- print((min(abs(e + d), abs(e - d))))","+t = min(abs(x) \/\/ d, k)","+u = abs(x) - d * t","+print((abs(u - d * ((k - t) % 2))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450640731,"measured_runtime_v1":0.0361908042,"runtime_lift":1.2451802057,"key":["s159094595","s452362854"]} +{"user_id":"u724687935","problem_id":"p02612","language":"python","submission_id_v0":"s064140398","submission_id_v1":"s472059240","cpu_time_v0":29,"cpu_time_v1":26,"memory_v0":9140,"memory_v1":9096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.34,"input":"N = int(eval(input()))\n\n\n\nfor i in range(100):\n\n if 1000 * i >= N:\n\n break\n\nprint((1000 * i - N))\n","target":"N = int(eval(input()))\n\n\n\nfor i in range(1, 11):\n\n if 1000 * i >= N:\n\n break\n\nprint((1000 * i - N))\n","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":100,"code_v1_num_chars":102,"code_v0_no_empty_lines":"N = int(eval(input()))\nfor i in range(100):\n if 1000 * i >= N:\n break\nprint((1000 * i - N))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nfor i in range(1, 11):\n if 1000 * i >= N:\n break\nprint((1000 * i - N))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(100):","+for i in range(1, 11):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0426559379,"measured_runtime_v1":0.0424231472,"runtime_lift":1.005487351,"key":["s064140398","s472059240"]} +{"user_id":"u245960901","problem_id":"p03162","language":"python","submission_id_v0":"s361772226","submission_id_v1":"s141844031","cpu_time_v0":576,"cpu_time_v1":379,"memory_v0":22824,"memory_v1":28828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.2,"input":"s = list(map(int, input().split()))\n\nn=s[0]\n\ndp=[[0]*3 for i in range(n)]\n\ns = list(map(int, input().split()))\n\ndp[0][0]=s[0]\n\ndp[0][1] = s[1]\n\ndp[0][2] = s[2]\n\nfor i in range(1,n):\n\n s = list(map(int, input().split()))\n\n dp[i][0] = max(dp[i-1][1]+s[0], dp[i-1][2]+s[0])\n\n dp[i][1] = max(dp[i-1][0]+s[1], dp[i-1][2]+s[1])\n\n dp[i][2] = max(dp[i-1][0]+s[2], dp[i-1][1]+s[2])\n\nprint((max(dp[n-1])))","target":"\n\nn=list(map(int,input().split()))[0]\n\n\n\ndp=[[0]*3 for _ in range(n+1)]\n\nfor i in range(1,n+1):\n\n a,b,c=list(map(int,input().split()))\n\n dp[i][0]=max(dp[i-1][1]+a,dp[i-1][2]+a)\n\n dp[i][1]=max(dp[i-1][0]+b,dp[i-1][2]+b)\n\n dp[i][2]=max(dp[i-1][1]+c,dp[i-1][0]+c)\n\nprint((max(dp[-1])))","code_v0_loc":13,"code_v1_loc":10,"code_v0_num_chars":405,"code_v1_num_chars":292,"code_v0_no_empty_lines":"s = list(map(int, input().split()))\nn = s[0]\ndp = [[0] * 3 for i in range(n)]\ns = list(map(int, input().split()))\ndp[0][0] = s[0]\ndp[0][1] = s[1]\ndp[0][2] = s[2]\nfor i in range(1, n):\n s = list(map(int, input().split()))\n dp[i][0] = max(dp[i - 1][1] + s[0], dp[i - 1][2] + s[0])\n dp[i][1] = max(dp[i - 1][0] + s[1], dp[i - 1][2] + s[1])\n dp[i][2] = max(dp[i - 1][0] + s[2], dp[i - 1][1] + s[2])\nprint((max(dp[n - 1])))\n","code_v1_no_empty_lines":"n = list(map(int, input().split()))[0]\ndp = [[0] * 3 for _ in range(n + 1)]\nfor i in range(1, n + 1):\n a, b, c = list(map(int, input().split()))\n dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a)\n dp[i][1] = max(dp[i - 1][0] + b, dp[i - 1][2] + b)\n dp[i][2] = max(dp[i - 1][1] + c, dp[i - 1][0] + c)\nprint((max(dp[-1])))\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-s = list(map(int, input().split()))","-n = s[0]","-dp = [[0] * 3 for i in range(n)]","-s = list(map(int, input().split()))","-dp[0][0] = s[0]","-dp[0][1] = s[1]","-dp[0][2] = s[2]","-for i in range(1, n):","- s = list(map(int, input().split()))","- dp[i][0] = max(dp[i - 1][1] + s[0], dp[i - 1][2] + s[0])","- dp[i][1] = max(dp[i - 1][0] + s[1], dp[i - 1][2] + s[1])","- dp[i][2] = max(dp[i - 1][0] + s[2], dp[i - 1][1] + s[2])","-print((max(dp[n - 1])))","+n = list(map(int, input().split()))[0]","+dp = [[0] * 3 for _ in range(n + 1)]","+for i in range(1, n + 1):","+ a, b, c = list(map(int, input().split()))","+ dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a)","+ dp[i][1] = max(dp[i - 1][0] + b, dp[i - 1][2] + b)","+ dp[i][2] = max(dp[i - 1][1] + c, dp[i - 1][0] + c)","+print((max(dp[-1])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369290209,"measured_runtime_v1":0.0458702102,"runtime_lift":0.805076339,"key":["s361772226","s141844031"]} +{"user_id":"u952708174","problem_id":"p03673","language":"python","submission_id_v0":"s747977385","submission_id_v1":"s611173923","cpu_time_v0":805,"cpu_time_v1":157,"memory_v0":29764,"memory_v1":30020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":80.5,"input":"def C_pushpush(x):\n\n from collections import deque\n\n # insert\u3092\u30ea\u30b9\u30c8\u306e\u5148\u982d\u306b\u884c\u3046\u3068\u3001\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u306e\u518d\u914d\u7f6e\u306b\u6642\u9593\u304c\u304b\u304b\u308b\n\n n = int(x[0])\n\n a = deque(x[1:])\n\n b = deque([])\n\n n_parity = n & 1\n\n for i in range(n):\n\n if n_parity == (i + 1) & 1:\n\n # n,i\u306e\u30d1\u30ea\u30c6\u30a3\u304c\u4e00\u81f4\n\n b.appendleft(a[i])\n\n else:\n\n b.append(a[i])\n\n print((' '.join(b)))\n\n\n\nn = eval(input())\n\nl = [i for i in input().split()]\n\nx = [n]+l\n\nC_pushpush(x)","target":"def c_pushpush(N,A):\n\n from collections import deque\n\n # insert\u3092\u30ea\u30b9\u30c8\u306e\u5148\u982d\u306b\u884c\u3046\u3068\u3001\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u306e\u518d\u914d\u7f6e\u306b\u6642\u9593\u304c\u304b\u304b\u308b\n\n b = deque([])\n\n n_parity = N & 1\n\n for i in range(N):\n\n if n_parity == (i + 1) & 1:\n\n # n,i\u306e\u30d1\u30ea\u30c6\u30a3\u304c\u4e00\u81f4\n\n b.appendleft(A[i])\n\n else:\n\n b.append(A[i])\n\n ans = ' '.join(map(str,b))\n\n return ans\n\n\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nprint((c_pushpush(N,A)))","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":440,"code_v1_num_chars":433,"code_v0_no_empty_lines":"def C_pushpush(x):\n from collections import deque\n\n # insert\u3092\u30ea\u30b9\u30c8\u306e\u5148\u982d\u306b\u884c\u3046\u3068\u3001\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u306e\u518d\u914d\u7f6e\u306b\u6642\u9593\u304c\u304b\u304b\u308b\n n = int(x[0])\n a = deque(x[1:])\n b = deque([])\n n_parity = n & 1\n for i in range(n):\n if n_parity == (i + 1) & 1:\n # n,i\u306e\u30d1\u30ea\u30c6\u30a3\u304c\u4e00\u81f4\n b.appendleft(a[i])\n else:\n b.append(a[i])\n print((\" \".join(b)))\n\n\nn = eval(input())\nl = [i for i in input().split()]\nx = [n] + l\nC_pushpush(x)\n","code_v1_no_empty_lines":"def c_pushpush(N, A):\n from collections import deque\n\n # insert\u3092\u30ea\u30b9\u30c8\u306e\u5148\u982d\u306b\u884c\u3046\u3068\u3001\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u306e\u518d\u914d\u7f6e\u306b\u6642\u9593\u304c\u304b\u304b\u308b\n b = deque([])\n n_parity = N & 1\n for i in range(N):\n if n_parity == (i + 1) & 1:\n # n,i\u306e\u30d1\u30ea\u30c6\u30a3\u304c\u4e00\u81f4\n b.appendleft(A[i])\n else:\n b.append(A[i])\n ans = \" \".join(map(str, b))\n return ans\n\n\nN = int(eval(input()))\nA = [int(i) for i in input().split()]\nprint((c_pushpush(N, A)))\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-def C_pushpush(x):","+def c_pushpush(N, A):","- n = int(x[0])","- a = deque(x[1:])","- n_parity = n & 1","- for i in range(n):","+ n_parity = N & 1","+ for i in range(N):","- b.appendleft(a[i])","+ b.appendleft(A[i])","- b.append(a[i])","- print((\" \".join(b)))","+ b.append(A[i])","+ ans = \" \".join(map(str, b))","+ return ans","-n = eval(input())","-l = [i for i in input().split()]","-x = [n] + l","-C_pushpush(x)","+N = int(eval(input()))","+A = [int(i) for i in input().split()]","+print((c_pushpush(N, A)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0567905426,"measured_runtime_v1":0.0397188663,"runtime_lift":1.4298127769,"key":["s747977385","s611173923"]} +{"user_id":"u717626627","problem_id":"p02945","language":"python","submission_id_v0":"s400372300","submission_id_v1":"s283361448","cpu_time_v0":154,"cpu_time_v1":17,"memory_v0":12420,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.96,"input":"import numpy as np\n\n\n\na,b = list(map(int, input().split()))\n\n\n\nans = [a + b, a- b, a * b]\n\n\n\nprint((np.amax(ans)))","target":"a,b = list(map(int, input().split()))\n\n\n\nprint((max(max(a+b, a-b), a*b)))","code_v0_loc":7,"code_v1_loc":3,"code_v0_num_chars":106,"code_v1_num_chars":65,"code_v0_no_empty_lines":"import numpy as np\n\na, b = list(map(int, input().split()))\nans = [a + b, a - b, a * b]\nprint((np.amax(ans)))\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nprint((max(max(a + b, a - b), a * b)))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-import numpy as np","-","-ans = [a + b, a - b, a * b]","-print((np.amax(ans)))","+print((max(max(a + b, a - b), a * b)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2074327469,"measured_runtime_v1":0.0387557507,"runtime_lift":5.3523088399,"key":["s400372300","s283361448"]} +{"user_id":"u297109012","problem_id":"p03427","language":"python","submission_id_v0":"s384116120","submission_id_v1":"s889805495","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"def solve(N):\n\n if N < 10:\n\n return N\n\n num = 9\n\n while num < N:\n\n num *= 10\n\n num += 9\n\n num -= 9\n\n num \/\/= 10\n\n\n\n k = int(str(N)[0] + str(num))\n\n if k <= N:\n\n return sum(int(c) for c in str(k))\n\n else:\n\n k = int(str(N)[0] + str(num)) - num - 1\n\n return sum(int(c) for c in str(k))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n N = int(eval(input()))\n\n print((solve(N)))\n","target":"def solve(N):\n\n if N < 10:\n\n return N\n\n num = int(\"9\" * (len(str(N)) - 1))\n\n k = int(str(N)[0] + str(num))\n\n if k <= N:\n\n return sum(int(c) for c in str(k))\n\n else:\n\n k = k - num - 1\n\n return sum(int(c) for c in str(k))\n\n\n\n\n\nassert (solve(799) == 25)\n\nassert (solve(999) == 27)\n\nassert (solve(200) == 19)\n\nassert (solve(100) == 18)\n\nassert (solve(99) == 18)\n\nassert (solve(89) == 17)\n\nassert (solve(5) == 5)\n\n\n\nif __name__ == \"__main__\":\n\n N = int(eval(input()))\n\n print((solve(N)))\n","code_v0_loc":21,"code_v1_loc":23,"code_v0_num_chars":424,"code_v1_num_chars":524,"code_v0_no_empty_lines":"def solve(N):\n if N < 10:\n return N\n num = 9\n while num < N:\n num *= 10\n num += 9\n num -= 9\n num \/\/= 10\n k = int(str(N)[0] + str(num))\n if k <= N:\n return sum(int(c) for c in str(k))\n else:\n k = int(str(N)[0] + str(num)) - num - 1\n return sum(int(c) for c in str(k))\n\n\nif __name__ == \"__main__\":\n N = int(eval(input()))\n print((solve(N)))\n","code_v1_no_empty_lines":"def solve(N):\n if N < 10:\n return N\n num = int(\"9\" * (len(str(N)) - 1))\n k = int(str(N)[0] + str(num))\n if k <= N:\n return sum(int(c) for c in str(k))\n else:\n k = k - num - 1\n return sum(int(c) for c in str(k))\n\n\nassert solve(799) == 25\nassert solve(999) == 27\nassert solve(200) == 19\nassert solve(100) == 18\nassert solve(99) == 18\nassert solve(89) == 17\nassert solve(5) == 5\nif __name__ == \"__main__\":\n N = int(eval(input()))\n print((solve(N)))\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["- num = 9","- while num < N:","- num *= 10","- num += 9","- num -= 9","- num \/\/= 10","+ num = int(\"9\" * (len(str(N)) - 1))","- k = int(str(N)[0] + str(num)) - num - 1","+ k = k - num - 1","+assert solve(799) == 25","+assert solve(999) == 27","+assert solve(200) == 19","+assert solve(100) == 18","+assert solve(99) == 18","+assert solve(89) == 17","+assert solve(5) == 5"],"diff_only_import_comment":false,"measured_runtime_v0":0.0468896053,"measured_runtime_v1":0.0484519324,"runtime_lift":0.9677551116,"key":["s384116120","s889805495"]} +{"user_id":"u731368968","problem_id":"p02813","language":"python","submission_id_v0":"s253524419","submission_id_v1":"s613142905","cpu_time_v0":35,"cpu_time_v1":29,"memory_v0":8052,"memory_v1":8052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.14,"input":"N = int(eval(input()))\n\nP = tuple(map(int, input().split()))\n\nQ = tuple(map(int, input().split()))\n\n\n\n\n\nimport itertools\n\n\n\nL = list(itertools.permutations([i for i in range(1, N + 1)]))\n\n\n\na = b = 1\n\n\n\nfor l in L:\n\n if l == P:\n\n break\n\n a += 1\n\nfor l in L:\n\n if l == Q:\n\n break\n\n b += 1\n\nprint((abs(a-b)))","target":"n = int(eval(input()))\n\nfrom itertools import *\n\nl = list(permutations(list(range(1, n + 1)), n))\n\nl.sort()\n\np = l.index(tuple(map(int, input().split())))\n\nq = l.index(tuple(map(int, input().split())))\n\nprint((abs(p - q)))\n","code_v0_loc":20,"code_v1_loc":7,"code_v0_num_chars":324,"code_v1_num_chars":209,"code_v0_no_empty_lines":"N = int(eval(input()))\nP = tuple(map(int, input().split()))\nQ = tuple(map(int, input().split()))\nimport itertools\n\nL = list(itertools.permutations([i for i in range(1, N + 1)]))\na = b = 1\nfor l in L:\n if l == P:\n break\n a += 1\nfor l in L:\n if l == Q:\n break\n b += 1\nprint((abs(a - b)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nfrom itertools import *\n\nl = list(permutations(list(range(1, n + 1)), n))\nl.sort()\np = l.index(tuple(map(int, input().split())))\nq = l.index(tuple(map(int, input().split())))\nprint((abs(p - q)))\n","code_same":false,"relative_loc_diff_percent":65.0,"diff":["-N = int(eval(input()))","-P = tuple(map(int, input().split()))","-Q = tuple(map(int, input().split()))","-import itertools","+n = int(eval(input()))","+from itertools import *","-L = list(itertools.permutations([i for i in range(1, N + 1)]))","-a = b = 1","-for l in L:","- if l == P:","- break","- a += 1","-for l in L:","- if l == Q:","- break","- b += 1","-print((abs(a - b)))","+l = list(permutations(list(range(1, n + 1)), n))","+l.sort()","+p = l.index(tuple(map(int, input().split())))","+q = l.index(tuple(map(int, input().split())))","+print((abs(p - q)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0445777893,"measured_runtime_v1":0.082470274,"runtime_lift":0.5405316019,"key":["s253524419","s613142905"]} +{"user_id":"u680851063","problem_id":"p02952","language":"python","submission_id_v0":"s922629103","submission_id_v1":"s039759898","cpu_time_v0":98,"cpu_time_v1":57,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":41.84,"input":"a =int(eval(input()))\n\nb=0\n\nfor i in range(1,a+1):\n\n s=[]\n\n s=list(str(i))\n\n if len(s)%2!=0:\n\n b+=1\n\nprint(b)","target":"n = int(eval(input()))\n\n\n\nx = 0\n\nfor i in range(1,n+1):\n\n if len(str(i))%2!=0:\n\n x += 1\n\n\n\nprint(x)","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":119,"code_v1_num_chars":103,"code_v0_no_empty_lines":"a = int(eval(input()))\nb = 0\nfor i in range(1, a + 1):\n s = []\n s = list(str(i))\n if len(s) % 2 != 0:\n b += 1\nprint(b)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nx = 0\nfor i in range(1, n + 1):\n if len(str(i)) % 2 != 0:\n x += 1\nprint(x)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a = int(eval(input()))","-b = 0","-for i in range(1, a + 1):","- s = []","- s = list(str(i))","- if len(s) % 2 != 0:","- b += 1","-print(b)","+n = int(eval(input()))","+x = 0","+for i in range(1, n + 1):","+ if len(str(i)) % 2 != 0:","+ x += 1","+print(x)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0576002669,"measured_runtime_v1":0.0486713774,"runtime_lift":1.1834525747,"key":["s922629103","s039759898"]} +{"user_id":"u971124021","problem_id":"p03835","language":"python","submission_id_v0":"s082382323","submission_id_v1":"s033857656","cpu_time_v0":1985,"cpu_time_v1":1323,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.35,"input":"k,s = list(map(int,input().split()))\n\ncnt = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n if s-(x+y) >=0 and s-(x+y) <= k:\n\n cnt += 1\n\nprint(cnt)","target":"\n\nk,s = list(map(int,input().split()))\n\n\n\ndef est():\n\n cnt = 0\n\n for x in range(k+1):\n\n for y in range(k+1):\n\n if s-(x+y) >=0 and s-(x+y) <= k:\n\n cnt += 1\n\n return cnt\n\nprint((est()))","code_v0_loc":7,"code_v1_loc":11,"code_v0_num_chars":158,"code_v1_num_chars":200,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\ncnt = 0\nfor x in range(k + 1):\n for y in range(k + 1):\n if s - (x + y) >= 0 and s - (x + y) <= k:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"k, s = list(map(int, input().split()))\n\n\ndef est():\n cnt = 0\n for x in range(k + 1):\n for y in range(k + 1):\n if s - (x + y) >= 0 and s - (x + y) <= k:\n cnt += 1\n return cnt\n\n\nprint((est()))\n","code_same":false,"relative_loc_diff_percent":36.3636363636,"diff":["-cnt = 0","-for x in range(k + 1):","- for y in range(k + 1):","- if s - (x + y) >= 0 and s - (x + y) <= k:","- cnt += 1","-print(cnt)","+","+","+def est():","+ cnt = 0","+ for x in range(k + 1):","+ for y in range(k + 1):","+ if s - (x + y) >= 0 and s - (x + y) <= k:","+ cnt += 1","+ return cnt","+","+","+print((est()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0342062496,"measured_runtime_v1":0.052576048,"runtime_lift":0.6506051889,"key":["s082382323","s033857656"]} +{"user_id":"u778204640","problem_id":"p03177","language":"python","submission_id_v0":"s664124501","submission_id_v1":"s477351044","cpu_time_v0":977,"cpu_time_v1":857,"memory_v0":19556,"memory_v1":12508,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.28,"input":"import numpy\n\nM=10**9+7\n\nn,k=list(map(int,input().split()))\n\na=numpy.matrix([list(map(int,input().split()))for i in[0]*n],dtype='O')\n\nb=numpy.eye(n,dtype='O')\n\nwhile k:\n\n if k&1:b=b*a%M\n\n a=a*a%M\n\n k\/=2\n\nprint(b.sum()%M)","target":"import numpy as P\n\nM=10**9+7\n\nn,k=list(map(int,input().split()))\n\na=P.matrix([list(map(int,input().split()))for i in[0]*n],dtype='O')\n\nb=P.eye(n,dtype='O')\n\nwhile k:\n\n if k&1:b=b*a%M\n\n a=a*a%M\n\n k>>=1\n\nprint((b.sum()%M))","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":215,"code_v1_num_chars":212,"code_v0_no_empty_lines":"import numpy\n\nM = 10**9 + 7\nn, k = list(map(int, input().split()))\na = numpy.matrix([list(map(int, input().split())) for i in [0] * n], dtype=\"O\")\nb = numpy.eye(n, dtype=\"O\")\nwhile k:\n if k & 1:\n b = b * a % M\n a = a * a % M\n k \/= 2\nprint(b.sum() % M)\n","code_v1_no_empty_lines":"import numpy as P\n\nM = 10**9 + 7\nn, k = list(map(int, input().split()))\na = P.matrix([list(map(int, input().split())) for i in [0] * n], dtype=\"O\")\nb = P.eye(n, dtype=\"O\")\nwhile k:\n if k & 1:\n b = b * a % M\n a = a * a % M\n k >>= 1\nprint((b.sum() % M))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import numpy","+import numpy as P","-a = numpy.matrix([list(map(int, input().split())) for i in [0] * n], dtype=\"O\")","-b = numpy.eye(n, dtype=\"O\")","+a = P.matrix([list(map(int, input().split())) for i in [0] * n], dtype=\"O\")","+b = P.eye(n, dtype=\"O\")","- k \/= 2","-print(b.sum() % M)","+ k >>= 1","+print((b.sum() % M))"],"diff_only_import_comment":false,"measured_runtime_v0":0.2227695907,"measured_runtime_v1":0.2283913327,"runtime_lift":0.9753854844,"key":["s664124501","s477351044"]} +{"user_id":"u188827677","problem_id":"p02707","language":"python","submission_id_v0":"s999137133","submission_id_v1":"s344590222","cpu_time_v0":188,"cpu_time_v1":147,"memory_v0":34180,"memory_v1":32288,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.81,"input":"from collections import Counter\n\nn = int(eval(input()))\n\na = Counter(list(map(int, input().split())))\n\n\n\nfor i in range(n):\n\n print((a[i+1]))","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\ns = [0]*n\n\nfor i in a:\n\n s[i-1] += 1\n\n \n\nfor i in s:\n\n print(i)","code_v0_loc":6,"code_v1_loc":9,"code_v0_num_chars":134,"code_v1_num_chars":123,"code_v0_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\na = Counter(list(map(int, input().split())))\nfor i in range(n):\n print((a[i + 1]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\ns = [0] * n\nfor i in a:\n s[i - 1] += 1\nfor i in s:\n print(i)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-from collections import Counter","-","-a = Counter(list(map(int, input().split())))","-for i in range(n):","- print((a[i + 1]))","+a = list(map(int, input().split()))","+s = [0] * n","+for i in a:","+ s[i - 1] += 1","+for i in s:","+ print(i)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0406904635,"measured_runtime_v1":0.040381892,"runtime_lift":1.0076413351,"key":["s999137133","s344590222"]} +{"user_id":"u312025627","problem_id":"p02873","language":"python","submission_id_v0":"s911695768","submission_id_v1":"s231774525","cpu_time_v0":426,"cpu_time_v1":268,"memory_v0":88264,"memory_v1":83400,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.09,"input":"def main():\n\n S = eval(input())\n\n N = len(S)\n\n li = []\n\n pre = S[0]\n\n pre_cnt = 1\n\n l_cnt = 0\n\n for i in range(1, N):\n\n if (pre == '<' and S[i] == '>') or (pre == '>' and S[i] == '<'):\n\n li.append((pre*pre_cnt, l_cnt))\n\n pre = S[i]\n\n pre_cnt = 1\n\n l_cnt += 1\n\n else:\n\n pre_cnt += 1\n\n else:\n\n li.append((pre*pre_cnt, l_cnt))\n\n finished = [False] * (len(li)+1)\n\n li.sort(key=lambda s: len(s[0]), reverse=True)\n\n\n\n ans = 0\n\n for i in range(len(li)):\n\n if li[i][0][0] == '<':\n\n n = len(li[i][0])\n\n if finished[li[i][1] + 1]:\n\n n -= 1\n\n ans += (n*(n+1))\/\/2\n\n else:\n\n n = len(li[i][0])\n\n if finished[li[i][1]]:\n\n n -= 1\n\n ans += (n*(n+1))\/\/2\n\n finished[li[i][1]] = True\n\n finished[li[i][1] + 1] = True\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n S = eval(input())\n\n from itertools import groupby\n\n ans = 0\n\n SL = [(k, len(list(v))) for k, v in groupby(S)]\n\n if SL[0][0] == \">\":\n\n ans += (SL[0][1])*(SL[0][1] + 1)\/\/2\n\n pre_v = SL[0][1]\n\n for k, v in SL[1:]:\n\n if k == \"<\":\n\n pre_v = v\n\n continue\n\n else:\n\n if pre_v > v:\n\n ans += pre_v*(pre_v+1)\/\/2\n\n ans += v*(v-1)\/\/2\n\n else:\n\n ans += (pre_v-1)*pre_v\/\/2\n\n ans += v*(v+1)\/\/2\n\n # print(ans, pre, pre_v)\n\n pre_v = v\n\n else:\n\n pre_v = 0\n\n for k, v in SL:\n\n if k == \"<\":\n\n pre_v = v\n\n continue\n\n else:\n\n if pre_v > v:\n\n ans += pre_v*(pre_v+1)\/\/2\n\n ans += v*(v-1)\/\/2\n\n else:\n\n ans += (pre_v-1)*pre_v\/\/2\n\n ans += v*(v+1)\/\/2\n\n # print(ans, pre, pre_v)\n\n pre_v = v\n\n if SL[-1][0] == \"<\":\n\n ans += (SL[-1][1])*(SL[-1][1] + 1)\/\/2\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":40,"code_v1_loc":43,"code_v0_num_chars":988,"code_v1_num_chars":1213,"code_v0_no_empty_lines":"def main():\n S = eval(input())\n N = len(S)\n li = []\n pre = S[0]\n pre_cnt = 1\n l_cnt = 0\n for i in range(1, N):\n if (pre == \"<\" and S[i] == \">\") or (pre == \">\" and S[i] == \"<\"):\n li.append((pre * pre_cnt, l_cnt))\n pre = S[i]\n pre_cnt = 1\n l_cnt += 1\n else:\n pre_cnt += 1\n else:\n li.append((pre * pre_cnt, l_cnt))\n finished = [False] * (len(li) + 1)\n li.sort(key=lambda s: len(s[0]), reverse=True)\n ans = 0\n for i in range(len(li)):\n if li[i][0][0] == \"<\":\n n = len(li[i][0])\n if finished[li[i][1] + 1]:\n n -= 1\n ans += (n * (n + 1)) \/\/ 2\n else:\n n = len(li[i][0])\n if finished[li[i][1]]:\n n -= 1\n ans += (n * (n + 1)) \/\/ 2\n finished[li[i][1]] = True\n finished[li[i][1] + 1] = True\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n S = eval(input())\n from itertools import groupby\n\n ans = 0\n SL = [(k, len(list(v))) for k, v in groupby(S)]\n if SL[0][0] == \">\":\n ans += (SL[0][1]) * (SL[0][1] + 1) \/\/ 2\n pre_v = SL[0][1]\n for k, v in SL[1:]:\n if k == \"<\":\n pre_v = v\n continue\n else:\n if pre_v > v:\n ans += pre_v * (pre_v + 1) \/\/ 2\n ans += v * (v - 1) \/\/ 2\n else:\n ans += (pre_v - 1) * pre_v \/\/ 2\n ans += v * (v + 1) \/\/ 2\n # print(ans, pre, pre_v)\n pre_v = v\n else:\n pre_v = 0\n for k, v in SL:\n if k == \"<\":\n pre_v = v\n continue\n else:\n if pre_v > v:\n ans += pre_v * (pre_v + 1) \/\/ 2\n ans += v * (v - 1) \/\/ 2\n else:\n ans += (pre_v - 1) * pre_v \/\/ 2\n ans += v * (v + 1) \/\/ 2\n # print(ans, pre, pre_v)\n pre_v = v\n if SL[-1][0] == \"<\":\n ans += (SL[-1][1]) * (SL[-1][1] + 1) \/\/ 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.976744186,"diff":["- N = len(S)","- li = []","- pre = S[0]","- pre_cnt = 1","- l_cnt = 0","- for i in range(1, N):","- if (pre == \"<\" and S[i] == \">\") or (pre == \">\" and S[i] == \"<\"):","- li.append((pre * pre_cnt, l_cnt))","- pre = S[i]","- pre_cnt = 1","- l_cnt += 1","- else:","- pre_cnt += 1","+ from itertools import groupby","+","+ ans = 0","+ SL = [(k, len(list(v))) for k, v in groupby(S)]","+ if SL[0][0] == \">\":","+ ans += (SL[0][1]) * (SL[0][1] + 1) \/\/ 2","+ pre_v = SL[0][1]","+ for k, v in SL[1:]:","+ if k == \"<\":","+ pre_v = v","+ continue","+ else:","+ if pre_v > v:","+ ans += pre_v * (pre_v + 1) \/\/ 2","+ ans += v * (v - 1) \/\/ 2","+ else:","+ ans += (pre_v - 1) * pre_v \/\/ 2","+ ans += v * (v + 1) \/\/ 2","+ # print(ans, pre, pre_v)","+ pre_v = v","- li.append((pre * pre_cnt, l_cnt))","- finished = [False] * (len(li) + 1)","- li.sort(key=lambda s: len(s[0]), reverse=True)","- ans = 0","- for i in range(len(li)):","- if li[i][0][0] == \"<\":","- n = len(li[i][0])","- if finished[li[i][1] + 1]:","- n -= 1","- ans += (n * (n + 1)) \/\/ 2","- else:","- n = len(li[i][0])","- if finished[li[i][1]]:","- n -= 1","- ans += (n * (n + 1)) \/\/ 2","- finished[li[i][1]] = True","- finished[li[i][1] + 1] = True","+ pre_v = 0","+ for k, v in SL:","+ if k == \"<\":","+ pre_v = v","+ continue","+ else:","+ if pre_v > v:","+ ans += pre_v * (pre_v + 1) \/\/ 2","+ ans += v * (v - 1) \/\/ 2","+ else:","+ ans += (pre_v - 1) * pre_v \/\/ 2","+ ans += v * (v + 1) \/\/ 2","+ # print(ans, pre, pre_v)","+ pre_v = v","+ if SL[-1][0] == \"<\":","+ ans += (SL[-1][1]) * (SL[-1][1] + 1) \/\/ 2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0466335905,"measured_runtime_v1":0.0461393333,"runtime_lift":1.0107122745,"key":["s911695768","s231774525"]} +{"user_id":"u761529120","problem_id":"p02727","language":"python","submission_id_v0":"s996477953","submission_id_v1":"s758419655","cpu_time_v0":902,"cpu_time_v1":518,"memory_v0":125428,"memory_v1":120872,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.57,"input":"import heapq\n\nimport sys\n\nfrom itertools import accumulate\n\nfrom collections import defaultdict\n\n\n\ninput = sys.stdin.readline\n\n\n\ndef main():\n\n X, Y, A, B, C = list(map(int, input().split()))\n\n P = list(map(int, input().split()))\n\n Q = list(map(int, input().split()))\n\n R = list(map(int, input().split()))\n\n ans = 0\n\n P_d = defaultdict(int)\n\n Q_d = defaultdict(int)\n\n R_d = defaultdict(int)\n\n\n\n for i in range(len(P)):\n\n P[i] = -P[i]\n\n P_d[P[i]] += 1\n\n \n\n for i in range(len(Q)):\n\n Q[i] = -Q[i]\n\n Q_d[Q[i]] += 1\n\n\n\n \n\n for i in range(len(R)):\n\n R[i] = -R[i]\n\n R_d[R[i]] += 1\n\n\n\n H = P + Q + R\n\n heapq.heapify(H)\n\n red = 0\n\n green = 0\n\n nocl = 0\n\n ans = 0\n\n for i in range(A + B + C):\n\n tmp = heapq.heappop(H)\n\n if red + green + nocl == X + Y:\n\n print((-ans))\n\n exit()\n\n\n\n if P_d[tmp] >= 1 and red < X:\n\n P_d[tmp] -= 1\n\n red += 1\n\n ans += tmp\n\n elif Q_d[tmp] >= 1 and green < Y:\n\n Q_d[tmp] -= 1\n\n green += 1\n\n ans += tmp\n\n elif R_d[tmp] >= 1:\n\n R_d[tmp] -= 1\n\n nocl += 1\n\n ans += tmp\n\n \n\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"from collections import defaultdict\n\n\n\ndef main():\n\n X, Y, A, B, C = list(map(int, input().split()))\n\n P = list(map(int, input().split()))\n\n Q = list(map(int, input().split()))\n\n R = list(map(int, input().split()))\n\n d_p = defaultdict(int)\n\n d_q = defaultdict(int)\n\n d_r = defaultdict(int)\n\n for p in P:\n\n d_p[p] += 1\n\n for q in Q:\n\n d_q[q] += 1\n\n for r in R:\n\n d_r[r] += 1\n\n D = P + Q + R\n\n D.sort(reverse=True)\n\n ans = 0\n\n x = 0\n\n y = 0\n\n c = 0\n\n for i in range(A + B + C):\n\n if x + y + c >= X + Y:\n\n break\n\n\n\n if x < X and d_p[D[i]]:\n\n ans += D[i]\n\n x += 1\n\n d_p[D[i]] -= 1\n\n elif y < Y and d_q[D[i]]:\n\n ans += D[i]\n\n y += 1\n\n d_q[D[i]] -= 1\n\n elif d_r[D[i]]:\n\n ans += D[i]\n\n c += 1\n\n d_r[D[i]] -= 1\n\n\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":62,"code_v1_loc":43,"code_v0_num_chars":1291,"code_v1_num_chars":966,"code_v0_no_empty_lines":"import heapq\nimport sys\nfrom itertools import accumulate\nfrom collections import defaultdict\n\ninput = sys.stdin.readline\n\n\ndef main():\n X, Y, A, B, C = list(map(int, input().split()))\n P = list(map(int, input().split()))\n Q = list(map(int, input().split()))\n R = list(map(int, input().split()))\n ans = 0\n P_d = defaultdict(int)\n Q_d = defaultdict(int)\n R_d = defaultdict(int)\n for i in range(len(P)):\n P[i] = -P[i]\n P_d[P[i]] += 1\n for i in range(len(Q)):\n Q[i] = -Q[i]\n Q_d[Q[i]] += 1\n for i in range(len(R)):\n R[i] = -R[i]\n R_d[R[i]] += 1\n H = P + Q + R\n heapq.heapify(H)\n red = 0\n green = 0\n nocl = 0\n ans = 0\n for i in range(A + B + C):\n tmp = heapq.heappop(H)\n if red + green + nocl == X + Y:\n print((-ans))\n exit()\n if P_d[tmp] >= 1 and red < X:\n P_d[tmp] -= 1\n red += 1\n ans += tmp\n elif Q_d[tmp] >= 1 and green < Y:\n Q_d[tmp] -= 1\n green += 1\n ans += tmp\n elif R_d[tmp] >= 1:\n R_d[tmp] -= 1\n nocl += 1\n ans += tmp\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import defaultdict\n\n\ndef main():\n X, Y, A, B, C = list(map(int, input().split()))\n P = list(map(int, input().split()))\n Q = list(map(int, input().split()))\n R = list(map(int, input().split()))\n d_p = defaultdict(int)\n d_q = defaultdict(int)\n d_r = defaultdict(int)\n for p in P:\n d_p[p] += 1\n for q in Q:\n d_q[q] += 1\n for r in R:\n d_r[r] += 1\n D = P + Q + R\n D.sort(reverse=True)\n ans = 0\n x = 0\n y = 0\n c = 0\n for i in range(A + B + C):\n if x + y + c >= X + Y:\n break\n if x < X and d_p[D[i]]:\n ans += D[i]\n x += 1\n d_p[D[i]] -= 1\n elif y < Y and d_q[D[i]]:\n ans += D[i]\n y += 1\n d_q[D[i]] -= 1\n elif d_r[D[i]]:\n ans += D[i]\n c += 1\n d_r[D[i]] -= 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":30.6451612903,"diff":["-import heapq","-import sys","-from itertools import accumulate","-","-input = sys.stdin.readline","+ d_p = defaultdict(int)","+ d_q = defaultdict(int)","+ d_r = defaultdict(int)","+ for p in P:","+ d_p[p] += 1","+ for q in Q:","+ d_q[q] += 1","+ for r in R:","+ d_r[r] += 1","+ D = P + Q + R","+ D.sort(reverse=True)","- P_d = defaultdict(int)","- Q_d = defaultdict(int)","- R_d = defaultdict(int)","- for i in range(len(P)):","- P[i] = -P[i]","- P_d[P[i]] += 1","- for i in range(len(Q)):","- Q[i] = -Q[i]","- Q_d[Q[i]] += 1","- for i in range(len(R)):","- R[i] = -R[i]","- R_d[R[i]] += 1","- H = P + Q + R","- heapq.heapify(H)","- red = 0","- green = 0","- nocl = 0","- ans = 0","+ x = 0","+ y = 0","+ c = 0","- tmp = heapq.heappop(H)","- if red + green + nocl == X + Y:","- print((-ans))","- exit()","- if P_d[tmp] >= 1 and red < X:","- P_d[tmp] -= 1","- red += 1","- ans += tmp","- elif Q_d[tmp] >= 1 and green < Y:","- Q_d[tmp] -= 1","- green += 1","- ans += tmp","- elif R_d[tmp] >= 1:","- R_d[tmp] -= 1","- nocl += 1","- ans += tmp","+ if x + y + c >= X + Y:","+ break","+ if x < X and d_p[D[i]]:","+ ans += D[i]","+ x += 1","+ d_p[D[i]] -= 1","+ elif y < Y and d_q[D[i]]:","+ ans += D[i]","+ y += 1","+ d_q[D[i]] -= 1","+ elif d_r[D[i]]:","+ ans += D[i]","+ c += 1","+ d_r[D[i]] -= 1","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0828330233,"measured_runtime_v1":0.0445058775,"runtime_lift":1.8611704331,"key":["s996477953","s758419655"]} +{"user_id":"u576917603","problem_id":"p02936","language":"python","submission_id_v0":"s735418228","submission_id_v1":"s776834023","cpu_time_v0":1237,"cpu_time_v1":1049,"memory_v0":73212,"memory_v1":56168,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.2,"input":"def main():\n\n import sys\n\n input=sys.stdin.readline\n\n n,q=list(map(int,input().split()))\n\n from collections import deque,defaultdict\n\n dic=defaultdict(list)\n\n for i in range(n-1):\n\n x,y=list(map(int,input().split()))\n\n dic[x-1].append(y-1)\n\n dic[y-1].append(x-1)\n\n cnt=[0]*n\n\n for i in range(q):\n\n x,y=list(map(int,input().split()))\n\n cnt[x-1]+=y\n\n \n\n d=deque()\n\n d.append(0)\n\n completed=[False]*n\n\n while d:\n\n now=d.popleft()\n\n completed[now]=True\n\n for x in dic[now]:\n\n if completed[x]==False:\n\n cnt[x]+=cnt[now]\n\n d.append(x)\n\n print((*cnt))\n\n\n\nif __name__==\"__main__\":\n\n main()","target":"import sys\n\ninput=sys.stdin.readline\n\ndef main():\n\n n,q=list(map(int,input().split()))\n\n tree=[[]*n for i in range(n)]\n\n score=[0]*n\n\n \n\n for i in range(n-1):\n\n x,y=list(map(int,input().split()))\n\n tree[x-1].append(y-1)\n\n tree[y-1].append(x-1)\n\n \n\n for i in range(q):\n\n x,y=list(map(int,input().split()))\n\n score[x-1]+=y\n\n \n\n from collections import deque\n\n option=deque()\n\n option.append(0)\n\n completed=[None]*n\n\n \n\n while option:\n\n before=option.pop()\n\n completed[before]=True\n\n for i in tree[before]:\n\n if completed[i]==None:\n\n score[i]+=score[before]\n\n option.append(i)\n\n print((*score))\n\nif __name__==\"__main__\":\n\n main()","code_v0_loc":29,"code_v1_loc":31,"code_v0_num_chars":703,"code_v1_num_chars":755,"code_v0_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.readline\n n, q = list(map(int, input().split()))\n from collections import deque, defaultdict\n\n dic = defaultdict(list)\n for i in range(n - 1):\n x, y = list(map(int, input().split()))\n dic[x - 1].append(y - 1)\n dic[y - 1].append(x - 1)\n cnt = [0] * n\n for i in range(q):\n x, y = list(map(int, input().split()))\n cnt[x - 1] += y\n d = deque()\n d.append(0)\n completed = [False] * n\n while d:\n now = d.popleft()\n completed[now] = True\n for x in dic[now]:\n if completed[x] == False:\n cnt[x] += cnt[now]\n d.append(x)\n print((*cnt))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n n, q = list(map(int, input().split()))\n tree = [[] * n for i in range(n)]\n score = [0] * n\n for i in range(n - 1):\n x, y = list(map(int, input().split()))\n tree[x - 1].append(y - 1)\n tree[y - 1].append(x - 1)\n for i in range(q):\n x, y = list(map(int, input().split()))\n score[x - 1] += y\n from collections import deque\n\n option = deque()\n option.append(0)\n completed = [None] * n\n while option:\n before = option.pop()\n completed[before] = True\n for i in tree[before]:\n if completed[i] == None:\n score[i] += score[before]\n option.append(i)\n print((*score))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.4516129032,"diff":["+import sys","+","+input = sys.stdin.readline","+","+","- import sys","-","- input = sys.stdin.readline","- from collections import deque, defaultdict","-","- dic = defaultdict(list)","+ tree = [[] * n for i in range(n)]","+ score = [0] * n","- dic[x - 1].append(y - 1)","- dic[y - 1].append(x - 1)","- cnt = [0] * n","+ tree[x - 1].append(y - 1)","+ tree[y - 1].append(x - 1)","- cnt[x - 1] += y","- d = deque()","- d.append(0)","- completed = [False] * n","- while d:","- now = d.popleft()","- completed[now] = True","- for x in dic[now]:","- if completed[x] == False:","- cnt[x] += cnt[now]","- d.append(x)","- print((*cnt))","+ score[x - 1] += y","+ from collections import deque","+","+ option = deque()","+ option.append(0)","+ completed = [None] * n","+ while option:","+ before = option.pop()","+ completed[before] = True","+ for i in tree[before]:","+ if completed[i] == None:","+ score[i] += score[before]","+ option.append(i)","+ print((*score))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0374560017,"measured_runtime_v1":0.0472895606,"runtime_lift":0.7920564545,"key":["s735418228","s776834023"]} +{"user_id":"u614550445","problem_id":"p03275","language":"python","submission_id_v0":"s132503431","submission_id_v1":"s735002940","cpu_time_v0":1267,"cpu_time_v1":788,"memory_v0":108388,"memory_v1":86372,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":37.81,"input":"N = int(eval(input()))\n\nA = [int(_) for _ in input().split()]\n\n\n\n\n\nclass BIT:\n\n # index 1~\n\n def __init__(self, n):\n\n self.size = n\n\n self.tree = [0] * (n + 1)\n\n\n\n def sum(self, i):\n\n s = 0\n\n while i > 0:\n\n s += self.tree[i]\n\n i -= i & -i\n\n return s\n\n\n\n def add(self, i, x):\n\n while i <= self.size:\n\n self.tree[i] += x\n\n i += i & -i\n\n\n\n\n\nM = N * (N + 1) \/\/ 2 # (N+1)C2\n\nsorted_A = sorted(A)\n\n\n\ninf = 0\n\nsup = max(A) + 1\n\nwhile sup - inf > 1:\n\n x = (sup + inf) \/\/ 2\n\n\n\n S = [0] * (N + 1)\n\n for i in range(N):\n\n if A[i] >= x:\n\n S[i + 1] = S[i] + 1\n\n else:\n\n S[i + 1] = S[i] - 1\n\n\n\n min_value = min(S)\n\n for i in range(N + 1):\n\n S[i] += abs(min_value) + 1\n\n\n\n forward = 0\n\n bit = BIT(max(S))\n\n for s in S:\n\n forward += bit.sum(s)\n\n bit.add(s, 1)\n\n\n\n if forward >= (M + 1) \/\/ 2:\n\n inf = x\n\n else:\n\n sup = x\n\n\n\nfor a in reversed(sorted_A):\n\n if inf >= a:\n\n print(a)\n\n break\n","target":"N = int(eval(input()))\n\nA = [int(_) for _ in input().split()]\n\n\n\nclass BIT:\n\n # index 1~\n\n def __init__(self, n):\n\n self.size = n\n\n self.tree = [0] * (n + 1)\n\n\n\n def sum(self, i):\n\n s = 0\n\n while i > 0:\n\n s += self.tree[i]\n\n i -= i & -i\n\n return s\n\n\n\n def add(self, i, x):\n\n while i <= self.size:\n\n self.tree[i] += x\n\n i += i & -i\n\n\n\ndef sub_problem(x):\n\n S = [0] * (N + 1)\n\n for i in range(N):\n\n S[i + 1] = S[i] + 1 if A[i] >= x else S[i] - 1\n\n\n\n geta = abs(min(S)) + 1\n\n for i in range(N + 1):\n\n S[i] += geta\n\n\n\n forward = 0\n\n bit = BIT(max(S))\n\n for s in S:\n\n forward += bit.sum(s)\n\n bit.add(s, 1)\n\n\n\n return forward >= (M + 1) \/\/ 2\n\n\n\nM = N * (N + 1) \/\/ 2 # (N+1)C2\n\nsorted_A = sorted(A)\n\n\n\ninf = 0\n\nsup = N\n\nwhile sup - inf > 1:\n\n mid = (sup + inf) \/\/ 2\n\n x = sorted_A[mid]\n\n\n\n if sub_problem(x):\n\n inf = mid\n\n else:\n\n sup = mid\n\n\n\nprint((sorted_A[inf]))\n","code_v0_loc":57,"code_v1_loc":53,"code_v0_num_chars":1080,"code_v1_num_chars":1029,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [int(_) for _ in input().split()]\n\n\nclass BIT:\n # index 1~\n def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n\n def sum(self, i):\n s = 0\n while i > 0:\n s += self.tree[i]\n i -= i & -i\n return s\n\n def add(self, i, x):\n while i <= self.size:\n self.tree[i] += x\n i += i & -i\n\n\nM = N * (N + 1) \/\/ 2 # (N+1)C2\nsorted_A = sorted(A)\ninf = 0\nsup = max(A) + 1\nwhile sup - inf > 1:\n x = (sup + inf) \/\/ 2\n S = [0] * (N + 1)\n for i in range(N):\n if A[i] >= x:\n S[i + 1] = S[i] + 1\n else:\n S[i + 1] = S[i] - 1\n min_value = min(S)\n for i in range(N + 1):\n S[i] += abs(min_value) + 1\n forward = 0\n bit = BIT(max(S))\n for s in S:\n forward += bit.sum(s)\n bit.add(s, 1)\n if forward >= (M + 1) \/\/ 2:\n inf = x\n else:\n sup = x\nfor a in reversed(sorted_A):\n if inf >= a:\n print(a)\n break\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(_) for _ in input().split()]\n\n\nclass BIT:\n # index 1~\n def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n\n def sum(self, i):\n s = 0\n while i > 0:\n s += self.tree[i]\n i -= i & -i\n return s\n\n def add(self, i, x):\n while i <= self.size:\n self.tree[i] += x\n i += i & -i\n\n\ndef sub_problem(x):\n S = [0] * (N + 1)\n for i in range(N):\n S[i + 1] = S[i] + 1 if A[i] >= x else S[i] - 1\n geta = abs(min(S)) + 1\n for i in range(N + 1):\n S[i] += geta\n forward = 0\n bit = BIT(max(S))\n for s in S:\n forward += bit.sum(s)\n bit.add(s, 1)\n return forward >= (M + 1) \/\/ 2\n\n\nM = N * (N + 1) \/\/ 2 # (N+1)C2\nsorted_A = sorted(A)\ninf = 0\nsup = N\nwhile sup - inf > 1:\n mid = (sup + inf) \/\/ 2\n x = sorted_A[mid]\n if sub_problem(x):\n inf = mid\n else:\n sup = mid\nprint((sorted_A[inf]))\n","code_same":false,"relative_loc_diff_percent":7.0175438596,"diff":["-M = N * (N + 1) \/\/ 2 # (N+1)C2","-sorted_A = sorted(A)","-inf = 0","-sup = max(A) + 1","-while sup - inf > 1:","- x = (sup + inf) \/\/ 2","+def sub_problem(x):","- if A[i] >= x:","- S[i + 1] = S[i] + 1","- else:","- S[i + 1] = S[i] - 1","- min_value = min(S)","+ S[i + 1] = S[i] + 1 if A[i] >= x else S[i] - 1","+ geta = abs(min(S)) + 1","- S[i] += abs(min_value) + 1","+ S[i] += geta","- if forward >= (M + 1) \/\/ 2:","- inf = x","+ return forward >= (M + 1) \/\/ 2","+","+","+M = N * (N + 1) \/\/ 2 # (N+1)C2","+sorted_A = sorted(A)","+inf = 0","+sup = N","+while sup - inf > 1:","+ mid = (sup + inf) \/\/ 2","+ x = sorted_A[mid]","+ if sub_problem(x):","+ inf = mid","- sup = x","-for a in reversed(sorted_A):","- if inf >= a:","- print(a)","- break","+ sup = mid","+print((sorted_A[inf]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.044505187,"measured_runtime_v1":0.0784419954,"runtime_lift":0.5673642902,"key":["s132503431","s735002940"]} +{"user_id":"u467736898","problem_id":"p03585","language":"python","submission_id_v0":"s449882237","submission_id_v1":"s231123351","cpu_time_v0":4625,"cpu_time_v1":792,"memory_v0":225236,"memory_v1":43556,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":82.88,"input":"class Bit:\n\n # \u53c2\u80031: http:\/\/hos.ac\/slides\/20140319_bit.pdf\n\n # \u53c2\u80032: https:\/\/atcoder.jp\/contests\/arc046\/submissions\/6264201\n\n # \u691c\u8a3c: https:\/\/atcoder.jp\/contests\/arc046\/submissions\/7435621\n\n # values \u306e 0 \u756a\u76ee\u306f\u4f7f\u308f\u306a\u3044\n\n # len(values) \u3092 2 \u51aa +1 \u306b\u3059\u308b\u3053\u3068\u3067\u4e8c\u5206\u63a2\u7d22\u306e\u6761\u4ef6\u3092\u6e1b\u3089\u3059\n\n def __init__(self, a):\n\n if hasattr(a, \"__iter__\"):\n\n le = len(a)\n\n self.n = 1 << le.bit_length() # le \u3092\u8d85\u3048\u308b\u6700\u5c0f\u306e 2 \u51aa\n\n self.values = values = [0] * (self.n + 1)\n\n values[1:le + 1] = a[:]\n\n for i in range(1, self.n):\n\n values[i + (i & -i)] += values[i]\n\n elif isinstance(a, int):\n\n self.n = 1 << a.bit_length()\n\n self.values = [0] * (self.n + 1)\n\n else:\n\n raise TypeError\n\n\n\n def add(self, i, val):\n\n n, values = self.n, self.values\n\n while i <= n:\n\n values[i] += val\n\n i += i & -i\n\n\n\n def sum(self, i): # (0, i]\n\n values = self.values\n\n res = 0\n\n while i > 0:\n\n res += values[i]\n\n i -= i & -i\n\n return res\n\n\n\n def bisect_left(self, v): # self.sum(i) \u304c v \u4ee5\u4e0a\u306b\u306a\u308b\u6700\u5c0f\u306e i\n\n n, values = self.n, self.values\n\n if v > values[n]:\n\n return None\n\n i, step = 0, n >> 1\n\n while step:\n\n if values[i + step] < v:\n\n i += step\n\n v -= values[i]\n\n step >>= 1\n\n return i + 1\n\n\n\ndef inversion_number(arr):\n\n n = len(arr)\n\n arr = sorted(list(range(n)), key=lambda x: arr[x])\n\n bit = Bit(n)\n\n res = n * (n-1) >> 1\n\n for val in arr:\n\n res -= bit.sum(val+1)\n\n bit.add(val+1, 1)\n\n return res\n\n\n\nN = int(eval(input()))\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\nA, B, C = list(zip(*ABC))\n\nth = N*(N-1)\/\/2 \/\/ 2 + 1\n\ndef solve(A, B, C):\n\n # y = (-Ax+C) \/ B\n\n if N < 100:\n\n ok = -1e10\n\n ng = 1e10\n\n n_iteration = 70\n\n else:\n\n ok = -1e4\n\n ng = 1e4\n\n n_iteration = 46\n\n A, B, C = list(zip(*sorted(zip(A, B, C), key=lambda x: -x[0]\/x[1])))\n\n for _ in range(n_iteration):\n\n x = (ok+ng) * 0.5\n\n Y = [(-a*x+c)\/b for a, b, c in zip(A, B, C)]\n\n inv_num = inversion_number(Y)\n\n if inv_num >= th:\n\n ok = x\n\n else:\n\n ng = x\n\n return ok\n\nprint((solve(A, B, C), solve(B, A, C)))\n","target":"import os\n\nimport sys\n\nimport numpy as np\n\n\n\n# >>> binary indexed tree >>>\n\n# \u5fc5\u8981\u306a\u8981\u7d20\u6570+1 \u306e\u9577\u3055\u306e ndarray \u306e 1 \u8981\u7d20\u76ee\u4ee5\u964d\u3092\u4f7f\u3046\n\n\n\ndef bit_sum(bit, i): # [bit_sum, \"i8(i8[:],i8)\"],\n\n # (0, i]\n\n res = 0\n\n while i:\n\n res += bit[i]\n\n i -= i & -i\n\n return res\n\n\n\ndef bit_add(bit, i, val): # [bit_add, \"void(i8[:],i8,i8)\"],\n\n n = len(bit)\n\n while i < n:\n\n bit[i] += val\n\n i += i & -i\n\n\n\n# <<< binary indexed tree <<<\n\n\n\n\n\ndef inversion_number(arr): # [inversion_number, \"i8(f8[:])\"],\n\n # \u8ee2\u5012\u6570\n\n n = len(arr)\n\n arr = np.argsort(arr) + 1\n\n bit = np.zeros(n+1, dtype=np.int64)\n\n res = n * (n-1) >> 1\n\n for val in arr:\n\n res -= bit_sum(bit, val)\n\n bit_add(bit, val, 1)\n\n return res\n\n\n\n\n\n# >>> numba compile >>\n\n\n\nnumba_config = [\n\n [bit_sum, \"i8(i8[:],i8)\"],\n\n [bit_add, \"void(i8[:],i8,i8)\"],\n\n [inversion_number, \"i8(f8[:])\"],\n\n]\n\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n\n from numba import njit\n\n from numba.pycc import CC\n\n cc = CC(\"my_module\")\n\n for func, signature in numba_config:\n\n vars()[func.__name__] = njit(signature)(func)\n\n cc.export(func.__name__, signature)(func)\n\n cc.compile()\n\n exit()\n\nelif os.name == \"posix\":\n\n exec(f\"from my_module import {','.join(func.__name__ for func, _ in numba_config)}\")\n\nelse:\n\n from numba import njit\n\n for func, signature in numba_config:\n\n vars()[func.__name__] = njit(signature, cache=True)(func)\n\n print(\"compiled\", file=sys.stderr)\n\n\n\n# <<< numba compile <<<\n\n\n\n\n\nN = int(input())\n\nABC = [list(map(int, input().split())) for _ in range(N)]\n\nA, B, C = zip(*ABC)\n\nth = N*(N-1)\/\/2 \/\/ 2 + 1\n\ndef solve(A, B, C):\n\n # y = (-Ax+C) \/ B\n\n if N < 100:\n\n ok = -1e10\n\n ng = 1e10\n\n n_iteration = 70\n\n else:\n\n ok = -1e4\n\n ng = 1e4\n\n n_iteration = 46\n\n A, B, C = zip(*sorted(zip(A, B, C), key=lambda x: -x[0]\/x[1]))\n\n A = np.array(A)\n\n B = np.array(B)\n\n C = np.array(C)\n\n for _ in range(n_iteration):\n\n x = (ok+ng) * 0.5\n\n Y = (-A*x+C) \/ B\n\n inv_num = inversion_number(Y)\n\n if inv_num >= th:\n\n ok = x\n\n else:\n\n ng = x\n\n return ok\n\n\n\nprint(solve(A, B, C), solve(B, A, C))\n","code_v0_loc":81,"code_v1_loc":92,"code_v0_num_chars":2363,"code_v1_num_chars":2248,"code_v0_no_empty_lines":"class Bit:\n # \u53c2\u80031: http:\/\/hos.ac\/slides\/20140319_bit.pdf\n # \u53c2\u80032: https:\/\/atcoder.jp\/contests\/arc046\/submissions\/6264201\n # \u691c\u8a3c: https:\/\/atcoder.jp\/contests\/arc046\/submissions\/7435621\n # values \u306e 0 \u756a\u76ee\u306f\u4f7f\u308f\u306a\u3044\n # len(values) \u3092 2 \u51aa +1 \u306b\u3059\u308b\u3053\u3068\u3067\u4e8c\u5206\u63a2\u7d22\u306e\u6761\u4ef6\u3092\u6e1b\u3089\u3059\n def __init__(self, a):\n if hasattr(a, \"__iter__\"):\n le = len(a)\n self.n = 1 << le.bit_length() # le \u3092\u8d85\u3048\u308b\u6700\u5c0f\u306e 2 \u51aa\n self.values = values = [0] * (self.n + 1)\n values[1 : le + 1] = a[:]\n for i in range(1, self.n):\n values[i + (i & -i)] += values[i]\n elif isinstance(a, int):\n self.n = 1 << a.bit_length()\n self.values = [0] * (self.n + 1)\n else:\n raise TypeError\n\n def add(self, i, val):\n n, values = self.n, self.values\n while i <= n:\n values[i] += val\n i += i & -i\n\n def sum(self, i): # (0, i]\n values = self.values\n res = 0\n while i > 0:\n res += values[i]\n i -= i & -i\n return res\n\n def bisect_left(self, v): # self.sum(i) \u304c v \u4ee5\u4e0a\u306b\u306a\u308b\u6700\u5c0f\u306e i\n n, values = self.n, self.values\n if v > values[n]:\n return None\n i, step = 0, n >> 1\n while step:\n if values[i + step] < v:\n i += step\n v -= values[i]\n step >>= 1\n return i + 1\n\n\ndef inversion_number(arr):\n n = len(arr)\n arr = sorted(list(range(n)), key=lambda x: arr[x])\n bit = Bit(n)\n res = n * (n - 1) >> 1\n for val in arr:\n res -= bit.sum(val + 1)\n bit.add(val + 1, 1)\n return res\n\n\nN = int(eval(input()))\nABC = [list(map(int, input().split())) for _ in range(N)]\nA, B, C = list(zip(*ABC))\nth = N * (N - 1) \/\/ 2 \/\/ 2 + 1\n\n\ndef solve(A, B, C):\n # y = (-Ax+C) \/ B\n if N < 100:\n ok = -1e10\n ng = 1e10\n n_iteration = 70\n else:\n ok = -1e4\n ng = 1e4\n n_iteration = 46\n A, B, C = list(zip(*sorted(zip(A, B, C), key=lambda x: -x[0] \/ x[1])))\n for _ in range(n_iteration):\n x = (ok + ng) * 0.5\n Y = [(-a * x + c) \/ b for a, b, c in zip(A, B, C)]\n inv_num = inversion_number(Y)\n if inv_num >= th:\n ok = x\n else:\n ng = x\n return ok\n\n\nprint((solve(A, B, C), solve(B, A, C)))\n","code_v1_no_empty_lines":"import os\nimport sys\nimport numpy as np\n\n# >>> binary indexed tree >>>\n# \u5fc5\u8981\u306a\u8981\u7d20\u6570+1 \u306e\u9577\u3055\u306e ndarray \u306e 1 \u8981\u7d20\u76ee\u4ee5\u964d\u3092\u4f7f\u3046\ndef bit_sum(bit, i): # [bit_sum, \"i8(i8[:],i8)\"],\n # (0, i]\n res = 0\n while i:\n res += bit[i]\n i -= i & -i\n return res\n\n\ndef bit_add(bit, i, val): # [bit_add, \"void(i8[:],i8,i8)\"],\n n = len(bit)\n while i < n:\n bit[i] += val\n i += i & -i\n\n\n# <<< binary indexed tree <<<\ndef inversion_number(arr): # [inversion_number, \"i8(f8[:])\"],\n # \u8ee2\u5012\u6570\n n = len(arr)\n arr = np.argsort(arr) + 1\n bit = np.zeros(n + 1, dtype=np.int64)\n res = n * (n - 1) >> 1\n for val in arr:\n res -= bit_sum(bit, val)\n bit_add(bit, val, 1)\n return res\n\n\n# >>> numba compile >>\nnumba_config = [\n [bit_sum, \"i8(i8[:],i8)\"],\n [bit_add, \"void(i8[:],i8,i8)\"],\n [inversion_number, \"i8(f8[:])\"],\n]\nif sys.argv[-1] == \"ONLINE_JUDGE\":\n from numba import njit\n from numba.pycc import CC\n\n cc = CC(\"my_module\")\n for func, signature in numba_config:\n vars()[func.__name__] = njit(signature)(func)\n cc.export(func.__name__, signature)(func)\n cc.compile()\n exit()\nelif os.name == \"posix\":\n exec(f\"from my_module import {','.join(func.__name__ for func, _ in numba_config)}\")\nelse:\n from numba import njit\n\n for func, signature in numba_config:\n vars()[func.__name__] = njit(signature, cache=True)(func)\n print(\"compiled\", file=sys.stderr)\n# <<< numba compile <<<\nN = int(input())\nABC = [list(map(int, input().split())) for _ in range(N)]\nA, B, C = zip(*ABC)\nth = N * (N - 1) \/\/ 2 \/\/ 2 + 1\n\n\ndef solve(A, B, C):\n # y = (-Ax+C) \/ B\n if N < 100:\n ok = -1e10\n ng = 1e10\n n_iteration = 70\n else:\n ok = -1e4\n ng = 1e4\n n_iteration = 46\n A, B, C = zip(*sorted(zip(A, B, C), key=lambda x: -x[0] \/ x[1]))\n A = np.array(A)\n B = np.array(B)\n C = np.array(C)\n for _ in range(n_iteration):\n x = (ok + ng) * 0.5\n Y = (-A * x + C) \/ B\n inv_num = inversion_number(Y)\n if inv_num >= th:\n ok = x\n else:\n ng = x\n return ok\n\n\nprint(solve(A, B, C), solve(B, A, C))\n","code_same":false,"relative_loc_diff_percent":11.9565217391,"diff":["-class Bit:","- # \u53c2\u80031: http:\/\/hos.ac\/slides\/20140319_bit.pdf","- # \u53c2\u80032: https:\/\/atcoder.jp\/contests\/arc046\/submissions\/6264201","- # \u691c\u8a3c: https:\/\/atcoder.jp\/contests\/arc046\/submissions\/7435621","- # values \u306e 0 \u756a\u76ee\u306f\u4f7f\u308f\u306a\u3044","- # len(values) \u3092 2 \u51aa +1 \u306b\u3059\u308b\u3053\u3068\u3067\u4e8c\u5206\u63a2\u7d22\u306e\u6761\u4ef6\u3092\u6e1b\u3089\u3059","- def __init__(self, a):","- if hasattr(a, \"__iter__\"):","- le = len(a)","- self.n = 1 << le.bit_length() # le \u3092\u8d85\u3048\u308b\u6700\u5c0f\u306e 2 \u51aa","- self.values = values = [0] * (self.n + 1)","- values[1 : le + 1] = a[:]","- for i in range(1, self.n):","- values[i + (i & -i)] += values[i]","- elif isinstance(a, int):","- self.n = 1 << a.bit_length()","- self.values = [0] * (self.n + 1)","- else:","- raise TypeError","+import os","+import sys","+import numpy as np","- def add(self, i, val):","- n, values = self.n, self.values","- while i <= n:","- values[i] += val","- i += i & -i","-","- def sum(self, i): # (0, i]","- values = self.values","- res = 0","- while i > 0:","- res += values[i]","- i -= i & -i","- return res","-","- def bisect_left(self, v): # self.sum(i) \u304c v \u4ee5\u4e0a\u306b\u306a\u308b\u6700\u5c0f\u306e i","- n, values = self.n, self.values","- if v > values[n]:","- return None","- i, step = 0, n >> 1","- while step:","- if values[i + step] < v:","- i += step","- v -= values[i]","- step >>= 1","- return i + 1","-","-","-def inversion_number(arr):","- n = len(arr)","- arr = sorted(list(range(n)), key=lambda x: arr[x])","- bit = Bit(n)","- res = n * (n - 1) >> 1","- for val in arr:","- res -= bit.sum(val + 1)","- bit.add(val + 1, 1)","+# >>> binary indexed tree >>>","+# \u5fc5\u8981\u306a\u8981\u7d20\u6570+1 \u306e\u9577\u3055\u306e ndarray \u306e 1 \u8981\u7d20\u76ee\u4ee5\u964d\u3092\u4f7f\u3046","+def bit_sum(bit, i): # [bit_sum, \"i8(i8[:],i8)\"],","+ # (0, i]","+ res = 0","+ while i:","+ res += bit[i]","+ i -= i & -i","-N = int(eval(input()))","+def bit_add(bit, i, val): # [bit_add, \"void(i8[:],i8,i8)\"],","+ n = len(bit)","+ while i < n:","+ bit[i] += val","+ i += i & -i","+","+","+# <<< binary indexed tree <<<","+def inversion_number(arr): # [inversion_number, \"i8(f8[:])\"],","+ # \u8ee2\u5012\u6570","+ n = len(arr)","+ arr = np.argsort(arr) + 1","+ bit = np.zeros(n + 1, dtype=np.int64)","+ res = n * (n - 1) >> 1","+ for val in arr:","+ res -= bit_sum(bit, val)","+ bit_add(bit, val, 1)","+ return res","+","+","+# >>> numba compile >>","+numba_config = [","+ [bit_sum, \"i8(i8[:],i8)\"],","+ [bit_add, \"void(i8[:],i8,i8)\"],","+ [inversion_number, \"i8(f8[:])\"],","+]","+if sys.argv[-1] == \"ONLINE_JUDGE\":","+ from numba import njit","+ from numba.pycc import CC","+","+ cc = CC(\"my_module\")","+ for func, signature in numba_config:","+ vars()[func.__name__] = njit(signature)(func)","+ cc.export(func.__name__, signature)(func)","+ cc.compile()","+ exit()","+elif os.name == \"posix\":","+ exec(f\"from my_module import {','.join(func.__name__ for func, _ in numba_config)}\")","+else:","+ from numba import njit","+","+ for func, signature in numba_config:","+ vars()[func.__name__] = njit(signature, cache=True)(func)","+ print(\"compiled\", file=sys.stderr)","+# <<< numba compile <<<","+N = int(input())","-A, B, C = list(zip(*ABC))","+A, B, C = zip(*ABC)","- A, B, C = list(zip(*sorted(zip(A, B, C), key=lambda x: -x[0] \/ x[1])))","+ A, B, C = zip(*sorted(zip(A, B, C), key=lambda x: -x[0] \/ x[1]))","+ A = np.array(A)","+ B = np.array(B)","+ C = np.array(C)","- Y = [(-a * x + c) \/ b for a, b, c in zip(A, B, C)]","+ Y = (-A * x + C) \/ B","-print((solve(A, B, C), solve(B, A, C)))","+print(solve(A, B, C), solve(B, A, C))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0377900267,"measured_runtime_v1":0.1973371797,"runtime_lift":0.1914997809,"key":["s449882237","s231123351"]} +{"user_id":"u688055251","problem_id":"p03280","language":"python","submission_id_v0":"s128956246","submission_id_v1":"s837015097","cpu_time_v0":24,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.17,"input":"import sys\n\n\n\n# \u95a2\u6570 solve \u306f\uff0c\u3082\u3061\u308d\u3093\uff0c\u554f\u984c\u306b\u5fdc\u3058\u3066\u66f8\u304d\u63db\u3048\u308b\n\ndef solve(a, b):\n\n s=int(a)-1\n\n r=int(b)-1\n\n return s*r\n\n\n\n# \u3053\u3053\u304b\u3089\u4e0b\u306f\uff0c\u5165\u529b\u30fb\u51fa\u529b\u5f62\u5f0f\u304c\u540c\u3058\u3067\u3042\u308c\u3070\uff0c\u5909\u3048\u306a\u304f\u3066\u826f\u3044\uff0e\n\ndef readQuestion():\n\n line = sys.stdin.readline().rstrip()\n\n [str_a, str_b] = line.split(' ')\n\n return (int(str_a), int(str_b))\n\n\n\ndef main():\n\n a, b = readQuestion()\n\n answer = solve(a, b)\n\n print(answer)\n\n \n\nif __name__ == '__main__':\n\n main()","target":"import sys\n\n\n\ndef solve(a, b):\n\n # Uncomment the following if you want to check the input.\n\n # print('a =', a)\n\n # print('b =', b)\n\n s=int(a)-1\n\n r=int(b)-1\n\n return s*r\n\n\n\n\n\ndef readQuestion():\n\n ws = sys.stdin.readline().strip().split()\n\n a = int(ws[0])\n\n b = int(ws[1])\n\n return (a, b)\n\n\n\ndef main():\n\n print((solve(*readQuestion())))\n\n\n\n# Uncomment before submission\n\nmain()","code_v0_loc":21,"code_v1_loc":22,"code_v0_num_chars":416,"code_v1_num_chars":409,"code_v0_no_empty_lines":"import sys\n\n# \u95a2\u6570 solve \u306f\uff0c\u3082\u3061\u308d\u3093\uff0c\u554f\u984c\u306b\u5fdc\u3058\u3066\u66f8\u304d\u63db\u3048\u308b\ndef solve(a, b):\n s = int(a) - 1\n r = int(b) - 1\n return s * r\n\n\n# \u3053\u3053\u304b\u3089\u4e0b\u306f\uff0c\u5165\u529b\u30fb\u51fa\u529b\u5f62\u5f0f\u304c\u540c\u3058\u3067\u3042\u308c\u3070\uff0c\u5909\u3048\u306a\u304f\u3066\u826f\u3044\uff0e\ndef readQuestion():\n line = sys.stdin.readline().rstrip()\n [str_a, str_b] = line.split(\" \")\n return (int(str_a), int(str_b))\n\n\ndef main():\n a, b = readQuestion()\n answer = solve(a, b)\n print(answer)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef solve(a, b):\n # Uncomment the following if you want to check the input.\n # print('a =', a)\n # print('b =', b)\n s = int(a) - 1\n r = int(b) - 1\n return s * r\n\n\ndef readQuestion():\n ws = sys.stdin.readline().strip().split()\n a = int(ws[0])\n b = int(ws[1])\n return (a, b)\n\n\ndef main():\n print((solve(*readQuestion())))\n\n\n# Uncomment before submission\nmain()\n","code_same":false,"relative_loc_diff_percent":4.5454545455,"diff":["-# \u95a2\u6570 solve \u306f\uff0c\u3082\u3061\u308d\u3093\uff0c\u554f\u984c\u306b\u5fdc\u3058\u3066\u66f8\u304d\u63db\u3048\u308b","+","+ # Uncomment the following if you want to check the input.","+ # print('a =', a)","+ # print('b =', b)","-# \u3053\u3053\u304b\u3089\u4e0b\u306f\uff0c\u5165\u529b\u30fb\u51fa\u529b\u5f62\u5f0f\u304c\u540c\u3058\u3067\u3042\u308c\u3070\uff0c\u5909\u3048\u306a\u304f\u3066\u826f\u3044\uff0e","- line = sys.stdin.readline().rstrip()","- [str_a, str_b] = line.split(\" \")","- return (int(str_a), int(str_b))","+ ws = sys.stdin.readline().strip().split()","+ a = int(ws[0])","+ b = int(ws[1])","+ return (a, b)","- a, b = readQuestion()","- answer = solve(a, b)","- print(answer)","+ print((solve(*readQuestion())))","-if __name__ == \"__main__\":","- main()","+# Uncomment before submission","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373057044,"measured_runtime_v1":0.0375822047,"runtime_lift":0.9926427883,"key":["s128956246","s837015097"]} +{"user_id":"u546285759","problem_id":"p00009","language":"python","submission_id_v0":"s729914408","submission_id_v1":"s306359879","cpu_time_v0":4330,"cpu_time_v1":640,"memory_v0":20964,"memory_v1":52708,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.22,"input":"primes = [0, 0] + [1] * 999999\n\nfor i in range(2, 1000):\n\n if primes[i]:\n\n for j in range(i*i, 1000000, i):\n\n primes[j] = 0\n\n\n\nwhile True:\n\n try:\n\n n = int(eval(input()))\n\n except:\n\n break\n\n ans = 0\n\n while n > 0:\n\n ans += primes[n]\n\n n -= 1\n\n print(ans)\n\n\n","target":"primes = [0, 0] + [1] * 999999\n\nfor i in range(2, 1000):\n\n if primes[i]:\n\n for j in range(i*i, 1000000, i):\n\n primes[j] = 0\n\n\n\nanswer = [0] * 1000000\n\nfor i in range(2, 1000000):\n\n answer[i] += primes[i] + answer[i-1]\n\n\n\nwhile True:\n\n try:\n\n n = int(eval(input()))\n\n except:\n\n break\n\n print((answer[n]))\n\n\n","code_v0_loc":17,"code_v1_loc":17,"code_v0_num_chars":315,"code_v1_num_chars":345,"code_v0_no_empty_lines":"primes = [0, 0] + [1] * 999999\nfor i in range(2, 1000):\n if primes[i]:\n for j in range(i * i, 1000000, i):\n primes[j] = 0\nwhile True:\n try:\n n = int(eval(input()))\n except:\n break\n ans = 0\n while n > 0:\n ans += primes[n]\n n -= 1\n print(ans)\n","code_v1_no_empty_lines":"primes = [0, 0] + [1] * 999999\nfor i in range(2, 1000):\n if primes[i]:\n for j in range(i * i, 1000000, i):\n primes[j] = 0\nanswer = [0] * 1000000\nfor i in range(2, 1000000):\n answer[i] += primes[i] + answer[i - 1]\nwhile True:\n try:\n n = int(eval(input()))\n except:\n break\n print((answer[n]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+answer = [0] * 1000000","+for i in range(2, 1000000):","+ answer[i] += primes[i] + answer[i - 1]","- ans = 0","- while n > 0:","- ans += primes[n]","- n -= 1","- print(ans)","+ print((answer[n]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.9712464113,"measured_runtime_v1":1.0484078546,"runtime_lift":0.9264013114,"key":["s729914408","s306359879"]} +{"user_id":"u693134887","problem_id":"p03162","language":"python","submission_id_v0":"s699373137","submission_id_v1":"s315079273","cpu_time_v0":532,"cpu_time_v1":457,"memory_v0":32408,"memory_v1":20540,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.1,"input":"n = int(eval(input()))\n\nls = [(0,0,0)]\n\nfor _ in range(n):\n\n a,b,c=list(map(int, input().split()))\n\n ls.append((a,b,c))\n\n\n\ndpa = [0]*(n+1)\n\ndpb = [0]*(n+1)\n\ndpc = [0]*(n+1)\n\n\n\nfor x in range(1,n+1):\n\n a,b,c = ls[x]\n\n dpa[x] = max(dpc[x-1]+a,dpb[x-1]+a)\n\n dpb[x] = max(dpa[x-1]+b,dpc[x-1]+b)\n\n dpc[x] = max(dpa[x-1]+c,dpb[x-1]+c)\n\n\n\n\n\nprint((max(dpa[-1],dpb[-1],dpc[-1])))\n","target":"n = int(eval(input()))\n\nls = [(0,0,0)]\n\nfor _ in range(n):\n\n a,b,c=list(map(int, input().split()))\n\n ls.append((a,b,c))\n\n\n\ndpa = 0\n\ndpb = 0\n\ndpc = 0\n\n\n\nfor x in range(1,n+1):\n\n a,b,c = ls[x]\n\n dpa, dpb, dpc = max(dpc+a,dpb+a), max(dpa+b,dpc+b), max(dpa+c,dpb+c)\n\n\n\n\n\nprint((max(dpa,dpb,dpc)))","code_v0_loc":18,"code_v1_loc":16,"code_v0_num_chars":376,"code_v1_num_chars":290,"code_v0_no_empty_lines":"n = int(eval(input()))\nls = [(0, 0, 0)]\nfor _ in range(n):\n a, b, c = list(map(int, input().split()))\n ls.append((a, b, c))\ndpa = [0] * (n + 1)\ndpb = [0] * (n + 1)\ndpc = [0] * (n + 1)\nfor x in range(1, n + 1):\n a, b, c = ls[x]\n dpa[x] = max(dpc[x - 1] + a, dpb[x - 1] + a)\n dpb[x] = max(dpa[x - 1] + b, dpc[x - 1] + b)\n dpc[x] = max(dpa[x - 1] + c, dpb[x - 1] + c)\nprint((max(dpa[-1], dpb[-1], dpc[-1])))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nls = [(0, 0, 0)]\nfor _ in range(n):\n a, b, c = list(map(int, input().split()))\n ls.append((a, b, c))\ndpa = 0\ndpb = 0\ndpc = 0\nfor x in range(1, n + 1):\n a, b, c = ls[x]\n dpa, dpb, dpc = max(dpc + a, dpb + a), max(dpa + b, dpc + b), max(dpa + c, dpb + c)\nprint((max(dpa, dpb, dpc)))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-dpa = [0] * (n + 1)","-dpb = [0] * (n + 1)","-dpc = [0] * (n + 1)","+dpa = 0","+dpb = 0","+dpc = 0","- dpa[x] = max(dpc[x - 1] + a, dpb[x - 1] + a)","- dpb[x] = max(dpa[x - 1] + b, dpc[x - 1] + b)","- dpc[x] = max(dpa[x - 1] + c, dpb[x - 1] + c)","-print((max(dpa[-1], dpb[-1], dpc[-1])))","+ dpa, dpb, dpc = max(dpc + a, dpb + a), max(dpa + b, dpc + b), max(dpa + c, dpb + c)","+print((max(dpa, dpb, dpc)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0077558472,"measured_runtime_v1":0.0390227249,"runtime_lift":0.1987520667,"key":["s699373137","s315079273"]} +{"user_id":"u782098901","problem_id":"p03485","language":"python","submission_id_v0":"s915866174","submission_id_v1":"s788958076","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"a, b = list(map(int, input().split()))\n\nprint(((a + b + 1) \/\/ 2))\n","target":"print(((sum(list(map(int, input().split()))) + 1) \/\/ 2))","code_v0_loc":2,"code_v1_loc":1,"code_v0_num_chars":58,"code_v1_num_chars":54,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nprint(((a + b + 1) \/\/ 2))\n","code_v1_no_empty_lines":"print(((sum(list(map(int, input().split()))) + 1) \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-a, b = list(map(int, input().split()))","-print(((a + b + 1) \/\/ 2))","+print(((sum(list(map(int, input().split()))) + 1) \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0450520039,"measured_runtime_v1":0.0435789108,"runtime_lift":1.0338028876,"key":["s915866174","s788958076"]} +{"user_id":"u472696272","problem_id":"p03107","language":"python","submission_id_v0":"s489942514","submission_id_v1":"s277317029","cpu_time_v0":56,"cpu_time_v1":42,"memory_v0":3956,"memory_v1":3956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"s = list(eval(input()))\n\nn = len(s)\n\nfor i in range(n):\n\n s[i] = int(s[i])\n\nones = sum(s)\n\nzeros = n-sum(s)\n\nprint((min(ones,zeros)*2))","target":"s = list(eval(input()))\n\n\n\ncount0 = 0\n\ncount1 = 0\n\nfor i in range(len(s)):\n\n if s[i]=='0': count0 += 1\n\n if s[i]=='1': count1 += 1\n\nprint((min(count0,count1)*2))\n","code_v0_loc":7,"code_v1_loc":8,"code_v0_num_chars":128,"code_v1_num_chars":156,"code_v0_no_empty_lines":"s = list(eval(input()))\nn = len(s)\nfor i in range(n):\n s[i] = int(s[i])\nones = sum(s)\nzeros = n - sum(s)\nprint((min(ones, zeros) * 2))\n","code_v1_no_empty_lines":"s = list(eval(input()))\ncount0 = 0\ncount1 = 0\nfor i in range(len(s)):\n if s[i] == \"0\":\n count0 += 1\n if s[i] == \"1\":\n count1 += 1\nprint((min(count0, count1) * 2))\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-n = len(s)","-for i in range(n):","- s[i] = int(s[i])","-ones = sum(s)","-zeros = n - sum(s)","-print((min(ones, zeros) * 2))","+count0 = 0","+count1 = 0","+for i in range(len(s)):","+ if s[i] == \"0\":","+ count0 += 1","+ if s[i] == \"1\":","+ count1 += 1","+print((min(count0, count1) * 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0356331859,"measured_runtime_v1":0.0418201296,"runtime_lift":0.8520582353,"key":["s489942514","s277317029"]} +{"user_id":"u682820318","problem_id":"p02552","language":"python","submission_id_v0":"s386792953","submission_id_v1":"s276092604","cpu_time_v0":33,"cpu_time_v1":27,"memory_v0":9072,"memory_v1":8920,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.18,"input":"#! \/usr\/bin\/python3\n\n\n\nx = int(eval(input()))\n\nif x:\n\n print((0))\n\nelse:\n\n print((1))\n","target":"#! \/usr\/bin\/python3\n\n\n\nx = int(eval(input()))\n\nprint((1-x))\n","code_v0_loc":7,"code_v1_loc":4,"code_v0_num_chars":82,"code_v1_num_chars":52,"code_v0_no_empty_lines":"#! \/usr\/bin\/python3\nx = int(eval(input()))\nif x:\n print((0))\nelse:\n print((1))\n","code_v1_no_empty_lines":"#! \/usr\/bin\/python3\nx = int(eval(input()))\nprint((1 - x))\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-if x:","- print((0))","-else:","- print((1))","+print((1 - x))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0482046962,"measured_runtime_v1":0.0480606357,"runtime_lift":1.0029974727,"key":["s386792953","s276092604"]} +{"user_id":"u282228874","problem_id":"p03261","language":"python","submission_id_v0":"s028776551","submission_id_v1":"s256632237","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"flag = 0\n\nn = int(eval(input()))\n\ns = [eval(input()) for i in range(n)]\n\nif len(set(s)) != n:\n\n flag = 1\n\nfor i in range(n-1):\n\n if s[i][-1] != s[i+1][0] :\n\n flag = 1\n\nif flag == 1:\n\n print('No')\n\nelse:\n\n print('Yes')","target":"n = int(eval(input()))\n\nW = [eval(input()) for i in range(n)]\n\nWW = set(W)\n\nflag = 1\n\nif len(WW) != n:\n\n print(\"No\")\n\n exit()\n\nelse:\n\n for i in range(n-1):\n\n if W[i][-1] != W[i+1][0]:\n\n flag = 0\n\n if flag == 1:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")","code_v0_loc":12,"code_v1_loc":15,"code_v0_num_chars":224,"code_v1_num_chars":282,"code_v0_no_empty_lines":"flag = 0\nn = int(eval(input()))\ns = [eval(input()) for i in range(n)]\nif len(set(s)) != n:\n flag = 1\nfor i in range(n - 1):\n if s[i][-1] != s[i + 1][0]:\n flag = 1\nif flag == 1:\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\nW = [eval(input()) for i in range(n)]\nWW = set(W)\nflag = 1\nif len(WW) != n:\n print(\"No\")\n exit()\nelse:\n for i in range(n - 1):\n if W[i][-1] != W[i + 1][0]:\n flag = 0\n if flag == 1:\n print(\"Yes\")\n else:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-flag = 0","-s = [eval(input()) for i in range(n)]","-if len(set(s)) != n:","- flag = 1","-for i in range(n - 1):","- if s[i][-1] != s[i + 1][0]:","- flag = 1","-if flag == 1:","+W = [eval(input()) for i in range(n)]","+WW = set(W)","+flag = 1","+if len(WW) != n:","+ exit()","- print(\"Yes\")","+ for i in range(n - 1):","+ if W[i][-1] != W[i + 1][0]:","+ flag = 0","+ if flag == 1:","+ print(\"Yes\")","+ else:","+ print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0472829361,"measured_runtime_v1":0.1476693785,"runtime_lift":0.3201945899,"key":["s028776551","s256632237"]} +{"user_id":"u260980560","problem_id":"p02362","language":"python","submission_id_v0":"s139498993","submission_id_v1":"s371546679","cpu_time_v0":520,"cpu_time_v1":30,"memory_v0":6560,"memory_v1":6568,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.23,"input":"V, E, r = list(map(int, input().split()))\n\ng = [[] for i in range(V)]\n\nfor i in range(E):\n\n s, t, d = list(map(int, input().split()))\n\n g[s].append((t, d))\n\n\n\nINF = 10**18\n\ndist = [INF] * V\n\ndist[r] = 0\n\nupdate = 1\n\nfor _ in range(V):\n\n update = 0\n\n for v, e in enumerate(g):\n\n for t, cost in e:\n\n if dist[v]!=INF and dist[v] + cost < dist[t]:\n\n dist[t] = dist[v] + cost\n\n update = 1\n\n if not update:\n\n break\n\nelse:\n\n print(\"NEGATIVE CYCLE\")\n\n exit(0)\n\nfor i in range(V):\n\n print(dist[i] if dist[i]=X1 and Y2>=Y1:\n\n ans = 0\n\nelif X2>=X1 and Y2=Y1:\n\n ans = 0\n\nelif X2= X1 and Y2 >= Y1:\n ans = 0\nelif X2 >= X1 and Y2 < Y1:\n ans = 0\nelif X2 < X1 and Y2 >= Y1:\n ans = 0\nelif X2 < X1 and Y2 < Y1:\n ans = (X1 - X2) * (Y1 - Y2)\nprint(ans)\n","code_v1_no_empty_lines":"W, H, N = list(map(int, input().split()))\nxl = 0\nxh = W\nyl = 0\nyh = H\nfor _ in range(N):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n xl = max(xl, x)\n elif a == 2:\n xh = min(xh, x)\n elif a == 3:\n yl = max(yl, y)\n elif a == 4:\n yh = min(yh, y)\ndx = max(0, xh - xl)\ndy = max(0, yh - yl)\nprint((dx * dy))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-X1 = W","-X2 = 0","-Y1 = H","-Y2 = 0","+xl = 0","+xh = W","+yl = 0","+yh = H","- X2 = max(X2, x)","+ xl = max(xl, x)","- X1 = min(X1, x)","+ xh = min(xh, x)","- Y2 = max(Y2, y)","+ yl = max(yl, y)","- Y1 = min(Y1, y)","-if X2 >= X1 and Y2 >= Y1:","- ans = 0","-elif X2 >= X1 and Y2 < Y1:","- ans = 0","-elif X2 < X1 and Y2 >= Y1:","- ans = 0","-elif X2 < X1 and Y2 < Y1:","- ans = (X1 - X2) * (Y1 - Y2)","-print(ans)","+ yh = min(yh, y)","+dx = max(0, xh - xl)","+dy = max(0, yh - yl)","+print((dx * dy))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0378477473,"measured_runtime_v1":0.0072809539,"runtime_lift":5.1981852758,"key":["s364694021","s026614887"]} +{"user_id":"u707124227","problem_id":"p02697","language":"python","submission_id_v0":"s920262581","submission_id_v1":"s244981488","cpu_time_v0":150,"cpu_time_v1":89,"memory_v0":28056,"memory_v1":9260,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.67,"input":"n,m=list(map(int,input().split()))\n\nif n%2==1:\n\n ab=[]\n\n a=n\/\/2\n\n b=n\/\/2+1\n\n ab.append([str(a),str(b)])\n\n for _ in range(m-1):\n\n a-=1\n\n b+=1\n\n ab.append([str(a),str(b)])\n\n for a,b in ab:\n\n print((a,b))\n\nelse:\n\n l=m\n\n ab=[]\n\n cnt=0\n\n for i in range(m):\n\n if i%2==0:\n\n a=i\/\/2+1\n\n b=a+l\n\n else:\n\n a=n-(i\/\/2+1)\n\n b=a-l\n\n ab.append([str(a),str(b)])\n\n l-=1\n\n for a,b in ab:\n\n print((a,b))","target":"n,m=list(map(int,input().split()))\n\nif n%2==1:\n\n for i in range(m):\n\n print((n-i-1,i+1))\n\nelse:\n\n cnt=1\n\n for i in range(m):\n\n if i%2==0:\n\n print((n\/\/4-i\/\/2,n\/\/4-i\/\/2+cnt))\n\n else:\n\n print((n\/\/2+n\/\/4-i\/\/2,n\/\/2+n\/\/4-i\/\/2+cnt))\n\n cnt+=1\n","code_v0_loc":27,"code_v1_loc":12,"code_v0_num_chars":430,"code_v1_num_chars":248,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nif n % 2 == 1:\n ab = []\n a = n \/\/ 2\n b = n \/\/ 2 + 1\n ab.append([str(a), str(b)])\n for _ in range(m - 1):\n a -= 1\n b += 1\n ab.append([str(a), str(b)])\n for a, b in ab:\n print((a, b))\nelse:\n l = m\n ab = []\n cnt = 0\n for i in range(m):\n if i % 2 == 0:\n a = i \/\/ 2 + 1\n b = a + l\n else:\n a = n - (i \/\/ 2 + 1)\n b = a - l\n ab.append([str(a), str(b)])\n l -= 1\n for a, b in ab:\n print((a, b))\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nif n % 2 == 1:\n for i in range(m):\n print((n - i - 1, i + 1))\nelse:\n cnt = 1\n for i in range(m):\n if i % 2 == 0:\n print((n \/\/ 4 - i \/\/ 2, n \/\/ 4 - i \/\/ 2 + cnt))\n else:\n print((n \/\/ 2 + n \/\/ 4 - i \/\/ 2, n \/\/ 2 + n \/\/ 4 - i \/\/ 2 + cnt))\n cnt += 1\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["- ab = []","- a = n \/\/ 2","- b = n \/\/ 2 + 1","- ab.append([str(a), str(b)])","- for _ in range(m - 1):","- a -= 1","- b += 1","- ab.append([str(a), str(b)])","- for a, b in ab:","- print((a, b))","+ for i in range(m):","+ print((n - i - 1, i + 1))","- l = m","- ab = []","- cnt = 0","+ cnt = 1","- a = i \/\/ 2 + 1","- b = a + l","+ print((n \/\/ 4 - i \/\/ 2, n \/\/ 4 - i \/\/ 2 + cnt))","- a = n - (i \/\/ 2 + 1)","- b = a - l","- ab.append([str(a), str(b)])","- l -= 1","- for a, b in ab:","- print((a, b))","+ print((n \/\/ 2 + n \/\/ 4 - i \/\/ 2, n \/\/ 2 + n \/\/ 4 - i \/\/ 2 + cnt))","+ cnt += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0367858823,"measured_runtime_v1":0.0345971962,"runtime_lift":1.0632619508,"key":["s920262581","s244981488"]} +{"user_id":"u506858457","problem_id":"p02629","language":"python","submission_id_v0":"s872746014","submission_id_v1":"s901662568","cpu_time_v0":30,"cpu_time_v1":26,"memory_v0":9128,"memory_v1":9196,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.33,"input":"def II(): return int(eval(input()))\n\nans=''\n\nN=II()\n\nN-=1\n\ni=1\n\nwhile N-26**i>=0: \n\n N-=26**i\n\n i+=1#26\u306e\u3079\u304d\u4e57\u500d\u3092\u5f15\u3044\u3066\u304b\u3089\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\n\nfor j in range(i):\n\n div,mod=divmod(N,26)\n\n ans+=chr(mod+ord('a'))\n\n N=div\n\nans=ans[::-1]\n\nprint(ans)","target":"def II(): return int(eval(input()))\n\nN=II()\n\nN-=1\n\ni=1\n\nans=''\n\nwhile N-26**i>=0:\n\n N-=26**i\n\n i+=1\n\nfor j in range(i):\n\n div,mod=divmod(N,26)\n\n ans+=chr(mod+ord('a'))\n\n N=div\n\nans=ans[::-1]\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":14,"code_v0_num_chars":224,"code_v1_num_chars":201,"code_v0_no_empty_lines":"def II():\n return int(eval(input()))\n\n\nans = \"\"\nN = II()\nN -= 1\ni = 1\nwhile N - 26**i >= 0:\n N -= 26**i\n i += 1 # 26\u306e\u3079\u304d\u4e57\u500d\u3092\u5f15\u3044\u3066\u304b\u3089\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\nfor j in range(i):\n div, mod = divmod(N, 26)\n ans += chr(mod + ord(\"a\"))\n N = div\nans = ans[::-1]\nprint(ans)\n","code_v1_no_empty_lines":"def II():\n return int(eval(input()))\n\n\nN = II()\nN -= 1\ni = 1\nans = \"\"\nwhile N - 26**i >= 0:\n N -= 26**i\n i += 1\nfor j in range(i):\n div, mod = divmod(N, 26)\n ans += chr(mod + ord(\"a\"))\n N = div\nans = ans[::-1]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-ans = \"\"","+ans = \"\"","- i += 1 # 26\u306e\u3079\u304d\u4e57\u500d\u3092\u5f15\u3044\u3066\u304b\u3089\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8","+ i += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0355839074,"measured_runtime_v1":0.0614946721,"runtime_lift":0.57865025,"key":["s872746014","s901662568"]} +{"user_id":"u852690916","problem_id":"p02954","language":"python","submission_id_v0":"s963200292","submission_id_v1":"s977846358","cpu_time_v0":241,"cpu_time_v1":94,"memory_v0":47684,"memory_v1":78644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":61.0,"input":"s=eval(input())\n\nn=len(s)\n\nans = [0]*n\n\n\n\nc=0\n\nfor i in range(n-1):\n\n if s[i]=='R':\n\n c+=1\n\n if s[i+1]=='L':\n\n ans[i]+=c\/\/2 + (c&1)\n\n ans[i+1]+=c\/\/2\n\n c=0\n\n\n\nc=0\n\nfor i in range(n-1,0,-1):\n\n if s[i]=='L':\n\n c+=1\n\n if s[i-1]=='R':\n\n ans[i]+=c\/\/2 + (c&1)\n\n ans[i-1]+=c\/\/2\n\n c=0\n\n\n\nprint((*ans))","target":"S = eval(input())\n\nN = len(S)\n\nans = [0] * N\n\nc = 0\n\nfor i in range(N):\n\n if S[i] == 'R':\n\n c += 1\n\n else:\n\n ans[i] += c \/\/ 2\n\n ans[i - 1] += c \/\/ 2 + c % 2\n\n c = 0\n\nfor i in range(N - 1, -1, -1):\n\n if S[i] == 'L':\n\n c += 1\n\n else:\n\n ans[i] += c \/\/ 2\n\n ans[i + 1] += c \/\/ 2 + c % 2\n\n c = 0\n\nprint((*ans))\n","code_v0_loc":23,"code_v1_loc":19,"code_v0_num_chars":384,"code_v1_num_chars":365,"code_v0_no_empty_lines":"s = eval(input())\nn = len(s)\nans = [0] * n\nc = 0\nfor i in range(n - 1):\n if s[i] == \"R\":\n c += 1\n if s[i + 1] == \"L\":\n ans[i] += c \/\/ 2 + (c & 1)\n ans[i + 1] += c \/\/ 2\n c = 0\nc = 0\nfor i in range(n - 1, 0, -1):\n if s[i] == \"L\":\n c += 1\n if s[i - 1] == \"R\":\n ans[i] += c \/\/ 2 + (c & 1)\n ans[i - 1] += c \/\/ 2\n c = 0\nprint((*ans))\n","code_v1_no_empty_lines":"S = eval(input())\nN = len(S)\nans = [0] * N\nc = 0\nfor i in range(N):\n if S[i] == \"R\":\n c += 1\n else:\n ans[i] += c \/\/ 2\n ans[i - 1] += c \/\/ 2 + c % 2\n c = 0\nfor i in range(N - 1, -1, -1):\n if S[i] == \"L\":\n c += 1\n else:\n ans[i] += c \/\/ 2\n ans[i + 1] += c \/\/ 2 + c % 2\n c = 0\nprint((*ans))\n","code_same":false,"relative_loc_diff_percent":17.3913043478,"diff":["-s = eval(input())","-n = len(s)","-ans = [0] * n","+S = eval(input())","+N = len(S)","+ans = [0] * N","-for i in range(n - 1):","- if s[i] == \"R\":","+for i in range(N):","+ if S[i] == \"R\":","- if s[i + 1] == \"L\":","- ans[i] += c \/\/ 2 + (c & 1)","- ans[i + 1] += c \/\/ 2","- c = 0","-c = 0","-for i in range(n - 1, 0, -1):","- if s[i] == \"L\":","+ else:","+ ans[i] += c \/\/ 2","+ ans[i - 1] += c \/\/ 2 + c % 2","+ c = 0","+for i in range(N - 1, -1, -1):","+ if S[i] == \"L\":","- if s[i - 1] == \"R\":","- ans[i] += c \/\/ 2 + (c & 1)","- ans[i - 1] += c \/\/ 2","- c = 0","+ else:","+ ans[i] += c \/\/ 2","+ ans[i + 1] += c \/\/ 2 + c % 2","+ c = 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372019672,"measured_runtime_v1":0.1183731518,"runtime_lift":0.3142770694,"key":["s963200292","s977846358"]} +{"user_id":"u312025627","problem_id":"p02732","language":"python","submission_id_v0":"s804629436","submission_id_v1":"s892212081","cpu_time_v0":286,"cpu_time_v1":220,"memory_v0":107820,"memory_v1":101020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.08,"input":"def main():\n\n N = int(eval(input()))\n\n A = [int(i) for i in input().split()]\n\n from collections import Counter\n\n c = Counter(A)\n\n ans = 0\n\n for v in list(c.values()):\n\n ans += v*(v-1)\/\/2\n\n\n\n for k in range(N):\n\n v = c[A[k]]\n\n diff = -v*(v-1)\/\/2 + (v-1)*(v-2)\/\/2\n\n print((ans + (diff if v != 1 else 0)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n N = int(eval(input()))\n\n A = [int(i) for i in input().split()]\n\n from collections import Counter\n\n c = Counter(A)\n\n ans = 0\n\n for v in list(c.values()):\n\n ans += v*(v-1)\/\/2\n\n\n\n for k in range(N):\n\n v = c[A[k]]\n\n diff = -v*(v-1)\/\/2 + (v-1)*(v-2)\/\/2\n\n print((ans + diff))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":17,"code_v1_loc":17,"code_v0_num_chars":382,"code_v1_num_chars":363,"code_v0_no_empty_lines":"def main():\n N = int(eval(input()))\n A = [int(i) for i in input().split()]\n from collections import Counter\n\n c = Counter(A)\n ans = 0\n for v in list(c.values()):\n ans += v * (v - 1) \/\/ 2\n for k in range(N):\n v = c[A[k]]\n diff = -v * (v - 1) \/\/ 2 + (v - 1) * (v - 2) \/\/ 2\n print((ans + (diff if v != 1 else 0)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n A = [int(i) for i in input().split()]\n from collections import Counter\n\n c = Counter(A)\n ans = 0\n for v in list(c.values()):\n ans += v * (v - 1) \/\/ 2\n for k in range(N):\n v = c[A[k]]\n diff = -v * (v - 1) \/\/ 2 + (v - 1) * (v - 2) \/\/ 2\n print((ans + diff))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- print((ans + (diff if v != 1 else 0)))","+ print((ans + diff))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0454476855,"measured_runtime_v1":0.0945826492,"runtime_lift":0.480507639,"key":["s804629436","s892212081"]} +{"user_id":"u345966487","problem_id":"p03363","language":"python","submission_id_v0":"s944970883","submission_id_v1":"s168481323","cpu_time_v0":247,"cpu_time_v1":226,"memory_v0":45060,"memory_v1":45048,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.5,"input":"import sys\n\nfrom collections import Counter\n\n\n\nsys.setrecursionlimit(10 ** 8)\n\nini = lambda: int(sys.stdin.readline())\n\ninl = lambda: [int(x) for x in sys.stdin.readline().split()]\n\nins = lambda: sys.stdin.readline().rstrip()\n\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\n\n\n\nN = ini()\n\nA = inl()\n\n\n\n\n\ndef solve():\n\n cum = [0] * (N + 1)\n\n for i in range(N - 1, -1, -1):\n\n cum[i] = cum[i + 1] + A[i]\n\n count = Counter()\n\n ans = 0\n\n for i in range(N):\n\n if A[i] == 0:\n\n ans += 1\n\n ans += count[cum[i] - A[i]]\n\n count[cum[i]] += 1\n\n return ans\n\n\n\n\n\nprint(solve())\n","target":"import sys\n\nfrom collections import Counter\n\n\n\nsys.setrecursionlimit(10 ** 8)\n\nini = lambda: int(sys.stdin.readline())\n\ninl = lambda: [int(x) for x in sys.stdin.readline().split()]\n\nins = lambda: sys.stdin.readline().rstrip()\n\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\n\n\n\nN = ini()\n\nA = inl()\n\n\n\n\n\ndef solve():\n\n cum = [0] * (N + 1)\n\n for i in range(N - 1, -1, -1):\n\n cum[i] = cum[i + 1] + A[i]\n\n count = Counter()\n\n ans = 0\n\n for i in range(N):\n\n count[cum[i]] += 1\n\n ans += count[cum[i + 1]]\n\n return ans\n\n\n\n\n\nprint(solve())\n","code_v0_loc":28,"code_v1_loc":26,"code_v0_num_chars":661,"code_v1_num_chars":613,"code_v0_no_empty_lines":"import sys\nfrom collections import Counter\n\nsys.setrecursionlimit(10**8)\nini = lambda: int(sys.stdin.readline())\ninl = lambda: [int(x) for x in sys.stdin.readline().split()]\nins = lambda: sys.stdin.readline().rstrip()\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\nN = ini()\nA = inl()\n\n\ndef solve():\n cum = [0] * (N + 1)\n for i in range(N - 1, -1, -1):\n cum[i] = cum[i + 1] + A[i]\n count = Counter()\n ans = 0\n for i in range(N):\n if A[i] == 0:\n ans += 1\n ans += count[cum[i] - A[i]]\n count[cum[i]] += 1\n return ans\n\n\nprint(solve())\n","code_v1_no_empty_lines":"import sys\nfrom collections import Counter\n\nsys.setrecursionlimit(10**8)\nini = lambda: int(sys.stdin.readline())\ninl = lambda: [int(x) for x in sys.stdin.readline().split()]\nins = lambda: sys.stdin.readline().rstrip()\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\nN = ini()\nA = inl()\n\n\ndef solve():\n cum = [0] * (N + 1)\n for i in range(N - 1, -1, -1):\n cum[i] = cum[i + 1] + A[i]\n count = Counter()\n ans = 0\n for i in range(N):\n count[cum[i]] += 1\n ans += count[cum[i + 1]]\n return ans\n\n\nprint(solve())\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["- if A[i] == 0:","- ans += 1","- ans += count[cum[i] - A[i]]","+ ans += count[cum[i + 1]]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0357971578,"measured_runtime_v1":0.0367059307,"runtime_lift":0.9752417951,"key":["s944970883","s168481323"]} +{"user_id":"u075012704","problem_id":"p03354","language":"python","submission_id_v0":"s419711134","submission_id_v1":"s999671693","cpu_time_v0":1160,"cpu_time_v1":771,"memory_v0":100716,"memory_v1":23480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.53,"input":"N, M = list(map(int, input().split()))\n\nP = list(map(int, input().split()))\n\nP = list(enumerate(P, start=1))\n\n\n\n\n\nclass UnionFind:\n\n def __init__(self, n):\n\n self.par = [i for i in range(n+1)]\n\n self.rank = [0] * (n+1)\n\n self.size = [1] * (n+1)\n\n\n\n # \u691c\u7d22\n\n def find(self, x):\n\n if self.par[x] == x:\n\n return x\n\n else:\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n\n\n # \u4f75\u5408\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.rank[x] < self.rank[y]:\n\n self.par[x] = y\n\n self.size[y] += self.size[x]\n\n self.size[x] = 0\n\n else:\n\n self.par[y] = x\n\n self.size[x] += self.size[y]\n\n self.size[y] = 0\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n\n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5224\u5b9a\n\n def same_check(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n\n\nuf = UnionFind(N)\n\nfor m in range(M):\n\n x, y = list(map(int, input().split()))\n\n uf.union(x, y)\n\n\n\nans = 0\n\nfor now, value in P:\n\n if uf.same_check(now, value):\n\n ans += 1\n\nprint(ans)","target":"N, M = list(map(int, input().split()))\n\nP = list(enumerate(map(int, input().split())))\n\n\n\n\n\nclass UnionFind:\n\n def __init__(self, n):\n\n self.par = [i for i in range(n)]\n\n self.rank = [0] * n\n\n self.size = [1] * n\n\n\n\n # \u691c\u7d22\n\n def find(self, x):\n\n if self.par[x] == x:\n\n return x\n\n else:\n\n self.par[x] = self.find(self.par[x])\n\n return self.par[x]\n\n\n\n # \u4f75\u5408\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.rank[x] < self.rank[y]:\n\n self.par[x] = y\n\n self.size[y] += self.size[x]\n\n self.size[x] = 0\n\n else:\n\n self.par[y] = x\n\n self.size[x] += self.size[y]\n\n self.size[y] = 0\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n\n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5224\u5b9a\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n # \u3059\u3079\u3066\u306e\u9802\u70b9\u306b\u5bfe\u3057\u3066\u89aa\u3092\u691c\u7d22\u3059\u308b\n\n def all_find(self):\n\n for n in range(len(self.par)):\n\n self.find(n)\n\n\n\n\n\nUF = UnionFind(N)\n\nfor i in range(M):\n\n x, y = list(map(int, input().split()))\n\n x, y = x-1, y-1\n\n UF.union(x, y)\n\n\n\n\n\nUF.all_find()\n\n\n\nans = 0\n\nfor index, number in P:\n\n ans += UF.same(index, number - 1)\n\n\n\nprint(ans)\n","code_v0_loc":53,"code_v1_loc":61,"code_v0_num_chars":1220,"code_v1_num_chars":1331,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nP = list(map(int, input().split()))\nP = list(enumerate(P, start=1))\n\n\nclass UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n + 1)]\n self.rank = [0] * (n + 1)\n self.size = [1] * (n + 1)\n\n # \u691c\u7d22\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n # \u4f75\u5408\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n self.size[y] += self.size[x]\n self.size[x] = 0\n else:\n self.par[y] = x\n self.size[x] += self.size[y]\n self.size[y] = 0\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5224\u5b9a\n def same_check(self, x, y):\n return self.find(x) == self.find(y)\n\n\nuf = UnionFind(N)\nfor m in range(M):\n x, y = list(map(int, input().split()))\n uf.union(x, y)\nans = 0\nfor now, value in P:\n if uf.same_check(now, value):\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nP = list(enumerate(map(int, input().split())))\n\n\nclass UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n)]\n self.rank = [0] * n\n self.size = [1] * n\n\n # \u691c\u7d22\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n # \u4f75\u5408\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n self.size[y] += self.size[x]\n self.size[x] = 0\n else:\n self.par[y] = x\n self.size[x] += self.size[y]\n self.size[y] = 0\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n # \u540c\u3058\u96c6\u5408\u306b\u5c5e\u3059\u308b\u304b\u5224\u5b9a\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n # \u3059\u3079\u3066\u306e\u9802\u70b9\u306b\u5bfe\u3057\u3066\u89aa\u3092\u691c\u7d22\u3059\u308b\n def all_find(self):\n for n in range(len(self.par)):\n self.find(n)\n\n\nUF = UnionFind(N)\nfor i in range(M):\n x, y = list(map(int, input().split()))\n x, y = x - 1, y - 1\n UF.union(x, y)\nUF.all_find()\nans = 0\nfor index, number in P:\n ans += UF.same(index, number - 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":13.1147540984,"diff":["-P = list(map(int, input().split()))","-P = list(enumerate(P, start=1))","+P = list(enumerate(map(int, input().split())))","- self.par = [i for i in range(n + 1)]","- self.rank = [0] * (n + 1)","- self.size = [1] * (n + 1)","+ self.par = [i for i in range(n)]","+ self.rank = [0] * n","+ self.size = [1] * n","- def same_check(self, x, y):","+ def same(self, x, y):","+ # \u3059\u3079\u3066\u306e\u9802\u70b9\u306b\u5bfe\u3057\u3066\u89aa\u3092\u691c\u7d22\u3059\u308b","+ def all_find(self):","+ for n in range(len(self.par)):","+ self.find(n)","-uf = UnionFind(N)","-for m in range(M):","+","+UF = UnionFind(N)","+for i in range(M):","- uf.union(x, y)","+ x, y = x - 1, y - 1","+ UF.union(x, y)","+UF.all_find()","-for now, value in P:","- if uf.same_check(now, value):","- ans += 1","+for index, number in P:","+ ans += UF.same(index, number - 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0468605707,"measured_runtime_v1":0.036369122,"runtime_lift":1.2884713197,"key":["s419711134","s999671693"]} +{"user_id":"u072053884","problem_id":"p02304","language":"python","submission_id_v0":"s096757243","submission_id_v1":"s049553725","cpu_time_v0":1510,"cpu_time_v1":1340,"memory_v0":28952,"memory_v1":35336,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.26,"input":"# Acceptance of input\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nn = file_input.readline()\n\n\n\nEP = []\n\nl = -1000000001\n\nu = 1000000001\n\nvs_x = set()\n\n\n\nfor line in file_input:\n\n x1, y1, x2, y2 = (list(map(int, line.split())))\n\n if x1 == x2:\n\n if y1 < y2:\n\n EP.append((y1, l, x1))\n\n EP.append((y2, u, x1))\n\n else:\n\n EP.append((y1, u, x1))\n\n EP.append((y2, l, x1))\n\n vs_x.add(x1)\n\n else:\n\n if x1 < x2:\n\n EP.append((y1, x1, x2))\n\n else:\n\n EP.append((y1, x2, x1))\n\n\n\nvs_x = sorted(vs_x)\n\n\n\n# Binary Indexed Tree\n\nclass BinaryIndexedTree:\n\n def __init__(self, n):\n\n self.data = [0] * (n + 1)\n\n self.num = n\n\n\n\n def switch(self, i, d):\n\n while i <= self.num:\n\n self.data[i] += d\n\n i += i & -i\n\n\n\n def _sum(self, i):\n\n s = 0\n\n while i:\n\n s += self.data[i]\n\n i -= i & -i\n\n return s\n\n\n\n def seg_sum(self, a, b):\n\n return self._sum(b) - self._sum(a - 1)\n\n\n\n# Sweep\n\nimport bisect\n\n\n\nEP.sort()\n\nBIT = BinaryIndexedTree(len(vs_x))\n\ncnt = 0\n\n\n\nfor p in EP:\n\n e = p[1]\n\n if e == l:\n\n vx = bisect.bisect(vs_x, p[2])\n\n BIT.switch(vx, 1)\n\n elif e == u:\n\n vx = bisect.bisect(vs_x, p[2])\n\n BIT.switch(vx, -1)\n\n else:\n\n l_x = bisect.bisect_left(vs_x, e) + 1\n\n r_x = bisect.bisect(vs_x, p[2])\n\n cnt += BIT.seg_sum(l_x, r_x)\n\n\n\n# Output\n\nprint(cnt)","target":"# Acceptance of input\n\nimport sys\n\n\n\nfile_input = sys.stdin\n\n\n\nn = file_input.readline()\n\n\n\nEP = []\n\nl = -1000000001\n\nu = 1000000001\n\nvs_x = set()\n\n\n\nfor line in file_input:\n\n x1, y1, x2, y2 = (list(map(int, line.split())))\n\n if x1 == x2:\n\n if y1 < y2:\n\n EP.append((y1, l, x1))\n\n EP.append((y2, u, x1))\n\n else:\n\n EP.append((y1, u, x1))\n\n EP.append((y2, l, x1))\n\n vs_x.add(x1)\n\n else:\n\n if x1 < x2:\n\n EP.append((y1, x1, x2))\n\n else:\n\n EP.append((y1, x2, x1))\n\n\n\n# Binary Indexed Tree\n\nclass BinaryIndexedTree:\n\n def __init__(self, n):\n\n self.data = [0] * (n + 1)\n\n self.num = n\n\n\n\n def switch(self, i, d):\n\n while i <= self.num:\n\n self.data[i] += d\n\n i += i & -i\n\n\n\n def _sum(self, i):\n\n s = 0\n\n while i:\n\n s += self.data[i]\n\n i -= i & -i\n\n return s\n\n\n\n def seg_sum(self, a, b):\n\n return self._sum(b) - self._sum(a - 1)\n\n\n\n# Sweep\n\nimport bisect\n\n\n\nEP.sort()\n\nBIT = BinaryIndexedTree(len(vs_x))\n\nvs_x = [l] + sorted(vs_x)\n\nd_vs_x = {e: i for i, e in enumerate(vs_x)}\n\ncnt = 0\n\n\n\nfor p in EP:\n\n e = p[1]\n\n if e == l:\n\n BIT.switch(d_vs_x[p[2]], 1)\n\n elif e == u:\n\n BIT.switch(d_vs_x[p[2]], -1)\n\n else:\n\n l_x = bisect.bisect_left(vs_x, e)\n\n r_x = bisect.bisect(vs_x, p[2]) - 1\n\n cnt += BIT.seg_sum(l_x, r_x)\n\n\n\n# Output\n\nprint(cnt)","code_v0_loc":73,"code_v1_loc":71,"code_v0_num_chars":1495,"code_v1_num_chars":1484,"code_v0_no_empty_lines":"# Acceptance of input\nimport sys\n\nfile_input = sys.stdin\nn = file_input.readline()\nEP = []\nl = -1000000001\nu = 1000000001\nvs_x = set()\nfor line in file_input:\n x1, y1, x2, y2 = list(map(int, line.split()))\n if x1 == x2:\n if y1 < y2:\n EP.append((y1, l, x1))\n EP.append((y2, u, x1))\n else:\n EP.append((y1, u, x1))\n EP.append((y2, l, x1))\n vs_x.add(x1)\n else:\n if x1 < x2:\n EP.append((y1, x1, x2))\n else:\n EP.append((y1, x2, x1))\nvs_x = sorted(vs_x)\n# Binary Indexed Tree\nclass BinaryIndexedTree:\n def __init__(self, n):\n self.data = [0] * (n + 1)\n self.num = n\n\n def switch(self, i, d):\n while i <= self.num:\n self.data[i] += d\n i += i & -i\n\n def _sum(self, i):\n s = 0\n while i:\n s += self.data[i]\n i -= i & -i\n return s\n\n def seg_sum(self, a, b):\n return self._sum(b) - self._sum(a - 1)\n\n\n# Sweep\nimport bisect\n\nEP.sort()\nBIT = BinaryIndexedTree(len(vs_x))\ncnt = 0\nfor p in EP:\n e = p[1]\n if e == l:\n vx = bisect.bisect(vs_x, p[2])\n BIT.switch(vx, 1)\n elif e == u:\n vx = bisect.bisect(vs_x, p[2])\n BIT.switch(vx, -1)\n else:\n l_x = bisect.bisect_left(vs_x, e) + 1\n r_x = bisect.bisect(vs_x, p[2])\n cnt += BIT.seg_sum(l_x, r_x)\n# Output\nprint(cnt)\n","code_v1_no_empty_lines":"# Acceptance of input\nimport sys\n\nfile_input = sys.stdin\nn = file_input.readline()\nEP = []\nl = -1000000001\nu = 1000000001\nvs_x = set()\nfor line in file_input:\n x1, y1, x2, y2 = list(map(int, line.split()))\n if x1 == x2:\n if y1 < y2:\n EP.append((y1, l, x1))\n EP.append((y2, u, x1))\n else:\n EP.append((y1, u, x1))\n EP.append((y2, l, x1))\n vs_x.add(x1)\n else:\n if x1 < x2:\n EP.append((y1, x1, x2))\n else:\n EP.append((y1, x2, x1))\n# Binary Indexed Tree\nclass BinaryIndexedTree:\n def __init__(self, n):\n self.data = [0] * (n + 1)\n self.num = n\n\n def switch(self, i, d):\n while i <= self.num:\n self.data[i] += d\n i += i & -i\n\n def _sum(self, i):\n s = 0\n while i:\n s += self.data[i]\n i -= i & -i\n return s\n\n def seg_sum(self, a, b):\n return self._sum(b) - self._sum(a - 1)\n\n\n# Sweep\nimport bisect\n\nEP.sort()\nBIT = BinaryIndexedTree(len(vs_x))\nvs_x = [l] + sorted(vs_x)\nd_vs_x = {e: i for i, e in enumerate(vs_x)}\ncnt = 0\nfor p in EP:\n e = p[1]\n if e == l:\n BIT.switch(d_vs_x[p[2]], 1)\n elif e == u:\n BIT.switch(d_vs_x[p[2]], -1)\n else:\n l_x = bisect.bisect_left(vs_x, e)\n r_x = bisect.bisect(vs_x, p[2]) - 1\n cnt += BIT.seg_sum(l_x, r_x)\n# Output\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":2.7397260274,"diff":["-vs_x = sorted(vs_x)","+vs_x = [l] + sorted(vs_x)","+d_vs_x = {e: i for i, e in enumerate(vs_x)}","- vx = bisect.bisect(vs_x, p[2])","- BIT.switch(vx, 1)","+ BIT.switch(d_vs_x[p[2]], 1)","- vx = bisect.bisect(vs_x, p[2])","- BIT.switch(vx, -1)","+ BIT.switch(d_vs_x[p[2]], -1)","- l_x = bisect.bisect_left(vs_x, e) + 1","- r_x = bisect.bisect(vs_x, p[2])","+ l_x = bisect.bisect_left(vs_x, e)","+ r_x = bisect.bisect(vs_x, p[2]) - 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0436569486,"measured_runtime_v1":0.0436279159,"runtime_lift":1.0006654615,"key":["s096757243","s049553725"]} +{"user_id":"u263830634","problem_id":"p03295","language":"python","submission_id_v0":"s172413937","submission_id_v1":"s048409143","cpu_time_v0":422,"cpu_time_v1":330,"memory_v0":18232,"memory_v1":18208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.8,"input":"N, M = list(map(int, input().split()))\n\n\n\nAB = [tuple(map(int, input().split())) for _ in range(M)]\n\nAB.sort(key = lambda x: x[0])\n\n\n\ncount = 1\n\nB = 10 ** 9\n\nfor a, b in AB:\n\n if a < B:\n\n B = min(B, b)\n\n else:\n\n count += 1\n\n B = b\n\n\n\nprint (count)\n","target":"import sys\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 9)\n\nMOD = 10 ** 9 + 7\n\n\n\nN, M = list(map(int, input().split()))\n\n\n\nAB = [tuple(map(int, input().split())) for _ in range(M)]\n\n\n\nAB.sort(key = lambda x: x[1]) #\u53f3\u5074\u304c\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8\n\nAB.sort(key = lambda x: x[0]) #\u5de6\u5074\u304c\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8\n\n\n\nans = 0\n\n\n\nright = N + 1\n\nfor a, b in AB:\n\n if a < right:\n\n right = min(right, b)\n\n else:\n\n ans += 1\n\n right = b\n\n\n\nprint((ans + 1))\n\n\n","code_v0_loc":15,"code_v1_loc":24,"code_v0_num_chars":269,"code_v1_num_chars":441,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nAB = [tuple(map(int, input().split())) for _ in range(M)]\nAB.sort(key=lambda x: x[0])\ncount = 1\nB = 10**9\nfor a, b in AB:\n if a < B:\n B = min(B, b)\n else:\n count += 1\n B = b\nprint(count)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**9)\nMOD = 10**9 + 7\nN, M = list(map(int, input().split()))\nAB = [tuple(map(int, input().split())) for _ in range(M)]\nAB.sort(key=lambda x: x[1]) # \u53f3\u5074\u304c\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8\nAB.sort(key=lambda x: x[0]) # \u5de6\u5074\u304c\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8\nans = 0\nright = N + 1\nfor a, b in AB:\n if a < right:\n right = min(right, b)\n else:\n ans += 1\n right = b\nprint((ans + 1))\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["+import sys","+","+input = sys.stdin.readline","+sys.setrecursionlimit(10**9)","+MOD = 10**9 + 7","-AB.sort(key=lambda x: x[0])","-count = 1","-B = 10**9","+AB.sort(key=lambda x: x[1]) # \u53f3\u5074\u304c\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8","+AB.sort(key=lambda x: x[0]) # \u5de6\u5074\u304c\u5c0f\u3055\u3044\u9806\u306b\u30bd\u30fc\u30c8","+ans = 0","+right = N + 1","- if a < B:","- B = min(B, b)","+ if a < right:","+ right = min(right, b)","- count += 1","- B = b","-print(count)","+ ans += 1","+ right = b","+print((ans + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.043641361,"measured_runtime_v1":0.0476115546,"runtime_lift":0.9166128125,"key":["s172413937","s048409143"]} +{"user_id":"u018679195","problem_id":"p03162","language":"python","submission_id_v0":"s934624790","submission_id_v1":"s697147605","cpu_time_v0":457,"cpu_time_v1":243,"memory_v0":30076,"memory_v1":90436,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.83,"input":"def main():\n\n\n\n n = int(eval(input()))\n\n actividad = []\n\n for i in range(n):\n\n puntos = list(map(int, input().split()))\n\n actividad.append(puntos)\n\n\n\n primer_puntos = [0] * 3\n\n\n\n for i in range(len(primer_puntos)):\n\n primer_puntos[i] = actividad[0][i]\n\n\n\n for i in range(1, n):\n\n siguiente = [0] * 3\n\n for j in range(3):\n\n for k in range(3):\n\n if j != k :\n\n siguiente[j] = max(siguiente[j], primer_puntos[k] + actividad[i][j])\n\n primer_puntos = siguiente\n\n\n\n print((max(primer_puntos)))\n\nif __name__ == \"__main__\":\n\n main()","target":"n = int(eval(input()))\n\n\n\nfelicidade = []\n\n\n\nfor x in range(n):\n\n felicidade.append(list(map(int,input().split())))\n\n\n\nDP = [0,0,0]\n\n\n\nif n == 1:\n\n print((max(felicidade[0])))\n\n\n\nelse:\n\n\n\n for x in range(3):\n\n DP[x] = felicidade[0][x]\n\n\n\n\n\n for dia in range(1,n):\n\n m = [0] * 3\n\n for x in range(3):#As duas poss\u00edveis escolhas s\u00e3o x e y\n\n for y in range(3):\n\n if x != y: #Se elas forem diferentes\n\n m[x] = max(m[x], DP[y] + felicidade[dia][x])\n\n DP = m\n\n \n\n print((max(DP)))\n","code_v0_loc":24,"code_v1_loc":27,"code_v0_num_chars":626,"code_v1_num_chars":557,"code_v0_no_empty_lines":"def main():\n n = int(eval(input()))\n actividad = []\n for i in range(n):\n puntos = list(map(int, input().split()))\n actividad.append(puntos)\n primer_puntos = [0] * 3\n for i in range(len(primer_puntos)):\n primer_puntos[i] = actividad[0][i]\n for i in range(1, n):\n siguiente = [0] * 3\n for j in range(3):\n for k in range(3):\n if j != k:\n siguiente[j] = max(siguiente[j], primer_puntos[k] + actividad[i][j])\n primer_puntos = siguiente\n print((max(primer_puntos)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"n = int(eval(input()))\nfelicidade = []\nfor x in range(n):\n felicidade.append(list(map(int, input().split())))\nDP = [0, 0, 0]\nif n == 1:\n print((max(felicidade[0])))\nelse:\n for x in range(3):\n DP[x] = felicidade[0][x]\n for dia in range(1, n):\n m = [0] * 3\n for x in range(3): # As duas poss\u00edveis escolhas s\u00e3o x e y\n for y in range(3):\n if x != y: # Se elas forem diferentes\n m[x] = max(m[x], DP[y] + felicidade[dia][x])\n DP = m\n print((max(DP)))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-def main():","- n = int(eval(input()))","- actividad = []","- for i in range(n):","- puntos = list(map(int, input().split()))","- actividad.append(puntos)","- primer_puntos = [0] * 3","- for i in range(len(primer_puntos)):","- primer_puntos[i] = actividad[0][i]","- for i in range(1, n):","- siguiente = [0] * 3","- for j in range(3):","- for k in range(3):","- if j != k:","- siguiente[j] = max(siguiente[j], primer_puntos[k] + actividad[i][j])","- primer_puntos = siguiente","- print((max(primer_puntos)))","-","-","-if __name__ == \"__main__\":","- main()","+n = int(eval(input()))","+felicidade = []","+for x in range(n):","+ felicidade.append(list(map(int, input().split())))","+DP = [0, 0, 0]","+if n == 1:","+ print((max(felicidade[0])))","+else:","+ for x in range(3):","+ DP[x] = felicidade[0][x]","+ for dia in range(1, n):","+ m = [0] * 3","+ for x in range(3): # As duas poss\u00edveis escolhas s\u00e3o x e y","+ for y in range(3):","+ if x != y: # Se elas forem diferentes","+ m[x] = max(m[x], DP[y] + felicidade[dia][x])","+ DP = m","+ print((max(DP)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.035584029,"measured_runtime_v1":0.0374015102,"runtime_lift":0.9514062059,"key":["s934624790","s697147605"]} +{"user_id":"u707498674","problem_id":"p02834","language":"python","submission_id_v0":"s612104386","submission_id_v1":"s932426402","cpu_time_v0":881,"cpu_time_v1":693,"memory_v0":101548,"memory_v1":80668,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.34,"input":"import sys\n\nsys.setrecursionlimit(10**9)\n\n\n\n\n\ndef dfs4t(a, par):\n\n for child in edge[a]:\n\n if child == par:\n\n continue\n\n else:\n\n cost4t[child] = cost4t[a] + 1\n\n dfs4t(child, a)\n\n return\n\n\n\ndef dfs4a(a, par):\n\n for child in edge[a]:\n\n if child == par:\n\n continue\n\n else:\n\n cost4a[child] = cost4a[a] + 1\n\n dfs4a(child, a)\n\n return\n\n\n\n\n\nN, u, v = list(map(int, input().split()))\n\nedge = [[] for _ in range(N)]\n\ncost4t = [10**5 for i in range(N)]\n\ncost4a = [10**5 for i in range(N)]\n\n\n\nfor _ in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n edge[a].append(b)\n\n edge[b].append(a)\n\n\n\nu -= 1\n\nv -= 1\n\ncost4t[u] = 0\n\ncost4a[v] = 0\n\ndfs4t(u, 10**5)\n\ndfs4a(v, 10**5)\n\n\n\nans = 0\n\nfor t, a, in zip(cost4t, cost4a):\n\n if a >= t:\n\n ans = max(ans, t + a - (t + 1))\n\nprint(ans)","target":"import sys\n\nfrom collections import deque, defaultdict\n\ndef input(): return sys.stdin.readline().strip()\n\n\n\ndef main():\n\n N, u, v = list(map(int, input().split()))\n\n u -= 1\n\n v -= 1\n\n \n\n edges = [list(map(int, input().split())) for _ in range(N-1)]\n\n\n\n to = [[] for _ in range(N)]\n\n for a, b in edges:\n\n a -= 1\n\n b -= 1\n\n to[a].append(b)\n\n to[b].append(a)\n\n \n\n dist = {key:defaultdict(int) for key in [u, v]}\n\n\n\n def bfs(key):\n\n q = deque()\n\n q.append(key)\n\n while(len(q)):\n\n now = q.popleft()\n\n for nv in to[now]:\n\n if nv == key or dist[key][nv]:\n\n continue\n\n else:\n\n dist[key][nv] = dist[key][now] + 1\n\n q.append(nv)\n\n \n\n for key in [u, v]:\n\n bfs(key)\n\n \n\n ans = 0\n\n for i in range(N):\n\n diff = dist[v][i] - dist[u][i]\n\n if diff > 0:\n\n ans = max(ans, dist[v][i]-1)\n\n\n\n print(ans) \n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":47,"code_v1_loc":45,"code_v0_num_chars":908,"code_v1_num_chars":1054,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**9)\n\n\ndef dfs4t(a, par):\n for child in edge[a]:\n if child == par:\n continue\n else:\n cost4t[child] = cost4t[a] + 1\n dfs4t(child, a)\n return\n\n\ndef dfs4a(a, par):\n for child in edge[a]:\n if child == par:\n continue\n else:\n cost4a[child] = cost4a[a] + 1\n dfs4a(child, a)\n return\n\n\nN, u, v = list(map(int, input().split()))\nedge = [[] for _ in range(N)]\ncost4t = [10**5 for i in range(N)]\ncost4a = [10**5 for i in range(N)]\nfor _ in range(N - 1):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n edge[a].append(b)\n edge[b].append(a)\nu -= 1\nv -= 1\ncost4t[u] = 0\ncost4a[v] = 0\ndfs4t(u, 10**5)\ndfs4a(v, 10**5)\nans = 0\nfor (\n t,\n a,\n) in zip(cost4t, cost4a):\n if a >= t:\n ans = max(ans, t + a - (t + 1))\nprint(ans)\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque, defaultdict\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n N, u, v = list(map(int, input().split()))\n u -= 1\n v -= 1\n edges = [list(map(int, input().split())) for _ in range(N - 1)]\n to = [[] for _ in range(N)]\n for a, b in edges:\n a -= 1\n b -= 1\n to[a].append(b)\n to[b].append(a)\n dist = {key: defaultdict(int) for key in [u, v]}\n\n def bfs(key):\n q = deque()\n q.append(key)\n while len(q):\n now = q.popleft()\n for nv in to[now]:\n if nv == key or dist[key][nv]:\n continue\n else:\n dist[key][nv] = dist[key][now] + 1\n q.append(nv)\n\n for key in [u, v]:\n bfs(key)\n ans = 0\n for i in range(N):\n diff = dist[v][i] - dist[u][i]\n if diff > 0:\n ans = max(ans, dist[v][i] - 1)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":4.2553191489,"diff":["-","-sys.setrecursionlimit(10**9)","+from collections import deque, defaultdict","-def dfs4t(a, par):","- for child in edge[a]:","- if child == par:","- continue","- else:","- cost4t[child] = cost4t[a] + 1","- dfs4t(child, a)","- return","+def input():","+ return sys.stdin.readline().strip()","-def dfs4a(a, par):","- for child in edge[a]:","- if child == par:","- continue","- else:","- cost4a[child] = cost4a[a] + 1","- dfs4a(child, a)","- return","+def main():","+ N, u, v = list(map(int, input().split()))","+ u -= 1","+ v -= 1","+ edges = [list(map(int, input().split())) for _ in range(N - 1)]","+ to = [[] for _ in range(N)]","+ for a, b in edges:","+ a -= 1","+ b -= 1","+ to[a].append(b)","+ to[b].append(a)","+ dist = {key: defaultdict(int) for key in [u, v]}","+","+ def bfs(key):","+ q = deque()","+ q.append(key)","+ while len(q):","+ now = q.popleft()","+ for nv in to[now]:","+ if nv == key or dist[key][nv]:","+ continue","+ else:","+ dist[key][nv] = dist[key][now] + 1","+ q.append(nv)","+","+ for key in [u, v]:","+ bfs(key)","+ ans = 0","+ for i in range(N):","+ diff = dist[v][i] - dist[u][i]","+ if diff > 0:","+ ans = max(ans, dist[v][i] - 1)","+ print(ans)","-N, u, v = list(map(int, input().split()))","-edge = [[] for _ in range(N)]","-cost4t = [10**5 for i in range(N)]","-cost4a = [10**5 for i in range(N)]","-for _ in range(N - 1):","- a, b = list(map(int, input().split()))","- a -= 1","- b -= 1","- edge[a].append(b)","- edge[b].append(a)","-u -= 1","-v -= 1","-cost4t[u] = 0","-cost4a[v] = 0","-dfs4t(u, 10**5)","-dfs4a(v, 10**5)","-ans = 0","-for (","- t,","- a,","-) in zip(cost4t, cost4a):","- if a >= t:","- ans = max(ans, t + a - (t + 1))","-print(ans)","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0439926546,"measured_runtime_v1":0.1019909091,"runtime_lift":0.4313389786,"key":["s612104386","s932426402"]} +{"user_id":"u858742833","problem_id":"p02936","language":"python","submission_id_v0":"s837343482","submission_id_v1":"s003592495","cpu_time_v0":1648,"cpu_time_v1":1492,"memory_v0":65308,"memory_v1":65308,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.47,"input":"def main():\n\n N, Q = [int(i) for i in input().split()]\n\n V = [[] for _ in range(N)]\n\n for _ in range(N - 1):\n\n a, b = [int(i) - 1 for i in input().split()]\n\n V[a].append(b)\n\n V[b].append(a)\n\n C = [0] * N\n\n for _ in range(Q):\n\n p, x = [int(i) for i in input().split()]\n\n C[p - 1] += x\n\n cur = [(0, 0, -1)]\n\n while cur:\n\n n, x, f = cur.pop()\n\n C[n] = x = C[n] + x\n\n for c in V[n]:\n\n if c != f:\n\n cur.append((c, x, n))\n\n print((' '.join(str(c) for c in C)))\n\n\n\nmain()\n","target":"def main():\n\n N, Q = list(map(int, input().split()))\n\n V = [[] for _ in range(N)]\n\n for _ in range(N - 1):\n\n a, b = list(map(int, input().split()))\n\n V[a - 1].append(b - 1)\n\n V[b - 1].append(a - 1)\n\n C = [0] * N\n\n for _ in range(Q):\n\n p, x = list(map(int, input().split()))\n\n C[p - 1] += x\n\n cur = [(0, 0, -1)]\n\n while cur:\n\n n, x, f = cur.pop()\n\n C[n] = x = C[n] + x\n\n for c in V[n]:\n\n if c != f:\n\n cur.append((c, x, n))\n\n print((' '.join(str(c) for c in C)))\n\n\n\nmain()\n","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":569,"code_v1_num_chars":557,"code_v0_no_empty_lines":"def main():\n N, Q = [int(i) for i in input().split()]\n V = [[] for _ in range(N)]\n for _ in range(N - 1):\n a, b = [int(i) - 1 for i in input().split()]\n V[a].append(b)\n V[b].append(a)\n C = [0] * N\n for _ in range(Q):\n p, x = [int(i) for i in input().split()]\n C[p - 1] += x\n cur = [(0, 0, -1)]\n while cur:\n n, x, f = cur.pop()\n C[n] = x = C[n] + x\n for c in V[n]:\n if c != f:\n cur.append((c, x, n))\n print((\" \".join(str(c) for c in C)))\n\n\nmain()\n","code_v1_no_empty_lines":"def main():\n N, Q = list(map(int, input().split()))\n V = [[] for _ in range(N)]\n for _ in range(N - 1):\n a, b = list(map(int, input().split()))\n V[a - 1].append(b - 1)\n V[b - 1].append(a - 1)\n C = [0] * N\n for _ in range(Q):\n p, x = list(map(int, input().split()))\n C[p - 1] += x\n cur = [(0, 0, -1)]\n while cur:\n n, x, f = cur.pop()\n C[n] = x = C[n] + x\n for c in V[n]:\n if c != f:\n cur.append((c, x, n))\n print((\" \".join(str(c) for c in C)))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- N, Q = [int(i) for i in input().split()]","+ N, Q = list(map(int, input().split()))","- a, b = [int(i) - 1 for i in input().split()]","- V[a].append(b)","- V[b].append(a)","+ a, b = list(map(int, input().split()))","+ V[a - 1].append(b - 1)","+ V[b - 1].append(a - 1)","- p, x = [int(i) for i in input().split()]","+ p, x = list(map(int, input().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.047773936,"measured_runtime_v1":0.0455190295,"runtime_lift":1.0495376661,"key":["s837343482","s003592495"]} +{"user_id":"u824144553","problem_id":"p03163","language":"python","submission_id_v0":"s356753637","submission_id_v1":"s173278287","cpu_time_v0":466,"cpu_time_v1":425,"memory_v0":118768,"memory_v1":118512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.8,"input":"def resolve():\n\n N, W = list(map(int, input().split())) \n\n w_v = [list(map(int, input().split())) for _ in range(N)] # [N][0:weight, 1:value]\n\n\n\n dp = [[0] * (W+1) for _ in range(N+1)] \n\n\n\n for i in range(N-1,-1,-1):\n\n for j in range(W+1):\n\n w = w_v[i][0]\n\n v = w_v[i][1]\n\n if j < w_v[i][0]:\n\n dp[i][j] = dp[i+1][j]\n\n else:\n\n dp[i][j] = max(dp[i+1][j], dp[i+1][j - w] + v)\n\n \n\n print((dp[0][W]))\n\n \n\nif __name__ == \"__main__\":\n\n resolve()","target":"def resolve():\n\n N, W = list(map(int, input().split())) \n\n w_v = [list(map(int, input().split())) for _ in range(N)] # [N][0:weight, 1:value]\n\n\n\n dp = [[0] * (W+1) for _ in range(N+1)] \n\n\n\n for i in range(N):\n\n for j in range(W+1):\n\n w = w_v[i][0]\n\n v = w_v[i][1]\n\n if j < w:\n\n dp[i+1][j] = dp[i][j]\n\n else:\n\n dp[i+1][j] = max(dp[i][j], dp[i][j - w] + v)\n\n \n\n print((dp[N][W]))\n\n \n\nif __name__ == \"__main__\":\n\n resolve()","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":533,"code_v1_num_chars":515,"code_v0_no_empty_lines":"def resolve():\n N, W = list(map(int, input().split()))\n w_v = [list(map(int, input().split())) for _ in range(N)] # [N][0:weight, 1:value]\n dp = [[0] * (W + 1) for _ in range(N + 1)]\n for i in range(N - 1, -1, -1):\n for j in range(W + 1):\n w = w_v[i][0]\n v = w_v[i][1]\n if j < w_v[i][0]:\n dp[i][j] = dp[i + 1][j]\n else:\n dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w] + v)\n print((dp[0][W]))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"def resolve():\n N, W = list(map(int, input().split()))\n w_v = [list(map(int, input().split())) for _ in range(N)] # [N][0:weight, 1:value]\n dp = [[0] * (W + 1) for _ in range(N + 1)]\n for i in range(N):\n for j in range(W + 1):\n w = w_v[i][0]\n v = w_v[i][1]\n if j < w:\n dp[i + 1][j] = dp[i][j]\n else:\n dp[i + 1][j] = max(dp[i][j], dp[i][j - w] + v)\n print((dp[N][W]))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for i in range(N - 1, -1, -1):","+ for i in range(N):","- if j < w_v[i][0]:","- dp[i][j] = dp[i + 1][j]","+ if j < w:","+ dp[i + 1][j] = dp[i][j]","- dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w] + v)","- print((dp[0][W]))","+ dp[i + 1][j] = max(dp[i][j], dp[i][j - w] + v)","+ print((dp[N][W]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409549236,"measured_runtime_v1":0.0414189339,"runtime_lift":0.9887971465,"key":["s356753637","s173278287"]} +{"user_id":"u694810977","problem_id":"p03378","language":"python","submission_id_v0":"s700042943","submission_id_v1":"s949487955","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"N, M, X = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\ncnt = 0\n\nmin = 0\n\ncnt_2 = 0\n\nlists = list(range(N + 1))\n\nfor i in range(X, N + 1):\n\n for j in range(len(A)):\n\n if i == 0 or i == N or i == X:\n\n continue\n\n elif i == A[j]:\n\n cnt += 1\n\nfor m in range(X, -1, -1):\n\n for n in range(len(A)):\n\n if m == 0 or m == N or m == X:\n\n continue\n\n elif m == A[n]:\n\n cnt_2 += 1\n\nif cnt > cnt_2:\n\n min = cnt_2\n\nelif cnt_2 > cnt:\n\n min = cnt\n\nprint(min)\n","target":"n,m,x = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\ncnt_r = 0\n\ncnt_l = 0\n\nroad = [True]*(n+1)\n\nfor i in a:\n\n road[i] = False\n\nfor i in range(x,n+1):\n\n if not road[i]:\n\n cnt_r += 1\n\nfor i in range(x,-1,-1):\n\n if not road[i]:\n\n cnt_l += 1\n\nans = min(cnt_r,cnt_l)\n\nprint(ans)","code_v0_loc":23,"code_v1_loc":15,"code_v0_num_chars":543,"code_v1_num_chars":313,"code_v0_no_empty_lines":"N, M, X = list(map(int, input().split()))\nA = list(map(int, input().split()))\ncnt = 0\nmin = 0\ncnt_2 = 0\nlists = list(range(N + 1))\nfor i in range(X, N + 1):\n for j in range(len(A)):\n if i == 0 or i == N or i == X:\n continue\n elif i == A[j]:\n cnt += 1\nfor m in range(X, -1, -1):\n for n in range(len(A)):\n if m == 0 or m == N or m == X:\n continue\n elif m == A[n]:\n cnt_2 += 1\nif cnt > cnt_2:\n min = cnt_2\nelif cnt_2 > cnt:\n min = cnt\nprint(min)\n","code_v1_no_empty_lines":"n, m, x = list(map(int, input().split()))\na = list(map(int, input().split()))\ncnt_r = 0\ncnt_l = 0\nroad = [True] * (n + 1)\nfor i in a:\n road[i] = False\nfor i in range(x, n + 1):\n if not road[i]:\n cnt_r += 1\nfor i in range(x, -1, -1):\n if not road[i]:\n cnt_l += 1\nans = min(cnt_r, cnt_l)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":34.7826086957,"diff":["-N, M, X = list(map(int, input().split()))","-A = list(map(int, input().split()))","-cnt = 0","-min = 0","-cnt_2 = 0","-lists = list(range(N + 1))","-for i in range(X, N + 1):","- for j in range(len(A)):","- if i == 0 or i == N or i == X:","- continue","- elif i == A[j]:","- cnt += 1","-for m in range(X, -1, -1):","- for n in range(len(A)):","- if m == 0 or m == N or m == X:","- continue","- elif m == A[n]:","- cnt_2 += 1","-if cnt > cnt_2:","- min = cnt_2","-elif cnt_2 > cnt:","- min = cnt","-print(min)","+n, m, x = list(map(int, input().split()))","+a = list(map(int, input().split()))","+cnt_r = 0","+cnt_l = 0","+road = [True] * (n + 1)","+for i in a:","+ road[i] = False","+for i in range(x, n + 1):","+ if not road[i]:","+ cnt_r += 1","+for i in range(x, -1, -1):","+ if not road[i]:","+ cnt_l += 1","+ans = min(cnt_r, cnt_l)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0713571072,"measured_runtime_v1":0.0621387005,"runtime_lift":1.1483520993,"key":["s700042943","s949487955"]} +{"user_id":"u320511454","problem_id":"p02814","language":"python","submission_id_v0":"s458576626","submission_id_v1":"s022443075","cpu_time_v0":239,"cpu_time_v1":157,"memory_v0":15060,"memory_v1":14244,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.31,"input":"def gcd_e(x, y):\n\n if y == 0:\n\n return x\n\n else:\n\n return gcd_e(y,x%y) \n\n\n\ndef lcm(x, y):\n\n return (x * y) \/\/ gcd_e(x, y)\n\n\n\nn,m=list(map(int,input().split()))\n\nA=list(map(int,input().split()))\n\na,b=A[0],0\n\n\n\nfor i in range(1,n):\n\n b = A[i]\n\n a = lcm(a,b)\n\n \n\nfor i in range(n):\n\n if (a \/\/ A[i]) % 2 == 0:\n\n print('0')\n\n exit() \n\n \n\nif a \/\/ 2 > m:\n\n print('0')\n\nelse:\n\n print(((m-a\/\/2)\/\/a+1))","target":"def gcd_e(x, y):\n\n if y == 0:\n\n return x\n\n else:\n\n return gcd_e(y,x%y) \n\n\n\ndef lcm(x, y):\n\n return (x * y) \/\/ gcd_e(x, y)\n\n\n\nn,m=list(map(int,input().split()))\n\nA=list(map(int,input().split()))\n\na,b=A[0],0\n\n\n\nfor i in range(1,n):\n\n b = A[i]\n\n a = lcm(a,b)\n\n \n\nfor i in set(A):\n\n if (a \/\/ i) % 2 == 0:\n\n print('0')\n\n exit() \n\n \n\nif a \/\/ 2 > m:\n\n print('0')\n\nelse:\n\n print(((m-a\/\/2)\/\/a+1))","code_v0_loc":26,"code_v1_loc":26,"code_v0_num_chars":420,"code_v1_num_chars":415,"code_v0_no_empty_lines":"def gcd_e(x, y):\n if y == 0:\n return x\n else:\n return gcd_e(y, x % y)\n\n\ndef lcm(x, y):\n return (x * y) \/\/ gcd_e(x, y)\n\n\nn, m = list(map(int, input().split()))\nA = list(map(int, input().split()))\na, b = A[0], 0\nfor i in range(1, n):\n b = A[i]\n a = lcm(a, b)\nfor i in range(n):\n if (a \/\/ A[i]) % 2 == 0:\n print(\"0\")\n exit()\nif a \/\/ 2 > m:\n print(\"0\")\nelse:\n print(((m - a \/\/ 2) \/\/ a + 1))\n","code_v1_no_empty_lines":"def gcd_e(x, y):\n if y == 0:\n return x\n else:\n return gcd_e(y, x % y)\n\n\ndef lcm(x, y):\n return (x * y) \/\/ gcd_e(x, y)\n\n\nn, m = list(map(int, input().split()))\nA = list(map(int, input().split()))\na, b = A[0], 0\nfor i in range(1, n):\n b = A[i]\n a = lcm(a, b)\nfor i in set(A):\n if (a \/\/ i) % 2 == 0:\n print(\"0\")\n exit()\nif a \/\/ 2 > m:\n print(\"0\")\nelse:\n print(((m - a \/\/ 2) \/\/ a + 1))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(n):","- if (a \/\/ A[i]) % 2 == 0:","+for i in set(A):","+ if (a \/\/ i) % 2 == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.044838033,"measured_runtime_v1":0.0400492764,"runtime_lift":1.1195716136,"key":["s458576626","s022443075"]} +{"user_id":"u624475441","problem_id":"p03652","language":"python","submission_id_v0":"s827347257","submission_id_v1":"s109941345","cpu_time_v0":1117,"cpu_time_v1":99,"memory_v0":4580,"memory_v1":4580,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.14,"input":"from collections import Counter\n\nfrom operator import itemgetter\n\n\n\ndef sub(prefers, canceled):\n\n res = Counter()\n\n for pref in prefers:\n\n pt = -1\n\n while pref[pt] in canceled:\n\n pt -= 1\n\n res[pref[pt]] += 1\n\n return max(list(res.items()), key=itemgetter(1))\n\n\n\ndef solve(m, prefers):\n\n canceled = set()\n\n ans = float('inf')\n\n for _ in [0] * m:\n\n s, c = sub(prefers, canceled)\n\n canceled.add(s)\n\n ans = min(ans, c)\n\n return ans\n\n\n\nif __name__ == '__main__':\n\n N, M = list(map(int, input().split()))\n\n A = [list(map(int, input().split()))[::-1] for _ in [0] * N]\n\n print((solve(M, A)))","target":"from collections import Counter\n\nfrom operator import itemgetter\n\n\n\ndef sub(prefers, canceled):\n\n res = Counter()\n\n for pref in prefers:\n\n p = pref[-1]\n\n while p in canceled:\n\n pref.pop()\n\n p = pref[-1]\n\n res[p] += 1\n\n return max(list(res.items()), key=itemgetter(1))\n\n\n\ndef solve(m, prefers):\n\n canceled = set()\n\n ans = float('inf')\n\n for _ in [0] * m:\n\n s, c = sub(prefers, canceled)\n\n canceled.add(s)\n\n ans = min(ans, c)\n\n return ans\n\n\n\nif __name__ == '__main__':\n\n N, M = list(map(int, input().split()))\n\n A = [list(map(int, input().split()))[::-1] for _ in [0] * N]\n\n print((solve(M, A)))","code_v0_loc":25,"code_v1_loc":26,"code_v0_num_chars":653,"code_v1_num_chars":673,"code_v0_no_empty_lines":"from collections import Counter\nfrom operator import itemgetter\n\n\ndef sub(prefers, canceled):\n res = Counter()\n for pref in prefers:\n pt = -1\n while pref[pt] in canceled:\n pt -= 1\n res[pref[pt]] += 1\n return max(list(res.items()), key=itemgetter(1))\n\n\ndef solve(m, prefers):\n canceled = set()\n ans = float(\"inf\")\n for _ in [0] * m:\n s, c = sub(prefers, canceled)\n canceled.add(s)\n ans = min(ans, c)\n return ans\n\n\nif __name__ == \"__main__\":\n N, M = list(map(int, input().split()))\n A = [list(map(int, input().split()))[::-1] for _ in [0] * N]\n print((solve(M, A)))\n","code_v1_no_empty_lines":"from collections import Counter\nfrom operator import itemgetter\n\n\ndef sub(prefers, canceled):\n res = Counter()\n for pref in prefers:\n p = pref[-1]\n while p in canceled:\n pref.pop()\n p = pref[-1]\n res[p] += 1\n return max(list(res.items()), key=itemgetter(1))\n\n\ndef solve(m, prefers):\n canceled = set()\n ans = float(\"inf\")\n for _ in [0] * m:\n s, c = sub(prefers, canceled)\n canceled.add(s)\n ans = min(ans, c)\n return ans\n\n\nif __name__ == \"__main__\":\n N, M = list(map(int, input().split()))\n A = [list(map(int, input().split()))[::-1] for _ in [0] * N]\n print((solve(M, A)))\n","code_same":false,"relative_loc_diff_percent":3.8461538462,"diff":["- pt = -1","- while pref[pt] in canceled:","- pt -= 1","- res[pref[pt]] += 1","+ p = pref[-1]","+ while p in canceled:","+ pref.pop()","+ p = pref[-1]","+ res[p] += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0413176509,"measured_runtime_v1":0.0353849728,"runtime_lift":1.167660947,"key":["s827347257","s109941345"]} +{"user_id":"u576432509","problem_id":"p03252","language":"python","submission_id_v0":"s673695374","submission_id_v1":"s320775906","cpu_time_v0":671,"cpu_time_v1":147,"memory_v0":45468,"memory_v1":6704,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.09,"input":"s=eval(input())\n\nt=eval(input())\n\n\n\nst=[]\n\nts=[]\n\nfor i in range(len(s)):\n\n st.append([s[i],t[i]])\n\n ts.append([t[i],s[i]])\n\n#print(st)\n\nst.sort()\n\nts.sort()\n\n#print(st)\n\n \n\nyesno=\"Yes\"\n\nfor i in range(len(st)-1):\n\n sj,tj=st[len(st)-i-1]\n\n sk,tk=st[len(st)-i-2]\n\n if sj==sk and tj!=tk:\n\n yesno=\"No\"\n\n break\n\n tj,sj=ts[len(ts)-i-1]\n\n tk,sk=ts[len(ts)-i-2]\n\n if tj==tk and sj!=sk:\n\n yesno=\"No\"\n\n break\n\n \n\nprint(yesno)\n","target":"\n\ns=list(eval(input()))\n\nt=list(eval(input()))\n\n\n\na=list(\"abcdefghijklmnopqrstuvwxyz\")\n\n\n\nrs=dict()\n\nrt=dict()\n\nfor i in range(26):\n\n rs[a[i]]=-1\n\n rt[a[i]]=-1\n\n\n\nyn=\"\"\n\nfor i in range(len(s)):\n\n if rs[s[i]]==-1:\n\n rs[s[i]]=t[i]\n\n else:\n\n if rs[s[i]]!=t[i]:\n\n yn=\"No\"\n\n break\n\n if rt[t[i]]==-1:\n\n rt[t[i]]=s[i]\n\n else:\n\n if rt[t[i]]!=s[i]:\n\n yn=\"No\"\n\n break\n\n \n\nif yn==\"No\":\n\n print(\"No\")\n\nelse:\n\n print(\"Yes\")\n\n ","code_v0_loc":27,"code_v1_loc":32,"code_v0_num_chars":463,"code_v1_num_chars":511,"code_v0_no_empty_lines":"s = eval(input())\nt = eval(input())\nst = []\nts = []\nfor i in range(len(s)):\n st.append([s[i], t[i]])\n ts.append([t[i], s[i]])\n# print(st)\nst.sort()\nts.sort()\n# print(st)\nyesno = \"Yes\"\nfor i in range(len(st) - 1):\n sj, tj = st[len(st) - i - 1]\n sk, tk = st[len(st) - i - 2]\n if sj == sk and tj != tk:\n yesno = \"No\"\n break\n tj, sj = ts[len(ts) - i - 1]\n tk, sk = ts[len(ts) - i - 2]\n if tj == tk and sj != sk:\n yesno = \"No\"\n break\nprint(yesno)\n","code_v1_no_empty_lines":"s = list(eval(input()))\nt = list(eval(input()))\na = list(\"abcdefghijklmnopqrstuvwxyz\")\nrs = dict()\nrt = dict()\nfor i in range(26):\n rs[a[i]] = -1\n rt[a[i]] = -1\nyn = \"\"\nfor i in range(len(s)):\n if rs[s[i]] == -1:\n rs[s[i]] = t[i]\n else:\n if rs[s[i]] != t[i]:\n yn = \"No\"\n break\n if rt[t[i]] == -1:\n rt[t[i]] = s[i]\n else:\n if rt[t[i]] != s[i]:\n yn = \"No\"\n break\nif yn == \"No\":\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":15.625,"diff":["-s = eval(input())","-t = eval(input())","-st = []","-ts = []","+s = list(eval(input()))","+t = list(eval(input()))","+a = list(\"abcdefghijklmnopqrstuvwxyz\")","+rs = dict()","+rt = dict()","+for i in range(26):","+ rs[a[i]] = -1","+ rt[a[i]] = -1","+yn = \"\"","- st.append([s[i], t[i]])","- ts.append([t[i], s[i]])","-# print(st)","-st.sort()","-ts.sort()","-# print(st)","-yesno = \"Yes\"","-for i in range(len(st) - 1):","- sj, tj = st[len(st) - i - 1]","- sk, tk = st[len(st) - i - 2]","- if sj == sk and tj != tk:","- yesno = \"No\"","- break","- tj, sj = ts[len(ts) - i - 1]","- tk, sk = ts[len(ts) - i - 2]","- if tj == tk and sj != sk:","- yesno = \"No\"","- break","-print(yesno)","+ if rs[s[i]] == -1:","+ rs[s[i]] = t[i]","+ else:","+ if rs[s[i]] != t[i]:","+ yn = \"No\"","+ break","+ if rt[t[i]] == -1:","+ rt[t[i]] = s[i]","+ else:","+ if rt[t[i]] != s[i]:","+ yn = \"No\"","+ break","+if yn == \"No\":","+ print(\"No\")","+else:","+ print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363590686,"measured_runtime_v1":0.0367894657,"runtime_lift":0.9883010792,"key":["s673695374","s320775906"]} +{"user_id":"u761320129","problem_id":"p03700","language":"python","submission_id_v0":"s181084695","submission_id_v1":"s718081934","cpu_time_v0":1547,"cpu_time_v1":854,"memory_v0":9828,"memory_v1":7384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.8,"input":"import math\n\n\n\ndef enough(n):\n\n whole_damage = B * n\n\n if (SUM > whole_damage*N + (A-B)*n):\n\n return False\n\n if (MAX <= whole_damage):\n\n return True\n\n arr = [hp for hp in HPS if hp > whole_damage]\n\n atk_times = 0\n\n for hp in arr:\n\n atk_times += int(math.ceil((hp - whole_damage)*1.0 \/ (A-B)))\n\n if atk_times > n:\n\n return False\n\n else:\n\n return True\n\n\n\nN,A,B = list(map(int, input().split()))\n\nHPS = [eval(input()) for i in range(N)]\n\nMAX = max(HPS)\n\nSUM = sum(HPS)\n\n\n\nleft = 1\n\nright = MAX\/B + 1\n\nwhile left < right:\n\n mid = (left + right)\/2\n\n if enough(mid):\n\n right = mid\n\n else:\n\n left = mid + 1\n\nprint(right)\n","target":"N,A,B = list(map(int,input().split()))\n\nsrc = [int(eval(input())) for i in range(N)]\n\nsrc.sort(reverse=True)\n\n\n\ndef isok(n):\n\n if all(h <= n*B for h in src):\n\n return True\n\n m = 0\n\n for h in src:\n\n h -= n*B\n\n m += (h-1)\/\/(A-B) + 1\n\n if m > n:\n\n return False\n\n return True\n\n\n\nok = 10**9\n\nng = 0\n\nwhile ok-ng > 1:\n\n m = (ok+ng) \/\/ 2\n\n if isok(m):\n\n ok = m\n\n else:\n\n ng = m\n\nprint(ok)","code_v0_loc":31,"code_v1_loc":24,"code_v0_num_chars":697,"code_v1_num_chars":443,"code_v0_no_empty_lines":"import math\n\n\ndef enough(n):\n whole_damage = B * n\n if SUM > whole_damage * N + (A - B) * n:\n return False\n if MAX <= whole_damage:\n return True\n arr = [hp for hp in HPS if hp > whole_damage]\n atk_times = 0\n for hp in arr:\n atk_times += int(math.ceil((hp - whole_damage) * 1.0 \/ (A - B)))\n if atk_times > n:\n return False\n else:\n return True\n\n\nN, A, B = list(map(int, input().split()))\nHPS = [eval(input()) for i in range(N)]\nMAX = max(HPS)\nSUM = sum(HPS)\nleft = 1\nright = MAX \/ B + 1\nwhile left < right:\n mid = (left + right) \/ 2\n if enough(mid):\n right = mid\n else:\n left = mid + 1\nprint(right)\n","code_v1_no_empty_lines":"N, A, B = list(map(int, input().split()))\nsrc = [int(eval(input())) for i in range(N)]\nsrc.sort(reverse=True)\n\n\ndef isok(n):\n if all(h <= n * B for h in src):\n return True\n m = 0\n for h in src:\n h -= n * B\n m += (h - 1) \/\/ (A - B) + 1\n if m > n:\n return False\n return True\n\n\nok = 10**9\nng = 0\nwhile ok - ng > 1:\n m = (ok + ng) \/\/ 2\n if isok(m):\n ok = m\n else:\n ng = m\nprint(ok)\n","code_same":false,"relative_loc_diff_percent":22.5806451613,"diff":["-import math","+N, A, B = list(map(int, input().split()))","+src = [int(eval(input())) for i in range(N)]","+src.sort(reverse=True)","-def enough(n):","- whole_damage = B * n","- if SUM > whole_damage * N + (A - B) * n:","- return False","- if MAX <= whole_damage:","+def isok(n):","+ if all(h <= n * B for h in src):","- arr = [hp for hp in HPS if hp > whole_damage]","- atk_times = 0","- for hp in arr:","- atk_times += int(math.ceil((hp - whole_damage) * 1.0 \/ (A - B)))","- if atk_times > n:","+ m = 0","+ for h in src:","+ h -= n * B","+ m += (h - 1) \/\/ (A - B) + 1","+ if m > n:","- else:","- return True","+ return True","-N, A, B = list(map(int, input().split()))","-HPS = [eval(input()) for i in range(N)]","-MAX = max(HPS)","-SUM = sum(HPS)","-left = 1","-right = MAX \/ B + 1","-while left < right:","- mid = (left + right) \/ 2","- if enough(mid):","- right = mid","+ok = 10**9","+ng = 0","+while ok - ng > 1:","+ m = (ok + ng) \/\/ 2","+ if isok(m):","+ ok = m","- left = mid + 1","-print(right)","+ ng = m","+print(ok)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0588261366,"measured_runtime_v1":0.0372702942,"runtime_lift":1.578365233,"key":["s181084695","s718081934"]} +{"user_id":"u156815136","problem_id":"p03665","language":"python","submission_id_v0":"s020335641","submission_id_v1":"s634037365","cpu_time_v0":58,"cpu_time_v1":35,"memory_v0":6156,"memory_v1":10452,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.66,"input":"from statistics import median\n\n#import collections\n\n#aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\n\nfrom fractions import gcd\n\nfrom itertools import combinations # (string,3) 3\u56de\n\nfrom collections import deque\n\nfrom collections import defaultdict\n\nimport bisect\n\n#\n\n# d = m - k[i] - k[j]\n\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n\n#\n\n#\n\n#\n\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n\n#\n\n#\n\n\n\nimport sys\n\nsys.setrecursionlimit(10000000)\n\nmod = 10**9 + 7\n\n\n\ndef readInts():\n\n return list(map(int,input().split()))\n\ndef main():\n\n n,p = readInts()\n\n m = 0\n\n A = readInts()\n\n for i in range(n):\n\n a = A[i]\n\n if a % 2 == 1:\n\n m += 1\n\n if m == 0:\n\n print((2**n if p == 0 else 0))\n\n else:\n\n print((2**(n-1)))\n\nif __name__ == '__main__':\n\n main()\n","target":"#from statistics import median\n\n#import collections\n\n#aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\n\nfrom fractions import gcd\n\nfrom itertools import combinations,permutations,accumulate # (string,3) 3\u56de\n\n#from collections import deque\n\nfrom collections import deque,defaultdict,Counter\n\nimport decimal\n\nimport re\n\n#import bisect\n\n#\n\n# d = m - k[i] - k[j]\n\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n\n#\n\n#\n\n#\n\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n\n#\n\n#\n\n# my_round_int = lambda x:np.round((x*2 + 1)\/\/2)\n\n# \u56db\u6368\u4e94\u5165\n\nimport sys\n\nsys.setrecursionlimit(10000000)\n\nmod = 10**9 + 7\n\n#mod = 9982443453\n\ndef readInts():\n\n return list(map(int,input().split()))\n\ndef I():\n\n return int(eval(input()))\n\nn,p = readInts()\n\nA = readInts()\n\nodd = 0\n\nfor i in range(n):\n\n # count odd numbers\n\n # you can use Binomial coefficient\n\n # if P = 0, you should calculate this in using an odd number of odd numbers\n\n # else even numbers\n\n if A[i]%2:\n\n odd += 1\n\nif odd == 0:\n\n if p == 0:\n\n print((2**n))\n\n else:\n\n print((0))\n\nelse:\n\n print((2**(n-1))) # 2**(n-1) = 2**(m-1) choosing odd * 2**(n-m) choosing even\n","code_v0_loc":38,"code_v1_loc":46,"code_v0_num_chars":828,"code_v1_num_chars":1158,"code_v0_no_empty_lines":"from statistics import median\n\n# import collections\n# aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\nfrom fractions import gcd\nfrom itertools import combinations # (string,3) 3\u56de\nfrom collections import deque\nfrom collections import defaultdict\nimport bisect\n\n#\n# d = m - k[i] - k[j]\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n#\n#\n#\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n#\n#\nimport sys\n\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n\n\ndef readInts():\n return list(map(int, input().split()))\n\n\ndef main():\n n, p = readInts()\n m = 0\n A = readInts()\n for i in range(n):\n a = A[i]\n if a % 2 == 1:\n m += 1\n if m == 0:\n print((2**n if p == 0 else 0))\n else:\n print((2 ** (n - 1)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# from statistics import median\n# import collections\n# aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\nfrom fractions import gcd\nfrom itertools import combinations, permutations, accumulate # (string,3) 3\u56de\n\n# from collections import deque\nfrom collections import deque, defaultdict, Counter\nimport decimal\nimport re\n\n# import bisect\n#\n# d = m - k[i] - k[j]\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n#\n#\n#\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n#\n#\n# my_round_int = lambda x:np.round((x*2 + 1)\/\/2)\n# \u56db\u6368\u4e94\u5165\nimport sys\n\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n# mod = 9982443453\ndef readInts():\n return list(map(int, input().split()))\n\n\ndef I():\n return int(eval(input()))\n\n\nn, p = readInts()\nA = readInts()\nodd = 0\nfor i in range(n):\n # count odd numbers\n # you can use Binomial coefficient\n # if P = 0, you should calculate this in using an odd number of odd numbers\n # else even numbers\n if A[i] % 2:\n odd += 1\nif odd == 0:\n if p == 0:\n print((2**n))\n else:\n print((0))\nelse:\n print((2 ** (n - 1))) # 2**(n-1) = 2**(m-1) choosing odd * 2**(n-m) choosing even\n","code_same":false,"relative_loc_diff_percent":17.3913043478,"diff":["-from statistics import median","-","+# from statistics import median","-from itertools import combinations # (string,3) 3\u56de","-from collections import deque","-from collections import defaultdict","-import bisect","+from itertools import combinations, permutations, accumulate # (string,3) 3\u56de","+# from collections import deque","+from collections import deque, defaultdict, Counter","+import decimal","+import re","+","+# import bisect","+# my_round_int = lambda x:np.round((x*2 + 1)\/\/2)","+# \u56db\u6368\u4e94\u5165","-","-","+# mod = 9982443453","-def main():","- n, p = readInts()","- m = 0","- A = readInts()","- for i in range(n):","- a = A[i]","- if a % 2 == 1:","- m += 1","- if m == 0:","- print((2**n if p == 0 else 0))","- else:","- print((2 ** (n - 1)))","+def I():","+ return int(eval(input()))","-if __name__ == \"__main__\":","- main()","+n, p = readInts()","+A = readInts()","+odd = 0","+for i in range(n):","+ # count odd numbers","+ # you can use Binomial coefficient","+ # if P = 0, you should calculate this in using an odd number of odd numbers","+ # else even numbers","+ if A[i] % 2:","+ odd += 1","+if odd == 0:","+ if p == 0:","+ print((2**n))","+ else:","+ print((0))","+else:","+ print((2 ** (n - 1))) # 2**(n-1) = 2**(m-1) choosing odd * 2**(n-m) choosing even"],"diff_only_import_comment":false,"measured_runtime_v0":0.0379434268,"measured_runtime_v1":0.0589498968,"runtime_lift":0.643655526,"key":["s020335641","s634037365"]} +{"user_id":"u761320129","problem_id":"p03651","language":"python","submission_id_v0":"s433258358","submission_id_v1":"s052742408","cpu_time_v0":129,"cpu_time_v1":101,"memory_v0":11320,"memory_v1":14224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.71,"input":"N,K = list(map(int,input().split()))\n\nsrc = list(map(int,input().split()))\n\n\n\ndef gcd(a,b):\n\n a,b = max(a,b),min(a,b)\n\n if b == 0:\n\n return a\n\n return gcd(b, a%b)\n\n\n\ndef solve():\n\n if N == 1: return src[0] == K\n\n mx = max(src)\n\n if K > mx: return False\n\n g = src[0]\n\n for i in range(1,N):\n\n g = gcd(g, src[i])\n\n if g == 1:\n\n return True\n\n return K % g == 0\n\n\n\nprint(('POSSIBLE' if solve() else 'IMPOSSIBLE'))","target":"N,K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nif K in A:\n\n print('POSSIBLE')\n\n exit()\n\nif max(A) < K:\n\n print('IMPOSSIBLE')\n\n exit()\n\n\n\nfrom fractions import gcd\n\ng = A[0]\n\nfor a in A[1:]:\n\n g = gcd(g,a)\n\nprint(('POSSIBLE' if K%g==0 else 'IMPOSSIBLE'))","code_v0_loc":21,"code_v1_loc":14,"code_v0_num_chars":426,"code_v1_num_chars":287,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nsrc = list(map(int, input().split()))\n\n\ndef gcd(a, b):\n a, b = max(a, b), min(a, b)\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\ndef solve():\n if N == 1:\n return src[0] == K\n mx = max(src)\n if K > mx:\n return False\n g = src[0]\n for i in range(1, N):\n g = gcd(g, src[i])\n if g == 1:\n return True\n return K % g == 0\n\n\nprint((\"POSSIBLE\" if solve() else \"IMPOSSIBLE\"))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nif K in A:\n print(\"POSSIBLE\")\n exit()\nif max(A) < K:\n print(\"IMPOSSIBLE\")\n exit()\nfrom fractions import gcd\n\ng = A[0]\nfor a in A[1:]:\n g = gcd(g, a)\nprint((\"POSSIBLE\" if K % g == 0 else \"IMPOSSIBLE\"))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-src = list(map(int, input().split()))","+A = list(map(int, input().split()))","+if K in A:","+ print(\"POSSIBLE\")","+ exit()","+if max(A) < K:","+ print(\"IMPOSSIBLE\")","+ exit()","+from fractions import gcd","-","-def gcd(a, b):","- a, b = max(a, b), min(a, b)","- if b == 0:","- return a","- return gcd(b, a % b)","-","-","-def solve():","- if N == 1:","- return src[0] == K","- mx = max(src)","- if K > mx:","- return False","- g = src[0]","- for i in range(1, N):","- g = gcd(g, src[i])","- if g == 1:","- return True","- return K % g == 0","-","-","-print((\"POSSIBLE\" if solve() else \"IMPOSSIBLE\"))","+g = A[0]","+for a in A[1:]:","+ g = gcd(g, a)","+print((\"POSSIBLE\" if K % g == 0 else \"IMPOSSIBLE\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1109087932,"measured_runtime_v1":0.0515528538,"runtime_lift":2.1513608843,"key":["s433258358","s052742408"]} +{"user_id":"u440161695","problem_id":"p02953","language":"python","submission_id_v0":"s645299149","submission_id_v1":"s044777492","cpu_time_v0":115,"cpu_time_v1":74,"memory_v0":14224,"memory_v1":14252,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.65,"input":"N=int(eval(input()))\n\nH=list(map(int,input().split()))\n\nif N==1:\n\n print(\"Yes\")\n\n exit()\n\nfor i in range(N-1):\n\n if H[i]-1<=H[i+1]:\n\n if i!=0:\n\n if H[i-1]H[i+1]:\n\n print(\"No\")\n\n exit()\n\nprint(\"Yes\")","target":"N=int(eval(input()))\n\nH=list(map(int,input().split()))\n\nif N==1:\n\n print(\"Yes\")\n\n exit()\n\nif H[0]H[1]:\n\n print(\"No\")\n\n exit()\n\nfor i in range(1,N):\n\n if H[i-1]H[i]:\n\n print(\"No\")\n\n exit()\n\nprint(\"Yes\")","code_v0_loc":20,"code_v1_loc":17,"code_v0_num_chars":340,"code_v1_num_chars":270,"code_v0_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\nif N == 1:\n print(\"Yes\")\n exit()\nfor i in range(N - 1):\n if H[i] - 1 <= H[i + 1]:\n if i != 0:\n if H[i - 1] < H[i]:\n H[i] -= 1\n elif H[i] == H[i + 1]:\n continue\n else:\n print(\"No\")\n exit()\nfor i in range(N - 1):\n if H[i] > H[i + 1]:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\nif N == 1:\n print(\"Yes\")\n exit()\nif H[0] < H[1]:\n H[0] -= 1\nelif H[0] > H[1]:\n print(\"No\")\n exit()\nfor i in range(1, N):\n if H[i - 1] < H[i]:\n H[i] -= 1\n elif H[i - 1] > H[i]:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-for i in range(N - 1):","- if H[i] - 1 <= H[i + 1]:","- if i != 0:","- if H[i - 1] < H[i]:","- H[i] -= 1","- elif H[i] == H[i + 1]:","- continue","- else:","- print(\"No\")","- exit()","-for i in range(N - 1):","- if H[i] > H[i + 1]:","+if H[0] < H[1]:","+ H[0] -= 1","+elif H[0] > H[1]:","+ print(\"No\")","+ exit()","+for i in range(1, N):","+ if H[i - 1] < H[i]:","+ H[i] -= 1","+ elif H[i - 1] > H[i]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.036456615,"measured_runtime_v1":0.0365215812,"runtime_lift":0.9982211556,"key":["s645299149","s044777492"]} +{"user_id":"u746428948","problem_id":"p02701","language":"python","submission_id_v0":"s161455141","submission_id_v1":"s960267949","cpu_time_v0":356,"cpu_time_v1":301,"memory_v0":25388,"memory_v1":31212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.45,"input":"n = int(eval(input()))\n\ns = []\n\nans = n\n\nfor i in range(n):\n\n s.append(eval(input()))\n\ns = sorted(s)\n\nfor i in range(1,n):\n\n if s[i] == s[i-1]:\n\n ans-=1\n\nprint(ans)","target":"n = int(eval(input()))\n\ns = set([])\n\nfor i in range(n):\n\n s.add(eval(input()))\n\nprint((len(s)))","code_v0_loc":10,"code_v1_loc":5,"code_v0_num_chars":165,"code_v1_num_chars":84,"code_v0_no_empty_lines":"n = int(eval(input()))\ns = []\nans = n\nfor i in range(n):\n s.append(eval(input()))\ns = sorted(s)\nfor i in range(1, n):\n if s[i] == s[i - 1]:\n ans -= 1\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = set([])\nfor i in range(n):\n s.add(eval(input()))\nprint((len(s)))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-s = []","-ans = n","+s = set([])","- s.append(eval(input()))","-s = sorted(s)","-for i in range(1, n):","- if s[i] == s[i - 1]:","- ans -= 1","-print(ans)","+ s.add(eval(input()))","+print((len(s)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1179550228,"measured_runtime_v1":0.039575088,"runtime_lift":2.9805372185,"key":["s161455141","s960267949"]} +{"user_id":"u523087093","problem_id":"p04045","language":"python","submission_id_v0":"s284094619","submission_id_v1":"s968240137","cpu_time_v0":135,"cpu_time_v1":106,"memory_v0":9124,"memory_v1":9212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":21.48,"input":"import itertools\n\n\n\nN, K = list(map(int, input().split())) # N\u5186\u306e\u54c1\u7269\u3001K\u500b\u306e\u5acc\u3044\u306a\u6570\u5b57\n\nD = set(list(map(int, input().split()))) # \u5acc\u3044\u306a\u6570\u5b57\u306e\u30ea\u30b9\u30c8\n\nbase = set(range(10))\n\n\n\ntarget_num = base - D\n\nketa = len(str(N))\n\n\n\nanswer = float('inf')\n\nfor p in itertools.product(target_num, repeat=keta):\n\n temp = 0\n\n for i, num in enumerate(p):\n\n temp += num * 10**i\n\n \n\n if temp >= N:\n\n answer = min(answer, temp)\n\n\n\nfor p in itertools.product(target_num, repeat=keta+1):\n\n temp = 0\n\n for i, num in enumerate(p):\n\n temp += num * 10**i\n\n \n\n if temp >= N:\n\n answer = min(answer, temp)\n\n\n\nprint(answer)","target":"import itertools\n\n\n\ndef cal(N, target_num, keta):\n\n answer = float('inf')\n\n for p in itertools.product(target_num, repeat=keta):\n\n temp = 0\n\n for i, num in enumerate(p):\n\n temp += num * 10**i\n\n \n\n if temp >= N:\n\n answer = min(answer, temp)\n\n\n\n return answer\n\n\n\nif __name__ == \"__main__\":\n\n N, K = list(map(int, input().split())) # N\u5186\u306e\u54c1\u7269\u3001K\u500b\u306e\u5acc\u3044\u306a\u6570\u5b57\n\n D = set(list(map(int, input().split()))) # \u5acc\u3044\u306a\u6570\u5b57\u306e\u30ea\u30b9\u30c8\n\n base = set(range(10))\n\n\n\n target_num = base - D\n\n keta = len(str(N))\n\n\n\n answer = min(cal(N, target_num, keta), cal(N, target_num, keta+1))\n\n\n\n print(answer)","code_v0_loc":27,"code_v1_loc":25,"code_v0_num_chars":627,"code_v1_num_chars":638,"code_v0_no_empty_lines":"import itertools\n\nN, K = list(map(int, input().split())) # N\u5186\u306e\u54c1\u7269\u3001K\u500b\u306e\u5acc\u3044\u306a\u6570\u5b57\nD = set(list(map(int, input().split()))) # \u5acc\u3044\u306a\u6570\u5b57\u306e\u30ea\u30b9\u30c8\nbase = set(range(10))\ntarget_num = base - D\nketa = len(str(N))\nanswer = float(\"inf\")\nfor p in itertools.product(target_num, repeat=keta):\n temp = 0\n for i, num in enumerate(p):\n temp += num * 10**i\n if temp >= N:\n answer = min(answer, temp)\nfor p in itertools.product(target_num, repeat=keta + 1):\n temp = 0\n for i, num in enumerate(p):\n temp += num * 10**i\n if temp >= N:\n answer = min(answer, temp)\nprint(answer)\n","code_v1_no_empty_lines":"import itertools\n\n\ndef cal(N, target_num, keta):\n answer = float(\"inf\")\n for p in itertools.product(target_num, repeat=keta):\n temp = 0\n for i, num in enumerate(p):\n temp += num * 10**i\n if temp >= N:\n answer = min(answer, temp)\n return answer\n\n\nif __name__ == \"__main__\":\n N, K = list(map(int, input().split())) # N\u5186\u306e\u54c1\u7269\u3001K\u500b\u306e\u5acc\u3044\u306a\u6570\u5b57\n D = set(list(map(int, input().split()))) # \u5acc\u3044\u306a\u6570\u5b57\u306e\u30ea\u30b9\u30c8\n base = set(range(10))\n target_num = base - D\n keta = len(str(N))\n answer = min(cal(N, target_num, keta), cal(N, target_num, keta + 1))\n print(answer)\n","code_same":false,"relative_loc_diff_percent":7.4074074074,"diff":["-N, K = list(map(int, input().split())) # N\u5186\u306e\u54c1\u7269\u3001K\u500b\u306e\u5acc\u3044\u306a\u6570\u5b57","-D = set(list(map(int, input().split()))) # \u5acc\u3044\u306a\u6570\u5b57\u306e\u30ea\u30b9\u30c8","-base = set(range(10))","-target_num = base - D","-keta = len(str(N))","-answer = float(\"inf\")","-for p in itertools.product(target_num, repeat=keta):","- temp = 0","- for i, num in enumerate(p):","- temp += num * 10**i","- if temp >= N:","- answer = min(answer, temp)","-for p in itertools.product(target_num, repeat=keta + 1):","- temp = 0","- for i, num in enumerate(p):","- temp += num * 10**i","- if temp >= N:","- answer = min(answer, temp)","-print(answer)","+","+def cal(N, target_num, keta):","+ answer = float(\"inf\")","+ for p in itertools.product(target_num, repeat=keta):","+ temp = 0","+ for i, num in enumerate(p):","+ temp += num * 10**i","+ if temp >= N:","+ answer = min(answer, temp)","+ return answer","+","+","+if __name__ == \"__main__\":","+ N, K = list(map(int, input().split())) # N\u5186\u306e\u54c1\u7269\u3001K\u500b\u306e\u5acc\u3044\u306a\u6570\u5b57","+ D = set(list(map(int, input().split()))) # \u5acc\u3044\u306a\u6570\u5b57\u306e\u30ea\u30b9\u30c8","+ base = set(range(10))","+ target_num = base - D","+ keta = len(str(N))","+ answer = min(cal(N, target_num, keta), cal(N, target_num, keta + 1))","+ print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0478165627,"measured_runtime_v1":0.048504734,"runtime_lift":0.9858122839,"key":["s284094619","s968240137"]} +{"user_id":"u771365068","problem_id":"p03339","language":"python","submission_id_v0":"s204384968","submission_id_v1":"s502735204","cpu_time_v0":228,"cpu_time_v1":183,"memory_v0":3700,"memory_v1":3700,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.74,"input":"\n\nN = int(eval(input()))\n\nS = eval(input())\n\n\n\ntmp = 0\n\n\n\nfor s in S[1:]:\n\n if s == 'E':\n\n tmp += 1\n\n \n\n\n\nminimum = tmp\n\n\n\nfor i in range(1, N):\n\n if S[i-1] == 'W':\n\n tmp += 1\n\n if S[i] == 'E':\n\n tmp -= 1\n\n minimum = min(tmp, minimum)\n\n\n\nprint(minimum)\n","target":"N = int(eval(input()))\n\nS = eval(input())\n\n\n\ntmp = S[1:].count('E')\n\n \n\nminimum = tmp\n\n\n\nfor i in range(1, N):\n\n if S[i-1] == 'W':\n\n tmp += 1\n\n if S[i] == 'E':\n\n tmp -= 1\n\n minimum = min(tmp, minimum)\n\n\n\nprint(minimum)\n","code_v0_loc":21,"code_v1_loc":15,"code_v0_num_chars":275,"code_v1_num_chars":231,"code_v0_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\ntmp = 0\nfor s in S[1:]:\n if s == \"E\":\n tmp += 1\nminimum = tmp\nfor i in range(1, N):\n if S[i - 1] == \"W\":\n tmp += 1\n if S[i] == \"E\":\n tmp -= 1\n minimum = min(tmp, minimum)\nprint(minimum)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\ntmp = S[1:].count(\"E\")\nminimum = tmp\nfor i in range(1, N):\n if S[i - 1] == \"W\":\n tmp += 1\n if S[i] == \"E\":\n tmp -= 1\n minimum = min(tmp, minimum)\nprint(minimum)\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-tmp = 0","-for s in S[1:]:","- if s == \"E\":","- tmp += 1","+tmp = S[1:].count(\"E\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0507626534,"measured_runtime_v1":0.0495591164,"runtime_lift":1.0242848756,"key":["s204384968","s502735204"]} +{"user_id":"u323680411","problem_id":"p03785","language":"python","submission_id_v0":"s583046845","submission_id_v1":"s670015799","cpu_time_v0":216,"cpu_time_v1":114,"memory_v0":8280,"memory_v1":8280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.22,"input":"def main() -> None:\n\n n, c, k = list(map(int, input().split()))\n\n t = [int(eval(input())) for _ in range(n)]\n\n ans = wait_start = wait_people = 0\n\n\n\n for ti in sorted(t):\n\n if ti - wait_start > k or wait_people == c:\n\n wait_people = 0\n\n wait_people += 1\n\n\n\n if wait_people == 1:\n\n wait_start = ti\n\n ans += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\n\n\ndef main() -> None:\n\n n, c, k = list(map(int, input().split()))\n\n t = [int(sys.stdin.readline()) for _ in range(n)]\n\n ans = wait_start = wait_people = 0\n\n\n\n for ti in sorted(t):\n\n if ti - wait_start > k or wait_people == c:\n\n wait_people = 0\n\n wait_people += 1\n\n\n\n if wait_people == 1:\n\n wait_start = ti\n\n ans += 1\n\n\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":19,"code_v1_loc":21,"code_v0_num_chars":424,"code_v1_num_chars":451,"code_v0_no_empty_lines":"def main() -> None:\n n, c, k = list(map(int, input().split()))\n t = [int(eval(input())) for _ in range(n)]\n ans = wait_start = wait_people = 0\n for ti in sorted(t):\n if ti - wait_start > k or wait_people == c:\n wait_people = 0\n wait_people += 1\n if wait_people == 1:\n wait_start = ti\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\n\ndef main() -> None:\n n, c, k = list(map(int, input().split()))\n t = [int(sys.stdin.readline()) for _ in range(n)]\n ans = wait_start = wait_people = 0\n for ti in sorted(t):\n if ti - wait_start > k or wait_people == c:\n wait_people = 0\n wait_people += 1\n if wait_people == 1:\n wait_start = ti\n ans += 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":9.5238095238,"diff":["+import sys","+","+","- t = [int(eval(input())) for _ in range(n)]","+ t = [int(sys.stdin.readline()) for _ in range(n)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0385151076,"measured_runtime_v1":0.0382201838,"runtime_lift":1.0077164384,"key":["s583046845","s670015799"]} +{"user_id":"u312025627","problem_id":"p03286","language":"python","submission_id_v0":"s167811746","submission_id_v1":"s532235385","cpu_time_v0":183,"cpu_time_v1":166,"memory_v0":38384,"memory_v1":40048,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.29,"input":"def main():\n\n N = int(eval(input()))\n\n\n\n def to_bin(n):\n\n \"\"\"\n\n n:10\u9032\u6570 -> 2\u9032\u6570\n\n \"\"\"\n\n if n == 0:\n\n return 0\n\n digits = []\n\n i = 0\n\n base = 1\n\n while n != 0:\n\n if n % (base*2) == 0:\n\n digits.append(\"0\")\n\n else:\n\n digits.append(\"1\")\n\n n -= base\n\n i += 1\n\n base *= -2\n\n return \"\".join(digits[::-1])\n\n\n\n print((to_bin(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n N = int(eval(input()))\n\n\n\n def to_bin(n):\n\n \"\"\"\n\n n:10\u9032\u6570 -> 2\u9032\u6570\n\n \"\"\"\n\n if n == 0:\n\n return 0\n\n digits = []\n\n i = 0\n\n base = 1\n\n while n != 0:\n\n if n % (base*-2) == 0:\n\n digits.append(\"0\")\n\n else:\n\n digits.append(\"1\")\n\n n -= base\n\n i += 1\n\n base *= -2\n\n return \"\".join(digits[::-1])\n\n\n\n print((to_bin(N)))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":27,"code_v1_loc":27,"code_v0_num_chars":527,"code_v1_num_chars":528,"code_v0_no_empty_lines":"def main():\n N = int(eval(input()))\n\n def to_bin(n):\n \"\"\"\n n:10\u9032\u6570 -> 2\u9032\u6570\n \"\"\"\n if n == 0:\n return 0\n digits = []\n i = 0\n base = 1\n while n != 0:\n if n % (base * 2) == 0:\n digits.append(\"0\")\n else:\n digits.append(\"1\")\n n -= base\n i += 1\n base *= -2\n return \"\".join(digits[::-1])\n\n print((to_bin(N)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n N = int(eval(input()))\n\n def to_bin(n):\n \"\"\"\n n:10\u9032\u6570 -> 2\u9032\u6570\n \"\"\"\n if n == 0:\n return 0\n digits = []\n i = 0\n base = 1\n while n != 0:\n if n % (base * -2) == 0:\n digits.append(\"0\")\n else:\n digits.append(\"1\")\n n -= base\n i += 1\n base *= -2\n return \"\".join(digits[::-1])\n\n print((to_bin(N)))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- if n % (base * 2) == 0:","+ if n % (base * -2) == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0489326034,"measured_runtime_v1":0.0488713236,"runtime_lift":1.0012539002,"key":["s167811746","s532235385"]} +{"user_id":"u912237403","problem_id":"p00120","language":"python","submission_id_v0":"s588214491","submission_id_v1":"s448364965","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4316,"memory_v1":4316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"import sys\n\nfor s in sys.stdin:\n\n a=list(map(int,s.split(\" \")))\n\n w=a[0]\n\n a=sorted(a[1:])\n\n A=[]\n\n try:\n\n while a:\n\n A+=[a.pop(0)]\n\n A=[a.pop()]+A\n\n A+=[a.pop()]\n\n A=[a.pop(0)]+A\n\n except: pass\n\n a=A[0]+A[-1]\n\n for i in range(len(A)-1): a+=2*(A[i]*A[i+1])**.5\n\n print([\"OK\",\"NA\"][a>w])","target":"import sys\n\nfor s in sys.stdin:\n\n a=list(map(int,s.split(\" \")))\n\n w=a[0]\n\n a=sorted(a[1:])\n\n A=[]\n\n while a:\n\n A+=[a.pop(0)]\n\n if a==[]: break\n\n A=[a.pop()]+A\n\n if a==[]: break\n\n A+=[a.pop()]\n\n if a==[]: break\n\n A=[a.pop(0)]+A\n\n a=A[0]+A[-1]\n\n for i in range(len(A)-1): a+=2*(A[i]*A[i+1])**.5\n\n print([\"OK\",\"NA\"][a>w])","code_v0_loc":16,"code_v1_loc":17,"code_v0_num_chars":311,"code_v1_num_chars":340,"code_v0_no_empty_lines":"import sys\n\nfor s in sys.stdin:\n a = list(map(int, s.split(\" \")))\n w = a[0]\n a = sorted(a[1:])\n A = []\n try:\n while a:\n A += [a.pop(0)]\n A = [a.pop()] + A\n A += [a.pop()]\n A = [a.pop(0)] + A\n except:\n pass\n a = A[0] + A[-1]\n for i in range(len(A) - 1):\n a += 2 * (A[i] * A[i + 1]) ** 0.5\n print([\"OK\", \"NA\"][a > w])\n","code_v1_no_empty_lines":"import sys\n\nfor s in sys.stdin:\n a = list(map(int, s.split(\" \")))\n w = a[0]\n a = sorted(a[1:])\n A = []\n while a:\n A += [a.pop(0)]\n if a == []:\n break\n A = [a.pop()] + A\n if a == []:\n break\n A += [a.pop()]\n if a == []:\n break\n A = [a.pop(0)] + A\n a = A[0] + A[-1]\n for i in range(len(A) - 1):\n a += 2 * (A[i] * A[i + 1]) ** 0.5\n print([\"OK\", \"NA\"][a > w])\n","code_same":false,"relative_loc_diff_percent":5.8823529412,"diff":["- try:","- while a:","- A += [a.pop(0)]","- A = [a.pop()] + A","- A += [a.pop()]","- A = [a.pop(0)] + A","- except:","- pass","+ while a:","+ A += [a.pop(0)]","+ if a == []:","+ break","+ A = [a.pop()] + A","+ if a == []:","+ break","+ A += [a.pop()]","+ if a == []:","+ break","+ A = [a.pop(0)] + A"],"diff_only_import_comment":false,"measured_runtime_v0":0.1823430796,"measured_runtime_v1":0.0436967103,"runtime_lift":4.1729246452,"key":["s588214491","s448364965"]} +{"user_id":"u189479417","problem_id":"p03317","language":"python","submission_id_v0":"s456844924","submission_id_v1":"s170780368","cpu_time_v0":41,"cpu_time_v1":17,"memory_v0":13812,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":58.54,"input":"import math\n\nN, K = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nprint((math.ceil((N-1)\/(K-1))))","target":"import math\n\nN, K = list(map(int,input().split()))\n\nprint((math.ceil((N-1)\/(K-1))))","code_v0_loc":4,"code_v1_loc":3,"code_v0_num_chars":111,"code_v1_num_chars":75,"code_v0_no_empty_lines":"import math\n\nN, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nprint((math.ceil((N - 1) \/ (K - 1))))\n","code_v1_no_empty_lines":"import math\n\nN, K = list(map(int, input().split()))\nprint((math.ceil((N - 1) \/ (K - 1))))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-A = list(map(int, input().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0358728592,"measured_runtime_v1":0.0341049912,"runtime_lift":1.0518360501,"key":["s456844924","s170780368"]} +{"user_id":"u467736898","problem_id":"p02670","language":"python","submission_id_v0":"s716908770","submission_id_v1":"s841113773","cpu_time_v0":1399,"cpu_time_v1":916,"memory_v0":123004,"memory_v1":123328,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.52,"input":"import numba\n\nimport numpy as np\n\nN = int(eval(input()))\n\nP = np.array([int(c)-1 for c in input().split()])\n\n\n\n#from random import shuffle\n\n#N = 500\n\n#P = list(range(N*N))\n\n#shuffle(P)\n\n#P = np.array(P)\n\n\n\n@numba.njit(\"i8(i8,i8[:])\", cache=True)\n\ndef proc(N, P):\n\n ans = 0\n\n Removed = np.zeros((500, 500), dtype=np.int8)\n\n Mat = np.zeros((500, 500), dtype=np.int16)\n\n Dy, Dx = np.array([1,0,-1,0]), np.array([0,1,0,-1])\n\n\n\n for y in range(N):\n\n for x in range(N):\n\n Mat[y, x] = min(y, N-1-y, x, N-1-x)\n\n #print(Mat)\n\n Buf = [(0, 0) for _ in range(1<<17)]\n\n Buf_idx = 0\n\n for i in range(N*N):\n\n p = P[i]\n\n y, x = divmod(p, N)\n\n ans += Mat[y,x]\n\n Removed[y,x] = 1\n\n Buf[Buf_idx] = (y, x)\n\n Buf_idx += 1\n\n while Buf_idx:\n\n Buf_idx -= 1\n\n vy, vx = Buf[Buf_idx]\n\n vr = Removed[vy,vx]\n\n val = Mat[vy,vx]\n\n #for dy, dx in zip(Dy, Dx):\n\n for j in range(4):\n\n uy, ux = vy + Dy[j], vx + Dx[j]\n\n if not (0<=uy= val+1:\n\n Mat[uy,ux] = val\n\n Buf[Buf_idx] = (uy, ux)\n\n Buf_idx += 1\n\n else:\n\n if Mat[uy,ux] >= val+2:\n\n Mat[uy,ux] = val+1\n\n Buf[Buf_idx] = (uy, ux)\n\n Buf_idx += 1\n\n # for m in Mat:\n\n # print(m)\n\n return ans\n\nprint((proc(N, P)))\n\n\n","target":"import sys\n\nimport numpy as np\n\nfrom numba import njit\n\n \n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\n\n\n@njit(\"i4(i4,i4[:])\", cache=True)\n\ndef proc(N, P):\n\n ans = 0\n\n Removed = np.zeros((500, 500), dtype=np.int8)\n\n Mat = np.zeros((500, 500), dtype=np.int16)\n\n Dy, Dx = np.array([1,0,-1,0]), np.array([0,1,0,-1])\n\n\n\n for y in range(N):\n\n for x in range(N):\n\n Mat[y, x] = min(y, N-1-y, x, N-1-x)\n\n #print(Mat)\n\n Buf = [(0, 0) for _ in range(1<<17)]\n\n Buf_idx = 0\n\n for i in range(N*N):\n\n p = P[i]\n\n y, x = divmod(p, N)\n\n ans += Mat[y,x]\n\n Removed[y,x] = 1\n\n Buf[Buf_idx] = (y, x)\n\n Buf_idx += 1\n\n while Buf_idx:\n\n Buf_idx -= 1\n\n vy, vx = Buf[Buf_idx]\n\n vr = Removed[vy,vx]\n\n val = Mat[vy,vx]\n\n #for dy, dx in zip(Dy, Dx):\n\n for j in range(4):\n\n uy, ux = vy + Dy[j], vx + Dx[j]\n\n if not (0<=uy= val+1:\n\n Mat[uy,ux] = val\n\n Buf[Buf_idx] = (uy, ux)\n\n Buf_idx += 1\n\n else:\n\n if Mat[uy,ux] >= val+2:\n\n Mat[uy,ux] = val+1\n\n Buf[Buf_idx] = (uy, ux)\n\n Buf_idx += 1\n\n return ans\n\n\n\nN = int(readline())\n\nP = np.array(read().split(), np.int32)-1\n\n \n\nprint((proc(N, P)))","code_v0_loc":57,"code_v1_loc":56,"code_v0_num_chars":1641,"code_v1_num_chars":1630,"code_v0_no_empty_lines":"import numba\nimport numpy as np\n\nN = int(eval(input()))\nP = np.array([int(c) - 1 for c in input().split()])\n# from random import shuffle\n# N = 500\n# P = list(range(N*N))\n# shuffle(P)\n# P = np.array(P)\n@numba.njit(\"i8(i8,i8[:])\", cache=True)\ndef proc(N, P):\n ans = 0\n Removed = np.zeros((500, 500), dtype=np.int8)\n Mat = np.zeros((500, 500), dtype=np.int16)\n Dy, Dx = np.array([1, 0, -1, 0]), np.array([0, 1, 0, -1])\n for y in range(N):\n for x in range(N):\n Mat[y, x] = min(y, N - 1 - y, x, N - 1 - x)\n # print(Mat)\n Buf = [(0, 0) for _ in range(1 << 17)]\n Buf_idx = 0\n for i in range(N * N):\n p = P[i]\n y, x = divmod(p, N)\n ans += Mat[y, x]\n Removed[y, x] = 1\n Buf[Buf_idx] = (y, x)\n Buf_idx += 1\n while Buf_idx:\n Buf_idx -= 1\n vy, vx = Buf[Buf_idx]\n vr = Removed[vy, vx]\n val = Mat[vy, vx]\n # for dy, dx in zip(Dy, Dx):\n for j in range(4):\n uy, ux = vy + Dy[j], vx + Dx[j]\n if not (0 <= uy < N and 0 <= ux < N):\n continue\n ur = Removed[uy, ux]\n if vr:\n if Mat[uy, ux] >= val + 1:\n Mat[uy, ux] = val\n Buf[Buf_idx] = (uy, ux)\n Buf_idx += 1\n else:\n if Mat[uy, ux] >= val + 2:\n Mat[uy, ux] = val + 1\n Buf[Buf_idx] = (uy, ux)\n Buf_idx += 1\n # for m in Mat:\n # print(m)\n return ans\n\n\nprint((proc(N, P)))\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\nfrom numba import njit\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\n@njit(\"i4(i4,i4[:])\", cache=True)\ndef proc(N, P):\n ans = 0\n Removed = np.zeros((500, 500), dtype=np.int8)\n Mat = np.zeros((500, 500), dtype=np.int16)\n Dy, Dx = np.array([1, 0, -1, 0]), np.array([0, 1, 0, -1])\n for y in range(N):\n for x in range(N):\n Mat[y, x] = min(y, N - 1 - y, x, N - 1 - x)\n # print(Mat)\n Buf = [(0, 0) for _ in range(1 << 17)]\n Buf_idx = 0\n for i in range(N * N):\n p = P[i]\n y, x = divmod(p, N)\n ans += Mat[y, x]\n Removed[y, x] = 1\n Buf[Buf_idx] = (y, x)\n Buf_idx += 1\n while Buf_idx:\n Buf_idx -= 1\n vy, vx = Buf[Buf_idx]\n vr = Removed[vy, vx]\n val = Mat[vy, vx]\n # for dy, dx in zip(Dy, Dx):\n for j in range(4):\n uy, ux = vy + Dy[j], vx + Dx[j]\n if not (0 <= uy < N and 0 <= ux < N):\n continue\n ur = Removed[uy, ux]\n if vr:\n if Mat[uy, ux] >= val + 1:\n Mat[uy, ux] = val\n Buf[Buf_idx] = (uy, ux)\n Buf_idx += 1\n else:\n if Mat[uy, ux] >= val + 2:\n Mat[uy, ux] = val + 1\n Buf[Buf_idx] = (uy, ux)\n Buf_idx += 1\n return ans\n\n\nN = int(readline())\nP = np.array(read().split(), np.int32) - 1\nprint((proc(N, P)))\n","code_same":false,"relative_loc_diff_percent":1.7543859649,"diff":["-import numba","+import sys","+from numba import njit","-N = int(eval(input()))","-P = np.array([int(c) - 1 for c in input().split()])","-# from random import shuffle","-# N = 500","-# P = list(range(N*N))","-# shuffle(P)","-# P = np.array(P)","-@numba.njit(\"i8(i8,i8[:])\", cache=True)","+read = sys.stdin.buffer.read","+readline = sys.stdin.buffer.readline","+readlines = sys.stdin.buffer.readlines","+","+","+@njit(\"i4(i4,i4[:])\", cache=True)","- # for m in Mat:","- # print(m)","+N = int(readline())","+P = np.array(read().split(), np.int32) - 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0438450972,"measured_runtime_v1":0.5805710375,"runtime_lift":0.0755206416,"key":["s716908770","s841113773"]} +{"user_id":"u971632623","problem_id":"p02781","language":"python","submission_id_v0":"s299597701","submission_id_v1":"s209455335","cpu_time_v0":61,"cpu_time_v1":30,"memory_v0":10092,"memory_v1":9216,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.82,"input":"import sys\n\nsys.setrecursionlimit(10000)\n\n\n\nn = eval(input())\n\nk = int(eval(input()))\n\nm = {}\n\n\n\n\n\ndef doit(n, k):\n\n if len(n) == 0:\n\n return k == 0\n\n d = int(n[0])\n\n if (n, k) not in m:\n\n ret = 0\n\n for i in range(d + 1):\n\n if i == d:\n\n ret += doit(n[1:], k - 1 if i > 0 else k)\n\n else:\n\n ret += doit('9' * (len(n) - 1), k - 1 if i > 0 else k)\n\n m[(n, k)] = ret\n\n return m[(n, k)]\n\n\n\n\n\nprint((doit(n, k)))\n","target":"import sys\n\nsys.setrecursionlimit(303)\n\n\n\n\n\ndef doit(n, k, m):\n\n if len(n) == 0 or k < 0:\n\n return k == 0\n\n if (n, k) not in m:\n\n d = int(n[0])\n\n m[(n, k)] = sum(doit(n[1:] if i == d else '9' * (len(n) - 1), k - 1 if i > 0 else k, m) for i in range(d + 1))\n\n return m[(n, k)]\n\n\n\n\n\nprint((doit(eval(input()), int(eval(input())), {})))\n","code_v0_loc":24,"code_v1_loc":14,"code_v0_num_chars":484,"code_v1_num_chars":350,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10000)\nn = eval(input())\nk = int(eval(input()))\nm = {}\n\n\ndef doit(n, k):\n if len(n) == 0:\n return k == 0\n d = int(n[0])\n if (n, k) not in m:\n ret = 0\n for i in range(d + 1):\n if i == d:\n ret += doit(n[1:], k - 1 if i > 0 else k)\n else:\n ret += doit(\"9\" * (len(n) - 1), k - 1 if i > 0 else k)\n m[(n, k)] = ret\n return m[(n, k)]\n\n\nprint((doit(n, k)))\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(303)\n\n\ndef doit(n, k, m):\n if len(n) == 0 or k < 0:\n return k == 0\n if (n, k) not in m:\n d = int(n[0])\n m[(n, k)] = sum(\n doit(n[1:] if i == d else \"9\" * (len(n) - 1), k - 1 if i > 0 else k, m)\n for i in range(d + 1)\n )\n return m[(n, k)]\n\n\nprint((doit(eval(input()), int(eval(input())), {})))\n","code_same":false,"relative_loc_diff_percent":41.6666666667,"diff":["-sys.setrecursionlimit(10000)","-n = eval(input())","-k = int(eval(input()))","-m = {}","+sys.setrecursionlimit(303)","-def doit(n, k):","- if len(n) == 0:","+def doit(n, k, m):","+ if len(n) == 0 or k < 0:","- d = int(n[0])","- ret = 0","- for i in range(d + 1):","- if i == d:","- ret += doit(n[1:], k - 1 if i > 0 else k)","- else:","- ret += doit(\"9\" * (len(n) - 1), k - 1 if i > 0 else k)","- m[(n, k)] = ret","+ d = int(n[0])","+ m[(n, k)] = sum(","+ doit(n[1:] if i == d else \"9\" * (len(n) - 1), k - 1 if i > 0 else k, m)","+ for i in range(d + 1)","+ )","-print((doit(n, k)))","+print((doit(eval(input()), int(eval(input())), {})))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0357577772,"measured_runtime_v1":0.0373716924,"runtime_lift":0.9568145002,"key":["s299597701","s209455335"]} +{"user_id":"u120233192","problem_id":"p02948","language":"python","submission_id_v0":"s236967200","submission_id_v1":"s375715449","cpu_time_v0":557,"cpu_time_v1":207,"memory_v0":40104,"memory_v1":25444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.84,"input":"# 3.4.3\n\n\n\nimport re\n\nfrom collections import deque\n\nfrom functools import reduce\n\nfrom heapq import heappop\n\nfrom heapq import heappush\n\nfrom itertools import permutations\n\nfrom math import pi\n\nfrom operator import itemgetter\n\nfrom operator import mul\n\nfrom operator import xor\n\nfrom os import linesep\n\nfrom sys import stdin\n\n\n\n\n\ndef rline() -> str:\n\n return stdin.readline().strip()\n\n\n\n\n\ndef rlines(hint: int = 1):\n\n ret = ['' for i in range(hint)]\n\n for i in range(hint):\n\n ret[i] = rline()\n\n return ret\n\n\n\n\n\ndef htokens(hint: int = 1):\n\n lns = rlines(hint)\n\n ret = list([ln.split() for ln in lns])\n\n return ret\n\n\n\n\n\ndef vtokens(hint: int = 1):\n\n m, _ = htokens()\n\n wint = len(m)\n\n ret = [[None] * hint for i in range(wint)]\n\n for y in range(hint):\n\n if y != 0:\n\n m, _ = htokens()\n\n # convert horizontal to vertical\n\n x = 0\n\n for v in m:\n\n ret[x][y] = v\n\n x += 1\n\n # if return value has one and only one element(list),\n\n if wint == 1:\n\n # then add an empty list.\n\n ret.append([])\n\n return ret\n\n\n\n\n\ndef rint(radix: int = 10) -> int:\n\n return int(rline(), radix)\n\n\n\n\n\ndef hints(hint: int = 1, radix: int = 10):\n\n ret = htokens(hint)\n\n for i in range(len(ret)):\n\n ret[i] = list([int(v, radix) for v in ret[i]])\n\n return ret\n\n\n\n\n\ndef vints(hint: int = 1, radix: int = 10):\n\n ret = vtokens(hint)\n\n for i in range(len(ret)):\n\n ret[i] = list([int(v, radix) for v in ret[i]])\n\n return ret\n\n\n\n\n\ndef mat(hint: int, wint: int):\n\n return [[None]*wint for i in range(hint)]\n\n\n\n\n\ndef filllist(lst, value: int) -> None:\n\n # destructive.\n\n for i in range(len(lst)):\n\n lst[i] = value\n\n\n\n\n\ndef isprime(n: int) -> bool:\n\n if n <= 1:\n\n return False\n\n if n in (2, 3, 5):\n\n return True\n\n if n % 2 == 0:\n\n return False\n\n if n % 3 == 0:\n\n return False\n\n lst = int(n**0.5)\n\n f = 5\n\n while f <= lst:\n\n if n % f == 0:\n\n return False\n\n if n % (f + 2) == 0:\n\n return False\n\n f += 6\n\n return True\n\n\n\n\n\ndef strmat(matrix, lnsep: str = linesep, fieldsep: str = ' ') -> str:\n\n return lnsep.join([fieldsep.join(map(str, row)) for row in matrix])\n\n\n\n\n\ndef strbool(boolval: int) -> str:\n\n return ['No', 'Yes'][boolval]\n\n\n\n\n\ndef solve() -> None:\n\n # read here\n\n (n, m) = hints()[0]\n\n ab_s = hints(n)\n\n\n\n # solve here\n\n\n\n # delay asc, prize desc\n\n ab_s.sort(key=itemgetter(1), reverse=True)\n\n ab_s.sort(key=itemgetter(0), reverse=False)\n\n\n\n ans = 0\n\n tasks = []\n\n ti = 0\n\n for t in range(m + 1):\n\n # from (m days after) to today\n\n while ti < n and ab_s[ti][0] == t:\n\n a, b = ab_s[ti]\n\n ti += 1\n\n heappush(tasks, -b)\n\n if tasks:\n\n # do task\n\n ans -= heappop(tasks)\n\n\n\n # print here\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","target":"# 3.4.3\n\n\n\nimport re\n\nfrom collections import deque\n\nfrom functools import reduce\n\nfrom heapq import *\n\nfrom itertools import permutations\n\nfrom math import pi\n\nfrom operator import itemgetter\n\nfrom operator import mul\n\nfrom operator import xor\n\nfrom os import linesep\n\n\n\n\n\ndef isprime(n: int) -> bool:\n\n if n <= 1:\n\n return False\n\n if n in (2, 3, 5):\n\n return True\n\n if n % 2 == 0:\n\n return False\n\n if n % 3 == 0:\n\n return False\n\n lst = int(n**0.5)\n\n f = 5\n\n while f <= lst:\n\n if n % f == 0:\n\n return False\n\n if n % (f + 2) == 0:\n\n return False\n\n f += 6\n\n return True\n\n\n\n\n\ndef strmat(matrix, lnsep: str = linesep, fieldsep: str = ' ') -> str:\n\n return lnsep.join([fieldsep.join(map(str, row)) for row in matrix])\n\n\n\n\n\ndef strbool(boolval: int) -> str:\n\n return ['No', 'Yes'][boolval]\n\n\n\n\n\ndef solve() -> None:\n\n # read here\n\n n, m, *t = list(map(int, open(0).read().split()))\n\n\n\n # solve here\n\n d = [[] for i in range(m+1)]\n\n for i in range(n):\n\n a, b = t[2*i], t[2*i+1]\n\n if a > m:\n\n continue\n\n d[a].append(b)\n\n\n\n ans = 0\n\n tasks = []\n\n for t in range(m + 1):\n\n # from (m days after) to today\n\n for tasksize in d[t]:\n\n heappush(tasks, -tasksize)\n\n if tasks:\n\n # do task\n\n ans -= heappop(tasks)\n\n\n\n # print here\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","code_v0_loc":138,"code_v1_loc":70,"code_v0_num_chars":3015,"code_v1_num_chars":1487,"code_v0_no_empty_lines":"# 3.4.3\nimport re\nfrom collections import deque\nfrom functools import reduce\nfrom heapq import heappop\nfrom heapq import heappush\nfrom itertools import permutations\nfrom math import pi\nfrom operator import itemgetter\nfrom operator import mul\nfrom operator import xor\nfrom os import linesep\nfrom sys import stdin\n\n\ndef rline() -> str:\n return stdin.readline().strip()\n\n\ndef rlines(hint: int = 1):\n ret = [\"\" for i in range(hint)]\n for i in range(hint):\n ret[i] = rline()\n return ret\n\n\ndef htokens(hint: int = 1):\n lns = rlines(hint)\n ret = list([ln.split() for ln in lns])\n return ret\n\n\ndef vtokens(hint: int = 1):\n m, _ = htokens()\n wint = len(m)\n ret = [[None] * hint for i in range(wint)]\n for y in range(hint):\n if y != 0:\n m, _ = htokens()\n # convert horizontal to vertical\n x = 0\n for v in m:\n ret[x][y] = v\n x += 1\n # if return value has one and only one element(list),\n if wint == 1:\n # then add an empty list.\n ret.append([])\n return ret\n\n\ndef rint(radix: int = 10) -> int:\n return int(rline(), radix)\n\n\ndef hints(hint: int = 1, radix: int = 10):\n ret = htokens(hint)\n for i in range(len(ret)):\n ret[i] = list([int(v, radix) for v in ret[i]])\n return ret\n\n\ndef vints(hint: int = 1, radix: int = 10):\n ret = vtokens(hint)\n for i in range(len(ret)):\n ret[i] = list([int(v, radix) for v in ret[i]])\n return ret\n\n\ndef mat(hint: int, wint: int):\n return [[None] * wint for i in range(hint)]\n\n\ndef filllist(lst, value: int) -> None:\n # destructive.\n for i in range(len(lst)):\n lst[i] = value\n\n\ndef isprime(n: int) -> bool:\n if n <= 1:\n return False\n if n in (2, 3, 5):\n return True\n if n % 2 == 0:\n return False\n if n % 3 == 0:\n return False\n lst = int(n**0.5)\n f = 5\n while f <= lst:\n if n % f == 0:\n return False\n if n % (f + 2) == 0:\n return False\n f += 6\n return True\n\n\ndef strmat(matrix, lnsep: str = linesep, fieldsep: str = \" \") -> str:\n return lnsep.join([fieldsep.join(map(str, row)) for row in matrix])\n\n\ndef strbool(boolval: int) -> str:\n return [\"No\", \"Yes\"][boolval]\n\n\ndef solve() -> None:\n # read here\n (n, m) = hints()[0]\n ab_s = hints(n)\n # solve here\n # delay asc, prize desc\n ab_s.sort(key=itemgetter(1), reverse=True)\n ab_s.sort(key=itemgetter(0), reverse=False)\n ans = 0\n tasks = []\n ti = 0\n for t in range(m + 1):\n # from (m days after) to today\n while ti < n and ab_s[ti][0] == t:\n a, b = ab_s[ti]\n ti += 1\n heappush(tasks, -b)\n if tasks:\n # do task\n ans -= heappop(tasks)\n # print here\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"# 3.4.3\nimport re\nfrom collections import deque\nfrom functools import reduce\nfrom heapq import *\nfrom itertools import permutations\nfrom math import pi\nfrom operator import itemgetter\nfrom operator import mul\nfrom operator import xor\nfrom os import linesep\n\n\ndef isprime(n: int) -> bool:\n if n <= 1:\n return False\n if n in (2, 3, 5):\n return True\n if n % 2 == 0:\n return False\n if n % 3 == 0:\n return False\n lst = int(n**0.5)\n f = 5\n while f <= lst:\n if n % f == 0:\n return False\n if n % (f + 2) == 0:\n return False\n f += 6\n return True\n\n\ndef strmat(matrix, lnsep: str = linesep, fieldsep: str = \" \") -> str:\n return lnsep.join([fieldsep.join(map(str, row)) for row in matrix])\n\n\ndef strbool(boolval: int) -> str:\n return [\"No\", \"Yes\"][boolval]\n\n\ndef solve() -> None:\n # read here\n n, m, *t = list(map(int, open(0).read().split()))\n # solve here\n d = [[] for i in range(m + 1)]\n for i in range(n):\n a, b = t[2 * i], t[2 * i + 1]\n if a > m:\n continue\n d[a].append(b)\n ans = 0\n tasks = []\n for t in range(m + 1):\n # from (m days after) to today\n for tasksize in d[t]:\n heappush(tasks, -tasksize)\n if tasks:\n # do task\n ans -= heappop(tasks)\n # print here\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":49.2753623188,"diff":["-from heapq import heappop","-from heapq import heappush","+from heapq import *","-from sys import stdin","-","-","-def rline() -> str:","- return stdin.readline().strip()","-","-","-def rlines(hint: int = 1):","- ret = [\"\" for i in range(hint)]","- for i in range(hint):","- ret[i] = rline()","- return ret","-","-","-def htokens(hint: int = 1):","- lns = rlines(hint)","- ret = list([ln.split() for ln in lns])","- return ret","-","-","-def vtokens(hint: int = 1):","- m, _ = htokens()","- wint = len(m)","- ret = [[None] * hint for i in range(wint)]","- for y in range(hint):","- if y != 0:","- m, _ = htokens()","- # convert horizontal to vertical","- x = 0","- for v in m:","- ret[x][y] = v","- x += 1","- # if return value has one and only one element(list),","- if wint == 1:","- # then add an empty list.","- ret.append([])","- return ret","-","-","-def rint(radix: int = 10) -> int:","- return int(rline(), radix)","-","-","-def hints(hint: int = 1, radix: int = 10):","- ret = htokens(hint)","- for i in range(len(ret)):","- ret[i] = list([int(v, radix) for v in ret[i]])","- return ret","-","-","-def vints(hint: int = 1, radix: int = 10):","- ret = vtokens(hint)","- for i in range(len(ret)):","- ret[i] = list([int(v, radix) for v in ret[i]])","- return ret","-","-","-def mat(hint: int, wint: int):","- return [[None] * wint for i in range(hint)]","-","-","-def filllist(lst, value: int) -> None:","- # destructive.","- for i in range(len(lst)):","- lst[i] = value","- (n, m) = hints()[0]","- ab_s = hints(n)","+ n, m, *t = list(map(int, open(0).read().split()))","- # delay asc, prize desc","- ab_s.sort(key=itemgetter(1), reverse=True)","- ab_s.sort(key=itemgetter(0), reverse=False)","+ d = [[] for i in range(m + 1)]","+ for i in range(n):","+ a, b = t[2 * i], t[2 * i + 1]","+ if a > m:","+ continue","+ d[a].append(b)","- ti = 0","- while ti < n and ab_s[ti][0] == t:","- a, b = ab_s[ti]","- ti += 1","- heappush(tasks, -b)","+ for tasksize in d[t]:","+ heappush(tasks, -tasksize)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0552926385,"measured_runtime_v1":0.0472948387,"runtime_lift":1.1691051304,"key":["s236967200","s375715449"]} +{"user_id":"u246401133","problem_id":"p02584","language":"python","submission_id_v0":"s770558045","submission_id_v1":"s725387205","cpu_time_v0":34,"cpu_time_v1":30,"memory_v0":9128,"memory_v1":9176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.76,"input":"import math\n\ny, k, d = list(map(int, input().split()))\n\nif y >= 0:\n\n x = y\n\nelse:\n\n x = -y\n\ni = math.floor(x \/ d)\n\nif i >= k:\n\n p = x - k * d\n\nelif i == x \/ d:\n\n if i + k == 2 * int((i + k) \/ 2):\n\n p = 0\n\n else:\n\n p = d\n\nelse:\n\n if (2 * i + 1) * d == 2 * x:\n\n p = x - i * d\n\n else:\n\n if i + k == 2 * int((i + k) \/ 2):\n\n p = x - i * d\n\n else:\n\n p = (i + 1) * d - x\n\nprint((int(p)))","target":"y, k, d = list(map(int, input().split()))\n\nx = abs(y)\n\ni = int(x \/ d)\n\nif i >= k:\n\n p = x - k * d\n\nelif i == x \/ d:\n\n if (i + k) % 2 == 0:\n\n p = 0\n\n else:\n\n p = d\n\nelse:\n\n if ((2 * i + 1) * d == 2 * x) or ((i + k) % 2 == 0):\n\n p = x - i * d\n\n else:\n\n p = (i + 1) * d - x\n\nprint((int(p)))","code_v0_loc":23,"code_v1_loc":16,"code_v0_num_chars":450,"code_v1_num_chars":322,"code_v0_no_empty_lines":"import math\n\ny, k, d = list(map(int, input().split()))\nif y >= 0:\n x = y\nelse:\n x = -y\ni = math.floor(x \/ d)\nif i >= k:\n p = x - k * d\nelif i == x \/ d:\n if i + k == 2 * int((i + k) \/ 2):\n p = 0\n else:\n p = d\nelse:\n if (2 * i + 1) * d == 2 * x:\n p = x - i * d\n else:\n if i + k == 2 * int((i + k) \/ 2):\n p = x - i * d\n else:\n p = (i + 1) * d - x\nprint((int(p)))\n","code_v1_no_empty_lines":"y, k, d = list(map(int, input().split()))\nx = abs(y)\ni = int(x \/ d)\nif i >= k:\n p = x - k * d\nelif i == x \/ d:\n if (i + k) % 2 == 0:\n p = 0\n else:\n p = d\nelse:\n if ((2 * i + 1) * d == 2 * x) or ((i + k) % 2 == 0):\n p = x - i * d\n else:\n p = (i + 1) * d - x\nprint((int(p)))\n","code_same":false,"relative_loc_diff_percent":30.4347826087,"diff":["-import math","-","-if y >= 0:","- x = y","-else:","- x = -y","-i = math.floor(x \/ d)","+x = abs(y)","+i = int(x \/ d)","- if i + k == 2 * int((i + k) \/ 2):","+ if (i + k) % 2 == 0:","- if (2 * i + 1) * d == 2 * x:","+ if ((2 * i + 1) * d == 2 * x) or ((i + k) % 2 == 0):","- if i + k == 2 * int((i + k) \/ 2):","- p = x - i * d","- else:","- p = (i + 1) * d - x","+ p = (i + 1) * d - x"],"diff_only_import_comment":false,"measured_runtime_v0":0.0466694965,"measured_runtime_v1":0.0339584846,"runtime_lift":1.3743103382,"key":["s770558045","s725387205"]} +{"user_id":"u867848444","problem_id":"p03371","language":"python","submission_id_v0":"s575339067","submission_id_v1":"s542858614","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"a,b,c,x,y=list(map(int,input().split()))\n\n\n\nans1=a*x+b*y\n\nans2=c*2*x+b*(y-x) if y>=x else a*(x-y)+c*2*y\n\nans3=max(x,y)*2*c\n\nprint((min(ans1,ans2,ans3)))","target":"a,b,c,x,y=list(map(int,input().split()))\n\n#A,B\u3092\u305d\u308c\u305e\u308c\u8cb7\u3046\n\ncand1=a*x+b*y\n\n#\u3059\u3079\u3066AB\u30d4\u30b6\u3067\u305d\u308d\u3048\u308b\n\ncand2=2*c*max(x,y)\n\n#A,B\u306e\u3046\u3061\u5fc5\u8981\u679a\u6570\u304c\u5c11\u306a\u3044\u307b\u3046\u3092\u3059\u3079\u3066AB\u30d4\u30b6\u3067\u4f5c\u308b\n\ncand3=2*c*x+b*(y-x) if x= x else a * (x - y) + c * 2 * y\nans3 = max(x, y) * 2 * c\nprint((min(ans1, ans2, ans3)))\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\n# A,B\u3092\u305d\u308c\u305e\u308c\u8cb7\u3046\ncand1 = a * x + b * y\n# \u3059\u3079\u3066AB\u30d4\u30b6\u3067\u305d\u308d\u3048\u308b\ncand2 = 2 * c * max(x, y)\n# A,B\u306e\u3046\u3061\u5fc5\u8981\u679a\u6570\u304c\u5c11\u306a\u3044\u307b\u3046\u3092\u3059\u3079\u3066AB\u30d4\u30b6\u3067\u4f5c\u308b\ncand3 = 2 * c * x + b * (y - x) if x < y else 2 * c * y + a * (x - y)\nprint((min(cand1, cand2, cand3)))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-ans1 = a * x + b * y","-ans2 = c * 2 * x + b * (y - x) if y >= x else a * (x - y) + c * 2 * y","-ans3 = max(x, y) * 2 * c","-print((min(ans1, ans2, ans3)))","+# A,B\u3092\u305d\u308c\u305e\u308c\u8cb7\u3046","+cand1 = a * x + b * y","+# \u3059\u3079\u3066AB\u30d4\u30b6\u3067\u305d\u308d\u3048\u308b","+cand2 = 2 * c * max(x, y)","+# A,B\u306e\u3046\u3061\u5fc5\u8981\u679a\u6570\u304c\u5c11\u306a\u3044\u307b\u3046\u3092\u3059\u3079\u3066AB\u30d4\u30b6\u3067\u4f5c\u308b","+cand3 = 2 * c * x + b * (y - x) if x < y else 2 * c * y + a * (x - y)","+print((min(cand1, cand2, cand3)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0710155129,"measured_runtime_v1":0.0736725452,"runtime_lift":0.9639345668,"key":["s575339067","s542858614"]} +{"user_id":"u582489208","problem_id":"p02612","language":"python","submission_id_v0":"s019402937","submission_id_v1":"s690805516","cpu_time_v0":29,"cpu_time_v1":25,"memory_v0":9168,"memory_v1":9100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.79,"input":"N = int(eval(input()))\n\nif N%1000 == 0:\n\n print((0))\n\nelse:\n\n Str = str(N)\n\n if len(Str) > 3:\n\n K = (int(Str[0]) + 1) * 1000\n\n print((K - N))\n\n else:\n\n print((1000 - N))\n","target":"n = int(eval(input()))\n\nif n % 1000 == 0:\n\n print((0))\n\nelse:\n\n k = int(((n\/1000)+1))*1000\n\n print((k-n))","code_v0_loc":10,"code_v1_loc":6,"code_v0_num_chars":191,"code_v1_num_chars":104,"code_v0_no_empty_lines":"N = int(eval(input()))\nif N % 1000 == 0:\n print((0))\nelse:\n Str = str(N)\n if len(Str) > 3:\n K = (int(Str[0]) + 1) * 1000\n print((K - N))\n else:\n print((1000 - N))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nif n % 1000 == 0:\n print((0))\nelse:\n k = int(((n \/ 1000) + 1)) * 1000\n print((k - n))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-N = int(eval(input()))","-if N % 1000 == 0:","+n = int(eval(input()))","+if n % 1000 == 0:","- Str = str(N)","- if len(Str) > 3:","- K = (int(Str[0]) + 1) * 1000","- print((K - N))","- else:","- print((1000 - N))","+ k = int(((n \/ 1000) + 1)) * 1000","+ print((k - n))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409409251,"measured_runtime_v1":0.0456946943,"runtime_lift":0.8959667147,"key":["s019402937","s690805516"]} +{"user_id":"u656643475","problem_id":"p03295","language":"python","submission_id_v0":"s525018687","submission_id_v1":"s300450672","cpu_time_v0":623,"cpu_time_v1":515,"memory_v0":36264,"memory_v1":20548,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.34,"input":"from operator import itemgetter\n\nN, M = list(map(int, input().split()))\n\nab = [[0,0] for i in range(M)]\n\nfor i in range(M):\n\n ab[i] = list(map(int, input().split()))\n\n\n\nab = sorted(ab, key=itemgetter(0,1))\n\n\n\nre = 1\n\nx, y = ab[0]\n\nfor i in range(1, M):\n\n a, b = ab[i]\n\n if b <= x or y <= a: # \u5207\u3063\u305f\u3068\u3053\u306e\u7bc4\u56f2\u5916\u3060\u3063\u305f\u3089\n\n re += 1\n\n x, y = a, b\n\n else:\n\n x = max(x, 1)\n\n y = min(y, b)\n\nprint(re)","target":"N, M = list(map(int, input().split()))\n\n\n\npair = []\n\nfor i in range(M):\n\n a, b = list(map(int, input().split()))\n\n pair.append([b, a])\n\n\n\n# b\u3092\u30ad\u30fc\u306b\u3057\u3066\u6607\u9806\u306b\u30bd\u30fc\u30c8\u3059\u308b\n\npair.sort()\n\n\n\nans = 1\n\ny, x = pair[0]\n\n\n\nfor i in range(1, M):\n\n b, a = pair[i]\n\n if y <= a:\n\n y = b\n\n ans += 1\n\n\n\nprint(ans)","code_v0_loc":19,"code_v1_loc":20,"code_v0_num_chars":421,"code_v1_num_chars":309,"code_v0_no_empty_lines":"from operator import itemgetter\n\nN, M = list(map(int, input().split()))\nab = [[0, 0] for i in range(M)]\nfor i in range(M):\n ab[i] = list(map(int, input().split()))\nab = sorted(ab, key=itemgetter(0, 1))\nre = 1\nx, y = ab[0]\nfor i in range(1, M):\n a, b = ab[i]\n if b <= x or y <= a: # \u5207\u3063\u305f\u3068\u3053\u306e\u7bc4\u56f2\u5916\u3060\u3063\u305f\u3089\n re += 1\n x, y = a, b\n else:\n x = max(x, 1)\n y = min(y, b)\nprint(re)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\npair = []\nfor i in range(M):\n a, b = list(map(int, input().split()))\n pair.append([b, a])\n# b\u3092\u30ad\u30fc\u306b\u3057\u3066\u6607\u9806\u306b\u30bd\u30fc\u30c8\u3059\u308b\npair.sort()\nans = 1\ny, x = pair[0]\nfor i in range(1, M):\n b, a = pair[i]\n if y <= a:\n y = b\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.0,"diff":["-from operator import itemgetter","-","-ab = [[0, 0] for i in range(M)]","+pair = []","- ab[i] = list(map(int, input().split()))","-ab = sorted(ab, key=itemgetter(0, 1))","-re = 1","-x, y = ab[0]","+ a, b = list(map(int, input().split()))","+ pair.append([b, a])","+# b\u3092\u30ad\u30fc\u306b\u3057\u3066\u6607\u9806\u306b\u30bd\u30fc\u30c8\u3059\u308b","+pair.sort()","+ans = 1","+y, x = pair[0]","- a, b = ab[i]","- if b <= x or y <= a: # \u5207\u3063\u305f\u3068\u3053\u306e\u7bc4\u56f2\u5916\u3060\u3063\u305f\u3089","- re += 1","- x, y = a, b","- else:","- x = max(x, 1)","- y = min(y, b)","-print(re)","+ b, a = pair[i]","+ if y <= a:","+ y = b","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0456289008,"measured_runtime_v1":0.0443842969,"runtime_lift":1.0280415361,"key":["s525018687","s300450672"]} +{"user_id":"u085667287","problem_id":"p02639","language":"python","submission_id_v0":"s084096834","submission_id_v1":"s004627866","cpu_time_v0":23,"cpu_time_v1":21,"memory_v0":9180,"memory_v1":8992,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.7,"input":"import sys\n\ninput = sys.stdin.readline\n\na = list(map(int, input().rstrip().split(' ')))\n\n \n\nfor i in range(len(a)):\n\n if a[i] == 0:\n\n print((i+1))\n\n break\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\na = list(map(int, input().split(' ')))\n\n \n\nfor i in range(len(a)):\n\n if a[i] == 0:\n\n print((i+1))\n\n break\n","code_v0_loc":8,"code_v1_loc":9,"code_v0_num_chars":160,"code_v1_num_chars":153,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\na = list(map(int, input().rstrip().split(\" \")))\nfor i in range(len(a)):\n if a[i] == 0:\n print((i + 1))\n break\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\na = list(map(int, input().split(\" \")))\nfor i in range(len(a)):\n if a[i] == 0:\n print((i + 1))\n break\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-a = list(map(int, input().rstrip().split(\" \")))","+a = list(map(int, input().split(\" \")))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0325166225,"measured_runtime_v1":0.0420108318,"runtime_lift":0.7740056818,"key":["s084096834","s004627866"]} +{"user_id":"u014139588","problem_id":"p03262","language":"python","submission_id_v0":"s065302820","submission_id_v1":"s196109439","cpu_time_v0":84,"cpu_time_v1":75,"memory_v0":20500,"memory_v1":19852,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.71,"input":"import math\n\nn,x = list(map(int,input().split()))\n\nxl = list(map(int,input().split()))\n\ndis = []\n\nans = 0\n\nfor i in range(n):\n\n dis.append(abs(x-xl[i]))\n\nfor i in range(n):\n\n ans = math.gcd(ans,dis[i])\n\nprint(ans)","target":"N,X = list(map(int,input().split()))\n\nx = list(map(int,input().split()))\n\nans = 0\n\nfrom math import gcd\n\nfor i in range(N):\n\n ans = gcd(ans,abs(X-x[i]))\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":7,"code_v0_num_chars":209,"code_v1_num_chars":159,"code_v0_no_empty_lines":"import math\n\nn, x = list(map(int, input().split()))\nxl = list(map(int, input().split()))\ndis = []\nans = 0\nfor i in range(n):\n dis.append(abs(x - xl[i]))\nfor i in range(n):\n ans = math.gcd(ans, dis[i])\nprint(ans)\n","code_v1_no_empty_lines":"N, X = list(map(int, input().split()))\nx = list(map(int, input().split()))\nans = 0\nfrom math import gcd\n\nfor i in range(N):\n ans = gcd(ans, abs(X - x[i]))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":30.0,"diff":["-import math","+N, X = list(map(int, input().split()))","+x = list(map(int, input().split()))","+ans = 0","+from math import gcd","-n, x = list(map(int, input().split()))","-xl = list(map(int, input().split()))","-dis = []","-ans = 0","-for i in range(n):","- dis.append(abs(x - xl[i]))","-for i in range(n):","- ans = math.gcd(ans, dis[i])","+for i in range(N):","+ ans = gcd(ans, abs(X - x[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0381428344,"measured_runtime_v1":0.0620439465,"runtime_lift":0.6147712479,"key":["s065302820","s196109439"]} +{"user_id":"u334712262","problem_id":"p02720","language":"python","submission_id_v0":"s473441990","submission_id_v1":"s908486661","cpu_time_v0":917,"cpu_time_v1":88,"memory_v0":5836,"memory_v1":9968,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.4,"input":"# -*- coding: utf-8 -*-\n\nimport bisect\n\nimport heapq\n\nimport math\n\nimport random\n\nimport sys\n\nfrom collections import Counter, defaultdict, deque\n\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\n\nfrom functools import lru_cache, reduce\n\nfrom itertools import combinations, combinations_with_replacement, product, permutations\n\nfrom operator import add, mul, sub\n\n\n\nsys.setrecursionlimit(1000000)\n\ninput = sys.stdin.readline\n\nINF = 2**62-1\n\n\n\ndef read_int():\n\n return int(input())\n\n\n\n\n\ndef read_int_n():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef read_float():\n\n return float(input())\n\n\n\n\n\ndef read_float_n():\n\n return list(map(float, input().split()))\n\n\n\n\n\ndef read_str():\n\n return input().strip()\n\n\n\n\n\ndef read_str_n():\n\n return list(map(str, input().split()))\n\n\n\n\n\ndef error_print(*args):\n\n print(*args, file=sys.stderr)\n\n\n\n\n\ndef mt(f):\n\n import time\n\n\n\n def wrap(*args, **kwargs):\n\n s = time.time()\n\n ret = f(*args, **kwargs)\n\n e = time.time()\n\n\n\n error_print(e - s, 'sec')\n\n return ret\n\n\n\n return wrap\n\n\n\ndef is_lunlun(n):\n\n s = str(n)\n\n for i in range(len(s)-1):\n\n if abs(int(s[i])-int(s[i+1])) > 1:\n\n return False\n\n return True\n\n\n\ndef slv(k):\n\n n = 1\n\n for _ in range(k-1):\n\n j = 0\n\n while True:\n\n l = 10**j\n\n t = 0\n\n t += n + l\n\n t -= (n+l) % l\n\n m = (t % (10**(j+1))) \/\/ l\n\n # print(t, j, m)\n\n for i in range(j-1, -1, -1):\n\n t += (10 ** i) * max(0, m-(j-i))\n\n # print(t, j)\n\n if is_lunlun(t):\n\n n = t\n\n break\n\n else:\n\n j+=1\n\n # if j > 5:\n\n # break\n\n # print(n)\n\n return n\n\n\n\n\n\n\n\ndef main():\n\n K = read_int()\n\n print(slv(K))\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"# -*- coding: utf-8 -*-\n\nimport bisect\n\nimport heapq\n\nimport math\n\nimport random\n\nimport sys\n\nfrom collections import Counter, defaultdict, deque\n\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\n\nfrom functools import lru_cache, reduce\n\nfrom itertools import combinations, combinations_with_replacement, product, permutations\n\nfrom operator import add, mul, sub\n\n\n\nsys.setrecursionlimit(1000000)\n\ninput = sys.stdin.readline\n\nINF = 2**62-1\n\n\n\ndef read_int():\n\n return int(input())\n\n\n\n\n\ndef read_int_n():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef read_float():\n\n return float(input())\n\n\n\n\n\ndef read_float_n():\n\n return list(map(float, input().split()))\n\n\n\n\n\ndef read_str():\n\n return input().strip()\n\n\n\n\n\ndef read_str_n():\n\n return list(map(str, input().split()))\n\n\n\n\n\ndef error_print(*args):\n\n print(*args, file=sys.stderr)\n\n\n\n\n\ndef mt(f):\n\n import time\n\n\n\n def wrap(*args, **kwargs):\n\n s = time.time()\n\n ret = f(*args, **kwargs)\n\n e = time.time()\n\n\n\n error_print(e - s, 'sec')\n\n return ret\n\n\n\n return wrap\n\n\n\ndef is_lunlun(n):\n\n s = str(n)\n\n for i in range(len(s)-1):\n\n if abs(int(s[i])-int(s[i+1])) > 1:\n\n return False\n\n return True\n\n\n\ndef slv(k):\n\n if k <= 9:\n\n return k\n\n lunlun = list(range(1, 10))\n\n q = deque(lunlun)\n\n\n\n while True:\n\n n = q.popleft()\n\n for i in (-1, 0, 1):\n\n d = n % 10\n\n if 0 <= d + i <= 9:\n\n l = n * 10 + d+i\n\n q.append(l)\n\n lunlun.append(l)\n\n if len(lunlun) == k:\n\n return lunlun[-1]\n\n\n\n\n\n\n\n\n\ndef main():\n\n K = read_int()\n\n print(slv(K))\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":98,"code_v1_loc":92,"code_v0_num_chars":1919,"code_v1_num_chars":1759,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(1000000)\ninput = sys.stdin.readline\nINF = 2**62 - 1\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n error_print(e - s, \"sec\")\n return ret\n\n return wrap\n\n\ndef is_lunlun(n):\n s = str(n)\n for i in range(len(s) - 1):\n if abs(int(s[i]) - int(s[i + 1])) > 1:\n return False\n return True\n\n\ndef slv(k):\n n = 1\n for _ in range(k - 1):\n j = 0\n while True:\n l = 10**j\n t = 0\n t += n + l\n t -= (n + l) % l\n m = (t % (10 ** (j + 1))) \/\/ l\n # print(t, j, m)\n for i in range(j - 1, -1, -1):\n t += (10**i) * max(0, m - (j - i))\n # print(t, j)\n if is_lunlun(t):\n n = t\n break\n else:\n j += 1\n # if j > 5:\n # break\n # print(n)\n return n\n\n\ndef main():\n K = read_int()\n print(slv(K))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(1000000)\ninput = sys.stdin.readline\nINF = 2**62 - 1\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n error_print(e - s, \"sec\")\n return ret\n\n return wrap\n\n\ndef is_lunlun(n):\n s = str(n)\n for i in range(len(s) - 1):\n if abs(int(s[i]) - int(s[i + 1])) > 1:\n return False\n return True\n\n\ndef slv(k):\n if k <= 9:\n return k\n lunlun = list(range(1, 10))\n q = deque(lunlun)\n while True:\n n = q.popleft()\n for i in (-1, 0, 1):\n d = n % 10\n if 0 <= d + i <= 9:\n l = n * 10 + d + i\n q.append(l)\n lunlun.append(l)\n if len(lunlun) == k:\n return lunlun[-1]\n\n\ndef main():\n K = read_int()\n print(slv(K))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.1224489796,"diff":["- n = 1","- for _ in range(k - 1):","- j = 0","- while True:","- l = 10**j","- t = 0","- t += n + l","- t -= (n + l) % l","- m = (t % (10 ** (j + 1))) \/\/ l","- # print(t, j, m)","- for i in range(j - 1, -1, -1):","- t += (10**i) * max(0, m - (j - i))","- # print(t, j)","- if is_lunlun(t):","- n = t","- break","- else:","- j += 1","- # if j > 5:","- # break","- # print(n)","- return n","+ if k <= 9:","+ return k","+ lunlun = list(range(1, 10))","+ q = deque(lunlun)","+ while True:","+ n = q.popleft()","+ for i in (-1, 0, 1):","+ d = n % 10","+ if 0 <= d + i <= 9:","+ l = n * 10 + d + i","+ q.append(l)","+ lunlun.append(l)","+ if len(lunlun) == k:","+ return lunlun[-1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.1156487992,"measured_runtime_v1":0.0432874305,"runtime_lift":2.6716485075,"key":["s473441990","s908486661"]} +{"user_id":"u175034939","problem_id":"p02642","language":"python","submission_id_v0":"s769605586","submission_id_v1":"s815069370","cpu_time_v0":604,"cpu_time_v1":347,"memory_v0":53840,"memory_v1":47812,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":42.55,"input":"n = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nA.sort()\n\n\n\nac = A.count(1)\n\nif ac == 1:\n\n print((1))\n\n exit()\n\nif ac >= 2:\n\n print((0))\n\n exit()\n\n\n\nnum = [0]*1000005\n\nfor a in A:\n\n num[a] += 1\n\n\n\nb = [False]*1000005\n\nseen = [False]*1000005\n\ncnt = 0\n\nA = list(set(A))\n\nA.sort()\n\nfor a in A:\n\n if seen[a]:\n\n continue\n\n\n\n seen[a] = True\n\n if b[a] == False:\n\n cnt += 1\n\n if num[a] > 1:\n\n cnt -= 1\n\n\n\n for i in range(a, 1000005, a):\n\n b[i] = True\n\nprint(cnt)\n","target":"n = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nnum = [0]*(10**6+1)\n\nfor a in A:\n\n num[a] += 1\n\n\n\nbai = [False]*(10**6+1)\n\ncnt = 0\n\nA = list(set(A))\n\nA.sort()\n\nfor a in A:\n\n if bai[a]:\n\n continue\n\n\n\n if num[a] == 1:\n\n cnt += 1\n\n\n\n for i in range(a, 10**6+1, a):\n\n bai[i] = True\n\nprint(cnt)","code_v0_loc":34,"code_v1_loc":21,"code_v0_num_chars":523,"code_v1_num_chars":330,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nA.sort()\nac = A.count(1)\nif ac == 1:\n print((1))\n exit()\nif ac >= 2:\n print((0))\n exit()\nnum = [0] * 1000005\nfor a in A:\n num[a] += 1\nb = [False] * 1000005\nseen = [False] * 1000005\ncnt = 0\nA = list(set(A))\nA.sort()\nfor a in A:\n if seen[a]:\n continue\n seen[a] = True\n if b[a] == False:\n cnt += 1\n if num[a] > 1:\n cnt -= 1\n for i in range(a, 1000005, a):\n b[i] = True\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nA = list(map(int, input().split()))\nnum = [0] * (10**6 + 1)\nfor a in A:\n num[a] += 1\nbai = [False] * (10**6 + 1)\ncnt = 0\nA = list(set(A))\nA.sort()\nfor a in A:\n if bai[a]:\n continue\n if num[a] == 1:\n cnt += 1\n for i in range(a, 10**6 + 1, a):\n bai[i] = True\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":38.2352941176,"diff":["-A.sort()","-ac = A.count(1)","-if ac == 1:","- print((1))","- exit()","-if ac >= 2:","- print((0))","- exit()","-num = [0] * 1000005","+num = [0] * (10**6 + 1)","-b = [False] * 1000005","-seen = [False] * 1000005","+bai = [False] * (10**6 + 1)","- if seen[a]:","+ if bai[a]:","- seen[a] = True","- if b[a] == False:","+ if num[a] == 1:","- if num[a] > 1:","- cnt -= 1","- for i in range(a, 1000005, a):","- b[i] = True","+ for i in range(a, 10**6 + 1, a):","+ bai[i] = True"],"diff_only_import_comment":false,"measured_runtime_v0":0.3320258288,"measured_runtime_v1":0.2975716295,"runtime_lift":1.115784557,"key":["s769605586","s815069370"]} +{"user_id":"u237493274","problem_id":"p03861","language":"python","submission_id_v0":"s634857046","submission_id_v1":"s533029660","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"a, b, x = list(map(int, input().split()))\n\nprint((int(b\/\/x) - int((a-1)\/\/x)))\n","target":"a, b, x = list(map(int, input().split()))\n\nprint((b\/\/x - (a-1)\/\/x))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":70,"code_v1_num_chars":59,"code_v0_no_empty_lines":"a, b, x = list(map(int, input().split()))\nprint((int(b \/\/ x) - int((a - 1) \/\/ x)))\n","code_v1_no_empty_lines":"a, b, x = list(map(int, input().split()))\nprint((b \/\/ x - (a - 1) \/\/ x))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-print((int(b \/\/ x) - int((a - 1) \/\/ x)))","+print((b \/\/ x - (a - 1) \/\/ x))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0388074253,"measured_runtime_v1":0.0452973294,"runtime_lift":0.8567265608,"key":["s634857046","s533029660"]} +{"user_id":"u475756142","problem_id":"p04031","language":"python","submission_id_v0":"s049103714","submission_id_v1":"s245171179","cpu_time_v0":169,"cpu_time_v1":24,"memory_v0":38512,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":85.8,"input":"from math import ceil\n\n\n\nn = int(eval(input()))\n\nnumeros = [int(x) for x in input().split()]\n\nsaida = 2000000000000000\n\n\n\nfor i in range(min(numeros), max(numeros)+1):\n\n\tvalor = 0\n\n\tfor j in numeros:\n\n\t\tvalor += (j-i)**2\n\n\t\n\n\tsaida = min(valor, saida)\n\n\n\nprint(saida)\n\n\n\n\n","target":"import sys\n\n\n\nn = int(eval(input()))\n\nnumeros = [int(x) for x in input().split()]\n\nsaida = sys.maxsize\n\n\n\nfor i in range(min(numeros), max(numeros)+1):\n\n\tvalor = 0\n\n\tfor j in numeros:\n\n\t\tvalor += (j-i)**2\n\n\t\n\n\tsaida = min(valor, saida)\n\n\n\nprint(saida)\n\n\n","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":266,"code_v1_num_chars":248,"code_v0_no_empty_lines":"from math import ceil\n\nn = int(eval(input()))\nnumeros = [int(x) for x in input().split()]\nsaida = 2000000000000000\nfor i in range(min(numeros), max(numeros) + 1):\n valor = 0\n for j in numeros:\n valor += (j - i) ** 2\n saida = min(valor, saida)\nprint(saida)\n","code_v1_no_empty_lines":"import sys\n\nn = int(eval(input()))\nnumeros = [int(x) for x in input().split()]\nsaida = sys.maxsize\nfor i in range(min(numeros), max(numeros) + 1):\n valor = 0\n for j in numeros:\n valor += (j - i) ** 2\n saida = min(valor, saida)\nprint(saida)\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["-from math import ceil","+import sys","-saida = 2000000000000000","+saida = sys.maxsize"],"diff_only_import_comment":false,"measured_runtime_v0":0.0377624409,"measured_runtime_v1":0.0376006906,"runtime_lift":1.0043017908,"key":["s049103714","s245171179"]} +{"user_id":"u606045429","problem_id":"p03721","language":"python","submission_id_v0":"s505161710","submission_id_v1":"s260194967","cpu_time_v0":451,"cpu_time_v1":332,"memory_v0":21652,"memory_v1":5740,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.39,"input":"N, K = [int(i) for i in input().split()]\n\nL = [[int(i) for i in input().split()] for _ in range(N)]\n\n\n\nL.sort()\n\nk = 0\n\nfor a, b in L:\n\n if k + b >= K:\n\n print(a)\n\n quit()\n\n k += b\n","target":"N, K = [int(i) for i in input().split()]\n\n\n\nmemo = [0] * (10 ** 5 + 10)\n\nfor _ in range(N):\n\n a, b = [int(i) for i in input().split()]\n\n memo[a] += b\n\n\n\nfor i, b in enumerate(memo):\n\n if K <= memo[i]:\n\n print(i)\n\n quit()\n\n K -= memo[i]\n","code_v0_loc":10,"code_v1_loc":12,"code_v0_num_chars":201,"code_v1_num_chars":262,"code_v0_no_empty_lines":"N, K = [int(i) for i in input().split()]\nL = [[int(i) for i in input().split()] for _ in range(N)]\nL.sort()\nk = 0\nfor a, b in L:\n if k + b >= K:\n print(a)\n quit()\n k += b\n","code_v1_no_empty_lines":"N, K = [int(i) for i in input().split()]\nmemo = [0] * (10**5 + 10)\nfor _ in range(N):\n a, b = [int(i) for i in input().split()]\n memo[a] += b\nfor i, b in enumerate(memo):\n if K <= memo[i]:\n print(i)\n quit()\n K -= memo[i]\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-L = [[int(i) for i in input().split()] for _ in range(N)]","-L.sort()","-k = 0","-for a, b in L:","- if k + b >= K:","- print(a)","+memo = [0] * (10**5 + 10)","+for _ in range(N):","+ a, b = [int(i) for i in input().split()]","+ memo[a] += b","+for i, b in enumerate(memo):","+ if K <= memo[i]:","+ print(i)","- k += b","+ K -= memo[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0444279184,"measured_runtime_v1":0.0392341558,"runtime_lift":1.1323785977,"key":["s505161710","s260194967"]} +{"user_id":"u852613820","problem_id":"p02755","language":"python","submission_id_v0":"s818157475","submission_id_v1":"s414944650","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3064,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"import math\n\n\n\ndef main():\n\n A, B = list(map(int, input().split()))\n\n\n\n # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u53ef\u80fd\u6027\u306e\u3042\u308b\u6700\u5c0f\u306e\u6b63\u6570\u3092\u8a08\u7b97\n\n x_min = max(math.ceil(A \/ 0.08), math.ceil(B \/ 0.1))\n\n # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u53ef\u80fd\u6027\u306e\u3042\u308b\u6700\u5927\u306e\u6b63\u6570\u3092\u8a08\u7b97\n\n x_max = min((math.ceil((A + 1) \/ 0.08), math.ceil((B + 1) \/ 0.1)))\n\n\n\n # \u5019\u88dc\u306e\u6b63\u6570\u3092\u9806\u756a\u306b\u30c1\u30a7\u30c3\u30af\u3057\u3001\u6e80\u305f\u3059\u3082\u306e\u304c\u3042\u308c\u3070\u305d\u308c\u3092\u51fa\u529b\u3057\u3066\u7d42\u4e86\n\n for x in range(x_min, x_max + 1):\n\n if (math.floor(x * 0.08) == A) and (math.floor(x * 0.1) == B):\n\n print(x)\n\n quit()\n\n\n\n # \u3053\u3053\u307e\u3067\u6765\u308b\u3068\u304d\u306f\u6e80\u305f\u3059\u3082\u306e\u304c\u306a\u3044\u306e\u3067\u3001-1\u3092\u51fa\u529b\n\n print((-1))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"from math import floor\n\n\n\n# \u5165\u529b\u5024\u306e\u53d6\u5f97\n\nA, B = list(map(int, input().split()))\n\n\n\n# \u554f\u984c\u306e\u5236\u7d04\u304b\u3089\u3001\u7b54\u3048\u306e\u5019\u88dc\u3068\u3057\u3066\u3042\u308a\u5f97\u308b\u7bc4\u56f2\u3092\u30c1\u30a7\u30c3\u30af\n\n# for _ in range(1010)\u3067\uff10\u301c\uff11\uff10\uff10\uff19\u307e\u3067\u306e\u30eb\u30fc\u30d7\u304c\u4f7f\u3048\u308b\n\nfor price in range(1010):\n\n if (floor(price * 0.08) == A) and (floor(price * 0.1) == B):\n\n # \u6761\u4ef6\u3092\u6e80\u305f\u3057\u305f\u306e\u3067\u305d\u306e\u91d1\u984d\u3092\u8868\u793a\u3057\u3066\u7d42\u4e86\n\n # \uff08\u5c0f\u3055\u3044\u91d1\u984d\u304b\u3089\u9806\u756a\u306b\u307f\u3066\u3044\u304f\u306e\u3067\u3001\u6700\u521d\u306b\u6761\u4ef6\u3092\u6e80\u305f\u3057\u305f\u3082\u306e\u304c\u3001\n\n # \u3000\u6761\u4ef6\u3092\u6e80\u305f\u3059\u91d1\u984d\u306e\u3046\u3061\u3067\u6700\u5c0f\u306e\u91d1\u984d\u306b\u306a\u308b\u3002\uff09\n\n print(price)\n\n quit()\n\n\n\n# \u6761\u4ef6\u3092\u6e80\u305f\u3059\u3082\u306e\u304c\u898b\u3064\u304b\u3063\u3066\u3044\u308c\u3070\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u7d42\u4e86\u3059\u308b\u306e\u3067\u3001\n\n# \u3053\u3053\u307e\u3067\u5b9f\u884c\u3055\u308c\u308b\u6642\u306f\u3001\u6761\u4ef6\u3092\u6e80\u305f\u3059\u91d1\u984d\u304c\u5b58\u5728\u3057\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3001\n\n# \u6761\u4ef6\u3092\u6e80\u305f\u3059\u91d1\u984d\u304c\u5b58\u5728\u3057\u306a\u3044\u6642\u306b\u8868\u793a\u3059\u3079\u304d -1 \u3092\u8868\u793a\u3059\u308b\u3002\n\n# \u6700\u5c0f\u884c\u306a\u306e\u3067\u3001quit()\u3057\u306a\u304f\u3066\u3082\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u7d42\u4e86\u3059\u308b\n\nprint((-1))\n","code_v0_loc":22,"code_v1_loc":20,"code_v0_num_chars":542,"code_v1_num_chars":539,"code_v0_no_empty_lines":"import math\n\n\ndef main():\n A, B = list(map(int, input().split()))\n # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u53ef\u80fd\u6027\u306e\u3042\u308b\u6700\u5c0f\u306e\u6b63\u6570\u3092\u8a08\u7b97\n x_min = max(math.ceil(A \/ 0.08), math.ceil(B \/ 0.1))\n # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u53ef\u80fd\u6027\u306e\u3042\u308b\u6700\u5927\u306e\u6b63\u6570\u3092\u8a08\u7b97\n x_max = min((math.ceil((A + 1) \/ 0.08), math.ceil((B + 1) \/ 0.1)))\n # \u5019\u88dc\u306e\u6b63\u6570\u3092\u9806\u756a\u306b\u30c1\u30a7\u30c3\u30af\u3057\u3001\u6e80\u305f\u3059\u3082\u306e\u304c\u3042\u308c\u3070\u305d\u308c\u3092\u51fa\u529b\u3057\u3066\u7d42\u4e86\n for x in range(x_min, x_max + 1):\n if (math.floor(x * 0.08) == A) and (math.floor(x * 0.1) == B):\n print(x)\n quit()\n # \u3053\u3053\u307e\u3067\u6765\u308b\u3068\u304d\u306f\u6e80\u305f\u3059\u3082\u306e\u304c\u306a\u3044\u306e\u3067\u3001-1\u3092\u51fa\u529b\n print((-1))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from math import floor\n\n# \u5165\u529b\u5024\u306e\u53d6\u5f97\nA, B = list(map(int, input().split()))\n# \u554f\u984c\u306e\u5236\u7d04\u304b\u3089\u3001\u7b54\u3048\u306e\u5019\u88dc\u3068\u3057\u3066\u3042\u308a\u5f97\u308b\u7bc4\u56f2\u3092\u30c1\u30a7\u30c3\u30af\n# for _ in range(1010)\u3067\uff10\u301c\uff11\uff10\uff10\uff19\u307e\u3067\u306e\u30eb\u30fc\u30d7\u304c\u4f7f\u3048\u308b\nfor price in range(1010):\n if (floor(price * 0.08) == A) and (floor(price * 0.1) == B):\n # \u6761\u4ef6\u3092\u6e80\u305f\u3057\u305f\u306e\u3067\u305d\u306e\u91d1\u984d\u3092\u8868\u793a\u3057\u3066\u7d42\u4e86\n # \uff08\u5c0f\u3055\u3044\u91d1\u984d\u304b\u3089\u9806\u756a\u306b\u307f\u3066\u3044\u304f\u306e\u3067\u3001\u6700\u521d\u306b\u6761\u4ef6\u3092\u6e80\u305f\u3057\u305f\u3082\u306e\u304c\u3001\n # \u3000\u6761\u4ef6\u3092\u6e80\u305f\u3059\u91d1\u984d\u306e\u3046\u3061\u3067\u6700\u5c0f\u306e\u91d1\u984d\u306b\u306a\u308b\u3002\uff09\n print(price)\n quit()\n# \u6761\u4ef6\u3092\u6e80\u305f\u3059\u3082\u306e\u304c\u898b\u3064\u304b\u3063\u3066\u3044\u308c\u3070\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u7d42\u4e86\u3059\u308b\u306e\u3067\u3001\n# \u3053\u3053\u307e\u3067\u5b9f\u884c\u3055\u308c\u308b\u6642\u306f\u3001\u6761\u4ef6\u3092\u6e80\u305f\u3059\u91d1\u984d\u304c\u5b58\u5728\u3057\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3001\n# \u6761\u4ef6\u3092\u6e80\u305f\u3059\u91d1\u984d\u304c\u5b58\u5728\u3057\u306a\u3044\u6642\u306b\u8868\u793a\u3059\u3079\u304d -1 \u3092\u8868\u793a\u3059\u308b\u3002\n# \u6700\u5c0f\u884c\u306a\u306e\u3067\u3001quit()\u3057\u306a\u304f\u3066\u3082\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u7d42\u4e86\u3059\u308b\nprint((-1))\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["-import math","+from math import floor","-","-def main():","- A, B = list(map(int, input().split()))","- # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u53ef\u80fd\u6027\u306e\u3042\u308b\u6700\u5c0f\u306e\u6b63\u6570\u3092\u8a08\u7b97","- x_min = max(math.ceil(A \/ 0.08), math.ceil(B \/ 0.1))","- # \u6761\u4ef6\u3092\u6e80\u305f\u3059\u53ef\u80fd\u6027\u306e\u3042\u308b\u6700\u5927\u306e\u6b63\u6570\u3092\u8a08\u7b97","- x_max = min((math.ceil((A + 1) \/ 0.08), math.ceil((B + 1) \/ 0.1)))","- # \u5019\u88dc\u306e\u6b63\u6570\u3092\u9806\u756a\u306b\u30c1\u30a7\u30c3\u30af\u3057\u3001\u6e80\u305f\u3059\u3082\u306e\u304c\u3042\u308c\u3070\u305d\u308c\u3092\u51fa\u529b\u3057\u3066\u7d42\u4e86","- for x in range(x_min, x_max + 1):","- if (math.floor(x * 0.08) == A) and (math.floor(x * 0.1) == B):","- print(x)","- quit()","- # \u3053\u3053\u307e\u3067\u6765\u308b\u3068\u304d\u306f\u6e80\u305f\u3059\u3082\u306e\u304c\u306a\u3044\u306e\u3067\u3001-1\u3092\u51fa\u529b","- print((-1))","-","-","-if __name__ == \"__main__\":","- main()","+# \u5165\u529b\u5024\u306e\u53d6\u5f97","+A, B = list(map(int, input().split()))","+# \u554f\u984c\u306e\u5236\u7d04\u304b\u3089\u3001\u7b54\u3048\u306e\u5019\u88dc\u3068\u3057\u3066\u3042\u308a\u5f97\u308b\u7bc4\u56f2\u3092\u30c1\u30a7\u30c3\u30af","+# for _ in range(1010)\u3067\uff10\u301c\uff11\uff10\uff10\uff19\u307e\u3067\u306e\u30eb\u30fc\u30d7\u304c\u4f7f\u3048\u308b","+for price in range(1010):","+ if (floor(price * 0.08) == A) and (floor(price * 0.1) == B):","+ # \u6761\u4ef6\u3092\u6e80\u305f\u3057\u305f\u306e\u3067\u305d\u306e\u91d1\u984d\u3092\u8868\u793a\u3057\u3066\u7d42\u4e86","+ # \uff08\u5c0f\u3055\u3044\u91d1\u984d\u304b\u3089\u9806\u756a\u306b\u307f\u3066\u3044\u304f\u306e\u3067\u3001\u6700\u521d\u306b\u6761\u4ef6\u3092\u6e80\u305f\u3057\u305f\u3082\u306e\u304c\u3001","+ # \u3000\u6761\u4ef6\u3092\u6e80\u305f\u3059\u91d1\u984d\u306e\u3046\u3061\u3067\u6700\u5c0f\u306e\u91d1\u984d\u306b\u306a\u308b\u3002\uff09","+ print(price)","+ quit()","+# \u6761\u4ef6\u3092\u6e80\u305f\u3059\u3082\u306e\u304c\u898b\u3064\u304b\u3063\u3066\u3044\u308c\u3070\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u7d42\u4e86\u3059\u308b\u306e\u3067\u3001","+# \u3053\u3053\u307e\u3067\u5b9f\u884c\u3055\u308c\u308b\u6642\u306f\u3001\u6761\u4ef6\u3092\u6e80\u305f\u3059\u91d1\u984d\u304c\u5b58\u5728\u3057\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3001","+# \u6761\u4ef6\u3092\u6e80\u305f\u3059\u91d1\u984d\u304c\u5b58\u5728\u3057\u306a\u3044\u6642\u306b\u8868\u793a\u3059\u3079\u304d -1 \u3092\u8868\u793a\u3059\u308b\u3002","+# \u6700\u5c0f\u884c\u306a\u306e\u3067\u3001quit()\u3057\u306a\u304f\u3066\u3082\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u7d42\u4e86\u3059\u308b","+print((-1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0708744609,"measured_runtime_v1":0.0731768007,"runtime_lift":0.968537299,"key":["s818157475","s414944650"]} +{"user_id":"u867320886","problem_id":"p03732","language":"python","submission_id_v0":"s174635932","submission_id_v1":"s700747435","cpu_time_v0":1328,"cpu_time_v1":521,"memory_v0":53740,"memory_v1":37996,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.77,"input":"n,W = list(map(int,input().split()))\n\n\n\ndp = [[[0]*(3*n+1) for _ in range(n)] for _ in range(n)]\n\n\n\nw1,v1 = list(map(int,input().split()))\n\nfor i in range(3*n+1):\n\n dp[0][0][i] = v1\n\n\n\nfor i in range(1,n):\n\n w,v = list(map(int,input().split()))\n\n w -= w1\n\n for j in range(min(i+1,n)):\n\n for k in range(3*n+1):\n\n if j>0 and k>=w:\n\n dp[i][j][k] = max(dp[i-1][j][k], dp[i-1][j-1][k-w] + v)\n\n elif k>=w:\n\n dp[i][0][k] = max(dp[i-1][0][k], v)\n\n else:\n\n dp[i][j][k] = dp[i-1][j][k]\n\n\n\nans = 0\n\nfor i in range(n):\n\n for j in range(3*n+1):\n\n if w1*(i+1) + j>W: continue\n\n ans = max(ans,dp[-1][i][j])\n\n\n\nprint(ans)","target":"n,W = list(map(int,input().split()))\n\n\n\ndp = [[[0]*(3*n+1) for _ in range(n)] for _ in range(n)]\n\n\n\nw1,v1 = list(map(int,input().split()))\n\nfor i in range(3*n+1):\n\n dp[0][0][i] = v1\n\n\n\nfor i in range(1,n):\n\n w,v = list(map(int,input().split()))\n\n w -= w1\n\n for j in range(min(i+1,n)):\n\n for k in range(3*(j+1)+1):\n\n if j>0 and k>=w:\n\n dp[i][j][k] = max(dp[i-1][j][k], dp[i-1][j-1][k-w] + v)\n\n elif k>=w:\n\n dp[i][0][k] = max(dp[i-1][0][k], v)\n\n else:\n\n dp[i][j][k] = dp[i-1][j][k]\n\n\n\nans = 0\n\nfor i in range(n):\n\n for j in range(3*n+1):\n\n if w1*(i+1) + j>W: continue\n\n ans = max(ans,dp[-1][i][j])\n\n\n\nprint(ans)","code_v0_loc":27,"code_v1_loc":27,"code_v0_num_chars":701,"code_v1_num_chars":705,"code_v0_no_empty_lines":"n, W = list(map(int, input().split()))\ndp = [[[0] * (3 * n + 1) for _ in range(n)] for _ in range(n)]\nw1, v1 = list(map(int, input().split()))\nfor i in range(3 * n + 1):\n dp[0][0][i] = v1\nfor i in range(1, n):\n w, v = list(map(int, input().split()))\n w -= w1\n for j in range(min(i + 1, n)):\n for k in range(3 * n + 1):\n if j > 0 and k >= w:\n dp[i][j][k] = max(dp[i - 1][j][k], dp[i - 1][j - 1][k - w] + v)\n elif k >= w:\n dp[i][0][k] = max(dp[i - 1][0][k], v)\n else:\n dp[i][j][k] = dp[i - 1][j][k]\nans = 0\nfor i in range(n):\n for j in range(3 * n + 1):\n if w1 * (i + 1) + j > W:\n continue\n ans = max(ans, dp[-1][i][j])\nprint(ans)\n","code_v1_no_empty_lines":"n, W = list(map(int, input().split()))\ndp = [[[0] * (3 * n + 1) for _ in range(n)] for _ in range(n)]\nw1, v1 = list(map(int, input().split()))\nfor i in range(3 * n + 1):\n dp[0][0][i] = v1\nfor i in range(1, n):\n w, v = list(map(int, input().split()))\n w -= w1\n for j in range(min(i + 1, n)):\n for k in range(3 * (j + 1) + 1):\n if j > 0 and k >= w:\n dp[i][j][k] = max(dp[i - 1][j][k], dp[i - 1][j - 1][k - w] + v)\n elif k >= w:\n dp[i][0][k] = max(dp[i - 1][0][k], v)\n else:\n dp[i][j][k] = dp[i - 1][j][k]\nans = 0\nfor i in range(n):\n for j in range(3 * n + 1):\n if w1 * (i + 1) + j > W:\n continue\n ans = max(ans, dp[-1][i][j])\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- for k in range(3 * n + 1):","+ for k in range(3 * (j + 1) + 1):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0395582199,"measured_runtime_v1":0.0387088776,"runtime_lift":1.0219417971,"key":["s174635932","s700747435"]} +{"user_id":"u871201743","problem_id":"p03162","language":"python","submission_id_v0":"s040142287","submission_id_v1":"s523999932","cpu_time_v0":717,"cpu_time_v1":643,"memory_v0":74968,"memory_v1":46680,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.32,"input":"N = int(eval(input()))\n\nabc = []\n\nfor _ in range(N):\n\n abc.append(tuple(map(int, input().split())))\n\n\n\ndp = [[0] * 3 for _ in range(N+1)]\n\nfor i in range(1, N+1):\n\n for k in range(3):\n\n for last in range(3):\n\n if k != last:\n\n dp[i][k] = max(dp[i][k], dp[i-1][last] + abc[i-1][last])\n\n\n\nans = max(dp[N][k] for k in range(3))\n\nprint(ans)\n","target":"N = int(eval(input()))\n\n\n\ncur, nxt = [0] * 3, [0] * 3\n\nfor i in range(N):\n\n abc = [int(c) for c in input().split()]\n\n for k in range(3):\n\n for last in range(3):\n\n if k != last:\n\n nxt[k] = max(nxt[k], cur[last] + abc[k])\n\n\n\n cur = nxt\n\n nxt = [0] * 3\n\n\n\nans = max(cur[k] for k in range(3))\n\nprint(ans)\n","code_v0_loc":14,"code_v1_loc":15,"code_v0_num_chars":369,"code_v1_num_chars":340,"code_v0_no_empty_lines":"N = int(eval(input()))\nabc = []\nfor _ in range(N):\n abc.append(tuple(map(int, input().split())))\ndp = [[0] * 3 for _ in range(N + 1)]\nfor i in range(1, N + 1):\n for k in range(3):\n for last in range(3):\n if k != last:\n dp[i][k] = max(dp[i][k], dp[i - 1][last] + abc[i - 1][last])\nans = max(dp[N][k] for k in range(3))\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\ncur, nxt = [0] * 3, [0] * 3\nfor i in range(N):\n abc = [int(c) for c in input().split()]\n for k in range(3):\n for last in range(3):\n if k != last:\n nxt[k] = max(nxt[k], cur[last] + abc[k])\n cur = nxt\n nxt = [0] * 3\nans = max(cur[k] for k in range(3))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["-abc = []","-for _ in range(N):","- abc.append(tuple(map(int, input().split())))","-dp = [[0] * 3 for _ in range(N + 1)]","-for i in range(1, N + 1):","+cur, nxt = [0] * 3, [0] * 3","+for i in range(N):","+ abc = [int(c) for c in input().split()]","- dp[i][k] = max(dp[i][k], dp[i - 1][last] + abc[i - 1][last])","-ans = max(dp[N][k] for k in range(3))","+ nxt[k] = max(nxt[k], cur[last] + abc[k])","+ cur = nxt","+ nxt = [0] * 3","+ans = max(cur[k] for k in range(3))"],"diff_only_import_comment":false,"measured_runtime_v0":0.048096869,"measured_runtime_v1":0.0481127641,"runtime_lift":0.9996696274,"key":["s040142287","s523999932"]} +{"user_id":"u408260374","problem_id":"p02396","language":"python","submission_id_v0":"s823577384","submission_id_v1":"s162890749","cpu_time_v0":100,"cpu_time_v1":30,"memory_v0":4192,"memory_v1":4188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.0,"input":"i = 1\n\nwhile 1:\n\n\tx = eval(input())\n\n\tif x == 0:\n\n\t\tbreak\n\n\tprint('Case %d: %d' % (i, x))\n\n\ti+=1","target":"i = 1\n\nwhile 1:\n\n\tx = input()\n\n\tif x == '0':\n\n\t\tbreak\n\n\tprint('Case %d: %s' % (i, x))\n\n\ti+=1","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":89,"code_v1_num_chars":95,"code_v0_no_empty_lines":"i = 1\nwhile 1:\n x = eval(input())\n if x == 0:\n break\n print(\"Case %d: %d\" % (i, x))\n i += 1\n","code_v1_no_empty_lines":"i = 1\nwhile 1:\n x = input()\n if x == \"0\":\n break\n print(\"Case %d: %s\" % (i, x))\n i += 1\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- x = eval(input())","- if x == 0:","+ x = input()","+ if x == \"0\":","- print(\"Case %d: %d\" % (i, x))","+ print(\"Case %d: %s\" % (i, x))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0628847556,"measured_runtime_v1":0.0926090682,"runtime_lift":0.6790345358,"key":["s823577384","s162890749"]} +{"user_id":"u073852194","problem_id":"p03305","language":"python","submission_id_v0":"s997476099","submission_id_v1":"s560370965","cpu_time_v0":1784,"cpu_time_v1":946,"memory_v0":126556,"memory_v1":137608,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":46.97,"input":"import heapq\n\nimport sys\n\n\n\ninput = sys.stdin.readline\n\nINF = 10**18\n\n\n\nn,m,s,t = list(map(int,input().split()))\n\nedge = [list(map(int,input().split())) for _ in range(m)]\n\n\n\ngraph_s = [[] for _ in range(n)]\n\ngraph_t = [[] for _ in range(n)]\n\n\n\nfor e in edge:\n\n graph_s[e[0]-1].append([e[1]-1,e[2]])\n\n graph_s[e[1]-1].append([e[0]-1,e[2]])\n\n graph_t[e[0]-1].append([e[1]-1,e[3]])\n\n graph_t[e[1]-1].append([e[0]-1,e[3]])\n\n\n\ndist_s = [INF]*n\n\ndist_t = [INF]*n\n\n\n\ndist_s[s-1] = 0\n\ndist_t[t-1] = 0\n\n\n\nheap_s = [[0,s-1]]\n\nheapq.heapify(heap_s)\n\n\n\nheap_t = [[0,t-1]]\n\nheapq.heapify(heap_t)\n\n\n\nwhile heap_s:\n\n cost,node = heapq.heappop(heap_s)\n\n if dist_s[node] < cost:\n\n continue\n\n for adj,adjcost in graph_s[node]:\n\n if dist_s[node] + adjcost < dist_s[adj]:\n\n dist_s[adj] = dist_s[node] + adjcost\n\n heapq.heappush(heap_s,[dist_s[adj],adj])\n\n\n\nwhile heap_t:\n\n cost,node = heapq.heappop(heap_t)\n\n if dist_t[node] < cost:\n\n continue\n\n for adj,adjcost in graph_t[node]:\n\n if dist_t[node] + adjcost < dist_t[adj]:\n\n dist_t[adj] = dist_t[node] + adjcost\n\n heapq.heappush(heap_t,[dist_t[adj],adj])\n\n\n\ndist = INF\n\nans = []\n\n \n\nfor i in range(n):\n\n dist = min(dist,dist_t[-1-i]+dist_s[-1-i])\n\n ans.append(10**15-dist)\n\n \n\nfor i in range(n):\n\n print((ans[-1-i]))","target":"from heapq import heappop, heappush, heapify\n\n\n\nclass Graph(): #non-directed\n\n def __init__(self, n, edge, indexed=1):\n\n self.n = n\n\n self.edge = edge\n\n self.indexed = indexed\n\n self.graph = [[] for _ in range(n)]\n\n for e in edge:\n\n self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))\n\n self.graph[e[1] - indexed].append((e[0] - indexed, e[2]))\n\n\n\n def dijkstra(self, s, INF=10**18, restore_to=None):\n\n dist = [INF for _ in range(self.n)]\n\n dist[s] = 0\n\n heap = [(0, s)]\n\n prev = [None for _ in range(self.n)]\n\n while heap:\n\n cost, node = heappop(heap)\n\n if dist[node] < cost:\n\n continue\n\n for adj, adjcost in self.graph[node]:\n\n if dist[node] + adjcost < dist[adj]:\n\n dist[adj] = dist[node] + adjcost\n\n prev[adj] = node\n\n heappush(heap, (dist[adj], adj))\n\n if restore_to is not None:\n\n g = restore_to\n\n if dist[g] == INF:\n\n return dist, False\n\n path = [g]\n\n node = g\n\n while node != s:\n\n node = prev[node]\n\n path.append(node)\n\n return dist, path[::-1]\n\n return dist\n\n\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN, M, S, T = list(map(int, input().split()))\n\n\n\nE1 = []\n\nE2 = []\n\n\n\nfor _ in range(M):\n\n u, v, a, b = list(map(int, input().split()))\n\n E1.append((u, v, a))\n\n E2.append((u, v, b))\n\n \n\ng1 = Graph(N, E1)\n\ng2 = Graph(N, E2)\n\ndist_from_s = g1.dijkstra(S - 1)\n\ndist_from_t = g2.dijkstra(T - 1)\n\n\n\nres = list()\n\ntmp = 0\n\n\n\nfor i in range(N)[::-1]:\n\n tmp = max(tmp, 10**15 - dist_from_t[i] - dist_from_s[i])\n\n res.append(tmp)\n\n \n\nprint(('\\n'.join(map(str, res[::-1]))))","code_v0_loc":57,"code_v1_loc":64,"code_v0_num_chars":1398,"code_v1_num_chars":1831,"code_v0_no_empty_lines":"import heapq\nimport sys\n\ninput = sys.stdin.readline\nINF = 10**18\nn, m, s, t = list(map(int, input().split()))\nedge = [list(map(int, input().split())) for _ in range(m)]\ngraph_s = [[] for _ in range(n)]\ngraph_t = [[] for _ in range(n)]\nfor e in edge:\n graph_s[e[0] - 1].append([e[1] - 1, e[2]])\n graph_s[e[1] - 1].append([e[0] - 1, e[2]])\n graph_t[e[0] - 1].append([e[1] - 1, e[3]])\n graph_t[e[1] - 1].append([e[0] - 1, e[3]])\ndist_s = [INF] * n\ndist_t = [INF] * n\ndist_s[s - 1] = 0\ndist_t[t - 1] = 0\nheap_s = [[0, s - 1]]\nheapq.heapify(heap_s)\nheap_t = [[0, t - 1]]\nheapq.heapify(heap_t)\nwhile heap_s:\n cost, node = heapq.heappop(heap_s)\n if dist_s[node] < cost:\n continue\n for adj, adjcost in graph_s[node]:\n if dist_s[node] + adjcost < dist_s[adj]:\n dist_s[adj] = dist_s[node] + adjcost\n heapq.heappush(heap_s, [dist_s[adj], adj])\nwhile heap_t:\n cost, node = heapq.heappop(heap_t)\n if dist_t[node] < cost:\n continue\n for adj, adjcost in graph_t[node]:\n if dist_t[node] + adjcost < dist_t[adj]:\n dist_t[adj] = dist_t[node] + adjcost\n heapq.heappush(heap_t, [dist_t[adj], adj])\ndist = INF\nans = []\nfor i in range(n):\n dist = min(dist, dist_t[-1 - i] + dist_s[-1 - i])\n ans.append(10**15 - dist)\nfor i in range(n):\n print((ans[-1 - i]))\n","code_v1_no_empty_lines":"from heapq import heappop, heappush, heapify\n\n\nclass Graph: # non-directed\n def __init__(self, n, edge, indexed=1):\n self.n = n\n self.edge = edge\n self.indexed = indexed\n self.graph = [[] for _ in range(n)]\n for e in edge:\n self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))\n self.graph[e[1] - indexed].append((e[0] - indexed, e[2]))\n\n def dijkstra(self, s, INF=10**18, restore_to=None):\n dist = [INF for _ in range(self.n)]\n dist[s] = 0\n heap = [(0, s)]\n prev = [None for _ in range(self.n)]\n while heap:\n cost, node = heappop(heap)\n if dist[node] < cost:\n continue\n for adj, adjcost in self.graph[node]:\n if dist[node] + adjcost < dist[adj]:\n dist[adj] = dist[node] + adjcost\n prev[adj] = node\n heappush(heap, (dist[adj], adj))\n if restore_to is not None:\n g = restore_to\n if dist[g] == INF:\n return dist, False\n path = [g]\n node = g\n while node != s:\n node = prev[node]\n path.append(node)\n return dist, path[::-1]\n return dist\n\n\nimport sys\n\ninput = sys.stdin.readline\nN, M, S, T = list(map(int, input().split()))\nE1 = []\nE2 = []\nfor _ in range(M):\n u, v, a, b = list(map(int, input().split()))\n E1.append((u, v, a))\n E2.append((u, v, b))\ng1 = Graph(N, E1)\ng2 = Graph(N, E2)\ndist_from_s = g1.dijkstra(S - 1)\ndist_from_t = g2.dijkstra(T - 1)\nres = list()\ntmp = 0\nfor i in range(N)[::-1]:\n tmp = max(tmp, 10**15 - dist_from_t[i] - dist_from_s[i])\n res.append(tmp)\nprint((\"\\n\".join(map(str, res[::-1]))))\n","code_same":false,"relative_loc_diff_percent":10.9375,"diff":["-import heapq","+from heapq import heappop, heappush, heapify","+","+","+class Graph: # non-directed","+ def __init__(self, n, edge, indexed=1):","+ self.n = n","+ self.edge = edge","+ self.indexed = indexed","+ self.graph = [[] for _ in range(n)]","+ for e in edge:","+ self.graph[e[0] - indexed].append((e[1] - indexed, e[2]))","+ self.graph[e[1] - indexed].append((e[0] - indexed, e[2]))","+","+ def dijkstra(self, s, INF=10**18, restore_to=None):","+ dist = [INF for _ in range(self.n)]","+ dist[s] = 0","+ heap = [(0, s)]","+ prev = [None for _ in range(self.n)]","+ while heap:","+ cost, node = heappop(heap)","+ if dist[node] < cost:","+ continue","+ for adj, adjcost in self.graph[node]:","+ if dist[node] + adjcost < dist[adj]:","+ dist[adj] = dist[node] + adjcost","+ prev[adj] = node","+ heappush(heap, (dist[adj], adj))","+ if restore_to is not None:","+ g = restore_to","+ if dist[g] == INF:","+ return dist, False","+ path = [g]","+ node = g","+ while node != s:","+ node = prev[node]","+ path.append(node)","+ return dist, path[::-1]","+ return dist","+","+","-INF = 10**18","-n, m, s, t = list(map(int, input().split()))","-edge = [list(map(int, input().split())) for _ in range(m)]","-graph_s = [[] for _ in range(n)]","-graph_t = [[] for _ in range(n)]","-for e in edge:","- graph_s[e[0] - 1].append([e[1] - 1, e[2]])","- graph_s[e[1] - 1].append([e[0] - 1, e[2]])","- graph_t[e[0] - 1].append([e[1] - 1, e[3]])","- graph_t[e[1] - 1].append([e[0] - 1, e[3]])","-dist_s = [INF] * n","-dist_t = [INF] * n","-dist_s[s - 1] = 0","-dist_t[t - 1] = 0","-heap_s = [[0, s - 1]]","-heapq.heapify(heap_s)","-heap_t = [[0, t - 1]]","-heapq.heapify(heap_t)","-while heap_s:","- cost, node = heapq.heappop(heap_s)","- if dist_s[node] < cost:","- continue","- for adj, adjcost in graph_s[node]:","- if dist_s[node] + adjcost < dist_s[adj]:","- dist_s[adj] = dist_s[node] + adjcost","- heapq.heappush(heap_s, [dist_s[adj], adj])","-while heap_t:","- cost, node = heapq.heappop(heap_t)","- if dist_t[node] < cost:","- continue","- for adj, adjcost in graph_t[node]:","- if dist_t[node] + adjcost < dist_t[adj]:","- dist_t[adj] = dist_t[node] + adjcost","- heapq.heappush(heap_t, [dist_t[adj], adj])","-dist = INF","-ans = []","-for i in range(n):","- dist = min(dist, dist_t[-1 - i] + dist_s[-1 - i])","- ans.append(10**15 - dist)","-for i in range(n):","- print((ans[-1 - i]))","+N, M, S, T = list(map(int, input().split()))","+E1 = []","+E2 = []","+for _ in range(M):","+ u, v, a, b = list(map(int, input().split()))","+ E1.append((u, v, a))","+ E2.append((u, v, b))","+g1 = Graph(N, E1)","+g2 = Graph(N, E2)","+dist_from_s = g1.dijkstra(S - 1)","+dist_from_t = g2.dijkstra(T - 1)","+res = list()","+tmp = 0","+for i in range(N)[::-1]:","+ tmp = max(tmp, 10**15 - dist_from_t[i] - dist_from_s[i])","+ res.append(tmp)","+print((\"\\n\".join(map(str, res[::-1]))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0386493553,"measured_runtime_v1":0.0348652377,"runtime_lift":1.1085355459,"key":["s997476099","s560370965"]} +{"user_id":"u489959379","problem_id":"p03830","language":"python","submission_id_v0":"s254947770","submission_id_v1":"s387287122","cpu_time_v0":62,"cpu_time_v1":22,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.52,"input":"MOD = 10 ** 9 + 7\n\nn = int(eval(input()))\n\n\n\nres = 1\n\nex = [0 for _ in range(n + 1)]\n\nfor i in range(1, n + 1):\n\n for j in range(2, i + 1):\n\n if i % j == 0:\n\n while i % j == 0:\n\n ex[j] += 1\n\n i \/\/= j\n\n\n\nans = 1\n\nfor i in range(n + 1):\n\n ans *= (ex[i] + 1)\n\n ans %= MOD\n\n \n\nprint(ans)\n","target":"import sys\n\n\n\nsys.setrecursionlimit(10 ** 7)\n\ninput = sys.stdin.readline\n\nf_inf = float('inf')\n\nmod = 10 ** 9 + 7\n\n\n\n\n\ndef prime_factorization(n):\n\n res = []\n\n for i in range(2, int(pow(n, 0.5)) + 1):\n\n if n % i == 0:\n\n ex = 0\n\n while n % i == 0:\n\n ex += 1\n\n n \/\/= i\n\n res.append([i, ex])\n\n if n != 1:\n\n res.append([n, 1])\n\n\n\n return res\n\n\n\n\n\ndef resolve():\n\n n = int(eval(input()))\n\n\n\n P = [0] * 1000\n\n for i in range(1, n + 1):\n\n t = prime_factorization(i)\n\n for num, ex in t:\n\n P[num] += ex\n\n\n\n res = 1\n\n for p in P:\n\n res *= p + 1\n\n res % mod\n\n\n\n print((res % mod))\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","code_v0_loc":18,"code_v1_loc":42,"code_v0_num_chars":338,"code_v1_num_chars":755,"code_v0_no_empty_lines":"MOD = 10**9 + 7\nn = int(eval(input()))\nres = 1\nex = [0 for _ in range(n + 1)]\nfor i in range(1, n + 1):\n for j in range(2, i + 1):\n if i % j == 0:\n while i % j == 0:\n ex[j] += 1\n i \/\/= j\nans = 1\nfor i in range(n + 1):\n ans *= ex[i] + 1\n ans %= MOD\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\nf_inf = float(\"inf\")\nmod = 10**9 + 7\n\n\ndef prime_factorization(n):\n res = []\n for i in range(2, int(pow(n, 0.5)) + 1):\n if n % i == 0:\n ex = 0\n while n % i == 0:\n ex += 1\n n \/\/= i\n res.append([i, ex])\n if n != 1:\n res.append([n, 1])\n return res\n\n\ndef resolve():\n n = int(eval(input()))\n P = [0] * 1000\n for i in range(1, n + 1):\n t = prime_factorization(i)\n for num, ex in t:\n P[num] += ex\n res = 1\n for p in P:\n res *= p + 1\n res % mod\n print((res % mod))\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-MOD = 10**9 + 7","-n = int(eval(input()))","-res = 1","-ex = [0 for _ in range(n + 1)]","-for i in range(1, n + 1):","- for j in range(2, i + 1):","- if i % j == 0:","- while i % j == 0:","- ex[j] += 1","- i \/\/= j","-ans = 1","-for i in range(n + 1):","- ans *= ex[i] + 1","- ans %= MOD","-print(ans)","+import sys","+","+sys.setrecursionlimit(10**7)","+input = sys.stdin.readline","+f_inf = float(\"inf\")","+mod = 10**9 + 7","+","+","+def prime_factorization(n):","+ res = []","+ for i in range(2, int(pow(n, 0.5)) + 1):","+ if n % i == 0:","+ ex = 0","+ while n % i == 0:","+ ex += 1","+ n \/\/= i","+ res.append([i, ex])","+ if n != 1:","+ res.append([n, 1])","+ return res","+","+","+def resolve():","+ n = int(eval(input()))","+ P = [0] * 1000","+ for i in range(1, n + 1):","+ t = prime_factorization(i)","+ for num, ex in t:","+ P[num] += ex","+ res = 1","+ for p in P:","+ res *= p + 1","+ res % mod","+ print((res % mod))","+","+","+if __name__ == \"__main__\":","+ resolve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.072663641,"measured_runtime_v1":0.0775625229,"runtime_lift":0.9368395748,"key":["s254947770","s387287122"]} +{"user_id":"u761989513","problem_id":"p02993","language":"python","submission_id_v0":"s640009546","submission_id_v1":"s918319253","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"s = eval(input())\n\nfor i in range(1, 4):\n\n if s[i] == s[i - 1]:\n\n print(\"Bad\")\n\n exit()\n\nprint(\"Good\")","target":"s = eval(input())\n\nfor i in range(3):\n\n if s[i] == s[i + 1]:\n\n print(\"Bad\")\n\n exit()\n\nprint(\"Good\")","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":113,"code_v1_num_chars":110,"code_v0_no_empty_lines":"s = eval(input())\nfor i in range(1, 4):\n if s[i] == s[i - 1]:\n print(\"Bad\")\n exit()\nprint(\"Good\")\n","code_v1_no_empty_lines":"s = eval(input())\nfor i in range(3):\n if s[i] == s[i + 1]:\n print(\"Bad\")\n exit()\nprint(\"Good\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-for i in range(1, 4):","- if s[i] == s[i - 1]:","+for i in range(3):","+ if s[i] == s[i + 1]:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1032080886,"measured_runtime_v1":0.067666486,"runtime_lift":1.5252467608,"key":["s640009546","s918319253"]} +{"user_id":"u325956328","problem_id":"p02642","language":"python","submission_id_v0":"s800245442","submission_id_v1":"s434267585","cpu_time_v0":1543,"cpu_time_v1":527,"memory_v0":47600,"memory_v1":32392,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.85,"input":"from collections import Counter\n\n\n\nN = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nMAX = 10 ** 6 + 10\n\nmultiples = [0] * MAX\n\n\n\nfor a in list(set(A)):\n\n for j in range(a * 2, MAX, a):\n\n multiples[j] = 1\n\n\n\nd = Counter(A)\n\ndup = [k for k, v in list(d.items()) if v > 1]\n\nfor i in dup:\n\n multiples[i] = 1\n\n\n\nans = 0\n\nfor i in A:\n\n if multiples[i] == 0:\n\n ans += 1\n\nprint(ans)\n","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nMAX = 10 ** 6 + 10\n\ncnt = [0] * MAX # cnt\u304c1\u4ee5\u4e0a\u306a\u3089\u305d\u306e\u6570\u4ee5\u4e0b\u306b\u7d04\u6570\u304c1\u500b\u4ee5\u4e0a\u5b58\u5728\u3059\u308b(\u81ea\u5206\u3082\u542b\u3081\u308b)\n\n\n\nfor a in A:\n\n if cnt[a] != 0:\n\n cnt[a] += 1\n\n continue\n\n for j in range(a, MAX, a):\n\n cnt[j] += 1\n\nans = 0\n\nfor a in A:\n\n if cnt[a] == 1:\n\n ans += 1\n\nprint(ans)\n","code_v0_loc":22,"code_v1_loc":16,"code_v0_num_chars":400,"code_v1_num_chars":330,"code_v0_no_empty_lines":"from collections import Counter\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nMAX = 10**6 + 10\nmultiples = [0] * MAX\nfor a in list(set(A)):\n for j in range(a * 2, MAX, a):\n multiples[j] = 1\nd = Counter(A)\ndup = [k for k, v in list(d.items()) if v > 1]\nfor i in dup:\n multiples[i] = 1\nans = 0\nfor i in A:\n if multiples[i] == 0:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nMAX = 10**6 + 10\ncnt = [0] * MAX # cnt\u304c1\u4ee5\u4e0a\u306a\u3089\u305d\u306e\u6570\u4ee5\u4e0b\u306b\u7d04\u6570\u304c1\u500b\u4ee5\u4e0a\u5b58\u5728\u3059\u308b(\u81ea\u5206\u3082\u542b\u3081\u308b)\nfor a in A:\n if cnt[a] != 0:\n cnt[a] += 1\n continue\n for j in range(a, MAX, a):\n cnt[j] += 1\nans = 0\nfor a in A:\n if cnt[a] == 1:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-from collections import Counter","-","-multiples = [0] * MAX","-for a in list(set(A)):","- for j in range(a * 2, MAX, a):","- multiples[j] = 1","-d = Counter(A)","-dup = [k for k, v in list(d.items()) if v > 1]","-for i in dup:","- multiples[i] = 1","+cnt = [0] * MAX # cnt\u304c1\u4ee5\u4e0a\u306a\u3089\u305d\u306e\u6570\u4ee5\u4e0b\u306b\u7d04\u6570\u304c1\u500b\u4ee5\u4e0a\u5b58\u5728\u3059\u308b(\u81ea\u5206\u3082\u542b\u3081\u308b)","+for a in A:","+ if cnt[a] != 0:","+ cnt[a] += 1","+ continue","+ for j in range(a, MAX, a):","+ cnt[j] += 1","-for i in A:","- if multiples[i] == 0:","+for a in A:","+ if cnt[a] == 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.144237705,"measured_runtime_v1":0.5029635901,"runtime_lift":0.2867756391,"key":["s800245442","s434267585"]} +{"user_id":"u411858517","problem_id":"p03210","language":"python","submission_id_v0":"s614159945","submission_id_v1":"s554630097","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"X = int(eval(input()))\n\nif X == 7 or X == 5 or X == 3:\n\n print('YES')\n\nelse:\n\n print('NO')","target":"X = int(eval(input()))\n\n\n\nif X in (3, 5, 7):\n\n print('YES')\n\n \n\nelse:\n\n print('NO')","code_v0_loc":5,"code_v1_loc":7,"code_v0_num_chars":90,"code_v1_num_chars":86,"code_v0_no_empty_lines":"X = int(eval(input()))\nif X == 7 or X == 5 or X == 3:\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_v1_no_empty_lines":"X = int(eval(input()))\nif X in (3, 5, 7):\n print(\"YES\")\nelse:\n print(\"NO\")\n","code_same":false,"relative_loc_diff_percent":28.5714285714,"diff":["-if X == 7 or X == 5 or X == 3:","+if X in (3, 5, 7):"],"diff_only_import_comment":false,"measured_runtime_v0":0.1325544954,"measured_runtime_v1":0.0415496926,"runtime_lift":3.190264163,"key":["s614159945","s554630097"]} +{"user_id":"u070449185","problem_id":"p03127","language":"python","submission_id_v0":"s314519700","submission_id_v1":"s375227773","cpu_time_v0":92,"cpu_time_v1":85,"memory_v0":21832,"memory_v1":14252,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.61,"input":"from sys import stdin\n\nfrom functools import reduce\n\nimport fractions\n\n#input = stdin.readline\n\nN = int(eval(input()))\n\nA = list(set(map(int,input().split())))\n\nanswer = reduce(fractions.gcd, A)\n\nprint(answer)","target":"def gcd(a,b):\n\n if(a%b==0):\n\n return b\n\n else:\n\n return gcd(b,a%b)\n\nN = int(eval(input()))\n\ns = [int(x) for x in input().split()]\n\ntmp = s[0]\n\nfor i in s[1:]:\n\n tmp = gcd(tmp,i)\n\nprint(tmp)","code_v0_loc":8,"code_v1_loc":11,"code_v0_num_chars":203,"code_v1_num_chars":206,"code_v0_no_empty_lines":"from sys import stdin\nfrom functools import reduce\nimport fractions\n\n# input = stdin.readline\nN = int(eval(input()))\nA = list(set(map(int, input().split())))\nanswer = reduce(fractions.gcd, A)\nprint(answer)\n","code_v1_no_empty_lines":"def gcd(a, b):\n if a % b == 0:\n return b\n else:\n return gcd(b, a % b)\n\n\nN = int(eval(input()))\ns = [int(x) for x in input().split()]\ntmp = s[0]\nfor i in s[1:]:\n tmp = gcd(tmp, i)\nprint(tmp)\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-from sys import stdin","-from functools import reduce","-import fractions","+def gcd(a, b):","+ if a % b == 0:","+ return b","+ else:","+ return gcd(b, a % b)","-# input = stdin.readline","+","-A = list(set(map(int, input().split())))","-answer = reduce(fractions.gcd, A)","-print(answer)","+s = [int(x) for x in input().split()]","+tmp = s[0]","+for i in s[1:]:","+ tmp = gcd(tmp, i)","+print(tmp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0556967752,"measured_runtime_v1":0.0826031606,"runtime_lift":0.6742692988,"key":["s314519700","s375227773"]} +{"user_id":"u797673668","problem_id":"p02262","language":"python","submission_id_v0":"s299039508","submission_id_v1":"s525724252","cpu_time_v0":22520,"cpu_time_v1":14220,"memory_v0":127848,"memory_v1":127888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":36.86,"input":"def insertion_sort(a, n, g, cnt):\n\n for i in range(g, n):\n\n v, j = a[i], i - g\n\n while j >= 0 and a[j] > v:\n\n a[j + g] = a[j]\n\n j = j - g\n\n cnt += 1\n\n a[j + g] = v\n\n return cnt\n\n\n\n\n\nn = int(eval(input()))\n\na = list(int(eval(input())) for _ in range(n))\n\n\n\nm, g, cnt = 0, n \/\/ 2 + 1, 0\n\nglist = []\n\n\n\nwhile g:\n\n m += 1\n\n glist.append(g)\n\n cnt = insertion_sort(a, n, g, cnt)\n\n g \/\/= 2\n\n\n\nprint(m)\n\nprint((*glist))\n\nprint(cnt)\n\nprint(('\\n'.join(str(i) for i in a)))","target":"def insertion_sort(a, n, g, cnt):\n\n for i in range(g, n):\n\n v, j = a[i], i - g\n\n while j >= 0 and a[j] > v:\n\n a[j + g] = a[j]\n\n j = j - g\n\n cnt += 1\n\n a[j + g] = v\n\n return cnt\n\n\n\n\n\nn = int(eval(input()))\n\na = list(int(eval(input())) for _ in range(n))\n\n\n\nm, g, glist, cnt = 0, 1, [], 0\n\nwhile g <= n:\n\n m += 1\n\n glist.append(g)\n\n g = 4 ** m + 3 * 2 ** (m - 1) + 1\n\n\n\nglist.reverse()\n\n\n\nfor g in glist:\n\n cnt = insertion_sort(a, n, g, cnt)\n\n\n\nprint(m)\n\nprint((*glist))\n\nprint(cnt)\n\nprint(('\\n'.join(map(str, a))))","code_v0_loc":27,"code_v1_loc":29,"code_v0_num_chars":518,"code_v1_num_chars":569,"code_v0_no_empty_lines":"def insertion_sort(a, n, g, cnt):\n for i in range(g, n):\n v, j = a[i], i - g\n while j >= 0 and a[j] > v:\n a[j + g] = a[j]\n j = j - g\n cnt += 1\n a[j + g] = v\n return cnt\n\n\nn = int(eval(input()))\na = list(int(eval(input())) for _ in range(n))\nm, g, cnt = 0, n \/\/ 2 + 1, 0\nglist = []\nwhile g:\n m += 1\n glist.append(g)\n cnt = insertion_sort(a, n, g, cnt)\n g \/\/= 2\nprint(m)\nprint((*glist))\nprint(cnt)\nprint((\"\\n\".join(str(i) for i in a)))\n","code_v1_no_empty_lines":"def insertion_sort(a, n, g, cnt):\n for i in range(g, n):\n v, j = a[i], i - g\n while j >= 0 and a[j] > v:\n a[j + g] = a[j]\n j = j - g\n cnt += 1\n a[j + g] = v\n return cnt\n\n\nn = int(eval(input()))\na = list(int(eval(input())) for _ in range(n))\nm, g, glist, cnt = 0, 1, [], 0\nwhile g <= n:\n m += 1\n glist.append(g)\n g = 4**m + 3 * 2 ** (m - 1) + 1\nglist.reverse()\nfor g in glist:\n cnt = insertion_sort(a, n, g, cnt)\nprint(m)\nprint((*glist))\nprint(cnt)\nprint((\"\\n\".join(map(str, a))))\n","code_same":false,"relative_loc_diff_percent":6.8965517241,"diff":["-m, g, cnt = 0, n \/\/ 2 + 1, 0","-glist = []","-while g:","+m, g, glist, cnt = 0, 1, [], 0","+while g <= n:","+ g = 4**m + 3 * 2 ** (m - 1) + 1","+glist.reverse()","+for g in glist:","- g \/\/= 2","-print((\"\\n\".join(str(i) for i in a)))","+print((\"\\n\".join(map(str, a))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0386507896,"measured_runtime_v1":0.0473859762,"runtime_lift":0.8156588237,"key":["s299039508","s525724252"]} +{"user_id":"u983918956","problem_id":"p03287","language":"python","submission_id_v0":"s285228388","submission_id_v1":"s985882513","cpu_time_v0":101,"cpu_time_v1":84,"memory_v0":17236,"memory_v1":17236,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.83,"input":"import itertools\n\nN,M = list(map(int,input().split()))\n\nA = list(map(int,input().split()))\n\nacc = itertools.accumulate(A)\n\nacc = [e % M for e in acc]\n\ncnt_dict = {}\n\nans = 0\n\nfor e in acc:\n\n if e == 0:\n\n ans += 1\n\n if e in cnt_dict:\n\n cnt_dict[e] += 1\n\n else:\n\n cnt_dict[e] = 0\n\n ans += cnt_dict[e]\n\nprint(ans)","target":"def main():\n\n import itertools\n\n N,M = list(map(int,input().split()))\n\n A = list(map(int,input().split()))\n\n acc = itertools.accumulate(A)\n\n acc = [e % M for e in acc]\n\n cnt_dict = {}\n\n ans = 0\n\n for e in acc:\n\n if e == 0:\n\n ans += 1\n\n if e in cnt_dict:\n\n cnt_dict[e] += 1\n\n else:\n\n cnt_dict[e] = 0\n\n ans += cnt_dict[e]\n\n print(ans)\n\n\n\nmain()","code_v0_loc":16,"code_v1_loc":19,"code_v0_num_chars":337,"code_v1_num_chars":424,"code_v0_no_empty_lines":"import itertools\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nacc = itertools.accumulate(A)\nacc = [e % M for e in acc]\ncnt_dict = {}\nans = 0\nfor e in acc:\n if e == 0:\n ans += 1\n if e in cnt_dict:\n cnt_dict[e] += 1\n else:\n cnt_dict[e] = 0\n ans += cnt_dict[e]\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n import itertools\n\n N, M = list(map(int, input().split()))\n A = list(map(int, input().split()))\n acc = itertools.accumulate(A)\n acc = [e % M for e in acc]\n cnt_dict = {}\n ans = 0\n for e in acc:\n if e == 0:\n ans += 1\n if e in cnt_dict:\n cnt_dict[e] += 1\n else:\n cnt_dict[e] = 0\n ans += cnt_dict[e]\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-import itertools","+def main():","+ import itertools","-N, M = list(map(int, input().split()))","-A = list(map(int, input().split()))","-acc = itertools.accumulate(A)","-acc = [e % M for e in acc]","-cnt_dict = {}","-ans = 0","-for e in acc:","- if e == 0:","- ans += 1","- if e in cnt_dict:","- cnt_dict[e] += 1","- else:","- cnt_dict[e] = 0","- ans += cnt_dict[e]","-print(ans)","+ N, M = list(map(int, input().split()))","+ A = list(map(int, input().split()))","+ acc = itertools.accumulate(A)","+ acc = [e % M for e in acc]","+ cnt_dict = {}","+ ans = 0","+ for e in acc:","+ if e == 0:","+ ans += 1","+ if e in cnt_dict:","+ cnt_dict[e] += 1","+ else:","+ cnt_dict[e] = 0","+ ans += cnt_dict[e]","+ print(ans)","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0400010171,"measured_runtime_v1":0.036624531,"runtime_lift":1.0921919259,"key":["s285228388","s985882513"]} +{"user_id":"u075012704","problem_id":"p03298","language":"python","submission_id_v0":"s336321027","submission_id_v1":"s199833111","cpu_time_v0":2426,"cpu_time_v1":1829,"memory_v0":170100,"memory_v1":129640,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.61,"input":"from collections import defaultdict\n\n\n\nN = int(eval(input()))\n\nS = eval(input())\n\n\n\nS1 = S[:N]\n\nS2 = S[N:][::-1]\n\n\n\nans = 0\n\nD = defaultdict(int)\n\n\n\nfor i in range(2**N):\n\n bit = bin(2**N+i)[3:]\n\n\n\n red1 = \"\".join([d for d, s in zip(S1, bit) if s == \"1\"])\n\n blue1 = \"\".join([d for d, s in zip(S1, bit) if s == \"0\"])\n\n D[(red1, blue1)] += 1\n\n\n\nfor i in range(2**N):\n\n bit = bin(2 ** N + i)[3:]\n\n\n\n red2 = \"\".join([d for d, s in zip(S2, bit) if s == \"1\"])\n\n blue2 = \"\".join([d for d, s in zip(S2, bit) if s == \"0\"])\n\n ans += D[(blue2, red2)]\n\n\n\nprint(ans)\n","target":"from itertools import product\n\nfrom collections import defaultdict\n\nN = int(eval(input()))\n\nS = eval(input())\n\n\n\nans = 0\n\nD = defaultdict(int)\n\nfor pattern in product([0, 1], repeat=N):\n\n red = ''.join([s for s, p in zip(S[:N], pattern) if p == 0])\n\n blue = ''.join([s for s, p in zip(S[:N], pattern) if p == 1])\n\n D[(red, blue)] += 1\n\n\n\nfor pattern in product([0, 1], repeat=N):\n\n red = ''.join([s for s, p in zip(S[N:], pattern) if p == 0])\n\n blue = ''.join([s for s, p in zip(S[N:], pattern) if p == 1])\n\n ans += D[(blue[::-1], red[::-1])]\n\nprint(ans)\n","code_v0_loc":26,"code_v1_loc":17,"code_v0_num_chars":566,"code_v1_num_chars":561,"code_v0_no_empty_lines":"from collections import defaultdict\n\nN = int(eval(input()))\nS = eval(input())\nS1 = S[:N]\nS2 = S[N:][::-1]\nans = 0\nD = defaultdict(int)\nfor i in range(2**N):\n bit = bin(2**N + i)[3:]\n red1 = \"\".join([d for d, s in zip(S1, bit) if s == \"1\"])\n blue1 = \"\".join([d for d, s in zip(S1, bit) if s == \"0\"])\n D[(red1, blue1)] += 1\nfor i in range(2**N):\n bit = bin(2**N + i)[3:]\n red2 = \"\".join([d for d, s in zip(S2, bit) if s == \"1\"])\n blue2 = \"\".join([d for d, s in zip(S2, bit) if s == \"0\"])\n ans += D[(blue2, red2)]\nprint(ans)\n","code_v1_no_empty_lines":"from itertools import product\nfrom collections import defaultdict\n\nN = int(eval(input()))\nS = eval(input())\nans = 0\nD = defaultdict(int)\nfor pattern in product([0, 1], repeat=N):\n red = \"\".join([s for s, p in zip(S[:N], pattern) if p == 0])\n blue = \"\".join([s for s, p in zip(S[:N], pattern) if p == 1])\n D[(red, blue)] += 1\nfor pattern in product([0, 1], repeat=N):\n red = \"\".join([s for s, p in zip(S[N:], pattern) if p == 0])\n blue = \"\".join([s for s, p in zip(S[N:], pattern) if p == 1])\n ans += D[(blue[::-1], red[::-1])]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":34.6153846154,"diff":["+from itertools import product","-S1 = S[:N]","-S2 = S[N:][::-1]","-for i in range(2**N):","- bit = bin(2**N + i)[3:]","- red1 = \"\".join([d for d, s in zip(S1, bit) if s == \"1\"])","- blue1 = \"\".join([d for d, s in zip(S1, bit) if s == \"0\"])","- D[(red1, blue1)] += 1","-for i in range(2**N):","- bit = bin(2**N + i)[3:]","- red2 = \"\".join([d for d, s in zip(S2, bit) if s == \"1\"])","- blue2 = \"\".join([d for d, s in zip(S2, bit) if s == \"0\"])","- ans += D[(blue2, red2)]","+for pattern in product([0, 1], repeat=N):","+ red = \"\".join([s for s, p in zip(S[:N], pattern) if p == 0])","+ blue = \"\".join([s for s, p in zip(S[:N], pattern) if p == 1])","+ D[(red, blue)] += 1","+for pattern in product([0, 1], repeat=N):","+ red = \"\".join([s for s, p in zip(S[N:], pattern) if p == 0])","+ blue = \"\".join([s for s, p in zip(S[N:], pattern) if p == 1])","+ ans += D[(blue[::-1], red[::-1])]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0073662159,"measured_runtime_v1":0.0715593884,"runtime_lift":0.1029384978,"key":["s336321027","s199833111"]} +{"user_id":"u037430802","problem_id":"p03157","language":"python","submission_id_v0":"s842069329","submission_id_v1":"s787887002","cpu_time_v0":1101,"cpu_time_v1":775,"memory_v0":89068,"memory_v1":37100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.61,"input":"from collections import defaultdict\n\n\n\nH,W = list(map(int, input().split()))\n\nS = [eval(input()) for _ in range(H)]\n\n\n\nes = defaultdict(list)\n\n\n\nfor i in range(H):\n\n for j in range(W):\n\n if 0 <= i < H-1:\n\n if S[i][j] != S[i+1][j]:\n\n es[(i,j)].append((i+1, j))\n\n es[(i+1,j)].append((i, j))\n\n\n\n if 0 <= j < W-1:\n\n if S[i][j] != S[i][j+1]:\n\n es[(i,j)].append((i, j+1))\n\n es[(i,j+1)].append((i, j))\n\n\n\nchecked = [[False for _ in range(W)] for _ in range(H)]\n\n\n\nans = 0\n\nfor i in range(H):\n\n for j in range(W):\n\n b,w = 0,0\n\n if not checked[i][j]:\n\n checked[i][j] = True\n\n if S[i][j] == \"#\":\n\n b += 1\n\n else:\n\n w += 1\n\n q = es[(i,j)]\n\n while q:\n\n y,x = q.pop()\n\n if not checked[y][x]:\n\n checked[y][x] = True\n\n if S[y][x] == \"#\":\n\n b += 1\n\n else:\n\n w += 1\n\n q.extend(es[(y,x)])\n\n ans += b * w\n\n\n\nprint(ans)\n","target":"from collections import defaultdict\n\n\n\nclass UnionFind:\n\n def __init__(self,N):\n\n self.parent = [i for i in range(N)]\n\n self.rank = [0] * N\n\n self.count = 0\n\n def root(self,a):\n\n if self.parent[a] == a:\n\n return a\n\n else:\n\n self.parent[a] = self.root(self.parent[a])\n\n return self.parent[a]\n\n def is_same(self,a,b):\n\n return self.root(a) == self.root(b)\n\n def unite(self,a,b):\n\n ra = self.root(a)\n\n rb = self.root(b)\n\n if ra == rb: return\n\n if self.rank[ra] < self.rank[rb]:\n\n self.parent[ra] = rb\n\n else:\n\n self.parent[rb] = ra\n\n if self.rank[ra] == self.rank[rb]: self.rank[ra] += 1\n\n self.count += 1\n\n\n\nH,W = list(map(int, input().split()))\n\nS = [eval(input()) for _ in range(H)]\n\n\n\nuf = UnionFind(H*W)\n\n\n\nfor i in range(H):\n\n for j in range(W):\n\n if 0 <= i < H-1:\n\n if S[i][j] != S[i+1][j]:\n\n uf.unite(W*i+j, W*(i+1)+j)\n\n \n\n if 0 <= j < W-1:\n\n if S[i][j] != S[i][j+1]:\n\n uf.unite(W*i+j, W*i+j+1)\n\n\n\n\n\nblack = defaultdict(int)\n\nwhite = defaultdict(int)\n\nunions = set(uf.parent)\n\nfor i in range(H):\n\n for j in range(W):\n\n if S[i][j] == \"#\":\n\n black[uf.root(W*i+j)] += 1\n\n else:\n\n white[uf.root(W*i+j)] += 1\n\nans = 0\n\nfor u in unions:\n\n ans += black[u] * white[u]\n\n\n\nprint(ans)","code_v0_loc":44,"code_v1_loc":56,"code_v0_num_chars":1152,"code_v1_num_chars":1439,"code_v0_no_empty_lines":"from collections import defaultdict\n\nH, W = list(map(int, input().split()))\nS = [eval(input()) for _ in range(H)]\nes = defaultdict(list)\nfor i in range(H):\n for j in range(W):\n if 0 <= i < H - 1:\n if S[i][j] != S[i + 1][j]:\n es[(i, j)].append((i + 1, j))\n es[(i + 1, j)].append((i, j))\n if 0 <= j < W - 1:\n if S[i][j] != S[i][j + 1]:\n es[(i, j)].append((i, j + 1))\n es[(i, j + 1)].append((i, j))\nchecked = [[False for _ in range(W)] for _ in range(H)]\nans = 0\nfor i in range(H):\n for j in range(W):\n b, w = 0, 0\n if not checked[i][j]:\n checked[i][j] = True\n if S[i][j] == \"#\":\n b += 1\n else:\n w += 1\n q = es[(i, j)]\n while q:\n y, x = q.pop()\n if not checked[y][x]:\n checked[y][x] = True\n if S[y][x] == \"#\":\n b += 1\n else:\n w += 1\n q.extend(es[(y, x)])\n ans += b * w\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict\n\n\nclass UnionFind:\n def __init__(self, N):\n self.parent = [i for i in range(N)]\n self.rank = [0] * N\n self.count = 0\n\n def root(self, a):\n if self.parent[a] == a:\n return a\n else:\n self.parent[a] = self.root(self.parent[a])\n return self.parent[a]\n\n def is_same(self, a, b):\n return self.root(a) == self.root(b)\n\n def unite(self, a, b):\n ra = self.root(a)\n rb = self.root(b)\n if ra == rb:\n return\n if self.rank[ra] < self.rank[rb]:\n self.parent[ra] = rb\n else:\n self.parent[rb] = ra\n if self.rank[ra] == self.rank[rb]:\n self.rank[ra] += 1\n self.count += 1\n\n\nH, W = list(map(int, input().split()))\nS = [eval(input()) for _ in range(H)]\nuf = UnionFind(H * W)\nfor i in range(H):\n for j in range(W):\n if 0 <= i < H - 1:\n if S[i][j] != S[i + 1][j]:\n uf.unite(W * i + j, W * (i + 1) + j)\n if 0 <= j < W - 1:\n if S[i][j] != S[i][j + 1]:\n uf.unite(W * i + j, W * i + j + 1)\nblack = defaultdict(int)\nwhite = defaultdict(int)\nunions = set(uf.parent)\nfor i in range(H):\n for j in range(W):\n if S[i][j] == \"#\":\n black[uf.root(W * i + j)] += 1\n else:\n white[uf.root(W * i + j)] += 1\nans = 0\nfor u in unions:\n ans += black[u] * white[u]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["+","+","+class UnionFind:","+ def __init__(self, N):","+ self.parent = [i for i in range(N)]","+ self.rank = [0] * N","+ self.count = 0","+","+ def root(self, a):","+ if self.parent[a] == a:","+ return a","+ else:","+ self.parent[a] = self.root(self.parent[a])","+ return self.parent[a]","+","+ def is_same(self, a, b):","+ return self.root(a) == self.root(b)","+","+ def unite(self, a, b):","+ ra = self.root(a)","+ rb = self.root(b)","+ if ra == rb:","+ return","+ if self.rank[ra] < self.rank[rb]:","+ self.parent[ra] = rb","+ else:","+ self.parent[rb] = ra","+ if self.rank[ra] == self.rank[rb]:","+ self.rank[ra] += 1","+ self.count += 1","+","-es = defaultdict(list)","+uf = UnionFind(H * W)","- es[(i, j)].append((i + 1, j))","- es[(i + 1, j)].append((i, j))","+ uf.unite(W * i + j, W * (i + 1) + j)","- es[(i, j)].append((i, j + 1))","- es[(i, j + 1)].append((i, j))","-checked = [[False for _ in range(W)] for _ in range(H)]","-ans = 0","+ uf.unite(W * i + j, W * i + j + 1)","+black = defaultdict(int)","+white = defaultdict(int)","+unions = set(uf.parent)","- b, w = 0, 0","- if not checked[i][j]:","- checked[i][j] = True","- if S[i][j] == \"#\":","- b += 1","- else:","- w += 1","- q = es[(i, j)]","- while q:","- y, x = q.pop()","- if not checked[y][x]:","- checked[y][x] = True","- if S[y][x] == \"#\":","- b += 1","- else:","- w += 1","- q.extend(es[(y, x)])","- ans += b * w","+ if S[i][j] == \"#\":","+ black[uf.root(W * i + j)] += 1","+ else:","+ white[uf.root(W * i + j)] += 1","+ans = 0","+for u in unions:","+ ans += black[u] * white[u]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0895797098,"measured_runtime_v1":0.0623759971,"runtime_lift":1.4361246949,"key":["s842069329","s787887002"]} +{"user_id":"u080364835","problem_id":"p03037","language":"python","submission_id_v0":"s052525128","submission_id_v1":"s018333198","cpu_time_v0":351,"cpu_time_v1":321,"memory_v0":27340,"memory_v1":32144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.55,"input":"n, m = list(map(int, input().split()))\n\nlrl = list(list(map(int, input().split())) for _ in range(m))\n\nlmax = 0\n\nrmin = n\n\n\n\nfor lr in lrl:\n\n if lr[0] > lmax:\n\n lmax = lr[0]\n\n if lr[1] < rmin:\n\n rmin = lr[1]\n\nif lmax <= rmin:\n\n print((rmin-lmax+1))\n\nelse:\n\n print((0))\n\n\n\n\n\n\n","target":"import numpy as np\n\nn, m = list(map(int, input().split()))\n\nans = [0]*n\n\n\n\nfor _ in range(m):\n\n l, r = list(map(int, input().split()))\n\n ans[l-1] += 1\n\n if r < n:\n\n ans[r] -= 1\n\n\n\nc = list(np.cumsum(ans))\n\nprint((c.count(m)))","code_v0_loc":17,"code_v1_loc":12,"code_v0_num_chars":291,"code_v1_num_chars":227,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nlrl = list(list(map(int, input().split())) for _ in range(m))\nlmax = 0\nrmin = n\nfor lr in lrl:\n if lr[0] > lmax:\n lmax = lr[0]\n if lr[1] < rmin:\n rmin = lr[1]\nif lmax <= rmin:\n print((rmin - lmax + 1))\nelse:\n print((0))\n","code_v1_no_empty_lines":"import numpy as np\n\nn, m = list(map(int, input().split()))\nans = [0] * n\nfor _ in range(m):\n l, r = list(map(int, input().split()))\n ans[l - 1] += 1\n if r < n:\n ans[r] -= 1\nc = list(np.cumsum(ans))\nprint((c.count(m)))\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["+import numpy as np","+","-lrl = list(list(map(int, input().split())) for _ in range(m))","-lmax = 0","-rmin = n","-for lr in lrl:","- if lr[0] > lmax:","- lmax = lr[0]","- if lr[1] < rmin:","- rmin = lr[1]","-if lmax <= rmin:","- print((rmin - lmax + 1))","-else:","- print((0))","+ans = [0] * n","+for _ in range(m):","+ l, r = list(map(int, input().split()))","+ ans[l - 1] += 1","+ if r < n:","+ ans[r] -= 1","+c = list(np.cumsum(ans))","+print((c.count(m)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0459934194,"measured_runtime_v1":0.3323422618,"runtime_lift":0.1383917265,"key":["s052525128","s018333198"]} +{"user_id":"u332385682","problem_id":"p03786","language":"python","submission_id_v0":"s928240201","submission_id_v1":"s426076397","cpu_time_v0":333,"cpu_time_v1":114,"memory_v0":14252,"memory_v1":14276,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.77,"input":"\n\ndef paku(N, A, mid):\n\n if mid == 0:\n\n return False\n\n\n\n size = sum(A[:mid])\n\n\n\n for i in range(mid, N):\n\n if A[i] <= 2*size:\n\n size += A[i]\n\n else:\n\n return False\n\n\n\n return True\n\n\n\n\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nA.sort()\n\n\n\ntop = N\n\nbtm = 0\n\n\n\nwhile top - btm > 1:\n\n mid = (top + btm) \/\/ 2\n\n\n\n if paku(N, A, mid):\n\n top = mid\n\n else:\n\n btm = mid\n\n\n\nans = N - top + 1\n\n\n\nprint(ans)","target":"\n\nN = int(eval(input()))\n\nA = [int(i) for i in input().split()]\n\nA.sort()\n\n\n\nl = 0\n\nsize = 0\n\n\n\nfor i in range(N - 1):\n\n size += A[i]\n\n\n\n if A[i + 1] > 2 * size:\n\n l = i + 1\n\n\n\nans = N - l\n\n\n\nprint(ans)","code_v0_loc":34,"code_v1_loc":17,"code_v0_num_chars":488,"code_v1_num_chars":209,"code_v0_no_empty_lines":"def paku(N, A, mid):\n if mid == 0:\n return False\n size = sum(A[:mid])\n for i in range(mid, N):\n if A[i] <= 2 * size:\n size += A[i]\n else:\n return False\n return True\n\n\nN = int(eval(input()))\nA = [int(i) for i in input().split()]\nA.sort()\ntop = N\nbtm = 0\nwhile top - btm > 1:\n mid = (top + btm) \/\/ 2\n if paku(N, A, mid):\n top = mid\n else:\n btm = mid\nans = N - top + 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = [int(i) for i in input().split()]\nA.sort()\nl = 0\nsize = 0\nfor i in range(N - 1):\n size += A[i]\n if A[i + 1] > 2 * size:\n l = i + 1\nans = N - l\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-def paku(N, A, mid):","- if mid == 0:","- return False","- size = sum(A[:mid])","- for i in range(mid, N):","- if A[i] <= 2 * size:","- size += A[i]","- else:","- return False","- return True","-","-","-top = N","-btm = 0","-while top - btm > 1:","- mid = (top + btm) \/\/ 2","- if paku(N, A, mid):","- top = mid","- else:","- btm = mid","-ans = N - top + 1","+l = 0","+size = 0","+for i in range(N - 1):","+ size += A[i]","+ if A[i + 1] > 2 * size:","+ l = i + 1","+ans = N - l"],"diff_only_import_comment":false,"measured_runtime_v0":0.0713022997,"measured_runtime_v1":0.0363752673,"runtime_lift":1.960186277,"key":["s928240201","s426076397"]} +{"user_id":"u020604402","problem_id":"p03673","language":"python","submission_id_v0":"s580678241","submission_id_v1":"s694946445","cpu_time_v0":357,"cpu_time_v1":322,"memory_v0":24772,"memory_v1":24768,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.8,"input":"n = int(input())\n\nL = [None]+list(input().split())\n\neven = []\n\nodd = []\n\nif n % 2 == 0:\n\n for i in range(1,1+n):\n\n if i % 2 == 0:\n\n even.append(L[i])\n\n else:\n\n odd.append(L[i])\n\n ans = even[::-1] + odd\n\nelse:\n\n for i in range(1,1+n):\n\n if i % 2 == 0:\n\n even.append(L[i])\n\n else:\n\n odd.append(L[i])\n\n ans = odd[::-1] + even\n\nfor i in range(n):\n\n if i == n - 1:\n\n print(ans[i])\n\n else:\n\n print(ans[i],end=' ')\n","target":"n = int(input())\n\nL = [None]+list(input().split())\n\neven = []\n\nodd = []\n\nif n % 2 == 0:\n\n for i in range(1,1+n):\n\n if i % 2 == 0:\n\n even.append(L[i])\n\n else:\n\n odd.append(L[i])\n\n ans = even[::-1] + odd\n\nelse:\n\n for i in range(1,1+n):\n\n if i % 2 == 0:\n\n even.append(L[i])\n\n else:\n\n odd.append(L[i])\n\n ans = odd[::-1] + even\n\nfor i in range(n-1):\n\n print(ans[i],end=' ')\n\nprint(ans[n-1])\n","code_v0_loc":23,"code_v1_loc":21,"code_v0_num_chars":511,"code_v1_num_chars":472,"code_v0_no_empty_lines":"n = int(input())\nL = [None] + list(input().split())\neven = []\nodd = []\nif n % 2 == 0:\n for i in range(1, 1 + n):\n if i % 2 == 0:\n even.append(L[i])\n else:\n odd.append(L[i])\n ans = even[::-1] + odd\nelse:\n for i in range(1, 1 + n):\n if i % 2 == 0:\n even.append(L[i])\n else:\n odd.append(L[i])\n ans = odd[::-1] + even\nfor i in range(n):\n if i == n - 1:\n print(ans[i])\n else:\n print(ans[i], end=\" \")\n","code_v1_no_empty_lines":"n = int(input())\nL = [None] + list(input().split())\neven = []\nodd = []\nif n % 2 == 0:\n for i in range(1, 1 + n):\n if i % 2 == 0:\n even.append(L[i])\n else:\n odd.append(L[i])\n ans = even[::-1] + odd\nelse:\n for i in range(1, 1 + n):\n if i % 2 == 0:\n even.append(L[i])\n else:\n odd.append(L[i])\n ans = odd[::-1] + even\nfor i in range(n - 1):\n print(ans[i], end=\" \")\nprint(ans[n - 1])\n","code_same":false,"relative_loc_diff_percent":8.6956521739,"diff":["-for i in range(n):","- if i == n - 1:","- print(ans[i])","- else:","- print(ans[i], end=\" \")","+for i in range(n - 1):","+ print(ans[i], end=\" \")","+print(ans[n - 1])"],"diff_only_import_comment":false,"measured_runtime_v0":0.0378020763,"measured_runtime_v1":0.0452517509,"runtime_lift":0.8353726771,"key":["s580678241","s694946445"]} +{"user_id":"u667084803","problem_id":"p03164","language":"python","submission_id_v0":"s722821602","submission_id_v1":"s218159009","cpu_time_v0":443,"cpu_time_v1":312,"memory_v0":95052,"memory_v1":14804,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.57,"input":"#https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_e\n\n#2019-01-13\n\nN, W = list(map(int, input().split()))\n\nw, v = [], []\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n w += [a]\n\n v += [b]\n\n\n\nDP = [float(\"inf\")] * (N*1000+1)\n\nDP[0] = 0\n\n#\u7dcf\u4fa1\u5024 i \u5186\u3092\u5f97\u308b\u305f\u3081\u306b\u6700\u4f4e\u9650\u5fc5\u8981\u306a\u91cd\u91cf\n\nfor i in range(N):\n\n for j in range(N*1000,-1,-1):\n\n DP[j] = min(DP[j- v[i]] + w[i], DP[j])\n\nans = 0\n\nfor k in range(N*1000+1):\n\n if DP[k] <= W:\n\n \n\n ans = k\n\nprint(ans)","target":"#https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_e\n\n#2019-01-13\n\nimport numpy as np\n\nN, W = list(map(int, input().split()))\n\nw, v = [], []\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n w += [a]\n\n v += [b]\n\n\n\nDP = np.ones(N*1000+1, dtype=int) *(W+1)\n\nDP[0] = 0\n\n#\u7dcf\u4fa1\u5024 i \u5186\u3092\u5f97\u308b\u305f\u3081\u306b\u6700\u4f4e\u9650\u5fc5\u8981\u306a\u91cd\u91cf\n\nfor i in range(N):\n\n DP[v[i]:] = np.minimum(DP[:-v[i]]+ w[i], DP[v[i]:])\n\nans = 0\n\nfor k in range(N*1000+1):\n\n if DP[k] <= W:\n\n ans = k\n\n \n\nprint(ans)","code_v0_loc":21,"code_v1_loc":21,"code_v0_num_chars":459,"code_v1_num_chars":461,"code_v0_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_e\n# 2019-01-13\nN, W = list(map(int, input().split()))\nw, v = [], []\nfor i in range(N):\n a, b = list(map(int, input().split()))\n w += [a]\n v += [b]\nDP = [float(\"inf\")] * (N * 1000 + 1)\nDP[0] = 0\n# \u7dcf\u4fa1\u5024 i \u5186\u3092\u5f97\u308b\u305f\u3081\u306b\u6700\u4f4e\u9650\u5fc5\u8981\u306a\u91cd\u91cf\nfor i in range(N):\n for j in range(N * 1000, -1, -1):\n DP[j] = min(DP[j - v[i]] + w[i], DP[j])\nans = 0\nfor k in range(N * 1000 + 1):\n if DP[k] <= W:\n ans = k\nprint(ans)\n","code_v1_no_empty_lines":"# https:\/\/atcoder.jp\/contests\/dp\/tasks\/dp_e\n# 2019-01-13\nimport numpy as np\n\nN, W = list(map(int, input().split()))\nw, v = [], []\nfor i in range(N):\n a, b = list(map(int, input().split()))\n w += [a]\n v += [b]\nDP = np.ones(N * 1000 + 1, dtype=int) * (W + 1)\nDP[0] = 0\n# \u7dcf\u4fa1\u5024 i \u5186\u3092\u5f97\u308b\u305f\u3081\u306b\u6700\u4f4e\u9650\u5fc5\u8981\u306a\u91cd\u91cf\nfor i in range(N):\n DP[v[i] :] = np.minimum(DP[: -v[i]] + w[i], DP[v[i] :])\nans = 0\nfor k in range(N * 1000 + 1):\n if DP[k] <= W:\n ans = k\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+import numpy as np","+","-DP = [float(\"inf\")] * (N * 1000 + 1)","+DP = np.ones(N * 1000 + 1, dtype=int) * (W + 1)","- for j in range(N * 1000, -1, -1):","- DP[j] = min(DP[j - v[i]] + w[i], DP[j])","+ DP[v[i] :] = np.minimum(DP[: -v[i]] + w[i], DP[v[i] :])"],"diff_only_import_comment":false,"measured_runtime_v0":0.1008314366,"measured_runtime_v1":0.7993094349,"runtime_lift":0.1261481877,"key":["s722821602","s218159009"]} +{"user_id":"u725133562","problem_id":"p02725","language":"python","submission_id_v0":"s626121930","submission_id_v1":"s752534773","cpu_time_v0":146,"cpu_time_v1":130,"memory_v0":26444,"memory_v1":26444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.96,"input":"k,n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = a + [a[0]+k]\n\ndif = [0]*n\n\nfor i in range(n):\n\n dif[i] += a[i+1] - a[i]\n\n\n\ndif.sort()\n\nprint((k-dif[-1]))","target":"k,n = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\na = a + [a[0]+k]\n\ndif = [0]*n\n\nfor i in range(n):\n\n dif[i] += a[i+1] - a[i]\n\nprint((k-max(dif)))","code_v0_loc":9,"code_v1_loc":7,"code_v0_num_chars":180,"code_v1_num_chars":167,"code_v0_no_empty_lines":"k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na = a + [a[0] + k]\ndif = [0] * n\nfor i in range(n):\n dif[i] += a[i + 1] - a[i]\ndif.sort()\nprint((k - dif[-1]))\n","code_v1_no_empty_lines":"k, n = list(map(int, input().split()))\na = list(map(int, input().split()))\na = a + [a[0] + k]\ndif = [0] * n\nfor i in range(n):\n dif[i] += a[i + 1] - a[i]\nprint((k - max(dif)))\n","code_same":false,"relative_loc_diff_percent":22.2222222222,"diff":["-dif.sort()","-print((k - dif[-1]))","+print((k - max(dif)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0393849451,"measured_runtime_v1":0.0850401637,"runtime_lift":0.463133458,"key":["s626121930","s752534773"]} +{"user_id":"u212328220","problem_id":"p02682","language":"python","submission_id_v0":"s933689559","submission_id_v1":"s565853701","cpu_time_v0":24,"cpu_time_v1":21,"memory_v0":9176,"memory_v1":9160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"#S = str(input())\n\nA, B, C, K = list(map(int,input().split()))\n\n\n\nif A <= K:\n\n a = A\n\nelse:\n\n a = K\n\n\n\nif B <= K-a:\n\n b = B\n\nelse:\n\n b = K-a\n\n\n\nc = K - a - b\n\n\n\nans = a - c\n\nprint(ans)","target":"a, b, c, k = list(map(int, input().split()))\n\n\n\n\n\nxa = min(k,a)\n\nxb = min(k-xa,b)\n\nxc = k- xa - xb\n\n\n\nprint((xa - xc))\n","code_v0_loc":17,"code_v1_loc":8,"code_v0_num_chars":190,"code_v1_num_chars":111,"code_v0_no_empty_lines":"# S = str(input())\nA, B, C, K = list(map(int, input().split()))\nif A <= K:\n a = A\nelse:\n a = K\nif B <= K - a:\n b = B\nelse:\n b = K - a\nc = K - a - b\nans = a - c\nprint(ans)\n","code_v1_no_empty_lines":"a, b, c, k = list(map(int, input().split()))\nxa = min(k, a)\nxb = min(k - xa, b)\nxc = k - xa - xb\nprint((xa - xc))\n","code_same":false,"relative_loc_diff_percent":52.9411764706,"diff":["-# S = str(input())","-A, B, C, K = list(map(int, input().split()))","-if A <= K:","- a = A","-else:","- a = K","-if B <= K - a:","- b = B","-else:","- b = K - a","-c = K - a - b","-ans = a - c","-print(ans)","+a, b, c, k = list(map(int, input().split()))","+xa = min(k, a)","+xb = min(k - xa, b)","+xc = k - xa - xb","+print((xa - xc))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0386346581,"measured_runtime_v1":0.039585665,"runtime_lift":0.9759759777,"key":["s933689559","s565853701"]} +{"user_id":"u860657719","problem_id":"p02629","language":"python","submission_id_v0":"s349113568","submission_id_v1":"s112762184","cpu_time_v0":73,"cpu_time_v1":63,"memory_v0":61748,"memory_v1":61888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.7,"input":"ans = []\n\nn = int(eval(input()))\n\nwhile n > 0:\n\n i = n % 26\n\n if i == 0:\n\n i += 26\n\n ans.append(chr(i + 96))\n\n if n % 26 == 0:\n\n n = n \/\/ 26 - 1\n\n else:\n\n n \/\/= 26\n\nans.reverse()\n\nprint((\"\".join(ans)))","target":"n = int(eval(input()))\n\nketa = 1\n\nend = 0\n\nwhile True:\n\n order = n - end\n\n end += 26**keta\n\n if n <= end:\n\n break\n\n keta += 1\n\norder -= 1\n\nans = []\n\nfor i in range(keta):\n\n ans.append(chr(order%26 + 97))\n\n order \/\/= 26\n\nans.reverse()\n\nprint((\"\".join(ans)))","code_v0_loc":13,"code_v1_loc":16,"code_v0_num_chars":229,"code_v1_num_chars":273,"code_v0_no_empty_lines":"ans = []\nn = int(eval(input()))\nwhile n > 0:\n i = n % 26\n if i == 0:\n i += 26\n ans.append(chr(i + 96))\n if n % 26 == 0:\n n = n \/\/ 26 - 1\n else:\n n \/\/= 26\nans.reverse()\nprint((\"\".join(ans)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nketa = 1\nend = 0\nwhile True:\n order = n - end\n end += 26**keta\n if n <= end:\n break\n keta += 1\norder -= 1\nans = []\nfor i in range(keta):\n ans.append(chr(order % 26 + 97))\n order \/\/= 26\nans.reverse()\nprint((\"\".join(ans)))\n","code_same":false,"relative_loc_diff_percent":18.75,"diff":["+n = int(eval(input()))","+keta = 1","+end = 0","+while True:","+ order = n - end","+ end += 26**keta","+ if n <= end:","+ break","+ keta += 1","+order -= 1","-n = int(eval(input()))","-while n > 0:","- i = n % 26","- if i == 0:","- i += 26","- ans.append(chr(i + 96))","- if n % 26 == 0:","- n = n \/\/ 26 - 1","- else:","- n \/\/= 26","+for i in range(keta):","+ ans.append(chr(order % 26 + 97))","+ order \/\/= 26"],"diff_only_import_comment":false,"measured_runtime_v0":0.0451997919,"measured_runtime_v1":0.044696687,"runtime_lift":1.0112559778,"key":["s349113568","s112762184"]} +{"user_id":"u656120612","problem_id":"p03962","language":"python","submission_id_v0":"s166552783","submission_id_v1":"s802219068","cpu_time_v0":31,"cpu_time_v1":27,"memory_v0":9044,"memory_v1":9044,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.9,"input":"a=input().split()\n\na.sort()\n\ncnt=0\n\nwhile len(a)>0:\n\n i=a.count(a.pop(0))\n\n for j in range(i):\n\n a.pop(0)\n\n cnt+=1\n\nprint(cnt)","target":"a,b,c=list(map(int,input().split()))\n\nif a==b and b==c:\n\n print((1))\n\nelif a==b and a!=c:\n\n print((2))\n\nelif a!=b and b==c:\n\n print((2))\n\nelif a==c and a!=b:\n\n print((2))\n\nelse:\n\n print((3))","code_v0_loc":9,"code_v1_loc":11,"code_v0_num_chars":142,"code_v1_num_chars":189,"code_v0_no_empty_lines":"a = input().split()\na.sort()\ncnt = 0\nwhile len(a) > 0:\n i = a.count(a.pop(0))\n for j in range(i):\n a.pop(0)\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"a, b, c = list(map(int, input().split()))\nif a == b and b == c:\n print((1))\nelif a == b and a != c:\n print((2))\nelif a != b and b == c:\n print((2))\nelif a == c and a != b:\n print((2))\nelse:\n print((3))\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-a = input().split()","-a.sort()","-cnt = 0","-while len(a) > 0:","- i = a.count(a.pop(0))","- for j in range(i):","- a.pop(0)","- cnt += 1","-print(cnt)","+a, b, c = list(map(int, input().split()))","+if a == b and b == c:","+ print((1))","+elif a == b and a != c:","+ print((2))","+elif a != b and b == c:","+ print((2))","+elif a == c and a != b:","+ print((2))","+else:","+ print((3))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0459851095,"measured_runtime_v1":0.0433005757,"runtime_lift":1.0619976475,"key":["s166552783","s802219068"]} +{"user_id":"u050708958","problem_id":"p03071","language":"python","submission_id_v0":"s549135278","submission_id_v1":"s468517692","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"import heapq\n\na, b = list(map(int, input().split()))\n\nprint((sum(heapq.nlargest(2, [a, a-1, b, b-1]))))\n","target":"a, b = list(map(int, input().split()))\n\nprint((max([a+b, 2*a-1, 2*b-1])))\n","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":96,"code_v1_num_chars":66,"code_v0_no_empty_lines":"import heapq\n\na, b = list(map(int, input().split()))\nprint((sum(heapq.nlargest(2, [a, a - 1, b, b - 1]))))\n","code_v1_no_empty_lines":"a, b = list(map(int, input().split()))\nprint((max([a + b, 2 * a - 1, 2 * b - 1])))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-import heapq","-","-print((sum(heapq.nlargest(2, [a, a - 1, b, b - 1]))))","+print((max([a + b, 2 * a - 1, 2 * b - 1])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.065006469,"measured_runtime_v1":0.062661603,"runtime_lift":1.0374210987,"key":["s549135278","s468517692"]} +{"user_id":"u141610915","problem_id":"p03026","language":"python","submission_id_v0":"s984326844","submission_id_v1":"s790903133","cpu_time_v0":475,"cpu_time_v1":287,"memory_v0":221444,"memory_v1":54364,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":39.58,"input":"import sys\n\nfrom collections import defaultdict as dd\n\nimport heapq\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 6)\n\nN = int(eval(input()))\n\ne = dd(list)\n\ninc = [0] * (N + 1)\n\nfor _ in range(N - 1):\n\n u, v = list(map(int, input().split()))\n\n e[u].append(v)\n\n e[v].append(u)\n\n inc[u] += 1\n\n inc[v] += 1\n\nx = 0\n\nfor i in range(1, N + 1):\n\n if inc[x] < inc[i]: x = i\n\n\n\nc = list(map(int, input().split()))\n\nc.sort()\n\nressum = sum(c[: -1])\n\nvis = set()\n\nres = [0] * (N + 1)\n\nres[x] = c[-1]\n\ndef dfs(y):\n\n global vis\n\n global res\n\n global c\n\n res[y] = c.pop()\n\n for z in e[y]:\n\n if z in vis: continue\n\n vis.add(z)\n\n dfs(z)\n\nvis.add(x)\n\ndfs(x)\n\nprint(ressum)\n\nprint((*res[1: ]))","target":"import sys\n\nfrom collections import defaultdict as dd\n\ninput = sys.stdin.readline\n\nsys.setrecursionlimit(10 ** 6)\n\nN = int(eval(input()))\n\ne = dd(list)\n\nfor _ in range(N - 1):\n\n u, v = list(map(int, input().split()))\n\n e[u].append(v)\n\n e[v].append(u)\n\nc = list(map(int, input().split()))\n\nc.sort()\n\nsm = sum(c) - c[-1]\n\nres = [0] * (N + 1)\n\ndef dfs(x):\n\n global res\n\n res[x] = c.pop()\n\n for y in e[x]:\n\n if res[y]: continue\n\n dfs(y)\n\ndfs(1)\n\nprint(sm)\n\nprint((*res[1: ]))","code_v0_loc":37,"code_v1_loc":23,"code_v0_num_chars":690,"code_v1_num_chars":469,"code_v0_no_empty_lines":"import sys\nfrom collections import defaultdict as dd\nimport heapq\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\nN = int(eval(input()))\ne = dd(list)\ninc = [0] * (N + 1)\nfor _ in range(N - 1):\n u, v = list(map(int, input().split()))\n e[u].append(v)\n e[v].append(u)\n inc[u] += 1\n inc[v] += 1\nx = 0\nfor i in range(1, N + 1):\n if inc[x] < inc[i]:\n x = i\nc = list(map(int, input().split()))\nc.sort()\nressum = sum(c[:-1])\nvis = set()\nres = [0] * (N + 1)\nres[x] = c[-1]\n\n\ndef dfs(y):\n global vis\n global res\n global c\n res[y] = c.pop()\n for z in e[y]:\n if z in vis:\n continue\n vis.add(z)\n dfs(z)\n\n\nvis.add(x)\ndfs(x)\nprint(ressum)\nprint((*res[1:]))\n","code_v1_no_empty_lines":"import sys\nfrom collections import defaultdict as dd\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\nN = int(eval(input()))\ne = dd(list)\nfor _ in range(N - 1):\n u, v = list(map(int, input().split()))\n e[u].append(v)\n e[v].append(u)\nc = list(map(int, input().split()))\nc.sort()\nsm = sum(c) - c[-1]\nres = [0] * (N + 1)\n\n\ndef dfs(x):\n global res\n res[x] = c.pop()\n for y in e[x]:\n if res[y]:\n continue\n dfs(y)\n\n\ndfs(1)\nprint(sm)\nprint((*res[1:]))\n","code_same":false,"relative_loc_diff_percent":37.8378378378,"diff":["-import heapq","-inc = [0] * (N + 1)","- inc[u] += 1","- inc[v] += 1","-x = 0","-for i in range(1, N + 1):","- if inc[x] < inc[i]:","- x = i","-ressum = sum(c[:-1])","-vis = set()","+sm = sum(c) - c[-1]","-res[x] = c[-1]","-def dfs(y):","- global vis","+def dfs(x):","- global c","- res[y] = c.pop()","- for z in e[y]:","- if z in vis:","+ res[x] = c.pop()","+ for y in e[x]:","+ if res[y]:","- vis.add(z)","- dfs(z)","+ dfs(y)","-vis.add(x)","-dfs(x)","-print(ressum)","+dfs(1)","+print(sm)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0361255929,"measured_runtime_v1":0.0713149716,"runtime_lift":0.5065639392,"key":["s984326844","s790903133"]} +{"user_id":"u970197315","problem_id":"p03761","language":"python","submission_id_v0":"s118131418","submission_id_v1":"s154831370","cpu_time_v0":24,"cpu_time_v1":18,"memory_v0":3444,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.0,"input":"from collections import Counter\n\nn=int(eval(input()))\n\ns=[eval(input()) for i in range(n)]\n\nc1=Counter(s.pop())\n\n\n\nfor ss in s:\n\n c2=Counter(ss)\n\n for k in list(c1.keys()):\n\n c1[k]=min(c1[k],c2[k])\n\n\n\nans=''\n\nfor k,v in sorted(c1.items()):\n\n ans+=k*v\n\nprint(ans)\n\n\n\n\n","target":"n=int(eval(input()))\n\ns=[eval(input()) for i in range(n)]\n\ncnt=[0]*26\n\nt=[0]*26\n\nfor i,ss in enumerate(s):\n\n t=[0]*26\n\n if i==0:\n\n for sss in ss:\n\n cnt[ord(sss)-97]+=1\n\n continue\n\n for sss in ss:\n\n t[ord(sss)-97]+=1\n\n for i in range(26):\n\n if cnt[i]>t[i]:\n\n cnt[i]=t[i]\n\nans=\"\"\n\nfor i in range(26):\n\n ans+=chr(i+97)*cnt[i]\n\nprint(ans)\n\n\n","code_v0_loc":16,"code_v1_loc":20,"code_v0_num_chars":265,"code_v1_num_chars":352,"code_v0_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\ns = [eval(input()) for i in range(n)]\nc1 = Counter(s.pop())\nfor ss in s:\n c2 = Counter(ss)\n for k in list(c1.keys()):\n c1[k] = min(c1[k], c2[k])\nans = \"\"\nfor k, v in sorted(c1.items()):\n ans += k * v\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = [eval(input()) for i in range(n)]\ncnt = [0] * 26\nt = [0] * 26\nfor i, ss in enumerate(s):\n t = [0] * 26\n if i == 0:\n for sss in ss:\n cnt[ord(sss) - 97] += 1\n continue\n for sss in ss:\n t[ord(sss) - 97] += 1\n for i in range(26):\n if cnt[i] > t[i]:\n cnt[i] = t[i]\nans = \"\"\nfor i in range(26):\n ans += chr(i + 97) * cnt[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-from collections import Counter","-","-c1 = Counter(s.pop())","-for ss in s:","- c2 = Counter(ss)","- for k in list(c1.keys()):","- c1[k] = min(c1[k], c2[k])","+cnt = [0] * 26","+t = [0] * 26","+for i, ss in enumerate(s):","+ t = [0] * 26","+ if i == 0:","+ for sss in ss:","+ cnt[ord(sss) - 97] += 1","+ continue","+ for sss in ss:","+ t[ord(sss) - 97] += 1","+ for i in range(26):","+ if cnt[i] > t[i]:","+ cnt[i] = t[i]","-for k, v in sorted(c1.items()):","- ans += k * v","+for i in range(26):","+ ans += chr(i + 97) * cnt[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0381682761,"measured_runtime_v1":0.0392276076,"runtime_lift":0.9729952539,"key":["s118131418","s154831370"]} +{"user_id":"u278886389","problem_id":"p02574","language":"python","submission_id_v0":"s295894159","submission_id_v1":"s619674526","cpu_time_v0":796,"cpu_time_v1":314,"memory_v0":197148,"memory_v1":189452,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.55,"input":"primeset = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009}\n\n\n\ndef gcd(n,m):\n\n while n:\n\n m,n = n,m%n\n\n return m\n\n\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nsoinsu = set()\n\na,b = 0,0\n\n\n\ndef pariwise():\n\n global primeset,N,A,soinsu,a,b\n\n for i in range(N):\n\n a = A[i]\n\n b = set()\n\n for j in primeset:\n\n while a != 1 and a % j == 0:\n\n a \/\/= j\n\n b.add(j)\n\n if a != 1:\n\n b.add(a)\n\n for j in b:\n\n if j in soinsu:\n\n return False\n\n soinsu.add(j)\n\n return True\n\n\n\ndef setwise():\n\n global primeset,N,A,soinsu,a,b\n\n a = A[0]\n\n for i in range(1,N):\n\n a = gcd(a,A[i])\n\n return (a == 1)\n\n\n\nif pariwise():\n\n print('pairwise coprime')\n\nelif setwise():\n\n print('setwise coprime')\n\nelse:\n\n print('not coprime')\n","target":"def gcd(n,m):\n\n while n:\n\n m,n = n,m%n\n\n return m\n\n\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\n\n\nmaxA = max(A)\n\nB = [0]*(maxA+1)\n\nfor i in range(2,maxA+1):\n\n if B[i] == 0:\n\n B[i] = i\n\n for j in range(2*i,maxA+1,i):\n\n B[j] = i\n\n\n\nsoinsu = set()\n\na,b = 0,0\n\n\n\ndef pariwise():\n\n global N,A,soinsu,a,b\n\n for i in range(N):\n\n a = A[i]\n\n b = set()\n\n while a != 1:\n\n b.add(B[a])\n\n a \/\/= B[a]\n\n for j in b:\n\n if j in soinsu:\n\n return False\n\n soinsu.add(j)\n\n return True\n\n\n\ndef setwise():\n\n global N,A,soinsu,a,b\n\n a = A[0]\n\n for i in range(1,N):\n\n a = gcd(a,A[i])\n\n return (a == 1)\n\n\n\nif pariwise():\n\n print('pairwise coprime')\n\nelif setwise():\n\n print('setwise coprime')\n\nelse:\n\n print('not coprime')\n","code_v0_loc":43,"code_v1_loc":46,"code_v0_num_chars":1652,"code_v1_num_chars":871,"code_v0_no_empty_lines":"primeset = {\n 2,\n 3,\n 5,\n 7,\n 11,\n 13,\n 17,\n 19,\n 23,\n 29,\n 31,\n 37,\n 41,\n 43,\n 47,\n 53,\n 59,\n 61,\n 67,\n 71,\n 73,\n 79,\n 83,\n 89,\n 97,\n 101,\n 103,\n 107,\n 109,\n 113,\n 127,\n 131,\n 137,\n 139,\n 149,\n 151,\n 157,\n 163,\n 167,\n 173,\n 179,\n 181,\n 191,\n 193,\n 197,\n 199,\n 211,\n 223,\n 227,\n 229,\n 233,\n 239,\n 241,\n 251,\n 257,\n 263,\n 269,\n 271,\n 277,\n 281,\n 283,\n 293,\n 307,\n 311,\n 313,\n 317,\n 331,\n 337,\n 347,\n 349,\n 353,\n 359,\n 367,\n 373,\n 379,\n 383,\n 389,\n 397,\n 401,\n 409,\n 419,\n 421,\n 431,\n 433,\n 439,\n 443,\n 449,\n 457,\n 461,\n 463,\n 467,\n 479,\n 487,\n 491,\n 499,\n 503,\n 509,\n 521,\n 523,\n 541,\n 547,\n 557,\n 563,\n 569,\n 571,\n 577,\n 587,\n 593,\n 599,\n 601,\n 607,\n 613,\n 617,\n 619,\n 631,\n 641,\n 643,\n 647,\n 653,\n 659,\n 661,\n 673,\n 677,\n 683,\n 691,\n 701,\n 709,\n 719,\n 727,\n 733,\n 739,\n 743,\n 751,\n 757,\n 761,\n 769,\n 773,\n 787,\n 797,\n 809,\n 811,\n 821,\n 823,\n 827,\n 829,\n 839,\n 853,\n 857,\n 859,\n 863,\n 877,\n 881,\n 883,\n 887,\n 907,\n 911,\n 919,\n 929,\n 937,\n 941,\n 947,\n 953,\n 967,\n 971,\n 977,\n 983,\n 991,\n 997,\n 1009,\n}\n\n\ndef gcd(n, m):\n while n:\n m, n = n, m % n\n return m\n\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nsoinsu = set()\na, b = 0, 0\n\n\ndef pariwise():\n global primeset, N, A, soinsu, a, b\n for i in range(N):\n a = A[i]\n b = set()\n for j in primeset:\n while a != 1 and a % j == 0:\n a \/\/= j\n b.add(j)\n if a != 1:\n b.add(a)\n for j in b:\n if j in soinsu:\n return False\n soinsu.add(j)\n return True\n\n\ndef setwise():\n global primeset, N, A, soinsu, a, b\n a = A[0]\n for i in range(1, N):\n a = gcd(a, A[i])\n return a == 1\n\n\nif pariwise():\n print(\"pairwise coprime\")\nelif setwise():\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n","code_v1_no_empty_lines":"def gcd(n, m):\n while n:\n m, n = n, m % n\n return m\n\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nmaxA = max(A)\nB = [0] * (maxA + 1)\nfor i in range(2, maxA + 1):\n if B[i] == 0:\n B[i] = i\n for j in range(2 * i, maxA + 1, i):\n B[j] = i\nsoinsu = set()\na, b = 0, 0\n\n\ndef pariwise():\n global N, A, soinsu, a, b\n for i in range(N):\n a = A[i]\n b = set()\n while a != 1:\n b.add(B[a])\n a \/\/= B[a]\n for j in b:\n if j in soinsu:\n return False\n soinsu.add(j)\n return True\n\n\ndef setwise():\n global N, A, soinsu, a, b\n a = A[0]\n for i in range(1, N):\n a = gcd(a, A[i])\n return a == 1\n\n\nif pariwise():\n print(\"pairwise coprime\")\nelif setwise():\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n","code_same":false,"relative_loc_diff_percent":6.5217391304,"diff":["-primeset = {","- 2,","- 3,","- 5,","- 7,","- 11,","- 13,","- 17,","- 19,","- 23,","- 29,","- 31,","- 37,","- 41,","- 43,","- 47,","- 53,","- 59,","- 61,","- 67,","- 71,","- 73,","- 79,","- 83,","- 89,","- 97,","- 101,","- 103,","- 107,","- 109,","- 113,","- 127,","- 131,","- 137,","- 139,","- 149,","- 151,","- 157,","- 163,","- 167,","- 173,","- 179,","- 181,","- 191,","- 193,","- 197,","- 199,","- 211,","- 223,","- 227,","- 229,","- 233,","- 239,","- 241,","- 251,","- 257,","- 263,","- 269,","- 271,","- 277,","- 281,","- 283,","- 293,","- 307,","- 311,","- 313,","- 317,","- 331,","- 337,","- 347,","- 349,","- 353,","- 359,","- 367,","- 373,","- 379,","- 383,","- 389,","- 397,","- 401,","- 409,","- 419,","- 421,","- 431,","- 433,","- 439,","- 443,","- 449,","- 457,","- 461,","- 463,","- 467,","- 479,","- 487,","- 491,","- 499,","- 503,","- 509,","- 521,","- 523,","- 541,","- 547,","- 557,","- 563,","- 569,","- 571,","- 577,","- 587,","- 593,","- 599,","- 601,","- 607,","- 613,","- 617,","- 619,","- 631,","- 641,","- 643,","- 647,","- 653,","- 659,","- 661,","- 673,","- 677,","- 683,","- 691,","- 701,","- 709,","- 719,","- 727,","- 733,","- 739,","- 743,","- 751,","- 757,","- 761,","- 769,","- 773,","- 787,","- 797,","- 809,","- 811,","- 821,","- 823,","- 827,","- 829,","- 839,","- 853,","- 857,","- 859,","- 863,","- 877,","- 881,","- 883,","- 887,","- 907,","- 911,","- 919,","- 929,","- 937,","- 941,","- 947,","- 953,","- 967,","- 971,","- 977,","- 983,","- 991,","- 997,","- 1009,","-}","-","-","+maxA = max(A)","+B = [0] * (maxA + 1)","+for i in range(2, maxA + 1):","+ if B[i] == 0:","+ B[i] = i","+ for j in range(2 * i, maxA + 1, i):","+ B[j] = i","- global primeset, N, A, soinsu, a, b","+ global N, A, soinsu, a, b","- for j in primeset:","- while a != 1 and a % j == 0:","- a \/\/= j","- b.add(j)","- if a != 1:","- b.add(a)","+ while a != 1:","+ b.add(B[a])","+ a \/\/= B[a]","- global primeset, N, A, soinsu, a, b","+ global N, A, soinsu, a, b"],"diff_only_import_comment":false,"measured_runtime_v0":0.0390830052,"measured_runtime_v1":0.0385693738,"runtime_lift":1.0133170773,"key":["s295894159","s619674526"]} +{"user_id":"u940102677","problem_id":"p03195","language":"python","submission_id_v0":"s893790001","submission_id_v1":"s748636334","cpu_time_v0":210,"cpu_time_v1":191,"memory_v0":3828,"memory_v1":3828,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.05,"input":"c = 0\n\nfor i in [0]*int(eval(input())):\n\n c = max(c,int(eval(input()))%2)\n\nprint((\"sfeicrosntd\"[c::2]))","target":"c = 0\n\nfor i in [0]*int(eval(input())):\n\n c += int(eval(input()))%2\n\nprint((\"sfeicrosntd\"[min(c,1)::2]))","code_v0_loc":4,"code_v1_loc":4,"code_v0_num_chars":90,"code_v1_num_chars":91,"code_v0_no_empty_lines":"c = 0\nfor i in [0] * int(eval(input())):\n c = max(c, int(eval(input())) % 2)\nprint((\"sfeicrosntd\"[c::2]))\n","code_v1_no_empty_lines":"c = 0\nfor i in [0] * int(eval(input())):\n c += int(eval(input())) % 2\nprint((\"sfeicrosntd\"[min(c, 1) :: 2]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- c = max(c, int(eval(input())) % 2)","-print((\"sfeicrosntd\"[c::2]))","+ c += int(eval(input())) % 2","+print((\"sfeicrosntd\"[min(c, 1) :: 2]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1200069904,"measured_runtime_v1":0.2057112217,"runtime_lift":0.5833760037,"key":["s893790001","s748636334"]} +{"user_id":"u624475441","problem_id":"p03250","language":"python","submission_id_v0":"s109341631","submission_id_v1":"s574360545","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3444,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"a, b, c = sorted(map(int, input().split()))\n\nprint((c*10+a+b))","target":"*x,=list(map(int,input().split()));print((sum(x)+max(x)*9))","code_v0_loc":2,"code_v1_loc":1,"code_v0_num_chars":60,"code_v1_num_chars":51,"code_v0_no_empty_lines":"a, b, c = sorted(map(int, input().split()))\nprint((c * 10 + a + b))\n","code_v1_no_empty_lines":"(*x,) = list(map(int, input().split()))\nprint((sum(x) + max(x) * 9))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-a, b, c = sorted(map(int, input().split()))","-print((c * 10 + a + b))","+(*x,) = list(map(int, input().split()))","+print((sum(x) + max(x) * 9))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0079970033,"measured_runtime_v1":0.0466439407,"runtime_lift":0.1714478493,"key":["s109341631","s574360545"]} +{"user_id":"u796942881","problem_id":"p02887","language":"python","submission_id_v0":"s210798229","submission_id_v1":"s437767499","cpu_time_v0":55,"cpu_time_v1":29,"memory_v0":15860,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.27,"input":"from itertools import groupby\n\n\n\n\n\ndef main():\n\n S = open(0).read().split()[1]\n\n print((len(list(groupby(S)))))\n\n\n\n\n\nmain()\n","target":"from itertools import groupby\n\n\n\n\n\ndef main():\n\n S = open(0).read().split()[1]\n\n print((sum(1 for x in groupby(S))))\n\n\n\n\n\nmain()\n","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":128,"code_v1_num_chars":133,"code_v0_no_empty_lines":"from itertools import groupby\n\n\ndef main():\n S = open(0).read().split()[1]\n print((len(list(groupby(S)))))\n\n\nmain()\n","code_v1_no_empty_lines":"from itertools import groupby\n\n\ndef main():\n S = open(0).read().split()[1]\n print((sum(1 for x in groupby(S))))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- print((len(list(groupby(S)))))","+ print((sum(1 for x in groupby(S))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0357939947,"measured_runtime_v1":0.035774585,"runtime_lift":1.0005425541,"key":["s210798229","s437767499"]} +{"user_id":"u153665391","problem_id":"p02271","language":"python","submission_id_v0":"s982787892","submission_id_v1":"s138262063","cpu_time_v0":720,"cpu_time_v1":560,"memory_v0":5644,"memory_v1":5644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.22,"input":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nQ = int(eval(input()))\n\nM = list(map(int, input().split()))\n\n\n\nexhaustive_dict = {}\n\n\n\ndef create_exhastive_list(head, sum):\n\n for i in range(head, N):\n\n sum += A[i]\n\n exhaustive_dict[sum] = 1\n\n create_exhastive_list(i+1, sum)\n\n sum -= A[i]\n\n\n\nhead = 0\n\nsum = 0\n\ncreate_exhastive_list(head, sum)\n\n\n\nfor target in M:\n\n if target in list(exhaustive_dict.keys()):\n\n print(\"yes\")\n\n else:\n\n print(\"no\")\n","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nQ = int(eval(input()))\n\nM = list(map(int, input().split()))\n\n\n\ncombinations = {}\n\n\n\ndef create_combinations(idx, sum):\n\n combinations[sum] = 1\n\n if idx >= N:\n\n return\n\n create_combinations(idx+1, sum)\n\n create_combinations(idx+1, sum+A[idx])\n\n return\n\n\n\ncreate_combinations(0, 0)\n\n\n\nfor target in M:\n\n if target in list(combinations.keys()):\n\n print(\"yes\")\n\n else:\n\n print(\"no\")\n","code_v0_loc":23,"code_v1_loc":22,"code_v0_num_chars":492,"code_v1_num_chars":464,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nQ = int(eval(input()))\nM = list(map(int, input().split()))\nexhaustive_dict = {}\n\n\ndef create_exhastive_list(head, sum):\n for i in range(head, N):\n sum += A[i]\n exhaustive_dict[sum] = 1\n create_exhastive_list(i + 1, sum)\n sum -= A[i]\n\n\nhead = 0\nsum = 0\ncreate_exhastive_list(head, sum)\nfor target in M:\n if target in list(exhaustive_dict.keys()):\n print(\"yes\")\n else:\n print(\"no\")\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nQ = int(eval(input()))\nM = list(map(int, input().split()))\ncombinations = {}\n\n\ndef create_combinations(idx, sum):\n combinations[sum] = 1\n if idx >= N:\n return\n create_combinations(idx + 1, sum)\n create_combinations(idx + 1, sum + A[idx])\n return\n\n\ncreate_combinations(0, 0)\nfor target in M:\n if target in list(combinations.keys()):\n print(\"yes\")\n else:\n print(\"no\")\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["-exhaustive_dict = {}","+combinations = {}","-def create_exhastive_list(head, sum):","- for i in range(head, N):","- sum += A[i]","- exhaustive_dict[sum] = 1","- create_exhastive_list(i + 1, sum)","- sum -= A[i]","+def create_combinations(idx, sum):","+ combinations[sum] = 1","+ if idx >= N:","+ return","+ create_combinations(idx + 1, sum)","+ create_combinations(idx + 1, sum + A[idx])","+ return","-head = 0","-sum = 0","-create_exhastive_list(head, sum)","+create_combinations(0, 0)","- if target in list(exhaustive_dict.keys()):","+ if target in list(combinations.keys()):"],"diff_only_import_comment":false,"measured_runtime_v0":0.034587992,"measured_runtime_v1":0.0732450256,"runtime_lift":0.4722230848,"key":["s982787892","s138262063"]} +{"user_id":"u059436995","problem_id":"p03012","language":"python","submission_id_v0":"s285537538","submission_id_v1":"s727918785","cpu_time_v0":150,"cpu_time_v1":18,"memory_v0":12500,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.0,"input":"import numpy as np\n\nn = eval(input())\n\nw = list(map(int, input().split()))\n\nw = np.array(w)\n\nprint((np.min(np.abs(2 * np.cumsum(w) -np.sum(w)))))","target":"n = int(eval(input()))\n\nw = list(map(int, input().split()))\n\nans = sum(w)\n\nfor i in range(1,n):\n\n ans = min(ans,abs(sum(w[:i + 1]) - sum(w[i +1:])))\n\nprint(ans)","code_v0_loc":5,"code_v1_loc":6,"code_v0_num_chars":137,"code_v1_num_chars":157,"code_v0_no_empty_lines":"import numpy as np\n\nn = eval(input())\nw = list(map(int, input().split()))\nw = np.array(w)\nprint((np.min(np.abs(2 * np.cumsum(w) - np.sum(w)))))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nw = list(map(int, input().split()))\nans = sum(w)\nfor i in range(1, n):\n ans = min(ans, abs(sum(w[: i + 1]) - sum(w[i + 1 :])))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-import numpy as np","-","-n = eval(input())","+n = int(eval(input()))","-w = np.array(w)","-print((np.min(np.abs(2 * np.cumsum(w) - np.sum(w)))))","+ans = sum(w)","+for i in range(1, n):","+ ans = min(ans, abs(sum(w[: i + 1]) - sum(w[i + 1 :])))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.4110743086,"measured_runtime_v1":0.0353013692,"runtime_lift":11.6447128807,"key":["s285537538","s727918785"]} +{"user_id":"u366959492","problem_id":"p03163","language":"python","submission_id_v0":"s801167513","submission_id_v1":"s712193467","cpu_time_v0":1478,"cpu_time_v1":496,"memory_v0":9716,"memory_v1":120172,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":66.44,"input":"def nap(n,cap):\n\n val = [0]*(cap+1)\n\n for _ in range(n):\n\n w,v = list(map(int,input().split()))\n\n for k in range(cap,w-1,-1):\n\n nv=val[k-w]+v\n\n if val[k]= h:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n","target":"h,n = list(map(int,input().split()))\n\nsp = list(map(int,input().split())) \n\nif h > sum(sp):\n\n print('No')\n\nelse:\n\n print('Yes')\n","code_v0_loc":6,"code_v1_loc":6,"code_v0_num_chars":122,"code_v1_num_chars":118,"code_v0_no_empty_lines":"h, n = list(map(int, input().split()))\na = list(map(int, input().split()))\nif sum(a) >= h:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"h, n = list(map(int, input().split()))\nsp = list(map(int, input().split()))\nif h > sum(sp):\n print(\"No\")\nelse:\n print(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a = list(map(int, input().split()))","-if sum(a) >= h:","+sp = list(map(int, input().split()))","+if h > sum(sp):","+ print(\"No\")","+else:","-else:","- print(\"No\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.037363466,"measured_runtime_v1":0.0423055615,"runtime_lift":0.8831809496,"key":["s414645687","s555297272"]} +{"user_id":"u980205854","problem_id":"p02574","language":"python","submission_id_v0":"s822127108","submission_id_v1":"s289875618","cpu_time_v0":694,"cpu_time_v1":338,"memory_v0":213052,"memory_v1":189236,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.3,"input":"# E - Coprime\n\nfrom math import gcd\n\n\n\nN = int(eval(input()))\n\nA = list(map(int,input().split()))\n\nA = sorted(A)\n\nMAX = 10**6\n\nL = [0]*(MAX+1)\n\n\n\ndef prime(x):\n\n global L\n\n p = 2\n\n while x>1:\n\n if L[x]==1:\n\n return False\n\n if x%p==0:\n\n while x%p==0:\n\n x \/\/= p\n\n tmp = p\n\n while tmp<=MAX:\n\n L[tmp] = 1\n\n tmp += p\n\n p = p+1 if p*p0:\n\n continue\n\n tmp = i\n\n while tmp<=MAX:\n\n p[tmp] = i\n\n tmp += i\n\n\n\npairwise = True\n\ng = -1\n\nq = [-1]*(MAX+1)\n\n\n\nfor i in range(N):\n\n a = A[i]\n\n g = a if g<0 else gcd(g,a)\n\n while pairwise and a>1:\n\n pairwise = True if q[p[a]] in [-1,i] else False\n\n q[p[a]] = i\n\n a \/\/= p[a]\n\n\n\nif pairwise:\n\n print('pairwise coprime')\n\nelif g==1:\n\n print('setwise coprime')\n\nelse:\n\n print('not coprime')","code_v0_loc":41,"code_v1_loc":34,"code_v0_num_chars":749,"code_v1_num_chars":617,"code_v0_no_empty_lines":"# E - Coprime\nfrom math import gcd\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nA = sorted(A)\nMAX = 10**6\nL = [0] * (MAX + 1)\n\n\ndef prime(x):\n global L\n p = 2\n while x > 1:\n if L[x] == 1:\n return False\n if x % p == 0:\n while x % p == 0:\n x \/\/= p\n tmp = p\n while tmp <= MAX:\n L[tmp] = 1\n tmp += p\n p = p + 1 if p * p < x else x\n return True\n\n\nG = A[0]\npairwise = True\n_ = prime(A[0])\nfor i in range(1, N):\n a = A[i]\n if pairwise:\n pairwise = prime(a)\n G = gcd(G, a)\nif pairwise:\n print(\"pairwise coprime\")\nelif G == 1:\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n","code_v1_no_empty_lines":"# E - Coprime\nfrom math import gcd\n\nN = int(eval(input()))\nA = list(map(int, input().split()))\nMAX = 10**6\np = [0] * (MAX + 1)\nfor i in range(2, MAX + 1):\n if p[i] > 0:\n continue\n tmp = i\n while tmp <= MAX:\n p[tmp] = i\n tmp += i\npairwise = True\ng = -1\nq = [-1] * (MAX + 1)\nfor i in range(N):\n a = A[i]\n g = a if g < 0 else gcd(g, a)\n while pairwise and a > 1:\n pairwise = True if q[p[a]] in [-1, i] else False\n q[p[a]] = i\n a \/\/= p[a]\nif pairwise:\n print(\"pairwise coprime\")\nelif g == 1:\n print(\"setwise coprime\")\nelse:\n print(\"not coprime\")\n","code_same":false,"relative_loc_diff_percent":17.0731707317,"diff":["-A = sorted(A)","-L = [0] * (MAX + 1)","-","-","-def prime(x):","- global L","- p = 2","- while x > 1:","- if L[x] == 1:","- return False","- if x % p == 0:","- while x % p == 0:","- x \/\/= p","- tmp = p","- while tmp <= MAX:","- L[tmp] = 1","- tmp += p","- p = p + 1 if p * p < x else x","- return True","-","-","-G = A[0]","+p = [0] * (MAX + 1)","+for i in range(2, MAX + 1):","+ if p[i] > 0:","+ continue","+ tmp = i","+ while tmp <= MAX:","+ p[tmp] = i","+ tmp += i","-_ = prime(A[0])","-for i in range(1, N):","+g = -1","+q = [-1] * (MAX + 1)","+for i in range(N):","- if pairwise:","- pairwise = prime(a)","- G = gcd(G, a)","+ g = a if g < 0 else gcd(g, a)","+ while pairwise and a > 1:","+ pairwise = True if q[p[a]] in [-1, i] else False","+ q[p[a]] = i","+ a \/\/= p[a]","-elif G == 1:","+elif g == 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.1454371753,"measured_runtime_v1":1.2450333893,"runtime_lift":0.1168138755,"key":["s822127108","s289875618"]} +{"user_id":"u103902792","problem_id":"p04001","language":"python","submission_id_v0":"s390197571","submission_id_v1":"s950361221","cpu_time_v0":28,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":35.71,"input":"s = eval(input())\n\nn = len(s)\n\nans = 0\n\n\n\nfor i in range(2**(n-1)):\n\n form = s\n\n bit = []\n\n for _ in range(n-1):\n\n bit.append(i%2)\n\n i = i\/\/2\n\n\n\n for j in range(n-1):\n\n if bit[j]:\n\n form = form[:n-j-1] + '+' + form[n-j-1:]\n\n\n\n \n\n ans += eval(form)\n\nprint(ans)\n\n\n","target":"s = eval(input())\n\nn = len(s)\n\ncand = []\n\n\n\ndef func(ac,yet,sum):\n\n next = int(yet[0])\n\n \n\n \n\n if len(yet) ==1:\n\n cand.append(sum+ ac+ next)\n\n cand.append(sum+ ac*10+ next)\n\n else:\n\n func(next, yet[1:],ac+sum)\n\n func(ac*10+next, yet[1:],sum)\n\n\n\nfunc(0,s,0)\n\nprint((sum(cand)\/\/2))","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":279,"code_v1_num_chars":288,"code_v0_no_empty_lines":"s = eval(input())\nn = len(s)\nans = 0\nfor i in range(2 ** (n - 1)):\n form = s\n bit = []\n for _ in range(n - 1):\n bit.append(i % 2)\n i = i \/\/ 2\n for j in range(n - 1):\n if bit[j]:\n form = form[: n - j - 1] + \"+\" + form[n - j - 1 :]\n ans += eval(form)\nprint(ans)\n","code_v1_no_empty_lines":"s = eval(input())\nn = len(s)\ncand = []\n\n\ndef func(ac, yet, sum):\n next = int(yet[0])\n if len(yet) == 1:\n cand.append(sum + ac + next)\n cand.append(sum + ac * 10 + next)\n else:\n func(next, yet[1:], ac + sum)\n func(ac * 10 + next, yet[1:], sum)\n\n\nfunc(0, s, 0)\nprint((sum(cand) \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-ans = 0","-for i in range(2 ** (n - 1)):","- form = s","- bit = []","- for _ in range(n - 1):","- bit.append(i % 2)","- i = i \/\/ 2","- for j in range(n - 1):","- if bit[j]:","- form = form[: n - j - 1] + \"+\" + form[n - j - 1 :]","- ans += eval(form)","-print(ans)","+cand = []","+","+","+def func(ac, yet, sum):","+ next = int(yet[0])","+ if len(yet) == 1:","+ cand.append(sum + ac + next)","+ cand.append(sum + ac * 10 + next)","+ else:","+ func(next, yet[1:], ac + sum)","+ func(ac * 10 + next, yet[1:], sum)","+","+","+func(0, s, 0)","+print((sum(cand) \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0452483654,"measured_runtime_v1":0.0770035267,"runtime_lift":0.5876141956,"key":["s390197571","s950361221"]} +{"user_id":"u644907318","problem_id":"p03268","language":"python","submission_id_v0":"s607327041","submission_id_v1":"s556023146","cpu_time_v0":165,"cpu_time_v1":61,"memory_v0":38384,"memory_v1":61488,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.03,"input":"N,K = list(map(int,input().split()))\n\nif K%2==1:\n\n n = N\/\/K\n\n ans = n**3\n\nelse:\n\n n1 = N\/\/K\n\n n2 = 1+(N-K\/\/2)\/\/K\n\n ans = n1**3+n2**3\n\nprint(ans)","target":"N,K = list(map(int,input().split()))\n\nL = N\/\/K\n\nif K%2==1:\n\n print((L**3))\n\nelse:\n\n M = N\/\/(K\/\/2)\n\n M -= L\n\n print((L**3+M**3))","code_v0_loc":9,"code_v1_loc":8,"code_v0_num_chars":153,"code_v1_num_chars":129,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nif K % 2 == 1:\n n = N \/\/ K\n ans = n**3\nelse:\n n1 = N \/\/ K\n n2 = 1 + (N - K \/\/ 2) \/\/ K\n ans = n1**3 + n2**3\nprint(ans)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nL = N \/\/ K\nif K % 2 == 1:\n print((L**3))\nelse:\n M = N \/\/ (K \/\/ 2)\n M -= L\n print((L**3 + M**3))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["+L = N \/\/ K","- n = N \/\/ K","- ans = n**3","+ print((L**3))","- n1 = N \/\/ K","- n2 = 1 + (N - K \/\/ 2) \/\/ K","- ans = n1**3 + n2**3","-print(ans)","+ M = N \/\/ (K \/\/ 2)","+ M -= L","+ print((L**3 + M**3))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1775273252,"measured_runtime_v1":0.0878204372,"runtime_lift":2.0214807715,"key":["s607327041","s556023146"]} +{"user_id":"u973840923","problem_id":"p03212","language":"python","submission_id_v0":"s913992142","submission_id_v1":"s049252309","cpu_time_v0":94,"cpu_time_v1":64,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":31.91,"input":"from itertools import product\n\nN = int(eval(input()))\n\nans = 0\n\nfor l in range(1, 11):\n\n for p in product(\"357\", repeat=l):\n\n v = \"\".join(p)\n\n if \"3\" in v and \"5\" in v and \"7\" in v and int(\"\".join(p)) <= N:\n\n ans += 1\n\nprint(ans)","target":"N = int(eval(input()))\n\n\n\ncnt = 0\n\ndef dfs(s):\n\n global cnt\n\n if '3' in s and '5' in s and '7' in s and int(s) <= N:\n\n cnt += 1\n\n if len(s) >= 10:\n\n return cnt\n\n dfs(s + '3')\n\n dfs(s + '5')\n\n dfs(s + '7')\n\n return cnt\n\n\n\nprint((dfs('')))","code_v0_loc":9,"code_v1_loc":15,"code_v0_num_chars":251,"code_v1_num_chars":264,"code_v0_no_empty_lines":"from itertools import product\n\nN = int(eval(input()))\nans = 0\nfor l in range(1, 11):\n for p in product(\"357\", repeat=l):\n v = \"\".join(p)\n if \"3\" in v and \"5\" in v and \"7\" in v and int(\"\".join(p)) <= N:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\ncnt = 0\n\n\ndef dfs(s):\n global cnt\n if \"3\" in s and \"5\" in s and \"7\" in s and int(s) <= N:\n cnt += 1\n if len(s) >= 10:\n return cnt\n dfs(s + \"3\")\n dfs(s + \"5\")\n dfs(s + \"7\")\n return cnt\n\n\nprint((dfs(\"\")))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-from itertools import product","+N = int(eval(input()))","+cnt = 0","-N = int(eval(input()))","-ans = 0","-for l in range(1, 11):","- for p in product(\"357\", repeat=l):","- v = \"\".join(p)","- if \"3\" in v and \"5\" in v and \"7\" in v and int(\"\".join(p)) <= N:","- ans += 1","-print(ans)","+","+def dfs(s):","+ global cnt","+ if \"3\" in s and \"5\" in s and \"7\" in s and int(s) <= N:","+ cnt += 1","+ if len(s) >= 10:","+ return cnt","+ dfs(s + \"3\")","+ dfs(s + \"5\")","+ dfs(s + \"7\")","+ return cnt","+","+","+print((dfs(\"\")))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1421381476,"measured_runtime_v1":0.1384982109,"runtime_lift":1.0262814707,"key":["s913992142","s049252309"]} +{"user_id":"u380524497","problem_id":"p03078","language":"python","submission_id_v0":"s787172113","submission_id_v1":"s963140305","cpu_time_v0":122,"cpu_time_v1":35,"memory_v0":8724,"memory_v1":4976,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":71.31,"input":"X, Y, Z, K = list(map(int, input().split()))\n\nA = sorted(list(map(int, input().split())),reverse=True)\n\nB = sorted(list(map(int, input().split())),reverse=True)\n\nC = sorted(list(map(int, input().split())),reverse=True)\n\n\n\nans = []\n\nfor x in range(X):\n\n if x+1 > K:\n\n break\n\n for y in range(Y):\n\n if (x+1) * (y+1) > K:\n\n break\n\n for z in range(Z):\n\n if (x+1) * (y+1) * (z+1) > K:\n\n break\n\n\n\n value = A[x] + B[y] + C[z]\n\n ans.append(value)\n\n\n\nans.sort(reverse=True)\n\nfor i in range(K):\n\n print((ans[i]))\n","target":"import heapq\n\n\n\nX, Y, Z, K = list(map(int, input().split()))\n\nA = sorted(list(map(int, input().split())),reverse=True)\n\nB = sorted(list(map(int, input().split())),reverse=True)\n\nC = sorted(list(map(int, input().split())),reverse=True)\n\n\n\nused = set()\n\ncandidate = []\n\nheapq.heappush(candidate, (-A[0]-B[0]-C[0], 0, 0, 0))\n\n\n\nfor _ in range(K):\n\n value, x, y, z = heapq.heappop(candidate)\n\n print((-value))\n\n\n\n if x+1 < X and (x+1, y, z) not in used:\n\n heapq.heappush(candidate, (-A[x+1]-B[y]-C[z], x+1, y, z))\n\n used.add((x+1, y, z))\n\n\n\n if y+1 < Y and (x, y+1, z) not in used:\n\n heapq.heappush(candidate, (-A[x]-B[y+1]-C[z], x, y+1, z))\n\n used.add((x, y+1, z))\n\n\n\n if z+1 < Z and (x, y, z+1) not in used:\n\n heapq.heappush(candidate, (-A[x]-B[y]-C[z+1], x , y, z+1))\n\n used.add((x, y, z+1))","code_v0_loc":22,"code_v1_loc":26,"code_v0_num_chars":583,"code_v1_num_chars":839,"code_v0_no_empty_lines":"X, Y, Z, K = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())), reverse=True)\nB = sorted(list(map(int, input().split())), reverse=True)\nC = sorted(list(map(int, input().split())), reverse=True)\nans = []\nfor x in range(X):\n if x + 1 > K:\n break\n for y in range(Y):\n if (x + 1) * (y + 1) > K:\n break\n for z in range(Z):\n if (x + 1) * (y + 1) * (z + 1) > K:\n break\n value = A[x] + B[y] + C[z]\n ans.append(value)\nans.sort(reverse=True)\nfor i in range(K):\n print((ans[i]))\n","code_v1_no_empty_lines":"import heapq\n\nX, Y, Z, K = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())), reverse=True)\nB = sorted(list(map(int, input().split())), reverse=True)\nC = sorted(list(map(int, input().split())), reverse=True)\nused = set()\ncandidate = []\nheapq.heappush(candidate, (-A[0] - B[0] - C[0], 0, 0, 0))\nfor _ in range(K):\n value, x, y, z = heapq.heappop(candidate)\n print((-value))\n if x + 1 < X and (x + 1, y, z) not in used:\n heapq.heappush(candidate, (-A[x + 1] - B[y] - C[z], x + 1, y, z))\n used.add((x + 1, y, z))\n if y + 1 < Y and (x, y + 1, z) not in used:\n heapq.heappush(candidate, (-A[x] - B[y + 1] - C[z], x, y + 1, z))\n used.add((x, y + 1, z))\n if z + 1 < Z and (x, y, z + 1) not in used:\n heapq.heappush(candidate, (-A[x] - B[y] - C[z + 1], x, y, z + 1))\n used.add((x, y, z + 1))\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["+import heapq","+","-ans = []","-for x in range(X):","- if x + 1 > K:","- break","- for y in range(Y):","- if (x + 1) * (y + 1) > K:","- break","- for z in range(Z):","- if (x + 1) * (y + 1) * (z + 1) > K:","- break","- value = A[x] + B[y] + C[z]","- ans.append(value)","-ans.sort(reverse=True)","-for i in range(K):","- print((ans[i]))","+used = set()","+candidate = []","+heapq.heappush(candidate, (-A[0] - B[0] - C[0], 0, 0, 0))","+for _ in range(K):","+ value, x, y, z = heapq.heappop(candidate)","+ print((-value))","+ if x + 1 < X and (x + 1, y, z) not in used:","+ heapq.heappush(candidate, (-A[x + 1] - B[y] - C[z], x + 1, y, z))","+ used.add((x + 1, y, z))","+ if y + 1 < Y and (x, y + 1, z) not in used:","+ heapq.heappush(candidate, (-A[x] - B[y + 1] - C[z], x, y + 1, z))","+ used.add((x, y + 1, z))","+ if z + 1 < Z and (x, y, z + 1) not in used:","+ heapq.heappush(candidate, (-A[x] - B[y] - C[z + 1], x, y, z + 1))","+ used.add((x, y, z + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0355692644,"measured_runtime_v1":0.0539314804,"runtime_lift":0.659526943,"key":["s787172113","s963140305"]} +{"user_id":"u147544115","problem_id":"p02603","language":"python","submission_id_v0":"s988102139","submission_id_v1":"s684967905","cpu_time_v0":31,"cpu_time_v1":27,"memory_v0":8992,"memory_v1":9088,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.9,"input":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\n# \u8caa\u6b32\u6cd5\n\n# a[i] < a[i+1]\u306a\u3089\u5168\u90e8\u8cb7\u3046\n\n# a[i] > a[i+1]\u306a\u3089\u5168\u90e8\u58f2\u308b\n\n\n\nmoney = 1000\n\nstock = 0\n\nfor i in range(n):\n\n if i == n-1 or a[i] > a[i+1]:\n\n money += stock * a[i]\n\n stock = 0\n\n elif money > a[i]:\n\n stock = money \/\/ a[i]\n\n money = money % a[i]\n\n\n\nprint(money)","target":"n = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\n# DP\n\n# dp[i]: i\u65e5\u76ee\u306e\u6240\u6301\u91d1\u306e\u6700\u5927\u5024\uff08\u6301\u3061\u682a\u306f\u58f2\u308b\uff09\n\ndp = [0] * n\n\ndp[0] = 1000\n\n\n\n# dp[1] = 0\u65e5\u76ee\u306b\u5168\u90e8\u8cb7\u3063\u30661\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b or 0\u65e5\u76ee\u304b\u3089\u4f55\u3082\u3057\u306a\u3044\n\n# dp[2] = 0 or 1\u65e5\u76ee\u306b\u5168\u90e8\u8cb7\u3063\u30662\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b or 1\u65e5\u76ee\u304b\u3089\u4f55\u3082\u3057\u306a\u3044\n\n# dp[i+1] + 0~i\u65e5\u76ee\u306e\u3069\u3053\u304b\u3067\u5168\u90e8\u8cb7\u3063\u3066i+1\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b or i\u65e5\u76ee\u304b\u3089\u4f55\u3082\u3057\u306a\u3044\n\nfor i in range(n):\n\n if i == 0:\n\n dp[i] = 1000\n\n continue\n\n \n\n dp[i] = dp[i-1]\n\n for j in range(i):\n\n # j\u65e5\u76ee\u306b\u5168\u90e8\u8cb7\u3063\u3066i\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b\n\n dp[i] = max(dp[i], (dp[j] \/\/ a[j]) * a[i] + dp[j] % a[j])\n\n \n\nprint((dp[n-1]))","code_v0_loc":18,"code_v1_loc":22,"code_v0_num_chars":341,"code_v1_num_chars":510,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\n# \u8caa\u6b32\u6cd5\n# a[i] < a[i+1]\u306a\u3089\u5168\u90e8\u8cb7\u3046\n# a[i] > a[i+1]\u306a\u3089\u5168\u90e8\u58f2\u308b\nmoney = 1000\nstock = 0\nfor i in range(n):\n if i == n - 1 or a[i] > a[i + 1]:\n money += stock * a[i]\n stock = 0\n elif money > a[i]:\n stock = money \/\/ a[i]\n money = money % a[i]\nprint(money)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\n# DP\n# dp[i]: i\u65e5\u76ee\u306e\u6240\u6301\u91d1\u306e\u6700\u5927\u5024\uff08\u6301\u3061\u682a\u306f\u58f2\u308b\uff09\ndp = [0] * n\ndp[0] = 1000\n# dp[1] = 0\u65e5\u76ee\u306b\u5168\u90e8\u8cb7\u3063\u30661\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b or 0\u65e5\u76ee\u304b\u3089\u4f55\u3082\u3057\u306a\u3044\n# dp[2] = 0 or 1\u65e5\u76ee\u306b\u5168\u90e8\u8cb7\u3063\u30662\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b or 1\u65e5\u76ee\u304b\u3089\u4f55\u3082\u3057\u306a\u3044\n# dp[i+1] + 0~i\u65e5\u76ee\u306e\u3069\u3053\u304b\u3067\u5168\u90e8\u8cb7\u3063\u3066i+1\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b or i\u65e5\u76ee\u304b\u3089\u4f55\u3082\u3057\u306a\u3044\nfor i in range(n):\n if i == 0:\n dp[i] = 1000\n continue\n dp[i] = dp[i - 1]\n for j in range(i):\n # j\u65e5\u76ee\u306b\u5168\u90e8\u8cb7\u3063\u3066i\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b\n dp[i] = max(dp[i], (dp[j] \/\/ a[j]) * a[i] + dp[j] % a[j])\nprint((dp[n - 1]))\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-# \u8caa\u6b32\u6cd5","-# a[i] < a[i+1]\u306a\u3089\u5168\u90e8\u8cb7\u3046","-# a[i] > a[i+1]\u306a\u3089\u5168\u90e8\u58f2\u308b","-money = 1000","-stock = 0","+# DP","+# dp[i]: i\u65e5\u76ee\u306e\u6240\u6301\u91d1\u306e\u6700\u5927\u5024\uff08\u6301\u3061\u682a\u306f\u58f2\u308b\uff09","+dp = [0] * n","+dp[0] = 1000","+# dp[1] = 0\u65e5\u76ee\u306b\u5168\u90e8\u8cb7\u3063\u30661\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b or 0\u65e5\u76ee\u304b\u3089\u4f55\u3082\u3057\u306a\u3044","+# dp[2] = 0 or 1\u65e5\u76ee\u306b\u5168\u90e8\u8cb7\u3063\u30662\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b or 1\u65e5\u76ee\u304b\u3089\u4f55\u3082\u3057\u306a\u3044","+# dp[i+1] + 0~i\u65e5\u76ee\u306e\u3069\u3053\u304b\u3067\u5168\u90e8\u8cb7\u3063\u3066i+1\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b or i\u65e5\u76ee\u304b\u3089\u4f55\u3082\u3057\u306a\u3044","- if i == n - 1 or a[i] > a[i + 1]:","- money += stock * a[i]","- stock = 0","- elif money > a[i]:","- stock = money \/\/ a[i]","- money = money % a[i]","-print(money)","+ if i == 0:","+ dp[i] = 1000","+ continue","+ dp[i] = dp[i - 1]","+ for j in range(i):","+ # j\u65e5\u76ee\u306b\u5168\u90e8\u8cb7\u3063\u3066i\u65e5\u76ee\u306b\u5168\u90e8\u58f2\u308b","+ dp[i] = max(dp[i], (dp[j] \/\/ a[j]) * a[i] + dp[j] % a[j])","+print((dp[n - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0454887328,"measured_runtime_v1":0.0657710595,"runtime_lift":0.6916223206,"key":["s988102139","s684967905"]} +{"user_id":"u266113953","problem_id":"p02732","language":"python","submission_id_v0":"s942563503","submission_id_v1":"s285979909","cpu_time_v0":462,"cpu_time_v1":410,"memory_v0":43836,"memory_v1":29140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.26,"input":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nse = set()\n\ndic = dict()\n\n\n\nfor i in range(N):\n\n if A[i] in se:\n\n dic[A[i]] += 1\n\n else:\n\n se.add(A[i])\n\n dic.update({A[i]: 1})\n\n\n\nc = 0\n\nfor k in list(dic.keys()):\n\n c += (dic[k])*(dic[k]-1)\/\/2\n\n\n\nresult = [0]*N\n\nfor i in range(N):\n\n result[i] = c - (dic[A[i]])*(dic[A[i]]-1)\/\/2 + (dic[A[i]]-1)*(dic[A[i]]-2)\/\/2\n\n\n\nprint((\"\\n\".join(list(map(str, result)))))\n","target":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\n\n\nse = set()\n\ndic = dict()\n\n\n\nfor i in range(N):\n\n if A[i] in se:\n\n dic[A[i]] += 1\n\n else:\n\n se.add(A[i])\n\n dic.update({A[i]: 1})\n\n\n\nc = 0\n\nfor k in list(dic.keys()):\n\n c += (dic[k])*(dic[k]-1)\/\/2\n\n\n\nfor i in range(N):\n\n print((c - dic[A[i]]+1))\n","code_v0_loc":22,"code_v1_loc":19,"code_v0_num_chars":441,"code_v1_num_chars":326,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nse = set()\ndic = dict()\nfor i in range(N):\n if A[i] in se:\n dic[A[i]] += 1\n else:\n se.add(A[i])\n dic.update({A[i]: 1})\nc = 0\nfor k in list(dic.keys()):\n c += (dic[k]) * (dic[k] - 1) \/\/ 2\nresult = [0] * N\nfor i in range(N):\n result[i] = (\n c - (dic[A[i]]) * (dic[A[i]] - 1) \/\/ 2 + (dic[A[i]] - 1) * (dic[A[i]] - 2) \/\/ 2\n )\nprint((\"\\n\".join(list(map(str, result)))))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nse = set()\ndic = dict()\nfor i in range(N):\n if A[i] in se:\n dic[A[i]] += 1\n else:\n se.add(A[i])\n dic.update({A[i]: 1})\nc = 0\nfor k in list(dic.keys()):\n c += (dic[k]) * (dic[k] - 1) \/\/ 2\nfor i in range(N):\n print((c - dic[A[i]] + 1))\n","code_same":false,"relative_loc_diff_percent":13.6363636364,"diff":["-result = [0] * N","- result[i] = (","- c - (dic[A[i]]) * (dic[A[i]] - 1) \/\/ 2 + (dic[A[i]] - 1) * (dic[A[i]] - 2) \/\/ 2","- )","-print((\"\\n\".join(list(map(str, result)))))","+ print((c - dic[A[i]] + 1))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0368898723,"measured_runtime_v1":0.0376020641,"runtime_lift":0.9810597677,"key":["s942563503","s285979909"]} +{"user_id":"u361381049","problem_id":"p02953","language":"python","submission_id_v0":"s278378146","submission_id_v1":"s236058166","cpu_time_v0":97,"cpu_time_v1":70,"memory_v0":14396,"memory_v1":14252,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":27.84,"input":"n = int(eval(input()))\n\nh = list(map(int, input().split()))\n\ncnt = 0\n\n \n\nfor i in range(n-1):\n\n if h[i] - h[i+1] >= 2:\n\n print('No')\n\n exit()\n\n elif h[i] - h[i+1] == 1:\n\n cnt += -1\n\n elif h[i] - h[i+1] <= -1:\n\n cnt = 0\n\n if cnt == -2:\n\n print('No')\n\n exit()\n\n \n\n \n\nprint('Yes')\n\n\n\n\n\n\n","target":"n = int(eval(input()))\n\nh = list(map(int, input().split()))\n\ncnt = h[0]\n\n \n\nfor i in range(n):\n\n if h[i] >= cnt-1:\n\n \n\n if h[i] >= cnt:\n\n cnt = h[i]\n\n else:\n\n print('No')\n\n exit()\n\n \n\nprint('Yes')","code_v0_loc":21,"code_v1_loc":14,"code_v0_num_chars":307,"code_v1_num_chars":211,"code_v0_no_empty_lines":"n = int(eval(input()))\nh = list(map(int, input().split()))\ncnt = 0\nfor i in range(n - 1):\n if h[i] - h[i + 1] >= 2:\n print(\"No\")\n exit()\n elif h[i] - h[i + 1] == 1:\n cnt += -1\n elif h[i] - h[i + 1] <= -1:\n cnt = 0\n if cnt == -2:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"n = int(eval(input()))\nh = list(map(int, input().split()))\ncnt = h[0]\nfor i in range(n):\n if h[i] >= cnt - 1:\n if h[i] >= cnt:\n cnt = h[i]\n else:\n print(\"No\")\n exit()\nprint(\"Yes\")\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-cnt = 0","-for i in range(n - 1):","- if h[i] - h[i + 1] >= 2:","- print(\"No\")","- exit()","- elif h[i] - h[i + 1] == 1:","- cnt += -1","- elif h[i] - h[i + 1] <= -1:","- cnt = 0","- if cnt == -2:","+cnt = h[0]","+for i in range(n):","+ if h[i] >= cnt - 1:","+ if h[i] >= cnt:","+ cnt = h[i]","+ else:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0640390837,"measured_runtime_v1":0.0964623685,"runtime_lift":0.6638763356,"key":["s278378146","s236058166"]} +{"user_id":"u256351611","problem_id":"p02678","language":"python","submission_id_v0":"s412582305","submission_id_v1":"s466239605","cpu_time_v0":753,"cpu_time_v1":672,"memory_v0":130392,"memory_v1":130896,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.76,"input":"n,m=list(map(int,input().split()))\n\nmarks = {i+1:-1 for i in range(n)}\n\nmarks[1] = 0\n\nroots = {i+1:[] for i in range(n)}\n\ncount = 0\n\nfor i in range(m):\n\n a,b = list(map(int,input().split()))\n\n roots[a].append(b)\n\n roots[b].append(a)\n\n\n\nbefore_room = 1\n\nsearchs = [{'root':roots[1], 'mark':1}]\n\nwhile searchs != []:\n\n next_search = []\n\n for search in searchs:\n\n for root in search['root']:\n\n new_root = []\n\n if marks[root] == -1:\n\n marks[root] = search['mark']\n\n count += 1\n\n new_root += roots[root]\n\n else:\n\n continue\n\n next_search.append({'root':roots[root], 'mark':root})\n\n searchs = next_search[:]\n\n\n\ndel marks[1]\n\nprint('Yes')\n\nfor v in list(marks.values()):\n\n print(v)\n\n ","target":"n,m=list(map(int,input().split()))\n\nmarks = {i+1:-1 for i in range(n)}\n\nroots = {i+1:[] for i in range(n)}\n\n\n\nfor i in range(m):\n\n a,b = list(map(int,input().split()))\n\n roots[a].append(b)\n\n roots[b].append(a)\n\n\n\nsearchs = [{'root':roots[1], 'mark':1}]\n\nwhile searchs != []:\n\n next_search = []\n\n for search in searchs:\n\n for root in search['root']:\n\n if marks[root] == -1:\n\n marks[root] = search['mark']\n\n else:\n\n continue\n\n next_search.append({'root':roots[root], 'mark':root})\n\n searchs = next_search[:]\n\n\n\nmarks[1] = 'Yes'\n\nfor v in list(marks.values()):\n\n print(v)\n\n ","code_v0_loc":31,"code_v1_loc":25,"code_v0_num_chars":793,"code_v1_num_chars":647,"code_v0_no_empty_lines":"n, m = list(map(int, input().split()))\nmarks = {i + 1: -1 for i in range(n)}\nmarks[1] = 0\nroots = {i + 1: [] for i in range(n)}\ncount = 0\nfor i in range(m):\n a, b = list(map(int, input().split()))\n roots[a].append(b)\n roots[b].append(a)\nbefore_room = 1\nsearchs = [{\"root\": roots[1], \"mark\": 1}]\nwhile searchs != []:\n next_search = []\n for search in searchs:\n for root in search[\"root\"]:\n new_root = []\n if marks[root] == -1:\n marks[root] = search[\"mark\"]\n count += 1\n new_root += roots[root]\n else:\n continue\n next_search.append({\"root\": roots[root], \"mark\": root})\n searchs = next_search[:]\ndel marks[1]\nprint(\"Yes\")\nfor v in list(marks.values()):\n print(v)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\nmarks = {i + 1: -1 for i in range(n)}\nroots = {i + 1: [] for i in range(n)}\nfor i in range(m):\n a, b = list(map(int, input().split()))\n roots[a].append(b)\n roots[b].append(a)\nsearchs = [{\"root\": roots[1], \"mark\": 1}]\nwhile searchs != []:\n next_search = []\n for search in searchs:\n for root in search[\"root\"]:\n if marks[root] == -1:\n marks[root] = search[\"mark\"]\n else:\n continue\n next_search.append({\"root\": roots[root], \"mark\": root})\n searchs = next_search[:]\nmarks[1] = \"Yes\"\nfor v in list(marks.values()):\n print(v)\n","code_same":false,"relative_loc_diff_percent":19.3548387097,"diff":["-marks[1] = 0","-count = 0","-before_room = 1","- new_root = []","- count += 1","- new_root += roots[root]","-del marks[1]","-print(\"Yes\")","+marks[1] = \"Yes\""],"diff_only_import_comment":false,"measured_runtime_v0":0.0374558457,"measured_runtime_v1":0.0361420107,"runtime_lift":1.0363520167,"key":["s412582305","s466239605"]} +{"user_id":"u768256617","problem_id":"p03162","language":"python","submission_id_v0":"s442221338","submission_id_v1":"s553245038","cpu_time_v0":983,"cpu_time_v1":664,"memory_v0":47344,"memory_v1":47324,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.45,"input":"n=int(eval(input()))\n\na=[]\n\nfor i in range(n):\n\n a_=list(map(int,input().split()))\n\n a.append(a_)\n\n \n\ndp=[[0]*3 for i in range(n)]\n\ndp[0]=a[0]\n\nfor i in range(1,n):\n\n for k in range(3):\n\n \n\n for j in range(3):\n\n \n\n if k!=j:\n\n dp[i][k]=max(dp[i][k], dp[i-1][j] + a[i][k])\n\n#print(dp) \n\nprint((max(dp[n-1])))","target":"n=int(eval(input()))\n\nabc=[[0,0,0]]\n\nfor i in range(n):\n\n labc=list(map(int,input().split()))\n\n abc.append(labc)\n\n\n\ndp=[[0]*3 for i in range(n+1)]\n\n\n\nfor i in range(n):\n\n for j in range(3):\n\n if j==0:\n\n dp[i+1][j]=max(dp[i][1],dp[i][2])+abc[i+1][j]\n\n\n\n elif j==1:\n\n dp[i+1][j]=max(dp[i][0],dp[i][2])+abc[i+1][j]\n\n\n\n else:\n\n dp[i+1][j]=max(dp[i][1],dp[i][0])+abc[i+1][j]\n\n\n\nprint((max(dp[n])))\n\n#print(dp)","code_v0_loc":17,"code_v1_loc":21,"code_v0_num_chars":332,"code_v1_num_chars":423,"code_v0_no_empty_lines":"n = int(eval(input()))\na = []\nfor i in range(n):\n a_ = list(map(int, input().split()))\n a.append(a_)\ndp = [[0] * 3 for i in range(n)]\ndp[0] = a[0]\nfor i in range(1, n):\n for k in range(3):\n for j in range(3):\n if k != j:\n dp[i][k] = max(dp[i][k], dp[i - 1][j] + a[i][k])\n# print(dp)\nprint((max(dp[n - 1])))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nabc = [[0, 0, 0]]\nfor i in range(n):\n labc = list(map(int, input().split()))\n abc.append(labc)\ndp = [[0] * 3 for i in range(n + 1)]\nfor i in range(n):\n for j in range(3):\n if j == 0:\n dp[i + 1][j] = max(dp[i][1], dp[i][2]) + abc[i + 1][j]\n elif j == 1:\n dp[i + 1][j] = max(dp[i][0], dp[i][2]) + abc[i + 1][j]\n else:\n dp[i + 1][j] = max(dp[i][1], dp[i][0]) + abc[i + 1][j]\nprint((max(dp[n])))\n# print(dp)\n","code_same":false,"relative_loc_diff_percent":19.0476190476,"diff":["-a = []","+abc = [[0, 0, 0]]","- a_ = list(map(int, input().split()))","- a.append(a_)","-dp = [[0] * 3 for i in range(n)]","-dp[0] = a[0]","-for i in range(1, n):","- for k in range(3):","- for j in range(3):","- if k != j:","- dp[i][k] = max(dp[i][k], dp[i - 1][j] + a[i][k])","+ labc = list(map(int, input().split()))","+ abc.append(labc)","+dp = [[0] * 3 for i in range(n + 1)]","+for i in range(n):","+ for j in range(3):","+ if j == 0:","+ dp[i + 1][j] = max(dp[i][1], dp[i][2]) + abc[i + 1][j]","+ elif j == 1:","+ dp[i + 1][j] = max(dp[i][0], dp[i][2]) + abc[i + 1][j]","+ else:","+ dp[i + 1][j] = max(dp[i][1], dp[i][0]) + abc[i + 1][j]","+print((max(dp[n])))","-print((max(dp[n - 1])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.038580092,"measured_runtime_v1":0.0432268367,"runtime_lift":0.8925032435,"key":["s442221338","s553245038"]} +{"user_id":"u353919145","problem_id":"p03264","language":"python","submission_id_v0":"s861249378","submission_id_v1":"s368838191","cpu_time_v0":166,"cpu_time_v1":18,"memory_v0":38640,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.16,"input":"n=int(eval(input()))\n\nm=list(range(1,n+1))\n\neven=[]\n\nodd=[]\n\nfor x in range (0,len(m)):\n\n if len(m)==0:\n\n print('0')\n\n else:\n\n if m[x] % 2 == 0:\n\n even.append(m[x])\n\n else:\n\n odd.append(m[x])\n\n\n\noutput = [[a, b] for a in even\n\n for b in odd]\n\nprint((len(output)))\n","target":"m=int(eval(input()))\n\nif m%2==0:\n\n z=(m\/\/2)*(m\/\/2)\n\n print(z)\n\nelse:\n\n y=(m\/\/2)*((m\/\/2)+1)\n\n print(y)","code_v0_loc":16,"code_v1_loc":7,"code_v0_num_chars":318,"code_v1_num_chars":107,"code_v0_no_empty_lines":"n = int(eval(input()))\nm = list(range(1, n + 1))\neven = []\nodd = []\nfor x in range(0, len(m)):\n if len(m) == 0:\n print(\"0\")\n else:\n if m[x] % 2 == 0:\n even.append(m[x])\n else:\n odd.append(m[x])\noutput = [[a, b] for a in even for b in odd]\nprint((len(output)))\n","code_v1_no_empty_lines":"m = int(eval(input()))\nif m % 2 == 0:\n z = (m \/\/ 2) * (m \/\/ 2)\n print(z)\nelse:\n y = (m \/\/ 2) * ((m \/\/ 2) + 1)\n print(y)\n","code_same":false,"relative_loc_diff_percent":56.25,"diff":["-n = int(eval(input()))","-m = list(range(1, n + 1))","-even = []","-odd = []","-for x in range(0, len(m)):","- if len(m) == 0:","- print(\"0\")","- else:","- if m[x] % 2 == 0:","- even.append(m[x])","- else:","- odd.append(m[x])","-output = [[a, b] for a in even for b in odd]","-print((len(output)))","+m = int(eval(input()))","+if m % 2 == 0:","+ z = (m \/\/ 2) * (m \/\/ 2)","+ print(z)","+else:","+ y = (m \/\/ 2) * ((m \/\/ 2) + 1)","+ print(y)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0358545887,"measured_runtime_v1":0.0339924638,"runtime_lift":1.0547805219,"key":["s861249378","s368838191"]} +{"user_id":"u970899068","problem_id":"p03592","language":"python","submission_id_v0":"s501753389","submission_id_v1":"s386099621","cpu_time_v0":394,"cpu_time_v1":186,"memory_v0":3060,"memory_v1":40428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.79,"input":"n,m,k=list(map(int, input().split()))\n\ncount=0\n\n\n\nfor i in range(n+1):\n\n for j in range(1,m+1):\n\n count=(i*m)+(j*n)-2*(i*j)\n\n if count==k:\n\n print('Yes')\n\n exit()\n\n\n\nprint('No')","target":"n,m,k= list(map(int, input().split()))\n\n\n\nfor i in range(n+1):\n\n for j in range(m+1):\n\n x=i*m+j*n-2*(i*j)\n\n if k==x:\n\n print('Yes')\n\n exit()\n\nprint('No')","code_v0_loc":11,"code_v1_loc":9,"code_v0_num_chars":210,"code_v1_num_chars":186,"code_v0_no_empty_lines":"n, m, k = list(map(int, input().split()))\ncount = 0\nfor i in range(n + 1):\n for j in range(1, m + 1):\n count = (i * m) + (j * n) - 2 * (i * j)\n if count == k:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_v1_no_empty_lines":"n, m, k = list(map(int, input().split()))\nfor i in range(n + 1):\n for j in range(m + 1):\n x = i * m + j * n - 2 * (i * j)\n if k == x:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-count = 0","- for j in range(1, m + 1):","- count = (i * m) + (j * n) - 2 * (i * j)","- if count == k:","+ for j in range(m + 1):","+ x = i * m + j * n - 2 * (i * j)","+ if k == x:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0626986105,"measured_runtime_v1":0.0444955249,"runtime_lift":1.4090992453,"key":["s501753389","s386099621"]} +{"user_id":"u284927738","problem_id":"p02725","language":"python","submission_id_v0":"s101050735","submission_id_v1":"s817908948","cpu_time_v0":191,"cpu_time_v1":148,"memory_v0":20148,"memory_v1":26444,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.51,"input":"first = eval(input())\n\nfirst = first.split()\n\n\n\nK = int(first[0])\n\nN = int(first[1])\n\n\n\nsecond = eval(input())\n\nsecond = second.split()\n\n\n\ndistance = []\n\ndiff = 0\n\n\n\nfor i in range(0, N):\n\n if i == N-1:\n\n diff0 = 0\n\n diff1 = 0\n\n diff0 = int(second[0])\n\n diff1 = K - int(second[i])\n\n diff = diff0 + diff1\n\n distance.append(diff)\n\n else:\n\n diff = int(second[i+1]) - int(second[i])\n\n distance.append(diff)\n\n \n\nMaxIndex = distance.index(max(distance))\n\ndistance.pop(MaxIndex)\n\nMax = sum(distance)\n\nprint(Max)","target":"K, N = list(map(int, input().split()))\n\n \n\nA_list = list(map(int, input().split()))\n\n\n\ndistance = []\n\ndiff = 0\n\n\n\nfor i in range(0, N):\n\n \n\n if i == N-1:\n\n diff = K + A_list[0] - A_list[i]\n\n distance.append(diff)\n\n \n\n else:\n\n diff = A_list[i+1] - A_list[i]\n\n distance.append(diff)\n\n \n\n\n\nprint((sum(distance) - max(distance)))","code_v0_loc":28,"code_v1_loc":19,"code_v0_num_chars":561,"code_v1_num_chars":368,"code_v0_no_empty_lines":"first = eval(input())\nfirst = first.split()\nK = int(first[0])\nN = int(first[1])\nsecond = eval(input())\nsecond = second.split()\ndistance = []\ndiff = 0\nfor i in range(0, N):\n if i == N - 1:\n diff0 = 0\n diff1 = 0\n diff0 = int(second[0])\n diff1 = K - int(second[i])\n diff = diff0 + diff1\n distance.append(diff)\n else:\n diff = int(second[i + 1]) - int(second[i])\n distance.append(diff)\nMaxIndex = distance.index(max(distance))\ndistance.pop(MaxIndex)\nMax = sum(distance)\nprint(Max)\n","code_v1_no_empty_lines":"K, N = list(map(int, input().split()))\nA_list = list(map(int, input().split()))\ndistance = []\ndiff = 0\nfor i in range(0, N):\n if i == N - 1:\n diff = K + A_list[0] - A_list[i]\n distance.append(diff)\n else:\n diff = A_list[i + 1] - A_list[i]\n distance.append(diff)\nprint((sum(distance) - max(distance)))\n","code_same":false,"relative_loc_diff_percent":32.1428571429,"diff":["-first = eval(input())","-first = first.split()","-K = int(first[0])","-N = int(first[1])","-second = eval(input())","-second = second.split()","+K, N = list(map(int, input().split()))","+A_list = list(map(int, input().split()))","- diff0 = 0","- diff1 = 0","- diff0 = int(second[0])","- diff1 = K - int(second[i])","- diff = diff0 + diff1","+ diff = K + A_list[0] - A_list[i]","- diff = int(second[i + 1]) - int(second[i])","+ diff = A_list[i + 1] - A_list[i]","-MaxIndex = distance.index(max(distance))","-distance.pop(MaxIndex)","-Max = sum(distance)","-print(Max)","+print((sum(distance) - max(distance)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0378561561,"measured_runtime_v1":0.038524473,"runtime_lift":0.9826521481,"key":["s101050735","s817908948"]} +{"user_id":"u347640436","problem_id":"p02661","language":"python","submission_id_v0":"s881992644","submission_id_v1":"s833527265","cpu_time_v0":486,"cpu_time_v1":275,"memory_v0":25448,"memory_v1":25480,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.42,"input":"N = int(eval(input()))\n\nA = [None] * N\n\nB = [None] * N\n\nfor i in range(N):\n\n a, b = list(map(int, input().split()))\n\n A[i] = a\n\n B[i] = b\n\n\n\nA.sort()\n\nB.sort()\n\n\n\nif N % 2 == 0:\n\n b = (B[N \/\/ 2] + B[(N - 1) \/\/ 2]) \/ 2\n\n a = (A[N \/\/ 2] + A[(N - 1) \/\/ 2]) \/ 2\n\n print((int((b - a) * 2 + 1)))\n\nelse:\n\n print((B[N \/\/ 2] - A[N \/\/ 2] + 1))\n","target":"from sys import stdin\n\nreadline = stdin.readline\n\n\n\nN = int(readline())\n\nA = [None] * N\n\nB = [None] * N\n\nfor i in range(N):\n\n a, b = list(map(int, readline().split()))\n\n A[i] = a\n\n B[i] = b\n\n\n\nA.sort()\n\nB.sort()\n\n\n\nif N % 2 == 0:\n\n b = (B[N \/\/ 2] + B[(N - 1) \/\/ 2]) \/ 2\n\n a = (A[N \/\/ 2] + A[(N - 1) \/\/ 2]) \/ 2\n\n print((int((b - a) * 2 + 1)))\n\nelse:\n\n print((B[N \/\/ 2] - A[N \/\/ 2] + 1))\n","code_v0_loc":17,"code_v1_loc":20,"code_v0_num_chars":339,"code_v1_num_chars":397,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [None] * N\nB = [None] * N\nfor i in range(N):\n a, b = list(map(int, input().split()))\n A[i] = a\n B[i] = b\nA.sort()\nB.sort()\nif N % 2 == 0:\n b = (B[N \/\/ 2] + B[(N - 1) \/\/ 2]) \/ 2\n a = (A[N \/\/ 2] + A[(N - 1) \/\/ 2]) \/ 2\n print((int((b - a) * 2 + 1)))\nelse:\n print((B[N \/\/ 2] - A[N \/\/ 2] + 1))\n","code_v1_no_empty_lines":"from sys import stdin\n\nreadline = stdin.readline\nN = int(readline())\nA = [None] * N\nB = [None] * N\nfor i in range(N):\n a, b = list(map(int, readline().split()))\n A[i] = a\n B[i] = b\nA.sort()\nB.sort()\nif N % 2 == 0:\n b = (B[N \/\/ 2] + B[(N - 1) \/\/ 2]) \/ 2\n a = (A[N \/\/ 2] + A[(N - 1) \/\/ 2]) \/ 2\n print((int((b - a) * 2 + 1)))\nelse:\n print((B[N \/\/ 2] - A[N \/\/ 2] + 1))\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-N = int(eval(input()))","+from sys import stdin","+","+readline = stdin.readline","+N = int(readline())","- a, b = list(map(int, input().split()))","+ a, b = list(map(int, readline().split()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0372928334,"measured_runtime_v1":0.041973701,"runtime_lift":0.8884809419,"key":["s881992644","s833527265"]} +{"user_id":"u312025627","problem_id":"p02574","language":"python","submission_id_v0":"s125248347","submission_id_v1":"s457804405","cpu_time_v0":823,"cpu_time_v1":754,"memory_v0":210860,"memory_v1":209376,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.38,"input":"def main():\n\n from math import gcd\n\n MINFact = [-1] * (10**6 + 10)\n\n MINFact[0] = 0\n\n MINFact[1] = 1\n\n\n\n def Eratosthenes(sup: int) -> set:\n\n primes = [True for i in range(sup+1)]\n\n primes[0] = False\n\n primes[1] = False\n\n for i in range(2, sup+1):\n\n if primes[i]:\n\n MINFact[i] = i\n\n mul = 2\n\n while i*mul <= sup:\n\n primes[i*mul] = False\n\n if MINFact[i*mul] == -1:\n\n MINFact[i*mul] = i\n\n mul += 1\n\n\n\n def prime_factor(n):\n\n while n != 1:\n\n prime = MINFact[n]\n\n while MINFact[n] == prime:\n\n n \/\/= prime\n\n B[prime] += 1\n\n\n\n _ = int(eval(input()))\n\n A = [int(i) for i in input().split()]\n\n g = A[0]\n\n for a in A:\n\n g = gcd(g, a)\n\n Eratosthenes(10**6 + 5)\n\n B = [0]*(10**6 + 5)\n\n for a in A:\n\n prime_factor(a)\n\n # \u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u306e\u3092B\u306b\u3044\u308c\u308b\n\n # 1\u3088\u308a\u5927\u304d\u3044\u306e\u304c\u3042\u3063\u305f\u3089 gcd != 1 \u306e\u30da\u30a2\u304c\u5b58\u5728\u3059\u308b\n\n if g != 1:\n\n print(\"not coprime\")\n\n elif max(B) <= 1:\n\n print(\"pairwise coprime\")\n\n else:\n\n print(\"setwise coprime\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def main():\n\n from math import gcd\n\n _ = int(eval(input()))\n\n A = [int(i) for i in input().split()]\n\n\n\n class osa_k:\n\n def __init__(self, sup):\n\n if sup > 2 * 10**8:\n\n raise RuntimeError(\"too big\")\n\n self.MINFact = [-1] * (sup + 1)\n\n self.MINFact[0] = 0\n\n self.MINFact[1] = 1\n\n primes = [True for i in range(sup+1)]\n\n primes[0] = False\n\n primes[1] = False\n\n for i in range(2, sup+1):\n\n if primes[i]:\n\n self.MINFact[i] = i\n\n mul = 2\n\n while i*mul <= sup:\n\n primes[i*mul] = False\n\n if self.MINFact[i*mul] == -1:\n\n self.MINFact[i*mul] = i\n\n mul += 1\n\n\n\n def prime_factor(self, n, B):\n\n while n > 1:\n\n prime = self.MINFact[n]\n\n while self.MINFact[n] == prime:\n\n n \/\/= prime\n\n B[prime] += 1\n\n\n\n maxA = max(A)\n\n p = osa_k(maxA)\n\n B = [0] * (maxA + 1)\n\n for a in A:\n\n p.prime_factor(a, B)\n\n\n\n g = A[0]\n\n for a in A:\n\n g = gcd(g, a)\n\n\n\n if g != 1:\n\n print(\"not coprime\")\n\n elif max(B) <= 1:\n\n print(\"pairwise coprime\")\n\n else:\n\n print(\"setwise coprime\")\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":48,"code_v1_loc":52,"code_v0_num_chars":1224,"code_v1_num_chars":1418,"code_v0_no_empty_lines":"def main():\n from math import gcd\n\n MINFact = [-1] * (10**6 + 10)\n MINFact[0] = 0\n MINFact[1] = 1\n\n def Eratosthenes(sup: int) -> set:\n primes = [True for i in range(sup + 1)]\n primes[0] = False\n primes[1] = False\n for i in range(2, sup + 1):\n if primes[i]:\n MINFact[i] = i\n mul = 2\n while i * mul <= sup:\n primes[i * mul] = False\n if MINFact[i * mul] == -1:\n MINFact[i * mul] = i\n mul += 1\n\n def prime_factor(n):\n while n != 1:\n prime = MINFact[n]\n while MINFact[n] == prime:\n n \/\/= prime\n B[prime] += 1\n\n _ = int(eval(input()))\n A = [int(i) for i in input().split()]\n g = A[0]\n for a in A:\n g = gcd(g, a)\n Eratosthenes(10**6 + 5)\n B = [0] * (10**6 + 5)\n for a in A:\n prime_factor(a)\n # \u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u306e\u3092B\u306b\u3044\u308c\u308b\n # 1\u3088\u308a\u5927\u304d\u3044\u306e\u304c\u3042\u3063\u305f\u3089 gcd != 1 \u306e\u30da\u30a2\u304c\u5b58\u5728\u3059\u308b\n if g != 1:\n print(\"not coprime\")\n elif max(B) <= 1:\n print(\"pairwise coprime\")\n else:\n print(\"setwise coprime\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n from math import gcd\n\n _ = int(eval(input()))\n A = [int(i) for i in input().split()]\n\n class osa_k:\n def __init__(self, sup):\n if sup > 2 * 10**8:\n raise RuntimeError(\"too big\")\n self.MINFact = [-1] * (sup + 1)\n self.MINFact[0] = 0\n self.MINFact[1] = 1\n primes = [True for i in range(sup + 1)]\n primes[0] = False\n primes[1] = False\n for i in range(2, sup + 1):\n if primes[i]:\n self.MINFact[i] = i\n mul = 2\n while i * mul <= sup:\n primes[i * mul] = False\n if self.MINFact[i * mul] == -1:\n self.MINFact[i * mul] = i\n mul += 1\n\n def prime_factor(self, n, B):\n while n > 1:\n prime = self.MINFact[n]\n while self.MINFact[n] == prime:\n n \/\/= prime\n B[prime] += 1\n\n maxA = max(A)\n p = osa_k(maxA)\n B = [0] * (maxA + 1)\n for a in A:\n p.prime_factor(a, B)\n g = A[0]\n for a in A:\n g = gcd(g, a)\n if g != 1:\n print(\"not coprime\")\n elif max(B) <= 1:\n print(\"pairwise coprime\")\n else:\n print(\"setwise coprime\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["- MINFact = [-1] * (10**6 + 10)","- MINFact[0] = 0","- MINFact[1] = 1","-","- def Eratosthenes(sup: int) -> set:","- primes = [True for i in range(sup + 1)]","- primes[0] = False","- primes[1] = False","- for i in range(2, sup + 1):","- if primes[i]:","- MINFact[i] = i","- mul = 2","- while i * mul <= sup:","- primes[i * mul] = False","- if MINFact[i * mul] == -1:","- MINFact[i * mul] = i","- mul += 1","-","- def prime_factor(n):","- while n != 1:","- prime = MINFact[n]","- while MINFact[n] == prime:","- n \/\/= prime","- B[prime] += 1","-","+","+ class osa_k:","+ def __init__(self, sup):","+ if sup > 2 * 10**8:","+ raise RuntimeError(\"too big\")","+ self.MINFact = [-1] * (sup + 1)","+ self.MINFact[0] = 0","+ self.MINFact[1] = 1","+ primes = [True for i in range(sup + 1)]","+ primes[0] = False","+ primes[1] = False","+ for i in range(2, sup + 1):","+ if primes[i]:","+ self.MINFact[i] = i","+ mul = 2","+ while i * mul <= sup:","+ primes[i * mul] = False","+ if self.MINFact[i * mul] == -1:","+ self.MINFact[i * mul] = i","+ mul += 1","+","+ def prime_factor(self, n, B):","+ while n > 1:","+ prime = self.MINFact[n]","+ while self.MINFact[n] == prime:","+ n \/\/= prime","+ B[prime] += 1","+","+ maxA = max(A)","+ p = osa_k(maxA)","+ B = [0] * (maxA + 1)","+ for a in A:","+ p.prime_factor(a, B)","- Eratosthenes(10**6 + 5)","- B = [0] * (10**6 + 5)","- for a in A:","- prime_factor(a)","- # \u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u306e\u3092B\u306b\u3044\u308c\u308b","- # 1\u3088\u308a\u5927\u304d\u3044\u306e\u304c\u3042\u3063\u305f\u3089 gcd != 1 \u306e\u30da\u30a2\u304c\u5b58\u5728\u3059\u308b"],"diff_only_import_comment":false,"measured_runtime_v0":1.3450208416,"measured_runtime_v1":0.0379784999,"runtime_lift":35.415323016,"key":["s125248347","s457804405"]} +{"user_id":"u525065967","problem_id":"p02639","language":"python","submission_id_v0":"s949321239","submission_id_v1":"s475956274","cpu_time_v0":25,"cpu_time_v1":23,"memory_v0":9156,"memory_v1":8952,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.0,"input":"X = [*list(map(int, input().split()))]\n\nfor i in range(len(X)):\n\n if X[i] == 0: print((i+1))\n","target":"print((15 - sum([*list(map(int, input().split()))])))\n","code_v0_loc":3,"code_v1_loc":1,"code_v0_num_chars":88,"code_v1_num_chars":46,"code_v0_no_empty_lines":"X = [*list(map(int, input().split()))]\nfor i in range(len(X)):\n if X[i] == 0:\n print((i + 1))\n","code_v1_no_empty_lines":"print((15 - sum([*list(map(int, input().split()))])))\n","code_same":false,"relative_loc_diff_percent":66.6666666667,"diff":["-X = [*list(map(int, input().split()))]","-for i in range(len(X)):","- if X[i] == 0:","- print((i + 1))","+print((15 - sum([*list(map(int, input().split()))])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1916224957,"measured_runtime_v1":0.0788031101,"runtime_lift":2.4316615845,"key":["s949321239","s475956274"]} +{"user_id":"u699296734","problem_id":"p02725","language":"python","submission_id_v0":"s876140532","submission_id_v1":"s525198583","cpu_time_v0":213,"cpu_time_v1":144,"memory_v0":26444,"memory_v1":24908,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.39,"input":"k,n=list(map(int,input().split()))\n\na=[int(i) for i in input().split()]\n\narray=[]\n\nresult=a[n-1]-a[0]\n\narray.append(result)\n\nfor i in range(1,n):\n\n result=k+a[i-1]-a[i]\n\n array.append(result)\n\n#print(min(array))\n\n\n\n###################################\n\nlen_array=[]\n\nfor i in range(n):\n\n if i==n-1:\n\n length=a[0]-a[i]+k\n\n else:\n\n length=a[i+1]-a[i]\n\n len_array.append(length) \n\n# len_array.index(max(len_array))\n\nprint((sum(len_array)-max(len_array)))\n\n###################################","target":"k,n=list(map(int,input().split()))\n\na=[int(i) for i in input().split()]\n\nlen_array=[]\n\nfor i in range(n):\n\n if i==n-1:\n\n length=a[0]-a[i]+k\n\n else:\n\n length=a[i+1]-a[i]\n\n len_array.append(length) \n\nprint((sum(len_array)-max(len_array)))\n","code_v0_loc":21,"code_v1_loc":10,"code_v0_num_chars":509,"code_v1_num_chars":253,"code_v0_no_empty_lines":"k, n = list(map(int, input().split()))\na = [int(i) for i in input().split()]\narray = []\nresult = a[n - 1] - a[0]\narray.append(result)\nfor i in range(1, n):\n result = k + a[i - 1] - a[i]\n array.append(result)\n# print(min(array))\n###################################\nlen_array = []\nfor i in range(n):\n if i == n - 1:\n length = a[0] - a[i] + k\n else:\n length = a[i + 1] - a[i]\n len_array.append(length)\n# len_array.index(max(len_array))\nprint((sum(len_array) - max(len_array)))\n###################################\n","code_v1_no_empty_lines":"k, n = list(map(int, input().split()))\na = [int(i) for i in input().split()]\nlen_array = []\nfor i in range(n):\n if i == n - 1:\n length = a[0] - a[i] + k\n else:\n length = a[i + 1] - a[i]\n len_array.append(length)\nprint((sum(len_array) - max(len_array)))\n","code_same":false,"relative_loc_diff_percent":52.380952381,"diff":["-array = []","-result = a[n - 1] - a[0]","-array.append(result)","-for i in range(1, n):","- result = k + a[i - 1] - a[i]","- array.append(result)","-# print(min(array))","-###################################","-# len_array.index(max(len_array))","-###################################"],"diff_only_import_comment":false,"measured_runtime_v0":0.0845342482,"measured_runtime_v1":0.0834258734,"runtime_lift":1.0132857443,"key":["s876140532","s525198583"]} +{"user_id":"u094999522","problem_id":"p03821","language":"python","submission_id_v0":"s153255738","submission_id_v1":"s997303063","cpu_time_v0":173,"cpu_time_v1":147,"memory_v0":35148,"memory_v1":27688,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.03,"input":"#!\/usr\/bin\/env python3\n\n(n, ), *s = [[*list(map(int, i.split()))] for i in open(0)]\n\na, b = list(zip(*s))\n\nc = 0\n\nfor i in reversed(list(range(n))):\n\n q = (a[i] + c) % b[i]\n\n c += b[i] - q if q > 0 else 0\n\nprint(c)\n","target":"#!\/usr\/bin\/env python3\n\n(n, ), *s = [[*list(map(int, i.split()))] for i in open(0)]\n\nc = 0\n\nfor a, b in reversed(s):\n\n q = (a + c) % b\n\n c += b * (q > 0) - q\n\nprint(c)\n","code_v0_loc":8,"code_v1_loc":7,"code_v0_num_chars":209,"code_v1_num_chars":168,"code_v0_no_empty_lines":"#!\/usr\/bin\/env python3\n(n,), *s = [[*list(map(int, i.split()))] for i in open(0)]\na, b = list(zip(*s))\nc = 0\nfor i in reversed(list(range(n))):\n q = (a[i] + c) % b[i]\n c += b[i] - q if q > 0 else 0\nprint(c)\n","code_v1_no_empty_lines":"#!\/usr\/bin\/env python3\n(n,), *s = [[*list(map(int, i.split()))] for i in open(0)]\nc = 0\nfor a, b in reversed(s):\n q = (a + c) % b\n c += b * (q > 0) - q\nprint(c)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-a, b = list(zip(*s))","-for i in reversed(list(range(n))):","- q = (a[i] + c) % b[i]","- c += b[i] - q if q > 0 else 0","+for a, b in reversed(s):","+ q = (a + c) % b","+ c += b * (q > 0) - q"],"diff_only_import_comment":false,"measured_runtime_v0":0.0487370905,"measured_runtime_v1":0.0489775486,"runtime_lift":0.9950904423,"key":["s153255738","s997303063"]} +{"user_id":"u310678820","problem_id":"p03321","language":"python","submission_id_v0":"s464997460","submission_id_v1":"s748613111","cpu_time_v0":1732,"cpu_time_v1":544,"memory_v0":18928,"memory_v1":35952,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.59,"input":"from collections import defaultdict, deque\n\nimport sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int, input().split()))\n\nedges = [list(range(N)) for i in range(N)]\n\nfor i in range(N):\n\n edges[i].remove(i)\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n edges[a-1].remove(b-1)\n\n edges[b-1].remove(a-1)\n\nsize = defaultdict(lambda: [0, 0])\n\ncolor = [-1]*N\n\ndef set_color(root):\n\n \n\n que = deque([root])\n\n color[root] = 0\n\n size[root][0]+=1\n\n while que:\n\n v = que.pop()\n\n for nv in edges[v]:\n\n if color[nv]<0:\n\n c = 1- color[v]\n\n color[nv] = c\n\n size[root][c]+=1\n\n que.append(nv)\n\n elif color[nv] == color[v]:\n\n print((-1))\n\n sys.exit()\n\nfor i in range(N):\n\n if color[i]<0:\n\n set_color(i)\n\nS = set([0])\n\nfor a, b in list(size.values()):\n\n S = set(s+b for s in S)|set(s+a for s in S)\n\nans = min(x*(x-1)\/\/2+(N-x)*(N-x-1)\/\/2 for x in S) \n\nprint(ans) ","target":"from collections import defaultdict, deque\n\nimport sys\n\ninput = sys.stdin.readline\n\nN, M = list(map(int, input().split()))\n\nedges = [set(range(N)) for i in range(N)]\n\nfor i in range(N):\n\n edges[i].remove(i)\n\nfor _ in range(M):\n\n a, b = list(map(int, input().split()))\n\n edges[a-1].remove(b-1)\n\n edges[b-1].remove(a-1)\n\nsize = defaultdict(lambda: [0, 0])\n\ncolor = [-1]*N\n\ndef set_color(root):\n\n \n\n que = deque([root])\n\n color[root] = 0\n\n size[root][0]+=1\n\n while que:\n\n v = que.pop()\n\n for nv in edges[v]:\n\n if color[nv]<0:\n\n c = 1- color[v]\n\n color[nv] = c\n\n size[root][c]+=1\n\n que.append(nv)\n\n elif color[nv] == color[v]:\n\n print((-1))\n\n sys.exit()\n\nfor i in range(N):\n\n if color[i]<0:\n\n set_color(i)\n\nS = set([0])\n\nfor a, b in list(size.values()):\n\n S = set(s+b for s in S)|set(s+a for s in S)\n\nans = min(x*(x-1)\/\/2+(N-x)*(N-x-1)\/\/2 for x in S) \n\nprint(ans) ","code_v0_loc":37,"code_v1_loc":37,"code_v0_num_chars":1033,"code_v1_num_chars":1032,"code_v0_no_empty_lines":"from collections import defaultdict, deque\nimport sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nedges = [list(range(N)) for i in range(N)]\nfor i in range(N):\n edges[i].remove(i)\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n edges[a - 1].remove(b - 1)\n edges[b - 1].remove(a - 1)\nsize = defaultdict(lambda: [0, 0])\ncolor = [-1] * N\n\n\ndef set_color(root):\n que = deque([root])\n color[root] = 0\n size[root][0] += 1\n while que:\n v = que.pop()\n for nv in edges[v]:\n if color[nv] < 0:\n c = 1 - color[v]\n color[nv] = c\n size[root][c] += 1\n que.append(nv)\n elif color[nv] == color[v]:\n print((-1))\n sys.exit()\n\n\nfor i in range(N):\n if color[i] < 0:\n set_color(i)\nS = set([0])\nfor a, b in list(size.values()):\n S = set(s + b for s in S) | set(s + a for s in S)\nans = min(x * (x - 1) \/\/ 2 + (N - x) * (N - x - 1) \/\/ 2 for x in S)\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict, deque\nimport sys\n\ninput = sys.stdin.readline\nN, M = list(map(int, input().split()))\nedges = [set(range(N)) for i in range(N)]\nfor i in range(N):\n edges[i].remove(i)\nfor _ in range(M):\n a, b = list(map(int, input().split()))\n edges[a - 1].remove(b - 1)\n edges[b - 1].remove(a - 1)\nsize = defaultdict(lambda: [0, 0])\ncolor = [-1] * N\n\n\ndef set_color(root):\n que = deque([root])\n color[root] = 0\n size[root][0] += 1\n while que:\n v = que.pop()\n for nv in edges[v]:\n if color[nv] < 0:\n c = 1 - color[v]\n color[nv] = c\n size[root][c] += 1\n que.append(nv)\n elif color[nv] == color[v]:\n print((-1))\n sys.exit()\n\n\nfor i in range(N):\n if color[i] < 0:\n set_color(i)\nS = set([0])\nfor a, b in list(size.values()):\n S = set(s + b for s in S) | set(s + a for s in S)\nans = min(x * (x - 1) \/\/ 2 + (N - x) * (N - x - 1) \/\/ 2 for x in S)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-edges = [list(range(N)) for i in range(N)]","+edges = [set(range(N)) for i in range(N)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0879454827,"measured_runtime_v1":0.0455317941,"runtime_lift":1.9315180635,"key":["s464997460","s748613111"]} +{"user_id":"u332385682","problem_id":"p03822","language":"python","submission_id_v0":"s487264811","submission_id_v1":"s309195588","cpu_time_v0":1177,"cpu_time_v1":615,"memory_v0":234664,"memory_v1":144048,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.75,"input":"import sys\n\n\n\nlimit = 10 ** 5 * 2\n\nsys.setrecursionlimit(limit)\n\n\n\ndef calc_depth(n):\n\n if children[n] == set():\n\n return 0\n\n\n\n depth_l = [calc_depth(child) for child in children[n]]\n\n depth_l.sort(reverse=True)\n\n\n\n return max(depth + (i+1) for (i, depth) in enumerate(depth_l))\n\n\n\nN = int(eval(input()))\n\n\n\nchildren = [set() for i in range(N + 1)]\n\n\n\nfor i in range(N - 1):\n\n a = int(eval(input()))\n\n children[a].add(i + 2)\n\n\n\nans = calc_depth(1)\n\n\n\n# print(children)\n\n\n\nprint(ans)","target":"from sys import stdin, setrecursionlimit\n\n\n\nsetrecursionlimit(10**7)\n\n\n\ndef solve():\n\n N = int(stdin.readline())\n\n Adj = [[] for i in range(N)]\n\n\n\n for i in range(N - 1):\n\n a = int(stdin.readline()) - 1\n\n Adj[a].append(i + 1)\n\n\n\n ans = dfs(N, Adj, 0, -1)\n\n\n\n print(ans)\n\n\n\ndef dfs(N, Adj, v, p):\n\n dl = []\n\n\n\n for u in Adj[v]:\n\n if u == p:\n\n continue\n\n\n\n dl.append(dfs(N, Adj, u, v))\n\n\n\n dl.sort(reverse=True)\n\n\n\n if not dl:\n\n return 0\n\n\n\n res = max(dl[i] + i + 1 for i in range(len(dl)))\n\n\n\n return res\n\n\n\nif __name__ == '__main__':\n\n solve()","code_v0_loc":27,"code_v1_loc":36,"code_v0_num_chars":495,"code_v1_num_chars":625,"code_v0_no_empty_lines":"import sys\n\nlimit = 10**5 * 2\nsys.setrecursionlimit(limit)\n\n\ndef calc_depth(n):\n if children[n] == set():\n return 0\n depth_l = [calc_depth(child) for child in children[n]]\n depth_l.sort(reverse=True)\n return max(depth + (i + 1) for (i, depth) in enumerate(depth_l))\n\n\nN = int(eval(input()))\nchildren = [set() for i in range(N + 1)]\nfor i in range(N - 1):\n a = int(eval(input()))\n children[a].add(i + 2)\nans = calc_depth(1)\n# print(children)\nprint(ans)\n","code_v1_no_empty_lines":"from sys import stdin, setrecursionlimit\n\nsetrecursionlimit(10**7)\n\n\ndef solve():\n N = int(stdin.readline())\n Adj = [[] for i in range(N)]\n for i in range(N - 1):\n a = int(stdin.readline()) - 1\n Adj[a].append(i + 1)\n ans = dfs(N, Adj, 0, -1)\n print(ans)\n\n\ndef dfs(N, Adj, v, p):\n dl = []\n for u in Adj[v]:\n if u == p:\n continue\n dl.append(dfs(N, Adj, u, v))\n dl.sort(reverse=True)\n if not dl:\n return 0\n res = max(dl[i] + i + 1 for i in range(len(dl)))\n return res\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-import sys","+from sys import stdin, setrecursionlimit","-limit = 10**5 * 2","-sys.setrecursionlimit(limit)","+setrecursionlimit(10**7)","-def calc_depth(n):","- if children[n] == set():","- return 0","- depth_l = [calc_depth(child) for child in children[n]]","- depth_l.sort(reverse=True)","- return max(depth + (i + 1) for (i, depth) in enumerate(depth_l))","+def solve():","+ N = int(stdin.readline())","+ Adj = [[] for i in range(N)]","+ for i in range(N - 1):","+ a = int(stdin.readline()) - 1","+ Adj[a].append(i + 1)","+ ans = dfs(N, Adj, 0, -1)","+ print(ans)","-N = int(eval(input()))","-children = [set() for i in range(N + 1)]","-for i in range(N - 1):","- a = int(eval(input()))","- children[a].add(i + 2)","-ans = calc_depth(1)","-# print(children)","-print(ans)","+def dfs(N, Adj, v, p):","+ dl = []","+ for u in Adj[v]:","+ if u == p:","+ continue","+ dl.append(dfs(N, Adj, u, v))","+ dl.sort(reverse=True)","+ if not dl:","+ return 0","+ res = max(dl[i] + i + 1 for i in range(len(dl)))","+ return res","+","+","+if __name__ == \"__main__\":","+ solve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0415122159,"measured_runtime_v1":0.0356173494,"runtime_lift":1.1655054786,"key":["s487264811","s309195588"]} +{"user_id":"u847923740","problem_id":"p03160","language":"python","submission_id_v0":"s118349605","submission_id_v1":"s320370062","cpu_time_v0":138,"cpu_time_v1":91,"memory_v0":13976,"memory_v1":84980,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.06,"input":"n=int(eval(input()))\n\nh=list(map(int,input().split()))\n\ndp=[10**9]*n\n\n\n\ndp[0]=0\n\ndp[1]=h[1]-h[0]\n\nfor i in range(1,n):\n\n c1=abs(h[i]-h[i-1])\n\n c2=abs(h[i]-h[i-2])\n\n dp[i]=min(dp[i-1]+c1,dp[i-2]+c2)\n\n \n\nprint((dp[n-1]))","target":"N = int(eval(input()))\n\nH = list(map(int, input().split()))\n\n\n\ndp = [0] * N\n\ndp[1] = abs(H[1] - H[0])\n\n\n\nfor i in range(2, N):\n\n\tdp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))\n\nprint((dp[-1]))","code_v0_loc":12,"code_v1_loc":9,"code_v0_num_chars":222,"code_v1_num_chars":217,"code_v0_no_empty_lines":"n = int(eval(input()))\nh = list(map(int, input().split()))\ndp = [10**9] * n\ndp[0] = 0\ndp[1] = h[1] - h[0]\nfor i in range(1, n):\n c1 = abs(h[i] - h[i - 1])\n c2 = abs(h[i] - h[i - 2])\n dp[i] = min(dp[i - 1] + c1, dp[i - 2] + c2)\nprint((dp[n - 1]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\ndp = [0] * N\ndp[1] = abs(H[1] - H[0])\nfor i in range(2, N):\n dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-n = int(eval(input()))","-h = list(map(int, input().split()))","-dp = [10**9] * n","-dp[0] = 0","-dp[1] = h[1] - h[0]","-for i in range(1, n):","- c1 = abs(h[i] - h[i - 1])","- c2 = abs(h[i] - h[i - 2])","- dp[i] = min(dp[i - 1] + c1, dp[i - 2] + c2)","-print((dp[n - 1]))","+N = int(eval(input()))","+H = list(map(int, input().split()))","+dp = [0] * N","+dp[1] = abs(H[1] - H[0])","+for i in range(2, N):","+ dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))","+print((dp[-1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0479554877,"measured_runtime_v1":0.0466195991,"runtime_lift":1.0286550858,"key":["s118349605","s320370062"]} +{"user_id":"u367130284","problem_id":"p03127","language":"python","submission_id_v0":"s006963281","submission_id_v1":"s163078146","cpu_time_v0":98,"cpu_time_v1":78,"memory_v0":16280,"memory_v1":16144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.41,"input":"from fractions import gcd\n\nn=int(eval(input()))\n\na=list(map(int,input().split()))\n\nfor s in range(len(a)-1):\n\n if s==0:x=a[s]\n\n x=gcd(x,a[s+1])\n\nprint(x)","target":"from fractions import*\n\nfrom functools import*\n\nn,*a=list(map(int,open(0).read().split()))\n\nprint((reduce(gcd,a)))","code_v0_loc":7,"code_v1_loc":4,"code_v0_num_chars":149,"code_v1_num_chars":106,"code_v0_no_empty_lines":"from fractions import gcd\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nfor s in range(len(a) - 1):\n if s == 0:\n x = a[s]\n x = gcd(x, a[s + 1])\nprint(x)\n","code_v1_no_empty_lines":"from fractions import *\nfrom functools import *\n\nn, *a = list(map(int, open(0).read().split()))\nprint((reduce(gcd, a)))\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-from fractions import gcd","+from fractions import *","+from functools import *","-n = int(eval(input()))","-a = list(map(int, input().split()))","-for s in range(len(a) - 1):","- if s == 0:","- x = a[s]","- x = gcd(x, a[s + 1])","-print(x)","+n, *a = list(map(int, open(0).read().split()))","+print((reduce(gcd, a)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0469673314,"measured_runtime_v1":0.0543082709,"runtime_lift":0.8648283327,"key":["s006963281","s163078146"]} +{"user_id":"u936985471","problem_id":"p02923","language":"python","submission_id_v0":"s879539385","submission_id_v1":"s917983922","cpu_time_v0":102,"cpu_time_v1":75,"memory_v0":14224,"memory_v1":14252,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.47,"input":"n=int(eval(input()))\n\nh=list(map(int,input().split()))\n\nr=[None]*(n-1)\n\nfor i in range(n-1):\n\n if h[i]>=h[i+1]:\n\n r[i]=True\n\n else:\n\n r[i]=False\n\n\n\nm=0\n\ncount=0\n\nfor i in range(len(r)):\n\n if r[i]:\n\n count=count+1\n\n m=max(m,count)\n\n else:\n\n count=0\n\n\n\nprint(m)","target":"N=int(eval(input()))\n\nH=list(map(int,input().split()))\n\ncur=H[0]\n\nstreak=0\n\nans=0\n\nfor i in range(1,N):\n\n if H[i]<=cur:\n\n streak+=1\n\n if ans= h[i + 1]:\n r[i] = True\n else:\n r[i] = False\nm = 0\ncount = 0\nfor i in range(len(r)):\n if r[i]:\n count = count + 1\n m = max(m, count)\n else:\n count = 0\nprint(m)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\ncur = H[0]\nstreak = 0\nans = 0\nfor i in range(1, N):\n if H[i] <= cur:\n streak += 1\n if ans < streak:\n ans = streak\n else:\n streak = 0\n cur = H[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.0526315789,"diff":["-n = int(eval(input()))","-h = list(map(int, input().split()))","-r = [None] * (n - 1)","-for i in range(n - 1):","- if h[i] >= h[i + 1]:","- r[i] = True","+N = int(eval(input()))","+H = list(map(int, input().split()))","+cur = H[0]","+streak = 0","+ans = 0","+for i in range(1, N):","+ if H[i] <= cur:","+ streak += 1","+ if ans < streak:","+ ans = streak","- r[i] = False","-m = 0","-count = 0","-for i in range(len(r)):","- if r[i]:","- count = count + 1","- m = max(m, count)","- else:","- count = 0","-print(m)","+ streak = 0","+ cur = H[i]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0361131687,"measured_runtime_v1":0.0819922962,"runtime_lift":0.4404458757,"key":["s879539385","s917983922"]} +{"user_id":"u838644735","problem_id":"p02714","language":"python","submission_id_v0":"s829987802","submission_id_v1":"s859005661","cpu_time_v0":763,"cpu_time_v1":117,"memory_v0":9320,"memory_v1":69176,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":84.67,"input":"def calc(i, j, B1, len_b):\n\n extra = 0\n\n d = j - i\n\n\n\n # i < j < k\n\n k1 = d + j\n\n if k1 < len_b:\n\n extra += B1[k1]\n\n\n\n # k < i < j\n\n k2 = i - d\n\n if 0 <= k2 and k2 < len_b:\n\n extra += B1[k2]\n\n\n\n # i < k < j\n\n s = i + j\n\n if s % 2 == 0:\n\n k3 = s \/\/ 2\n\n if k3 < len_b:\n\n extra += B1[k3]\n\n return extra\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n S = eval(input())\n\n R, G, B = [], [], []\n\n num_r, num_g, num_b = 0, 0, 0\n\n for i in range(N):\n\n s = S[i]\n\n if s == 'R':\n\n R.append(i)\n\n num_r += 1\n\n elif s == 'G':\n\n G.append(i)\n\n num_g += 1\n\n elif s == 'B':\n\n B.append(i)\n\n num_b += 1\n\n if len(R) == 0 or len(G) == 0 or len(B) == 0:\n\n print((0))\n\n return\n\n len_b = (B[-1] + 1)\n\n B1 = [0]*len_b\n\n for b in B:\n\n B1[b] = 1\n\n # print(R, G, B)\n\n ans = 0\n\n for i in R:\n\n for j in G:\n\n ans += num_b\n\n if i < j:\n\n ans -= calc(i, j, B1, len_b)\n\n else:\n\n ans -= calc(j, i, B1, len_b)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"def calc(i, j, B1, len_b):\n\n extra = 0\n\n d = j - i\n\n\n\n # i < j < k\n\n k1 = d + j\n\n if k1 < len_b:\n\n extra += B1[k1]\n\n\n\n # k < i < j\n\n k2 = i - d\n\n if 0 <= k2 and k2 < len_b:\n\n extra += B1[k2]\n\n\n\n # i < k < j\n\n s = i + j\n\n if s % 2 == 0:\n\n k3 = s \/\/ 2\n\n if k3 < len_b:\n\n extra += B1[k3]\n\n return extra\n\n\n\ndef main():\n\n N = int(eval(input()))\n\n S = eval(input())\n\n RGB = {'R': [], 'G': [], 'B': []}\n\n for i in range(N):\n\n RGB[S[i]].append(i)\n\n num_r = len(RGB['R'])\n\n num_g = len(RGB['G'])\n\n num_b = len(RGB['B'])\n\n if num_r == 0 or num_g == 0 or num_b == 0:\n\n print((0))\n\n return\n\n\n\n len_b = (RGB['B'][-1] + 1)\n\n B1 = [0]*len_b\n\n for b in RGB['B']:\n\n B1[b] = 1\n\n # print(R, G, B)\n\n ans = num_r * num_g * num_b\n\n for i in RGB['R']:\n\n for j in RGB['G']:\n\n ans -= calc(min(i, j), max(i, j), B1, len_b)\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":58,"code_v1_loc":48,"code_v0_num_chars":1206,"code_v1_num_chars":1004,"code_v0_no_empty_lines":"def calc(i, j, B1, len_b):\n extra = 0\n d = j - i\n # i < j < k\n k1 = d + j\n if k1 < len_b:\n extra += B1[k1]\n # k < i < j\n k2 = i - d\n if 0 <= k2 and k2 < len_b:\n extra += B1[k2]\n # i < k < j\n s = i + j\n if s % 2 == 0:\n k3 = s \/\/ 2\n if k3 < len_b:\n extra += B1[k3]\n return extra\n\n\ndef main():\n N = int(eval(input()))\n S = eval(input())\n R, G, B = [], [], []\n num_r, num_g, num_b = 0, 0, 0\n for i in range(N):\n s = S[i]\n if s == \"R\":\n R.append(i)\n num_r += 1\n elif s == \"G\":\n G.append(i)\n num_g += 1\n elif s == \"B\":\n B.append(i)\n num_b += 1\n if len(R) == 0 or len(G) == 0 or len(B) == 0:\n print((0))\n return\n len_b = B[-1] + 1\n B1 = [0] * len_b\n for b in B:\n B1[b] = 1\n # print(R, G, B)\n ans = 0\n for i in R:\n for j in G:\n ans += num_b\n if i < j:\n ans -= calc(i, j, B1, len_b)\n else:\n ans -= calc(j, i, B1, len_b)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def calc(i, j, B1, len_b):\n extra = 0\n d = j - i\n # i < j < k\n k1 = d + j\n if k1 < len_b:\n extra += B1[k1]\n # k < i < j\n k2 = i - d\n if 0 <= k2 and k2 < len_b:\n extra += B1[k2]\n # i < k < j\n s = i + j\n if s % 2 == 0:\n k3 = s \/\/ 2\n if k3 < len_b:\n extra += B1[k3]\n return extra\n\n\ndef main():\n N = int(eval(input()))\n S = eval(input())\n RGB = {\"R\": [], \"G\": [], \"B\": []}\n for i in range(N):\n RGB[S[i]].append(i)\n num_r = len(RGB[\"R\"])\n num_g = len(RGB[\"G\"])\n num_b = len(RGB[\"B\"])\n if num_r == 0 or num_g == 0 or num_b == 0:\n print((0))\n return\n len_b = RGB[\"B\"][-1] + 1\n B1 = [0] * len_b\n for b in RGB[\"B\"]:\n B1[b] = 1\n # print(R, G, B)\n ans = num_r * num_g * num_b\n for i in RGB[\"R\"]:\n for j in RGB[\"G\"]:\n ans -= calc(min(i, j), max(i, j), B1, len_b)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":17.2413793103,"diff":["- R, G, B = [], [], []","- num_r, num_g, num_b = 0, 0, 0","+ RGB = {\"R\": [], \"G\": [], \"B\": []}","- s = S[i]","- if s == \"R\":","- R.append(i)","- num_r += 1","- elif s == \"G\":","- G.append(i)","- num_g += 1","- elif s == \"B\":","- B.append(i)","- num_b += 1","- if len(R) == 0 or len(G) == 0 or len(B) == 0:","+ RGB[S[i]].append(i)","+ num_r = len(RGB[\"R\"])","+ num_g = len(RGB[\"G\"])","+ num_b = len(RGB[\"B\"])","+ if num_r == 0 or num_g == 0 or num_b == 0:","- len_b = B[-1] + 1","+ len_b = RGB[\"B\"][-1] + 1","- for b in B:","+ for b in RGB[\"B\"]:","- ans = 0","- for i in R:","- for j in G:","- ans += num_b","- if i < j:","- ans -= calc(i, j, B1, len_b)","- else:","- ans -= calc(j, i, B1, len_b)","+ ans = num_r * num_g * num_b","+ for i in RGB[\"R\"]:","+ for j in RGB[\"G\"]:","+ ans -= calc(min(i, j), max(i, j), B1, len_b)"],"diff_only_import_comment":false,"measured_runtime_v0":0.046756224,"measured_runtime_v1":0.0410166899,"runtime_lift":1.1399316753,"key":["s829987802","s859005661"]} +{"user_id":"u620480037","problem_id":"p02861","language":"python","submission_id_v0":"s546247432","submission_id_v1":"s375911235","cpu_time_v0":170,"cpu_time_v1":63,"memory_v0":38384,"memory_v1":62248,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":62.94,"input":"N=int(eval(input()))\n\nL=[]\n\nfor i in range(N):\n\n x,y=list(map(int,input().split()))\n\n L.append([x,y])\n\n \n\ncnt=0\n\nS=0\n\nfor i in range(N-1):\n\n for j in range(i+1,N):\n\n cnt+=1\n\n S+=((L[i][0]-L[j][0])**2+(L[i][1]-L[j][1])**2)**0.5\n\nAVE=S\/cnt\n\nprint((AVE*(N-1)))\n\n ","target":"N=int(eval(input()))\n\nL=[]\n\nfor i in range(N):\n\n x,y=list(map(int,input().split()))\n\n L.append([x,y])\n\nD=[]\n\nfor i in range(N-1):\n\n for j in range(i+1,N):\n\n d=((L[i][0]-L[j][0])**2+(L[i][1]-L[j][1])**2)**0.5\n\n D.append(d)\n\nAve=sum(D)\/len(D)\n\nprint((Ave*(N-1)))","code_v0_loc":15,"code_v1_loc":12,"code_v0_num_chars":279,"code_v1_num_chars":275,"code_v0_no_empty_lines":"N = int(eval(input()))\nL = []\nfor i in range(N):\n x, y = list(map(int, input().split()))\n L.append([x, y])\ncnt = 0\nS = 0\nfor i in range(N - 1):\n for j in range(i + 1, N):\n cnt += 1\n S += ((L[i][0] - L[j][0]) ** 2 + (L[i][1] - L[j][1]) ** 2) ** 0.5\nAVE = S \/ cnt\nprint((AVE * (N - 1)))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nL = []\nfor i in range(N):\n x, y = list(map(int, input().split()))\n L.append([x, y])\nD = []\nfor i in range(N - 1):\n for j in range(i + 1, N):\n d = ((L[i][0] - L[j][0]) ** 2 + (L[i][1] - L[j][1]) ** 2) ** 0.5\n D.append(d)\nAve = sum(D) \/ len(D)\nprint((Ave * (N - 1)))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-cnt = 0","-S = 0","+D = []","- cnt += 1","- S += ((L[i][0] - L[j][0]) ** 2 + (L[i][1] - L[j][1]) ** 2) ** 0.5","-AVE = S \/ cnt","-print((AVE * (N - 1)))","+ d = ((L[i][0] - L[j][0]) ** 2 + (L[i][1] - L[j][1]) ** 2) ** 0.5","+ D.append(d)","+Ave = sum(D) \/ len(D)","+print((Ave * (N - 1)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0393034458,"measured_runtime_v1":0.0777720928,"runtime_lift":0.505366956,"key":["s546247432","s375911235"]} +{"user_id":"u111473084","problem_id":"p02773","language":"python","submission_id_v0":"s107764454","submission_id_v1":"s767967098","cpu_time_v0":878,"cpu_time_v1":812,"memory_v0":33416,"memory_v1":32096,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.52,"input":"n = int(eval(input()))\n\n\n\ndata = {}\n\nnames = []\n\nmax_poll = 1\n\n\n\nfor i in range(n):\n\n s = eval(input())\n\n try:\n\n data[s] += 1\n\n except:\n\n data[s] = 1\n\n names.append(s)\n\n if max_poll < data[s]:\n\n max_poll = data[s]\n\n\n\nwinner = []\n\nfor key, value in list(data.items()):\n\n if max_poll == value:\n\n winner.append(key)\n\n\n\nwinner.sort()\n\nfor i in winner:\n\n print(i)","target":"n = int(eval(input()))\n\ndata = {}\n\nmax_poll = 1\n\n\n\nfor i in range(n):\n\n s = eval(input())\n\n try:\n\n data[s] += 1\n\n except:\n\n data[s] = 1\n\n if max_poll < data[s]:\n\n max_poll = data[s]\n\n\n\nwinner = []\n\nfor key, value in list(data.items()):\n\n if max_poll == value:\n\n winner.append(key)\n\n\n\nwinner.sort()\n\nfor i in winner:\n\n print(i)\n","code_v0_loc":24,"code_v1_loc":21,"code_v0_num_chars":393,"code_v1_num_chars":355,"code_v0_no_empty_lines":"n = int(eval(input()))\ndata = {}\nnames = []\nmax_poll = 1\nfor i in range(n):\n s = eval(input())\n try:\n data[s] += 1\n except:\n data[s] = 1\n names.append(s)\n if max_poll < data[s]:\n max_poll = data[s]\nwinner = []\nfor key, value in list(data.items()):\n if max_poll == value:\n winner.append(key)\nwinner.sort()\nfor i in winner:\n print(i)\n","code_v1_no_empty_lines":"n = int(eval(input()))\ndata = {}\nmax_poll = 1\nfor i in range(n):\n s = eval(input())\n try:\n data[s] += 1\n except:\n data[s] = 1\n if max_poll < data[s]:\n max_poll = data[s]\nwinner = []\nfor key, value in list(data.items()):\n if max_poll == value:\n winner.append(key)\nwinner.sort()\nfor i in winner:\n print(i)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["-names = []","- names.append(s)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0420204852,"measured_runtime_v1":0.0420857761,"runtime_lift":0.9984486222,"key":["s107764454","s767967098"]} +{"user_id":"u875291233","problem_id":"p03946","language":"python","submission_id_v0":"s923568686","submission_id_v1":"s457749922","cpu_time_v0":136,"cpu_time_v1":120,"memory_v0":14260,"memory_v1":14512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":11.76,"input":"# coding: utf-8\n\n# Your code here!\n\n\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nreadline = sys.stdin.readline\n\n \n\n#n = int(input())\n\nn,t = [int(i) for i in readline().split()]\n\na = [10**9+1]+[int(i) for i in readline().split()]\n\n\n\n\n\n\"\"\"\n\ngain = 0\n\nm = 0\n\nmaxid = []\n\nminid = []\n\nmemo = {}\n\nfor i in range(n-1,-1,-1):\n\n ai = a[i]\n\n if ai > m:\n\n m = ai\n\n maxid = [i]\n\n memo.append([minid[:],maxid[:]])\n\n elif ai == m:\n\n maxid.append[i]\n\n\n\n m = max(ai,m)\n\n if gain < m-ai:\n\n gain = m-ai\n\n minid = [i]\n\n memo = []\n\n elif gain == m-ai:\n\n minid.append(i)\n\n \n\n print(minid,maxid,memo)\n\n\"\"\" \n\n\n\ngain = 0\n\nm = 0\n\nfor ai in reversed(a):\n\n m = max(ai,m)\n\n if gain < m-ai: gain = m-ai\n\n\n\nm = 0\n\nmi = ma = 0\n\n\n\nans = 0\n\nfor ai in reversed(a):\n\n if m < ai:\n\n ans += max(mi,ma)\n\n mi = ma = 0\n\n elif m == ai:\n\n ma += 1\n\n\n\n m = max(m,ai)\n\n \n\n if m-ai == gain:\n\n mi += 1\n\n\n\n\n\nprint(ans) \n\n\n\n\n\n\n\n\n","target":"# coding: utf-8\n\n# Your code here!\n\n\n\nimport sys\n\nsys.setrecursionlimit(10**6)\n\nreadline = sys.stdin.readline\n\n \n\n#n = int(input())\n\nn,t = [int(i) for i in readline().split()]\n\na = [int(i) for i in readline().split()]\n\n\n\nm = gain = 0\n\nans = 0\n\nfor ai in reversed(a):\n\n m = max(ai,m)\n\n if gain < m-ai:\n\n ans = 1\n\n elif gain == m-ai:\n\n ans += 1\n\n gain = max(gain,m-ai)\n\n\n\nprint(ans) \n\n\n\n\n\n\n\n\n","code_v0_loc":66,"code_v1_loc":26,"code_v0_num_chars":1013,"code_v1_num_chars":419,"code_v0_no_empty_lines":"# coding: utf-8\n# Your code here!\nimport sys\n\nsys.setrecursionlimit(10**6)\nreadline = sys.stdin.readline\n# n = int(input())\nn, t = [int(i) for i in readline().split()]\na = [10**9 + 1] + [int(i) for i in readline().split()]\n\"\"\"\ngain = 0\nm = 0\nmaxid = []\nminid = []\nmemo = {}\nfor i in range(n-1,-1,-1):\n ai = a[i]\n if ai > m:\n m = ai\n maxid = [i]\n memo.append([minid[:],maxid[:]])\n elif ai == m:\n maxid.append[i]\n m = max(ai,m)\n if gain < m-ai:\n gain = m-ai\n minid = [i]\n memo = []\n elif gain == m-ai:\n minid.append(i)\n print(minid,maxid,memo)\n\"\"\"\ngain = 0\nm = 0\nfor ai in reversed(a):\n m = max(ai, m)\n if gain < m - ai:\n gain = m - ai\nm = 0\nmi = ma = 0\nans = 0\nfor ai in reversed(a):\n if m < ai:\n ans += max(mi, ma)\n mi = ma = 0\n elif m == ai:\n ma += 1\n m = max(m, ai)\n if m - ai == gain:\n mi += 1\nprint(ans)\n","code_v1_no_empty_lines":"# coding: utf-8\n# Your code here!\nimport sys\n\nsys.setrecursionlimit(10**6)\nreadline = sys.stdin.readline\n# n = int(input())\nn, t = [int(i) for i in readline().split()]\na = [int(i) for i in readline().split()]\nm = gain = 0\nans = 0\nfor ai in reversed(a):\n m = max(ai, m)\n if gain < m - ai:\n ans = 1\n elif gain == m - ai:\n ans += 1\n gain = max(gain, m - ai)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":60.6060606061,"diff":["-a = [10**9 + 1] + [int(i) for i in readline().split()]","-\"\"\"","-gain = 0","-m = 0","-maxid = []","-minid = []","-memo = {}","-for i in range(n-1,-1,-1):","- ai = a[i]","- if ai > m:","- m = ai","- maxid = [i]","- memo.append([minid[:],maxid[:]])","- elif ai == m:","- maxid.append[i]","- m = max(ai,m)","- if gain < m-ai:","- gain = m-ai","- minid = [i]","- memo = []","- elif gain == m-ai:","- minid.append(i)","- print(minid,maxid,memo)","-\"\"\"","-gain = 0","-m = 0","+a = [int(i) for i in readline().split()]","+m = gain = 0","+ans = 0","- gain = m - ai","-m = 0","-mi = ma = 0","-ans = 0","-for ai in reversed(a):","- if m < ai:","- ans += max(mi, ma)","- mi = ma = 0","- elif m == ai:","- ma += 1","- m = max(m, ai)","- if m - ai == gain:","- mi += 1","+ ans = 1","+ elif gain == m - ai:","+ ans += 1","+ gain = max(gain, m - ai)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0381071568,"measured_runtime_v1":0.041883564,"runtime_lift":0.9098355801,"key":["s923568686","s457749922"]} +{"user_id":"u260216890","problem_id":"p02719","language":"python","submission_id_v0":"s983438438","submission_id_v1":"s260641811","cpu_time_v0":171,"cpu_time_v1":69,"memory_v0":38256,"memory_v1":61744,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.65,"input":"n,k=list(map(int, input().split()))\n\na=n\/\/k\n\nprint((min(abs(n-k*a), abs(n-k*(a+1)))))","target":"n,k=list(map(int,input().split()))\n\nprint((min(n%k, k-n%k)))","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":77,"code_v1_num_chars":52,"code_v0_no_empty_lines":"n, k = list(map(int, input().split()))\na = n \/\/ k\nprint((min(abs(n - k * a), abs(n - k * (a + 1)))))\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nprint((min(n % k, k - n % k)))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-a = n \/\/ k","-print((min(abs(n - k * a), abs(n - k * (a + 1)))))","+print((min(n % k, k - n % k)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369872134,"measured_runtime_v1":0.0437959156,"runtime_lift":0.84453568,"key":["s983438438","s260641811"]} +{"user_id":"u392319141","problem_id":"p02780","language":"python","submission_id_v0":"s453277578","submission_id_v1":"s364558375","cpu_time_v0":247,"cpu_time_v1":188,"memory_v0":24804,"memory_v1":25060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.89,"input":"N, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nP = pow(1 \/ 6, K)\n\n\n\nnow = sum([a * (a + 1) \/\/ 2 \/ a for a in A[:K - 1]])\n\nans = 0\n\nfor left, right in zip(A, A[K - 1:]):\n\n now += right * (right + 1) \/\/ 2 \/ right\n\n ans = max(ans, now)\n\n now -= left * (left + 1) \/\/ 2 \/ left\n\n\n\nprint(('{:.10f}'.format(ans)))\n","target":"N, K = list(map(int, input().split()))\n\nP = list(map(int, input().split()))\n\n\n\nQ = [(p + 1) \/ 2 for p in P]\n\nnow = sum(Q[:K])\n\nans = now\n\nfor i in range(N - K):\n\n now -= Q[i]\n\n now += Q[i + K]\n\n ans = max(ans, now)\n\nprint(ans)","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":342,"code_v1_num_chars":229,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nP = pow(1 \/ 6, K)\nnow = sum([a * (a + 1) \/\/ 2 \/ a for a in A[: K - 1]])\nans = 0\nfor left, right in zip(A, A[K - 1 :]):\n now += right * (right + 1) \/\/ 2 \/ right\n ans = max(ans, now)\n now -= left * (left + 1) \/\/ 2 \/ left\nprint((\"{:.10f}\".format(ans)))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nP = list(map(int, input().split()))\nQ = [(p + 1) \/ 2 for p in P]\nnow = sum(Q[:K])\nans = now\nfor i in range(N - K):\n now -= Q[i]\n now += Q[i + K]\n ans = max(ans, now)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-A = list(map(int, input().split()))","-P = pow(1 \/ 6, K)","-now = sum([a * (a + 1) \/\/ 2 \/ a for a in A[: K - 1]])","-ans = 0","-for left, right in zip(A, A[K - 1 :]):","- now += right * (right + 1) \/\/ 2 \/ right","+P = list(map(int, input().split()))","+Q = [(p + 1) \/ 2 for p in P]","+now = sum(Q[:K])","+ans = now","+for i in range(N - K):","+ now -= Q[i]","+ now += Q[i + K]","- now -= left * (left + 1) \/\/ 2 \/ left","-print((\"{:.10f}\".format(ans)))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.138576431,"measured_runtime_v1":0.0391545577,"runtime_lift":3.5392158442,"key":["s453277578","s364558375"]} +{"user_id":"u863442865","problem_id":"p02936","language":"python","submission_id_v0":"s117321705","submission_id_v1":"s173771624","cpu_time_v0":1303,"cpu_time_v1":982,"memory_v0":80540,"memory_v1":80544,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.64,"input":"import sys\n\nsys.setrecursionlimit(500000)\n\ninput = sys.stdin.readline\n\n\n\nN, Q = list(map(int, input().split()))\n\nG = [set() for _ in range(N)]\n\ncnt = [0]*N\n\nvisited = [0]*N\n\n\n\nfor _ in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n G[a].add(b)\n\n G[b].add(a)\n\n\n\nfor i in range(Q):\n\n it = list(map(int, input().split()))\n\n p = next(it) - 1\n\n x = next(it)\n\n cnt[p] += x\n\n\n\nvisited[0]=1\n\nst = [0]\n\nwhile st:\n\n v = st.pop()\n\n for u in G[v]:\n\n if visited[u]:\n\n continue\n\n visited[u] = 1\n\n cnt[u] += cnt[v]\n\n st.append(u) \n\n\n\nprint((*cnt))\n","target":"def main():\n\n import sys\n\n sys.setrecursionlimit(500000)\n\n input = sys.stdin.readline\n\n\n\n N, Q = list(map(int, input().split()))\n\n G = [set() for _ in range(N)]\n\n cnt = [0]*N\n\n visited = [0]*N\n\n\n\n for _ in range(N-1):\n\n a, b = list(map(int, input().split()))\n\n a -= 1\n\n b -= 1\n\n G[a].add(b)\n\n G[b].add(a)\n\n\n\n for i in range(Q):\n\n node, x = list(map(int, input().split()))\n\n node -= 1\n\n cnt[node] += x\n\n\n\n visited[0]=1\n\n st = [0]\n\n while st:\n\n v = st.pop()\n\n for u in G[v]:\n\n if visited[u]:\n\n continue\n\n visited[u] = 1\n\n cnt[u] += cnt[v]\n\n st.append(u) \n\n\n\n print((*cnt))\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":34,"code_v1_loc":36,"code_v0_num_chars":614,"code_v1_num_chars":705,"code_v0_no_empty_lines":"import sys\n\nsys.setrecursionlimit(500000)\ninput = sys.stdin.readline\nN, Q = list(map(int, input().split()))\nG = [set() for _ in range(N)]\ncnt = [0] * N\nvisited = [0] * N\nfor _ in range(N - 1):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n G[a].add(b)\n G[b].add(a)\nfor i in range(Q):\n it = list(map(int, input().split()))\n p = next(it) - 1\n x = next(it)\n cnt[p] += x\nvisited[0] = 1\nst = [0]\nwhile st:\n v = st.pop()\n for u in G[v]:\n if visited[u]:\n continue\n visited[u] = 1\n cnt[u] += cnt[v]\n st.append(u)\nprint((*cnt))\n","code_v1_no_empty_lines":"def main():\n import sys\n\n sys.setrecursionlimit(500000)\n input = sys.stdin.readline\n N, Q = list(map(int, input().split()))\n G = [set() for _ in range(N)]\n cnt = [0] * N\n visited = [0] * N\n for _ in range(N - 1):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n G[a].add(b)\n G[b].add(a)\n for i in range(Q):\n node, x = list(map(int, input().split()))\n node -= 1\n cnt[node] += x\n visited[0] = 1\n st = [0]\n while st:\n v = st.pop()\n for u in G[v]:\n if visited[u]:\n continue\n visited[u] = 1\n cnt[u] += cnt[v]\n st.append(u)\n print((*cnt))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":5.5555555556,"diff":["-import sys","+def main():","+ import sys","-sys.setrecursionlimit(500000)","-input = sys.stdin.readline","-N, Q = list(map(int, input().split()))","-G = [set() for _ in range(N)]","-cnt = [0] * N","-visited = [0] * N","-for _ in range(N - 1):","- a, b = list(map(int, input().split()))","- a -= 1","- b -= 1","- G[a].add(b)","- G[b].add(a)","-for i in range(Q):","- it = list(map(int, input().split()))","- p = next(it) - 1","- x = next(it)","- cnt[p] += x","-visited[0] = 1","-st = [0]","-while st:","- v = st.pop()","- for u in G[v]:","- if visited[u]:","- continue","- visited[u] = 1","- cnt[u] += cnt[v]","- st.append(u)","-print((*cnt))","+ sys.setrecursionlimit(500000)","+ input = sys.stdin.readline","+ N, Q = list(map(int, input().split()))","+ G = [set() for _ in range(N)]","+ cnt = [0] * N","+ visited = [0] * N","+ for _ in range(N - 1):","+ a, b = list(map(int, input().split()))","+ a -= 1","+ b -= 1","+ G[a].add(b)","+ G[b].add(a)","+ for i in range(Q):","+ node, x = list(map(int, input().split()))","+ node -= 1","+ cnt[node] += x","+ visited[0] = 1","+ st = [0]","+ while st:","+ v = st.pop()","+ for u in G[v]:","+ if visited[u]:","+ continue","+ visited[u] = 1","+ cnt[u] += cnt[v]","+ st.append(u)","+ print((*cnt))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0384439486,"measured_runtime_v1":0.0715621161,"runtime_lift":0.5372108967,"key":["s117321705","s173771624"]} +{"user_id":"u977389981","problem_id":"p03425","language":"python","submission_id_v0":"s915858415","submission_id_v1":"s334860213","cpu_time_v0":174,"cpu_time_v1":140,"memory_v0":3060,"memory_v1":4224,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.54,"input":"n = int(eval(input()))\n\nS = ''\n\n\n\nfor i in range(n):\n\n S += input()[0]\n\n \n\nm = S.count('M')\n\na = S.count('A')\n\nr = S.count('R')\n\nc = S.count('C')\n\nh = S.count('H')\n\n\n\nprint((m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h))","target":"from collections import Counter\n\nn = int(eval(input()))\n\nA = [input()[0] for i in range(n)]\n\n\n\nA = Counter(A)\n\nm = A['M']\n\na = A['A']\n\nr = A['R']\n\nc = A['C']\n\nh = A['H']\n\n\n\nprint((m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h))","code_v0_loc":13,"code_v1_loc":12,"code_v0_num_chars":251,"code_v1_num_chars":251,"code_v0_no_empty_lines":"n = int(eval(input()))\nS = \"\"\nfor i in range(n):\n S += input()[0]\nm = S.count(\"M\")\na = S.count(\"A\")\nr = S.count(\"R\")\nc = S.count(\"C\")\nh = S.count(\"H\")\nprint(\n (\n m * a * r\n + m * a * c\n + m * a * h\n + m * r * c\n + m * r * h\n + m * c * h\n + a * r * c\n + a * r * h\n + a * c * h\n + r * c * h\n )\n)\n","code_v1_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\nA = [input()[0] for i in range(n)]\nA = Counter(A)\nm = A[\"M\"]\na = A[\"A\"]\nr = A[\"R\"]\nc = A[\"C\"]\nh = A[\"H\"]\nprint(\n (\n m * a * r\n + m * a * c\n + m * a * h\n + m * r * c\n + m * r * h\n + m * c * h\n + a * r * c\n + a * r * h\n + a * c * h\n + r * c * h\n )\n)\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["+from collections import Counter","+","-S = \"\"","-for i in range(n):","- S += input()[0]","-m = S.count(\"M\")","-a = S.count(\"A\")","-r = S.count(\"R\")","-c = S.count(\"C\")","-h = S.count(\"H\")","+A = [input()[0] for i in range(n)]","+A = Counter(A)","+m = A[\"M\"]","+a = A[\"A\"]","+r = A[\"R\"]","+c = A[\"C\"]","+h = A[\"H\"]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0469332323,"measured_runtime_v1":0.0419390843,"runtime_lift":1.1190809978,"key":["s915858415","s334860213"]} +{"user_id":"u863841238","problem_id":"p03495","language":"python","submission_id_v0":"s016775533","submission_id_v1":"s082769731","cpu_time_v0":175,"cpu_time_v1":107,"memory_v0":39344,"memory_v1":25644,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.86,"input":"from collections import Counter\n\n\n\nn,k = list(map(int,input().split()))\n\nn_lst = list(map(int,input().split()))\n\n\n\ncnt_lst = Counter(n_lst).most_common()[k:]\n\nans = 0\n\nfor x in cnt_lst:\n\n ans += x[1]\n\nprint(ans)\n","target":"n,k = list(map(int,input().split()))\n\nn_lst = list(map(int,input().split())) \n\ncnt_lst = [0 for _ in range(n+1)]\n\n\n\nfor x in n_lst:\n\n cnt_lst[x] += 1\n\ncnt_lst.sort(reverse=True)\n\nprint((sum(cnt_lst[k:])))\n","code_v0_loc":10,"code_v1_loc":8,"code_v0_num_chars":209,"code_v1_num_chars":200,"code_v0_no_empty_lines":"from collections import Counter\n\nn, k = list(map(int, input().split()))\nn_lst = list(map(int, input().split()))\ncnt_lst = Counter(n_lst).most_common()[k:]\nans = 0\nfor x in cnt_lst:\n ans += x[1]\nprint(ans)\n","code_v1_no_empty_lines":"n, k = list(map(int, input().split()))\nn_lst = list(map(int, input().split()))\ncnt_lst = [0 for _ in range(n + 1)]\nfor x in n_lst:\n cnt_lst[x] += 1\ncnt_lst.sort(reverse=True)\nprint((sum(cnt_lst[k:])))\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-from collections import Counter","-","-cnt_lst = Counter(n_lst).most_common()[k:]","-ans = 0","-for x in cnt_lst:","- ans += x[1]","-print(ans)","+cnt_lst = [0 for _ in range(n + 1)]","+for x in n_lst:","+ cnt_lst[x] += 1","+cnt_lst.sort(reverse=True)","+print((sum(cnt_lst[k:])))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0406263351,"measured_runtime_v1":0.0327717781,"runtime_lift":1.2396744235,"key":["s016775533","s082769731"]} +{"user_id":"u509674552","problem_id":"p03112","language":"python","submission_id_v0":"s328425783","submission_id_v1":"s878716547","cpu_time_v0":1638,"cpu_time_v1":787,"memory_v0":16132,"memory_v1":76380,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":51.95,"input":"A, B, Q = list(map(int, input().split()))\n\nINF = 10 ** 18\n\nS = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]\n\nT = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]\n\nX = [int(eval(input())) for _ in range(Q)]\n\n\n\n\n\ndef binary_search(q, A):\n\n l, r = 0, len(A)\n\n while r - l > 1:\n\n mid = (l + r) \/\/ 2\n\n if q > A[mid]:\n\n l = mid\n\n else:\n\n r = mid\n\n return A[l], A[r]\n\n\n\n\n\ndef main():\n\n for x in X:\n\n s1, s2 = binary_search(x, S)\n\n t1, t2 = binary_search(x, T)\n\n print((min(abs(s-t) + min(abs(s-x), abs(t-x)) for s in [s1, s2] for t in [t1, t2])))\n\n return\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nimport bisect\n\n\n\nA, B, Q = list(map(int, sys.stdin.readline().split()))\n\nINF = 10 ** 18\n\nS = [-INF] + [int(sys.stdin.readline()) for _ in range(A)] + [INF]\n\nT = [-INF] + [int(sys.stdin.readline()) for _ in range(B)] + [INF]\n\nX = [int(sys.stdin.readline()) for _ in range(Q)]\n\n\n\n\n\n# def binary_search(q, A):\n\n# l, r = 0, len(A)\n\n# while r - l > 1:\n\n# mid = (l + r) \/\/ 2\n\n# if q > A[mid]:\n\n# l = mid\n\n# else:\n\n# r = mid\n\n# return A[l], A[r]\n\n\n\n\n\ndef main():\n\n for x in X:\n\n ids, idt = bisect.bisect_right(S, x), bisect.bisect_right(T, x)\n\n print((min(abs(s-t) + min(abs(s-x), abs(t-x)) for s in S[ids-1:ids+1] for t in T[idt-1:idt+1])))\n\n return\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":27,"code_v1_loc":29,"code_v0_num_chars":662,"code_v1_num_chars":770,"code_v0_no_empty_lines":"A, B, Q = list(map(int, input().split()))\nINF = 10**18\nS = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]\nT = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]\nX = [int(eval(input())) for _ in range(Q)]\n\n\ndef binary_search(q, A):\n l, r = 0, len(A)\n while r - l > 1:\n mid = (l + r) \/\/ 2\n if q > A[mid]:\n l = mid\n else:\n r = mid\n return A[l], A[r]\n\n\ndef main():\n for x in X:\n s1, s2 = binary_search(x, S)\n t1, t2 = binary_search(x, T)\n print(\n (\n min(\n abs(s - t) + min(abs(s - x), abs(t - x))\n for s in [s1, s2]\n for t in [t1, t2]\n )\n )\n )\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\nimport bisect\n\nA, B, Q = list(map(int, sys.stdin.readline().split()))\nINF = 10**18\nS = [-INF] + [int(sys.stdin.readline()) for _ in range(A)] + [INF]\nT = [-INF] + [int(sys.stdin.readline()) for _ in range(B)] + [INF]\nX = [int(sys.stdin.readline()) for _ in range(Q)]\n# def binary_search(q, A):\n# l, r = 0, len(A)\n# while r - l > 1:\n# mid = (l + r) \/\/ 2\n# if q > A[mid]:\n# l = mid\n# else:\n# r = mid\n# return A[l], A[r]\ndef main():\n for x in X:\n ids, idt = bisect.bisect_right(S, x), bisect.bisect_right(T, x)\n print(\n (\n min(\n abs(s - t) + min(abs(s - x), abs(t - x))\n for s in S[ids - 1 : ids + 1]\n for t in T[idt - 1 : idt + 1]\n )\n )\n )\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":6.8965517241,"diff":["-A, B, Q = list(map(int, input().split()))","+import sys","+import bisect","+","+A, B, Q = list(map(int, sys.stdin.readline().split()))","-S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]","-T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]","-X = [int(eval(input())) for _ in range(Q)]","-","-","-def binary_search(q, A):","- l, r = 0, len(A)","- while r - l > 1:","- mid = (l + r) \/\/ 2","- if q > A[mid]:","- l = mid","- else:","- r = mid","- return A[l], A[r]","-","-","+S = [-INF] + [int(sys.stdin.readline()) for _ in range(A)] + [INF]","+T = [-INF] + [int(sys.stdin.readline()) for _ in range(B)] + [INF]","+X = [int(sys.stdin.readline()) for _ in range(Q)]","+# def binary_search(q, A):","+# l, r = 0, len(A)","+# while r - l > 1:","+# mid = (l + r) \/\/ 2","+# if q > A[mid]:","+# l = mid","+# else:","+# r = mid","+# return A[l], A[r]","- s1, s2 = binary_search(x, S)","- t1, t2 = binary_search(x, T)","+ ids, idt = bisect.bisect_right(S, x), bisect.bisect_right(T, x)","- for s in [s1, s2]","- for t in [t1, t2]","+ for s in S[ids - 1 : ids + 1]","+ for t in T[idt - 1 : idt + 1]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0724835651,"measured_runtime_v1":0.0382788242,"runtime_lift":1.8935682193,"key":["s328425783","s878716547"]} +{"user_id":"u901144784","problem_id":"p02887","language":"python","submission_id_v0":"s293631164","submission_id_v1":"s116276418","cpu_time_v0":51,"cpu_time_v1":43,"memory_v0":4644,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.69,"input":"n=int(eval(input()))\n\nl=list(eval(input()))\n\nl1=[l[0]]\n\nfor i in range(1,n):\n\n if(l[i]!=l1[len(l1)-1]):\n\n l1.append(l[i])\n\nprint((len(l1)))","target":"n=int(eval(input()))\n\ns=eval(input())\n\nc=1\n\nfor i in range(1,n):\n\n if(s[i]!=s[i-1]):\n\n c+=1\n\nprint(c)","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":129,"code_v1_num_chars":93,"code_v0_no_empty_lines":"n = int(eval(input()))\nl = list(eval(input()))\nl1 = [l[0]]\nfor i in range(1, n):\n if l[i] != l1[len(l1) - 1]:\n l1.append(l[i])\nprint((len(l1)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\ns = eval(input())\nc = 1\nfor i in range(1, n):\n if s[i] != s[i - 1]:\n c += 1\nprint(c)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-l = list(eval(input()))","-l1 = [l[0]]","+s = eval(input())","+c = 1","- if l[i] != l1[len(l1) - 1]:","- l1.append(l[i])","-print((len(l1)))","+ if s[i] != s[i - 1]:","+ c += 1","+print(c)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0602806399,"measured_runtime_v1":0.0856524181,"runtime_lift":0.7037821137,"key":["s293631164","s116276418"]} +{"user_id":"u713914478","problem_id":"p02802","language":"python","submission_id_v0":"s523887891","submission_id_v1":"s349855317","cpu_time_v0":315,"cpu_time_v1":271,"memory_v0":21396,"memory_v1":4596,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.97,"input":"N, M = list(map(int, input().split()))\n\npnt = {}\n\nac = {}\n\nfor i in range(M):\n\n\tp,s = input().split()\n\n\tp = int(p)\n\n\tif not p in pnt:\n\n\t\tpnt[p] = 0\n\n\t\tac[p] = 0\n\n\tif s == \"WA\" and ac[p] == 0:\n\n\t\tpnt[p] += 1\n\n\telif s == \"AC\" and ac[p] == 0:\n\n\t\tac[p] += 1\n\n\n\nfor i in pnt:\n\n\tif pnt[i] != 0 and ac[i] == 0:\n\n\t\tpnt[i] = 0\n\n\n\nprint((sum(ac.values()),sum(pnt.values())))","target":"N,M = list(map(int,input().split()))\n\n\n\nac = 0\n\nwa = 0\n\nacs = [0]*(N+1)\n\nwas = [0]*(N+1)\n\n\n\nfor i in range(M):\n\n\tp,s = input().split()\n\n\tp = int(p)\n\n\tif s == \"AC\":\n\n\t\tif acs[p]==0:\n\n\t\t\tac += 1\n\n\t\t\twa += was[p]\n\n\t\t\tacs[p] = 1\n\n\telse:\n\n\t\twas[p] += 1\n\n\n\nprint((ac,wa))","code_v0_loc":19,"code_v1_loc":19,"code_v0_num_chars":356,"code_v1_num_chars":257,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\npnt = {}\nac = {}\nfor i in range(M):\n p, s = input().split()\n p = int(p)\n if not p in pnt:\n pnt[p] = 0\n ac[p] = 0\n if s == \"WA\" and ac[p] == 0:\n pnt[p] += 1\n elif s == \"AC\" and ac[p] == 0:\n ac[p] += 1\nfor i in pnt:\n if pnt[i] != 0 and ac[i] == 0:\n pnt[i] = 0\nprint((sum(ac.values()), sum(pnt.values())))\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nac = 0\nwa = 0\nacs = [0] * (N + 1)\nwas = [0] * (N + 1)\nfor i in range(M):\n p, s = input().split()\n p = int(p)\n if s == \"AC\":\n if acs[p] == 0:\n ac += 1\n wa += was[p]\n acs[p] = 1\n else:\n was[p] += 1\nprint((ac, wa))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-pnt = {}","-ac = {}","+ac = 0","+wa = 0","+acs = [0] * (N + 1)","+was = [0] * (N + 1)","- if not p in pnt:","- pnt[p] = 0","- ac[p] = 0","- if s == \"WA\" and ac[p] == 0:","- pnt[p] += 1","- elif s == \"AC\" and ac[p] == 0:","- ac[p] += 1","-for i in pnt:","- if pnt[i] != 0 and ac[i] == 0:","- pnt[i] = 0","-print((sum(ac.values()), sum(pnt.values())))","+ if s == \"AC\":","+ if acs[p] == 0:","+ ac += 1","+ wa += was[p]","+ acs[p] = 1","+ else:","+ was[p] += 1","+print((ac, wa))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0987519882,"measured_runtime_v1":0.0476406276,"runtime_lift":2.0728523758,"key":["s523887891","s349855317"]} +{"user_id":"u263830634","problem_id":"p03806","language":"python","submission_id_v0":"s693168818","submission_id_v1":"s640792040","cpu_time_v0":1410,"cpu_time_v1":264,"memory_v0":4852,"memory_v1":18632,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":81.28,"input":"N, Ma, Mb = list(map(int, input().split()))\n\n\n\nINF = 10 ** 8\n\n\n\nlst = [[INF] * 401 for i in range(401)]\n\nlst[0][0] = 0\n\n\n\nfor _ in range(N):\n\n a, b, c = list(map(int, input().split()))\n\n for i in range(400, a - 1, -1):\n\n for j in range(400, b - 1, -1):\n\n if lst[i- a][j - b] == INF:\n\n pass\n\n else:\n\n lst[i][j] = min(lst[i][j], lst[i - a][j - b] + c)\n\n\n\nans = INF\n\nn = 400 \/\/ max(Ma, Mb)\n\nfor i in range(1, n + 1):\n\n ans = min(ans, lst[Ma * i][Mb * i])\n\n\n\nif ans == INF:\n\n print((-1))\n\nelse:\n\n print (ans)\n\n\n\n# for i in range(7):\n\n# print (lst[i][:7])","target":"#masoy\u3055\u3093\u306e\u30b3\u30fc\u30c9\n\n\n\nimport numpy as np\n\n\n\nN, Ma, Mb = list(map(int, input().split()))\n\nU = N * 10\n\n\n\ndp = np.zeros((U + 1, U + 1), dtype = np.int64)\n\ntemp = np.zeros_like(dp)\n\n\n\nINF = 10 ** 18\n\ndp += INF\n\ndp[0, 0] = 0\n\n\n\nfor _ in range(N):\n\n a, b, c = list(map(int, input().split()))\n\n temp[:] = dp.copy()\n\n temp[a:, b:] = np.minimum(temp[a:, b:], dp[:-a, :-b] + c)\n\n dp = temp #\u6bce\u56de\u3001\u4e00\u3064\u524d\u306e\u7d50\u679c\u3092\u6b8b\u3059\n\n\n\nanswer = INF\n\nfor t in range(1, 401):\n\n a = Ma * t\n\n b = Mb * t\n\n if max(a, b) >= U: #\u5230\u9054\u3067\u304d\u306a\u3044\u91cf\u306b\u9054\u3057\u305f\u3089\u7d42\u4e86\n\n break\n\n answer = min(answer, dp[a, b])\n\n\n\nif answer == INF:\n\n answer = -1\n\n\n\nprint (answer)\n","code_v0_loc":28,"code_v1_loc":32,"code_v0_num_chars":615,"code_v1_num_chars":608,"code_v0_no_empty_lines":"N, Ma, Mb = list(map(int, input().split()))\nINF = 10**8\nlst = [[INF] * 401 for i in range(401)]\nlst[0][0] = 0\nfor _ in range(N):\n a, b, c = list(map(int, input().split()))\n for i in range(400, a - 1, -1):\n for j in range(400, b - 1, -1):\n if lst[i - a][j - b] == INF:\n pass\n else:\n lst[i][j] = min(lst[i][j], lst[i - a][j - b] + c)\nans = INF\nn = 400 \/\/ max(Ma, Mb)\nfor i in range(1, n + 1):\n ans = min(ans, lst[Ma * i][Mb * i])\nif ans == INF:\n print((-1))\nelse:\n print(ans)\n# for i in range(7):\n# print (lst[i][:7])\n","code_v1_no_empty_lines":"# masoy\u3055\u3093\u306e\u30b3\u30fc\u30c9\nimport numpy as np\n\nN, Ma, Mb = list(map(int, input().split()))\nU = N * 10\ndp = np.zeros((U + 1, U + 1), dtype=np.int64)\ntemp = np.zeros_like(dp)\nINF = 10**18\ndp += INF\ndp[0, 0] = 0\nfor _ in range(N):\n a, b, c = list(map(int, input().split()))\n temp[:] = dp.copy()\n temp[a:, b:] = np.minimum(temp[a:, b:], dp[:-a, :-b] + c)\n dp = temp # \u6bce\u56de\u3001\u4e00\u3064\u524d\u306e\u7d50\u679c\u3092\u6b8b\u3059\nanswer = INF\nfor t in range(1, 401):\n a = Ma * t\n b = Mb * t\n if max(a, b) >= U: # \u5230\u9054\u3067\u304d\u306a\u3044\u91cf\u306b\u9054\u3057\u305f\u3089\u7d42\u4e86\n break\n answer = min(answer, dp[a, b])\nif answer == INF:\n answer = -1\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":12.5,"diff":["+# masoy\u3055\u3093\u306e\u30b3\u30fc\u30c9","+import numpy as np","+","-INF = 10**8","-lst = [[INF] * 401 for i in range(401)]","-lst[0][0] = 0","+U = N * 10","+dp = np.zeros((U + 1, U + 1), dtype=np.int64)","+temp = np.zeros_like(dp)","+INF = 10**18","+dp += INF","+dp[0, 0] = 0","- for i in range(400, a - 1, -1):","- for j in range(400, b - 1, -1):","- if lst[i - a][j - b] == INF:","- pass","- else:","- lst[i][j] = min(lst[i][j], lst[i - a][j - b] + c)","-ans = INF","-n = 400 \/\/ max(Ma, Mb)","-for i in range(1, n + 1):","- ans = min(ans, lst[Ma * i][Mb * i])","-if ans == INF:","- print((-1))","-else:","- print(ans)","-# for i in range(7):","-# print (lst[i][:7])","+ temp[:] = dp.copy()","+ temp[a:, b:] = np.minimum(temp[a:, b:], dp[:-a, :-b] + c)","+ dp = temp # \u6bce\u56de\u3001\u4e00\u3064\u524d\u306e\u7d50\u679c\u3092\u6b8b\u3059","+answer = INF","+for t in range(1, 401):","+ a = Ma * t","+ b = Mb * t","+ if max(a, b) >= U: # \u5230\u9054\u3067\u304d\u306a\u3044\u91cf\u306b\u9054\u3057\u305f\u3089\u7d42\u4e86","+ break","+ answer = min(answer, dp[a, b])","+if answer == INF:","+ answer = -1","+print(answer)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1018688829,"measured_runtime_v1":0.1643388711,"runtime_lift":0.6198708937,"key":["s693168818","s640792040"]} +{"user_id":"u624475441","problem_id":"p04030","language":"python","submission_id_v0":"s977784866","submission_id_v1":"s599127468","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3188,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"import re\n\ns = eval(input())\n\nfor _ in range(s.count('B')):\n\n s = re.sub('.?B', '', s, 1)\n\nprint(s)","target":"s=eval(input())\n\nwhile'B'in s:\n\n s=s[s[0]=='B':].replace('0B','').replace('1B','')\n\nprint(s)","code_v0_loc":5,"code_v1_loc":4,"code_v0_num_chars":96,"code_v1_num_chars":89,"code_v0_no_empty_lines":"import re\n\ns = eval(input())\nfor _ in range(s.count(\"B\")):\n s = re.sub(\".?B\", \"\", s, 1)\nprint(s)\n","code_v1_no_empty_lines":"s = eval(input())\nwhile \"B\" in s:\n s = s[s[0] == \"B\" :].replace(\"0B\", \"\").replace(\"1B\", \"\")\nprint(s)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-import re","-","-for _ in range(s.count(\"B\")):","- s = re.sub(\".?B\", \"\", s, 1)","+while \"B\" in s:","+ s = s[s[0] == \"B\" :].replace(\"0B\", \"\").replace(\"1B\", \"\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0988070566,"measured_runtime_v1":0.0861529538,"runtime_lift":1.1468795002,"key":["s977784866","s599127468"]} +{"user_id":"u201928947","problem_id":"p02559","language":"python","submission_id_v0":"s608896780","submission_id_v1":"s267006894","cpu_time_v0":1476,"cpu_time_v1":644,"memory_v0":132404,"memory_v1":129656,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.37,"input":"N,Q = list(map(int,input().split()))\n\nBIT = [0]*(N+1)\n\n\n\ndef BIT_query(idx):\n\n res_sum = 0\n\n while idx > 0:\n\n res_sum += BIT[idx]\n\n idx -= idx&(-idx)\n\n return res_sum\n\n\n\ndef BIT_update(idx,x):\n\n while idx <= N:\n\n BIT[idx] += x\n\n idx += idx&(-idx)\n\n return\n\n\n\na = list(map(int,input().split()))\n\nfor i in range(N):\n\n BIT_update(i+1,a[i])\n\n\n\nfor i in range(Q):\n\n a,b,c = list(map(int,input().split()))\n\n if a == 0:\n\n BIT_update(b+1,c)\n\n else:\n\n print((BIT_query(c)-BIT_query(b)))\n","target":"import sys\n\ninput = sys.stdin.buffer.readline\n\nN,Q = list(map(int,input().split()))\n\nBIT = [0]*(N+1)\n\n\n\ndef BIT_query(idx):\n\n res_sum = 0\n\n while idx > 0:\n\n res_sum += BIT[idx]\n\n idx -= idx&(-idx)\n\n return res_sum\n\n\n\ndef BIT_update(idx,x):\n\n while idx <= N:\n\n BIT[idx] += x\n\n idx += idx&(-idx)\n\n return\n\n\n\na = list(map(int,input().split()))\n\nfor i in range(N):\n\n BIT_update(i+1,a[i])\n\n\n\nfor i in range(Q):\n\n a,b,c = list(map(int,input().split()))\n\n if a == 0:\n\n BIT_update(b+1,c)\n\n else:\n\n print((BIT_query(c)-BIT_query(b)))\n","code_v0_loc":26,"code_v1_loc":28,"code_v0_num_chars":533,"code_v1_num_chars":580,"code_v0_no_empty_lines":"N, Q = list(map(int, input().split()))\nBIT = [0] * (N + 1)\n\n\ndef BIT_query(idx):\n res_sum = 0\n while idx > 0:\n res_sum += BIT[idx]\n idx -= idx & (-idx)\n return res_sum\n\n\ndef BIT_update(idx, x):\n while idx <= N:\n BIT[idx] += x\n idx += idx & (-idx)\n return\n\n\na = list(map(int, input().split()))\nfor i in range(N):\n BIT_update(i + 1, a[i])\nfor i in range(Q):\n a, b, c = list(map(int, input().split()))\n if a == 0:\n BIT_update(b + 1, c)\n else:\n print((BIT_query(c) - BIT_query(b)))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.buffer.readline\nN, Q = list(map(int, input().split()))\nBIT = [0] * (N + 1)\n\n\ndef BIT_query(idx):\n res_sum = 0\n while idx > 0:\n res_sum += BIT[idx]\n idx -= idx & (-idx)\n return res_sum\n\n\ndef BIT_update(idx, x):\n while idx <= N:\n BIT[idx] += x\n idx += idx & (-idx)\n return\n\n\na = list(map(int, input().split()))\nfor i in range(N):\n BIT_update(i + 1, a[i])\nfor i in range(Q):\n a, b, c = list(map(int, input().split()))\n if a == 0:\n BIT_update(b + 1, c)\n else:\n print((BIT_query(c) - BIT_query(b)))\n","code_same":false,"relative_loc_diff_percent":7.1428571429,"diff":["+import sys","+","+input = sys.stdin.buffer.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.0773011823,"measured_runtime_v1":0.1096058943,"runtime_lift":0.7052648285,"key":["s608896780","s267006894"]} +{"user_id":"u086503932","problem_id":"p03425","language":"python","submission_id_v0":"s682315982","submission_id_v1":"s522955794","cpu_time_v0":206,"cpu_time_v1":185,"memory_v0":9792,"memory_v1":83076,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.19,"input":"import itertools\n\nimport math\n\n\n\nN = int(eval(input()))\n\nS_list = []\n\nfor i in range(N):\n\n S_list.append(eval(input()))\n\n\n\ncount_M = 0\n\ncount_A = 0\n\ncount_R = 0\n\ncount_C = 0\n\ncount_H = 0\n\n\n\nfor l in S_list:\n\n if l.startswith('M'):\n\n count_M += 1\n\n elif l.startswith('A'):\n\n count_A += 1\n\n elif l.startswith('R'):\n\n count_R += 1\n\n elif l.startswith('C'):\n\n count_C += 1\n\n elif l.startswith('H'):\n\n count_H += 1\n\n\n\ncount = [count_M,count_A,count_R,count_C,count_H]\n\nc = list(itertools.combinations(count,3))\n\nx = 0\n\nfor i in c:\n\n i_list = list(i)\n\n x += i_list[0]*i_list[1]*i_list[2]\n\nprint(x)\n","target":"N = int(eval(input()))\n\nS = [eval(input()) for _ in range(N)]\n\nres = [0] * 5\n\nini = 'MARCH'\n\nfor i in range(N):\n\n for j in range(5):\n\n if S[i][0] == ini[j]:\n\n res[j] += 1\n\n\n\nans = 0\n\nfor i in range(5):\n\n for j in range(i+1,5):\n\n for k in range(j+1,5):\n\n ans += res[i]*res[j]*res[k]\n\nprint(ans)","code_v0_loc":33,"code_v1_loc":15,"code_v0_num_chars":639,"code_v1_num_chars":323,"code_v0_no_empty_lines":"import itertools\nimport math\n\nN = int(eval(input()))\nS_list = []\nfor i in range(N):\n S_list.append(eval(input()))\ncount_M = 0\ncount_A = 0\ncount_R = 0\ncount_C = 0\ncount_H = 0\nfor l in S_list:\n if l.startswith(\"M\"):\n count_M += 1\n elif l.startswith(\"A\"):\n count_A += 1\n elif l.startswith(\"R\"):\n count_R += 1\n elif l.startswith(\"C\"):\n count_C += 1\n elif l.startswith(\"H\"):\n count_H += 1\ncount = [count_M, count_A, count_R, count_C, count_H]\nc = list(itertools.combinations(count, 3))\nx = 0\nfor i in c:\n i_list = list(i)\n x += i_list[0] * i_list[1] * i_list[2]\nprint(x)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = [eval(input()) for _ in range(N)]\nres = [0] * 5\nini = \"MARCH\"\nfor i in range(N):\n for j in range(5):\n if S[i][0] == ini[j]:\n res[j] += 1\nans = 0\nfor i in range(5):\n for j in range(i + 1, 5):\n for k in range(j + 1, 5):\n ans += res[i] * res[j] * res[k]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":54.5454545455,"diff":["-import itertools","-import math","-","-S_list = []","+S = [eval(input()) for _ in range(N)]","+res = [0] * 5","+ini = \"MARCH\"","- S_list.append(eval(input()))","-count_M = 0","-count_A = 0","-count_R = 0","-count_C = 0","-count_H = 0","-for l in S_list:","- if l.startswith(\"M\"):","- count_M += 1","- elif l.startswith(\"A\"):","- count_A += 1","- elif l.startswith(\"R\"):","- count_R += 1","- elif l.startswith(\"C\"):","- count_C += 1","- elif l.startswith(\"H\"):","- count_H += 1","-count = [count_M, count_A, count_R, count_C, count_H]","-c = list(itertools.combinations(count, 3))","-x = 0","-for i in c:","- i_list = list(i)","- x += i_list[0] * i_list[1] * i_list[2]","-print(x)","+ for j in range(5):","+ if S[i][0] == ini[j]:","+ res[j] += 1","+ans = 0","+for i in range(5):","+ for j in range(i + 1, 5):","+ for k in range(j + 1, 5):","+ ans += res[i] * res[j] * res[k]","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0475493083,"measured_runtime_v1":0.0440258594,"runtime_lift":1.0800313494,"key":["s682315982","s522955794"]} +{"user_id":"u073852194","problem_id":"p02563","language":"python","submission_id_v0":"s725419450","submission_id_v1":"s473507384","cpu_time_v0":819,"cpu_time_v1":756,"memory_v0":187044,"memory_v1":197280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.69,"input":"#Convolution_998244353\n\n\n\nMOD = 998244353\n\nROOT = 3\n\n\n\nsum_e = (911660635, 509520358, 369330050, 332049552, 983190778, 123842337, 238493703, 975955924, 603855026, 856644456, 131300601, 842657263, 730768835, 942482514, 806263778, 151565301, 510815449, 503497456, 743006876, 741047443, 56250497, 0, 0, 0, 0, 0, 0, 0, 0, 0)\n\nsum_ie = (86583718, 372528824, 373294451, 645684063, 112220581, 692852209, 155456985, 797128860, 90816748, 860285882, 927414960, 354738543, 109331171, 293255632, 535113200, 308540755, 121186627, 608385704, 438932459, 359477183, 824071951, 0, 0, 0, 0, 0, 0, 0, 0, 0)\n\n\n\ndef butterfly(arr):\n\n n = len(arr)\n\n h = (n - 1).bit_length()\n\n for ph in range(1, h + 1):\n\n w = 1 << (ph - 1)\n\n p = 1 << (h - ph)\n\n now = 1\n\n for s in range(w):\n\n offset = s << (h - ph + 1)\n\n for i in range(p):\n\n l = arr[i + offset]\n\n r = arr[i + offset + p] * now\n\n arr[i + offset] = (l + r) % MOD\n\n arr[i + offset + p] = (l - r) % MOD\n\n now *= sum_e[(~s & -~s).bit_length() - 1]\n\n now %= MOD\n\n\n\ndef butterfly_inv(arr):\n\n n = len(arr)\n\n h = (n - 1).bit_length()\n\n for ph in range(1, h + 1)[::-1]:\n\n w = 1 << (ph - 1)\n\n p = 1 << (h - ph)\n\n inow = 1\n\n for s in range(w):\n\n offset = s << (h - ph + 1)\n\n for i in range(p):\n\n l = arr[i + offset]\n\n r = arr[i + offset + p]\n\n arr[i + offset] = (l + r) % MOD\n\n arr[i + offset + p] = (MOD + l - r) * inow % MOD\n\n inow *= sum_ie[(~s & -~s).bit_length() - 1]\n\n inow %= MOD\n\n\n\ndef convolution(a, b):\n\n n = len(a)\n\n m = len(b)\n\n if not n or not m: return []\n\n if min(n, m) <= 50:\n\n if n < m:\n\n n, m = m, n\n\n a, b = b, a\n\n res = [0] * (n + m - 1)\n\n for i in range(n):\n\n for j in range(m):\n\n res[i + j] += a[i] * b[j]\n\n res[i + j] %= MOD\n\n return res\n\n z = 1 << (n + m - 2).bit_length()\n\n a += [0] * (z - n)\n\n b += [0] * (z - m)\n\n butterfly(a)\n\n butterfly(b)\n\n for i in range(z):\n\n a[i] *= b[i]\n\n a[i] %= MOD\n\n butterfly_inv(a)\n\n a = a[:n + m - 1]\n\n iz = pow(z, MOD - 2, MOD)\n\n for i in range(n + m - 1):\n\n a[i] *= iz\n\n a[i] %= MOD\n\n return a\n\n\n\ndef autocorrelation(a):\n\n n = len(a)\n\n if not n: return []\n\n if n <= 50:\n\n res = [0] * (2 * n - 1)\n\n for i in range(n):\n\n for j in range(n):\n\n res[i + j] += a[i] * a[j]\n\n res[i + j] %= MOD\n\n return res\n\n z = 1 << (2 * n - 2).bit_length()\n\n a += [0] * (z - n)\n\n butterfly(a)\n\n for i in range(a):\n\n a[i] *= a[i]\n\n a[i] %= MOD\n\n butterfly_inv(a)\n\n a = a[:2 * n - 1]\n\n iz = pow(z, MOD - 2, MOD)\n\n for i in range(2 * n - 1):\n\n a[i] *= iz\n\n a[i] %= MOD\n\n return a\n\n\n\nN, M = list(map(int, input().split()))\n\nA = [int(x) for x in input().split()]\n\nB = [int(x) for x in input().split()]\n\n\n\nprint((*convolution(A, B)))","target":"#Convolution_998244353\n\n\n\nMOD = 998244353\n\nROOT = 3\n\n\n\nsum_e = (911660635, 509520358, 369330050, 332049552, 983190778, 123842337, 238493703, 975955924, 603855026, 856644456, 131300601, 842657263, 730768835, 942482514, 806263778, 151565301, 510815449, 503497456, 743006876, 741047443, 56250497, 0, 0, 0, 0, 0, 0, 0, 0, 0)\n\nsum_ie = (86583718, 372528824, 373294451, 645684063, 112220581, 692852209, 155456985, 797128860, 90816748, 860285882, 927414960, 354738543, 109331171, 293255632, 535113200, 308540755, 121186627, 608385704, 438932459, 359477183, 824071951, 0, 0, 0, 0, 0, 0, 0, 0, 0)\n\n\n\ndef butterfly(arr):\n\n n = len(arr)\n\n h = (n - 1).bit_length()\n\n for ph in range(1, h + 1):\n\n w = 1 << (ph - 1)\n\n p = 1 << (h - ph)\n\n now = 1\n\n for s in range(w):\n\n offset = s << (h - ph + 1)\n\n for i in range(p):\n\n l = arr[i + offset]\n\n r = arr[i + offset + p] * now\n\n arr[i + offset] = (l + r) % MOD\n\n arr[i + offset + p] = (l - r) % MOD\n\n now *= sum_e[(~s & -~s).bit_length() - 1]\n\n now %= MOD\n\n\n\ndef butterfly_inv(arr):\n\n n = len(arr)\n\n h = (n - 1).bit_length()\n\n for ph in range(1, h + 1)[::-1]:\n\n w = 1 << (ph - 1)\n\n p = 1 << (h - ph)\n\n inow = 1\n\n for s in range(w):\n\n offset = s << (h - ph + 1)\n\n for i in range(p):\n\n l = arr[i + offset]\n\n r = arr[i + offset + p]\n\n arr[i + offset] = (l + r) % MOD\n\n arr[i + offset + p] = (MOD + l - r) * inow % MOD\n\n inow *= sum_ie[(~s & -~s).bit_length() - 1]\n\n inow %= MOD\n\n\n\ndef convolution(a, b):\n\n n = len(a)\n\n m = len(b)\n\n if not n or not m: return []\n\n if min(n, m) <= 50:\n\n if n < m:\n\n n, m = m, n\n\n a, b = b, a\n\n res = [0] * (n + m - 1)\n\n for i in range(n):\n\n for j in range(m):\n\n res[i + j] += a[i] * b[j]\n\n res[i + j] %= MOD\n\n return res\n\n z = 1 << (n + m - 2).bit_length()\n\n a += [0] * (z - n)\n\n b += [0] * (z - m)\n\n butterfly(a)\n\n butterfly(b)\n\n for i in range(z):\n\n a[i] *= b[i]\n\n a[i] %= MOD\n\n butterfly_inv(a)\n\n a = a[:n + m - 1]\n\n iz = pow(z, MOD - 2, MOD)\n\n for i in range(n + m - 1):\n\n a[i] *= iz\n\n a[i] %= MOD\n\n return a\n\n\n\ndef autocorrelation(a):\n\n n = len(a)\n\n if not n: return []\n\n if n <= 50:\n\n res = [0] * (2 * n - 1)\n\n for i in range(n):\n\n for j in range(n):\n\n res[i + j] += a[i] * a[j]\n\n res[i + j] %= MOD\n\n return res\n\n z = 1 << (2 * n - 2).bit_length()\n\n a += [0] * (z - n)\n\n butterfly(a)\n\n for i in range(a):\n\n a[i] *= a[i]\n\n a[i] %= MOD\n\n butterfly_inv(a)\n\n a = a[:2 * n - 1]\n\n iz = pow(z, MOD - 2, MOD)\n\n for i in range(2 * n - 1):\n\n a[i] *= iz\n\n a[i] %= MOD\n\n return a\n\n\n\nimport sys\n\ninput = sys.stdin.buffer.readline\n\n\n\nN, M = list(map(int, input().split()))\n\nA = [int(x) for x in input().split()]\n\nB = [int(x) for x in input().split()]\n\n\n\nprint((*convolution(A, B)))","code_v0_loc":101,"code_v1_loc":104,"code_v0_num_chars":3146,"code_v1_num_chars":3195,"code_v0_no_empty_lines":"# Convolution_998244353\nMOD = 998244353\nROOT = 3\nsum_e = (\n 911660635,\n 509520358,\n 369330050,\n 332049552,\n 983190778,\n 123842337,\n 238493703,\n 975955924,\n 603855026,\n 856644456,\n 131300601,\n 842657263,\n 730768835,\n 942482514,\n 806263778,\n 151565301,\n 510815449,\n 503497456,\n 743006876,\n 741047443,\n 56250497,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n)\nsum_ie = (\n 86583718,\n 372528824,\n 373294451,\n 645684063,\n 112220581,\n 692852209,\n 155456985,\n 797128860,\n 90816748,\n 860285882,\n 927414960,\n 354738543,\n 109331171,\n 293255632,\n 535113200,\n 308540755,\n 121186627,\n 608385704,\n 438932459,\n 359477183,\n 824071951,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n)\n\n\ndef butterfly(arr):\n n = len(arr)\n h = (n - 1).bit_length()\n for ph in range(1, h + 1):\n w = 1 << (ph - 1)\n p = 1 << (h - ph)\n now = 1\n for s in range(w):\n offset = s << (h - ph + 1)\n for i in range(p):\n l = arr[i + offset]\n r = arr[i + offset + p] * now\n arr[i + offset] = (l + r) % MOD\n arr[i + offset + p] = (l - r) % MOD\n now *= sum_e[(~s & -~s).bit_length() - 1]\n now %= MOD\n\n\ndef butterfly_inv(arr):\n n = len(arr)\n h = (n - 1).bit_length()\n for ph in range(1, h + 1)[::-1]:\n w = 1 << (ph - 1)\n p = 1 << (h - ph)\n inow = 1\n for s in range(w):\n offset = s << (h - ph + 1)\n for i in range(p):\n l = arr[i + offset]\n r = arr[i + offset + p]\n arr[i + offset] = (l + r) % MOD\n arr[i + offset + p] = (MOD + l - r) * inow % MOD\n inow *= sum_ie[(~s & -~s).bit_length() - 1]\n inow %= MOD\n\n\ndef convolution(a, b):\n n = len(a)\n m = len(b)\n if not n or not m:\n return []\n if min(n, m) <= 50:\n if n < m:\n n, m = m, n\n a, b = b, a\n res = [0] * (n + m - 1)\n for i in range(n):\n for j in range(m):\n res[i + j] += a[i] * b[j]\n res[i + j] %= MOD\n return res\n z = 1 << (n + m - 2).bit_length()\n a += [0] * (z - n)\n b += [0] * (z - m)\n butterfly(a)\n butterfly(b)\n for i in range(z):\n a[i] *= b[i]\n a[i] %= MOD\n butterfly_inv(a)\n a = a[: n + m - 1]\n iz = pow(z, MOD - 2, MOD)\n for i in range(n + m - 1):\n a[i] *= iz\n a[i] %= MOD\n return a\n\n\ndef autocorrelation(a):\n n = len(a)\n if not n:\n return []\n if n <= 50:\n res = [0] * (2 * n - 1)\n for i in range(n):\n for j in range(n):\n res[i + j] += a[i] * a[j]\n res[i + j] %= MOD\n return res\n z = 1 << (2 * n - 2).bit_length()\n a += [0] * (z - n)\n butterfly(a)\n for i in range(a):\n a[i] *= a[i]\n a[i] %= MOD\n butterfly_inv(a)\n a = a[: 2 * n - 1]\n iz = pow(z, MOD - 2, MOD)\n for i in range(2 * n - 1):\n a[i] *= iz\n a[i] %= MOD\n return a\n\n\nN, M = list(map(int, input().split()))\nA = [int(x) for x in input().split()]\nB = [int(x) for x in input().split()]\nprint((*convolution(A, B)))\n","code_v1_no_empty_lines":"# Convolution_998244353\nMOD = 998244353\nROOT = 3\nsum_e = (\n 911660635,\n 509520358,\n 369330050,\n 332049552,\n 983190778,\n 123842337,\n 238493703,\n 975955924,\n 603855026,\n 856644456,\n 131300601,\n 842657263,\n 730768835,\n 942482514,\n 806263778,\n 151565301,\n 510815449,\n 503497456,\n 743006876,\n 741047443,\n 56250497,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n)\nsum_ie = (\n 86583718,\n 372528824,\n 373294451,\n 645684063,\n 112220581,\n 692852209,\n 155456985,\n 797128860,\n 90816748,\n 860285882,\n 927414960,\n 354738543,\n 109331171,\n 293255632,\n 535113200,\n 308540755,\n 121186627,\n 608385704,\n 438932459,\n 359477183,\n 824071951,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n)\n\n\ndef butterfly(arr):\n n = len(arr)\n h = (n - 1).bit_length()\n for ph in range(1, h + 1):\n w = 1 << (ph - 1)\n p = 1 << (h - ph)\n now = 1\n for s in range(w):\n offset = s << (h - ph + 1)\n for i in range(p):\n l = arr[i + offset]\n r = arr[i + offset + p] * now\n arr[i + offset] = (l + r) % MOD\n arr[i + offset + p] = (l - r) % MOD\n now *= sum_e[(~s & -~s).bit_length() - 1]\n now %= MOD\n\n\ndef butterfly_inv(arr):\n n = len(arr)\n h = (n - 1).bit_length()\n for ph in range(1, h + 1)[::-1]:\n w = 1 << (ph - 1)\n p = 1 << (h - ph)\n inow = 1\n for s in range(w):\n offset = s << (h - ph + 1)\n for i in range(p):\n l = arr[i + offset]\n r = arr[i + offset + p]\n arr[i + offset] = (l + r) % MOD\n arr[i + offset + p] = (MOD + l - r) * inow % MOD\n inow *= sum_ie[(~s & -~s).bit_length() - 1]\n inow %= MOD\n\n\ndef convolution(a, b):\n n = len(a)\n m = len(b)\n if not n or not m:\n return []\n if min(n, m) <= 50:\n if n < m:\n n, m = m, n\n a, b = b, a\n res = [0] * (n + m - 1)\n for i in range(n):\n for j in range(m):\n res[i + j] += a[i] * b[j]\n res[i + j] %= MOD\n return res\n z = 1 << (n + m - 2).bit_length()\n a += [0] * (z - n)\n b += [0] * (z - m)\n butterfly(a)\n butterfly(b)\n for i in range(z):\n a[i] *= b[i]\n a[i] %= MOD\n butterfly_inv(a)\n a = a[: n + m - 1]\n iz = pow(z, MOD - 2, MOD)\n for i in range(n + m - 1):\n a[i] *= iz\n a[i] %= MOD\n return a\n\n\ndef autocorrelation(a):\n n = len(a)\n if not n:\n return []\n if n <= 50:\n res = [0] * (2 * n - 1)\n for i in range(n):\n for j in range(n):\n res[i + j] += a[i] * a[j]\n res[i + j] %= MOD\n return res\n z = 1 << (2 * n - 2).bit_length()\n a += [0] * (z - n)\n butterfly(a)\n for i in range(a):\n a[i] *= a[i]\n a[i] %= MOD\n butterfly_inv(a)\n a = a[: 2 * n - 1]\n iz = pow(z, MOD - 2, MOD)\n for i in range(2 * n - 1):\n a[i] *= iz\n a[i] %= MOD\n return a\n\n\nimport sys\n\ninput = sys.stdin.buffer.readline\nN, M = list(map(int, input().split()))\nA = [int(x) for x in input().split()]\nB = [int(x) for x in input().split()]\nprint((*convolution(A, B)))\n","code_same":false,"relative_loc_diff_percent":2.8846153846,"diff":["+import sys","+","+input = sys.stdin.buffer.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.0490695446,"measured_runtime_v1":0.0505003043,"runtime_lift":0.9716682943,"key":["s725419450","s473507384"]} +{"user_id":"u701644092","problem_id":"p03161","language":"python","submission_id_v0":"s155903797","submission_id_v1":"s553006887","cpu_time_v0":1509,"cpu_time_v1":1283,"memory_v0":20640,"memory_v1":38304,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.98,"input":"N,K = list(map(int,input().split()))\n\nH = list(map(int,input().split()))\n\n\n\nINF = 10 ** 9 + 1\n\ndp = [INF] * N\n\ndp[0] = 0\n\n\n\nfor i in range(1, N):\n\n dp[i] = min(pre + abs(h - H[i]) for pre,h in zip(dp[max(0,i - K):i],H[max(0,i - K):i]))\n\n\n\nprint((dp[-1]))","target":"N,K = list(map(int,input().split()))\n\nimport numpy as np\n\nH = np.array(input().split(), dtype = int)\n\n\n\nINF = 10 ** 9 + 1\n\ndp = np.full(N,INF,dtype = int)\n\ndp[0] = 0\n\n\n\nfor i in range(1, N):\n\n dp[i] = min(dp[max(i - K,0):i] + abs(H[max(i - K,0):i] - H[i]))\n\n\n\nprint((dp[-1]))","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":247,"code_v1_num_chars":268,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nH = list(map(int, input().split()))\nINF = 10**9 + 1\ndp = [INF] * N\ndp[0] = 0\nfor i in range(1, N):\n dp[i] = min(\n pre + abs(h - H[i])\n for pre, h in zip(dp[max(0, i - K) : i], H[max(0, i - K) : i])\n )\nprint((dp[-1]))\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nimport numpy as np\n\nH = np.array(input().split(), dtype=int)\nINF = 10**9 + 1\ndp = np.full(N, INF, dtype=int)\ndp[0] = 0\nfor i in range(1, N):\n dp[i] = min(dp[max(i - K, 0) : i] + abs(H[max(i - K, 0) : i] - H[i]))\nprint((dp[-1]))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-H = list(map(int, input().split()))","+import numpy as np","+","+H = np.array(input().split(), dtype=int)","-dp = [INF] * N","+dp = np.full(N, INF, dtype=int)","- dp[i] = min(","- pre + abs(h - H[i])","- for pre, h in zip(dp[max(0, i - K) : i], H[max(0, i - K) : i])","- )","+ dp[i] = min(dp[max(i - K, 0) : i] + abs(H[max(i - K, 0) : i] - H[i]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0734918892,"measured_runtime_v1":0.6112277837,"runtime_lift":0.1202364997,"key":["s155903797","s553006887"]} +{"user_id":"u476604182","problem_id":"p03142","language":"python","submission_id_v0":"s948838246","submission_id_v1":"s636593604","cpu_time_v0":297,"cpu_time_v1":253,"memory_v0":37140,"memory_v1":37140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.81,"input":"from collections import defaultdict, deque\n\nN, M, *L = list(map(int, open(0).read().split()))\n\ndic = defaultdict(list)\n\npar = [0]*N\n\ncnt = [0]*(N+1)\n\nfor a,b in zip(*[iter(L)]*2):\n\n dic[a] += [b]\n\n cnt[b] += 1\n\n\n\nfor i in range(1,N+1):\n\n if cnt[i]==0:\n\n q = deque([i])\n\n par[i-1] = '0'\n\n break\n\n \n\nwhile q:\n\n m = q.popleft()\n\n for c in dic[m]:\n\n cnt[c] -= 1\n\n if cnt[c]==0:\n\n par[c-1] = str(m)\n\n q += [c]\n\n\n\nans = '\\n'.join(par)\n\nprint(ans)","target":"from collections import defaultdict, deque\n\ndef main():\n\n N, M, *L = list(map(int, open(0).read().split()))\n\n dic = defaultdict(list)\n\n par = [0]*N\n\n cnt = [0]*(N+1)\n\n for a,b in zip(*[iter(L)]*2):\n\n dic[a] += [b]\n\n cnt[b] += 1\n\n\n\n for i in range(1,N+1):\n\n if cnt[i]==0:\n\n q = deque([i])\n\n par[i-1] = '0'\n\n break\n\n \n\n while q:\n\n m = q.popleft()\n\n for c in dic[m]:\n\n cnt[c] -= 1\n\n if cnt[c]==0:\n\n par[c-1] = str(m)\n\n q += [c]\n\n\n\n ans = '\\n'.join(par)\n\n print(ans)\n\n \n\nif __name__== '__main__':\n\n main()","code_v0_loc":25,"code_v1_loc":29,"code_v0_num_chars":466,"code_v1_num_chars":562,"code_v0_no_empty_lines":"from collections import defaultdict, deque\n\nN, M, *L = list(map(int, open(0).read().split()))\ndic = defaultdict(list)\npar = [0] * N\ncnt = [0] * (N + 1)\nfor a, b in zip(*[iter(L)] * 2):\n dic[a] += [b]\n cnt[b] += 1\nfor i in range(1, N + 1):\n if cnt[i] == 0:\n q = deque([i])\n par[i - 1] = \"0\"\n break\nwhile q:\n m = q.popleft()\n for c in dic[m]:\n cnt[c] -= 1\n if cnt[c] == 0:\n par[c - 1] = str(m)\n q += [c]\nans = \"\\n\".join(par)\nprint(ans)\n","code_v1_no_empty_lines":"from collections import defaultdict, deque\n\n\ndef main():\n N, M, *L = list(map(int, open(0).read().split()))\n dic = defaultdict(list)\n par = [0] * N\n cnt = [0] * (N + 1)\n for a, b in zip(*[iter(L)] * 2):\n dic[a] += [b]\n cnt[b] += 1\n for i in range(1, N + 1):\n if cnt[i] == 0:\n q = deque([i])\n par[i - 1] = \"0\"\n break\n while q:\n m = q.popleft()\n for c in dic[m]:\n cnt[c] -= 1\n if cnt[c] == 0:\n par[c - 1] = str(m)\n q += [c]\n ans = \"\\n\".join(par)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":13.7931034483,"diff":["-N, M, *L = list(map(int, open(0).read().split()))","-dic = defaultdict(list)","-par = [0] * N","-cnt = [0] * (N + 1)","-for a, b in zip(*[iter(L)] * 2):","- dic[a] += [b]","- cnt[b] += 1","-for i in range(1, N + 1):","- if cnt[i] == 0:","- q = deque([i])","- par[i - 1] = \"0\"","- break","-while q:","- m = q.popleft()","- for c in dic[m]:","- cnt[c] -= 1","- if cnt[c] == 0:","- par[c - 1] = str(m)","- q += [c]","-ans = \"\\n\".join(par)","-print(ans)","+","+def main():","+ N, M, *L = list(map(int, open(0).read().split()))","+ dic = defaultdict(list)","+ par = [0] * N","+ cnt = [0] * (N + 1)","+ for a, b in zip(*[iter(L)] * 2):","+ dic[a] += [b]","+ cnt[b] += 1","+ for i in range(1, N + 1):","+ if cnt[i] == 0:","+ q = deque([i])","+ par[i - 1] = \"0\"","+ break","+ while q:","+ m = q.popleft()","+ for c in dic[m]:","+ cnt[c] -= 1","+ if cnt[c] == 0:","+ par[c - 1] = str(m)","+ q += [c]","+ ans = \"\\n\".join(par)","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0353627474,"measured_runtime_v1":0.0697430073,"runtime_lift":0.5070436279,"key":["s948838246","s636593604"]} +{"user_id":"u528181687","problem_id":"p02536","language":"python","submission_id_v0":"s778125689","submission_id_v1":"s010042709","cpu_time_v0":329,"cpu_time_v1":288,"memory_v0":19008,"memory_v1":19208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.46,"input":"def main():\n\n n, m = list(map(int, input().split()))\n\n # \u30de\u30a4\u30ca\u30b9\u306e\u5834\u5408\u306f leader \u3067\u3042\u308a\u3001\u540c\u6642\u306b\u30b5\u30a4\u30ba(*-1)\u3092\u4fdd\u6301\u3059\u308b\n\n uf = [-1] * (n+1)\n\n\n\n def uf_leader(a):\n\n if uf[a]<0:\n\n return a\n\n uf[a] = uf_leader(uf[a])\n\n return uf[a]\n\n def uf_unite(a, b):\n\n ua, ub = uf_leader(a), uf_leader(b)\n\n if ua==ub:\n\n return False\n\n if uf[ua] > uf[ub]:\n\n a, b = b, a\n\n uf[ua] += uf[ub]\n\n uf[ub] = ua\n\n return True\n\n def uf_leaders():\n\n return set([uf_leader(v) for v in range(1,n+1)])\n\n\n\n # print(uf[1:])\n\n for _ in range(m):\n\n a, b = list(map(int, input().split()))\n\n uf_unite(a, b)\n\n # print(uf[1:])\n\n\n\n # print(uf_leaders())\n\n \n\n ans = len(uf_leaders())-1\n\n print(ans)\n\n\n\nmain()","target":"def main():\n\n n, m = list(map(int, input().split()))\n\n # \u30de\u30a4\u30ca\u30b9\u306e\u5834\u5408\u306f leader \u3067\u3042\u308a\u3001\u540c\u6642\u306b\u30b5\u30a4\u30ba(*-1)\u3092\u4fdd\u6301\u3059\u308b\n\n uf = [-1] * (n+1)\n\n\n\n def uf_leader(a):\n\n if uf[a]<0:\n\n return a\n\n uf[a] = uf_leader(uf[a])\n\n return uf[a]\n\n def uf_unite(a, b):\n\n ua, ub = uf_leader(a), uf_leader(b)\n\n if ua==ub:\n\n return False\n\n if uf[ua] > uf[ub]:\n\n ua, ub = ub, ua\n\n uf[ua] += uf[ub]\n\n uf[ub] = ua\n\n return True\n\n def uf_leaders():\n\n return set([uf_leader(v) for v in range(1,n+1)])\n\n\n\n # print(uf[1:])\n\n for _ in range(m):\n\n a, b = list(map(int, input().split()))\n\n uf_unite(a, b)\n\n # print(uf[1:])\n\n\n\n # print(uf_leaders())\n\n \n\n ans = len(uf_leaders())-1\n\n print(ans)\n\n\n\nmain()","code_v0_loc":34,"code_v1_loc":34,"code_v0_num_chars":789,"code_v1_num_chars":793,"code_v0_no_empty_lines":"def main():\n n, m = list(map(int, input().split()))\n # \u30de\u30a4\u30ca\u30b9\u306e\u5834\u5408\u306f leader \u3067\u3042\u308a\u3001\u540c\u6642\u306b\u30b5\u30a4\u30ba(*-1)\u3092\u4fdd\u6301\u3059\u308b\n uf = [-1] * (n + 1)\n\n def uf_leader(a):\n if uf[a] < 0:\n return a\n uf[a] = uf_leader(uf[a])\n return uf[a]\n\n def uf_unite(a, b):\n ua, ub = uf_leader(a), uf_leader(b)\n if ua == ub:\n return False\n if uf[ua] > uf[ub]:\n a, b = b, a\n uf[ua] += uf[ub]\n uf[ub] = ua\n return True\n\n def uf_leaders():\n return set([uf_leader(v) for v in range(1, n + 1)])\n\n # print(uf[1:])\n for _ in range(m):\n a, b = list(map(int, input().split()))\n uf_unite(a, b)\n # print(uf[1:])\n # print(uf_leaders())\n ans = len(uf_leaders()) - 1\n print(ans)\n\n\nmain()\n","code_v1_no_empty_lines":"def main():\n n, m = list(map(int, input().split()))\n # \u30de\u30a4\u30ca\u30b9\u306e\u5834\u5408\u306f leader \u3067\u3042\u308a\u3001\u540c\u6642\u306b\u30b5\u30a4\u30ba(*-1)\u3092\u4fdd\u6301\u3059\u308b\n uf = [-1] * (n + 1)\n\n def uf_leader(a):\n if uf[a] < 0:\n return a\n uf[a] = uf_leader(uf[a])\n return uf[a]\n\n def uf_unite(a, b):\n ua, ub = uf_leader(a), uf_leader(b)\n if ua == ub:\n return False\n if uf[ua] > uf[ub]:\n ua, ub = ub, ua\n uf[ua] += uf[ub]\n uf[ub] = ua\n return True\n\n def uf_leaders():\n return set([uf_leader(v) for v in range(1, n + 1)])\n\n # print(uf[1:])\n for _ in range(m):\n a, b = list(map(int, input().split()))\n uf_unite(a, b)\n # print(uf[1:])\n # print(uf_leaders())\n ans = len(uf_leaders()) - 1\n print(ans)\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- a, b = b, a","+ ua, ub = ub, ua"],"diff_only_import_comment":false,"measured_runtime_v0":0.0078676178,"measured_runtime_v1":0.1139758298,"runtime_lift":0.069028827,"key":["s778125689","s010042709"]} +{"user_id":"u606045429","problem_id":"p02713","language":"python","submission_id_v0":"s981425483","submission_id_v1":"s567736025","cpu_time_v0":687,"cpu_time_v1":481,"memory_v0":111600,"memory_v1":68784,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":29.99,"input":"from numba import njit\n\nfrom math import gcd\n\n\n\nK = int(eval(input()))\n\n\n\n@njit\n\ndef solve():\n\n ans = 0\n\n for a in range(1, K + 1):\n\n for b in range(1, K + 1):\n\n for c in range(1, K + 1):\n\n ans += gcd(gcd(a, b), c)\n\n return ans\n\n\n\nprint((solve()))","target":"from math import gcd\n\n\n\nK = int(eval(input()))\n\n\n\nans = 0\n\nfor a in range(1, K + 1):\n\n for b in range(1, K + 1):\n\n for c in range(1, K + 1):\n\n ans += gcd(gcd(a, b), c)\n\n\n\nprint(ans)","code_v0_loc":15,"code_v1_loc":11,"code_v0_num_chars":281,"code_v1_num_chars":196,"code_v0_no_empty_lines":"from numba import njit\nfrom math import gcd\n\nK = int(eval(input()))\n\n\n@njit\ndef solve():\n ans = 0\n for a in range(1, K + 1):\n for b in range(1, K + 1):\n for c in range(1, K + 1):\n ans += gcd(gcd(a, b), c)\n return ans\n\n\nprint((solve()))\n","code_v1_no_empty_lines":"from math import gcd\n\nK = int(eval(input()))\nans = 0\nfor a in range(1, K + 1):\n for b in range(1, K + 1):\n for c in range(1, K + 1):\n ans += gcd(gcd(a, b), c)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":26.6666666667,"diff":["-from numba import njit","-","-","-@njit","-def solve():","- ans = 0","- for a in range(1, K + 1):","- for b in range(1, K + 1):","- for c in range(1, K + 1):","- ans += gcd(gcd(a, b), c)","- return ans","-","-","-print((solve()))","+ans = 0","+for a in range(1, K + 1):","+ for b in range(1, K + 1):","+ for c in range(1, K + 1):","+ ans += gcd(gcd(a, b), c)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0782829254,"measured_runtime_v1":0.0509512901,"runtime_lift":1.5364267549,"key":["s981425483","s567736025"]} +{"user_id":"u345966487","problem_id":"p02702","language":"python","submission_id_v0":"s067562086","submission_id_v1":"s689557085","cpu_time_v0":519,"cpu_time_v1":140,"memory_v0":107108,"memory_v1":29956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.03,"input":"import sys\n\nimport numba\n\nimport numpy as np\n\nS = sys.stdin.buffer.readline().decode('utf-8').rstrip()\n\nS = np.array([int(d) for d in S[::-1]], dtype=np.int32)\n\n\n\n@numba.njit(numba.i8(numba.typeof(S)), cache=True)\n\ndef solve(S):\n\n\tM = 2019\n\n\tt = 1\n\n\tans = 0\n\n\tc = np.zeros(M, dtype=np.int64)\n\n\tc[0] = 1\n\n\tr = 0\n\n\tfor d in S:\n\n\t\tr = (d * t + r) % M\n\n\t\tans += c[r]\n\n\t\tc[r] += 1\n\n\t\tt = t * 10 % M\n\n\treturn ans\n\n\n\nprint((solve(S)))","target":"import sys\n\nimport numpy as np\n\n\n\ndef solve(S):\n\n\tM = 2019\n\n\tt = 1\n\n\tans = 0\n\n\tc = np.zeros(M, dtype=np.int64)\n\n\tc[0] = 1\n\n\tr = 0\n\n\tfor d in S:\n\n\t\tr = (d * t + r) % M\n\n\t\tans += c[r]\n\n\t\tc[r] += 1\n\n\t\tt = t * 10 % M\n\n\treturn ans\n\n\n\n\n\n\n\ndef cc_export():\n\n\tfrom numba.pycc import CC\n\n\tcc = CC('my_module')\n\n\tcc.export('solve', 'i8(i4[:])')(solve)\n\n\tcc.compile()\n\n\n\nif __name__ == '__main__':\n\n\timport sys\n\n\tif sys.argv[-1] == 'ONLINE_JUDGE':\n\n\t\tcc_export()\n\n\t\texit(0)\n\n\tfrom my_module import solve\n\n\tS = sys.stdin.buffer.readline().decode('utf-8').rstrip()\n\n\tS = np.array([int(d) for d in S[::-1]], dtype=np.int32)\n\n\tprint((solve(S)))\n","code_v0_loc":22,"code_v1_loc":34,"code_v0_num_chars":425,"code_v1_num_chars":628,"code_v0_no_empty_lines":"import sys\nimport numba\nimport numpy as np\n\nS = sys.stdin.buffer.readline().decode(\"utf-8\").rstrip()\nS = np.array([int(d) for d in S[::-1]], dtype=np.int32)\n\n\n@numba.njit(numba.i8(numba.typeof(S)), cache=True)\ndef solve(S):\n M = 2019\n t = 1\n ans = 0\n c = np.zeros(M, dtype=np.int64)\n c[0] = 1\n r = 0\n for d in S:\n r = (d * t + r) % M\n ans += c[r]\n c[r] += 1\n t = t * 10 % M\n return ans\n\n\nprint((solve(S)))\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\n\ndef solve(S):\n M = 2019\n t = 1\n ans = 0\n c = np.zeros(M, dtype=np.int64)\n c[0] = 1\n r = 0\n for d in S:\n r = (d * t + r) % M\n ans += c[r]\n c[r] += 1\n t = t * 10 % M\n return ans\n\n\ndef cc_export():\n from numba.pycc import CC\n\n cc = CC(\"my_module\")\n cc.export(\"solve\", \"i8(i4[:])\")(solve)\n cc.compile()\n\n\nif __name__ == \"__main__\":\n import sys\n\n if sys.argv[-1] == \"ONLINE_JUDGE\":\n cc_export()\n exit(0)\n from my_module import solve\n\n S = sys.stdin.buffer.readline().decode(\"utf-8\").rstrip()\n S = np.array([int(d) for d in S[::-1]], dtype=np.int32)\n print((solve(S)))\n","code_same":false,"relative_loc_diff_percent":35.2941176471,"diff":["-import numba","-S = sys.stdin.buffer.readline().decode(\"utf-8\").rstrip()","-S = np.array([int(d) for d in S[::-1]], dtype=np.int32)","-","-@numba.njit(numba.i8(numba.typeof(S)), cache=True)","-print((solve(S)))","+def cc_export():","+ from numba.pycc import CC","+","+ cc = CC(\"my_module\")","+ cc.export(\"solve\", \"i8(i4[:])\")(solve)","+ cc.compile()","+","+","+if __name__ == \"__main__\":","+ import sys","+","+ if sys.argv[-1] == \"ONLINE_JUDGE\":","+ cc_export()","+ exit(0)","+ from my_module import solve","+","+ S = sys.stdin.buffer.readline().decode(\"utf-8\").rstrip()","+ S = np.array([int(d) for d in S[::-1]], dtype=np.int32)","+ print((solve(S)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0373723729,"measured_runtime_v1":0.3224958591,"runtime_lift":0.1158848147,"key":["s067562086","s689557085"]} +{"user_id":"u400765446","problem_id":"p02386","language":"python","submission_id_v0":"s746365940","submission_id_v1":"s240023923","cpu_time_v0":1640,"cpu_time_v1":80,"memory_v0":8212,"memory_v1":5616,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.12,"input":"class Dice:\n\n\n\n def __init__(self):\n\n # \u521d\u671f\u5024\u304c\u306a\u3044\u5834\u5408\n\n # \u4e0a, \u5357\u3001\u6771\u3001\u897f\u3001\u5317\u3001\u4e0b\u306b\u305d\u308c\u305e\u308c1, 2, 3, 4, 5, 6\u304c\u304f\u308b\u60f3\u5b9a\n\n self.t = 1\n\n self.s = 2\n\n self.e = 3\n\n self.w = 4\n\n self.n = 5\n\n self.b = 6\n\n self.rotway = {\"S\": 0, \"N\": 1, \"E\": 2, \"W\": 3}\n\n\n\n def __init__(self, t, s, e, w, n, b):\n\n # \u521d\u671f\u5024\u304c\u6307\u5b9a\u3055\u308c\u308b\u5834\u5408\n\n self.t = t\n\n self.s = s\n\n self.e = e\n\n self.w = w\n\n self.n = n\n\n self.b = b\n\n self.rotway = {\"S\": 0, \"N\": 1, \"E\": 2, \"W\": 3}\n\n\n\n def rot(self, way):\n\n if way == 0:\n\n self.t, self.s, self.e, self.w, self.n, self.b = self.n, self.t, self.e, self.w, self.b, self.s\n\n elif way == 1:\n\n self.t, self.s, self.e, self.w, self.n, self.b = self.s, self.b, self.e, self.w, self.t, self.n\n\n elif way == 2:\n\n self.t, self.s, self.e, self.w, self.n, self.b = self.w, self.s, self.t, self.b, self.n, self.e\n\n elif way == 3:\n\n self.t, self.s, self.e, self.w, self.n, self.b = self.e, self.s, self.b, self.t, self.n, self.w\n\n \n\n\n\ndef main():\n\n import random\n\n\n\n n = int(eval(input()))\n\n diceList = [[0 for _ in range(6)] for _ in range(n)]\n\n for i in range(n):\n\n diceList[i][0],diceList[i][1],diceList[i][2],diceList[i][3],diceList[i][4],diceList[i][5] = list(map(int, input().split()))\n\n\n\n flag = 0\n\n\n\n # 2\u3064\u76ee\u4ee5\u964d\u306e\u3055\u3044\u3053\u308d\u304c\u3001\u4ee5\u524d\u306e\u3055\u3044\u3053\u308d\u3068\u4e00\u81f4\u3057\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u3044\u304f\u3002\n\n for i in range(1, n):\n\n if flag == 1:\n\n break\n\n else:\n\n dice_a = Dice(diceList[i][0],diceList[i][1],diceList[i][2],diceList[i][3],diceList[i][4],diceList[i][5])\n\n for j in range(i):\n\n dice_b = Dice(diceList[j][0],diceList[j][1],diceList[j][2],diceList[j][3],diceList[j][4],diceList[j][5])\n\n\n\n for _ in range(100):\n\n if (dice_a.t, dice_a.s, dice_a.e, dice_a.w, dice_a.n, dice_a.b) == (dice_b.t, dice_b.s, dice_b.e, dice_b.w, dice_b.n, dice_b.b):\n\n flag = 1\n\n break\n\n else:\n\n seed = random.randint(0, 3)\n\n dice_a.rot(seed)\n\n\n\n if flag == 0:\n\n print(\"Yes\")\n\n else:\n\n print(\"No\")\n\n\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n\n\n","target":"def main():\n\n n = int(eval(input()))\n\n dices=[]\n\n same = 0\n\n for _ in range(n):\n\n dices.append(list(map(int, input().split())))\n\n\n\n for i in range(n-1):\n\n for j in range(i+1,n):\n\n same += check_dice(dices[i], dices[j])\n\n if same >= 1:\n\n print('No')\n\n break\n\n\n\n if same == 0:\n\n print('Yes')\n\n\n\n\n\ndef check_dice(f, s):\n\n yes = 0\n\n for _ in range(4):\n\n s[0],s[2],s[5],s[3] = s[2],s[5],s[3],s[0]\n\n for _ in range(4):\n\n s[1],s[2],s[4],s[3] = s[2],s[4],s[3],s[1]\n\n if f == s:\n\n yes = 1\n\n\n\n for _ in range(4):\n\n s[0],s[1],s[5],s[4] = s[1],s[5],s[4],s[0]\n\n for _ in range(4):\n\n s[1],s[2],s[4],s[3] = s[2],s[4],s[3],s[1]\n\n if f == s:\n\n yes = 1\n\n\n\n return yes\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":71,"code_v1_loc":38,"code_v0_num_chars":2279,"code_v1_num_chars":879,"code_v0_no_empty_lines":"class Dice:\n def __init__(self):\n # \u521d\u671f\u5024\u304c\u306a\u3044\u5834\u5408\n # \u4e0a, \u5357\u3001\u6771\u3001\u897f\u3001\u5317\u3001\u4e0b\u306b\u305d\u308c\u305e\u308c1, 2, 3, 4, 5, 6\u304c\u304f\u308b\u60f3\u5b9a\n self.t = 1\n self.s = 2\n self.e = 3\n self.w = 4\n self.n = 5\n self.b = 6\n self.rotway = {\"S\": 0, \"N\": 1, \"E\": 2, \"W\": 3}\n\n def __init__(self, t, s, e, w, n, b):\n # \u521d\u671f\u5024\u304c\u6307\u5b9a\u3055\u308c\u308b\u5834\u5408\n self.t = t\n self.s = s\n self.e = e\n self.w = w\n self.n = n\n self.b = b\n self.rotway = {\"S\": 0, \"N\": 1, \"E\": 2, \"W\": 3}\n\n def rot(self, way):\n if way == 0:\n self.t, self.s, self.e, self.w, self.n, self.b = (\n self.n,\n self.t,\n self.e,\n self.w,\n self.b,\n self.s,\n )\n elif way == 1:\n self.t, self.s, self.e, self.w, self.n, self.b = (\n self.s,\n self.b,\n self.e,\n self.w,\n self.t,\n self.n,\n )\n elif way == 2:\n self.t, self.s, self.e, self.w, self.n, self.b = (\n self.w,\n self.s,\n self.t,\n self.b,\n self.n,\n self.e,\n )\n elif way == 3:\n self.t, self.s, self.e, self.w, self.n, self.b = (\n self.e,\n self.s,\n self.b,\n self.t,\n self.n,\n self.w,\n )\n\n\ndef main():\n import random\n\n n = int(eval(input()))\n diceList = [[0 for _ in range(6)] for _ in range(n)]\n for i in range(n):\n (\n diceList[i][0],\n diceList[i][1],\n diceList[i][2],\n diceList[i][3],\n diceList[i][4],\n diceList[i][5],\n ) = list(map(int, input().split()))\n flag = 0\n # 2\u3064\u76ee\u4ee5\u964d\u306e\u3055\u3044\u3053\u308d\u304c\u3001\u4ee5\u524d\u306e\u3055\u3044\u3053\u308d\u3068\u4e00\u81f4\u3057\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u3044\u304f\u3002\n for i in range(1, n):\n if flag == 1:\n break\n else:\n dice_a = Dice(\n diceList[i][0],\n diceList[i][1],\n diceList[i][2],\n diceList[i][3],\n diceList[i][4],\n diceList[i][5],\n )\n for j in range(i):\n dice_b = Dice(\n diceList[j][0],\n diceList[j][1],\n diceList[j][2],\n diceList[j][3],\n diceList[j][4],\n diceList[j][5],\n )\n for _ in range(100):\n if (dice_a.t, dice_a.s, dice_a.e, dice_a.w, dice_a.n, dice_a.b) == (\n dice_b.t,\n dice_b.s,\n dice_b.e,\n dice_b.w,\n dice_b.n,\n dice_b.b,\n ):\n flag = 1\n break\n else:\n seed = random.randint(0, 3)\n dice_a.rot(seed)\n if flag == 0:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"def main():\n n = int(eval(input()))\n dices = []\n same = 0\n for _ in range(n):\n dices.append(list(map(int, input().split())))\n for i in range(n - 1):\n for j in range(i + 1, n):\n same += check_dice(dices[i], dices[j])\n if same >= 1:\n print(\"No\")\n break\n if same == 0:\n print(\"Yes\")\n\n\ndef check_dice(f, s):\n yes = 0\n for _ in range(4):\n s[0], s[2], s[5], s[3] = s[2], s[5], s[3], s[0]\n for _ in range(4):\n s[1], s[2], s[4], s[3] = s[2], s[4], s[3], s[1]\n if f == s:\n yes = 1\n for _ in range(4):\n s[0], s[1], s[5], s[4] = s[1], s[5], s[4], s[0]\n for _ in range(4):\n s[1], s[2], s[4], s[3] = s[2], s[4], s[3], s[1]\n if f == s:\n yes = 1\n return yes\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":46.4788732394,"diff":["-class Dice:","- def __init__(self):","- # \u521d\u671f\u5024\u304c\u306a\u3044\u5834\u5408","- # \u4e0a, \u5357\u3001\u6771\u3001\u897f\u3001\u5317\u3001\u4e0b\u306b\u305d\u308c\u305e\u308c1, 2, 3, 4, 5, 6\u304c\u304f\u308b\u60f3\u5b9a","- self.t = 1","- self.s = 2","- self.e = 3","- self.w = 4","- self.n = 5","- self.b = 6","- self.rotway = {\"S\": 0, \"N\": 1, \"E\": 2, \"W\": 3}","-","- def __init__(self, t, s, e, w, n, b):","- # \u521d\u671f\u5024\u304c\u6307\u5b9a\u3055\u308c\u308b\u5834\u5408","- self.t = t","- self.s = s","- self.e = e","- self.w = w","- self.n = n","- self.b = b","- self.rotway = {\"S\": 0, \"N\": 1, \"E\": 2, \"W\": 3}","-","- def rot(self, way):","- if way == 0:","- self.t, self.s, self.e, self.w, self.n, self.b = (","- self.n,","- self.t,","- self.e,","- self.w,","- self.b,","- self.s,","- )","- elif way == 1:","- self.t, self.s, self.e, self.w, self.n, self.b = (","- self.s,","- self.b,","- self.e,","- self.w,","- self.t,","- self.n,","- )","- elif way == 2:","- self.t, self.s, self.e, self.w, self.n, self.b = (","- self.w,","- self.s,","- self.t,","- self.b,","- self.n,","- self.e,","- )","- elif way == 3:","- self.t, self.s, self.e, self.w, self.n, self.b = (","- self.e,","- self.s,","- self.b,","- self.t,","- self.n,","- self.w,","- )","+def main():","+ n = int(eval(input()))","+ dices = []","+ same = 0","+ for _ in range(n):","+ dices.append(list(map(int, input().split())))","+ for i in range(n - 1):","+ for j in range(i + 1, n):","+ same += check_dice(dices[i], dices[j])","+ if same >= 1:","+ print(\"No\")","+ break","+ if same == 0:","+ print(\"Yes\")","-def main():","- import random","-","- n = int(eval(input()))","- diceList = [[0 for _ in range(6)] for _ in range(n)]","- for i in range(n):","- (","- diceList[i][0],","- diceList[i][1],","- diceList[i][2],","- diceList[i][3],","- diceList[i][4],","- diceList[i][5],","- ) = list(map(int, input().split()))","- flag = 0","- # 2\u3064\u76ee\u4ee5\u964d\u306e\u3055\u3044\u3053\u308d\u304c\u3001\u4ee5\u524d\u306e\u3055\u3044\u3053\u308d\u3068\u4e00\u81f4\u3057\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u3044\u304f\u3002","- for i in range(1, n):","- if flag == 1:","- break","- else:","- dice_a = Dice(","- diceList[i][0],","- diceList[i][1],","- diceList[i][2],","- diceList[i][3],","- diceList[i][4],","- diceList[i][5],","- )","- for j in range(i):","- dice_b = Dice(","- diceList[j][0],","- diceList[j][1],","- diceList[j][2],","- diceList[j][3],","- diceList[j][4],","- diceList[j][5],","- )","- for _ in range(100):","- if (dice_a.t, dice_a.s, dice_a.e, dice_a.w, dice_a.n, dice_a.b) == (","- dice_b.t,","- dice_b.s,","- dice_b.e,","- dice_b.w,","- dice_b.n,","- dice_b.b,","- ):","- flag = 1","- break","- else:","- seed = random.randint(0, 3)","- dice_a.rot(seed)","- if flag == 0:","- print(\"Yes\")","- else:","- print(\"No\")","+def check_dice(f, s):","+ yes = 0","+ for _ in range(4):","+ s[0], s[2], s[5], s[3] = s[2], s[5], s[3], s[0]","+ for _ in range(4):","+ s[1], s[2], s[4], s[3] = s[2], s[4], s[3], s[1]","+ if f == s:","+ yes = 1","+ for _ in range(4):","+ s[0], s[1], s[5], s[4] = s[1], s[5], s[4], s[0]","+ for _ in range(4):","+ s[1], s[2], s[4], s[3] = s[2], s[4], s[3], s[1]","+ if f == s:","+ yes = 1","+ return yes"],"diff_only_import_comment":false,"measured_runtime_v0":0.0448515472,"measured_runtime_v1":0.0361153688,"runtime_lift":1.2418964188,"key":["s746365940","s240023923"]} +{"user_id":"u933622697","problem_id":"p03478","language":"python","submission_id_v0":"s742228205","submission_id_v1":"s931890347","cpu_time_v0":38,"cpu_time_v1":35,"memory_v0":3060,"memory_v1":3424,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.89,"input":"n, a, b = list(map(int, input().split()))\n\ntotal_val = 0\n\nfor i in range(1, n+1):\n\n i_str = str(i)\n\n digits = list(i_str)\n\n sum_digit = sum([int(digit) for digit in digits])\n\n if sum_digit >= a and sum_digit <= b:\n\n total_val += i\n\nprint(total_val)","target":"n, a, b = list(map(int, input().split()))\n\ncanditates = [i for i in range(1, n+1) \n\n if a <= sum(list(map(int, list(str(i))))) <= b]\n\nprint((sum(canditates)))","code_v0_loc":9,"code_v1_loc":4,"code_v0_num_chars":261,"code_v1_num_chars":163,"code_v0_no_empty_lines":"n, a, b = list(map(int, input().split()))\ntotal_val = 0\nfor i in range(1, n + 1):\n i_str = str(i)\n digits = list(i_str)\n sum_digit = sum([int(digit) for digit in digits])\n if sum_digit >= a and sum_digit <= b:\n total_val += i\nprint(total_val)\n","code_v1_no_empty_lines":"n, a, b = list(map(int, input().split()))\ncanditates = [i for i in range(1, n + 1) if a <= sum(list(map(int, list(str(i))))) <= b]\nprint((sum(canditates)))\n","code_same":false,"relative_loc_diff_percent":55.5555555556,"diff":["-total_val = 0","-for i in range(1, n + 1):","- i_str = str(i)","- digits = list(i_str)","- sum_digit = sum([int(digit) for digit in digits])","- if sum_digit >= a and sum_digit <= b:","- total_val += i","-print(total_val)","+canditates = [i for i in range(1, n + 1) if a <= sum(list(map(int, list(str(i))))) <= b]","+print((sum(canditates)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0447727642,"measured_runtime_v1":0.0470381541,"runtime_lift":0.9518393106,"key":["s742228205","s931890347"]} +{"user_id":"u794173881","problem_id":"p03064","language":"python","submission_id_v0":"s979940654","submission_id_v1":"s476774613","cpu_time_v0":2048,"cpu_time_v1":1342,"memory_v0":457096,"memory_v1":43612,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":34.47,"input":"n = int(eval(input()))\n\na = [int(eval(input())) for i in range(n)]\n\nsum_a = sum(a)\n\nMOD = 998244353\n\n\n\ndp = [[0] * (sum_a + 1) for i in range(n + 1)]\n\ndp[0][0] = 1\n\nfor i in range(n):\n\n for j in range(sum_a + 1):\n\n # \u9078\u3076\u3068\u304d\n\n if j - a[i] >= 0:\n\n dp[i + 1][j] += dp[i][j - a[i]]\n\n # \u9078\u3070\u306a\u3044\u3068\u304d\n\n dp[i + 1][j] += dp[i][j] * 2\n\n dp[i + 1][j] %= MOD\n\n \n\ndq = [[0] * (sum_a + 1) for i in range(n + 1)]\n\ndq[0][0] = 1\n\nfor i in range(n):\n\n for j in range(sum_a + 1):\n\n # \u9078\u3076\u3068\u304d\n\n if j - a[i] >= 0:\n\n dq[i + 1][j] += dq[i][j - a[i]]\n\n # \u9078\u3070\u306a\u3044\u3068\u304d\n\n dq[i + 1][j] += dq[i][j]\n\n dq[i + 1][j] %= MOD\n\n\n\nans = 0\n\nfor j in range(sum_a + 1):\n\n if sum_a <= j * 2:\n\n ans += dp[-1][j] * 3\n\n ans %= MOD\n\n\n\nif sum_a % 2 == 0:\n\n ans -= dq[-1][sum_a \/\/ 2] * 3\n\n\n\nprint(((3 ** n - ans) % MOD))","target":"n = int(eval(input()))\n\na = [int(eval(input())) for i in range(n)]\n\nsum_a = sum(a)\n\nMOD = 998244353\n\n\n\ndp = [0] * (sum_a + 1)\n\ndp[0] = 1\n\nfor i in range(n):\n\n for j in range(sum_a + 1)[::-1]:\n\n # \u9078\u3070\u306a\u3044\u3068\u304d\n\n dp[j] += dp[j]\n\n if j - a[i] >= 0:\n\n dp[j] += dp[j - a[i]]\n\n dp[j] %= MOD\n\n \n\ndq = [0] * (sum_a + 1)\n\ndq[0] = 1\n\nfor i in range(n):\n\n for j in range(sum_a + 1)[::-1]:\n\n # \u9078\u3076\u3068\u304d\n\n if j - a[i] >= 0:\n\n dq[j] += dq[j - a[i]]\n\n dq[j] %= MOD\n\n else:\n\n break\n\n\n\nans = 0\n\nfor j in range(sum_a + 1):\n\n if sum_a <= j * 2:\n\n ans += dp[j] * 3\n\n ans %= MOD\n\n\n\nif sum_a % 2 == 0:\n\n ans -= dq[sum_a \/\/ 2] * 3\n\n\n\nprint(((3 ** n - ans) % MOD))","code_v0_loc":37,"code_v1_loc":36,"code_v0_num_chars":870,"code_v1_num_chars":742,"code_v0_no_empty_lines":"n = int(eval(input()))\na = [int(eval(input())) for i in range(n)]\nsum_a = sum(a)\nMOD = 998244353\ndp = [[0] * (sum_a + 1) for i in range(n + 1)]\ndp[0][0] = 1\nfor i in range(n):\n for j in range(sum_a + 1):\n # \u9078\u3076\u3068\u304d\n if j - a[i] >= 0:\n dp[i + 1][j] += dp[i][j - a[i]]\n # \u9078\u3070\u306a\u3044\u3068\u304d\n dp[i + 1][j] += dp[i][j] * 2\n dp[i + 1][j] %= MOD\ndq = [[0] * (sum_a + 1) for i in range(n + 1)]\ndq[0][0] = 1\nfor i in range(n):\n for j in range(sum_a + 1):\n # \u9078\u3076\u3068\u304d\n if j - a[i] >= 0:\n dq[i + 1][j] += dq[i][j - a[i]]\n # \u9078\u3070\u306a\u3044\u3068\u304d\n dq[i + 1][j] += dq[i][j]\n dq[i + 1][j] %= MOD\nans = 0\nfor j in range(sum_a + 1):\n if sum_a <= j * 2:\n ans += dp[-1][j] * 3\n ans %= MOD\nif sum_a % 2 == 0:\n ans -= dq[-1][sum_a \/\/ 2] * 3\nprint(((3**n - ans) % MOD))\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = [int(eval(input())) for i in range(n)]\nsum_a = sum(a)\nMOD = 998244353\ndp = [0] * (sum_a + 1)\ndp[0] = 1\nfor i in range(n):\n for j in range(sum_a + 1)[::-1]:\n # \u9078\u3070\u306a\u3044\u3068\u304d\n dp[j] += dp[j]\n if j - a[i] >= 0:\n dp[j] += dp[j - a[i]]\n dp[j] %= MOD\ndq = [0] * (sum_a + 1)\ndq[0] = 1\nfor i in range(n):\n for j in range(sum_a + 1)[::-1]:\n # \u9078\u3076\u3068\u304d\n if j - a[i] >= 0:\n dq[j] += dq[j - a[i]]\n dq[j] %= MOD\n else:\n break\nans = 0\nfor j in range(sum_a + 1):\n if sum_a <= j * 2:\n ans += dp[j] * 3\n ans %= MOD\nif sum_a % 2 == 0:\n ans -= dq[sum_a \/\/ 2] * 3\nprint(((3**n - ans) % MOD))\n","code_same":false,"relative_loc_diff_percent":2.7027027027,"diff":["-dp = [[0] * (sum_a + 1) for i in range(n + 1)]","-dp[0][0] = 1","+dp = [0] * (sum_a + 1)","+dp[0] = 1","- for j in range(sum_a + 1):","+ for j in range(sum_a + 1)[::-1]:","+ # \u9078\u3070\u306a\u3044\u3068\u304d","+ dp[j] += dp[j]","+ if j - a[i] >= 0:","+ dp[j] += dp[j - a[i]]","+ dp[j] %= MOD","+dq = [0] * (sum_a + 1)","+dq[0] = 1","+for i in range(n):","+ for j in range(sum_a + 1)[::-1]:","- dp[i + 1][j] += dp[i][j - a[i]]","- # \u9078\u3070\u306a\u3044\u3068\u304d","- dp[i + 1][j] += dp[i][j] * 2","- dp[i + 1][j] %= MOD","-dq = [[0] * (sum_a + 1) for i in range(n + 1)]","-dq[0][0] = 1","-for i in range(n):","- for j in range(sum_a + 1):","- # \u9078\u3076\u3068\u304d","- if j - a[i] >= 0:","- dq[i + 1][j] += dq[i][j - a[i]]","- # \u9078\u3070\u306a\u3044\u3068\u304d","- dq[i + 1][j] += dq[i][j]","- dq[i + 1][j] %= MOD","+ dq[j] += dq[j - a[i]]","+ dq[j] %= MOD","+ else:","+ break","- ans += dp[-1][j] * 3","+ ans += dp[j] * 3","- ans -= dq[-1][sum_a \/\/ 2] * 3","+ ans -= dq[sum_a \/\/ 2] * 3"],"diff_only_import_comment":false,"measured_runtime_v0":0.0404995248,"measured_runtime_v1":0.0394414649,"runtime_lift":1.0268260807,"key":["s979940654","s476774613"]} +{"user_id":"u844005364","problem_id":"p03854","language":"python","submission_id_v0":"s307319425","submission_id_v1":"s090711706","cpu_time_v0":25,"cpu_time_v1":19,"memory_v0":9588,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.0,"input":"import re\n\nprint((\"YES\" if re.match(\"^(eraser?|dream(er)?)+$\",eval(input())) else \"NO\"))","target":"s = input().replace(\"eraser\",\" \").replace(\"erase\",\" \").replace(\"dreamer\",\" \").replace(\"dream\",\" \").replace(\" \", \"\")\n\nif s:\n\n print(\"NO\")\n\nelse:\n\n print(\"YES\")\n","code_v0_loc":2,"code_v1_loc":5,"code_v0_num_chars":80,"code_v1_num_chars":165,"code_v0_no_empty_lines":"import re\n\nprint((\"YES\" if re.match(\"^(eraser?|dream(er)?)+$\", eval(input())) else \"NO\"))\n","code_v1_no_empty_lines":"s = (\n input()\n .replace(\"eraser\", \" \")\n .replace(\"erase\", \" \")\n .replace(\"dreamer\", \" \")\n .replace(\"dream\", \" \")\n .replace(\" \", \"\")\n)\nif s:\n print(\"NO\")\nelse:\n print(\"YES\")\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-import re","-","-print((\"YES\" if re.match(\"^(eraser?|dream(er)?)+$\", eval(input())) else \"NO\"))","+s = (","+ input()","+ .replace(\"eraser\", \" \")","+ .replace(\"erase\", \" \")","+ .replace(\"dreamer\", \" \")","+ .replace(\"dream\", \" \")","+ .replace(\" \", \"\")","+)","+if s:","+ print(\"NO\")","+else:","+ print(\"YES\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1273432539,"measured_runtime_v1":0.0564139359,"runtime_lift":2.2573013529,"key":["s307319425","s090711706"]} +{"user_id":"u725662235","problem_id":"p03745","language":"python","submission_id_v0":"s289247710","submission_id_v1":"s786084878","cpu_time_v0":110,"cpu_time_v1":93,"memory_v0":11320,"memory_v1":11320,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.45,"input":"n = eval(input())\n\na = list(map(int, input().split()))\n\n\n\nb = []\n\nfor i in range(1, n):\n\n if a[i] - a[i-1] != 0:\n\n b.append(a[i] - a[i-1])\n\ndont_mind = True\n\nc = 1\n\ni = 1\n\nwhile i < len(b):\n\n prev = b[i-1]\n\n t = prev * b[i]\n\n if t >= 0:\n\n i += 1\n\n continue\n\n if t < 0:\n\n c += 1\n\n i += 2\n\n continue\n\n i += 1\n\nprint(c)","target":"# coding: utf-8\n\n# AGC 013 a \n\n# Here your code !\n\nn = eval(input())\n\nif n <= 2:\n\n print(1)\n\n exit()\n\n \n\na = list(map(int, input().split()))\n\n\n\nc = 1\n\n\n\nstatus = \"n\"\n\ni = 1\n\nwhile i < n:\n\n if status == \"n\":\n\n if a[i-1] < a[i]:\n\n status = \"i\"\n\n elif a[i-1] > a[i]:\n\n status = \"d\"\n\n i += 1\n\n \n\n elif status == \"i\":\n\n if a[i-1] <= a[i]:\n\n i += 1\n\n elif a[i-1] > a[i]:\n\n status = \"n\"\n\n c += 1\n\n i += 1\n\n \n\n elif status == \"d\":\n\n if a[i-1] < a[i]:\n\n status = \"n\"\n\n c += 1\n\n i += 1\n\n elif a[i-1] >= a[i]:\n\n i += 1\n\nprint(c)","code_v0_loc":22,"code_v1_loc":38,"code_v0_num_chars":368,"code_v1_num_chars":698,"code_v0_no_empty_lines":"n = eval(input())\na = list(map(int, input().split()))\nb = []\nfor i in range(1, n):\n if a[i] - a[i - 1] != 0:\n b.append(a[i] - a[i - 1])\ndont_mind = True\nc = 1\ni = 1\nwhile i < len(b):\n prev = b[i - 1]\n t = prev * b[i]\n if t >= 0:\n i += 1\n continue\n if t < 0:\n c += 1\n i += 2\n continue\n i += 1\nprint(c)\n","code_v1_no_empty_lines":"# coding: utf-8\n# AGC 013 a\n# Here your code !\nn = eval(input())\nif n <= 2:\n print(1)\n exit()\na = list(map(int, input().split()))\nc = 1\nstatus = \"n\"\ni = 1\nwhile i < n:\n if status == \"n\":\n if a[i - 1] < a[i]:\n status = \"i\"\n elif a[i - 1] > a[i]:\n status = \"d\"\n i += 1\n elif status == \"i\":\n if a[i - 1] <= a[i]:\n i += 1\n elif a[i - 1] > a[i]:\n status = \"n\"\n c += 1\n i += 1\n elif status == \"d\":\n if a[i - 1] < a[i]:\n status = \"n\"\n c += 1\n i += 1\n elif a[i - 1] >= a[i]:\n i += 1\nprint(c)\n","code_same":false,"relative_loc_diff_percent":42.1052631579,"diff":["+# coding: utf-8","+# AGC 013 a","+# Here your code !","+if n <= 2:","+ print(1)","+ exit()","-b = []","-for i in range(1, n):","- if a[i] - a[i - 1] != 0:","- b.append(a[i] - a[i - 1])","-dont_mind = True","+status = \"n\"","-while i < len(b):","- prev = b[i - 1]","- t = prev * b[i]","- if t >= 0:","+while i < n:","+ if status == \"n\":","+ if a[i - 1] < a[i]:","+ status = \"i\"","+ elif a[i - 1] > a[i]:","+ status = \"d\"","- continue","- if t < 0:","- c += 1","- i += 2","- continue","- i += 1","+ elif status == \"i\":","+ if a[i - 1] <= a[i]:","+ i += 1","+ elif a[i - 1] > a[i]:","+ status = \"n\"","+ c += 1","+ i += 1","+ elif status == \"d\":","+ if a[i - 1] < a[i]:","+ status = \"n\"","+ c += 1","+ i += 1","+ elif a[i - 1] >= a[i]:","+ i += 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.1515509343,"measured_runtime_v1":0.0459488862,"runtime_lift":3.2982504465,"key":["s289247710","s786084878"]} +{"user_id":"u699296734","problem_id":"p03324","language":"python","submission_id_v0":"s078580282","submission_id_v1":"s247146242","cpu_time_v0":310,"cpu_time_v1":27,"memory_v0":8932,"memory_v1":9092,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":91.29,"input":"d, n = list(map(int, input().split()))\n\nstart = 100 ** d\n\ncounter = 0\n\nwhile True:\n\n if start % (100 ** d) == 0 and start % (100 ** (d + 1)) != 0:\n\n counter += 1\n\n if counter == n:\n\n print(start)\n\n break\n\n start += 1\n","target":"d, n = list(map(int, input().split()))\n\nstart = 100 ** d\n\ncounter = 0\n\nwhile True:\n\n if start % (100 ** d) == 0 and start % (100 ** (d + 1)) != 0:\n\n counter += 1\n\n if counter == n:\n\n print(start)\n\n break\n\n start += 100 ** d\n","code_v0_loc":10,"code_v1_loc":10,"code_v0_num_chars":241,"code_v1_num_chars":248,"code_v0_no_empty_lines":"d, n = list(map(int, input().split()))\nstart = 100**d\ncounter = 0\nwhile True:\n if start % (100**d) == 0 and start % (100 ** (d + 1)) != 0:\n counter += 1\n if counter == n:\n print(start)\n break\n start += 1\n","code_v1_no_empty_lines":"d, n = list(map(int, input().split()))\nstart = 100**d\ncounter = 0\nwhile True:\n if start % (100**d) == 0 and start % (100 ** (d + 1)) != 0:\n counter += 1\n if counter == n:\n print(start)\n break\n start += 100**d\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- start += 1","+ start += 100**d"],"diff_only_import_comment":false,"measured_runtime_v0":0.3240975738,"measured_runtime_v1":0.0404712677,"runtime_lift":8.0080904823,"key":["s078580282","s247146242"]} +{"user_id":"u802963389","problem_id":"p03447","language":"python","submission_id_v0":"s379499589","submission_id_v1":"s529876200","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":3316,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"X = int(eval(input()))\n\nA = int(eval(input()))\n\nB = int(eval(input()))\n\nprint(((X - A) % B))","target":"X, A, B = [int(eval(input())) for _ in range(3)]\n\nprint(((X-A) % B))","code_v0_loc":4,"code_v1_loc":2,"code_v0_num_chars":72,"code_v1_num_chars":60,"code_v0_no_empty_lines":"X = int(eval(input()))\nA = int(eval(input()))\nB = int(eval(input()))\nprint(((X - A) % B))\n","code_v1_no_empty_lines":"X, A, B = [int(eval(input())) for _ in range(3)]\nprint(((X - A) % B))\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-X = int(eval(input()))","-A = int(eval(input()))","-B = int(eval(input()))","+X, A, B = [int(eval(input())) for _ in range(3)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0398127499,"measured_runtime_v1":0.0405057058,"runtime_lift":0.982892386,"key":["s379499589","s529876200"]} +{"user_id":"u600402037","problem_id":"p02990","language":"python","submission_id_v0":"s955450341","submission_id_v1":"s716942858","cpu_time_v0":612,"cpu_time_v1":545,"memory_v0":46940,"memory_v1":3944,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.95,"input":"from operator import mul\n\nfrom functools import reduce\n\n\n\nMOD = 10**9 + 7\n\n\n\ndef cmb(n, r):\n\n if n < r:\n\n return 0\n\n r = min(n-r, r)\n\n if r == 0:\n\n return 1\n\n numer = reduce(mul, list(range(n, n-r, -1)))\n\n denom = reduce(mul, list(range(1, r+1)))\n\n return numer \/\/ denom % MOD\n\n\n\nN, K = list(map(int, input().split()))\n\nfor i in range(1, K+1):\n\n print((cmb(K-1, i-1) * cmb(N-K+1, i) % MOD))","target":"from operator import mul\n\nfrom functools import reduce\n\nMOD = 10 ** 9 + 7\n\n\n\nN, K = list(map(int, input().split()))\n\n\n\ndef cmb(n, r):\n\n if n < r:\n\n return 0\n\n r = min(r, n-r)\n\n if r == 0:\n\n return 1\n\n nume = reduce(mul, list(range(n, n-r, -1)))\n\n deno = reduce(mul, list(range(1, r+1)))\n\n \n\n return nume \/\/ deno % MOD\n\n\n\n# \u8d64\u3044\u30dc\u30fc\u30eb\u306e\u9593\u3068\u4e21\u7aef\uff08N-K+1\uff09\u306e\u4e2d\u304b\u3089i\u500b\u3092\u9078\u3076\n\nfor i in range(1, K+1):\n\n print((cmb((N-K+1), i) * cmb((K-1), i-1) % MOD))","code_v0_loc":18,"code_v1_loc":20,"code_v0_num_chars":405,"code_v1_num_chars":443,"code_v0_no_empty_lines":"from operator import mul\nfrom functools import reduce\n\nMOD = 10**9 + 7\n\n\ndef cmb(n, r):\n if n < r:\n return 0\n r = min(n - r, r)\n if r == 0:\n return 1\n numer = reduce(mul, list(range(n, n - r, -1)))\n denom = reduce(mul, list(range(1, r + 1)))\n return numer \/\/ denom % MOD\n\n\nN, K = list(map(int, input().split()))\nfor i in range(1, K + 1):\n print((cmb(K - 1, i - 1) * cmb(N - K + 1, i) % MOD))\n","code_v1_no_empty_lines":"from operator import mul\nfrom functools import reduce\n\nMOD = 10**9 + 7\nN, K = list(map(int, input().split()))\n\n\ndef cmb(n, r):\n if n < r:\n return 0\n r = min(r, n - r)\n if r == 0:\n return 1\n nume = reduce(mul, list(range(n, n - r, -1)))\n deno = reduce(mul, list(range(1, r + 1)))\n return nume \/\/ deno % MOD\n\n\n# \u8d64\u3044\u30dc\u30fc\u30eb\u306e\u9593\u3068\u4e21\u7aef\uff08N-K+1\uff09\u306e\u4e2d\u304b\u3089i\u500b\u3092\u9078\u3076\nfor i in range(1, K + 1):\n print((cmb((N - K + 1), i) * cmb((K - 1), i - 1) % MOD))\n","code_same":false,"relative_loc_diff_percent":10.0,"diff":["+N, K = list(map(int, input().split()))","- r = min(n - r, r)","+ r = min(r, n - r)","- numer = reduce(mul, list(range(n, n - r, -1)))","- denom = reduce(mul, list(range(1, r + 1)))","- return numer \/\/ denom % MOD","+ nume = reduce(mul, list(range(n, n - r, -1)))","+ deno = reduce(mul, list(range(1, r + 1)))","+ return nume \/\/ deno % MOD","-N, K = list(map(int, input().split()))","+# \u8d64\u3044\u30dc\u30fc\u30eb\u306e\u9593\u3068\u4e21\u7aef\uff08N-K+1\uff09\u306e\u4e2d\u304b\u3089i\u500b\u3092\u9078\u3076","- print((cmb(K - 1, i - 1) * cmb(N - K + 1, i) % MOD))","+ print((cmb((N - K + 1), i) * cmb((K - 1), i - 1) % MOD))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0448404474,"measured_runtime_v1":0.1273867521,"runtime_lift":0.3520024388,"key":["s955450341","s716942858"]} +{"user_id":"u852690916","problem_id":"p04045","language":"python","submission_id_v0":"s279041729","submission_id_v1":"s126867861","cpu_time_v0":212,"cpu_time_v1":190,"memory_v0":41324,"memory_v1":40812,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.38,"input":"N,K = list(map(int,input().split()))\n\nD = list(map(str,list(map(int,input().split()))))\n\n\n\nn = N\n\nwhile True:\n\n s = str(n)\n\n S = set(list(s))\n\n for c in S:\n\n if c in D:\n\n break\n\n else:\n\n break\n\n n += 1\n\nprint(n)","target":"N,K=list(map(int, input().split()))\n\nD=set(input().split())\n\n\n\ndef check(x):\n\n for c in str(x):\n\n if c in D: return False\n\n return True\n\n\n\nans = N\n\nwhile not check(ans): ans += 1\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":11,"code_v0_num_chars":239,"code_v1_num_chars":197,"code_v0_no_empty_lines":"N, K = list(map(int, input().split()))\nD = list(map(str, list(map(int, input().split()))))\nn = N\nwhile True:\n s = str(n)\n S = set(list(s))\n for c in S:\n if c in D:\n break\n else:\n break\n n += 1\nprint(n)\n","code_v1_no_empty_lines":"N, K = list(map(int, input().split()))\nD = set(input().split())\n\n\ndef check(x):\n for c in str(x):\n if c in D:\n return False\n return True\n\n\nans = N\nwhile not check(ans):\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-D = list(map(str, list(map(int, input().split()))))","-n = N","-while True:","- s = str(n)","- S = set(list(s))","- for c in S:","+D = set(input().split())","+","+","+def check(x):","+ for c in str(x):","- break","- else:","- break","- n += 1","-print(n)","+ return False","+ return True","+","+","+ans = N","+while not check(ans):","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0823637486,"measured_runtime_v1":0.0850636959,"runtime_lift":0.9682596984,"key":["s279041729","s126867861"]} +{"user_id":"u141786930","problem_id":"p02861","language":"python","submission_id_v0":"s122930293","submission_id_v1":"s674214464","cpu_time_v0":570,"cpu_time_v1":473,"memory_v0":4468,"memory_v1":4400,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.02,"input":"# C - Average Length\n\n\n\nN = int(eval(input()))\n\nP = [tuple(map(int, input().split())) for _ in range(N)]\n\n\n\ndef calcDist(Y):\n\n dist = 0\n\n for i in range(1, len(Y)):\n\n dist += pow(pow(P[Y[i]][0] - P[Y[i-1]][0], 2) + pow(P[Y[i]][1] - P[Y[i-1]][1], 2), 0.5)\n\n return dist\n\n\n\ndef dfs(X):\n\n global ans\n\n if len(X)==N:\n\n ans.append(calcDist(X))\n\n return\n\n for i in range(N):\n\n if i not in X:\n\n X.append(i)\n\n dfs(X)\n\n X.pop()\n\n\n\nans = []\n\nX = []\n\ndfs(X)\n\n\n\nprint((sum(ans)\/len(ans)))\n\n\n","target":"# C - Average Length\n\n\n\nimport itertools\n\n\n\nN = int(eval(input()))\n\nP = [tuple(map(int, input().split())) for _ in range(N)]\n\n\n\ndef calcDist(Y):\n\n dist = 0\n\n for i in range(1, len(Y)):\n\n dist += pow(pow(P[Y[i]][0] - P[Y[i-1]][0], 2) + pow(P[Y[i]][1] - P[Y[i-1]][1], 2), 0.5)\n\n return dist\n\n\n\ndef dfs(X):\n\n global ans\n\n if len(X)==N:\n\n ans.append(calcDist(X))\n\n return\n\n for i in range(N):\n\n if i not in X:\n\n X.append(i)\n\n dfs(X)\n\n X.pop()\n\n\n\nans = []\n\nX = []\n\n#dfs(X)\n\n\n\nfor X in itertools.permutations(list(range(N)),N):\n\n ans.append(calcDist(X))\n\n\n\nprint((sum(ans)\/len(ans)))\n\n\n","code_v0_loc":28,"code_v1_loc":33,"code_v0_num_chars":550,"code_v1_num_chars":648,"code_v0_no_empty_lines":"# C - Average Length\nN = int(eval(input()))\nP = [tuple(map(int, input().split())) for _ in range(N)]\n\n\ndef calcDist(Y):\n dist = 0\n for i in range(1, len(Y)):\n dist += pow(\n pow(P[Y[i]][0] - P[Y[i - 1]][0], 2) + pow(P[Y[i]][1] - P[Y[i - 1]][1], 2),\n 0.5,\n )\n return dist\n\n\ndef dfs(X):\n global ans\n if len(X) == N:\n ans.append(calcDist(X))\n return\n for i in range(N):\n if i not in X:\n X.append(i)\n dfs(X)\n X.pop()\n\n\nans = []\nX = []\ndfs(X)\nprint((sum(ans) \/ len(ans)))\n","code_v1_no_empty_lines":"# C - Average Length\nimport itertools\n\nN = int(eval(input()))\nP = [tuple(map(int, input().split())) for _ in range(N)]\n\n\ndef calcDist(Y):\n dist = 0\n for i in range(1, len(Y)):\n dist += pow(\n pow(P[Y[i]][0] - P[Y[i - 1]][0], 2) + pow(P[Y[i]][1] - P[Y[i - 1]][1], 2),\n 0.5,\n )\n return dist\n\n\ndef dfs(X):\n global ans\n if len(X) == N:\n ans.append(calcDist(X))\n return\n for i in range(N):\n if i not in X:\n X.append(i)\n dfs(X)\n X.pop()\n\n\nans = []\nX = []\n# dfs(X)\nfor X in itertools.permutations(list(range(N)), N):\n ans.append(calcDist(X))\nprint((sum(ans) \/ len(ans)))\n","code_same":false,"relative_loc_diff_percent":15.1515151515,"diff":["+import itertools","+","-dfs(X)","+# dfs(X)","+for X in itertools.permutations(list(range(N)), N):","+ ans.append(calcDist(X))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1127294064,"measured_runtime_v1":0.1031559944,"runtime_lift":1.0928051926,"key":["s122930293","s674214464"]} +{"user_id":"u747602774","problem_id":"p03795","language":"python","submission_id_v0":"s176032208","submission_id_v1":"s122773582","cpu_time_v0":168,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.88,"input":"N = int(eval(input()))\n\n\n\nprint((800*N - 200*(N\/\/15)))","target":"n = int(eval(input()))\n\nprint((n*800 - n\/\/15*200))\n","code_v0_loc":3,"code_v1_loc":2,"code_v0_num_chars":46,"code_v1_num_chars":43,"code_v0_no_empty_lines":"N = int(eval(input()))\nprint((800 * N - 200 * (N \/\/ 15)))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nprint((n * 800 - n \/\/ 15 * 200))\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["-N = int(eval(input()))","-print((800 * N - 200 * (N \/\/ 15)))","+n = int(eval(input()))","+print((n * 800 - n \/\/ 15 * 200))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1255376816,"measured_runtime_v1":0.0437459469,"runtime_lift":2.8696985776,"key":["s176032208","s122773582"]} +{"user_id":"u969850098","problem_id":"p03061","language":"python","submission_id_v0":"s018935044","submission_id_v1":"s523684782","cpu_time_v0":1306,"cpu_time_v1":882,"memory_v0":14400,"memory_v1":14428,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":32.47,"input":"N = int(eval(input()))\n\nA = list(map(int, input().split()))\n\nA = sorted(A)\n\n\n\ndef make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n \/\/ i:\n\n divisors.append(n\/\/i)\n\n \n\n return divisors\n\n\n\nif len(A) <= 2:\n\n print((max(A)))\n\n exit()\n\nelse:\n\n all_divisors = list(set(make_divisors(A[0]) + make_divisors(A[1])))\n\n\n\nans = 1\n\nfor divisor in all_divisors:\n\n cnt = 0\n\n for a in A:\n\n if a % divisor != 0:\n\n cnt += 1\n\n if cnt == 2:\n\n break\n\n if cnt < 2:\n\n ans = max(ans, divisor)\n\n\n\nprint(ans)","target":"import sys\n\n\n\nN = int(sys.stdin.readline())\n\nA = list(map(int, sys.stdin.readline().rstrip().split()))\n\nA = sorted(A)\n\n\n\ndef make_divisors(n):\n\n divisors = []\n\n for i in range(1, int(n**0.5)+1):\n\n if n % i == 0:\n\n divisors.append(i)\n\n if i != n \/\/ i:\n\n divisors.append(n\/\/i)\n\n \n\n return divisors\n\n\n\ndef main():\n\n if len(A) <= 2:\n\n print((max(A)))\n\n exit()\n\n else:\n\n all_divisors = list(set(make_divisors(A[0]) + make_divisors(A[1])))\n\n\n\n ans = 1\n\n for divisor in all_divisors:\n\n cnt = 0\n\n for a in A:\n\n if a % divisor != 0:\n\n cnt += 1\n\n if cnt == 2:\n\n break\n\n if cnt < 2:\n\n ans = max(ans, divisor)\n\n\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n main()","code_v0_loc":32,"code_v1_loc":38,"code_v0_num_chars":660,"code_v1_num_chars":828,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = list(map(int, input().split()))\nA = sorted(A)\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n \/\/ i:\n divisors.append(n \/\/ i)\n return divisors\n\n\nif len(A) <= 2:\n print((max(A)))\n exit()\nelse:\n all_divisors = list(set(make_divisors(A[0]) + make_divisors(A[1])))\nans = 1\nfor divisor in all_divisors:\n cnt = 0\n for a in A:\n if a % divisor != 0:\n cnt += 1\n if cnt == 2:\n break\n if cnt < 2:\n ans = max(ans, divisor)\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\nN = int(sys.stdin.readline())\nA = list(map(int, sys.stdin.readline().rstrip().split()))\nA = sorted(A)\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n \/\/ i:\n divisors.append(n \/\/ i)\n return divisors\n\n\ndef main():\n if len(A) <= 2:\n print((max(A)))\n exit()\n else:\n all_divisors = list(set(make_divisors(A[0]) + make_divisors(A[1])))\n ans = 1\n for divisor in all_divisors:\n cnt = 0\n for a in A:\n if a % divisor != 0:\n cnt += 1\n if cnt == 2:\n break\n if cnt < 2:\n ans = max(ans, divisor)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":15.7894736842,"diff":["-N = int(eval(input()))","-A = list(map(int, input().split()))","+import sys","+","+N = int(sys.stdin.readline())","+A = list(map(int, sys.stdin.readline().rstrip().split()))","-if len(A) <= 2:","- print((max(A)))","- exit()","-else:","- all_divisors = list(set(make_divisors(A[0]) + make_divisors(A[1])))","-ans = 1","-for divisor in all_divisors:","- cnt = 0","- for a in A:","- if a % divisor != 0:","- cnt += 1","- if cnt == 2:","- break","- if cnt < 2:","- ans = max(ans, divisor)","-print(ans)","+def main():","+ if len(A) <= 2:","+ print((max(A)))","+ exit()","+ else:","+ all_divisors = list(set(make_divisors(A[0]) + make_divisors(A[1])))","+ ans = 1","+ for divisor in all_divisors:","+ cnt = 0","+ for a in A:","+ if a % divisor != 0:","+ cnt += 1","+ if cnt == 2:","+ break","+ if cnt < 2:","+ ans = max(ans, divisor)","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0335862405,"measured_runtime_v1":0.0416965959,"runtime_lift":0.8054911868,"key":["s018935044","s523684782"]} +{"user_id":"u316341119","problem_id":"p02744","language":"python","submission_id_v0":"s501119293","submission_id_v1":"s981586044","cpu_time_v0":433,"cpu_time_v1":150,"memory_v0":60248,"memory_v1":4340,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.36,"input":"N = int(eval(input()))\n\n\n\ncset = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']\n\nsset = ['a'] * N\n\ndef rec(di, usedci):\n\n if di >= len(sset):\n\n print((''.join(sset)))\n\n return\n\n for i in range(usedci+1):\n\n sset[di] = cset[i]\n\n rec(di+1, usedci)\n\n sset[di] = cset[usedci+1]\n\n rec(di+1, usedci+1)\n\n\n\nrec(1, 0)\n","target":"N = int(eval(input()))\n\n\n\ncset = [chr(ord('a')+i) for i in range(N)]\n\nsset = ['a'] * N\n\ndef rec(di, usedci):\n\n if di >= len(sset):\n\n print((''.join(sset)))\n\n return\n\n for i in range(usedci+1):\n\n sset[di] = cset[i]\n\n rec(di+1, usedci)\n\n sset[di] = cset[usedci+1]\n\n rec(di+1, usedci+1)\n\n\n\nrec(1, 0)\n","code_v0_loc":15,"code_v1_loc":15,"code_v0_num_chars":344,"code_v1_num_chars":329,"code_v0_no_empty_lines":"N = int(eval(input()))\ncset = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\"]\nsset = [\"a\"] * N\n\n\ndef rec(di, usedci):\n if di >= len(sset):\n print((\"\".join(sset)))\n return\n for i in range(usedci + 1):\n sset[di] = cset[i]\n rec(di + 1, usedci)\n sset[di] = cset[usedci + 1]\n rec(di + 1, usedci + 1)\n\n\nrec(1, 0)\n","code_v1_no_empty_lines":"N = int(eval(input()))\ncset = [chr(ord(\"a\") + i) for i in range(N)]\nsset = [\"a\"] * N\n\n\ndef rec(di, usedci):\n if di >= len(sset):\n print((\"\".join(sset)))\n return\n for i in range(usedci + 1):\n sset[di] = cset[i]\n rec(di + 1, usedci)\n sset[di] = cset[usedci + 1]\n rec(di + 1, usedci + 1)\n\n\nrec(1, 0)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-cset = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\"]","+cset = [chr(ord(\"a\") + i) for i in range(N)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.1337666372,"measured_runtime_v1":0.0491204441,"runtime_lift":2.7232375395,"key":["s501119293","s981586044"]} +{"user_id":"u396495667","problem_id":"p03860","language":"python","submission_id_v0":"s111813236","submission_id_v1":"s355269893","cpu_time_v0":171,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.06,"input":"print(('A' + input().split()[1][0] +'C'))","target":"a,b,c = input().split()\n\nprint('A',b[0],'C',sep='')\n","code_v0_loc":1,"code_v1_loc":2,"code_v0_num_chars":39,"code_v1_num_chars":51,"code_v0_no_empty_lines":"print((\"A\" + input().split()[1][0] + \"C\"))\n","code_v1_no_empty_lines":"a, b, c = input().split()\nprint(\"A\", b[0], \"C\", sep=\"\")\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-print((\"A\" + input().split()[1][0] + \"C\"))","+a, b, c = input().split()","+print(\"A\", b[0], \"C\", sep=\"\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1155027273,"measured_runtime_v1":0.0417963357,"runtime_lift":2.7634653927,"key":["s111813236","s355269893"]} +{"user_id":"u094191970","problem_id":"p02804","language":"python","submission_id_v0":"s774516867","submission_id_v1":"s335717282","cpu_time_v0":302,"cpu_time_v1":246,"memory_v0":19920,"memory_v1":25512,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.54,"input":"n,k=list(map(int,input().split()))\n\na=list(map(int,input().split()))\n\na.sort()\n\n\n\nmod=10**9+7\n\n\n\nMAX_N=n+5\n\nfac = [1,1] + [0]*MAX_N\n\nfinv = [1,1] + [0]*MAX_N\n\ninv = [0,1] + [0]*MAX_N\n\nfor i in range(2,MAX_N):\n\n fac[i] = fac[i-1] * i % mod\n\n inv[i] = mod - inv[mod % i] * (mod \/\/ i) % mod\n\n finv[i] = finv[i-1] * inv[i] % mod\n\n\n\ndef nCk(n,k):\n\n if n None:\n\n d[v] = x\n\n for u in G[v]:\n\n if not d[u]:\n\n dfs(u, x + 1, d)\n\n\n\n\n\ndef main():\n\n global G, DB, DW\n\n N = int(eval(input()))\n\n E = tuple(tuple(map(int, input().split())) for _ in range(N - 1))\n\n G = [[] for _ in range(N + 1)]\n\n for v, u in E:\n\n G[v] += [u]\n\n G[u] += [v]\n\n DB, DW = [0] * (N + 1), [0] * (N + 1)\n\n dfs(1, 1, DB), dfs(N, 1, DW)\n\n b, w = 0, 0\n\n for i, j in zip(DB[1:], DW[1:]):\n\n if i <= j:\n\n b += 1\n\n else:\n\n w += 1\n\n flg = b > w\n\n print((\"Fennec\" if flg else \"Snuke\"))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"# ABC067D - Fennec VS. Snuke (ARC078D)\n\nfrom collections import deque\n\n\n\n\n\ndef bfs(s: int, d: \"List[int]\") -> None:\n\n q = deque([s])\n\n while q:\n\n v = q.popleft()\n\n for u in G[v]:\n\n if not d[u]:\n\n q.append(u)\n\n d[u] = d[v] + 1\n\n\n\n\n\ndef main():\n\n global G, DB, DW\n\n N, *E = list(map(int, open(0).read().split()))\n\n G = [[] for _ in range(N + 1)]\n\n for i in range(0, (N - 1) * 2, 2):\n\n v, u = E[i : i + 2]\n\n G[v] += [u]\n\n G[u] += [v]\n\n DB, DW = [0] * (N + 1), [0] * (N + 1)\n\n bfs(1, DB), bfs(N, DW)\n\n b, w = 0, 0\n\n for i, j in zip(DB[1:], DW[1:]):\n\n if i <= j:\n\n b += 1\n\n else:\n\n w += 1\n\n flg = b > w\n\n print((\"Fennec\" if flg else \"Snuke\"))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":36,"code_v1_loc":36,"code_v0_num_chars":791,"code_v1_num_chars":821,"code_v0_no_empty_lines":"# ABC067D - Fennec VS. Snuke (ARC078D)\nimport sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**9)\n\n\ndef dfs(v: int, x: int, d: \"List[int]\") -> None:\n d[v] = x\n for u in G[v]:\n if not d[u]:\n dfs(u, x + 1, d)\n\n\ndef main():\n global G, DB, DW\n N = int(eval(input()))\n E = tuple(tuple(map(int, input().split())) for _ in range(N - 1))\n G = [[] for _ in range(N + 1)]\n for v, u in E:\n G[v] += [u]\n G[u] += [v]\n DB, DW = [0] * (N + 1), [0] * (N + 1)\n dfs(1, 1, DB), dfs(N, 1, DW)\n b, w = 0, 0\n for i, j in zip(DB[1:], DW[1:]):\n if i <= j:\n b += 1\n else:\n w += 1\n flg = b > w\n print((\"Fennec\" if flg else \"Snuke\"))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# ABC067D - Fennec VS. Snuke (ARC078D)\nfrom collections import deque\n\n\ndef bfs(s: int, d: \"List[int]\") -> None:\n q = deque([s])\n while q:\n v = q.popleft()\n for u in G[v]:\n if not d[u]:\n q.append(u)\n d[u] = d[v] + 1\n\n\ndef main():\n global G, DB, DW\n N, *E = list(map(int, open(0).read().split()))\n G = [[] for _ in range(N + 1)]\n for i in range(0, (N - 1) * 2, 2):\n v, u = E[i : i + 2]\n G[v] += [u]\n G[u] += [v]\n DB, DW = [0] * (N + 1), [0] * (N + 1)\n bfs(1, DB), bfs(N, DW)\n b, w = 0, 0\n for i, j in zip(DB[1:], DW[1:]):\n if i <= j:\n b += 1\n else:\n w += 1\n flg = b > w\n print((\"Fennec\" if flg else \"Snuke\"))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import sys","-","-input = sys.stdin.readline","-sys.setrecursionlimit(10**9)","+from collections import deque","-def dfs(v: int, x: int, d: \"List[int]\") -> None:","- d[v] = x","- for u in G[v]:","- if not d[u]:","- dfs(u, x + 1, d)","+def bfs(s: int, d: \"List[int]\") -> None:","+ q = deque([s])","+ while q:","+ v = q.popleft()","+ for u in G[v]:","+ if not d[u]:","+ q.append(u)","+ d[u] = d[v] + 1","- N = int(eval(input()))","- E = tuple(tuple(map(int, input().split())) for _ in range(N - 1))","+ N, *E = list(map(int, open(0).read().split()))","- for v, u in E:","+ for i in range(0, (N - 1) * 2, 2):","+ v, u = E[i : i + 2]","- dfs(1, 1, DB), dfs(N, 1, DW)","+ bfs(1, DB), bfs(N, DW)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0069887638,"measured_runtime_v1":0.0412017822,"runtime_lift":0.169622852,"key":["s432555803","s189263290"]} +{"user_id":"u367701763","problem_id":"p03222","language":"python","submission_id_v0":"s041611949","submission_id_v1":"s398988694","cpu_time_v0":75,"cpu_time_v1":69,"memory_v0":63168,"memory_v1":63116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.0,"input":"H, W, K = list(map(int, input().split()))\n\nW2 = W-1\n\nc = [0] * (W2+1)\n\ncnt = 0\n\nMOD = 10**9 + 7\n\nfor bit in range(1 << W2):\n\n s0 = bit&1\n\n flg=True\n\n for i in range(1, W2):\n\n if (bit>>i)&1 and s0 == 1:\n\n flg = False\n\n break\n\n s0 = (bit>>i)&1\n\n if flg:\n\n cnt += 1\n\n for i in range(W2):\n\n if (bit >> i)&1:\n\n c[i] += 1\n\ndp = [[0]*W for _ in range(H+1)]\n\ndp[0][0] = 1\n\nfor h in range(H):\n\n for i in range(W):\n\n if i != 0:\n\n dp[h+1][i-1] += dp[h][i]*c[i-1]\n\n dp[h+1][i-1] %= MOD\n\n if i != W-1:\n\n dp[h+1][i+1] += dp[h][i]*c[i]\n\n dp[h+1][i+1] %= MOD\n\n dp[h+1][i] += dp[h][i]*(cnt-c[i-1]-c[i])\n\n dp[h+1][i] %= MOD\n\nprint((dp[H][K-1]))","target":"H, W, K = list(map(int, input().split()))\n\nMOD, p, cnt = 10**9+7, [0]*W, 0\n\nfor bit in range(1<<(W-1)):\n\n s0 = bit&1\n\n flg=True\n\n for w in range(1, W-1):\n\n if (bit>>w)&1 and s0 == 1:flg=False; break\n\n s0 = (bit>>w)&1\n\n if flg:\n\n cnt += 1\n\n for w in range(W - 1):\n\n if (bit >> w)&1:p[w] += 1\n\ndp = [[0]*W for _ in range(H+1)]\n\ndp[0][0] = 1\n\nfor h in range(H):\n\n for w in range(W):\n\n if w:\n\n dp[h+1][w-1] += dp[h][w]*p[w-1]\n\n dp[h+1][w-1] %= MOD\n\n if w-(W - 1):\n\n dp[h+1][w+1] += dp[h][w]*p[w]\n\n dp[h+1][w+1] %= MOD\n\n dp[h+1][w]+=dp[h][w]*(cnt-p[w-1]-p[w])\n\n dp[h+1][w]%=MOD\n\nprint((dp[H][K-1]))","code_v0_loc":31,"code_v1_loc":25,"code_v0_num_chars":781,"code_v1_num_chars":711,"code_v0_no_empty_lines":"H, W, K = list(map(int, input().split()))\nW2 = W - 1\nc = [0] * (W2 + 1)\ncnt = 0\nMOD = 10**9 + 7\nfor bit in range(1 << W2):\n s0 = bit & 1\n flg = True\n for i in range(1, W2):\n if (bit >> i) & 1 and s0 == 1:\n flg = False\n break\n s0 = (bit >> i) & 1\n if flg:\n cnt += 1\n for i in range(W2):\n if (bit >> i) & 1:\n c[i] += 1\ndp = [[0] * W for _ in range(H + 1)]\ndp[0][0] = 1\nfor h in range(H):\n for i in range(W):\n if i != 0:\n dp[h + 1][i - 1] += dp[h][i] * c[i - 1]\n dp[h + 1][i - 1] %= MOD\n if i != W - 1:\n dp[h + 1][i + 1] += dp[h][i] * c[i]\n dp[h + 1][i + 1] %= MOD\n dp[h + 1][i] += dp[h][i] * (cnt - c[i - 1] - c[i])\n dp[h + 1][i] %= MOD\nprint((dp[H][K - 1]))\n","code_v1_no_empty_lines":"H, W, K = list(map(int, input().split()))\nMOD, p, cnt = 10**9 + 7, [0] * W, 0\nfor bit in range(1 << (W - 1)):\n s0 = bit & 1\n flg = True\n for w in range(1, W - 1):\n if (bit >> w) & 1 and s0 == 1:\n flg = False\n break\n s0 = (bit >> w) & 1\n if flg:\n cnt += 1\n for w in range(W - 1):\n if (bit >> w) & 1:\n p[w] += 1\ndp = [[0] * W for _ in range(H + 1)]\ndp[0][0] = 1\nfor h in range(H):\n for w in range(W):\n if w:\n dp[h + 1][w - 1] += dp[h][w] * p[w - 1]\n dp[h + 1][w - 1] %= MOD\n if w - (W - 1):\n dp[h + 1][w + 1] += dp[h][w] * p[w]\n dp[h + 1][w + 1] %= MOD\n dp[h + 1][w] += dp[h][w] * (cnt - p[w - 1] - p[w])\n dp[h + 1][w] %= MOD\nprint((dp[H][K - 1]))\n","code_same":false,"relative_loc_diff_percent":19.3548387097,"diff":["-W2 = W - 1","-c = [0] * (W2 + 1)","-cnt = 0","-MOD = 10**9 + 7","-for bit in range(1 << W2):","+MOD, p, cnt = 10**9 + 7, [0] * W, 0","+for bit in range(1 << (W - 1)):","- for i in range(1, W2):","- if (bit >> i) & 1 and s0 == 1:","+ for w in range(1, W - 1):","+ if (bit >> w) & 1 and s0 == 1:","- s0 = (bit >> i) & 1","+ s0 = (bit >> w) & 1","- for i in range(W2):","- if (bit >> i) & 1:","- c[i] += 1","+ for w in range(W - 1):","+ if (bit >> w) & 1:","+ p[w] += 1","- for i in range(W):","- if i != 0:","- dp[h + 1][i - 1] += dp[h][i] * c[i - 1]","- dp[h + 1][i - 1] %= MOD","- if i != W - 1:","- dp[h + 1][i + 1] += dp[h][i] * c[i]","- dp[h + 1][i + 1] %= MOD","- dp[h + 1][i] += dp[h][i] * (cnt - c[i - 1] - c[i])","- dp[h + 1][i] %= MOD","+ for w in range(W):","+ if w:","+ dp[h + 1][w - 1] += dp[h][w] * p[w - 1]","+ dp[h + 1][w - 1] %= MOD","+ if w - (W - 1):","+ dp[h + 1][w + 1] += dp[h][w] * p[w]","+ dp[h + 1][w + 1] %= MOD","+ dp[h + 1][w] += dp[h][w] * (cnt - p[w - 1] - p[w])","+ dp[h + 1][w] %= MOD"],"diff_only_import_comment":false,"measured_runtime_v0":0.0455150637,"measured_runtime_v1":0.0454495098,"runtime_lift":1.0014423439,"key":["s041611949","s398988694"]} +{"user_id":"u762955009","problem_id":"p03835","language":"python","submission_id_v0":"s950367330","submission_id_v1":"s172169067","cpu_time_v0":1638,"cpu_time_v1":861,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":47.44,"input":"K, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(K + 1):\n\n for y in range(K + 1):\n\n z = S - (x + y)\n\n if 0 <= z and z <= K:\n\n ans += 1\n\n\n\nprint(ans)","target":"K, S = list(map(int, input().split()))\n\n\n\nans = 0\n\nfor x in range(K + 1):\n\n for y in range(x, K + 1):\n\n z = S - (x + y)\n\n if y <= z and z <= K:\n\n if x == y and y == z:\n\n ans += 1\n\n elif x == y or y == z or z == x:\n\n ans += 3\n\n else:\n\n ans += 6\n\n\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":15,"code_v0_num_chars":187,"code_v1_num_chars":346,"code_v0_no_empty_lines":"K, S = list(map(int, input().split()))\nans = 0\nfor x in range(K + 1):\n for y in range(K + 1):\n z = S - (x + y)\n if 0 <= z and z <= K:\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"K, S = list(map(int, input().split()))\nans = 0\nfor x in range(K + 1):\n for y in range(x, K + 1):\n z = S - (x + y)\n if y <= z and z <= K:\n if x == y and y == z:\n ans += 1\n elif x == y or y == z or z == x:\n ans += 3\n else:\n ans += 6\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":33.3333333333,"diff":["- for y in range(K + 1):","+ for y in range(x, K + 1):","- if 0 <= z and z <= K:","- ans += 1","+ if y <= z and z <= K:","+ if x == y and y == z:","+ ans += 1","+ elif x == y or y == z or z == x:","+ ans += 3","+ else:","+ ans += 6"],"diff_only_import_comment":false,"measured_runtime_v0":0.0371964018,"measured_runtime_v1":0.038094417,"runtime_lift":0.9764265932,"key":["s950367330","s172169067"]} +{"user_id":"u223646582","problem_id":"p02892","language":"python","submission_id_v0":"s424739845","submission_id_v1":"s717024918","cpu_time_v0":334,"cpu_time_v1":109,"memory_v0":46380,"memory_v1":74672,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.37,"input":"from collections import deque\n\nN = int(eval(input()))\n\nS = [list(eval(input())) for _ in range(N)]\n\n\n\n\n\ndef bfs(i):\n\n\n\n d = [-1 for _ in range(N)]\n\n d[i] = 0\n\n\n\n que = deque([(i, 0, -1)])\n\n\n\n finished = set()\n\n while que:\n\n ci, dist, p = que.popleft()\n\n # print(ci, dist, p)\n\n\n\n for j in range(N):\n\n if S[ci][j] == '1':\n\n if j != p and d[j] >= 0:\n\n if d[j] == dist or (d[j] != dist+1 and j not in finished):\n\n # print(ci, j)\n\n return -1\n\n elif d[j] == -1:\n\n d[j] = dist+1\n\n que.append((j, dist+1, ci))\n\n finished.add(ci)\n\n\n\n return dist+1\n\n\n\n\n\nans = -1\n\nfor i in range(N):\n\n b = bfs(i)\n\n ans = max(ans, b)\n\n\n\nprint(ans)\n","target":"from collections import deque\n\nN = int(eval(input()))\n\n\n\nG = {k: [] for k in range(N)}\n\nfor i in range(N):\n\n S = eval(input())\n\n for j in range(N):\n\n if S[j] == '1':\n\n G[i].append(j)\n\n G[j].append(i)\n\n\n\n\n\ndef bfs(i):\n\n visited = [-1 for _ in range(N)]\n\n visited[i] = 1\n\n M = 1\n\n que = deque([(i, -1)])\n\n\n\n while que:\n\n ci, p = que.popleft()\n\n\n\n for ni in G[ci]:\n\n if ni != p:\n\n if visited[ni] != -1:\n\n if (visited[ci]+1-visited[ni]) % 2 == 1:\n\n print((-1))\n\n exit()\n\n else:\n\n que.append((ni, ci))\n\n visited[ni] = visited[ci]+1\n\n M = max(M, visited[ni])\n\n\n\n return M\n\n\n\n\n\nans = 0\n\nfor i in range(N): # start node\n\n ans = max(ans, bfs(i))\n\nprint(ans)\n","code_v0_loc":37,"code_v1_loc":39,"code_v0_num_chars":804,"code_v1_num_chars":870,"code_v0_no_empty_lines":"from collections import deque\n\nN = int(eval(input()))\nS = [list(eval(input())) for _ in range(N)]\n\n\ndef bfs(i):\n d = [-1 for _ in range(N)]\n d[i] = 0\n que = deque([(i, 0, -1)])\n finished = set()\n while que:\n ci, dist, p = que.popleft()\n # print(ci, dist, p)\n for j in range(N):\n if S[ci][j] == \"1\":\n if j != p and d[j] >= 0:\n if d[j] == dist or (d[j] != dist + 1 and j not in finished):\n # print(ci, j)\n return -1\n elif d[j] == -1:\n d[j] = dist + 1\n que.append((j, dist + 1, ci))\n finished.add(ci)\n return dist + 1\n\n\nans = -1\nfor i in range(N):\n b = bfs(i)\n ans = max(ans, b)\nprint(ans)\n","code_v1_no_empty_lines":"from collections import deque\n\nN = int(eval(input()))\nG = {k: [] for k in range(N)}\nfor i in range(N):\n S = eval(input())\n for j in range(N):\n if S[j] == \"1\":\n G[i].append(j)\n G[j].append(i)\n\n\ndef bfs(i):\n visited = [-1 for _ in range(N)]\n visited[i] = 1\n M = 1\n que = deque([(i, -1)])\n while que:\n ci, p = que.popleft()\n for ni in G[ci]:\n if ni != p:\n if visited[ni] != -1:\n if (visited[ci] + 1 - visited[ni]) % 2 == 1:\n print((-1))\n exit()\n else:\n que.append((ni, ci))\n visited[ni] = visited[ci] + 1\n M = max(M, visited[ni])\n return M\n\n\nans = 0\nfor i in range(N): # start node\n ans = max(ans, bfs(i))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":5.1282051282,"diff":["-S = [list(eval(input())) for _ in range(N)]","+G = {k: [] for k in range(N)}","+for i in range(N):","+ S = eval(input())","+ for j in range(N):","+ if S[j] == \"1\":","+ G[i].append(j)","+ G[j].append(i)","- d = [-1 for _ in range(N)]","- d[i] = 0","- que = deque([(i, 0, -1)])","- finished = set()","+ visited = [-1 for _ in range(N)]","+ visited[i] = 1","+ M = 1","+ que = deque([(i, -1)])","- ci, dist, p = que.popleft()","- # print(ci, dist, p)","- for j in range(N):","- if S[ci][j] == \"1\":","- if j != p and d[j] >= 0:","- if d[j] == dist or (d[j] != dist + 1 and j not in finished):","- # print(ci, j)","- return -1","- elif d[j] == -1:","- d[j] = dist + 1","- que.append((j, dist + 1, ci))","- finished.add(ci)","- return dist + 1","+ ci, p = que.popleft()","+ for ni in G[ci]:","+ if ni != p:","+ if visited[ni] != -1:","+ if (visited[ci] + 1 - visited[ni]) % 2 == 1:","+ print((-1))","+ exit()","+ else:","+ que.append((ni, ci))","+ visited[ni] = visited[ci] + 1","+ M = max(M, visited[ni])","+ return M","-ans = -1","-for i in range(N):","- b = bfs(i)","- ans = max(ans, b)","+ans = 0","+for i in range(N): # start node","+ ans = max(ans, bfs(i))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0343143957,"measured_runtime_v1":0.0415952156,"runtime_lift":0.8249601594,"key":["s424739845","s717024918"]} +{"user_id":"u459798349","problem_id":"p02862","language":"python","submission_id_v0":"s079847175","submission_id_v1":"s374185042","cpu_time_v0":1543,"cpu_time_v1":614,"memory_v0":44716,"memory_v1":19884,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.21,"input":"import math\n\na,b=list(map(int,input().split()))\n\nx=max(a,b)\n\ny=min(a,b)\n\np=abs(x-y)\n\n\n\nP = 10**9 + 7\n\nN = 1000000\n\ninv_t = [0]+[1]\n\nfor i in range(2,N):\n\n inv_t += [inv_t[P % i] * (P - int(P \/ i)) % P]\n\n\n\nif (x+y)%3!=0:\n\n print((0))\n\nelif x>y*2:\n\n print((0))\n\nelse:\n\n n=(x+y)\/\/3\n\n q=(2*x-y)\/\/3\n\n r=(2*y-x)\/\/3\n\n \n\n #print(math.factorial(q+r)\/\/math.factorial(q)\/\/math.factorial(r)%(10**9+7))\n\n ans=1\n\n qq=1\n\n rr=1\n\n for i in range(1,q+r+1):\n\n ans*=i\n\n ans%=10**9+7\n\n for i in range(1,q+1):\n\n ans*=inv_t[i]\n\n ans%=10**9+7\n\n\n\n P = 10**9 + 7\n\n N = r+2\n\n inv_t = [0]+[1]\n\n for i in range(2,N):\n\n inv_t += [inv_t[P % i] * (P - int(P \/ i)) % P]\n\n\n\n for i in range(1,r+1):\n\n ans*=inv_t[i]\n\n ans%=10**9+7\n\n \n\n \n\n print(ans)\n","target":"import math\n\na,b=list(map(int,input().split()))\n\nx=max(a,b)\n\ny=min(a,b)\n\np=abs(x-y)\n\n\n\nif (x+y)%3!=0:\n\n print((0))\n\nelif x>y*2:\n\n print((0))\n\nelse:\n\n n=(x+y)\/\/3\n\n q=(2*x-y)\/\/3\n\n r=(2*y-x)\/\/3\n\n \n\n #print(math.factorial(q+r)\/\/math.factorial(q)\/\/math.factorial(r)%(10**9+7))\n\n ans=1\n\n qq=1\n\n rr=1\n\n P = 10**9 + 7\n\n N = max(q,r)+2\n\n inv_t = [0]+[1]\n\n for i in range(2,N):\n\n inv_t += [inv_t[P % i] * (P - int(P \/ i)) % P]\n\n for i in range(1,q+r+1):\n\n ans*=i\n\n ans%=10**9+7\n\n for i in range(1,q+1):\n\n ans*=inv_t[i]\n\n ans%=10**9+7\n\n for i in range(1,r+1):\n\n ans*=inv_t[i]\n\n ans%=10**9+7\n\n \n\n \n\n print(ans)\n","code_v0_loc":44,"code_v1_loc":36,"code_v0_num_chars":830,"code_v1_num_chars":714,"code_v0_no_empty_lines":"import math\n\na, b = list(map(int, input().split()))\nx = max(a, b)\ny = min(a, b)\np = abs(x - y)\nP = 10**9 + 7\nN = 1000000\ninv_t = [0] + [1]\nfor i in range(2, N):\n inv_t += [inv_t[P % i] * (P - int(P \/ i)) % P]\nif (x + y) % 3 != 0:\n print((0))\nelif x > y * 2:\n print((0))\nelse:\n n = (x + y) \/\/ 3\n q = (2 * x - y) \/\/ 3\n r = (2 * y - x) \/\/ 3\n # print(math.factorial(q+r)\/\/math.factorial(q)\/\/math.factorial(r)%(10**9+7))\n ans = 1\n qq = 1\n rr = 1\n for i in range(1, q + r + 1):\n ans *= i\n ans %= 10**9 + 7\n for i in range(1, q + 1):\n ans *= inv_t[i]\n ans %= 10**9 + 7\n P = 10**9 + 7\n N = r + 2\n inv_t = [0] + [1]\n for i in range(2, N):\n inv_t += [inv_t[P % i] * (P - int(P \/ i)) % P]\n for i in range(1, r + 1):\n ans *= inv_t[i]\n ans %= 10**9 + 7\n print(ans)\n","code_v1_no_empty_lines":"import math\n\na, b = list(map(int, input().split()))\nx = max(a, b)\ny = min(a, b)\np = abs(x - y)\nif (x + y) % 3 != 0:\n print((0))\nelif x > y * 2:\n print((0))\nelse:\n n = (x + y) \/\/ 3\n q = (2 * x - y) \/\/ 3\n r = (2 * y - x) \/\/ 3\n # print(math.factorial(q+r)\/\/math.factorial(q)\/\/math.factorial(r)%(10**9+7))\n ans = 1\n qq = 1\n rr = 1\n P = 10**9 + 7\n N = max(q, r) + 2\n inv_t = [0] + [1]\n for i in range(2, N):\n inv_t += [inv_t[P % i] * (P - int(P \/ i)) % P]\n for i in range(1, q + r + 1):\n ans *= i\n ans %= 10**9 + 7\n for i in range(1, q + 1):\n ans *= inv_t[i]\n ans %= 10**9 + 7\n for i in range(1, r + 1):\n ans *= inv_t[i]\n ans %= 10**9 + 7\n print(ans)\n","code_same":false,"relative_loc_diff_percent":18.1818181818,"diff":["-P = 10**9 + 7","-N = 1000000","-inv_t = [0] + [1]","-for i in range(2, N):","- inv_t += [inv_t[P % i] * (P - int(P \/ i)) % P]","+ P = 10**9 + 7","+ N = max(q, r) + 2","+ inv_t = [0] + [1]","+ for i in range(2, N):","+ inv_t += [inv_t[P % i] * (P - int(P \/ i)) % P]","- P = 10**9 + 7","- N = r + 2","- inv_t = [0] + [1]","- for i in range(2, N):","- inv_t += [inv_t[P % i] * (P - int(P \/ i)) % P]"],"diff_only_import_comment":false,"measured_runtime_v0":1.0496712449,"measured_runtime_v1":0.1502795324,"runtime_lift":6.984791793,"key":["s079847175","s374185042"]} +{"user_id":"u790710233","problem_id":"p03219","language":"python","submission_id_v0":"s245961436","submission_id_v1":"s588454427","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"a, b = list(map(int, input().split()))\n\nprint((a+b\/\/2))","target":"x, y = list(map(int, input().split()))\n\nprint((x+y\/\/2))\n","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":47,"code_v1_num_chars":48,"code_v0_no_empty_lines":"a, b = list(map(int, input().split()))\nprint((a + b \/\/ 2))\n","code_v1_no_empty_lines":"x, y = list(map(int, input().split()))\nprint((x + y \/\/ 2))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-a, b = list(map(int, input().split()))","-print((a + b \/\/ 2))","+x, y = list(map(int, input().split()))","+print((x + y \/\/ 2))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0379134998,"measured_runtime_v1":0.0366170119,"runtime_lift":1.0354067066,"key":["s245961436","s588454427"]} +{"user_id":"u970197315","problem_id":"p03700","language":"python","submission_id_v0":"s931884287","submission_id_v1":"s424993098","cpu_time_v0":1236,"cpu_time_v1":1135,"memory_v0":11040,"memory_v1":11028,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.17,"input":"# ABC063 D - Widespread\n\ndef check(x,hp):\n\n hp=[hh-(b*x) for hh in hp]\n\n explosion=0\n\n for hhh in hp:\n\n if hhh<=0:continue\n\n if hhh%(a-b)==0:\n\n explosion+=hhh\/\/(a-b)\n\n else:\n\n explosion+=hhh\/\/(a-b)+1\n\n return explosion<=x\n\n\n\nn,a,b=list(map(int,input().split()))\n\nh=[int(eval(input())) for i in range(n)]\n\nlo=0\n\nhi=10**9\n\nwhile hi-lo>1:\n\n mid=(hi+lo)\/\/2\n\n if check(mid,h):\n\n hi=mid\n\n else:\n\n lo=mid\n\nprint((lo+1))","target":"from math import ceil\n\ndef check(x,hp):\n\n hp=[hh-(b*x) for hh in hp]\n\n cnt=0\n\n for p in hp:\n\n if p<=0:continue\n\n cnt+=ceil(p\/(a-b))\n\n return cnt<=x\n\n\n\nn,a,b=list(map(int,input().split()))\n\nh=[int(eval(input())) for i in range(n)]\n\nlo=0\n\nhi=10**9\n\nwhile hi-lo>1:\n\n mid=(hi+lo)\/\/2\n\n if check(mid,h):\n\n hi=mid\n\n else:\n\n lo=mid\n\nans=hi\n\n# ht\u3068lo\u3069\u3061\u3089\u3092\u51fa\u529b\u3059\u308c\u3070\u3088\u3044\uff1f\n\n# print(lo)\n\nprint(hi)","code_v0_loc":23,"code_v1_loc":23,"code_v0_num_chars":476,"code_v1_num_chars":413,"code_v0_no_empty_lines":"# ABC063 D - Widespread\ndef check(x, hp):\n hp = [hh - (b * x) for hh in hp]\n explosion = 0\n for hhh in hp:\n if hhh <= 0:\n continue\n if hhh % (a - b) == 0:\n explosion += hhh \/\/ (a - b)\n else:\n explosion += hhh \/\/ (a - b) + 1\n return explosion <= x\n\n\nn, a, b = list(map(int, input().split()))\nh = [int(eval(input())) for i in range(n)]\nlo = 0\nhi = 10**9\nwhile hi - lo > 1:\n mid = (hi + lo) \/\/ 2\n if check(mid, h):\n hi = mid\n else:\n lo = mid\nprint((lo + 1))\n","code_v1_no_empty_lines":"from math import ceil\n\n\ndef check(x, hp):\n hp = [hh - (b * x) for hh in hp]\n cnt = 0\n for p in hp:\n if p <= 0:\n continue\n cnt += ceil(p \/ (a - b))\n return cnt <= x\n\n\nn, a, b = list(map(int, input().split()))\nh = [int(eval(input())) for i in range(n)]\nlo = 0\nhi = 10**9\nwhile hi - lo > 1:\n mid = (hi + lo) \/\/ 2\n if check(mid, h):\n hi = mid\n else:\n lo = mid\nans = hi\n# ht\u3068lo\u3069\u3061\u3089\u3092\u51fa\u529b\u3059\u308c\u3070\u3088\u3044\uff1f\n# print(lo)\nprint(hi)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-# ABC063 D - Widespread","+from math import ceil","+","+","- explosion = 0","- for hhh in hp:","- if hhh <= 0:","+ cnt = 0","+ for p in hp:","+ if p <= 0:","- if hhh % (a - b) == 0:","- explosion += hhh \/\/ (a - b)","- else:","- explosion += hhh \/\/ (a - b) + 1","- return explosion <= x","+ cnt += ceil(p \/ (a - b))","+ return cnt <= x","-print((lo + 1))","+ans = hi","+# ht\u3068lo\u3069\u3061\u3089\u3092\u51fa\u529b\u3059\u308c\u3070\u3088\u3044\uff1f","+# print(lo)","+print(hi)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1147856228,"measured_runtime_v1":0.1016475923,"runtime_lift":1.1292507793,"key":["s931884287","s424993098"]} +{"user_id":"u591467586","problem_id":"p02263","language":"python","submission_id_v0":"s083312446","submission_id_v1":"s042317279","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7772,"memory_v1":7772,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"def push(x, top, S):\n\n S.append(x)\n\n top = top + 1\n\n\n\ndef pop(top):\n\n del S[top-1]\n\n top = top - 1\n\n\n\nif __name__ == \"__main__\":\n\n stdin = eval(input())\n\n stdin = stdin.split()\n\n n = len(stdin)\n\n S = []\n\n top = len(S)\n\n for i in range(0, n):\n\n if stdin[i] == '+':\n\n b = S[top-1]\n\n a = S[top-2]\n\n pop(top)\n\n S[top-1] = a + b\n\n elif stdin[i] == '-':\n\n b = S[top-1]\n\n a = S[top-2]\n\n pop(top)\n\n S[top-1] = a - b\n\n elif stdin[i] == '*':\n\n b = S[top-1]\n\n a = S[top-2]\n\n pop(top)\n\n S[top-1] = a * b\n\n else:\n\n push(int(stdin[i]), top, S)\n\n print((S[top]))","target":"def push(S, top, x):\n\n S.append(x)\n\n top = top + 1\n\n\n\ndef pop(S, top):\n\n t = int(S[top-1])\n\n del S[top-1]\n\n top = top -1\n\n return t\n\n\n\nif __name__ == \"__main__\":\n\n top = 0\n\n inpt = (eval(input())).split()\n\n n = len(inpt)\n\n S = []\n\n for i in range(0,n):\n\n if inpt[i] == \"+\":\n\n b = pop(S, top)\n\n a = pop(S, top)\n\n c = a + b\n\n push(S, top, c)\n\n elif inpt[i] == \"-\":\n\n b = pop(S, top)\n\n a = pop(S, top)\n\n c = a - b\n\n push(S, top, c)\n\n elif inpt[i] == \"*\":\n\n b = pop(S, top)\n\n a = pop(S, top)\n\n c = a * b\n\n push(S, top, c)\n\n else :\n\n push(S, top, int(inpt[i]))\n\n print((S[top-1]))","code_v0_loc":33,"code_v1_loc":34,"code_v0_num_chars":859,"code_v1_num_chars":892,"code_v0_no_empty_lines":"def push(x, top, S):\n S.append(x)\n top = top + 1\n\n\ndef pop(top):\n del S[top - 1]\n top = top - 1\n\n\nif __name__ == \"__main__\":\n stdin = eval(input())\n stdin = stdin.split()\n n = len(stdin)\n S = []\n top = len(S)\n for i in range(0, n):\n if stdin[i] == \"+\":\n b = S[top - 1]\n a = S[top - 2]\n pop(top)\n S[top - 1] = a + b\n elif stdin[i] == \"-\":\n b = S[top - 1]\n a = S[top - 2]\n pop(top)\n S[top - 1] = a - b\n elif stdin[i] == \"*\":\n b = S[top - 1]\n a = S[top - 2]\n pop(top)\n S[top - 1] = a * b\n else:\n push(int(stdin[i]), top, S)\n print((S[top]))\n","code_v1_no_empty_lines":"def push(S, top, x):\n S.append(x)\n top = top + 1\n\n\ndef pop(S, top):\n t = int(S[top - 1])\n del S[top - 1]\n top = top - 1\n return t\n\n\nif __name__ == \"__main__\":\n top = 0\n inpt = (eval(input())).split()\n n = len(inpt)\n S = []\n for i in range(0, n):\n if inpt[i] == \"+\":\n b = pop(S, top)\n a = pop(S, top)\n c = a + b\n push(S, top, c)\n elif inpt[i] == \"-\":\n b = pop(S, top)\n a = pop(S, top)\n c = a - b\n push(S, top, c)\n elif inpt[i] == \"*\":\n b = pop(S, top)\n a = pop(S, top)\n c = a * b\n push(S, top, c)\n else:\n push(S, top, int(inpt[i]))\n print((S[top - 1]))\n","code_same":false,"relative_loc_diff_percent":2.9411764706,"diff":["-def push(x, top, S):","+def push(S, top, x):","-def pop(top):","+def pop(S, top):","+ t = int(S[top - 1])","+ return t","- stdin = eval(input())","- stdin = stdin.split()","- n = len(stdin)","+ top = 0","+ inpt = (eval(input())).split()","+ n = len(inpt)","- top = len(S)","- if stdin[i] == \"+\":","- b = S[top - 1]","- a = S[top - 2]","- pop(top)","- S[top - 1] = a + b","- elif stdin[i] == \"-\":","- b = S[top - 1]","- a = S[top - 2]","- pop(top)","- S[top - 1] = a - b","- elif stdin[i] == \"*\":","- b = S[top - 1]","- a = S[top - 2]","- pop(top)","- S[top - 1] = a * b","+ if inpt[i] == \"+\":","+ b = pop(S, top)","+ a = pop(S, top)","+ c = a + b","+ push(S, top, c)","+ elif inpt[i] == \"-\":","+ b = pop(S, top)","+ a = pop(S, top)","+ c = a - b","+ push(S, top, c)","+ elif inpt[i] == \"*\":","+ b = pop(S, top)","+ a = pop(S, top)","+ c = a * b","+ push(S, top, c)","- push(int(stdin[i]), top, S)","- print((S[top]))","+ push(S, top, int(inpt[i]))","+ print((S[top - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0414622558,"measured_runtime_v1":0.0413108398,"runtime_lift":1.0036652843,"key":["s083312446","s042317279"]} +{"user_id":"u762540523","problem_id":"p02573","language":"python","submission_id_v0":"s670605003","submission_id_v1":"s654073776","cpu_time_v0":309,"cpu_time_v1":284,"memory_v0":74144,"memory_v1":100948,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.09,"input":"class UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def members(self, x):\n\n root = self.find(x)\n\n return (i for i in range(self.n) if self.find(i) == root)\n\n\n\n def roots(self):\n\n return (i for i, x in enumerate(self.parents) if x < 0)\n\n\n\n def group_count(self):\n\n return len(self.roots())\n\n\n\n def all_group_members(self):\n\n d = {}\n\n for i in range(self.n):\n\n p = self.find(i)\n\n d[p] = d.get(p, []) + [i]\n\n return d\n\n\n\n def __str__(self):\n\n return '\\n'.join('{}: {}'.format(k, v) for k, v in list(self.all_group_members().items()))\n\n\n\n\n\ndef resolve():\n\n import sys\n\n input = sys.stdin.readline\n\n n, m = list(map(int, input().split()))\n\n u = UnionFind(n)\n\n for _ in range(m):\n\n a, b = list(map(int, input().split()))\n\n u.union(a - 1, b - 1)\n\n ans = 0\n\n for i in u.roots():\n\n ans = max(u.size(i), ans)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","target":"class UnionFind():\n\n def __init__(self, n):\n\n self.n = n\n\n self.parents = [-1] * n\n\n\n\n def find(self, x):\n\n if self.parents[x] < 0:\n\n return x\n\n else:\n\n self.parents[x] = self.find(self.parents[x])\n\n return self.parents[x]\n\n\n\n def union(self, x, y):\n\n x = self.find(x)\n\n y = self.find(y)\n\n\n\n if x == y:\n\n return\n\n\n\n if self.parents[x] > self.parents[y]:\n\n x, y = y, x\n\n\n\n self.parents[x] += self.parents[y]\n\n self.parents[y] = x\n\n\n\n def size(self, x):\n\n return -self.parents[self.find(x)]\n\n\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\n def members(self, x):\n\n root = self.find(x)\n\n return (i for i in range(self.n) if self.find(i) == root)\n\n\n\n def roots(self):\n\n return (i for i, x in enumerate(self.parents) if x < 0)\n\n\n\n def group_count(self):\n\n return len(self.roots())\n\n\n\n def sizes(self):\n\n return {x: self.size(x) for x in self.roots()}\n\n\n\n def all_group_members(self):\n\n d = {}\n\n for i in range(self.n):\n\n p = self.find(i)\n\n d[p] = d.get(p, []) + [i]\n\n return d\n\n\n\n def __str__(self):\n\n return '\\n'.join('{}: {}'.format(k, v) for k, v in list(self.all_group_members().items()))\n\n\n\n\n\ndef resolve():\n\n import sys\n\n input = sys.stdin.readline\n\n n, m = list(map(int, input().split()))\n\n u = UnionFind(n)\n\n for _ in range(m):\n\n a, b = list(map(int, input().split()))\n\n u.union(a - 1, b - 1)\n\n ans = 0\n\n for i in list(u.sizes().values()):\n\n ans = max(i, ans)\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n resolve()\n","code_v0_loc":68,"code_v1_loc":71,"code_v0_num_chars":1638,"code_v1_num_chars":1719,"code_v0_no_empty_lines":"class UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return (i for i in range(self.n) if self.find(i) == root)\n\n def roots(self):\n return (i for i, x in enumerate(self.parents) if x < 0)\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n d = {}\n for i in range(self.n):\n p = self.find(i)\n d[p] = d.get(p, []) + [i]\n return d\n\n def __str__(self):\n return \"\\n\".join(\n \"{}: {}\".format(k, v) for k, v in list(self.all_group_members().items())\n )\n\n\ndef resolve():\n import sys\n\n input = sys.stdin.readline\n n, m = list(map(int, input().split()))\n u = UnionFind(n)\n for _ in range(m):\n a, b = list(map(int, input().split()))\n u.union(a - 1, b - 1)\n ans = 0\n for i in u.roots():\n ans = max(u.size(i), ans)\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_v1_no_empty_lines":"class UnionFind:\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return (i for i in range(self.n) if self.find(i) == root)\n\n def roots(self):\n return (i for i, x in enumerate(self.parents) if x < 0)\n\n def group_count(self):\n return len(self.roots())\n\n def sizes(self):\n return {x: self.size(x) for x in self.roots()}\n\n def all_group_members(self):\n d = {}\n for i in range(self.n):\n p = self.find(i)\n d[p] = d.get(p, []) + [i]\n return d\n\n def __str__(self):\n return \"\\n\".join(\n \"{}: {}\".format(k, v) for k, v in list(self.all_group_members().items())\n )\n\n\ndef resolve():\n import sys\n\n input = sys.stdin.readline\n n, m = list(map(int, input().split()))\n u = UnionFind(n)\n for _ in range(m):\n a, b = list(map(int, input().split()))\n u.union(a - 1, b - 1)\n ans = 0\n for i in list(u.sizes().values()):\n ans = max(i, ans)\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":4.2253521127,"diff":["+ def sizes(self):","+ return {x: self.size(x) for x in self.roots()}","+","- for i in u.roots():","- ans = max(u.size(i), ans)","+ for i in list(u.sizes().values()):","+ ans = max(i, ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0383794291,"measured_runtime_v1":0.0471140249,"runtime_lift":0.8146073105,"key":["s670605003","s654073776"]} +{"user_id":"u652057333","problem_id":"p03077","language":"python","submission_id_v0":"s698501449","submission_id_v1":"s709221826","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"# C\n\nimport math\n\nn = int(eval(input()))\n\na = []\n\nfor i in range(5):\n\n a.append(int(eval(input())))\n\nans = math.ceil((n\/min(a) + 5) - 1)\n\nprint(ans)","target":"from math import ceil\n\nn = int(eval(input()))\n\na = []\n\nfor i in range(5):\n\n a.append(int(eval(input())))\n\n\n\nans = ceil(n \/ min(a)) + 4\n\nprint(ans)","code_v0_loc":8,"code_v1_loc":8,"code_v0_num_chars":139,"code_v1_num_chars":137,"code_v0_no_empty_lines":"# C\nimport math\n\nn = int(eval(input()))\na = []\nfor i in range(5):\n a.append(int(eval(input())))\nans = math.ceil((n \/ min(a) + 5) - 1)\nprint(ans)\n","code_v1_no_empty_lines":"from math import ceil\n\nn = int(eval(input()))\na = []\nfor i in range(5):\n a.append(int(eval(input())))\nans = ceil(n \/ min(a)) + 4\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-# C","-import math","+from math import ceil","-ans = math.ceil((n \/ min(a) + 5) - 1)","+ans = ceil(n \/ min(a)) + 4"],"diff_only_import_comment":false,"measured_runtime_v0":0.092160646,"measured_runtime_v1":0.0483254917,"runtime_lift":1.9070813925,"key":["s698501449","s709221826"]} +{"user_id":"u631025015","problem_id":"p02713","language":"python","submission_id_v0":"s786289763","submission_id_v1":"s564243533","cpu_time_v0":605,"cpu_time_v1":454,"memory_v0":9216,"memory_v1":9204,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.96,"input":"def gcd(a, b):\n\n while b != 0 :\n\n t = a % b\n\n a = b\n\n b = t\n\n return a\n\n \n\nsum = 0\n\nN=int(eval(input(\"\")))\n\nfor a in range(1, N + 1):\n\n for b in range(1, N + 1):\n\n x = gcd(a, b)\n\n if x == 1:\n\n sum = sum + N\n\n elif x == 2:\n\n sum = sum + (N + 1) \/\/ 2 + N \/\/ 2 * 2\n\n else:\n\n for c in range(1, N + 1):\n\n sum = sum + gcd(x, c)\n\nprint(sum)","target":"def gcd(a, b):\n\n while b != 0 :\n\n t = a % b\n\n a = b\n\n b = t\n\n return a\n\n \n\nsum = 0\n\nN=int(eval(input(\"\")))\n\nfor a in range(1, N + 1):\n\n for b in range(1, N + 1):\n\n x = gcd(a, b)\n\n if x == 1:\n\n sum = sum + N\n\n elif x == 2:\n\n sum = sum + (N + 1) \/\/ 2 + N \/\/ 2 * 2\n\n elif x == 3:\n\n sum = sum + N \/\/ 3 * 3 + (N - N \/\/ 3)\n\n else:\n\n for c in range(1, N + 1):\n\n sum = sum + gcd(x, c)\n\nprint(sum)","code_v0_loc":20,"code_v1_loc":22,"code_v0_num_chars":440,"code_v1_num_chars":513,"code_v0_no_empty_lines":"def gcd(a, b):\n while b != 0:\n t = a % b\n a = b\n b = t\n return a\n\n\nsum = 0\nN = int(eval(input(\"\")))\nfor a in range(1, N + 1):\n for b in range(1, N + 1):\n x = gcd(a, b)\n if x == 1:\n sum = sum + N\n elif x == 2:\n sum = sum + (N + 1) \/\/ 2 + N \/\/ 2 * 2\n else:\n for c in range(1, N + 1):\n sum = sum + gcd(x, c)\nprint(sum)\n","code_v1_no_empty_lines":"def gcd(a, b):\n while b != 0:\n t = a % b\n a = b\n b = t\n return a\n\n\nsum = 0\nN = int(eval(input(\"\")))\nfor a in range(1, N + 1):\n for b in range(1, N + 1):\n x = gcd(a, b)\n if x == 1:\n sum = sum + N\n elif x == 2:\n sum = sum + (N + 1) \/\/ 2 + N \/\/ 2 * 2\n elif x == 3:\n sum = sum + N \/\/ 3 * 3 + (N - N \/\/ 3)\n else:\n for c in range(1, N + 1):\n sum = sum + gcd(x, c)\nprint(sum)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["+ elif x == 3:","+ sum = sum + N \/\/ 3 * 3 + (N - N \/\/ 3)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1344548657,"measured_runtime_v1":0.0786137588,"runtime_lift":1.7103223116,"key":["s786289763","s564243533"]} +{"user_id":"u408260374","problem_id":"p01545","language":"python","submission_id_v0":"s226587317","submission_id_v1":"s099979355","cpu_time_v0":1440,"cpu_time_v1":1070,"memory_v0":27748,"memory_v1":23424,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":25.69,"input":"import math\n\n\n\n\n\nclass FenwickTree:\n\n def __init__(self, a_list, f, default):\n\n # 0-indexed\n\n self.N = len(a_list)\n\n self.bit = a_list[:]\n\n self.f = f\n\n self.default = default\n\n for _ in range(self.N, 1 << (math.ceil(math.log(self.N, 2)))):\n\n self.bit.append(self.default)\n\n for i in range(self.N - 1):\n\n self.bit[i | (i + 1)] = self.f(self.bit[i | (i + 1)], self.bit[i])\n\n\n\n def update(self, i, val):\n\n while i < self.N:\n\n self.bit[i] = self.f(self.bit[i], val)\n\n i |= i + 1\n\n\n\n def query(self, n):\n\n # [0, n]\n\n ret = 0\n\n while n >= 0:\n\n ret = self.f(ret, self.bit[n])\n\n n = (n & (n + 1)) - 1\n\n return ret\n\n\n\n\n\nN = int(eval(input()))\n\nX = [int(x) for x in input().split()]\n\ndp = FenwickTree([0] * N, lambda x, y: max(x, y), 0)\n\nfor x, i in sorted((x, i) for i, x in enumerate(X)):\n\n dp.update(i, dp.query(i) + x)\n\nprint((N * (N + 1) \/\/ 2 - dp.query(N - 1)))","target":"import math\n\nimport sys\n\nif sys.version[0] == '2':\n\n range, input = xrange, raw_input\n\n\n\n\n\nclass FenwickTree:\n\n def __init__(self, a_list, f, default):\n\n # 0-indexed\n\n self.N = len(a_list)\n\n self.bit = a_list[:]\n\n self.f = f\n\n self.default = default\n\n for _ in range(self.N, 1 << int(math.ceil(math.log(self.N, 2)))):\n\n self.bit.append(self.default)\n\n for i in range(self.N - 1):\n\n self.bit[i | (i + 1)] = self.f(self.bit[i | (i + 1)], self.bit[i])\n\n\n\n def update(self, i, val):\n\n while i < self.N:\n\n self.bit[i] = self.f(self.bit[i], val)\n\n i |= i + 1\n\n\n\n def query(self, n):\n\n # [0, n]\n\n ret = 0\n\n while n >= 0:\n\n ret = self.f(ret, self.bit[n])\n\n n = (n & (n + 1)) - 1\n\n return ret\n\n\n\n\n\nN = int(eval(input()))\n\nX = [int(x) for x in input().split()]\n\ndp = FenwickTree([0] * N, lambda x, y: max(x, y), 0)\n\nfor x, i in sorted((x, i) for i, x in enumerate(X)):\n\n dp.update(i, dp.query(i) + x)\n\nprint((N * (N + 1) \/\/ 2 - dp.query(N - 1)))","code_v0_loc":35,"code_v1_loc":38,"code_v0_num_chars":1012,"code_v1_num_chars":1092,"code_v0_no_empty_lines":"import math\n\n\nclass FenwickTree:\n def __init__(self, a_list, f, default):\n # 0-indexed\n self.N = len(a_list)\n self.bit = a_list[:]\n self.f = f\n self.default = default\n for _ in range(self.N, 1 << (math.ceil(math.log(self.N, 2)))):\n self.bit.append(self.default)\n for i in range(self.N - 1):\n self.bit[i | (i + 1)] = self.f(self.bit[i | (i + 1)], self.bit[i])\n\n def update(self, i, val):\n while i < self.N:\n self.bit[i] = self.f(self.bit[i], val)\n i |= i + 1\n\n def query(self, n):\n # [0, n]\n ret = 0\n while n >= 0:\n ret = self.f(ret, self.bit[n])\n n = (n & (n + 1)) - 1\n return ret\n\n\nN = int(eval(input()))\nX = [int(x) for x in input().split()]\ndp = FenwickTree([0] * N, lambda x, y: max(x, y), 0)\nfor x, i in sorted((x, i) for i, x in enumerate(X)):\n dp.update(i, dp.query(i) + x)\nprint((N * (N + 1) \/\/ 2 - dp.query(N - 1)))\n","code_v1_no_empty_lines":"import math\nimport sys\n\nif sys.version[0] == \"2\":\n range, input = xrange, raw_input\n\n\nclass FenwickTree:\n def __init__(self, a_list, f, default):\n # 0-indexed\n self.N = len(a_list)\n self.bit = a_list[:]\n self.f = f\n self.default = default\n for _ in range(self.N, 1 << int(math.ceil(math.log(self.N, 2)))):\n self.bit.append(self.default)\n for i in range(self.N - 1):\n self.bit[i | (i + 1)] = self.f(self.bit[i | (i + 1)], self.bit[i])\n\n def update(self, i, val):\n while i < self.N:\n self.bit[i] = self.f(self.bit[i], val)\n i |= i + 1\n\n def query(self, n):\n # [0, n]\n ret = 0\n while n >= 0:\n ret = self.f(ret, self.bit[n])\n n = (n & (n + 1)) - 1\n return ret\n\n\nN = int(eval(input()))\nX = [int(x) for x in input().split()]\ndp = FenwickTree([0] * N, lambda x, y: max(x, y), 0)\nfor x, i in sorted((x, i) for i, x in enumerate(X)):\n dp.update(i, dp.query(i) + x)\nprint((N * (N + 1) \/\/ 2 - dp.query(N - 1)))\n","code_same":false,"relative_loc_diff_percent":7.8947368421,"diff":["+import sys","+","+if sys.version[0] == \"2\":","+ range, input = xrange, raw_input","- for _ in range(self.N, 1 << (math.ceil(math.log(self.N, 2)))):","+ for _ in range(self.N, 1 << int(math.ceil(math.log(self.N, 2)))):"],"diff_only_import_comment":false,"measured_runtime_v0":0.1577507051,"measured_runtime_v1":0.04637604,"runtime_lift":3.4015561723,"key":["s226587317","s099979355"]} +{"user_id":"u926412290","problem_id":"p03167","language":"python","submission_id_v0":"s537459559","submission_id_v1":"s936545985","cpu_time_v0":195,"cpu_time_v1":167,"memory_v0":94260,"memory_v1":86624,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.36,"input":"from collections import deque\n\n\n\nMOD = 10**9 + 7\n\nH, W = list(map(int, input().split()))\n\nG = [eval(input()) for _ in range(H)]\n\n\n\n\n\ndef main():\n\n dist = [[-1] * W for _ in range(H)]\n\n dist[0][0] = 0\n\n\n\n dp = [[0] * W for _ in range(H)]\n\n for i in range(H):\n\n if G[i][0] == '#':\n\n break\n\n dp[i][0] = 1\n\n for i in range(W):\n\n if G[0][i] == '#':\n\n break\n\n dp[0][i] = 1\n\n\n\n que = deque([(0, 0)])\n\n\n\n while que:\n\n h, w = que.popleft()\n\n for dh, dw in ((1, 0), (0, 1)):\n\n nh = h + dh\n\n nw = w + dw\n\n if nh < 0 or nw < 0 or nh >= H or nw >= W:\n\n continue\n\n if G[nh][nw] == '#':\n\n continue\n\n if dist[nh][nw] != -1:\n\n continue\n\n if nh > 0 and nw > 0:\n\n dp[nh][nw] = (dp[nh - 1][nw] + dp[nh][nw - 1]) % MOD\n\n dist[nh][nw] = dist[h][w] + 1\n\n que.append((nh, nw))\n\n\n\n print((dp[H - 1][W - 1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"from collections import deque\n\n\n\nMOD = 10**9 + 7\n\nH, W = list(map(int, input().split()))\n\nG = [eval(input()) for _ in range(H)]\n\n\n\n\n\ndef main():\n\n dp = [[0] * W for _ in range(H)]\n\n for i in range(H):\n\n if G[i][0] == '#':\n\n break\n\n dp[i][0] = 1\n\n for i in range(W):\n\n if G[0][i] == '#':\n\n break\n\n dp[0][i] = 1\n\n\n\n que = deque([(0, 0)])\n\n\n\n while que:\n\n h, w = que.popleft()\n\n for dh, dw in ((1, 0), (0, 1)):\n\n nh = h + dh\n\n nw = w + dw\n\n if nh < 0 or nw < 0 or nh >= H or nw >= W:\n\n continue\n\n if G[nh][nw] == '#':\n\n continue\n\n if nh > 0 and nw > 0:\n\n if dp[nh][nw]:\n\n continue\n\n dp[nh][nw] = (dp[nh - 1][nw] + dp[nh][nw - 1]) % MOD\n\n que.append((nh, nw))\n\n\n\n print((dp[H - 1][W - 1]))\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":44,"code_v1_loc":40,"code_v0_num_chars":1049,"code_v1_num_chars":943,"code_v0_no_empty_lines":"from collections import deque\n\nMOD = 10**9 + 7\nH, W = list(map(int, input().split()))\nG = [eval(input()) for _ in range(H)]\n\n\ndef main():\n dist = [[-1] * W for _ in range(H)]\n dist[0][0] = 0\n dp = [[0] * W for _ in range(H)]\n for i in range(H):\n if G[i][0] == \"#\":\n break\n dp[i][0] = 1\n for i in range(W):\n if G[0][i] == \"#\":\n break\n dp[0][i] = 1\n que = deque([(0, 0)])\n while que:\n h, w = que.popleft()\n for dh, dw in ((1, 0), (0, 1)):\n nh = h + dh\n nw = w + dw\n if nh < 0 or nw < 0 or nh >= H or nw >= W:\n continue\n if G[nh][nw] == \"#\":\n continue\n if dist[nh][nw] != -1:\n continue\n if nh > 0 and nw > 0:\n dp[nh][nw] = (dp[nh - 1][nw] + dp[nh][nw - 1]) % MOD\n dist[nh][nw] = dist[h][w] + 1\n que.append((nh, nw))\n print((dp[H - 1][W - 1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"from collections import deque\n\nMOD = 10**9 + 7\nH, W = list(map(int, input().split()))\nG = [eval(input()) for _ in range(H)]\n\n\ndef main():\n dp = [[0] * W for _ in range(H)]\n for i in range(H):\n if G[i][0] == \"#\":\n break\n dp[i][0] = 1\n for i in range(W):\n if G[0][i] == \"#\":\n break\n dp[0][i] = 1\n que = deque([(0, 0)])\n while que:\n h, w = que.popleft()\n for dh, dw in ((1, 0), (0, 1)):\n nh = h + dh\n nw = w + dw\n if nh < 0 or nw < 0 or nh >= H or nw >= W:\n continue\n if G[nh][nw] == \"#\":\n continue\n if nh > 0 and nw > 0:\n if dp[nh][nw]:\n continue\n dp[nh][nw] = (dp[nh - 1][nw] + dp[nh][nw - 1]) % MOD\n que.append((nh, nw))\n print((dp[H - 1][W - 1]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["- dist = [[-1] * W for _ in range(H)]","- dist[0][0] = 0","- if dist[nh][nw] != -1:","- continue","+ if dp[nh][nw]:","+ continue","- dist[nh][nw] = dist[h][w] + 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.037165467,"measured_runtime_v1":0.0421036632,"runtime_lift":0.8827133837,"key":["s537459559","s936545985"]} +{"user_id":"u201234972","problem_id":"p02605","language":"python","submission_id_v0":"s305964210","submission_id_v1":"s049480014","cpu_time_v0":1066,"cpu_time_v1":985,"memory_v0":102780,"memory_v1":103036,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.6,"input":"N=int(eval(input()))\n\nXYU=[tuple(input().split()) for _ in range(N)]\n\nU=[]\n\nR=[]\n\nD=[]\n\nL=[]\n\nfor x,y,u in XYU:\n\n x,y = int(x),int(y)\n\n if u==\"U\":\n\n U.append((x,y))\n\n elif u==\"D\":\n\n D.append((x,y))\n\n elif u==\"L\":\n\n L.append((x,y))\n\n else:\n\n R.append((x,y))\n\nans=[10**9]\n\ndef z(A):\n\n A.sort()\n\n n=p=-10**9\n\n for k,c,a in A:\n\n if k!=n:\n\n if a==1:\n\n n=k\n\n p=c\n\n continue\n\n if a==1:\n\n p=c\n\n continue\n\n if (c-p)*5=10**9 else ans[0]))\n","target":"N=int(eval(input()))\n\nXYU=[tuple(input().split()) for _ in range(N)]\n\nU=[]\n\nR=[]\n\nD=[]\n\nL=[]\n\nfor x,y,u in XYU:\n\n x,y = int(x),int(y)\n\n if u==\"U\":\n\n U.append((x,y))\n\n elif u==\"D\":\n\n D.append((x,y))\n\n elif u==\"L\":\n\n L.append((x,y))\n\n else:\n\n R.append((x,y))\n\nans=10**9\n\ndef z(A):\n\n global ans\n\n A.sort()\n\n n=p=-10**9\n\n for k,c,a in A:\n\n if k!=n:\n\n if a==1:\n\n n=k\n\n p=c\n\n continue\n\n if a==1:\n\n p=c\n\n continue\n\n if (c-p)*5=10**9 else ans))","code_v0_loc":38,"code_v1_loc":39,"code_v0_num_chars":833,"code_v1_num_chars":831,"code_v0_no_empty_lines":"N = int(eval(input()))\nXYU = [tuple(input().split()) for _ in range(N)]\nU = []\nR = []\nD = []\nL = []\nfor x, y, u in XYU:\n x, y = int(x), int(y)\n if u == \"U\":\n U.append((x, y))\n elif u == \"D\":\n D.append((x, y))\n elif u == \"L\":\n L.append((x, y))\n else:\n R.append((x, y))\nans = [10**9]\n\n\ndef z(A):\n A.sort()\n n = p = -(10**9)\n for k, c, a in A:\n if k != n:\n if a == 1:\n n = k\n p = c\n continue\n if a == 1:\n p = c\n continue\n if (c - p) * 5 < ans[0]:\n ans[0] = (c - p) * 5\n\n\nz([(x, y, 1) for x, y in U] + [(x, y, -1) for x, y in D])\nz([(y, x, 1) for x, y in R] + [(y, x, -1) for x, y in L])\nz([(x + y, x - y, 1) for x, y in R] + [(x + y, x - y, -1) for x, y in U])\nz([(x + y, x - y, 1) for x, y in D] + [(x + y, x - y, -1) for x, y in L])\nz([(x - y, x + y, 1) for x, y in U] + [(x - y, x + y, -1) for x, y in L])\nz([(x - y, x + y, 1) for x, y in R] + [(x - y, x + y, -1) for x, y in D])\nprint((\"SAFE\" if ans[0] >= 10**9 else ans[0]))\n","code_v1_no_empty_lines":"N = int(eval(input()))\nXYU = [tuple(input().split()) for _ in range(N)]\nU = []\nR = []\nD = []\nL = []\nfor x, y, u in XYU:\n x, y = int(x), int(y)\n if u == \"U\":\n U.append((x, y))\n elif u == \"D\":\n D.append((x, y))\n elif u == \"L\":\n L.append((x, y))\n else:\n R.append((x, y))\nans = 10**9\n\n\ndef z(A):\n global ans\n A.sort()\n n = p = -(10**9)\n for k, c, a in A:\n if k != n:\n if a == 1:\n n = k\n p = c\n continue\n if a == 1:\n p = c\n continue\n if (c - p) * 5 < ans:\n ans = (c - p) * 5\n\n\nz([(x, y, 1) for x, y in U] + [(x, y, -1) for x, y in D])\nz([(y, x, 1) for x, y in R] + [(y, x, -1) for x, y in L])\nz([(x + y, x - y, 1) for x, y in R] + [(x + y, x - y, -1) for x, y in U])\nz([(x + y, x - y, 1) for x, y in D] + [(x + y, x - y, -1) for x, y in L])\nz([(x - y, x + y, 1) for x, y in U] + [(x - y, x + y, -1) for x, y in L])\nz([(x - y, x + y, 1) for x, y in R] + [(x - y, x + y, -1) for x, y in D])\nprint((\"SAFE\" if ans >= 10**9 else ans))\n","code_same":false,"relative_loc_diff_percent":2.5641025641,"diff":["-ans = [10**9]","+ans = 10**9","+ global ans","- if (c - p) * 5 < ans[0]:","- ans[0] = (c - p) * 5","+ if (c - p) * 5 < ans:","+ ans = (c - p) * 5","-print((\"SAFE\" if ans[0] >= 10**9 else ans[0]))","+print((\"SAFE\" if ans >= 10**9 else ans))"],"diff_only_import_comment":false,"measured_runtime_v0":0.038016932,"measured_runtime_v1":0.0421474953,"runtime_lift":0.9019974202,"key":["s305964210","s049480014"]} +{"user_id":"u814986259","problem_id":"p03371","language":"python","submission_id_v0":"s669329486","submission_id_v1":"s560599892","cpu_time_v0":20,"cpu_time_v1":17,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.0,"input":"A,B,C,X,Y=list(map(int,input().split()))\n\nans= min(A+B,2*C)*min(X,Y)\n\nif X>Y:\n\n ans+=min(A,2*C)*(X-Y)\n\nelse:\n\n ans+=min(B,2*C)*(Y-X)\n\nprint(ans)\n","target":"a,b,c,x,y=list(map(int,input().split()))\n\nans=a*x+b*y\n\nans=min(ans,c*x*2 +max(0,y-x)*b,c*y*2+max(0,x-y)*a)\n\nprint(ans)","code_v0_loc":7,"code_v1_loc":4,"code_v0_num_chars":141,"code_v1_num_chars":112,"code_v0_no_empty_lines":"A, B, C, X, Y = list(map(int, input().split()))\nans = min(A + B, 2 * C) * min(X, Y)\nif X > Y:\n ans += min(A, 2 * C) * (X - Y)\nelse:\n ans += min(B, 2 * C) * (Y - X)\nprint(ans)\n","code_v1_no_empty_lines":"a, b, c, x, y = list(map(int, input().split()))\nans = a * x + b * y\nans = min(ans, c * x * 2 + max(0, y - x) * b, c * y * 2 + max(0, x - y) * a)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-A, B, C, X, Y = list(map(int, input().split()))","-ans = min(A + B, 2 * C) * min(X, Y)","-if X > Y:","- ans += min(A, 2 * C) * (X - Y)","-else:","- ans += min(B, 2 * C) * (Y - X)","+a, b, c, x, y = list(map(int, input().split()))","+ans = a * x + b * y","+ans = min(ans, c * x * 2 + max(0, y - x) * b, c * y * 2 + max(0, x - y) * a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0386554942,"measured_runtime_v1":0.0370822752,"runtime_lift":1.0424250951,"key":["s669329486","s560599892"]} +{"user_id":"u580093517","problem_id":"p03835","language":"python","submission_id_v0":"s889813027","submission_id_v1":"s668052707","cpu_time_v0":1749,"cpu_time_v1":1483,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.21,"input":"k,s = list(map(int,input().split()))\n\ncnt = 0\n\nfor i in range(0,k+1):\n\n for j in range(0,k+1):\n\n if s-i-j <= k and 0 <= s-i-j:\n\n cnt += 1\n\nprint(cnt)","target":"k,s = list(map(int,input().split()))\n\nc = 0\n\nfor x in range(k+1):\n\n for y in range(k+1):\n\n z = s-x-y\n\n if 0<=z<=k:c += 1\n\nprint(c)","code_v0_loc":7,"code_v1_loc":7,"code_v0_num_chars":165,"code_v1_num_chars":141,"code_v0_no_empty_lines":"k, s = list(map(int, input().split()))\ncnt = 0\nfor i in range(0, k + 1):\n for j in range(0, k + 1):\n if s - i - j <= k and 0 <= s - i - j:\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"k, s = list(map(int, input().split()))\nc = 0\nfor x in range(k + 1):\n for y in range(k + 1):\n z = s - x - y\n if 0 <= z <= k:\n c += 1\nprint(c)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-cnt = 0","-for i in range(0, k + 1):","- for j in range(0, k + 1):","- if s - i - j <= k and 0 <= s - i - j:","- cnt += 1","-print(cnt)","+c = 0","+for x in range(k + 1):","+ for y in range(k + 1):","+ z = s - x - y","+ if 0 <= z <= k:","+ c += 1","+print(c)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0437841617,"measured_runtime_v1":0.0454096932,"runtime_lift":0.9642029838,"key":["s889813027","s668052707"]} +{"user_id":"u456353530","problem_id":"p02559","language":"python","submission_id_v0":"s385696568","submission_id_v1":"s871450342","cpu_time_v0":4965,"cpu_time_v1":1305,"memory_v0":145832,"memory_v1":175000,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":73.72,"input":"# test\n\nclass fenwick_tree:\n\n def __init__(s, n):\n\n s._n = n\n\n s.data = [0] * n\n\n\n\n def add(s, p, x):\n\n p += 1\n\n while p <= s._n:\n\n s.data[p - 1] += x\n\n p += p & -p\n\n\n\n def sumlr(s, l, r):\n\n return s.sum(r) - s.sum(l)\n\n\n\n def sum(self, r):\n\n s = 0\n\n while r > 0:\n\n s += self.data[r - 1]\n\n r -= r & -r\n\n return s\n\n\n\n\n\nN, Q = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nQuery = [list(map(int, input().split())) for _ in range(Q)]\n\n \n\nbit = fenwick_tree(N)\n\nfor i in range(N):\n\n bit.add(i, a[i])\n\n\n\nfor q in Query:\n\n if q[0] == 0:\n\n _, p, x = q\n\n bit.add(p, x)\n\n else:\n\n _, l, r = q\n\n print((bit.sumlr(l, r)))\n","target":"class BIT:\n\n def __init__(s, n):\n\n s._n = n\n\n s.data = [0] * n\n\n def add(s, p, x):\n\n p += 1\n\n while p <= s._n:\n\n s.data[p - 1] += x\n\n p += p & -p\n\n def sum(s, l, r):\n\n return s.zum(r) - s.zum(l)\n\n def zum(s, r):\n\n ans = 0\n\n while r > 0:\n\n ans += s.data[r - 1]\n\n r -= r & -r\n\n return ans\n\n\n\nN, Q = list(map(int, input().split()))\n\na = list(map(int, input().split()))\n\nQuery = [list(map(int, input().split())) for _ in range(Q)]\n\n \n\nbit = BIT(N)\n\nfor i in range(N):\n\n bit.add(i, a[i])\n\n \n\nfor q in Query:\n\n if q[0] == 0:\n\n _, p, x = q\n\n bit.add(p, x)\n\n else:\n\n _, l, r = q\n\n print((bit.sum(l, r)))","code_v0_loc":38,"code_v1_loc":33,"code_v0_num_chars":695,"code_v1_num_chars":657,"code_v0_no_empty_lines":"# test\nclass fenwick_tree:\n def __init__(s, n):\n s._n = n\n s.data = [0] * n\n\n def add(s, p, x):\n p += 1\n while p <= s._n:\n s.data[p - 1] += x\n p += p & -p\n\n def sumlr(s, l, r):\n return s.sum(r) - s.sum(l)\n\n def sum(self, r):\n s = 0\n while r > 0:\n s += self.data[r - 1]\n r -= r & -r\n return s\n\n\nN, Q = list(map(int, input().split()))\na = list(map(int, input().split()))\nQuery = [list(map(int, input().split())) for _ in range(Q)]\nbit = fenwick_tree(N)\nfor i in range(N):\n bit.add(i, a[i])\nfor q in Query:\n if q[0] == 0:\n _, p, x = q\n bit.add(p, x)\n else:\n _, l, r = q\n print((bit.sumlr(l, r)))\n","code_v1_no_empty_lines":"class BIT:\n def __init__(s, n):\n s._n = n\n s.data = [0] * n\n\n def add(s, p, x):\n p += 1\n while p <= s._n:\n s.data[p - 1] += x\n p += p & -p\n\n def sum(s, l, r):\n return s.zum(r) - s.zum(l)\n\n def zum(s, r):\n ans = 0\n while r > 0:\n ans += s.data[r - 1]\n r -= r & -r\n return ans\n\n\nN, Q = list(map(int, input().split()))\na = list(map(int, input().split()))\nQuery = [list(map(int, input().split())) for _ in range(Q)]\nbit = BIT(N)\nfor i in range(N):\n bit.add(i, a[i])\nfor q in Query:\n if q[0] == 0:\n _, p, x = q\n bit.add(p, x)\n else:\n _, l, r = q\n print((bit.sum(l, r)))\n","code_same":false,"relative_loc_diff_percent":13.1578947368,"diff":["-# test","-class fenwick_tree:","+class BIT:","- def sumlr(s, l, r):","- return s.sum(r) - s.sum(l)","+ def sum(s, l, r):","+ return s.zum(r) - s.zum(l)","- def sum(self, r):","- s = 0","+ def zum(s, r):","+ ans = 0","- s += self.data[r - 1]","+ ans += s.data[r - 1]","- return s","+ return ans","-bit = fenwick_tree(N)","+bit = BIT(N)","- print((bit.sumlr(l, r)))","+ print((bit.sum(l, r)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.046361001,"measured_runtime_v1":0.0470500569,"runtime_lift":0.9853548332,"key":["s385696568","s871450342"]} +{"user_id":"u816631826","problem_id":"p03261","language":"python","submission_id_v0":"s919824576","submission_id_v1":"s768389776","cpu_time_v0":18,"cpu_time_v1":10,"memory_v0":3064,"memory_v1":2696,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.44,"input":"import sys\n\nN=int(eval(input()))\n\na=[[] for i in range(N)]\n\nfor i in range(N):\n\n a[i]=eval(input())\n\n \n\nfor i in range(N):\n\n if i>0:\n\n if a[i-1][len(a[i-1])-1]!=a[i][0]:\n\n print(\"No\")\n\n sys.exit()\n\n\n\nfor i in range(N):\n\n for j in range(1,N-i-1):\n\n if a[i] == a[N-j]:\n\n print(\"No\")\n\n sys.exit()\n\n\n\nprint(\"Yes\")\n","target":"#!\/usr\/bin\/python\n\n# -*- coding: utf-8 -*-\n\nn = int(input())\n\ns = []\n\nfor _ in range(n):\n\n s.append(input())\n\n\n\nss = set()\n\nlast = None\n\nret = 'Yes'\n\nfor w in s:\n\n if w in ss:\n\n ret = 'No'\n\n break\n\n if last is None:\n\n ss.add(w)\n\n last = w\n\n continue\n\n if last[-1] != w[0]:\n\n ret = 'No'\n\n break\n\n ss.add(w)\n\n last = w\n\n\n\nprint(ret)","code_v0_loc":19,"code_v1_loc":25,"code_v0_num_chars":376,"code_v1_num_chars":405,"code_v0_no_empty_lines":"import sys\n\nN = int(eval(input()))\na = [[] for i in range(N)]\nfor i in range(N):\n a[i] = eval(input())\nfor i in range(N):\n if i > 0:\n if a[i - 1][len(a[i - 1]) - 1] != a[i][0]:\n print(\"No\")\n sys.exit()\nfor i in range(N):\n for j in range(1, N - i - 1):\n if a[i] == a[N - j]:\n print(\"No\")\n sys.exit()\nprint(\"Yes\")\n","code_v1_no_empty_lines":"#!\/usr\/bin\/python\n# -*- coding: utf-8 -*-\nn = int(input())\ns = []\nfor _ in range(n):\n s.append(input())\nss = set()\nlast = None\nret = \"Yes\"\nfor w in s:\n if w in ss:\n ret = \"No\"\n break\n if last is None:\n ss.add(w)\n last = w\n continue\n if last[-1] != w[0]:\n ret = \"No\"\n break\n ss.add(w)\n last = w\nprint(ret)\n","code_same":false,"relative_loc_diff_percent":24.0,"diff":["-import sys","-","-N = int(eval(input()))","-a = [[] for i in range(N)]","-for i in range(N):","- a[i] = eval(input())","-for i in range(N):","- if i > 0:","- if a[i - 1][len(a[i - 1]) - 1] != a[i][0]:","- print(\"No\")","- sys.exit()","-for i in range(N):","- for j in range(1, N - i - 1):","- if a[i] == a[N - j]:","- print(\"No\")","- sys.exit()","-print(\"Yes\")","+#!\/usr\/bin\/python","+# -*- coding: utf-8 -*-","+n = int(input())","+s = []","+for _ in range(n):","+ s.append(input())","+ss = set()","+last = None","+ret = \"Yes\"","+for w in s:","+ if w in ss:","+ ret = \"No\"","+ break","+ if last is None:","+ ss.add(w)","+ last = w","+ continue","+ if last[-1] != w[0]:","+ ret = \"No\"","+ break","+ ss.add(w)","+ last = w","+print(ret)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0405474529,"measured_runtime_v1":0.0351044445,"runtime_lift":1.1550518314,"key":["s919824576","s768389776"]} +{"user_id":"u133936772","problem_id":"p02781","language":"python","submission_id_v0":"s753092126","submission_id_v1":"s997205159","cpu_time_v0":367,"cpu_time_v1":22,"memory_v0":3060,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":94.01,"input":"def f(n,k):\n\n if k<1: return 1\n\n if n<10:\n\n if k<2: return n\n\n return 0\n\n d,m=n\/\/10,n%10\n\n return f(d,k-1)*m+f(d-1,k-1)*(9-m)+f(d,k)\n\nprint((f(int(eval(input())),int(eval(input())))))","target":"s=eval(input())\n\nn=len(s)\n\nK=int(eval(input()))\n\ndp=[[[0,0] for _ in range(K+1)] for _ in range(n+1)]\n\ndp[0][0][0]=1\n\nr=range\n\nfor i in r(n):\n\n nd=int(s[i])\n\n for j in r(K+1):\n\n for k in r(2):\n\n for d in r(10):\n\n ni,nj,nk=i+1,j,k\n\n if d: nj+=1\n\n if nj>K: continue\n\n if k<1:\n\n if d>nd: continue\n\n if d K:\n continue\n if k < 1:\n if d > nd:\n continue\n if d < nd:\n nk = 1\n dp[ni][nj][nk] += dp[i][j][k]\nprint((dp[n][K][0] + dp[n][K][1]))\n","code_same":false,"relative_loc_diff_percent":57.8947368421,"diff":["-def f(n, k):","- if k < 1:","- return 1","- if n < 10:","- if k < 2:","- return n","- return 0","- d, m = n \/\/ 10, n % 10","- return f(d, k - 1) * m + f(d - 1, k - 1) * (9 - m) + f(d, k)","-","-","-print((f(int(eval(input())), int(eval(input())))))","+s = eval(input())","+n = len(s)","+K = int(eval(input()))","+dp = [[[0, 0] for _ in range(K + 1)] for _ in range(n + 1)]","+dp[0][0][0] = 1","+r = range","+for i in r(n):","+ nd = int(s[i])","+ for j in r(K + 1):","+ for k in r(2):","+ for d in r(10):","+ ni, nj, nk = i + 1, j, k","+ if d:","+ nj += 1","+ if nj > K:","+ continue","+ if k < 1:","+ if d > nd:","+ continue","+ if d < nd:","+ nk = 1","+ dp[ni][nj][nk] += dp[i][j][k]","+print((dp[n][K][0] + dp[n][K][1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1072843614,"measured_runtime_v1":0.0377678111,"runtime_lift":2.8406295817,"key":["s753092126","s997205159"]} +{"user_id":"u001024152","problem_id":"p03601","language":"python","submission_id_v0":"s061835675","submission_id_v1":"s446662736","cpu_time_v0":36,"cpu_time_v1":25,"memory_v0":5048,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.56,"input":"from fractions import gcd\n\ndef solve():\n\n A,B,C,D,E,F = list(map(int, input().split()))\n\n ans = {\"w\":A*100, \"s\":0}\n\n def density(water, sugar):\n\n return 100*sugar\/(water+sugar)\n\n\n\n G = gcd(C,D)\n\n for a in range(31):\n\n for b in range(31):\n\n water = (a*A+b*B)*100\n\n if water>F:\n\n continue\n\n max_sugar = min((a*A+b*B)*E, F-water)\n\n sugar = int(G*(max_sugar\/\/G))\n\n if sugardensity(ans[\"w\"], ans[\"s\"]):\n\n ans[\"w\"] = water\n\n ans[\"s\"] = sugar\n\n #print(water, sugar)\n\n print((ans[\"w\"]+ans[\"s\"], ans[\"s\"]))\n\n \n\nif __name__ == '__main__':\n\n solve()","target":"A,B,C,D,E,F = list(map(int, input().split()))\n\nans = {\"w\":A*100, \"s\":0}\n\ndef density(water, sugar):\n\n return 100*sugar\/(water+sugar)\n\n\n\nfor a in range(31):\n\n for b in range(31):\n\n water = (a*A+b*B)*100\n\n if water>F:\n\n continue\n\n max_sugar = min((a*A+b*B)*E, F-water)\n\n for c in range(max_sugar\/\/C+1):\n\n sugar = c*C\n\n sugar += ((max_sugar-sugar)\/\/D)*D\n\n if water+sugar==0: \n\n continue\n\n if density(water, sugar)>density(ans[\"w\"], ans[\"s\"]):\n\n ans[\"w\"] = water\n\n ans[\"s\"] = sugar\n\nprint((ans[\"w\"]+ans[\"s\"], ans[\"s\"]))","code_v0_loc":26,"code_v1_loc":20,"code_v0_num_chars":800,"code_v1_num_chars":641,"code_v0_no_empty_lines":"from fractions import gcd\n\n\ndef solve():\n A, B, C, D, E, F = list(map(int, input().split()))\n ans = {\"w\": A * 100, \"s\": 0}\n\n def density(water, sugar):\n return 100 * sugar \/ (water + sugar)\n\n G = gcd(C, D)\n for a in range(31):\n for b in range(31):\n water = (a * A + b * B) * 100\n if water > F:\n continue\n max_sugar = min((a * A + b * B) * E, F - water)\n sugar = int(G * (max_sugar \/\/ G))\n if sugar < min(C, D):\n continue\n if water + sugar == 0:\n continue\n if density(water, sugar) > density(ans[\"w\"], ans[\"s\"]):\n ans[\"w\"] = water\n ans[\"s\"] = sugar\n # print(water, sugar)\n print((ans[\"w\"] + ans[\"s\"], ans[\"s\"]))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"A, B, C, D, E, F = list(map(int, input().split()))\nans = {\"w\": A * 100, \"s\": 0}\n\n\ndef density(water, sugar):\n return 100 * sugar \/ (water + sugar)\n\n\nfor a in range(31):\n for b in range(31):\n water = (a * A + b * B) * 100\n if water > F:\n continue\n max_sugar = min((a * A + b * B) * E, F - water)\n for c in range(max_sugar \/\/ C + 1):\n sugar = c * C\n sugar += ((max_sugar - sugar) \/\/ D) * D\n if water + sugar == 0:\n continue\n if density(water, sugar) > density(ans[\"w\"], ans[\"s\"]):\n ans[\"w\"] = water\n ans[\"s\"] = sugar\nprint((ans[\"w\"] + ans[\"s\"], ans[\"s\"]))\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-from fractions import gcd","+A, B, C, D, E, F = list(map(int, input().split()))","+ans = {\"w\": A * 100, \"s\": 0}","-def solve():","- A, B, C, D, E, F = list(map(int, input().split()))","- ans = {\"w\": A * 100, \"s\": 0}","+def density(water, sugar):","+ return 100 * sugar \/ (water + sugar)","- def density(water, sugar):","- return 100 * sugar \/ (water + sugar)","- G = gcd(C, D)","- for a in range(31):","- for b in range(31):","- water = (a * A + b * B) * 100","- if water > F:","- continue","- max_sugar = min((a * A + b * B) * E, F - water)","- sugar = int(G * (max_sugar \/\/ G))","- if sugar < min(C, D):","- continue","+for a in range(31):","+ for b in range(31):","+ water = (a * A + b * B) * 100","+ if water > F:","+ continue","+ max_sugar = min((a * A + b * B) * E, F - water)","+ for c in range(max_sugar \/\/ C + 1):","+ sugar = c * C","+ sugar += ((max_sugar - sugar) \/\/ D) * D","- # print(water, sugar)","- print((ans[\"w\"] + ans[\"s\"], ans[\"s\"]))","-","-","-if __name__ == \"__main__\":","- solve()","+print((ans[\"w\"] + ans[\"s\"], ans[\"s\"]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0459911346,"measured_runtime_v1":0.0836685181,"runtime_lift":0.5496826728,"key":["s061835675","s446662736"]} +{"user_id":"u919730120","problem_id":"p02947","language":"python","submission_id_v0":"s640388885","submission_id_v1":"s377974415","cpu_time_v0":539,"cpu_time_v1":319,"memory_v0":21988,"memory_v1":26144,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.82,"input":"n=int(eval(input()))\n\nA={}\n\nfor i in range(n):\n\n s=str(sorted(eval(input())))\n\n if s in list(A.keys()):\n\n A[s]+=1\n\n else:\n\n A[s]=1\n\nans=0\n\nfor i in list(A.values()):\n\n ans+=int(i*(i-1)\/2)\n\nprint(ans)","target":"def resolve():\n\n n=int(eval(input()))\n\n s={}\n\n for i in range(n):\n\n x=str(sorted(list(eval(input()))))\n\n if x in list(s.keys()):\n\n s[x]+=1\n\n else:\n\n s[x]=1\n\n ans=0\n\n if s:\n\n for i in list(s.values()):\n\n ans+=i*(i-1)\/\/2\n\n print(ans)\n\n\n\nif __name__ == '__main__':\n\n resolve()","code_v0_loc":12,"code_v1_loc":17,"code_v0_num_chars":191,"code_v1_num_chars":331,"code_v0_no_empty_lines":"n = int(eval(input()))\nA = {}\nfor i in range(n):\n s = str(sorted(eval(input())))\n if s in list(A.keys()):\n A[s] += 1\n else:\n A[s] = 1\nans = 0\nfor i in list(A.values()):\n ans += int(i * (i - 1) \/ 2)\nprint(ans)\n","code_v1_no_empty_lines":"def resolve():\n n = int(eval(input()))\n s = {}\n for i in range(n):\n x = str(sorted(list(eval(input()))))\n if x in list(s.keys()):\n s[x] += 1\n else:\n s[x] = 1\n ans = 0\n if s:\n for i in list(s.values()):\n ans += i * (i - 1) \/\/ 2\n print(ans)\n\n\nif __name__ == \"__main__\":\n resolve()\n","code_same":false,"relative_loc_diff_percent":29.4117647059,"diff":["-n = int(eval(input()))","-A = {}","-for i in range(n):","- s = str(sorted(eval(input())))","- if s in list(A.keys()):","- A[s] += 1","- else:","- A[s] = 1","-ans = 0","-for i in list(A.values()):","- ans += int(i * (i - 1) \/ 2)","-print(ans)","+def resolve():","+ n = int(eval(input()))","+ s = {}","+ for i in range(n):","+ x = str(sorted(list(eval(input()))))","+ if x in list(s.keys()):","+ s[x] += 1","+ else:","+ s[x] = 1","+ ans = 0","+ if s:","+ for i in list(s.values()):","+ ans += i * (i - 1) \/\/ 2","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ resolve()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0339508231,"measured_runtime_v1":0.0419076755,"runtime_lift":0.8101337679,"key":["s640388885","s377974415"]} +{"user_id":"u947762778","problem_id":"p02263","language":"python","submission_id_v0":"s895579482","submission_id_v1":"s501210874","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7696,"memory_v1":7720,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"x = input().split()\n\nA = []\n\nfor i in x:\n\n try:\n\n A.append(int(i))\n\n except:\n\n b = A.pop()\n\n a = A.pop()\n\n if i == '+':\n\n A.append(a + b)\n\n if i == '-':\n\n A.append(a - b)\n\n if i == '*':\n\n A.append(a * b)\n\nprint((A.pop()))","target":"inList = input().split()\n\nstack = []\n\nfor i in inList:\n\n if i in ['+', '-', '*']:\n\n b, a = stack.pop(), stack.pop()\n\n if i == '+':\n\n stack.append(b + a)\n\n if i == '-':\n\n stack.append(a - b)\n\n if i == '*':\n\n stack.append(b * a)\n\n else:\n\n stack.append(int(i))\n\nprint((stack.pop()))","code_v0_loc":15,"code_v1_loc":14,"code_v0_num_chars":300,"code_v1_num_chars":351,"code_v0_no_empty_lines":"x = input().split()\nA = []\nfor i in x:\n try:\n A.append(int(i))\n except:\n b = A.pop()\n a = A.pop()\n if i == \"+\":\n A.append(a + b)\n if i == \"-\":\n A.append(a - b)\n if i == \"*\":\n A.append(a * b)\nprint((A.pop()))\n","code_v1_no_empty_lines":"inList = input().split()\nstack = []\nfor i in inList:\n if i in [\"+\", \"-\", \"*\"]:\n b, a = stack.pop(), stack.pop()\n if i == \"+\":\n stack.append(b + a)\n if i == \"-\":\n stack.append(a - b)\n if i == \"*\":\n stack.append(b * a)\n else:\n stack.append(int(i))\nprint((stack.pop()))\n","code_same":false,"relative_loc_diff_percent":6.6666666667,"diff":["-x = input().split()","-A = []","-for i in x:","- try:","- A.append(int(i))","- except:","- b = A.pop()","- a = A.pop()","+inList = input().split()","+stack = []","+for i in inList:","+ if i in [\"+\", \"-\", \"*\"]:","+ b, a = stack.pop(), stack.pop()","- A.append(a + b)","+ stack.append(b + a)","- A.append(a - b)","+ stack.append(a - b)","- A.append(a * b)","-print((A.pop()))","+ stack.append(b * a)","+ else:","+ stack.append(int(i))","+print((stack.pop()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0509836194,"measured_runtime_v1":0.0506789978,"runtime_lift":1.0060108057,"key":["s895579482","s501210874"]} +{"user_id":"u400765446","problem_id":"p02393","language":"python","submission_id_v0":"s614753345","submission_id_v1":"s269134002","cpu_time_v0":30,"cpu_time_v1":20,"memory_v0":7784,"memory_v1":5584,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":33.33,"input":"def main():\n\n x = eval(input())\n\n x1, x2, x3 = x.split(' ') \n\n a = int(x1)\n\n b = int(x2)\n\n c = int(x3)\n\n z = [a, b, c]\n\n z.sort()\n\n print((z[0],z[1],z[2]))\n\n\n\nif __name__ == \"__main__\":\n\n main()","target":"three_numbers = list(map(int, input().split()))\n\na, b, c = sorted(three_numbers)\n\nprint((a, b, c))\n","code_v0_loc":12,"code_v1_loc":3,"code_v0_num_chars":213,"code_v1_num_chars":91,"code_v0_no_empty_lines":"def main():\n x = eval(input())\n x1, x2, x3 = x.split(\" \")\n a = int(x1)\n b = int(x2)\n c = int(x3)\n z = [a, b, c]\n z.sort()\n print((z[0], z[1], z[2]))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"three_numbers = list(map(int, input().split()))\na, b, c = sorted(three_numbers)\nprint((a, b, c))\n","code_same":false,"relative_loc_diff_percent":75.0,"diff":["-def main():","- x = eval(input())","- x1, x2, x3 = x.split(\" \")","- a = int(x1)","- b = int(x2)","- c = int(x3)","- z = [a, b, c]","- z.sort()","- print((z[0], z[1], z[2]))","-","-","-if __name__ == \"__main__\":","- main()","+three_numbers = list(map(int, input().split()))","+a, b, c = sorted(three_numbers)","+print((a, b, c))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0452903748,"measured_runtime_v1":0.0430077553,"runtime_lift":1.0530746013,"key":["s614753345","s269134002"]} +{"user_id":"u747602774","problem_id":"p03338","language":"python","submission_id_v0":"s702364293","submission_id_v1":"s037759526","cpu_time_v0":21,"cpu_time_v1":19,"memory_v0":3316,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":9.52,"input":"import collections\n\nN = int(eval(input()))\n\nY = list(eval(input()))\n\nX = []\n\nans = 0\n\nfor n in range(N):\n\n X.append(Y.pop(0))\n\n X_and_Y = set(X) & set(Y)\n\n ans = max(ans,len(X_and_Y))\n\nprint(ans)\n","target":"N = int(eval(input()))\n\nS = eval(input())\n\nans = 0\n\nfor i in range(N):\n\n a = S[:i+1]\n\n b = S[i+1:]\n\n c = 0\n\n for j in range(26):\n\n if chr(j+97) in a and chr(j+97) in b:\n\n c += 1\n\n ans = max(ans,c)\n\nprint(ans)","code_v0_loc":10,"code_v1_loc":12,"code_v0_num_chars":193,"code_v1_num_chars":229,"code_v0_no_empty_lines":"import collections\n\nN = int(eval(input()))\nY = list(eval(input()))\nX = []\nans = 0\nfor n in range(N):\n X.append(Y.pop(0))\n X_and_Y = set(X) & set(Y)\n ans = max(ans, len(X_and_Y))\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nS = eval(input())\nans = 0\nfor i in range(N):\n a = S[: i + 1]\n b = S[i + 1 :]\n c = 0\n for j in range(26):\n if chr(j + 97) in a and chr(j + 97) in b:\n c += 1\n ans = max(ans, c)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":16.6666666667,"diff":["-import collections","-","-Y = list(eval(input()))","-X = []","+S = eval(input())","-for n in range(N):","- X.append(Y.pop(0))","- X_and_Y = set(X) & set(Y)","- ans = max(ans, len(X_and_Y))","+for i in range(N):","+ a = S[: i + 1]","+ b = S[i + 1 :]","+ c = 0","+ for j in range(26):","+ if chr(j + 97) in a and chr(j + 97) in b:","+ c += 1","+ ans = max(ans, c)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1202728403,"measured_runtime_v1":0.1058244894,"runtime_lift":1.1365312602,"key":["s702364293","s037759526"]} +{"user_id":"u670180528","problem_id":"p03036","language":"python","submission_id_v0":"s214032493","submission_id_v1":"s312673049","cpu_time_v0":164,"cpu_time_v1":17,"memory_v0":38384,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.63,"input":"r,d,x = list(map(int,input().split()))\n\nfor i in range(10):\n\n temp = r*x - d\n\n print(temp)\n\n x = temp","target":"r,d,x=list(map(int,input().split()))\n\nfor i in range(10):x=r*x-d;print(x)","code_v0_loc":5,"code_v1_loc":2,"code_v0_num_chars":98,"code_v1_num_chars":67,"code_v0_no_empty_lines":"r, d, x = list(map(int, input().split()))\nfor i in range(10):\n temp = r * x - d\n print(temp)\n x = temp\n","code_v1_no_empty_lines":"r, d, x = list(map(int, input().split()))\nfor i in range(10):\n x = r * x - d\n print(x)\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["- temp = r * x - d","- print(temp)","- x = temp","+ x = r * x - d","+ print(x)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0355025838,"measured_runtime_v1":0.0371792132,"runtime_lift":0.9549041185,"key":["s214032493","s312673049"]} +{"user_id":"u562935282","problem_id":"p03611","language":"python","submission_id_v0":"s473052755","submission_id_v1":"s286094485","cpu_time_v0":126,"cpu_time_v1":69,"memory_v0":13964,"memory_v1":14220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.24,"input":"def inpl():\n\n return input().split()\n\n\n\nn = int(eval(input()))\n\na = list(map(int, inpl()))\n\nd = {}\n\nfor i in range(n):\n\n d[a[i]] = d.get(a[i], 0) + 1\n\n\n\nans = 0\n\nfor k in list(d.keys()):\n\n b = 0\n\n b += d.get(k - 1, 0)\n\n b += d.get(k, 0)\n\n b += d.get(k + 1, 0)\n\n ans = max(ans, b)\n\nprint(ans)","target":"def main():\n\n from collections import deque\n\n\n\n N = int(eval(input()))\n\n *a, = list(map(int, input().split()))\n\n\n\n b = [0] * (10 ** 5 + 10)\n\n for x in a:\n\n b[x] += 1\n\n\n\n dq = deque()\n\n b_iter = iter(b)\n\n dq.append(next(b_iter))\n\n dq.append(next(b_iter))\n\n dq.append(next(b_iter))\n\n t = sum(dq)\n\n ans = t\n\n for x in b:\n\n dq.append(x)\n\n y = dq.popleft()\n\n t = t + x - y\n\n if ans < t:\n\n ans = t\n\n print(ans)\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":17,"code_v1_loc":28,"code_v0_num_chars":300,"code_v1_num_chars":525,"code_v0_no_empty_lines":"def inpl():\n return input().split()\n\n\nn = int(eval(input()))\na = list(map(int, inpl()))\nd = {}\nfor i in range(n):\n d[a[i]] = d.get(a[i], 0) + 1\nans = 0\nfor k in list(d.keys()):\n b = 0\n b += d.get(k - 1, 0)\n b += d.get(k, 0)\n b += d.get(k + 1, 0)\n ans = max(ans, b)\nprint(ans)\n","code_v1_no_empty_lines":"def main():\n from collections import deque\n\n N = int(eval(input()))\n (*a,) = list(map(int, input().split()))\n b = [0] * (10**5 + 10)\n for x in a:\n b[x] += 1\n dq = deque()\n b_iter = iter(b)\n dq.append(next(b_iter))\n dq.append(next(b_iter))\n dq.append(next(b_iter))\n t = sum(dq)\n ans = t\n for x in b:\n dq.append(x)\n y = dq.popleft()\n t = t + x - y\n if ans < t:\n ans = t\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":39.2857142857,"diff":["-def inpl():","- return input().split()","+def main():","+ from collections import deque","+","+ N = int(eval(input()))","+ (*a,) = list(map(int, input().split()))","+ b = [0] * (10**5 + 10)","+ for x in a:","+ b[x] += 1","+ dq = deque()","+ b_iter = iter(b)","+ dq.append(next(b_iter))","+ dq.append(next(b_iter))","+ dq.append(next(b_iter))","+ t = sum(dq)","+ ans = t","+ for x in b:","+ dq.append(x)","+ y = dq.popleft()","+ t = t + x - y","+ if ans < t:","+ ans = t","+ print(ans)","-n = int(eval(input()))","-a = list(map(int, inpl()))","-d = {}","-for i in range(n):","- d[a[i]] = d.get(a[i], 0) + 1","-ans = 0","-for k in list(d.keys()):","- b = 0","- b += d.get(k - 1, 0)","- b += d.get(k, 0)","- b += d.get(k + 1, 0)","- ans = max(ans, b)","-print(ans)","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0474348545,"measured_runtime_v1":0.0554657459,"runtime_lift":0.8552098905,"key":["s473052755","s286094485"]} +{"user_id":"u644907318","problem_id":"p03254","language":"python","submission_id_v0":"s663171598","submission_id_v1":"s181157669","cpu_time_v0":169,"cpu_time_v1":62,"memory_v0":38256,"memory_v1":61964,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.31,"input":"N,x = list(map(int,input().split()))\n\nA = sorted(list(map(int,input().split())))\n\ncnt = 0\n\ntot = A[0]\n\nwhile cnt=2*sum(A):\n\n print((0))\n\nelse:\n\n ind = N\n\n for i in range(N):\n\n x -= A[i]\n\n if x<0:\n\n ind = i\n\n break\n\n if ind==N and x>0:\n\n A = sorted(A,reverse=True)\n\n for i in range(N):\n\n x -= A[i]\n\n if x<0:\n\n ind -= 1\n\n break\n\n print(ind)","code_v0_loc":11,"code_v1_loc":19,"code_v0_num_chars":220,"code_v1_num_chars":422,"code_v0_no_empty_lines":"N, x = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())))\ncnt = 0\ntot = A[0]\nwhile cnt < N and tot <= x:\n cnt += 1\n if cnt < N:\n tot += A[cnt]\nif cnt == N and tot < x:\n cnt -= 1\nprint(cnt)\n","code_v1_no_empty_lines":"N, x = list(map(int, input().split()))\nA = sorted(list(map(int, input().split())))\nif x >= 2 * sum(A):\n print((0))\nelse:\n ind = N\n for i in range(N):\n x -= A[i]\n if x < 0:\n ind = i\n break\n if ind == N and x > 0:\n A = sorted(A, reverse=True)\n for i in range(N):\n x -= A[i]\n if x < 0:\n ind -= 1\n break\n print(ind)\n","code_same":false,"relative_loc_diff_percent":42.1052631579,"diff":["-cnt = 0","-tot = A[0]","-while cnt < N and tot <= x:","- cnt += 1","- if cnt < N:","- tot += A[cnt]","-if cnt == N and tot < x:","- cnt -= 1","-print(cnt)","+if x >= 2 * sum(A):","+ print((0))","+else:","+ ind = N","+ for i in range(N):","+ x -= A[i]","+ if x < 0:","+ ind = i","+ break","+ if ind == N and x > 0:","+ A = sorted(A, reverse=True)","+ for i in range(N):","+ x -= A[i]","+ if x < 0:","+ ind -= 1","+ break","+ print(ind)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0406564639,"measured_runtime_v1":0.0376313345,"runtime_lift":1.0803885736,"key":["s663171598","s181157669"]} +{"user_id":"u909643606","problem_id":"p03566","language":"python","submission_id_v0":"s253345662","submission_id_v1":"s792918937","cpu_time_v0":28,"cpu_time_v1":25,"memory_v0":3192,"memory_v1":3188,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.71,"input":"n=int(eval(input()))\n\nt=[int(i) for i in input().split()]\n\nv=[int(i) for i in input().split()]\n\nS=[0 for i in range(n)]\n\nS1=[0 for i in range(n)]\n\nS2=[0 for i in range(n)]\n\nvel=[0 for i in range(n)]\n\n\n\ndt=[0 for i in range(n)]\n\nv0=[0 for i in range(n)]\n\nve=[0 for i in range(n)]\n\nok=0\n\n\n\n\n\n\n\nfor i in range(n):\n\n if n ==1:\n\n dt[0]=t[0]\n\n elif i==n-1:\n\n v0[i]=ve[i-1]\n\n ve[i]=0\n\n dt[i]=t[i]\n\n else:\n\n v0[i]=ve[i-1]\n\n dt[i]=t[i]\n\n ve[i]=min(v[i+1],v[i],v0[i]+dt[i])\n\n\n\n#print(dt)\n\n#print(v0)\n\n#print(ve)\n\n\n\nwhile ok==0:\n\n for i in range(n-1):\n\n# if abs((ve[i]-ve[i+1])\/dt[i+1]) >1:\n\n if abs((ve[i+1]-v0[i+1])\/dt[i+1]) >1:\n\n ve[i]=ve[i]-1\n\n v0[i+1]=v0[i+1]-1\n\n# v0[i]=v0[i]-1\n\n# print(\"dt\",dt)\n\n# print(\"v0\",v0)\n\n# print(\"ve\",ve)\n\n break\n\n else:\n\n ok=1\n\n\n\n\n\n#print(dt)\n\n#print(v0)\n\n#print(ve)\n\n\n\n\n\nfor i in range(n):\n\n\n\n ttt=0.5*(ve[i]+dt[i]-v0[i])\n\n vvv=ttt+v0[i]\n\n if vvv-v[i]>=0:\n\n S[i]=0.5*(v0[i]+vvv)*ttt + 0.5*(ve[i]+vvv)*(dt[i]-ttt) - (ttt-v[i]+v0[i])*(vvv-v[i]) \n\n S1[i]=0.5*(v0[i]+vvv)*ttt + 0.5*(ve[i]+vvv)*(dt[i]-ttt)\n\n S2[i]=(ttt-v[i]+v0[i])*(vvv-v[i]) \n\n else:\n\n S[i]=0.5*(v0[i]+vvv)*ttt + 0.5*(ve[i]+vvv)*(dt[i]-ttt)\n\n S1[i]=0.5*(v0[i]+vvv)*ttt + 0.5*(ve[i]+vvv)*(dt[i]-ttt)\n\n S2[i]=0\n\n\n\nprint((sum(S)))\n\n\n","target":"#\u6a19\u6e96\u5165\u529b\n\nn=int(eval(input()))\n\nt=[int(i) for i in input().split()]\n\nv=[int(i) for i in input().split()]\n\n\n\n#n\u500b\u306e\u533a\u9593\u306b\u3064\u3044\u3066\n\ndt=[0 for i in range(n)] #\u533a\u9593\u306e\u6642\u9593\n\nv0=[0 for i in range(n)] #\u5404\u533a\u9593\u306e\u6700\u521d\u306e\u901f\u5ea6\n\nve=[0 for i in range(n)] #\u5404\u533a\u9593\u306e\u6700\u5f8c\u306e\u901f\u5ea6\n\nS=[0 for i in range(n)] #\u5404\u533a\u9593\u306b\u8d70\u3063\u305f\u8ddd\u96e2\uff08v-t\u30b0\u30e9\u30d5\u306e\u9762\u7a4d\uff09\n\nok=0 #ok\u7267\u5834\u3000\u5f8c\u3067\u30d5\u30e9\u30b0\u306b\u4f7f\u3046\n\n\n\n#dt, v0, ve\u3092\u683c\u7d0d(v0, ve\u306f\u5f8c\u3067\u984c\u610f\u3092\u6e80\u305f\u3059\u3088\u3046\u306b\u8abf\u6574\u3059\u308b\uff09----------\n\n\n\nfor i in range(n):\n\n if n ==1:\n\n dt[0]=t[0]\n\n elif i==n-1:\n\n v0[i]=ve[i-1]\n\n ve[i]=0\n\n dt[i]=t[i]\n\n else:\n\n v0[i]=ve[i-1]\n\n dt[i]=t[i]\n\n ve[i]=min(v[i+1],v[i],v0[i]+dt[i])\n\n\n\n#\u03b1=(ve-v0)\/dt\u304c\u00b11\u4ee5\u4e0b\u306b\u306a\u308b\u3088\u3046\u306b\u8abf\u6574-----------------------------------------\n\n\n\nwhile ok==0:\n\n for i in range(n-1):\n\n if abs((ve[i+1]-v0[i+1])\/dt[i+1]) >1:\n\n ve[i]=ve[i]-1\n\n v0[i+1]=v0[i+1]-1\n\n\n\n break\n\n else:\n\n ok=1\n\n#------------------------------------------------------------------------------------------------\n\n\n\n#\u5404\u533a\u9593\u306b\u95a2\u3057\u3066\u3001\u8d70\u3063\u305f\u8ddd\u96e2\uff08v-t\u30b0\u30e9\u30d5\u306e\u9762\u7a4d\uff09\u3092\u8a08\u7b97---------------------\n\nfor i in range(n):\n\n\n\n ttt=0.5*(ve[i]+dt[i]-v0[i])\n\n vvv=ttt+v0[i]\n\n if vvv-v[i]>=0:\n\n S[i]=0.5*(v0[i]+vvv)*ttt + 0.5*(ve[i]+vvv)*(dt[i]-ttt) - (ttt-v[i]+v0[i])*(vvv-v[i]) \n\n\n\n else:\n\n S[i]=0.5*(v0[i]+vvv)*ttt + 0.5*(ve[i]+vvv)*(dt[i]-ttt)\n\n\n\n#------------------------------------------------------------------------------------------------\n\nprint((sum(S))) #\u5404\u533a\u9593\u306e\u8d70\u3063\u305f\u8ddd\u96e2\u306e\u7dcf\u548c\uff08\u7b54\u3048\uff09\u3092\u51fa\u529b","code_v0_loc":66,"code_v1_loc":52,"code_v0_num_chars":1455,"code_v1_num_chars":1402,"code_v0_no_empty_lines":"n = int(eval(input()))\nt = [int(i) for i in input().split()]\nv = [int(i) for i in input().split()]\nS = [0 for i in range(n)]\nS1 = [0 for i in range(n)]\nS2 = [0 for i in range(n)]\nvel = [0 for i in range(n)]\ndt = [0 for i in range(n)]\nv0 = [0 for i in range(n)]\nve = [0 for i in range(n)]\nok = 0\nfor i in range(n):\n if n == 1:\n dt[0] = t[0]\n elif i == n - 1:\n v0[i] = ve[i - 1]\n ve[i] = 0\n dt[i] = t[i]\n else:\n v0[i] = ve[i - 1]\n dt[i] = t[i]\n ve[i] = min(v[i + 1], v[i], v0[i] + dt[i])\n# print(dt)\n# print(v0)\n# print(ve)\nwhile ok == 0:\n for i in range(n - 1):\n # if abs((ve[i]-ve[i+1])\/dt[i+1]) >1:\n if abs((ve[i + 1] - v0[i + 1]) \/ dt[i + 1]) > 1:\n ve[i] = ve[i] - 1\n v0[i + 1] = v0[i + 1] - 1\n # v0[i]=v0[i]-1\n # print(\"dt\",dt)\n # print(\"v0\",v0)\n # print(\"ve\",ve)\n break\n else:\n ok = 1\n# print(dt)\n# print(v0)\n# print(ve)\nfor i in range(n):\n ttt = 0.5 * (ve[i] + dt[i] - v0[i])\n vvv = ttt + v0[i]\n if vvv - v[i] >= 0:\n S[i] = (\n 0.5 * (v0[i] + vvv) * ttt\n + 0.5 * (ve[i] + vvv) * (dt[i] - ttt)\n - (ttt - v[i] + v0[i]) * (vvv - v[i])\n )\n S1[i] = 0.5 * (v0[i] + vvv) * ttt + 0.5 * (ve[i] + vvv) * (dt[i] - ttt)\n S2[i] = (ttt - v[i] + v0[i]) * (vvv - v[i])\n else:\n S[i] = 0.5 * (v0[i] + vvv) * ttt + 0.5 * (ve[i] + vvv) * (dt[i] - ttt)\n S1[i] = 0.5 * (v0[i] + vvv) * ttt + 0.5 * (ve[i] + vvv) * (dt[i] - ttt)\n S2[i] = 0\nprint((sum(S)))\n","code_v1_no_empty_lines":"# \u6a19\u6e96\u5165\u529b\nn = int(eval(input()))\nt = [int(i) for i in input().split()]\nv = [int(i) for i in input().split()]\n# n\u500b\u306e\u533a\u9593\u306b\u3064\u3044\u3066\ndt = [0 for i in range(n)] # \u533a\u9593\u306e\u6642\u9593\nv0 = [0 for i in range(n)] # \u5404\u533a\u9593\u306e\u6700\u521d\u306e\u901f\u5ea6\nve = [0 for i in range(n)] # \u5404\u533a\u9593\u306e\u6700\u5f8c\u306e\u901f\u5ea6\nS = [0 for i in range(n)] # \u5404\u533a\u9593\u306b\u8d70\u3063\u305f\u8ddd\u96e2\uff08v-t\u30b0\u30e9\u30d5\u306e\u9762\u7a4d\uff09\nok = 0 # ok\u7267\u5834\u3000\u5f8c\u3067\u30d5\u30e9\u30b0\u306b\u4f7f\u3046\n# dt, v0, ve\u3092\u683c\u7d0d(v0, ve\u306f\u5f8c\u3067\u984c\u610f\u3092\u6e80\u305f\u3059\u3088\u3046\u306b\u8abf\u6574\u3059\u308b\uff09----------\nfor i in range(n):\n if n == 1:\n dt[0] = t[0]\n elif i == n - 1:\n v0[i] = ve[i - 1]\n ve[i] = 0\n dt[i] = t[i]\n else:\n v0[i] = ve[i - 1]\n dt[i] = t[i]\n ve[i] = min(v[i + 1], v[i], v0[i] + dt[i])\n# \u03b1=(ve-v0)\/dt\u304c\u00b11\u4ee5\u4e0b\u306b\u306a\u308b\u3088\u3046\u306b\u8abf\u6574-----------------------------------------\nwhile ok == 0:\n for i in range(n - 1):\n if abs((ve[i + 1] - v0[i + 1]) \/ dt[i + 1]) > 1:\n ve[i] = ve[i] - 1\n v0[i + 1] = v0[i + 1] - 1\n break\n else:\n ok = 1\n# ------------------------------------------------------------------------------------------------\n# \u5404\u533a\u9593\u306b\u95a2\u3057\u3066\u3001\u8d70\u3063\u305f\u8ddd\u96e2\uff08v-t\u30b0\u30e9\u30d5\u306e\u9762\u7a4d\uff09\u3092\u8a08\u7b97---------------------\nfor i in range(n):\n ttt = 0.5 * (ve[i] + dt[i] - v0[i])\n vvv = ttt + v0[i]\n if vvv - v[i] >= 0:\n S[i] = (\n 0.5 * (v0[i] + vvv) * ttt\n + 0.5 * (ve[i] + vvv) * (dt[i] - ttt)\n - (ttt - v[i] + v0[i]) * (vvv - v[i])\n )\n else:\n S[i] = 0.5 * (v0[i] + vvv) * ttt + 0.5 * (ve[i] + vvv) * (dt[i] - ttt)\n# ------------------------------------------------------------------------------------------------\nprint((sum(S))) # \u5404\u533a\u9593\u306e\u8d70\u3063\u305f\u8ddd\u96e2\u306e\u7dcf\u548c\uff08\u7b54\u3048\uff09\u3092\u51fa\u529b\n","code_same":false,"relative_loc_diff_percent":21.2121212121,"diff":["+# \u6a19\u6e96\u5165\u529b","-S = [0 for i in range(n)]","-S1 = [0 for i in range(n)]","-S2 = [0 for i in range(n)]","-vel = [0 for i in range(n)]","-dt = [0 for i in range(n)]","-v0 = [0 for i in range(n)]","-ve = [0 for i in range(n)]","-ok = 0","+# n\u500b\u306e\u533a\u9593\u306b\u3064\u3044\u3066","+dt = [0 for i in range(n)] # \u533a\u9593\u306e\u6642\u9593","+v0 = [0 for i in range(n)] # \u5404\u533a\u9593\u306e\u6700\u521d\u306e\u901f\u5ea6","+ve = [0 for i in range(n)] # \u5404\u533a\u9593\u306e\u6700\u5f8c\u306e\u901f\u5ea6","+S = [0 for i in range(n)] # \u5404\u533a\u9593\u306b\u8d70\u3063\u305f\u8ddd\u96e2\uff08v-t\u30b0\u30e9\u30d5\u306e\u9762\u7a4d\uff09","+ok = 0 # ok\u7267\u5834\u3000\u5f8c\u3067\u30d5\u30e9\u30b0\u306b\u4f7f\u3046","-# print(dt)","-# print(v0)","-# print(ve)","- # if abs((ve[i]-ve[i+1])\/dt[i+1]) >1:","- # v0[i]=v0[i]-1","- # print(\"dt\",dt)","- # print(\"v0\",v0)","- # print(\"ve\",ve)","-# print(dt)","-# print(v0)","-# print(ve)","- S1[i] = 0.5 * (v0[i] + vvv) * ttt + 0.5 * (ve[i] + vvv) * (dt[i] - ttt)","- S2[i] = (ttt - v[i] + v0[i]) * (vvv - v[i])","- S1[i] = 0.5 * (v0[i] + vvv) * ttt + 0.5 * (ve[i] + vvv) * (dt[i] - ttt)","- S2[i] = 0","-print((sum(S)))","+print((sum(S))) # \u5404\u533a\u9593\u306e\u8d70\u3063\u305f\u8ddd\u96e2\u306e\u7dcf\u548c\uff08\u7b54\u3048\uff09\u3092\u51fa\u529b"],"diff_only_import_comment":false,"measured_runtime_v0":0.0454903018,"measured_runtime_v1":0.0495013741,"runtime_lift":0.9189704867,"key":["s253345662","s792918937"]} +{"user_id":"u899975427","problem_id":"p02952","language":"python","submission_id_v0":"s030147436","submission_id_v1":"s420071562","cpu_time_v0":32,"cpu_time_v1":18,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.75,"input":"n = int(eval(input()))\n\nans = 0\n\nfor i in range(1,10):\n\n if i <= n:\n\n ans += 1\n\n else:\n\n break\n\nif n > 99:\n\n for i in range(100,1000):\n\n if i <= n:\n\n ans += 1\n\n else:\n\n break\n\nif n > 9999:\n\n for i in range(10000,100000):\n\n if i <= n:\n\n ans += 1\n\n else:\n\n break\n\nprint(ans)","target":"n = int(eval(input()))\n\n\n\nif n < 100:\n\n print((min(n,9)))\n\nelif n < 10000:\n\n print((min(n-90,909)))\n\nelif n <= 100000:\n\n print((min(n-9090,90909)))","code_v0_loc":20,"code_v1_loc":8,"code_v0_num_chars":308,"code_v1_num_chars":138,"code_v0_no_empty_lines":"n = int(eval(input()))\nans = 0\nfor i in range(1, 10):\n if i <= n:\n ans += 1\n else:\n break\nif n > 99:\n for i in range(100, 1000):\n if i <= n:\n ans += 1\n else:\n break\nif n > 9999:\n for i in range(10000, 100000):\n if i <= n:\n ans += 1\n else:\n break\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nif n < 100:\n print((min(n, 9)))\nelif n < 10000:\n print((min(n - 90, 909)))\nelif n <= 100000:\n print((min(n - 9090, 90909)))\n","code_same":false,"relative_loc_diff_percent":60.0,"diff":["-ans = 0","-for i in range(1, 10):","- if i <= n:","- ans += 1","- else:","- break","-if n > 99:","- for i in range(100, 1000):","- if i <= n:","- ans += 1","- else:","- break","-if n > 9999:","- for i in range(10000, 100000):","- if i <= n:","- ans += 1","- else:","- break","-print(ans)","+if n < 100:","+ print((min(n, 9)))","+elif n < 10000:","+ print((min(n - 90, 909)))","+elif n <= 100000:","+ print((min(n - 9090, 90909)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0396809113,"measured_runtime_v1":0.0456832972,"runtime_lift":0.8686087424,"key":["s030147436","s420071562"]} +{"user_id":"u806779442","problem_id":"p02720","language":"python","submission_id_v0":"s689126585","submission_id_v1":"s440387590","cpu_time_v0":1054,"cpu_time_v1":95,"memory_v0":12480,"memory_v1":8040,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.99,"input":"import queue\n\n\n\nk = int(eval(input()))\n\nq = queue.Queue()\n\n\n\nfor i in range(1,10):\n\n q.put(i)\n\n\n\nfor i in range(1,k):\n\n l = q.get()\n\n m = l % 10\n\n if (m != 0):\n\n q.put(l * 10 + m - 1)\n\n q.put(l * 10 + m)\n\n if (m != 9):\n\n q.put(l * 10 + m + 1)\n\n\n\nprint((q.get())) ","target":"from collections import deque\n\n\n\nk = int(eval(input()))\n\nq = deque([1,2,3,4,5,6,7,8,9])\n\n\n\nfor i in range(1,k):\n\n l = q.popleft()\n\n if (len(q) < k):\n\n m = l % 10\n\n if (m != 0):\n\n q.append(l * 10 + m - 1)\n\n q.append(l * 10 + m)\n\n if (m != 9):\n\n q.append(l * 10 + m + 1)\n\n\n\nprint((q.popleft()))","code_v0_loc":18,"code_v1_loc":16,"code_v0_num_chars":287,"code_v1_num_chars":340,"code_v0_no_empty_lines":"import queue\n\nk = int(eval(input()))\nq = queue.Queue()\nfor i in range(1, 10):\n q.put(i)\nfor i in range(1, k):\n l = q.get()\n m = l % 10\n if m != 0:\n q.put(l * 10 + m - 1)\n q.put(l * 10 + m)\n if m != 9:\n q.put(l * 10 + m + 1)\nprint((q.get()))\n","code_v1_no_empty_lines":"from collections import deque\n\nk = int(eval(input()))\nq = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])\nfor i in range(1, k):\n l = q.popleft()\n if len(q) < k:\n m = l % 10\n if m != 0:\n q.append(l * 10 + m - 1)\n q.append(l * 10 + m)\n if m != 9:\n q.append(l * 10 + m + 1)\nprint((q.popleft()))\n","code_same":false,"relative_loc_diff_percent":11.1111111111,"diff":["-import queue","+from collections import deque","-q = queue.Queue()","-for i in range(1, 10):","- q.put(i)","+q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])","- l = q.get()","- m = l % 10","- if m != 0:","- q.put(l * 10 + m - 1)","- q.put(l * 10 + m)","- if m != 9:","- q.put(l * 10 + m + 1)","-print((q.get()))","+ l = q.popleft()","+ if len(q) < k:","+ m = l % 10","+ if m != 0:","+ q.append(l * 10 + m - 1)","+ q.append(l * 10 + m)","+ if m != 9:","+ q.append(l * 10 + m + 1)","+print((q.popleft()))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3782454615,"measured_runtime_v1":0.0586601467,"runtime_lift":6.4480824306,"key":["s689126585","s440387590"]} +{"user_id":"u075012704","problem_id":"p03776","language":"python","submission_id_v0":"s000732776","submission_id_v1":"s205944720","cpu_time_v0":173,"cpu_time_v1":22,"memory_v0":13412,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":87.28,"input":"from scipy.misc import comb\n\nN, A, B = list(map(int, input().split()))\n\nV = list(map(int, input().split()))\n\n\n\n\n\nV.sort(reverse=True)\n\nprint((sum(V[:A]) \/ A))\n\n\n\n\n\nAth_CNT = V.count(V[A - 1])\n\nV_than_Ath_CNT = len([v for v in V if v > V[A - 1]])\n\nif max(V) == V[A - 1]:\n\n ans = 0\n\n for k in range(A, B + 1):\n\n ans += comb(Ath_CNT, k, 1)\n\nelse:\n\n ans = comb(Ath_CNT, A - V_than_Ath_CNT, 1)\n\nprint(ans)\n","target":"from collections import Counter\n\nfrom math import factorial\n\nN, A, B = list(map(int, input().split()))\n\nV = sorted(list(map(int, input().split())), reverse=True)\n\n\n\nMAX_AVE = sum(V[:A]) \/ A\n\nC = Counter(V)\n\n\n\n\n\ndef nCr(n, r):\n\n return int(factorial(n) \/ (factorial(r) * factorial(n - r)))\n\n\n\n\n\nAth_V = V[A - 1]\n\nif Ath_V == max(V):\n\n ans = 0\n\n for r in range(A, min(B + 1, C[Ath_V] + 1)):\n\n ans += nCr(C[Ath_V], r)\n\n print(MAX_AVE)\n\n print(ans)\n\n\n\nelse:\n\n print(MAX_AVE)\n\n for i, v in enumerate(V):\n\n if v == Ath_V:\n\n used = i\n\n break\n\n print((nCr(C[Ath_V], A - used)))\n","code_v0_loc":18,"code_v1_loc":28,"code_v0_num_chars":409,"code_v1_num_chars":622,"code_v0_no_empty_lines":"from scipy.misc import comb\n\nN, A, B = list(map(int, input().split()))\nV = list(map(int, input().split()))\nV.sort(reverse=True)\nprint((sum(V[:A]) \/ A))\nAth_CNT = V.count(V[A - 1])\nV_than_Ath_CNT = len([v for v in V if v > V[A - 1]])\nif max(V) == V[A - 1]:\n ans = 0\n for k in range(A, B + 1):\n ans += comb(Ath_CNT, k, 1)\nelse:\n ans = comb(Ath_CNT, A - V_than_Ath_CNT, 1)\nprint(ans)\n","code_v1_no_empty_lines":"from collections import Counter\nfrom math import factorial\n\nN, A, B = list(map(int, input().split()))\nV = sorted(list(map(int, input().split())), reverse=True)\nMAX_AVE = sum(V[:A]) \/ A\nC = Counter(V)\n\n\ndef nCr(n, r):\n return int(factorial(n) \/ (factorial(r) * factorial(n - r)))\n\n\nAth_V = V[A - 1]\nif Ath_V == max(V):\n ans = 0\n for r in range(A, min(B + 1, C[Ath_V] + 1)):\n ans += nCr(C[Ath_V], r)\n print(MAX_AVE)\n print(ans)\nelse:\n print(MAX_AVE)\n for i, v in enumerate(V):\n if v == Ath_V:\n used = i\n break\n print((nCr(C[Ath_V], A - used)))\n","code_same":false,"relative_loc_diff_percent":35.7142857143,"diff":["-from scipy.misc import comb","+from collections import Counter","+from math import factorial","-V = list(map(int, input().split()))","-V.sort(reverse=True)","-print((sum(V[:A]) \/ A))","-Ath_CNT = V.count(V[A - 1])","-V_than_Ath_CNT = len([v for v in V if v > V[A - 1]])","-if max(V) == V[A - 1]:","+V = sorted(list(map(int, input().split())), reverse=True)","+MAX_AVE = sum(V[:A]) \/ A","+C = Counter(V)","+","+","+def nCr(n, r):","+ return int(factorial(n) \/ (factorial(r) * factorial(n - r)))","+","+","+Ath_V = V[A - 1]","+if Ath_V == max(V):","- for k in range(A, B + 1):","- ans += comb(Ath_CNT, k, 1)","+ for r in range(A, min(B + 1, C[Ath_V] + 1)):","+ ans += nCr(C[Ath_V], r)","+ print(MAX_AVE)","+ print(ans)","- ans = comb(Ath_CNT, A - V_than_Ath_CNT, 1)","-print(ans)","+ print(MAX_AVE)","+ for i, v in enumerate(V):","+ if v == Ath_V:","+ used = i","+ break","+ print((nCr(C[Ath_V], A - used)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.7035176678,"measured_runtime_v1":0.0355647488,"runtime_lift":19.7813197624,"key":["s000732776","s205944720"]} +{"user_id":"u923279197","problem_id":"p03126","language":"python","submission_id_v0":"s604923200","submission_id_v1":"s051290915","cpu_time_v0":166,"cpu_time_v1":17,"memory_v0":38512,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.76,"input":"from collections import Counter\n\nn,m = list(map(int,input().split()))\n\nmany =[]\n\nfor i in range(n):\n\n a = list(map(int,input().split()))\n\n for j in range(1,a[0]+1):\n\n many.append(a[j])\n\n\n\nans = Counter(many).most_common()\n\ncount = 0\n\nfor i in range(len(ans)):\n\n if ans[i][1] == n:\n\n count += 1\n\n\n\nprint(count)","target":"n,m = list(map(int,input().split()))\n\ndata = [0 for i in range(m)]\n\nfor i in range(n):\n\n k,*a = list(map(int,input().split()))\n\n for x in a:\n\n data[x-1] += 1\n\nans = 0\n\nfor i in range(m):\n\n if data[i] == n:\n\n ans += 1\n\n\n\nprint(ans)","code_v0_loc":15,"code_v1_loc":12,"code_v0_num_chars":327,"code_v1_num_chars":241,"code_v0_no_empty_lines":"from collections import Counter\n\nn, m = list(map(int, input().split()))\nmany = []\nfor i in range(n):\n a = list(map(int, input().split()))\n for j in range(1, a[0] + 1):\n many.append(a[j])\nans = Counter(many).most_common()\ncount = 0\nfor i in range(len(ans)):\n if ans[i][1] == n:\n count += 1\nprint(count)\n","code_v1_no_empty_lines":"n, m = list(map(int, input().split()))\ndata = [0 for i in range(m)]\nfor i in range(n):\n k, *a = list(map(int, input().split()))\n for x in a:\n data[x - 1] += 1\nans = 0\nfor i in range(m):\n if data[i] == n:\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":20.0,"diff":["-from collections import Counter","-","-many = []","+data = [0 for i in range(m)]","- a = list(map(int, input().split()))","- for j in range(1, a[0] + 1):","- many.append(a[j])","-ans = Counter(many).most_common()","-count = 0","-for i in range(len(ans)):","- if ans[i][1] == n:","- count += 1","-print(count)","+ k, *a = list(map(int, input().split()))","+ for x in a:","+ data[x - 1] += 1","+ans = 0","+for i in range(m):","+ if data[i] == n:","+ ans += 1","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0409803154,"measured_runtime_v1":0.035564899,"runtime_lift":1.1522685745,"key":["s604923200","s051290915"]} +{"user_id":"u078181689","problem_id":"p02720","language":"python","submission_id_v0":"s371912706","submission_id_v1":"s133350923","cpu_time_v0":289,"cpu_time_v1":115,"memory_v0":20364,"memory_v1":11956,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":60.21,"input":"k = int(eval(input()))\n\n\n\nnumset = {i for i in range(1,10)}\n\nflag = False\n\ncount = len(numset)\n\nif count >= k:\n\n flag = True\n\narr = [numset]\n\nindex = 0\n\n\n\nwhile not flag:\n\n beforeset = arr[index]\n\n tmpset = set()\n\n for i in beforeset:\n\n tail = str(i)[-1]\n\n if tail == \"0\":\n\n tmpset.add(int(str(i)+str(0)))\n\n tmpset.add(int(str(i)+str(1)))\n\n elif tail == \"9\":\n\n tmpset.add(int(str(i)+str(8)))\n\n tmpset.add(int(str(i)+str(9)))\n\n else:\n\n tmpset.add(int(str(i)+str(int(tail))))\n\n tmpset.add(int(str(i)+str(int(tail)+1)))\n\n tmpset.add(int(str(i)+str(int(tail)-1)))\n\n count += len(tmpset)\n\n if count >= k:\n\n flag = True\n\n arr.append(tmpset)\n\n index += 1\n\n \n\ntotalarr = []\n\nfor tmpset in arr:\n\n totalarr += list(tmpset)\n\n \n\ntotalarr.sort()\n\nprint((totalarr[k-1]))","target":"k = int(eval(input()))\n\n\n\nfrom collections import deque\n\nqueue = deque(list(range(1,10)))\n\ncount = 0\n\n\n\nwhile count < k:\n\n tmp = queue.popleft()\n\n tail = tmp%10\n\n if tail != 0:\n\n queue.append(tmp*10+tail-1)\n\n queue.append(tmp*10+tail)\n\n if tail != 9:\n\n queue.append(tmp*10+tail+1)\n\n count += 1\n\n \n\nprint(tmp)\n","code_v0_loc":37,"code_v1_loc":17,"code_v0_num_chars":893,"code_v1_num_chars":332,"code_v0_no_empty_lines":"k = int(eval(input()))\nnumset = {i for i in range(1, 10)}\nflag = False\ncount = len(numset)\nif count >= k:\n flag = True\narr = [numset]\nindex = 0\nwhile not flag:\n beforeset = arr[index]\n tmpset = set()\n for i in beforeset:\n tail = str(i)[-1]\n if tail == \"0\":\n tmpset.add(int(str(i) + str(0)))\n tmpset.add(int(str(i) + str(1)))\n elif tail == \"9\":\n tmpset.add(int(str(i) + str(8)))\n tmpset.add(int(str(i) + str(9)))\n else:\n tmpset.add(int(str(i) + str(int(tail))))\n tmpset.add(int(str(i) + str(int(tail) + 1)))\n tmpset.add(int(str(i) + str(int(tail) - 1)))\n count += len(tmpset)\n if count >= k:\n flag = True\n arr.append(tmpset)\n index += 1\ntotalarr = []\nfor tmpset in arr:\n totalarr += list(tmpset)\ntotalarr.sort()\nprint((totalarr[k - 1]))\n","code_v1_no_empty_lines":"k = int(eval(input()))\nfrom collections import deque\n\nqueue = deque(list(range(1, 10)))\ncount = 0\nwhile count < k:\n tmp = queue.popleft()\n tail = tmp % 10\n if tail != 0:\n queue.append(tmp * 10 + tail - 1)\n queue.append(tmp * 10 + tail)\n if tail != 9:\n queue.append(tmp * 10 + tail + 1)\n count += 1\nprint(tmp)\n","code_same":false,"relative_loc_diff_percent":54.0540540541,"diff":["-numset = {i for i in range(1, 10)}","-flag = False","-count = len(numset)","-if count >= k:","- flag = True","-arr = [numset]","-index = 0","-while not flag:","- beforeset = arr[index]","- tmpset = set()","- for i in beforeset:","- tail = str(i)[-1]","- if tail == \"0\":","- tmpset.add(int(str(i) + str(0)))","- tmpset.add(int(str(i) + str(1)))","- elif tail == \"9\":","- tmpset.add(int(str(i) + str(8)))","- tmpset.add(int(str(i) + str(9)))","- else:","- tmpset.add(int(str(i) + str(int(tail))))","- tmpset.add(int(str(i) + str(int(tail) + 1)))","- tmpset.add(int(str(i) + str(int(tail) - 1)))","- count += len(tmpset)","- if count >= k:","- flag = True","- arr.append(tmpset)","- index += 1","-totalarr = []","-for tmpset in arr:","- totalarr += list(tmpset)","-totalarr.sort()","-print((totalarr[k - 1]))","+from collections import deque","+","+queue = deque(list(range(1, 10)))","+count = 0","+while count < k:","+ tmp = queue.popleft()","+ tail = tmp % 10","+ if tail != 0:","+ queue.append(tmp * 10 + tail - 1)","+ queue.append(tmp * 10 + tail)","+ if tail != 9:","+ queue.append(tmp * 10 + tail + 1)","+ count += 1","+print(tmp)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0902766671,"measured_runtime_v1":0.0464899955,"runtime_lift":1.9418514923,"key":["s371912706","s133350923"]} +{"user_id":"u492910842","problem_id":"p03698","language":"python","submission_id_v0":"s526961287","submission_id_v1":"s558431540","cpu_time_v0":78,"cpu_time_v1":66,"memory_v0":67856,"memory_v1":61780,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.38,"input":"import copy\n\ns = eval(input())\n\nss = list(s)\n\nsss = copy.copy(ss)\n\nn = len(ss)\n\nans = \"yes\"\n\n\n\nfor i in range(n):\n\n sss = copy.copy(ss)\n\n sss.remove(sss[i])\n\n if ss[i] in sss:\n\n ans = \"no\"\n\nprint(ans)\n\n ","target":"s = list(eval(input()))\n\nn = len(s)\n\nans = \"yes\"\n\nfor i in range(n):\n\n if s.count(s[i]) != 1:\n\n ans = \"no\"\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":7,"code_v0_num_chars":206,"code_v1_num_chars":116,"code_v0_no_empty_lines":"import copy\n\ns = eval(input())\nss = list(s)\nsss = copy.copy(ss)\nn = len(ss)\nans = \"yes\"\nfor i in range(n):\n sss = copy.copy(ss)\n sss.remove(sss[i])\n if ss[i] in sss:\n ans = \"no\"\nprint(ans)\n","code_v1_no_empty_lines":"s = list(eval(input()))\nn = len(s)\nans = \"yes\"\nfor i in range(n):\n if s.count(s[i]) != 1:\n ans = \"no\"\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":50.0,"diff":["-import copy","-","-s = eval(input())","-ss = list(s)","-sss = copy.copy(ss)","-n = len(ss)","+s = list(eval(input()))","+n = len(s)","- sss = copy.copy(ss)","- sss.remove(sss[i])","- if ss[i] in sss:","+ if s.count(s[i]) != 1:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0574551671,"measured_runtime_v1":0.0360130117,"runtime_lift":1.5954002272,"key":["s526961287","s558431540"]} +{"user_id":"u780962115","problem_id":"p02727","language":"python","submission_id_v0":"s420923294","submission_id_v1":"s190336573","cpu_time_v0":904,"cpu_time_v1":492,"memory_v0":125736,"memory_v1":22504,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.58,"input":"\n\nx,y,a,b,c=list(map(int,input().split()))\n\n\n\na_list=list(map(int,input().split()))\n\na_list=sorted(a_list)\n\nb_list=list(map(int,input().split()))\n\nb_list=sorted(b_list)\n\na_list=a_list[-x:]\n\nb_list=b_list[-y:]\n\nc_list=list(map(int,input().split()))\n\nfor i in range(c):\n\n c_list[i]=-c_list[i]\n\nimport heapq\n\nheapq.heapify(a_list)\n\nheapq.heapify(b_list)\n\nheapq.heapify(c_list)\n\n\n\nflag=True\n\nwhile flag and c_list:\n\n x=heapq.heappop(c_list)\n\n x=x*(-1)\n\n #\uff43_list\u306e\u4e2d\u3067\u306e\u3082\u3063\u3068\u3082\u5927\u304d\u3044\u5024\n\n min_a=heapq.heappop(a_list)\n\n min_b=heapq.heappop(b_list)\n\n if min(min_a,min_b)>=x:\n\n flag=False\n\n heapq.heappush(a_list,min_a)\n\n heapq.heappush(b_list,min_b)\n\n else:\n\n if min_a>=min_b:\n\n heapq.heappush(a_list,min_a)\n\n heapq.heappush(b_list,x)\n\n \n\n elif min_a=x:\n\n flag=False\n\n heapq.heappush(a_list,min_a)\n\n heapq.heappush(b_list,min_b)\n\n else:\n\n if min_a>=min_b:\n\n heapq.heappush(a_list,min_a)\n\n heapq.heappush(b_list,x)\n\n \n\n elif min_a= x:\n flag = False\n heapq.heappush(a_list, min_a)\n heapq.heappush(b_list, min_b)\n else:\n if min_a >= min_b:\n heapq.heappush(a_list, min_a)\n heapq.heappush(b_list, x)\n elif min_a < min_b:\n heapq.heappush(b_list, min_b)\n heapq.heappush(a_list, x)\nsum_a = sum(list(a_list))\nsum_b = sum(list(b_list))\nprint((sum_a + sum_b))\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nx, y, a, b, c = list(map(int, input().split()))\na_list = list(map(int, input().split()))\na_list = sorted(a_list)\nb_list = list(map(int, input().split()))\nb_list = sorted(b_list)\na_list = a_list[-x:]\nb_list = b_list[-y:]\nc_list = list(map(int, input().split()))\nfor i in range(c):\n c_list[i] = -c_list[i]\nimport heapq\n\nheapq.heapify(a_list)\nheapq.heapify(b_list)\nheapq.heapify(c_list)\nflag = True\nwhile flag and c_list:\n x = heapq.heappop(c_list)\n x = x * (-1)\n # \uff43_list\u306e\u4e2d\u3067\u306e\u3082\u3063\u3068\u3082\u5927\u304d\u3044\u5024\n min_a = heapq.heappop(a_list)\n min_b = heapq.heappop(b_list)\n if min(min_a, min_b) >= x:\n flag = False\n heapq.heappush(a_list, min_a)\n heapq.heappush(b_list, min_b)\n else:\n if min_a >= min_b:\n heapq.heappush(a_list, min_a)\n heapq.heappush(b_list, x)\n elif min_a < min_b:\n heapq.heappush(b_list, min_b)\n heapq.heappush(a_list, x)\nsum_a = sum(list(a_list))\nsum_b = sum(list(b_list))\nprint((sum_a + sum_b))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["+import sys","+","+input = sys.stdin.readline"],"diff_only_import_comment":false,"measured_runtime_v0":0.0423262775,"measured_runtime_v1":0.0369119864,"runtime_lift":1.14668111,"key":["s420923294","s190336573"]} +{"user_id":"u506910932","problem_id":"p03160","language":"python","submission_id_v0":"s325635659","submission_id_v1":"s771245885","cpu_time_v0":227,"cpu_time_v1":126,"memory_v0":52720,"memory_v1":20520,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.49,"input":"n = int(eval(input()))\n\nh = list(map(int, input().split()))\n\ninf = 1001001001\n\ndp = [inf for _ in range(n + 1)]\n\n\n\ndp[0] = 0\n\ndp[1] = abs(h[0]-h[1])\n\nfor i in range(2, n):\n\n dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),\n\n dp[i - 1] + abs(h[i] - h[i - 1]))\n\nprint((dp[n-1]))\n","target":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\n\n\n\nn = int(eval(input()))\n\nh = list(map(int, input().split()))\n\ninf = 1001001001\n\ndp = [inf for _ in range(n + 5)]\n\ndp[0] = 0\n\ndp[1] = abs(h[0] - h[1])\n\nfor i in range(2, n):\n\n dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),\n\n dp[i - 1] + abs(h[i] - h[i - 1]))\n\nprint((dp[n-1]))\n","code_v0_loc":11,"code_v1_loc":13,"code_v0_num_chars":284,"code_v1_num_chars":345,"code_v0_no_empty_lines":"n = int(eval(input()))\nh = list(map(int, input().split()))\ninf = 1001001001\ndp = [inf for _ in range(n + 1)]\ndp[0] = 0\ndp[1] = abs(h[0] - h[1])\nfor i in range(2, n):\n dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]))\nprint((dp[n - 1]))\n","code_v1_no_empty_lines":"import sys\n\ninput = lambda: sys.stdin.readline().rstrip()\nn = int(eval(input()))\nh = list(map(int, input().split()))\ninf = 1001001001\ndp = [inf for _ in range(n + 5)]\ndp[0] = 0\ndp[1] = abs(h[0] - h[1])\nfor i in range(2, n):\n dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]))\nprint((dp[n - 1]))\n","code_same":false,"relative_loc_diff_percent":15.3846153846,"diff":["+import sys","+","+input = lambda: sys.stdin.readline().rstrip()","-dp = [inf for _ in range(n + 1)]","+dp = [inf for _ in range(n + 5)]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376876149,"measured_runtime_v1":0.1486264448,"runtime_lift":0.2535727404,"key":["s325635659","s771245885"]} +{"user_id":"u768896740","problem_id":"p02720","language":"python","submission_id_v0":"s134479891","submission_id_v1":"s903598898","cpu_time_v0":152,"cpu_time_v1":139,"memory_v0":7052,"memory_v1":7100,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.55,"input":"k = int(eval(input()))\n\n\n\nlun_list = [1,2,3,4,5,6,7,8,9]\n\n\n\nfor i in lun_list:\n\n if str(i)[-1] == '0':\n\n for j in range(2):\n\n lun_list.append(int(str(i)+str(j)))\n\n elif str(i)[-1] == '9':\n\n for j in range(8,10):\n\n lun_list.append(int(str(i)+str(j)))\n\n else:\n\n for j in range(int(str(i)[-1])-1,int(str(i)[-1])+2):\n\n lun_list.append(int(str(i)+str(j)))\n\n if len(lun_list) > k:\n\n break\n\n\n\nprint((lun_list[k-1]))","target":"k = int(eval(input()))\n\n\n\nnum_list = [1,2,3,4,5,6,7,8,9]\n\nnum_a = ['0', '1']\n\nnum_b = ['8', '9']\n\n\n\nfor i in num_list:\n\n if str(i)[-1] == '0':\n\n for j in num_a:\n\n num_list.append(int(str(i)+j))\n\n elif str(i)[-1] == '9':\n\n for j in num_b:\n\n num_list.append(int(str(i)+j))\n\n else:\n\n num = int(str(i)[-1])\n\n for j in range(num-1, num+2):\n\n num_list.append(int(str(i)+str(j)))\n\n if len(num_list) > k:\n\n break\n\n\n\nprint((num_list[k-1]))","code_v0_loc":18,"code_v1_loc":21,"code_v0_num_chars":473,"code_v1_num_chars":502,"code_v0_no_empty_lines":"k = int(eval(input()))\nlun_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]\nfor i in lun_list:\n if str(i)[-1] == \"0\":\n for j in range(2):\n lun_list.append(int(str(i) + str(j)))\n elif str(i)[-1] == \"9\":\n for j in range(8, 10):\n lun_list.append(int(str(i) + str(j)))\n else:\n for j in range(int(str(i)[-1]) - 1, int(str(i)[-1]) + 2):\n lun_list.append(int(str(i) + str(j)))\n if len(lun_list) > k:\n break\nprint((lun_list[k - 1]))\n","code_v1_no_empty_lines":"k = int(eval(input()))\nnum_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]\nnum_a = [\"0\", \"1\"]\nnum_b = [\"8\", \"9\"]\nfor i in num_list:\n if str(i)[-1] == \"0\":\n for j in num_a:\n num_list.append(int(str(i) + j))\n elif str(i)[-1] == \"9\":\n for j in num_b:\n num_list.append(int(str(i) + j))\n else:\n num = int(str(i)[-1])\n for j in range(num - 1, num + 2):\n num_list.append(int(str(i) + str(j)))\n if len(num_list) > k:\n break\nprint((num_list[k - 1]))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-lun_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]","-for i in lun_list:","+num_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]","+num_a = [\"0\", \"1\"]","+num_b = [\"8\", \"9\"]","+for i in num_list:","- for j in range(2):","- lun_list.append(int(str(i) + str(j)))","+ for j in num_a:","+ num_list.append(int(str(i) + j))","- for j in range(8, 10):","- lun_list.append(int(str(i) + str(j)))","+ for j in num_b:","+ num_list.append(int(str(i) + j))","- for j in range(int(str(i)[-1]) - 1, int(str(i)[-1]) + 2):","- lun_list.append(int(str(i) + str(j)))","- if len(lun_list) > k:","+ num = int(str(i)[-1])","+ for j in range(num - 1, num + 2):","+ num_list.append(int(str(i) + str(j)))","+ if len(num_list) > k:","-print((lun_list[k - 1]))","+print((num_list[k - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0531051407,"measured_runtime_v1":0.0725588675,"runtime_lift":0.7318904297,"key":["s134479891","s903598898"]} +{"user_id":"u690873774","problem_id":"p02773","language":"python","submission_id_v0":"s500584947","submission_id_v1":"s017430460","cpu_time_v0":443,"cpu_time_v1":361,"memory_v0":35568,"memory_v1":38384,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.51,"input":"import sys\n\nimport collections\n\nn = int(sys.stdin.readline())\n\na = []\n\nfor _ in range(n):\n\n a.append(sys.stdin.readline().strip())\n\nc = collections.Counter(a)\n\nmaxc = max(c.values())\n\nprint((*sorted([i[0] for i in list(c.items()) if i[1] == maxc])))","target":"from collections import Counter\n\ndef main():\n\n _, *A = open(0).read().split()\n\n c = Counter(A)\n\n maxc = max(c.values())\n\n print((*sorted([i[0] for i in list(c.items()) if i[1] == maxc])))\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":242,"code_v1_num_chars":224,"code_v0_no_empty_lines":"import sys\nimport collections\n\nn = int(sys.stdin.readline())\na = []\nfor _ in range(n):\n a.append(sys.stdin.readline().strip())\nc = collections.Counter(a)\nmaxc = max(c.values())\nprint((*sorted([i[0] for i in list(c.items()) if i[1] == maxc])))\n","code_v1_no_empty_lines":"from collections import Counter\n\n\ndef main():\n _, *A = open(0).read().split()\n c = Counter(A)\n maxc = max(c.values())\n print((*sorted([i[0] for i in list(c.items()) if i[1] == maxc])))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-import sys","-import collections","+from collections import Counter","-n = int(sys.stdin.readline())","-a = []","-for _ in range(n):","- a.append(sys.stdin.readline().strip())","-c = collections.Counter(a)","-maxc = max(c.values())","-print((*sorted([i[0] for i in list(c.items()) if i[1] == maxc])))","+","+def main():","+ _, *A = open(0).read().split()","+ c = Counter(A)","+ maxc = max(c.values())","+ print((*sorted([i[0] for i in list(c.items()) if i[1] == maxc])))","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0586629572,"measured_runtime_v1":0.0691116314,"runtime_lift":0.8488145338,"key":["s500584947","s017430460"]} +{"user_id":"u124498235","problem_id":"p03487","language":"python","submission_id_v0":"s506414155","submission_id_v1":"s896918707","cpu_time_v0":216,"cpu_time_v1":123,"memory_v0":21232,"memory_v1":18672,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.06,"input":"import collections\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\naa = collections.Counter(a)\n\nans = 0\n\nfor i,j in sorted(aa.items()):\n\n\tif j > i:\n\n\t\tans += j-i\n\n\telif j < i:\n\n\t\tans += j\n\nprint (ans)\n","target":"from collections import Counter\n\nn = int(eval(input()))\n\na = list(map(int, input().split()))\n\n\n\nc = Counter(a)\n\nans = 0\n\nfor i in c:\n\n\tif c[i] > i:\n\n\t\tans += c[i] - i\n\n\telif c[i] < i:\n\n\t\tans += c[i]\n\nprint (ans)","code_v0_loc":11,"code_v1_loc":12,"code_v0_num_chars":209,"code_v1_num_chars":205,"code_v0_no_empty_lines":"import collections\n\nn = int(eval(input()))\na = list(map(int, input().split()))\naa = collections.Counter(a)\nans = 0\nfor i, j in sorted(aa.items()):\n if j > i:\n ans += j - i\n elif j < i:\n ans += j\nprint(ans)\n","code_v1_no_empty_lines":"from collections import Counter\n\nn = int(eval(input()))\na = list(map(int, input().split()))\nc = Counter(a)\nans = 0\nfor i in c:\n if c[i] > i:\n ans += c[i] - i\n elif c[i] < i:\n ans += c[i]\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import collections","+from collections import Counter","-aa = collections.Counter(a)","+c = Counter(a)","-for i, j in sorted(aa.items()):","- if j > i:","- ans += j - i","- elif j < i:","- ans += j","+for i in c:","+ if c[i] > i:","+ ans += c[i] - i","+ elif c[i] < i:","+ ans += c[i]"],"diff_only_import_comment":false,"measured_runtime_v0":0.0444087505,"measured_runtime_v1":0.0395608425,"runtime_lift":1.1225430931,"key":["s506414155","s896918707"]} +{"user_id":"u832039789","problem_id":"p03212","language":"python","submission_id_v0":"s002009341","submission_id_v1":"s655025581","cpu_time_v0":1221,"cpu_time_v1":53,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":95.66,"input":"n = int(eval(input()))\n\n\n\ndef tobase4(num):\n\n ans = ''\n\n while num>0:\n\n ans += str(num%4)\n\n num \/\/= 4\n\n return ans[::-1]\n\n\n\ndef check(s):\n\n if '1' in s and '2' in s and '3' in s and '0' not in s:\n\n return True\n\n return False\n\n\n\ndef conv(s):\n\n s = s.replace('2','5')\n\n s = s.replace('3','7')\n\n s = s.replace('1','3')\n\n return s\n\n\n\nres = 0\n\nfor i in range(10**9):\n\n s = tobase4(i)\n\n if not check(s):\n\n continue\n\n s = conv(s)\n\n s = int(s)\n\n #print(s)\n\n if n < s:\n\n break\n\n #print(s)\n\n res += 1\n\nprint(res)\n","target":"def dfs(N,s,a,b,c):\n\n if int(s)>N:\n\n return 0\n\n ret = dfs(N,s+'3',True,b,c)\n\n ret += dfs(N,s+'5',a,True,c)\n\n ret += dfs(N,s+'7',a,b,True)\n\n return ret + (a and b and c)\n\n\n\nprint((dfs(int(eval(input())),'0',False,False,False)))\n","code_v0_loc":33,"code_v1_loc":9,"code_v0_num_chars":583,"code_v1_num_chars":242,"code_v0_no_empty_lines":"n = int(eval(input()))\n\n\ndef tobase4(num):\n ans = \"\"\n while num > 0:\n ans += str(num % 4)\n num \/\/= 4\n return ans[::-1]\n\n\ndef check(s):\n if \"1\" in s and \"2\" in s and \"3\" in s and \"0\" not in s:\n return True\n return False\n\n\ndef conv(s):\n s = s.replace(\"2\", \"5\")\n s = s.replace(\"3\", \"7\")\n s = s.replace(\"1\", \"3\")\n return s\n\n\nres = 0\nfor i in range(10**9):\n s = tobase4(i)\n if not check(s):\n continue\n s = conv(s)\n s = int(s)\n # print(s)\n if n < s:\n break\n # print(s)\n res += 1\nprint(res)\n","code_v1_no_empty_lines":"def dfs(N, s, a, b, c):\n if int(s) > N:\n return 0\n ret = dfs(N, s + \"3\", True, b, c)\n ret += dfs(N, s + \"5\", a, True, c)\n ret += dfs(N, s + \"7\", a, b, True)\n return ret + (a and b and c)\n\n\nprint((dfs(int(eval(input())), \"0\", False, False, False)))\n","code_same":false,"relative_loc_diff_percent":72.7272727273,"diff":["-n = int(eval(input()))","+def dfs(N, s, a, b, c):","+ if int(s) > N:","+ return 0","+ ret = dfs(N, s + \"3\", True, b, c)","+ ret += dfs(N, s + \"5\", a, True, c)","+ ret += dfs(N, s + \"7\", a, b, True)","+ return ret + (a and b and c)","-def tobase4(num):","- ans = \"\"","- while num > 0:","- ans += str(num % 4)","- num \/\/= 4","- return ans[::-1]","-","-","-def check(s):","- if \"1\" in s and \"2\" in s and \"3\" in s and \"0\" not in s:","- return True","- return False","-","-","-def conv(s):","- s = s.replace(\"2\", \"5\")","- s = s.replace(\"3\", \"7\")","- s = s.replace(\"1\", \"3\")","- return s","-","-","-res = 0","-for i in range(10**9):","- s = tobase4(i)","- if not check(s):","- continue","- s = conv(s)","- s = int(s)","- # print(s)","- if n < s:","- break","- # print(s)","- res += 1","-print(res)","+print((dfs(int(eval(input())), \"0\", False, False, False)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.3627170079,"measured_runtime_v1":0.0415293553,"runtime_lift":8.7339908187,"key":["s002009341","s655025581"]} +{"user_id":"u073852194","problem_id":"p03332","language":"python","submission_id_v0":"s019254346","submission_id_v1":"s796654105","cpu_time_v0":682,"cpu_time_v1":490,"memory_v0":32780,"memory_v1":32576,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":28.15,"input":"class Factorial():\n\n def __init__(self, n, mod):\n\n self.mod = mod\n\n self.fct = [0 for _ in range(n + 1)]\n\n self.inv = [0 for _ in range(n + 1)]\n\n self.fct[0] = 1\n\n self.inv[0] = 1\n\n for i in range(n):\n\n self.fct[i + 1] = self.fct[i] * (i + 1) % mod\n\n self.inv[n] = pow(self.fct[n], mod - 2, mod)\n\n for i in range(n)[::-1]:\n\n self.inv[i] = self.inv[i + 1] * (i + 1) % mod\n\n\n\n def comb(self, m, k):\n\n if m < k: return 0\n\n return self.fct[m] * self.inv[k] * self.inv[m - k] % self.mod\n\n\n\ndef ex_euclid(x, y):\n\n c0, c1 = x, y\n\n a0, a1 = 1, 0\n\n b0, b1 = 0, 1\n\n while c1:\n\n a0, a1 = a1, a0 - c0 \/\/ c1 * a1\n\n b0, b1 = b1, b0 - c0 \/\/ c1 * b1\n\n c0, c1 = c1, c0 % c1\n\n return c0, a0, b0\n\n\n\nMOD = 998244353\n\nN, A, B, K =list(map(int,input().split()))\n\n\n\nf = Factorial(N, MOD)\n\nc, a, b = ex_euclid(A, B)\n\n\n\nif K == 0:\n\n print((1))\n\n\n\nelif K % c != 0:\n\n print((0))\n\n\n\nelse:\n\n lo = -10**18\n\n hi = 10**18\n\n while hi - lo > 1:\n\n mid = (hi + lo) \/\/ 2\n\n if a * K \/\/ c + mid * B \/\/ c >= 0:\n\n hi = mid\n\n else:\n\n lo = mid\n\n x0 = a * K \/\/ c + hi * B \/\/ c\n\n\n\n lo = -10**18\n\n hi = 10**18\n\n while hi - lo > 1:\n\n mid = (hi + lo) \/\/ 2\n\n if b * K \/\/ c - mid * A \/\/ c >= 0:\n\n lo = mid\n\n else:\n\n hi = mid\n\n y0 = b * K \/\/ c - lo * A \/\/ c\n\n\n\n res = 0\n\n x = x0\n\n y = (K - A * x0) \/\/ B\n\n\n\n while True:\n\n res += f.comb(N, x) * f.comb(N, y)\n\n res %= MOD\n\n if y == y0:\n\n break\n\n x += B \/\/ c\n\n y -= A \/\/ c\n\n\n\n print(res)","target":"class Factorial():\n\n def __init__(self, n, mod):\n\n self.mod = mod\n\n self.fct = [0 for _ in range(n + 1)]\n\n self.inv = [0 for _ in range(n + 1)]\n\n self.fct[0] = 1\n\n self.inv[0] = 1\n\n for i in range(n):\n\n self.fct[i + 1] = self.fct[i] * (i + 1) % mod\n\n self.inv[n] = pow(self.fct[n], mod - 2, mod)\n\n for i in range(n)[::-1]:\n\n self.inv[i] = self.inv[i + 1] * (i + 1) % mod\n\n\n\n def comb(self, m, k):\n\n if m < k: return 0\n\n return self.fct[m] * self.inv[k] * self.inv[m - k] % self.mod\n\n\n\nMOD = 998244353\n\nN, A, B, K =list(map(int,input().split()))\n\n\n\nf = Factorial(N, MOD)\n\n\n\nres = 0\n\n\n\nfor i in range(N + 1):\n\n if (K - A * i) % B == 0:\n\n j = (K - A * i) \/\/ B\n\n if 0 <= j <= N:\n\n res += f.comb(N, i) * f.comb(N, j)\n\n res %= MOD\n\n\n\nprint(res)","code_v0_loc":73,"code_v1_loc":32,"code_v0_num_chars":1683,"code_v1_num_chars":869,"code_v0_no_empty_lines":"class Factorial:\n def __init__(self, n, mod):\n self.mod = mod\n self.fct = [0 for _ in range(n + 1)]\n self.inv = [0 for _ in range(n + 1)]\n self.fct[0] = 1\n self.inv[0] = 1\n for i in range(n):\n self.fct[i + 1] = self.fct[i] * (i + 1) % mod\n self.inv[n] = pow(self.fct[n], mod - 2, mod)\n for i in range(n)[::-1]:\n self.inv[i] = self.inv[i + 1] * (i + 1) % mod\n\n def comb(self, m, k):\n if m < k:\n return 0\n return self.fct[m] * self.inv[k] * self.inv[m - k] % self.mod\n\n\ndef ex_euclid(x, y):\n c0, c1 = x, y\n a0, a1 = 1, 0\n b0, b1 = 0, 1\n while c1:\n a0, a1 = a1, a0 - c0 \/\/ c1 * a1\n b0, b1 = b1, b0 - c0 \/\/ c1 * b1\n c0, c1 = c1, c0 % c1\n return c0, a0, b0\n\n\nMOD = 998244353\nN, A, B, K = list(map(int, input().split()))\nf = Factorial(N, MOD)\nc, a, b = ex_euclid(A, B)\nif K == 0:\n print((1))\nelif K % c != 0:\n print((0))\nelse:\n lo = -(10**18)\n hi = 10**18\n while hi - lo > 1:\n mid = (hi + lo) \/\/ 2\n if a * K \/\/ c + mid * B \/\/ c >= 0:\n hi = mid\n else:\n lo = mid\n x0 = a * K \/\/ c + hi * B \/\/ c\n lo = -(10**18)\n hi = 10**18\n while hi - lo > 1:\n mid = (hi + lo) \/\/ 2\n if b * K \/\/ c - mid * A \/\/ c >= 0:\n lo = mid\n else:\n hi = mid\n y0 = b * K \/\/ c - lo * A \/\/ c\n res = 0\n x = x0\n y = (K - A * x0) \/\/ B\n while True:\n res += f.comb(N, x) * f.comb(N, y)\n res %= MOD\n if y == y0:\n break\n x += B \/\/ c\n y -= A \/\/ c\n print(res)\n","code_v1_no_empty_lines":"class Factorial:\n def __init__(self, n, mod):\n self.mod = mod\n self.fct = [0 for _ in range(n + 1)]\n self.inv = [0 for _ in range(n + 1)]\n self.fct[0] = 1\n self.inv[0] = 1\n for i in range(n):\n self.fct[i + 1] = self.fct[i] * (i + 1) % mod\n self.inv[n] = pow(self.fct[n], mod - 2, mod)\n for i in range(n)[::-1]:\n self.inv[i] = self.inv[i + 1] * (i + 1) % mod\n\n def comb(self, m, k):\n if m < k:\n return 0\n return self.fct[m] * self.inv[k] * self.inv[m - k] % self.mod\n\n\nMOD = 998244353\nN, A, B, K = list(map(int, input().split()))\nf = Factorial(N, MOD)\nres = 0\nfor i in range(N + 1):\n if (K - A * i) % B == 0:\n j = (K - A * i) \/\/ B\n if 0 <= j <= N:\n res += f.comb(N, i) * f.comb(N, j)\n res %= MOD\nprint(res)\n","code_same":false,"relative_loc_diff_percent":56.1643835616,"diff":["-def ex_euclid(x, y):","- c0, c1 = x, y","- a0, a1 = 1, 0","- b0, b1 = 0, 1","- while c1:","- a0, a1 = a1, a0 - c0 \/\/ c1 * a1","- b0, b1 = b1, b0 - c0 \/\/ c1 * b1","- c0, c1 = c1, c0 % c1","- return c0, a0, b0","-","-","-c, a, b = ex_euclid(A, B)","-if K == 0:","- print((1))","-elif K % c != 0:","- print((0))","-else:","- lo = -(10**18)","- hi = 10**18","- while hi - lo > 1:","- mid = (hi + lo) \/\/ 2","- if a * K \/\/ c + mid * B \/\/ c >= 0:","- hi = mid","- else:","- lo = mid","- x0 = a * K \/\/ c + hi * B \/\/ c","- lo = -(10**18)","- hi = 10**18","- while hi - lo > 1:","- mid = (hi + lo) \/\/ 2","- if b * K \/\/ c - mid * A \/\/ c >= 0:","- lo = mid","- else:","- hi = mid","- y0 = b * K \/\/ c - lo * A \/\/ c","- res = 0","- x = x0","- y = (K - A * x0) \/\/ B","- while True:","- res += f.comb(N, x) * f.comb(N, y)","- res %= MOD","- if y == y0:","- break","- x += B \/\/ c","- y -= A \/\/ c","- print(res)","+res = 0","+for i in range(N + 1):","+ if (K - A * i) % B == 0:","+ j = (K - A * i) \/\/ B","+ if 0 <= j <= N:","+ res += f.comb(N, i) * f.comb(N, j)","+ res %= MOD","+print(res)"],"diff_only_import_comment":false,"measured_runtime_v0":0.1169746332,"measured_runtime_v1":0.0969758766,"runtime_lift":1.2062240357,"key":["s019254346","s796654105"]} +{"user_id":"u884982181","problem_id":"p03013","language":"python","submission_id_v0":"s732689859","submission_id_v1":"s478557680","cpu_time_v0":519,"cpu_time_v1":235,"memory_v0":56664,"memory_v1":50140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":54.72,"input":"#import sys\n\n#from collections import deque\n\n#from collections import defaultdict\n\n#import math\n\n#sys.setrecursionlimit(20000000)\n\n#input = sys.stdin.readline\n\nn,m = list(map(int,input().split()))\n\na = [int(eval(input())) for i in range(m)]\n\na = set(a)\n\nmod = 10**9+7\n\ndp = [0]*(n+1)\n\ndp[0] = 1\n\nfor i in range(1,n+1):\n\n if i in a:\n\n continue\n\n if i == 1:\n\n dp[i] = 1\n\n continue\n\n dp[i] = dp[i-1] + dp[i-2]\n\n dp[i] %= mod\n\nprint((dp[n]%mod))","target":"import sys\n\nfrom collections import deque\n\nfrom collections import defaultdict\n\nimport math\n\nsys.setrecursionlimit(20000000)\n\ninput = sys.stdin.readline\n\nn,m = list(map(int,input().split()))\n\na = [int(eval(input())) for i in range(m)]\n\na = set(a)\n\nmod = 10**9+7\n\ndp = [0]*(n+5)\n\ndp[0] = 1\n\nfor i in range(1,n+1):\n\n if i in a:\n\n continue\n\n dp[i] = dp[i-1] + dp[i-2]\n\n dp[i] %= mod\n\nprint((dp[n]%mod))\n","code_v0_loc":21,"code_v1_loc":18,"code_v0_num_chars":500,"code_v1_num_chars":422,"code_v0_no_empty_lines":"# import sys\n# from collections import deque\n# from collections import defaultdict\n# import math\n# sys.setrecursionlimit(20000000)\n# input = sys.stdin.readline\nn, m = list(map(int, input().split()))\na = [int(eval(input())) for i in range(m)]\na = set(a)\nmod = 10**9 + 7\ndp = [0] * (n + 1)\ndp[0] = 1\nfor i in range(1, n + 1):\n if i in a:\n continue\n if i == 1:\n dp[i] = 1\n continue\n dp[i] = dp[i - 1] + dp[i - 2]\n dp[i] %= mod\nprint((dp[n] % mod))\n","code_v1_no_empty_lines":"import sys\nfrom collections import deque\nfrom collections import defaultdict\nimport math\n\nsys.setrecursionlimit(20000000)\ninput = sys.stdin.readline\nn, m = list(map(int, input().split()))\na = [int(eval(input())) for i in range(m)]\na = set(a)\nmod = 10**9 + 7\ndp = [0] * (n + 5)\ndp[0] = 1\nfor i in range(1, n + 1):\n if i in a:\n continue\n dp[i] = dp[i - 1] + dp[i - 2]\n dp[i] %= mod\nprint((dp[n] % mod))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-# import sys","-# from collections import deque","-# from collections import defaultdict","-# import math","-# sys.setrecursionlimit(20000000)","-# input = sys.stdin.readline","+import sys","+from collections import deque","+from collections import defaultdict","+import math","+","+sys.setrecursionlimit(20000000)","+input = sys.stdin.readline","-dp = [0] * (n + 1)","+dp = [0] * (n + 5)","- if i == 1:","- dp[i] = 1","- continue"],"diff_only_import_comment":false,"measured_runtime_v0":0.0911115878,"measured_runtime_v1":0.0357580423,"runtime_lift":2.548002681,"key":["s732689859","s478557680"]} +{"user_id":"u592248346","problem_id":"p03135","language":"python","submission_id_v0":"s391724856","submission_id_v1":"s813082158","cpu_time_v0":19,"cpu_time_v1":17,"memory_v0":2940,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.53,"input":"x,y = list(map(int,input().split()))\n\nprint((x\/y))","target":"t,x = list(map(int,input().split()))\n\nprint((t\/x))","code_v0_loc":2,"code_v1_loc":2,"code_v0_num_chars":42,"code_v1_num_chars":42,"code_v0_no_empty_lines":"x, y = list(map(int, input().split()))\nprint((x \/ y))\n","code_v1_no_empty_lines":"t, x = list(map(int, input().split()))\nprint((t \/ x))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-x, y = list(map(int, input().split()))","-print((x \/ y))","+t, x = list(map(int, input().split()))","+print((t \/ x))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0390016422,"measured_runtime_v1":0.0376094902,"runtime_lift":1.037015978,"key":["s391724856","s813082158"]} +{"user_id":"u978167553","problem_id":"p03013","language":"python","submission_id_v0":"s838681255","submission_id_v1":"s006586464","cpu_time_v0":404,"cpu_time_v1":186,"memory_v0":481272,"memory_v1":34280,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.96,"input":"def route_num(stairs):\n\n if stairs <= 1:\n\n return 1\n\n else:\n\n return route_num(stairs - 1) + route_num(stairs - 2)\n\n\n\nn, m = list(map(int, input().split()))\n\na = [int(eval(input())) for _ in range(m)]\n\n\n\nbroken = {i:False for i in range(n + 1)}\n\nfor a_i in a:\n\n broken[a_i] = True\n\n\n\nroute_num = {}\n\nfor i in range(n + 1):\n\n if broken[i]:\n\n route_num[i] = 0\n\n elif i <= 1:\n\n route_num[i] = 1\n\n else:\n\n route_num[i] = route_num[i-1] + route_num[i-2]\n\n\n\nprint((route_num[n] % 1000000007))\n","target":"def route_num(stairs):\n\n if stairs <= 1:\n\n return 1\n\n else:\n\n return route_num(stairs - 1) + route_num(stairs - 2)\n\n\n\nn, m = list(map(int, input().split()))\n\na = [int(eval(input())) for _ in range(m)]\n\n\n\nbroken = {i:False for i in range(n + 1)}\n\nfor a_i in a:\n\n broken[a_i] = True\n\n\n\nroute_num = {}\n\nfor i in range(n + 1):\n\n if broken[i]:\n\n route_num[i] = 0\n\n elif i <= 1:\n\n route_num[i] = 1\n\n else:\n\n route_num[i] = (route_num[i-1] + route_num[i-2]) % 1000000007\n\n\n\nprint((route_num[n]))\n","code_v0_loc":23,"code_v1_loc":23,"code_v0_num_chars":526,"code_v1_num_chars":528,"code_v0_no_empty_lines":"def route_num(stairs):\n if stairs <= 1:\n return 1\n else:\n return route_num(stairs - 1) + route_num(stairs - 2)\n\n\nn, m = list(map(int, input().split()))\na = [int(eval(input())) for _ in range(m)]\nbroken = {i: False for i in range(n + 1)}\nfor a_i in a:\n broken[a_i] = True\nroute_num = {}\nfor i in range(n + 1):\n if broken[i]:\n route_num[i] = 0\n elif i <= 1:\n route_num[i] = 1\n else:\n route_num[i] = route_num[i - 1] + route_num[i - 2]\nprint((route_num[n] % 1000000007))\n","code_v1_no_empty_lines":"def route_num(stairs):\n if stairs <= 1:\n return 1\n else:\n return route_num(stairs - 1) + route_num(stairs - 2)\n\n\nn, m = list(map(int, input().split()))\na = [int(eval(input())) for _ in range(m)]\nbroken = {i: False for i in range(n + 1)}\nfor a_i in a:\n broken[a_i] = True\nroute_num = {}\nfor i in range(n + 1):\n if broken[i]:\n route_num[i] = 0\n elif i <= 1:\n route_num[i] = 1\n else:\n route_num[i] = (route_num[i - 1] + route_num[i - 2]) % 1000000007\nprint((route_num[n]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- route_num[i] = route_num[i - 1] + route_num[i - 2]","-print((route_num[n] % 1000000007))","+ route_num[i] = (route_num[i - 1] + route_num[i - 2]) % 1000000007","+print((route_num[n]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1124666483,"measured_runtime_v1":0.0771123066,"runtime_lift":1.4584785917,"key":["s838681255","s006586464"]} +{"user_id":"u038021590","problem_id":"p03078","language":"python","submission_id_v0":"s193926974","submission_id_v1":"s985329666","cpu_time_v0":994,"cpu_time_v1":690,"memory_v0":151768,"memory_v1":137660,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":30.58,"input":"X, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\n\n\nD = []\n\nfor a in A:\n\n for b in B:\n\n D.append(a + b)\n\nD.sort(reverse=True)\n\nif len(D) > K:\n\n D = D[:K]\n\nE = []\n\nfor d in D:\n\n for c in C:\n\n E.append(c + d)\n\n\n\nE.sort(reverse=True)\n\nfor i, e in enumerate(E):\n\n if i >= K:\n\n break\n\n print(e)","target":"X, Y, Z, K = list(map(int, input().split()))\n\nA = list(map(int, input().split()))\n\nB = list(map(int, input().split()))\n\nC = list(map(int, input().split()))\n\nA.sort(reverse=True)\n\nB.sort(reverse=True)\n\nC.sort(reverse=True)\n\nD = []\n\nfor i in range(X):\n\n for j in range(Y):\n\n for k in range(Z):\n\n if i * j * k > K:\n\n break\n\n D.append(A[i] + B[j] + C[k])\n\nD.sort(reverse=True)\n\nfor d in D[:K]:\n\n print(d)\n","code_v0_loc":22,"code_v1_loc":17,"code_v0_num_chars":426,"code_v1_num_chars":445,"code_v0_no_empty_lines":"X, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nD = []\nfor a in A:\n for b in B:\n D.append(a + b)\nD.sort(reverse=True)\nif len(D) > K:\n D = D[:K]\nE = []\nfor d in D:\n for c in C:\n E.append(c + d)\nE.sort(reverse=True)\nfor i, e in enumerate(E):\n if i >= K:\n break\n print(e)\n","code_v1_no_empty_lines":"X, Y, Z, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort(reverse=True)\nB.sort(reverse=True)\nC.sort(reverse=True)\nD = []\nfor i in range(X):\n for j in range(Y):\n for k in range(Z):\n if i * j * k > K:\n break\n D.append(A[i] + B[j] + C[k])\nD.sort(reverse=True)\nfor d in D[:K]:\n print(d)\n","code_same":false,"relative_loc_diff_percent":22.7272727273,"diff":["+A.sort(reverse=True)","+B.sort(reverse=True)","+C.sort(reverse=True)","-for a in A:","- for b in B:","- D.append(a + b)","+for i in range(X):","+ for j in range(Y):","+ for k in range(Z):","+ if i * j * k > K:","+ break","+ D.append(A[i] + B[j] + C[k])","-if len(D) > K:","- D = D[:K]","-E = []","-for d in D:","- for c in C:","- E.append(c + d)","-E.sort(reverse=True)","-for i, e in enumerate(E):","- if i >= K:","- break","- print(e)","+for d in D[:K]:","+ print(d)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0368357344,"measured_runtime_v1":0.0352240186,"runtime_lift":1.0457561587,"key":["s193926974","s985329666"]} +{"user_id":"u503476415","problem_id":"p03486","language":"python","submission_id_v0":"s450478464","submission_id_v1":"s822649054","cpu_time_v0":30,"cpu_time_v1":17,"memory_v0":3824,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.33,"input":"import random\n\ns_given = list(eval(input()))\n\nt_given = list(eval(input()))\n\n\n\ns_len = len(s_given)\n\nt_len = len(t_given)\n\ns_sorted = sorted(s_given)\n\nt_sorted = sorted(t_given, reverse=True)\n\n\n\nfor i in range(t_len):\n\n if s_sorted[i] < t_sorted[i]:\n\n print('Yes')\n\n break\n\n elif s_sorted[i] > t_sorted[i]:\n\n print('No')\n\n break\n\n if i == t_len - 1:\n\n print('No')\n\n break\n\n elif i == s_len - 1 :\n\n print('Yes')\n\n break\n","target":"s_given = list(eval(input()))\n\nt_given = list(eval(input()))\n\n\n\ns_len = len(s_given)\n\nt_len = len(t_given)\n\ns_sorted = sorted(s_given)\n\nt_sorted = sorted(t_given, reverse=True)\n\n\n\nfor i in range(t_len):\n\n if s_sorted[i] < t_sorted[i]:\n\n print('Yes')\n\n break\n\n elif s_sorted[i] > t_sorted[i]:\n\n print('No')\n\n break\n\n\n\n #s_sorted\u3068t_sorted\u304c\u540c\u4e00\u306e\u5834\u5408\u306bNo\u3068\u51fa\u529b\u3059\u308b\u305f\u3081\u3001\u3053\u306e\u9806\u5e8f\u3067if\u3068elif\u3092\u66f8\u304f\n\n if i == t_len - 1:\n\n print('No')\n\n break\n\n elif i == s_len - 1 :\n\n print('Yes')\n\n break\n","code_v0_loc":22,"code_v1_loc":23,"code_v0_num_chars":475,"code_v1_num_chars":518,"code_v0_no_empty_lines":"import random\n\ns_given = list(eval(input()))\nt_given = list(eval(input()))\ns_len = len(s_given)\nt_len = len(t_given)\ns_sorted = sorted(s_given)\nt_sorted = sorted(t_given, reverse=True)\nfor i in range(t_len):\n if s_sorted[i] < t_sorted[i]:\n print(\"Yes\")\n break\n elif s_sorted[i] > t_sorted[i]:\n print(\"No\")\n break\n if i == t_len - 1:\n print(\"No\")\n break\n elif i == s_len - 1:\n print(\"Yes\")\n break\n","code_v1_no_empty_lines":"s_given = list(eval(input()))\nt_given = list(eval(input()))\ns_len = len(s_given)\nt_len = len(t_given)\ns_sorted = sorted(s_given)\nt_sorted = sorted(t_given, reverse=True)\nfor i in range(t_len):\n if s_sorted[i] < t_sorted[i]:\n print(\"Yes\")\n break\n elif s_sorted[i] > t_sorted[i]:\n print(\"No\")\n break\n # s_sorted\u3068t_sorted\u304c\u540c\u4e00\u306e\u5834\u5408\u306bNo\u3068\u51fa\u529b\u3059\u308b\u305f\u3081\u3001\u3053\u306e\u9806\u5e8f\u3067if\u3068elif\u3092\u66f8\u304f\n if i == t_len - 1:\n print(\"No\")\n break\n elif i == s_len - 1:\n print(\"Yes\")\n break\n","code_same":false,"relative_loc_diff_percent":4.347826087,"diff":["-import random","-","+ # s_sorted\u3068t_sorted\u304c\u540c\u4e00\u306e\u5834\u5408\u306bNo\u3068\u51fa\u529b\u3059\u308b\u305f\u3081\u3001\u3053\u306e\u9806\u5e8f\u3067if\u3068elif\u3092\u66f8\u304f"],"diff_only_import_comment":false,"measured_runtime_v0":0.0843495924,"measured_runtime_v1":0.0382919985,"runtime_lift":2.2027994262,"key":["s450478464","s822649054"]} +{"user_id":"u480138356","problem_id":"p03290","language":"python","submission_id_v0":"s303118094","submission_id_v1":"s308701868","cpu_time_v0":24,"cpu_time_v1":21,"memory_v0":3192,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":12.5,"input":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef ceil(a, b):\n\n if a%b == 0:\n\n return a\/\/b\n\n else:\n\n return a\/\/b + 1\n\n\n\ndef main():\n\n D, G = list(map(int, input().split()))\n\n G \/\/= 100\n\n pc = [list(map(int, input().split())) for i in range(D)]\n\n\n\n ans = int(1e9)\n\n for i in range(2**D):\n\n tmp = 0\n\n rest = []\n\n count = 0\n\n for j in range(D):\n\n if i&1:# \u30b3\u30f3\u30d7\u30ea\u30fc\u30c8\u3059\u308b\u554f\u984c\n\n tmp += (j+1) * pc[j][0] + pc[j][1]\/\/100\n\n count += pc[j][0]\n\n else:\n\n rest.append((j+1, pc[j][0]))\n\n i >>= 1\n\n rest = sorted(rest, reverse=True)\n\n rest_point = G - tmp\n\n if rest_point <= 0:# \u3059\u3067\u306b\u8db3\u308a\u3066\u3044\u308b\n\n ans = min(ans, count)\n\n elif len(rest) > 0:# \u4e0d\u8db3\u5206\u3092\u88dc\u3046\u5fc5\u8981\u304c\u3042\u308b\n\n plus = ceil(rest_point, rest[0][0])\n\n if plus < rest[0][1]:# p-1\u554f\u4ee5\u5185\u3067\u3059\u3080\n\n ans = min(ans, count + plus)\n\n else:# \u3059\u3079\u3066\u4f7f\u3063\u3066\u3082\u8db3\u308a\u306a\u3044\n\n pass\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"import sys\n\ninput = sys.stdin.readline\n\n\n\ndef ceil(a, b):\n\n if a%b == 0:\n\n return a\/\/b\n\n else:\n\n return (a\/\/b) + 1\n\n\n\ndef main():\n\n D, G = list(map(int, input().split()))\n\n pc = [list(map(int, input().split())) for i in range(D)]\n\n\n\n ans = int(1e9)\n\n for i in range(2**D):\n\n score = 0\n\n count = 0\n\n check = [False] * D\n\n for j in range(D):\n\n p, c = pc[j]\n\n if i&1:# \u554f\u984cj\u3092\u5168\u3066\u89e3\u304f\n\n score += 100 * (j+1) * p + c\n\n count += p\n\n check[j] = True\n\n i >>= 1\n\n if score < G:\n\n for j in range(D):\n\n if not check[D-1-j]:\n\n check[D-1-j] = True\n\n p, c = pc[D-1-j]\n\n tmp = ceil(G - score, (D-j) * 100)\n\n if tmp < p:\n\n count += tmp\n\n score += tmp * (D-j) * 100\n\n break\n\n if score >= G:\n\n # print(score, check, count)\n\n ans = min(ans, count)\n\n \n\n print(ans)\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":40,"code_v1_loc":46,"code_v0_num_chars":1040,"code_v1_num_chars":1127,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef ceil(a, b):\n if a % b == 0:\n return a \/\/ b\n else:\n return a \/\/ b + 1\n\n\ndef main():\n D, G = list(map(int, input().split()))\n G \/\/= 100\n pc = [list(map(int, input().split())) for i in range(D)]\n ans = int(1e9)\n for i in range(2**D):\n tmp = 0\n rest = []\n count = 0\n for j in range(D):\n if i & 1: # \u30b3\u30f3\u30d7\u30ea\u30fc\u30c8\u3059\u308b\u554f\u984c\n tmp += (j + 1) * pc[j][0] + pc[j][1] \/\/ 100\n count += pc[j][0]\n else:\n rest.append((j + 1, pc[j][0]))\n i >>= 1\n rest = sorted(rest, reverse=True)\n rest_point = G - tmp\n if rest_point <= 0: # \u3059\u3067\u306b\u8db3\u308a\u3066\u3044\u308b\n ans = min(ans, count)\n elif len(rest) > 0: # \u4e0d\u8db3\u5206\u3092\u88dc\u3046\u5fc5\u8981\u304c\u3042\u308b\n plus = ceil(rest_point, rest[0][0])\n if plus < rest[0][1]: # p-1\u554f\u4ee5\u5185\u3067\u3059\u3080\n ans = min(ans, count + plus)\n else: # \u3059\u3079\u3066\u4f7f\u3063\u3066\u3082\u8db3\u308a\u306a\u3044\n pass\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\ndef ceil(a, b):\n if a % b == 0:\n return a \/\/ b\n else:\n return (a \/\/ b) + 1\n\n\ndef main():\n D, G = list(map(int, input().split()))\n pc = [list(map(int, input().split())) for i in range(D)]\n ans = int(1e9)\n for i in range(2**D):\n score = 0\n count = 0\n check = [False] * D\n for j in range(D):\n p, c = pc[j]\n if i & 1: # \u554f\u984cj\u3092\u5168\u3066\u89e3\u304f\n score += 100 * (j + 1) * p + c\n count += p\n check[j] = True\n i >>= 1\n if score < G:\n for j in range(D):\n if not check[D - 1 - j]:\n check[D - 1 - j] = True\n p, c = pc[D - 1 - j]\n tmp = ceil(G - score, (D - j) * 100)\n if tmp < p:\n count += tmp\n score += tmp * (D - j) * 100\n break\n if score >= G:\n # print(score, check, count)\n ans = min(ans, count)\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":13.0434782609,"diff":["- return a \/\/ b + 1","+ return (a \/\/ b) + 1","- G \/\/= 100","- tmp = 0","- rest = []","+ score = 0","+ check = [False] * D","- if i & 1: # \u30b3\u30f3\u30d7\u30ea\u30fc\u30c8\u3059\u308b\u554f\u984c","- tmp += (j + 1) * pc[j][0] + pc[j][1] \/\/ 100","- count += pc[j][0]","- else:","- rest.append((j + 1, pc[j][0]))","+ p, c = pc[j]","+ if i & 1: # \u554f\u984cj\u3092\u5168\u3066\u89e3\u304f","+ score += 100 * (j + 1) * p + c","+ count += p","+ check[j] = True","- rest = sorted(rest, reverse=True)","- rest_point = G - tmp","- if rest_point <= 0: # \u3059\u3067\u306b\u8db3\u308a\u3066\u3044\u308b","+ if score < G:","+ for j in range(D):","+ if not check[D - 1 - j]:","+ check[D - 1 - j] = True","+ p, c = pc[D - 1 - j]","+ tmp = ceil(G - score, (D - j) * 100)","+ if tmp < p:","+ count += tmp","+ score += tmp * (D - j) * 100","+ break","+ if score >= G:","+ # print(score, check, count)","- elif len(rest) > 0: # \u4e0d\u8db3\u5206\u3092\u88dc\u3046\u5fc5\u8981\u304c\u3042\u308b","- plus = ceil(rest_point, rest[0][0])","- if plus < rest[0][1]: # p-1\u554f\u4ee5\u5185\u3067\u3059\u3080","- ans = min(ans, count + plus)","- else: # \u3059\u3079\u3066\u4f7f\u3063\u3066\u3082\u8db3\u308a\u306a\u3044","- pass"],"diff_only_import_comment":false,"measured_runtime_v0":0.0430688508,"measured_runtime_v1":0.0474523594,"runtime_lift":0.9076229561,"key":["s303118094","s308701868"]} +{"user_id":"u539367121","problem_id":"p02901","language":"python","submission_id_v0":"s345947777","submission_id_v1":"s882017508","cpu_time_v0":1048,"cpu_time_v1":452,"memory_v0":9244,"memory_v1":9208,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":56.87,"input":"def main():\n\n n,m=list(map(int,input().split()))\n\n inf=10**9\n\n dp=[inf]*(1<dp[s]+a:\n\n dp[t|s]=dp[s]+a\n\n #dp[t|s]=min(dp[t|s], dp[s]+a)\n\n \n\n #print(cost)\n\n \"\"\"\n\n dp=[inf]*(1< dp[s] + a:\n dp[t | s] = dp[s] + a\n # dp[t|s]=min(dp[t|s], dp[s]+a)\n # print(cost)\n \"\"\"\n dp=[inf]*(1< dp[s] + a:","+ dp[t | s] = dp[s] + a","+ # dp[t|s]=min(dp[t|s], dp[s]+a)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0362124324,"measured_runtime_v1":0.0427803292,"runtime_lift":0.8464739059,"key":["s345947777","s882017508"]} +{"user_id":"u392319141","problem_id":"p02681","language":"python","submission_id_v0":"s812368470","submission_id_v1":"s143565651","cpu_time_v0":28,"cpu_time_v1":23,"memory_v0":9916,"memory_v1":9016,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":17.86,"input":"import string\n\n\n\nS = eval(input())\n\nT = eval(input())\n\n\n\nfor a in string.ascii_lowercase:\n\n if S + a == T:\n\n print('Yes')\n\n exit()\n\n\n\nprint('No')","target":"S = eval(input())\n\nT = eval(input())\n\n\n\nprint(('Yes' if S == T[:-1] else 'No'))\n","code_v0_loc":11,"code_v1_loc":4,"code_v0_num_chars":150,"code_v1_num_chars":66,"code_v0_no_empty_lines":"import string\n\nS = eval(input())\nT = eval(input())\nfor a in string.ascii_lowercase:\n if S + a == T:\n print(\"Yes\")\n exit()\nprint(\"No\")\n","code_v1_no_empty_lines":"S = eval(input())\nT = eval(input())\nprint((\"Yes\" if S == T[:-1] else \"No\"))\n","code_same":false,"relative_loc_diff_percent":63.6363636364,"diff":["-import string","-","-for a in string.ascii_lowercase:","- if S + a == T:","- print(\"Yes\")","- exit()","-print(\"No\")","+print((\"Yes\" if S == T[:-1] else \"No\"))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0469690795,"measured_runtime_v1":0.0372148364,"runtime_lift":1.2621063016,"key":["s812368470","s143565651"]} +{"user_id":"u130900604","problem_id":"p02554","language":"python","submission_id_v0":"s683107105","submission_id_v1":"s092423015","cpu_time_v0":75,"cpu_time_v1":63,"memory_v0":61680,"memory_v1":61800,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.0,"input":"n=int(eval(input()))\n\nmod=10**9+7\n\nans=pow(10,n,mod)\n\nans-=2*pow(9,n,mod)\n\nans+=pow(8,n,mod)\n\nans%=mod\n\nprint(ans)","target":"n=int(eval(input()))\n\nm=10**9+7\n\nprint(((pow(10,n,m)-2*pow(9,n,m)+pow(8,n,m))%m))","code_v0_loc":7,"code_v1_loc":3,"code_v0_num_chars":108,"code_v1_num_chars":73,"code_v0_no_empty_lines":"n = int(eval(input()))\nmod = 10**9 + 7\nans = pow(10, n, mod)\nans -= 2 * pow(9, n, mod)\nans += pow(8, n, mod)\nans %= mod\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\nm = 10**9 + 7\nprint(((pow(10, n, m) - 2 * pow(9, n, m) + pow(8, n, m)) % m))\n","code_same":false,"relative_loc_diff_percent":57.1428571429,"diff":["-mod = 10**9 + 7","-ans = pow(10, n, mod)","-ans -= 2 * pow(9, n, mod)","-ans += pow(8, n, mod)","-ans %= mod","-print(ans)","+m = 10**9 + 7","+print(((pow(10, n, m) - 2 * pow(9, n, m) + pow(8, n, m)) % m))"],"diff_only_import_comment":false,"measured_runtime_v0":0.045108748,"measured_runtime_v1":0.0361436763,"runtime_lift":1.2480398396,"key":["s683107105","s092423015"]} +{"user_id":"u729133443","problem_id":"p02735","language":"python","submission_id_v0":"s281036734","submission_id_v1":"s164489548","cpu_time_v0":24,"cpu_time_v1":22,"memory_v0":3064,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.33,"input":"_,*s=open(0)\n\nb,q='.'*101,list(range(101))\n\nfor i,s in enumerate(s):\n\n a=[i]\n\n for x,y,z,c in zip(b,'.'+s,s,q):a+=min(c+(x=='.'>z),a[-1]+(y=='.'>z)),\n\n b,q=s,a[1:]\n\nprint((a[-2]))","target":"def main():\n\n _,*s=open(0)\n\n b,q='.'*101,list(range(101))\n\n for i,s in enumerate(s):\n\n a=[]\n\n for x,y,z,c in zip(b,'.'+s,s,q):\n\n c+=x=='.'>z\n\n i+=y=='.'>z\n\n if i>c:i=c\n\n a+=i,\n\n b,q=s,a\n\n print((a[-2]))\n\nmain()","code_v0_loc":7,"code_v1_loc":13,"code_v0_num_chars":174,"code_v1_num_chars":235,"code_v0_no_empty_lines":"_, *s = open(0)\nb, q = \".\" * 101, list(range(101))\nfor i, s in enumerate(s):\n a = [i]\n for x, y, z, c in zip(b, \".\" + s, s, q):\n a += (min(c + (x == \".\" > z), a[-1] + (y == \".\" > z)),)\n b, q = s, a[1:]\nprint((a[-2]))\n","code_v1_no_empty_lines":"def main():\n _, *s = open(0)\n b, q = \".\" * 101, list(range(101))\n for i, s in enumerate(s):\n a = []\n for x, y, z, c in zip(b, \".\" + s, s, q):\n c += x == \".\" > z\n i += y == \".\" > z\n if i > c:\n i = c\n a += (i,)\n b, q = s, a\n print((a[-2]))\n\n\nmain()\n","code_same":false,"relative_loc_diff_percent":46.1538461538,"diff":["-_, *s = open(0)","-b, q = \".\" * 101, list(range(101))","-for i, s in enumerate(s):","- a = [i]","- for x, y, z, c in zip(b, \".\" + s, s, q):","- a += (min(c + (x == \".\" > z), a[-1] + (y == \".\" > z)),)","- b, q = s, a[1:]","-print((a[-2]))","+def main():","+ _, *s = open(0)","+ b, q = \".\" * 101, list(range(101))","+ for i, s in enumerate(s):","+ a = []","+ for x, y, z, c in zip(b, \".\" + s, s, q):","+ c += x == \".\" > z","+ i += y == \".\" > z","+ if i > c:","+ i = c","+ a += (i,)","+ b, q = s, a","+ print((a[-2]))","+","+","+main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0333595871,"measured_runtime_v1":0.0359994255,"runtime_lift":0.9266699857,"key":["s281036734","s164489548"]} +{"user_id":"u859987056","problem_id":"p02584","language":"python","submission_id_v0":"s714815256","submission_id_v1":"s099455288","cpu_time_v0":32,"cpu_time_v1":26,"memory_v0":9156,"memory_v1":9064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.75,"input":"x,k,d = list(map(int,input().split()))\n\n\n\ntmp = abs(x) % d\n\ncal = abs(x) \/\/ d\n\nif tmp > abs(tmp - d):\n\n cal += 1\n\n tmp = abs(tmp - d)\n\n\n\nif cal == k:\n\n print(tmp)\n\nelif cal > k:\n\n print((abs(x) - k*d))\n\nelse:\n\n if (k - cal) % 2 == 0:\n\n print(tmp)\n\n else:\n\n print((min(abs(tmp-d),abs(tmp+d))))","target":"x,k,d = list(map(int,input().split()))\n\n\n\nans = abs(x) % d\n\ncal = abs(x) \/\/ d\n\nif ans > abs(ans - d):\n\n cal += 1\n\n ans = abs(ans - d)\n\n\n\nif cal > k:\n\n ans = abs(x) - k*d\n\nelse:\n\n if (k - cal) % 2 == 1:\n\n ans = min(abs(ans-d),abs(ans+d))\n\n\n\nprint(ans)","code_v0_loc":17,"code_v1_loc":15,"code_v0_num_chars":314,"code_v1_num_chars":263,"code_v0_no_empty_lines":"x, k, d = list(map(int, input().split()))\ntmp = abs(x) % d\ncal = abs(x) \/\/ d\nif tmp > abs(tmp - d):\n cal += 1\n tmp = abs(tmp - d)\nif cal == k:\n print(tmp)\nelif cal > k:\n print((abs(x) - k * d))\nelse:\n if (k - cal) % 2 == 0:\n print(tmp)\n else:\n print((min(abs(tmp - d), abs(tmp + d))))\n","code_v1_no_empty_lines":"x, k, d = list(map(int, input().split()))\nans = abs(x) % d\ncal = abs(x) \/\/ d\nif ans > abs(ans - d):\n cal += 1\n ans = abs(ans - d)\nif cal > k:\n ans = abs(x) - k * d\nelse:\n if (k - cal) % 2 == 1:\n ans = min(abs(ans - d), abs(ans + d))\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":11.7647058824,"diff":["-tmp = abs(x) % d","+ans = abs(x) % d","-if tmp > abs(tmp - d):","+if ans > abs(ans - d):","- tmp = abs(tmp - d)","-if cal == k:","- print(tmp)","-elif cal > k:","- print((abs(x) - k * d))","+ ans = abs(ans - d)","+if cal > k:","+ ans = abs(x) - k * d","- if (k - cal) % 2 == 0:","- print(tmp)","- else:","- print((min(abs(tmp - d), abs(tmp + d))))","+ if (k - cal) % 2 == 1:","+ ans = min(abs(ans - d), abs(ans + d))","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0417960007,"measured_runtime_v1":0.0402810924,"runtime_lift":1.0376084215,"key":["s714815256","s099455288"]} +{"user_id":"u014333473","problem_id":"p03695","language":"python","submission_id_v0":"s640639678","submission_id_v1":"s418313447","cpu_time_v0":33,"cpu_time_v1":28,"memory_v0":9368,"memory_v1":9380,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":15.15,"input":"import collections as c\n\neval(input());a=c.Counter(i\/\/400 for i in [*list(map(int,input().split()))])\n\nb,c=len(set([i for i,j in list(a.items())if i<8])),sum([j for i,j in list(a.items())if i>=8])\n\nprint(([b,1][b==0],b+c))\n","target":"import collections as c\n\neval(input());a=c.Counter(i\/\/400 for i in [*list(map(int,input().split()))])\n\nb,c=len(set([i for i in list(a.keys())if i<8])),sum([j for i,j in list(a.items())if i>=8])\n\nprint(([b,1][b==0],b+c))","code_v0_loc":4,"code_v1_loc":4,"code_v0_num_chars":197,"code_v1_num_chars":193,"code_v0_no_empty_lines":"import collections as c\n\neval(input())\na = c.Counter(i \/\/ 400 for i in [*list(map(int, input().split()))])\nb, c = len(set([i for i, j in list(a.items()) if i < 8])), sum(\n [j for i, j in list(a.items()) if i >= 8]\n)\nprint(([b, 1][b == 0], b + c))\n","code_v1_no_empty_lines":"import collections as c\n\neval(input())\na = c.Counter(i \/\/ 400 for i in [*list(map(int, input().split()))])\nb, c = len(set([i for i in list(a.keys()) if i < 8])), sum(\n [j for i, j in list(a.items()) if i >= 8]\n)\nprint(([b, 1][b == 0], b + c))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-b, c = len(set([i for i, j in list(a.items()) if i < 8])), sum(","+b, c = len(set([i for i in list(a.keys()) if i < 8])), sum("],"diff_only_import_comment":false,"measured_runtime_v0":0.0431378219,"measured_runtime_v1":0.102918148,"runtime_lift":0.4191468923,"key":["s640639678","s418313447"]} +{"user_id":"u231095456","problem_id":"p03682","language":"python","submission_id_v0":"s130840247","submission_id_v1":"s647157053","cpu_time_v0":1855,"cpu_time_v1":820,"memory_v0":95880,"memory_v1":54572,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":55.8,"input":"import heapq as hq\n\nclass UnionFind(object):\n\n def __init__(self, size):\n\n self.parent = [i for i in range(size)]\n\n self.rank = [0]*size\n\n def find(self, x):\n\n if self.parent[x] == x:\n\n return x\n\n self.parent[x] = self.find(self.parent[x])\n\n return self.parent[x]\n\n def unite(self, x, y):\n\n x, y = self.find(x), self.find(y)\n\n if x == y:\n\n return\n\n if self.rank[x] < self.rank[y]:\n\n self.parent[x] = y\n\n else:\n\n self.parent[y] = x\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\nN = int(eval(input()))\n\nls = []\n\nrs = []\n\nind = 0\n\ninds = dict()\n\nfor _ in range(N):\n\n x,y = list(map(int,input().split()))\n\n if (x,y) not in list(inds.keys()):\n\n ls.append((x,y))\n\n rs.append((y,x))\n\n inds[(x,y)] = ind\n\n ind += 1\n\nN = ind\n\nls.sort()\n\nrs.sort()\n\nuf = UnionFind(N)\n\n\n\nedges = []\n\nfor i in range(N-1):\n\n x = ls[i][0]\n\n a = ls[i+1][0]\n\n y = ls[i][1]\n\n b = ls[i+1][1]\n\n d = min(abs(x-a), abs(y-b))\n\n edges.append((d,(x,y),(a,b)))\n\n x = rs[i][1]\n\n a = rs[i+1][1]\n\n y = rs[i][0]\n\n b = rs[i+1][0]\n\n d = min(abs(x-a), abs(y-b))\n\n edges.append((d,(x,y),(a,b)))\n\nedges.sort(key=lambda x:x[0])\n\nans = 0\n\nfor d,i,j in edges:\n\n # \u9589\u8def\u304c\u3067\u304d\u306a\u3044\u5834\u5408\u8ffd\u52a0\u3059\u308b\n\n if not uf.same(inds[i],inds[j]):\n\n uf.unite(inds[i],inds[j])\n\n ans += d\n\nprint(ans)","target":"import sys\n\ninput = sys.stdin.readline\n\nclass UnionFind(object):\n\n def __init__(self, size):\n\n self.parent = [i for i in range(size)]\n\n self.rank = [0]*size\n\n def find(self, x):\n\n if self.parent[x] == x:\n\n return x\n\n # path compression\n\n self.parent[x] = self.find(self.parent[x])\n\n return self.parent[x]\n\n \n\n def unite(self, x, y):\n\n x, y = self.find(x), self.find(y)\n\n if x == y:\n\n return\n\n # union by rank\n\n if self.rank[x] < self.rank[y]:\n\n self.parent[x] = y\n\n else:\n\n self.parent[y] = x\n\n if self.rank[x] == self.rank[y]:\n\n self.rank[x] += 1\n\n \n\n def same(self, x, y):\n\n return self.find(x) == self.find(y)\n\n\n\nif __name__ == \"__main__\":\n\n N = int(eval(input()))\n\n vs = []\n\n for i in range(N):\n\n x,y = list(map(int,input().split()))\n\n vs.append((x,y,i))\n\n vs.sort()\n\n edges = []\n\n for k in range(1, N):\n\n x,y,i = vs[k]\n\n a,b,j = vs[k-1]\n\n edges.append((i, j, min(abs(x-a),abs(y-b))))\n\n vs.sort(key=lambda x:x[1])\n\n for k in range(1, N):\n\n x,y,i = vs[k]\n\n a,b,j = vs[k-1]\n\n edges.append((i, j, min(abs(x-a),abs(y-b))))\n\n uf = UnionFind(N)\n\n edges.sort(key=lambda x:x[2])\n\n ans = 0\n\n for i,j,w in edges:\n\n if not uf.same(i,j):\n\n uf.unite(i,j)\n\n ans += w\n\n print(ans)","code_v0_loc":61,"code_v1_loc":53,"code_v0_num_chars":1521,"code_v1_num_chars":1453,"code_v0_no_empty_lines":"import heapq as hq\n\n\nclass UnionFind(object):\n def __init__(self, size):\n self.parent = [i for i in range(size)]\n self.rank = [0] * size\n\n def find(self, x):\n if self.parent[x] == x:\n return x\n self.parent[x] = self.find(self.parent[x])\n return self.parent[x]\n\n def unite(self, x, y):\n x, y = self.find(x), self.find(y)\n if x == y:\n return\n if self.rank[x] < self.rank[y]:\n self.parent[x] = y\n else:\n self.parent[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n\nN = int(eval(input()))\nls = []\nrs = []\nind = 0\ninds = dict()\nfor _ in range(N):\n x, y = list(map(int, input().split()))\n if (x, y) not in list(inds.keys()):\n ls.append((x, y))\n rs.append((y, x))\n inds[(x, y)] = ind\n ind += 1\nN = ind\nls.sort()\nrs.sort()\nuf = UnionFind(N)\nedges = []\nfor i in range(N - 1):\n x = ls[i][0]\n a = ls[i + 1][0]\n y = ls[i][1]\n b = ls[i + 1][1]\n d = min(abs(x - a), abs(y - b))\n edges.append((d, (x, y), (a, b)))\n x = rs[i][1]\n a = rs[i + 1][1]\n y = rs[i][0]\n b = rs[i + 1][0]\n d = min(abs(x - a), abs(y - b))\n edges.append((d, (x, y), (a, b)))\nedges.sort(key=lambda x: x[0])\nans = 0\nfor d, i, j in edges:\n # \u9589\u8def\u304c\u3067\u304d\u306a\u3044\u5834\u5408\u8ffd\u52a0\u3059\u308b\n if not uf.same(inds[i], inds[j]):\n uf.unite(inds[i], inds[j])\n ans += d\nprint(ans)\n","code_v1_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\n\n\nclass UnionFind(object):\n def __init__(self, size):\n self.parent = [i for i in range(size)]\n self.rank = [0] * size\n\n def find(self, x):\n if self.parent[x] == x:\n return x\n # path compression\n self.parent[x] = self.find(self.parent[x])\n return self.parent[x]\n\n def unite(self, x, y):\n x, y = self.find(x), self.find(y)\n if x == y:\n return\n # union by rank\n if self.rank[x] < self.rank[y]:\n self.parent[x] = y\n else:\n self.parent[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n\nif __name__ == \"__main__\":\n N = int(eval(input()))\n vs = []\n for i in range(N):\n x, y = list(map(int, input().split()))\n vs.append((x, y, i))\n vs.sort()\n edges = []\n for k in range(1, N):\n x, y, i = vs[k]\n a, b, j = vs[k - 1]\n edges.append((i, j, min(abs(x - a), abs(y - b))))\n vs.sort(key=lambda x: x[1])\n for k in range(1, N):\n x, y, i = vs[k]\n a, b, j = vs[k - 1]\n edges.append((i, j, min(abs(x - a), abs(y - b))))\n uf = UnionFind(N)\n edges.sort(key=lambda x: x[2])\n ans = 0\n for i, j, w in edges:\n if not uf.same(i, j):\n uf.unite(i, j)\n ans += w\n print(ans)\n","code_same":false,"relative_loc_diff_percent":13.1147540984,"diff":["-import heapq as hq","+import sys","+","+input = sys.stdin.readline","+ # path compression","+ # union by rank","-N = int(eval(input()))","-ls = []","-rs = []","-ind = 0","-inds = dict()","-for _ in range(N):","- x, y = list(map(int, input().split()))","- if (x, y) not in list(inds.keys()):","- ls.append((x, y))","- rs.append((y, x))","- inds[(x, y)] = ind","- ind += 1","-N = ind","-ls.sort()","-rs.sort()","-uf = UnionFind(N)","-edges = []","-for i in range(N - 1):","- x = ls[i][0]","- a = ls[i + 1][0]","- y = ls[i][1]","- b = ls[i + 1][1]","- d = min(abs(x - a), abs(y - b))","- edges.append((d, (x, y), (a, b)))","- x = rs[i][1]","- a = rs[i + 1][1]","- y = rs[i][0]","- b = rs[i + 1][0]","- d = min(abs(x - a), abs(y - b))","- edges.append((d, (x, y), (a, b)))","-edges.sort(key=lambda x: x[0])","-ans = 0","-for d, i, j in edges:","- # \u9589\u8def\u304c\u3067\u304d\u306a\u3044\u5834\u5408\u8ffd\u52a0\u3059\u308b","- if not uf.same(inds[i], inds[j]):","- uf.unite(inds[i], inds[j])","- ans += d","-print(ans)","+if __name__ == \"__main__\":","+ N = int(eval(input()))","+ vs = []","+ for i in range(N):","+ x, y = list(map(int, input().split()))","+ vs.append((x, y, i))","+ vs.sort()","+ edges = []","+ for k in range(1, N):","+ x, y, i = vs[k]","+ a, b, j = vs[k - 1]","+ edges.append((i, j, min(abs(x - a), abs(y - b))))","+ vs.sort(key=lambda x: x[1])","+ for k in range(1, N):","+ x, y, i = vs[k]","+ a, b, j = vs[k - 1]","+ edges.append((i, j, min(abs(x - a), abs(y - b))))","+ uf = UnionFind(N)","+ edges.sort(key=lambda x: x[2])","+ ans = 0","+ for i, j, w in edges:","+ if not uf.same(i, j):","+ uf.unite(i, j)","+ ans += w","+ print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0869617462,"measured_runtime_v1":0.0377503872,"runtime_lift":2.3035987883,"key":["s130840247","s647157053"]} +{"user_id":"u060232355","problem_id":"p03298","language":"python","submission_id_v0":"s047471981","submission_id_v1":"s035522830","cpu_time_v0":1341,"cpu_time_v1":402,"memory_v0":155580,"memory_v1":62684,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":70.02,"input":"\n\nimport sys\n\n#sys.stdin=open(\"data.txt\")\n\ninput=sys.stdin.readline\n\n\n\nn=int(eval(input()))\n\ns=input().strip()\n\n\n\nmemo={}\n\ndef getans(a,b,c):\n\n while a and c and a[0]==c[-1]:\n\n a=a[1:]\n\n c=c[:-1]\n\n if b==\"\":\n\n if a==\"\" and c==\"\": return 1\n\n else: return 0\n\n key=a+\"\/\"+b+\"\/\"+c\n\n if key in memo: return memo[key]\n\n # select first letter\n\n ans=0\n\n for i in range(1,len(b)):\n\n if b[0]==b[i]:\n\n ans+=getans(a,b[1:i],b[i+1:]+c)\n\n # don't select first letter\n\n ans+=getans(a+b[0],b[1:],c)\n\n memo[key]=ans\n\n #print(key,ans)\n\n return ans\n\n\n\nprint((getans(\"\",s,\"\")*2))\n\n\n\n#print(len(memo))\n","target":"\n\nimport sys\n\n#sys.stdin=open(\"data.txt\")\n\ninput=sys.stdin.readline\n\n\n\nn=int(eval(input()))\n\ns=input().strip()\n\n\n\nmemo={}\n\ndef getans(a,b,c):\n\n while a and c and a[0]==c[-1]:\n\n a=a[1:]\n\n c=c[:-1]\n\n if a and c: return 0\n\n if b==\"\":\n\n if a==\"\" and c==\"\": return 1\n\n else: return 0\n\n key=a+\"\/\"+b+\"\/\"+c\n\n if key in memo: return memo[key]\n\n # select first letter\n\n ans=0\n\n for i in range(1,len(b)):\n\n if b[0]==b[i]:\n\n ans+=getans(a,b[1:i],b[i+1:]+c)\n\n # don't select first letter\n\n ans+=getans(a+b[0],b[1:],c)\n\n memo[key]=ans\n\n #print(key,ans)\n\n return ans\n\n\n\nprint((getans(\"\",s,\"\")*2))\n\n\n\n#print(len(memo))\n","code_v0_loc":32,"code_v1_loc":33,"code_v0_num_chars":654,"code_v1_num_chars":680,"code_v0_no_empty_lines":"import sys\n\n# sys.stdin=open(\"data.txt\")\ninput = sys.stdin.readline\nn = int(eval(input()))\ns = input().strip()\nmemo = {}\n\n\ndef getans(a, b, c):\n while a and c and a[0] == c[-1]:\n a = a[1:]\n c = c[:-1]\n if b == \"\":\n if a == \"\" and c == \"\":\n return 1\n else:\n return 0\n key = a + \"\/\" + b + \"\/\" + c\n if key in memo:\n return memo[key]\n # select first letter\n ans = 0\n for i in range(1, len(b)):\n if b[0] == b[i]:\n ans += getans(a, b[1:i], b[i + 1 :] + c)\n # don't select first letter\n ans += getans(a + b[0], b[1:], c)\n memo[key] = ans\n # print(key,ans)\n return ans\n\n\nprint((getans(\"\", s, \"\") * 2))\n# print(len(memo))\n","code_v1_no_empty_lines":"import sys\n\n# sys.stdin=open(\"data.txt\")\ninput = sys.stdin.readline\nn = int(eval(input()))\ns = input().strip()\nmemo = {}\n\n\ndef getans(a, b, c):\n while a and c and a[0] == c[-1]:\n a = a[1:]\n c = c[:-1]\n if a and c:\n return 0\n if b == \"\":\n if a == \"\" and c == \"\":\n return 1\n else:\n return 0\n key = a + \"\/\" + b + \"\/\" + c\n if key in memo:\n return memo[key]\n # select first letter\n ans = 0\n for i in range(1, len(b)):\n if b[0] == b[i]:\n ans += getans(a, b[1:i], b[i + 1 :] + c)\n # don't select first letter\n ans += getans(a + b[0], b[1:], c)\n memo[key] = ans\n # print(key,ans)\n return ans\n\n\nprint((getans(\"\", s, \"\") * 2))\n# print(len(memo))\n","code_same":false,"relative_loc_diff_percent":3.0303030303,"diff":["+ if a and c:","+ return 0"],"diff_only_import_comment":false,"measured_runtime_v0":0.1670867405,"measured_runtime_v1":0.0797748501,"runtime_lift":2.0944789016,"key":["s047471981","s035522830"]} +{"user_id":"u072717685","problem_id":"p03044","language":"python","submission_id_v0":"s537401411","submission_id_v1":"s015231329","cpu_time_v0":1445,"cpu_time_v1":492,"memory_v0":120036,"memory_v1":103876,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":65.95,"input":"from copy import deepcopy\n\nfrom collections import deque\n\ndef main():\n\n def find(x):\n\n if par[x] < 0:\n\n return x\n\n else:\n\n par[x] = find(par[x])\n\n return par[x]\n\n def unite(x, y):\n\n x = find(x)\n\n y = find(y)\n\n if x == y:\n\n return False\n\n else:\n\n if par[x] > par[y]:\n\n x, y = y, x\n\n par[x] += par[y]\n\n par[y] = x\n\n return True\n\n def roots():\n\n return [i for i, x in enumerate(par) if x < 0]\n\n\n\n n = int(input())\n\n par = [-1] * n\n\n uvw = {e:[] for e in range(n)}\n\n\n\n for _ in range(n - 1):\n\n u, v, w = map(int, input().split())\n\n u -= 1\n\n v -= 1\n\n uvw[u].append((u, v, w))\n\n uvw[v].append((v, u, w))\n\n unite(u, v)\n\n root_node = roots()[0]\n\n color = [-1] * n\n\n color[root_node] = 0\n\n node_next = deque()\n\n node_next.append(root_node)\n\n node_next_next = deque()\n\n node_seen = set()\n\n\n\n while len(node_seen) < n:\n\n while node_next:\n\n node_togo = node_next.popleft()\n\n if node_togo in node_seen:\n\n continue\n\n else:\n\n node_seen.add(node_togo)\n\n # \u6b21\u306e\u5c64\u306e\u30ce\u30fc\u30c9\u7fa4\u60c5\u5831\u3092\u53d6\u5f97\u3057\u3001\u300c\u6b21\u306b\u307f\u308b\u30ce\u30fc\u30c9list\u300d\u306b\u3044\u308c\u308b\u3002\n\n node_adj = uvw[node_togo]\n\n node_next_next += [i[1] for i in node_adj]\n\n # \u6b21\u306e\u5c64\u3092\u51e6\u7406\uff1d\u8272\u5857\u308a\u3059\u308b\n\n for adj in node_adj:\n\n if adj[1] in node_seen or color[adj[1]] != -1:\n\n continue\n\n if adj[2] % 2 == 0:\n\n color[adj[1]] = color[node_togo]\n\n else:\n\n color[adj[1]] = color[node_togo] ^ 1\n\n node_next = deepcopy(node_next_next)\n\n node_next_next = deque()\n\n print(*color, sep='\\n')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import sys\n\nsys.setrecursionlimit(10**6)\n\nread = sys.stdin.read\n\nreadlines = sys.stdin.readlines\n\ndef main():\n\n def dfs(node):\n\n for adjnode in edges[node]:\n\n if colors[adjnode[0]] == -1:\n\n if adjnode[1] % 2 == 0:\n\n colors[adjnode[0]] = colors[node]\n\n else:\n\n colors[adjnode[0]] = colors[node] ^ 1\n\n dfs(adjnode[0])\n\n # input\n\n n = int(input())\n\n edges = {e: [] for e in range(n)}\n\n for _ in range(n - 1):\n\n u, v, w = map(int, input().split())\n\n u -= 1\n\n v -= 1\n\n edges[u].append((v, w))\n\n edges[v].append((u, w))\n\n # process\n\n colors = [-1] * n\n\n colors[0] = 0\n\n dfs(0)\n\n # output\n\n print(*colors, sep='\\n')\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":67,"code_v1_loc":32,"code_v0_num_chars":1870,"code_v1_num_chars":822,"code_v0_no_empty_lines":"from copy import deepcopy\nfrom collections import deque\n\n\ndef main():\n def find(x):\n if par[x] < 0:\n return x\n else:\n par[x] = find(par[x])\n return par[x]\n\n def unite(x, y):\n x = find(x)\n y = find(y)\n if x == y:\n return False\n else:\n if par[x] > par[y]:\n x, y = y, x\n par[x] += par[y]\n par[y] = x\n return True\n\n def roots():\n return [i for i, x in enumerate(par) if x < 0]\n\n n = int(input())\n par = [-1] * n\n uvw = {e: [] for e in range(n)}\n for _ in range(n - 1):\n u, v, w = map(int, input().split())\n u -= 1\n v -= 1\n uvw[u].append((u, v, w))\n uvw[v].append((v, u, w))\n unite(u, v)\n root_node = roots()[0]\n color = [-1] * n\n color[root_node] = 0\n node_next = deque()\n node_next.append(root_node)\n node_next_next = deque()\n node_seen = set()\n while len(node_seen) < n:\n while node_next:\n node_togo = node_next.popleft()\n if node_togo in node_seen:\n continue\n else:\n node_seen.add(node_togo)\n # \u6b21\u306e\u5c64\u306e\u30ce\u30fc\u30c9\u7fa4\u60c5\u5831\u3092\u53d6\u5f97\u3057\u3001\u300c\u6b21\u306b\u307f\u308b\u30ce\u30fc\u30c9list\u300d\u306b\u3044\u308c\u308b\u3002\n node_adj = uvw[node_togo]\n node_next_next += [i[1] for i in node_adj]\n # \u6b21\u306e\u5c64\u3092\u51e6\u7406\uff1d\u8272\u5857\u308a\u3059\u308b\n for adj in node_adj:\n if adj[1] in node_seen or color[adj[1]] != -1:\n continue\n if adj[2] % 2 == 0:\n color[adj[1]] = color[node_togo]\n else:\n color[adj[1]] = color[node_togo] ^ 1\n node_next = deepcopy(node_next_next)\n node_next_next = deque()\n print(*color, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nsys.setrecursionlimit(10**6)\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\n\n\ndef main():\n def dfs(node):\n for adjnode in edges[node]:\n if colors[adjnode[0]] == -1:\n if adjnode[1] % 2 == 0:\n colors[adjnode[0]] = colors[node]\n else:\n colors[adjnode[0]] = colors[node] ^ 1\n dfs(adjnode[0])\n\n # input\n n = int(input())\n edges = {e: [] for e in range(n)}\n for _ in range(n - 1):\n u, v, w = map(int, input().split())\n u -= 1\n v -= 1\n edges[u].append((v, w))\n edges[v].append((u, w))\n # process\n colors = [-1] * n\n colors[0] = 0\n dfs(0)\n # output\n print(*colors, sep=\"\\n\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":52.2388059701,"diff":["-from copy import deepcopy","-from collections import deque","+import sys","+","+sys.setrecursionlimit(10**6)","+read = sys.stdin.read","+readlines = sys.stdin.readlines","- def find(x):","- if par[x] < 0:","- return x","- else:","- par[x] = find(par[x])","- return par[x]","+ def dfs(node):","+ for adjnode in edges[node]:","+ if colors[adjnode[0]] == -1:","+ if adjnode[1] % 2 == 0:","+ colors[adjnode[0]] = colors[node]","+ else:","+ colors[adjnode[0]] = colors[node] ^ 1","+ dfs(adjnode[0])","- def unite(x, y):","- x = find(x)","- y = find(y)","- if x == y:","- return False","- else:","- if par[x] > par[y]:","- x, y = y, x","- par[x] += par[y]","- par[y] = x","- return True","-","- def roots():","- return [i for i, x in enumerate(par) if x < 0]","-","+ # input","- par = [-1] * n","- uvw = {e: [] for e in range(n)}","+ edges = {e: [] for e in range(n)}","- uvw[u].append((u, v, w))","- uvw[v].append((v, u, w))","- unite(u, v)","- root_node = roots()[0]","- color = [-1] * n","- color[root_node] = 0","- node_next = deque()","- node_next.append(root_node)","- node_next_next = deque()","- node_seen = set()","- while len(node_seen) < n:","- while node_next:","- node_togo = node_next.popleft()","- if node_togo in node_seen:","- continue","- else:","- node_seen.add(node_togo)","- # \u6b21\u306e\u5c64\u306e\u30ce\u30fc\u30c9\u7fa4\u60c5\u5831\u3092\u53d6\u5f97\u3057\u3001\u300c\u6b21\u306b\u307f\u308b\u30ce\u30fc\u30c9list\u300d\u306b\u3044\u308c\u308b\u3002","- node_adj = uvw[node_togo]","- node_next_next += [i[1] for i in node_adj]","- # \u6b21\u306e\u5c64\u3092\u51e6\u7406\uff1d\u8272\u5857\u308a\u3059\u308b","- for adj in node_adj:","- if adj[1] in node_seen or color[adj[1]] != -1:","- continue","- if adj[2] % 2 == 0:","- color[adj[1]] = color[node_togo]","- else:","- color[adj[1]] = color[node_togo] ^ 1","- node_next = deepcopy(node_next_next)","- node_next_next = deque()","- print(*color, sep=\"\\n\")","+ edges[u].append((v, w))","+ edges[v].append((u, w))","+ # process","+ colors = [-1] * n","+ colors[0] = 0","+ dfs(0)","+ # output","+ print(*colors, sep=\"\\n\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0401458388,"measured_runtime_v1":0.0431402752,"runtime_lift":0.9305883791,"key":["s537401411","s015231329"]} +{"user_id":"u021548497","problem_id":"p02788","language":"python","submission_id_v0":"s388569231","submission_id_v1":"s530075332","cpu_time_v0":1561,"cpu_time_v1":959,"memory_v0":41748,"memory_v1":41868,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":38.57,"input":"import bisect\n\nn, d, a = list(map(int, input().split()))\n\nfox = [None]*n\n\nfor i in range(n):\n\n x, h = list(map(int, input().split()))\n\n fox[i] = (x, h)\n\n\n\nfox.sort()\n\nx = [int(fox[i][0]) for i in range(n)]\n\nh = [int(fox[i][1]) for i in range(n)]\n\n\n\nans = 0\n\nbit = [0]*n\n\nfor i in range(n):\n\n if i != 0:\n\n bit[i] += bit[i-1]\n\n if bit[i] >= h[i]:\n\n continue\n\n sub = (h[i]-bit[i]-1)\/\/a+1\n\n ans += sub\n\n bit[i] += sub*a\n\n index = bisect.bisect_right(x, x[i]+2*d)\n\n if index == n:\n\n continue\n\n bit[index] -= sub*a\n\nprint(ans)","target":"import bisect\n\nimport sys\n\n\n\ndef main():\n\n input = sys.stdin.readline\n\n n, d, a = list(map(int, input().split()))\n\n fox = [None]*n\n\n for i in range(n):\n\n x, h = list(map(int, input().split()))\n\n fox[i] = (x, h)\n\n\n\n fox.sort()\n\n x = [int(fox[i][0]) for i in range(n)]\n\n h = [int(fox[i][1]) for i in range(n)]\n\n\n\n ans = 0\n\n bit = [0]*n\n\n for i in range(n):\n\n if i != 0:\n\n bit[i] += bit[i-1]\n\n sub = max([(h[i]-bit[i]-1)\/\/a+1, 0])\n\n ans += sub\n\n bit[i] += sub*a\n\n index = bisect.bisect_right(x, x[i]+2*d)\n\n if index != n:\n\n bit[index] -= sub*a\n\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":26,"code_v1_loc":30,"code_v0_num_chars":527,"code_v1_num_chars":626,"code_v0_no_empty_lines":"import bisect\n\nn, d, a = list(map(int, input().split()))\nfox = [None] * n\nfor i in range(n):\n x, h = list(map(int, input().split()))\n fox[i] = (x, h)\nfox.sort()\nx = [int(fox[i][0]) for i in range(n)]\nh = [int(fox[i][1]) for i in range(n)]\nans = 0\nbit = [0] * n\nfor i in range(n):\n if i != 0:\n bit[i] += bit[i - 1]\n if bit[i] >= h[i]:\n continue\n sub = (h[i] - bit[i] - 1) \/\/ a + 1\n ans += sub\n bit[i] += sub * a\n index = bisect.bisect_right(x, x[i] + 2 * d)\n if index == n:\n continue\n bit[index] -= sub * a\nprint(ans)\n","code_v1_no_empty_lines":"import bisect\nimport sys\n\n\ndef main():\n input = sys.stdin.readline\n n, d, a = list(map(int, input().split()))\n fox = [None] * n\n for i in range(n):\n x, h = list(map(int, input().split()))\n fox[i] = (x, h)\n fox.sort()\n x = [int(fox[i][0]) for i in range(n)]\n h = [int(fox[i][1]) for i in range(n)]\n ans = 0\n bit = [0] * n\n for i in range(n):\n if i != 0:\n bit[i] += bit[i - 1]\n sub = max([(h[i] - bit[i] - 1) \/\/ a + 1, 0])\n ans += sub\n bit[i] += sub * a\n index = bisect.bisect_right(x, x[i] + 2 * d)\n if index != n:\n bit[index] -= sub * a\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":13.3333333333,"diff":["+import sys","-n, d, a = list(map(int, input().split()))","-fox = [None] * n","-for i in range(n):","- x, h = list(map(int, input().split()))","- fox[i] = (x, h)","-fox.sort()","-x = [int(fox[i][0]) for i in range(n)]","-h = [int(fox[i][1]) for i in range(n)]","-ans = 0","-bit = [0] * n","-for i in range(n):","- if i != 0:","- bit[i] += bit[i - 1]","- if bit[i] >= h[i]:","- continue","- sub = (h[i] - bit[i] - 1) \/\/ a + 1","- ans += sub","- bit[i] += sub * a","- index = bisect.bisect_right(x, x[i] + 2 * d)","- if index == n:","- continue","- bit[index] -= sub * a","-print(ans)","+","+def main():","+ input = sys.stdin.readline","+ n, d, a = list(map(int, input().split()))","+ fox = [None] * n","+ for i in range(n):","+ x, h = list(map(int, input().split()))","+ fox[i] = (x, h)","+ fox.sort()","+ x = [int(fox[i][0]) for i in range(n)]","+ h = [int(fox[i][1]) for i in range(n)]","+ ans = 0","+ bit = [0] * n","+ for i in range(n):","+ if i != 0:","+ bit[i] += bit[i - 1]","+ sub = max([(h[i] - bit[i] - 1) \/\/ a + 1, 0])","+ ans += sub","+ bit[i] += sub * a","+ index = bisect.bisect_right(x, x[i] + 2 * d)","+ if index != n:","+ bit[index] -= sub * a","+ print(ans)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0554721429,"measured_runtime_v1":0.0559210513,"runtime_lift":0.9919724624,"key":["s388569231","s530075332"]} +{"user_id":"u246401133","problem_id":"p02676","language":"python","submission_id_v0":"s530267211","submission_id_v1":"s723596023","cpu_time_v0":31,"cpu_time_v1":26,"memory_v0":9028,"memory_v1":9140,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.13,"input":"k = int(eval(input()))\n\ns = eval(input())\n\nif len(s) <= k:\n\n print(s)\n\nelse:\n\n print((s[0:k] + \"...\"))","target":"k = int(input())\n\ns = input()\n\nif len(s) <= k:\n\n print(s)\n\nelse:\n\n S = s[:k]\n\n print(S, end=\"\")\n\n print(\"...\")\n","code_v0_loc":6,"code_v1_loc":8,"code_v0_num_chars":94,"code_v1_num_chars":122,"code_v0_no_empty_lines":"k = int(eval(input()))\ns = eval(input())\nif len(s) <= k:\n print(s)\nelse:\n print((s[0:k] + \"...\"))\n","code_v1_no_empty_lines":"k = int(input())\ns = input()\nif len(s) <= k:\n print(s)\nelse:\n S = s[:k]\n print(S, end=\"\")\n print(\"...\")\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-k = int(eval(input()))","-s = eval(input())","+k = int(input())","+s = input()","- print((s[0:k] + \"...\"))","+ S = s[:k]","+ print(S, end=\"\")","+ print(\"...\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.1130186228,"measured_runtime_v1":0.0371020754,"runtime_lift":3.0461536583,"key":["s530267211","s723596023"]} +{"user_id":"u197955752","problem_id":"p03557","language":"python","submission_id_v0":"s868696639","submission_id_v1":"s274441261","cpu_time_v0":1673,"cpu_time_v1":356,"memory_v0":24220,"memory_v1":23232,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":78.72,"input":"N = int(eval(input()))\n\nA = [int(x) for x in input().split()]\n\nB = [int(x) for x in input().split()]\n\nC = [int(x) for x in input().split()]\n\n\n\nA.sort()\n\nB.sort()\n\nC.sort()\n\nB += [10 ** 9 + 1] + [0] # B[-1] = 0, B[N] = 10**9 + 1\u3068\u306a\u308b\u3088\u3046\u306b\u3059\u308b\n\nC += [10 ** 9 + 1] + [0] # C[-1] = 0, C[N] = 10**9 + 1\u3068\u306a\u308b\u3088\u3046\u306b\u3059\u308b\n\n\n\n# For each j = 0, 1, ..., N-1,\n\n# find k such that B[j] < C[k] and (C[k-1] <= B[j] or k = 0)\n\n# Let K[j] = k for such k.\n\n# If such k doesn't exist, let K[j] := N\n\nK = [0] * N\n\n\n\nfor j in range(N):\n\n ng = -1 # C[ng] <= B[j]\n\n ok = N # B[j] < C[ok]\n\n while ok - ng > 1:\n\n mid = (ok + ng) \/\/ 2\n\n if B[j] < C[mid]:\n\n ok = mid\n\n else:\n\n ng = mid\n\n K[j] = ok\n\n\n\n# Let\n\n# f[j] := B[j]\u3088\u308a\u5927\u304d\u3044C[k]\u306e\u6570 + B[j + 1]\u3088\u308a\u5927\u304d\u3044C[k]\u306e\u6570\n\n# ... + B[N-1]\u3088\u308a\u5927\u304d\u3044C[k]\u306e\u6570\n\nf = [0] * (N - 1) + [N - K[N - 1]]\n\nfor j in range(N - 2, -1, -1):\n\n f[j] = f[j + 1] + N - K[j]\n\n\n\nans = 0\n\nfor i in range(N):\n\n # find j such that B[j - 1] <= A[i] < B[j]\n\n ng = -1 # B[ng] <= A[i]\n\n ok = N # A[i] < B[ok]\n\n while ok - ng > 1:\n\n mid = (ok + ng) \/\/ 2\n\n if A[i] < B[mid]:\n\n ok = mid\n\n else:\n\n ng = mid\n\n if ok >= N: continue\n\n # 0 <= ok <= N - 1\n\n ans += f[ok]\n\n\n\nprint(ans)","target":"import bisect\n\n\n\nN = int(eval(input()))\n\nA = [int(x) for x in input().split()]\n\nB = [int(x) for x in input().split()]\n\nC = [int(x) for x in input().split()]\n\n\n\nA.sort()\n\nB.sort()\n\nC.sort()\n\n\n\nans = 0\n\nfor j in range(N):\n\n i = bisect.bisect_left(A, B[j])\n\n k = bisect.bisect_right(C, B[j])\n\n ans += i * (N - k)\n\n\n\nprint(ans)","code_v0_loc":51,"code_v1_loc":18,"code_v0_num_chars":1267,"code_v1_num_chars":326,"code_v0_no_empty_lines":"N = int(eval(input()))\nA = [int(x) for x in input().split()]\nB = [int(x) for x in input().split()]\nC = [int(x) for x in input().split()]\nA.sort()\nB.sort()\nC.sort()\nB += [10**9 + 1] + [0] # B[-1] = 0, B[N] = 10**9 + 1\u3068\u306a\u308b\u3088\u3046\u306b\u3059\u308b\nC += [10**9 + 1] + [0] # C[-1] = 0, C[N] = 10**9 + 1\u3068\u306a\u308b\u3088\u3046\u306b\u3059\u308b\n# For each j = 0, 1, ..., N-1,\n# find k such that B[j] < C[k] and (C[k-1] <= B[j] or k = 0)\n# Let K[j] = k for such k.\n# If such k doesn't exist, let K[j] := N\nK = [0] * N\nfor j in range(N):\n ng = -1 # C[ng] <= B[j]\n ok = N # B[j] < C[ok]\n while ok - ng > 1:\n mid = (ok + ng) \/\/ 2\n if B[j] < C[mid]:\n ok = mid\n else:\n ng = mid\n K[j] = ok\n# Let\n# f[j] := B[j]\u3088\u308a\u5927\u304d\u3044C[k]\u306e\u6570 + B[j + 1]\u3088\u308a\u5927\u304d\u3044C[k]\u306e\u6570\n# ... + B[N-1]\u3088\u308a\u5927\u304d\u3044C[k]\u306e\u6570\nf = [0] * (N - 1) + [N - K[N - 1]]\nfor j in range(N - 2, -1, -1):\n f[j] = f[j + 1] + N - K[j]\nans = 0\nfor i in range(N):\n # find j such that B[j - 1] <= A[i] < B[j]\n ng = -1 # B[ng] <= A[i]\n ok = N # A[i] < B[ok]\n while ok - ng > 1:\n mid = (ok + ng) \/\/ 2\n if A[i] < B[mid]:\n ok = mid\n else:\n ng = mid\n if ok >= N:\n continue\n # 0 <= ok <= N - 1\n ans += f[ok]\nprint(ans)\n","code_v1_no_empty_lines":"import bisect\n\nN = int(eval(input()))\nA = [int(x) for x in input().split()]\nB = [int(x) for x in input().split()]\nC = [int(x) for x in input().split()]\nA.sort()\nB.sort()\nC.sort()\nans = 0\nfor j in range(N):\n i = bisect.bisect_left(A, B[j])\n k = bisect.bisect_right(C, B[j])\n ans += i * (N - k)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":64.7058823529,"diff":["+import bisect","+","-B += [10**9 + 1] + [0] # B[-1] = 0, B[N] = 10**9 + 1\u3068\u306a\u308b\u3088\u3046\u306b\u3059\u308b","-C += [10**9 + 1] + [0] # C[-1] = 0, C[N] = 10**9 + 1\u3068\u306a\u308b\u3088\u3046\u306b\u3059\u308b","-# For each j = 0, 1, ..., N-1,","-# find k such that B[j] < C[k] and (C[k-1] <= B[j] or k = 0)","-# Let K[j] = k for such k.","-# If such k doesn't exist, let K[j] := N","-K = [0] * N","+ans = 0","- ng = -1 # C[ng] <= B[j]","- ok = N # B[j] < C[ok]","- while ok - ng > 1:","- mid = (ok + ng) \/\/ 2","- if B[j] < C[mid]:","- ok = mid","- else:","- ng = mid","- K[j] = ok","-# Let","-# f[j] := B[j]\u3088\u308a\u5927\u304d\u3044C[k]\u306e\u6570 + B[j + 1]\u3088\u308a\u5927\u304d\u3044C[k]\u306e\u6570","-# ... + B[N-1]\u3088\u308a\u5927\u304d\u3044C[k]\u306e\u6570","-f = [0] * (N - 1) + [N - K[N - 1]]","-for j in range(N - 2, -1, -1):","- f[j] = f[j + 1] + N - K[j]","-ans = 0","-for i in range(N):","- # find j such that B[j - 1] <= A[i] < B[j]","- ng = -1 # B[ng] <= A[i]","- ok = N # A[i] < B[ok]","- while ok - ng > 1:","- mid = (ok + ng) \/\/ 2","- if A[i] < B[mid]:","- ok = mid","- else:","- ng = mid","- if ok >= N:","- continue","- # 0 <= ok <= N - 1","- ans += f[ok]","+ i = bisect.bisect_left(A, B[j])","+ k = bisect.bisect_right(C, B[j])","+ ans += i * (N - k)"],"diff_only_import_comment":false,"measured_runtime_v0":0.045152092,"measured_runtime_v1":0.0417233467,"runtime_lift":1.0821780976,"key":["s868696639","s274441261"]} +{"user_id":"u043844098","problem_id":"p03290","language":"python","submission_id_v0":"s706493592","submission_id_v1":"s863118218","cpu_time_v0":89,"cpu_time_v1":81,"memory_v0":10408,"memory_v1":10212,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.99,"input":"import copy\n\n\n\nfrom typing import List, Tuple\n\n\n\n\n\ndef main():\n\n d, g = list(map(int, input().split()))\n\n v = []\n\n for _ in range(d):\n\n p, c = list(map(int, input().split()))\n\n v.append((p, c))\n\n\n\n print((ag(v, g)))\n\n\n\n\n\ndef ag(v: List[Tuple[int, int]], g: int) -> int:\n\n # ex. [(3, 500), (5, 800)] -> [(1, 3, 500), (2, 5, 800)]\n\n v = [(i, p, c) for i, (p, c) in enumerate(v, 1)]\n\n\n\n result = 100 ** 10\n\n for j in range(2 ** len(v)):\n\n cb = []\n\n for k in range(len(v)):\n\n if ((j >> k) & 1):\n\n cb.append(v[k])\n\n\n\n sc = 0\n\n cnt = 0\n\n # calc bonus score\n\n for (i, p, c) in cb:\n\n sc += i * 100 * p + c\n\n cnt += p\n\n\n\n for idx in reversed(list(range(len(v)))):\n\n if sc >= g:\n\n break\n\n if v[idx] in cb:\n\n continue\n\n i, p, _ = v[idx]\n\n for _ in range(p - 1):\n\n if sc >= g:\n\n break\n\n sc += i * 100\n\n cnt += 1\n\n\n\n if sc >= g:\n\n result = min(result, cnt)\n\n return result\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"import itertools\n\nfrom typing import List, Tuple\n\n\n\n\n\ndef main():\n\n d, g = list(map(int, input().split()))\n\n v = []\n\n for _ in range(d):\n\n p, c = list(map(int, input().split()))\n\n v.append((p, c))\n\n\n\n print((ag(v, g)))\n\n\n\n\n\ndef ag(v: List[Tuple[int, int]], g: int) -> int:\n\n # ex. [(3, 500), (5, 800)] -> [(1, 3, 500), (2, 5, 800)]\n\n v = [(i + 1, v[i][0], v[i][1]) for i in range(len(v))]\n\n\n\n result = 100 ** 10\n\n\n\n for j in range(len(v) + 1):\n\n for cb in itertools.combinations(v, j):\n\n sc = 0\n\n cnt = 0\n\n # calc bonus score\n\n for (i, p, c) in cb:\n\n sc += i * 100 * p + c\n\n cnt += p\n\n\n\n for idx in reversed(list(range(len(v)))):\n\n if sc >= g:\n\n break\n\n if v[idx] in cb:\n\n continue\n\n i, p, _ = v[idx]\n\n for _ in range(p - 1):\n\n if sc >= g:\n\n break\n\n sc += i * 100\n\n cnt += 1\n\n\n\n if sc >= g:\n\n result = min(result, cnt)\n\n return result\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":52,"code_v1_loc":48,"code_v0_num_chars":1178,"code_v1_num_chars":1196,"code_v0_no_empty_lines":"import copy\nfrom typing import List, Tuple\n\n\ndef main():\n d, g = list(map(int, input().split()))\n v = []\n for _ in range(d):\n p, c = list(map(int, input().split()))\n v.append((p, c))\n print((ag(v, g)))\n\n\ndef ag(v: List[Tuple[int, int]], g: int) -> int:\n # ex. [(3, 500), (5, 800)] -> [(1, 3, 500), (2, 5, 800)]\n v = [(i, p, c) for i, (p, c) in enumerate(v, 1)]\n result = 100**10\n for j in range(2 ** len(v)):\n cb = []\n for k in range(len(v)):\n if (j >> k) & 1:\n cb.append(v[k])\n sc = 0\n cnt = 0\n # calc bonus score\n for (i, p, c) in cb:\n sc += i * 100 * p + c\n cnt += p\n for idx in reversed(list(range(len(v)))):\n if sc >= g:\n break\n if v[idx] in cb:\n continue\n i, p, _ = v[idx]\n for _ in range(p - 1):\n if sc >= g:\n break\n sc += i * 100\n cnt += 1\n if sc >= g:\n result = min(result, cnt)\n return result\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import itertools\nfrom typing import List, Tuple\n\n\ndef main():\n d, g = list(map(int, input().split()))\n v = []\n for _ in range(d):\n p, c = list(map(int, input().split()))\n v.append((p, c))\n print((ag(v, g)))\n\n\ndef ag(v: List[Tuple[int, int]], g: int) -> int:\n # ex. [(3, 500), (5, 800)] -> [(1, 3, 500), (2, 5, 800)]\n v = [(i + 1, v[i][0], v[i][1]) for i in range(len(v))]\n result = 100**10\n for j in range(len(v) + 1):\n for cb in itertools.combinations(v, j):\n sc = 0\n cnt = 0\n # calc bonus score\n for (i, p, c) in cb:\n sc += i * 100 * p + c\n cnt += p\n for idx in reversed(list(range(len(v)))):\n if sc >= g:\n break\n if v[idx] in cb:\n continue\n i, p, _ = v[idx]\n for _ in range(p - 1):\n if sc >= g:\n break\n sc += i * 100\n cnt += 1\n if sc >= g:\n result = min(result, cnt)\n return result\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":7.6923076923,"diff":["-import copy","+import itertools","- v = [(i, p, c) for i, (p, c) in enumerate(v, 1)]","+ v = [(i + 1, v[i][0], v[i][1]) for i in range(len(v))]","- for j in range(2 ** len(v)):","- cb = []","- for k in range(len(v)):","- if (j >> k) & 1:","- cb.append(v[k])","- sc = 0","- cnt = 0","- # calc bonus score","- for (i, p, c) in cb:","- sc += i * 100 * p + c","- cnt += p","- for idx in reversed(list(range(len(v)))):","- if sc >= g:","- break","- if v[idx] in cb:","- continue","- i, p, _ = v[idx]","- for _ in range(p - 1):","+ for j in range(len(v) + 1):","+ for cb in itertools.combinations(v, j):","+ sc = 0","+ cnt = 0","+ # calc bonus score","+ for (i, p, c) in cb:","+ sc += i * 100 * p + c","+ cnt += p","+ for idx in reversed(list(range(len(v)))):","- sc += i * 100","- cnt += 1","- if sc >= g:","- result = min(result, cnt)","+ if v[idx] in cb:","+ continue","+ i, p, _ = v[idx]","+ for _ in range(p - 1):","+ if sc >= g:","+ break","+ sc += i * 100","+ cnt += 1","+ if sc >= g:","+ result = min(result, cnt)"],"diff_only_import_comment":false,"measured_runtime_v0":0.050257905,"measured_runtime_v1":0.0506085174,"runtime_lift":0.9930720671,"key":["s706493592","s863118218"]} +{"user_id":"u163320134","problem_id":"p02642","language":"python","submission_id_v0":"s889314911","submission_id_v1":"s353132566","cpu_time_v0":907,"cpu_time_v1":287,"memory_v0":103248,"memory_v1":219808,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":68.36,"input":"import collections\n\n\n\nn=int(eval(input()))\n\narr=list(map(int,input().split()))\n\narr=sorted(arr)\n\ns=set()\n\ncnt=collections.Counter(arr)\n\nfor i in range(n):\n\n if arr[i] in s:\n\n continue\n\n if cnt[arr[i]]>=2:\n\n s.add(arr[i])\n\n for j in range(2,10**6\/\/arr[i]+1):\n\n s.add(arr[i]*j)\n\nans=0\n\nfor i in range(n):\n\n if arr[i] in s:\n\n continue\n\n if cnt[arr[i]]>=2:\n\n continue\n\n ans+=1\n\nprint(ans)\n","target":"import collections\n\n\n\nn=int(eval(input()))\n\narr=list(map(int,input().split()))\n\narr=sorted(arr)\n\ns=set()\n\ncnt=collections.Counter(arr)\n\nfor i in range(n):\n\n if arr[i] in s:\n\n continue\n\n if cnt[arr[i]]>=2:\n\n s.add(arr[i])\n\n for j in range(2,10**6\/\/arr[i]+1):\n\n s.add(arr[i]*j)\n\nans=0\n\nfor i in range(n):\n\n if arr[i] in s:\n\n continue\n\n ans+=1\n\nprint(ans)","code_v0_loc":22,"code_v1_loc":20,"code_v0_num_chars":400,"code_v1_num_chars":363,"code_v0_no_empty_lines":"import collections\n\nn = int(eval(input()))\narr = list(map(int, input().split()))\narr = sorted(arr)\ns = set()\ncnt = collections.Counter(arr)\nfor i in range(n):\n if arr[i] in s:\n continue\n if cnt[arr[i]] >= 2:\n s.add(arr[i])\n for j in range(2, 10**6 \/\/ arr[i] + 1):\n s.add(arr[i] * j)\nans = 0\nfor i in range(n):\n if arr[i] in s:\n continue\n if cnt[arr[i]] >= 2:\n continue\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"import collections\n\nn = int(eval(input()))\narr = list(map(int, input().split()))\narr = sorted(arr)\ns = set()\ncnt = collections.Counter(arr)\nfor i in range(n):\n if arr[i] in s:\n continue\n if cnt[arr[i]] >= 2:\n s.add(arr[i])\n for j in range(2, 10**6 \/\/ arr[i] + 1):\n s.add(arr[i] * j)\nans = 0\nfor i in range(n):\n if arr[i] in s:\n continue\n ans += 1\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":9.0909090909,"diff":["- if cnt[arr[i]] >= 2:","- continue"],"diff_only_import_comment":false,"measured_runtime_v0":0.5018581514,"measured_runtime_v1":0.7098455646,"runtime_lift":0.7069962488,"key":["s889314911","s353132566"]} +{"user_id":"u688587139","problem_id":"p02830","language":"python","submission_id_v0":"s533694152","submission_id_v1":"s563500967","cpu_time_v0":66,"cpu_time_v1":61,"memory_v0":64860,"memory_v1":62160,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.58,"input":"from collections import deque\n\n\n\nN = int(input())\n\nS, T = input().split()\n\n\n\nchar = deque()\n\n\n\nfor i in range(N):\n\n char.append(S[i])\n\n char.append(T[i])\n\n\n\nprint(*char, sep='')\n","target":"N = int(input())\n\nS, T = input().split()\n\nchar = []\n\n\n\nfor i in range(N):\n\n char.append(S[i])\n\n char.append(T[i])\n\n\n\nprint(*char, sep='')\n","code_v0_loc":12,"code_v1_loc":9,"code_v0_num_chars":184,"code_v1_num_chars":144,"code_v0_no_empty_lines":"from collections import deque\n\nN = int(input())\nS, T = input().split()\nchar = deque()\nfor i in range(N):\n char.append(S[i])\n char.append(T[i])\nprint(*char, sep=\"\")\n","code_v1_no_empty_lines":"N = int(input())\nS, T = input().split()\nchar = []\nfor i in range(N):\n char.append(S[i])\n char.append(T[i])\nprint(*char, sep=\"\")\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-from collections import deque","-","-char = deque()","+char = []"],"diff_only_import_comment":false,"measured_runtime_v0":0.0380390151,"measured_runtime_v1":0.0377166176,"runtime_lift":1.008547889,"key":["s533694152","s563500967"]} +{"user_id":"u075595666","problem_id":"p03476","language":"python","submission_id_v0":"s453000321","submission_id_v1":"s067141505","cpu_time_v0":1433,"cpu_time_v1":526,"memory_v0":8188,"memory_v1":5520,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":63.29,"input":"import math\n\ndef eratosthenes(limit):\n\n A = [i for i in range(2, limit+1)]\n\n P = []\n\n while True:\n\n prime = min(A)\n\n if prime > math.sqrt(limit):\n\n break\n\n P.append(prime)\n\n i = 0\n\n while i < len(A):\n\n if A[i] % prime == 0:\n\n A.pop(i)\n\n continue\n\n i += 1\n\n for a in A:\n\n P.append(a)\n\n return list(P)\n\n\n\na = eratosthenes(100000)\n\nb = set([2*i-1 for i in a])\n\na = set(a)\n\nchk = sorted(list(a&b))\n\n\n\nfrom bisect import bisect,bisect_left\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nq = int(eval(input()))\n\nfor i in range(q):\n\n l,r = list(map(int,input().split()))\n\n print((bisect(chk,r)-bisect_left(chk,l)))","target":"def is_prime(q):\n\n if q == 2: return True\n\n if q < 2 or q&1 == 0: return False\n\n return pow(5, q-1, q)*pow(7, q-1, q) == 1\n\n \n\ns = [561, 11041, 29341, 38081, 46657, 50737, 75361, 79381, 88831]\n\nb = [5,7]\n\nfor i in range(2,10**5):\n\n if i in s:\n\n continue\n\n if is_prime(i):\n\n b.append(i)\n\n\n\na = set([2*i-1 for i in b])\n\nb = set(b)\n\nchk = sorted(list(a&b))\n\n \n\nfrom bisect import bisect,bisect_left\n\nimport sys\n\ninput = sys.stdin.readline\n\n \n\nq = int(eval(input()))\n\nfor i in range(q):\n\n l,r = list(map(int,input().split()))\n\n print((bisect(chk,r)-bisect_left(chk,l)))","code_v0_loc":32,"code_v1_loc":25,"code_v0_num_chars":711,"code_v1_num_chars":573,"code_v0_no_empty_lines":"import math\n\n\ndef eratosthenes(limit):\n A = [i for i in range(2, limit + 1)]\n P = []\n while True:\n prime = min(A)\n if prime > math.sqrt(limit):\n break\n P.append(prime)\n i = 0\n while i < len(A):\n if A[i] % prime == 0:\n A.pop(i)\n continue\n i += 1\n for a in A:\n P.append(a)\n return list(P)\n\n\na = eratosthenes(100000)\nb = set([2 * i - 1 for i in a])\na = set(a)\nchk = sorted(list(a & b))\nfrom bisect import bisect, bisect_left\nimport sys\n\ninput = sys.stdin.readline\nq = int(eval(input()))\nfor i in range(q):\n l, r = list(map(int, input().split()))\n print((bisect(chk, r) - bisect_left(chk, l)))\n","code_v1_no_empty_lines":"def is_prime(q):\n if q == 2:\n return True\n if q < 2 or q & 1 == 0:\n return False\n return pow(5, q - 1, q) * pow(7, q - 1, q) == 1\n\n\ns = [561, 11041, 29341, 38081, 46657, 50737, 75361, 79381, 88831]\nb = [5, 7]\nfor i in range(2, 10**5):\n if i in s:\n continue\n if is_prime(i):\n b.append(i)\na = set([2 * i - 1 for i in b])\nb = set(b)\nchk = sorted(list(a & b))\nfrom bisect import bisect, bisect_left\nimport sys\n\ninput = sys.stdin.readline\nq = int(eval(input()))\nfor i in range(q):\n l, r = list(map(int, input().split()))\n print((bisect(chk, r) - bisect_left(chk, l)))\n","code_same":false,"relative_loc_diff_percent":21.875,"diff":["-import math","+def is_prime(q):","+ if q == 2:","+ return True","+ if q < 2 or q & 1 == 0:","+ return False","+ return pow(5, q - 1, q) * pow(7, q - 1, q) == 1","-def eratosthenes(limit):","- A = [i for i in range(2, limit + 1)]","- P = []","- while True:","- prime = min(A)","- if prime > math.sqrt(limit):","- break","- P.append(prime)","- i = 0","- while i < len(A):","- if A[i] % prime == 0:","- A.pop(i)","- continue","- i += 1","- for a in A:","- P.append(a)","- return list(P)","-","-","-a = eratosthenes(100000)","-b = set([2 * i - 1 for i in a])","-a = set(a)","+s = [561, 11041, 29341, 38081, 46657, 50737, 75361, 79381, 88831]","+b = [5, 7]","+for i in range(2, 10**5):","+ if i in s:","+ continue","+ if is_prime(i):","+ b.append(i)","+a = set([2 * i - 1 for i in b])","+b = set(b)"],"diff_only_import_comment":false,"measured_runtime_v0":1.6426566443,"measured_runtime_v1":0.7379002581,"runtime_lift":2.2261228755,"key":["s453000321","s067141505"]} +{"user_id":"u844789719","problem_id":"p03409","language":"python","submission_id_v0":"s942510963","submission_id_v1":"s045133777","cpu_time_v0":381,"cpu_time_v1":43,"memory_v0":56328,"memory_v1":9732,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":88.71,"input":"import networkx as nx\n\nN = int(eval(input()))\n\nAB = [[int(_) for _ in input().split()] for _ in range(N)]\n\nCD = [[int(_) for _ in input().split()] for _ in range(N)]\n\nG = nx.DiGraph()\n\nfor a, b in AB:\n\n G.add_edge(-1, a * 1000 + b, capacity=1)\n\nfor c, d in CD:\n\n G.add_edge(c * 1000 + d, -2, capacity=1)\n\nfor a, b in AB:\n\n for c, d in CD:\n\n if a < c and b < d:\n\n G.add_edge(a * 1000 + b, c * 1000 + d, capacity=1)\n\nflow_value, flow_dict = nx.maximum_flow(G, -1, -2)\n\nprint(flow_value)\n","target":"import collections, itertools\n\n\n\n\n\nclass MaximumFlow:\n\n def __init__(self, G):\n\n self.G = G\n\n\n\n def ford_fulkerson(self, s, t):\n\n def dfs(start, used):\n\n G = self.G\n\n if start == t:\n\n return [start]\n\n for end, cap in list(G[start].items()):\n\n if cap > 0 and end not in used:\n\n used.add(end)\n\n ret = dfs(end, used)\n\n if ret:\n\n return ret + [start]\n\n return []\n\n\n\n fmax = 0\n\n cnt = 0\n\n while True:\n\n G = self.G\n\n cnt += 1\n\n root = dfs(s, set([s]))\n\n if root:\n\n root = root[::-1]\n\n residue = min([G[a][b] for a, b in zip(root, root[1:])])\n\n fmax += residue\n\n for a, b in zip(root, root[1:]):\n\n G[a][b] -= residue\n\n G[b][a] += residue\n\n else:\n\n return (fmax, G)\n\n\n\n\n\nN = int(eval(input()))\n\nAB = [[int(_) for _ in input().split()] for _ in range(N)]\n\nCD = [[int(_) for _ in input().split()] for _ in range(N)]\n\nG = collections.defaultdict(lambda: collections.defaultdict(int))\n\nfor a, b in AB:\n\n G[-1][1000 * a + b] = 1\n\nfor c, d in CD:\n\n G[1000 * c + d][-2] = 1\n\nfor ab, cd in itertools.product(AB, CD):\n\n a, b = ab\n\n c, d = cd\n\n if a < c and b < d:\n\n G[1000 * a + b][1000 * c + d] = 1\n\nflow = MaximumFlow(G)\n\nfmax, Gres = flow.ford_fulkerson(-1, -2)\n\nprint(fmax)\n","code_v0_loc":15,"code_v1_loc":53,"code_v0_num_chars":506,"code_v1_num_chars":1534,"code_v0_no_empty_lines":"import networkx as nx\n\nN = int(eval(input()))\nAB = [[int(_) for _ in input().split()] for _ in range(N)]\nCD = [[int(_) for _ in input().split()] for _ in range(N)]\nG = nx.DiGraph()\nfor a, b in AB:\n G.add_edge(-1, a * 1000 + b, capacity=1)\nfor c, d in CD:\n G.add_edge(c * 1000 + d, -2, capacity=1)\nfor a, b in AB:\n for c, d in CD:\n if a < c and b < d:\n G.add_edge(a * 1000 + b, c * 1000 + d, capacity=1)\nflow_value, flow_dict = nx.maximum_flow(G, -1, -2)\nprint(flow_value)\n","code_v1_no_empty_lines":"import collections, itertools\n\n\nclass MaximumFlow:\n def __init__(self, G):\n self.G = G\n\n def ford_fulkerson(self, s, t):\n def dfs(start, used):\n G = self.G\n if start == t:\n return [start]\n for end, cap in list(G[start].items()):\n if cap > 0 and end not in used:\n used.add(end)\n ret = dfs(end, used)\n if ret:\n return ret + [start]\n return []\n\n fmax = 0\n cnt = 0\n while True:\n G = self.G\n cnt += 1\n root = dfs(s, set([s]))\n if root:\n root = root[::-1]\n residue = min([G[a][b] for a, b in zip(root, root[1:])])\n fmax += residue\n for a, b in zip(root, root[1:]):\n G[a][b] -= residue\n G[b][a] += residue\n else:\n return (fmax, G)\n\n\nN = int(eval(input()))\nAB = [[int(_) for _ in input().split()] for _ in range(N)]\nCD = [[int(_) for _ in input().split()] for _ in range(N)]\nG = collections.defaultdict(lambda: collections.defaultdict(int))\nfor a, b in AB:\n G[-1][1000 * a + b] = 1\nfor c, d in CD:\n G[1000 * c + d][-2] = 1\nfor ab, cd in itertools.product(AB, CD):\n a, b = ab\n c, d = cd\n if a < c and b < d:\n G[1000 * a + b][1000 * c + d] = 1\nflow = MaximumFlow(G)\nfmax, Gres = flow.ford_fulkerson(-1, -2)\nprint(fmax)\n","code_same":false,"relative_loc_diff_percent":71.6981132075,"diff":["-import networkx as nx","+import collections, itertools","+","+","+class MaximumFlow:","+ def __init__(self, G):","+ self.G = G","+","+ def ford_fulkerson(self, s, t):","+ def dfs(start, used):","+ G = self.G","+ if start == t:","+ return [start]","+ for end, cap in list(G[start].items()):","+ if cap > 0 and end not in used:","+ used.add(end)","+ ret = dfs(end, used)","+ if ret:","+ return ret + [start]","+ return []","+","+ fmax = 0","+ cnt = 0","+ while True:","+ G = self.G","+ cnt += 1","+ root = dfs(s, set([s]))","+ if root:","+ root = root[::-1]","+ residue = min([G[a][b] for a, b in zip(root, root[1:])])","+ fmax += residue","+ for a, b in zip(root, root[1:]):","+ G[a][b] -= residue","+ G[b][a] += residue","+ else:","+ return (fmax, G)","+","-G = nx.DiGraph()","+G = collections.defaultdict(lambda: collections.defaultdict(int))","- G.add_edge(-1, a * 1000 + b, capacity=1)","+ G[-1][1000 * a + b] = 1","- G.add_edge(c * 1000 + d, -2, capacity=1)","-for a, b in AB:","- for c, d in CD:","- if a < c and b < d:","- G.add_edge(a * 1000 + b, c * 1000 + d, capacity=1)","-flow_value, flow_dict = nx.maximum_flow(G, -1, -2)","-print(flow_value)","+ G[1000 * c + d][-2] = 1","+for ab, cd in itertools.product(AB, CD):","+ a, b = ab","+ c, d = cd","+ if a < c and b < d:","+ G[1000 * a + b][1000 * c + d] = 1","+flow = MaximumFlow(G)","+fmax, Gres = flow.ford_fulkerson(-1, -2)","+print(fmax)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0970129999,"measured_runtime_v1":0.0378819926,"runtime_lift":2.5609265327,"key":["s942510963","s045133777"]} +{"user_id":"u260216890","problem_id":"p03634","language":"python","submission_id_v0":"s315133421","submission_id_v1":"s187355129","cpu_time_v0":746,"cpu_time_v1":683,"memory_v0":104444,"memory_v1":102892,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":8.45,"input":"n=int(eval(input()))\n\nes=[[] for _ in range(n)]\n\n\n\nfor _ in range(n-1):\n\n a,b,c=list(map(int,input().split()))\n\n es[a-1].append((b-1,c))\n\n es[b-1].append((a-1,c))\n\n\n\nfrom heapq import heappush, heappop\n\ndef dijkstra(edges, size, source):\n\n distance = [float('inf')] * size\n\n distance[source] = 0\n\n visited = [False] * size\n\n pq = []\n\n heappush(pq, (0, source))\n\n while pq:\n\n dist_v, v = heappop(pq)\n\n visited[v] = True\n\n for u, weight in edges[v]:\n\n if not visited[u]:\n\n new_dist = dist_v + weight\n\n if distance[u] > new_dist:\n\n distance[u] = new_dist\n\n heappush(pq, (new_dist, u))\n\n return distance\n\n\n\n\n\nq,k=list(map(int,input().split()))\n\nk-=1\n\ndist=dijkstra(es,n,k)\n\nfor _ in range(q):\n\n x,y=list(map(int,input().split()))\n\n x-=1\n\n y-=1\n\n print((dist[x]+dist[y]))","target":"n=int(eval(input()))\n\nes=[[] for _ in range(n)]\n\n\n\nfor _ in range(n-1):\n\n a,b,c=list(map(int,input().split()))\n\n es[a-1].append((b-1,c))\n\n es[b-1].append((a-1,c))\n\n\n\nq,k=list(map(int,input().split()))\n\nk-=1\n\ndist=[float('inf')]*n\n\n\n\ndist[k]=0\n\nstack=[k]\n\nwhile stack:\n\n now=stack.pop()\n\n for e,w in es[now]:\n\n if dist[e]==float('inf'):\n\n dist[e]=dist[now]+w\n\n stack.append(e)\n\n\n\nfor _ in range(q):\n\n x,y=list(map(int,input().split()))\n\n x-=1\n\n y-=1\n\n print((dist[x]+dist[y]))","code_v0_loc":35,"code_v1_loc":26,"code_v0_num_chars":882,"code_v1_num_chars":505,"code_v0_no_empty_lines":"n = int(eval(input()))\nes = [[] for _ in range(n)]\nfor _ in range(n - 1):\n a, b, c = list(map(int, input().split()))\n es[a - 1].append((b - 1, c))\n es[b - 1].append((a - 1, c))\nfrom heapq import heappush, heappop\n\n\ndef dijkstra(edges, size, source):\n distance = [float(\"inf\")] * size\n distance[source] = 0\n visited = [False] * size\n pq = []\n heappush(pq, (0, source))\n while pq:\n dist_v, v = heappop(pq)\n visited[v] = True\n for u, weight in edges[v]:\n if not visited[u]:\n new_dist = dist_v + weight\n if distance[u] > new_dist:\n distance[u] = new_dist\n heappush(pq, (new_dist, u))\n return distance\n\n\nq, k = list(map(int, input().split()))\nk -= 1\ndist = dijkstra(es, n, k)\nfor _ in range(q):\n x, y = list(map(int, input().split()))\n x -= 1\n y -= 1\n print((dist[x] + dist[y]))\n","code_v1_no_empty_lines":"n = int(eval(input()))\nes = [[] for _ in range(n)]\nfor _ in range(n - 1):\n a, b, c = list(map(int, input().split()))\n es[a - 1].append((b - 1, c))\n es[b - 1].append((a - 1, c))\nq, k = list(map(int, input().split()))\nk -= 1\ndist = [float(\"inf\")] * n\ndist[k] = 0\nstack = [k]\nwhile stack:\n now = stack.pop()\n for e, w in es[now]:\n if dist[e] == float(\"inf\"):\n dist[e] = dist[now] + w\n stack.append(e)\nfor _ in range(q):\n x, y = list(map(int, input().split()))\n x -= 1\n y -= 1\n print((dist[x] + dist[y]))\n","code_same":false,"relative_loc_diff_percent":25.7142857143,"diff":["-from heapq import heappush, heappop","-","-","-def dijkstra(edges, size, source):","- distance = [float(\"inf\")] * size","- distance[source] = 0","- visited = [False] * size","- pq = []","- heappush(pq, (0, source))","- while pq:","- dist_v, v = heappop(pq)","- visited[v] = True","- for u, weight in edges[v]:","- if not visited[u]:","- new_dist = dist_v + weight","- if distance[u] > new_dist:","- distance[u] = new_dist","- heappush(pq, (new_dist, u))","- return distance","-","-","-dist = dijkstra(es, n, k)","+dist = [float(\"inf\")] * n","+dist[k] = 0","+stack = [k]","+while stack:","+ now = stack.pop()","+ for e, w in es[now]:","+ if dist[e] == float(\"inf\"):","+ dist[e] = dist[now] + w","+ stack.append(e)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0498507404,"measured_runtime_v1":0.0642030351,"runtime_lift":0.7764545762,"key":["s315133421","s187355129"]} +{"user_id":"u366886346","problem_id":"p03476","language":"python","submission_id_v0":"s547595379","submission_id_v1":"s223589801","cpu_time_v0":911,"cpu_time_v1":732,"memory_v0":13996,"memory_v1":12736,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.65,"input":"def sb(n):\n\n arr = []\n\n temp = n\n\n for i in range(2, int(-(-n**0.5\/\/1))+1):\n\n if temp%i==0:\n\n cnt=0\n\n while temp%i==0:\n\n cnt+=1\n\n temp \/\/= i\n\n arr.append([i, cnt])\n\n if temp!=1:\n\n arr.append([temp, 1])\n\n if arr==[]:\n\n arr.append([n, 1])\n\n return arr\n\nnum=[0]*(10**5+1)\n\nnum2=[0]*(10**5+1)\n\ncnt=[0]*(10**5+1)\n\nnum[2]+=1\n\nfor i in range(2,10**5+1):\n\n if i%2==1:\n\n n=sb(i)\n\n if len(n)==1 and n[0][1]==1:\n\n num[i]+=1\n\n if num[i]==1 and num[(i+1)\/\/2]==1:\n\n num2[i]+=1\n\nfor i in range(1,len(num2)):\n\n cnt[i]=cnt[i-1]+num2[i]\n\nq=int(eval(input()))\n\nfor i in range(q):\n\n l,r=list(map(int,input().split()))\n\n print((cnt[r]-cnt[l-1]))\n","target":"import math\n\nq=int(eval(input()))\n\nnum=[0]*(10**5+5)\n\nans=[0]*(10**5+5)\n\nnum[2]=1\n\nfor i in range(3,10**5+2,2):\n\n yn=0\n\n for j in range(2,int(math.sqrt(i))+1):\n\n if i%j==0:\n\n yn=1\n\n break\n\n if yn==0:\n\n num[i]=1\n\n if num[(i+1)\/\/2]==1:\n\n ans[i]=1\n\nfor i in range(1,len(num)):\n\n ans[i]=ans[i-1]+ans[i]\n\nfor i in range(q):\n\n l,r=list(map(int,input().split()))\n\n print((ans[r]-ans[l-1]))\n","code_v0_loc":32,"code_v1_loc":20,"code_v0_num_chars":768,"code_v1_num_chars":441,"code_v0_no_empty_lines":"def sb(n):\n arr = []\n temp = n\n for i in range(2, int(-(-(n**0.5) \/\/ 1)) + 1):\n if temp % i == 0:\n cnt = 0\n while temp % i == 0:\n cnt += 1\n temp \/\/= i\n arr.append([i, cnt])\n if temp != 1:\n arr.append([temp, 1])\n if arr == []:\n arr.append([n, 1])\n return arr\n\n\nnum = [0] * (10**5 + 1)\nnum2 = [0] * (10**5 + 1)\ncnt = [0] * (10**5 + 1)\nnum[2] += 1\nfor i in range(2, 10**5 + 1):\n if i % 2 == 1:\n n = sb(i)\n if len(n) == 1 and n[0][1] == 1:\n num[i] += 1\n if num[i] == 1 and num[(i + 1) \/\/ 2] == 1:\n num2[i] += 1\nfor i in range(1, len(num2)):\n cnt[i] = cnt[i - 1] + num2[i]\nq = int(eval(input()))\nfor i in range(q):\n l, r = list(map(int, input().split()))\n print((cnt[r] - cnt[l - 1]))\n","code_v1_no_empty_lines":"import math\n\nq = int(eval(input()))\nnum = [0] * (10**5 + 5)\nans = [0] * (10**5 + 5)\nnum[2] = 1\nfor i in range(3, 10**5 + 2, 2):\n yn = 0\n for j in range(2, int(math.sqrt(i)) + 1):\n if i % j == 0:\n yn = 1\n break\n if yn == 0:\n num[i] = 1\n if num[(i + 1) \/\/ 2] == 1:\n ans[i] = 1\nfor i in range(1, len(num)):\n ans[i] = ans[i - 1] + ans[i]\nfor i in range(q):\n l, r = list(map(int, input().split()))\n print((ans[r] - ans[l - 1]))\n","code_same":false,"relative_loc_diff_percent":37.5,"diff":["-def sb(n):","- arr = []","- temp = n","- for i in range(2, int(-(-(n**0.5) \/\/ 1)) + 1):","- if temp % i == 0:","- cnt = 0","- while temp % i == 0:","- cnt += 1","- temp \/\/= i","- arr.append([i, cnt])","- if temp != 1:","- arr.append([temp, 1])","- if arr == []:","- arr.append([n, 1])","- return arr","+import math","-","-num = [0] * (10**5 + 1)","-num2 = [0] * (10**5 + 1)","-cnt = [0] * (10**5 + 1)","-num[2] += 1","-for i in range(2, 10**5 + 1):","- if i % 2 == 1:","- n = sb(i)","- if len(n) == 1 and n[0][1] == 1:","- num[i] += 1","- if num[i] == 1 and num[(i + 1) \/\/ 2] == 1:","- num2[i] += 1","-for i in range(1, len(num2)):","- cnt[i] = cnt[i - 1] + num2[i]","+num = [0] * (10**5 + 5)","+ans = [0] * (10**5 + 5)","+num[2] = 1","+for i in range(3, 10**5 + 2, 2):","+ yn = 0","+ for j in range(2, int(math.sqrt(i)) + 1):","+ if i % j == 0:","+ yn = 1","+ break","+ if yn == 0:","+ num[i] = 1","+ if num[(i + 1) \/\/ 2] == 1:","+ ans[i] = 1","+for i in range(1, len(num)):","+ ans[i] = ans[i - 1] + ans[i]","- print((cnt[r] - cnt[l - 1]))","+ print((ans[r] - ans[l - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.940009033,"measured_runtime_v1":0.4474065051,"runtime_lift":2.1010178042,"key":["s547595379","s223589801"]} +{"user_id":"u700805562","problem_id":"p02721","language":"python","submission_id_v0":"s218824293","submission_id_v1":"s826770355","cpu_time_v0":355,"cpu_time_v1":282,"memory_v0":20644,"memory_v1":65020,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":20.56,"input":"n, k, c = list(map(int, input().split()))\n\ns = eval(input())\n\nleft_dp = []\n\nright_dp = []\n\n\n\ni = 0\n\nwhile len(left_dp) dp[c]: dp[c] = tmp\n\n \n\n # maximum profit will be at the bottom-right corner.\n\n return dp[capacity]\n\n \n\ndef main():\n\n \n\n res = solve_knapsack(W)\n\n \n\n print(res)\n\nif __name__ == \"__main__\":\n\n\tmain()","target":"N,W=list(map(int,input().split()))\n\n\n\ndef solve_knapsack(capacity):\n\n # basic checks\n\n \n\n \n\n # populate the capacity = 0 columns, with '0' capacity we have '0' profit\n\n dp = [0]*(W + 1)\n\n weights, profits = [0]*(N+1), [0]*(N+1)\n\n \n\n\n\n for i in range(0, N):\n\n weights,profits = list(map(int,input().split()))\n\n for c in range(capacity, weights-1, -1):\n\n tmp = profits + dp[c - weights]\n\n if tmp > dp[c]: dp[c] = tmp\n\n \n\n # maximum profit will be at the bottom-right corner.\n\n return dp[capacity]\n\n \n\ndef main():\n\n \n\n \n\n res = solve_knapsack(W)\n\n \n\n print(res)\n\nif __name__ == \"__main__\":\n\n\tmain()","code_v0_loc":25,"code_v1_loc":28,"code_v0_num_chars":595,"code_v1_num_chars":656,"code_v0_no_empty_lines":"N, W = list(map(int, input().split()))\ndp = [0] * (W + 1)\n\n\ndef solve_knapsack(capacity):\n # basic checks\n # populate the capacity = 0 columns, with '0' capacity we have '0' profit\n for i in range(0, N):\n weights, profits = list(map(int, input().split()))\n for c in range(capacity, weights - 1, -1):\n tmp = profits + dp[c - weights]\n if tmp > dp[c]:\n dp[c] = tmp\n # maximum profit will be at the bottom-right corner.\n return dp[capacity]\n\n\ndef main():\n res = solve_knapsack(W)\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"N, W = list(map(int, input().split()))\n\n\ndef solve_knapsack(capacity):\n # basic checks\n # populate the capacity = 0 columns, with '0' capacity we have '0' profit\n dp = [0] * (W + 1)\n weights, profits = [0] * (N + 1), [0] * (N + 1)\n for i in range(0, N):\n weights, profits = list(map(int, input().split()))\n for c in range(capacity, weights - 1, -1):\n tmp = profits + dp[c - weights]\n if tmp > dp[c]:\n dp[c] = tmp\n # maximum profit will be at the bottom-right corner.\n return dp[capacity]\n\n\ndef main():\n res = solve_knapsack(W)\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":10.7142857143,"diff":["-dp = [0] * (W + 1)","+ dp = [0] * (W + 1)","+ weights, profits = [0] * (N + 1), [0] * (N + 1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0387392044,"measured_runtime_v1":0.0481590748,"runtime_lift":0.804400927,"key":["s003078284","s289432775"]} +{"user_id":"u445404615","problem_id":"p03494","language":"python","submission_id_v0":"s154197549","submission_id_v1":"s645269959","cpu_time_v0":164,"cpu_time_v1":18,"memory_v0":38640,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":89.02,"input":"n = int(eval(input()))\n\na = list(map(int,input().split()))\n\n\n\ncnt = 0\n\nfor i in range(100):\n\n\n\n if sum(list(1 for x in a if x % 2 == 1)) != 0:\n\n print(cnt)\n\n exit()\n\n \n\n a = list(x \/\/ 2 for x in a)\n\n cnt += 1\n\n\n\nprint(cnt)","target":"n = int(eval(input()))\n\na = list(map(int,input().split()))\n\n\n\ncnt = 0\n\nwhile True:\n\n if sum(list(1 for x in a if x % 2 == 1)) != 0:\n\n print(cnt)\n\n exit() \n\n a = list(x \/\/ 2 for x in a)\n\n cnt += 1\n\nprint(cnt)","code_v0_loc":14,"code_v1_loc":11,"code_v0_num_chars":242,"code_v1_num_chars":225,"code_v0_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\ncnt = 0\nfor i in range(100):\n if sum(list(1 for x in a if x % 2 == 1)) != 0:\n print(cnt)\n exit()\n a = list(x \/\/ 2 for x in a)\n cnt += 1\nprint(cnt)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na = list(map(int, input().split()))\ncnt = 0\nwhile True:\n if sum(list(1 for x in a if x % 2 == 1)) != 0:\n print(cnt)\n exit()\n a = list(x \/\/ 2 for x in a)\n cnt += 1\nprint(cnt)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["-for i in range(100):","+while True:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0348179107,"measured_runtime_v1":0.0350593336,"runtime_lift":0.9931138765,"key":["s154197549","s645269959"]} +{"user_id":"u323680411","problem_id":"p02641","language":"python","submission_id_v0":"s396260472","submission_id_v1":"s452061983","cpu_time_v0":31,"cpu_time_v1":25,"memory_v0":9116,"memory_v1":9116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":19.35,"input":"x, n = list(map(int, input().split()))\n\ns = set(list(map(int, input().split())) if n != 0 else \"\")\n\n\n\ni = 0\n\nwhile True:\n\n k = x + i\n\n if k not in s:\n\n print(k)\n\n break\n\n\n\n if i >= 0: i += 1\n\n i *= -1\n","target":"x, n = list(map(int, input().split()))\n\ns = set(list(map(int, input().split())) if n != 0 else \"\")\n\n\n\ni = 0\n\nwhile x + i in s:\n\n if i >= 0: i += 1\n\n i *= -1\n\n\n\nprint((x + i))\n","code_v0_loc":12,"code_v1_loc":9,"code_v0_num_chars":215,"code_v1_num_chars":167,"code_v0_no_empty_lines":"x, n = list(map(int, input().split()))\ns = set(list(map(int, input().split())) if n != 0 else \"\")\ni = 0\nwhile True:\n k = x + i\n if k not in s:\n print(k)\n break\n if i >= 0:\n i += 1\n i *= -1\n","code_v1_no_empty_lines":"x, n = list(map(int, input().split()))\ns = set(list(map(int, input().split())) if n != 0 else \"\")\ni = 0\nwhile x + i in s:\n if i >= 0:\n i += 1\n i *= -1\nprint((x + i))\n","code_same":false,"relative_loc_diff_percent":25.0,"diff":["-while True:","- k = x + i","- if k not in s:","- print(k)","- break","+while x + i in s:","+print((x + i))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0432287889,"measured_runtime_v1":0.0415431983,"runtime_lift":1.0405744036,"key":["s396260472","s452061983"]} +{"user_id":"u633068244","problem_id":"p00038","language":"python","submission_id_v0":"s224771062","submission_id_v1":"s821879037","cpu_time_v0":20,"cpu_time_v1":10,"memory_v0":4240,"memory_v1":4220,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"while True:\n\n try:\n\n hand = list(map(int, input().split(\",\")))\n\n kind = list(set(hand))\n\n rank =[]\n\n for card in kind:\n\n rank.append(hand.count(card))\n\n rank.sort()\n\n rank.reverse()\n\n if rank[0] == 4:\n\n print(\"four card\")\n\n elif rank[0] == 3:\n\n if rank[1] == 2:\n\n print(\"full house\")\n\n else:\n\n print(\"three card\")\n\n elif rank[0] == 2:\n\n if rank[1] == 2:\n\n print(\"two pair\")\n\n else:\n\n print(\"one pair\")\n\n else:\n\n hand.sort()\n\n if hand[4] - hand[0] == 4 or (hand[0] == 1 and hand[1] == 10):\n\n print(\"straight\")\n\n else:\n\n print(\"null\")\n\n except:\n\n break","target":"while True:\n\n try:\n\n hand = sorted(map(int, input().split(\",\")))\n\n kind = len(set(hand))\n\n ma = max([hand.count(i) for i in hand])\n\n if kind == 4:\n\n print(\"one pair\")\n\n elif kind == 3:\n\n if ma == 2:\n\n print(\"two pair\")\n\n else:\n\n print(\"three card\")\n\n elif kind == 2:\n\n if ma==4:\n\n print(\"four card\")\n\n else:\n\n print(\"full house\")\n\n else:\n\n if hand==[1,10,11,12,13] or hand[4] - hand[0] == 4:\n\n print(\"straight\")\n\n else:\n\n print(\"null\")\n\n except:\n\n break","code_v0_loc":29,"code_v1_loc":24,"code_v0_num_chars":821,"code_v1_num_chars":805,"code_v0_no_empty_lines":"while True:\n try:\n hand = list(map(int, input().split(\",\")))\n kind = list(set(hand))\n rank = []\n for card in kind:\n rank.append(hand.count(card))\n rank.sort()\n rank.reverse()\n if rank[0] == 4:\n print(\"four card\")\n elif rank[0] == 3:\n if rank[1] == 2:\n print(\"full house\")\n else:\n print(\"three card\")\n elif rank[0] == 2:\n if rank[1] == 2:\n print(\"two pair\")\n else:\n print(\"one pair\")\n else:\n hand.sort()\n if hand[4] - hand[0] == 4 or (hand[0] == 1 and hand[1] == 10):\n print(\"straight\")\n else:\n print(\"null\")\n except:\n break\n","code_v1_no_empty_lines":"while True:\n try:\n hand = sorted(map(int, input().split(\",\")))\n kind = len(set(hand))\n ma = max([hand.count(i) for i in hand])\n if kind == 4:\n print(\"one pair\")\n elif kind == 3:\n if ma == 2:\n print(\"two pair\")\n else:\n print(\"three card\")\n elif kind == 2:\n if ma == 4:\n print(\"four card\")\n else:\n print(\"full house\")\n else:\n if hand == [1, 10, 11, 12, 13] or hand[4] - hand[0] == 4:\n print(\"straight\")\n else:\n print(\"null\")\n except:\n break\n","code_same":false,"relative_loc_diff_percent":17.2413793103,"diff":["- hand = list(map(int, input().split(\",\")))","- kind = list(set(hand))","- rank = []","- for card in kind:","- rank.append(hand.count(card))","- rank.sort()","- rank.reverse()","- if rank[0] == 4:","- print(\"four card\")","- elif rank[0] == 3:","- if rank[1] == 2:","- print(\"full house\")","+ hand = sorted(map(int, input().split(\",\")))","+ kind = len(set(hand))","+ ma = max([hand.count(i) for i in hand])","+ if kind == 4:","+ print(\"one pair\")","+ elif kind == 3:","+ if ma == 2:","+ print(\"two pair\")","- elif rank[0] == 2:","- if rank[1] == 2:","- print(\"two pair\")","+ elif kind == 2:","+ if ma == 4:","+ print(\"four card\")","- print(\"one pair\")","+ print(\"full house\")","- hand.sort()","- if hand[4] - hand[0] == 4 or (hand[0] == 1 and hand[1] == 10):","+ if hand == [1, 10, 11, 12, 13] or hand[4] - hand[0] == 4:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0483335345,"measured_runtime_v1":0.0655406454,"runtime_lift":0.7374589342,"key":["s224771062","s821879037"]} +{"user_id":"u197300773","problem_id":"p03426","language":"python","submission_id_v0":"s000398630","submission_id_v1":"s196554947","cpu_time_v0":1097,"cpu_time_v1":1012,"memory_v0":25716,"memory_v1":20888,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.75,"input":"\n\n\n\nH,W,D=list(map(int,input().split()))\n\na=[list(map(int,input().split())) for i in range(H)]\n\nQ=int(eval(input()))\n\n\n\ny=[[-1,-1] for i in range(H*W+1)]\n\n\n\nfor i in range(H):\n\n for j in range(W):\n\n y[a[i][j]]=[i,j]\n\n\n\nx=[ [0] for i in range(D)]\n\n\n\nfor i in range(D):\n\n j=H*W-i-D\n\n while j>0:\n\n tmp1,tmp2=abs(y[j][0]-y[j+D][0]),abs(y[j][1]-y[j+D][1])\n\n x[i].append(x[i][-1]+tmp1+tmp2)\n\n j-=D\n\n\n\nfor q in range(Q):\n\n L,R=list(map(int,input().split()))\n\n i=(H*W-R)%D\n\n l=(H*W-i-R)\/\/D\n\n r=(H*W-i-L)\/\/D\n\n print((x[i][r]-x[i][l]))","target":"H,W,D=list(map(int,input().split()))\n\na=[list(map(int,input().split())) for i in range(H)]\n\nQ=int(eval(input()))\n\n\n\ny=[[-1,-1] for i in range(H*W+1)]\n\nfor i in range(H):\n\n for j in range(W):\n\n y[a[i][j]]=[i,j]\n\n\n\nx=[0 for i in range(H*W+1)]\n\nfor i in range(D+1,H*W+1):\n\n x[i]=x[i-D]+abs(y[i][0]-y[i-D][0])+abs(y[i][1]-y[i-D][1]) \n\n\n\nfor q in range(Q):\n\n L,R=list(map(int,input().split()))\n\n print((x[R]-x[L]))","code_v0_loc":27,"code_v1_loc":16,"code_v0_num_chars":557,"code_v1_num_chars":411,"code_v0_no_empty_lines":"H, W, D = list(map(int, input().split()))\na = [list(map(int, input().split())) for i in range(H)]\nQ = int(eval(input()))\ny = [[-1, -1] for i in range(H * W + 1)]\nfor i in range(H):\n for j in range(W):\n y[a[i][j]] = [i, j]\nx = [[0] for i in range(D)]\nfor i in range(D):\n j = H * W - i - D\n while j > 0:\n tmp1, tmp2 = abs(y[j][0] - y[j + D][0]), abs(y[j][1] - y[j + D][1])\n x[i].append(x[i][-1] + tmp1 + tmp2)\n j -= D\nfor q in range(Q):\n L, R = list(map(int, input().split()))\n i = (H * W - R) % D\n l = (H * W - i - R) \/\/ D\n r = (H * W - i - L) \/\/ D\n print((x[i][r] - x[i][l]))\n","code_v1_no_empty_lines":"H, W, D = list(map(int, input().split()))\na = [list(map(int, input().split())) for i in range(H)]\nQ = int(eval(input()))\ny = [[-1, -1] for i in range(H * W + 1)]\nfor i in range(H):\n for j in range(W):\n y[a[i][j]] = [i, j]\nx = [0 for i in range(H * W + 1)]\nfor i in range(D + 1, H * W + 1):\n x[i] = x[i - D] + abs(y[i][0] - y[i - D][0]) + abs(y[i][1] - y[i - D][1])\nfor q in range(Q):\n L, R = list(map(int, input().split()))\n print((x[R] - x[L]))\n","code_same":false,"relative_loc_diff_percent":40.7407407407,"diff":["-x = [[0] for i in range(D)]","-for i in range(D):","- j = H * W - i - D","- while j > 0:","- tmp1, tmp2 = abs(y[j][0] - y[j + D][0]), abs(y[j][1] - y[j + D][1])","- x[i].append(x[i][-1] + tmp1 + tmp2)","- j -= D","+x = [0 for i in range(H * W + 1)]","+for i in range(D + 1, H * W + 1):","+ x[i] = x[i - D] + abs(y[i][0] - y[i - D][0]) + abs(y[i][1] - y[i - D][1])","- i = (H * W - R) % D","- l = (H * W - i - R) \/\/ D","- r = (H * W - i - L) \/\/ D","- print((x[i][r] - x[i][l]))","+ print((x[R] - x[L]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0441841474,"measured_runtime_v1":0.1170586147,"runtime_lift":0.3774531884,"key":["s000398630","s196554947"]} +{"user_id":"u600402037","problem_id":"p02990","language":"python","submission_id_v0":"s716942858","submission_id_v1":"s045529651","cpu_time_v0":545,"cpu_time_v1":176,"memory_v0":3944,"memory_v1":12860,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":67.71,"input":"from operator import mul\n\nfrom functools import reduce\n\nMOD = 10 ** 9 + 7\n\n\n\nN, K = list(map(int, input().split()))\n\n\n\ndef cmb(n, r):\n\n if n < r:\n\n return 0\n\n r = min(r, n-r)\n\n if r == 0:\n\n return 1\n\n nume = reduce(mul, list(range(n, n-r, -1)))\n\n deno = reduce(mul, list(range(1, r+1)))\n\n \n\n return nume \/\/ deno % MOD\n\n\n\n# \u8d64\u3044\u30dc\u30fc\u30eb\u306e\u9593\u3068\u4e21\u7aef\uff08N-K+1\uff09\u306e\u4e2d\u304b\u3089i\u500b\u3092\u9078\u3076\n\nfor i in range(1, K+1):\n\n print((cmb((N-K+1), i) * cmb((K-1), i-1) % MOD))","target":"import sys\n\nimport numpy as np\n\n\n\nsr = lambda: sys.stdin.readline().rstrip()\n\nir = lambda: int(sr())\n\nlr = lambda: list(map(int, sr().split()))\n\n\n\ndef cmb(n, k):\n\n return fact[n] * fact_inv[k] % MOD * fact_inv[n-k] % MOD\n\n\n\ndef cumprod(arr, MOD):\n\n L = len(arr); Lsq = int(L**.5+1)\n\n arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)\n\n for n in range(1, Lsq):\n\n arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD\n\n for n in range(1, Lsq):\n\n arr[n] *= arr[n-1, -1]; arr[n] %= MOD\n\n return arr.ravel()[:L]\n\n\n\ndef make_fact(U, MOD):\n\n x = np.arange(U, dtype=np.int64); x[0] = 1\n\n fact = cumprod(x, MOD)\n\n x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)\n\n fact_inv = cumprod(x, MOD)[::-1]\n\n return fact, fact_inv\n\n\n\nN, K = lr()\n\nMOD = 10 ** 9 + 7\n\nU = 2010 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650\n\nfact, fact_inv = make_fact(U, MOD)\n\nred = N-K\n\nfor i in range(1, K+1):\n\n # (red+1)Ci\n\n answer = 0 if red+1 < i else cmb(red+1, i)\n\n #print(answer)\n\n remain = K - i\n\n # remain\u3092i\u306e\u4e2d\u306b\u81ea\u7531\u306b\u3044\u308c\u308b\u3001i-1\u306e\u58c1\u3092\u7528\u610f\n\n # (remain+(i-1)) C remain\n\n answer *= cmb(remain+i-1, remain)\n\n print((answer%MOD))\n\n\n\n# 15\n","code_v0_loc":20,"code_v1_loc":42,"code_v0_num_chars":443,"code_v1_num_chars":1144,"code_v0_no_empty_lines":"from operator import mul\nfrom functools import reduce\n\nMOD = 10**9 + 7\nN, K = list(map(int, input().split()))\n\n\ndef cmb(n, r):\n if n < r:\n return 0\n r = min(r, n - r)\n if r == 0:\n return 1\n nume = reduce(mul, list(range(n, n - r, -1)))\n deno = reduce(mul, list(range(1, r + 1)))\n return nume \/\/ deno % MOD\n\n\n# \u8d64\u3044\u30dc\u30fc\u30eb\u306e\u9593\u3068\u4e21\u7aef\uff08N-K+1\uff09\u306e\u4e2d\u304b\u3089i\u500b\u3092\u9078\u3076\nfor i in range(1, K + 1):\n print((cmb((N - K + 1), i) * cmb((K - 1), i - 1) % MOD))\n","code_v1_no_empty_lines":"import sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\n\ndef cmb(n, k):\n return fact[n] * fact_inv[k] % MOD * fact_inv[n - k] % MOD\n\n\ndef cumprod(arr, MOD):\n L = len(arr)\n Lsq = int(L**0.5 + 1)\n arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)\n for n in range(1, Lsq):\n arr[:, n] *= arr[:, n - 1]\n arr[:, n] %= MOD\n for n in range(1, Lsq):\n arr[n] *= arr[n - 1, -1]\n arr[n] %= MOD\n return arr.ravel()[:L]\n\n\ndef make_fact(U, MOD):\n x = np.arange(U, dtype=np.int64)\n x[0] = 1\n fact = cumprod(x, MOD)\n x = np.arange(U, 0, -1, dtype=np.int64)\n x[0] = pow(int(fact[-1]), MOD - 2, MOD)\n fact_inv = cumprod(x, MOD)[::-1]\n return fact, fact_inv\n\n\nN, K = lr()\nMOD = 10**9 + 7\nU = 2010 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650\nfact, fact_inv = make_fact(U, MOD)\nred = N - K\nfor i in range(1, K + 1):\n # (red+1)Ci\n answer = 0 if red + 1 < i else cmb(red + 1, i)\n # print(answer)\n remain = K - i\n # remain\u3092i\u306e\u4e2d\u306b\u81ea\u7531\u306b\u3044\u308c\u308b\u3001i-1\u306e\u58c1\u3092\u7528\u610f\n # (remain+(i-1)) C remain\n answer *= cmb(remain + i - 1, remain)\n print((answer % MOD))\n# 15\n","code_same":false,"relative_loc_diff_percent":52.380952381,"diff":["-from operator import mul","-from functools import reduce","+import sys","+import numpy as np","-MOD = 10**9 + 7","-N, K = list(map(int, input().split()))","+sr = lambda: sys.stdin.readline().rstrip()","+ir = lambda: int(sr())","+lr = lambda: list(map(int, sr().split()))","-def cmb(n, r):","- if n < r:","- return 0","- r = min(r, n - r)","- if r == 0:","- return 1","- nume = reduce(mul, list(range(n, n - r, -1)))","- deno = reduce(mul, list(range(1, r + 1)))","- return nume \/\/ deno % MOD","+def cmb(n, k):","+ return fact[n] * fact_inv[k] % MOD * fact_inv[n - k] % MOD","-# \u8d64\u3044\u30dc\u30fc\u30eb\u306e\u9593\u3068\u4e21\u7aef\uff08N-K+1\uff09\u306e\u4e2d\u304b\u3089i\u500b\u3092\u9078\u3076","+def cumprod(arr, MOD):","+ L = len(arr)","+ Lsq = int(L**0.5 + 1)","+ arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)","+ for n in range(1, Lsq):","+ arr[:, n] *= arr[:, n - 1]","+ arr[:, n] %= MOD","+ for n in range(1, Lsq):","+ arr[n] *= arr[n - 1, -1]","+ arr[n] %= MOD","+ return arr.ravel()[:L]","+","+","+def make_fact(U, MOD):","+ x = np.arange(U, dtype=np.int64)","+ x[0] = 1","+ fact = cumprod(x, MOD)","+ x = np.arange(U, 0, -1, dtype=np.int64)","+ x[0] = pow(int(fact[-1]), MOD - 2, MOD)","+ fact_inv = cumprod(x, MOD)[::-1]","+ return fact, fact_inv","+","+","+N, K = lr()","+MOD = 10**9 + 7","+U = 2010 # \u968e\u4e57\u30c6\u30fc\u30d6\u30eb\u306e\u4e0a\u9650","+fact, fact_inv = make_fact(U, MOD)","+red = N - K","- print((cmb((N - K + 1), i) * cmb((K - 1), i - 1) % MOD))","+ # (red+1)Ci","+ answer = 0 if red + 1 < i else cmb(red + 1, i)","+ # print(answer)","+ remain = K - i","+ # remain\u3092i\u306e\u4e2d\u306b\u81ea\u7531\u306b\u3044\u308c\u308b\u3001i-1\u306e\u58c1\u3092\u7528\u610f","+ # (remain+(i-1)) C remain","+ answer *= cmb(remain + i - 1, remain)","+ print((answer % MOD))","+# 15"],"diff_only_import_comment":false,"measured_runtime_v0":0.1273867521,"measured_runtime_v1":0.1895597246,"runtime_lift":0.6720138068,"key":["s716942858","s045529651"]} +{"user_id":"u086503932","problem_id":"p02873","language":"python","submission_id_v0":"s027901918","submission_id_v1":"s035842588","cpu_time_v0":674,"cpu_time_v1":273,"memory_v0":23368,"memory_v1":13896,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.5,"input":"S = eval(input())\n\nN = len(S)\n\na = [0] * (N+1)\n\nindex = 0\n\nwhile index < N:\n\n tmp = S[index]\n\n count = 1\n\n if index < N-1:\n\n while S[index+count] == tmp:\n\n count += 1\n\n if index+count == N:\n\n break\n\n if tmp == '<':\n\n for j in range(count+1):\n\n a[index+j] = max(a[index+j],j)\n\n else:\n\n for j in range(count+1):\n\n a[index+count-j] = max(a[index+count-j],j)\n\n index += count\n\nprint((sum(a)))","target":"s = eval(input())\n\nN = len(s)+1\n\nres = []\n\nans = 0\n\ni = 0\n\nwhile i < N-1:\n\n seq = 1\n\n while i < N - 2 and s[i] == s[i + 1]:\n\n i += 1\n\n seq += 1\n\n res.append(seq)\n\n i += 1\n\n\n\nif s[0] == '>':\n\n ans += res[0] * (res[0] + 1) \/\/ 2\n\n res = res[1:]\n\nif s[-1] == '<':\n\n ans += res[-1] * (res[-1]+1)\/\/2\n\n res = res[:-1]\n\n\n\nfor i in range(len(res) \/\/ 2):\n\n tmp = max(res[2 * i], res[2 * i + 1])\n\n tmp2 = min(res[2 * i], res[2 * i + 1])\n\n ans += tmp * (tmp + 1) \/\/ 2\n\n ans += tmp2 * (tmp2-1) \/\/2\n\nprint(ans)","code_v0_loc":20,"code_v1_loc":26,"code_v0_num_chars":422,"code_v1_num_chars":540,"code_v0_no_empty_lines":"S = eval(input())\nN = len(S)\na = [0] * (N + 1)\nindex = 0\nwhile index < N:\n tmp = S[index]\n count = 1\n if index < N - 1:\n while S[index + count] == tmp:\n count += 1\n if index + count == N:\n break\n if tmp == \"<\":\n for j in range(count + 1):\n a[index + j] = max(a[index + j], j)\n else:\n for j in range(count + 1):\n a[index + count - j] = max(a[index + count - j], j)\n index += count\nprint((sum(a)))\n","code_v1_no_empty_lines":"s = eval(input())\nN = len(s) + 1\nres = []\nans = 0\ni = 0\nwhile i < N - 1:\n seq = 1\n while i < N - 2 and s[i] == s[i + 1]:\n i += 1\n seq += 1\n res.append(seq)\n i += 1\nif s[0] == \">\":\n ans += res[0] * (res[0] + 1) \/\/ 2\n res = res[1:]\nif s[-1] == \"<\":\n ans += res[-1] * (res[-1] + 1) \/\/ 2\n res = res[:-1]\nfor i in range(len(res) \/\/ 2):\n tmp = max(res[2 * i], res[2 * i + 1])\n tmp2 = min(res[2 * i], res[2 * i + 1])\n ans += tmp * (tmp + 1) \/\/ 2\n ans += tmp2 * (tmp2 - 1) \/\/ 2\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":23.0769230769,"diff":["-S = eval(input())","-N = len(S)","-a = [0] * (N + 1)","-index = 0","-while index < N:","- tmp = S[index]","- count = 1","- if index < N - 1:","- while S[index + count] == tmp:","- count += 1","- if index + count == N:","- break","- if tmp == \"<\":","- for j in range(count + 1):","- a[index + j] = max(a[index + j], j)","- else:","- for j in range(count + 1):","- a[index + count - j] = max(a[index + count - j], j)","- index += count","-print((sum(a)))","+s = eval(input())","+N = len(s) + 1","+res = []","+ans = 0","+i = 0","+while i < N - 1:","+ seq = 1","+ while i < N - 2 and s[i] == s[i + 1]:","+ i += 1","+ seq += 1","+ res.append(seq)","+ i += 1","+if s[0] == \">\":","+ ans += res[0] * (res[0] + 1) \/\/ 2","+ res = res[1:]","+if s[-1] == \"<\":","+ ans += res[-1] * (res[-1] + 1) \/\/ 2","+ res = res[:-1]","+for i in range(len(res) \/\/ 2):","+ tmp = max(res[2 * i], res[2 * i + 1])","+ tmp2 = min(res[2 * i], res[2 * i + 1])","+ ans += tmp * (tmp + 1) \/\/ 2","+ ans += tmp2 * (tmp2 - 1) \/\/ 2","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.119089311,"measured_runtime_v1":0.1320828561,"runtime_lift":0.9016258018,"key":["s027901918","s035842588"]} +{"user_id":"u955251526","problem_id":"p03545","language":"python","submission_id_v0":"s935045759","submission_id_v1":"s792174972","cpu_time_v0":21,"cpu_time_v1":18,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":14.29,"input":"s = list(map(int,list(input())))\n\ndef search(i,current,signs):\n\n if i == 4:\n\n if current == 7:\n\n return signs\n\n else: return []\n\n return search(i+1,current+s[i],signs+['+']) + search(i+1,current-s[i],signs+['-'])\n\nsigns = search(1,s[0],[])\n\nfor i in range(4):\n\n if i == 3:\n\n print(s[i], end='')\n\n else:\n\n print(s[i], end='')\n\n print(signs[i], end='')\n\nprint('=7')\n","target":"p = list(map(int, list(input())))\n\ndef add(x,y,s):\n\n if s == 0: return x+y\n\n else: return x-y\n\ndef bittolist(x):\n\n ret = []\n\n for _ in range(3):\n\n ret.append(x%2)\n\n x \/\/= 2\n\n return ret\n\ndef pm(s):\n\n if s == 0:\n\n return '+'\n\n else: return '-'\n\nfor i in range(8):\n\n s = bittolist(i)\n\n res = p[0]\n\n for j in range(3):\n\n res = add(res, p[j+1], s[j])\n\n if res == 7:\n\n print(p[0], end = '')\n\n print(pm(s[0]), end = '')\n\n print(p[1], end = '')\n\n print(pm(s[1]), end = '')\n\n print(p[2], end = '')\n\n print(pm(s[2]), end = '')\n\n print(p[3], end = '')\n\n print('=7')\n\n exit()\n","code_v0_loc":15,"code_v1_loc":29,"code_v0_num_chars":421,"code_v1_num_chars":688,"code_v0_no_empty_lines":"s = list(map(int, list(input())))\n\n\ndef search(i, current, signs):\n if i == 4:\n if current == 7:\n return signs\n else:\n return []\n return search(i + 1, current + s[i], signs + [\"+\"]) + search(\n i + 1, current - s[i], signs + [\"-\"]\n )\n\n\nsigns = search(1, s[0], [])\nfor i in range(4):\n if i == 3:\n print(s[i], end=\"\")\n else:\n print(s[i], end=\"\")\n print(signs[i], end=\"\")\nprint(\"=7\")\n","code_v1_no_empty_lines":"p = list(map(int, list(input())))\n\n\ndef add(x, y, s):\n if s == 0:\n return x + y\n else:\n return x - y\n\n\ndef bittolist(x):\n ret = []\n for _ in range(3):\n ret.append(x % 2)\n x \/\/= 2\n return ret\n\n\ndef pm(s):\n if s == 0:\n return \"+\"\n else:\n return \"-\"\n\n\nfor i in range(8):\n s = bittolist(i)\n res = p[0]\n for j in range(3):\n res = add(res, p[j + 1], s[j])\n if res == 7:\n print(p[0], end=\"\")\n print(pm(s[0]), end=\"\")\n print(p[1], end=\"\")\n print(pm(s[1]), end=\"\")\n print(p[2], end=\"\")\n print(pm(s[2]), end=\"\")\n print(p[3], end=\"\")\n print(\"=7\")\n exit()\n","code_same":false,"relative_loc_diff_percent":48.275862069,"diff":["-s = list(map(int, list(input())))","+p = list(map(int, list(input())))","-def search(i, current, signs):","- if i == 4:","- if current == 7:","- return signs","- else:","- return []","- return search(i + 1, current + s[i], signs + [\"+\"]) + search(","- i + 1, current - s[i], signs + [\"-\"]","- )","+def add(x, y, s):","+ if s == 0:","+ return x + y","+ else:","+ return x - y","-signs = search(1, s[0], [])","-for i in range(4):","- if i == 3:","- print(s[i], end=\"\")","+def bittolist(x):","+ ret = []","+ for _ in range(3):","+ ret.append(x % 2)","+ x \/\/= 2","+ return ret","+","+","+def pm(s):","+ if s == 0:","+ return \"+\"","- print(s[i], end=\"\")","- print(signs[i], end=\"\")","-print(\"=7\")","+ return \"-\"","+","+","+for i in range(8):","+ s = bittolist(i)","+ res = p[0]","+ for j in range(3):","+ res = add(res, p[j + 1], s[j])","+ if res == 7:","+ print(p[0], end=\"\")","+ print(pm(s[0]), end=\"\")","+ print(p[1], end=\"\")","+ print(pm(s[1]), end=\"\")","+ print(p[2], end=\"\")","+ print(pm(s[2]), end=\"\")","+ print(p[3], end=\"\")","+ print(\"=7\")","+ exit()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0347696333,"measured_runtime_v1":0.0417234678,"runtime_lift":0.8333351731,"key":["s935045759","s792174972"]} +{"user_id":"u571281863","problem_id":"p02660","language":"python","submission_id_v0":"s230579938","submission_id_v1":"s100937364","cpu_time_v0":81,"cpu_time_v1":68,"memory_v0":9376,"memory_v1":9356,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":16.05,"input":"N=int(eval(input()))\n\np=[]\n\nr=0\n\n\n\nif N%2==0:\n\n c=0\n\n while N%2==0:\n\n N=N\/\/2\n\n c+=1\n\n p.append(c)\n\nfor i in range(3,int(N**0.5)+1,2):\n\n if N%i==0:\n\n c=0\n\n while N%i==0:\n\n N=N\/\/i\n\n c+=1\n\n p.append(c)\n\nif N!=1:\n\n p.append(1)\n\n \n\nwhile p:\n\n r+=int(((8*p.pop()+1)**0.5-1)\/2)\n\n \n\nprint(r)","target":"def f(n):\n\n p=[]\n\n if n%2==0:\n\n c=0\n\n while n%2==0:\n\n c+=1\n\n n\/=2\n\n p.append(c)\n\n for i in range(3,int(n**0.5)+1,2):\n\n if n%i==0:\n\n c=0\n\n while n%i==0:\n\n c+=1\n\n n\/=i\n\n p.append(c)\n\n if n!=1:\n\n p.append(1)\n\n return p\n\n \n\nN=int(eval(input()))\n\np=f(N)\n\nr=0\n\nwhile p:\n\n r+=int(((8*p.pop()+1)**0.5-1)\/2)\n\nprint(r)","code_v0_loc":24,"code_v1_loc":25,"code_v0_num_chars":310,"code_v1_num_chars":363,"code_v0_no_empty_lines":"N = int(eval(input()))\np = []\nr = 0\nif N % 2 == 0:\n c = 0\n while N % 2 == 0:\n N = N \/\/ 2\n c += 1\n p.append(c)\nfor i in range(3, int(N**0.5) + 1, 2):\n if N % i == 0:\n c = 0\n while N % i == 0:\n N = N \/\/ i\n c += 1\n p.append(c)\nif N != 1:\n p.append(1)\nwhile p:\n r += int(((8 * p.pop() + 1) ** 0.5 - 1) \/ 2)\nprint(r)\n","code_v1_no_empty_lines":"def f(n):\n p = []\n if n % 2 == 0:\n c = 0\n while n % 2 == 0:\n c += 1\n n \/= 2\n p.append(c)\n for i in range(3, int(n**0.5) + 1, 2):\n if n % i == 0:\n c = 0\n while n % i == 0:\n c += 1\n n \/= i\n p.append(c)\n if n != 1:\n p.append(1)\n return p\n\n\nN = int(eval(input()))\np = f(N)\nr = 0\nwhile p:\n r += int(((8 * p.pop() + 1) ** 0.5 - 1) \/ 2)\nprint(r)\n","code_same":false,"relative_loc_diff_percent":4.0,"diff":["+def f(n):","+ p = []","+ if n % 2 == 0:","+ c = 0","+ while n % 2 == 0:","+ c += 1","+ n \/= 2","+ p.append(c)","+ for i in range(3, int(n**0.5) + 1, 2):","+ if n % i == 0:","+ c = 0","+ while n % i == 0:","+ c += 1","+ n \/= i","+ p.append(c)","+ if n != 1:","+ p.append(1)","+ return p","+","+","-p = []","+p = f(N)","-if N % 2 == 0:","- c = 0","- while N % 2 == 0:","- N = N \/\/ 2","- c += 1","- p.append(c)","-for i in range(3, int(N**0.5) + 1, 2):","- if N % i == 0:","- c = 0","- while N % i == 0:","- N = N \/\/ i","- c += 1","- p.append(c)","-if N != 1:","- p.append(1)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0468387083,"measured_runtime_v1":0.0474315474,"runtime_lift":0.9875011648,"key":["s230579938","s100937364"]} +{"user_id":"u029000441","problem_id":"p02969","language":"python","submission_id_v0":"s196486819","submission_id_v1":"s139929818","cpu_time_v0":173,"cpu_time_v1":80,"memory_v0":38384,"memory_v1":65560,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":53.76,"input":"import sys\n\ninput = sys.stdin.readline\n\nimport math\n\nimport collections\n\ndef I(): return int(eval(input()))\n\ndef MI(): return list(map(int, input().split()))\n\ndef LI(): return list(map(int, input().split()))\n\n\n\nr=I()\n\nprint((3*r*r))","target":"def main():\n\n import sys\n\n input = sys.stdin.readline\n\n sys.setrecursionlimit(10**7)\n\n from collections import Counter, deque\n\n from collections import defaultdict\n\n from itertools import combinations, permutations, accumulate, groupby, product\n\n from bisect import bisect_left,bisect_right\n\n from heapq import heapify, heappop, heappush\n\n from math import floor, ceil,pi,factorial\n\n from operator import itemgetter\n\n def I(): return int(eval(input()))\n\n def MI(): return list(map(int, input().split()))\n\n def LI(): return list(map(int, input().split()))\n\n def LI2(): return [int(eval(input())) for i in range(n)]\n\n def MXI(): return [[LI()]for i in range(n)]\n\n def SI(): return input().rstrip()\n\n def printns(x): print(('\\n'.join(x)))\n\n def printni(x): print(('\\n'.join(list(map(str,x)))))\n\n inf = 10**17\n\n mod = 10**9 + 7\n\n#main code here!\n\n r=I()\n\n print((3*r**2))\n\n \n\n \n\n \n\n \n\n\n\n \n\n \n\n \n\n \n\n\n\n \n\nif __name__==\"__main__\":\n\n main()\n","code_v0_loc":10,"code_v1_loc":37,"code_v0_num_chars":218,"code_v1_num_chars":1050,"code_v0_no_empty_lines":"import sys\n\ninput = sys.stdin.readline\nimport math\nimport collections\n\n\ndef I():\n return int(eval(input()))\n\n\ndef MI():\n return list(map(int, input().split()))\n\n\ndef LI():\n return list(map(int, input().split()))\n\n\nr = I()\nprint((3 * r * r))\n","code_v1_no_empty_lines":"def main():\n import sys\n\n input = sys.stdin.readline\n sys.setrecursionlimit(10**7)\n from collections import Counter, deque\n from collections import defaultdict\n from itertools import combinations, permutations, accumulate, groupby, product\n from bisect import bisect_left, bisect_right\n from heapq import heapify, heappop, heappush\n from math import floor, ceil, pi, factorial\n from operator import itemgetter\n\n def I():\n return int(eval(input()))\n\n def MI():\n return list(map(int, input().split()))\n\n def LI():\n return list(map(int, input().split()))\n\n def LI2():\n return [int(eval(input())) for i in range(n)]\n\n def MXI():\n return [[LI()] for i in range(n)]\n\n def SI():\n return input().rstrip()\n\n def printns(x):\n print((\"\\n\".join(x)))\n\n def printni(x):\n print((\"\\n\".join(list(map(str, x)))))\n\n inf = 10**17\n mod = 10**9 + 7\n # main code here!\n r = I()\n print((3 * r**2))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":72.972972973,"diff":["-import sys","+def main():","+ import sys","-input = sys.stdin.readline","-import math","-import collections","+ input = sys.stdin.readline","+ sys.setrecursionlimit(10**7)","+ from collections import Counter, deque","+ from collections import defaultdict","+ from itertools import combinations, permutations, accumulate, groupby, product","+ from bisect import bisect_left, bisect_right","+ from heapq import heapify, heappop, heappush","+ from math import floor, ceil, pi, factorial","+ from operator import itemgetter","+","+ def I():","+ return int(eval(input()))","+","+ def MI():","+ return list(map(int, input().split()))","+","+ def LI():","+ return list(map(int, input().split()))","+","+ def LI2():","+ return [int(eval(input())) for i in range(n)]","+","+ def MXI():","+ return [[LI()] for i in range(n)]","+","+ def SI():","+ return input().rstrip()","+","+ def printns(x):","+ print((\"\\n\".join(x)))","+","+ def printni(x):","+ print((\"\\n\".join(list(map(str, x)))))","+","+ inf = 10**17","+ mod = 10**9 + 7","+ # main code here!","+ r = I()","+ print((3 * r**2))","-def I():","- return int(eval(input()))","-","-","-def MI():","- return list(map(int, input().split()))","-","-","-def LI():","- return list(map(int, input().split()))","-","-","-r = I()","-print((3 * r * r))","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0377271044,"measured_runtime_v1":0.0878271606,"runtime_lift":0.4295607892,"key":["s196486819","s139929818"]} +{"user_id":"u832039789","problem_id":"p03862","language":"python","submission_id_v0":"s653364814","submission_id_v1":"s186089339","cpu_time_v0":197,"cpu_time_v1":118,"memory_v0":14068,"memory_v1":14252,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":40.1,"input":"n,x = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\n\n\nres = float('inf')\n\nfor b in (a,a[::-1]):\n\n tmp = 0\n\n for i in range(n-1):\n\n if b[i]+b[i+1]>x:\n\n tmp += b[i] + b[i+1] - x\n\n if b[i]>x:\n\n b[i],b[i+1] = x,0\n\n else:\n\n b[i+1] = x - b[i]\n\n res = min(res,tmp)\n\n\n\nprint(res)\n","target":"n,x = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\n\n\nres = 0\n\nif a[0]>x:\n\n res += a[0] - x\n\n a[0] = x\n\nif a[-1]>x:\n\n res += a[-1] - x\n\n a[-1] = x\n\nfor i in range(n-1):\n\n if a[i]+a[i+1]>x:\n\n res += a[i] + a[i+1] - x\n\n a[i+1] -= a[i] + a[i+1] - x\n\nprint(res)\n","code_v0_loc":16,"code_v1_loc":15,"code_v0_num_chars":367,"code_v1_num_chars":303,"code_v0_no_empty_lines":"n, x = list(map(int, input().split()))\na = list(map(int, input().split()))\nres = float(\"inf\")\nfor b in (a, a[::-1]):\n tmp = 0\n for i in range(n - 1):\n if b[i] + b[i + 1] > x:\n tmp += b[i] + b[i + 1] - x\n if b[i] > x:\n b[i], b[i + 1] = x, 0\n else:\n b[i + 1] = x - b[i]\n res = min(res, tmp)\nprint(res)\n","code_v1_no_empty_lines":"n, x = list(map(int, input().split()))\na = list(map(int, input().split()))\nres = 0\nif a[0] > x:\n res += a[0] - x\n a[0] = x\nif a[-1] > x:\n res += a[-1] - x\n a[-1] = x\nfor i in range(n - 1):\n if a[i] + a[i + 1] > x:\n res += a[i] + a[i + 1] - x\n a[i + 1] -= a[i] + a[i + 1] - x\nprint(res)\n","code_same":false,"relative_loc_diff_percent":6.25,"diff":["-res = float(\"inf\")","-for b in (a, a[::-1]):","- tmp = 0","- for i in range(n - 1):","- if b[i] + b[i + 1] > x:","- tmp += b[i] + b[i + 1] - x","- if b[i] > x:","- b[i], b[i + 1] = x, 0","- else:","- b[i + 1] = x - b[i]","- res = min(res, tmp)","+res = 0","+if a[0] > x:","+ res += a[0] - x","+ a[0] = x","+if a[-1] > x:","+ res += a[-1] - x","+ a[-1] = x","+for i in range(n - 1):","+ if a[i] + a[i + 1] > x:","+ res += a[i] + a[i + 1] - x","+ a[i + 1] -= a[i] + a[i + 1] - x"],"diff_only_import_comment":false,"measured_runtime_v0":0.0363910949,"measured_runtime_v1":0.038099638,"runtime_lift":0.9551559237,"key":["s653364814","s186089339"]} +{"user_id":"u670567845","problem_id":"p03137","language":"python","submission_id_v0":"s398324896","submission_id_v1":"s351161059","cpu_time_v0":128,"cpu_time_v1":97,"memory_v0":13960,"memory_v1":20440,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":24.22,"input":"N, M = list(map(int,input().split()))\n\nX = list(map(int, input().split()))\n\nX.sort()\n\ndiff = []\n\nif M != 1:\n\n for i in range(M-1):\n\n diff.append(X[i+1]-X[i])\n\nelse:\n\n diff = [0]\n\n\n\nsorted_diff = sorted(diff)\n\nsorted_diff.reverse()\n\n\n\nans = sum(sorted_diff)\n\nfor i in range(min([N,M])-1):\n\n ans -= sorted_diff[i]\n\nprint(ans)","target":"N, M = list(map(int, input().split()))\n\nX = list(map(int, input().split()))\n\nX.sort()\n\nd = []\n\nfor i in range(M-1):\n\n d.append(X[i+1]-X[i])\n\nd.sort()\n\nif M-N >= 0:\n\n print((sum(d[0:M-N])))\n\nelse:\n\n print((0))","code_v0_loc":17,"code_v1_loc":11,"code_v0_num_chars":323,"code_v1_num_chars":201,"code_v0_no_empty_lines":"N, M = list(map(int, input().split()))\nX = list(map(int, input().split()))\nX.sort()\ndiff = []\nif M != 1:\n for i in range(M - 1):\n diff.append(X[i + 1] - X[i])\nelse:\n diff = [0]\nsorted_diff = sorted(diff)\nsorted_diff.reverse()\nans = sum(sorted_diff)\nfor i in range(min([N, M]) - 1):\n ans -= sorted_diff[i]\nprint(ans)\n","code_v1_no_empty_lines":"N, M = list(map(int, input().split()))\nX = list(map(int, input().split()))\nX.sort()\nd = []\nfor i in range(M - 1):\n d.append(X[i + 1] - X[i])\nd.sort()\nif M - N >= 0:\n print((sum(d[0 : M - N])))\nelse:\n print((0))\n","code_same":false,"relative_loc_diff_percent":35.2941176471,"diff":["-diff = []","-if M != 1:","- for i in range(M - 1):","- diff.append(X[i + 1] - X[i])","+d = []","+for i in range(M - 1):","+ d.append(X[i + 1] - X[i])","+d.sort()","+if M - N >= 0:","+ print((sum(d[0 : M - N])))","- diff = [0]","-sorted_diff = sorted(diff)","-sorted_diff.reverse()","-ans = sum(sorted_diff)","-for i in range(min([N, M]) - 1):","- ans -= sorted_diff[i]","-print(ans)","+ print((0))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0437803981,"measured_runtime_v1":0.0848945987,"runtime_lift":0.5157029868,"key":["s398324896","s351161059"]} +{"user_id":"u021019433","problem_id":"p02735","language":"python","submission_id_v0":"s763714689","submission_id_v1":"s455055096","cpu_time_v0":26,"cpu_time_v1":24,"memory_v0":3188,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":7.69,"input":"from itertools import count, repeat\n\n\n\nh = int(input().split()[0])\n\na0 = repeat('.')\n\nr0 = count()\n\nfor i in range(h):\n\n a = eval(input())\n\n r = [i]\n\n for x, y, z, u in zip(a0, '.' + a, a, r0):\n\n r.append(min(u + (x + z == '.#'), r[-1] + (y + z == '.#')))\n\n a0 = a\n\n r0 = r[1:]\n\nprint((r[-1]))\n","target":"from itertools import count, repeat\n\n\n\nh = int(input().split()[0])\n\na0 = repeat('.')\n\nr0 = count()\n\nfor i in range(h):\n\n a = eval(input())\n\n r = [i]\n\n for x, y, z, u in zip(a0, '.' + a, a, r0):\n\n r.append(min(u + (x > z), r[-1] + (y > z)))\n\n a0 = a\n\n r0 = r[1:]\n\nprint((r[-1]))\n","code_v0_loc":13,"code_v1_loc":13,"code_v0_num_chars":294,"code_v1_num_chars":278,"code_v0_no_empty_lines":"from itertools import count, repeat\n\nh = int(input().split()[0])\na0 = repeat(\".\")\nr0 = count()\nfor i in range(h):\n a = eval(input())\n r = [i]\n for x, y, z, u in zip(a0, \".\" + a, a, r0):\n r.append(min(u + (x + z == \".#\"), r[-1] + (y + z == \".#\")))\n a0 = a\n r0 = r[1:]\nprint((r[-1]))\n","code_v1_no_empty_lines":"from itertools import count, repeat\n\nh = int(input().split()[0])\na0 = repeat(\".\")\nr0 = count()\nfor i in range(h):\n a = eval(input())\n r = [i]\n for x, y, z, u in zip(a0, \".\" + a, a, r0):\n r.append(min(u + (x > z), r[-1] + (y > z)))\n a0 = a\n r0 = r[1:]\nprint((r[-1]))\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["- r.append(min(u + (x + z == \".#\"), r[-1] + (y + z == \".#\")))","+ r.append(min(u + (x > z), r[-1] + (y > z)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0466552987,"measured_runtime_v1":0.1089080239,"runtime_lift":0.4283917477,"key":["s763714689","s455055096"]} +{"user_id":"u268793453","problem_id":"p03999","language":"python","submission_id_v0":"s368726814","submission_id_v1":"s841050574","cpu_time_v0":26,"cpu_time_v1":20,"memory_v0":3060,"memory_v1":3060,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":23.08,"input":"import itertools as it\n\n\n\nS = eval(input())\n\nans = 0\n\n\n\nfor bits in it.product((True, False), repeat=len(S)-1):\n\n A = ''\n\n for s, bit in zip(S, bits + (0,)):\n\n A += s + '+'*bit\n\n ans += eval(A)\n\n\n\nprint(ans)","target":"S = eval(input())\n\n\n\nans = 0\n\n\n\ndef dfs(s, sum_, n):\n\n if n == len(S)-1:\n\n return int(s) + sum_\n\n\n\n return dfs(s+S[n+1], sum_, n+1) + dfs(S[n+1], sum_+int(s), n+1)\n\n\n\nprint((dfs(S[0], 0, 0)))","code_v0_loc":12,"code_v1_loc":11,"code_v0_num_chars":217,"code_v1_num_chars":196,"code_v0_no_empty_lines":"import itertools as it\n\nS = eval(input())\nans = 0\nfor bits in it.product((True, False), repeat=len(S) - 1):\n A = \"\"\n for s, bit in zip(S, bits + (0,)):\n A += s + \"+\" * bit\n ans += eval(A)\nprint(ans)\n","code_v1_no_empty_lines":"S = eval(input())\nans = 0\n\n\ndef dfs(s, sum_, n):\n if n == len(S) - 1:\n return int(s) + sum_\n return dfs(s + S[n + 1], sum_, n + 1) + dfs(S[n + 1], sum_ + int(s), n + 1)\n\n\nprint((dfs(S[0], 0, 0)))\n","code_same":false,"relative_loc_diff_percent":8.3333333333,"diff":["-import itertools as it","-","-for bits in it.product((True, False), repeat=len(S) - 1):","- A = \"\"","- for s, bit in zip(S, bits + (0,)):","- A += s + \"+\" * bit","- ans += eval(A)","-print(ans)","+","+","+def dfs(s, sum_, n):","+ if n == len(S) - 1:","+ return int(s) + sum_","+ return dfs(s + S[n + 1], sum_, n + 1) + dfs(S[n + 1], sum_ + int(s), n + 1)","+","+","+print((dfs(S[0], 0, 0)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.088366972,"measured_runtime_v1":0.069840176,"runtime_lift":1.2652741872,"key":["s368726814","s841050574"]} +{"user_id":"u952708174","problem_id":"p02900","language":"python","submission_id_v0":"s147386166","submission_id_v1":"s824988217","cpu_time_v0":702,"cpu_time_v1":397,"memory_v0":3316,"memory_v1":5052,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":43.45,"input":"def d_disjoint_set_of_common_divisors():\n\n A, B = [int(i) for i in input().split()]\n\n if A == 1 or B == 1:\n\n return 1\n\n\n\n def prime_factorization_dict(n):\n\n \"\"\"n\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u3068\u304d\u306e\u7d20\u6570\u306e\u8f9e\u66f8\"\"\"\n\n from collections import defaultdict\n\n if n == 1:\n\n return {2: 0} # 1\u306f\u7d20\u6570\u306e0\u4e57\u306e\u7a4d\u3068\u307f\u306a\u3059\n\n i, table = 2, defaultdict(int)\n\n while i**2 <= n:\n\n while n % i == 0:\n\n table[i] += 1\n\n n \/\/= i\n\n i += 1\n\n if n > 1:\n\n table[n] = 1\n\n return set(table.keys())\n\n a_primekey = prime_factorization_dict(A)\n\n b_primekey = prime_factorization_dict(B)\n\n ans = []\n\n for a in a_primekey:\n\n if a in b_primekey:\n\n ans.append(a)\n\n return len(ans) + 1\n\n\n\nprint((d_disjoint_set_of_common_divisors()))","target":"def d_disjoint_set_of_common_divisors():\n\n from fractions import gcd\n\n A, B = [int(i) for i in input().split()]\n\n\n\n def prime_factorization_dict(n):\n\n \"\"\"n\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u3068\u304d\u306e\u7d20\u6570\u3068\u305d\u306e\u6307\u6570\u306e\u8f9e\u66f8\"\"\"\n\n from collections import defaultdict\n\n if n == 1:\n\n return {2: 0} # 1\u306f\u7d20\u6570\u306e0\u4e57\u306e\u7a4d\u3068\u307f\u306a\u3059\n\n i, table = 2, defaultdict(int)\n\n while i**2 <= n:\n\n while n % i == 0:\n\n table[i] += 1\n\n n \/\/= i\n\n i += 1\n\n if n > 1:\n\n table[n] = 1\n\n return table\n\n g = gcd(A, B)\n\n return len(list(prime_factorization_dict(g).keys())) + 1 if g > 1 else 1\n\n\n\nprint((d_disjoint_set_of_common_divisors()))","code_v0_loc":28,"code_v1_loc":22,"code_v0_num_chars":823,"code_v1_num_chars":681,"code_v0_no_empty_lines":"def d_disjoint_set_of_common_divisors():\n A, B = [int(i) for i in input().split()]\n if A == 1 or B == 1:\n return 1\n\n def prime_factorization_dict(n):\n \"\"\"n\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u3068\u304d\u306e\u7d20\u6570\u306e\u8f9e\u66f8\"\"\"\n from collections import defaultdict\n\n if n == 1:\n return {2: 0} # 1\u306f\u7d20\u6570\u306e0\u4e57\u306e\u7a4d\u3068\u307f\u306a\u3059\n i, table = 2, defaultdict(int)\n while i**2 <= n:\n while n % i == 0:\n table[i] += 1\n n \/\/= i\n i += 1\n if n > 1:\n table[n] = 1\n return set(table.keys())\n\n a_primekey = prime_factorization_dict(A)\n b_primekey = prime_factorization_dict(B)\n ans = []\n for a in a_primekey:\n if a in b_primekey:\n ans.append(a)\n return len(ans) + 1\n\n\nprint((d_disjoint_set_of_common_divisors()))\n","code_v1_no_empty_lines":"def d_disjoint_set_of_common_divisors():\n from fractions import gcd\n\n A, B = [int(i) for i in input().split()]\n\n def prime_factorization_dict(n):\n \"\"\"n\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u3068\u304d\u306e\u7d20\u6570\u3068\u305d\u306e\u6307\u6570\u306e\u8f9e\u66f8\"\"\"\n from collections import defaultdict\n\n if n == 1:\n return {2: 0} # 1\u306f\u7d20\u6570\u306e0\u4e57\u306e\u7a4d\u3068\u307f\u306a\u3059\n i, table = 2, defaultdict(int)\n while i**2 <= n:\n while n % i == 0:\n table[i] += 1\n n \/\/= i\n i += 1\n if n > 1:\n table[n] = 1\n return table\n\n g = gcd(A, B)\n return len(list(prime_factorization_dict(g).keys())) + 1 if g > 1 else 1\n\n\nprint((d_disjoint_set_of_common_divisors()))\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["+ from fractions import gcd","+","- if A == 1 or B == 1:","- return 1","- \"\"\"n\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u3068\u304d\u306e\u7d20\u6570\u306e\u8f9e\u66f8\"\"\"","+ \"\"\"n\u3092\u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u3068\u304d\u306e\u7d20\u6570\u3068\u305d\u306e\u6307\u6570\u306e\u8f9e\u66f8\"\"\"","- return set(table.keys())","+ return table","- a_primekey = prime_factorization_dict(A)","- b_primekey = prime_factorization_dict(B)","- ans = []","- for a in a_primekey:","- if a in b_primekey:","- ans.append(a)","- return len(ans) + 1","+ g = gcd(A, B)","+ return len(list(prime_factorization_dict(g).keys())) + 1 if g > 1 else 1"],"diff_only_import_comment":false,"measured_runtime_v0":0.0423327427,"measured_runtime_v1":0.0543867414,"runtime_lift":0.7783651234,"key":["s147386166","s824988217"]} +{"user_id":"u334712262","problem_id":"p03039","language":"python","submission_id_v0":"s855626790","submission_id_v1":"s395709946","cpu_time_v0":466,"cpu_time_v1":233,"memory_v0":29268,"memory_v1":80876,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":50.0,"input":"# -*- coding: utf-8 -*-\n\nimport bisect\n\nimport heapq\n\nimport math\n\nimport random\n\nimport sys\n\nfrom collections import Counter, defaultdict, deque\n\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\n\nfrom functools import lru_cache, reduce\n\nfrom itertools import combinations, combinations_with_replacement, product, permutations\n\nfrom operator import add, mul, sub\n\n\n\nsys.setrecursionlimit(100000)\n\n\n\n\n\ndef read_int():\n\n return int(input())\n\n\n\n\n\ndef read_int_n():\n\n return list(map(int, input().split()))\n\n\n\n\n\ndef read_float():\n\n return float(input())\n\n\n\n\n\ndef read_float_n():\n\n return list(map(float, input().split()))\n\n\n\n\n\ndef read_str():\n\n return input().strip()\n\n\n\n\n\ndef read_str_n():\n\n return list(map(str, input().split()))\n\n\n\n\n\ndef error_print(*args):\n\n print(*args, file=sys.stderr)\n\n\n\n\n\ndef mt(f):\n\n import time\n\n\n\n def wrap(*args, **kwargs):\n\n s = time.time()\n\n ret = f(*args, **kwargs)\n\n e = time.time()\n\n\n\n error_print(e - s, 'sec')\n\n return ret\n\n\n\n return wrap\n\n\n\n\n\nclass Mod:\n\n def __init__(self, m):\n\n self.m = m\n\n\n\n def add(self, a, b):\n\n return (a + b) % self.m\n\n\n\n def sub(self, a, b):\n\n return (a - b) % self.m\n\n\n\n def mul(self, a, b):\n\n return ((a % self.m) * (b % self.m)) % self.m\n\n\n\n def div(self, a, b):\n\n return self.mul(a, self.pow(b, self.m-2))\n\n\n\n def pow(self, x, y):\n\n if y == 0:\n\n return 1\n\n elif y == 1:\n\n return x % self.m\n\n elif y % 2 == 0:\n\n return self.pow(x, y\/\/2)**2 % self.m\n\n else:\n\n return self.pow(x, y\/\/2)**2 * x % self.m\n\n\n\n\n\nclass Combination:\n\n def __init__(self, n, mod):\n\n\n\n g1 = [1, 1]\n\n g2 = [1, 1]\n\n inverse = [0, 1]\n\n for i in range(2, n + 1):\n\n g1.append((g1[-1] * i) % mod)\n\n inverse.append((-inverse[mod % i] * (mod\/\/i)) % mod)\n\n g2.append((g2[-1] * inverse[-1]) % mod)\n\n self.MOD = mod\n\n self.N = n\n\n self.g1 = g1\n\n self.g2 = g2\n\n self.inverse = inverse\n\n\n\n def __call__(self, n, r):\n\n if (r < 0 or r > n):\n\n return 0\n\n r = min(r, n-r)\n\n return self.g1[n] * self.g2[r] * self.g2[n-r] % self.MOD\n\n\n\n\n\n@mt\n\ndef slv(N, M, K):\n\n m = Mod(10**9+7)\n\n b = Combination(N*M, 10**9+7)(N*M-2, K-2)\n\n\n\n MM = m.mul(M, M)\n\n NN = m.mul(N, N)\n\n ans = 0\n\n for d in range(1, N):\n\n ans = m.add(ans, m.mul(m.mul(m.mul(d, N-d), MM), b))\n\n\n\n for d in range(1, M):\n\n ans = m.add(ans, m.mul(m.mul(m.mul(d, M-d), NN), b))\n\n\n\n return ans\n\n\n\n\n\ndef main():\n\n N, M, K = read_int_n()\n\n print(slv(N, M, K))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","target":"# -*- coding: utf-8 -*-\n\nimport sys\n\n# sys.setrecursionlimit(10**6)\n\n# buff_readline = sys.stdin.buffer.readline\n\nbuff_readline = sys.stdin.readline\n\nreadline = sys.stdin.readline\n\n\n\nINF = 2**62-1\n\n\n\n\n\ndef read_int():\n\n return int(buff_readline())\n\n\n\n\n\ndef read_int_n():\n\n return list(map(int, buff_readline().split()))\n\n\n\n\n\ndef read_float():\n\n return float(buff_readline())\n\n\n\n\n\ndef read_float_n():\n\n return list(map(float, buff_readline().split()))\n\n\n\n\n\ndef read_str():\n\n return readline().strip()\n\n\n\n\n\ndef read_str_n():\n\n return readline().strip().split()\n\n\n\n\n\ndef error_print(*args):\n\n print(*args, file=sys.stderr)\n\n\n\n\n\ndef mt(f):\n\n import time\n\n\n\n def wrap(*args, **kwargs):\n\n s = time.time()\n\n ret = f(*args, **kwargs)\n\n e = time.time()\n\n\n\n error_print(e - s, 'sec')\n\n return ret\n\n\n\n return wrap\n\n\n\n\n\nclass Combination:\n\n def __init__(self, n, mod):\n\n\n\n g1 = [1, 1]\n\n g2 = [1, 1]\n\n inverse = [0, 1]\n\n for i in range(2, n + 1):\n\n g1.append((g1[-1] * i) % mod)\n\n inverse.append((-inverse[mod % i] * (mod\/\/i)) % mod)\n\n g2.append((g2[-1] * inverse[-1]) % mod)\n\n self.MOD = mod\n\n self.N = n\n\n self.g1 = g1\n\n self.g2 = g2\n\n self.inverse = inverse\n\n\n\n def __call__(self, n, r):\n\n if (r < 0 or r > n):\n\n return 0\n\n r = min(r, n-r)\n\n return self.g1[n] * self.g2[r] * self.g2[n-r] % self.MOD\n\n\n\n\n\n@mt\n\ndef slv(N, M, K):\n\n mod = 10**9+7\n\n C = Combination(N*M, mod)\n\n b = C(N*M-2, K-2)\n\n ans = 0\n\n m = M**2\n\n for d in range(1, N):\n\n ans += (N-d) * b * d * m\n\n ans %= mod\n\n m = N**2\n\n for d in range(1, M):\n\n ans += (M-d) * b * d * m\n\n ans %= mod\n\n\n\n\n\n\n\n return ans\n\n\n\n\n\n\n\ndef main():\n\n N, M, K = read_int_n()\n\n print(slv(N, M, K))\n\n\n\n\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":131,"code_v1_loc":103,"code_v0_num_chars":2750,"code_v1_num_chars":1930,"code_v0_no_empty_lines":"# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\nfrom operator import add, mul, sub\n\nsys.setrecursionlimit(100000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input().strip()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n error_print(e - s, \"sec\")\n return ret\n\n return wrap\n\n\nclass Mod:\n def __init__(self, m):\n self.m = m\n\n def add(self, a, b):\n return (a + b) % self.m\n\n def sub(self, a, b):\n return (a - b) % self.m\n\n def mul(self, a, b):\n return ((a % self.m) * (b % self.m)) % self.m\n\n def div(self, a, b):\n return self.mul(a, self.pow(b, self.m - 2))\n\n def pow(self, x, y):\n if y == 0:\n return 1\n elif y == 1:\n return x % self.m\n elif y % 2 == 0:\n return self.pow(x, y \/\/ 2) ** 2 % self.m\n else:\n return self.pow(x, y \/\/ 2) ** 2 * x % self.m\n\n\nclass Combination:\n def __init__(self, n, mod):\n g1 = [1, 1]\n g2 = [1, 1]\n inverse = [0, 1]\n for i in range(2, n + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\n self.MOD = mod\n self.N = n\n self.g1 = g1\n self.g2 = g2\n self.inverse = inverse\n\n def __call__(self, n, r):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD\n\n\n@mt\ndef slv(N, M, K):\n m = Mod(10**9 + 7)\n b = Combination(N * M, 10**9 + 7)(N * M - 2, K - 2)\n MM = m.mul(M, M)\n NN = m.mul(N, N)\n ans = 0\n for d in range(1, N):\n ans = m.add(ans, m.mul(m.mul(m.mul(d, N - d), MM), b))\n for d in range(1, M):\n ans = m.add(ans, m.mul(m.mul(m.mul(d, M - d), NN), b))\n return ans\n\n\ndef main():\n N, M, K = read_int_n()\n print(slv(N, M, K))\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"# -*- coding: utf-8 -*-\nimport sys\n\n# sys.setrecursionlimit(10**6)\n# buff_readline = sys.stdin.buffer.readline\nbuff_readline = sys.stdin.readline\nreadline = sys.stdin.readline\nINF = 2**62 - 1\n\n\ndef read_int():\n return int(buff_readline())\n\n\ndef read_int_n():\n return list(map(int, buff_readline().split()))\n\n\ndef read_float():\n return float(buff_readline())\n\n\ndef read_float_n():\n return list(map(float, buff_readline().split()))\n\n\ndef read_str():\n return readline().strip()\n\n\ndef read_str_n():\n return readline().strip().split()\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n error_print(e - s, \"sec\")\n return ret\n\n return wrap\n\n\nclass Combination:\n def __init__(self, n, mod):\n g1 = [1, 1]\n g2 = [1, 1]\n inverse = [0, 1]\n for i in range(2, n + 1):\n g1.append((g1[-1] * i) % mod)\n inverse.append((-inverse[mod % i] * (mod \/\/ i)) % mod)\n g2.append((g2[-1] * inverse[-1]) % mod)\n self.MOD = mod\n self.N = n\n self.g1 = g1\n self.g2 = g2\n self.inverse = inverse\n\n def __call__(self, n, r):\n if r < 0 or r > n:\n return 0\n r = min(r, n - r)\n return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD\n\n\n@mt\ndef slv(N, M, K):\n mod = 10**9 + 7\n C = Combination(N * M, mod)\n b = C(N * M - 2, K - 2)\n ans = 0\n m = M**2\n for d in range(1, N):\n ans += (N - d) * b * d * m\n ans %= mod\n m = N**2\n for d in range(1, M):\n ans += (M - d) * b * d * m\n ans %= mod\n return ans\n\n\ndef main():\n N, M, K = read_int_n()\n print(slv(N, M, K))\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":21.3740458015,"diff":["-import bisect","-import heapq","-import math","-import random","-from collections import Counter, defaultdict, deque","-from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal","-from functools import lru_cache, reduce","-from itertools import combinations, combinations_with_replacement, product, permutations","-from operator import add, mul, sub","-sys.setrecursionlimit(100000)","+# sys.setrecursionlimit(10**6)","+# buff_readline = sys.stdin.buffer.readline","+buff_readline = sys.stdin.readline","+readline = sys.stdin.readline","+INF = 2**62 - 1","- return int(input())","+ return int(buff_readline())","- return list(map(int, input().split()))","+ return list(map(int, buff_readline().split()))","- return float(input())","+ return float(buff_readline())","- return list(map(float, input().split()))","+ return list(map(float, buff_readline().split()))","- return input().strip()","+ return readline().strip()","- return list(map(str, input().split()))","+ return readline().strip().split()","-","-","-class Mod:","- def __init__(self, m):","- self.m = m","-","- def add(self, a, b):","- return (a + b) % self.m","-","- def sub(self, a, b):","- return (a - b) % self.m","-","- def mul(self, a, b):","- return ((a % self.m) * (b % self.m)) % self.m","-","- def div(self, a, b):","- return self.mul(a, self.pow(b, self.m - 2))","-","- def pow(self, x, y):","- if y == 0:","- return 1","- elif y == 1:","- return x % self.m","- elif y % 2 == 0:","- return self.pow(x, y \/\/ 2) ** 2 % self.m","- else:","- return self.pow(x, y \/\/ 2) ** 2 * x % self.m","- m = Mod(10**9 + 7)","- b = Combination(N * M, 10**9 + 7)(N * M - 2, K - 2)","- MM = m.mul(M, M)","- NN = m.mul(N, N)","+ mod = 10**9 + 7","+ C = Combination(N * M, mod)","+ b = C(N * M - 2, K - 2)","+ m = M**2","- ans = m.add(ans, m.mul(m.mul(m.mul(d, N - d), MM), b))","+ ans += (N - d) * b * d * m","+ ans %= mod","+ m = N**2","- ans = m.add(ans, m.mul(m.mul(m.mul(d, M - d), NN), b))","+ ans += (M - d) * b * d * m","+ ans %= mod"],"diff_only_import_comment":false,"measured_runtime_v0":0.1955783727,"measured_runtime_v1":0.0845155106,"runtime_lift":2.3141121837,"key":["s855626790","s395709946"]} +{"user_id":"u102461423","problem_id":"p03580","language":"python","submission_id_v0":"s126052085","submission_id_v1":"s941731230","cpu_time_v0":401,"cpu_time_v1":294,"memory_v0":8360,"memory_v1":8360,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.68,"input":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(readline())\n\nS = readline().rstrip().decode('utf-8')\n\n\n\ndef solve_partial(S):\n\n INF = 10**18\n\n \"\"\"\n\n \u30fbS\u306f1\u304b\u3089\u59cb\u307e\u308a\u30011\u3067\u7d42\u308f\u308b\n\n \u30fbS\u306f00\u3092\u542b\u307e\u306a\u3044\n\n \u30fb\u3057\u305f\u304c\u3063\u3066\u3001S\u306f1,01\u306b\u5206\u89e3\u53ef\u80fd\n\n \u30fb\u6b8b\u308b\u6700\u5c0f\u500b\u6570\u3092\u8abf\u3079\u308bdp\u3002\u3053\u308c\u306f\u30011, 101111,111101 \u306e3\u7a2e\u3092\u6570\u3048\u308b\u3053\u3068\u3068\u540c\u3058\n\n \u30fba, b0cccc, dddd0e \u3068\u3057\u3066\u3001\u300c\u73fe\u5728\u306e1\u304c\u3069\u308c\u3067\u3042\u308b\u304b -> \u6700\u5c0f\u500b\u6570\u300d\u3067dp\n\n \u30fb\u500b\u6570\u306fa,b,e\u306e\u3068\u304d\u306b\u6570\u3048\u308b\n\n \"\"\"\n\n S = S.replace('01','2')\n\n a,b,c,d,e = 1,1,INF,0,INF\n\n for x in S[1:]:\n\n if x == '1':\n\n a2 = min(a,c,e)+1\n\n b2 = min(a,c,e)+1\n\n c2 = c\n\n d2 = min(a,c,d,e)\n\n e2 = INF\n\n else:\n\n a2 = min(a,c,e)+1\n\n b2 = min(a,c,e)+1\n\n c2 = b\n\n d2 = min(a,c,e)\n\n e2 = d+1\n\n a,b,c,d,e = a2,b2,c2,d2,e2\n\n return len(S)-min(a,c,e)\n\n\n\nanswer = 0\n\nfor x in S.split('00'):\n\n x = x.strip('0')\n\n if x:\n\n answer += solve_partial(x)\n\n\n\nprint(answer)","target":"import sys\n\nread = sys.stdin.buffer.read\n\nreadline = sys.stdin.buffer.readline\n\nreadlines = sys.stdin.buffer.readlines\n\n\n\nN = int(readline())\n\nS = readline().rstrip().decode('utf-8')\n\n\n\ndef solve_partial(S):\n\n INF = 10**18\n\n \"\"\"\n\n \u30fbS\u306f1\u304b\u3089\u59cb\u307e\u308a\u30011\u3067\u7d42\u308f\u308b\n\n \u30fbS\u306f00\u3092\u542b\u307e\u306a\u3044\n\n \u30fb\u3057\u305f\u304c\u3063\u3066\u3001S\u306f1,01\u306b\u5206\u89e3\u53ef\u80fd\n\n \u30fb\u6b8b\u308b\u6700\u5c0f\u500b\u6570\u3092\u8abf\u3079\u308bdp\u3002\u3053\u308c\u306f\u30011, 101111,111101 \u306e3\u7a2e\u3092\u6570\u3048\u308b\u3053\u3068\u3068\u540c\u3058\n\n \u30fba, b0cccc, dddd0e \u3068\u3057\u3066\u3001\u300c\u73fe\u5728\u306e1\u304c\u3069\u308c\u3067\u3042\u308b\u304b -> \u6700\u5c0f\u500b\u6570\u300d\u3067dp\n\n \u30fb\u500b\u6570\u306fa,b,e\u306e\u3068\u304d\u306b\u6570\u3048\u308b\n\n \"\"\"\n\n S = S.replace('01','2')\n\n a,b,c,d,e = 1,1,INF,0,INF\n\n for x in S[1:]:\n\n if x == '1':\n\n a2 = min(a,c,e)+1\n\n c2 = c\n\n d2 = min(a,c,d,e)\n\n e2 = INF\n\n else:\n\n a2 = min(a,c,e)+1\n\n c2 = a\n\n d2 = min(a,c,e)\n\n e2 = d+1\n\n a,c,d,e = a2,c2,d2,e2\n\n return len(S)-min(a,c,e)\n\n\n\nanswer = 0\n\nfor x in S.split('00'):\n\n x = x.strip('0')\n\n if x:\n\n answer += solve_partial(x)\n\n\n\nprint(answer)","code_v0_loc":43,"code_v1_loc":41,"code_v0_num_chars":1009,"code_v1_num_chars":942,"code_v0_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nS = readline().rstrip().decode(\"utf-8\")\n\n\ndef solve_partial(S):\n INF = 10**18\n \"\"\"\n \u30fbS\u306f1\u304b\u3089\u59cb\u307e\u308a\u30011\u3067\u7d42\u308f\u308b\n \u30fbS\u306f00\u3092\u542b\u307e\u306a\u3044\n \u30fb\u3057\u305f\u304c\u3063\u3066\u3001S\u306f1,01\u306b\u5206\u89e3\u53ef\u80fd\n \u30fb\u6b8b\u308b\u6700\u5c0f\u500b\u6570\u3092\u8abf\u3079\u308bdp\u3002\u3053\u308c\u306f\u30011, 101111,111101 \u306e3\u7a2e\u3092\u6570\u3048\u308b\u3053\u3068\u3068\u540c\u3058\n \u30fba, b0cccc, dddd0e \u3068\u3057\u3066\u3001\u300c\u73fe\u5728\u306e1\u304c\u3069\u308c\u3067\u3042\u308b\u304b -> \u6700\u5c0f\u500b\u6570\u300d\u3067dp\n \u30fb\u500b\u6570\u306fa,b,e\u306e\u3068\u304d\u306b\u6570\u3048\u308b\n \"\"\"\n S = S.replace(\"01\", \"2\")\n a, b, c, d, e = 1, 1, INF, 0, INF\n for x in S[1:]:\n if x == \"1\":\n a2 = min(a, c, e) + 1\n b2 = min(a, c, e) + 1\n c2 = c\n d2 = min(a, c, d, e)\n e2 = INF\n else:\n a2 = min(a, c, e) + 1\n b2 = min(a, c, e) + 1\n c2 = b\n d2 = min(a, c, e)\n e2 = d + 1\n a, b, c, d, e = a2, b2, c2, d2, e2\n return len(S) - min(a, c, e)\n\n\nanswer = 0\nfor x in S.split(\"00\"):\n x = x.strip(\"0\")\n if x:\n answer += solve_partial(x)\nprint(answer)\n","code_v1_no_empty_lines":"import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nN = int(readline())\nS = readline().rstrip().decode(\"utf-8\")\n\n\ndef solve_partial(S):\n INF = 10**18\n \"\"\"\n \u30fbS\u306f1\u304b\u3089\u59cb\u307e\u308a\u30011\u3067\u7d42\u308f\u308b\n \u30fbS\u306f00\u3092\u542b\u307e\u306a\u3044\n \u30fb\u3057\u305f\u304c\u3063\u3066\u3001S\u306f1,01\u306b\u5206\u89e3\u53ef\u80fd\n \u30fb\u6b8b\u308b\u6700\u5c0f\u500b\u6570\u3092\u8abf\u3079\u308bdp\u3002\u3053\u308c\u306f\u30011, 101111,111101 \u306e3\u7a2e\u3092\u6570\u3048\u308b\u3053\u3068\u3068\u540c\u3058\n \u30fba, b0cccc, dddd0e \u3068\u3057\u3066\u3001\u300c\u73fe\u5728\u306e1\u304c\u3069\u308c\u3067\u3042\u308b\u304b -> \u6700\u5c0f\u500b\u6570\u300d\u3067dp\n \u30fb\u500b\u6570\u306fa,b,e\u306e\u3068\u304d\u306b\u6570\u3048\u308b\n \"\"\"\n S = S.replace(\"01\", \"2\")\n a, b, c, d, e = 1, 1, INF, 0, INF\n for x in S[1:]:\n if x == \"1\":\n a2 = min(a, c, e) + 1\n c2 = c\n d2 = min(a, c, d, e)\n e2 = INF\n else:\n a2 = min(a, c, e) + 1\n c2 = a\n d2 = min(a, c, e)\n e2 = d + 1\n a, c, d, e = a2, c2, d2, e2\n return len(S) - min(a, c, e)\n\n\nanswer = 0\nfor x in S.split(\"00\"):\n x = x.strip(\"0\")\n if x:\n answer += solve_partial(x)\nprint(answer)\n","code_same":false,"relative_loc_diff_percent":4.6511627907,"diff":["- b2 = min(a, c, e) + 1","- b2 = min(a, c, e) + 1","- c2 = b","+ c2 = a","- a, b, c, d, e = a2, b2, c2, d2, e2","+ a, c, d, e = a2, c2, d2, e2"],"diff_only_import_comment":false,"measured_runtime_v0":0.0422050378,"measured_runtime_v1":0.0369185278,"runtime_lift":1.1431939544,"key":["s126052085","s941731230"]} +{"user_id":"u875291233","problem_id":"p02563","language":"python","submission_id_v0":"s687642386","submission_id_v1":"s774763559","cpu_time_v0":2063,"cpu_time_v1":834,"memory_v0":343380,"memory_v1":189116,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":59.57,"input":"ROOT = 3\n\nMOD = 998244353\n\npn = [pow(ROOT,(MOD-1)>>i,MOD) for i in range(30)]\n\n\n\ndef ntt_rec(a,n):\n\n if n==0:\n\n return a[:]\n\n if n==1:\n\n return [a[0]+a[1],a[0]-a[1]]\n\n\n\n b = ntt_rec(a[::2],n-1)\n\n c = ntt_rec(a[1::2],n-1)\n\n \n\n N = 1<<(n-1)\n\n res = [0]*(N*2)\n\n w_N = 1\n\n for k in range(N):\n\n res[k] = (b[k] + w_N*c[k])%MOD\n\n res[k+N] = (b[k] - w_N*c[k])%MOD\n\n w_N = w_N*pn[n]%MOD\n\n return res\n\n\n\ndef intt_rec(a,n):\n\n res = ntt_rec(a[0:1]+a[1:][::-1],n)\n\n inv = pow(1<= N:\n\n n += 1\n\n N <<= 1\n\n \n\n a += [0]*(N-len(a))\n\n b += [0]*(N-len(b))\n\n \n\n #print(ntt_rec(a,n))\n\n return intt_rec([ai*bi%MOD for ai,bi in zip(ntt_rec(a,n),ntt_rec(b,n))],n)\n\n\n\nn,m = list(map(int,input().split()))\n\na = list(map(int,input().split()))\n\nb = list(map(int,input().split()))\n\n#*a, = [1]*10**5\n\n#*b, = [1]*10**5\n\nL = len(a)+len(b)\n\nc = convolution(a,b)\n\nprint((*c[:L-1]))\n","target":"ROOT = 3\n\nMOD = 998244353\n\nroots = [pow(ROOT,(MOD-1)>>i,MOD) for i in range(24)] # 1 \u306e 2^i \u4e57\u6839\n\niroots = [pow(x,MOD-2,MOD) for x in roots] # 1 \u306e 2^i \u4e57\u6839\u306e\u9006\u5143\n\n\n\ndef untt(a,n):\n\n for i in range(n):\n\n m = 1<<(n-i-1)\n\n for s in range(1<> i, MOD) for i in range(30)]\n\n\ndef ntt_rec(a, n):\n if n == 0:\n return a[:]\n if n == 1:\n return [a[0] + a[1], a[0] - a[1]]\n b = ntt_rec(a[::2], n - 1)\n c = ntt_rec(a[1::2], n - 1)\n N = 1 << (n - 1)\n res = [0] * (N * 2)\n w_N = 1\n for k in range(N):\n res[k] = (b[k] + w_N * c[k]) % MOD\n res[k + N] = (b[k] - w_N * c[k]) % MOD\n w_N = w_N * pn[n] % MOD\n return res\n\n\ndef intt_rec(a, n):\n res = ntt_rec(a[0:1] + a[1:][::-1], n)\n inv = pow(1 << n, MOD - 2, MOD)\n for i in range(1 << n):\n res[i] = res[i] * inv % MOD\n return res\n\n\ndef convolution(a, b):\n deg = len(a) + len(b) - 1\n n = 0\n N = 1\n while deg * 2 >= N:\n n += 1\n N <<= 1\n a += [0] * (N - len(a))\n b += [0] * (N - len(b))\n # print(ntt_rec(a,n))\n return intt_rec([ai * bi % MOD for ai, bi in zip(ntt_rec(a, n), ntt_rec(b, n))], n)\n\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\n# *a, = [1]*10**5\n# *b, = [1]*10**5\nL = len(a) + len(b)\nc = convolution(a, b)\nprint((*c[: L - 1]))\n","code_v1_no_empty_lines":"ROOT = 3\nMOD = 998244353\nroots = [pow(ROOT, (MOD - 1) >> i, MOD) for i in range(24)] # 1 \u306e 2^i \u4e57\u6839\niroots = [pow(x, MOD - 2, MOD) for x in roots] # 1 \u306e 2^i \u4e57\u6839\u306e\u9006\u5143\n\n\ndef untt(a, n):\n for i in range(n):\n m = 1 << (n - i - 1)\n for s in range(1 << i):\n w_N = 1\n s *= m * 2\n for p in range(m):\n a[s + p], a[s + p + m] = (a[s + p] + a[s + p + m]) % MOD, (\n a[s + p] - a[s + p + m]\n ) * w_N % MOD\n w_N = w_N * roots[n - i] % MOD\n\n\ndef iuntt(a, n):\n for i in range(n):\n m = 1 << i\n for s in range(1 << (n - i - 1)):\n w_N = 1\n s *= m * 2\n for p in range(m):\n a[s + p], a[s + p + m] = (a[s + p] + a[s + p + m] * w_N) % MOD, (\n a[s + p] - a[s + p + m] * w_N\n ) % MOD\n w_N = w_N * iroots[i + 1] % MOD\n inv = pow((MOD + 1) \/\/ 2, n, MOD)\n for i in range(1 << n):\n a[i] = a[i] * inv % MOD\n\n\ndef convolution(a, b):\n deg = len(a) + len(b) - 2\n n = deg.bit_length()\n N = 1 << n\n a += [0] * (N - len(a))\n b += [0] * (N - len(b))\n untt(a, n)\n untt(b, n)\n for i in range(N):\n a[i] = a[i] * b[i] % MOD\n iuntt(a, n)\n return a[: deg + 1]\n\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = convolution(a, b)\nprint((*c))\n","code_same":false,"relative_loc_diff_percent":9.6153846154,"diff":["-pn = [pow(ROOT, (MOD - 1) >> i, MOD) for i in range(30)]","+roots = [pow(ROOT, (MOD - 1) >> i, MOD) for i in range(24)] # 1 \u306e 2^i \u4e57\u6839","+iroots = [pow(x, MOD - 2, MOD) for x in roots] # 1 \u306e 2^i \u4e57\u6839\u306e\u9006\u5143","-def ntt_rec(a, n):","- if n == 0:","- return a[:]","- if n == 1:","- return [a[0] + a[1], a[0] - a[1]]","- b = ntt_rec(a[::2], n - 1)","- c = ntt_rec(a[1::2], n - 1)","- N = 1 << (n - 1)","- res = [0] * (N * 2)","- w_N = 1","- for k in range(N):","- res[k] = (b[k] + w_N * c[k]) % MOD","- res[k + N] = (b[k] - w_N * c[k]) % MOD","- w_N = w_N * pn[n] % MOD","- return res","+def untt(a, n):","+ for i in range(n):","+ m = 1 << (n - i - 1)","+ for s in range(1 << i):","+ w_N = 1","+ s *= m * 2","+ for p in range(m):","+ a[s + p], a[s + p + m] = (a[s + p] + a[s + p + m]) % MOD, (","+ a[s + p] - a[s + p + m]","+ ) * w_N % MOD","+ w_N = w_N * roots[n - i] % MOD","-def intt_rec(a, n):","- res = ntt_rec(a[0:1] + a[1:][::-1], n)","- inv = pow(1 << n, MOD - 2, MOD)","+def iuntt(a, n):","+ for i in range(n):","+ m = 1 << i","+ for s in range(1 << (n - i - 1)):","+ w_N = 1","+ s *= m * 2","+ for p in range(m):","+ a[s + p], a[s + p + m] = (a[s + p] + a[s + p + m] * w_N) % MOD, (","+ a[s + p] - a[s + p + m] * w_N","+ ) % MOD","+ w_N = w_N * iroots[i + 1] % MOD","+ inv = pow((MOD + 1) \/\/ 2, n, MOD)","- res[i] = res[i] * inv % MOD","- return res","+ a[i] = a[i] * inv % MOD","- deg = len(a) + len(b) - 1","- n = 0","- N = 1","- while deg * 2 >= N:","- n += 1","- N <<= 1","+ deg = len(a) + len(b) - 2","+ n = deg.bit_length()","+ N = 1 << n","- # print(ntt_rec(a,n))","- return intt_rec([ai * bi % MOD for ai, bi in zip(ntt_rec(a, n), ntt_rec(b, n))], n)","+ untt(a, n)","+ untt(b, n)","+ for i in range(N):","+ a[i] = a[i] * b[i] % MOD","+ iuntt(a, n)","+ return a[: deg + 1]","-# *a, = [1]*10**5","-# *b, = [1]*10**5","-L = len(a) + len(b)","-print((*c[: L - 1]))","+print((*c))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0635839385,"measured_runtime_v1":0.0401741914,"runtime_lift":1.5827061179,"key":["s687642386","s774763559"]} +{"user_id":"u077291787","problem_id":"p03160","language":"python","submission_id_v0":"s631639694","submission_id_v1":"s508681868","cpu_time_v0":161,"cpu_time_v1":118,"memory_v0":13980,"memory_v1":13928,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":26.71,"input":"# EduDPA - Frog 1\n\nn = int(eval(input()))\n\nlst = list(map(int, input().rstrip().split()))\n\nans = [0, abs(lst[0] - lst[1])] + [float(\"inf\")] * (n - 2)\n\nfor i in range(2, n):\n\n ans[i] = min(ans[i], ans[i - 1] + abs(lst[i] - lst[i - 1]))\n\n ans[i] = min(ans[i], ans[i - 2] + abs(lst[i] - lst[i - 2]))\n\n\n\nprint((ans[-1]))","target":"# EduDPA - Frog 1\n\nn = int(eval(input()))\n\nlst = list(map(int, input().rstrip().split()))\n\na, b = 0, abs(lst[0] - lst[1])\n\nfor i in range(2, n):\n\n dif_1 = a + abs(lst[i] - lst[i - 2])\n\n dif_2 = b + abs(lst[i] - lst[i - 1])\n\n a, b = b, min(dif_1, dif_2)\n\nprint(b)","code_v0_loc":9,"code_v1_loc":9,"code_v0_num_chars":314,"code_v1_num_chars":265,"code_v0_no_empty_lines":"# EduDPA - Frog 1\nn = int(eval(input()))\nlst = list(map(int, input().rstrip().split()))\nans = [0, abs(lst[0] - lst[1])] + [float(\"inf\")] * (n - 2)\nfor i in range(2, n):\n ans[i] = min(ans[i], ans[i - 1] + abs(lst[i] - lst[i - 1]))\n ans[i] = min(ans[i], ans[i - 2] + abs(lst[i] - lst[i - 2]))\nprint((ans[-1]))\n","code_v1_no_empty_lines":"# EduDPA - Frog 1\nn = int(eval(input()))\nlst = list(map(int, input().rstrip().split()))\na, b = 0, abs(lst[0] - lst[1])\nfor i in range(2, n):\n dif_1 = a + abs(lst[i] - lst[i - 2])\n dif_2 = b + abs(lst[i] - lst[i - 1])\n a, b = b, min(dif_1, dif_2)\nprint(b)\n","code_same":false,"relative_loc_diff_percent":0.0,"diff":["-ans = [0, abs(lst[0] - lst[1])] + [float(\"inf\")] * (n - 2)","+a, b = 0, abs(lst[0] - lst[1])","- ans[i] = min(ans[i], ans[i - 1] + abs(lst[i] - lst[i - 1]))","- ans[i] = min(ans[i], ans[i - 2] + abs(lst[i] - lst[i - 2]))","-print((ans[-1]))","+ dif_1 = a + abs(lst[i] - lst[i - 2])","+ dif_2 = b + abs(lst[i] - lst[i - 1])","+ a, b = b, min(dif_1, dif_2)","+print(b)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0457068245,"measured_runtime_v1":0.0375590763,"runtime_lift":1.2169315388,"key":["s631639694","s508681868"]} +{"user_id":"u607563136","problem_id":"p03998","language":"python","submission_id_v0":"s457602223","submission_id_v1":"s382126319","cpu_time_v0":30,"cpu_time_v1":27,"memory_v0":9068,"memory_v1":9004,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.0,"input":"s = [list(eval(input())) for _ in range(3)]\n\n\n\nn_row = 0\n\n\n\ndic = {0:\"A\",1:\"B\",2:\"C\"}\n\n\n\nwhile True:\n\n if len(s[n_row]) == 0:\n\n break\n\n\n\n s_num = s[n_row].pop(0)\n\n \n\n if s_num == \"a\":\n\n n_row = 0\n\n elif s_num == \"b\":\n\n n_row = 1\n\n elif s_num ==\"c\":\n\n n_row = 2\n\n\n\nprint((dic[n_row]))","target":"s = [list(eval(input())) for _ in range(3)]\n\n\n\nn_row = 0\n\n\n\ndic = {0:\"A\",1:\"B\",2:\"C\"}\n\n\n\nwhile len(s[n_row]):\n\n s_num = s[n_row].pop(0)\n\n \n\n if s_num == \"a\":\n\n n_row = 0\n\n elif s_num == \"b\":\n\n n_row = 1\n\n elif s_num ==\"c\":\n\n n_row = 2\n\n\n\nprint((dic[n_row]))","code_v0_loc":20,"code_v1_loc":17,"code_v0_num_chars":321,"code_v1_num_chars":285,"code_v0_no_empty_lines":"s = [list(eval(input())) for _ in range(3)]\nn_row = 0\ndic = {0: \"A\", 1: \"B\", 2: \"C\"}\nwhile True:\n if len(s[n_row]) == 0:\n break\n s_num = s[n_row].pop(0)\n if s_num == \"a\":\n n_row = 0\n elif s_num == \"b\":\n n_row = 1\n elif s_num == \"c\":\n n_row = 2\nprint((dic[n_row]))\n","code_v1_no_empty_lines":"s = [list(eval(input())) for _ in range(3)]\nn_row = 0\ndic = {0: \"A\", 1: \"B\", 2: \"C\"}\nwhile len(s[n_row]):\n s_num = s[n_row].pop(0)\n if s_num == \"a\":\n n_row = 0\n elif s_num == \"b\":\n n_row = 1\n elif s_num == \"c\":\n n_row = 2\nprint((dic[n_row]))\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-while True:","- if len(s[n_row]) == 0:","- break","+while len(s[n_row]):"],"diff_only_import_comment":false,"measured_runtime_v0":0.0366162688,"measured_runtime_v1":0.0411586631,"runtime_lift":0.8896369808,"key":["s457602223","s382126319"]} +{"user_id":"u592248346","problem_id":"p02831","language":"python","submission_id_v0":"s414033474","submission_id_v1":"s160368287","cpu_time_v0":36,"cpu_time_v1":17,"memory_v0":5044,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":52.78,"input":"# coding: utf-8\n\n# Your code here!\n\n\n\nimport math\n\nimport fractions\n\ndef lcm(x, y):\n\n return (x * y) \/\/ fractions.gcd(x, y)\n\n\n\na,b = list(map(int,input().split()))\n\nprint((lcm(a, b)))","target":"def gcd(x,y):\n\n if x%y==0: return y\n\n else: return gcd(y,x%y)\n\n\n\na,b = list(map(int,input().split()))\n\nprint((int(a*b\/gcd(a,b))))","code_v0_loc":10,"code_v1_loc":6,"code_v0_num_chars":178,"code_v1_num_chars":127,"code_v0_no_empty_lines":"# coding: utf-8\n# Your code here!\nimport math\nimport fractions\n\n\ndef lcm(x, y):\n return (x * y) \/\/ fractions.gcd(x, y)\n\n\na, b = list(map(int, input().split()))\nprint((lcm(a, b)))\n","code_v1_no_empty_lines":"def gcd(x, y):\n if x % y == 0:\n return y\n else:\n return gcd(y, x % y)\n\n\na, b = list(map(int, input().split()))\nprint((int(a * b \/ gcd(a, b))))\n","code_same":false,"relative_loc_diff_percent":40.0,"diff":["-# coding: utf-8","-# Your code here!","-import math","-import fractions","-","-","-def lcm(x, y):","- return (x * y) \/\/ fractions.gcd(x, y)","+def gcd(x, y):","+ if x % y == 0:","+ return y","+ else:","+ return gcd(y, x % y)","-print((lcm(a, b)))","+print((int(a * b \/ gcd(a, b))))"],"diff_only_import_comment":false,"measured_runtime_v0":0.1083374927,"measured_runtime_v1":0.0363405151,"runtime_lift":2.9811765812,"key":["s414033474","s160368287"]} +{"user_id":"u120865944","problem_id":"p03167","language":"python","submission_id_v0":"s442751870","submission_id_v1":"s170190338","cpu_time_v0":1031,"cpu_time_v1":311,"memory_v0":44612,"memory_v1":55260,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":69.84,"input":"H, W = list(map(int, input().split()))\n\nans = [[0 for i in range(W)] for j in range(H)]\n\nmark = []\n\nfor i in range(H):\n\n mark.append(eval(input()))\n\n\n\nans[0][0] = 1\n\nmod = 10**9 + 7\n\nfor i in range(H):\n\n for j in range(W):\n\n if mark[i][j] == '#':\n\n continue\n\n if i > 0:\n\n ans[i][j] += ans[i-1][j]\n\n if j > 0:\n\n ans[i][j] += ans[i][j-1]\n\n ans[i][j] %= mod\n\n\n\nprint((ans[H-1][W-1]))","target":"H, W = list(map(int, input().split()))\n\nmark = []\n\nfor i in range(H):\n\n mark.append(eval(input()))\n\n\n\ndp = [[0 for i in range(W)] for j in range(H)]\n\ndp[0][0] = 1\n\nmod = int(1e9) + 7\n\nfor i in range(H):\n\n for j in range(W):\n\n if i > 0 and mark[i - 1][j] == '.':\n\n dp[i][j] += dp[i - 1][j] % mod\n\n if j > 0 and mark[i][j - 1] == '.':\n\n dp[i][j] += dp[i][j - 1] % mod\n\n dp[i][j] %= mod\n\n\n\nprint((dp[H - 1][W - 1]))","code_v0_loc":19,"code_v1_loc":17,"code_v0_num_chars":433,"code_v1_num_chars":447,"code_v0_no_empty_lines":"H, W = list(map(int, input().split()))\nans = [[0 for i in range(W)] for j in range(H)]\nmark = []\nfor i in range(H):\n mark.append(eval(input()))\nans[0][0] = 1\nmod = 10**9 + 7\nfor i in range(H):\n for j in range(W):\n if mark[i][j] == \"#\":\n continue\n if i > 0:\n ans[i][j] += ans[i - 1][j]\n if j > 0:\n ans[i][j] += ans[i][j - 1]\n ans[i][j] %= mod\nprint((ans[H - 1][W - 1]))\n","code_v1_no_empty_lines":"H, W = list(map(int, input().split()))\nmark = []\nfor i in range(H):\n mark.append(eval(input()))\ndp = [[0 for i in range(W)] for j in range(H)]\ndp[0][0] = 1\nmod = int(1e9) + 7\nfor i in range(H):\n for j in range(W):\n if i > 0 and mark[i - 1][j] == \".\":\n dp[i][j] += dp[i - 1][j] % mod\n if j > 0 and mark[i][j - 1] == \".\":\n dp[i][j] += dp[i][j - 1] % mod\n dp[i][j] %= mod\nprint((dp[H - 1][W - 1]))\n","code_same":false,"relative_loc_diff_percent":10.5263157895,"diff":["-ans = [[0 for i in range(W)] for j in range(H)]","-ans[0][0] = 1","-mod = 10**9 + 7","+dp = [[0 for i in range(W)] for j in range(H)]","+dp[0][0] = 1","+mod = int(1e9) + 7","- if mark[i][j] == \"#\":","- continue","- if i > 0:","- ans[i][j] += ans[i - 1][j]","- if j > 0:","- ans[i][j] += ans[i][j - 1]","- ans[i][j] %= mod","-print((ans[H - 1][W - 1]))","+ if i > 0 and mark[i - 1][j] == \".\":","+ dp[i][j] += dp[i - 1][j] % mod","+ if j > 0 and mark[i][j - 1] == \".\":","+ dp[i][j] += dp[i][j - 1] % mod","+ dp[i][j] %= mod","+print((dp[H - 1][W - 1]))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0892340612,"measured_runtime_v1":0.0471301479,"runtime_lift":1.8933541509,"key":["s442751870","s170190338"]} +{"user_id":"u764956288","problem_id":"p02692","language":"python","submission_id_v0":"s517804354","submission_id_v1":"s281152734","cpu_time_v0":208,"cpu_time_v1":115,"memory_v0":9692,"memory_v1":9900,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.71,"input":"def solve(writer):\n\n N, A, B, C = list(map(int, input().split()))\n\n variables = {\n\n 'A': A,\n\n 'B': B,\n\n 'C': C\n\n }\n\n\n\n queries = (list(eval(input())) for _ in range(N))\n\n\n\n buffer = list()\n\n\n\n for i in range(N):\n\n\n\n if not buffer:\n\n t1, t2 = next(queries)\n\n else:\n\n b = buffer.pop()\n\n if b == 'pass':\n\n continue\n\n else:\n\n t1, t2 = list(b)\n\n\n\n v1 = variables[t1]\n\n v2 = variables[t2]\n\n\n\n if v1 == v2 == 0:\n\n return False\n\n\n\n elif v1 == v2 == 1:\n\n if i == N-1:\n\n writer.append(t1)\n\n return True\n\n\n\n nt1, nt2 = next(queries)\n\n if len({t1, t2, nt1, nt2}) == 2:\n\n buffer.append('pass')\n\n writer.append(t1)\n\n writer.append(t2)\n\n continue\n\n\n\n if t1 in {nt1, nt2}:\n\n variables[t1] += 1\n\n variables[t2] -= 1\n\n writer.append(t1)\n\n else:\n\n variables[t1] -= 1\n\n variables[t2] += 1\n\n writer.append(t2)\n\n\n\n buffer.append(''.join([nt1, nt2]))\n\n\n\n elif v1 > v2:\n\n variables[t1] -= 1\n\n variables[t2] += 1\n\n writer.append(t2)\n\n elif v2 > v1:\n\n variables[t1] += 1\n\n variables[t2] -= 1\n\n writer.append(t1)\n\n else:\n\n variables[t1] += 1\n\n variables[t2] -= 1\n\n writer.append(t1)\n\n\n\n return True\n\n\n\n\n\ndef main():\n\n writer = list()\n\n ok = solve(writer)\n\n if ok:\n\n print('Yes')\n\n for w in writer:\n\n print(w)\n\n else:\n\n print('No')\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","target":"import sys\n\nreadline = sys.stdin.readline\n\n\n\n\n\ndef solve(writer):\n\n N, A, B, C = map(int, input().split())\n\n\n\n variables = {\n\n 'A': A,\n\n 'B': B,\n\n 'C': C\n\n }\n\n\n\n queries = (list(readline().strip()) for _ in range(N))\n\n\n\n next_q = next(queries)\n\n\n\n for i in range(N):\n\n\n\n let_1, let_2 = next_q\n\n next_q = next(queries) if i != N - 1 else ()\n\n\n\n if variables[let_1] == variables[let_2] == 0:\n\n return False\n\n\n\n if variables[let_1] == variables[let_2] == 1 and let_2 in next_q \\\n\n or variables[let_1] > variables[let_2]:\n\n let_1, let_2 = let_2, let_1\n\n\n\n variables[let_1] += 1\n\n variables[let_2] -= 1\n\n\n\n writer.append(let_1)\n\n\n\n return True\n\n\n\n\n\ndef main():\n\n writer = ['Yes']\n\n ok = solve(writer)\n\n if ok:\n\n for w in writer:\n\n print(w)\n\n else:\n\n print('No')\n\n\n\n\n\nif __name__ == \"__main__\":\n\n main()\n","code_v0_loc":81,"code_v1_loc":49,"code_v0_num_chars":1815,"code_v1_num_chars":966,"code_v0_no_empty_lines":"def solve(writer):\n N, A, B, C = list(map(int, input().split()))\n variables = {\"A\": A, \"B\": B, \"C\": C}\n queries = (list(eval(input())) for _ in range(N))\n buffer = list()\n for i in range(N):\n if not buffer:\n t1, t2 = next(queries)\n else:\n b = buffer.pop()\n if b == \"pass\":\n continue\n else:\n t1, t2 = list(b)\n v1 = variables[t1]\n v2 = variables[t2]\n if v1 == v2 == 0:\n return False\n elif v1 == v2 == 1:\n if i == N - 1:\n writer.append(t1)\n return True\n nt1, nt2 = next(queries)\n if len({t1, t2, nt1, nt2}) == 2:\n buffer.append(\"pass\")\n writer.append(t1)\n writer.append(t2)\n continue\n if t1 in {nt1, nt2}:\n variables[t1] += 1\n variables[t2] -= 1\n writer.append(t1)\n else:\n variables[t1] -= 1\n variables[t2] += 1\n writer.append(t2)\n buffer.append(\"\".join([nt1, nt2]))\n elif v1 > v2:\n variables[t1] -= 1\n variables[t2] += 1\n writer.append(t2)\n elif v2 > v1:\n variables[t1] += 1\n variables[t2] -= 1\n writer.append(t1)\n else:\n variables[t1] += 1\n variables[t2] -= 1\n writer.append(t1)\n return True\n\n\ndef main():\n writer = list()\n ok = solve(writer)\n if ok:\n print(\"Yes\")\n for w in writer:\n print(w)\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_v1_no_empty_lines":"import sys\n\nreadline = sys.stdin.readline\n\n\ndef solve(writer):\n N, A, B, C = map(int, input().split())\n variables = {\"A\": A, \"B\": B, \"C\": C}\n queries = (list(readline().strip()) for _ in range(N))\n next_q = next(queries)\n for i in range(N):\n let_1, let_2 = next_q\n next_q = next(queries) if i != N - 1 else ()\n if variables[let_1] == variables[let_2] == 0:\n return False\n if (\n variables[let_1] == variables[let_2] == 1\n and let_2 in next_q\n or variables[let_1] > variables[let_2]\n ):\n let_1, let_2 = let_2, let_1\n variables[let_1] += 1\n variables[let_2] -= 1\n writer.append(let_1)\n return True\n\n\ndef main():\n writer = [\"Yes\"]\n ok = solve(writer)\n if ok:\n for w in writer:\n print(w)\n else:\n print(\"No\")\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":39.5061728395,"diff":["+import sys","+","+readline = sys.stdin.readline","+","+","- N, A, B, C = list(map(int, input().split()))","+ N, A, B, C = map(int, input().split())","- queries = (list(eval(input())) for _ in range(N))","- buffer = list()","+ queries = (list(readline().strip()) for _ in range(N))","+ next_q = next(queries)","- if not buffer:","- t1, t2 = next(queries)","- else:","- b = buffer.pop()","- if b == \"pass\":","- continue","- else:","- t1, t2 = list(b)","- v1 = variables[t1]","- v2 = variables[t2]","- if v1 == v2 == 0:","+ let_1, let_2 = next_q","+ next_q = next(queries) if i != N - 1 else ()","+ if variables[let_1] == variables[let_2] == 0:","- elif v1 == v2 == 1:","- if i == N - 1:","- writer.append(t1)","- return True","- nt1, nt2 = next(queries)","- if len({t1, t2, nt1, nt2}) == 2:","- buffer.append(\"pass\")","- writer.append(t1)","- writer.append(t2)","- continue","- if t1 in {nt1, nt2}:","- variables[t1] += 1","- variables[t2] -= 1","- writer.append(t1)","- else:","- variables[t1] -= 1","- variables[t2] += 1","- writer.append(t2)","- buffer.append(\"\".join([nt1, nt2]))","- elif v1 > v2:","- variables[t1] -= 1","- variables[t2] += 1","- writer.append(t2)","- elif v2 > v1:","- variables[t1] += 1","- variables[t2] -= 1","- writer.append(t1)","- else:","- variables[t1] += 1","- variables[t2] -= 1","- writer.append(t1)","+ if (","+ variables[let_1] == variables[let_2] == 1","+ and let_2 in next_q","+ or variables[let_1] > variables[let_2]","+ ):","+ let_1, let_2 = let_2, let_1","+ variables[let_1] += 1","+ variables[let_2] -= 1","+ writer.append(let_1)","- writer = list()","+ writer = [\"Yes\"]","- print(\"Yes\")"],"diff_only_import_comment":false,"measured_runtime_v0":0.0383535905,"measured_runtime_v1":0.0373531621,"runtime_lift":1.0267829649,"key":["s517804354","s281152734"]} +{"user_id":"u863370423","problem_id":"p03316","language":"python","submission_id_v0":"s518259468","submission_id_v1":"s239284438","cpu_time_v0":172,"cpu_time_v1":17,"memory_v0":38256,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":90.12,"input":"# your code goes here\n\nn = int(eval(input()))\n\nN = str(n)\n\nN = [int(x) for x in N]\n\nif n%sum(N)==0:\n\n\tprint(\"Yes\")\n\nelse:\n\n\tprint(\"No\")\n","target":"x = eval(input())\n\nk=0\n\nfor i in x:\n\n k+=int(i)\n\n\n\nif int(x)%k==0:\n\n print(\"Yes\")\n\nelse:\n\n print(\"No\")\n\n\n\n \n","code_v0_loc":8,"code_v1_loc":11,"code_v0_num_chars":130,"code_v1_num_chars":114,"code_v0_no_empty_lines":"# your code goes here\nn = int(eval(input()))\nN = str(n)\nN = [int(x) for x in N]\nif n % sum(N) == 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_v1_no_empty_lines":"x = eval(input())\nk = 0\nfor i in x:\n k += int(i)\nif int(x) % k == 0:\n print(\"Yes\")\nelse:\n print(\"No\")\n","code_same":false,"relative_loc_diff_percent":27.2727272727,"diff":["-# your code goes here","-n = int(eval(input()))","-N = str(n)","-N = [int(x) for x in N]","-if n % sum(N) == 0:","+x = eval(input())","+k = 0","+for i in x:","+ k += int(i)","+if int(x) % k == 0:"],"diff_only_import_comment":false,"measured_runtime_v0":0.0413202286,"measured_runtime_v1":0.0742440224,"runtime_lift":0.5565462007,"key":["s518259468","s239284438"]} +{"user_id":"u280978334","problem_id":"p03290","language":"python","submission_id_v0":"s088441353","submission_id_v1":"s492841137","cpu_time_v0":43,"cpu_time_v1":24,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":44.19,"input":"d,g = list(map(int,input().split()))\n\nPC = [list(map(int,input().split())) for _ in range(d)]\n\ncost = 10000000\n\n\n\nfor j in range(2**d):\n\n temp = 0\n\n score = 0\n\n bit = format(j,\"0\"+str(d)+\"b\")\n\n for i in range(d):\n\n if bit[i] == \"1\":\n\n score += PC[i][0]*(i+1)*100 + PC[i][1]\n\n temp += PC[i][0]\n\n if score >= g:\n\n if temp < cost:\n\n cost = temp\n\n else:\n\n for i in range(d-1,-1,-1):\n\n if bit[i] == \"0\":\n\n p,c = PC[i]\n\n point = 100*(i+1)\n\n for v in range(p):\n\n score += point\n\n temp += 1\n\n if score >= g:\n\n break\n\n break\n\n if score >= g and temp < cost:\n\n cost = temp\n\nprint(cost)","target":"from sys import setrecursionlimit\n\nfrom operator import itemgetter\n\nfrom math import ceil\n\ndef main():\n\n D,G = list(map(int,input().split()))\n\n PC = [list(map(int,input().split())) for _ in range(D)]\n\n ans = float(\"inf\")\n\n for i in range(2**D):\n\n done = [False]*D\n\n tmp = 0\n\n q = 0\n\n cnt = i\n\n point = 0\n\n while cnt > 0:\n\n if cnt%2 == 1:\n\n done[point] = True\n\n tmp += PC[point][0]*(100*(point + 1)) + PC[point][1]\n\n q += PC[point][0]\n\n point += 1\n\n cnt \/\/= 2\n\n if tmp < G:\n\n for j in range(D):\n\n if not(done[D - j - 1]):\n\n score = 100*(D - j)\n\n num = min(ceil((G - tmp) \/ score),PC[D - j - 1][0])\n\n tmp += num*score\n\n q += num\n\n if tmp < G:\n\n q = float(\"inf\")\n\n break\n\n \n\n ans = min(q,ans)\n\n print(ans)\n\n return\n\n\n\nif __name__ == \"__main__\":\n\n main()","code_v0_loc":29,"code_v1_loc":37,"code_v0_num_chars":810,"code_v1_num_chars":1077,"code_v0_no_empty_lines":"d, g = list(map(int, input().split()))\nPC = [list(map(int, input().split())) for _ in range(d)]\ncost = 10000000\nfor j in range(2**d):\n temp = 0\n score = 0\n bit = format(j, \"0\" + str(d) + \"b\")\n for i in range(d):\n if bit[i] == \"1\":\n score += PC[i][0] * (i + 1) * 100 + PC[i][1]\n temp += PC[i][0]\n if score >= g:\n if temp < cost:\n cost = temp\n else:\n for i in range(d - 1, -1, -1):\n if bit[i] == \"0\":\n p, c = PC[i]\n point = 100 * (i + 1)\n for v in range(p):\n score += point\n temp += 1\n if score >= g:\n break\n break\n if score >= g and temp < cost:\n cost = temp\nprint(cost)\n","code_v1_no_empty_lines":"from sys import setrecursionlimit\nfrom operator import itemgetter\nfrom math import ceil\n\n\ndef main():\n D, G = list(map(int, input().split()))\n PC = [list(map(int, input().split())) for _ in range(D)]\n ans = float(\"inf\")\n for i in range(2**D):\n done = [False] * D\n tmp = 0\n q = 0\n cnt = i\n point = 0\n while cnt > 0:\n if cnt % 2 == 1:\n done[point] = True\n tmp += PC[point][0] * (100 * (point + 1)) + PC[point][1]\n q += PC[point][0]\n point += 1\n cnt \/\/= 2\n if tmp < G:\n for j in range(D):\n if not (done[D - j - 1]):\n score = 100 * (D - j)\n num = min(ceil((G - tmp) \/ score), PC[D - j - 1][0])\n tmp += num * score\n q += num\n if tmp < G:\n q = float(\"inf\")\n break\n ans = min(q, ans)\n print(ans)\n return\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":21.6216216216,"diff":["-d, g = list(map(int, input().split()))","-PC = [list(map(int, input().split())) for _ in range(d)]","-cost = 10000000","-for j in range(2**d):","- temp = 0","- score = 0","- bit = format(j, \"0\" + str(d) + \"b\")","- for i in range(d):","- if bit[i] == \"1\":","- score += PC[i][0] * (i + 1) * 100 + PC[i][1]","- temp += PC[i][0]","- if score >= g:","- if temp < cost:","- cost = temp","- else:","- for i in range(d - 1, -1, -1):","- if bit[i] == \"0\":","- p, c = PC[i]","- point = 100 * (i + 1)","- for v in range(p):","- score += point","- temp += 1","- if score >= g:","- break","- break","- if score >= g and temp < cost:","- cost = temp","-print(cost)","+from sys import setrecursionlimit","+from operator import itemgetter","+from math import ceil","+","+","+def main():","+ D, G = list(map(int, input().split()))","+ PC = [list(map(int, input().split())) for _ in range(D)]","+ ans = float(\"inf\")","+ for i in range(2**D):","+ done = [False] * D","+ tmp = 0","+ q = 0","+ cnt = i","+ point = 0","+ while cnt > 0:","+ if cnt % 2 == 1:","+ done[point] = True","+ tmp += PC[point][0] * (100 * (point + 1)) + PC[point][1]","+ q += PC[point][0]","+ point += 1","+ cnt \/\/= 2","+ if tmp < G:","+ for j in range(D):","+ if not (done[D - j - 1]):","+ score = 100 * (D - j)","+ num = min(ceil((G - tmp) \/ score), PC[D - j - 1][0])","+ tmp += num * score","+ q += num","+ if tmp < G:","+ q = float(\"inf\")","+ break","+ ans = min(q, ans)","+ print(ans)","+ return","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0376721544,"measured_runtime_v1":0.0888416181,"runtime_lift":0.4240372389,"key":["s088441353","s492841137"]} +{"user_id":"u497046426","problem_id":"p03147","language":"python","submission_id_v0":"s812404013","submission_id_v1":"s346529151","cpu_time_v0":23,"cpu_time_v1":20,"memory_v0":3064,"memory_v1":3064,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":13.04,"input":"N = int(eval(input()))\n\nH = list(map(int, input().split()))\n\n\n\n# H\u30921\u6bb5\u305a\u3064\u6e1b\u3089\u3057\u3066\u3044\u304f.\n\n# \u5024\u304c\u6b63\u306e\u533a\u9593 (left, right) \u304c\u4e00\u3064\u898b\u3064\u304b\u308b\u3054\u3068\u306b\u7b54\u3048\u306f1\u5897\u3048\u308b.\n\n\n\nans = 0\n\nwhile sum(H) > 0:\n\n left = right = 0\n\n prev = 0\n\n segment = []\n\n for i, h in enumerate(H):\n\n if h == 0 and prev != 0: # H = {..., 0, *(left), *, ..., *, 0(right), ...} (*: \u6b63\u6570)\n\n right = i\n\n segment.append((left, right))\n\n elif h != 0 and prev == 0:\n\n left = i\n\n if i == N-1: # H = {..., 0, *(left)} (*: \u6b63\u6570)\n\n right = i + 1\n\n segment.append((left, right))\n\n elif h != 0 and i == N-1: #(prev != 0) H = {..., 0, *(left), ..., *, *} (*: \u6b63\u6570)\n\n right = i + 1\n\n segment.append((left, right))\n\n prev = h\n\n ans += len(segment)\n\n # H\u306e\u5024\u304c\u6b63\u306e\u3068\u3053\u308d\u30921\u6bb5\u6e1b\u3089\u3059.\n\n for l, r in segment:\n\n for i in range(l, r):\n\n H[i] -= 1\n\nprint(ans)","target":"N = int(eval(input()))\n\nH = list(map(int, input().split()))\n\n\n\nstack = [H]\n\ncount = 0\n\nwhile stack:\n\n lst = stack.pop()\n\n m = min(lst)\n\n count += m\n\n lst = [l-m for l in lst]\n\n prev = 0\n\n left = 0\n\n for i, h in enumerate(lst):\n\n if h == 0 and prev != 0: # H = {..., 0, *(left), *, ..., *, 0(right), ...} (*: \u6b63\u6570)\n\n stack.append(lst[left:i])\n\n elif h != 0 and prev == 0:\n\n left = i\n\n if i == len(lst)-1: # H = {..., 0, *(left)} (*: \u6b63\u6570)\n\n stack.append(lst[left:i+1])\n\n elif h != 0 and i == len(lst)-1: #(prev != 0) H = {..., 0, *(left), ..., *, *} (*: \u6b63\u6570)\n\n stack.append(lst[left:i+1])\n\n prev = h\n\nprint(count)","code_v0_loc":30,"code_v1_loc":23,"code_v0_num_chars":901,"code_v1_num_chars":709,"code_v0_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\n# H\u30921\u6bb5\u305a\u3064\u6e1b\u3089\u3057\u3066\u3044\u304f.\n# \u5024\u304c\u6b63\u306e\u533a\u9593 (left, right) \u304c\u4e00\u3064\u898b\u3064\u304b\u308b\u3054\u3068\u306b\u7b54\u3048\u306f1\u5897\u3048\u308b.\nans = 0\nwhile sum(H) > 0:\n left = right = 0\n prev = 0\n segment = []\n for i, h in enumerate(H):\n if (\n h == 0 and prev != 0\n ): # H = {..., 0, *(left), *, ..., *, 0(right), ...} (*: \u6b63\u6570)\n right = i\n segment.append((left, right))\n elif h != 0 and prev == 0:\n left = i\n if i == N - 1: # H = {..., 0, *(left)} (*: \u6b63\u6570)\n right = i + 1\n segment.append((left, right))\n elif (\n h != 0 and i == N - 1\n ): # (prev != 0) H = {..., 0, *(left), ..., *, *} (*: \u6b63\u6570)\n right = i + 1\n segment.append((left, right))\n prev = h\n ans += len(segment)\n # H\u306e\u5024\u304c\u6b63\u306e\u3068\u3053\u308d\u30921\u6bb5\u6e1b\u3089\u3059.\n for l, r in segment:\n for i in range(l, r):\n H[i] -= 1\nprint(ans)\n","code_v1_no_empty_lines":"N = int(eval(input()))\nH = list(map(int, input().split()))\nstack = [H]\ncount = 0\nwhile stack:\n lst = stack.pop()\n m = min(lst)\n count += m\n lst = [l - m for l in lst]\n prev = 0\n left = 0\n for i, h in enumerate(lst):\n if (\n h == 0 and prev != 0\n ): # H = {..., 0, *(left), *, ..., *, 0(right), ...} (*: \u6b63\u6570)\n stack.append(lst[left:i])\n elif h != 0 and prev == 0:\n left = i\n if i == len(lst) - 1: # H = {..., 0, *(left)} (*: \u6b63\u6570)\n stack.append(lst[left : i + 1])\n elif (\n h != 0 and i == len(lst) - 1\n ): # (prev != 0) H = {..., 0, *(left), ..., *, *} (*: \u6b63\u6570)\n stack.append(lst[left : i + 1])\n prev = h\nprint(count)\n","code_same":false,"relative_loc_diff_percent":23.3333333333,"diff":["-# H\u30921\u6bb5\u305a\u3064\u6e1b\u3089\u3057\u3066\u3044\u304f.","-# \u5024\u304c\u6b63\u306e\u533a\u9593 (left, right) \u304c\u4e00\u3064\u898b\u3064\u304b\u308b\u3054\u3068\u306b\u7b54\u3048\u306f1\u5897\u3048\u308b.","-ans = 0","-while sum(H) > 0:","- left = right = 0","+stack = [H]","+count = 0","+while stack:","+ lst = stack.pop()","+ m = min(lst)","+ count += m","+ lst = [l - m for l in lst]","- segment = []","- for i, h in enumerate(H):","+ left = 0","+ for i, h in enumerate(lst):","- right = i","- segment.append((left, right))","+ stack.append(lst[left:i])","- if i == N - 1: # H = {..., 0, *(left)} (*: \u6b63\u6570)","- right = i + 1","- segment.append((left, right))","+ if i == len(lst) - 1: # H = {..., 0, *(left)} (*: \u6b63\u6570)","+ stack.append(lst[left : i + 1])","- h != 0 and i == N - 1","+ h != 0 and i == len(lst) - 1","- right = i + 1","- segment.append((left, right))","+ stack.append(lst[left : i + 1])","- ans += len(segment)","- # H\u306e\u5024\u304c\u6b63\u306e\u3068\u3053\u308d\u30921\u6bb5\u6e1b\u3089\u3059.","- for l, r in segment:","- for i in range(l, r):","- H[i] -= 1","-print(ans)","+print(count)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0852939112,"measured_runtime_v1":0.0825146518,"runtime_lift":1.0336820113,"key":["s812404013","s346529151"]} +{"user_id":"u495731174","problem_id":"p03073","language":"python","submission_id_v0":"s270913817","submission_id_v1":"s372742440","cpu_time_v0":137,"cpu_time_v1":48,"memory_v0":3956,"memory_v1":3316,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":64.96,"input":"s = list(eval(input()))\n\n\n\nans = 0\n\nfor i in range(len(s)-1):\n\n if int(s[i]) == int(s[i+1]) == 0:\n\n s[i+1] = 1\n\n ans += 1\n\n elif int(s[i]) == int(s[i+1]) == 1:\n\n s[i+1] = 0\n\n ans += 1\n\nprint(ans)\n\n\n","target":"s = eval(input())\n\n\n\na = \"01\"*int(len(s)\/2) + \"0\"*int(len(s)%2)\n\nb = \"10\"*int(len(s)\/2) + \"1\"*int(len(s)%2)\n\n\n\na_count = 0\n\nb_count = 0\n\nfor i, j, k in zip(a, b, s):\n\n if i != k:\n\n a_count += 1\n\n if j != k:\n\n b_count += 1\n\n\n\nprint((min(a_count, b_count)))\n","code_v0_loc":12,"code_v1_loc":14,"code_v0_num_chars":226,"code_v1_num_chars":268,"code_v0_no_empty_lines":"s = list(eval(input()))\nans = 0\nfor i in range(len(s) - 1):\n if int(s[i]) == int(s[i + 1]) == 0:\n s[i + 1] = 1\n ans += 1\n elif int(s[i]) == int(s[i + 1]) == 1:\n s[i + 1] = 0\n ans += 1\nprint(ans)\n","code_v1_no_empty_lines":"s = eval(input())\na = \"01\" * int(len(s) \/ 2) + \"0\" * int(len(s) % 2)\nb = \"10\" * int(len(s) \/ 2) + \"1\" * int(len(s) % 2)\na_count = 0\nb_count = 0\nfor i, j, k in zip(a, b, s):\n if i != k:\n a_count += 1\n if j != k:\n b_count += 1\nprint((min(a_count, b_count)))\n","code_same":false,"relative_loc_diff_percent":14.2857142857,"diff":["-s = list(eval(input()))","-ans = 0","-for i in range(len(s) - 1):","- if int(s[i]) == int(s[i + 1]) == 0:","- s[i + 1] = 1","- ans += 1","- elif int(s[i]) == int(s[i + 1]) == 1:","- s[i + 1] = 0","- ans += 1","-print(ans)","+s = eval(input())","+a = \"01\" * int(len(s) \/ 2) + \"0\" * int(len(s) % 2)","+b = \"10\" * int(len(s) \/ 2) + \"1\" * int(len(s) % 2)","+a_count = 0","+b_count = 0","+for i, j, k in zip(a, b, s):","+ if i != k:","+ a_count += 1","+ if j != k:","+ b_count += 1","+print((min(a_count, b_count)))"],"diff_only_import_comment":false,"measured_runtime_v0":0.0369185662,"measured_runtime_v1":0.0369355493,"runtime_lift":0.9995401979,"key":["s270913817","s372742440"]} +{"user_id":"u753803401","problem_id":"p02936","language":"python","submission_id_v0":"s981170803","submission_id_v1":"s743630929","cpu_time_v0":1066,"cpu_time_v1":867,"memory_v0":123864,"memory_v1":122204,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":18.67,"input":"import sys\n\nimport collections\n\n\n\n\n\ndef solve():\n\n input = sys.stdin.readline\n\n mod = 10 ** 9 + 7\n\n n, q = list(map(int, input().rstrip('\\n').split()))\n\n d = collections.defaultdict(list)\n\n for i in range(n-1):\n\n a, b = list(map(int, input().rstrip('\\n').split()))\n\n d[a-1] += [b-1]\n\n d[b-1] += [a-1]\n\n ls = [0] * n\n\n for i in range(q):\n\n p, x = list(map(int, input().rstrip('\\n').split()))\n\n ls[p-1] += x\n\n ql = collections.deque([0])\n\n fq = collections.defaultdict(int)\n\n fq[0]\n\n while True:\n\n if len(ql) != 0:\n\n p = ql.popleft()\n\n for v in d[p]:\n\n if v not in fq:\n\n ls[v] += ls[p]\n\n ql.appendleft(v)\n\n fq[p]\n\n else:\n\n print((*ls))\n\n exit()\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","target":"import sys\n\nimport collections\n\n\n\n\n\ndef solve():\n\n readline = sys.stdin.buffer.readline\n\n mod = 10 ** 9 + 7\n\n\n\n n, q = list(map(int, readline().split()))\n\n tmd = collections.defaultdict(list)\n\n for i in range(n-1):\n\n tma, tmb = list(map(int, readline().split()))\n\n tmd[tma-1] += [tmb-1]\n\n tmd[tmb-1] += [tma-1]\n\n score = [0] * n\n\n for i in range(q):\n\n p, x = list(map(int, readline().split()))\n\n score[p-1] += x\n\n\n\n ql = [[0, 0]]\n\n ql = collections.deque(ql)\n\n fq = collections.defaultdict(list)\n\n fq[0]\n\n while True:\n\n if len(ql) != 0:\n\n cost, tmp = ql.popleft()\n\n for tmv in tmd[tmp]:\n\n if tmv not in fq:\n\n score[tmv] += score[tmp]\n\n ql.append([cost + 1, tmv])\n\n fq[tmv]\n\n else:\n\n break\n\n print((*score))\n\n\n\n\n\nif __name__ == '__main__':\n\n solve()\n","code_v0_loc":35,"code_v1_loc":38,"code_v0_num_chars":884,"code_v1_num_chars":943,"code_v0_no_empty_lines":"import sys\nimport collections\n\n\ndef solve():\n input = sys.stdin.readline\n mod = 10**9 + 7\n n, q = list(map(int, input().rstrip(\"\\n\").split()))\n d = collections.defaultdict(list)\n for i in range(n - 1):\n a, b = list(map(int, input().rstrip(\"\\n\").split()))\n d[a - 1] += [b - 1]\n d[b - 1] += [a - 1]\n ls = [0] * n\n for i in range(q):\n p, x = list(map(int, input().rstrip(\"\\n\").split()))\n ls[p - 1] += x\n ql = collections.deque([0])\n fq = collections.defaultdict(int)\n fq[0]\n while True:\n if len(ql) != 0:\n p = ql.popleft()\n for v in d[p]:\n if v not in fq:\n ls[v] += ls[p]\n ql.appendleft(v)\n fq[p]\n else:\n print((*ls))\n exit()\n\n\nif __name__ == \"__main__\":\n solve()\n","code_v1_no_empty_lines":"import sys\nimport collections\n\n\ndef solve():\n readline = sys.stdin.buffer.readline\n mod = 10**9 + 7\n n, q = list(map(int, readline().split()))\n tmd = collections.defaultdict(list)\n for i in range(n - 1):\n tma, tmb = list(map(int, readline().split()))\n tmd[tma - 1] += [tmb - 1]\n tmd[tmb - 1] += [tma - 1]\n score = [0] * n\n for i in range(q):\n p, x = list(map(int, readline().split()))\n score[p - 1] += x\n ql = [[0, 0]]\n ql = collections.deque(ql)\n fq = collections.defaultdict(list)\n fq[0]\n while True:\n if len(ql) != 0:\n cost, tmp = ql.popleft()\n for tmv in tmd[tmp]:\n if tmv not in fq:\n score[tmv] += score[tmp]\n ql.append([cost + 1, tmv])\n fq[tmv]\n else:\n break\n print((*score))\n\n\nif __name__ == \"__main__\":\n solve()\n","code_same":false,"relative_loc_diff_percent":7.8947368421,"diff":["- input = sys.stdin.readline","+ readline = sys.stdin.buffer.readline","- n, q = list(map(int, input().rstrip(\"\\n\").split()))","- d = collections.defaultdict(list)","+ n, q = list(map(int, readline().split()))","+ tmd = collections.defaultdict(list)","- a, b = list(map(int, input().rstrip(\"\\n\").split()))","- d[a - 1] += [b - 1]","- d[b - 1] += [a - 1]","- ls = [0] * n","+ tma, tmb = list(map(int, readline().split()))","+ tmd[tma - 1] += [tmb - 1]","+ tmd[tmb - 1] += [tma - 1]","+ score = [0] * n","- p, x = list(map(int, input().rstrip(\"\\n\").split()))","- ls[p - 1] += x","- ql = collections.deque([0])","- fq = collections.defaultdict(int)","+ p, x = list(map(int, readline().split()))","+ score[p - 1] += x","+ ql = [[0, 0]]","+ ql = collections.deque(ql)","+ fq = collections.defaultdict(list)","- p = ql.popleft()","- for v in d[p]:","- if v not in fq:","- ls[v] += ls[p]","- ql.appendleft(v)","- fq[p]","+ cost, tmp = ql.popleft()","+ for tmv in tmd[tmp]:","+ if tmv not in fq:","+ score[tmv] += score[tmp]","+ ql.append([cost + 1, tmv])","+ fq[tmv]","- print((*ls))","- exit()","+ break","+ print((*score))"],"diff_only_import_comment":false,"measured_runtime_v0":0.007531541,"measured_runtime_v1":0.0859100384,"runtime_lift":0.0876677637,"key":["s981170803","s743630929"]} +{"user_id":"u813387707","problem_id":"p02934","language":"python","submission_id_v0":"s896970234","submission_id_v1":"s778038179","cpu_time_v0":22,"cpu_time_v1":17,"memory_v0":3572,"memory_v1":2940,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":22.73,"input":"from functools import reduce\n\nfrom operator import mul\n\n\n\nn = int(eval(input()))\n\na_list = [int(x) for x in input().split()]\n\n\n\ntemp_mul = reduce(mul, a_list)\n\n\n\ntemp_add = 0\n\nfor a in a_list:\n\n temp_add += temp_mul \/\/ a\n\n\n\nans = temp_mul \/ temp_add\n\nprint(ans)","target":"n = int(eval(input()))\n\na_list = [int(x) for x in input().split()]\n\n\n\ntemp = 0\n\nfor a in a_list:\n\n temp += 1 \/ a\n\nans = 1 \/ temp\n\nprint(ans)","code_v0_loc":14,"code_v1_loc":8,"code_v0_num_chars":258,"code_v1_num_chars":137,"code_v0_no_empty_lines":"from functools import reduce\nfrom operator import mul\n\nn = int(eval(input()))\na_list = [int(x) for x in input().split()]\ntemp_mul = reduce(mul, a_list)\ntemp_add = 0\nfor a in a_list:\n temp_add += temp_mul \/\/ a\nans = temp_mul \/ temp_add\nprint(ans)\n","code_v1_no_empty_lines":"n = int(eval(input()))\na_list = [int(x) for x in input().split()]\ntemp = 0\nfor a in a_list:\n temp += 1 \/ a\nans = 1 \/ temp\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":42.8571428571,"diff":["-from functools import reduce","-from operator import mul","-","-temp_mul = reduce(mul, a_list)","-temp_add = 0","+temp = 0","- temp_add += temp_mul \/\/ a","-ans = temp_mul \/ temp_add","+ temp += 1 \/ a","+ans = 1 \/ temp"],"diff_only_import_comment":false,"measured_runtime_v0":0.0354996643,"measured_runtime_v1":0.0360773244,"runtime_lift":0.9839882779,"key":["s896970234","s778038179"]} +{"user_id":"u169696482","problem_id":"p02948","language":"python","submission_id_v0":"s714492306","submission_id_v1":"s355591945","cpu_time_v0":507,"cpu_time_v1":454,"memory_v0":23752,"memory_v1":23748,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":10.45,"input":"import heapq\n\nN, M = list(map(int, input().split()))\n\njobs = [[] for _ in range(M)]\n\nfor i in range(N):\n\n d, r = list(map(int, input().split()))\n\n if d-1 < M:\n\n jobs[d-1].append(-r)\n\n\n\nm = 0\n\nheap = []\n\nfor i in range(M):\n\n for a in jobs[i]:\n\n heapq.heappush(heap, a)\n\n if len(heap) > 0:\n\n b = heapq.heappop(heap)\n\n m += -b\n\nprint(m)","target":"import heapq\n\ndef main():\n\n N, M = list(map(int, input().split()))\n\n jobs = [[] for _ in range(M)]\n\n for i in range(N):\n\n d, r = list(map(int, input().split()))\n\n if d-1 < M:\n\n jobs[d-1].append(-r)\n\n\n\n m = 0\n\n heap = []\n\n for i in range(M):\n\n for a in jobs[i]:\n\n heapq.heappush(heap, a)\n\n if len(heap) > 0:\n\n b = heapq.heappop(heap)\n\n m += -b\n\n print(m)\n\nif __name__ == '__main__':\n\n main()\n","code_v0_loc":17,"code_v1_loc":20,"code_v0_num_chars":373,"code_v1_num_chars":431,"code_v0_no_empty_lines":"import heapq\n\nN, M = list(map(int, input().split()))\njobs = [[] for _ in range(M)]\nfor i in range(N):\n d, r = list(map(int, input().split()))\n if d - 1 < M:\n jobs[d - 1].append(-r)\nm = 0\nheap = []\nfor i in range(M):\n for a in jobs[i]:\n heapq.heappush(heap, a)\n if len(heap) > 0:\n b = heapq.heappop(heap)\n m += -b\nprint(m)\n","code_v1_no_empty_lines":"import heapq\n\n\ndef main():\n N, M = list(map(int, input().split()))\n jobs = [[] for _ in range(M)]\n for i in range(N):\n d, r = list(map(int, input().split()))\n if d - 1 < M:\n jobs[d - 1].append(-r)\n m = 0\n heap = []\n for i in range(M):\n for a in jobs[i]:\n heapq.heappush(heap, a)\n if len(heap) > 0:\n b = heapq.heappop(heap)\n m += -b\n print(m)\n\n\nif __name__ == \"__main__\":\n main()\n","code_same":false,"relative_loc_diff_percent":15.0,"diff":["-N, M = list(map(int, input().split()))","-jobs = [[] for _ in range(M)]","-for i in range(N):","- d, r = list(map(int, input().split()))","- if d - 1 < M:","- jobs[d - 1].append(-r)","-m = 0","-heap = []","-for i in range(M):","- for a in jobs[i]:","- heapq.heappush(heap, a)","- if len(heap) > 0:","- b = heapq.heappop(heap)","- m += -b","-print(m)","+","+def main():","+ N, M = list(map(int, input().split()))","+ jobs = [[] for _ in range(M)]","+ for i in range(N):","+ d, r = list(map(int, input().split()))","+ if d - 1 < M:","+ jobs[d - 1].append(-r)","+ m = 0","+ heap = []","+ for i in range(M):","+ for a in jobs[i]:","+ heapq.heappush(heap, a)","+ if len(heap) > 0:","+ b = heapq.heappop(heap)","+ m += -b","+ print(m)","+","+","+if __name__ == \"__main__\":","+ main()"],"diff_only_import_comment":false,"measured_runtime_v0":0.0547127407,"measured_runtime_v1":0.075702384,"runtime_lift":0.7227347114,"key":["s714492306","s355591945"]} +{"user_id":"u144913062","problem_id":"p02888","language":"python","submission_id_v0":"s630803406","submission_id_v1":"s695559124","cpu_time_v0":1357,"cpu_time_v1":740,"memory_v0":3188,"memory_v1":43372,"status_v0":"Accepted","status_v1":"Accepted","improvement_frac":45.47,"input":"from bisect import bisect_left\n\n\n\nN = int(eval(input()))\n\nL = list(map(int, input().split()))\n\nL.sort()\n\ncount = 0\n\nfor i in range(N):\n\n for j in range(i+1, N):\n\n max_len = L[i] + L[j]\n\n count += bisect_left(L, max_len) - j - 1\n\nprint(count)\n","target":"from bisect import bisect_left\n\nimport sys\n\ninput = sys.stdin.readline\n\n\n\nN = int(eval(input()))\n\nL = list(map(int, input().split()))\n\nL.sort()\n\nans = 0\n\nfor i in range(N-1):\n\n for j in range(i+1, N):\n\n l = L[i] + L[j]\n\n k = bisect_left(L, l)\n\n ans += max(0, k - j - 1)\n\nprint(ans)","code_v0_loc":11,"code_v1_loc":14,"code_v0_num_chars":253,"code_v1_num_chars":299,"code_v0_no_empty_lines":"from bisect import bisect_left\n\nN = int(eval(input()))\nL = list(map(int, input().split()))\nL.sort()\ncount = 0\nfor i in range(N):\n for j in range(i + 1, N):\n max_len = L[i] + L[j]\n count += bisect_left(L, max_len) - j - 1\nprint(count)\n","code_v1_no_empty_lines":"from bisect import bisect_left\nimport sys\n\ninput = sys.stdin.readline\nN = int(eval(input()))\nL = list(map(int, input().split()))\nL.sort()\nans = 0\nfor i in range(N - 1):\n for j in range(i + 1, N):\n l = L[i] + L[j]\n k = bisect_left(L, l)\n ans += max(0, k - j - 1)\nprint(ans)\n","code_same":false,"relative_loc_diff_percent":21.4285714286,"diff":["+import sys","+input = sys.stdin.readline","-count = 0","-for i in range(N):","+ans = 0","+for i in range(N - 1):","- max_len = L[i] + L[j]","- count += bisect_left(L, max_len) - j - 1","-print(count)","+ l = L[i] + L[j]","+ k = bisect_left(L, l)","+ ans += max(0, k - j - 1)","+print(ans)"],"diff_only_import_comment":false,"measured_runtime_v0":0.0425538182,"measured_runtime_v1":0.036387989,"runtime_lift":1.1694468239,"key":["s630803406","s695559124"]} diff --git a/sven_bigvul_sft_all_1_1024_train.json b/sven_bigvul_sft_all_1_1024_train.json new file mode 100644 index 0000000000000000000000000000000000000000..a4eba023cae21c36f7c0378806ec00f7d59e6926 --- /dev/null +++ b/sven_bigvul_sft_all_1_1024_train.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa58789df8428eb79edb829c8ae2975101b72adeebeef60404e5ee7eb8c0b19c +size 17745244 diff --git a/sven_bigvul_sft_all_1_1024_val.json b/sven_bigvul_sft_all_1_1024_val.json new file mode 100644 index 0000000000000000000000000000000000000000..c60fb9d89c5f8d8d5e3fd02cc8575c5a19132147 --- /dev/null +++ b/sven_bigvul_sft_all_1_1024_val.json @@ -0,0 +1,8002 @@ +[ + { + "problem_id": "bigvul#validation#af05a799e3f47331fb27a24a8a56f1b1dd47a9c2", + "input": "void PrintWebViewHelper::UpdatePrintableSizeInPrintParameters(\n WebFrame* frame,\n WebNode* node,\n ViewMsg_Print_Params* params) {\n double content_width_in_points;\n double content_height_in_points;\n double margin_top_in_points;\n double margin_right_in_points;\n double margin_bottom_in_points;\n double margin_left_in_points;\n PrepareFrameAndViewForPrint prepare(*params, frame, node, frame->view());\n PrintWebViewHelper::GetPageSizeAndMarginsInPoints(frame, 0, *params,\n &content_width_in_points, &content_height_in_points,\n &margin_top_in_points, &margin_right_in_points,\n &margin_bottom_in_points, &margin_left_in_points);\n#if defined(OS_MACOSX)\n int dpi = printing::kPointsPerInch;\n#else\n int dpi = static_cast(params->dpi);\n#endif // defined(OS_MACOSX)\n params->printable_size = gfx::Size(\n static_cast(ConvertUnitDouble(content_width_in_points,\n printing::kPointsPerInch, dpi)),\n static_cast(ConvertUnitDouble(content_height_in_points,\n printing::kPointsPerInch, dpi)));\n \n params->page_size = gfx::Size(\n static_cast(ConvertUnitDouble(content_width_in_points +\n margin_left_in_points + margin_right_in_points,\n printing::kPointsPerInch, dpi)),\n static_cast(ConvertUnitDouble(content_height_in_points +\n margin_top_in_points + margin_bottom_in_points,\n printing::kPointsPerInch, dpi)));\n \n params->margin_top = static_cast(ConvertUnitDouble(\n margin_top_in_points, printing::kPointsPerInch, dpi));\n params->margin_left = static_cast(ConvertUnitDouble(\n margin_left_in_points, printing::kPointsPerInch, dpi));\n}\n", + "target": "void PrintWebViewHelper::UpdatePrintableSizeInPrintParameters(\n WebFrame* frame,\n WebNode* node,\n ViewMsg_Print_Params* params) {\n double content_width_in_points;\n double content_height_in_points;\n double margin_top_in_points;\n double margin_right_in_points;\n double margin_bottom_in_points;\n double margin_left_in_points;\n PrepareFrameAndViewForPrint prepare(*params, frame, node, frame->view());\n PrintWebViewHelper::GetPageSizeAndMarginsInPoints(frame, 0, *params,\n &content_width_in_points, &content_height_in_points,\n &margin_top_in_points, &margin_right_in_points,\n &margin_bottom_in_points, &margin_left_in_points);\n#if defined(OS_MACOSX)\n int dpi = printing::kPointsPerInch;\n#else\n int dpi = static_cast(params->dpi);\n#endif // defined(OS_MACOSX)\n params->printable_size = gfx::Size(\n static_cast(ConvertUnitDouble(content_width_in_points,\n printing::kPointsPerInch, dpi)),\n static_cast(ConvertUnitDouble(content_height_in_points,\n printing::kPointsPerInch, dpi)));\n \n double page_width_in_points = content_width_in_points +\n margin_left_in_points + margin_right_in_points;\n double page_height_in_points = content_height_in_points +\n margin_top_in_points + margin_bottom_in_points;\n\n params->page_size = gfx::Size(\n static_cast(ConvertUnitDouble(\n page_width_in_points, printing::kPointsPerInch, dpi)),\n static_cast(ConvertUnitDouble(\n page_height_in_points, printing::kPointsPerInch, dpi)));\n \n params->margin_top = static_cast(ConvertUnitDouble(\n margin_top_in_points, printing::kPointsPerInch, dpi));\n params->margin_left = static_cast(ConvertUnitDouble(\n margin_left_in_points, printing::kPointsPerInch, dpi));\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fbfa4d1083ea84c5429992ca3e996d7d4fbc8238", + "input": "tChecksumCheckResult ParaNdis_CheckRxChecksum(\n PARANDIS_ADAPTER *pContext,\n ULONG virtioFlags,\n tCompletePhysicalAddress *pPacketPages,\n ULONG ulPacketLength,\n ULONG ulDataOffset)\n {\n tOffloadSettingsFlags f = pContext->Offload.flags;\n tChecksumCheckResult res, resIp;\n tTcpIpPacketParsingResult ppr;\n ULONG flagsToCalculate = 0;\n res.value = 0;\n resIp.value = 0;\n \n\n if (f.fRxIPChecksum) flagsToCalculate |= pcrIpChecksum; // check only\n\n if (!(virtioFlags & VIRTIO_NET_HDR_F_DATA_VALID))\n {\n if (virtioFlags & VIRTIO_NET_HDR_F_NEEDS_CSUM)\n {\n flagsToCalculate |= pcrFixXxpChecksum | pcrTcpChecksum | pcrUdpChecksum;\n }\n else\n {\n if (f.fRxTCPChecksum) flagsToCalculate |= pcrTcpV4Checksum;\n if (f.fRxUDPChecksum) flagsToCalculate |= pcrUdpV4Checksum;\n if (f.fRxTCPv6Checksum) flagsToCalculate |= pcrTcpV6Checksum;\n if (f.fRxUDPv6Checksum) flagsToCalculate |= pcrUdpV6Checksum;\n }\n }\n \n ppr = ParaNdis_CheckSumVerify(pPacketPages, ulPacketLength - ETH_HEADER_SIZE, ulDataOffset + ETH_HEADER_SIZE, flagsToCalculate, __FUNCTION__);\n \n if (virtioFlags & VIRTIO_NET_HDR_F_DATA_VALID)\n {\n pContext->extraStatistics.framesRxCSHwOK++;\n ppr.xxpCheckSum = ppresCSOK;\n }\n\n if (ppr.ipStatus == ppresIPV4 && !ppr.IsFragment)\n {\n if (f.fRxIPChecksum)\n {\n res.flags.IpOK = ppr.ipCheckSum == ppresCSOK;\n res.flags.IpFailed = ppr.ipCheckSum == ppresCSBad;\n }\n if(ppr.xxpStatus == ppresXxpKnown)\n {\n if(ppr.TcpUdp == ppresIsTCP) /* TCP */\n {\n if (f.fRxTCPChecksum)\n {\n res.flags.TcpOK = ppr.xxpCheckSum == ppresCSOK || ppr.fixedXxpCS;\n res.flags.TcpFailed = !res.flags.TcpOK;\n }\n }\n else /* UDP */\n {\n if (f.fRxUDPChecksum)\n {\n res.flags.UdpOK = ppr.xxpCheckSum == ppresCSOK || ppr.fixedXxpCS;\n res.flags.UdpFailed = !res.flags.UdpOK;\n }\n }\n }\n }\n else if (ppr.ipStatus == ppresIPV6)\n {\n if(ppr.xxpStatus == ppresXxpKnown)\n {\n if(ppr.TcpUdp == ppresIsTCP) /* TCP */\n {\n if (f.fRxTCPv6Checksum)\n {\n res.flags.TcpOK = ppr.xxpCheckSum == ppresCSOK || ppr.fixedXxpCS;\n res.flags.TcpFailed = !res.flags.TcpOK;\n }\n }\n else /* UDP */\n {\n if (f.fRxUDPv6Checksum)\n {\n res.flags.UdpOK = ppr.xxpCheckSum == ppresCSOK || ppr.fixedXxpCS;\n res.flags.UdpFailed = !res.flags.UdpOK;\n }\n }\n }\n }\n\n return res;\n}\n", + "target": "tChecksumCheckResult ParaNdis_CheckRxChecksum(\n PARANDIS_ADAPTER *pContext,\n ULONG virtioFlags,\n tCompletePhysicalAddress *pPacketPages,\n ULONG ulPacketLength,\n ULONG ulDataOffset)\n {\n tOffloadSettingsFlags f = pContext->Offload.flags;\n tChecksumCheckResult res;\n tTcpIpPacketParsingResult ppr;\n ULONG flagsToCalculate = 0;\n res.value = 0;\n \n\n if (f.fRxIPChecksum) flagsToCalculate |= pcrIpChecksum; // check only\n\n if (!(virtioFlags & VIRTIO_NET_HDR_F_DATA_VALID))\n {\n if (virtioFlags & VIRTIO_NET_HDR_F_NEEDS_CSUM)\n {\n flagsToCalculate |= pcrFixXxpChecksum | pcrTcpChecksum | pcrUdpChecksum;\n }\n else\n {\n if (f.fRxTCPChecksum) flagsToCalculate |= pcrTcpV4Checksum;\n if (f.fRxUDPChecksum) flagsToCalculate |= pcrUdpV4Checksum;\n if (f.fRxTCPv6Checksum) flagsToCalculate |= pcrTcpV6Checksum;\n if (f.fRxUDPv6Checksum) flagsToCalculate |= pcrUdpV6Checksum;\n }\n }\n \n ppr = ParaNdis_CheckSumVerify(pPacketPages, ulPacketLength - ETH_HEADER_SIZE, ulDataOffset + ETH_HEADER_SIZE, flagsToCalculate, __FUNCTION__);\n \n if (ppr.ipCheckSum == ppresIPTooShort || ppr.xxpStatus == ppresXxpIncomplete)\n {\n res.flags.IpOK = FALSE;\n res.flags.IpFailed = TRUE;\n return res;\n }\n\n if (virtioFlags & VIRTIO_NET_HDR_F_DATA_VALID)\n {\n pContext->extraStatistics.framesRxCSHwOK++;\n ppr.xxpCheckSum = ppresCSOK;\n }\n\n if (ppr.ipStatus == ppresIPV4 && !ppr.IsFragment)\n {\n if (f.fRxIPChecksum)\n {\n res.flags.IpOK = ppr.ipCheckSum == ppresCSOK;\n res.flags.IpFailed = ppr.ipCheckSum == ppresCSBad;\n }\n if(ppr.xxpStatus == ppresXxpKnown)\n {\n if(ppr.TcpUdp == ppresIsTCP) /* TCP */\n {\n if (f.fRxTCPChecksum)\n {\n res.flags.TcpOK = ppr.xxpCheckSum == ppresCSOK || ppr.fixedXxpCS;\n res.flags.TcpFailed = !res.flags.TcpOK;\n }\n }\n else /* UDP */\n {\n if (f.fRxUDPChecksum)\n {\n res.flags.UdpOK = ppr.xxpCheckSum == ppresCSOK || ppr.fixedXxpCS;\n res.flags.UdpFailed = !res.flags.UdpOK;\n }\n }\n }\n }\n else if (ppr.ipStatus == ppresIPV6)\n {\n if(ppr.xxpStatus == ppresXxpKnown)\n {\n if(ppr.TcpUdp == ppresIsTCP) /* TCP */\n {\n if (f.fRxTCPv6Checksum)\n {\n res.flags.TcpOK = ppr.xxpCheckSum == ppresCSOK || ppr.fixedXxpCS;\n res.flags.TcpFailed = !res.flags.TcpOK;\n }\n }\n else /* UDP */\n {\n if (f.fRxUDPv6Checksum)\n {\n res.flags.UdpOK = ppr.xxpCheckSum == ppresCSOK || ppr.fixedXxpCS;\n res.flags.UdpFailed = !res.flags.UdpOK;\n }\n }\n }\n }\n\n return res;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#17-69233f4e2a93", + "input": "\tdef add_input(self, data):\n\t\tconnection = self.connect()\n\t\ttry:\n\t\t\t# The following introduces a deliberate security flaw.See section on SQL injection below\n\t\t\tquery = \"INSERT INTO crimes (description) VALUES('{}');\".format(data)\n\t\t\twith connection.cursor() as cursor:\n\t\t\t\tcursor.execute(query)\n\t\t\t\tconnection.commit()\n\t\tfinally:\n\t\t\tconnection.close()", + "target": "\tdef add_input(self, data):\n\t\tconnection = self.connect()\n\t\ttry:\n\t\t\t# The following introduces a deliberate security flaw.See section on SQL injection below\n\t\t\tquery = \"INSERT INTO crimes (description) VALUES (%s);\"\n\t\t\twith connection.cursor() as cursor:\n\t\t\t\tcursor.execute(query, data)\n\t\t\t\tconnection.commit()\n\t\tfinally:\n\t\t\tconnection.close()", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#2cb006bc9d3ad16353ed49c2b75faea618156d0f", + "input": " bool AppCacheBackendImpl::MarkAsForeignEntry(\n int host_id,\n const GURL& document_url,\n int64 cache_document_was_loaded_from) {\n AppCacheHost* host = GetHost(host_id);\n if (!host)\n return false;\n \n host->MarkAsForeignEntry(document_url, cache_document_was_loaded_from);\n return true;\n }\n", + "target": " bool AppCacheBackendImpl::MarkAsForeignEntry(\n int host_id,\n const GURL& document_url,\n int64 cache_document_was_loaded_from) {\n AppCacheHost* host = GetHost(host_id);\n if (!host)\n return false;\n \n return host->MarkAsForeignEntry(document_url, cache_document_was_loaded_from);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7cadd489698be117c47efcadd742651594429e6d", + "input": "int main(int argc, char *argv[]) {\n struct mschm_decompressor *chmd;\n struct mschmd_header *chm;\n struct mschmd_file *file, **f;\n unsigned int numf, i;\n\n setbuf(stdout, NULL);\n setbuf(stderr, NULL);\n user_umask = umask(0); umask(user_umask);\n\n MSPACK_SYS_SELFTEST(i);\n if (i) return 0;\n\n if ((chmd = mspack_create_chm_decompressor(NULL))) {\n for (argv++; *argv; argv++) {\n printf(\"%s\\n\", *argv);\n if ((chm = chmd->open(chmd, *argv))) {\n\n\t/* build an ordered list of files for maximum extraction speed */\n\tfor (numf=0, file=chm->files; file; file = file->next) numf++;\n\tif ((f = (struct mschmd_file **) calloc(numf, sizeof(struct mschmd_file *)))) {\n\t for (i=0, file=chm->files; file; file = file->next) f[i++] = file;\n \t qsort(f, numf, sizeof(struct mschmd_file *), &sortfunc);\n \n \t for (i = 0; i < numf; i++) {\n\t char *outname = create_output_name((unsigned char *)f[i]->filename,NULL,0,1,0);\n \t printf(\"Extracting %s\\n\", outname);\n \t ensure_filepath(outname);\n \t if (chmd->extract(chmd, f[i], outname)) {\n\t printf(\"%s: extract error on \\\"%s\\\": %s\\n\",\n\t\t *argv, f[i]->filename, ERROR(chmd));\n\t }\n\t free(outname);\n\t }\n\t free(f);\n\t}\n\tchmd->close(chmd, chm);\n }\n else {\n\tprintf(\"%s: can't open -- %s\\n\", *argv, ERROR(chmd));\n }\n }\n mspack_destroy_chm_decompressor(chmd);\n }\n return 0;\n}\n", + "target": "int main(int argc, char *argv[]) {\n struct mschm_decompressor *chmd;\n struct mschmd_header *chm;\n struct mschmd_file *file, **f;\n unsigned int numf, i;\n\n setbuf(stdout, NULL);\n setbuf(stderr, NULL);\n user_umask = umask(0); umask(user_umask);\n\n MSPACK_SYS_SELFTEST(i);\n if (i) return 0;\n\n if ((chmd = mspack_create_chm_decompressor(NULL))) {\n for (argv++; *argv; argv++) {\n printf(\"%s\\n\", *argv);\n if ((chm = chmd->open(chmd, *argv))) {\n\n\t/* build an ordered list of files for maximum extraction speed */\n\tfor (numf=0, file=chm->files; file; file = file->next) numf++;\n\tif ((f = (struct mschmd_file **) calloc(numf, sizeof(struct mschmd_file *)))) {\n\t for (i=0, file=chm->files; file; file = file->next) f[i++] = file;\n \t qsort(f, numf, sizeof(struct mschmd_file *), &sortfunc);\n \n \t for (i = 0; i < numf; i++) {\n\t char *outname = create_output_name(f[i]->filename);\n \t printf(\"Extracting %s\\n\", outname);\n \t ensure_filepath(outname);\n \t if (chmd->extract(chmd, f[i], outname)) {\n\t printf(\"%s: extract error on \\\"%s\\\": %s\\n\",\n\t\t *argv, f[i]->filename, ERROR(chmd));\n\t }\n\t free(outname);\n\t }\n\t free(f);\n\t}\n\tchmd->close(chmd, chm);\n }\n else {\n\tprintf(\"%s: can't open -- %s\\n\", *argv, ERROR(chmd));\n }\n }\n mspack_destroy_chm_decompressor(chmd);\n }\n return 0;\n}\n", + "vul_type": "cwe-22", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#29014da83e5fc358d6bff0f574e9ed45e61a35ac", + "input": " void BrowserContextDestroyer::FinishDestroyContext() {\n DCHECK_EQ(pending_hosts_, 0U);\n \n delete context_;\n context_ = nullptr;\n \n delete this;\n }\n", + "target": " void BrowserContextDestroyer::FinishDestroyContext() {\n DCHECK(finish_destroy_scheduled_);\n CHECK_EQ(GetHostsForContext(context_.get()).size(), 0U)\n << \"One or more RenderProcessHosts exist whilst its BrowserContext is \"\n << \"being deleted!\";\n \n g_contexts_pending_deletion.Get().remove(this);\n\n if (context_->IsOffTheRecord()) {\n // If this is an OTR context and its owner BrowserContext has been scheduled\n // for deletion, update the owner's BrowserContextDestroyer\n BrowserContextDestroyer* orig_destroyer =\n GetForContext(context_->GetOriginalContext());\n if (orig_destroyer) {\n DCHECK_GT(orig_destroyer->otr_contexts_pending_deletion_, 0U);\n DCHECK(!orig_destroyer->finish_destroy_scheduled_);\n --orig_destroyer->otr_contexts_pending_deletion_;\n orig_destroyer->MaybeScheduleFinishDestroyContext();\n }\n }\n \n delete this;\n }\n", + "vul_type": "cwe-20", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cd0bd79d6ebdb72183e6f0833673464cc10b3600", + "input": " static void CopyTransportDIBHandleForMessage(\n const TransportDIB::Handle& handle_in,\n TransportDIB::Handle* handle_out) {\n #if defined(OS_MACOSX)\n if ((handle_out->fd = HANDLE_EINTR(dup(handle_in.fd))) < 0) {\n PLOG(ERROR) << \"dup()\";\n return;\n }\n handle_out->auto_close = true;\n #else\n *handle_out = handle_in;\n#endif\n}\n", + "target": " static void CopyTransportDIBHandleForMessage(\n const TransportDIB::Handle& handle_in,\n TransportDIB::Handle* handle_out,\n base::ProcessId peer_pid) {\n #if defined(OS_MACOSX)\n if ((handle_out->fd = HANDLE_EINTR(dup(handle_in.fd))) < 0) {\n PLOG(ERROR) << \"dup()\";\n return;\n }\n handle_out->auto_close = true;\n#elif defined(OS_WIN)\n // On Windows we need to duplicate the handle for the plugin process.\n *handle_out = NULL;\n sandbox::BrokerDuplicateHandle(handle_in, peer_pid, handle_out,\n FILE_MAP_READ | FILE_MAP_WRITE, 0);\n CHECK(*handle_out != NULL);\n #else\n *handle_out = handle_in;\n#endif\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ac149a8d4371c0e01e0934fdd57b09e86f96b5b9", + "input": "static int _hid_get_descriptor(struct hid_device_priv* dev, HANDLE hid_handle, int recipient,\n\t\t\t\t\t\t\t int type, int _index, void *data, size_t *size)\n{\n\tswitch(type) {\n\tcase LIBUSB_DT_DEVICE:\n\t\tusbi_dbg(\"LIBUSB_DT_DEVICE\");\n\t\treturn _hid_get_device_descriptor(dev, data, size);\n\tcase LIBUSB_DT_CONFIG:\n\t\tusbi_dbg(\"LIBUSB_DT_CONFIG\");\n\t\tif (!_index)\n\t\t\treturn _hid_get_config_descriptor(dev, data, size);\n\t\treturn LIBUSB_ERROR_INVALID_PARAM;\n\tcase LIBUSB_DT_STRING:\n\t\tusbi_dbg(\"LIBUSB_DT_STRING\");\n\t\treturn _hid_get_string_descriptor(dev, _index, data, size);\n\tcase LIBUSB_DT_HID:\n\t\tusbi_dbg(\"LIBUSB_DT_HID\");\n\t\tif (!_index)\n\t\t\treturn _hid_get_hid_descriptor(dev, data, size);\n\t\treturn LIBUSB_ERROR_INVALID_PARAM;\n\tcase LIBUSB_DT_REPORT:\n\t\tusbi_dbg(\"LIBUSB_DT_REPORT\");\n\t\tif (!_index)\n\t\t\treturn _hid_get_report_descriptor(dev, data, size);\n\t\treturn LIBUSB_ERROR_INVALID_PARAM;\n\tcase LIBUSB_DT_PHYSICAL:\n\t\tusbi_dbg(\"LIBUSB_DT_PHYSICAL\");\n\t\tif (HidD_GetPhysicalDescriptor(hid_handle, data, (ULONG)*size))\n\t\t\treturn LIBUSB_COMPLETED;\n\t\treturn LIBUSB_ERROR_OTHER;\n\t}\n\tusbi_dbg(\"unsupported\");\n\treturn LIBUSB_ERROR_INVALID_PARAM;\n}\n", + "target": "static int _hid_get_descriptor(struct hid_device_priv* dev, HANDLE hid_handle, int recipient,\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0f177948ae2640bfe4d70f8e4248e106406b3b0a", + "input": " BufferMeta(size_t size, OMX_U32 portIndex)\n : mSize(size),\n mIsBackup(false),\n mPortIndex(portIndex) {\n }\n", + "target": " BufferMeta(size_t size, OMX_U32 portIndex)\n : mSize(size),\n mCopyFromOmx(false),\n mCopyToOmx(false),\n mPortIndex(portIndex),\n mBackup(NULL) {\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cb07844454d8cc9fb21f53ace75975f91185a120", + "input": "pax_decode_header (struct tar_sparse_file *file)\n{\n if (file->stat_info->sparse_major > 0)\n {\n uintmax_t u;\n char nbuf[UINTMAX_STRSIZE_BOUND];\n union block *blk;\n char *p;\n size_t i;\n off_t start;\n \n#define COPY_BUF(b,buf,src) do \\\n { \\\n char *endp = b->buffer + BLOCKSIZE; \\\n char *dst = buf; \\\n do \\\n { \\\n if (dst == buf + UINTMAX_STRSIZE_BOUND -1) \\\n { \\\n ERROR ((0, 0, _(\"%s: numeric overflow in sparse archive member\"), \\\n\t file->stat_info->orig_file_name)); \\\n return false; \\\n } \\\n if (src == endp) \\\n \t { \\\n \t set_next_block_after (b); \\\n b = find_next_block (); \\\n src = b->buffer; \\\n \t endp = b->buffer + BLOCKSIZE; \\\n \t } \\\n while (*dst++ != '\\n'); \\\n dst[-1] = 0; \\\n } while (0)\n\n start = current_block_ordinal ();\n set_next_block_after (current_header);\n start = current_block_ordinal ();\n set_next_block_after (current_header);\n blk = find_next_block ();\n p = blk->buffer;\n COPY_BUF (blk,nbuf,p);\n if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t)))\n\t}\n file->stat_info->sparse_map_size = u;\n file->stat_info->sparse_map = xcalloc (file->stat_info->sparse_map_size,\n\t\t\t\t\t sizeof (*file->stat_info->sparse_map));\n file->stat_info->sparse_map_avail = 0;\n for (i = 0; i < file->stat_info->sparse_map_size; i++)\n\t{\n\t struct sp_array sp;\n\n\t COPY_BUF (blk,nbuf,p);\n\t if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))\n\t {\n\t ERROR ((0, 0, _(\"%s: malformed sparse archive member\"),\n\t\t file->stat_info->orig_file_name));\n\t return false;\n\t }\n\t sp.offset = u;\n\t COPY_BUF (blk,nbuf,p);\n\t if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))\n\t {\n\t ERROR ((0, 0, _(\"%s: malformed sparse archive member\"),\n\t\t file->stat_info->orig_file_name));\n\t return false;\n\t }\n\t sp.numbytes = u;\n\t sparse_add_map (file->stat_info, &sp);\n\t}\n set_next_block_after (blk);\n\n file->dumped_size += BLOCKSIZE * (current_block_ordinal () - start);\n }\n\n return true;\n}\n", + "target": "pax_decode_header (struct tar_sparse_file *file)\n{\n if (file->stat_info->sparse_major > 0)\n {\n uintmax_t u;\n char nbuf[UINTMAX_STRSIZE_BOUND];\n union block *blk;\n char *p;\n size_t i;\n off_t start;\n \n#define COPY_BUF(b,buf,src) do \\\n { \\\n char *endp = b->buffer + BLOCKSIZE; \\\n char *dst = buf; \\\n do \\\n { \\\n if (dst == buf + UINTMAX_STRSIZE_BOUND -1) \\\n { \\\n ERROR ((0, 0, _(\"%s: numeric overflow in sparse archive member\"), \\\n\t file->stat_info->orig_file_name)); \\\n return false; \\\n } \\\n if (src == endp) \\\n \t { \\\n \t set_next_block_after (b); \\\n b = find_next_block (); \\\n if (!b) \\\n FATAL_ERROR ((0, 0, _(\"Unexpected EOF in archive\"))); \\\n src = b->buffer; \\\n \t endp = b->buffer + BLOCKSIZE; \\\n \t } \\\n while (*dst++ != '\\n'); \\\n dst[-1] = 0; \\\n } while (0)\n\n start = current_block_ordinal ();\n set_next_block_after (current_header);\n start = current_block_ordinal ();\n set_next_block_after (current_header);\n blk = find_next_block ();\n if (!blk)\n FATAL_ERROR ((0, 0, _(\"Unexpected EOF in archive\")));\n p = blk->buffer;\n COPY_BUF (blk,nbuf,p);\n if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t)))\n\t}\n file->stat_info->sparse_map_size = u;\n file->stat_info->sparse_map = xcalloc (file->stat_info->sparse_map_size,\n\t\t\t\t\t sizeof (*file->stat_info->sparse_map));\n file->stat_info->sparse_map_avail = 0;\n for (i = 0; i < file->stat_info->sparse_map_size; i++)\n\t{\n\t struct sp_array sp;\n\n\t COPY_BUF (blk,nbuf,p);\n\t if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))\n\t {\n\t ERROR ((0, 0, _(\"%s: malformed sparse archive member\"),\n\t\t file->stat_info->orig_file_name));\n\t return false;\n\t }\n\t sp.offset = u;\n\t COPY_BUF (blk,nbuf,p);\n\t if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))\n\t {\n\t ERROR ((0, 0, _(\"%s: malformed sparse archive member\"),\n\t\t file->stat_info->orig_file_name));\n\t return false;\n\t }\n\t sp.numbytes = u;\n\t sparse_add_map (file->stat_info, &sp);\n\t}\n set_next_block_after (blk);\n\n file->dumped_size += BLOCKSIZE * (current_block_ordinal () - start);\n }\n\n return true;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f3a24d7916b9173c69a3e0ee790102993833d6c5", + "input": "CURLcode Curl_auth_create_plain_message(struct Curl_easy *data,\n const char *userp,\n const char *passwdp,\n char **outptr, size_t *outlen)\n{\n CURLcode result;\n char *plainauth;\n size_t ulen;\n size_t plen;\n size_t plainlen;\n\n *outlen = 0;\n *outptr = NULL;\n ulen = strlen(userp);\n plen = strlen(passwdp);\n \n /* Compute binary message length. Check for overflows. */\n if((ulen > SIZE_T_MAX/2) || (plen > (SIZE_T_MAX/2 - 2)))\n return CURLE_OUT_OF_MEMORY;\n plainlen = 2 * ulen + plen + 2;\n \n plainauth = malloc(plainlen);\n if(!plainauth)\n return CURLE_OUT_OF_MEMORY;\n\n /* Calculate the reply */\n memcpy(plainauth, userp, ulen);\n plainauth[ulen] = '\\0';\n memcpy(plainauth + ulen + 1, userp, ulen);\n plainauth[2 * ulen + 1] = '\\0';\n memcpy(plainauth + 2 * ulen + 2, passwdp, plen);\n\n /* Base64 encode the reply */\n result = Curl_base64_encode(data, plainauth, plainlen, outptr, outlen);\n free(plainauth);\n\n return result;\n}\n", + "target": "CURLcode Curl_auth_create_plain_message(struct Curl_easy *data,\n const char *userp,\n const char *passwdp,\n char **outptr, size_t *outlen)\n{\n CURLcode result;\n char *plainauth;\n size_t ulen;\n size_t plen;\n size_t plainlen;\n\n *outlen = 0;\n *outptr = NULL;\n ulen = strlen(userp);\n plen = strlen(passwdp);\n \n /* Compute binary message length. Check for overflows. */\n if((ulen > SIZE_T_MAX/4) || (plen > (SIZE_T_MAX/2 - 2)))\n return CURLE_OUT_OF_MEMORY;\n plainlen = 2 * ulen + plen + 2;\n \n plainauth = malloc(plainlen);\n if(!plainauth)\n return CURLE_OUT_OF_MEMORY;\n\n /* Calculate the reply */\n memcpy(plainauth, userp, ulen);\n plainauth[ulen] = '\\0';\n memcpy(plainauth + ulen + 1, userp, ulen);\n plainauth[2 * ulen + 1] = '\\0';\n memcpy(plainauth + 2 * ulen + 2, passwdp, plen);\n\n /* Base64 encode the reply */\n result = Curl_base64_encode(data, plainauth, plainlen, outptr, outlen);\n free(plainauth);\n\n return result;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#295c883fe3105b19bcd0f9e07d54c6b589fc5bff", + "input": "OMX_ERRORTYPE SoftAMRNBEncoder::internalSetParameter(\n OMX_INDEXTYPE index, const OMX_PTR params) {\n switch (index) {\n case OMX_IndexParamStandardComponentRole:\n {\n\n const OMX_PARAM_COMPONENTROLETYPE *roleParams =\n (const OMX_PARAM_COMPONENTROLETYPE *)params;\n \n if (strncmp((const char *)roleParams->cRole,\n \"audio_encoder.amrnb\",\n OMX_MAX_STRINGNAME_SIZE - 1)) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioPortFormat:\n {\n\n const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =\n (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;\n \n if (formatParams->nPortIndex > 1) {\n return OMX_ErrorUndefined;\n }\n\n if (formatParams->nIndex > 0) {\n return OMX_ErrorNoMore;\n }\n\n if ((formatParams->nPortIndex == 0\n && formatParams->eEncoding != OMX_AUDIO_CodingPCM)\n || (formatParams->nPortIndex == 1\n && formatParams->eEncoding != OMX_AUDIO_CodingAMR)) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioAmr:\n {\n\n OMX_AUDIO_PARAM_AMRTYPE *amrParams =\n (OMX_AUDIO_PARAM_AMRTYPE *)params;\n \n if (amrParams->nPortIndex != 1) {\n return OMX_ErrorUndefined;\n }\n\n if (amrParams->nChannels != 1\n || amrParams->eAMRDTXMode != OMX_AUDIO_AMRDTXModeOff\n || amrParams->eAMRFrameFormat\n != OMX_AUDIO_AMRFrameFormatFSF\n || amrParams->eAMRBandMode < OMX_AUDIO_AMRBandModeNB0\n || amrParams->eAMRBandMode > OMX_AUDIO_AMRBandModeNB7) {\n return OMX_ErrorUndefined;\n }\n\n mBitRate = amrParams->nBitRate;\n mMode = amrParams->eAMRBandMode - 1;\n\n amrParams->eAMRDTXMode = OMX_AUDIO_AMRDTXModeOff;\n amrParams->eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF;\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioPcm:\n {\n\n OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =\n (OMX_AUDIO_PARAM_PCMMODETYPE *)params;\n \n if (pcmParams->nPortIndex != 0) {\n return OMX_ErrorUndefined;\n }\n\n if (pcmParams->nChannels != 1\n || pcmParams->nSamplingRate != (OMX_U32)kSampleRate) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n\n default:\n return SimpleSoftOMXComponent::internalSetParameter(index, params);\n }\n}\n", + "target": "OMX_ERRORTYPE SoftAMRNBEncoder::internalSetParameter(\n OMX_INDEXTYPE index, const OMX_PTR params) {\n switch (index) {\n case OMX_IndexParamStandardComponentRole:\n {\n\n const OMX_PARAM_COMPONENTROLETYPE *roleParams =\n (const OMX_PARAM_COMPONENTROLETYPE *)params;\n \n if (!isValidOMXParam(roleParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (strncmp((const char *)roleParams->cRole,\n \"audio_encoder.amrnb\",\n OMX_MAX_STRINGNAME_SIZE - 1)) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioPortFormat:\n {\n\n const OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =\n (const OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;\n \n if (!isValidOMXParam(formatParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (formatParams->nPortIndex > 1) {\n return OMX_ErrorUndefined;\n }\n\n if (formatParams->nIndex > 0) {\n return OMX_ErrorNoMore;\n }\n\n if ((formatParams->nPortIndex == 0\n && formatParams->eEncoding != OMX_AUDIO_CodingPCM)\n || (formatParams->nPortIndex == 1\n && formatParams->eEncoding != OMX_AUDIO_CodingAMR)) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioAmr:\n {\n\n OMX_AUDIO_PARAM_AMRTYPE *amrParams =\n (OMX_AUDIO_PARAM_AMRTYPE *)params;\n \n if (!isValidOMXParam(amrParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (amrParams->nPortIndex != 1) {\n return OMX_ErrorUndefined;\n }\n\n if (amrParams->nChannels != 1\n || amrParams->eAMRDTXMode != OMX_AUDIO_AMRDTXModeOff\n || amrParams->eAMRFrameFormat\n != OMX_AUDIO_AMRFrameFormatFSF\n || amrParams->eAMRBandMode < OMX_AUDIO_AMRBandModeNB0\n || amrParams->eAMRBandMode > OMX_AUDIO_AMRBandModeNB7) {\n return OMX_ErrorUndefined;\n }\n\n mBitRate = amrParams->nBitRate;\n mMode = amrParams->eAMRBandMode - 1;\n\n amrParams->eAMRDTXMode = OMX_AUDIO_AMRDTXModeOff;\n amrParams->eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF;\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioPcm:\n {\n\n OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =\n (OMX_AUDIO_PARAM_PCMMODETYPE *)params;\n \n if (!isValidOMXParam(pcmParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (pcmParams->nPortIndex != 0) {\n return OMX_ErrorUndefined;\n }\n\n if (pcmParams->nChannels != 1\n || pcmParams->nSamplingRate != (OMX_U32)kSampleRate) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n\n default:\n return SimpleSoftOMXComponent::internalSetParameter(index, params);\n }\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5e5c796617e1712905dc5462b94bd5e6c08d15ea", + "input": "wiki_handle_http_request(HttpRequest *req)\n{\n HttpResponse *res = http_response_new(req);\n char *page = http_request_get_path_info(req); \n char *command = http_request_get_query_string(req); \n char *wikitext = \"\";\n\n util_dehttpize(page); \t/* remove any encoding on the requested\n\t\t\t\t page name. */\n\n if (!strcmp(page, \"/\"))\n {\n if (access(\"WikiHome\", R_OK) != 0)\n\twiki_redirect(res, \"/WikiHome?create\");\n page = \"/WikiHome\";\n }\n\n if (!strcmp(page, \"/styles.css\"))\n {\n /* Return CSS page */\n http_response_set_content_type(res, \"text/css\");\n http_response_printf(res, \"%s\", CssData);\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"/favicon.ico\"))\n {\n /* Return favicon */\n http_response_set_content_type(res, \"image/ico\");\n http_response_set_data(res, FaviconData, FaviconDataLen);\n http_response_send(res);\n exit(0);\n }\n\n\n page = page + 1; \t\t/* skip slash */\n\n if (!strncmp(page, \"api/\", 4))\n {\n char *p;\n\n page += 4; \n for (p=page; *p != '\\0'; p++)\n\tif (*p=='?') { *p ='\\0'; break; }\n \n wiki_handle_rest_call(req, res, page); \n exit(0);\n }\n\n /* A little safety. issue a malformed request for any paths,\n * There shouldn't need to be any..\n */\n if (strchr(page, '/'))\n {\n http_response_set_status(res, 404, \"Not Found\");\n http_response_printf(res, \"404 Not Found\\n\");\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"Changes\"))\n {\n wiki_show_changes_page(res);\n }\n else if (!strcmp(page, \"ChangesRss\"))\n {\n wiki_show_changes_page_rss(res);\n }\n else if (!strcmp(page, \"Search\"))\n {\n wiki_show_search_results_page(res, http_request_param_get(req, \"expr\"));\n }\n else if (!strcmp(page, \"Create\"))\n {\n if ( (wikitext = http_request_param_get(req, \"title\")) != NULL)\n\t{\n\t /* create page and redirect */\n\t wiki_redirect(res, http_request_param_get(req, \"title\"));\n\t}\n else\n\t{\n\t /* show create page form */\n\t wiki_show_create_page(res);\n\t}\n }\n else\n {\n /* TODO: dont blindly write wikitext data to disk */\n if ( (wikitext = http_request_param_get(req, \"wikitext\")) != NULL)\n\t{\n\t file_write(page, wikitext);\t \n\t}\n\n if (access(page, R_OK) == 0) \t/* page exists */\n\t{\n\t wikitext = file_read(page);\n\t \n\t if (!strcmp(command, \"edit\"))\n\t {\n\t /* print edit page */\n\t wiki_show_edit_page(res, wikitext, page);\n\t }\n\t else\n\t {\n\t wiki_show_page(res, wikitext, page);\n\t }\n\t}\n else\n\t{\n\t if (!strcmp(command, \"create\"))\n\t {\n\t wiki_show_edit_page(res, NULL, page);\n\t }\n\t else\n\t {\n\t char buf[1024];\n\t snprintf(buf, 1024, \"%s?create\", page);\n\t wiki_redirect(res, buf);\n\t }\n\t}\n }\n\n}\n", + "target": "wiki_handle_http_request(HttpRequest *req)\n{\n HttpResponse *res = http_response_new(req);\n char *page = http_request_get_path_info(req); \n char *command = http_request_get_query_string(req); \n char *wikitext = \"\";\n\n util_dehttpize(page); \t/* remove any encoding on the requested\n\t\t\t\t page name. */\n\n if (!strcmp(page, \"/\"))\n {\n if (access(\"WikiHome\", R_OK) != 0)\n\twiki_redirect(res, \"/WikiHome?create\");\n page = \"/WikiHome\";\n }\n\n if (!strcmp(page, \"/styles.css\"))\n {\n /* Return CSS page */\n http_response_set_content_type(res, \"text/css\");\n http_response_printf(res, \"%s\", CssData);\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"/favicon.ico\"))\n {\n /* Return favicon */\n http_response_set_content_type(res, \"image/ico\");\n http_response_set_data(res, FaviconData, FaviconDataLen);\n http_response_send(res);\n exit(0);\n }\n\n\n page = page + 1; \t\t/* skip slash */\n\n if (!strncmp(page, \"api/\", 4))\n {\n char *p;\n\n page += 4; \n for (p=page; *p != '\\0'; p++)\n\tif (*p=='?') { *p ='\\0'; break; }\n \n wiki_handle_rest_call(req, res, page); \n exit(0);\n }\n\n /* A little safety. issue a malformed request for any paths,\n * There shouldn't need to be any..\n */\n if (!page_name_is_good(page))\n {\n http_response_set_status(res, 404, \"Not Found\");\n http_response_printf(res, \"404 Not Found\\n\");\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"Changes\"))\n {\n wiki_show_changes_page(res);\n }\n else if (!strcmp(page, \"ChangesRss\"))\n {\n wiki_show_changes_page_rss(res);\n }\n else if (!strcmp(page, \"Search\"))\n {\n wiki_show_search_results_page(res, http_request_param_get(req, \"expr\"));\n }\n else if (!strcmp(page, \"Create\"))\n {\n if ( (wikitext = http_request_param_get(req, \"title\")) != NULL)\n\t{\n\t /* create page and redirect */\n\t wiki_redirect(res, http_request_param_get(req, \"title\"));\n\t}\n else\n\t{\n\t /* show create page form */\n\t wiki_show_create_page(res);\n\t}\n }\n else\n {\n /* TODO: dont blindly write wikitext data to disk */\n if ( (wikitext = http_request_param_get(req, \"wikitext\")) != NULL)\n\t{\n\t file_write(page, wikitext);\t \n\t}\n\n if (access(page, R_OK) == 0) \t/* page exists */\n\t{\n\t wikitext = file_read(page);\n\t \n\t if (!strcmp(command, \"edit\"))\n\t {\n\t /* print edit page */\n\t wiki_show_edit_page(res, wikitext, page);\n\t }\n\t else\n\t {\n\t wiki_show_page(res, wikitext, page);\n\t }\n\t}\n else\n\t{\n\t if (!strcmp(command, \"create\"))\n\t {\n\t wiki_show_edit_page(res, NULL, page);\n\t }\n\t else\n\t {\n\t char buf[1024];\n\t snprintf(buf, 1024, \"%s?create\", page);\n\t wiki_redirect(res, buf);\n\t }\n\t}\n }\n\n}\n", + "vul_type": "cwe-22", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "row_copy(png_bytep toBuffer, png_const_bytep fromBuffer, unsigned int bitWidth)\n {\n memcpy(toBuffer, fromBuffer, bitWidth >> 3);\n \n if ((bitWidth & 7) != 0)\n {\n unsigned int mask;\n\n \n toBuffer += bitWidth >> 3;\n fromBuffer += bitWidth >> 3;\n /* The remaining bits are in the top of the byte, the mask is the bits to\n * retain.\n */\n mask = 0xff >> (bitWidth & 7);\n *toBuffer = (png_byte)((*toBuffer & mask) | (*fromBuffer & ~mask));\n }\n }\n", + "target": "row_copy(png_bytep toBuffer, png_const_bytep fromBuffer, unsigned int bitWidth)\nrow_copy(png_bytep toBuffer, png_const_bytep fromBuffer, unsigned int bitWidth,\n int littleendian)\n {\n memcpy(toBuffer, fromBuffer, bitWidth >> 3);\n \n if ((bitWidth & 7) != 0)\n {\n unsigned int mask;\n\n \n toBuffer += bitWidth >> 3;\n fromBuffer += bitWidth >> 3;\n if (littleendian)\n mask = 0xff << (bitWidth & 7);\n else\n mask = 0xff >> (bitWidth & 7);\n *toBuffer = (png_byte)((*toBuffer & mask) | (*fromBuffer & ~mask));\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " string DecodeFile(const string& filename, int num_threads) {\n libvpx_test::WebMVideoSource video(filename);\n video.Init();\n \n vpx_codec_dec_cfg_t cfg = {0};\n cfg.threads = num_threads;\n libvpx_test::VP9Decoder decoder(cfg, 0);\n \n libvpx_test::MD5 md5;\n for (video.Begin(); video.cxdata(); video.Next()) {\n const vpx_codec_err_t res =\n decoder.DecodeFrame(video.cxdata(), video.frame_size());\n if (res != VPX_CODEC_OK) {\n EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();\n break;\n }\n\n libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();\n const vpx_image_t *img = NULL;\n\n while ((img = dec_iter.Next())) {\n md5.Add(img);\n }\n }\n\n return string(md5.Get());\n }\n", + "target": " string DecodeFile(const string& filename, int num_threads) {\n libvpx_test::WebMVideoSource video(filename);\n video.Init();\n \n vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();\n cfg.threads = num_threads;\n libvpx_test::VP9Decoder decoder(cfg, 0);\n \n libvpx_test::MD5 md5;\n for (video.Begin(); video.cxdata(); video.Next()) {\n const vpx_codec_err_t res =\n decoder.DecodeFrame(video.cxdata(), video.frame_size());\n if (res != VPX_CODEC_OK) {\n EXPECT_EQ(VPX_CODEC_OK, res) << decoder.DecodeError();\n break;\n }\n\n libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();\n const vpx_image_t *img = NULL;\n\n while ((img = dec_iter.Next())) {\n md5.Add(img);\n }\n }\n\n return string(md5.Get());\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#438b99bc730bc665eedfc62c4eb864c981e5c65f", + "input": "void AppLauncherHandler::FillAppDictionary(base::DictionaryValue* dictionary) {\n base::AutoReset auto_reset(&ignore_changes_, true);\n\n base::ListValue* list = new base::ListValue();\n Profile* profile = Profile::FromWebUI(web_ui());\n PrefService* prefs = profile->GetPrefs();\n\n for (std::set::iterator it = visible_apps_.begin();\n it != visible_apps_.end(); ++it) {\n const Extension* extension = extension_service_->GetInstalledExtension(*it);\n if (extension && extensions::ui_util::ShouldDisplayInNewTabPage(\n extension, profile)) {\n base::DictionaryValue* app_info = GetAppInfo(extension);\n list->Append(app_info);\n }\n }\n \n dictionary->Set(\"apps\", list);\n \n#if defined(OS_MACOSX)\n dictionary->SetBoolean(\"disableAppWindowLaunch\", true);\n dictionary->SetBoolean(\"disableCreateAppShortcut\", true);\n#endif\n#if defined(OS_CHROMEOS)\n dictionary->SetBoolean(\"disableCreateAppShortcut\", true);\n#endif\n const base::ListValue* app_page_names =\n prefs->GetList(prefs::kNtpAppPageNames);\n if (!app_page_names || !app_page_names->GetSize()) {\n ListPrefUpdate update(prefs, prefs::kNtpAppPageNames);\n base::ListValue* list = update.Get();\n list->Set(0, new base::StringValue(\n l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME)));\n dictionary->Set(\"appPageNames\",\n static_cast(list->DeepCopy()));\n } else {\n dictionary->Set(\"appPageNames\",\n static_cast(app_page_names->DeepCopy()));\n }\n}\n", + "target": "void AppLauncherHandler::FillAppDictionary(base::DictionaryValue* dictionary) {\n base::AutoReset auto_reset(&ignore_changes_, true);\n\n base::ListValue* list = new base::ListValue();\n Profile* profile = Profile::FromWebUI(web_ui());\n PrefService* prefs = profile->GetPrefs();\n\n for (std::set::iterator it = visible_apps_.begin();\n it != visible_apps_.end(); ++it) {\n const Extension* extension = extension_service_->GetInstalledExtension(*it);\n if (extension && extensions::ui_util::ShouldDisplayInNewTabPage(\n extension, profile)) {\n base::DictionaryValue* app_info = GetAppInfo(extension);\n list->Append(app_info);\n }\n }\n \n dictionary->Set(\"apps\", list);\n \n const base::ListValue* app_page_names =\n prefs->GetList(prefs::kNtpAppPageNames);\n if (!app_page_names || !app_page_names->GetSize()) {\n ListPrefUpdate update(prefs, prefs::kNtpAppPageNames);\n base::ListValue* list = update.Get();\n list->Set(0, new base::StringValue(\n l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME)));\n dictionary->Set(\"appPageNames\",\n static_cast(list->DeepCopy()));\n } else {\n dictionary->Set(\"appPageNames\",\n static_cast(app_page_names->DeepCopy()));\n }\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8dccf79857ceeb7a6d3e42c1e762e7b865d5344d", + "input": "file_add_mapi_attrs (File* file, MAPI_Attr** attrs)\n{\n int i;\n for (i = 0; attrs[i]; i++)\n {\n\tMAPI_Attr* a = attrs[i];\n\n\tif (a->num_values)\n\t{\n\n \t switch (a->name)\n \t {\n \t case MAPI_ATTACH_LONG_FILENAME:\n \t\tif (file->name) XFREE(file->name);\n \t\tfile->name = strdup( (char*)a->values[0].data.buf );\n \t\tbreak;\n \n \t case MAPI_ATTACH_DATA_OBJ:\n \t\tfile->len = a->values[0].len;\n \t\tif (file->data) XFREE (file->data);\n \t\tfile->data = CHECKED_XMALLOC (unsigned char, file->len);\n \t\tmemmove (file->data, a->values[0].data.buf, file->len);\n \t\tbreak;\n \n case MAPI_ATTACH_MIME_TAG:\n \t\tif (file->mime_type) XFREE (file->mime_type);\n \t\tfile->mime_type = CHECKED_XMALLOC (char, a->values[0].len);\n \t\tmemmove (file->mime_type, a->values[0].data.buf, a->values[0].len);\n \t\tbreak;\n \n case MAPI_ATTACH_CONTENT_ID:\n if (file->content_id) XFREE(file->content_id);\n file->content_id = CHECKED_XMALLOC (char, a->values[0].len);\n memmove (file->content_id, a->values[0].data.buf, a->values[0].len);\n break;\n\n\t default:\n\t\tbreak;\n\t }\n\t}\n }\n}\n", + "target": "file_add_mapi_attrs (File* file, MAPI_Attr** attrs)\n{\n int i;\n for (i = 0; attrs[i]; i++)\n {\n\tMAPI_Attr* a = attrs[i];\n\n\tif (a->num_values)\n\t{\n\n \t switch (a->name)\n \t {\n \t case MAPI_ATTACH_LONG_FILENAME:\n\t\tassert(a->type == szMAPI_STRING);\n \t\tif (file->name) XFREE(file->name);\n \t\tfile->name = strdup( (char*)a->values[0].data.buf );\n \t\tbreak;\n \n \t case MAPI_ATTACH_DATA_OBJ:\n\t\tassert((a->type == szMAPI_BINARY) || (a->type == szMAPI_OBJECT));\n \t\tfile->len = a->values[0].len;\n \t\tif (file->data) XFREE (file->data);\n \t\tfile->data = CHECKED_XMALLOC (unsigned char, file->len);\n \t\tmemmove (file->data, a->values[0].data.buf, file->len);\n \t\tbreak;\n \n case MAPI_ATTACH_MIME_TAG:\n\t\tassert(a->type == szMAPI_STRING);\n \t\tif (file->mime_type) XFREE (file->mime_type);\n \t\tfile->mime_type = CHECKED_XMALLOC (char, a->values[0].len);\n \t\tmemmove (file->mime_type, a->values[0].data.buf, a->values[0].len);\n \t\tbreak;\n \n case MAPI_ATTACH_CONTENT_ID:\n assert(a->type == szMAPI_STRING);\n if (file->content_id) XFREE(file->content_id);\n file->content_id = CHECKED_XMALLOC (char, a->values[0].len);\n memmove (file->content_id, a->values[0].data.buf, a->values[0].len);\n break;\n\n\t default:\n\t\tbreak;\n\t }\n\t}\n }\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c70422f760c120480fee4de6c38804c72aa26bc1", + "input": "nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,\n\t\t\t\t\tstruct nfsd3_readdirargs *args)\n{\n\tp = decode_fh(p, &args->fh);\n\tif (!p)\n\t\treturn 0;\n\tp = xdr_decode_hyper(p, &args->cookie);\n \targs->verf = p; p += 2;\n \targs->dircount = ~0;\n \targs->count = ntohl(*p++);\n \targs->count = min_t(u32, args->count, PAGE_SIZE);\n \targs->buffer = page_address(*(rqstp->rq_next_page++));\n \n\treturn xdr_argsize_check(rqstp, p);\n }\n", + "target": "nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,\n\t\t\t\t\tstruct nfsd3_readdirargs *args)\n{\n\tp = decode_fh(p, &args->fh);\n\tif (!p)\n\t\treturn 0;\n\tp = xdr_decode_hyper(p, &args->cookie);\n \targs->verf = p; p += 2;\n \targs->dircount = ~0;\n \targs->count = ntohl(*p++);\n\n\tif (!xdr_argsize_check(rqstp, p))\n\t\treturn 0;\n\n \targs->count = min_t(u32, args->count, PAGE_SIZE);\n \targs->buffer = page_address(*(rqstp->rq_next_page++));\n \n\treturn 1;\n }\n", + "vul_type": "cwe-404", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#48fae61b8a6c9b741f001d478c595b6c7c0af4d9", + "input": "int TestOpenProcess(DWORD process_id) {\n HANDLE process = ::OpenProcess(PROCESS_VM_READ,\n FALSE, // Do not inherit handle.\n process_id);\n if (NULL == process) {\n if (ERROR_ACCESS_DENIED == ::GetLastError()) {\n return SBOX_TEST_DENIED;\n } else {\n return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;\n }\n } else {\n ::CloseHandle(process);\n return SBOX_TEST_SUCCEEDED;\n }\n}\n", + "target": "int TestOpenProcess(DWORD process_id) {\nint TestOpenProcess(DWORD process_id, DWORD access_mask) {\n HANDLE process = ::OpenProcess(access_mask,\n FALSE, // Do not inherit handle.\n process_id);\n if (NULL == process) {\n if (ERROR_ACCESS_DENIED == ::GetLastError()) {\n return SBOX_TEST_DENIED;\n } else {\n return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;\n }\n } else {\n ::CloseHandle(process);\n return SBOX_TEST_SUCCEEDED;\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ac149a8d4371c0e01e0934fdd57b09e86f96b5b9", + "input": "static int _hid_class_request(struct hid_device_priv* dev, HANDLE hid_handle, int request_type,\n\t\t\t\t\t\t\t int request, int value, int _index, void *data, struct windows_transfer_priv *tp,\n\t\t\t\t\t\t\t size_t *size, OVERLAPPED* overlapped)\n{\n\tint report_type = (value >> 8) & 0xFF;\n\tint report_id = value & 0xFF;\n\tif ( (LIBUSB_REQ_RECIPIENT(request_type) != LIBUSB_RECIPIENT_INTERFACE)\n\t && (LIBUSB_REQ_RECIPIENT(request_type) != LIBUSB_RECIPIENT_DEVICE) )\n\t\treturn LIBUSB_ERROR_INVALID_PARAM;\n\tif (LIBUSB_REQ_OUT(request_type) && request == HID_REQ_SET_REPORT)\n\t\treturn _hid_set_report(dev, hid_handle, report_id, data, tp, size, overlapped, report_type);\n\tif (LIBUSB_REQ_IN(request_type) && request == HID_REQ_GET_REPORT)\n\t\treturn _hid_get_report(dev, hid_handle, report_id, data, tp, size, overlapped, report_type);\n\treturn LIBUSB_ERROR_INVALID_PARAM;\n}\n", + "target": "static int _hid_class_request(struct hid_device_priv* dev, HANDLE hid_handle, int request_type,\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c70422f760c120480fee4de6c38804c72aa26bc1", + "input": "static void svc_rdma_get_write_arrays(struct rpcrdma_msg *rmsgp,\n\t\t\t\t struct rpcrdma_write_array **write,\n\t\t\t\t struct rpcrdma_write_array **reply)\n {\n \t__be32 *p;\n \n\tp = (__be32 *)&rmsgp->rm_body.rm_chunks[0];\n \n \t/* Read list */\n \twhile (*p++ != xdr_zero)\n \t\tp += 5;\n \n \t/* Write list */\n \tif (*p != xdr_zero) {\n\t\t*write = (struct rpcrdma_write_array *)p;\n \t\twhile (*p++ != xdr_zero)\n \t\t\tp += 1 + be32_to_cpu(*p) * 4;\n \t} else {\n\t\t*write = NULL;\n\t\tp++;\n\t}\n \n \t/* Reply chunk */\n \tif (*p != xdr_zero)\n\t\t*reply = (struct rpcrdma_write_array *)p;\n \telse\n \t\t*reply = NULL;\n }\n", + "target": "static void svc_rdma_get_write_arrays(struct rpcrdma_msg *rmsgp,\nstatic void svc_rdma_get_write_arrays(__be32 *rdma_argp,\n\t\t\t\t __be32 **write, __be32 **reply)\n {\n \t__be32 *p;\n \n\tp = rdma_argp + rpcrdma_fixed_maxsz;\n \n \t/* Read list */\n \twhile (*p++ != xdr_zero)\n \t\tp += 5;\n \n \t/* Write list */\n \tif (*p != xdr_zero) {\n\t\t*write = p;\n \t\twhile (*p++ != xdr_zero)\n \t\t\tp += 1 + be32_to_cpu(*p) * 4;\n \t} else {\n\t\t*write = NULL;\n\t\tp++;\n\t}\n \n \t/* Reply chunk */\n \tif (*p != xdr_zero)\n\t\t*reply = p;\n \telse\n \t\t*reply = NULL;\n }\n", + "vul_type": "cwe-404", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d27468a832d5316884bd02f459cbf493697fd7e1", + "input": "bool AXNodeObject::hasContentEditableAttributeSet() const {\n const AtomicString& contentEditableValue = getAttribute(contenteditableAttr);\n if (contentEditableValue.isNull())\n return false;\n return contentEditableValue.isEmpty() ||\n equalIgnoringCase(contentEditableValue, \"true\");\n }\n", + "target": "bool AXNodeObject::hasContentEditableAttributeSet() const {\n const AtomicString& contentEditableValue = getAttribute(contenteditableAttr);\n if (contentEditableValue.isNull())\n return false;\n return contentEditableValue.isEmpty() ||\n equalIgnoringASCIICase(contentEditableValue, \"true\");\n }\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": "void fht4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {\n vp9_fht4x4_c(in, out, stride, tx_type);\n }\n", + "target": "void fht4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {\nvoid fht4x4_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {\n vp9_fht4x4_c(in, out, stride, tx_type);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#9-ec3e10f7a444", + "input": " def _set_connections(self):\n \"\"\"Set the number of concurrent connections.\n\n The 3PAR WS API server has a limit of concurrent connections.\n This is setting the number to the highest allowed, 15 connections.\n \"\"\"\n self._cli_run(\"setwsapi -sru high\", None)", + "target": " def _set_connections(self):\n \"\"\"Set the number of concurrent connections.\n\n The 3PAR WS API server has a limit of concurrent connections.\n This is setting the number to the highest allowed, 15 connections.\n \"\"\"\n self._cli_run(['setwsapi', '-sru', 'high'])", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#4afb628e068367d5b73440537555902cd12416f8", + "input": "void GLOutputSurfaceBufferQueueAndroid::HandlePartialSwap(\n const gfx::Rect& sub_buffer_rect,\n uint32_t flags,\n gpu::ContextSupport::SwapCompletedCallback swap_callback,\n gpu::ContextSupport::PresentationCallback presentation_callback) {\n DCHECK(sub_buffer_rect.IsEmpty());\n context_provider_->ContextSupport()->CommitOverlayPlanes(\n flags, std::move(swap_callback), std::move(presentation_callback));\n}\n", + "target": "void GLOutputSurfaceBufferQueueAndroid::HandlePartialSwap(\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7933c117fd16b192e70609c331641e9112af5e42", + "input": "bool ProxyClientSocket::SanitizeProxyRedirect(HttpResponseInfo* response,\n const GURL& url) {\n//// static\n DCHECK(response && response->headers.get());\n \n std::string location;\n if (!response->headers->IsRedirect(&location))\n return false;\n \n std::string fake_response_headers =\n base::StringPrintf(\"HTTP/1.0 302 Found\\n\"\n \"Location: %s\\n\"\n \"Content-length: 0\\n\"\n \"Connection: close\\n\"\n \"\\n\",\n location.c_str());\n std::string raw_headers =\n HttpUtil::AssembleRawHeaders(fake_response_headers.data(),\n fake_response_headers.length());\n response->headers = new HttpResponseHeaders(raw_headers);\n\n return true;\n}\n", + "target": "bool ProxyClientSocket::SanitizeProxyRedirect(HttpResponseInfo* response,\nbool ProxyClientSocket::SanitizeProxyAuth(HttpResponseInfo* response) {\n DCHECK(response && response->headers.get());\n\n scoped_refptr old_headers = response->headers;\n\n const char kHeaders[] = \"HTTP/1.1 407 Proxy Authentication Required\\n\\n\";\n scoped_refptr new_headers = new HttpResponseHeaders(\n HttpUtil::AssembleRawHeaders(kHeaders, arraysize(kHeaders)));\n\n new_headers->ReplaceStatusLine(old_headers->GetStatusLine());\n CopyHeaderValues(old_headers, new_headers, \"Connection\");\n CopyHeaderValues(old_headers, new_headers, \"Proxy-Authenticate\");\n\n response->headers = new_headers;\n return true;\n}\n\n//// static\nbool ProxyClientSocket::SanitizeProxyRedirect(HttpResponseInfo* response) {\n DCHECK(response && response->headers.get());\n \n std::string location;\n if (!response->headers->IsRedirect(&location))\n return false;\n \n // Return minimal headers; set \"Content-Length: 0\" to ignore response body.\n std::string fake_response_headers = base::StringPrintf(\n \"HTTP/1.0 302 Found\\n\"\n \"Location: %s\\n\"\n \"Content-Length: 0\\n\"\n \"Connection: close\\n\"\n \"\\n\",\n location.c_str());\n std::string raw_headers =\n HttpUtil::AssembleRawHeaders(fake_response_headers.data(),\n fake_response_headers.length());\n response->headers = new HttpResponseHeaders(raw_headers);\n\n return true;\n}\n", + "vul_type": "cwe-19", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9a480deec4d20277d8e20bc55515ef0640ca1e55", + "input": "char *auth_server(int f_in, int f_out, int module, const char *host,\n\t\t const char *addr, const char *leader)\n{\n\tchar *users = lp_auth_users(module);\n\tchar challenge[MAX_DIGEST_LEN*2];\n\tchar line[BIGPATHBUFLEN];\n\tchar **auth_uid_groups = NULL;\n\tint auth_uid_groups_cnt = -1;\n\tconst char *err = NULL;\n\tint group_match = -1;\n\tchar *tok, *pass;\n\tchar opt_ch = '\\0';\n\n\t/* if no auth list then allow anyone in! */\n\tif (!users || !*users)\n if (!users || !*users)\n return \"\";\n \n gen_challenge(addr, challenge);\n \n io_printf(f_out, \"%s%s\\n\", leader, challenge);\n\t\treturn NULL;\n\t}\n", + "target": "char *auth_server(int f_in, int f_out, int module, const char *host,\n\t\t const char *addr, const char *leader)\n{\n\tchar *users = lp_auth_users(module);\n\tchar challenge[MAX_DIGEST_LEN*2];\n\tchar line[BIGPATHBUFLEN];\n\tchar **auth_uid_groups = NULL;\n\tint auth_uid_groups_cnt = -1;\n\tconst char *err = NULL;\n\tint group_match = -1;\n\tchar *tok, *pass;\n\tchar opt_ch = '\\0';\n\n\t/* if no auth list then allow anyone in! */\n\tif (!users || !*users)\n if (!users || !*users)\n return \"\";\n \n if (protocol_version < 21) { /* Don't allow a weak checksum for the password. */\n rprintf(FERROR, \"ERROR: protocol version is too old!\\n\");\n exit_cleanup(RERR_PROTOCOL);\n }\n\n gen_challenge(addr, challenge);\n \n io_printf(f_out, \"%s%s\\n\", leader, challenge);\n\t\treturn NULL;\n\t}\n", + "vul_type": "cwe-354", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cab1c3b3708eead315e033359d07049b23b147a3", + "input": " static void php_snmp_object_free_storage(void *object TSRMLS_DC)\n {\n php_snmp_object *intern = (php_snmp_object *)object;\n if (!intern) {\n return;\n }\n\n netsnmp_session_free(&(intern->session));\n \n zend_object_std_dtor(&intern->zo TSRMLS_CC);\n efree(intern);\n }\n", + "target": " static void php_snmp_object_free_storage(void *object TSRMLS_DC)\n {\n php_snmp_object *intern = (php_snmp_object *)object;\n\n if (!intern) {\n return;\n }\n\n netsnmp_session_free(&(intern->session));\n \n zend_object_std_dtor(&intern->zo TSRMLS_CC);\n\n efree(intern);\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24", + "input": "char* _single_string_alloc_and_copy( LPCWSTR in )\n{\n char *chr;\n int len = 0;\n \n if ( !in )\n {\n return in;\n }\n \n while ( in[ len ] != 0 )\n {\n len ++;\n }\n\n chr = malloc( len + 1 );\n\n len = 0;\n while ( in[ len ] != 0 )\n {\n chr[ len ] = 0xFF & in[ len ];\n len ++;\n }\n chr[ len ++ ] = '\\0';\n\n return chr;\n}\n", + "target": "char* _single_string_alloc_and_copy( LPCWSTR in )\n{\n char *chr;\n int len = 0;\n \n if ( !in )\n {\n return NULL;\n }\n \n while ( in[ len ] != 0 )\n {\n len ++;\n }\n\n chr = malloc( len + 1 );\n\n len = 0;\n while ( in[ len ] != 0 )\n {\n chr[ len ] = 0xFF & in[ len ];\n len ++;\n }\n chr[ len ++ ] = '\\0';\n\n return chr;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f2fcfcd670257236ebf2088bbdf26f6a8ef459fe", + "input": "static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct sockaddr_l2 la;\n\tint len, err = 0;\n\n\tBT_DBG(\"sk %p\", sk);\n\n\tif (!addr || addr->sa_family != AF_BLUETOOTH)\n\t\treturn -EINVAL;\n\n\tmemset(&la, 0, sizeof(la));\n\tlen = min_t(unsigned int, sizeof(la), alen);\n\tmemcpy(&la, addr, len);\n\n\tif (la.l2_cid)\n\t\treturn -EINVAL;\n\n\tlock_sock(sk);\n\n\tif (sk->sk_type == SOCK_SEQPACKET && !la.l2_psm) {\n\t\terr = -EINVAL;\n\t\tgoto done;\n\t}\n\n\tswitch (l2cap_pi(sk)->mode) {\n \tcase L2CAP_MODE_BASIC:\n \t\tbreak;\n \tcase L2CAP_MODE_ERTM:\n \t\tif (enable_ertm)\n \t\t\tbreak;\n \t\t/* fall through */\n\tdefault:\n\t\terr = -ENOTSUPP;\n\t\tgoto done;\n\t}\n\n\tswitch (sk->sk_state) {\n\tcase BT_CONNECT:\n\tcase BT_CONNECT2:\n\tcase BT_CONFIG:\n\t\t/* Already connecting */\n\t\tgoto wait;\n\n\tcase BT_CONNECTED:\n\t\t/* Already connected */\n\t\tgoto done;\n\n\tcase BT_OPEN:\n\tcase BT_BOUND:\n\t\t/* Can connect */\n\t\tbreak;\n\n\tdefault:\n\t\terr = -EBADFD;\n\t\tgoto done;\n\t}\n\n\t/* Set destination address and psm */\n\tbacpy(&bt_sk(sk)->dst, &la.l2_bdaddr);\n\tl2cap_pi(sk)->psm = la.l2_psm;\n\n\terr = l2cap_do_connect(sk);\n\tif (err)\n\t\tgoto done;\n\nwait:\n\terr = bt_sock_wait_state(sk, BT_CONNECTED,\n\t\t\tsock_sndtimeo(sk, flags & O_NONBLOCK));\ndone:\n\trelease_sock(sk);\n\treturn err;\n}\n", + "target": "static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct sockaddr_l2 la;\n\tint len, err = 0;\n\n\tBT_DBG(\"sk %p\", sk);\n\n\tif (!addr || addr->sa_family != AF_BLUETOOTH)\n\t\treturn -EINVAL;\n\n\tmemset(&la, 0, sizeof(la));\n\tlen = min_t(unsigned int, sizeof(la), alen);\n\tmemcpy(&la, addr, len);\n\n\tif (la.l2_cid)\n\t\treturn -EINVAL;\n\n\tlock_sock(sk);\n\n\tif (sk->sk_type == SOCK_SEQPACKET && !la.l2_psm) {\n\t\terr = -EINVAL;\n\t\tgoto done;\n\t}\n\n\tswitch (l2cap_pi(sk)->mode) {\n \tcase L2CAP_MODE_BASIC:\n \t\tbreak;\n \tcase L2CAP_MODE_ERTM:\n\tcase L2CAP_MODE_STREAMING:\n \t\tif (enable_ertm)\n \t\t\tbreak;\n \t\t/* fall through */\n\tdefault:\n\t\terr = -ENOTSUPP;\n\t\tgoto done;\n\t}\n\n\tswitch (sk->sk_state) {\n\tcase BT_CONNECT:\n\tcase BT_CONNECT2:\n\tcase BT_CONFIG:\n\t\t/* Already connecting */\n\t\tgoto wait;\n\n\tcase BT_CONNECTED:\n\t\t/* Already connected */\n\t\tgoto done;\n\n\tcase BT_OPEN:\n\tcase BT_BOUND:\n\t\t/* Can connect */\n\t\tbreak;\n\n\tdefault:\n\t\terr = -EBADFD;\n\t\tgoto done;\n\t}\n\n\t/* Set destination address and psm */\n\tbacpy(&bt_sk(sk)->dst, &la.l2_bdaddr);\n\tl2cap_pi(sk)->psm = la.l2_psm;\n\n\terr = l2cap_do_connect(sk);\n\tif (err)\n\t\tgoto done;\n\nwait:\n\terr = bt_sock_wait_state(sk, BT_CONNECTED,\n\t\t\tsock_sndtimeo(sk, flags & O_NONBLOCK));\ndone:\n\trelease_sock(sk);\n\treturn err;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2899351224fe2940aec37d7656e1e392c0fe07f0", + "input": "static void ikev2_parent_outI1_continue(struct pluto_crypto_req_cont *pcrc,\n\t\t\t\t\tstruct pluto_crypto_req *r,\n\t\t\t\t\terr_t ugh)\n{\n\tstruct ke_continuation *ke = (struct ke_continuation *)pcrc;\n\tstruct msg_digest *md = ke->md;\n\tstruct state *const st = md->st;\n\tstf_status e;\n\n\tDBG(DBG_CONTROLMORE,\n\t DBG_log(\"ikev2 parent outI1: calculated ke+nonce, sending I1\"));\n\n\tif (st == NULL) {\n\t\tloglog(RC_LOG_SERIOUS,\n\t\t \"%s: Request was disconnected from state\",\n\t\t __FUNCTION__);\n\t\tif (ke->md)\n\t\t\trelease_md(ke->md);\n\t\treturn;\n\t}\n\n\t/* XXX should check out ugh */\n\tpassert(ugh == NULL);\n\tpassert(cur_state == NULL);\n\tpassert(st != NULL);\n\n\tpassert(st->st_suspended_md == ke->md);\n\tset_suspended(st, NULL); /* no longer connected or suspended */\n\n\tset_cur_state(st);\n\n\tst->st_calculating = FALSE;\n\n\te = ikev2_parent_outI1_tail(pcrc, r);\n\n\tif (ke->md != NULL) {\n\t\tcomplete_v2_state_transition(&ke->md, e);\n\t\tif (ke->md)\n\t\t\trelease_md(ke->md);\n \t}\n \treset_cur_state();\n \treset_globals();\n\tpassert(GLOBALS_ARE_RESET());\n }\n", + "target": "static void ikev2_parent_outI1_continue(struct pluto_crypto_req_cont *pcrc,\n\t\t\t\t\tstruct pluto_crypto_req *r,\n\t\t\t\t\terr_t ugh)\n{\n\tstruct ke_continuation *ke = (struct ke_continuation *)pcrc;\n\tstruct msg_digest *md = ke->md;\n\tstruct state *const st = md->st;\n\tstf_status e;\n\n\tDBG(DBG_CONTROLMORE,\n\t DBG_log(\"ikev2 parent outI1: calculated ke+nonce, sending I1\"));\n\n\tif (st == NULL) {\n\t\tloglog(RC_LOG_SERIOUS,\n\t\t \"%s: Request was disconnected from state\",\n\t\t __FUNCTION__);\n\t\tif (ke->md)\n\t\t\trelease_md(ke->md);\n\t\treturn;\n\t}\n\n\t/* XXX should check out ugh */\n\tpassert(ugh == NULL);\n\tpassert(cur_state == NULL);\n\tpassert(st != NULL);\n\n\tpassert(st->st_suspended_md == ke->md);\n\tset_suspended(st, NULL); /* no longer connected or suspended */\n\n\tset_cur_state(st);\n\n\tst->st_calculating = FALSE;\n\n\te = ikev2_parent_outI1_tail(pcrc, r);\n\n\tif (ke->md != NULL) {\n\t\tcomplete_v2_state_transition(&ke->md, e);\n\t\tif (ke->md)\n\t\t\trelease_md(ke->md);\n \t}\n \treset_cur_state();\n \treset_globals();\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d926098e2e2be270c80a5ba25ab8a611b80b8556", + "input": "void OnGetDevicesOnServiceThread(\n const std::vector& filters,\n const base::Callback)>& callback,\n scoped_refptr callback_task_runner,\n const std::vector>& devices) {\n mojo::Array mojo_devices(0);\n for (size_t i = 0; i < devices.size(); ++i) {\n if (UsbDeviceFilter::MatchesAny(devices[i], filters))\n mojo_devices.push_back(DeviceInfo::From(*devices[i]));\n }\n callback_task_runner->PostTask(\n FROM_HERE, base::Bind(callback, base::Passed(&mojo_devices)));\n}\n", + "target": "void OnGetDevicesOnServiceThread(\n const std::vector& filters,\n const base::Callback)>& callback,\n scoped_refptr callback_task_runner,\n const std::vector>& devices) {\n mojo::Array mojo_devices(0);\n for (size_t i = 0; i < devices.size(); ++i) {\n if (UsbDeviceFilter::MatchesAny(devices[i], filters) || filters.empty())\n mojo_devices.push_back(DeviceInfo::From(*devices[i]));\n }\n callback_task_runner->PostTask(\n FROM_HERE, base::Bind(callback, base::Passed(&mojo_devices)));\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2ee663f39dc8dac3d9988e847db19b2d7e3ac8c6", + "input": "int ntlm_read_message_fields(wStream* s, NTLM_MESSAGE_FIELDS* fields)\n {\n \tif (Stream_GetRemainingLength(s) < 8)\n \t\treturn -1;\n\n\tStream_Read_UINT16(s, fields->Len); /* Len (2 bytes) */\n\tStream_Read_UINT16(s, fields->MaxLen); /* MaxLen (2 bytes) */\n\tStream_Read_UINT32(s, fields->BufferOffset); /* BufferOffset (4 bytes) */\n \treturn 1;\n }\n", + "target": "int ntlm_read_message_fields(wStream* s, NTLM_MESSAGE_FIELDS* fields)\nstatic int ntlm_read_message_fields(wStream* s, NTLM_MESSAGE_FIELDS* fields)\n {\n \tif (Stream_GetRemainingLength(s) < 8)\n \t\treturn -1;\n\n\tStream_Read_UINT16(s, fields->Len); /* Len (2 bytes) */\n\tStream_Read_UINT16(s, fields->MaxLen); /* MaxLen (2 bytes) */\n\tStream_Read_UINT32(s, fields->BufferOffset); /* BufferOffset (4 bytes) */\n \treturn 1;\n }\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ac8bd041b81e46e4e4fcd5021aaa5499703952e6", + "input": "bool PluginServiceImpl::GetPluginInfo(int render_process_id,\n int render_view_id,\n ResourceContext* context,\n const GURL& url,\n const GURL& page_url,\n const std::string& mime_type,\n bool allow_wildcard,\n bool* is_stale,\n webkit::WebPluginInfo* info,\n std::string* actual_mime_type) {\n std::vector plugins;\n std::vector mime_types;\n bool stale = GetPluginInfoArray(\n url, mime_type, allow_wildcard, &plugins, &mime_types);\n if (is_stale)\n *is_stale = stale;\n \n for (size_t i = 0; i < plugins.size(); ++i) {\n if (!filter_ || filter_->IsPluginEnabled(render_process_id,\n render_view_id,\n context,\n url,\n page_url,\n &plugins[i])) {\n *info = plugins[i];\n if (actual_mime_type)\n *actual_mime_type = mime_types[i];\n return true;\n }\n }\n return false;\n}\n", + "target": "bool PluginServiceImpl::GetPluginInfo(int render_process_id,\n int render_view_id,\n ResourceContext* context,\n const GURL& url,\n const GURL& page_url,\n const std::string& mime_type,\n bool allow_wildcard,\n bool* is_stale,\n webkit::WebPluginInfo* info,\n std::string* actual_mime_type) {\n std::vector plugins;\n std::vector mime_types;\n bool stale = GetPluginInfoArray(\n url, mime_type, allow_wildcard, &plugins, &mime_types);\n if (is_stale)\n *is_stale = stale;\n \n for (size_t i = 0; i < plugins.size(); ++i) {\n if (!filter_ || filter_->IsPluginAvailable(render_process_id,\n render_view_id,\n context,\n url,\n page_url,\n &plugins[i])) {\n *info = plugins[i];\n if (actual_mime_type)\n *actual_mime_type = mime_types[i];\n return true;\n }\n }\n return false;\n}\n", + "vul_type": "cwe-287", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#55edae0226409de25e59922807cb09acb45731a2", + "input": "mrb_obj_clone(mrb_state *mrb, mrb_value self)\n{\n struct RObject *p;\n mrb_value clone;\n\n if (mrb_immediate_p(self)) {\n mrb_raisef(mrb, E_TYPE_ERROR, \"can't clone %S\", self);\n }\n if (mrb_type(self) == MRB_TT_SCLASS) {\n mrb_raise(mrb, E_TYPE_ERROR, \"can't clone singleton class\");\n }\n p = (struct RObject*)mrb_obj_alloc(mrb, mrb_type(self), mrb_obj_class(mrb, self));\n p->c = mrb_singleton_class_clone(mrb, self);\n mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)p->c);\n clone = mrb_obj_value(p);\n init_copy(mrb, clone, self);\n p->flags = mrb_obj_ptr(self)->flags;\n \n return clone;\n }\n", + "target": "mrb_obj_clone(mrb_state *mrb, mrb_value self)\n{\n struct RObject *p;\n mrb_value clone;\n\n if (mrb_immediate_p(self)) {\n mrb_raisef(mrb, E_TYPE_ERROR, \"can't clone %S\", self);\n }\n if (mrb_type(self) == MRB_TT_SCLASS) {\n mrb_raise(mrb, E_TYPE_ERROR, \"can't clone singleton class\");\n }\n p = (struct RObject*)mrb_obj_alloc(mrb, mrb_type(self), mrb_obj_class(mrb, self));\n p->c = mrb_singleton_class_clone(mrb, self);\n mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)p->c);\n clone = mrb_obj_value(p);\n init_copy(mrb, clone, self);\n p->flags |= mrb_obj_ptr(self)->flags & MRB_FLAG_IS_FROZEN;\n \n return clone;\n }\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c0c8978849ac57e4ecd613ddc8ff7852a2054734", + "input": " void PlatformSensorProviderWin::CreateSensorInternal(\n mojom::SensorType type,\n mojo::ScopedSharedBufferMapping mapping,\n const CreateSensorCallback& callback) {\n DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);\n if (!StartSensorThread()) {\n callback.Run(nullptr);\n return;\n }\n\n switch (type) {\n case mojom::SensorType::LINEAR_ACCELERATION: {\n auto linear_acceleration_fusion_algorithm = std::make_unique<\n LinearAccelerationFusionAlgorithmUsingAccelerometer>();\n PlatformSensorFusion::Create(\n std::move(mapping), this,\n std::move(linear_acceleration_fusion_algorithm), callback);\n break;\n }\n \n default: {\n base::PostTaskAndReplyWithResult(\n sensor_thread_->task_runner().get(), FROM_HERE,\n base::Bind(&PlatformSensorProviderWin::CreateSensorReader,\n base::Unretained(this), type),\n base::Bind(&PlatformSensorProviderWin::SensorReaderCreated,\n base::Unretained(this), type, base::Passed(&mapping),\n callback));\n break;\n }\n }\n}\n", + "target": " void PlatformSensorProviderWin::CreateSensorInternal(\n mojom::SensorType type,\n SensorReadingSharedBuffer* reading_buffer,\n const CreateSensorCallback& callback) {\n DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);\n if (!StartSensorThread()) {\n callback.Run(nullptr);\n return;\n }\n\n switch (type) {\n case mojom::SensorType::LINEAR_ACCELERATION: {\n auto linear_acceleration_fusion_algorithm = std::make_unique<\n LinearAccelerationFusionAlgorithmUsingAccelerometer>();\n PlatformSensorFusion::Create(\n reading_buffer, this, std::move(linear_acceleration_fusion_algorithm),\n callback);\n break;\n }\n \n default: {\n base::PostTaskAndReplyWithResult(\n sensor_thread_->task_runner().get(), FROM_HERE,\n base::Bind(&PlatformSensorProviderWin::CreateSensorReader,\n base::Unretained(this), type),\n base::Bind(&PlatformSensorProviderWin::SensorReaderCreated,\n base::Unretained(this), type, reading_buffer, callback));\n break;\n }\n }\n}\n", + "vul_type": "cwe-732", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0bd1a6ddb5fb23dfea3e72d60e5e8df4cf5826bc", + "input": "XSharedMemoryId AttachSharedMemory(Display* display, int shared_memory_key) {\n DCHECK(QuerySharedMemorySupport(display));\n\n XShmSegmentInfo shminfo;\n memset(&shminfo, 0, sizeof(shminfo));\n shminfo.shmid = shared_memory_key;\n\n if (!XShmAttach(display, &shminfo))\n NOTREACHED();\n \n return shminfo.shmseg;\n }\n", + "target": "XSharedMemoryId AttachSharedMemory(Display* display, int shared_memory_key) {\n DCHECK(QuerySharedMemorySupport(display));\n\n XShmSegmentInfo shminfo;\n memset(&shminfo, 0, sizeof(shminfo));\n shminfo.shmid = shared_memory_key;\n\n if (!XShmAttach(display, &shminfo)) {\n LOG(WARNING) << \"X failed to attach to shared memory segment \"\n << shminfo.shmid;\n NOTREACHED();\n } else {\n VLOG(1) << \"X attached to shared memory segment \" << shminfo.shmid;\n }\n \n return shminfo.shmseg;\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#511d0a0a31a54e0cc0f15cb1b977dc9f9b20f0d3", + "input": "int WebSocketHandshake::ReadServerHandshake(const char* data, size_t len) {\n mode_ = MODE_INCOMPLETE;\n if (len < kServerHandshakeHeaderLength) {\n return -1;\n }\n if (!memcmp(data, kServerHandshakeHeader, kServerHandshakeHeaderLength)) {\n mode_ = MODE_NORMAL;\n } else {\n int eoh = HttpUtil::LocateEndOfHeaders(data, len);\n if (eoh < 0)\n return -1;\n return eoh;\n }\n const char* p = data + kServerHandshakeHeaderLength;\n const char* end = data + len + 1;\n if (mode_ == MODE_NORMAL) {\n size_t header_size = end - p;\n if (header_size < kUpgradeHeaderLength)\n return -1;\n if (memcmp(p, kUpgradeHeader, kUpgradeHeaderLength)) {\n mode_ = MODE_FAILED;\n DLOG(INFO) << \"Bad Upgrade Header \"\n << std::string(p, kUpgradeHeaderLength);\n return p - data;\n }\n p += kUpgradeHeaderLength;\n header_size = end - p;\n if (header_size < kConnectionHeaderLength)\n return -1;\n if (memcmp(p, kConnectionHeader, kConnectionHeaderLength)) {\n mode_ = MODE_FAILED;\n DLOG(INFO) << \"Bad Connection Header \"\n << std::string(p, kConnectionHeaderLength);\n return p - data;\n }\n p += kConnectionHeaderLength;\n }\n int eoh = HttpUtil::LocateEndOfHeaders(data, len);\n if (eoh == -1)\n return eoh;\n scoped_refptr headers(\n new HttpResponseHeaders(HttpUtil::AssembleRawHeaders(data, eoh)));\n if (!ProcessHeaders(*headers)) {\n DLOG(INFO) << \"Process Headers failed: \"\n << std::string(data, eoh);\n mode_ = MODE_FAILED;\n }\n switch (mode_) {\n case MODE_NORMAL:\n if (CheckResponseHeaders()) {\n mode_ = MODE_CONNECTED;\n } else {\n mode_ = MODE_FAILED;\n }\n break;\n default:\n mode_ = MODE_FAILED;\n break;\n }\n return eoh;\n}\n", + "target": "int WebSocketHandshake::ReadServerHandshake(const char* data, size_t len) {\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#eeb4e45d5683f88488c083ecf142dc89bc3f0b47", + "input": " static ogg_uint32_t decpack(long entry,long used_entry,long quantvals,\n\t\t\t codebook *b,oggpack_buffer *opb,int maptype){\n ogg_uint32_t ret=0;\n int j;\n \n switch(b->dec_type){\n\n case 0:\n return (ogg_uint32_t)entry;\n\n case 1:\n\n if(maptype==1){\n /* vals are already read into temporary column vector here */\n for(j=0;jdim;j++){\n\togg_uint32_t off=entry%quantvals;\n\tentry/=quantvals;\n\tret|=((ogg_uint16_t *)(b->q_val))[off]<<(b->q_bits*j);\n }\n }else{\n for(j=0;jdim;j++)\n\tret|=oggpack_read(opb,b->q_bits)<<(b->q_bits*j);\n }\n return ret;\n \n case 2:\n for(j=0;jdim;j++){\n ogg_uint32_t off=entry%quantvals;\n entry/=quantvals;\n ret|=off<<(b->q_pack*j);\n }\n return ret;\n\n case 3:\n return (ogg_uint32_t)used_entry;\n\n }\n return 0; /* silence compiler */\n}\n", + "target": " static ogg_uint32_t decpack(long entry,long used_entry,long quantvals,\n codebook *b,oggpack_buffer *opb,int maptype){\n ogg_uint32_t ret=0;\n int j;\n \n switch(b->dec_type){\n\n case 0:\n return (ogg_uint32_t)entry;\n\n case 1:\n\n if(maptype==1){\n /* vals are already read into temporary column vector here */\n for(j=0;jdim;j++){\n ogg_uint32_t off=entry%quantvals;\n entry/=quantvals;\n ret|=((ogg_uint16_t *)(b->q_val))[off]<<(b->q_bits*j);\n }\n }else{\n for(j=0;jdim;j++)\n ret|=oggpack_read(opb,b->q_bits)<<(b->q_bits*j);\n }\n return ret;\n \n case 2:\n for(j=0;jdim;j++){\n ogg_uint32_t off=entry%quantvals;\n entry/=quantvals;\n ret|=off<<(b->q_pack*j);\n }\n return ret;\n\n case 3:\n return (ogg_uint32_t)used_entry;\n\n }\n return 0; /* silence compiler */\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#18de8f9f0762c3a542b1122589edb8af859d9813", + "input": "void read_sequence_header(decoder_info_t *decoder_info, stream_t *stream) {\n decoder_info->width = get_flc(16, stream);\n decoder_info->height = get_flc(16, stream);\n decoder_info->log2_sb_size = get_flc(3, stream);\n decoder_info->pb_split = get_flc(1, stream);\n decoder_info->tb_split_enable = get_flc(1, stream);\n decoder_info->max_num_ref = get_flc(2, stream) + 1;\n decoder_info->interp_ref = get_flc(2, stream);\n decoder_info->max_delta_qp = get_flc(1, stream);\n decoder_info->deblocking = get_flc(1, stream);\n decoder_info->clpf = get_flc(1, stream);\n decoder_info->use_block_contexts = get_flc(1, stream);\n decoder_info->bipred = get_flc(2, stream);\n decoder_info->qmtx = get_flc(1, stream);\n if (decoder_info->qmtx) {\n decoder_info->qmtx_offset = get_flc(6, stream) - 32;\n }\n decoder_info->subsample = get_flc(2, stream);\n decoder_info->subsample = // 0: 400 1: 420 2: 422 3: 444\n (decoder_info->subsample & 1) * 20 + (decoder_info->subsample & 2) * 22 +\n ((decoder_info->subsample & 3) == 3) * 2 + 400;\n decoder_info->num_reorder_pics = get_flc(4, stream);\n if (decoder_info->subsample != 400) {\n decoder_info->cfl_intra = get_flc(1, stream);\n decoder_info->cfl_inter = get_flc(1, stream);\n }\n decoder_info->bitdepth = get_flc(1, stream) ? 10 : 8;\n if (decoder_info->bitdepth == 10)\n decoder_info->bitdepth += 2 * get_flc(1, stream);\n decoder_info->input_bitdepth = get_flc(1, stream) ? 10 : 8;\n if (decoder_info->input_bitdepth == 10)\n decoder_info->input_bitdepth += 2 * get_flc(1, stream);\n}\n", + "target": "void read_sequence_header(decoder_info_t *decoder_info, stream_t *stream) {\n decoder_info->width = get_flc(16, stream);\n decoder_info->height = get_flc(16, stream);\n decoder_info->log2_sb_size = get_flc(3, stream);\n decoder_info->log2_sb_size = clip(decoder_info->log2_sb_size, log2i(MIN_BLOCK_SIZE), log2i(MAX_SB_SIZE));\n decoder_info->pb_split = get_flc(1, stream);\n decoder_info->tb_split_enable = get_flc(1, stream);\n decoder_info->max_num_ref = get_flc(2, stream) + 1;\n decoder_info->interp_ref = get_flc(2, stream);\n decoder_info->max_delta_qp = get_flc(1, stream);\n decoder_info->deblocking = get_flc(1, stream);\n decoder_info->clpf = get_flc(1, stream);\n decoder_info->use_block_contexts = get_flc(1, stream);\n decoder_info->bipred = get_flc(2, stream);\n decoder_info->qmtx = get_flc(1, stream);\n if (decoder_info->qmtx) {\n decoder_info->qmtx_offset = get_flc(6, stream) - 32;\n }\n decoder_info->subsample = get_flc(2, stream);\n decoder_info->subsample = // 0: 400 1: 420 2: 422 3: 444\n (decoder_info->subsample & 1) * 20 + (decoder_info->subsample & 2) * 22 +\n ((decoder_info->subsample & 3) == 3) * 2 + 400;\n decoder_info->num_reorder_pics = get_flc(4, stream);\n if (decoder_info->subsample != 400) {\n decoder_info->cfl_intra = get_flc(1, stream);\n decoder_info->cfl_inter = get_flc(1, stream);\n }\n decoder_info->bitdepth = get_flc(1, stream) ? 10 : 8;\n if (decoder_info->bitdepth == 10)\n decoder_info->bitdepth += 2 * get_flc(1, stream);\n decoder_info->input_bitdepth = get_flc(1, stream) ? 10 : 8;\n if (decoder_info->input_bitdepth == 10)\n decoder_info->input_bitdepth += 2 * get_flc(1, stream);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#master", + "input": "void qrio_cpuwd_flag(bool flag)\n {\n \tu8 reason1;\n \tvoid __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;\n \treason1 = in_8(qrio_base + REASON1_OFF);\n \tif (flag)\n \t\treason1 |= REASON1_CPUWD;\n\telse\n\t\treason1 &= ~REASON1_CPUWD;\n \tout_8(qrio_base + REASON1_OFF, reason1);\n }\n", + "target": "void qrio_cpuwd_flag(bool flag)\n {\n \tu8 reason1;\n \tvoid __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;\n\n \treason1 = in_8(qrio_base + REASON1_OFF);\n \tif (flag)\n \t\treason1 |= REASON1_CPUWD;\n\telse\n\t\treason1 &= ~REASON1_CPUWD;\n \tout_8(qrio_base + REASON1_OFF, reason1);\n }\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#3-675023f3129b", + "input": "def karma_rank(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n SELECT (SELECT COUNT(*) FROM people AS t2 WHERE t2.karma > t1.karma)\n AS row_Num FROM people AS t1 WHERE name='{}'\n '''.format(name))\n rank = cursor.fetchone()[0] + 1\n logger.debug('Rank of {} found for name {}'.format(rank, name))\n db.close()\n return rank\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise", + "target": "def karma_rank(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n SELECT (SELECT COUNT(*) FROM people AS t2 WHERE t2.karma > t1.karma)\n AS row_Num FROM people AS t1 WHERE name=%(name)s\n ''', (name, ))\n rank = cursor.fetchone()[0] + 1\n logger.debug('Rank of {} found for name {}'.format(rank, name))\n db.close()\n return rank\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#de1e67d0703894cb6ea782e36abb63976ab07e60", + "input": "static void test_show_object(struct object *object,\n\t\t\t struct strbuf *path,\n\t\t\t const char *last, void *data)\n {\n \tstruct bitmap_test_data *tdata = data;\n \tint bitmap_pos;\n\n\tbitmap_pos = bitmap_position(object->oid.hash);\n\tif (bitmap_pos < 0)\n\t\tdie(\"Object not in bitmap: %s\\n\", oid_to_hex(&object->oid));\n\n\tbitmap_set(tdata->base, bitmap_pos);\n\tdisplay_progress(tdata->prg, ++tdata->seen);\n}\n", + "target": "static void test_show_object(struct object *object,\nstatic void test_show_object(struct object *object, const char *name,\n\t\t\t void *data)\n {\n \tstruct bitmap_test_data *tdata = data;\n \tint bitmap_pos;\n\n\tbitmap_pos = bitmap_position(object->oid.hash);\n\tif (bitmap_pos < 0)\n\t\tdie(\"Object not in bitmap: %s\\n\", oid_to_hex(&object->oid));\n\n\tbitmap_set(tdata->base, bitmap_pos);\n\tdisplay_progress(tdata->prg, ++tdata->seen);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#db24063b01cba8e9d4d88b7d8ac70c9000c104e4", + "input": "resp_get_length(netdissect_options *ndo, register const u_char *bp, int len, const u_char **endp)\n{\n int result;\n u_char c;\n int saw_digit;\n int neg;\n int too_large;\n\n if (len == 0)\n goto trunc;\n ND_TCHECK(*bp);\n too_large = 0;\n neg = 0;\n if (*bp == '-') {\n neg = 1;\n bp++;\n len--;\n }\n result = 0;\n saw_digit = 0;\n\n for (;;) {\n if (len == 0)\n goto trunc;\n ND_TCHECK(*bp);\n c = *bp;\n if (!(c >= '0' && c <= '9')) {\n if (!saw_digit)\n goto invalid;\n break;\n }\n c -= '0';\n if (result > (INT_MAX / 10)) {\n /* This will overflow an int when we multiply it by 10. */\n too_large = 1;\n } else {\n result *= 10;\n if (result == INT_MAX && c > (INT_MAX % 10)) {\n /* This will overflow an int when we add c */\n too_large = 1;\n } else\n result += c;\n }\n bp++;\n len--;\n saw_digit = 1;\n }\n if (!saw_digit)\n goto invalid;\n\n /*\n * OK, the next thing should be \\r\\n.\n */\n if (len == 0)\n goto trunc;\n ND_TCHECK(*bp);\n if (*bp != '\\r')\n goto invalid;\n bp++;\n len--;\n if (len == 0)\n goto trunc;\n ND_TCHECK(*bp);\n if (*bp != '\\n')\n goto invalid;\n bp++;\n len--;\n *endp = bp;\n if (neg) {\n /* -1 means \"null\", anything else is invalid */\n if (too_large || result != 1)\n return (-4);\n result = -1;\n }\n return (too_large ? -3 : result);\n \n trunc:\n return (-2);\n \n invalid:\n return (-5);\n }\n", + "target": "resp_get_length(netdissect_options *ndo, register const u_char *bp, int len, const u_char **endp)\n{\n int result;\n u_char c;\n int saw_digit;\n int neg;\n int too_large;\n\n if (len == 0)\n goto trunc;\n ND_TCHECK(*bp);\n too_large = 0;\n neg = 0;\n if (*bp == '-') {\n neg = 1;\n bp++;\n len--;\n }\n result = 0;\n saw_digit = 0;\n\n for (;;) {\n if (len == 0)\n goto trunc;\n ND_TCHECK(*bp);\n c = *bp;\n if (!(c >= '0' && c <= '9')) {\n if (!saw_digit) {\n bp++;\n goto invalid;\n }\n break;\n }\n c -= '0';\n if (result > (INT_MAX / 10)) {\n /* This will overflow an int when we multiply it by 10. */\n too_large = 1;\n } else {\n result *= 10;\n if (result == INT_MAX && c > (INT_MAX % 10)) {\n /* This will overflow an int when we add c */\n too_large = 1;\n } else\n result += c;\n }\n bp++;\n len--;\n saw_digit = 1;\n }\n if (!saw_digit)\n goto invalid;\n\n /*\n * OK, the next thing should be \\r\\n.\n */\n if (len == 0)\n goto trunc;\n ND_TCHECK(*bp);\n if (*bp != '\\r') {\n bp++;\n goto invalid;\n }\n bp++;\n len--;\n if (len == 0)\n goto trunc;\n ND_TCHECK(*bp);\n if (*bp != '\\n') {\n bp++;\n goto invalid;\n }\n bp++;\n len--;\n *endp = bp;\n if (neg) {\n /* -1 means \"null\", anything else is invalid */\n if (too_large || result != 1)\n return (-4);\n result = -1;\n }\n return (too_large ? -3 : result);\n \n trunc:\n *endp = bp;\n return (-2);\n \n invalid:\n *endp = bp;\n return (-5);\n }\n", + "vul_type": "cwe-835", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#31400a673325147e1205326008e32135a78b4d8a", + "input": " findoprnd(ITEM *ptr, int32 *pos)\n {\n \tif (ptr[*pos].type == VAL || ptr[*pos].type == VALTRUE)\n \t{\n \t\tptr[*pos].left = 0;\n\t\t(*pos)++;\n\t}\n\telse if (ptr[*pos].val == (int32) '!')\n\t{\n\t\tptr[*pos].left = 1;\n\t\t(*pos)++;\n\t\tfindoprnd(ptr, pos);\n\t}\n\telse\n\t{\n\t\tITEM\t *curitem = &ptr[*pos];\n\t\tint32\t\ttmp = *pos;\n\n\t\t(*pos)++;\n\t\tfindoprnd(ptr, pos);\n\t\tcuritem->left = *pos - tmp;\n\t\tfindoprnd(ptr, pos);\n\t}\n}\n", + "target": " findoprnd(ITEM *ptr, int32 *pos)\n {\n\t/* since this function recurses, it could be driven to stack overflow. */\n\tcheck_stack_depth();\n\n \tif (ptr[*pos].type == VAL || ptr[*pos].type == VALTRUE)\n \t{\n \t\tptr[*pos].left = 0;\n\t\t(*pos)++;\n\t}\n\telse if (ptr[*pos].val == (int32) '!')\n\t{\n\t\tptr[*pos].left = 1;\n\t\t(*pos)++;\n\t\tfindoprnd(ptr, pos);\n\t}\n\telse\n\t{\n\t\tITEM\t *curitem = &ptr[*pos];\n\t\tint32\t\ttmp = *pos;\n\n\t\t(*pos)++;\n\t\tfindoprnd(ptr, pos);\n\t\tcuritem->left = *pos - tmp;\n\t\tfindoprnd(ptr, pos);\n\t}\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e6bd18f57aad1a2d1ef40e646d03ed0f2515c9e3", + "input": "static ssize_t ucma_write(struct file *filp, const char __user *buf,\n\t\t\t size_t len, loff_t *pos)\n{\n\tstruct ucma_file *file = filp->private_data;\n \tstruct rdma_ucm_cmd_hdr hdr;\n \tssize_t ret;\n \n \tif (len < sizeof(hdr))\n \t\treturn -EINVAL;\n \n\tif (copy_from_user(&hdr, buf, sizeof(hdr)))\n\t\treturn -EFAULT;\n\n\tif (hdr.cmd >= ARRAY_SIZE(ucma_cmd_table))\n\t\treturn -EINVAL;\n\n\tif (hdr.in + sizeof(hdr) > len)\n\t\treturn -EINVAL;\n\n\tif (!ucma_cmd_table[hdr.cmd])\n\t\treturn -ENOSYS;\n\n\tret = ucma_cmd_table[hdr.cmd](file, buf + sizeof(hdr), hdr.in, hdr.out);\n\tif (!ret)\n\t\tret = len;\n\n\treturn ret;\n}\n", + "target": "static ssize_t ucma_write(struct file *filp, const char __user *buf,\n\t\t\t size_t len, loff_t *pos)\n{\n\tstruct ucma_file *file = filp->private_data;\n \tstruct rdma_ucm_cmd_hdr hdr;\n \tssize_t ret;\n \n\tif (WARN_ON_ONCE(!ib_safe_file_access(filp)))\n\t\treturn -EACCES;\n\n \tif (len < sizeof(hdr))\n \t\treturn -EINVAL;\n \n\tif (copy_from_user(&hdr, buf, sizeof(hdr)))\n\t\treturn -EFAULT;\n\n\tif (hdr.cmd >= ARRAY_SIZE(ucma_cmd_table))\n\t\treturn -EINVAL;\n\n\tif (hdr.in + sizeof(hdr) > len)\n\t\treturn -EINVAL;\n\n\tif (!ucma_cmd_table[hdr.cmd])\n\t\treturn -ENOSYS;\n\n\tret = ucma_cmd_table[hdr.cmd](file, buf + sizeof(hdr), hdr.in, hdr.out);\n\tif (!ret)\n\t\tret = len;\n\n\treturn ret;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#67f1aee6f45059fd6b0f5b0ecb2c97ad0451f6b3", + "input": " int iwch_cxgb3_ofld_send(struct t3cdev *tdev, struct sk_buff *skb)\n{\n\tint\terror = 0;\n\tstruct cxio_rdev *rdev;\n\n\trdev = (struct cxio_rdev *)tdev->ulp;\n\tif (cxio_fatal_error(rdev)) {\n\t\tkfree_skb(skb);\n\t\treturn -EIO;\n\t}\n \terror = cxgb3_ofld_send(tdev, skb);\n \tif (error < 0)\n \t\tkfree_skb(skb);\n\treturn error;\n }\n", + "target": " int iwch_cxgb3_ofld_send(struct t3cdev *tdev, struct sk_buff *skb)\n{\n\tint\terror = 0;\n\tstruct cxio_rdev *rdev;\n\n\trdev = (struct cxio_rdev *)tdev->ulp;\n\tif (cxio_fatal_error(rdev)) {\n\t\tkfree_skb(skb);\n\t\treturn -EIO;\n\t}\n \terror = cxgb3_ofld_send(tdev, skb);\n \tif (error < 0)\n \t\tkfree_skb(skb);\n\treturn error < 0 ? error : 0;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": " load_fake(png_charp param, png_bytepp profile)\n {\n char *endptr = NULL;\n unsigned long long int size = strtoull(param, &endptr, 0/*base*/);\n \n /* The 'fake' format is *[string] */\n if (endptr != NULL && *endptr == '*')\n {\n size_t len = strlen(++endptr);\n size_t result = (size_t)size;\n\n if (len == 0) len = 1; /* capture the terminating '\\0' */\n\n /* Now repeat that string to fill 'size' bytes. */\n if (result == size && (*profile = malloc(result)) != NULL)\n {\n png_bytep out = *profile;\n\n if (len == 1)\n memset(out, *endptr, result);\n\n else\n {\n while (size >= len)\n {\n memcpy(out, endptr, len);\n out += len;\n size -= len;\n }\n memcpy(out, endptr, size);\n }\n\n return result;\n }\n\n else\n {\n fprintf(stderr, \"%s: size exceeds system limits\\n\", param);\n exit(1);\n }\n }\n\n return 0;\n}\n", + "target": " load_fake(png_charp param, png_bytepp profile)\n {\n char *endptr = NULL;\n uint64_t size = strtoull(param, &endptr, 0/*base*/);\n \n /* The 'fake' format is *[string] */\n if (endptr != NULL && *endptr == '*')\n {\n size_t len = strlen(++endptr);\n size_t result = (size_t)size;\n\n if (len == 0) len = 1; /* capture the terminating '\\0' */\n\n /* Now repeat that string to fill 'size' bytes. */\n if (result == size && (*profile = malloc(result)) != NULL)\n {\n png_bytep out = *profile;\n\n if (len == 1)\n memset(out, *endptr, result);\n\n else\n {\n while (size >= len)\n {\n memcpy(out, endptr, len);\n out += len;\n size -= len;\n }\n memcpy(out, endptr, size);\n }\n\n return result;\n }\n\n else\n {\n fprintf(stderr, \"%s: size exceeds system limits\\n\", param);\n exit(1);\n }\n }\n\n return 0;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b351eabb428c7ca85a34513c64601f437923d576", + "input": "status_t OMXNodeInstance::useBuffer(\n OMX_U32 portIndex, const sp ¶ms,\n OMX::buffer_id *buffer, OMX_U32 allottedSize) {\n Mutex::Autolock autoLock(mLock);\n if (allottedSize > params->size()) {\n\n return BAD_VALUE;\n }\n \n BufferMeta *buffer_meta = new BufferMeta(params);\n \n OMX_BUFFERHEADERTYPE *header;\n \n OMX_ERRORTYPE err = OMX_UseBuffer(\n mHandle, &header, portIndex, buffer_meta,\n allottedSize, static_cast(params->pointer()));\n\n if (err != OMX_ErrorNone) {\n CLOG_ERROR(useBuffer, err, SIMPLE_BUFFER(\n portIndex, (size_t)allottedSize, params->pointer()));\n\n delete buffer_meta;\n buffer_meta = NULL;\n\n *buffer = 0;\n\n return StatusFromOMXError(err);\n }\n\n CHECK_EQ(header->pAppPrivate, buffer_meta);\n\n *buffer = makeBufferID(header);\n\n addActiveBuffer(portIndex, *buffer);\n\n sp bufferSource(getGraphicBufferSource());\n if (bufferSource != NULL && portIndex == kPortIndexInput) {\n bufferSource->addCodecBuffer(header);\n }\n\n CLOG_BUFFER(useBuffer, NEW_BUFFER_FMT(\n *buffer, portIndex, \"%u(%zu)@%p\", allottedSize, params->size(), params->pointer()));\n return OK;\n}\n", + "target": "status_t OMXNodeInstance::useBuffer(\n OMX_U32 portIndex, const sp ¶ms,\n OMX::buffer_id *buffer, OMX_U32 allottedSize) {\n Mutex::Autolock autoLock(mLock);\n if (allottedSize > params->size()) {\n\n return BAD_VALUE;\n }\n \n BufferMeta *buffer_meta = new BufferMeta(params, portIndex);\n \n OMX_BUFFERHEADERTYPE *header;\n \n OMX_ERRORTYPE err = OMX_UseBuffer(\n mHandle, &header, portIndex, buffer_meta,\n allottedSize, static_cast(params->pointer()));\n\n if (err != OMX_ErrorNone) {\n CLOG_ERROR(useBuffer, err, SIMPLE_BUFFER(\n portIndex, (size_t)allottedSize, params->pointer()));\n\n delete buffer_meta;\n buffer_meta = NULL;\n\n *buffer = 0;\n\n return StatusFromOMXError(err);\n }\n\n CHECK_EQ(header->pAppPrivate, buffer_meta);\n\n *buffer = makeBufferID(header);\n\n addActiveBuffer(portIndex, *buffer);\n\n sp bufferSource(getGraphicBufferSource());\n if (bufferSource != NULL && portIndex == kPortIndexInput) {\n bufferSource->addCodecBuffer(header);\n }\n\n CLOG_BUFFER(useBuffer, NEW_BUFFER_FMT(\n *buffer, portIndex, \"%u(%zu)@%p\", allottedSize, params->size(), params->pointer()));\n return OK;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#78d89fe556cb5dabbc47b4967cdf55e607e29580", + "input": "void DestroySkImageOnOriginalThread(\n sk_sp image,\n base::WeakPtr context_provider_wrapper,\n std::unique_ptr sync_token) {\n if (context_provider_wrapper &&\n image->isValid(\n context_provider_wrapper->ContextProvider()->GetGrContext())) {\n if (sync_token->HasData()) {\n context_provider_wrapper->ContextProvider()\n ->ContextGL()\n ->WaitSyncTokenCHROMIUM(sync_token->GetData());\n }\n image->getTexture()->textureParamsModified();\n }\n }\n", + "target": "void DestroySkImageOnOriginalThread(\n sk_sp image,\n base::WeakPtr context_provider_wrapper,\n std::unique_ptr sync_token) {\n if (context_provider_wrapper &&\n image->isValid(\n context_provider_wrapper->ContextProvider()->GetGrContext())) {\n if (sync_token->HasData()) {\n context_provider_wrapper->ContextProvider()\n ->ContextGL()\n ->WaitSyncTokenCHROMIUM(sync_token->GetData());\n }\n image->getTexture()->textureParamsModified();\n }\n image.reset();\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c552cd7b8a0862f6b3c8c6a07f98bda3721101eb", + "input": "void Browser::AddNewContents(WebContents* source,\n std::unique_ptr new_contents,\n WindowOpenDisposition disposition,\n const gfx::Rect& initial_rect,\n bool user_gesture,\n bool* was_blocked) {\n if (source && PopupBlockerTabHelper::ConsiderForPopupBlocking(disposition))\n PopupTracker::CreateForWebContents(new_contents.get(), source);\n chrome::AddWebContents(this, source, std::move(new_contents), disposition,\n initial_rect);\n}\n", + "target": "void Browser::AddNewContents(WebContents* source,\n std::unique_ptr new_contents,\n WindowOpenDisposition disposition,\n const gfx::Rect& initial_rect,\n bool user_gesture,\n bool* was_blocked) {\n#if defined(OS_MACOSX)\n // On the Mac, the convention is to turn popups into new tabs when in\n // fullscreen mode. Only worry about user-initiated fullscreen as showing a\n // popup in HTML5 fullscreen would have kicked the page out of fullscreen.\n if (disposition == WindowOpenDisposition::NEW_POPUP &&\n exclusive_access_manager_->fullscreen_controller()\n ->IsFullscreenForBrowser()) {\n disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;\n }\n#endif\n\n if (source && PopupBlockerTabHelper::ConsiderForPopupBlocking(disposition))\n PopupTracker::CreateForWebContents(new_contents.get(), source);\n chrome::AddWebContents(this, source, std::move(new_contents), disposition,\n initial_rect);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c5b831f21d0d29d1e517d139d9d101763f60c9a2", + "input": "int ssl3_send_server_key_exchange(SSL *s)\n{\n#ifndef OPENSSL_NO_RSA\n unsigned char *q;\n int j, num;\n RSA *rsa;\n unsigned char md_buf[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];\n unsigned int u;\n#endif\n#ifndef OPENSSL_NO_DH\n DH *dh = NULL, *dhp;\n#endif\n#ifndef OPENSSL_NO_ECDH\n EC_KEY *ecdh = NULL, *ecdhp;\n unsigned char *encodedPoint = NULL;\n int encodedlen = 0;\n int curve_id = 0;\n BN_CTX *bn_ctx = NULL;\n#endif\n EVP_PKEY *pkey;\n const EVP_MD *md = NULL;\n unsigned char *p, *d;\n int al, i;\n unsigned long type;\n int n;\n CERT *cert;\n BIGNUM *r[4];\n int nr[4], kn;\n BUF_MEM *buf;\n EVP_MD_CTX md_ctx;\n\n EVP_MD_CTX_init(&md_ctx);\n if (s->state == SSL3_ST_SW_KEY_EXCH_A) {\n type = s->s3->tmp.new_cipher->algorithm_mkey;\n cert = s->cert;\n\n buf = s->init_buf;\n\n r[0] = r[1] = r[2] = r[3] = NULL;\n n = 0;\n#ifndef OPENSSL_NO_RSA\n if (type & SSL_kRSA) {\n rsa = cert->rsa_tmp;\n if ((rsa == NULL) && (s->cert->rsa_tmp_cb != NULL)) {\n rsa = s->cert->rsa_tmp_cb(s,\n SSL_C_IS_EXPORT(s->s3->\n tmp.new_cipher),\n SSL_C_EXPORT_PKEYLENGTH(s->s3->\n tmp.new_cipher));\n if (rsa == NULL) {\n al = SSL_AD_HANDSHAKE_FAILURE;\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,\n SSL_R_ERROR_GENERATING_TMP_RSA_KEY);\n goto f_err;\n }\n RSA_up_ref(rsa);\n cert->rsa_tmp = rsa;\n }\n if (rsa == NULL) {\n al = SSL_AD_HANDSHAKE_FAILURE;\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,\n SSL_R_MISSING_TMP_RSA_KEY);\n goto f_err;\n }\n r[0] = rsa->n;\n r[1] = rsa->e;\n s->s3->tmp.use_rsa_tmp = 1;\n } else\n#endif\n#ifndef OPENSSL_NO_DH\n if (type & SSL_kEDH) {\n dhp = cert->dh_tmp;\n if ((dhp == NULL) && (s->cert->dh_tmp_cb != NULL))\n dhp = s->cert->dh_tmp_cb(s,\n SSL_C_IS_EXPORT(s->s3->\n tmp.new_cipher),\n SSL_C_EXPORT_PKEYLENGTH(s->s3->\n tmp.new_cipher));\n if (dhp == NULL) {\n al = SSL_AD_HANDSHAKE_FAILURE;\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,\n SSL_R_MISSING_TMP_DH_KEY);\n goto f_err;\n }\n\n if (s->s3->tmp.dh != NULL) {\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,\n ERR_R_INTERNAL_ERROR);\n goto err;\n }\n\n if ((dh = DHparams_dup(dhp)) == NULL) {\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB);\n goto err;\n }\n \n s->s3->tmp.dh = dh;\n if ((dhp->pub_key == NULL ||\n dhp->priv_key == NULL ||\n (s->options & SSL_OP_SINGLE_DH_USE))) {\n if (!DH_generate_key(dh)) {\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB);\n goto err;\n }\n } else {\n dh->pub_key = BN_dup(dhp->pub_key);\n dh->priv_key = BN_dup(dhp->priv_key);\n if ((dh->pub_key == NULL) || (dh->priv_key == NULL)) {\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB);\n goto err;\n }\n }\n r[0] = dh->p;\n r[1] = dh->g;\n }\n } else {\n dh->pub_key = BN_dup(dhp->pub_key);\n dh->priv_key = BN_dup(dhp->priv_key);\n if ((dh->pub_key == NULL) || (dh->priv_key == NULL)) {\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB);\n goto err;\n }\n }\n r[0] = dh->p;\n r[1] = dh->g;\n r[2] = dh->pub_key;\n } else\n", + "target": "int ssl3_send_server_key_exchange(SSL *s)\n{\n#ifndef OPENSSL_NO_RSA\n unsigned char *q;\n int j, num;\n RSA *rsa;\n unsigned char md_buf[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];\n unsigned int u;\n#endif\n#ifndef OPENSSL_NO_DH\n DH *dh = NULL, *dhp;\n#endif\n#ifndef OPENSSL_NO_ECDH\n EC_KEY *ecdh = NULL, *ecdhp;\n unsigned char *encodedPoint = NULL;\n int encodedlen = 0;\n int curve_id = 0;\n BN_CTX *bn_ctx = NULL;\n#endif\n EVP_PKEY *pkey;\n const EVP_MD *md = NULL;\n unsigned char *p, *d;\n int al, i;\n unsigned long type;\n int n;\n CERT *cert;\n BIGNUM *r[4];\n int nr[4], kn;\n BUF_MEM *buf;\n EVP_MD_CTX md_ctx;\n\n EVP_MD_CTX_init(&md_ctx);\n if (s->state == SSL3_ST_SW_KEY_EXCH_A) {\n type = s->s3->tmp.new_cipher->algorithm_mkey;\n cert = s->cert;\n\n buf = s->init_buf;\n\n r[0] = r[1] = r[2] = r[3] = NULL;\n n = 0;\n#ifndef OPENSSL_NO_RSA\n if (type & SSL_kRSA) {\n rsa = cert->rsa_tmp;\n if ((rsa == NULL) && (s->cert->rsa_tmp_cb != NULL)) {\n rsa = s->cert->rsa_tmp_cb(s,\n SSL_C_IS_EXPORT(s->s3->\n tmp.new_cipher),\n SSL_C_EXPORT_PKEYLENGTH(s->s3->\n tmp.new_cipher));\n if (rsa == NULL) {\n al = SSL_AD_HANDSHAKE_FAILURE;\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,\n SSL_R_ERROR_GENERATING_TMP_RSA_KEY);\n goto f_err;\n }\n RSA_up_ref(rsa);\n cert->rsa_tmp = rsa;\n }\n if (rsa == NULL) {\n al = SSL_AD_HANDSHAKE_FAILURE;\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,\n SSL_R_MISSING_TMP_RSA_KEY);\n goto f_err;\n }\n r[0] = rsa->n;\n r[1] = rsa->e;\n s->s3->tmp.use_rsa_tmp = 1;\n } else\n#endif\n#ifndef OPENSSL_NO_DH\n if (type & SSL_kEDH) {\n dhp = cert->dh_tmp;\n if ((dhp == NULL) && (s->cert->dh_tmp_cb != NULL))\n dhp = s->cert->dh_tmp_cb(s,\n SSL_C_IS_EXPORT(s->s3->\n tmp.new_cipher),\n SSL_C_EXPORT_PKEYLENGTH(s->s3->\n tmp.new_cipher));\n if (dhp == NULL) {\n al = SSL_AD_HANDSHAKE_FAILURE;\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,\n SSL_R_MISSING_TMP_DH_KEY);\n goto f_err;\n }\n\n if (s->s3->tmp.dh != NULL) {\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,\n ERR_R_INTERNAL_ERROR);\n goto err;\n }\n\n if ((dh = DHparams_dup(dhp)) == NULL) {\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB);\n goto err;\n }\n \n s->s3->tmp.dh = dh;\n if (!DH_generate_key(dh)) {\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB);\n goto err;\n }\n r[0] = dh->p;\n r[1] = dh->g;\n }\n } else {\n dh->pub_key = BN_dup(dhp->pub_key);\n dh->priv_key = BN_dup(dhp->priv_key);\n if ((dh->pub_key == NULL) || (dh->priv_key == NULL)) {\n SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_DH_LIB);\n goto err;\n }\n }\n r[0] = dh->p;\n r[1] = dh->g;\n r[2] = dh->pub_key;\n } else\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b15c87071f906301bccc824ce013966ca93998c7", + "input": " void WorkerProcessLauncher::Core::StopWorker() {\n DCHECK(caller_task_runner_->BelongsToCurrentThread());\n \n if (launch_success_timer_->IsRunning()) {\n launch_success_timer_->Stop();\n launch_backoff_.InformOfRequest(false);\n }\n \n self_ = this;\n ipc_enabled_ = false;\n \n if (process_watcher_.GetWatchedObject() != NULL) {\n launcher_delegate_->KillProcess(CONTROL_C_EXIT);\n return;\n }\n \n DCHECK(process_watcher_.GetWatchedObject() == NULL);\n \n ipc_error_timer_->Stop();\n process_exit_event_.Close();\n\n if (stopping_) {\n ipc_error_timer_.reset();\n launch_timer_.reset();\n self_ = NULL;\n return;\n }\n \n self_ = NULL;\n DWORD exit_code = launcher_delegate_->GetExitCode();\n if (kMinPermanentErrorExitCode <= exit_code &&\n exit_code <= kMaxPermanentErrorExitCode) {\n worker_delegate_->OnPermanentError();\n return;\n }\n launch_timer_->Start(FROM_HERE, launch_backoff_.GetTimeUntilRelease(),\n this, &Core::LaunchWorker);\n }\n", + "target": " void WorkerProcessLauncher::Core::StopWorker() {\n DCHECK(caller_task_runner_->BelongsToCurrentThread());\n \n // Keep the object alive in case one of delegates decides to delete |this|.\n scoped_refptr self = this;\n\n if (launch_success_timer_->IsRunning()) {\n launch_success_timer_->Stop();\n launch_backoff_.InformOfRequest(false);\n }\n \n ipc_enabled_ = false;\n \n if (process_watcher_.GetWatchedObject() != NULL) {\n launcher_delegate_->KillProcess(CONTROL_C_EXIT);\n \n // Wait until the process is actually stopped if the caller keeps\n // a reference to |this|. Otherwise terminate everything right now - there\n // won't be a second chance.\n if (!stopping_)\n return;\n\n process_watcher_.StopWatching();\n }\n \n ipc_error_timer_->Stop();\n process_exit_event_.Close();\n\n if (stopping_) {\n ipc_error_timer_.reset();\n launch_timer_.reset();\n return;\n }\n \n if (launcher_delegate_->IsPermanentError(launch_backoff_.failure_count())) {\n if (!stopping_)\n worker_delegate_->OnPermanentError();\n } else {\n // Schedule the next attempt to launch the worker process.\n launch_timer_->Start(FROM_HERE, launch_backoff_.GetTimeUntilRelease(),\n this, &Core::LaunchWorker);\n }\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long Chapters::Atom::ParseDisplay(\n IMkvReader* pReader,\n long long pos,\n long long size)\n{\n if (!ExpandDisplaysArray())\n return -1;\n Display& d = m_displays[m_displays_count++];\n d.Init();\n return d.Parse(pReader, pos, size);\n}\n", + "target": "long Chapters::Atom::ParseDisplay(\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#bc1f34b9be509f1404f0bb1ba1947614d5f0bcd1", + "input": " void MediaInterfaceProxy::CreateCdm(\n media::mojom::ContentDecryptionModuleRequest request) {\n DCHECK(thread_checker_.CalledOnValidThread());\n GetMediaInterfaceFactory()->CreateCdm(std::move(request));\n }\n", + "target": " void MediaInterfaceProxy::CreateCdm(\n media::mojom::ContentDecryptionModuleRequest request) {\n DCHECK(thread_checker_.CalledOnValidThread());\n GetCdmInterfaceFactory()->CreateCdm(std::move(request));\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e04f0283516e80d2f93366e0d479d13c9b5c8c2a", + "input": " static int gss_iakerbmechglue_init(void)\n {\n struct gss_mech_config mech_iakerb;\n struct gss_config iakerb_mechanism = krb5_mechanism;\n /* IAKERB mechanism mirrors krb5, but with different context SPIs */\n iakerb_mechanism.gss_accept_sec_context = iakerb_gss_accept_sec_context;\n iakerb_mechanism.gss_init_sec_context = iakerb_gss_init_sec_context;\n iakerb_mechanism.gss_delete_sec_context = iakerb_gss_delete_sec_context;\n iakerb_mechanism.gss_acquire_cred = iakerb_gss_acquire_cred;\n iakerb_mechanism.gssspi_acquire_cred_with_password\n = iakerb_gss_acquire_cred_with_password;\n \n memset(&mech_iakerb, 0, sizeof(mech_iakerb));\n mech_iakerb.mech = &iakerb_mechanism;\n\n mech_iakerb.mechNameStr = \"iakerb\";\n mech_iakerb.mech_type = (gss_OID)gss_mech_iakerb;\n gssint_register_mechinfo(&mech_iakerb);\n\n return 0;\n}\n", + "target": " static int gss_iakerbmechglue_init(void)\n {\n struct gss_mech_config mech_iakerb;\n \n memset(&mech_iakerb, 0, sizeof(mech_iakerb));\n mech_iakerb.mech = &iakerb_mechanism;\n\n mech_iakerb.mechNameStr = \"iakerb\";\n mech_iakerb.mech_type = (gss_OID)gss_mech_iakerb;\n gssint_register_mechinfo(&mech_iakerb);\n\n return 0;\n}\n", + "vul_type": "cwe-18", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc7b094a338c6c521f918f478e993f0f74bbea0d", + "input": "InputMethodStatusConnection* ChromeOSMonitorInputMethodStatus(\n void* language_library,\n LanguageCurrentInputMethodMonitorFunction current_input_method_changed,\n LanguageRegisterImePropertiesFunction register_ime_properties,\n LanguageUpdateImePropertyFunction update_ime_property,\n LanguageConnectionChangeMonitorFunction connection_changed) {\n DLOG(INFO) << \"MonitorInputMethodStatus\";\n return InputMethodStatusConnection::GetConnection(\n language_library,\n current_input_method_changed,\n register_ime_properties,\n update_ime_property,\n connection_changed);\n}\n", + "target": "InputMethodStatusConnection* ChromeOSMonitorInputMethodStatus(\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0", + "input": " void MockRenderThread::RemoveRoute(int32 routing_id) {\n EXPECT_EQ(routing_id_, routing_id);\n widget_ = NULL;\n }\n", + "target": " void MockRenderThread::RemoveRoute(int32 routing_id) {\n // We may hear this for views created from OnMsgCreateWindow as well,\n // in which case we don't want to track the new widget.\n if (routing_id_ == routing_id)\n widget_ = NULL;\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a261ea1c56ef16fc0fc4af1e440feb302d577716", + "input": " void FileReaderLoader::OnCalculatedSize(uint64_t total_size,\n uint64_t expected_content_size) {\n OnStartLoading(expected_content_size);\n if (expected_content_size == 0) {\n received_all_data_ = true;\n return;\n }\n\n if (IsSyncLoad()) {\n OnDataPipeReadable(MOJO_RESULT_OK);\n } else {\n handle_watcher_.Watch(\n consumer_handle_.get(), MOJO_HANDLE_SIGNAL_READABLE,\n WTF::BindRepeating(&FileReaderLoader::OnDataPipeReadable,\n WTF::Unretained(this)));\n }\n}\n", + "target": " void FileReaderLoader::OnCalculatedSize(uint64_t total_size,\n uint64_t expected_content_size) {\n auto weak_this = weak_factory_.GetWeakPtr();\n OnStartLoading(expected_content_size);\n // OnStartLoading calls out to our client, which could delete |this|, so bail\n // out if that happened.\n if (!weak_this)\n return;\n\n if (expected_content_size == 0) {\n received_all_data_ = true;\n return;\n }\n\n if (IsSyncLoad()) {\n OnDataPipeReadable(MOJO_RESULT_OK);\n } else {\n handle_watcher_.Watch(\n consumer_handle_.get(), MOJO_HANDLE_SIGNAL_READABLE,\n WTF::BindRepeating(&FileReaderLoader::OnDataPipeReadable,\n WTF::Unretained(this)));\n }\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long long Cluster::GetLastTime() const\n{\n const BlockEntry* pEntry;\n const long status = GetLast(pEntry);\n if (status < 0) //error\n return status;\n if (pEntry == NULL) //empty cluster\n return GetTime();\n const Block* const pBlock = pEntry->GetBlock();\n assert(pBlock);\n return pBlock->GetTime(this);\n}\n", + "target": "long long Cluster::GetLastTime() const\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#727ba748e110b4de50d142edca9d6a9b7e6111d8", + "input": "static int handle_vmread(struct kvm_vcpu *vcpu)\n{\n\tunsigned long field;\n\tu64 field_value;\n\tunsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);\n\tu32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);\n\tgva_t gva = 0;\n\n\tif (!nested_vmx_check_permission(vcpu))\n\t\treturn 1;\n\n\tif (!nested_vmx_check_vmcs12(vcpu))\n\t\treturn kvm_skip_emulated_instruction(vcpu);\n\n\t/* Decode instruction info and find the field to read */\n\tfield = kvm_register_readl(vcpu, (((vmx_instruction_info) >> 28) & 0xf));\n\t/* Read the field, zero-extended to a u64 field_value */\n\tif (vmcs12_read_any(vcpu, field, &field_value) < 0) {\n\t\tnested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);\n\t\treturn kvm_skip_emulated_instruction(vcpu);\n\t}\n\t/*\n\t * Now copy part of this value to register or memory, as requested.\n\t * Note that the number of bits actually copied is 32 or 64 depending\n\t * on the guest's mode (32 or 64 bit), not on the given field's length.\n\t */\n\tif (vmx_instruction_info & (1u << 10)) {\n\t\tkvm_register_writel(vcpu, (((vmx_instruction_info) >> 3) & 0xf),\n\t\t\tfield_value);\n\t} else {\n \t\tif (get_vmx_mem_address(vcpu, exit_qualification,\n \t\t\t\tvmx_instruction_info, true, &gva))\n \t\t\treturn 1;\n\t\t/* _system ok, as hardware has verified cpl=0 */\n \t\tkvm_write_guest_virt_system(&vcpu->arch.emulate_ctxt, gva,\n \t\t\t &field_value, (is_long_mode(vcpu) ? 8 : 4), NULL);\n \t}\n\n\tnested_vmx_succeed(vcpu);\n\treturn kvm_skip_emulated_instruction(vcpu);\n}\n", + "target": "static int handle_vmread(struct kvm_vcpu *vcpu)\n{\n\tunsigned long field;\n\tu64 field_value;\n\tunsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);\n\tu32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);\n\tgva_t gva = 0;\n\n\tif (!nested_vmx_check_permission(vcpu))\n\t\treturn 1;\n\n\tif (!nested_vmx_check_vmcs12(vcpu))\n\t\treturn kvm_skip_emulated_instruction(vcpu);\n\n\t/* Decode instruction info and find the field to read */\n\tfield = kvm_register_readl(vcpu, (((vmx_instruction_info) >> 28) & 0xf));\n\t/* Read the field, zero-extended to a u64 field_value */\n\tif (vmcs12_read_any(vcpu, field, &field_value) < 0) {\n\t\tnested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);\n\t\treturn kvm_skip_emulated_instruction(vcpu);\n\t}\n\t/*\n\t * Now copy part of this value to register or memory, as requested.\n\t * Note that the number of bits actually copied is 32 or 64 depending\n\t * on the guest's mode (32 or 64 bit), not on the given field's length.\n\t */\n\tif (vmx_instruction_info & (1u << 10)) {\n\t\tkvm_register_writel(vcpu, (((vmx_instruction_info) >> 3) & 0xf),\n\t\t\tfield_value);\n\t} else {\n \t\tif (get_vmx_mem_address(vcpu, exit_qualification,\n \t\t\t\tvmx_instruction_info, true, &gva))\n \t\t\treturn 1;\n\t\t/* _system ok, nested_vmx_check_permission has verified cpl=0 */\n \t\tkvm_write_guest_virt_system(&vcpu->arch.emulate_ctxt, gva,\n \t\t\t &field_value, (is_long_mode(vcpu) ? 8 : 4), NULL);\n \t}\n\n\tnested_vmx_succeed(vcpu);\n\treturn kvm_skip_emulated_instruction(vcpu);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8c7c42f5cd3d3cab81fad08b1159106184fa0c47", + "input": "ChromeGeolocationPermissionContext::ChromeGeolocationPermissionContext(\n Profile* profile)\n : profile_(profile),\n ALLOW_THIS_IN_INITIALIZER_LIST(geolocation_infobar_queue_controller_(\n new GeolocationInfoBarQueueController(\n base::Bind(\n &ChromeGeolocationPermissionContext::NotifyPermissionSet,\n this),\n profile))) {\n }\n", + "target": "ChromeGeolocationPermissionContext::ChromeGeolocationPermissionContext(\n Profile* profile)\n : profile_(profile),\n ALLOW_THIS_IN_INITIALIZER_LIST(geolocation_infobar_queue_controller_(\n new GeolocationInfoBarQueueController(\n base::Bind(\n &ChromeGeolocationPermissionContext::NotifyPermissionSet,\n base::Unretained(this)),\n profile))) {\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d0947db40187f4708c58e64cbd6013faf9eddeed", + "input": "xmlStopParser(xmlParserCtxtPtr ctxt) {\n if (ctxt == NULL)\n return;\n ctxt->instate = XML_PARSER_EOF;\n ctxt->disableSAX = 1;\n if (ctxt->input != NULL) {\n \tctxt->input->cur = BAD_CAST\"\";\n\tctxt->input->base = ctxt->input->cur;\n }\n}\n", + "target": "xmlStopParser(xmlParserCtxtPtr ctxt) {\n if (ctxt == NULL)\n return;\n ctxt->instate = XML_PARSER_EOF;\n ctxt->errNo = XML_ERR_USER_STOP;\n ctxt->disableSAX = 1;\n if (ctxt->input != NULL) {\n \tctxt->input->cur = BAD_CAST\"\";\n\tctxt->input->base = ctxt->input->cur;\n }\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d65b01ca819881a507b5e60c25a2f9caff58cd57", + "input": "void QuotaManager::GetAvailableSpace(const AvailableSpaceCallback& callback) {\n if (is_incognito_) {\n callback.Run(kQuotaStatusOk, kIncognitoDefaultTemporaryQuota);\n return;\n }\n make_scoped_refptr(new AvailableSpaceQueryTask(this, callback))->Start();\n }\n", + "target": "void QuotaManager::GetAvailableSpace(const AvailableSpaceCallback& callback) {\n if (is_incognito_) {\n callback.Run(kQuotaStatusOk, kIncognitoDefaultTemporaryQuota);\n return;\n }\n\n PostTaskAndReplyWithResult(\n db_thread_,\n FROM_HERE,\n base::Bind(get_disk_space_fn_, profile_path_),\n base::Bind(&QuotaManager::DidGetAvailableSpace,\n weak_factory_.GetWeakPtr(),\n callback));\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b3500af717010137046ec4076d1e1c0641e33727", + "input": " Horizontal_Sweep_Drop( RAS_ARGS Short y,\n FT_F26Dot6 x1,\n FT_F26Dot6 x2,\n PProfile left,\n PProfile right )\n {\n Long e1, e2, pxl;\n PByte bits;\n Byte f1;\n\n\n /* During the horizontal sweep, we only take care of drop-outs */\n\n /* e1 + <-- pixel center */\n /* | */\n /* x1 ---+--> <-- contour */\n /* | */\n /* | */\n /* x2 <--+--- <-- contour */\n /* | */\n /* | */\n /* e2 + <-- pixel center */\n\n e1 = CEILING( x1 );\n e2 = FLOOR ( x2 );\n pxl = e1;\n\n if ( e1 > e2 )\n {\n Int dropOutControl = left->flags & 7;\n\n\n if ( e1 == e2 + ras.precision )\n {\n switch ( dropOutControl )\n {\n case 0: /* simple drop-outs including stubs */\n pxl = e2;\n break;\n\n case 4: /* smart drop-outs including stubs */\n pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );\n break;\n\n case 1: /* simple drop-outs excluding stubs */\n case 5: /* smart drop-outs excluding stubs */\n /* see Vertical_Sweep_Drop for details */\n\n /* rightmost stub test */\n if ( left->next == right &&\n left->height <= 0 &&\n !( left->flags & Overshoot_Top &&\n x2 - x1 >= ras.precision_half ) )\n return;\n\n /* leftmost stub test */\n if ( right->next == left &&\n left->start == y &&\n !( left->flags & Overshoot_Bottom &&\n x2 - x1 >= ras.precision_half ) )\n return;\n\n if ( dropOutControl == 1 )\n pxl = e2;\n else\n pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );\n break;\n\n default: /* modes 2, 3, 6, 7 */\n return; /* no drop-out control */\n }\n\n /* undocumented but confirmed: If the drop-out would result in a */\n /* pixel outside of the bounding box, use the pixel inside of the */\n /* bounding box instead */\n if ( pxl < 0 )\n pxl = e1;\n else if ( TRUNC( pxl ) >= ras.target.rows )\n pxl = e2;\n \n /* check that the other pixel isn't set */\n e1 = pxl == e1 ? e2 : e1;\n\n e1 = TRUNC( e1 );\n\n bits = ras.bTarget + ( y >> 3 );\n f1 = (Byte)( 0x80 >> ( y & 7 ) );\n\n bits -= e1 * ras.target.pitch;\n if ( ras.target.pitch > 0 )\n bits += ( ras.target.rows - 1 ) * ras.target.pitch;\n \n if ( e1 >= 0 &&\n e1 < ras.target.rows &&\n *bits & f1 )\n return;\n }\n else\n return;\n }\n\n bits = ras.bTarget + ( y >> 3 );\n f1 = (Byte)( 0x80 >> ( y & 7 ) );\n \n e1 = TRUNC( pxl );\n \n if ( e1 >= 0 && e1 < ras.target.rows )\n {\n bits -= e1 * ras.target.pitch;\n if ( ras.target.pitch > 0 )\n bits += ( ras.target.rows - 1 ) * ras.target.pitch;\n\n bits[0] |= f1;\n }\n }\n", + "target": " Horizontal_Sweep_Drop( RAS_ARGS Short y,\n FT_F26Dot6 x1,\n FT_F26Dot6 x2,\n PProfile left,\n PProfile right )\n {\n Long e1, e2, pxl;\n PByte bits;\n Byte f1;\n\n\n /* During the horizontal sweep, we only take care of drop-outs */\n\n /* e1 + <-- pixel center */\n /* | */\n /* x1 ---+--> <-- contour */\n /* | */\n /* | */\n /* x2 <--+--- <-- contour */\n /* | */\n /* | */\n /* e2 + <-- pixel center */\n\n e1 = CEILING( x1 );\n e2 = FLOOR ( x2 );\n pxl = e1;\n\n if ( e1 > e2 )\n {\n Int dropOutControl = left->flags & 7;\n\n\n if ( e1 == e2 + ras.precision )\n {\n switch ( dropOutControl )\n {\n case 0: /* simple drop-outs including stubs */\n pxl = e2;\n break;\n\n case 4: /* smart drop-outs including stubs */\n pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );\n break;\n\n case 1: /* simple drop-outs excluding stubs */\n case 5: /* smart drop-outs excluding stubs */\n /* see Vertical_Sweep_Drop for details */\n\n /* rightmost stub test */\n if ( left->next == right &&\n left->height <= 0 &&\n !( left->flags & Overshoot_Top &&\n x2 - x1 >= ras.precision_half ) )\n return;\n\n /* leftmost stub test */\n if ( right->next == left &&\n left->start == y &&\n !( left->flags & Overshoot_Bottom &&\n x2 - x1 >= ras.precision_half ) )\n return;\n\n if ( dropOutControl == 1 )\n pxl = e2;\n else\n pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );\n break;\n\n default: /* modes 2, 3, 6, 7 */\n return; /* no drop-out control */\n }\n\n /* undocumented but confirmed: If the drop-out would result in a */\n /* pixel outside of the bounding box, use the pixel inside of the */\n /* bounding box instead */\n if ( pxl < 0 )\n pxl = e1;\n else if ( (ULong)( TRUNC( pxl ) ) >= ras.target.rows )\n pxl = e2;\n \n /* check that the other pixel isn't set */\n e1 = pxl == e1 ? e2 : e1;\n\n e1 = TRUNC( e1 );\n\n bits = ras.bTarget + ( y >> 3 );\n f1 = (Byte)( 0x80 >> ( y & 7 ) );\n\n bits -= e1 * ras.target.pitch;\n if ( ras.target.pitch > 0 )\n bits += ( ras.target.rows - 1 ) * ras.target.pitch;\n \n if ( e1 >= 0 &&\n (ULong)e1 < ras.target.rows &&\n *bits & f1 )\n return;\n }\n else\n return;\n }\n\n bits = ras.bTarget + ( y >> 3 );\n f1 = (Byte)( 0x80 >> ( y & 7 ) );\n \n e1 = TRUNC( pxl );\n \n if ( e1 >= 0 && (ULong)e1 < ras.target.rows )\n {\n bits -= e1 * ras.target.pitch;\n if ( ras.target.pitch > 0 )\n bits += ( ras.target.rows - 1 ) * ras.target.pitch;\n\n bits[0] |= f1;\n }\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3cb1b6944e776863aea316e25fdc16d7f9962902", + "input": "OMX_BUFFERHEADERTYPE *OMXNodeInstance::findBufferHeader(OMX::buffer_id buffer) {\n return (OMX_BUFFERHEADERTYPE *)buffer;\n}\n", + "target": "OMX_BUFFERHEADERTYPE *OMXNodeInstance::findBufferHeader(OMX::buffer_id buffer) {\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": " ContentEncoding::~ContentEncoding() {\n ContentCompression** comp_i = compression_entries_;\n ContentCompression** const comp_j = compression_entries_end_;\n\n while (comp_i != comp_j) {\n ContentCompression* const comp = *comp_i++;\n\n delete comp;\n }\n \n delete [] compression_entries_;\n \n ContentEncryption** enc_i = encryption_entries_;\n ContentEncryption** const enc_j = encryption_entries_end_;\n\n while (enc_i != enc_j) {\n ContentEncryption* const enc = *enc_i++;\n\n delete enc;\n }\n \n delete [] encryption_entries_;\n }\n", + "target": " ContentEncoding::~ContentEncoding() {\n ContentCompression** comp_i = compression_entries_;\n ContentCompression** const comp_j = compression_entries_end_;\n\n while (comp_i != comp_j) {\n ContentCompression* const comp = *comp_i++;\n\n delete comp;\n }\n \n delete[] compression_entries_;\n \n ContentEncryption** enc_i = encryption_entries_;\n ContentEncryption** const enc_j = encryption_entries_end_;\n\n while (enc_i != enc_j) {\n ContentEncryption* const enc = *enc_i++;\n\n delete enc;\n }\n \n delete[] encryption_entries_;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f911e11e7f6b5c0d6f5ee694a9871de6619889f7", + "input": "void PropertyTreeManager::SetupRootClipNode() {\n cc::ClipTree& clip_tree = property_trees_.clip_tree;\n clip_tree.clear();\n cc::ClipNode& clip_node =\n *clip_tree.Node(clip_tree.Insert(cc::ClipNode(), kRealRootNodeId));\n DCHECK_EQ(clip_node.id, kSecondaryRootNodeId);\n\n clip_node.clip_type = cc::ClipNode::ClipType::APPLIES_LOCAL_CLIP;\n clip_node.clip = gfx::RectF(\n gfx::SizeF(root_layer_->layer_tree_host()->device_viewport_size()));\n clip_node.transform_id = kRealRootNodeId;\n \n clip_node_map_.Set(ClipPaintPropertyNode::Root(), clip_node.id);\n root_layer_->SetClipTreeIndex(clip_node.id);\n }\n", + "target": "void PropertyTreeManager::SetupRootClipNode() {\n cc::ClipTree& clip_tree = property_trees_.clip_tree;\n clip_tree.clear();\n cc::ClipNode& clip_node =\n *clip_tree.Node(clip_tree.Insert(cc::ClipNode(), kRealRootNodeId));\n DCHECK_EQ(clip_node.id, kSecondaryRootNodeId);\n\n clip_node.clip_type = cc::ClipNode::ClipType::APPLIES_LOCAL_CLIP;\n clip_node.clip = gfx::RectF(\n gfx::SizeF(root_layer_->layer_tree_host()->device_viewport_size()));\n clip_node.transform_id = kRealRootNodeId;\n \n clip_node_map_.Set(&ClipPaintPropertyNode::Root(), clip_node.id);\n root_layer_->SetClipTreeIndex(clip_node.id);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#673ce95d481ea9368c4d4d43ac756ba1d6d9e608", + "input": "MojoResult Core::WrapPlatformSharedBufferHandle(\n const MojoPlatformHandle* platform_handle,\n size_t size,\n const MojoSharedBufferGuid* guid,\n MojoPlatformSharedBufferHandleFlags flags,\n MojoHandle* mojo_handle) {\n DCHECK(size);\n ScopedPlatformHandle handle;\n MojoResult result =\n MojoPlatformHandleToScopedPlatformHandle(platform_handle, &handle);\n if (result != MOJO_RESULT_OK)\n return result;\n \n base::UnguessableToken token =\n base::UnguessableToken::Deserialize(guid->high, guid->low);\n bool read_only = flags & MOJO_PLATFORM_SHARED_BUFFER_HANDLE_FLAG_READ_ONLY;\n scoped_refptr platform_buffer =\n PlatformSharedBuffer::CreateFromPlatformHandle(size, read_only, token,\n std::move(handle));\n if (!platform_buffer)\n return MOJO_RESULT_UNKNOWN;\n\n scoped_refptr dispatcher;\n result = SharedBufferDispatcher::CreateFromPlatformSharedBuffer(\n platform_buffer, &dispatcher);\n if (result != MOJO_RESULT_OK)\n return result;\n\n MojoHandle h = AddDispatcher(dispatcher);\n if (h == MOJO_HANDLE_INVALID) {\n dispatcher->Close();\n return MOJO_RESULT_RESOURCE_EXHAUSTED;\n }\n\n *mojo_handle = h;\n return MOJO_RESULT_OK;\n}\n", + "target": "MojoResult Core::WrapPlatformSharedBufferHandle(\n const MojoPlatformHandle* platform_handle,\n size_t size,\n const MojoSharedBufferGuid* guid,\n MojoPlatformSharedBufferHandleFlags flags,\n MojoHandle* mojo_handle) {\n DCHECK(size);\n ScopedPlatformHandle handle;\n MojoResult result =\n MojoPlatformHandleToScopedPlatformHandle(platform_handle, &handle);\n if (result != MOJO_RESULT_OK)\n return result;\n \n base::UnguessableToken token =\n base::UnguessableToken::Deserialize(guid->high, guid->low);\n const bool read_only =\n flags & MOJO_PLATFORM_SHARED_BUFFER_HANDLE_FLAG_HANDLE_IS_READ_ONLY;\n scoped_refptr platform_buffer =\n PlatformSharedBuffer::CreateFromPlatformHandle(size, read_only, token,\n std::move(handle));\n if (!platform_buffer)\n return MOJO_RESULT_UNKNOWN;\n\n scoped_refptr dispatcher;\n result = SharedBufferDispatcher::CreateFromPlatformSharedBuffer(\n platform_buffer, &dispatcher);\n if (result != MOJO_RESULT_OK)\n return result;\n\n MojoHandle h = AddDispatcher(dispatcher);\n if (h == MOJO_HANDLE_INVALID) {\n dispatcher->Close();\n return MOJO_RESULT_RESOURCE_EXHAUSTED;\n }\n\n *mojo_handle = h;\n return MOJO_RESULT_OK;\n}\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a8b6c3e0537e90fba3c55910fd1b7229d54a60a7", + "input": " int cg_mkdir(const char *path, mode_t mode)\n {\n \tstruct fuse_context *fc = fuse_get_context();\n\tchar *fpath = NULL, *path1, *cgdir = NULL, *controller;\n \tconst char *cgroup;\n \tint ret;\n \n\tif (!fc)\n\t\treturn -EIO;\n\n\n\tcontroller = pick_controller_from_path(fc, path);\n\tif (!controller)\n\t\treturn -EINVAL;\n\n\tcgroup = find_cgroup_in_path(path);\n\tif (!cgroup)\n\t\treturn -EINVAL;\n\n\tget_cgdir_and_path(cgroup, &cgdir, &fpath);\n\tif (!fpath)\n\t\tpath1 = \"/\";\n \telse\n \t\tpath1 = cgdir;\n \n \tif (!fc_may_access(fc, controller, path1, NULL, O_RDWR)) {\n \t\tret = -EACCES;\n \t\tgoto out;\n\t}\n\tif (!caller_is_in_ancestor(fc->pid, controller, path1, NULL)) {\n\t\tret = -EACCES;\n\t\tgoto out;\n\t}\n\n\tret = cgfs_create(controller, cgroup, fc->uid, fc->gid);\n\tprintf(\"cgfs_create returned %d for %s %s\\n\", ret, controller, cgroup);\n \n out:\n \tfree(cgdir);\n \treturn ret;\n }\n", + "target": " int cg_mkdir(const char *path, mode_t mode)\n {\n \tstruct fuse_context *fc = fuse_get_context();\n\tchar *fpath = NULL, *path1, *cgdir = NULL, *controller, *next = NULL;\n \tconst char *cgroup;\n \tint ret;\n \n\tif (!fc)\n\t\treturn -EIO;\n\n\n\tcontroller = pick_controller_from_path(fc, path);\n\tif (!controller)\n\t\treturn -EINVAL;\n\n\tcgroup = find_cgroup_in_path(path);\n\tif (!cgroup)\n\t\treturn -EINVAL;\n\n\tget_cgdir_and_path(cgroup, &cgdir, &fpath);\n\tif (!fpath)\n\t\tpath1 = \"/\";\n \telse\n \t\tpath1 = cgdir;\n \n\tif (!caller_is_in_ancestor(fc->pid, controller, path1, &next)) {\n\t\tif (fpath && strcmp(next, fpath) == 0)\n\t\t\tret = -EEXIST;\n\t\telse\n\t\t\tret = -ENOENT;\n\t\tgoto out;\n\t}\n\n \tif (!fc_may_access(fc, controller, path1, NULL, O_RDWR)) {\n \t\tret = -EACCES;\n \t\tgoto out;\n\t}\n\tif (!caller_is_in_ancestor(fc->pid, controller, path1, NULL)) {\n\t\tret = -EACCES;\n\t\tgoto out;\n\t}\n\n\tret = cgfs_create(controller, cgroup, fc->uid, fc->gid);\n\tprintf(\"cgfs_create returned %d for %s %s\\n\", ret, controller, cgroup);\n \n out:\n \tfree(cgdir);\n\tfree(next);\n \treturn ret;\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ea3d1d84be3d6f97bf50e76511c9e26af6895533", + "input": " ResourceClientProxy(PluginChannelHost* channel, int instance_id)\n : channel_(channel), instance_id_(instance_id), resource_id_(0),\n notify_needed_(false), notify_data_(0),\n multibyte_response_expected_(false) {\n }\n", + "target": " ResourceClientProxy(PluginChannelHost* channel, int instance_id)\n : channel_(channel), instance_id_(instance_id), resource_id_(0),\n multibyte_response_expected_(false) {\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a8b6c3e0537e90fba3c55910fd1b7229d54a60a7", + "input": " static bool caller_is_in_ancestor(pid_t pid, const char *contrl, const char *cg, char **nextcg)\n {\n\tchar fnam[PROCLEN];\n\tFILE *f;\n \tbool answer = false;\n\tchar *line = NULL;\n\tsize_t len = 0;\n\tint ret;\n \n\tret = snprintf(fnam, PROCLEN, \"/proc/%d/cgroup\", pid);\n\tif (ret < 0 || ret >= PROCLEN)\n\t\treturn false;\n\tif (!(f = fopen(fnam, \"r\")))\n \t\treturn false;\n \n\twhile (getline(&line, &len, f) != -1) {\n\t\tchar *c1, *c2, *linecmp;\n\t\tif (!line[0])\n\t\t\tcontinue;\n\t\tc1 = strchr(line, ':');\n\t\tif (!c1)\n\t\t\tgoto out;\n\t\tc1++;\n\t\tc2 = strchr(c1, ':');\n\t\tif (!c2)\n\t\t\tgoto out;\n\t\t*c2 = '\\0';\n\t\tif (strcmp(c1, contrl) != 0)\n\t\t\tcontinue;\n\t\tc2++;\n\t\tstripnewline(c2);\n\t\tprune_init_slice(c2);\n\t\t/*\n\t\t * callers pass in '/' for root cgroup, otherwise they pass\n\t\t * in a cgroup without leading '/'\n\t\t */\n\t\tlinecmp = *cg == '/' ? c2 : c2+1;\n\t\tif (strncmp(linecmp, cg, strlen(linecmp)) != 0) {\n\t\t\tif (nextcg)\n\t\t\t\t*nextcg = get_next_cgroup_dir(linecmp, cg);\n\t\t\tgoto out;\n \t\t}\n \t\tanswer = true;\n \t\tgoto out;\n \t}\n \n out:\n\tfclose(f);\n\tfree(line);\n \treturn answer;\n }\n", + "target": " static bool caller_is_in_ancestor(pid_t pid, const char *contrl, const char *cg, char **nextcg)\n {\n \tbool answer = false;\n\tchar *c2 = get_pid_cgroup(pid, contrl);\n\tchar *linecmp;\n \n\tif (!c2)\n \t\treturn false;\n\tprune_init_slice(c2);\n \n\t/*\n\t * callers pass in '/' for root cgroup, otherwise they pass\n\t * in a cgroup without leading '/'\n\t */\n\tlinecmp = *cg == '/' ? c2 : c2+1;\n\tif (strncmp(linecmp, cg, strlen(linecmp)) != 0) {\n\t\tif (nextcg) {\n\t\t\t*nextcg = get_next_cgroup_dir(linecmp, cg);\n \t\t}\n\t\tgoto out;\n\t}\n\tanswer = true;\n\nout:\n\tfree(c2);\n\treturn answer;\n}\n\n/*\n * If caller is in /a/b/c, he may see that /a exists, but not /b or /a/c.\n */\nstatic bool caller_may_see_dir(pid_t pid, const char *contrl, const char *cg)\n{\n\tbool answer = false;\n\tchar *c2, *task_cg;\n\tsize_t target_len, task_len;\n\n\tif (strcmp(cg, \"/\") == 0)\n\t\treturn true;\n\n\tc2 = get_pid_cgroup(pid, contrl);\n\n\tif (!c2)\n\t\treturn false;\n\n\ttask_cg = c2 + 1;\n\ttarget_len = strlen(cg);\n\ttask_len = strlen(task_cg);\n\tif (strcmp(cg, task_cg) == 0) {\n \t\tanswer = true;\n \t\tgoto out;\n \t}\n\tif (target_len < task_len) {\n\t\t/* looking up a parent dir */\n\t\tif (strncmp(task_cg, cg, target_len) == 0 && task_cg[target_len] == '/')\n\t\t\tanswer = true;\n\t\tgoto out;\n\t}\n\tif (target_len > task_len) {\n\t\t/* looking up a child dir */\n\t\tif (strncmp(task_cg, cg, task_len) == 0 && cg[task_len] == '/')\n\t\t\tanswer = true;\n\t\tgoto out;\n\t}\n \n out:\n\tfree(c2);\n \treturn answer;\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#64e36901a0614bf64a19bc3396469c66dcd0b015", + "input": " unsigned long lh_char_hash(const void *k)\n {\n\tunsigned int h = 0;\n\tconst char* data = (const char*)k;\n\twhile( *data!=0 ) h = h*129 + (unsigned int)(*data++) + LH_PRIME;\n \n\treturn h;\n }\n", + "target": " unsigned long lh_char_hash(const void *k)\n {\n\tstatic volatile int random_seed = -1;\n\n\tif (random_seed == -1) {\n\t\tint seed;\n\t\t/* we can't use -1 as it is the unitialized sentinel */\n\t\twhile ((seed = json_c_get_random_seed()) == -1);\n#if defined __GNUC__\n\t\t__sync_val_compare_and_swap(&random_seed, -1, seed);\n#elif defined _MSC_VER\n\t\tInterlockedCompareExchange(&random_seed, seed, -1);\n#else\n#warning \"racy random seed initializtion if used by multiple threads\"\n\t\trandom_seed = seed; /* potentially racy */\n#endif\n\t}\n \n\treturn hashlittle((const char*)k, strlen((const char*)k), random_seed); \n }\n", + "vul_type": "cwe-310", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7394cf6f43d7a86630d3eb1c728fd63c621b5530", + "input": " TabManagerTest() : scoped_set_tick_clock_for_testing_(&test_clock_) {\n test_clock_.Advance(kShortDelay);\n }\n", + "target": " TabManagerTest() : scoped_set_tick_clock_for_testing_(&test_clock_) {\n test_clock_.Advance(kShortDelay);\n scoped_feature_list_.InitAndEnableFeature(\n features::kSiteCharacteristicsDatabase);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9e2dcf72023d1447f09c47d77c99b0c49659e5ce", + "input": "struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user)\n{\n\tstruct sk_buff *clone;\n\tstruct net_device *dev = skb->dev;\n\tstruct frag_hdr *fhdr;\n\tstruct nf_ct_frag6_queue *fq;\n\tstruct ipv6hdr *hdr;\n\tint fhoff, nhoff;\n\tu8 prevhdr;\n\tstruct sk_buff *ret_skb = NULL;\n\n\t/* Jumbo payload inhibits frag. header */\n\tif (ipv6_hdr(skb)->payload_len == 0) {\n\t\tpr_debug(\"payload len = 0\\n\");\n\t\treturn skb;\n\t}\n\n\tif (find_prev_fhdr(skb, &prevhdr, &nhoff, &fhoff) < 0)\n\t\treturn skb;\n\n\tclone = skb_clone(skb, GFP_ATOMIC);\n\tif (clone == NULL) {\n\t\tpr_debug(\"Can't clone skb\\n\");\n\t\treturn skb;\n\t}\n\n\tNFCT_FRAG6_CB(clone)->orig = skb;\n\n\tif (!pskb_may_pull(clone, fhoff + sizeof(*fhdr))) {\n\t\tpr_debug(\"message is too short.\\n\");\n\t\tgoto ret_orig;\n\t}\n\n\tskb_set_transport_header(clone, fhoff);\n \thdr = ipv6_hdr(clone);\n \tfhdr = (struct frag_hdr *)skb_transport_header(clone);\n \n\tif (!(fhdr->frag_off & htons(0xFFF9))) {\n\t\tpr_debug(\"Invalid fragment offset\\n\");\n\t\t/* It is not a fragmented frame */\n\t\tgoto ret_orig;\n\t}\n \tif (atomic_read(&nf_init_frags.mem) > nf_init_frags.high_thresh)\n \t\tnf_ct_frag6_evictor();\n \n\tfq = fq_find(fhdr->identification, user, &hdr->saddr, &hdr->daddr);\n\tif (fq == NULL) {\n\t\tpr_debug(\"Can't find and can't create new queue\\n\");\n\t\tgoto ret_orig;\n\t}\n\n\tspin_lock_bh(&fq->q.lock);\n\n\tif (nf_ct_frag6_queue(fq, clone, fhdr, nhoff) < 0) {\n\t\tspin_unlock_bh(&fq->q.lock);\n\t\tpr_debug(\"Can't insert skb to queue\\n\");\n\t\tfq_put(fq);\n\t\tgoto ret_orig;\n\t}\n\n\tif (fq->q.last_in == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&\n\t fq->q.meat == fq->q.len) {\n\t\tret_skb = nf_ct_frag6_reasm(fq, dev);\n\t\tif (ret_skb == NULL)\n\t\t\tpr_debug(\"Can't reassemble fragmented packets\\n\");\n\t}\n\tspin_unlock_bh(&fq->q.lock);\n\n\tfq_put(fq);\n\treturn ret_skb;\n\nret_orig:\n\tkfree_skb(clone);\n\treturn skb;\n}\n", + "target": "struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user)\n{\n\tstruct sk_buff *clone;\n\tstruct net_device *dev = skb->dev;\n\tstruct frag_hdr *fhdr;\n\tstruct nf_ct_frag6_queue *fq;\n\tstruct ipv6hdr *hdr;\n\tint fhoff, nhoff;\n\tu8 prevhdr;\n\tstruct sk_buff *ret_skb = NULL;\n\n\t/* Jumbo payload inhibits frag. header */\n\tif (ipv6_hdr(skb)->payload_len == 0) {\n\t\tpr_debug(\"payload len = 0\\n\");\n\t\treturn skb;\n\t}\n\n\tif (find_prev_fhdr(skb, &prevhdr, &nhoff, &fhoff) < 0)\n\t\treturn skb;\n\n\tclone = skb_clone(skb, GFP_ATOMIC);\n\tif (clone == NULL) {\n\t\tpr_debug(\"Can't clone skb\\n\");\n\t\treturn skb;\n\t}\n\n\tNFCT_FRAG6_CB(clone)->orig = skb;\n\n\tif (!pskb_may_pull(clone, fhoff + sizeof(*fhdr))) {\n\t\tpr_debug(\"message is too short.\\n\");\n\t\tgoto ret_orig;\n\t}\n\n\tskb_set_transport_header(clone, fhoff);\n \thdr = ipv6_hdr(clone);\n \tfhdr = (struct frag_hdr *)skb_transport_header(clone);\n \n \tif (atomic_read(&nf_init_frags.mem) > nf_init_frags.high_thresh)\n \t\tnf_ct_frag6_evictor();\n \n\tfq = fq_find(fhdr->identification, user, &hdr->saddr, &hdr->daddr);\n\tif (fq == NULL) {\n\t\tpr_debug(\"Can't find and can't create new queue\\n\");\n\t\tgoto ret_orig;\n\t}\n\n\tspin_lock_bh(&fq->q.lock);\n\n\tif (nf_ct_frag6_queue(fq, clone, fhdr, nhoff) < 0) {\n\t\tspin_unlock_bh(&fq->q.lock);\n\t\tpr_debug(\"Can't insert skb to queue\\n\");\n\t\tfq_put(fq);\n\t\tgoto ret_orig;\n\t}\n\n\tif (fq->q.last_in == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&\n\t fq->q.meat == fq->q.len) {\n\t\tret_skb = nf_ct_frag6_reasm(fq, dev);\n\t\tif (ret_skb == NULL)\n\t\t\tpr_debug(\"Can't reassemble fragmented packets\\n\");\n\t}\n\tspin_unlock_bh(&fq->q.lock);\n\n\tfq_put(fq);\n\treturn ret_skb;\n\nret_orig:\n\tkfree_skb(clone);\n\treturn skb;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ba1513223e47b62ed53b61518b7f7b82ad1d8ccd", + "input": " void ServerWrapper::OnHttpRequest(int connection_id,\n const net::HttpServerRequestInfo& info) {\n server_->SetSendBufferSize(connection_id, kSendBufferSizeForDevTools);\n \n if (base::StartsWith(info.path, \"/json\", base::CompareCase::SENSITIVE)) {\n BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,\n base::BindOnce(&DevToolsHttpHandler::OnJsonRequest,\n handler_, connection_id, info));\n return;\n }\n\n if (info.path.empty() || info.path == \"/\") {\n BrowserThread::PostTask(\n BrowserThread::UI, FROM_HERE,\n base::BindOnce(&DevToolsHttpHandler::OnDiscoveryPageRequest, handler_,\n connection_id));\n return;\n }\n\n if (!base::StartsWith(info.path, \"/devtools/\",\n base::CompareCase::SENSITIVE)) {\n server_->Send404(connection_id, kDevtoolsHttpHandlerTrafficAnnotation);\n return;\n }\n\n std::string filename = PathWithoutParams(info.path.substr(10));\n std::string mime_type = GetMimeType(filename);\n\n if (!debug_frontend_dir_.empty()) {\n base::FilePath path = debug_frontend_dir_.AppendASCII(filename);\n std::string data;\n base::ReadFileToString(path, &data);\n server_->Send200(connection_id, data, mime_type,\n kDevtoolsHttpHandlerTrafficAnnotation);\n return;\n }\n\n if (bundles_resources_) {\n BrowserThread::PostTask(\n BrowserThread::UI, FROM_HERE,\n base::BindOnce(&DevToolsHttpHandler::OnFrontendResourceRequest,\n handler_, connection_id, filename));\n return;\n }\n server_->Send404(connection_id, kDevtoolsHttpHandlerTrafficAnnotation);\n}\n", + "target": " void ServerWrapper::OnHttpRequest(int connection_id,\n const net::HttpServerRequestInfo& info) {\n if (!RequestIsSafeToServe(info)) {\n Send500(connection_id,\n \"Host header is specified and is not an IP address or localhost.\");\n return;\n }\n\n server_->SetSendBufferSize(connection_id, kSendBufferSizeForDevTools);\n \n if (base::StartsWith(info.path, \"/json\", base::CompareCase::SENSITIVE)) {\n BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,\n base::BindOnce(&DevToolsHttpHandler::OnJsonRequest,\n handler_, connection_id, info));\n return;\n }\n\n if (info.path.empty() || info.path == \"/\") {\n BrowserThread::PostTask(\n BrowserThread::UI, FROM_HERE,\n base::BindOnce(&DevToolsHttpHandler::OnDiscoveryPageRequest, handler_,\n connection_id));\n return;\n }\n\n if (!base::StartsWith(info.path, \"/devtools/\",\n base::CompareCase::SENSITIVE)) {\n server_->Send404(connection_id, kDevtoolsHttpHandlerTrafficAnnotation);\n return;\n }\n\n std::string filename = PathWithoutParams(info.path.substr(10));\n std::string mime_type = GetMimeType(filename);\n\n if (!debug_frontend_dir_.empty()) {\n base::FilePath path = debug_frontend_dir_.AppendASCII(filename);\n std::string data;\n base::ReadFileToString(path, &data);\n server_->Send200(connection_id, data, mime_type,\n kDevtoolsHttpHandlerTrafficAnnotation);\n return;\n }\n\n if (bundles_resources_) {\n BrowserThread::PostTask(\n BrowserThread::UI, FROM_HERE,\n base::BindOnce(&DevToolsHttpHandler::OnFrontendResourceRequest,\n handler_, connection_id, filename));\n return;\n }\n server_->Send404(connection_id, kDevtoolsHttpHandlerTrafficAnnotation);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#62b8b6e168a12263aab6b88dbef0b900cc37309f", + "input": "void PartialMagnificationController::CreateMagnifierWindow() {\n if (zoom_widget_)\n return;\n \n aura::Window* root_window = GetCurrentRootWindow();\n if (!root_window)\n return;\n \n root_window->AddObserver(this);\n \n gfx::Point mouse(\n root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot());\n \n zoom_widget_ = new views::Widget;\n views::Widget::InitParams params(\n views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);\n params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;\n params.accept_events = false;\n params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;\n params.parent = root_window;\n zoom_widget_->Init(params);\n zoom_widget_->SetBounds(gfx::Rect(mouse.x() - kMagnifierWidth / 2,\n mouse.y() - kMagnifierHeight / 2,\n kMagnifierWidth, kMagnifierHeight));\n zoom_widget_->set_focus_on_creation(false);\n zoom_widget_->Show();\n aura::Window* window = zoom_widget_->GetNativeView();\n window->SetName(kPartialMagniferWindowName);\n \n zoom_widget_->GetNativeView()->layer()->SetBounds(\n gfx::Rect(0, 0, kMagnifierWidth, kMagnifierHeight));\n zoom_widget_->GetNativeView()->layer()->SetBackgroundZoom(scale_, kZoomInset);\n \n zoom_widget_->AddObserver(this);\n }\n", + "target": "void PartialMagnificationController::CreateMagnifierWindow() {\n if (event->type() == ui::ET_MOUSE_PRESSED)\n SetActive(true);\n\n if (event->type() == ui::ET_MOUSE_RELEASED)\n SetActive(false);\n\n if (!is_active_)\n return;\n \n // If the previous root window was detached host_widget_ will be null;\n // reconstruct it. We also need to change the root window if the cursor has\n // crossed display boundries.\n SwitchTargetRootWindowIfNeeded(GetCurrentRootWindow());\n\n // If that failed for any reason return.\n if (!host_widget_) {\n SetActive(false);\n return;\n }\n\n gfx::Point point = event->root_location();\n\n // Remap point from where it was captured to the display it is actually on.\n aura::Window* target = static_cast(event->target());\n aura::Window* event_root = target->GetRootWindow();\n aura::Window::ConvertPointToTarget(\n event_root, host_widget_->GetNativeView()->GetRootWindow(), &point);\n\n host_widget_->SetBounds(GetBounds(point));\n\n event->StopPropagation();\n}\n\nvoid PartialMagnificationController::CreateMagnifierWindow(\n aura::Window* root_window) {\n if (host_widget_ || !root_window)\n return;\n \n root_window->AddObserver(this);\n \n gfx::Point mouse(\n root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot());\n \n host_widget_ = new views::Widget;\n views::Widget::InitParams params(\n views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);\n params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;\n params.accept_events = false;\n params.bounds = GetBounds(mouse);\n params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;\n params.parent = root_window;\n host_widget_->Init(params);\n host_widget_->set_focus_on_creation(false);\n host_widget_->Show();\n\n aura::Window* window = host_widget_->GetNativeView();\n window->SetName(kPartialMagniferWindowName);\n \n ui::Layer* root_layer = host_widget_->GetNativeView()->layer();\n\n zoom_layer_.reset(new ui::Layer(ui::LayerType::LAYER_SOLID_COLOR));\n zoom_layer_->SetBounds(gfx::Rect(GetWindowSize()));\n zoom_layer_->SetBackgroundZoom(kMagnificationScale, kZoomInset);\n root_layer->Add(zoom_layer_.get());\n\n border_layer_.reset(new ui::Layer(ui::LayerType::LAYER_SOLID_COLOR));\n border_layer_->SetBounds(gfx::Rect(GetWindowSize()));\n border_layer_->SetColor(SK_ColorWHITE);\n root_layer->Add(border_layer_.get());\n\n border_mask_.reset(new ContentMask(true, GetWindowSize()));\n border_layer_->SetMaskLayer(border_mask_->layer());\n \n zoom_mask_.reset(new ContentMask(false, GetWindowSize()));\n zoom_layer_->SetMaskLayer(zoom_mask_->layer());\n\n host_widget_->AddObserver(this);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#27c68f543e5eba779902447445dfb05ec3f5bf75", + "input": "bool Vp9FrameHeader::IsKeyframe() const {\n return !show_existing_frame && frame_type == KEYFRAME;\n}\n", + "target": "bool Vp9FrameHeader::IsKeyframe() const {\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ffab15eb80630dc799eb410855c93525b75233c3", + "input": " UWORD16 impeg2d_get_mb_addr_incr(stream_t *ps_stream)\n {\n UWORD16 u2_mb_addr_incr = 0;\n while (impeg2d_bit_stream_nxt(ps_stream,MB_ESCAPE_CODE_LEN) == MB_ESCAPE_CODE)\n {\n impeg2d_bit_stream_flush(ps_stream,MB_ESCAPE_CODE_LEN);\n u2_mb_addr_incr += 33;\n }\n u2_mb_addr_incr += impeg2d_dec_vld_symbol(ps_stream,gai2_impeg2d_mb_addr_incr,MB_ADDR_INCR_LEN) +\n MB_ADDR_INCR_OFFSET;\n return(u2_mb_addr_incr);\n}\n", + "target": " UWORD16 impeg2d_get_mb_addr_incr(stream_t *ps_stream)\n {\n UWORD16 u2_mb_addr_incr = 0;\n while (impeg2d_bit_stream_nxt(ps_stream,MB_ESCAPE_CODE_LEN) == MB_ESCAPE_CODE &&\n ps_stream->u4_offset < ps_stream->u4_max_offset)\n {\n impeg2d_bit_stream_flush(ps_stream,MB_ESCAPE_CODE_LEN);\n u2_mb_addr_incr += 33;\n }\n u2_mb_addr_incr += impeg2d_dec_vld_symbol(ps_stream,gai2_impeg2d_mb_addr_incr,MB_ADDR_INCR_LEN) +\n MB_ADDR_INCR_OFFSET;\n return(u2_mb_addr_incr);\n}\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#384632e67e0829deb8015ee6ad916b180049d252", + "input": "static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,\n\t\t\t\t\t struct userfaultfd_wait_queue *ewq)\n{\n\tif (WARN_ON_ONCE(current->flags & PF_EXITING))\n\t\tgoto out;\n\n\tewq->ctx = ctx;\n\tinit_waitqueue_entry(&ewq->wq, current);\n\n\tspin_lock(&ctx->event_wqh.lock);\n\t/*\n\t * After the __add_wait_queue the uwq is visible to userland\n\t * through poll/read().\n\t */\n\t__add_wait_queue(&ctx->event_wqh, &ewq->wq);\n\tfor (;;) {\n\t\tset_current_state(TASK_KILLABLE);\n\t\tif (ewq->msg.event == 0)\n \t\t\tbreak;\n \t\tif (ACCESS_ONCE(ctx->released) ||\n \t\t fatal_signal_pending(current)) {\n \t\t\t__remove_wait_queue(&ctx->event_wqh, &ewq->wq);\n \t\t\tif (ewq->msg.event == UFFD_EVENT_FORK) {\n \t\t\t\tstruct userfaultfd_ctx *new;\n\n\t\t\t\tnew = (struct userfaultfd_ctx *)\n\t\t\t\t\t(unsigned long)\n\t\t\t\t\tewq->msg.arg.reserved.reserved1;\n\n\t\t\t\tuserfaultfd_ctx_put(new);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tspin_unlock(&ctx->event_wqh.lock);\n\n\t\twake_up_poll(&ctx->fd_wqh, POLLIN);\n\t\tschedule();\n\n\t\tspin_lock(&ctx->event_wqh.lock);\n\t}\n\t__set_current_state(TASK_RUNNING);\n\tspin_unlock(&ctx->event_wqh.lock);\n\n\t/*\n\t * ctx may go away after this if the userfault pseudo fd is\n\t * already released.\n\t */\nout:\n\tuserfaultfd_ctx_put(ctx);\n}\n", + "target": "static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,\n\t\t\t\t\t struct userfaultfd_wait_queue *ewq)\n{\n\tif (WARN_ON_ONCE(current->flags & PF_EXITING))\n\t\tgoto out;\n\n\tewq->ctx = ctx;\n\tinit_waitqueue_entry(&ewq->wq, current);\n\n\tspin_lock(&ctx->event_wqh.lock);\n\t/*\n\t * After the __add_wait_queue the uwq is visible to userland\n\t * through poll/read().\n\t */\n\t__add_wait_queue(&ctx->event_wqh, &ewq->wq);\n\tfor (;;) {\n\t\tset_current_state(TASK_KILLABLE);\n\t\tif (ewq->msg.event == 0)\n \t\t\tbreak;\n \t\tif (ACCESS_ONCE(ctx->released) ||\n \t\t fatal_signal_pending(current)) {\n\t\t\t/*\n\t\t\t * &ewq->wq may be queued in fork_event, but\n\t\t\t * __remove_wait_queue ignores the head\n\t\t\t * parameter. It would be a problem if it\n\t\t\t * didn't.\n\t\t\t */\n \t\t\t__remove_wait_queue(&ctx->event_wqh, &ewq->wq);\n \t\t\tif (ewq->msg.event == UFFD_EVENT_FORK) {\n \t\t\t\tstruct userfaultfd_ctx *new;\n\n\t\t\t\tnew = (struct userfaultfd_ctx *)\n\t\t\t\t\t(unsigned long)\n\t\t\t\t\tewq->msg.arg.reserved.reserved1;\n\n\t\t\t\tuserfaultfd_ctx_put(new);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tspin_unlock(&ctx->event_wqh.lock);\n\n\t\twake_up_poll(&ctx->fd_wqh, POLLIN);\n\t\tschedule();\n\n\t\tspin_lock(&ctx->event_wqh.lock);\n\t}\n\t__set_current_state(TASK_RUNNING);\n\tspin_unlock(&ctx->event_wqh.lock);\n\n\t/*\n\t * ctx may go away after this if the userfault pseudo fd is\n\t * already released.\n\t */\nout:\n\tuserfaultfd_ctx_put(ctx);\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#262e77a72493e36e8006aeeba1c7497a42ee5ad9", + "input": "void VRDisplay::ProcessScheduledWindowAnimations(double timestamp) {\n TRACE_EVENT1(\"gpu\", \"VRDisplay::window.rAF\", \"frame\", vr_frame_id_);\n auto doc = navigator_vr_->GetDocument();\n if (!doc)\n return;\n auto page = doc->GetPage();\n if (!page)\n return;\n page->Animator().ServiceScriptedAnimations(timestamp);\n }\n", + "target": "void VRDisplay::ProcessScheduledWindowAnimations(double timestamp) {\n TRACE_EVENT1(\"gpu\", \"VRDisplay::window.rAF\", \"frame\", vr_frame_id_);\n auto doc = navigator_vr_->GetDocument();\n if (!doc)\n return;\n auto page = doc->GetPage();\n if (!page)\n return;\n\n bool had_pending_vrdisplay_raf = pending_vrdisplay_raf_;\n page->Animator().ServiceScriptedAnimations(timestamp);\n\n if (had_pending_vrdisplay_raf != pending_vrdisplay_raf_) {\n DVLOG(1) << __FUNCTION__\n << \": window.rAF fallback successfully scheduled VRDisplay.rAF\";\n }\n\n if (!pending_vrdisplay_raf_) {\n // There wasn't any call to vrDisplay.rAF, so we will not be getting new\n // frames from now on unless the application schedules one down the road in\n // reaction to a separate event or timeout. TODO(klausw,crbug.com/716087):\n // do something more useful here?\n DVLOG(1) << __FUNCTION__\n << \": no scheduled VRDisplay.requestAnimationFrame, presentation \"\n \"broken?\";\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": "void SubpelVarianceTest::RefTest() {\n for (int x = 0; x < 16; ++x) {\n for (int y = 0; y < 16; ++y) {\n for (int j = 0; j < block_size_; j++) {\n src_[j] = rnd.Rand8();\n sec_[j] = rnd.Rand8();\n }\n for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {\n ref_[j] = rnd.Rand8();\n }\n unsigned int sse1, sse2;\n unsigned int var1;\n REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y,\n src_, width_, &sse1, sec_));\n const unsigned int var2 = subpel_avg_variance_ref(ref_, src_, sec_,\n log2width_, log2height_,\n x, y, &sse2);\n EXPECT_EQ(sse1, sse2) << \"at position \" << x << \", \" << y;\n EXPECT_EQ(var1, var2) << \"at position \" << x << \", \" << y;\n }\n }\n }\n", + "target": "void SubpelVarianceTest::RefTest() {\nvoid SubpelVarianceTest::RefTest() {\n for (int x = 0; x < 8; ++x) {\n for (int y = 0; y < 8; ++y) {\n if (!use_high_bit_depth_) {\n for (int j = 0; j < block_size_; j++) {\n src_[j] = rnd_.Rand8();\n sec_[j] = rnd_.Rand8();\n }\n for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {\n ref_[j] = rnd_.Rand8();\n }\n#if CONFIG_VP9_HIGHBITDEPTH\n } else {\n for (int j = 0; j < block_size_; j++) {\n CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;\n CONVERT_TO_SHORTPTR(sec_)[j] = rnd_.Rand16() & mask_;\n }\n for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {\n CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;\n }\n#endif // CONFIG_VP9_HIGHBITDEPTH\n }\n unsigned int sse1, sse2;\n unsigned int var1;\n ASM_REGISTER_STATE_CHECK(\n var1 = subpel_variance_(ref_, width_ + 1, x, y,\n src_, width_, &sse1, sec_));\n const unsigned int var2 = subpel_avg_variance_ref(ref_, src_, sec_,\n log2width_, log2height_,\n x, y, &sse2,\n use_high_bit_depth_,\n bit_depth_);\n EXPECT_EQ(sse1, sse2) << \"at position \" << x << \", \" << y;\n EXPECT_EQ(var1, var2) << \"at position \" << x << \", \" << y;\n }\n }\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f084d7007f67809ef116ee6b11f251bf3c9ed895", + "input": "void ContainerNode::removeChildren()\n{\n if (!m_firstChild)\n return;\n\n RefPtr protect(this);\n\n if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExists(&document()))\n fullscreen->removeFullScreenElementOfSubtree(this, true);\n\n willRemoveChildren(protect.get());\n\n {\n SubframeLoadingDisabler disabler(this);\n\n document().removeFocusedElementOfSubtree(this, true);\n }\n \n NodeVector removedChildren;\n {\n RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates;\n {\n NoEventDispatchAssertion assertNoEventDispatch;\n removedChildren.reserveInitialCapacity(childNodeCount());\n while (m_firstChild) {\n removedChildren.append(m_firstChild);\n removeBetween(0, m_firstChild->nextSibling(), m_firstChild);\n }\n }\n\n childrenChanged(false, 0, 0, -static_cast(removedChildren.size()));\n\n for (size_t i = 0; i < removedChildren.size(); ++i)\n ChildNodeRemovalNotifier(this).notify(removedChildren[i].get());\n }\n\n dispatchSubtreeModifiedEvent();\n}\n", + "target": "void ContainerNode::removeChildren()\n{\n if (!m_firstChild)\n return;\n\n RefPtr protect(this);\n\n if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExists(&document()))\n fullscreen->removeFullScreenElementOfSubtree(this, true);\n\n willRemoveChildren(protect.get());\n\n {\n SubframeLoadingDisabler disabler(this);\n\n document().removeFocusedElementOfSubtree(this, true);\n }\n \n document().nodeChildrenWillBeRemoved(this);\n\n NodeVector removedChildren;\n {\n RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates;\n {\n NoEventDispatchAssertion assertNoEventDispatch;\n removedChildren.reserveInitialCapacity(childNodeCount());\n while (m_firstChild) {\n removedChildren.append(m_firstChild);\n removeBetween(0, m_firstChild->nextSibling(), m_firstChild);\n }\n }\n\n childrenChanged(false, 0, 0, -static_cast(removedChildren.size()));\n\n for (size_t i = 0; i < removedChildren.size(); ++i)\n ChildNodeRemovalNotifier(this).notify(removedChildren[i].get());\n }\n\n dispatchSubtreeModifiedEvent();\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#863d37ea66d5c960db08d6f4a2cbd2518f0f80d1", + "input": "void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)\n{\n\tint lastBorder;\n\t/* Seek left */\n \tint leftLimit = -1, rightLimit;\n \tint i, restoreAlphaBlending = 0;\n \n\tif (border < 0) {\n \t\t/* Refuse to fill to a non-solid border */\n \t\treturn;\n \t}\n\n\tif (!im->trueColor) {\n\t\tif ((color > (im->colorsTotal - 1)) || (border > (im->colorsTotal - 1)) || (color < 0)) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\trestoreAlphaBlending = im->alphaBlendingFlag;\n\tim->alphaBlendingFlag = 0;\n\n\tif (x >= im->sx) {\n\t\tx = im->sx - 1;\n\t} else if (x < 0) {\n\t\tx = 0;\n\t}\n\tif (y >= im->sy) {\n\t\ty = im->sy - 1;\n\t} else if (y < 0) {\n\t\ty = 0;\n\t}\n\n\tfor (i = x; i >= 0; i--) {\n\t\tif (gdImageGetPixel(im, i, y) == border) {\n\t\t\tbreak;\n\t\t}\n\t\tgdImageSetPixel(im, i, y, color);\n\t\tleftLimit = i;\n\t}\n\tif (leftLimit == -1) {\n\t\tim->alphaBlendingFlag = restoreAlphaBlending;\n\t\treturn;\n\t}\n\t/* Seek right */\n\trightLimit = x;\n\tfor (i = (x + 1); i < im->sx; i++) {\n\t\tif (gdImageGetPixel(im, i, y) == border) {\n\t\t\tbreak;\n\t\t}\n\t\tgdImageSetPixel(im, i, y, color);\n\t\trightLimit = i;\n\t}\n\t/* Look at lines above and below and start paints */\n\t/* Above */\n\tif (y > 0) {\n\t\tlastBorder = 1;\n\t\tfor (i = leftLimit; i <= rightLimit; i++) {\n\t\t\tint c = gdImageGetPixel(im, i, y - 1);\n\t\t\tif (lastBorder) {\n\t\t\t\tif ((c != border) && (c != color)) {\n\t\t\t\t\tgdImageFillToBorder(im, i, y - 1, border, color);\n\t\t\t\t\tlastBorder = 0;\n\t\t\t\t}\n\t\t\t} else if ((c == border) || (c == color)) {\n\t\t\t\tlastBorder = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Below */\n\tif (y < ((im->sy) - 1)) {\n\t\tlastBorder = 1;\n\t\tfor (i = leftLimit; i <= rightLimit; i++) {\n\t\t\tint c = gdImageGetPixel(im, i, y + 1);\n\n\t\t\tif (lastBorder) {\n\t\t\t\tif ((c != border) && (c != color)) {\n\t\t\t\t\tgdImageFillToBorder(im, i, y + 1, border, color);\n\t\t\t\t\tlastBorder = 0;\n\t\t\t\t}\n\t\t\t} else if ((c == border) || (c == color)) {\n\t\t\t\tlastBorder = 1;\n\t\t\t}\n\t\t}\n\t}\n\tim->alphaBlendingFlag = restoreAlphaBlending;\n}\n", + "target": "void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)\n{\n\tint lastBorder;\n\t/* Seek left */\n \tint leftLimit = -1, rightLimit;\n \tint i, restoreAlphaBlending = 0;\n \n\tif (border < 0 || color < 0) {\n \t\t/* Refuse to fill to a non-solid border */\n \t\treturn;\n \t}\n\n\tif (!im->trueColor) {\n\t\tif ((color > (im->colorsTotal - 1)) || (border > (im->colorsTotal - 1)) || (color < 0)) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\trestoreAlphaBlending = im->alphaBlendingFlag;\n\tim->alphaBlendingFlag = 0;\n\n\tif (x >= im->sx) {\n\t\tx = im->sx - 1;\n\t} else if (x < 0) {\n\t\tx = 0;\n\t}\n\tif (y >= im->sy) {\n\t\ty = im->sy - 1;\n\t} else if (y < 0) {\n\t\ty = 0;\n\t}\n\n\tfor (i = x; i >= 0; i--) {\n\t\tif (gdImageGetPixel(im, i, y) == border) {\n\t\t\tbreak;\n\t\t}\n\t\tgdImageSetPixel(im, i, y, color);\n\t\tleftLimit = i;\n\t}\n\tif (leftLimit == -1) {\n\t\tim->alphaBlendingFlag = restoreAlphaBlending;\n\t\treturn;\n\t}\n\t/* Seek right */\n\trightLimit = x;\n\tfor (i = (x + 1); i < im->sx; i++) {\n\t\tif (gdImageGetPixel(im, i, y) == border) {\n\t\t\tbreak;\n\t\t}\n\t\tgdImageSetPixel(im, i, y, color);\n\t\trightLimit = i;\n\t}\n\t/* Look at lines above and below and start paints */\n\t/* Above */\n\tif (y > 0) {\n\t\tlastBorder = 1;\n\t\tfor (i = leftLimit; i <= rightLimit; i++) {\n\t\t\tint c = gdImageGetPixel(im, i, y - 1);\n\t\t\tif (lastBorder) {\n\t\t\t\tif ((c != border) && (c != color)) {\n\t\t\t\t\tgdImageFillToBorder(im, i, y - 1, border, color);\n\t\t\t\t\tlastBorder = 0;\n\t\t\t\t}\n\t\t\t} else if ((c == border) || (c == color)) {\n\t\t\t\tlastBorder = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Below */\n\tif (y < ((im->sy) - 1)) {\n\t\tlastBorder = 1;\n\t\tfor (i = leftLimit; i <= rightLimit; i++) {\n\t\t\tint c = gdImageGetPixel(im, i, y + 1);\n\n\t\t\tif (lastBorder) {\n\t\t\t\tif ((c != border) && (c != color)) {\n\t\t\t\t\tgdImageFillToBorder(im, i, y + 1, border, color);\n\t\t\t\t\tlastBorder = 0;\n\t\t\t\t}\n\t\t\t} else if ((c == border) || (c == color)) {\n\t\t\t\tlastBorder = 1;\n\t\t\t}\n\t\t}\n\t}\n\tim->alphaBlendingFlag = restoreAlphaBlending;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8275cdd0e7ac550dcce2b3ef6d2fb3b808c1ae59", + "input": "xfs_attr3_leaf_getvalue(\n\tstruct xfs_buf\t\t*bp,\n\tstruct xfs_da_args\t*args)\n{\n\tstruct xfs_attr_leafblock *leaf;\n\tstruct xfs_attr3_icleaf_hdr ichdr;\n\tstruct xfs_attr_leaf_entry *entry;\n\tstruct xfs_attr_leaf_name_local *name_loc;\n\tstruct xfs_attr_leaf_name_remote *name_rmt;\n\tint\t\t\tvaluelen;\n\n\tleaf = bp->b_addr;\n\txfs_attr3_leaf_hdr_from_disk(&ichdr, leaf);\n\tASSERT(ichdr.count < XFS_LBSIZE(args->dp->i_mount) / 8);\n\tASSERT(args->index < ichdr.count);\n\n\tentry = &xfs_attr3_leaf_entryp(leaf)[args->index];\n\tif (entry->flags & XFS_ATTR_LOCAL) {\n\t\tname_loc = xfs_attr3_leaf_name_local(leaf, args->index);\n\t\tASSERT(name_loc->namelen == args->namelen);\n\t\tASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0);\n\t\tvaluelen = be16_to_cpu(name_loc->valuelen);\n\t\tif (args->flags & ATTR_KERNOVAL) {\n\t\t\targs->valuelen = valuelen;\n\t\t\treturn 0;\n\t\t}\n\t\tif (args->valuelen < valuelen) {\n\t\t\targs->valuelen = valuelen;\n\t\t\treturn XFS_ERROR(ERANGE);\n\t\t}\n\t\targs->valuelen = valuelen;\n\t\tmemcpy(args->value, &name_loc->nameval[args->namelen], valuelen);\n\t} else {\n \t\tname_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);\n \t\tASSERT(name_rmt->namelen == args->namelen);\n \t\tASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0);\n\t\tvaluelen = be32_to_cpu(name_rmt->valuelen);\n \t\targs->rmtblkno = be32_to_cpu(name_rmt->valueblk);\n \t\targs->rmtblkcnt = xfs_attr3_rmt_blocks(args->dp->i_mount,\n\t\t\t\t\t\t valuelen);\n \t\tif (args->flags & ATTR_KERNOVAL) {\n\t\t\targs->valuelen = valuelen;\n \t\t\treturn 0;\n \t\t}\n\t\tif (args->valuelen < valuelen) {\n\t\t\targs->valuelen = valuelen;\n \t\t\treturn XFS_ERROR(ERANGE);\n \t\t}\n\t\targs->valuelen = valuelen;\n \t}\n \treturn 0;\n }\n", + "target": "xfs_attr3_leaf_getvalue(\n\tstruct xfs_buf\t\t*bp,\n\tstruct xfs_da_args\t*args)\n{\n\tstruct xfs_attr_leafblock *leaf;\n\tstruct xfs_attr3_icleaf_hdr ichdr;\n\tstruct xfs_attr_leaf_entry *entry;\n\tstruct xfs_attr_leaf_name_local *name_loc;\n\tstruct xfs_attr_leaf_name_remote *name_rmt;\n\tint\t\t\tvaluelen;\n\n\tleaf = bp->b_addr;\n\txfs_attr3_leaf_hdr_from_disk(&ichdr, leaf);\n\tASSERT(ichdr.count < XFS_LBSIZE(args->dp->i_mount) / 8);\n\tASSERT(args->index < ichdr.count);\n\n\tentry = &xfs_attr3_leaf_entryp(leaf)[args->index];\n\tif (entry->flags & XFS_ATTR_LOCAL) {\n\t\tname_loc = xfs_attr3_leaf_name_local(leaf, args->index);\n\t\tASSERT(name_loc->namelen == args->namelen);\n\t\tASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0);\n\t\tvaluelen = be16_to_cpu(name_loc->valuelen);\n\t\tif (args->flags & ATTR_KERNOVAL) {\n\t\t\targs->valuelen = valuelen;\n\t\t\treturn 0;\n\t\t}\n\t\tif (args->valuelen < valuelen) {\n\t\t\targs->valuelen = valuelen;\n\t\t\treturn XFS_ERROR(ERANGE);\n\t\t}\n\t\targs->valuelen = valuelen;\n\t\tmemcpy(args->value, &name_loc->nameval[args->namelen], valuelen);\n\t} else {\n \t\tname_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);\n \t\tASSERT(name_rmt->namelen == args->namelen);\n \t\tASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0);\n\t\targs->rmtvaluelen = be32_to_cpu(name_rmt->valuelen);\n \t\targs->rmtblkno = be32_to_cpu(name_rmt->valueblk);\n \t\targs->rmtblkcnt = xfs_attr3_rmt_blocks(args->dp->i_mount,\n\t\t\t\t\t\t args->rmtvaluelen);\n \t\tif (args->flags & ATTR_KERNOVAL) {\n\t\t\targs->valuelen = args->rmtvaluelen;\n \t\t\treturn 0;\n \t\t}\n\t\tif (args->valuelen < args->rmtvaluelen) {\n\t\t\targs->valuelen = args->rmtvaluelen;\n \t\t\treturn XFS_ERROR(ERANGE);\n \t\t}\n\t\targs->valuelen = args->rmtvaluelen;\n \t}\n \treturn 0;\n }\n", + "vul_type": "cwe-19", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long long AudioTrack::GetBitDepth() const\n{\n return m_bitDepth;\n}\n", + "target": "long long AudioTrack::GetBitDepth() const\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6ec82562ffc6f297d0de36d65776cff8e5704867", + "input": "static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)\n{\n\tstruct net_device *rcv = NULL;\n\tstruct veth_priv *priv, *rcv_priv;\n\tstruct veth_net_stats *stats, *rcv_stats;\n\tint length;\n\n\tpriv = netdev_priv(dev);\n\trcv = priv->peer;\n\trcv_priv = netdev_priv(rcv);\n\n\tstats = this_cpu_ptr(priv->stats);\n\trcv_stats = this_cpu_ptr(rcv_priv->stats);\n\n\tif (!(rcv->flags & IFF_UP))\n\t\tgoto tx_drop;\n\n\tif (dev->features & NETIF_F_NO_CSUM)\n\t\tskb->ip_summed = rcv_priv->ip_summed;\n\n\tlength = skb->len + ETH_HLEN;\n\tif (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS)\n\t\tgoto rx_drop;\n\n\tstats->tx_bytes += length;\n\tstats->tx_packets++;\n\n\trcv_stats->rx_bytes += length;\n\trcv_stats->rx_packets++;\n\n\treturn NETDEV_TX_OK;\n\ntx_drop:\n\tkfree_skb(skb);\n\tstats->tx_dropped++;\n \treturn NETDEV_TX_OK;\n \n rx_drop:\n\tkfree_skb(skb);\n \trcv_stats->rx_dropped++;\n \treturn NETDEV_TX_OK;\n }\n", + "target": "static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)\n{\n\tstruct net_device *rcv = NULL;\n\tstruct veth_priv *priv, *rcv_priv;\n\tstruct veth_net_stats *stats, *rcv_stats;\n\tint length;\n\n\tpriv = netdev_priv(dev);\n\trcv = priv->peer;\n\trcv_priv = netdev_priv(rcv);\n\n\tstats = this_cpu_ptr(priv->stats);\n\trcv_stats = this_cpu_ptr(rcv_priv->stats);\n\n\tif (!(rcv->flags & IFF_UP))\n\t\tgoto tx_drop;\n\n\tif (dev->features & NETIF_F_NO_CSUM)\n\t\tskb->ip_summed = rcv_priv->ip_summed;\n\n\tlength = skb->len + ETH_HLEN;\n\tif (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS)\n\t\tgoto rx_drop;\n\n\tstats->tx_bytes += length;\n\tstats->tx_packets++;\n\n\trcv_stats->rx_bytes += length;\n\trcv_stats->rx_packets++;\n\n\treturn NETDEV_TX_OK;\n\ntx_drop:\n\tkfree_skb(skb);\n\tstats->tx_dropped++;\n \treturn NETDEV_TX_OK;\n \n rx_drop:\n \trcv_stats->rx_dropped++;\n \treturn NETDEV_TX_OK;\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#27c68f543e5eba779902447445dfb05ec3f5bf75", + "input": "bool Vp9Parser::ParseSuperframe() {\n const uint8_t* stream = stream_;\n off_t bytes_left = bytes_left_;\n DCHECK(frames_.empty());\n stream_ = nullptr;\n bytes_left_ = 0;\n if (bytes_left < 1)\n return false;\n uint8_t marker = *(stream + bytes_left - 1);\n if ((marker & 0xe0) != 0xc0) {\n frames_.push_back(FrameInfo(stream, bytes_left));\n return true;\n }\n DVLOG(1) << \"Parsing a superframe\";\n size_t num_frames = (marker & 0x7) + 1;\n size_t mag = ((marker >> 3) & 0x3) + 1;\n off_t index_size = 2 + mag * num_frames;\n \n if (bytes_left < index_size)\n return false;\n \n const uint8_t* index_ptr = stream + bytes_left - index_size;\n if (marker != *index_ptr)\n return false;\n ++index_ptr;\n bytes_left -= index_size;\n for (size_t i = 0; i < num_frames; ++i) {\n uint32_t size = 0;\n for (size_t j = 0; j < mag; ++j) {\n size |= *index_ptr << (j * 8);\n ++index_ptr;\n }\n if (base::checked_cast(size) > bytes_left) {\n DVLOG(1) << \"Not enough data in the buffer for frame \" << i;\n return false;\n }\n frames_.push_back(FrameInfo(stream, size));\n stream += size;\n bytes_left -= size;\n DVLOG(1) << \"Frame \" << i << \", size: \" << size;\n }\n \n return true;\n }\n", + "target": "bool Vp9Parser::ParseSuperframe() {\n \n if (!ParseUncompressedHeader(fhdr))\n return false;\n \n UpdateSlots(fhdr);\n \n return true;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#511d0a0a31a54e0cc0f15cb1b977dc9f9b20f0d3", + "input": "net::WebSocket* WebSocketExperimentTask::Context::CreateWebSocket(\n const Config& config, net::WebSocketDelegate* delegate) {\n URLRequestContextGetter* getter =\n Profile::GetDefaultRequestContext();\n if (!getter)\n return NULL;\n net::WebSocket::Request* request(\n new net::WebSocket::Request(config.url,\n config.ws_protocol,\n config.ws_origin,\n config.ws_location,\n getter->GetURLRequestContext()));\n return new net::WebSocket(request, delegate);\n }\n", + "target": "net::WebSocket* WebSocketExperimentTask::Context::CreateWebSocket(\n const Config& config, net::WebSocketDelegate* delegate) {\n URLRequestContextGetter* getter =\n Profile::GetDefaultRequestContext();\n if (!getter)\n return NULL;\n net::WebSocket::Request* request(\n new net::WebSocket::Request(config.url,\n config.ws_protocol,\n config.ws_origin,\n config.ws_location,\n net::WebSocket::DRAFT75,\n getter->GetURLRequestContext()));\n return new net::WebSocket(request, delegate);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#51dfe5e3b332bcea02fb4d4c7493ae841106dd9b", + "input": "double PulseAudioMixer::GetVolumeDb() const {\n if (!MainloopLockIfReady())\n return pa_sw_volume_to_dB(0); // this returns -inf.\n AudioInfo data;\n GetAudioInfo(&data);\n MainloopUnlock();\n return pa_sw_volume_to_dB(data.cvolume.values[0]);\n }\n", + "target": "double PulseAudioMixer::GetVolumeDb() const {\ndouble AudioMixerPulse::GetVolumeDb() const {\n if (!MainloopLockIfReady())\n return AudioMixer::kSilenceDb;\n AudioInfo data;\n GetAudioInfo(&data);\n MainloopUnlock();\n return pa_sw_volume_to_dB(data.cvolume.values[0]);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5c437bcc7a51edbef45242c5173cf7871fde2866", + "input": "bool WebRequestPermissions::CanExtensionAccessURL(\n const extensions::InfoMap* extension_info_map,\n const std::string& extension_id,\n const GURL& url,\n bool crosses_incognito,\n HostPermissionsCheck host_permissions_check) {\n if (!extension_info_map)\n return true;\n\n const extensions::Extension* extension =\n extension_info_map->extensions().GetByID(extension_id);\n if (!extension)\n return false;\n\n if (crosses_incognito && !extension_info_map->CanCrossIncognito(extension))\n return false;\n\n switch (host_permissions_check) {\n case DO_NOT_CHECK_HOST:\n break;\n case REQUIRE_HOST_PERMISSION:\n if (!((url.SchemeIs(url::kAboutScheme) ||\n extension->permissions_data()->HasHostPermission(url) ||\n url.GetOrigin() == extension->url()))) {\n return false;\n }\n break;\n case REQUIRE_ALL_URLS:\n if (!extension->permissions_data()->HasEffectiveAccessToAllHosts())\n return false;\n break;\n }\n\n return true;\n}\n", + "target": "bool WebRequestPermissions::CanExtensionAccessURL(\n const extensions::InfoMap* extension_info_map,\n const std::string& extension_id,\n const GURL& url,\n bool crosses_incognito,\n HostPermissionsCheck host_permissions_check) {\n if (!extension_info_map)\n return true;\n\n const extensions::Extension* extension =\n extension_info_map->extensions().GetByID(extension_id);\n if (!extension)\n return false;\n\n if (crosses_incognito && !extension_info_map->CanCrossIncognito(extension))\n return false;\n\n switch (host_permissions_check) {\n case DO_NOT_CHECK_HOST:\n break;\n case REQUIRE_HOST_PERMISSION:\n if (!url.SchemeIs(url::kAboutScheme) &&\n !extension->permissions_data()->HasHostPermission(url) &&\n !url::IsSameOriginWith(url, extension->url())) {\n return false;\n }\n break;\n case REQUIRE_ALL_URLS:\n if (!extension->permissions_data()->HasEffectiveAccessToAllHosts())\n return false;\n break;\n }\n\n return true;\n}\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#877b66b398518d9501513e0860c9f3a8acc70892", + "input": " beep_print(netdissect_options *ndo, const u_char *bp, u_int length)\n {\n \n\tif (l_strnstart(\"MSG\", 4, (const char *)bp, length)) /* A REQuest */\n \t\tND_PRINT((ndo, \" BEEP MSG\"));\n\telse if (l_strnstart(\"RPY \", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP RPY\"));\n\telse if (l_strnstart(\"ERR \", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP ERR\"));\n\telse if (l_strnstart(\"ANS \", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP ANS\"));\n\telse if (l_strnstart(\"NUL \", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP NUL\"));\n\telse if (l_strnstart(\"SEQ \", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP SEQ\"));\n\telse if (l_strnstart(\"END\", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP END\"));\n \telse\n \t\tND_PRINT((ndo, \" BEEP (payload or undecoded)\"));\n}\n", + "target": " beep_print(netdissect_options *ndo, const u_char *bp, u_int length)\n {\n \n\tif (l_strnstart(ndo, \"MSG\", 4, (const char *)bp, length)) /* A REQuest */\n \t\tND_PRINT((ndo, \" BEEP MSG\"));\n\telse if (l_strnstart(ndo, \"RPY \", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP RPY\"));\n\telse if (l_strnstart(ndo, \"ERR \", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP ERR\"));\n\telse if (l_strnstart(ndo, \"ANS \", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP ANS\"));\n\telse if (l_strnstart(ndo, \"NUL \", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP NUL\"));\n\telse if (l_strnstart(ndo, \"SEQ \", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP SEQ\"));\n\telse if (l_strnstart(ndo, \"END\", 4, (const char *)bp, length))\n \t\tND_PRINT((ndo, \" BEEP END\"));\n \telse\n \t\tND_PRINT((ndo, \" BEEP (payload or undecoded)\"));\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cd0bd79d6ebdb72183e6f0833673464cc10b3600", + "input": " PluginChannel::PluginChannel()\n : renderer_handle_(0),\n renderer_id_(-1),\n in_send_(0),\n incognito_(false),\n filter_(new MessageFilter()) {\n set_send_unblocking_only_during_unblock_dispatch();\n ChildProcess::current()->AddRefProcess();\n const CommandLine* command_line = CommandLine::ForCurrentProcess();\n log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);\n }\n", + "target": " PluginChannel::PluginChannel()\n : renderer_id_(-1),\n in_send_(0),\n incognito_(false),\n filter_(new MessageFilter()) {\n set_send_unblocking_only_during_unblock_dispatch();\n ChildProcess::current()->AddRefProcess();\n const CommandLine* command_line = CommandLine::ForCurrentProcess();\n log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#17d68b763f09a9ce824ae23eb62c9efc57b69271", + "input": " static void recalculate_apic_map(struct kvm *kvm)\n {\n \tstruct kvm_apic_map *new, *old = NULL;\n\tstruct kvm_vcpu *vcpu;\n\tint i;\n\n\tnew = kzalloc(sizeof(struct kvm_apic_map), GFP_KERNEL);\n\n\tmutex_lock(&kvm->arch.apic_map_lock);\n\n\tif (!new)\n\t\tgoto out;\n\n\tnew->ldr_bits = 8;\n\t/* flat mode is default */\n\tnew->cid_shift = 8;\n\tnew->cid_mask = 0;\n\tnew->lid_mask = 0xff;\n\n\tkvm_for_each_vcpu(i, vcpu, kvm) {\n\t\tstruct kvm_lapic *apic = vcpu->arch.apic;\n\t\tu16 cid, lid;\n\t\tu32 ldr;\n\n\t\tif (!kvm_apic_present(vcpu))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * All APICs have to be configured in the same mode by an OS.\n\t\t * We take advatage of this while building logical id loockup\n\t\t * table. After reset APICs are in xapic/flat mode, so if we\n\t\t * find apic with different setting we assume this is the mode\n\t\t * OS wants all apics to be in; build lookup table accordingly.\n\t\t */\n \t\tif (apic_x2apic_mode(apic)) {\n \t\t\tnew->ldr_bits = 32;\n \t\t\tnew->cid_shift = 16;\n\t\t\tnew->cid_mask = new->lid_mask = 0xffff;\n \t\t} else if (kvm_apic_sw_enabled(apic) &&\n \t\t\t\t!new->cid_mask /* flat mode */ &&\n \t\t\t\tkvm_apic_get_reg(apic, APIC_DFR) == APIC_DFR_CLUSTER) {\n\t\t\tnew->cid_shift = 4;\n\t\t\tnew->cid_mask = 0xf;\n\t\t\tnew->lid_mask = 0xf;\n\t\t}\n\n\t\tnew->phys_map[kvm_apic_id(apic)] = apic;\n\n\t\tldr = kvm_apic_get_reg(apic, APIC_LDR);\n\t\tcid = apic_cluster_id(new, ldr);\n\t\tlid = apic_logical_id(new, ldr);\n\n\t\tif (lid)\n\t\t\tnew->logical_map[cid][ffs(lid) - 1] = apic;\n\t}\nout:\n\told = rcu_dereference_protected(kvm->arch.apic_map,\n\t\t\tlockdep_is_held(&kvm->arch.apic_map_lock));\n\trcu_assign_pointer(kvm->arch.apic_map, new);\n\tmutex_unlock(&kvm->arch.apic_map_lock);\n\n\tif (old)\n\t\tkfree_rcu(old, rcu);\n\n\tkvm_vcpu_request_scan_ioapic(kvm);\n}\n", + "target": " static void recalculate_apic_map(struct kvm *kvm)\n {\n \tstruct kvm_apic_map *new, *old = NULL;\n\tstruct kvm_vcpu *vcpu;\n\tint i;\n\n\tnew = kzalloc(sizeof(struct kvm_apic_map), GFP_KERNEL);\n\n\tmutex_lock(&kvm->arch.apic_map_lock);\n\n\tif (!new)\n\t\tgoto out;\n\n\tnew->ldr_bits = 8;\n\t/* flat mode is default */\n\tnew->cid_shift = 8;\n\tnew->cid_mask = 0;\n\tnew->lid_mask = 0xff;\n\n\tkvm_for_each_vcpu(i, vcpu, kvm) {\n\t\tstruct kvm_lapic *apic = vcpu->arch.apic;\n\t\tu16 cid, lid;\n\t\tu32 ldr;\n\n\t\tif (!kvm_apic_present(vcpu))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * All APICs have to be configured in the same mode by an OS.\n\t\t * We take advatage of this while building logical id loockup\n\t\t * table. After reset APICs are in xapic/flat mode, so if we\n\t\t * find apic with different setting we assume this is the mode\n\t\t * OS wants all apics to be in; build lookup table accordingly.\n\t\t */\n \t\tif (apic_x2apic_mode(apic)) {\n \t\t\tnew->ldr_bits = 32;\n \t\t\tnew->cid_shift = 16;\n\t\t\tnew->cid_mask = (1 << KVM_X2APIC_CID_BITS) - 1;\n\t\t\tnew->lid_mask = 0xffff;\n \t\t} else if (kvm_apic_sw_enabled(apic) &&\n \t\t\t\t!new->cid_mask /* flat mode */ &&\n \t\t\t\tkvm_apic_get_reg(apic, APIC_DFR) == APIC_DFR_CLUSTER) {\n\t\t\tnew->cid_shift = 4;\n\t\t\tnew->cid_mask = 0xf;\n\t\t\tnew->lid_mask = 0xf;\n\t\t}\n\n\t\tnew->phys_map[kvm_apic_id(apic)] = apic;\n\n\t\tldr = kvm_apic_get_reg(apic, APIC_LDR);\n\t\tcid = apic_cluster_id(new, ldr);\n\t\tlid = apic_logical_id(new, ldr);\n\n\t\tif (lid)\n\t\t\tnew->logical_map[cid][ffs(lid) - 1] = apic;\n\t}\nout:\n\told = rcu_dereference_protected(kvm->arch.apic_map,\n\t\t\tlockdep_is_held(&kvm->arch.apic_map_lock));\n\trcu_assign_pointer(kvm->arch.apic_map, new);\n\tmutex_unlock(&kvm->arch.apic_map_lock);\n\n\tif (old)\n\t\tkfree_rcu(old, rcu);\n\n\tkvm_vcpu_request_scan_ioapic(kvm);\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long Track::Create(\n Segment* pSegment,\n const Info& info,\n long long element_start,\n long long element_size,\n Track*& pResult)\n{\n if (pResult)\n return -1;\n \n Track* const pTrack = new (std::nothrow) Track(pSegment,\n element_start,\n element_size);\n \n if (pTrack == NULL)\n return -1; //generic error\n \n const int status = info.Copy(pTrack->m_info);\n \n if (status) // error\n {\n delete pTrack;\n return status;\n }\n \n pResult = pTrack;\n return 0; //success\n }\n", + "target": "long Track::Create(\nTrack::Info::Info()\n : uid(0),\n defaultDuration(0),\n codecDelay(0),\n seekPreRoll(0),\n nameAsUTF8(NULL),\n language(NULL),\n codecId(NULL),\n codecNameAsUTF8(NULL),\n codecPrivate(NULL),\n codecPrivateSize(0),\n lacing(false) {}\n \nTrack::Info::~Info() { Clear(); }\n \nvoid Track::Info::Clear() {\n delete[] nameAsUTF8;\n nameAsUTF8 = NULL;\n \n delete[] language;\n language = NULL;\n \n delete[] codecId;\n codecId = NULL;\n \n delete[] codecPrivate;\n codecPrivate = NULL;\n codecPrivateSize = 0;\n\n delete[] codecNameAsUTF8;\n codecNameAsUTF8 = NULL;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#673ce95d481ea9368c4d4d43ac756ba1d6d9e608", + "input": " shared_memory_handle(const gfx::GpuMemoryBufferHandle& handle) {\n if (handle.type != gfx::SHARED_MEMORY_BUFFER &&\n handle.type != gfx::DXGI_SHARED_HANDLE &&\n handle.type != gfx::ANDROID_HARDWARE_BUFFER)\n return mojo::ScopedSharedBufferHandle();\n return mojo::WrapSharedMemoryHandle(handle.handle, handle.handle.GetSize(),\n false);\n }\n", + "target": " shared_memory_handle(const gfx::GpuMemoryBufferHandle& handle) {\n if (handle.type != gfx::SHARED_MEMORY_BUFFER &&\n handle.type != gfx::DXGI_SHARED_HANDLE &&\n handle.type != gfx::ANDROID_HARDWARE_BUFFER)\n return mojo::ScopedSharedBufferHandle();\n return mojo::WrapSharedMemoryHandle(\n handle.handle, handle.handle.GetSize(),\n mojo::UnwrappedSharedMemoryHandleProtection::kReadWrite);\n }\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#530d50a1abdcdf4d1775652d4c456c1274d83d8d", + "input": "static bool decode_openldap_dereference(void *mem_ctx, DATA_BLOB in, void *_out)\n{\n\tvoid **out = (void **)_out;\n\tstruct asn1_data *data = asn1_init(mem_ctx);\n\tstruct dsdb_openldap_dereference_result_control *control;\n\tstruct dsdb_openldap_dereference_result **r = NULL;\n\tint i = 0;\n\tif (!data) return false;\n\n\tcontrol = talloc(mem_ctx, struct dsdb_openldap_dereference_result_control);\n\tif (!control) return false;\n\n\tif (!asn1_load(data, in)) {\n\t\treturn false;\n\t}\n\n\tcontrol = talloc(mem_ctx, struct dsdb_openldap_dereference_result_control);\n\tif (!control) {\n\t\treturn false;\n\t}\n\n\tif (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {\n\t\treturn false;\n\t}\n\n\twhile (asn1_tag_remaining(data) > 0) {\t\t\t\t\t\n\t\tr = talloc_realloc(control, r, struct dsdb_openldap_dereference_result *, i + 2);\n\t\tif (!r) {\n\t\t\treturn false;\n\t\t}\n\t\tr[i] = talloc_zero(r, struct dsdb_openldap_dereference_result);\n\t\tif (!r[i]) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tasn1_read_OctetString_talloc(r[i], data, &r[i]->source_attribute);\n\t\tasn1_read_OctetString_talloc(r[i], data, &r[i]->dereferenced_dn);\n\t\tif (asn1_peek_tag(data, ASN1_CONTEXT(0))) {\n if (!asn1_start_tag(data, ASN1_CONTEXT(0))) {\n return false;\n }\n ldap_decode_attribs_bare(r, data, &r[i]->attributes,\n &r[i]->num_attributes);\n if (!asn1_end_tag(data)) {\n return false;\n }\n\t\t}\n\t\tif (!asn1_end_tag(data)) {\n\t\t\treturn false;\n\t\t}\n\t\ti++;\n\t\tr[i] = NULL;\n\t}\n\n\tif (!asn1_end_tag(data)) {\n\t\treturn false;\n\t}\n\n\tcontrol->attributes = r;\n\t*out = control;\n\n\treturn true;\n}\n", + "target": "static bool decode_openldap_dereference(void *mem_ctx, DATA_BLOB in, void *_out)\n{\n\tvoid **out = (void **)_out;\n\tstruct asn1_data *data = asn1_init(mem_ctx);\n\tstruct dsdb_openldap_dereference_result_control *control;\n\tstruct dsdb_openldap_dereference_result **r = NULL;\n\tint i = 0;\n\tif (!data) return false;\n\n\tcontrol = talloc(mem_ctx, struct dsdb_openldap_dereference_result_control);\n\tif (!control) return false;\n\n\tif (!asn1_load(data, in)) {\n\t\treturn false;\n\t}\n\n\tcontrol = talloc(mem_ctx, struct dsdb_openldap_dereference_result_control);\n\tif (!control) {\n\t\treturn false;\n\t}\n\n\tif (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {\n\t\treturn false;\n\t}\n\n\twhile (asn1_tag_remaining(data) > 0) {\t\t\t\t\t\n\t\tr = talloc_realloc(control, r, struct dsdb_openldap_dereference_result *, i + 2);\n\t\tif (!r) {\n\t\t\treturn false;\n\t\t}\n\t\tr[i] = talloc_zero(r, struct dsdb_openldap_dereference_result);\n\t\tif (!r[i]) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tasn1_read_OctetString_talloc(r[i], data, &r[i]->source_attribute);\n\t\tasn1_read_OctetString_talloc(r[i], data, &r[i]->dereferenced_dn);\n\t\tif (asn1_peek_tag(data, ASN1_CONTEXT(0))) {\n if (!asn1_start_tag(data, ASN1_CONTEXT(0))) {\n return false;\n }\n if (!ldap_decode_attribs_bare(r, data, &r[i]->attributes,\n &r[i]->num_attributes)) {\n return false;\n }\n if (!asn1_end_tag(data)) {\n return false;\n }\n\t\t}\n\t\tif (!asn1_end_tag(data)) {\n\t\t\treturn false;\n\t\t}\n\t\ti++;\n\t\tr[i] = NULL;\n\t}\n\n\tif (!asn1_end_tag(data)) {\n\t\treturn false;\n\t}\n\n\tcontrol->attributes = r;\n\t*out = control;\n\n\treturn true;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9590232bb4f4cc824f3425a6e1349afbe6d6d2b7", + "input": "static int ion_handle_put(struct ion_handle *handle)\n {\n \tstruct ion_client *client = handle->client;\n \tint ret;\n \n \tmutex_lock(&client->lock);\n\tret = kref_put(&handle->ref, ion_handle_destroy);\n \tmutex_unlock(&client->lock);\n \n \treturn ret;\n}\n", + "target": "static int ion_handle_put(struct ion_handle *handle)\nstatic int ion_handle_put_nolock(struct ion_handle *handle)\n{\n\tint ret;\n\n\tret = kref_put(&handle->ref, ion_handle_destroy);\n\n\treturn ret;\n}\n\nint ion_handle_put(struct ion_handle *handle)\n {\n \tstruct ion_client *client = handle->client;\n \tint ret;\n \n \tmutex_lock(&client->lock);\n\tret = ion_handle_put_nolock(handle);\n \tmutex_unlock(&client->lock);\n \n \treturn ret;\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3c8e4852477d5b1e2da877808c998dc57db9460f", + "input": "void DevToolsDomainHandler::SetRenderer(RenderProcessHost* process_host,\n RenderFrameHostImpl* frame_host) {}\n", + "target": "void DevToolsDomainHandler::SetRenderer(RenderProcessHost* process_host,\nvoid DevToolsDomainHandler::SetRenderer(int process_host_id,\n RenderFrameHostImpl* frame_host) {}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fcd135c9df440bcd2d5870405ad3311743d78d97", + "input": "auth_password(Authctxt *authctxt, const char *password)\n{\n\tstruct passwd * pw = authctxt->pw;\n\tint result, ok = authctxt->valid;\n#if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE)\n \tstatic int expire_checked = 0;\n #endif\n \n #ifndef HAVE_CYGWIN\n \tif (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES)\n \t\tok = 0;\n#endif\n\tif (*password == '\\0' && options.permit_empty_passwd == 0)\n\t\treturn 0;\n\n#ifdef KRB5\n\tif (options.kerberos_authentication == 1) {\n\t\tint ret = auth_krb5_password(authctxt, password);\n\t\tif (ret == 1 || ret == 0)\n\t\t\treturn ret && ok;\n\t\t/* Fall back to ordinary passwd authentication. */\n\t}\n#endif\n#ifdef HAVE_CYGWIN\n\t{\n\t\tHANDLE hToken = cygwin_logon_user(pw, password);\n\n\t\tif (hToken == INVALID_HANDLE_VALUE)\n\t\t\treturn 0;\n\t\tcygwin_set_impersonation_token(hToken);\n\t\treturn ok;\n\t}\n#endif\n#ifdef USE_PAM\n\tif (options.use_pam)\n\t\treturn (sshpam_auth_passwd(authctxt, password) && ok);\n#endif\n#if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE)\n\tif (!expire_checked) {\n\t\texpire_checked = 1;\n\t\tif (auth_shadow_pwexpired(authctxt))\n\t\t\tauthctxt->force_pwchange = 1;\n\t}\n#endif\n\tresult = sys_auth_passwd(authctxt, password);\n\tif (authctxt->force_pwchange)\n\t\tdisable_forwarding();\n\treturn (result && ok);\n}\n", + "target": "auth_password(Authctxt *authctxt, const char *password)\n{\n\tstruct passwd * pw = authctxt->pw;\n\tint result, ok = authctxt->valid;\n#if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE)\n \tstatic int expire_checked = 0;\n #endif\n \n\tif (strlen(password) > MAX_PASSWORD_LEN)\n\t\treturn 0;\n\n #ifndef HAVE_CYGWIN\n \tif (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES)\n \t\tok = 0;\n#endif\n\tif (*password == '\\0' && options.permit_empty_passwd == 0)\n\t\treturn 0;\n\n#ifdef KRB5\n\tif (options.kerberos_authentication == 1) {\n\t\tint ret = auth_krb5_password(authctxt, password);\n\t\tif (ret == 1 || ret == 0)\n\t\t\treturn ret && ok;\n\t\t/* Fall back to ordinary passwd authentication. */\n\t}\n#endif\n#ifdef HAVE_CYGWIN\n\t{\n\t\tHANDLE hToken = cygwin_logon_user(pw, password);\n\n\t\tif (hToken == INVALID_HANDLE_VALUE)\n\t\t\treturn 0;\n\t\tcygwin_set_impersonation_token(hToken);\n\t\treturn ok;\n\t}\n#endif\n#ifdef USE_PAM\n\tif (options.use_pam)\n\t\treturn (sshpam_auth_passwd(authctxt, password) && ok);\n#endif\n#if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE)\n\tif (!expire_checked) {\n\t\texpire_checked = 1;\n\t\tif (auth_shadow_pwexpired(authctxt))\n\t\t\tauthctxt->force_pwchange = 1;\n\t}\n#endif\n\tresult = sys_auth_passwd(authctxt, password);\n\tif (authctxt->force_pwchange)\n\t\tdisable_forwarding();\n\treturn (result && ok);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6045de69c7dedcba3eadf7c4bba424b19c81d00d", + "input": "void pdo_stmt_init(TSRMLS_D)\n{\n\tzend_class_entry ce;\n\n\tINIT_CLASS_ENTRY(ce, \"PDOStatement\", pdo_dbstmt_functions);\n\tpdo_dbstmt_ce = zend_register_internal_class(&ce TSRMLS_CC);\n\tpdo_dbstmt_ce->get_iterator = pdo_stmt_iter_get;\n\tpdo_dbstmt_ce->create_object = pdo_dbstmt_new;\n\tzend_class_implements(pdo_dbstmt_ce TSRMLS_CC, 1, zend_ce_traversable);\n\tzend_declare_property_null(pdo_dbstmt_ce, \"queryString\", sizeof(\"queryString\")-1, ZEND_ACC_PUBLIC TSRMLS_CC);\n\n\tmemcpy(&pdo_dbstmt_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));\n\tpdo_dbstmt_object_handlers.write_property = dbstmt_prop_write;\n\tpdo_dbstmt_object_handlers.unset_property = dbstmt_prop_delete;\n\tpdo_dbstmt_object_handlers.get_method = dbstmt_method_get;\n\tpdo_dbstmt_object_handlers.compare_objects = dbstmt_compare;\n\tpdo_dbstmt_object_handlers.clone_obj = dbstmt_clone_obj;\n\n\tINIT_CLASS_ENTRY(ce, \"PDORow\", pdo_row_functions);\n\tpdo_row_ce = zend_register_internal_class(&ce TSRMLS_CC);\n \tpdo_row_ce->ce_flags |= ZEND_ACC_FINAL_CLASS; /* when removing this a lot of handlers need to be redone */\n \tpdo_row_ce->create_object = pdo_row_new;\n \tpdo_row_ce->serialize = pdo_row_serialize;\n }\n", + "target": "void pdo_stmt_init(TSRMLS_D)\n{\n\tzend_class_entry ce;\n\n\tINIT_CLASS_ENTRY(ce, \"PDOStatement\", pdo_dbstmt_functions);\n\tpdo_dbstmt_ce = zend_register_internal_class(&ce TSRMLS_CC);\n\tpdo_dbstmt_ce->get_iterator = pdo_stmt_iter_get;\n\tpdo_dbstmt_ce->create_object = pdo_dbstmt_new;\n\tzend_class_implements(pdo_dbstmt_ce TSRMLS_CC, 1, zend_ce_traversable);\n\tzend_declare_property_null(pdo_dbstmt_ce, \"queryString\", sizeof(\"queryString\")-1, ZEND_ACC_PUBLIC TSRMLS_CC);\n\n\tmemcpy(&pdo_dbstmt_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));\n\tpdo_dbstmt_object_handlers.write_property = dbstmt_prop_write;\n\tpdo_dbstmt_object_handlers.unset_property = dbstmt_prop_delete;\n\tpdo_dbstmt_object_handlers.get_method = dbstmt_method_get;\n\tpdo_dbstmt_object_handlers.compare_objects = dbstmt_compare;\n\tpdo_dbstmt_object_handlers.clone_obj = dbstmt_clone_obj;\n\n\tINIT_CLASS_ENTRY(ce, \"PDORow\", pdo_row_functions);\n\tpdo_row_ce = zend_register_internal_class(&ce TSRMLS_CC);\n \tpdo_row_ce->ce_flags |= ZEND_ACC_FINAL_CLASS; /* when removing this a lot of handlers need to be redone */\n \tpdo_row_ce->create_object = pdo_row_new;\n \tpdo_row_ce->serialize = pdo_row_serialize;\n\tpdo_row_ce->unserialize = zend_class_unserialize_deny;\n }\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a3b76c8c13ea6b228122440f48c61b66d20443dd", + "input": " void CreateAuthenticatorFactory() {\n DCHECK(context_->network_task_runner()->BelongsToCurrentThread());\n \n std::string local_certificate = key_pair_.GenerateCertificate();\n if (local_certificate.empty()) {\n LOG(ERROR) << \"Failed to generate host certificate.\";\n Shutdown(kHostInitializationFailed);\n return;\n }\n\n scoped_ptr factory(\n new protocol::Me2MeHostAuthenticatorFactory(\n local_certificate, *key_pair_.private_key(), host_secret_hash_));\n host_->SetAuthenticatorFactory(factory.Pass());\n }\n", + "target": " void CreateAuthenticatorFactory() {\n DCHECK(context_->network_task_runner()->BelongsToCurrentThread());\n \n if (!host_ || shutting_down_)\n return;\n\n std::string local_certificate = key_pair_.GenerateCertificate();\n if (local_certificate.empty()) {\n LOG(ERROR) << \"Failed to generate host certificate.\";\n Shutdown(kHostInitializationFailed);\n return;\n }\n\n scoped_ptr factory(\n new protocol::Me2MeHostAuthenticatorFactory(\n local_certificate, *key_pair_.private_key(), host_secret_hash_));\n host_->SetAuthenticatorFactory(factory.Pass());\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "perform_formatting_test(png_store *volatile ps)\n {\n #ifdef PNG_TIME_RFC1123_SUPPORTED\n /* The handle into the formatting code is the RFC1123 support; this test does\n * nothing if that is compiled out.\n */\n context(ps, fault);\n\n Try\n {\n png_const_charp correct = \"29 Aug 2079 13:53:60 +0000\";\n png_const_charp result;\n# if PNG_LIBPNG_VER >= 10600\n char timestring[29];\n# endif\n png_structp pp;\n png_time pt;\n\n pp = set_store_for_write(ps, NULL, \"libpng formatting test\");\n\n if (pp == NULL)\n Throw ps;\n\n\n /* Arbitrary settings: */\n pt.year = 2079;\n pt.month = 8;\n pt.day = 29;\n pt.hour = 13;\n pt.minute = 53;\n pt.second = 60; /* a leap second */\n\n# if PNG_LIBPNG_VER < 10600\n result = png_convert_to_rfc1123(pp, &pt);\n# else\n if (png_convert_to_rfc1123_buffer(timestring, &pt))\n result = timestring;\n\n else\n result = NULL;\n# endif\n\n if (result == NULL)\n png_error(pp, \"png_convert_to_rfc1123 failed\");\n\n if (strcmp(result, correct) != 0)\n {\n size_t pos = 0;\n char msg[128];\n\n pos = safecat(msg, sizeof msg, pos, \"png_convert_to_rfc1123(\");\n pos = safecat(msg, sizeof msg, pos, correct);\n pos = safecat(msg, sizeof msg, pos, \") returned: '\");\n pos = safecat(msg, sizeof msg, pos, result);\n pos = safecat(msg, sizeof msg, pos, \"'\");\n\n png_error(pp, msg);\n }\n\n store_write_reset(ps);\n }\n\n Catch(fault)\n {\n store_write_reset(fault);\n }\n#else\n UNUSED(ps)\n#endif\n}\n", + "target": "perform_formatting_test(png_store *volatile ps)\nperform_formatting_test(png_store *ps)\n {\n #ifdef PNG_TIME_RFC1123_SUPPORTED\n /* The handle into the formatting code is the RFC1123 support; this test does\n * nothing if that is compiled out.\n */\n context(ps, fault);\n\n Try\n {\n png_const_charp correct = \"29 Aug 2079 13:53:60 +0000\";\n png_const_charp result;\n# if PNG_LIBPNG_VER >= 10600\n char timestring[29];\n# endif\n png_structp pp;\n png_time pt;\n\n pp = set_store_for_write(ps, NULL, \"libpng formatting test\");\n\n if (pp == NULL)\n Throw ps;\n\n\n /* Arbitrary settings: */\n pt.year = 2079;\n pt.month = 8;\n pt.day = 29;\n pt.hour = 13;\n pt.minute = 53;\n pt.second = 60; /* a leap second */\n\n# if PNG_LIBPNG_VER < 10600\n result = png_convert_to_rfc1123(pp, &pt);\n# else\n if (png_convert_to_rfc1123_buffer(timestring, &pt))\n result = timestring;\n\n else\n result = NULL;\n# endif\n\n if (result == NULL)\n png_error(pp, \"png_convert_to_rfc1123 failed\");\n\n if (strcmp(result, correct) != 0)\n {\n size_t pos = 0;\n char msg[128];\n\n pos = safecat(msg, sizeof msg, pos, \"png_convert_to_rfc1123(\");\n pos = safecat(msg, sizeof msg, pos, correct);\n pos = safecat(msg, sizeof msg, pos, \") returned: '\");\n pos = safecat(msg, sizeof msg, pos, result);\n pos = safecat(msg, sizeof msg, pos, \"'\");\n\n png_error(pp, msg);\n }\n\n store_write_reset(ps);\n }\n\n Catch(fault)\n {\n store_write_reset(fault);\n }\n#else\n UNUSED(ps)\n#endif\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0558f33c06bb910e2879e355192227a8e8f0219d", + "input": "void sas_deform_port(struct asd_sas_phy *phy, int gone)\n{\n\tstruct sas_ha_struct *sas_ha = phy->ha;\n\tstruct asd_sas_port *port = phy->port;\n\tstruct sas_internal *si =\n\t\tto_sas_internal(sas_ha->core.shost->transportt);\n\tstruct domain_device *dev;\n\tunsigned long flags;\n\n\tif (!port)\n\t\treturn;\t\t /* done by a phy event */\n\n\tdev = port->port_dev;\n\tif (dev)\n\t\tdev->pathways--;\n \n \tif (port->num_phys == 1) {\n \t\tsas_unregister_domain_devices(port, gone);\n \t\tsas_port_delete(port->port);\n \t\tport->port = NULL;\n \t} else {\n\t\tsas_port_delete_phy(port->port, phy->phy);\n\t\tsas_device_set_phy(dev, port->port);\n\t}\n\n\tif (si->dft->lldd_port_deformed)\n\t\tsi->dft->lldd_port_deformed(phy);\n\n\tspin_lock_irqsave(&sas_ha->phy_port_lock, flags);\n\tspin_lock(&port->phy_list_lock);\n\n\tlist_del_init(&phy->port_phy_el);\n\tsas_phy_set_target(phy, NULL);\n\tphy->port = NULL;\n\tport->num_phys--;\n\tport->phy_mask &= ~(1U << phy->id);\n\n\tif (port->num_phys == 0) {\n\t\tINIT_LIST_HEAD(&port->phy_list);\n\t\tmemset(port->sas_addr, 0, SAS_ADDR_SIZE);\n\t\tmemset(port->attached_sas_addr, 0, SAS_ADDR_SIZE);\n\t\tport->class = 0;\n\t\tport->iproto = 0;\n\t\tport->tproto = 0;\n\t\tport->oob_mode = 0;\n\t\tport->phy_mask = 0;\n\t}\n\tspin_unlock(&port->phy_list_lock);\n\tspin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);\n\n\treturn;\n}\n", + "target": "void sas_deform_port(struct asd_sas_phy *phy, int gone)\n{\n\tstruct sas_ha_struct *sas_ha = phy->ha;\n\tstruct asd_sas_port *port = phy->port;\n\tstruct sas_internal *si =\n\t\tto_sas_internal(sas_ha->core.shost->transportt);\n\tstruct domain_device *dev;\n\tunsigned long flags;\n\n\tif (!port)\n\t\treturn;\t\t /* done by a phy event */\n\n\tdev = port->port_dev;\n\tif (dev)\n\t\tdev->pathways--;\n \n \tif (port->num_phys == 1) {\n \t\tsas_unregister_domain_devices(port, gone);\n\t\tsas_destruct_devices(port);\n \t\tsas_port_delete(port->port);\n \t\tport->port = NULL;\n \t} else {\n\t\tsas_port_delete_phy(port->port, phy->phy);\n\t\tsas_device_set_phy(dev, port->port);\n\t}\n\n\tif (si->dft->lldd_port_deformed)\n\t\tsi->dft->lldd_port_deformed(phy);\n\n\tspin_lock_irqsave(&sas_ha->phy_port_lock, flags);\n\tspin_lock(&port->phy_list_lock);\n\n\tlist_del_init(&phy->port_phy_el);\n\tsas_phy_set_target(phy, NULL);\n\tphy->port = NULL;\n\tport->num_phys--;\n\tport->phy_mask &= ~(1U << phy->id);\n\n\tif (port->num_phys == 0) {\n\t\tINIT_LIST_HEAD(&port->phy_list);\n\t\tmemset(port->sas_addr, 0, SAS_ADDR_SIZE);\n\t\tmemset(port->attached_sas_addr, 0, SAS_ADDR_SIZE);\n\t\tport->class = 0;\n\t\tport->iproto = 0;\n\t\tport->tproto = 0;\n\t\tport->oob_mode = 0;\n\t\tport->phy_mask = 0;\n\t}\n\tspin_unlock(&port->phy_list_lock);\n\tspin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);\n\n\treturn;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fcd3a7a671ecf2d5f46ea34787d27507a914d2f5", + "input": "void SyncBackendHost::Core::DoInitialize(const DoInitializeOptions& options) {\n DCHECK(!sync_loop_);\n sync_loop_ = options.sync_loop;\n DCHECK(sync_loop_);\n\n if (options.delete_sync_data_folder) {\n DeleteSyncDataFolder();\n }\n\n bool success = file_util::CreateDirectory(sync_data_folder_path_);\n DCHECK(success);\n\n DCHECK(!registrar_);\n registrar_ = options.registrar;\n DCHECK(registrar_);\n\n sync_manager_.reset(new sync_api::SyncManager(name_));\n sync_manager_->AddObserver(this);\n success = sync_manager_->Init(\n sync_data_folder_path_,\n options.event_handler,\n options.service_url.host() + options.service_url.path(),\n options.service_url.EffectiveIntPort(),\n options.service_url.SchemeIsSecure(),\n BrowserThread::GetBlockingPool(),\n options.make_http_bridge_factory_fn.Run(),\n options.registrar /* as ModelSafeWorkerRegistrar */,\n options.extensions_activity_monitor,\n options.registrar /* as SyncManager::ChangeDelegate */,\n MakeUserAgentForSyncApi(),\n options.credentials,\n true,\n new BridgedSyncNotifier(\n options.chrome_sync_notification_bridge,\n options.sync_notifier_factory->CreateSyncNotifier()),\n options.restored_key_for_bootstrapping,\n options.testing_mode,\n &encryptor_,\n options.unrecoverable_error_handler,\n options.report_unrecoverable_error_function);\n LOG_IF(ERROR, !success) << \"Syncapi initialization failed!\";\n\n if (CommandLine::ForCurrentProcess()->HasSwitch(\n switches::kSyncThrowUnrecoverableError)) {\n sync_manager_->ThrowUnrecoverableError();\n }\n}\n", + "target": "void SyncBackendHost::Core::DoInitialize(const DoInitializeOptions& options) {\n DCHECK(!sync_loop_);\n sync_loop_ = options.sync_loop;\n DCHECK(sync_loop_);\n\n if (options.delete_sync_data_folder) {\n DeleteSyncDataFolder();\n }\n\n bool success = file_util::CreateDirectory(sync_data_folder_path_);\n DCHECK(success);\n\n DCHECK(!registrar_);\n registrar_ = options.registrar;\n DCHECK(registrar_);\n\n sync_manager_.reset(new sync_api::SyncManager(name_));\n sync_manager_->AddObserver(this);\n success = sync_manager_->Init(\n sync_data_folder_path_,\n options.event_handler,\n options.service_url.host() + options.service_url.path(),\n options.service_url.EffectiveIntPort(),\n options.service_url.SchemeIsSecure(),\n BrowserThread::GetBlockingPool(),\n options.make_http_bridge_factory_fn.Run(),\n options.registrar /* as ModelSafeWorkerRegistrar */,\n options.extensions_activity_monitor,\n options.registrar /* as SyncManager::ChangeDelegate */,\n MakeUserAgentForSyncApi(),\n options.credentials,\n new BridgedSyncNotifier(\n options.chrome_sync_notification_bridge,\n options.sync_notifier_factory->CreateSyncNotifier()),\n options.restored_key_for_bootstrapping,\n options.testing_mode,\n &encryptor_,\n options.unrecoverable_error_handler,\n options.report_unrecoverable_error_function);\n LOG_IF(ERROR, !success) << \"Syncapi initialization failed!\";\n\n if (CommandLine::ForCurrentProcess()->HasSwitch(\n switches::kSyncThrowUnrecoverableError)) {\n sync_manager_->ThrowUnrecoverableError();\n }\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#11-14341513f37c", + "input": "def update_playlist(id, name, db):\n db.execute(\n \"UPDATE playlist SET name='{name}' WHERE id={id};\".format(name=name, id=id))", + "target": "def update_playlist(id, name, db):\n db.execute(\"UPDATE playlist SET name=%s WHERE id=%s;\", (name, id,))", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#3097f364237fb552871f7639d37a7afa4563e252", + "input": "const sp& MediaMetadataRetriever::getService()\n {\n Mutex::Autolock lock(sServiceLock);\n if (sService == 0) {\n sp sm = defaultServiceManager();\n sp binder;\n do {\n binder = sm->getService(String16(\"media.player\"));\n if (binder != 0) {\n break;\n }\n ALOGW(\"MediaPlayerService not published, waiting...\");\n usleep(500000); // 0.5 s\n } while (true);\n if (sDeathNotifier == NULL) {\n sDeathNotifier = new DeathNotifier();\n }\n binder->linkToDeath(sDeathNotifier);\n sService = interface_cast(binder);\n }\n ALOGE_IF(sService == 0, \"no MediaPlayerService!?\");\n return sService;\n}\n", + "target": "const sp& MediaMetadataRetriever::getService()\nconst sp MediaMetadataRetriever::getService()\n {\n Mutex::Autolock lock(sServiceLock);\n if (sService == 0) {\n sp sm = defaultServiceManager();\n sp binder;\n do {\n binder = sm->getService(String16(\"media.player\"));\n if (binder != 0) {\n break;\n }\n ALOGW(\"MediaPlayerService not published, waiting...\");\n usleep(500000); // 0.5 s\n } while (true);\n if (sDeathNotifier == NULL) {\n sDeathNotifier = new DeathNotifier();\n }\n binder->linkToDeath(sDeathNotifier);\n sService = interface_cast(binder);\n }\n ALOGE_IF(sService == 0, \"no MediaPlayerService!?\");\n return sService;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#918eeaa29d99d257282fafec931b4bda0e3bae12", + "input": "void SoftMPEG2::setDecodeArgs(\n ivd_video_decode_ip_t *ps_dec_ip,\n ivd_video_decode_op_t *ps_dec_op,\n OMX_BUFFERHEADERTYPE *inHeader,\n OMX_BUFFERHEADERTYPE *outHeader,\n\n size_t timeStampIx) {\n size_t sizeY = outputBufferWidth() * outputBufferHeight();\n size_t sizeUV;\n uint8_t *pBuf;\n \n ps_dec_ip->u4_size = sizeof(ivd_video_decode_ip_t);\n ps_dec_op->u4_size = sizeof(ivd_video_decode_op_t);\n\n ps_dec_ip->e_cmd = IVD_CMD_VIDEO_DECODE;\n\n /* When in flush and after EOS with zero byte input,\n * inHeader is set to zero. Hence check for non-null */\n if (inHeader) {\n ps_dec_ip->u4_ts = timeStampIx;\n ps_dec_ip->pv_stream_buffer = inHeader->pBuffer\n + inHeader->nOffset;\n ps_dec_ip->u4_num_Bytes = inHeader->nFilledLen;\n } else {\n ps_dec_ip->u4_ts = 0;\n ps_dec_ip->pv_stream_buffer = NULL;\n\n ps_dec_ip->u4_num_Bytes = 0;\n }\n \n if (outHeader) {\n pBuf = outHeader->pBuffer;\n } else {\n pBuf = mFlushOutBuffer;\n }\n sizeUV = sizeY / 4;\n ps_dec_ip->s_out_buffer.u4_min_out_buf_size[0] = sizeY;\n ps_dec_ip->s_out_buffer.u4_min_out_buf_size[1] = sizeUV;\n ps_dec_ip->s_out_buffer.u4_min_out_buf_size[2] = sizeUV;\n \n ps_dec_ip->s_out_buffer.pu1_bufs[0] = pBuf;\n ps_dec_ip->s_out_buffer.pu1_bufs[1] = pBuf + sizeY;\n ps_dec_ip->s_out_buffer.pu1_bufs[2] = pBuf + sizeY + sizeUV;\n ps_dec_ip->s_out_buffer.u4_num_bufs = 3;\n return;\n }\n", + "target": "void SoftMPEG2::setDecodeArgs(\nbool SoftMPEG2::setDecodeArgs(\n ivd_video_decode_ip_t *ps_dec_ip,\n ivd_video_decode_op_t *ps_dec_op,\n OMX_BUFFERHEADERTYPE *inHeader,\n OMX_BUFFERHEADERTYPE *outHeader,\n\n size_t timeStampIx) {\n size_t sizeY = outputBufferWidth() * outputBufferHeight();\n size_t sizeUV;\n \n ps_dec_ip->u4_size = sizeof(ivd_video_decode_ip_t);\n ps_dec_op->u4_size = sizeof(ivd_video_decode_op_t);\n\n ps_dec_ip->e_cmd = IVD_CMD_VIDEO_DECODE;\n\n /* When in flush and after EOS with zero byte input,\n * inHeader is set to zero. Hence check for non-null */\n if (inHeader) {\n ps_dec_ip->u4_ts = timeStampIx;\n ps_dec_ip->pv_stream_buffer = inHeader->pBuffer\n + inHeader->nOffset;\n ps_dec_ip->u4_num_Bytes = inHeader->nFilledLen;\n } else {\n ps_dec_ip->u4_ts = 0;\n ps_dec_ip->pv_stream_buffer = NULL;\n\n ps_dec_ip->u4_num_Bytes = 0;\n }\n \n sizeUV = sizeY / 4;\n ps_dec_ip->s_out_buffer.u4_min_out_buf_size[0] = sizeY;\n ps_dec_ip->s_out_buffer.u4_min_out_buf_size[1] = sizeUV;\n ps_dec_ip->s_out_buffer.u4_min_out_buf_size[2] = sizeUV;\n \n uint8_t *pBuf;\n if (outHeader) {\n if (outHeader->nAllocLen < sizeY + (sizeUV * 2)) {\n android_errorWriteLog(0x534e4554, \"27569635\");\n return false;\n }\n pBuf = outHeader->pBuffer;\n } else {\n // mFlushOutBuffer always has the right size.\n pBuf = mFlushOutBuffer;\n }\n\n ps_dec_ip->s_out_buffer.pu1_bufs[0] = pBuf;\n ps_dec_ip->s_out_buffer.pu1_bufs[1] = pBuf + sizeY;\n ps_dec_ip->s_out_buffer.pu1_bufs[2] = pBuf + sizeY + sizeUV;\n ps_dec_ip->s_out_buffer.u4_num_bufs = 3;\n return true;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#18-fea1cd1a8ae7", + "input": "def getResults(poll_name):\n conn, c = connectDB()\n req = \"SELECT options from {} where name = '{}'\".format(CFG(\"poll_table_name\"), poll_name)\n options_str = queryOne(c, req)\n\n if not options_str:\n raise LookupError(\"Poll '{}' not found in DB\".format(poll_name))\n\n total = 0\n options = options_str.split(\",\")\n results = dict()\n for opt in options:\n count = getOptionCount(c, poll_name, opt)\n total += int(count)\n results.update({opt:count})\n\n conn.close()\n return (results, total)", + "target": "def getResults(poll_name):\n conn, c = connectDB()\n req = \"SELECT options from {} where name=?\".format(CFG(\"poll_table_name\"))\n options_str = queryOne(c, req, (poll_name,))\n\n if not options_str:\n raise LookupError(\"Poll '{}' not found in DB\".format(poll_name))\n\n total = 0\n options = options_str.split(\",\")\n results = dict()\n for opt in options:\n count = getOptionCount(c, poll_name, opt)\n total += int(count)\n results.update({opt:count})\n\n conn.close()\n return (results, total)", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#e86d3cfd2bc28dac421092106751e5638d54a848", + "input": "WORD32 ih264d_parse_sei_message(dec_struct_t *ps_dec,\n dec_bit_stream_t *ps_bitstrm)\n{\n UWORD32 ui4_payload_type, ui4_payload_size;\n UWORD32 u4_bits;\n WORD32 i4_status = 0;\n\n do\n {\n\n ui4_payload_type = 0;\n \n u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);\n while(0xff == u4_bits)\n {\n u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);\n ui4_payload_type += 255;\n }\n ui4_payload_type += u4_bits;\n\n \n ui4_payload_size = 0;\n u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);\n while(0xff == u4_bits)\n {\n u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);\n ui4_payload_size += 255;\n }\n ui4_payload_size += u4_bits;\n\n i4_status = ih264d_parse_sei_payload(ps_bitstrm, ui4_payload_type,\n ui4_payload_size, ps_dec);\n if(i4_status == -1)\n {\n i4_status = 0;\n break;\n }\n\n if(i4_status != OK)\n return i4_status;\n\n if(ih264d_check_byte_aligned(ps_bitstrm) == 0)\n {\n u4_bits = ih264d_get_bit_h264(ps_bitstrm);\n if(0 == u4_bits)\n\n {\n H264_DEC_DEBUG_PRINT(\"\\nError in parsing SEI message\");\n }\n while(0 == ih264d_check_byte_aligned(ps_bitstrm))\n {\n u4_bits = ih264d_get_bit_h264(ps_bitstrm);\n if(u4_bits)\n {\n H264_DEC_DEBUG_PRINT(\"\\nError in parsing SEI message\");\n }\n }\n }\n }\n while(ps_bitstrm->u4_ofst < ps_bitstrm->u4_max_ofst);\n return (i4_status);\n}\n", + "target": "WORD32 ih264d_parse_sei_message(dec_struct_t *ps_dec,\n dec_bit_stream_t *ps_bitstrm)\n{\n UWORD32 ui4_payload_type, ui4_payload_size;\n UWORD32 u4_bits;\n WORD32 i4_status = 0;\n\n do\n {\n\n ui4_payload_type = 0;\n \n u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);\n while(0xff == u4_bits && !EXCEED_OFFSET(ps_bitstrm))\n {\n u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);\n ui4_payload_type += 255;\n }\n ui4_payload_type += u4_bits;\n\n \n ui4_payload_size = 0;\n u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);\n while(0xff == u4_bits && !EXCEED_OFFSET(ps_bitstrm))\n {\n u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);\n ui4_payload_size += 255;\n }\n ui4_payload_size += u4_bits;\n\n i4_status = ih264d_parse_sei_payload(ps_bitstrm, ui4_payload_type,\n ui4_payload_size, ps_dec);\n if(i4_status == -1)\n {\n i4_status = 0;\n break;\n }\n\n if(i4_status != OK)\n return i4_status;\n\n if(ih264d_check_byte_aligned(ps_bitstrm) == 0)\n {\n u4_bits = ih264d_get_bit_h264(ps_bitstrm);\n if(0 == u4_bits)\n\n {\n H264_DEC_DEBUG_PRINT(\"\\nError in parsing SEI message\");\n }\n while(0 == ih264d_check_byte_aligned(ps_bitstrm)\n && !EXCEED_OFFSET(ps_bitstrm))\n {\n u4_bits = ih264d_get_bit_h264(ps_bitstrm);\n if(u4_bits)\n {\n H264_DEC_DEBUG_PRINT(\"\\nError in parsing SEI message\");\n }\n }\n }\n }\n while(ps_bitstrm->u4_ofst < ps_bitstrm->u4_max_ofst);\n return (i4_status);\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d0947db40187f4708c58e64cbd6013faf9eddeed", + "input": "xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,\n const xmlChar *SystemID) {\n xmlDetectSAX2(ctxt);\n GROW;\n\n if ((ctxt->encoding == (const xmlChar *)XML_CHAR_ENCODING_NONE) &&\n (ctxt->input->end - ctxt->input->cur >= 4)) {\n xmlChar start[4];\n\txmlCharEncoding enc;\n\n\tstart[0] = RAW;\n\tstart[1] = NXT(1);\n\tstart[2] = NXT(2);\n\tstart[3] = NXT(3);\n\tenc = xmlDetectCharEncoding(start, 4);\n\tif (enc != XML_CHAR_ENCODING_NONE)\n\t xmlSwitchEncoding(ctxt, enc);\n }\n\n if (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) {\n\txmlParseTextDecl(ctxt);\n\tif (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {\n\t /*\n\t * The XML REC instructs us to stop parsing right here\n\t */\n\t ctxt->instate = XML_PARSER_EOF;\n\t return;\n\t}\n }\n if (ctxt->myDoc == NULL) {\n ctxt->myDoc = xmlNewDoc(BAD_CAST \"1.0\");\n\tif (ctxt->myDoc == NULL) {\n\t xmlErrMemory(ctxt, \"New Doc failed\");\n\t return;\n\t}\n\tctxt->myDoc->properties = XML_DOC_INTERNAL;\n }\n if ((ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset == NULL))\n xmlCreateIntSubset(ctxt->myDoc, NULL, ExternalID, SystemID);\n\n ctxt->instate = XML_PARSER_DTD;\n ctxt->external = 1;\n while (((RAW == '<') && (NXT(1) == '?')) ||\n ((RAW == '<') && (NXT(1) == '!')) ||\n\t (RAW == '%') || IS_BLANK_CH(CUR)) {\n\tconst xmlChar *check = CUR_PTR;\n\tunsigned int cons = ctxt->input->consumed;\n\n\tGROW;\n if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {\n\t xmlParseConditionalSections(ctxt);\n\t} else if (IS_BLANK_CH(CUR)) {\n\t NEXT;\n\t} else if (RAW == '%') {\n xmlParsePEReference(ctxt);\n\t} else\n\t xmlParseMarkupDecl(ctxt);\n\n\t/*\n\t * Pop-up of finished entities.\n\t */\n\twhile ((RAW == 0) && (ctxt->inputNr > 1))\n\t xmlPopInput(ctxt);\n\n\tif ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {\n\t xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);\n \t break;\n \t}\n }\n if (RAW != 0) {\n \txmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);\n }\n\n}\n", + "target": "xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,\n const xmlChar *SystemID) {\n xmlDetectSAX2(ctxt);\n GROW;\n\n if ((ctxt->encoding == (const xmlChar *)XML_CHAR_ENCODING_NONE) &&\n (ctxt->input->end - ctxt->input->cur >= 4)) {\n xmlChar start[4];\n\txmlCharEncoding enc;\n\n\tstart[0] = RAW;\n\tstart[1] = NXT(1);\n\tstart[2] = NXT(2);\n\tstart[3] = NXT(3);\n\tenc = xmlDetectCharEncoding(start, 4);\n\tif (enc != XML_CHAR_ENCODING_NONE)\n\t xmlSwitchEncoding(ctxt, enc);\n }\n\n if (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) {\n\txmlParseTextDecl(ctxt);\n\tif (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {\n\t /*\n\t * The XML REC instructs us to stop parsing right here\n\t */\n\t ctxt->instate = XML_PARSER_EOF;\n\t return;\n\t}\n }\n if (ctxt->myDoc == NULL) {\n ctxt->myDoc = xmlNewDoc(BAD_CAST \"1.0\");\n\tif (ctxt->myDoc == NULL) {\n\t xmlErrMemory(ctxt, \"New Doc failed\");\n\t return;\n\t}\n\tctxt->myDoc->properties = XML_DOC_INTERNAL;\n }\n if ((ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset == NULL))\n xmlCreateIntSubset(ctxt->myDoc, NULL, ExternalID, SystemID);\n\n ctxt->instate = XML_PARSER_DTD;\n ctxt->external = 1;\n while (((RAW == '<') && (NXT(1) == '?')) ||\n ((RAW == '<') && (NXT(1) == '!')) ||\n\t (RAW == '%') || IS_BLANK_CH(CUR)) {\n\tconst xmlChar *check = CUR_PTR;\n\tunsigned int cons = ctxt->input->consumed;\n\n\tGROW;\n if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {\n\t xmlParseConditionalSections(ctxt);\n\t} else if (IS_BLANK_CH(CUR)) {\n\t NEXT;\n\t} else if (RAW == '%') {\n xmlParsePEReference(ctxt);\n\t} else\n\t xmlParseMarkupDecl(ctxt);\n\n\t/*\n\t * Pop-up of finished entities.\n\t */\n\twhile ((RAW == 0) && (ctxt->inputNr > 1))\n\t xmlPopInput(ctxt);\n\n\tif ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {\n\t xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);\n \t break;\n \t}\n }\n\n if (RAW != 0) {\n \txmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);\n }\n\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8f80c2d83808150724d31793e6ade92749b1faa4", + "input": "static void read_conf(FILE *conffile)\n{\n char *buffer, *line, *val;\n\n buffer = loadfile(conffile);\n for (line = strtok(buffer, \"\\r\\n\"); line; line = strtok(NULL, \"\\r\\n\")) {\n if (!strncmp(line, \"export \", 7))\n continue;\n val = strchr(line, '=');\n if (!val) {\n printf(\"invalid configuration line\\n\");\n break;\n }\n *val++ = '\\0';\n\n if (!strcmp(line, \"JSON_INDENT\"))\n conf.indent = atoi(val);\n if (!strcmp(line, \"JSON_COMPACT\"))\n conf.compact = atoi(val);\n if (!strcmp(line, \"JSON_ENSURE_ASCII\"))\n conf.ensure_ascii = atoi(val);\n if (!strcmp(line, \"JSON_PRESERVE_ORDER\"))\n conf.preserve_order = atoi(val);\n if (!strcmp(line, \"JSON_SORT_KEYS\"))\n conf.sort_keys = atoi(val);\n if (!strcmp(line, \"STRIP\"))\n conf.strip = atoi(val);\n }\n \n free(buffer);\n}\n", + "target": "static void read_conf(FILE *conffile)\n{\n char *buffer, *line, *val;\n\n buffer = loadfile(conffile);\n for (line = strtok(buffer, \"\\r\\n\"); line; line = strtok(NULL, \"\\r\\n\")) {\n if (!strncmp(line, \"export \", 7))\n continue;\n val = strchr(line, '=');\n if (!val) {\n printf(\"invalid configuration line\\n\");\n break;\n }\n *val++ = '\\0';\n\n if (!strcmp(line, \"JSON_INDENT\"))\n conf.indent = atoi(val);\n if (!strcmp(line, \"JSON_COMPACT\"))\n conf.compact = atoi(val);\n if (!strcmp(line, \"JSON_ENSURE_ASCII\"))\n conf.ensure_ascii = atoi(val);\n if (!strcmp(line, \"JSON_PRESERVE_ORDER\"))\n conf.preserve_order = atoi(val);\n if (!strcmp(line, \"JSON_SORT_KEYS\"))\n conf.sort_keys = atoi(val);\n if (!strcmp(line, \"STRIP\"))\n conf.strip = atoi(val);\n if (!strcmp(line, \"HASHSEED\")) {\n conf.have_hashseed = 1;\n conf.hashseed = atoi(val);\n } else {\n conf.have_hashseed = 0;\n }\n }\n \n free(buffer);\n}\n", + "vul_type": "cwe-310", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#19190765882e272a6a2162c89acdb29110f7e3cf", + "input": " DictionaryValue* BaseNode::GetDetailsAsValue() const {\n DictionaryValue* node_info = GetSummaryAsValue();\n node_info->SetString(\n \"modificationTime\",\n browser_sync::GetTimeDebugString(GetModificationTime()));\n node_info->SetString(\"parentId\", base::Int64ToString(GetParentId()));\n node_info->SetString(\"externalId\",\n base::Int64ToString(GetExternalId()));\n node_info->SetString(\"predecessorId\",\n base::Int64ToString(GetPredecessorId()));\n node_info->SetString(\"successorId\",\n base::Int64ToString(GetSuccessorId()));\n node_info->SetString(\"firstChildId\",\n base::Int64ToString(GetFirstChildId()));\n node_info->Set(\"entry\", GetEntry()->ToValue());\n return node_info;\n}\n", + "target": " DictionaryValue* BaseNode::GetDetailsAsValue() const {\n DictionaryValue* node_info = GetSummaryAsValue();\n // TODO(akalin): Return time in a better format.\n node_info->SetString(\"modificationTime\",\n base::Int64ToString(GetModificationTime()));\n node_info->SetString(\"parentId\", base::Int64ToString(GetParentId()));\n node_info->SetString(\"externalId\",\n base::Int64ToString(GetExternalId()));\n node_info->SetString(\"predecessorId\",\n base::Int64ToString(GetPredecessorId()));\n node_info->SetString(\"successorId\",\n base::Int64ToString(GetSuccessorId()));\n node_info->SetString(\"firstChildId\",\n base::Int64ToString(GetFirstChildId()));\n node_info->Set(\"entry\", GetEntry()->ToValue());\n return node_info;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#9-5283547f22c3", + "input": "def get_game_info(conn, game):\n # get the basic game properties\n cursor = conn.cursor()\n cursor.execute(\"SELECT player1,player2,size,state FROM games WHERE id = %d;\" % game)\n if cursor.rowcount != 1:\n raise FormError(\"Invalid game ID\")\n\n row = cursor.fetchall()[0]\n players = [row[0],row[1]]\n size = row[2]\n state = row[3]\n\n if state is None:\n state = \"Active\"\n\n cursor.close()\n\n return (players,size,state)", + "target": "def get_game_info(conn, game):\n # get the basic game properties\n cursor = conn.cursor()\n cursor.execute(\"SELECT player1,player2,size,state FROM games WHERE id = %d;\", (game,))\n if cursor.rowcount != 1:\n raise FormError(\"Invalid game ID\")\n\n row = cursor.fetchall()[0]\n players = [row[0],row[1]]\n size = row[2]\n state = row[3]\n\n if state is None:\n state = \"Active\"\n\n cursor.close()\n\n return (players,size,state)", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#fd4edbad91f65bfab79276390de5db59b079fd3b", + "input": " InternalWebIntentsDispatcherTest() {\n replied_ = 0;\n }\n", + "target": " InternalWebIntentsDispatcherTest() {\n InternalWebIntentsDispatcherTest()\n : replied_(0),\n notified_reply_type_(webkit_glue::WEB_INTENT_REPLY_INVALID) {\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1c40f9042ae2d6ee7483d72998aabb5e73b2ff60", + "input": "void ResourceFetcher::DidLoadResourceFromMemoryCache(\n unsigned long identifier,\n Resource* resource,\n const ResourceRequest& original_resource_request) {\n ResourceRequest resource_request(resource->Url());\n resource_request.SetFrameType(original_resource_request.GetFrameType());\n resource_request.SetRequestContext(\n original_resource_request.GetRequestContext());\n Context().DispatchDidLoadResourceFromMemoryCache(identifier, resource_request,\n resource->GetResponse());\n Context().DispatchWillSendRequest(identifier, resource_request,\n ResourceResponse() /* redirects */,\n resource->Options().initiator_info);\n Context().DispatchDidReceiveResponse(\n identifier, resource->GetResponse(), resource_request.GetFrameType(),\n resource_request.GetRequestContext(), resource,\n FetchContext::ResourceResponseType::kFromMemoryCache);\n\n if (resource->EncodedSize() > 0)\n Context().DispatchDidReceiveData(identifier, 0, resource->EncodedSize());\n\n Context().DispatchDidFinishLoading(\n identifier, 0, 0, resource->GetResponse().DecodedBodyLength());\n}\n", + "target": "void ResourceFetcher::DidLoadResourceFromMemoryCache(\n unsigned long identifier,\n Resource* resource,\n const ResourceRequest& original_resource_request) {\n ResourceRequest resource_request(resource->Url());\n resource_request.SetFrameType(original_resource_request.GetFrameType());\n resource_request.SetRequestContext(\n original_resource_request.GetRequestContext());\n Context().DispatchDidLoadResourceFromMemoryCache(identifier, resource_request,\n resource->GetResponse());\n Context().DispatchWillSendRequest(\n identifier, resource_request, ResourceResponse() /* redirects */,\n resource->GetType(), resource->Options().initiator_info);\n Context().DispatchDidReceiveResponse(\n identifier, resource->GetResponse(), resource_request.GetFrameType(),\n resource_request.GetRequestContext(), resource,\n FetchContext::ResourceResponseType::kFromMemoryCache);\n\n if (resource->EncodedSize() > 0)\n Context().DispatchDidReceiveData(identifier, 0, resource->EncodedSize());\n\n Context().DispatchDidFinishLoading(\n identifier, 0, 0, resource->GetResponse().DecodedBodyLength());\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1e7aed70144b4673fc26e73062064b6724795e5f", + "input": "static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iovec *iov,\n unsigned int max_num_sg, bool is_write,\n hwaddr pa, size_t sz)\n{\n unsigned num_sg = *p_num_sg;\n assert(num_sg <= max_num_sg);\n \n while (sz) {\n hwaddr len = sz;\n iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write);\n iov[num_sg].iov_len = len;\n addr[num_sg] = pa;\n\n sz -= len;\n pa += len;\n num_sg++;\n }\n *p_num_sg = num_sg;\n}\n", + "target": "static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iovec *iov,\n unsigned int max_num_sg, bool is_write,\n hwaddr pa, size_t sz)\n{\n unsigned num_sg = *p_num_sg;\n assert(num_sg <= max_num_sg);\n \n if (!sz) {\n error_report(\"virtio: zero sized buffers are not allowed\");\n exit(1);\n }\n\n while (sz) {\n hwaddr len = sz;\n iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write);\n iov[num_sg].iov_len = len;\n addr[num_sg] = pa;\n\n sz -= len;\n pa += len;\n num_sg++;\n }\n *p_num_sg = num_sg;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d02cda7a634fbd6e53d98091f618057f0174387", + "input": " std::string::size_type CountTrailingChars(\n const std::string input,\n const std::string::value_type trailing_chars[]) {\n const size_t last_good_char = input.find_last_not_of(trailing_chars);\n return (last_good_char == std::string::npos) ?\n input.length() : (input.length() - last_good_char - 1);\n}\n", + "target": " std::string::size_type CountTrailingChars(\n const std::string& input,\n const std::string::value_type trailing_chars[]) {\n const size_t last_good_char = input.find_last_not_of(trailing_chars);\n return (last_good_char == std::string::npos) ?\n input.length() : (input.length() - last_good_char - 1);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d42b2388f7f8e0332c846675133acea151fc557a", + "input": " void jas_matrix_asl(jas_matrix_t *matrix, int n)\n {\n\tint i;\n\tint j;\n \tjas_seqent_t *rowstart;\n\tint rowstep;\n \tjas_seqent_t *data;\n \n \tif (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) {\n\t\tassert(matrix->rows_);\n\t\trowstep = jas_matrix_rowstep(matrix);\n\t\tfor (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,\n\t\t rowstart += rowstep) {\n\t\t\tfor (j = matrix->numcols_, data = rowstart; j > 0; --j,\n\t\t\t ++data) {\n\t\t\t\t*data = jas_seqent_asl(*data, n);\n\t\t\t}\n\t\t}\n\t}\n}\n", + "target": " void jas_matrix_asl(jas_matrix_t *matrix, int n)\n {\n\tjas_matind_t i;\n\tjas_matind_t j;\n \tjas_seqent_t *rowstart;\n\tjas_matind_t rowstep;\n \tjas_seqent_t *data;\n \n \tif (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) {\n\t\tassert(matrix->rows_);\n\t\trowstep = jas_matrix_rowstep(matrix);\n\t\tfor (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,\n\t\t rowstart += rowstep) {\n\t\t\tfor (j = matrix->numcols_, data = rowstart; j > 0; --j,\n\t\t\t ++data) {\n\t\t\t\t*data = jas_seqent_asl(*data, n);\n\t\t\t}\n\t\t}\n\t}\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8939398b82006ba1fec4ed491339fc075f43fc7c", + "input": "static void ParseCommon(map_string_t *settings, const char *conf_filename)\n{\n const char *value;\n\n value = get_map_string_item_or_NULL(settings, \"WatchCrashdumpArchiveDir\");\n if (value)\n {\n g_settings_sWatchCrashdumpArchiveDir = xstrdup(value);\n remove_map_string_item(settings, \"WatchCrashdumpArchiveDir\");\n }\n\n value = get_map_string_item_or_NULL(settings, \"MaxCrashReportsSize\");\n if (value)\n {\n char *end;\n errno = 0;\n unsigned long ul = strtoul(value, &end, 10);\n if (errno || end == value || *end != '\\0' || ul > INT_MAX)\n error_msg(\"Error parsing %s setting: '%s'\", \"MaxCrashReportsSize\", value);\n else\n g_settings_nMaxCrashReportsSize = ul;\n remove_map_string_item(settings, \"MaxCrashReportsSize\");\n }\n\n value = get_map_string_item_or_NULL(settings, \"DumpLocation\");\n if (value)\n {\n g_settings_dump_location = xstrdup(value);\n remove_map_string_item(settings, \"DumpLocation\");\n }\n else\n g_settings_dump_location = xstrdup(DEFAULT_DUMP_LOCATION);\n\n value = get_map_string_item_or_NULL(settings, \"DeleteUploaded\");\n if (value)\n {\n g_settings_delete_uploaded = string_to_bool(value);\n remove_map_string_item(settings, \"DeleteUploaded\");\n }\n\n value = get_map_string_item_or_NULL(settings, \"AutoreportingEnabled\");\n if (value)\n {\n g_settings_autoreporting = string_to_bool(value);\n remove_map_string_item(settings, \"AutoreportingEnabled\");\n }\n\n value = get_map_string_item_or_NULL(settings, \"AutoreportingEvent\");\n if (value)\n {\n g_settings_autoreporting_event = xstrdup(value);\n remove_map_string_item(settings, \"AutoreportingEvent\");\n }\n else\n g_settings_autoreporting_event = xstrdup(\"report_uReport\");\n\n value = get_map_string_item_or_NULL(settings, \"ShortenedReporting\");\n if (value)\n {\n g_settings_shortenedreporting = string_to_bool(value);\n remove_map_string_item(settings, \"ShortenedReporting\");\n }\n else\n g_settings_shortenedreporting = 0;\n \n GHashTableIter iter;\n const char *name;\n /*char *value; - already declared */\n init_map_string_iter(&iter, settings);\n while (next_map_string_iter(&iter, &name, &value))\n {\n error_msg(\"Unrecognized variable '%s' in '%s'\", name, conf_filename);\n }\n}\n", + "target": "static void ParseCommon(map_string_t *settings, const char *conf_filename)\n{\n const char *value;\n\n value = get_map_string_item_or_NULL(settings, \"WatchCrashdumpArchiveDir\");\n if (value)\n {\n g_settings_sWatchCrashdumpArchiveDir = xstrdup(value);\n remove_map_string_item(settings, \"WatchCrashdumpArchiveDir\");\n }\n\n value = get_map_string_item_or_NULL(settings, \"MaxCrashReportsSize\");\n if (value)\n {\n char *end;\n errno = 0;\n unsigned long ul = strtoul(value, &end, 10);\n if (errno || end == value || *end != '\\0' || ul > INT_MAX)\n error_msg(\"Error parsing %s setting: '%s'\", \"MaxCrashReportsSize\", value);\n else\n g_settings_nMaxCrashReportsSize = ul;\n remove_map_string_item(settings, \"MaxCrashReportsSize\");\n }\n\n value = get_map_string_item_or_NULL(settings, \"DumpLocation\");\n if (value)\n {\n g_settings_dump_location = xstrdup(value);\n remove_map_string_item(settings, \"DumpLocation\");\n }\n else\n g_settings_dump_location = xstrdup(DEFAULT_DUMP_LOCATION);\n\n value = get_map_string_item_or_NULL(settings, \"DeleteUploaded\");\n if (value)\n {\n g_settings_delete_uploaded = string_to_bool(value);\n remove_map_string_item(settings, \"DeleteUploaded\");\n }\n\n value = get_map_string_item_or_NULL(settings, \"AutoreportingEnabled\");\n if (value)\n {\n g_settings_autoreporting = string_to_bool(value);\n remove_map_string_item(settings, \"AutoreportingEnabled\");\n }\n\n value = get_map_string_item_or_NULL(settings, \"AutoreportingEvent\");\n if (value)\n {\n g_settings_autoreporting_event = xstrdup(value);\n remove_map_string_item(settings, \"AutoreportingEvent\");\n }\n else\n g_settings_autoreporting_event = xstrdup(\"report_uReport\");\n\n value = get_map_string_item_or_NULL(settings, \"ShortenedReporting\");\n if (value)\n {\n g_settings_shortenedreporting = string_to_bool(value);\n remove_map_string_item(settings, \"ShortenedReporting\");\n }\n else\n g_settings_shortenedreporting = 0;\n \n value = get_map_string_item_or_NULL(settings, \"PrivateReports\");\n if (value)\n {\n g_settings_privatereports = string_to_bool(value);\n remove_map_string_item(settings, \"PrivateReports\");\n }\n\n GHashTableIter iter;\n const char *name;\n /*char *value; - already declared */\n init_map_string_iter(&iter, settings);\n while (next_map_string_iter(&iter, &name, &value))\n {\n error_msg(\"Unrecognized variable '%s' in '%s'\", name, conf_filename);\n }\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1", + "input": " SPL_METHOD(DirectoryIterator, rewind)\n {\n \tspl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);\n \tif (zend_parse_parameters_none() == FAILURE) {\n \t\treturn;\n \t}\n\n\tintern->u.dir.index = 0;\n\tif (intern->u.dir.dirp) {\n\t\tphp_stream_rewinddir(intern->u.dir.dirp);\n\t}\n\tspl_filesystem_dir_read(intern TSRMLS_CC);\n}\n", + "target": " SPL_METHOD(DirectoryIterator, rewind)\n {\n \tspl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);\n\n \tif (zend_parse_parameters_none() == FAILURE) {\n \t\treturn;\n \t}\n\n\tintern->u.dir.index = 0;\n\tif (intern->u.dir.dirp) {\n\t\tphp_stream_rewinddir(intern->u.dir.dirp);\n\t}\n\tspl_filesystem_dir_read(intern TSRMLS_CC);\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d", + "input": " long Chapters::Parse() {\n IMkvReader* const pReader = m_pSegment->m_pReader;\n\n long long pos = m_start; // payload start\n const long long stop = pos + m_size; // payload stop\n\n while (pos < stop) {\n long long id, size;\n\n long status = ParseElementHeader(pReader, pos, stop, id, size);\n\n if (status < 0) // error\n return status;\n\n if (size == 0) // weird\n continue;\n\n if (id == 0x05B9) { // EditionEntry ID\n status = ParseEdition(pos, size);\n\n if (status < 0) // error\n return status;\n\n }\n \n pos += size;\n assert(pos <= stop);\n }\n \n assert(pos == stop);\n return 0;\n }\n", + "target": " long Chapters::Parse() {\n IMkvReader* const pReader = m_pSegment->m_pReader;\n\n long long pos = m_start; // payload start\n const long long stop = pos + m_size; // payload stop\n\n while (pos < stop) {\n long long id, size;\n\n long status = ParseElementHeader(pReader, pos, stop, id, size);\n\n if (status < 0) // error\n return status;\n\n if (size == 0) // weird\n continue;\n\n if (id == 0x05B9) { // EditionEntry ID\n status = ParseEdition(pos, size);\n\n if (status < 0) // error\n return status;\n\n }\n \n pos += size;\n if (pos > stop)\n return E_FILE_FORMAT_INVALID;\n }\n \n if (pos != stop)\n return E_FILE_FORMAT_INVALID;\n return 0;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#94f1bb15bed84ad6c893916b7e7b9db6f1d7eec6", + "input": "static inline struct old_rng_alg *crypto_old_rng_alg(struct crypto_rng *tfm)\n{\n\treturn &crypto_rng_tfm(tfm)->__crt_alg->cra_rng;\n}\n", + "target": "static inline struct old_rng_alg *crypto_old_rng_alg(struct crypto_rng *tfm)\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#237bbd29f7a049d310d907f4b2716a7feef9abf3", + "input": "struct key *key_alloc(struct key_type *type, const char *desc,\n\t\t kuid_t uid, kgid_t gid, const struct cred *cred,\n\t\t key_perm_t perm, unsigned long flags,\n\t\t struct key_restriction *restrict_link)\n{\n\tstruct key_user *user = NULL;\n\tstruct key *key;\n\tsize_t desclen, quotalen;\n\tint ret;\n\n\tkey = ERR_PTR(-EINVAL);\n\tif (!desc || !*desc)\n\t\tgoto error;\n\n\tif (type->vet_description) {\n\t\tret = type->vet_description(desc);\n\t\tif (ret < 0) {\n\t\t\tkey = ERR_PTR(ret);\n\t\t\tgoto error;\n\t\t}\n\t}\n\n\tdesclen = strlen(desc);\n\tquotalen = desclen + 1 + type->def_datalen;\n\n\t/* get hold of the key tracking for this user */\n\tuser = key_user_lookup(uid);\n\tif (!user)\n\t\tgoto no_memory_1;\n\n\t/* check that the user's quota permits allocation of another key and\n\t * its description */\n\tif (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) {\n\t\tunsigned maxkeys = uid_eq(uid, GLOBAL_ROOT_UID) ?\n\t\t\tkey_quota_root_maxkeys : key_quota_maxkeys;\n\t\tunsigned maxbytes = uid_eq(uid, GLOBAL_ROOT_UID) ?\n\t\t\tkey_quota_root_maxbytes : key_quota_maxbytes;\n\n\t\tspin_lock(&user->lock);\n\t\tif (!(flags & KEY_ALLOC_QUOTA_OVERRUN)) {\n\t\t\tif (user->qnkeys + 1 >= maxkeys ||\n\t\t\t user->qnbytes + quotalen >= maxbytes ||\n\t\t\t user->qnbytes + quotalen < user->qnbytes)\n\t\t\t\tgoto no_quota;\n\t\t}\n\n\t\tuser->qnkeys++;\n\t\tuser->qnbytes += quotalen;\n\t\tspin_unlock(&user->lock);\n\t}\n\n\t/* allocate and initialise the key and its description */\n\tkey = kmem_cache_zalloc(key_jar, GFP_KERNEL);\n\tif (!key)\n\t\tgoto no_memory_2;\n\n\tkey->index_key.desc_len = desclen;\n\tkey->index_key.description = kmemdup(desc, desclen + 1, GFP_KERNEL);\n\tif (!key->index_key.description)\n\t\tgoto no_memory_3;\n\n\trefcount_set(&key->usage, 1);\n\tinit_rwsem(&key->sem);\n\tlockdep_set_class(&key->sem, &type->lock_class);\n\tkey->index_key.type = type;\n\tkey->user = user;\n\tkey->quotalen = quotalen;\n\tkey->datalen = type->def_datalen;\n\tkey->uid = uid;\n\tkey->gid = gid;\n\tkey->perm = perm;\n\tkey->restrict_link = restrict_link;\n\n\tif (!(flags & KEY_ALLOC_NOT_IN_QUOTA))\n \t\tkey->flags |= 1 << KEY_FLAG_IN_QUOTA;\n \tif (flags & KEY_ALLOC_BUILT_IN)\n \t\tkey->flags |= 1 << KEY_FLAG_BUILTIN;\n \n #ifdef KEY_DEBUGGING\n \tkey->magic = KEY_DEBUG_MAGIC;\n#endif\n\n\t/* let the security module know about the key */\n\tret = security_key_alloc(key, cred, flags);\n\tif (ret < 0)\n\t\tgoto security_error;\n\n\t/* publish the key by giving it a serial number */\n\tatomic_inc(&user->nkeys);\n\tkey_alloc_serial(key);\n\nerror:\n\treturn key;\n\nsecurity_error:\n\tkfree(key->description);\n\tkmem_cache_free(key_jar, key);\n\tif (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) {\n\t\tspin_lock(&user->lock);\n\t\tuser->qnkeys--;\n\t\tuser->qnbytes -= quotalen;\n\t\tspin_unlock(&user->lock);\n\t}\n\tkey_user_put(user);\n\tkey = ERR_PTR(ret);\n\tgoto error;\n\nno_memory_3:\n\tkmem_cache_free(key_jar, key);\nno_memory_2:\n\tif (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) {\n\t\tspin_lock(&user->lock);\n\t\tuser->qnkeys--;\n\t\tuser->qnbytes -= quotalen;\n\t\tspin_unlock(&user->lock);\n\t}\n\tkey_user_put(user);\nno_memory_1:\n\tkey = ERR_PTR(-ENOMEM);\n\tgoto error;\n\nno_quota:\n\tspin_unlock(&user->lock);\n\tkey_user_put(user);\n\tkey = ERR_PTR(-EDQUOT);\n\tgoto error;\n}\n", + "target": "struct key *key_alloc(struct key_type *type, const char *desc,\n\t\t kuid_t uid, kgid_t gid, const struct cred *cred,\n\t\t key_perm_t perm, unsigned long flags,\n\t\t struct key_restriction *restrict_link)\n{\n\tstruct key_user *user = NULL;\n\tstruct key *key;\n\tsize_t desclen, quotalen;\n\tint ret;\n\n\tkey = ERR_PTR(-EINVAL);\n\tif (!desc || !*desc)\n\t\tgoto error;\n\n\tif (type->vet_description) {\n\t\tret = type->vet_description(desc);\n\t\tif (ret < 0) {\n\t\t\tkey = ERR_PTR(ret);\n\t\t\tgoto error;\n\t\t}\n\t}\n\n\tdesclen = strlen(desc);\n\tquotalen = desclen + 1 + type->def_datalen;\n\n\t/* get hold of the key tracking for this user */\n\tuser = key_user_lookup(uid);\n\tif (!user)\n\t\tgoto no_memory_1;\n\n\t/* check that the user's quota permits allocation of another key and\n\t * its description */\n\tif (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) {\n\t\tunsigned maxkeys = uid_eq(uid, GLOBAL_ROOT_UID) ?\n\t\t\tkey_quota_root_maxkeys : key_quota_maxkeys;\n\t\tunsigned maxbytes = uid_eq(uid, GLOBAL_ROOT_UID) ?\n\t\t\tkey_quota_root_maxbytes : key_quota_maxbytes;\n\n\t\tspin_lock(&user->lock);\n\t\tif (!(flags & KEY_ALLOC_QUOTA_OVERRUN)) {\n\t\t\tif (user->qnkeys + 1 >= maxkeys ||\n\t\t\t user->qnbytes + quotalen >= maxbytes ||\n\t\t\t user->qnbytes + quotalen < user->qnbytes)\n\t\t\t\tgoto no_quota;\n\t\t}\n\n\t\tuser->qnkeys++;\n\t\tuser->qnbytes += quotalen;\n\t\tspin_unlock(&user->lock);\n\t}\n\n\t/* allocate and initialise the key and its description */\n\tkey = kmem_cache_zalloc(key_jar, GFP_KERNEL);\n\tif (!key)\n\t\tgoto no_memory_2;\n\n\tkey->index_key.desc_len = desclen;\n\tkey->index_key.description = kmemdup(desc, desclen + 1, GFP_KERNEL);\n\tif (!key->index_key.description)\n\t\tgoto no_memory_3;\n\n\trefcount_set(&key->usage, 1);\n\tinit_rwsem(&key->sem);\n\tlockdep_set_class(&key->sem, &type->lock_class);\n\tkey->index_key.type = type;\n\tkey->user = user;\n\tkey->quotalen = quotalen;\n\tkey->datalen = type->def_datalen;\n\tkey->uid = uid;\n\tkey->gid = gid;\n\tkey->perm = perm;\n\tkey->restrict_link = restrict_link;\n\n\tif (!(flags & KEY_ALLOC_NOT_IN_QUOTA))\n \t\tkey->flags |= 1 << KEY_FLAG_IN_QUOTA;\n \tif (flags & KEY_ALLOC_BUILT_IN)\n \t\tkey->flags |= 1 << KEY_FLAG_BUILTIN;\n\tif (flags & KEY_ALLOC_UID_KEYRING)\n\t\tkey->flags |= 1 << KEY_FLAG_UID_KEYRING;\n \n #ifdef KEY_DEBUGGING\n \tkey->magic = KEY_DEBUG_MAGIC;\n#endif\n\n\t/* let the security module know about the key */\n\tret = security_key_alloc(key, cred, flags);\n\tif (ret < 0)\n\t\tgoto security_error;\n\n\t/* publish the key by giving it a serial number */\n\tatomic_inc(&user->nkeys);\n\tkey_alloc_serial(key);\n\nerror:\n\treturn key;\n\nsecurity_error:\n\tkfree(key->description);\n\tkmem_cache_free(key_jar, key);\n\tif (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) {\n\t\tspin_lock(&user->lock);\n\t\tuser->qnkeys--;\n\t\tuser->qnbytes -= quotalen;\n\t\tspin_unlock(&user->lock);\n\t}\n\tkey_user_put(user);\n\tkey = ERR_PTR(ret);\n\tgoto error;\n\nno_memory_3:\n\tkmem_cache_free(key_jar, key);\nno_memory_2:\n\tif (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) {\n\t\tspin_lock(&user->lock);\n\t\tuser->qnkeys--;\n\t\tuser->qnbytes -= quotalen;\n\t\tspin_unlock(&user->lock);\n\t}\n\tkey_user_put(user);\nno_memory_1:\n\tkey = ERR_PTR(-ENOMEM);\n\tgoto error;\n\nno_quota:\n\tspin_unlock(&user->lock);\n\tkey_user_put(user);\n\tkey = ERR_PTR(-EDQUOT);\n\tgoto error;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e66eded8309ebf679d3d3c1f5820d1f2ca332c71", + "input": "SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)\n{\n\tstruct fs_struct *fs, *new_fs = NULL;\n\tstruct files_struct *fd, *new_fd = NULL;\n\tstruct cred *new_cred = NULL;\n\tstruct nsproxy *new_nsproxy = NULL;\n\tint do_sysvsem = 0;\n\tint err;\n\n\t/*\n \t * If unsharing a user namespace must also unshare the thread.\n \t */\n \tif (unshare_flags & CLONE_NEWUSER)\n\t\tunshare_flags |= CLONE_THREAD;\n \t/*\n \t * If unsharing a pid namespace must also unshare the thread.\n \t */\n\tif (unshare_flags & CLONE_NEWPID)\n\t\tunshare_flags |= CLONE_THREAD;\n\t/*\n\t * If unsharing a thread from a thread group, must also unshare vm.\n\t */\n\tif (unshare_flags & CLONE_THREAD)\n\t\tunshare_flags |= CLONE_VM;\n\t/*\n\t * If unsharing vm, must also unshare signal handlers.\n\t */\n\tif (unshare_flags & CLONE_VM)\n\t\tunshare_flags |= CLONE_SIGHAND;\n\t/*\n\t * If unsharing namespace, must also unshare filesystem information.\n\t */\n\tif (unshare_flags & CLONE_NEWNS)\n\t\tunshare_flags |= CLONE_FS;\n\n\terr = check_unshare_flags(unshare_flags);\n\tif (err)\n\t\tgoto bad_unshare_out;\n\t/*\n\t * CLONE_NEWIPC must also detach from the undolist: after switching\n\t * to a new ipc namespace, the semaphore arrays from the old\n\t * namespace are unreachable.\n\t */\n\tif (unshare_flags & (CLONE_NEWIPC|CLONE_SYSVSEM))\n\t\tdo_sysvsem = 1;\n\terr = unshare_fs(unshare_flags, &new_fs);\n\tif (err)\n\t\tgoto bad_unshare_out;\n\terr = unshare_fd(unshare_flags, &new_fd);\n\tif (err)\n\t\tgoto bad_unshare_cleanup_fs;\n\terr = unshare_userns(unshare_flags, &new_cred);\n\tif (err)\n\t\tgoto bad_unshare_cleanup_fd;\n\terr = unshare_nsproxy_namespaces(unshare_flags, &new_nsproxy,\n\t\t\t\t\t new_cred, new_fs);\n\tif (err)\n\t\tgoto bad_unshare_cleanup_cred;\n\n\tif (new_fs || new_fd || do_sysvsem || new_cred || new_nsproxy) {\n\t\tif (do_sysvsem) {\n\t\t\t/*\n\t\t\t * CLONE_SYSVSEM is equivalent to sys_exit().\n\t\t\t */\n\t\t\texit_sem(current);\n\t\t}\n\n\t\tif (new_nsproxy)\n\t\t\tswitch_task_namespaces(current, new_nsproxy);\n\n\t\ttask_lock(current);\n\n\t\tif (new_fs) {\n\t\t\tfs = current->fs;\n\t\t\tspin_lock(&fs->lock);\n\t\t\tcurrent->fs = new_fs;\n\t\t\tif (--fs->users)\n\t\t\t\tnew_fs = NULL;\n\t\t\telse\n\t\t\t\tnew_fs = fs;\n\t\t\tspin_unlock(&fs->lock);\n\t\t}\n\n\t\tif (new_fd) {\n\t\t\tfd = current->files;\n\t\t\tcurrent->files = new_fd;\n\t\t\tnew_fd = fd;\n\t\t}\n\n\t\ttask_unlock(current);\n\n\t\tif (new_cred) {\n\t\t\t/* Install the new user namespace */\n\t\t\tcommit_creds(new_cred);\n\t\t\tnew_cred = NULL;\n\t\t}\n\t}\n\nbad_unshare_cleanup_cred:\n\tif (new_cred)\n\t\tput_cred(new_cred);\nbad_unshare_cleanup_fd:\n\tif (new_fd)\n\t\tput_files_struct(new_fd);\n\nbad_unshare_cleanup_fs:\n\tif (new_fs)\n\t\tfree_fs_struct(new_fs);\n\nbad_unshare_out:\n\treturn err;\n}\n", + "target": "SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)\n{\n\tstruct fs_struct *fs, *new_fs = NULL;\n\tstruct files_struct *fd, *new_fd = NULL;\n\tstruct cred *new_cred = NULL;\n\tstruct nsproxy *new_nsproxy = NULL;\n\tint do_sysvsem = 0;\n\tint err;\n\n\t/*\n \t * If unsharing a user namespace must also unshare the thread.\n \t */\n \tif (unshare_flags & CLONE_NEWUSER)\n\t\tunshare_flags |= CLONE_THREAD | CLONE_FS;\n \t/*\n \t * If unsharing a pid namespace must also unshare the thread.\n \t */\n\tif (unshare_flags & CLONE_NEWPID)\n\t\tunshare_flags |= CLONE_THREAD;\n\t/*\n\t * If unsharing a thread from a thread group, must also unshare vm.\n\t */\n\tif (unshare_flags & CLONE_THREAD)\n\t\tunshare_flags |= CLONE_VM;\n\t/*\n\t * If unsharing vm, must also unshare signal handlers.\n\t */\n\tif (unshare_flags & CLONE_VM)\n\t\tunshare_flags |= CLONE_SIGHAND;\n\t/*\n\t * If unsharing namespace, must also unshare filesystem information.\n\t */\n\tif (unshare_flags & CLONE_NEWNS)\n\t\tunshare_flags |= CLONE_FS;\n\n\terr = check_unshare_flags(unshare_flags);\n\tif (err)\n\t\tgoto bad_unshare_out;\n\t/*\n\t * CLONE_NEWIPC must also detach from the undolist: after switching\n\t * to a new ipc namespace, the semaphore arrays from the old\n\t * namespace are unreachable.\n\t */\n\tif (unshare_flags & (CLONE_NEWIPC|CLONE_SYSVSEM))\n\t\tdo_sysvsem = 1;\n\terr = unshare_fs(unshare_flags, &new_fs);\n\tif (err)\n\t\tgoto bad_unshare_out;\n\terr = unshare_fd(unshare_flags, &new_fd);\n\tif (err)\n\t\tgoto bad_unshare_cleanup_fs;\n\terr = unshare_userns(unshare_flags, &new_cred);\n\tif (err)\n\t\tgoto bad_unshare_cleanup_fd;\n\terr = unshare_nsproxy_namespaces(unshare_flags, &new_nsproxy,\n\t\t\t\t\t new_cred, new_fs);\n\tif (err)\n\t\tgoto bad_unshare_cleanup_cred;\n\n\tif (new_fs || new_fd || do_sysvsem || new_cred || new_nsproxy) {\n\t\tif (do_sysvsem) {\n\t\t\t/*\n\t\t\t * CLONE_SYSVSEM is equivalent to sys_exit().\n\t\t\t */\n\t\t\texit_sem(current);\n\t\t}\n\n\t\tif (new_nsproxy)\n\t\t\tswitch_task_namespaces(current, new_nsproxy);\n\n\t\ttask_lock(current);\n\n\t\tif (new_fs) {\n\t\t\tfs = current->fs;\n\t\t\tspin_lock(&fs->lock);\n\t\t\tcurrent->fs = new_fs;\n\t\t\tif (--fs->users)\n\t\t\t\tnew_fs = NULL;\n\t\t\telse\n\t\t\t\tnew_fs = fs;\n\t\t\tspin_unlock(&fs->lock);\n\t\t}\n\n\t\tif (new_fd) {\n\t\t\tfd = current->files;\n\t\t\tcurrent->files = new_fd;\n\t\t\tnew_fd = fd;\n\t\t}\n\n\t\ttask_unlock(current);\n\n\t\tif (new_cred) {\n\t\t\t/* Install the new user namespace */\n\t\t\tcommit_creds(new_cred);\n\t\t\tnew_cred = NULL;\n\t\t}\n\t}\n\nbad_unshare_cleanup_cred:\n\tif (new_cred)\n\t\tput_cred(new_cred);\nbad_unshare_cleanup_fd:\n\tif (new_fd)\n\t\tput_files_struct(new_fd);\n\nbad_unshare_cleanup_fs:\n\tif (new_fs)\n\t\tfree_fs_struct(new_fs);\n\nbad_unshare_out:\n\treturn err;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#828eab2216a765dea92575c290421c115b8ad028", + "input": " void UpdateContentLengthPrefsForDataReductionProxy(\n int received_content_length, int original_content_length,\n bool with_data_reduction_proxy_enabled, bool via_data_reduction_proxy,\n base::Time now, PrefService* prefs) {\n base::TimeDelta time_since_unix_epoch = now - base::Time::UnixEpoch();\n const int kMinDaysSinceUnixEpoch = 365 * 2; // 2 years.\n const int kMaxDaysSinceUnixEpoch = 365 * 1000; // 1000 years.\n if (time_since_unix_epoch.InDays() < kMinDaysSinceUnixEpoch ||\n time_since_unix_epoch.InDays() > kMaxDaysSinceUnixEpoch) {\n return;\n }\n\n int64 then_internal = prefs->GetInt64(\n prefs::kDailyHttpContentLengthLastUpdateDate);\n base::Time then_midnight =\n base::Time::FromInternalValue(then_internal).LocalMidnight();\n base::Time midnight = now.LocalMidnight();\n int days_since_last_update = (midnight - then_midnight).InDays();\n\n DailyDataSavingUpdate total(\n prefs::kDailyHttpOriginalContentLength,\n prefs::kDailyHttpReceivedContentLength,\n prefs);\n total.UpdateForDataChange(days_since_last_update);\n\n DailyDataSavingUpdate proxy_enabled(\n prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled,\n prefs::kDailyContentLengthWithDataReductionProxyEnabled,\n prefs);\n proxy_enabled.UpdateForDataChange(days_since_last_update);\n\n DailyDataSavingUpdate via_proxy(\n prefs::kDailyOriginalContentLengthViaDataReductionProxy,\n prefs::kDailyContentLengthViaDataReductionProxy,\n prefs);\n via_proxy.UpdateForDataChange(days_since_last_update);\n \n total.Add(original_content_length, received_content_length);\n if (with_data_reduction_proxy_enabled) {\n proxy_enabled.Add(original_content_length, received_content_length);\n if (via_data_reduction_proxy) {\n via_proxy.Add(original_content_length, received_content_length);\n }\n }\n \n if (days_since_last_update) {\n prefs->SetInt64(prefs::kDailyHttpContentLengthLastUpdateDate,\n midnight.ToInternalValue());\n\n if (days_since_last_update == 1) {\n RecordDailyContentLengthHistograms(\n total.GetOriginalListPrefValue(kNumDaysInHistory - 2),\n total.GetReceivedListPrefValue(kNumDaysInHistory - 2),\n proxy_enabled.GetOriginalListPrefValue(kNumDaysInHistory - 2),\n proxy_enabled.GetReceivedListPrefValue(kNumDaysInHistory - 2),\n via_proxy.GetOriginalListPrefValue(kNumDaysInHistory - 2),\n via_proxy.GetReceivedListPrefValue(kNumDaysInHistory - 2));\n }\n }\n }\n", + "target": " void UpdateContentLengthPrefsForDataReductionProxy(\n int received_content_length,\n int original_content_length,\n bool with_data_reduction_proxy_enabled,\n DataReductionRequestType data_reduction_type,\n base::Time now, PrefService* prefs) {\n base::TimeDelta time_since_unix_epoch = now - base::Time::UnixEpoch();\n const int kMinDaysSinceUnixEpoch = 365 * 2; // 2 years.\n const int kMaxDaysSinceUnixEpoch = 365 * 1000; // 1000 years.\n if (time_since_unix_epoch.InDays() < kMinDaysSinceUnixEpoch ||\n time_since_unix_epoch.InDays() > kMaxDaysSinceUnixEpoch) {\n return;\n }\n\n int64 then_internal = prefs->GetInt64(\n prefs::kDailyHttpContentLengthLastUpdateDate);\n base::Time then_midnight =\n base::Time::FromInternalValue(then_internal).LocalMidnight();\n base::Time midnight = now.LocalMidnight();\n int days_since_last_update = (midnight - then_midnight).InDays();\n\n DailyDataSavingUpdate total(\n prefs::kDailyHttpOriginalContentLength,\n prefs::kDailyHttpReceivedContentLength,\n prefs);\n total.UpdateForDataChange(days_since_last_update);\n\n DailyDataSavingUpdate proxy_enabled(\n prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled,\n prefs::kDailyContentLengthWithDataReductionProxyEnabled,\n prefs);\n proxy_enabled.UpdateForDataChange(days_since_last_update);\n\n DailyDataSavingUpdate via_proxy(\n prefs::kDailyOriginalContentLengthViaDataReductionProxy,\n prefs::kDailyContentLengthViaDataReductionProxy,\n prefs);\n via_proxy.UpdateForDataChange(days_since_last_update);\n \n DailyContentLengthUpdate https(\n prefs::kDailyContentLengthHttpsWithDataReductionProxyEnabled, prefs);\n https.UpdateForDataChange(days_since_last_update);\n\n DailyContentLengthUpdate short_bypass(\n prefs::kDailyContentLengthShortBypassWithDataReductionProxyEnabled,\n prefs);\n short_bypass.UpdateForDataChange(days_since_last_update);\n\n DailyContentLengthUpdate long_bypass(\n prefs::kDailyContentLengthLongBypassWithDataReductionProxyEnabled, prefs);\n long_bypass.UpdateForDataChange(days_since_last_update);\n\n DailyContentLengthUpdate unknown(\n prefs::kDailyContentLengthUnknownWithDataReductionProxyEnabled, prefs);\n unknown.UpdateForDataChange(days_since_last_update);\n\n total.Add(original_content_length, received_content_length);\n if (with_data_reduction_proxy_enabled) {\n proxy_enabled.Add(original_content_length, received_content_length);\n // Ignore data source cases, if exist, when\n // \"with_data_reduction_proxy_enabled == false\"\n switch (data_reduction_type) {\n case VIA_DATA_REDUCTION_PROXY:\n via_proxy.Add(original_content_length, received_content_length);\n break;\n case OFF_THE_RECORD:\n // We don't measure off-the-record data.\n break;\n case HTTPS:\n https.Add(received_content_length);\n break;\n case SHORT_BYPASS:\n short_bypass.Add(received_content_length);\n break;\n case LONG_BYPASS:\n long_bypass.Add(received_content_length);\n break;\n case UNKNOWN_TYPE:\n unknown.Add(received_content_length);\n break;\n }\n }\n \n if (days_since_last_update) {\n prefs->SetInt64(prefs::kDailyHttpContentLengthLastUpdateDate,\n midnight.ToInternalValue());\n\n if (days_since_last_update == 1) {\n // Therefore (kNumDaysInHistory - 2) below.\n RecordDailyContentLengthHistograms(\n total.GetOriginalListPrefValue(kNumDaysInHistory - 2),\n total.GetReceivedListPrefValue(kNumDaysInHistory - 2),\n proxy_enabled.GetOriginalListPrefValue(kNumDaysInHistory - 2),\n proxy_enabled.GetReceivedListPrefValue(kNumDaysInHistory - 2),\n via_proxy.GetOriginalListPrefValue(kNumDaysInHistory - 2),\n via_proxy.GetReceivedListPrefValue(kNumDaysInHistory - 2),\n https.GetListPrefValue(kNumDaysInHistory - 2),\n short_bypass.GetListPrefValue(kNumDaysInHistory - 2),\n long_bypass.GetListPrefValue(kNumDaysInHistory - 2),\n unknown.GetListPrefValue(kNumDaysInHistory - 2));\n }\n }\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d", + "input": "long ContentEncoding::ParseContentEncodingEntry(long long start, long long size,\n IMkvReader* pReader) {\n assert(pReader);\n\n long long pos = start;\n const long long stop = start + size;\n\n int compression_count = 0;\n int encryption_count = 0;\n\n while (pos < stop) {\n long long id, size;\n const long status = ParseElementHeader(pReader, pos, stop, id, size);\n if (status < 0) // error\n return status;\n\n if (id == 0x1034) // ContentCompression ID\n ++compression_count;\n\n if (id == 0x1035) // ContentEncryption ID\n\n ++encryption_count;\n \n pos += size; // consume payload\n assert(pos <= stop);\n }\n \n if (compression_count <= 0 && encryption_count <= 0)\n return -1;\n\n \n if (compression_count > 0) {\n compression_entries_ =\n new (std::nothrow) ContentCompression* [compression_count];\n if (!compression_entries_)\n return -1;\n compression_entries_end_ = compression_entries_;\n }\n\n \n if (encryption_count > 0) {\n encryption_entries_ =\n new (std::nothrow) ContentEncryption* [encryption_count];\n if (!encryption_entries_) {\n delete[] compression_entries_;\n return -1;\n }\n encryption_entries_end_ = encryption_entries_;\n }\n\n pos = start;\n while (pos < stop) {\n long long id, size;\n long status = ParseElementHeader(pReader, pos, stop, id, size);\n if (status < 0) // error\n return status;\n\n if (id == 0x1031) {\n encoding_order_ = UnserializeUInt(pReader, pos, size);\n } else if (id == 0x1032) {\n encoding_scope_ = UnserializeUInt(pReader, pos, size);\n if (encoding_scope_ < 1)\n return -1;\n } else if (id == 0x1033) {\n encoding_type_ = UnserializeUInt(pReader, pos, size);\n } else if (id == 0x1034) {\n ContentCompression* const compression =\n new (std::nothrow) ContentCompression();\n if (!compression)\n return -1;\n\n status = ParseCompressionEntry(pos, size, pReader, compression);\n if (status) {\n delete compression;\n return status;\n }\n *compression_entries_end_++ = compression;\n } else if (id == 0x1035) {\n ContentEncryption* const encryption =\n new (std::nothrow) ContentEncryption();\n if (!encryption)\n return -1;\n\n status = ParseEncryptionEntry(pos, size, pReader, encryption);\n if (status) {\n delete encryption;\n return status;\n }\n *encryption_entries_end_++ = encryption;\n\n }\n \n pos += size; // consume payload\n assert(pos <= stop);\n }\n \n assert(pos == stop);\n return 0;\n }\n", + "target": "long ContentEncoding::ParseContentEncodingEntry(long long start, long long size,\n IMkvReader* pReader) {\n assert(pReader);\n\n long long pos = start;\n const long long stop = start + size;\n\n int compression_count = 0;\n int encryption_count = 0;\n\n while (pos < stop) {\n long long id, size;\n const long status = ParseElementHeader(pReader, pos, stop, id, size);\n if (status < 0) // error\n return status;\n\n if (id == 0x1034) // ContentCompression ID\n ++compression_count;\n\n if (id == 0x1035) // ContentEncryption ID\n\n ++encryption_count;\n \n pos += size; // consume payload\n if (pos > stop)\n return E_FILE_FORMAT_INVALID;\n }\n \n if (compression_count <= 0 && encryption_count <= 0)\n return -1;\n\n \n if (compression_count > 0) {\n compression_entries_ =\n new (std::nothrow) ContentCompression*[compression_count];\n if (!compression_entries_)\n return -1;\n compression_entries_end_ = compression_entries_;\n }\n\n \n if (encryption_count > 0) {\n encryption_entries_ =\n new (std::nothrow) ContentEncryption*[encryption_count];\n if (!encryption_entries_) {\n delete[] compression_entries_;\n return -1;\n }\n encryption_entries_end_ = encryption_entries_;\n }\n\n pos = start;\n while (pos < stop) {\n long long id, size;\n long status = ParseElementHeader(pReader, pos, stop, id, size);\n if (status < 0) // error\n return status;\n\n if (id == 0x1031) {\n encoding_order_ = UnserializeUInt(pReader, pos, size);\n } else if (id == 0x1032) {\n encoding_scope_ = UnserializeUInt(pReader, pos, size);\n if (encoding_scope_ < 1)\n return -1;\n } else if (id == 0x1033) {\n encoding_type_ = UnserializeUInt(pReader, pos, size);\n } else if (id == 0x1034) {\n ContentCompression* const compression =\n new (std::nothrow) ContentCompression();\n if (!compression)\n return -1;\n\n status = ParseCompressionEntry(pos, size, pReader, compression);\n if (status) {\n delete compression;\n return status;\n }\n *compression_entries_end_++ = compression;\n } else if (id == 0x1035) {\n ContentEncryption* const encryption =\n new (std::nothrow) ContentEncryption();\n if (!encryption)\n return -1;\n\n status = ParseEncryptionEntry(pos, size, pReader, encryption);\n if (status) {\n delete encryption;\n return status;\n }\n *encryption_entries_end_++ = encryption;\n\n }\n \n pos += size; // consume payload\n if (pos > stop)\n return E_FILE_FORMAT_INVALID;\n }\n \n if (pos != stop)\n return E_FILE_FORMAT_INVALID;\n return 0;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7f8cdab6fda192d15e45a3e9682b1eec427870c5", + "input": " gfx::Rect ShellWindowFrameView::GetWindowBoundsForClientBounds(\n const gfx::Rect& client_bounds) const {\n int closeButtonOffsetX =\n (kCaptionHeight - close_button_->height()) / 2;\n int header_width = close_button_->width() + closeButtonOffsetX * 2;\n return gfx::Rect(client_bounds.x(),\n std::max(0, client_bounds.y() - kCaptionHeight),\n std::max(header_width, client_bounds.width()),\n client_bounds.height() + kCaptionHeight);\n}\n", + "target": " gfx::Rect ShellWindowFrameView::GetWindowBoundsForClientBounds(\n const gfx::Rect& client_bounds) const {\n if (is_frameless_)\n return client_bounds;\n\n int closeButtonOffsetX =\n (kCaptionHeight - close_button_->height()) / 2;\n int header_width = close_button_->width() + closeButtonOffsetX * 2;\n return gfx::Rect(client_bounds.x(),\n std::max(0, client_bounds.y() - kCaptionHeight),\n std::max(header_width, client_bounds.width()),\n client_bounds.height() + kCaptionHeight);\n}\n", + "vul_type": "cwe-79", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a00183107d4b84bc8a714290e824ca9c68dac738", + "input": "static int find_high_bit(unsigned int x)\n {\n \tint i;\n \tfor(i=31;i>=0;i--) {\n\t\tif(x&(1<=0;i--) {\n\t\tif(x&(1U<<(unsigned int)i)) return i;\n \t}\n \treturn 0;\n }\n", + "vul_type": "cwe-682", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a8b0ca17b80e92faab46ee7179ba9e99ccb61233", + "input": " static void record_and_restart(struct perf_event *event, unsigned long val,\n\t\t\t struct pt_regs *regs, int nmi)\n {\n \tu64 period = event->hw.sample_period;\n \ts64 prev, delta, left;\n\tint record = 0;\n\n\tif (event->hw.state & PERF_HES_STOPPED) {\n\t\twrite_pmc(event->hw.idx, 0);\n\t\treturn;\n\t}\n\n\t/* we don't have to worry about interrupts here */\n\tprev = local64_read(&event->hw.prev_count);\n\tdelta = (val - prev) & 0xfffffffful;\n\tlocal64_add(delta, &event->count);\n\n\t/*\n\t * See if the total period for this event has expired,\n\t * and update for the next period.\n\t */\n\tval = 0;\n\tleft = local64_read(&event->hw.period_left) - delta;\n\tif (period) {\n\t\tif (left <= 0) {\n\t\t\tleft += period;\n\t\t\tif (left <= 0)\n\t\t\t\tleft = period;\n\t\t\trecord = 1;\n\t\t\tevent->hw.last_period = event->hw.sample_period;\n\t\t}\n\t\tif (left < 0x80000000LL)\n\t\t\tval = 0x80000000LL - left;\n\t}\n\n\twrite_pmc(event->hw.idx, val);\n\tlocal64_set(&event->hw.prev_count, val);\n\tlocal64_set(&event->hw.period_left, left);\n\tperf_event_update_userpage(event);\n\n\t/*\n\t * Finally record data if requested.\n\t */\n\tif (record) {\n\t\tstruct perf_sample_data data;\n\n \t\tperf_sample_data_init(&data, 0);\n \t\tdata.period = event->hw.last_period;\n \n\t\tif (perf_event_overflow(event, nmi, &data, regs))\n \t\t\tfsl_emb_pmu_stop(event, 0);\n \t}\n }\n", + "target": " static void record_and_restart(struct perf_event *event, unsigned long val,\n\t\t\t struct pt_regs *regs)\n {\n \tu64 period = event->hw.sample_period;\n \ts64 prev, delta, left;\n\tint record = 0;\n\n\tif (event->hw.state & PERF_HES_STOPPED) {\n\t\twrite_pmc(event->hw.idx, 0);\n\t\treturn;\n\t}\n\n\t/* we don't have to worry about interrupts here */\n\tprev = local64_read(&event->hw.prev_count);\n\tdelta = (val - prev) & 0xfffffffful;\n\tlocal64_add(delta, &event->count);\n\n\t/*\n\t * See if the total period for this event has expired,\n\t * and update for the next period.\n\t */\n\tval = 0;\n\tleft = local64_read(&event->hw.period_left) - delta;\n\tif (period) {\n\t\tif (left <= 0) {\n\t\t\tleft += period;\n\t\t\tif (left <= 0)\n\t\t\t\tleft = period;\n\t\t\trecord = 1;\n\t\t\tevent->hw.last_period = event->hw.sample_period;\n\t\t}\n\t\tif (left < 0x80000000LL)\n\t\t\tval = 0x80000000LL - left;\n\t}\n\n\twrite_pmc(event->hw.idx, val);\n\tlocal64_set(&event->hw.prev_count, val);\n\tlocal64_set(&event->hw.period_left, left);\n\tperf_event_update_userpage(event);\n\n\t/*\n\t * Finally record data if requested.\n\t */\n\tif (record) {\n\t\tstruct perf_sample_data data;\n\n \t\tperf_sample_data_init(&data, 0);\n \t\tdata.period = event->hw.last_period;\n \n\t\tif (perf_event_overflow(event, &data, regs))\n \t\t\tfsl_emb_pmu_stop(event, 0);\n \t}\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#06630554ccbdd25780aa03c3548aaff1eb56dffd", + "input": "static void mptsas_fetch_request(MPTSASState *s)\n{\n PCIDevice *pci = (PCIDevice *) s;\n char req[MPTSAS_MAX_REQUEST_SIZE];\n MPIRequestHeader *hdr = (MPIRequestHeader *)req;\n hwaddr addr;\n int size;\n \n if (s->state != MPI_IOC_STATE_OPERATIONAL) {\n mptsas_set_fault(s, MPI_IOCSTATUS_INVALID_STATE);\n return;\n }\n /* Read the message header from the guest first. */\n addr = s->host_mfa_high_addr | MPTSAS_FIFO_GET(s, request_post);\n pci_dma_read(pci, addr, req, sizeof(hdr));\n }\n", + "target": "static void mptsas_fetch_request(MPTSASState *s)\n{\n PCIDevice *pci = (PCIDevice *) s;\n char req[MPTSAS_MAX_REQUEST_SIZE];\n MPIRequestHeader *hdr = (MPIRequestHeader *)req;\n hwaddr addr;\n int size;\n \n /* Read the message header from the guest first. */\n addr = s->host_mfa_high_addr | MPTSAS_FIFO_GET(s, request_post);\n pci_dma_read(pci, addr, req, sizeof(hdr));\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc7b094a338c6c521f918f478e993f0f74bbea0d", + "input": " InputMethodStatusConnection()\n : current_input_method_changed_(NULL),\n register_ime_properties_(NULL),\n update_ime_property_(NULL),\n connection_change_handler_(NULL),\n language_library_(NULL),\n ibus_(NULL),\n ibus_config_(NULL) {\n }\n", + "target": " InputMethodStatusConnection()\n // Functions that end with Thunk are used to deal with glib callbacks.\n //\n // Note that we cannot use CHROMEG_CALLBACK_0() here as we'll define\n // IBusBusConnected() inline. If we are to define the function outside\n // of the class definition, we should use CHROMEG_CALLBACK_0() here.\n //\n // CHROMEG_CALLBACK_0(Impl,\n // void, IBusBusConnected, IBusBus*);\n static void IBusBusConnectedThunk(IBusBus* sender, gpointer userdata) {\n return reinterpret_cast(userdata)\n ->IBusBusConnected(sender);\n }\n static void IBusBusDisconnectedThunk(IBusBus* sender, gpointer userdata) {\n return reinterpret_cast(userdata)\n ->IBusBusDisconnected(sender);\n }\n static void IBusBusGlobalEngineChangedThunk(IBusBus* sender,\n const gchar* engine_name,\n gpointer userdata) {\n return reinterpret_cast(userdata)\n ->IBusBusGlobalEngineChanged(sender, engine_name);\n }\n static void IBusBusNameOwnerChangedThunk(IBusBus* sender,\n const gchar* name,\n const gchar* old_name,\n const gchar* new_name,\n gpointer userdata) {\n return reinterpret_cast(userdata)\n ->IBusBusNameOwnerChanged(sender, name, old_name, new_name);\n }\n static void FocusInThunk(IBusPanelService* sender,\n const gchar* input_context_path,\n gpointer userdata) {\n return reinterpret_cast(userdata)\n ->FocusIn(sender, input_context_path);\n }\n static void RegisterPropertiesThunk(IBusPanelService* sender,\n IBusPropList* prop_list,\n gpointer userdata) {\n return reinterpret_cast(userdata)\n ->RegisterProperties(sender, prop_list);\n }\n static void UpdatePropertyThunk(IBusPanelService* sender,\n IBusProperty* ibus_prop,\n gpointer userdata) {\n return reinterpret_cast(userdata)\n ->UpdateProperty(sender, ibus_prop);\n }\n\n friend struct DefaultSingletonTraits;\n IBusControllerImpl()\n : ibus_(NULL),\n ibus_config_(NULL) {\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#da087238963c1239fdabd47dc1b65279605aca70", + "input": "int handle(int s, unsigned char* data, int len, struct sockaddr_in *s_in)\n{\n\tchar buf[2048];\n\tunsigned short *cmd = (unsigned short *)buf;\n\tint plen;\n\tstruct in_addr *addr = &s_in->sin_addr;\n\tunsigned short *pid = (unsigned short*) data;\n\n\t/* inet check */\n\tif (len == S_HELLO_LEN && memcmp(data, \"sorbo\", 5) == 0) {\n\t\tunsigned short *id = (unsigned short*) (data+5);\n\t\tint x = 2+4+2;\n\n\t\t*cmd = htons(S_CMD_INET_CHECK);\n\t\tmemcpy(cmd+1, addr, 4);\n\t\tmemcpy(cmd+1+2, id, 2);\n\n\t\tprintf(\"Inet check by %s %d\\n\",\n\t\t inet_ntoa(*addr), ntohs(*id));\n\t\tif (send(s, buf, x, 0) != x)\n\t\t\treturn 1;\n\n\t\treturn 0;\n\t}\n\n \t*cmd++ = htons(S_CMD_PACKET);\n \t*cmd++ = *pid;\n \tplen = len - 2;\n \n \tlast_id = ntohs(*pid);\n \tif (last_id > 20000)\n\t\twrap = 1;\n\tif (wrap && last_id < 100) {\n\t\twrap = 0;\n\t\tmemset(ids, 0, sizeof(ids));\n\t}\n\n\tprintf(\"Got packet %d %d\", last_id, plen);\n\tif (is_dup(last_id)) {\n\t\tprintf(\" (DUP)\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"\\n\");\n\n\t*cmd++ = htons(plen);\n\tmemcpy(cmd, data+2, plen);\n\n\tplen += 2 + 2 + 2;\n\tassert(plen <= (int) sizeof(buf));\n\tif (send(s, buf, plen, 0) != plen)\n\t\treturn 1;\n\n\treturn 0;\n}\n", + "target": "int handle(int s, unsigned char* data, int len, struct sockaddr_in *s_in)\n{\n\tchar buf[2048];\n\tunsigned short *cmd = (unsigned short *)buf;\n\tint plen;\n\tstruct in_addr *addr = &s_in->sin_addr;\n\tunsigned short *pid = (unsigned short*) data;\n\n\t/* inet check */\n\tif (len == S_HELLO_LEN && memcmp(data, \"sorbo\", 5) == 0) {\n\t\tunsigned short *id = (unsigned short*) (data+5);\n\t\tint x = 2+4+2;\n\n\t\t*cmd = htons(S_CMD_INET_CHECK);\n\t\tmemcpy(cmd+1, addr, 4);\n\t\tmemcpy(cmd+1+2, id, 2);\n\n\t\tprintf(\"Inet check by %s %d\\n\",\n\t\t inet_ntoa(*addr), ntohs(*id));\n\t\tif (send(s, buf, x, 0) != x)\n\t\t\treturn 1;\n\n\t\treturn 0;\n\t}\n\n \t*cmd++ = htons(S_CMD_PACKET);\n \t*cmd++ = *pid;\n \tplen = len - 2;\n if (plen < 0)\n return 0;\n \n \tlast_id = ntohs(*pid);\n \tif (last_id > 20000)\n\t\twrap = 1;\n\tif (wrap && last_id < 100) {\n\t\twrap = 0;\n\t\tmemset(ids, 0, sizeof(ids));\n\t}\n\n\tprintf(\"Got packet %d %d\", last_id, plen);\n\tif (is_dup(last_id)) {\n\t\tprintf(\" (DUP)\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"\\n\");\n\n\t*cmd++ = htons(plen);\n\tmemcpy(cmd, data+2, plen);\n\n\tplen += 2 + 2 + 2;\n\tassert(plen <= (int) sizeof(buf));\n\tif (send(s, buf, plen, 0) != plen)\n\t\treturn 1;\n\n\treturn 0;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7f8cdab6fda192d15e45a3e9682b1eec427870c5", + "input": " void ShellWindowFrameView::OnPaint(gfx::Canvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(false);\n paint.setStyle(SkPaint::kFill_Style);\n paint.setColor(SK_ColorWHITE);\n gfx::Path path;\n const int radius = 1;\n path.moveTo(0, radius);\n path.lineTo(radius, 0);\n path.lineTo(width() - radius - 1, 0);\n path.lineTo(width(), radius + 1);\n path.lineTo(width(), kCaptionHeight);\n path.lineTo(0, kCaptionHeight);\n path.close();\n canvas->DrawPath(path, paint);\n}\n", + "target": " void ShellWindowFrameView::OnPaint(gfx::Canvas* canvas) {\n if (is_frameless_)\n return;\n SkPaint paint;\n paint.setAntiAlias(false);\n paint.setStyle(SkPaint::kFill_Style);\n paint.setColor(SK_ColorWHITE);\n gfx::Path path;\n const int radius = 1;\n path.moveTo(0, radius);\n path.lineTo(radius, 0);\n path.lineTo(width() - radius - 1, 0);\n path.lineTo(width(), radius + 1);\n path.lineTo(width(), kCaptionHeight);\n path.lineTo(0, kCaptionHeight);\n path.close();\n canvas->DrawPath(path, paint);\n}\n", + "vul_type": "cwe-79", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6d0249be2275fd4086783f259f4e2c54722a7c55", + "input": "ID3::ID3(const uint8_t *data, size_t size, bool ignoreV1)\n : mIsValid(false),\n mData(NULL),\n mSize(0),\n\n mFirstFrameOffset(0),\n mVersion(ID3_UNKNOWN),\n mRawSize(0) {\n sp source = new MemorySource(data, size);\n \n mIsValid = parseV2(source, 0);\n \n if (!mIsValid && !ignoreV1) {\n mIsValid = parseV1(source);\n }\n}\n", + "target": "ID3::ID3(const uint8_t *data, size_t size, bool ignoreV1)\n : mIsValid(false),\n mData(NULL),\n mSize(0),\n\n mFirstFrameOffset(0),\n mVersion(ID3_UNKNOWN),\n mRawSize(0) {\n sp source = new (std::nothrow) MemorySource(data, size);\n\n if (source == NULL)\n return;\n \n mIsValid = parseV2(source, 0);\n \n if (!mIsValid && !ignoreV1) {\n mIsValid = parseV1(source);\n }\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f911e11e7f6b5c0d6f5ee694a9871de6619889f7", + "input": "void PaintArtifactCompositor::CollectPendingLayers(\n const PaintArtifact& paint_artifact,\n Vector& pending_layers) {\n Vector::const_iterator cursor =\n paint_artifact.PaintChunks().begin();\n LayerizeGroup(paint_artifact, pending_layers,\n *EffectPaintPropertyNode::Root(), cursor);\n DCHECK_EQ(paint_artifact.PaintChunks().end(), cursor);\n }\n", + "target": "void PaintArtifactCompositor::CollectPendingLayers(\n const PaintArtifact& paint_artifact,\n Vector& pending_layers) {\n Vector::const_iterator cursor =\n paint_artifact.PaintChunks().begin();\n LayerizeGroup(paint_artifact, pending_layers, EffectPaintPropertyNode::Root(),\n cursor);\n DCHECK_EQ(paint_artifact.PaintChunks().end(), cursor);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1dcd10aceabbc03bf571ea32b892c522cbe923de", + "input": "ethertype_print(netdissect_options *ndo,\n u_short ether_type, const u_char *p,\n u_int length, u_int caplen,\n const struct lladdr_info *src, const struct lladdr_info *dst)\n{\n\tswitch (ether_type) {\n\n\tcase ETHERTYPE_IP:\n\t ip_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_IPV6:\n\t\tip6_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_ARP:\n\tcase ETHERTYPE_REVARP:\n\t arp_print(ndo, p, length, caplen);\n\t\treturn (1);\n\n\tcase ETHERTYPE_DN:\n\t\tdecnet_print(ndo, p, length, caplen);\n\t\treturn (1);\n\n\tcase ETHERTYPE_ATALK:\n\t\tif (ndo->ndo_vflag)\n\t\t\tND_PRINT((ndo, \"et1 \"));\n\t\tatalk_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_AARP:\n\t\taarp_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_IPX:\n\t\tND_PRINT((ndo, \"(NOV-ETHII) \"));\n\t\tipx_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_ISO:\n\t\tif (length == 0 || caplen == 0) {\n \t\t\tND_PRINT((ndo, \" [|osi]\"));\n \t\t\treturn (1);\n \t\t}\n\t\tisoclns_print(ndo, p + 1, length - 1, caplen - 1);\n \t\treturn(1);\n \n \tcase ETHERTYPE_PPPOED:\n\tcase ETHERTYPE_PPPOES:\n\tcase ETHERTYPE_PPPOED2:\n\tcase ETHERTYPE_PPPOES2:\n\t\tpppoe_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_EAPOL:\n\t eap_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_RRCP:\n\t rrcp_print(ndo, p, length, src, dst);\n\t\treturn (1);\n\n\tcase ETHERTYPE_PPP:\n\t\tif (length) {\n\t\t\tND_PRINT((ndo, \": \"));\n\t\t\tppp_print(ndo, p, length);\n\t\t}\n\t\treturn (1);\n\n\tcase ETHERTYPE_MPCP:\n\t mpcp_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_SLOW:\n\t slow_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_CFM:\n\tcase ETHERTYPE_CFM_OLD:\n\t\tcfm_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_LLDP:\n\t\tlldp_print(ndo, p, length);\n\t\treturn (1);\n\n case ETHERTYPE_NSH:\n nsh_print(ndo, p, length);\n return (1);\n\n case ETHERTYPE_LOOPBACK:\n\t\tloopback_print(ndo, p, length);\n return (1);\n\n\tcase ETHERTYPE_MPLS:\n\tcase ETHERTYPE_MPLS_MULTI:\n\t\tmpls_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_TIPC:\n\t\ttipc_print(ndo, p, length, caplen);\n\t\treturn (1);\n\n\tcase ETHERTYPE_MS_NLB_HB:\n\t\tmsnlb_print(ndo, p);\n\t\treturn (1);\n\n case ETHERTYPE_GEONET_OLD:\n case ETHERTYPE_GEONET:\n geonet_print(ndo, p, length, src);\n return (1);\n\n case ETHERTYPE_CALM_FAST:\n calm_fast_print(ndo, p, length, src);\n return (1);\n\n\tcase ETHERTYPE_AOE:\n\t\taoe_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_MEDSA:\n\t\tmedsa_print(ndo, p, length, caplen, src, dst);\n\t\treturn (1);\n\n\tcase ETHERTYPE_LAT:\n\tcase ETHERTYPE_SCA:\n\tcase ETHERTYPE_MOPRC:\n\tcase ETHERTYPE_MOPDL:\n\tcase ETHERTYPE_IEEE1905_1:\n\t\t/* default_print for now */\n\tdefault:\n\t\treturn (0);\n\t}\n}\n", + "target": "ethertype_print(netdissect_options *ndo,\n u_short ether_type, const u_char *p,\n u_int length, u_int caplen,\n const struct lladdr_info *src, const struct lladdr_info *dst)\n{\n\tswitch (ether_type) {\n\n\tcase ETHERTYPE_IP:\n\t ip_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_IPV6:\n\t\tip6_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_ARP:\n\tcase ETHERTYPE_REVARP:\n\t arp_print(ndo, p, length, caplen);\n\t\treturn (1);\n\n\tcase ETHERTYPE_DN:\n\t\tdecnet_print(ndo, p, length, caplen);\n\t\treturn (1);\n\n\tcase ETHERTYPE_ATALK:\n\t\tif (ndo->ndo_vflag)\n\t\t\tND_PRINT((ndo, \"et1 \"));\n\t\tatalk_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_AARP:\n\t\taarp_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_IPX:\n\t\tND_PRINT((ndo, \"(NOV-ETHII) \"));\n\t\tipx_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_ISO:\n\t\tif (length == 0 || caplen == 0) {\n \t\t\tND_PRINT((ndo, \" [|osi]\"));\n \t\t\treturn (1);\n \t\t}\n\t\tisoclns_print(ndo, p + 1, length - 1);\n \t\treturn(1);\n \n \tcase ETHERTYPE_PPPOED:\n\tcase ETHERTYPE_PPPOES:\n\tcase ETHERTYPE_PPPOED2:\n\tcase ETHERTYPE_PPPOES2:\n\t\tpppoe_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_EAPOL:\n\t eap_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_RRCP:\n\t rrcp_print(ndo, p, length, src, dst);\n\t\treturn (1);\n\n\tcase ETHERTYPE_PPP:\n\t\tif (length) {\n\t\t\tND_PRINT((ndo, \": \"));\n\t\t\tppp_print(ndo, p, length);\n\t\t}\n\t\treturn (1);\n\n\tcase ETHERTYPE_MPCP:\n\t mpcp_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_SLOW:\n\t slow_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_CFM:\n\tcase ETHERTYPE_CFM_OLD:\n\t\tcfm_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_LLDP:\n\t\tlldp_print(ndo, p, length);\n\t\treturn (1);\n\n case ETHERTYPE_NSH:\n nsh_print(ndo, p, length);\n return (1);\n\n case ETHERTYPE_LOOPBACK:\n\t\tloopback_print(ndo, p, length);\n return (1);\n\n\tcase ETHERTYPE_MPLS:\n\tcase ETHERTYPE_MPLS_MULTI:\n\t\tmpls_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_TIPC:\n\t\ttipc_print(ndo, p, length, caplen);\n\t\treturn (1);\n\n\tcase ETHERTYPE_MS_NLB_HB:\n\t\tmsnlb_print(ndo, p);\n\t\treturn (1);\n\n case ETHERTYPE_GEONET_OLD:\n case ETHERTYPE_GEONET:\n geonet_print(ndo, p, length, src);\n return (1);\n\n case ETHERTYPE_CALM_FAST:\n calm_fast_print(ndo, p, length, src);\n return (1);\n\n\tcase ETHERTYPE_AOE:\n\t\taoe_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_MEDSA:\n\t\tmedsa_print(ndo, p, length, caplen, src, dst);\n\t\treturn (1);\n\n\tcase ETHERTYPE_LAT:\n\tcase ETHERTYPE_SCA:\n\tcase ETHERTYPE_MOPRC:\n\tcase ETHERTYPE_MOPDL:\n\tcase ETHERTYPE_IEEE1905_1:\n\t\t/* default_print for now */\n\tdefault:\n\t\treturn (0);\n\t}\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0545ec1ca36b27cb928128870a83e5f668980bc5", + "input": " cff_charset_load( CFF_Charset charset,\n FT_UInt num_glyphs,\n FT_Stream stream,\n FT_ULong base_offset,\n FT_ULong offset,\n FT_Bool invert )\n {\n FT_Memory memory = stream->memory;\n FT_Error error = CFF_Err_Ok;\n FT_UShort glyph_sid;\n\n\n /* If the the offset is greater than 2, we have to parse the */\n /* charset table. */\n if ( offset > 2 )\n {\n FT_UInt j;\n\n\n charset->offset = base_offset + offset;\n\n /* Get the format of the table. */\n if ( FT_STREAM_SEEK( charset->offset ) ||\n FT_READ_BYTE( charset->format ) )\n goto Exit;\n\n /* Allocate memory for sids. */\n if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )\n goto Exit;\n\n /* assign the .notdef glyph */\n charset->sids[0] = 0;\n\n switch ( charset->format )\n {\n case 0:\n if ( num_glyphs > 0 )\n {\n if ( FT_FRAME_ENTER( ( num_glyphs - 1 ) * 2 ) )\n goto Exit;\n \n for ( j = 1; j < num_glyphs; j++ )\n charset->sids[j] = FT_GET_USHORT();\n \n FT_FRAME_EXIT();\n }\n /* Read the first glyph sid of the range. */\n if ( FT_READ_USHORT( glyph_sid ) )\n goto Exit;\n\n /* Read the number of glyphs in the range. */\n if ( charset->format == 2 )\n {\n if ( FT_READ_USHORT( nleft ) )\n goto Exit;\n }\n else\n {\n if ( FT_READ_BYTE( nleft ) )\n goto Exit;\n }\n\n /* Fill in the range of sids -- `nleft + 1' glyphs. */\n for ( i = 0; j < num_glyphs && i <= nleft; i++, j++, glyph_sid++ )\n charset->sids[j] = glyph_sid;\n }\n }\n break;\n\n default:\n FT_ERROR(( \"cff_charset_load: invalid table format!\\n\" ));\n error = CFF_Err_Invalid_File_Format;\n goto Exit;\n }\n", + "target": " cff_charset_load( CFF_Charset charset,\n FT_UInt num_glyphs,\n FT_Stream stream,\n FT_ULong base_offset,\n FT_ULong offset,\n FT_Bool invert )\n {\n FT_Memory memory = stream->memory;\n FT_Error error = CFF_Err_Ok;\n FT_UShort glyph_sid;\n\n\n /* If the the offset is greater than 2, we have to parse the */\n /* charset table. */\n if ( offset > 2 )\n {\n FT_UInt j;\n\n\n charset->offset = base_offset + offset;\n\n /* Get the format of the table. */\n if ( FT_STREAM_SEEK( charset->offset ) ||\n FT_READ_BYTE( charset->format ) )\n goto Exit;\n\n /* Allocate memory for sids. */\n if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )\n goto Exit;\n\n /* assign the .notdef glyph */\n charset->sids[0] = 0;\n\n switch ( charset->format )\n {\n case 0:\n if ( num_glyphs > 0 )\n {\n if ( FT_FRAME_ENTER( ( num_glyphs - 1 ) * 2 ) )\n goto Exit;\n \n for ( j = 1; j < num_glyphs; j++ )\n {\n FT_UShort sid = FT_GET_USHORT();\n\n\n /* this constant is given in the CFF specification */\n if ( sid < 65000 )\n charset->sids[j] = sid;\n else\n {\n FT_ERROR(( \"cff_charset_load:\"\n \" invalid SID value %d set to zero\\n\", sid ));\n charset->sids[j] = 0;\n }\n }\n \n FT_FRAME_EXIT();\n }\n /* Read the first glyph sid of the range. */\n if ( FT_READ_USHORT( glyph_sid ) )\n goto Exit;\n\n /* Read the number of glyphs in the range. */\n if ( charset->format == 2 )\n {\n if ( FT_READ_USHORT( nleft ) )\n goto Exit;\n }\n else\n {\n if ( FT_READ_BYTE( nleft ) )\n goto Exit;\n }\n\n /* Fill in the range of sids -- `nleft + 1' glyphs. */\n for ( i = 0; j < num_glyphs && i <= nleft; i++, j++, glyph_sid++ )\n charset->sids[j] = glyph_sid;\n }\n }\n break;\n\n default:\n FT_ERROR(( \"cff_charset_load: invalid table format!\\n\" ));\n error = CFF_Err_Invalid_File_Format;\n goto Exit;\n }\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a90289b0962663bc1d247bbbd31b9e65b2ca000e", + "input": " ActionReply Smb4KMountHelper::mount(const QVariantMap &args)\n {\n ActionReply reply;\n \n QMapIterator it(args);\n proc.setOutputChannelMode(KProcess::SeparateChannels);\n proc.setProcessEnvironment(QProcessEnvironment::systemEnvironment());\n#if defined(Q_OS_LINUX)\n proc.setEnv(\"PASSWD\", entry[\"mh_url\"].toUrl().password(), true);\n#endif\n QVariantMap entry = it.value().toMap();\n \n KProcess proc(this);\n command << entry[\"mh_mountpoint\"].toString();\n command << entry[\"mh_options\"].toStringList();\n#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)\n command << entry[\"mh_command\"].toString();\n command << entry[\"mh_options\"].toStringList();\n command << entry[\"mh_unc\"].toString();\n command << entry[\"mh_mountpoint\"].toString();\n#else\n#endif\n proc.setProgram(command);\n\n proc.start();\n \n if (proc.waitForStarted(-1))\n {\n bool userKill = false;\n QStringList command;\n #if defined(Q_OS_LINUX)\n command << entry[\"mh_command\"].toString();\n command << entry[\"mh_unc\"].toString();\n command << entry[\"mh_mountpoint\"].toString();\n command << entry[\"mh_options\"].toStringList();\n #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)\n command << entry[\"mh_command\"].toString();\n command << entry[\"mh_options\"].toStringList();\n command << entry[\"mh_unc\"].toString();\n command << entry[\"mh_mountpoint\"].toString();\n else\n {\n }\n\n if (HelperSupport::isStopped())\n {\n proc.kill();\n userKill = true;\n break;\n }\n else\n {\n }\n }\n\n if (proc.exitStatus() == KProcess::CrashExit)\n {\n if (!userKill)\n {\n reply.setType(ActionReply::HelperErrorType);\n reply.setErrorDescription(i18n(\"The mount process crashed.\"));\n break;\n }\n else\n {\n }\n }\n else\n {\n QString stdErr = QString::fromUtf8(proc.readAllStandardError());\n reply.addData(QString(\"mh_error_message_%1\").arg(index), stdErr.trimmed());\n }\n }\n", + "target": " ActionReply Smb4KMountHelper::mount(const QVariantMap &args)\n {\n //\n // The action reply\n //\n ActionReply reply;\n \n // Get the mount executable\n //\n const QString mount = findMountExecutable();\n \n //\n QMapIterator it(args);\n proc.setOutputChannelMode(KProcess::SeparateChannels);\n proc.setProcessEnvironment(QProcessEnvironment::systemEnvironment());\n#if defined(Q_OS_LINUX)\n proc.setEnv(\"PASSWD\", entry[\"mh_url\"].toUrl().password(), true);\n#endif\n QVariantMap entry = it.value().toMap();\n \n // Check the executable\n //\n if (mount != entry[\"mh_command\"].toString())\n {\n // Something weird is going on, bail out.\n reply.setType(ActionReply::HelperErrorType);\n return reply;\n }\n else\n {\n // Do nothing\n }\n \n //\n KProcess proc(this);\n command << entry[\"mh_mountpoint\"].toString();\n command << entry[\"mh_options\"].toStringList();\n#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)\n command << entry[\"mh_command\"].toString();\n command << entry[\"mh_options\"].toStringList();\n command << entry[\"mh_unc\"].toString();\n command << entry[\"mh_mountpoint\"].toString();\n#else\n#endif\n proc.setProgram(command);\n\n proc.start();\n \n if (proc.waitForStarted(-1))\n {\n bool userKill = false;\n QStringList command;\n #if defined(Q_OS_LINUX)\n command << mount;\n command << entry[\"mh_unc\"].toString();\n command << entry[\"mh_mountpoint\"].toString();\n command << entry[\"mh_options\"].toStringList();\n #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)\n command << mount;\n command << entry[\"mh_options\"].toStringList();\n command << entry[\"mh_unc\"].toString();\n command << entry[\"mh_mountpoint\"].toString();\n else\n {\n }\n\n if (HelperSupport::isStopped())\n {\n proc.kill();\n userKill = true;\n break;\n }\n else\n {\n }\n }\n\n if (proc.exitStatus() == KProcess::CrashExit)\n {\n if (!userKill)\n {\n reply.setType(ActionReply::HelperErrorType);\n reply.setErrorDescription(i18n(\"The mount process crashed.\"));\n break;\n }\n else\n {\n }\n }\n else\n {\n QString stdErr = QString::fromUtf8(proc.readAllStandardError());\n reply.addData(QString(\"mh_error_message_%1\").arg(index), stdErr.trimmed());\n }\n }\n", + "vul_type": "cwe-20", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c0569cc04741cccf6548c2169fcc1609d958523f", + "input": "V8ContextNativeHandler::V8ContextNativeHandler(ScriptContext* context)\n : ObjectBackedNativeHandler(context), context_(context) {\n RouteFunction(\"GetAvailability\",\n base::Bind(&V8ContextNativeHandler::GetAvailability,\n base::Unretained(this)));\n RouteFunction(\"GetModuleSystem\",\n base::Bind(&V8ContextNativeHandler::GetModuleSystem,\n base::Unretained(this)));\n RouteFunction(\n \"RunWithNativesEnabled\",\n base::Bind(&V8ContextNativeHandler::RunWithNativesEnabled,\n base::Unretained(this)));\n }\n", + "target": "V8ContextNativeHandler::V8ContextNativeHandler(ScriptContext* context)\n : ObjectBackedNativeHandler(context), context_(context) {\n RouteFunction(\"GetAvailability\",\n base::Bind(&V8ContextNativeHandler::GetAvailability,\n base::Unretained(this)));\n RouteFunction(\"GetModuleSystem\",\n base::Bind(&V8ContextNativeHandler::GetModuleSystem,\n base::Unretained(this)));\n RouteFunction(\"RunWithNativesEnabled\", \"test\",\n base::Bind(&V8ContextNativeHandler::RunWithNativesEnabled,\n base::Unretained(this)));\n }\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#550fd08c2cebad61c548def135f67aba284c6162", + "input": " static void ieee80211_if_setup(struct net_device *dev)\n {\n \tether_setup(dev);\n \tdev->netdev_ops = &ieee80211_dataif_ops;\n \tdev->destructor = free_netdev;\n }\n", + "target": " static void ieee80211_if_setup(struct net_device *dev)\n {\n \tether_setup(dev);\n\tdev->priv_flags &= ~IFF_TX_SKB_SHARING;\n \tdev->netdev_ops = &ieee80211_dataif_ops;\n \tdev->destructor = free_netdev;\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3ca657a8793dd011bf869695d72ad31c779c3cc1", + "input": " horAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)\n {\n \ttmsize_t stride = PredictorState(tif)->stride;\n \tuint32* wp = (uint32*) cp0;\n \ttmsize_t wc = cc / 4;\n \n\tassert((cc%(4*stride))==0);\n \n \tif (wc > stride) {\n \t\twc -= stride;\n\t\tdo {\n\t\t\tREPEAT4(stride, wp[stride] += wp[0]; wp++)\n \t\t\twc -= stride;\n \t\t} while (wc > 0);\n \t}\n }\n", + "target": " horAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)\n {\n \ttmsize_t stride = PredictorState(tif)->stride;\n \tuint32* wp = (uint32*) cp0;\n \ttmsize_t wc = cc / 4;\n \n if((cc%(4*stride))!=0)\n {\n TIFFErrorExt(tif->tif_clientdata, \"horAcc32\",\n \"%s\", \"cc%(4*stride))!=0\");\n return 0;\n }\n \n \tif (wc > stride) {\n \t\twc -= stride;\n\t\tdo {\n\t\t\tREPEAT4(stride, wp[stride] += wp[0]; wp++)\n \t\t\twc -= stride;\n \t\t} while (wc > 0);\n \t}\n\treturn 1;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3ee55637480d5e319a5de0481b01c3346855cbc9", + "input": "xps_select_best_font_encoding(xps_font_t *font)\n{\n static struct { int pid, eid; } xps_cmap_list[] =\n {\n { 3, 10 }, /* Unicode with surrogates */\n { 3, 1 }, /* Unicode without surrogates */\n { 3, 5 }, /* Wansung */\n { 3, 4 }, /* Big5 */\n { 3, 3 }, /* Prc */\n { 3, 2 }, /* ShiftJis */\n { 3, 0 }, /* Symbol */\n { 1, 0 },\n { -1, -1 },\n };\n\n int i, k, n, pid, eid;\n\n n = xps_count_font_encodings(font);\n for (k = 0; xps_cmap_list[k].pid != -1; k++)\n {\n for (i = 0; i < n; i++)\n {\n xps_identify_font_encoding(font, i, &pid, &eid);\n if (pid == xps_cmap_list[k].pid && eid == xps_cmap_list[k].eid)\n {\n xps_select_font_encoding(font, i);\n return;\n }\n }\n }\n\n gs_warn(\"could not find a suitable cmap\");\n}\n", + "target": "xps_select_best_font_encoding(xps_font_t *font)\n{\n static struct { int pid, eid; } xps_cmap_list[] =\n {\n { 3, 10 }, /* Unicode with surrogates */\n { 3, 1 }, /* Unicode without surrogates */\n { 3, 5 }, /* Wansung */\n { 3, 4 }, /* Big5 */\n { 3, 3 }, /* Prc */\n { 3, 2 }, /* ShiftJis */\n { 3, 0 }, /* Symbol */\n { 1, 0 },\n { -1, -1 },\n };\n\n int i, k, n, pid, eid;\n\n n = xps_count_font_encodings(font);\n for (k = 0; xps_cmap_list[k].pid != -1; k++)\n {\n for (i = 0; i < n; i++)\n {\n xps_identify_font_encoding(font, i, &pid, &eid);\n if (pid == xps_cmap_list[k].pid && eid == xps_cmap_list[k].eid)\n {\n if (xps_select_font_encoding(font, i))\n return;\n }\n }\n }\n\n gs_warn(\"could not find a suitable cmap\");\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c27a3e4d667fdcad3db7b104f75659478e0c68d8", + "input": "static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac,\n\t\t\t\t\t struct ceph_authorizer *a, size_t len)\n{\n\tstruct ceph_x_authorizer *au = (void *)a;\n \tstruct ceph_x_ticket_handler *th;\n \tint ret = 0;\n \tstruct ceph_x_authorize_reply reply;\n \tvoid *p = au->reply_buf;\n \tvoid *end = p + sizeof(au->reply_buf);\n \n \tth = get_ticket_handler(ac, au->service);\n \tif (IS_ERR(th))\n \t\treturn PTR_ERR(th);\n\tret = ceph_x_decrypt(&th->session_key, &p, end, &reply, sizeof(reply));\n \tif (ret < 0)\n \t\treturn ret;\n \tif (ret != sizeof(reply))\n\t\treturn -EPERM;\n\n\tif (au->nonce + 1 != le64_to_cpu(reply.nonce_plus_one))\n\t\tret = -EPERM;\n\telse\n\t\tret = 0;\n\tdout(\"verify_authorizer_reply nonce %llx got %llx ret %d\\n\",\n\t au->nonce, le64_to_cpu(reply.nonce_plus_one), ret);\n\treturn ret;\n}\n", + "target": "static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac,\n\t\t\t\t\t struct ceph_authorizer *a, size_t len)\n{\n\tstruct ceph_x_authorizer *au = (void *)a;\n \tstruct ceph_x_ticket_handler *th;\n \tint ret = 0;\n \tstruct ceph_x_authorize_reply reply;\n\tvoid *preply = &reply;\n \tvoid *p = au->reply_buf;\n \tvoid *end = p + sizeof(au->reply_buf);\n \n \tth = get_ticket_handler(ac, au->service);\n \tif (IS_ERR(th))\n \t\treturn PTR_ERR(th);\n\tret = ceph_x_decrypt(&th->session_key, &p, end, &preply, sizeof(reply));\n \tif (ret < 0)\n \t\treturn ret;\n \tif (ret != sizeof(reply))\n\t\treturn -EPERM;\n\n\tif (au->nonce + 1 != le64_to_cpu(reply.nonce_plus_one))\n\t\tret = -EPERM;\n\telse\n\t\tret = 0;\n\tdout(\"verify_authorizer_reply nonce %llx got %llx ret %d\\n\",\n\t au->nonce, le64_to_cpu(reply.nonce_plus_one), ret);\n\treturn ret;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#35ab4475a7df9b2a4bcab235e379c0c3ec543658", + "input": "GF_Err cat_multiple_files(GF_ISOFile *dest, char *fileName, u32 import_flags, Double force_fps, u32 frames_per_sample, char *tmp_dir, Bool force_cat, Bool align_timelines, Bool allow_add_in_command)\n{\n\tCATEnum cat_enum;\n\tchar *sep;\n\n\tcat_enum.dest = dest;\n\tcat_enum.import_flags = import_flags;\n\tcat_enum.force_fps = force_fps;\n\tcat_enum.frames_per_sample = frames_per_sample;\n\tcat_enum.tmp_dir = tmp_dir;\n\tcat_enum.force_cat = force_cat;\n \tcat_enum.align_timelines = align_timelines;\n \tcat_enum.allow_add_in_command = allow_add_in_command;\n \n \tstrcpy(cat_enum.szPath, fileName);\n \tsep = strrchr(cat_enum.szPath, GF_PATH_SEPARATOR);\n \tif (!sep) sep = strrchr(cat_enum.szPath, '/');\n \tif (!sep) {\n \t\tstrcpy(cat_enum.szPath, \".\");\n \t\tstrcpy(cat_enum.szRad1, fileName);\n \t} else {\n \t\tstrcpy(cat_enum.szRad1, sep+1);\n \t\tsep[0] = 0;\n \t}\n \tsep = strchr(cat_enum.szRad1, '*');\n \tstrcpy(cat_enum.szRad2, sep+1);\n \tsep[0] = 0;\n \tsep = strchr(cat_enum.szRad2, '%');\n \tif (!sep) sep = strchr(cat_enum.szRad2, '#');\n \tif (!sep) sep = strchr(cat_enum.szRad2, ':');\n \tstrcpy(cat_enum.szOpt, \"\");\n \tif (sep) {\n \t\tstrcpy(cat_enum.szOpt, sep);\n \t\tsep[0] = 0;\n \t}\n\treturn gf_enum_directory(cat_enum.szPath, 0, cat_enumerate, &cat_enum, NULL);\n}\n", + "target": "GF_Err cat_multiple_files(GF_ISOFile *dest, char *fileName, u32 import_flags, Double force_fps, u32 frames_per_sample, char *tmp_dir, Bool force_cat, Bool align_timelines, Bool allow_add_in_command)\n{\n\tCATEnum cat_enum;\n\tchar *sep;\n\n\tcat_enum.dest = dest;\n\tcat_enum.import_flags = import_flags;\n\tcat_enum.force_fps = force_fps;\n\tcat_enum.frames_per_sample = frames_per_sample;\n\tcat_enum.tmp_dir = tmp_dir;\n\tcat_enum.force_cat = force_cat;\n \tcat_enum.align_timelines = align_timelines;\n \tcat_enum.allow_add_in_command = allow_add_in_command;\n \n\tif (strlen(fileName) >= sizeof(cat_enum.szPath)) {\n\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"File name %s is too long.\\n\", fileName));\n\t\treturn GF_NOT_SUPPORTED;\n\t}\n \tstrcpy(cat_enum.szPath, fileName);\n \tsep = strrchr(cat_enum.szPath, GF_PATH_SEPARATOR);\n \tif (!sep) sep = strrchr(cat_enum.szPath, '/');\n \tif (!sep) {\n \t\tstrcpy(cat_enum.szPath, \".\");\n\t\tif (strlen(fileName) >= sizeof(cat_enum.szRad1)) {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"File name %s is too long.\\n\", fileName));\n\t\t\treturn GF_NOT_SUPPORTED;\n\t\t}\n \t\tstrcpy(cat_enum.szRad1, fileName);\n \t} else {\n\t\tif (strlen(sep + 1) >= sizeof(cat_enum.szRad1)) {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"File name %s is too long.\\n\", (sep + 1)));\n\t\t\treturn GF_NOT_SUPPORTED;\n\t\t}\n \t\tstrcpy(cat_enum.szRad1, sep+1);\n \t\tsep[0] = 0;\n \t}\n \tsep = strchr(cat_enum.szRad1, '*');\n\tif (strlen(sep + 1) >= sizeof(cat_enum.szRad2)) {\n\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"File name %s is too long.\\n\", (sep + 1)));\n\t\treturn GF_NOT_SUPPORTED;\n\t}\n \tstrcpy(cat_enum.szRad2, sep+1);\n \tsep[0] = 0;\n \tsep = strchr(cat_enum.szRad2, '%');\n \tif (!sep) sep = strchr(cat_enum.szRad2, '#');\n \tif (!sep) sep = strchr(cat_enum.szRad2, ':');\n \tstrcpy(cat_enum.szOpt, \"\");\n \tif (sep) {\n\t\tif (strlen(sep) >= sizeof(cat_enum.szOpt)) {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Invalid option: %s.\\n\", sep));\n\t\t\treturn GF_NOT_SUPPORTED;\n\t\t}\n \t\tstrcpy(cat_enum.szOpt, sep);\n \t\tsep[0] = 0;\n \t}\n\treturn gf_enum_directory(cat_enum.szPath, 0, cat_enumerate, &cat_enum, NULL);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9ab4233dd08036fe34a89c7dc6f47a8bf2eb29eb", + "input": "static long madvise_remove(struct vm_area_struct *vma,\n\t\t\t\tstruct vm_area_struct **prev,\n\t\t\t\tunsigned long start, unsigned long end)\n {\n \tloff_t offset;\n \tint error;\n \n \t*prev = NULL;\t/* tell sys_madvise we drop mmap_sem */\n \n \tif (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB))\n \t\treturn -EINVAL;\n \n\tif (!vma->vm_file || !vma->vm_file->f_mapping\n\t\t|| !vma->vm_file->f_mapping->host) {\n \t\t\treturn -EINVAL;\n \t}\n \n\tif ((vma->vm_flags & (VM_SHARED|VM_WRITE)) != (VM_SHARED|VM_WRITE))\n\t\treturn -EACCES;\n\n \toffset = (loff_t)(start - vma->vm_start)\n \t\t\t+ ((loff_t)vma->vm_pgoff << PAGE_SHIFT);\n \n\t/* filesystem's fallocate may need to take i_mutex */\n \tup_read(¤t->mm->mmap_sem);\n\terror = do_fallocate(vma->vm_file,\n \t\t\t\tFALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,\n \t\t\t\toffset, end - start);\n \tdown_read(¤t->mm->mmap_sem);\n \treturn error;\n }\n", + "target": "static long madvise_remove(struct vm_area_struct *vma,\n\t\t\t\tstruct vm_area_struct **prev,\n\t\t\t\tunsigned long start, unsigned long end)\n {\n \tloff_t offset;\n \tint error;\n\tstruct file *f;\n \n \t*prev = NULL;\t/* tell sys_madvise we drop mmap_sem */\n \n \tif (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB))\n \t\treturn -EINVAL;\n \n\tf = vma->vm_file;\n\n\tif (!f || !f->f_mapping || !f->f_mapping->host) {\n \t\t\treturn -EINVAL;\n \t}\n \n\tif ((vma->vm_flags & (VM_SHARED|VM_WRITE)) != (VM_SHARED|VM_WRITE))\n\t\treturn -EACCES;\n\n \toffset = (loff_t)(start - vma->vm_start)\n \t\t\t+ ((loff_t)vma->vm_pgoff << PAGE_SHIFT);\n \n\t/*\n\t * Filesystem's fallocate may need to take i_mutex. We need to\n\t * explicitly grab a reference because the vma (and hence the\n\t * vma's reference to the file) can go away as soon as we drop\n\t * mmap_sem.\n\t */\n\tget_file(f);\n \tup_read(¤t->mm->mmap_sem);\n\terror = do_fallocate(f,\n \t\t\t\tFALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,\n \t\t\t\toffset, end - start);\n\tfput(f);\n \tdown_read(¤t->mm->mmap_sem);\n \treturn error;\n }\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e0a5a02b0fc1900a69d6c37ed0aab36fb8494e6d", + "input": " ikev1_attrmap_print(netdissect_options *ndo,\n\t\t const u_char *p, const u_char *ep,\n \t\t const struct attrmap *map, size_t nmap)\n {\n \tint totlen;\n \tuint32_t t, v;\n \n \tif (p[0] & 0x80)\n \t\ttotlen = 4;\n\telse\n \t\ttotlen = 4 + EXTRACT_16BITS(&p[2]);\n\tif (ep < p + totlen) {\n \t\tND_PRINT((ndo,\"[|attr]\"));\n\t\treturn ep + 1;\n \t}\n \n \tND_PRINT((ndo,\"(\"));\n \tt = EXTRACT_16BITS(&p[0]) & 0x7fff;\n \tif (map && t < nmap && map[t].type)\n\t\tND_PRINT((ndo,\"type=%s \", map[t].type));\n\telse\n \t\tND_PRINT((ndo,\"type=#%d \", t));\n \tif (p[0] & 0x80) {\n \t\tND_PRINT((ndo,\"value=\"));\n \t\tv = EXTRACT_16BITS(&p[2]);\n \t\tif (map && t < nmap && v < map[t].nvalue && map[t].value[v])\n \t\t\tND_PRINT((ndo,\"%s\", map[t].value[v]));\n\t\telse\n\t\t\trawprint(ndo, (const uint8_t *)&p[2], 2);\n \t} else {\n\t\tND_PRINT((ndo,\"len=%d value=\", EXTRACT_16BITS(&p[2])));\n\t\trawprint(ndo, (const uint8_t *)&p[4], EXTRACT_16BITS(&p[2]));\n \t}\n \tND_PRINT((ndo,\")\"));\n \treturn p + totlen;\n }\n", + "target": " ikev1_attrmap_print(netdissect_options *ndo,\n\t\t const u_char *p, const u_char *ep2,\n \t\t const struct attrmap *map, size_t nmap)\n {\n \tint totlen;\n \tuint32_t t, v;\n \n\tND_TCHECK(p[0]);\n \tif (p[0] & 0x80)\n \t\ttotlen = 4;\n\telse {\n\t\tND_TCHECK_16BITS(&p[2]);\n \t\ttotlen = 4 + EXTRACT_16BITS(&p[2]);\n\t}\n\tif (ep2 < p + totlen) {\n \t\tND_PRINT((ndo,\"[|attr]\"));\n\t\treturn ep2 + 1;\n \t}\n \n\tND_TCHECK_16BITS(&p[0]);\n \tND_PRINT((ndo,\"(\"));\n \tt = EXTRACT_16BITS(&p[0]) & 0x7fff;\n \tif (map && t < nmap && map[t].type)\n\t\tND_PRINT((ndo,\"type=%s \", map[t].type));\n\telse\n \t\tND_PRINT((ndo,\"type=#%d \", t));\n \tif (p[0] & 0x80) {\n \t\tND_PRINT((ndo,\"value=\"));\n\t\tND_TCHECK_16BITS(&p[2]);\n \t\tv = EXTRACT_16BITS(&p[2]);\n \t\tif (map && t < nmap && v < map[t].nvalue && map[t].value[v])\n \t\t\tND_PRINT((ndo,\"%s\", map[t].value[v]));\n\t\telse {\n\t\t\tif (!rawprint(ndo, (const uint8_t *)&p[2], 2)) {\n\t\t\t\tND_PRINT((ndo,\")\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t}\n \t} else {\n\t\tND_PRINT((ndo,\"len=%d value=\", totlen - 4));\n\t\tif (!rawprint(ndo, (const uint8_t *)&p[4], totlen - 4)) {\n\t\t\tND_PRINT((ndo,\")\"));\n\t\t\tgoto trunc;\n\t\t}\n \t}\n \tND_PRINT((ndo,\")\"));\n \treturn p + totlen;\n\ntrunc:\n\treturn NULL;\n }\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#88c4913f11967abfd08a8b22b4423710322ac49b", + "input": " CCLayerTreeHostTest()\n : m_beginning(false)\n , m_endWhenBeginReturns(false)\n , m_running(false)\n , m_timedOut(false)\n {\n m_webThread = adoptPtr(webKitPlatformSupport()->createThread(\"CCLayerTreeHostTest\"));\n WebCompositor::setThread(m_webThread.get());\n#if USE(THREADED_COMPOSITING)\n m_settings.enableCompositorThread = true;\n#else\n m_settings.enableCompositorThread = false;\n #endif\n }\n", + "target": " CCLayerTreeHostTest()\n : m_beginning(false)\n , m_endWhenBeginReturns(false)\n , m_timedOut(false)\n {\n m_webThread = adoptPtr(webKitPlatformSupport()->createThread(\"CCLayerTreeHostTest\"));\n WebCompositor::setThread(m_webThread.get());\n#ifndef NDEBUG\n CCProxy::setMainThread(currentThread());\n #endif\n ASSERT(CCProxy::isMainThread());\n m_mainThreadProxy = CCScopedMainThreadProxy::create();\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e1e0c4301aaa8228e362f2409dbde2d4d1896866", + "input": "void Document::open()\n{\n ASSERT(!importLoader());\n\n if (m_frame) {\n if (ScriptableDocumentParser* parser = scriptableDocumentParser()) {\n if (parser->isParsing()) {\n if (parser->isExecutingScript())\n return;\n\n if (!parser->wasCreatedByScript() && parser->hasInsertionPoint())\n return;\n }\n }\n\n if (m_frame->loader().provisionalDocumentLoader())\n m_frame->loader().stopAllLoaders();\n }\n\n removeAllEventListenersRecursively();\n implicitOpen(ForceSynchronousParsing);\n if (ScriptableDocumentParser* parser = scriptableDocumentParser())\n parser->setWasCreatedByScript(true);\n \n if (m_frame)\n m_frame->loader().didExplicitOpen();\n if (m_loadEventProgress != LoadEventInProgress && m_loadEventProgress != UnloadEventInProgress)\n m_loadEventProgress = LoadEventNotRun;\n }\n", + "target": "void Document::open()\n{\n ASSERT(!importLoader());\n\n if (m_frame) {\n if (ScriptableDocumentParser* parser = scriptableDocumentParser()) {\n if (parser->isParsing()) {\n if (parser->isExecutingScript())\n return;\n\n if (!parser->wasCreatedByScript() && parser->hasInsertionPoint())\n return;\n }\n }\n\n if (m_frame->loader().provisionalDocumentLoader())\n m_frame->loader().stopAllLoaders();\n }\n\n removeAllEventListenersRecursively();\n implicitOpen(ForceSynchronousParsing);\n if (ScriptableDocumentParser* parser = scriptableDocumentParser())\n parser->setWasCreatedByScript(true);\n \n if (m_frame)\n m_frame->loader().didExplicitOpen();\n if (m_loadEventProgress != LoadEventInProgress && pageDismissalEventBeingDispatched() == NoDismissal)\n m_loadEventProgress = LoadEventNotRun;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#53110871935244816bbb9d131da0bccff734bfe9", + "input": "static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len)\n{\n\tint rlen, remain;\n\tdpIOCtxPtr dctx;\n\tdynamicPtr *dp;\n\n\tdctx = (dpIOCtxPtr) ctx;\n\tdp = dctx->dp;\n\n\tremain = dp->logicalSize - dp->pos;\n \tif(remain >= len) {\n \t\trlen = len;\n \t} else {\n\t\tif(remain == 0) {\n \t\t\t/* 2.0.34: EOF is incorrect. We use 0 for\n \t\t\t * errors and EOF, just like fileGetbuf,\n \t\t\t * which is a simple fread() wrapper.\n\t\t\t * TBB. Original bug report: Daniel Cowgill. */\n\t\t\treturn 0; /* NOT EOF */\n\t\t}\n\n\t\trlen = remain;\n\t}\n\n\tmemcpy(buf, (void *) ((char *)dp->data + dp->pos), rlen);\n\tdp->pos += rlen;\n\n\treturn rlen;\n}\n", + "target": "static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len)\n{\n\tint rlen, remain;\n\tdpIOCtxPtr dctx;\n\tdynamicPtr *dp;\n\n\tdctx = (dpIOCtxPtr) ctx;\n\tdp = dctx->dp;\n\n\tremain = dp->logicalSize - dp->pos;\n \tif(remain >= len) {\n \t\trlen = len;\n \t} else {\n\t\tif(remain <= 0) {\n \t\t\t/* 2.0.34: EOF is incorrect. We use 0 for\n \t\t\t * errors and EOF, just like fileGetbuf,\n \t\t\t * which is a simple fread() wrapper.\n\t\t\t * TBB. Original bug report: Daniel Cowgill. */\n\t\t\treturn 0; /* NOT EOF */\n\t\t}\n\n\t\trlen = remain;\n\t}\n\n\tmemcpy(buf, (void *) ((char *)dp->data + dp->pos), rlen);\n\tdp->pos += rlen;\n\n\treturn rlen;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ac149a8d4371c0e01e0934fdd57b09e86f96b5b9", + "input": "static int hid_copy_transfer_data(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size) {\n\tstruct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);\n\tstruct libusb_context *ctx = DEVICE_CTX(transfer->dev_handle->dev);\n\tstruct windows_transfer_priv *transfer_priv = usbi_transfer_get_os_priv(itransfer);\n\tint r = LIBUSB_TRANSFER_COMPLETED;\n\tuint32_t corrected_size = io_size;\n\tif (transfer_priv->hid_buffer != NULL) {\n\t\tif (transfer_priv->hid_dest != NULL) {\t// Data readout\n\t\t\tif (corrected_size > transfer_priv->hid_expected_size) {\n\t\t\t\tusbi_err(ctx, \"OVERFLOW!\");\n\t\t\t\tcorrected_size = (uint32_t)transfer_priv->hid_expected_size;\n\t\t\t\tr = LIBUSB_TRANSFER_OVERFLOW;\n\t\t\t}\n\t\t\tif (transfer_priv->hid_buffer[0] == 0) {\n\t\t\t\tcorrected_size--;\n\t\t\t\tmemcpy(transfer_priv->hid_dest, transfer_priv->hid_buffer+1, corrected_size);\n\t\t\t} else {\n\t\t\t\tmemcpy(transfer_priv->hid_dest, transfer_priv->hid_buffer, corrected_size);\n\t\t\t}\n\t\t\ttransfer_priv->hid_dest = NULL;\n\t\t}\n\t\tsafe_free(transfer_priv->hid_buffer);\n\t}\n\titransfer->transferred += corrected_size;\n\treturn r;\n}\n", + "target": "static int hid_copy_transfer_data(int sub_api, struct usbi_transfer *itransfer, uint32_t io_size) {\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#0-dfc76ecee75b", + "input": " def likeComments(self,commentid,userid):\n sqlText=\"insert into comment_like values(%d,%d);\"%(userid,commentid)\n result=sql.insertDB(self.conn,sqlText)\n return result;", + "target": " def likeComments(self,commentid,userid):\n sqlText=\"insert into comment_like values(%s,%s);\"\n params=[userid,commentid]\n result=sql.insertDB(self.conn,sqlText,params)\n return result;", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#cc4a7391c616be7a64ed65742ef9ed3f106eb165", + "input": "l2tp_msgtype_print(netdissect_options *ndo, const u_char *dat)\n {\n \tconst uint16_t *ptr = (const uint16_t *)dat;\n \n \tND_PRINT((ndo, \"%s\", tok2str(l2tp_msgtype2str, \"MSGTYPE-#%u\",\n \t EXTRACT_16BITS(ptr))));\n }\n", + "target": "l2tp_msgtype_print(netdissect_options *ndo, const u_char *dat)\nl2tp_msgtype_print(netdissect_options *ndo, const u_char *dat, u_int length)\n {\n \tconst uint16_t *ptr = (const uint16_t *)dat;\n \n\tif (length < 2) {\n\t\tND_PRINT((ndo, \"AVP too short\"));\n\t\treturn;\n\t}\n \tND_PRINT((ndo, \"%s\", tok2str(l2tp_msgtype2str, \"MSGTYPE-#%u\",\n \t EXTRACT_16BITS(ptr))));\n }\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#532c34b5fbf1687df63b3fcd5b2846312ac943c6", + "input": "static int sclp_ctl_ioctl_sccb(void __user *user_area)\n {\n \tstruct sclp_ctl_sccb ctl_sccb;\n \tstruct sccb_header *sccb;\n \tint rc;\n \n \tif (copy_from_user(&ctl_sccb, user_area, sizeof(ctl_sccb)))\n\t\treturn -EFAULT;\n\tif (!sclp_ctl_cmdw_supported(ctl_sccb.cmdw))\n\t\treturn -EOPNOTSUPP;\n \tsccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);\n \tif (!sccb)\n \t\treturn -ENOMEM;\n\tif (copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), sizeof(*sccb))) {\n \t\trc = -EFAULT;\n \t\tgoto out_free;\n \t}\n\tif (sccb->length > PAGE_SIZE || sccb->length < 8)\n\t\treturn -EINVAL;\n\tif (copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), sccb->length)) {\n\t\trc = -EFAULT;\n \t\tgoto out_free;\n \t}\n \trc = sclp_sync_request(ctl_sccb.cmdw, sccb);\n\tif (rc)\n\t\tgoto out_free;\n\tif (copy_to_user(u64_to_uptr(ctl_sccb.sccb), sccb, sccb->length))\n\t\trc = -EFAULT;\nout_free:\n\tfree_page((unsigned long) sccb);\n\treturn rc;\n}\n", + "target": "static int sclp_ctl_ioctl_sccb(void __user *user_area)\n {\n \tstruct sclp_ctl_sccb ctl_sccb;\n \tstruct sccb_header *sccb;\n\tunsigned long copied;\n \tint rc;\n \n \tif (copy_from_user(&ctl_sccb, user_area, sizeof(ctl_sccb)))\n\t\treturn -EFAULT;\n\tif (!sclp_ctl_cmdw_supported(ctl_sccb.cmdw))\n\t\treturn -EOPNOTSUPP;\n \tsccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);\n \tif (!sccb)\n \t\treturn -ENOMEM;\n\tcopied = PAGE_SIZE -\n\t\tcopy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), PAGE_SIZE);\n\tif (offsetof(struct sccb_header, length) +\n\t sizeof(sccb->length) > copied || sccb->length > copied) {\n \t\trc = -EFAULT;\n \t\tgoto out_free;\n \t}\n\tif (sccb->length < 8) {\n\t\trc = -EINVAL;\n \t\tgoto out_free;\n \t}\n \trc = sclp_sync_request(ctl_sccb.cmdw, sccb);\n\tif (rc)\n\t\tgoto out_free;\n\tif (copy_to_user(u64_to_uptr(ctl_sccb.sccb), sccb, sccb->length))\n\t\trc = -EFAULT;\nout_free:\n\tfree_page((unsigned long) sccb);\n\treturn rc;\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#78d89fe556cb5dabbc47b4967cdf55e607e29580", + "input": " void AcceleratedStaticBitmapImage::EnsureMailbox(MailboxSyncMode mode,\n GLenum filter) {\n if (!texture_holder_->IsMailboxTextureHolder()) {\n TRACE_EVENT0(\"blink\", \"AcceleratedStaticBitmapImage::EnsureMailbox\");\n \n if (!original_skia_image_) {\n RetainOriginalSkImage();\n }\n\n texture_holder_ = std::make_unique(\n std::move(texture_holder_), filter);\n }\n texture_holder_->Sync(mode);\n }\n", + "target": " void AcceleratedStaticBitmapImage::EnsureMailbox(MailboxSyncMode mode,\n GLenum filter) {\n DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);\n if (!texture_holder_->IsMailboxTextureHolder()) {\n TRACE_EVENT0(\"blink\", \"AcceleratedStaticBitmapImage::EnsureMailbox\");\n \n if (!original_skia_image_) {\n RetainOriginalSkImage();\n }\n\n texture_holder_ = std::make_unique(\n std::move(texture_holder_), filter);\n }\n texture_holder_->Sync(mode);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#828eab2216a765dea92575c290421c115b8ad028", + "input": "void IOThread::RegisterPrefs(PrefRegistrySimple* registry) {\n registry->RegisterStringPref(prefs::kAuthSchemes,\n \"basic,digest,ntlm,negotiate,\"\n \"spdyproxy\");\n registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false);\n registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false);\n registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string());\n registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist,\n std::string());\n registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string());\n registry->RegisterStringPref(prefs::kSpdyProxyAuthOrigin, std::string());\n registry->RegisterBooleanPref(prefs::kEnableReferrers, true);\n registry->RegisterInt64Pref(prefs::kHttpReceivedContentLength, 0);\n registry->RegisterInt64Pref(prefs::kHttpOriginalContentLength, 0);\n#if defined(OS_ANDROID) || defined(OS_IOS)\n registry->RegisterListPref(prefs::kDailyHttpOriginalContentLength);\n registry->RegisterListPref(prefs::kDailyHttpReceivedContentLength);\n registry->RegisterListPref(\n prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled);\n registry->RegisterListPref(\n prefs::kDailyContentLengthWithDataReductionProxyEnabled);\n registry->RegisterListPref(\n prefs::kDailyOriginalContentLengthViaDataReductionProxy);\n registry->RegisterListPref(\n prefs::kDailyContentLengthViaDataReductionProxy);\n registry->RegisterInt64Pref(prefs::kDailyHttpContentLengthLastUpdateDate, 0L);\n#endif\n registry->RegisterBooleanPref(prefs::kBuiltInDnsClientEnabled, true);\n}\n", + "target": "void IOThread::RegisterPrefs(PrefRegistrySimple* registry) {\n registry->RegisterStringPref(prefs::kAuthSchemes,\n \"basic,digest,ntlm,negotiate,\"\n \"spdyproxy\");\n registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false);\n registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false);\n registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string());\n registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist,\n std::string());\n registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string());\n registry->RegisterStringPref(prefs::kSpdyProxyAuthOrigin, std::string());\n registry->RegisterBooleanPref(prefs::kEnableReferrers, true);\n registry->RegisterInt64Pref(prefs::kHttpReceivedContentLength, 0);\n registry->RegisterInt64Pref(prefs::kHttpOriginalContentLength, 0);\n#if defined(OS_ANDROID) || defined(OS_IOS)\n registry->RegisterListPref(prefs::kDailyHttpOriginalContentLength);\n registry->RegisterListPref(prefs::kDailyHttpReceivedContentLength);\n registry->RegisterListPref(\n prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled);\n registry->RegisterListPref(\n prefs::kDailyContentLengthWithDataReductionProxyEnabled);\n registry->RegisterListPref(\n prefs::kDailyContentLengthHttpsWithDataReductionProxyEnabled);\n registry->RegisterListPref(\n prefs::kDailyContentLengthShortBypassWithDataReductionProxyEnabled);\n registry->RegisterListPref(\n prefs::kDailyContentLengthLongBypassWithDataReductionProxyEnabled);\n registry->RegisterListPref(\n prefs::kDailyContentLengthUnknownWithDataReductionProxyEnabled);\n registry->RegisterListPref(\n prefs::kDailyOriginalContentLengthViaDataReductionProxy);\n registry->RegisterListPref(\n prefs::kDailyContentLengthViaDataReductionProxy);\n registry->RegisterInt64Pref(prefs::kDailyHttpContentLengthLastUpdateDate, 0L);\n#endif\n registry->RegisterBooleanPref(prefs::kBuiltInDnsClientEnabled, true);\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d4cd2b2c0953ad7e9fa988c234eb9361be80fe81", + "input": "InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient)\n : m_instrumentingAgents(InstrumentingAgents::create())\n , m_injectedScriptManager(InjectedScriptManager::createForPage())\n , m_state(adoptPtr(new InspectorCompositeState(inspectorClient)))\n , m_overlay(InspectorOverlay::create(page, inspectorClient))\n , m_page(page)\n , m_inspectorClient(inspectorClient)\n , m_isUnderTest(false)\n{\n m_agents.append(InspectorAgent::create(page, m_injectedScriptManager.get(), m_instrumentingAgents.get(), m_state.get()));\n\n OwnPtr pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_state.get(), m_injectedScriptManager.get(), inspectorClient, m_overlay.get()));\n InspectorPageAgent* pageAgent = pageAgentPtr.get();\n m_agents.append(pageAgentPtr.release());\n\n OwnPtr domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get(), m_injectedScriptManager.get(), m_overlay.get(), inspectorClient));\n InspectorDOMAgent* domAgent = domAgentPtr.get();\n m_agents.append(domAgentPtr.release());\n \n OwnPtr resourceAgentPtr(InspectorResourceAgent::create(m_instrumentingAgents.get(), pageAgent, inspectorClient, m_state.get(), m_overlay.get()));\n InspectorResourceAgent* resourceAgent = resourceAgentPtr.get();\n m_agents.append(resourceAgentPtr.release());\n \n m_agents.append(InspectorCSSAgent::create(m_instrumentingAgents.get(), m_state.get(), domAgent, pageAgent, resourceAgent));\n\n m_agents.append(InspectorDatabaseAgent::create(m_instrumentingAgents.get(), m_state.get()));\n\n m_agents.append(InspectorIndexedDBAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), pageAgent));\n\n m_agents.append(InspectorFileSystemAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get()));\n\n m_agents.append(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get()));\n\n OwnPtr memoryAgentPtr(InspectorMemoryAgent::create(m_instrumentingAgents.get(), m_state.get()));\n m_memoryAgent = memoryAgentPtr.get();\n m_agents.append(memoryAgentPtr.release());\n\n OwnPtr timelineAgentPtr(InspectorTimelineAgent::create(m_instrumentingAgents.get(), pageAgent, m_memoryAgent, domAgent, m_state.get(),\n InspectorTimelineAgent::PageInspector, inspectorClient));\n m_timelineAgent = timelineAgentPtr.get();\n m_agents.append(timelineAgentPtr.release());\n\n m_agents.append(InspectorApplicationCacheAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent));\n\n PageScriptDebugServer* pageScriptDebugServer = &PageScriptDebugServer::shared();\n\n m_agents.append(PageRuntimeAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), pageScriptDebugServer, page, pageAgent));\n\n OwnPtr consoleAgentPtr(PageConsoleAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), domAgent, m_timelineAgent));\n InspectorConsoleAgent* consoleAgent = consoleAgentPtr.get();\n m_agents.append(consoleAgentPtr.release());\n\n OwnPtr debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), pageScriptDebugServer, pageAgent, m_injectedScriptManager.get(), m_overlay.get()));\n InspectorDebuggerAgent* debuggerAgent = debuggerAgentPtr.get();\n m_agents.append(debuggerAgentPtr.release());\n\n m_agents.append(InspectorDOMDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), domAgent, debuggerAgent));\n\n m_agents.append(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent, m_state.get(), m_injectedScriptManager.get()));\n\n m_agents.append(InspectorHeapProfilerAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get()));\n\n\n m_agents.append(InspectorWorkerAgent::create(m_instrumentingAgents.get(), m_state.get()));\n\n m_agents.append(InspectorCanvasAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent, m_injectedScriptManager.get()));\n\n m_agents.append(InspectorInputAgent::create(m_instrumentingAgents.get(), m_state.get(), page, inspectorClient));\n\n m_agents.append(InspectorLayerTreeAgent::create(m_instrumentingAgents.get(), m_state.get(), domAgent, page));\n\n ASSERT_ARG(inspectorClient, inspectorClient);\n m_injectedScriptManager->injectedScriptHost()->init(m_instrumentingAgents.get(), pageScriptDebugServer);\n}\n", + "target": "InspectorController::InspectorController(Page* page, InspectorClient* inspectorClient)\n : m_instrumentingAgents(InstrumentingAgents::create())\n , m_injectedScriptManager(InjectedScriptManager::createForPage())\n , m_state(adoptPtr(new InspectorCompositeState(inspectorClient)))\n , m_overlay(InspectorOverlay::create(page, inspectorClient))\n , m_page(page)\n , m_inspectorClient(inspectorClient)\n , m_isUnderTest(false)\n{\n m_agents.append(InspectorAgent::create(page, m_injectedScriptManager.get(), m_instrumentingAgents.get(), m_state.get()));\n\n OwnPtr pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_state.get(), m_injectedScriptManager.get(), inspectorClient, m_overlay.get()));\n InspectorPageAgent* pageAgent = pageAgentPtr.get();\n m_agents.append(pageAgentPtr.release());\n\n OwnPtr domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get(), m_injectedScriptManager.get(), m_overlay.get(), inspectorClient));\n InspectorDOMAgent* domAgent = domAgentPtr.get();\n m_agents.append(domAgentPtr.release());\n \n OwnPtr resourceAgentPtr(InspectorResourceAgent::create(m_instrumentingAgents.get(), pageAgent, inspectorClient, m_state.get()));\n InspectorResourceAgent* resourceAgent = resourceAgentPtr.get();\n m_agents.append(resourceAgentPtr.release());\n \n m_agents.append(InspectorCSSAgent::create(m_instrumentingAgents.get(), m_state.get(), domAgent, pageAgent, resourceAgent));\n\n m_agents.append(InspectorDatabaseAgent::create(m_instrumentingAgents.get(), m_state.get()));\n\n m_agents.append(InspectorIndexedDBAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), pageAgent));\n\n m_agents.append(InspectorFileSystemAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get()));\n\n m_agents.append(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get()));\n\n OwnPtr memoryAgentPtr(InspectorMemoryAgent::create(m_instrumentingAgents.get(), m_state.get()));\n m_memoryAgent = memoryAgentPtr.get();\n m_agents.append(memoryAgentPtr.release());\n\n OwnPtr timelineAgentPtr(InspectorTimelineAgent::create(m_instrumentingAgents.get(), pageAgent, m_memoryAgent, domAgent, m_state.get(),\n InspectorTimelineAgent::PageInspector, inspectorClient));\n m_timelineAgent = timelineAgentPtr.get();\n m_agents.append(timelineAgentPtr.release());\n\n m_agents.append(InspectorApplicationCacheAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent));\n\n PageScriptDebugServer* pageScriptDebugServer = &PageScriptDebugServer::shared();\n\n m_agents.append(PageRuntimeAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), pageScriptDebugServer, page, pageAgent));\n\n OwnPtr consoleAgentPtr(PageConsoleAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), domAgent, m_timelineAgent));\n InspectorConsoleAgent* consoleAgent = consoleAgentPtr.get();\n m_agents.append(consoleAgentPtr.release());\n\n OwnPtr debuggerAgentPtr(PageDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), pageScriptDebugServer, pageAgent, m_injectedScriptManager.get(), m_overlay.get()));\n InspectorDebuggerAgent* debuggerAgent = debuggerAgentPtr.get();\n m_agents.append(debuggerAgentPtr.release());\n\n m_agents.append(InspectorDOMDebuggerAgent::create(m_instrumentingAgents.get(), m_state.get(), domAgent, debuggerAgent));\n\n m_agents.append(InspectorProfilerAgent::create(m_instrumentingAgents.get(), consoleAgent, m_state.get(), m_injectedScriptManager.get()));\n\n m_agents.append(InspectorHeapProfilerAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get()));\n\n\n m_agents.append(InspectorWorkerAgent::create(m_instrumentingAgents.get(), m_state.get()));\n\n m_agents.append(InspectorCanvasAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent, m_injectedScriptManager.get()));\n\n m_agents.append(InspectorInputAgent::create(m_instrumentingAgents.get(), m_state.get(), page, inspectorClient));\n\n m_agents.append(InspectorLayerTreeAgent::create(m_instrumentingAgents.get(), m_state.get(), domAgent, page));\n\n ASSERT_ARG(inspectorClient, inspectorClient);\n m_injectedScriptManager->injectedScriptHost()->init(m_instrumentingAgents.get(), pageScriptDebugServer);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9a6bce9b615abca6068348c1606ba8eaf13d9ae0", + "input": "my_object_class_init (MyObjectClass *mobject_class)\n{\n GObjectClass *gobject_class = G_OBJECT_CLASS (mobject_class);\n gobject_class->finalize = my_object_finalize;\n gobject_class->set_property = my_object_set_property;\n gobject_class->get_property = my_object_get_property;\n g_object_class_install_property (gobject_class,\n\t\t\t\t PROP_THIS_IS_A_STRING,\n\t\t\t\t g_param_spec_string (\"this_is_a_string\",\n _(\"Sample string\"),\n _(\"Example of a string property\"),\n \"default value\",\n G_PARAM_READWRITE));\n signals[FROBNICATE] =\n g_signal_new (\"frobnicate\",\n\t\t G_OBJECT_CLASS_TYPE (mobject_class),\n G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,\n 0,\n NULL, NULL,\n g_cclosure_marshal_VOID__INT,\n G_TYPE_NONE, 1, G_TYPE_INT);\n signals[SIG0] =\n g_signal_new (\"sig0\",\n\t\t G_OBJECT_CLASS_TYPE (mobject_class),\n G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,\n 0,\n NULL, NULL,\n my_object_marshal_VOID__STRING_INT_STRING,\n G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);\n signals[SIG1] =\n g_signal_new (\"sig1\",\n\t\t G_OBJECT_CLASS_TYPE (mobject_class),\n G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,\n 0,\n NULL, NULL,\n my_object_marshal_VOID__STRING_BOXED,\n G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VALUE);\n signals[SIG2] =\n g_signal_new (\"sig2\",\n\t\t G_OBJECT_CLASS_TYPE (mobject_class),\n G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,\n 0,\n NULL, NULL,\n g_cclosure_marshal_VOID__BOXED,\n G_TYPE_NONE, 1, DBUS_TYPE_G_STRING_STRING_HASHTABLE);\n}\n", + "target": "my_object_class_init (MyObjectClass *mobject_class)\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0b1b7baa4695c945a1b0bea1f0636f1219139e8e", + "input": "void DownloadUIAdapterDelegate::OpenItem(const OfflineItem& item,\n int64_t offline_id) {\n JNIEnv* env = AttachCurrentThread();\n Java_OfflinePageDownloadBridge_openItem(\n env, ConvertUTF8ToJavaString(env, item.page_url.spec()), offline_id);\n }\n", + "target": "void DownloadUIAdapterDelegate::OpenItem(const OfflineItem& item,\n int64_t offline_id) {\n JNIEnv* env = AttachCurrentThread();\n Java_OfflinePageDownloadBridge_openItem(\n env, ConvertUTF8ToJavaString(env, item.page_url.spec()), offline_id,\n offline_pages::ShouldOfflinePagesInDownloadHomeOpenInCct());\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a46bcef82b29d30836a0f26226e3d4aca4fa9612", + "input": " void HostNPScriptObject::OnShutdownFinished() {\n DCHECK_EQ(MessageLoop::current(), host_context_.main_message_loop());\n \n disconnected_event_.Signal();\n }\n", + "target": " void HostNPScriptObject::OnShutdownFinished() {\n if (MessageLoop::current() != host_context_.main_message_loop()) {\n host_context_.main_message_loop()->PostTask(FROM_HERE, base::Bind(\n &HostNPScriptObject::OnShutdownFinished, base::Unretained(this)));\n return;\n }\n \n disconnected_event_.Signal();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fec26ff33bf372476a70326f3669a35f34a9d474", + "input": " PreconnectRequest::PreconnectRequest(\n const GURL& origin,\n int num_sockets,\n const net::NetworkIsolationKey& network_isolation_key)\n : origin(origin),\n num_sockets(num_sockets),\n network_isolation_key(network_isolation_key) {\n DCHECK_GE(num_sockets, 0);\n}\n", + "target": " PreconnectRequest::PreconnectRequest(\n const url::Origin& origin,\n int num_sockets,\n const net::NetworkIsolationKey& network_isolation_key)\n : origin(origin),\n num_sockets(num_sockets),\n network_isolation_key(network_isolation_key) {\n DCHECK_GE(num_sockets, 0);\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " void FillConstant(uint8_t *data, int stride, uint8_t fill_constant) {\n for (int h = 0; h < height_; ++h) {\n for (int w = 0; w < width_; ++w) {\n data[h * stride + w] = fill_constant;\n }\n }\n }\n", + "target": " void FillConstant(uint8_t *data, int stride, uint8_t fill_constant) {\n // Sum of Absolute Differences Average. Given two blocks, and a prediction\n // calculate the absolute difference between one pixel and average of the\n // corresponding and predicted pixels; accumulate.\n unsigned int ReferenceSADavg(int block_idx) {\n unsigned int sad = 0;\n const uint8_t *const reference8 = GetReference(block_idx);\n const uint8_t *const source8 = source_data_;\n const uint8_t *const second_pred8 = second_pred_;\n#if CONFIG_VP9_HIGHBITDEPTH\n const uint16_t *const reference16 =\n CONVERT_TO_SHORTPTR(GetReference(block_idx));\n const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);\n const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);\n#endif // CONFIG_VP9_HIGHBITDEPTH\n for (int h = 0; h < height_; ++h) {\n for (int w = 0; w < width_; ++w) {\n if (!use_high_bit_depth_) {\n const int tmp = second_pred8[h * width_ + w] +\n reference8[h * reference_stride_ + w];\n const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);\n sad += abs(source8[h * source_stride_ + w] - comp_pred);\n#if CONFIG_VP9_HIGHBITDEPTH\n } else {\n const int tmp = second_pred16[h * width_ + w] +\n reference16[h * reference_stride_ + w];\n const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);\n sad += abs(source16[h * source_stride_ + w] - comp_pred);\n#endif // CONFIG_VP9_HIGHBITDEPTH\n }\n }\n }\n return sad;\n }\n\n void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) {\n uint8_t *data8 = data;\n#if CONFIG_VP9_HIGHBITDEPTH\n uint16_t *data16 = CONVERT_TO_SHORTPTR(data);\n#endif // CONFIG_VP9_HIGHBITDEPTH\n for (int h = 0; h < height_; ++h) {\n for (int w = 0; w < width_; ++w) {\n if (!use_high_bit_depth_) {\n data8[h * stride + w] = static_cast(fill_constant);\n#if CONFIG_VP9_HIGHBITDEPTH\n } else {\n data16[h * stride + w] = fill_constant;\n#endif // CONFIG_VP9_HIGHBITDEPTH\n }\n }\n }\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": " perform_transform_test(png_modifier *pm)\n {\n png_byte colour_type = 0;\n\n png_byte bit_depth = 0;\n unsigned int palette_number = 0;\n \n while (next_format(&colour_type, &bit_depth, &palette_number, 0))\n {\n png_uint_32 counter = 0;\n size_t base_pos;\n char name[64];\n\n base_pos = safecat(name, sizeof name, 0, \"transform:\");\n\n\n for (;;)\n {\n size_t pos = base_pos;\n PNG_CONST image_transform *list = 0;\n \n /* 'max' is currently hardwired to '1'; this should be settable on the\n * command line.\n */\n counter = image_transform_add(&list, 1/*max*/, counter,\n name, sizeof name, &pos, colour_type, bit_depth);\n\n if (counter == 0)\n break;\n\n /* The command line can change this to checking interlaced images. */\n do\n {\n pm->repeat = 0;\n transform_test(pm, FILEID(colour_type, bit_depth, palette_number,\n pm->interlace_type, 0, 0, 0), list, name);\n\n if (fail(pm))\n return;\n }\n while (pm->repeat);\n }\n }\n}\n", + "target": " perform_transform_test(png_modifier *pm)\n {\n png_byte colour_type = 0;\n\n png_byte bit_depth = 0;\n unsigned int palette_number = 0;\n \n while (next_format(&colour_type, &bit_depth, &palette_number, pm->test_lbg,\n pm->test_tRNS))\n {\n png_uint_32 counter = 0;\n size_t base_pos;\n char name[64];\n\n base_pos = safecat(name, sizeof name, 0, \"transform:\");\n\n\n for (;;)\n {\n size_t pos = base_pos;\n const image_transform *list = 0;\n \n /* 'max' is currently hardwired to '1'; this should be settable on the\n * command line.\n */\n counter = image_transform_add(&list, 1/*max*/, counter,\n name, sizeof name, &pos, colour_type, bit_depth);\n\n if (counter == 0)\n break;\n\n /* The command line can change this to checking interlaced images. */\n do\n {\n pm->repeat = 0;\n transform_test(pm, FILEID(colour_type, bit_depth, palette_number,\n pm->interlace_type, 0, 0, 0), list, name);\n\n if (fail(pm))\n return;\n }\n while (pm->repeat);\n }\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6b3a707736301c2128ca85ce85fb13f60b5e350a", + "input": "static int link_pipe(struct pipe_inode_info *ipipe,\n\t\t struct pipe_inode_info *opipe,\n\t\t size_t len, unsigned int flags)\n{\n\tstruct pipe_buffer *ibuf, *obuf;\n\tint ret = 0, i = 0, nbuf;\n\n\t/*\n\t * Potential ABBA deadlock, work around it by ordering lock\n\t * grabbing by pipe info address. Otherwise two different processes\n\t * could deadlock (one doing tee from A -> B, the other from B -> A).\n\t */\n\tpipe_double_lock(ipipe, opipe);\n\n\tdo {\n\t\tif (!opipe->readers) {\n\t\t\tsend_sig(SIGPIPE, current, 0);\n\t\t\tif (!ret)\n\t\t\t\tret = -EPIPE;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * If we have iterated all input buffers or ran out of\n\t\t * output room, break.\n\t\t */\n\t\tif (i >= ipipe->nrbufs || opipe->nrbufs >= opipe->buffers)\n\t\t\tbreak;\n\n\t\tibuf = ipipe->bufs + ((ipipe->curbuf + i) & (ipipe->buffers-1));\n\t\tnbuf = (opipe->curbuf + opipe->nrbufs) & (opipe->buffers - 1);\n\n\t\t/*\n \t\t * Get a reference to this pipe buffer,\n \t\t * so we can copy the contents over.\n \t\t */\n\t\tpipe_buf_get(ipipe, ibuf);\n \n \t\tobuf = opipe->bufs + nbuf;\n \t\t*obuf = *ibuf;\n\n\t\t/*\n\t\t * Don't inherit the gift flag, we need to\n\t\t * prevent multiple steals of this page.\n\t\t */\n\t\tobuf->flags &= ~PIPE_BUF_FLAG_GIFT;\n\n\t\tpipe_buf_mark_unmergeable(obuf);\n\n\t\tif (obuf->len > len)\n\t\t\tobuf->len = len;\n\n\t\topipe->nrbufs++;\n\t\tret += obuf->len;\n\t\tlen -= obuf->len;\n\t\ti++;\n\t} while (len);\n\n\t/*\n\t * return EAGAIN if we have the potential of some data in the\n\t * future, otherwise just return 0\n\t */\n\tif (!ret && ipipe->waiting_writers && (flags & SPLICE_F_NONBLOCK))\n\t\tret = -EAGAIN;\n\n\tpipe_unlock(ipipe);\n\tpipe_unlock(opipe);\n\n\t/*\n\t * If we put data in the output pipe, wakeup any potential readers.\n\t */\n\tif (ret > 0)\n\t\twakeup_pipe_readers(opipe);\n\n\treturn ret;\n}\n", + "target": "static int link_pipe(struct pipe_inode_info *ipipe,\n\t\t struct pipe_inode_info *opipe,\n\t\t size_t len, unsigned int flags)\n{\n\tstruct pipe_buffer *ibuf, *obuf;\n\tint ret = 0, i = 0, nbuf;\n\n\t/*\n\t * Potential ABBA deadlock, work around it by ordering lock\n\t * grabbing by pipe info address. Otherwise two different processes\n\t * could deadlock (one doing tee from A -> B, the other from B -> A).\n\t */\n\tpipe_double_lock(ipipe, opipe);\n\n\tdo {\n\t\tif (!opipe->readers) {\n\t\t\tsend_sig(SIGPIPE, current, 0);\n\t\t\tif (!ret)\n\t\t\t\tret = -EPIPE;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * If we have iterated all input buffers or ran out of\n\t\t * output room, break.\n\t\t */\n\t\tif (i >= ipipe->nrbufs || opipe->nrbufs >= opipe->buffers)\n\t\t\tbreak;\n\n\t\tibuf = ipipe->bufs + ((ipipe->curbuf + i) & (ipipe->buffers-1));\n\t\tnbuf = (opipe->curbuf + opipe->nrbufs) & (opipe->buffers - 1);\n\n\t\t/*\n \t\t * Get a reference to this pipe buffer,\n \t\t * so we can copy the contents over.\n \t\t */\n\t\tif (!pipe_buf_get(ipipe, ibuf)) {\n\t\t\tif (ret == 0)\n\t\t\t\tret = -EFAULT;\n\t\t\tbreak;\n\t\t}\n \n \t\tobuf = opipe->bufs + nbuf;\n \t\t*obuf = *ibuf;\n\n\t\t/*\n\t\t * Don't inherit the gift flag, we need to\n\t\t * prevent multiple steals of this page.\n\t\t */\n\t\tobuf->flags &= ~PIPE_BUF_FLAG_GIFT;\n\n\t\tpipe_buf_mark_unmergeable(obuf);\n\n\t\tif (obuf->len > len)\n\t\t\tobuf->len = len;\n\n\t\topipe->nrbufs++;\n\t\tret += obuf->len;\n\t\tlen -= obuf->len;\n\t\ti++;\n\t} while (len);\n\n\t/*\n\t * return EAGAIN if we have the potential of some data in the\n\t * future, otherwise just return 0\n\t */\n\tif (!ret && ipipe->waiting_writers && (flags & SPLICE_F_NONBLOCK))\n\t\tret = -EAGAIN;\n\n\tpipe_unlock(ipipe);\n\tpipe_unlock(opipe);\n\n\t/*\n\t * If we put data in the output pipe, wakeup any potential readers.\n\t */\n\tif (ret > 0)\n\t\twakeup_pipe_readers(opipe);\n\n\treturn ret;\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4da7eefcaad044a6f919947a2a0e3d4fed87834c", + "input": " ~OffScreenRootWindow()\n {\n if (!--refCount) {\n#if PLATFORM(QT)\n delete window;\n window = 0;\n#elif PLATFORM(EFL)\n XUnmapWindow(display, window);\n XDestroyWindow(display, window);\n#endif\n }\n }\n", + "target": " ~OffScreenRootWindow()\n {\n if (!--refCount) {\n XUnmapWindow(display, window);\n XDestroyWindow(display, window);\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ab5e55ff333def909d025ac45da9ffa0d88a63f2", + "input": "PassRefPtr RTCPeerConnectionHandlerDummy::remoteDescription()\n{\n return 0;\n}\n", + "target": "PassRefPtr RTCPeerConnectionHandlerDummy::remoteDescription()\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#81406c0c1d45f75fcc7972ed974d2597abb0b9e9", + "input": "php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,\n\t\t\t\t\t\t\t\t\t\t\tchar *path,\n\t\t\t\t\t\t\t\t\t\t\tchar *mode,\n\t\t\t\t\t\t\t\t\t\t\tint options,\n char **opened_path,\n php_stream_context *context STREAMS_DC TSRMLS_DC)\n {\n int path_len;\n \n char *file_basename;\n size_t file_basename_len;\n\tchar file_dirname[MAXPATHLEN];\n\n struct zip *za;\n struct zip_file *zf = NULL;\n char *fragment;\n int fragment_len;\n int err;\n \n php_stream *stream = NULL;\n\tstruct php_zip_stream_data_t *self;\n\n\tfragment = strchr(path, '#');\n\tif (!fragment) {\n\t\treturn NULL;\n\t}\n\n\tif (strncasecmp(\"zip://\", path, 6) == 0) {\n\t\tpath += 6;\n\t}\n\n\tfragment_len = strlen(fragment);\n\n\tif (fragment_len < 1) {\n\t\treturn NULL;\n\t}\n\tpath_len = strlen(path);\n\tif (path_len >= MAXPATHLEN || mode[0] != 'r') {\n\t\treturn NULL;\n\t}\n\n\tmemcpy(file_dirname, path, path_len - fragment_len);\n\tfile_dirname[path_len - fragment_len] = '\\0';\n\n\tphp_basename(path, path_len - fragment_len, NULL, 0, &file_basename, &file_basename_len TSRMLS_CC);\n\tfragment++;\n\n\tif (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) {\n\t\tefree(file_basename);\n\t\treturn NULL;\n\t}\n\n\tza = zip_open(file_dirname, ZIP_CREATE, &err);\n\tif (za) {\n\t\tzf = zip_fopen(za, fragment, 0);\n\t\tif (zf) {\n self = emalloc(sizeof(*self));\n \n self->za = za;\n self->zf = zf; \n self->stream = NULL;\n self->cursor = 0;\n stream = php_stream_alloc(&php_stream_zipio_ops, self, NULL, mode);\n\n\t\t\tif (opened_path) {\n\t\t\t\t*opened_path = estrdup(path);\n\t\t\t}\n\t\t} else {\n\t\t\tzip_close(za);\n\t\t}\n\t}\n\n\tefree(file_basename);\n\n\tif (!stream) {\n\t\treturn NULL;\n\t} else {\n\t\treturn stream;\n\t}\n}\n", + "target": "php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,\n\t\t\t\t\t\t\t\t\t\t\tchar *path,\n\t\t\t\t\t\t\t\t\t\t\tchar *mode,\n\t\t\t\t\t\t\t\t\t\t\tint options,\n char **opened_path,\n php_stream_context *context STREAMS_DC TSRMLS_DC)\n {\n size_t path_len;\n \n char *file_basename;\n size_t file_basename_len;\n\tchar file_dirname[MAXPATHLEN];\n\n struct zip *za;\n struct zip_file *zf = NULL;\n char *fragment;\n size_t fragment_len;\n int err;\n \n php_stream *stream = NULL;\n\tstruct php_zip_stream_data_t *self;\n\n\tfragment = strchr(path, '#');\n\tif (!fragment) {\n\t\treturn NULL;\n\t}\n\n\tif (strncasecmp(\"zip://\", path, 6) == 0) {\n\t\tpath += 6;\n\t}\n\n\tfragment_len = strlen(fragment);\n\n\tif (fragment_len < 1) {\n\t\treturn NULL;\n\t}\n\tpath_len = strlen(path);\n\tif (path_len >= MAXPATHLEN || mode[0] != 'r') {\n\t\treturn NULL;\n\t}\n\n\tmemcpy(file_dirname, path, path_len - fragment_len);\n\tfile_dirname[path_len - fragment_len] = '\\0';\n\n\tphp_basename(path, path_len - fragment_len, NULL, 0, &file_basename, &file_basename_len TSRMLS_CC);\n\tfragment++;\n\n\tif (ZIP_OPENBASEDIR_CHECKPATH(file_dirname)) {\n\t\tefree(file_basename);\n\t\treturn NULL;\n\t}\n\n\tza = zip_open(file_dirname, ZIP_CREATE, &err);\n\tif (za) {\n\t\tzf = zip_fopen(za, fragment, 0);\n\t\tif (zf) {\n self = emalloc(sizeof(*self));\n \n self->za = za;\n self->zf = zf;\n self->stream = NULL;\n self->cursor = 0;\n stream = php_stream_alloc(&php_stream_zipio_ops, self, NULL, mode);\n\n\t\t\tif (opened_path) {\n\t\t\t\t*opened_path = estrdup(path);\n\t\t\t}\n\t\t} else {\n\t\t\tzip_close(za);\n\t\t}\n\t}\n\n\tefree(file_basename);\n\n\tif (!stream) {\n\t\treturn NULL;\n\t} else {\n\t\treturn stream;\n\t}\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e3171b346e6919f4162ea128d0f7b342cf878fd4", + "input": " PowerPopupView() {\n SetHorizontalAlignment(ALIGN_RIGHT);\n UpdateText();\n }\n", + "target": " PowerPopupView() {\n SetHorizontalAlignment(ALIGN_RIGHT);\n SetMultiLine(true);\n UpdateText();\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9a5467bf7b6e9e02ec9c3da4e23747c05faeaac6", + "input": "static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)\n {\n \tstruct crypto_report_blkcipher rblkcipher;\n \n\tsnprintf(rblkcipher.type, CRYPTO_MAX_ALG_NAME, \"%s\", \"ablkcipher\");\n\tsnprintf(rblkcipher.geniv, CRYPTO_MAX_ALG_NAME, \"%s\",\n\t\t alg->cra_ablkcipher.geniv ?: \"\");\n \n \trblkcipher.blocksize = alg->cra_blocksize;\n \trblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;\n\trblkcipher.max_keysize = alg->cra_ablkcipher.max_keysize;\n\trblkcipher.ivsize = alg->cra_ablkcipher.ivsize;\n\n\tif (nla_put(skb, CRYPTOCFGA_REPORT_BLKCIPHER,\n\t\t sizeof(struct crypto_report_blkcipher), &rblkcipher))\n\t\tgoto nla_put_failure;\n\treturn 0;\n\nnla_put_failure:\n\treturn -EMSGSIZE;\n}\n", + "target": "static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)\n {\n \tstruct crypto_report_blkcipher rblkcipher;\n \n\tstrncpy(rblkcipher.type, \"ablkcipher\", sizeof(rblkcipher.type));\n\tstrncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: \"\",\n\t\tsizeof(rblkcipher.geniv));\n \n \trblkcipher.blocksize = alg->cra_blocksize;\n \trblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;\n\trblkcipher.max_keysize = alg->cra_ablkcipher.max_keysize;\n\trblkcipher.ivsize = alg->cra_ablkcipher.ivsize;\n\n\tif (nla_put(skb, CRYPTOCFGA_REPORT_BLKCIPHER,\n\t\t sizeof(struct crypto_report_blkcipher), &rblkcipher))\n\t\tgoto nla_put_failure;\n\treturn 0;\n\nnla_put_failure:\n\treturn -EMSGSIZE;\n}\n", + "vul_type": "cwe-310", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fa8b18edd752a8b4e9d1ee2cd615b82c93cf8bba", + "input": "xfs_acl_from_disk(struct xfs_acl *aclp)\n{\n\tstruct posix_acl_entry *acl_e;\n\tstruct posix_acl *acl;\n\tstruct xfs_acl_entry *ace;\n \tint count, i;\n \n \tcount = be32_to_cpu(aclp->acl_cnt);\n \n \tacl = posix_acl_alloc(count, GFP_KERNEL);\n \tif (!acl)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tfor (i = 0; i < count; i++) {\n\t\tacl_e = &acl->a_entries[i];\n\t\tace = &aclp->acl_entry[i];\n\n\t\t/*\n\t\t * The tag is 32 bits on disk and 16 bits in core.\n\t\t *\n\t\t * Because every access to it goes through the core\n\t\t * format first this is not a problem.\n\t\t */\n\t\tacl_e->e_tag = be32_to_cpu(ace->ae_tag);\n\t\tacl_e->e_perm = be16_to_cpu(ace->ae_perm);\n\n\t\tswitch (acl_e->e_tag) {\n\t\tcase ACL_USER:\n\t\tcase ACL_GROUP:\n\t\t\tacl_e->e_id = be32_to_cpu(ace->ae_id);\n\t\t\tbreak;\n\t\tcase ACL_USER_OBJ:\n\t\tcase ACL_GROUP_OBJ:\n\t\tcase ACL_MASK:\n\t\tcase ACL_OTHER:\n\t\t\tacl_e->e_id = ACL_UNDEFINED_ID;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn acl;\n\nfail:\n\tposix_acl_release(acl);\n\treturn ERR_PTR(-EINVAL);\n}\n", + "target": "xfs_acl_from_disk(struct xfs_acl *aclp)\n{\n\tstruct posix_acl_entry *acl_e;\n\tstruct posix_acl *acl;\n\tstruct xfs_acl_entry *ace;\n \tint count, i;\n \n \tcount = be32_to_cpu(aclp->acl_cnt);\n\tif (count > XFS_ACL_MAX_ENTRIES)\n\t\treturn ERR_PTR(-EFSCORRUPTED);\n \n \tacl = posix_acl_alloc(count, GFP_KERNEL);\n \tif (!acl)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tfor (i = 0; i < count; i++) {\n\t\tacl_e = &acl->a_entries[i];\n\t\tace = &aclp->acl_entry[i];\n\n\t\t/*\n\t\t * The tag is 32 bits on disk and 16 bits in core.\n\t\t *\n\t\t * Because every access to it goes through the core\n\t\t * format first this is not a problem.\n\t\t */\n\t\tacl_e->e_tag = be32_to_cpu(ace->ae_tag);\n\t\tacl_e->e_perm = be16_to_cpu(ace->ae_perm);\n\n\t\tswitch (acl_e->e_tag) {\n\t\tcase ACL_USER:\n\t\tcase ACL_GROUP:\n\t\t\tacl_e->e_id = be32_to_cpu(ace->ae_id);\n\t\t\tbreak;\n\t\tcase ACL_USER_OBJ:\n\t\tcase ACL_GROUP_OBJ:\n\t\tcase ACL_MASK:\n\t\tcase ACL_OTHER:\n\t\t\tacl_e->e_id = ACL_UNDEFINED_ID;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tgoto fail;\n\t\t}\n\t}\n\treturn acl;\n\nfail:\n\tposix_acl_release(acl);\n\treturn ERR_PTR(-EINVAL);\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9a6bce9b615abca6068348c1606ba8eaf13d9ae0", + "input": "my_object_throw_error (MyObject *obj, GError **error)\n{\n g_set_error (error,\n\t MY_OBJECT_ERROR,\n\t MY_OBJECT_ERROR_FOO,\n\t \"%s\",\n\t \"this method always loses\"); \n return FALSE;\n}\n", + "target": "my_object_throw_error (MyObject *obj, GError **error)\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f0d1762554014ce0ae347b9f0d088f2c157c8c72", + "input": "static int __init pcd_init(void)\n{\n\tstruct pcd_unit *cd;\n\tint unit;\n\n\tif (disable)\n\t\treturn -EINVAL;\n\n\tpcd_init_units();\n\n\tif (pcd_detect())\n\t\treturn -ENODEV;\n\n\t/* get the atapi capabilities page */\n \tpcd_probe_capabilities();\n \n \tif (register_blkdev(major, name)) {\n\t\tfor (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)\n \t\t\tput_disk(cd->disk);\n \t\treturn -EBUSY;\n \t}\n \n\tfor (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {\n\t\tif (cd->present) {\n\t\t\tregister_cdrom(&cd->info);\n\t\t\tcd->disk->private_data = cd;\n\t\t\tadd_disk(cd->disk);\n\t\t}\n\t}\n\n\treturn 0;\n}\n", + "target": "static int __init pcd_init(void)\n{\n\tstruct pcd_unit *cd;\n\tint unit;\n\n\tif (disable)\n\t\treturn -EINVAL;\n\n\tpcd_init_units();\n\n\tif (pcd_detect())\n\t\treturn -ENODEV;\n\n\t/* get the atapi capabilities page */\n \tpcd_probe_capabilities();\n \n \tif (register_blkdev(major, name)) {\n\t\tfor (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {\n\t\t\tif (!cd->disk)\n\t\t\t\tcontinue;\n\n\t\t\tblk_cleanup_queue(cd->disk->queue);\n\t\t\tblk_mq_free_tag_set(&cd->tag_set);\n \t\t\tput_disk(cd->disk);\n\t\t}\n \t\treturn -EBUSY;\n \t}\n \n\tfor (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {\n\t\tif (cd->present) {\n\t\t\tregister_cdrom(&cd->info);\n\t\t\tcd->disk->private_data = cd;\n\t\t\tadd_disk(cd->disk);\n\t\t}\n\t}\n\n\treturn 0;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b8a4ff9775318ca5e679183884a6a63f3da8f863", + "input": "static void copy_xauthority(void) {\n\tchar *src = RUN_XAUTHORITY_FILE ;\n\tchar *dest;\n\tif (asprintf(&dest, \"%s/.Xauthority\", cfg.homedir) == -1)\n\t\terrExit(\"asprintf\");\n\t\n\tif (is_link(dest)) {\n\t\tfprintf(stderr, \"Error: %s is a symbolic link\\n\", dest);\n \t\texit(1);\n \t}\n \n\tpid_t child = fork();\n\tif (child < 0)\n\t\terrExit(\"fork\");\n\tif (child == 0) {\n\t\tdrop_privs(0);\n\t\tint rv = copy_file(src, dest, getuid(), getgid(), S_IRUSR | S_IWUSR);\n\t\tif (rv)\n\t\t\tfprintf(stderr, \"Warning: cannot transfer .Xauthority in private home directory\\n\");\n\t\telse {\n\t\t\tfs_logger2(\"clone\", dest);\n\t\t}\n\t\t_exit(0);\n\t}\n\twaitpid(child, NULL, 0);\n \t\n \tunlink(src);\n}\n", + "target": "static void copy_xauthority(void) {\n\tchar *src = RUN_XAUTHORITY_FILE ;\n\tchar *dest;\n\tif (asprintf(&dest, \"%s/.Xauthority\", cfg.homedir) == -1)\n\t\terrExit(\"asprintf\");\n\t\n\tif (is_link(dest)) {\n\t\tfprintf(stderr, \"Error: %s is a symbolic link\\n\", dest);\n \t\texit(1);\n \t}\n \n\tcopy_file_as_user(src, dest, getuid(), getgid(), S_IRUSR | S_IWUSR);\n\tfs_logger2(\"clone\", dest);\n \t\n \tunlink(src);\n}\n", + "vul_type": "cwe-269", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c395c6e5d7e8df37a21265ff76e48fe75ceb5ae6?w=1", + "input": "gdImagePtr gdImageCreate (int sx, int sy)\n{\n\tint i;\n\tgdImagePtr im;\n\n\tif (overflow2(sx, sy)) {\n\t\treturn NULL;\n\t}\n\n\tif (overflow2(sizeof(unsigned char *), sy)) {\n \t\treturn NULL;\n \t}\n \n \tim = (gdImage *) gdCalloc(1, sizeof(gdImage));\n \n \t/* Row-major ever since gd 1.3 */\n\tim->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);\n\tim->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);\n\tim->polyInts = 0;\n\tim->polyAllocated = 0;\n\tim->brush = 0;\n\tim->tile = 0;\n\tim->style = 0;\n\tfor (i = 0; i < sy; i++) {\n\t\t/* Row-major ever since gd 1.3 */\n\t\tim->pixels[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char));\n\t\tim->AA_opacity[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char));\n\t}\n\tim->sx = sx;\n\tim->sy = sy;\n\tim->colorsTotal = 0;\n\tim->transparent = (-1);\n\tim->interlace = 0;\n\tim->thick = 1;\n\tim->AA = 0;\n\tim->AA_polygon = 0;\n\tfor (i = 0; i < gdMaxColors; i++) {\n\t\tim->open[i] = 1;\n\t\tim->red[i] = 0;\n\t\tim->green[i] = 0;\n\t\tim->blue[i] = 0;\n\t}\n\tim->trueColor = 0;\n\tim->tpixels = 0;\n\tim->cx1 = 0;\n\tim->cy1 = 0;\n\tim->cx2 = im->sx - 1;\n\tim->cy2 = im->sy - 1;\n\tim->interpolation = NULL;\n\tim->interpolation_id = GD_BILINEAR_FIXED;\n\treturn im;\n}\n", + "target": "gdImagePtr gdImageCreate (int sx, int sy)\n{\n\tint i;\n\tgdImagePtr im;\n\n\tif (overflow2(sx, sy)) {\n\t\treturn NULL;\n\t}\n\n\tif (overflow2(sizeof(unsigned char *), sy)) {\n \t\treturn NULL;\n \t}\n \n\tif (overflow2(sizeof(unsigned char *), sx)) {\n\t\treturn NULL;\n\t}\n\n \tim = (gdImage *) gdCalloc(1, sizeof(gdImage));\n \n \t/* Row-major ever since gd 1.3 */\n\tim->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);\n\tim->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);\n\tim->polyInts = 0;\n\tim->polyAllocated = 0;\n\tim->brush = 0;\n\tim->tile = 0;\n\tim->style = 0;\n\tfor (i = 0; i < sy; i++) {\n\t\t/* Row-major ever since gd 1.3 */\n\t\tim->pixels[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char));\n\t\tim->AA_opacity[i] = (unsigned char *) gdCalloc(sx, sizeof(unsigned char));\n\t}\n\tim->sx = sx;\n\tim->sy = sy;\n\tim->colorsTotal = 0;\n\tim->transparent = (-1);\n\tim->interlace = 0;\n\tim->thick = 1;\n\tim->AA = 0;\n\tim->AA_polygon = 0;\n\tfor (i = 0; i < gdMaxColors; i++) {\n\t\tim->open[i] = 1;\n\t\tim->red[i] = 0;\n\t\tim->green[i] = 0;\n\t\tim->blue[i] = 0;\n\t}\n\tim->trueColor = 0;\n\tim->tpixels = 0;\n\tim->cx1 = 0;\n\tim->cy1 = 0;\n\tim->cx2 = im->sx - 1;\n\tim->cy2 = im->sy - 1;\n\tim->interpolation = NULL;\n\tim->interpolation_id = GD_BILINEAR_FIXED;\n\treturn im;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ee73f656a604d5aa9df86a97102e4e462dd79924", + "input": "static int pit_ioport_read(struct kvm_io_device *this,\n\t\t\t gpa_t addr, int len, void *data)\n{\n\tstruct kvm_pit *pit = dev_to_pit(this);\n\tstruct kvm_kpit_state *pit_state = &pit->pit_state;\n\tstruct kvm *kvm = pit->kvm;\n\tint ret, count;\n\tstruct kvm_kpit_channel_state *s;\n\tif (!pit_in_range(addr))\n \t\treturn -EOPNOTSUPP;\n \n \taddr &= KVM_PIT_CHANNEL_MASK;\n \ts = &pit_state->channels[addr];\n \n \tmutex_lock(&pit_state->lock);\n\n\tif (s->status_latched) {\n\t\ts->status_latched = 0;\n\t\tret = s->status;\n\t} else if (s->count_latched) {\n\t\tswitch (s->count_latched) {\n\t\tdefault:\n\t\tcase RW_STATE_LSB:\n\t\t\tret = s->latched_count & 0xff;\n\t\t\ts->count_latched = 0;\n\t\t\tbreak;\n\t\tcase RW_STATE_MSB:\n\t\t\tret = s->latched_count >> 8;\n\t\t\ts->count_latched = 0;\n\t\t\tbreak;\n\t\tcase RW_STATE_WORD0:\n\t\t\tret = s->latched_count & 0xff;\n\t\t\ts->count_latched = RW_STATE_MSB;\n\t\t\tbreak;\n\t\t}\n\t} else {\n\t\tswitch (s->read_state) {\n\t\tdefault:\n\t\tcase RW_STATE_LSB:\n\t\t\tcount = pit_get_count(kvm, addr);\n\t\t\tret = count & 0xff;\n\t\t\tbreak;\n\t\tcase RW_STATE_MSB:\n\t\t\tcount = pit_get_count(kvm, addr);\n\t\t\tret = (count >> 8) & 0xff;\n\t\t\tbreak;\n\t\tcase RW_STATE_WORD0:\n\t\t\tcount = pit_get_count(kvm, addr);\n\t\t\tret = count & 0xff;\n\t\t\ts->read_state = RW_STATE_WORD1;\n\t\t\tbreak;\n\t\tcase RW_STATE_WORD1:\n\t\t\tcount = pit_get_count(kvm, addr);\n\t\t\tret = (count >> 8) & 0xff;\n\t\t\ts->read_state = RW_STATE_WORD0;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (len > sizeof(ret))\n\t\tlen = sizeof(ret);\n\tmemcpy(data, (char *)&ret, len);\n\n\tmutex_unlock(&pit_state->lock);\n\treturn 0;\n}\n", + "target": "static int pit_ioport_read(struct kvm_io_device *this,\n\t\t\t gpa_t addr, int len, void *data)\n{\n\tstruct kvm_pit *pit = dev_to_pit(this);\n\tstruct kvm_kpit_state *pit_state = &pit->pit_state;\n\tstruct kvm *kvm = pit->kvm;\n\tint ret, count;\n\tstruct kvm_kpit_channel_state *s;\n\tif (!pit_in_range(addr))\n \t\treturn -EOPNOTSUPP;\n \n \taddr &= KVM_PIT_CHANNEL_MASK;\n\tif (addr == 3)\n\t\treturn 0;\n\n \ts = &pit_state->channels[addr];\n \n \tmutex_lock(&pit_state->lock);\n\n\tif (s->status_latched) {\n\t\ts->status_latched = 0;\n\t\tret = s->status;\n\t} else if (s->count_latched) {\n\t\tswitch (s->count_latched) {\n\t\tdefault:\n\t\tcase RW_STATE_LSB:\n\t\t\tret = s->latched_count & 0xff;\n\t\t\ts->count_latched = 0;\n\t\t\tbreak;\n\t\tcase RW_STATE_MSB:\n\t\t\tret = s->latched_count >> 8;\n\t\t\ts->count_latched = 0;\n\t\t\tbreak;\n\t\tcase RW_STATE_WORD0:\n\t\t\tret = s->latched_count & 0xff;\n\t\t\ts->count_latched = RW_STATE_MSB;\n\t\t\tbreak;\n\t\t}\n\t} else {\n\t\tswitch (s->read_state) {\n\t\tdefault:\n\t\tcase RW_STATE_LSB:\n\t\t\tcount = pit_get_count(kvm, addr);\n\t\t\tret = count & 0xff;\n\t\t\tbreak;\n\t\tcase RW_STATE_MSB:\n\t\t\tcount = pit_get_count(kvm, addr);\n\t\t\tret = (count >> 8) & 0xff;\n\t\t\tbreak;\n\t\tcase RW_STATE_WORD0:\n\t\t\tcount = pit_get_count(kvm, addr);\n\t\t\tret = count & 0xff;\n\t\t\ts->read_state = RW_STATE_WORD1;\n\t\t\tbreak;\n\t\tcase RW_STATE_WORD1:\n\t\t\tcount = pit_get_count(kvm, addr);\n\t\t\tret = (count >> 8) & 0xff;\n\t\t\ts->read_state = RW_STATE_WORD0;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (len > sizeof(ret))\n\t\tlen = sizeof(ret);\n\tmemcpy(data, (char *)&ret, len);\n\n\tmutex_unlock(&pit_state->lock);\n\treturn 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a8b0ca17b80e92faab46ee7179ba9e99ccb61233", + "input": "asmlinkage void do_ade(struct pt_regs *regs)\n{\n\tunsigned int __user *pc;\n \tmm_segment_t seg;\n \n \tperf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,\n\t\t\t1, 0, regs, regs->cp0_badvaddr);\n \t/*\n \t * Did we catch a fault trying to load an instruction?\n \t * Or are we running in MIPS16 mode?\n\t */\n\tif ((regs->cp0_badvaddr == regs->cp0_epc) || (regs->cp0_epc & 0x1))\n\t\tgoto sigbus;\n\n\tpc = (unsigned int __user *) exception_epc(regs);\n\tif (user_mode(regs) && !test_thread_flag(TIF_FIXADE))\n\t\tgoto sigbus;\n\tif (unaligned_action == UNALIGNED_ACTION_SIGNAL)\n\t\tgoto sigbus;\n\telse if (unaligned_action == UNALIGNED_ACTION_SHOW)\n\t\tshow_registers(regs);\n\n\t/*\n\t * Do branch emulation only if we didn't forward the exception.\n\t * This is all so but ugly ...\n\t */\n\tseg = get_fs();\n\tif (!user_mode(regs))\n\t\tset_fs(KERNEL_DS);\n\temulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc);\n\tset_fs(seg);\n\n\treturn;\n\nsigbus:\n\tdie_if_kernel(\"Kernel unaligned instruction access\", regs);\n\tforce_sig(SIGBUS, current);\n\n\t/*\n\t * XXX On return from the signal handler we should advance the epc\n\t */\n}\n", + "target": "asmlinkage void do_ade(struct pt_regs *regs)\n{\n\tunsigned int __user *pc;\n \tmm_segment_t seg;\n \n \tperf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,\n\t\t\t1, regs, regs->cp0_badvaddr);\n \t/*\n \t * Did we catch a fault trying to load an instruction?\n \t * Or are we running in MIPS16 mode?\n\t */\n\tif ((regs->cp0_badvaddr == regs->cp0_epc) || (regs->cp0_epc & 0x1))\n\t\tgoto sigbus;\n\n\tpc = (unsigned int __user *) exception_epc(regs);\n\tif (user_mode(regs) && !test_thread_flag(TIF_FIXADE))\n\t\tgoto sigbus;\n\tif (unaligned_action == UNALIGNED_ACTION_SIGNAL)\n\t\tgoto sigbus;\n\telse if (unaligned_action == UNALIGNED_ACTION_SHOW)\n\t\tshow_registers(regs);\n\n\t/*\n\t * Do branch emulation only if we didn't forward the exception.\n\t * This is all so but ugly ...\n\t */\n\tseg = get_fs();\n\tif (!user_mode(regs))\n\t\tset_fs(KERNEL_DS);\n\temulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc);\n\tset_fs(seg);\n\n\treturn;\n\nsigbus:\n\tdie_if_kernel(\"Kernel unaligned instruction access\", regs);\n\tforce_sig(SIGBUS, current);\n\n\t/*\n\t * XXX On return from the signal handler we should advance the epc\n\t */\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#54d83fc74aa9ec72794373cb47432c5f7fb1a309", + "input": "static inline int check_entry_size_and_hooks(struct arpt_entry *e,\n\t\t\t\t\t struct xt_table_info *newinfo,\n\t\t\t\t\t const unsigned char *base,\n\t\t\t\t\t const unsigned char *limit,\n\t\t\t\t\t const unsigned int *hook_entries,\n\t\t\t\t\t const unsigned int *underflows,\n\t\t\t\t\t unsigned int valid_hooks)\n{\n\tunsigned int h;\n\tint err;\n\n\tif ((unsigned long)e % __alignof__(struct arpt_entry) != 0 ||\n\t (unsigned char *)e + sizeof(struct arpt_entry) >= limit ||\n\t (unsigned char *)e + e->next_offset > limit) {\n\t\tduprintf(\"Bad offset %p\\n\", e);\n\t\treturn -EINVAL;\n\t}\n\n\tif (e->next_offset\n\t < sizeof(struct arpt_entry) + sizeof(struct xt_entry_target)) {\n\t\tduprintf(\"checking: element %p size %u\\n\",\n\t\t\t e, e->next_offset);\n\t\treturn -EINVAL;\n\t}\n\n\terr = check_entry(e);\n\tif (err)\n\t\treturn err;\n\n\t/* Check hooks & underflows */\n\tfor (h = 0; h < NF_ARP_NUMHOOKS; h++) {\n\t\tif (!(valid_hooks & (1 << h)))\n\t\t\tcontinue;\n\t\tif ((unsigned char *)e - base == hook_entries[h])\n \t\t\tnewinfo->hook_entry[h] = hook_entries[h];\n \t\tif ((unsigned char *)e - base == underflows[h]) {\n \t\t\tif (!check_underflow(e)) {\n\t\t\t\tpr_err(\"Underflows must be unconditional and \"\n\t\t\t\t \"use the STANDARD target with \"\n\t\t\t\t \"ACCEPT/DROP\\n\");\n \t\t\t\treturn -EINVAL;\n \t\t\t}\n \t\t\tnewinfo->underflow[h] = underflows[h];\n\t\t}\n\t}\n\n\t/* Clear counters and comefrom */\n\te->counters = ((struct xt_counters) { 0, 0 });\n\te->comefrom = 0;\n\treturn 0;\n}\n", + "target": "static inline int check_entry_size_and_hooks(struct arpt_entry *e,\n\t\t\t\t\t struct xt_table_info *newinfo,\n\t\t\t\t\t const unsigned char *base,\n\t\t\t\t\t const unsigned char *limit,\n\t\t\t\t\t const unsigned int *hook_entries,\n\t\t\t\t\t const unsigned int *underflows,\n\t\t\t\t\t unsigned int valid_hooks)\n{\n\tunsigned int h;\n\tint err;\n\n\tif ((unsigned long)e % __alignof__(struct arpt_entry) != 0 ||\n\t (unsigned char *)e + sizeof(struct arpt_entry) >= limit ||\n\t (unsigned char *)e + e->next_offset > limit) {\n\t\tduprintf(\"Bad offset %p\\n\", e);\n\t\treturn -EINVAL;\n\t}\n\n\tif (e->next_offset\n\t < sizeof(struct arpt_entry) + sizeof(struct xt_entry_target)) {\n\t\tduprintf(\"checking: element %p size %u\\n\",\n\t\t\t e, e->next_offset);\n\t\treturn -EINVAL;\n\t}\n\n\terr = check_entry(e);\n\tif (err)\n\t\treturn err;\n\n\t/* Check hooks & underflows */\n\tfor (h = 0; h < NF_ARP_NUMHOOKS; h++) {\n\t\tif (!(valid_hooks & (1 << h)))\n\t\t\tcontinue;\n\t\tif ((unsigned char *)e - base == hook_entries[h])\n \t\t\tnewinfo->hook_entry[h] = hook_entries[h];\n \t\tif ((unsigned char *)e - base == underflows[h]) {\n \t\t\tif (!check_underflow(e)) {\n\t\t\t\tpr_debug(\"Underflows must be unconditional and \"\n\t\t\t\t\t \"use the STANDARD target with \"\n\t\t\t\t\t \"ACCEPT/DROP\\n\");\n \t\t\t\treturn -EINVAL;\n \t\t\t}\n \t\t\tnewinfo->underflow[h] = underflows[h];\n\t\t}\n\t}\n\n\t/* Clear counters and comefrom */\n\te->counters = ((struct xt_counters) { 0, 0 });\n\te->comefrom = 0;\n\treturn 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) {\n inv_txfm_(out, dst, stride);\n }\n", + "target": " void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) {\n void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {\n inv_txfm_(out, dst, stride);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#20b65d00ca3d8696430e22efad7485366f8c3a21", + "input": "void ThreadHeap::TakeSnapshot(SnapshotType type) {\n DCHECK(thread_state_->InAtomicMarkingPause());\n \n ThreadState::GCSnapshotInfo info(GCInfoTable::GcInfoIndex() + 1);\n String thread_dump_name =\n String::Format(\"blink_gc/thread_%lu\",\n static_cast(thread_state_->ThreadId()));\n const String heaps_dump_name = thread_dump_name + \"/heaps\";\n const String classes_dump_name = thread_dump_name + \"/classes\";\n\n int number_of_heaps_reported = 0;\n#define SNAPSHOT_HEAP(ArenaType) \\\n { \\\n number_of_heaps_reported++; \\\n switch (type) { \\\n case SnapshotType::kHeapSnapshot: \\\n arenas_[BlinkGC::k##ArenaType##ArenaIndex]->TakeSnapshot( \\\n heaps_dump_name + \"/\" #ArenaType, info); \\\n break; \\\n case SnapshotType::kFreelistSnapshot: \\\n arenas_[BlinkGC::k##ArenaType##ArenaIndex]->TakeFreelistSnapshot( \\\n heaps_dump_name + \"/\" #ArenaType); \\\n break; \\\n default: \\\n NOTREACHED(); \\\n } \\\n }\n\n SNAPSHOT_HEAP(NormalPage1);\n SNAPSHOT_HEAP(NormalPage2);\n SNAPSHOT_HEAP(NormalPage3);\n SNAPSHOT_HEAP(NormalPage4);\n SNAPSHOT_HEAP(EagerSweep);\n SNAPSHOT_HEAP(Vector1);\n SNAPSHOT_HEAP(Vector2);\n SNAPSHOT_HEAP(Vector3);\n SNAPSHOT_HEAP(Vector4);\n SNAPSHOT_HEAP(InlineVector);\n SNAPSHOT_HEAP(HashTable);\n SNAPSHOT_HEAP(LargeObject);\n FOR_EACH_TYPED_ARENA(SNAPSHOT_HEAP);\n\n DCHECK_EQ(number_of_heaps_reported, BlinkGC::kNumberOfArenas);\n\n#undef SNAPSHOT_HEAP\n\n if (type == SnapshotType::kFreelistSnapshot)\n return;\n\n size_t total_live_count = 0;\n size_t total_dead_count = 0;\n size_t total_live_size = 0;\n size_t total_dead_size = 0;\n for (size_t gc_info_index = 1; gc_info_index <= GCInfoTable::GcInfoIndex();\n ++gc_info_index) {\n total_live_count += info.live_count[gc_info_index];\n total_dead_count += info.dead_count[gc_info_index];\n total_live_size += info.live_size[gc_info_index];\n total_dead_size += info.dead_size[gc_info_index];\n }\n\n base::trace_event::MemoryAllocatorDump* thread_dump =\n BlinkGCMemoryDumpProvider::Instance()\n ->CreateMemoryAllocatorDumpForCurrentGC(thread_dump_name);\n thread_dump->AddScalar(\"live_count\", \"objects\", total_live_count);\n thread_dump->AddScalar(\"dead_count\", \"objects\", total_dead_count);\n thread_dump->AddScalar(\"live_size\", \"bytes\", total_live_size);\n thread_dump->AddScalar(\"dead_size\", \"bytes\", total_dead_size);\n\n base::trace_event::MemoryAllocatorDump* heaps_dump =\n BlinkGCMemoryDumpProvider::Instance()\n ->CreateMemoryAllocatorDumpForCurrentGC(heaps_dump_name);\n base::trace_event::MemoryAllocatorDump* classes_dump =\n BlinkGCMemoryDumpProvider::Instance()\n ->CreateMemoryAllocatorDumpForCurrentGC(classes_dump_name);\n BlinkGCMemoryDumpProvider::Instance()\n ->CurrentProcessMemoryDump()\n ->AddOwnershipEdge(classes_dump->guid(), heaps_dump->guid());\n}\n", + "target": "void ThreadHeap::TakeSnapshot(SnapshotType type) {\n DCHECK(thread_state_->InAtomicMarkingPause());\n \n ThreadState::GCSnapshotInfo info(GCInfoTable::Get().GcInfoIndex() + 1);\n String thread_dump_name =\n String::Format(\"blink_gc/thread_%lu\",\n static_cast(thread_state_->ThreadId()));\n const String heaps_dump_name = thread_dump_name + \"/heaps\";\n const String classes_dump_name = thread_dump_name + \"/classes\";\n\n int number_of_heaps_reported = 0;\n#define SNAPSHOT_HEAP(ArenaType) \\\n { \\\n number_of_heaps_reported++; \\\n switch (type) { \\\n case SnapshotType::kHeapSnapshot: \\\n arenas_[BlinkGC::k##ArenaType##ArenaIndex]->TakeSnapshot( \\\n heaps_dump_name + \"/\" #ArenaType, info); \\\n break; \\\n case SnapshotType::kFreelistSnapshot: \\\n arenas_[BlinkGC::k##ArenaType##ArenaIndex]->TakeFreelistSnapshot( \\\n heaps_dump_name + \"/\" #ArenaType); \\\n break; \\\n default: \\\n NOTREACHED(); \\\n } \\\n }\n\n SNAPSHOT_HEAP(NormalPage1);\n SNAPSHOT_HEAP(NormalPage2);\n SNAPSHOT_HEAP(NormalPage3);\n SNAPSHOT_HEAP(NormalPage4);\n SNAPSHOT_HEAP(EagerSweep);\n SNAPSHOT_HEAP(Vector1);\n SNAPSHOT_HEAP(Vector2);\n SNAPSHOT_HEAP(Vector3);\n SNAPSHOT_HEAP(Vector4);\n SNAPSHOT_HEAP(InlineVector);\n SNAPSHOT_HEAP(HashTable);\n SNAPSHOT_HEAP(LargeObject);\n FOR_EACH_TYPED_ARENA(SNAPSHOT_HEAP);\n\n DCHECK_EQ(number_of_heaps_reported, BlinkGC::kNumberOfArenas);\n\n#undef SNAPSHOT_HEAP\n\n if (type == SnapshotType::kFreelistSnapshot)\n return;\n\n size_t total_live_count = 0;\n size_t total_dead_count = 0;\n size_t total_live_size = 0;\n size_t total_dead_size = 0;\n for (size_t gc_info_index = 1;\n gc_info_index <= GCInfoTable::Get().GcInfoIndex(); ++gc_info_index) {\n total_live_count += info.live_count[gc_info_index];\n total_dead_count += info.dead_count[gc_info_index];\n total_live_size += info.live_size[gc_info_index];\n total_dead_size += info.dead_size[gc_info_index];\n }\n\n base::trace_event::MemoryAllocatorDump* thread_dump =\n BlinkGCMemoryDumpProvider::Instance()\n ->CreateMemoryAllocatorDumpForCurrentGC(thread_dump_name);\n thread_dump->AddScalar(\"live_count\", \"objects\", total_live_count);\n thread_dump->AddScalar(\"dead_count\", \"objects\", total_dead_count);\n thread_dump->AddScalar(\"live_size\", \"bytes\", total_live_size);\n thread_dump->AddScalar(\"dead_size\", \"bytes\", total_dead_size);\n\n base::trace_event::MemoryAllocatorDump* heaps_dump =\n BlinkGCMemoryDumpProvider::Instance()\n ->CreateMemoryAllocatorDumpForCurrentGC(heaps_dump_name);\n base::trace_event::MemoryAllocatorDump* classes_dump =\n BlinkGCMemoryDumpProvider::Instance()\n ->CreateMemoryAllocatorDumpForCurrentGC(classes_dump_name);\n BlinkGCMemoryDumpProvider::Instance()\n ->CurrentProcessMemoryDump()\n ->AddOwnershipEdge(classes_dump->guid(), heaps_dump->guid());\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#98095c718d7580b5d6715e5bfd8698234ecb4470", + "input": " GLboolean WebGLRenderingContextBase::isTexture(WebGLTexture* texture) {\n if (!texture || isContextLost())\n return 0;\n \n if (!texture->HasEverBeenBound())\n return 0;\n if (texture->IsDeleted())\n return 0;\n\n return ContextGL()->IsTexture(texture->Object());\n}\n", + "target": " GLboolean WebGLRenderingContextBase::isTexture(WebGLTexture* texture) {\n if (!texture || isContextLost() || !texture->Validate(ContextGroup(), this))\n return 0;\n \n if (!texture->HasEverBeenBound())\n return 0;\n if (texture->IsDeleted())\n return 0;\n\n return ContextGL()->IsTexture(texture->Object());\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cd0bd79d6ebdb72183e6f0833673464cc10b3600", + "input": "void PluginChannel::OnChannelConnected(int32 peer_pid) {\n base::ProcessHandle handle;\n if (!base::OpenProcessHandle(peer_pid, &handle)) {\n NOTREACHED();\n }\n renderer_handle_ = handle;\n NPChannelBase::OnChannelConnected(peer_pid);\n}\n", + "target": "void PluginChannel::OnChannelConnected(int32 peer_pid) {\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#71554140bdaede27b95dbe4c9b5a028a83c83cce", + "input": " ActionReply Smb4KMountHelper::mount(const QVariantMap &args)\n {\n ActionReply reply;\n reply.addData(\"mh_mountpoint\", args[\"mh_mountpoint\"]);\n command << args[\"mh_unc\"].toString();\n command << args[\"mh_mountpoint\"].toString();\n command << args[\"mh_options\"].toStringList();\n#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)\n command << args[\"mh_command\"].toString();\n command << args[\"mh_options\"].toStringList();\n command << args[\"mh_unc\"].toString();\n command << args[\"mh_mountpoint\"].toString();\n#else\n#endif\n proc.setProgram(command);\n\n proc.start();\n\n if (proc.waitForStarted(-1))\n {\n bool user_kill = false;\n\n QStringList command;\n #if defined(Q_OS_LINUX)\n command << args[\"mh_command\"].toString();\n command << args[\"mh_unc\"].toString();\n command << args[\"mh_mountpoint\"].toString();\n command << args[\"mh_options\"].toStringList();\n #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)\n command << args[\"mh_command\"].toString();\n command << args[\"mh_options\"].toStringList();\n command << args[\"mh_unc\"].toString();\n command << args[\"mh_mountpoint\"].toString();\n {\n }\n\n if (HelperSupport::isStopped())\n {\n proc.kill();\n user_kill = true;\n break;\n }\n else\n {\n }\n }\n\n if (proc.exitStatus() == KProcess::CrashExit)\n {\n if (!user_kill)\n {\n reply.setErrorCode(ActionReply::HelperError);\n reply.setErrorDescription(i18n(\"The mount process crashed.\"));\n return reply;\n }\n else\n {\n }\n }\n else\n {\n QString stdErr = QString::fromUtf8(proc.readAllStandardError());\n reply.addData(\"mh_error_message\", stdErr.trimmed());\n }\n }\n", + "target": " ActionReply Smb4KMountHelper::mount(const QVariantMap &args)\n {\n ActionReply reply;\n \n //\n // Get the mount executable\n //\n const QString mount = findMountExecutable();\n \n //\n // Check the executable\n //\n if (mount != args[\"mh_command\"].toString())\n {\n // Something weird is going on, bail out.\n reply.setErrorCode(ActionReply::HelperError);\n reply.setErrorDescription(i18n(\"Wrong executable passed. Bailing out.\"));\n return reply;\n }\n else\n {\n // Do nothing\n }\n \n reply.addData(\"mh_mountpoint\", args[\"mh_mountpoint\"]);\n command << args[\"mh_unc\"].toString();\n command << args[\"mh_mountpoint\"].toString();\n command << args[\"mh_options\"].toStringList();\n#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)\n command << args[\"mh_command\"].toString();\n command << args[\"mh_options\"].toStringList();\n command << args[\"mh_unc\"].toString();\n command << args[\"mh_mountpoint\"].toString();\n#else\n#endif\n proc.setProgram(command);\n\n proc.start();\n\n if (proc.waitForStarted(-1))\n {\n bool user_kill = false;\n\n QStringList command;\n #if defined(Q_OS_LINUX)\n command << mount;\n command << args[\"mh_unc\"].toString();\n command << args[\"mh_mountpoint\"].toString();\n command << args[\"mh_options\"].toStringList();\n #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)\n command << mount;\n command << args[\"mh_options\"].toStringList();\n command << args[\"mh_unc\"].toString();\n command << args[\"mh_mountpoint\"].toString();\n {\n }\n\n if (HelperSupport::isStopped())\n {\n proc.kill();\n user_kill = true;\n break;\n }\n else\n {\n }\n }\n\n if (proc.exitStatus() == KProcess::CrashExit)\n {\n if (!user_kill)\n {\n reply.setErrorCode(ActionReply::HelperError);\n reply.setErrorDescription(i18n(\"The mount process crashed.\"));\n return reply;\n }\n else\n {\n }\n }\n else\n {\n QString stdErr = QString::fromUtf8(proc.readAllStandardError());\n reply.addData(\"mh_error_message\", stdErr.trimmed());\n }\n }\n", + "vul_type": "cwe-20", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#33c5e0a9db05dbd2f7793c23ac23b7aa6a556c05", + "input": " void SetManualFallbacks(bool enabled) {\n std::vector features = {\n password_manager::features::kEnableManualFallbacksFilling.name,\n password_manager::features::kEnableManualFallbacksFillingStandalone\n .name,\n password_manager::features::kEnableManualFallbacksGeneration.name};\n if (enabled) {\n scoped_feature_list_.InitFromCommandLine(base::JoinString(features, \",\"),\n std::string());\n } else {\n scoped_feature_list_.InitFromCommandLine(std::string(),\n base::JoinString(features, \",\"));\n }\n }\n", + "target": " void SetManualFallbacks(bool enabled) {\n std::vector features = {\n password_manager::features::kManualFallbacksFilling.name,\n password_manager::features::kEnableManualFallbacksFillingStandalone\n .name,\n password_manager::features::kEnableManualFallbacksGeneration.name};\n if (enabled) {\n scoped_feature_list_.InitFromCommandLine(base::JoinString(features, \",\"),\n std::string());\n } else {\n scoped_feature_list_.InitFromCommandLine(std::string(),\n base::JoinString(features, \",\"));\n }\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dee1f973ca341c266229faa5a1a5bb268bed3531", + "input": " static int ext4_convert_unwritten_extents_endio(handle_t *handle,\n\t\t\t\t\t struct inode *inode,\n\t\t\t\t\t struct ext4_ext_path *path)\n {\n \tstruct ext4_extent *ex;\n \tint depth;\n \tint err = 0;\n \n \tdepth = ext_depth(inode);\n \tex = path[depth].p_ext;\n \n \text_debug(\"ext4_convert_unwritten_extents_endio: inode %lu, logical\"\n \t\t\"block %llu, max_blocks %u\\n\", inode->i_ino,\n\t\t(unsigned long long)le32_to_cpu(ex->ee_block),\n\t\text4_ext_get_actual_len(ex));\n \n \terr = ext4_ext_get_access(handle, inode, path + depth);\n \tif (err)\n\t\tgoto out;\n\t/* first mark the extent as initialized */\n\text4_ext_mark_initialized(ex);\n\n\t/* note: ext4_ext_correct_indexes() isn't needed here because\n\t * borders are not changed\n\t */\n\text4_ext_try_to_merge(handle, inode, path, ex);\n\n\t/* Mark modified extent as dirty */\n\terr = ext4_ext_dirty(handle, inode, path + path->p_depth);\nout:\n\text4_ext_show_leaf(inode, path);\n\treturn err;\n}\n", + "target": " static int ext4_convert_unwritten_extents_endio(handle_t *handle,\n\t\t\t\t\t\tstruct inode *inode,\n\t\t\t\t\t\tstruct ext4_map_blocks *map,\n\t\t\t\t\t\tstruct ext4_ext_path *path)\n {\n \tstruct ext4_extent *ex;\n\text4_lblk_t ee_block;\n\tunsigned int ee_len;\n \tint depth;\n \tint err = 0;\n \n \tdepth = ext_depth(inode);\n \tex = path[depth].p_ext;\n\tee_block = le32_to_cpu(ex->ee_block);\n\tee_len = ext4_ext_get_actual_len(ex);\n \n \text_debug(\"ext4_convert_unwritten_extents_endio: inode %lu, logical\"\n \t\t\"block %llu, max_blocks %u\\n\", inode->i_ino,\n\t\t (unsigned long long)ee_block, ee_len);\n\n\t/* If extent is larger than requested then split is required */\n\tif (ee_block != map->m_lblk || ee_len > map->m_len) {\n\t\terr = ext4_split_unwritten_extents(handle, inode, map, path,\n\t\t\t\t\t\t EXT4_GET_BLOCKS_CONVERT);\n\t\tif (err < 0)\n\t\t\tgoto out;\n\t\text4_ext_drop_refs(path);\n\t\tpath = ext4_ext_find_extent(inode, map->m_lblk, path);\n\t\tif (IS_ERR(path)) {\n\t\t\terr = PTR_ERR(path);\n\t\t\tgoto out;\n\t\t}\n\t\tdepth = ext_depth(inode);\n\t\tex = path[depth].p_ext;\n\t}\n \n \terr = ext4_ext_get_access(handle, inode, path + depth);\n \tif (err)\n\t\tgoto out;\n\t/* first mark the extent as initialized */\n\text4_ext_mark_initialized(ex);\n\n\t/* note: ext4_ext_correct_indexes() isn't needed here because\n\t * borders are not changed\n\t */\n\text4_ext_try_to_merge(handle, inode, path, ex);\n\n\t/* Mark modified extent as dirty */\n\terr = ext4_ext_dirty(handle, inode, path + path->p_depth);\nout:\n\text4_ext_show_leaf(inode, path);\n\treturn err;\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#11f3659f64a4e42e90cb3c09fcef66894205aefe", + "input": "Packet *PacketTunnelPktSetup(ThreadVars *tv, DecodeThreadVars *dtv, Packet *parent,\n uint8_t *pkt, uint32_t len, enum DecodeTunnelProto proto,\n PacketQueue *pq)\n{\n int ret;\n\n SCEnter();\n\n /* get us a packet */\n Packet *p = PacketGetFromQueueOrAlloc();\n if (unlikely(p == NULL)) {\n SCReturnPtr(NULL, \"Packet\");\n }\n\n /* copy packet and set lenght, proto */\n PacketCopyData(p, pkt, len);\n p->recursion_level = parent->recursion_level + 1;\n p->ts.tv_sec = parent->ts.tv_sec;\n p->ts.tv_usec = parent->ts.tv_usec;\n p->datalink = DLT_RAW;\n p->tenant_id = parent->tenant_id;\n\n /* set the root ptr to the lowest layer */\n if (parent->root != NULL)\n p->root = parent->root;\n else\n p->root = parent;\n\n /* tell new packet it's part of a tunnel */\n SET_TUNNEL_PKT(p);\n\n ret = DecodeTunnel(tv, dtv, p, GET_PKT_DATA(p),\n GET_PKT_LEN(p), pq, proto);\n \n if (unlikely(ret != TM_ECODE_OK)) {\n /* Not a tunnel packet, just a pseudo packet */\n p->root = NULL;\n UNSET_TUNNEL_PKT(p);\n TmqhOutputPacketpool(tv, p);\n SCReturnPtr(NULL, \"Packet\");\n }\n\n\n /* tell parent packet it's part of a tunnel */\n SET_TUNNEL_PKT(parent);\n\n /* increment tunnel packet refcnt in the root packet */\n TUNNEL_INCR_PKT_TPR(p);\n\n /* disable payload (not packet) inspection on the parent, as the payload\n * is the packet we will now run through the system separately. We do\n * check it against the ip/port/other header checks though */\n DecodeSetNoPayloadInspectionFlag(parent);\n SCReturnPtr(p, \"Packet\");\n}\n", + "target": "Packet *PacketTunnelPktSetup(ThreadVars *tv, DecodeThreadVars *dtv, Packet *parent,\n uint8_t *pkt, uint32_t len, enum DecodeTunnelProto proto,\n PacketQueue *pq)\n{\n int ret;\n\n SCEnter();\n\n /* get us a packet */\n Packet *p = PacketGetFromQueueOrAlloc();\n if (unlikely(p == NULL)) {\n SCReturnPtr(NULL, \"Packet\");\n }\n\n /* copy packet and set lenght, proto */\n PacketCopyData(p, pkt, len);\n p->recursion_level = parent->recursion_level + 1;\n p->ts.tv_sec = parent->ts.tv_sec;\n p->ts.tv_usec = parent->ts.tv_usec;\n p->datalink = DLT_RAW;\n p->tenant_id = parent->tenant_id;\n\n /* set the root ptr to the lowest layer */\n if (parent->root != NULL)\n p->root = parent->root;\n else\n p->root = parent;\n\n /* tell new packet it's part of a tunnel */\n SET_TUNNEL_PKT(p);\n\n ret = DecodeTunnel(tv, dtv, p, GET_PKT_DATA(p),\n GET_PKT_LEN(p), pq, proto);\n \n if (unlikely(ret != TM_ECODE_OK) ||\n (proto == DECODE_TUNNEL_IPV6_TEREDO && (p->flags & PKT_IS_INVALID)))\n {\n /* Not a (valid) tunnel packet */\n SCLogDebug(\"tunnel packet is invalid\");\n\n p->root = NULL;\n UNSET_TUNNEL_PKT(p);\n TmqhOutputPacketpool(tv, p);\n SCReturnPtr(NULL, \"Packet\");\n }\n\n\n /* tell parent packet it's part of a tunnel */\n SET_TUNNEL_PKT(parent);\n\n /* increment tunnel packet refcnt in the root packet */\n TUNNEL_INCR_PKT_TPR(p);\n\n /* disable payload (not packet) inspection on the parent, as the payload\n * is the packet we will now run through the system separately. We do\n * check it against the ip/port/other header checks though */\n DecodeSetNoPayloadInspectionFlag(parent);\n SCReturnPtr(p, \"Packet\");\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ea735ba37dc0fd5f5622d031830b9a559dec1cc9", + "input": "zsetstrokecolorspace(i_ctx_t * i_ctx_p)\n{\n int code;\n\n zsetstrokecolorspace(i_ctx_t * i_ctx_p)\n {\n int code;\n \n code = zswapcolors(i_ctx_p);\n if (code < 0)\n /* Now, the actual continuation routine */\n push_op_estack(setstrokecolorspace_cont);\n\n code = zsetcolorspace(i_ctx_p);\n if (code >= 0)\n return o_push_estack;\n\n return code;\n}\n if (code >= 0)\n return o_push_estack;\n \n return code;\n }\n", + "target": "zsetstrokecolorspace(i_ctx_t * i_ctx_p)\n{\n int code;\n\n zsetstrokecolorspace(i_ctx_t * i_ctx_p)\n {\n int code;\n es_ptr iesp = esp; /* preserve exec stack in case of error */\n \n code = zswapcolors(i_ctx_p);\n if (code < 0)\n /* Now, the actual continuation routine */\n push_op_estack(setstrokecolorspace_cont);\n\n code = zsetcolorspace(i_ctx_p);\n if (code >= 0)\n return o_push_estack;\n\n return code;\n}\n if (code >= 0)\n return o_push_estack;\n \n /* Something went wrong, swap back to the non-stroking space and restore the exec stack */\n esp = iesp;\n (void)zswapcolors(i_ctx_p);\n return code;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e3adcf566cb278444830e7badfdcc3983e334fd1", + "input": " static TEE_Result set_rmem_param(const struct optee_msg_param_rmem *rmem,\n \t\t\t\t struct param_mem *mem)\n {\n \tuint64_t shm_ref = READ_ONCE(rmem->shm_ref);\n \n \tmem->mobj = mobj_reg_shm_get_by_cookie(shm_ref);\n\tif (!mem->mobj)\n\t\treturn TEE_ERROR_BAD_PARAMETERS;\n\n \tmem->offs = READ_ONCE(rmem->offs);\n \tmem->size = READ_ONCE(rmem->size);\n \n \treturn TEE_SUCCESS;\n }\n", + "target": " static TEE_Result set_rmem_param(const struct optee_msg_param_rmem *rmem,\n \t\t\t\t struct param_mem *mem)\n {\n\tsize_t req_size = 0;\n \tuint64_t shm_ref = READ_ONCE(rmem->shm_ref);\n \n \tmem->mobj = mobj_reg_shm_get_by_cookie(shm_ref);\n\tif (!mem->mobj)\n\t\treturn TEE_ERROR_BAD_PARAMETERS;\n\n \tmem->offs = READ_ONCE(rmem->offs);\n \tmem->size = READ_ONCE(rmem->size);\n \n\t/*\n\t * Check that the supplied offset and size is covered by the\n\t * previously verified MOBJ.\n\t */\n\tif (ADD_OVERFLOW(mem->offs, mem->size, &req_size) ||\n\t mem->mobj->size < req_size)\n\t\treturn TEE_ERROR_SECURITY;\n\n \treturn TEE_SUCCESS;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#282f53ffdc3b1902da86f6a0791af736837efbf8", + "input": "void ProfileChooserView::RemoveAccount() {\n DCHECK(!account_id_to_remove_.empty());\n ProfileOAuth2TokenService* oauth2_token_service =\n ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile());\n if (oauth2_token_service) {\n oauth2_token_service->RevokeCredentials(account_id_to_remove_);\n PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT);\n }\n account_id_to_remove_.clear();\n\n ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT);\n}\n", + "target": "void ProfileChooserView::RemoveAccount() {\n DCHECK(!account_id_to_remove_.empty());\n ProfileOAuth2TokenService* oauth2_token_service =\n ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile());\n if (oauth2_token_service) {\n oauth2_token_service->RevokeCredentials(\n account_id_to_remove_, signin_metrics::SourceForRefreshTokenOperation::\n kUserMenu_RemoveAccount);\n PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_REMOVE_ACCT);\n }\n account_id_to_remove_.clear();\n\n ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#82dc33da50338ac84c7b4102dc6513d897d0506a", + "input": "krb5_gss_wrap_size_limit(minor_status, context_handle, conf_req_flag,\n qop_req, req_output_size, max_input_size)\n OM_uint32 *minor_status;\n gss_ctx_id_t context_handle;\n int conf_req_flag;\n gss_qop_t qop_req;\n OM_uint32 req_output_size;\n OM_uint32 *max_input_size;\n{\n krb5_gss_ctx_id_rec *ctx;\n OM_uint32 data_size, conflen;\n OM_uint32 ohlen;\n int overhead;\n\n /* only default qop is allowed */\n if (qop_req != GSS_C_QOP_DEFAULT) {\n *minor_status = (OM_uint32) G_UNKNOWN_QOP;\n return(GSS_S_FAILURE);\n }\n \n ctx = (krb5_gss_ctx_id_rec *) context_handle;\n if (! ctx->established) {\n *minor_status = KG_CTX_INCOMPLETE;\n return(GSS_S_NO_CONTEXT);\n }\n\n if (ctx->proto == 1) {\n /* No pseudo-ASN.1 wrapper overhead, so no sequence length and\n OID. */\n OM_uint32 sz = req_output_size;\n\n /* Token header: 16 octets. */\n if (conf_req_flag) {\n krb5_key key;\n krb5_enctype enctype;\n\n key = ctx->have_acceptor_subkey ? ctx->acceptor_subkey\n : ctx->subkey;\n enctype = key->keyblock.enctype;\n\n while (sz > 0 && krb5_encrypt_size(sz, enctype) + 16 > req_output_size)\n sz--;\n /* Allow for encrypted copy of header. */\n if (sz > 16)\n sz -= 16;\n else\n sz = 0;\n#ifdef CFX_EXERCISE\n /* Allow for EC padding. In the MIT implementation, only\n added while testing. */\n if (sz > 65535)\n sz -= 65535;\n else\n sz = 0;\n#endif\n } else {\n krb5_cksumtype cksumtype;\n krb5_error_code err;\n size_t cksumsize;\n\n cksumtype = ctx->have_acceptor_subkey ? ctx->acceptor_subkey_cksumtype\n : ctx->cksumtype;\n\n err = krb5_c_checksum_length(ctx->k5_context, cksumtype, &cksumsize);\n if (err) {\n *minor_status = err;\n return GSS_S_FAILURE;\n }\n\n /* Allow for token header and checksum. */\n if (sz < 16 + cksumsize)\n sz = 0;\n else\n sz -= (16 + cksumsize);\n }\n\n *max_input_size = sz;\n *minor_status = 0;\n return GSS_S_COMPLETE;\n }\n\n /* Calculate the token size and subtract that from the output size */\n overhead = 7 + ctx->mech_used->length;\n data_size = req_output_size;\n conflen = kg_confounder_size(ctx->k5_context, ctx->enc->keyblock.enctype);\n data_size = (conflen + data_size + 8) & (~(OM_uint32)7);\n ohlen = g_token_size(ctx->mech_used,\n (unsigned int) (data_size + ctx->cksum_size + 14))\n - req_output_size;\n\n if (ohlen+overhead < req_output_size)\n /*\n * Cannot have trailer length that will cause us to pad over our\n * length.\n */\n *max_input_size = (req_output_size - ohlen - overhead) & (~(OM_uint32)7);\n else\n *max_input_size = 0;\n\n *minor_status = 0;\n return(GSS_S_COMPLETE);\n}\n", + "target": "krb5_gss_wrap_size_limit(minor_status, context_handle, conf_req_flag,\n qop_req, req_output_size, max_input_size)\n OM_uint32 *minor_status;\n gss_ctx_id_t context_handle;\n int conf_req_flag;\n gss_qop_t qop_req;\n OM_uint32 req_output_size;\n OM_uint32 *max_input_size;\n{\n krb5_gss_ctx_id_rec *ctx;\n OM_uint32 data_size, conflen;\n OM_uint32 ohlen;\n int overhead;\n\n /* only default qop is allowed */\n if (qop_req != GSS_C_QOP_DEFAULT) {\n *minor_status = (OM_uint32) G_UNKNOWN_QOP;\n return(GSS_S_FAILURE);\n }\n \n ctx = (krb5_gss_ctx_id_rec *) context_handle;\n if (ctx->terminated || !ctx->established) {\n *minor_status = KG_CTX_INCOMPLETE;\n return(GSS_S_NO_CONTEXT);\n }\n\n if (ctx->proto == 1) {\n /* No pseudo-ASN.1 wrapper overhead, so no sequence length and\n OID. */\n OM_uint32 sz = req_output_size;\n\n /* Token header: 16 octets. */\n if (conf_req_flag) {\n krb5_key key;\n krb5_enctype enctype;\n\n key = ctx->have_acceptor_subkey ? ctx->acceptor_subkey\n : ctx->subkey;\n enctype = key->keyblock.enctype;\n\n while (sz > 0 && krb5_encrypt_size(sz, enctype) + 16 > req_output_size)\n sz--;\n /* Allow for encrypted copy of header. */\n if (sz > 16)\n sz -= 16;\n else\n sz = 0;\n#ifdef CFX_EXERCISE\n /* Allow for EC padding. In the MIT implementation, only\n added while testing. */\n if (sz > 65535)\n sz -= 65535;\n else\n sz = 0;\n#endif\n } else {\n krb5_cksumtype cksumtype;\n krb5_error_code err;\n size_t cksumsize;\n\n cksumtype = ctx->have_acceptor_subkey ? ctx->acceptor_subkey_cksumtype\n : ctx->cksumtype;\n\n err = krb5_c_checksum_length(ctx->k5_context, cksumtype, &cksumsize);\n if (err) {\n *minor_status = err;\n return GSS_S_FAILURE;\n }\n\n /* Allow for token header and checksum. */\n if (sz < 16 + cksumsize)\n sz = 0;\n else\n sz -= (16 + cksumsize);\n }\n\n *max_input_size = sz;\n *minor_status = 0;\n return GSS_S_COMPLETE;\n }\n\n /* Calculate the token size and subtract that from the output size */\n overhead = 7 + ctx->mech_used->length;\n data_size = req_output_size;\n conflen = kg_confounder_size(ctx->k5_context, ctx->enc->keyblock.enctype);\n data_size = (conflen + data_size + 8) & (~(OM_uint32)7);\n ohlen = g_token_size(ctx->mech_used,\n (unsigned int) (data_size + ctx->cksum_size + 14))\n - req_output_size;\n\n if (ohlen+overhead < req_output_size)\n /*\n * Cannot have trailer length that will cause us to pad over our\n * length.\n */\n *max_input_size = (req_output_size - ohlen - overhead) & (~(OM_uint32)7);\n else\n *max_input_size = 0;\n\n *minor_status = 0;\n return(GSS_S_COMPLETE);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#bfa69d49b17f33635c79f79819b90a8d2089c4b3", + "input": "void RenderThread::EnsureWebKitInitialized() {\n if (webkit_client_.get())\n return;\n\n v8::V8::SetCounterFunction(StatsTable::FindLocation);\n v8::V8::SetCreateHistogramFunction(CreateHistogram);\n v8::V8::SetAddHistogramSampleFunction(AddHistogramSample);\n\n webkit_client_.reset(new RendererWebKitClientImpl);\n WebKit::initialize(webkit_client_.get());\n\n WebScriptController::enableV8SingleThreadMode();\n\n WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme));\n WebSecurityPolicy::registerURLSchemeAsLocal(chrome_ui_scheme);\n WebSecurityPolicy::registerURLSchemeAsNoAccess(chrome_ui_scheme);\n\n WebString print_ui_scheme(ASCIIToUTF16(chrome::kPrintScheme));\n WebSecurityPolicy::registerURLSchemeAsLocal(print_ui_scheme);\n WebSecurityPolicy::registerURLSchemeAsNoAccess(print_ui_scheme);\n\n#if defined(OS_WIN)\n WebScriptController::registerExtension(extensions_v8::GearsExtension::Get());\n#endif\n WebScriptController::registerExtension(\n extensions_v8::IntervalExtension::Get());\n WebScriptController::registerExtension(\n extensions_v8::LoadTimesExtension::Get());\n WebScriptController::registerExtension(\n extensions_v8::ExternalExtension::Get());\n\n const WebKit::WebString kExtensionScheme =\n WebKit::WebString::fromUTF8(chrome::kExtensionScheme);\n\n WebScriptController::registerExtension(\n ExtensionProcessBindings::Get(), kExtensionScheme);\n\n WebScriptController::registerExtension(\n BaseJsV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);\n WebScriptController::registerExtension(\n BaseJsV8Extension::Get(), kExtensionScheme);\n WebScriptController::registerExtension(\n JsonSchemaJsV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);\n WebScriptController::registerExtension(JsonSchemaJsV8Extension::Get(),\n kExtensionScheme);\n WebScriptController::registerExtension(\n EventBindings::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);\n WebScriptController::registerExtension(EventBindings::Get(),\n kExtensionScheme);\n WebScriptController::registerExtension(\n RendererExtensionBindings::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);\n WebScriptController::registerExtension(\n RendererExtensionBindings::Get(), kExtensionScheme);\n WebScriptController::registerExtension(\n ExtensionApiTestV8Extension::Get(), kExtensionScheme);\n WebScriptController::registerExtension(\n ExtensionApiTestV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);\n\n renderer_web_database_observer_.reset(new RendererWebDatabaseObserver(this));\n WebKit::WebDatabase::setObserver(renderer_web_database_observer_.get());\n\n const CommandLine& command_line = *CommandLine::ForCurrentProcess();\n\n if (command_line.HasSwitch(switches::kEnableBenchmarking)) {\n WebScriptController::registerExtension(\n extensions_v8::BenchmarkingExtension::Get());\n }\n\n if (command_line.HasSwitch(switches::kPlaybackMode) ||\n command_line.HasSwitch(switches::kRecordMode) ||\n command_line.HasSwitch(switches::kNoJsRandomness)) {\n WebScriptController::registerExtension(\n extensions_v8::PlaybackExtension::Get());\n }\n\n WebRuntimeFeatures::enableMediaPlayer(\n RenderProcess::current()->initialized_media_library());\n\n WebRuntimeFeatures::enableSockets(\n command_line.HasSwitch(switches::kEnableWebSockets));\n \n WebRuntimeFeatures::enableDatabase(\n command_line.HasSwitch(switches::kEnableDatabases));\n }\n", + "target": "void RenderThread::EnsureWebKitInitialized() {\n if (webkit_client_.get())\n return;\n\n v8::V8::SetCounterFunction(StatsTable::FindLocation);\n v8::V8::SetCreateHistogramFunction(CreateHistogram);\n v8::V8::SetAddHistogramSampleFunction(AddHistogramSample);\n\n webkit_client_.reset(new RendererWebKitClientImpl);\n WebKit::initialize(webkit_client_.get());\n\n WebScriptController::enableV8SingleThreadMode();\n\n WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme));\n WebSecurityPolicy::registerURLSchemeAsLocal(chrome_ui_scheme);\n WebSecurityPolicy::registerURLSchemeAsNoAccess(chrome_ui_scheme);\n\n WebString print_ui_scheme(ASCIIToUTF16(chrome::kPrintScheme));\n WebSecurityPolicy::registerURLSchemeAsLocal(print_ui_scheme);\n WebSecurityPolicy::registerURLSchemeAsNoAccess(print_ui_scheme);\n\n#if defined(OS_WIN)\n WebScriptController::registerExtension(extensions_v8::GearsExtension::Get());\n#endif\n WebScriptController::registerExtension(\n extensions_v8::IntervalExtension::Get());\n WebScriptController::registerExtension(\n extensions_v8::LoadTimesExtension::Get());\n WebScriptController::registerExtension(\n extensions_v8::ExternalExtension::Get());\n\n const WebKit::WebString kExtensionScheme =\n WebKit::WebString::fromUTF8(chrome::kExtensionScheme);\n\n WebScriptController::registerExtension(\n ExtensionProcessBindings::Get(), kExtensionScheme);\n\n WebScriptController::registerExtension(\n BaseJsV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);\n WebScriptController::registerExtension(\n BaseJsV8Extension::Get(), kExtensionScheme);\n WebScriptController::registerExtension(\n JsonSchemaJsV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);\n WebScriptController::registerExtension(JsonSchemaJsV8Extension::Get(),\n kExtensionScheme);\n WebScriptController::registerExtension(\n EventBindings::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);\n WebScriptController::registerExtension(EventBindings::Get(),\n kExtensionScheme);\n WebScriptController::registerExtension(\n RendererExtensionBindings::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);\n WebScriptController::registerExtension(\n RendererExtensionBindings::Get(), kExtensionScheme);\n WebScriptController::registerExtension(\n ExtensionApiTestV8Extension::Get(), kExtensionScheme);\n WebScriptController::registerExtension(\n ExtensionApiTestV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);\n\n renderer_web_database_observer_.reset(new RendererWebDatabaseObserver(this));\n WebKit::WebDatabase::setObserver(renderer_web_database_observer_.get());\n\n const CommandLine& command_line = *CommandLine::ForCurrentProcess();\n\n if (command_line.HasSwitch(switches::kEnableBenchmarking)) {\n WebScriptController::registerExtension(\n extensions_v8::BenchmarkingExtension::Get());\n }\n\n if (command_line.HasSwitch(switches::kPlaybackMode) ||\n command_line.HasSwitch(switches::kRecordMode) ||\n command_line.HasSwitch(switches::kNoJsRandomness)) {\n WebScriptController::registerExtension(\n extensions_v8::PlaybackExtension::Get());\n }\n\n WebRuntimeFeatures::enableMediaPlayer(\n RenderProcess::current()->initialized_media_library());\n\n WebRuntimeFeatures::enableSockets(\n command_line.HasSwitch(switches::kEnableWebSockets));\n \n WebRuntimeFeatures::enableDatabase(\n command_line.HasSwitch(switches::kEnableDatabases));\n\n#if defined(OS_WIN)\n // We don't yet support notifications on non-Windows, so hide it from pages.\n WebRuntimeFeatures::enableNotifications(\n command_line.HasSwitch(switches::kEnableDesktopNotifications));\n#endif\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3b2943f5d343f5da393b99fe9efe6cefc6856aa1", + "input": "void SavePackage::OnReceivedSavableResourceLinksForCurrentPage(\n const std::vector& resources_list,\n const std::vector& referrers_list,\n const std::vector& frames_list) {\n if (wait_state_ != RESOURCES_LIST)\n return;\n \n DCHECK(resources_list.size() == referrers_list.size());\n all_save_items_count_ = static_cast(resources_list.size()) +\n static_cast(frames_list.size());\n \n if (download_ && download_->IsInProgress())\n download_->SetTotalBytes(all_save_items_count_);\n\n if (all_save_items_count_) {\n for (int i = 0; i < static_cast(resources_list.size()); ++i) {\n const GURL& u = resources_list[i];\n DCHECK(u.is_valid());\n SaveFileCreateInfo::SaveFileSource save_source = u.SchemeIsFile() ?\n SaveFileCreateInfo::SAVE_FILE_FROM_FILE :\n SaveFileCreateInfo::SAVE_FILE_FROM_NET;\n SaveItem* save_item = new SaveItem(u, referrers_list[i],\n this, save_source);\n waiting_item_queue_.push(save_item);\n }\n for (int i = 0; i < static_cast(frames_list.size()); ++i) {\n const GURL& u = frames_list[i];\n DCHECK(u.is_valid());\n SaveItem* save_item = new SaveItem(\n u, Referrer(), this, SaveFileCreateInfo::SAVE_FILE_FROM_DOM);\n waiting_item_queue_.push(save_item);\n }\n wait_state_ = NET_FILES;\n DoSavingProcess();\n } else {\n Cancel(true);\n }\n}\n", + "target": "void SavePackage::OnReceivedSavableResourceLinksForCurrentPage(\n const std::vector& resources_list,\n const std::vector& referrers_list,\n const std::vector& frames_list) {\n if (wait_state_ != RESOURCES_LIST)\n return;\n \n if (resources_list.size() != referrers_list.size())\n return;\n\n all_save_items_count_ = static_cast(resources_list.size()) +\n static_cast(frames_list.size());\n \n if (download_ && download_->IsInProgress())\n download_->SetTotalBytes(all_save_items_count_);\n\n if (all_save_items_count_) {\n for (int i = 0; i < static_cast(resources_list.size()); ++i) {\n const GURL& u = resources_list[i];\n DCHECK(u.is_valid());\n SaveFileCreateInfo::SaveFileSource save_source = u.SchemeIsFile() ?\n SaveFileCreateInfo::SAVE_FILE_FROM_FILE :\n SaveFileCreateInfo::SAVE_FILE_FROM_NET;\n SaveItem* save_item = new SaveItem(u, referrers_list[i],\n this, save_source);\n waiting_item_queue_.push(save_item);\n }\n for (int i = 0; i < static_cast(frames_list.size()); ++i) {\n const GURL& u = frames_list[i];\n DCHECK(u.is_valid());\n SaveItem* save_item = new SaveItem(\n u, Referrer(), this, SaveFileCreateInfo::SAVE_FILE_FROM_DOM);\n waiting_item_queue_.push(save_item);\n }\n wait_state_ = NET_FILES;\n DoSavingProcess();\n } else {\n Cancel(true);\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " virtual void SetUp() {\n fwd_txfm_ = GET_PARAM(0);\n inv_txfm_ = GET_PARAM(1);\n\n tx_type_ = GET_PARAM(2);\n pitch_ = 8;\n fwd_txfm_ref = fht8x8_ref;\n }\n", + "target": " virtual void SetUp() {\n fwd_txfm_ = GET_PARAM(0);\n inv_txfm_ = GET_PARAM(1);\n\n tx_type_ = GET_PARAM(2);\n pitch_ = 8;\n fwd_txfm_ref = fht8x8_ref;\n bit_depth_ = GET_PARAM(3);\n mask_ = (1 << bit_depth_) - 1;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f3d3342602f8bcbf37d7c46641cb9bca7618eb1c", + "input": "mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock,\n\t\t struct msghdr *msg, size_t len, int flags)\n {\n \tstruct sk_buff\t\t*skb;\n \tstruct sock\t\t*sk = sock->sk;\n\tstruct sockaddr_mISDN\t*maddr;\n \n \tint\t\tcopied, err;\n \n\tif (*debug & DEBUG_SOCKET)\n\t\tprintk(KERN_DEBUG \"%s: len %d, flags %x ch.nr %d, proto %x\\n\",\n\t\t __func__, (int)len, flags, _pms(sk)->ch.nr,\n\t\t sk->sk_protocol);\n\tif (flags & (MSG_OOB))\n\t\treturn -EOPNOTSUPP;\n\n\tif (sk->sk_state == MISDN_CLOSED)\n\t\treturn 0;\n\n\tskb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &err);\n \tif (!skb)\n \t\treturn err;\n \n\tif (msg->msg_namelen >= sizeof(struct sockaddr_mISDN)) {\n\t\tmsg->msg_namelen = sizeof(struct sockaddr_mISDN);\n\t\tmaddr = (struct sockaddr_mISDN *)msg->msg_name;\n \t\tmaddr->family = AF_ISDN;\n \t\tmaddr->dev = _pms(sk)->dev->id;\n \t\tif ((sk->sk_protocol == ISDN_P_LAPD_TE) ||\n\t\t (sk->sk_protocol == ISDN_P_LAPD_NT)) {\n\t\t\tmaddr->channel = (mISDN_HEAD_ID(skb) >> 16) & 0xff;\n\t\t\tmaddr->tei = (mISDN_HEAD_ID(skb) >> 8) & 0xff;\n\t\t\tmaddr->sapi = mISDN_HEAD_ID(skb) & 0xff;\n\t\t} else {\n\t\t\tmaddr->channel = _pms(sk)->ch.nr;\n \t\t\tmaddr->sapi = _pms(sk)->ch.addr & 0xFF;\n \t\t\tmaddr->tei = (_pms(sk)->ch.addr >> 8) & 0xFF;\n \t\t}\n\t} else {\n\t\tif (msg->msg_namelen)\n\t\t\tprintk(KERN_WARNING \"%s: too small namelen %d\\n\",\n\t\t\t __func__, msg->msg_namelen);\n\t\tmsg->msg_namelen = 0;\n \t}\n \n \tcopied = skb->len + MISDN_HEADER_LEN;\n\tif (len < copied) {\n\t\tif (flags & MSG_PEEK)\n\t\t\tatomic_dec(&skb->users);\n\t\telse\n\t\t\tskb_queue_head(&sk->sk_receive_queue, skb);\n\t\treturn -ENOSPC;\n\t}\n\tmemcpy(skb_push(skb, MISDN_HEADER_LEN), mISDN_HEAD_P(skb),\n\t MISDN_HEADER_LEN);\n\n\terr = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);\n\n\tmISDN_sock_cmsg(sk, msg, skb);\n\n\tskb_free_datagram(sk, skb);\n\n\treturn err ? : copied;\n}\n", + "target": "mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock,\n\t\t struct msghdr *msg, size_t len, int flags)\n {\n \tstruct sk_buff\t\t*skb;\n \tstruct sock\t\t*sk = sock->sk;\n \n \tint\t\tcopied, err;\n \n\tif (*debug & DEBUG_SOCKET)\n\t\tprintk(KERN_DEBUG \"%s: len %d, flags %x ch.nr %d, proto %x\\n\",\n\t\t __func__, (int)len, flags, _pms(sk)->ch.nr,\n\t\t sk->sk_protocol);\n\tif (flags & (MSG_OOB))\n\t\treturn -EOPNOTSUPP;\n\n\tif (sk->sk_state == MISDN_CLOSED)\n\t\treturn 0;\n\n\tskb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &err);\n \tif (!skb)\n \t\treturn err;\n \n\tif (msg->msg_name) {\n\t\tstruct sockaddr_mISDN *maddr = msg->msg_name;\n\n \t\tmaddr->family = AF_ISDN;\n \t\tmaddr->dev = _pms(sk)->dev->id;\n \t\tif ((sk->sk_protocol == ISDN_P_LAPD_TE) ||\n\t\t (sk->sk_protocol == ISDN_P_LAPD_NT)) {\n\t\t\tmaddr->channel = (mISDN_HEAD_ID(skb) >> 16) & 0xff;\n\t\t\tmaddr->tei = (mISDN_HEAD_ID(skb) >> 8) & 0xff;\n\t\t\tmaddr->sapi = mISDN_HEAD_ID(skb) & 0xff;\n\t\t} else {\n\t\t\tmaddr->channel = _pms(sk)->ch.nr;\n \t\t\tmaddr->sapi = _pms(sk)->ch.addr & 0xFF;\n \t\t\tmaddr->tei = (_pms(sk)->ch.addr >> 8) & 0xFF;\n \t\t}\n\t\tmsg->msg_namelen = sizeof(*maddr);\n \t}\n \n \tcopied = skb->len + MISDN_HEADER_LEN;\n\tif (len < copied) {\n\t\tif (flags & MSG_PEEK)\n\t\t\tatomic_dec(&skb->users);\n\t\telse\n\t\t\tskb_queue_head(&sk->sk_receive_queue, skb);\n\t\treturn -ENOSPC;\n\t}\n\tmemcpy(skb_push(skb, MISDN_HEADER_LEN), mISDN_HEAD_P(skb),\n\t MISDN_HEADER_LEN);\n\n\terr = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);\n\n\tmISDN_sock_cmsg(sk, msg, skb);\n\n\tskb_free_datagram(sk, skb);\n\n\treturn err ? : copied;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1e84674d95353c64e5c4c0e7232ae86fd6ea813b", + "input": "int jpc_bitstream_putbits(jpc_bitstream_t *bitstream, int n, long v)\n{\n\tint m;\n \n \t/* We can reliably put at most 31 bits since ISO/IEC 9899 only\n \t guarantees that a long can represent values up to 2^31-1. */\n\tassert(n >= 0 && n < 32);\n \t/* Ensure that only the bits to be output are nonzero. */\n \tassert(!(v & (~JAS_ONES(n))));\n \n\t/* Put the desired number of bits to the specified bit stream. */\n\tm = n - 1;\n\twhile (--n >= 0) {\n\t\tif (jpc_bitstream_putbit(bitstream, (v >> m) & 1) == EOF) {\n\t\t\treturn EOF;\n\t\t}\n\t\tv <<= 1;\n\t}\n\treturn 0;\n}\n", + "target": "int jpc_bitstream_putbits(jpc_bitstream_t *bitstream, int n, long v)\n{\n\tint m;\n \n \t/* We can reliably put at most 31 bits since ISO/IEC 9899 only\n \t guarantees that a long can represent values up to 2^31-1. */\n\t//assert(n >= 0 && n < 32);\n\tif (n < 0 || n >= 32) {\n\t\treturn EOF;\n\t}\n \t/* Ensure that only the bits to be output are nonzero. */\n \tassert(!(v & (~JAS_ONES(n))));\n \n\t/* Put the desired number of bits to the specified bit stream. */\n\tm = n - 1;\n\twhile (--n >= 0) {\n\t\tif (jpc_bitstream_putbit(bitstream, (v >> m) & 1) == EOF) {\n\t\t\treturn EOF;\n\t\t}\n\t\tv <<= 1;\n\t}\n\treturn 0;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#58936737b65052775b67b1409b87edbbbc09f72b", + "input": " int BlobURLRequestJob::ComputeBytesToRead() const {\n int64 current_item_remaining_bytes =\n item_length_list_[current_item_index_] - current_item_offset_;\n int64 remaining_bytes = std::min(current_item_remaining_bytes,\n remaining_bytes_);\n return static_cast(std::min(\n static_cast(read_buf_->BytesRemaining()),\n remaining_bytes));\n }\n", + "target": " int BlobURLRequestJob::ComputeBytesToRead() const {\n int64 current_item_length = item_length_list_[current_item_index_];\n\n int64 item_remaining = current_item_length - current_item_offset_;\n int64 buf_remaining = read_buf_->BytesRemaining();\n int64 max_remaining = std::numeric_limits::max();\n\n int64 min = std::min(std::min(std::min(item_remaining,\n buf_remaining),\n remaining_bytes_),\n max_remaining);\n\n return static_cast(min);\n }\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc7b094a338c6c521f918f478e993f0f74bbea0d", + "input": " void SendHandwritingStroke(const HandwritingStroke& stroke) {\n if (stroke.size() < 2) {\n LOG(WARNING) << \"Empty stroke data or a single dot is passed.\";\n return;\n }\n\n IBusInputContext* context = GetInputContext(input_context_path_, ibus_);\n if (!context) {\n return;\n }\n\n const size_t raw_stroke_size = stroke.size() * 2;\n scoped_array raw_stroke(new double[raw_stroke_size]);\n for (size_t n = 0; n < stroke.size(); ++n) {\n raw_stroke[n * 2] = stroke[n].first; // x\n raw_stroke[n * 2 + 1] = stroke[n].second; // y\n }\n ibus_input_context_process_hand_writing_event(\n context, raw_stroke.get(), raw_stroke_size);\n g_object_unref(context);\n }\n", + "target": " void SendHandwritingStroke(const HandwritingStroke& stroke) {\n // IBusController override.\n virtual void SendHandwritingStroke(const HandwritingStroke& stroke) {\n if (stroke.size() < 2) {\n LOG(WARNING) << \"Empty stroke data or a single dot is passed.\";\n return;\n }\n\n IBusInputContext* context = GetInputContext(input_context_path_, ibus_);\n if (!context) {\n return;\n }\n\n const size_t raw_stroke_size = stroke.size() * 2;\n scoped_array raw_stroke(new double[raw_stroke_size]);\n for (size_t n = 0; n < stroke.size(); ++n) {\n raw_stroke[n * 2] = stroke[n].first; // x\n raw_stroke[n * 2 + 1] = stroke[n].second; // y\n }\n ibus_input_context_process_hand_writing_event(\n context, raw_stroke.get(), raw_stroke_size);\n g_object_unref(context);\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a8b0ca17b80e92faab46ee7179ba9e99ccb61233", + "input": "static int p4_pmu_handle_irq(struct pt_regs *regs)\n{\n\tstruct perf_sample_data data;\n\tstruct cpu_hw_events *cpuc;\n\tstruct perf_event *event;\n\tstruct hw_perf_event *hwc;\n\tint idx, handled = 0;\n\tu64 val;\n\n\tperf_sample_data_init(&data, 0);\n\n\tcpuc = &__get_cpu_var(cpu_hw_events);\n\n\tfor (idx = 0; idx < x86_pmu.num_counters; idx++) {\n\t\tint overflow;\n\n\t\tif (!test_bit(idx, cpuc->active_mask)) {\n\t\t\t/* catch in-flight IRQs */\n\t\t\tif (__test_and_clear_bit(idx, cpuc->running))\n\t\t\t\thandled++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tevent = cpuc->events[idx];\n\t\thwc = &event->hw;\n\n\t\tWARN_ON_ONCE(hwc->idx != idx);\n\n\t\t/* it might be unflagged overflow */\n\t\toverflow = p4_pmu_clear_cccr_ovf(hwc);\n\n\t\tval = x86_perf_event_update(event);\n\t\tif (!overflow && (val & (1ULL << (x86_pmu.cntval_bits - 1))))\n\t\t\tcontinue;\n\n\t\thandled += overflow;\n\n\t\t/* event overflow for sure */\n\t\tdata.period = event->hw.last_period;\n \n \t\tif (!x86_perf_event_set_period(event))\n \t\t\tcontinue;\n\t\tif (perf_event_overflow(event, 1, &data, regs))\n \t\t\tx86_pmu_stop(event, 0);\n \t}\n \n\tif (handled)\n\t\tinc_irq_stat(apic_perf_irqs);\n\n\t/*\n\t * When dealing with the unmasking of the LVTPC on P4 perf hw, it has\n\t * been observed that the OVF bit flag has to be cleared first _before_\n\t * the LVTPC can be unmasked.\n\t *\n\t * The reason is the NMI line will continue to be asserted while the OVF\n\t * bit is set. This causes a second NMI to generate if the LVTPC is\n\t * unmasked before the OVF bit is cleared, leading to unknown NMI\n\t * messages.\n\t */\n\tapic_write(APIC_LVTPC, APIC_DM_NMI);\n\n\treturn handled;\n}\n", + "target": "static int p4_pmu_handle_irq(struct pt_regs *regs)\n{\n\tstruct perf_sample_data data;\n\tstruct cpu_hw_events *cpuc;\n\tstruct perf_event *event;\n\tstruct hw_perf_event *hwc;\n\tint idx, handled = 0;\n\tu64 val;\n\n\tperf_sample_data_init(&data, 0);\n\n\tcpuc = &__get_cpu_var(cpu_hw_events);\n\n\tfor (idx = 0; idx < x86_pmu.num_counters; idx++) {\n\t\tint overflow;\n\n\t\tif (!test_bit(idx, cpuc->active_mask)) {\n\t\t\t/* catch in-flight IRQs */\n\t\t\tif (__test_and_clear_bit(idx, cpuc->running))\n\t\t\t\thandled++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tevent = cpuc->events[idx];\n\t\thwc = &event->hw;\n\n\t\tWARN_ON_ONCE(hwc->idx != idx);\n\n\t\t/* it might be unflagged overflow */\n\t\toverflow = p4_pmu_clear_cccr_ovf(hwc);\n\n\t\tval = x86_perf_event_update(event);\n\t\tif (!overflow && (val & (1ULL << (x86_pmu.cntval_bits - 1))))\n\t\t\tcontinue;\n\n\t\thandled += overflow;\n\n\t\t/* event overflow for sure */\n\t\tdata.period = event->hw.last_period;\n \n \t\tif (!x86_perf_event_set_period(event))\n \t\t\tcontinue;\n\t\tif (perf_event_overflow(event, &data, regs))\n \t\t\tx86_pmu_stop(event, 0);\n \t}\n \n\tif (handled)\n\t\tinc_irq_stat(apic_perf_irqs);\n\n\t/*\n\t * When dealing with the unmasking of the LVTPC on P4 perf hw, it has\n\t * been observed that the OVF bit flag has to be cleared first _before_\n\t * the LVTPC can be unmasked.\n\t *\n\t * The reason is the NMI line will continue to be asserted while the OVF\n\t * bit is set. This causes a second NMI to generate if the LVTPC is\n\t * unmasked before the OVF bit is cleared, leading to unknown NMI\n\t * messages.\n\t */\n\tapic_write(APIC_LVTPC, APIC_DM_NMI);\n\n\treturn handled;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f5ec0afb766f19519ea9623152cca3bbe2229500", + "input": "static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,\n gint64 *data_offset)\n {\n \tgint64\toffset;\n\tint\tpkt_len;\n \tchar\tline[COSINE_LINE_LENGTH];\n \n \t/* Find the next packet */\n\toffset = cosine_seek_next_packet(wth, err, err_info, line);\n\tif (offset < 0)\n \t\treturn FALSE;\n \t*data_offset = offset;\n \n\t/* Parse the header */\n\tpkt_len = parse_cosine_rec_hdr(&wth->phdr, line, err, err_info);\n\tif (pkt_len == -1)\n\t\treturn FALSE;\n\t/* Convert the ASCII hex dump to binary data */\n\treturn parse_cosine_hex_dump(wth->fh, &wth->phdr, pkt_len,\n\t wth->frame_buffer, err, err_info);\n }\n", + "target": "static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,\n gint64 *data_offset)\n {\n \tgint64\toffset;\n \tchar\tline[COSINE_LINE_LENGTH];\n \n \t/* Find the next packet */\n\toffset = cosine_seek_next_packet(wth, err, err_info, line);\n\tif (offset < 0)\n \t\treturn FALSE;\n \t*data_offset = offset;\n \n\t/* Parse the header and convert the ASCII hex dump to binary data */\n\treturn parse_cosine_packet(wth->fh, &wth->phdr, wth->frame_buffer,\n\t line, err, err_info);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#51dfe5e3b332bcea02fb4d4c7493ae841106dd9b", + "input": "void PulseAudioMixer::DoInit(InitDoneCallback* callback) {\n bool success = PulseAudioInit();\n callback->Run(success);\n delete callback;\n }\n", + "target": "void PulseAudioMixer::DoInit(InitDoneCallback* callback) {\nvoid AudioMixerPulse::DoInit(InitDoneCallback* callback) {\n bool success = PulseAudioInit();\n callback->Run(success);\n delete callback;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7cf563aba8f4b3bab68e9bfe43824d952241dcf7", + "input": "void HostPortAllocatorSession::SendSessionRequest(const std::string& host,\n int port) {\n GURL url(\"https://\" + host + \":\" + base::IntToString(port) +\n GetSessionRequestUrl() + \"&sn=1\");\n scoped_ptr url_fetcher(new UrlFetcher(url, UrlFetcher::GET));\n url_fetcher->SetRequestContext(url_context_);\n url_fetcher->SetHeader(\"X-Talk-Google-Relay-Auth\", relay_token());\n url_fetcher->SetHeader(\"X-Google-Relay-Auth\", relay_token());\n url_fetcher->SetHeader(\"X-Stream-Type\", \"chromoting\");\n url_fetcher->Start(base::Bind(&HostPortAllocatorSession::OnSessionRequestDone,\n base::Unretained(this), url_fetcher.get()));\n url_fetchers_.insert(url_fetcher.release());\n }\n", + "target": "void HostPortAllocatorSession::SendSessionRequest(const std::string& host,\n int port) {\n GURL url(\"https://\" + host + \":\" + base::IntToString(port) +\n GetSessionRequestUrl() + \"&sn=1\");\n scoped_ptr url_fetcher(\n net::URLFetcher::Create(url, net::URLFetcher::GET, this));\n url_fetcher->SetRequestContext(url_context_);\n url_fetcher->AddExtraRequestHeader(\n \"X-Talk-Google-Relay-Auth: \" + relay_token());\n url_fetcher->AddExtraRequestHeader(\"X-Google-Relay-Auth: \" + relay_token());\n url_fetcher->AddExtraRequestHeader(\"X-Stream-Type: chromoting\");\n url_fetcher->Start();\n url_fetchers_.insert(url_fetcher.release());\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dee1f973ca341c266229faa5a1a5bb268bed3531", + "input": "static int ext4_split_extent(handle_t *handle,\n\t\t\t struct inode *inode,\n\t\t\t struct ext4_ext_path *path,\n\t\t\t struct ext4_map_blocks *map,\n\t\t\t int split_flag,\n\t\t\t int flags)\n{\n\text4_lblk_t ee_block;\n\tstruct ext4_extent *ex;\n\tunsigned int ee_len, depth;\n\tint err = 0;\n\tint uninitialized;\n\tint split_flag1, flags1;\n\n\tdepth = ext_depth(inode);\n\tex = path[depth].p_ext;\n\tee_block = le32_to_cpu(ex->ee_block);\n\tee_len = ext4_ext_get_actual_len(ex);\n \tuninitialized = ext4_ext_is_uninitialized(ex);\n \n \tif (map->m_lblk + map->m_len < ee_block + ee_len) {\n\t\tsplit_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT ?\n\t\t\t EXT4_EXT_MAY_ZEROOUT : 0;\n \t\tflags1 = flags | EXT4_GET_BLOCKS_PRE_IO;\n \t\tif (uninitialized)\n \t\t\tsplit_flag1 |= EXT4_EXT_MARK_UNINIT1 |\n \t\t\t\t EXT4_EXT_MARK_UNINIT2;\n \t\terr = ext4_split_extent_at(handle, inode, path,\n \t\t\t\tmap->m_lblk + map->m_len, split_flag1, flags1);\n \t\tif (err)\n\t\t\tgoto out;\n\t}\n\n\text4_ext_drop_refs(path);\n\tpath = ext4_ext_find_extent(inode, map->m_lblk, path);\n\tif (IS_ERR(path))\n \t\treturn PTR_ERR(path);\n \n \tif (map->m_lblk >= ee_block) {\n\t\tsplit_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT ?\n\t\t\t EXT4_EXT_MAY_ZEROOUT : 0;\n \t\tif (uninitialized)\n \t\t\tsplit_flag1 |= EXT4_EXT_MARK_UNINIT1;\n \t\tif (split_flag & EXT4_EXT_MARK_UNINIT2)\n\t\t\tsplit_flag1 |= EXT4_EXT_MARK_UNINIT2;\n\t\terr = ext4_split_extent_at(handle, inode, path,\n\t\t\t\tmap->m_lblk, split_flag1, flags);\n\t\tif (err)\n\t\t\tgoto out;\n\t}\n\n\text4_ext_show_leaf(inode, path);\nout:\n\treturn err ? err : map->m_len;\n}\n", + "target": "static int ext4_split_extent(handle_t *handle,\n\t\t\t struct inode *inode,\n\t\t\t struct ext4_ext_path *path,\n\t\t\t struct ext4_map_blocks *map,\n\t\t\t int split_flag,\n\t\t\t int flags)\n{\n\text4_lblk_t ee_block;\n\tstruct ext4_extent *ex;\n\tunsigned int ee_len, depth;\n\tint err = 0;\n\tint uninitialized;\n\tint split_flag1, flags1;\n\n\tdepth = ext_depth(inode);\n\tex = path[depth].p_ext;\n\tee_block = le32_to_cpu(ex->ee_block);\n\tee_len = ext4_ext_get_actual_len(ex);\n \tuninitialized = ext4_ext_is_uninitialized(ex);\n \n \tif (map->m_lblk + map->m_len < ee_block + ee_len) {\n\t\tsplit_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT;\n \t\tflags1 = flags | EXT4_GET_BLOCKS_PRE_IO;\n \t\tif (uninitialized)\n \t\t\tsplit_flag1 |= EXT4_EXT_MARK_UNINIT1 |\n \t\t\t\t EXT4_EXT_MARK_UNINIT2;\n\t\tif (split_flag & EXT4_EXT_DATA_VALID2)\n\t\t\tsplit_flag1 |= EXT4_EXT_DATA_VALID1;\n \t\terr = ext4_split_extent_at(handle, inode, path,\n \t\t\t\tmap->m_lblk + map->m_len, split_flag1, flags1);\n \t\tif (err)\n\t\t\tgoto out;\n\t}\n\n\text4_ext_drop_refs(path);\n\tpath = ext4_ext_find_extent(inode, map->m_lblk, path);\n\tif (IS_ERR(path))\n \t\treturn PTR_ERR(path);\n \n \tif (map->m_lblk >= ee_block) {\n\t\tsplit_flag1 = split_flag & (EXT4_EXT_MAY_ZEROOUT |\n\t\t\t\t\t EXT4_EXT_DATA_VALID2);\n \t\tif (uninitialized)\n \t\t\tsplit_flag1 |= EXT4_EXT_MARK_UNINIT1;\n \t\tif (split_flag & EXT4_EXT_MARK_UNINIT2)\n\t\t\tsplit_flag1 |= EXT4_EXT_MARK_UNINIT2;\n\t\terr = ext4_split_extent_at(handle, inode, path,\n\t\t\t\tmap->m_lblk, split_flag1, flags);\n\t\tif (err)\n\t\t\tgoto out;\n\t}\n\n\text4_ext_show_leaf(inode, path);\nout:\n\treturn err ? err : map->m_len;\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5bf703700ee4a5d6eae20da07cb7a29369667aef", + "input": "CatalogueRescan (FontPathElementPtr fpe)\n{\n CataloguePtr\tcat = fpe->private;\n char\t\tlink[MAXFONTFILENAMELEN];\n char\t\tdest[MAXFONTFILENAMELEN];\n char\t\t*attrib;\n FontPathElementPtr\tsubfpe;\n struct stat\t\tstatbuf;\n const char\t\t*path;\n DIR\t\t\t*dir;\n struct dirent\t*entry;\n int\t\t\tlen;\n int\t\t\tpathlen;\n\n path = fpe->name + strlen(CataloguePrefix);\n if (stat(path, &statbuf) < 0 || !S_ISDIR(statbuf.st_mode))\n\treturn BadFontPath;\n\n if (statbuf.st_mtime <= cat->mtime)\n\treturn Successful;\n\n dir = opendir(path);\n if (dir == NULL)\n {\n\txfree(cat);\n\treturn BadFontPath;\n }\n\n CatalogueUnrefFPEs (fpe);\n while (entry = readdir(dir), entry != NULL)\n {\n \tsnprintf(link, sizeof link, \"%s/%s\", path, entry->d_name);\n\tlen = readlink(link, dest, sizeof dest);\n \tif (len < 0)\n \t continue;\n\tdest[len] = '\\0';\n\n\tif (dest[0] != '/')\n\t{\n\t pathlen = strlen(path);\n\t memmove(dest + pathlen + 1, dest, sizeof dest - pathlen - 1);\n\t memcpy(dest, path, pathlen);\n\t memcpy(dest + pathlen, \"/\", 1);\n\t len += pathlen + 1;\n\t}\n\n\tattrib = strchr(link, ':');\n\tif (attrib && len + strlen(attrib) < sizeof dest)\n\t{\n\t memcpy(dest + len, attrib, strlen(attrib));\n\t len += strlen(attrib);\n\t}\n\n\tsubfpe = xalloc(sizeof *subfpe);\n\tif (subfpe == NULL)\n\t continue;\n\n\t/* The fonts returned by OpenFont will point back to the\n\t * subfpe they come from. So set the type of the subfpe to\n\t * what the catalogue fpe was assigned, so calls to CloseFont\n\t * (which uses font->fpe->type) goes to CatalogueCloseFont. */\n\tsubfpe->type = fpe->type;\n\tsubfpe->name_length = len;\n\tsubfpe->name = xalloc (len + 1);\n\tif (subfpe == NULL)\n\t{\n\t xfree(subfpe);\n\t continue;\n\t}\n\n\tmemcpy(subfpe->name, dest, len);\n\tsubfpe->name[len] = '\\0';\n\n\t/* The X server will manipulate the subfpe ref counts\n\t * associated with the font in OpenFont and CloseFont, so we\n\t * have to make sure it's valid. */\n\tsubfpe->refcount = 1;\n\n\tif (FontFileInitFPE (subfpe) != Successful)\n\t{\n\t xfree(subfpe->name);\n\t xfree(subfpe);\n\t continue;\n\t}\n\n\tif (CatalogueAddFPE(cat, subfpe) != Successful)\n\t{\n\t FontFileFreeFPE (subfpe);\n\t xfree(subfpe);\n\t continue;\n\t}\n }\n\n closedir(dir);\n\n qsort(cat->fpeList,\n\t cat->fpeCount, sizeof cat->fpeList[0], ComparePriority);\n\n cat->mtime = statbuf.st_mtime;\n\n return Successful;\n}\n", + "target": "CatalogueRescan (FontPathElementPtr fpe)\n{\n CataloguePtr\tcat = fpe->private;\n char\t\tlink[MAXFONTFILENAMELEN];\n char\t\tdest[MAXFONTFILENAMELEN];\n char\t\t*attrib;\n FontPathElementPtr\tsubfpe;\n struct stat\t\tstatbuf;\n const char\t\t*path;\n DIR\t\t\t*dir;\n struct dirent\t*entry;\n int\t\t\tlen;\n int\t\t\tpathlen;\n\n path = fpe->name + strlen(CataloguePrefix);\n if (stat(path, &statbuf) < 0 || !S_ISDIR(statbuf.st_mode))\n\treturn BadFontPath;\n\n if (statbuf.st_mtime <= cat->mtime)\n\treturn Successful;\n\n dir = opendir(path);\n if (dir == NULL)\n {\n\txfree(cat);\n\treturn BadFontPath;\n }\n\n CatalogueUnrefFPEs (fpe);\n while (entry = readdir(dir), entry != NULL)\n {\n \tsnprintf(link, sizeof link, \"%s/%s\", path, entry->d_name);\n\tlen = readlink(link, dest, sizeof dest - 1);\n \tif (len < 0)\n \t continue;\n\tdest[len] = '\\0';\n\n\tif (dest[0] != '/')\n\t{\n\t pathlen = strlen(path);\n\t memmove(dest + pathlen + 1, dest, sizeof dest - pathlen - 1);\n\t memcpy(dest, path, pathlen);\n\t memcpy(dest + pathlen, \"/\", 1);\n\t len += pathlen + 1;\n\t}\n\n\tattrib = strchr(link, ':');\n\tif (attrib && len + strlen(attrib) < sizeof dest)\n\t{\n\t memcpy(dest + len, attrib, strlen(attrib));\n\t len += strlen(attrib);\n\t}\n\n\tsubfpe = xalloc(sizeof *subfpe);\n\tif (subfpe == NULL)\n\t continue;\n\n\t/* The fonts returned by OpenFont will point back to the\n\t * subfpe they come from. So set the type of the subfpe to\n\t * what the catalogue fpe was assigned, so calls to CloseFont\n\t * (which uses font->fpe->type) goes to CatalogueCloseFont. */\n\tsubfpe->type = fpe->type;\n\tsubfpe->name_length = len;\n\tsubfpe->name = xalloc (len + 1);\n\tif (subfpe == NULL)\n\t{\n\t xfree(subfpe);\n\t continue;\n\t}\n\n\tmemcpy(subfpe->name, dest, len);\n\tsubfpe->name[len] = '\\0';\n\n\t/* The X server will manipulate the subfpe ref counts\n\t * associated with the font in OpenFont and CloseFont, so we\n\t * have to make sure it's valid. */\n\tsubfpe->refcount = 1;\n\n\tif (FontFileInitFPE (subfpe) != Successful)\n\t{\n\t xfree(subfpe->name);\n\t xfree(subfpe);\n\t continue;\n\t}\n\n\tif (CatalogueAddFPE(cat, subfpe) != Successful)\n\t{\n\t FontFileFreeFPE (subfpe);\n\t xfree(subfpe);\n\t continue;\n\t}\n }\n\n closedir(dir);\n\n qsort(cat->fpeList,\n\t cat->fpeCount, sizeof cat->fpeList[0], ComparePriority);\n\n cat->mtime = statbuf.st_mtime;\n\n return Successful;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d1112c279bd1a327e8e4d0b5f371458bf2579659", + "input": "void nsc_encode(NSC_CONTEXT* context, const BYTE* bmpdata, UINT32 rowstride)\n {\n\tnsc_encode_argb_to_aycocg(context, bmpdata, rowstride);\n \n \tif (context->ChromaSubsamplingLevel)\n \t{\n\t\tnsc_encode_subsampling(context);\n \t}\n }\n", + "target": "void nsc_encode(NSC_CONTEXT* context, const BYTE* bmpdata, UINT32 rowstride)\nBOOL nsc_encode(NSC_CONTEXT* context, const BYTE* bmpdata, UINT32 rowstride)\n {\n\tif (!context || !bmpdata || (rowstride == 0))\n\t\treturn FALSE;\n\n\tif (!nsc_encode_argb_to_aycocg(context, bmpdata, rowstride))\n\t\treturn FALSE;\n \n \tif (context->ChromaSubsamplingLevel)\n \t{\n\t\tif (!nsc_encode_subsampling(context))\n\t\t\treturn FALSE;\n \t}\n\n\treturn TRUE;\n }\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#69b4b9ef7455753b12c3efe4eec71647e6fb1da1", + "input": " std::unique_ptr GetConfigResponse(\n const net::test_server::HttpRequest& request) {\n auto response = std::make_unique();\n response->set_content(config_.SerializeAsString());\n response->set_content_type(\"text/plain\");\n if (config_run_loop_)\n config_run_loop_->Quit();\n return response;\n }\n", + "target": " std::unique_ptr GetConfigResponse(\n const net::test_server::HttpRequest& request) {\n // Config should not be fetched when in holdback.\n EXPECT_FALSE(\n data_reduction_proxy::params::IsIncludedInHoldbackFieldTrial());\n\n auto response = std::make_unique();\n response->set_content(config_.SerializeAsString());\n response->set_content_type(\"text/plain\");\n if (config_run_loop_)\n config_run_loop_->Quit();\n return response;\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f3d3342602f8bcbf37d7c46641cb9bca7618eb1c", + "input": "int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,\n\t\t struct sockaddr_storage *kern_address, int mode)\n{\n\tint tot_len;\n\n\tif (kern_msg->msg_namelen) {\n\t\tif (mode == VERIFY_READ) {\n\t\t\tint err = move_addr_to_kernel(kern_msg->msg_name,\n\t\t\t\t\t\t kern_msg->msg_namelen,\n\t\t\t\t\t\t kern_address);\n \t\t\tif (err < 0)\n \t\t\t\treturn err;\n \t\t}\n\t\tkern_msg->msg_name = kern_address;\n \t} else\n \t\tkern_msg->msg_name = NULL;\n \n\ttot_len = iov_from_user_compat_to_kern(kern_iov,\n\t\t\t\t\t (struct compat_iovec __user *)kern_msg->msg_iov,\n\t\t\t\t\t kern_msg->msg_iovlen);\n\tif (tot_len >= 0)\n\t\tkern_msg->msg_iov = kern_iov;\n\n\treturn tot_len;\n}\n", + "target": "int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,\n\t\t struct sockaddr_storage *kern_address, int mode)\n{\n\tint tot_len;\n\n\tif (kern_msg->msg_namelen) {\n\t\tif (mode == VERIFY_READ) {\n\t\t\tint err = move_addr_to_kernel(kern_msg->msg_name,\n\t\t\t\t\t\t kern_msg->msg_namelen,\n\t\t\t\t\t\t kern_address);\n \t\t\tif (err < 0)\n \t\t\t\treturn err;\n \t\t}\n\t\tif (kern_msg->msg_name)\n\t\t\tkern_msg->msg_name = kern_address;\n \t} else\n \t\tkern_msg->msg_name = NULL;\n \n\ttot_len = iov_from_user_compat_to_kern(kern_iov,\n\t\t\t\t\t (struct compat_iovec __user *)kern_msg->msg_iov,\n\t\t\t\t\t kern_msg->msg_iovlen);\n\tif (tot_len >= 0)\n\t\tkern_msg->msg_iov = kern_iov;\n\n\treturn tot_len;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0e2f5d518c60e2978f26400d110eff178fa7e3c3", + "input": " pcf_read_TOC( FT_Stream stream,\n PCF_Face face )\n {\n FT_Error error;\n PCF_Toc toc = &face->toc;\n PCF_Table tables;\n\n FT_Memory memory = FT_FACE( face )->memory;\n FT_UInt n;\n\n\n if ( FT_STREAM_SEEK ( 0 ) ||\n FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) )\n return FT_THROW( Cannot_Open_Resource );\n\n if ( toc->version != PCF_FILE_VERSION ||\n toc->count > FT_ARRAY_MAX( face->toc.tables ) ||\n toc->count == 0 )\n return FT_THROW( Invalid_File_Format );\n\n if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) )\n return FT_THROW( Out_Of_Memory );\n\n tables = face->toc.tables;\n for ( n = 0; n < toc->count; n++ )\n {\n if ( FT_STREAM_READ_FIELDS( pcf_table_header, tables ) )\n goto Exit;\n tables++;\n }\n\n /* Sort tables and check for overlaps. Because they are almost */\n /* always ordered already, an in-place bubble sort with simultaneous */\n /* boundary checking seems appropriate. */\n tables = face->toc.tables;\n\n for ( n = 0; n < toc->count - 1; n++ )\n {\n FT_UInt i, have_change;\n\n\n have_change = 0;\n\n for ( i = 0; i < toc->count - 1 - n; i++ )\n {\n PCF_TableRec tmp;\n\n\n if ( tables[i].offset > tables[i + 1].offset )\n {\n tmp = tables[i];\n tables[i] = tables[i + 1];\n tables[i + 1] = tmp;\n\n have_change = 1;\n }\n\n if ( ( tables[i].size > tables[i + 1].offset ) ||\n ( tables[i].offset > tables[i + 1].offset - tables[i].size ) )\n {\n error = FT_THROW( Invalid_Offset );\n goto Exit;\n }\n }\n\n if ( !have_change )\n break;\n }\n \n #ifdef FT_DEBUG_LEVEL_TRACE\n \n {\n\n FT_TRACE4(( \" %d: type=%s, format=0x%X, \"\n \"size=%ld (0x%lX), offset=%ld (0x%lX)\\n\",\n i, name,\n tables[i].format,\n tables[i].size, tables[i].size,\n tables[i].offset, tables[i].offset ));\n }\n }\n", + "target": " pcf_read_TOC( FT_Stream stream,\n PCF_Face face )\n {\n FT_Error error;\n PCF_Toc toc = &face->toc;\n PCF_Table tables;\n\n FT_Memory memory = FT_FACE( face )->memory;\n FT_UInt n;\n\n\n if ( FT_STREAM_SEEK ( 0 ) ||\n FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) )\n return FT_THROW( Cannot_Open_Resource );\n\n if ( toc->version != PCF_FILE_VERSION ||\n toc->count > FT_ARRAY_MAX( face->toc.tables ) ||\n toc->count == 0 )\n return FT_THROW( Invalid_File_Format );\n\n if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) )\n return FT_THROW( Out_Of_Memory );\n\n tables = face->toc.tables;\n for ( n = 0; n < toc->count; n++ )\n {\n if ( FT_STREAM_READ_FIELDS( pcf_table_header, tables ) )\n goto Exit;\n tables++;\n }\n\n /* Sort tables and check for overlaps. Because they are almost */\n /* always ordered already, an in-place bubble sort with simultaneous */\n /* boundary checking seems appropriate. */\n tables = face->toc.tables;\n\n for ( n = 0; n < toc->count - 1; n++ )\n {\n FT_UInt i, have_change;\n\n\n have_change = 0;\n\n for ( i = 0; i < toc->count - 1 - n; i++ )\n {\n PCF_TableRec tmp;\n\n\n if ( tables[i].offset > tables[i + 1].offset )\n {\n tmp = tables[i];\n tables[i] = tables[i + 1];\n tables[i + 1] = tmp;\n\n have_change = 1;\n }\n\n if ( ( tables[i].size > tables[i + 1].offset ) ||\n ( tables[i].offset > tables[i + 1].offset - tables[i].size ) )\n {\n error = FT_THROW( Invalid_Offset );\n goto Exit;\n }\n }\n\n if ( !have_change )\n break;\n }\n \n /* we now check whether the `size' and `offset' values are reasonable: */\n /* `offset' + `size' must not exceed the stream size */\n tables = face->toc.tables;\n for ( n = 0; n < toc->count; n++ )\n {\n /* we need two checks to avoid overflow */\n if ( ( tables->size > stream->size ) ||\n ( tables->offset > stream->size - tables->size ) )\n {\n error = FT_THROW( Invalid_Table );\n goto Exit;\n }\n tables++;\n }\n\n #ifdef FT_DEBUG_LEVEL_TRACE\n \n {\n\n FT_TRACE4(( \" %d: type=%s, format=0x%X, \"\n \"size=%ld (0x%lX), offset=%ld (0x%lX)\\n\",\n i, name,\n tables[i].format,\n tables[i].size, tables[i].size,\n tables[i].offset, tables[i].offset ));\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d345af9ed62ee5f431be327967f41c3cc3fe936a", + "input": "static JSValueRef addTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)\n{\n if (argumentCount < 2)\n return JSValueMakeUndefined(context);\n\n int x = static_cast(JSValueToNumber(context, arguments[0], exception));\n ASSERT(!exception || !*exception);\n int y = static_cast(JSValueToNumber(context, arguments[1], exception));\n ASSERT(!exception || !*exception);\n \n BlackBerry::Platform::TouchPoint touch;\n touch.m_id = touches.isEmpty() ? 0 : touches.last().m_id + 1;\n IntPoint pos(x, y);\n touch.m_pos = pos;\n touch.m_screenPos = pos;\n touch.m_state = BlackBerry::Platform::TouchPoint::TouchPressed;\n \n touches.append(touch);\n \n return JSValueMakeUndefined(context);\n}\n", + "target": "static JSValueRef addTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)\n{\n if (argumentCount < 2)\n return JSValueMakeUndefined(context);\n\n int x = static_cast(JSValueToNumber(context, arguments[0], exception));\n ASSERT(!exception || !*exception);\n int y = static_cast(JSValueToNumber(context, arguments[1], exception));\n ASSERT(!exception || !*exception);\n \n int id = touches.isEmpty() ? 0 : touches.last().id() + 1;\n\n // pixelViewportPosition is unused in the WebKit layer, so use this for screen position\n IntPoint pos(x, y);\n\n BlackBerry::Platform::TouchPoint touch(id, BlackBerry::Platform::TouchPoint::TouchPressed, pos, pos, 0);\n\n // Unfortunately we don't know the scroll position at this point, so use pos for the content position too.\n // This assumes scroll position is 0,0\n touch.populateDocumentPosition(pos, pos);\n \n touches.append(touch);\n \n return JSValueMakeUndefined(context);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#80742f2ffeb9e90cd85cbee27acb9f924ffebd16", + "input": "bool AutofillDownloadManager::StartUploadRequest(\n const FormStructure& form,\n bool form_was_autofilled,\n const FieldTypeSet& available_field_types) {\n if (next_upload_request_ > base::Time::Now()) {\n VLOG(1) << \"AutofillDownloadManager: Upload request is throttled.\";\n return false;\n }\n\n double upload_rate = form_was_autofilled ? GetPositiveUploadRate() :\n GetNegativeUploadRate();\n if (base::RandDouble() > upload_rate) {\n VLOG(1) << \"AutofillDownloadManager: Upload request is ignored.\";\n return false;\n }\n\n std::string form_xml;\n if (!form.EncodeUploadRequest(available_field_types, form_was_autofilled,\n &form_xml))\n return false;\n\n FormRequestData request_data;\n request_data.form_signatures.push_back(form.FormSignature());\n request_data.request_type = AutofillDownloadManager::REQUEST_UPLOAD;\n\n return StartRequest(form_xml, request_data);\n}\n", + "target": "bool AutofillDownloadManager::StartUploadRequest(\n const FormStructure& form,\n bool form_was_autofilled,\n const FieldTypeSet& available_field_types) {\n if (next_upload_request_ > base::Time::Now()) {\n VLOG(1) << \"AutofillDownloadManager: Upload request is throttled.\";\n return false;\n }\n\n double upload_rate = form_was_autofilled ? GetPositiveUploadRate() :\n GetNegativeUploadRate();\n if (form.upload_required() == UPLOAD_NOT_REQUIRED ||\n (form.upload_required() == USE_UPLOAD_RATES &&\n base::RandDouble() > upload_rate)) {\n VLOG(1) << \"AutofillDownloadManager: Upload request is ignored.\";\n return false;\n }\n\n std::string form_xml;\n if (!form.EncodeUploadRequest(available_field_types, form_was_autofilled,\n &form_xml))\n return false;\n\n FormRequestData request_data;\n request_data.form_signatures.push_back(form.FormSignature());\n request_data.request_type = AutofillDownloadManager::REQUEST_UPLOAD;\n\n return StartRequest(form_xml, request_data);\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#79708b391b2e91d63b5d009ec6202c7d7ededf93", + "input": " bool TryAddAxesButton(\n vr::EVRButtonId button_id,\n AxesRequirement requirement = AxesRequirement::kOptional) {\n if (!IsInAxesData(button_id))\n return false;\n \n bool require_axes = (requirement == AxesRequirement::kRequired);\n if (require_axes && !axes_data_[button_id].has_both_axes)\n return false;\n \n AddButton(axes_data_[button_id]);\n used_axes_.insert(button_id);\n\n return true;\n }\n", + "target": " bool TryAddAxesButton(\n bool TryAddAxesOrTriggerButton(\n vr::EVRButtonId button_id,\n AxesRequirement requirement = AxesRequirement::kOptional) {\n if (!IsInAxesData(button_id))\n return false;\n \n bool require_axes = (requirement == AxesRequirement::kRequireBoth);\n if (require_axes && !axes_data_[button_id].has_both_axes)\n return false;\n \n AddButton(axes_data_[button_id]);\n used_axes_.insert(button_id);\n\n return true;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5c895ed26b096468eea6baa6584f2df65905b76b", + "input": " bool PasswordAutofillAgent::TryToShowTouchToFill(\n const WebFormControlElement& control_element) {\n const WebInputElement* element = ToWebInputElement(&control_element);\n if (!element || (!base::Contains(web_input_to_password_info_, *element) &&\n !base::Contains(password_to_username_, *element))) {\n return false;\n }\n if (was_touch_to_fill_ui_shown_)\n return false;\n was_touch_to_fill_ui_shown_ = true;\n\n GetPasswordManagerDriver()->ShowTouchToFill();\n return true;\n}\n", + "target": " bool PasswordAutofillAgent::TryToShowTouchToFill(\n const WebFormControlElement& control_element) {\n const WebInputElement* element = ToWebInputElement(&control_element);\n WebInputElement username_element;\n WebInputElement password_element;\n PasswordInfo* password_info = nullptr;\n if (!element ||\n !FindPasswordInfoForElement(*element, &username_element,\n &password_element, &password_info)) {\n return false;\n }\n if (was_touch_to_fill_ui_shown_)\n return false;\n was_touch_to_fill_ui_shown_ = true;\n\n GetPasswordManagerDriver()->ShowTouchToFill();\n return true;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9c391ac04f9ac478c8b0e43b359c2b43a6c892ab", + "input": " PrintPreviewMessageHandler::PrintPreviewMessageHandler(\n WebContents* web_contents)\n : content::WebContentsObserver(web_contents) {\n DCHECK(web_contents);\n }\n", + "target": " PrintPreviewMessageHandler::PrintPreviewMessageHandler(\n WebContents* web_contents)\n : content::WebContentsObserver(web_contents), weak_ptr_factory_(this) {\n DCHECK(web_contents);\n }\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#08f0d612f2a4039aaf6733d4e8d0a67614941378", + "input": "void Browser::CloseContents(TabContents* source) {\n if (is_attempting_to_close_browser_) {\n ClearUnloadState(source);\n return;\n }\n \n int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source);\n if (index == TabStripModel::kNoTab) {\n NOTREACHED() << \"CloseContents called for tab not in our strip\";\n return;\n }\n tab_handler_->GetTabStripModel()->CloseTabContentsAt(\n index,\n TabStripModel::CLOSE_CREATE_HISTORICAL_TAB);\n}\n", + "target": "void Browser::CloseContents(TabContents* source) {\n if (is_attempting_to_close_browser_) {\n ClearUnloadState(source, true);\n return;\n }\n \n int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source);\n if (index == TabStripModel::kNoTab) {\n NOTREACHED() << \"CloseContents called for tab not in our strip\";\n return;\n }\n tab_handler_->GetTabStripModel()->CloseTabContentsAt(\n index,\n TabStripModel::CLOSE_CREATE_HISTORICAL_TAB);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#45737cb776625f17384540523674761e6313e6d4", + "input": "SampleTable::~SampleTable() {\n delete[] mSampleToChunkEntries;\n mSampleToChunkEntries = NULL;\n\n delete[] mSyncSamples;\n mSyncSamples = NULL;\n\n delete mCompositionDeltaLookup;\n mCompositionDeltaLookup = NULL;\n\n delete[] mCompositionTimeDeltaEntries;\n mCompositionTimeDeltaEntries = NULL;\n\n\n delete[] mSampleTimeEntries;\n mSampleTimeEntries = NULL;\n \n delete[] mTimeToSample;\n mTimeToSample = NULL;\n delete mSampleIterator;\n mSampleIterator = NULL;\n }\n", + "target": "SampleTable::~SampleTable() {\n delete[] mSampleToChunkEntries;\n mSampleToChunkEntries = NULL;\n\n delete[] mSyncSamples;\n mSyncSamples = NULL;\n\n delete mCompositionDeltaLookup;\n mCompositionDeltaLookup = NULL;\n\n delete[] mCompositionTimeDeltaEntries;\n mCompositionTimeDeltaEntries = NULL;\n\n\n delete[] mSampleTimeEntries;\n mSampleTimeEntries = NULL;\n \n delete mSampleIterator;\n mSampleIterator = NULL;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5e5571d1a431eb3c61977b6dd6ec90186ef79867", + "input": "email_close(FILE *mailer)\n{\n\tchar *temp;\n\tmode_t prev_umask;\n\tpriv_state priv;\n\tchar *customSig;\n\n\tif ( mailer == NULL ) {\n\t\treturn;\n\t}\n\n\t/* Want the letter to come from \"condor\" if possible */\n\tpriv = set_condor_priv();\n\n customSig = NULL;\n if ((customSig = param(\"EMAIL_SIGNATURE\")) != NULL) {\n fprintf( mailer, \"\\n\\n\");\n fprintf( mailer, customSig);\n fprintf( mailer, \"\\n\");\n free(customSig);\n } else {\n\t\t\n\t\t/* Put a signature on the bottom of the email */\n\t\tfprintf( mailer, \"\\n\\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\\n\" );\n\t\tfprintf( mailer, \"Questions about this message or Condor in general?\\n\" );\n\n\t\t\t/* See if there's an address users should use for help */\n\t\ttemp = param( \"CONDOR_SUPPORT_EMAIL\" );\n\t\tif( ! temp ) {\n\t\t\ttemp = param( \"CONDOR_ADMIN\" );\n\t\t}\n\t\tif( temp ) {\n\t\t\tfprintf( mailer, \"Email address of the local Condor administrator: \"\n\t\t\t\t\t \"%s\\n\", temp );\n\t\t\tfree( temp );\n\t\t}\n\t\tfprintf( mailer, \"The Official Condor Homepage is \"\n\t\t\t\t \"http://www.cs.wisc.edu/condor\\n\" );\n\t}\n\n\tfflush(mailer);\n\t/* there are some oddities with how pclose can close a file. In some\n\t\tarches, pclose will create temp files for locking and they need to\n\t\tbe of the correct perms in order to be deleted. So the umask is\n\t\tset to something useable for the close operation. -pete 9/11/99\n\t*/\n\tprev_umask = umask(022);\n\t/* \n\t** we fclose() on UNIX, pclose on win32 \n\t*/\n#if defined(WIN32)\n\tif (EMAIL_FINAL_COMMAND == NULL) {\n\t\tmy_pclose( mailer );\n\t} else {\n\t\tchar *email_filename = NULL;\n\t\t/* Should this be a pclose??? -Erik 9/21/00 */ \n\t\tfclose( mailer );\n\t\tdprintf(D_FULLDEBUG,\"Sending email via system(%s)\\n\",\n\t\t\tEMAIL_FINAL_COMMAND);\n\t\tsystem(EMAIL_FINAL_COMMAND);\n\t\tif ( (email_filename=strrchr(EMAIL_FINAL_COMMAND,'<')) ) {\n\t\t\temail_filename++;\t/* go past the \"<\" */\n\t\t\temail_filename++;\t/* go past the space after the < */\n\t\t\tif ( unlink(email_filename) == -1 ) {\n\t\t\t\tdprintf(D_ALWAYS,\"email_close: cannot unlink temp file %s\\n\",\n\t\t\t\t\temail_filename);\n\t\t\t}\n\t\t}\n\t\tfree(EMAIL_FINAL_COMMAND);\n\t\tEMAIL_FINAL_COMMAND = NULL;\n\t}\n#else\n\t(void)fclose( mailer );\n#endif\n\tumask(prev_umask);\n\n\t/* Set priv state back */\n\tset_priv(priv);\n\n}\n", + "target": "email_close(FILE *mailer)\n{\n\tchar *temp;\n\tmode_t prev_umask;\n\tpriv_state priv;\n\tchar *customSig;\n\n\tif ( mailer == NULL ) {\n\t\treturn;\n\t}\n\n\t/* Want the letter to come from \"condor\" if possible */\n\tpriv = set_condor_priv();\n\n customSig = NULL;\n if ((customSig = param(\"EMAIL_SIGNATURE\")) != NULL) {\n fprintf( mailer, \"\\n\\n\");\n fprintf( mailer, \"%s\", customSig);\n fprintf( mailer, \"\\n\");\n free(customSig);\n } else {\n\t\t\n\t\t/* Put a signature on the bottom of the email */\n\t\tfprintf( mailer, \"\\n\\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\\n\" );\n\t\tfprintf( mailer, \"Questions about this message or Condor in general?\\n\" );\n\n\t\t\t/* See if there's an address users should use for help */\n\t\ttemp = param( \"CONDOR_SUPPORT_EMAIL\" );\n\t\tif( ! temp ) {\n\t\t\ttemp = param( \"CONDOR_ADMIN\" );\n\t\t}\n\t\tif( temp ) {\n\t\t\tfprintf( mailer, \"Email address of the local Condor administrator: \"\n\t\t\t\t\t \"%s\\n\", temp );\n\t\t\tfree( temp );\n\t\t}\n\t\tfprintf( mailer, \"The Official Condor Homepage is \"\n\t\t\t\t \"http://www.cs.wisc.edu/condor\\n\" );\n\t}\n\n\tfflush(mailer);\n\t/* there are some oddities with how pclose can close a file. In some\n\t\tarches, pclose will create temp files for locking and they need to\n\t\tbe of the correct perms in order to be deleted. So the umask is\n\t\tset to something useable for the close operation. -pete 9/11/99\n\t*/\n\tprev_umask = umask(022);\n\t/* \n\t** we fclose() on UNIX, pclose on win32 \n\t*/\n#if defined(WIN32)\n\tif (EMAIL_FINAL_COMMAND == NULL) {\n\t\tmy_pclose( mailer );\n\t} else {\n\t\tchar *email_filename = NULL;\n\t\t/* Should this be a pclose??? -Erik 9/21/00 */ \n\t\tfclose( mailer );\n\t\tdprintf(D_FULLDEBUG,\"Sending email via system(%s)\\n\",\n\t\t\tEMAIL_FINAL_COMMAND);\n\t\tsystem(EMAIL_FINAL_COMMAND);\n\t\tif ( (email_filename=strrchr(EMAIL_FINAL_COMMAND,'<')) ) {\n\t\t\temail_filename++;\t/* go past the \"<\" */\n\t\t\temail_filename++;\t/* go past the space after the < */\n\t\t\tif ( unlink(email_filename) == -1 ) {\n\t\t\t\tdprintf(D_ALWAYS,\"email_close: cannot unlink temp file %s\\n\",\n\t\t\t\t\temail_filename);\n\t\t\t}\n\t\t}\n\t\tfree(EMAIL_FINAL_COMMAND);\n\t\tEMAIL_FINAL_COMMAND = NULL;\n\t}\n#else\n\t(void)fclose( mailer );\n#endif\n\tumask(prev_umask);\n\n\t/* Set priv state back */\n\tset_priv(priv);\n\n}\n", + "vul_type": "cwe-134", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b6f13a5ef9d6280cf984826a5de012a32c396cd4?w=1", + "input": "PHP_FUNCTION(imageaffinematrixget)\n{\n\tdouble affine[6];\n\tlong type;\n\tzval *options = NULL;\n\tzval **tmp;\n\tint res = GD_FALSE, i;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"l|z\", &type, &options) == FAILURE) {\n\t\treturn;\n\t}\n\n\tswitch((gdAffineStandardMatrix)type) {\n\t\tcase GD_AFFINE_TRANSLATE:\n\t\tcase GD_AFFINE_SCALE: {\n\t\t\tdouble x, y;\n\t\t\tif (!options || Z_TYPE_P(options) != IS_ARRAY) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Array expected as options\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tif (zend_hash_find(HASH_OF(options), \"x\", sizeof(\"x\"), (void **)&tmp) != FAILURE) {\n\t\t\t\tif (Z_TYPE_PP(tmp) != IS_DOUBLE) {\n\t\t\t\t\tzval dval;\n\t\t\t\t\tdval = **tmp;\n\t\t\t\t\tzval_copy_ctor(&dval);\n\t\t\t\t\tconvert_to_double(&dval);\n\t\t\t\t\tx = Z_DVAL(dval);\n\t\t\t\t} else {\n\t\t\t\t\tx = Z_DVAL_PP(tmp);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Missing x position\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\n\t\t\tif (zend_hash_find(HASH_OF(options), \"y\", sizeof(\"y\"), (void **)&tmp) != FAILURE) {\n\t\t\t\tif (Z_TYPE_PP(tmp) != IS_DOUBLE) {\n\t\t\t\t\tzval dval;\n\t\t\t\t\tdval = **tmp;\n\t\t\t\t\tzval_copy_ctor(&dval);\n\t\t\t\t\tconvert_to_double(&dval);\n\t\t\t\t\ty = Z_DVAL(dval);\n\t\t\t\t} else {\n\t\t\t\t\ty = Z_DVAL_PP(tmp);\n\t\t\t\t}\n\t\t\t} else {\n \t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Missing y position\");\n \t\t\t\tRETURN_FALSE;\n \t\t\t}\n \t\t\tif (type == GD_AFFINE_TRANSLATE) {\n \t\t\t\tres = gdAffineTranslate(affine, x, y);\n \t\t\t} else {\n\t\t\t\tres = gdAffineScale(affine, x, y);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tcase GD_AFFINE_ROTATE:\n\t\tcase GD_AFFINE_SHEAR_HORIZONTAL:\n\t\tcase GD_AFFINE_SHEAR_VERTICAL: {\n\t\t\tdouble angle;\n\n\t\t\tif (!options) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Number is expected as option\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tif(Z_TYPE_P(options) != IS_DOUBLE) {\n\t\t\t\tzval dval;\n\t\t\t\tdval = *options;\n\t\t\t\tzval_copy_ctor(&dval);\n\t\t\t\tconvert_to_double(&dval);\n\t\t\t\tangle = Z_DVAL(dval);\n\t\t\t} else {\n\t\t\t\tangle = Z_DVAL_P(options);\n\t\t\t}\n\n\t\t\tif (type == GD_AFFINE_SHEAR_HORIZONTAL) {\n\t\t\t\tres = gdAffineShearHorizontal(affine, angle);\n\t\t\t} else if (type == GD_AFFINE_SHEAR_VERTICAL) {\n\t\t\t\tres = gdAffineShearVertical(affine, angle);\n\t\t\t} else {\n\t\t\t\tres = gdAffineRotate(affine, angle);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault:\n\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Invalid type for element %li\", type);\n\t\t\tRETURN_FALSE;\n\t}\n\n\tif (res == GD_FALSE) {\n\t\tRETURN_FALSE;\n\t} else {\n\t\tarray_init(return_value);\n\t\tfor (i = 0; i < 6; i++) {\n\t\t\tadd_index_double(return_value, i, affine[i]);\n\t\t}\n\t}\n}\n", + "target": "PHP_FUNCTION(imageaffinematrixget)\n{\n\tdouble affine[6];\n\tlong type;\n\tzval *options = NULL;\n\tzval **tmp;\n\tint res = GD_FALSE, i;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"l|z\", &type, &options) == FAILURE) {\n\t\treturn;\n\t}\n\n\tswitch((gdAffineStandardMatrix)type) {\n\t\tcase GD_AFFINE_TRANSLATE:\n\t\tcase GD_AFFINE_SCALE: {\n\t\t\tdouble x, y;\n\t\t\tif (!options || Z_TYPE_P(options) != IS_ARRAY) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Array expected as options\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tif (zend_hash_find(HASH_OF(options), \"x\", sizeof(\"x\"), (void **)&tmp) != FAILURE) {\n\t\t\t\tif (Z_TYPE_PP(tmp) != IS_DOUBLE) {\n\t\t\t\t\tzval dval;\n\t\t\t\t\tdval = **tmp;\n\t\t\t\t\tzval_copy_ctor(&dval);\n\t\t\t\t\tconvert_to_double(&dval);\n\t\t\t\t\tx = Z_DVAL(dval);\n\t\t\t\t} else {\n\t\t\t\t\tx = Z_DVAL_PP(tmp);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Missing x position\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\n\t\t\tif (zend_hash_find(HASH_OF(options), \"y\", sizeof(\"y\"), (void **)&tmp) != FAILURE) {\n\t\t\t\tif (Z_TYPE_PP(tmp) != IS_DOUBLE) {\n\t\t\t\t\tzval dval;\n\t\t\t\t\tdval = **tmp;\n\t\t\t\t\tzval_copy_ctor(&dval);\n\t\t\t\t\tconvert_to_double(&dval);\n\t\t\t\t\ty = Z_DVAL(dval);\n\t\t\t\t} else {\n\t\t\t\t\ty = Z_DVAL_PP(tmp);\n\t\t\t\t}\n\t\t\t} else {\n \t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Missing y position\");\n \t\t\t\tRETURN_FALSE;\n \t\t\t}\n\n \t\t\tif (type == GD_AFFINE_TRANSLATE) {\n \t\t\t\tres = gdAffineTranslate(affine, x, y);\n \t\t\t} else {\n\t\t\t\tres = gdAffineScale(affine, x, y);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tcase GD_AFFINE_ROTATE:\n\t\tcase GD_AFFINE_SHEAR_HORIZONTAL:\n\t\tcase GD_AFFINE_SHEAR_VERTICAL: {\n\t\t\tdouble angle;\n\n\t\t\tif (!options) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Number is expected as option\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tif(Z_TYPE_P(options) != IS_DOUBLE) {\n\t\t\t\tzval dval;\n\t\t\t\tdval = *options;\n\t\t\t\tzval_copy_ctor(&dval);\n\t\t\t\tconvert_to_double(&dval);\n\t\t\t\tangle = Z_DVAL(dval);\n\t\t\t} else {\n\t\t\t\tangle = Z_DVAL_P(options);\n\t\t\t}\n\n\t\t\tif (type == GD_AFFINE_SHEAR_HORIZONTAL) {\n\t\t\t\tres = gdAffineShearHorizontal(affine, angle);\n\t\t\t} else if (type == GD_AFFINE_SHEAR_VERTICAL) {\n\t\t\t\tres = gdAffineShearVertical(affine, angle);\n\t\t\t} else {\n\t\t\t\tres = gdAffineRotate(affine, angle);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault:\n\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Invalid type for element %li\", type);\n\t\t\tRETURN_FALSE;\n\t}\n\n\tif (res == GD_FALSE) {\n\t\tRETURN_FALSE;\n\t} else {\n\t\tarray_init(return_value);\n\t\tfor (i = 0; i < 6; i++) {\n\t\t\tadd_index_double(return_value, i, affine[i]);\n\t\t}\n\t}\n}\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5bb223676defeba9c44a5ce42460c86e24561e73", + "input": "ExtensionsGuestViewMessageFilter::MaybeCreateThrottle(\n NavigationHandle* handle) {\n DCHECK(content::MimeHandlerViewMode::UsesCrossProcessFrame());\n if (!handle->GetParentFrame()) {\n return nullptr;\n }\n int32_t parent_process_id = handle->GetParentFrame()->GetProcess()->GetID();\n auto& map = *GetProcessIdToFilterMap();\n if (!base::ContainsKey(map, parent_process_id) || !map[parent_process_id]) {\n return nullptr;\n }\n for (auto& pair : map[parent_process_id]->frame_navigation_helpers_) {\n if (!pair.second->ShouldCancelAndIgnore(handle))\n continue;\n return std::make_unique(\n handle);\n }\n return nullptr;\n}\n", + "target": "ExtensionsGuestViewMessageFilter::MaybeCreateThrottle(\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#59296d9276ffcc8bced092828210748d2ed19ab0", + "input": "int32_t PepperFlashRendererHost::OnNavigate(\n ppapi::host::HostMessageContext* host_context,\n const ppapi::URLRequestInfoData& data,\n const std::string& target,\n bool from_user_action) {\n content::PepperPluginInstance* plugin_instance =\n host_->GetPluginInstance(pp_instance());\n if (!plugin_instance)\n return PP_ERROR_FAILED;\n \n ppapi::proxy::HostDispatcher* host_dispatcher =\n ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());\n host_dispatcher->set_allow_plugin_reentrancy();\n\n base::WeakPtr weak_ptr = weak_factory_.GetWeakPtr();\n navigate_replies_.push_back(host_context->MakeReplyMessageContext());\n plugin_instance->Navigate(data, target.c_str(), from_user_action);\n if (weak_ptr.get()) {\n SendReply(navigate_replies_.back(), IPC::Message());\n navigate_replies_.pop_back();\n }\n\n return PP_OK_COMPLETIONPENDING;\n}\n", + "target": "int32_t PepperFlashRendererHost::OnNavigate(\n ppapi::host::HostMessageContext* host_context,\n const ppapi::URLRequestInfoData& data,\n const std::string& target,\n bool from_user_action) {\n content::PepperPluginInstance* plugin_instance =\n host_->GetPluginInstance(pp_instance());\n if (!plugin_instance)\n return PP_ERROR_FAILED;\n \n std::map& rejected_headers =\n g_rejected_headers.Get();\n if (rejected_headers.empty()) {\n for (size_t i = 0; i < arraysize(kRejectedHttpRequestHeaders); ++i)\n rejected_headers[kRejectedHttpRequestHeaders[i]] =\n static_cast(i);\n }\n\n net::HttpUtil::HeadersIterator header_iter(data.headers.begin(),\n data.headers.end(),\n \"\\n\\r\");\n bool rejected = false;\n while (header_iter.GetNext()) {\n std::string lower_case_header_name = StringToLowerASCII(header_iter.name());\n if (!IsSimpleHeader(lower_case_header_name, header_iter.values())) {\n rejected = true;\n\n std::map::const_iterator iter =\n rejected_headers.find(lower_case_header_name);\n FlashNavigateUsage usage = iter != rejected_headers.end() ?\n iter->second : REJECT_OTHER_HEADERS;\n RecordFlashNavigateUsage(usage);\n }\n }\n\n RecordFlashNavigateUsage(TOTAL_NAVIGATE_REQUESTS);\n if (rejected) {\n RecordFlashNavigateUsage(TOTAL_REJECTED_NAVIGATE_REQUESTS);\n return PP_ERROR_NOACCESS;\n }\n\n ppapi::proxy::HostDispatcher* host_dispatcher =\n ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());\n host_dispatcher->set_allow_plugin_reentrancy();\n\n base::WeakPtr weak_ptr = weak_factory_.GetWeakPtr();\n navigate_replies_.push_back(host_context->MakeReplyMessageContext());\n plugin_instance->Navigate(data, target.c_str(), from_user_action);\n if (weak_ptr.get()) {\n SendReply(navigate_replies_.back(), IPC::Message());\n navigate_replies_.pop_back();\n }\n\n return PP_OK_COMPLETIONPENDING;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#93060258ae748573ca7197204125a2670047896d", + "input": "static bool vmxnet_tx_pkt_parse_headers(struct VmxnetTxPkt *pkt)\n{\n struct iovec *l2_hdr, *l3_hdr;\n size_t bytes_read;\n size_t full_ip6hdr_len;\n uint16_t l3_proto;\n\n assert(pkt);\n\n l2_hdr = &pkt->vec[VMXNET_TX_PKT_L2HDR_FRAG];\n l3_hdr = &pkt->vec[VMXNET_TX_PKT_L3HDR_FRAG];\n\n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags, 0, l2_hdr->iov_base,\n ETH_MAX_L2_HDR_LEN);\n if (bytes_read < sizeof(struct eth_header)) {\n l2_hdr->iov_len = 0;\n return false;\n }\n\n l2_hdr->iov_len = sizeof(struct eth_header);\n switch (be16_to_cpu(PKT_GET_ETH_HDR(l2_hdr->iov_base)->h_proto)) {\n case ETH_P_VLAN:\n l2_hdr->iov_len += sizeof(struct vlan_header);\n break;\n case ETH_P_DVLAN:\n l2_hdr->iov_len += 2 * sizeof(struct vlan_header);\n break;\n }\n\n if (bytes_read < l2_hdr->iov_len) {\n l2_hdr->iov_len = 0;\n return false;\n }\n\n l3_proto = eth_get_l3_proto(l2_hdr->iov_base, l2_hdr->iov_len);\n\n switch (l3_proto) {\n case ETH_P_IP:\n l3_hdr->iov_base = g_malloc(ETH_MAX_IP4_HDR_LEN);\n\n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags, l2_hdr->iov_len,\n l3_hdr->iov_base, sizeof(struct ip_header));\n\n if (bytes_read < sizeof(struct ip_header)) {\n l3_hdr->iov_len = 0;\n return false;\n }\n \n l3_hdr->iov_len = IP_HDR_GET_LEN(l3_hdr->iov_base);\n pkt->l4proto = ((struct ip_header *) l3_hdr->iov_base)->ip_p;\n \n /* copy optional IPv4 header data */\n l3_hdr->iov_len = 0;\n return false;\n }\n break;\n\n case ETH_P_IPV6:\n if (!eth_parse_ipv6_hdr(pkt->raw, pkt->raw_frags, l2_hdr->iov_len,\n &pkt->l4proto, &full_ip6hdr_len)) {\n l3_hdr->iov_len = 0;\n return false;\n }\n\n l3_hdr->iov_base = g_malloc(full_ip6hdr_len);\n\n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags, l2_hdr->iov_len,\n l3_hdr->iov_base, full_ip6hdr_len);\n\n if (bytes_read < full_ip6hdr_len) {\n l3_hdr->iov_len = 0;\n return false;\n } else {\n l3_hdr->iov_len = full_ip6hdr_len;\n }\n break;\n\n default:\n l3_hdr->iov_len = 0;\n break;\n }\n", + "target": "static bool vmxnet_tx_pkt_parse_headers(struct VmxnetTxPkt *pkt)\n{\n struct iovec *l2_hdr, *l3_hdr;\n size_t bytes_read;\n size_t full_ip6hdr_len;\n uint16_t l3_proto;\n\n assert(pkt);\n\n l2_hdr = &pkt->vec[VMXNET_TX_PKT_L2HDR_FRAG];\n l3_hdr = &pkt->vec[VMXNET_TX_PKT_L3HDR_FRAG];\n\n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags, 0, l2_hdr->iov_base,\n ETH_MAX_L2_HDR_LEN);\n if (bytes_read < sizeof(struct eth_header)) {\n l2_hdr->iov_len = 0;\n return false;\n }\n\n l2_hdr->iov_len = sizeof(struct eth_header);\n switch (be16_to_cpu(PKT_GET_ETH_HDR(l2_hdr->iov_base)->h_proto)) {\n case ETH_P_VLAN:\n l2_hdr->iov_len += sizeof(struct vlan_header);\n break;\n case ETH_P_DVLAN:\n l2_hdr->iov_len += 2 * sizeof(struct vlan_header);\n break;\n }\n\n if (bytes_read < l2_hdr->iov_len) {\n l2_hdr->iov_len = 0;\n return false;\n }\n\n l3_proto = eth_get_l3_proto(l2_hdr->iov_base, l2_hdr->iov_len);\n\n switch (l3_proto) {\n case ETH_P_IP:\n l3_hdr->iov_base = g_malloc(ETH_MAX_IP4_HDR_LEN);\n\n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags, l2_hdr->iov_len,\n l3_hdr->iov_base, sizeof(struct ip_header));\n\n if (bytes_read < sizeof(struct ip_header)) {\n l3_hdr->iov_len = 0;\n return false;\n }\n \n l3_hdr->iov_len = IP_HDR_GET_LEN(l3_hdr->iov_base);\n if(l3_hdr->iov_len < sizeof(struct ip_header))\n {\n l3_hdr->iov_len = 0;\n return false;\n }\n pkt->l4proto = ((struct ip_header *) l3_hdr->iov_base)->ip_p;\n \n /* copy optional IPv4 header data */\n l3_hdr->iov_len = 0;\n return false;\n }\n break;\n\n case ETH_P_IPV6:\n if (!eth_parse_ipv6_hdr(pkt->raw, pkt->raw_frags, l2_hdr->iov_len,\n &pkt->l4proto, &full_ip6hdr_len)) {\n l3_hdr->iov_len = 0;\n return false;\n }\n\n l3_hdr->iov_base = g_malloc(full_ip6hdr_len);\n\n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags, l2_hdr->iov_len,\n l3_hdr->iov_base, full_ip6hdr_len);\n\n if (bytes_read < full_ip6hdr_len) {\n l3_hdr->iov_len = 0;\n return false;\n } else {\n l3_hdr->iov_len = full_ip6hdr_len;\n }\n break;\n\n default:\n l3_hdr->iov_len = 0;\n break;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ea3d1d84be3d6f97bf50e76511c9e26af6895533", + "input": " bool WebPluginImpl::InitiateHTTPRequest(unsigned long resource_id,\n WebPluginResourceClient* client,\n const char* method, const char* buf,\n int buf_len,\n const GURL& url,\n const char* range_info,\n Referrer referrer_flag) {\n if (!client) {\n NOTREACHED();\n return false;\n }\n\n ClientInfo info;\n info.id = resource_id;\n info.client = client;\n info.request.initialize();\n info.request.setURL(url);\n info.request.setRequestorProcessID(delegate_->GetProcessId());\n info.request.setTargetType(WebURLRequest::TargetIsObject);\n info.request.setHTTPMethod(WebString::fromUTF8(method));\n info.pending_failure_notification = false;\n\n if (range_info) {\n info.request.addHTTPHeaderField(WebString::fromUTF8(\"Range\"),\n WebString::fromUTF8(range_info));\n }\n\n if (strcmp(method, \"POST\") == 0) {\n SetPostData(&info.request, buf, buf_len);\n }\n\n SetReferrer(&info.request, referrer_flag);\n\n webframe_->dispatchWillSendRequest(info.request);\n if (WebDevToolsAgent* devtools_agent = GetDevToolsAgent()) {\n devtools_agent->identifierForInitialRequest(resource_id, webframe_,\n info.request);\n devtools_agent->willSendRequest(resource_id, info.request);\n }\n\n info.loader.reset(WebKit::webKitClient()->createURLLoader());\n if (!info.loader.get())\n return false;\n info.loader->loadAsynchronously(info.request, this);\n\n clients_.push_back(info);\n return true;\n}\n", + "target": " bool WebPluginImpl::InitiateHTTPRequest(unsigned long resource_id,\n WebPluginResourceClient* client,\n const GURL& url,\n const char* method,\n const char* buf,\n int buf_len,\n const char* range_info,\n Referrer referrer_flag) {\n if (!client) {\n NOTREACHED();\n return false;\n }\n\n ClientInfo info;\n info.id = resource_id;\n info.client = client;\n info.request.initialize();\n info.request.setURL(url);\n info.request.setRequestorProcessID(delegate_->GetProcessId());\n info.request.setTargetType(WebURLRequest::TargetIsObject);\n info.request.setHTTPMethod(WebString::fromUTF8(method));\n info.pending_failure_notification = false;\n\n if (range_info) {\n info.request.addHTTPHeaderField(WebString::fromUTF8(\"Range\"),\n WebString::fromUTF8(range_info));\n }\n\n if (strcmp(method, \"POST\") == 0) {\n SetPostData(&info.request, buf, buf_len);\n }\n\n SetReferrer(&info.request, referrer_flag);\n\n webframe_->dispatchWillSendRequest(info.request);\n if (WebDevToolsAgent* devtools_agent = GetDevToolsAgent()) {\n devtools_agent->identifierForInitialRequest(resource_id, webframe_,\n info.request);\n devtools_agent->willSendRequest(resource_id, info.request);\n }\n\n info.loader.reset(WebKit::webKitClient()->createURLLoader());\n if (!info.loader.get())\n return false;\n info.loader->loadAsynchronously(info.request, this);\n\n clients_.push_back(info);\n return true;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b51b33f2bc5d1497ddf5bd107f791c101695000d", + "input": "create_spnego_ctx(void)\n {\n \tspnego_gss_ctx_id_t spnego_ctx = NULL;\n \tspnego_ctx = (spnego_gss_ctx_id_t)\n\t\tmalloc(sizeof (spnego_gss_ctx_id_rec));\n\n\tif (spnego_ctx == NULL) {\n\t\treturn (NULL);\n\t}\n\n\tspnego_ctx->magic_num = SPNEGO_MAGIC_ID;\n\tspnego_ctx->ctx_handle = GSS_C_NO_CONTEXT;\n\tspnego_ctx->mech_set = NULL;\n\tspnego_ctx->internal_mech = NULL;\n\tspnego_ctx->optionStr = NULL;\n\tspnego_ctx->DER_mechTypes.length = 0;\n\tspnego_ctx->DER_mechTypes.value = NULL;\n\tspnego_ctx->default_cred = GSS_C_NO_CREDENTIAL;\n\tspnego_ctx->mic_reqd = 0;\n\tspnego_ctx->mic_sent = 0;\n \tspnego_ctx->mic_rcvd = 0;\n \tspnego_ctx->mech_complete = 0;\n \tspnego_ctx->nego_done = 0;\n \tspnego_ctx->internal_name = GSS_C_NO_NAME;\n \tspnego_ctx->actual_mech = GSS_C_NO_OID;\n \n\tcheck_spnego_options(spnego_ctx);\n\n\treturn (spnego_ctx);\n}\n", + "target": "create_spnego_ctx(void)\ncreate_spnego_ctx(int initiate)\n {\n \tspnego_gss_ctx_id_t spnego_ctx = NULL;\n \tspnego_ctx = (spnego_gss_ctx_id_t)\n\t\tmalloc(sizeof (spnego_gss_ctx_id_rec));\n\n\tif (spnego_ctx == NULL) {\n\t\treturn (NULL);\n\t}\n\n\tspnego_ctx->magic_num = SPNEGO_MAGIC_ID;\n\tspnego_ctx->ctx_handle = GSS_C_NO_CONTEXT;\n\tspnego_ctx->mech_set = NULL;\n\tspnego_ctx->internal_mech = NULL;\n\tspnego_ctx->optionStr = NULL;\n\tspnego_ctx->DER_mechTypes.length = 0;\n\tspnego_ctx->DER_mechTypes.value = NULL;\n\tspnego_ctx->default_cred = GSS_C_NO_CREDENTIAL;\n\tspnego_ctx->mic_reqd = 0;\n\tspnego_ctx->mic_sent = 0;\n \tspnego_ctx->mic_rcvd = 0;\n \tspnego_ctx->mech_complete = 0;\n \tspnego_ctx->nego_done = 0;\n\tspnego_ctx->opened = 0;\n\tspnego_ctx->initiate = initiate;\n \tspnego_ctx->internal_name = GSS_C_NO_NAME;\n \tspnego_ctx->actual_mech = GSS_C_NO_OID;\n \n\tcheck_spnego_options(spnego_ctx);\n\n\treturn (spnego_ctx);\n}\n", + "vul_type": "cwe-18", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#da9a32b9e282c1653bb6b5c1b8c89a1970905f21", + "input": " bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) {\n if (delegate_->OnMessageReceived(this, msg))\n return true;\n \n if (cross_process_frame_connector_ &&\n cross_process_frame_connector_->OnMessageReceived(msg))\n return true;\n\n bool handled = true;\n bool msg_is_ok = true;\n IPC_BEGIN_MESSAGE_MAP_EX(RenderFrameHostImpl, msg, msg_is_ok)\n IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach)\n IPC_MESSAGE_HANDLER(FrameHostMsg_FrameFocused, OnFrameFocused)\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartProvisionalLoadForFrame,\n OnDidStartProvisionalLoadForFrame)\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailProvisionalLoadWithError,\n OnDidFailProvisionalLoadWithError)\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidRedirectProvisionalLoad,\n OnDidRedirectProvisionalLoad)\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError,\n OnDidFailLoadWithError)\n IPC_MESSAGE_HANDLER_GENERIC(FrameHostMsg_DidCommitProvisionalLoad,\n OnNavigate(msg))\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading)\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading)\n IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL)\n IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK)\n IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK)\n IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu)\n IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse,\n OnJavaScriptExecuteResponse)\n IPC_END_MESSAGE_MAP_EX()\n\n if (!msg_is_ok) {\n RecordAction(base::UserMetricsAction(\"BadMessageTerminate_RFH\"));\n GetProcess()->ReceivedBadMessage();\n }\n\n return handled;\n}\n", + "target": " bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) {\n // Filter out most IPC messages if this renderer is swapped out.\n // We still want to handle certain ACKs to keep our state consistent.\n // TODO(nasko): Only check RenderViewHost state, as this object's own state\n // isn't yet properly updated. Transition this check once the swapped out\n // state is correct in RenderFrameHost itself.\n if (render_view_host_->IsSwappedOut()) {\n if (!SwappedOutMessages::CanHandleWhileSwappedOut(msg)) {\n // If this is a synchronous message and we decided not to handle it,\n // we must send an error reply, or else the renderer will be stuck\n // and won't respond to future requests.\n if (msg.is_sync()) {\n IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg);\n reply->set_reply_error();\n Send(reply);\n }\n // Don't continue looking for someone to handle it.\n return true;\n }\n }\n\n if (delegate_->OnMessageReceived(this, msg))\n return true;\n \n if (cross_process_frame_connector_ &&\n cross_process_frame_connector_->OnMessageReceived(msg))\n return true;\n\n bool handled = true;\n bool msg_is_ok = true;\n IPC_BEGIN_MESSAGE_MAP_EX(RenderFrameHostImpl, msg, msg_is_ok)\n IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach)\n IPC_MESSAGE_HANDLER(FrameHostMsg_FrameFocused, OnFrameFocused)\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartProvisionalLoadForFrame,\n OnDidStartProvisionalLoadForFrame)\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailProvisionalLoadWithError,\n OnDidFailProvisionalLoadWithError)\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidRedirectProvisionalLoad,\n OnDidRedirectProvisionalLoad)\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError,\n OnDidFailLoadWithError)\n IPC_MESSAGE_HANDLER_GENERIC(FrameHostMsg_DidCommitProvisionalLoad,\n OnNavigate(msg))\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading)\n IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading)\n IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL)\n IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK)\n IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK)\n IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu)\n IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse,\n OnJavaScriptExecuteResponse)\n IPC_END_MESSAGE_MAP_EX()\n\n if (!msg_is_ok) {\n RecordAction(base::UserMetricsAction(\"BadMessageTerminate_RFH\"));\n GetProcess()->ReceivedBadMessage();\n }\n\n return handled;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#966031f340185eddd05affcf72b740549f056348", + "input": "static int n_tty_ioctl(struct tty_struct *tty, struct file *file,\n\t\t unsigned int cmd, unsigned long arg)\n{\n\tstruct n_tty_data *ldata = tty->disc_data;\n\tint retval;\n\n\tswitch (cmd) {\n\tcase TIOCOUTQ:\n \t\treturn put_user(tty_chars_in_buffer(tty), (int __user *) arg);\n \tcase TIOCINQ:\n \t\tdown_write(&tty->termios_rwsem);\n\t\tif (L_ICANON(tty))\n \t\t\tretval = inq_canon(ldata);\n \t\telse\n \t\t\tretval = read_cnt(ldata);\n\t\tup_write(&tty->termios_rwsem);\n\t\treturn put_user(retval, (unsigned int __user *) arg);\n\tdefault:\n\t\treturn n_tty_ioctl_helper(tty, file, cmd, arg);\n\t}\n}\n", + "target": "static int n_tty_ioctl(struct tty_struct *tty, struct file *file,\n\t\t unsigned int cmd, unsigned long arg)\n{\n\tstruct n_tty_data *ldata = tty->disc_data;\n\tint retval;\n\n\tswitch (cmd) {\n\tcase TIOCOUTQ:\n \t\treturn put_user(tty_chars_in_buffer(tty), (int __user *) arg);\n \tcase TIOCINQ:\n \t\tdown_write(&tty->termios_rwsem);\n\t\tif (L_ICANON(tty) && !L_EXTPROC(tty))\n \t\t\tretval = inq_canon(ldata);\n \t\telse\n \t\t\tretval = read_cnt(ldata);\n\t\tup_write(&tty->termios_rwsem);\n\t\treturn put_user(retval, (unsigned int __user *) arg);\n\tdefault:\n\t\treturn n_tty_ioctl_helper(tty, file, cmd, arg);\n\t}\n}\n", + "vul_type": "cwe-704", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#01a6365651e0b1e9896b251411a18a4ab5a4306d", + "input": "void DownloadRequestLimiter::TabDownloadState::SetDownloadStatusAndNotifyImpl(\n DownloadStatus status,\n ContentSetting setting) {\n DCHECK((GetSettingFromDownloadStatus(status) == setting) ||\n (GetDownloadStatusFromSetting(setting) == status))\n << \"status \" << status << \" and setting \" << setting\n << \" do not correspond to each other\";\n\n ContentSetting last_setting = GetSettingFromDownloadStatus(status_);\n DownloadUiStatus last_ui_status = ui_status_;\n\n status_ = status;\n ui_status_ = GetUiStatusFromDownloadStatus(status_, download_seen_);\n\n if (!web_contents())\n return;\n \n if (last_setting == setting && last_ui_status == ui_status_)\n return;\n\n content::NotificationService::current()->Notify(\n chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,\n content::Source(web_contents()),\n content::NotificationService::NoDetails());\n }\n", + "target": "void DownloadRequestLimiter::TabDownloadState::SetDownloadStatusAndNotifyImpl(\n DownloadStatus status,\n ContentSetting setting) {\n DCHECK((GetSettingFromDownloadStatus(status) == setting) ||\n (GetDownloadStatusFromSetting(setting) == status))\n << \"status \" << status << \" and setting \" << setting\n << \" do not correspond to each other\";\n\n ContentSetting last_setting = GetSettingFromDownloadStatus(status_);\n DownloadUiStatus last_ui_status = ui_status_;\n\n status_ = status;\n ui_status_ = GetUiStatusFromDownloadStatus(status_, download_seen_);\n\n if (!web_contents())\n return;\n \n if (status_ == PROMPT_BEFORE_DOWNLOAD || status_ == DOWNLOADS_NOT_ALLOWED) {\n if (!initial_page_host_.empty())\n restricted_hosts_.emplace(initial_page_host_);\n }\n\n if (last_setting == setting && last_ui_status == ui_status_)\n return;\n\n content::NotificationService::current()->Notify(\n chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,\n content::Source(web_contents()),\n content::NotificationService::NoDetails());\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9a6bce9b615abca6068348c1606ba8eaf13d9ae0", + "input": "my_object_do_nothing (MyObject *obj, GError **error)\n{\n return TRUE;\n}\n", + "target": "my_object_do_nothing (MyObject *obj, GError **error)\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1e9b175204e3286d64dfd6c9f09151c31b5e099a", + "input": "PHP_METHOD(Phar, delete)\n{\n\tchar *fname;\n\tsize_t fname_len;\n\tchar *error;\n\tphar_entry_info *entry;\n\tPHAR_ARCHIVE_OBJECT();\n\n\tif (PHAR_G(readonly) && !phar_obj->archive->is_data) {\n\t\tzend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,\n\t\t\t\"Cannot write out phar archive, phar is read-only\");\n return;\n }\n \n if (zend_parse_parameters(ZEND_NUM_ARGS(), \"s\", &fname, &fname_len) == FAILURE) {\n RETURN_FALSE;\n }\n \n\tif (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {\n\t\tzend_throw_exception_ex(phar_ce_PharException, 0, \"phar \\\"%s\\\" is persistent, unable to copy on write\", phar_obj->archive->fname);\n\t\treturn;\n\t}\n\tif (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint) fname_len)) {\n\t\tif (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint) fname_len))) {\n\t\t\tif (entry->is_deleted) {\n\t\t\t\t/* entry is deleted, but has not been flushed to disk yet */\n\t\t\t\tRETURN_TRUE;\n\t\t\t} else {\n\t\t\t\tentry->is_deleted = 1;\n\t\t\t\tentry->is_modified = 1;\n\t\t\t\tphar_obj->archive->is_modified = 1;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tzend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \"Entry %s does not exist and cannot be deleted\", fname);\n\t\tRETURN_FALSE;\n\t}\n\n\tphar_flush(phar_obj->archive, NULL, 0, 0, &error);\n\tif (error) {\n\t\tzend_throw_exception_ex(phar_ce_PharException, 0, \"%s\", error);\n\t\tefree(error);\n\t}\n\n\tRETURN_TRUE;\n}\n", + "target": "PHP_METHOD(Phar, delete)\n{\n\tchar *fname;\n\tsize_t fname_len;\n\tchar *error;\n\tphar_entry_info *entry;\n\tPHAR_ARCHIVE_OBJECT();\n\n\tif (PHAR_G(readonly) && !phar_obj->archive->is_data) {\n\t\tzend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,\n\t\t\t\"Cannot write out phar archive, phar is read-only\");\n return;\n }\n \n if (zend_parse_parameters(ZEND_NUM_ARGS(), \"p\", &fname, &fname_len) == FAILURE) {\n RETURN_FALSE;\n }\n \n\tif (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {\n\t\tzend_throw_exception_ex(phar_ce_PharException, 0, \"phar \\\"%s\\\" is persistent, unable to copy on write\", phar_obj->archive->fname);\n\t\treturn;\n\t}\n\tif (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint) fname_len)) {\n\t\tif (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint) fname_len))) {\n\t\t\tif (entry->is_deleted) {\n\t\t\t\t/* entry is deleted, but has not been flushed to disk yet */\n\t\t\t\tRETURN_TRUE;\n\t\t\t} else {\n\t\t\t\tentry->is_deleted = 1;\n\t\t\t\tentry->is_modified = 1;\n\t\t\t\tphar_obj->archive->is_modified = 1;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tzend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \"Entry %s does not exist and cannot be deleted\", fname);\n\t\tRETURN_FALSE;\n\t}\n\n\tphar_flush(phar_obj->archive, NULL, 0, 0, &error);\n\tif (error) {\n\t\tzend_throw_exception_ex(phar_ce_PharException, 0, \"%s\", error);\n\t\tefree(error);\n\t}\n\n\tRETURN_TRUE;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34", + "input": "LayerTreeHost::LayerTreeHost(InitParams* params, CompositorMode mode)\n : micro_benchmark_controller_(this),\n image_worker_task_runner_(params->image_worker_task_runner),\n compositor_mode_(mode),\n ui_resource_manager_(base::MakeUnique()),\n client_(params->client),\n rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()),\n settings_(*params->settings),\n debug_state_(settings_.initial_debug_state),\n id_(s_layer_tree_host_sequence_number.GetNext() + 1),\n task_graph_runner_(params->task_graph_runner),\n event_listener_properties_(),\n mutator_host_(params->mutator_host) {\n DCHECK(task_graph_runner_);\n DCHECK(!settings_.enable_checker_imaging || image_worker_task_runner_);\n DCHECK(!settings_.enable_checker_imaging ||\n settings_.image_decode_tasks_enabled);\n\n mutator_host_->SetMutatorHostClient(this);\n\n rendering_stats_instrumentation_->set_record_rendering_stats(\n debug_state_.RecordRenderingStats());\n}\n", + "target": "LayerTreeHost::LayerTreeHost(InitParams* params, CompositorMode mode)\n : micro_benchmark_controller_(this),\n image_worker_task_runner_(params->image_worker_task_runner),\n compositor_mode_(mode),\n ui_resource_manager_(base::MakeUnique()),\n client_(params->client),\n rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()),\n settings_(*params->settings),\n debug_state_(settings_.initial_debug_state),\n id_(s_layer_tree_host_sequence_number.GetNext() + 1),\n task_graph_runner_(params->task_graph_runner),\n content_source_id_(0),\n event_listener_properties_(),\n mutator_host_(params->mutator_host) {\n DCHECK(task_graph_runner_);\n DCHECK(!settings_.enable_checker_imaging || image_worker_task_runner_);\n DCHECK(!settings_.enable_checker_imaging ||\n settings_.image_decode_tasks_enabled);\n\n mutator_host_->SetMutatorHostClient(this);\n\n rendering_stats_instrumentation_->set_record_rendering_stats(\n debug_state_.RecordRenderingStats());\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#91f2fa59e8ed80dfbf400add0164ee0e508e412a", + "input": "static char *print_value( cJSON *item, int depth, int fmt )\n{\n\tchar *out = 0;\n\tif ( ! item )\n\t\treturn 0;\n\tswitch ( ( item->type ) & 255 ) {\n\t\tcase cJSON_NULL: out = cJSON_strdup( \"null\" ); break;\n\t\tcase cJSON_False: out = cJSON_strdup( \"false\" ); break;\n\t\tcase cJSON_True: out = cJSON_strdup( \"true\" ); break;\n\t\tcase cJSON_Number: out = print_number( item ); break;\n\t\tcase cJSON_String: out = print_string( item ); break;\n\t\tcase cJSON_Array: out = print_array( item, depth, fmt ); break;\n\t\tcase cJSON_Object: out = print_object( item, depth, fmt ); break;\n \t}\n \treturn out;\n }\n", + "target": "static char *print_value( cJSON *item, int depth, int fmt )\nstatic char *print_value(cJSON *item,int depth,int fmt,printbuffer *p)\n{\n\tchar *out=0;\n\tif (!item) return 0;\n\tif (p)\n\t{\n\t\tswitch ((item->type)&255)\n\t\t{\n\t\t\tcase cJSON_NULL:\t{out=ensure(p,5);\tif (out) strcpy(out,\"null\");\tbreak;}\n\t\t\tcase cJSON_False:\t{out=ensure(p,6);\tif (out) strcpy(out,\"false\");\tbreak;}\n\t\t\tcase cJSON_True:\t{out=ensure(p,5);\tif (out) strcpy(out,\"true\");\tbreak;}\n\t\t\tcase cJSON_Number:\tout=print_number(item,p);break;\n\t\t\tcase cJSON_String:\tout=print_string(item,p);break;\n\t\t\tcase cJSON_Array:\tout=print_array(item,depth,fmt,p);break;\n\t\t\tcase cJSON_Object:\tout=print_object(item,depth,fmt,p);break;\n\t\t}\n\t}\n\telse\n\t{\n\t\tswitch ((item->type)&255)\n\t\t{\n\t\t\tcase cJSON_NULL:\tout=cJSON_strdup(\"null\");\tbreak;\n\t\t\tcase cJSON_False:\tout=cJSON_strdup(\"false\");break;\n\t\t\tcase cJSON_True:\tout=cJSON_strdup(\"true\"); break;\n\t\t\tcase cJSON_Number:\tout=print_number(item,0);break;\n\t\t\tcase cJSON_String:\tout=print_string(item,0);break;\n\t\t\tcase cJSON_Array:\tout=print_array(item,depth,fmt,0);break;\n\t\t\tcase cJSON_Object:\tout=print_object(item,depth,fmt,0);break;\n\t\t}\n \t}\n \treturn out;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#faaa2fd0a05f1622d9a8806da118d4f3b602e707", + "input": " bool MockContentSettingsClient::allowAutoplay(bool default_value) {\n return default_value || flags_->autoplay_allowed();\n }\n", + "target": " bool MockContentSettingsClient::allowAutoplay(bool default_value) {\n return flags_->autoplay_allowed();\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d3bd7413e0ca40b60cf60d4003246d067cafdeda", + "input": " static int sanitize_ptr_alu(struct bpf_verifier_env *env,\n \t\t\t struct bpf_insn *insn,\n \t\t\t const struct bpf_reg_state *ptr_reg,\n\t\t\t struct bpf_reg_state *dst_reg,\n\t\t\t bool off_is_neg)\n{\n\tstruct bpf_verifier_state *vstate = env->cur_state;\n\tstruct bpf_insn_aux_data *aux = cur_aux(env);\n\tbool ptr_is_dst_reg = ptr_reg == dst_reg;\n\tu8 opcode = BPF_OP(insn->code);\n\tu32 alu_state, alu_limit;\n \tstruct bpf_reg_state tmp;\n \tbool ret;\n \n\tif (env->allow_ptr_leaks || BPF_SRC(insn->code) == BPF_K)\n \t\treturn 0;\n \n \t/* We already marked aux for masking from non-speculative\n\t * paths, thus we got here in the first place. We only care\n\t * to explore bad access from here.\n\t */\n\tif (vstate->speculative)\n\t\tgoto do_sim;\n\n\talu_state = off_is_neg ? BPF_ALU_NEG_VALUE : 0;\n\talu_state |= ptr_is_dst_reg ?\n\t\t BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST;\n \n \tif (retrieve_ptr_limit(ptr_reg, &alu_limit, opcode, off_is_neg))\n \t\treturn 0;\n\t/* If we arrived here from different branches with different\n\t * limits to sanitize, then this won't work.\n\t */\n\tif (aux->alu_state &&\n\t (aux->alu_state != alu_state ||\n\t aux->alu_limit != alu_limit))\n \t\treturn -EACCES;\n\t/* Corresponding fixup done in fixup_bpf_calls(). */\n\taux->alu_state = alu_state;\n\taux->alu_limit = alu_limit;\n do_sim:\n \t/* Simulate and find potential out-of-bounds access under\n \t * speculative execution from truncation as a result of\n\t * masking when off was not within expected range. If off\n\t * sits in dst, then we temporarily need to move ptr there\n\t * to simulate dst (== 0) +/-= ptr. Needed, for example,\n\t * for cases where we use K-based arithmetic in one direction\n\t * and truncated reg-based in the other in order to explore\n\t * bad access.\n\t */\n\tif (!ptr_is_dst_reg) {\n\t\ttmp = *dst_reg;\n\t\t*dst_reg = *ptr_reg;\n\t}\n\tret = push_stack(env, env->insn_idx + 1, env->insn_idx, true);\n\tif (!ptr_is_dst_reg)\n\t\t*dst_reg = tmp;\n\treturn !ret ? -EFAULT : 0;\n}\n", + "target": " static int sanitize_ptr_alu(struct bpf_verifier_env *env,\n \t\t\t struct bpf_insn *insn,\n \t\t\t const struct bpf_reg_state *ptr_reg,\n\t\t\t struct bpf_reg_state *dst_reg,\n\t\t\t bool off_is_neg)\n{\n\tstruct bpf_verifier_state *vstate = env->cur_state;\n\tstruct bpf_insn_aux_data *aux = cur_aux(env);\n\tbool ptr_is_dst_reg = ptr_reg == dst_reg;\n\tu8 opcode = BPF_OP(insn->code);\n\tu32 alu_state, alu_limit;\n \tstruct bpf_reg_state tmp;\n \tbool ret;\n \n\tif (can_skip_alu_sanitation(env, insn))\n \t\treturn 0;\n \n \t/* We already marked aux for masking from non-speculative\n\t * paths, thus we got here in the first place. We only care\n\t * to explore bad access from here.\n\t */\n\tif (vstate->speculative)\n\t\tgoto do_sim;\n\n\talu_state = off_is_neg ? BPF_ALU_NEG_VALUE : 0;\n\talu_state |= ptr_is_dst_reg ?\n\t\t BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST;\n \n \tif (retrieve_ptr_limit(ptr_reg, &alu_limit, opcode, off_is_neg))\n \t\treturn 0;\n\tif (update_alu_sanitation_state(aux, alu_state, alu_limit))\n \t\treturn -EACCES;\n do_sim:\n \t/* Simulate and find potential out-of-bounds access under\n \t * speculative execution from truncation as a result of\n\t * masking when off was not within expected range. If off\n\t * sits in dst, then we temporarily need to move ptr there\n\t * to simulate dst (== 0) +/-= ptr. Needed, for example,\n\t * for cases where we use K-based arithmetic in one direction\n\t * and truncated reg-based in the other in order to explore\n\t * bad access.\n\t */\n\tif (!ptr_is_dst_reg) {\n\t\ttmp = *dst_reg;\n\t\t*dst_reg = *ptr_reg;\n\t}\n\tret = push_stack(env, env->insn_idx + 1, env->insn_idx, true);\n\tif (!ptr_is_dst_reg)\n\t\t*dst_reg = tmp;\n\treturn !ret ? -EFAULT : 0;\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#51e0cb2e5ec18eaf6fb331bc573ff27b743898f4", + "input": "xmlParse3986Port(xmlURIPtr uri, const char **str)\n{\n const char *cur = *str;\n unsigned port = 0; /* unsigned for defined overflow behavior */\n\n if (ISA_DIGIT(cur)) {\n while (ISA_DIGIT(cur)) {\n\t port = port * 10 + (*cur - '0');\n\n\n \t cur++;\n \t}\n \tif (uri != NULL)\n\t uri->port = port & INT_MAX; /* port value modulo INT_MAX+1 */\n \t*str = cur;\n \treturn(0);\n }\n return(1);\n}\n", + "target": "xmlParse3986Port(xmlURIPtr uri, const char **str)\n{\n const char *cur = *str;\n unsigned port = 0; /* unsigned for defined overflow behavior */\n\n if (ISA_DIGIT(cur)) {\n while (ISA_DIGIT(cur)) {\n\t port = port * 10 + (*cur - '0');\n\n\n \t cur++;\n \t}\n \tif (uri != NULL)\n\t uri->port = port & USHRT_MAX; /* port value modulo INT_MAX+1 */\n \t*str = cur;\n \treturn(0);\n }\n return(1);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0e3d721470add955c056e3051614f58c7220e85b", + "input": " bool SynchronousCompositorImpl::IsExternalFlingActive() const {\n DCHECK(CalledOnValidThread());\n DCHECK(compositor_client_);\n return compositor_client_->IsExternalFlingActive();\n }\n", + "target": " bool SynchronousCompositorImpl::IsExternalFlingActive() const {\n DCHECK(CalledOnValidThread());\n DCHECK(compositor_client_);\n if (!registered_with_client_)\n return false;\n return compositor_client_->IsExternalFlingActive();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "VideoTrack::VideoTrack(\n Segment* pSegment,\n long long element_start,\n long long element_size) :\n Track(pSegment, element_start, element_size)\n{\n}\n", + "target": "VideoTrack::VideoTrack(\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1161a49d663dd395bd639549c2dfe7324f847938", + "input": " bool OSExchangeDataProviderAuraX11::GetURLAndTitle(\n GURL* url,\n base::string16* title) const {\n std::vector< ::Atom> url_atoms = ui::GetURLAtomsFrom(&atom_cache_);\n std::vector< ::Atom> requested_types;\n ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types);\n\n ui::SelectionData data(format_map_.GetFirstOf(requested_types));\n if (data.IsValid()) {\n\n if (data.GetType() == atom_cache_.GetAtom(kMimeTypeMozillaURL)) {\n base::string16 unparsed;\n data.AssignTo(&unparsed);\n\n std::vector tokens;\n size_t num_tokens = Tokenize(unparsed, base::ASCIIToUTF16(\"\\n\"), &tokens);\n if (num_tokens > 0) {\n if (num_tokens > 1)\n *title = tokens[1];\n else\n *title = base::string16();\n\n *url = GURL(tokens[0]);\n return true;\n }\n } else if (data.GetType() == atom_cache_.GetAtom(\n Clipboard::kMimeTypeURIList)) {\n std::vector tokens = ui::ParseURIList(data);\n for (std::vector::const_iterator it = tokens.begin();\n it != tokens.end(); ++it) {\n GURL test_url(*it);\n if (!test_url.SchemeIsFile()) {\n *url = test_url;\n *title = base::string16();\n return true;\n }\n }\n }\n }\n\n return false;\n}\n", + "target": " bool OSExchangeDataProviderAuraX11::GetURLAndTitle(\n OSExchangeData::FilenameToURLPolicy policy,\n GURL* url,\n base::string16* title) const {\n std::vector< ::Atom> url_atoms = ui::GetURLAtomsFrom(&atom_cache_);\n std::vector< ::Atom> requested_types;\n ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types);\n\n ui::SelectionData data(format_map_.GetFirstOf(requested_types));\n if (data.IsValid()) {\n\n if (data.GetType() == atom_cache_.GetAtom(kMimeTypeMozillaURL)) {\n base::string16 unparsed;\n data.AssignTo(&unparsed);\n\n std::vector tokens;\n size_t num_tokens = Tokenize(unparsed, base::ASCIIToUTF16(\"\\n\"), &tokens);\n if (num_tokens > 0) {\n if (num_tokens > 1)\n *title = tokens[1];\n else\n *title = base::string16();\n\n *url = GURL(tokens[0]);\n return true;\n }\n } else if (data.GetType() == atom_cache_.GetAtom(\n Clipboard::kMimeTypeURIList)) {\n std::vector tokens = ui::ParseURIList(data);\n for (std::vector::const_iterator it = tokens.begin();\n it != tokens.end(); ++it) {\n GURL test_url(*it);\n if (!test_url.SchemeIsFile() ||\n policy == OSExchangeData::CONVERT_FILENAMES) {\n *url = test_url;\n *title = base::string16();\n return true;\n }\n }\n }\n }\n\n return false;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f76e7feb41a4327d2b0978449bbdafe98d4a3771", + "input": "isakmp_rfc3948_print(netdissect_options *ndo,\n \t\t const u_char *bp, u_int length,\n \t\t const u_char *bp2)\n {\n \tif(length == 1 && bp[0]==0xff) {\n \t\tND_PRINT((ndo, \"isakmp-nat-keep-alive\"));\n \t\treturn;\n\t}\n\n \tif(length < 4) {\n \t\tgoto trunc;\n \t}\n \n \t/*\n \t * see if this is an IKE packet\n\t */\n\tif(bp[0]==0 && bp[1]==0 && bp[2]==0 && bp[3]==0) {\n\t\tND_PRINT((ndo, \"NONESP-encap: \"));\n\t\tisakmp_print(ndo, bp+4, length-4, bp2);\n\t\treturn;\n\t}\n\n\t/* must be an ESP packet */\n\t{\n\t\tint nh, enh, padlen;\n\t\tint advance;\n\n\t\tND_PRINT((ndo, \"UDP-encap: \"));\n\n\t\tadvance = esp_print(ndo, bp, length, bp2, &enh, &padlen);\n\t\tif(advance <= 0)\n\t\t\treturn;\n\n\t\tbp += advance;\n\t\tlength -= advance + padlen;\n\t\tnh = enh & 0xff;\n\n\t\tip_print_inner(ndo, bp, length, nh, bp2);\n\t\treturn;\n\t}\n\ntrunc:\n\tND_PRINT((ndo,\"[|isakmp]\"));\n\treturn;\n}\n", + "target": "isakmp_rfc3948_print(netdissect_options *ndo,\n \t\t const u_char *bp, u_int length,\n \t\t const u_char *bp2)\n {\n\tND_TCHECK(bp[0]);\n \tif(length == 1 && bp[0]==0xff) {\n \t\tND_PRINT((ndo, \"isakmp-nat-keep-alive\"));\n \t\treturn;\n\t}\n\n \tif(length < 4) {\n \t\tgoto trunc;\n \t}\n\tND_TCHECK(bp[3]);\n \n \t/*\n \t * see if this is an IKE packet\n\t */\n\tif(bp[0]==0 && bp[1]==0 && bp[2]==0 && bp[3]==0) {\n\t\tND_PRINT((ndo, \"NONESP-encap: \"));\n\t\tisakmp_print(ndo, bp+4, length-4, bp2);\n\t\treturn;\n\t}\n\n\t/* must be an ESP packet */\n\t{\n\t\tint nh, enh, padlen;\n\t\tint advance;\n\n\t\tND_PRINT((ndo, \"UDP-encap: \"));\n\n\t\tadvance = esp_print(ndo, bp, length, bp2, &enh, &padlen);\n\t\tif(advance <= 0)\n\t\t\treturn;\n\n\t\tbp += advance;\n\t\tlength -= advance + padlen;\n\t\tnh = enh & 0xff;\n\n\t\tip_print_inner(ndo, bp, length, nh, bp2);\n\t\treturn;\n\t}\n\ntrunc:\n\tND_PRINT((ndo,\"[|isakmp]\"));\n\treturn;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0da6dcdbe8e34740133773d20cc466b89d399d0a", + "input": "void XSSAuditor::Init(Document* document,\n XSSAuditorDelegate* auditor_delegate) {\n DCHECK(IsMainThread());\n if (state_ != kUninitialized)\n return;\n state_ = kFilteringTokens;\n\n if (Settings* settings = document->GetSettings())\n is_enabled_ = settings->GetXSSAuditorEnabled();\n\n if (!is_enabled_)\n return;\n\n document_url_ = document->Url().Copy();\n\n if (!document->GetFrame()) {\n is_enabled_ = false;\n return;\n }\n\n if (document_url_.IsEmpty()) {\n is_enabled_ = false;\n return;\n }\n\n if (document_url_.ProtocolIsData()) {\n is_enabled_ = false;\n return;\n }\n\n if (document->Encoding().IsValid())\n encoding_ = document->Encoding();\n\n if (DocumentLoader* document_loader =\n document->GetFrame()->Loader().GetDocumentLoader()) {\n const AtomicString& header_value =\n document_loader->GetResponse().HttpHeaderField(\n HTTPNames::X_XSS_Protection);\n String error_details;\n unsigned error_position = 0;\n String report_url;\n KURL xss_protection_report_url;\n\n ReflectedXSSDisposition xss_protection_header = ParseXSSProtectionHeader(\n header_value, error_details, error_position, report_url);\n\n if (xss_protection_header == kAllowReflectedXSS)\n UseCounter::Count(*document, WebFeature::kXSSAuditorDisabled);\n else if (xss_protection_header == kFilterReflectedXSS)\n UseCounter::Count(*document, WebFeature::kXSSAuditorEnabledFilter);\n else if (xss_protection_header == kBlockReflectedXSS)\n UseCounter::Count(*document, WebFeature::kXSSAuditorEnabledBlock);\n else if (xss_protection_header == kReflectedXSSInvalid)\n UseCounter::Count(*document, WebFeature::kXSSAuditorInvalid);\n\n did_send_valid_xss_protection_header_ =\n xss_protection_header != kReflectedXSSUnset &&\n xss_protection_header != kReflectedXSSInvalid;\n if ((xss_protection_header == kFilterReflectedXSS ||\n xss_protection_header == kBlockReflectedXSS) &&\n !report_url.IsEmpty()) {\n xss_protection_report_url = document->CompleteURL(report_url);\n if (MixedContentChecker::IsMixedContent(document->GetSecurityOrigin(),\n xss_protection_report_url)) {\n error_details = \"insecure reporting URL for secure page\";\n xss_protection_header = kReflectedXSSInvalid;\n xss_protection_report_url = KURL();\n }\n }\n if (xss_protection_header == kReflectedXSSInvalid) {\n document->AddConsoleMessage(ConsoleMessage::Create(\n kSecurityMessageSource, kErrorMessageLevel,\n \"Error parsing header X-XSS-Protection: \" + header_value + \": \" +\n error_details + \" at character position \" +\n String::Format(\"%u\", error_position) +\n \". The default protections will be applied.\"));\n }\n\n xss_protection_ = xss_protection_header;\n if (xss_protection_ == kReflectedXSSInvalid ||\n xss_protection_ == kReflectedXSSUnset) {\n xss_protection_ = kBlockReflectedXSS;\n }\n\n if (auditor_delegate)\n auditor_delegate->SetReportURL(xss_protection_report_url.Copy());\n\n EncodedFormData* http_body = document_loader->GetRequest().HttpBody();\n if (http_body && !http_body->IsEmpty())\n http_body_as_string_ = http_body->FlattenToString();\n }\n\n SetEncoding(encoding_);\n}\n", + "target": "void XSSAuditor::Init(Document* document,\n XSSAuditorDelegate* auditor_delegate) {\n DCHECK(IsMainThread());\n if (state_ != kUninitialized)\n return;\n state_ = kFilteringTokens;\n\n if (Settings* settings = document->GetSettings())\n is_enabled_ = settings->GetXSSAuditorEnabled();\n\n if (!is_enabled_)\n return;\n\n document_url_ = document->Url().Copy();\n\n if (!document->GetFrame()) {\n is_enabled_ = false;\n return;\n }\n\n if (document_url_.IsEmpty()) {\n is_enabled_ = false;\n return;\n }\n\n if (document_url_.ProtocolIsData()) {\n is_enabled_ = false;\n return;\n }\n\n if (document->Encoding().IsValid())\n encoding_ = document->Encoding();\n\n if (DocumentLoader* document_loader =\n document->GetFrame()->Loader().GetDocumentLoader()) {\n const AtomicString& header_value =\n document_loader->GetResponse().HttpHeaderField(\n HTTPNames::X_XSS_Protection);\n String error_details;\n unsigned error_position = 0;\n String report_url;\n KURL xss_protection_report_url;\n\n ReflectedXSSDisposition xss_protection_header = ParseXSSProtectionHeader(\n header_value, error_details, error_position, report_url);\n\n if (xss_protection_header == kAllowReflectedXSS)\n UseCounter::Count(*document, WebFeature::kXSSAuditorDisabled);\n else if (xss_protection_header == kFilterReflectedXSS)\n UseCounter::Count(*document, WebFeature::kXSSAuditorEnabledFilter);\n else if (xss_protection_header == kBlockReflectedXSS)\n UseCounter::Count(*document, WebFeature::kXSSAuditorEnabledBlock);\n else if (xss_protection_header == kReflectedXSSInvalid)\n UseCounter::Count(*document, WebFeature::kXSSAuditorInvalid);\n\n did_send_valid_xss_protection_header_ =\n xss_protection_header != kReflectedXSSUnset &&\n xss_protection_header != kReflectedXSSInvalid;\n if ((xss_protection_header == kFilterReflectedXSS ||\n xss_protection_header == kBlockReflectedXSS) &&\n !report_url.IsEmpty()) {\n xss_protection_report_url = document->CompleteURL(report_url);\n if (!SecurityOrigin::Create(xss_protection_report_url)\n ->IsSameSchemeHostPort(document->GetSecurityOrigin())) {\n error_details =\n \"reporting URL is not same scheme, host, and port as page\";\n xss_protection_header = kReflectedXSSInvalid;\n xss_protection_report_url = KURL();\n }\n if (MixedContentChecker::IsMixedContent(document->GetSecurityOrigin(),\n xss_protection_report_url)) {\n error_details = \"insecure reporting URL for secure page\";\n xss_protection_header = kReflectedXSSInvalid;\n xss_protection_report_url = KURL();\n }\n }\n if (xss_protection_header == kReflectedXSSInvalid) {\n document->AddConsoleMessage(ConsoleMessage::Create(\n kSecurityMessageSource, kErrorMessageLevel,\n \"Error parsing header X-XSS-Protection: \" + header_value + \": \" +\n error_details + \" at character position \" +\n String::Format(\"%u\", error_position) +\n \". The default protections will be applied.\"));\n }\n\n xss_protection_ = xss_protection_header;\n if (xss_protection_ == kReflectedXSSInvalid ||\n xss_protection_ == kReflectedXSSUnset) {\n xss_protection_ = kBlockReflectedXSS;\n }\n\n if (auditor_delegate)\n auditor_delegate->SetReportURL(xss_protection_report_url.Copy());\n\n EncodedFormData* http_body = document_loader->GetRequest().HttpBody();\n if (http_body && !http_body->IsEmpty())\n http_body_as_string_ = http_body->FlattenToString();\n }\n\n SetEncoding(encoding_);\n}\n", + "vul_type": "cwe-79", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cef31d9af908243421258f1df35a4a644604efbe", + "input": "void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting)\n{\n\tconst struct k_clock *kc = timr->kclock;\n\tktime_t now, remaining, iv;\n \tstruct timespec64 ts64;\n \tbool sig_none;\n \n\tsig_none = (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE;\n \tiv = timr->it_interval;\n \n \t/* interval timer ? */\n\tif (iv) {\n\t\tcur_setting->it_interval = ktime_to_timespec64(iv);\n\t} else if (!timr->it_active) {\n\t\t/*\n\t\t * SIGEV_NONE oneshot timers are never queued. Check them\n\t\t * below.\n\t\t */\n\t\tif (!sig_none)\n\t\t\treturn;\n\t}\n\n\t/*\n\t * The timespec64 based conversion is suboptimal, but it's not\n\t * worth to implement yet another callback.\n\t */\n\tkc->clock_get(timr->it_clock, &ts64);\n\tnow = timespec64_to_ktime(ts64);\n\n\t/*\n\t * When a requeue is pending or this is a SIGEV_NONE timer move the\n\t * expiry time forward by intervals, so expiry is > now.\n\t */\n\tif (iv && (timr->it_requeue_pending & REQUEUE_PENDING || sig_none))\n\t\ttimr->it_overrun += kc->timer_forward(timr, now);\n\n\tremaining = kc->timer_remaining(timr, now);\n\t/* Return 0 only, when the timer is expired and not pending */\n\tif (remaining <= 0) {\n\t\t/*\n\t\t * A single shot SIGEV_NONE timer must return 0, when\n\t\t * it is expired !\n\t\t */\n\t\tif (!sig_none)\n\t\t\tcur_setting->it_value.tv_nsec = 1;\n\t} else {\n\t\tcur_setting->it_value = ktime_to_timespec64(remaining);\n\t}\n}\n", + "target": "void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting)\n{\n\tconst struct k_clock *kc = timr->kclock;\n\tktime_t now, remaining, iv;\n \tstruct timespec64 ts64;\n \tbool sig_none;\n \n\tsig_none = timr->it_sigev_notify == SIGEV_NONE;\n \tiv = timr->it_interval;\n \n \t/* interval timer ? */\n\tif (iv) {\n\t\tcur_setting->it_interval = ktime_to_timespec64(iv);\n\t} else if (!timr->it_active) {\n\t\t/*\n\t\t * SIGEV_NONE oneshot timers are never queued. Check them\n\t\t * below.\n\t\t */\n\t\tif (!sig_none)\n\t\t\treturn;\n\t}\n\n\t/*\n\t * The timespec64 based conversion is suboptimal, but it's not\n\t * worth to implement yet another callback.\n\t */\n\tkc->clock_get(timr->it_clock, &ts64);\n\tnow = timespec64_to_ktime(ts64);\n\n\t/*\n\t * When a requeue is pending or this is a SIGEV_NONE timer move the\n\t * expiry time forward by intervals, so expiry is > now.\n\t */\n\tif (iv && (timr->it_requeue_pending & REQUEUE_PENDING || sig_none))\n\t\ttimr->it_overrun += kc->timer_forward(timr, now);\n\n\tremaining = kc->timer_remaining(timr, now);\n\t/* Return 0 only, when the timer is expired and not pending */\n\tif (remaining <= 0) {\n\t\t/*\n\t\t * A single shot SIGEV_NONE timer must return 0, when\n\t\t * it is expired !\n\t\t */\n\t\tif (!sig_none)\n\t\t\tcur_setting->it_value.tv_nsec = 1;\n\t} else {\n\t\tcur_setting->it_value = ktime_to_timespec64(remaining);\n\t}\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1309d7afbed112f0e8e90be9af975550caa0076b", + "input": "int tpm_open(struct inode *inode, struct file *file)\n{\n\tint minor = iminor(inode);\n\tstruct tpm_chip *chip = NULL, *pos;\n\n\trcu_read_lock();\n\tlist_for_each_entry_rcu(pos, &tpm_chip_list, list) {\n\t\tif (pos->vendor.miscdev.minor == minor) {\n\t\t\tchip = pos;\n\t\t\tget_device(chip->dev);\n\t\t\tbreak;\n\t\t}\n\t}\n\trcu_read_unlock();\n\n\tif (!chip)\n\t\treturn -ENODEV;\n\n\tif (test_and_set_bit(0, &chip->is_open)) {\n\t\tdev_dbg(chip->dev, \"Another process owns this TPM\\n\");\n\t\tput_device(chip->dev);\n \t\treturn -EBUSY;\n \t}\n \n\tchip->data_buffer = kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL);\n \tif (chip->data_buffer == NULL) {\n \t\tclear_bit(0, &chip->is_open);\n \t\tput_device(chip->dev);\n\t\treturn -ENOMEM;\n\t}\n\n\tatomic_set(&chip->data_pending, 0);\n\n\tfile->private_data = chip;\n\treturn 0;\n}\n", + "target": "int tpm_open(struct inode *inode, struct file *file)\n{\n\tint minor = iminor(inode);\n\tstruct tpm_chip *chip = NULL, *pos;\n\n\trcu_read_lock();\n\tlist_for_each_entry_rcu(pos, &tpm_chip_list, list) {\n\t\tif (pos->vendor.miscdev.minor == minor) {\n\t\t\tchip = pos;\n\t\t\tget_device(chip->dev);\n\t\t\tbreak;\n\t\t}\n\t}\n\trcu_read_unlock();\n\n\tif (!chip)\n\t\treturn -ENODEV;\n\n\tif (test_and_set_bit(0, &chip->is_open)) {\n\t\tdev_dbg(chip->dev, \"Another process owns this TPM\\n\");\n\t\tput_device(chip->dev);\n \t\treturn -EBUSY;\n \t}\n \n\tchip->data_buffer = kzalloc(TPM_BUFSIZE, GFP_KERNEL);\n \tif (chip->data_buffer == NULL) {\n \t\tclear_bit(0, &chip->is_open);\n \t\tput_device(chip->dev);\n\t\treturn -ENOMEM;\n\t}\n\n\tatomic_set(&chip->data_pending, 0);\n\n\tfile->private_data = chip;\n\treturn 0;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3207ddb0103543da8ad2139ec6539f590f9900c1", + "input": "static int read_entry(\n\tgit_index_entry **out,\n\tsize_t *out_size,\n\tgit_index *index,\n\tconst void *buffer,\n\tsize_t buffer_size,\n\tconst char *last)\n{\n\tsize_t path_length, entry_size;\n\tconst char *path_ptr;\n\tstruct entry_short source;\n\tgit_index_entry entry = {{0}};\n\tbool compressed = index->version >= INDEX_VERSION_NUMBER_COMP;\n\tchar *tmp_path = NULL;\n\n\tif (INDEX_FOOTER_SIZE + minimal_entry_size > buffer_size)\n\t\treturn -1;\n\n\t/* buffer is not guaranteed to be aligned */\n\tmemcpy(&source, buffer, sizeof(struct entry_short));\n\n\tentry.ctime.seconds = (git_time_t)ntohl(source.ctime.seconds);\n\tentry.ctime.nanoseconds = ntohl(source.ctime.nanoseconds);\n\tentry.mtime.seconds = (git_time_t)ntohl(source.mtime.seconds);\n\tentry.mtime.nanoseconds = ntohl(source.mtime.nanoseconds);\n\tentry.dev = ntohl(source.dev);\n\tentry.ino = ntohl(source.ino);\n\tentry.mode = ntohl(source.mode);\n\tentry.uid = ntohl(source.uid);\n\tentry.gid = ntohl(source.gid);\n\tentry.file_size = ntohl(source.file_size);\n\tgit_oid_cpy(&entry.id, &source.oid);\n\tentry.flags = ntohs(source.flags);\n\n\tif (entry.flags & GIT_IDXENTRY_EXTENDED) {\n\t\tuint16_t flags_raw;\n\t\tsize_t flags_offset;\n\n\t\tflags_offset = offsetof(struct entry_long, flags_extended);\n\t\tmemcpy(&flags_raw, (const char *) buffer + flags_offset,\n\t\t\tsizeof(flags_raw));\n\t\tflags_raw = ntohs(flags_raw);\n\n\t\tmemcpy(&entry.flags_extended, &flags_raw, sizeof(flags_raw));\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_long, path);\n\t} else\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_short, path);\n\n\tif (!compressed) {\n\t\tpath_length = entry.flags & GIT_IDXENTRY_NAMEMASK;\n\n\t\t/* if this is a very long string, we must find its\n\t\t * real length without overflowing */\n\t\tif (path_length == 0xFFF) {\n\t\t\tconst char *path_end;\n\n\t\t\tpath_end = memchr(path_ptr, '\\0', buffer_size);\n\t\t\tif (path_end == NULL)\n\t\t\t\treturn -1;\n\n\t\t\tpath_length = path_end - path_ptr;\n\t\t}\n\n \t\tentry_size = index_entry_size(path_length, 0, entry.flags);\n \t\tentry.path = (char *)path_ptr;\n \t} else {\n\t\tsize_t varint_len;\n\t\tsize_t strip_len = git_decode_varint((const unsigned char *)path_ptr,\n\t\t\t\t\t\t &varint_len);\n\t\tsize_t last_len = strlen(last);\n\t\tsize_t prefix_len = last_len - strip_len;\n\t\tsize_t suffix_len = strlen(path_ptr + varint_len);\n\t\tsize_t path_len;\n\t\tif (varint_len == 0)\n \t\t\treturn index_error_invalid(\"incorrect prefix length\");\n \n \t\tGITERR_CHECK_ALLOC_ADD(&path_len, prefix_len, suffix_len);\n \t\tGITERR_CHECK_ALLOC_ADD(&path_len, path_len, 1);\n \t\ttmp_path = git__malloc(path_len);\n\t\tGITERR_CHECK_ALLOC(tmp_path);\n\n\t\tmemcpy(tmp_path, last, prefix_len);\n\t\tmemcpy(tmp_path + prefix_len, path_ptr + varint_len, suffix_len + 1);\n\t\tentry_size = index_entry_size(suffix_len, varint_len, entry.flags);\n\t\tentry.path = tmp_path;\n\t}\n\n\tif (entry_size == 0)\n\t\treturn -1;\n\n\tif (INDEX_FOOTER_SIZE + entry_size > buffer_size)\n\t\treturn -1;\n\n\tif (index_entry_dup(out, index, &entry) < 0) {\n\t\tgit__free(tmp_path);\n\t\treturn -1;\n\t}\n\n\tgit__free(tmp_path);\n\t*out_size = entry_size;\n\treturn 0;\n}\n", + "target": "static int read_entry(\n\tgit_index_entry **out,\n\tsize_t *out_size,\n\tgit_index *index,\n\tconst void *buffer,\n\tsize_t buffer_size,\n\tconst char *last)\n{\n\tsize_t path_length, entry_size;\n\tconst char *path_ptr;\n\tstruct entry_short source;\n\tgit_index_entry entry = {{0}};\n\tbool compressed = index->version >= INDEX_VERSION_NUMBER_COMP;\n\tchar *tmp_path = NULL;\n\n\tif (INDEX_FOOTER_SIZE + minimal_entry_size > buffer_size)\n\t\treturn -1;\n\n\t/* buffer is not guaranteed to be aligned */\n\tmemcpy(&source, buffer, sizeof(struct entry_short));\n\n\tentry.ctime.seconds = (git_time_t)ntohl(source.ctime.seconds);\n\tentry.ctime.nanoseconds = ntohl(source.ctime.nanoseconds);\n\tentry.mtime.seconds = (git_time_t)ntohl(source.mtime.seconds);\n\tentry.mtime.nanoseconds = ntohl(source.mtime.nanoseconds);\n\tentry.dev = ntohl(source.dev);\n\tentry.ino = ntohl(source.ino);\n\tentry.mode = ntohl(source.mode);\n\tentry.uid = ntohl(source.uid);\n\tentry.gid = ntohl(source.gid);\n\tentry.file_size = ntohl(source.file_size);\n\tgit_oid_cpy(&entry.id, &source.oid);\n\tentry.flags = ntohs(source.flags);\n\n\tif (entry.flags & GIT_IDXENTRY_EXTENDED) {\n\t\tuint16_t flags_raw;\n\t\tsize_t flags_offset;\n\n\t\tflags_offset = offsetof(struct entry_long, flags_extended);\n\t\tmemcpy(&flags_raw, (const char *) buffer + flags_offset,\n\t\t\tsizeof(flags_raw));\n\t\tflags_raw = ntohs(flags_raw);\n\n\t\tmemcpy(&entry.flags_extended, &flags_raw, sizeof(flags_raw));\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_long, path);\n\t} else\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_short, path);\n\n\tif (!compressed) {\n\t\tpath_length = entry.flags & GIT_IDXENTRY_NAMEMASK;\n\n\t\t/* if this is a very long string, we must find its\n\t\t * real length without overflowing */\n\t\tif (path_length == 0xFFF) {\n\t\t\tconst char *path_end;\n\n\t\t\tpath_end = memchr(path_ptr, '\\0', buffer_size);\n\t\t\tif (path_end == NULL)\n\t\t\t\treturn -1;\n\n\t\t\tpath_length = path_end - path_ptr;\n\t\t}\n\n \t\tentry_size = index_entry_size(path_length, 0, entry.flags);\n \t\tentry.path = (char *)path_ptr;\n \t} else {\n\t\tsize_t varint_len, last_len, prefix_len, suffix_len, path_len;\n\t\tuintmax_t strip_len;\n\n\t\tstrip_len = git_decode_varint((const unsigned char *)path_ptr, &varint_len);\n\t\tlast_len = strlen(last);\n\n\t\tif (varint_len == 0 || last_len < strip_len)\n \t\t\treturn index_error_invalid(\"incorrect prefix length\");\n \n\t\tprefix_len = last_len - strip_len;\n\t\tsuffix_len = strlen(path_ptr + varint_len);\n\n \t\tGITERR_CHECK_ALLOC_ADD(&path_len, prefix_len, suffix_len);\n \t\tGITERR_CHECK_ALLOC_ADD(&path_len, path_len, 1);\n \t\ttmp_path = git__malloc(path_len);\n\t\tGITERR_CHECK_ALLOC(tmp_path);\n\n\t\tmemcpy(tmp_path, last, prefix_len);\n\t\tmemcpy(tmp_path + prefix_len, path_ptr + varint_len, suffix_len + 1);\n\t\tentry_size = index_entry_size(suffix_len, varint_len, entry.flags);\n\t\tentry.path = tmp_path;\n\t}\n\n\tif (entry_size == 0)\n\t\treturn -1;\n\n\tif (INDEX_FOOTER_SIZE + entry_size > buffer_size)\n\t\treturn -1;\n\n\tif (index_entry_dup(out, index, &entry) < 0) {\n\t\tgit__free(tmp_path);\n\t\treturn -1;\n\t}\n\n\tgit__free(tmp_path);\n\t*out_size = entry_size;\n\treturn 0;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#83a4b92815ea04969d494416eaae3d4c6b338e4a#diff-c8b4b355f9b5c06d585b23138e1c185f", + "input": "horizontalDifference8(unsigned char *ip, int n, int stride, \n\tunsigned short *wp, uint16 *From8)\n{\n register int r1, g1, b1, a1, r2, g2, b2, a2, mask;\n\n#undef\t CLAMP\n#define CLAMP(v) (From8[(v)])\n\n mask = CODE_MASK;\n if (n >= stride) {\n\tif (stride == 3) {\n\t r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);\n\t b2 = wp[2] = CLAMP(ip[2]);\n\t n -= 3;\n\t while (n > 0) {\n\t\tn -= 3;\n\t\tr1 = CLAMP(ip[3]); wp[3] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = CLAMP(ip[4]); wp[4] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = CLAMP(ip[5]); wp[5] = (uint16)((b1-b2) & mask); b2 = b1;\n\t\twp += 3;\n\t\tip += 3;\n\t }\n\t} else if (stride == 4) {\n\t r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);\n\t b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]);\n\t n -= 4;\n\t while (n > 0) {\n\t\tn -= 4;\n\t\tr1 = CLAMP(ip[4]); wp[4] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = CLAMP(ip[5]); wp[5] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = CLAMP(ip[6]); wp[6] = (uint16)((b1-b2) & mask); b2 = b1;\n\t\ta1 = CLAMP(ip[7]); wp[7] = (uint16)((a1-a2) & mask); a2 = a1;\n\t\twp += 4;\n \t\tip += 4;\n \t }\n \t} else {\n\t wp += n + stride - 1;\t/* point to last one */\n\t ip += n + stride - 1;\t/* point to last one */\n\t n -= stride;\n\t while (n > 0) {\n\t\tREPEAT(stride, wp[0] = CLAMP(ip[0]);\n\t\t\t\twp[stride] -= wp[0];\n\t\t\t\twp[stride] &= mask;\n\t\t\t\twp--; ip--)\n\t\tn -= stride;\n\t }\n\t REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--)\n\t}\n }\n }\n", + "target": "horizontalDifference8(unsigned char *ip, int n, int stride, \n\tunsigned short *wp, uint16 *From8)\n{\n register int r1, g1, b1, a1, r2, g2, b2, a2, mask;\n\n#undef\t CLAMP\n#define CLAMP(v) (From8[(v)])\n\n mask = CODE_MASK;\n if (n >= stride) {\n\tif (stride == 3) {\n\t r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);\n\t b2 = wp[2] = CLAMP(ip[2]);\n\t n -= 3;\n\t while (n > 0) {\n\t\tn -= 3;\n\t\tr1 = CLAMP(ip[3]); wp[3] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = CLAMP(ip[4]); wp[4] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = CLAMP(ip[5]); wp[5] = (uint16)((b1-b2) & mask); b2 = b1;\n\t\twp += 3;\n\t\tip += 3;\n\t }\n\t} else if (stride == 4) {\n\t r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);\n\t b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]);\n\t n -= 4;\n\t while (n > 0) {\n\t\tn -= 4;\n\t\tr1 = CLAMP(ip[4]); wp[4] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = CLAMP(ip[5]); wp[5] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = CLAMP(ip[6]); wp[6] = (uint16)((b1-b2) & mask); b2 = b1;\n\t\ta1 = CLAMP(ip[7]); wp[7] = (uint16)((a1-a2) & mask); a2 = a1;\n\t\twp += 4;\n \t\tip += 4;\n \t }\n \t} else {\n REPEAT(stride, wp[0] = CLAMP(ip[0]); wp++; ip++)\n n -= stride;\n while (n > 0) {\n REPEAT(stride,\n wp[0] = (uint16)((CLAMP(ip[0])-CLAMP(ip[-stride])) & mask);\n wp++; ip++)\n n -= stride;\n }\n }\n }\n }\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-079#1-f5b73f1c28f1", + "input": " def redirect(self, url, **kwargs):\n \"\"\"Explicitly converts url to 'str', because webapp2.RequestHandler.redirect\n strongly requires 'str' but url might be an unicode string.\"\"\"\n super(Handler, self).redirect(str(url), **kwargs)", + "target": " def redirect(self, url, **kwargs):\n \"\"\"Explicitly converts url to 'str', because webapp2.RequestHandler.redirect\n strongly requires 'str' but url might be an unicode string.\"\"\"\n url = str(url)\n check_redirect_url(url)\n super(Handler, self).redirect(url, **kwargs)", + "vul_type": "cwe-079", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#55136969558bd7d8b3456cd1447442a5425fd9df", + "input": "void DisplayItemList::removeLastDisplayItem()\n{\n if (m_newDisplayItems.isEmpty())\n return;\n\n#if ENABLE(ASSERT)\n DisplayItemIndicesByClientMap::iterator it = m_newDisplayItemIndicesByClient.find(m_newDisplayItems.last().client());\n if (it != m_newDisplayItemIndicesByClient.end()) {\n Vector& indices = it->value;\n if (!indices.isEmpty() && indices.last() == (m_newDisplayItems.size() - 1))\n indices.removeLast();\n }\n #endif\n m_newDisplayItems.removeLast();\n }\n", + "target": "void DisplayItemList::removeLastDisplayItem()\n{\n if (m_newDisplayItems.isEmpty())\n return;\n\n#if ENABLE(ASSERT)\n DisplayItemIndicesByClientMap::iterator it = m_newDisplayItemIndicesByClient.find(m_newDisplayItems.last().client());\n if (it != m_newDisplayItemIndicesByClient.end()) {\n Vector& indices = it->value;\n if (!indices.isEmpty() && indices.last() == (m_newDisplayItems.size() - 1))\n indices.removeLast();\n }\n #endif\n m_newDisplayItems.removeLast();\n\n if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())\n m_newPaintChunks.decrementDisplayItemIndex();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#983bda1f0fa5fa86884381208274198a620f006e", + "input": " int CLASS ljpeg_start (struct jhead *jh, int info_only)\n {\n int c, tag, len;\n uchar data[0x10000];\n const uchar *dp;\n \n memset (jh, 0, sizeof *jh);\n jh->restart = INT_MAX;\n fread (data, 2, 1, ifp);\n if (data[1] != 0xd8) return 0;\n do {\n fread (data, 2, 2, ifp);\n tag = data[0] << 8 | data[1];\n len = (data[2] << 8 | data[3]) - 2;\n if (tag <= 0xff00) return 0;\n fread (data, 1, len, ifp);\n switch (tag) {\n case 0xffc3:\n\tjh->sraw = ((data[7] >> 4) * (data[7] & 15) - 1) & 3;\n case 0xffc0:\n\tjh->bits = data[0];\n\tjh->high = data[1] << 8 | data[2];\n\tjh->wide = data[3] << 8 | data[4];\n\tjh->clrs = data[5] + jh->sraw;\n\tif (len == 9 && !dng_version) getc(ifp);\n\tbreak;\n case 0xffc4:\n\tif (info_only) break;\n\tfor (dp = data; dp < data+len && (c = *dp++) < 4; )\n\t jh->free[c] = jh->huff[c] = make_decoder_ref (&dp);\n\tbreak;\n case 0xffda:\n\tjh->psv = data[1+data[0]*2];\n\tjh->bits -= data[3+data[0]*2] & 15;\n\tbreak;\n case 0xffdd:\n\tjh->restart = data[0] << 8 | data[1];\n }\n } while (tag != 0xffda);\n if (info_only) return 1;\n FORC(5) if (!jh->huff[c+1]) jh->huff[c+1] = jh->huff[c];\n if (jh->sraw) {\n FORC(4) jh->huff[2+c] = jh->huff[1];\n FORC(jh->sraw) jh->huff[1+c] = jh->huff[0];\n }\n jh->row = (ushort *) calloc (jh->wide*jh->clrs, 4);\n merror (jh->row, \"ljpeg_start()\");\n return zero_after_ff = 1;\n}\n", + "target": " int CLASS ljpeg_start (struct jhead *jh, int info_only)\n {\n int c, tag;\n ushort len;\n uchar data[0x10000];\n const uchar *dp;\n \n memset (jh, 0, sizeof *jh);\n jh->restart = INT_MAX;\n fread (data, 2, 1, ifp);\n if (data[1] != 0xd8) return 0;\n do {\n fread (data, 2, 2, ifp);\n tag = data[0] << 8 | data[1];\n len = (data[2] << 8 | data[3]) - 2;\n if (tag <= 0xff00) return 0;\n fread (data, 1, len, ifp);\n switch (tag) {\n case 0xffc3:\n\tjh->sraw = ((data[7] >> 4) * (data[7] & 15) - 1) & 3;\n case 0xffc0:\n\tjh->bits = data[0];\n\tjh->high = data[1] << 8 | data[2];\n\tjh->wide = data[3] << 8 | data[4];\n\tjh->clrs = data[5] + jh->sraw;\n\tif (len == 9 && !dng_version) getc(ifp);\n\tbreak;\n case 0xffc4:\n\tif (info_only) break;\n\tfor (dp = data; dp < data+len && (c = *dp++) < 4; )\n\t jh->free[c] = jh->huff[c] = make_decoder_ref (&dp);\n\tbreak;\n case 0xffda:\n\tjh->psv = data[1+data[0]*2];\n\tjh->bits -= data[3+data[0]*2] & 15;\n\tbreak;\n case 0xffdd:\n\tjh->restart = data[0] << 8 | data[1];\n }\n } while (tag != 0xffda);\n if (info_only) return 1;\n FORC(5) if (!jh->huff[c+1]) jh->huff[c+1] = jh->huff[c];\n if (jh->sraw) {\n FORC(4) jh->huff[2+c] = jh->huff[1];\n FORC(jh->sraw) jh->huff[1+c] = jh->huff[0];\n }\n jh->row = (ushort *) calloc (jh->wide*jh->clrs, 4);\n merror (jh->row, \"ljpeg_start()\");\n return zero_after_ff = 1;\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e9372a1bfd3588a80fcf49aa07321f0971dd6091", + "input": "v8::Handle V8WebGLRenderingContext::getUniformCallback(const v8::Arguments& args)\n{\n INC_STATS(\"DOM.WebGLRenderingContext.getUniform()\");\n \n if (args.Length() != 2)\n return V8Proxy::throwNotEnoughArgumentsError();\n \n ExceptionCode ec = 0;\n WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());\n if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0])) {\n V8Proxy::throwTypeError();\n return notHandledByInterceptor();\n }\n WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle::Cast(args[0])) : 0;\n\n if (args.Length() > 1 && !isUndefinedOrNull(args[1]) && !V8WebGLUniformLocation::HasInstance(args[1])) {\n V8Proxy::throwTypeError();\n return notHandledByInterceptor();\n }\n bool ok = false;\n WebGLUniformLocation* location = toWebGLUniformLocation(args[1], ok);\n\n WebGLGetInfo info = context->getUniform(program, location, ec);\n if (ec) {\n V8Proxy::setDOMException(ec, args.GetIsolate());\n return v8::Undefined();\n }\n return toV8Object(info, args.GetIsolate());\n}\n", + "target": "v8::Handle V8WebGLRenderingContext::getUniformCallback(const v8::Arguments& args)\n{\n INC_STATS(\"DOM.WebGLRenderingContext.getUniform()\");\n \n if (args.Length() != 2)\n return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());\n \n ExceptionCode ec = 0;\n WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());\n if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0])) {\n V8Proxy::throwTypeError();\n return notHandledByInterceptor();\n }\n WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle::Cast(args[0])) : 0;\n\n if (args.Length() > 1 && !isUndefinedOrNull(args[1]) && !V8WebGLUniformLocation::HasInstance(args[1])) {\n V8Proxy::throwTypeError();\n return notHandledByInterceptor();\n }\n bool ok = false;\n WebGLUniformLocation* location = toWebGLUniformLocation(args[1], ok);\n\n WebGLGetInfo info = context->getUniform(program, location, ec);\n if (ec) {\n V8Proxy::setDOMException(ec, args.GetIsolate());\n return v8::Undefined();\n }\n return toV8Object(info, args.GetIsolate());\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fcd3a7a671ecf2d5f46ea34787d27507a914d2f5", + "input": "void SyncManager::SyncInternal::UpdateEnabledTypes() {\n DCHECK(thread_checker_.CalledOnValidThread());\n ModelSafeRoutingInfo routes;\n registrar_->GetModelSafeRoutingInfo(&routes);\n const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes);\n sync_notifier_->UpdateEnabledTypes(enabled_types);\n if (enable_sync_tabs_for_other_clients_)\n MaybeSetSyncTabsInNigoriNode(enabled_types);\n}\n", + "target": "void SyncManager::SyncInternal::UpdateEnabledTypes() {\n DCHECK(thread_checker_.CalledOnValidThread());\n ModelSafeRoutingInfo routes;\n registrar_->GetModelSafeRoutingInfo(&routes);\n const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes);\n sync_notifier_->UpdateEnabledTypes(enabled_types);\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b69f2292063d2caf37ca9aec7d63ded203701bf3", + "input": "void exit_io_context(void)\n {\n \tstruct io_context *ioc;\n \n\ttask_lock(current);\n\tioc = current->io_context;\n\tcurrent->io_context = NULL;\n\ttask_unlock(current);\n \n \tif (atomic_dec_and_test(&ioc->nr_tasks)) {\n \t\tif (ioc->aic && ioc->aic->exit)\n\t\t\tioc->aic->exit(ioc->aic);\n\t\tcfq_exit(ioc);\n\n\t}\n\tput_io_context(ioc);\n}\n", + "target": "void exit_io_context(void)\nvoid exit_io_context(struct task_struct *task)\n {\n \tstruct io_context *ioc;\n \n\ttask_lock(task);\n\tioc = task->io_context;\n\ttask->io_context = NULL;\n\ttask_unlock(task);\n \n \tif (atomic_dec_and_test(&ioc->nr_tasks)) {\n \t\tif (ioc->aic && ioc->aic->exit)\n\t\t\tioc->aic->exit(ioc->aic);\n\t\tcfq_exit(ioc);\n\n\t}\n\tput_io_context(ioc);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4d17163f4b66be517dc49019a029e5ddbd45078c", + "input": "void StyleResolver::matchUARules(ElementRuleCollector& collector)\n {\n collector.setMatchingUARules(true);\n \n if (CSSDefaultStyleSheets::simpleDefaultStyleSheet)\n collector.matchedResult().isCacheable = false;\n RuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific(\"print\")\n ? CSSDefaultStyleSheets::defaultPrintStyle : CSSDefaultStyleSheets::defaultStyle;\n matchUARules(collector, userAgentStyleSheet);\n\n if (document().inQuirksMode())\n matchUARules(collector, CSSDefaultStyleSheets::defaultQuirksStyle);\n\n if (document().isViewSource())\n matchUARules(collector, CSSDefaultStyleSheets::viewSourceStyle());\n\n collector.setMatchingUARules(false);\n\n matchWatchSelectorRules(collector);\n}\n", + "target": "void StyleResolver::matchUARules(ElementRuleCollector& collector)\n {\n collector.setMatchingUARules(true);\n \n RuleSet* userAgentStyleSheet = m_medium->mediaTypeMatchSpecific(\"print\")\n ? CSSDefaultStyleSheets::defaultPrintStyle : CSSDefaultStyleSheets::defaultStyle;\n matchUARules(collector, userAgentStyleSheet);\n\n if (document().inQuirksMode())\n matchUARules(collector, CSSDefaultStyleSheets::defaultQuirksStyle);\n\n if (document().isViewSource())\n matchUARules(collector, CSSDefaultStyleSheets::viewSourceStyle());\n\n collector.setMatchingUARules(false);\n\n matchWatchSelectorRules(collector);\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d", + "input": "void CuePoint::TrackPosition::Parse(IMkvReader* pReader, long long start_,\n long long size_) {\n const long long stop = start_ + size_;\n long long pos = start_;\n\n m_track = -1;\n m_pos = -1;\n m_block = 1; // default\n\n\n while (pos < stop) {\n long len;\n \n const long long id = ReadUInt(pReader, pos, len);\n assert(id >= 0); // TODO\n assert((pos + len) <= stop);\n \n pos += len; // consume ID\n \n const long long size = ReadUInt(pReader, pos, len);\n assert(size >= 0);\n assert((pos + len) <= stop);\n \n pos += len; // consume Size field\n assert((pos + size) <= stop);\n \n if (id == 0x77) // CueTrack ID\n m_track = UnserializeUInt(pReader, pos, size);\n\n else if (id == 0x71) // CueClusterPos ID\n m_pos = UnserializeUInt(pReader, pos, size);\n\n else if (id == 0x1378) // CueBlockNumber\n\n m_block = UnserializeUInt(pReader, pos, size);\n \n pos += size; // consume payload\n assert(pos <= stop);\n }\n \n assert(m_pos >= 0);\n assert(m_track > 0);\n }\n", + "target": "void CuePoint::TrackPosition::Parse(IMkvReader* pReader, long long start_,\nbool CuePoint::TrackPosition::Parse(IMkvReader* pReader, long long start_,\n long long size_) {\n const long long stop = start_ + size_;\n long long pos = start_;\n\n m_track = -1;\n m_pos = -1;\n m_block = 1; // default\n\n\n while (pos < stop) {\n long len;\n \n const long long id = ReadID(pReader, pos, len);\n if ((id < 0) || ((pos + len) > stop)) {\n return false;\n }\n \n pos += len; // consume ID\n \n const long long size = ReadUInt(pReader, pos, len);\n if ((size < 0) || ((pos + len) > stop)) {\n return false;\n }\n \n pos += len; // consume Size field\n if ((pos + size) > stop) {\n return false;\n }\n \n if (id == 0x77) // CueTrack ID\n m_track = UnserializeUInt(pReader, pos, size);\n\n else if (id == 0x71) // CueClusterPos ID\n m_pos = UnserializeUInt(pReader, pos, size);\n\n else if (id == 0x1378) // CueBlockNumber\n\n m_block = UnserializeUInt(pReader, pos, size);\n \n pos += size; // consume payload\n }\n \n if ((m_pos < 0) || (m_track <= 0)) {\n return false;\n }\n\n return true;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4dca6ea1d9432052afb06baf2e3ae78188a4410b", + "input": "static void construct_get_dest_keyring(struct key **_dest_keyring)\n {\n \tstruct request_key_auth *rka;\n \tconst struct cred *cred = current_cred();\n \tstruct key *dest_keyring = *_dest_keyring, *authkey;\n \n \tkenter(\"%p\", dest_keyring);\n \n\t/* find the appropriate keyring */\n\tif (dest_keyring) {\n \t\t/* the caller supplied one */\n \t\tkey_get(dest_keyring);\n \t} else {\n \t\t/* use a default keyring; falling through the cases until we\n \t\t * find one that we actually have */\n \t\tswitch (cred->jit_keyring) {\n\t\tcase KEY_REQKEY_DEFL_DEFAULT:\n\t\tcase KEY_REQKEY_DEFL_REQUESTOR_KEYRING:\n\t\t\tif (cred->request_key_auth) {\n\t\t\t\tauthkey = cred->request_key_auth;\n\t\t\t\tdown_read(&authkey->sem);\n\t\t\t\trka = authkey->payload.data[0];\n\t\t\t\tif (!test_bit(KEY_FLAG_REVOKED,\n\t\t\t\t\t &authkey->flags))\n \t\t\t\t\tdest_keyring =\n \t\t\t\t\t\tkey_get(rka->dest_keyring);\n \t\t\t\tup_read(&authkey->sem);\n\t\t\t\tif (dest_keyring)\n \t\t\t\t\tbreak;\n \t\t\t}\n \n \t\tcase KEY_REQKEY_DEFL_THREAD_KEYRING:\n\t\t\tdest_keyring = key_get(cred->thread_keyring);\n\t\t\tif (dest_keyring)\n\t\t\t\tbreak;\n\n\t\tcase KEY_REQKEY_DEFL_PROCESS_KEYRING:\n\t\t\tdest_keyring = key_get(cred->process_keyring);\n\t\t\tif (dest_keyring)\n\t\t\t\tbreak;\n\n\t\tcase KEY_REQKEY_DEFL_SESSION_KEYRING:\n\t\t\trcu_read_lock();\n\t\t\tdest_keyring = key_get(\n\t\t\t\trcu_dereference(cred->session_keyring));\n\t\t\trcu_read_unlock();\n\n\t\t\tif (dest_keyring)\n\t\t\t\tbreak;\n\n\t\tcase KEY_REQKEY_DEFL_USER_SESSION_KEYRING:\n\t\t\tdest_keyring =\n\t\t\t\tkey_get(cred->user->session_keyring);\n\t\t\tbreak;\n\n\t\tcase KEY_REQKEY_DEFL_USER_KEYRING:\n\t\t\tdest_keyring = key_get(cred->user->uid_keyring);\n\t\t\tbreak;\n\n\t\tcase KEY_REQKEY_DEFL_GROUP_KEYRING:\n \t\tdefault:\n \t\t\tBUG();\n \t\t}\n \t}\n \n \t*_dest_keyring = dest_keyring;\n \tkleave(\" [dk %d]\", key_serial(dest_keyring));\n\treturn;\n }\n", + "target": "static void construct_get_dest_keyring(struct key **_dest_keyring)\nstatic int construct_get_dest_keyring(struct key **_dest_keyring)\n {\n \tstruct request_key_auth *rka;\n \tconst struct cred *cred = current_cred();\n \tstruct key *dest_keyring = *_dest_keyring, *authkey;\n\tint ret;\n \n \tkenter(\"%p\", dest_keyring);\n \n\t/* find the appropriate keyring */\n\tif (dest_keyring) {\n \t\t/* the caller supplied one */\n \t\tkey_get(dest_keyring);\n \t} else {\n\t\tbool do_perm_check = true;\n\n \t\t/* use a default keyring; falling through the cases until we\n \t\t * find one that we actually have */\n \t\tswitch (cred->jit_keyring) {\n\t\tcase KEY_REQKEY_DEFL_DEFAULT:\n\t\tcase KEY_REQKEY_DEFL_REQUESTOR_KEYRING:\n\t\t\tif (cred->request_key_auth) {\n\t\t\t\tauthkey = cred->request_key_auth;\n\t\t\t\tdown_read(&authkey->sem);\n\t\t\t\trka = authkey->payload.data[0];\n\t\t\t\tif (!test_bit(KEY_FLAG_REVOKED,\n\t\t\t\t\t &authkey->flags))\n \t\t\t\t\tdest_keyring =\n \t\t\t\t\t\tkey_get(rka->dest_keyring);\n \t\t\t\tup_read(&authkey->sem);\n\t\t\t\tif (dest_keyring) {\n\t\t\t\t\tdo_perm_check = false;\n \t\t\t\t\tbreak;\n\t\t\t\t}\n \t\t\t}\n \n \t\tcase KEY_REQKEY_DEFL_THREAD_KEYRING:\n\t\t\tdest_keyring = key_get(cred->thread_keyring);\n\t\t\tif (dest_keyring)\n\t\t\t\tbreak;\n\n\t\tcase KEY_REQKEY_DEFL_PROCESS_KEYRING:\n\t\t\tdest_keyring = key_get(cred->process_keyring);\n\t\t\tif (dest_keyring)\n\t\t\t\tbreak;\n\n\t\tcase KEY_REQKEY_DEFL_SESSION_KEYRING:\n\t\t\trcu_read_lock();\n\t\t\tdest_keyring = key_get(\n\t\t\t\trcu_dereference(cred->session_keyring));\n\t\t\trcu_read_unlock();\n\n\t\t\tif (dest_keyring)\n\t\t\t\tbreak;\n\n\t\tcase KEY_REQKEY_DEFL_USER_SESSION_KEYRING:\n\t\t\tdest_keyring =\n\t\t\t\tkey_get(cred->user->session_keyring);\n\t\t\tbreak;\n\n\t\tcase KEY_REQKEY_DEFL_USER_KEYRING:\n\t\t\tdest_keyring = key_get(cred->user->uid_keyring);\n\t\t\tbreak;\n\n\t\tcase KEY_REQKEY_DEFL_GROUP_KEYRING:\n \t\tdefault:\n \t\t\tBUG();\n \t\t}\n\n\t\t/*\n\t\t * Require Write permission on the keyring. This is essential\n\t\t * because the default keyring may be the session keyring, and\n\t\t * joining a keyring only requires Search permission.\n\t\t *\n\t\t * However, this check is skipped for the \"requestor keyring\" so\n\t\t * that /sbin/request-key can itself use request_key() to add\n\t\t * keys to the original requestor's destination keyring.\n\t\t */\n\t\tif (dest_keyring && do_perm_check) {\n\t\t\tret = key_permission(make_key_ref(dest_keyring, 1),\n\t\t\t\t\t KEY_NEED_WRITE);\n\t\t\tif (ret) {\n\t\t\t\tkey_put(dest_keyring);\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t}\n \t}\n \n \t*_dest_keyring = dest_keyring;\n \tkleave(\" [dk %d]\", key_serial(dest_keyring));\n\treturn 0;\n }\n", + "vul_type": "cwe-862", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#db5523bcb7e0419955172709c241a188ab94e8e0", + "input": "PP_InputEvent_Type ConvertEventTypes(WebInputEvent::Type wetype) {\n switch (wetype) {\n case WebInputEvent::MouseDown:\n return PP_INPUTEVENT_TYPE_MOUSEDOWN;\n case WebInputEvent::MouseUp:\n return PP_INPUTEVENT_TYPE_MOUSEUP;\n case WebInputEvent::MouseMove:\n return PP_INPUTEVENT_TYPE_MOUSEMOVE;\n case WebInputEvent::MouseEnter:\n return PP_INPUTEVENT_TYPE_MOUSEENTER;\n case WebInputEvent::MouseLeave:\n return PP_INPUTEVENT_TYPE_MOUSELEAVE;\n case WebInputEvent::MouseWheel:\n return PP_INPUTEVENT_TYPE_MOUSEWHEEL;\n case WebInputEvent::RawKeyDown:\n return PP_INPUTEVENT_TYPE_RAWKEYDOWN;\n case WebInputEvent::KeyDown:\n return PP_INPUTEVENT_TYPE_KEYDOWN;\n case WebInputEvent::KeyUp:\n return PP_INPUTEVENT_TYPE_KEYUP;\n case WebInputEvent::Char:\n return PP_INPUTEVENT_TYPE_CHAR;\n case WebInputEvent::Undefined:\n default:\n return PP_INPUTEVENT_TYPE_UNDEFINED;\n }\n}\n", + "target": "PP_InputEvent_Type ConvertEventTypes(WebInputEvent::Type wetype) {\n switch (wetype) {\n case WebInputEvent::MouseDown:\n return PP_INPUTEVENT_TYPE_MOUSEDOWN;\n case WebInputEvent::MouseUp:\n return PP_INPUTEVENT_TYPE_MOUSEUP;\n case WebInputEvent::MouseMove:\n return PP_INPUTEVENT_TYPE_MOUSEMOVE;\n case WebInputEvent::MouseEnter:\n return PP_INPUTEVENT_TYPE_MOUSEENTER;\n case WebInputEvent::MouseLeave:\n return PP_INPUTEVENT_TYPE_MOUSELEAVE;\n case WebInputEvent::ContextMenu:\n return PP_INPUTEVENT_TYPE_CONTEXTMENU;\n case WebInputEvent::MouseWheel:\n return PP_INPUTEVENT_TYPE_MOUSEWHEEL;\n case WebInputEvent::RawKeyDown:\n return PP_INPUTEVENT_TYPE_RAWKEYDOWN;\n case WebInputEvent::KeyDown:\n return PP_INPUTEVENT_TYPE_KEYDOWN;\n case WebInputEvent::KeyUp:\n return PP_INPUTEVENT_TYPE_KEYUP;\n case WebInputEvent::Char:\n return PP_INPUTEVENT_TYPE_CHAR;\n case WebInputEvent::Undefined:\n default:\n return PP_INPUTEVENT_TYPE_UNDEFINED;\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ea3d1d84be3d6f97bf50e76511c9e26af6895533", + "input": " void WebPluginDelegateStub::OnDidFinishLoadWithReason(\n const GURL& url, int reason, intptr_t notify_data) {\n delegate_->DidFinishLoadWithReason(url, reason, notify_data);\n }\n", + "target": " void WebPluginDelegateStub::OnDidFinishLoadWithReason(\n const GURL& url, int reason, int notify_id) {\n delegate_->DidFinishLoadWithReason(url, reason, notify_id);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ff82911cd3f69f028f2537825c9720ff78bc3f19", + "input": "ssize_t nbd_wr_syncv(QIOChannel *ioc,\n struct iovec *iov,\n size_t niov,\n size_t length,\n bool do_read)\n{\n ssize_t done = 0;\n Error *local_err = NULL;\n struct iovec *local_iov = g_new(struct iovec, niov);\n struct iovec *local_iov_head = local_iov;\n unsigned int nlocal_iov = niov;\n\n nlocal_iov = iov_copy(local_iov, nlocal_iov, iov, niov, 0, length);\n\n while (nlocal_iov > 0) {\n ssize_t len;\n if (do_read) {\n len = qio_channel_readv(ioc, local_iov, nlocal_iov, &local_err);\n } else {\n len = qio_channel_writev(ioc, local_iov, nlocal_iov, &local_err);\n }\n if (len == QIO_CHANNEL_ERR_BLOCK) {\n if (qemu_in_coroutine()) {\n /* XXX figure out if we can create a variant on\n * qio_channel_yield() that works with AIO contexts\n * and consider using that in this branch */\n qemu_coroutine_yield();\n } else if (done) {\n /* XXX this is needed by nbd_reply_ready. */\n qio_channel_wait(ioc,\n do_read ? G_IO_IN : G_IO_OUT);\n } else {\n return -EAGAIN;\n }\n } else if (done) {\n /* XXX this is needed by nbd_reply_ready. */\n qio_channel_wait(ioc,\n do_read ? G_IO_IN : G_IO_OUT);\n } else {\n return -EAGAIN;\n }\n continue;\n }\n if (len < 0) {\n TRACE(\"I/O error: %s\", error_get_pretty(local_err));\n error_free(local_err);\n /* XXX handle Error objects */\n done = -EIO;\n goto cleanup;\n }\n\n if (do_read && len == 0) {\n break;\n }\n\n iov_discard_front(&local_iov, &nlocal_iov, len);\n done += len;\n }\n", + "target": "ssize_t nbd_wr_syncv(QIOChannel *ioc,\n struct iovec *iov,\n size_t niov,\n size_t length,\n bool do_read)\n{\n ssize_t done = 0;\n Error *local_err = NULL;\n struct iovec *local_iov = g_new(struct iovec, niov);\n struct iovec *local_iov_head = local_iov;\n unsigned int nlocal_iov = niov;\n\n nlocal_iov = iov_copy(local_iov, nlocal_iov, iov, niov, 0, length);\n\n while (nlocal_iov > 0) {\n ssize_t len;\n if (do_read) {\n len = qio_channel_readv(ioc, local_iov, nlocal_iov, &local_err);\n } else {\n len = qio_channel_writev(ioc, local_iov, nlocal_iov, &local_err);\n }\n if (len == QIO_CHANNEL_ERR_BLOCK) {\n if (qemu_in_coroutine()) {\n qio_channel_yield(ioc, do_read ? G_IO_IN : G_IO_OUT);\n } else {\n return -EAGAIN;\n }\n } else if (done) {\n /* XXX this is needed by nbd_reply_ready. */\n qio_channel_wait(ioc,\n do_read ? G_IO_IN : G_IO_OUT);\n } else {\n return -EAGAIN;\n }\n continue;\n }\n if (len < 0) {\n TRACE(\"I/O error: %s\", error_get_pretty(local_err));\n error_free(local_err);\n /* XXX handle Error objects */\n done = -EIO;\n goto cleanup;\n }\n\n if (do_read && len == 0) {\n break;\n }\n\n iov_discard_front(&local_iov, &nlocal_iov, len);\n done += len;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e49d943e9f5f90411313e64d0ae6b646edc85043", + "input": "CachedDocumentParameters::CachedDocumentParameters(Document* document)\n{\n ASSERT(isMainThread());\n ASSERT(document);\n doHtmlPreloadScanning = !document->settings() || document->settings()->doHtmlPreloadScanning();\n doDocumentWritePreloadScanning = doHtmlPreloadScanning && document->frame() && document->frame()->isMainFrame();\n defaultViewportMinWidth = document->viewportDefaultMinWidth();\n viewportMetaZeroValuesQuirk = document->settings() && document->settings()->viewportMetaZeroValuesQuirk();\n viewportMetaEnabled = document->settings() && document->settings()->viewportMetaEnabled();\n referrerPolicy = ReferrerPolicyDefault;\n }\n", + "target": "CachedDocumentParameters::CachedDocumentParameters(Document* document)\n{\n ASSERT(isMainThread());\n ASSERT(document);\n doHtmlPreloadScanning = !document->settings() || document->settings()->doHtmlPreloadScanning();\n doDocumentWritePreloadScanning = doHtmlPreloadScanning && document->frame() && document->frame()->isMainFrame();\n defaultViewportMinWidth = document->viewportDefaultMinWidth();\n viewportMetaZeroValuesQuirk = document->settings() && document->settings()->viewportMetaZeroValuesQuirk();\n viewportMetaEnabled = document->settings() && document->settings()->viewportMetaEnabled();\n referrerPolicy = document->getReferrerPolicy();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#363b02dab09b3226f3bd1420dad9c72b79a42a76", + "input": "void big_key_revoke(struct key *key)\n{\n\tstruct path *path = (struct path *)&key->payload.data[big_key_path];\n \n \t/* clear the quota */\n \tkey_payload_reserve(key, 0);\n\tif (key_is_instantiated(key) &&\n \t (size_t)key->payload.data[big_key_len] > BIG_KEY_FILE_THRESHOLD)\n \t\tvfs_truncate(path, 0);\n }\n", + "target": "void big_key_revoke(struct key *key)\n{\n\tstruct path *path = (struct path *)&key->payload.data[big_key_path];\n \n \t/* clear the quota */\n \tkey_payload_reserve(key, 0);\n\tif (key_is_positive(key) &&\n \t (size_t)key->payload.data[big_key_len] > BIG_KEY_FILE_THRESHOLD)\n \t\tvfs_truncate(path, 0);\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long long BlockGroup::GetPrevTimeCode() const\n{\n return m_prev;\n}\n", + "target": "long long BlockGroup::GetPrevTimeCode() const\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1e5479084bc9852854feb1ba9bf68b52cd127e02", + "input": "static void ctrycatchfinally(JF, js_Ast *trystm, js_Ast *catchvar, js_Ast *catchstm, js_Ast *finallystm)\n{\n\tint L1, L2, L3;\n\tL1 = emitjump(J, F, OP_TRY);\n\t{\n\t\t/* if we get here, we have caught an exception in the try block */\n\t\tL2 = emitjump(J, F, OP_TRY);\n\t\t{\n\t\t\t/* if we get here, we have caught an exception in the catch block */\n\t\t\tcstm(J, F, finallystm); /* inline finally block */\n\t\t\temit(J, F, OP_THROW); /* rethrow exception */\n\t\t}\n\t\tlabel(J, F, L2);\n\t\tif (F->strict) {\n\t\t\tcheckfutureword(J, F, catchvar);\n\t\t\tif (!strcmp(catchvar->string, \"arguments\"))\n\t\t\t\tjsC_error(J, catchvar, \"redefining 'arguments' is not allowed in strict mode\");\n\t\t\tif (!strcmp(catchvar->string, \"eval\"))\n\t\t\t\tjsC_error(J, catchvar, \"redefining 'eval' is not allowed in strict mode\");\n\t\t}\n\t\temitline(J, F, catchvar);\n \t\temitstring(J, F, OP_CATCH, catchvar->string);\n \t\tcstm(J, F, catchstm);\n \t\temit(J, F, OP_ENDCATCH);\n \t\tL3 = emitjump(J, F, OP_JUMP); /* skip past the try block to the finally block */\n \t}\n \tlabel(J, F, L1);\n\tcstm(J, F, trystm);\n\temit(J, F, OP_ENDTRY);\n\tlabel(J, F, L3);\n\tcstm(J, F, finallystm);\n}\n", + "target": "static void ctrycatchfinally(JF, js_Ast *trystm, js_Ast *catchvar, js_Ast *catchstm, js_Ast *finallystm)\n{\n\tint L1, L2, L3;\n\tL1 = emitjump(J, F, OP_TRY);\n\t{\n\t\t/* if we get here, we have caught an exception in the try block */\n\t\tL2 = emitjump(J, F, OP_TRY);\n\t\t{\n\t\t\t/* if we get here, we have caught an exception in the catch block */\n\t\t\tcstm(J, F, finallystm); /* inline finally block */\n\t\t\temit(J, F, OP_THROW); /* rethrow exception */\n\t\t}\n\t\tlabel(J, F, L2);\n\t\tif (F->strict) {\n\t\t\tcheckfutureword(J, F, catchvar);\n\t\t\tif (!strcmp(catchvar->string, \"arguments\"))\n\t\t\t\tjsC_error(J, catchvar, \"redefining 'arguments' is not allowed in strict mode\");\n\t\t\tif (!strcmp(catchvar->string, \"eval\"))\n\t\t\t\tjsC_error(J, catchvar, \"redefining 'eval' is not allowed in strict mode\");\n\t\t}\n\t\temitline(J, F, catchvar);\n \t\temitstring(J, F, OP_CATCH, catchvar->string);\n \t\tcstm(J, F, catchstm);\n \t\temit(J, F, OP_ENDCATCH);\n\t\temit(J, F, OP_ENDTRY);\n \t\tL3 = emitjump(J, F, OP_JUMP); /* skip past the try block to the finally block */\n \t}\n \tlabel(J, F, L1);\n\tcstm(J, F, trystm);\n\temit(J, F, OP_ENDTRY);\n\tlabel(J, F, L3);\n\tcstm(J, F, finallystm);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-022#5-cd467764fc9b", + "input": "def _get_settings(view):\n return {\n 'linters': get_settings(view, 'anaconda_go_linters', []),\n 'lint_test': get_settings(\n view, 'anaconda_go_lint_test', False),\n 'exclude_regexps': get_settings(\n view, 'anaconda_go_exclude_regexps', []),\n 'max_line_length': get_settings(\n view, 'anaconda_go_max_line_length', 120),\n 'gocyclo_threshold': get_settings(\n view, 'anaconda_go_gocyclo_threshold', 10),\n 'golint_min_confidence': get_settings(\n view, 'anaconda_go_golint_min_confidence', 0.80),\n 'goconst_min_occurrences': get_settings(\n view, 'anaconda_go_goconst_min_occurrences', 3),\n 'min_const_length': get_settings(\n view, 'anaconda_go_min_const_length', 3),\n 'dupl_threshold': get_settings(\n view, 'anaconda_go_dupl_threshold', 50),\n 'path': get_working_directory(view)\n }", + "target": "def _get_settings(view):\n return {\n 'linters': get_settings(view, 'anaconda_go_linters', []),\n 'lint_test': get_settings(\n view, 'anaconda_go_lint_test', False),\n 'exclude_regexps': get_settings(\n view, 'anaconda_go_exclude_regexps', []),\n 'max_line_length': get_settings(\n view, 'anaconda_go_max_line_length', 120),\n 'gocyclo_threshold': get_settings(\n view, 'anaconda_go_gocyclo_threshold', 10),\n 'golint_min_confidence': get_settings(\n view, 'anaconda_go_golint_min_confidence', 0.80),\n 'goconst_min_occurrences': get_settings(\n view, 'anaconda_go_goconst_min_occurrences', 3),\n 'min_const_length': get_settings(\n view, 'anaconda_go_min_const_length', 3),\n 'dupl_threshold': get_settings(\n view, 'anaconda_go_dupl_threshold', 50),\n 'path': os.path.dirname(view.file_name())\n }", + "vul_type": "cwe-022", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#295c883fe3105b19bcd0f9e07d54c6b589fc5bff", + "input": "OMX_ERRORTYPE SoftAACEncoder2::internalGetParameter(\n OMX_INDEXTYPE index, OMX_PTR params) {\n switch (index) {\n case OMX_IndexParamAudioPortFormat:\n {\n\n OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =\n (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;\n \n if (formatParams->nPortIndex > 1) {\n return OMX_ErrorUndefined;\n }\n\n if (formatParams->nIndex > 0) {\n return OMX_ErrorNoMore;\n }\n\n formatParams->eEncoding =\n (formatParams->nPortIndex == 0)\n ? OMX_AUDIO_CodingPCM : OMX_AUDIO_CodingAAC;\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioAac:\n {\n\n OMX_AUDIO_PARAM_AACPROFILETYPE *aacParams =\n (OMX_AUDIO_PARAM_AACPROFILETYPE *)params;\n \n if (aacParams->nPortIndex != 1) {\n return OMX_ErrorUndefined;\n }\n\n aacParams->nBitRate = mBitRate;\n aacParams->nAudioBandWidth = 0;\n aacParams->nAACtools = 0;\n aacParams->nAACERtools = 0;\n aacParams->eAACProfile = (OMX_AUDIO_AACPROFILETYPE) mAACProfile;\n aacParams->eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4FF;\n aacParams->eChannelMode = OMX_AUDIO_ChannelModeStereo;\n\n aacParams->nChannels = mNumChannels;\n aacParams->nSampleRate = mSampleRate;\n aacParams->nFrameLength = 0;\n\n switch (mSBRMode) {\n case 1: // sbr on\n switch (mSBRRatio) {\n case 0:\n aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidSSBR;\n aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidDSBR;\n break;\n case 1:\n aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidSSBR;\n aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidDSBR;\n break;\n case 2:\n aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidSSBR;\n aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidDSBR;\n break;\n default:\n ALOGE(\"invalid SBR ratio %d\", mSBRRatio);\n TRESPASS();\n }\n break;\n case 0: // sbr off\n case -1: // sbr undefined\n aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidSSBR;\n aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidDSBR;\n break;\n default:\n ALOGE(\"invalid SBR mode %d\", mSBRMode);\n TRESPASS();\n }\n\n\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioPcm:\n {\n\n OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =\n (OMX_AUDIO_PARAM_PCMMODETYPE *)params;\n \n if (pcmParams->nPortIndex != 0) {\n return OMX_ErrorUndefined;\n }\n\n pcmParams->eNumData = OMX_NumericalDataSigned;\n pcmParams->eEndian = OMX_EndianBig;\n pcmParams->bInterleaved = OMX_TRUE;\n pcmParams->nBitPerSample = 16;\n pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear;\n pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelLF;\n pcmParams->eChannelMapping[1] = OMX_AUDIO_ChannelRF;\n\n pcmParams->nChannels = mNumChannels;\n pcmParams->nSamplingRate = mSampleRate;\n\n return OMX_ErrorNone;\n }\n\n default:\n return SimpleSoftOMXComponent::internalGetParameter(index, params);\n }\n}\n", + "target": "OMX_ERRORTYPE SoftAACEncoder2::internalGetParameter(\n OMX_INDEXTYPE index, OMX_PTR params) {\n switch (index) {\n case OMX_IndexParamAudioPortFormat:\n {\n\n OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =\n (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;\n \n if (!isValidOMXParam(formatParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (formatParams->nPortIndex > 1) {\n return OMX_ErrorUndefined;\n }\n\n if (formatParams->nIndex > 0) {\n return OMX_ErrorNoMore;\n }\n\n formatParams->eEncoding =\n (formatParams->nPortIndex == 0)\n ? OMX_AUDIO_CodingPCM : OMX_AUDIO_CodingAAC;\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioAac:\n {\n\n OMX_AUDIO_PARAM_AACPROFILETYPE *aacParams =\n (OMX_AUDIO_PARAM_AACPROFILETYPE *)params;\n \n if (!isValidOMXParam(aacParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (aacParams->nPortIndex != 1) {\n return OMX_ErrorUndefined;\n }\n\n aacParams->nBitRate = mBitRate;\n aacParams->nAudioBandWidth = 0;\n aacParams->nAACtools = 0;\n aacParams->nAACERtools = 0;\n aacParams->eAACProfile = (OMX_AUDIO_AACPROFILETYPE) mAACProfile;\n aacParams->eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4FF;\n aacParams->eChannelMode = OMX_AUDIO_ChannelModeStereo;\n\n aacParams->nChannels = mNumChannels;\n aacParams->nSampleRate = mSampleRate;\n aacParams->nFrameLength = 0;\n\n switch (mSBRMode) {\n case 1: // sbr on\n switch (mSBRRatio) {\n case 0:\n aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidSSBR;\n aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidDSBR;\n break;\n case 1:\n aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidSSBR;\n aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidDSBR;\n break;\n case 2:\n aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidSSBR;\n aacParams->nAACtools |= OMX_AUDIO_AACToolAndroidDSBR;\n break;\n default:\n ALOGE(\"invalid SBR ratio %d\", mSBRRatio);\n TRESPASS();\n }\n break;\n case 0: // sbr off\n case -1: // sbr undefined\n aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidSSBR;\n aacParams->nAACtools &= ~OMX_AUDIO_AACToolAndroidDSBR;\n break;\n default:\n ALOGE(\"invalid SBR mode %d\", mSBRMode);\n TRESPASS();\n }\n\n\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioPcm:\n {\n\n OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =\n (OMX_AUDIO_PARAM_PCMMODETYPE *)params;\n \n if (!isValidOMXParam(pcmParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (pcmParams->nPortIndex != 0) {\n return OMX_ErrorUndefined;\n }\n\n pcmParams->eNumData = OMX_NumericalDataSigned;\n pcmParams->eEndian = OMX_EndianBig;\n pcmParams->bInterleaved = OMX_TRUE;\n pcmParams->nBitPerSample = 16;\n pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear;\n pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelLF;\n pcmParams->eChannelMapping[1] = OMX_AUDIO_ChannelRF;\n\n pcmParams->nChannels = mNumChannels;\n pcmParams->nSamplingRate = mSampleRate;\n\n return OMX_ErrorNone;\n }\n\n default:\n return SimpleSoftOMXComponent::internalGetParameter(index, params);\n }\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#78d89fe556cb5dabbc47b4967cdf55e607e29580", + "input": "bool AcceleratedStaticBitmapImage::CopyToTexture(\n gpu::gles2::GLES2Interface* dest_gl,\n GLenum dest_target,\n GLuint dest_texture_id,\n bool unpack_premultiply_alpha,\n bool unpack_flip_y,\n const IntPoint& dest_point,\n const IntRect& source_sub_rectangle) {\n CheckThread();\n if (!IsValid())\n return false;\n DCHECK(texture_holder_->IsCrossThread() ||\n dest_gl != ContextProviderWrapper()->ContextProvider()->ContextGL());\n\n EnsureMailbox(kUnverifiedSyncToken, GL_NEAREST);\n\n dest_gl->WaitSyncTokenCHROMIUM(\n texture_holder_->GetSyncToken().GetConstData());\n GLuint source_texture_id = dest_gl->CreateAndConsumeTextureCHROMIUM(\n texture_holder_->GetMailbox().name);\n dest_gl->CopySubTextureCHROMIUM(\n source_texture_id, 0, dest_target, dest_texture_id, 0, dest_point.X(),\n dest_point.Y(), source_sub_rectangle.X(), source_sub_rectangle.Y(),\n source_sub_rectangle.Width(), source_sub_rectangle.Height(),\n unpack_flip_y ? GL_FALSE : GL_TRUE, GL_FALSE,\n unpack_premultiply_alpha ? GL_FALSE : GL_TRUE);\n dest_gl->DeleteTextures(1, &source_texture_id);\n\n gpu::SyncToken sync_token;\n dest_gl->GenUnverifiedSyncTokenCHROMIUM(sync_token.GetData());\n texture_holder_->UpdateSyncToken(sync_token);\n\n return true;\n}\n", + "target": "bool AcceleratedStaticBitmapImage::CopyToTexture(\n gpu::gles2::GLES2Interface* dest_gl,\n GLenum dest_target,\n GLuint dest_texture_id,\n bool unpack_premultiply_alpha,\n bool unpack_flip_y,\n const IntPoint& dest_point,\n const IntRect& source_sub_rectangle) {\n DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);\n if (!IsValid())\n return false;\n DCHECK(texture_holder_->IsCrossThread() ||\n dest_gl != ContextProviderWrapper()->ContextProvider()->ContextGL());\n\n EnsureMailbox(kUnverifiedSyncToken, GL_NEAREST);\n\n dest_gl->WaitSyncTokenCHROMIUM(\n texture_holder_->GetSyncToken().GetConstData());\n GLuint source_texture_id = dest_gl->CreateAndConsumeTextureCHROMIUM(\n texture_holder_->GetMailbox().name);\n dest_gl->CopySubTextureCHROMIUM(\n source_texture_id, 0, dest_target, dest_texture_id, 0, dest_point.X(),\n dest_point.Y(), source_sub_rectangle.X(), source_sub_rectangle.Y(),\n source_sub_rectangle.Width(), source_sub_rectangle.Height(),\n unpack_flip_y ? GL_FALSE : GL_TRUE, GL_FALSE,\n unpack_premultiply_alpha ? GL_FALSE : GL_TRUE);\n dest_gl->DeleteTextures(1, &source_texture_id);\n\n gpu::SyncToken sync_token;\n dest_gl->GenUnverifiedSyncTokenCHROMIUM(sync_token.GetData());\n texture_holder_->UpdateSyncToken(sync_token);\n\n return true;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#16-887d1e8b6c0a", + "input": " @staticmethod\n def _check_camera_tags(tags):\n \"\"\"\n Function that convert stupid code name of a smartphone or camera\n from EXIF to meaningful one by looking a collation in a special MySQL\n table For example instead of just Nikon there can be\n NIKON CORPORATION in EXIF\n\n :param tags: name of a camera and lens from EXIF\n :return: list with one or two strings which are name of\n camera and/or lens. If there is not better name for the gadget\n in database, function just returns name how it is\n \"\"\"\n checked_tags = []\n\n for tag in tags:\n if tag: # If there was this information inside EXIF of the photo\n tag = str(tag).strip()\n log.info('Looking up collation for %s', tag)\n query = ('SELECT right_tag '\n 'FROM tag_table '\n 'WHERE wrong_tag=\"{}\"'.format(tag))\n cursor = db.execute_query(query)\n if not cursor:\n log.error(\"Can't check the tag because of the db error\")\n log.warning(\"Tag will stay as is.\")\n continue\n if cursor.rowcount:\n # Get appropriate tag from the table\n tag = cursor.fetchone()[0]\n log.info('Tag after looking up in tag_tables - %s.', tag)\n\n checked_tags.append(tag)\n return checked_tags", + "target": " @staticmethod\n def _check_camera_tags(tags):\n \"\"\"\n Function that convert stupid code name of a smartphone or camera\n from EXIF to meaningful one by looking a collation in a special MySQL\n table For example instead of just Nikon there can be\n NIKON CORPORATION in EXIF\n\n :param tags: name of a camera and lens from EXIF\n :return: list with one or two strings which are name of\n camera and/or lens. If there is not better name for the gadget\n in database, function just returns name how it is\n \"\"\"\n checked_tags = []\n\n for tag in tags:\n if tag: # If there was this information inside EXIF of the photo\n tag = str(tag).strip()\n log.info('Looking up collation for %s', tag)\n query = ('SELECT right_tag '\n 'FROM tag_table '\n 'WHERE wrong_tag=%s')\n parameters = tag,\n cursor = db.execute_query(query, parameters)\n if not cursor:\n log.error(\"Can't check the tag because of the db error\")\n log.warning(\"Tag will stay as is.\")\n continue\n if cursor.rowcount:\n # Get appropriate tag from the table\n tag = cursor.fetchone()[0]\n log.info('Tag after looking up in tag_tables - %s.', tag)\n\n checked_tags.append(tag)\n return checked_tags", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#b9a41d21dceadf8104812626ef85dc56ee8a60ed", + "input": "struct mapped_device *dm_get_from_kobject(struct kobject *kobj)\n{\n\tstruct mapped_device *md;\n \n \tmd = container_of(kobj, struct mapped_device, kobj_holder.kobj);\n \n\tif (test_bit(DMF_FREEING, &md->flags) ||\n\t dm_deleting_md(md))\n\t\treturn NULL;\n \tdm_get(md);\n \treturn md;\n }\n", + "target": "struct mapped_device *dm_get_from_kobject(struct kobject *kobj)\n{\n\tstruct mapped_device *md;\n \n \tmd = container_of(kobj, struct mapped_device, kobj_holder.kobj);\n \n\tspin_lock(&_minor_lock);\n\tif (test_bit(DMF_FREEING, &md->flags) || dm_deleting_md(md)) {\n\t\tmd = NULL;\n\t\tgoto out;\n\t}\n \tdm_get(md);\nout:\n\tspin_unlock(&_minor_lock);\n\n \treturn md;\n }\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0773bb9303d24473fe1185d85a424dfe159aff53", + "input": "static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)\n{\n\tfreerdp_peer* client = (freerdp_peer*) extra;\n\trdpRdp* rdp = client->context->rdp;\n\n\tswitch (rdp->state)\n\t{\n\t\tcase CONNECTION_STATE_INITIAL:\n\t\t\tif (!rdp_server_accept_nego(rdp, s))\n\t\t\t\treturn -1;\n\n\t\t\tif (rdp->nego->selected_protocol & PROTOCOL_NLA)\n\t\t\t{\n \t\t\t\tsspi_CopyAuthIdentity(&client->identity, &(rdp->nego->transport->credssp->identity));\n \t\t\t\tIFCALLRET(client->Logon, client->authenticated, client, &client->identity, TRUE);\n \t\t\t\tcredssp_free(rdp->nego->transport->credssp);\n \t\t\t}\n \t\t\telse\n \t\t\t{\n\t\t\t\tIFCALLRET(client->Logon, client->authenticated, client, &client->identity, FALSE);\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_NEGO:\n\t\t\tif (!rdp_server_accept_mcs_connect_initial(rdp, s))\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_MCS_CONNECT:\n\t\t\tif (!rdp_server_accept_mcs_erect_domain_request(rdp, s))\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_MCS_ERECT_DOMAIN:\n\t\t\tif (!rdp_server_accept_mcs_attach_user_request(rdp, s))\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_MCS_ATTACH_USER:\n\t\t\tif (!rdp_server_accept_mcs_channel_join_request(rdp, s))\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_MCS_CHANNEL_JOIN:\n\t\t\tif (rdp->settings->DisableEncryption)\n\t\t\t{\n\t\t\t\tif (!rdp_server_accept_client_keys(rdp, s))\n\t\t\t\t\treturn -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\trdp->state = CONNECTION_STATE_ESTABLISH_KEYS;\n\t\t\t/* FALLTHROUGH */\n\n\t\tcase CONNECTION_STATE_ESTABLISH_KEYS:\n\t\t\tif (!rdp_server_accept_client_info(rdp, s))\n\t\t\t\treturn -1;\n\n\t\t\tIFCALL(client->Capabilities, client);\n\n\t\t\tif (!rdp_send_demand_active(rdp))\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_LICENSE:\n\t\t\tif (!rdp_server_accept_confirm_active(rdp, s))\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * During reactivation sequence the client might sent some input or channel data\n\t\t\t\t * before receiving the Deactivate All PDU. We need to process them as usual.\n\t\t\t\t */\n\t\t\t\tStream_SetPosition(s, 0);\n\t\t\t\treturn peer_recv_pdu(client, s);\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_ACTIVE:\n\t\t\tif (peer_recv_pdu(client, s) < 0)\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tfprintf(stderr, \"Invalid state %d\\n\", rdp->state);\n\t\t\treturn -1;\n\t}\n\n\treturn 0;\n}\n", + "target": "static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)\n{\n\tfreerdp_peer* client = (freerdp_peer*) extra;\n\trdpRdp* rdp = client->context->rdp;\n\n\tswitch (rdp->state)\n\t{\n\t\tcase CONNECTION_STATE_INITIAL:\n\t\t\tif (!rdp_server_accept_nego(rdp, s))\n\t\t\t\treturn -1;\n\n\t\t\tif (rdp->nego->selected_protocol & PROTOCOL_NLA)\n\t\t\t{\n \t\t\t\tsspi_CopyAuthIdentity(&client->identity, &(rdp->nego->transport->credssp->identity));\n \t\t\t\tIFCALLRET(client->Logon, client->authenticated, client, &client->identity, TRUE);\n \t\t\t\tcredssp_free(rdp->nego->transport->credssp);\n\t\t\t\trdp->nego->transport->credssp = NULL;\n \t\t\t}\n \t\t\telse\n \t\t\t{\n\t\t\t\tIFCALLRET(client->Logon, client->authenticated, client, &client->identity, FALSE);\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_NEGO:\n\t\t\tif (!rdp_server_accept_mcs_connect_initial(rdp, s))\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_MCS_CONNECT:\n\t\t\tif (!rdp_server_accept_mcs_erect_domain_request(rdp, s))\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_MCS_ERECT_DOMAIN:\n\t\t\tif (!rdp_server_accept_mcs_attach_user_request(rdp, s))\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_MCS_ATTACH_USER:\n\t\t\tif (!rdp_server_accept_mcs_channel_join_request(rdp, s))\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_MCS_CHANNEL_JOIN:\n\t\t\tif (rdp->settings->DisableEncryption)\n\t\t\t{\n\t\t\t\tif (!rdp_server_accept_client_keys(rdp, s))\n\t\t\t\t\treturn -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\trdp->state = CONNECTION_STATE_ESTABLISH_KEYS;\n\t\t\t/* FALLTHROUGH */\n\n\t\tcase CONNECTION_STATE_ESTABLISH_KEYS:\n\t\t\tif (!rdp_server_accept_client_info(rdp, s))\n\t\t\t\treturn -1;\n\n\t\t\tIFCALL(client->Capabilities, client);\n\n\t\t\tif (!rdp_send_demand_active(rdp))\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_LICENSE:\n\t\t\tif (!rdp_server_accept_confirm_active(rdp, s))\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * During reactivation sequence the client might sent some input or channel data\n\t\t\t\t * before receiving the Deactivate All PDU. We need to process them as usual.\n\t\t\t\t */\n\t\t\t\tStream_SetPosition(s, 0);\n\t\t\t\treturn peer_recv_pdu(client, s);\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase CONNECTION_STATE_ACTIVE:\n\t\t\tif (peer_recv_pdu(client, s) < 0)\n\t\t\t\treturn -1;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tfprintf(stderr, \"Invalid state %d\\n\", rdp->state);\n\t\t\treturn -1;\n\t}\n\n\treturn 0;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e93dc535728da259ec16d1c3cc393f80b25f64ae", + "input": "bool OSExchangeDataProviderWin::GetPickledData(\n const OSExchangeData::CustomFormat& format,\n Pickle* data) const {\n DCHECK(data);\n bool success = false;\n STGMEDIUM medium;\n FORMATETC format_etc = format.ToFormatEtc();\n if (SUCCEEDED(source_object_->GetData(&format_etc, &medium))) {\n if (medium.tymed & TYMED_HGLOBAL) {\n base::win::ScopedHGlobal c_data(medium.hGlobal);\n DCHECK_GT(c_data.Size(), 0u);\n *data = Pickle(c_data.get(), static_cast(c_data.Size()));\n success = true;\n }\n ReleaseStgMedium(&medium);\n }\n return success;\n}\n", + "target": "bool OSExchangeDataProviderWin::GetPickledData(\n const OSExchangeData::CustomFormat& format,\n Pickle* data) const {\n DCHECK(data);\n bool success = false;\n STGMEDIUM medium;\n FORMATETC format_etc = format.ToFormatEtc();\n if (SUCCEEDED(source_object_->GetData(&format_etc, &medium))) {\n if (medium.tymed & TYMED_HGLOBAL) {\n base::win::ScopedHGlobal c_data(medium.hGlobal);\n DCHECK_GT(c_data.Size(), 0u);\n *data = Pickle(c_data.get(), static_cast(c_data.Size()));\n success = true;\n }\n ReleaseStgMedium(&medium);\n }\n return success;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#65000a7fd9eea62359e6d6714f17b94a99a82edd", + "input": " void grubfs_free (GrubFS *gf) {\n \tif (gf) {\n\t\tif (gf->file && gf->file->device)\n \t\t\tfree (gf->file->device->disk);\n \t\tfree (gf->file);\n \t\tfree (gf);\n\t}\n}\n", + "target": " void grubfs_free (GrubFS *gf) {\n \tif (gf) {\n\t\tif (gf->file && gf->file->device) {\n \t\t\tfree (gf->file->device->disk);\n\t\t}\n \t\tfree (gf->file);\n \t\tfree (gf);\n\t}\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2e02cfe89cbffc8a0bc1bdaee9efe930fd55e376", + "input": "bool ParamTraits::Read(const Message* m, PickleIterator* iter,\n param_type* r) {\n const char *data;\n int data_size = 0;\n bool result = m->ReadData(iter, &data, &data_size);\n if (result && data_size == sizeof(LOGFONT)) {\n memcpy(r, data, sizeof(LOGFONT));\n } else {\n result = false;\n NOTREACHED();\n }\n \n return result;\n }\n", + "target": "bool ParamTraits::Read(const Message* m, PickleIterator* iter,\n param_type* r) {\n const char *data;\n int data_size = 0;\n if (m->ReadData(iter, &data, &data_size) && data_size == sizeof(LOGFONT)) {\n const LOGFONT *font = reinterpret_cast(const_cast(data));\n if (_tcsnlen(font->lfFaceName, LF_FACESIZE) < LF_FACESIZE) {\n memcpy(r, data, sizeof(LOGFONT));\n return true;\n }\n }\n \n NOTREACHED();\n return false;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8f3a9a68b2dcdd2c54cf49a41ad34729ab576702", + "input": " bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) {\n const content::NavigationEntry* entry =\n source->GetController().GetActiveEntry();\n if (entry) {\n const GURL& url = entry->GetURL();\n const GURL& virtual_url = entry->GetVirtualURL();\n if ((url.SchemeIs(content::kChromeUIScheme) &&\n url.host_piece() == chrome::kChromeUINewTabHost) ||\n (virtual_url.SchemeIs(content::kChromeUIScheme) &&\n virtual_url.host_piece() == chrome::kChromeUINewTabHost)) {\n return true;\n }\n }\n\n return search::NavEntryIsInstantNTP(source, entry);\n}\n", + "target": " bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) {\n // Navigations in background tabs shouldn't change the focus state of the\n // omnibox, since it's associated with the foreground tab.\n if (source != tab_strip_model_->GetActiveWebContents())\n return false;\n\n const content::NavigationEntry* entry =\n source->GetController().GetActiveEntry();\n if (entry) {\n const GURL& url = entry->GetURL();\n const GURL& virtual_url = entry->GetVirtualURL();\n if ((url.SchemeIs(content::kChromeUIScheme) &&\n url.host_piece() == chrome::kChromeUINewTabHost) ||\n (virtual_url.SchemeIs(content::kChromeUIScheme) &&\n virtual_url.host_piece() == chrome::kChromeUINewTabHost)) {\n return true;\n }\n }\n\n return search::NavEntryIsInstantNTP(source, entry);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#baef1ffd73db183ca50c854e1779ed7f6e5100a8", + "input": " void SetUpCacheWithVariousFiles() {\n CreateFile(persistent_directory_.AppendASCII(\"id_foo.md5foo\"));\n CreateFile(persistent_directory_.AppendASCII(\"id_bar.local\"));\n CreateFile(persistent_directory_.AppendASCII(\"id_baz.local\"));\n CreateFile(persistent_directory_.AppendASCII(\"id_bad.md5bad\"));\n CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull),\n persistent_directory_.AppendASCII(\"id_symlink\"));\n CreateFile(tmp_directory_.AppendASCII(\"id_qux.md5qux\"));\n CreateFile(tmp_directory_.AppendASCII(\"id_quux.local\"));\n CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull),\n tmp_directory_.AppendASCII(\"id_symlink_tmp\"));\n CreateSymbolicLink(persistent_directory_.AppendASCII(\"id_foo.md5foo\"),\n pinned_directory_.AppendASCII(\"id_foo\"));\n CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull),\n pinned_directory_.AppendASCII(\"id_corge\"));\n CreateSymbolicLink(persistent_directory_.AppendASCII(\"id_dangling.md5foo\"),\n pinned_directory_.AppendASCII(\"id_dangling\"));\n CreateSymbolicLink(tmp_directory_.AppendASCII(\"id_qux.md5qux\"),\n pinned_directory_.AppendASCII(\"id_outside\"));\n CreateFile(pinned_directory_.AppendASCII(\"id_not_symlink\"));\n CreateSymbolicLink(persistent_directory_.AppendASCII(\"id_bar.local\"),\n outgoing_directory_.AppendASCII(\"id_bar\"));\n CreateSymbolicLink(persistent_directory_.AppendASCII(\"id_foo.md5foo\"),\n outgoing_directory_.AppendASCII(\"id_foo\"));\n }\n", + "target": " void SetUpCacheWithVariousFiles() {\n std::vector empty_cache_paths;\n metadata_->Initialize(empty_cache_paths);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3c8e4852477d5b1e2da877808c998dc57db9460f", + "input": "void NetworkHandler::GetResponseBodyForInterception(\n const String& interception_id,\n std::unique_ptr callback) {\n DevToolsInterceptorController* interceptor =\n DevToolsInterceptorController::FromBrowserContext(\n process_->GetBrowserContext());\n if (!interceptor) {\n callback->sendFailure(Response::InternalError());\n return;\n }\n interceptor->GetResponseBody(interception_id, std::move(callback));\n}\n", + "target": "void NetworkHandler::GetResponseBodyForInterception(\n const String& interception_id,\n std::unique_ptr callback) {\n DevToolsInterceptorController* interceptor =\n DevToolsInterceptorController::FromBrowserContext(browser_context_);\n if (!interceptor) {\n callback->sendFailure(Response::InternalError());\n return;\n }\n interceptor->GetResponseBody(interception_id, std::move(callback));\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8f363b77ee4fbf7c3bbcf5ec2c5ca482d396d664", + "input": "static void tcp_illinois_info(struct sock *sk, u32 ext,\n\t\t\t struct sk_buff *skb)\n{\n\tconst struct illinois *ca = inet_csk_ca(sk);\n\n\tif (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {\n\t\tstruct tcpvegas_info info = {\n\t\t\t.tcpv_enabled = 1,\n \t\t\t.tcpv_rttcnt = ca->cnt_rtt,\n \t\t\t.tcpv_minrtt = ca->base_rtt,\n \t\t};\n\t\tu64 t = ca->sum_rtt;\n \n\t\tdo_div(t, ca->cnt_rtt);\n\t\tinfo.tcpv_rtt = t;\n \n \t\tnla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);\n \t}\n }\n", + "target": "static void tcp_illinois_info(struct sock *sk, u32 ext,\n\t\t\t struct sk_buff *skb)\n{\n\tconst struct illinois *ca = inet_csk_ca(sk);\n\n\tif (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {\n\t\tstruct tcpvegas_info info = {\n\t\t\t.tcpv_enabled = 1,\n \t\t\t.tcpv_rttcnt = ca->cnt_rtt,\n \t\t\t.tcpv_minrtt = ca->base_rtt,\n \t\t};\n \n\t\tif (info.tcpv_rttcnt > 0) {\n\t\t\tu64 t = ca->sum_rtt;\n \n\t\t\tdo_div(t, info.tcpv_rttcnt);\n\t\t\tinfo.tcpv_rtt = t;\n\t\t}\n \t\tnla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);\n \t}\n }\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ab5e55ff333def909d025ac45da9ffa0d88a63f2", + "input": "RTCPeerConnectionHandler::~RTCPeerConnectionHandler()\n{\n}\n", + "target": "RTCPeerConnectionHandler::~RTCPeerConnectionHandler()\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0fb75f1e468fe9054be3b3d3d5b9bf9a66e4199d", + "input": " Win32StackFrameUnwinder::Win32StackFrameUnwinder()\n : Win32StackFrameUnwinder(&win32_unwind_functions_) {\n }\n", + "target": " Win32StackFrameUnwinder::Win32StackFrameUnwinder()\n : Win32StackFrameUnwinder(make_scoped_ptr(new Win32UnwindFunctions)) {\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d1a59e4e845a01d7d7b80ef184b672752a9eae4d", + "input": "void RenderViewImpl::OnPostMessageEvent(\n const ViewMsg_PostMessage_Params& params) {\n WebFrame* frame = FindFrameByID(webview()->mainFrame(),\n params.target_frame_id);\n if (!frame)\n return;\n\n WebFrame* source_frame = NULL;\n if (params.source_routing_id != MSG_ROUTING_NONE) {\n RenderViewImpl* source_view = FromRoutingID(params.source_routing_id);\n if (source_view)\n source_frame = source_view->GetFrameByMappedID(params.source_frame_id);\n }\n \n WebDOMEvent event = frame->document().createEvent(\"MessageEvent\");\n WebDOMMessageEvent msg_event = event.to();\n msg_event.initMessageEvent(\"message\",\n false, false,\n WebSerializedScriptValue::fromString(params.data),\n params.source_origin, source_frame, \"\");\n\n WebSecurityOrigin target_origin;\n if (!params.target_origin.empty()) {\n target_origin =\n WebSecurityOrigin::createFromString(WebString(params.target_origin));\n }\n frame->dispatchMessageEventWithOriginCheck(target_origin, msg_event);\n}\n", + "target": "void RenderViewImpl::OnPostMessageEvent(\n const ViewMsg_PostMessage_Params& params) {\n WebFrame* frame = FindFrameByID(webview()->mainFrame(),\n params.target_frame_id);\n if (!frame)\n return;\n\n WebFrame* source_frame = NULL;\n if (params.source_routing_id != MSG_ROUTING_NONE) {\n RenderViewImpl* source_view = FromRoutingID(params.source_routing_id);\n if (source_view)\n source_frame = source_view->GetFrameByRemoteID(params.source_frame_id);\n }\n \n WebDOMEvent event = frame->document().createEvent(\"MessageEvent\");\n WebDOMMessageEvent msg_event = event.to();\n msg_event.initMessageEvent(\"message\",\n false, false,\n WebSerializedScriptValue::fromString(params.data),\n params.source_origin, source_frame, \"\");\n\n WebSecurityOrigin target_origin;\n if (!params.target_origin.empty()) {\n target_origin =\n WebSecurityOrigin::createFromString(WebString(params.target_origin));\n }\n frame->dispatchMessageEventWithOriginCheck(target_origin, msg_event);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#56f7b1bc95a2a3eeb420e069e7655fb181ade5cf", + "input": "gss_complete_auth_token (OM_uint32 *minor_status,\n\t const gss_ctx_id_t context_handle,\n\t gss_buffer_t input_message_buffer)\n{\n OM_uint32\t\tstatus;\n gss_union_ctx_id_t\tctx;\n gss_mechanism\tmech;\n\n if (context_handle == GSS_C_NO_CONTEXT)\n\treturn GSS_S_NO_CONTEXT;\n\n /*\n * select the approprate underlying mechanism routine and\n * call it.\n */\n \n ctx = (gss_union_ctx_id_t) context_handle;\n mech = gssint_get_mechanism (ctx->mech_type);\n \n if (mech != NULL) {\n\tif (mech->gss_complete_auth_token != NULL) {\n\t status = mech->gss_complete_auth_token(minor_status,\n\t\t\t\t\t\t ctx->internal_ctx_id,\n\t\t\t\t\t\t input_message_buffer);\n\t if (status != GSS_S_COMPLETE)\n\t\tmap_error(minor_status, mech);\n\t} else\n\t status = GSS_S_COMPLETE;\n } else\n\tstatus = GSS_S_BAD_MECH;\n\n return status;\n}\n", + "target": "gss_complete_auth_token (OM_uint32 *minor_status,\n\t const gss_ctx_id_t context_handle,\n\t gss_buffer_t input_message_buffer)\n{\n OM_uint32\t\tstatus;\n gss_union_ctx_id_t\tctx;\n gss_mechanism\tmech;\n\n if (context_handle == GSS_C_NO_CONTEXT)\n\treturn GSS_S_NO_CONTEXT;\n\n /*\n * select the approprate underlying mechanism routine and\n * call it.\n */\n \n ctx = (gss_union_ctx_id_t) context_handle;\n if (ctx->internal_ctx_id == GSS_C_NO_CONTEXT)\n\treturn GSS_S_NO_CONTEXT;\n mech = gssint_get_mechanism (ctx->mech_type);\n \n if (mech != NULL) {\n\tif (mech->gss_complete_auth_token != NULL) {\n\t status = mech->gss_complete_auth_token(minor_status,\n\t\t\t\t\t\t ctx->internal_ctx_id,\n\t\t\t\t\t\t input_message_buffer);\n\t if (status != GSS_S_COMPLETE)\n\t\tmap_error(minor_status, mech);\n\t} else\n\t status = GSS_S_COMPLETE;\n } else\n\tstatus = GSS_S_BAD_MECH;\n\n return status;\n}\n", + "vul_type": "cwe-415", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c9f838d104fed6f2f61d68164712e3204bf5271b", + "input": " int install_process_keyring_to_cred(struct cred *new)\n {\n \tstruct key *keyring;\n \n \tif (new->process_keyring)\n\t\treturn -EEXIST;\n \n \tkeyring = keyring_alloc(\"_pid\", new->uid, new->gid, new,\n \t\t\t\tKEY_POS_ALL | KEY_USR_VIEW,\n\t\t\t\tKEY_ALLOC_QUOTA_OVERRUN,\n\t\t\t\tNULL, NULL);\n\tif (IS_ERR(keyring))\n\t\treturn PTR_ERR(keyring);\n\n\tnew->process_keyring = keyring;\n\treturn 0;\n }\n", + "target": " int install_process_keyring_to_cred(struct cred *new)\n {\n \tstruct key *keyring;\n \n \tif (new->process_keyring)\n\t\treturn 0;\n \n \tkeyring = keyring_alloc(\"_pid\", new->uid, new->gid, new,\n \t\t\t\tKEY_POS_ALL | KEY_USR_VIEW,\n\t\t\t\tKEY_ALLOC_QUOTA_OVERRUN,\n\t\t\t\tNULL, NULL);\n\tif (IS_ERR(keyring))\n\t\treturn PTR_ERR(keyring);\n\n\tnew->process_keyring = keyring;\n\treturn 0;\n }\n", + "vul_type": "cwe-404", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#08f0d612f2a4039aaf6733d4e8d0a67614941378", + "input": "void Browser::TabDetachedAtImpl(TabContentsWrapper* contents, int index,\n DetachType type) {\n if (type == DETACH_TYPE_DETACH) {\n if (contents == GetSelectedTabContentsWrapper())\n window_->GetLocationBar()->SaveStateToContents(contents->tab_contents());\n\n if (!tab_handler_->GetTabStripModel()->closing_all())\n SyncHistoryWithTabs(0);\n }\n\n contents->tab_contents()->set_delegate(NULL);\n RemoveScheduledUpdatesFor(contents->tab_contents());\n\n if (find_bar_controller_.get() &&\n index == tab_handler_->GetTabStripModel()->selected_index()) {\n find_bar_controller_->ChangeTabContents(NULL);\n }\n \n registrar_.Remove(this, NotificationType::TAB_CONTENTS_DISCONNECTED,\n Source(contents));\n }\n", + "target": "void Browser::TabDetachedAtImpl(TabContentsWrapper* contents, int index,\n DetachType type) {\n if (type == DETACH_TYPE_DETACH) {\n if (contents == GetSelectedTabContentsWrapper())\n window_->GetLocationBar()->SaveStateToContents(contents->tab_contents());\n\n if (!tab_handler_->GetTabStripModel()->closing_all())\n SyncHistoryWithTabs(0);\n }\n\n contents->tab_contents()->set_delegate(NULL);\n RemoveScheduledUpdatesFor(contents->tab_contents());\n\n if (find_bar_controller_.get() &&\n index == tab_handler_->GetTabStripModel()->selected_index()) {\n find_bar_controller_->ChangeTabContents(NULL);\n }\n \n if (is_attempting_to_close_browser_) {\n // If this is the last tab with unload handlers, then ProcessPendingTabs\n // would call back into the TabStripModel (which is invoking this method on\n // us). Avoid that by passing in false so that the call to\n // ProcessPendingTabs is delayed.\n ClearUnloadState(contents->tab_contents(), false);\n }\n\n registrar_.Remove(this, NotificationType::TAB_CONTENTS_DISCONNECTED,\n Source(contents));\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#124d3b7041f9a0ca7c43a6293e1cae4576c32fd5", + "input": "static ssize_t generic_perform_write(struct file *file,\n\t\t\t\tstruct iov_iter *i, loff_t pos)\n{\n\tstruct address_space *mapping = file->f_mapping;\n\tconst struct address_space_operations *a_ops = mapping->a_ops;\n\tlong status = 0;\n\tssize_t written = 0;\n\tunsigned int flags = 0;\n\n\t/*\n\t * Copies from kernel address space cannot fail (NFSD is a big user).\n\t */\n\tif (segment_eq(get_fs(), KERNEL_DS))\n\t\tflags |= AOP_FLAG_UNINTERRUPTIBLE;\n\n\tdo {\n\t\tstruct page *page;\n\t\tpgoff_t index;\t\t/* Pagecache index for current page */\n\t\tunsigned long offset;\t/* Offset into pagecache page */\n\t\tunsigned long bytes;\t/* Bytes to write to page */\n\t\tsize_t copied;\t\t/* Bytes copied from user */\n\t\tvoid *fsdata;\n\n\t\toffset = (pos & (PAGE_CACHE_SIZE - 1));\n\t\tindex = pos >> PAGE_CACHE_SHIFT;\n\t\tbytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,\n\t\t\t\t\t\tiov_iter_count(i));\n\nagain:\n\n\t\t/*\n\t\t * Bring in the user page that we will copy from _first_.\n\t\t * Otherwise there's a nasty deadlock on copying from the\n\t\t * same page as we're writing to, without it being marked\n\t\t * up-to-date.\n\t\t *\n\t\t * Not only is this an optimisation, but it is also required\n\t\t * to check that the address is actually valid, when atomic\n\t\t * usercopies are used, below.\n\t\t */\n\t\tif (unlikely(iov_iter_fault_in_readable(i, bytes))) {\n\t\t\tstatus = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\n\t\tstatus = a_ops->write_begin(file, mapping, pos, bytes, flags,\n\t\t\t\t\t\t&page, &fsdata);\n\t\tif (unlikely(status))\n\t\t\tbreak;\n\n\t\tpagefault_disable();\n\t\tcopied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);\n\t\tpagefault_enable();\n\t\tflush_dcache_page(page);\n\n\t\tstatus = a_ops->write_end(file, mapping, pos, bytes, copied,\n\t\t\t\t\t\tpage, fsdata);\n\t\tif (unlikely(status < 0))\n\t\t\tbreak;\n\t\tcopied = status;\n \n \t\tcond_resched();\n \n \t\tif (unlikely(copied == 0)) {\n \t\t\t/*\n \t\t\t * If we were unable to copy any data at all, we must\n\t\t\t * fall back to a single segment length write.\n\t\t\t *\n\t\t\t * If we didn't fallback here, we could livelock\n\t\t\t * because not all segments in the iov can be copied at\n\t\t\t * once without a pagefault.\n\t\t\t */\n\t\t\tbytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,\n \t\t\t\t\t\tiov_iter_single_seg_count(i));\n \t\t\tgoto again;\n \t\t}\n\t\tiov_iter_advance(i, copied);\n \t\tpos += copied;\n \t\twritten += copied;\n \n\t\tbalance_dirty_pages_ratelimited(mapping);\n\n\t} while (iov_iter_count(i));\n\n\treturn written ? written : status;\n}\n", + "target": "static ssize_t generic_perform_write(struct file *file,\n\t\t\t\tstruct iov_iter *i, loff_t pos)\n{\n\tstruct address_space *mapping = file->f_mapping;\n\tconst struct address_space_operations *a_ops = mapping->a_ops;\n\tlong status = 0;\n\tssize_t written = 0;\n\tunsigned int flags = 0;\n\n\t/*\n\t * Copies from kernel address space cannot fail (NFSD is a big user).\n\t */\n\tif (segment_eq(get_fs(), KERNEL_DS))\n\t\tflags |= AOP_FLAG_UNINTERRUPTIBLE;\n\n\tdo {\n\t\tstruct page *page;\n\t\tpgoff_t index;\t\t/* Pagecache index for current page */\n\t\tunsigned long offset;\t/* Offset into pagecache page */\n\t\tunsigned long bytes;\t/* Bytes to write to page */\n\t\tsize_t copied;\t\t/* Bytes copied from user */\n\t\tvoid *fsdata;\n\n\t\toffset = (pos & (PAGE_CACHE_SIZE - 1));\n\t\tindex = pos >> PAGE_CACHE_SHIFT;\n\t\tbytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,\n\t\t\t\t\t\tiov_iter_count(i));\n\nagain:\n\n\t\t/*\n\t\t * Bring in the user page that we will copy from _first_.\n\t\t * Otherwise there's a nasty deadlock on copying from the\n\t\t * same page as we're writing to, without it being marked\n\t\t * up-to-date.\n\t\t *\n\t\t * Not only is this an optimisation, but it is also required\n\t\t * to check that the address is actually valid, when atomic\n\t\t * usercopies are used, below.\n\t\t */\n\t\tif (unlikely(iov_iter_fault_in_readable(i, bytes))) {\n\t\t\tstatus = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\n\t\tstatus = a_ops->write_begin(file, mapping, pos, bytes, flags,\n\t\t\t\t\t\t&page, &fsdata);\n\t\tif (unlikely(status))\n\t\t\tbreak;\n\n\t\tpagefault_disable();\n\t\tcopied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);\n\t\tpagefault_enable();\n\t\tflush_dcache_page(page);\n\n\t\tstatus = a_ops->write_end(file, mapping, pos, bytes, copied,\n\t\t\t\t\t\tpage, fsdata);\n\t\tif (unlikely(status < 0))\n\t\t\tbreak;\n\t\tcopied = status;\n \n \t\tcond_resched();\n \n\t\tiov_iter_advance(i, copied);\n \t\tif (unlikely(copied == 0)) {\n \t\t\t/*\n \t\t\t * If we were unable to copy any data at all, we must\n\t\t\t * fall back to a single segment length write.\n\t\t\t *\n\t\t\t * If we didn't fallback here, we could livelock\n\t\t\t * because not all segments in the iov can be copied at\n\t\t\t * once without a pagefault.\n\t\t\t */\n\t\t\tbytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,\n \t\t\t\t\t\tiov_iter_single_seg_count(i));\n \t\t\tgoto again;\n \t\t}\n \t\tpos += copied;\n \t\twritten += copied;\n \n\t\tbalance_dirty_pages_ratelimited(mapping);\n\n\t} while (iov_iter_count(i));\n\n\treturn written ? written : status;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#13e1002277287ed0090b2ca76c2d01545e677935", + "input": " void TabletModeWindowManager::ArrangeWindowsForClamshellMode(\n base::flat_map windows_in_splitview) {\n int divider_position = CalculateCarryOverDividerPostion(windows_in_splitview);\n \n while (window_state_map_.size()) {\n aura::Window* window = window_state_map_.begin()->first;\n ForgetWindow(window, /*destroyed=*/false);\n }\n \n if (IsClamshellSplitViewModeEnabled()) {\n DoSplitViewTransition(windows_in_splitview, divider_position);\n }\n}\n", + "target": " void TabletModeWindowManager::ArrangeWindowsForClamshellMode(\n base::flat_map windows_in_splitview,\n bool was_in_overview) {\n int divider_position = CalculateCarryOverDividerPostion(windows_in_splitview);\n \n while (window_state_map_.size()) {\n aura::Window* window = window_state_map_.begin()->first;\n ForgetWindow(window, /*destroyed=*/false, was_in_overview);\n }\n \n if (IsClamshellSplitViewModeEnabled()) {\n DoSplitViewTransition(windows_in_splitview, divider_position);\n }\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ba1dbd78e5f1ed67c1b8d37ac89d90e5e330b628", + "input": "CURLcode Curl_smtp_escape_eob(struct connectdata *conn, const ssize_t nread)\n{\n /* When sending a SMTP payload we must detect CRLF. sequences making sure\n they are sent as CRLF.. instead, as a . on the beginning of a line will\n be deleted by the server when not part of an EOB terminator and a\n genuine CRLF.CRLF which isn't escaped will wrongly be detected as end of\n data by the server\n */\n ssize_t i;\n ssize_t si;\n struct Curl_easy *data = conn->data;\n struct SMTP *smtp = data->req.protop;\n char *scratch = data->state.scratch;\n char *newscratch = NULL;\n char *oldscratch = NULL;\n size_t eob_sent;\n\n /* Do we need to allocate a scratch buffer? */\n if(!scratch || data->set.crlf) {\n oldscratch = scratch;\n \n scratch = newscratch = malloc(2 * data->set.buffer_size);\n if(!newscratch) {\n failf(data, \"Failed to alloc scratch buffer!\");\n \n return CURLE_OUT_OF_MEMORY;\n }\n }\n \n /* Have we already sent part of the EOB? */\n eob_sent = smtp->eob;\n\n /* This loop can be improved by some kind of Boyer-Moore style of\n approach but that is saved for later... */\n for(i = 0, si = 0; i < nread; i++) {\n if(SMTP_EOB[smtp->eob] == data->req.upload_fromhere[i]) {\n smtp->eob++;\n\n /* Is the EOB potentially the terminating CRLF? */\n if(2 == smtp->eob || SMTP_EOB_LEN == smtp->eob)\n smtp->trailing_crlf = TRUE;\n else\n smtp->trailing_crlf = FALSE;\n }\n else if(smtp->eob) {\n /* A previous substring matched so output that first */\n memcpy(&scratch[si], &SMTP_EOB[eob_sent], smtp->eob - eob_sent);\n si += smtp->eob - eob_sent;\n\n /* Then compare the first byte */\n if(SMTP_EOB[0] == data->req.upload_fromhere[i])\n smtp->eob = 1;\n else\n smtp->eob = 0;\n\n eob_sent = 0;\n\n /* Reset the trailing CRLF flag as there was more data */\n smtp->trailing_crlf = FALSE;\n }\n\n /* Do we have a match for CRLF. as per RFC-5321, sect. 4.5.2 */\n if(SMTP_EOB_FIND_LEN == smtp->eob) {\n /* Copy the replacement data to the target buffer */\n memcpy(&scratch[si], &SMTP_EOB_REPL[eob_sent],\n SMTP_EOB_REPL_LEN - eob_sent);\n si += SMTP_EOB_REPL_LEN - eob_sent;\n smtp->eob = 0;\n eob_sent = 0;\n }\n else if(!smtp->eob)\n scratch[si++] = data->req.upload_fromhere[i];\n }\n\n if(smtp->eob - eob_sent) {\n /* A substring matched before processing ended so output that now */\n memcpy(&scratch[si], &SMTP_EOB[eob_sent], smtp->eob - eob_sent);\n si += smtp->eob - eob_sent;\n }\n\n /* Only use the new buffer if we replaced something */\n if(si != nread) {\n /* Upload from the new (replaced) buffer instead */\n data->req.upload_fromhere = scratch;\n\n /* Save the buffer so it can be freed later */\n data->state.scratch = scratch;\n\n /* Free the old scratch buffer */\n free(oldscratch);\n\n /* Set the new amount too */\n data->req.upload_present = si;\n }\n else\n free(newscratch);\n\n return CURLE_OK;\n}\n", + "target": "CURLcode Curl_smtp_escape_eob(struct connectdata *conn, const ssize_t nread)\n{\n /* When sending a SMTP payload we must detect CRLF. sequences making sure\n they are sent as CRLF.. instead, as a . on the beginning of a line will\n be deleted by the server when not part of an EOB terminator and a\n genuine CRLF.CRLF which isn't escaped will wrongly be detected as end of\n data by the server\n */\n ssize_t i;\n ssize_t si;\n struct Curl_easy *data = conn->data;\n struct SMTP *smtp = data->req.protop;\n char *scratch = data->state.scratch;\n char *newscratch = NULL;\n char *oldscratch = NULL;\n size_t eob_sent;\n\n /* Do we need to allocate a scratch buffer? */\n if(!scratch || data->set.crlf) {\n oldscratch = scratch;\n \n scratch = newscratch = malloc(2 * UPLOAD_BUFSIZE);\n if(!newscratch) {\n failf(data, \"Failed to alloc scratch buffer!\");\n \n return CURLE_OUT_OF_MEMORY;\n }\n }\n DEBUGASSERT(UPLOAD_BUFSIZE >= nread);\n \n /* Have we already sent part of the EOB? */\n eob_sent = smtp->eob;\n\n /* This loop can be improved by some kind of Boyer-Moore style of\n approach but that is saved for later... */\n for(i = 0, si = 0; i < nread; i++) {\n if(SMTP_EOB[smtp->eob] == data->req.upload_fromhere[i]) {\n smtp->eob++;\n\n /* Is the EOB potentially the terminating CRLF? */\n if(2 == smtp->eob || SMTP_EOB_LEN == smtp->eob)\n smtp->trailing_crlf = TRUE;\n else\n smtp->trailing_crlf = FALSE;\n }\n else if(smtp->eob) {\n /* A previous substring matched so output that first */\n memcpy(&scratch[si], &SMTP_EOB[eob_sent], smtp->eob - eob_sent);\n si += smtp->eob - eob_sent;\n\n /* Then compare the first byte */\n if(SMTP_EOB[0] == data->req.upload_fromhere[i])\n smtp->eob = 1;\n else\n smtp->eob = 0;\n\n eob_sent = 0;\n\n /* Reset the trailing CRLF flag as there was more data */\n smtp->trailing_crlf = FALSE;\n }\n\n /* Do we have a match for CRLF. as per RFC-5321, sect. 4.5.2 */\n if(SMTP_EOB_FIND_LEN == smtp->eob) {\n /* Copy the replacement data to the target buffer */\n memcpy(&scratch[si], &SMTP_EOB_REPL[eob_sent],\n SMTP_EOB_REPL_LEN - eob_sent);\n si += SMTP_EOB_REPL_LEN - eob_sent;\n smtp->eob = 0;\n eob_sent = 0;\n }\n else if(!smtp->eob)\n scratch[si++] = data->req.upload_fromhere[i];\n }\n\n if(smtp->eob - eob_sent) {\n /* A substring matched before processing ended so output that now */\n memcpy(&scratch[si], &SMTP_EOB[eob_sent], smtp->eob - eob_sent);\n si += smtp->eob - eob_sent;\n }\n\n /* Only use the new buffer if we replaced something */\n if(si != nread) {\n /* Upload from the new (replaced) buffer instead */\n data->req.upload_fromhere = scratch;\n\n /* Save the buffer so it can be freed later */\n data->state.scratch = scratch;\n\n /* Free the old scratch buffer */\n free(oldscratch);\n\n /* Set the new amount too */\n data->req.upload_present = si;\n }\n else\n free(newscratch);\n\n return CURLE_OK;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a0fe4d88137213aa24fbb16fd7eec34533345c9b", + "input": " void EnableHighDPISupport() {\n if (IsHighDPIEnabled() &&\n (base::win::GetVersion() < base::win::VERSION_WIN8_1)) {\n if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) {\n SetProcessDPIAwareWrapper();\n }\n }\n }\n", + "target": " void EnableHighDPISupport() {\n if (IsHighDPIEnabled() &&\n !SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) {\n SetProcessDPIAwareWrapper();\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6d444c273da5499a4cd72f21cb6d4c9a5256807d", + "input": "gsicc_open_search(const char* pname, int namelen, gs_memory_t *mem_gc,\n const char* dirname, int dirlen, stream**strp)\n{\n char *buffer;\n stream* str;\n\n /* Check if we need to prepend the file name */\n if ( dirname != NULL) {\n /* If this fails, we will still try the file by itself and with\n %rom% since someone may have left a space some of the spaces\n as our defaults, even if they defined the directory to use.\n This will occur only after searching the defined directory.\n A warning is noted. */\n buffer = (char *) gs_alloc_bytes(mem_gc, namelen + dirlen + 1,\n \"gsicc_open_search\");\n if (buffer == NULL)\n return_error(gs_error_VMerror);\n strcpy(buffer, dirname);\n strcat(buffer, pname);\n /* Just to make sure we were null terminated */\n buffer[namelen + dirlen] = '\\0';\n str = sfopen(buffer, \"r\", mem_gc);\n gs_free_object(mem_gc, buffer, \"gsicc_open_search\");\n if (str != NULL) {\n *strp = str;\n\t return 0;\n }\n }\n \n /* First just try it like it is */\n str = sfopen(pname, \"r\", mem_gc);\n if (str != NULL) {\n *strp = str;\n return 0;\n }\n \n /* If that fails, try %rom% */ /* FIXME: Not sure this is needed or correct */\n strlen(DEFAULT_DIR_ICC),\"gsicc_open_search\");\n if (buffer == NULL)\n return_error(gs_error_VMerror);\n strcpy(buffer, DEFAULT_DIR_ICC);\n strcat(buffer, pname);\n /* Just to make sure we were null terminated */\n buffer[namelen + strlen(DEFAULT_DIR_ICC)] = '\\0';\n str = sfopen(buffer, \"r\", mem_gc);\n gs_free_object(mem_gc, buffer, \"gsicc_open_search\");\n if (str == NULL) {\n gs_warn1(\"Could not find %s \",pname);\n }\n *strp = str;\n return 0;\n}\n", + "target": "gsicc_open_search(const char* pname, int namelen, gs_memory_t *mem_gc,\n const char* dirname, int dirlen, stream**strp)\n{\n char *buffer;\n stream* str;\n\n /* Check if we need to prepend the file name */\n if ( dirname != NULL) {\n /* If this fails, we will still try the file by itself and with\n %rom% since someone may have left a space some of the spaces\n as our defaults, even if they defined the directory to use.\n This will occur only after searching the defined directory.\n A warning is noted. */\n buffer = (char *) gs_alloc_bytes(mem_gc, namelen + dirlen + 1,\n \"gsicc_open_search\");\n if (buffer == NULL)\n return_error(gs_error_VMerror);\n strcpy(buffer, dirname);\n strcat(buffer, pname);\n /* Just to make sure we were null terminated */\n buffer[namelen + dirlen] = '\\0';\n str = sfopen(buffer, \"r\", mem_gc);\n gs_free_object(mem_gc, buffer, \"gsicc_open_search\");\n if (str != NULL) {\n *strp = str;\n\t return 0;\n }\n }\n \n /* First just try it like it is */\n if (gs_check_file_permission(mem_gc, pname, namelen, \"r\") >= 0) {\n str = sfopen(pname, \"r\", mem_gc);\n if (str != NULL) {\n *strp = str;\n return 0;\n }\n }\n \n /* If that fails, try %rom% */ /* FIXME: Not sure this is needed or correct */\n strlen(DEFAULT_DIR_ICC),\"gsicc_open_search\");\n if (buffer == NULL)\n return_error(gs_error_VMerror);\n strcpy(buffer, DEFAULT_DIR_ICC);\n strcat(buffer, pname);\n /* Just to make sure we were null terminated */\n buffer[namelen + strlen(DEFAULT_DIR_ICC)] = '\\0';\n str = sfopen(buffer, \"r\", mem_gc);\n gs_free_object(mem_gc, buffer, \"gsicc_open_search\");\n if (str == NULL) {\n gs_warn1(\"Could not find %s \",pname);\n }\n *strp = str;\n return 0;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#91f2fa59e8ed80dfbf400add0164ee0e508e412a", + "input": "static const char *skip( const char *in )\n{\n\twhile ( in && *in && (unsigned char) *in <= 32 )\n\t\tin++;\n\treturn in;\n}\n", + "target": "static const char *skip( const char *in )\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#20e0fa98b751facf9a1101edaefbc19c82616a68", + "input": "static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen)\n{\n\tstruct page *pages[NFS4ACL_MAXPAGES] = {NULL, };\n\tstruct nfs_getaclargs args = {\n\t\t.fh = NFS_FH(inode),\n\t\t.acl_pages = pages,\n\t\t.acl_len = buflen,\n\t};\n\tstruct nfs_getaclres res = {\n\t\t.acl_len = buflen,\n\t};\n\tvoid *resp_buf;\n\tstruct rpc_message msg = {\n\t\t.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL],\n\t\t.rpc_argp = &args,\n\t\t.rpc_resp = &res,\n\t};\n\tint ret = -ENOMEM, npages, i, acl_len = 0;\n\n\tnpages = (buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;\n\t/* As long as we're doing a round trip to the server anyway,\n\t * let's be prepared for a page of acl data. */\n\tif (npages == 0)\n\t\tnpages = 1;\n\n\tfor (i = 0; i < npages; i++) {\n\t\tpages[i] = alloc_page(GFP_KERNEL);\n\t\tif (!pages[i])\n\t\t\tgoto out_free;\n\t}\n\tif (npages > 1) {\n\t\t/* for decoding across pages */\n\t\tres.acl_scratch = alloc_page(GFP_KERNEL);\n\t\tif (!res.acl_scratch)\n\t\t\tgoto out_free;\n\t}\n\targs.acl_len = npages * PAGE_SIZE;\n\targs.acl_pgbase = 0;\n\t/* Let decode_getfacl know not to fail if the ACL data is larger than\n\t * the page we send as a guess */\n\tif (buf == NULL)\n\t\tres.acl_flags |= NFS4_ACL_LEN_REQUEST;\n\tresp_buf = page_address(pages[0]);\n\n\tdprintk(\"%s buf %p buflen %zu npages %d args.acl_len %zu\\n\",\n\t\t__func__, buf, buflen, npages, args.acl_len);\n\tret = nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode),\n\t\t\t &msg, &args.seq_args, &res.seq_res, 0);\n\tif (ret)\n\t\tgoto out_free;\n\n\tacl_len = res.acl_len - res.acl_data_offset;\n\tif (acl_len > args.acl_len)\n\t\tnfs4_write_cached_acl(inode, NULL, acl_len);\n\telse\n\t\tnfs4_write_cached_acl(inode, resp_buf + res.acl_data_offset,\n\t\t\t\t acl_len);\n\tif (buf) {\n\t\tret = -ERANGE;\n \t\tif (acl_len > buflen)\n \t\t\tgoto out_free;\n \t\t_copy_from_pages(buf, pages, res.acl_data_offset,\n\t\t\t\tres.acl_len);\n \t}\n \tret = acl_len;\n out_free:\n\tfor (i = 0; i < npages; i++)\n\t\tif (pages[i])\n\t\t\t__free_page(pages[i]);\n\tif (res.acl_scratch)\n\t\t__free_page(res.acl_scratch);\n\treturn ret;\n}\n", + "target": "static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen)\n{\n\tstruct page *pages[NFS4ACL_MAXPAGES] = {NULL, };\n\tstruct nfs_getaclargs args = {\n\t\t.fh = NFS_FH(inode),\n\t\t.acl_pages = pages,\n\t\t.acl_len = buflen,\n\t};\n\tstruct nfs_getaclres res = {\n\t\t.acl_len = buflen,\n\t};\n\tvoid *resp_buf;\n\tstruct rpc_message msg = {\n\t\t.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL],\n\t\t.rpc_argp = &args,\n\t\t.rpc_resp = &res,\n\t};\n\tint ret = -ENOMEM, npages, i, acl_len = 0;\n\n\tnpages = (buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;\n\t/* As long as we're doing a round trip to the server anyway,\n\t * let's be prepared for a page of acl data. */\n\tif (npages == 0)\n\t\tnpages = 1;\n\n\tfor (i = 0; i < npages; i++) {\n\t\tpages[i] = alloc_page(GFP_KERNEL);\n\t\tif (!pages[i])\n\t\t\tgoto out_free;\n\t}\n\tif (npages > 1) {\n\t\t/* for decoding across pages */\n\t\tres.acl_scratch = alloc_page(GFP_KERNEL);\n\t\tif (!res.acl_scratch)\n\t\t\tgoto out_free;\n\t}\n\targs.acl_len = npages * PAGE_SIZE;\n\targs.acl_pgbase = 0;\n\t/* Let decode_getfacl know not to fail if the ACL data is larger than\n\t * the page we send as a guess */\n\tif (buf == NULL)\n\t\tres.acl_flags |= NFS4_ACL_LEN_REQUEST;\n\tresp_buf = page_address(pages[0]);\n\n\tdprintk(\"%s buf %p buflen %zu npages %d args.acl_len %zu\\n\",\n\t\t__func__, buf, buflen, npages, args.acl_len);\n\tret = nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode),\n\t\t\t &msg, &args.seq_args, &res.seq_res, 0);\n\tif (ret)\n\t\tgoto out_free;\n\n\tacl_len = res.acl_len - res.acl_data_offset;\n\tif (acl_len > args.acl_len)\n\t\tnfs4_write_cached_acl(inode, NULL, acl_len);\n\telse\n\t\tnfs4_write_cached_acl(inode, resp_buf + res.acl_data_offset,\n\t\t\t\t acl_len);\n\tif (buf) {\n\t\tret = -ERANGE;\n \t\tif (acl_len > buflen)\n \t\t\tgoto out_free;\n \t\t_copy_from_pages(buf, pages, res.acl_data_offset,\n\t\t\t\tacl_len);\n \t}\n \tret = acl_len;\n out_free:\n\tfor (i = 0; i < npages; i++)\n\t\tif (pages[i])\n\t\t\t__free_page(pages[i]);\n\tif (res.acl_scratch)\n\t\t__free_page(res.acl_scratch);\n\treturn ret;\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1161a49d663dd395bd639549c2dfe7324f847938", + "input": "bool BookmarkNodeData::Read(const ui::OSExchangeData& data) {\n elements.clear();\n\n profile_path_.clear();\n\n if (data.HasCustomFormat(GetBookmarkCustomFormat())) {\n Pickle drag_data_pickle;\n if (data.GetPickledData(GetBookmarkCustomFormat(), &drag_data_pickle)) {\n if (!ReadFromPickle(&drag_data_pickle))\n return false;\n }\n } else {\n Element element;\n GURL url;\n base::string16 title;\n if (data.GetURLAndTitle(&url, &title))\n ReadFromTuple(url, title);\n }\n \n return is_valid();\n}\n", + "target": "bool BookmarkNodeData::Read(const ui::OSExchangeData& data) {\n elements.clear();\n\n profile_path_.clear();\n\n if (data.HasCustomFormat(GetBookmarkCustomFormat())) {\n Pickle drag_data_pickle;\n if (data.GetPickledData(GetBookmarkCustomFormat(), &drag_data_pickle)) {\n if (!ReadFromPickle(&drag_data_pickle))\n return false;\n }\n } else {\n Element element;\n GURL url;\n base::string16 title;\n if (data.GetURLAndTitle(\n ui::OSExchangeData::CONVERT_FILENAMES, &url, &title))\n ReadFromTuple(url, title);\n }\n \n return is_valid();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0220f39fac21d169a834ef91de362f4169f2eef5", + "input": "XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded)\n : m_ownerNode(parentNode)\n , m_originalURL(originalURL)\n , m_finalURL(finalURL)\n , m_isDisabled(false)\n , m_embedded(embedded)\n , m_processed(true) // The root sheet starts off processed.\n , m_stylesheetDoc(0)\n , m_stylesheetDocTaken(false)\n , m_parentStyleSheet(0)\n {\n }\n", + "target": "XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded)\n : m_ownerNode(parentNode)\n , m_originalURL(originalURL)\n , m_finalURL(finalURL)\n , m_isDisabled(false)\n , m_embedded(embedded)\n , m_processed(true) // The root sheet starts off processed.\n , m_stylesheetDoc(0)\n , m_stylesheetDocTaken(false)\n , m_compilationFailed(false)\n , m_parentStyleSheet(0)\n {\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#88c4913f11967abfd08a8b22b4423710322ac49b", + "input": " void CCLayerTreeHostTest::doBeginTest()\n {\n ASSERT(isMainThread());\n ASSERT(!m_running);\n m_running = true;\n m_client = MockLayerTreeHostClient::create(this);\n \n RefPtr rootLayer = LayerChromium::create(0);\n m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings);\n ASSERT(m_layerTreeHost);\n\n m_beginning = true;\n beginTest();\n m_beginning = false;\n if (m_endWhenBeginReturns)\n onEndTest(static_cast(this));\n}\n", + "target": " void CCLayerTreeHostTest::doBeginTest()\n {\n ASSERT(isMainThread());\n m_client = MockLayerTreeHostClient::create(this);\n \n RefPtr rootLayer = LayerChromium::create(0);\n m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, m_settings);\n ASSERT(m_layerTreeHost);\n\n m_beginning = true;\n beginTest();\n m_beginning = false;\n if (m_endWhenBeginReturns)\n onEndTest(static_cast(this));\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#4-d492b51213ce", + "input": " def _run_ssh(self, command, check_exit_code=True, attempts=1):\n if not self.sshpool:\n password = self.configuration.san_password\n privatekey = self.configuration.san_private_key\n min_size = self.configuration.ssh_min_pool_conn\n max_size = self.configuration.ssh_max_pool_conn\n self.sshpool = utils.SSHPool(self.configuration.san_ip,\n self.configuration.san_ssh_port,\n self.configuration.ssh_conn_timeout,\n self.configuration.san_login,\n password=password,\n privatekey=privatekey,\n min_size=min_size,\n max_size=max_size)\n last_exception = None\n try:\n total_attempts = attempts\n with self.sshpool.item() as ssh:\n while attempts > 0:\n attempts -= 1\n try:\n return utils.ssh_execute(\n ssh,\n command,\n check_exit_code=check_exit_code)\n except Exception as e:\n LOG.error(e)\n last_exception = e\n greenthread.sleep(random.randint(20, 500) / 100.0)\n try:\n raise exception.ProcessExecutionError(\n exit_code=last_exception.exit_code,\n stdout=last_exception.stdout,\n stderr=last_exception.stderr,\n cmd=last_exception.cmd)\n except AttributeError:\n raise exception.ProcessExecutionError(\n exit_code=-1,\n stdout=\"\",\n stderr=\"Error running SSH command\",\n cmd=command)\n\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error running SSH command: %s\") % command)", + "target": " def _run_ssh(self, cmd_list, check_exit_code=True, attempts=1):\n utils.check_ssh_injection(cmd_list)\n command = ' '. join(cmd_list)\n\n if not self.sshpool:\n password = self.configuration.san_password\n privatekey = self.configuration.san_private_key\n min_size = self.configuration.ssh_min_pool_conn\n max_size = self.configuration.ssh_max_pool_conn\n self.sshpool = utils.SSHPool(self.configuration.san_ip,\n self.configuration.san_ssh_port,\n self.configuration.ssh_conn_timeout,\n self.configuration.san_login,\n password=password,\n privatekey=privatekey,\n min_size=min_size,\n max_size=max_size)\n last_exception = None\n try:\n total_attempts = attempts\n with self.sshpool.item() as ssh:\n while attempts > 0:\n attempts -= 1\n try:\n return utils.ssh_execute(\n ssh,\n command,\n check_exit_code=check_exit_code)\n except Exception as e:\n LOG.error(e)\n last_exception = e\n greenthread.sleep(random.randint(20, 500) / 100.0)\n try:\n raise exception.ProcessExecutionError(\n exit_code=last_exception.exit_code,\n stdout=last_exception.stdout,\n stderr=last_exception.stderr,\n cmd=last_exception.cmd)\n except AttributeError:\n raise exception.ProcessExecutionError(\n exit_code=-1,\n stdout=\"\",\n stderr=\"Error running SSH command\",\n cmd=command)\n\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error running SSH command: %s\") % command)", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#828eab2216a765dea92575c290421c115b8ad028", + "input": "void StoreAccumulatedContentLength(int received_content_length,\n int original_content_length,\n bool data_reduction_proxy_was_used) {\n BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,\n base::Bind(&UpdateContentLengthPrefs,\n received_content_length, original_content_length,\n data_reduction_proxy_was_used));\n }\n", + "target": "void StoreAccumulatedContentLength(int received_content_length,\nvoid StoreAccumulatedContentLength(\n int received_content_length,\n int original_content_length,\n chrome_browser_net::DataReductionRequestType data_reduction_type) {\n BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,\n base::Bind(&UpdateContentLengthPrefs,\n received_content_length, original_content_length,\n data_reduction_type));\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1f686d023b95219db933394a7704ad9aa5f01cbb", + "input": "static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)\n{\n MpegEncContext *s = &ctx->m;\n\n if (get_bits_left(gb) <= 32)\n return 0;\n \n s->partitioned_frame = 0;\n s->decode_mb = mpeg4_decode_studio_mb;\n \n decode_smpte_tc(ctx, gb);\n\n skip_bits(gb, 10); /* temporal_reference */\n skip_bits(gb, 2); /* vop_structure */\n s->pict_type = get_bits(gb, 2) + AV_PICTURE_TYPE_I; /* vop_coding_type */\n if (get_bits1(gb)) { /* vop_coded */\n skip_bits1(gb); /* top_field_first */\n skip_bits1(gb); /* repeat_first_field */\n s->progressive_frame = get_bits1(gb) ^ 1; /* progressive_frame */\n }\n\n if (s->pict_type == AV_PICTURE_TYPE_I) {\n if (get_bits1(gb))\n reset_studio_dc_predictors(s);\n }\n\n if (ctx->shape != BIN_ONLY_SHAPE) {\n s->alternate_scan = get_bits1(gb);\n s->frame_pred_frame_dct = get_bits1(gb);\n s->dct_precision = get_bits(gb, 2);\n s->intra_dc_precision = get_bits(gb, 2);\n s->q_scale_type = get_bits1(gb);\n }\n\n if (s->alternate_scan) {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n } else {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n }\n\n mpeg4_load_default_matrices(s);\n\n next_start_code_studio(gb);\n extension_and_user_data(s, gb, 4);\n\n return 0;\n}\n", + "target": "static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)\n{\n MpegEncContext *s = &ctx->m;\n\n if (get_bits_left(gb) <= 32)\n return 0;\n \n s->partitioned_frame = 0;\n s->interlaced_dct = 0;\n s->decode_mb = mpeg4_decode_studio_mb;\n \n decode_smpte_tc(ctx, gb);\n\n skip_bits(gb, 10); /* temporal_reference */\n skip_bits(gb, 2); /* vop_structure */\n s->pict_type = get_bits(gb, 2) + AV_PICTURE_TYPE_I; /* vop_coding_type */\n if (get_bits1(gb)) { /* vop_coded */\n skip_bits1(gb); /* top_field_first */\n skip_bits1(gb); /* repeat_first_field */\n s->progressive_frame = get_bits1(gb) ^ 1; /* progressive_frame */\n }\n\n if (s->pict_type == AV_PICTURE_TYPE_I) {\n if (get_bits1(gb))\n reset_studio_dc_predictors(s);\n }\n\n if (ctx->shape != BIN_ONLY_SHAPE) {\n s->alternate_scan = get_bits1(gb);\n s->frame_pred_frame_dct = get_bits1(gb);\n s->dct_precision = get_bits(gb, 2);\n s->intra_dc_precision = get_bits(gb, 2);\n s->q_scale_type = get_bits1(gb);\n }\n\n if (s->alternate_scan) {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n } else {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n }\n\n mpeg4_load_default_matrices(s);\n\n next_start_code_studio(gb);\n extension_and_user_data(s, gb, 4);\n\n return 0;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#11f3710417d026ea2f4fcf362d866342c5274185", + "input": "static int ovl_remove_upper(struct dentry *dentry, bool is_dir)\n {\n \tstruct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);\n \tstruct inode *dir = upperdir->d_inode;\n\tstruct dentry *upper = ovl_dentry_upper(dentry);\n \tint err;\n \n \tinode_lock_nested(dir, I_MUTEX_PARENT);\n \terr = -ESTALE;\n\tif (upper->d_parent == upperdir) {\n\t\t/* Don't let d_delete() think it can reset d_inode */\n\t\tdget(upper);\n \t\tif (is_dir)\n \t\t\terr = vfs_rmdir(dir, upper);\n \t\telse\n \t\t\terr = vfs_unlink(dir, upper, NULL);\n\t\tdput(upper);\n \t\tovl_dentry_version_inc(dentry->d_parent);\n \t}\n \n \t/*\n \t * Keeping this dentry hashed would mean having to release\n\t * upperpath/lowerpath, which could only be done if we are the\n\t * sole user of this dentry. Too tricky... Just unhash for\n\t * now.\n \t */\n \tif (!err)\n \t\td_drop(dentry);\n \tinode_unlock(dir);\n \n \treturn err;\n}\n", + "target": "static int ovl_remove_upper(struct dentry *dentry, bool is_dir)\n {\n \tstruct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);\n \tstruct inode *dir = upperdir->d_inode;\n\tstruct dentry *upper;\n \tint err;\n \n \tinode_lock_nested(dir, I_MUTEX_PARENT);\n\tupper = lookup_one_len(dentry->d_name.name, upperdir,\n\t\t\t dentry->d_name.len);\n\terr = PTR_ERR(upper);\n\tif (IS_ERR(upper))\n\t\tgoto out_unlock;\n\n \terr = -ESTALE;\n\tif (upper == ovl_dentry_upper(dentry)) {\n \t\tif (is_dir)\n \t\t\terr = vfs_rmdir(dir, upper);\n \t\telse\n \t\t\terr = vfs_unlink(dir, upper, NULL);\n \t\tovl_dentry_version_inc(dentry->d_parent);\n \t}\n\tdput(upper);\n \n \t/*\n \t * Keeping this dentry hashed would mean having to release\n\t * upperpath/lowerpath, which could only be done if we are the\n\t * sole user of this dentry. Too tricky... Just unhash for\n\t * now.\n \t */\n \tif (!err)\n \t\td_drop(dentry);\nout_unlock:\n \tinode_unlock(dir);\n \n \treturn err;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d30a8bd191f17b61938fc87890bffc80049b0774", + "input": " void TabHelper::OnInlineInstallComplete(int install_id,\n int return_route_id,\n bool success,\n const std::string& error,\n webstore_install::Result result) {\n Send(new ExtensionMsg_InlineWebstoreInstallResponse(\n return_route_id,\n install_id,\n success,\n success ? std::string() : error,\n result));\n}\n", + "target": " void TabHelper::OnInlineInstallComplete(int install_id,\n int return_route_id,\n const std::string& extension_id,\n bool success,\n const std::string& error,\n webstore_install::Result result) {\n DCHECK_EQ(1u, pending_inline_installations_.count(extension_id));\n pending_inline_installations_.erase(extension_id);\n install_observers_.erase(extension_id);\n Send(new ExtensionMsg_InlineWebstoreInstallResponse(\n return_route_id,\n install_id,\n success,\n success ? std::string() : error,\n result));\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#29014da83e5fc358d6bff0f574e9ed45e61a35ac", + "input": " base::WeakPtr GetWeakPtr() {\n return weak_ptr_factory_.GetWeakPtr();\n }\n", + "target": " base::WeakPtr GetWeakPtr() {\n", + "vul_type": "cwe-20", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d", + "input": " long Segment::DoLoadClusterUnknownSize(long long& pos, long& len) {\n assert(m_pos < 0);\n assert(m_pUnknownSize);\n \n#if 0\n assert(m_pUnknownSize->GetElementSize() < 0); //TODO: verify this\n const long long element_start = m_pUnknownSize->m_element_start;\n pos = -m_pos;\n assert(pos > element_start);\n long long total, avail;\n long status = m_pReader->Length(&total, &avail);\n if (status < 0) //error\n return status;\n assert((total < 0) || (avail <= total));\n const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;\n long long element_size = -1;\n for (;;) { //determine cluster size\n if ((total >= 0) && (pos >= total))\n {\n element_size = total - element_start;\n assert(element_size > 0);\n break;\n }\n if ((segment_stop >= 0) && (pos >= segment_stop))\n {\n element_size = segment_stop - element_start;\n assert(element_size > 0);\n break;\n }\n if ((pos + 1) > avail)\n {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n long long result = GetUIntLength(m_pReader, pos, len);\n if (result < 0) //error\n return static_cast(result);\n if (result > 0) //weird\n return E_BUFFER_NOT_FULL;\n if ((segment_stop >= 0) && ((pos + len) > segment_stop))\n return E_FILE_FORMAT_INVALID;\n if ((pos + len) > avail)\n return E_BUFFER_NOT_FULL;\n const long long idpos = pos;\n const long long id = ReadUInt(m_pReader, idpos, len);\n if (id < 0) //error (or underflow)\n return static_cast(id);\n if ((id == 0x0F43B675) || (id == 0x0C53BB6B)) { //Cluster ID or Cues ID\n element_size = pos - element_start;\n assert(element_size > 0);\n break;\n }\n#ifdef _DEBUG\n switch (id)\n {\n case 0x20: //BlockGroup\n case 0x23: //Simple Block\n case 0x67: //TimeCode\n case 0x2B: //PrevSize\n break;\n default:\n assert(false);\n break;\n }\n#endif\n pos += len; //consume ID (of sub-element)\n if ((pos + 1) > avail)\n {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n result = GetUIntLength(m_pReader, pos, len);\n if (result < 0) //error\n return static_cast(result);\n if (result > 0) //weird\n return E_BUFFER_NOT_FULL;\n if ((segment_stop >= 0) && ((pos + len) > segment_stop))\n return E_FILE_FORMAT_INVALID;\n if ((pos + len) > avail)\n return E_BUFFER_NOT_FULL;\n const long long size = ReadUInt(m_pReader, pos, len);\n if (size < 0) //error\n return static_cast(size);\n pos += len; //consume size field of element\n if (size == 0) //weird\n continue;\n const long long unknown_size = (1LL << (7 * len)) - 1;\n if (size == unknown_size)\n return E_FILE_FORMAT_INVALID; //not allowed for sub-elements\n if ((segment_stop >= 0) && ((pos + size) > segment_stop)) //weird\n return E_FILE_FORMAT_INVALID;\n pos += size; //consume payload of sub-element\n assert((segment_stop < 0) || (pos <= segment_stop));\n } //determine cluster size\n assert(element_size >= 0);\n m_pos = element_start + element_size;\n m_pUnknownSize = 0;\n return 2; //continue parsing\n#else\n const long status = m_pUnknownSize->Parse(pos, len);\n \n if (status < 0) // error or underflow\n return status;\n\n\n if (status == 0) // parsed a block\n return 2; // continue parsing\n \n assert(status > 0); // nothing left to parse of this cluster\n const long long start = m_pUnknownSize->m_element_start;\n const long long size = m_pUnknownSize->GetElementSize();\n assert(size >= 0);\n \n pos = start + size;\n m_pos = pos;\n\n\n m_pUnknownSize = 0;\n \n return 2; // continue parsing\n#endif\n }\n", + "target": " long Segment::DoLoadClusterUnknownSize(long long& pos, long& len) {\n if (m_pos >= 0 || m_pUnknownSize == NULL)\n return E_PARSE_FAILED;\n \n const long status = m_pUnknownSize->Parse(pos, len);\n \n if (status < 0) // error or underflow\n return status;\n\n\n if (status == 0) // parsed a block\n return 2; // continue parsing\n \n const long long start = m_pUnknownSize->m_element_start;\n const long long size = m_pUnknownSize->GetElementSize();\n\n if (size < 0)\n return E_FILE_FORMAT_INVALID;\n \n pos = start + size;\n m_pos = pos;\n\n\n m_pUnknownSize = 0;\n \n return 2; // continue parsing\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#27c68f543e5eba779902447445dfb05ec3f5bf75", + "input": " Vp9InterpFilter Vp9Parser::ReadInterpFilter() {\n if (reader_.ReadBool())\n return Vp9InterpFilter::SWICHABLE;\n \n const Vp9InterpFilter table[] = {\n Vp9InterpFilter::EIGHTTAP_SMOOTH, Vp9InterpFilter::EIGHTTAP,\n Vp9InterpFilter::EIGHTTAP_SHARP, Vp9InterpFilter::BILINEAR,\n };\n return table[reader_.ReadLiteral(2)];\n }\n", + "target": " Vp9InterpFilter Vp9Parser::ReadInterpFilter() {\n if (reader_.ReadBool())\n return Vp9InterpFilter::INTERP_FILTER_SELECT;\n \n const Vp9InterpFilter table[] = {\n Vp9InterpFilter::EIGHTTAP_SMOOTH, Vp9InterpFilter::EIGHTTAP,\n Vp9InterpFilter::EIGHTTAP_SHARP, Vp9InterpFilter::BILINEAR,\n };\n return table[reader_.ReadLiteral(2)];\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#acff81ec2c79492b180fade3c2894425cd35a545", + "input": "int ovl_setattr(struct dentry *dentry, struct iattr *attr)\n{\n\tint err;\n\tstruct dentry *upperdentry;\n\n\terr = ovl_want_write(dentry);\n \tif (err)\n \t\tgoto out;\n \n\tupperdentry = ovl_dentry_upper(dentry);\n\tif (upperdentry) {\n \t\tmutex_lock(&upperdentry->d_inode->i_mutex);\n \t\terr = notify_change(upperdentry, attr, NULL);\n \t\tmutex_unlock(&upperdentry->d_inode->i_mutex);\n\t} else {\n\t\terr = ovl_copy_up_last(dentry, attr, false);\n \t}\n \tovl_drop_write(dentry);\n out:\n\treturn err;\n}\n", + "target": "int ovl_setattr(struct dentry *dentry, struct iattr *attr)\n{\n\tint err;\n\tstruct dentry *upperdentry;\n\n\terr = ovl_want_write(dentry);\n \tif (err)\n \t\tgoto out;\n \n\terr = ovl_copy_up(dentry);\n\tif (!err) {\n\t\tupperdentry = ovl_dentry_upper(dentry);\n\n \t\tmutex_lock(&upperdentry->d_inode->i_mutex);\n \t\terr = notify_change(upperdentry, attr, NULL);\n \t\tmutex_unlock(&upperdentry->d_inode->i_mutex);\n \t}\n \tovl_drop_write(dentry);\n out:\n\treturn err;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4a3e17c874bc4c4c90e5b0f8ec568520964695d4", + "input": "WebNotificationData createWebNotificationData(ExecutionContext* executionContext, const String& title, const NotificationOptions& options, ExceptionState& exceptionState)\n{\n if (options.hasVibrate() && options.silent()) {\n exceptionState.throwTypeError(\"Silent notifications must not specify vibration patterns.\");\n return WebNotificationData();\n }\n\n WebNotificationData webData;\n\n webData.title = title;\n webData.direction = toDirectionEnumValue(options.dir());\n webData.lang = options.lang();\n webData.body = options.body();\n webData.tag = options.tag();\n \n KURL iconUrl;\n \n iconUrl = executionContext->completeURL(options.icon());\n if (!iconUrl.isValid())\n iconUrl = KURL();\n }\n\n webData.icon = iconUrl;\n webData.vibrate = NavigatorVibration::sanitizeVibrationPattern(options.vibrate());\n webData.timestamp = options.hasTimestamp() ? static_cast(options.timestamp()) : WTF::currentTimeMS();\n webData.silent = options.silent();\n webData.requireInteraction = options.requireInteraction();\n\n if (options.hasData()) {\n RefPtr serializedScriptValue = SerializedScriptValueFactory::instance().create(options.data().isolate(), options.data(), nullptr, exceptionState);\n if (exceptionState.hadException())\n return WebNotificationData();\n\n Vector serializedData;\n serializedScriptValue->toWireBytes(serializedData);\n\n webData.data = serializedData;\n }\n\n Vector actions;\n\n const size_t maxActions = Notification::maxActions();\n for (const NotificationAction& action : options.actions()) {\n if (actions.size() >= maxActions)\n break;\n\n WebNotificationAction webAction;\n webAction.action = action.action();\n webAction.title = action.title();\n \n actions.append(webAction);\n }\n \n webData.actions = actions;\n\n return webData;\n}\n", + "target": "WebNotificationData createWebNotificationData(ExecutionContext* executionContext, const String& title, const NotificationOptions& options, ExceptionState& exceptionState)\n{\n if (options.hasVibrate() && options.silent()) {\n exceptionState.throwTypeError(\"Silent notifications must not specify vibration patterns.\");\n return WebNotificationData();\n }\n\n WebNotificationData webData;\n\n webData.title = title;\n webData.direction = toDirectionEnumValue(options.dir());\n webData.lang = options.lang();\n webData.body = options.body();\n webData.tag = options.tag();\n \n KURL iconUrl;\n \n iconUrl = executionContext->completeURL(options.icon());\n if (!iconUrl.isValid())\n iconUrl = KURL();\n }\n\n webData.icon = iconUrl;\n webData.vibrate = NavigatorVibration::sanitizeVibrationPattern(options.vibrate());\n webData.timestamp = options.hasTimestamp() ? static_cast(options.timestamp()) : WTF::currentTimeMS();\n webData.silent = options.silent();\n webData.requireInteraction = options.requireInteraction();\n\n if (options.hasData()) {\n RefPtr serializedScriptValue = SerializedScriptValueFactory::instance().create(options.data().isolate(), options.data(), nullptr, exceptionState);\n if (exceptionState.hadException())\n return WebNotificationData();\n\n Vector serializedData;\n serializedScriptValue->toWireBytes(serializedData);\n\n webData.data = serializedData;\n }\n\n Vector actions;\n\n const size_t maxActions = Notification::maxActions();\n for (const NotificationAction& action : options.actions()) {\n if (actions.size() >= maxActions)\n break;\n\n WebNotificationAction webAction;\n webAction.action = action.action();\n webAction.title = action.title();\n \n KURL iconUrl;\n if (action.hasIcon() && !action.icon().isEmpty()) {\n iconUrl = executionContext->completeURL(action.icon());\n if (!iconUrl.isValid())\n iconUrl = KURL();\n }\n webAction.icon = iconUrl;\n\n actions.append(webAction);\n }\n \n webData.actions = actions;\n\n return webData;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#acc192347665943ca674acf117e4f74a88436922", + "input": " static void copyMono16(\n short *dst,\n const int *const *src,\n unsigned nSamples,\n unsigned /* nChannels */) {\n for (unsigned i = 0; i < nSamples; ++i) {\n *dst++ = src[0][i];\n }\n}\n", + "target": " static void copyMono16(\n short *dst,\n const int * src[FLACParser::kMaxChannels],\n unsigned nSamples,\n unsigned /* nChannels */) {\n for (unsigned i = 0; i < nSamples; ++i) {\n *dst++ = src[0][i];\n }\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3ff403eecdd23a39853a4ebca52023fbba6c5d00", + "input": " bool MessageLoop::DoWork() {\n if (!nestable_tasks_allowed_) {\n return false;\n }\n\n for (;;) {\n ReloadWorkQueue();\n if (work_queue_.empty())\n break;\n\n do {\n PendingTask pending_task = std::move(work_queue_.front());\n work_queue_.pop();\n\n if (pending_task.task.IsCancelled()) {\n#if defined(OS_WIN)\n DecrementHighResTaskCountIfNeeded(pending_task);\n#endif\n } else if (!pending_task.delayed_run_time.is_null()) {\n int sequence_num = pending_task.sequence_num;\n TimeTicks delayed_run_time = pending_task.delayed_run_time;\n AddToDelayedWorkQueue(std::move(pending_task));\n if (delayed_work_queue_.top().sequence_num == sequence_num)\n pump_->ScheduleDelayedWork(delayed_run_time);\n } else {\n if (DeferOrRunPendingTask(std::move(pending_task)))\n return true;\n }\n } while (!work_queue_.empty());\n }\n\n return false;\n }\n", + "target": " bool MessageLoop::DoWork() {\n if (!NestableTasksAllowed()) {\n return false;\n }\n\n for (;;) {\n ReloadWorkQueue();\n if (work_queue_.empty())\n break;\n\n do {\n PendingTask pending_task = std::move(work_queue_.front());\n work_queue_.pop();\n\n if (pending_task.task.IsCancelled()) {\n#if defined(OS_WIN)\n DecrementHighResTaskCountIfNeeded(pending_task);\n#endif\n } else if (!pending_task.delayed_run_time.is_null()) {\n int sequence_num = pending_task.sequence_num;\n TimeTicks delayed_run_time = pending_task.delayed_run_time;\n AddToDelayedWorkQueue(std::move(pending_task));\n if (delayed_work_queue_.top().sequence_num == sequence_num)\n pump_->ScheduleDelayedWork(delayed_run_time);\n } else {\n if (DeferOrRunPendingTask(std::move(pending_task)))\n return true;\n }\n } while (!work_queue_.empty());\n }\n\n return false;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#78d89fe556cb5dabbc47b4967cdf55e607e29580", + "input": "void AcceleratedStaticBitmapImage::Draw(cc::PaintCanvas* canvas,\n const cc::PaintFlags& flags,\n const FloatRect& dst_rect,\n const FloatRect& src_rect,\n RespectImageOrientationEnum,\n ImageClampingMode image_clamping_mode,\n ImageDecodingMode decode_mode) {\n auto paint_image = PaintImageForCurrentFrame();\n if (!paint_image)\n return;\n auto paint_image_decoding_mode = ToPaintImageDecodingMode(decode_mode);\n if (paint_image.decoding_mode() != paint_image_decoding_mode) {\n paint_image = PaintImageBuilder::WithCopy(std::move(paint_image))\n .set_decoding_mode(paint_image_decoding_mode)\n .TakePaintImage();\n }\n StaticBitmapImage::DrawHelper(canvas, flags, dst_rect, src_rect,\n image_clamping_mode, paint_image);\n}\n", + "target": "void AcceleratedStaticBitmapImage::Draw(cc::PaintCanvas* canvas,\n const cc::PaintFlags& flags,\n const FloatRect& dst_rect,\n const FloatRect& src_rect,\n RespectImageOrientationEnum,\n ImageClampingMode image_clamping_mode,\n ImageDecodingMode decode_mode) {\n DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);\n auto paint_image = PaintImageForCurrentFrame();\n if (!paint_image)\n return;\n auto paint_image_decoding_mode = ToPaintImageDecodingMode(decode_mode);\n if (paint_image.decoding_mode() != paint_image_decoding_mode) {\n paint_image = PaintImageBuilder::WithCopy(std::move(paint_image))\n .set_decoding_mode(paint_image_decoding_mode)\n .TakePaintImage();\n }\n StaticBitmapImage::DrawHelper(canvas, flags, dst_rect, src_rect,\n image_clamping_mode, paint_image);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7a6d81a8544c595331b50a17f8c0b11feca2f029", + "input": " static void reflectStringAttributeAttributeSetter(v8::Local v8Value, const v8::FunctionCallbackInfo& info)\n {\n v8::Local holder = info.Holder();\n Element* impl = V8Element::toImpl(holder);\n V8StringResource<> cppValue = v8Value;\n if (!cppValue.prepare())\n return;\n impl->setAttribute(HTMLNames::reflectstringattributeAttr, cppValue);\n}\n", + "target": " static void reflectStringAttributeAttributeSetter(v8::Local v8Value, const v8::FunctionCallbackInfo& info)\n {\n v8::Local holder = info.Holder();\n TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder);\n V8StringResource<> cppValue = v8Value;\n if (!cppValue.prepare())\n return;\n impl->setAttribute(HTMLNames::reflectstringattributeAttr, cppValue);\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2fb4f2c9c461551d43fdfa28ef4c960da81a47dd", + "input": "bool MimeUtil::ParseCodecString(const std::string& mime_type_lower_case,\n const std::string& codec_id,\n Codec* codec,\n bool* ambiguous_codec_string,\n VideoCodecProfile* out_profile,\n uint8_t* out_level,\n gfx::ColorSpace::TransferID* out_eotf) const {\n DCHECK_EQ(base::ToLowerASCII(mime_type_lower_case), mime_type_lower_case);\n DCHECK(codec);\n DCHECK(out_profile);\n DCHECK(out_level);\n\n *codec = INVALID_CODEC;\n *ambiguous_codec_string = false;\n *out_profile = VIDEO_CODEC_PROFILE_UNKNOWN;\n *out_level = 0;\n \n *out_eotf = gfx::ColorSpace::TransferID::BT709;\n \n std::map::const_iterator itr =\n GetStringToCodecMap().find(codec_id);\n if (itr != GetStringToCodecMap().end()) {\n *codec = itr->second;\n\n return true;\n }\n\n if (codec_id == \"avc1\" || codec_id == \"avc3\") {\n *codec = MimeUtil::H264;\n *ambiguous_codec_string = true;\n return true;\n } else if (codec_id == \"mp4a.40\") {\n *codec = MimeUtil::MPEG4_AAC;\n *ambiguous_codec_string = true;\n return true;\n }\n\n if (ParseVp9CodecID(mime_type_lower_case, codec_id, out_profile, out_level,\n out_eotf)) {\n *codec = MimeUtil::VP9;\n return true;\n }\n\n if (ParseAVCCodecId(codec_id, out_profile, out_level)) {\n *codec = MimeUtil::H264;\n *ambiguous_codec_string = !IsValidH264Level(*out_level);\n return true;\n }\n\n#if BUILDFLAG(ENABLE_HEVC_DEMUXING)\n if (ParseHEVCCodecId(codec_id, out_profile, out_level)) {\n *codec = MimeUtil::HEVC;\n return true;\n }\n#endif\n\n#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)\n if (ParseDolbyVisionCodecId(codec_id, out_profile, out_level)) {\n *codec = MimeUtil::DOLBY_VISION;\n return true;\n }\n#endif\n\n DVLOG(2) << __func__ << \": Unrecognized codec id \" << codec_id;\n return false;\n}\n", + "target": "bool MimeUtil::ParseCodecString(const std::string& mime_type_lower_case,\n const std::string& codec_id,\n Codec* codec,\n bool* ambiguous_codec_string,\n VideoCodecProfile* out_profile,\n uint8_t* out_level,\n VideoColorSpace* out_color_space) const {\n DCHECK_EQ(base::ToLowerASCII(mime_type_lower_case), mime_type_lower_case);\n DCHECK(codec);\n DCHECK(out_profile);\n DCHECK(out_level);\n\n *codec = INVALID_CODEC;\n *ambiguous_codec_string = false;\n *out_profile = VIDEO_CODEC_PROFILE_UNKNOWN;\n *out_level = 0;\n \n // Most codec strings do not yet specify color. We choose 709 as default color\n // space elsewhere, so defaulting to 709 here as well. See here for context:\n *out_color_space = VideoColorSpace::BT709();\n \n std::map::const_iterator itr =\n GetStringToCodecMap().find(codec_id);\n if (itr != GetStringToCodecMap().end()) {\n *codec = itr->second;\n\n return true;\n }\n\n if (codec_id == \"avc1\" || codec_id == \"avc3\") {\n *codec = MimeUtil::H264;\n *ambiguous_codec_string = true;\n return true;\n } else if (codec_id == \"mp4a.40\") {\n *codec = MimeUtil::MPEG4_AAC;\n *ambiguous_codec_string = true;\n return true;\n }\n\n if (ParseVp9CodecID(mime_type_lower_case, codec_id, out_profile, out_level,\n out_color_space)) {\n *codec = MimeUtil::VP9;\n return true;\n }\n\n if (ParseAVCCodecId(codec_id, out_profile, out_level)) {\n *codec = MimeUtil::H264;\n *ambiguous_codec_string = !IsValidH264Level(*out_level);\n return true;\n }\n\n#if BUILDFLAG(ENABLE_HEVC_DEMUXING)\n if (ParseHEVCCodecId(codec_id, out_profile, out_level)) {\n *codec = MimeUtil::HEVC;\n return true;\n }\n#endif\n\n#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)\n if (ParseDolbyVisionCodecId(codec_id, out_profile, out_level)) {\n *codec = MimeUtil::DOLBY_VISION;\n return true;\n }\n#endif\n\n DVLOG(2) << __func__ << \": Unrecognized codec id \" << codec_id;\n return false;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#18dcbadf2771cdb0c18509b14e4e73505b242753", + "input": "init_rc(void)\n{\n int i;\n struct stat st;\n FILE *f;\n\n if (rc_dir != NULL)\n\tgoto open_rc;\n\n rc_dir = expandPath(RC_DIR);\n i = strlen(rc_dir);\n if (i > 1 && rc_dir[i - 1] == '/')\n\trc_dir[i - 1] = '\\0';\n\n#ifdef USE_M17N\n display_charset_str = wc_get_ces_list();\n document_charset_str = display_charset_str;\n system_charset_str = display_charset_str;\n#endif\n\n if (stat(rc_dir, &st) < 0) {\n\tif (errno == ENOENT) {\t/* no directory */\n\t if (do_mkdir(rc_dir, 0700) < 0) {\n\t\t/* fprintf(stderr, \"Can't create config directory (%s)!\\n\", rc_dir); */\n\t\tgoto rc_dir_err;\n\t }\n\t else {\n\t\tstat(rc_dir, &st);\n\t }\n\t}\n\telse {\n\t /* fprintf(stderr, \"Can't open config directory (%s)!\\n\", rc_dir); */\n\t goto rc_dir_err;\n\t}\n }\n if (!S_ISDIR(st.st_mode)) {\n\t/* not a directory */\n\t/* fprintf(stderr, \"%s is not a directory!\\n\", rc_dir); */\n\tgoto rc_dir_err;\n }\n if (!(st.st_mode & S_IWUSR)) {\n\t/* fprintf(stderr, \"%s is not writable!\\n\", rc_dir); */\n\tgoto rc_dir_err;\n }\n no_rc_dir = FALSE;\n tmp_dir = rc_dir;\n\n if (config_file == NULL)\n\tconfig_file = rcFile(CONFIG_FILE);\n\n create_option_search_table();\n\n open_rc:\n /* open config file */\n if ((f = fopen(etcFile(W3MCONFIG), \"rt\")) != NULL) {\n\tinterpret_rc(f);\n\tfclose(f);\n }\n if ((f = fopen(confFile(CONFIG_FILE), \"rt\")) != NULL) {\n\tinterpret_rc(f);\n\tfclose(f);\n }\n if (config_file && (f = fopen(config_file, \"rt\")) != NULL) {\n\tinterpret_rc(f);\n\tfclose(f);\n }\n return;\n\n rc_dir_err:\n no_rc_dir = TRUE;\n if (((tmp_dir = getenv(\"TMPDIR\")) == NULL || *tmp_dir == '\\0') &&\n \t((tmp_dir = getenv(\"TMP\")) == NULL || *tmp_dir == '\\0') &&\n \t((tmp_dir = getenv(\"TEMP\")) == NULL || *tmp_dir == '\\0'))\n \ttmp_dir = \"/tmp\";\n create_option_search_table();\n goto open_rc;\n }\n", + "target": "init_rc(void)\n{\n int i;\n struct stat st;\n FILE *f;\n\n if (rc_dir != NULL)\n\tgoto open_rc;\n\n rc_dir = expandPath(RC_DIR);\n i = strlen(rc_dir);\n if (i > 1 && rc_dir[i - 1] == '/')\n\trc_dir[i - 1] = '\\0';\n\n#ifdef USE_M17N\n display_charset_str = wc_get_ces_list();\n document_charset_str = display_charset_str;\n system_charset_str = display_charset_str;\n#endif\n\n if (stat(rc_dir, &st) < 0) {\n\tif (errno == ENOENT) {\t/* no directory */\n\t if (do_mkdir(rc_dir, 0700) < 0) {\n\t\t/* fprintf(stderr, \"Can't create config directory (%s)!\\n\", rc_dir); */\n\t\tgoto rc_dir_err;\n\t }\n\t else {\n\t\tstat(rc_dir, &st);\n\t }\n\t}\n\telse {\n\t /* fprintf(stderr, \"Can't open config directory (%s)!\\n\", rc_dir); */\n\t goto rc_dir_err;\n\t}\n }\n if (!S_ISDIR(st.st_mode)) {\n\t/* not a directory */\n\t/* fprintf(stderr, \"%s is not a directory!\\n\", rc_dir); */\n\tgoto rc_dir_err;\n }\n if (!(st.st_mode & S_IWUSR)) {\n\t/* fprintf(stderr, \"%s is not writable!\\n\", rc_dir); */\n\tgoto rc_dir_err;\n }\n no_rc_dir = FALSE;\n tmp_dir = rc_dir;\n\n if (config_file == NULL)\n\tconfig_file = rcFile(CONFIG_FILE);\n\n create_option_search_table();\n\n open_rc:\n /* open config file */\n if ((f = fopen(etcFile(W3MCONFIG), \"rt\")) != NULL) {\n\tinterpret_rc(f);\n\tfclose(f);\n }\n if ((f = fopen(confFile(CONFIG_FILE), \"rt\")) != NULL) {\n\tinterpret_rc(f);\n\tfclose(f);\n }\n if (config_file && (f = fopen(config_file, \"rt\")) != NULL) {\n\tinterpret_rc(f);\n\tfclose(f);\n }\n return;\n\n rc_dir_err:\n no_rc_dir = TRUE;\n if (((tmp_dir = getenv(\"TMPDIR\")) == NULL || *tmp_dir == '\\0') &&\n \t((tmp_dir = getenv(\"TMP\")) == NULL || *tmp_dir == '\\0') &&\n \t((tmp_dir = getenv(\"TEMP\")) == NULL || *tmp_dir == '\\0'))\n \ttmp_dir = \"/tmp\";\n#ifdef HAVE_MKDTEMP\n tmp_dir = mkdtemp(Strnew_m_charp(tmp_dir, \"/w3m-XXXXXX\", NULL)->ptr);\n if (tmp_dir == NULL)\n\ttmp_dir = rc_dir;\n#endif\n create_option_search_table();\n goto open_rc;\n }\n", + "vul_type": "cwe-59", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e9372a1bfd3588a80fcf49aa07321f0971dd6091", + "input": "v8::Handle V8DataView::getInt8Callback(const v8::Arguments& args)\n {\n INC_STATS(\"DOM.DataView.getInt8\");\n if (args.Length() < 1)\n return V8Proxy::throwNotEnoughArgumentsError();\n \n DataView* imp = V8DataView::toNative(args.Holder());\n ExceptionCode ec = 0;\n EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));\n int8_t result = imp->getInt8(byteOffset, ec);\n if (UNLIKELY(ec)) {\n V8Proxy::setDOMException(ec, args.GetIsolate());\n return v8::Handle();\n }\n return v8::Integer::New(result);\n}\n", + "target": "v8::Handle V8DataView::getInt8Callback(const v8::Arguments& args)\n {\n INC_STATS(\"DOM.DataView.getInt8\");\n if (args.Length() < 1)\n return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());\n \n DataView* imp = V8DataView::toNative(args.Holder());\n ExceptionCode ec = 0;\n EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));\n int8_t result = imp->getInt8(byteOffset, ec);\n if (UNLIKELY(ec)) {\n V8Proxy::setDOMException(ec, args.GetIsolate());\n return v8::Handle();\n }\n return v8::Integer::New(result);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8a3257b01faa899dd9b5e35c6bb3403cd709c371", + "input": "pdf_load_xobject(fz_context *ctx, pdf_document *doc, pdf_obj *dict)\n {\n pdf_xobject *form;\n \n if ((form = pdf_find_item(ctx, pdf_drop_xobject_imp, dict)) != NULL)\n return form;\n\tform->iteration = 0;\n\n\t/* Store item immediately, to avoid possible recursion if objects refer back to this one */\n\tpdf_store_item(ctx, dict, form, pdf_xobject_size(form));\n\n\tform->obj = pdf_keep_obj(ctx, dict);\n\n\treturn form;\n}\n", + "target": "pdf_load_xobject(fz_context *ctx, pdf_document *doc, pdf_obj *dict)\n {\n pdf_xobject *form;\n \n if (!pdf_is_stream(ctx, dict))\n fz_throw(ctx, FZ_ERROR_SYNTAX, \"XObject must be a stream\");\n\n if ((form = pdf_find_item(ctx, pdf_drop_xobject_imp, dict)) != NULL)\n return form;\n\tform->iteration = 0;\n\n\t/* Store item immediately, to avoid possible recursion if objects refer back to this one */\n\tpdf_store_item(ctx, dict, form, pdf_xobject_size(form));\n\n\tform->obj = pdf_keep_obj(ctx, dict);\n\n\treturn form;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#20e1db19db5d6b9e4e83021595eab0dc8f107bef", + "input": "static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,\n\t\t\t struct msghdr *msg, size_t len)\n{\n\tstruct sock_iocb *siocb = kiocb_to_siocb(kiocb);\n\tstruct sock *sk = sock->sk;\n\tstruct netlink_sock *nlk = nlk_sk(sk);\n\tstruct sockaddr_nl *addr = msg->msg_name;\n\tu32 dst_pid;\n\tu32 dst_group;\n\tstruct sk_buff *skb;\n\tint err;\n\tstruct scm_cookie scm;\n\n\tif (msg->msg_flags&MSG_OOB)\n\t\treturn -EOPNOTSUPP;\n\n\tif (NULL == siocb->scm)\n\t\tsiocb->scm = &scm;\n\n\terr = scm_send(sock, msg, siocb->scm, true);\n\tif (err < 0)\n\t\treturn err;\n\n\tif (msg->msg_namelen) {\n\t\terr = -EINVAL;\n\t\tif (addr->nl_family != AF_NETLINK)\n\t\t\tgoto out;\n \t\tdst_pid = addr->nl_pid;\n \t\tdst_group = ffs(addr->nl_groups);\n \t\terr = -EPERM;\n\t\tif (dst_group && !netlink_capable(sock, NL_NONROOT_SEND))\n \t\t\tgoto out;\n \t} else {\n \t\tdst_pid = nlk->dst_pid;\n\t\tdst_group = nlk->dst_group;\n\t}\n\n\tif (!nlk->pid) {\n\t\terr = netlink_autobind(sock);\n\t\tif (err)\n\t\t\tgoto out;\n\t}\n\n\terr = -EMSGSIZE;\n\tif (len > sk->sk_sndbuf - 32)\n\t\tgoto out;\n\terr = -ENOBUFS;\n\tskb = alloc_skb(len, GFP_KERNEL);\n\tif (skb == NULL)\n\t\tgoto out;\n\n\tNETLINK_CB(skb).pid\t= nlk->pid;\n\tNETLINK_CB(skb).dst_group = dst_group;\n\tmemcpy(NETLINK_CREDS(skb), &siocb->scm->creds, sizeof(struct ucred));\n\n\terr = -EFAULT;\n\tif (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {\n\t\tkfree_skb(skb);\n\t\tgoto out;\n\t}\n\n\terr = security_netlink_send(sk, skb);\n\tif (err) {\n\t\tkfree_skb(skb);\n\t\tgoto out;\n\t}\n\n\tif (dst_group) {\n\t\tatomic_inc(&skb->users);\n\t\tnetlink_broadcast(sk, skb, dst_pid, dst_group, GFP_KERNEL);\n\t}\n\terr = netlink_unicast(sk, skb, dst_pid, msg->msg_flags&MSG_DONTWAIT);\n\nout:\n\tscm_destroy(siocb->scm);\n\treturn err;\n}\n", + "target": "static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,\n\t\t\t struct msghdr *msg, size_t len)\n{\n\tstruct sock_iocb *siocb = kiocb_to_siocb(kiocb);\n\tstruct sock *sk = sock->sk;\n\tstruct netlink_sock *nlk = nlk_sk(sk);\n\tstruct sockaddr_nl *addr = msg->msg_name;\n\tu32 dst_pid;\n\tu32 dst_group;\n\tstruct sk_buff *skb;\n\tint err;\n\tstruct scm_cookie scm;\n\n\tif (msg->msg_flags&MSG_OOB)\n\t\treturn -EOPNOTSUPP;\n\n\tif (NULL == siocb->scm)\n\t\tsiocb->scm = &scm;\n\n\terr = scm_send(sock, msg, siocb->scm, true);\n\tif (err < 0)\n\t\treturn err;\n\n\tif (msg->msg_namelen) {\n\t\terr = -EINVAL;\n\t\tif (addr->nl_family != AF_NETLINK)\n\t\t\tgoto out;\n \t\tdst_pid = addr->nl_pid;\n \t\tdst_group = ffs(addr->nl_groups);\n \t\terr = -EPERM;\n\t\tif ((dst_group || dst_pid) &&\n\t\t !netlink_capable(sock, NL_NONROOT_SEND))\n \t\t\tgoto out;\n \t} else {\n \t\tdst_pid = nlk->dst_pid;\n\t\tdst_group = nlk->dst_group;\n\t}\n\n\tif (!nlk->pid) {\n\t\terr = netlink_autobind(sock);\n\t\tif (err)\n\t\t\tgoto out;\n\t}\n\n\terr = -EMSGSIZE;\n\tif (len > sk->sk_sndbuf - 32)\n\t\tgoto out;\n\terr = -ENOBUFS;\n\tskb = alloc_skb(len, GFP_KERNEL);\n\tif (skb == NULL)\n\t\tgoto out;\n\n\tNETLINK_CB(skb).pid\t= nlk->pid;\n\tNETLINK_CB(skb).dst_group = dst_group;\n\tmemcpy(NETLINK_CREDS(skb), &siocb->scm->creds, sizeof(struct ucred));\n\n\terr = -EFAULT;\n\tif (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {\n\t\tkfree_skb(skb);\n\t\tgoto out;\n\t}\n\n\terr = security_netlink_send(sk, skb);\n\tif (err) {\n\t\tkfree_skb(skb);\n\t\tgoto out;\n\t}\n\n\tif (dst_group) {\n\t\tatomic_inc(&skb->users);\n\t\tnetlink_broadcast(sk, skb, dst_pid, dst_group, GFP_KERNEL);\n\t}\n\terr = netlink_unicast(sk, skb, dst_pid, msg->msg_flags&MSG_DONTWAIT);\n\nout:\n\tscm_destroy(siocb->scm);\n\treturn err;\n}\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a0fe4d88137213aa24fbb16fd7eec34533345c9b", + "input": " bool IsHighDPIEnabled() {\n if (CommandLine::ForCurrentProcess()->HasSwitch(\n switches::kHighDPISupport)) {\n return CommandLine::ForCurrentProcess()->GetSwitchValueASCII(\n switches::kHighDPISupport).compare(\"1\") == 0;\n }\n return false;\n }\n", + "target": " bool IsHighDPIEnabled() {\n // Flag stored in HKEY_CURRENT_USER\\SOFTWARE\\\\Google\\\\Chrome\\\\Profile,\n // under the DWORD value high-dpi-support.\n static DWORD value = ReadRegistryValue(\n HKEY_CURRENT_USER, kRegistryProfilePath,\n kHighDPISupportW, FALSE);\n return force_highdpi_for_testing || (value == 1);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0da8b8b801f9276359262f1ef8274c7812d3dfda?w=1", + "input": "static inline void write_s3row_data(\n\tconst entity_stage3_row *r,\n\tunsigned orig_cp,\n\tenum entity_charset charset,\n\tzval *arr)\n{\n\tchar key[9] = \"\"; /* two unicode code points in UTF-8 */\n\tchar entity[LONGEST_ENTITY_LENGTH + 2] = {'&'};\n\tsize_t written_k1;\n\n\twritten_k1 = write_octet_sequence(key, charset, orig_cp);\n\n\tif (!r->ambiguous) {\n\t\tsize_t l = r->data.ent.entity_len;\n\t\tmemcpy(&entity[1], r->data.ent.entity, l);\n\t\tentity[l + 1] = ';';\n\t\tadd_assoc_stringl_ex(arr, key, written_k1 + 1, entity, l + 2, 1);\n\t} else {\n\t\tunsigned i,\n\t\t\t num_entries;\n\t\tconst entity_multicodepoint_row *mcpr = r->data.multicodepoint_table;\n\n\t\tif (mcpr[0].leading_entry.default_entity != NULL) {\n\t\t\tsize_t l = mcpr[0].leading_entry.default_entity_len;\n\t\t\tmemcpy(&entity[1], mcpr[0].leading_entry.default_entity, l);\n\t\t\tentity[l + 1] = ';';\n\t\t\tadd_assoc_stringl_ex(arr, key, written_k1 + 1, entity, l + 2, 1);\n\t\t}\n\t\tnum_entries = mcpr[0].leading_entry.size;\n\t\tfor (i = 1; i <= num_entries; i++) {\n\t\t\tsize_t l,\n\t\t\t\t written_k2;\n\t\t\tunsigned uni_cp,\n\t\t\t\t\t spe_cp;\n\n\t\t\tuni_cp = mcpr[i].normal_entry.second_cp;\n\t\t\tl = mcpr[i].normal_entry.entity_len;\n\n\t\t\tif (!CHARSET_UNICODE_COMPAT(charset)) {\n\t\t\t\tif (map_from_unicode(uni_cp, charset, &spe_cp) == FAILURE)\n\t\t\t\t\tcontinue; /* non representable in this charset */\n \t\t\t} else {\n \t\t\t\tspe_cp = uni_cp;\n \t\t\t}\n \t\t\twritten_k2 = write_octet_sequence(&key[written_k1], charset, spe_cp);\n \t\t\tmemcpy(&entity[1], mcpr[i].normal_entry.entity, l);\n \t\t\tentity[l + 1] = ';';\n\t\t\tentity[l + 1] = '\\0';\n\t\t\tadd_assoc_stringl_ex(arr, key, written_k1 + written_k2 + 1, entity, l + 1, 1);\n\t\t}\n\t}\n}\n", + "target": "static inline void write_s3row_data(\n\tconst entity_stage3_row *r,\n\tunsigned orig_cp,\n\tenum entity_charset charset,\n\tzval *arr)\n{\n\tchar key[9] = \"\"; /* two unicode code points in UTF-8 */\n\tchar entity[LONGEST_ENTITY_LENGTH + 2] = {'&'};\n\tsize_t written_k1;\n\n\twritten_k1 = write_octet_sequence(key, charset, orig_cp);\n\n\tif (!r->ambiguous) {\n\t\tsize_t l = r->data.ent.entity_len;\n\t\tmemcpy(&entity[1], r->data.ent.entity, l);\n\t\tentity[l + 1] = ';';\n\t\tadd_assoc_stringl_ex(arr, key, written_k1 + 1, entity, l + 2, 1);\n\t} else {\n\t\tunsigned i,\n\t\t\t num_entries;\n\t\tconst entity_multicodepoint_row *mcpr = r->data.multicodepoint_table;\n\n\t\tif (mcpr[0].leading_entry.default_entity != NULL) {\n\t\t\tsize_t l = mcpr[0].leading_entry.default_entity_len;\n\t\t\tmemcpy(&entity[1], mcpr[0].leading_entry.default_entity, l);\n\t\t\tentity[l + 1] = ';';\n\t\t\tadd_assoc_stringl_ex(arr, key, written_k1 + 1, entity, l + 2, 1);\n\t\t}\n\t\tnum_entries = mcpr[0].leading_entry.size;\n\t\tfor (i = 1; i <= num_entries; i++) {\n\t\t\tsize_t l,\n\t\t\t\t written_k2;\n\t\t\tunsigned uni_cp,\n\t\t\t\t\t spe_cp;\n\n\t\t\tuni_cp = mcpr[i].normal_entry.second_cp;\n\t\t\tl = mcpr[i].normal_entry.entity_len;\n\n\t\t\tif (!CHARSET_UNICODE_COMPAT(charset)) {\n\t\t\t\tif (map_from_unicode(uni_cp, charset, &spe_cp) == FAILURE)\n\t\t\t\t\tcontinue; /* non representable in this charset */\n \t\t\t} else {\n \t\t\t\tspe_cp = uni_cp;\n \t\t\t}\n\n \t\t\twritten_k2 = write_octet_sequence(&key[written_k1], charset, spe_cp);\n \t\t\tmemcpy(&entity[1], mcpr[i].normal_entry.entity, l);\n \t\t\tentity[l + 1] = ';';\n\t\t\tentity[l + 1] = '\\0';\n\t\t\tadd_assoc_stringl_ex(arr, key, written_k1 + written_k2 + 1, entity, l + 1, 1);\n\t\t}\n\t}\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2706470a422dec8f4ae2538e80f0e7e3c4f4f7f6", + "input": " void PaymentRequest::CanMakePayment() {\n if (observer_for_testing_)\n observer_for_testing_->OnCanMakePaymentCalled();\n \n if (!delegate_->GetPrefService()->GetBoolean(kCanMakePaymentEnabled) ||\n !state_) {\n CanMakePaymentCallback(/*can_make_payment=*/false);\n } else {\n state_->CanMakePayment(\n base::BindOnce(&PaymentRequest::CanMakePaymentCallback,\n weak_ptr_factory_.GetWeakPtr()));\n }\n }\n", + "target": " void PaymentRequest::CanMakePayment() {\n if (!IsInitialized()) {\n log_.Error(\"Attempted canMakePayment without initialization\");\n OnConnectionTerminated();\n return;\n }\n\n // It's valid to call canMakePayment() without calling show() first.\n\n if (observer_for_testing_)\n observer_for_testing_->OnCanMakePaymentCalled();\n \n if (!delegate_->GetPrefService()->GetBoolean(kCanMakePaymentEnabled) ||\n !state_) {\n CanMakePaymentCallback(/*can_make_payment=*/false);\n } else {\n state_->CanMakePayment(\n base::BindOnce(&PaymentRequest::CanMakePaymentCallback,\n weak_ptr_factory_.GetWeakPtr()));\n }\n }\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d27468a832d5316884bd02f459cbf493697fd7e1", + "input": " const AXObject* AXObject::ariaHiddenRoot() const {\n for (const AXObject* object = this; object; object = object->parentObject()) {\n if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), \"true\"))\n return object;\n }\n \n return 0;\n}\n", + "target": " const AXObject* AXObject::ariaHiddenRoot() const {\n for (const AXObject* object = this; object; object = object->parentObject()) {\n if (equalIgnoringASCIICase(object->getAttribute(aria_hiddenAttr), \"true\"))\n return object;\n }\n \n return 0;\n}\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc4a7391c616be7a64ed65742ef9ed3f106eb165", + "input": "l2tp_bearer_type_print(netdissect_options *ndo, const u_char *dat)\n {\n \tconst uint32_t *ptr = (const uint32_t *)dat;\n \n \tif (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {\n \t\tND_PRINT((ndo, \"A\"));\n \t}\n\tif (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {\n\t\tND_PRINT((ndo, \"D\"));\n\t}\n }\n", + "target": "l2tp_bearer_type_print(netdissect_options *ndo, const u_char *dat)\nl2tp_bearer_type_print(netdissect_options *ndo, const u_char *dat, u_int length)\n {\n \tconst uint32_t *ptr = (const uint32_t *)dat;\n \n\tif (length < 4) {\n\t\tND_PRINT((ndo, \"AVP too short\"));\n\t\treturn;\n\t}\n \tif (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {\n \t\tND_PRINT((ndo, \"A\"));\n \t}\n\tif (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {\n\t\tND_PRINT((ndo, \"D\"));\n\t}\n }\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d31f450c723ba46b53c1762e51188557447d85fd", + "input": "PassOwnPtr LayerTreeCoordinator::beginContentUpdate(const WebCore::IntSize& size, ShareableBitmap::Flags flags, ShareableSurface::Handle& handle, WebCore::IntPoint& offset)\n{\n OwnPtr graphicsContext;\n for (unsigned i = 0; i < m_updateAtlases.size(); ++i) {\n UpdateAtlas* atlas = m_updateAtlases[i].get();\n if (atlas->flags() == flags) {\n graphicsContext = atlas->beginPaintingOnAvailableBuffer(handle, size, offset);\n if (graphicsContext)\n return graphicsContext.release();\n }\n }\n \n static const int ScratchBufferDimension = 1024; // Should be a power of two.\n m_updateAtlases.append(adoptPtr(new UpdateAtlas(ScratchBufferDimension, flags)));\n return m_updateAtlases.last()->beginPaintingOnAvailableBuffer(handle, size, offset);\n }\n", + "target": "PassOwnPtr LayerTreeCoordinator::beginContentUpdate(const WebCore::IntSize& size, ShareableBitmap::Flags flags, ShareableSurface::Handle& handle, WebCore::IntPoint& offset)\n{\n OwnPtr graphicsContext;\n for (unsigned i = 0; i < m_updateAtlases.size(); ++i) {\n UpdateAtlas* atlas = m_updateAtlases[i].get();\n if (atlas->flags() == flags) {\n graphicsContext = atlas->beginPaintingOnAvailableBuffer(handle, size, offset);\n if (graphicsContext)\n return graphicsContext.release();\n }\n }\n \n static const int ScratchBufferDimension = 1024; // Should be a power of two.\n m_updateAtlases.append(adoptPtr(new UpdateAtlas(ScratchBufferDimension, flags)));\n scheduleReleaseInactiveAtlases();\n return m_updateAtlases.last()->beginPaintingOnAvailableBuffer(handle, size, offset);\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04038bf3633c4b909b5ded3072dc88c8c419bf16", + "input": "krb5_encode_krbsecretkey(krb5_key_data *key_data_in, int n_key_data,\n krb5_kvno mkvno) {\n struct berval **ret = NULL;\n int currkvno;\n int num_versions = 1;\n int i, j, last;\n krb5_error_code err = 0;\n krb5_key_data *key_data;\n \n if (n_key_data <= 0)\n return NULL;\n \n /* Make a shallow copy of the key data so we can alter it. */\n key_data = k5calloc(n_key_data, sizeof(*key_data), &err);\n if (key_data_in == NULL)\n goto cleanup;\n memcpy(key_data, key_data_in, n_key_data * sizeof(*key_data));\n \n /* Unpatched krb5 1.11 and 1.12 cannot decode KrbKey sequences with no salt\n * field. For compatibility, always encode a salt field. */\n for (i = 0; i < n_key_data; i++) {\n if (key_data[i].key_data_ver == 1) {\n key_data[i].key_data_ver = 2;\n key_data[i].key_data_type[1] = KRB5_KDB_SALTTYPE_NORMAL;\n key_data[i].key_data_length[1] = 0;\n key_data[i].key_data_contents[1] = NULL;\n }\n }\n\n /* Find the number of key versions */\n for (i = 0; i < n_key_data - 1; i++)\n if (key_data[i].key_data_kvno != key_data[i + 1].key_data_kvno)\n num_versions++;\n\n ret = (struct berval **) calloc (num_versions + 1, sizeof (struct berval *));\n if (ret == NULL) {\n err = ENOMEM;\n goto cleanup;\n }\n for (i = 0, last = 0, j = 0, currkvno = key_data[0].key_data_kvno; i < n_key_data; i++) {\n krb5_data *code;\n if (i == n_key_data - 1 || key_data[i + 1].key_data_kvno != currkvno) {\n ret[j] = k5alloc(sizeof(struct berval), &err);\n if (ret[j] == NULL)\n goto cleanup;\n err = asn1_encode_sequence_of_keys(key_data + last,\n (krb5_int16)i - last + 1,\n mkvno, &code);\n if (err)\n goto cleanup;\n /*CHECK_NULL(ret[j]); */\n ret[j]->bv_len = code->length;\n ret[j]->bv_val = code->data;\n free(code);\n j++;\n last = i + 1;\n\n if (i < n_key_data - 1)\n currkvno = key_data[i + 1].key_data_kvno;\n }\n }\n ret[num_versions] = NULL;\n\ncleanup:\n\n free(key_data);\n if (err != 0) {\n if (ret != NULL) {\n for (i = 0; i <= num_versions; i++)\n if (ret[i] != NULL)\n free (ret[i]);\n free (ret);\n ret = NULL;\n }\n }\n\n return ret;\n}\n", + "target": "krb5_encode_krbsecretkey(krb5_key_data *key_data_in, int n_key_data,\n krb5_kvno mkvno) {\n struct berval **ret = NULL;\n int currkvno;\n int num_versions = 1;\n int i, j, last;\n krb5_error_code err = 0;\n krb5_key_data *key_data = NULL;\n \n if (n_key_data < 0)\n return NULL;\n \n /* Make a shallow copy of the key data so we can alter it. */\n key_data = k5calloc(n_key_data, sizeof(*key_data), &err);\n if (key_data == NULL)\n goto cleanup;\n memcpy(key_data, key_data_in, n_key_data * sizeof(*key_data));\n \n /* Unpatched krb5 1.11 and 1.12 cannot decode KrbKey sequences with no salt\n * field. For compatibility, always encode a salt field. */\n for (i = 0; i < n_key_data; i++) {\n if (key_data[i].key_data_ver == 1) {\n key_data[i].key_data_ver = 2;\n key_data[i].key_data_type[1] = KRB5_KDB_SALTTYPE_NORMAL;\n key_data[i].key_data_length[1] = 0;\n key_data[i].key_data_contents[1] = NULL;\n }\n }\n\n /* Find the number of key versions */\n for (i = 0; i < n_key_data - 1; i++)\n if (key_data[i].key_data_kvno != key_data[i + 1].key_data_kvno)\n num_versions++;\n\n ret = (struct berval **) calloc (num_versions + 1, sizeof (struct berval *));\n if (ret == NULL) {\n err = ENOMEM;\n goto cleanup;\n }\n for (i = 0, last = 0, j = 0, currkvno = key_data[0].key_data_kvno; i < n_key_data; i++) {\n krb5_data *code;\n if (i == n_key_data - 1 || key_data[i + 1].key_data_kvno != currkvno) {\n ret[j] = k5alloc(sizeof(struct berval), &err);\n if (ret[j] == NULL)\n goto cleanup;\n err = asn1_encode_sequence_of_keys(key_data + last,\n (krb5_int16)i - last + 1,\n mkvno, &code);\n if (err)\n goto cleanup;\n /*CHECK_NULL(ret[j]); */\n ret[j]->bv_len = code->length;\n ret[j]->bv_val = code->data;\n free(code);\n j++;\n last = i + 1;\n\n if (i < n_key_data - 1)\n currkvno = key_data[i + 1].key_data_kvno;\n }\n }\n ret[num_versions] = NULL;\n\ncleanup:\n\n free(key_data);\n if (err != 0) {\n if (ret != NULL) {\n for (i = 0; ret[i] != NULL; i++)\n free (ret[i]);\n free (ret);\n ret = NULL;\n }\n }\n\n return ret;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#744692dc059845b2a3022119871846e74d4f6e11", + "input": "static int ext4_writepage(struct page *page,\n\t\t\t struct writeback_control *wbc)\n{\n \tint ret = 0;\n \tloff_t size;\n \tunsigned int len;\n\tstruct buffer_head *page_bufs;\n \tstruct inode *inode = page->mapping->host;\n \n \ttrace_ext4_writepage(inode, page);\n\tsize = i_size_read(inode);\n\tif (page->index == size >> PAGE_CACHE_SHIFT)\n\t\tlen = size & ~PAGE_CACHE_MASK;\n\telse\n\t\tlen = PAGE_CACHE_SIZE;\n\n\tif (page_has_buffers(page)) {\n\t\tpage_bufs = page_buffers(page);\n\t\tif (walk_page_buffers(NULL, page_bufs, 0, len, NULL,\n\t\t\t\t\text4_bh_delay_or_unwritten)) {\n\t\t\t/*\n\t\t\t * We don't want to do block allocation\n\t\t\t * So redirty the page and return\n\t\t\t * We may reach here when we do a journal commit\n\t\t\t * via journal_submit_inode_data_buffers.\n\t\t\t * If we don't have mapping block we just ignore\n\t\t\t * them. We can also reach here via shrink_page_list\n\t\t\t */\n\t\t\tredirty_page_for_writepage(wbc, page);\n\t\t\tunlock_page(page);\n\t\t\treturn 0;\n\t\t}\n\t} else {\n\t\t/*\n\t\t * The test for page_has_buffers() is subtle:\n\t\t * We know the page is dirty but it lost buffers. That means\n\t\t * that at some moment in time after write_begin()/write_end()\n\t\t * has been called all buffers have been clean and thus they\n\t\t * must have been written at least once. So they are all\n\t\t * mapped and we can happily proceed with mapping them\n\t\t * and writing the page.\n\t\t *\n\t\t * Try to initialize the buffer_heads and check whether\n\t\t * all are mapped and non delay. We don't want to\n\t\t * do block allocation here.\n\t\t */\n\t\tret = block_prepare_write(page, 0, len,\n\t\t\t\t\t noalloc_get_block_write);\n\t\tif (!ret) {\n\t\t\tpage_bufs = page_buffers(page);\n\t\t\t/* check whether all are mapped and non delay */\n\t\t\tif (walk_page_buffers(NULL, page_bufs, 0, len, NULL,\n\t\t\t\t\t\text4_bh_delay_or_unwritten)) {\n\t\t\t\tredirty_page_for_writepage(wbc, page);\n\t\t\t\tunlock_page(page);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t} else {\n\t\t\t/*\n\t\t\t * We can't do block allocation here\n\t\t\t * so just redity the page and unlock\n\t\t\t * and return\n\t\t\t */\n\t\t\tredirty_page_for_writepage(wbc, page);\n\t\t\tunlock_page(page);\n\t\t\treturn 0;\n\t\t}\n\t\t/* now mark the buffer_heads as dirty and uptodate */\n\t\tblock_commit_write(page, 0, len);\n\t}\n\n\tif (PageChecked(page) && ext4_should_journal_data(inode)) {\n\t\t/*\n\t\t * It's mmapped pagecache. Add buffers and journal it. There\n\t\t * doesn't seem much point in redirtying the page here.\n\t\t */\n\t\tClearPageChecked(page);\n\t\treturn __ext4_journalled_writepage(page, len);\n\t}\n \n \tif (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode))\n \t\tret = nobh_writepage(page, noalloc_get_block_write, wbc);\n\telse\n \t\tret = block_write_full_page(page, noalloc_get_block_write,\n \t\t\t\t\t wbc);\n \n\treturn ret;\n}\n", + "target": "static int ext4_writepage(struct page *page,\n\t\t\t struct writeback_control *wbc)\n{\n \tint ret = 0;\n \tloff_t size;\n \tunsigned int len;\n\tstruct buffer_head *page_bufs = NULL;\n \tstruct inode *inode = page->mapping->host;\n \n \ttrace_ext4_writepage(inode, page);\n\tsize = i_size_read(inode);\n\tif (page->index == size >> PAGE_CACHE_SHIFT)\n\t\tlen = size & ~PAGE_CACHE_MASK;\n\telse\n\t\tlen = PAGE_CACHE_SIZE;\n\n\tif (page_has_buffers(page)) {\n\t\tpage_bufs = page_buffers(page);\n\t\tif (walk_page_buffers(NULL, page_bufs, 0, len, NULL,\n\t\t\t\t\text4_bh_delay_or_unwritten)) {\n\t\t\t/*\n\t\t\t * We don't want to do block allocation\n\t\t\t * So redirty the page and return\n\t\t\t * We may reach here when we do a journal commit\n\t\t\t * via journal_submit_inode_data_buffers.\n\t\t\t * If we don't have mapping block we just ignore\n\t\t\t * them. We can also reach here via shrink_page_list\n\t\t\t */\n\t\t\tredirty_page_for_writepage(wbc, page);\n\t\t\tunlock_page(page);\n\t\t\treturn 0;\n\t\t}\n\t} else {\n\t\t/*\n\t\t * The test for page_has_buffers() is subtle:\n\t\t * We know the page is dirty but it lost buffers. That means\n\t\t * that at some moment in time after write_begin()/write_end()\n\t\t * has been called all buffers have been clean and thus they\n\t\t * must have been written at least once. So they are all\n\t\t * mapped and we can happily proceed with mapping them\n\t\t * and writing the page.\n\t\t *\n\t\t * Try to initialize the buffer_heads and check whether\n\t\t * all are mapped and non delay. We don't want to\n\t\t * do block allocation here.\n\t\t */\n\t\tret = block_prepare_write(page, 0, len,\n\t\t\t\t\t noalloc_get_block_write);\n\t\tif (!ret) {\n\t\t\tpage_bufs = page_buffers(page);\n\t\t\t/* check whether all are mapped and non delay */\n\t\t\tif (walk_page_buffers(NULL, page_bufs, 0, len, NULL,\n\t\t\t\t\t\text4_bh_delay_or_unwritten)) {\n\t\t\t\tredirty_page_for_writepage(wbc, page);\n\t\t\t\tunlock_page(page);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t} else {\n\t\t\t/*\n\t\t\t * We can't do block allocation here\n\t\t\t * so just redity the page and unlock\n\t\t\t * and return\n\t\t\t */\n\t\t\tredirty_page_for_writepage(wbc, page);\n\t\t\tunlock_page(page);\n\t\t\treturn 0;\n\t\t}\n\t\t/* now mark the buffer_heads as dirty and uptodate */\n\t\tblock_commit_write(page, 0, len);\n\t}\n\n\tif (PageChecked(page) && ext4_should_journal_data(inode)) {\n\t\t/*\n\t\t * It's mmapped pagecache. Add buffers and journal it. There\n\t\t * doesn't seem much point in redirtying the page here.\n\t\t */\n\t\tClearPageChecked(page);\n\t\treturn __ext4_journalled_writepage(page, len);\n\t}\n \n \tif (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode))\n \t\tret = nobh_writepage(page, noalloc_get_block_write, wbc);\n\telse if (page_bufs && buffer_uninit(page_bufs)) {\n\t\text4_set_bh_endio(page_bufs, inode);\n\t\tret = block_write_full_page_endio(page, noalloc_get_block_write,\n\t\t\t\t\t wbc, ext4_end_io_buffer_write);\n\t} else\n \t\tret = block_write_full_page(page, noalloc_get_block_write,\n \t\t\t\t\t wbc);\n \n\treturn ret;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6a7f59ee1b9dbc6e5cf9e5f3b306504d02b73ef0", + "input": " QString IRCView::openTags(TextHtmlData* data, int from)\n {\n QString ret, tag;\n int i = from;\n for ( ; i < data->openHtmlTags.count(); ++i)\n {\n tag = data->openHtmlTags.at(i);\n if (data->reverse)\n {\n ret += fontColorOpenTag(Preferences::self()->color(Preferences::TextViewBackground).name());\n }\n else\n {\n ret += fontColorOpenTag(data->lastFgColor);\n }\n }\n else if (tag == QLatin1String(\"span\"))\n {\n if (data->reverse)\n {\n ret += spanColorOpenTag(data->defaultColor);\n }\n else\n {\n ret += spanColorOpenTag(data->lastBgColor);\n }\n }\n else\n {\n ret += QLatin1Char('<') + tag + QLatin1Char('>');\n }\n }\n", + "target": " QString IRCView::openTags(TextHtmlData* data, int from)\n {\n QString ret, tag;\n int i = from > -1 ? from : 0;\n\n for ( ; i < data->openHtmlTags.count(); ++i)\n {\n tag = data->openHtmlTags.at(i);\n if (data->reverse)\n {\n ret += fontColorOpenTag(Preferences::self()->color(Preferences::TextViewBackground).name());\n }\n else\n {\n ret += fontColorOpenTag(data->lastFgColor);\n }\n }\n else if (tag == QLatin1String(\"span\"))\n {\n if (data->reverse)\n {\n ret += spanColorOpenTag(data->defaultColor);\n }\n else\n {\n ret += spanColorOpenTag(data->lastBgColor);\n }\n }\n else\n {\n ret += QLatin1Char('<') + tag + QLatin1Char('>');\n }\n }\n", + "vul_type": "unknown", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#65c49d5b382de4085ee5668732bcb0f6ecaf7148", + "input": "long ParseElementHeader(IMkvReader* pReader, long long& pos,\n long long stop, long long& id,\n long long& size) {\n if (stop >= 0 && pos >= stop)\n return E_FILE_FORMAT_INVALID;\n\n long len;\n\n id = ReadID(pReader, pos, len);\n\n if (id < 0)\n return E_FILE_FORMAT_INVALID;\n\n pos += len; // consume id\n\n if (stop >= 0 && pos >= stop)\n return E_FILE_FORMAT_INVALID;\n\n size = ReadUInt(pReader, pos, len);\n\n if (size < 0 || len < 1 || len > 8) {\n return E_FILE_FORMAT_INVALID;\n }\n\n const unsigned long long rollover_check =\n static_cast(pos) + len;\n if (rollover_check > LONG_LONG_MAX)\n return E_FILE_FORMAT_INVALID;\n\n pos += len; // consume length of size\n\n \n \n if (stop >= 0 && pos >= stop)\n return E_FILE_FORMAT_INVALID;\n \n return 0; // success\n}\n", + "target": "long ParseElementHeader(IMkvReader* pReader, long long& pos,\n long long stop, long long& id,\n long long& size) {\n if (stop >= 0 && pos >= stop)\n return E_FILE_FORMAT_INVALID;\n\n long len;\n\n id = ReadID(pReader, pos, len);\n\n if (id < 0)\n return E_FILE_FORMAT_INVALID;\n\n pos += len; // consume id\n\n if (stop >= 0 && pos >= stop)\n return E_FILE_FORMAT_INVALID;\n\n size = ReadUInt(pReader, pos, len);\n\n if (size < 0 || len < 1 || len > 8) {\n return E_FILE_FORMAT_INVALID;\n }\n\n const unsigned long long rollover_check =\n static_cast(pos) + len;\n if (rollover_check > LONG_LONG_MAX)\n return E_FILE_FORMAT_INVALID;\n\n pos += len; // consume length of size\n\n \n \n if (stop >= 0 && pos > stop)\n return E_FILE_FORMAT_INVALID;\n \n return 0; // success\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6c5211a0cef0cc2854eaa387e0eb036e012904d0?w=1", + "input": "PHP_FUNCTION(mcrypt_encrypt)\n{\n \tzval **mode;\n \tchar *cipher, *key, *data, *iv = NULL;\n \tint cipher_len, key_len, data_len, iv_len = 0;\n \tMCRYPT_GET_CRYPT_ARGS\n \tconvert_to_string_ex(mode);\n \n \tphp_mcrypt_do_crypt(cipher, key, key_len, data, data_len, Z_STRVAL_PP(mode), iv, iv_len, ZEND_NUM_ARGS(), MCRYPT_ENCRYPT, return_value TSRMLS_CC);\n}\n", + "target": "PHP_FUNCTION(mcrypt_encrypt)\n{\n \tzval **mode;\n \tchar *cipher, *key, *data, *iv = NULL;\n \tint cipher_len, key_len, data_len, iv_len = 0;\n\n \tMCRYPT_GET_CRYPT_ARGS\n\n \tconvert_to_string_ex(mode);\n \n \tphp_mcrypt_do_crypt(cipher, key, key_len, data, data_len, Z_STRVAL_PP(mode), iv, iv_len, ZEND_NUM_ARGS(), MCRYPT_ENCRYPT, return_value TSRMLS_CC);\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e9372a1bfd3588a80fcf49aa07321f0971dd6091", + "input": "static v8::Handle serializedValueCallback(const v8::Arguments& args)\n {\n INC_STATS(\"DOM.TestObj.serializedValue\");\n if (args.Length() < 1)\n return V8Proxy::throwNotEnoughArgumentsError();\n TestObj* imp = V8TestObj::toNative(args.Holder());\n bool serializedArgDidThrow = false;\n RefPtr serializedArg = SerializedScriptValue::create(args[0], 0, 0, serializedArgDidThrow, args.GetIsolate());\n if (serializedArgDidThrow)\n return v8::Undefined();\n imp->serializedValue(serializedArg);\n return v8::Handle();\n}\n", + "target": "static v8::Handle serializedValueCallback(const v8::Arguments& args)\n {\n INC_STATS(\"DOM.TestObj.serializedValue\");\n if (args.Length() < 1)\n return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());\n TestObj* imp = V8TestObj::toNative(args.Holder());\n bool serializedArgDidThrow = false;\n RefPtr serializedArg = SerializedScriptValue::create(args[0], 0, 0, serializedArgDidThrow, args.GetIsolate());\n if (serializedArgDidThrow)\n return v8::Undefined();\n imp->serializedValue(serializedArg);\n return v8::Handle();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "transform_name(int t)\n /* The name, if 't' has multiple bits set the name of the lowest set bit is\n * returned.\n */\n{\n unsigned int i;\n\n \n t &= -t; /* first set bit */\n \n for (i=0; i PIPE_SHADER_GEOMETRY)\n return EINVAL;\n\n if (offlen & VIRGL_OBJ_SHADER_OFFSET_CONT)\n new_shader = false;\n else if (((offlen + 3) / 4) > pkt_length)\n long_shader = true;\n\n /* if we have an in progress one - don't allow a new shader\n of that type or a different handle. */\n if (ctx->sub->long_shader_in_progress_handle[type]) {\n if (new_shader == true)\n return EINVAL;\n if (handle != ctx->sub->long_shader_in_progress_handle[type])\n return EINVAL;\n }\n\n if (new_shader) {\n sel = vrend_create_shader_state(ctx, so_info, type);\n if (sel == NULL)\n return ENOMEM;\n\n if (long_shader) {\n sel->buf_len = ((offlen + 3) / 4) * 4; /* round up buffer size */\n sel->tmp_buf = malloc(sel->buf_len);\n if (!sel->tmp_buf) {\n ret = ENOMEM;\n goto error;\n }\n memcpy(sel->tmp_buf, shd_text, pkt_length * 4);\n sel->buf_offset = pkt_length * 4;\n ctx->sub->long_shader_in_progress_handle[type] = handle;\n } else\n finished = true;\n } else {\n sel = vrend_object_lookup(ctx->sub->object_hash, handle, VIRGL_OBJECT_SHADER);\n if (!sel) {\n fprintf(stderr, \"got continuation without original shader %d\\n\", handle);\n ret = EINVAL;\n goto error;\n }\n\n offlen &= ~VIRGL_OBJ_SHADER_OFFSET_CONT;\n if (offlen != sel->buf_offset) {\n fprintf(stderr, \"Got mismatched shader continuation %d vs %d\\n\",\n offlen, sel->buf_offset);\n ret = EINVAL;\n goto error;\n }\n if ((pkt_length * 4 + sel->buf_offset) > sel->buf_len) {\n fprintf(stderr, \"Got too large shader continuation %d vs %d\\n\",\n pkt_length * 4 + sel->buf_offset, sel->buf_len);\n shd_text = sel->tmp_buf;\n }\n }\n\n if (finished) {\n struct tgsi_token *tokens;\n\n tokens = calloc(num_tokens + 10, sizeof(struct tgsi_token));\n if (!tokens) {\n ret = ENOMEM;\n goto error;\n }\n\n if (vrend_dump_shaders)\n fprintf(stderr,\"shader\\n%s\\n\", shd_text);\n if (!tgsi_text_translate((const char *)shd_text, tokens, num_tokens + 10)) {\n free(tokens);\n ret = EINVAL;\n goto error;\n }\n\n if (vrend_finish_shader(ctx, sel, tokens)) {\n free(tokens);\n ret = EINVAL;\n goto error;\n } else {\n free(sel->tmp_buf);\n sel->tmp_buf = NULL;\n }\n free(tokens);\n ctx->sub->long_shader_in_progress_handle[type] = 0;\n }\n\n if (new_shader) {\n ret_handle = vrend_renderer_object_insert(ctx, sel, sizeof(*sel), handle, VIRGL_OBJECT_SHADER);\n if (ret_handle == 0) {\n ret = ENOMEM;\n goto error;\n }\n }\n\n return 0;\n\nerror:\n if (new_shader)\n vrend_destroy_shader_selector(sel);\n else\n vrend_renderer_object_destroy(ctx, handle);\n\n return ret;\n}\n", + "target": "int vrend_create_shader(struct vrend_context *ctx,\n uint32_t handle,\n const struct pipe_stream_output_info *so_info,\n const char *shd_text, uint32_t offlen, uint32_t num_tokens,\n uint32_t type, uint32_t pkt_length)\n{\n struct vrend_shader_selector *sel = NULL;\n int ret_handle;\n bool new_shader = true, long_shader = false;\n bool finished = false;\n int ret;\n\n if (type > PIPE_SHADER_GEOMETRY)\n return EINVAL;\n\n if (offlen & VIRGL_OBJ_SHADER_OFFSET_CONT)\n new_shader = false;\n else if (((offlen + 3) / 4) > pkt_length)\n long_shader = true;\n\n /* if we have an in progress one - don't allow a new shader\n of that type or a different handle. */\n if (ctx->sub->long_shader_in_progress_handle[type]) {\n if (new_shader == true)\n return EINVAL;\n if (handle != ctx->sub->long_shader_in_progress_handle[type])\n return EINVAL;\n }\n\n if (new_shader) {\n sel = vrend_create_shader_state(ctx, so_info, type);\n if (sel == NULL)\n return ENOMEM;\n\n if (long_shader) {\n sel->buf_len = ((offlen + 3) / 4) * 4; /* round up buffer size */\n sel->tmp_buf = malloc(sel->buf_len);\n if (!sel->tmp_buf) {\n ret = ENOMEM;\n goto error;\n }\n memcpy(sel->tmp_buf, shd_text, pkt_length * 4);\n sel->buf_offset = pkt_length * 4;\n ctx->sub->long_shader_in_progress_handle[type] = handle;\n } else\n finished = true;\n } else {\n sel = vrend_object_lookup(ctx->sub->object_hash, handle, VIRGL_OBJECT_SHADER);\n if (!sel) {\n fprintf(stderr, \"got continuation without original shader %d\\n\", handle);\n ret = EINVAL;\n goto error;\n }\n\n offlen &= ~VIRGL_OBJ_SHADER_OFFSET_CONT;\n if (offlen != sel->buf_offset) {\n fprintf(stderr, \"Got mismatched shader continuation %d vs %d\\n\",\n offlen, sel->buf_offset);\n ret = EINVAL;\n goto error;\n }\n\n /*make sure no overflow */\n if (pkt_length * 4 < pkt_length ||\n pkt_length * 4 + sel->buf_offset < pkt_length * 4 ||\n pkt_length * 4 + sel->buf_offset < sel->buf_offset) {\n ret = EINVAL;\n goto error;\n }\n\n if ((pkt_length * 4 + sel->buf_offset) > sel->buf_len) {\n fprintf(stderr, \"Got too large shader continuation %d vs %d\\n\",\n pkt_length * 4 + sel->buf_offset, sel->buf_len);\n shd_text = sel->tmp_buf;\n }\n }\n\n if (finished) {\n struct tgsi_token *tokens;\n\n tokens = calloc(num_tokens + 10, sizeof(struct tgsi_token));\n if (!tokens) {\n ret = ENOMEM;\n goto error;\n }\n\n if (vrend_dump_shaders)\n fprintf(stderr,\"shader\\n%s\\n\", shd_text);\n if (!tgsi_text_translate((const char *)shd_text, tokens, num_tokens + 10)) {\n free(tokens);\n ret = EINVAL;\n goto error;\n }\n\n if (vrend_finish_shader(ctx, sel, tokens)) {\n free(tokens);\n ret = EINVAL;\n goto error;\n } else {\n free(sel->tmp_buf);\n sel->tmp_buf = NULL;\n }\n free(tokens);\n ctx->sub->long_shader_in_progress_handle[type] = 0;\n }\n\n if (new_shader) {\n ret_handle = vrend_renderer_object_insert(ctx, sel, sizeof(*sel), handle, VIRGL_OBJECT_SHADER);\n if (ret_handle == 0) {\n ret = ENOMEM;\n goto error;\n }\n }\n\n return 0;\n\nerror:\n if (new_shader)\n vrend_destroy_shader_selector(sel);\n else\n vrend_renderer_object_destroy(ctx, handle);\n\n return ret;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3b006ededaf351f1723aea6c727c9edd1b1fff9b", + "input": "static void Process_ipfix_template_withdraw(exporter_ipfix_domain_t *exporter, void *DataPtr, uint32_t size_left, FlowSource_t *fs) {\nipfix_template_record_t *ipfix_template_record;\n\n \twhile ( size_left ) {\n \t\tuint32_t id;\n \n \t\tipfix_template_record = (ipfix_template_record_t *)DataPtr;\n \t\tsize_left \t\t-= 4;\n\n\t\tid \t = ntohs(ipfix_template_record->TemplateID);\n\n\t\tif ( id == IPFIX_TEMPLATE_FLOWSET_ID ) {\n\t\t\tremove_all_translation_tables(exporter);\n\t\t\tReInitExtensionMapList(fs);\n\t\t} else {\n\t\t\tremove_translation_table(fs, exporter, id);\n\t\t}\n\n\t\tDataPtr = DataPtr + 4;\n\t\tif ( size_left < 4 ) {\n\t\t\tdbg_printf(\"Skip %u bytes padding\\n\", size_left);\n\t\t\tsize_left = 0;\n\t\t}\n\t}\n \n} // End of Process_ipfix_template_withdraw\n", + "target": "static void Process_ipfix_template_withdraw(exporter_ipfix_domain_t *exporter, void *DataPtr, uint32_t size_left, FlowSource_t *fs) {\nipfix_template_record_t *ipfix_template_record;\n\n \twhile ( size_left ) {\n \t\tuint32_t id;\n \n\t\tif ( size_left < 4 ) {\n\t\t\tLogError(\"Process_ipfix [%u] Template withdraw size error at %s line %u\" , \n\t\t\t\texporter->info.id, __FILE__, __LINE__, strerror (errno));\n\t\t\tsize_left = 0;\n\t\t\tcontinue;\n\t\t}\n\n\n \t\tipfix_template_record = (ipfix_template_record_t *)DataPtr;\n \t\tsize_left \t\t-= 4;\n\n\t\tid \t = ntohs(ipfix_template_record->TemplateID);\n\n\t\tif ( id == IPFIX_TEMPLATE_FLOWSET_ID ) {\n\t\t\tremove_all_translation_tables(exporter);\n\t\t\tReInitExtensionMapList(fs);\n\t\t} else {\n\t\t\tremove_translation_table(fs, exporter, id);\n\t\t}\n\n\t\tDataPtr = DataPtr + 4;\n\t\tif ( size_left < 4 ) {\n\t\t\tdbg_printf(\"Skip %u bytes padding\\n\", size_left);\n\t\t\tsize_left = 0;\n\t\t}\n\t}\n \n} // End of Process_ipfix_template_withdraw\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dccda88f27a084bcbbb30198ace12b4e7ae961cc", + "input": "static void _xml_add_to_info(xml_parser *parser,char *name)\n{\n\tzval **element, *values;\n\n\tif (! parser->info) {\n\t\treturn;\n\t}\n \n if (zend_hash_find(Z_ARRVAL_P(parser->info),name,strlen(name) + 1,(void **) &element) == FAILURE) {\n MAKE_STD_ZVAL(values);\n array_init(values);\n zend_hash_update(Z_ARRVAL_P(parser->info), name, strlen(name)+1, (void *) &values, sizeof(zval*), (void **) &element);\n } \n add_next_index_long(*element,parser->curtag);\n parser->curtag++;\n }\n", + "target": "static void _xml_add_to_info(xml_parser *parser,char *name)\n{\n\tzval **element, *values;\n\n\tif (! parser->info) {\n\t\treturn;\n\t}\n \n if (zend_hash_find(Z_ARRVAL_P(parser->info),name,strlen(name) + 1,(void **) &element) == FAILURE) {\n MAKE_STD_ZVAL(values);\n\n array_init(values);\n\n zend_hash_update(Z_ARRVAL_P(parser->info), name, strlen(name)+1, (void *) &values, sizeof(zval*), (void **) &element);\n }\n\n add_next_index_long(*element,parser->curtag);\n\n parser->curtag++;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4a04f814b15762eb446a5ead4d69d021512df6f8", + "input": "BuildTestPacket(uint16_t id, uint16_t off, int mf, const char content,\n int content_len)\n {\n Packet *p = NULL;\n int hlen = 20;\n int ttl = 64;\n uint8_t *pcontent;\n IPV4Hdr ip4h;\n\n p = SCCalloc(1, sizeof(*p) + default_packet_size);\n if (unlikely(p == NULL))\n return NULL;\n\n PACKET_INITIALIZE(p);\n\n gettimeofday(&p->ts, NULL);\n ip4h.ip_verhl = 4 << 4;\n ip4h.ip_verhl |= hlen >> 2;\n ip4h.ip_len = htons(hlen + content_len);\n ip4h.ip_id = htons(id);\n ip4h.ip_off = htons(off);\n if (mf)\n ip4h.ip_off = htons(IP_MF | off);\n else\n ip4h.ip_off = htons(off);\n ip4h.ip_ttl = ttl;\n ip4h.ip_proto = IPPROTO_ICMP;\n \n ip4h.s_ip_src.s_addr = 0x01010101; /* 1.1.1.1 */\n ip4h.s_ip_dst.s_addr = 0x02020202; /* 2.2.2.2 */\n\n /* copy content_len crap, we need full length */\n PacketCopyData(p, (uint8_t *)&ip4h, sizeof(ip4h));\n p->ip4h = (IPV4Hdr *)GET_PKT_DATA(p);\n SET_IPV4_SRC_ADDR(p, &p->src);\n SET_IPV4_DST_ADDR(p, &p->dst);\n\n pcontent = SCCalloc(1, content_len);\n if (unlikely(pcontent == NULL))\n return NULL;\n memset(pcontent, content, content_len);\n PacketCopyDataOffset(p, hlen, pcontent, content_len);\n SET_PKT_LEN(p, hlen + content_len);\n SCFree(pcontent);\n\n p->ip4h->ip_csum = IPV4CalculateChecksum((uint16_t *)GET_PKT_DATA(p), hlen);\n\n /* Self test. */\n if (IPV4_GET_VER(p) != 4)\n goto error;\n if (IPV4_GET_HLEN(p) != hlen)\n goto error;\n if (IPV4_GET_IPLEN(p) != hlen + content_len)\n goto error;\n if (IPV4_GET_IPID(p) != id)\n goto error;\n if (IPV4_GET_IPOFFSET(p) != off)\n goto error;\n if (IPV4_GET_MF(p) != mf)\n goto error;\n if (IPV4_GET_IPTTL(p) != ttl)\n goto error;\n if (IPV4_GET_IPPROTO(p) != IPPROTO_ICMP)\n goto error;\n \n return p;\nerror:\n if (p != NULL)\n SCFree(p);\n return NULL;\n}\n", + "target": "BuildTestPacket(uint16_t id, uint16_t off, int mf, const char content,\nBuildTestPacket(uint8_t proto, uint16_t id, uint16_t off, int mf,\n const char content, int content_len)\n {\n Packet *p = NULL;\n int hlen = 20;\n int ttl = 64;\n uint8_t *pcontent;\n IPV4Hdr ip4h;\n\n p = SCCalloc(1, sizeof(*p) + default_packet_size);\n if (unlikely(p == NULL))\n return NULL;\n\n PACKET_INITIALIZE(p);\n\n gettimeofday(&p->ts, NULL);\n ip4h.ip_verhl = 4 << 4;\n ip4h.ip_verhl |= hlen >> 2;\n ip4h.ip_len = htons(hlen + content_len);\n ip4h.ip_id = htons(id);\n ip4h.ip_off = htons(off);\n if (mf)\n ip4h.ip_off = htons(IP_MF | off);\n else\n ip4h.ip_off = htons(off);\n ip4h.ip_ttl = ttl;\n ip4h.ip_proto = proto;\n \n ip4h.s_ip_src.s_addr = 0x01010101; /* 1.1.1.1 */\n ip4h.s_ip_dst.s_addr = 0x02020202; /* 2.2.2.2 */\n\n /* copy content_len crap, we need full length */\n PacketCopyData(p, (uint8_t *)&ip4h, sizeof(ip4h));\n p->ip4h = (IPV4Hdr *)GET_PKT_DATA(p);\n SET_IPV4_SRC_ADDR(p, &p->src);\n SET_IPV4_DST_ADDR(p, &p->dst);\n\n pcontent = SCCalloc(1, content_len);\n if (unlikely(pcontent == NULL))\n return NULL;\n memset(pcontent, content, content_len);\n PacketCopyDataOffset(p, hlen, pcontent, content_len);\n SET_PKT_LEN(p, hlen + content_len);\n SCFree(pcontent);\n\n p->ip4h->ip_csum = IPV4CalculateChecksum((uint16_t *)GET_PKT_DATA(p), hlen);\n\n /* Self test. */\n if (IPV4_GET_VER(p) != 4)\n goto error;\n if (IPV4_GET_HLEN(p) != hlen)\n goto error;\n if (IPV4_GET_IPLEN(p) != hlen + content_len)\n goto error;\n if (IPV4_GET_IPID(p) != id)\n goto error;\n if (IPV4_GET_IPOFFSET(p) != off)\n goto error;\n if (IPV4_GET_MF(p) != mf)\n goto error;\n if (IPV4_GET_IPTTL(p) != ttl)\n goto error;\n if (IPV4_GET_IPPROTO(p) != proto)\n goto error;\n \n return p;\nerror:\n if (p != NULL)\n SCFree(p);\n return NULL;\n}\n", + "vul_type": "cwe-358", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3f71619ec516f553c69a08bf373dcde14e86d08f", + "input": "void ZeroSuggestProvider::Start(const AutocompleteInput& input,\n bool minimal_changes) {\n TRACE_EVENT0(\"omnibox\", \"ZeroSuggestProvider::Start\");\n matches_.clear();\n if (!input.from_omnibox_focus() || client()->IsOffTheRecord() ||\n input.type() == metrics::OmniboxInputType::INVALID)\n return;\n\n Stop(true, false);\n set_field_trial_triggered(false);\n set_field_trial_triggered_in_session(false);\n results_from_cache_ = false;\n permanent_text_ = input.text();\n current_query_ = input.current_url().spec();\n current_title_ = input.current_title();\n current_page_classification_ = input.current_page_classification();\n current_url_match_ = MatchForCurrentURL();\n \n std::string url_string = GetContextualSuggestionsUrl();\n GURL suggest_url(url_string);\n if (!suggest_url.is_valid())\n return;\n \n const TemplateURLService* template_url_service =\n client()->GetTemplateURLService();\n const TemplateURL* default_provider =\n template_url_service->GetDefaultSearchProvider();\n const bool can_send_current_url =\n CanSendURL(input.current_url(), suggest_url, default_provider,\n current_page_classification_,\n template_url_service->search_terms_data(), client());\n GURL arbitrary_insecure_url(kArbitraryInsecureUrlString);\n ZeroSuggestEligibility eligibility = ZeroSuggestEligibility::ELIGIBLE;\n if (!can_send_current_url) {\n const bool can_send_ordinary_url =\n CanSendURL(arbitrary_insecure_url, suggest_url, default_provider,\n current_page_classification_,\n template_url_service->search_terms_data(), client());\n eligibility = can_send_ordinary_url\n ? ZeroSuggestEligibility::URL_INELIGIBLE\n : ZeroSuggestEligibility::GENERALLY_INELIGIBLE;\n }\n UMA_HISTOGRAM_ENUMERATION(\n \"Omnibox.ZeroSuggest.Eligible.OnFocus\", static_cast(eligibility),\n static_cast(ZeroSuggestEligibility::ELIGIBLE_MAX_VALUE));\n if (can_send_current_url &&\n !OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial() &&\n !OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial()) {\n if (OmniboxFieldTrial::InZeroSuggestRedirectToChromeFieldTrial()) {\n url_string +=\n \"/url=\" + net::EscapePath(current_query_) +\n OmniboxFieldTrial::ZeroSuggestRedirectToChromeAdditionalFields();\n suggest_url = GURL(url_string);\n } else {\n base::string16 prefix;\n TemplateURLRef::SearchTermsArgs search_term_args(prefix);\n search_term_args.current_page_url = current_query_;\n suggest_url =\n GURL(default_provider->suggestions_url_ref().ReplaceSearchTerms(\n search_term_args, template_url_service->search_terms_data()));\n }\n } else if (!ShouldShowNonContextualZeroSuggest(input.current_url())) {\n return;\n }\n\n done_ = false;\n MaybeUseCachedSuggestions();\n Run(suggest_url);\n}\n", + "target": "void ZeroSuggestProvider::Start(const AutocompleteInput& input,\n bool minimal_changes) {\n TRACE_EVENT0(\"omnibox\", \"ZeroSuggestProvider::Start\");\n matches_.clear();\n if (!input.from_omnibox_focus() || client()->IsOffTheRecord() ||\n input.type() == metrics::OmniboxInputType::INVALID)\n return;\n\n Stop(true, false);\n set_field_trial_triggered(false);\n set_field_trial_triggered_in_session(false);\n results_from_cache_ = false;\n permanent_text_ = input.text();\n current_query_ = input.current_url().spec();\n current_title_ = input.current_title();\n current_page_classification_ = input.current_page_classification();\n current_url_match_ = MatchForCurrentURL();\n \n GURL suggest_url(GetContextualSuggestionsUrl());\n if (!suggest_url.is_valid())\n return;\n \n const TemplateURLService* template_url_service =\n client()->GetTemplateURLService();\n const TemplateURL* default_provider =\n template_url_service->GetDefaultSearchProvider();\n const bool can_send_current_url =\n CanSendURL(input.current_url(), suggest_url, default_provider,\n current_page_classification_,\n template_url_service->search_terms_data(), client());\n GURL arbitrary_insecure_url(kArbitraryInsecureUrlString);\n ZeroSuggestEligibility eligibility = ZeroSuggestEligibility::ELIGIBLE;\n if (!can_send_current_url) {\n const bool can_send_ordinary_url =\n CanSendURL(arbitrary_insecure_url, suggest_url, default_provider,\n current_page_classification_,\n template_url_service->search_terms_data(), client());\n eligibility = can_send_ordinary_url\n ? ZeroSuggestEligibility::URL_INELIGIBLE\n : ZeroSuggestEligibility::GENERALLY_INELIGIBLE;\n }\n UMA_HISTOGRAM_ENUMERATION(\n \"Omnibox.ZeroSuggest.Eligible.OnFocus\", static_cast(eligibility),\n static_cast(ZeroSuggestEligibility::ELIGIBLE_MAX_VALUE));\n if (can_send_current_url &&\n !OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial() &&\n !OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial()) {\n if (UseExperimentalSuggestService(*template_url_service)) {\n suggest_url = GURL(\n OmniboxFieldTrial::ZeroSuggestRedirectToChromeServerAddress() +\n \"/url=\" + net::EscapePath(current_query_) +\n OmniboxFieldTrial::ZeroSuggestRedirectToChromeAdditionalFields());\n } else {\n base::string16 prefix;\n TemplateURLRef::SearchTermsArgs search_term_args(prefix);\n search_term_args.current_page_url = current_query_;\n suggest_url =\n GURL(default_provider->suggestions_url_ref().ReplaceSearchTerms(\n search_term_args, template_url_service->search_terms_data()));\n }\n } else if (!ShouldShowNonContextualZeroSuggest(input.current_url())) {\n return;\n }\n\n done_ = false;\n MaybeUseCachedSuggestions();\n Run(suggest_url);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b944f670bb7a8a919daac497a4ea0536c954c201", + "input": "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongArray(ExecState* exec)\n{\n JSValue thisValue = exec->hostThisValue();\n if (!thisValue.inherits(&JSTestObj::s_info))\n return throwVMTypeError(exec);\n JSTestObj* castedThis = jsCast(asObject(thisValue));\n ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);\n TestObj* impl = static_cast(castedThis->impl());\n if (exec->argumentCount() < 1)\n return throwVMError(exec, createTypeError(exec, \"Not enough arguments\"));\n Vector unsignedLongArray(jsUnsignedLongArrayToVector(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n impl->methodWithUnsignedLongArray(unsignedLongArray);\n return JSValue::encode(jsUndefined());\n}\n", + "target": "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongArray(ExecState* exec)\n{\n JSValue thisValue = exec->hostThisValue();\n if (!thisValue.inherits(&JSTestObj::s_info))\n return throwVMTypeError(exec);\n JSTestObj* castedThis = jsCast(asObject(thisValue));\n ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);\n TestObj* impl = static_cast(castedThis->impl());\n if (exec->argumentCount() < 1)\n return throwVMError(exec, createNotEnoughArgumentsError(exec));\n Vector unsignedLongArray(jsUnsignedLongArrayToVector(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n impl->methodWithUnsignedLongArray(unsignedLongArray);\n return JSValue::encode(jsUndefined());\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#55ef04e135edaa9abfbf3647634b11ed57dc49e9", + "input": "uint32 ResourceTracker::GetLiveObjectsForInstance(\n PP_Instance instance) const {\n InstanceMap::const_iterator found = instance_map_.find(instance);\n if (found == instance_map_.end())\n return 0;\n return static_cast(found->second->resources.size() +\n found->second->object_vars.size());\n }\n", + "target": "uint32 ResourceTracker::GetLiveObjectsForInstance(\n PP_Instance instance) const {\n InstanceMap::const_iterator found = instance_map_.find(instance);\n if (found == instance_map_.end())\n return 0;\n return static_cast(found->second->ref_resources.size() +\n found->second->object_vars.size());\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " void CheckSADs() {\n unsigned int reference_sad, exp_sad[4];\n \n SADs(exp_sad);\n for (int block = 0; block < 4; block++) {\n reference_sad = ReferenceSAD(UINT_MAX, block);\n \n EXPECT_EQ(exp_sad[block], reference_sad) << \"block \" << block;\n }\n }\n", + "target": " void CheckSADs() {\n unsigned int reference_sad, exp_sad[4];\n \n SADs(exp_sad);\n for (int block = 0; block < 4; ++block) {\n reference_sad = ReferenceSAD(block);\n \n EXPECT_EQ(reference_sad, exp_sad[block]) << \"block \" << block;\n }\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#69b4b9ef7455753b12c3efe4eec71647e6fb1da1", + "input": "void WarmupURLFetcher::FetchWarmupURL(\n size_t previous_attempt_counts,\n const DataReductionProxyServer& proxy_server) {\n DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);\n \n previous_attempt_counts_ = previous_attempt_counts;\n \n DCHECK_LE(0u, previous_attempt_counts_);\n DCHECK_GE(2u, previous_attempt_counts_);\n\n fetch_delay_timer_.Stop();\n\n if (previous_attempt_counts_ == 0) {\n FetchWarmupURLNow(proxy_server);\n return;\n }\n fetch_delay_timer_.Start(\n FROM_HERE, GetFetchWaitTime(),\n base::BindOnce(&WarmupURLFetcher::FetchWarmupURLNow,\n base::Unretained(this), proxy_server));\n}\n", + "target": "void WarmupURLFetcher::FetchWarmupURL(\n size_t previous_attempt_counts,\n const DataReductionProxyServer& proxy_server) {\n DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);\n DCHECK(!params::IsIncludedInHoldbackFieldTrial());\n \n previous_attempt_counts_ = previous_attempt_counts;\n \n DCHECK_LE(0u, previous_attempt_counts_);\n DCHECK_GE(2u, previous_attempt_counts_);\n\n fetch_delay_timer_.Stop();\n\n if (previous_attempt_counts_ == 0) {\n FetchWarmupURLNow(proxy_server);\n return;\n }\n fetch_delay_timer_.Start(\n FROM_HERE, GetFetchWaitTime(),\n base::BindOnce(&WarmupURLFetcher::FetchWarmupURLNow,\n base::Unretained(this), proxy_server));\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#635682a14427d241bab7bbdeebb48a7d7b91638e", + "input": " static void sctp_generate_timeout_event(struct sctp_association *asoc,\n \t\t\t\t\tsctp_event_timeout_t timeout_type)\n {\n\tstruct net *net = sock_net(asoc->base.sk);\n \tint error = 0;\n \n\tbh_lock_sock(asoc->base.sk);\n\tif (sock_owned_by_user(asoc->base.sk)) {\n \t\tpr_debug(\"%s: sock is busy: timer %d\\n\", __func__,\n \t\t\t timeout_type);\n \n\t\t/* Try again later. */\n\t\tif (!mod_timer(&asoc->timers[timeout_type], jiffies + (HZ/20)))\n\t\t\tsctp_association_hold(asoc);\n\t\tgoto out_unlock;\n\t}\n\n\t/* Is this association really dead and just waiting around for\n\t * the timer to let go of the reference?\n\t */\n\tif (asoc->base.dead)\n\t\tgoto out_unlock;\n\n\t/* Run through the state machine. */\n\terror = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT,\n\t\t\t SCTP_ST_TIMEOUT(timeout_type),\n\t\t\t asoc->state, asoc->ep, asoc,\n \t\t\t (void *)timeout_type, GFP_ATOMIC);\n \n \tif (error)\n\t\tasoc->base.sk->sk_err = -error;\n \n out_unlock:\n\tbh_unlock_sock(asoc->base.sk);\n \tsctp_association_put(asoc);\n }\n", + "target": " static void sctp_generate_timeout_event(struct sctp_association *asoc,\n \t\t\t\t\tsctp_event_timeout_t timeout_type)\n {\n\tstruct sock *sk = asoc->base.sk;\n\tstruct net *net = sock_net(sk);\n \tint error = 0;\n \n\tbh_lock_sock(sk);\n\tif (sock_owned_by_user(sk)) {\n \t\tpr_debug(\"%s: sock is busy: timer %d\\n\", __func__,\n \t\t\t timeout_type);\n \n\t\t/* Try again later. */\n\t\tif (!mod_timer(&asoc->timers[timeout_type], jiffies + (HZ/20)))\n\t\t\tsctp_association_hold(asoc);\n\t\tgoto out_unlock;\n\t}\n\n\t/* Is this association really dead and just waiting around for\n\t * the timer to let go of the reference?\n\t */\n\tif (asoc->base.dead)\n\t\tgoto out_unlock;\n\n\t/* Run through the state machine. */\n\terror = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT,\n\t\t\t SCTP_ST_TIMEOUT(timeout_type),\n\t\t\t asoc->state, asoc->ep, asoc,\n \t\t\t (void *)timeout_type, GFP_ATOMIC);\n \n \tif (error)\n\t\tsk->sk_err = -error;\n \n out_unlock:\n\tbh_unlock_sock(sk);\n \tsctp_association_put(asoc);\n }\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c0569cc04741cccf6548c2169fcc1609d958523f", + "input": " TestFeaturesNativeHandler::TestFeaturesNativeHandler(ScriptContext* context)\n : ObjectBackedNativeHandler(context) {\n RouteFunction(\"GetAPIFeatures\",\n base::Bind(&TestFeaturesNativeHandler::GetAPIFeatures,\n base::Unretained(this)));\n }\n", + "target": " TestFeaturesNativeHandler::TestFeaturesNativeHandler(ScriptContext* context)\n : ObjectBackedNativeHandler(context) {\n RouteFunction(\"GetAPIFeatures\", \"test\",\n base::Bind(&TestFeaturesNativeHandler::GetAPIFeatures,\n base::Unretained(this)));\n }\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#13c149b051f82b709e8d7cc32111e84b49d57234", + "input": "rad_get_vendor_attr(u_int32_t *vendor, const void **data, size_t *len)\n {\n \tstruct vendor_attribute *attr;\n \n\tattr = (struct vendor_attribute *)*data;\n \t*vendor = ntohl(attr->vendor_value);\n \t*data = attr->attrib_data;\n \t*len = attr->attrib_len - 2;\n \n \treturn (attr->attrib_type);\n }\n", + "target": "rad_get_vendor_attr(u_int32_t *vendor, const void **data, size_t *len)\nrad_get_vendor_attr(u_int32_t *vendor, unsigned char *type, const void **data, size_t *len, const void *raw, size_t raw_len)\n {\n \tstruct vendor_attribute *attr;\n \n\tif (raw_len < sizeof(struct vendor_attribute)) {\n\t\treturn -1;\n\t}\n\n\tattr = (struct vendor_attribute *) raw;\n \t*vendor = ntohl(attr->vendor_value);\n\t*type = attr->attrib_type;\n \t*data = attr->attrib_data;\n \t*len = attr->attrib_len - 2;\n \n\tif ((attr->attrib_len + 4) > raw_len) {\n\t\treturn -1;\n\t}\n\n \treturn (attr->attrib_type);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#28aaa72a03df96fa1934876b0efbbc7e6b4b38af", + "input": "bool ResourceDispatcherHostImpl::AcceptAuthRequest(\n ResourceLoader* loader,\n net::AuthChallengeInfo* auth_info) {\n if (delegate_ && !delegate_->AcceptAuthRequest(loader->request(), auth_info))\n return false;\n\n if (!auth_info->is_proxy) {\n HttpAuthResourceType resource_type =\n HttpAuthResourceTypeOf(loader->request());\n UMA_HISTOGRAM_ENUMERATION(\"Net.HttpAuthResource\",\n resource_type,\n HTTP_AUTH_RESOURCE_LAST);\n \n if (resource_type == HTTP_AUTH_RESOURCE_BLOCKED_CROSS)\n return false;\n }\n \n return true;\n}\n", + "target": "bool ResourceDispatcherHostImpl::AcceptAuthRequest(\n ResourceLoader* loader,\n net::AuthChallengeInfo* auth_info) {\n if (delegate_ && !delegate_->AcceptAuthRequest(loader->request(), auth_info))\n return false;\n\n if (!auth_info->is_proxy) {\n HttpAuthResourceType resource_type =\n HttpAuthResourceTypeOf(loader->request());\n UMA_HISTOGRAM_ENUMERATION(\"Net.HttpAuthResource\",\n resource_type,\n HTTP_AUTH_RESOURCE_LAST);\n \n // TODO(tsepez): Return false on HTTP_AUTH_RESOURCE_BLOCKED_CROSS.\n // The code once did this, but was changed due to http://crbug.com/174129.\n // http://crbug.com/174179 has been filed to track this issue.\n }\n \n return true;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a8b0ca17b80e92faab46ee7179ba9e99ccb61233", + "input": "asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)\n{\n\tenum direction dir = decode_direction(insn);\n\tint size = decode_access_size(regs, insn);\n\tint orig_asi, asi;\n\n\tcurrent_thread_info()->kern_una_regs = regs;\n\tcurrent_thread_info()->kern_una_insn = insn;\n\n\torig_asi = asi = decode_asi(insn, regs);\n\n\t/* If this is a {get,put}_user() on an unaligned userspace pointer,\n\t * just signal a fault and do not log the event.\n\t */\n\tif (asi == ASI_AIUS) {\n\t\tkernel_mna_trap_fault(0);\n\t\treturn;\n\t}\n\n\tlog_unaligned(regs);\n\n\tif (!ok_for_kernel(insn) || dir == both) {\n\t\tprintk(\"Unsupported unaligned load/store trap for kernel \"\n\t\t \"at <%016lx>.\\n\", regs->tpc);\n\t\tunaligned_panic(\"Kernel does fpu/atomic \"\n\t\t\t\t\"unaligned load/store.\", regs);\n\n\t\tkernel_mna_trap_fault(0);\n\t} else {\n\t\tunsigned long addr, *reg_addr;\n\t\tint err;\n \n \t\taddr = compute_effective_address(regs, insn,\n \t\t\t\t\t\t ((insn >> 25) & 0x1f));\n\t\tperf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, addr);\n \t\tswitch (asi) {\n \t\tcase ASI_NL:\n \t\tcase ASI_AIUPL:\n\t\tcase ASI_AIUSL:\n\t\tcase ASI_PL:\n\t\tcase ASI_SL:\n\t\tcase ASI_PNFL:\n\t\tcase ASI_SNFL:\n\t\t\tasi &= ~0x08;\n\t\t\tbreak;\n\t\t}\n\t\tswitch (dir) {\n\t\tcase load:\n\t\t\treg_addr = fetch_reg_addr(((insn>>25)&0x1f), regs);\n\t\t\terr = do_int_load(reg_addr, size,\n\t\t\t\t\t (unsigned long *) addr,\n\t\t\t\t\t decode_signedness(insn), asi);\n\t\t\tif (likely(!err) && unlikely(asi != orig_asi)) {\n\t\t\t\tunsigned long val_in = *reg_addr;\n\t\t\t\tswitch (size) {\n\t\t\t\tcase 2:\n\t\t\t\t\tval_in = swab16(val_in);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\tval_in = swab32(val_in);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 8:\n\t\t\t\t\tval_in = swab64(val_in);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 16:\n\t\t\t\tdefault:\n\t\t\t\t\tBUG();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t*reg_addr = val_in;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase store:\n\t\t\terr = do_int_store(((insn>>25)&0x1f), size,\n\t\t\t\t\t (unsigned long *) addr, regs,\n\t\t\t\t\t asi, orig_asi);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tpanic(\"Impossible kernel unaligned trap.\");\n\t\t\t/* Not reached... */\n\t\t}\n\t\tif (unlikely(err))\n\t\t\tkernel_mna_trap_fault(1);\n\t\telse\n\t\t\tadvance(regs);\n\t}\n}\n", + "target": "asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)\n{\n\tenum direction dir = decode_direction(insn);\n\tint size = decode_access_size(regs, insn);\n\tint orig_asi, asi;\n\n\tcurrent_thread_info()->kern_una_regs = regs;\n\tcurrent_thread_info()->kern_una_insn = insn;\n\n\torig_asi = asi = decode_asi(insn, regs);\n\n\t/* If this is a {get,put}_user() on an unaligned userspace pointer,\n\t * just signal a fault and do not log the event.\n\t */\n\tif (asi == ASI_AIUS) {\n\t\tkernel_mna_trap_fault(0);\n\t\treturn;\n\t}\n\n\tlog_unaligned(regs);\n\n\tif (!ok_for_kernel(insn) || dir == both) {\n\t\tprintk(\"Unsupported unaligned load/store trap for kernel \"\n\t\t \"at <%016lx>.\\n\", regs->tpc);\n\t\tunaligned_panic(\"Kernel does fpu/atomic \"\n\t\t\t\t\"unaligned load/store.\", regs);\n\n\t\tkernel_mna_trap_fault(0);\n\t} else {\n\t\tunsigned long addr, *reg_addr;\n\t\tint err;\n \n \t\taddr = compute_effective_address(regs, insn,\n \t\t\t\t\t\t ((insn >> 25) & 0x1f));\n\t\tperf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, regs, addr);\n \t\tswitch (asi) {\n \t\tcase ASI_NL:\n \t\tcase ASI_AIUPL:\n\t\tcase ASI_AIUSL:\n\t\tcase ASI_PL:\n\t\tcase ASI_SL:\n\t\tcase ASI_PNFL:\n\t\tcase ASI_SNFL:\n\t\t\tasi &= ~0x08;\n\t\t\tbreak;\n\t\t}\n\t\tswitch (dir) {\n\t\tcase load:\n\t\t\treg_addr = fetch_reg_addr(((insn>>25)&0x1f), regs);\n\t\t\terr = do_int_load(reg_addr, size,\n\t\t\t\t\t (unsigned long *) addr,\n\t\t\t\t\t decode_signedness(insn), asi);\n\t\t\tif (likely(!err) && unlikely(asi != orig_asi)) {\n\t\t\t\tunsigned long val_in = *reg_addr;\n\t\t\t\tswitch (size) {\n\t\t\t\tcase 2:\n\t\t\t\t\tval_in = swab16(val_in);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\tval_in = swab32(val_in);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 8:\n\t\t\t\t\tval_in = swab64(val_in);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 16:\n\t\t\t\tdefault:\n\t\t\t\t\tBUG();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t*reg_addr = val_in;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase store:\n\t\t\terr = do_int_store(((insn>>25)&0x1f), size,\n\t\t\t\t\t (unsigned long *) addr, regs,\n\t\t\t\t\t asi, orig_asi);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tpanic(\"Impossible kernel unaligned trap.\");\n\t\t\t/* Not reached... */\n\t\t}\n\t\tif (unlikely(err))\n\t\t\tkernel_mna_trap_fault(1);\n\t\telse\n\t\t\tadvance(regs);\n\t}\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ce683e5f9d045e5d67d1312a42b359cb2ab2a13c", + "input": "int xt_compat_check_entry_offsets(const void *base,\n \t\t\t\t unsigned int target_offset,\n \t\t\t\t unsigned int next_offset)\n {\n \tconst struct compat_xt_entry_target *t;\n \tconst char *e = base;\n \n \tif (target_offset + sizeof(*t) > next_offset)\n \t\treturn -EINVAL;\n \n\tt = (void *)(e + target_offset);\n\tif (t->u.target_size < sizeof(*t))\n\t\treturn -EINVAL;\n\n\tif (target_offset + t->u.target_size > next_offset)\n\t\treturn -EINVAL;\n\n\tif (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 &&\n\t target_offset + sizeof(struct compat_xt_standard_target) != next_offset)\n\t\treturn -EINVAL;\n\n\treturn 0;\n}\n", + "target": "int xt_compat_check_entry_offsets(const void *base,\nint xt_compat_check_entry_offsets(const void *base, const char *elems,\n \t\t\t\t unsigned int target_offset,\n \t\t\t\t unsigned int next_offset)\n {\n\tlong size_of_base_struct = elems - (const char *)base;\n \tconst struct compat_xt_entry_target *t;\n \tconst char *e = base;\n \n\tif (target_offset < size_of_base_struct)\n\t\treturn -EINVAL;\n\n \tif (target_offset + sizeof(*t) > next_offset)\n \t\treturn -EINVAL;\n \n\tt = (void *)(e + target_offset);\n\tif (t->u.target_size < sizeof(*t))\n\t\treturn -EINVAL;\n\n\tif (target_offset + t->u.target_size > next_offset)\n\t\treturn -EINVAL;\n\n\tif (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 &&\n\t target_offset + sizeof(struct compat_xt_standard_target) != next_offset)\n\t\treturn -EINVAL;\n\n\treturn 0;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#baee520e3dd9be6511c45a14c5f5e77784de1471", + "input": "static UINT drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp,\n int cbChId, wStream* s)\n{\n\tUINT status;\n\n \tif (!drdynvc)\n \t\treturn CHANNEL_RC_BAD_INIT_HANDLE;\n \n \tWLog_Print(drdynvc->log, WLOG_TRACE, \"capability_request Sp=%d cbChId=%d\", Sp, cbChId);\n \tStream_Seek(s, 1); /* pad */\n \tStream_Read_UINT16(s, drdynvc->version);\n\n\t/* RDP8 servers offer version 3, though Microsoft forgot to document it\n\t * in their early documents. It behaves the same as version 2.\n \t */\n \tif ((drdynvc->version == 2) || (drdynvc->version == 3))\n \t{\n \t\tStream_Read_UINT16(s, drdynvc->PriorityCharge0);\n \t\tStream_Read_UINT16(s, drdynvc->PriorityCharge1);\n \t\tStream_Read_UINT16(s, drdynvc->PriorityCharge2);\n\t\tStream_Read_UINT16(s, drdynvc->PriorityCharge3);\n\t}\n\n\tstatus = drdynvc_send_capability_response(drdynvc);\n\tdrdynvc->state = DRDYNVC_STATE_READY;\n \treturn status;\n }\n", + "target": "static UINT drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp,\n int cbChId, wStream* s)\n{\n\tUINT status;\n\n \tif (!drdynvc)\n \t\treturn CHANNEL_RC_BAD_INIT_HANDLE;\n \n\tif (Stream_GetRemainingLength(s) < 3)\n\t\treturn ERROR_INVALID_DATA;\n\n \tWLog_Print(drdynvc->log, WLOG_TRACE, \"capability_request Sp=%d cbChId=%d\", Sp, cbChId);\n \tStream_Seek(s, 1); /* pad */\n \tStream_Read_UINT16(s, drdynvc->version);\n\n\t/* RDP8 servers offer version 3, though Microsoft forgot to document it\n\t * in their early documents. It behaves the same as version 2.\n \t */\n \tif ((drdynvc->version == 2) || (drdynvc->version == 3))\n \t{\n\t\tif (Stream_GetRemainingLength(s) < 8)\n\t\t\treturn ERROR_INVALID_DATA;\n\n \t\tStream_Read_UINT16(s, drdynvc->PriorityCharge0);\n \t\tStream_Read_UINT16(s, drdynvc->PriorityCharge1);\n \t\tStream_Read_UINT16(s, drdynvc->PriorityCharge2);\n\t\tStream_Read_UINT16(s, drdynvc->PriorityCharge3);\n\t}\n\n\tstatus = drdynvc_send_capability_response(drdynvc);\n\tdrdynvc->state = DRDYNVC_STATE_READY;\n \treturn status;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1dcd10aceabbc03bf571ea32b892c522cbe923de", + "input": "juniper_mlfr_print(netdissect_options *ndo,\n const struct pcap_pkthdr *h, register const u_char *p)\n{\n struct juniper_l2info_t l2info;\n\n l2info.pictype = DLT_JUNIPER_MLFR;\n if (juniper_parse_header(ndo, p, h, &l2info) == 0)\n return l2info.header_len;\n\n p+=l2info.header_len;\n\n /* suppress Bundle-ID if frame was captured on a child-link */\n if (ndo->ndo_eflag && EXTRACT_32BITS(l2info.cookie) != 1)\n ND_PRINT((ndo, \"Bundle-ID %u, \", l2info.bundle));\n switch (l2info.proto) {\n case (LLC_UI):\n case (LLC_UI<<8):\n isoclns_print(ndo, p, l2info.length, l2info.caplen);\n break;\n case (LLC_UI<<8 | NLPID_Q933):\n case (LLC_UI<<8 | NLPID_IP):\n case (LLC_UI<<8 | NLPID_IP6):\n /* pass IP{4,6} to the OSI layer for proper link-layer printing */\n isoclns_print(ndo, p - 1, l2info.length + 1, l2info.caplen + 1);\n break;\n default:\n ND_PRINT((ndo, \"unknown protocol 0x%04x, length %u\", l2info.proto, l2info.length));\n }\n\n return l2info.header_len;\n}\n", + "target": "juniper_mlfr_print(netdissect_options *ndo,\n const struct pcap_pkthdr *h, register const u_char *p)\n{\n struct juniper_l2info_t l2info;\n\n l2info.pictype = DLT_JUNIPER_MLFR;\n if (juniper_parse_header(ndo, p, h, &l2info) == 0)\n return l2info.header_len;\n\n p+=l2info.header_len;\n\n /* suppress Bundle-ID if frame was captured on a child-link */\n if (ndo->ndo_eflag && EXTRACT_32BITS(l2info.cookie) != 1)\n ND_PRINT((ndo, \"Bundle-ID %u, \", l2info.bundle));\n switch (l2info.proto) {\n case (LLC_UI):\n case (LLC_UI<<8):\n isoclns_print(ndo, p, l2info.length);\n break;\n case (LLC_UI<<8 | NLPID_Q933):\n case (LLC_UI<<8 | NLPID_IP):\n case (LLC_UI<<8 | NLPID_IP6):\n /* pass IP{4,6} to the OSI layer for proper link-layer printing */\n isoclns_print(ndo, p - 1, l2info.length + 1);\n break;\n default:\n ND_PRINT((ndo, \"unknown protocol 0x%04x, length %u\", l2info.proto, l2info.length));\n }\n\n return l2info.header_len;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8a50f99c25fb70ff43aaa82b6f9569db383f0ca8", + "input": " virtual void TearDown() {\n message_loop_.RunAllPending();\n client_.Stop();\n }\n", + "target": " virtual void TearDown() {\n StopClient();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ca8cc70b2de822b939f87effc7c2b83bac280a44", + "input": " ChromeURLRequestContext::ChromeURLRequestContext(\n ContextType type,\n chrome_browser_net::LoadTimeStats* load_time_stats)\n : load_time_stats_(load_time_stats) {\n DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));\n if (load_time_stats_)\n load_time_stats_->RegisterURLRequestContext(this, type);\n}\n", + "target": " ChromeURLRequestContext::ChromeURLRequestContext(\n ContextType type,\n chrome_browser_net::LoadTimeStats* load_time_stats)\n : weak_factory_(this),\n load_time_stats_(load_time_stats) {\n DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));\n if (load_time_stats_)\n load_time_stats_->RegisterURLRequestContext(this, type);\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "image_transform_png_set_strip_alpha_set(PNG_CONST image_transform *this,\n transform_display *that, png_structp pp, png_infop pi)\n {\n png_set_strip_alpha(pp);\n this->next->set(this->next, that, pp, pi);\n\n }\n", + "target": "image_transform_png_set_strip_alpha_set(PNG_CONST image_transform *this,\nimage_transform_png_set_strip_alpha_set(const image_transform *this,\n transform_display *that, png_structp pp, png_infop pi)\n {\n png_set_strip_alpha(pp);\n this->next->set(this->next, that, pp, pi);\n\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1f37c04f2a762500222dda2459e6a04646feeedf", + "input": "static void process_constructors (RBinFile *bf, RList *ret, int bits) {\n\tRList *secs = sections (bf);\n\tRListIter *iter;\n\tRBinSection *sec;\n\tint i, type;\n\tr_list_foreach (secs, iter, sec) {\n\t\ttype = -1;\n\t\tif (!strcmp (sec->name, \".fini_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_FINI;\n\t\t} else if (!strcmp (sec->name, \".init_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_INIT;\n\t\t} else if (!strcmp (sec->name, \".preinit_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_PREINIT;\n\t\t}\n\t\tif (type != -1) {\n\t\t\tut8 *buf = calloc (sec->size, 1);\n\t\t\tif (!buf) {\n\t\t\t\tcontinue;\n \t\t\t}\n \t\t\t(void)r_buf_read_at (bf->buf, sec->paddr, buf, sec->size);\n \t\t\tif (bits == 32) {\n\t\t\t\tfor (i = 0; i < sec->size; i += 4) {\n \t\t\t\t\tut32 addr32 = r_read_le32 (buf + i);\n \t\t\t\t\tif (addr32) {\n \t\t\t\t\t\tRBinAddr *ba = newEntry (sec->paddr + i, (ut64)addr32, type, bits);\n \t\t\t\t\t\tr_list_append (ret, ba);\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t} else {\n\t\t\t\tfor (i = 0; i < sec->size; i += 8) {\n \t\t\t\t\tut64 addr64 = r_read_le64 (buf + i);\n \t\t\t\t\tif (addr64) {\n \t\t\t\t\t\tRBinAddr *ba = newEntry (sec->paddr + i, addr64, type, bits);\n\t\t\t\t\t\tr_list_append (ret, ba);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfree (buf);\n\t\t}\n\t}\n\tr_list_free (secs);\n}\n", + "target": "static void process_constructors (RBinFile *bf, RList *ret, int bits) {\n\tRList *secs = sections (bf);\n\tRListIter *iter;\n\tRBinSection *sec;\n\tint i, type;\n\tr_list_foreach (secs, iter, sec) {\n\t\ttype = -1;\n\t\tif (!strcmp (sec->name, \".fini_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_FINI;\n\t\t} else if (!strcmp (sec->name, \".init_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_INIT;\n\t\t} else if (!strcmp (sec->name, \".preinit_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_PREINIT;\n\t\t}\n\t\tif (type != -1) {\n\t\t\tut8 *buf = calloc (sec->size, 1);\n\t\t\tif (!buf) {\n\t\t\t\tcontinue;\n \t\t\t}\n \t\t\t(void)r_buf_read_at (bf->buf, sec->paddr, buf, sec->size);\n \t\t\tif (bits == 32) {\n\t\t\t\tfor (i = 0; (i + 3) < sec->size; i += 4) {\n \t\t\t\t\tut32 addr32 = r_read_le32 (buf + i);\n \t\t\t\t\tif (addr32) {\n \t\t\t\t\t\tRBinAddr *ba = newEntry (sec->paddr + i, (ut64)addr32, type, bits);\n \t\t\t\t\t\tr_list_append (ret, ba);\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t} else {\n\t\t\t\tfor (i = 0; (i + 7) < sec->size; i += 8) {\n \t\t\t\t\tut64 addr64 = r_read_le64 (buf + i);\n \t\t\t\t\tif (addr64) {\n \t\t\t\t\t\tRBinAddr *ba = newEntry (sec->paddr + i, addr64, type, bits);\n\t\t\t\t\t\tr_list_append (ret, ba);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfree (buf);\n\t\t}\n\t}\n\tr_list_free (secs);\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8fe377e93b4b56060e5bbfb6f3142ceaeca744fa", + "input": "sc_parse_ef_gdo_content(const unsigned char *gdo, size_t gdo_len,\n\t\tunsigned char *iccsn, size_t *iccsn_len,\n\t\tunsigned char *chn, size_t *chn_len)\n{\n\tint r = SC_SUCCESS, iccsn_found = 0, chn_found = 0;\n\tconst unsigned char *p = gdo;\n\tsize_t left = gdo_len;\n\n\twhile (left >= 2) {\n\t\tunsigned int cla, tag;\n\t\tsize_t tag_len;\n\n\t\tr = sc_asn1_read_tag(&p, left, &cla, &tag, &tag_len);\n\t\tif (r != SC_SUCCESS) {\n\t\t\tif (r == SC_ERROR_ASN1_END_OF_CONTENTS) {\n\t\t\t\t/* not enough data */\n\t\t\t\tr = SC_SUCCESS;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif (p == NULL) {\n\t\t\t/* done parsing */\n\t\t\tbreak;\n\t\t}\n\n\t\tif (cla == SC_ASN1_TAG_APPLICATION) {\n\t\t\tswitch (tag) {\n\t\t\t\tcase 0x1A:\n\t\t\t\t\ticcsn_found = 1;\n\t\t\t\t\tif (iccsn && iccsn_len) {\n\t\t\t\t\t\tmemcpy(iccsn, p, MIN(tag_len, *iccsn_len));\n\t\t\t\t\t\t*iccsn_len = MIN(tag_len, *iccsn_len);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x1F20:\n\t\t\t\t\tchn_found = 1;\n\t\t\t\t\tif (chn && chn_len) {\n\t\t\t\t\t\tmemcpy(chn, p, MIN(tag_len, *chn_len));\n\t\t\t\t\t\t*chn_len = MIN(tag_len, *chn_len);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n \t\t}\n \n \t\tp += tag_len;\n\t\tleft -= (p - gdo);\n \t}\n \n \tif (!iccsn_found && iccsn_len)\n\t\t*iccsn_len = 0;\n\tif (!chn_found && chn_len)\n\t\t*chn_len = 0;\n\n\treturn r;\n}\n", + "target": "sc_parse_ef_gdo_content(const unsigned char *gdo, size_t gdo_len,\n\t\tunsigned char *iccsn, size_t *iccsn_len,\n\t\tunsigned char *chn, size_t *chn_len)\n{\n\tint r = SC_SUCCESS, iccsn_found = 0, chn_found = 0;\n\tconst unsigned char *p = gdo;\n\tsize_t left = gdo_len;\n\n\twhile (left >= 2) {\n\t\tunsigned int cla, tag;\n\t\tsize_t tag_len;\n\n\t\tr = sc_asn1_read_tag(&p, left, &cla, &tag, &tag_len);\n\t\tif (r != SC_SUCCESS) {\n\t\t\tif (r == SC_ERROR_ASN1_END_OF_CONTENTS) {\n\t\t\t\t/* not enough data */\n\t\t\t\tr = SC_SUCCESS;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif (p == NULL) {\n\t\t\t/* done parsing */\n\t\t\tbreak;\n\t\t}\n\n\t\tif (cla == SC_ASN1_TAG_APPLICATION) {\n\t\t\tswitch (tag) {\n\t\t\t\tcase 0x1A:\n\t\t\t\t\ticcsn_found = 1;\n\t\t\t\t\tif (iccsn && iccsn_len) {\n\t\t\t\t\t\tmemcpy(iccsn, p, MIN(tag_len, *iccsn_len));\n\t\t\t\t\t\t*iccsn_len = MIN(tag_len, *iccsn_len);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x1F20:\n\t\t\t\t\tchn_found = 1;\n\t\t\t\t\tif (chn && chn_len) {\n\t\t\t\t\t\tmemcpy(chn, p, MIN(tag_len, *chn_len));\n\t\t\t\t\t\t*chn_len = MIN(tag_len, *chn_len);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n \t\t}\n \n \t\tp += tag_len;\n\t\tleft = gdo_len - (p - gdo);\n \t}\n \n \tif (!iccsn_found && iccsn_len)\n\t\t*iccsn_len = 0;\n\tif (!chn_found && chn_len)\n\t\t*chn_len = 0;\n\n\treturn r;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d", + "input": " const BlockEntry* Cluster::GetEntry(const CuePoint& cp,\n const CuePoint::TrackPosition& tp) const {\n assert(m_pSegment);\n#if 0\n LoadBlockEntries();\n if (m_entries == NULL)\n return NULL;\n const long long count = m_entries_count;\n if (count <= 0)\n return NULL;\n const long long tc = cp.GetTimeCode();\n if ((tp.m_block > 0) && (tp.m_block <= count))\n {\n const size_t block = static_cast(tp.m_block);\n const size_t index = block - 1;\n const BlockEntry* const pEntry = m_entries[index];\n assert(pEntry);\n assert(!pEntry->EOS());\n const Block* const pBlock = pEntry->GetBlock();\n assert(pBlock);\n if ((pBlock->GetTrackNumber() == tp.m_track) &&\n (pBlock->GetTimeCode(this) == tc))\n {\n return pEntry;\n }\n }\n const BlockEntry* const* i = m_entries;\n const BlockEntry* const* const j = i + count;\n while (i != j)\n {\n#ifdef _DEBUG\n const ptrdiff_t idx = i - m_entries;\n idx;\n#endif\n const BlockEntry* const pEntry = *i++;\n assert(pEntry);\n assert(!pEntry->EOS());\n const Block* const pBlock = pEntry->GetBlock();\n assert(pBlock);\n if (pBlock->GetTrackNumber() != tp.m_track)\n continue;\n const long long tc_ = pBlock->GetTimeCode(this);\n assert(tc_ >= 0);\n if (tc_ < tc)\n continue;\n if (tc_ > tc)\n return NULL;\n const Tracks* const pTracks = m_pSegment->GetTracks();\n assert(pTracks);\n const long tn = static_cast(tp.m_track);\n const Track* const pTrack = pTracks->GetTrackByNumber(tn);\n if (pTrack == NULL)\n return NULL;\n const long long type = pTrack->GetType();\n if (type == 2) //audio\n return pEntry;\n if (type != 1) //not video\n return NULL;\n if (!pBlock->IsKey())\n return NULL;\n return pEntry;\n }\n return NULL;\n#else\n const long long tc = cp.GetTimeCode();\n \n if (tp.m_block > 0) {\n const long block = static_cast(tp.m_block);\n const long index = block - 1;\n\n while (index >= m_entries_count) {\n long long pos;\n long len;\n\n const long status = Parse(pos, len);\n\n if (status < 0) // TODO: can this happen?\n return NULL;\n\n if (status > 0) // nothing remains to be parsed\n return NULL;\n }\n\n const BlockEntry* const pEntry = m_entries[index];\n assert(pEntry);\n assert(!pEntry->EOS());\n\n const Block* const pBlock = pEntry->GetBlock();\n assert(pBlock);\n\n if ((pBlock->GetTrackNumber() == tp.m_track) &&\n (pBlock->GetTimeCode(this) == tc)) {\n return pEntry;\n }\n }\n\n long index = 0;\n\n for (;;) {\n if (index >= m_entries_count) {\n long long pos;\n long len;\n\n const long status = Parse(pos, len);\n\n if (status < 0) // TODO: can this happen?\n return NULL;\n\n if (status > 0) // nothing remains to be parsed\n return NULL;\n\n assert(m_entries);\n assert(index < m_entries_count);\n }\n\n const BlockEntry* const pEntry = m_entries[index];\n assert(pEntry);\n assert(!pEntry->EOS());\n\n const Block* const pBlock = pEntry->GetBlock();\n assert(pBlock);\n\n if (pBlock->GetTrackNumber() != tp.m_track) {\n ++index;\n continue;\n }\n\n const long long tc_ = pBlock->GetTimeCode(this);\n\n if (tc_ < tc) {\n ++index;\n continue;\n }\n\n if (tc_ > tc)\n return NULL;\n\n const Tracks* const pTracks = m_pSegment->GetTracks();\n assert(pTracks);\n\n const long tn = static_cast(tp.m_track);\n const Track* const pTrack = pTracks->GetTrackByNumber(tn);\n\n if (pTrack == NULL)\n return NULL;\n\n const long long type = pTrack->GetType();\n\n if (type == 2) // audio\n return pEntry;\n\n if (type != 1) // not video\n return NULL;\n\n if (!pBlock->IsKey())\n return NULL;\n\n \n return pEntry;\n }\n#endif\n }\n", + "target": " const BlockEntry* Cluster::GetEntry(const CuePoint& cp,\n const CuePoint::TrackPosition& tp) const {\n assert(m_pSegment);\n const long long tc = cp.GetTimeCode();\n \n if (tp.m_block > 0) {\n const long block = static_cast(tp.m_block);\n const long index = block - 1;\n\n while (index >= m_entries_count) {\n long long pos;\n long len;\n\n const long status = Parse(pos, len);\n\n if (status < 0) // TODO: can this happen?\n return NULL;\n\n if (status > 0) // nothing remains to be parsed\n return NULL;\n }\n\n const BlockEntry* const pEntry = m_entries[index];\n assert(pEntry);\n assert(!pEntry->EOS());\n\n const Block* const pBlock = pEntry->GetBlock();\n assert(pBlock);\n\n if ((pBlock->GetTrackNumber() == tp.m_track) &&\n (pBlock->GetTimeCode(this) == tc)) {\n return pEntry;\n }\n }\n\n long index = 0;\n\n for (;;) {\n if (index >= m_entries_count) {\n long long pos;\n long len;\n\n const long status = Parse(pos, len);\n\n if (status < 0) // TODO: can this happen?\n return NULL;\n\n if (status > 0) // nothing remains to be parsed\n return NULL;\n\n assert(m_entries);\n assert(index < m_entries_count);\n }\n\n const BlockEntry* const pEntry = m_entries[index];\n assert(pEntry);\n assert(!pEntry->EOS());\n\n const Block* const pBlock = pEntry->GetBlock();\n assert(pBlock);\n\n if (pBlock->GetTrackNumber() != tp.m_track) {\n ++index;\n continue;\n }\n\n const long long tc_ = pBlock->GetTimeCode(this);\n\n if (tc_ < tc) {\n ++index;\n continue;\n }\n\n if (tc_ > tc)\n return NULL;\n\n const Tracks* const pTracks = m_pSegment->GetTracks();\n assert(pTracks);\n\n const long tn = static_cast(tp.m_track);\n const Track* const pTrack = pTracks->GetTrackByNumber(tn);\n\n if (pTrack == NULL)\n return NULL;\n\n const long long type = pTrack->GetType();\n\n if (type == 2) // audio\n return pEntry;\n\n if (type != 1) // not video\n return NULL;\n\n if (!pBlock->IsKey())\n return NULL;\n\n \n return pEntry;\n }\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f457b7b5ecfe91697ed01cfc825772c4d8de1236", + "input": "id3_skip (SF_PRIVATE * psf)\n{\tunsigned char\tbuf [10] ;\n\n\tmemset (buf, 0, sizeof (buf)) ;\n\tpsf_binheader_readf (psf, \"pb\", 0, buf, 10) ;\n\n\tif (buf [0] == 'I' && buf [1] == 'D' && buf [2] == '3')\n\t{\tint\toffset = buf [6] & 0x7f ;\n\t\toffset = (offset << 7) | (buf [7] & 0x7f) ;\n\t\toffset = (offset << 7) | (buf [8] & 0x7f) ;\n\t\toffset = (offset << 7) | (buf [9] & 0x7f) ;\n\n\t\tpsf_log_printf (psf, \"ID3 length : %d\\n--------------------\\n\", offset) ;\n\n\t\t/* Never want to jump backwards in a file. */\n\t\tif (offset < 0)\n\t\t\treturn 0 ;\n \n \t\t/* Calculate new file offset and position ourselves there. */\n \t\tpsf->fileoffset += offset + 10 ;\n\t\tpsf_binheader_readf (psf, \"p\", psf->fileoffset) ;\n \n\t\treturn 1 ;\n \t\t} ;\n \n \treturn 0 ;\n} /* id3_skip */\n", + "target": "id3_skip (SF_PRIVATE * psf)\n{\tunsigned char\tbuf [10] ;\n\n\tmemset (buf, 0, sizeof (buf)) ;\n\tpsf_binheader_readf (psf, \"pb\", 0, buf, 10) ;\n\n\tif (buf [0] == 'I' && buf [1] == 'D' && buf [2] == '3')\n\t{\tint\toffset = buf [6] & 0x7f ;\n\t\toffset = (offset << 7) | (buf [7] & 0x7f) ;\n\t\toffset = (offset << 7) | (buf [8] & 0x7f) ;\n\t\toffset = (offset << 7) | (buf [9] & 0x7f) ;\n\n\t\tpsf_log_printf (psf, \"ID3 length : %d\\n--------------------\\n\", offset) ;\n\n\t\t/* Never want to jump backwards in a file. */\n\t\tif (offset < 0)\n\t\t\treturn 0 ;\n \n \t\t/* Calculate new file offset and position ourselves there. */\n \t\tpsf->fileoffset += offset + 10 ;\n \n\t\tif (psf->fileoffset < psf->filelength)\n\t\t{\tpsf_binheader_readf (psf, \"p\", psf->fileoffset) ;\n\t\t\treturn 1 ;\n\t\t\t} ;\n \t\t} ;\n \n \treturn 0 ;\n} /* id3_skip */\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6c5211a0cef0cc2854eaa387e0eb036e012904d0?w=1", + "input": "PHP_FUNCTION(mcrypt_ofb)\n{\n \tzval **mode;\n \tchar *cipher, *key, *data, *iv = NULL;\n \tint cipher_len, key_len, data_len, iv_len = 0;\n \tMCRYPT_GET_CRYPT_ARGS\n \n \tconvert_to_long_ex(mode);\n\n\tphp_mcrypt_do_crypt(cipher, key, key_len, data, data_len, \"ofb\", iv, iv_len, ZEND_NUM_ARGS(), Z_LVAL_PP(mode), return_value TSRMLS_CC);\n}\n", + "target": "PHP_FUNCTION(mcrypt_ofb)\n{\n \tzval **mode;\n \tchar *cipher, *key, *data, *iv = NULL;\n \tint cipher_len, key_len, data_len, iv_len = 0;\n\n \tMCRYPT_GET_CRYPT_ARGS\n \n \tconvert_to_long_ex(mode);\n\n\tphp_mcrypt_do_crypt(cipher, key, key_len, data, data_len, \"ofb\", iv, iv_len, ZEND_NUM_ARGS(), Z_LVAL_PP(mode), return_value TSRMLS_CC);\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#415e3d3e90ce9e18727e8843ae343eda5a58fad6", + "input": "void unix_inflight(struct file *fp)\n {\n \tstruct sock *s = unix_get_socket(fp);\n \n\tspin_lock(&unix_gc_lock);\n\n\tif (s) {\n\t\tstruct unix_sock *u = unix_sk(s);\n\n\t\tif (atomic_long_inc_return(&u->inflight) == 1) {\n\t\t\tBUG_ON(!list_empty(&u->link));\n\t\t\tlist_add_tail(&u->link, &gc_inflight_list);\n\t\t} else {\n\t\t\tBUG_ON(list_empty(&u->link));\n \t\t}\n \t\tunix_tot_inflight++;\n \t}\n\tfp->f_cred->user->unix_inflight++;\n \tspin_unlock(&unix_gc_lock);\n }\n", + "target": "void unix_inflight(struct file *fp)\nvoid unix_inflight(struct user_struct *user, struct file *fp)\n {\n \tstruct sock *s = unix_get_socket(fp);\n \n\tspin_lock(&unix_gc_lock);\n\n\tif (s) {\n\t\tstruct unix_sock *u = unix_sk(s);\n\n\t\tif (atomic_long_inc_return(&u->inflight) == 1) {\n\t\t\tBUG_ON(!list_empty(&u->link));\n\t\t\tlist_add_tail(&u->link, &gc_inflight_list);\n\t\t} else {\n\t\t\tBUG_ON(list_empty(&u->link));\n \t\t}\n \t\tunix_tot_inflight++;\n \t}\n\tuser->unix_inflight++;\n \tspin_unlock(&unix_gc_lock);\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a70b52ec1aaeaf60f4739edb1b422827cb6f3893", + "input": "static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)\n{\n\tssize_t ret;\n\n#ifdef CONFIG_COMPAT\n\tif (compat)\n\t\tret = compat_rw_copy_check_uvector(type,\n\t\t\t\t(struct compat_iovec __user *)kiocb->ki_buf,\n\t\t\t\tkiocb->ki_nbytes, 1, &kiocb->ki_inline_vec,\n\t\t\t\t&kiocb->ki_iovec, 1);\n\telse\n#endif\n\t\tret = rw_copy_check_uvector(type,\n\t\t\t\t(struct iovec __user *)kiocb->ki_buf,\n\t\t\t\tkiocb->ki_nbytes, 1, &kiocb->ki_inline_vec,\n\t\t\t\t&kiocb->ki_iovec, 1);\n \tif (ret < 0)\n \t\tgoto out;\n \n \tkiocb->ki_nr_segs = kiocb->ki_nbytes;\n \tkiocb->ki_cur_seg = 0;\n \t/* ki_nbytes/left now reflect bytes instead of segs */\n\tkiocb->ki_nbytes = ret;\n\tkiocb->ki_left = ret;\n\n\tret = 0;\nout:\n \treturn ret;\n }\n", + "target": "static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)\n{\n\tssize_t ret;\n\n#ifdef CONFIG_COMPAT\n\tif (compat)\n\t\tret = compat_rw_copy_check_uvector(type,\n\t\t\t\t(struct compat_iovec __user *)kiocb->ki_buf,\n\t\t\t\tkiocb->ki_nbytes, 1, &kiocb->ki_inline_vec,\n\t\t\t\t&kiocb->ki_iovec, 1);\n\telse\n#endif\n\t\tret = rw_copy_check_uvector(type,\n\t\t\t\t(struct iovec __user *)kiocb->ki_buf,\n\t\t\t\tkiocb->ki_nbytes, 1, &kiocb->ki_inline_vec,\n\t\t\t\t&kiocb->ki_iovec, 1);\n \tif (ret < 0)\n \t\tgoto out;\n \n\tret = rw_verify_area(type, kiocb->ki_filp, &kiocb->ki_pos, ret);\n\tif (ret < 0)\n\t\tgoto out;\n\n \tkiocb->ki_nr_segs = kiocb->ki_nbytes;\n \tkiocb->ki_cur_seg = 0;\n \t/* ki_nbytes/left now reflect bytes instead of segs */\n\tkiocb->ki_nbytes = ret;\n\tkiocb->ki_left = ret;\n\n\tret = 0;\nout:\n \treturn ret;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a3987c8b93d3abbba6ea4e438493bf996fff66b7", + "input": "OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() {\n if (!GetSurfaceManager()) {\n if (surface_factory_)\n surface_factory_->DidDestroySurfaceManager();\n } else {\n GetSurfaceManager()->InvalidateSurfaceClientId(id_allocator_->client_id());\n }\n surface_factory_->Destroy(surface_id_);\n}\n", + "target": "OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() {\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#411a4068f8c464e883358bf403a3e25158863823", + "input": "static int ras_getdatastd(jas_stream_t *in, ras_hdr_t *hdr, ras_cmap_t *cmap,\n jas_image_t *image)\n{\n\tint pad;\n\tint nz;\n\tint z;\n\tint c;\n\tint y;\n\tint x;\n\tint v;\n\tint i;\n\tjas_matrix_t *data[3];\n\n/* Note: This function does not properly handle images with a colormap. */\n \t/* Avoid compiler warnings about unused parameters. */\n \tcmap = 0;\n \n \tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n\t\tdata[i] = jas_matrix_create(1, jas_image_width(image));\n\t\tassert(data[i]);\n \t}\n \n \tpad = RAS_ROWSIZE(hdr) - (hdr->width * hdr->depth + 7) / 8;\n\n\tfor (y = 0; y < hdr->height; y++) {\n\t\tnz = 0;\n\t\tz = 0;\n \t\tfor (x = 0; x < hdr->width; x++) {\n \t\t\twhile (nz < hdr->depth) {\n \t\t\t\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\t\t\t\treturn -1;\n \t\t\t\t}\n \t\t\t\tz = (z << 8) | c;\n \t\t\t\tnz += 8;\n\t\t\t}\n\n\t\t\tv = (z >> (nz - hdr->depth)) & RAS_ONES(hdr->depth);\n\t\t\tz &= RAS_ONES(nz - hdr->depth);\n\t\t\tnz -= hdr->depth;\n\n\t\t\tif (jas_image_numcmpts(image) == 3) {\n\t\t\t\tjas_matrix_setv(data[0], x, (RAS_GETRED(v)));\n\t\t\t\tjas_matrix_setv(data[1], x, (RAS_GETGREEN(v)));\n\t\t\t\tjas_matrix_setv(data[2], x, (RAS_GETBLUE(v)));\n\t\t\t} else {\n\t\t\t\tjas_matrix_setv(data[0], x, (v));\n\t\t\t}\n \t\t}\n \t\tif (pad) {\n \t\t\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\t\t\treturn -1;\n \t\t\t}\n \t\t}\n \t\tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n \t\t\tif (jas_image_writecmpt(image, i, 0, y, hdr->width, 1,\n \t\t\t data[i])) {\n\t\t\t\treturn -1;\n \t\t\t}\n \t\t}\n \t}\n \n \tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n \t\tjas_matrix_destroy(data[i]);\n \t}\n \n \treturn 0;\n }\n", + "target": "static int ras_getdatastd(jas_stream_t *in, ras_hdr_t *hdr, ras_cmap_t *cmap,\n jas_image_t *image)\n{\n\tint pad;\n\tint nz;\n\tint z;\n\tint c;\n\tint y;\n\tint x;\n\tint v;\n\tint i;\n\tjas_matrix_t *data[3];\n\n/* Note: This function does not properly handle images with a colormap. */\n \t/* Avoid compiler warnings about unused parameters. */\n \tcmap = 0;\n \n\tassert(jas_image_numcmpts(image) <= 3);\n\n\tfor (i = 0; i < 3; ++i) {\n\t\tdata[i] = 0;\n\t}\n\n \tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n\t\tif (!(data[i] = jas_matrix_create(1, jas_image_width(image)))) {\n\t\t\tgoto error;\n\t\t}\n \t}\n \n \tpad = RAS_ROWSIZE(hdr) - (hdr->width * hdr->depth + 7) / 8;\n\n\tfor (y = 0; y < hdr->height; y++) {\n\t\tnz = 0;\n\t\tz = 0;\n \t\tfor (x = 0; x < hdr->width; x++) {\n \t\t\twhile (nz < hdr->depth) {\n \t\t\t\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\t\t\t\tgoto error;\n \t\t\t\t}\n \t\t\t\tz = (z << 8) | c;\n \t\t\t\tnz += 8;\n\t\t\t}\n\n\t\t\tv = (z >> (nz - hdr->depth)) & RAS_ONES(hdr->depth);\n\t\t\tz &= RAS_ONES(nz - hdr->depth);\n\t\t\tnz -= hdr->depth;\n\n\t\t\tif (jas_image_numcmpts(image) == 3) {\n\t\t\t\tjas_matrix_setv(data[0], x, (RAS_GETRED(v)));\n\t\t\t\tjas_matrix_setv(data[1], x, (RAS_GETGREEN(v)));\n\t\t\t\tjas_matrix_setv(data[2], x, (RAS_GETBLUE(v)));\n\t\t\t} else {\n\t\t\t\tjas_matrix_setv(data[0], x, (v));\n\t\t\t}\n \t\t}\n \t\tif (pad) {\n \t\t\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\t\t\tgoto error;\n \t\t\t}\n \t\t}\n \t\tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n \t\t\tif (jas_image_writecmpt(image, i, 0, y, hdr->width, 1,\n \t\t\t data[i])) {\n\t\t\t\tgoto error;\n \t\t\t}\n \t\t}\n \t}\n \n \tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n \t\tjas_matrix_destroy(data[i]);\n\t\tdata[i] = 0;\n \t}\n \n \treturn 0;\n\nerror:\n\tfor (i = 0; i < 3; ++i) {\n\t\tif (data[i]) {\n\t\t\tjas_matrix_destroy(data[i]);\n\t\t}\n\t}\n\treturn -1;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#2-0ffbec2a3792", + "input": "@mod.route('/delete/', methods=['GET', 'POST'])\ndef delete(msg_id):\n if request.method == 'GET':\n sql = \"DELETE FROM message where msg_id = '%d';\" % (msg_id)\n cursor.execute(sql)\n conn.commit()\n flash('Delete Success!')\n return redirect(url_for('show_entries'))", + "target": "@mod.route('/delete/', methods=['GET', 'POST'])\ndef delete(msg_id):\n if request.method == 'GET':\n cursor.execute(\"DELETE FROM message where msg_id = %s;\", (msg_id,))\n conn.commit()\n flash('Delete Success!')\n return redirect(url_for('show_entries'))", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#a1b9004b768bef606ee98d417bceb9392ceb788d", + "input": "static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)\n{\n uint8_t byte;\n\n if (bytestream2_get_bytes_left(&s->g) < 5)\n return AVERROR_INVALIDDATA;\n\n /* nreslevels = number of resolution levels\n = number of decomposition level +1 */\n c->nreslevels = bytestream2_get_byteu(&s->g) + 1;\n if (c->nreslevels >= JPEG2000_MAX_RESLEVELS) {\n av_log(s->avctx, AV_LOG_ERROR, \"nreslevels %d is invalid\\n\", c->nreslevels);\n return AVERROR_INVALIDDATA;\n }\n \n /* compute number of resolution levels to decode */\n if (c->nreslevels < s->reduction_factor)\n c->nreslevels2decode = 1;\n else\n c->nreslevels2decode = c->nreslevels - s->reduction_factor;\n \n c->log2_cblk_width = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk width\n c->log2_cblk_height = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk height\n\n if (c->log2_cblk_width > 10 || c->log2_cblk_height > 10 ||\n c->log2_cblk_width + c->log2_cblk_height > 12) {\n av_log(s->avctx, AV_LOG_ERROR, \"cblk size invalid\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) {\n avpriv_request_sample(s->avctx, \"cblk size > 64\");\n return AVERROR_PATCHWELCOME;\n }\n\n c->cblk_style = bytestream2_get_byteu(&s->g);\n if (c->cblk_style != 0) { // cblk style\n av_log(s->avctx, AV_LOG_WARNING, \"extra cblk styles %X\\n\", c->cblk_style);\n }\n c->transform = bytestream2_get_byteu(&s->g); // DWT transformation type\n /* set integer 9/7 DWT in case of BITEXACT flag */\n if ((s->avctx->flags & CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97))\n c->transform = FF_DWT97_INT;\n\n if (c->csty & JPEG2000_CSTY_PREC) {\n int i;\n for (i = 0; i < c->nreslevels; i++) {\n byte = bytestream2_get_byte(&s->g);\n c->log2_prec_widths[i] = byte & 0x0F; // precinct PPx\n c->log2_prec_heights[i] = (byte >> 4) & 0x0F; // precinct PPy\n }\n } else {\n memset(c->log2_prec_widths , 15, sizeof(c->log2_prec_widths ));\n memset(c->log2_prec_heights, 15, sizeof(c->log2_prec_heights));\n }\n return 0;\n}\n", + "target": "static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)\n{\n uint8_t byte;\n\n if (bytestream2_get_bytes_left(&s->g) < 5)\n return AVERROR_INVALIDDATA;\n\n /* nreslevels = number of resolution levels\n = number of decomposition level +1 */\n c->nreslevels = bytestream2_get_byteu(&s->g) + 1;\n if (c->nreslevels >= JPEG2000_MAX_RESLEVELS) {\n av_log(s->avctx, AV_LOG_ERROR, \"nreslevels %d is invalid\\n\", c->nreslevels);\n return AVERROR_INVALIDDATA;\n }\n \n if (c->nreslevels <= s->reduction_factor) {\n /* we are forced to update reduction_factor as its requested value is\n not compatible with this bitstream, and as we might have used it\n already in setup earlier we have to fail this frame until\n reinitialization is implemented */\n av_log(s->avctx, AV_LOG_ERROR, \"reduction_factor too large for this bitstream, max is %d\\n\", c->nreslevels - 1);\n s->reduction_factor = c->nreslevels - 1;\n return AVERROR(EINVAL);\n }\n\n /* compute number of resolution levels to decode */\n c->nreslevels2decode = c->nreslevels - s->reduction_factor;\n \n c->log2_cblk_width = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk width\n c->log2_cblk_height = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk height\n\n if (c->log2_cblk_width > 10 || c->log2_cblk_height > 10 ||\n c->log2_cblk_width + c->log2_cblk_height > 12) {\n av_log(s->avctx, AV_LOG_ERROR, \"cblk size invalid\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) {\n avpriv_request_sample(s->avctx, \"cblk size > 64\");\n return AVERROR_PATCHWELCOME;\n }\n\n c->cblk_style = bytestream2_get_byteu(&s->g);\n if (c->cblk_style != 0) { // cblk style\n av_log(s->avctx, AV_LOG_WARNING, \"extra cblk styles %X\\n\", c->cblk_style);\n }\n c->transform = bytestream2_get_byteu(&s->g); // DWT transformation type\n /* set integer 9/7 DWT in case of BITEXACT flag */\n if ((s->avctx->flags & CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97))\n c->transform = FF_DWT97_INT;\n\n if (c->csty & JPEG2000_CSTY_PREC) {\n int i;\n for (i = 0; i < c->nreslevels; i++) {\n byte = bytestream2_get_byte(&s->g);\n c->log2_prec_widths[i] = byte & 0x0F; // precinct PPx\n c->log2_prec_heights[i] = (byte >> 4) & 0x0F; // precinct PPy\n }\n } else {\n memset(c->log2_prec_widths , 15, sizeof(c->log2_prec_widths ));\n memset(c->log2_prec_heights, 15, sizeof(c->log2_prec_heights));\n }\n return 0;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0a709e2a10b8288a0cc383547924ecfe285cef89", + "input": "static int dnxhd_find_frame_end(DNXHDParserContext *dctx,\n const uint8_t *buf, int buf_size)\n{\n ParseContext *pc = &dctx->pc;\n uint64_t state = pc->state64;\n int pic_found = pc->frame_start_found;\n int i = 0;\n\n if (!pic_found) {\n for (i = 0; i < buf_size; i++) {\n state = (state << 8) | buf[i];\n if (ff_dnxhd_check_header_prefix(state & 0xffffffffff00LL) != 0) {\n i++;\n pic_found = 1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n break;\n }\n }\n }\n\n if (pic_found && !dctx->remaining) {\n if (!buf_size) /* EOF considered as end of frame */\n return 0;\n for (; i < buf_size; i++) {\n dctx->cur_byte++;\n state = (state << 8) | buf[i];\n\n if (dctx->cur_byte == 24) {\n dctx->h = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 26) {\n dctx->w = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 42) {\n int cid = (state >> 32) & 0xFFFFFFFF;\n \n if (cid <= 0)\n continue;\n \n dctx->remaining = avpriv_dnxhd_get_frame_size(cid);\n if (dctx->remaining <= 0) {\n dctx->remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);\n if (dctx->remaining <= 0)\n return dctx->remaining;\n }\n if (buf_size - i + 47 >= dctx->remaining) {\n int remaining = dctx->remaining;\n \n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n } else {\n dctx->remaining -= buf_size;\n }\n }\n }\n } else if (pic_found) {\n if (dctx->remaining > buf_size) {\n dctx->remaining -= buf_size;\n } else {\n int remaining = dctx->remaining;\n\n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n }\n }\n pc->frame_start_found = pic_found;\n pc->state64 = state;\n return END_NOT_FOUND;\n}\n", + "target": "static int dnxhd_find_frame_end(DNXHDParserContext *dctx,\n const uint8_t *buf, int buf_size)\n{\n ParseContext *pc = &dctx->pc;\n uint64_t state = pc->state64;\n int pic_found = pc->frame_start_found;\n int i = 0;\n\n if (!pic_found) {\n for (i = 0; i < buf_size; i++) {\n state = (state << 8) | buf[i];\n if (ff_dnxhd_check_header_prefix(state & 0xffffffffff00LL) != 0) {\n i++;\n pic_found = 1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n break;\n }\n }\n }\n\n if (pic_found && !dctx->remaining) {\n if (!buf_size) /* EOF considered as end of frame */\n return 0;\n for (; i < buf_size; i++) {\n dctx->cur_byte++;\n state = (state << 8) | buf[i];\n\n if (dctx->cur_byte == 24) {\n dctx->h = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 26) {\n dctx->w = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 42) {\n int cid = (state >> 32) & 0xFFFFFFFF;\n int remaining;\n \n if (cid <= 0)\n continue;\n \n remaining = avpriv_dnxhd_get_frame_size(cid);\n if (remaining <= 0) {\n remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);\n if (remaining <= 0)\n continue;\n }\n dctx->remaining = remaining;\n if (buf_size - i + 47 >= dctx->remaining) {\n int remaining = dctx->remaining;\n \n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n } else {\n dctx->remaining -= buf_size;\n }\n }\n }\n } else if (pic_found) {\n if (dctx->remaining > buf_size) {\n dctx->remaining -= buf_size;\n } else {\n int remaining = dctx->remaining;\n\n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n }\n }\n pc->frame_start_found = pic_found;\n pc->state64 = state;\n return END_NOT_FOUND;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0c14577c9905bd8161159ec7eaac810c594508d0", + "input": "int OmniboxViewWin::OnPerformDropImpl(const views::DropTargetEvent& event,\n bool in_drag) {\n const ui::OSExchangeData& data = event.data();\n\n if (data.HasURL()) {\n GURL url;\n string16 title;\n if (data.GetURLAndTitle(&url, &title)) {\n string16 text(StripJavascriptSchemas(UTF8ToUTF16(url.spec())));\n SetUserText(text);\n if (url.spec().length() == text.length())\n model()->AcceptInput(CURRENT_TAB, true);\n return CopyOrLinkDragOperation(event.source_operations());\n }\n } else if (data.HasString()) {\n int string_drop_position = drop_highlight_position();\n string16 text;\n if ((string_drop_position != -1 || !in_drag) && data.GetString(&text)) {\n DCHECK(string_drop_position == -1 ||\n ((string_drop_position >= 0) &&\n (string_drop_position <= GetTextLength())));\n if (in_drag) {\n if (event.source_operations()== ui::DragDropTypes::DRAG_MOVE)\n MoveSelectedText(string_drop_position);\n else\n InsertText(string_drop_position, text);\n } else {\n PasteAndGo(CollapseWhitespace(text, true));\n }\n return CopyOrLinkDragOperation(event.source_operations());\n }\n }\n\n return ui::DragDropTypes::DRAG_NONE;\n}\n", + "target": "int OmniboxViewWin::OnPerformDropImpl(const views::DropTargetEvent& event,\n bool in_drag) {\n const ui::OSExchangeData& data = event.data();\n\n if (data.HasURL()) {\n GURL url;\n string16 title;\n if (data.GetURLAndTitle(&url, &title)) {\n string16 text(StripJavascriptSchemas(UTF8ToUTF16(url.spec())));\n SetUserText(text);\n model()->AcceptInput(CURRENT_TAB, true);\n return CopyOrLinkDragOperation(event.source_operations());\n }\n } else if (data.HasString()) {\n int string_drop_position = drop_highlight_position();\n string16 text;\n if ((string_drop_position != -1 || !in_drag) && data.GetString(&text)) {\n DCHECK(string_drop_position == -1 ||\n ((string_drop_position >= 0) &&\n (string_drop_position <= GetTextLength())));\n if (in_drag) {\n if (event.source_operations()== ui::DragDropTypes::DRAG_MOVE)\n MoveSelectedText(string_drop_position);\n else\n InsertText(string_drop_position, text);\n } else {\n PasteAndGo(CollapseWhitespace(text, true));\n }\n return CopyOrLinkDragOperation(event.source_operations());\n }\n }\n\n return ui::DragDropTypes::DRAG_NONE;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dd248ed7e204ee8a1873914e02b8b526e8f1b80d", + "input": "static void virtio_gpu_set_scanout(VirtIOGPU *g,\n struct virtio_gpu_ctrl_command *cmd)\n{\n struct virtio_gpu_simple_resource *res;\n struct virtio_gpu_scanout *scanout;\n pixman_format_code_t format;\n uint32_t offset;\n int bpp;\n struct virtio_gpu_set_scanout ss;\n\n VIRTIO_GPU_FILL_CMD(ss);\n trace_virtio_gpu_cmd_set_scanout(ss.scanout_id, ss.resource_id,\n ss.r.width, ss.r.height, ss.r.x, ss.r.y);\n\n if (ss.scanout_id >= g->conf.max_outputs) {\n qemu_log_mask(LOG_GUEST_ERROR, \"%s: illegal scanout id specified %d\",\n __func__, ss.scanout_id);\n cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID;\n return;\n }\n\n g->enable = 1;\n if (ss.resource_id == 0) {\n scanout = &g->scanout[ss.scanout_id];\n if (scanout->resource_id) {\n res = virtio_gpu_find_resource(g, scanout->resource_id);\n if (res) {\n res->scanout_bitmask &= ~(1 << ss.scanout_id);\n }\n }\n if (ss.scanout_id == 0) {\n qemu_log_mask(LOG_GUEST_ERROR,\n \"%s: illegal scanout id specified %d\",\n __func__, ss.scanout_id);\n cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID;\n return;\n }\n dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con, NULL);\n scanout->ds = NULL;\n scanout->width = 0;\n scanout->height = 0;\n return;\n }\n\n /* create a surface for this scanout */\n res = virtio_gpu_find_resource(g, ss.resource_id);\n if (!res) {\n qemu_log_mask(LOG_GUEST_ERROR, \"%s: illegal resource specified %d\\n\",\n __func__, ss.resource_id);\n cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;\n return;\n }\n\n if (ss.r.x > res->width ||\n ss.r.y > res->height ||\n ss.r.width > res->width ||\n ss.r.height > res->height ||\n ss.r.x + ss.r.width > res->width ||\n ss.r.y + ss.r.height > res->height) {\n qemu_log_mask(LOG_GUEST_ERROR, \"%s: illegal scanout %d bounds for\"\n \" resource %d, (%d,%d)+%d,%d vs %d %d\\n\",\n __func__, ss.scanout_id, ss.resource_id, ss.r.x, ss.r.y,\n ss.r.width, ss.r.height, res->width, res->height);\n cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;\n return;\n }\n\n scanout = &g->scanout[ss.scanout_id];\n\n format = pixman_image_get_format(res->image);\n bpp = (PIXMAN_FORMAT_BPP(format) + 7) / 8;\n offset = (ss.r.x * bpp) + ss.r.y * pixman_image_get_stride(res->image);\n if (!scanout->ds || surface_data(scanout->ds)\n != ((uint8_t *)pixman_image_get_data(res->image) + offset) ||\n scanout->width != ss.r.width ||\n scanout->height != ss.r.height) {\n pixman_image_t *rect;\n void *ptr = (uint8_t *)pixman_image_get_data(res->image) + offset;\n rect = pixman_image_create_bits(format, ss.r.width, ss.r.height, ptr,\n pixman_image_get_stride(res->image));\n pixman_image_ref(res->image);\n pixman_image_set_destroy_function(rect, virtio_unref_resource,\n res->image);\n /* realloc the surface ptr */\n scanout->ds = qemu_create_displaysurface_pixman(rect);\n if (!scanout->ds) {\n cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;\n return;\n }\n dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con, scanout->ds);\n }\n scanout->resource_id = ss.resource_id;\n scanout->x = ss.r.x;\n scanout->y = ss.r.y;\n scanout->width = ss.r.width;\n scanout->height = ss.r.height;\n}\n", + "target": "static void virtio_gpu_set_scanout(VirtIOGPU *g,\n struct virtio_gpu_ctrl_command *cmd)\n{\n struct virtio_gpu_simple_resource *res;\n struct virtio_gpu_scanout *scanout;\n pixman_format_code_t format;\n uint32_t offset;\n int bpp;\n struct virtio_gpu_set_scanout ss;\n\n VIRTIO_GPU_FILL_CMD(ss);\n trace_virtio_gpu_cmd_set_scanout(ss.scanout_id, ss.resource_id,\n ss.r.width, ss.r.height, ss.r.x, ss.r.y);\n\n if (ss.scanout_id >= g->conf.max_outputs) {\n qemu_log_mask(LOG_GUEST_ERROR, \"%s: illegal scanout id specified %d\",\n __func__, ss.scanout_id);\n cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID;\n return;\n }\n\n g->enable = 1;\n if (ss.resource_id == 0) {\n scanout = &g->scanout[ss.scanout_id];\n if (scanout->resource_id) {\n res = virtio_gpu_find_resource(g, scanout->resource_id);\n if (res) {\n res->scanout_bitmask &= ~(1 << ss.scanout_id);\n }\n }\n if (ss.scanout_id == 0) {\n qemu_log_mask(LOG_GUEST_ERROR,\n \"%s: illegal scanout id specified %d\",\n __func__, ss.scanout_id);\n cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID;\n return;\n }\n dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con, NULL);\n scanout->ds = NULL;\n scanout->width = 0;\n scanout->height = 0;\n return;\n }\n\n /* create a surface for this scanout */\n res = virtio_gpu_find_resource(g, ss.resource_id);\n if (!res) {\n qemu_log_mask(LOG_GUEST_ERROR, \"%s: illegal resource specified %d\\n\",\n __func__, ss.resource_id);\n cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;\n return;\n }\n\n if (ss.r.x > res->width ||\n ss.r.y > res->height ||\n ss.r.width > res->width ||\n ss.r.height > res->height ||\n ss.r.x + ss.r.width > res->width ||\n ss.r.y + ss.r.height > res->height) {\n qemu_log_mask(LOG_GUEST_ERROR, \"%s: illegal scanout %d bounds for\"\n \" resource %d, (%d,%d)+%d,%d vs %d %d\\n\",\n __func__, ss.scanout_id, ss.resource_id, ss.r.x, ss.r.y,\n ss.r.width, ss.r.height, res->width, res->height);\n cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;\n return;\n }\n\n scanout = &g->scanout[ss.scanout_id];\n\n format = pixman_image_get_format(res->image);\n bpp = (PIXMAN_FORMAT_BPP(format) + 7) / 8;\n offset = (ss.r.x * bpp) + ss.r.y * pixman_image_get_stride(res->image);\n if (!scanout->ds || surface_data(scanout->ds)\n != ((uint8_t *)pixman_image_get_data(res->image) + offset) ||\n scanout->width != ss.r.width ||\n scanout->height != ss.r.height) {\n pixman_image_t *rect;\n void *ptr = (uint8_t *)pixman_image_get_data(res->image) + offset;\n rect = pixman_image_create_bits(format, ss.r.width, ss.r.height, ptr,\n pixman_image_get_stride(res->image));\n pixman_image_ref(res->image);\n pixman_image_set_destroy_function(rect, virtio_unref_resource,\n res->image);\n /* realloc the surface ptr */\n scanout->ds = qemu_create_displaysurface_pixman(rect);\n if (!scanout->ds) {\n cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;\n return;\n }\n pixman_image_unref(rect);\n dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con, scanout->ds);\n }\n scanout->resource_id = ss.resource_id;\n scanout->x = ss.r.x;\n scanout->y = ss.r.y;\n scanout->width = ss.r.width;\n scanout->height = ss.r.height;\n}\n", + "vul_type": "cwe-772", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc3857aac17be72c96f28d860d875235b3be349a", + "input": "QtBuiltinBundlePage::QtBuiltinBundlePage(QtBuiltinBundle* bundle, WKBundlePageRef page)\n : m_bundle(bundle)\n , m_page(page)\n , m_navigatorQtObject(0)\n , m_navigatorQtObjectEnabled(false)\n{\n WKBundlePageLoaderClient loaderClient = {\n kWKBundlePageLoaderClientCurrentVersion,\n this,\n 0, // didStartProvisionalLoadForFrame\n 0, // didReceiveServerRedirectForProvisionalLoadForFrame\n 0, // didFailProvisionalLoadWithErrorForFrame\n 0, // didCommitLoadForFrame\n 0, // didFinishDocumentLoadForFrame\n 0, // didFinishLoadForFrame\n 0, // didFailLoadWithErrorForFrame\n 0, // didSameDocumentNavigationForFrame\n 0, // didReceiveTitleForFrame\n 0, // didFirstLayoutForFrame\n 0, // didFirstVisuallyNonEmptyLayoutForFrame\n 0, // didRemoveFrameFromHierarchy\n 0, // didDisplayInsecureContentForFrame\n 0, // didRunInsecureContentForFrame\n didClearWindowForFrame,\n 0, // didCancelClientRedirectForFrame\n 0, // willPerformClientRedirectForFrame\n 0, // didHandleOnloadEventsForFrame\n 0, // didLayoutForFrame\n 0, // didNewFirstVisuallyNonEmptyLayoutForFrame\n 0, // didDetectXSSForFrame\n 0, // shouldGoToBackForwardListItem\n 0, // didCreateGlobalObjectForFrame\n 0, // willDisconnectDOMWindowExtensionFromGlobalObject\n 0, // didReconnectDOMWindowExtensionToGlobalObject\n 0, // willDestroyGlobalObjectForDOMWindowExtension\n 0, // didFinishProgress\n 0, // shouldForceUniversalAccessFromLocalURL\n 0, // didLayout\n };\n WKBundlePageSetPageLoaderClient(m_page, &loaderClient);\n}\n", + "target": "QtBuiltinBundlePage::QtBuiltinBundlePage(QtBuiltinBundle* bundle, WKBundlePageRef page)\n : m_bundle(bundle)\n , m_page(page)\n , m_navigatorQtObject(0)\n , m_navigatorQtObjectEnabled(false)\n{\n WKBundlePageLoaderClient loaderClient = {\n kWKBundlePageLoaderClientCurrentVersion,\n this,\n 0, // didStartProvisionalLoadForFrame\n 0, // didReceiveServerRedirectForProvisionalLoadForFrame\n 0, // didFailProvisionalLoadWithErrorForFrame\n 0, // didCommitLoadForFrame\n 0, // didFinishDocumentLoadForFrame\n 0, // didFinishLoadForFrame\n 0, // didFailLoadWithErrorForFrame\n 0, // didSameDocumentNavigationForFrame\n 0, // didReceiveTitleForFrame\n 0, // didFirstLayoutForFrame\n 0, // didFirstVisuallyNonEmptyLayoutForFrame\n 0, // didRemoveFrameFromHierarchy\n 0, // didDisplayInsecureContentForFrame\n 0, // didRunInsecureContentForFrame\n didClearWindowForFrame,\n 0, // didCancelClientRedirectForFrame\n 0, // willPerformClientRedirectForFrame\n 0, // didHandleOnloadEventsForFrame\n 0, // didLayoutForFrame\n 0, // didNewFirstVisuallyNonEmptyLayoutForFrame\n 0, // didDetectXSSForFrame\n 0, // shouldGoToBackForwardListItem\n 0, // didCreateGlobalObjectForFrame\n 0, // willDisconnectDOMWindowExtensionFromGlobalObject\n 0, // didReconnectDOMWindowExtensionToGlobalObject\n 0, // willDestroyGlobalObjectForDOMWindowExtension\n 0, // didFinishProgress\n 0, // shouldForceUniversalAccessFromLocalURL\n 0, // didReceiveIntentForFrame\n 0, // registerIntentServiceForFrame\n 0, // didLayout\n };\n WKBundlePageSetPageLoaderClient(m_page, &loaderClient);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dde871628c04863cf5992cb17e3e40f2ba576279", + "input": "void PepperVideoRenderer2D::FlushBuffer(const webrtc::DesktopRect& clip_area,\n webrtc::DesktopFrame* buffer,\n const webrtc::DesktopRegion& region) {\n if (flush_pending_) {\n DCHECK(merge_buffer_ == nullptr);\n\n merge_clip_area_ = clip_area;\n merge_buffer_ = buffer;\n merge_region_ = region;\n return;\n }\n\n base::Time start_time = base::Time::Now();\n\n for (webrtc::DesktopRegion::Iterator i(region); !i.IsAtEnd(); i.Advance()) {\n webrtc::DesktopRect rect = i.rect();\n\n rect.IntersectWith(clip_area_);\n if (rect.is_empty())\n continue;\n\n rect.Translate(-clip_area.left(), -clip_area.top());\n\n graphics2d_.PaintImageData(\n static_cast(buffer)->buffer(),\n pp::Point(clip_area.left(), clip_area.top()),\n pp::Rect(rect.left(), rect.top(), rect.width(), rect.height()));\n }\n\n if (!clip_area.equals(clip_area_)) {\n webrtc::DesktopRegion not_painted = region;\n not_painted.Subtract(clip_area_);\n if (!not_painted.is_empty()) {\n software_video_renderer_->InvalidateRegion(not_painted);\n }\n }\n\n pp::CompletionCallback callback = callback_factory_.NewCallback(\n &PepperVideoRenderer2D::OnFlushDone, start_time, buffer);\n int error = graphics2d_.Flush(callback);\n CHECK(error == PP_OK_COMPLETIONPENDING);\n flush_pending_ = true;\n }\n", + "target": "void PepperVideoRenderer2D::FlushBuffer(const webrtc::DesktopRect& clip_area,\n webrtc::DesktopFrame* buffer,\n const webrtc::DesktopRegion& region) {\n if (flush_pending_) {\n DCHECK(merge_buffer_ == nullptr);\n\n merge_clip_area_ = clip_area;\n merge_buffer_ = buffer;\n merge_region_ = region;\n return;\n }\n\n base::Time start_time = base::Time::Now();\n\n for (webrtc::DesktopRegion::Iterator i(region); !i.IsAtEnd(); i.Advance()) {\n webrtc::DesktopRect rect = i.rect();\n\n rect.IntersectWith(clip_area_);\n if (rect.is_empty())\n continue;\n\n rect.Translate(-clip_area.left(), -clip_area.top());\n\n graphics2d_.PaintImageData(\n static_cast(buffer)->buffer(),\n pp::Point(clip_area.left(), clip_area.top()),\n pp::Rect(rect.left(), rect.top(), rect.width(), rect.height()));\n }\n\n if (!clip_area.equals(clip_area_)) {\n webrtc::DesktopRegion not_painted = region;\n not_painted.Subtract(clip_area_);\n if (!not_painted.is_empty()) {\n software_video_renderer_->InvalidateRegion(not_painted);\n }\n }\n\n pp::CompletionCallback callback = callback_factory_.NewCallback(\n &PepperVideoRenderer2D::OnFlushDone, start_time, buffer);\n int error = graphics2d_.Flush(callback);\n CHECK(error == PP_OK_COMPLETIONPENDING);\n flush_pending_ = true;\n\n // If Debug dirty region is enabled then emit it.\n if (debug_dirty_region_) {\n event_handler_->OnVideoFrameDirtyRegion(region);\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7df3e59c3d1df4f87fe874c7956ef7a3d2f4d5fb", + "input": "static int __init big_key_crypto_init(void)\n{\n\tint ret = -EINVAL;\n \n\t/* init RNG */\n\tbig_key_rng = crypto_alloc_rng(big_key_rng_name, 0, 0);\n\tif (IS_ERR(big_key_rng)) {\n\t\tbig_key_rng = NULL;\n\t\treturn -EFAULT;\n \t}\n \n \t/* seed RNG */\n\tret = crypto_rng_reset(big_key_rng, NULL, crypto_rng_seedsize(big_key_rng));\n\tif (ret)\n\t\tgoto error;\n \n \t/* init block cipher */\n\tbig_key_skcipher = crypto_alloc_skcipher(big_key_alg_name,\n\t\t\t\t\t\t 0, CRYPTO_ALG_ASYNC);\n\tif (IS_ERR(big_key_skcipher)) {\n\t\tbig_key_skcipher = NULL;\n\t\tret = -EFAULT;\n\t\tgoto error;\n \t}\n \n \treturn 0;\n \nerror:\n \tcrypto_free_rng(big_key_rng);\n\tbig_key_rng = NULL;\n \treturn ret;\n }\n", + "target": "static int __init big_key_crypto_init(void)\n\tstruct crypto_skcipher *cipher;\n\tstruct crypto_rng *rng;\n\tint ret;\n \n\trng = crypto_alloc_rng(big_key_rng_name, 0, 0);\n\tif (IS_ERR(rng)) {\n\t\tpr_err(\"Can't alloc rng: %ld\\n\", PTR_ERR(rng));\n\t\treturn PTR_ERR(rng);\n \t}\n \n\tbig_key_rng = rng;\n\n \t/* seed RNG */\n\tret = crypto_rng_reset(rng, NULL, crypto_rng_seedsize(rng));\n\tif (ret) {\n\t\tpr_err(\"Can't reset rng: %d\\n\", ret);\n\t\tgoto error_rng;\n\t}\n \n \t/* init block cipher */\n\tcipher = crypto_alloc_skcipher(big_key_alg_name, 0, CRYPTO_ALG_ASYNC);\n\tif (IS_ERR(cipher)) {\n\t\tret = PTR_ERR(cipher);\n\t\tpr_err(\"Can't alloc crypto: %d\\n\", ret);\n\t\tgoto error_rng;\n\t}\n\n\tbig_key_skcipher = cipher;\n\n\tret = register_key_type(&key_type_big_key);\n\tif (ret < 0) {\n\t\tpr_err(\"Can't register type: %d\\n\", ret);\n\t\tgoto error_cipher;\n \t}\n \n \treturn 0;\n \nerror_cipher:\n\tcrypto_free_skcipher(big_key_skcipher);\nerror_rng:\n \tcrypto_free_rng(big_key_rng);\n \treturn ret;\n }\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#730fc35968c5433b9e2a829779057f4f9495dc51", + "input": " lookup_bytestring(netdissect_options *ndo, register const u_char *bs,\n \t\t const unsigned int nlen)\n {\n\tstruct enamemem *tp;\n \tregister u_int i, j, k;\n \n \tif (nlen >= 6) {\n\t\tk = (bs[0] << 8) | bs[1];\n\t\tj = (bs[2] << 8) | bs[3];\n\t\ti = (bs[4] << 8) | bs[5];\n\t} else if (nlen >= 4) {\n\t\tk = (bs[0] << 8) | bs[1];\n\t\tj = (bs[2] << 8) | bs[3];\n\t\ti = 0;\n\t} else\n \t\ti = j = k = 0;\n \n \ttp = &bytestringtable[(i ^ j) & (HASHNAMESIZE-1)];\n\twhile (tp->e_nxt)\n\t\tif (tp->e_addr0 == i &&\n\t\t tp->e_addr1 == j &&\n\t\t tp->e_addr2 == k &&\n\t\t memcmp((const char *)bs, (const char *)(tp->e_bs), nlen) == 0)\n \t\t\treturn tp;\n \t\telse\n\t\t\ttp = tp->e_nxt;\n \n\ttp->e_addr0 = i;\n\ttp->e_addr1 = j;\n\ttp->e_addr2 = k;\n \n\ttp->e_bs = (u_char *) calloc(1, nlen + 1);\n\tif (tp->e_bs == NULL)\n \t\t(*ndo->ndo_error)(ndo, \"lookup_bytestring: calloc\");\n \n\tmemcpy(tp->e_bs, bs, nlen);\n\ttp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp));\n\tif (tp->e_nxt == NULL)\n \t\t(*ndo->ndo_error)(ndo, \"lookup_bytestring: calloc\");\n \n \treturn tp;\n}\n", + "target": " lookup_bytestring(netdissect_options *ndo, register const u_char *bs,\n \t\t const unsigned int nlen)\n {\n\tstruct bsnamemem *tp;\n \tregister u_int i, j, k;\n \n \tif (nlen >= 6) {\n\t\tk = (bs[0] << 8) | bs[1];\n\t\tj = (bs[2] << 8) | bs[3];\n\t\ti = (bs[4] << 8) | bs[5];\n\t} else if (nlen >= 4) {\n\t\tk = (bs[0] << 8) | bs[1];\n\t\tj = (bs[2] << 8) | bs[3];\n\t\ti = 0;\n\t} else\n \t\ti = j = k = 0;\n \n \ttp = &bytestringtable[(i ^ j) & (HASHNAMESIZE-1)];\n\twhile (tp->bs_nxt)\n\t\tif (nlen == tp->bs_nbytes &&\n\t\t tp->bs_addr0 == i &&\n\t\t tp->bs_addr1 == j &&\n\t\t tp->bs_addr2 == k &&\n\t\t memcmp((const char *)bs, (const char *)(tp->bs_bytes), nlen) == 0)\n \t\t\treturn tp;\n \t\telse\n\t\t\ttp = tp->bs_nxt;\n \n\ttp->bs_addr0 = i;\n\ttp->bs_addr1 = j;\n\ttp->bs_addr2 = k;\n \n\ttp->bs_bytes = (u_char *) calloc(1, nlen + 1);\n\tif (tp->bs_bytes == NULL)\n \t\t(*ndo->ndo_error)(ndo, \"lookup_bytestring: calloc\");\n \n\tmemcpy(tp->bs_bytes, bs, nlen);\n\ttp->bs_nbytes = nlen;\n\ttp->bs_nxt = (struct bsnamemem *)calloc(1, sizeof(*tp));\n\tif (tp->bs_nxt == NULL)\n \t\t(*ndo->ndo_error)(ndo, \"lookup_bytestring: calloc\");\n \n \treturn tp;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#350f7d4b2c76950c8e7271284de84a9756b796e1", + "input": "void QuicTransportHost::Initialize(\n IceTransportHost* ice_transport_host,\n quic::Perspective perspective,\n const std::vector>& certificates) {\n DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);\n DCHECK(ice_transport_host);\n DCHECK(!ice_transport_host_);\n ice_transport_host_ = ice_transport_host;\n P2PQuicTransportConfig config(\n this, ice_transport_host->ConnectConsumer(this)->packet_transport(),\n certificates);\n config.is_server = (perspective == quic::Perspective::IS_SERVER);\n quic_transport_ =\n quic_transport_factory_->CreateQuicTransport(std::move(config));\n}\n", + "target": "void QuicTransportHost::Initialize(\n IceTransportHost* ice_transport_host,\n quic::Perspective perspective,\n const std::vector>& certificates) {\n DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);\n DCHECK(ice_transport_host);\n DCHECK(!ice_transport_host_);\n ice_transport_host_ = ice_transport_host;\n // TODO(https://crbug.com/874296): Pass through values for read and write\n // stream buffer sizes in the P2PQuicTransportConfig. Currently this is just\n // set to the same size as the QUIC receive window size (24 MB).\n uint32_t stream_buffer_size = 24 * 1024 * 1024;\n P2PQuicTransportConfig config(\n this, ice_transport_host->ConnectConsumer(this)->packet_transport(),\n certificates, stream_buffer_size);\n config.is_server = (perspective == quic::Perspective::IS_SERVER);\n quic_transport_ =\n quic_transport_factory_->CreateQuicTransport(std::move(config));\n}\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#35ab4475a7df9b2a4bcab235e379c0c3ec543658", + "input": "void set_cfg_option(char *opt_string)\n{\n\tchar *sep, *sep2, szSec[1024], szKey[1024], szVal[1024];\n\tsep = strchr(opt_string, ':');\n\tif (!sep) {\n\t\tfprintf(stderr, \"Badly formatted option %s - expected Section:Name=Value\\n\", opt_string);\n\t\treturn;\n \t}\n \t{\n \t\tconst size_t sepIdx = sep - opt_string;\n \t\tstrncpy(szSec, opt_string, sepIdx);\n \t\tszSec[sepIdx] = 0;\n \t}\n\tsep ++;\n\tsep2 = strchr(sep, '=');\n\tif (!sep2) {\n\t\tfprintf(stderr, \"Badly formatted option %s - expected Section:Name=Value\\n\", opt_string);\n\t\treturn;\n \t}\n \t{\n \t\tconst size_t sepIdx = sep2 - sep;\n \t\tstrncpy(szKey, sep, sepIdx);\n \t\tszKey[sepIdx] = 0;\n \t\tstrcpy(szVal, sep2+1);\n \t}\n \n\tif (!stricmp(szKey, \"*\")) {\n\t\tif (stricmp(szVal, \"null\")) {\n\t\t\tfprintf(stderr, \"Badly formatted option %s - expected Section:*=null\\n\", opt_string);\n\t\t\treturn;\n\t\t}\n\t\tgf_cfg_del_section(cfg_file, szSec);\n\t\treturn;\n\t}\n\n\tif (!stricmp(szVal, \"null\")) {\n\t\tszVal[0]=0;\n\t}\n\tgf_cfg_set_key(cfg_file, szSec, szKey, szVal[0] ? szVal : NULL);\n}\n", + "target": "void set_cfg_option(char *opt_string)\n{\n\tchar *sep, *sep2, szSec[1024], szKey[1024], szVal[1024];\n\tsep = strchr(opt_string, ':');\n\tif (!sep) {\n\t\tfprintf(stderr, \"Badly formatted option %s - expected Section:Name=Value\\n\", opt_string);\n\t\treturn;\n \t}\n \t{\n \t\tconst size_t sepIdx = sep - opt_string;\n\t\tif (sepIdx >= sizeof(szSec)) {\n\t\t\tfprintf(stderr, \"Badly formatted option %s - Section name is too long\\n\", opt_string);\n\t\t\treturn;\n\t\t}\n\n \t\tstrncpy(szSec, opt_string, sepIdx);\n \t\tszSec[sepIdx] = 0;\n \t}\n\tsep ++;\n\tsep2 = strchr(sep, '=');\n\tif (!sep2) {\n\t\tfprintf(stderr, \"Badly formatted option %s - expected Section:Name=Value\\n\", opt_string);\n\t\treturn;\n \t}\n \t{\n \t\tconst size_t sepIdx = sep2 - sep;\n\t\tif (sepIdx >= sizeof(szKey)) {\n\t\t\tfprintf(stderr, \"Badly formatted option %s - key name is too long\\n\", opt_string);\n\t\t\treturn;\n\t\t}\n \t\tstrncpy(szKey, sep, sepIdx);\n \t\tszKey[sepIdx] = 0;\n\t\tif (strlen(sep2 + 1) >= sizeof(szVal)) {\n\t\t\tfprintf(stderr, \"Badly formatted option %s - value is too long\\n\", opt_string);\n\t\t\treturn;\n\t\t}\n \t\tstrcpy(szVal, sep2+1);\n \t}\n \n\tif (!stricmp(szKey, \"*\")) {\n\t\tif (stricmp(szVal, \"null\")) {\n\t\t\tfprintf(stderr, \"Badly formatted option %s - expected Section:*=null\\n\", opt_string);\n\t\t\treturn;\n\t\t}\n\t\tgf_cfg_del_section(cfg_file, szSec);\n\t\treturn;\n\t}\n\n\tif (!stricmp(szVal, \"null\")) {\n\t\tszVal[0]=0;\n\t}\n\tgf_cfg_set_key(cfg_file, szSec, szKey, szVal[0] ? szVal : NULL);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a1b14d27ed0965838350f1377ff97c93ee383492", + "input": "static void adjust_branches(struct bpf_prog *prog, int pos, int delta)\n{\n\tstruct bpf_insn *insn = prog->insnsi;\n\tint insn_cnt = prog->len;\n\tint i;\n\n\tfor (i = 0; i < insn_cnt; i++, insn++) {\n\t\tif (BPF_CLASS(insn->code) != BPF_JMP ||\n\t\t BPF_OP(insn->code) == BPF_CALL ||\n\t\t BPF_OP(insn->code) == BPF_EXIT)\n\t\t\tcontinue;\n\n \t\t/* adjust offset of jmps if necessary */\n \t\tif (i < pos && i + insn->off + 1 > pos)\n \t\t\tinsn->off += delta;\n\t\telse if (i > pos && i + insn->off + 1 < pos)\n \t\t\tinsn->off -= delta;\n \t}\n }\n", + "target": "static void adjust_branches(struct bpf_prog *prog, int pos, int delta)\n{\n\tstruct bpf_insn *insn = prog->insnsi;\n\tint insn_cnt = prog->len;\n\tint i;\n\n\tfor (i = 0; i < insn_cnt; i++, insn++) {\n\t\tif (BPF_CLASS(insn->code) != BPF_JMP ||\n\t\t BPF_OP(insn->code) == BPF_CALL ||\n\t\t BPF_OP(insn->code) == BPF_EXIT)\n\t\t\tcontinue;\n\n \t\t/* adjust offset of jmps if necessary */\n \t\tif (i < pos && i + insn->off + 1 > pos)\n \t\t\tinsn->off += delta;\n\t\telse if (i > pos + delta && i + insn->off + 1 <= pos + delta)\n \t\t\tinsn->off -= delta;\n \t}\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d358f57009b85fb7440208afa5ba87636b491889", + "input": "void BluetoothDeviceChromeOS::AuthorizeService(\n const dbus::ObjectPath& device_path,\n const std::string& uuid,\n const ConfirmationCallback& callback) {\n callback.Run(CANCELLED);\n}\n", + "target": "void BluetoothDeviceChromeOS::AuthorizeService(\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5e26325317c72a04c1610ad952974e206384d291", + "input": "char *my_asctime(time_t t)\n{\n\tstruct tm *tm;\n\tchar *str;\n int len;\n \n \ttm = localtime(&t);\n \tstr = g_strdup(asctime(tm));\n \n \tlen = strlen(str);\n\tif (len > 0) str[len-1] = '\\0';\n return str;\n}\n", + "target": "char *my_asctime(time_t t)\n{\n\tstruct tm *tm;\n\tchar *str;\n int len;\n \n \ttm = localtime(&t);\n\tif (tm == NULL)\n\t return g_strdup(\"???\");\n\n \tstr = g_strdup(asctime(tm));\n \n \tlen = strlen(str);\n\tif (len > 0) str[len-1] = '\\0';\n return str;\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#deaa07bec5d105ffc546d37eba3da4cba341fc03", + "input": "void RunCallbacksWithDisabled(LogoCallbacks callbacks) {\n if (callbacks.on_cached_encoded_logo_available) {\n std::move(callbacks.on_cached_encoded_logo_available)\n .Run(LogoCallbackReason::DISABLED, base::nullopt);\n }\n if (callbacks.on_cached_decoded_logo_available) {\n std::move(callbacks.on_cached_decoded_logo_available)\n .Run(LogoCallbackReason::DISABLED, base::nullopt);\n }\n if (callbacks.on_fresh_encoded_logo_available) {\n std::move(callbacks.on_fresh_encoded_logo_available)\n .Run(LogoCallbackReason::DISABLED, base::nullopt);\n }\n if (callbacks.on_fresh_decoded_logo_available) {\n std::move(callbacks.on_fresh_decoded_logo_available)\n .Run(LogoCallbackReason::DISABLED, base::nullopt);\n }\n}\n", + "target": "void RunCallbacksWithDisabled(LogoCallbacks callbacks) {\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c25b198675380f713a56649c857b4367601d4a3d", + "input": " MediaControlsProgressView::MediaControlsProgressView(\n base::RepeatingCallback seek_callback)\n : seek_callback_(std::move(seek_callback)) {\n SetLayoutManager(std::make_unique(\n views::BoxLayout::Orientation::kVertical, kProgressViewInsets));\n \n progress_bar_ = AddChildView(std::make_unique(5, false));\n progress_bar_->SetBorder(views::CreateEmptyBorder(kProgressBarInsets));\n \n gfx::Font default_font;\n int font_size_delta = kProgressTimeFontSize - default_font.GetFontSize();\n gfx::Font font = default_font.Derive(font_size_delta, gfx::Font::NORMAL,\n gfx::Font::Weight::NORMAL);\n gfx::FontList font_list(font);\n\n auto time_view = std::make_unique();\n auto* time_view_layout =\n time_view->SetLayoutManager(std::make_unique());\n time_view_layout->SetOrientation(views::LayoutOrientation::kHorizontal)\n .SetMainAxisAlignment(views::LayoutAlignment::kCenter)\n .SetCrossAxisAlignment(views::LayoutAlignment::kCenter)\n .SetCollapseMargins(true);\n\n auto progress_time = std::make_unique();\n progress_time->SetFontList(font_list);\n progress_time->SetEnabledColor(SK_ColorWHITE);\n progress_time->SetAutoColorReadabilityEnabled(false);\n progress_time_ = time_view->AddChildView(std::move(progress_time));\n\n auto time_spacing = std::make_unique();\n time_spacing->SetPreferredSize(kTimeSpacingSize);\n time_spacing->SetProperty(views::kFlexBehaviorKey,\n views::FlexSpecification::ForSizeRule(\n views::MinimumFlexSizeRule::kPreferred,\n views::MaximumFlexSizeRule::kUnbounded));\n time_view->AddChildView(std::move(time_spacing));\n\n auto duration = std::make_unique();\n duration->SetFontList(font_list);\n duration->SetEnabledColor(SK_ColorWHITE);\n duration->SetAutoColorReadabilityEnabled(false);\n duration_ = time_view->AddChildView(std::move(duration));\n\n AddChildView(std::move(time_view));\n}\n", + "target": " MediaControlsProgressView::MediaControlsProgressView(\n base::RepeatingCallback seek_callback)\n : seek_callback_(std::move(seek_callback)) {\n SetLayoutManager(std::make_unique(\n views::BoxLayout::Orientation::kVertical, kProgressViewInsets,\n kProgressBarAndTimeSpacing));\n \n progress_bar_ = AddChildView(\n std::make_unique(kProgressBarHeight, false));\n \n gfx::Font default_font;\n int font_size_delta = kProgressTimeFontSize - default_font.GetFontSize();\n gfx::Font font = default_font.Derive(font_size_delta, gfx::Font::NORMAL,\n gfx::Font::Weight::NORMAL);\n gfx::FontList font_list(font);\n\n auto time_view = std::make_unique();\n auto* time_view_layout =\n time_view->SetLayoutManager(std::make_unique());\n time_view_layout->SetOrientation(views::LayoutOrientation::kHorizontal)\n .SetMainAxisAlignment(views::LayoutAlignment::kCenter)\n .SetCrossAxisAlignment(views::LayoutAlignment::kCenter)\n .SetCollapseMargins(true);\n\n auto progress_time = std::make_unique();\n progress_time->SetFontList(font_list);\n progress_time->SetEnabledColor(SK_ColorWHITE);\n progress_time->SetAutoColorReadabilityEnabled(false);\n progress_time_ = time_view->AddChildView(std::move(progress_time));\n\n auto time_spacing = std::make_unique();\n time_spacing->SetPreferredSize(kTimeSpacingSize);\n time_spacing->SetProperty(views::kFlexBehaviorKey,\n views::FlexSpecification::ForSizeRule(\n views::MinimumFlexSizeRule::kPreferred,\n views::MaximumFlexSizeRule::kUnbounded));\n time_view->AddChildView(std::move(time_spacing));\n\n auto duration = std::make_unique();\n duration->SetFontList(font_list);\n duration->SetEnabledColor(SK_ColorWHITE);\n duration->SetAutoColorReadabilityEnabled(false);\n duration_ = time_view->AddChildView(std::move(duration));\n\n AddChildView(std::move(time_view));\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e698d5c11d27212aa1098bc5b1673a3378563092", + "input": "jbig2_sd_new(Jbig2Ctx *ctx, int n_symbols)\n {\n Jbig2SymbolDict *new = NULL;\n \n if (n_symbols < 0) {\n jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, \"Negative number of symbols in symbol dict: %d\", n_symbols);\n return NULL;\n }\n \n new = jbig2_new(ctx, Jbig2SymbolDict, 1);\n if (new != NULL) {\n new->glyphs = jbig2_new(ctx, Jbig2Image *, n_symbols);\n new->n_symbols = n_symbols;\n } else {\n jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, \"unable to allocate new empty symbol dict\");\n return NULL;\n }\n \n if (new->glyphs != NULL) {\n memset(new->glyphs, 0, n_symbols * sizeof(Jbig2Image *));\n } else {\n jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, \"unable to allocate glyphs for new empty symbol dict\");\n jbig2_free(ctx->allocator, new);\n return NULL;\n }\n \n return new;\n }\n", + "target": "jbig2_sd_new(Jbig2Ctx *ctx, int n_symbols)\njbig2_sd_new(Jbig2Ctx *ctx, uint32_t n_symbols)\n {\n Jbig2SymbolDict *new_dict = NULL;\n \n if (n_symbols < 0) {\n jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, \"Negative number of symbols in symbol dict: %d\", n_symbols);\n return NULL;\n }\n \n new_dict = jbig2_new(ctx, Jbig2SymbolDict, 1);\n if (new_dict != NULL) {\n new_dict->glyphs = jbig2_new(ctx, Jbig2Image *, n_symbols);\n new_dict->n_symbols = n_symbols;\n } else {\n jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, \"unable to allocate new empty symbol dict\");\n return NULL;\n }\n \n if (new_dict->glyphs != NULL) {\n memset(new_dict->glyphs, 0, n_symbols * sizeof(Jbig2Image *));\n } else {\n jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, \"unable to allocate glyphs for new empty symbol dict\");\n jbig2_free(ctx->allocator, new_dict);\n return NULL;\n }\n \n return new_dict;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#5-181dbf70779d", + "input": "@app.route('/view/')\ndef view(sid):\n if '/' not in sid:\n path = os.path.join(app.config['UPLOAD_FOLDER'], sid)\n if os.path.isdir(path):\n using_firebase = 'true' if app.config['FIREBASE'] else 'false'\n return render_template('view.html',\n sid=sid, title=\"Progress for %s\" % sid, using_firebase=using_firebase)\n else:\n abort(404)\n else:\n abort(403)", + "target": "@app.route('/view/')\ndef view(sid):\n if utils.sid_is_valid(sid):\n path = join(app.config['UPLOAD_FOLDER'], sid)\n if os.path.isdir(path):\n using_firebase = 'true' if app.config['FIREBASE'] else 'false'\n return render_template('view.html', sid=sid,\n title=\"Progress for %s\" % sid,\n using_firebase=using_firebase)\n else:\n abort(404)\n else:\n abort(403)", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#fa1298c2d623522eda7b4f1f721fcb935abb7360", + "input": " static int ohci_bus_start(OHCIState *ohci)\n {\n ohci->eof_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,\n ohci_frame_boundary,\n ohci);\n if (ohci->eof_timer == NULL) {\n trace_usb_ohci_bus_eof_timer_failed(ohci->name);\n ohci_die(ohci);\n return 0;\n }\n trace_usb_ohci_start(ohci->name);\n \n /* Delay the first SOF event by one frame time as\n\n if (ohci->eof_timer == NULL) {\n trace_usb_ohci_bus_eof_timer_failed(ohci->name);\n ohci_die(ohci);\n return 0;\n }\n\n trace_usb_ohci_start(ohci->name);\n\n /* Delay the first SOF event by one frame time as\n static void ohci_bus_stop(OHCIState *ohci)\n {\n trace_usb_ohci_stop(ohci->name);\n if (ohci->eof_timer) {\n timer_del(ohci->eof_timer);\n timer_free(ohci->eof_timer);\n }\n ohci->eof_timer = NULL;\n }\n \n /* Sets a flag in a port status register but only set it if the port is\n}\n", + "target": " static int ohci_bus_start(OHCIState *ohci)\n {\n trace_usb_ohci_start(ohci->name);\n \n /* Delay the first SOF event by one frame time as\n\n if (ohci->eof_timer == NULL) {\n trace_usb_ohci_bus_eof_timer_failed(ohci->name);\n ohci_die(ohci);\n return 0;\n }\n\n trace_usb_ohci_start(ohci->name);\n\n /* Delay the first SOF event by one frame time as\n static void ohci_bus_stop(OHCIState *ohci)\n {\n trace_usb_ohci_stop(ohci->name);\n timer_del(ohci->eof_timer);\n }\n \n /* Sets a flag in a port status register but only set it if the port is\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#70cff275010b33dbab628f837d76364359065b79", + "input": " void RenderViewImpl::didActivateCompositor(int input_handler_identifier) {\n CompositorThread* compositor_thread =\n RenderThreadImpl::current()->compositor_thread();\n if (compositor_thread)\n compositor_thread->AddInputHandler(\n routing_id_, input_handler_identifier, AsWeakPtr());\n \n RenderWidget::didActivateCompositor(input_handler_identifier);\n \n ProcessAcceleratedPinchZoomFlags(*CommandLine::ForCurrentProcess());\n}\n", + "target": " void RenderViewImpl::didActivateCompositor(int input_handler_identifier) {\n#if !defined(OS_WIN) // http://crbug.com/160122\n CompositorThread* compositor_thread =\n RenderThreadImpl::current()->compositor_thread();\n if (compositor_thread)\n compositor_thread->AddInputHandler(\n routing_id_, input_handler_identifier, AsWeakPtr());\n#endif\n \n RenderWidget::didActivateCompositor(input_handler_identifier);\n \n ProcessAcceleratedPinchZoomFlags(*CommandLine::ForCurrentProcess());\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc7b094a338c6c521f918f478e993f0f74bbea0d", + "input": "bool ConvertProperty(IBusProperty* ibus_prop,\n int selection_item_id,\n ImePropertyList* out_prop_list) {\n DCHECK(ibus_prop);\n DCHECK(ibus_prop->key);\n DCHECK(out_prop_list);\n\n const bool has_sub_props = PropertyHasChildren(ibus_prop);\n if (has_sub_props && (ibus_prop->type != PROP_TYPE_MENU)) {\n LOG(ERROR) << \"The property has sub properties, \"\n << \"but the type of the property is not PROP_TYPE_MENU\";\n return false;\n }\n if ((!has_sub_props) && (ibus_prop->type == PROP_TYPE_MENU)) {\n DLOG(INFO) << \"Property list is empty\";\n return false;\n }\n if (ibus_prop->type == PROP_TYPE_SEPARATOR ||\n ibus_prop->type == PROP_TYPE_MENU) {\n return true;\n }\n\n const bool is_selection_item = (ibus_prop->type == PROP_TYPE_RADIO);\n selection_item_id = is_selection_item ?\n selection_item_id : ImeProperty::kInvalidSelectionItemId;\n\n bool is_selection_item_checked = false;\n if (ibus_prop->state == PROP_STATE_INCONSISTENT) {\n LOG(WARNING) << \"The property is in PROP_STATE_INCONSISTENT, \"\n << \"which is not supported.\";\n } else if ((!is_selection_item) && (ibus_prop->state == PROP_STATE_CHECKED)) {\n LOG(WARNING) << \"PROP_STATE_CHECKED is meaningful only if the type is \"\n << \"PROP_TYPE_RADIO.\";\n } else {\n is_selection_item_checked = (ibus_prop->state == PROP_STATE_CHECKED);\n }\n\n if (!ibus_prop->key) {\n LOG(ERROR) << \"key is NULL\";\n }\n if (ibus_prop->tooltip && (!ibus_prop->tooltip->text)) {\n LOG(ERROR) << \"tooltip is NOT NULL, but tooltip->text IS NULL: key=\"\n << Or(ibus_prop->key, \"\");\n }\n if (ibus_prop->label && (!ibus_prop->label->text)) {\n LOG(ERROR) << \"label is NOT NULL, but label->text IS NULL: key=\"\n << Or(ibus_prop->key, \"\");\n }\n\n std::string label =\n ((ibus_prop->tooltip &&\n ibus_prop->tooltip->text) ? ibus_prop->tooltip->text : \"\");\n if (label.empty()) {\n label = (ibus_prop->label && ibus_prop->label->text)\n ? ibus_prop->label->text : \"\";\n }\n if (label.empty()) {\n label = Or(ibus_prop->key, \"\");\n }\n\n out_prop_list->push_back(ImeProperty(ibus_prop->key,\n label,\n is_selection_item,\n is_selection_item_checked,\n selection_item_id));\n return true;\n}\n", + "target": "bool ConvertProperty(IBusProperty* ibus_prop,\n int selection_item_id,\n ImePropertyList* out_prop_list) {\n DCHECK(ibus_prop);\n DCHECK(ibus_prop->key);\n DCHECK(out_prop_list);\n\n const bool has_sub_props = PropertyHasChildren(ibus_prop);\n if (has_sub_props && (ibus_prop->type != PROP_TYPE_MENU)) {\n LOG(ERROR) << \"The property has sub properties, \"\n << \"but the type of the property is not PROP_TYPE_MENU\";\n return false;\n }\n if ((!has_sub_props) && (ibus_prop->type == PROP_TYPE_MENU)) {\n VLOG(1) << \"Property list is empty\";\n return false;\n }\n if (ibus_prop->type == PROP_TYPE_SEPARATOR ||\n ibus_prop->type == PROP_TYPE_MENU) {\n return true;\n }\n\n const bool is_selection_item = (ibus_prop->type == PROP_TYPE_RADIO);\n selection_item_id = is_selection_item ?\n selection_item_id : ImeProperty::kInvalidSelectionItemId;\n\n bool is_selection_item_checked = false;\n if (ibus_prop->state == PROP_STATE_INCONSISTENT) {\n LOG(WARNING) << \"The property is in PROP_STATE_INCONSISTENT, \"\n << \"which is not supported.\";\n } else if ((!is_selection_item) && (ibus_prop->state == PROP_STATE_CHECKED)) {\n LOG(WARNING) << \"PROP_STATE_CHECKED is meaningful only if the type is \"\n << \"PROP_TYPE_RADIO.\";\n } else {\n is_selection_item_checked = (ibus_prop->state == PROP_STATE_CHECKED);\n }\n\n if (!ibus_prop->key) {\n LOG(ERROR) << \"key is NULL\";\n }\n if (ibus_prop->tooltip && (!ibus_prop->tooltip->text)) {\n LOG(ERROR) << \"tooltip is NOT NULL, but tooltip->text IS NULL: key=\"\n << Or(ibus_prop->key, \"\");\n }\n if (ibus_prop->label && (!ibus_prop->label->text)) {\n LOG(ERROR) << \"label is NOT NULL, but label->text IS NULL: key=\"\n << Or(ibus_prop->key, \"\");\n }\n\n std::string label =\n ((ibus_prop->tooltip &&\n ibus_prop->tooltip->text) ? ibus_prop->tooltip->text : \"\");\n if (label.empty()) {\n label = (ibus_prop->label && ibus_prop->label->text)\n ? ibus_prop->label->text : \"\";\n }\n if (label.empty()) {\n label = Or(ibus_prop->key, \"\");\n }\n\n out_prop_list->push_back(ImeProperty(ibus_prop->key,\n label,\n is_selection_item,\n is_selection_item_checked,\n selection_item_id));\n return true;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3592aaeb80290bda0f2cf0b5456c97bfc638b192", + "input": "static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,\n\t\t\t int *uaddrlen, int peer)\n{\n \tstruct sockaddr_llc sllc;\n \tstruct sock *sk = sock->sk;\n \tstruct llc_sock *llc = llc_sk(sk);\n\tint rc = 0;\n \n \tmemset(&sllc, 0, sizeof(sllc));\n \tlock_sock(sk);\n \tif (sock_flag(sk, SOCK_ZAPPED))\n \t\tgoto out;\n \t*uaddrlen = sizeof(sllc);\n\tmemset(uaddr, 0, *uaddrlen);\n \tif (peer) {\n \t\trc = -ENOTCONN;\n \t\tif (sk->sk_state != TCP_ESTABLISHED)\n\t\t\tgoto out;\n\t\tif(llc->dev)\n\t\t\tsllc.sllc_arphrd = llc->dev->type;\n\t\tsllc.sllc_sap = llc->daddr.lsap;\n\t\tmemcpy(&sllc.sllc_mac, &llc->daddr.mac, IFHWADDRLEN);\n\t} else {\n\t\trc = -EINVAL;\n\t\tif (!llc->sap)\n\t\t\tgoto out;\n\t\tsllc.sllc_sap = llc->sap->laddr.lsap;\n\n\t\tif (llc->dev) {\n\t\t\tsllc.sllc_arphrd = llc->dev->type;\n\t\t\tmemcpy(&sllc.sllc_mac, llc->dev->dev_addr,\n\t\t\t IFHWADDRLEN);\n\t\t}\n\t}\n\trc = 0;\n\tsllc.sllc_family = AF_LLC;\n\tmemcpy(uaddr, &sllc, sizeof(sllc));\nout:\n\trelease_sock(sk);\n\treturn rc;\n}\n", + "target": "static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,\n\t\t\t int *uaddrlen, int peer)\n{\n \tstruct sockaddr_llc sllc;\n \tstruct sock *sk = sock->sk;\n \tstruct llc_sock *llc = llc_sk(sk);\n\tint rc = -EBADF;\n \n \tmemset(&sllc, 0, sizeof(sllc));\n \tlock_sock(sk);\n \tif (sock_flag(sk, SOCK_ZAPPED))\n \t\tgoto out;\n \t*uaddrlen = sizeof(sllc);\n \tif (peer) {\n \t\trc = -ENOTCONN;\n \t\tif (sk->sk_state != TCP_ESTABLISHED)\n\t\t\tgoto out;\n\t\tif(llc->dev)\n\t\t\tsllc.sllc_arphrd = llc->dev->type;\n\t\tsllc.sllc_sap = llc->daddr.lsap;\n\t\tmemcpy(&sllc.sllc_mac, &llc->daddr.mac, IFHWADDRLEN);\n\t} else {\n\t\trc = -EINVAL;\n\t\tif (!llc->sap)\n\t\t\tgoto out;\n\t\tsllc.sllc_sap = llc->sap->laddr.lsap;\n\n\t\tif (llc->dev) {\n\t\t\tsllc.sllc_arphrd = llc->dev->type;\n\t\t\tmemcpy(&sllc.sllc_mac, llc->dev->dev_addr,\n\t\t\t IFHWADDRLEN);\n\t\t}\n\t}\n\trc = 0;\n\tsllc.sllc_family = AF_LLC;\n\tmemcpy(uaddr, &sllc, sizeof(sllc));\nout:\n\trelease_sock(sk);\n\treturn rc;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1", + "input": " void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, int len, int use_copy TSRMLS_DC) /* {{{ */\n {\n \tchar *p1, *p2;\n \tif (intern->file_name) {\n \t\tefree(intern->file_name);\n \t}\n\n\tintern->file_name = use_copy ? estrndup(path, len) : path;\n\tintern->file_name_len = len;\n\n\twhile(IS_SLASH_AT(intern->file_name, intern->file_name_len-1) && intern->file_name_len > 1) {\n\t\tintern->file_name[intern->file_name_len-1] = 0;\n\t\tintern->file_name_len--;\n\t}\n\n\tp1 = strrchr(intern->file_name, '/');\n#if defined(PHP_WIN32) || defined(NETWARE)\n\tp2 = strrchr(intern->file_name, '\\\\');\n#else\n\tp2 = 0;\n#endif\n\tif (p1 || p2) {\n\t\tintern->_path_len = (p1 > p2 ? p1 : p2) - intern->file_name;\n \t} else {\n \t\tintern->_path_len = 0;\n \t}\n \tif (intern->_path) {\n \t\tefree(intern->_path);\n \t}\n\tintern->_path = estrndup(path, intern->_path_len);\n} /* }}} */\n", + "target": " void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, int len, int use_copy TSRMLS_DC) /* {{{ */\n {\n \tchar *p1, *p2;\n\n \tif (intern->file_name) {\n \t\tefree(intern->file_name);\n \t}\n\n\tintern->file_name = use_copy ? estrndup(path, len) : path;\n\tintern->file_name_len = len;\n\n\twhile(IS_SLASH_AT(intern->file_name, intern->file_name_len-1) && intern->file_name_len > 1) {\n\t\tintern->file_name[intern->file_name_len-1] = 0;\n\t\tintern->file_name_len--;\n\t}\n\n\tp1 = strrchr(intern->file_name, '/');\n#if defined(PHP_WIN32) || defined(NETWARE)\n\tp2 = strrchr(intern->file_name, '\\\\');\n#else\n\tp2 = 0;\n#endif\n\tif (p1 || p2) {\n\t\tintern->_path_len = (p1 > p2 ? p1 : p2) - intern->file_name;\n \t} else {\n \t\tintern->_path_len = 0;\n \t}\n\n \tif (intern->_path) {\n \t\tefree(intern->_path);\n \t}\n\tintern->_path = estrndup(path, intern->_path_len);\n} /* }}} */\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#acc192347665943ca674acf117e4f74a88436922", + "input": " static void copyStereo16(\n short *dst,\n const int *const *src,\n unsigned nSamples,\n unsigned /* nChannels */) {\n for (unsigned i = 0; i < nSamples; ++i) {\n *dst++ = src[0][i];\n *dst++ = src[1][i];\n\n }\n }\n", + "target": " static void copyStereo16(\n short *dst,\n const int * src[FLACParser::kMaxChannels],\n unsigned nSamples,\n unsigned /* nChannels */) {\n for (unsigned i = 0; i < nSamples; ++i) {\n *dst++ = src[0][i];\n *dst++ = src[1][i];\n\n }\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#73edae623529f04c668268de49d00324b96166a2", + "input": "Node* DOMPatchSupport::patchNode(Node* node, const String& markup, ExceptionCode& ec)\n{\n if (node->isDocumentNode() || (node->parentNode() && node->parentNode()->isDocumentNode())) {\n patchDocument(markup);\n return 0;\n }\n \n Node* previousSibling = node->previousSibling();\n RefPtr fragment = DocumentFragment::create(m_document);\n fragment->parseHTML(markup, node->parentElement() ? node->parentElement() : m_document->documentElement());\n \n ContainerNode* parentNode = node->parentNode();\n Vector > oldList;\n for (Node* child = parentNode->firstChild(); child; child = child->nextSibling())\n oldList.append(createDigest(child, 0));\n\n String markupCopy = markup;\n markupCopy.makeLower();\n Vector > newList;\n for (Node* child = parentNode->firstChild(); child != node; child = child->nextSibling())\n newList.append(createDigest(child, 0));\n for (Node* child = fragment->firstChild(); child; child = child->nextSibling()) {\n if (child->hasTagName(headTag) && !child->firstChild() && markupCopy.find(\"\") == notFound)\n continue; // HTML5 parser inserts empty tag whenever it parses \n if (child->hasTagName(bodyTag) && !child->firstChild() && markupCopy.find(\"\") == notFound)\n continue; // HTML5 parser inserts empty tag whenever it parses \n newList.append(createDigest(child, &m_unusedNodesMap));\n }\n for (Node* child = node->nextSibling(); child; child = child->nextSibling())\n newList.append(createDigest(child, 0));\n\n if (!innerPatchChildren(parentNode, oldList, newList, ec)) {\n ec = 0;\n if (!m_domEditor->replaceChild(parentNode, fragment.release(), node, ec))\n return 0;\n }\n return previousSibling ? previousSibling->nextSibling() : parentNode->firstChild();\n}\n", + "target": "Node* DOMPatchSupport::patchNode(Node* node, const String& markup, ExceptionCode& ec)\n{\n if (node->isDocumentNode() || (node->parentNode() && node->parentNode()->isDocumentNode())) {\n patchDocument(markup);\n return 0;\n }\n \n Node* previousSibling = node->previousSibling();\n // FIXME: This code should use one of createFragment* in markup.h\n RefPtr fragment = DocumentFragment::create(m_document);\n fragment->parseHTML(markup, node->parentElement() ? node->parentElement() : m_document->documentElement());\n \n ContainerNode* parentNode = node->parentNode();\n Vector > oldList;\n for (Node* child = parentNode->firstChild(); child; child = child->nextSibling())\n oldList.append(createDigest(child, 0));\n\n String markupCopy = markup;\n markupCopy.makeLower();\n Vector > newList;\n for (Node* child = parentNode->firstChild(); child != node; child = child->nextSibling())\n newList.append(createDigest(child, 0));\n for (Node* child = fragment->firstChild(); child; child = child->nextSibling()) {\n if (child->hasTagName(headTag) && !child->firstChild() && markupCopy.find(\"\") == notFound)\n continue; // HTML5 parser inserts empty tag whenever it parses \n if (child->hasTagName(bodyTag) && !child->firstChild() && markupCopy.find(\"\") == notFound)\n continue; // HTML5 parser inserts empty tag whenever it parses \n newList.append(createDigest(child, &m_unusedNodesMap));\n }\n for (Node* child = node->nextSibling(); child; child = child->nextSibling())\n newList.append(createDigest(child, 0));\n\n if (!innerPatchChildren(parentNode, oldList, newList, ec)) {\n ec = 0;\n if (!m_domEditor->replaceChild(parentNode, fragment.release(), node, ec))\n return 0;\n }\n return previousSibling ? previousSibling->nextSibling() : parentNode->firstChild();\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ee301cb2029db8a6289c5295daa42bba7715e99a", + "input": " gplotGenCommandFile(GPLOT *gplot)\n {\nchar buf[L_BUF_SIZE];\n char *cmdstr, *plottitle, *dataname;\n l_int32 i, plotstyle, nplots;\n FILE *fp;\n\n PROCNAME(\"gplotGenCommandFile\");\n\n if (!gplot)\n return ERROR_INT(\"gplot not defined\", procName, 1);\n\n /* Remove any previous command data */\n sarrayClear(gplot->cmddata);\n \n /* Generate command data instructions */\n if (gplot->title) { /* set title */\n snprintf(buf, L_BUF_SIZE, \"set title '%s'\", gplot->title);\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n if (gplot->xlabel) { /* set xlabel */\n snprintf(buf, L_BUF_SIZE, \"set xlabel '%s'\", gplot->xlabel);\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n if (gplot->ylabel) { /* set ylabel */\n snprintf(buf, L_BUF_SIZE, \"set ylabel '%s'\", gplot->ylabel);\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n \n /* Set terminal type and output */\n if (gplot->outformat == GPLOT_PNG) {\n snprintf(buf, L_BUF_SIZE, \"set terminal png; set output '%s'\",\n gplot->outname);\n } else if (gplot->outformat == GPLOT_PS) {\n snprintf(buf, L_BUF_SIZE, \"set terminal postscript; set output '%s'\",\n gplot->outname);\n } else if (gplot->outformat == GPLOT_EPS) {\n snprintf(buf, L_BUF_SIZE,\n \"set terminal postscript eps; set output '%s'\",\n gplot->outname);\n } else if (gplot->outformat == GPLOT_LATEX) {\n snprintf(buf, L_BUF_SIZE, \"set terminal latex; set output '%s'\",\n gplot->outname);\n }\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n \n if (gplot->scaling == GPLOT_LOG_SCALE_X ||\n gplot->scaling == GPLOT_LOG_SCALE_X_Y) {\n snprintf(buf, L_BUF_SIZE, \"set logscale x\");\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n if (gplot->scaling == GPLOT_LOG_SCALE_Y ||\n gplot->scaling == GPLOT_LOG_SCALE_X_Y) {\n snprintf(buf, L_BUF_SIZE, \"set logscale y\");\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n \n nplots = sarrayGetCount(gplot->datanames);\n for (i = 0; i < nplots; i++) {\n plottitle = sarrayGetString(gplot->plottitles, i, L_NOCOPY);\n dataname = sarrayGetString(gplot->datanames, i, L_NOCOPY);\n numaGetIValue(gplot->plotstyles, i, &plotstyle);\n if (nplots == 1) {\n snprintf(buf, L_BUF_SIZE, \"plot '%s' title '%s' %s\",\n dataname, plottitle, gplotstylenames[plotstyle]);\n } else {\n if (i == 0)\n snprintf(buf, L_BUF_SIZE, \"plot '%s' title '%s' %s, \\\\\",\n dataname, plottitle, gplotstylenames[plotstyle]);\n else if (i < nplots - 1)\n snprintf(buf, L_BUF_SIZE, \" '%s' title '%s' %s, \\\\\",\n dataname, plottitle, gplotstylenames[plotstyle]);\n else\n snprintf(buf, L_BUF_SIZE, \" '%s' title '%s' %s\",\n dataname, plottitle, gplotstylenames[plotstyle]);\n }\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n\n /* Write command data to file */\n cmdstr = sarrayToString(gplot->cmddata, 1);\n if ((fp = fopenWriteStream(gplot->cmdname, \"w\")) == NULL) {\n LEPT_FREE(cmdstr);\n return ERROR_INT(\"cmd stream not opened\", procName, 1);\n }\n fwrite(cmdstr, 1, strlen(cmdstr), fp);\n fclose(fp);\n LEPT_FREE(cmdstr);\n return 0;\n}\n", + "target": " gplotGenCommandFile(GPLOT *gplot)\n {\nchar buf[L_BUFSIZE];\n char *cmdstr, *plottitle, *dataname;\n l_int32 i, plotstyle, nplots;\n FILE *fp;\n\n PROCNAME(\"gplotGenCommandFile\");\n\n if (!gplot)\n return ERROR_INT(\"gplot not defined\", procName, 1);\n\n /* Remove any previous command data */\n sarrayClear(gplot->cmddata);\n \n /* Generate command data instructions */\n if (gplot->title) { /* set title */\n snprintf(buf, L_BUFSIZE, \"set title '%s'\", gplot->title);\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n if (gplot->xlabel) { /* set xlabel */\n snprintf(buf, L_BUFSIZE, \"set xlabel '%s'\", gplot->xlabel);\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n if (gplot->ylabel) { /* set ylabel */\n snprintf(buf, L_BUFSIZE, \"set ylabel '%s'\", gplot->ylabel);\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n \n /* Set terminal type and output */\n if (gplot->outformat == GPLOT_PNG) {\n snprintf(buf, L_BUFSIZE, \"set terminal png; set output '%s'\",\n gplot->outname);\n } else if (gplot->outformat == GPLOT_PS) {\n snprintf(buf, L_BUFSIZE, \"set terminal postscript; set output '%s'\",\n gplot->outname);\n } else if (gplot->outformat == GPLOT_EPS) {\n snprintf(buf, L_BUFSIZE,\n \"set terminal postscript eps; set output '%s'\",\n gplot->outname);\n } else if (gplot->outformat == GPLOT_LATEX) {\n snprintf(buf, L_BUFSIZE, \"set terminal latex; set output '%s'\",\n gplot->outname);\n }\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n \n if (gplot->scaling == GPLOT_LOG_SCALE_X ||\n gplot->scaling == GPLOT_LOG_SCALE_X_Y) {\n snprintf(buf, L_BUFSIZE, \"set logscale x\");\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n if (gplot->scaling == GPLOT_LOG_SCALE_Y ||\n gplot->scaling == GPLOT_LOG_SCALE_X_Y) {\n snprintf(buf, L_BUFSIZE, \"set logscale y\");\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n \n nplots = sarrayGetCount(gplot->datanames);\n for (i = 0; i < nplots; i++) {\n plottitle = sarrayGetString(gplot->plottitles, i, L_NOCOPY);\n dataname = sarrayGetString(gplot->datanames, i, L_NOCOPY);\n numaGetIValue(gplot->plotstyles, i, &plotstyle);\n if (nplots == 1) {\n snprintf(buf, L_BUFSIZE, \"plot '%s' title '%s' %s\",\n dataname, plottitle, gplotstylenames[plotstyle]);\n } else {\n if (i == 0)\n snprintf(buf, L_BUFSIZE, \"plot '%s' title '%s' %s, \\\\\",\n dataname, plottitle, gplotstylenames[plotstyle]);\n else if (i < nplots - 1)\n snprintf(buf, L_BUFSIZE, \" '%s' title '%s' %s, \\\\\",\n dataname, plottitle, gplotstylenames[plotstyle]);\n else\n snprintf(buf, L_BUFSIZE, \" '%s' title '%s' %s\",\n dataname, plottitle, gplotstylenames[plotstyle]);\n }\n sarrayAddString(gplot->cmddata, buf, L_COPY);\n }\n\n /* Write command data to file */\n cmdstr = sarrayToString(gplot->cmddata, 1);\n if ((fp = fopenWriteStream(gplot->cmdname, \"w\")) == NULL) {\n LEPT_FREE(cmdstr);\n return ERROR_INT(\"cmd stream not opened\", procName, 1);\n }\n fwrite(cmdstr, 1, strlen(cmdstr), fp);\n fclose(fp);\n LEPT_FREE(cmdstr);\n return 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4e7c52b4577b682be39ad617ceb5d98a32279939", + "input": "void WriteFromUrlOperation::Download(const base::Closure& continuation) {\n DCHECK_CURRENTLY_ON(BrowserThread::FILE);\n\n if (IsCancelled()) {\n return;\n }\n\n download_continuation_ = continuation;\n \n SetStage(image_writer_api::STAGE_DOWNLOAD);\n \n url_fetcher_ = net::URLFetcher::Create(url_, net::URLFetcher::GET, this);\n \n url_fetcher_->SetRequestContext(request_context_);\n url_fetcher_->SaveResponseToFileAtPath(\n image_path_, BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE));\n\n AddCleanUpFunction(\n base::Bind(&WriteFromUrlOperation::DestroyUrlFetcher, this));\n\n url_fetcher_->Start();\n}\n", + "target": "void WriteFromUrlOperation::Download(const base::Closure& continuation) {\n DCHECK_CURRENTLY_ON(BrowserThread::FILE);\n\n if (IsCancelled()) {\n return;\n }\n\n download_continuation_ = continuation;\n \n SetStage(image_writer_api::STAGE_DOWNLOAD);\n \n // Create traffic annotation tag.\n net::NetworkTrafficAnnotationTag traffic_annotation =\n net::DefineNetworkTrafficAnnotation(\"cros_recovery_image_download\", R\"(\n semantics {\n sender: \"Chrome OS Recovery Utility\"\n description:\n \"The Google Chrome OS recovery utility downloads the recovery \"\n \"image from Google Download Server.\"\n trigger:\n \"User uses the Chrome OS Recovery Utility app/extension, selects \"\n \"a Chrome OS recovery image, and clicks the Create button to write \"\n \"the image to a USB or SD card.\"\n data:\n \"URL of the image file to be downloaded. No other data or user \"\n \"identifier is sent.\"\n destination: GOOGLE_OWNED_SERVICE\n }\n policy {\n cookies_allowed: true\n cookies_store: \"user\"\n setting:\n \"This feature cannot be disabled by settings, it can only be used \"\n \"by whitelisted apps/extension.\"\n policy_exception_justification:\n \"Not implemented, considered not useful.\"\n })\");\n\n url_fetcher_ = net::URLFetcher::Create(url_, net::URLFetcher::GET, this,\n traffic_annotation);\n \n url_fetcher_->SetRequestContext(request_context_);\n url_fetcher_->SaveResponseToFileAtPath(\n image_path_, BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE));\n\n AddCleanUpFunction(\n base::Bind(&WriteFromUrlOperation::DestroyUrlFetcher, this));\n\n url_fetcher_->Start();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#51dfe5e3b332bcea02fb4d4c7493ae841106dd9b", + "input": "inline void PulseAudioMixer::MainloopUnlock() const {\n --mainloop_lock_count_;\n pa_threaded_mainloop_unlock(pa_mainloop_);\n }\n", + "target": "inline void PulseAudioMixer::MainloopUnlock() const {\ninline void AudioMixerPulse::MainloopUnlock() const {\n --mainloop_lock_count_;\n pa_threaded_mainloop_unlock(pa_mainloop_);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3b7ff00418c0e7593d42e5648ba39397e23fe2f9", + "input": "void SyncManager::SyncInternal::UpdateCredentials(\n const SyncCredentials& credentials) {\n DCHECK(thread_checker_.CalledOnValidThread());\n DCHECK_EQ(credentials.email, share_.name);\n DCHECK(!credentials.email.empty());\n DCHECK(!credentials.sync_token.empty());\n\n observing_ip_address_changes_ = true;\n if (connection_manager()->set_auth_token(credentials.sync_token)) {\n sync_notifier_->UpdateCredentials(\n credentials.email, credentials.sync_token);\n if (!setup_for_test_mode_) {\n CheckServerReachable();\n }\n }\n }\n", + "target": "void SyncManager::SyncInternal::UpdateCredentials(\n const SyncCredentials& credentials) {\n DCHECK(thread_checker_.CalledOnValidThread());\n DCHECK_EQ(credentials.email, share_.name);\n DCHECK(!credentials.email.empty());\n DCHECK(!credentials.sync_token.empty());\n\n observing_ip_address_changes_ = true;\n if (connection_manager()->set_auth_token(credentials.sync_token)) {\n sync_notifier_->UpdateCredentials(\n credentials.email, credentials.sync_token);\n if (!setup_for_test_mode_) {\n // Post a task so we don't block UpdateCredentials.\n MessageLoop::current()->PostTask(\n FROM_HERE, base::Bind(&SyncInternal::CheckServerReachable,\n weak_ptr_factory_.GetWeakPtr()));\n }\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2706470a422dec8f4ae2538e80f0e7e3c4f4f7f6", + "input": " void PaymentRequest::Retry(mojom::PaymentValidationErrorsPtr errors) {\n if (!client_.is_bound() || !binding_.is_bound()) {\n DLOG(ERROR) << \"Attempted Retry(), but binding(s) missing.\";\n OnConnectionTerminated();\n return;\n }\n \n if (!display_handle_) {\n DLOG(ERROR) << \"Attempted Retry(), but display_handle_ is nullptr.\";\n OnConnectionTerminated();\n return;\n }\n \n std::string error;\n if (!PaymentsValidators::IsValidPaymentValidationErrorsFormat(errors,\n &error)) {\n DLOG(ERROR) << error;\n client_->OnError(mojom::PaymentErrorReason::USER_CANCEL);\n OnConnectionTerminated();\n return;\n }\n\n spec()->Retry(std::move(errors));\n display_handle_->Retry();\n }\n", + "target": " void PaymentRequest::Retry(mojom::PaymentValidationErrorsPtr errors) {\n if (!IsInitialized()) {\n log_.Error(\"Attempted retry without initialization\");\n OnConnectionTerminated();\n return;\n }\n \n if (!IsThisPaymentRequestShowing()) {\n log_.Error(\"Attempted retry without show\");\n OnConnectionTerminated();\n return;\n }\n \n std::string error;\n if (!PaymentsValidators::IsValidPaymentValidationErrorsFormat(errors,\n &error)) {\n log_.Error(error);\n client_->OnError(mojom::PaymentErrorReason::USER_CANCEL);\n OnConnectionTerminated();\n return;\n }\n\n spec()->Retry(std::move(errors));\n display_handle_->Retry();\n }\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#13-4e8c70c2602d", + "input": "def retrieve_videos_from_playlist(playlist_id, db):\n db.execute(\"SELECT id, title, thumbnail, position from video WHERE playlist_id={playlist_id} ORDER BY position ASC;\".format(\n playlist_id=playlist_id))\n rows = db.fetchall()\n return rows", + "target": "def retrieve_videos_from_playlist(playlist_id, db):\n db.execute(\"SELECT id, title, thumbnail, position from video WHERE playlist_id=%s ORDER BY position ASC;\", (playlist_id,))\n rows = db.fetchall()\n return rows", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#b69f2292063d2caf37ca9aec7d63ded203701bf3", + "input": "NORET_TYPE void do_exit(long code)\n{\n\tstruct task_struct *tsk = current;\n\tint group_dead;\n\n\tprofile_task_exit(tsk);\n\n\tWARN_ON(atomic_read(&tsk->fs_excl));\n\n\tif (unlikely(in_interrupt()))\n\t\tpanic(\"Aiee, killing interrupt handler!\");\n\tif (unlikely(!tsk->pid))\n\t\tpanic(\"Attempted to kill the idle task!\");\n\n\ttracehook_report_exit(&code);\n\n\tvalidate_creds_for_do_exit(tsk);\n\n\t/*\n\t * We're taking recursive faults here in do_exit. Safest is to just\n\t * leave this task alone and wait for reboot.\n\t */\n\tif (unlikely(tsk->flags & PF_EXITING)) {\n\t\tprintk(KERN_ALERT\n\t\t\t\"Fixing recursive fault but reboot is needed!\\n\");\n\t\t/*\n\t\t * We can do this unlocked here. The futex code uses\n\t\t * this flag just to verify whether the pi state\n\t\t * cleanup has been done or not. In the worst case it\n\t\t * loops once more. We pretend that the cleanup was\n\t\t * done as there is no way to return. Either the\n\t\t * OWNER_DIED bit is set by now or we push the blocked\n\t\t * task into the wait for ever nirwana as well.\n\t\t */\n\t\ttsk->flags |= PF_EXITPIDONE;\n\t\tset_current_state(TASK_UNINTERRUPTIBLE);\n\t\tschedule();\n\t}\n\n\texit_irq_thread();\n\n\texit_signals(tsk); /* sets PF_EXITING */\n\t/*\n\t * tsk->flags are checked in the futex code to protect against\n\t * an exiting task cleaning up the robust pi futexes.\n\t */\n\tsmp_mb();\n\tspin_unlock_wait(&tsk->pi_lock);\n\n\tif (unlikely(in_atomic()))\n\t\tprintk(KERN_INFO \"note: %s[%d] exited with preempt_count %d\\n\",\n\t\t\t\tcurrent->comm, task_pid_nr(current),\n\t\t\t\tpreempt_count());\n\n\tacct_update_integrals(tsk);\n\n\tgroup_dead = atomic_dec_and_test(&tsk->signal->live);\n\tif (group_dead) {\n\t\thrtimer_cancel(&tsk->signal->real_timer);\n\t\texit_itimers(tsk->signal);\n\t\tif (tsk->mm)\n\t\t\tsetmax_mm_hiwater_rss(&tsk->signal->maxrss, tsk->mm);\n\t}\n\tacct_collect(code, group_dead);\n\tif (group_dead)\n\t\ttty_audit_exit();\n\tif (unlikely(tsk->audit_context))\n\t\taudit_free(tsk);\n\n\ttsk->exit_code = code;\n\ttaskstats_exit(tsk, group_dead);\n\n\texit_mm(tsk);\n\n\tif (group_dead)\n\t\tacct_process();\n\ttrace_sched_process_exit(tsk);\n\n\texit_sem(tsk);\n\texit_files(tsk);\n\texit_fs(tsk);\n\tcheck_stack_usage();\n\texit_thread();\n\tcgroup_exit(tsk, 1);\n\n\tif (group_dead && tsk->signal->leader)\n\t\tdisassociate_ctty(1);\n\n\tmodule_put(task_thread_info(tsk)->exec_domain->module);\n\n\tproc_exit_connector(tsk);\n\n\t/*\n\t * Flush inherited counters to the parent - before the parent\n\t * gets woken up by child-exit notifications.\n\t */\n\tperf_event_exit_task(tsk);\n\n\texit_notify(tsk, group_dead);\n#ifdef CONFIG_NUMA\n\tmpol_put(tsk->mempolicy);\n\ttsk->mempolicy = NULL;\n#endif\n#ifdef CONFIG_FUTEX\n\tif (unlikely(current->pi_state_cache))\n\t\tkfree(current->pi_state_cache);\n#endif\n\t/*\n\t * Make sure we are holding no locks:\n\t */\n\tdebug_check_no_locks_held(tsk);\n\t/*\n\t * We can do this unlocked here. The futex code uses this flag\n\t * just to verify whether the pi state cleanup has been done\n\t * or not. In the worst case it loops once more.\n\t */\n \ttsk->flags |= PF_EXITPIDONE;\n \n \tif (tsk->io_context)\n\t\texit_io_context();\n \n \tif (tsk->splice_pipe)\n \t\t__free_pipe_info(tsk->splice_pipe);\n\n\tvalidate_creds_for_do_exit(tsk);\n\n\tpreempt_disable();\n\texit_rcu();\n\t/* causes final put_task_struct in finish_task_switch(). */\n\ttsk->state = TASK_DEAD;\n\tschedule();\n\tBUG();\n\t/* Avoid \"noreturn function does return\". */\n\tfor (;;)\n\t\tcpu_relax();\t/* For when BUG is null */\n}\n", + "target": "NORET_TYPE void do_exit(long code)\n{\n\tstruct task_struct *tsk = current;\n\tint group_dead;\n\n\tprofile_task_exit(tsk);\n\n\tWARN_ON(atomic_read(&tsk->fs_excl));\n\n\tif (unlikely(in_interrupt()))\n\t\tpanic(\"Aiee, killing interrupt handler!\");\n\tif (unlikely(!tsk->pid))\n\t\tpanic(\"Attempted to kill the idle task!\");\n\n\ttracehook_report_exit(&code);\n\n\tvalidate_creds_for_do_exit(tsk);\n\n\t/*\n\t * We're taking recursive faults here in do_exit. Safest is to just\n\t * leave this task alone and wait for reboot.\n\t */\n\tif (unlikely(tsk->flags & PF_EXITING)) {\n\t\tprintk(KERN_ALERT\n\t\t\t\"Fixing recursive fault but reboot is needed!\\n\");\n\t\t/*\n\t\t * We can do this unlocked here. The futex code uses\n\t\t * this flag just to verify whether the pi state\n\t\t * cleanup has been done or not. In the worst case it\n\t\t * loops once more. We pretend that the cleanup was\n\t\t * done as there is no way to return. Either the\n\t\t * OWNER_DIED bit is set by now or we push the blocked\n\t\t * task into the wait for ever nirwana as well.\n\t\t */\n\t\ttsk->flags |= PF_EXITPIDONE;\n\t\tset_current_state(TASK_UNINTERRUPTIBLE);\n\t\tschedule();\n\t}\n\n\texit_irq_thread();\n\n\texit_signals(tsk); /* sets PF_EXITING */\n\t/*\n\t * tsk->flags are checked in the futex code to protect against\n\t * an exiting task cleaning up the robust pi futexes.\n\t */\n\tsmp_mb();\n\tspin_unlock_wait(&tsk->pi_lock);\n\n\tif (unlikely(in_atomic()))\n\t\tprintk(KERN_INFO \"note: %s[%d] exited with preempt_count %d\\n\",\n\t\t\t\tcurrent->comm, task_pid_nr(current),\n\t\t\t\tpreempt_count());\n\n\tacct_update_integrals(tsk);\n\n\tgroup_dead = atomic_dec_and_test(&tsk->signal->live);\n\tif (group_dead) {\n\t\thrtimer_cancel(&tsk->signal->real_timer);\n\t\texit_itimers(tsk->signal);\n\t\tif (tsk->mm)\n\t\t\tsetmax_mm_hiwater_rss(&tsk->signal->maxrss, tsk->mm);\n\t}\n\tacct_collect(code, group_dead);\n\tif (group_dead)\n\t\ttty_audit_exit();\n\tif (unlikely(tsk->audit_context))\n\t\taudit_free(tsk);\n\n\ttsk->exit_code = code;\n\ttaskstats_exit(tsk, group_dead);\n\n\texit_mm(tsk);\n\n\tif (group_dead)\n\t\tacct_process();\n\ttrace_sched_process_exit(tsk);\n\n\texit_sem(tsk);\n\texit_files(tsk);\n\texit_fs(tsk);\n\tcheck_stack_usage();\n\texit_thread();\n\tcgroup_exit(tsk, 1);\n\n\tif (group_dead && tsk->signal->leader)\n\t\tdisassociate_ctty(1);\n\n\tmodule_put(task_thread_info(tsk)->exec_domain->module);\n\n\tproc_exit_connector(tsk);\n\n\t/*\n\t * Flush inherited counters to the parent - before the parent\n\t * gets woken up by child-exit notifications.\n\t */\n\tperf_event_exit_task(tsk);\n\n\texit_notify(tsk, group_dead);\n#ifdef CONFIG_NUMA\n\tmpol_put(tsk->mempolicy);\n\ttsk->mempolicy = NULL;\n#endif\n#ifdef CONFIG_FUTEX\n\tif (unlikely(current->pi_state_cache))\n\t\tkfree(current->pi_state_cache);\n#endif\n\t/*\n\t * Make sure we are holding no locks:\n\t */\n\tdebug_check_no_locks_held(tsk);\n\t/*\n\t * We can do this unlocked here. The futex code uses this flag\n\t * just to verify whether the pi state cleanup has been done\n\t * or not. In the worst case it loops once more.\n\t */\n \ttsk->flags |= PF_EXITPIDONE;\n \n \tif (tsk->io_context)\n\t\texit_io_context(tsk);\n \n \tif (tsk->splice_pipe)\n \t\t__free_pipe_info(tsk->splice_pipe);\n\n\tvalidate_creds_for_do_exit(tsk);\n\n\tpreempt_disable();\n\texit_rcu();\n\t/* causes final put_task_struct in finish_task_switch(). */\n\ttsk->state = TASK_DEAD;\n\tschedule();\n\tBUG();\n\t/* Avoid \"noreturn function does return\". */\n\tfor (;;)\n\t\tcpu_relax();\t/* For when BUG is null */\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7a7b5df84b6b4e5d599c7289526eed96541a0654", + "input": "static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset)\n{\n \tstruct cp2112_device *dev = gpiochip_get_data(chip);\n \tstruct hid_device *hdev = dev->hdev;\n \tu8 *buf = dev->in_out_buffer;\n\tunsigned long flags;\n \tint ret;\n \n\tspin_lock_irqsave(&dev->lock, flags);\n \n \tret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,\n \t\t\t\t CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,\n\t\t\t\t HID_REQ_GET_REPORT);\n\tif (ret != CP2112_GPIO_CONFIG_LENGTH) {\n\t\thid_err(hdev, \"error requesting GPIO config: %d\\n\", ret);\n\t\tgoto exit;\n\t}\n\n\tbuf[1] &= ~(1 << offset);\n\tbuf[2] = gpio_push_pull;\n\n\tret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,\n\t\t\t\t CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,\n\t\t\t\t HID_REQ_SET_REPORT);\n\tif (ret < 0) {\n\t\thid_err(hdev, \"error setting GPIO config: %d\\n\", ret);\n\t\tgoto exit;\n\t}\n\n \tret = 0;\n \n exit:\n\tspin_unlock_irqrestore(&dev->lock, flags);\n \treturn ret <= 0 ? ret : -EIO;\n }\n", + "target": "static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset)\n{\n \tstruct cp2112_device *dev = gpiochip_get_data(chip);\n \tstruct hid_device *hdev = dev->hdev;\n \tu8 *buf = dev->in_out_buffer;\n \tint ret;\n \n\tmutex_lock(&dev->lock);\n \n \tret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,\n \t\t\t\t CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,\n\t\t\t\t HID_REQ_GET_REPORT);\n\tif (ret != CP2112_GPIO_CONFIG_LENGTH) {\n\t\thid_err(hdev, \"error requesting GPIO config: %d\\n\", ret);\n\t\tgoto exit;\n\t}\n\n\tbuf[1] &= ~(1 << offset);\n\tbuf[2] = gpio_push_pull;\n\n\tret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf,\n\t\t\t\t CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT,\n\t\t\t\t HID_REQ_SET_REPORT);\n\tif (ret < 0) {\n\t\thid_err(hdev, \"error setting GPIO config: %d\\n\", ret);\n\t\tgoto exit;\n\t}\n\n \tret = 0;\n \n exit:\n\tmutex_unlock(&dev->lock);\n \treturn ret <= 0 ? ret : -EIO;\n }\n", + "vul_type": "cwe-404", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3ca657a8793dd011bf869695d72ad31c779c3cc1", + "input": " horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc)\n {\n \tTIFFPredictorState* sp = PredictorState(tif);\n \ttmsize_t stride = sp->stride;\n \tunsigned char* cp = (unsigned char*) cp0;\n \n\tassert((cc%stride)==0);\n \n \tif (cc > stride) {\n \t\tcc -= stride;\n\t\t/*\n\t\t * Pipeline the most common cases.\n\t\t */\n\t\tif (stride == 3) {\n\t\t\tunsigned int r1, g1, b1;\n\t\t\tunsigned int r2 = cp[0];\n\t\t\tunsigned int g2 = cp[1];\n\t\t\tunsigned int b2 = cp[2];\n\t\t\tdo {\n\t\t\t\tr1 = cp[3]; cp[3] = (unsigned char)((r1-r2)&0xff); r2 = r1;\n\t\t\t\tg1 = cp[4]; cp[4] = (unsigned char)((g1-g2)&0xff); g2 = g1;\n\t\t\t\tb1 = cp[5]; cp[5] = (unsigned char)((b1-b2)&0xff); b2 = b1;\n\t\t\t\tcp += 3;\n\t\t\t} while ((cc -= 3) > 0);\n\t\t} else if (stride == 4) {\n\t\t\tunsigned int r1, g1, b1, a1;\n\t\t\tunsigned int r2 = cp[0];\n\t\t\tunsigned int g2 = cp[1];\n\t\t\tunsigned int b2 = cp[2];\n\t\t\tunsigned int a2 = cp[3];\n\t\t\tdo {\n\t\t\t\tr1 = cp[4]; cp[4] = (unsigned char)((r1-r2)&0xff); r2 = r1;\n\t\t\t\tg1 = cp[5]; cp[5] = (unsigned char)((g1-g2)&0xff); g2 = g1;\n\t\t\t\tb1 = cp[6]; cp[6] = (unsigned char)((b1-b2)&0xff); b2 = b1;\n\t\t\t\ta1 = cp[7]; cp[7] = (unsigned char)((a1-a2)&0xff); a2 = a1;\n\t\t\t\tcp += 4;\n\t\t\t} while ((cc -= 4) > 0);\n\t\t} else {\n\t\t\tcp += cc - 1;\n\t\t\tdo {\n\t\t\t\tREPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--)\n \t\t\t} while ((cc -= stride) > 0);\n \t\t}\n \t}\n }\n", + "target": " horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc)\n {\n \tTIFFPredictorState* sp = PredictorState(tif);\n \ttmsize_t stride = sp->stride;\n \tunsigned char* cp = (unsigned char*) cp0;\n \n if((cc%stride)!=0)\n {\n TIFFErrorExt(tif->tif_clientdata, \"horDiff8\",\n \"%s\", \"(cc%stride)!=0\");\n return 0;\n }\n \n \tif (cc > stride) {\n \t\tcc -= stride;\n\t\t/*\n\t\t * Pipeline the most common cases.\n\t\t */\n\t\tif (stride == 3) {\n\t\t\tunsigned int r1, g1, b1;\n\t\t\tunsigned int r2 = cp[0];\n\t\t\tunsigned int g2 = cp[1];\n\t\t\tunsigned int b2 = cp[2];\n\t\t\tdo {\n\t\t\t\tr1 = cp[3]; cp[3] = (unsigned char)((r1-r2)&0xff); r2 = r1;\n\t\t\t\tg1 = cp[4]; cp[4] = (unsigned char)((g1-g2)&0xff); g2 = g1;\n\t\t\t\tb1 = cp[5]; cp[5] = (unsigned char)((b1-b2)&0xff); b2 = b1;\n\t\t\t\tcp += 3;\n\t\t\t} while ((cc -= 3) > 0);\n\t\t} else if (stride == 4) {\n\t\t\tunsigned int r1, g1, b1, a1;\n\t\t\tunsigned int r2 = cp[0];\n\t\t\tunsigned int g2 = cp[1];\n\t\t\tunsigned int b2 = cp[2];\n\t\t\tunsigned int a2 = cp[3];\n\t\t\tdo {\n\t\t\t\tr1 = cp[4]; cp[4] = (unsigned char)((r1-r2)&0xff); r2 = r1;\n\t\t\t\tg1 = cp[5]; cp[5] = (unsigned char)((g1-g2)&0xff); g2 = g1;\n\t\t\t\tb1 = cp[6]; cp[6] = (unsigned char)((b1-b2)&0xff); b2 = b1;\n\t\t\t\ta1 = cp[7]; cp[7] = (unsigned char)((a1-a2)&0xff); a2 = a1;\n\t\t\t\tcp += 4;\n\t\t\t} while ((cc -= 4) > 0);\n\t\t} else {\n\t\t\tcp += cc - 1;\n\t\t\tdo {\n\t\t\t\tREPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--)\n \t\t\t} while ((cc -= stride) > 0);\n \t\t}\n \t}\n\treturn 1;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9fe90fe465e046a219411b192d8b08086faae39c", + "input": "OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font,\n OmniboxView* omnibox_view,\n AutocompleteEditModel* edit_model,\n GtkWidget* location_bar)\n : model_(new AutocompletePopupModel(this, edit_model)),\n omnibox_view_(omnibox_view),\n location_bar_(location_bar),\n window_(gtk_window_new(GTK_WINDOW_POPUP)),\n layout_(NULL),\n theme_service_(ThemeServiceGtk::GetFrom(edit_model->profile())),\n font_(font.DeriveFont(kEditFontAdjust)),\n ignore_mouse_drag_(false),\n opened_(false) {\n gtk_widget_set_can_focus(window_, FALSE);\n gtk_window_set_resizable(GTK_WINDOW(window_), FALSE);\n gtk_widget_set_app_paintable(window_, TRUE);\n gtk_widget_set_double_buffered(window_, TRUE);\n\n layout_ = gtk_widget_create_pango_layout(window_, NULL);\n pango_layout_set_auto_dir(layout_, FALSE);\n pango_layout_set_ellipsize(layout_, PANGO_ELLIPSIZE_END);\n\n gtk_widget_add_events(window_, GDK_BUTTON_MOTION_MASK |\n GDK_POINTER_MOTION_MASK |\n GDK_BUTTON_PRESS_MASK |\n GDK_BUTTON_RELEASE_MASK);\n g_signal_connect(window_, \"motion-notify-event\",\n G_CALLBACK(HandleMotionThunk), this);\n g_signal_connect(window_, \"button-press-event\",\n G_CALLBACK(HandleButtonPressThunk), this);\n g_signal_connect(window_, \"button-release-event\",\n G_CALLBACK(HandleButtonReleaseThunk), this);\n g_signal_connect(window_, \"expose-event\",\n G_CALLBACK(HandleExposeThunk), this);\n \n registrar_.Add(this,\n chrome::NOTIFICATION_BROWSER_THEME_CHANGED,\n content::Source(theme_service_));\n theme_service_->InitThemesFor(this);\n\n }\n", + "target": "OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font,\n OmniboxView* omnibox_view,\n AutocompleteEditModel* edit_model,\n GtkWidget* location_bar)\n : signal_registrar_(new ui::GtkSignalRegistrar),\n model_(new AutocompletePopupModel(this, edit_model)),\n omnibox_view_(omnibox_view),\n location_bar_(location_bar),\n window_(gtk_window_new(GTK_WINDOW_POPUP)),\n layout_(NULL),\n theme_service_(ThemeServiceGtk::GetFrom(edit_model->profile())),\n font_(font.DeriveFont(kEditFontAdjust)),\n ignore_mouse_drag_(false),\n opened_(false) {\n gtk_widget_set_can_focus(window_, FALSE);\n gtk_window_set_resizable(GTK_WINDOW(window_), FALSE);\n gtk_widget_set_app_paintable(window_, TRUE);\n gtk_widget_set_double_buffered(window_, TRUE);\n\n layout_ = gtk_widget_create_pango_layout(window_, NULL);\n pango_layout_set_auto_dir(layout_, FALSE);\n pango_layout_set_ellipsize(layout_, PANGO_ELLIPSIZE_END);\n\n gtk_widget_add_events(window_, GDK_BUTTON_MOTION_MASK |\n GDK_POINTER_MOTION_MASK |\n GDK_BUTTON_PRESS_MASK |\n GDK_BUTTON_RELEASE_MASK);\n signal_registrar_->Connect(window_, \"motion-notify-event\",\n G_CALLBACK(HandleMotionThunk), this);\n signal_registrar_->Connect(window_, \"button-press-event\",\n G_CALLBACK(HandleButtonPressThunk), this);\n signal_registrar_->Connect(window_, \"button-release-event\",\n G_CALLBACK(HandleButtonReleaseThunk), this);\n signal_registrar_->Connect(window_, \"expose-event\",\n G_CALLBACK(HandleExposeThunk), this);\n \n registrar_.Add(this,\n chrome::NOTIFICATION_BROWSER_THEME_CHANGED,\n content::Source(theme_service_));\n theme_service_->InitThemesFor(this);\n\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#da48524eb20662618854bb3df2db01fc65f3070c", + "input": "SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,\n\t\tsiginfo_t __user *, uinfo)\n{\n\tsiginfo_t info;\n\n\tif (copy_from_user(&info, uinfo, sizeof(siginfo_t)))\n \t\treturn -EFAULT;\n \n \t/* Not even root can pretend to send signals from the kernel.\n\t Nor can they impersonate a kill(), which adds source info. */\n\tif (info.si_code >= 0)\n \t\treturn -EPERM;\n \tinfo.si_signo = sig;\n \n \t/* POSIX.1b doesn't mention process groups. */\n\treturn kill_proc_info(sig, &info, pid);\n}\n", + "target": "SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,\n\t\tsiginfo_t __user *, uinfo)\n{\n\tsiginfo_t info;\n\n\tif (copy_from_user(&info, uinfo, sizeof(siginfo_t)))\n \t\treturn -EFAULT;\n \n \t/* Not even root can pretend to send signals from the kernel.\n\t * Nor can they impersonate a kill()/tgkill(), which adds source info.\n\t */\n\tif (info.si_code != SI_QUEUE) {\n\t\t/* We used to allow any < 0 si_code */\n\t\tWARN_ON_ONCE(info.si_code < 0);\n \t\treturn -EPERM;\n\t}\n \tinfo.si_signo = sig;\n \n \t/* POSIX.1b doesn't mention process groups. */\n\treturn kill_proc_info(sig, &info, pid);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#472271b153c5dc53c28beac55480a8d8434b2d5c", + "input": "int bta_co_rfc_data_outgoing(void *user_data, uint8_t *buf, uint16_t size) {\n pthread_mutex_lock(&slot_lock);\n\n uint32_t id = (uintptr_t)user_data;\n int ret = false;\n rfc_slot_t *slot = find_rfc_slot_by_id(id);\n\n if (!slot)\n goto out;\n \n int received = recv(slot->fd, buf, size, 0);\n if(received == size) {\n ret = true;\n } else {\n LOG_ERROR(\"%s error receiving RFCOMM data from app: %s\", __func__, strerror(errno));\n cleanup_rfc_slot(slot);\n }\n\nout:;\n pthread_mutex_unlock(&slot_lock);\n return ret;\n}\n", + "target": "int bta_co_rfc_data_outgoing(void *user_data, uint8_t *buf, uint16_t size) {\n pthread_mutex_lock(&slot_lock);\n\n uint32_t id = (uintptr_t)user_data;\n int ret = false;\n rfc_slot_t *slot = find_rfc_slot_by_id(id);\n\n if (!slot)\n goto out;\n \n int received = TEMP_FAILURE_RETRY(recv(slot->fd, buf, size, 0));\n if(received == size) {\n ret = true;\n } else {\n LOG_ERROR(\"%s error receiving RFCOMM data from app: %s\", __func__, strerror(errno));\n cleanup_rfc_slot(slot);\n }\n\nout:;\n pthread_mutex_unlock(&slot_lock);\n return ret;\n}\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7f3d85b096f66870a15b37c2f40b219b2e292693", + "input": " png_write_finish_row(png_structp png_ptr)\n {\n #ifdef PNG_WRITE_INTERLACING_SUPPORTED\n /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */\n \n /* Start of interlace block */\n int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};\n\n /* Offset to next interlace block */\n int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};\n\n /* Start of interlace block in the y direction */\n int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};\n \n /* Offset to next interlace block in the y direction */\n int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};\n #endif\n \n int ret;\n\n png_debug(1, \"in png_write_finish_row\");\n\n /* Next row */\n png_ptr->row_number++;\n\n /* See if we are done */\n if (png_ptr->row_number < png_ptr->num_rows)\n return;\n\n#ifdef PNG_WRITE_INTERLACING_SUPPORTED\n /* If interlaced, go to next pass */\n if (png_ptr->interlaced)\n {\n png_ptr->row_number = 0;\n if (png_ptr->transformations & PNG_INTERLACE)\n {\n png_ptr->pass++;\n }\n else\n {\n /* Loop until we find a non-zero width or height pass */\n do\n {\n png_ptr->pass++;\n if (png_ptr->pass >= 7)\n break;\n png_ptr->usr_width = (png_ptr->width +\n png_pass_inc[png_ptr->pass] - 1 -\n png_pass_start[png_ptr->pass]) /\n png_pass_inc[png_ptr->pass];\n png_ptr->num_rows = (png_ptr->height +\n png_pass_yinc[png_ptr->pass] - 1 -\n png_pass_ystart[png_ptr->pass]) /\n png_pass_yinc[png_ptr->pass];\n if (png_ptr->transformations & PNG_INTERLACE)\n break;\n } while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0);\n\n }\n\n /* Reset the row above the image for the next pass */\n if (png_ptr->pass < 7)\n {\n if (png_ptr->prev_row != NULL)\n png_memset(png_ptr->prev_row, 0,\n (png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels*\n png_ptr->usr_bit_depth, png_ptr->width)) + 1);\n return;\n }\n }\n#endif\n\n /* If we get here, we've just written the last row, so we need\n to flush the compressor */\n do\n {\n /* Tell the compressor we are done */\n ret = deflate(&png_ptr->zstream, Z_FINISH);\n /* Check for an error */\n if (ret == Z_OK)\n {\n /* Check to see if we need more room */\n if (!(png_ptr->zstream.avail_out))\n {\n png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);\n png_ptr->zstream.next_out = png_ptr->zbuf;\n png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;\n }\n }\n else if (ret != Z_STREAM_END)\n {\n if (png_ptr->zstream.msg != NULL)\n png_error(png_ptr, png_ptr->zstream.msg);\n else\n png_error(png_ptr, \"zlib error\");\n }\n } while (ret != Z_STREAM_END);\n\n /* Write any extra space */\n if (png_ptr->zstream.avail_out < png_ptr->zbuf_size)\n {\n png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size -\n png_ptr->zstream.avail_out);\n }\n\n deflateReset(&png_ptr->zstream);\n png_ptr->zstream.data_type = Z_BINARY;\n}\n", + "target": " png_write_finish_row(png_structp png_ptr)\n {\n #ifdef PNG_WRITE_INTERLACING_SUPPORTED\n#ifndef PNG_USE_GLOBAL_ARRAYS\n /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */\n \n /* Start of interlace block */\n int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};\n\n /* Offset to next interlace block */\n int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};\n\n /* Start of interlace block in the y direction */\n int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};\n \n /* Offset to next interlace block in the y direction */\n int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};\n#endif\n #endif\n \n int ret;\n\n png_debug(1, \"in png_write_finish_row\");\n\n /* Next row */\n png_ptr->row_number++;\n\n /* See if we are done */\n if (png_ptr->row_number < png_ptr->num_rows)\n return;\n\n#ifdef PNG_WRITE_INTERLACING_SUPPORTED\n /* If interlaced, go to next pass */\n if (png_ptr->interlaced)\n {\n png_ptr->row_number = 0;\n if (png_ptr->transformations & PNG_INTERLACE)\n {\n png_ptr->pass++;\n }\n else\n {\n /* Loop until we find a non-zero width or height pass */\n do\n {\n png_ptr->pass++;\n if (png_ptr->pass >= 7)\n break;\n png_ptr->usr_width = (png_ptr->width +\n png_pass_inc[png_ptr->pass] - 1 -\n png_pass_start[png_ptr->pass]) /\n png_pass_inc[png_ptr->pass];\n png_ptr->num_rows = (png_ptr->height +\n png_pass_yinc[png_ptr->pass] - 1 -\n png_pass_ystart[png_ptr->pass]) /\n png_pass_yinc[png_ptr->pass];\n if (png_ptr->transformations & PNG_INTERLACE)\n break;\n } while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0);\n\n }\n\n /* Reset the row above the image for the next pass */\n if (png_ptr->pass < 7)\n {\n if (png_ptr->prev_row != NULL)\n png_memset(png_ptr->prev_row, 0,\n (png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels*\n png_ptr->usr_bit_depth, png_ptr->width)) + 1);\n return;\n }\n }\n#endif\n\n /* If we get here, we've just written the last row, so we need\n to flush the compressor */\n do\n {\n /* Tell the compressor we are done */\n ret = deflate(&png_ptr->zstream, Z_FINISH);\n /* Check for an error */\n if (ret == Z_OK)\n {\n /* Check to see if we need more room */\n if (!(png_ptr->zstream.avail_out))\n {\n png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);\n png_ptr->zstream.next_out = png_ptr->zbuf;\n png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;\n }\n }\n else if (ret != Z_STREAM_END)\n {\n if (png_ptr->zstream.msg != NULL)\n png_error(png_ptr, png_ptr->zstream.msg);\n else\n png_error(png_ptr, \"zlib error\");\n }\n } while (ret != Z_STREAM_END);\n\n /* Write any extra space */\n if (png_ptr->zstream.avail_out < png_ptr->zbuf_size)\n {\n png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size -\n png_ptr->zstream.avail_out);\n }\n\n deflateReset(&png_ptr->zstream);\n png_ptr->zstream.data_type = Z_BINARY;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1eb08bcd4634ae42ec45e8284923ac048beaa4c3", + "input": "static int getnum (lua_State *L, const char **fmt, int df) {\n if (!isdigit(**fmt)) /* no number? */\n return df; /* return default value */\n else {\n int a = 0;\n do {\n if (a > (INT_MAX / 10) || a * 10 > (INT_MAX - (**fmt - '0')))\n luaL_error(L, \"integral size overflow\");\n a = a*10 + *((*fmt)++) - '0';\n } while (isdigit(**fmt));\n return a;\n }\n}\n", + "target": "static int getnum (lua_State *L, const char **fmt, int df) {\nstatic int getnum (const char **fmt, int df) {\n if (!isdigit(**fmt)) /* no number? */\n return df; /* return default value */\n else {\n int a = 0;\n do {\n a = a*10 + *((*fmt)++) - '0';\n } while (isdigit(**fmt));\n return a;\n }\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5e5c796617e1712905dc5462b94bd5e6c08d15ea", + "input": " wiki_handle_rest_call(HttpRequest *req, \n \t\t HttpResponse *res,\n\t\t char *func)\n{\n\n if (func != NULL && *func != '\\0')\n {\n if (!strcmp(func, \"page/get\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n \t if (page == NULL)\n \t page = http_request_get_query_string(req);\n \n\t if (page && (access(page, R_OK) == 0)) \n \t {\n \t http_response_printf(res, \"%s\", file_read(page));\n \t http_response_send(res);\n\t return;\n\t } \n\t}\n else if (!strcmp(func, \"page/set\"))\n\t{\n\t char *wikitext = NULL, *page = NULL;\n \t if( ( (wikitext = http_request_param_get(req, \"text\")) != NULL)\n \t && ( (page = http_request_param_get(req, \"page\")) != NULL))\n \t {\n\t file_write(page, wikitext);\t \n \t http_response_printf(res, \"success\");\n \t http_response_send(res);\n \t return;\n \t }\n \t}\n else if (!strcmp(func, \"page/delete\"))\n \t{\n\t char *page = http_request_param_get(req, \"page\");\n\n \t if (page == NULL)\n \t page = http_request_get_query_string(req);\n \n\t if (page && (unlink(page) > 0))\n \t {\n \t http_response_printf(res, \"success\");\n \t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"page/exists\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n \t if (page == NULL)\n \t page = http_request_get_query_string(req);\n \n\t if (page && (access(page, R_OK) == 0)) \n \t {\n \t http_response_printf(res, \"success\");\n \t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"pages\") || !strcmp(func, \"search\"))\n\t{\n\t WikiPageList **pages = NULL;\n\t int n_pages, i;\n\t char *expr = http_request_param_get(req, \"expr\");\n\n\t if (expr == NULL)\n\t expr = http_request_get_query_string(req);\n\t \n\t pages = wiki_get_pages(&n_pages, expr);\n\n\t if (pages)\n\t {\n\t for (i=0; imtime);\n\t\t strftime(datebuf, sizeof(datebuf), \"%Y-%m-%d %H:%M\", pTm);\n\t\t http_response_printf(res, \"%s\\t%s\\n\", pages[i]->name, datebuf);\n\t\t}\n\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n }\n\n http_response_set_status(res, 500, \"Error\");\n http_response_printf(res, \"Failed\\n\");\n http_response_send(res);\n\n return; \n}\n", + "target": " wiki_handle_rest_call(HttpRequest *req, \n \t\t HttpResponse *res,\n\t\t char *func)\n{\n\n if (func != NULL && *func != '\\0')\n {\n if (!strcmp(func, \"page/get\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n \t if (page == NULL)\n \t page = http_request_get_query_string(req);\n \n\t if (page && page_name_is_good(page) && (access(page, R_OK) == 0))\n \t {\n \t http_response_printf(res, \"%s\", file_read(page));\n \t http_response_send(res);\n\t return;\n\t } \n\t}\n else if (!strcmp(func, \"page/set\"))\n\t{\n\t char *wikitext = NULL, *page = NULL;\n \t if( ( (wikitext = http_request_param_get(req, \"text\")) != NULL)\n \t && ( (page = http_request_param_get(req, \"page\")) != NULL))\n \t {\n\t if (page_name_is_good(page))\n\t {\n\t file_write(page, wikitext);\n \t http_response_printf(res, \"success\");\n \t http_response_send(res);\n \t return;\n \t }\n\t }\n \t}\n else if (!strcmp(func, \"page/delete\"))\n \t{\n\t char *page = http_request_param_get(req, \"page\");\n\n \t if (page == NULL)\n \t page = http_request_get_query_string(req);\n \n\t if (page && page_name_is_good(page) && (unlink(page) > 0))\n \t {\n \t http_response_printf(res, \"success\");\n \t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"page/exists\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n \t if (page == NULL)\n \t page = http_request_get_query_string(req);\n \n\t if (page && page_name_is_good(page) && (access(page, R_OK) == 0))\n \t {\n \t http_response_printf(res, \"success\");\n \t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"pages\") || !strcmp(func, \"search\"))\n\t{\n\t WikiPageList **pages = NULL;\n\t int n_pages, i;\n\t char *expr = http_request_param_get(req, \"expr\");\n\n\t if (expr == NULL)\n\t expr = http_request_get_query_string(req);\n\t \n\t pages = wiki_get_pages(&n_pages, expr);\n\n\t if (pages)\n\t {\n\t for (i=0; imtime);\n\t\t strftime(datebuf, sizeof(datebuf), \"%Y-%m-%d %H:%M\", pTm);\n\t\t http_response_printf(res, \"%s\\t%s\\n\", pages[i]->name, datebuf);\n\t\t}\n\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n }\n\n http_response_set_status(res, 500, \"Error\");\n http_response_printf(res, \"Failed\\n\");\n http_response_send(res);\n\n return; \n}\n", + "vul_type": "cwe-22", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "void Segment::PreloadCluster(Cluster* pCluster, ptrdiff_t idx)\n{\n assert(pCluster);\n assert(pCluster->m_index < 0);\n assert(idx >= m_clusterCount);\n const long count = m_clusterCount + m_clusterPreloadCount;\n long& size = m_clusterSize;\n assert(size >= count);\n if (count >= size)\n {\n const long n = (size <= 0) ? 2048 : 2*size;\n Cluster** const qq = new Cluster*[n];\n Cluster** q = qq;\n Cluster** p = m_clusters;\n Cluster** const pp = p + count;\n while (p != pp)\n *q++ = *p++;\n delete[] m_clusters;\n m_clusters = qq;\n size = n;\n }\n assert(m_clusters);\n \n Cluster** const p = m_clusters + idx;\n \n Cluster** q = m_clusters + count;\n assert(q >= p);\n assert(q < (m_clusters + size));\n \n while (q > p)\n {\n Cluster** const qq = q - 1;\n assert((*qq)->m_index < 0);\n \n *q = *qq;\n q = qq;\n }\n \n m_clusters[idx] = pCluster;\n ++m_clusterPreloadCount;\n }\n", + "target": "void Segment::PreloadCluster(Cluster* pCluster, ptrdiff_t idx)\n if (m_clusterPreloadCount > 0) {\n assert(m_clusters);\n \n Cluster** const p = m_clusters + m_clusterCount;\n assert(*p);\n assert((*p)->m_index < 0);\n \n Cluster** q = p + m_clusterPreloadCount;\n assert(q < (m_clusters + size));\n \n for (;;) {\n Cluster** const qq = q - 1;\n assert((*qq)->m_index < 0);\n \n *q = *qq;\n q = qq;\n\n if (q == p)\n break;\n }\n }\n \n m_clusters[idx] = pCluster;\n ++m_clusterCount;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f3d3342602f8bcbf37d7c46641cb9bca7618eb1c", + "input": "static int rfcomm_sock_recvmsg(struct kiocb *iocb, struct socket *sock,\n\t\t\t struct msghdr *msg, size_t size, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct rfcomm_dlc *d = rfcomm_pi(sk)->dlc;\n\tint len;\n \n \tif (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) {\n \t\trfcomm_dlc_accept(d);\n\t\tmsg->msg_namelen = 0;\n \t\treturn 0;\n \t}\n \n\tlen = bt_sock_stream_recvmsg(iocb, sock, msg, size, flags);\n\n\tlock_sock(sk);\n\tif (!(flags & MSG_PEEK) && len > 0)\n\t\tatomic_sub(len, &sk->sk_rmem_alloc);\n\n\tif (atomic_read(&sk->sk_rmem_alloc) <= (sk->sk_rcvbuf >> 2))\n\t\trfcomm_dlc_unthrottle(rfcomm_pi(sk)->dlc);\n\trelease_sock(sk);\n\n\treturn len;\n}\n", + "target": "static int rfcomm_sock_recvmsg(struct kiocb *iocb, struct socket *sock,\n\t\t\t struct msghdr *msg, size_t size, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct rfcomm_dlc *d = rfcomm_pi(sk)->dlc;\n\tint len;\n \n \tif (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) {\n \t\trfcomm_dlc_accept(d);\n \t\treturn 0;\n \t}\n \n\tlen = bt_sock_stream_recvmsg(iocb, sock, msg, size, flags);\n\n\tlock_sock(sk);\n\tif (!(flags & MSG_PEEK) && len > 0)\n\t\tatomic_sub(len, &sk->sk_rmem_alloc);\n\n\tif (atomic_read(&sk->sk_rmem_alloc) <= (sk->sk_rcvbuf >> 2))\n\t\trfcomm_dlc_unthrottle(rfcomm_pi(sk)->dlc);\n\trelease_sock(sk);\n\n\treturn len;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#eea3300239f0b53e172a320eb8de59d0bea65f27", + "input": " void DevToolsUIBindings::RecordEnumeratedHistogram(const std::string& name,\n int sample,\n int boundary_value) {\n if (!(boundary_value >= 0 && boundary_value <= 100 && sample >= 0 &&\n sample < boundary_value)) {\n frontend_host_->BadMessageRecieved();\n return;\n }\n if (name == kDevToolsActionTakenHistogram)\n UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value);\n else if (name == kDevToolsPanelShownHistogram)\n UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value);\n else\n frontend_host_->BadMessageRecieved();\n}\n", + "target": " void DevToolsUIBindings::RecordEnumeratedHistogram(const std::string& name,\n int sample,\n int boundary_value) {\n if (!frontend_host_)\n return;\n if (!(boundary_value >= 0 && boundary_value <= 100 && sample >= 0 &&\n sample < boundary_value)) {\n frontend_host_->BadMessageRecieved();\n return;\n }\n if (name == kDevToolsActionTakenHistogram)\n UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value);\n else if (name == kDevToolsPanelShownHistogram)\n UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value);\n else\n frontend_host_->BadMessageRecieved();\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "int Block::GetFrameCount() const\n{\n return m_frame_count;\n}\n", + "target": "int Block::GetFrameCount() const\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d358f57009b85fb7440208afa5ba87636b491889", + "input": " void BluetoothDeviceChromeOS::ConfirmPairing() {\n if (!agent_.get() || confirmation_callback_.is_null())\n return;\n \n confirmation_callback_.Run(SUCCESS);\n confirmation_callback_.Reset();\n }\n", + "target": " void BluetoothDeviceChromeOS::ConfirmPairing() {\n if (!pairing_context_.get())\n return;\n \n pairing_context_->ConfirmPairing();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c06cfb08b88dfbe13be44a69ae2fdc3a7c902d81", + "input": " static int asymmetric_key_match_preparse(struct key_match_data *match_data)\n {\n \tmatch_data->lookup_type = KEYRING_SEARCH_LOOKUP_ITERATE;\n \treturn 0;\n }\n", + "target": " static int asymmetric_key_match_preparse(struct key_match_data *match_data)\n {\n \tmatch_data->lookup_type = KEYRING_SEARCH_LOOKUP_ITERATE;\n\tmatch_data->cmp = asymmetric_key_cmp;\n \treturn 0;\n }\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6b8ac63847bc2f958dd93c09edc941a0118992d9", + "input": "vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)\n{\n\tstruct drm_vc4_submit_cl *args = exec->args;\n\tvoid *temp = NULL;\n\tvoid *bin;\n\tint ret = 0;\n\tuint32_t bin_offset = 0;\n\tuint32_t shader_rec_offset = roundup(bin_offset + args->bin_cl_size,\n\t\t\t\t\t 16);\n\tuint32_t uniforms_offset = shader_rec_offset + args->shader_rec_size;\n\tuint32_t exec_size = uniforms_offset + args->uniforms_size;\n\tuint32_t temp_size = exec_size + (sizeof(struct vc4_shader_state) *\n\t\t\t\t\t args->shader_rec_count);\n\tstruct vc4_bo *bo;\n\n\tif (shader_rec_offset < args->bin_cl_size ||\n\t uniforms_offset < shader_rec_offset ||\n\t exec_size < uniforms_offset ||\n\t args->shader_rec_count >= (UINT_MAX /\n \t\t\t\t\t sizeof(struct vc4_shader_state)) ||\n \t temp_size < exec_size) {\n \t\tDRM_ERROR(\"overflow in exec arguments\\n\");\n \t\tgoto fail;\n \t}\n \n\t/* Allocate space where we'll store the copied in user command lists\n\t * and shader records.\n\t *\n\t * We don't just copy directly into the BOs because we need to\n\t * read the contents back for validation, and I think the\n\t * bo->vaddr is uncached access.\n\t */\n\ttemp = drm_malloc_ab(temp_size, 1);\n\tif (!temp) {\n\t\tDRM_ERROR(\"Failed to allocate storage for copying \"\n\t\t\t \"in bin/render CLs.\\n\");\n\t\tret = -ENOMEM;\n\t\tgoto fail;\n\t}\n\tbin = temp + bin_offset;\n\texec->shader_rec_u = temp + shader_rec_offset;\n\texec->uniforms_u = temp + uniforms_offset;\n\texec->shader_state = temp + exec_size;\n\texec->shader_state_size = args->shader_rec_count;\n\n\tif (copy_from_user(bin,\n\t\t\t (void __user *)(uintptr_t)args->bin_cl,\n\t\t\t args->bin_cl_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->shader_rec_u,\n\t\t\t (void __user *)(uintptr_t)args->shader_rec,\n\t\t\t args->shader_rec_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->uniforms_u,\n\t\t\t (void __user *)(uintptr_t)args->uniforms,\n\t\t\t args->uniforms_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tbo = vc4_bo_create(dev, exec_size, true);\n\tif (IS_ERR(bo)) {\n\t\tDRM_ERROR(\"Couldn't allocate BO for binning\\n\");\n\t\tret = PTR_ERR(bo);\n\t\tgoto fail;\n\t}\n\texec->exec_bo = &bo->base;\n\n\tlist_add_tail(&to_vc4_bo(&exec->exec_bo->base)->unref_head,\n\t\t &exec->unref_list);\n\n\texec->ct0ca = exec->exec_bo->paddr + bin_offset;\n\n\texec->bin_u = bin;\n\n\texec->shader_rec_v = exec->exec_bo->vaddr + shader_rec_offset;\n\texec->shader_rec_p = exec->exec_bo->paddr + shader_rec_offset;\n\texec->shader_rec_size = args->shader_rec_size;\n\n\texec->uniforms_v = exec->exec_bo->vaddr + uniforms_offset;\n\texec->uniforms_p = exec->exec_bo->paddr + uniforms_offset;\n\texec->uniforms_size = args->uniforms_size;\n\n\tret = vc4_validate_bin_cl(dev,\n\t\t\t\t exec->exec_bo->vaddr + bin_offset,\n\t\t\t\t bin,\n\t\t\t\t exec);\n\tif (ret)\n\t\tgoto fail;\n\n\tret = vc4_validate_shader_recs(dev, exec);\n\tif (ret)\n\t\tgoto fail;\n\n\t/* Block waiting on any previous rendering into the CS's VBO,\n\t * IB, or textures, so that pixels are actually written by the\n\t * time we try to read them.\n\t */\n\tret = vc4_wait_for_seqno(dev, exec->bin_dep_seqno, ~0ull, true);\n\nfail:\n\tdrm_free_large(temp);\n\treturn ret;\n}\n", + "target": "vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)\n{\n\tstruct drm_vc4_submit_cl *args = exec->args;\n\tvoid *temp = NULL;\n\tvoid *bin;\n\tint ret = 0;\n\tuint32_t bin_offset = 0;\n\tuint32_t shader_rec_offset = roundup(bin_offset + args->bin_cl_size,\n\t\t\t\t\t 16);\n\tuint32_t uniforms_offset = shader_rec_offset + args->shader_rec_size;\n\tuint32_t exec_size = uniforms_offset + args->uniforms_size;\n\tuint32_t temp_size = exec_size + (sizeof(struct vc4_shader_state) *\n\t\t\t\t\t args->shader_rec_count);\n\tstruct vc4_bo *bo;\n\n\tif (shader_rec_offset < args->bin_cl_size ||\n\t uniforms_offset < shader_rec_offset ||\n\t exec_size < uniforms_offset ||\n\t args->shader_rec_count >= (UINT_MAX /\n \t\t\t\t\t sizeof(struct vc4_shader_state)) ||\n \t temp_size < exec_size) {\n \t\tDRM_ERROR(\"overflow in exec arguments\\n\");\n\t\tret = -EINVAL;\n \t\tgoto fail;\n \t}\n \n\t/* Allocate space where we'll store the copied in user command lists\n\t * and shader records.\n\t *\n\t * We don't just copy directly into the BOs because we need to\n\t * read the contents back for validation, and I think the\n\t * bo->vaddr is uncached access.\n\t */\n\ttemp = drm_malloc_ab(temp_size, 1);\n\tif (!temp) {\n\t\tDRM_ERROR(\"Failed to allocate storage for copying \"\n\t\t\t \"in bin/render CLs.\\n\");\n\t\tret = -ENOMEM;\n\t\tgoto fail;\n\t}\n\tbin = temp + bin_offset;\n\texec->shader_rec_u = temp + shader_rec_offset;\n\texec->uniforms_u = temp + uniforms_offset;\n\texec->shader_state = temp + exec_size;\n\texec->shader_state_size = args->shader_rec_count;\n\n\tif (copy_from_user(bin,\n\t\t\t (void __user *)(uintptr_t)args->bin_cl,\n\t\t\t args->bin_cl_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->shader_rec_u,\n\t\t\t (void __user *)(uintptr_t)args->shader_rec,\n\t\t\t args->shader_rec_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->uniforms_u,\n\t\t\t (void __user *)(uintptr_t)args->uniforms,\n\t\t\t args->uniforms_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tbo = vc4_bo_create(dev, exec_size, true);\n\tif (IS_ERR(bo)) {\n\t\tDRM_ERROR(\"Couldn't allocate BO for binning\\n\");\n\t\tret = PTR_ERR(bo);\n\t\tgoto fail;\n\t}\n\texec->exec_bo = &bo->base;\n\n\tlist_add_tail(&to_vc4_bo(&exec->exec_bo->base)->unref_head,\n\t\t &exec->unref_list);\n\n\texec->ct0ca = exec->exec_bo->paddr + bin_offset;\n\n\texec->bin_u = bin;\n\n\texec->shader_rec_v = exec->exec_bo->vaddr + shader_rec_offset;\n\texec->shader_rec_p = exec->exec_bo->paddr + shader_rec_offset;\n\texec->shader_rec_size = args->shader_rec_size;\n\n\texec->uniforms_v = exec->exec_bo->vaddr + uniforms_offset;\n\texec->uniforms_p = exec->exec_bo->paddr + uniforms_offset;\n\texec->uniforms_size = args->uniforms_size;\n\n\tret = vc4_validate_bin_cl(dev,\n\t\t\t\t exec->exec_bo->vaddr + bin_offset,\n\t\t\t\t bin,\n\t\t\t\t exec);\n\tif (ret)\n\t\tgoto fail;\n\n\tret = vc4_validate_shader_recs(dev, exec);\n\tif (ret)\n\t\tgoto fail;\n\n\t/* Block waiting on any previous rendering into the CS's VBO,\n\t * IB, or textures, so that pixels are actually written by the\n\t * time we try to read them.\n\t */\n\tret = vc4_wait_for_seqno(dev, exec->bin_dep_seqno, ~0ull, true);\n\nfail:\n\tdrm_free_large(temp);\n\treturn ret;\n}\n", + "vul_type": "cwe-388", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "Tracks::Tracks(\n Segment* pSegment,\n long long start,\n long long size_,\n long long element_start,\n long long element_size) :\n m_pSegment(pSegment),\n m_start(start),\n m_size(size_),\n m_element_start(element_start),\n m_element_size(element_size),\n m_trackEntries(NULL),\n m_trackEntriesEnd(NULL)\n{\n}\n", + "target": "Tracks::Tracks(\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0a1d52994d440e21def1c2174932410b4f2a98a1", + "input": "int expand_downwards(struct vm_area_struct *vma,\n\t\t\t\t unsigned long address)\n {\n \tstruct mm_struct *mm = vma->vm_mm;\n \tstruct vm_area_struct *prev;\n\tint error;\n \n \taddress &= PAGE_MASK;\n\terror = security_mmap_addr(address);\n\tif (error)\n\t\treturn error;\n \n \t/* Enforce stack_guard_gap */\n \tprev = vma->vm_prev;\n\t/* Check that both stack segments have the same anon_vma? */\n\tif (prev && !(prev->vm_flags & VM_GROWSDOWN) &&\n\t\t\t(prev->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {\n\t\tif (address - prev->vm_end < stack_guard_gap)\n\t\t\treturn -ENOMEM;\n\t}\n\n\t/* We must make sure the anon_vma is allocated. */\n\tif (unlikely(anon_vma_prepare(vma)))\n\t\treturn -ENOMEM;\n\n\t/*\n\t * vma->vm_start/vm_end cannot change under us because the caller\n\t * is required to hold the mmap_sem in read mode. We need the\n\t * anon_vma lock to serialize against concurrent expand_stacks.\n\t */\n\tanon_vma_lock_write(vma->anon_vma);\n\n\t/* Somebody else might have raced and expanded it already */\n\tif (address < vma->vm_start) {\n\t\tunsigned long size, grow;\n\n\t\tsize = vma->vm_end - address;\n\t\tgrow = (vma->vm_start - address) >> PAGE_SHIFT;\n\n\t\terror = -ENOMEM;\n\t\tif (grow <= vma->vm_pgoff) {\n\t\t\terror = acct_stack_growth(vma, size, grow);\n\t\t\tif (!error) {\n\t\t\t\t/*\n\t\t\t\t * vma_gap_update() doesn't support concurrent\n\t\t\t\t * updates, but we only hold a shared mmap_sem\n\t\t\t\t * lock here, so we need to protect against\n\t\t\t\t * concurrent vma expansions.\n\t\t\t\t * anon_vma_lock_write() doesn't help here, as\n\t\t\t\t * we don't guarantee that all growable vmas\n\t\t\t\t * in a mm share the same root anon vma.\n\t\t\t\t * So, we reuse mm->page_table_lock to guard\n\t\t\t\t * against concurrent vma expansions.\n\t\t\t\t */\n\t\t\t\tspin_lock(&mm->page_table_lock);\n\t\t\t\tif (vma->vm_flags & VM_LOCKED)\n\t\t\t\t\tmm->locked_vm += grow;\n\t\t\t\tvm_stat_account(mm, vma->vm_flags, grow);\n\t\t\t\tanon_vma_interval_tree_pre_update_vma(vma);\n\t\t\t\tvma->vm_start = address;\n\t\t\t\tvma->vm_pgoff -= grow;\n\t\t\t\tanon_vma_interval_tree_post_update_vma(vma);\n\t\t\t\tvma_gap_update(vma);\n\t\t\t\tspin_unlock(&mm->page_table_lock);\n\n\t\t\t\tperf_event_mmap(vma);\n\t\t\t}\n\t\t}\n\t}\n\tanon_vma_unlock_write(vma->anon_vma);\n\tkhugepaged_enter_vma_merge(vma, vma->vm_flags);\n\tvalidate_mm(mm);\n\treturn error;\n}\n", + "target": "int expand_downwards(struct vm_area_struct *vma,\n\t\t\t\t unsigned long address)\n {\n \tstruct mm_struct *mm = vma->vm_mm;\n \tstruct vm_area_struct *prev;\n\tint error = 0;\n \n \taddress &= PAGE_MASK;\n\tif (address < mmap_min_addr)\n\t\treturn -EPERM;\n \n \t/* Enforce stack_guard_gap */\n \tprev = vma->vm_prev;\n\t/* Check that both stack segments have the same anon_vma? */\n\tif (prev && !(prev->vm_flags & VM_GROWSDOWN) &&\n\t\t\t(prev->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {\n\t\tif (address - prev->vm_end < stack_guard_gap)\n\t\t\treturn -ENOMEM;\n\t}\n\n\t/* We must make sure the anon_vma is allocated. */\n\tif (unlikely(anon_vma_prepare(vma)))\n\t\treturn -ENOMEM;\n\n\t/*\n\t * vma->vm_start/vm_end cannot change under us because the caller\n\t * is required to hold the mmap_sem in read mode. We need the\n\t * anon_vma lock to serialize against concurrent expand_stacks.\n\t */\n\tanon_vma_lock_write(vma->anon_vma);\n\n\t/* Somebody else might have raced and expanded it already */\n\tif (address < vma->vm_start) {\n\t\tunsigned long size, grow;\n\n\t\tsize = vma->vm_end - address;\n\t\tgrow = (vma->vm_start - address) >> PAGE_SHIFT;\n\n\t\terror = -ENOMEM;\n\t\tif (grow <= vma->vm_pgoff) {\n\t\t\terror = acct_stack_growth(vma, size, grow);\n\t\t\tif (!error) {\n\t\t\t\t/*\n\t\t\t\t * vma_gap_update() doesn't support concurrent\n\t\t\t\t * updates, but we only hold a shared mmap_sem\n\t\t\t\t * lock here, so we need to protect against\n\t\t\t\t * concurrent vma expansions.\n\t\t\t\t * anon_vma_lock_write() doesn't help here, as\n\t\t\t\t * we don't guarantee that all growable vmas\n\t\t\t\t * in a mm share the same root anon vma.\n\t\t\t\t * So, we reuse mm->page_table_lock to guard\n\t\t\t\t * against concurrent vma expansions.\n\t\t\t\t */\n\t\t\t\tspin_lock(&mm->page_table_lock);\n\t\t\t\tif (vma->vm_flags & VM_LOCKED)\n\t\t\t\t\tmm->locked_vm += grow;\n\t\t\t\tvm_stat_account(mm, vma->vm_flags, grow);\n\t\t\t\tanon_vma_interval_tree_pre_update_vma(vma);\n\t\t\t\tvma->vm_start = address;\n\t\t\t\tvma->vm_pgoff -= grow;\n\t\t\t\tanon_vma_interval_tree_post_update_vma(vma);\n\t\t\t\tvma_gap_update(vma);\n\t\t\t\tspin_unlock(&mm->page_table_lock);\n\n\t\t\t\tperf_event_mmap(vma);\n\t\t\t}\n\t\t}\n\t}\n\tanon_vma_unlock_write(vma->anon_vma);\n\tkhugepaged_enter_vma_merge(vma, vma->vm_flags);\n\tvalidate_mm(mm);\n\treturn error;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#819cbb120eaec7e014e5abd029260db1ca8c5735", + "input": "static int do_devinfo_ioctl(struct comedi_device *dev,\n\t\t\t struct comedi_devinfo __user *arg,\n\t\t\t struct file *file)\n{\n\tstruct comedi_devinfo devinfo;\n\tconst unsigned minor = iminor(file->f_dentry->d_inode);\n\tstruct comedi_device_file_info *dev_file_info =\n\t comedi_get_device_file_info(minor);\n\tstruct comedi_subdevice *read_subdev =\n\t comedi_get_read_subdevice(dev_file_info);\n\tstruct comedi_subdevice *write_subdev =\n\t comedi_get_write_subdevice(dev_file_info);\n\n\tmemset(&devinfo, 0, sizeof(devinfo));\n\n \t/* fill devinfo structure */\n \tdevinfo.version_code = COMEDI_VERSION_CODE;\n \tdevinfo.n_subdevs = dev->n_subdevices;\n\tmemcpy(devinfo.driver_name, dev->driver->driver_name, COMEDI_NAMELEN);\n\tmemcpy(devinfo.board_name, dev->board_name, COMEDI_NAMELEN);\n \n \tif (read_subdev)\n \t\tdevinfo.read_subdevice = read_subdev - dev->subdevices;\n\telse\n\t\tdevinfo.read_subdevice = -1;\n\n\tif (write_subdev)\n\t\tdevinfo.write_subdevice = write_subdev - dev->subdevices;\n\telse\n\t\tdevinfo.write_subdevice = -1;\n\n\tif (copy_to_user(arg, &devinfo, sizeof(struct comedi_devinfo)))\n\t\treturn -EFAULT;\n\n\treturn 0;\n}\n", + "target": "static int do_devinfo_ioctl(struct comedi_device *dev,\n\t\t\t struct comedi_devinfo __user *arg,\n\t\t\t struct file *file)\n{\n\tstruct comedi_devinfo devinfo;\n\tconst unsigned minor = iminor(file->f_dentry->d_inode);\n\tstruct comedi_device_file_info *dev_file_info =\n\t comedi_get_device_file_info(minor);\n\tstruct comedi_subdevice *read_subdev =\n\t comedi_get_read_subdevice(dev_file_info);\n\tstruct comedi_subdevice *write_subdev =\n\t comedi_get_write_subdevice(dev_file_info);\n\n\tmemset(&devinfo, 0, sizeof(devinfo));\n\n \t/* fill devinfo structure */\n \tdevinfo.version_code = COMEDI_VERSION_CODE;\n \tdevinfo.n_subdevs = dev->n_subdevices;\n\tstrlcpy(devinfo.driver_name, dev->driver->driver_name, COMEDI_NAMELEN);\n\tstrlcpy(devinfo.board_name, dev->board_name, COMEDI_NAMELEN);\n \n \tif (read_subdev)\n \t\tdevinfo.read_subdevice = read_subdev - dev->subdevices;\n\telse\n\t\tdevinfo.read_subdevice = -1;\n\n\tif (write_subdev)\n\t\tdevinfo.write_subdevice = write_subdev - dev->subdevices;\n\telse\n\t\tdevinfo.write_subdevice = -1;\n\n\tif (copy_to_user(arg, &devinfo, sizeof(struct comedi_devinfo)))\n\t\treturn -EFAULT;\n\n\treturn 0;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#224858e719d045c8554856b12c4ab73d2375cf33", + "input": "void NuPlayer::GenericSource::notifyPreparedAndCleanup(status_t err) {\n if (err != OK) {\n mMetaDataSize = -1ll;\n mContentType = \"\";\n mSniffedMIME = \"\";\n {\n sp dataSource = mDataSource;\n sp cachedSource = mCachedSource;\n sp httpSource = mHttpSource;\n\n {\n Mutex::Autolock _l(mDisconnectLock);\n mDataSource.clear();\n mCachedSource.clear();\n mHttpSource.clear();\n }\n }\n\n cancelPollBuffering();\n }\n notifyPrepared(err);\n}\n", + "target": "void NuPlayer::GenericSource::notifyPreparedAndCleanup(status_t err) {\n if (err != OK) {\n mMetaDataSize = -1ll;\n mContentType = \"\";\n mSniffedMIME = \"\";\n {\n sp dataSource = mDataSource;\n sp cachedSource = mCachedSource;\n sp httpSource = mHttpSource;\n\n {\n Mutex::Autolock _l(mDisconnectLock);\n mDataSource.clear();\n mDrmManagerClient = NULL;\n mCachedSource.clear();\n mHttpSource.clear();\n }\n }\n\n cancelPollBuffering();\n }\n notifyPrepared(err);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a0d7f432abee692402c00e8b615ff5982dde9780", + "input": "size_t jsuGetFreeStack() {\n#ifdef ARM\n void *frame = __builtin_frame_address(0);\n size_t stackPos = (size_t)((char*)frame);\n size_t stackEnd = (size_t)((char*)&LINKER_END_VAR);\n if (stackPos < stackEnd) return 0; // should never happen, but just in case of overflow!\n return stackPos - stackEnd;\n#elif defined(LINUX)\n char ptr; // this is on the stack\n extern void *STACK_BASE;\n uint32_t count = (uint32_t)((size_t)STACK_BASE - (size_t)&ptr);\n return 1000000 - count; // give it 1 megabyte of stack\n #else\n return 1000000; // no stack depth check on this platform\n#endif\n}\n", + "target": "size_t jsuGetFreeStack() {\n#ifdef ARM\n void *frame = __builtin_frame_address(0);\n size_t stackPos = (size_t)((char*)frame);\n size_t stackEnd = (size_t)((char*)&LINKER_END_VAR);\n if (stackPos < stackEnd) return 0; // should never happen, but just in case of overflow!\n return stackPos - stackEnd;\n#elif defined(LINUX)\n char ptr; // this is on the stack\n extern void *STACK_BASE;\n uint32_t count = (uint32_t)((size_t)STACK_BASE - (size_t)&ptr);\n const uint32_t max_stack = 1000000; // give it 1 megabyte of stack\n if (count>max_stack) return 0;\n return max_stack - count;\n #else\n return 1000000; // no stack depth check on this platform\n#endif\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#bceaa90240b6019ed73b49965eac7d167610be69", + "input": "static int pn_recvmsg(struct kiocb *iocb, struct sock *sk,\n\t\t\tstruct msghdr *msg, size_t len, int noblock,\n\t\t\tint flags, int *addr_len)\n{\n\tstruct sk_buff *skb = NULL;\n\tstruct sockaddr_pn sa;\n\tint rval = -EOPNOTSUPP;\n\tint copylen;\n\n\tif (flags & ~(MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_NOSIGNAL|\n \t\t\tMSG_CMSG_COMPAT))\n \t\tgoto out_nofree;\n \n\tif (addr_len)\n\t\t*addr_len = sizeof(sa);\n \tskb = skb_recv_datagram(sk, flags, noblock, &rval);\n \tif (skb == NULL)\n \t\tgoto out_nofree;\n\n\tpn_skb_get_src_sockaddr(skb, &sa);\n\n\tcopylen = skb->len;\n\tif (len < copylen) {\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\t\tcopylen = len;\n\t}\n\n\trval = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copylen);\n\tif (rval) {\n\t\trval = -EFAULT;\n\t\tgoto out;\n\t}\n \n \trval = (flags & MSG_TRUNC) ? skb->len : copylen;\n \n\tif (msg->msg_name != NULL)\n\t\tmemcpy(msg->msg_name, &sa, sizeof(struct sockaddr_pn));\n \n out:\n \tskb_free_datagram(sk, skb);\n\nout_nofree:\n\treturn rval;\n}\n", + "target": "static int pn_recvmsg(struct kiocb *iocb, struct sock *sk,\n\t\t\tstruct msghdr *msg, size_t len, int noblock,\n\t\t\tint flags, int *addr_len)\n{\n\tstruct sk_buff *skb = NULL;\n\tstruct sockaddr_pn sa;\n\tint rval = -EOPNOTSUPP;\n\tint copylen;\n\n\tif (flags & ~(MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_NOSIGNAL|\n \t\t\tMSG_CMSG_COMPAT))\n \t\tgoto out_nofree;\n \n \tskb = skb_recv_datagram(sk, flags, noblock, &rval);\n \tif (skb == NULL)\n \t\tgoto out_nofree;\n\n\tpn_skb_get_src_sockaddr(skb, &sa);\n\n\tcopylen = skb->len;\n\tif (len < copylen) {\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\t\tcopylen = len;\n\t}\n\n\trval = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copylen);\n\tif (rval) {\n\t\trval = -EFAULT;\n\t\tgoto out;\n\t}\n \n \trval = (flags & MSG_TRUNC) ? skb->len : copylen;\n \n\tif (msg->msg_name != NULL) {\n\t\tmemcpy(msg->msg_name, &sa, sizeof(sa));\n\t\t*addr_len = sizeof(sa);\n\t}\n \n out:\n \tskb_free_datagram(sk, skb);\n\nout_nofree:\n\treturn rval;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5b597a2e5b28e2d5a52fc1be13f425f08f47cb62?w=1", + "input": "static size_t _php_mb_regex_get_option_string(char *str, size_t len, OnigOptionType option, OnigSyntaxType *syntax)\n{\n\tsize_t len_left = len;\n\tsize_t len_req = 0;\n\tchar *p = str;\n\tchar c;\n\n\tif ((option & ONIG_OPTION_IGNORECASE) != 0) {\n\t\tif (len_left > 0) {\n \t\t\t--len_left;\n \t\t\t*(p++) = 'i';\n \t\t}\n\t\t++len_req;\t\n \t}\n \n \tif ((option & ONIG_OPTION_EXTEND) != 0) {\n \t\tif (len_left > 0) {\n \t\t\t--len_left;\n \t\t\t*(p++) = 'x';\n \t\t}\n\t\t++len_req;\t\n \t}\n \n \tif ((option & (ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE)) ==\n\t\t\t(ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE)) {\n\t\tif (len_left > 0) {\n \t\t\t--len_left;\n \t\t\t*(p++) = 'p';\n \t\t}\n\t\t++len_req;\t\n \t} else {\n \t\tif ((option & ONIG_OPTION_MULTILINE) != 0) {\n \t\t\tif (len_left > 0) {\n \t\t\t\t--len_left;\n \t\t\t\t*(p++) = 'm';\n \t\t\t}\n\t\t\t++len_req;\t\n \t\t}\n \n \t\tif ((option & ONIG_OPTION_SINGLELINE) != 0) {\n \t\t\tif (len_left > 0) {\n \t\t\t\t--len_left;\n \t\t\t\t*(p++) = 's';\n \t\t\t}\n\t\t\t++len_req;\t\n \t\t}\n\t}\t\n \tif ((option & ONIG_OPTION_FIND_LONGEST) != 0) {\n \t\tif (len_left > 0) {\n \t\t\t--len_left;\n \t\t\t*(p++) = 'l';\n \t\t}\n\t\t++len_req;\t\n \t}\n \tif ((option & ONIG_OPTION_FIND_NOT_EMPTY) != 0) {\n \t\tif (len_left > 0) {\n \t\t\t--len_left;\n \t\t\t*(p++) = 'n';\n \t\t}\n\t\t++len_req;\t\n \t}\n \n \tc = 0;\n\n\tif (syntax == ONIG_SYNTAX_JAVA) {\n\t\tc = 'j';\n\t} else if (syntax == ONIG_SYNTAX_GNU_REGEX) {\n\t\tc = 'u';\n\t} else if (syntax == ONIG_SYNTAX_GREP) {\n\t\tc = 'g';\n\t} else if (syntax == ONIG_SYNTAX_EMACS) {\n\t\tc = 'c';\n\t} else if (syntax == ONIG_SYNTAX_RUBY) {\n\t\tc = 'r';\n\t} else if (syntax == ONIG_SYNTAX_PERL) {\n\t\tc = 'z';\n\t} else if (syntax == ONIG_SYNTAX_POSIX_BASIC) {\n\t\tc = 'b';\n\t} else if (syntax == ONIG_SYNTAX_POSIX_EXTENDED) {\n\t\tc = 'd';\n\t}\n\n\tif (c != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = c;\n\t\t}\n\t\t++len_req;\n\t}\n\n\n\tif (len_left > 0) {\n \t\t--len_left;\n \t\t*(p++) = '\\0';\n \t}\n\t++len_req;\t\n \tif (len < len_req) {\n \t\treturn len_req;\n \t}\n\n\treturn 0;\n}\n", + "target": "static size_t _php_mb_regex_get_option_string(char *str, size_t len, OnigOptionType option, OnigSyntaxType *syntax)\n{\n\tsize_t len_left = len;\n\tsize_t len_req = 0;\n\tchar *p = str;\n\tchar c;\n\n\tif ((option & ONIG_OPTION_IGNORECASE) != 0) {\n\t\tif (len_left > 0) {\n \t\t\t--len_left;\n \t\t\t*(p++) = 'i';\n \t\t}\n\t\t++len_req;\n \t}\n \n \tif ((option & ONIG_OPTION_EXTEND) != 0) {\n \t\tif (len_left > 0) {\n \t\t\t--len_left;\n \t\t\t*(p++) = 'x';\n \t\t}\n\t\t++len_req;\n \t}\n \n \tif ((option & (ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE)) ==\n\t\t\t(ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE)) {\n\t\tif (len_left > 0) {\n \t\t\t--len_left;\n \t\t\t*(p++) = 'p';\n \t\t}\n\t\t++len_req;\n \t} else {\n \t\tif ((option & ONIG_OPTION_MULTILINE) != 0) {\n \t\t\tif (len_left > 0) {\n \t\t\t\t--len_left;\n \t\t\t\t*(p++) = 'm';\n \t\t\t}\n\t\t\t++len_req;\n \t\t}\n \n \t\tif ((option & ONIG_OPTION_SINGLELINE) != 0) {\n \t\t\tif (len_left > 0) {\n \t\t\t\t--len_left;\n \t\t\t\t*(p++) = 's';\n \t\t\t}\n\t\t\t++len_req;\n \t\t}\n\t}\n \tif ((option & ONIG_OPTION_FIND_LONGEST) != 0) {\n \t\tif (len_left > 0) {\n \t\t\t--len_left;\n \t\t\t*(p++) = 'l';\n \t\t}\n\t\t++len_req;\n \t}\n \tif ((option & ONIG_OPTION_FIND_NOT_EMPTY) != 0) {\n \t\tif (len_left > 0) {\n \t\t\t--len_left;\n \t\t\t*(p++) = 'n';\n \t\t}\n\t\t++len_req;\n \t}\n \n \tc = 0;\n\n\tif (syntax == ONIG_SYNTAX_JAVA) {\n\t\tc = 'j';\n\t} else if (syntax == ONIG_SYNTAX_GNU_REGEX) {\n\t\tc = 'u';\n\t} else if (syntax == ONIG_SYNTAX_GREP) {\n\t\tc = 'g';\n\t} else if (syntax == ONIG_SYNTAX_EMACS) {\n\t\tc = 'c';\n\t} else if (syntax == ONIG_SYNTAX_RUBY) {\n\t\tc = 'r';\n\t} else if (syntax == ONIG_SYNTAX_PERL) {\n\t\tc = 'z';\n\t} else if (syntax == ONIG_SYNTAX_POSIX_BASIC) {\n\t\tc = 'b';\n\t} else if (syntax == ONIG_SYNTAX_POSIX_EXTENDED) {\n\t\tc = 'd';\n\t}\n\n\tif (c != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = c;\n\t\t}\n\t\t++len_req;\n\t}\n\n\n\tif (len_left > 0) {\n \t\t--len_left;\n \t\t*(p++) = '\\0';\n \t}\n\t++len_req;\n \tif (len < len_req) {\n \t\treturn len_req;\n \t}\n\n\treturn 0;\n}\n", + "vul_type": "cwe-415", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b2b21468c1f7f08b30a7c1755316f6026c50eb2a", + "input": "void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyle)\n{\n RenderStyle* oldStyle = style();\n if (oldStyle) {\n if (diff >= StyleDifferenceRepaint && node() &&\n (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) {\n view()->repaint();\n \n if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFixedBackground())\n view()->compositor()->setNeedsUpdateFixedBackground();\n }\n \n if (diff == StyleDifferenceLayout && parent() && oldStyle->position() != newStyle.position()) {\n markContainingBlocksForLayout();\n if (oldStyle->position() == StaticPosition)\n repaint();\n else if (newStyle.hasOutOfFlowPosition())\n parent()->setChildNeedsLayout();\n if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlowPosition())\n removeFloatingOrPositionedChildFromBlockLists();\n }\n } else if (isBody())\n view()->repaint();\n\n RenderBoxModelObject::styleWillChange(diff, newStyle);\n}\n", + "target": "void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyle)\n{\n RenderStyle* oldStyle = style();\n if (oldStyle) {\n if ((diff.needsRepaint() || diff.needsLayout()) && node()\n && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) {\n view()->repaint();\n \n if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFixedBackground())\n view()->compositor()->setNeedsUpdateFixedBackground();\n }\n \n if (diff.needsFullLayout() && parent() && oldStyle->position() != newStyle.position()) {\n markContainingBlocksForLayout();\n if (oldStyle->position() == StaticPosition)\n repaint();\n else if (newStyle.hasOutOfFlowPosition())\n parent()->setChildNeedsLayout();\n if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlowPosition())\n removeFloatingOrPositionedChildFromBlockLists();\n }\n } else if (isBody())\n view()->repaint();\n\n RenderBoxModelObject::styleWillChange(diff, newStyle);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8083841913b8eb8018ae52f67c923f0b3d66c466", + "input": " bool HasPermissionsForFile(const FilePath& file, int permissions) {\n FilePath current_path = file.StripTrailingSeparators();\n FilePath last_path;\n while (current_path != last_path) {\n if (file_permissions_.find(current_path) != file_permissions_.end())\n return (file_permissions_[current_path] & permissions) == permissions;\n last_path = current_path;\n current_path = current_path.DirName();\n }\n\n return false;\n }\n", + "target": " bool HasPermissionsForFile(const FilePath& file, int permissions) {\n FilePath current_path = file.StripTrailingSeparators();\n FilePath last_path;\n int skip = 0;\n while (current_path != last_path) {\n FilePath base_name = current_path.BaseName();\n if (base_name.value() == FilePath::kParentDirectory) {\n ++skip;\n } else if (skip > 0) {\n if (base_name.value() != FilePath::kCurrentDirectory)\n --skip;\n } else {\n if (file_permissions_.find(current_path) != file_permissions_.end())\n return (file_permissions_[current_path] & permissions) == permissions;\n }\n last_path = current_path;\n current_path = current_path.DirName();\n }\n\n return false;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d2f813f7db157fc83abc4b3726821c36ee7e40b1", + "input": "fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)\n{\n\n \tsrcRepeat = FALSE;\n if (maskTransform)\n \tmaskRepeat = FALSE;\n if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc,\n\t\t\t\t xMask, yMask, xDst, yDst, width, height))\n return;\n \n n = REGION_NUM_RECTS (®ion);\n pbox = REGION_RECTS (®ion);\n while (n--)\n {\n\th = pbox->y2 - pbox->y1;\n\ty_src = pbox->y1 - yDst + ySrc;\n\ty_msk = pbox->y1 - yDst + yMask;\n\ty_dst = pbox->y1;\n\twhile (h)\n\t{\n\t h_this = h;\n\t w = pbox->x2 - pbox->x1;\n\t x_src = pbox->x1 - xDst + xSrc;\n\t x_msk = pbox->x1 - xDst + xMask;\n\t x_dst = pbox->x1;\n\t if (maskRepeat)\n\t {\n\t\ty_msk = mod (y_msk - pMask->pDrawable->y, pMask->pDrawable->height);\n\t\tif (h_this > pMask->pDrawable->height - y_msk)\n\t\t h_this = pMask->pDrawable->height - y_msk;\n\t\ty_msk += pMask->pDrawable->y;\n\t }\n\t if (srcRepeat)\n\t {\n\t\ty_src = mod (y_src - pSrc->pDrawable->y, pSrc->pDrawable->height);\n\t\tif (h_this > pSrc->pDrawable->height - y_src)\n\t\t h_this = pSrc->pDrawable->height - y_src;\n\t\ty_src += pSrc->pDrawable->y;\n\t }\n\t while (w)\n\t {\n\t\tw_this = w;\n\t\tif (maskRepeat)\n\t\t{\n\t\t x_msk = mod (x_msk - pMask->pDrawable->x, pMask->pDrawable->width);\n\t\t if (w_this > pMask->pDrawable->width - x_msk)\n\t\t\tw_this = pMask->pDrawable->width - x_msk;\n\t\t x_msk += pMask->pDrawable->x;\n\t\t}\n\t\tif (srcRepeat)\n\t\t{\n\t\t x_src = mod (x_src - pSrc->pDrawable->x, pSrc->pDrawable->width);\n\t\t if (w_this > pSrc->pDrawable->width - x_src)\n\t\t\tw_this = pSrc->pDrawable->width - x_src;\n\t\t x_src += pSrc->pDrawable->x;\n\t\t}\n\t\t(*func) (op, pSrc, pMask, pDst,\n\t\t\t x_src, y_src, x_msk, y_msk, x_dst, y_dst,\n\t\t\t w_this, h_this);\n\t\tw -= w_this;\n\t\tx_src += w_this;\n\t\tx_msk += w_this;\n\t\tx_dst += w_this;\n\t }\n\t h -= h_this;\n\t y_src += h_this;\n\t y_msk += h_this;\n\t y_dst += h_this;\n\t}\n\tpbox++;\n }\n REGION_UNINIT (pDst->pDrawable->pScreen, ®ion);\n }\n", + "target": "fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)\n{\n\n \tsrcRepeat = FALSE;\n if (maskTransform)\n \tmaskRepeat = FALSE;\n \n fbWalkCompositeRegion (op, pSrc, pMask, pDst, xSrc, ySrc,\n\t\t\t xMask, yMask, xDst, yDst, width, height,\n\t\t\t srcRepeat, maskRepeat, func);\n }\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e68fafe04d29810cebe8d25554863b0cae4c1356", + "input": "int UDPSocketLibevent::DoBind(const IPEndPoint& address) {\n SockaddrStorage storage;\n if (!address.ToSockAddr(storage.addr, &storage.addr_len))\n return ERR_ADDRESS_INVALID;\n int rv = bind(socket_, storage.addr, storage.addr_len);\n if (rv == 0)\n return OK;\n int last_error = errno;\n UMA_HISTOGRAM_SPARSE_SLOWLY(\"Net.UdpSocketBindErrorFromPosix\", last_error);\n return MapSystemError(last_error);\n }\n", + "target": "int UDPSocketLibevent::DoBind(const IPEndPoint& address) {\n SockaddrStorage storage;\n if (!address.ToSockAddr(storage.addr, &storage.addr_len))\n return ERR_ADDRESS_INVALID;\n int rv = bind(socket_, storage.addr, storage.addr_len);\n if (rv == 0)\n return OK;\n int last_error = errno;\n UMA_HISTOGRAM_SPARSE_SLOWLY(\"Net.UdpSocketBindErrorFromPosix\", last_error);\n#if defined(OS_CHROMEOS)\n if (last_error == EINVAL)\n return ERR_ADDRESS_IN_USE;\n#elif defined(OS_MACOSX)\n if (last_error == EADDRNOTAVAIL)\n return ERR_ADDRESS_IN_USE;\n#endif\n return MapSystemError(last_error);\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4435b9142ff9813845d5c97ab29a5d637bedb257", + "input": "PHP_FUNCTION(stream_resolve_include_path)\n{\n char *filename, *resolved_path;\n int filename_len;\n \n if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &filename, &filename_len) == FAILURE) {\n return;\n }\n\tresolved_path = zend_resolve_path(filename, filename_len TSRMLS_CC);\n\n\tif (resolved_path) {\n\t\tRETURN_STRING(resolved_path, 0);\n\t}\n\tRETURN_FALSE;\n}\n", + "target": "PHP_FUNCTION(stream_resolve_include_path)\n{\n char *filename, *resolved_path;\n int filename_len;\n \n if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"p\", &filename, &filename_len) == FAILURE) {\n return;\n }\n\tresolved_path = zend_resolve_path(filename, filename_len TSRMLS_CC);\n\n\tif (resolved_path) {\n\t\tRETURN_STRING(resolved_path, 0);\n\t}\n\tRETURN_FALSE;\n}\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#11f3659f64a4e42e90cb3c09fcef66894205aefe", + "input": "int DecodeTunnel(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,\n uint8_t *pkt, uint32_t len, PacketQueue *pq, enum DecodeTunnelProto proto)\n{\n switch (proto) {\n case DECODE_TUNNEL_PPP:\n return DecodePPP(tv, dtv, p, pkt, len, pq);\n case DECODE_TUNNEL_IPV4:\n return DecodeIPV4(tv, dtv, p, pkt, len, pq);\n case DECODE_TUNNEL_IPV6:\n return DecodeIPV6(tv, dtv, p, pkt, len, pq);\n case DECODE_TUNNEL_VLAN:\n return DecodeVLAN(tv, dtv, p, pkt, len, pq);\n case DECODE_TUNNEL_ETHERNET:\n return DecodeEthernet(tv, dtv, p, pkt, len, pq);\n case DECODE_TUNNEL_ERSPAN:\n return DecodeERSPAN(tv, dtv, p, pkt, len, pq);\n default:\n SCLogInfo(\"FIXME: DecodeTunnel: protocol %\" PRIu32 \" not supported.\", proto);\n break;\n }\n return TM_ECODE_OK;\n}\n", + "target": "int DecodeTunnel(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,\n uint8_t *pkt, uint32_t len, PacketQueue *pq, enum DecodeTunnelProto proto)\n{\n switch (proto) {\n case DECODE_TUNNEL_PPP:\n return DecodePPP(tv, dtv, p, pkt, len, pq);\n case DECODE_TUNNEL_IPV4:\n return DecodeIPV4(tv, dtv, p, pkt, len, pq);\n case DECODE_TUNNEL_IPV6:\n case DECODE_TUNNEL_IPV6_TEREDO:\n return DecodeIPV6(tv, dtv, p, pkt, len, pq);\n case DECODE_TUNNEL_VLAN:\n return DecodeVLAN(tv, dtv, p, pkt, len, pq);\n case DECODE_TUNNEL_ETHERNET:\n return DecodeEthernet(tv, dtv, p, pkt, len, pq);\n case DECODE_TUNNEL_ERSPAN:\n return DecodeERSPAN(tv, dtv, p, pkt, len, pq);\n default:\n SCLogDebug(\"FIXME: DecodeTunnel: protocol %\" PRIu32 \" not supported.\", proto);\n break;\n }\n return TM_ECODE_OK;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#7-d6ed886028d6", + "input": "@app.route(\"//edit\")\ndef edit_page(page_name):\n query = db.query(\"select * from page where title = '%s'\" % page_name).namedresult()\n if len(query) == 0:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query\n )\n else:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query[0]\n )", + "target": "@app.route(\"//edit\")\ndef edit_page(page_name):\n query = db.query(\"select * from page where title = $1\", page_name).namedresult()\n if len(query) == 0:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query\n )\n else:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query[0]\n )", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#11f8838bf99ea0a6f0b76f9760c43704d00c4ff6", + "input": "setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)\n{\n DTD * const dtd = parser->m_dtd; /* save one level of indirection */\n const XML_Char *name;\n for (name = elementType->name; *name; name++) {\n if (*name == XML_T(ASCII_COLON)) {\n PREFIX *prefix;\n const XML_Char *s;\n for (s = elementType->name; s != name; s++) {\n if (!poolAppendChar(&dtd->pool, *s))\n return 0;\n }\n if (!poolAppendChar(&dtd->pool, XML_T('\\0')))\n return 0;\n prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool),\n sizeof(PREFIX));\n if (!prefix)\n return 0;\n if (prefix->name == poolStart(&dtd->pool))\n poolFinish(&dtd->pool);\n else\n poolDiscard(&dtd->pool);\n elementType->prefix = prefix;\n }\n }\n return 1;\n}\n", + "target": "setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)\n{\n DTD * const dtd = parser->m_dtd; /* save one level of indirection */\n const XML_Char *name;\n for (name = elementType->name; *name; name++) {\n if (*name == XML_T(ASCII_COLON)) {\n PREFIX *prefix;\n const XML_Char *s;\n for (s = elementType->name; s != name; s++) {\n if (!poolAppendChar(&dtd->pool, *s))\n return 0;\n }\n if (!poolAppendChar(&dtd->pool, XML_T('\\0')))\n return 0;\n prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool),\n sizeof(PREFIX));\n if (!prefix)\n return 0;\n if (prefix->name == poolStart(&dtd->pool))\n poolFinish(&dtd->pool);\n else\n poolDiscard(&dtd->pool);\n elementType->prefix = prefix;\n break;\n }\n }\n return 1;\n}\n", + "vul_type": "cwe-611", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d4fdf8ba0e5808ba9ad6b44337783bd9935e0982", + "input": "int create_flush_cmd_control(struct f2fs_sb_info *sbi)\n{\n\tdev_t dev = sbi->sb->s_bdev->bd_dev;\n\tstruct flush_cmd_control *fcc;\n\tint err = 0;\n\n\tif (SM_I(sbi)->fcc_info) {\n\t\tfcc = SM_I(sbi)->fcc_info;\n\t\tgoto init_thread;\n\t}\n\n\tfcc = kzalloc(sizeof(struct flush_cmd_control), GFP_KERNEL);\n\tif (!fcc)\n\t\treturn -ENOMEM;\n\tatomic_set(&fcc->issued_flush, 0);\n\tatomic_set(&fcc->issing_flush, 0);\n \tinit_waitqueue_head(&fcc->flush_wait_queue);\n \tinit_llist_head(&fcc->issue_list);\n \tSM_I(sbi)->fcc_info = fcc;\n init_thread:\n \tfcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi,\n \t\t\t\t\"f2fs_flush-%u:%u\", MAJOR(dev), MINOR(dev));\n\tif (IS_ERR(fcc->f2fs_issue_flush)) {\n\t\terr = PTR_ERR(fcc->f2fs_issue_flush);\n\t\tkfree(fcc);\n\t\tSM_I(sbi)->fcc_info = NULL;\n\t\treturn err;\n\t}\n\n\treturn err;\n}\n", + "target": "int create_flush_cmd_control(struct f2fs_sb_info *sbi)\n{\n\tdev_t dev = sbi->sb->s_bdev->bd_dev;\n\tstruct flush_cmd_control *fcc;\n\tint err = 0;\n\n\tif (SM_I(sbi)->fcc_info) {\n\t\tfcc = SM_I(sbi)->fcc_info;\n\t\tgoto init_thread;\n\t}\n\n\tfcc = kzalloc(sizeof(struct flush_cmd_control), GFP_KERNEL);\n\tif (!fcc)\n\t\treturn -ENOMEM;\n\tatomic_set(&fcc->issued_flush, 0);\n\tatomic_set(&fcc->issing_flush, 0);\n \tinit_waitqueue_head(&fcc->flush_wait_queue);\n \tinit_llist_head(&fcc->issue_list);\n \tSM_I(sbi)->fcc_info = fcc;\n\tif (!test_opt(sbi, FLUSH_MERGE))\n\t\treturn err;\n\n init_thread:\n \tfcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi,\n \t\t\t\t\"f2fs_flush-%u:%u\", MAJOR(dev), MINOR(dev));\n\tif (IS_ERR(fcc->f2fs_issue_flush)) {\n\t\terr = PTR_ERR(fcc->f2fs_issue_flush);\n\t\tkfree(fcc);\n\t\tSM_I(sbi)->fcc_info = NULL;\n\t\treturn err;\n\t}\n\n\treturn err;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2aec794f26098c7a361c27d7c8f57119631cca8a", + "input": " void ExtensionDevToolsClientHost::AgentHostClosed(\n DevToolsAgentHost* agent_host) {\n DCHECK(agent_host == agent_host_.get());\n SendDetachedEvent();\n delete this;\n }\n", + "target": " void ExtensionDevToolsClientHost::AgentHostClosed(\n DevToolsAgentHost* agent_host) {\n DCHECK(agent_host == agent_host_.get());\n RespondDetachedToPendingRequests();\n SendDetachedEvent();\n delete this;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7b8a4ecd6ff9cdf4e5d3850ebf822f1e989255b3", + "input": "void sum_init(int csum_type, int seed)\n{\n\tchar s[4];\n\n\tif (csum_type < 0)\n\t\tcsum_type = parse_csum_name(NULL, 0);\n\tcursum_type = csum_type;\n\n\tswitch (csum_type) {\n\t case CSUM_MD5:\n\t\tmd5_begin(&md);\n\t\tbreak;\n\t case CSUM_MD4:\n\t\tmdfour_begin(&md);\n\t\tsumresidue = 0;\n\t\tbreak;\n\t case CSUM_MD4_OLD:\n break;\n case CSUM_MD4_OLD:\n case CSUM_MD4_BUSTED:\n mdfour_begin(&md);\n sumresidue = 0;\n SIVAL(s, 0, seed);\n\t\tbreak;\n\t}\n}\n", + "target": "void sum_init(int csum_type, int seed)\n{\n\tchar s[4];\n\n\tif (csum_type < 0)\n\t\tcsum_type = parse_csum_name(NULL, 0);\n\tcursum_type = csum_type;\n\n\tswitch (csum_type) {\n\t case CSUM_MD5:\n\t\tmd5_begin(&md);\n\t\tbreak;\n\t case CSUM_MD4:\n\t\tmdfour_begin(&md);\n\t\tsumresidue = 0;\n\t\tbreak;\n\t case CSUM_MD4_OLD:\n break;\n case CSUM_MD4_OLD:\n case CSUM_MD4_BUSTED:\n case CSUM_MD4_ARCHAIC:\n mdfour_begin(&md);\n sumresidue = 0;\n SIVAL(s, 0, seed);\n\t\tbreak;\n\t}\n}\n", + "vul_type": "cwe-354", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d0666f289ac013094bbbf547bfbcd616199b7d2d", + "input": "int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,\n\t const unsigned char *in, int inl)\n\t{\n\tint seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,exp_nl;\n\tunsigned char *d;\n\n\tn=ctx->num;\n\td=ctx->enc_data;\n\tln=ctx->line_num;\n\texp_nl=ctx->expect_nl;\n\n\t/* last line of input. */\n\tif ((inl == 0) || ((n == 0) && (conv_ascii2bin(in[0]) == B64_EOF)))\n\t\t{ rv=0; goto end; }\n\t\t\n\t/* We parse the input data */\n\tfor (i=0; i 80 characters, scream alot */\n\t\tif (ln >= 80) { rv= -1; goto end; }\n\n\t\t/* Get char and put it into the buffer */\n\t\ttmp= *(in++);\n\t\tv=conv_ascii2bin(tmp);\n\t\t/* only save the good data :-) */\n\t\tif (!B64_NOT_BASE64(v))\n\t\t\t{\n\t\t\tOPENSSL_assert(n < (int)sizeof(ctx->enc_data));\n\t\t\td[n++]=tmp;\n\t\t\tln++;\n\t\t\t}\n\t\telse if (v == B64_ERROR)\n\t\t\t{\n\t\t\trv= -1;\n\t\t\tgoto end;\n\t\t\t}\n\n\t\t/* have we seen a '=' which is 'definitly' the last\n\t\t * input line. seof will point to the character that\n\t\t * holds it. and eof will hold how many characters to\n\t\t * chop off. */\n\t\tif (tmp == '=')\n\t\t\t{\n\t\t\tif (seof == -1) seof=n;\n\t\t\teof++;\n\t\t\t}\n\n\t\tif (v == B64_CR)\n\t\t\t{\n\t\t\tln = 0;\n\t\t\tif (exp_nl)\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t/* eoln */\n\t\tif (v == B64_EOLN)\n\t\t\t{\n\t\t\tln=0;\n\t\t\tif (exp_nl)\n\t\t\t\t{\n\t\t\t\texp_nl=0;\n\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\texp_nl=0;\n\n\t\t/* If we are at the end of input and it looks like a\n\t\t * line, process it. */\n\t\tif (((i+1) == inl) && (((n&3) == 0) || eof))\n\t\t\t{\n\t\t\tv=B64_EOF;\n\t\t\t/* In case things were given us in really small\n\t\t\t records (so two '=' were given in separate\n\t\t\t updates), eof may contain the incorrect number\n\t\t\t of ending bytes to skip, so let's redo the count */\n\t\t\teof = 0;\n\t\t\tif (d[n-1] == '=') eof++;\n\t\t\tif (d[n-2] == '=') eof++;\n\t\t\t/* There will never be more than two '=' */\n\t\t\t}\n\n\t\tif ((v == B64_EOF && (n&3) == 0) || (n >= 64))\n\t\t\t{\n\t\t\t/* This is needed to work correctly on 64 byte input\n\t\t\t * lines. We process the line and then need to\n\t\t\t * accept the '\\n' */\n\t\t\tif ((v != B64_EOF) && (n >= 64)) exp_nl=1;\n\t\t\tif (n > 0)\n\t\t\t\t{\n v=EVP_DecodeBlock(out,d,n);\n n=0;\n if (v < 0) { rv=0; goto end; }\n ret+=(v-eof);\n }\n else\n\t\t\t\teof=1;\n\t\t\t\tv=0;\n\t\t\t\t}\n\n\t\t\t/* This is the case where we have had a short\n\t\t\t * but valid input line */\n\t\t\tif ((v < ctx->length) && eof)\n\t\t\t\t{\n\t\t\t\trv=0;\n\t\t\t\tgoto end;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tctx->length=v;\n\n\t\t\tif (seof >= 0) { rv=0; goto end; }\n\t\t\tout+=v;\n\t\t\t}\n\t\t}\n", + "target": "int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,\n\t const unsigned char *in, int inl)\n\t{\n\tint seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,exp_nl;\n\tunsigned char *d;\n\n\tn=ctx->num;\n\td=ctx->enc_data;\n\tln=ctx->line_num;\n\texp_nl=ctx->expect_nl;\n\n\t/* last line of input. */\n\tif ((inl == 0) || ((n == 0) && (conv_ascii2bin(in[0]) == B64_EOF)))\n\t\t{ rv=0; goto end; }\n\t\t\n\t/* We parse the input data */\n\tfor (i=0; i 80 characters, scream alot */\n\t\tif (ln >= 80) { rv= -1; goto end; }\n\n\t\t/* Get char and put it into the buffer */\n\t\ttmp= *(in++);\n\t\tv=conv_ascii2bin(tmp);\n\t\t/* only save the good data :-) */\n\t\tif (!B64_NOT_BASE64(v))\n\t\t\t{\n\t\t\tOPENSSL_assert(n < (int)sizeof(ctx->enc_data));\n\t\t\td[n++]=tmp;\n\t\t\tln++;\n\t\t\t}\n\t\telse if (v == B64_ERROR)\n\t\t\t{\n\t\t\trv= -1;\n\t\t\tgoto end;\n\t\t\t}\n\n\t\t/* have we seen a '=' which is 'definitly' the last\n\t\t * input line. seof will point to the character that\n\t\t * holds it. and eof will hold how many characters to\n\t\t * chop off. */\n\t\tif (tmp == '=')\n\t\t\t{\n\t\t\tif (seof == -1) seof=n;\n\t\t\teof++;\n\t\t\t}\n\n\t\tif (v == B64_CR)\n\t\t\t{\n\t\t\tln = 0;\n\t\t\tif (exp_nl)\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t/* eoln */\n\t\tif (v == B64_EOLN)\n\t\t\t{\n\t\t\tln=0;\n\t\t\tif (exp_nl)\n\t\t\t\t{\n\t\t\t\texp_nl=0;\n\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\texp_nl=0;\n\n\t\t/* If we are at the end of input and it looks like a\n\t\t * line, process it. */\n\t\tif (((i+1) == inl) && (((n&3) == 0) || eof))\n\t\t\t{\n\t\t\tv=B64_EOF;\n\t\t\t/* In case things were given us in really small\n\t\t\t records (so two '=' were given in separate\n\t\t\t updates), eof may contain the incorrect number\n\t\t\t of ending bytes to skip, so let's redo the count */\n\t\t\teof = 0;\n\t\t\tif (d[n-1] == '=') eof++;\n\t\t\tif (d[n-2] == '=') eof++;\n\t\t\t/* There will never be more than two '=' */\n\t\t\t}\n\n\t\tif ((v == B64_EOF && (n&3) == 0) || (n >= 64))\n\t\t\t{\n\t\t\t/* This is needed to work correctly on 64 byte input\n\t\t\t * lines. We process the line and then need to\n\t\t\t * accept the '\\n' */\n\t\t\tif ((v != B64_EOF) && (n >= 64)) exp_nl=1;\n\t\t\tif (n > 0)\n\t\t\t\t{\n v=EVP_DecodeBlock(out,d,n);\n n=0;\n if (v < 0) { rv=0; goto end; }\n if (eof > v) { rv=-1; goto end; }\n ret+=(v-eof);\n }\n else\n\t\t\t\teof=1;\n\t\t\t\tv=0;\n\t\t\t\t}\n\n\t\t\t/* This is the case where we have had a short\n\t\t\t * but valid input line */\n\t\t\tif ((v < ctx->length) && eof)\n\t\t\t\t{\n\t\t\t\trv=0;\n\t\t\t\tgoto end;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tctx->length=v;\n\n\t\t\tif (seof >= 0) { rv=0; goto end; }\n\t\t\tout+=v;\n\t\t\t}\n\t\t}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#29a78a11844fc027fa44be7f8bd8dc1cf8bf89f6", + "input": "IMPEG2D_ERROR_CODES_T impeg2d_init_video_state(dec_state_t *ps_dec, e_video_type_t e_video_type)\n{\n /*-----------------------------------------------------------------------*/\n /* Bit Stream that conforms to MPEG-1 standard */\n /*-----------------------------------------------------------------------*/\n if(e_video_type == MPEG_1_VIDEO)\n {\n ps_dec->u2_is_mpeg2 = 0;\n\n /*-------------------------------------------------------------------*/\n /* force MPEG-1 parameters for proper decoder behavior */\n /* see ISO/IEC 13818-2 section D.9.14 */\n /*-------------------------------------------------------------------*/\n ps_dec->u2_progressive_sequence = 1;\n ps_dec->u2_intra_dc_precision = 0;\n ps_dec->u2_picture_structure = FRAME_PICTURE;\n ps_dec->u2_frame_pred_frame_dct = 1;\n ps_dec->u2_concealment_motion_vectors = 0;\n ps_dec->u2_q_scale_type = 0;\n ps_dec->u2_intra_vlc_format = 0;\n ps_dec->u2_alternate_scan = 0;\n ps_dec->u2_repeat_first_field = 0;\n\n ps_dec->u2_progressive_frame = 1;\n ps_dec->u2_frame_rate_extension_n = 0;\n ps_dec->u2_frame_rate_extension_d = 0;\n \n ps_dec->pf_vld_inv_quant = impeg2d_vld_inv_quant_mpeg1;\n /*-------------------------------------------------------------------*/\n /* Setting of parameters other than those mentioned in MPEG2 standard*/\n /* but used in decoding process. */\n /*-------------------------------------------------------------------*/\n }\n /*-----------------------------------------------------------------------*/\n /* Bit Stream that conforms to MPEG-2 */\n /*-----------------------------------------------------------------------*/\n else\n {\n ps_dec->u2_is_mpeg2 = 1;\n ps_dec->u2_full_pel_forw_vector = 0;\n ps_dec->u2_forw_f_code = 7;\n ps_dec->u2_full_pel_back_vector = 0;\n ps_dec->u2_back_f_code = 7;\n ps_dec->pf_vld_inv_quant = impeg2d_vld_inv_quant_mpeg2;\n\n\n }\n\n\n impeg2d_init_function_ptr(ps_dec);\n\n /* Set the frame Width and frame Height */\n ps_dec->u2_frame_height = ALIGN16(ps_dec->u2_vertical_size);\n ps_dec->u2_frame_width = ALIGN16(ps_dec->u2_horizontal_size);\n ps_dec->u2_num_horiz_mb = (ps_dec->u2_horizontal_size + 15) >> 4;\n if (ps_dec->u2_frame_height > ps_dec->u2_create_max_height || ps_dec->u2_frame_width > ps_dec->u2_create_max_width)\n {\n return IMPEG2D_PIC_SIZE_NOT_SUPPORTED;\n }\n\n ps_dec->u2_num_flds_decoded = 0;\n\n /* Calculate the frame period */\n {\n UWORD32 numer;\n UWORD32 denom;\n numer = (UWORD32)gau2_impeg2_frm_rate_code[ps_dec->u2_frame_rate_code][1] *\n (UWORD32)(ps_dec->u2_frame_rate_extension_d + 1);\n\n denom = (UWORD32)gau2_impeg2_frm_rate_code[ps_dec->u2_frame_rate_code][0] *\n (UWORD32)(ps_dec->u2_frame_rate_extension_n + 1);\n ps_dec->u2_framePeriod = (numer * 1000 * 100) / denom;\n }\n\n\n if(VERTICAL_SCAN == ps_dec->u2_alternate_scan)\n {\n ps_dec->pu1_inv_scan_matrix = (UWORD8 *)gau1_impeg2_inv_scan_vertical;\n }\n else\n {\n ps_dec->pu1_inv_scan_matrix = (UWORD8 *)gau1_impeg2_inv_scan_zig_zag;\n }\n return (IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE;\n}\n", + "target": "IMPEG2D_ERROR_CODES_T impeg2d_init_video_state(dec_state_t *ps_dec, e_video_type_t e_video_type)\n{\n /*-----------------------------------------------------------------------*/\n /* Bit Stream that conforms to MPEG-1 standard */\n /*-----------------------------------------------------------------------*/\n if(e_video_type == MPEG_1_VIDEO)\n {\n ps_dec->u2_is_mpeg2 = 0;\n\n /*-------------------------------------------------------------------*/\n /* force MPEG-1 parameters for proper decoder behavior */\n /* see ISO/IEC 13818-2 section D.9.14 */\n /*-------------------------------------------------------------------*/\n ps_dec->u2_progressive_sequence = 1;\n ps_dec->u2_intra_dc_precision = 0;\n ps_dec->u2_picture_structure = FRAME_PICTURE;\n ps_dec->u2_frame_pred_frame_dct = 1;\n ps_dec->u2_concealment_motion_vectors = 0;\n ps_dec->u2_q_scale_type = 0;\n ps_dec->u2_intra_vlc_format = 0;\n ps_dec->u2_alternate_scan = 0;\n ps_dec->u2_repeat_first_field = 0;\n\n ps_dec->u2_progressive_frame = 1;\n ps_dec->u2_frame_rate_extension_n = 0;\n ps_dec->u2_frame_rate_extension_d = 0;\n ps_dec->u2_forw_f_code = 7;\n ps_dec->u2_back_f_code = 7;\n \n ps_dec->pf_vld_inv_quant = impeg2d_vld_inv_quant_mpeg1;\n /*-------------------------------------------------------------------*/\n /* Setting of parameters other than those mentioned in MPEG2 standard*/\n /* but used in decoding process. */\n /*-------------------------------------------------------------------*/\n }\n /*-----------------------------------------------------------------------*/\n /* Bit Stream that conforms to MPEG-2 */\n /*-----------------------------------------------------------------------*/\n else\n {\n ps_dec->u2_is_mpeg2 = 1;\n ps_dec->u2_full_pel_forw_vector = 0;\n ps_dec->u2_forw_f_code = 7;\n ps_dec->u2_full_pel_back_vector = 0;\n ps_dec->u2_back_f_code = 7;\n ps_dec->pf_vld_inv_quant = impeg2d_vld_inv_quant_mpeg2;\n\n\n }\n\n\n impeg2d_init_function_ptr(ps_dec);\n\n /* Set the frame Width and frame Height */\n ps_dec->u2_frame_height = ALIGN16(ps_dec->u2_vertical_size);\n ps_dec->u2_frame_width = ALIGN16(ps_dec->u2_horizontal_size);\n ps_dec->u2_num_horiz_mb = (ps_dec->u2_horizontal_size + 15) >> 4;\n if (ps_dec->u2_frame_height > ps_dec->u2_create_max_height || ps_dec->u2_frame_width > ps_dec->u2_create_max_width)\n {\n return IMPEG2D_PIC_SIZE_NOT_SUPPORTED;\n }\n\n ps_dec->u2_num_flds_decoded = 0;\n\n /* Calculate the frame period */\n {\n UWORD32 numer;\n UWORD32 denom;\n numer = (UWORD32)gau2_impeg2_frm_rate_code[ps_dec->u2_frame_rate_code][1] *\n (UWORD32)(ps_dec->u2_frame_rate_extension_d + 1);\n\n denom = (UWORD32)gau2_impeg2_frm_rate_code[ps_dec->u2_frame_rate_code][0] *\n (UWORD32)(ps_dec->u2_frame_rate_extension_n + 1);\n ps_dec->u2_framePeriod = (numer * 1000 * 100) / denom;\n }\n\n\n if(VERTICAL_SCAN == ps_dec->u2_alternate_scan)\n {\n ps_dec->pu1_inv_scan_matrix = (UWORD8 *)gau1_impeg2_inv_scan_vertical;\n }\n else\n {\n ps_dec->pu1_inv_scan_matrix = (UWORD8 *)gau1_impeg2_inv_scan_zig_zag;\n }\n return (IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3fcd042d26d70856e826a42b5f93dc4854d80bf0", + "input": "do_ed_script (char const *inname, char const *outname,\n\t bool *outname_needs_removal, FILE *ofp)\n{\n static char const editor_program[] = EDITOR_PROGRAM;\n\n file_offset beginning_of_this_line;\n size_t chars_read;\n FILE *tmpfp = 0;\n char const *tmpname;\n int tmpfd;\n pid_t pid;\n\n if (! dry_run && ! skip_rest_of_patch)\n {\n\t/* Write ed script to a temporary file. This causes ed to abort on\n\t invalid commands such as when line numbers or ranges exceed the\n\t number of available lines. When ed reads from a pipe, it rejects\n\t invalid commands and treats the next line as a new command, which\n\t can lead to arbitrary command execution. */\n\n\ttmpfd = make_tempfile (&tmpname, 'e', NULL, O_RDWR | O_BINARY, 0);\n\tif (tmpfd == -1)\n\t pfatal (\"Can't create temporary file %s\", quotearg (tmpname));\n\ttmpfp = fdopen (tmpfd, \"w+b\");\n\tif (! tmpfp)\n\t pfatal (\"Can't open stream for file %s\", quotearg (tmpname));\n }\n\n for (;;) {\n\tchar ed_command_letter;\n\tbeginning_of_this_line = file_tell (pfp);\n\tchars_read = get_line ();\n\tif (! chars_read) {\n\t next_intuit_at(beginning_of_this_line,p_input_line);\n\t break;\n\t}\n\ted_command_letter = get_ed_command_letter (buf);\n\tif (ed_command_letter) {\n\t if (tmpfp)\n\t\tif (! fwrite (buf, sizeof *buf, chars_read, tmpfp))\n\t\t write_fatal ();\n\t if (ed_command_letter != 'd' && ed_command_letter != 's') {\n\t p_pass_comments_through = true;\n\t\twhile ((chars_read = get_line ()) != 0) {\n\t\t if (tmpfp)\n\t\t\tif (! fwrite (buf, sizeof *buf, chars_read, tmpfp))\n\t\t\t write_fatal ();\n\t\t if (chars_read == 2 && strEQ (buf, \".\\n\"))\n\t\t\tbreak;\n\t\t}\n\t\tp_pass_comments_through = false;\n\t }\n\t}\n\telse {\n\t next_intuit_at(beginning_of_this_line,p_input_line);\n\t break;\n\t}\n }\n if (!tmpfp)\n return;\n if (fwrite (\"w\\nq\\n\", sizeof (char), (size_t) 4, tmpfp) == 0\n\t|| fflush (tmpfp) != 0)\n write_fatal ();\n\n if (lseek (tmpfd, 0, SEEK_SET) == -1)\n pfatal (\"Can't rewind to the beginning of file %s\", quotearg (tmpname));\n\n if (! dry_run && ! skip_rest_of_patch) {\n\tint exclusive = *outname_needs_removal ? 0 : O_EXCL;\n\t*outname_needs_removal = true;\n\tif (inerrno != ENOENT)\n\t {\n \t *outname_needs_removal = true;\n \t copy_file (inname, outname, 0, exclusive, instat.st_mode, true);\n \t }\n\tsprintf (buf, \"%s %s%s\", editor_program,\n\t\t verbosity == VERBOSE ? \"\" : \"- \",\n\t\t outname);\n \tfflush (stdout);\n \n \tpid = fork();\n\tfflush (stdout);\n\n \telse if (pid == 0)\n \t {\n \t dup2 (tmpfd, 0);\n\t execl (\"/bin/sh\", \"sh\", \"-c\", buf, (char *) 0);\n \t _exit (2);\n \t }\n \telse\n\t }\n\telse\n\t {\n\t int wstatus;\n\t if (waitpid (pid, &wstatus, 0) == -1\n\t || ! WIFEXITED (wstatus)\n\t\t|| WEXITSTATUS (wstatus) != 0)\n\t fatal (\"%s FAILED\", editor_program);\n\t }\n }\n", + "target": "do_ed_script (char const *inname, char const *outname,\n\t bool *outname_needs_removal, FILE *ofp)\n{\n static char const editor_program[] = EDITOR_PROGRAM;\n\n file_offset beginning_of_this_line;\n size_t chars_read;\n FILE *tmpfp = 0;\n char const *tmpname;\n int tmpfd;\n pid_t pid;\n\n if (! dry_run && ! skip_rest_of_patch)\n {\n\t/* Write ed script to a temporary file. This causes ed to abort on\n\t invalid commands such as when line numbers or ranges exceed the\n\t number of available lines. When ed reads from a pipe, it rejects\n\t invalid commands and treats the next line as a new command, which\n\t can lead to arbitrary command execution. */\n\n\ttmpfd = make_tempfile (&tmpname, 'e', NULL, O_RDWR | O_BINARY, 0);\n\tif (tmpfd == -1)\n\t pfatal (\"Can't create temporary file %s\", quotearg (tmpname));\n\ttmpfp = fdopen (tmpfd, \"w+b\");\n\tif (! tmpfp)\n\t pfatal (\"Can't open stream for file %s\", quotearg (tmpname));\n }\n\n for (;;) {\n\tchar ed_command_letter;\n\tbeginning_of_this_line = file_tell (pfp);\n\tchars_read = get_line ();\n\tif (! chars_read) {\n\t next_intuit_at(beginning_of_this_line,p_input_line);\n\t break;\n\t}\n\ted_command_letter = get_ed_command_letter (buf);\n\tif (ed_command_letter) {\n\t if (tmpfp)\n\t\tif (! fwrite (buf, sizeof *buf, chars_read, tmpfp))\n\t\t write_fatal ();\n\t if (ed_command_letter != 'd' && ed_command_letter != 's') {\n\t p_pass_comments_through = true;\n\t\twhile ((chars_read = get_line ()) != 0) {\n\t\t if (tmpfp)\n\t\t\tif (! fwrite (buf, sizeof *buf, chars_read, tmpfp))\n\t\t\t write_fatal ();\n\t\t if (chars_read == 2 && strEQ (buf, \".\\n\"))\n\t\t\tbreak;\n\t\t}\n\t\tp_pass_comments_through = false;\n\t }\n\t}\n\telse {\n\t next_intuit_at(beginning_of_this_line,p_input_line);\n\t break;\n\t}\n }\n if (!tmpfp)\n return;\n if (fwrite (\"w\\nq\\n\", sizeof (char), (size_t) 4, tmpfp) == 0\n\t|| fflush (tmpfp) != 0)\n write_fatal ();\n\n if (lseek (tmpfd, 0, SEEK_SET) == -1)\n pfatal (\"Can't rewind to the beginning of file %s\", quotearg (tmpname));\n\n if (! dry_run && ! skip_rest_of_patch) {\n\tint exclusive = *outname_needs_removal ? 0 : O_EXCL;\n\t*outname_needs_removal = true;\n\tif (inerrno != ENOENT)\n\t {\n \t *outname_needs_removal = true;\n \t copy_file (inname, outname, 0, exclusive, instat.st_mode, true);\n \t }\n \tfflush (stdout);\n \n \tpid = fork();\n\tfflush (stdout);\n\n \telse if (pid == 0)\n \t {\n \t dup2 (tmpfd, 0);\n\t assert (outname[0] != '!' && outname[0] != '-');\n\t execlp (editor_program, editor_program, \"-\", outname, (char *) NULL);\n \t _exit (2);\n \t }\n \telse\n\t }\n\telse\n\t {\n\t int wstatus;\n\t if (waitpid (pid, &wstatus, 0) == -1\n\t || ! WIFEXITED (wstatus)\n\t\t|| WEXITSTATUS (wstatus) != 0)\n\t fatal (\"%s FAILED\", editor_program);\n\t }\n }\n", + "vul_type": "cwe-78", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#db93178bcaaf7e99ebb18bd51fa99b2feaf47e1f", + "input": "void AppListControllerDelegate::DoShowAppInfoFlow(\n Profile* profile,\n const std::string& extension_id) {\n DCHECK(CanDoShowAppInfoFlow());\n ExtensionService* service =\n extensions::ExtensionSystem::Get(profile)->extension_service();\n DCHECK(service);\n const extensions::Extension* extension = service->GetInstalledExtension(\n extension_id);\n DCHECK(extension);\n \n OnShowChildDialog();\n\n UMA_HISTOGRAM_ENUMERATION(\"Apps.AppInfoDialog.Launches\",\n AppInfoLaunchSource::FROM_APP_LIST,\n AppInfoLaunchSource::NUM_LAUNCH_SOURCES);\n\n ShowAppInfoInAppList(\n GetAppListWindow(),\n GetAppListBounds(),\n profile,\n extension,\n base::Bind(&AppListControllerDelegate::OnCloseChildDialog,\n base::Unretained(this)));\n}\n", + "target": "void AppListControllerDelegate::DoShowAppInfoFlow(\n Profile* profile,\n const std::string& extension_id) {\n DCHECK(CanDoShowAppInfoFlow());\n const extensions::Extension* extension = GetExtension(profile, extension_id);\n DCHECK(extension);\n \n OnShowChildDialog();\n\n UMA_HISTOGRAM_ENUMERATION(\"Apps.AppInfoDialog.Launches\",\n AppInfoLaunchSource::FROM_APP_LIST,\n AppInfoLaunchSource::NUM_LAUNCH_SOURCES);\n\n ShowAppInfoInAppList(\n GetAppListWindow(),\n GetAppListBounds(),\n profile,\n extension,\n base::Bind(&AppListControllerDelegate::OnCloseChildDialog,\n base::Unretained(this)));\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0558f33c06bb910e2879e355192227a8e8f0219d", + "input": "static void sas_destruct_devices(struct work_struct *work)\n {\n \tstruct domain_device *dev, *n;\n\tstruct sas_discovery_event *ev = to_sas_discovery_event(work);\n\tstruct asd_sas_port *port = ev->port;\n\tclear_bit(DISCE_DESTRUCT, &port->disc.pending);\n \n \tlist_for_each_entry_safe(dev, n, &port->destroy_list, disco_list_node) {\n \t\tlist_del_init(&dev->disco_list_node);\n\n\t\tsas_remove_children(&dev->rphy->dev);\n\t\tsas_rphy_delete(dev->rphy);\n\t\tsas_unregister_common_dev(port, dev);\n \t}\n }\n", + "target": "static void sas_destruct_devices(struct work_struct *work)\nvoid sas_destruct_devices(struct asd_sas_port *port)\n {\n \tstruct domain_device *dev, *n;\n \n \tlist_for_each_entry_safe(dev, n, &port->destroy_list, disco_list_node) {\n \t\tlist_del_init(&dev->disco_list_node);\n\n\t\tsas_remove_children(&dev->rphy->dev);\n\t\tsas_rphy_delete(dev->rphy);\n\t\tsas_unregister_common_dev(port, dev);\n \t}\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#aeea52da00d210587fb3ed895de3d5f2e0264c88", + "input": " extern \"C\" int EffectCreate(const effect_uuid_t *uuid,\n int32_t sessionId,\n int32_t ioId,\n effect_handle_t *pHandle){\n int ret;\n int i;\n int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);\n const effect_descriptor_t *desc;\n\n ALOGV(\"\\t\\nEffectCreate start\");\n\n if (pHandle == NULL || uuid == NULL){\n ALOGV(\"\\tLVM_ERROR : EffectCreate() called with NULL pointer\");\n return -EINVAL;\n }\n\n for (i = 0; i < length; i++) {\n desc = gDescriptors[i];\n if (memcmp(uuid, &desc->uuid, sizeof(effect_uuid_t))\n == 0) {\n ALOGV(\"\\tEffectCreate - UUID matched Reverb type %d, UUID = %x\", i, desc->uuid.timeLow);\n break;\n }\n }\n\n if (i == length) {\n return -ENOENT;\n }\n\n ReverbContext *pContext = new ReverbContext;\n\n pContext->itfe = &gReverbInterface;\n pContext->hInstance = NULL;\n\n pContext->auxiliary = false;\n if ((desc->flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY){\n pContext->auxiliary = true;\n ALOGV(\"\\tEffectCreate - AUX\");\n }else{\n ALOGV(\"\\tEffectCreate - INS\");\n }\n\n pContext->preset = false;\n if (memcmp(&desc->type, SL_IID_PRESETREVERB, sizeof(effect_uuid_t)) == 0) {\n pContext->preset = true;\n pContext->curPreset = REVERB_PRESET_LAST + 1;\n pContext->nextPreset = REVERB_DEFAULT_PRESET;\n ALOGV(\"\\tEffectCreate - PRESET\");\n }else{\n ALOGV(\"\\tEffectCreate - ENVIRONMENTAL\");\n }\n\n ALOGV(\"\\tEffectCreate - Calling Reverb_init\");\n ret = Reverb_init(pContext);\n\n if (ret < 0){\n ALOGV(\"\\tLVM_ERROR : EffectCreate() init failed\");\n delete pContext;\n return ret;\n }\n\n *pHandle = (effect_handle_t)pContext;\n\n #ifdef LVM_PCM\n pContext->PcmInPtr = NULL;\n pContext->PcmOutPtr = NULL;\n\n pContext->PcmInPtr = fopen(\"/data/tmp/reverb_pcm_in.pcm\", \"w\");\n pContext->PcmOutPtr = fopen(\"/data/tmp/reverb_pcm_out.pcm\", \"w\");\n\n if((pContext->PcmInPtr == NULL)||\n (pContext->PcmOutPtr == NULL)){\n return -EINVAL;\n }\n #endif\n\n\n pContext->InFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);\n pContext->OutFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);\n\n ALOGV(\"\\tEffectCreate %p, size %zu\", pContext, sizeof(ReverbContext));\n ALOGV(\"\\tEffectCreate end\\n\");\n return 0;\n} /* end EffectCreate */\n", + "target": " extern \"C\" int EffectCreate(const effect_uuid_t *uuid,\n int32_t sessionId __unused,\n int32_t ioId __unused,\n effect_handle_t *pHandle){\n int ret;\n int i;\n int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);\n const effect_descriptor_t *desc;\n\n ALOGV(\"\\t\\nEffectCreate start\");\n\n if (pHandle == NULL || uuid == NULL){\n ALOGV(\"\\tLVM_ERROR : EffectCreate() called with NULL pointer\");\n return -EINVAL;\n }\n\n for (i = 0; i < length; i++) {\n desc = gDescriptors[i];\n if (memcmp(uuid, &desc->uuid, sizeof(effect_uuid_t))\n == 0) {\n ALOGV(\"\\tEffectCreate - UUID matched Reverb type %d, UUID = %x\", i, desc->uuid.timeLow);\n break;\n }\n }\n\n if (i == length) {\n return -ENOENT;\n }\n\n ReverbContext *pContext = new ReverbContext;\n\n pContext->itfe = &gReverbInterface;\n pContext->hInstance = NULL;\n\n pContext->auxiliary = false;\n if ((desc->flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY){\n pContext->auxiliary = true;\n ALOGV(\"\\tEffectCreate - AUX\");\n }else{\n ALOGV(\"\\tEffectCreate - INS\");\n }\n\n pContext->preset = false;\n if (memcmp(&desc->type, SL_IID_PRESETREVERB, sizeof(effect_uuid_t)) == 0) {\n pContext->preset = true;\n pContext->curPreset = REVERB_PRESET_LAST + 1;\n pContext->nextPreset = REVERB_DEFAULT_PRESET;\n ALOGV(\"\\tEffectCreate - PRESET\");\n }else{\n ALOGV(\"\\tEffectCreate - ENVIRONMENTAL\");\n }\n\n ALOGV(\"\\tEffectCreate - Calling Reverb_init\");\n ret = Reverb_init(pContext);\n\n if (ret < 0){\n ALOGV(\"\\tLVM_ERROR : EffectCreate() init failed\");\n delete pContext;\n return ret;\n }\n\n *pHandle = (effect_handle_t)pContext;\n\n #ifdef LVM_PCM\n pContext->PcmInPtr = NULL;\n pContext->PcmOutPtr = NULL;\n\n pContext->PcmInPtr = fopen(\"/data/tmp/reverb_pcm_in.pcm\", \"w\");\n pContext->PcmOutPtr = fopen(\"/data/tmp/reverb_pcm_out.pcm\", \"w\");\n\n if((pContext->PcmInPtr == NULL)||\n (pContext->PcmOutPtr == NULL)){\n return -EINVAL;\n }\n #endif\n\n\n pContext->InFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);\n pContext->OutFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);\n\n ALOGV(\"\\tEffectCreate %p, size %zu\", pContext, sizeof(ReverbContext));\n ALOGV(\"\\tEffectCreate end\\n\");\n return 0;\n} /* end EffectCreate */\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b5a663aa426f4884c71cd8580adae73f33570f0d", + "input": "static int snd_timer_start_slave(struct snd_timer_instance *timeri)\n{\n\tunsigned long flags;\n \n \tspin_lock_irqsave(&slave_active_lock, flags);\n \ttimeri->flags |= SNDRV_TIMER_IFLG_RUNNING;\n\tif (timeri->master)\n \t\tlist_add_tail(&timeri->active_list,\n \t\t\t &timeri->master->slave_active_head);\n \tspin_unlock_irqrestore(&slave_active_lock, flags);\n \treturn 1; /* delayed start */\n }\n", + "target": "static int snd_timer_start_slave(struct snd_timer_instance *timeri)\n{\n\tunsigned long flags;\n \n \tspin_lock_irqsave(&slave_active_lock, flags);\n \ttimeri->flags |= SNDRV_TIMER_IFLG_RUNNING;\n\tif (timeri->master && timeri->timer) {\n\t\tspin_lock(&timeri->timer->lock);\n \t\tlist_add_tail(&timeri->active_list,\n \t\t\t &timeri->master->slave_active_head);\n\t\tspin_unlock(&timeri->timer->lock);\n\t}\n \tspin_unlock_irqrestore(&slave_active_lock, flags);\n \treturn 1; /* delayed start */\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c0569cc04741cccf6548c2169fcc1609d958523f", + "input": " RenderFrameObserverNatives::RenderFrameObserverNatives(ScriptContext* context)\n : ObjectBackedNativeHandler(context), weak_ptr_factory_(this) {\n RouteFunction(\n \"OnDocumentElementCreated\",\n base::Bind(&RenderFrameObserverNatives::OnDocumentElementCreated,\n base::Unretained(this)));\n }\n", + "target": " RenderFrameObserverNatives::RenderFrameObserverNatives(ScriptContext* context)\n : ObjectBackedNativeHandler(context), weak_ptr_factory_(this) {\n RouteFunction(\n \"OnDocumentElementCreated\", \"app.window\",\n base::Bind(&RenderFrameObserverNatives::OnDocumentElementCreated,\n base::Unretained(this)));\n }\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#905ad269c55fc62bee3da29f7b1d1efeba8aa1e1", + "input": " void pid_ns_release_proc(struct pid_namespace *ns)\n {\n\tmntput(ns->proc_mnt);\n }\n", + "target": " void pid_ns_release_proc(struct pid_namespace *ns)\n {\n\tkern_unmount(ns->proc_mnt);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7fa3f552a6f34ed05c15e64ea30b8eed53f77a41", + "input": "status_t SampleTable::setSyncSampleParams(off64_t data_offset, size_t data_size) {\n if (mSyncSampleOffset >= 0 || data_size < 8) {\n return ERROR_MALFORMED;\n }\n\n uint8_t header[8];\n if (mDataSource->readAt(\n data_offset, header, sizeof(header)) < (ssize_t)sizeof(header)) {\n return ERROR_IO;\n }\n\n if (U32_AT(header) != 0) {\n return ERROR_MALFORMED;\n }\n\n uint32_t numSyncSamples = U32_AT(&header[4]);\n\n if (numSyncSamples < 2) {\n ALOGV(\"Table of sync samples is empty or has only a single entry!\");\n }\n\n uint64_t allocSize = (uint64_t)numSyncSamples * sizeof(uint32_t);\n if (allocSize > kMaxTotalSize) {\n ALOGE(\"Sync sample table size too large.\");\n return ERROR_OUT_OF_RANGE;\n }\n\n mTotalSize += allocSize;\n if (mTotalSize > kMaxTotalSize) {\n ALOGE(\"Sync sample table size would make sample table too large.\\n\"\n \" Requested sync sample table size = %llu\\n\"\n \" Eventual sample table size >= %llu\\n\"\n \" Allowed sample table size = %llu\\n\",\n (unsigned long long)allocSize,\n (unsigned long long)mTotalSize,\n (unsigned long long)kMaxTotalSize);\n return ERROR_OUT_OF_RANGE;\n }\n\n mSyncSamples = new (std::nothrow) uint32_t[numSyncSamples];\n if (!mSyncSamples) {\n ALOGE(\"Cannot allocate sync sample table with %llu entries.\",\n (unsigned long long)numSyncSamples);\n return ERROR_OUT_OF_RANGE;\n }\n\n \n if (mDataSource->readAt(data_offset + 8, mSyncSamples,\n (size_t)allocSize) != (ssize_t)allocSize) {\n delete mSyncSamples;\n mSyncSamples = NULL;\n return ERROR_IO;\n }\n\n for (size_t i = 0; i < numSyncSamples; ++i) {\n if (mSyncSamples[i] == 0) {\n ALOGE(\"b/32423862, unexpected zero value in stss\");\n continue;\n }\n mSyncSamples[i] = ntohl(mSyncSamples[i]) - 1;\n }\n\n mSyncSampleOffset = data_offset;\n mNumSyncSamples = numSyncSamples;\n\n return OK;\n}\n", + "target": "status_t SampleTable::setSyncSampleParams(off64_t data_offset, size_t data_size) {\n if (mSyncSampleOffset >= 0 || data_size < 8) {\n return ERROR_MALFORMED;\n }\n\n uint8_t header[8];\n if (mDataSource->readAt(\n data_offset, header, sizeof(header)) < (ssize_t)sizeof(header)) {\n return ERROR_IO;\n }\n\n if (U32_AT(header) != 0) {\n return ERROR_MALFORMED;\n }\n\n uint32_t numSyncSamples = U32_AT(&header[4]);\n\n if (numSyncSamples < 2) {\n ALOGV(\"Table of sync samples is empty or has only a single entry!\");\n }\n\n uint64_t allocSize = (uint64_t)numSyncSamples * sizeof(uint32_t);\n if (allocSize > kMaxTotalSize) {\n ALOGE(\"Sync sample table size too large.\");\n return ERROR_OUT_OF_RANGE;\n }\n\n mTotalSize += allocSize;\n if (mTotalSize > kMaxTotalSize) {\n ALOGE(\"Sync sample table size would make sample table too large.\\n\"\n \" Requested sync sample table size = %llu\\n\"\n \" Eventual sample table size >= %llu\\n\"\n \" Allowed sample table size = %llu\\n\",\n (unsigned long long)allocSize,\n (unsigned long long)mTotalSize,\n (unsigned long long)kMaxTotalSize);\n return ERROR_OUT_OF_RANGE;\n }\n\n mSyncSamples = new (std::nothrow) uint32_t[numSyncSamples];\n if (!mSyncSamples) {\n ALOGE(\"Cannot allocate sync sample table with %llu entries.\",\n (unsigned long long)numSyncSamples);\n return ERROR_OUT_OF_RANGE;\n }\n\n \n if (mDataSource->readAt(data_offset + 8, mSyncSamples,\n (size_t)allocSize) != (ssize_t)allocSize) {\n delete[] mSyncSamples;\n mSyncSamples = NULL;\n return ERROR_IO;\n }\n\n for (size_t i = 0; i < numSyncSamples; ++i) {\n if (mSyncSamples[i] == 0) {\n ALOGE(\"b/32423862, unexpected zero value in stss\");\n continue;\n }\n mSyncSamples[i] = ntohl(mSyncSamples[i]) - 1;\n }\n\n mSyncSampleOffset = data_offset;\n mNumSyncSamples = numSyncSamples;\n\n return OK;\n}\n", + "vul_type": "cwe-772", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8a50f99c25fb70ff43aaa82b6f9569db383f0ca8", + "input": "void InvalidationNotifier::UpdateCredentials(\n const std::string& email, const std::string& token) {\n if (state_ == STOPPED) {\n invalidation_client_.Start(\n invalidation_client_id_, client_info_, invalidation_state_,\n initial_max_invalidation_versions_,\n invalidation_state_tracker_,\n this);\n invalidation_state_.clear();\n state_ = STARTED;\n }\n invalidation_client_.UpdateCredentials(email, token);\n}\n", + "target": "void InvalidationNotifier::UpdateCredentials(\n const std::string& email, const std::string& token) {\n if (state_ == STOPPED) {\n invalidation_client_.Start(\n base::Bind(&invalidation::CreateInvalidationClient),\n invalidation_client_id_, client_info_, invalidation_state_,\n initial_max_invalidation_versions_,\n invalidation_state_tracker_,\n this);\n invalidation_state_.clear();\n state_ = STARTED;\n }\n invalidation_client_.UpdateCredentials(email, token);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#564f7cc2a51dcd2f28ab12a13394f31be5aa3c93", + "input": "init_remote_listener(int port, gboolean encrypted)\n{\n int rc;\n int *ssock = NULL;\n struct sockaddr_in saddr;\n int optval;\n static struct mainloop_fd_callbacks remote_listen_fd_callbacks = \n {\n .dispatch = cib_remote_listen,\n .destroy = remote_connection_destroy,\n };\n\n if (port <= 0) {\n /* dont start it */\n return 0;\n }\n\n if (encrypted) {\n#ifndef HAVE_GNUTLS_GNUTLS_H\n crm_warn(\"TLS support is not available\");\n return 0;\n #else\n crm_notice(\"Starting a tls listener on port %d.\", port);\n gnutls_global_init();\n/* \tgnutls_global_set_log_level (10); */\n gnutls_global_set_log_function(debug_log);\n gnutls_dh_params_init(&dh_params);\n gnutls_dh_params_generate2(dh_params, DH_BITS);\n gnutls_anon_allocate_server_credentials(&anon_cred_s);\n gnutls_anon_set_server_dh_params(anon_cred_s, dh_params);\n#endif\n } else {\n crm_warn(\"Starting a plain_text listener on port %d.\", port);\n }\n#ifndef HAVE_PAM\n crm_warn(\"PAM is _not_ enabled!\");\n#endif\n\n /* create server socket */\n ssock = malloc(sizeof(int));\n *ssock = socket(AF_INET, SOCK_STREAM, 0);\n if (*ssock == -1) {\n crm_perror(LOG_ERR, \"Can not create server socket.\" ERROR_SUFFIX);\n free(ssock);\n return -1;\n }\n\n /* reuse address */\n optval = 1;\n rc = setsockopt(*ssock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));\n if(rc < 0) {\n crm_perror(LOG_INFO, \"Couldn't allow the reuse of local addresses by our remote listener\");\n }\n\n /* bind server socket */\n memset(&saddr, '\\0', sizeof(saddr));\n saddr.sin_family = AF_INET;\n saddr.sin_addr.s_addr = INADDR_ANY;\n saddr.sin_port = htons(port);\n if (bind(*ssock, (struct sockaddr *)&saddr, sizeof(saddr)) == -1) {\n crm_perror(LOG_ERR, \"Can not bind server socket.\" ERROR_SUFFIX);\n close(*ssock);\n free(ssock);\n return -2;\n }\n if (listen(*ssock, 10) == -1) {\n crm_perror(LOG_ERR, \"Can not start listen.\" ERROR_SUFFIX);\n close(*ssock);\n free(ssock);\n return -3;\n }\n\n mainloop_add_fd(\"cib-remote\", G_PRIORITY_DEFAULT, *ssock, ssock, &remote_listen_fd_callbacks);\n\n return *ssock;\n}\n", + "target": "init_remote_listener(int port, gboolean encrypted)\n{\n int rc;\n int *ssock = NULL;\n struct sockaddr_in saddr;\n int optval;\n static struct mainloop_fd_callbacks remote_listen_fd_callbacks = \n {\n .dispatch = cib_remote_listen,\n .destroy = remote_connection_destroy,\n };\n\n if (port <= 0) {\n /* dont start it */\n return 0;\n }\n\n if (encrypted) {\n#ifndef HAVE_GNUTLS_GNUTLS_H\n crm_warn(\"TLS support is not available\");\n return 0;\n #else\n crm_notice(\"Starting a tls listener on port %d.\", port);\n gnutls_global_init();\n /* gnutls_global_set_log_level (10); */\n gnutls_global_set_log_function(debug_log);\n gnutls_dh_params_init(&dh_params);\n gnutls_dh_params_generate2(dh_params, DH_BITS);\n gnutls_anon_allocate_server_credentials(&anon_cred_s);\n gnutls_anon_set_server_dh_params(anon_cred_s, dh_params);\n#endif\n } else {\n crm_warn(\"Starting a plain_text listener on port %d.\", port);\n }\n#ifndef HAVE_PAM\n crm_warn(\"PAM is _not_ enabled!\");\n#endif\n\n /* create server socket */\n ssock = malloc(sizeof(int));\n *ssock = socket(AF_INET, SOCK_STREAM, 0);\n if (*ssock == -1) {\n crm_perror(LOG_ERR, \"Can not create server socket.\" ERROR_SUFFIX);\n free(ssock);\n return -1;\n }\n\n /* reuse address */\n optval = 1;\n rc = setsockopt(*ssock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));\n if(rc < 0) {\n crm_perror(LOG_INFO, \"Couldn't allow the reuse of local addresses by our remote listener\");\n }\n\n /* bind server socket */\n memset(&saddr, '\\0', sizeof(saddr));\n saddr.sin_family = AF_INET;\n saddr.sin_addr.s_addr = INADDR_ANY;\n saddr.sin_port = htons(port);\n if (bind(*ssock, (struct sockaddr *)&saddr, sizeof(saddr)) == -1) {\n crm_perror(LOG_ERR, \"Can not bind server socket.\" ERROR_SUFFIX);\n close(*ssock);\n free(ssock);\n return -2;\n }\n if (listen(*ssock, 10) == -1) {\n crm_perror(LOG_ERR, \"Can not start listen.\" ERROR_SUFFIX);\n close(*ssock);\n free(ssock);\n return -3;\n }\n\n mainloop_add_fd(\"cib-remote\", G_PRIORITY_DEFAULT, *ssock, ssock, &remote_listen_fd_callbacks);\n\n return *ssock;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6cbd34025e5fd3ba47b29b602096e456507ce83b", + "input": "void PSIR_FileWriter::ParseFileResources ( XMP_IO* fileRef, XMP_Uns32 length )\n{\n\t\n\t\n\n\tstatic const size_t kMinPSIRSize = 12;\t// 4+2+1+1+4\n\t\n\tthis->DeleteExistingInfo();\n\tthis->fileParsed = true;\n\tif ( length == 0 ) return;\n\n\tXMP_Int64 psirOrigin = fileRef->Offset();\t// Need this to determine the resource data offsets.\n\tXMP_Int64 fileEnd = psirOrigin + length;\n\n\tchar nameBuffer [260];\t// The name is a PString, at 1+255+1 including length and pad.\n\n\twhile ( fileRef->Offset() < fileEnd ) {\n\n\t\tif ( ! XIO::CheckFileSpace ( fileRef, kMinPSIRSize ) ) break;\t// Bad image resource.\n\n\t\tXMP_Int64 thisRsrcPos = fileRef->Offset();\n\n\t\tXMP_Uns32 type = XIO::ReadUns32_BE ( fileRef );\n\t\tXMP_Uns16 id = XIO::ReadUns16_BE ( fileRef );\n\n\t\tXMP_Uns8 nameLen = XIO::ReadUns8 ( fileRef );\t// ! The length for the Pascal string.\n\t\tXMP_Uns16 paddedLen = (nameLen + 2) & 0xFFFE;\t// ! Round up to an even total. Yes, +2!\n\t\tif ( ! XIO::CheckFileSpace ( fileRef, paddedLen+4 ) ) break;\t// Bad image resource.\n\n\t\tnameBuffer[0] = nameLen;\n\t\tfileRef->ReadAll ( &nameBuffer[1], paddedLen-1 );\t// Include the pad byte, present for zero nameLen.\n \n \t\tXMP_Uns32 dataLen = XIO::ReadUns32_BE ( fileRef );\n \t\tXMP_Uns32 dataTotal = ((dataLen + 1) & 0xFFFFFFFEUL);\t// Round up to an even total.\n \t\tif ( ! XIO::CheckFileSpace ( fileRef, dataTotal ) ) break;\t// Bad image resource.\n \n \t\tXMP_Int64 thisDataPos = fileRef->Offset();\n\t\t\tcontinue;\n\t\t}\n\n\t\tInternalRsrcInfo newInfo ( id, dataLen, kIsFileBased );\n\t\tInternalRsrcMap::iterator rsrcPos = this->imgRsrcs.find ( id );\n\t\tif ( rsrcPos == this->imgRsrcs.end() ) {\n\t\t\trsrcPos = this->imgRsrcs.insert ( rsrcPos, InternalRsrcMap::value_type ( id, newInfo ) );\n\t\t} else if ( (rsrcPos->second.dataLen == 0) && (newInfo.dataLen != 0) ) {\n\t\t\trsrcPos->second = newInfo;\n\t\t} else {\n\t\t\tfileRef->Seek ( nextRsrcPos, kXMP_SeekFromStart );\n\t\t\tcontinue;\n\t\t}\n\t\tInternalRsrcInfo* rsrcPtr = &rsrcPos->second;\n\n\t\trsrcPtr->origOffset = (XMP_Uns32)thisDataPos;\n\n\t\tif ( nameLen > 0 ) {\n\t\t\trsrcPtr->rsrcName = (XMP_Uns8*) malloc ( paddedLen );\n\t\t\tif ( rsrcPtr->rsrcName == 0 ) XMP_Throw ( \"Out of memory\", kXMPErr_NoMemory );\n\t\t\tmemcpy ( (void*)rsrcPtr->rsrcName, nameBuffer, paddedLen );\t// AUDIT: Safe, allocated enough bytes above.\n\t\t}\n\n\t\tif ( ! IsMetadataImgRsrc ( id ) ) {\n\t\t\tfileRef->Seek ( nextRsrcPos, kXMP_SeekFromStart );\n\t\t\tcontinue;\n\t\t}\n\n\t\trsrcPtr->dataPtr = malloc ( dataTotal );\t// ! Allocate after the IsMetadataImgRsrc check.\n\t\tif ( rsrcPtr->dataPtr == 0 ) XMP_Throw ( \"Out of memory\", kXMPErr_NoMemory );\n\t\tfileRef->ReadAll ( (void*)rsrcPtr->dataPtr, dataTotal );\n\n\t}\n", + "target": "void PSIR_FileWriter::ParseFileResources ( XMP_IO* fileRef, XMP_Uns32 length )\n{\n\t\n\t\n\n\tstatic const size_t kMinPSIRSize = 12;\t// 4+2+1+1+4\n\t\n\tthis->DeleteExistingInfo();\n\tthis->fileParsed = true;\n\tif ( length == 0 ) return;\n\n\tXMP_Int64 psirOrigin = fileRef->Offset();\t// Need this to determine the resource data offsets.\n\tXMP_Int64 fileEnd = psirOrigin + length;\n\n\tchar nameBuffer [260];\t// The name is a PString, at 1+255+1 including length and pad.\n\n\twhile ( fileRef->Offset() < fileEnd ) {\n\n\t\tif ( ! XIO::CheckFileSpace ( fileRef, kMinPSIRSize ) ) break;\t// Bad image resource.\n\n\t\tXMP_Int64 thisRsrcPos = fileRef->Offset();\n\n\t\tXMP_Uns32 type = XIO::ReadUns32_BE ( fileRef );\n\t\tXMP_Uns16 id = XIO::ReadUns16_BE ( fileRef );\n\n\t\tXMP_Uns8 nameLen = XIO::ReadUns8 ( fileRef );\t// ! The length for the Pascal string.\n\t\tXMP_Uns16 paddedLen = (nameLen + 2) & 0xFFFE;\t// ! Round up to an even total. Yes, +2!\n\t\tif ( ! XIO::CheckFileSpace ( fileRef, paddedLen+4 ) ) break;\t// Bad image resource.\n\n\t\tnameBuffer[0] = nameLen;\n\t\tfileRef->ReadAll ( &nameBuffer[1], paddedLen-1 );\t// Include the pad byte, present for zero nameLen.\n \n \t\tXMP_Uns32 dataLen = XIO::ReadUns32_BE ( fileRef );\n \t\tXMP_Uns32 dataTotal = ((dataLen + 1) & 0xFFFFFFFEUL);\t// Round up to an even total.\n\t\t// See bug https://bugs.freedesktop.org/show_bug.cgi?id=105204\n\t\t// If dataLen is 0xffffffff, then dataTotal might be 0\n\t\t// and therefor make the CheckFileSpace test pass.\n\t\tif (dataTotal < dataLen) {\n\t\t\tbreak;\n\t\t}\n \t\tif ( ! XIO::CheckFileSpace ( fileRef, dataTotal ) ) break;\t// Bad image resource.\n \n \t\tXMP_Int64 thisDataPos = fileRef->Offset();\n\t\t\tcontinue;\n\t\t}\n\n\t\tInternalRsrcInfo newInfo ( id, dataLen, kIsFileBased );\n\t\tInternalRsrcMap::iterator rsrcPos = this->imgRsrcs.find ( id );\n\t\tif ( rsrcPos == this->imgRsrcs.end() ) {\n\t\t\trsrcPos = this->imgRsrcs.insert ( rsrcPos, InternalRsrcMap::value_type ( id, newInfo ) );\n\t\t} else if ( (rsrcPos->second.dataLen == 0) && (newInfo.dataLen != 0) ) {\n\t\t\trsrcPos->second = newInfo;\n\t\t} else {\n\t\t\tfileRef->Seek ( nextRsrcPos, kXMP_SeekFromStart );\n\t\t\tcontinue;\n\t\t}\n\t\tInternalRsrcInfo* rsrcPtr = &rsrcPos->second;\n\n\t\trsrcPtr->origOffset = (XMP_Uns32)thisDataPos;\n\n\t\tif ( nameLen > 0 ) {\n\t\t\trsrcPtr->rsrcName = (XMP_Uns8*) malloc ( paddedLen );\n\t\t\tif ( rsrcPtr->rsrcName == 0 ) XMP_Throw ( \"Out of memory\", kXMPErr_NoMemory );\n\t\t\tmemcpy ( (void*)rsrcPtr->rsrcName, nameBuffer, paddedLen );\t// AUDIT: Safe, allocated enough bytes above.\n\t\t}\n\n\t\tif ( ! IsMetadataImgRsrc ( id ) ) {\n\t\t\tfileRef->Seek ( nextRsrcPos, kXMP_SeekFromStart );\n\t\t\tcontinue;\n\t\t}\n\n\t\trsrcPtr->dataPtr = malloc ( dataTotal );\t// ! Allocate after the IsMetadataImgRsrc check.\n\t\tif ( rsrcPtr->dataPtr == 0 ) XMP_Throw ( \"Out of memory\", kXMPErr_NoMemory );\n\t\tfileRef->ReadAll ( (void*)rsrcPtr->dataPtr, dataTotal );\n\n\t}\n", + "vul_type": "cwe-125", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1c40f9042ae2d6ee7483d72998aabb5e73b2ff60", + "input": "void InspectorNetworkAgent::DidBlockRequest(\n ExecutionContext* execution_context,\n const ResourceRequest& request,\n DocumentLoader* loader,\n const FetchInitiatorInfo& initiator_info,\n ResourceRequestBlockedReason reason) {\n unsigned long identifier = CreateUniqueIdentifier();\n WillSendRequestInternal(execution_context, identifier, loader, request,\n ResourceResponse(), initiator_info);\n \n String request_id = IdentifiersFactory::RequestId(identifier);\n String protocol_reason = BuildBlockedReason(reason);\n GetFrontend()->loadingFailed(\n request_id, MonotonicallyIncreasingTime(),\n InspectorPageAgent::ResourceTypeJson(\n resources_data_->GetResourceType(request_id)),\n String(), false, protocol_reason);\n}\n", + "target": "void InspectorNetworkAgent::DidBlockRequest(\n ExecutionContext* execution_context,\n const ResourceRequest& request,\n DocumentLoader* loader,\n const FetchInitiatorInfo& initiator_info,\n ResourceRequestBlockedReason reason,\n Resource::Type resource_type) {\n unsigned long identifier = CreateUniqueIdentifier();\n InspectorPageAgent::ResourceType type =\n InspectorPageAgent::ToResourceType(resource_type);\n\n WillSendRequestInternal(execution_context, identifier, loader, request,\n ResourceResponse(), initiator_info, type);\n \n String request_id = IdentifiersFactory::RequestId(identifier);\n String protocol_reason = BuildBlockedReason(reason);\n GetFrontend()->loadingFailed(\n request_id, MonotonicallyIncreasingTime(),\n InspectorPageAgent::ResourceTypeJson(\n resources_data_->GetResourceType(request_id)),\n String(), false, protocol_reason);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b351eabb428c7ca85a34513c64601f437923d576", + "input": "status_t OMXNodeInstance::emptyBuffer(\n OMX::buffer_id buffer,\n OMX_U32 rangeOffset, OMX_U32 rangeLength,\n\n OMX_U32 flags, OMX_TICKS timestamp, int fenceFd) {\n Mutex::Autolock autoLock(mLock);\n \n OMX_BUFFERHEADERTYPE *header = findBufferHeader(buffer);\n BufferMeta *buffer_meta =\n static_cast(header->pAppPrivate);\n sp backup = buffer_meta->getBuffer(header, true /* backup */, false /* limit */);\n sp codec = buffer_meta->getBuffer(header, false /* backup */, false /* limit */);\n\n if (mMetadataType[kPortIndexInput] == kMetadataBufferTypeGrallocSource\n && backup->capacity() >= sizeof(VideoNativeMetadata)\n && codec->capacity() >= sizeof(VideoGrallocMetadata)\n && ((VideoNativeMetadata *)backup->base())->eType\n == kMetadataBufferTypeANWBuffer) {\n VideoNativeMetadata &backupMeta = *(VideoNativeMetadata *)backup->base();\n VideoGrallocMetadata &codecMeta = *(VideoGrallocMetadata *)codec->base();\n CLOG_BUFFER(emptyBuffer, \"converting ANWB %p to handle %p\",\n backupMeta.pBuffer, backupMeta.pBuffer->handle);\n codecMeta.pHandle = backupMeta.pBuffer != NULL ? backupMeta.pBuffer->handle : NULL;\n codecMeta.eType = kMetadataBufferTypeGrallocSource;\n header->nFilledLen = rangeLength ? sizeof(codecMeta) : 0;\n header->nOffset = 0;\n } else {\n if (rangeOffset > header->nAllocLen\n || rangeLength > header->nAllocLen - rangeOffset) {\n CLOG_ERROR(emptyBuffer, OMX_ErrorBadParameter, FULL_BUFFER(NULL, header, fenceFd));\n if (fenceFd >= 0) {\n ::close(fenceFd);\n }\n return BAD_VALUE;\n }\n header->nFilledLen = rangeLength;\n header->nOffset = rangeOffset;\n\n buffer_meta->CopyToOMX(header);\n }\n\n return emptyBuffer_l(header, flags, timestamp, (intptr_t)buffer, fenceFd);\n}\n", + "target": "status_t OMXNodeInstance::emptyBuffer(\n OMX::buffer_id buffer,\n OMX_U32 rangeOffset, OMX_U32 rangeLength,\n\n OMX_U32 flags, OMX_TICKS timestamp, int fenceFd) {\n Mutex::Autolock autoLock(mLock);\n \n OMX_BUFFERHEADERTYPE *header = findBufferHeader(buffer, kPortIndexInput);\n if (header == NULL) {\n return BAD_VALUE;\n }\n BufferMeta *buffer_meta =\n static_cast(header->pAppPrivate);\n sp backup = buffer_meta->getBuffer(header, true /* backup */, false /* limit */);\n sp codec = buffer_meta->getBuffer(header, false /* backup */, false /* limit */);\n\n if (mMetadataType[kPortIndexInput] == kMetadataBufferTypeGrallocSource\n && backup->capacity() >= sizeof(VideoNativeMetadata)\n && codec->capacity() >= sizeof(VideoGrallocMetadata)\n && ((VideoNativeMetadata *)backup->base())->eType\n == kMetadataBufferTypeANWBuffer) {\n VideoNativeMetadata &backupMeta = *(VideoNativeMetadata *)backup->base();\n VideoGrallocMetadata &codecMeta = *(VideoGrallocMetadata *)codec->base();\n CLOG_BUFFER(emptyBuffer, \"converting ANWB %p to handle %p\",\n backupMeta.pBuffer, backupMeta.pBuffer->handle);\n codecMeta.pHandle = backupMeta.pBuffer != NULL ? backupMeta.pBuffer->handle : NULL;\n codecMeta.eType = kMetadataBufferTypeGrallocSource;\n header->nFilledLen = rangeLength ? sizeof(codecMeta) : 0;\n header->nOffset = 0;\n } else {\n if (rangeOffset > header->nAllocLen\n || rangeLength > header->nAllocLen - rangeOffset) {\n CLOG_ERROR(emptyBuffer, OMX_ErrorBadParameter, FULL_BUFFER(NULL, header, fenceFd));\n if (fenceFd >= 0) {\n ::close(fenceFd);\n }\n return BAD_VALUE;\n }\n header->nFilledLen = rangeLength;\n header->nOffset = rangeOffset;\n\n buffer_meta->CopyToOMX(header);\n }\n\n return emptyBuffer_l(header, flags, timestamp, (intptr_t)buffer, fenceFd);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d42b2388f7f8e0332c846675133acea151fc557a", + "input": " jas_matrix_t *jas_seq2d_input(FILE *in)\n {\n \tjas_matrix_t *matrix;\n\tint i;\n\tint j;\n \tlong x;\n\tint numrows;\n\tint numcols;\n\tint xoff;\n\tint yoff;\n\tif (fscanf(in, \"%d %d\", &xoff, &yoff) != 2)\n \t\treturn 0;\n\tif (fscanf(in, \"%d %d\", &numcols, &numrows) != 2)\n \t\treturn 0;\n\tif (!(matrix = jas_seq2d_create(xoff, yoff, xoff + numcols, yoff + numrows)))\n \t\treturn 0;\n \n \tif (jas_matrix_numrows(matrix) != numrows ||\n \t jas_matrix_numcols(matrix) != numcols) {\n\t\tabort();\n\t}\n\n\t/* Get matrix data. */\n\tfor (i = 0; i < jas_matrix_numrows(matrix); i++) {\n\t\tfor (j = 0; j < jas_matrix_numcols(matrix); j++) {\n\t\t\tif (fscanf(in, \"%ld\", &x) != 1) {\n\t\t\t\tjas_matrix_destroy(matrix);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tjas_matrix_set(matrix, i, j, JAS_CAST(jas_seqent_t, x));\n\t\t}\n\t}\n\n\treturn matrix;\n}\n", + "target": " jas_matrix_t *jas_seq2d_input(FILE *in)\n {\n \tjas_matrix_t *matrix;\n\tjas_matind_t i;\n\tjas_matind_t j;\n \tlong x;\n\tjas_matind_t numrows;\n\tjas_matind_t numcols;\n\tjas_matind_t xoff;\n\tjas_matind_t yoff;\n\tlong tmp_xoff;\n\tlong tmp_yoff;\n\tlong tmp_numrows;\n\tlong tmp_numcols;\n\n\tif (fscanf(in, \"%ld %ld\", &tmp_xoff, &tmp_yoff) != 2) {\n \t\treturn 0;\n\t}\n\txoff = tmp_xoff;\n\tyoff = tmp_yoff;\n\tif (fscanf(in, \"%ld %ld\", &tmp_numcols, &tmp_numrows) != 2) {\n \t\treturn 0;\n\t}\n\tnumrows = tmp_numrows;\n\tnumcols = tmp_numcols;\n\tif (!(matrix = jas_seq2d_create(xoff, yoff, xoff + numcols,\n\t yoff + numrows))) {\n \t\treturn 0;\n\t}\n \n \tif (jas_matrix_numrows(matrix) != numrows ||\n \t jas_matrix_numcols(matrix) != numcols) {\n\t\tabort();\n\t}\n\n\t/* Get matrix data. */\n\tfor (i = 0; i < jas_matrix_numrows(matrix); i++) {\n\t\tfor (j = 0; j < jas_matrix_numcols(matrix); j++) {\n\t\t\tif (fscanf(in, \"%ld\", &x) != 1) {\n\t\t\t\tjas_matrix_destroy(matrix);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tjas_matrix_set(matrix, i, j, JAS_CAST(jas_seqent_t, x));\n\t\t}\n\t}\n\n\treturn matrix;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#12348a12a8b108baedee2ddbda99948029d363ed", + "input": "UseCounterPageLoadMetricsObserver::GetAllowedUkmFeatures() {\n static base::NoDestructor\n opt_in_features(std::initializer_list({\n WebFeature::kNavigatorVibrate,\n WebFeature::kNavigatorVibrateSubFrame,\n WebFeature::kTouchEventPreventedNoTouchAction,\n WebFeature::kTouchEventPreventedForcedDocumentPassiveNoTouchAction,\n WebFeature::kDataUriHasOctothorpe,\n WebFeature::kApplicationCacheManifestSelectInsecureOrigin,\n WebFeature::kApplicationCacheManifestSelectSecureOrigin,\n WebFeature::kMixedContentAudio,\n WebFeature::kMixedContentImage,\n WebFeature::kMixedContentVideo,\n WebFeature::kMixedContentPlugin,\n WebFeature::kOpenerNavigationWithoutGesture,\n WebFeature::kUsbRequestDevice,\n WebFeature::kXMLHttpRequestSynchronous,\n WebFeature::kPaymentHandler,\n WebFeature::kPaymentRequestShowWithoutGesture,\n WebFeature::kHTMLImports,\n WebFeature::kHTMLImportsHasStyleSheets,\n WebFeature::kElementCreateShadowRoot,\n WebFeature::kDocumentRegisterElement,\n WebFeature::kCredentialManagerCreatePublicKeyCredential,\n WebFeature::kCredentialManagerGetPublicKeyCredential,\n WebFeature::kCredentialManagerMakePublicKeyCredentialSuccess,\n WebFeature::kCredentialManagerGetPublicKeyCredentialSuccess,\n WebFeature::kV8AudioContext_Constructor,\n WebFeature::kElementAttachShadow,\n WebFeature::kElementAttachShadowOpen,\n WebFeature::kElementAttachShadowClosed,\n WebFeature::kCustomElementRegistryDefine,\n WebFeature::kTextToSpeech_Speak,\n WebFeature::kTextToSpeech_SpeakDisallowedByAutoplay,\n WebFeature::kCSSEnvironmentVariable,\n WebFeature::kCSSEnvironmentVariable_SafeAreaInsetTop,\n WebFeature::kCSSEnvironmentVariable_SafeAreaInsetLeft,\n WebFeature::kCSSEnvironmentVariable_SafeAreaInsetRight,\n WebFeature::kCSSEnvironmentVariable_SafeAreaInsetBottom,\n WebFeature::kMediaControlsDisplayCutoutGesture,\n WebFeature::kPolymerV1Detected,\n WebFeature::kPolymerV2Detected,\n WebFeature::kFullscreenSecureOrigin,\n WebFeature::kFullscreenInsecureOrigin,\n WebFeature::kPrefixedVideoEnterFullscreen,\n WebFeature::kPrefixedVideoExitFullscreen,\n WebFeature::kPrefixedVideoEnterFullScreen,\n WebFeature::kPrefixedVideoExitFullScreen,\n WebFeature::kDocumentLevelPassiveDefaultEventListenerPreventedWheel,\n WebFeature::kDocumentDomainBlockedCrossOriginAccess,\n WebFeature::kDocumentDomainEnabledCrossOriginAccess,\n WebFeature::kSuppressHistoryEntryWithoutUserGesture,\n WebFeature::kCursorImageGT32x32,\n WebFeature::kCursorImageLE32x32,\n WebFeature::kHistoryPushState,\n WebFeature::kHistoryReplaceState,\n WebFeature::kCursorImageGT64x64,\n WebFeature::kAdClick,\n WebFeature::kUpdateWithoutShippingOptionOnShippingAddressChange,\n WebFeature::kUpdateWithoutShippingOptionOnShippingOptionChange,\n WebFeature::kSignedExchangeInnerResponseInMainFrame,\n WebFeature::kSignedExchangeInnerResponseInSubFrame,\n WebFeature::kWebShareShare,\n WebFeature::kHTMLAnchorElementDownloadInSandboxWithUserGesture,\n WebFeature::kHTMLAnchorElementDownloadInSandboxWithoutUserGesture,\n WebFeature::kNavigationDownloadInSandboxWithUserGesture,\n WebFeature::kNavigationDownloadInSandboxWithoutUserGesture,\n WebFeature::kDownloadInAdFrameWithUserGesture,\n WebFeature::kDownloadInAdFrameWithoutUserGesture,\n WebFeature::kOpenWebDatabase,\n WebFeature::kV8MediaCapabilities_DecodingInfo_Method,\n }));\n return *opt_in_features;\n }\n", + "target": "UseCounterPageLoadMetricsObserver::GetAllowedUkmFeatures() {\n static base::NoDestructor\n opt_in_features(std::initializer_list({\n WebFeature::kNavigatorVibrate,\n WebFeature::kNavigatorVibrateSubFrame,\n WebFeature::kTouchEventPreventedNoTouchAction,\n WebFeature::kTouchEventPreventedForcedDocumentPassiveNoTouchAction,\n WebFeature::kDataUriHasOctothorpe,\n WebFeature::kApplicationCacheManifestSelectInsecureOrigin,\n WebFeature::kApplicationCacheManifestSelectSecureOrigin,\n WebFeature::kMixedContentAudio,\n WebFeature::kMixedContentImage,\n WebFeature::kMixedContentVideo,\n WebFeature::kMixedContentPlugin,\n WebFeature::kOpenerNavigationWithoutGesture,\n WebFeature::kUsbRequestDevice,\n WebFeature::kXMLHttpRequestSynchronous,\n WebFeature::kPaymentHandler,\n WebFeature::kPaymentRequestShowWithoutGesture,\n WebFeature::kHTMLImports,\n WebFeature::kHTMLImportsHasStyleSheets,\n WebFeature::kElementCreateShadowRoot,\n WebFeature::kDocumentRegisterElement,\n WebFeature::kCredentialManagerCreatePublicKeyCredential,\n WebFeature::kCredentialManagerGetPublicKeyCredential,\n WebFeature::kCredentialManagerMakePublicKeyCredentialSuccess,\n WebFeature::kCredentialManagerGetPublicKeyCredentialSuccess,\n WebFeature::kV8AudioContext_Constructor,\n WebFeature::kElementAttachShadow,\n WebFeature::kElementAttachShadowOpen,\n WebFeature::kElementAttachShadowClosed,\n WebFeature::kCustomElementRegistryDefine,\n WebFeature::kTextToSpeech_Speak,\n WebFeature::kTextToSpeech_SpeakDisallowedByAutoplay,\n WebFeature::kCSSEnvironmentVariable,\n WebFeature::kCSSEnvironmentVariable_SafeAreaInsetTop,\n WebFeature::kCSSEnvironmentVariable_SafeAreaInsetLeft,\n WebFeature::kCSSEnvironmentVariable_SafeAreaInsetRight,\n WebFeature::kCSSEnvironmentVariable_SafeAreaInsetBottom,\n WebFeature::kMediaControlsDisplayCutoutGesture,\n WebFeature::kPolymerV1Detected,\n WebFeature::kPolymerV2Detected,\n WebFeature::kFullscreenSecureOrigin,\n WebFeature::kFullscreenInsecureOrigin,\n WebFeature::kPrefixedVideoEnterFullscreen,\n WebFeature::kPrefixedVideoExitFullscreen,\n WebFeature::kPrefixedVideoEnterFullScreen,\n WebFeature::kPrefixedVideoExitFullScreen,\n WebFeature::kDocumentLevelPassiveDefaultEventListenerPreventedWheel,\n WebFeature::kDocumentDomainBlockedCrossOriginAccess,\n WebFeature::kDocumentDomainEnabledCrossOriginAccess,\n WebFeature::kSuppressHistoryEntryWithoutUserGesture,\n WebFeature::kCursorImageGT32x32,\n WebFeature::kCursorImageLE32x32,\n WebFeature::kHistoryPushState,\n WebFeature::kHistoryReplaceState,\n WebFeature::kCursorImageGT64x64,\n WebFeature::kAdClick,\n WebFeature::kUpdateWithoutShippingOptionOnShippingAddressChange,\n WebFeature::kUpdateWithoutShippingOptionOnShippingOptionChange,\n WebFeature::kSignedExchangeInnerResponseInMainFrame,\n WebFeature::kSignedExchangeInnerResponseInSubFrame,\n WebFeature::kWebShareShare,\n WebFeature::kHTMLAnchorElementDownloadInSandboxWithUserGesture,\n WebFeature::kHTMLAnchorElementDownloadInSandboxWithoutUserGesture,\n WebFeature::kNavigationDownloadInSandboxWithUserGesture,\n WebFeature::kNavigationDownloadInSandboxWithoutUserGesture,\n WebFeature::kDownloadInAdFrameWithUserGesture,\n WebFeature::kDownloadInAdFrameWithoutUserGesture,\n WebFeature::kOpenWebDatabase,\n WebFeature::kV8MediaCapabilities_DecodingInfo_Method,\n WebFeature::kOpenerNavigationDownloadCrossOriginNoGesture,\n }));\n return *opt_in_features;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#853bc26a7ea39e354b9f8889ae7ad1492ffa28d2", + "input": "static ssize_t o2nm_node_local_store(struct config_item *item, const char *page,\n \t\t\t\t size_t count)\n {\n \tstruct o2nm_node *node = to_o2nm_node(item);\n\tstruct o2nm_cluster *cluster = to_o2nm_cluster_from_node(node);\n \tunsigned long tmp;\n \tchar *p = (char *)page;\n \tssize_t ret;\n\n\ttmp = simple_strtoul(p, &p, 0);\n\tif (!p || (*p && (*p != '\\n')))\n\t\treturn -EINVAL;\n\n\ttmp = !!tmp; /* boolean of whether this node wants to be local */\n\n\t/* setting local turns on networking rx for now so we require having\n\t * set everything else first */\n\tif (!test_bit(O2NM_NODE_ATTR_ADDRESS, &node->nd_set_attributes) ||\n\t !test_bit(O2NM_NODE_ATTR_NUM, &node->nd_set_attributes) ||\n \t !test_bit(O2NM_NODE_ATTR_PORT, &node->nd_set_attributes))\n \t\treturn -EINVAL; /* XXX */\n \n \t/* the only failure case is trying to set a new local node\n \t * when a different one is already set */\n \tif (tmp && tmp == cluster->cl_has_local &&\n\t cluster->cl_local_node != node->nd_num)\n\t\treturn -EBUSY;\n \n \t/* bring up the rx thread if we're setting the new local node. */\n \tif (tmp && !cluster->cl_has_local) {\n \t\tret = o2net_start_listening(node);\n \t\tif (ret)\n\t\t\treturn ret;\n \t}\n \n \tif (!tmp && cluster->cl_has_local &&\n\t cluster->cl_local_node == node->nd_num) {\n\t\to2net_stop_listening(node);\n\t\tcluster->cl_local_node = O2NM_INVALID_NODE_NUM;\n\t}\n\n\tnode->nd_local = tmp;\n\tif (node->nd_local) {\n\t\tcluster->cl_has_local = tmp;\n \t\tcluster->cl_local_node = node->nd_num;\n \t}\n \n\treturn count;\n }\n", + "target": "static ssize_t o2nm_node_local_store(struct config_item *item, const char *page,\n \t\t\t\t size_t count)\n {\n \tstruct o2nm_node *node = to_o2nm_node(item);\n\tstruct o2nm_cluster *cluster;\n \tunsigned long tmp;\n \tchar *p = (char *)page;\n \tssize_t ret;\n\n\ttmp = simple_strtoul(p, &p, 0);\n\tif (!p || (*p && (*p != '\\n')))\n\t\treturn -EINVAL;\n\n\ttmp = !!tmp; /* boolean of whether this node wants to be local */\n\n\t/* setting local turns on networking rx for now so we require having\n\t * set everything else first */\n\tif (!test_bit(O2NM_NODE_ATTR_ADDRESS, &node->nd_set_attributes) ||\n\t !test_bit(O2NM_NODE_ATTR_NUM, &node->nd_set_attributes) ||\n \t !test_bit(O2NM_NODE_ATTR_PORT, &node->nd_set_attributes))\n \t\treturn -EINVAL; /* XXX */\n \n\to2nm_lock_subsystem();\n\tcluster = to_o2nm_cluster_from_node(node);\n\tif (!cluster) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n \t/* the only failure case is trying to set a new local node\n \t * when a different one is already set */\n \tif (tmp && tmp == cluster->cl_has_local &&\n\t cluster->cl_local_node != node->nd_num) {\n\t\tret = -EBUSY;\n\t\tgoto out;\n\t}\n \n \t/* bring up the rx thread if we're setting the new local node. */\n \tif (tmp && !cluster->cl_has_local) {\n \t\tret = o2net_start_listening(node);\n \t\tif (ret)\n\t\t\tgoto out;\n \t}\n \n \tif (!tmp && cluster->cl_has_local &&\n\t cluster->cl_local_node == node->nd_num) {\n\t\to2net_stop_listening(node);\n\t\tcluster->cl_local_node = O2NM_INVALID_NODE_NUM;\n\t}\n\n\tnode->nd_local = tmp;\n\tif (node->nd_local) {\n\t\tcluster->cl_has_local = tmp;\n \t\tcluster->cl_local_node = node->nd_num;\n \t}\n \n\tret = count;\n\nout:\n\to2nm_unlock_subsystem();\n\treturn ret;\n }\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f911e11e7f6b5c0d6f5ee694a9871de6619889f7", + "input": " void AddChunk(sk_sp record,\n const TransformPaintPropertyNode* t,\n const ClipPaintPropertyNode* c,\n const EffectPaintPropertyNode* e,\n const FloatRect& bounds = FloatRect(0, 0, 100, 100)) {\n size_t i = items.size();\n items.AllocateAndConstruct(\n DefaultId().client, DefaultId().type, std::move(record));\n chunks.emplace_back(i, i + 1, DefaultId(), PropertyTreeState(t, c, e));\n chunks.back().bounds = bounds;\n }\n", + "target": " void AddChunk(sk_sp record,\n const TransformPaintPropertyNode& t,\n const ClipPaintPropertyNode& c,\n const EffectPaintPropertyNode& e,\n const FloatRect& bounds = FloatRect(0, 0, 100, 100)) {\n size_t i = items.size();\n items.AllocateAndConstruct(\n DefaultId().client, DefaultId().type, std::move(record));\n chunks.emplace_back(i, i + 1, DefaultId(), PropertyTreeState(&t, &c, &e));\n chunks.back().bounds = bounds;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#18d67244984a574ba2dd8779faabc0e3e34f4b76", + "input": "void BrowserPluginGuest::SetCompositingBufferData(int gpu_process_id,\n uint32 client_id,\n uint32 context_id,\n uint32 texture_id_0,\n uint32 texture_id_1,\n uint32 sync_point) {\n if (texture_id_0 == 0) {\n DCHECK(texture_id_1 == 0);\n return;\n }\n\n DCHECK(texture_id_1 != 0);\n DCHECK(texture_id_0 != texture_id_1);\n\n surface_handle_ = gfx::GLSurfaceHandle(gfx::kNullPluginWindow, true);\n surface_handle_.parent_gpu_process_id = gpu_process_id;\n surface_handle_.parent_client_id = client_id;\n surface_handle_.parent_context_id = context_id;\n surface_handle_.parent_texture_id[0] = texture_id_0;\n surface_handle_.parent_texture_id[1] = texture_id_1;\n surface_handle_.sync_point = sync_point;\n }\n", + "target": "void BrowserPluginGuest::SetCompositingBufferData(int gpu_process_id,\n uint32 client_id,\n uint32 context_id,\n uint32 texture_id_0,\n uint32 texture_id_1,\n uint32 sync_point) {\n if (texture_id_0 == 0) {\n DCHECK(texture_id_1 == 0);\n return;\n }\n\n DCHECK(texture_id_1 != 0);\n DCHECK(texture_id_0 != texture_id_1);\n\n surface_handle_ = gfx::GLSurfaceHandle(gfx::kNullPluginWindow, true);\n surface_handle_.parent_gpu_process_id = gpu_process_id;\n surface_handle_.parent_client_id = client_id;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#db124b8f607dd0a40a9aef2d4d468fad433522a7", + "input": " static M_bool M_fs_check_overwrite_allowed(const char *p1, const char *p2, M_uint32 mode)\n {\n \tM_fs_info_t *info = NULL;\n\tchar *pold = NULL;\n\tchar *pnew = NULL;\n\tM_fs_type_t type;\n\tM_bool ret = M_TRUE;\n\n\tif (mode & M_FS_FILE_MODE_OVERWRITE)\n\t\treturn M_TRUE;\n\n\t/* If we're not overwriting we need to verify existance.\n \t *\n \t * For files we need to check if the file name exists in the\n\t * directory it's being copied to.\n\t *\n\t * For directories we need to check if the directory name\n\t * exists in the directory it's being copied to.\n\t */\n\n\tif (M_fs_info(&info, p1, M_FS_PATH_INFO_FLAGS_BASIC) != M_FS_ERROR_SUCCESS)\n\t\treturn M_FALSE;\n\n\ttype = M_fs_info_get_type(info);\n\tM_fs_info_destroy(info);\n \n \tif (type != M_FS_TYPE_DIR) {\n \t\t/* File exists at path. */\n\t\tif (M_fs_perms_can_access(p2, M_FS_PERMS_MODE_NONE) == M_FS_ERROR_SUCCESS)\n\t\t{\n \t\t\tret = M_FALSE;\n \t\t\tgoto done;\n \t\t}\n\t}\n\n\t/* Is dir */\n\tpold = M_fs_path_basename(p1, M_FS_SYSTEM_AUTO);\n\tpnew = M_fs_path_join(p2, pnew, M_FS_SYSTEM_AUTO);\n\tif (M_fs_perms_can_access(pnew, M_FS_PERMS_MODE_NONE) == M_FS_ERROR_SUCCESS) {\n\t\tret = M_FALSE;\n\t\tgoto done;\n\t}\n\ndone:\n\tM_free(pnew);\n\tM_free(pold);\n\treturn ret;\n}\n", + "target": " static M_bool M_fs_check_overwrite_allowed(const char *p1, const char *p2, M_uint32 mode)\n {\n \tM_fs_info_t *info = NULL;\n\tchar *pold = NULL;\n\tchar *pnew = NULL;\n\tM_fs_type_t type;\n\tM_bool ret = M_TRUE;\n\n\tif (mode & M_FS_FILE_MODE_OVERWRITE)\n\t\treturn M_TRUE;\n\n\t/* If we're not overwriting we need to verify existance.\n \t *\n \t * For files we need to check if the file name exists in the\n\t * directory it's being copied to.\n\t *\n\t * For directories we need to check if the directory name\n\t * exists in the directory it's being copied to.\n\t */\n\n\tif (M_fs_info(&info, p1, M_FS_PATH_INFO_FLAGS_BASIC) != M_FS_ERROR_SUCCESS)\n\t\treturn M_FALSE;\n\n\ttype = M_fs_info_get_type(info);\n\tM_fs_info_destroy(info);\n \n \tif (type != M_FS_TYPE_DIR) {\n \t\t/* File exists at path. */\n\t\tif (M_fs_perms_can_access(p2, M_FS_PERMS_MODE_NONE) == M_FS_ERROR_SUCCESS) {\n \t\t\tret = M_FALSE;\n \t\t\tgoto done;\n \t\t}\n\t}\n\n\t/* Is dir */\n\tpold = M_fs_path_basename(p1, M_FS_SYSTEM_AUTO);\n\tpnew = M_fs_path_join(p2, pnew, M_FS_SYSTEM_AUTO);\n\tif (M_fs_perms_can_access(pnew, M_FS_PERMS_MODE_NONE) == M_FS_ERROR_SUCCESS) {\n\t\tret = M_FALSE;\n\t\tgoto done;\n\t}\n\ndone:\n\tM_free(pnew);\n\tM_free(pold);\n\treturn ret;\n}\n", + "vul_type": "cwe-732", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9a6bce9b615abca6068348c1606ba8eaf13d9ae0", + "input": "my_object_get_val (MyObject *obj, guint *ret, GError **error)\n{\n *ret = obj->val;\n return TRUE;\n}\n", + "target": "my_object_get_val (MyObject *obj, guint *ret, GError **error)\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#21d4d15a81b030f522fef29a0429f08a70220f68", + "input": "void GuestViewBase::RegisterGuestViewType(\n const std::string& view_type,\n const GuestCreationCallback& callback) {\n auto it = guest_view_registry.Get().find(view_type);\n DCHECK(it == guest_view_registry.Get().end());\n guest_view_registry.Get()[view_type] = callback;\n}\n", + "target": "void GuestViewBase::RegisterGuestViewType(\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#961d0cda4cfc3bcf04aa48ccc32772d63af12d9b", + "input": " void ManualFillingControllerImpl::CreateForWebContentsForTesting(\n content::WebContents* web_contents,\n base::WeakPtr pwd_controller,\n std::unique_ptr view) {\n DCHECK(web_contents) << \"Need valid WebContents to attach controller to!\";\n DCHECK(!FromWebContents(web_contents)) << \"Controller already attached!\";\n DCHECK(pwd_controller);\n DCHECK(view);\n \n web_contents->SetUserData(\n UserDataKey(),\n std::make_unique(\n web_contents, std::move(pwd_controller), std::move(view)));\n }\n", + "target": " void ManualFillingControllerImpl::CreateForWebContentsForTesting(\n content::WebContents* web_contents,\n base::WeakPtr pwd_controller,\n PasswordGenerationController* pwd_generation_controller_for_testing,\n std::unique_ptr view) {\n DCHECK(web_contents) << \"Need valid WebContents to attach controller to!\";\n DCHECK(!FromWebContents(web_contents)) << \"Controller already attached!\";\n DCHECK(pwd_controller);\n DCHECK(pwd_generation_controller_for_testing);\n DCHECK(view);\n \n web_contents->SetUserData(\n UserDataKey(),\n base::WrapUnique(new ManualFillingControllerImpl(\n web_contents, std::move(pwd_controller),\n pwd_generation_controller_for_testing, std::move(view))));\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#96e8ffb4e805c7266a2fc1fbe0e470052019bad9", + "input": "int FFmpegVideoDecoder::GetVideoBuffer(AVCodecContext* codec_context,\n AVFrame* frame) {\n VideoFrame::Format format = PixelFormatToVideoFormat(codec_context->pix_fmt);\n if (format == VideoFrame::UNKNOWN)\n return AVERROR(EINVAL);\n DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16 ||\n format == VideoFrame::YV12J);\n \n gfx::Size size(codec_context->width, codec_context->height);\n int ret;\n if ((ret = av_image_check_size(size.width(), size.height(), 0, NULL)) < 0)\n return ret;\n \n gfx::Size natural_size;\n if (codec_context->sample_aspect_ratio.num > 0) {\n natural_size = GetNaturalSize(size,\n codec_context->sample_aspect_ratio.num,\n codec_context->sample_aspect_ratio.den);\n } else {\n natural_size = config_.natural_size();\n }\n \n if (!VideoFrame::IsValidConfig(format, size, gfx::Rect(size), natural_size))\n return AVERROR(EINVAL);\n \n scoped_refptr video_frame =\n frame_pool_.CreateFrame(format, size, gfx::Rect(size),\n natural_size, kNoTimestamp());\n \n for (int i = 0; i < 3; i++) {\n frame->base[i] = video_frame->data(i);\n frame->data[i] = video_frame->data(i);\n frame->linesize[i] = video_frame->stride(i);\n }\n\n frame->opaque = NULL;\n video_frame.swap(reinterpret_cast(&frame->opaque));\n frame->type = FF_BUFFER_TYPE_USER;\n frame->width = codec_context->width;\n frame->height = codec_context->height;\n frame->format = codec_context->pix_fmt;\n \n return 0;\n}\n", + "target": "int FFmpegVideoDecoder::GetVideoBuffer(AVCodecContext* codec_context,\n AVFrame* frame) {\n VideoFrame::Format format = PixelFormatToVideoFormat(codec_context->pix_fmt);\n if (format == VideoFrame::UNKNOWN)\n return AVERROR(EINVAL);\n DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16 ||\n format == VideoFrame::YV12J);\n \n gfx::Size size(codec_context->width, codec_context->height);\n const int ret = av_image_check_size(size.width(), size.height(), 0, NULL);\n if (ret < 0)\n return ret;\n \n gfx::Size natural_size;\n if (codec_context->sample_aspect_ratio.num > 0) {\n natural_size = GetNaturalSize(size,\n codec_context->sample_aspect_ratio.num,\n codec_context->sample_aspect_ratio.den);\n } else {\n natural_size = config_.natural_size();\n }\n \n // FFmpeg has specific requirements on the allocation size of the frame. The\n // following logic replicates FFmpeg's allocation strategy to ensure buffers\n // are not overread / overwritten. See ff_init_buffer_info() for details.\n //\n // When lowres is non-zero, dimensions should be divided by 2^(lowres), but\n // since we don't use this, just DCHECK that it's zero.\n DCHECK_EQ(codec_context->lowres, 0);\n gfx::Size coded_size(std::max(size.width(), codec_context->coded_width),\n std::max(size.height(), codec_context->coded_height));\n\n if (!VideoFrame::IsValidConfig(\n format, coded_size, gfx::Rect(size), natural_size))\n return AVERROR(EINVAL);\n \n scoped_refptr video_frame = frame_pool_.CreateFrame(\n format, coded_size, gfx::Rect(size), natural_size, kNoTimestamp());\n \n for (int i = 0; i < 3; i++) {\n frame->base[i] = video_frame->data(i);\n frame->data[i] = video_frame->data(i);\n frame->linesize[i] = video_frame->stride(i);\n }\n\n frame->opaque = NULL;\n video_frame.swap(reinterpret_cast(&frame->opaque));\n frame->type = FF_BUFFER_TYPE_USER;\n frame->width = coded_size.width();\n frame->height = coded_size.height();\n frame->format = codec_context->pix_fmt;\n \n return 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#396240cf070a806b91fea81131d034e1399af1e0", + "input": "newEntry(struct rx_call *call, char aname[], afs_int32 flag, afs_int32 oid,\n\t afs_int32 *aid, afs_int32 *cid)\n{\n afs_int32 code;\n struct ubik_trans *tt;\n int admin;\n char cname[PR_MAXNAMELEN];\n stolower(aname);\n code = Initdb();\n if (code)\n\treturn code;\n code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt);\n if (code)\n\treturn code;\n code = ubik_SetLock(tt, 1, 1, LOCKWRITE);\n if (code)\n\tABORT_WITH(tt, code);\n code = read_DbHeader(tt);\n if (code)\n\tABORT_WITH(tt, code);\n\n /* this is for cross-cell self registration. It is not added in the\n * SPR_INewEntry because we want self-registration to only do\n * automatic id assignment.\n */\n code = WhoIsThisWithName(call, tt, cid, cname);\n if (code != 2) { /* 2 specifies that this is a foreign cell request */\n if (code)\n ABORT_WITH(tt, PRPERM);\n admin = IsAMemberOf(tt, *cid, SYSADMINID);\n } else {\n admin = ((!restricted && !strcmp(aname, cname))) || IsAMemberOf(tt, *cid, SYSADMINID);\n oid = *cid = SYSADMINID;\n }\n if (!CreateOK(tt, *cid, oid, flag, admin))\n ABORT_WITH(tt, PRPERM);\n if (code)\n\treturn code;\n return PRSUCCESS;\n}\n", + "target": "newEntry(struct rx_call *call, char aname[], afs_int32 flag, afs_int32 oid,\n\t afs_int32 *aid, afs_int32 *cid)\n{\n afs_int32 code;\n struct ubik_trans *tt;\n int admin;\n char cname[PR_MAXNAMELEN];\n stolower(aname);\n code = Initdb();\n if (code)\n\treturn code;\n code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt);\n if (code)\n\treturn code;\n code = ubik_SetLock(tt, 1, 1, LOCKWRITE);\n if (code)\n\tABORT_WITH(tt, code);\n code = read_DbHeader(tt);\n if (code)\n\tABORT_WITH(tt, code);\n\n /* this is for cross-cell self registration. It is not added in the\n * SPR_INewEntry because we want self-registration to only do\n * automatic id assignment.\n */\n code = WhoIsThisWithName(call, tt, cid, cname);\n if (code && code != 2)\n ABORT_WITH(tt, PRPERM);\n admin = IsAMemberOf(tt, *cid, SYSADMINID);\n if (code == 2 /* foreign cell request */) {\n if (!restricted && (strcmp(aname, cname) == 0)) {\n /* can't autoregister while providing an owner id */\n if (oid != 0)\n ABORT_WITH(tt, PRPERM);\n\n admin = 1;\n oid = SYSADMINID;\n *cid = SYSADMINID;\n }\n }\n if (!CreateOK(tt, *cid, oid, flag, admin))\n ABORT_WITH(tt, PRPERM);\n if (code)\n\treturn code;\n return PRSUCCESS;\n}\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7f8cdab6fda192d15e45a3e9682b1eec427870c5", + "input": " views::NonClientFrameView* ShellWindowViews::CreateNonClientFrameView(\n views::Widget* widget) {\n ShellWindowFrameView* frame_view = new ShellWindowFrameView();\n frame_view->Init(window_);\n return frame_view;\n }\n", + "target": " views::NonClientFrameView* ShellWindowViews::CreateNonClientFrameView(\n views::Widget* widget) {\n ShellWindowFrameView* frame_view =\n new ShellWindowFrameView(use_custom_frame_);\n frame_view->Init(window_);\n return frame_view;\n }\n", + "vul_type": "cwe-79", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#53488f0275d6c8a121af49f7ac817d09ce68090d", + "input": " void red_channel_pipes_add_type(RedChannel *channel, int pipe_item_type)\n {\n RingItem *link;\n \n RING_FOREACH(link, &channel->clients) {\n red_channel_client_pipe_add_type(\n SPICE_CONTAINEROF(link, RedChannelClient, channel_link),\n pipe_item_type);\n }\n}\n", + "target": " void red_channel_pipes_add_type(RedChannel *channel, int pipe_item_type)\n {\n RingItem *link, *next;\n \n RING_FOREACH_SAFE(link, next, &channel->clients) {\n red_channel_client_pipe_add_type(\n SPICE_CONTAINEROF(link, RedChannelClient, channel_link),\n pipe_item_type);\n }\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3ac044334c3ff6a61cb4238ff3ddaf17c7efcf49", + "input": "EAS_BOOL WT_CheckSampleEnd (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame, EAS_BOOL update)\n{\n EAS_U32 endPhaseAccum;\n EAS_U32 endPhaseFrac;\n EAS_I32 numSamples;\n EAS_BOOL done = EAS_FALSE;\n\n /* check to see if we hit the end of the waveform this time */\n /*lint -e{703} use shift for performance */\n endPhaseFrac = pWTVoice->phaseFrac + (pWTIntFrame->frame.phaseIncrement << SYNTH_UPDATE_PERIOD_IN_BITS);\n endPhaseAccum = pWTVoice->phaseAccum + GET_PHASE_INT_PART(endPhaseFrac);\n if (endPhaseAccum >= pWTVoice->loopEnd)\n {\n /* calculate how far current ptr is from end */\n numSamples = (EAS_I32) (pWTVoice->loopEnd - pWTVoice->phaseAccum);\n\n /* now account for the fractional portion */\n /*lint -e{703} use shift for performance */\n numSamples = (EAS_I32) ((numSamples << NUM_PHASE_FRAC_BITS) - pWTVoice->phaseFrac);\n if (pWTIntFrame->frame.phaseIncrement) {\n pWTIntFrame->numSamples = 1 + (numSamples / pWTIntFrame->frame.phaseIncrement);\n\n } else {\n pWTIntFrame->numSamples = numSamples;\n }\n \n /* sound will be done this frame */\n done = EAS_TRUE;\n }\n\n /* update data for off-chip synth */\n if (update)\n {\n pWTVoice->phaseFrac = endPhaseFrac;\n pWTVoice->phaseAccum = endPhaseAccum;\n }\n\n return done;\n}\n", + "target": "EAS_BOOL WT_CheckSampleEnd (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame, EAS_BOOL update)\n{\n EAS_U32 endPhaseAccum;\n EAS_U32 endPhaseFrac;\n EAS_I32 numSamples;\n EAS_BOOL done = EAS_FALSE;\n\n /* check to see if we hit the end of the waveform this time */\n /*lint -e{703} use shift for performance */\n endPhaseFrac = pWTVoice->phaseFrac + (pWTIntFrame->frame.phaseIncrement << SYNTH_UPDATE_PERIOD_IN_BITS);\n endPhaseAccum = pWTVoice->phaseAccum + GET_PHASE_INT_PART(endPhaseFrac);\n if (endPhaseAccum >= pWTVoice->loopEnd)\n {\n /* calculate how far current ptr is from end */\n numSamples = (EAS_I32) (pWTVoice->loopEnd - pWTVoice->phaseAccum);\n\n /* now account for the fractional portion */\n /*lint -e{703} use shift for performance */\n numSamples = (EAS_I32) ((numSamples << NUM_PHASE_FRAC_BITS) - pWTVoice->phaseFrac);\n if (pWTIntFrame->frame.phaseIncrement) {\n pWTIntFrame->numSamples = 1 + (numSamples / pWTIntFrame->frame.phaseIncrement);\n\n } else {\n pWTIntFrame->numSamples = numSamples;\n }\n if (pWTIntFrame->numSamples < 0) {\n ALOGE(\"b/26366256\");\n pWTIntFrame->numSamples = 0;\n }\n \n /* sound will be done this frame */\n done = EAS_TRUE;\n }\n\n /* update data for off-chip synth */\n if (update)\n {\n pWTVoice->phaseFrac = endPhaseFrac;\n pWTVoice->phaseAccum = endPhaseAccum;\n }\n\n return done;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fec26ff33bf372476a70326f3669a35f34a9d474", + "input": " void PageRequestSummary::UpdateOrAddToOrigins(\n const content::mojom::ResourceLoadInfo& resource_load_info) {\n for (const auto& redirect_info : resource_load_info.redirect_info_chain)\n UpdateOrAddToOrigins(redirect_info->url, redirect_info->network_info);\n UpdateOrAddToOrigins(resource_load_info.url, resource_load_info.network_info);\n }\n", + "target": " void PageRequestSummary::UpdateOrAddToOrigins(\n const content::mojom::ResourceLoadInfo& resource_load_info) {\n for (const auto& redirect_info : resource_load_info.redirect_info_chain) {\n UpdateOrAddToOrigins(url::Origin::Create(redirect_info->url),\n redirect_info->network_info);\n }\n UpdateOrAddToOrigins(url::Origin::Create(resource_load_info.url),\n resource_load_info.network_info);\n }\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b995299b73ba4cd259f221f500d4e63095508bec", + "input": " write_message( RenderState state )\n {\n ADisplay adisplay = (ADisplay)state->display.disp;\n\n\n if ( state->message == NULL )\n {\n FontFace face = &state->faces[state->face_index];\n int idx, total;\n\n\n idx = face->index;\n total = 1;\n while ( total + state->face_index < state->num_faces &&\n face[total].filepath == face[0].filepath )\n total++;\n\n total += idx;\n \n state->message = state->message0;\n if ( total > 1 )\n sprintf( state->message0, \"%s %d/%d @ %5.1fpt\",\n state->filename, idx + 1, total,\n state->char_size );\n else\n sprintf( state->message0, \"%s @ %5.1fpt\",\n state->filename,\n state->char_size );\n }\n\n grWriteCellString( adisplay->bitmap, 0, DIM_Y - 10, state->message,\n adisplay->fore_color );\n\n state->message = NULL;\n }\n", + "target": " write_message( RenderState state )\n {\n ADisplay adisplay = (ADisplay)state->display.disp;\n\n\n if ( state->message == NULL )\n {\n FontFace face = &state->faces[state->face_index];\n int idx, total;\n\n\n idx = face->index;\n total = 1;\n while ( total + state->face_index < state->num_faces &&\n face[total].filepath == face[0].filepath )\n total++;\n\n total += idx;\n \n state->message = state->message0;\n if ( total > 1 )\n sprintf( state->message0, \"%.100s %d/%d @ %5.1fpt\",\n state->filename, idx + 1, total,\n state->char_size );\n else\n sprintf( state->message0, \"%.100s @ %5.1fpt\",\n state->filename,\n state->char_size );\n }\n\n grWriteCellString( adisplay->bitmap, 0, DIM_Y - 10, state->message,\n adisplay->fore_color );\n\n state->message = NULL;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04ff52bb66284467ccb43d90800013b89ee8db75", + "input": " void WaitForCallback() {\n if (!use_audio_thread_) {\n base::RunLoop().RunUntilIdle();\n return;\n }\n media::WaitableMessageLoopEvent event;\n audio_thread_.task_runner()->PostTaskAndReply(\n FROM_HERE, base::Bind(&base::DoNothing), event.GetClosure());\n event.RunAndWait();\n base::RunLoop().RunUntilIdle();\n }\n", + "target": " void WaitForCallback() {\n if (!use_audio_thread_) {\n base::RunLoop().RunUntilIdle();\n return;\n }\n WaitableMessageLoopEvent event;\n audio_thread_.task_runner()->PostTaskAndReply(\n FROM_HERE, base::Bind(&base::DoNothing), event.GetClosure());\n event.RunAndWait();\n base::RunLoop().RunUntilIdle();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#282f53ffdc3b1902da86f6a0791af736837efbf8", + "input": "void PeopleHandler::HandleSignout(const base::ListValue* args) {\n bool delete_profile = false;\n args->GetBoolean(0, &delete_profile);\n\n if (!signin_util::IsUserSignoutAllowedForProfile(profile_)) {\n DCHECK(delete_profile);\n } else {\n SigninManager* signin_manager =\n SigninManagerFactory::GetForProfile(profile_);\n if (signin_manager->IsAuthenticated()) {\n if (GetSyncService())\n ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);\n\n signin_metrics::SignoutDelete delete_metric =\n delete_profile ? signin_metrics::SignoutDelete::DELETED\n : signin_metrics::SignoutDelete::KEEPING;\n signin_manager->SignOutAndRemoveAllAccounts(\n signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, delete_metric);\n } else {\n DCHECK(!delete_profile)\n << \"Deleting the profile should only be offered the user is syncing.\";\n ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)\n ->RevokeAllCredentials();\n }\n }\n \n if (delete_profile) {\n webui::DeleteProfileAtPath(profile_->GetPath(),\n ProfileMetrics::DELETE_PROFILE_SETTINGS);\n }\n}\n", + "target": "void PeopleHandler::HandleSignout(const base::ListValue* args) {\n bool delete_profile = false;\n args->GetBoolean(0, &delete_profile);\n\n if (!signin_util::IsUserSignoutAllowedForProfile(profile_)) {\n DCHECK(delete_profile);\n } else {\n SigninManager* signin_manager =\n SigninManagerFactory::GetForProfile(profile_);\n if (signin_manager->IsAuthenticated()) {\n if (GetSyncService())\n ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);\n\n signin_metrics::SignoutDelete delete_metric =\n delete_profile ? signin_metrics::SignoutDelete::DELETED\n : signin_metrics::SignoutDelete::KEEPING;\n signin_manager->SignOutAndRemoveAllAccounts(\n signin_metrics::USER_CLICKED_SIGNOUT_SETTINGS, delete_metric);\n } else {\n DCHECK(!delete_profile)\n << \"Deleting the profile should only be offered the user is syncing.\";\n ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)\n ->RevokeAllCredentials(\n signin_metrics::SourceForRefreshTokenOperation::\n kSettings_Signout);\n }\n }\n \n if (delete_profile) {\n webui::DeleteProfileAtPath(profile_->GetPath(),\n ProfileMetrics::DELETE_PROFILE_SETTINGS);\n }\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ffac0ee4b8b00944e2ddf23f7f4f55daff3c117e", + "input": " void ManifestChangeNotifier::DidChangeManifest() {\n if (weak_factory_.HasWeakPtrs())\n return;\n \n if (!render_frame()->GetWebFrame()->IsLoading()) {\n render_frame()\n ->GetTaskRunner(blink::TaskType::kUnspecedLoading)\n ->PostTask(FROM_HERE,\n base::BindOnce(&ManifestChangeNotifier::ReportManifestChange,\n weak_factory_.GetWeakPtr()));\n return;\n }\n ReportManifestChange();\n}\n", + "target": " void ManifestChangeNotifier::DidChangeManifest() {\n // Manifests are not considered when the current page has a unique origin.\n if (!ManifestManager::CanFetchManifest(render_frame()))\n return;\n\n if (weak_factory_.HasWeakPtrs())\n return;\n \n if (!render_frame()->GetWebFrame()->IsLoading()) {\n render_frame()\n ->GetTaskRunner(blink::TaskType::kUnspecedLoading)\n ->PostTask(FROM_HERE,\n base::BindOnce(&ManifestChangeNotifier::ReportManifestChange,\n weak_factory_.GetWeakPtr()));\n return;\n }\n ReportManifestChange();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#89f296b34f4f33e048848c06da08fc9271b30bc9", + "input": "void PageFormAnalyserLogger::Flush() {\n std::string text;\n for (ConsoleLevel level : {kError, kWarning, kVerbose}) {\n for (LogEntry& entry : node_buffer_[level]) {\n text.clear();\n text += \"[DOM] \";\n text += entry.message;\n for (unsigned i = 0; i < entry.nodes.size(); ++i)\n text += \" %o\";\n \n blink::WebConsoleMessage message(level, blink::WebString::FromUTF8(text));\n message.nodes = std::move(entry.nodes); // avoids copying node vectors.\n frame_->AddMessageToConsole(message);\n }\n }\n node_buffer_.clear();\n}\n", + "target": "void PageFormAnalyserLogger::Flush() {\n std::string text;\n for (ConsoleLevel level : {kError, kWarning, kVerbose}) {\n for (LogEntry& entry : node_buffer_[level]) {\n text.clear();\n text += \"[DOM] \";\n text += entry.message;\n\n std::vector nodesToLog;\n for (unsigned i = 0; i < entry.nodes.size(); ++i) {\n if (entry.nodes[i].IsElementNode()) {\n const blink::WebElement element =\n entry.nodes[i].ToConst();\n const blink::WebInputElement* webInputElement =\n blink::ToWebInputElement(&element);\n\n // Filter out password inputs with values from being logged, as their\n // values are also logged.\n const bool shouldObfuscate =\n webInputElement &&\n webInputElement->IsPasswordFieldForAutofill() &&\n !webInputElement->Value().IsEmpty();\n\n if (!shouldObfuscate) {\n text += \" %o\";\n nodesToLog.push_back(element);\n }\n }\n }\n \n blink::WebConsoleMessage message(level, blink::WebString::FromUTF8(text));\n message.nodes = std::move(nodesToLog); // avoids copying node vectors.\n frame_->AddMessageToConsole(message);\n }\n }\n node_buffer_.clear();\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#193e87143c290ec16838f5368adc0e0bc94eb931", + "input": "static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np)\n{\n\tstruct platform_device *pdev = cqspi->pdev;\n\tstruct device *dev = &pdev->dev;\n\tstruct cqspi_flash_pdata *f_pdata;\n\tstruct spi_nor *nor;\n\tstruct mtd_info *mtd;\n\tunsigned int cs;\n\tint i, ret;\n\n\t/* Get flash device data */\n\tfor_each_available_child_of_node(dev->of_node, np) {\n\t\tif (of_property_read_u32(np, \"reg\", &cs)) {\n\t\t\tdev_err(dev, \"Couldn't determine chip select.\\n\");\n \t\t\tgoto err;\n \t\t}\n \n\t\tif (cs > CQSPI_MAX_CHIPSELECT) {\n \t\t\tdev_err(dev, \"Chip select %d out of range.\\n\", cs);\n \t\t\tgoto err;\n \t\t}\n\n\t\tf_pdata = &cqspi->f_pdata[cs];\n\t\tf_pdata->cqspi = cqspi;\n\t\tf_pdata->cs = cs;\n\n\t\tret = cqspi_of_get_flash_pdata(pdev, f_pdata, np);\n\t\tif (ret)\n\t\t\tgoto err;\n\n\t\tnor = &f_pdata->nor;\n\t\tmtd = &nor->mtd;\n\n\t\tmtd->priv = nor;\n\n\t\tnor->dev = dev;\n\t\tspi_nor_set_flash_node(nor, np);\n\t\tnor->priv = f_pdata;\n\n\t\tnor->read_reg = cqspi_read_reg;\n\t\tnor->write_reg = cqspi_write_reg;\n\t\tnor->read = cqspi_read;\n\t\tnor->write = cqspi_write;\n\t\tnor->erase = cqspi_erase;\n\t\tnor->prepare = cqspi_prep;\n\t\tnor->unprepare = cqspi_unprep;\n\n\t\tmtd->name = devm_kasprintf(dev, GFP_KERNEL, \"%s.%d\",\n\t\t\t\t\t dev_name(dev), cs);\n\t\tif (!mtd->name) {\n\t\t\tret = -ENOMEM;\n\t\t\tgoto err;\n\t\t}\n\n\t\tret = spi_nor_scan(nor, NULL, SPI_NOR_QUAD);\n\t\tif (ret)\n\t\t\tgoto err;\n\n\t\tret = mtd_device_register(mtd, NULL, 0);\n\t\tif (ret)\n\t\t\tgoto err;\n\n\t\tf_pdata->registered = true;\n\t}\n\n\treturn 0;\n\nerr:\n\tfor (i = 0; i < CQSPI_MAX_CHIPSELECT; i++)\n\t\tif (cqspi->f_pdata[i].registered)\n\t\t\tmtd_device_unregister(&cqspi->f_pdata[i].nor.mtd);\n\treturn ret;\n}\n", + "target": "static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np)\n{\n\tstruct platform_device *pdev = cqspi->pdev;\n\tstruct device *dev = &pdev->dev;\n\tstruct cqspi_flash_pdata *f_pdata;\n\tstruct spi_nor *nor;\n\tstruct mtd_info *mtd;\n\tunsigned int cs;\n\tint i, ret;\n\n\t/* Get flash device data */\n\tfor_each_available_child_of_node(dev->of_node, np) {\n\t\tif (of_property_read_u32(np, \"reg\", &cs)) {\n\t\t\tdev_err(dev, \"Couldn't determine chip select.\\n\");\n \t\t\tgoto err;\n \t\t}\n \n\t\tif (cs >= CQSPI_MAX_CHIPSELECT) {\n \t\t\tdev_err(dev, \"Chip select %d out of range.\\n\", cs);\n \t\t\tgoto err;\n \t\t}\n\n\t\tf_pdata = &cqspi->f_pdata[cs];\n\t\tf_pdata->cqspi = cqspi;\n\t\tf_pdata->cs = cs;\n\n\t\tret = cqspi_of_get_flash_pdata(pdev, f_pdata, np);\n\t\tif (ret)\n\t\t\tgoto err;\n\n\t\tnor = &f_pdata->nor;\n\t\tmtd = &nor->mtd;\n\n\t\tmtd->priv = nor;\n\n\t\tnor->dev = dev;\n\t\tspi_nor_set_flash_node(nor, np);\n\t\tnor->priv = f_pdata;\n\n\t\tnor->read_reg = cqspi_read_reg;\n\t\tnor->write_reg = cqspi_write_reg;\n\t\tnor->read = cqspi_read;\n\t\tnor->write = cqspi_write;\n\t\tnor->erase = cqspi_erase;\n\t\tnor->prepare = cqspi_prep;\n\t\tnor->unprepare = cqspi_unprep;\n\n\t\tmtd->name = devm_kasprintf(dev, GFP_KERNEL, \"%s.%d\",\n\t\t\t\t\t dev_name(dev), cs);\n\t\tif (!mtd->name) {\n\t\t\tret = -ENOMEM;\n\t\t\tgoto err;\n\t\t}\n\n\t\tret = spi_nor_scan(nor, NULL, SPI_NOR_QUAD);\n\t\tif (ret)\n\t\t\tgoto err;\n\n\t\tret = mtd_device_register(mtd, NULL, 0);\n\t\tif (ret)\n\t\t\tgoto err;\n\n\t\tf_pdata->registered = true;\n\t}\n\n\treturn 0;\n\nerr:\n\tfor (i = 0; i < CQSPI_MAX_CHIPSELECT; i++)\n\t\tif (cqspi->f_pdata[i].registered)\n\t\t\tmtd_device_unregister(&cqspi->f_pdata[i].nor.mtd);\n\treturn ret;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#de9f869616dd95e95c00bdd6b0fcd3421e8a4323", + "input": " unsigned long insn_get_seg_base(struct pt_regs *regs, int seg_reg_idx)\n {\n\tstruct desc_struct *desc;\n \tshort sel;\n \n \tsel = get_segment_selector(regs, seg_reg_idx);\n\tif (sel < 0)\n\t\treturn -1L;\n\n\tif (v8086_mode(regs))\n\t\t/*\n\t\t * Base is simply the segment selector shifted 4\n\t\t * bits to the right.\n\t\t */\n\t\treturn (unsigned long)(sel << 4);\n\n\tif (user_64bit_mode(regs)) {\n\t\t/*\n\t\t * Only FS or GS will have a base address, the rest of\n\t\t * the segments' bases are forced to 0.\n\t\t */\n\t\tunsigned long base;\n\n\t\tif (seg_reg_idx == INAT_SEG_REG_FS)\n\t\t\trdmsrl(MSR_FS_BASE, base);\n\t\telse if (seg_reg_idx == INAT_SEG_REG_GS)\n\t\t\t/*\n\t\t\t * swapgs was called at the kernel entry point. Thus,\n\t\t\t * MSR_KERNEL_GS_BASE will have the user-space GS base.\n\t\t\t */\n\t\t\trdmsrl(MSR_KERNEL_GS_BASE, base);\n\t\telse\n\t\t\tbase = 0;\n\t\treturn base;\n\t}\n\n\t/* In protected mode the segment selector cannot be null. */\n \tif (!sel)\n \t\treturn -1L;\n \n\tdesc = get_desc(sel);\n\tif (!desc)\n \t\treturn -1L;\n \n\treturn get_desc_base(desc);\n }\n", + "target": " unsigned long insn_get_seg_base(struct pt_regs *regs, int seg_reg_idx)\n {\n\tstruct desc_struct desc;\n \tshort sel;\n \n \tsel = get_segment_selector(regs, seg_reg_idx);\n\tif (sel < 0)\n\t\treturn -1L;\n\n\tif (v8086_mode(regs))\n\t\t/*\n\t\t * Base is simply the segment selector shifted 4\n\t\t * bits to the right.\n\t\t */\n\t\treturn (unsigned long)(sel << 4);\n\n\tif (user_64bit_mode(regs)) {\n\t\t/*\n\t\t * Only FS or GS will have a base address, the rest of\n\t\t * the segments' bases are forced to 0.\n\t\t */\n\t\tunsigned long base;\n\n\t\tif (seg_reg_idx == INAT_SEG_REG_FS)\n\t\t\trdmsrl(MSR_FS_BASE, base);\n\t\telse if (seg_reg_idx == INAT_SEG_REG_GS)\n\t\t\t/*\n\t\t\t * swapgs was called at the kernel entry point. Thus,\n\t\t\t * MSR_KERNEL_GS_BASE will have the user-space GS base.\n\t\t\t */\n\t\t\trdmsrl(MSR_KERNEL_GS_BASE, base);\n\t\telse\n\t\t\tbase = 0;\n\t\treturn base;\n\t}\n\n\t/* In protected mode the segment selector cannot be null. */\n \tif (!sel)\n \t\treturn -1L;\n \n\tif (!get_desc(&desc, sel))\n \t\treturn -1L;\n \n\treturn get_desc_base(&desc);\n }\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7f3d85b096f66870a15b37c2f40b219b2e292693", + "input": "png_get_copyright(png_structp png_ptr)\n{\n PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */\n#ifdef PNG_STRING_COPYRIGHT\n return PNG_STRING_COPYRIGHT\n #else\n #ifdef __STDC__\n return ((png_charp) PNG_STRING_NEWLINE \\\n \"libpng version 1.2.52 - November 20, 2014\" PNG_STRING_NEWLINE \\\n \"Copyright (c) 1998-2014 Glenn Randers-Pehrson\" PNG_STRING_NEWLINE \\\n \"Copyright (c) 1996-1997 Andreas Dilger\" PNG_STRING_NEWLINE \\\n \"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\" \\\n PNG_STRING_NEWLINE);\n #else\n return ((png_charp) \"libpng version 1.2.52 - November 20, 2014\\\n Copyright (c) 1998-2014 Glenn Randers-Pehrson\\\n Copyright (c) 1996-1997 Andreas Dilger\\\n Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\");\n #endif\n#endif\n}\n", + "target": "png_get_copyright(png_structp png_ptr)\n{\n PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */\n#ifdef PNG_STRING_COPYRIGHT\n return PNG_STRING_COPYRIGHT\n #else\n #ifdef __STDC__\n return ((png_charp) PNG_STRING_NEWLINE \\\n \"libpng version 1.2.54 - November 12, 2015\" PNG_STRING_NEWLINE \\\n \"Copyright (c) 1998-2015 Glenn Randers-Pehrson\" PNG_STRING_NEWLINE \\\n \"Copyright (c) 1996-1997 Andreas Dilger\" PNG_STRING_NEWLINE \\\n \"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\" \\\n PNG_STRING_NEWLINE);\n #else\n return ((png_charp) \"libpng version 1.2.54 - November 12, 2015\\\n Copyright (c) 1998-2015 Glenn Randers-Pehrson\\\n Copyright (c) 1996-1997 Andreas Dilger\\\n Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\");\n #endif\n#endif\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d0c31f0342cefc46a3b3d80359a9779d044d4c0d", + "input": " Blob::Blob(PassOwnPtr blobData, long long size)\n : m_type(blobData->contentType())\n , m_size(size)\n{\n ASSERT(blobData);\n ScriptWrappable::init(this);\n \n m_internalURL = BlobURL::createInternalURL();\n ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData);\n }\n", + "target": " Blob::Blob(PassOwnPtr blobData, long long size)\n : m_type(blobData->contentType())\n , m_size(size)\n{\n ASSERT(blobData);\n ScriptWrappable::init(this);\n \n m_internalURL = BlobURL::createInternalURL();\n BlobRegistry::registerBlobURL(m_internalURL, blobData);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04aaacb936a08d70862d6d9d7e8354721ae46be8", + "input": "bool AppCacheDatabase::InsertEntry(const EntryRecord* record) {\n if (!LazyOpen(kCreateIfNeeded))\n return false;\n \n static const char kSql[] =\n \"INSERT INTO Entries (cache_id, url, flags, response_id, response_size)\"\n \" VALUES(?, ?, ?, ?, ?)\";\n \n sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql));\n statement.BindInt64(0, record->cache_id);\n statement.BindString(1, record->url.spec());\n statement.BindInt(2, record->flags);\n statement.BindInt64(3, record->response_id);\n statement.BindInt64(4, record->response_size);\n \n return statement.Run();\n }\n", + "target": "bool AppCacheDatabase::InsertEntry(const EntryRecord* record) {\n if (!LazyOpen(kCreateIfNeeded))\n return false;\n \n static const char kSql[] =\n \"INSERT INTO Entries (cache_id, url, flags, response_id, response_size, \"\n \"padding_size)\"\n \" VALUES(?, ?, ?, ?, ?, ?)\";\n \n sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql));\n statement.BindInt64(0, record->cache_id);\n statement.BindString(1, record->url.spec());\n statement.BindInt(2, record->flags);\n statement.BindInt64(3, record->response_id);\n DCHECK_GE(record->response_size, 0);\n statement.BindInt64(4, record->response_size);\n DCHECK_GE(record->padding_size, 0);\n statement.BindInt64(5, record->padding_size);\n \n return statement.Run();\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#34b2cef20f19c87999fff3da4071e66937db9644", + "input": "void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)\n{\n\tstruct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);\n\tbool prepare = (inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) ||\n\t\t ipv6_sk_rxinfo(sk);\n\n\tif (prepare && skb_rtable(skb)) {\n\t\t/* skb->cb is overloaded: prior to this point it is IP{6}CB\n\t\t * which has interface index (iif) as the first member of the\n\t\t * underlying inet{6}_skb_parm struct. This code then overlays\n\t\t * PKTINFO_SKB_CB and in_pktinfo also has iif as the first\n\t\t * element so the iif is picked up from the prior IPCB. If iif\n\t\t * is the loopback interface, then return the sending interface\n\t\t * (e.g., process binds socket to eth0 for Tx which is\n\t\t * redirected to loopback in the rtable/dst).\n\t\t */\n\t\tif (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)\n\t\t\tpktinfo->ipi_ifindex = inet_iif(skb);\n\n\t\tpktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);\n\t} else {\n \t\tpktinfo->ipi_ifindex = 0;\n \t\tpktinfo->ipi_spec_dst.s_addr = 0;\n \t}\n\tskb_dst_drop(skb);\n }\n", + "target": "void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)\n{\n\tstruct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);\n\tbool prepare = (inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) ||\n\t\t ipv6_sk_rxinfo(sk);\n\n\tif (prepare && skb_rtable(skb)) {\n\t\t/* skb->cb is overloaded: prior to this point it is IP{6}CB\n\t\t * which has interface index (iif) as the first member of the\n\t\t * underlying inet{6}_skb_parm struct. This code then overlays\n\t\t * PKTINFO_SKB_CB and in_pktinfo also has iif as the first\n\t\t * element so the iif is picked up from the prior IPCB. If iif\n\t\t * is the loopback interface, then return the sending interface\n\t\t * (e.g., process binds socket to eth0 for Tx which is\n\t\t * redirected to loopback in the rtable/dst).\n\t\t */\n\t\tif (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)\n\t\t\tpktinfo->ipi_ifindex = inet_iif(skb);\n\n\t\tpktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);\n\t} else {\n \t\tpktinfo->ipi_ifindex = 0;\n \t\tpktinfo->ipi_spec_dst.s_addr = 0;\n \t}\n\t/* We need to keep the dst for __ip_options_echo()\n\t * We could restrict the test to opt.ts_needtime || opt.srr,\n\t * but the following is good enough as IP options are not often used.\n\t */\n\tif (unlikely(IPCB(skb)->opt.optlen))\n\t\tskb_dst_force(skb);\n\telse\n\t\tskb_dst_drop(skb);\n }\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d7325bac173492b358417a0ad49fabad44447d52", + "input": " static MagickBooleanType ReadDXT5(Image *image, DDSInfo *dds_info,\n ExceptionInfo *exception)\n{\n DDSColors\n colors;\n\n ssize_t\n j,\n y;\n\n MagickSizeType\n alpha_bits;\n\n PixelPacket\n *q;\n\n register ssize_t\n i,\n x;\n\n unsigned char\n a0,\n a1;\n\n size_t\n alpha,\n bits,\n code,\n alpha_code;\n\n unsigned short\n c0,\n c1;\n\n for (y = 0; y < (ssize_t) dds_info->height; y += 4)\n {\n for (x = 0; x < (ssize_t) dds_info->width; x += 4)\n {\n /* Get 4x4 patch of pixels to write on */\n q = QueueAuthenticPixels(image, x, y, Min(4, dds_info->width - x),\n Min(4, dds_info->height - y),exception);\n \n if (q == (PixelPacket *) NULL)\n return MagickFalse;\n\n /* Read alpha values (8 bytes) */\n a0 = (unsigned char) ReadBlobByte(image);\n a1 = (unsigned char) ReadBlobByte(image);\n\n alpha_bits = (MagickSizeType)ReadBlobLSBLong(image);\n alpha_bits = alpha_bits | ((MagickSizeType)ReadBlobLSBShort(image) << 32);\n\n /* Read 8 bytes of data from the image */\n c0 = ReadBlobLSBShort(image);\n c1 = ReadBlobLSBShort(image);\n bits = ReadBlobLSBLong(image);\n\n CalculateColors(c0, c1, &colors, MagickTrue);\n\n /* Write the pixels */\n for (j = 0; j < 4; j++)\n {\n for (i = 0; i < 4; i++)\n {\n if ((x + i) < (ssize_t) dds_info->width && (y + j) < (ssize_t) dds_info->height)\n {\n code = (bits >> ((4*j+i)*2)) & 0x3;\n SetPixelRed(q,ScaleCharToQuantum(colors.r[code]));\n SetPixelGreen(q,ScaleCharToQuantum(colors.g[code]));\n SetPixelBlue(q,ScaleCharToQuantum(colors.b[code]));\n /* Extract alpha value */\n alpha_code = (size_t) (alpha_bits >> (3*(4*j+i))) & 0x7;\n if (alpha_code == 0)\n alpha = a0;\n else if (alpha_code == 1)\n alpha = a1;\n else if (a0 > a1)\n alpha = ((8-alpha_code) * a0 + (alpha_code-1) * a1) / 7;\n else if (alpha_code == 6)\n alpha = 0;\n else if (alpha_code == 7)\n alpha = 255;\n else\n alpha = (((6-alpha_code) * a0 + (alpha_code-1) * a1) / 5);\n SetPixelAlpha(q,ScaleCharToQuantum((unsigned char)\n alpha));\n q++;\n }\n }\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n return MagickFalse;\n }\n }\n \n SkipDXTMipmaps(image, dds_info, 16);\n return MagickTrue;\n }\n", + "target": " static MagickBooleanType ReadDXT5(Image *image, DDSInfo *dds_info,\n ExceptionInfo *exception)\n{\n DDSColors\n colors;\n\n ssize_t\n j,\n y;\n\n MagickSizeType\n alpha_bits;\n\n PixelPacket\n *q;\n\n register ssize_t\n i,\n x;\n\n unsigned char\n a0,\n a1;\n\n size_t\n alpha,\n bits,\n code,\n alpha_code;\n\n unsigned short\n c0,\n c1;\n\n for (y = 0; y < (ssize_t) dds_info->height; y += 4)\n {\n for (x = 0; x < (ssize_t) dds_info->width; x += 4)\n {\n /* Get 4x4 patch of pixels to write on */\n q = QueueAuthenticPixels(image, x, y, MagickMin(4, dds_info->width - x),\n MagickMin(4, dds_info->height - y),exception);\n \n if (q == (PixelPacket *) NULL)\n return MagickFalse;\n\n /* Read alpha values (8 bytes) */\n a0 = (unsigned char) ReadBlobByte(image);\n a1 = (unsigned char) ReadBlobByte(image);\n\n alpha_bits = (MagickSizeType)ReadBlobLSBLong(image);\n alpha_bits = alpha_bits | ((MagickSizeType)ReadBlobLSBShort(image) << 32);\n\n /* Read 8 bytes of data from the image */\n c0 = ReadBlobLSBShort(image);\n c1 = ReadBlobLSBShort(image);\n bits = ReadBlobLSBLong(image);\n\n CalculateColors(c0, c1, &colors, MagickTrue);\n\n /* Write the pixels */\n for (j = 0; j < 4; j++)\n {\n for (i = 0; i < 4; i++)\n {\n if ((x + i) < (ssize_t) dds_info->width && (y + j) < (ssize_t) dds_info->height)\n {\n code = (bits >> ((4*j+i)*2)) & 0x3;\n SetPixelRed(q,ScaleCharToQuantum(colors.r[code]));\n SetPixelGreen(q,ScaleCharToQuantum(colors.g[code]));\n SetPixelBlue(q,ScaleCharToQuantum(colors.b[code]));\n /* Extract alpha value */\n alpha_code = (size_t) (alpha_bits >> (3*(4*j+i))) & 0x7;\n if (alpha_code == 0)\n alpha = a0;\n else if (alpha_code == 1)\n alpha = a1;\n else if (a0 > a1)\n alpha = ((8-alpha_code) * a0 + (alpha_code-1) * a1) / 7;\n else if (alpha_code == 6)\n alpha = 0;\n else if (alpha_code == 7)\n alpha = 255;\n else\n alpha = (((6-alpha_code) * a0 + (alpha_code-1) * a1) / 5);\n SetPixelAlpha(q,ScaleCharToQuantum((unsigned char)\n alpha));\n q++;\n }\n }\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n return MagickFalse;\n }\n }\n \n return(SkipDXTMipmaps(image,dds_info,16,exception));\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#14-15e31f919ed2", + "input": "def create_playlist(name):\n db = connect_to_database()\n cursor = db.cursor()\n cursor.execute(\n \"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);\".format(name=name))\n db.commit()\n db.close()", + "target": "def create_playlist(name):\n db = connect_to_database()\n cursor = db.cursor()\n cursor.execute(\n \"INSERT INTO playlist (name, video_position) VALUES(%s, 0);\", (name,))\n db.commit()\n db.close()", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#630f9c33c23639de85c3fd306b209b538b73b4c9", + "input": "static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements, int objprops)\n{\n\twhile (elements-- > 0) {\n\t\tzval *key, *data, **old_data;\n\n\t\tALLOC_INIT_ZVAL(key);\n\n\t\tif (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\treturn 0;\n\t\t}\n\n\t\tALLOC_INIT_ZVAL(data);\n\n\t\tif (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\tzval_dtor(data);\n\t\t\tFREE_ZVAL(data);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (!objprops) {\n\t\t\tswitch (Z_TYPE_P(key)) {\n\t\t\tcase IS_LONG:\n\t\t\t\tif (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) {\n\t\t\t\t\tvar_push_dtor(var_hash, old_data);\n\t\t\t\t}\n\t\t\t\tzend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);\n\t\t\t\tbreak;\n\t\t\tcase IS_STRING:\n\t\t\t\tif (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {\n\t\t\t\t\tvar_push_dtor(var_hash, old_data);\n\t\t\t\t}\n\t\t\t\tzend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);\n\t\t\t\tbreak;\n\t\t\t}\n } else {\n /* object properties should include no integers */\n convert_to_string(key);\n zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data,\n sizeof data, NULL);\n }\n\n\t\tif (elements && *(*p-1) != ';' && *(*p-1) != '}') {\n\t\t\t(*p)--;\n\t\t\treturn 0;\n\t\t}\n\t}\n", + "target": "static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements, int objprops)\n{\n\twhile (elements-- > 0) {\n\t\tzval *key, *data, **old_data;\n\n\t\tALLOC_INIT_ZVAL(key);\n\n\t\tif (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\treturn 0;\n\t\t}\n\n\t\tALLOC_INIT_ZVAL(data);\n\n\t\tif (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\tzval_dtor(data);\n\t\t\tFREE_ZVAL(data);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (!objprops) {\n\t\t\tswitch (Z_TYPE_P(key)) {\n\t\t\tcase IS_LONG:\n\t\t\t\tif (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) {\n\t\t\t\t\tvar_push_dtor(var_hash, old_data);\n\t\t\t\t}\n\t\t\t\tzend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);\n\t\t\t\tbreak;\n\t\t\tcase IS_STRING:\n\t\t\t\tif (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {\n\t\t\t\t\tvar_push_dtor(var_hash, old_data);\n\t\t\t\t}\n\t\t\t\tzend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);\n\t\t\t\tbreak;\n\t\t\t}\n } else {\n /* object properties should include no integers */\n convert_to_string(key);\n if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {\n var_push_dtor(var_hash, old_data);\n }\n zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data,\n sizeof data, NULL);\n }\n\n\t\tif (elements && *(*p-1) != ';' && *(*p-1) != '}') {\n\t\t\t(*p)--;\n\t\t\treturn 0;\n\t\t}\n\t}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cb66ddd156203daefb8d71158036b27b0e2caf63", + "input": "static void rds_tcp_kill_sock(struct net *net)\n{\n\tstruct rds_tcp_connection *tc, *_tc;\n\tLIST_HEAD(tmp_list);\n\tstruct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid);\n\tstruct socket *lsock = rtn->rds_tcp_listen_sock;\n\n\trtn->rds_tcp_listen_sock = NULL;\n\trds_tcp_listen_stop(lsock, &rtn->rds_tcp_accept_w);\n\tspin_lock_irq(&rds_tcp_conn_lock);\n \tlist_for_each_entry_safe(tc, _tc, &rds_tcp_conn_list, t_tcp_node) {\n \t\tstruct net *c_net = read_pnet(&tc->t_cpath->cp_conn->c_net);\n \n\t\tif (net != c_net || !tc->t_sock)\n \t\t\tcontinue;\n \t\tif (!list_has_conn(&tmp_list, tc->t_cpath->cp_conn)) {\n \t\t\tlist_move_tail(&tc->t_tcp_node, &tmp_list);\n\t\t} else {\n\t\t\tlist_del(&tc->t_tcp_node);\n\t\t\ttc->t_tcp_node_detached = true;\n\t\t}\n\t}\n\tspin_unlock_irq(&rds_tcp_conn_lock);\n\tlist_for_each_entry_safe(tc, _tc, &tmp_list, t_tcp_node)\n\t\trds_conn_destroy(tc->t_cpath->cp_conn);\n}\n", + "target": "static void rds_tcp_kill_sock(struct net *net)\n{\n\tstruct rds_tcp_connection *tc, *_tc;\n\tLIST_HEAD(tmp_list);\n\tstruct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid);\n\tstruct socket *lsock = rtn->rds_tcp_listen_sock;\n\n\trtn->rds_tcp_listen_sock = NULL;\n\trds_tcp_listen_stop(lsock, &rtn->rds_tcp_accept_w);\n\tspin_lock_irq(&rds_tcp_conn_lock);\n \tlist_for_each_entry_safe(tc, _tc, &rds_tcp_conn_list, t_tcp_node) {\n \t\tstruct net *c_net = read_pnet(&tc->t_cpath->cp_conn->c_net);\n \n\t\tif (net != c_net)\n \t\t\tcontinue;\n \t\tif (!list_has_conn(&tmp_list, tc->t_cpath->cp_conn)) {\n \t\t\tlist_move_tail(&tc->t_tcp_node, &tmp_list);\n\t\t} else {\n\t\t\tlist_del(&tc->t_tcp_node);\n\t\t\ttc->t_tcp_node_detached = true;\n\t\t}\n\t}\n\tspin_unlock_irq(&rds_tcp_conn_lock);\n\tlist_for_each_entry_safe(tc, _tc, &tmp_list, t_tcp_node)\n\t\trds_conn_destroy(tc->t_cpath->cp_conn);\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8176cced706b5e5d15887584150764894e94e02f", + "input": " static int perf_swevent_init(struct perf_event *event)\n {\n\tint event_id = event->attr.config;\n \n \tif (event->attr.type != PERF_TYPE_SOFTWARE)\n \t\treturn -ENOENT;\n\n\t/*\n\t * no branch sampling for software events\n\t */\n\tif (has_branch_stack(event))\n\t\treturn -EOPNOTSUPP;\n\n\tswitch (event_id) {\n\tcase PERF_COUNT_SW_CPU_CLOCK:\n\tcase PERF_COUNT_SW_TASK_CLOCK:\n\t\treturn -ENOENT;\n\n\tdefault:\n\t\tbreak;\n\t}\n\n\tif (event_id >= PERF_COUNT_SW_MAX)\n\t\treturn -ENOENT;\n\n\tif (!event->parent) {\n\t\tint err;\n\n\t\terr = swevent_hlist_get(event);\n\t\tif (err)\n\t\t\treturn err;\n\n\t\tstatic_key_slow_inc(&perf_swevent_enabled[event_id]);\n\t\tevent->destroy = sw_perf_event_destroy;\n\t}\n\n\treturn 0;\n}\n", + "target": " static int perf_swevent_init(struct perf_event *event)\n {\n\tu64 event_id = event->attr.config;\n \n \tif (event->attr.type != PERF_TYPE_SOFTWARE)\n \t\treturn -ENOENT;\n\n\t/*\n\t * no branch sampling for software events\n\t */\n\tif (has_branch_stack(event))\n\t\treturn -EOPNOTSUPP;\n\n\tswitch (event_id) {\n\tcase PERF_COUNT_SW_CPU_CLOCK:\n\tcase PERF_COUNT_SW_TASK_CLOCK:\n\t\treturn -ENOENT;\n\n\tdefault:\n\t\tbreak;\n\t}\n\n\tif (event_id >= PERF_COUNT_SW_MAX)\n\t\treturn -ENOENT;\n\n\tif (!event->parent) {\n\t\tint err;\n\n\t\terr = swevent_hlist_get(event);\n\t\tif (err)\n\t\t\treturn err;\n\n\t\tstatic_key_slow_inc(&perf_swevent_enabled[event_id]);\n\t\tevent->destroy = sw_perf_event_destroy;\n\t}\n\n\treturn 0;\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-022#0-68e32b5cd09e", + "input": "def getKey(client):\n\t\"\"\"Retrieves the specified key for the specified client\n\tReturns an error if the key doesn't exist, obviously.\n\t\"\"\"\n\tglobal SERVER_JWT_PRIVATE_KEY\n\tglobal BAD_REQUEST\n\n\tvalidateClient(client)\n\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\n\t# Keys may only have alpha-numeric names\n\ttry:\n\t\tif re.search('[^a-zA-Z0-9]', token_data['key']):\n\t\t\traise FoxlockError(BAD_REQUEST, 'Invalid key requested')\n\t\trequested_key = open('keys/%s/%s.key' % (client, token_data['key']), 'r').read()\n\texcept KeyError:\n\t\traise FoxlockError(BAD_REQUEST, \"JWT did not contain attribute 'key'\")\n\texcept IOError:\n\t\traise FoxlockError(BAD_REQUEST, \"Key '%s' not found\" % token_data['key'])\n\n\t# Key is returned in a JWT encrypted with the client's public key, so only they can decrypt it\n\tkeytoken = packJWT({'key': requested_key}, SERVER_JWT_PRIVATE_KEY, client_pub_key)\n\n\treturn keytoken", + "target": "def getKey(client):\n\t\"\"\"Retrieves the specified key for the specified client\n\tReturns an error if the key doesn't exist, obviously.\n\t\"\"\"\n\tglobal SERVER_JWT_PRIVATE_KEY\n\tglobal BAD_REQUEST\n\n\tvalidateClient(client)\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateKeyName(token_data['key'])\n\n\t# Keys may only have alpha-numeric names\n\ttry:\n\t\trequested_key = open('keys/%s/%s.key' % (client, token_data['key']), 'r').read()\n\texcept KeyError:\n\t\traise FoxlockError(BAD_REQUEST, \"JWT did not contain attribute 'key'\")\n\texcept IOError:\n\t\traise FoxlockError(BAD_REQUEST, \"Key '%s' not found\" % token_data['key'])\n\n\t# Key is returned in a JWT encrypted with the client's public key, so only they can decrypt it\n\tkeytoken = packJWT({'key': requested_key}, SERVER_JWT_PRIVATE_KEY, client_pub_key)\n\n\treturn keytoken", + "vul_type": "cwe-022", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "cwe-089#5-839c7649fee9", + "input": "@app.route('/players//achievements')\ndef achievements_list_player(player_id):\n \"\"\"Lists the progress of achievements for a player.\n\n :param player_id: ID of the player.\n\n :return:\n If successful, this method returns a response body with the following structure::\n\n {\n \"items\": [\n {\n \"achievement_id\": string,\n \"state\": string,\n \"current_steps\": integer,\n \"create_time\": long,\n \"update_time\": long\n }\n ]\n }\n \"\"\"\n with db.connection:\n cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n cursor.execute(\"\"\"SELECT\n achievement_id,\n current_steps,\n state,\n UNIX_TIMESTAMP(create_time) as create_time,\n UNIX_TIMESTAMP(update_time) as update_time\n FROM player_achievements\n WHERE player_id = '%s'\"\"\" % player_id)\n\n return flask.jsonify(items=cursor.fetchall())", + "target": "@app.route('/players//achievements')\ndef achievements_list_player(player_id):\n \"\"\"Lists the progress of achievements for a player.\n\n :param player_id: ID of the player.\n\n :return:\n If successful, this method returns a response body with the following structure::\n\n {\n \"items\": [\n {\n \"achievement_id\": string,\n \"state\": string,\n \"current_steps\": integer,\n \"create_time\": long,\n \"update_time\": long\n }\n ]\n }\n \"\"\"\n with db.connection:\n cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n cursor.execute(\"\"\"SELECT\n achievement_id,\n current_steps,\n state,\n UNIX_TIMESTAMP(create_time) as create_time,\n UNIX_TIMESTAMP(update_time) as update_time\n FROM player_achievements\n WHERE player_id = %s\"\"\", player_id)\n\n return flask.jsonify(items=cursor.fetchall())", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#8dca25d26c7ca2caf6138267f6f17111212c156e", + "input": "ikev2_ke_print(netdissect_options *ndo, u_char tpay,\n\t\tconst struct isakmp_gen *ext,\n\t\tu_int item_len _U_, const u_char *ep _U_,\n\t\tuint32_t phase _U_, uint32_t doi _U_,\n\t\tuint32_t proto _U_, int depth _U_)\n{\n\tstruct ikev2_ke ke;\n \tconst struct ikev2_ke *k;\n \n \tk = (const struct ikev2_ke *)ext;\n\tND_TCHECK(*ext);\n \tUNALIGNED_MEMCPY(&ke, ext, sizeof(ke));\n \tikev2_pay_print(ndo, NPSTR(tpay), ke.h.critical);\n \n\tND_PRINT((ndo,\" len=%u group=%s\", ntohs(ke.h.len) - 8,\n\t\t STR_OR_ID(ntohs(ke.ke_group), dh_p_map)));\n\n\tif (2 < ndo->ndo_vflag && 8 < ntohs(ke.h.len)) {\n\t\tND_PRINT((ndo,\" \"));\n\t\tif (!rawprint(ndo, (const uint8_t *)(k + 1), ntohs(ke.h.len) - 8))\n\t\t\tgoto trunc;\n\t}\n\treturn (const u_char *)ext + ntohs(ke.h.len);\ntrunc:\n\tND_PRINT((ndo,\" [|%s]\", NPSTR(tpay)));\n\treturn NULL;\n}\n", + "target": "ikev2_ke_print(netdissect_options *ndo, u_char tpay,\n\t\tconst struct isakmp_gen *ext,\n\t\tu_int item_len _U_, const u_char *ep _U_,\n\t\tuint32_t phase _U_, uint32_t doi _U_,\n\t\tuint32_t proto _U_, int depth _U_)\n{\n\tstruct ikev2_ke ke;\n \tconst struct ikev2_ke *k;\n \n \tk = (const struct ikev2_ke *)ext;\n\tND_TCHECK(*k);\n \tUNALIGNED_MEMCPY(&ke, ext, sizeof(ke));\n \tikev2_pay_print(ndo, NPSTR(tpay), ke.h.critical);\n \n\tND_PRINT((ndo,\" len=%u group=%s\", ntohs(ke.h.len) - 8,\n\t\t STR_OR_ID(ntohs(ke.ke_group), dh_p_map)));\n\n\tif (2 < ndo->ndo_vflag && 8 < ntohs(ke.h.len)) {\n\t\tND_PRINT((ndo,\" \"));\n\t\tif (!rawprint(ndo, (const uint8_t *)(k + 1), ntohs(ke.h.len) - 8))\n\t\t\tgoto trunc;\n\t}\n\treturn (const u_char *)ext + ntohs(ke.h.len);\ntrunc:\n\tND_PRINT((ndo,\" [|%s]\", NPSTR(tpay)));\n\treturn NULL;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#1-6f4a009d2b32", + "input": " def add_inverters(self):\n interfaces = self.config.get_connection_interfaces()\n for source in interfaces:\n if source[\"type\"] == \"inverter\":\n\n query = '''\n INSERT OR IGNORE INTO Inverters (\n Serial,\n EToday,\n ETotal\n ) VALUES (\n %s,\n %s,\n %s\n );\n ''' % (source[\"serial_id\"], 0, source[\"prev_etotal\"])\n self.c.execute(query)\n\n query = '''\n UPDATE Inverters\n SET \n Name='%s', \n Type='%s', \n SW_Version='%s', \n Status='%s',\n TimeStamp='%s'\n WHERE Serial='%s';\n ''' % (source[\"name\"], source[\"inverter_type\"], \"s0-bridge v0\", \"OK\", int(datetime.now().timestamp()), source[\"serial_id\"] )\n self.c.execute(query)\n\n self.db.commit()", + "target": " def add_inverters(self):\n interfaces = self.config.get_connection_interfaces()\n for source in interfaces:\n if source[\"type\"] == \"inverter\":\n\n query = '''\n INSERT OR IGNORE INTO Inverters (\n Serial,\n EToday,\n ETotal\n ) VALUES (\n ?,\n ?,\n ?\n );\n '''\n self.c.execute(query, (source[\"serial_id\"], 0, source[\"prev_etotal\"]))\n\n query = '''\n UPDATE Inverters\n SET \n Name=?, \n Type=?, \n SW_Version=?, \n Status=?,\n TimeStamp=?\n WHERE Serial=?;\n '''\n self.c.execute(query, (source[\"name\"], source[\"inverter_type\"], \"s0-bridge v0\", \"OK\", int(datetime.now().timestamp()), source[\"serial_id\"] ))\n\n self.db.commit()", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#415ab35a441eca767d033a2702223e785b9d5190", + "input": "static int ne2000_buffer_full(NE2000State *s)\n {\n int avail, index, boundary;\n \n index = s->curpag << 8;\n boundary = s->boundary << 8;\n if (index < boundary)\n return 1;\n return 0;\n}\n", + "target": "static int ne2000_buffer_full(NE2000State *s)\n {\n int avail, index, boundary;\n \n if (s->stop <= s->start) {\n return 1;\n }\n\n index = s->curpag << 8;\n boundary = s->boundary << 8;\n if (index < boundary)\n return 1;\n return 0;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b51b33f2bc5d1497ddf5bd107f791c101695000d", + "input": "spnego_gss_unwrap_iov(OM_uint32 *minor_status,\n\t\t gss_ctx_id_t context_handle,\n\t\t int *conf_state,\n\t\t gss_qop_t *qop_state,\n\t\t gss_iov_buffer_desc *iov,\n \t\t int iov_count)\n {\n \tOM_uint32 ret;\n \tret = gss_unwrap_iov(minor_status,\n\t\t\t context_handle,\n \t\t\t conf_state,\n \t\t\t qop_state,\n \t\t\t iov,\n\t\t\t iov_count);\n\treturn (ret);\n}\n", + "target": "spnego_gss_unwrap_iov(OM_uint32 *minor_status,\n\t\t gss_ctx_id_t context_handle,\n\t\t int *conf_state,\n\t\t gss_qop_t *qop_state,\n\t\t gss_iov_buffer_desc *iov,\n \t\t int iov_count)\n {\n \tOM_uint32 ret;\n\tspnego_gss_ctx_id_t sc = (spnego_gss_ctx_id_t)context_handle;\n\n\tif (sc->ctx_handle == GSS_C_NO_CONTEXT)\n\t\treturn (GSS_S_NO_CONTEXT);\n\n \tret = gss_unwrap_iov(minor_status,\n\t\t\t sc->ctx_handle,\n \t\t\t conf_state,\n \t\t\t qop_state,\n \t\t\t iov,\n\t\t\t iov_count);\n\treturn (ret);\n}\n", + "vul_type": "cwe-18", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#360e95d45ac4123255a4c796db96337f332160ad#diff-d643a0fa169471dbf2912f4866dc49c5", + "input": "int read_file(struct sc_card *card, char *str_path, unsigned char **data, size_t *data_len)\n{\n\tstruct sc_path path;\n\tstruct sc_file *file;\n\tunsigned char *p;\n\tint ok = 0;\n\tint r;\n\tsize_t len;\n\n\tsc_format_path(str_path, &path);\n\tif (SC_SUCCESS != sc_select_file(card, &path, &file)) {\n \t\tgoto err;\n \t}\n \n\tlen = file ? file->size : 4096;\n \tp = realloc(*data, len);\n \tif (!p) {\n \t\tgoto err;\n\t}\n\t*data = p;\n\t*data_len = len;\n\n\tr = sc_read_binary(card, 0, p, len, 0);\n\tif (r < 0)\n\t\tgoto err;\n\n\t*data_len = r;\n\tok = 1;\n\nerr:\n\tsc_file_free(file);\n\n\treturn ok;\n}\n", + "target": "int read_file(struct sc_card *card, char *str_path, unsigned char **data, size_t *data_len)\n{\n\tstruct sc_path path;\n\tstruct sc_file *file;\n\tunsigned char *p;\n\tint ok = 0;\n\tint r;\n\tsize_t len;\n\n\tsc_format_path(str_path, &path);\n\tif (SC_SUCCESS != sc_select_file(card, &path, &file)) {\n \t\tgoto err;\n \t}\n \n\tlen = file && file->size > 0 ? file->size : 4096;\n \tp = realloc(*data, len);\n \tif (!p) {\n \t\tgoto err;\n\t}\n\t*data = p;\n\t*data_len = len;\n\n\tr = sc_read_binary(card, 0, p, len, 0);\n\tif (r < 0)\n\t\tgoto err;\n\n\t*data_len = r;\n\tok = 1;\n\nerr:\n\tsc_file_free(file);\n\n\treturn ok;\n}\n", + "vul_type": "cwe-415", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "void Chapters::Atom::ShallowCopy(Atom& rhs) const\n{\n rhs.m_string_uid = m_string_uid;\n rhs.m_uid = m_uid;\n rhs.m_start_timecode = m_start_timecode;\n rhs.m_stop_timecode = m_stop_timecode;\n rhs.m_displays = m_displays;\n rhs.m_displays_size = m_displays_size;\n rhs.m_displays_count = m_displays_count;\n}\n", + "target": "void Chapters::Atom::ShallowCopy(Atom& rhs) const\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f0d1bec9d58d4c038d0ac958c9af82be6eb18045", + "input": "pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len,\n\t\t\tint atomic)\n{\n\tunsigned long copy;\n\twhile (len > 0) {\n\t\twhile (!iov->iov_len)\n\t\t\tiov++;\n\t\tcopy = min_t(unsigned long, len, iov->iov_len);\n\t\tif (atomic) {\n\t\t\tif (__copy_from_user_inatomic(to, iov->iov_base, copy))\n\t\t\t\treturn -EFAULT;\n\t\t} else {\n\t\t\tif (copy_from_user(to, iov->iov_base, copy))\n\t\t\t\treturn -EFAULT;\n\t\t}\n\t\tto += copy;\n\t\tlen -= copy;\n\t\tiov->iov_base += copy;\n\t\tiov->iov_len -= copy;\n\t}\n\treturn 0;\n}\n", + "target": "pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len,\n", + "vul_type": "cwe-17", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dd3b6fe574edad231c01c78e4647a74c38dc4178", + "input": " void GDataDirectoryService::InitializeRootEntry(const std::string& root_id) {\n root_.reset(new GDataDirectory(NULL, this));\n root_->set_title(kGDataRootDirectory);\n root_->SetBaseNameFromTitle();\n root_->set_resource_id(root_id);\n AddEntryToResourceMap(root_.get());\n}\n", + "target": " void GDataDirectoryService::InitializeRootEntry(const std::string& root_id) {\n root_.reset(CreateGDataDirectory());\n root_->set_title(kGDataRootDirectory);\n root_->SetBaseNameFromTitle();\n root_->set_resource_id(root_id);\n AddEntryToResourceMap(root_.get());\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8f9b304c4f6c0a98dafa61b2c0e4beb3b70e4c84", + "input": " SchedulerObject::hold(std::string key, std::string &reason, std::string &text)\n {\n PROC_ID id = getProcByString(key.c_str());\n if (id.cluster < 0 || id.proc < 0) {\n dprintf(D_FULLDEBUG, \"Hold: Failed to parse id: %s\\n\", key.c_str());\n text = \"Invalid Id\";\n return false;\n\t}\n\n\tif (!holdJob(id.cluster,\n\t\t\t\t id.proc,\n\t\t\t\t reason.c_str(),\n\t\t\t\t true, // Always perform this action within a transaction\n\t\t\t\t true, // Always notify the shadow of the hold\n\t\t\t\t false, // Do not email the user about this action\n\t\t\t\t false, // Do not email admin about this action\n\t\t\t\t false // This is not a system related (internal) hold\n\t\t\t\t )) {\n\t\ttext = \"Failed to hold job\";\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n", + "target": " SchedulerObject::hold(std::string key, std::string &reason, std::string &text)\n {\n PROC_ID id = getProcByString(key.c_str());\n if (id.cluster <= 0 || id.proc < 0) {\n dprintf(D_FULLDEBUG, \"Hold: Failed to parse id: %s\\n\", key.c_str());\n text = \"Invalid Id\";\n return false;\n\t}\n\n\tif (!holdJob(id.cluster,\n\t\t\t\t id.proc,\n\t\t\t\t reason.c_str(),\n\t\t\t\t true, // Always perform this action within a transaction\n\t\t\t\t true, // Always notify the shadow of the hold\n\t\t\t\t false, // Do not email the user about this action\n\t\t\t\t false, // Do not email admin about this action\n\t\t\t\t false // This is not a system related (internal) hold\n\t\t\t\t )) {\n\t\ttext = \"Failed to hold job\";\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n", + "vul_type": "cwe-20", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c277159986c80142180fbe5efb256bbf3bdf3edc", + "input": " static opj_bool pi_next_lrcp(opj_pi_iterator_t * pi)\n {\n opj_pi_comp_t *comp = NULL;\n opj_pi_resolution_t *res = NULL;\n long index = 0;\n\n if (!pi->first) {\n comp = &pi->comps[pi->compno];\n res = &comp->resolutions[pi->resno];\n goto LABEL_SKIP;\n } else {\n pi->first = 0;\n }\n\n for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {\n for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1;\n pi->resno++) {\n for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {\n comp = &pi->comps[pi->compno];\n if (pi->resno >= comp->numresolutions) {\n continue;\n }\n res = &comp->resolutions[pi->resno];\n if (!pi->tp_on) {\n pi->poc.precno1 = res->pw * res->ph;\n }\n for (pi->precno = pi->poc.precno0; pi->precno < pi->poc.precno1; pi->precno++) {\n index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *\n pi->step_c + pi->precno * pi->step_p;\n if (!pi->include[index]) {\n pi->include[index] = 1;\n return OPJ_TRUE;\n }\nLABEL_SKIP:\n ;\n }\n }\n }\n }\n\n return OPJ_FALSE;\n}\n", + "target": " static opj_bool pi_next_lrcp(opj_pi_iterator_t * pi)\n {\n opj_pi_comp_t *comp = NULL;\n opj_pi_resolution_t *res = NULL;\n long index = 0;\n\n if (!pi->first) {\n comp = &pi->comps[pi->compno];\n res = &comp->resolutions[pi->resno];\n goto LABEL_SKIP;\n } else {\n pi->first = 0;\n }\n\n for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {\n for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1;\n pi->resno++) {\n for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {\n comp = &pi->comps[pi->compno];\n if (pi->resno >= comp->numresolutions) {\n continue;\n }\n res = &comp->resolutions[pi->resno];\n if (!pi->tp_on) {\n pi->poc.precno1 = res->pw * res->ph;\n }\n for (pi->precno = pi->poc.precno0; pi->precno < pi->poc.precno1; pi->precno++) {\n index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno *\n pi->step_c + pi->precno * pi->step_p;\n /* Avoids index out of bounds access with include*/\n if (index >= pi->include_size) {\n opj_pi_emit_error(pi, \"Invalid access to pi->include\");\n return OPJ_FALSE;\n }\n if (!pi->include[index]) {\n pi->include[index] = 1;\n return OPJ_TRUE;\n }\nLABEL_SKIP:\n ;\n }\n }\n }\n }\n\n return OPJ_FALSE;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c0569cc04741cccf6548c2169fcc1609d958523f", + "input": "LazyBackgroundPageNativeHandler::LazyBackgroundPageNativeHandler(\n ScriptContext* context)\n : ObjectBackedNativeHandler(context) {\n RouteFunction(\n \"IncrementKeepaliveCount\",\n base::Bind(&LazyBackgroundPageNativeHandler::IncrementKeepaliveCount,\n base::Unretained(this)));\n RouteFunction(\n \"DecrementKeepaliveCount\",\n base::Bind(&LazyBackgroundPageNativeHandler::DecrementKeepaliveCount,\n base::Unretained(this)));\n }\n", + "target": "LazyBackgroundPageNativeHandler::LazyBackgroundPageNativeHandler(\n ScriptContext* context)\n : ObjectBackedNativeHandler(context) {\n RouteFunction(\n \"IncrementKeepaliveCount\", \"tts\",\n base::Bind(&LazyBackgroundPageNativeHandler::IncrementKeepaliveCount,\n base::Unretained(this)));\n RouteFunction(\n \"DecrementKeepaliveCount\", \"tts\",\n base::Bind(&LazyBackgroundPageNativeHandler::DecrementKeepaliveCount,\n base::Unretained(this)));\n }\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1", + "input": "static void spl_filesystem_tree_it_rewind(zend_object_iterator *iter TSRMLS_DC)\n {\n \tspl_filesystem_iterator *iterator = (spl_filesystem_iterator *)iter;\n \tspl_filesystem_object *object = spl_filesystem_iterator_to_object(iterator);\n \tobject->u.dir.index = 0;\n \tif (object->u.dir.dirp) {\n \t\tphp_stream_rewinddir(object->u.dir.dirp);\n\t}\n\tdo {\n\t\tspl_filesystem_dir_read(object TSRMLS_CC);\n\t} while (spl_filesystem_is_dot(object->u.dir.entry.d_name));\n\tif (iterator->current) {\n\t\tzval_ptr_dtor(&iterator->current);\n\t\titerator->current = NULL;\n\t}\n}\n", + "target": "static void spl_filesystem_tree_it_rewind(zend_object_iterator *iter TSRMLS_DC)\n {\n \tspl_filesystem_iterator *iterator = (spl_filesystem_iterator *)iter;\n \tspl_filesystem_object *object = spl_filesystem_iterator_to_object(iterator);\n\n \tobject->u.dir.index = 0;\n \tif (object->u.dir.dirp) {\n \t\tphp_stream_rewinddir(object->u.dir.dirp);\n\t}\n\tdo {\n\t\tspl_filesystem_dir_read(object TSRMLS_CC);\n\t} while (spl_filesystem_is_dot(object->u.dir.entry.d_name));\n\tif (iterator->current) {\n\t\tzval_ptr_dtor(&iterator->current);\n\t\titerator->current = NULL;\n\t}\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#58b6dde319c301b0eae27d12e2a659e067d80558", + "input": " int main()\n {\n gdImagePtr im;\n char *buffer;\n size_t size;\n \n size = read_test_file(&buffer, \"heap_overflow.tga\");\n im = gdImageCreateFromTgaPtr(size, (void *) buffer);\n gdTestAssert(im == NULL);\n free(buffer);\n return gdNumFailures();\n }\n", + "target": " int main()\n{\n check_file(\"heap_overflow_1.tga\");\n check_file(\"heap_overflow_2.tga\");\n\n return gdNumFailures();\n}\n\n\nstatic void check_file(char *basename)\n {\n gdImagePtr im;\n char *buffer;\n size_t size;\n \n size = read_test_file(&buffer, basename);\n im = gdImageCreateFromTgaPtr(size, (void *) buffer);\n gdTestAssert(im == NULL);\n free(buffer);\n }\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f6e9d0d9955e85bdd7540b251cd50d598dacc5e6", + "input": "static Image *ReadSTEGANOImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n#define GetBit(alpha,i) MagickMin((((size_t) (alpha) >> (size_t) \\\n (i)) & 0x01),16)\n#define SetBit(indexes,i,set) SetPixelIndex(indexes,((set) != 0 ? \\\n (size_t) GetPixelIndex(indexes) | (one << (size_t) (i)) : (size_t) \\\n GetPixelIndex(indexes) & ~(one << (size_t) (i))))\n\n Image\n *image,\n *watermark;\n\n ImageInfo\n *read_info;\n\n int\n c;\n\n MagickBooleanType\n status;\n\n PixelPacket\n pixel;\n\n register IndexPacket\n *indexes;\n\n register PixelPacket\n *q;\n\n register ssize_t\n x;\n\n size_t\n depth,\n one;\n\n ssize_t\n i,\n j,\n k,\n y;\n\n /*\n Initialize Image structure.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n one=1;\n image=AcquireImage(image_info);\n if ((image->columns == 0) || (image->rows == 0))\n ThrowReaderException(OptionError,\"MustSpecifyImageSize\");\n read_info=CloneImageInfo(image_info);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n *read_info->magick='\\0';\n watermark=ReadImage(read_info,exception);\n read_info=DestroyImageInfo(read_info);\n if (watermark == (Image *) NULL)\n return((Image *) NULL);\n watermark->depth=MAGICKCORE_QUANTUM_DEPTH;\n if (AcquireImageColormap(image,MaxColormapSize) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n /*\n Get hidden watermark from low-order bits of image.\n */\n c=0;\n i=0;\n j=0;\n i=(ssize_t) (watermark->depth-1);\n depth=watermark->depth;\n for (k=image->offset; (i >= 0) && (j < (ssize_t) depth); i--)\n {\n for (y=0; (y < (ssize_t) image->rows) && (j < (ssize_t) depth); y++)\n {\n x=0;\n for ( ; (x < (ssize_t) image->columns) && (j < (ssize_t) depth); x++)\n {\n if ((k/(ssize_t) watermark->columns) >= (ssize_t) watermark->rows)\n break;\n (void) GetOneVirtualPixel(watermark,k % (ssize_t) watermark->columns,\n k/(ssize_t) watermark->columns,&pixel,exception);\n q=GetAuthenticPixels(image,x,y,1,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n switch (c)\n {\n case 0:\n {\n SetBit(indexes,i,GetBit(pixel.red,j));\n break;\n }\n case 1:\n {\n SetBit(indexes,i,GetBit(pixel.green,j));\n break;\n }\n case 2:\n {\n SetBit(indexes,i,GetBit(pixel.blue,j));\n break;\n }\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n c++;\n if (c == 3)\n c=0;\n k++;\n if (k == (ssize_t) (watermark->columns*watermark->columns))\n k=0;\n if (k == image->offset)\n j++;\n }\n }\n status=SetImageProgress(image,LoadImagesTag,(MagickOffsetType) i,depth);\n if (status == MagickFalse)\n break;\n }\n watermark=DestroyImage(watermark);\n (void) SyncImage(image);\n return(GetFirstImageInList(image));\n}\n", + "target": "static Image *ReadSTEGANOImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n#define GetBit(alpha,i) MagickMin((((size_t) (alpha) >> (size_t) \\\n (i)) & 0x01),16)\n#define SetBit(indexes,i,set) SetPixelIndex(indexes,((set) != 0 ? \\\n (size_t) GetPixelIndex(indexes) | (one << (size_t) (i)) : (size_t) \\\n GetPixelIndex(indexes) & ~(one << (size_t) (i))))\n\n Image\n *image,\n *watermark;\n\n ImageInfo\n *read_info;\n\n int\n c;\n\n MagickBooleanType\n status;\n\n PixelPacket\n pixel;\n\n register IndexPacket\n *indexes;\n\n register PixelPacket\n *q;\n\n register ssize_t\n x;\n\n size_t\n depth,\n one;\n\n ssize_t\n i,\n j,\n k,\n y;\n\n /*\n Initialize Image structure.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n one=1;\n image=AcquireImage(image_info);\n if ((image->columns == 0) || (image->rows == 0))\n ThrowReaderException(OptionError,\"MustSpecifyImageSize\");\n read_info=CloneImageInfo(image_info);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n *read_info->magick='\\0';\n watermark=ReadImage(read_info,exception);\n read_info=DestroyImageInfo(read_info);\n if (watermark == (Image *) NULL)\n return((Image *) NULL);\n watermark->depth=MAGICKCORE_QUANTUM_DEPTH;\n if (AcquireImageColormap(image,MaxColormapSize) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n /*\n Get hidden watermark from low-order bits of image.\n */\n c=0;\n i=0;\n j=0;\n i=(ssize_t) (watermark->depth-1);\n depth=watermark->depth;\n for (k=image->offset; (i >= 0) && (j < (ssize_t) depth); i--)\n {\n for (y=0; (y < (ssize_t) image->rows) && (j < (ssize_t) depth); y++)\n {\n x=0;\n for ( ; (x < (ssize_t) image->columns) && (j < (ssize_t) depth); x++)\n {\n if ((k/(ssize_t) watermark->columns) >= (ssize_t) watermark->rows)\n break;\n (void) GetOneVirtualPixel(watermark,k % (ssize_t) watermark->columns,\n k/(ssize_t) watermark->columns,&pixel,exception);\n q=GetAuthenticPixels(image,x,y,1,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n switch (c)\n {\n case 0:\n {\n SetBit(indexes,i,GetBit(pixel.red,j));\n break;\n }\n case 1:\n {\n SetBit(indexes,i,GetBit(pixel.green,j));\n break;\n }\n case 2:\n {\n SetBit(indexes,i,GetBit(pixel.blue,j));\n break;\n }\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n c++;\n if (c == 3)\n c=0;\n k++;\n if (k == (ssize_t) (watermark->columns*watermark->columns))\n k=0;\n if (k == image->offset)\n j++;\n }\n }\n status=SetImageProgress(image,LoadImagesTag,(MagickOffsetType) i,depth);\n if (status == MagickFalse)\n break;\n }\n watermark=DestroyImage(watermark);\n (void) SyncImage(image);\n return(GetFirstImageInList(image));\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fc81fcf38edd250876cc384a6ed5567e1b2999e4", + "input": "void V8LazyEventListener::prepareListenerObject(ExecutionContext* executionContext)\n{\n if (!executionContext)\n return;\n\n v8::HandleScope handleScope(toIsolate(executionContext));\n v8::Local v8Context = toV8Context(executionContext, world());\n if (v8Context.IsEmpty())\n return;\n ScriptState* scriptState = ScriptState::from(v8Context);\n if (!scriptState->contextIsValid())\n return;\n \n if (executionContext->isDocument() && !toDocument(executionContext)->allowInlineEventHandlers(m_node, this, m_sourceURL, m_position.m_line)) {\n clearListenerObject();\n return;\n }\n \n if (hasExistingListenerObject())\n return;\n \n ASSERT(executionContext->isDocument());\n ScriptState::Scope scope(scriptState);\n String listenerSource = InspectorInstrumentation::preprocessEventListener(toDocument(executionContext)->frame(), m_code, m_sourceURL, m_functionName);\n \n String code = \"(function() {\"\n \"with (this[2]) {\"\n \"with (this[1]) {\"\n \"with (this[0]) {\"\n \"return function(\" + m_eventParameterName + \") {\" +\n listenerSource + \"\\n\" // Insert '\\n' otherwise //-style comments could break the handler.\n \"};\"\n \"}}}})\";\n\n v8::Handle codeExternalString = v8String(isolate(), code);\n\n v8::Local result = V8ScriptRunner::compileAndRunInternalScript(codeExternalString, isolate(), m_sourceURL, m_position);\n if (result.IsEmpty())\n return;\n \n ASSERT(result->IsFunction());\n v8::Local intermediateFunction = result.As();\n \n HTMLFormElement* formElement = 0;\n if (m_node && m_node->isHTMLElement())\n formElement = toHTMLElement(m_node)->formOwner();\n\n v8::Handle nodeWrapper = toObjectWrapper(m_node, scriptState);\n v8::Handle formWrapper = toObjectWrapper(formElement, scriptState);\n v8::Handle documentWrapper = toObjectWrapper(m_node ? m_node->ownerDocument() : 0, scriptState);\n\n v8::Local thisObject = v8::Object::New(isolate());\n if (thisObject.IsEmpty())\n return;\n if (!thisObject->ForceSet(v8::Integer::New(isolate(), 0), nodeWrapper))\n return;\n if (!thisObject->ForceSet(v8::Integer::New(isolate(), 1), formWrapper))\n return;\n if (!thisObject->ForceSet(v8::Integer::New(isolate(), 2), documentWrapper))\n return;\n\n v8::Local innerValue = V8ScriptRunner::callInternalFunction(intermediateFunction, thisObject, 0, 0, isolate());\n if (innerValue.IsEmpty() || !innerValue->IsFunction())\n return;\n\n v8::Local wrappedFunction = innerValue.As();\n\n v8::Local toStringFunction = v8::Function::New(isolate(), V8LazyEventListenerToString);\n ASSERT(!toStringFunction.IsEmpty());\n String toStringString = \"function \" + m_functionName + \"(\" + m_eventParameterName + \") {\\n \" + m_code + \"\\n}\";\n V8HiddenValue::setHiddenValue(isolate(), wrappedFunction, V8HiddenValue::toStringString(isolate()), v8String(isolate(), toStringString));\n wrappedFunction->Set(v8AtomicString(isolate(), \"toString\"), toStringFunction);\n wrappedFunction->SetName(v8String(isolate(), m_functionName));\n\n\n setListenerObject(wrappedFunction);\n}\n", + "target": "void V8LazyEventListener::prepareListenerObject(ExecutionContext* executionContext)\n{\n if (!executionContext)\n return;\n\n v8::HandleScope handleScope(toIsolate(executionContext));\n v8::Local v8Context = toV8Context(executionContext, world());\n if (v8Context.IsEmpty())\n return;\n ScriptState* scriptState = ScriptState::from(v8Context);\n if (!scriptState->contextIsValid())\n return;\n \n if (!executionContext->isDocument())\n return;\n\n if (!toDocument(executionContext)->allowInlineEventHandlers(m_node, this, m_sourceURL, m_position.m_line)) {\n clearListenerObject();\n return;\n }\n \n if (hasExistingListenerObject())\n return;\n \n ScriptState::Scope scope(scriptState);\n String listenerSource = InspectorInstrumentation::preprocessEventListener(toDocument(executionContext)->frame(), m_code, m_sourceURL, m_functionName);\n \n String code = \"(function() {\"\n \"with (this[2]) {\"\n \"with (this[1]) {\"\n \"with (this[0]) {\"\n \"return function(\" + m_eventParameterName + \") {\" +\n listenerSource + \"\\n\" // Insert '\\n' otherwise //-style comments could break the handler.\n \"};\"\n \"}}}})\";\n\n v8::Handle codeExternalString = v8String(isolate(), code);\n\n v8::Local result = V8ScriptRunner::compileAndRunInternalScript(codeExternalString, isolate(), m_sourceURL, m_position);\n if (result.IsEmpty())\n return;\n \n if (!result->IsFunction())\n return;\n v8::Local intermediateFunction = result.As();\n \n HTMLFormElement* formElement = 0;\n if (m_node && m_node->isHTMLElement())\n formElement = toHTMLElement(m_node)->formOwner();\n\n v8::Handle nodeWrapper = toObjectWrapper(m_node, scriptState);\n v8::Handle formWrapper = toObjectWrapper(formElement, scriptState);\n v8::Handle documentWrapper = toObjectWrapper(m_node ? m_node->ownerDocument() : 0, scriptState);\n\n v8::Local thisObject = v8::Object::New(isolate());\n if (thisObject.IsEmpty())\n return;\n if (!thisObject->ForceSet(v8::Integer::New(isolate(), 0), nodeWrapper))\n return;\n if (!thisObject->ForceSet(v8::Integer::New(isolate(), 1), formWrapper))\n return;\n if (!thisObject->ForceSet(v8::Integer::New(isolate(), 2), documentWrapper))\n return;\n\n v8::Local innerValue = V8ScriptRunner::callInternalFunction(intermediateFunction, thisObject, 0, 0, isolate());\n if (innerValue.IsEmpty() || !innerValue->IsFunction())\n return;\n\n v8::Local wrappedFunction = innerValue.As();\n\n v8::Local toStringFunction = v8::Function::New(isolate(), V8LazyEventListenerToString);\n ASSERT(!toStringFunction.IsEmpty());\n String toStringString = \"function \" + m_functionName + \"(\" + m_eventParameterName + \") {\\n \" + m_code + \"\\n}\";\n V8HiddenValue::setHiddenValue(isolate(), wrappedFunction, V8HiddenValue::toStringString(isolate()), v8String(isolate(), toStringString));\n wrappedFunction->Set(v8AtomicString(isolate(), \"toString\"), toStringFunction);\n wrappedFunction->SetName(v8String(isolate(), m_functionName));\n\n\n setListenerObject(wrappedFunction);\n}\n", + "vul_type": "cwe-17", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#bcc265132e3d9b62c6c49facbf849575c615d1e3", + "input": "void ScreenOrientationDispatcherHost::OnUnlockRequest(\n RenderFrameHost* render_frame_host) {\n if (current_lock_) {\n NotifyLockError(current_lock_->request_id,\n blink::WebLockOrientationErrorCanceled);\n }\n \n if (!provider_.get())\n return;\n \n provider_->UnlockOrientation();\n}\n", + "target": "void ScreenOrientationDispatcherHost::OnUnlockRequest(\n RenderFrameHost* render_frame_host) {\n if (current_lock_) {\n NotifyLockError(current_lock_->request_id,\n blink::WebLockOrientationErrorCanceled);\n }\n \n if (!provider_)\n return;\n \n provider_->UnlockOrientation();\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ea3d1d84be3d6f97bf50e76511c9e26af6895533", + "input": "void WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) {\n child_process_logging::SetActiveURL(page_url_);\n\n if (!in_destructor_)\n AddRef();\n\n IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateStub, msg)\n IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit)\n IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest)\n IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveResponse, OnDidReceiveResponse)\n IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData)\n IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading)\n IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail)\n IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoadWithReason,\n OnDidFinishLoadWithReason)\n IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus)\n IPC_MESSAGE_HANDLER(PluginMsg_HandleInputEvent, OnHandleInputEvent)\n IPC_MESSAGE_HANDLER(PluginMsg_Paint, OnPaint)\n IPC_MESSAGE_HANDLER(PluginMsg_DidPaint, OnDidPaint)\n IPC_MESSAGE_HANDLER(PluginMsg_Print, OnPrint)\n IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject,\n OnGetPluginScriptableObject)\n IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry)\n IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometrySync, OnUpdateGeometry)\n IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream,\n OnSendJavaScriptStream)\n IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse,\n OnDidReceiveManualResponse)\n IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData)\n IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading,\n OnDidFinishManualLoading)\n IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail)\n IPC_MESSAGE_HANDLER(PluginMsg_InstallMissingPlugin, OnInstallMissingPlugin)\n IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply,\n OnHandleURLRequestReply)\n IPC_MESSAGE_HANDLER(PluginMsg_CreateCommandBuffer,\n OnCreateCommandBuffer)\n IPC_MESSAGE_UNHANDLED_ERROR()\n IPC_END_MESSAGE_MAP()\n\n if (!in_destructor_)\n Release();\n}\n", + "target": "void WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) {\n child_process_logging::SetActiveURL(page_url_);\n\n if (!in_destructor_)\n AddRef();\n\n IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateStub, msg)\n IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit)\n IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest)\n IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveResponse, OnDidReceiveResponse)\n IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData)\n IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading)\n IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail)\n IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoadWithReason,\n OnDidFinishLoadWithReason)\n IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus)\n IPC_MESSAGE_HANDLER(PluginMsg_HandleInputEvent, OnHandleInputEvent)\n IPC_MESSAGE_HANDLER(PluginMsg_Paint, OnPaint)\n IPC_MESSAGE_HANDLER(PluginMsg_DidPaint, OnDidPaint)\n IPC_MESSAGE_HANDLER(PluginMsg_Print, OnPrint)\n IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject,\n OnGetPluginScriptableObject)\n IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry)\n IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometrySync, OnUpdateGeometry)\n IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream,\n OnSendJavaScriptStream)\n IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse,\n OnDidReceiveManualResponse)\n IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData)\n IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading,\n OnDidFinishManualLoading)\n IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail)\n IPC_MESSAGE_HANDLER(PluginMsg_InstallMissingPlugin, OnInstallMissingPlugin)\n IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply,\n OnHandleURLRequestReply)\n IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply,\n OnHTTPRangeRequestReply)\n IPC_MESSAGE_HANDLER(PluginMsg_CreateCommandBuffer,\n OnCreateCommandBuffer)\n IPC_MESSAGE_UNHANDLED_ERROR()\n IPC_END_MESSAGE_MAP()\n\n if (!in_destructor_)\n Release();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#83ed75feba32e46f736fcce0d96a0445f29b96c2", + "input": "chpass_principal_2_svc(chpass_arg *arg, struct svc_req *rqstp)\n {\n static generic_ret ret;\n char *prime_arg;\n gss_buffer_desc client_name,\n service_name;\n OM_uint32 minor_stat;\n kadm5_server_handle_t handle;\n const char *errmsg = NULL;\n\n xdr_free(xdr_generic_ret, &ret);\n\n if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle)))\n goto exit_func;\n\n if ((ret.code = check_handle((void *)handle)))\n goto exit_func;\n\n ret.api_version = handle->api_version;\n\n if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {\n ret.code = KADM5_FAILURE;\n goto exit_func;\n }\n if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) {\n ret.code = KADM5_BAD_PRINCIPAL;\n goto exit_func;\n }\n\n if (cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ)) {\n ret.code = chpass_principal_wrapper_3((void *)handle, arg->princ,\n FALSE, 0, NULL, arg->pass);\n } else if (!(CHANGEPW_SERVICE(rqstp)) &&\n kadm5int_acl_check(handle->context, rqst2name(rqstp),\n ACL_CHANGEPW, arg->princ, NULL)) {\n ret.code = kadm5_chpass_principal((void *)handle, arg->princ,\n arg->pass);\n } else {\n log_unauth(\"kadm5_chpass_principal\", prime_arg,\n &client_name, &service_name, rqstp);\n ret.code = KADM5_AUTH_CHANGEPW;\n }\n\n if (ret.code != KADM5_AUTH_CHANGEPW) {\n if (ret.code != 0)\n errmsg = krb5_get_error_message(handle->context, ret.code);\n\n log_done(\"kadm5_chpass_principal\", prime_arg, errmsg,\n &client_name, &service_name, rqstp);\n\n if (errmsg != NULL)\n krb5_free_error_message(handle->context, errmsg);\n }\n \n free(prime_arg);\n gss_release_buffer(&minor_stat, &client_name);\n gss_release_buffer(&minor_stat, &service_name);\nexit_func:\n free_server_handle(handle);\n return &ret;\n }\n", + "target": "chpass_principal_2_svc(chpass_arg *arg, struct svc_req *rqstp)\n {\n static generic_ret ret;\n char *prime_arg;\n gss_buffer_desc client_name = GSS_C_EMPTY_BUFFER;\n gss_buffer_desc service_name = GSS_C_EMPTY_BUFFER;\n OM_uint32 minor_stat;\n kadm5_server_handle_t handle;\n const char *errmsg = NULL;\n\n xdr_free(xdr_generic_ret, &ret);\n\n if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle)))\n goto exit_func;\n\n if ((ret.code = check_handle((void *)handle)))\n goto exit_func;\n\n ret.api_version = handle->api_version;\n\n if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {\n ret.code = KADM5_FAILURE;\n goto exit_func;\n }\n if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) {\n ret.code = KADM5_BAD_PRINCIPAL;\n goto exit_func;\n }\n\n if (cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ)) {\n ret.code = chpass_principal_wrapper_3((void *)handle, arg->princ,\n FALSE, 0, NULL, arg->pass);\n } else if (!(CHANGEPW_SERVICE(rqstp)) &&\n kadm5int_acl_check(handle->context, rqst2name(rqstp),\n ACL_CHANGEPW, arg->princ, NULL)) {\n ret.code = kadm5_chpass_principal((void *)handle, arg->princ,\n arg->pass);\n } else {\n log_unauth(\"kadm5_chpass_principal\", prime_arg,\n &client_name, &service_name, rqstp);\n ret.code = KADM5_AUTH_CHANGEPW;\n }\n\n if (ret.code != KADM5_AUTH_CHANGEPW) {\n if (ret.code != 0)\n errmsg = krb5_get_error_message(handle->context, ret.code);\n\n log_done(\"kadm5_chpass_principal\", prime_arg, errmsg,\n &client_name, &service_name, rqstp);\n\n if (errmsg != NULL)\n krb5_free_error_message(handle->context, errmsg);\n }\n \n free(prime_arg);\nexit_func:\n gss_release_buffer(&minor_stat, &client_name);\n gss_release_buffer(&minor_stat, &service_name);\n free_server_handle(handle);\n return &ret;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#45f6fad84cc305103b28d73482b344d7f5b76f39", + "input": "ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt)\n{\n\tstruct ipv6_txoptions *opt2;\n\n\topt2 = sock_kmalloc(sk, opt->tot_len, GFP_ATOMIC);\n\tif (opt2) {\n\t\tlong dif = (char *)opt2 - (char *)opt;\n\t\tmemcpy(opt2, opt, opt->tot_len);\n\t\tif (opt2->hopopt)\n\t\t\t*((char **)&opt2->hopopt) += dif;\n\t\tif (opt2->dst0opt)\n\t\t\t*((char **)&opt2->dst0opt) += dif;\n\t\tif (opt2->dst1opt)\n \t\t\t*((char **)&opt2->dst1opt) += dif;\n \t\tif (opt2->srcrt)\n \t\t\t*((char **)&opt2->srcrt) += dif;\n \t}\n \treturn opt2;\n }\n", + "target": "ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt)\n{\n\tstruct ipv6_txoptions *opt2;\n\n\topt2 = sock_kmalloc(sk, opt->tot_len, GFP_ATOMIC);\n\tif (opt2) {\n\t\tlong dif = (char *)opt2 - (char *)opt;\n\t\tmemcpy(opt2, opt, opt->tot_len);\n\t\tif (opt2->hopopt)\n\t\t\t*((char **)&opt2->hopopt) += dif;\n\t\tif (opt2->dst0opt)\n\t\t\t*((char **)&opt2->dst0opt) += dif;\n\t\tif (opt2->dst1opt)\n \t\t\t*((char **)&opt2->dst1opt) += dif;\n \t\tif (opt2->srcrt)\n \t\t\t*((char **)&opt2->srcrt) += dif;\n\t\tatomic_set(&opt2->refcnt, 1);\n \t}\n \treturn opt2;\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#10-511f80696d9d", + "input": " def _get_chap_secret_for_host(self, host_name):\n \"\"\"Return the CHAP secret for the given host.\"\"\"\n\n LOG.debug(_('enter: _get_chap_secret_for_host: host name %s')\n % host_name)\n\n ssh_cmd = 'svcinfo lsiscsiauth -delim !'\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return None\n\n host_lines = out.strip().split('\\n')\n self._assert_ssh_return(len(host_lines), '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('name' in header, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_auth_method' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_chap_secret' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n name_index = header.index('name')\n method_index = header.index('iscsi_auth_method')\n secret_index = header.index('iscsi_chap_secret')\n\n chap_secret = None\n host_found = False\n for line in host_lines:\n info = line.split('!')\n if info[name_index] == host_name:\n host_found = True\n if info[method_index] == 'chap':\n chap_secret = info[secret_index]\n\n self._assert_ssh_return(host_found, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n LOG.debug(_('leave: _get_chap_secret_for_host: host name '\n '%(host_name)s with secret %(chap_secret)s')\n % {'host_name': host_name, 'chap_secret': chap_secret})\n\n return chap_secret", + "target": " def _get_chap_secret_for_host(self, host_name):\n \"\"\"Return the CHAP secret for the given host.\"\"\"\n\n LOG.debug(_('enter: _get_chap_secret_for_host: host name %s')\n % host_name)\n\n ssh_cmd = ['svcinfo', 'lsiscsiauth', '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return None\n\n host_lines = out.strip().split('\\n')\n self._assert_ssh_return(len(host_lines), '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('name' in header, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_auth_method' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_chap_secret' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n name_index = header.index('name')\n method_index = header.index('iscsi_auth_method')\n secret_index = header.index('iscsi_chap_secret')\n\n chap_secret = None\n host_found = False\n for line in host_lines:\n info = line.split('!')\n if info[name_index] == host_name:\n host_found = True\n if info[method_index] == 'chap':\n chap_secret = info[secret_index]\n\n self._assert_ssh_return(host_found, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n LOG.debug(_('leave: _get_chap_secret_for_host: host name '\n '%(host_name)s with secret %(chap_secret)s')\n % {'host_name': host_name, 'chap_secret': chap_secret})\n\n return chap_secret", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#94036902775aa96ea74db583135f4080a125fab9", + "input": " void AppModalDialog::CompleteDialog() {\n AppModalDialogQueue::GetInstance()->ShowNextDialog();\n }\n", + "target": " void AppModalDialog::CompleteDialog() {\n if (!completed_) {\n completed_ = true;\n AppModalDialogQueue::GetInstance()->ShowNextDialog();\n }\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0ab5fab4939150bd0f30ada8a4bf6eb0f69d66c1", + "input": "void GpuCommandBufferStub::OnCreateTransferBuffer(int32 size,\n int32 id_request,\n IPC::Message* reply_message) {\n TRACE_EVENT0(\"gpu\", \"GpuCommandBufferStub::OnCreateTransferBuffer\");\n if (command_buffer_.get()) {\n int32 id = command_buffer_->CreateTransferBuffer(size, id_request);\n GpuCommandBufferMsg_CreateTransferBuffer::WriteReplyParams(\n reply_message, id);\n } else {\n reply_message->set_reply_error();\n }\n Send(reply_message);\n}\n", + "target": "void GpuCommandBufferStub::OnCreateTransferBuffer(int32 size,\nvoid GpuCommandBufferStub::OnCreateTransferBuffer(uint32 size,\n int32 id_request,\n IPC::Message* reply_message) {\n TRACE_EVENT0(\"gpu\", \"GpuCommandBufferStub::OnCreateTransferBuffer\");\n if (command_buffer_.get()) {\n int32 id = command_buffer_->CreateTransferBuffer(size, id_request);\n GpuCommandBufferMsg_CreateTransferBuffer::WriteReplyParams(\n reply_message, id);\n } else {\n reply_message->set_reply_error();\n }\n Send(reply_message);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#50220dead1650609206efe91f0cc116132d59b3f", + "input": "static void hid_input_field(struct hid_device *hid, struct hid_field *field,\n\t\t\t __u8 *data, int interrupt)\n{\n\tunsigned n;\n\tunsigned count = field->report_count;\n\tunsigned offset = field->report_offset;\n\tunsigned size = field->report_size;\n\t__s32 min = field->logical_minimum;\n\t__s32 max = field->logical_maximum;\n\t__s32 *value;\n\n\tvalue = kmalloc(sizeof(__s32) * count, GFP_ATOMIC);\n\tif (!value)\n\t\treturn;\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tvalue[n] = min < 0 ?\n\t\t\tsnto32(hid_field_extract(hid, data, offset + n * size,\n\t\t\t size), size) :\n\t\t\thid_field_extract(hid, data, offset + n * size, size);\n\n \t\t/* Ignore report if ErrorRollOver */\n \t\tif (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&\n \t\t value[n] >= min && value[n] <= max &&\n \t\t field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)\n \t\t\tgoto exit;\n \t}\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tif (HID_MAIN_ITEM_VARIABLE & field->flags) {\n\t\t\thid_process_event(hid, field, &field->usage[n], value[n], interrupt);\n\t\t\tcontinue;\n \t\t}\n \n \t\tif (field->value[n] >= min && field->value[n] <= max\n \t\t\t&& field->usage[field->value[n] - min].hid\n \t\t\t&& search(value, field->value[n], count))\n \t\t\t\thid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);\n \n \t\tif (value[n] >= min && value[n] <= max\n \t\t\t&& field->usage[value[n] - min].hid\n \t\t\t&& search(field->value, value[n], count))\n \t\t\t\thid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);\n\t}\n\n\tmemcpy(field->value, value, count * sizeof(__s32));\nexit:\n\tkfree(value);\n}\n", + "target": "static void hid_input_field(struct hid_device *hid, struct hid_field *field,\n\t\t\t __u8 *data, int interrupt)\n{\n\tunsigned n;\n\tunsigned count = field->report_count;\n\tunsigned offset = field->report_offset;\n\tunsigned size = field->report_size;\n\t__s32 min = field->logical_minimum;\n\t__s32 max = field->logical_maximum;\n\t__s32 *value;\n\n\tvalue = kmalloc(sizeof(__s32) * count, GFP_ATOMIC);\n\tif (!value)\n\t\treturn;\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tvalue[n] = min < 0 ?\n\t\t\tsnto32(hid_field_extract(hid, data, offset + n * size,\n\t\t\t size), size) :\n\t\t\thid_field_extract(hid, data, offset + n * size, size);\n\n \t\t/* Ignore report if ErrorRollOver */\n \t\tif (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&\n \t\t value[n] >= min && value[n] <= max &&\n\t\t value[n] - min < field->maxusage &&\n \t\t field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)\n \t\t\tgoto exit;\n \t}\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tif (HID_MAIN_ITEM_VARIABLE & field->flags) {\n\t\t\thid_process_event(hid, field, &field->usage[n], value[n], interrupt);\n\t\t\tcontinue;\n \t\t}\n \n \t\tif (field->value[n] >= min && field->value[n] <= max\n\t\t\t&& field->value[n] - min < field->maxusage\n \t\t\t&& field->usage[field->value[n] - min].hid\n \t\t\t&& search(value, field->value[n], count))\n \t\t\t\thid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);\n \n \t\tif (value[n] >= min && value[n] <= max\n\t\t\t&& value[n] - min < field->maxusage\n \t\t\t&& field->usage[value[n] - min].hid\n \t\t\t&& search(field->value, value[n], count))\n \t\t\t\thid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);\n\t}\n\n\tmemcpy(field->value, value, count * sizeof(__s32));\nexit:\n\tkfree(value);\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#654b404f2a222f918af9b0cd18ad469d0c941a8e", + "input": "static void edge_bulk_in_callback(struct urb *urb)\n{\n\tstruct edgeport_port *edge_port = urb->context;\n\tstruct device *dev = &edge_port->port->dev;\n\tunsigned char *data = urb->transfer_buffer;\n\tint retval = 0;\n\tint port_number;\n\tint status = urb->status;\n\n\tswitch (status) {\n\tcase 0:\n\t\t/* success */\n\t\tbreak;\n\tcase -ECONNRESET:\n\tcase -ENOENT:\n\tcase -ESHUTDOWN:\n\t\t/* this urb is terminated, clean up */\n\t\tdev_dbg(&urb->dev->dev, \"%s - urb shutting down with status: %d\\n\", __func__, status);\n\t\treturn;\n\tdefault:\n\t\tdev_err(&urb->dev->dev, \"%s - nonzero read bulk status received: %d\\n\", __func__, status);\n\t}\n\n\tif (status == -EPIPE)\n\t\tgoto exit;\n\n\tif (status) {\n\t\tdev_err(&urb->dev->dev, \"%s - stopping read!\\n\", __func__);\n\t\treturn;\n\t}\n \n \tport_number = edge_port->port->port_number;\n \n\tif (edge_port->lsr_event) {\n \t\tedge_port->lsr_event = 0;\n \t\tdev_dbg(dev, \"%s ===== Port %u LSR Status = %02x, Data = %02x ======\\n\",\n \t\t\t__func__, port_number, edge_port->lsr_mask, *data);\n\t\thandle_new_lsr(edge_port, 1, edge_port->lsr_mask, *data);\n\t\t/* Adjust buffer length/pointer */\n\t\t--urb->actual_length;\n\t\t++data;\n\t}\n\n\tif (urb->actual_length) {\n\t\tusb_serial_debug_data(dev, __func__, urb->actual_length, data);\n\t\tif (edge_port->close_pending)\n\t\t\tdev_dbg(dev, \"%s - close pending, dropping data on the floor\\n\",\n\t\t\t\t\t\t\t\t__func__);\n\t\telse\n\t\t\tedge_tty_recv(edge_port->port, data,\n\t\t\t\t\turb->actual_length);\n\t\tedge_port->port->icount.rx += urb->actual_length;\n\t}\n\nexit:\n\t/* continue read unless stopped */\n\tspin_lock(&edge_port->ep_lock);\n\tif (edge_port->ep_read_urb_state == EDGE_READ_URB_RUNNING)\n\t\tretval = usb_submit_urb(urb, GFP_ATOMIC);\n\telse if (edge_port->ep_read_urb_state == EDGE_READ_URB_STOPPING)\n\t\tedge_port->ep_read_urb_state = EDGE_READ_URB_STOPPED;\n\n\tspin_unlock(&edge_port->ep_lock);\n\tif (retval)\n\t\tdev_err(dev, \"%s - usb_submit_urb failed with result %d\\n\", __func__, retval);\n}\n", + "target": "static void edge_bulk_in_callback(struct urb *urb)\n{\n\tstruct edgeport_port *edge_port = urb->context;\n\tstruct device *dev = &edge_port->port->dev;\n\tunsigned char *data = urb->transfer_buffer;\n\tint retval = 0;\n\tint port_number;\n\tint status = urb->status;\n\n\tswitch (status) {\n\tcase 0:\n\t\t/* success */\n\t\tbreak;\n\tcase -ECONNRESET:\n\tcase -ENOENT:\n\tcase -ESHUTDOWN:\n\t\t/* this urb is terminated, clean up */\n\t\tdev_dbg(&urb->dev->dev, \"%s - urb shutting down with status: %d\\n\", __func__, status);\n\t\treturn;\n\tdefault:\n\t\tdev_err(&urb->dev->dev, \"%s - nonzero read bulk status received: %d\\n\", __func__, status);\n\t}\n\n\tif (status == -EPIPE)\n\t\tgoto exit;\n\n\tif (status) {\n\t\tdev_err(&urb->dev->dev, \"%s - stopping read!\\n\", __func__);\n\t\treturn;\n\t}\n \n \tport_number = edge_port->port->port_number;\n \n\tif (urb->actual_length > 0 && edge_port->lsr_event) {\n \t\tedge_port->lsr_event = 0;\n \t\tdev_dbg(dev, \"%s ===== Port %u LSR Status = %02x, Data = %02x ======\\n\",\n \t\t\t__func__, port_number, edge_port->lsr_mask, *data);\n\t\thandle_new_lsr(edge_port, 1, edge_port->lsr_mask, *data);\n\t\t/* Adjust buffer length/pointer */\n\t\t--urb->actual_length;\n\t\t++data;\n\t}\n\n\tif (urb->actual_length) {\n\t\tusb_serial_debug_data(dev, __func__, urb->actual_length, data);\n\t\tif (edge_port->close_pending)\n\t\t\tdev_dbg(dev, \"%s - close pending, dropping data on the floor\\n\",\n\t\t\t\t\t\t\t\t__func__);\n\t\telse\n\t\t\tedge_tty_recv(edge_port->port, data,\n\t\t\t\t\turb->actual_length);\n\t\tedge_port->port->icount.rx += urb->actual_length;\n\t}\n\nexit:\n\t/* continue read unless stopped */\n\tspin_lock(&edge_port->ep_lock);\n\tif (edge_port->ep_read_urb_state == EDGE_READ_URB_RUNNING)\n\t\tretval = usb_submit_urb(urb, GFP_ATOMIC);\n\telse if (edge_port->ep_read_urb_state == EDGE_READ_URB_STOPPING)\n\t\tedge_port->ep_read_urb_state = EDGE_READ_URB_STOPPED;\n\n\tspin_unlock(&edge_port->ep_lock);\n\tif (retval)\n\t\tdev_err(dev, \"%s - usb_submit_urb failed with result %d\\n\", __func__, retval);\n}\n", + "vul_type": "cwe-191", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5d201df72f3d4f4cb8b8f75f980169b03507da38", + "input": "_XcursorReadImage (XcursorFile\t\t*file,\n\t\t XcursorFileHeader\t*fileHeader,\n\t\t int\t\t\ttoc)\n{\n XcursorChunkHeader\tchunkHeader;\n XcursorImage\thead;\n XcursorImage\t*image;\n int\t\t\tn;\n XcursorPixel\t*p;\n\n if (!file || !fileHeader)\n return NULL;\n\n if (!_XcursorFileReadChunkHeader (file, fileHeader, toc, &chunkHeader))\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.width))\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.height))\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.xhot))\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.yhot))\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.delay))\n\treturn NULL;\n /* sanity check data */\n if (head.width >= 0x10000 || head.height > 0x10000)\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.delay))\n \treturn NULL;\n /* sanity check data */\n if (head.width >= 0x10000 || head.height > 0x10000)\n \treturn NULL;\n if (head.width == 0 || head.height == 0)\n \treturn NULL;\n\t return NULL;\n if (chunkHeader.version < image->version)\n\timage->version = chunkHeader.version;\n image->size = chunkHeader.subtype;\n image->xhot = head.xhot;\n image->yhot = head.yhot;\n image->delay = head.delay;\n n = image->width * image->height;\n p = image->pixels;\n while (n--)\n {\n\tif (!_XcursorReadUInt (file, p))\n\t{\n\t XcursorImageDestroy (image);\n\t return NULL;\n\t}\n\tp++;\n }\n return image;\n}\n", + "target": "_XcursorReadImage (XcursorFile\t\t*file,\n\t\t XcursorFileHeader\t*fileHeader,\n\t\t int\t\t\ttoc)\n{\n XcursorChunkHeader\tchunkHeader;\n XcursorImage\thead;\n XcursorImage\t*image;\n int\t\t\tn;\n XcursorPixel\t*p;\n\n if (!file || !fileHeader)\n return NULL;\n\n if (!_XcursorFileReadChunkHeader (file, fileHeader, toc, &chunkHeader))\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.width))\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.height))\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.xhot))\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.yhot))\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.delay))\n\treturn NULL;\n /* sanity check data */\n if (head.width >= 0x10000 || head.height > 0x10000)\n\treturn NULL;\n if (!_XcursorReadUInt (file, &head.delay))\n \treturn NULL;\n /* sanity check data */\n if (head.width > XCURSOR_IMAGE_MAX_SIZE ||\n\thead.height > XCURSOR_IMAGE_MAX_SIZE)\n \treturn NULL;\n if (head.width == 0 || head.height == 0)\n \treturn NULL;\n\t return NULL;\n if (chunkHeader.version < image->version)\n\timage->version = chunkHeader.version;\n image->size = chunkHeader.subtype;\n image->xhot = head.xhot;\n image->yhot = head.yhot;\n image->delay = head.delay;\n n = image->width * image->height;\n p = image->pixels;\n while (n--)\n {\n\tif (!_XcursorReadUInt (file, p))\n\t{\n\t XcursorImageDestroy (image);\n\t return NULL;\n\t}\n\tp++;\n }\n return image;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#787c0ee906430b772f33ca50b97b8b5ca070faec", + "input": "DECLAREreadFunc(readContigTilesIntoBuffer)\n{\n\tint status = 1;\n\ttsize_t tilesize = TIFFTileSize(in);\n \ttdata_t tilebuf;\n \tuint32 imagew = TIFFScanlineSize(in);\n \tuint32 tilew = TIFFTileRowSize(in);\n\tint iskew = imagew - tilew;\n \tuint8* bufp = (uint8*) buf;\n \tuint32 tw, tl;\n \tuint32 row;\n\n\t(void) spp;\n\ttilebuf = _TIFFmalloc(tilesize);\n\tif (tilebuf == 0)\n\t\treturn 0;\n\t_TIFFmemset(tilebuf, 0, tilesize);\n\t(void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);\n\t(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);\n \n\tfor (row = 0; row < imagelength; row += tl) {\n\t\tuint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;\n\t\tuint32 colb = 0;\n\t\tuint32 col;\n\n\t\tfor (col = 0; col < imagewidth && colb < imagew; col += tw) {\n\t\t\tif (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0\n\t\t\t && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t \"Error, can't read tile at %lu %lu\",\n\t\t\t\t (unsigned long) col,\n\t\t\t\t (unsigned long) row);\n \t\t\t\tstatus = 0;\n \t\t\t\tgoto done;\n \t\t\t}\n\t\t\tif (colb + tilew > imagew) {\n \t\t\t\tuint32 width = imagew - colb;\n \t\t\t\tuint32 oskew = tilew - width;\n \t\t\t\tcpStripToTile(bufp + colb,\n\t\t\t\t tilebuf, nrow, width,\n\t\t\t\t oskew + iskew, oskew );\n\t\t\t} else\n\t\t\t\tcpStripToTile(bufp + colb,\n\t\t\t\t tilebuf, nrow, tilew,\n\t\t\t\t iskew, 0);\n\t\t\tcolb += tilew;\n\t\t}\n\t\tbufp += imagew * nrow;\n\t}\ndone:\n\t_TIFFfree(tilebuf);\n\treturn status;\n}\n", + "target": "DECLAREreadFunc(readContigTilesIntoBuffer)\n{\n\tint status = 1;\n\ttsize_t tilesize = TIFFTileSize(in);\n \ttdata_t tilebuf;\n \tuint32 imagew = TIFFScanlineSize(in);\n \tuint32 tilew = TIFFTileRowSize(in);\n\tint64 iskew = (int64)imagew - (int64)tilew;\n \tuint8* bufp = (uint8*) buf;\n \tuint32 tw, tl;\n \tuint32 row;\n\n\t(void) spp;\n\ttilebuf = _TIFFmalloc(tilesize);\n\tif (tilebuf == 0)\n\t\treturn 0;\n\t_TIFFmemset(tilebuf, 0, tilesize);\n\t(void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);\n\t(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);\n \n\tfor (row = 0; row < imagelength; row += tl) {\n\t\tuint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;\n\t\tuint32 colb = 0;\n\t\tuint32 col;\n\n\t\tfor (col = 0; col < imagewidth && colb < imagew; col += tw) {\n\t\t\tif (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0\n\t\t\t && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t \"Error, can't read tile at %lu %lu\",\n\t\t\t\t (unsigned long) col,\n\t\t\t\t (unsigned long) row);\n \t\t\t\tstatus = 0;\n \t\t\t\tgoto done;\n \t\t\t}\n\t\t\tif (colb > iskew) {\n \t\t\t\tuint32 width = imagew - colb;\n \t\t\t\tuint32 oskew = tilew - width;\n \t\t\t\tcpStripToTile(bufp + colb,\n\t\t\t\t tilebuf, nrow, width,\n\t\t\t\t oskew + iskew, oskew );\n\t\t\t} else\n\t\t\t\tcpStripToTile(bufp + colb,\n\t\t\t\t tilebuf, nrow, tilew,\n\t\t\t\t iskew, 0);\n\t\t\tcolb += tilew;\n\t\t}\n\t\tbufp += imagew * nrow;\n\t}\ndone:\n\t_TIFFfree(tilebuf);\n\treturn status;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#802ecdb9cee0d66fe546bdf24e98150f8f716ad8", + "input": "bool AudioRendererAlgorithm::OutputSlowerPlayback(uint8* dest) {\n DCHECK_LT(index_into_window_, window_size_);\n DCHECK_LT(playback_rate_, 1.0);\n DCHECK_NE(playback_rate_, 0.0);\n\n if (audio_buffer_.forward_bytes() < bytes_per_frame_)\n return false;\n\n int input_step = ceil(window_size_ * playback_rate_);\n AlignToFrameBoundary(&input_step);\n int output_step = window_size_;\n DCHECK_LT(input_step, output_step);\n int bytes_to_crossfade = bytes_in_crossfade_;\n if (muted_ || bytes_to_crossfade > input_step)\n bytes_to_crossfade = 0;\n\n int intro_crossfade_begin = input_step - bytes_to_crossfade;\n\n int intro_crossfade_end = input_step;\n\n int outtro_crossfade_begin = output_step - bytes_to_crossfade;\n\n if (index_into_window_ < intro_crossfade_begin) {\n CopyWithAdvance(dest);\n index_into_window_ += bytes_per_frame_;\n return true;\n }\n\n if (index_into_window_ < intro_crossfade_end) {\n int offset = index_into_window_ - intro_crossfade_begin;\n uint8* place_to_copy = crossfade_buffer_.get() + offset;\n CopyWithoutAdvance(place_to_copy);\n CopyWithAdvance(dest);\n index_into_window_ += bytes_per_frame_;\n return true;\n }\n\n int audio_buffer_offset = index_into_window_ - intro_crossfade_end;\n\n if (audio_buffer_.forward_bytes() < audio_buffer_offset + bytes_per_frame_)\n return false;\n\n DCHECK_GE(index_into_window_, intro_crossfade_end);\n CopyWithoutAdvance(dest, audio_buffer_offset);\n\n if (index_into_window_ >= outtro_crossfade_begin) {\n int offset_into_crossfade_buffer =\n index_into_window_ - outtro_crossfade_begin;\n uint8* intro_frame_ptr =\n crossfade_buffer_.get() + offset_into_crossfade_buffer;\n OutputCrossfadedFrame(dest, intro_frame_ptr);\n }\n\n index_into_window_ += bytes_per_frame_;\n return true;\n}\n", + "target": "bool AudioRendererAlgorithm::OutputSlowerPlayback(uint8* dest) {\nbool AudioRendererAlgorithm::OutputSlowerPlayback(uint8* dest,\n int input_step,\n int output_step) {\n // Ensure we don't run into OOB read/write situation.\n CHECK_LT(input_step, output_step);\n DCHECK_LT(index_into_window_, window_size_);\n DCHECK_LT(playback_rate_, 1.0);\n DCHECK_NE(playback_rate_, 0.0);\n\n if (audio_buffer_.forward_bytes() < bytes_per_frame_)\n return false;\n\n int bytes_to_crossfade = bytes_in_crossfade_;\n if (muted_ || bytes_to_crossfade > input_step)\n bytes_to_crossfade = 0;\n\n int intro_crossfade_begin = input_step - bytes_to_crossfade;\n\n int intro_crossfade_end = input_step;\n\n int outtro_crossfade_begin = output_step - bytes_to_crossfade;\n\n if (index_into_window_ < intro_crossfade_begin) {\n CopyWithAdvance(dest);\n index_into_window_ += bytes_per_frame_;\n return true;\n }\n\n if (index_into_window_ < intro_crossfade_end) {\n int offset = index_into_window_ - intro_crossfade_begin;\n uint8* place_to_copy = crossfade_buffer_.get() + offset;\n CopyWithoutAdvance(place_to_copy);\n CopyWithAdvance(dest);\n index_into_window_ += bytes_per_frame_;\n return true;\n }\n\n int audio_buffer_offset = index_into_window_ - intro_crossfade_end;\n\n if (audio_buffer_.forward_bytes() < audio_buffer_offset + bytes_per_frame_)\n return false;\n\n DCHECK_GE(index_into_window_, intro_crossfade_end);\n CopyWithoutAdvance(dest, audio_buffer_offset);\n\n if (index_into_window_ >= outtro_crossfade_begin) {\n int offset_into_crossfade_buffer =\n index_into_window_ - outtro_crossfade_begin;\n uint8* intro_frame_ptr =\n crossfade_buffer_.get() + offset_into_crossfade_buffer;\n OutputCrossfadedFrame(dest, intro_frame_ptr);\n }\n\n index_into_window_ += bytes_per_frame_;\n return true;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "void Chapters::Display::Init()\n{\n m_string = NULL;\n m_language = NULL;\n m_country = NULL;\n}\n", + "target": "void Chapters::Display::Init()\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#45f6fad84cc305103b28d73482b344d7f5b76f39", + "input": "struct dst_entry *inet6_csk_route_req(const struct sock *sk,\n\t\t\t\t struct flowi6 *fl6,\n\t\t\t\t const struct request_sock *req,\n\t\t\t\t u8 proto)\n{\n\tstruct inet_request_sock *ireq = inet_rsk(req);\n\tconst struct ipv6_pinfo *np = inet6_sk(sk);\n\tstruct in6_addr *final_p, final;\n\tstruct dst_entry *dst;\n\n \tmemset(fl6, 0, sizeof(*fl6));\n \tfl6->flowi6_proto = proto;\n \tfl6->daddr = ireq->ir_v6_rmt_addr;\n\tfinal_p = fl6_update_dst(fl6, np->opt, &final);\n \tfl6->saddr = ireq->ir_v6_loc_addr;\n \tfl6->flowi6_oif = ireq->ir_iif;\n \tfl6->flowi6_mark = ireq->ir_mark;\n\tfl6->fl6_dport = ireq->ir_rmt_port;\n\tfl6->fl6_sport = htons(ireq->ir_num);\n\tsecurity_req_classify_flow(req, flowi6_to_flowi(fl6));\n\n\tdst = ip6_dst_lookup_flow(sk, fl6, final_p);\n\tif (IS_ERR(dst))\n\t\treturn NULL;\n\n\treturn dst;\n}\n", + "target": "struct dst_entry *inet6_csk_route_req(const struct sock *sk,\n\t\t\t\t struct flowi6 *fl6,\n\t\t\t\t const struct request_sock *req,\n\t\t\t\t u8 proto)\n{\n\tstruct inet_request_sock *ireq = inet_rsk(req);\n\tconst struct ipv6_pinfo *np = inet6_sk(sk);\n\tstruct in6_addr *final_p, final;\n\tstruct dst_entry *dst;\n\n \tmemset(fl6, 0, sizeof(*fl6));\n \tfl6->flowi6_proto = proto;\n \tfl6->daddr = ireq->ir_v6_rmt_addr;\n\trcu_read_lock();\n\tfinal_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final);\n\trcu_read_unlock();\n \tfl6->saddr = ireq->ir_v6_loc_addr;\n \tfl6->flowi6_oif = ireq->ir_iif;\n \tfl6->flowi6_mark = ireq->ir_mark;\n\tfl6->fl6_dport = ireq->ir_rmt_port;\n\tfl6->fl6_sport = htons(ireq->ir_num);\n\tsecurity_req_classify_flow(req, flowi6_to_flowi(fl6));\n\n\tdst = ip6_dst_lookup_flow(sk, fl6, final_p);\n\tif (IS_ERR(dst))\n\t\treturn NULL;\n\n\treturn dst;\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#bd998c2e0df0469707503023d50d46cf0b10c787", + "input": " void usb_serial_console_disconnect(struct usb_serial *serial)\n {\n\tif (serial->port[0] == usbcons_info.port) {\n \t\tusb_serial_console_exit();\n \t\tusb_serial_put(serial);\n \t}\n}\n", + "target": " void usb_serial_console_disconnect(struct usb_serial *serial)\n {\n\tif (serial->port[0] && serial->port[0] == usbcons_info.port) {\n \t\tusb_serial_console_exit();\n \t\tusb_serial_put(serial);\n \t}\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#8-f2cfe9c45da3", + "input": " def _create_3par_vlun(self, volume, hostname):\n out = self._cli_run('createvlun %s auto %s' % (volume, hostname), None)\n if out and len(out) > 1:\n if \"must be in the same domain\" in out[0]:\n err = out[0].strip()\n err = err + \" \" + out[1].strip()\n raise exception.Invalid3PARDomain(err=err)", + "target": " def _create_3par_vlun(self, volume, hostname):\n out = self._cli_run(['createvlun', volume, 'auto', hostname])\n if out and len(out) > 1:\n if \"must be in the same domain\" in out[0]:\n err = out[0].strip()\n err = err + \" \" + out[1].strip()\n raise exception.Invalid3PARDomain(err=err)", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,\n ::libvpx_test::Encoder *encoder) {\n if (video->frame() == 1) {\n encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);\n }\n if (cfg_.ts_number_layers > 1) {\n if (video->frame() == 1) {\n encoder->Control(VP9E_SET_SVC, 1);\n }\n vpx_svc_layer_id_t layer_id = {0, 0};\n layer_id.spatial_layer_id = 0;\n frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers);\n layer_id.temporal_layer_id = SetLayerId(video->frame(),\n cfg_.ts_number_layers);\n if (video->frame() > 0) {\n encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);\n }\n }\n const vpx_rational_t tb = video->timebase();\n timebase_ = static_cast(tb.num) / tb.den;\n duration_ = 0;\n }\n", + "target": " virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,\n ::libvpx_test::Encoder *encoder) {\n if (video->frame() == 0)\n encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);\n\n if (denoiser_offon_test_) {\n ASSERT_GT(denoiser_offon_period_, 0)\n << \"denoiser_offon_period_ is not positive.\";\n if ((video->frame() + 1) % denoiser_offon_period_ == 0) {\n // Flip denoiser_on_ periodically\n denoiser_on_ ^= 1;\n }\n }\n\n encoder->Control(VP9E_SET_NOISE_SENSITIVITY, denoiser_on_);\n\n if (cfg_.ts_number_layers > 1) {\n if (video->frame() == 0) {\n encoder->Control(VP9E_SET_SVC, 1);\n }\n vpx_svc_layer_id_t layer_id;\n layer_id.spatial_layer_id = 0;\n frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers);\n layer_id.temporal_layer_id = SetLayerId(video->frame(),\n cfg_.ts_number_layers);\n encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);\n }\n const vpx_rational_t tb = video->timebase();\n timebase_ = static_cast(tb.num) / tb.den;\n duration_ = 0;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ecd7918745234e423dd87fcc0c077da557909720", + "input": "static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_esn,\n \t\t\t\t\t struct nlattr *rp)\n {\n \tstruct xfrm_replay_state_esn *up;\n \n \tif (!replay_esn || !rp)\n \t\treturn 0;\n \n \tup = nla_data(rp);\n \n\tif (xfrm_replay_state_esn_len(replay_esn) !=\n\t\t\txfrm_replay_state_esn_len(up))\n \t\treturn -EINVAL;\n \n \treturn 0;\n}\n", + "target": "static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_esn,\n \t\t\t\t\t struct nlattr *rp)\n {\n \tstruct xfrm_replay_state_esn *up;\n\tint ulen;\n \n \tif (!replay_esn || !rp)\n \t\treturn 0;\n \n \tup = nla_data(rp);\n\tulen = xfrm_replay_state_esn_len(up);\n \n\tif (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen)\n \t\treturn -EINVAL;\n \n \treturn 0;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#961d0cda4cfc3bcf04aa48ccc32772d63af12d9b", + "input": "PasswordGenerationUIData GetTestGenerationUIData1() {\n PasswordForm form;\n form.form_data = autofill::FormData();\n form.form_data.action = GURL(\"http://www.example1.com/accounts/Login\");\n form.form_data.origin = GURL(\"http://www.example1.com/accounts/LoginAuth\");\n PasswordGenerationUIData data;\n data.password_form = form;\n data.generation_element = ASCIIToUTF16(\"testelement1\");\n data.max_length = 10;\n return data;\n}\n", + "target": "PasswordGenerationUIData GetTestGenerationUIData1() {\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#600ddd6825543962fb807884169e57b580dba208", + "input": "void sctp_assoc_update(struct sctp_association *asoc,\n\t\t struct sctp_association *new)\n{\n\tstruct sctp_transport *trans;\n\tstruct list_head *pos, *temp;\n\n\t/* Copy in new parameters of peer. */\n\tasoc->c = new->c;\n\tasoc->peer.rwnd = new->peer.rwnd;\n\tasoc->peer.sack_needed = new->peer.sack_needed;\n\tasoc->peer.auth_capable = new->peer.auth_capable;\n\tasoc->peer.i = new->peer.i;\n\tsctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL,\n\t\t\t asoc->peer.i.initial_tsn, GFP_ATOMIC);\n\n\t/* Remove any peer addresses not present in the new association. */\n\tlist_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {\n\t\ttrans = list_entry(pos, struct sctp_transport, transports);\n\t\tif (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) {\n\t\t\tsctp_assoc_rm_peer(asoc, trans);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (asoc->state >= SCTP_STATE_ESTABLISHED)\n\t\t\tsctp_transport_reset(trans);\n\t}\n\n\t/* If the case is A (association restart), use\n\t * initial_tsn as next_tsn. If the case is B, use\n\t * current next_tsn in case data sent to peer\n\t * has been discarded and needs retransmission.\n\t */\n\tif (asoc->state >= SCTP_STATE_ESTABLISHED) {\n\t\tasoc->next_tsn = new->next_tsn;\n\t\tasoc->ctsn_ack_point = new->ctsn_ack_point;\n\t\tasoc->adv_peer_ack_point = new->adv_peer_ack_point;\n\n\t\t/* Reinitialize SSN for both local streams\n\t\t * and peer's streams.\n\t\t */\n\t\tsctp_ssnmap_clear(asoc->ssnmap);\n\n\t\t/* Flush the ULP reassembly and ordered queue.\n\t\t * Any data there will now be stale and will\n\t\t * cause problems.\n\t\t */\n\t\tsctp_ulpq_flush(&asoc->ulpq);\n\n\t\t/* reset the overall association error count so\n\t\t * that the restarted association doesn't get torn\n\t\t * down on the next retransmission timer.\n\t\t */\n\t\tasoc->overall_error_count = 0;\n\n\t} else {\n\t\t/* Add any peer addresses from the new association. */\n\t\tlist_for_each_entry(trans, &new->peer.transport_addr_list,\n\t\t\t\ttransports) {\n\t\t\tif (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr))\n\t\t\t\tsctp_assoc_add_peer(asoc, &trans->ipaddr,\n\t\t\t\t\t\t GFP_ATOMIC, trans->state);\n\t\t}\n\n\t\tasoc->ctsn_ack_point = asoc->next_tsn - 1;\n\t\tasoc->adv_peer_ack_point = asoc->ctsn_ack_point;\n\t\tif (!asoc->ssnmap) {\n\t\t\t/* Move the ssnmap. */\n\t\t\tasoc->ssnmap = new->ssnmap;\n\t\t\tnew->ssnmap = NULL;\n\t\t}\n\n\t\tif (!asoc->assoc_id) {\n\t\t\t/* get a new association id since we don't have one\n\t\t\t * yet.\n\t\t\t */\n\t\t\tsctp_assoc_set_id(asoc, GFP_ATOMIC);\n\t\t}\n\t}\n\n\t/* SCTP-AUTH: Save the peer parameters from the new associations\n\t * and also move the association shared keys over\n\t */\n\tkfree(asoc->peer.peer_random);\n\tasoc->peer.peer_random = new->peer.peer_random;\n\tnew->peer.peer_random = NULL;\n\n\tkfree(asoc->peer.peer_chunks);\n\tasoc->peer.peer_chunks = new->peer.peer_chunks;\n\tnew->peer.peer_chunks = NULL;\n\n\tkfree(asoc->peer.peer_hmacs);\n \tasoc->peer.peer_hmacs = new->peer.peer_hmacs;\n \tnew->peer.peer_hmacs = NULL;\n \n\tsctp_auth_key_put(asoc->asoc_shared_key);\n \tsctp_auth_asoc_init_active_key(asoc, GFP_ATOMIC);\n }\n", + "target": "void sctp_assoc_update(struct sctp_association *asoc,\n\t\t struct sctp_association *new)\n{\n\tstruct sctp_transport *trans;\n\tstruct list_head *pos, *temp;\n\n\t/* Copy in new parameters of peer. */\n\tasoc->c = new->c;\n\tasoc->peer.rwnd = new->peer.rwnd;\n\tasoc->peer.sack_needed = new->peer.sack_needed;\n\tasoc->peer.auth_capable = new->peer.auth_capable;\n\tasoc->peer.i = new->peer.i;\n\tsctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL,\n\t\t\t asoc->peer.i.initial_tsn, GFP_ATOMIC);\n\n\t/* Remove any peer addresses not present in the new association. */\n\tlist_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {\n\t\ttrans = list_entry(pos, struct sctp_transport, transports);\n\t\tif (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) {\n\t\t\tsctp_assoc_rm_peer(asoc, trans);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (asoc->state >= SCTP_STATE_ESTABLISHED)\n\t\t\tsctp_transport_reset(trans);\n\t}\n\n\t/* If the case is A (association restart), use\n\t * initial_tsn as next_tsn. If the case is B, use\n\t * current next_tsn in case data sent to peer\n\t * has been discarded and needs retransmission.\n\t */\n\tif (asoc->state >= SCTP_STATE_ESTABLISHED) {\n\t\tasoc->next_tsn = new->next_tsn;\n\t\tasoc->ctsn_ack_point = new->ctsn_ack_point;\n\t\tasoc->adv_peer_ack_point = new->adv_peer_ack_point;\n\n\t\t/* Reinitialize SSN for both local streams\n\t\t * and peer's streams.\n\t\t */\n\t\tsctp_ssnmap_clear(asoc->ssnmap);\n\n\t\t/* Flush the ULP reassembly and ordered queue.\n\t\t * Any data there will now be stale and will\n\t\t * cause problems.\n\t\t */\n\t\tsctp_ulpq_flush(&asoc->ulpq);\n\n\t\t/* reset the overall association error count so\n\t\t * that the restarted association doesn't get torn\n\t\t * down on the next retransmission timer.\n\t\t */\n\t\tasoc->overall_error_count = 0;\n\n\t} else {\n\t\t/* Add any peer addresses from the new association. */\n\t\tlist_for_each_entry(trans, &new->peer.transport_addr_list,\n\t\t\t\ttransports) {\n\t\t\tif (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr))\n\t\t\t\tsctp_assoc_add_peer(asoc, &trans->ipaddr,\n\t\t\t\t\t\t GFP_ATOMIC, trans->state);\n\t\t}\n\n\t\tasoc->ctsn_ack_point = asoc->next_tsn - 1;\n\t\tasoc->adv_peer_ack_point = asoc->ctsn_ack_point;\n\t\tif (!asoc->ssnmap) {\n\t\t\t/* Move the ssnmap. */\n\t\t\tasoc->ssnmap = new->ssnmap;\n\t\t\tnew->ssnmap = NULL;\n\t\t}\n\n\t\tif (!asoc->assoc_id) {\n\t\t\t/* get a new association id since we don't have one\n\t\t\t * yet.\n\t\t\t */\n\t\t\tsctp_assoc_set_id(asoc, GFP_ATOMIC);\n\t\t}\n\t}\n\n\t/* SCTP-AUTH: Save the peer parameters from the new associations\n\t * and also move the association shared keys over\n\t */\n\tkfree(asoc->peer.peer_random);\n\tasoc->peer.peer_random = new->peer.peer_random;\n\tnew->peer.peer_random = NULL;\n\n\tkfree(asoc->peer.peer_chunks);\n\tasoc->peer.peer_chunks = new->peer.peer_chunks;\n\tnew->peer.peer_chunks = NULL;\n\n\tkfree(asoc->peer.peer_hmacs);\n \tasoc->peer.peer_hmacs = new->peer.peer_hmacs;\n \tnew->peer.peer_hmacs = NULL;\n \n \tsctp_auth_asoc_init_active_key(asoc, GFP_ATOMIC);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d1d577490c15a0c6862473d7576352a9f18ef811", + "input": "local unsigned long crc32_big(crc, buf, len)\n unsigned long crc;\n const unsigned char FAR *buf;\n unsigned len;\n{\n register z_crc_t c;\n register const z_crc_t FAR *buf4;\n\n c = ZSWAP32((z_crc_t)crc);\n c = ~c;\n while (len && ((ptrdiff_t)buf & 3)) {\n c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);\n len--;\n }\n \n buf4 = (const z_crc_t FAR *)(const void FAR *)buf;\n buf4--;\n while (len >= 32) {\n DOBIG32;\n len -= 32;\n }\n while (len >= 4) {\n DOBIG4;\n len -= 4;\n }\n buf4++;\n buf = (const unsigned char FAR *)buf4;\n \n if (len) do {\n c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);\n } while (--len);\n c = ~c;\n return (unsigned long)(ZSWAP32(c));\n}\n", + "target": "local unsigned long crc32_big(crc, buf, len)\n unsigned long crc;\n const unsigned char FAR *buf;\n unsigned len;\n{\n register z_crc_t c;\n register const z_crc_t FAR *buf4;\n\n c = ZSWAP32((z_crc_t)crc);\n c = ~c;\n while (len && ((ptrdiff_t)buf & 3)) {\n c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);\n len--;\n }\n \n buf4 = (const z_crc_t FAR *)(const void FAR *)buf;\n while (len >= 32) {\n DOBIG32;\n len -= 32;\n }\n while (len >= 4) {\n DOBIG4;\n len -= 4;\n }\n buf = (const unsigned char FAR *)buf4;\n \n if (len) do {\n c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);\n } while (--len);\n c = ~c;\n return (unsigned long)(ZSWAP32(c));\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#163ae1c6ad6299b19e22b4a35d5ab24a89791a98", + "input": " int fscrypt_process_policy(struct inode *inode,\n \t\t\t\tconst struct fscrypt_policy *policy)\n {\n \tif (policy->version != 0)\n \t\treturn -EINVAL;\n \n\tif (!inode_has_encryption_context(inode)) {\n\t\tif (!inode->i_sb->s_cop->empty_dir)\n\t\t\treturn -EOPNOTSUPP;\n\t\tif (!inode->i_sb->s_cop->empty_dir(inode))\n\t\t\treturn -ENOTEMPTY;\n\t\treturn create_encryption_context_from_policy(inode, policy);\n\t}\n\n\tif (is_encryption_context_consistent_with_policy(inode, policy))\n\t\treturn 0;\n\n\tprintk(KERN_WARNING \"%s: Policy inconsistent with encryption context\\n\",\n\t __func__);\n\treturn -EINVAL;\n}\n", + "target": " int fscrypt_process_policy(struct inode *inode,\n \t\t\t\tconst struct fscrypt_policy *policy)\n {\n\tif (!inode_owner_or_capable(inode))\n\t\treturn -EACCES;\n\n \tif (policy->version != 0)\n \t\treturn -EINVAL;\n \n\tif (!inode_has_encryption_context(inode)) {\n\t\tif (!inode->i_sb->s_cop->empty_dir)\n\t\t\treturn -EOPNOTSUPP;\n\t\tif (!inode->i_sb->s_cop->empty_dir(inode))\n\t\t\treturn -ENOTEMPTY;\n\t\treturn create_encryption_context_from_policy(inode, policy);\n\t}\n\n\tif (is_encryption_context_consistent_with_policy(inode, policy))\n\t\treturn 0;\n\n\tprintk(KERN_WARNING \"%s: Policy inconsistent with encryption context\\n\",\n\t __func__);\n\treturn -EINVAL;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "bool mkvparser::Match(\n IMkvReader* pReader,\n long long& pos,\n unsigned long id_,\n long long& val)\n{\n assert(pReader);\n assert(pos >= 0);\n \n long long total, available;\n \n const long status = pReader->Length(&total, &available);\n assert(status >= 0);\n assert((total < 0) || (available <= total));\n if (status < 0)\n return false;\n \n long len;\n \n const long long id = ReadUInt(pReader, pos, len);\n assert(id >= 0);\n assert(len > 0);\n assert(len <= 8);\n assert((pos + len) <= available);\n \n if ((unsigned long)id != id_)\n return false;\n \n pos += len; //consume id\n \n const long long size = ReadUInt(pReader, pos, len);\n assert(size >= 0);\n assert(size <= 8);\n assert(len > 0);\n assert(len <= 8);\n assert((pos + len) <= available);\n \n pos += len; //consume length of size of payload\n \n val = UnserializeUInt(pReader, pos, size);\n assert(val >= 0);\n \n pos += size; //consume size of payload\n return true;\n }\n", + "target": "bool mkvparser::Match(\n long long total, available;\n \n const long status = pReader->Length(&total, &available);\n assert(status >= 0);\n assert((total < 0) || (available <= total));\n if (status < 0)\n return false;\n \n long len;\n \n const long long id = ReadUInt(pReader, pos, len);\n assert(id >= 0);\n assert(len > 0);\n assert(len <= 8);\n assert((pos + len) <= available);\n \n if ((unsigned long)id != id_)\n return false;\n \n pos += len; // consume id\n \n const long long size = ReadUInt(pReader, pos, len);\n assert(size >= 0);\n assert(size <= 8);\n assert(len > 0);\n assert(len <= 8);\n assert((pos + len) <= available);\n \n pos += len; // consume length of size of payload\n \n val = UnserializeUInt(pReader, pos, size);\n assert(val >= 0);\n \n pos += size; // consume size of payload\n \n return true;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#aeea52da00d210587fb3ed895de3d5f2e0264c88", + "input": " int LELib_Create(const effect_uuid_t *uuid,\n int32_t sessionId,\n int32_t ioId,\n effect_handle_t *pHandle) {\n ALOGV(\"LELib_Create()\");\n int ret;\n int i;\n\n if (pHandle == NULL || uuid == NULL) {\n return -EINVAL;\n }\n\n if (memcmp(uuid, &gLEDescriptor.uuid, sizeof(effect_uuid_t)) != 0) {\n return -EINVAL;\n }\n\n LoudnessEnhancerContext *pContext = new LoudnessEnhancerContext;\n\n pContext->mItfe = &gLEInterface;\n pContext->mState = LOUDNESS_ENHANCER_STATE_UNINITIALIZED;\n\n pContext->mCompressor = NULL;\n ret = LE_init(pContext);\n if (ret < 0) {\n ALOGW(\"LELib_Create() init failed\");\n delete pContext;\n return ret;\n }\n\n *pHandle = (effect_handle_t)pContext;\n\n pContext->mState = LOUDNESS_ENHANCER_STATE_INITIALIZED;\n\n ALOGV(\" LELib_Create context is %p\", pContext);\n\n return 0;\n\n}\n", + "target": " int LELib_Create(const effect_uuid_t *uuid,\n int32_t sessionId __unused,\n int32_t ioId __unused,\n effect_handle_t *pHandle) {\n ALOGV(\"LELib_Create()\");\n int ret;\n int i;\n\n if (pHandle == NULL || uuid == NULL) {\n return -EINVAL;\n }\n\n if (memcmp(uuid, &gLEDescriptor.uuid, sizeof(effect_uuid_t)) != 0) {\n return -EINVAL;\n }\n\n LoudnessEnhancerContext *pContext = new LoudnessEnhancerContext;\n\n pContext->mItfe = &gLEInterface;\n pContext->mState = LOUDNESS_ENHANCER_STATE_UNINITIALIZED;\n\n pContext->mCompressor = NULL;\n ret = LE_init(pContext);\n if (ret < 0) {\n ALOGW(\"LELib_Create() init failed\");\n delete pContext;\n return ret;\n }\n\n *pHandle = (effect_handle_t)pContext;\n\n pContext->mState = LOUDNESS_ENHANCER_STATE_INITIALIZED;\n\n ALOGV(\" LELib_Create context is %p\", pContext);\n\n return 0;\n\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0ab2412a104d2f235d7b9fe19d30ef605a410832", + "input": "void DocumentLoader::DidInstallNewDocument(Document* document) {\n document->SetReadyState(Document::kLoading);\n document->InitContentSecurityPolicy(content_security_policy_.Release());\n \n if (history_item_ && IsBackForwardLoadType(load_type_))\n document->SetStateForNewFormElements(history_item_->GetDocumentState());\n\n String suborigin_header = response_.HttpHeaderField(HTTPNames::Suborigin);\n if (!suborigin_header.IsNull()) {\n Vector messages;\n Suborigin suborigin;\n if (ParseSuboriginHeader(suborigin_header, &suborigin, messages))\n document->EnforceSuborigin(suborigin);\n\n for (auto& message : messages) {\n document->AddConsoleMessage(\n ConsoleMessage::Create(kSecurityMessageSource, kErrorMessageLevel,\n \"Error with Suborigin header: \" + message));\n }\n }\n\n document->GetClientHintsPreferences().UpdateFrom(client_hints_preferences_);\n\n Settings* settings = document->GetSettings();\n fetcher_->SetImagesEnabled(settings->GetImagesEnabled());\n fetcher_->SetAutoLoadImages(settings->GetLoadsImagesAutomatically());\n\n const AtomicString& dns_prefetch_control =\n response_.HttpHeaderField(HTTPNames::X_DNS_Prefetch_Control);\n if (!dns_prefetch_control.IsEmpty())\n document->ParseDNSPrefetchControlHeader(dns_prefetch_control);\n\n String header_content_language =\n response_.HttpHeaderField(HTTPNames::Content_Language);\n if (!header_content_language.IsEmpty()) {\n size_t comma_index = header_content_language.find(',');\n header_content_language.Truncate(comma_index);\n header_content_language =\n header_content_language.StripWhiteSpace(IsHTMLSpace);\n if (!header_content_language.IsEmpty())\n document->SetContentLanguage(AtomicString(header_content_language));\n }\n\n OriginTrialContext::AddTokensFromHeader(\n document, response_.HttpHeaderField(HTTPNames::Origin_Trial));\n String referrer_policy_header =\n response_.HttpHeaderField(HTTPNames::Referrer_Policy);\n if (!referrer_policy_header.IsNull()) {\n UseCounter::Count(*document, WebFeature::kReferrerPolicyHeader);\n document->ParseAndSetReferrerPolicy(referrer_policy_header);\n }\n\n GetLocalFrameClient().DidCreateNewDocument();\n}\n", + "target": "void DocumentLoader::DidInstallNewDocument(Document* document) {\nvoid DocumentLoader::DidInstallNewDocument(Document* document,\n InstallNewDocumentReason reason) {\n document->SetReadyState(Document::kLoading);\n if (content_security_policy_) {\n document->InitContentSecurityPolicy(content_security_policy_.Release());\n }\n \n if (history_item_ && IsBackForwardLoadType(load_type_))\n document->SetStateForNewFormElements(history_item_->GetDocumentState());\n\n String suborigin_header = response_.HttpHeaderField(HTTPNames::Suborigin);\n if (!suborigin_header.IsNull()) {\n Vector messages;\n Suborigin suborigin;\n if (ParseSuboriginHeader(suborigin_header, &suborigin, messages))\n document->EnforceSuborigin(suborigin);\n\n for (auto& message : messages) {\n document->AddConsoleMessage(\n ConsoleMessage::Create(kSecurityMessageSource, kErrorMessageLevel,\n \"Error with Suborigin header: \" + message));\n }\n }\n\n document->GetClientHintsPreferences().UpdateFrom(client_hints_preferences_);\n\n Settings* settings = document->GetSettings();\n fetcher_->SetImagesEnabled(settings->GetImagesEnabled());\n fetcher_->SetAutoLoadImages(settings->GetLoadsImagesAutomatically());\n\n const AtomicString& dns_prefetch_control =\n response_.HttpHeaderField(HTTPNames::X_DNS_Prefetch_Control);\n if (!dns_prefetch_control.IsEmpty())\n document->ParseDNSPrefetchControlHeader(dns_prefetch_control);\n\n String header_content_language =\n response_.HttpHeaderField(HTTPNames::Content_Language);\n if (!header_content_language.IsEmpty()) {\n size_t comma_index = header_content_language.find(',');\n header_content_language.Truncate(comma_index);\n header_content_language =\n header_content_language.StripWhiteSpace(IsHTMLSpace);\n if (!header_content_language.IsEmpty())\n document->SetContentLanguage(AtomicString(header_content_language));\n }\n\n OriginTrialContext::AddTokensFromHeader(\n document, response_.HttpHeaderField(HTTPNames::Origin_Trial));\n String referrer_policy_header =\n response_.HttpHeaderField(HTTPNames::Referrer_Policy);\n if (!referrer_policy_header.IsNull()) {\n UseCounter::Count(*document, WebFeature::kReferrerPolicyHeader);\n document->ParseAndSetReferrerPolicy(referrer_policy_header);\n }\n\n GetLocalFrameClient().DidCreateNewDocument();\n}\n", + "vul_type": "cwe-732", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3c8e4852477d5b1e2da877808c998dc57db9460f", + "input": " Response StorageHandler::UntrackCacheStorageForOrigin(\n const std::string& origin) {\n if (!process_)\n return Response::InternalError();\n \n GURL origin_url(origin);\n if (!origin_url.is_valid())\n return Response::InvalidParams(origin + \" is not a valid URL\");\n\n BrowserThread::PostTask(\n BrowserThread::IO, FROM_HERE,\n base::BindOnce(&CacheStorageObserver::UntrackOriginOnIOThread,\n base::Unretained(GetCacheStorageObserver()),\n url::Origin::Create(origin_url)));\n return Response::OK();\n }\n", + "target": " Response StorageHandler::UntrackCacheStorageForOrigin(\n const std::string& origin) {\n if (!storage_partition_)\n return Response::InternalError();\n \n GURL origin_url(origin);\n if (!origin_url.is_valid())\n return Response::InvalidParams(origin + \" is not a valid URL\");\n\n BrowserThread::PostTask(\n BrowserThread::IO, FROM_HERE,\n base::BindOnce(&CacheStorageObserver::UntrackOriginOnIOThread,\n base::Unretained(GetCacheStorageObserver()),\n url::Origin::Create(origin_url)));\n return Response::OK();\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e6838a29ecb484c97e4efef9429643b9851fba6e", + "input": " nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)\n {\n\tstruct svc_procedure\t*proc;\n\tkxdrproc_t\t\txdr;\n\t__be32\t\t\tnfserr;\n\t__be32\t\t\t*nfserrp;\n\n\tdprintk(\"nfsd_dispatch: vers %d proc %d\\n\",\n \t\t\t\trqstp->rq_vers, rqstp->rq_proc);\n \tproc = rqstp->rq_procinfo;\n \n \t/*\n \t * Give the xdr decoder a chance to change this if it wants\n \t * (necessary in the NFSv4.0 compound case)\n\t */\n\trqstp->rq_cachetype = proc->pc_cachetype;\n\t/* Decode arguments */\n\txdr = proc->pc_decode;\n\tif (xdr && !xdr(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base,\n\t\t\trqstp->rq_argp)) {\n\t\tdprintk(\"nfsd: failed to decode arguments!\\n\");\n\t\t*statp = rpc_garbage_args;\n\t\treturn 1;\n\t}\n\n\t/* Check whether we have this call in the cache. */\n\tswitch (nfsd_cache_lookup(rqstp)) {\n\tcase RC_DROPIT:\n\t\treturn 0;\n\tcase RC_REPLY:\n\t\treturn 1;\n\tcase RC_DOIT:;\n\t\t/* do it */\n\t}\n\n\t/* need to grab the location to store the status, as\n\t * nfsv4 does some encoding while processing \n\t */\n\tnfserrp = rqstp->rq_res.head[0].iov_base\n\t\t+ rqstp->rq_res.head[0].iov_len;\n\trqstp->rq_res.head[0].iov_len += sizeof(__be32);\n\n\t/* Now call the procedure handler, and encode NFS status. */\n\tnfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);\n\tnfserr = map_new_errors(rqstp->rq_vers, nfserr);\n\tif (nfserr == nfserr_dropit || test_bit(RQ_DROPME, &rqstp->rq_flags)) {\n\t\tdprintk(\"nfsd: Dropping request; may be revisited later\\n\");\n\t\tnfsd_cache_update(rqstp, RC_NOCACHE, NULL);\n\t\treturn 0;\n\t}\n\n\tif (rqstp->rq_proc != 0)\n\t\t*nfserrp++ = nfserr;\n\n\t/* Encode result.\n\t * For NFSv2, additional info is never returned in case of an error.\n\t */\n\tif (!(nfserr && rqstp->rq_vers == 2)) {\n\t\txdr = proc->pc_encode;\n\t\tif (xdr && !xdr(rqstp, nfserrp,\n\t\t\t\trqstp->rq_resp)) {\n\t\t\t/* Failed to encode result. Release cache entry */\n\t\t\tdprintk(\"nfsd: failed to encode result!\\n\");\n\t\t\tnfsd_cache_update(rqstp, RC_NOCACHE, NULL);\n\t\t\t*statp = rpc_system_err;\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\t/* Store reply in cache. */\n\tnfsd_cache_update(rqstp, rqstp->rq_cachetype, statp + 1);\n\treturn 1;\n}\n", + "target": " nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)\n {\n\tstruct svc_procedure\t*proc;\n\tkxdrproc_t\t\txdr;\n\t__be32\t\t\tnfserr;\n\t__be32\t\t\t*nfserrp;\n\n\tdprintk(\"nfsd_dispatch: vers %d proc %d\\n\",\n \t\t\t\trqstp->rq_vers, rqstp->rq_proc);\n \tproc = rqstp->rq_procinfo;\n \n\tif (nfs_request_too_big(rqstp, proc)) {\n\t\tdprintk(\"nfsd: NFSv%d argument too large\\n\", rqstp->rq_vers);\n\t\t*statp = rpc_garbage_args;\n\t\treturn 1;\n\t}\n \t/*\n \t * Give the xdr decoder a chance to change this if it wants\n \t * (necessary in the NFSv4.0 compound case)\n\t */\n\trqstp->rq_cachetype = proc->pc_cachetype;\n\t/* Decode arguments */\n\txdr = proc->pc_decode;\n\tif (xdr && !xdr(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base,\n\t\t\trqstp->rq_argp)) {\n\t\tdprintk(\"nfsd: failed to decode arguments!\\n\");\n\t\t*statp = rpc_garbage_args;\n\t\treturn 1;\n\t}\n\n\t/* Check whether we have this call in the cache. */\n\tswitch (nfsd_cache_lookup(rqstp)) {\n\tcase RC_DROPIT:\n\t\treturn 0;\n\tcase RC_REPLY:\n\t\treturn 1;\n\tcase RC_DOIT:;\n\t\t/* do it */\n\t}\n\n\t/* need to grab the location to store the status, as\n\t * nfsv4 does some encoding while processing \n\t */\n\tnfserrp = rqstp->rq_res.head[0].iov_base\n\t\t+ rqstp->rq_res.head[0].iov_len;\n\trqstp->rq_res.head[0].iov_len += sizeof(__be32);\n\n\t/* Now call the procedure handler, and encode NFS status. */\n\tnfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);\n\tnfserr = map_new_errors(rqstp->rq_vers, nfserr);\n\tif (nfserr == nfserr_dropit || test_bit(RQ_DROPME, &rqstp->rq_flags)) {\n\t\tdprintk(\"nfsd: Dropping request; may be revisited later\\n\");\n\t\tnfsd_cache_update(rqstp, RC_NOCACHE, NULL);\n\t\treturn 0;\n\t}\n\n\tif (rqstp->rq_proc != 0)\n\t\t*nfserrp++ = nfserr;\n\n\t/* Encode result.\n\t * For NFSv2, additional info is never returned in case of an error.\n\t */\n\tif (!(nfserr && rqstp->rq_vers == 2)) {\n\t\txdr = proc->pc_encode;\n\t\tif (xdr && !xdr(rqstp, nfserrp,\n\t\t\t\trqstp->rq_resp)) {\n\t\t\t/* Failed to encode result. Release cache entry */\n\t\t\tdprintk(\"nfsd: failed to encode result!\\n\");\n\t\t\tnfsd_cache_update(rqstp, RC_NOCACHE, NULL);\n\t\t\t*statp = rpc_system_err;\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\t/* Store reply in cache. */\n\tnfsd_cache_update(rqstp, rqstp->rq_cachetype, statp + 1);\n\treturn 1;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d0947db40187f4708c58e64cbd6013faf9eddeed", + "input": "xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) {\n register const xmlChar *cmp = other;\n register const xmlChar *in;\n const xmlChar *ret;\n \n GROW;\n \n in = ctxt->input->cur;\n while (*in != 0 && *in == *cmp) {\n\t++in;\n\t++cmp;\n\tctxt->input->col++;\n }\n if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) {\n\t/* success */\n\tctxt->input->cur = in;\n\treturn (const xmlChar*) 1;\n }\n /* failure (or end of input buffer), check with full function */\n ret = xmlParseName (ctxt);\n /* strings coming from the dictionnary direct compare possible */\n if (ret == other) {\n\treturn (const xmlChar*) 1;\n }\n return ret;\n}\n", + "target": "xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) {\n register const xmlChar *cmp = other;\n register const xmlChar *in;\n const xmlChar *ret;\n \n GROW;\n if (ctxt->instate == XML_PARSER_EOF)\n return(NULL);\n \n in = ctxt->input->cur;\n while (*in != 0 && *in == *cmp) {\n\t++in;\n\t++cmp;\n\tctxt->input->col++;\n }\n if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) {\n\t/* success */\n\tctxt->input->cur = in;\n\treturn (const xmlChar*) 1;\n }\n /* failure (or end of input buffer), check with full function */\n ret = xmlParseName (ctxt);\n /* strings coming from the dictionnary direct compare possible */\n if (ret == other) {\n\treturn (const xmlChar*) 1;\n }\n return ret;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ae66a48d272b1fdc8bf475b107ae11d95edc91f9", + "input": "NetworkChangeNotifierLinux::NetworkChangeNotifierLinux()\n : notifier_thread_(new Thread) {\n base::Thread::Options thread_options(MessageLoop::TYPE_IO, 0);\n notifier_thread_->StartWithOptions(thread_options);\n}\n", + "target": "NetworkChangeNotifierLinux::NetworkChangeNotifierLinux()\nNetworkChangeNotifierLinux* NetworkChangeNotifierLinux::Create() {\n return new NetworkChangeNotifierLinux(NULL);\n}\n\nNetworkChangeNotifierLinux* NetworkChangeNotifierLinux::CreateForTest(\n dbus::Bus* bus) {\n return new NetworkChangeNotifierLinux(bus);\n}\n\nNetworkChangeNotifierLinux::NetworkChangeNotifierLinux(dbus::Bus* bus)\n : notifier_thread_(new Thread(bus)) {\n base::Thread::Options thread_options(MessageLoop::TYPE_IO, 0);\n notifier_thread_->StartWithOptions(thread_options);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#59512d1ea20d8e85555ecb743ee29ba90016656d", + "input": " void ImageFetched(const ContentSuggestion::ID& id,\n const GURL& url,\n const base::string16& title,\n const base::string16& text,\n base::Time timeout_at,\n const gfx::Image& image) {\n if (!ShouldNotifyInState(app_status_listener_.GetState())) {\n return; // Became foreground while we were fetching the image; forget it.\n }\n DVLOG(1) << \"Fetched \" << image.Size().width() << \"x\"\n << image.Size().height() << \" image for \" << url.spec();\n if (ContentSuggestionsNotificationHelper::SendNotification(\n id, url, title, text, CropSquare(image), timeout_at)) {\n RecordContentSuggestionsNotificationImpression(\n id.category().IsKnownCategory(KnownCategories::ARTICLES)\n ? CONTENT_SUGGESTIONS_ARTICLE\n : CONTENT_SUGGESTIONS_NONARTICLE);\n }\n }\n", + "target": " void ImageFetched(const ContentSuggestion::ID& id,\n const GURL& url,\n const base::string16& title,\n const base::string16& text,\n base::Time timeout_at,\n const gfx::Image& image) {\n if (!ShouldNotifyInState(app_status_listener_.GetState())) {\n return; // Became foreground while we were fetching the image; forget it.\n }\n DVLOG(1) << \"Fetched \" << image.Size().width() << \"x\"\n << image.Size().height() << \" image for \" << url.spec();\n ConsumeQuota(profile_->GetPrefs());\n if (ContentSuggestionsNotificationHelper::SendNotification(\n id, url, title, text, CropSquare(image), timeout_at)) {\n RecordContentSuggestionsNotificationImpression(\n id.category().IsKnownCategory(KnownCategories::ARTICLES)\n ? CONTENT_SUGGESTIONS_ARTICLE\n : CONTENT_SUGGESTIONS_NONARTICLE);\n }\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3f38b2253b19f9f9595f79fb92bfb5077e7b1959", + "input": " void CreatePersistentHistogramAllocator() {\n GlobalHistogramAllocator::GetCreateHistogramResultHistogram();\n GlobalHistogramAllocator::CreateWithLocalMemory(\n kAllocatorMemorySize, 0, \"HistogramAllocatorTest\");\n allocator_ = GlobalHistogramAllocator::Get()->memory_allocator();\n }\n", + "target": " void CreatePersistentHistogramAllocator() {\n GlobalHistogramAllocator::CreateWithLocalMemory(\n kAllocatorMemorySize, 0, \"HistogramAllocatorTest\");\n allocator_ = GlobalHistogramAllocator::Get()->memory_allocator();\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ecaaab5649781c5a0effdaf298a925063020500e", + "input": "static int encrypt(struct blkcipher_desc *desc,\n\t\t struct scatterlist *dst, struct scatterlist *src,\n\t\t unsigned int nbytes)\n{\n\tstruct blkcipher_walk walk;\n\tstruct crypto_blkcipher *tfm = desc->tfm;\n\tstruct salsa20_ctx *ctx = crypto_blkcipher_ctx(tfm);\n\tint err;\n\n\tblkcipher_walk_init(&walk, dst, src, nbytes);\n\terr = blkcipher_walk_virt_block(desc, &walk, 64);\n \n \tsalsa20_ivsetup(ctx, walk.iv);\n \n\tif (likely(walk.nbytes == nbytes))\n\t{\n\t\tsalsa20_encrypt_bytes(ctx, walk.src.virt.addr,\n\t\t\t\t walk.dst.virt.addr, nbytes);\n\t\treturn blkcipher_walk_done(desc, &walk, 0);\n\t}\n \twhile (walk.nbytes >= 64) {\n \t\tsalsa20_encrypt_bytes(ctx, walk.src.virt.addr,\n \t\t\t\t walk.dst.virt.addr,\n\t\t\t\t walk.nbytes - (walk.nbytes % 64));\n\t\terr = blkcipher_walk_done(desc, &walk, walk.nbytes % 64);\n\t}\n\n\tif (walk.nbytes) {\n\t\tsalsa20_encrypt_bytes(ctx, walk.src.virt.addr,\n\t\t\t\t walk.dst.virt.addr, walk.nbytes);\n\t\terr = blkcipher_walk_done(desc, &walk, 0);\n\t}\n\n\treturn err;\n}\n", + "target": "static int encrypt(struct blkcipher_desc *desc,\n\t\t struct scatterlist *dst, struct scatterlist *src,\n\t\t unsigned int nbytes)\n{\n\tstruct blkcipher_walk walk;\n\tstruct crypto_blkcipher *tfm = desc->tfm;\n\tstruct salsa20_ctx *ctx = crypto_blkcipher_ctx(tfm);\n\tint err;\n\n\tblkcipher_walk_init(&walk, dst, src, nbytes);\n\terr = blkcipher_walk_virt_block(desc, &walk, 64);\n \n \tsalsa20_ivsetup(ctx, walk.iv);\n \n \twhile (walk.nbytes >= 64) {\n \t\tsalsa20_encrypt_bytes(ctx, walk.src.virt.addr,\n \t\t\t\t walk.dst.virt.addr,\n\t\t\t\t walk.nbytes - (walk.nbytes % 64));\n\t\terr = blkcipher_walk_done(desc, &walk, walk.nbytes % 64);\n\t}\n\n\tif (walk.nbytes) {\n\t\tsalsa20_encrypt_bytes(ctx, walk.src.virt.addr,\n\t\t\t\t walk.dst.virt.addr, walk.nbytes);\n\t\terr = blkcipher_walk_done(desc, &walk, 0);\n\t}\n\n\treturn err;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#65437cee25199dbd385fb35901bc0011e164276c", + "input": "donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,\n int clazz, int swap, size_t align, int *flags, uint16_t *notecount)\n{\n\tElf32_Nhdr nh32;\n\tElf64_Nhdr nh64;\n\tsize_t noff, doff;\n\tuint32_t namesz, descsz;\n\tunsigned char *nbuf = CAST(unsigned char *, vbuf);\n\n\tif (*notecount == 0)\n\t\treturn 0;\n\t--*notecount;\n\n\tif (xnh_sizeof + offset > size) {\n\t\t/*\n\t\t * We're out of note headers.\n\t\t */\n\t\treturn xnh_sizeof + offset;\n\t}\n\n\t(void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);\n\toffset += xnh_sizeof;\n\n\tnamesz = xnh_namesz;\n\tdescsz = xnh_descsz;\n\tif ((namesz == 0) && (descsz == 0)) {\n\t\t/*\n\t\t * We're out of note headers.\n\t\t */\n\t\treturn (offset >= size) ? offset : size;\n\t}\n\n\tif (namesz & 0x80000000) {\n\t (void)file_printf(ms, \", bad note name size 0x%lx\",\n\t\t(unsigned long)namesz);\n\t return 0;\n\t}\n\n\tif (descsz & 0x80000000) {\n\t (void)file_printf(ms, \", bad note description size 0x%lx\",\n\t\t(unsigned long)descsz);\n\t return 0;\n\t}\n\n\tnoff = offset;\n\tdoff = ELF_ALIGN(offset + namesz);\n\n\tif (offset + namesz > size) {\n\t\t/*\n\t\t * We're past the end of the buffer.\n\t\t */\n\t\treturn doff;\n\t}\n\n\toffset = ELF_ALIGN(doff + descsz);\n\tif (doff + descsz > size) {\n\t\t/*\n\t\t * We're past the end of the buffer.\n\t\t */\n\t\treturn (offset >= size) ? offset : size;\n\t}\n\n\tif ((*flags & FLAGS_DID_OS_NOTE) == 0) {\n\t\tif (do_os_note(ms, nbuf, xnh_type, swap,\n\t\t namesz, descsz, noff, doff, flags))\n\t\t\treturn size;\n\t}\n\n\tif ((*flags & FLAGS_DID_BUILD_ID) == 0) {\n\t\tif (do_bid_note(ms, nbuf, xnh_type, swap,\n\t\t namesz, descsz, noff, doff, flags))\n\t\t\treturn size;\n\t}\n\t\t\n\tif ((*flags & FLAGS_DID_NETBSD_PAX) == 0) {\n\t\tif (do_pax_note(ms, nbuf, xnh_type, swap,\n\t\t namesz, descsz, noff, doff, flags))\n\t\t\treturn size;\n\t}\n\n\tif ((*flags & FLAGS_DID_CORE) == 0) {\n\t\tif (do_core_note(ms, nbuf, xnh_type, swap,\n\t\t namesz, descsz, noff, doff, flags, size, clazz))\n\t\t\treturn size;\n \t}\n \n \tif (namesz == 7 && strcmp((char *)&nbuf[noff], \"NetBSD\") == 0) {\n \t\tswitch (xnh_type) {\n \t \tcase NT_NETBSD_VERSION:\n \t\t\treturn size;\n \t\tcase NT_NETBSD_MARCH:\n \t\t\tif (*flags & FLAGS_DID_NETBSD_MARCH)\n \t\t\t\treturn size;\n\t\t\tif (file_printf(ms, \", compiled for: %.*s\", (int)descsz,\n\t\t\t (const char *)&nbuf[doff]) == -1)\n \t\t\t\treturn size;\n \t\t\tbreak;\n \t\tcase NT_NETBSD_CMODEL:\n \t\t\tif (*flags & FLAGS_DID_NETBSD_CMODEL)\n \t\t\t\treturn size;\n \t\t\tif (file_printf(ms, \", compiler model: %.*s\",\n \t\t\t (int)descsz, (const char *)&nbuf[doff]) == -1)\n \t\t\t\treturn size;\n \t\t\tbreak;\n \t\tdefault:\n \t\t\tif (*flags & FLAGS_DID_NETBSD_UNKNOWN)\n \t\t\t\treturn size;\n \t\t\tif (file_printf(ms, \", note=%u\", xnh_type) == -1)\n \t\t\t\treturn size;\n \t\t\tbreak;\n\t\t}\n\t\treturn size;\n\t}\n\n\treturn offset;\n}\n", + "target": "donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,\n int clazz, int swap, size_t align, int *flags, uint16_t *notecount)\n{\n\tElf32_Nhdr nh32;\n\tElf64_Nhdr nh64;\n\tsize_t noff, doff;\n\tuint32_t namesz, descsz;\n\tunsigned char *nbuf = CAST(unsigned char *, vbuf);\n\n\tif (*notecount == 0)\n\t\treturn 0;\n\t--*notecount;\n\n\tif (xnh_sizeof + offset > size) {\n\t\t/*\n\t\t * We're out of note headers.\n\t\t */\n\t\treturn xnh_sizeof + offset;\n\t}\n\n\t(void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);\n\toffset += xnh_sizeof;\n\n\tnamesz = xnh_namesz;\n\tdescsz = xnh_descsz;\n\tif ((namesz == 0) && (descsz == 0)) {\n\t\t/*\n\t\t * We're out of note headers.\n\t\t */\n\t\treturn (offset >= size) ? offset : size;\n\t}\n\n\tif (namesz & 0x80000000) {\n\t (void)file_printf(ms, \", bad note name size 0x%lx\",\n\t\t(unsigned long)namesz);\n\t return 0;\n\t}\n\n\tif (descsz & 0x80000000) {\n\t (void)file_printf(ms, \", bad note description size 0x%lx\",\n\t\t(unsigned long)descsz);\n\t return 0;\n\t}\n\n\tnoff = offset;\n\tdoff = ELF_ALIGN(offset + namesz);\n\n\tif (offset + namesz > size) {\n\t\t/*\n\t\t * We're past the end of the buffer.\n\t\t */\n\t\treturn doff;\n\t}\n\n\toffset = ELF_ALIGN(doff + descsz);\n\tif (doff + descsz > size) {\n\t\t/*\n\t\t * We're past the end of the buffer.\n\t\t */\n\t\treturn (offset >= size) ? offset : size;\n\t}\n\n\tif ((*flags & FLAGS_DID_OS_NOTE) == 0) {\n\t\tif (do_os_note(ms, nbuf, xnh_type, swap,\n\t\t namesz, descsz, noff, doff, flags))\n\t\t\treturn size;\n\t}\n\n\tif ((*flags & FLAGS_DID_BUILD_ID) == 0) {\n\t\tif (do_bid_note(ms, nbuf, xnh_type, swap,\n\t\t namesz, descsz, noff, doff, flags))\n\t\t\treturn size;\n\t}\n\t\t\n\tif ((*flags & FLAGS_DID_NETBSD_PAX) == 0) {\n\t\tif (do_pax_note(ms, nbuf, xnh_type, swap,\n\t\t namesz, descsz, noff, doff, flags))\n\t\t\treturn size;\n\t}\n\n\tif ((*flags & FLAGS_DID_CORE) == 0) {\n\t\tif (do_core_note(ms, nbuf, xnh_type, swap,\n\t\t namesz, descsz, noff, doff, flags, size, clazz))\n\t\t\treturn size;\n \t}\n \n \tif (namesz == 7 && strcmp((char *)&nbuf[noff], \"NetBSD\") == 0) {\n\t\tif (descsz > 100)\n\t\t\tdescsz = 100;\n \t\tswitch (xnh_type) {\n \t \tcase NT_NETBSD_VERSION:\n \t\t\treturn size;\n \t\tcase NT_NETBSD_MARCH:\n \t\t\tif (*flags & FLAGS_DID_NETBSD_MARCH)\n \t\t\t\treturn size;\n\t\t\t*flags |= FLAGS_DID_NETBSD_MARCH;\n\t\t\tif (file_printf(ms, \", compiled for: %.*s\",\n\t\t\t (int)descsz, (const char *)&nbuf[doff]) == -1)\n \t\t\t\treturn size;\n \t\t\tbreak;\n \t\tcase NT_NETBSD_CMODEL:\n \t\t\tif (*flags & FLAGS_DID_NETBSD_CMODEL)\n \t\t\t\treturn size;\n\t\t\t*flags |= FLAGS_DID_NETBSD_CMODEL;\n \t\t\tif (file_printf(ms, \", compiler model: %.*s\",\n \t\t\t (int)descsz, (const char *)&nbuf[doff]) == -1)\n \t\t\t\treturn size;\n \t\t\tbreak;\n \t\tdefault:\n \t\t\tif (*flags & FLAGS_DID_NETBSD_UNKNOWN)\n \t\t\t\treturn size;\n\t\t\t*flags |= FLAGS_DID_NETBSD_UNKNOWN;\n \t\t\tif (file_printf(ms, \", note=%u\", xnh_type) == -1)\n \t\t\t\treturn size;\n \t\t\tbreak;\n\t\t}\n\t\treturn size;\n\t}\n\n\treturn offset;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#01924fbe6c0e0f059ca46a03f9f6b2670ae3e0fa", + "input": " void Reset() {\n events_.clear();\n tap_ = false;\n tap_down_ = false;\n tap_cancel_ = false;\n begin_ = false;\n end_ = false;\n scroll_begin_ = false;\n scroll_update_ = false;\n scroll_end_ = false;\n pinch_begin_ = false;\n pinch_update_ = false;\n pinch_end_ = false;\n long_press_ = false;\n fling_ = false;\n two_finger_tap_ = false;\n show_press_ = false;\n swipe_left_ = false;\n swipe_right_ = false;\n swipe_up_ = false;\n swipe_down_ = false;\n\n scroll_begin_position_.SetPoint(0, 0);\n tap_location_.SetPoint(0, 0);\n gesture_end_location_.SetPoint(0, 0);\n\n scroll_x_ = 0;\n scroll_y_ = 0;\n scroll_velocity_x_ = 0;\n scroll_velocity_y_ = 0;\n velocity_x_ = 0;\n velocity_y_ = 0;\n scroll_x_hint_ = 0;\n scroll_y_hint_ = 0;\n tap_count_ = 0;\n scale_ = 0;\n flags_ = 0;\n }\n", + "target": " void Reset() {\n events_.clear();\n tap_ = false;\n tap_down_ = false;\n tap_cancel_ = false;\n begin_ = false;\n end_ = false;\n scroll_begin_ = false;\n scroll_update_ = false;\n scroll_end_ = false;\n pinch_begin_ = false;\n pinch_update_ = false;\n pinch_end_ = false;\n long_press_ = false;\n fling_ = false;\n two_finger_tap_ = false;\n show_press_ = false;\n swipe_left_ = false;\n swipe_right_ = false;\n swipe_up_ = false;\n swipe_down_ = false;\n\n scroll_begin_position_.SetPoint(0, 0);\n tap_location_.SetPoint(0, 0);\n gesture_end_location_.SetPoint(0, 0);\n\n scroll_x_ = 0;\n scroll_y_ = 0;\n scroll_velocity_x_ = 0;\n scroll_velocity_y_ = 0;\n velocity_x_ = 0;\n velocity_y_ = 0;\n scroll_x_hint_ = 0;\n scroll_y_hint_ = 0;\n tap_count_ = 0;\n scale_ = 0;\n flags_ = 0;\n latency_info_.Clear();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc7b094a338c6c521f918f478e993f0f74bbea0d", + "input": " static void IBusBusConnectedCallback(IBusBus* bus, gpointer user_data) {\n LOG(WARNING) << \"IBus connection is recovered.\";\n g_return_if_fail(user_data);\n InputMethodStatusConnection* self\n = static_cast(user_data);\n self->MaybeRestoreConnections();\n }\n", + "target": " static void IBusBusConnectedCallback(IBusBus* bus, gpointer user_data) {\n void IBusBusConnected(IBusBus* bus) {\n LOG(WARNING) << \"IBus connection is recovered.\";\n MaybeRestoreConnections();\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#295c883fe3105b19bcd0f9e07d54c6b589fc5bff", + "input": "OMX_ERRORTYPE SoftAMRNBEncoder::internalGetParameter(\n OMX_INDEXTYPE index, OMX_PTR params) {\n switch (index) {\n case OMX_IndexParamAudioPortFormat:\n {\n\n OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =\n (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;\n \n if (formatParams->nPortIndex > 1) {\n return OMX_ErrorUndefined;\n }\n\n if (formatParams->nIndex > 0) {\n return OMX_ErrorNoMore;\n }\n\n formatParams->eEncoding =\n (formatParams->nPortIndex == 0)\n ? OMX_AUDIO_CodingPCM : OMX_AUDIO_CodingAMR;\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioAmr:\n {\n\n OMX_AUDIO_PARAM_AMRTYPE *amrParams =\n (OMX_AUDIO_PARAM_AMRTYPE *)params;\n \n if (amrParams->nPortIndex != 1) {\n return OMX_ErrorUndefined;\n }\n\n amrParams->nChannels = 1;\n amrParams->nBitRate = mBitRate;\n amrParams->eAMRBandMode = (OMX_AUDIO_AMRBANDMODETYPE)(mMode + 1);\n amrParams->eAMRDTXMode = OMX_AUDIO_AMRDTXModeOff;\n amrParams->eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF;\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioPcm:\n {\n\n OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =\n (OMX_AUDIO_PARAM_PCMMODETYPE *)params;\n \n if (pcmParams->nPortIndex != 0) {\n return OMX_ErrorUndefined;\n }\n\n pcmParams->eNumData = OMX_NumericalDataSigned;\n pcmParams->eEndian = OMX_EndianBig;\n pcmParams->bInterleaved = OMX_TRUE;\n pcmParams->nBitPerSample = 16;\n pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear;\n pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelCF;\n\n pcmParams->nChannels = 1;\n pcmParams->nSamplingRate = kSampleRate;\n\n return OMX_ErrorNone;\n }\n\n default:\n return SimpleSoftOMXComponent::internalGetParameter(index, params);\n }\n}\n", + "target": "OMX_ERRORTYPE SoftAMRNBEncoder::internalGetParameter(\n OMX_INDEXTYPE index, OMX_PTR params) {\n switch (index) {\n case OMX_IndexParamAudioPortFormat:\n {\n\n OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =\n (OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;\n \n if (!isValidOMXParam(formatParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (formatParams->nPortIndex > 1) {\n return OMX_ErrorUndefined;\n }\n\n if (formatParams->nIndex > 0) {\n return OMX_ErrorNoMore;\n }\n\n formatParams->eEncoding =\n (formatParams->nPortIndex == 0)\n ? OMX_AUDIO_CodingPCM : OMX_AUDIO_CodingAMR;\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioAmr:\n {\n\n OMX_AUDIO_PARAM_AMRTYPE *amrParams =\n (OMX_AUDIO_PARAM_AMRTYPE *)params;\n \n if (!isValidOMXParam(amrParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (amrParams->nPortIndex != 1) {\n return OMX_ErrorUndefined;\n }\n\n amrParams->nChannels = 1;\n amrParams->nBitRate = mBitRate;\n amrParams->eAMRBandMode = (OMX_AUDIO_AMRBANDMODETYPE)(mMode + 1);\n amrParams->eAMRDTXMode = OMX_AUDIO_AMRDTXModeOff;\n amrParams->eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF;\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioPcm:\n {\n\n OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =\n (OMX_AUDIO_PARAM_PCMMODETYPE *)params;\n \n if (!isValidOMXParam(pcmParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (pcmParams->nPortIndex != 0) {\n return OMX_ErrorUndefined;\n }\n\n pcmParams->eNumData = OMX_NumericalDataSigned;\n pcmParams->eEndian = OMX_EndianBig;\n pcmParams->bInterleaved = OMX_TRUE;\n pcmParams->nBitPerSample = 16;\n pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear;\n pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelCF;\n\n pcmParams->nChannels = 1;\n pcmParams->nSamplingRate = kSampleRate;\n\n return OMX_ErrorNone;\n }\n\n default:\n return SimpleSoftOMXComponent::internalGetParameter(index, params);\n }\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7f0126ff011142c8619b10a6e64d04d1745c503a", + "input": "void LinkChangeSerializerMarkupAccumulator::appendElement(StringBuilder& result, Element* element, Namespaces* namespaces)\n{\n if (element->hasTagName(HTMLNames::baseTag)) {\n result.append(\"\\n\",\n static_cast(m_document->url().string().utf8().length()),\n m_document->url().string().utf8().data()));\n }\n SerializerMarkupAccumulator::appendElement(result, element, namespaces);\n if (element->hasTagName(HTMLNames::baseTag)) {\n result.appendLiteral(\"-->\");\n result.appendLiteral(\"baseTarget().isEmpty()) {\n result.appendLiteral(\" target=\\\"\");\n result.append(m_document->baseTarget());\n result.append('\"');\n }\n if (m_document->isXHTMLDocument())\n result.appendLiteral(\" />\");\n else\n result.appendLiteral(\">\");\n }\n}\n", + "target": "void LinkChangeSerializerMarkupAccumulator::appendElement(StringBuilder& result, Element* element, Namespaces* namespaces)\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long Segment::ParseCues(\n long long off,\n long long& pos,\n long& len)\n{\n if (m_pCues)\n return 0; //success\n \n if (off < 0)\n return -1;\n \n long long total, avail;\n \n const int status = m_pReader->Length(&total, &avail);\n \n if (status < 0) //error\n return status;\n \n assert((total < 0) || (avail <= total));\n \n pos = m_start + off;\n \n if ((total < 0) || (pos >= total))\n return 1; //don't bother parsing cues\n \n const long long element_start = pos;\n const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;\n \n if ((pos + 1) > avail)\n {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n \n long long result = GetUIntLength(m_pReader, pos, len);\n \n if (result < 0) //error\n return static_cast(result);\n \n if (result > 0) //underflow (weird)\n {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n \n if ((segment_stop >= 0) && ((pos + len) > segment_stop))\n return E_FILE_FORMAT_INVALID;\n \n if ((pos + len) > avail)\n return E_BUFFER_NOT_FULL;\n \n const long long idpos = pos;\n \n const long long id = ReadUInt(m_pReader, idpos, len);\n \n if (id != 0x0C53BB6B) //Cues ID\n return E_FILE_FORMAT_INVALID;\n \n pos += len; //consume ID\n assert((segment_stop < 0) || (pos <= segment_stop));\n \n \n if ((pos + 1) > avail)\n {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n \n result = GetUIntLength(m_pReader, pos, len);\n \n if (result < 0) //error\n return static_cast(result);\n \n if (result > 0) //underflow (weird)\n {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n \n if ((segment_stop >= 0) && ((pos + len) > segment_stop))\n return E_FILE_FORMAT_INVALID;\n \n if ((pos + len) > avail)\n return E_BUFFER_NOT_FULL;\n \n const long long size = ReadUInt(m_pReader, pos, len);\n \n if (size < 0) //error\n return static_cast(size);\n \n if (size == 0) //weird, although technically not illegal\n return 1; //done\n \n pos += len; //consume length of size of element\n assert((segment_stop < 0) || (pos <= segment_stop));\n \n \n const long long element_stop = pos + size;\n \n if ((segment_stop >= 0) && (element_stop > segment_stop))\n return E_FILE_FORMAT_INVALID;\n \n if ((total >= 0) && (element_stop > total))\n return 1; //don't bother parsing anymore\n \n len = static_cast(size);\n \n if (element_stop > avail)\n return E_BUFFER_NOT_FULL;\n \n const long long element_size = element_stop - element_start;\n \n m_pCues = new (std::nothrow) Cues(\n this,\n pos,\n size,\n element_start,\n element_size);\n assert(m_pCues); //TODO\n \n return 0; //success\n }\n", + "target": "long Segment::ParseCues(\nlong Segment::ParseCues(long long off, long long& pos, long& len) {\n if (m_pCues)\n return 0; // success\n \n if (off < 0)\n return -1;\n \n long long total, avail;\n \n const int status = m_pReader->Length(&total, &avail);\n \n if (status < 0) // error\n return status;\n \n assert((total < 0) || (avail <= total));\n \n pos = m_start + off;\n \n if ((total < 0) || (pos >= total))\n return 1; // don't bother parsing cues\n \n const long long element_start = pos;\n const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;\n \n if ((pos + 1) > avail) {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n \n long long result = GetUIntLength(m_pReader, pos, len);\n \n if (result < 0) // error\n return static_cast(result);\n \n if (result > 0) // underflow (weird)\n {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n \n if ((segment_stop >= 0) && ((pos + len) > segment_stop))\n return E_FILE_FORMAT_INVALID;\n \n if ((pos + len) > avail)\n return E_BUFFER_NOT_FULL;\n \n const long long idpos = pos;\n \n const long long id = ReadUInt(m_pReader, idpos, len);\n \n if (id != 0x0C53BB6B) // Cues ID\n return E_FILE_FORMAT_INVALID;\n \n pos += len; // consume ID\n assert((segment_stop < 0) || (pos <= segment_stop));\n \n // Read Size\n \n if ((pos + 1) > avail) {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n \n result = GetUIntLength(m_pReader, pos, len);\n \n if (result < 0) // error\n return static_cast(result);\n \n if (result > 0) // underflow (weird)\n {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n \n if ((segment_stop >= 0) && ((pos + len) > segment_stop))\n return E_FILE_FORMAT_INVALID;\n \n if ((pos + len) > avail)\n return E_BUFFER_NOT_FULL;\n \n const long long size = ReadUInt(m_pReader, pos, len);\n \n if (size < 0) // error\n return static_cast(size);\n \n if (size == 0) // weird, although technically not illegal\n return 1; // done\n \n pos += len; // consume length of size of element\n assert((segment_stop < 0) || (pos <= segment_stop));\n \n // Pos now points to start of payload\n \n const long long element_stop = pos + size;\n \n if ((segment_stop >= 0) && (element_stop > segment_stop))\n return E_FILE_FORMAT_INVALID;\n \n if ((total >= 0) && (element_stop > total))\n return 1; // don't bother parsing anymore\n \n len = static_cast(size);\n \n if (element_stop > avail)\n return E_BUFFER_NOT_FULL;\n \n const long long element_size = element_stop - element_start;\n \n m_pCues =\n new (std::nothrow) Cues(this, pos, size, element_start, element_size);\n assert(m_pCues); // TODO\n \n return 0; // success\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#14ff9d0cded8ae8032ef027d1f33c6666a695019", + "input": "FileBrowserHandlerCustomBindings::FileBrowserHandlerCustomBindings(\n ScriptContext* context)\n : ObjectBackedNativeHandler(context) {\n RouteFunction(\n \"GetExternalFileEntry\",\n base::Bind(&FileBrowserHandlerCustomBindings::GetExternalFileEntry,\n base::Unretained(this)));\n RouteFunction(\"GetEntryURL\",\n base::Bind(&FileBrowserHandlerCustomBindings::GetEntryURL,\n base::Unretained(this)));\n }\n", + "target": "FileBrowserHandlerCustomBindings::FileBrowserHandlerCustomBindings(\n ScriptContext* context)\n : ObjectBackedNativeHandler(context) {\n RouteFunction(\n \"GetExternalFileEntry\", \"fileBrowserHandler\",\n base::Bind(\n &FileBrowserHandlerCustomBindings::GetExternalFileEntryCallback,\n base::Unretained(this)));\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6217e5ede23285ddfee10d2e4ba0cc2d4c046205", + "input": "static int snd_compress_check_input(struct snd_compr_params *params)\n {\n \t/* first let's check the buffer parameter's */\n \tif (params->buffer.fragment_size == 0 ||\n\t\t\tparams->buffer.fragments > SIZE_MAX / params->buffer.fragment_size)\n \t\treturn -EINVAL;\n \n \t/* now codec parameters */\n\tif (params->codec.id == 0 || params->codec.id > SND_AUDIOCODEC_MAX)\n\t\treturn -EINVAL;\n\n\tif (params->codec.ch_in == 0 || params->codec.ch_out == 0)\n\t\treturn -EINVAL;\n\n\treturn 0;\n}\n", + "target": "static int snd_compress_check_input(struct snd_compr_params *params)\n {\n \t/* first let's check the buffer parameter's */\n \tif (params->buffer.fragment_size == 0 ||\n\t params->buffer.fragments > INT_MAX / params->buffer.fragment_size)\n \t\treturn -EINVAL;\n \n \t/* now codec parameters */\n\tif (params->codec.id == 0 || params->codec.id > SND_AUDIOCODEC_MAX)\n\t\treturn -EINVAL;\n\n\tif (params->codec.ch_in == 0 || params->codec.ch_out == 0)\n\t\treturn -EINVAL;\n\n\treturn 0;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d917514bd6b270df431ea4e781a865764d406120", + "input": "static bool get_build_id(\n Backtrace* backtrace, uintptr_t base_addr, uint8_t* e_ident, std::string* build_id) {\n HdrType hdr;\n\n memcpy(&hdr.e_ident[0], e_ident, EI_NIDENT);\n\n if (backtrace->Read(base_addr + EI_NIDENT, reinterpret_cast(&hdr) + EI_NIDENT,\n sizeof(HdrType) - EI_NIDENT) != sizeof(HdrType) - EI_NIDENT) {\n return false;\n }\n\n for (size_t i = 0; i < hdr.e_phnum; i++) {\n PhdrType phdr;\n if (backtrace->Read(base_addr + hdr.e_phoff + i * hdr.e_phentsize,\n reinterpret_cast(&phdr), sizeof(phdr)) != sizeof(phdr)) {\n return false;\n }\n if (phdr.p_type == PT_NOTE) {\n size_t hdr_size = phdr.p_filesz;\n uintptr_t addr = base_addr + phdr.p_offset;\n while (hdr_size >= sizeof(NhdrType)) {\n NhdrType nhdr;\n if (backtrace->Read(addr, reinterpret_cast(&nhdr), sizeof(nhdr)) != sizeof(nhdr)) {\n return false;\n }\n addr += sizeof(nhdr);\n\n if (nhdr.n_type == NT_GNU_BUILD_ID) {\n addr += NOTE_ALIGN(nhdr.n_namesz);\n uint8_t build_id_data[128];\n if (nhdr.n_namesz > sizeof(build_id_data)) {\n ALOGE(\"Possible corrupted note, name size value is too large: %u\",\n nhdr.n_namesz);\n return false;\n }\n if (backtrace->Read(addr, build_id_data, nhdr.n_descsz) != nhdr.n_descsz) {\n return false;\n }\n\n build_id->clear();\n for (size_t bytes = 0; bytes < nhdr.n_descsz; bytes++) {\n *build_id += android::base::StringPrintf(\"%02x\", build_id_data[bytes]);\n }\n\n return true;\n } else {\n hdr_size -= sizeof(nhdr);\n size_t skip_bytes = NOTE_ALIGN(nhdr.n_namesz) + NOTE_ALIGN(nhdr.n_descsz);\n addr += skip_bytes;\n if (hdr_size < skip_bytes) {\n break;\n }\n hdr_size -= skip_bytes;\n }\n }\n }\n }\n return false;\n}\n", + "target": "static bool get_build_id(\n Backtrace* backtrace, uintptr_t base_addr, uint8_t* e_ident, std::string* build_id) {\n HdrType hdr;\n\n memcpy(&hdr.e_ident[0], e_ident, EI_NIDENT);\n\n if (backtrace->Read(base_addr + EI_NIDENT, reinterpret_cast(&hdr) + EI_NIDENT,\n sizeof(HdrType) - EI_NIDENT) != sizeof(HdrType) - EI_NIDENT) {\n return false;\n }\n\n for (size_t i = 0; i < hdr.e_phnum; i++) {\n PhdrType phdr;\n if (backtrace->Read(base_addr + hdr.e_phoff + i * hdr.e_phentsize,\n reinterpret_cast(&phdr), sizeof(phdr)) != sizeof(phdr)) {\n return false;\n }\n if (phdr.p_type == PT_NOTE) {\n size_t hdr_size = phdr.p_filesz;\n uintptr_t addr = base_addr + phdr.p_offset;\n while (hdr_size >= sizeof(NhdrType)) {\n NhdrType nhdr;\n if (backtrace->Read(addr, reinterpret_cast(&nhdr), sizeof(nhdr)) != sizeof(nhdr)) {\n return false;\n }\n addr += sizeof(nhdr);\n\n if (nhdr.n_type == NT_GNU_BUILD_ID) {\n addr += NOTE_ALIGN(nhdr.n_namesz);\n uint8_t build_id_data[160];\n if (nhdr.n_descsz > sizeof(build_id_data)) {\n ALOGE(\"Possible corrupted note, desc size value is too large: %u\",\n nhdr.n_descsz);\n return false;\n }\n if (backtrace->Read(addr, build_id_data, nhdr.n_descsz) != nhdr.n_descsz) {\n return false;\n }\n\n build_id->clear();\n for (size_t bytes = 0; bytes < nhdr.n_descsz; bytes++) {\n *build_id += android::base::StringPrintf(\"%02x\", build_id_data[bytes]);\n }\n\n return true;\n } else {\n hdr_size -= sizeof(nhdr);\n size_t skip_bytes = NOTE_ALIGN(nhdr.n_namesz) + NOTE_ALIGN(nhdr.n_descsz);\n addr += skip_bytes;\n if (hdr_size < skip_bytes) {\n break;\n }\n hdr_size -= skip_bytes;\n }\n }\n }\n }\n return false;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2f01a0cb03732fdb982dd42786d95736322d2241", + "input": "bool SetExtendedFileAttribute(const char* path,\n const char* name,\n const char* value,\n size_t value_size,\n int flags) {\n//// On Chrome OS, there is no component that can validate these extended\n//// attributes so there is no need to set them.\n base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);\n int result = setxattr(path, name, value, value_size, flags);\n if (result) {\n DPLOG(ERROR) << \"Could not set extended attribute \" << name << \" on file \"\n << path;\n return false;\n }\n return true;\n }\n", + "target": "bool SetExtendedFileAttribute(const char* path,\n const char* name,\n const char* value,\n size_t value_size,\n int flags) {\n//// On Chrome OS, there is no component that can validate these extended\n//// attributes so there is no need to set them.\n#if !defined(OS_CHROMEOS)\n base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);\n int result = setxattr(path, name, value, value_size, flags);\n if (result) {\n DPLOG(ERROR) << \"Could not set extended attribute \" << name << \" on file \"\n << path;\n return false;\n }\n#endif // !defined(OS_CHROMEOS)\n return true;\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d2ab84732936b6e7e5a461dc94344902965e9a06", + "input": "xps_load_sfnt_name(xps_font_t *font, char *namep)\n{\n byte *namedata;\n int offset, length;\n /*int format;*/\n int count, stringoffset;\n int found;\n int i, k;\n\n found = 0;\n strcpy(namep, \"Unknown\");\n\n offset = xps_find_sfnt_table(font, \"name\", &length);\n if (offset < 0 || length < 6)\n {\n gs_warn(\"cannot find name table\");\n return;\n }\n \n namedata = font->data + offset;\n \n /*format = u16(namedata + 0);*/\n count = u16(namedata + 2);\n stringoffset = u16(namedata + 4);\n \n if (length < 6 + (count * 12))\n {\n gs_warn(\"name table too short\");\n {\n if (pid == 1 && eid == 0 && langid == 0) /* mac roman, english */\n {\n if (found < 3)\n {\n memcpy(namep, namedata + stringoffset + offset, length);\n namep[length] = 0;\n found = 3;\n }\n }\n\n if (pid == 3 && eid == 1 && langid == 0x409) /* windows unicode ucs-2, US */\n {\n if (found < 2)\n {\n unsigned char *s = namedata + stringoffset + offset;\n int n = length / 2;\n for (k = 0; k < n; k ++)\n {\n int c = u16(s + k * 2);\n namep[k] = isprint(c) ? c : '?';\n }\n namep[k] = 0;\n found = 2;\n }\n }\n\n if (pid == 3 && eid == 10 && langid == 0x409) /* windows unicode ucs-4, US */\n {\n if (found < 1)\n {\n unsigned char *s = namedata + stringoffset + offset;\n int n = length / 4;\n for (k = 0; k < n; k ++)\n {\n int c = u32(s + k * 4);\n namep[k] = isprint(c) ? c : '?';\n }\n namep[k] = 0;\n found = 1;\n }\n }\n }\n }\n}\n", + "target": "xps_load_sfnt_name(xps_font_t *font, char *namep)\n{\n byte *namedata;\n int offset, length;\n /*int format;*/\n int count, stringoffset;\n int found;\n int i, k;\n\n found = 0;\n strcpy(namep, \"Unknown\");\n\n offset = xps_find_sfnt_table(font, \"name\", &length);\n if (offset < 0 || length < 6)\n {\n gs_warn(\"cannot find name table\");\n return;\n }\n \n /* validate the offset, and the data for the two\n * values we're about to read\n */\n if (offset + 6 > font->length)\n {\n gs_warn(\"name table byte offset invalid\");\n return;\n }\n namedata = font->data + offset;\n \n /*format = u16(namedata + 0);*/\n count = u16(namedata + 2);\n stringoffset = u16(namedata + 4);\n \n if (stringoffset + offset > font->length\n || offset + 6 + count * 12 > font->length)\n {\n gs_warn(\"name table invalid\");\n return;\n }\n\n if (length < 6 + (count * 12))\n {\n gs_warn(\"name table too short\");\n {\n if (pid == 1 && eid == 0 && langid == 0) /* mac roman, english */\n {\n if (found < 3)\n {\n memcpy(namep, namedata + stringoffset + offset, length);\n namep[length] = 0;\n found = 3;\n }\n }\n\n if (pid == 3 && eid == 1 && langid == 0x409) /* windows unicode ucs-2, US */\n {\n if (found < 2)\n {\n unsigned char *s = namedata + stringoffset + offset;\n int n = length / 2;\n for (k = 0; k < n; k ++)\n {\n int c = u16(s + k * 2);\n namep[k] = isprint(c) ? c : '?';\n }\n namep[k] = 0;\n found = 2;\n }\n }\n\n if (pid == 3 && eid == 10 && langid == 0x409) /* windows unicode ucs-4, US */\n {\n if (found < 1)\n {\n unsigned char *s = namedata + stringoffset + offset;\n int n = length / 4;\n for (k = 0; k < n; k ++)\n {\n int c = u32(s + k * 4);\n namep[k] = isprint(c) ? c : '?';\n }\n namep[k] = 0;\n found = 1;\n }\n }\n }\n }\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#295c883fe3105b19bcd0f9e07d54c6b589fc5bff", + "input": "OMX_ERRORTYPE SoftMP3::internalGetParameter(\n OMX_INDEXTYPE index, OMX_PTR params) {\n switch (index) {\n case OMX_IndexParamAudioPcm:\n {\n\n OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =\n (OMX_AUDIO_PARAM_PCMMODETYPE *)params;\n \n if (pcmParams->nPortIndex > 1) {\n return OMX_ErrorUndefined;\n }\n\n pcmParams->eNumData = OMX_NumericalDataSigned;\n pcmParams->eEndian = OMX_EndianBig;\n pcmParams->bInterleaved = OMX_TRUE;\n pcmParams->nBitPerSample = 16;\n pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear;\n pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelLF;\n pcmParams->eChannelMapping[1] = OMX_AUDIO_ChannelRF;\n\n pcmParams->nChannels = mNumChannels;\n pcmParams->nSamplingRate = mSamplingRate;\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioMp3:\n {\n\n OMX_AUDIO_PARAM_MP3TYPE *mp3Params =\n (OMX_AUDIO_PARAM_MP3TYPE *)params;\n \n if (mp3Params->nPortIndex > 1) {\n return OMX_ErrorUndefined;\n }\n\n mp3Params->nChannels = mNumChannels;\n mp3Params->nBitRate = 0 /* unknown */;\n mp3Params->nSampleRate = mSamplingRate;\n\n return OMX_ErrorNone;\n }\n\n default:\n return SimpleSoftOMXComponent::internalGetParameter(index, params);\n }\n}\n", + "target": "OMX_ERRORTYPE SoftMP3::internalGetParameter(\n OMX_INDEXTYPE index, OMX_PTR params) {\n switch (index) {\n case OMX_IndexParamAudioPcm:\n {\n\n OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =\n (OMX_AUDIO_PARAM_PCMMODETYPE *)params;\n \n if (!isValidOMXParam(pcmParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (pcmParams->nPortIndex > 1) {\n return OMX_ErrorUndefined;\n }\n\n pcmParams->eNumData = OMX_NumericalDataSigned;\n pcmParams->eEndian = OMX_EndianBig;\n pcmParams->bInterleaved = OMX_TRUE;\n pcmParams->nBitPerSample = 16;\n pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear;\n pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelLF;\n pcmParams->eChannelMapping[1] = OMX_AUDIO_ChannelRF;\n\n pcmParams->nChannels = mNumChannels;\n pcmParams->nSamplingRate = mSamplingRate;\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioMp3:\n {\n\n OMX_AUDIO_PARAM_MP3TYPE *mp3Params =\n (OMX_AUDIO_PARAM_MP3TYPE *)params;\n \n if (!isValidOMXParam(mp3Params)) {\n return OMX_ErrorBadParameter;\n }\n\n if (mp3Params->nPortIndex > 1) {\n return OMX_ErrorUndefined;\n }\n\n mp3Params->nChannels = mNumChannels;\n mp3Params->nBitRate = 0 /* unknown */;\n mp3Params->nSampleRate = mSamplingRate;\n\n return OMX_ErrorNone;\n }\n\n default:\n return SimpleSoftOMXComponent::internalGetParameter(index, params);\n }\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4d00135a680727f6c3be78f8befaac009030e4df", + "input": " static void opl3_setup_voice(int dev, int voice, int chn)\n {\n\tstruct channel_info *info =\n\t&synth_devs[dev]->chn_info[chn];\n \n \topl3_set_instr(dev, voice, info->pgm_num);\n \n\tdevc->voc[voice].bender = 0;\n\tdevc->voc[voice].bender_range = info->bender_range;\n\tdevc->voc[voice].volume = info->controllers[CTL_MAIN_VOLUME];\n\tdevc->voc[voice].panning = (info->controllers[CTL_PAN] * 2) - 128;\n}\n", + "target": " static void opl3_setup_voice(int dev, int voice, int chn)\n {\n\tstruct channel_info *info;\n\n\tif (voice < 0 || voice >= devc->nr_voice)\n\t\treturn;\n\n\tif (chn < 0 || chn > 15)\n\t\treturn;\n\n\tinfo = &synth_devs[dev]->chn_info[chn];\n \n \topl3_set_instr(dev, voice, info->pgm_num);\n \n\tdevc->voc[voice].bender = 0;\n\tdevc->voc[voice].bender_range = info->bender_range;\n\tdevc->voc[voice].volume = info->controllers[CTL_MAIN_VOLUME];\n\tdevc->voc[voice].panning = (info->controllers[CTL_PAN] * 2) - 128;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3ca657a8793dd011bf869695d72ad31c779c3cc1", + "input": " swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)\n {\n \tuint32* wp = (uint32*) cp0;\n \ttmsize_t wc = cc / 4;\n \n TIFFSwabArrayOfLong(wp, wc);\n\thorAcc32(tif, cp0, cc);\n }\n", + "target": " swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)\n {\n \tuint32* wp = (uint32*) cp0;\n \ttmsize_t wc = cc / 4;\n \n TIFFSwabArrayOfLong(wp, wc);\n\treturn horAcc32(tif, cp0, cc);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e3a5d056633677959ad924a51758876d415e7046", + "input": "void comps_rtree_unite(COMPS_RTree *rt1, COMPS_RTree *rt2) {\n COMPS_HSList *tmplist, *tmp_subnodes;\n COMPS_HSListItem *it;\n struct Pair {\n COMPS_HSList * subnodes;\n char * key;\n char added;\n } *pair, *parent_pair;\n \n pair = malloc(sizeof(struct Pair));\n pair->subnodes = rt2->subnodes;\n pair->key = NULL;\n\n tmplist = comps_hslist_create();\n comps_hslist_init(tmplist, NULL, NULL, &free);\n comps_hslist_append(tmplist, pair, 0);\n\n while (tmplist->first != NULL) {\n it = tmplist->first;\n comps_hslist_remove(tmplist, tmplist->first);\n tmp_subnodes = ((struct Pair*)it->data)->subnodes;\n parent_pair = (struct Pair*) it->data;\n free(it);\n\n for (it = tmp_subnodes->first; it != NULL; it=it->next) {\n pair = malloc(sizeof(struct Pair));\n pair->subnodes = ((COMPS_RTreeData*)it->data)->subnodes;\n\n if (parent_pair->key != NULL) {\n pair->key = malloc(sizeof(char)\n * (strlen(((COMPS_RTreeData*)it->data)->key)\n + strlen(parent_pair->key) + 1));\n memcpy(pair->key, parent_pair->key,\n sizeof(char) * strlen(parent_pair->key));\n memcpy(pair->key + strlen(parent_pair->key),\n ((COMPS_RTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_RTreeData*)it->data)->key)+1));\n } else {\n pair->key = malloc(sizeof(char)*\n (strlen(((COMPS_RTreeData*)it->data)->key) +1));\n memcpy(pair->key, ((COMPS_RTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_RTreeData*)it->data)->key)+1));\n }\n /* current node has data */\n if (((COMPS_RTreeData*)it->data)->data != NULL) {\n comps_rtree_set(rt1,\n pair->key,\n rt2->data_cloner(((COMPS_RTreeData*)it->data)->data));\n }\n if (((COMPS_RTreeData*)it->data)->subnodes->first) {\n comps_hslist_append(tmplist, pair, 0);\n } else {\n free(pair->key);\n free(pair);\n }\n }\n free(parent_pair->key);\n free(parent_pair);\n }\n comps_hslist_destroy(&tmplist);\n}\n", + "target": "void comps_rtree_unite(COMPS_RTree *rt1, COMPS_RTree *rt2) {\n COMPS_HSList *tmplist, *tmp_subnodes;\n COMPS_HSListItem *it;\n struct Pair {\n COMPS_HSList * subnodes;\n char * key;\n } *pair, *parent_pair;\n \n pair = malloc(sizeof(struct Pair));\n pair->subnodes = rt2->subnodes;\n pair->key = NULL;\n\n tmplist = comps_hslist_create();\n comps_hslist_init(tmplist, NULL, NULL, &free);\n comps_hslist_append(tmplist, pair, 0);\n\n while (tmplist->first != NULL) {\n it = tmplist->first;\n comps_hslist_remove(tmplist, tmplist->first);\n tmp_subnodes = ((struct Pair*)it->data)->subnodes;\n parent_pair = (struct Pair*) it->data;\n free(it);\n\n for (it = tmp_subnodes->first; it != NULL; it=it->next) {\n pair = malloc(sizeof(struct Pair));\n pair->subnodes = ((COMPS_RTreeData*)it->data)->subnodes;\n\n if (parent_pair->key != NULL) {\n pair->key = malloc(sizeof(char)\n * (strlen(((COMPS_RTreeData*)it->data)->key)\n + strlen(parent_pair->key) + 1));\n memcpy(pair->key, parent_pair->key,\n sizeof(char) * strlen(parent_pair->key));\n memcpy(pair->key + strlen(parent_pair->key),\n ((COMPS_RTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_RTreeData*)it->data)->key)+1));\n } else {\n pair->key = malloc(sizeof(char)*\n (strlen(((COMPS_RTreeData*)it->data)->key) +1));\n memcpy(pair->key, ((COMPS_RTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_RTreeData*)it->data)->key)+1));\n }\n /* current node has data */\n if (((COMPS_RTreeData*)it->data)->data != NULL) {\n comps_rtree_set(rt1,\n pair->key,\n rt2->data_cloner(((COMPS_RTreeData*)it->data)->data));\n }\n if (((COMPS_RTreeData*)it->data)->subnodes->first) {\n comps_hslist_append(tmplist, pair, 0);\n } else {\n free(pair->key);\n free(pair);\n }\n }\n free(parent_pair->key);\n free(parent_pair);\n }\n comps_hslist_destroy(&tmplist);\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-079#2-e3262a46f2fc", + "input": " def get_value(self):\n if self.column.render_function:\n # We don't want to escape our html\n return self.column.render_function(self.object)\n\n field = getattr(self.object, self.column.field_name) if self.column.field_name else None\n if type(self.object) == dict:\n value = self.object.get(self.column.field_name)\n elif callable(field):\n value = field() if getattr(field, 'do_not_call_in_templates', False) else field\n else:\n display_function = getattr(self.object, 'get_%s_display' % self.column.field_name, False)\n value = display_function() if display_function else field\n\n return escape(value)", + "target": " def get_value(self):\n field = getattr(self.object, self.column.field_name) if self.column.field_name else None\n if self.column.render_function:\n template = self.column.render_function(self.object)\n if not self.is_template_instance(template):\n raise SmartListException(\n 'Your render_function {} should return django.template.Template or django.template.backends.django.Template object instead of {}'.format(\n self.column.render_function.__name__,\n type(template),\n )\n )\n value = template.render()\n elif type(self.object) == dict:\n value = self.object.get(self.column.field_name)\n elif callable(field):\n value = field() if getattr(field, 'do_not_call_in_templates', False) else field\n else:\n display_function = getattr(self.object, 'get_%s_display' % self.column.field_name, False)\n value = display_function() if display_function else field\n\n return value", + "vul_type": "cwe-079", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#7a3439b3d169047c1c07f28a6f9cda341328980b", + "input": "bool PrintWebViewHelper::GetPrintSettingsFromUser(WebKit::WebFrame* frame,\n const WebKit::WebNode& node,\n int expected_pages_count,\n bool use_browser_overlays) {\n PrintHostMsg_ScriptedPrint_Params params;\n PrintMsg_PrintPages_Params print_settings;\n\n params.host_window_id = render_view()->GetHostWindow();\n params.cookie = print_pages_params_->params.document_cookie;\n params.has_selection = frame->hasSelection();\n params.expected_pages_count = expected_pages_count;\n printing::MarginType margin_type = printing::DEFAULT_MARGINS;\n if (PrintingNodeOrPdfFrame(frame, node))\n margin_type = GetMarginsForPdf(frame, node);\n params.margin_type = margin_type;\n \n Send(new PrintHostMsg_DidShowPrintDialog(routing_id()));\n \n print_pages_params_.reset();\n IPC::SyncMessage* msg =\n new PrintHostMsg_ScriptedPrint(routing_id(), params, &print_settings);\n msg->EnableMessagePumping();\n Send(msg);\n print_pages_params_.reset(new PrintMsg_PrintPages_Params(print_settings));\n return (print_settings.params.dpi && print_settings.params.document_cookie);\n }\n", + "target": "bool PrintWebViewHelper::GetPrintSettingsFromUser(WebKit::WebFrame* frame,\n const WebKit::WebNode& node,\n int expected_pages_count,\n bool use_browser_overlays) {\n PrintHostMsg_ScriptedPrint_Params params;\n PrintMsg_PrintPages_Params print_settings;\n\n params.host_window_id = render_view()->GetHostWindow();\n params.cookie = print_pages_params_->params.document_cookie;\n params.has_selection = frame->hasSelection();\n params.expected_pages_count = expected_pages_count;\n printing::MarginType margin_type = printing::DEFAULT_MARGINS;\n if (PrintingNodeOrPdfFrame(frame, node))\n margin_type = GetMarginsForPdf(frame, node);\n params.margin_type = margin_type;\n \n Send(new PrintHostMsg_DidShowPrintDialog(routing_id()));\n \n // PrintHostMsg_ScriptedPrint will reset print_scaling_option, so we save the\n // value before and restore it afterwards.\n bool fit_to_paper_size = print_pages_params_->params.fit_to_paper_size;\n\n print_pages_params_.reset();\n IPC::SyncMessage* msg =\n new PrintHostMsg_ScriptedPrint(routing_id(), params, &print_settings);\n msg->EnableMessagePumping();\n Send(msg);\n print_pages_params_.reset(new PrintMsg_PrintPages_Params(print_settings));\n\n print_pages_params_->params.fit_to_paper_size = fit_to_paper_size;\n return (print_settings.params.dpi && print_settings.params.document_cookie);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ee8d6fd30b022ac2c87b7a190c954e7bb3c9b21e", + "input": "bool WebPluginDelegateProxy::BindFakePluginWindowHandle(bool opaque) {\n gfx::PluginWindowHandle fake_window = NULL;\n if (render_view_)\n fake_window = render_view_->AllocateFakePluginWindowHandle(opaque);\n if (!fake_window)\n return false;\n OnSetWindow(fake_window);\n if (!Send(new PluginMsg_SetFakeAcceleratedSurfaceWindowHandle(instance_id_,\n fake_window))) {\n return false;\n }\n\n webkit_glue::WebPluginGeometry geom;\n geom.window = fake_window;\n geom.window_rect = plugin_rect_;\n geom.clip_rect = gfx::Rect(0, 0, plugin_rect_.width(), plugin_rect_.height());\n geom.rects_valid = true;\n geom.visible = true;\n render_view_->DidMovePlugin(geom);\n render_view_->didInvalidateRect(WebKit::WebRect(plugin_rect_.x(),\n plugin_rect_.y(),\n plugin_rect_.width(),\n plugin_rect_.height()));\n\n return true;\n}\n", + "target": "bool WebPluginDelegateProxy::BindFakePluginWindowHandle(bool opaque) {\n gfx::PluginWindowHandle fake_window = NULL;\n if (render_view_)\n fake_window = render_view_->AllocateFakePluginWindowHandle(opaque);\n if (!fake_window)\n return false;\n OnSetWindow(fake_window);\n if (!Send(new PluginMsg_SetFakeAcceleratedSurfaceWindowHandle(instance_id_,\n fake_window))) {\n return false;\n }\n\n webkit_glue::WebPluginGeometry geom;\n geom.window = fake_window;\n geom.window_rect = plugin_rect_;\n geom.clip_rect = gfx::Rect(plugin_rect_.size());\n geom.rects_valid = true;\n geom.visible = true;\n render_view_->DidMovePlugin(geom);\n render_view_->didInvalidateRect(WebKit::WebRect(plugin_rect_.x(),\n plugin_rect_.y(),\n plugin_rect_.width(),\n plugin_rect_.height()));\n\n return true;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "void CuePoint::Load(IMkvReader* pReader)\n{\n \n if (m_timecode >= 0) //already loaded\n return;\n \n assert(m_track_positions == NULL);\n assert(m_track_positions_count == 0);\n \n long long pos_ = -m_timecode;\n const long long element_start = pos_;\n \n long long stop;\n \n {\n long len;\n \n const long long id = ReadUInt(pReader, pos_, len);\n assert(id == 0x3B); //CuePoint ID\n if (id != 0x3B)\n return;\n \n pos_ += len; //consume ID\n \n const long long size = ReadUInt(pReader, pos_, len);\n assert(size >= 0);\n \n pos_ += len; //consume Size field\n \n stop = pos_ + size;\n }\n \n const long long element_size = stop - element_start;\n \n long long pos = pos_;\n \n while (pos < stop)\n {\n long len;\n const long long id = ReadUInt(pReader, pos, len);\n assert(id >= 0); //TODO\n assert((pos + len) <= stop);\n pos += len; //consume ID\n const long long size = ReadUInt(pReader, pos, len);\n assert(size >= 0);\n assert((pos + len) <= stop);\n pos += len; //consume Size field\n assert((pos + size) <= stop);\n if (id == 0x33) //CueTime ID\n m_timecode = UnserializeUInt(pReader, pos, size);\n else if (id == 0x37) //CueTrackPosition(s) ID\n ++m_track_positions_count;\n pos += size; //consume payload\n assert(pos <= stop);\n }\n assert(m_timecode >= 0);\n assert(m_track_positions_count > 0);\n m_track_positions = new TrackPosition[m_track_positions_count];\n TrackPosition* p = m_track_positions;\n pos = pos_;\n while (pos < stop)\n {\n long len;\n const long long id = ReadUInt(pReader, pos, len);\n assert(id >= 0); //TODO\n assert((pos + len) <= stop);\n pos += len; //consume ID\n const long long size = ReadUInt(pReader, pos, len);\n assert(size >= 0);\n assert((pos + len) <= stop);\n pos += len; //consume Size field\n assert((pos + size) <= stop);\n if (id == 0x37) //CueTrackPosition(s) ID\n {\n TrackPosition& tp = *p++;\n tp.Parse(pReader, pos, size);\n }\n pos += size; //consume payload\n assert(pos <= stop);\n }\n assert(size_t(p - m_track_positions) == m_track_positions_count);\n m_element_start = element_start;\n m_element_size = element_size;\n }\n", + "target": "void CuePoint::Load(IMkvReader* pReader)\n assert(m_track_positions == NULL);\n assert(m_track_positions_count == 0);\n \n long long pos_ = -m_timecode;\n const long long element_start = pos_;\n \n long long stop;\n \n {\n long len;\n \n const long long id = ReadUInt(pReader, pos_, len);\n assert(id == 0x3B); // CuePoint ID\n if (id != 0x3B)\n return;\n \n pos_ += len; // consume ID\n \n const long long size = ReadUInt(pReader, pos_, len);\n assert(size >= 0);\n \n pos_ += len; // consume Size field\n // pos_ now points to start of payload\n \n stop = pos_ + size;\n }\n \n const long long element_size = stop - element_start;\n \n long long pos = pos_;\n\n // First count number of track positions\n\n while (pos < stop) {\n long len;\n\n const long long id = ReadUInt(pReader, pos, len);\n assert(id >= 0); // TODO\n assert((pos + len) <= stop);\n\n pos += len; // consume ID\n\n const long long size = ReadUInt(pReader, pos, len);\n assert(size >= 0);\n assert((pos + len) <= stop);\n\n pos += len; // consume Size field\n assert((pos + size) <= stop);\n\n if (id == 0x33) // CueTime ID\n m_timecode = UnserializeUInt(pReader, pos, size);\n\n else if (id == 0x37) // CueTrackPosition(s) ID\n ++m_track_positions_count;\n\n pos += size; // consume payload\n assert(pos <= stop);\n }\n\n assert(m_timecode >= 0);\n assert(m_track_positions_count > 0);\n\n // os << \"CuePoint::Load(cont'd): idpos=\" << idpos\n // << \" timecode=\" << m_timecode\n // << endl;\n\n m_track_positions = new TrackPosition[m_track_positions_count];\n\n // Now parse track positions\n\n TrackPosition* p = m_track_positions;\n pos = pos_;\n\n while (pos < stop) {\n long len;\n\n const long long id = ReadUInt(pReader, pos, len);\n assert(id >= 0); // TODO\n assert((pos + len) <= stop);\n\n pos += len; // consume ID\n\n const long long size = ReadUInt(pReader, pos, len);\n assert(size >= 0);\n assert((pos + len) <= stop);\n\n pos += len; // consume Size field\n assert((pos + size) <= stop);\n\n if (id == 0x37) { // CueTrackPosition(s) ID\n TrackPosition& tp = *p++;\n tp.Parse(pReader, pos, size);\n }\n \n pos += size; // consume payload\n assert(pos <= stop);\n }\n \n assert(size_t(p - m_track_positions) == m_track_positions_count);\n \n m_element_start = element_start;\n m_element_size = element_size;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e0a5a02b0fc1900a69d6c37ed0aab36fb8494e6d", + "input": "ikev1_t_print(netdissect_options *ndo, u_char tpay _U_,\n\t const struct isakmp_gen *ext, u_int item_len,\n\t const u_char *ep, uint32_t phase _U_, uint32_t doi _U_,\n\t uint32_t proto, int depth _U_)\n{\n\tconst struct ikev1_pl_t *p;\n\tstruct ikev1_pl_t t;\n\tconst u_char *cp;\n\tconst char *idstr;\n\tconst struct attrmap *map;\n\tsize_t nmap;\n\tconst u_char *ep2;\n\n\tND_PRINT((ndo,\"%s:\", NPSTR(ISAKMP_NPTYPE_T)));\n\n\tp = (const struct ikev1_pl_t *)ext;\n\tND_TCHECK(*p);\n\tUNALIGNED_MEMCPY(&t, ext, sizeof(t));\n\n\tswitch (proto) {\n\tcase 1:\n\t\tidstr = STR_OR_ID(t.t_id, ikev1_p_map);\n\t\tmap = oakley_t_map;\n\t\tnmap = sizeof(oakley_t_map)/sizeof(oakley_t_map[0]);\n\t\tbreak;\n\tcase 2:\n\t\tidstr = STR_OR_ID(t.t_id, ah_p_map);\n\t\tmap = ipsec_t_map;\n\t\tnmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]);\n\t\tbreak;\n\tcase 3:\n\t\tidstr = STR_OR_ID(t.t_id, esp_p_map);\n\t\tmap = ipsec_t_map;\n\t\tnmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]);\n\t\tbreak;\n\tcase 4:\n\t\tidstr = STR_OR_ID(t.t_id, ipcomp_p_map);\n\t\tmap = ipsec_t_map;\n\t\tnmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]);\n\t\tbreak;\n\tdefault:\n\t\tidstr = NULL;\n\t\tmap = NULL;\n\t\tnmap = 0;\n\t\tbreak;\n\t}\n\n\tif (idstr)\n\t\tND_PRINT((ndo,\" #%d id=%s \", t.t_no, idstr));\n\telse\n\t\tND_PRINT((ndo,\" #%d id=%d \", t.t_no, t.t_id));\n \tcp = (const u_char *)(p + 1);\n \tep2 = (const u_char *)p + item_len;\n \twhile (cp < ep && cp < ep2) {\n\t\tif (map && nmap) {\n\t\t\tcp = ikev1_attrmap_print(ndo, cp, (ep < ep2) ? ep : ep2,\n\t\t\t\tmap, nmap);\n\t\t} else\n\t\t\tcp = ikev1_attr_print(ndo, cp, (ep < ep2) ? ep : ep2);\n \t}\n \tif (ep < ep2)\n \t\tND_PRINT((ndo,\"...\"));\n\treturn cp;\ntrunc:\n\tND_PRINT((ndo,\" [|%s]\", NPSTR(ISAKMP_NPTYPE_T)));\n\treturn NULL;\n}\n", + "target": "ikev1_t_print(netdissect_options *ndo, u_char tpay _U_,\n\t const struct isakmp_gen *ext, u_int item_len,\n\t const u_char *ep, uint32_t phase _U_, uint32_t doi _U_,\n\t uint32_t proto, int depth _U_)\n{\n\tconst struct ikev1_pl_t *p;\n\tstruct ikev1_pl_t t;\n\tconst u_char *cp;\n\tconst char *idstr;\n\tconst struct attrmap *map;\n\tsize_t nmap;\n\tconst u_char *ep2;\n\n\tND_PRINT((ndo,\"%s:\", NPSTR(ISAKMP_NPTYPE_T)));\n\n\tp = (const struct ikev1_pl_t *)ext;\n\tND_TCHECK(*p);\n\tUNALIGNED_MEMCPY(&t, ext, sizeof(t));\n\n\tswitch (proto) {\n\tcase 1:\n\t\tidstr = STR_OR_ID(t.t_id, ikev1_p_map);\n\t\tmap = oakley_t_map;\n\t\tnmap = sizeof(oakley_t_map)/sizeof(oakley_t_map[0]);\n\t\tbreak;\n\tcase 2:\n\t\tidstr = STR_OR_ID(t.t_id, ah_p_map);\n\t\tmap = ipsec_t_map;\n\t\tnmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]);\n\t\tbreak;\n\tcase 3:\n\t\tidstr = STR_OR_ID(t.t_id, esp_p_map);\n\t\tmap = ipsec_t_map;\n\t\tnmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]);\n\t\tbreak;\n\tcase 4:\n\t\tidstr = STR_OR_ID(t.t_id, ipcomp_p_map);\n\t\tmap = ipsec_t_map;\n\t\tnmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]);\n\t\tbreak;\n\tdefault:\n\t\tidstr = NULL;\n\t\tmap = NULL;\n\t\tnmap = 0;\n\t\tbreak;\n\t}\n\n\tif (idstr)\n\t\tND_PRINT((ndo,\" #%d id=%s \", t.t_no, idstr));\n\telse\n\t\tND_PRINT((ndo,\" #%d id=%d \", t.t_no, t.t_id));\n \tcp = (const u_char *)(p + 1);\n \tep2 = (const u_char *)p + item_len;\n \twhile (cp < ep && cp < ep2) {\n\t\tif (map && nmap)\n\t\t\tcp = ikev1_attrmap_print(ndo, cp, ep2, map, nmap);\n\t\telse\n\t\t\tcp = ikev1_attr_print(ndo, cp, ep2);\n\t\tif (cp == NULL)\n\t\t\tgoto trunc;\n \t}\n \tif (ep < ep2)\n \t\tND_PRINT((ndo,\"...\"));\n\treturn cp;\ntrunc:\n\tND_PRINT((ndo,\" [|%s]\", NPSTR(ISAKMP_NPTYPE_T)));\n\treturn NULL;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long long AudioTrack::GetChannels() const\n{\n return m_channels;\n }\n", + "target": "long long AudioTrack::GetChannels() const\n Track** i = m_trackEntries;\n Track** const j = m_trackEntriesEnd;\n\n while (i != j) {\n Track* const pTrack = *i++;\n\n if (pTrack == NULL)\n continue;\n\n if (tn == pTrack->GetNumber())\n return pTrack;\n }\n\n return NULL; // not found\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c90c6ca59378d7e86d1a2f28fe96bada35df1508", + "input": " void FindBarController::MaybeSetPrepopulateText() {\n #if !defined(OS_MACOSX)\n FindManager* find_manager = tab_contents_->GetFindManager();\n string16 find_string = find_manager->find_text();\n if (find_string.empty())\n find_string = find_manager->previous_find_text();\n if (find_string.empty()) {\n find_string =\n FindBarState::GetLastPrepopulateText(tab_contents_->profile());\n }\n\n find_bar_->SetFindText(find_string);\n#else\n#endif\n}\n", + "target": " void FindBarController::MaybeSetPrepopulateText() {\n #if !defined(OS_MACOSX)\n FindTabHelper* find_tab_helper = tab_contents_->find_tab_helper();\n string16 find_string = find_tab_helper->find_text();\n if (find_string.empty())\n find_string = find_tab_helper->previous_find_text();\n if (find_string.empty()) {\n find_string =\n FindBarState::GetLastPrepopulateText(tab_contents_->profile());\n }\n\n find_bar_->SetFindText(find_string);\n#else\n#endif\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1b53cf9815bb4744958d41f3795d5d5a1d365e2d", + "input": "static void put_crypt_info(struct fscrypt_info *ci)\n{\n \tif (!ci)\n \t\treturn;\n \n\tkey_put(ci->ci_keyring_key);\n \tcrypto_free_skcipher(ci->ci_ctfm);\n \tkmem_cache_free(fscrypt_info_cachep, ci);\n }\n", + "target": "static void put_crypt_info(struct fscrypt_info *ci)\n{\n \tif (!ci)\n \t\treturn;\n \n \tcrypto_free_skcipher(ci->ci_ctfm);\n \tkmem_cache_free(fscrypt_info_cachep, ci);\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#116d0963cadfbf55ef2ec3d13781987c4d80517a", + "input": "void ChromeMockRenderThread::OnUpdatePrintSettings(\n int document_cookie,\n const base::DictionaryValue& job_settings,\n PrintMsg_PrintPages_Params* params) {\n std::string dummy_string;\n int margins_type = 0;\n if (!job_settings.GetBoolean(printing::kSettingLandscape, NULL) ||\n !job_settings.GetBoolean(printing::kSettingCollate, NULL) ||\n !job_settings.GetInteger(printing::kSettingColor, NULL) ||\n !job_settings.GetBoolean(printing::kSettingPrintToPDF, NULL) ||\n !job_settings.GetBoolean(printing::kIsFirstRequest, NULL) ||\n !job_settings.GetString(printing::kSettingDeviceName, &dummy_string) ||\n !job_settings.GetInteger(printing::kSettingDuplexMode, NULL) ||\n !job_settings.GetInteger(printing::kSettingCopies, NULL) ||\n !job_settings.GetString(printing::kPreviewUIAddr, &dummy_string) ||\n !job_settings.GetInteger(printing::kPreviewRequestID, NULL) ||\n !job_settings.GetInteger(printing::kSettingMarginsType, &margins_type)) {\n return;\n }\n \n if (printer_.get()) {\n const ListValue* page_range_array;\n printing::PageRanges new_ranges;\n if (job_settings.GetList(printing::kSettingPageRange, &page_range_array)) {\n for (size_t index = 0; index < page_range_array->GetSize(); ++index) {\n const base::DictionaryValue* dict;\n if (!page_range_array->GetDictionary(index, &dict))\n continue;\n printing::PageRange range;\n if (!dict->GetInteger(printing::kSettingPageRangeFrom, &range.from) ||\n !dict->GetInteger(printing::kSettingPageRangeTo, &range.to)) {\n continue;\n }\n range.from--;\n range.to--;\n new_ranges.push_back(range);\n }\n }\n std::vector pages(printing::PageRange::GetPages(new_ranges));\n printer_->UpdateSettings(document_cookie, params, pages, margins_type);\n }\n }\n", + "target": "void ChromeMockRenderThread::OnUpdatePrintSettings(\n int document_cookie,\n const base::DictionaryValue& job_settings,\n PrintMsg_PrintPages_Params* params) {\n std::string dummy_string;\n int margins_type = 0;\n if (!job_settings.GetBoolean(printing::kSettingLandscape, NULL) ||\n !job_settings.GetBoolean(printing::kSettingCollate, NULL) ||\n !job_settings.GetInteger(printing::kSettingColor, NULL) ||\n !job_settings.GetBoolean(printing::kSettingPrintToPDF, NULL) ||\n !job_settings.GetBoolean(printing::kIsFirstRequest, NULL) ||\n !job_settings.GetString(printing::kSettingDeviceName, &dummy_string) ||\n !job_settings.GetInteger(printing::kSettingDuplexMode, NULL) ||\n !job_settings.GetInteger(printing::kSettingCopies, NULL) ||\n !job_settings.GetInteger(printing::kPreviewUIID, NULL) ||\n !job_settings.GetInteger(printing::kPreviewRequestID, NULL) ||\n !job_settings.GetInteger(printing::kSettingMarginsType, &margins_type)) {\n return;\n }\n \n const ListValue* page_range_array;\n printing::PageRanges new_ranges;\n if (job_settings.GetList(printing::kSettingPageRange, &page_range_array)) {\n for (size_t index = 0; index < page_range_array->GetSize(); ++index) {\n const base::DictionaryValue* dict;\n if (!page_range_array->GetDictionary(index, &dict))\n continue;\n printing::PageRange range;\n if (!dict->GetInteger(printing::kSettingPageRangeFrom, &range.from) ||\n !dict->GetInteger(printing::kSettingPageRangeTo, &range.to)) {\n continue;\n }\n // Page numbers are 1-based in the dictionary.\n // Page numbers are 0-based for the printing context.\n range.from--;\n range.to--;\n new_ranges.push_back(range);\n }\n }\n std::vector pages(printing::PageRange::GetPages(new_ranges));\n printer_->UpdateSettings(document_cookie, params, pages, margins_type);\n}\n\nMockPrinter* ChromeMockRenderThread::printer() {\n return printer_.get();\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1e9b175204e3286d64dfd6c9f09151c31b5e099a", + "input": "PHP_METHOD(Phar, mount)\n{\n\tchar *fname, *arch = NULL, *entry = NULL, *path, *actual;\n\tint fname_len, arch_len, entry_len;\n size_t path_len, actual_len;\n phar_archive_data *pphar;\n \n if (zend_parse_parameters(ZEND_NUM_ARGS(), \"ss\", &path, &path_len, &actual, &actual_len) == FAILURE) {\n return;\n }\n \n\tfname = (char*)zend_get_executed_filename();\n\tfname_len = strlen(fname);\n\n#ifdef PHP_WIN32\n\tphar_unixify_path_separators(fname, fname_len);\n#endif\n\n\tif (fname_len > 7 && !memcmp(fname, \"phar://\", 7) && SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {\n\t\tefree(entry);\n\t\tentry = NULL;\n\n\t\tif (path_len > 7 && !memcmp(path, \"phar://\", 7)) {\n\t\t\tzend_throw_exception_ex(phar_ce_PharException, 0, \"Can only mount internal paths within a phar archive, use a relative path instead of \\\"%s\\\"\", path);\n\t\t\tefree(arch);\n\t\t\treturn;\n\t\t}\ncarry_on2:\n\t\tif (NULL == (pphar = zend_hash_str_find_ptr(&(PHAR_G(phar_fname_map)), arch, arch_len))) {\n\t\t\tif (PHAR_G(manifest_cached) && NULL != (pphar = zend_hash_str_find_ptr(&cached_phars, arch, arch_len))) {\n\t\t\t\tif (SUCCESS == phar_copy_on_write(&pphar)) {\n\t\t\t\t\tgoto carry_on;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tzend_throw_exception_ex(phar_ce_PharException, 0, \"%s is not a phar archive, cannot mount\", arch);\n\n\t\t\tif (arch) {\n\t\t\t\tefree(arch);\n\t\t\t}\n\t\t\treturn;\n\t\t}\ncarry_on:\n\t\tif (SUCCESS != phar_mount_entry(pphar, actual, actual_len, path, path_len)) {\n\t\t\tzend_throw_exception_ex(phar_ce_PharException, 0, \"Mounting of %s to %s within phar %s failed\", path, actual, arch);\n\t\t\tif (path && path == entry) {\n\t\t\t\tefree(entry);\n\t\t\t}\n\n\t\t\tif (arch) {\n\t\t\t\tefree(arch);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (entry && path && path == entry) {\n\t\t\tefree(entry);\n\t\t}\n\n\t\tif (arch) {\n\t\t\tefree(arch);\n\t\t}\n\n\t\treturn;\n\t} else if (PHAR_G(phar_fname_map.u.flags) && NULL != (pphar = zend_hash_str_find_ptr(&(PHAR_G(phar_fname_map)), fname, fname_len))) {\n\t\tgoto carry_on;\n\t} else if (PHAR_G(manifest_cached) && NULL != (pphar = zend_hash_str_find_ptr(&cached_phars, fname, fname_len))) {\n\t\tif (SUCCESS == phar_copy_on_write(&pphar)) {\n\t\t\tgoto carry_on;\n\t\t}\n\n\t\tgoto carry_on;\n\t} else if (SUCCESS == phar_split_fname(path, path_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {\n\t\tpath = entry;\n\t\tpath_len = entry_len;\n\t\tgoto carry_on2;\n\t}\n\n\tzend_throw_exception_ex(phar_ce_PharException, 0, \"Mounting of %s to %s failed\", path, actual);\n}\n", + "target": "PHP_METHOD(Phar, mount)\n{\n\tchar *fname, *arch = NULL, *entry = NULL, *path, *actual;\n\tint fname_len, arch_len, entry_len;\n size_t path_len, actual_len;\n phar_archive_data *pphar;\n \n if (zend_parse_parameters(ZEND_NUM_ARGS(), \"pp\", &path, &path_len, &actual, &actual_len) == FAILURE) {\n return;\n }\n \n\tfname = (char*)zend_get_executed_filename();\n\tfname_len = strlen(fname);\n\n#ifdef PHP_WIN32\n\tphar_unixify_path_separators(fname, fname_len);\n#endif\n\n\tif (fname_len > 7 && !memcmp(fname, \"phar://\", 7) && SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {\n\t\tefree(entry);\n\t\tentry = NULL;\n\n\t\tif (path_len > 7 && !memcmp(path, \"phar://\", 7)) {\n\t\t\tzend_throw_exception_ex(phar_ce_PharException, 0, \"Can only mount internal paths within a phar archive, use a relative path instead of \\\"%s\\\"\", path);\n\t\t\tefree(arch);\n\t\t\treturn;\n\t\t}\ncarry_on2:\n\t\tif (NULL == (pphar = zend_hash_str_find_ptr(&(PHAR_G(phar_fname_map)), arch, arch_len))) {\n\t\t\tif (PHAR_G(manifest_cached) && NULL != (pphar = zend_hash_str_find_ptr(&cached_phars, arch, arch_len))) {\n\t\t\t\tif (SUCCESS == phar_copy_on_write(&pphar)) {\n\t\t\t\t\tgoto carry_on;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tzend_throw_exception_ex(phar_ce_PharException, 0, \"%s is not a phar archive, cannot mount\", arch);\n\n\t\t\tif (arch) {\n\t\t\t\tefree(arch);\n\t\t\t}\n\t\t\treturn;\n\t\t}\ncarry_on:\n\t\tif (SUCCESS != phar_mount_entry(pphar, actual, actual_len, path, path_len)) {\n\t\t\tzend_throw_exception_ex(phar_ce_PharException, 0, \"Mounting of %s to %s within phar %s failed\", path, actual, arch);\n\t\t\tif (path && path == entry) {\n\t\t\t\tefree(entry);\n\t\t\t}\n\n\t\t\tif (arch) {\n\t\t\t\tefree(arch);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (entry && path && path == entry) {\n\t\t\tefree(entry);\n\t\t}\n\n\t\tif (arch) {\n\t\t\tefree(arch);\n\t\t}\n\n\t\treturn;\n\t} else if (PHAR_G(phar_fname_map.u.flags) && NULL != (pphar = zend_hash_str_find_ptr(&(PHAR_G(phar_fname_map)), fname, fname_len))) {\n\t\tgoto carry_on;\n\t} else if (PHAR_G(manifest_cached) && NULL != (pphar = zend_hash_str_find_ptr(&cached_phars, fname, fname_len))) {\n\t\tif (SUCCESS == phar_copy_on_write(&pphar)) {\n\t\t\tgoto carry_on;\n\t\t}\n\n\t\tgoto carry_on;\n\t} else if (SUCCESS == phar_split_fname(path, path_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {\n\t\tpath = entry;\n\t\tpath_len = entry_len;\n\t\tgoto carry_on2;\n\t}\n\n\tzend_throw_exception_ex(phar_ce_PharException, 0, \"Mounting of %s to %s failed\", path, actual);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a9cbaa7a40e2b2723cfc2f266c42f4980038a949", + "input": "UrlData::UrlData(const GURL& url, CORSMode cors_mode, UrlIndex* url_index)\n : url_(url),\n have_data_origin_(false),\n cors_mode_(cors_mode),\n url_index_(url_index),\n length_(kPositionNotSpecified),\n range_supported_(false),\n cacheable_(false),\n has_opaque_data_(false),\n last_used_(),\n multibuffer_(this, url_index_->block_shift_) {}\n", + "target": "UrlData::UrlData(const GURL& url, CORSMode cors_mode, UrlIndex* url_index)\n : url_(url),\n have_data_origin_(false),\n cors_mode_(cors_mode),\n url_index_(url_index),\n length_(kPositionNotSpecified),\n range_supported_(false),\n cacheable_(false),\n last_used_(),\n multibuffer_(this, url_index_->block_shift_) {}\n", + "vul_type": "cwe-732", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7a1aac3343af85b4af4df5f8844946eaa27394ab?w=1", + "input": "static inline int _setEdgePixel(const gdImagePtr src, unsigned int x, unsigned int y, gdFixed coverage, const int bgColor) \n {\n \tconst gdFixed f_127 = gd_itofx(127);\n \tregister int c = src->tpixels[y][x];\n\tc = c | (( (int) (gd_fxtof(gd_mulfx(coverage, f_127)) + 50.5f)) << 24);\n\treturn _color_blend(bgColor, c);\n}\n", + "target": "static inline int _setEdgePixel(const gdImagePtr src, unsigned int x, unsigned int y, gdFixed coverage, const int bgColor) \nstatic inline int _setEdgePixel(const gdImagePtr src, unsigned int x, unsigned int y, gdFixed coverage, const int bgColor)\n {\n \tconst gdFixed f_127 = gd_itofx(127);\n \tregister int c = src->tpixels[y][x];\n\tc = c | (( (int) (gd_fxtof(gd_mulfx(coverage, f_127)) + 50.5f)) << 24);\n\treturn _color_blend(bgColor, c);\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d", + "input": "ContentEncoding::GetCompressionByIndex(unsigned long idx) const {\n const ptrdiff_t count = compression_entries_end_ - compression_entries_;\n assert(count >= 0);\n \n if (idx >= static_cast(count))\n return NULL;\n\n return compression_entries_[idx];\n}\n", + "target": "ContentEncoding::GetCompressionByIndex(unsigned long idx) const {\n ContentEncoding::GetCompressionByIndex(unsigned long idx) const {\n const ptrdiff_t count = compression_entries_end_ - compression_entries_;\n assert(count >= 0);\n \n if (idx >= static_cast(count))\n return NULL;\n\n return compression_entries_[idx];\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#181c7400b2bf50ba02ac77149749fb419b4d4797", + "input": "error::Error GLES2DecoderImpl::HandleGetUniformiv(uint32 immediate_data_size,\n const void* cmd_data) {\n const gles2::cmds::GetUniformiv& c =\n *static_cast(cmd_data);\n GLuint program = c.program;\n GLint fake_location = c.location;\n GLuint service_id;\n GLenum result_type;\n GLint real_location = -1;\n Error error;\n void* result;\n if (GetUniformSetup(\n program, fake_location, c.params_shm_id, c.params_shm_offset,\n &error, &real_location, &service_id, &result, &result_type)) {\n glGetUniformiv(\n service_id, real_location,\n static_cast(result)->GetData());\n }\n return error;\n}\n", + "target": "error::Error GLES2DecoderImpl::HandleGetUniformiv(uint32 immediate_data_size,\n const void* cmd_data) {\n const gles2::cmds::GetUniformiv& c =\n *static_cast(cmd_data);\n GLuint program = c.program;\n GLint fake_location = c.location;\n GLuint service_id;\n GLenum result_type;\n GLsizei result_size;\n GLint real_location = -1;\n Error error;\n void* result;\n if (GetUniformSetup(program, fake_location, c.params_shm_id,\n c.params_shm_offset, &error, &real_location, &service_id,\n &result, &result_type, &result_size)) {\n glGetUniformiv(\n service_id, real_location,\n static_cast(result)->GetData());\n }\n return error;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d52fc5dde171f030170a6cb78034d166b13c9445", + "input": "int cap_bprm_set_creds(struct linux_binprm *bprm)\n{\n\tconst struct cred *old = current_cred();\n\tstruct cred *new = bprm->cred;\n\tbool effective, has_cap = false;\n\tint ret;\n\n\teffective = false;\n\tret = get_file_caps(bprm, &effective, &has_cap);\n\tif (ret < 0)\n\t\treturn ret;\n\n\tif (!issecure(SECURE_NOROOT)) {\n\t\t/*\n\t\t * If the legacy file capability is set, then don't set privs\n\t\t * for a setuid root binary run by a non-root user. Do set it\n\t\t * for a root user just to cause least surprise to an admin.\n\t\t */\n\t\tif (has_cap && new->uid != 0 && new->euid == 0) {\n\t\t\twarn_setuid_and_fcaps_mixed(bprm->filename);\n\t\t\tgoto skip;\n\t\t}\n\t\t/*\n\t\t * To support inheritance of root-permissions and suid-root\n\t\t * executables under compatibility mode, we override the\n\t\t * capability sets for the file.\n\t\t *\n\t\t * If only the real uid is 0, we do not set the effective bit.\n\t\t */\n\t\tif (new->euid == 0 || new->uid == 0) {\n\t\t\t/* pP' = (cap_bset & ~0) | (pI & ~0) */\n\t\t\tnew->cap_permitted = cap_combine(old->cap_bset,\n\t\t\t\t\t\t\t old->cap_inheritable);\n\t\t}\n\t\tif (new->euid == 0)\n\t\t\teffective = true;\n \t}\n skip:\n \n \t/* Don't let someone trace a set[ug]id/setpcap binary with the revised\n \t * credentials unless they have the appropriate permit\n \t */\n\tif ((new->euid != old->uid ||\n\t new->egid != old->gid ||\n\t !cap_issubset(new->cap_permitted, old->cap_permitted)) &&\n\t bprm->unsafe & ~LSM_UNSAFE_PTRACE_CAP) {\n\t\t/* downgrade; they get no more than they had, and maybe less */\n\t\tif (!capable(CAP_SETUID)) {\n\t\t\tnew->euid = new->uid;\n\t\t\tnew->egid = new->gid;\n\t\t}\n\t\tnew->cap_permitted = cap_intersect(new->cap_permitted,\n\t\t\t\t\t\t old->cap_permitted);\n\t}\n\n\tnew->suid = new->fsuid = new->euid;\n\tnew->sgid = new->fsgid = new->egid;\n\n\tif (effective)\n\t\tnew->cap_effective = new->cap_permitted;\n\telse\n\t\tcap_clear(new->cap_effective);\n\tbprm->cap_effective = effective;\n\n\t/*\n\t * Audit candidate if current->cap_effective is set\n\t *\n\t * We do not bother to audit if 3 things are true:\n\t * 1) cap_effective has all caps\n\t * 2) we are root\n\t * 3) root is supposed to have all caps (SECURE_NOROOT)\n\t * Since this is just a normal root execing a process.\n\t *\n\t * Number 1 above might fail if you don't have a full bset, but I think\n\t * that is interesting information to audit.\n\t */\n\tif (!cap_isclear(new->cap_effective)) {\n\t\tif (!cap_issubset(CAP_FULL_SET, new->cap_effective) ||\n\t\t new->euid != 0 || new->uid != 0 ||\n\t\t issecure(SECURE_NOROOT)) {\n\t\t\tret = audit_log_bprm_fcaps(bprm, new, old);\n\t\t\tif (ret < 0)\n\t\t\t\treturn ret;\n\t\t}\n\t}\n\n\tnew->securebits &= ~issecure_mask(SECURE_KEEP_CAPS);\n\treturn 0;\n}\n", + "target": "int cap_bprm_set_creds(struct linux_binprm *bprm)\n{\n\tconst struct cred *old = current_cred();\n\tstruct cred *new = bprm->cred;\n\tbool effective, has_cap = false;\n\tint ret;\n\n\teffective = false;\n\tret = get_file_caps(bprm, &effective, &has_cap);\n\tif (ret < 0)\n\t\treturn ret;\n\n\tif (!issecure(SECURE_NOROOT)) {\n\t\t/*\n\t\t * If the legacy file capability is set, then don't set privs\n\t\t * for a setuid root binary run by a non-root user. Do set it\n\t\t * for a root user just to cause least surprise to an admin.\n\t\t */\n\t\tif (has_cap && new->uid != 0 && new->euid == 0) {\n\t\t\twarn_setuid_and_fcaps_mixed(bprm->filename);\n\t\t\tgoto skip;\n\t\t}\n\t\t/*\n\t\t * To support inheritance of root-permissions and suid-root\n\t\t * executables under compatibility mode, we override the\n\t\t * capability sets for the file.\n\t\t *\n\t\t * If only the real uid is 0, we do not set the effective bit.\n\t\t */\n\t\tif (new->euid == 0 || new->uid == 0) {\n\t\t\t/* pP' = (cap_bset & ~0) | (pI & ~0) */\n\t\t\tnew->cap_permitted = cap_combine(old->cap_bset,\n\t\t\t\t\t\t\t old->cap_inheritable);\n\t\t}\n\t\tif (new->euid == 0)\n\t\t\teffective = true;\n \t}\n skip:\n \n\t/* if we have fs caps, clear dangerous personality flags */\n\tif (!cap_issubset(new->cap_permitted, old->cap_permitted))\n\t\tbprm->per_clear |= PER_CLEAR_ON_SETID;\n\n\n \t/* Don't let someone trace a set[ug]id/setpcap binary with the revised\n \t * credentials unless they have the appropriate permit\n \t */\n\tif ((new->euid != old->uid ||\n\t new->egid != old->gid ||\n\t !cap_issubset(new->cap_permitted, old->cap_permitted)) &&\n\t bprm->unsafe & ~LSM_UNSAFE_PTRACE_CAP) {\n\t\t/* downgrade; they get no more than they had, and maybe less */\n\t\tif (!capable(CAP_SETUID)) {\n\t\t\tnew->euid = new->uid;\n\t\t\tnew->egid = new->gid;\n\t\t}\n\t\tnew->cap_permitted = cap_intersect(new->cap_permitted,\n\t\t\t\t\t\t old->cap_permitted);\n\t}\n\n\tnew->suid = new->fsuid = new->euid;\n\tnew->sgid = new->fsgid = new->egid;\n\n\tif (effective)\n\t\tnew->cap_effective = new->cap_permitted;\n\telse\n\t\tcap_clear(new->cap_effective);\n\tbprm->cap_effective = effective;\n\n\t/*\n\t * Audit candidate if current->cap_effective is set\n\t *\n\t * We do not bother to audit if 3 things are true:\n\t * 1) cap_effective has all caps\n\t * 2) we are root\n\t * 3) root is supposed to have all caps (SECURE_NOROOT)\n\t * Since this is just a normal root execing a process.\n\t *\n\t * Number 1 above might fail if you don't have a full bset, but I think\n\t * that is interesting information to audit.\n\t */\n\tif (!cap_isclear(new->cap_effective)) {\n\t\tif (!cap_issubset(CAP_FULL_SET, new->cap_effective) ||\n\t\t new->euid != 0 || new->uid != 0 ||\n\t\t issecure(SECURE_NOROOT)) {\n\t\t\tret = audit_log_bprm_fcaps(bprm, new, old);\n\t\t\tif (ret < 0)\n\t\t\t\treturn ret;\n\t\t}\n\t}\n\n\tnew->securebits &= ~issecure_mask(SECURE_KEEP_CAPS);\n\treturn 0;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c70422f760c120480fee4de6c38804c72aa26bc1", + "input": " int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp)\n {\n\tif (d_mountpoint(dentry))\n \t\treturn 1;\n \tif (nfsd4_is_junction(dentry))\n \t\treturn 1;\n\tif (!(exp->ex_flags & NFSEXP_V4ROOT))\n\t\treturn 0;\n\treturn d_inode(dentry) != NULL;\n }\n", + "target": " int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp)\n {\n\tif (!d_inode(dentry))\n\t\treturn 0;\n\tif (exp->ex_flags & NFSEXP_V4ROOT)\n \t\treturn 1;\n \tif (nfsd4_is_junction(dentry))\n \t\treturn 1;\n\tif (d_mountpoint(dentry))\n\t\t/*\n\t\t * Might only be a mountpoint in a different namespace,\n\t\t * but we need to check.\n\t\t */\n\t\treturn 2;\n\treturn 0;\n }\n", + "vul_type": "cwe-404", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long mkvparser::UnserializeString(\n IMkvReader* pReader,\n long long pos,\n long long size_,\n char*& str)\n{\n delete[] str;\n str = NULL;\n \n if (size_ >= LONG_MAX) //we need (size+1) chars\n return E_FILE_FORMAT_INVALID;\n \n const long size = static_cast(size_);\n \n str = new (std::nothrow) char[size+1];\n if (str == NULL)\n return -1;\n unsigned char* const buf = reinterpret_cast(str);\n const long status = pReader->Read(pos, size, buf);\n if (status)\n {\n delete[] str;\n str = NULL;\n return status;\n }\n str[size] = '\\0';\n return 0; //success\n }\n", + "target": "long mkvparser::UnserializeString(\n if (status) {\n delete[] str;\n str = NULL;\n \n return status;\n }\n \n str[size] = '\\0';\n \n return 0; // success\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9cfe470d793da6e09b966d435c8fa2ba1625d5fe", + "input": "void VirtualAuthenticator::AddRegistration(\n blink::test::mojom::RegisteredKeyPtr registration,\n AddRegistrationCallback callback) {\n if (registration->application_parameter.size() != device::kRpIdHashLength) {\n std::move(callback).Run(false);\n return;\n }\n\n bool success = false;\n std::tie(std::ignore, success) = state_->registrations.emplace(\n std::move(registration->key_handle),\n ::device::VirtualFidoDevice::RegistrationData(\n crypto::ECPrivateKey::CreateFromPrivateKeyInfo(\n registration->private_key),\n registration->application_parameter, registration->counter));\n std::move(callback).Run(success);\n }\n", + "target": "void VirtualAuthenticator::AddRegistration(\n blink::test::mojom::RegisteredKeyPtr registration,\n AddRegistrationCallback callback) {\n if (registration->application_parameter.size() != device::kRpIdHashLength) {\n std::move(callback).Run(false);\n return;\n }\n\n bool success = false;\n std::tie(std::ignore, success) = state_->registrations.emplace(\n std::move(registration->key_handle),\n ::device::VirtualFidoDevice::RegistrationData(\n crypto::ECPrivateKey::CreateFromPrivateKeyInfo(\n registration->private_key),\n base::make_span(\n registration->application_parameter),\n registration->counter));\n std::move(callback).Run(success);\n }\n", + "vul_type": "cwe-22", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c0569cc04741cccf6548c2169fcc1609d958523f", + "input": " WebstoreBindings::WebstoreBindings(ScriptContext* context)\n : ObjectBackedNativeHandler(context) {\n RouteFunction(\"Install\",\n base::Bind(&WebstoreBindings::Install, base::Unretained(this)));\n }\n", + "target": " WebstoreBindings::WebstoreBindings(ScriptContext* context)\n : ObjectBackedNativeHandler(context) {\n RouteFunction(\"Install\", \"webstore\",\n base::Bind(&WebstoreBindings::Install, base::Unretained(this)));\n }\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6e94e0cfb0887e4013b3b930fa6ab1fe6bb6ba91", + "input": "check_entry_size_and_hooks(struct ip6t_entry *e,\n\t\t\t struct xt_table_info *newinfo,\n\t\t\t const unsigned char *base,\n\t\t\t const unsigned char *limit,\n\t\t\t const unsigned int *hook_entries,\n\t\t\t const unsigned int *underflows,\n\t\t\t unsigned int valid_hooks)\n{\n\tunsigned int h;\n \tint err;\n \n \tif ((unsigned long)e % __alignof__(struct ip6t_entry) != 0 ||\n\t (unsigned char *)e + sizeof(struct ip6t_entry) >= limit) {\n \t\tduprintf(\"Bad offset %p\\n\", e);\n \t\treturn -EINVAL;\n \t}\n\n\tif (e->next_offset\n\t < sizeof(struct ip6t_entry) + sizeof(struct xt_entry_target)) {\n\t\tduprintf(\"checking: element %p size %u\\n\",\n\t\t\t e, e->next_offset);\n\t\treturn -EINVAL;\n\t}\n\n\terr = check_entry(e);\n\tif (err)\n\t\treturn err;\n\n\t/* Check hooks & underflows */\n\tfor (h = 0; h < NF_INET_NUMHOOKS; h++) {\n\t\tif (!(valid_hooks & (1 << h)))\n\t\t\tcontinue;\n\t\tif ((unsigned char *)e - base == hook_entries[h])\n\t\t\tnewinfo->hook_entry[h] = hook_entries[h];\n\t\tif ((unsigned char *)e - base == underflows[h]) {\n\t\t\tif (!check_underflow(e)) {\n\t\t\t\tpr_err(\"Underflows must be unconditional and \"\n\t\t\t\t \"use the STANDARD target with \"\n\t\t\t\t \"ACCEPT/DROP\\n\");\n\t\t\t\treturn -EINVAL;\n\t\t\t}\n\t\t\tnewinfo->underflow[h] = underflows[h];\n\t\t}\n\t}\n\n\t/* Clear counters and comefrom */\n\te->counters = ((struct xt_counters) { 0, 0 });\n\te->comefrom = 0;\n\treturn 0;\n}\n", + "target": "check_entry_size_and_hooks(struct ip6t_entry *e,\n\t\t\t struct xt_table_info *newinfo,\n\t\t\t const unsigned char *base,\n\t\t\t const unsigned char *limit,\n\t\t\t const unsigned int *hook_entries,\n\t\t\t const unsigned int *underflows,\n\t\t\t unsigned int valid_hooks)\n{\n\tunsigned int h;\n \tint err;\n \n \tif ((unsigned long)e % __alignof__(struct ip6t_entry) != 0 ||\n\t (unsigned char *)e + sizeof(struct ip6t_entry) >= limit ||\n\t (unsigned char *)e + e->next_offset > limit) {\n \t\tduprintf(\"Bad offset %p\\n\", e);\n \t\treturn -EINVAL;\n \t}\n\n\tif (e->next_offset\n\t < sizeof(struct ip6t_entry) + sizeof(struct xt_entry_target)) {\n\t\tduprintf(\"checking: element %p size %u\\n\",\n\t\t\t e, e->next_offset);\n\t\treturn -EINVAL;\n\t}\n\n\terr = check_entry(e);\n\tif (err)\n\t\treturn err;\n\n\t/* Check hooks & underflows */\n\tfor (h = 0; h < NF_INET_NUMHOOKS; h++) {\n\t\tif (!(valid_hooks & (1 << h)))\n\t\t\tcontinue;\n\t\tif ((unsigned char *)e - base == hook_entries[h])\n\t\t\tnewinfo->hook_entry[h] = hook_entries[h];\n\t\tif ((unsigned char *)e - base == underflows[h]) {\n\t\t\tif (!check_underflow(e)) {\n\t\t\t\tpr_err(\"Underflows must be unconditional and \"\n\t\t\t\t \"use the STANDARD target with \"\n\t\t\t\t \"ACCEPT/DROP\\n\");\n\t\t\t\treturn -EINVAL;\n\t\t\t}\n\t\t\tnewinfo->underflow[h] = underflows[h];\n\t\t}\n\t}\n\n\t/* Clear counters and comefrom */\n\te->counters = ((struct xt_counters) { 0, 0 });\n\te->comefrom = 0;\n\treturn 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e9372a1bfd3588a80fcf49aa07321f0971dd6091", + "input": "v8::Handle V8AudioContext::constructorCallback(const v8::Arguments& args)\n{\n INC_STATS(\"DOM.AudioContext.Contructor\");\n\n if (!args.IsConstructCall())\n return V8Proxy::throwTypeError(\"AudioContext constructor cannot be called as a function.\");\n\n if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)\n return args.Holder();\n\n Frame* frame = V8Proxy::retrieveFrameForCurrentContext();\n if (!frame)\n return V8Proxy::throwError(V8Proxy::ReferenceError, \"AudioContext constructor associated frame is unavailable\", args.GetIsolate());\n\n Document* document = frame->document();\n if (!document)\n return V8Proxy::throwError(V8Proxy::ReferenceError, \"AudioContext constructor associated document is unavailable\", args.GetIsolate());\n\n RefPtr audioContext;\n \n if (!args.Length()) {\n ExceptionCode ec = 0;\n audioContext = AudioContext::create(document, ec);\n if (ec)\n return throwError(ec, args.GetIsolate());\n if (!audioContext.get())\n return V8Proxy::throwError(V8Proxy::SyntaxError, \"audio resources unavailable for AudioContext construction\", args.GetIsolate());\n } else {\n if (args.Length() < 3)\n return V8Proxy::throwNotEnoughArgumentsError();\n \n bool ok = false;\n \n int32_t numberOfChannels = toInt32(args[0], ok);\n if (!ok || numberOfChannels <= 0 || numberOfChannels > 10)\n return V8Proxy::throwError(V8Proxy::SyntaxError, \"Invalid number of channels\", args.GetIsolate());\n\n int32_t numberOfFrames = toInt32(args[1], ok);\n if (!ok || numberOfFrames <= 0)\n return V8Proxy::throwError(V8Proxy::SyntaxError, \"Invalid number of frames\", args.GetIsolate());\n\n float sampleRate = toFloat(args[2]);\n if (sampleRate <= 0)\n return V8Proxy::throwError(V8Proxy::SyntaxError, \"Invalid sample rate\", args.GetIsolate());\n\n ExceptionCode ec = 0;\n audioContext = AudioContext::createOfflineContext(document, numberOfChannels, numberOfFrames, sampleRate, ec);\n if (ec)\n return throwError(ec, args.GetIsolate());\n }\n\n if (!audioContext.get())\n return V8Proxy::throwError(V8Proxy::SyntaxError, \"Error creating AudioContext\", args.GetIsolate());\n \n V8DOMWrapper::setDOMWrapper(args.Holder(), &info, audioContext.get());\n audioContext->ref();\n \n return args.Holder();\n}\n", + "target": "v8::Handle V8AudioContext::constructorCallback(const v8::Arguments& args)\n{\n INC_STATS(\"DOM.AudioContext.Contructor\");\n\n if (!args.IsConstructCall())\n return V8Proxy::throwTypeError(\"AudioContext constructor cannot be called as a function.\");\n\n if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)\n return args.Holder();\n\n Frame* frame = V8Proxy::retrieveFrameForCurrentContext();\n if (!frame)\n return V8Proxy::throwError(V8Proxy::ReferenceError, \"AudioContext constructor associated frame is unavailable\", args.GetIsolate());\n\n Document* document = frame->document();\n if (!document)\n return V8Proxy::throwError(V8Proxy::ReferenceError, \"AudioContext constructor associated document is unavailable\", args.GetIsolate());\n\n RefPtr audioContext;\n \n if (!args.Length()) {\n ExceptionCode ec = 0;\n audioContext = AudioContext::create(document, ec);\n if (ec)\n return throwError(ec, args.GetIsolate());\n if (!audioContext.get())\n return V8Proxy::throwError(V8Proxy::SyntaxError, \"audio resources unavailable for AudioContext construction\", args.GetIsolate());\n } else {\n if (args.Length() < 3)\n return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());\n \n bool ok = false;\n \n int32_t numberOfChannels = toInt32(args[0], ok);\n if (!ok || numberOfChannels <= 0 || numberOfChannels > 10)\n return V8Proxy::throwError(V8Proxy::SyntaxError, \"Invalid number of channels\", args.GetIsolate());\n\n int32_t numberOfFrames = toInt32(args[1], ok);\n if (!ok || numberOfFrames <= 0)\n return V8Proxy::throwError(V8Proxy::SyntaxError, \"Invalid number of frames\", args.GetIsolate());\n\n float sampleRate = toFloat(args[2]);\n if (sampleRate <= 0)\n return V8Proxy::throwError(V8Proxy::SyntaxError, \"Invalid sample rate\", args.GetIsolate());\n\n ExceptionCode ec = 0;\n audioContext = AudioContext::createOfflineContext(document, numberOfChannels, numberOfFrames, sampleRate, ec);\n if (ec)\n return throwError(ec, args.GetIsolate());\n }\n\n if (!audioContext.get())\n return V8Proxy::throwError(V8Proxy::SyntaxError, \"Error creating AudioContext\", args.GetIsolate());\n \n V8DOMWrapper::setDOMWrapper(args.Holder(), &info, audioContext.get());\n audioContext->ref();\n \n return args.Holder();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ed4c8d79153baab7f26562afb8930652dfbf853b", + "input": " static uint32_t readU16(const uint8_t* data, size_t offset) {\n return data[offset] << 8 | data[offset + 1];\n }\n", + "target": " static uint32_t readU16(const uint8_t* data, size_t offset) {\n return ((uint32_t)data[offset]) << 8 | ((uint32_t)data[offset + 1]);\n }\n", + "vul_type": "cwe-19", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "image_transform_png_set_expand_16_mod(PNG_CONST image_transform *this,\n image_pixel *that, png_const_structp pp,\n PNG_CONST transform_display *display)\n {\n /* Expect expand_16 to expand everything to 16 bits as a result of also\n * causing 'expand' to happen.\n */\n if (that->colour_type == PNG_COLOR_TYPE_PALETTE)\n\n image_pixel_convert_PLTE(that);\n \n if (that->have_tRNS)\n image_pixel_add_alpha(that, &display->this);\n \n if (that->bit_depth < 16)\n that->sample_depth = that->bit_depth = 16;\n\n this->next->mod(this->next, that, pp, display);\n}\n", + "target": "image_transform_png_set_expand_16_mod(PNG_CONST image_transform *this,\nimage_transform_png_set_expand_16_mod(const image_transform *this,\n image_pixel *that, png_const_structp pp,\n const transform_display *display)\n {\n /* Expect expand_16 to expand everything to 16 bits as a result of also\n * causing 'expand' to happen.\n */\n if (that->colour_type == PNG_COLOR_TYPE_PALETTE)\n\n image_pixel_convert_PLTE(that);\n \n if (that->have_tRNS)\n image_pixel_add_alpha(that, &display->this, 0/*!for background*/);\n \n if (that->bit_depth < 16)\n that->sample_depth = that->bit_depth = 16;\n\n this->next->mod(this->next, that, pp, display);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0837e3242c73566fc1c0196b4ec61779c25ffc93", + "input": "static void perf_event_interrupt(struct pt_regs *regs)\n{\n\tint i;\n\tstruct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);\n\tstruct perf_event *event;\n\tunsigned long val;\n\tint found = 0;\n\tint nmi;\n\n\tif (cpuhw->n_limited)\n\t\tfreeze_limited_counters(cpuhw, mfspr(SPRN_PMC5),\n\t\t\t\t\tmfspr(SPRN_PMC6));\n\n\tperf_read_regs(regs);\n\n\tnmi = perf_intr_is_nmi(regs);\n\tif (nmi)\n\t\tnmi_enter();\n\telse\n\t\tirq_enter();\n\n\tfor (i = 0; i < cpuhw->n_events; ++i) {\n\t\tevent = cpuhw->event[i];\n\t\tif (!event->hw.idx || is_limited_pmc(event->hw.idx))\n\t\t\tcontinue;\n\t\tval = read_pmc(event->hw.idx);\n\t\tif ((int)val < 0) {\n\t\t\t/* event has overflowed */\n\t\t\tfound = 1;\n\t\t\trecord_and_restart(event, val, regs, nmi);\n\t\t}\n\t}\n\n\t/*\n\t * In case we didn't find and reset the event that caused\n\t * the interrupt, scan all events and reset any that are\n\t * negative, to avoid getting continual interrupts.\n\t * Any that we processed in the previous loop will not be negative.\n\t */\n\tif (!found) {\n\t\tfor (i = 0; i < ppmu->n_counter; ++i) {\n \t\t\tif (is_limited_pmc(i + 1))\n \t\t\t\tcontinue;\n \t\t\tval = read_pmc(i + 1);\n\t\t\tif ((int)val < 0)\n \t\t\t\twrite_pmc(i + 1, 0);\n \t\t}\n \t}\n\n\t/*\n\t * Reset MMCR0 to its normal value. This will set PMXE and\n\t * clear FC (freeze counters) and PMAO (perf mon alert occurred)\n\t * and thus allow interrupts to occur again.\n\t * XXX might want to use MSR.PM to keep the events frozen until\n\t * we get back out of this interrupt.\n\t */\n\twrite_mmcr0(cpuhw, cpuhw->mmcr[0]);\n\n\tif (nmi)\n\t\tnmi_exit();\n\telse\n\t\tirq_exit();\n}\n", + "target": "static void perf_event_interrupt(struct pt_regs *regs)\n{\n\tint i;\n\tstruct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);\n\tstruct perf_event *event;\n\tunsigned long val;\n\tint found = 0;\n\tint nmi;\n\n\tif (cpuhw->n_limited)\n\t\tfreeze_limited_counters(cpuhw, mfspr(SPRN_PMC5),\n\t\t\t\t\tmfspr(SPRN_PMC6));\n\n\tperf_read_regs(regs);\n\n\tnmi = perf_intr_is_nmi(regs);\n\tif (nmi)\n\t\tnmi_enter();\n\telse\n\t\tirq_enter();\n\n\tfor (i = 0; i < cpuhw->n_events; ++i) {\n\t\tevent = cpuhw->event[i];\n\t\tif (!event->hw.idx || is_limited_pmc(event->hw.idx))\n\t\t\tcontinue;\n\t\tval = read_pmc(event->hw.idx);\n\t\tif ((int)val < 0) {\n\t\t\t/* event has overflowed */\n\t\t\tfound = 1;\n\t\t\trecord_and_restart(event, val, regs, nmi);\n\t\t}\n\t}\n\n\t/*\n\t * In case we didn't find and reset the event that caused\n\t * the interrupt, scan all events and reset any that are\n\t * negative, to avoid getting continual interrupts.\n\t * Any that we processed in the previous loop will not be negative.\n\t */\n\tif (!found) {\n\t\tfor (i = 0; i < ppmu->n_counter; ++i) {\n \t\t\tif (is_limited_pmc(i + 1))\n \t\t\t\tcontinue;\n \t\t\tval = read_pmc(i + 1);\n\t\t\tif (pmc_overflow(val))\n \t\t\t\twrite_pmc(i + 1, 0);\n \t\t}\n \t}\n\n\t/*\n\t * Reset MMCR0 to its normal value. This will set PMXE and\n\t * clear FC (freeze counters) and PMAO (perf mon alert occurred)\n\t * and thus allow interrupts to occur again.\n\t * XXX might want to use MSR.PM to keep the events frozen until\n\t * we get back out of this interrupt.\n\t */\n\twrite_mmcr0(cpuhw, cpuhw->mmcr[0]);\n\n\tif (nmi)\n\t\tnmi_exit();\n\telse\n\t\tirq_exit();\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#45d901b56f578a74b19ba0d10fa5c4c467f19303", + "input": " void TabGroupHeader::OnPaint(gfx::Canvas* canvas) {\n constexpr SkColor kPlaceholderColor = SkColorSetRGB(0xAA, 0xBB, 0xCC);\n gfx::Rect fill_bounds(GetLocalBounds());\n fill_bounds.Inset(TabStyle::GetTabOverlap(), 0);\n canvas->FillRect(fill_bounds, kPlaceholderColor);\n }\n", + "target": " void TabGroupHeader::OnPaint(gfx::Canvas* canvas) {\n gfx::Rect fill_bounds(GetLocalBounds());\n fill_bounds.Inset(TabStyle::GetTabOverlap(), 0);\n const SkColor color = GetGroupData()->color();\n canvas->FillRect(fill_bounds, color);\n title_label_->SetBackgroundColor(color);\n}\n\nconst TabGroupData* TabGroupHeader::GetGroupData() {\n return controller_->GetDataForGroup(group_);\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#3-8035e4e0e399", + "input": " def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_NO_HOST_RET), ''])\n\n create_host_cmd = ('createhost -iscsi -add fakehost '\n 'iqn.1993-08.org.debian:01:222')\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)", + "target": " def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_NO_HOST_RET), ''])\n\n create_host_cmd = ['createhost', '-iscsi', '-add', 'fakehost',\n 'iqn.1993-08.org.debian:01:222']\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#564f7cc2a51dcd2f28ab12a13394f31be5aa3c93", + "input": "cib_connect(gboolean full)\n{\n int rc = pcmk_ok;\n static gboolean need_pass = TRUE;\n\n CRM_CHECK(cib != NULL, return -EINVAL);\n\n if (getenv(\"CIB_passwd\") != NULL) {\n need_pass = FALSE;\n }\n\n if(watch_fencing && st == NULL) {\n st = stonith_api_new();\n }\n \n if(watch_fencing && st->state == stonith_disconnected) {\n crm_trace(\"Connecting to stonith\");\n rc = st->cmds->connect(st, crm_system_name, NULL);\n if(rc == pcmk_ok) {\n crm_trace(\"Setting up stonith callbacks\");\n st->cmds->register_notification(st, T_STONITH_NOTIFY_FENCE, mon_st_callback);\n }\n }\n \n if (cib->state != cib_connected_query && cib->state != cib_connected_command) {\n crm_trace(\"Connecting to the CIB\");\n if (as_console && need_pass && cib->variant == cib_remote) {\n need_pass = FALSE;\n print_as(\"Password:\");\n }\n\n rc = cib->cmds->signon(cib, crm_system_name, cib_query);\n\n if (rc != pcmk_ok) {\n return rc;\n }\n\n current_cib = get_cib_copy(cib);\n mon_refresh_display(NULL);\n\n if (full) {\n if (rc == pcmk_ok) {\n rc = cib->cmds->set_connection_dnotify(cib, mon_cib_connection_destroy);\n if (rc == -EPROTONOSUPPORT) {\n print_as(\"Notification setup failed, won't be able to reconnect after failure\");\n if (as_console) {\n sleep(2);\n }\n rc = pcmk_ok;\n }\n\n }\n\n if (rc == pcmk_ok) {\n cib->cmds->del_notify_callback(cib, T_CIB_DIFF_NOTIFY, crm_diff_update);\n rc = cib->cmds->add_notify_callback(cib, T_CIB_DIFF_NOTIFY, crm_diff_update);\n }\n\n if (rc != pcmk_ok) {\n print_as(\"Notification setup failed, could not monitor CIB actions\");\n if (as_console) {\n sleep(2);\n }\n clean_up(-rc);\n }\n }\n }\n return rc;\n}\n", + "target": "cib_connect(gboolean full)\n{\n int rc = pcmk_ok;\n static gboolean need_pass = TRUE;\n\n CRM_CHECK(cib != NULL, return -EINVAL);\n\n if (getenv(\"CIB_passwd\") != NULL) {\n need_pass = FALSE;\n }\n\n if(watch_fencing && st == NULL) {\n st = stonith_api_new();\n }\n \n if(watch_fencing && st->state == stonith_disconnected) {\n crm_trace(\"Connecting to stonith\");\n rc = st->cmds->connect(st, crm_system_name, NULL);\n if(rc == pcmk_ok) {\n crm_trace(\"Setting up stonith callbacks\");\n st->cmds->register_notification(st, T_STONITH_NOTIFY_FENCE, mon_st_callback);\n }\n }\n \n if (cib->state != cib_connected_query && cib->state != cib_connected_command) {\n crm_trace(\"Connecting to the CIB\");\n if (as_console && need_pass && cib->variant == cib_remote) {\n need_pass = FALSE;\n print_as(\"Password:\");\n }\n\n rc = cib->cmds->signon(cib, crm_system_name, cib_query);\n\n if (rc != pcmk_ok) {\n return rc;\n }\n\n current_cib = get_cib_copy(cib);\n mon_refresh_display(NULL);\n\n if (full) {\n if (rc == pcmk_ok) {\n rc = cib->cmds->set_connection_dnotify(cib, mon_cib_connection_destroy);\n if (rc == -EPROTONOSUPPORT) {\n print_as(\"Notification setup not supported, won't be able to reconnect after failure\");\n if (as_console) {\n sleep(2);\n }\n rc = pcmk_ok;\n }\n\n }\n\n if (rc == pcmk_ok) {\n cib->cmds->del_notify_callback(cib, T_CIB_DIFF_NOTIFY, crm_diff_update);\n rc = cib->cmds->add_notify_callback(cib, T_CIB_DIFF_NOTIFY, crm_diff_update);\n }\n\n if (rc != pcmk_ok) {\n print_as(\"Notification setup failed, could not monitor CIB actions\");\n if (as_console) {\n sleep(2);\n }\n clean_up(-rc);\n }\n }\n }\n return rc;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9c78a04df4e44ef6487eee99c4258397f4fdca55", + "input": "METHODDEF(JDIMENSION)\nget_word_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)\n/* This version is for reading raw-word-format PPM files with any maxval */\n{\n ppm_source_ptr source = (ppm_source_ptr)sinfo;\n register JSAMPROW ptr;\n register U_CHAR *bufferptr;\n register JSAMPLE *rescale = source->rescale;\n JDIMENSION col;\n unsigned int maxval = source->maxval;\n\n if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))\n ERREXIT(cinfo, JERR_INPUT_EOF);\n ptr = source->pub.buffer[0];\n bufferptr = source->iobuffer;\n for (col = cinfo->image_width; col > 0; col--) {\n register unsigned int temp;\n temp = UCH(*bufferptr++) << 8;\n temp |= UCH(*bufferptr++);\n if (temp > maxval)\n ERREXIT(cinfo, JERR_PPM_TOOLARGE);\n *ptr++ = rescale[temp];\n temp = UCH(*bufferptr++) << 8;\n temp |= UCH(*bufferptr++);\n if (temp > maxval)\n ERREXIT(cinfo, JERR_PPM_TOOLARGE);\n *ptr++ = rescale[temp];\n temp = UCH(*bufferptr++) << 8;\n temp |= UCH(*bufferptr++);\n if (temp > maxval)\n ERREXIT(cinfo, JERR_PPM_TOOLARGE);\n *ptr++ = rescale[temp];\n }\n return 1;\n}\n", + "target": "METHODDEF(JDIMENSION)\nget_word_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)\n/* This version is for reading raw-word-format PPM files with any maxval */\n{\n ppm_source_ptr source = (ppm_source_ptr)sinfo;\n register JSAMPROW ptr;\n register U_CHAR *bufferptr;\n register JSAMPLE *rescale = source->rescale;\n JDIMENSION col;\n unsigned int maxval = source->maxval;\n\n if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))\n ERREXIT(cinfo, JERR_INPUT_EOF);\n ptr = source->pub.buffer[0];\n bufferptr = source->iobuffer;\n for (col = cinfo->image_width; col > 0; col--) {\n register unsigned int temp;\n temp = UCH(*bufferptr++) << 8;\n temp |= UCH(*bufferptr++);\n if (temp > maxval)\n ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);\n *ptr++ = rescale[temp];\n temp = UCH(*bufferptr++) << 8;\n temp |= UCH(*bufferptr++);\n if (temp > maxval)\n ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);\n *ptr++ = rescale[temp];\n temp = UCH(*bufferptr++) << 8;\n temp |= UCH(*bufferptr++);\n if (temp > maxval)\n ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);\n *ptr++ = rescale[temp];\n }\n return 1;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#360e95d45ac4123255a4c796db96337f332160ad#diff-d643a0fa169471dbf2912f4866dc49c5", + "input": "static int read_public_key(RSA *rsa)\n{\n\tint r;\n\tsc_path_t path;\n\tsc_file_t *file;\n\tu8 buf[2048], *p = buf;\n\tsize_t bufsize, keysize;\n\n\tr = select_app_df();\n\tif (r)\n\t\treturn 1;\n\tsc_format_path(\"I1012\", &path);\n\tr = sc_select_file(card, &path, &file);\n\tif (r) {\n \t\tfprintf(stderr, \"Unable to select public key file: %s\\n\", sc_strerror(r));\n \t\treturn 2;\n \t}\n\tbufsize = file->size;\n \tsc_file_free(file);\n \tr = sc_read_binary(card, 0, buf, bufsize, 0);\n \tif (r < 0) {\n\t\tfprintf(stderr, \"Unable to read public key file: %s\\n\", sc_strerror(r));\n\t\treturn 2;\n\t}\n\tbufsize = r;\n\tdo {\n\t\tif (bufsize < 4)\n\t\t\treturn 3;\n\t\tkeysize = (p[0] << 8) | p[1];\n\t\tif (keysize == 0)\n\t\t\tbreak;\n\t\tif (keysize < 3)\n\t\t\treturn 3;\n\t\tif (p[2] == opt_key_num)\n\t\t\tbreak;\n\t\tp += keysize;\n\t\tbufsize -= keysize;\n\t} while (1);\n\tif (keysize == 0) {\n\t\tprintf(\"Key number %d not found.\\n\", opt_key_num);\n\t\treturn 2;\n\t}\n\treturn parse_public_key(p, keysize, rsa);\n}\n", + "target": "static int read_public_key(RSA *rsa)\n{\n\tint r;\n\tsc_path_t path;\n\tsc_file_t *file;\n\tu8 buf[2048], *p = buf;\n\tsize_t bufsize, keysize;\n\n\tr = select_app_df();\n\tif (r)\n\t\treturn 1;\n\tsc_format_path(\"I1012\", &path);\n\tr = sc_select_file(card, &path, &file);\n\tif (r) {\n \t\tfprintf(stderr, \"Unable to select public key file: %s\\n\", sc_strerror(r));\n \t\treturn 2;\n \t}\n\tbufsize = MIN(file->size, sizeof buf);\n \tsc_file_free(file);\n \tr = sc_read_binary(card, 0, buf, bufsize, 0);\n \tif (r < 0) {\n\t\tfprintf(stderr, \"Unable to read public key file: %s\\n\", sc_strerror(r));\n\t\treturn 2;\n\t}\n\tbufsize = r;\n\tdo {\n\t\tif (bufsize < 4)\n\t\t\treturn 3;\n\t\tkeysize = (p[0] << 8) | p[1];\n\t\tif (keysize == 0)\n\t\t\tbreak;\n\t\tif (keysize < 3)\n\t\t\treturn 3;\n\t\tif (p[2] == opt_key_num)\n\t\t\tbreak;\n\t\tp += keysize;\n\t\tbufsize -= keysize;\n\t} while (1);\n\tif (keysize == 0) {\n\t\tprintf(\"Key number %d not found.\\n\", opt_key_num);\n\t\treturn 2;\n\t}\n\treturn parse_public_key(p, keysize, rsa);\n}\n", + "vul_type": "cwe-415", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04f2d32871bb3b11d7dc024039952f2fe2750306", + "input": " pidfile_write(const char *pid_file, int pid)\n {\n \tFILE *pidfile = NULL;\n\tint pidfd = creat(pid_file, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);\n \n \tif (pidfd != -1) pidfile = fdopen(pidfd, \"w\");\n \n\tif (!pidfile) {\n\t\tlog_message(LOG_INFO, \"pidfile_write : Cannot open %s pidfile\",\n\t\t pid_file);\n\t\treturn 0;\n\t}\n\tfprintf(pidfile, \"%d\\n\", pid);\n\tfclose(pidfile);\n\treturn 1;\n}\n", + "target": " pidfile_write(const char *pid_file, int pid)\n {\n \tFILE *pidfile = NULL;\n\tint pidfd = open(pid_file, O_NOFOLLOW | O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);\n \n \tif (pidfd != -1) pidfile = fdopen(pidfd, \"w\");\n \n\tif (!pidfile) {\n\t\tlog_message(LOG_INFO, \"pidfile_write : Cannot open %s pidfile\",\n\t\t pid_file);\n\t\treturn 0;\n\t}\n\tfprintf(pidfile, \"%d\\n\", pid);\n\tfclose(pidfile);\n\treturn 1;\n}\n", + "vul_type": "cwe-59", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1", + "input": "SPL_METHOD(SplFileInfo, setInfoClass)\n{\n \tspl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);\n \tzend_class_entry *ce = spl_ce_SplFileInfo;\n \tzend_error_handling error_handling;\n \tzend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC);\n \n \tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"|C\", &ce) == SUCCESS) {\n\t\tintern->info_class = ce;\n\t}\n\n\tzend_restore_error_handling(&error_handling TSRMLS_CC);\n}\n", + "target": "SPL_METHOD(SplFileInfo, setInfoClass)\n{\n \tspl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);\n \tzend_class_entry *ce = spl_ce_SplFileInfo;\n \tzend_error_handling error_handling;\n\n \tzend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC);\n \n \tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"|C\", &ce) == SUCCESS) {\n\t\tintern->info_class = ce;\n\t}\n\n\tzend_restore_error_handling(&error_handling TSRMLS_CC);\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " void VarianceTest::OneQuarterTest() {\n memset(src_, 255, block_size_);\n const int half = block_size_ / 2;\n memset(ref_, 255, half);\n memset(ref_ + half, 0, half);\n unsigned int sse;\n unsigned int var;\n REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse));\n const unsigned int expected = block_size_ * 255 * 255 / 4;\n EXPECT_EQ(expected, var);\n }\n", + "target": " void VarianceTest::OneQuarterTest() {\n const int half = block_size_ / 2;\n if (!use_high_bit_depth_) {\n memset(src_, 255, block_size_);\n memset(ref_, 255, half);\n memset(ref_ + half, 0, half);\n#if CONFIG_VP9_HIGHBITDEPTH\n } else {\n vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << (bit_depth_ - 8),\n block_size_);\n vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 255 << (bit_depth_ - 8), half);\n vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, 0, half);\n#endif // CONFIG_VP9_HIGHBITDEPTH\n }\n unsigned int sse;\n unsigned int var;\n ASM_REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse));\n const unsigned int expected = block_size_ * 255 * 255 / 4;\n EXPECT_EQ(expected, var);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b3ae5db129f88dae153880e84bdabea8ce2ca89b", + "input": "void CrosLibrary::TestApi::SetNetworkLibrary(\n NetworkLibrary* library, bool own) {\n library_->network_lib_.SetImpl(library, own);\n}\n", + "target": "void CrosLibrary::TestApi::SetNetworkLibrary(\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04ff52bb66284467ccb43d90800013b89ee8db75", + "input": "void AudioOutputAuthorizationHandler::GetDeviceParameters(\n AuthorizationCompletedCallback cb,\n const std::string& raw_device_id) const {\n DCHECK_CURRENTLY_ON(BrowserThread::IO);\n DCHECK(!raw_device_id.empty());\n base::PostTaskAndReplyWithResult(\n audio_manager_->GetTaskRunner(), FROM_HERE,\n base::Bind(&GetDeviceParametersOnDeviceThread,\n base::Unretained(audio_manager_), raw_device_id),\n base::Bind(&AudioOutputAuthorizationHandler::DeviceParametersReceived,\n weak_factory_.GetWeakPtr(), std::move(cb), false,\n raw_device_id));\n}\n", + "target": "void AudioOutputAuthorizationHandler::GetDeviceParameters(\n AuthorizationCompletedCallback cb,\n const std::string& raw_device_id) const {\n DCHECK_CURRENTLY_ON(BrowserThread::IO);\n DCHECK(!raw_device_id.empty());\n audio_system_->GetOutputStreamParameters(\n raw_device_id,\n base::Bind(&AudioOutputAuthorizationHandler::DeviceParametersReceived,\n weak_factory_.GetWeakPtr(), std::move(cb), false,\n raw_device_id));\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "void Chapters::Display::Clear()\n{\n delete[] m_string;\n m_string = NULL;\n delete[] m_language;\n m_language = NULL;\n delete[] m_country;\n m_country = NULL;\n}\n", + "target": "void Chapters::Display::Clear()\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2b0bbc4f8809c972bad134bc1a2570dbb01dea0b", + "input": "static int nbd_negotiate_write(QIOChannel *ioc, const void *buffer, size_t size)\n{\n ssize_t ret;\n guint watch;\n assert(qemu_in_coroutine());\n /* Negotiation are always in main loop. */\n watch = qio_channel_add_watch(ioc,\n G_IO_OUT,\n nbd_negotiate_continue,\n qemu_coroutine_self(),\n NULL);\n ret = nbd_write(ioc, buffer, size, NULL);\n g_source_remove(watch);\n return ret;\n}\n", + "target": "static int nbd_negotiate_write(QIOChannel *ioc, const void *buffer, size_t size)\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3c8e4852477d5b1e2da877808c998dc57db9460f", + "input": " StorageHandler::StorageHandler()\n : DevToolsDomainHandler(Storage::Metainfo::domainName),\n process_(nullptr),\n weak_ptr_factory_(this) {}\n", + "target": " StorageHandler::StorageHandler()\n : DevToolsDomainHandler(Storage::Metainfo::domainName),\n storage_partition_(nullptr),\n weak_ptr_factory_(this) {}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c70422f760c120480fee4de6c38804c72aa26bc1", + "input": "nlmsvc_grant_reply(struct nlm_cookie *cookie, __be32 status)\n{\n\tstruct nlm_block\t*block;\n\n\tdprintk(\"grant_reply: looking for cookie %x, s=%d \\n\",\n\t\t*(unsigned int *)(cookie->data), status);\n \tif (!(block = nlmsvc_find_block(cookie)))\n \t\treturn;\n \n\tif (block) {\n\t\tif (status == nlm_lck_denied_grace_period) {\n\t\t\t/* Try again in a couple of seconds */\n\t\t\tnlmsvc_insert_block(block, 10 * HZ);\n\t\t} else {\n\t\t\t/* Lock is now held by client, or has been rejected.\n\t\t\t * In both cases, the block should be removed. */\n\t\t\tnlmsvc_unlink_block(block);\n\t\t}\n \t}\n \tnlmsvc_release_block(block);\n }\n", + "target": "nlmsvc_grant_reply(struct nlm_cookie *cookie, __be32 status)\n{\n\tstruct nlm_block\t*block;\n\n\tdprintk(\"grant_reply: looking for cookie %x, s=%d \\n\",\n\t\t*(unsigned int *)(cookie->data), status);\n \tif (!(block = nlmsvc_find_block(cookie)))\n \t\treturn;\n \n\tif (status == nlm_lck_denied_grace_period) {\n\t\t/* Try again in a couple of seconds */\n\t\tnlmsvc_insert_block(block, 10 * HZ);\n\t} else {\n\t\t/*\n\t\t * Lock is now held by client, or has been rejected.\n\t\t * In both cases, the block should be removed.\n\t\t */\n\t\tnlmsvc_unlink_block(block);\n \t}\n \tnlmsvc_release_block(block);\n }\n", + "vul_type": "cwe-404", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8f80c2d83808150724d31793e6ade92749b1faa4", + "input": "void *hashtable_iter_at(hashtable_t *hashtable, const char *key)\n{\n pair_t *pair;\n size_t hash;\n bucket_t *bucket;\n \n hash = hash_str(key);\n bucket = &hashtable->buckets[hash % num_buckets(hashtable)];\n \n pair = hashtable_find_pair(hashtable, bucket, key, hash);\n if(!pair)\n return NULL;\n\n return &pair->list;\n}\n", + "target": "void *hashtable_iter_at(hashtable_t *hashtable, const char *key)\n{\n pair_t *pair;\n size_t hash;\n bucket_t *bucket;\n \n hash = hash_str(key);\n bucket = &hashtable->buckets[hash & hashmask(hashtable->order)];\n \n pair = hashtable_find_pair(hashtable, bucket, key, hash);\n if(!pair)\n return NULL;\n\n return &pair->list;\n}\n", + "vul_type": "cwe-310", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#472271b153c5dc53c28beac55480a8d8434b2d5c", + "input": "bool semaphore_try_wait(semaphore_t *semaphore) {\n\n assert(semaphore != NULL);\n assert(semaphore->fd != INVALID_FD);\n \n int flags = fcntl(semaphore->fd, F_GETFL);\n if (flags == -1) {\n LOG_ERROR(\"%s unable to get flags for semaphore fd: %s\", __func__, strerror(errno));\n return false;\n }\n if (fcntl(semaphore->fd, F_SETFL, flags | O_NONBLOCK) == -1) {\n LOG_ERROR(\"%s unable to set O_NONBLOCK for semaphore fd: %s\", __func__, strerror(errno));\n return false;\n }\n\n eventfd_t value;\n\n if (eventfd_read(semaphore->fd, &value) == -1)\n return false;\n \n if (fcntl(semaphore->fd, F_SETFL, flags) == -1)\n LOG_ERROR(\"%s unable to resetore flags for semaphore fd: %s\", __func__, strerror(errno));\n return true;\n }\n", + "target": "bool semaphore_try_wait(semaphore_t *semaphore) {\n\n assert(semaphore != NULL);\n assert(semaphore->fd != INVALID_FD);\n \n int flags = TEMP_FAILURE_RETRY(fcntl(semaphore->fd, F_GETFL));\n if (flags == -1) {\n LOG_ERROR(\"%s unable to get flags for semaphore fd: %s\", __func__, strerror(errno));\n return false;\n }\n if (TEMP_FAILURE_RETRY(fcntl(semaphore->fd, F_SETFL, flags | O_NONBLOCK)) == -1) {\n LOG_ERROR(\"%s unable to set O_NONBLOCK for semaphore fd: %s\", __func__, strerror(errno));\n return false;\n }\n\n eventfd_t value;\n\n if (eventfd_read(semaphore->fd, &value) == -1)\n return false;\n \n if (TEMP_FAILURE_RETRY(fcntl(semaphore->fd, F_SETFL, flags)) == -1)\n LOG_ERROR(\"%s unable to resetore flags for semaphore fd: %s\", __func__, strerror(errno));\n return true;\n }\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "int Chapters::Atom::GetDisplayCount() const\n{\n return m_displays_count;\n}\n", + "target": "int Chapters::Atom::GetDisplayCount() const\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e3a5d056633677959ad924a51758876d415e7046", + "input": "void comps_objmrtree_unite(COMPS_ObjMRTree *rt1, COMPS_ObjMRTree *rt2) {\n COMPS_HSList *tmplist, *tmp_subnodes;\n COMPS_HSListItem *it;\n COMPS_ObjListIt *it2;\n struct Pair {\n COMPS_HSList * subnodes;\n char * key;\n char added;\n } *pair, *parent_pair;\n \n pair = malloc(sizeof(struct Pair));\n pair->subnodes = rt2->subnodes;\n pair->key = NULL;\n\n tmplist = comps_hslist_create();\n comps_hslist_init(tmplist, NULL, NULL, &free);\n comps_hslist_append(tmplist, pair, 0);\n\n while (tmplist->first != NULL) {\n it = tmplist->first;\n comps_hslist_remove(tmplist, tmplist->first);\n tmp_subnodes = ((struct Pair*)it->data)->subnodes;\n parent_pair = (struct Pair*) it->data;\n free(it);\n \n pair->added = 0;\n for (it = tmp_subnodes->first; it != NULL; it=it->next) {\n pair = malloc(sizeof(struct Pair));\n pair->subnodes = ((COMPS_ObjMRTreeData*)it->data)->subnodes;\n\n if (parent_pair->key != NULL) {\n pair->key =\n malloc(sizeof(char)\n * (strlen(((COMPS_ObjMRTreeData*)it->data)->key)\n + strlen(parent_pair->key) + 1));\n memcpy(pair->key, parent_pair->key,\n sizeof(char) * strlen(parent_pair->key));\n memcpy(pair->key+strlen(parent_pair->key),\n ((COMPS_ObjMRTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_ObjMRTreeData*)it->data)->key)+1));\n } else {\n pair->key = malloc(sizeof(char)*\n (strlen(((COMPS_ObjMRTreeData*)it->data)->key) +\n 1));\n memcpy(pair->key, ((COMPS_ObjMRTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_ObjMRTreeData*)it->data)->key)+1));\n }\n /* current node has data */\n if (((COMPS_ObjMRTreeData*)it->data)->data->first != NULL) {\n for (it2 = ((COMPS_ObjMRTreeData*)it->data)->data->first;\n it2 != NULL; it2 = it2->next) {\n comps_objmrtree_set(rt1, pair->key, it2->comps_obj);\n }\n\n if (((COMPS_ObjMRTreeData*)it->data)->subnodes->first) {\n comps_hslist_append(tmplist, pair, 0);\n } else {\n free(pair->key);\n free(pair);\n }\n /* current node hasn't data */\n } else {\n if (((COMPS_ObjMRTreeData*)it->data)->subnodes->first) {\n comps_hslist_append(tmplist, pair, 0);\n } else {\n free(pair->key);\n free(pair);\n }\n }\n }\n free(parent_pair->key);\n free(parent_pair);\n }\n comps_hslist_destroy(&tmplist);\n}\n", + "target": "void comps_objmrtree_unite(COMPS_ObjMRTree *rt1, COMPS_ObjMRTree *rt2) {\n COMPS_HSList *tmplist, *tmp_subnodes;\n COMPS_HSListItem *it;\n COMPS_ObjListIt *it2;\n struct Pair {\n COMPS_HSList * subnodes;\n char * key;\n } *pair, *parent_pair;\n \n pair = malloc(sizeof(struct Pair));\n pair->subnodes = rt2->subnodes;\n pair->key = NULL;\n\n tmplist = comps_hslist_create();\n comps_hslist_init(tmplist, NULL, NULL, &free);\n comps_hslist_append(tmplist, pair, 0);\n\n while (tmplist->first != NULL) {\n it = tmplist->first;\n comps_hslist_remove(tmplist, tmplist->first);\n tmp_subnodes = ((struct Pair*)it->data)->subnodes;\n parent_pair = (struct Pair*) it->data;\n free(it);\n \n for (it = tmp_subnodes->first; it != NULL; it=it->next) {\n pair = malloc(sizeof(struct Pair));\n pair->subnodes = ((COMPS_ObjMRTreeData*)it->data)->subnodes;\n\n if (parent_pair->key != NULL) {\n pair->key =\n malloc(sizeof(char)\n * (strlen(((COMPS_ObjMRTreeData*)it->data)->key)\n + strlen(parent_pair->key) + 1));\n memcpy(pair->key, parent_pair->key,\n sizeof(char) * strlen(parent_pair->key));\n memcpy(pair->key+strlen(parent_pair->key),\n ((COMPS_ObjMRTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_ObjMRTreeData*)it->data)->key)+1));\n } else {\n pair->key = malloc(sizeof(char)*\n (strlen(((COMPS_ObjMRTreeData*)it->data)->key) +\n 1));\n memcpy(pair->key, ((COMPS_ObjMRTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_ObjMRTreeData*)it->data)->key)+1));\n }\n /* current node has data */\n if (((COMPS_ObjMRTreeData*)it->data)->data->first != NULL) {\n for (it2 = ((COMPS_ObjMRTreeData*)it->data)->data->first;\n it2 != NULL; it2 = it2->next) {\n comps_objmrtree_set(rt1, pair->key, it2->comps_obj);\n }\n\n if (((COMPS_ObjMRTreeData*)it->data)->subnodes->first) {\n comps_hslist_append(tmplist, pair, 0);\n } else {\n free(pair->key);\n free(pair);\n }\n /* current node hasn't data */\n } else {\n if (((COMPS_ObjMRTreeData*)it->data)->subnodes->first) {\n comps_hslist_append(tmplist, pair, 0);\n } else {\n free(pair->key);\n free(pair);\n }\n }\n }\n free(parent_pair->key);\n free(parent_pair);\n }\n comps_hslist_destroy(&tmplist);\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f8bd2258e2d520dff28c855658bd24bdafb5102d", + "input": "static int sgi_timer_set(struct k_itimer *timr, int flags,\n\tstruct itimerspec * new_setting,\n\tstruct itimerspec * old_setting)\n{\n\tunsigned long when, period, irqflags;\n\tint err = 0;\n\tcnodeid_t nodeid;\n\tstruct mmtimer *base;\n\tstruct rb_node *n;\n\n\tif (old_setting)\n \t\tsgi_timer_get(timr, old_setting);\n \n \tsgi_timer_del(timr);\n\twhen = timespec_to_ns(new_setting->it_value);\n\tperiod = timespec_to_ns(new_setting->it_interval);\n \n \tif (when == 0)\n \t\t/* Clear timer */\n\t\treturn 0;\n\n\tbase = kmalloc(sizeof(struct mmtimer), GFP_KERNEL);\n\tif (base == NULL)\n\t\treturn -ENOMEM;\n\n\tif (flags & TIMER_ABSTIME) {\n\t\tstruct timespec n;\n \t\tunsigned long now;\n \n \t\tgetnstimeofday(&n);\n\t\tnow = timespec_to_ns(n);\n \t\tif (when > now)\n \t\t\twhen -= now;\n \t\telse\n\t\t\t/* Fire the timer immediately */\n\t\t\twhen = 0;\n\t}\n\n\t/*\n\t * Convert to sgi clock period. Need to keep rtc_time() as near as possible\n\t * to getnstimeofday() in order to be as faithful as possible to the time\n\t * specified.\n\t */\n\twhen = (when + sgi_clock_period - 1) / sgi_clock_period + rtc_time();\n\tperiod = (period + sgi_clock_period - 1) / sgi_clock_period;\n\n\t/*\n\t * We are allocating a local SHub comparator. If we would be moved to another\n\t * cpu then another SHub may be local to us. Prohibit that by switching off\n\t * preemption.\n\t */\n\tpreempt_disable();\n\n\tnodeid = cpu_to_node(smp_processor_id());\n\n\t/* Lock the node timer structure */\n\tspin_lock_irqsave(&timers[nodeid].lock, irqflags);\n\n\tbase->timer = timr;\n\tbase->cpu = smp_processor_id();\n\n\ttimr->it.mmtimer.clock = TIMER_SET;\n\ttimr->it.mmtimer.node = nodeid;\n\ttimr->it.mmtimer.incr = period;\n\ttimr->it.mmtimer.expires = when;\n\n\tn = timers[nodeid].next;\n\n\t/* Add the new struct mmtimer to node's timer list */\n\tmmtimer_add_list(base);\n\n\tif (timers[nodeid].next == n) {\n\t\t/* No need to reprogram comparator for now */\n\t\tspin_unlock_irqrestore(&timers[nodeid].lock, irqflags);\n\t\tpreempt_enable();\n\t\treturn err;\n\t}\n\n\t/* We need to reprogram the comparator */\n\tif (n)\n\t\tmmtimer_disable_int(cnodeid_to_nasid(nodeid), COMPARATOR);\n\n\tmmtimer_set_next_timer(nodeid);\n\n\t/* Unlock the node timer structure */\n\tspin_unlock_irqrestore(&timers[nodeid].lock, irqflags);\n\n\tpreempt_enable();\n\n\treturn err;\n}\n", + "target": "static int sgi_timer_set(struct k_itimer *timr, int flags,\n\tstruct itimerspec * new_setting,\n\tstruct itimerspec * old_setting)\n{\n\tunsigned long when, period, irqflags;\n\tint err = 0;\n\tcnodeid_t nodeid;\n\tstruct mmtimer *base;\n\tstruct rb_node *n;\n\n\tif (old_setting)\n \t\tsgi_timer_get(timr, old_setting);\n \n \tsgi_timer_del(timr);\n\twhen = timespec_to_ns(&new_setting->it_value);\n\tperiod = timespec_to_ns(&new_setting->it_interval);\n \n \tif (when == 0)\n \t\t/* Clear timer */\n\t\treturn 0;\n\n\tbase = kmalloc(sizeof(struct mmtimer), GFP_KERNEL);\n\tif (base == NULL)\n\t\treturn -ENOMEM;\n\n\tif (flags & TIMER_ABSTIME) {\n\t\tstruct timespec n;\n \t\tunsigned long now;\n \n \t\tgetnstimeofday(&n);\n\t\tnow = timespec_to_ns(&n);\n \t\tif (when > now)\n \t\t\twhen -= now;\n \t\telse\n\t\t\t/* Fire the timer immediately */\n\t\t\twhen = 0;\n\t}\n\n\t/*\n\t * Convert to sgi clock period. Need to keep rtc_time() as near as possible\n\t * to getnstimeofday() in order to be as faithful as possible to the time\n\t * specified.\n\t */\n\twhen = (when + sgi_clock_period - 1) / sgi_clock_period + rtc_time();\n\tperiod = (period + sgi_clock_period - 1) / sgi_clock_period;\n\n\t/*\n\t * We are allocating a local SHub comparator. If we would be moved to another\n\t * cpu then another SHub may be local to us. Prohibit that by switching off\n\t * preemption.\n\t */\n\tpreempt_disable();\n\n\tnodeid = cpu_to_node(smp_processor_id());\n\n\t/* Lock the node timer structure */\n\tspin_lock_irqsave(&timers[nodeid].lock, irqflags);\n\n\tbase->timer = timr;\n\tbase->cpu = smp_processor_id();\n\n\ttimr->it.mmtimer.clock = TIMER_SET;\n\ttimr->it.mmtimer.node = nodeid;\n\ttimr->it.mmtimer.incr = period;\n\ttimr->it.mmtimer.expires = when;\n\n\tn = timers[nodeid].next;\n\n\t/* Add the new struct mmtimer to node's timer list */\n\tmmtimer_add_list(base);\n\n\tif (timers[nodeid].next == n) {\n\t\t/* No need to reprogram comparator for now */\n\t\tspin_unlock_irqrestore(&timers[nodeid].lock, irqflags);\n\t\tpreempt_enable();\n\t\treturn err;\n\t}\n\n\t/* We need to reprogram the comparator */\n\tif (n)\n\t\tmmtimer_disable_int(cnodeid_to_nasid(nodeid), COMPARATOR);\n\n\tmmtimer_set_next_timer(nodeid);\n\n\t/* Unlock the node timer structure */\n\tspin_unlock_irqrestore(&timers[nodeid].lock, irqflags);\n\n\tpreempt_enable();\n\n\treturn err;\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04aaacb936a08d70862d6d9d7e8354721ae46be8", + "input": " bool AppCache::AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry) {\n std::pair ret =\n entries_.insert(EntryMap::value_type(url, entry));\n \n if (!ret.second)\n ret.first->second.add_types(entry.types());\n else\n cache_size_ += entry.response_size(); // New entry. Add to cache size.\n return ret.second;\n }\n", + "target": " bool AppCache::AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry) {\n std::pair ret =\n entries_.insert(EntryMap::value_type(url, entry));\n \n if (!ret.second) {\n ret.first->second.add_types(entry.types());\n } else {\n cache_size_ += entry.response_size(); // New entry. Add to cache size.\n padding_size_ += entry.padding_size();\n }\n return ret.second;\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3ca657a8793dd011bf869695d72ad31c779c3cc1", + "input": "PredictorDecodeRow(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)\n{\n\tTIFFPredictorState *sp = PredictorState(tif);\n\n\tassert(sp != NULL);\n\tassert(sp->decoderow != NULL);\n \tassert(sp->decodepfunc != NULL); \n \n \tif ((*sp->decoderow)(tif, op0, occ0, s)) {\n\t\t(*sp->decodepfunc)(tif, op0, occ0);\n\t\treturn 1;\n \t} else\n \t\treturn 0;\n }\n", + "target": "PredictorDecodeRow(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)\n{\n\tTIFFPredictorState *sp = PredictorState(tif);\n\n\tassert(sp != NULL);\n\tassert(sp->decoderow != NULL);\n \tassert(sp->decodepfunc != NULL); \n \n \tif ((*sp->decoderow)(tif, op0, occ0, s)) {\n\t\treturn (*sp->decodepfunc)(tif, op0, occ0);\n \t} else\n \t\treturn 0;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#355b98553789b646ed97ad801a619ff898471b92", + "input": "static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)\n{\n\t/* Must be called with pernet_ops_rwsem held */\n\tconst struct pernet_operations *ops, *saved_ops;\n\tint error = 0;\n\tLIST_HEAD(net_exit_list);\n \n \trefcount_set(&net->count, 1);\n \trefcount_set(&net->passive, 1);\n \tnet->dev_base_seq = 1;\n \tnet->user_ns = user_ns;\n \tidr_init(&net->netns_ids);\n\tspin_lock_init(&net->nsid_lock);\n\tmutex_init(&net->ipv4.ra_mutex);\n\n\tlist_for_each_entry(ops, &pernet_list, list) {\n\t\terror = ops_init(ops, net);\n\t\tif (error < 0)\n\t\t\tgoto out_undo;\n\t}\n\tdown_write(&net_rwsem);\n\tlist_add_tail_rcu(&net->list, &net_namespace_list);\n\tup_write(&net_rwsem);\nout:\n\treturn error;\n\nout_undo:\n\t/* Walk through the list backwards calling the exit functions\n\t * for the pernet modules whose init functions did not fail.\n\t */\n\tlist_add(&net->exit_list, &net_exit_list);\n\tsaved_ops = ops;\n\tlist_for_each_entry_continue_reverse(ops, &pernet_list, list)\n\t\tops_exit_list(ops, &net_exit_list);\n\n\tops = saved_ops;\n\tlist_for_each_entry_continue_reverse(ops, &pernet_list, list)\n\t\tops_free_list(ops, &net_exit_list);\n\n\trcu_barrier();\n\tgoto out;\n}\n", + "target": "static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)\n{\n\t/* Must be called with pernet_ops_rwsem held */\n\tconst struct pernet_operations *ops, *saved_ops;\n\tint error = 0;\n\tLIST_HEAD(net_exit_list);\n \n \trefcount_set(&net->count, 1);\n \trefcount_set(&net->passive, 1);\n\tget_random_bytes(&net->hash_mix, sizeof(u32));\n \tnet->dev_base_seq = 1;\n \tnet->user_ns = user_ns;\n \tidr_init(&net->netns_ids);\n\tspin_lock_init(&net->nsid_lock);\n\tmutex_init(&net->ipv4.ra_mutex);\n\n\tlist_for_each_entry(ops, &pernet_list, list) {\n\t\terror = ops_init(ops, net);\n\t\tif (error < 0)\n\t\t\tgoto out_undo;\n\t}\n\tdown_write(&net_rwsem);\n\tlist_add_tail_rcu(&net->list, &net_namespace_list);\n\tup_write(&net_rwsem);\nout:\n\treturn error;\n\nout_undo:\n\t/* Walk through the list backwards calling the exit functions\n\t * for the pernet modules whose init functions did not fail.\n\t */\n\tlist_add(&net->exit_list, &net_exit_list);\n\tsaved_ops = ops;\n\tlist_for_each_entry_continue_reverse(ops, &pernet_list, list)\n\t\tops_exit_list(ops, &net_exit_list);\n\n\tops = saved_ops;\n\tlist_for_each_entry_continue_reverse(ops, &pernet_list, list)\n\t\tops_free_list(ops, &net_exit_list);\n\n\trcu_barrier();\n\tgoto out;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#363b02dab09b3226f3bd1420dad9c72b79a42a76", + "input": "static int __key_instantiate_and_link(struct key *key,\n\t\t\t\t struct key_preparsed_payload *prep,\n\t\t\t\t struct key *keyring,\n\t\t\t\t struct key *authkey,\n\t\t\t\t struct assoc_array_edit **_edit)\n{\n\tint ret, awaken;\n\n\tkey_check(key);\n\tkey_check(keyring);\n\n\tawaken = 0;\n\tret = -EBUSY;\n\n \tmutex_lock(&key_construction_mutex);\n \n \t/* can't instantiate twice */\n\tif (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {\n \t\t/* instantiate the key */\n \t\tret = key->type->instantiate(key, prep);\n \n \t\tif (ret == 0) {\n \t\t\t/* mark the key as being instantiated */\n \t\t\tatomic_inc(&key->user->nikeys);\n\t\t\tset_bit(KEY_FLAG_INSTANTIATED, &key->flags);\n \n \t\t\tif (test_and_clear_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags))\n \t\t\t\tawaken = 1;\n\n\t\t\t/* and link it into the destination keyring */\n\t\t\tif (keyring) {\n\t\t\t\tif (test_bit(KEY_FLAG_KEEP, &keyring->flags))\n\t\t\t\t\tset_bit(KEY_FLAG_KEEP, &key->flags);\n\n\t\t\t\t__key_link(key, _edit);\n\t\t\t}\n\n\t\t\t/* disable the authorisation key */\n\t\t\tif (authkey)\n\t\t\t\tkey_revoke(authkey);\n\n\t\t\tif (prep->expiry != TIME_T_MAX) {\n\t\t\t\tkey->expiry = prep->expiry;\n\t\t\t\tkey_schedule_gc(prep->expiry + key_gc_delay);\n\t\t\t}\n\t\t}\n\t}\n\n\tmutex_unlock(&key_construction_mutex);\n\n\t/* wake up anyone waiting for a key to be constructed */\n\tif (awaken)\n\t\twake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);\n\n\treturn ret;\n}\n", + "target": "static int __key_instantiate_and_link(struct key *key,\n\t\t\t\t struct key_preparsed_payload *prep,\n\t\t\t\t struct key *keyring,\n\t\t\t\t struct key *authkey,\n\t\t\t\t struct assoc_array_edit **_edit)\n{\n\tint ret, awaken;\n\n\tkey_check(key);\n\tkey_check(keyring);\n\n\tawaken = 0;\n\tret = -EBUSY;\n\n \tmutex_lock(&key_construction_mutex);\n \n \t/* can't instantiate twice */\n\tif (key->state == KEY_IS_UNINSTANTIATED) {\n \t\t/* instantiate the key */\n \t\tret = key->type->instantiate(key, prep);\n \n \t\tif (ret == 0) {\n \t\t\t/* mark the key as being instantiated */\n \t\t\tatomic_inc(&key->user->nikeys);\n\t\t\tmark_key_instantiated(key, 0);\n \n \t\t\tif (test_and_clear_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags))\n \t\t\t\tawaken = 1;\n\n\t\t\t/* and link it into the destination keyring */\n\t\t\tif (keyring) {\n\t\t\t\tif (test_bit(KEY_FLAG_KEEP, &keyring->flags))\n\t\t\t\t\tset_bit(KEY_FLAG_KEEP, &key->flags);\n\n\t\t\t\t__key_link(key, _edit);\n\t\t\t}\n\n\t\t\t/* disable the authorisation key */\n\t\t\tif (authkey)\n\t\t\t\tkey_revoke(authkey);\n\n\t\t\tif (prep->expiry != TIME_T_MAX) {\n\t\t\t\tkey->expiry = prep->expiry;\n\t\t\t\tkey_schedule_gc(prep->expiry + key_gc_delay);\n\t\t\t}\n\t\t}\n\t}\n\n\tmutex_unlock(&key_construction_mutex);\n\n\t/* wake up anyone waiting for a key to be constructed */\n\tif (awaken)\n\t\twake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);\n\n\treturn ret;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f3d3342602f8bcbf37d7c46641cb9bca7618eb1c", + "input": "static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,\n\t\t\t struct msghdr *msg, size_t len, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct sco_pinfo *pi = sco_pi(sk);\n\n\tlock_sock(sk);\n\n\tif (sk->sk_state == BT_CONNECT2 &&\n \t test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) {\n \t\tsco_conn_defer_accept(pi->conn->hcon, pi->setting);\n \t\tsk->sk_state = BT_CONFIG;\n\t\tmsg->msg_namelen = 0;\n \n \t\trelease_sock(sk);\n \t\treturn 0;\n\t}\n\n\trelease_sock(sk);\n\n\treturn bt_sock_recvmsg(iocb, sock, msg, len, flags);\n}\n", + "target": "static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,\n\t\t\t struct msghdr *msg, size_t len, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct sco_pinfo *pi = sco_pi(sk);\n\n\tlock_sock(sk);\n\n\tif (sk->sk_state == BT_CONNECT2 &&\n \t test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) {\n \t\tsco_conn_defer_accept(pi->conn->hcon, pi->setting);\n \t\tsk->sk_state = BT_CONFIG;\n \n \t\trelease_sock(sk);\n \t\treturn 0;\n\t}\n\n\trelease_sock(sk);\n\n\treturn bt_sock_recvmsg(iocb, sock, msg, len, flags);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b8682d868ddf7f741e93b791588af0932893f95c", + "input": " bool extractPages (const char *srcFileName, const char *destFileName) {\n char pathName[1024];\n GooString *gfileName = new GooString (srcFileName);\n PDFDoc *doc = new PDFDoc (gfileName, NULL, NULL, NULL);\n \n if (!doc->isOk()) {\n error(errSyntaxError, -1, \"Could not extract page(s) from damaged file ('{0:s}')\", srcFileName);\n return false;\n }\n\n if (firstPage == 0 && lastPage == 0) {\n firstPage = 1;\n lastPage = doc->getNumPages();\n }\n if (lastPage == 0)\n lastPage = doc->getNumPages();\n if (firstPage == 0)\n firstPage = 1;\n if (firstPage != lastPage && strstr(destFileName, \"%d\") == NULL) {\n error(errSyntaxError, -1, \"'{0:s}' must contain '%%d' if more than one page should be extracted\", destFileName);\n return false;\n }\n for (int pageNo = firstPage; pageNo <= lastPage; pageNo++) {\n sprintf (pathName, destFileName, pageNo);\n GooString *gpageName = new GooString (pathName);\n int errCode = doc->savePageAs(gpageName, pageNo);\n if ( errCode != errNone) {\n delete gpageName;\n delete gfileName;\n return false;\n }\n delete gpageName;\n }\n delete gfileName;\n return true;\n}\n", + "target": " bool extractPages (const char *srcFileName, const char *destFileName) {\n char pathName[4096];\n GooString *gfileName = new GooString (srcFileName);\n PDFDoc *doc = new PDFDoc (gfileName, NULL, NULL, NULL);\n \n if (!doc->isOk()) {\n error(errSyntaxError, -1, \"Could not extract page(s) from damaged file ('{0:s}')\", srcFileName);\n return false;\n }\n\n if (firstPage == 0 && lastPage == 0) {\n firstPage = 1;\n lastPage = doc->getNumPages();\n }\n if (lastPage == 0)\n lastPage = doc->getNumPages();\n if (firstPage == 0)\n firstPage = 1;\n if (firstPage != lastPage && strstr(destFileName, \"%d\") == NULL) {\n error(errSyntaxError, -1, \"'{0:s}' must contain '%%d' if more than one page should be extracted\", destFileName);\n return false;\n }\n for (int pageNo = firstPage; pageNo <= lastPage; pageNo++) {\n snprintf (pathName, sizeof (pathName) - 1, destFileName, pageNo);\n GooString *gpageName = new GooString (pathName);\n int errCode = doc->savePageAs(gpageName, pageNo);\n if ( errCode != errNone) {\n delete gpageName;\n delete gfileName;\n return false;\n }\n delete gpageName;\n }\n delete gfileName;\n return true;\n}\n", + "vul_type": "cwe-119", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#bb80e9c7a798f035768260ebdadffb6eb0786178", + "input": "on_unregister_handler(TCMUService1HandlerManager1 *interface,\n\t\t GDBusMethodInvocation *invocation,\n\t\t gchar *subtype,\n\t\t gpointer user_data)\n{\n\tstruct tcmur_handler *handler = find_handler_by_subtype(subtype);\n\tstruct dbus_info *info = handler ? handler->opaque : NULL;\n\n\tif (!handler) {\n\t\tg_dbus_method_invocation_return_value(invocation,\n\t\t\tg_variant_new(\"(bs)\", FALSE,\n \t\t\t\t \"unknown subtype\"));\n \t\treturn TRUE;\n \t}\n \tdbus_unexport_handler(handler);\n\ttcmur_unregister_handler(handler);\n \tg_bus_unwatch_name(info->watcher_id);\n \tg_free(info);\n \tg_free(handler);\n\tg_dbus_method_invocation_return_value(invocation,\n\t\tg_variant_new(\"(bs)\", TRUE, \"succeeded\"));\n\treturn TRUE;\n}\n", + "target": "on_unregister_handler(TCMUService1HandlerManager1 *interface,\n\t\t GDBusMethodInvocation *invocation,\n\t\t gchar *subtype,\n\t\t gpointer user_data)\n{\n\tstruct tcmur_handler *handler = find_handler_by_subtype(subtype);\n\tstruct dbus_info *info = handler ? handler->opaque : NULL;\n\n\tif (!handler) {\n\t\tg_dbus_method_invocation_return_value(invocation,\n\t\t\tg_variant_new(\"(bs)\", FALSE,\n \t\t\t\t \"unknown subtype\"));\n \t\treturn TRUE;\n \t}\n\telse if (handler->_is_dbus_handler != 1) {\n\t\tg_dbus_method_invocation_return_value(invocation,\n\t\t\tg_variant_new(\"(bs)\", FALSE,\n\t\t\t\t \"cannot unregister internal handler\"));\n\t\treturn TRUE;\n\t}\n\n \tdbus_unexport_handler(handler);\n\ttcmur_unregister_dbus_handler(handler);\n\n \tg_bus_unwatch_name(info->watcher_id);\n \tg_free(info);\n \tg_free(handler);\n\tg_dbus_method_invocation_return_value(invocation,\n\t\tg_variant_new(\"(bs)\", TRUE, \"succeeded\"));\n\treturn TRUE;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#6-3eb4912201d0", + "input": " def check_if_this_project_is_in_database(self, project_id):\n self.cursor.execute(\"SELECT count(id) FROM projects where id = %s\" % project_id)\n return self.cursor.fetchall()[0][0] == 1", + "target": " def check_if_this_project_is_in_database(self, project_id):\n self.cursor.execute(\"SELECT count(id) FROM projects where id = %s\", (project_id,))\n return self.cursor.fetchall()[0][0] == 1", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#d8fccaec4e73a9120074293c1997f963f810c9dd", + "input": "bool HarfBuzzShaper::shape(GlyphBuffer* glyphBuffer)\n{\n if (!createHarfBuzzRuns())\n return false;\n \n m_totalWidth = 0;\n if (!shapeHarfBuzzRuns())\n return false;\n \n if (glyphBuffer && !fillGlyphBuffer(glyphBuffer))\n return false;\n\n return true;\n}\n", + "target": "bool HarfBuzzShaper::shape(GlyphBuffer* glyphBuffer)\n{\n if (!createHarfBuzzRuns())\n return false;\n \n if (!shapeHarfBuzzRuns())\n return false;\n \n if (glyphBuffer && !fillGlyphBuffer(glyphBuffer))\n return false;\n\n return true;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3095060f479b86288e31c79ecbc5131a66bcd2f9", + "input": "ssh_packet_get_state(struct ssh *ssh, struct sshbuf *m)\n{\n\tstruct session_state *state = ssh->state;\n\tu_char *p;\n\tsize_t slen, rlen;\n\tint r, ssh1cipher;\n\n\tif (!compat20) {\n\t\tssh1cipher = cipher_ctx_get_number(state->receive_context);\n\t\tslen = cipher_get_keyiv_len(state->send_context);\n\t\trlen = cipher_get_keyiv_len(state->receive_context);\n\t\tif ((r = sshbuf_put_u32(m, state->remote_protocol_flags)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, ssh1cipher)) != 0 ||\n\t\t (r = sshbuf_put_string(m, state->ssh1_key, state->ssh1_keylen)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, slen)) != 0 ||\n\t\t (r = sshbuf_reserve(m, slen, &p)) != 0 ||\n\t\t (r = cipher_get_keyiv(state->send_context, p, slen)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, rlen)) != 0 ||\n\t\t (r = sshbuf_reserve(m, rlen, &p)) != 0 ||\n\t\t (r = cipher_get_keyiv(state->receive_context, p, rlen)) != 0)\n\t\t\treturn r;\n\t} else {\n\t\tif ((r = kex_to_blob(m, ssh->kex)) != 0 ||\n\t\t (r = newkeys_to_blob(m, ssh, MODE_OUT)) != 0 ||\n\t\t (r = newkeys_to_blob(m, ssh, MODE_IN)) != 0 ||\n\t\t (r = sshbuf_put_u64(m, state->rekey_limit)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, state->rekey_interval)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, state->p_send.seqnr)) != 0 ||\n\t\t (r = sshbuf_put_u64(m, state->p_send.blocks)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, state->p_send.packets)) != 0 ||\n\t\t (r = sshbuf_put_u64(m, state->p_send.bytes)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, state->p_read.seqnr)) != 0 ||\n\t\t (r = sshbuf_put_u64(m, state->p_read.blocks)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, state->p_read.packets)) != 0 ||\n\t\t (r = sshbuf_put_u64(m, state->p_read.bytes)) != 0)\n\t\t\treturn r;\n\t}\n\n\tslen = cipher_get_keycontext(state->send_context, NULL);\n\trlen = cipher_get_keycontext(state->receive_context, NULL);\n\tif ((r = sshbuf_put_u32(m, slen)) != 0 ||\n\t (r = sshbuf_reserve(m, slen, &p)) != 0)\n\t\treturn r;\n\tif (cipher_get_keycontext(state->send_context, p) != (int)slen)\n\t\treturn SSH_ERR_INTERNAL_ERROR;\n\tif ((r = sshbuf_put_u32(m, rlen)) != 0 ||\n\t (r = sshbuf_reserve(m, rlen, &p)) != 0)\n \t\treturn r;\n \tif (cipher_get_keycontext(state->receive_context, p) != (int)rlen)\n \t\treturn SSH_ERR_INTERNAL_ERROR;\n\tif ((r = ssh_packet_get_compress_state(m, ssh)) != 0 ||\n\t (r = sshbuf_put_stringb(m, state->input)) != 0 ||\n \t (r = sshbuf_put_stringb(m, state->output)) != 0)\n \t\treturn r;\n \n\treturn 0;\n}\n", + "target": "ssh_packet_get_state(struct ssh *ssh, struct sshbuf *m)\n{\n\tstruct session_state *state = ssh->state;\n\tu_char *p;\n\tsize_t slen, rlen;\n\tint r, ssh1cipher;\n\n\tif (!compat20) {\n\t\tssh1cipher = cipher_ctx_get_number(state->receive_context);\n\t\tslen = cipher_get_keyiv_len(state->send_context);\n\t\trlen = cipher_get_keyiv_len(state->receive_context);\n\t\tif ((r = sshbuf_put_u32(m, state->remote_protocol_flags)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, ssh1cipher)) != 0 ||\n\t\t (r = sshbuf_put_string(m, state->ssh1_key, state->ssh1_keylen)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, slen)) != 0 ||\n\t\t (r = sshbuf_reserve(m, slen, &p)) != 0 ||\n\t\t (r = cipher_get_keyiv(state->send_context, p, slen)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, rlen)) != 0 ||\n\t\t (r = sshbuf_reserve(m, rlen, &p)) != 0 ||\n\t\t (r = cipher_get_keyiv(state->receive_context, p, rlen)) != 0)\n\t\t\treturn r;\n\t} else {\n\t\tif ((r = kex_to_blob(m, ssh->kex)) != 0 ||\n\t\t (r = newkeys_to_blob(m, ssh, MODE_OUT)) != 0 ||\n\t\t (r = newkeys_to_blob(m, ssh, MODE_IN)) != 0 ||\n\t\t (r = sshbuf_put_u64(m, state->rekey_limit)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, state->rekey_interval)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, state->p_send.seqnr)) != 0 ||\n\t\t (r = sshbuf_put_u64(m, state->p_send.blocks)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, state->p_send.packets)) != 0 ||\n\t\t (r = sshbuf_put_u64(m, state->p_send.bytes)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, state->p_read.seqnr)) != 0 ||\n\t\t (r = sshbuf_put_u64(m, state->p_read.blocks)) != 0 ||\n\t\t (r = sshbuf_put_u32(m, state->p_read.packets)) != 0 ||\n\t\t (r = sshbuf_put_u64(m, state->p_read.bytes)) != 0)\n\t\t\treturn r;\n\t}\n\n\tslen = cipher_get_keycontext(state->send_context, NULL);\n\trlen = cipher_get_keycontext(state->receive_context, NULL);\n\tif ((r = sshbuf_put_u32(m, slen)) != 0 ||\n\t (r = sshbuf_reserve(m, slen, &p)) != 0)\n\t\treturn r;\n\tif (cipher_get_keycontext(state->send_context, p) != (int)slen)\n\t\treturn SSH_ERR_INTERNAL_ERROR;\n\tif ((r = sshbuf_put_u32(m, rlen)) != 0 ||\n\t (r = sshbuf_reserve(m, rlen, &p)) != 0)\n \t\treturn r;\n \tif (cipher_get_keycontext(state->receive_context, p) != (int)rlen)\n \t\treturn SSH_ERR_INTERNAL_ERROR;\n\tif ((r = sshbuf_put_stringb(m, state->input)) != 0 ||\n \t (r = sshbuf_put_stringb(m, state->output)) != 0)\n \t\treturn r;\n \n\treturn 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4c19b042ea31bd393d2265656f94339d1c3d82ff", + "input": "bool FileUtilProxy::Write(\n scoped_refptr message_loop_proxy,\n PlatformFile file,\n int64 offset,\n const char* buffer,\n int bytes_to_write,\n WriteCallback* callback) {\n if (bytes_to_write <= 0)\n return false;\n return Start(FROM_HERE, message_loop_proxy,\n new RelayWrite(file, offset, buffer, bytes_to_write, callback));\n }\n", + "target": "bool FileUtilProxy::Write(\n scoped_refptr message_loop_proxy,\n PlatformFile file,\n int64 offset,\n const char* buffer,\n int bytes_to_write,\n WriteCallback* callback) {\n if (bytes_to_write <= 0) {\n delete callback;\n return false;\n }\n return Start(FROM_HERE, message_loop_proxy,\n new RelayWrite(file, offset, buffer, bytes_to_write, callback));\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d42b2388f7f8e0332c846675133acea151fc557a", + "input": " jas_image_t *jas_image_create0()\n{\n\tjas_image_t *image;\n\n\tif (!(image = jas_malloc(sizeof(jas_image_t)))) {\n\t\treturn 0;\n\t}\n\n\timage->tlx_ = 0;\n\timage->tly_ = 0;\n\timage->brx_ = 0;\n\timage->bry_ = 0;\n\timage->clrspc_ = JAS_CLRSPC_UNKNOWN;\n \timage->numcmpts_ = 0;\n \timage->maxcmpts_ = 0;\n \timage->cmpts_ = 0;\n\timage->inmem_ = true;\n////\timage->inmem_ = true;\n \timage->cmprof_ = 0;\n \n \treturn image;\n}\n", + "target": " jas_image_t *jas_image_create0()\n{\n\tjas_image_t *image;\n\n\tif (!(image = jas_malloc(sizeof(jas_image_t)))) {\n\t\treturn 0;\n\t}\n\n\timage->tlx_ = 0;\n\timage->tly_ = 0;\n\timage->brx_ = 0;\n\timage->bry_ = 0;\n\timage->clrspc_ = JAS_CLRSPC_UNKNOWN;\n \timage->numcmpts_ = 0;\n \timage->maxcmpts_ = 0;\n \timage->cmpts_ = 0;\n////\timage->inmem_ = true;\n \timage->cmprof_ = 0;\n \n \treturn image;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8d4d589fc7d0a8f2fbb7a468e00f264fe54c7981", + "input": " CachedCSSStyleSheet* Cache::requestUserCSSStyleSheet(DocLoader* docLoader, const String& url, const String& charset)\n {\n CachedCSSStyleSheet* userSheet = new CachedCSSStyleSheet(url, charset);\n \n userSheet->setInCache(true);\n userSheet->load(docLoader, false, true, false);\n if (!disabled())\n m_resources.set(url, userSheet);\n else\n userSheet->setInCache(false);\n\n return userSheet;\n}\n", + "target": " CachedCSSStyleSheet* Cache::requestUserCSSStyleSheet(DocLoader* docLoader, const String& url, const String& charset)\n {\n if (CachedResource* existing = m_resources.get(url))\n return existing->type() == CachedResource::CSSStyleSheet ? static_cast(existing) : 0;\n\n CachedCSSStyleSheet* userSheet = new CachedCSSStyleSheet(url, charset);\n \n userSheet->setInCache(true);\n userSheet->load(docLoader, false, true, false);\n if (!disabled())\n m_resources.set(url, userSheet);\n else\n userSheet->setInCache(false);\n\n return userSheet;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1c40f9042ae2d6ee7483d72998aabb5e73b2ff60", + "input": "void WorkerFetchContext::DispatchWillSendRequest(\n unsigned long identifier,\n ResourceRequest& request,\n const ResourceResponse& redirect_response,\n const FetchInitiatorInfo& initiator_info) {\n probe::willSendRequest(global_scope_, identifier, nullptr, request,\n redirect_response, initiator_info);\n }\n", + "target": "void WorkerFetchContext::DispatchWillSendRequest(\n unsigned long identifier,\n ResourceRequest& request,\n const ResourceResponse& redirect_response,\n Resource::Type resource_type,\n const FetchInitiatorInfo& initiator_info) {\n probe::willSendRequest(global_scope_, identifier, nullptr, request,\n redirect_response, initiator_info, resource_type);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b15c87071f906301bccc824ce013966ca93998c7", + "input": "bool WtsSessionProcessDelegate::Core::Initialize(uint32 session_id) {\n if (base::win::GetVersion() == base::win::VERSION_XP)\n launch_elevated_ = false;\n \n if (launch_elevated_) {\n process_exit_event_.Set(CreateEvent(NULL, TRUE, FALSE, NULL));\n if (!process_exit_event_.IsValid()) {\n LOG(ERROR) << \"Failed to create a nameless event\";\n return false;\n }\n\n io_task_runner_->PostTask(FROM_HERE,\n base::Bind(&Core::InitializeJob, this));\n }\n\n return CreateSessionToken(session_id, &session_token_);\n}\n", + "target": "bool WtsSessionProcessDelegate::Core::Initialize(uint32 session_id) {\n if (base::win::GetVersion() == base::win::VERSION_XP)\n launch_elevated_ = false;\n \n if (launch_elevated_) {\n // GetNamedPipeClientProcessId() is available starting from Vista.\n HMODULE kernel32 = ::GetModuleHandle(L\"kernel32.dll\");\n CHECK(kernel32 != NULL);\n\n get_named_pipe_client_pid_ =\n reinterpret_cast(\n GetProcAddress(kernel32, \"GetNamedPipeClientProcessId\"));\n CHECK(get_named_pipe_client_pid_ != NULL);\n\n process_exit_event_.Set(CreateEvent(NULL, TRUE, FALSE, NULL));\n if (!process_exit_event_.IsValid()) {\n LOG(ERROR) << \"Failed to create a nameless event\";\n return false;\n }\n\n io_task_runner_->PostTask(FROM_HERE,\n base::Bind(&Core::InitializeJob, this));\n }\n\n return CreateSessionToken(session_id, &session_token_);\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5193be3be35f29a35bc465036cd64ad60d43385f", + "input": "static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)\n{\n TSC210xState *s = (TSC210xState *) opaque;\n int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);\n int i;\n\n s->x = qemu_get_be16(f);\n s->y = qemu_get_be16(f);\n s->pressure = qemu_get_byte(f);\n\n s->state = qemu_get_byte(f);\n s->page = qemu_get_byte(f);\n s->offset = qemu_get_byte(f);\n s->command = qemu_get_byte(f);\n\n s->irq = qemu_get_byte(f);\n qemu_get_be16s(f, &s->dav);\n\n timer_get(f, s->timer);\n s->enabled = qemu_get_byte(f);\n s->host_mode = qemu_get_byte(f);\n s->function = qemu_get_byte(f);\n s->nextfunction = qemu_get_byte(f);\n s->precision = qemu_get_byte(f);\n s->nextprecision = qemu_get_byte(f);\n s->filter = qemu_get_byte(f);\n s->pin_func = qemu_get_byte(f);\n s->ref = qemu_get_byte(f);\n qemu_get_be16s(f, &s->dac_power);\n\n for (i = 0; i < 0x14; i ++)\n qemu_get_be16s(f, &s->filter_data[i]);\n\n s->busy = timer_pending(s->timer);\n qemu_set_irq(s->pint, !s->irq);\n qemu_set_irq(s->davint, !s->dav);\n\n return 0;\n}\n", + "target": "static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)\n{\n TSC210xState *s = (TSC210xState *) opaque;\n int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);\n int i;\n\n s->x = qemu_get_be16(f);\n s->y = qemu_get_be16(f);\n s->pressure = qemu_get_byte(f);\n\n s->state = qemu_get_byte(f);\n s->page = qemu_get_byte(f);\n s->offset = qemu_get_byte(f);\n s->command = qemu_get_byte(f);\n\n s->irq = qemu_get_byte(f);\n qemu_get_be16s(f, &s->dav);\n\n timer_get(f, s->timer);\n s->enabled = qemu_get_byte(f);\n s->host_mode = qemu_get_byte(f);\n s->function = qemu_get_byte(f);\n if (s->function < 0 || s->function >= ARRAY_SIZE(mode_regs)) {\n return -EINVAL;\n }\n s->nextfunction = qemu_get_byte(f);\n if (s->nextfunction < 0 || s->nextfunction >= ARRAY_SIZE(mode_regs)) {\n return -EINVAL;\n }\n s->precision = qemu_get_byte(f);\n if (s->precision < 0 || s->precision >= ARRAY_SIZE(resolution)) {\n return -EINVAL;\n }\n s->nextprecision = qemu_get_byte(f);\n if (s->nextprecision < 0 || s->nextprecision >= ARRAY_SIZE(resolution)) {\n return -EINVAL;\n }\n s->filter = qemu_get_byte(f);\n s->pin_func = qemu_get_byte(f);\n s->ref = qemu_get_byte(f);\n qemu_get_be16s(f, &s->dac_power);\n\n for (i = 0; i < 0x14; i ++)\n qemu_get_be16s(f, &s->filter_data[i]);\n\n s->busy = timer_pending(s->timer);\n qemu_set_irq(s->pint, !s->irq);\n qemu_set_irq(s->davint, !s->dav);\n\n return 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0aca6bc05a263ea9eafee515fc6ba14da94c1964", + "input": " AccessType GetExtensionAccess(const Extension* extension,\n const GURL& url,\n int tab_id) {\n bool allowed_script = IsAllowedScript(extension, url, tab_id);\n bool allowed_capture =\n extension->permissions_data()->CanCaptureVisiblePage(tab_id, nullptr);\n \n if (allowed_script && allowed_capture)\n return ALLOWED_SCRIPT_AND_CAPTURE;\n if (allowed_script)\n return ALLOWED_SCRIPT_ONLY;\n if (allowed_capture)\n return ALLOWED_CAPTURE_ONLY;\n return DISALLOWED;\n }\n", + "target": " AccessType GetExtensionAccess(const Extension* extension,\n const GURL& url,\n int tab_id) {\n bool allowed_script = IsAllowedScript(extension, url, tab_id);\n bool allowed_capture = extension->permissions_data()->CanCaptureVisiblePage(\n url, extension, tab_id, nullptr);\n \n if (allowed_script && allowed_capture)\n return ALLOWED_SCRIPT_AND_CAPTURE;\n if (allowed_script)\n return ALLOWED_SCRIPT_ONLY;\n if (allowed_capture)\n return ALLOWED_CAPTURE_ONLY;\n return DISALLOWED;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0c4120fffa3dffe97b95c486a120eded82afe8a6", + "input": "static void load_xref_from_plaintext(FILE *fp, xref_t *xref)\n{\n int i, buf_idx, obj_id, added_entries;\n char c, buf[32] = {0};\n long start, pos;\n\n start = ftell(fp);\n\n /* Get number of entries */\n pos = xref->end;\n fseek(fp, pos, SEEK_SET);\n while (ftell(fp) != 0)\n if (SAFE_F(fp, (fgetc(fp) == '/' && fgetc(fp) == 'S')))\n break;\n else\n SAFE_E(fseek(fp, --pos, SEEK_SET), 0, \"Failed seek to xref /Size.\\n\");\n \n SAFE_E(fread(buf, 1, 21, fp), 21, \"Failed to load entry Size string.\\n\");\n xref->n_entries = atoi(buf + strlen(\"ize \"));\n xref->entries = calloc(1, xref->n_entries * sizeof(struct _xref_entry));\n \n /* Load entry data */\n obj_id = 0;\n fseek(fp, xref->start + strlen(\"xref\"), SEEK_SET);\n added_entries = 0;\n for (i=0; in_entries; i++)\n {\n /* Advance past newlines. */\n c = fgetc(fp);\n while (c == '\\n' || c == '\\r')\n c = fgetc(fp);\n\n /* Collect data up until the following newline. */\n buf_idx = 0;\n while (c != '\\n' && c != '\\r' && !feof(fp) &&\n !ferror(fp) && buf_idx < sizeof(buf))\n {\n buf[buf_idx++] = c;\n c = fgetc(fp);\n }\n if (buf_idx >= sizeof(buf))\n {\n ERR(\"Failed to locate newline character. \"\n \"This might be a corrupt PDF.\\n\");\n exit(EXIT_FAILURE);\n }\n buf[buf_idx] = '\\0';\n\n /* Went to far and hit start of trailer */\n if (strchr(buf, 't'))\n break;\n\n /* Entry or object id */\n if (strlen(buf) > 17)\n {\n xref->entries[i].obj_id = obj_id++;\n xref->entries[i].offset = atol(strtok(buf, \" \"));\n xref->entries[i].gen_num = atoi(strtok(NULL, \" \"));\n xref->entries[i].f_or_n = buf[17];\n ++added_entries;\n }\n else\n {\n obj_id = atoi(buf);\n --i;\n }\n }\n\n xref->n_entries = added_entries;\n fseek(fp, start, SEEK_SET);\n}\n", + "target": "static void load_xref_from_plaintext(FILE *fp, xref_t *xref)\n{\n int i, buf_idx, obj_id, added_entries;\n char c, buf[32] = {0};\n long start, pos;\n\n start = ftell(fp);\n\n /* Get number of entries */\n pos = xref->end;\n fseek(fp, pos, SEEK_SET);\n while (ftell(fp) != 0)\n if (SAFE_F(fp, (fgetc(fp) == '/' && fgetc(fp) == 'S')))\n break;\n else\n SAFE_E(fseek(fp, --pos, SEEK_SET), 0, \"Failed seek to xref /Size.\\n\");\n \n SAFE_E(fread(buf, 1, 21, fp), 21, \"Failed to load entry Size string.\\n\");\n xref->n_entries = atoi(buf + strlen(\"ize \"));\n xref->entries = safe_calloc(xref->n_entries * sizeof(struct _xref_entry));\n \n /* Load entry data */\n obj_id = 0;\n fseek(fp, xref->start + strlen(\"xref\"), SEEK_SET);\n added_entries = 0;\n for (i=0; in_entries; i++)\n {\n /* Advance past newlines. */\n c = fgetc(fp);\n while (c == '\\n' || c == '\\r')\n c = fgetc(fp);\n\n /* Collect data up until the following newline. */\n buf_idx = 0;\n while (c != '\\n' && c != '\\r' && !feof(fp) &&\n !ferror(fp) && buf_idx < sizeof(buf))\n {\n buf[buf_idx++] = c;\n c = fgetc(fp);\n }\n if (buf_idx >= sizeof(buf))\n {\n ERR(\"Failed to locate newline character. \"\n \"This might be a corrupt PDF.\\n\");\n exit(EXIT_FAILURE);\n }\n buf[buf_idx] = '\\0';\n\n /* Went to far and hit start of trailer */\n if (strchr(buf, 't'))\n break;\n\n /* Entry or object id */\n if (strlen(buf) > 17)\n {\n xref->entries[i].obj_id = obj_id++;\n xref->entries[i].offset = atol(strtok(buf, \" \"));\n xref->entries[i].gen_num = atoi(strtok(NULL, \" \"));\n xref->entries[i].f_or_n = buf[17];\n ++added_entries;\n }\n else\n {\n obj_id = atoi(buf);\n --i;\n }\n }\n\n xref->n_entries = added_entries;\n fseek(fp, start, SEEK_SET);\n}\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b944f670bb7a8a919daac497a4ea0536c954c201", + "input": "EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionAcceptTransferList(ExecState* exec)\n{\n JSValue thisValue = exec->hostThisValue();\n if (!thisValue.inherits(&JSTestSerializedScriptValueInterface::s_info))\n return throwVMTypeError(exec);\n JSTestSerializedScriptValueInterface* castedThis = jsCast(asObject(thisValue));\n ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestSerializedScriptValueInterface::s_info);\n TestSerializedScriptValueInterface* impl = static_cast(castedThis->impl());\n if (exec->argumentCount() < 1)\n return throwVMError(exec, createTypeError(exec, \"Not enough arguments\"));\n RefPtr data(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n\n size_t argsCount = exec->argumentCount();\n if (argsCount <= 1) {\n impl->acceptTransferList(data);\n return JSValue::encode(jsUndefined());\n }\n\n Array* transferList(toArray(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined)));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n impl->acceptTransferList(data, transferList);\n return JSValue::encode(jsUndefined());\n}\n", + "target": "EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionAcceptTransferList(ExecState* exec)\n{\n JSValue thisValue = exec->hostThisValue();\n if (!thisValue.inherits(&JSTestSerializedScriptValueInterface::s_info))\n return throwVMTypeError(exec);\n JSTestSerializedScriptValueInterface* castedThis = jsCast(asObject(thisValue));\n ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestSerializedScriptValueInterface::s_info);\n TestSerializedScriptValueInterface* impl = static_cast(castedThis->impl());\n if (exec->argumentCount() < 1)\n return throwVMError(exec, createNotEnoughArgumentsError(exec));\n RefPtr data(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n\n size_t argsCount = exec->argumentCount();\n if (argsCount <= 1) {\n impl->acceptTransferList(data);\n return JSValue::encode(jsUndefined());\n }\n\n Array* transferList(toArray(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined)));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n impl->acceptTransferList(data, transferList);\n return JSValue::encode(jsUndefined());\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d7a6be58edc01b1c66ecd8fcc91236bfbce0a420", + "input": "static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,\n\t\t\t u64 param3, u64 param4)\n{\n \tint rc;\n \tu64 base_addr, size;\n \n \t/* If user manually set \"flags\", make sure it is legal */\n \tif (flags && (flags &\n \t\t~(SETWA_FLAGS_APICID|SETWA_FLAGS_MEM|SETWA_FLAGS_PCIE_SBDF)))\n\t\treturn -EINVAL;\n\n\t/*\n\t * We need extra sanity checks for memory errors.\n\t * Other types leap directly to injection.\n\t */\n\n\t/* ensure param1/param2 existed */\n\tif (!(param_extension || acpi5))\n\t\tgoto inject;\n\n\t/* ensure injection is memory related */\n\tif (type & ACPI5_VENDOR_BIT) {\n\t\tif (vendor_flags != SETWA_FLAGS_MEM)\n\t\t\tgoto inject;\n\t} else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM))\n\t\tgoto inject;\n\n\t/*\n\t * Disallow crazy address masks that give BIOS leeway to pick\n\t * injection address almost anywhere. Insist on page or\n\t * better granularity and that target address is normal RAM or\n\t * NVDIMM.\n\t */\n\tbase_addr = param1 & param2;\n\tsize = ~param2 + 1;\n\n\tif (((param2 & PAGE_MASK) != PAGE_MASK) ||\n\t ((region_intersects(base_addr, size, IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE)\n\t\t\t\t!= REGION_INTERSECTS) &&\n\t (region_intersects(base_addr, size, IORESOURCE_MEM, IORES_DESC_PERSISTENT_MEMORY)\n\t\t\t\t!= REGION_INTERSECTS)))\n\t\treturn -EINVAL;\n\ninject:\n\tmutex_lock(&einj_mutex);\n\trc = __einj_error_inject(type, flags, param1, param2, param3, param4);\n\tmutex_unlock(&einj_mutex);\n\n\treturn rc;\n}\n", + "target": "static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,\n\t\t\t u64 param3, u64 param4)\n{\n \tint rc;\n \tu64 base_addr, size;\n \n\tif (get_securelevel() > 0)\n\t\treturn -EPERM;\n\n \t/* If user manually set \"flags\", make sure it is legal */\n \tif (flags && (flags &\n \t\t~(SETWA_FLAGS_APICID|SETWA_FLAGS_MEM|SETWA_FLAGS_PCIE_SBDF)))\n\t\treturn -EINVAL;\n\n\t/*\n\t * We need extra sanity checks for memory errors.\n\t * Other types leap directly to injection.\n\t */\n\n\t/* ensure param1/param2 existed */\n\tif (!(param_extension || acpi5))\n\t\tgoto inject;\n\n\t/* ensure injection is memory related */\n\tif (type & ACPI5_VENDOR_BIT) {\n\t\tif (vendor_flags != SETWA_FLAGS_MEM)\n\t\t\tgoto inject;\n\t} else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM))\n\t\tgoto inject;\n\n\t/*\n\t * Disallow crazy address masks that give BIOS leeway to pick\n\t * injection address almost anywhere. Insist on page or\n\t * better granularity and that target address is normal RAM or\n\t * NVDIMM.\n\t */\n\tbase_addr = param1 & param2;\n\tsize = ~param2 + 1;\n\n\tif (((param2 & PAGE_MASK) != PAGE_MASK) ||\n\t ((region_intersects(base_addr, size, IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE)\n\t\t\t\t!= REGION_INTERSECTS) &&\n\t (region_intersects(base_addr, size, IORESOURCE_MEM, IORES_DESC_PERSISTENT_MEMORY)\n\t\t\t\t!= REGION_INTERSECTS)))\n\t\treturn -EINVAL;\n\ninject:\n\tmutex_lock(&einj_mutex);\n\trc = __einj_error_inject(type, flags, param1, param2, param3, param4);\n\tmutex_unlock(&einj_mutex);\n\n\treturn rc;\n}\n", + "vul_type": "cwe-74", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c88547a8119e3b581318ab65e9b72f27f23e641d", + "input": "xfs_da3_fixhashpath(\n\tstruct xfs_da_state\t*state,\n\tstruct xfs_da_state_path *path)\n{\n\tstruct xfs_da_state_blk\t*blk;\n\tstruct xfs_da_intnode\t*node;\n\tstruct xfs_da_node_entry *btree;\n\txfs_dahash_t\t\tlasthash=0;\n\tint\t\t\tlevel;\n\tint\t\t\tcount;\n\tstruct xfs_inode\t*dp = state->args->dp;\n\n\ttrace_xfs_da_fixhashpath(state->args);\n\n\tlevel = path->active-1;\n\tblk = &path->blk[ level ];\n\tswitch (blk->magic) {\n\tcase XFS_ATTR_LEAF_MAGIC:\n\t\tlasthash = xfs_attr_leaf_lasthash(blk->bp, &count);\n\t\tif (count == 0)\n\t\t\treturn;\n\t\tbreak;\n\tcase XFS_DIR2_LEAFN_MAGIC:\n\t\tlasthash = xfs_dir2_leafn_lasthash(dp, blk->bp, &count);\n\t\tif (count == 0)\n\t\t\treturn;\n\t\tbreak;\n\tcase XFS_DA_NODE_MAGIC:\n\t\tlasthash = xfs_da3_node_lasthash(dp, blk->bp, &count);\n\t\tif (count == 0)\n\t\t\treturn;\n\t\tbreak;\n\t}\n\tfor (blk--, level--; level >= 0; blk--, level--) {\n\t\tstruct xfs_da3_icnode_hdr nodehdr;\n\n \t\tnode = blk->bp->b_addr;\n \t\tdp->d_ops->node_hdr_from_disk(&nodehdr, node);\n \t\tbtree = dp->d_ops->node_tree_p(node);\n\t\tif (be32_to_cpu(btree->hashval) == lasthash)\n \t\t\tbreak;\n \t\tblk->hashval = lasthash;\n \t\tbtree[blk->index].hashval = cpu_to_be32(lasthash);\n\t\txfs_trans_log_buf(state->args->trans, blk->bp,\n\t\t\t\t XFS_DA_LOGRANGE(node, &btree[blk->index],\n\t\t\t\t\t\t sizeof(*btree)));\n\n\t\tlasthash = be32_to_cpu(btree[nodehdr.count - 1].hashval);\n\t}\n}\n", + "target": "xfs_da3_fixhashpath(\n\tstruct xfs_da_state\t*state,\n\tstruct xfs_da_state_path *path)\n{\n\tstruct xfs_da_state_blk\t*blk;\n\tstruct xfs_da_intnode\t*node;\n\tstruct xfs_da_node_entry *btree;\n\txfs_dahash_t\t\tlasthash=0;\n\tint\t\t\tlevel;\n\tint\t\t\tcount;\n\tstruct xfs_inode\t*dp = state->args->dp;\n\n\ttrace_xfs_da_fixhashpath(state->args);\n\n\tlevel = path->active-1;\n\tblk = &path->blk[ level ];\n\tswitch (blk->magic) {\n\tcase XFS_ATTR_LEAF_MAGIC:\n\t\tlasthash = xfs_attr_leaf_lasthash(blk->bp, &count);\n\t\tif (count == 0)\n\t\t\treturn;\n\t\tbreak;\n\tcase XFS_DIR2_LEAFN_MAGIC:\n\t\tlasthash = xfs_dir2_leafn_lasthash(dp, blk->bp, &count);\n\t\tif (count == 0)\n\t\t\treturn;\n\t\tbreak;\n\tcase XFS_DA_NODE_MAGIC:\n\t\tlasthash = xfs_da3_node_lasthash(dp, blk->bp, &count);\n\t\tif (count == 0)\n\t\t\treturn;\n\t\tbreak;\n\t}\n\tfor (blk--, level--; level >= 0; blk--, level--) {\n\t\tstruct xfs_da3_icnode_hdr nodehdr;\n\n \t\tnode = blk->bp->b_addr;\n \t\tdp->d_ops->node_hdr_from_disk(&nodehdr, node);\n \t\tbtree = dp->d_ops->node_tree_p(node);\n\t\tif (be32_to_cpu(btree[blk->index].hashval) == lasthash)\n \t\t\tbreak;\n \t\tblk->hashval = lasthash;\n \t\tbtree[blk->index].hashval = cpu_to_be32(lasthash);\n\t\txfs_trans_log_buf(state->args->trans, blk->bp,\n\t\t\t\t XFS_DA_LOGRANGE(node, &btree[blk->index],\n\t\t\t\t\t\t sizeof(*btree)));\n\n\t\tlasthash = be32_to_cpu(btree[nodehdr.count - 1].hashval);\n\t}\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6a310d99a741f9ba5e4e537c5ec49d3adbe5876f", + "input": "void AXTree::PopulateOrderedSetItems(const AXNode* ordered_set,\n const AXNode* local_parent,\n std::vector& items,\n bool node_is_radio_button) const {\n if (!(ordered_set == local_parent)) {\n if (local_parent->data().role == ordered_set->data().role)\n return;\n }\n\n for (int i = 0; i < local_parent->child_count(); ++i) {\n const AXNode* child = local_parent->GetUnignoredChildAtIndex(i);\n \n if (node_is_radio_button &&\n child->data().role == ax::mojom::Role::kRadioButton)\n items.push_back(child);\n\n if (!node_is_radio_button && child->SetRoleMatchesItemRole(ordered_set))\n items.push_back(child);\n\n if (child->data().role == ax::mojom::Role::kGenericContainer ||\n child->data().role == ax::mojom::Role::kIgnored) {\n PopulateOrderedSetItems(ordered_set, child, items, node_is_radio_button);\n }\n }\n}\n", + "target": "void AXTree::PopulateOrderedSetItems(const AXNode* ordered_set,\n const AXNode* local_parent,\n std::vector& items,\n bool node_is_radio_button) const {\n if (!(ordered_set == local_parent)) {\n if (local_parent->data().role == ordered_set->data().role)\n return;\n }\n\n for (int i = 0; i < local_parent->child_count(); ++i) {\n const AXNode* child = local_parent->GetUnignoredChildAtIndex(i);\n \n // Invisible children should not be counted.\n // However, in the collapsed container case (e.g. a combobox), items can\n // still be chosen/navigated. However, the options in these collapsed\n // containers are historically marked invisible. Therefore, in that case,\n // count the invisible items. Only check 2 levels up, as combobox containers\n // are never higher.\n if (child->data().HasState(ax::mojom::State::kInvisible) &&\n !IsCollapsed(local_parent) && !IsCollapsed(local_parent->parent())) {\n continue;\n }\n\n if (node_is_radio_button &&\n child->data().role == ax::mojom::Role::kRadioButton)\n items.push_back(child);\n\n if (!node_is_radio_button && child->SetRoleMatchesItemRole(ordered_set))\n items.push_back(child);\n\n if (child->data().role == ax::mojom::Role::kGenericContainer ||\n child->data().role == ax::mojom::Role::kIgnored) {\n PopulateOrderedSetItems(ordered_set, child, items, node_is_radio_button);\n }\n }\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1161a49d663dd395bd639549c2dfe7324f847938", + "input": "int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) {\n if (HasTextBeingDragged())\n return ui::DragDropTypes::DRAG_NONE;\n\n if (data.HasURL()) {\n GURL url;\n base::string16 title;\n if (data.GetURLAndTitle(&url, &title)) {\n base::string16 text(\n StripJavascriptSchemas(base::UTF8ToUTF16(url.spec())));\n if (model()->CanPasteAndGo(text)) {\n model()->PasteAndGo(text);\n return ui::DragDropTypes::DRAG_COPY;\n }\n }\n } else if (data.HasString()) {\n base::string16 text;\n if (data.GetString(&text)) {\n base::string16 collapsed_text(CollapseWhitespace(text, true));\n if (model()->CanPasteAndGo(collapsed_text))\n model()->PasteAndGo(collapsed_text);\n return ui::DragDropTypes::DRAG_COPY;\n }\n }\n\n return ui::DragDropTypes::DRAG_NONE;\n}\n", + "target": "int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) {\n if (HasTextBeingDragged())\n return ui::DragDropTypes::DRAG_NONE;\n\n if (data.HasURL()) {\n GURL url;\n base::string16 title;\n if (data.GetURLAndTitle(\n ui::OSExchangeData::CONVERT_FILENAMES, &url, &title)) {\n base::string16 text(\n StripJavascriptSchemas(base::UTF8ToUTF16(url.spec())));\n if (model()->CanPasteAndGo(text)) {\n model()->PasteAndGo(text);\n return ui::DragDropTypes::DRAG_COPY;\n }\n }\n } else if (data.HasString()) {\n base::string16 text;\n if (data.GetString(&text)) {\n base::string16 collapsed_text(CollapseWhitespace(text, true));\n if (model()->CanPasteAndGo(collapsed_text))\n model()->PasteAndGo(collapsed_text);\n return ui::DragDropTypes::DRAG_COPY;\n }\n }\n\n return ui::DragDropTypes::DRAG_NONE;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cec8f96e49d9be372fdb0c3836dcf31ec71e457e", + "input": "static int snd_timer_user_params(struct file *file,\n\t\t\t\t struct snd_timer_params __user *_params)\n{\n\tstruct snd_timer_user *tu;\n\tstruct snd_timer_params params;\n\tstruct snd_timer *t;\n\tstruct snd_timer_read *tr;\n\tstruct snd_timer_tread *ttr;\n\tint err;\n\n\ttu = file->private_data;\n\tif (!tu->timeri)\n\t\treturn -EBADFD;\n\tt = tu->timeri->timer;\n\tif (!t)\n\t\treturn -EBADFD;\n\tif (copy_from_user(¶ms, _params, sizeof(params)))\n\t\treturn -EFAULT;\n\tif (!(t->hw.flags & SNDRV_TIMER_HW_SLAVE) && params.ticks < 1) {\n\t\terr = -EINVAL;\n\t\tgoto _end;\n\t}\n\tif (params.queue_size > 0 &&\n\t (params.queue_size < 32 || params.queue_size > 1024)) {\n\t\terr = -EINVAL;\n\t\tgoto _end;\n\t}\n\tif (params.filter & ~((1<timeri);\n\tspin_lock_irq(&t->lock);\n\ttu->timeri->flags &= ~(SNDRV_TIMER_IFLG_AUTO|\n\t\t\t SNDRV_TIMER_IFLG_EXCLUSIVE|\n\t\t\t SNDRV_TIMER_IFLG_EARLY_EVENT);\n\tif (params.flags & SNDRV_TIMER_PSFLG_AUTO)\n\t\ttu->timeri->flags |= SNDRV_TIMER_IFLG_AUTO;\n\tif (params.flags & SNDRV_TIMER_PSFLG_EXCLUSIVE)\n\t\ttu->timeri->flags |= SNDRV_TIMER_IFLG_EXCLUSIVE;\n\tif (params.flags & SNDRV_TIMER_PSFLG_EARLY_EVENT)\n\t\ttu->timeri->flags |= SNDRV_TIMER_IFLG_EARLY_EVENT;\n\tspin_unlock_irq(&t->lock);\n\tif (params.queue_size > 0 &&\n\t (unsigned int)tu->queue_size != params.queue_size) {\n\t\tif (tu->tread) {\n\t\t\tttr = kmalloc(params.queue_size * sizeof(*ttr),\n\t\t\t\t GFP_KERNEL);\n\t\t\tif (ttr) {\n\t\t\t\tkfree(tu->tqueue);\n\t\t\t\ttu->queue_size = params.queue_size;\n\t\t\t\ttu->tqueue = ttr;\n\t\t\t}\n\t\t} else {\n\t\t\ttr = kmalloc(params.queue_size * sizeof(*tr),\n\t\t\t\t GFP_KERNEL);\n\t\t\tif (tr) {\n\t\t\t\tkfree(tu->queue);\n\t\t\t\ttu->queue_size = params.queue_size;\n\t\t\t\ttu->queue = tr;\n\t\t\t}\n\t\t}\n\t}\n\ttu->qhead = tu->qtail = tu->qused = 0;\n \tif (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) {\n \t\tif (tu->tread) {\n \t\t\tstruct snd_timer_tread tread;\n \t\t\ttread.event = SNDRV_TIMER_EVENT_EARLY;\n \t\t\ttread.tstamp.tv_sec = 0;\n \t\t\ttread.tstamp.tv_nsec = 0;\n\t\t\ttread.val = 0;\n\t\t\tsnd_timer_user_append_to_tqueue(tu, &tread);\n\t\t} else {\n\t\t\tstruct snd_timer_read *r = &tu->queue[0];\n\t\t\tr->resolution = 0;\n\t\t\tr->ticks = 0;\n\t\t\ttu->qused++;\n\t\t\ttu->qtail++;\n\t\t}\n\t}\n\ttu->filter = params.filter;\n\ttu->ticks = params.ticks;\n\terr = 0;\n _end:\n\tif (copy_to_user(_params, ¶ms, sizeof(params)))\n\t\treturn -EFAULT;\n\treturn err;\n}\n", + "target": "static int snd_timer_user_params(struct file *file,\n\t\t\t\t struct snd_timer_params __user *_params)\n{\n\tstruct snd_timer_user *tu;\n\tstruct snd_timer_params params;\n\tstruct snd_timer *t;\n\tstruct snd_timer_read *tr;\n\tstruct snd_timer_tread *ttr;\n\tint err;\n\n\ttu = file->private_data;\n\tif (!tu->timeri)\n\t\treturn -EBADFD;\n\tt = tu->timeri->timer;\n\tif (!t)\n\t\treturn -EBADFD;\n\tif (copy_from_user(¶ms, _params, sizeof(params)))\n\t\treturn -EFAULT;\n\tif (!(t->hw.flags & SNDRV_TIMER_HW_SLAVE) && params.ticks < 1) {\n\t\terr = -EINVAL;\n\t\tgoto _end;\n\t}\n\tif (params.queue_size > 0 &&\n\t (params.queue_size < 32 || params.queue_size > 1024)) {\n\t\terr = -EINVAL;\n\t\tgoto _end;\n\t}\n\tif (params.filter & ~((1<timeri);\n\tspin_lock_irq(&t->lock);\n\ttu->timeri->flags &= ~(SNDRV_TIMER_IFLG_AUTO|\n\t\t\t SNDRV_TIMER_IFLG_EXCLUSIVE|\n\t\t\t SNDRV_TIMER_IFLG_EARLY_EVENT);\n\tif (params.flags & SNDRV_TIMER_PSFLG_AUTO)\n\t\ttu->timeri->flags |= SNDRV_TIMER_IFLG_AUTO;\n\tif (params.flags & SNDRV_TIMER_PSFLG_EXCLUSIVE)\n\t\ttu->timeri->flags |= SNDRV_TIMER_IFLG_EXCLUSIVE;\n\tif (params.flags & SNDRV_TIMER_PSFLG_EARLY_EVENT)\n\t\ttu->timeri->flags |= SNDRV_TIMER_IFLG_EARLY_EVENT;\n\tspin_unlock_irq(&t->lock);\n\tif (params.queue_size > 0 &&\n\t (unsigned int)tu->queue_size != params.queue_size) {\n\t\tif (tu->tread) {\n\t\t\tttr = kmalloc(params.queue_size * sizeof(*ttr),\n\t\t\t\t GFP_KERNEL);\n\t\t\tif (ttr) {\n\t\t\t\tkfree(tu->tqueue);\n\t\t\t\ttu->queue_size = params.queue_size;\n\t\t\t\ttu->tqueue = ttr;\n\t\t\t}\n\t\t} else {\n\t\t\ttr = kmalloc(params.queue_size * sizeof(*tr),\n\t\t\t\t GFP_KERNEL);\n\t\t\tif (tr) {\n\t\t\t\tkfree(tu->queue);\n\t\t\t\ttu->queue_size = params.queue_size;\n\t\t\t\ttu->queue = tr;\n\t\t\t}\n\t\t}\n\t}\n\ttu->qhead = tu->qtail = tu->qused = 0;\n \tif (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) {\n \t\tif (tu->tread) {\n \t\t\tstruct snd_timer_tread tread;\n\t\t\tmemset(&tread, 0, sizeof(tread));\n \t\t\ttread.event = SNDRV_TIMER_EVENT_EARLY;\n \t\t\ttread.tstamp.tv_sec = 0;\n \t\t\ttread.tstamp.tv_nsec = 0;\n\t\t\ttread.val = 0;\n\t\t\tsnd_timer_user_append_to_tqueue(tu, &tread);\n\t\t} else {\n\t\t\tstruct snd_timer_read *r = &tu->queue[0];\n\t\t\tr->resolution = 0;\n\t\t\tr->ticks = 0;\n\t\t\ttu->qused++;\n\t\t\ttu->qtail++;\n\t\t}\n\t}\n\ttu->filter = params.filter;\n\ttu->ticks = params.ticks;\n\terr = 0;\n _end:\n\tif (copy_to_user(_params, ¶ms, sizeof(params)))\n\t\treturn -EFAULT;\n\treturn err;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7f3d85b096f66870a15b37c2f40b219b2e292693", + "input": " png_get_mmx_rowbytes_threshold (png_structp png_ptr)\n {\n /* Obsolete, to be removed from libpng-1.4.0 */\n return (png_ptr? 0L: 0L);\n }\n", + "target": " png_get_mmx_rowbytes_threshold (png_structp png_ptr)\n {\n /* Obsolete, to be removed from libpng-1.4.0 */\n PNG_UNUSED(png_ptr)\n return 0L;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#027429ee5abe6e2fb5e3b2b4542f0a6fe0dbc12d", + "input": "bool BaseSessionService::RestoreUpdateTabNavigationCommand(\n const SessionCommand& command,\n TabNavigation* navigation,\n SessionID::id_type* tab_id) {\n scoped_ptr pickle(command.PayloadAsPickle());\n if (!pickle.get())\n return false;\n void* iterator = NULL;\n std::string url_spec;\n if (!pickle->ReadInt(&iterator, tab_id) ||\n !pickle->ReadInt(&iterator, &(navigation->index_)) ||\n !pickle->ReadString(&iterator, &url_spec) ||\n !pickle->ReadString16(&iterator, &(navigation->title_)) ||\n !pickle->ReadString(&iterator, &(navigation->state_)) ||\n !pickle->ReadInt(&iterator,\n reinterpret_cast(&(navigation->transition_))))\n return false;\n bool has_type_mask = pickle->ReadInt(&iterator, &(navigation->type_mask_));\n\n if (has_type_mask) {\n std::string referrer_spec;\n pickle->ReadString(&iterator, &referrer_spec);\n int policy_int;\n WebReferrerPolicy policy;\n if (pickle->ReadInt(&iterator, &policy_int))\n policy = static_cast(policy_int);\n else\n policy = WebKit::WebReferrerPolicyDefault;\n navigation->referrer_ = content::Referrer(\n referrer_spec.empty() ? GURL() : GURL(referrer_spec),\n policy);\n \n std::string content_state;\n if (CompressDataHelper::ReadAndDecompressStringFromPickle(\n *pickle.get(), &iterator, &content_state) &&\n !content_state.empty()) {\n navigation->state_ = content_state;\n }\n }\n \n navigation->virtual_url_ = GURL(url_spec);\n return true;\n}\n", + "target": "bool BaseSessionService::RestoreUpdateTabNavigationCommand(\n const SessionCommand& command,\n TabNavigation* navigation,\n SessionID::id_type* tab_id) {\n scoped_ptr pickle(command.PayloadAsPickle());\n if (!pickle.get())\n return false;\n void* iterator = NULL;\n std::string url_spec;\n if (!pickle->ReadInt(&iterator, tab_id) ||\n !pickle->ReadInt(&iterator, &(navigation->index_)) ||\n !pickle->ReadString(&iterator, &url_spec) ||\n !pickle->ReadString16(&iterator, &(navigation->title_)) ||\n !pickle->ReadString(&iterator, &(navigation->state_)) ||\n !pickle->ReadInt(&iterator,\n reinterpret_cast(&(navigation->transition_))))\n return false;\n bool has_type_mask = pickle->ReadInt(&iterator, &(navigation->type_mask_));\n\n if (has_type_mask) {\n std::string referrer_spec;\n pickle->ReadString(&iterator, &referrer_spec);\n int policy_int;\n WebReferrerPolicy policy;\n if (pickle->ReadInt(&iterator, &policy_int))\n policy = static_cast(policy_int);\n else\n policy = WebKit::WebReferrerPolicyDefault;\n navigation->referrer_ = content::Referrer(\n referrer_spec.empty() ? GURL() : GURL(referrer_spec),\n policy);\n \n base::TimeTicks start_time_ = base::TimeTicks::Now();\n std::string content_state;\n if (CompressDataHelper::ReadAndDecompressStringFromPickle(\n *pickle.get(), &iterator, &content_state) &&\n !content_state.empty()) {\n navigation->state_ = content_state;\n }\n base::TimeDelta total_time = base::TimeTicks::Now() - start_time_;\n time_spent_reading_compressed_content_states += total_time;\n }\n \n navigation->virtual_url_ = GURL(url_spec);\n return true;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ffac0ee4b8b00944e2ddf23f7f4f55daff3c117e", + "input": " void ManifestManager::FetchManifest() {\n manifest_url_ = render_frame()->GetWebFrame()->GetDocument().ManifestURL();\n \n if (manifest_url_.is_empty()) {\n ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_EMPTY_URL);\n ResolveCallbacks(ResolveStateFailure);\n return;\n }\n\n fetcher_.reset(new ManifestFetcher(manifest_url_));\n fetcher_->Start(\n render_frame()->GetWebFrame(),\n render_frame()->GetWebFrame()->GetDocument().ManifestUseCredentials(),\n base::Bind(&ManifestManager::OnManifestFetchComplete,\n base::Unretained(this),\n render_frame()->GetWebFrame()->GetDocument().Url()));\n}\n", + "target": " void ManifestManager::FetchManifest() {\n if (!CanFetchManifest(render_frame())) {\n ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_FROM_UNIQUE_ORIGIN);\n ResolveCallbacks(ResolveStateFailure);\n return;\n }\n\n manifest_url_ = render_frame()->GetWebFrame()->GetDocument().ManifestURL();\n \n if (manifest_url_.is_empty()) {\n ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_EMPTY_URL);\n ResolveCallbacks(ResolveStateFailure);\n return;\n }\n\n fetcher_.reset(new ManifestFetcher(manifest_url_));\n fetcher_->Start(\n render_frame()->GetWebFrame(),\n render_frame()->GetWebFrame()->GetDocument().ManifestUseCredentials(),\n base::Bind(&ManifestManager::OnManifestFetchComplete,\n base::Unretained(this),\n render_frame()->GetWebFrame()->GetDocument().Url()));\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b585a3aed7880a5fa5c18e2b838fc96f40e075bd", + "input": "static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements, int objprops)\n{\n\twhile (elements-- > 0) {\n\t\tzval *key, *data, **old_data;\n\n\t\tALLOC_INIT_ZVAL(key);\n\n\t\tif (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\treturn 0;\n\t\t}\n\n\t\tALLOC_INIT_ZVAL(data);\n\n\t\tif (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\tzval_dtor(data);\n\t\t\tFREE_ZVAL(data);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (!objprops) {\n\t\t\tswitch (Z_TYPE_P(key)) {\n\t\t\tcase IS_LONG:\n\t\t\t\tif (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) {\n\t\t\t\t\tvar_push_dtor(var_hash, old_data);\n\t\t\t\t}\n\t\t\t\tzend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);\n\t\t\t\tbreak;\n\t\t\tcase IS_STRING:\n\t\t\t\tif (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {\n\t\t\t\t\tvar_push_dtor(var_hash, old_data);\n\t\t\t\t}\n\t\t\t\tzend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);\n\t\t\t\tbreak;\n\t\t\t}\n \t\t} else {\n \t\t\t/* object properties should include no integers */\n \t\t\tconvert_to_string(key);\n\t\t\tif (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {\n \t\t\t\tvar_push_dtor(var_hash, old_data);\n \t\t\t}\n \t\t\tzend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data,\n\t\t\t\t\tsizeof data, NULL);\n\t\t}\n\t\t\n\t\tzval_dtor(key);\n\t\tFREE_ZVAL(key);\n\n\t\tif (elements && *(*p-1) != ';' && *(*p-1) != '}') {\n\t\t\t(*p)--;\n\t\t\treturn 0;\n\t\t}\n\t}\n", + "target": "static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements, int objprops)\n{\n\twhile (elements-- > 0) {\n\t\tzval *key, *data, **old_data;\n\n\t\tALLOC_INIT_ZVAL(key);\n\n\t\tif (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\treturn 0;\n\t\t}\n\n\t\tALLOC_INIT_ZVAL(data);\n\n\t\tif (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) {\n\t\t\tzval_dtor(key);\n\t\t\tFREE_ZVAL(key);\n\t\t\tzval_dtor(data);\n\t\t\tFREE_ZVAL(data);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (!objprops) {\n\t\t\tswitch (Z_TYPE_P(key)) {\n\t\t\tcase IS_LONG:\n\t\t\t\tif (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) {\n\t\t\t\t\tvar_push_dtor(var_hash, old_data);\n\t\t\t\t}\n\t\t\t\tzend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL);\n\t\t\t\tbreak;\n\t\t\tcase IS_STRING:\n\t\t\t\tif (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {\n\t\t\t\t\tvar_push_dtor(var_hash, old_data);\n\t\t\t\t}\n\t\t\t\tzend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);\n\t\t\t\tbreak;\n\t\t\t}\n \t\t} else {\n \t\t\t/* object properties should include no integers */\n \t\t\tconvert_to_string(key);\n\t\t\tif (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {\n \t\t\t\tvar_push_dtor(var_hash, old_data);\n \t\t\t}\n \t\t\tzend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data,\n\t\t\t\t\tsizeof data, NULL);\n\t\t}\n\t\t\n\t\tzval_dtor(key);\n\t\tFREE_ZVAL(key);\n\n\t\tif (elements && *(*p-1) != ';' && *(*p-1) != '}') {\n\t\t\t(*p)--;\n\t\t\treturn 0;\n\t\t}\n\t}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b944f670bb7a8a919daac497a4ea0536c954c201", + "input": "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec)\n{\n JSValue thisValue = exec->hostThisValue();\n if (!thisValue.inherits(&JSTestObj::s_info))\n return throwVMTypeError(exec);\n JSTestObj* castedThis = jsCast(asObject(thisValue));\n ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);\n TestObj* impl = static_cast(castedThis->impl());\n if (exec->argumentCount() < 2)\n return throwVMError(exec, createTypeError(exec, \"Not enough arguments\"));\n JSValue listener = exec->argument(1);\n if (!listener.isObject())\n return JSValue::encode(jsUndefined());\n impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));\n return JSValue::encode(jsUndefined());\n}\n", + "target": "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec)\n{\n JSValue thisValue = exec->hostThisValue();\n if (!thisValue.inherits(&JSTestObj::s_info))\n return throwVMTypeError(exec);\n JSTestObj* castedThis = jsCast(asObject(thisValue));\n ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);\n TestObj* impl = static_cast(castedThis->impl());\n if (exec->argumentCount() < 2)\n return throwVMError(exec, createNotEnoughArgumentsError(exec));\n JSValue listener = exec->argument(1);\n if (!listener.isObject())\n return JSValue::encode(jsUndefined());\n impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));\n return JSValue::encode(jsUndefined());\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0720b02e4f303ea6b114d4ae9453e3a7ff55f8dc", + "input": "void WebContentsImpl::RunJavaScriptDialog(RenderFrameHost* render_frame_host,\n const base::string16& message,\n const base::string16& default_prompt,\n const GURL& frame_url,\n JavaScriptDialogType dialog_type,\n IPC::Message* reply_msg) {\n bool suppress_this_message =\n ShowingInterstitialPage() || !delegate_ ||\n delegate_->ShouldSuppressDialogs(this) ||\n !delegate_->GetJavaScriptDialogManager(this);\n\n if (!suppress_this_message) {\n is_showing_javascript_dialog_ = true;\n dialog_manager_ = delegate_->GetJavaScriptDialogManager(this);\n dialog_manager_->RunJavaScriptDialog(\n this, frame_url, dialog_type, message, default_prompt,\n base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this),\n render_frame_host->GetProcess()->GetID(),\n render_frame_host->GetRoutingID(), reply_msg, false),\n &suppress_this_message);\n }\n\n if (suppress_this_message) {\n OnDialogClosed(render_frame_host->GetProcess()->GetID(),\n render_frame_host->GetRoutingID(), reply_msg,\n true, false, base::string16());\n }\n}\n", + "target": "void WebContentsImpl::RunJavaScriptDialog(RenderFrameHost* render_frame_host,\n const base::string16& message,\n const base::string16& default_prompt,\n const GURL& frame_url,\n JavaScriptDialogType dialog_type,\n IPC::Message* reply_msg) {\n // Running a dialog causes an exit to webpage-initiated fullscreen.\n // http://crbug.com/728276\n if (IsFullscreenForCurrentTab())\n ExitFullscreen(true);\n\n bool suppress_this_message =\n ShowingInterstitialPage() || !delegate_ ||\n delegate_->ShouldSuppressDialogs(this) ||\n !delegate_->GetJavaScriptDialogManager(this);\n\n if (!suppress_this_message) {\n is_showing_javascript_dialog_ = true;\n dialog_manager_ = delegate_->GetJavaScriptDialogManager(this);\n dialog_manager_->RunJavaScriptDialog(\n this, frame_url, dialog_type, message, default_prompt,\n base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this),\n render_frame_host->GetProcess()->GetID(),\n render_frame_host->GetRoutingID(), reply_msg, false),\n &suppress_this_message);\n }\n\n if (suppress_this_message) {\n OnDialogClosed(render_frame_host->GetProcess()->GetID(),\n render_frame_host->GetRoutingID(), reply_msg,\n true, false, base::string16());\n }\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7394cf6f43d7a86630d3eb1c728fd63c621b5530", + "input": "bool TabLifecycleUnitSource::TabLifecycleUnit::CanDiscard(\n DiscardReason reason,\n DecisionDetails* decision_details) const {\n DCHECK(decision_details->reasons().empty());\n\n\n if (!tab_strip_model_)\n return false;\n\n const LifecycleUnitState target_state =\n reason == DiscardReason::kProactive &&\n GetState() != LifecycleUnitState::FROZEN\n ? LifecycleUnitState::PENDING_DISCARD\n : LifecycleUnitState::DISCARDED;\n if (!IsValidStateChange(GetState(), target_state,\n DiscardReasonToStateChangeReason(reason))) {\n return false;\n }\n\n if (GetWebContents()->IsCrashed())\n return false;\n\n if (!GetWebContents()->GetLastCommittedURL().is_valid() ||\n GetWebContents()->GetLastCommittedURL().is_empty()) {\n return false;\n }\n\n if (discard_count_ > 0) {\n#if defined(OS_CHROMEOS)\n if (reason != DiscardReason::kUrgent)\n return false;\n#else\n return false;\n #endif // defined(OS_CHROMEOS)\n }\n \n\n#if defined(OS_CHROMEOS)\n if (GetWebContents()->GetVisibility() == content::Visibility::VISIBLE)\n decision_details->AddReason(DecisionFailureReason::LIVE_STATE_VISIBLE);\n#else\n if (tab_strip_model_->GetActiveWebContents() == GetWebContents())\n decision_details->AddReason(DecisionFailureReason::LIVE_STATE_VISIBLE);\n#endif // defined(OS_CHROMEOS)\n\n if (GetWebContents()->GetPageImportanceSignals().had_form_interaction)\n decision_details->AddReason(DecisionFailureReason::LIVE_STATE_FORM_ENTRY);\n\n IsMediaTabImpl(decision_details);\n\n if (GetWebContents()->GetContentsMimeType() == \"application/pdf\")\n decision_details->AddReason(DecisionFailureReason::LIVE_STATE_IS_PDF);\n\n if (!IsAutoDiscardable()) {\n decision_details->AddReason(\n DecisionFailureReason::LIVE_STATE_EXTENSION_DISALLOWED);\n }\n \n if (decision_details->reasons().empty()) {\n decision_details->AddReason(\n DecisionSuccessReason::HEURISTIC_OBSERVED_TO_BE_SAFE);\n DCHECK(decision_details->IsPositive());\n }\n return decision_details->IsPositive();\n}\n", + "target": "bool TabLifecycleUnitSource::TabLifecycleUnit::CanDiscard(\n DiscardReason reason,\n DecisionDetails* decision_details) const {\n DCHECK(decision_details->reasons().empty());\n\n\n if (!tab_strip_model_)\n return false;\n\n const LifecycleUnitState target_state =\n reason == DiscardReason::kProactive &&\n GetState() != LifecycleUnitState::FROZEN\n ? LifecycleUnitState::PENDING_DISCARD\n : LifecycleUnitState::DISCARDED;\n if (!IsValidStateChange(GetState(), target_state,\n DiscardReasonToStateChangeReason(reason))) {\n return false;\n }\n\n if (GetWebContents()->IsCrashed())\n return false;\n\n if (!GetWebContents()->GetLastCommittedURL().is_valid() ||\n GetWebContents()->GetLastCommittedURL().is_empty()) {\n return false;\n }\n\n if (discard_count_ > 0) {\n#if defined(OS_CHROMEOS)\n if (reason != DiscardReason::kUrgent)\n return false;\n#else\n return false;\n #endif // defined(OS_CHROMEOS)\n }\n \n\n#if defined(OS_CHROMEOS)\n if (GetWebContents()->GetVisibility() == content::Visibility::VISIBLE)\n decision_details->AddReason(DecisionFailureReason::LIVE_STATE_VISIBLE);\n#else\n if (tab_strip_model_->GetActiveWebContents() == GetWebContents())\n decision_details->AddReason(DecisionFailureReason::LIVE_STATE_VISIBLE);\n#endif // defined(OS_CHROMEOS)\n\n if (GetWebContents()->GetPageImportanceSignals().had_form_interaction)\n decision_details->AddReason(DecisionFailureReason::LIVE_STATE_FORM_ENTRY);\n\n IsMediaTabImpl(decision_details);\n\n if (GetWebContents()->GetContentsMimeType() == \"application/pdf\")\n decision_details->AddReason(DecisionFailureReason::LIVE_STATE_IS_PDF);\n\n if (!IsAutoDiscardable()) {\n decision_details->AddReason(\n DecisionFailureReason::LIVE_STATE_EXTENSION_DISALLOWED);\n }\n \n // Consult the local database to see if this tab could try to communicate with\n // the user while in background (don't check for the visibility here as\n // there's already a check for that above).\n if (reason != DiscardReason::kUrgent) {\n CheckIfTabCanCommunicateWithUserWhileInBackground(GetWebContents(),\n decision_details);\n }\n\n if (decision_details->reasons().empty()) {\n decision_details->AddReason(\n DecisionSuccessReason::HEURISTIC_OBSERVED_TO_BE_SAFE);\n DCHECK(decision_details->IsPositive());\n }\n return decision_details->IsPositive();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#bf381d8a02c3d272d4dd879ac719d8993dfb5ad6", + "input": " void HistoryModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) {\n WaitableEvent done(false, false);\n scoped_refptr task(new WorkerTask(work, &done));\n history_service_->ScheduleDBTask(task.get(), this);\n done.Wait();\n }\n", + "target": " void HistoryModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) {\n WaitableEvent done(false, false);\n scoped_refptr task(new WorkerTask(work, &done));\n history_service_->ScheduleDBTask(task.get(), &cancelable_consumer_);\n done.Wait();\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc7b094a338c6c521f918f478e993f0f74bbea0d", + "input": " static void FocusInCallback(IBusPanelService* panel,\n const gchar* path,\n gpointer user_data) {\n g_return_if_fail(user_data);\n InputMethodStatusConnection* self\n = static_cast(user_data);\n self->FocusIn(path);\n }\n", + "target": " static void FocusInCallback(IBusPanelService* panel,\n void FocusIn(IBusPanelService* panel, const gchar* input_context_path) {\n if (!input_context_path) {\n LOG(ERROR) << \"NULL context passed\";\n } else {\n VLOG(1) << \"FocusIn: \" << input_context_path;\n }\n // Remember the current ic path.\n input_context_path_ = Or(input_context_path, \"\");\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d0c31f0342cefc46a3b3d80359a9779d044d4c0d", + "input": " static void unregisterBlobURLTask(void* context)\n {\n OwnPtr blobRegistryContext = adoptPtr(static_cast(context));\n blobRegistry().unregisterBlobURL(blobRegistryContext->url);\n }\n", + "target": " static void unregisterBlobURLTask(void* context)\n {\n OwnPtr blobRegistryContext = adoptPtr(static_cast(context));\n if (WebBlobRegistry* registry = blobRegistry())\n registry->unregisterBlobURL(blobRegistryContext->url);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7d3aba9f06899d0128ef46e8a2fa143c6fad8f62", + "input": "mobility_opt_print(netdissect_options *ndo,\n const u_char *bp, const unsigned len)\n{\n\tunsigned i, optlen;\n\n\tfor (i = 0; i < len; i += optlen) {\n\t\tND_TCHECK(bp[i]);\n\t\tif (bp[i] == IP6MOPT_PAD1)\n\t\t\toptlen = 1;\n\t\telse {\n\t\t\tif (i + 1 < len) {\n\t\t\t\tND_TCHECK(bp[i + 1]);\n\t\t\t\toptlen = bp[i + 1] + 2;\n\t\t\t}\n\t\t\telse\n\t\t\t\tgoto trunc;\n\t\t}\n\t\tif (i + optlen > len)\n\t\t\tgoto trunc;\n\t\tND_TCHECK(bp[i + optlen]);\n\n\t\tswitch (bp[i]) {\n\t\tcase IP6MOPT_PAD1:\n\t\t\tND_PRINT((ndo, \"(pad1)\"));\n\t\t\tbreak;\n\t\tcase IP6MOPT_PADN:\n\t\t\tif (len - i < IP6MOPT_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(padn: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(padn)\"));\n\t\t\tbreak;\n\t\tcase IP6MOPT_REFRESH:\n\t\t\tif (len - i < IP6MOPT_REFRESH_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(refresh: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\t/* units of 4 secs */\n\t\t\tND_TCHECK_16BITS(&bp[i+2]);\n\t\t\tND_PRINT((ndo, \"(refresh: %u)\",\n\t\t\t\tEXTRACT_16BITS(&bp[i+2]) << 2));\n\t\t\tbreak;\n\t\tcase IP6MOPT_ALTCOA:\n\t\t\tif (len - i < IP6MOPT_ALTCOA_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(altcoa: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(alt-CoA: %s)\", ip6addr_string(ndo, &bp[i+2])));\n\t\t\tbreak;\n\t\tcase IP6MOPT_NONCEID:\n\t\t\tif (len - i < IP6MOPT_NONCEID_MINLEN) {\n \t\t\t\tND_PRINT((ndo, \"(ni: trunc)\"));\n \t\t\t\tgoto trunc;\n \t\t\t}\n \t\t\tND_PRINT((ndo, \"(ni: ho=0x%04x co=0x%04x)\",\n \t\t\t\tEXTRACT_16BITS(&bp[i+2]),\n \t\t\t\tEXTRACT_16BITS(&bp[i+4])));\n\t\t\tbreak;\n\t\tcase IP6MOPT_AUTH:\n\t\t\tif (len - i < IP6MOPT_AUTH_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(auth: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(auth)\"));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (len - i < IP6MOPT_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(sopt_type %u: trunc)\", bp[i]));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(type-0x%02x: len=%u)\", bp[i], bp[i + 1]));\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n\ntrunc:\n\treturn 1;\n}\n", + "target": "mobility_opt_print(netdissect_options *ndo,\n const u_char *bp, const unsigned len)\n{\n\tunsigned i, optlen;\n\n\tfor (i = 0; i < len; i += optlen) {\n\t\tND_TCHECK(bp[i]);\n\t\tif (bp[i] == IP6MOPT_PAD1)\n\t\t\toptlen = 1;\n\t\telse {\n\t\t\tif (i + 1 < len) {\n\t\t\t\tND_TCHECK(bp[i + 1]);\n\t\t\t\toptlen = bp[i + 1] + 2;\n\t\t\t}\n\t\t\telse\n\t\t\t\tgoto trunc;\n\t\t}\n\t\tif (i + optlen > len)\n\t\t\tgoto trunc;\n\t\tND_TCHECK(bp[i + optlen]);\n\n\t\tswitch (bp[i]) {\n\t\tcase IP6MOPT_PAD1:\n\t\t\tND_PRINT((ndo, \"(pad1)\"));\n\t\t\tbreak;\n\t\tcase IP6MOPT_PADN:\n\t\t\tif (len - i < IP6MOPT_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(padn: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(padn)\"));\n\t\t\tbreak;\n\t\tcase IP6MOPT_REFRESH:\n\t\t\tif (len - i < IP6MOPT_REFRESH_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(refresh: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\t/* units of 4 secs */\n\t\t\tND_TCHECK_16BITS(&bp[i+2]);\n\t\t\tND_PRINT((ndo, \"(refresh: %u)\",\n\t\t\t\tEXTRACT_16BITS(&bp[i+2]) << 2));\n\t\t\tbreak;\n\t\tcase IP6MOPT_ALTCOA:\n\t\t\tif (len - i < IP6MOPT_ALTCOA_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(altcoa: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(alt-CoA: %s)\", ip6addr_string(ndo, &bp[i+2])));\n\t\t\tbreak;\n\t\tcase IP6MOPT_NONCEID:\n\t\t\tif (len - i < IP6MOPT_NONCEID_MINLEN) {\n \t\t\t\tND_PRINT((ndo, \"(ni: trunc)\"));\n \t\t\t\tgoto trunc;\n \t\t\t}\n\t\t\tND_TCHECK_16BITS(&bp[i+2]);\n\t\t\tND_TCHECK_16BITS(&bp[i+4]);\n \t\t\tND_PRINT((ndo, \"(ni: ho=0x%04x co=0x%04x)\",\n \t\t\t\tEXTRACT_16BITS(&bp[i+2]),\n \t\t\t\tEXTRACT_16BITS(&bp[i+4])));\n\t\t\tbreak;\n\t\tcase IP6MOPT_AUTH:\n\t\t\tif (len - i < IP6MOPT_AUTH_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(auth: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(auth)\"));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (len - i < IP6MOPT_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(sopt_type %u: trunc)\", bp[i]));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(type-0x%02x: len=%u)\", bp[i], bp[i + 1]));\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n\ntrunc:\n\treturn 1;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0be839a2701369f669532ea5884c15bead1c6e08", + "input": "static inline void *host_from_stream_offset(QEMUFile *f,\n ram_addr_t offset,\n int flags)\n{\n static RAMBlock *block = NULL;\n char id[256];\n uint8_t len;\n \n if (flags & RAM_SAVE_FLAG_CONTINUE) {\n if (!block) {\n error_report(\"Ack, bad migration stream!\");\n return NULL;\n }\n\n return memory_region_get_ram_ptr(block->mr) + offset;\n }\n\n len = qemu_get_byte(f);\n qemu_get_buffer(f, (uint8_t *)id, len);\n id[len] = 0;\n \n QTAILQ_FOREACH(block, &ram_list.blocks, next) {\n if (!strncmp(id, block->idstr, sizeof(id)))\n return memory_region_get_ram_ptr(block->mr) + offset;\n }\n \n error_report(\"Can't find block %s!\", id);\n}\n", + "target": "static inline void *host_from_stream_offset(QEMUFile *f,\n ram_addr_t offset,\n int flags)\n{\n static RAMBlock *block = NULL;\n char id[256];\n uint8_t len;\n \n if (flags & RAM_SAVE_FLAG_CONTINUE) {\n if (!block || block->length <= offset) {\n error_report(\"Ack, bad migration stream!\");\n return NULL;\n }\n\n return memory_region_get_ram_ptr(block->mr) + offset;\n }\n\n len = qemu_get_byte(f);\n qemu_get_buffer(f, (uint8_t *)id, len);\n id[len] = 0;\n \n QTAILQ_FOREACH(block, &ram_list.blocks, next) {\n if (!strncmp(id, block->idstr, sizeof(id)) && block->length > offset) {\n return memory_region_get_ram_ptr(block->mr) + offset;\n }\n }\n \n error_report(\"Can't find block %s!\", id);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fad67a5b73639d7211b24fd9bdb242e82039b765", + "input": "AccessControlStatus ScriptResource::CalculateAccessControlStatus() const {\n if (GetCORSStatus() == CORSStatus::kServiceWorkerOpaque)\n return kOpaqueResource;\n \n if (IsSameOriginOrCORSSuccessful())\n return kSharableCrossOrigin;\n \n return kNotSharableCrossOrigin;\n}\n", + "target": "AccessControlStatus ScriptResource::CalculateAccessControlStatus() const {\nAccessControlStatus ScriptResource::CalculateAccessControlStatus(\n const SecurityOrigin* security_origin) const {\n if (GetResponse().WasFetchedViaServiceWorker()) {\n if (GetCORSStatus() == CORSStatus::kServiceWorkerOpaque)\n return kOpaqueResource;\n return kSharableCrossOrigin;\n }\n \n if (security_origin && PassesAccessControlCheck(*security_origin))\n return kSharableCrossOrigin;\n \n return kNotSharableCrossOrigin;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#19190765882e272a6a2162c89acdb29110f7e3cf", + "input": "void ExpectTimeValue(const base::Time& expected_value,\n const DictionaryValue& value, const std::string& key) {\n std::string time_str;\n EXPECT_TRUE(value.GetString(key, &time_str));\n EXPECT_EQ(browser_sync::GetTimeDebugString(expected_value), time_str);\n}\n", + "target": "void ExpectTimeValue(const base::Time& expected_value,\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ab676b7d6fbf4b294bf198fb27ade5b0e865c7ce", + "input": " static int pagemap_open(struct inode *inode, struct file *file)\n {\n \tpr_warn_once(\"Bits 55-60 of /proc/PID/pagemap entries are about \"\n \t\t\t\"to stop being page-shift some time soon. See the \"\n \t\t\t\"linux/Documentation/vm/pagemap.txt for details.\\n\");\n\treturn 0;\n}\n", + "target": " static int pagemap_open(struct inode *inode, struct file *file)\n {\n\t/* do not disclose physical addresses: attack vector */\n\tif (!capable(CAP_SYS_ADMIN))\n\t\treturn -EPERM;\n \tpr_warn_once(\"Bits 55-60 of /proc/PID/pagemap entries are about \"\n \t\t\t\"to stop being page-shift some time soon. See the \"\n \t\t\t\"linux/Documentation/vm/pagemap.txt for details.\\n\");\n\treturn 0;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc0b027dfadfcb8a5504f7d8052754bf8d501ab9", + "input": "nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,\n int flags, struct nameidata *nd)\n{\n\tstruct path path = {\n\t\t.mnt = nd->path.mnt,\n\t\t.dentry = dentry,\n \t};\n \tstruct nfs4_state *state;\n \tstruct rpc_cred *cred;\n \tint status = 0;\n \n \tcred = rpc_lookup_cred();\n \tif (IS_ERR(cred)) {\n \t\tstatus = PTR_ERR(cred);\n \t\tgoto out;\n \t}\n\tstate = nfs4_do_open(dir, &path, flags, sattr, cred);\n \td_drop(dentry);\n \tif (IS_ERR(state)) {\n \t\tstatus = PTR_ERR(state);\n\t\tgoto out_putcred;\n\t}\n\td_add(dentry, igrab(state->inode));\n\tnfs_set_verifier(dentry, nfs_save_change_attribute(dir));\n\tif (flags & O_EXCL) {\n\t\tstruct nfs_fattr fattr;\n\t\tstatus = nfs4_do_setattr(state->inode, cred, &fattr, sattr, state);\n\t\tif (status == 0)\n\t\t\tnfs_setattr_update_inode(state->inode, sattr);\n \t\tnfs_post_op_update_inode(state->inode, &fattr);\n \t}\n \tif (status == 0 && (nd->flags & LOOKUP_OPEN) != 0)\n\t\tstatus = nfs4_intent_set_file(nd, &path, state);\n \telse\n\t\tnfs4_close_sync(&path, state, flags);\n out_putcred:\n \tput_rpccred(cred);\n out:\n\treturn status;\n}\n", + "target": "nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,\n int flags, struct nameidata *nd)\n{\n\tstruct path path = {\n\t\t.mnt = nd->path.mnt,\n\t\t.dentry = dentry,\n \t};\n \tstruct nfs4_state *state;\n \tstruct rpc_cred *cred;\n\tfmode_t fmode = flags & (FMODE_READ | FMODE_WRITE);\n \tint status = 0;\n \n \tcred = rpc_lookup_cred();\n \tif (IS_ERR(cred)) {\n \t\tstatus = PTR_ERR(cred);\n \t\tgoto out;\n \t}\n\tstate = nfs4_do_open(dir, &path, fmode, flags, sattr, cred);\n \td_drop(dentry);\n \tif (IS_ERR(state)) {\n \t\tstatus = PTR_ERR(state);\n\t\tgoto out_putcred;\n\t}\n\td_add(dentry, igrab(state->inode));\n\tnfs_set_verifier(dentry, nfs_save_change_attribute(dir));\n\tif (flags & O_EXCL) {\n\t\tstruct nfs_fattr fattr;\n\t\tstatus = nfs4_do_setattr(state->inode, cred, &fattr, sattr, state);\n\t\tif (status == 0)\n\t\t\tnfs_setattr_update_inode(state->inode, sattr);\n \t\tnfs_post_op_update_inode(state->inode, &fattr);\n \t}\n \tif (status == 0 && (nd->flags & LOOKUP_OPEN) != 0)\n\t\tstatus = nfs4_intent_set_file(nd, &path, state, fmode);\n \telse\n\t\tnfs4_close_sync(&path, state, fmode);\n out_putcred:\n \tput_rpccred(cred);\n out:\n\treturn status;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b469da1430cdcee06e31c6251b83aede072a1ff0", + "input": "char **XListExtensions(\n register Display *dpy,\n int *nextensions)\t/* RETURN */\n{\n\txListExtensionsReply rep;\n\tchar **list = NULL;\n\tchar *ch = NULL;\n\tchar *chend;\n\tint count = 0;\n\tregister unsigned i;\n\tregister int length;\n\t_X_UNUSED register xReq *req;\n\tunsigned long rlen = 0;\n\n\tLockDisplay(dpy);\n\tGetEmptyReq (ListExtensions, req);\n\n\tif (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) {\n\t UnlockDisplay(dpy);\n\t SyncHandle();\n\t return (char **) NULL;\n\t}\n\n\tif (rep.nExtensions) {\n\t list = Xmalloc (rep.nExtensions * sizeof (char *));\n\t if (rep.length > 0 && rep.length < (INT_MAX >> 2)) {\n\t\trlen = rep.length << 2;\n\t\tch = Xmalloc (rlen + 1);\n /* +1 to leave room for last null-terminator */\n\t }\n\n\t if ((!list) || (!ch)) {\n\t\tXfree(list);\n\t\tXfree(ch);\n\t\t_XEatDataWords(dpy, rep.length);\n\t\tUnlockDisplay(dpy);\n\t\tSyncHandle();\n\t\treturn (char **) NULL;\n\t }\n\n\t _XReadPad (dpy, ch, rlen);\n \t /*\n \t * unpack into null terminated strings.\n \t */\n\t chend = ch + (rlen + 1);\n \t length = *ch;\n \t for (i = 0; i < rep.nExtensions; i++) {\n \t\tif (ch + length < chend) {\n \t\t list[i] = ch+1; /* skip over length */\n \t\t ch += length + 1; /* find next length ... */\n\t\t if (ch <= chend) {\n\t\t\tlength = *ch;\n\t\t\t*ch = '\\0'; /* and replace with null-termination */\n\t\t\tcount++;\n\t\t } else {\n\t\t\tlist[i] = NULL;\n\t\t }\n \t\t} else\n \t\t list[i] = NULL;\n \t }\n\t\t }\n\t\t} else\n", + "target": "char **XListExtensions(\n register Display *dpy,\n int *nextensions)\t/* RETURN */\n{\n\txListExtensionsReply rep;\n\tchar **list = NULL;\n\tchar *ch = NULL;\n\tchar *chend;\n\tint count = 0;\n\tregister unsigned i;\n\tregister int length;\n\t_X_UNUSED register xReq *req;\n\tunsigned long rlen = 0;\n\n\tLockDisplay(dpy);\n\tGetEmptyReq (ListExtensions, req);\n\n\tif (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) {\n\t UnlockDisplay(dpy);\n\t SyncHandle();\n\t return (char **) NULL;\n\t}\n\n\tif (rep.nExtensions) {\n\t list = Xmalloc (rep.nExtensions * sizeof (char *));\n\t if (rep.length > 0 && rep.length < (INT_MAX >> 2)) {\n\t\trlen = rep.length << 2;\n\t\tch = Xmalloc (rlen + 1);\n /* +1 to leave room for last null-terminator */\n\t }\n\n\t if ((!list) || (!ch)) {\n\t\tXfree(list);\n\t\tXfree(ch);\n\t\t_XEatDataWords(dpy, rep.length);\n\t\tUnlockDisplay(dpy);\n\t\tSyncHandle();\n\t\treturn (char **) NULL;\n\t }\n\n\t _XReadPad (dpy, ch, rlen);\n \t /*\n \t * unpack into null terminated strings.\n \t */\n\t chend = ch + rlen;\n \t length = *ch;\n \t for (i = 0; i < rep.nExtensions; i++) {\n \t\tif (ch + length < chend) {\n \t\t list[i] = ch+1; /* skip over length */\n \t\t ch += length + 1; /* find next length ... */\n\t\t length = *ch;\n\t\t *ch = '\\0'; /* and replace with null-termination */\n\t\t count++;\n \t\t} else\n \t\t list[i] = NULL;\n \t }\n\t\t }\n\t\t} else\n", + "vul_type": "cwe-682", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dff368031150a1033a1a3c913f8857679a0279be", + "input": "void HTMLScriptRunner::runScript(Element* script, const TextPosition& scriptStartPosition)\n{\n ASSERT(m_document);\n ASSERT(!hasParserBlockingScript());\n {\n ScriptLoader* scriptLoader = toScriptLoaderIfPossible(script);\n\n ASSERT(scriptLoader);\n if (!scriptLoader)\n return;\n\n ASSERT(scriptLoader->isParserInserted());\n \n if (!isExecutingScript())\n Microtask::performCheckpoint();\n \n InsertionPointRecord insertionPointRecord(m_host->inputStream());\n NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);\n\n scriptLoader->prepareScript(scriptStartPosition);\n\n if (!scriptLoader->willBeParserExecuted())\n return;\n\n if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) {\n requestDeferredScript(script);\n } else if (scriptLoader->readyToBeParserExecuted()) {\n if (m_scriptNestingLevel == 1) {\n m_parserBlockingScript.setElement(script);\n m_parserBlockingScript.setStartingPosition(scriptStartPosition);\n } else {\n ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), scriptStartPosition);\n scriptLoader->executeScript(sourceCode);\n }\n } else {\n requestParsingBlockingScript(script);\n }\n }\n}\n", + "target": "void HTMLScriptRunner::runScript(Element* script, const TextPosition& scriptStartPosition)\n{\n ASSERT(m_document);\n ASSERT(!hasParserBlockingScript());\n {\n ScriptLoader* scriptLoader = toScriptLoaderIfPossible(script);\n\n ASSERT(scriptLoader);\n if (!scriptLoader)\n return;\n\n ASSERT(scriptLoader->isParserInserted());\n \n if (!isExecutingScript())\n Microtask::performCheckpoint(V8PerIsolateData::mainThreadIsolate());\n \n InsertionPointRecord insertionPointRecord(m_host->inputStream());\n NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);\n\n scriptLoader->prepareScript(scriptStartPosition);\n\n if (!scriptLoader->willBeParserExecuted())\n return;\n\n if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) {\n requestDeferredScript(script);\n } else if (scriptLoader->readyToBeParserExecuted()) {\n if (m_scriptNestingLevel == 1) {\n m_parserBlockingScript.setElement(script);\n m_parserBlockingScript.setStartingPosition(scriptStartPosition);\n } else {\n ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), scriptStartPosition);\n scriptLoader->executeScript(sourceCode);\n }\n } else {\n requestParsingBlockingScript(script);\n }\n }\n}\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a44b00c88bc5ea35b5b150217c5fd6e4ce168e58", + "input": " xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {\n if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);\n if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||\n\t(ctxt->context->node->type == XML_NAMESPACE_DECL))\n\treturn(NULL);\n if (cur != NULL) {\n if ((cur->type == XML_ATTRIBUTE_NODE) ||\n (cur->type == XML_NAMESPACE_DECL))\n return(NULL);\n if (cur->children != NULL)\n return cur->children ;\n }\n if (cur == NULL) cur = ctxt->context->node;\n if (cur == NULL) return(NULL) ; /* ERROR */\n if (cur->next != NULL) return(cur->next) ;\n do {\n cur = cur->parent;\n if (cur == NULL) break;\n if (cur == (xmlNodePtr) ctxt->context->doc) return(NULL);\n if (cur->next != NULL) return(cur->next);\n } while (cur != NULL);\n return(cur);\n}\n", + "target": " xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {\n if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);\n if ((cur != NULL) && (cur->type != XML_ATTRIBUTE_NODE) &&\n (cur->type != XML_NAMESPACE_DECL) && (cur->children != NULL))\n return(cur->children);\n\n if (cur == NULL) {\n cur = ctxt->context->node;\n if (cur->type == XML_NAMESPACE_DECL)\n return(NULL);\n if (cur->type == XML_ATTRIBUTE_NODE)\n cur = cur->parent;\n }\n if (cur == NULL) return(NULL) ; /* ERROR */\n if (cur->next != NULL) return(cur->next) ;\n do {\n cur = cur->parent;\n if (cur == NULL) break;\n if (cur == (xmlNodePtr) ctxt->context->doc) return(NULL);\n if (cur->next != NULL) return(cur->next);\n } while (cur != NULL);\n return(cur);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ee8d6fd30b022ac2c87b7a190c954e7bb3c9b21e", + "input": "void RenderWidget::didInvalidateRect(const WebRect& rect) {\n bool update_pending = paint_aggregator_.HasPendingUpdate();\n \n gfx::Rect view_rect(0, 0, size_.width(), size_.height());\n gfx::Rect damaged_rect = view_rect.Intersect(rect);\n if (damaged_rect.IsEmpty())\n return;\n\n paint_aggregator_.InvalidateRect(damaged_rect);\n\n if (update_pending)\n return;\n if (!paint_aggregator_.HasPendingUpdate())\n return;\n if (update_reply_pending())\n return;\n\n MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(\n this, &RenderWidget::CallDoDeferredUpdate));\n}\n", + "target": "void RenderWidget::didInvalidateRect(const WebRect& rect) {\n bool update_pending = paint_aggregator_.HasPendingUpdate();\n \n gfx::Rect view_rect(size_);\n gfx::Rect damaged_rect = view_rect.Intersect(rect);\n if (damaged_rect.IsEmpty())\n return;\n\n paint_aggregator_.InvalidateRect(damaged_rect);\n\n if (update_pending)\n return;\n if (!paint_aggregator_.HasPendingUpdate())\n return;\n if (update_reply_pending())\n return;\n\n MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(\n this, &RenderWidget::CallDoDeferredUpdate));\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " virtual void SetUp() {\n vp9_worker_init(&worker_);\n }\n", + "target": " virtual void SetUp() {\n vpx_get_worker_interface()->init(&worker_);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {\n #if WRITE_COMPRESSED_STREAM\n ++out_frames_;\n \n if (pkt->data.frame.pts == 0)\n write_ivf_file_header(&cfg_, 0, outfile_);\n\n\n write_ivf_frame_header(pkt, outfile_);\n (void)fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_);\n#endif\n }\n", + "target": " virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {\n #if WRITE_COMPRESSED_STREAM\n virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {\n ++out_frames_;\n \n if (pkt->data.frame.pts == 0)\n write_ivf_file_header(&cfg_, 0, outfile_);\n\n\n write_ivf_frame_header(pkt, outfile_);\n (void)fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile_);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1c40f9042ae2d6ee7483d72998aabb5e73b2ff60", + "input": "bool ResourceFetcher::StartLoad(Resource* resource) {\n DCHECK(resource);\n DCHECK(resource->StillNeedsLoad());\n\n ResourceRequest request(resource->GetResourceRequest());\n ResourceLoader* loader = nullptr;\n\n {\n Resource::RevalidationStartForbiddenScope\n revalidation_start_forbidden_scope(resource);\n ScriptForbiddenIfMainThreadScope script_forbidden_scope;\n\n if (!Context().ShouldLoadNewResource(resource->GetType()) &&\n IsMainThread()) {\n GetMemoryCache()->Remove(resource);\n return false;\n }\n\n ResourceResponse response;\n\n blink::probe::PlatformSendRequest probe(&Context(), resource->Identifier(),\n request, response,\n resource->Options().initiator_info);\n \n Context().DispatchWillSendRequest(resource->Identifier(), request, response,\n resource->Options().initiator_info);\n \n SecurityOrigin* source_origin = Context().GetSecurityOrigin();\n if (source_origin && source_origin->HasSuborigin())\n request.SetServiceWorkerMode(WebURLRequest::ServiceWorkerMode::kNone);\n\n resource->SetResourceRequest(request);\n\n loader = ResourceLoader::Create(this, scheduler_, resource);\n if (resource->ShouldBlockLoadEvent())\n loaders_.insert(loader);\n else\n non_blocking_loaders_.insert(loader);\n\n StorePerformanceTimingInitiatorInformation(resource);\n resource->SetFetcherSecurityOrigin(source_origin);\n\n Resource::ProhibitAddRemoveClientInScope\n prohibit_add_remove_client_in_scope(resource);\n\n resource->NotifyStartLoad();\n }\n\n loader->Start();\n return true;\n}\n", + "target": "bool ResourceFetcher::StartLoad(Resource* resource) {\n DCHECK(resource);\n DCHECK(resource->StillNeedsLoad());\n\n ResourceRequest request(resource->GetResourceRequest());\n ResourceLoader* loader = nullptr;\n\n {\n Resource::RevalidationStartForbiddenScope\n revalidation_start_forbidden_scope(resource);\n ScriptForbiddenIfMainThreadScope script_forbidden_scope;\n\n if (!Context().ShouldLoadNewResource(resource->GetType()) &&\n IsMainThread()) {\n GetMemoryCache()->Remove(resource);\n return false;\n }\n\n ResourceResponse response;\n\n blink::probe::PlatformSendRequest probe(&Context(), resource->Identifier(),\n request, response,\n resource->Options().initiator_info);\n \n Context().DispatchWillSendRequest(resource->Identifier(), request, response,\n resource->GetType(),\n resource->Options().initiator_info);\n \n SecurityOrigin* source_origin = Context().GetSecurityOrigin();\n if (source_origin && source_origin->HasSuborigin())\n request.SetServiceWorkerMode(WebURLRequest::ServiceWorkerMode::kNone);\n\n resource->SetResourceRequest(request);\n\n loader = ResourceLoader::Create(this, scheduler_, resource);\n if (resource->ShouldBlockLoadEvent())\n loaders_.insert(loader);\n else\n non_blocking_loaders_.insert(loader);\n\n StorePerformanceTimingInitiatorInformation(resource);\n resource->SetFetcherSecurityOrigin(source_origin);\n\n Resource::ProhibitAddRemoveClientInScope\n prohibit_add_remove_client_in_scope(resource);\n\n resource->NotifyStartLoad();\n }\n\n loader->Start();\n return true;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9c2cd3c93c05d009a91d84eedbb85873b0cb505d", + "input": " rs_filter_graph(RSFilter *filter)\n {\n \tg_return_if_fail(RS_IS_FILTER(filter));\n \tGString *str = g_string_new(\"digraph G {\\n\");\n \n \trs_filter_graph_helper(str, filter);\n \n \tg_string_append_printf(str, \"}\\n\");\n\tg_file_set_contents(\"/tmp/rs-filter-graph\", str->str, str->len, NULL);\n \n\tif (0 != system(\"dot -Tpng >/tmp/rs-filter-graph.png str, str->len, NULL);\n\n\tcommand_line = g_strdup_printf(\"dot -Tpng >%s <%s\", png_filename, dot_filename);\n\tif (0 != system(command_line))\n \t\tg_warning(\"Calling dot failed\");\n\tg_free(command_line);\n\n\tcommand_line = g_strdup_printf(\"gnome-open %s\", png_filename);\n\tif (0 != system(command_line))\n \t\tg_warning(\"Calling gnome-open failed.\");\n\tg_free(command_line);\n \n\tg_free(dot_filename);\n\tg_free(png_filename);\n \tg_string_free(str, TRUE);\n }\n", + "vul_type": "cwe-59", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ea3d1d84be3d6f97bf50e76511c9e26af6895533", + "input": " void WebPluginDelegateProxy::DidFinishLoadWithReason(\n const GURL& url, NPReason reason, intptr_t notify_data) {\n Send(new PluginMsg_DidFinishLoadWithReason(\n instance_id_, url, reason, notify_data));\n }\n", + "target": " void WebPluginDelegateProxy::DidFinishLoadWithReason(\n const GURL& url, NPReason reason, int notify_id) {\n Send(new PluginMsg_DidFinishLoadWithReason(\n instance_id_, url, reason, notify_id));\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b944f670bb7a8a919daac497a4ea0536c954c201", + "input": "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert2(ExecState* exec)\n{\n JSValue thisValue = exec->hostThisValue();\n if (!thisValue.inherits(&JSTestObj::s_info))\n return throwVMTypeError(exec);\n JSTestObj* castedThis = jsCast(asObject(thisValue));\n ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);\n TestObj* impl = static_cast(castedThis->impl());\n if (exec->argumentCount() < 1)\n return throwVMError(exec, createTypeError(exec, \"Not enough arguments\"));\n b* (tob(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n impl->convert2();\n return JSValue::encode(jsUndefined());\n}\n", + "target": "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert2(ExecState* exec)\n{\n JSValue thisValue = exec->hostThisValue();\n if (!thisValue.inherits(&JSTestObj::s_info))\n return throwVMTypeError(exec);\n JSTestObj* castedThis = jsCast(asObject(thisValue));\n ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);\n TestObj* impl = static_cast(castedThis->impl());\n if (exec->argumentCount() < 1)\n return throwVMError(exec, createNotEnoughArgumentsError(exec));\n b* (tob(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n impl->convert2();\n return JSValue::encode(jsUndefined());\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#665baf5ed5c6186d973c46cdea165c0548027350", + "input": "entry_guard_obeys_restriction(const entry_guard_t *guard,\n const entry_guard_restriction_t *rst)\n{\n tor_assert(guard);\n if (! rst)\n return 1; // No restriction? No problem.\n \n return tor_memneq(guard->identity, rst->exclude_id, DIGEST_LEN);\n }\n", + "target": "entry_guard_obeys_restriction(const entry_guard_t *guard,\n const entry_guard_restriction_t *rst)\n{\n tor_assert(guard);\n if (! rst)\n return 1; // No restriction? No problem.\n \n // Only one kind of restriction exists right now: excluding an exit\n // ID and all of its family.\n const node_t *node = node_get_by_id((const char*)rst->exclude_id);\n if (node && guard_in_node_family(guard, node))\n return 0;\n\n return tor_memneq(guard->identity, rst->exclude_id, DIGEST_LEN);\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b15c87071f906301bccc824ce013966ca93998c7", + "input": " void WtsSessionProcessDelegate::Core::KillProcess(DWORD exit_code) {\n DCHECK(main_task_runner_->BelongsToCurrentThread());\n \n channel_.reset();\n \n if (launch_elevated_) {\n if (job_.IsValid()) {\n TerminateJobObject(job_, exit_code);\n }\n } else {\n if (worker_process_.IsValid()) {\n TerminateProcess(worker_process_, exit_code);\n }\n }\n}\n", + "target": " void WtsSessionProcessDelegate::Core::KillProcess(DWORD exit_code) {\n DCHECK(main_task_runner_->BelongsToCurrentThread());\n \n channel_.reset();\n pipe_.Close();\n \n if (launch_elevated_) {\n if (job_.IsValid()) {\n TerminateJobObject(job_, exit_code);\n }\n } else {\n if (worker_process_.IsValid()) {\n TerminateProcess(worker_process_, exit_code);\n }\n }\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#341f12cd5b97ab419e53853ca00176457c9f1681", + "input": "uint32_t GetPayloadTime(size_t handle, uint32_t index, float *in, float *out)\n {\n \tmp4object *mp4 = (mp4object *)handle;\n\tif (mp4 == NULL) return 0;\n \n\tif (mp4->metaoffsets == 0 || mp4->basemetadataduration == 0 || mp4->meta_clockdemon == 0 || in == NULL || out == NULL) return 1;\n \n\t*in = (float)((double)index * (double)mp4->basemetadataduration / (double)mp4->meta_clockdemon);\n\t*out = (float)((double)(index + 1) * (double)mp4->basemetadataduration / (double)mp4->meta_clockdemon);\n\treturn 0;\n }\n", + "target": "uint32_t GetPayloadTime(size_t handle, uint32_t index, float *in, float *out)\nuint32_t GetPayloadTime(size_t handle, uint32_t index, double *in, double *out)\n {\n \tmp4object *mp4 = (mp4object *)handle;\n\tif (mp4 == NULL) return GPMF_ERROR_MEMORY;\n \n\tif (mp4->metaoffsets == 0 || mp4->basemetadataduration == 0 || mp4->meta_clockdemon == 0 || in == NULL || out == NULL) return GPMF_ERROR_MEMORY;\n \n\t*in = ((double)index * (double)mp4->basemetadataduration / (double)mp4->meta_clockdemon);\n\t*out = ((double)(index + 1) * (double)mp4->basemetadataduration / (double)mp4->meta_clockdemon);\n\treturn GPMF_OK;\n }\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#53262b5285efbbfdbbcc17fbf5200890f1ee295c", + "input": " void HistogramsCallback() {\n MockHistogramsCallback();\n QuitMessageLoop();\n }\n", + "target": " void HistogramsCallback() {\n void HistogramsCallback(base::RepeatingClosure on_done) {\n MockHistogramsCallback();\n on_done.Run();\n }\n", + "vul_type": "cwe-94", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c2ccf4197f697c4ff143b8a786acdd875e70a89d", + "input": "setup_server_realm(krb5_principal sprinc)\n{\n krb5_error_code kret;\n kdc_realm_t *newrealm;\n \n kret = 0;\n if (kdc_numrealms > 1) {\n if (!(newrealm = find_realm_data(sprinc->realm.data,\n (krb5_ui_4) sprinc->realm.length)))\n kret = ENOENT;\n else\n kdc_active_realm = newrealm;\n }\n else\n kdc_active_realm = kdc_realmlist[0];\n return(kret);\n}\n", + "target": "setup_server_realm(krb5_principal sprinc)\n{\n krb5_error_code kret;\n kdc_realm_t *newrealm;\n \n kret = 0;\n if (sprinc == NULL)\n return NULL;\n\n if (kdc_numrealms > 1) {\n if (!(newrealm = find_realm_data(sprinc->realm.data,\n (krb5_ui_4) sprinc->realm.length)))\n kret = ENOENT;\n else\n kdc_active_realm = newrealm;\n }\n else\n kdc_active_realm = kdc_realmlist[0];\n return(kret);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#8-f66442e7331e", + "input": "def reportMatch(winner, loser):\n \"\"\"Records the outcome of a single match between two players.\n\n Args:\n winner: the id number of the player who won\n loser: the id number of the player who lost\n \"\"\"\n conn = connect()\n cursor = conn.cursor()\n cursor.execute(\"INSERT INTO playsRecord (winner, loser) VALUES ('%s', '%s')\" % (winner, loser));\n conn.commit()\n conn.close()", + "target": "def reportMatch(winner, loser):\n \"\"\"Records the outcome of a single match between two players.\n\n Args:\n winner: the id number of the player who won\n loser: the id number of the player who lost\n \"\"\"\n conn = connect()\n cursor = conn.cursor()\n query = \"INSERT INTO playsRecord (winner, loser) VALUES (%s, %s);\"\n cursor.execute(query, (winner, loser));\n conn.commit()\n conn.close()", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#dc7b094a338c6c521f918f478e993f0f74bbea0d", + "input": " static void UpdatePropertyHandler(\n void* object, const ImePropertyList& prop_list) {\n if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {\n LOG(ERROR) << \"Not on UI thread\";\n return;\n }\n \n InputMethodLibraryImpl* input_method_library =\n static_cast(object);\n input_method_library->UpdateProperty(prop_list);\n }\n", + "target": " static void UpdatePropertyHandler(\n // IBusController override.\n virtual void OnUpdateImeProperty(\n const input_method::ImePropertyList& prop_list) {\n if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {\n LOG(ERROR) << \"Not on UI thread\";\n return;\n }\n \n UpdateProperty(prop_list);\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6f442be2fb22be02cafa606f1769fa1e6f894441", + "input": "dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code)\n{\n\tenum ctx_state prev_state;\n\tprev_state = exception_enter();\n\tif (notify_die(DIE_TRAP, \"stack segment\", regs, error_code,\n\t\t X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) {\n\t\tpreempt_conditional_sti(regs);\n\t\tdo_trap(X86_TRAP_SS, SIGBUS, \"stack segment\", regs, error_code, NULL);\n\t\tpreempt_conditional_cli(regs);\n\t}\n\texception_exit(prev_state);\n}\n", + "target": "dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code)\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "image_transform_png_set_scale_16_mod(PNG_CONST image_transform *this,\n image_pixel *that, png_const_structp pp,\n PNG_CONST transform_display *display)\n {\n if (that->bit_depth == 16)\n {\n that->sample_depth = that->bit_depth = 8;\n if (that->red_sBIT > 8) that->red_sBIT = 8;\n if (that->green_sBIT > 8) that->green_sBIT = 8;\n if (that->blue_sBIT > 8) that->blue_sBIT = 8;\n if (that->alpha_sBIT > 8) that->alpha_sBIT = 8;\n }\n\n this->next->mod(this->next, that, pp, display);\n}\n", + "target": "image_transform_png_set_scale_16_mod(PNG_CONST image_transform *this,\nimage_transform_png_set_scale_16_mod(const image_transform *this,\n image_pixel *that, png_const_structp pp,\n const transform_display *display)\n {\n if (that->bit_depth == 16)\n {\n that->sample_depth = that->bit_depth = 8;\n if (that->red_sBIT > 8) that->red_sBIT = 8;\n if (that->green_sBIT > 8) that->green_sBIT = 8;\n if (that->blue_sBIT > 8) that->blue_sBIT = 8;\n if (that->alpha_sBIT > 8) that->alpha_sBIT = 8;\n }\n\n this->next->mod(this->next, that, pp, display);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1e38da300e1e395a15048b0af1e5305bd91402f6", + "input": " static void timerfd_setup_cancel(struct timerfd_ctx *ctx, int flags)\n {\n \tif ((ctx->clockid == CLOCK_REALTIME ||\n \t ctx->clockid == CLOCK_REALTIME_ALARM) &&\n \t (flags & TFD_TIMER_ABSTIME) && (flags & TFD_TIMER_CANCEL_ON_SET)) {\n\t\tif (!ctx->might_cancel) {\n\t\t\tctx->might_cancel = true;\n\t\t\tspin_lock(&cancel_lock);\n \t\t\tlist_add_rcu(&ctx->clist, &cancel_list);\n \t\t\tspin_unlock(&cancel_lock);\n \t\t}\n\t} else if (ctx->might_cancel) {\n\t\ttimerfd_remove_cancel(ctx);\n \t}\n }\n", + "target": " static void timerfd_setup_cancel(struct timerfd_ctx *ctx, int flags)\n {\n\tspin_lock(&ctx->cancel_lock);\n \tif ((ctx->clockid == CLOCK_REALTIME ||\n \t ctx->clockid == CLOCK_REALTIME_ALARM) &&\n \t (flags & TFD_TIMER_ABSTIME) && (flags & TFD_TIMER_CANCEL_ON_SET)) {\n\t\tif (!ctx->might_cancel) {\n\t\t\tctx->might_cancel = true;\n\t\t\tspin_lock(&cancel_lock);\n \t\t\tlist_add_rcu(&ctx->clist, &cancel_list);\n \t\t\tspin_unlock(&cancel_lock);\n \t\t}\n\t} else {\n\t\t__timerfd_remove_cancel(ctx);\n \t}\n\tspin_unlock(&ctx->cancel_lock);\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d27468a832d5316884bd02f459cbf493697fd7e1", + "input": "AccessibilityOrientation AXNodeObject::orientation() const {\n const AtomicString& ariaOrientation =\n getAOMPropertyOrARIAAttribute(AOMStringProperty::kOrientation);\n AccessibilityOrientation orientation = AccessibilityOrientationUndefined;\n if (equalIgnoringCase(ariaOrientation, \"horizontal\"))\n orientation = AccessibilityOrientationHorizontal;\n else if (equalIgnoringCase(ariaOrientation, \"vertical\"))\n orientation = AccessibilityOrientationVertical;\n \n switch (roleValue()) {\n case ComboBoxRole:\n case ListBoxRole:\n case MenuRole:\n case ScrollBarRole:\n case TreeRole:\n if (orientation == AccessibilityOrientationUndefined)\n orientation = AccessibilityOrientationVertical;\n\n return orientation;\n case MenuBarRole:\n case SliderRole:\n case SplitterRole:\n case TabListRole:\n case ToolbarRole:\n if (orientation == AccessibilityOrientationUndefined)\n orientation = AccessibilityOrientationHorizontal;\n\n return orientation;\n case RadioGroupRole:\n case TreeGridRole:\n case TableRole:\n return orientation;\n default:\n return AXObject::orientation();\n }\n}\n", + "target": "AccessibilityOrientation AXNodeObject::orientation() const {\n const AtomicString& ariaOrientation =\n getAOMPropertyOrARIAAttribute(AOMStringProperty::kOrientation);\n AccessibilityOrientation orientation = AccessibilityOrientationUndefined;\n if (equalIgnoringASCIICase(ariaOrientation, \"horizontal\"))\n orientation = AccessibilityOrientationHorizontal;\n else if (equalIgnoringASCIICase(ariaOrientation, \"vertical\"))\n orientation = AccessibilityOrientationVertical;\n \n switch (roleValue()) {\n case ComboBoxRole:\n case ListBoxRole:\n case MenuRole:\n case ScrollBarRole:\n case TreeRole:\n if (orientation == AccessibilityOrientationUndefined)\n orientation = AccessibilityOrientationVertical;\n\n return orientation;\n case MenuBarRole:\n case SliderRole:\n case SplitterRole:\n case TabListRole:\n case ToolbarRole:\n if (orientation == AccessibilityOrientationUndefined)\n orientation = AccessibilityOrientationHorizontal;\n\n return orientation;\n case RadioGroupRole:\n case TreeGridRole:\n case TableRole:\n return orientation;\n default:\n return AXObject::orientation();\n }\n}\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1777aa6484af15014b8691082a8c3075418786f5", + "input": " void LayerTreeHostQt::setRootCompositingLayer(WebCore::GraphicsLayer* graphicsLayer)\n {\n m_nonCompositedContentLayer->removeAllChildren();\n \n if (graphicsLayer)\n m_nonCompositedContentLayer->addChild(graphicsLayer);\n}\n", + "target": " void LayerTreeHostQt::setRootCompositingLayer(WebCore::GraphicsLayer* graphicsLayer)\n {\n m_nonCompositedContentLayer->removeAllChildren();\n m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());\n \n if (graphicsLayer)\n m_nonCompositedContentLayer->addChild(graphicsLayer);\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#df831400bcb63db4259b5858281b1727ba972a2a", + "input": " bool WebPageProxy::gestureWillBegin(const IntPoint& point)\n {\n bool canBeginPanning;\n process()->sendSync(Messages::WebPage::GestureWillBegin(point), Messages::WebPage::GestureWillBegin::Reply(canBeginPanning), m_pageID);\n return canBeginPanning;\n }\n", + "target": " bool WebPageProxy::gestureWillBegin(const IntPoint& point)\n {\n bool canBeginPanning = false;\n process()->sendSync(Messages::WebPage::GestureWillBegin(point), Messages::WebPage::GestureWillBegin::Reply(canBeginPanning), m_pageID);\n return canBeginPanning;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8a50f99c25fb70ff43aaa82b6f9569db383f0ca8", + "input": " void InvalidationNotifier::UpdateRegisteredIds(SyncNotifierObserver* handler,\n const ObjectIdSet& ids) {\n DCHECK(CalledOnValidThread());\n invalidation_client_.RegisterIds(helper_.UpdateRegisteredIds(handler, ids));\n }\n", + "target": " void InvalidationNotifier::UpdateRegisteredIds(SyncNotifierObserver* handler,\n const ObjectIdSet& ids) {\n DCHECK(CalledOnValidThread());\n const ObjectIdSet& all_registered_ids =\n helper_.UpdateRegisteredIds(handler, ids);\n invalidation_client_.UpdateRegisteredIds(all_registered_ids);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2ee663f39dc8dac3d9988e847db19b2d7e3ac8c6", + "input": "void ntlm_free_message_fields_buffer(NTLM_MESSAGE_FIELDS* fields)\n {\n \tif (fields)\n \t{\n\t\tif (fields->Buffer)\n\t\t{\n\t\t\tfree(fields->Buffer);\n\t\t\tfields->Len = 0;\n\t\t\tfields->MaxLen = 0;\n\t\t\tfields->Buffer = NULL;\n\t\t\tfields->BufferOffset = 0;\n\t\t}\n \t}\n }\n", + "target": "void ntlm_free_message_fields_buffer(NTLM_MESSAGE_FIELDS* fields)\nstatic void ntlm_free_message_fields_buffer(NTLM_MESSAGE_FIELDS* fields)\n {\n \tif (fields)\n \t{\n\t\tif (fields->Buffer)\n\t\t{\n\t\t\tfree(fields->Buffer);\n\t\t\tfields->Len = 0;\n\t\t\tfields->MaxLen = 0;\n\t\t\tfields->Buffer = NULL;\n\t\t\tfields->BufferOffset = 0;\n\t\t}\n \t}\n }\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#45d901b56f578a74b19ba0d10fa5c4c467f19303", + "input": "void GM2TabStyle::PaintTab(gfx::Canvas* canvas, const SkPath& clip) const {\n int active_tab_fill_id = 0;\n int active_tab_y_inset = 0;\n if (tab_->GetThemeProvider()->HasCustomImage(IDR_THEME_TOOLBAR)) {\n active_tab_fill_id = IDR_THEME_TOOLBAR;\n active_tab_y_inset = GetStrokeThickness(true);\n }\n \n if (tab_->IsActive()) {\n PaintTabBackground(canvas, true /* active */, active_tab_fill_id,\n active_tab_y_inset, nullptr /* clip */);\n } else {\n PaintInactiveTabBackground(canvas, clip);\n\n const float throb_value = GetThrobValue();\n if (throb_value > 0) {\n canvas->SaveLayerAlpha(gfx::ToRoundedInt(throb_value * 0xff),\n tab_->GetLocalBounds());\n PaintTabBackground(canvas, true /* active */, active_tab_fill_id,\n active_tab_y_inset, nullptr /* clip */);\n canvas->Restore();\n }\n }\n}\n", + "target": "void GM2TabStyle::PaintTab(gfx::Canvas* canvas, const SkPath& clip) const {\n int active_tab_fill_id = 0;\n int active_tab_y_inset = 0;\n if (tab_->GetThemeProvider()->HasCustomImage(IDR_THEME_TOOLBAR)) {\n active_tab_fill_id = IDR_THEME_TOOLBAR;\n active_tab_y_inset = GetStrokeThickness(true);\n }\n \n if (tab_->IsActive()) {\n PaintTabBackground(canvas, TAB_ACTIVE, active_tab_fill_id,\n active_tab_y_inset, nullptr /* clip */);\n } else {\n PaintInactiveTabBackground(canvas, clip);\n\n const float throb_value = GetThrobValue();\n if (throb_value > 0) {\n canvas->SaveLayerAlpha(gfx::ToRoundedInt(throb_value * 0xff),\n tab_->GetLocalBounds());\n PaintTabBackground(canvas, TAB_ACTIVE, active_tab_fill_id,\n active_tab_y_inset, nullptr /* clip */);\n canvas->Restore();\n }\n }\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#723416fa4210b7464b28eab89cc76252e6193ac1", + "input": "USHORT CNB::QueryL4HeaderOffset(PVOID PacketData, ULONG IpHeaderOffset) const\n {\n USHORT Res;\n auto ppr = ParaNdis_ReviewIPPacket(RtlOffsetToPointer(PacketData, IpHeaderOffset),\n GetDataLength(), __FUNCTION__);\n if (ppr.ipStatus != ppresNotIP)\n {\n Res = static_cast(IpHeaderOffset + ppr.ipHeaderSize);\n }\n else\n {\n DPrintf(0, (\"[%s] ERROR: NOT an IP packet - expected troubles!\\n\", __FUNCTION__));\n Res = 0;\n }\n return Res;\n}\n", + "target": "USHORT CNB::QueryL4HeaderOffset(PVOID PacketData, ULONG IpHeaderOffset) const\n {\n USHORT Res;\n auto ppr = ParaNdis_ReviewIPPacket(RtlOffsetToPointer(PacketData, IpHeaderOffset),\n GetDataLength(), FALSE, __FUNCTION__);\n if (ppr.ipStatus != ppresNotIP)\n {\n Res = static_cast(IpHeaderOffset + ppr.ipHeaderSize);\n }\n else\n {\n DPrintf(0, (\"[%s] ERROR: NOT an IP packet - expected troubles!\\n\", __FUNCTION__));\n Res = 0;\n }\n return Res;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#55136969558bd7d8b3456cd1447442a5425fd9df", + "input": " void DisplayItemList::processNewItem(DisplayItem& displayItem)\n{\n ASSERT(!m_constructionDisabled);\n ASSERT(!skippingCache() || !displayItem.isCached());\n\n if (displayItem.isCached())\n ++m_numCachedItems;\n\n#if ENABLE(ASSERT)\n if (m_newDisplayItems.size() >= 2 && displayItem.isEnd()) {\n const auto& beginDisplayItem = m_newDisplayItems[m_newDisplayItems.size() - 2];\n if (beginDisplayItem.isBegin() && !beginDisplayItem.isSubsequence() && !beginDisplayItem.drawsContent())\n ASSERT(!displayItem.isEndAndPairedWith(beginDisplayItem.type()));\n }\n#endif\n\n if (!m_scopeStack.isEmpty())\n displayItem.setScope(m_scopeStack.last());\n\n#if ENABLE(ASSERT)\n size_t index = findMatchingItemFromIndex(displayItem.nonCachedId(), m_newDisplayItemIndicesByClient, m_newDisplayItems);\n if (index != kNotFound) {\n#ifndef NDEBUG\n showDebugData();\n WTFLogAlways(\"DisplayItem %s has duplicated id with previous %s (index=%d)\\n\",\n displayItem.asDebugString().utf8().data(), m_newDisplayItems[index].asDebugString().utf8().data(), static_cast(index));\n#endif\n ASSERT_NOT_REACHED();\n }\n addItemToIndexIfNeeded(displayItem, m_newDisplayItems.size() - 1, m_newDisplayItemIndicesByClient);\n#endif // ENABLE(ASSERT)\n \n if (skippingCache())\n displayItem.setSkippedCache();\n }\n", + "target": " void DisplayItemList::processNewItem(DisplayItem& displayItem)\n{\n ASSERT(!m_constructionDisabled);\n ASSERT(!skippingCache() || !displayItem.isCached());\n\n if (displayItem.isCached())\n ++m_numCachedItems;\n\n#if ENABLE(ASSERT)\n if (m_newDisplayItems.size() >= 2 && displayItem.isEnd()) {\n const auto& beginDisplayItem = m_newDisplayItems[m_newDisplayItems.size() - 2];\n if (beginDisplayItem.isBegin() && !beginDisplayItem.isSubsequence() && !beginDisplayItem.drawsContent())\n ASSERT(!displayItem.isEndAndPairedWith(beginDisplayItem.type()));\n }\n#endif\n\n if (!m_scopeStack.isEmpty())\n displayItem.setScope(m_scopeStack.last());\n\n#if ENABLE(ASSERT)\n size_t index = findMatchingItemFromIndex(displayItem.nonCachedId(), m_newDisplayItemIndicesByClient, m_newDisplayItems);\n if (index != kNotFound) {\n#ifndef NDEBUG\n showDebugData();\n WTFLogAlways(\"DisplayItem %s has duplicated id with previous %s (index=%d)\\n\",\n displayItem.asDebugString().utf8().data(), m_newDisplayItems[index].asDebugString().utf8().data(), static_cast(index));\n#endif\n ASSERT_NOT_REACHED();\n }\n addItemToIndexIfNeeded(displayItem, m_newDisplayItems.size() - 1, m_newDisplayItemIndicesByClient);\n#endif // ENABLE(ASSERT)\n \n if (skippingCache())\n displayItem.setSkippedCache();\n\n if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())\n m_newPaintChunks.incrementDisplayItemIndex();\n}\n\nvoid DisplayItemList::updateCurrentPaintProperties(const PaintProperties& newPaintProperties)\n{\n m_newPaintChunks.updateCurrentPaintProperties(newPaintProperties);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dd3b6fe574edad231c01c78e4647a74c38dc4178", + "input": "GDataEntry* GDataFile::FromDocumentEntry(\n GDataDirectory* parent,\n DocumentEntry* doc,\n GDataDirectoryService* directory_service) {\n DCHECK(doc->is_hosted_document() || doc->is_file());\n GDataFile* file = new GDataFile(parent, directory_service);\n file->title_ = UTF16ToUTF8(doc->title());\n \n if (doc->is_file()) {\n file->file_info_.size = doc->file_size();\n file->file_md5_ = doc->file_md5();\n \n const Link* upload_link = doc->GetLinkByType(Link::RESUMABLE_EDIT_MEDIA);\n if (upload_link)\n file->upload_url_ = upload_link->href();\n } else {\n file->document_extension_ = doc->GetHostedDocumentExtension();\n file->file_info_.size = 0;\n }\n file->kind_ = doc->kind();\n const Link* edit_link = doc->GetLinkByType(Link::EDIT);\n if (edit_link)\n file->edit_url_ = edit_link->href();\n file->content_url_ = doc->content_url();\n file->content_mime_type_ = doc->content_mime_type();\n file->resource_id_ = doc->resource_id();\n file->is_hosted_document_ = doc->is_hosted_document();\n file->file_info_.last_modified = doc->updated_time();\n file->file_info_.last_accessed = doc->updated_time();\n file->file_info_.creation_time = doc->published_time();\n file->deleted_ = doc->deleted();\n const Link* parent_link = doc->GetLinkByType(Link::PARENT);\n if (parent_link)\n file->parent_resource_id_ = ExtractResourceId(parent_link->href());\n file->SetBaseNameFromTitle();\n \n const Link* thumbnail_link = doc->GetLinkByType(Link::THUMBNAIL);\n if (thumbnail_link)\n file->thumbnail_url_ = thumbnail_link->href();\n \n const Link* alternate_link = doc->GetLinkByType(Link::ALTERNATE);\n if (alternate_link)\n file->alternate_url_ = alternate_link->href();\n return file;\n }\n", + "target": "GDataEntry* GDataFile::FromDocumentEntry(\nvoid GDataFile::InitFromDocumentEntry(DocumentEntry* doc) {\n GDataEntry::InitFromDocumentEntry(doc);\n \n if (doc->is_file()) {\n file_info_.size = doc->file_size();\n file_md5_ = doc->file_md5();\n \n const Link* upload_link = doc->GetLinkByType(Link::RESUMABLE_EDIT_MEDIA);\n if (upload_link)\n upload_url_ = upload_link->href();\n } else {\n document_extension_ = doc->GetHostedDocumentExtension();\n file_info_.size = 0;\n }\n kind_ = doc->kind();\n content_mime_type_ = doc->content_mime_type();\n is_hosted_document_ = doc->is_hosted_document();\n SetBaseNameFromTitle();\n \n const Link* thumbnail_link = doc->GetLinkByType(Link::THUMBNAIL);\n if (thumbnail_link)\n thumbnail_url_ = thumbnail_link->href();\n \n const Link* alternate_link = doc->GetLinkByType(Link::ALTERNATE);\n if (alternate_link)\n alternate_url_ = alternate_link->href();\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d10a8dac48d3a9467e81c62cb45208344f4542db", + "input": " StateBase* writeFileList(v8::Handle value, StateBase* next)\n {\n FileList* fileList = V8FileList::toNative(value.As());\n if (!fileList)\n return 0;\n unsigned length = fileList->length();\n Vector blobIndices;\n for (unsigned i = 0; i < length; ++i) {\n int blobIndex = -1;\n const File* file = fileList->item(i);\n if (file->hasBeenClosed())\n return handleError(DataCloneError, \"A File object has been closed, and could therefore not be cloned.\", next);\n m_blobDataHandles.add(file->uuid(), file->blobDataHandle());\n if (appendFileInfo(file, &blobIndex)) {\n ASSERT(!i || blobIndex > 0);\n ASSERT(blobIndex >= 0);\n blobIndices.append(blobIndex);\n }\n }\n if (!blobIndices.isEmpty())\n m_writer.writeFileListIndex(blobIndices);\n else\n m_writer.writeFileList(*fileList);\n return 0;\n }\n", + "target": " StateBase* writeFileList(v8::Handle value, StateBase* next)\n {\n FileList* fileList = V8FileList::toNative(value.As());\n if (!fileList)\n return 0;\n unsigned length = fileList->length();\n Vector blobIndices;\n for (unsigned i = 0; i < length; ++i) {\n int blobIndex = -1;\n const File* file = fileList->item(i);\n if (file->hasBeenClosed())\n return handleError(DataCloneError, \"A File object has been closed, and could therefore not be cloned.\", next);\n m_blobDataHandles.set(file->uuid(), file->blobDataHandle());\n if (appendFileInfo(file, &blobIndex)) {\n ASSERT(!i || blobIndex > 0);\n ASSERT(blobIndex >= 0);\n blobIndices.append(blobIndex);\n }\n }\n if (!blobIndices.isEmpty())\n m_writer.writeFileListIndex(blobIndices);\n else\n m_writer.writeFileList(*fileList);\n return 0;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fc80ab45621bd966f70594c0b7393ec005a94007", + "input": " static unsigned HuffmanTree_makeFromFrequencies(HuffmanTree* tree, const unsigned* frequencies,\n size_t mincodes, size_t numcodes, unsigned maxbitlen)\n {\n unsigned error = 0;\n while(!frequencies[numcodes - 1] && numcodes > mincodes) numcodes--; /*trim zeroes*/\n tree->maxbitlen = maxbitlen;\n tree->numcodes = (unsigned)numcodes; /*number of symbols*/\n tree->lengths = (unsigned*)realloc(tree->lengths, numcodes * sizeof(unsigned));\n if(!tree->lengths) return 83; /*alloc fail*/\n /*initialize all lengths to 0*/\n memset(tree->lengths, 0, numcodes * sizeof(unsigned));\n\n error = lodepng_huffman_code_lengths(tree->lengths, frequencies, numcodes, maxbitlen);\n if(!error) error = HuffmanTree_makeFromLengths2(tree);\n return error;\n}\n", + "target": " static unsigned HuffmanTree_makeFromFrequencies(HuffmanTree* tree, const unsigned* frequencies,\n size_t mincodes, size_t numcodes, unsigned maxbitlen)\n {\n\tunsigned* lengths;\n unsigned error = 0;\n while(!frequencies[numcodes - 1] && numcodes > mincodes) numcodes--; /*trim zeroes*/\n tree->maxbitlen = maxbitlen;\n tree->numcodes = (unsigned)numcodes; /*number of symbols*/\n lengths = (unsigned*)realloc(tree->lengths, numcodes * sizeof(unsigned));\n\tif (!lengths)\n\t\tfree(tree->lengths);\n\ttree->lengths = lengths;\n if(!tree->lengths) return 83; /*alloc fail*/\n /*initialize all lengths to 0*/\n memset(tree->lengths, 0, numcodes * sizeof(unsigned));\n\n error = lodepng_huffman_code_lengths(tree->lengths, frequencies, numcodes, maxbitlen);\n if(!error) error = HuffmanTree_makeFromLengths2(tree);\n return error;\n}\n", + "vul_type": "cwe-772", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#295c883fe3105b19bcd0f9e07d54c6b589fc5bff", + "input": "OMX_ERRORTYPE SoftGSM::internalSetParameter(\n OMX_INDEXTYPE index, const OMX_PTR params) {\n switch (index) {\n case OMX_IndexParamAudioPcm:\n {\n\n OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =\n (OMX_AUDIO_PARAM_PCMMODETYPE *)params;\n \n if (pcmParams->nPortIndex != 0 && pcmParams->nPortIndex != 1) {\n return OMX_ErrorUndefined;\n }\n\n if (pcmParams->nChannels != 1) {\n return OMX_ErrorUndefined;\n }\n\n if (pcmParams->nSamplingRate != 8000) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamStandardComponentRole:\n {\n\n const OMX_PARAM_COMPONENTROLETYPE *roleParams =\n (const OMX_PARAM_COMPONENTROLETYPE *)params;\n \n if (strncmp((const char *)roleParams->cRole,\n \"audio_decoder.gsm\",\n OMX_MAX_STRINGNAME_SIZE - 1)) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n default:\n return SimpleSoftOMXComponent::internalSetParameter(index, params);\n }\n}\n", + "target": "OMX_ERRORTYPE SoftGSM::internalSetParameter(\n OMX_INDEXTYPE index, const OMX_PTR params) {\n switch (index) {\n case OMX_IndexParamAudioPcm:\n {\n\n OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =\n (OMX_AUDIO_PARAM_PCMMODETYPE *)params;\n \n if (!isValidOMXParam(pcmParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (pcmParams->nPortIndex != 0 && pcmParams->nPortIndex != 1) {\n return OMX_ErrorUndefined;\n }\n\n if (pcmParams->nChannels != 1) {\n return OMX_ErrorUndefined;\n }\n\n if (pcmParams->nSamplingRate != 8000) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamStandardComponentRole:\n {\n\n const OMX_PARAM_COMPONENTROLETYPE *roleParams =\n (const OMX_PARAM_COMPONENTROLETYPE *)params;\n \n if (!isValidOMXParam(roleParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (strncmp((const char *)roleParams->cRole,\n \"audio_decoder.gsm\",\n OMX_MAX_STRINGNAME_SIZE - 1)) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n default:\n return SimpleSoftOMXComponent::internalSetParameter(index, params);\n }\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4a59cfaf9ab3d48fca4a15c0d2674bf7138e3d1a", + "input": "void jpc_qmfb_split_col(jpc_fix_t *a, int numrows, int stride,\n int parity)\n{\n\n\tint bufsize = JPC_CEILDIVPOW2(numrows, 1);\n\tjpc_fix_t splitbuf[QMFB_SPLITBUFSIZE];\n\tjpc_fix_t *buf = splitbuf;\n\tregister jpc_fix_t *srcptr;\n \tregister jpc_fix_t *dstptr;\n \tregister int n;\n \tregister int m;\n\tint hstartcol;\n \n \t/* Get a buffer. */\n \tif (bufsize > QMFB_SPLITBUFSIZE) {\n\t\tif (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) {\n\t\t\t/* We have no choice but to commit suicide in this case. */\n\t\t\tabort();\n\t\t}\n \t}\n \n \tif (numrows >= 2) {\n\t\thstartcol = (numrows + 1 - parity) >> 1;\n\t\tm = numrows - hstartcol;\n \n \t\t/* Save the samples destined for the highpass channel. */\n \t\tn = m;\n\t\tdstptr = buf;\n\t\tsrcptr = &a[(1 - parity) * stride];\n\t\twhile (n-- > 0) {\n\t\t\t*dstptr = *srcptr;\n\t\t\t++dstptr;\n\t\t\tsrcptr += stride << 1;\n\t\t}\n\t\t/* Copy the appropriate samples into the lowpass channel. */\n\t\tdstptr = &a[(1 - parity) * stride];\n\t\tsrcptr = &a[(2 - parity) * stride];\n\t\tn = numrows - m - (!parity);\n\t\twhile (n-- > 0) {\n\t\t\t*dstptr = *srcptr;\n\t\t\tdstptr += stride;\n \t\t\tsrcptr += stride << 1;\n \t\t}\n \t\t/* Copy the saved samples into the highpass channel. */\n\t\tdstptr = &a[hstartcol * stride];\n \t\tsrcptr = buf;\n \t\tn = m;\n \t\twhile (n-- > 0) {\n\t\t\t*dstptr = *srcptr;\n\t\t\tdstptr += stride;\n\t\t\t++srcptr;\n\t\t}\n\t}\n\n\t/* If the split buffer was allocated on the heap, free this memory. */\n\tif (buf != splitbuf) {\n\t\tjas_free(buf);\n\t}\n\n}\n", + "target": "void jpc_qmfb_split_col(jpc_fix_t *a, int numrows, int stride,\n int parity)\n{\n\n\tint bufsize = JPC_CEILDIVPOW2(numrows, 1);\n\tjpc_fix_t splitbuf[QMFB_SPLITBUFSIZE];\n\tjpc_fix_t *buf = splitbuf;\n\tregister jpc_fix_t *srcptr;\n \tregister jpc_fix_t *dstptr;\n \tregister int n;\n \tregister int m;\n\tint hstartrow;\n \n \t/* Get a buffer. */\n \tif (bufsize > QMFB_SPLITBUFSIZE) {\n\t\tif (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) {\n\t\t\t/* We have no choice but to commit suicide in this case. */\n\t\t\tabort();\n\t\t}\n \t}\n \n \tif (numrows >= 2) {\n\t\thstartrow = (numrows + 1 - parity) >> 1;\n\t\t// ORIGINAL (WRONG): m = (parity) ? hstartrow : (numrows - hstartrow);\n\t\tm = numrows - hstartrow;\n \n \t\t/* Save the samples destined for the highpass channel. */\n \t\tn = m;\n\t\tdstptr = buf;\n\t\tsrcptr = &a[(1 - parity) * stride];\n\t\twhile (n-- > 0) {\n\t\t\t*dstptr = *srcptr;\n\t\t\t++dstptr;\n\t\t\tsrcptr += stride << 1;\n\t\t}\n\t\t/* Copy the appropriate samples into the lowpass channel. */\n\t\tdstptr = &a[(1 - parity) * stride];\n\t\tsrcptr = &a[(2 - parity) * stride];\n\t\tn = numrows - m - (!parity);\n\t\twhile (n-- > 0) {\n\t\t\t*dstptr = *srcptr;\n\t\t\tdstptr += stride;\n \t\t\tsrcptr += stride << 1;\n \t\t}\n \t\t/* Copy the saved samples into the highpass channel. */\n\t\tdstptr = &a[hstartrow * stride];\n \t\tsrcptr = buf;\n \t\tn = m;\n \t\twhile (n-- > 0) {\n\t\t\t*dstptr = *srcptr;\n\t\t\tdstptr += stride;\n\t\t\t++srcptr;\n\t\t}\n\t}\n\n\t/* If the split buffer was allocated on the heap, free this memory. */\n\tif (buf != splitbuf) {\n\t\tjas_free(buf);\n\t}\n\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#708e996c87c5fae77b104ccfeb8f6db784c32074", + "input": " header_put_le_3byte (SF_PRIVATE *psf, int x)\n{\tif (psf->headindex < SIGNED_SIZEOF (psf->header) - 3)\n\t{\tpsf->header [psf->headindex++] = x ;\n\t\tpsf->header [psf->headindex++] = (x >> 8) ;\n\t\tpsf->header [psf->headindex++] = (x >> 16) ;\n\t\t} ;\n } /* header_put_le_3byte */\n", + "target": " header_put_le_3byte (SF_PRIVATE *psf, int x)\n{\tpsf->header.ptr [psf->header.indx++] = x ;\n\tpsf->header.ptr [psf->header.indx++] = (x >> 8) ;\n\tpsf->header.ptr [psf->header.indx++] = (x >> 16) ;\n } /* header_put_le_3byte */\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8353baf8d1504dbdd4ad7584ff2466de657521cd", + "input": "bool Frame::canHaveSecureChild() const\n{\n for (const Frame* parent = this; parent; parent = parent->tree().parent()) {\n if (!parent->securityContext()->getSecurityOrigin()->isPotentiallyTrustworthy())\n return false;\n }\n return true;\n}\n", + "target": "bool Frame::canHaveSecureChild() const\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4379a7fcff8190aa7ba72307b398161c32102c52", + "input": "NavigationPolicy EffectiveNavigationPolicy(NavigationPolicy policy,\n const WebInputEvent* current_event,\n const WebWindowFeatures& features) {\n if (policy == kNavigationPolicyIgnore)\n return GetNavigationPolicy(current_event, features);\n if (policy == kNavigationPolicyNewBackgroundTab &&\n GetNavigationPolicy(current_event, features) !=\n kNavigationPolicyNewBackgroundTab &&\n !UIEventWithKeyState::NewTabModifierSetFromIsolatedWorld()) {\n return kNavigationPolicyNewForegroundTab;\n }\n return policy;\n }\n", + "target": "NavigationPolicy EffectiveNavigationPolicy(NavigationPolicy policy,\n if (policy == kNavigationPolicyNewBackgroundTab &&\n user_policy != kNavigationPolicyNewBackgroundTab &&\n !UIEventWithKeyState::NewTabModifierSetFromIsolatedWorld()) {\n // Don't allow background tabs to be opened via script setting the\n // event modifiers.\n return kNavigationPolicyNewForegroundTab;\n }\n\n if (policy == kNavigationPolicyDownload &&\n user_policy != kNavigationPolicyDownload) {\n // Don't allow downloads to be triggered via script setting the event\n // modifiers.\n return kNavigationPolicyNewForegroundTab;\n }\n\n return policy;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a4ca568cdf68cf4a0343eb161518dc8e50cea87d", + "input": "void CtcpHandler::defaultHandler(const QString &cmd, CtcpType ctcptype, const QString &prefix, const QString &target, const QString ¶m) {\n Q_UNUSED(ctcptype);\n Q_UNUSED(target);\n if(!_ignoreListManager->ctcpMatch(prefix, network()->networkName())) {\n QString str = tr(\"Received unknown CTCP %1 by %2\").arg(cmd).arg(prefix);\n if(!param.isEmpty())\n str.append(tr(\" with arguments: %1\").arg(param));\n emit displayMsg(Message::Error, BufferInfo::StatusBuffer, \"\", str);\n }\n }\n", + "target": "void CtcpHandler::defaultHandler(const QString &cmd, CtcpType ctcptype, const QString &prefix, const QString &target, const QString ¶m) {\nvoid CtcpHandler::defaultHandler(const QString &cmd, CtcpType ctcptype, const QString &prefix, const QString &target, const QString ¶m, QString &reply) {\n Q_UNUSED(ctcptype);\n Q_UNUSED(target);\n Q_UNUSED(reply);\n QString str = tr(\"Received unknown CTCP %1 by %2\").arg(cmd).arg(prefix);\n if(!param.isEmpty())\n str.append(tr(\" with arguments: %1\").arg(param));\n emit displayMsg(Message::Error, BufferInfo::StatusBuffer, \"\", str);\n }\n", + "vul_type": "cwe-399", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c5759e7b76f5bf844be6c6641cc1b356bbc83869", + "input": "fm_mgr_config_mgr_connect\n(\n\tfm_config_conx_hdl\t*hdl, \n\tfm_mgr_type_t \t\tmgr\n)\n{\n\tchar s_path[256];\n \tchar c_path[256];\n \tchar *mgr_prefix;\n \tp_hsm_com_client_hdl_t *mgr_hdl;\n\tpid_t pid;\n \n \tmemset(s_path,0,sizeof(s_path));\n \tmemset(c_path,0,sizeof(c_path));\n \n\tpid = getpid();\n \tswitch ( mgr )\n \t{\n \t\tcase FM_MGR_SM:\n\t\t\tmgr_prefix = HSM_FM_SCK_SM;\n\t\t\tmgr_hdl = &hdl->sm_hdl;\n\t\t\tbreak;\n\t\tcase FM_MGR_PM:\n\t\t\tmgr_prefix = HSM_FM_SCK_PM;\n\t\t\tmgr_hdl = &hdl->pm_hdl;\n\t\t\tbreak;\n\t\tcase FM_MGR_FE:\n\t\t\tmgr_prefix = HSM_FM_SCK_FE;\n\t\t\tmgr_hdl = &hdl->fe_hdl;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn FM_CONF_INIT_ERR;\n\t}\n\n \tsprintf(s_path,\"%s%s%d\",HSM_FM_SCK_PREFIX,mgr_prefix,hdl->instance);\n \n\tsprintf(c_path,\"%s%s%d_C_%lu\",HSM_FM_SCK_PREFIX,mgr_prefix,\n\t\t\thdl->instance, (long unsigned)pid);\n \n \tif ( *mgr_hdl == NULL )\n \t{\n\t\tif ( hcom_client_init(mgr_hdl,s_path,c_path,32768) != HSM_COM_OK )\n\t\t{\n\t\t\treturn FM_CONF_INIT_ERR;\n\t\t}\n\t}\n\n\tif ( hcom_client_connect(*mgr_hdl) == HSM_COM_OK )\n\t{\n\t\thdl->conx_mask |= mgr;\n\t\treturn FM_CONF_OK;\n\t}\n\n\treturn FM_CONF_CONX_ERR;\n\n}\n", + "target": "fm_mgr_config_mgr_connect\n(\n\tfm_config_conx_hdl\t*hdl, \n\tfm_mgr_type_t \t\tmgr\n)\n{\n\tchar s_path[256];\n \tchar c_path[256];\n \tchar *mgr_prefix;\n \tp_hsm_com_client_hdl_t *mgr_hdl;\n \n \tmemset(s_path,0,sizeof(s_path));\n \tmemset(c_path,0,sizeof(c_path));\n \n \tswitch ( mgr )\n \t{\n \t\tcase FM_MGR_SM:\n\t\t\tmgr_prefix = HSM_FM_SCK_SM;\n\t\t\tmgr_hdl = &hdl->sm_hdl;\n\t\t\tbreak;\n\t\tcase FM_MGR_PM:\n\t\t\tmgr_prefix = HSM_FM_SCK_PM;\n\t\t\tmgr_hdl = &hdl->pm_hdl;\n\t\t\tbreak;\n\t\tcase FM_MGR_FE:\n\t\t\tmgr_prefix = HSM_FM_SCK_FE;\n\t\t\tmgr_hdl = &hdl->fe_hdl;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn FM_CONF_INIT_ERR;\n\t}\n\n \tsprintf(s_path,\"%s%s%d\",HSM_FM_SCK_PREFIX,mgr_prefix,hdl->instance);\n \n\tsprintf(c_path,\"%s%s%d_C_XXXXXX\",HSM_FM_SCK_PREFIX,mgr_prefix,hdl->instance);\n \n \tif ( *mgr_hdl == NULL )\n \t{\n\t\tif ( hcom_client_init(mgr_hdl,s_path,c_path,32768) != HSM_COM_OK )\n\t\t{\n\t\t\treturn FM_CONF_INIT_ERR;\n\t\t}\n\t}\n\n\tif ( hcom_client_connect(*mgr_hdl) == HSM_COM_OK )\n\t{\n\t\thdl->conx_mask |= mgr;\n\t\treturn FM_CONF_OK;\n\t}\n\n\treturn FM_CONF_CONX_ERR;\n\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "static void perform_gamma_sbit_tests(png_modifier *pm)\n{\n png_byte sbit;\n\n /* The only interesting cases are colour and grayscale, alpha is ignored here\n * for overall speed. Only bit depths where sbit is less than the bit depth\n * are tested.\n */\n for (sbit=pm->sbitlow; sbit<(1<ngamma_tests; ++i)\n {\n unsigned int j;\n\n for (j=0; jngamma_tests; ++j) if (i != j)\n {\n gamma_transform_test(pm, colour_type, bit_depth, npalette,\n pm->interlace_type, 1/pm->gammas[i], pm->gammas[j],\n sbit, pm->use_input_precision_sbit, 0 /*scale16*/);\n\n if (fail(pm))\n return;\n }\n }\n }\n }\n}\n", + "target": "static void perform_gamma_sbit_tests(png_modifier *pm)\n{\n png_byte sbit;\n\n /* The only interesting cases are colour and grayscale, alpha is ignored here\n * for overall speed. Only bit depths where sbit is less than the bit depth\n * are tested.\n */\n for (sbit=pm->sbitlow; sbit<(1<test_lbg_gamma_sbit, pm->test_tRNS))\n if ((colour_type & PNG_COLOR_MASK_ALPHA) == 0 &&\n ((colour_type == 3 && sbit < 8) ||\n (colour_type != 3 && sbit < bit_depth)))\n {\n unsigned int i;\n\n for (i=0; ingamma_tests; ++i)\n {\n unsigned int j;\n\n for (j=0; jngamma_tests; ++j) if (i != j)\n {\n gamma_transform_test(pm, colour_type, bit_depth, npalette,\n pm->interlace_type, 1/pm->gammas[i], pm->gammas[j],\n sbit, pm->use_input_precision_sbit, 0 /*scale16*/);\n\n if (fail(pm))\n return;\n }\n }\n }\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#6-0e192cb6110d", + "input": "def get_title_from_youtube_url(url):\n try:\n output = str(subprocess.check_output('youtube-dl --get-title %s --no-warnings' % url, stderr=subprocess.STDOUT,\n shell=True)).strip()\n except subprocess.CalledProcessError as ex:\n output = str(ex.output).strip()\n except OSError as ex:\n output = 'youtube-dl not found: %s' % ex\n except Exception as ex:\n output = 'Something bad happened: %s' % ex\n return remove_commas_from_string(output)", + "target": "def get_title_from_youtube_url(url):\n try:\n output = str(subprocess.check_output(['youtube-dl', '--get-title', url, '--no-warnings'],\n stderr=subprocess.STDOUT)).strip()\n except subprocess.CalledProcessError as ex:\n output = str(ex.output).strip()\n except OSError as ex:\n output = 'youtube-dl not found: %s' % ex\n except Exception as ex:\n output = 'Something bad happened: %s' % ex\n return remove_commas_from_string(output)", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#2fb4f2c9c461551d43fdfa28ef4c960da81a47dd", + "input": "bool ParseVp9Eotf(const int value, gfx::ColorSpace::TransferID* eotf) {\n switch (value) {\n case 1:\n *eotf = gfx::ColorSpace::TransferID::BT709;\n break;\n case 2:\n *eotf = gfx::ColorSpace::TransferID::INVALID;\n break;\n case 4:\n *eotf = gfx::ColorSpace::TransferID::GAMMA22;\n break;\n case 5:\n *eotf = gfx::ColorSpace::TransferID::GAMMA28;\n break;\n case 6:\n *eotf = gfx::ColorSpace::TransferID::SMPTE170M;\n break;\n case 7:\n *eotf = gfx::ColorSpace::TransferID::SMPTE240M;\n break;\n case 8:\n *eotf = gfx::ColorSpace::TransferID::LINEAR;\n break;\n case 9:\n *eotf = gfx::ColorSpace::TransferID::LOG;\n break;\n case 10:\n *eotf = gfx::ColorSpace::TransferID::LOG_SQRT;\n break;\n case 11:\n *eotf = gfx::ColorSpace::TransferID::IEC61966_2_4;\n break;\n case 12:\n *eotf = gfx::ColorSpace::TransferID::BT1361_ECG;\n break;\n case 13:\n *eotf = gfx::ColorSpace::TransferID::IEC61966_2_1;\n break;\n case 14:\n *eotf = gfx::ColorSpace::TransferID::BT2020_10;\n break;\n case 15:\n *eotf = gfx::ColorSpace::TransferID::BT2020_12;\n break;\n case 16:\n *eotf = gfx::ColorSpace::TransferID::SMPTEST2084;\n break;\n case 17:\n *eotf = gfx::ColorSpace::TransferID::SMPTEST428_1;\n break;\n default:\n *eotf = gfx::ColorSpace::TransferID::INVALID;\n return false;\n }\n return true;\n}\n", + "target": "bool ParseVp9Eotf(const int value, gfx::ColorSpace::TransferID* eotf) {\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#708e996c87c5fae77b104ccfeb8f6db784c32074", + "input": "header_put_be_8byte (SF_PRIVATE *psf, sf_count_t x)\n{\tif (psf->headindex < SIGNED_SIZEOF (psf->header) - 8)\n\t{\tpsf->header [psf->headindex++] = 0 ;\n\t\tpsf->header [psf->headindex++] = 0 ;\n\t\tpsf->header [psf->headindex++] = 0 ;\n\t\tpsf->header [psf->headindex++] = 0 ;\n\t\tpsf->header [psf->headindex++] = (x >> 24) ;\n\t\tpsf->header [psf->headindex++] = (x >> 16) ;\n\t\tpsf->header [psf->headindex++] = (x >> 8) ;\n\t\tpsf->header [psf->headindex++] = x ;\n\t\t} ;\n} /* header_put_be_8byte */\n", + "target": "header_put_be_8byte (SF_PRIVATE *psf, sf_count_t x)\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3ca657a8793dd011bf869695d72ad31c779c3cc1", + "input": " swabHorAcc16(TIFF* tif, uint8* cp0, tmsize_t cc)\n {\n \tuint16* wp = (uint16*) cp0;\n \ttmsize_t wc = cc / 2;\n \n TIFFSwabArrayOfShort(wp, wc);\n horAcc16(tif, cp0, cc);\n }\n", + "target": " swabHorAcc16(TIFF* tif, uint8* cp0, tmsize_t cc)\n {\n \tuint16* wp = (uint16*) cp0;\n \ttmsize_t wc = cc / 2;\n \n TIFFSwabArrayOfShort(wp, wc);\n return horAcc16(tif, cp0, cc);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#15-08854d838c25", + "input": "def update_video_positions(removed_position, db):\n db.execute(\"UPDATE video SET position = position - 1 WHERE position > {removed_position}\".format(\n removed_position=removed_position))", + "target": "def update_video_positions(removed_position, db):\n db.execute(\"UPDATE video SET position = position - 1 WHERE position > %s\", (removed_position,))", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#3ac044334c3ff6a61cb4238ff3ddaf17c7efcf49", + "input": "void WT_Interpolate (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)\n{\n EAS_PCM *pOutputBuffer;\n EAS_I32 phaseInc;\n EAS_I32 phaseFrac;\n EAS_I32 acc0;\n const EAS_SAMPLE *pSamples;\n const EAS_SAMPLE *loopEnd;\n EAS_I32 samp1;\n EAS_I32 samp2;\n EAS_I32 numSamples;\n\n \n /* initialize some local variables */\n numSamples = pWTIntFrame->numSamples;\n pOutputBuffer = pWTIntFrame->pAudioBuffer;\n \n loopEnd = (const EAS_SAMPLE*) pWTVoice->loopEnd + 1;\n pSamples = (const EAS_SAMPLE*) pWTVoice->phaseAccum;\n /*lint -e{713} truncation is OK */\n phaseFrac = pWTVoice->phaseFrac;\n phaseInc = pWTIntFrame->frame.phaseIncrement;\n\n /* fetch adjacent samples */\n#if defined(_8_BIT_SAMPLES)\n /*lint -e{701} */\n samp1 = pSamples[0] << 8;\n /*lint -e{701} */\n samp2 = pSamples[1] << 8;\n#else\n samp1 = pSamples[0];\n samp2 = pSamples[1];\n#endif\n\n while (numSamples--) {\n\n /* linear interpolation */\n acc0 = samp2 - samp1;\n acc0 = acc0 * phaseFrac;\n /*lint -e{704} */\n acc0 = samp1 + (acc0 >> NUM_PHASE_FRAC_BITS);\n\n /* save new output sample in buffer */\n /*lint -e{704} */\n *pOutputBuffer++ = (EAS_I16)(acc0 >> 2);\n\n /* increment phase */\n phaseFrac += phaseInc;\n /*lint -e{704} */\n acc0 = phaseFrac >> NUM_PHASE_FRAC_BITS;\n\n /* next sample */\n if (acc0 > 0) {\n\n /* advance sample pointer */\n pSamples += acc0;\n phaseFrac = (EAS_I32)((EAS_U32)phaseFrac & PHASE_FRAC_MASK);\n\n /* check for loop end */\n acc0 = (EAS_I32) (pSamples - loopEnd);\n if (acc0 >= 0)\n pSamples = (const EAS_SAMPLE*) pWTVoice->loopStart + acc0;\n\n /* fetch new samples */\n#if defined(_8_BIT_SAMPLES)\n /*lint -e{701} */\n samp1 = pSamples[0] << 8;\n /*lint -e{701} */\n samp2 = pSamples[1] << 8;\n#else\n samp1 = pSamples[0];\n samp2 = pSamples[1];\n#endif\n }\n }\n\n /* save pointer and phase */\n pWTVoice->phaseAccum = (EAS_U32) pSamples;\n pWTVoice->phaseFrac = (EAS_U32) phaseFrac;\n}\n", + "target": "void WT_Interpolate (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)\n{\n EAS_PCM *pOutputBuffer;\n EAS_I32 phaseInc;\n EAS_I32 phaseFrac;\n EAS_I32 acc0;\n const EAS_SAMPLE *pSamples;\n const EAS_SAMPLE *loopEnd;\n EAS_I32 samp1;\n EAS_I32 samp2;\n EAS_I32 numSamples;\n\n \n /* initialize some local variables */\n numSamples = pWTIntFrame->numSamples;\n if (numSamples <= 0) {\n ALOGE(\"b/26366256\");\n return;\n }\n pOutputBuffer = pWTIntFrame->pAudioBuffer;\n \n loopEnd = (const EAS_SAMPLE*) pWTVoice->loopEnd + 1;\n pSamples = (const EAS_SAMPLE*) pWTVoice->phaseAccum;\n /*lint -e{713} truncation is OK */\n phaseFrac = pWTVoice->phaseFrac;\n phaseInc = pWTIntFrame->frame.phaseIncrement;\n\n /* fetch adjacent samples */\n#if defined(_8_BIT_SAMPLES)\n /*lint -e{701} */\n samp1 = pSamples[0] << 8;\n /*lint -e{701} */\n samp2 = pSamples[1] << 8;\n#else\n samp1 = pSamples[0];\n samp2 = pSamples[1];\n#endif\n\n while (numSamples--) {\n\n /* linear interpolation */\n acc0 = samp2 - samp1;\n acc0 = acc0 * phaseFrac;\n /*lint -e{704} */\n acc0 = samp1 + (acc0 >> NUM_PHASE_FRAC_BITS);\n\n /* save new output sample in buffer */\n /*lint -e{704} */\n *pOutputBuffer++ = (EAS_I16)(acc0 >> 2);\n\n /* increment phase */\n phaseFrac += phaseInc;\n /*lint -e{704} */\n acc0 = phaseFrac >> NUM_PHASE_FRAC_BITS;\n\n /* next sample */\n if (acc0 > 0) {\n\n /* advance sample pointer */\n pSamples += acc0;\n phaseFrac = (EAS_I32)((EAS_U32)phaseFrac & PHASE_FRAC_MASK);\n\n /* check for loop end */\n acc0 = (EAS_I32) (pSamples - loopEnd);\n if (acc0 >= 0)\n pSamples = (const EAS_SAMPLE*) pWTVoice->loopStart + acc0;\n\n /* fetch new samples */\n#if defined(_8_BIT_SAMPLES)\n /*lint -e{701} */\n samp1 = pSamples[0] << 8;\n /*lint -e{701} */\n samp2 = pSamples[1] << 8;\n#else\n samp1 = pSamples[0];\n samp2 = pSamples[1];\n#endif\n }\n }\n\n /* save pointer and phase */\n pWTVoice->phaseAccum = (EAS_U32) pSamples;\n pWTVoice->phaseFrac = (EAS_U32) phaseFrac;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a46bcef82b29d30836a0f26226e3d4aca4fa9612", + "input": " void JingleSessionManager::Close() {\n DCHECK(CalledOnValidThread());\n \n DCHECK(sessions_.empty());\n if (!closed_) {\n cricket_session_manager_->RemoveClient(kChromotingXmlNamespace);\n jingle_signaling_connector_.reset();\n cricket_session_manager_.reset();\n closed_ = true;\n }\n }\n", + "target": " void JingleSessionManager::Close() {\n DCHECK(CalledOnValidThread());\n \n if (!closed_) {\n cricket_session_manager_->RemoveClient(kChromotingXmlNamespace);\n jingle_signaling_connector_.reset();\n closed_ = true;\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#30cec963095366536ca0b1306089154e09bfe1a9", + "input": "tBTA_AV_EVT bta_av_proc_meta_cmd(tAVRC_RESPONSE* p_rc_rsp,\n tBTA_AV_RC_MSG* p_msg, uint8_t* p_ctype) {\n tBTA_AV_EVT evt = BTA_AV_META_MSG_EVT;\n uint8_t u8, pdu, *p;\n uint16_t u16;\n tAVRC_MSG_VENDOR* p_vendor = &p_msg->msg.vendor;\n\n pdu = *(p_vendor->p_vendor_data);\n p_rc_rsp->pdu = pdu;\n *p_ctype = AVRC_RSP_REJ;\n\n /* Check to ansure a valid minimum meta data length */\n if ((AVRC_MIN_META_CMD_LEN + p_vendor->vendor_len) > AVRC_META_CMD_BUF_SIZE) {\n /* reject it */\n p_rc_rsp->rsp.status = AVRC_STS_BAD_PARAM;\n APPL_TRACE_ERROR(\"%s: Invalid meta-command length: %d\", __func__,\n p_vendor->vendor_len);\n return 0;\n }\n\n /* Metadata messages only use PANEL sub-unit type */\n if (p_vendor->hdr.subunit_type != AVRC_SUB_PANEL) {\n APPL_TRACE_DEBUG(\"%s: SUBUNIT must be PANEL\", __func__);\n /* reject it */\n evt = 0;\n p_vendor->hdr.ctype = AVRC_RSP_NOT_IMPL;\n p_vendor->vendor_len = 0;\n p_rc_rsp->rsp.status = AVRC_STS_BAD_PARAM;\n } else if (!AVRC_IsValidAvcType(pdu, p_vendor->hdr.ctype)) {\n APPL_TRACE_DEBUG(\"%s: Invalid pdu/ctype: 0x%x, %d\", __func__, pdu,\n p_vendor->hdr.ctype);\n /* reject invalid message without reporting to app */\n evt = 0;\n p_rc_rsp->rsp.status = AVRC_STS_BAD_CMD;\n } else {\n switch (pdu) {\n\n case AVRC_PDU_GET_CAPABILITIES:\n /* process GetCapabilities command without reporting the event to app */\n evt = 0;\n u8 = *(p_vendor->p_vendor_data + 4);\n p = p_vendor->p_vendor_data + 2;\n p_rc_rsp->get_caps.capability_id = u8;\n BE_STREAM_TO_UINT16(u16, p);\n if ((u16 != 1) || (p_vendor->vendor_len != 5)) {\n p_rc_rsp->get_caps.status = AVRC_STS_INTERNAL_ERR;\n } else {\n p_rc_rsp->get_caps.status = AVRC_STS_NO_ERROR;\n if (u8 == AVRC_CAP_COMPANY_ID) {\n *p_ctype = AVRC_RSP_IMPL_STBL;\n p_rc_rsp->get_caps.count = p_bta_av_cfg->num_co_ids;\n memcpy(p_rc_rsp->get_caps.param.company_id,\n p_bta_av_cfg->p_meta_co_ids,\n (p_bta_av_cfg->num_co_ids << 2));\n } else if (u8 == AVRC_CAP_EVENTS_SUPPORTED) {\n *p_ctype = AVRC_RSP_IMPL_STBL;\n p_rc_rsp->get_caps.count = p_bta_av_cfg->num_evt_ids;\n memcpy(p_rc_rsp->get_caps.param.event_id,\n p_bta_av_cfg->p_meta_evt_ids, p_bta_av_cfg->num_evt_ids);\n } else {\n APPL_TRACE_DEBUG(\"%s: Invalid capability ID: 0x%x\", __func__, u8);\n /* reject - unknown capability ID */\n p_rc_rsp->get_caps.status = AVRC_STS_BAD_PARAM;\n }\n }\n break;\n\n case AVRC_PDU_REGISTER_NOTIFICATION:\n /* make sure the event_id is implemented */\n p_rc_rsp->rsp.status = bta_av_chk_notif_evt_id(p_vendor);\n if (p_rc_rsp->rsp.status != BTA_AV_STS_NO_RSP) evt = 0;\n break;\n }\n }\n\n return evt;\n}\n", + "target": "tBTA_AV_EVT bta_av_proc_meta_cmd(tAVRC_RESPONSE* p_rc_rsp,\n tBTA_AV_RC_MSG* p_msg, uint8_t* p_ctype) {\n tBTA_AV_EVT evt = BTA_AV_META_MSG_EVT;\n uint8_t u8, pdu, *p;\n uint16_t u16;\n tAVRC_MSG_VENDOR* p_vendor = &p_msg->msg.vendor;\n\n pdu = *(p_vendor->p_vendor_data);\n p_rc_rsp->pdu = pdu;\n *p_ctype = AVRC_RSP_REJ;\n\n /* Check to ansure a valid minimum meta data length */\n if ((AVRC_MIN_META_CMD_LEN + p_vendor->vendor_len) > AVRC_META_CMD_BUF_SIZE) {\n /* reject it */\n p_rc_rsp->rsp.status = AVRC_STS_BAD_PARAM;\n APPL_TRACE_ERROR(\"%s: Invalid meta-command length: %d\", __func__,\n p_vendor->vendor_len);\n return 0;\n }\n\n /* Metadata messages only use PANEL sub-unit type */\n if (p_vendor->hdr.subunit_type != AVRC_SUB_PANEL) {\n APPL_TRACE_DEBUG(\"%s: SUBUNIT must be PANEL\", __func__);\n /* reject it */\n evt = 0;\n p_vendor->hdr.ctype = AVRC_RSP_NOT_IMPL;\n p_vendor->vendor_len = 0;\n p_rc_rsp->rsp.status = AVRC_STS_BAD_PARAM;\n } else if (!AVRC_IsValidAvcType(pdu, p_vendor->hdr.ctype)) {\n APPL_TRACE_DEBUG(\"%s: Invalid pdu/ctype: 0x%x, %d\", __func__, pdu,\n p_vendor->hdr.ctype);\n /* reject invalid message without reporting to app */\n evt = 0;\n p_rc_rsp->rsp.status = AVRC_STS_BAD_CMD;\n } else {\n switch (pdu) {\n\n case AVRC_PDU_GET_CAPABILITIES:\n /* process GetCapabilities command without reporting the event to app */\n evt = 0;\n if (p_vendor->vendor_len != 5) {\n android_errorWriteLog(0x534e4554, \"111893951\");\n p_rc_rsp->get_caps.status = AVRC_STS_INTERNAL_ERR;\n break;\n }\n u8 = *(p_vendor->p_vendor_data + 4);\n p = p_vendor->p_vendor_data + 2;\n p_rc_rsp->get_caps.capability_id = u8;\n BE_STREAM_TO_UINT16(u16, p);\n if (u16 != 1) {\n p_rc_rsp->get_caps.status = AVRC_STS_INTERNAL_ERR;\n } else {\n p_rc_rsp->get_caps.status = AVRC_STS_NO_ERROR;\n if (u8 == AVRC_CAP_COMPANY_ID) {\n *p_ctype = AVRC_RSP_IMPL_STBL;\n p_rc_rsp->get_caps.count = p_bta_av_cfg->num_co_ids;\n memcpy(p_rc_rsp->get_caps.param.company_id,\n p_bta_av_cfg->p_meta_co_ids,\n (p_bta_av_cfg->num_co_ids << 2));\n } else if (u8 == AVRC_CAP_EVENTS_SUPPORTED) {\n *p_ctype = AVRC_RSP_IMPL_STBL;\n p_rc_rsp->get_caps.count = p_bta_av_cfg->num_evt_ids;\n memcpy(p_rc_rsp->get_caps.param.event_id,\n p_bta_av_cfg->p_meta_evt_ids, p_bta_av_cfg->num_evt_ids);\n } else {\n APPL_TRACE_DEBUG(\"%s: Invalid capability ID: 0x%x\", __func__, u8);\n /* reject - unknown capability ID */\n p_rc_rsp->get_caps.status = AVRC_STS_BAD_PARAM;\n }\n }\n break;\n\n case AVRC_PDU_REGISTER_NOTIFICATION:\n /* make sure the event_id is implemented */\n p_rc_rsp->rsp.status = bta_av_chk_notif_evt_id(p_vendor);\n if (p_rc_rsp->rsp.status != BTA_AV_STS_NO_RSP) evt = 0;\n break;\n }\n }\n\n return evt;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d2b1d124d4055c2fcbe5126863487c52fd58cca1", + "input": "void MSG_WriteBits( msg_t *msg, int value, int bits ) {\n\tint\ti;\n \n \toldsize += bits;\n \n\tif ( msg->maxsize - msg->cursize < 4 ) {\n\t\tmsg->overflowed = qtrue;\n \t\treturn;\n \t}\n \n\tif ( bits == 0 || bits < -31 || bits > 32 ) {\n\t\tCom_Error( ERR_DROP, \"MSG_WriteBits: bad bits %i\", bits );\n\t}\n\n\tif ( bits < 0 ) {\n\t\tbits = -bits;\n \t}\n \n \tif ( msg->oob ) {\n \t\tif ( bits == 8 ) {\n \t\t\tmsg->data[msg->cursize] = value;\n \t\t\tmsg->cursize += 1;\n\t\t\tmsg->bit += 8;\n\t\t} else if ( bits == 16 ) {\n\t\t\tshort temp = value;\n\n\t\t\tCopyLittleShort( &msg->data[msg->cursize], &temp );\n\t\t\tmsg->cursize += 2;\n\t\t\tmsg->bit += 16;\n\t\t} else if ( bits==32 ) {\n\t\t\tCopyLittleLong( &msg->data[msg->cursize], &value );\n\t\t\tmsg->cursize += 4;\n\t\t\tmsg->bit += 32;\n\t\t} else {\n\t\t\tCom_Error( ERR_DROP, \"can't write %d bits\", bits );\n\t\t}\n\t} else {\n\t\tvalue &= (0xffffffff >> (32 - bits));\n \t\tif ( bits&7 ) {\n \t\t\tint nbits;\n \t\t\tnbits = bits&7;\n \t\t\tfor( i = 0; i < nbits; i++ ) {\n \t\t\t\tHuff_putBit( (value & 1), msg->data, &msg->bit );\n \t\t\t\tvalue = (value >> 1);\n\t\t\t}\n\t\t\tbits = bits - nbits;\n \t\t}\n \t\tif ( bits ) {\n \t\t\tfor( i = 0; i < bits; i += 8 ) {\n\t\t\t\tHuff_offsetTransmit( &msgHuff.compressor, (value & 0xff), msg->data, &msg->bit );\n \t\t\t\tvalue = (value >> 8);\n \t\t\t}\n \t\t}\n \t\tmsg->cursize = (msg->bit >> 3) + 1;\n\t}\n}\n", + "target": "void MSG_WriteBits( msg_t *msg, int value, int bits ) {\n\tint\ti;\n \n \toldsize += bits;\n \n\tif ( msg->overflowed ) {\n \t\treturn;\n \t}\n \n\tif ( bits == 0 || bits < -31 || bits > 32 ) {\n\t\tCom_Error( ERR_DROP, \"MSG_WriteBits: bad bits %i\", bits );\n\t}\n\n\tif ( bits < 0 ) {\n\t\tbits = -bits;\n \t}\n \n \tif ( msg->oob ) {\n\t\tif ( msg->cursize + ( bits >> 3 ) > msg->maxsize ) {\n\t\t\tmsg->overflowed = qtrue;\n\t\t\treturn;\n\t\t}\n\n \t\tif ( bits == 8 ) {\n \t\t\tmsg->data[msg->cursize] = value;\n \t\t\tmsg->cursize += 1;\n\t\t\tmsg->bit += 8;\n\t\t} else if ( bits == 16 ) {\n\t\t\tshort temp = value;\n\n\t\t\tCopyLittleShort( &msg->data[msg->cursize], &temp );\n\t\t\tmsg->cursize += 2;\n\t\t\tmsg->bit += 16;\n\t\t} else if ( bits==32 ) {\n\t\t\tCopyLittleLong( &msg->data[msg->cursize], &value );\n\t\t\tmsg->cursize += 4;\n\t\t\tmsg->bit += 32;\n\t\t} else {\n\t\t\tCom_Error( ERR_DROP, \"can't write %d bits\", bits );\n\t\t}\n\t} else {\n\t\tvalue &= (0xffffffff >> (32 - bits));\n \t\tif ( bits&7 ) {\n \t\t\tint nbits;\n \t\t\tnbits = bits&7;\n\t\t\tif ( msg->bit + nbits > msg->maxsize << 3 ) {\n\t\t\t\tmsg->overflowed = qtrue;\n\t\t\t\treturn;\n\t\t\t}\n \t\t\tfor( i = 0; i < nbits; i++ ) {\n \t\t\t\tHuff_putBit( (value & 1), msg->data, &msg->bit );\n \t\t\t\tvalue = (value >> 1);\n\t\t\t}\n\t\t\tbits = bits - nbits;\n \t\t}\n \t\tif ( bits ) {\n \t\t\tfor( i = 0; i < bits; i += 8 ) {\n\t\t\t\tHuff_offsetTransmit( &msgHuff.compressor, (value & 0xff), msg->data, &msg->bit, msg->maxsize << 3 );\n \t\t\t\tvalue = (value >> 8);\n\n\t\t\t\tif ( msg->bit > msg->maxsize << 3 ) {\n\t\t\t\t\tmsg->overflowed = qtrue;\n\t\t\t\t\treturn;\n\t\t\t\t}\n \t\t\t}\n \t\t}\n \t\tmsg->cursize = (msg->bit >> 3) + 1;\n\t}\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#39595f8d4dffcb644d438106dcb64a30c139ff0e", + "input": "void WallpaperManager::OnWallpaperDecoded(\n const AccountId& account_id,\n const wallpaper::WallpaperInfo& info,\n bool update_wallpaper,\n MovableOnDestroyCallbackHolder on_finish,\n std::unique_ptr user_image) {\n DCHECK_CURRENTLY_ON(BrowserThread::UI);\n TRACE_EVENT_ASYNC_END0(\"ui\", \"LoadAndDecodeWallpaper\", this);\n\n if (user_image->image().isNull()) {\n wallpaper::WallpaperInfo default_info(\n \"\", wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED, wallpaper::DEFAULT,\n base::Time::Now().LocalMidnight());\n SetUserWallpaperInfo(account_id, default_info, true);\n if (update_wallpaper)\n DoSetDefaultWallpaper(account_id, std::move(on_finish));\n return;\n }\n \n wallpaper_cache_[account_id].second = user_image->image();\n\n if (update_wallpaper)\n SetWallpaper(user_image->image(), info);\n}\n", + "target": "void WallpaperManager::OnWallpaperDecoded(\n const AccountId& account_id,\n const wallpaper::WallpaperInfo& info,\n bool update_wallpaper,\n MovableOnDestroyCallbackHolder on_finish,\n std::unique_ptr user_image) {\n DCHECK_CURRENTLY_ON(BrowserThread::UI);\n TRACE_EVENT_ASYNC_END0(\"ui\", \"LoadAndDecodeWallpaper\", this);\n\n if (user_image->image().isNull()) {\n wallpaper::WallpaperInfo default_info(\n \"\", wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED, wallpaper::DEFAULT,\n base::Time::Now().LocalMidnight());\n SetUserWallpaperInfo(account_id, default_info, true);\n DoSetDefaultWallpaper(account_id, update_wallpaper, std::move(on_finish));\n return;\n }\n \n wallpaper_cache_[account_id].second = user_image->image();\n\n if (update_wallpaper)\n SetWallpaper(user_image->image(), info);\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c67d275803dc6ea22c558d06b1f7ba9f94cd8de3", + "input": "build_config(char *prefix, struct server *server)\n {\n char *path = NULL;\n int path_size = strlen(prefix) + strlen(server->port) + 20;\n\n path = ss_malloc(path_size);\n snprintf(path, path_size, \"%s/.shadowsocks_%s.conf\", prefix, server->port);\n FILE *f = fopen(path, \"w+\");\n if (f == NULL) {\n if (verbose) {\n LOGE(\"unable to open config file\");\n }\n ss_free(path);\n return;\n }\n fprintf(f, \"{\\n\");\n fprintf(f, \"\\\"server_port\\\":%d,\\n\", atoi(server->port));\n fprintf(f, \"\\\"password\\\":\\\"%s\\\"\", server->password);\n if (server->fast_open[0]) fprintf(f, \",\\n\\\"fast_open\\\": %s\", server->fast_open);\n if (server->mode) fprintf(f, \",\\n\\\"mode\\\":\\\"%s\\\"\", server->mode);\n if (server->method) fprintf(f, \",\\n\\\"method\\\":\\\"%s\\\"\", server->method);\n if (server->plugin) fprintf(f, \",\\n\\\"plugin\\\":\\\"%s\\\"\", server->plugin);\n if (server->plugin_opts) fprintf(f, \",\\n\\\"plugin_opts\\\":\\\"%s\\\"\", server->plugin_opts);\n fprintf(f, \"\\n}\\n\");\n fclose(f);\n ss_free(path);\n}\n", + "target": "build_config(char *prefix, struct server *server)\nbuild_config(char *prefix, struct manager_ctx *manager, struct server *server)\n {\n char *path = NULL;\n int path_size = strlen(prefix) + strlen(server->port) + 20;\n\n path = ss_malloc(path_size);\n snprintf(path, path_size, \"%s/.shadowsocks_%s.conf\", prefix, server->port);\n FILE *f = fopen(path, \"w+\");\n if (f == NULL) {\n if (verbose) {\n LOGE(\"unable to open config file\");\n }\n ss_free(path);\n return;\n }\n fprintf(f, \"{\\n\");\n fprintf(f, \"\\\"server_port\\\":%d,\\n\", atoi(server->port));\n fprintf(f, \"\\\"password\\\":\\\"%s\\\"\", server->password);\n if (server->method)\n fprintf(f, \",\\n\\\"method\\\":\\\"%s\\\"\", server->method);\n else if (manager->method)\n fprintf(f, \",\\n\\\"method\\\":\\\"%s\\\"\", manager->method);\n if (server->fast_open[0])\n fprintf(f, \",\\n\\\"fast_open\\\": %s\", server->fast_open);\n if (server->mode)\n fprintf(f, \",\\n\\\"mode\\\":\\\"%s\\\"\", server->mode);\n if (server->plugin)\n fprintf(f, \",\\n\\\"plugin\\\":\\\"%s\\\"\", server->plugin);\n if (server->plugin_opts)\n fprintf(f, \",\\n\\\"plugin_opts\\\":\\\"%s\\\"\", server->plugin_opts);\n fprintf(f, \"\\n}\\n\");\n fclose(f);\n ss_free(path);\n}\n", + "vul_type": "cwe-78", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04aaacb936a08d70862d6d9d7e8354721ae46be8", + "input": " void SetupMockGroup() {\n std::unique_ptr info(MakeMockResponseInfo());\n const int kMockInfoSize = GetResponseInfoSize(info.get());\n\n scoped_refptr group(\n new AppCacheGroup(service_->storage(), kManifestUrl, kMockGroupId));\n scoped_refptr cache(\n new AppCache(service_->storage(), kMockCacheId));\n cache->AddEntry(\n kManifestUrl,\n AppCacheEntry(AppCacheEntry::MANIFEST, kMockResponseId,\n kMockInfoSize + kMockBodySize));\n cache->set_complete(true);\n group->AddCache(cache.get());\n mock_storage()->AddStoredGroup(group.get());\n mock_storage()->AddStoredCache(cache.get());\n }\n", + "target": " void SetupMockGroup() {\n std::unique_ptr info(MakeMockResponseInfo());\n const int kMockInfoSize = GetResponseInfoSize(info.get());\n\n scoped_refptr group(\n new AppCacheGroup(service_->storage(), kManifestUrl, kMockGroupId));\n scoped_refptr cache(\n new AppCache(service_->storage(), kMockCacheId));\n cache->AddEntry(\n kManifestUrl,\n AppCacheEntry(AppCacheEntry::MANIFEST, kMockResponseId,\n kMockInfoSize + kMockBodySize, /*padding_size=*/0));\n cache->set_complete(true);\n group->AddCache(cache.get());\n mock_storage()->AddStoredGroup(group.get());\n mock_storage()->AddStoredCache(cache.get());\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3b0d77670a0613f409110817455d2137576b485a", + "input": "bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper,\n NaClSubprocess* subprocess,\n const Manifest* manifest,\n bool should_report_uma,\n ErrorInfo* error_info,\n pp::CompletionCallback init_done_cb,\n pp::CompletionCallback crash_cb) {\n ServiceRuntime* new_service_runtime =\n new ServiceRuntime(this, manifest, should_report_uma, init_done_cb,\n crash_cb);\n subprocess->set_service_runtime(new_service_runtime);\n PLUGIN_PRINTF((\"Plugin::LoadNaClModuleCommon (service_runtime=%p)\\n\",\n static_cast(new_service_runtime)));\n if (NULL == new_service_runtime) {\n error_info->SetReport(ERROR_SEL_LDR_INIT,\n \"sel_ldr init failure \" + subprocess->description());\n return false;\n }\n \n bool service_runtime_started =\n new_service_runtime->Start(wrapper,\n error_info,\n manifest_base_url());\n PLUGIN_PRINTF((\"Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\\n\",\n service_runtime_started));\n if (!service_runtime_started) {\n return false;\n }\n const PPB_NaCl_Private* ppb_nacl = GetNaclInterface();\n if (ppb_nacl->StartPpapiProxy(pp_instance())) {\n using_ipc_proxy_ = true;\n CHECK(init_done_cb.pp_completion_callback().func != NULL);\n PLUGIN_PRINTF((\"Plugin::LoadNaClModuleCommon, started ipc proxy.\\n\"));\n pp::Module::Get()->core()->CallOnMainThread(0, init_done_cb, PP_OK);\n }\n return true;\n }\n", + "target": "bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper,\n NaClSubprocess* subprocess,\n const Manifest* manifest,\n bool should_report_uma,\n ErrorInfo* error_info,\n pp::CompletionCallback init_done_cb,\n pp::CompletionCallback crash_cb) {\n ServiceRuntime* new_service_runtime =\n new ServiceRuntime(this, manifest, should_report_uma, init_done_cb,\n crash_cb);\n subprocess->set_service_runtime(new_service_runtime);\n PLUGIN_PRINTF((\"Plugin::LoadNaClModuleCommon (service_runtime=%p)\\n\",\n static_cast(new_service_runtime)));\n if (NULL == new_service_runtime) {\n error_info->SetReport(ERROR_SEL_LDR_INIT,\n \"sel_ldr init failure \" + subprocess->description());\n return false;\n }\n \n bool service_runtime_started =\n new_service_runtime->Start(wrapper, error_info, manifest_base_url());\n PLUGIN_PRINTF((\"Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\\n\",\n service_runtime_started));\n if (!service_runtime_started) {\n return false;\n }\n return true;\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#257578a23d1537a2d235aaa2b1488ee4f818e360", + "input": "static void save_text_if_changed(const char *name, const char *new_value)\n{\n /* a text value can't be change if the file is not loaded */\n /* returns NULL if the name is not found; otherwise nonzero */\n if (!g_hash_table_lookup(g_loaded_texts, name))\n return;\n\n const char *old_value = g_cd ? problem_data_get_content_or_NULL(g_cd, name) : \"\";\n if (!old_value)\n old_value = \"\";\n if (strcmp(new_value, old_value) != 0)\n {\n struct dump_dir *dd = wizard_open_directory_for_writing(g_dump_dir_name);\n if (dd)\n dd_save_text(dd, name, new_value);\n \n dd_close(dd);\n problem_data_reload_from_dump_dir();\n update_gui_state_from_problem_data(/* don't update selected event */ 0);\n }\n }\n", + "target": "static void save_text_if_changed(const char *name, const char *new_value)\n{\n /* a text value can't be change if the file is not loaded */\n /* returns NULL if the name is not found; otherwise nonzero */\n if (!g_hash_table_lookup(g_loaded_texts, name))\n return;\n\n const char *old_value = g_cd ? problem_data_get_content_or_NULL(g_cd, name) : \"\";\n if (!old_value)\n old_value = \"\";\n if (strcmp(new_value, old_value) != 0)\n {\n struct dump_dir *dd = wizard_open_directory_for_writing(g_dump_dir_name);\n if (dd)\n dd_save_text(dd, name, new_value);\n \n dd_close(dd);\n }\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "const Track* Tracks::GetTrackByIndex(unsigned long idx) const\n{\n const ptrdiff_t count = m_trackEntriesEnd - m_trackEntries;\n if (idx >= static_cast(count))\n return NULL;\n return m_trackEntries[idx];\n }\n", + "target": "const Track* Tracks::GetTrackByIndex(unsigned long idx) const\n return m_trackEntries[idx];\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4f65a3e4eedaffa1efcf9ee1eb08f0b504fbc31a", + "input": "static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter)\n{\n\tdouble width_d;\n\tdouble scale_f_d = 1.0;\n\tconst double filter_width_d = DEFAULT_BOX_RADIUS;\n\tint windows_size;\n\tunsigned int u;\n\tLineContribType *res;\n\n\tif (scale_d < 1.0) {\n\t\twidth_d = filter_width_d / scale_d;\n\t\tscale_f_d = scale_d;\n\t} else {\n\t\twidth_d= filter_width_d;\n\t}\n\n\twindows_size = 2 * (int)ceil(width_d) + 1;\n\tres = _gdContributionsAlloc(line_size, windows_size);\n\n\tfor (u = 0; u < line_size; u++) {\n\t\tconst double dCenter = (double)u / scale_d;\n\t\t/* get the significant edge points affecting the pixel */\n\t\tregister int iLeft = MAX(0, (int)floor (dCenter - width_d));\n\t\tint iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1);\n \t\tdouble dTotalWeight = 0.0;\n \t\tint iSrc;\n \n\t\tres->ContribRow[u].Left = iLeft;\n\t\tres->ContribRow[u].Right = iRight;\n \t\t/* Cut edge points to fit in filter window in case of spill-off */\n \t\tif (iRight - iLeft + 1 > windows_size) {\n \t\t\tif (iLeft < ((int)src_size - 1 / 2)) {\n\t\t\t\tiLeft++;\n\t\t\t} else {\n\t\t\t\tiRight--;\n \t\t\t}\n \t\t}\n \n \t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n \t\t\tdTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc)));\n \t\t}\n\n\t\tif (dTotalWeight < 0.0) {\n\t\t\t_gdContributionsFree(res);\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (dTotalWeight > 0.0) {\n\t\t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n\t\t\t\tres->ContribRow[u].Weights[iSrc-iLeft] /= dTotalWeight;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}\n", + "target": "static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter)\n{\n\tdouble width_d;\n\tdouble scale_f_d = 1.0;\n\tconst double filter_width_d = DEFAULT_BOX_RADIUS;\n\tint windows_size;\n\tunsigned int u;\n\tLineContribType *res;\n\n\tif (scale_d < 1.0) {\n\t\twidth_d = filter_width_d / scale_d;\n\t\tscale_f_d = scale_d;\n\t} else {\n\t\twidth_d= filter_width_d;\n\t}\n\n\twindows_size = 2 * (int)ceil(width_d) + 1;\n\tres = _gdContributionsAlloc(line_size, windows_size);\n\n\tfor (u = 0; u < line_size; u++) {\n\t\tconst double dCenter = (double)u / scale_d;\n\t\t/* get the significant edge points affecting the pixel */\n\t\tregister int iLeft = MAX(0, (int)floor (dCenter - width_d));\n\t\tint iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1);\n \t\tdouble dTotalWeight = 0.0;\n \t\tint iSrc;\n \n \t\t/* Cut edge points to fit in filter window in case of spill-off */\n \t\tif (iRight - iLeft + 1 > windows_size) {\n \t\t\tif (iLeft < ((int)src_size - 1 / 2)) {\n\t\t\t\tiLeft++;\n\t\t\t} else {\n\t\t\t\tiRight--;\n \t\t\t}\n \t\t}\n \n\t\tres->ContribRow[u].Left = iLeft;\n\t\tres->ContribRow[u].Right = iRight;\n\n \t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n \t\t\tdTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc)));\n \t\t}\n\n\t\tif (dTotalWeight < 0.0) {\n\t\t\t_gdContributionsFree(res);\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (dTotalWeight > 0.0) {\n\t\t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n\t\t\t\tres->ContribRow[u].Weights[iSrc-iLeft] /= dTotalWeight;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#39f226a9c137f547e12afde972eeba7551124493", + "input": "static boolean ReadICCProfile(j_decompress_ptr jpeg_info)\n{\n char\n magick[12];\n\n ErrorManager\n *error_manager;\n\n ExceptionInfo\n *exception;\n\n Image\n *image;\n\n MagickBooleanType\n status;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n length;\n\n StringInfo\n *icc_profile,\n *profile;\n\n /*\n Read color profile.\n */\n length=(size_t) ((size_t) GetCharacter(jpeg_info) << 8);\n length+=(size_t) GetCharacter(jpeg_info);\n length-=2;\n if (length <= 14)\n {\n while (length-- > 0)\n if (GetCharacter(jpeg_info) == EOF)\n break;\n return(TRUE);\n }\n for (i=0; i < 12; i++)\n magick[i]=(char) GetCharacter(jpeg_info);\n if (LocaleCompare(magick,ICC_PROFILE) != 0)\n {\n /*\n Not a ICC profile, return.\n */\n for (i=0; i < (ssize_t) (length-12); i++)\n if (GetCharacter(jpeg_info) == EOF)\n break;\n return(TRUE);\n }\n (void) GetCharacter(jpeg_info); /* id */\n (void) GetCharacter(jpeg_info); /* markers */\n length-=14;\n error_manager=(ErrorManager *) jpeg_info->client_data;\n exception=error_manager->exception;\n image=error_manager->image;\n profile=BlobToStringInfo((const void *) NULL,length);\n if (profile == (StringInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(FALSE);\n }\n error_manager->profile=profile;\n p=GetStringInfoDatum(profile);\n for (i=0; i < (ssize_t) length; i++)\n {\n int\n c;\n\n c=GetCharacter(jpeg_info);\n if (c == EOF)\n break;\n *p++=(unsigned char) c;\n }\n if (i != (ssize_t) length)\n {\n profile=DestroyStringInfo(profile);\n (void) ThrowMagickException(exception,GetMagickModule(),\n CorruptImageError,\"InsufficientImageDataInFile\",\"`%s'\",\n image->filename);\n return(FALSE);\n }\n error_manager->profile=NULL;\n icc_profile=(StringInfo *) GetImageProfile(image,\"icc\");\n if (icc_profile != (StringInfo *) NULL)\n {\n ConcatenateStringInfo(icc_profile,profile);\n profile=DestroyStringInfo(profile);\n }\n else\n {\n status=SetImageProfile(image,\"icc\",profile,exception);\n profile=DestroyStringInfo(profile);\n if (status == MagickFalse)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(FALSE);\n }\n }\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"Profile: ICC, %.20g bytes\",(double) length);\n return(TRUE);\n}\n", + "target": "static boolean ReadICCProfile(j_decompress_ptr jpeg_info)\n{\n char\n magick[12];\n\n ErrorManager\n *error_manager;\n\n ExceptionInfo\n *exception;\n\n Image\n *image;\n\n MagickBooleanType\n status;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n length;\n\n StringInfo\n *icc_profile,\n *profile;\n\n /*\n Read color profile.\n */\n length=(size_t) ((size_t) GetCharacter(jpeg_info) << 8);\n length+=(size_t) GetCharacter(jpeg_info);\n length-=2;\n if (length <= 14)\n {\n while (length-- > 0)\n if (GetCharacter(jpeg_info) == EOF)\n break;\n return(TRUE);\n }\n for (i=0; i < 12; i++)\n magick[i]=(char) GetCharacter(jpeg_info);\n if (LocaleCompare(magick,ICC_PROFILE) != 0)\n {\n /*\n Not a ICC profile, return.\n */\n for (i=0; i < (ssize_t) (length-12); i++)\n if (GetCharacter(jpeg_info) == EOF)\n break;\n return(TRUE);\n }\n (void) GetCharacter(jpeg_info); /* id */\n (void) GetCharacter(jpeg_info); /* markers */\n length-=14;\n error_manager=(ErrorManager *) jpeg_info->client_data;\n exception=error_manager->exception;\n image=error_manager->image;\n profile=BlobToStringInfo((const void *) NULL,length);\n if (profile == (StringInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(FALSE);\n }\n error_manager->profile=profile;\n p=GetStringInfoDatum(profile);\n for (i=0; i < (ssize_t) length; i++)\n {\n int\n c;\n\n c=GetCharacter(jpeg_info);\n if (c == EOF)\n break;\n *p++=(unsigned char) c;\n }\n error_manager->profile=NULL;\n if (i != (ssize_t) length)\n {\n profile=DestroyStringInfo(profile);\n (void) ThrowMagickException(exception,GetMagickModule(),\n CorruptImageError,\"InsufficientImageDataInFile\",\"`%s'\",\n image->filename);\n return(FALSE);\n }\n icc_profile=(StringInfo *) GetImageProfile(image,\"icc\");\n if (icc_profile != (StringInfo *) NULL)\n {\n ConcatenateStringInfo(icc_profile,profile);\n profile=DestroyStringInfo(profile);\n }\n else\n {\n status=SetImageProfile(image,\"icc\",profile,exception);\n profile=DestroyStringInfo(profile);\n if (status == MagickFalse)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(FALSE);\n }\n }\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"Profile: ICC, %.20g bytes\",(double) length);\n return(TRUE);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long long Cluster::GetFirstTime() const\n{\n const BlockEntry* pEntry;\n const long status = GetFirst(pEntry);\n if (status < 0) //error\n return status;\n if (pEntry == NULL) //empty cluster\n return GetTime();\n const Block* const pBlock = pEntry->GetBlock();\n assert(pBlock);\n return pBlock->GetTime(this);\n}\n", + "target": "long long Cluster::GetFirstTime() const\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e9372a1bfd3588a80fcf49aa07321f0971dd6091", + "input": "v8::Handle V8SVGLength::convertToSpecifiedUnitsCallback(const v8::Arguments& args)\n{\n INC_STATS(\"DOM.SVGLength.convertToSpecifiedUnits\");\n SVGPropertyTearOff* wrapper = V8SVGLength::toNative(args.Holder());\n if (wrapper->role() == AnimValRole) {\n V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR, args.GetIsolate());\n return v8::Handle();\n }\n \n if (args.Length() < 1)\n return V8Proxy::throwNotEnoughArgumentsError();\n \n SVGLength& imp = wrapper->propertyReference();\n ExceptionCode ec = 0;\n EXCEPTION_BLOCK(int, unitType, toUInt32(args[0]));\n SVGLengthContext lengthContext(wrapper->contextElement());\n imp.convertToSpecifiedUnits(unitType, lengthContext, ec);\n if (UNLIKELY(ec))\n V8Proxy::setDOMException(ec, args.GetIsolate());\n else\n wrapper->commitChange();\n return v8::Handle();\n}\n", + "target": "v8::Handle V8SVGLength::convertToSpecifiedUnitsCallback(const v8::Arguments& args)\n{\n INC_STATS(\"DOM.SVGLength.convertToSpecifiedUnits\");\n SVGPropertyTearOff* wrapper = V8SVGLength::toNative(args.Holder());\n if (wrapper->role() == AnimValRole) {\n V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR, args.GetIsolate());\n return v8::Handle();\n }\n \n if (args.Length() < 1)\n return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());\n \n SVGLength& imp = wrapper->propertyReference();\n ExceptionCode ec = 0;\n EXCEPTION_BLOCK(int, unitType, toUInt32(args[0]));\n SVGLengthContext lengthContext(wrapper->contextElement());\n imp.convertToSpecifiedUnits(unitType, lengthContext, ec);\n if (UNLIKELY(ec))\n V8Proxy::setDOMException(ec, args.GetIsolate());\n else\n wrapper->commitChange();\n return v8::Handle();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#16dcd30c215801941d9890859fd79a234128fc3e", + "input": "void DownloadFileManager::CancelDownloadOnRename(\n DownloadId global_id, net::Error rename_error) {\n DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));\n DownloadFile* download_file = GetDownloadFile(global_id);\n if (!download_file)\n return;\n DownloadManager* download_manager = download_file->GetDownloadManager();\n DCHECK(download_manager);\n BrowserThread::PostTask(\n BrowserThread::UI, FROM_HERE,\n base::Bind(&DownloadManager::OnDownloadInterrupted,\n download_manager,\n global_id.local(),\n download_file->BytesSoFar(),\n download_file->GetHashState(),\n content::ConvertNetErrorToInterruptReason(\n rename_error,\n content::DOWNLOAD_INTERRUPT_FROM_DISK)));\n}\n", + "target": "void DownloadFileManager::CancelDownloadOnRename(\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0474237508f39c4f783208123431815f1ededb76", + "input": "MagickExport void *AcquireQuantumMemory(const size_t count,const size_t quantum)\n{\n size_t\n extent;\n \n if (CheckMemoryOverflow(count,quantum) != MagickFalse)\n return((void *) NULL);\n extent=count*quantum;\n return(AcquireMagickMemory(extent));\n}\n", + "target": "MagickExport void *AcquireQuantumMemory(const size_t count,const size_t quantum)\n{\n size_t\n extent;\n \n if (HeapOverflowSanityCheck(count,quantum) != MagickFalse)\n return((void *) NULL);\n extent=count*quantum;\n return(AcquireMagickMemory(extent));\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4f9c9adef4036aff60b734b4a0045c43c320fe1d", + "input": "void testRandomDecodeAfterClearFrameBufferCache(const char* gifFile)\n {\n SCOPED_TRACE(gifFile);\n \n RefPtr data = readFile(gifFile);\n ASSERT_TRUE(data.get());\n Vector baselineHashes;\n createDecodingBaseline(data.get(), &baselineHashes);\n size_t frameCount = baselineHashes.size();\n\n OwnPtr decoder = createDecoder();\n decoder->setData(data.get(), true);\n for (size_t clearExceptFrame = 0; clearExceptFrame < frameCount; ++clearExceptFrame) {\n decoder->clearCacheExceptFrame(clearExceptFrame);\n const size_t skippingStep = 5;\n for (size_t i = 0; i < skippingStep; ++i) {\n for (size_t j = 0; j < frameCount; j += skippingStep) {\n SCOPED_TRACE(testing::Message() << \"Random i:\" << i << \" j:\" << j);\n ImageFrame* frame = decoder->frameBufferAtIndex(j);\n EXPECT_EQ(baselineHashes[j], hashSkBitmap(frame->getSkBitmap()));\n }\n }\n }\n}\n", + "target": "void testRandomDecodeAfterClearFrameBufferCache(const char* gifFile)\nvoid testRandomDecodeAfterClearFrameBufferCache(const char* dir, const char* gifFile)\n {\n SCOPED_TRACE(gifFile);\n \n RefPtr data = readFile(dir, gifFile);\n ASSERT_TRUE(data.get());\n Vector baselineHashes;\n createDecodingBaseline(data.get(), &baselineHashes);\n size_t frameCount = baselineHashes.size();\n\n OwnPtr decoder = createDecoder();\n decoder->setData(data.get(), true);\n for (size_t clearExceptFrame = 0; clearExceptFrame < frameCount; ++clearExceptFrame) {\n decoder->clearCacheExceptFrame(clearExceptFrame);\n const size_t skippingStep = 5;\n for (size_t i = 0; i < skippingStep; ++i) {\n for (size_t j = 0; j < frameCount; j += skippingStep) {\n SCOPED_TRACE(testing::Message() << \"Random i:\" << i << \" j:\" << j);\n ImageFrame* frame = decoder->frameBufferAtIndex(j);\n EXPECT_EQ(baselineHashes[j], hashSkBitmap(frame->getSkBitmap()));\n }\n }\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#42a25c46b844518ff0d0b920c20c519e1417be69", + "input": "status_t MediaPlayer::setDataSource(\n const sp &httpService,\n const char *url, const KeyedVector *headers)\n{\n\n ALOGV(\"setDataSource(%s)\", url);\n status_t err = BAD_VALUE;\n if (url != NULL) {\n const sp& service(getMediaPlayerService());\n if (service != 0) {\n sp player(service->create(this, mAudioSessionId));\n if ((NO_ERROR != doSetRetransmitEndpoint(player)) ||\n (NO_ERROR != player->setDataSource(httpService, url, headers))) {\n player.clear();\n }\n err = attachNewPlayer(player);\n }\n }\n return err;\n}\n", + "target": "status_t MediaPlayer::setDataSource(\n const sp &httpService,\n const char *url, const KeyedVector *headers)\n{\n\n ALOGV(\"setDataSource(%s)\", url);\n status_t err = BAD_VALUE;\n if (url != NULL) {\n const sp service(getMediaPlayerService());\n if (service != 0) {\n sp player(service->create(this, mAudioSessionId));\n if ((NO_ERROR != doSetRetransmitEndpoint(player)) ||\n (NO_ERROR != player->setDataSource(httpService, url, headers))) {\n player.clear();\n }\n err = attachNewPlayer(player);\n }\n }\n return err;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6297a117d77fa3a0df2e21ca926a92c231819cd5", + "input": "PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC TSRMLS_DC)\n{\n\tphp_stream *stream;\n\tphp_stream_memory_data *ms;\n \n if ((stream = php_stream_memory_create_rel(mode)) != NULL) {\n ms = (php_stream_memory_data*)stream->abstract;\n if (mode == TEMP_STREAM_READONLY || mode == TEMP_STREAM_TAKE_BUFFER) {\n /* use the buffer directly */\n ms->data = buf;\n\t\t\tms->fsize = length;\n\t\t} else {\n\t\t\tif (length) {\n\t\t\t\tassert(buf != NULL);\n\t\t\t\tphp_stream_write(stream, buf, length);\n\t\t\t}\n\t\t}\n\t}\n\treturn stream;\n}\n", + "target": "PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC TSRMLS_DC)\n{\n\tphp_stream *stream;\n\tphp_stream_memory_data *ms;\n \n if ((stream = php_stream_memory_create_rel(mode)) != NULL) {\n ms = (php_stream_memory_data*)stream->abstract;\n\n if (mode == TEMP_STREAM_READONLY || mode == TEMP_STREAM_TAKE_BUFFER) {\n /* use the buffer directly */\n ms->data = buf;\n\t\t\tms->fsize = length;\n\t\t} else {\n\t\t\tif (length) {\n\t\t\t\tassert(buf != NULL);\n\t\t\t\tphp_stream_write(stream, buf, length);\n\t\t\t}\n\t\t}\n\t}\n\treturn stream;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6f163e07ae68654d7ac5268cbb7565f6df79ad85", + "input": "void test_base64_lengths(void)\n{\n const char *in = \"FuseMuse\";\n char out1[32];\n char out2[32];\n size_t enclen;\n int declen;\n\n /* Encoding a zero-length string should fail */\n enclen = mutt_b64_encode(out1, in, 0, 32);\n if (!TEST_CHECK(enclen == 0))\n {\n TEST_MSG(\"Expected: %zu\", 0);\n TEST_MSG(\"Actual : %zu\", enclen);\n }\n \n /* Decoding a zero-length string should fail, too */\n out1[0] = '\\0';\n declen = mutt_b64_decode(out2, out1);\n if (!TEST_CHECK(declen == -1))\n {\n TEST_MSG(\"Expected: %zu\", -1);\n TEST_MSG(\"Actual : %zu\", declen);\n }\n\n /* Encode one to eight bytes, check the lengths of the returned string */\n for (size_t i = 1; i <= 8; ++i)\n {\n enclen = mutt_b64_encode(out1, in, i, 32);\n size_t exp = ((i + 2) / 3) << 2;\n if (!TEST_CHECK(enclen == exp))\n {\n TEST_MSG(\"Expected: %zu\", exp);\n TEST_MSG(\"Actual : %zu\", enclen);\n }\n declen = mutt_b64_decode(out2, out1);\n if (!TEST_CHECK(declen == i))\n {\n TEST_MSG(\"Expected: %zu\", i);\n TEST_MSG(\"Actual : %zu\", declen);\n }\n out2[declen] = '\\0';\n if (!TEST_CHECK(strncmp(out2, in, i) == 0))\n {\n TEST_MSG(\"Expected: %s\", in);\n TEST_MSG(\"Actual : %s\", out2);\n }\n }\n}\n", + "target": "void test_base64_lengths(void)\n{\n const char *in = \"FuseMuse\";\n char out1[32];\n char out2[32];\n size_t enclen;\n int declen;\n\n /* Encoding a zero-length string should fail */\n enclen = mutt_b64_encode(out1, in, 0, 32);\n if (!TEST_CHECK(enclen == 0))\n {\n TEST_MSG(\"Expected: %zu\", 0);\n TEST_MSG(\"Actual : %zu\", enclen);\n }\n \n /* Decoding a zero-length string should fail, too */\n out1[0] = '\\0';\n declen = mutt_b64_decode(out2, out1, sizeof(out2));\n if (!TEST_CHECK(declen == -1))\n {\n TEST_MSG(\"Expected: %zu\", -1);\n TEST_MSG(\"Actual : %zu\", declen);\n }\n\n /* Encode one to eight bytes, check the lengths of the returned string */\n for (size_t i = 1; i <= 8; ++i)\n {\n enclen = mutt_b64_encode(out1, in, i, 32);\n size_t exp = ((i + 2) / 3) << 2;\n if (!TEST_CHECK(enclen == exp))\n {\n TEST_MSG(\"Expected: %zu\", exp);\n TEST_MSG(\"Actual : %zu\", enclen);\n }\n declen = mutt_b64_decode(out2, out1, sizeof(out2));\n if (!TEST_CHECK(declen == i))\n {\n TEST_MSG(\"Expected: %zu\", i);\n TEST_MSG(\"Actual : %zu\", declen);\n }\n out2[declen] = '\\0';\n if (!TEST_CHECK(strncmp(out2, in, i) == 0))\n {\n TEST_MSG(\"Expected: %s\", in);\n TEST_MSG(\"Actual : %s\", out2);\n }\n }\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b45cb1b665a14b0175b9cb1502ef7168e1fe0d5d", + "input": " static int get_exif_tag_int_value(struct iw_exif_state *e, unsigned int tag_pos,\n\tunsigned int *pv)\n{\n \tunsigned int field_type;\n \tunsigned int value_count;\n \n\tfield_type = iw_get_ui16_e(&e->d[tag_pos+2],e->endian);\n\tvalue_count = iw_get_ui32_e(&e->d[tag_pos+4],e->endian);\n \n \tif(value_count!=1) return 0;\n \n \tif(field_type==3) { // SHORT (uint16)\n\t\t*pv = iw_get_ui16_e(&e->d[tag_pos+8],e->endian);\n \t\treturn 1;\n \t}\n \telse if(field_type==4) { // LONG (uint32)\n\t\t*pv = iw_get_ui32_e(&e->d[tag_pos+8],e->endian);\n \t\treturn 1;\n \t}\n \n\treturn 0;\n}\n", + "target": " static int get_exif_tag_int_value(struct iw_exif_state *e, unsigned int tag_pos,\n\tunsigned int *pv)\n{\n \tunsigned int field_type;\n \tunsigned int value_count;\n \n\tfield_type = get_exif_ui16(e, tag_pos+2);\n\tvalue_count = get_exif_ui32(e, tag_pos+4);\n \n \tif(value_count!=1) return 0;\n \n \tif(field_type==3) { // SHORT (uint16)\n\t\t*pv = get_exif_ui16(e, tag_pos+8);\n \t\treturn 1;\n \t}\n \telse if(field_type==4) { // LONG (uint32)\n\t\t*pv = get_exif_ui32(e, tag_pos+8);\n \t\treturn 1;\n \t}\n \n\treturn 0;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d926098e2e2be270c80a5ba25ab8a611b80b8556", + "input": "void RenderViewTest::SetUp() {\n blink::initialize(blink_platform_impl_.Get());\n\n content_client_.reset(CreateContentClient());\n content_browser_client_.reset(CreateContentBrowserClient());\n content_renderer_client_.reset(CreateContentRendererClient());\n SetContentClient(content_client_.get());\n SetBrowserClientForTesting(content_browser_client_.get());\n SetRendererClientForTesting(content_renderer_client_.get());\n\n if (!render_thread_)\n render_thread_.reset(new MockRenderThread());\n render_thread_->set_routing_id(kRouteId);\n render_thread_->set_surface_id(kSurfaceId);\n render_thread_->set_new_window_routing_id(kNewWindowRouteId);\n render_thread_->set_new_frame_routing_id(kNewFrameRouteId);\n\n#if defined(OS_MACOSX)\n autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool());\n#endif\n command_line_.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM));\n params_.reset(new MainFunctionParams(*command_line_));\n platform_.reset(new RendererMainPlatformDelegate(*params_));\n platform_->PlatformInitialize();\n\n std::string flags(\"--expose-gc\");\n v8::V8::SetFlagsFromString(flags.c_str(), static_cast(flags.size()));\n\n RenderThreadImpl::RegisterSchemes();\n\n if (!ui::ResourceBundle::HasSharedInstance())\n ui::ResourceBundle::InitSharedInstanceWithLocale(\n \"en-US\", NULL, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);\n\n compositor_deps_.reset(new FakeCompositorDependencies);\n mock_process_.reset(new MockRenderProcess);\n\n ViewMsg_New_Params view_params;\n view_params.opener_frame_route_id = MSG_ROUTING_NONE;\n view_params.window_was_created_with_opener = false;\n view_params.renderer_preferences = RendererPreferences();\n view_params.web_preferences = WebPreferences();\n view_params.view_id = kRouteId;\n view_params.main_frame_routing_id = kMainFrameRouteId;\n view_params.surface_id = kSurfaceId;\n view_params.session_storage_namespace_id = kInvalidSessionStorageNamespaceId;\n view_params.swapped_out = false;\n view_params.replicated_frame_state = FrameReplicationState();\n view_params.proxy_routing_id = MSG_ROUTING_NONE;\n view_params.hidden = false;\n view_params.never_visible = false;\n view_params.next_page_id = 1;\n view_params.initial_size = *InitialSizeParams();\n view_params.enable_auto_resize = false;\n view_params.min_size = gfx::Size();\n view_params.max_size = gfx::Size();\n \n RenderViewImpl* view =\n RenderViewImpl::Create(compositor_deps_.get(), view_params, false);\n view_ = view;\n}\n", + "target": "void RenderViewTest::SetUp() {\n blink::initialize(blink_platform_impl_.Get());\n\n content_client_.reset(CreateContentClient());\n content_browser_client_.reset(CreateContentBrowserClient());\n content_renderer_client_.reset(CreateContentRendererClient());\n SetContentClient(content_client_.get());\n SetBrowserClientForTesting(content_browser_client_.get());\n SetRendererClientForTesting(content_renderer_client_.get());\n\n if (!render_thread_)\n render_thread_.reset(new MockRenderThread());\n render_thread_->set_routing_id(kRouteId);\n render_thread_->set_surface_id(kSurfaceId);\n render_thread_->set_new_window_routing_id(kNewWindowRouteId);\n render_thread_->set_new_frame_routing_id(kNewFrameRouteId);\n\n#if defined(OS_MACOSX)\n autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool());\n#endif\n command_line_.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM));\n params_.reset(new MainFunctionParams(*command_line_));\n platform_.reset(new RendererMainPlatformDelegate(*params_));\n platform_->PlatformInitialize();\n\n std::string flags(\"--expose-gc\");\n v8::V8::SetFlagsFromString(flags.c_str(), static_cast(flags.size()));\n\n RenderThreadImpl::RegisterSchemes();\n\n if (!ui::ResourceBundle::HasSharedInstance())\n ui::ResourceBundle::InitSharedInstanceWithLocale(\n \"en-US\", NULL, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);\n\n compositor_deps_.reset(new FakeCompositorDependencies);\n mock_process_.reset(new MockRenderProcess);\n\n ViewMsg_New_Params view_params;\n view_params.opener_frame_route_id = MSG_ROUTING_NONE;\n view_params.window_was_created_with_opener = false;\n view_params.renderer_preferences = RendererPreferences();\n view_params.web_preferences = WebPreferences();\n view_params.view_id = kRouteId;\n view_params.main_frame_routing_id = kMainFrameRouteId;\n view_params.surface_id = kSurfaceId;\n view_params.session_storage_namespace_id = kInvalidSessionStorageNamespaceId;\n view_params.swapped_out = false;\n view_params.replicated_frame_state = FrameReplicationState();\n view_params.proxy_routing_id = MSG_ROUTING_NONE;\n view_params.hidden = false;\n view_params.never_visible = false;\n view_params.next_page_id = 1;\n view_params.initial_size = *InitialSizeParams();\n view_params.enable_auto_resize = false;\n view_params.min_size = gfx::Size();\n view_params.max_size = gfx::Size();\n \n#if !defined(OS_IOS)\n InitializeMojo();\n#endif\n\n RenderViewImpl* view =\n RenderViewImpl::Create(compositor_deps_.get(), view_params, false);\n view_ = view;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#bf118a342f10dafe44b14451a1392c3254629a1f", + "input": " static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen)\n {\n\tstruct page *pages[NFS4ACL_MAXPAGES];\n \tstruct nfs_getaclargs args = {\n \t\t.fh = NFS_FH(inode),\n \t\t.acl_pages = pages,\n\t\t.acl_len = buflen,\n\t};\n\tstruct nfs_getaclres res = {\n\t\t.acl_len = buflen,\n\t};\n\tvoid *resp_buf;\n\tstruct rpc_message msg = {\n\t\t.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL],\n \t\t.rpc_argp = &args,\n \t\t.rpc_resp = &res,\n \t};\n\tstruct page *localpage = NULL;\n\tint ret;\n \n\tif (buflen < PAGE_SIZE) {\n\t\t/* As long as we're doing a round trip to the server anyway,\n\t\t * let's be prepared for a page of acl data. */\n\t\tlocalpage = alloc_page(GFP_KERNEL);\n\t\tresp_buf = page_address(localpage);\n\t\tif (localpage == NULL)\n\t\t\treturn -ENOMEM;\n\t\targs.acl_pages[0] = localpage;\n\t\targs.acl_pgbase = 0;\n\t\targs.acl_len = PAGE_SIZE;\n\t} else {\n\t\tresp_buf = buf;\n\t\tbuf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase);\n \t}\n\tret = nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode), &msg, &args.seq_args, &res.seq_res, 0);\n \tif (ret)\n \t\tgoto out_free;\n\tif (res.acl_len > args.acl_len)\n\t\tnfs4_write_cached_acl(inode, NULL, res.acl_len);\n \telse\n\t\tnfs4_write_cached_acl(inode, resp_buf, res.acl_len);\n \tif (buf) {\n \t\tret = -ERANGE;\n\t\tif (res.acl_len > buflen)\n \t\t\tgoto out_free;\n\t\tif (localpage)\n\t\t\tmemcpy(buf, resp_buf, res.acl_len);\n \t}\n\tret = res.acl_len;\n out_free:\n\tif (localpage)\n\t\t__free_page(localpage);\n \treturn ret;\n }\n", + "target": " static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen)\n {\n\tstruct page *pages[NFS4ACL_MAXPAGES] = {NULL, };\n \tstruct nfs_getaclargs args = {\n \t\t.fh = NFS_FH(inode),\n \t\t.acl_pages = pages,\n\t\t.acl_len = buflen,\n\t};\n\tstruct nfs_getaclres res = {\n\t\t.acl_len = buflen,\n\t};\n\tvoid *resp_buf;\n\tstruct rpc_message msg = {\n\t\t.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL],\n \t\t.rpc_argp = &args,\n \t\t.rpc_resp = &res,\n \t};\n\tint ret = -ENOMEM, npages, i, acl_len = 0;\n \n\tnpages = (buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;\n\t/* As long as we're doing a round trip to the server anyway,\n\t * let's be prepared for a page of acl data. */\n\tif (npages == 0)\n\t\tnpages = 1;\n\n\tfor (i = 0; i < npages; i++) {\n\t\tpages[i] = alloc_page(GFP_KERNEL);\n\t\tif (!pages[i])\n\t\t\tgoto out_free;\n\t}\n\tif (npages > 1) {\n\t\t/* for decoding across pages */\n\t\targs.acl_scratch = alloc_page(GFP_KERNEL);\n\t\tif (!args.acl_scratch)\n\t\t\tgoto out_free;\n \t}\n\targs.acl_len = npages * PAGE_SIZE;\n\targs.acl_pgbase = 0;\n\t/* Let decode_getfacl know not to fail if the ACL data is larger than\n\t * the page we send as a guess */\n\tif (buf == NULL)\n\t\tres.acl_flags |= NFS4_ACL_LEN_REQUEST;\n\tresp_buf = page_address(pages[0]);\n\n\tdprintk(\"%s buf %p buflen %ld npages %d args.acl_len %ld\\n\",\n\t\t__func__, buf, buflen, npages, args.acl_len);\n\tret = nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode),\n\t\t\t &msg, &args.seq_args, &res.seq_res, 0);\n \tif (ret)\n \t\tgoto out_free;\n\n\tacl_len = res.acl_len - res.acl_data_offset;\n\tif (acl_len > args.acl_len)\n\t\tnfs4_write_cached_acl(inode, NULL, acl_len);\n \telse\n\t\tnfs4_write_cached_acl(inode, resp_buf + res.acl_data_offset,\n\t\t\t\t acl_len);\n \tif (buf) {\n \t\tret = -ERANGE;\n\t\tif (acl_len > buflen)\n \t\t\tgoto out_free;\n\t\t_copy_from_pages(buf, pages, res.acl_data_offset,\n\t\t\t\tres.acl_len);\n \t}\n\tret = acl_len;\n out_free:\n\tfor (i = 0; i < npages; i++)\n\t\tif (pages[i])\n\t\t\t__free_page(pages[i]);\n\tif (args.acl_scratch)\n\t\t__free_page(args.acl_scratch);\n \treturn ret;\n }\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4ab22cfc619ee8ff17a8c50e289ec3b30731ceba", + "input": "void CheckValueType(const Value::ValueType expected,\n const Value* const actual) {\n DCHECK(actual != NULL) << \"Expected value to be non-NULL\";\n DCHECK(expected == actual->GetType())\n << \"Expected \" << print_valuetype(expected)\n << \", but was \" << print_valuetype(actual->GetType());\n}\n", + "target": "void CheckValueType(const Value::ValueType expected,\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a118d4220ed85749c07fb43c1229d9e2fecbea6b", + "input": "_PUBLIC_ char *strupper_talloc_n_handle(struct smb_iconv_handle *iconv_handle,\n\t\t\t\t\tTALLOC_CTX *ctx, const char *src, size_t n)\n{\n\tsize_t size=0;\n\tchar *dest;\n\n\tif (!src) {\n\t\treturn NULL;\n\t}\n\n\t/* this takes advantage of the fact that upper/lower can't\n\t change the length of a character by more than 1 byte */\n\tdest = talloc_array(ctx, char, 2*(n+1));\n\tif (dest == NULL) {\n return NULL;\n }\n \n while (n-- && *src) {\n size_t c_size;\n codepoint_t c = next_codepoint_handle_ext(iconv_handle, src, n,\n CH_UNIX, &c_size);\n src += c_size;\n \n c = toupper_m(c);\n\t\tif (c_size == -1) {\n\t\t\ttalloc_free(dest);\n\t\t\treturn NULL;\n\t\t}\n\t\tsize += c_size;\n\t}\n\n\tdest[size] = 0;\n\n\t/* trim it so talloc_append_string() works */\n\tdest = talloc_realloc(ctx, dest, char, size+1);\n\n\ttalloc_set_name_const(dest, dest);\n\n\treturn dest;\n}\n", + "target": "_PUBLIC_ char *strupper_talloc_n_handle(struct smb_iconv_handle *iconv_handle,\n\t\t\t\t\tTALLOC_CTX *ctx, const char *src, size_t n)\n{\n\tsize_t size=0;\n\tchar *dest;\n\n\tif (!src) {\n\t\treturn NULL;\n\t}\n\n\t/* this takes advantage of the fact that upper/lower can't\n\t change the length of a character by more than 1 byte */\n\tdest = talloc_array(ctx, char, 2*(n+1));\n\tif (dest == NULL) {\n return NULL;\n }\n \n while (n && *src) {\n size_t c_size;\n codepoint_t c = next_codepoint_handle_ext(iconv_handle, src, n,\n CH_UNIX, &c_size);\n src += c_size;\n n -= c_size;\n \n c = toupper_m(c);\n\t\tif (c_size == -1) {\n\t\t\ttalloc_free(dest);\n\t\t\treturn NULL;\n\t\t}\n\t\tsize += c_size;\n\t}\n\n\tdest[size] = 0;\n\n\t/* trim it so talloc_append_string() works */\n\tdest = talloc_realloc(ctx, dest, char, size+1);\n\n\ttalloc_set_name_const(dest, dest);\n\n\treturn dest;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04915c26ea193247b8a29aa24bfa34578ef5d39e", + "input": " static inline quint32 swapBgrToRgb(quint32 pixel)\n {\n return ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff) | (pixel & 0xff00ff00);\n }\n", + "target": " static inline quint32 swapBgrToRgb(quint32 pixel)\n {\n return (((pixel << 16) | (pixel >> 16)) & 0x00ff00ff) | (pixel & 0xff00ff00);\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0da8b8b801f9276359262f1ef8274c7812d3dfda?w=1", + "input": "static inline void find_entity_for_char(\n\tunsigned int k,\n\tenum entity_charset charset,\n\tconst entity_stage1_row *table,\n\tconst unsigned char **entity,\n\tsize_t *entity_len,\n\tunsigned char *old,\n\tsize_t oldlen,\n\tsize_t *cursor)\n {\n \tunsigned stage1_idx = ENT_STAGE1_INDEX(k);\n \tconst entity_stage3_row *c;\n \tif (stage1_idx > 0x1D) {\n \t\t*entity = NULL;\n \t\t*entity_len = 0;\n\t\treturn;\n\t}\n\n\tc = &table[stage1_idx][ENT_STAGE2_INDEX(k)][ENT_STAGE3_INDEX(k)];\n\n\tif (!c->ambiguous) {\n\t\t*entity = (const unsigned char *)c->data.ent.entity;\n\t\t*entity_len = c->data.ent.entity_len;\n\t} else {\n\t\t/* peek at next char */\n\t\tsize_t\t cursor_before\t= *cursor;\n\t\tint\t\t status\t\t\t= SUCCESS;\n\t\tunsigned next_char;\n\n \t\tif (!(*cursor < oldlen))\n \t\t\tgoto no_suitable_2nd;\n \n\t\tnext_char = get_next_char(charset, old, oldlen, cursor, &status); \n \n \t\tif (status == FAILURE)\n \t\t\tgoto no_suitable_2nd;\n\n\t\t{\n\t\t\tconst entity_multicodepoint_row *s, *e;\n\n\t\t\ts = &c->data.multicodepoint_table[1];\n\t\t\te = s - 1 + c->data.multicodepoint_table[0].leading_entry.size;\n\t\t\t/* we could do a binary search but it's not worth it since we have\n\t\t\t * at most two entries... */\n\t\t\tfor ( ; s <= e; s++) {\n\t\t\t\tif (s->normal_entry.second_cp == next_char) {\n\t\t\t\t\t*entity = s->normal_entry.entity;\n\t\t\t\t\t*entity_len = s->normal_entry.entity_len;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\nno_suitable_2nd:\n\t\t*cursor = cursor_before;\n \t\t*entity = (const unsigned char *)\n \t\t\tc->data.multicodepoint_table[0].leading_entry.default_entity;\n \t\t*entity_len = c->data.multicodepoint_table[0].leading_entry.default_entity_len;\n\t}\t\n }\n", + "target": "static inline void find_entity_for_char(\n\tunsigned int k,\n\tenum entity_charset charset,\n\tconst entity_stage1_row *table,\n\tconst unsigned char **entity,\n\tsize_t *entity_len,\n\tunsigned char *old,\n\tsize_t oldlen,\n\tsize_t *cursor)\n {\n \tunsigned stage1_idx = ENT_STAGE1_INDEX(k);\n \tconst entity_stage3_row *c;\n\n \tif (stage1_idx > 0x1D) {\n \t\t*entity = NULL;\n \t\t*entity_len = 0;\n\t\treturn;\n\t}\n\n\tc = &table[stage1_idx][ENT_STAGE2_INDEX(k)][ENT_STAGE3_INDEX(k)];\n\n\tif (!c->ambiguous) {\n\t\t*entity = (const unsigned char *)c->data.ent.entity;\n\t\t*entity_len = c->data.ent.entity_len;\n\t} else {\n\t\t/* peek at next char */\n\t\tsize_t\t cursor_before\t= *cursor;\n\t\tint\t\t status\t\t\t= SUCCESS;\n\t\tunsigned next_char;\n\n \t\tif (!(*cursor < oldlen))\n \t\t\tgoto no_suitable_2nd;\n \n\t\tnext_char = get_next_char(charset, old, oldlen, cursor, &status);\n \n \t\tif (status == FAILURE)\n \t\t\tgoto no_suitable_2nd;\n\n\t\t{\n\t\t\tconst entity_multicodepoint_row *s, *e;\n\n\t\t\ts = &c->data.multicodepoint_table[1];\n\t\t\te = s - 1 + c->data.multicodepoint_table[0].leading_entry.size;\n\t\t\t/* we could do a binary search but it's not worth it since we have\n\t\t\t * at most two entries... */\n\t\t\tfor ( ; s <= e; s++) {\n\t\t\t\tif (s->normal_entry.second_cp == next_char) {\n\t\t\t\t\t*entity = s->normal_entry.entity;\n\t\t\t\t\t*entity_len = s->normal_entry.entity_len;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\nno_suitable_2nd:\n\t\t*cursor = cursor_before;\n \t\t*entity = (const unsigned char *)\n \t\t\tc->data.multicodepoint_table[0].leading_entry.default_entity;\n \t\t*entity_len = c->data.multicodepoint_table[0].leading_entry.default_entity_len;\n\t}\n }\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dd7633ecd553a5e304d349aa6f8eb8a0417098c5", + "input": "static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs)\n {\n \tkref_put(&ubufs->kref, vhost_net_zerocopy_done_signal);\n \twait_event(ubufs->wait, !atomic_read(&ubufs->kref.refcount));\n \tkfree(ubufs);\n }\n", + "target": "static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs)\n {\n \tkref_put(&ubufs->kref, vhost_net_zerocopy_done_signal);\n \twait_event(ubufs->wait, !atomic_read(&ubufs->kref.refcount));\n}\n\nstatic void vhost_net_ubuf_put_wait_and_free(struct vhost_net_ubuf_ref *ubufs)\n{\n\tvhost_net_ubuf_put_and_wait(ubufs);\n \tkfree(ubufs);\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#550fd08c2cebad61c548def135f67aba284c6162", + "input": "static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)\n{\n\thdlc_device *hdlc = dev_to_hdlc(frad);\n\tpvc_device *pvc;\n\tstruct net_device *dev;\n\tint used;\n\n\tif ((pvc = add_pvc(frad, dlci)) == NULL) {\n\t\tnetdev_warn(frad, \"Memory squeeze on fr_add_pvc()\\n\");\n\t\treturn -ENOBUFS;\n\t}\n\n\tif (*get_dev_p(pvc, type))\n\t\treturn -EEXIST;\n \n \tused = pvc_is_used(pvc);\n \n\tif (type == ARPHRD_ETHER)\n \t\tdev = alloc_netdev(0, \"pvceth%d\", ether_setup);\n\telse\n \t\tdev = alloc_netdev(0, \"pvc%d\", pvc_setup);\n \n \tif (!dev) {\n\t\tnetdev_warn(frad, \"Memory squeeze on fr_pvc()\\n\");\n\t\tdelete_unused_pvcs(hdlc);\n\t\treturn -ENOBUFS;\n\t}\n\n\tif (type == ARPHRD_ETHER)\n\t\trandom_ether_addr(dev->dev_addr);\n\telse {\n\t\t*(__be16*)dev->dev_addr = htons(dlci);\n\t\tdlci_to_q922(dev->broadcast, dlci);\n\t}\n\tdev->netdev_ops = &pvc_ops;\n\tdev->mtu = HDLC_MAX_MTU;\n\tdev->tx_queue_len = 0;\n\tdev->ml_priv = pvc;\n\n\tif (register_netdevice(dev) != 0) {\n\t\tfree_netdev(dev);\n\t\tdelete_unused_pvcs(hdlc);\n\t\treturn -EIO;\n\t}\n\n\tdev->destructor = free_netdev;\n\t*get_dev_p(pvc, type) = dev;\n\tif (!used) {\n\t\tstate(hdlc)->dce_changed = 1;\n\t\tstate(hdlc)->dce_pvc_count++;\n\t}\n\treturn 0;\n}\n", + "target": "static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)\n{\n\thdlc_device *hdlc = dev_to_hdlc(frad);\n\tpvc_device *pvc;\n\tstruct net_device *dev;\n\tint used;\n\n\tif ((pvc = add_pvc(frad, dlci)) == NULL) {\n\t\tnetdev_warn(frad, \"Memory squeeze on fr_add_pvc()\\n\");\n\t\treturn -ENOBUFS;\n\t}\n\n\tif (*get_dev_p(pvc, type))\n\t\treturn -EEXIST;\n \n \tused = pvc_is_used(pvc);\n \n\tif (type == ARPHRD_ETHER) {\n \t\tdev = alloc_netdev(0, \"pvceth%d\", ether_setup);\n\t\tdev->priv_flags &= ~IFF_TX_SKB_SHARING;\n\t} else\n \t\tdev = alloc_netdev(0, \"pvc%d\", pvc_setup);\n \n \tif (!dev) {\n\t\tnetdev_warn(frad, \"Memory squeeze on fr_pvc()\\n\");\n\t\tdelete_unused_pvcs(hdlc);\n\t\treturn -ENOBUFS;\n\t}\n\n\tif (type == ARPHRD_ETHER)\n\t\trandom_ether_addr(dev->dev_addr);\n\telse {\n\t\t*(__be16*)dev->dev_addr = htons(dlci);\n\t\tdlci_to_q922(dev->broadcast, dlci);\n\t}\n\tdev->netdev_ops = &pvc_ops;\n\tdev->mtu = HDLC_MAX_MTU;\n\tdev->tx_queue_len = 0;\n\tdev->ml_priv = pvc;\n\n\tif (register_netdevice(dev) != 0) {\n\t\tfree_netdev(dev);\n\t\tdelete_unused_pvcs(hdlc);\n\t\treturn -EIO;\n\t}\n\n\tdev->destructor = free_netdev;\n\t*get_dev_p(pvc, type) = dev;\n\tif (!used) {\n\t\tstate(hdlc)->dce_changed = 1;\n\t\tstate(hdlc)->dce_pvc_count++;\n\t}\n\treturn 0;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long Track::ParseContentEncodingsEntry(long long start, long long size) {\n IMkvReader* const pReader = m_pSegment->m_pReader;\n assert(pReader);\n\n long long pos = start;\n const long long stop = start + size;\n\n\n int count = 0;\n while (pos < stop) {\n long long id, size;\n const long status = ParseElementHeader(pReader,\n pos,\n stop,\n id,\n size);\n if (status < 0) //error\n return status;\n \n if (id == 0x2240) // ContentEncoding ID\n ++count;\n \n pos += size; //consume payload\n assert(pos <= stop);\n }\n \n if (count <= 0)\n return -1;\n \n content_encoding_entries_ = new (std::nothrow) ContentEncoding*[count];\n if (!content_encoding_entries_)\n return -1;\n \n content_encoding_entries_end_ = content_encoding_entries_;\n\n\n pos = start;\n while (pos < stop) {\n long long id, size;\n long status = ParseElementHeader(pReader,\n pos,\n stop,\n id,\n size);\n if (status < 0) //error\n return status;\n \n if (id == 0x2240) { // ContentEncoding ID\n ContentEncoding* const content_encoding =\n new (std::nothrow) ContentEncoding();\n if (!content_encoding)\n return -1;\n \n status = content_encoding->ParseContentEncodingEntry(pos,\n size,\n pReader);\n if (status) {\n delete content_encoding;\n return status;\n }\n\n\n *content_encoding_entries_end_++ = content_encoding;\n }\n \n pos += size; //consume payload\n assert(pos <= stop);\n }\n \n assert(pos == stop);\n\n\n return 0;\n }\n", + "target": "long Track::ParseContentEncodingsEntry(long long start, long long size) {\n IMkvReader* const pReader = m_pSegment->m_pReader;\n assert(pReader);\n\n long long pos = start;\n const long long stop = start + size;\n\n\n int count = 0;\n while (pos < stop) {\n long long id, size;\n const long status = ParseElementHeader(pReader, pos, stop, id, size);\n if (status < 0) // error\n return status;\n \n // pos now designates start of element\n if (id == 0x2240) // ContentEncoding ID\n ++count;\n \n pos += size; // consume payload\n assert(pos <= stop);\n }\n \n if (count <= 0)\n return -1;\n \n content_encoding_entries_ = new (std::nothrow) ContentEncoding* [count];\n if (!content_encoding_entries_)\n return -1;\n \n content_encoding_entries_end_ = content_encoding_entries_;\n\n\n pos = start;\n while (pos < stop) {\n long long id, size;\n long status = ParseElementHeader(pReader, pos, stop, id, size);\n if (status < 0) // error\n return status;\n \n // pos now designates start of element\n if (id == 0x2240) { // ContentEncoding ID\n ContentEncoding* const content_encoding =\n new (std::nothrow) ContentEncoding();\n if (!content_encoding)\n return -1;\n \n status = content_encoding->ParseContentEncodingEntry(pos, size, pReader);\n if (status) {\n delete content_encoding;\n return status;\n }\n\n\n *content_encoding_entries_end_++ = content_encoding;\n }\n \n pos += size; // consume payload\n assert(pos <= stop);\n }\n \n assert(pos == stop);\n\n\n return 0;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a2f18db0c68fec96631c10cad9384c196e9008ac", + "input": "static int nft_flush_table(struct nft_ctx *ctx)\n{\n\tint err;\n \tstruct nft_chain *chain, *nc;\n \tstruct nft_set *set, *ns;\n \n\tlist_for_each_entry_safe(chain, nc, &ctx->table->chains, list) {\n \t\tctx->chain = chain;\n \n \t\terr = nft_delrule_by_chain(ctx);\n \t\tif (err < 0)\n \t\t\tgoto out;\n\t\terr = nft_delchain(ctx);\n\t\tif (err < 0)\n\t\t\tgoto out;\n \t}\n \n \tlist_for_each_entry_safe(set, ns, &ctx->table->sets, list) {\n\t\tif (set->flags & NFT_SET_ANONYMOUS &&\n\t\t !list_empty(&set->bindings))\n\t\t\tcontinue;\n\n\t\terr = nft_delset(ctx, set);\n\t\tif (err < 0)\n \t\t\tgoto out;\n \t}\n \n \terr = nft_deltable(ctx);\n out:\n \treturn err;\n}\n", + "target": "static int nft_flush_table(struct nft_ctx *ctx)\n{\n\tint err;\n \tstruct nft_chain *chain, *nc;\n \tstruct nft_set *set, *ns;\n \n\tlist_for_each_entry(chain, &ctx->table->chains, list) {\n \t\tctx->chain = chain;\n \n \t\terr = nft_delrule_by_chain(ctx);\n \t\tif (err < 0)\n \t\t\tgoto out;\n \t}\n \n \tlist_for_each_entry_safe(set, ns, &ctx->table->sets, list) {\n\t\tif (set->flags & NFT_SET_ANONYMOUS &&\n\t\t !list_empty(&set->bindings))\n\t\t\tcontinue;\n\n\t\terr = nft_delset(ctx, set);\n\t\tif (err < 0)\n \t\t\tgoto out;\n \t}\n \n\tlist_for_each_entry_safe(chain, nc, &ctx->table->chains, list) {\n\t\tctx->chain = chain;\n\n\t\terr = nft_delchain(ctx);\n\t\tif (err < 0)\n\t\t\tgoto out;\n\t}\n\n \terr = nft_deltable(ctx);\n out:\n \treturn err;\n}\n", + "vul_type": "cwe-19", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b712795852f9d6073e062680e280634290c4ba5d", + "input": " HarfBuzzShaperBase::HarfBuzzShaperBase(const Font* font, const TextRun& run)\n : m_font(font)\n , m_run(run)\n , m_wordSpacingAdjustment(font->wordSpacing())\n , m_letterSpacing(font->letterSpacing())\n {\n }\n", + "target": " HarfBuzzShaperBase::HarfBuzzShaperBase(const Font* font, const TextRun& run)\n : m_font(font)\n , m_normalizedBufferLength(0)\n , m_run(run)\n , m_wordSpacingAdjustment(font->wordSpacing())\n , m_padding(0)\n , m_padPerWordBreak(0)\n , m_padError(0)\n , m_letterSpacing(font->letterSpacing())\n {\n }\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#53c1dcd34bed85181b901bfce1a2322f85a59472", + "input": "static void RemoveICCProfileFromResourceBlock(StringInfo *bim_profile)\n{\n register const unsigned char\n *p;\n\n size_t\n length;\n\n unsigned char\n *datum;\n\n unsigned int\n count,\n long_sans;\n\n unsigned short\n id,\n short_sans;\n\n length=GetStringInfoLength(bim_profile);\n if (length < 16)\n return;\n datum=GetStringInfoDatum(bim_profile);\n for (p=datum; (p >= datum) && (p < (datum+length-16)); )\n {\n register unsigned char\n *q;\n\n q=(unsigned char *) p;\n if (LocaleNCompare((const char *) p,\"8BIM\",4) != 0)\n break;\n p=PushLongPixel(MSBEndian,p,&long_sans);\n p=PushShortPixel(MSBEndian,p,&id);\n p=PushShortPixel(MSBEndian,p,&short_sans);\n p=PushLongPixel(MSBEndian,p,&count);\n if (id == 0x0000040f)\n {\n (void) CopyMagickMemory(q,q+PSDQuantum(count)+12,length-\n (PSDQuantum(count)+12)-(q-datum));\n SetStringInfoLength(bim_profile,length-(PSDQuantum(count)+12));\n break;\n }\n p+=count;\n if ((count & 0x01) != 0)\n p++;\n }\n}\n", + "target": "static void RemoveICCProfileFromResourceBlock(StringInfo *bim_profile)\n{\n register const unsigned char\n *p;\n\n size_t\n length;\n\n unsigned char\n *datum;\n\n unsigned int\n count,\n long_sans;\n\n unsigned short\n id,\n short_sans;\n\n length=GetStringInfoLength(bim_profile);\n if (length < 16)\n return;\n datum=GetStringInfoDatum(bim_profile);\n for (p=datum; (p >= datum) && (p < (datum+length-16)); )\n {\n register unsigned char\n *q;\n\n q=(unsigned char *) p;\n if (LocaleNCompare((const char *) p,\"8BIM\",4) != 0)\n break;\n p=PushLongPixel(MSBEndian,p,&long_sans);\n p=PushShortPixel(MSBEndian,p,&id);\n p=PushShortPixel(MSBEndian,p,&short_sans);\n p=PushLongPixel(MSBEndian,p,&count);\n if (id == 0x0000040f)\n {\n if ((q+PSDQuantum(count)+12) < (datum+length-16))\n {\n (void) CopyMagickMemory(q,q+PSDQuantum(count)+12,length-\n (PSDQuantum(count)+12)-(q-datum));\n SetStringInfoLength(bim_profile,length-(PSDQuantum(count)+12));\n }\n break;\n }\n p+=count;\n if ((count & 0x01) != 0)\n p++;\n }\n}\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#58d9c46929ca0828edde34d263700c3a5fe8dc3c", + "input": " MagickExport int LocaleLowercase(const int c)\n {\n if (c < 0)\n return(c);\n #if defined(MAGICKCORE_LOCALE_SUPPORT)\n if (c_locale != (locale_t) NULL)\n return(tolower_l((int) ((unsigned char) c),c_locale));\n#endif\n return(tolower((int) ((unsigned char) c)));\n}\n", + "target": " MagickExport int LocaleLowercase(const int c)\n {\n if (c == EOF)\n return(c);\n #if defined(MAGICKCORE_LOCALE_SUPPORT)\n if (c_locale != (locale_t) NULL)\n return(tolower_l((int) ((unsigned char) c),c_locale));\n#endif\n return(tolower((int) ((unsigned char) c)));\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#29014da83e5fc358d6bff0f574e9ed45e61a35ac", + "input": "oxide::BrowserContext* WebContext::GetContext() {\n if (context_.get()) {\n return context_.get();\n }\n \n DCHECK(construct_props_);\n \n oxide::BrowserContext::Params params(\n construct_props_->data_path,\n construct_props_->cache_path,\n construct_props_->max_cache_size_hint,\n construct_props_->session_cookie_mode);\n params.host_mapping_rules = construct_props_->host_mapping_rules;\n \n context_ = oxide::BrowserContext::Create(params);\n \n UserAgentSettings* ua_settings = UserAgentSettings::Get(context_.get());\n if (!construct_props_->product.empty()) {\n ua_settings->SetProduct(construct_props_->product);\n }\n if (!construct_props_->user_agent.empty()) {\n ua_settings->SetUserAgent(construct_props_->user_agent);\n }\n if (!construct_props_->accept_langs.empty()) {\n ua_settings->SetAcceptLangs(construct_props_->accept_langs);\n }\n ua_settings->SetUserAgentOverrides(construct_props_->user_agent_overrides);\n ua_settings->SetLegacyUserAgentOverrideEnabled(\n construct_props_->legacy_user_agent_override_enabled);\n\n context_->SetCookiePolicy(construct_props_->cookie_policy);\n context_->SetIsPopupBlockerEnabled(construct_props_->popup_blocker_enabled);\n context_->SetDoNotTrack(construct_props_->do_not_track);\n\n MediaCaptureDevicesContext* dc =\n MediaCaptureDevicesContext::Get(context_.get());\n\n if (!construct_props_->default_audio_capture_device_id.empty()) {\n if (!dc->SetDefaultAudioDeviceId(\n construct_props_->default_audio_capture_device_id)) {\n client_->DefaultAudioCaptureDeviceChanged();\n }\n }\n if (!construct_props_->default_video_capture_device_id.empty()) {\n if (!dc->SetDefaultVideoDeviceId(\n construct_props_->default_video_capture_device_id)) {\n client_->DefaultVideoCaptureDeviceChanged();\n }\n }\n\n dc->set_client(this);\n\n DevToolsManager* devtools = DevToolsManager::Get(context_.get());\n if (!construct_props_->devtools_ip.empty()) {\n devtools->SetAddress(construct_props_->devtools_ip);\n }\n if (construct_props_->devtools_port != -1) {\n devtools->SetPort(construct_props_->devtools_port);\n }\n devtools->SetEnabled(construct_props_->devtools_enabled);\n\n context_->SetDelegate(delegate_.get());\n\n construct_props_.reset();\n\n UpdateUserScripts();\n\n return context_.get();\n}\n", + "target": "oxide::BrowserContext* WebContext::GetContext() {\nBrowserContext* WebContext::GetContext() {\n if (context_.get()) {\n return context_.get();\n }\n \n DCHECK(construct_props_);\n \n BrowserContext::Params params(\n construct_props_->data_path,\n construct_props_->cache_path,\n construct_props_->max_cache_size_hint,\n construct_props_->session_cookie_mode);\n params.host_mapping_rules = construct_props_->host_mapping_rules;\n \n context_ = BrowserContext::Create(params);\n \n UserAgentSettings* ua_settings = UserAgentSettings::Get(context_.get());\n if (!construct_props_->product.empty()) {\n ua_settings->SetProduct(construct_props_->product);\n }\n if (!construct_props_->user_agent.empty()) {\n ua_settings->SetUserAgent(construct_props_->user_agent);\n }\n if (!construct_props_->accept_langs.empty()) {\n ua_settings->SetAcceptLangs(construct_props_->accept_langs);\n }\n ua_settings->SetUserAgentOverrides(construct_props_->user_agent_overrides);\n ua_settings->SetLegacyUserAgentOverrideEnabled(\n construct_props_->legacy_user_agent_override_enabled);\n\n context_->SetCookiePolicy(construct_props_->cookie_policy);\n context_->SetIsPopupBlockerEnabled(construct_props_->popup_blocker_enabled);\n context_->SetDoNotTrack(construct_props_->do_not_track);\n\n MediaCaptureDevicesContext* dc =\n MediaCaptureDevicesContext::Get(context_.get());\n\n if (!construct_props_->default_audio_capture_device_id.empty()) {\n if (!dc->SetDefaultAudioDeviceId(\n construct_props_->default_audio_capture_device_id)) {\n client_->DefaultAudioCaptureDeviceChanged();\n }\n }\n if (!construct_props_->default_video_capture_device_id.empty()) {\n if (!dc->SetDefaultVideoDeviceId(\n construct_props_->default_video_capture_device_id)) {\n client_->DefaultVideoCaptureDeviceChanged();\n }\n }\n\n dc->set_client(this);\n\n DevToolsManager* devtools = DevToolsManager::Get(context_.get());\n if (!construct_props_->devtools_ip.empty()) {\n devtools->SetAddress(construct_props_->devtools_ip);\n }\n if (construct_props_->devtools_port != -1) {\n devtools->SetPort(construct_props_->devtools_port);\n }\n devtools->SetEnabled(construct_props_->devtools_enabled);\n\n context_->SetDelegate(delegate_.get());\n\n construct_props_.reset();\n\n UpdateUserScripts();\n\n return context_.get();\n}\n", + "vul_type": "cwe-20", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0f6ceabab0a8849b47f67d727aa526c2656089ba", + "input": "check_user_token (const char *authfile,\n\t\t const char *username,\n\t\t const char *otp_id,\n\t\t int verbose,\n FILE *debug_file)\n{\n char buf[1024];\n char *s_user, *s_token;\n int retval = AUTH_ERROR;\n int fd;\n struct stat st;\n FILE *opwfile;\n\n fd = open(authfile, O_RDONLY, 0);\n if (fd < 0) {\n if(verbose)\n\t D (debug_file, \"Cannot open file: %s (%s)\", authfile, strerror(errno));\n return retval;\n }\n\n if (fstat(fd, &st) < 0) {\n if(verbose)\n\t D (debug_file, \"Cannot stat file: %s (%s)\", authfile, strerror(errno));\n close(fd);\n return retval;\n }\n\n if (!S_ISREG(st.st_mode)) {\n if(verbose)\n\t D (debug_file, \"%s is not a regular file\", authfile);\n close(fd);\n return retval;\n }\n\n opwfile = fdopen(fd, \"r\");\n if (opwfile == NULL) {\n if(verbose)\n\t D (debug_file, \"fdopen: %s\", strerror(errno));\n close(fd);\n return retval;\n }\n\n retval = AUTH_NO_TOKENS;\n while (fgets (buf, 1024, opwfile))\n {\n char *saveptr = NULL;\n if (buf[strlen (buf) - 1] == '\\n')\n\tbuf[strlen (buf) - 1] = '\\0';\n if (buf[0] == '#') {\n /* This is a comment and we may skip it. */\n if(verbose)\n D (debug_file, \"Skipping comment line: %s\", buf);\n continue;\n }\n if(verbose)\n\t D (debug_file, \"Authorization line: %s\", buf);\n s_user = strtok_r (buf, \":\", &saveptr);\n if (s_user && strcmp (username, s_user) == 0)\n\t{\n\t if(verbose)\n\t D (debug_file, \"Matched user: %s\", s_user);\n retval = AUTH_NOT_FOUND; /* We found at least one line for the user */\n\t do\n\t {\n\t s_token = strtok_r (NULL, \":\", &saveptr);\n\t if(verbose)\n\t\t D (debug_file, \"Authorization token: %s\", s_token);\n\t if (s_token && otp_id && strcmp (otp_id, s_token) == 0)\n \t\t{\n \t\t if(verbose)\n \t\t D (debug_file, \"Match user/token as %s/%s\", username, otp_id);\n \t\t return AUTH_FOUND;\n \t\t}\n \t }\n\t while (s_token != NULL);\n\t}\n }\n\n fclose (opwfile);\n\n return retval;\n}\n", + "target": "check_user_token (const char *authfile,\n\t\t const char *username,\n\t\t const char *otp_id,\n\t\t int verbose,\n FILE *debug_file)\n{\n char buf[1024];\n char *s_user, *s_token;\n int retval = AUTH_ERROR;\n int fd;\n struct stat st;\n FILE *opwfile;\n\n fd = open(authfile, O_RDONLY, 0);\n if (fd < 0) {\n if(verbose)\n\t D (debug_file, \"Cannot open file: %s (%s)\", authfile, strerror(errno));\n return retval;\n }\n\n if (fstat(fd, &st) < 0) {\n if(verbose)\n\t D (debug_file, \"Cannot stat file: %s (%s)\", authfile, strerror(errno));\n close(fd);\n return retval;\n }\n\n if (!S_ISREG(st.st_mode)) {\n if(verbose)\n\t D (debug_file, \"%s is not a regular file\", authfile);\n close(fd);\n return retval;\n }\n\n opwfile = fdopen(fd, \"r\");\n if (opwfile == NULL) {\n if(verbose)\n\t D (debug_file, \"fdopen: %s\", strerror(errno));\n close(fd);\n return retval;\n }\n\n retval = AUTH_NO_TOKENS;\n while (fgets (buf, 1024, opwfile))\n {\n char *saveptr = NULL;\n if (buf[strlen (buf) - 1] == '\\n')\n\tbuf[strlen (buf) - 1] = '\\0';\n if (buf[0] == '#') {\n /* This is a comment and we may skip it. */\n if(verbose)\n D (debug_file, \"Skipping comment line: %s\", buf);\n continue;\n }\n if(verbose)\n\t D (debug_file, \"Authorization line: %s\", buf);\n s_user = strtok_r (buf, \":\", &saveptr);\n if (s_user && strcmp (username, s_user) == 0)\n\t{\n\t if(verbose)\n\t D (debug_file, \"Matched user: %s\", s_user);\n retval = AUTH_NOT_FOUND; /* We found at least one line for the user */\n\t do\n\t {\n\t s_token = strtok_r (NULL, \":\", &saveptr);\n\t if(verbose)\n\t\t D (debug_file, \"Authorization token: %s\", s_token);\n\t if (s_token && otp_id && strcmp (otp_id, s_token) == 0)\n \t\t{\n \t\t if(verbose)\n \t\t D (debug_file, \"Match user/token as %s/%s\", username, otp_id);\n\n\t\t fclose(opwfile);\n \t\t return AUTH_FOUND;\n \t\t}\n \t }\n\t while (s_token != NULL);\n\t}\n }\n\n fclose (opwfile);\n\n return retval;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#23adbe12ef7d3d4195e80800ab36b37bee28cd03", + "input": "void setattr_copy(struct inode *inode, const struct iattr *attr)\n{\n\tunsigned int ia_valid = attr->ia_valid;\n\n\tif (ia_valid & ATTR_UID)\n\t\tinode->i_uid = attr->ia_uid;\n\tif (ia_valid & ATTR_GID)\n\t\tinode->i_gid = attr->ia_gid;\n\tif (ia_valid & ATTR_ATIME)\n\t\tinode->i_atime = timespec_trunc(attr->ia_atime,\n\t\t\t\t\t\tinode->i_sb->s_time_gran);\n\tif (ia_valid & ATTR_MTIME)\n\t\tinode->i_mtime = timespec_trunc(attr->ia_mtime,\n\t\t\t\t\t\tinode->i_sb->s_time_gran);\n\tif (ia_valid & ATTR_CTIME)\n\t\tinode->i_ctime = timespec_trunc(attr->ia_ctime,\n\t\t\t\t\t\tinode->i_sb->s_time_gran);\n\tif (ia_valid & ATTR_MODE) {\n \t\tumode_t mode = attr->ia_mode;\n \n \t\tif (!in_group_p(inode->i_gid) &&\n\t\t !inode_capable(inode, CAP_FSETID))\n \t\t\tmode &= ~S_ISGID;\n \t\tinode->i_mode = mode;\n \t}\n}\n", + "target": "void setattr_copy(struct inode *inode, const struct iattr *attr)\n{\n\tunsigned int ia_valid = attr->ia_valid;\n\n\tif (ia_valid & ATTR_UID)\n\t\tinode->i_uid = attr->ia_uid;\n\tif (ia_valid & ATTR_GID)\n\t\tinode->i_gid = attr->ia_gid;\n\tif (ia_valid & ATTR_ATIME)\n\t\tinode->i_atime = timespec_trunc(attr->ia_atime,\n\t\t\t\t\t\tinode->i_sb->s_time_gran);\n\tif (ia_valid & ATTR_MTIME)\n\t\tinode->i_mtime = timespec_trunc(attr->ia_mtime,\n\t\t\t\t\t\tinode->i_sb->s_time_gran);\n\tif (ia_valid & ATTR_CTIME)\n\t\tinode->i_ctime = timespec_trunc(attr->ia_ctime,\n\t\t\t\t\t\tinode->i_sb->s_time_gran);\n\tif (ia_valid & ATTR_MODE) {\n \t\tumode_t mode = attr->ia_mode;\n \n \t\tif (!in_group_p(inode->i_gid) &&\n\t\t !capable_wrt_inode_uidgid(inode, CAP_FSETID))\n \t\t\tmode &= ~S_ISGID;\n \t\tinode->i_mode = mode;\n \t}\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d", + "input": "bool mkvparser::Match(IMkvReader* pReader, long long& pos, unsigned long id_,\n unsigned char*& buf, size_t& buflen) {\n assert(pReader);\n assert(pos >= 0);\n long long total, available;\n long status = pReader->Length(&total, &available);\n assert(status >= 0);\n assert((total < 0) || (available <= total));\n if (status < 0)\n return false;\n \n long len;\n const long long id = ReadUInt(pReader, pos, len);\n assert(id >= 0);\n assert(len > 0);\n assert(len <= 8);\n assert((pos + len) <= available);\n \n if ((unsigned long)id != id_)\n return false;\n \n pos += len; // consume id\n \n const long long size_ = ReadUInt(pReader, pos, len);\n assert(size_ >= 0);\n assert(len > 0);\n assert(len <= 8);\n assert((pos + len) <= available);\n \n pos += len; // consume length of size of payload\n assert((pos + size_) <= available);\n \n const long buflen_ = static_cast(size_);\n \n buf = new (std::nothrow) unsigned char[buflen_];\n assert(buf); // TODO\n \n status = pReader->Read(pos, buflen_, buf);\n assert(status == 0); // TODO\n \n buflen = buflen_;\n \n pos += size_; // consume size of payload\n return true;\n }\n", + "target": "bool mkvparser::Match(IMkvReader* pReader, long long& pos, unsigned long id_,\nbool Match(IMkvReader* pReader, long long& pos, unsigned long expected_id,\n unsigned char*& buf, size_t& buflen) {\n if (!pReader || pos < 0)\n return false;\n \n long long total = 0;\n long long available = 0;\n \n long status = pReader->Length(&total, &available);\n if (status < 0 || (total >= 0 && available > total))\n return false;\n\n long len = 0;\n const long long id = ReadID(pReader, pos, len);\n if (id < 0 || (available - pos) > len)\n return false;\n\n if (static_cast(id) != expected_id)\n return false;\n \n pos += len; // consume id\n \n const long long size = ReadUInt(pReader, pos, len);\n if (size < 0 || len <= 0 || len > 8 || (available - pos) > len)\n return false;\n\n unsigned long long rollover_check =\n static_cast(pos) + len;\n if (rollover_check > LONG_LONG_MAX)\n return false;\n \n pos += len; // consume length of size of payload\n \n rollover_check = static_cast(pos) + size;\n if (rollover_check > LONG_LONG_MAX)\n return false;\n \n if ((pos + size) > available)\n return false;\n\n if (size >= LONG_MAX)\n return false;\n\n const long buflen_ = static_cast(size);\n\n buf = SafeArrayAlloc(1, buflen_);\n if (!buf)\n return false;\n \n status = pReader->Read(pos, buflen_, buf);\n if (status != 0)\n return false;\n \n buflen = buflen_;\n \n pos += size; // consume size of payload\n return true;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5338aac7b8b880b0c5e0c15e27dadc44c5559284", + "input": "mobility_opt_print(netdissect_options *ndo,\n const u_char *bp, const unsigned len)\n{\n\tunsigned i, optlen;\n\n\tfor (i = 0; i < len; i += optlen) {\n\t\tND_TCHECK(bp[i]);\n\t\tif (bp[i] == IP6MOPT_PAD1)\n\t\t\toptlen = 1;\n\t\telse {\n\t\t\tif (i + 1 < len) {\n\t\t\t\tND_TCHECK(bp[i + 1]);\n\t\t\t\toptlen = bp[i + 1] + 2;\n\t\t\t}\n\t\t\telse\n\t\t\t\tgoto trunc;\n\t\t}\n\t\tif (i + optlen > len)\n\t\t\tgoto trunc;\n\t\tND_TCHECK(bp[i + optlen]);\n\n\t\tswitch (bp[i]) {\n\t\tcase IP6MOPT_PAD1:\n\t\t\tND_PRINT((ndo, \"(pad1)\"));\n\t\t\tbreak;\n\t\tcase IP6MOPT_PADN:\n\t\t\tif (len - i < IP6MOPT_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(padn: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(padn)\"));\n\t\t\tbreak;\n\t\tcase IP6MOPT_REFRESH:\n\t\t\tif (len - i < IP6MOPT_REFRESH_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(refresh: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\t/* units of 4 secs */\n\t\t\tND_TCHECK_16BITS(&bp[i+2]);\n\t\t\tND_PRINT((ndo, \"(refresh: %u)\",\n\t\t\t\tEXTRACT_16BITS(&bp[i+2]) << 2));\n\t\t\tbreak;\n\t\tcase IP6MOPT_ALTCOA:\n\t\t\tif (len - i < IP6MOPT_ALTCOA_MINLEN) {\n \t\t\t\tND_PRINT((ndo, \"(altcoa: trunc)\"));\n \t\t\t\tgoto trunc;\n \t\t\t}\n \t\t\tND_PRINT((ndo, \"(alt-CoA: %s)\", ip6addr_string(ndo, &bp[i+2])));\n \t\t\tbreak;\n \t\tcase IP6MOPT_NONCEID:\n\t\t\tif (len - i < IP6MOPT_NONCEID_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(ni: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_TCHECK_16BITS(&bp[i+2]);\n\t\t\tND_TCHECK_16BITS(&bp[i+4]);\n\t\t\tND_PRINT((ndo, \"(ni: ho=0x%04x co=0x%04x)\",\n\t\t\t\tEXTRACT_16BITS(&bp[i+2]),\n\t\t\t\tEXTRACT_16BITS(&bp[i+4])));\n\t\t\tbreak;\n\t\tcase IP6MOPT_AUTH:\n\t\t\tif (len - i < IP6MOPT_AUTH_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(auth: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(auth)\"));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (len - i < IP6MOPT_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(sopt_type %u: trunc)\", bp[i]));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(type-0x%02x: len=%u)\", bp[i], bp[i + 1]));\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n\ntrunc:\n\treturn 1;\n}\n", + "target": "mobility_opt_print(netdissect_options *ndo,\n const u_char *bp, const unsigned len)\n{\n\tunsigned i, optlen;\n\n\tfor (i = 0; i < len; i += optlen) {\n\t\tND_TCHECK(bp[i]);\n\t\tif (bp[i] == IP6MOPT_PAD1)\n\t\t\toptlen = 1;\n\t\telse {\n\t\t\tif (i + 1 < len) {\n\t\t\t\tND_TCHECK(bp[i + 1]);\n\t\t\t\toptlen = bp[i + 1] + 2;\n\t\t\t}\n\t\t\telse\n\t\t\t\tgoto trunc;\n\t\t}\n\t\tif (i + optlen > len)\n\t\t\tgoto trunc;\n\t\tND_TCHECK(bp[i + optlen]);\n\n\t\tswitch (bp[i]) {\n\t\tcase IP6MOPT_PAD1:\n\t\t\tND_PRINT((ndo, \"(pad1)\"));\n\t\t\tbreak;\n\t\tcase IP6MOPT_PADN:\n\t\t\tif (len - i < IP6MOPT_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(padn: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(padn)\"));\n\t\t\tbreak;\n\t\tcase IP6MOPT_REFRESH:\n\t\t\tif (len - i < IP6MOPT_REFRESH_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(refresh: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\t/* units of 4 secs */\n\t\t\tND_TCHECK_16BITS(&bp[i+2]);\n\t\t\tND_PRINT((ndo, \"(refresh: %u)\",\n\t\t\t\tEXTRACT_16BITS(&bp[i+2]) << 2));\n\t\t\tbreak;\n\t\tcase IP6MOPT_ALTCOA:\n\t\t\tif (len - i < IP6MOPT_ALTCOA_MINLEN) {\n \t\t\t\tND_PRINT((ndo, \"(altcoa: trunc)\"));\n \t\t\t\tgoto trunc;\n \t\t\t}\n\t\t\tND_TCHECK_128BITS(&bp[i+2]);\n \t\t\tND_PRINT((ndo, \"(alt-CoA: %s)\", ip6addr_string(ndo, &bp[i+2])));\n \t\t\tbreak;\n \t\tcase IP6MOPT_NONCEID:\n\t\t\tif (len - i < IP6MOPT_NONCEID_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(ni: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_TCHECK_16BITS(&bp[i+2]);\n\t\t\tND_TCHECK_16BITS(&bp[i+4]);\n\t\t\tND_PRINT((ndo, \"(ni: ho=0x%04x co=0x%04x)\",\n\t\t\t\tEXTRACT_16BITS(&bp[i+2]),\n\t\t\t\tEXTRACT_16BITS(&bp[i+4])));\n\t\t\tbreak;\n\t\tcase IP6MOPT_AUTH:\n\t\t\tif (len - i < IP6MOPT_AUTH_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(auth: trunc)\"));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(auth)\"));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (len - i < IP6MOPT_MINLEN) {\n\t\t\t\tND_PRINT((ndo, \"(sopt_type %u: trunc)\", bp[i]));\n\t\t\t\tgoto trunc;\n\t\t\t}\n\t\t\tND_PRINT((ndo, \"(type-0x%02x: len=%u)\", bp[i], bp[i + 1]));\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n\ntrunc:\n\treturn 1;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#181c7400b2bf50ba02ac77149749fb419b4d4797", + "input": "error::Error GLES2DecoderImpl::HandleGetUniformfv(uint32 immediate_data_size,\n const void* cmd_data) {\n const gles2::cmds::GetUniformfv& c =\n *static_cast(cmd_data);\n GLuint program = c.program;\n GLint fake_location = c.location;\n GLuint service_id;\n GLint real_location = -1;\n Error error;\n typedef cmds::GetUniformfv::Result Result;\n Result* result;\n GLenum result_type;\n if (GetUniformSetup(\n program, fake_location, c.params_shm_id, c.params_shm_offset,\n &error, &real_location, &service_id,\n reinterpret_cast(&result), &result_type)) {\n if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 ||\n result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) {\n GLsizei num_values = result->GetNumResults();\n scoped_ptr temp(new GLint[num_values]);\n glGetUniformiv(service_id, real_location, temp.get());\n GLfloat* dst = result->GetData();\n for (GLsizei ii = 0; ii < num_values; ++ii) {\n dst[ii] = (temp[ii] != 0);\n }\n } else {\n glGetUniformfv(service_id, real_location, result->GetData());\n }\n }\n return error;\n}\n", + "target": "error::Error GLES2DecoderImpl::HandleGetUniformfv(uint32 immediate_data_size,\n const void* cmd_data) {\n const gles2::cmds::GetUniformfv& c =\n *static_cast(cmd_data);\n GLuint program = c.program;\n GLint fake_location = c.location;\n GLuint service_id;\n GLint real_location = -1;\n Error error;\n typedef cmds::GetUniformfv::Result Result;\n Result* result;\n GLenum result_type;\n GLsizei result_size;\n if (GetUniformSetup(program, fake_location, c.params_shm_id,\n c.params_shm_offset, &error, &real_location, &service_id,\n reinterpret_cast(&result), &result_type,\n &result_size)) {\n if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 ||\n result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) {\n GLsizei num_values = result_size / sizeof(Result::Type);\n scoped_ptr temp(new GLint[num_values]);\n glGetUniformiv(service_id, real_location, temp.get());\n GLfloat* dst = result->GetData();\n for (GLsizei ii = 0; ii < num_values; ++ii) {\n dst[ii] = (temp[ii] != 0);\n }\n } else {\n glGetUniformfv(service_id, real_location, result->GetData());\n }\n }\n return error;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ce683e5f9d045e5d67d1312a42b359cb2ab2a13c", + "input": "check_compat_entry_size_and_hooks(struct compat_arpt_entry *e,\n\t\t\t\t struct xt_table_info *newinfo,\n\t\t\t\t unsigned int *size,\n\t\t\t\t const unsigned char *base,\n\t\t\t\t const unsigned char *limit,\n\t\t\t\t const unsigned int *hook_entries,\n\t\t\t\t const unsigned int *underflows,\n\t\t\t\t const char *name)\n{\n\tstruct xt_entry_target *t;\n\tstruct xt_target *target;\n\tunsigned int entry_offset;\n\tint ret, off, h;\n\n\tduprintf(\"check_compat_entry_size_and_hooks %p\\n\", e);\n\tif ((unsigned long)e % __alignof__(struct compat_arpt_entry) != 0 ||\n\t (unsigned char *)e + sizeof(struct compat_arpt_entry) >= limit ||\n\t (unsigned char *)e + e->next_offset > limit) {\n\t\tduprintf(\"Bad offset %p, limit = %p\\n\", e, limit);\n\t\treturn -EINVAL;\n\t}\n\n\tif (e->next_offset < sizeof(struct compat_arpt_entry) +\n\t\t\t sizeof(struct compat_xt_entry_target)) {\n\t\tduprintf(\"checking: element %p size %u\\n\",\n\t\t\t e, e->next_offset);\n\t\treturn -EINVAL;\n\t}\n\n \tif (!arp_checkentry(&e->arp))\n \t\treturn -EINVAL;\n \n\tret = xt_compat_check_entry_offsets(e, e->target_offset,\n \t\t\t\t\t e->next_offset);\n \tif (ret)\n \t\treturn ret;\n\n\toff = sizeof(struct arpt_entry) - sizeof(struct compat_arpt_entry);\n\tentry_offset = (void *)e - (void *)base;\n\n\tt = compat_arpt_get_target(e);\n\ttarget = xt_request_find_target(NFPROTO_ARP, t->u.user.name,\n\t\t\t\t\tt->u.user.revision);\n\tif (IS_ERR(target)) {\n\t\tduprintf(\"check_compat_entry_size_and_hooks: `%s' not found\\n\",\n\t\t\t t->u.user.name);\n\t\tret = PTR_ERR(target);\n\t\tgoto out;\n\t}\n\tt->u.kernel.target = target;\n\n\toff += xt_compat_target_offset(target);\n\t*size += off;\n\tret = xt_compat_add_offset(NFPROTO_ARP, entry_offset, off);\n\tif (ret)\n\t\tgoto release_target;\n\n\t/* Check hooks & underflows */\n\tfor (h = 0; h < NF_ARP_NUMHOOKS; h++) {\n\t\tif ((unsigned char *)e - base == hook_entries[h])\n\t\t\tnewinfo->hook_entry[h] = hook_entries[h];\n\t\tif ((unsigned char *)e - base == underflows[h])\n\t\t\tnewinfo->underflow[h] = underflows[h];\n\t}\n\n\t/* Clear counters and comefrom */\n\tmemset(&e->counters, 0, sizeof(e->counters));\n\te->comefrom = 0;\n\treturn 0;\n\nrelease_target:\n\tmodule_put(t->u.kernel.target->me);\nout:\n\treturn ret;\n}\n", + "target": "check_compat_entry_size_and_hooks(struct compat_arpt_entry *e,\n\t\t\t\t struct xt_table_info *newinfo,\n\t\t\t\t unsigned int *size,\n\t\t\t\t const unsigned char *base,\n\t\t\t\t const unsigned char *limit,\n\t\t\t\t const unsigned int *hook_entries,\n\t\t\t\t const unsigned int *underflows,\n\t\t\t\t const char *name)\n{\n\tstruct xt_entry_target *t;\n\tstruct xt_target *target;\n\tunsigned int entry_offset;\n\tint ret, off, h;\n\n\tduprintf(\"check_compat_entry_size_and_hooks %p\\n\", e);\n\tif ((unsigned long)e % __alignof__(struct compat_arpt_entry) != 0 ||\n\t (unsigned char *)e + sizeof(struct compat_arpt_entry) >= limit ||\n\t (unsigned char *)e + e->next_offset > limit) {\n\t\tduprintf(\"Bad offset %p, limit = %p\\n\", e, limit);\n\t\treturn -EINVAL;\n\t}\n\n\tif (e->next_offset < sizeof(struct compat_arpt_entry) +\n\t\t\t sizeof(struct compat_xt_entry_target)) {\n\t\tduprintf(\"checking: element %p size %u\\n\",\n\t\t\t e, e->next_offset);\n\t\treturn -EINVAL;\n\t}\n\n \tif (!arp_checkentry(&e->arp))\n \t\treturn -EINVAL;\n \n\tret = xt_compat_check_entry_offsets(e, e->elems, e->target_offset,\n \t\t\t\t\t e->next_offset);\n \tif (ret)\n \t\treturn ret;\n\n\toff = sizeof(struct arpt_entry) - sizeof(struct compat_arpt_entry);\n\tentry_offset = (void *)e - (void *)base;\n\n\tt = compat_arpt_get_target(e);\n\ttarget = xt_request_find_target(NFPROTO_ARP, t->u.user.name,\n\t\t\t\t\tt->u.user.revision);\n\tif (IS_ERR(target)) {\n\t\tduprintf(\"check_compat_entry_size_and_hooks: `%s' not found\\n\",\n\t\t\t t->u.user.name);\n\t\tret = PTR_ERR(target);\n\t\tgoto out;\n\t}\n\tt->u.kernel.target = target;\n\n\toff += xt_compat_target_offset(target);\n\t*size += off;\n\tret = xt_compat_add_offset(NFPROTO_ARP, entry_offset, off);\n\tif (ret)\n\t\tgoto release_target;\n\n\t/* Check hooks & underflows */\n\tfor (h = 0; h < NF_ARP_NUMHOOKS; h++) {\n\t\tif ((unsigned char *)e - base == hook_entries[h])\n\t\t\tnewinfo->hook_entry[h] = hook_entries[h];\n\t\tif ((unsigned char *)e - base == underflows[h])\n\t\t\tnewinfo->underflow[h] = underflows[h];\n\t}\n\n\t/* Clear counters and comefrom */\n\tmemset(&e->counters, 0, sizeof(e->counters));\n\te->comefrom = 0;\n\treturn 0;\n\nrelease_target:\n\tmodule_put(t->u.kernel.target->me);\nout:\n\treturn ret;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d", + "input": "long Cluster::ParseSimpleBlock(long long block_size, long long& pos,\n long& len) {\n const long long block_start = pos;\n const long long block_stop = pos + block_size;\n\n IMkvReader* const pReader = m_pSegment->m_pReader;\n\n long long total, avail;\n\n long status = pReader->Length(&total, &avail);\n\n if (status < 0) // error\n return status;\n\n assert((total < 0) || (avail <= total));\n\n\n if ((pos + 1) > avail) {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n\n long long result = GetUIntLength(pReader, pos, len);\n\n if (result < 0) // error\n return static_cast(result);\n\n if (result > 0) // weird\n return E_BUFFER_NOT_FULL;\n\n if ((pos + len) > block_stop)\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + len) > avail)\n return E_BUFFER_NOT_FULL;\n\n const long long track = ReadUInt(pReader, pos, len);\n\n if (track < 0) // error\n return static_cast(track);\n\n\n if (track == 0)\n return E_FILE_FORMAT_INVALID;\n \n#if 0\n const Tracks* const pTracks = m_pSegment->GetTracks();\n assert(pTracks);\n const long tn = static_cast(track);\n const Track* const pTrack = pTracks->GetTrackByNumber(tn);\n if (pTrack == NULL)\n return E_FILE_FORMAT_INVALID;\n#endif\n pos += len; // consume track number\n \n if ((pos + 2) > block_stop)\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + 2) > avail) {\n len = 2;\n return E_BUFFER_NOT_FULL;\n }\n\n pos += 2; // consume timecode\n\n if ((pos + 1) > block_stop)\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + 1) > avail) {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n\n unsigned char flags;\n\n status = pReader->Read(pos, 1, &flags);\n\n if (status < 0) { // error or underflow\n len = 1;\n return status;\n }\n\n ++pos; // consume flags byte\n assert(pos <= avail);\n\n if (pos >= block_stop)\n return E_FILE_FORMAT_INVALID;\n\n const int lacing = int(flags & 0x06) >> 1;\n\n if ((lacing != 0) && (block_stop > avail)) {\n len = static_cast(block_stop - pos);\n return E_BUFFER_NOT_FULL;\n }\n\n status = CreateBlock(0x23, // simple block id\n block_start, block_size,\n 0); // DiscardPadding\n\n if (status != 0)\n return status;\n\n m_pos = block_stop;\n\n return 0; // success\n}\n", + "target": "long Cluster::ParseSimpleBlock(long long block_size, long long& pos,\n long& len) {\n const long long block_start = pos;\n const long long block_stop = pos + block_size;\n\n IMkvReader* const pReader = m_pSegment->m_pReader;\n\n long long total, avail;\n\n long status = pReader->Length(&total, &avail);\n\n if (status < 0) // error\n return status;\n\n assert((total < 0) || (avail <= total));\n\n\n if ((pos + 1) > avail) {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n\n long long result = GetUIntLength(pReader, pos, len);\n\n if (result < 0) // error\n return static_cast(result);\n\n if (result > 0) // weird\n return E_BUFFER_NOT_FULL;\n\n if ((pos + len) > block_stop)\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + len) > avail)\n return E_BUFFER_NOT_FULL;\n\n const long long track = ReadUInt(pReader, pos, len);\n\n if (track < 0) // error\n return static_cast(track);\n\n\n if (track == 0)\n return E_FILE_FORMAT_INVALID;\n \n pos += len; // consume track number\n \n if ((pos + 2) > block_stop)\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + 2) > avail) {\n len = 2;\n return E_BUFFER_NOT_FULL;\n }\n\n pos += 2; // consume timecode\n\n if ((pos + 1) > block_stop)\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + 1) > avail) {\n len = 1;\n return E_BUFFER_NOT_FULL;\n }\n\n unsigned char flags;\n\n status = pReader->Read(pos, 1, &flags);\n\n if (status < 0) { // error or underflow\n len = 1;\n return status;\n }\n\n ++pos; // consume flags byte\n assert(pos <= avail);\n\n if (pos >= block_stop)\n return E_FILE_FORMAT_INVALID;\n\n const int lacing = int(flags & 0x06) >> 1;\n\n if ((lacing != 0) && (block_stop > avail)) {\n len = static_cast(block_stop - pos);\n return E_BUFFER_NOT_FULL;\n }\n\n status = CreateBlock(0x23, // simple block id\n block_start, block_size,\n 0); // DiscardPadding\n\n if (status != 0)\n return status;\n\n m_pos = block_stop;\n\n return 0; // success\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#45d901b56f578a74b19ba0d10fa5c4c467f19303", + "input": " void GM2TabStyle::PaintInactiveTabBackground(gfx::Canvas* canvas,\n const SkPath& clip) const {\n bool has_custom_image;\n int fill_id = tab_->controller()->GetBackgroundResourceId(&has_custom_image);\n if (!has_custom_image)\n fill_id = 0;\n \n PaintTabBackground(canvas, false /* active */, fill_id, 0,\n tab_->controller()->MaySetClip() ? &clip : nullptr);\n }\n", + "target": " void GM2TabStyle::PaintInactiveTabBackground(gfx::Canvas* canvas,\n const SkPath& clip) const {\n bool has_custom_image;\n int fill_id = tab_->controller()->GetBackgroundResourceId(&has_custom_image);\n if (!has_custom_image)\n fill_id = 0;\n \n PaintTabBackground(canvas, TAB_INACTIVE, fill_id, 0,\n tab_->controller()->MaySetClip() ? &clip : nullptr);\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f911e11e7f6b5c0d6f5ee694a9871de6619889f7", + "input": " void ChunkToLayerMapper::SwitchToChunk(const PaintChunk& chunk) {\n outset_for_raster_effects_ = chunk.outset_for_raster_effects;\n \n const auto& new_chunk_state = chunk.properties.GetPropertyTreeState();\n if (new_chunk_state == chunk_state_)\n return;\n \n if (new_chunk_state == layer_state_) {\n has_filter_that_moves_pixels_ = false;\n transform_ = TransformationMatrix().Translate(-layer_offset_.x(),\n -layer_offset_.y());\n clip_rect_ = FloatClipRect();\n chunk_state_ = new_chunk_state;\n return;\n }\n\n if (new_chunk_state.Transform() != chunk_state_.Transform()) {\n transform_ = GeometryMapper::SourceToDestinationProjection(\n new_chunk_state.Transform(), layer_state_.Transform());\n transform_.PostTranslate(-layer_offset_.x(), -layer_offset_.y());\n }\n\n bool new_has_filter_that_moves_pixels = has_filter_that_moves_pixels_;\n if (new_chunk_state.Effect() != chunk_state_.Effect()) {\n new_has_filter_that_moves_pixels = false;\n for (const auto* effect = new_chunk_state.Effect();\n effect && effect != layer_state_.Effect(); effect = effect->Parent()) {\n if (effect->HasFilterThatMovesPixels()) {\n new_has_filter_that_moves_pixels = true;\n break;\n }\n }\n }\n\n bool needs_clip_recalculation =\n new_has_filter_that_moves_pixels != has_filter_that_moves_pixels_ ||\n new_chunk_state.Clip() != chunk_state_.Clip();\n if (needs_clip_recalculation) {\n clip_rect_ =\n GeometryMapper::LocalToAncestorClipRect(new_chunk_state, layer_state_);\n if (!clip_rect_.IsInfinite())\n clip_rect_.MoveBy(FloatPoint(-layer_offset_.x(), -layer_offset_.y()));\n }\n\n chunk_state_ = new_chunk_state;\n has_filter_that_moves_pixels_ = new_has_filter_that_moves_pixels;\n}\n", + "target": " void ChunkToLayerMapper::SwitchToChunk(const PaintChunk& chunk) {\n outset_for_raster_effects_ = chunk.outset_for_raster_effects;\n \n const auto& new_chunk_state = chunk.properties;\n if (new_chunk_state == chunk_state_)\n return;\n \n if (new_chunk_state == layer_state_) {\n has_filter_that_moves_pixels_ = false;\n transform_ = TransformationMatrix().Translate(-layer_offset_.x(),\n -layer_offset_.y());\n clip_rect_ = FloatClipRect();\n chunk_state_ = new_chunk_state;\n return;\n }\n\n if (new_chunk_state.Transform() != chunk_state_.Transform()) {\n transform_ = GeometryMapper::SourceToDestinationProjection(\n new_chunk_state.Transform(), layer_state_.Transform());\n transform_.PostTranslate(-layer_offset_.x(), -layer_offset_.y());\n }\n\n bool new_has_filter_that_moves_pixels = has_filter_that_moves_pixels_;\n if (new_chunk_state.Effect() != chunk_state_.Effect()) {\n new_has_filter_that_moves_pixels = false;\n for (const auto* effect = new_chunk_state.Effect();\n effect && effect != layer_state_.Effect(); effect = effect->Parent()) {\n if (effect->HasFilterThatMovesPixels()) {\n new_has_filter_that_moves_pixels = true;\n break;\n }\n }\n }\n\n bool needs_clip_recalculation =\n new_has_filter_that_moves_pixels != has_filter_that_moves_pixels_ ||\n new_chunk_state.Clip() != chunk_state_.Clip();\n if (needs_clip_recalculation) {\n clip_rect_ =\n GeometryMapper::LocalToAncestorClipRect(new_chunk_state, layer_state_);\n if (!clip_rect_.IsInfinite())\n clip_rect_.MoveBy(FloatPoint(-layer_offset_.x(), -layer_offset_.y()));\n }\n\n chunk_state_ = new_chunk_state;\n has_filter_that_moves_pixels_ = new_has_filter_that_moves_pixels;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9c6b899f7a46893ab3b671e341a2234e9c0c060e", + "input": "static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,\n const char *name, V9fsPath *target)\n {\n if (dir_path) {\n v9fs_path_sprintf(target, \"%s/%s\", dir_path->data, name);\n } else {\n v9fs_path_sprintf(target, \"%s\", name);\n }\n return 0;\n }\n", + "target": "static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,\n const char *name, V9fsPath *target)\n {\n if (dir_path) {\n v9fs_path_sprintf(target, \"%s/%s\", dir_path->data, name);\n } else if (strcmp(name, \"/\")) {\n v9fs_path_sprintf(target, \"%s\", name);\n } else {\n /* We want the path of the export root to be relative, otherwise\n * \"*at()\" syscalls would treat it as \"/\" in the host.\n */\n v9fs_path_sprintf(target, \"%s\", \".\");\n }\n return 0;\n }\n", + "vul_type": "cwe-732", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d6e2f6f128cef4c21cb80941ae674c9842681aa7", + "input": " static bool dump_fd_info(const char *dest_filename, char *source_filename, int source_base_ofs, uid_t uid, gid_t gid)\n {\n FILE *fp = fopen(dest_filename, \"w\");\n if (!fp)\n return false;\n \n unsigned fd = 0;\n while (fd <= 99999) /* paranoia check */\n {\n sprintf(source_filename + source_base_ofs, \"fd/%u\", fd);\n char *name = malloc_readlink(source_filename);\n if (!name)\n break;\n fprintf(fp, \"%u:%s\\n\", fd, name);\n free(name);\n\n sprintf(source_filename + source_base_ofs, \"fdinfo/%u\", fd);\n fd++;\n FILE *in = fopen(source_filename, \"r\");\n if (!in)\n continue;\n char buf[128];\n while (fgets(buf, sizeof(buf)-1, in))\n {\n /* in case the line is not terminated, terminate it */\n char *eol = strchrnul(buf, '\\n');\n eol[0] = '\\n';\n eol[1] = '\\0';\n fputs(buf, fp);\n }\n fclose(in);\n }\n\n const int dest_fd = fileno(fp);\n if (fchown(dest_fd, uid, gid) < 0)\n {\n perror_msg(\"Can't change '%s' ownership to %lu:%lu\", dest_filename, (long)uid, (long)gid);\n fclose(fp);\n unlink(dest_filename);\n return false;\n }\n\n fclose(fp);\n return true;\n}\n", + "target": " static bool dump_fd_info(const char *dest_filename, char *source_filename, int source_base_ofs, uid_t uid, gid_t gid)\n {\n FILE *fp = fopen(dest_filename, \"wx\");\n if (!fp)\n return false;\n \n unsigned fd = 0;\n while (fd <= 99999) /* paranoia check */\n {\n sprintf(source_filename + source_base_ofs, \"fd/%u\", fd);\n char *name = malloc_readlink(source_filename);\n if (!name)\n break;\n fprintf(fp, \"%u:%s\\n\", fd, name);\n free(name);\n\n sprintf(source_filename + source_base_ofs, \"fdinfo/%u\", fd);\n fd++;\n FILE *in = fopen(source_filename, \"r\");\n if (!in)\n continue;\n char buf[128];\n while (fgets(buf, sizeof(buf)-1, in))\n {\n /* in case the line is not terminated, terminate it */\n char *eol = strchrnul(buf, '\\n');\n eol[0] = '\\n';\n eol[1] = '\\0';\n fputs(buf, fp);\n }\n fclose(in);\n }\n\n const int dest_fd = fileno(fp);\n if (fchown(dest_fd, uid, gid) < 0)\n {\n perror_msg(\"Can't change '%s' ownership to %lu:%lu\", dest_filename, (long)uid, (long)gid);\n fclose(fp);\n unlink(dest_filename);\n return false;\n }\n\n fclose(fp);\n return true;\n}\n", + "vul_type": "cwe-59", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2ee663f39dc8dac3d9988e847db19b2d7e3ac8c6", + "input": "void ntlm_populate_message_header(NTLM_MESSAGE_HEADER* header, UINT32 MessageType)\n {\n \tCopyMemory(header->Signature, NTLM_SIGNATURE, sizeof(NTLM_SIGNATURE));\n \theader->MessageType = MessageType;\n }\n", + "target": "void ntlm_populate_message_header(NTLM_MESSAGE_HEADER* header, UINT32 MessageType)\nstatic void ntlm_populate_message_header(NTLM_MESSAGE_HEADER* header, UINT32 MessageType)\n {\n \tCopyMemory(header->Signature, NTLM_SIGNATURE, sizeof(NTLM_SIGNATURE));\n \theader->MessageType = MessageType;\n }\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d358f57009b85fb7440208afa5ba87636b491889", + "input": "void BluetoothDeviceChromeOS::UnregisterAgent() {\n if (!agent_.get())\n return;\n DCHECK(pairing_delegate_);\n DCHECK(pincode_callback_.is_null());\n DCHECK(passkey_callback_.is_null());\n DCHECK(confirmation_callback_.is_null());\n pairing_delegate_->DismissDisplayOrConfirm();\n pairing_delegate_ = NULL;\n agent_.reset();\n VLOG(1) << object_path_.value() << \": Unregistering pairing agent\";\n DBusThreadManager::Get()->GetBluetoothAgentManagerClient()->\n UnregisterAgent(\n dbus::ObjectPath(kAgentPath),\n base::Bind(&base::DoNothing),\n base::Bind(&BluetoothDeviceChromeOS::OnUnregisterAgentError,\n weak_ptr_factory_.GetWeakPtr()));\n}\n", + "target": "void BluetoothDeviceChromeOS::UnregisterAgent() {\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "modifier_color_encoding_is_set(PNG_CONST png_modifier *pm)\n {\n return pm->current_gamma != 0;\n }\n", + "target": "modifier_color_encoding_is_set(PNG_CONST png_modifier *pm)\nmodifier_color_encoding_is_set(const png_modifier *pm)\n {\n return pm->current_gamma != 0;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#05a974efa4bdf6e2a150e3f27dc6fcf0a9ad5655", + "input": " static int atusb_get_and_show_revision(struct atusb *atusb)\n {\n \tstruct usb_device *usb_dev = atusb->usb_dev;\n\tunsigned char buffer[3];\n \tint ret;\n \n \t/* Get a couple of the ATMega Firmware values */\n \tret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0),\n \t\t\t\tATUSB_ID, ATUSB_REQ_FROM_DEV, 0, 0,\n\t\t\t\tbuffer, 3, 1000);\n\tif (ret >= 0) {\n\t\tatusb->fw_ver_maj = buffer[0];\n\t\tatusb->fw_ver_min = buffer[1];\n\t\tatusb->fw_hw_type = buffer[2];\n\n\t\tdev_info(&usb_dev->dev,\n\t\t\t \"Firmware: major: %u, minor: %u, hardware type: %u\\n\",\n\t\t\t atusb->fw_ver_maj, atusb->fw_ver_min, atusb->fw_hw_type);\n\t}\n\tif (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 2) {\n\t\tdev_info(&usb_dev->dev,\n\t\t\t \"Firmware version (%u.%u) predates our first public release.\",\n\t\t\t atusb->fw_ver_maj, atusb->fw_ver_min);\n \t\tdev_info(&usb_dev->dev, \"Please update to version 0.2 or newer\");\n \t}\n \n \treturn ret;\n }\n", + "target": " static int atusb_get_and_show_revision(struct atusb *atusb)\n {\n \tstruct usb_device *usb_dev = atusb->usb_dev;\n\tunsigned char *buffer;\n \tint ret;\n \n\tbuffer = kmalloc(3, GFP_KERNEL);\n\tif (!buffer)\n\t\treturn -ENOMEM;\n\n \t/* Get a couple of the ATMega Firmware values */\n \tret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0),\n \t\t\t\tATUSB_ID, ATUSB_REQ_FROM_DEV, 0, 0,\n\t\t\t\tbuffer, 3, 1000);\n\tif (ret >= 0) {\n\t\tatusb->fw_ver_maj = buffer[0];\n\t\tatusb->fw_ver_min = buffer[1];\n\t\tatusb->fw_hw_type = buffer[2];\n\n\t\tdev_info(&usb_dev->dev,\n\t\t\t \"Firmware: major: %u, minor: %u, hardware type: %u\\n\",\n\t\t\t atusb->fw_ver_maj, atusb->fw_ver_min, atusb->fw_hw_type);\n\t}\n\tif (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 2) {\n\t\tdev_info(&usb_dev->dev,\n\t\t\t \"Firmware version (%u.%u) predates our first public release.\",\n\t\t\t atusb->fw_ver_maj, atusb->fw_ver_min);\n \t\tdev_info(&usb_dev->dev, \"Please update to version 0.2 or newer\");\n \t}\n \n\tkfree(buffer);\n \treturn ret;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a4ca568cdf68cf4a0343eb161518dc8e50cea87d", + "input": "void CtcpHandler::handleAction(CtcpType ctcptype, const QString &prefix, const QString &target, const QString ¶m) {\n Q_UNUSED(ctcptype)\n emit displayMsg(Message::Action, typeByTarget(target), target, param, prefix);\n }\n", + "target": "void CtcpHandler::handleAction(CtcpType ctcptype, const QString &prefix, const QString &target, const QString ¶m) {\nvoid CtcpHandler::handleAction(CtcpType ctcptype, const QString &prefix, const QString &target, const QString ¶m, QString &/*reply*/) {\n Q_UNUSED(ctcptype)\n emit displayMsg(Message::Action, typeByTarget(target), target, param, prefix);\n }\n", + "vul_type": "cwe-399", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6d1c73b5858fefc6161c7d686345f0dc887ea799", + "input": " smb2_flush(smb_request_t *sr)\n {\n\tsmb_ofile_t *of = NULL;\n \tuint16_t StructSize;\n \tuint16_t reserved1;\n \tuint32_t reserved2;\n\tsmb2fid_t smb2fid;\n\tuint32_t status;\n\tint rc = 0;\n\n\t/*\n\t * SMB2 Flush request\n\t */\n\trc = smb_mbc_decodef(\n\t &sr->smb_data, \"wwlqq\",\n\t &StructSize,\t\t/* w */\n\t &reserved1,\t\t\t/* w */\n\t &reserved2,\t\t\t/* l */\n\t &smb2fid.persistent,\t/* q */\n\t &smb2fid.temporal);\t\t/* q */\n\tif (rc)\n\t\treturn (SDRC_ERROR);\n\tif (StructSize != 24)\n\t\treturn (SDRC_ERROR);\n\n\tstatus = smb2sr_lookup_fid(sr, &smb2fid);\n\tif (status) {\n \t\tsmb2sr_put_error(sr, status);\n \t\treturn (SDRC_SUCCESS);\n \t}\n\tof = sr->fid_ofile;\n \n\t/*\n\t * XXX - todo:\n\t * Flush named pipe should drain writes.\n\t */\n\tif ((of->f_node->flags & NODE_FLAGS_WRITE_THROUGH) == 0)\n\t\t(void) smb_fsop_commit(sr, of->f_cr, of->f_node);\n \n \t/*\n \t * SMB2 Flush reply\n\t */\n\t(void) smb_mbc_encodef(\n\t &sr->reply, \"wwl\",\n\t 4,\t/* StructSize */\t/* w */\n\t 0); /* reserved */\t\t/* w */\n\n\treturn (SDRC_SUCCESS);\n}\n", + "target": " smb2_flush(smb_request_t *sr)\n {\n \tuint16_t StructSize;\n \tuint16_t reserved1;\n \tuint32_t reserved2;\n\tsmb2fid_t smb2fid;\n\tuint32_t status;\n\tint rc = 0;\n\n\t/*\n\t * SMB2 Flush request\n\t */\n\trc = smb_mbc_decodef(\n\t &sr->smb_data, \"wwlqq\",\n\t &StructSize,\t\t/* w */\n\t &reserved1,\t\t\t/* w */\n\t &reserved2,\t\t\t/* l */\n\t &smb2fid.persistent,\t/* q */\n\t &smb2fid.temporal);\t\t/* q */\n\tif (rc)\n\t\treturn (SDRC_ERROR);\n\tif (StructSize != 24)\n\t\treturn (SDRC_ERROR);\n\n\tstatus = smb2sr_lookup_fid(sr, &smb2fid);\n\tif (status) {\n \t\tsmb2sr_put_error(sr, status);\n \t\treturn (SDRC_SUCCESS);\n \t}\n \n\tsmb_ofile_flush(sr, sr->fid_ofile);\n \n \t/*\n \t * SMB2 Flush reply\n\t */\n\t(void) smb_mbc_encodef(\n\t &sr->reply, \"wwl\",\n\t 4,\t/* StructSize */\t/* w */\n\t 0); /* reserved */\t\t/* w */\n\n\treturn (SDRC_SUCCESS);\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#74aaa70032784e7cf00256821f29b2b53edb6589", + "input": " void ParamTraits::Write(Message* m, const GURL& p) {\n DCHECK(p.possibly_invalid_spec().length() <= content::kMaxURLChars);\n m->WriteString(p.possibly_invalid_spec());\n }\n", + "target": " void ParamTraits::Write(Message* m, const GURL& p) {\n DCHECK(p.possibly_invalid_spec().length() <= content::kMaxURLChars);\n\n // Beware of print-parse inconsistency which would change an invalid\n // URL into a valid one. Ideally, the message would contain this flag\n // so that the read side could make the check, but performing it here\n // avoids changing the on-the-wire representation of such a fundamental\n // type as GURL. See https://crbug.com/166486 for additional work in\n // this area.\n if (!p.is_valid()) {\n GURL reconstructed_url(p.possibly_invalid_spec());\n if (reconstructed_url.is_valid()) {\n DLOG(WARNING) << \"GURL string \" << p.possibly_invalid_spec()\n << \" (marked invalid) but parsed as valid.\";\n m->WriteString(std::string());\n return;\n }\n }\n\n m->WriteString(p.possibly_invalid_spec());\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ce90e05774dd77d86cfc8dfa6da57b32816841c4", + "input": " toomany(struct magic_set *ms, const char *name, uint16_t num)\n {\n\tif (file_printf(ms, \", too many %s header sections (%u)\", name, num\n \t ) == -1)\n \t\treturn -1;\n \treturn 0;\n}\n", + "target": " toomany(struct magic_set *ms, const char *name, uint16_t num)\n {\n\tif (file_printf(ms, \", too many %s (%u)\", name, num\n \t ) == -1)\n \t\treturn -1;\n \treturn 0;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#aa1a102f73565feeb1d121d0d6c9524bebcdd75f", + "input": "void XMLHttpRequest::genericError()\n {\n clearResponse();\n clearRequest();\n m_error = true;\n \n changeState(DONE);\n }\n", + "target": "void XMLHttpRequest::genericError()\nvoid XMLHttpRequest::handleDidFailGeneric()\n {\n clearResponse();\n clearRequest();\n \n m_error = true;\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#7-35e4733721a9", + "input": " def test_get_ports(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = 'showport'\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = 'showport -iscsi'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = 'showport -iscsiname'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI),\n ''])\n self.mox.ReplayAll()\n\n ports = self.driver.common.get_ports()\n self.assertEqual(ports['FC'][0], '20210002AC00383D')\n self.assertEqual(ports['iSCSI']['10.10.120.252']['nsp'], '0:8:2')", + "target": " def test_get_ports(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = ['showport']\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = ['showport', '-iscsi']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = ['showport', '-iscsiname']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI),\n ''])\n self.mox.ReplayAll()\n\n ports = self.driver.common.get_ports()\n self.assertEqual(ports['FC'][0], '20210002AC00383D')\n self.assertEqual(ports['iSCSI']['10.10.120.252']['nsp'], '0:8:2')", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#7cde8513c12a6e8ec5d1d1eb1cfd078d9adad3ef", + "input": "void PageInfo::OnWhitelistPasswordReuseButtonPressed(\n content::WebContents* web_contents) {\n #if defined(FULL_SAFE_BROWSING)\n DCHECK(password_protection_service_);\n DCHECK(safe_browsing_status_ == SAFE_BROWSING_STATUS_SIGN_IN_PASSWORD_REUSE ||\n safe_browsing_status_ ==\n SAFE_BROWSING_STATUS_ENTERPRISE_PASSWORD_REUSE);\n password_protection_service_->OnUserAction(\n web_contents,\n safe_browsing_status_ == SAFE_BROWSING_STATUS_SIGN_IN_PASSWORD_REUSE\n ? PasswordReuseEvent::SIGN_IN_PASSWORD\n : PasswordReuseEvent::ENTERPRISE_PASSWORD,\n safe_browsing::WarningUIType::PAGE_INFO,\n safe_browsing::WarningAction::MARK_AS_LEGITIMATE);\n#endif\n}\n", + "target": "void PageInfo::OnWhitelistPasswordReuseButtonPressed(\n content::WebContents* web_contents) {\n #if defined(FULL_SAFE_BROWSING)\n DCHECK(password_protection_service_);\n DCHECK(site_identity_status_ == SITE_IDENTITY_STATUS_SIGN_IN_PASSWORD_REUSE ||\n site_identity_status_ ==\n SITE_IDENTITY_STATUS_ENTERPRISE_PASSWORD_REUSE);\n password_protection_service_->OnUserAction(\n web_contents,\n site_identity_status_ == SITE_IDENTITY_STATUS_SIGN_IN_PASSWORD_REUSE\n ? PasswordReuseEvent::SIGN_IN_PASSWORD\n : PasswordReuseEvent::ENTERPRISE_PASSWORD,\n safe_browsing::WarningUIType::PAGE_INFO,\n safe_browsing::WarningAction::MARK_AS_LEGITIMATE);\n#endif\n}\n", + "vul_type": "cwe-311", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#64dd153c83743af81f20924c6343652d731eeecb", + "input": "static long gfs2_fallocate(struct file *file, int mode, loff_t offset,\n\t\t\t loff_t len)\n{\n\tstruct inode *inode = file->f_path.dentry->d_inode;\n\tstruct gfs2_sbd *sdp = GFS2_SB(inode);\n\tstruct gfs2_inode *ip = GFS2_I(inode);\n\tunsigned int data_blocks = 0, ind_blocks = 0, rblocks;\n\tloff_t bytes, max_bytes;\n\tstruct gfs2_alloc *al;\n \tint error;\n \tloff_t bsize_mask = ~((loff_t)sdp->sd_sb.sb_bsize - 1);\n \tloff_t next = (offset + len - 1) >> sdp->sd_sb.sb_bsize_shift;\n \tnext = (next + 1) << sdp->sd_sb.sb_bsize_shift;\n \n \t/* We only support the FALLOC_FL_KEEP_SIZE mode */\n\tif (mode & ~FALLOC_FL_KEEP_SIZE)\n\t\treturn -EOPNOTSUPP;\n\n\toffset &= bsize_mask;\n\n\tlen = next - offset;\n\tbytes = sdp->sd_max_rg_data * sdp->sd_sb.sb_bsize / 2;\n\tif (!bytes)\n\t\tbytes = UINT_MAX;\n\tbytes &= bsize_mask;\n\tif (bytes == 0)\n\t\tbytes = sdp->sd_sb.sb_bsize;\n\n\tgfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ip->i_gh);\n\terror = gfs2_glock_nq(&ip->i_gh);\n\tif (unlikely(error))\n\t\tgoto out_uninit;\n\n\tif (!gfs2_write_alloc_required(ip, offset, len))\n\t\tgoto out_unlock;\n\n\twhile (len > 0) {\n\t\tif (len < bytes)\n\t\t\tbytes = len;\n\t\tal = gfs2_alloc_get(ip);\n\t\tif (!al) {\n\t\t\terror = -ENOMEM;\n\t\t\tgoto out_unlock;\n\t\t}\n\n\t\terror = gfs2_quota_lock_check(ip);\n\t\tif (error)\n\t\t\tgoto out_alloc_put;\n\nretry:\n\t\tgfs2_write_calc_reserv(ip, bytes, &data_blocks, &ind_blocks);\n\n\t\tal->al_requested = data_blocks + ind_blocks;\n\t\terror = gfs2_inplace_reserve(ip);\n\t\tif (error) {\n\t\t\tif (error == -ENOSPC && bytes > sdp->sd_sb.sb_bsize) {\n\t\t\t\tbytes >>= 1;\n\t\t\t\tbytes &= bsize_mask;\n\t\t\t\tif (bytes == 0)\n\t\t\t\t\tbytes = sdp->sd_sb.sb_bsize;\n\t\t\t\tgoto retry;\n\t\t\t}\n \t\t\tgoto out_qunlock;\n \t\t}\n \t\tmax_bytes = bytes;\n\t\tcalc_max_reserv(ip, len, &max_bytes, &data_blocks, &ind_blocks);\n \t\tal->al_requested = data_blocks + ind_blocks;\n \n \t\trblocks = RES_DINODE + ind_blocks + RES_STATFS + RES_QUOTA +\n\t\t\t RES_RG_HDR + gfs2_rg_blocks(ip);\n\t\tif (gfs2_is_jdata(ip))\n\t\t\trblocks += data_blocks ? data_blocks : 1;\n\n\t\terror = gfs2_trans_begin(sdp, rblocks,\n\t\t\t\t\t PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize);\n\t\tif (error)\n\t\t\tgoto out_trans_fail;\n\n\t\terror = fallocate_chunk(inode, offset, max_bytes, mode);\n\t\tgfs2_trans_end(sdp);\n\n\t\tif (error)\n\t\t\tgoto out_trans_fail;\n\n\t\tlen -= max_bytes;\n\t\toffset += max_bytes;\n\t\tgfs2_inplace_release(ip);\n\t\tgfs2_quota_unlock(ip);\n\t\tgfs2_alloc_put(ip);\n\t}\n\tgoto out_unlock;\n\nout_trans_fail:\n\tgfs2_inplace_release(ip);\nout_qunlock:\n\tgfs2_quota_unlock(ip);\nout_alloc_put:\n\tgfs2_alloc_put(ip);\nout_unlock:\n\tgfs2_glock_dq(&ip->i_gh);\nout_uninit:\n\tgfs2_holder_uninit(&ip->i_gh);\n\treturn error;\n}\n", + "target": "static long gfs2_fallocate(struct file *file, int mode, loff_t offset,\n\t\t\t loff_t len)\n{\n\tstruct inode *inode = file->f_path.dentry->d_inode;\n\tstruct gfs2_sbd *sdp = GFS2_SB(inode);\n\tstruct gfs2_inode *ip = GFS2_I(inode);\n\tunsigned int data_blocks = 0, ind_blocks = 0, rblocks;\n\tloff_t bytes, max_bytes;\n\tstruct gfs2_alloc *al;\n \tint error;\n \tloff_t bsize_mask = ~((loff_t)sdp->sd_sb.sb_bsize - 1);\n \tloff_t next = (offset + len - 1) >> sdp->sd_sb.sb_bsize_shift;\n\tloff_t max_chunk_size = UINT_MAX & bsize_mask;\n \tnext = (next + 1) << sdp->sd_sb.sb_bsize_shift;\n \n \t/* We only support the FALLOC_FL_KEEP_SIZE mode */\n\tif (mode & ~FALLOC_FL_KEEP_SIZE)\n\t\treturn -EOPNOTSUPP;\n\n\toffset &= bsize_mask;\n\n\tlen = next - offset;\n\tbytes = sdp->sd_max_rg_data * sdp->sd_sb.sb_bsize / 2;\n\tif (!bytes)\n\t\tbytes = UINT_MAX;\n\tbytes &= bsize_mask;\n\tif (bytes == 0)\n\t\tbytes = sdp->sd_sb.sb_bsize;\n\n\tgfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ip->i_gh);\n\terror = gfs2_glock_nq(&ip->i_gh);\n\tif (unlikely(error))\n\t\tgoto out_uninit;\n\n\tif (!gfs2_write_alloc_required(ip, offset, len))\n\t\tgoto out_unlock;\n\n\twhile (len > 0) {\n\t\tif (len < bytes)\n\t\t\tbytes = len;\n\t\tal = gfs2_alloc_get(ip);\n\t\tif (!al) {\n\t\t\terror = -ENOMEM;\n\t\t\tgoto out_unlock;\n\t\t}\n\n\t\terror = gfs2_quota_lock_check(ip);\n\t\tif (error)\n\t\t\tgoto out_alloc_put;\n\nretry:\n\t\tgfs2_write_calc_reserv(ip, bytes, &data_blocks, &ind_blocks);\n\n\t\tal->al_requested = data_blocks + ind_blocks;\n\t\terror = gfs2_inplace_reserve(ip);\n\t\tif (error) {\n\t\t\tif (error == -ENOSPC && bytes > sdp->sd_sb.sb_bsize) {\n\t\t\t\tbytes >>= 1;\n\t\t\t\tbytes &= bsize_mask;\n\t\t\t\tif (bytes == 0)\n\t\t\t\t\tbytes = sdp->sd_sb.sb_bsize;\n\t\t\t\tgoto retry;\n\t\t\t}\n \t\t\tgoto out_qunlock;\n \t\t}\n \t\tmax_bytes = bytes;\n\t\tcalc_max_reserv(ip, (len > max_chunk_size)? max_chunk_size: len,\n\t\t\t\t&max_bytes, &data_blocks, &ind_blocks);\n \t\tal->al_requested = data_blocks + ind_blocks;\n \n \t\trblocks = RES_DINODE + ind_blocks + RES_STATFS + RES_QUOTA +\n\t\t\t RES_RG_HDR + gfs2_rg_blocks(ip);\n\t\tif (gfs2_is_jdata(ip))\n\t\t\trblocks += data_blocks ? data_blocks : 1;\n\n\t\terror = gfs2_trans_begin(sdp, rblocks,\n\t\t\t\t\t PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize);\n\t\tif (error)\n\t\t\tgoto out_trans_fail;\n\n\t\terror = fallocate_chunk(inode, offset, max_bytes, mode);\n\t\tgfs2_trans_end(sdp);\n\n\t\tif (error)\n\t\t\tgoto out_trans_fail;\n\n\t\tlen -= max_bytes;\n\t\toffset += max_bytes;\n\t\tgfs2_inplace_release(ip);\n\t\tgfs2_quota_unlock(ip);\n\t\tgfs2_alloc_put(ip);\n\t}\n\tgoto out_unlock;\n\nout_trans_fail:\n\tgfs2_inplace_release(ip);\nout_qunlock:\n\tgfs2_quota_unlock(ip);\nout_alloc_put:\n\tgfs2_alloc_put(ip);\nout_unlock:\n\tgfs2_glock_dq(&ip->i_gh);\nout_uninit:\n\tgfs2_holder_uninit(&ip->i_gh);\n\treturn error;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4e78c724d47e2342aa8fde61f6b8536f662f795f", + "input": "static int tomoyo_mount_acl(struct tomoyo_request_info *r, char *dev_name,\n\t\t\t struct path *dir, char *type, unsigned long flags)\n{\n\tstruct path path;\n\tstruct file_system_type *fstype = NULL;\n\tconst char *requested_type = NULL;\n\tconst char *requested_dir_name = NULL;\n\tconst char *requested_dev_name = NULL;\n\tstruct tomoyo_path_info rtype;\n\tstruct tomoyo_path_info rdev;\n\tstruct tomoyo_path_info rdir;\n\tint need_dev = 0;\n\tint error = -ENOMEM;\n\n\t/* Get fstype. */\n\trequested_type = tomoyo_encode(type);\n\tif (!requested_type)\n\t\tgoto out;\n\trtype.name = requested_type;\n\ttomoyo_fill_path_info(&rtype);\n\n\t/* Get mount point. */\n\trequested_dir_name = tomoyo_realpath_from_path(dir);\n\tif (!requested_dir_name) {\n\t\terror = -ENOMEM;\n\t\tgoto out;\n\t}\n\trdir.name = requested_dir_name;\n\ttomoyo_fill_path_info(&rdir);\n\n\t/* Compare fs name. */\n\tif (!strcmp(type, TOMOYO_MOUNT_REMOUNT_KEYWORD)) {\n\t\t/* dev_name is ignored. */\n\t} else if (!strcmp(type, TOMOYO_MOUNT_MAKE_UNBINDABLE_KEYWORD) ||\n\t\t !strcmp(type, TOMOYO_MOUNT_MAKE_PRIVATE_KEYWORD) ||\n\t\t !strcmp(type, TOMOYO_MOUNT_MAKE_SLAVE_KEYWORD) ||\n\t\t !strcmp(type, TOMOYO_MOUNT_MAKE_SHARED_KEYWORD)) {\n\t\t/* dev_name is ignored. */\n\t} else if (!strcmp(type, TOMOYO_MOUNT_BIND_KEYWORD) ||\n\t\t !strcmp(type, TOMOYO_MOUNT_MOVE_KEYWORD)) {\n\t\tneed_dev = -1; /* dev_name is a directory */\n\t} else {\n\t\tfstype = get_fs_type(type);\n\t\tif (!fstype) {\n\t\t\terror = -ENODEV;\n\t\t\tgoto out;\n\t\t}\n\t\tif (fstype->fs_flags & FS_REQUIRES_DEV)\n\t\t\t/* dev_name is a block device file. */\n\t\t\tneed_dev = 1;\n \t}\n \tif (need_dev) {\n \t\t/* Get mount point or device file. */\n\t\tif (kern_path(dev_name, LOOKUP_FOLLOW, &path)) {\n \t\t\terror = -ENOENT;\n \t\t\tgoto out;\n \t\t}\n\t\trequested_dev_name = tomoyo_realpath_from_path(&path);\n\t\tpath_put(&path);\n\t\tif (!requested_dev_name) {\n\t\t\terror = -ENOENT;\n\t\t\tgoto out;\n\t\t}\n\t} else {\n\t\t/* Map dev_name to \"\" if no dev_name given. */\n\t\tif (!dev_name)\n\t\t\tdev_name = \"\";\n\t\trequested_dev_name = tomoyo_encode(dev_name);\n\t\tif (!requested_dev_name) {\n\t\t\terror = -ENOMEM;\n\t\t\tgoto out;\n\t\t}\n\t}\n\trdev.name = requested_dev_name;\n\ttomoyo_fill_path_info(&rdev);\n\tr->param_type = TOMOYO_TYPE_MOUNT_ACL;\n\tr->param.mount.need_dev = need_dev;\n\tr->param.mount.dev = &rdev;\n\tr->param.mount.dir = &rdir;\n\tr->param.mount.type = &rtype;\n\tr->param.mount.flags = flags;\n\tdo {\n\t\ttomoyo_check_acl(r, tomoyo_check_mount_acl);\n\t\terror = tomoyo_audit_mount_log(r);\n\t} while (error == TOMOYO_RETRY_REQUEST);\n out:\n\tkfree(requested_dev_name);\n\tkfree(requested_dir_name);\n\tif (fstype)\n\t\tput_filesystem(fstype);\n\tkfree(requested_type);\n\treturn error;\n}\n", + "target": "static int tomoyo_mount_acl(struct tomoyo_request_info *r, char *dev_name,\n\t\t\t struct path *dir, char *type, unsigned long flags)\n{\n\tstruct path path;\n\tstruct file_system_type *fstype = NULL;\n\tconst char *requested_type = NULL;\n\tconst char *requested_dir_name = NULL;\n\tconst char *requested_dev_name = NULL;\n\tstruct tomoyo_path_info rtype;\n\tstruct tomoyo_path_info rdev;\n\tstruct tomoyo_path_info rdir;\n\tint need_dev = 0;\n\tint error = -ENOMEM;\n\n\t/* Get fstype. */\n\trequested_type = tomoyo_encode(type);\n\tif (!requested_type)\n\t\tgoto out;\n\trtype.name = requested_type;\n\ttomoyo_fill_path_info(&rtype);\n\n\t/* Get mount point. */\n\trequested_dir_name = tomoyo_realpath_from_path(dir);\n\tif (!requested_dir_name) {\n\t\terror = -ENOMEM;\n\t\tgoto out;\n\t}\n\trdir.name = requested_dir_name;\n\ttomoyo_fill_path_info(&rdir);\n\n\t/* Compare fs name. */\n\tif (!strcmp(type, TOMOYO_MOUNT_REMOUNT_KEYWORD)) {\n\t\t/* dev_name is ignored. */\n\t} else if (!strcmp(type, TOMOYO_MOUNT_MAKE_UNBINDABLE_KEYWORD) ||\n\t\t !strcmp(type, TOMOYO_MOUNT_MAKE_PRIVATE_KEYWORD) ||\n\t\t !strcmp(type, TOMOYO_MOUNT_MAKE_SLAVE_KEYWORD) ||\n\t\t !strcmp(type, TOMOYO_MOUNT_MAKE_SHARED_KEYWORD)) {\n\t\t/* dev_name is ignored. */\n\t} else if (!strcmp(type, TOMOYO_MOUNT_BIND_KEYWORD) ||\n\t\t !strcmp(type, TOMOYO_MOUNT_MOVE_KEYWORD)) {\n\t\tneed_dev = -1; /* dev_name is a directory */\n\t} else {\n\t\tfstype = get_fs_type(type);\n\t\tif (!fstype) {\n\t\t\terror = -ENODEV;\n\t\t\tgoto out;\n\t\t}\n\t\tif (fstype->fs_flags & FS_REQUIRES_DEV)\n\t\t\t/* dev_name is a block device file. */\n\t\t\tneed_dev = 1;\n \t}\n \tif (need_dev) {\n \t\t/* Get mount point or device file. */\n\t\tif (!dev_name || kern_path(dev_name, LOOKUP_FOLLOW, &path)) {\n \t\t\terror = -ENOENT;\n \t\t\tgoto out;\n \t\t}\n\t\trequested_dev_name = tomoyo_realpath_from_path(&path);\n\t\tpath_put(&path);\n\t\tif (!requested_dev_name) {\n\t\t\terror = -ENOENT;\n\t\t\tgoto out;\n\t\t}\n\t} else {\n\t\t/* Map dev_name to \"\" if no dev_name given. */\n\t\tif (!dev_name)\n\t\t\tdev_name = \"\";\n\t\trequested_dev_name = tomoyo_encode(dev_name);\n\t\tif (!requested_dev_name) {\n\t\t\terror = -ENOMEM;\n\t\t\tgoto out;\n\t\t}\n\t}\n\trdev.name = requested_dev_name;\n\ttomoyo_fill_path_info(&rdev);\n\tr->param_type = TOMOYO_TYPE_MOUNT_ACL;\n\tr->param.mount.need_dev = need_dev;\n\tr->param.mount.dev = &rdev;\n\tr->param.mount.dir = &rdir;\n\tr->param.mount.type = &rtype;\n\tr->param.mount.flags = flags;\n\tdo {\n\t\ttomoyo_check_acl(r, tomoyo_check_mount_acl);\n\t\terror = tomoyo_audit_mount_log(r);\n\t} while (error == TOMOYO_RETRY_REQUEST);\n out:\n\tkfree(requested_dev_name);\n\tkfree(requested_dir_name);\n\tif (fstype)\n\t\tput_filesystem(fstype);\n\tkfree(requested_type);\n\treturn error;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#592fd47a6245508b79fe6ac819fe6d3b2c1289be", + "input": "static int setup_ttydir_console(const struct lxc_rootfs *rootfs,\n\t\t\t const struct lxc_console *console,\n\t\t\t char *ttydir)\n{\n\tchar path[MAXPATHLEN], lxcpath[MAXPATHLEN];\n\tint ret;\n\n\t/* create rootfs/dev/ directory */\n\tret = snprintf(path, sizeof(path), \"%s/dev/%s\", rootfs->mount,\n\t\t ttydir);\n\tif (ret >= sizeof(path))\n\t\treturn -1;\n\tret = mkdir(path, 0755);\n\tif (ret && errno != EEXIST) {\n\t\tSYSERROR(\"failed with errno %d to create %s\", errno, path);\n\t\treturn -1;\n\t}\n\tINFO(\"created %s\", path);\n\n\tret = snprintf(lxcpath, sizeof(lxcpath), \"%s/dev/%s/console\",\n\t\t rootfs->mount, ttydir);\n\tif (ret >= sizeof(lxcpath)) {\n\t\tERROR(\"console path too long\");\n\t\treturn -1;\n\t}\n\n\tsnprintf(path, sizeof(path), \"%s/dev/console\", rootfs->mount);\n\tret = unlink(path);\n\tif (ret && errno != ENOENT) {\n\t\tSYSERROR(\"error unlinking %s\", path);\n\t\treturn -1;\n\t}\n\n\tret = creat(lxcpath, 0660);\n\tif (ret==-1 && errno != EEXIST) {\n\t\tSYSERROR(\"error %d creating %s\", errno, lxcpath);\n\t\treturn -1;\n\t}\n\tif (ret >= 0)\n\t\tclose(ret);\n\n\tif (console->master < 0) {\n\t\tINFO(\"no console\");\n \t\treturn 0;\n \t}\n \n\tif (mount(console->name, lxcpath, \"none\", MS_BIND, 0)) {\n \t\tERROR(\"failed to mount '%s' on '%s'\", console->name, lxcpath);\n \t\treturn -1;\n \t}\n\n\t/* create symlink from rootfs/dev/console to 'lxc/console' */\n\tret = snprintf(lxcpath, sizeof(lxcpath), \"%s/console\", ttydir);\n\tif (ret >= sizeof(lxcpath)) {\n\t\tERROR(\"lxc/console path too long\");\n\t\treturn -1;\n\t}\n\tret = symlink(lxcpath, path);\n\tif (ret) {\n\t\tSYSERROR(\"failed to create symlink for console\");\n\t\treturn -1;\n\t}\n\n\tINFO(\"console has been setup on %s\", lxcpath);\n\n\treturn 0;\n}\n", + "target": "static int setup_ttydir_console(const struct lxc_rootfs *rootfs,\n\t\t\t const struct lxc_console *console,\n\t\t\t char *ttydir)\n{\n\tchar path[MAXPATHLEN], lxcpath[MAXPATHLEN];\n\tint ret;\n\n\t/* create rootfs/dev/ directory */\n\tret = snprintf(path, sizeof(path), \"%s/dev/%s\", rootfs->mount,\n\t\t ttydir);\n\tif (ret >= sizeof(path))\n\t\treturn -1;\n\tret = mkdir(path, 0755);\n\tif (ret && errno != EEXIST) {\n\t\tSYSERROR(\"failed with errno %d to create %s\", errno, path);\n\t\treturn -1;\n\t}\n\tINFO(\"created %s\", path);\n\n\tret = snprintf(lxcpath, sizeof(lxcpath), \"%s/dev/%s/console\",\n\t\t rootfs->mount, ttydir);\n\tif (ret >= sizeof(lxcpath)) {\n\t\tERROR(\"console path too long\");\n\t\treturn -1;\n\t}\n\n\tsnprintf(path, sizeof(path), \"%s/dev/console\", rootfs->mount);\n\tret = unlink(path);\n\tif (ret && errno != ENOENT) {\n\t\tSYSERROR(\"error unlinking %s\", path);\n\t\treturn -1;\n\t}\n\n\tret = creat(lxcpath, 0660);\n\tif (ret==-1 && errno != EEXIST) {\n\t\tSYSERROR(\"error %d creating %s\", errno, lxcpath);\n\t\treturn -1;\n\t}\n\tif (ret >= 0)\n\t\tclose(ret);\n\n\tif (console->master < 0) {\n\t\tINFO(\"no console\");\n \t\treturn 0;\n \t}\n \n\tif (safe_mount(console->name, lxcpath, \"none\", MS_BIND, 0, rootfs->mount)) {\n \t\tERROR(\"failed to mount '%s' on '%s'\", console->name, lxcpath);\n \t\treturn -1;\n \t}\n\n\t/* create symlink from rootfs/dev/console to 'lxc/console' */\n\tret = snprintf(lxcpath, sizeof(lxcpath), \"%s/console\", ttydir);\n\tif (ret >= sizeof(lxcpath)) {\n\t\tERROR(\"lxc/console path too long\");\n\t\treturn -1;\n\t}\n\tret = symlink(lxcpath, path);\n\tif (ret) {\n\t\tSYSERROR(\"failed to create symlink for console\");\n\t\treturn -1;\n\t}\n\n\tINFO(\"console has been setup on %s\", lxcpath);\n\n\treturn 0;\n}\n", + "vul_type": "cwe-59", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cea4dcfdad926a27a18e188720efe0f2c9403456", + "input": "int iscsi_decode_text_input(\n\tu8 phase,\n\tu8 sender,\n\tchar *textbuf,\n\tu32 length,\n\tstruct iscsi_conn *conn)\n{\n\tstruct iscsi_param_list *param_list = conn->param_list;\n\tchar *tmpbuf, *start = NULL, *end = NULL;\n\n\ttmpbuf = kzalloc(length + 1, GFP_KERNEL);\n\tif (!tmpbuf) {\n\t\tpr_err(\"Unable to allocate memory for tmpbuf.\\n\");\n\t\treturn -1;\n\t}\n\n\tmemcpy(tmpbuf, textbuf, length);\n\ttmpbuf[length] = '\\0';\n\tstart = tmpbuf;\n\tend = (start + length);\n\n\twhile (start < end) {\n\t\tchar *key, *value;\n\t\tstruct iscsi_param *param;\n\n\t\tif (iscsi_extract_key_value(start, &key, &value) < 0) {\n\t\t\tkfree(tmpbuf);\n\t\t\treturn -1;\n\t\t}\n\n\t\tpr_debug(\"Got key: %s=%s\\n\", key, value);\n \n \t\tif (phase & PHASE_SECURITY) {\n \t\t\tif (iscsi_check_for_auth_key(key) > 0) {\n\t\t\t\tchar *tmpptr = key + strlen(key);\n\t\t\t\t*tmpptr = '=';\n \t\t\t\tkfree(tmpbuf);\n \t\t\t\treturn 1;\n \t\t\t}\n\t\t}\n\n\t\tparam = iscsi_check_key(key, phase, sender, param_list);\n\t\tif (!param) {\n\t\t\tif (iscsi_add_notunderstood_response(key,\n\t\t\t\t\tvalue, param_list) < 0) {\n\t\t\t\tkfree(tmpbuf);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tstart += strlen(key) + strlen(value) + 2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (iscsi_check_value(param, value) < 0) {\n\t\t\tkfree(tmpbuf);\n\t\t\treturn -1;\n\t\t}\n\n\t\tstart += strlen(key) + strlen(value) + 2;\n\n\t\tif (IS_PSTATE_PROPOSER(param)) {\n\t\t\tif (iscsi_check_proposer_state(param, value) < 0) {\n\t\t\t\tkfree(tmpbuf);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tSET_PSTATE_RESPONSE_GOT(param);\n\t\t} else {\n\t\t\tif (iscsi_check_acceptor_state(param, value, conn) < 0) {\n\t\t\t\tkfree(tmpbuf);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tSET_PSTATE_ACCEPTOR(param);\n\t\t}\n\t}\n\n\tkfree(tmpbuf);\n\treturn 0;\n}\n", + "target": "int iscsi_decode_text_input(\n\tu8 phase,\n\tu8 sender,\n\tchar *textbuf,\n\tu32 length,\n\tstruct iscsi_conn *conn)\n{\n\tstruct iscsi_param_list *param_list = conn->param_list;\n\tchar *tmpbuf, *start = NULL, *end = NULL;\n\n\ttmpbuf = kzalloc(length + 1, GFP_KERNEL);\n\tif (!tmpbuf) {\n\t\tpr_err(\"Unable to allocate memory for tmpbuf.\\n\");\n\t\treturn -1;\n\t}\n\n\tmemcpy(tmpbuf, textbuf, length);\n\ttmpbuf[length] = '\\0';\n\tstart = tmpbuf;\n\tend = (start + length);\n\n\twhile (start < end) {\n\t\tchar *key, *value;\n\t\tstruct iscsi_param *param;\n\n\t\tif (iscsi_extract_key_value(start, &key, &value) < 0) {\n\t\t\tkfree(tmpbuf);\n\t\t\treturn -1;\n\t\t}\n\n\t\tpr_debug(\"Got key: %s=%s\\n\", key, value);\n \n \t\tif (phase & PHASE_SECURITY) {\n \t\t\tif (iscsi_check_for_auth_key(key) > 0) {\n \t\t\t\tkfree(tmpbuf);\n \t\t\t\treturn 1;\n \t\t\t}\n\t\t}\n\n\t\tparam = iscsi_check_key(key, phase, sender, param_list);\n\t\tif (!param) {\n\t\t\tif (iscsi_add_notunderstood_response(key,\n\t\t\t\t\tvalue, param_list) < 0) {\n\t\t\t\tkfree(tmpbuf);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tstart += strlen(key) + strlen(value) + 2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (iscsi_check_value(param, value) < 0) {\n\t\t\tkfree(tmpbuf);\n\t\t\treturn -1;\n\t\t}\n\n\t\tstart += strlen(key) + strlen(value) + 2;\n\n\t\tif (IS_PSTATE_PROPOSER(param)) {\n\t\t\tif (iscsi_check_proposer_state(param, value) < 0) {\n\t\t\t\tkfree(tmpbuf);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tSET_PSTATE_RESPONSE_GOT(param);\n\t\t} else {\n\t\t\tif (iscsi_check_acceptor_state(param, value, conn) < 0) {\n\t\t\t\tkfree(tmpbuf);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tSET_PSTATE_ACCEPTOR(param);\n\t\t}\n\t}\n\n\tkfree(tmpbuf);\n\treturn 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#62b8b6e168a12263aab6b88dbef0b900cc37309f", + "input": " void PartialMagnificationController::OnMouseEvent(ui::MouseEvent* event) {\n if (IsPartialMagnified() && event->type() == ui::ET_MOUSE_MOVED) {\n aura::Window* target = static_cast(event->target());\n aura::Window* current_root = target->GetRootWindow();\n gfx::Rect root_bounds = current_root->bounds();\n if (root_bounds.Contains(event->root_location())) {\n SwitchTargetRootWindow(current_root);\n OnMouseMove(event->root_location());\n }\n }\n }\n", + "target": " void PartialMagnificationController::OnMouseEvent(ui::MouseEvent* event) {\n OnLocatedEvent(event, event->pointer_details());\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ee7579229ff7e9e5ae28bf53aea069251499d7da", + "input": "bool GLES2DecoderImpl::CheckFramebufferValid(\n Framebuffer* framebuffer,\n GLenum target, const char* func_name) {\n if (!framebuffer) {\n if (backbuffer_needs_clear_bits_) {\n glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat(\n offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1);\n state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);\n glClearStencil(0);\n state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1);\n state_.SetDeviceStencilMaskSeparate(GL_BACK, -1);\n glClearDepth(1.0f);\n state_.SetDeviceDepthMask(GL_TRUE);\n state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);\n glClear(backbuffer_needs_clear_bits_);\n backbuffer_needs_clear_bits_ = 0;\n RestoreClearState();\n }\n return true;\n }\n\n if (framebuffer_manager()->IsComplete(framebuffer)) {\n return true;\n }\n\n GLenum completeness = framebuffer->IsPossiblyComplete();\n if (completeness != GL_FRAMEBUFFER_COMPLETE) {\n LOCAL_SET_GL_ERROR(\n GL_INVALID_FRAMEBUFFER_OPERATION, func_name, \"framebuffer incomplete\");\n return false;\n }\n\n if (renderbuffer_manager()->HaveUnclearedRenderbuffers() ||\n texture_manager()->HaveUnclearedMips()) {\n if (!framebuffer->IsCleared()) {\n if (framebuffer->GetStatus(texture_manager(), target) !=\n GL_FRAMEBUFFER_COMPLETE) {\n LOCAL_SET_GL_ERROR(\n GL_INVALID_FRAMEBUFFER_OPERATION, func_name,\n \"framebuffer incomplete (clear)\");\n return false;\n }\n ClearUnclearedAttachments(target, framebuffer);\n }\n }\n\n if (!framebuffer_manager()->IsComplete(framebuffer)) {\n if (framebuffer->GetStatus(texture_manager(), target) !=\n GL_FRAMEBUFFER_COMPLETE) {\n LOCAL_SET_GL_ERROR(\n GL_INVALID_FRAMEBUFFER_OPERATION, func_name,\n \"framebuffer incomplete (check)\");\n return false;\n }\n framebuffer_manager()->MarkAsComplete(framebuffer);\n }\n\n return true;\n}\n", + "target": "bool GLES2DecoderImpl::CheckFramebufferValid(\n Framebuffer* framebuffer,\n GLenum target, const char* func_name) {\n if (!framebuffer) {\n if (backbuffer_needs_clear_bits_) {\n glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat(\n offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1);\n state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);\n glClearStencil(0);\n state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1);\n state_.SetDeviceStencilMaskSeparate(GL_BACK, -1);\n glClearDepth(1.0f);\n state_.SetDeviceDepthMask(GL_TRUE);\n state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);\n bool reset_draw_buffer = false;\n if ((backbuffer_needs_clear_bits_ | GL_COLOR_BUFFER_BIT) != 0 &&\n group_->draw_buffer() == GL_NONE) {\n reset_draw_buffer = true;\n GLenum buf = GL_BACK;\n if (GetBackbufferServiceId() != 0) // emulated backbuffer\n buf = GL_COLOR_ATTACHMENT0;\n glDrawBuffersARB(1, &buf);\n }\n glClear(backbuffer_needs_clear_bits_);\n if (reset_draw_buffer) {\n GLenum buf = GL_NONE;\n glDrawBuffersARB(1, &buf);\n }\n backbuffer_needs_clear_bits_ = 0;\n RestoreClearState();\n }\n return true;\n }\n\n if (framebuffer_manager()->IsComplete(framebuffer)) {\n return true;\n }\n\n GLenum completeness = framebuffer->IsPossiblyComplete();\n if (completeness != GL_FRAMEBUFFER_COMPLETE) {\n LOCAL_SET_GL_ERROR(\n GL_INVALID_FRAMEBUFFER_OPERATION, func_name, \"framebuffer incomplete\");\n return false;\n }\n\n if (renderbuffer_manager()->HaveUnclearedRenderbuffers() ||\n texture_manager()->HaveUnclearedMips()) {\n if (!framebuffer->IsCleared()) {\n if (framebuffer->GetStatus(texture_manager(), target) !=\n GL_FRAMEBUFFER_COMPLETE) {\n LOCAL_SET_GL_ERROR(\n GL_INVALID_FRAMEBUFFER_OPERATION, func_name,\n \"framebuffer incomplete (clear)\");\n return false;\n }\n ClearUnclearedAttachments(target, framebuffer);\n }\n }\n\n if (!framebuffer_manager()->IsComplete(framebuffer)) {\n if (framebuffer->GetStatus(texture_manager(), target) !=\n GL_FRAMEBUFFER_COMPLETE) {\n LOCAL_SET_GL_ERROR(\n GL_INVALID_FRAMEBUFFER_OPERATION, func_name,\n \"framebuffer incomplete (check)\");\n return false;\n }\n framebuffer_manager()->MarkAsComplete(framebuffer);\n }\n\n return true;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#843d0b7a10bb45627f94764a6c5d468a24143345", + "input": "static void StreamTcpPacketSetState(Packet *p, TcpSession *ssn,\n uint8_t state)\n{\n if (state == ssn->state || PKT_IS_PSEUDOPKT(p))\n return;\n \n ssn->state = state;\n \n /* update the flow state */\n switch(ssn->state) {\n case TCP_ESTABLISHED:\n case TCP_FIN_WAIT1:\n case TCP_FIN_WAIT2:\n case TCP_CLOSING:\n case TCP_CLOSE_WAIT:\n FlowUpdateState(p->flow, FLOW_STATE_ESTABLISHED);\n break;\n case TCP_LAST_ACK:\n case TCP_TIME_WAIT:\n case TCP_CLOSED:\n FlowUpdateState(p->flow, FLOW_STATE_CLOSED);\n break;\n }\n}\n", + "target": "static void StreamTcpPacketSetState(Packet *p, TcpSession *ssn,\n uint8_t state)\n{\n if (state == ssn->state || PKT_IS_PSEUDOPKT(p))\n return;\n \n ssn->pstate = ssn->state;\n ssn->state = state;\n \n /* update the flow state */\n switch(ssn->state) {\n case TCP_ESTABLISHED:\n case TCP_FIN_WAIT1:\n case TCP_FIN_WAIT2:\n case TCP_CLOSING:\n case TCP_CLOSE_WAIT:\n FlowUpdateState(p->flow, FLOW_STATE_ESTABLISHED);\n break;\n case TCP_LAST_ACK:\n case TCP_TIME_WAIT:\n case TCP_CLOSED:\n FlowUpdateState(p->flow, FLOW_STATE_CLOSED);\n break;\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6b5f83842b5edb5d4bd6684b196b3630c6769731", + "input": "void ExtensionSettingsHandler::GetLocalizedValues(\n DictionaryValue* localized_strings) {\n RegisterTitle(localized_strings, \"extensionSettings\",\n IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE);\n\n localized_strings->SetString(\"extensionSettingsVisitWebsite\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE));\n\n localized_strings->SetString(\"extensionSettingsDeveloperMode\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEVELOPER_MODE_LINK));\n localized_strings->SetString(\"extensionSettingsNoExtensions\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_NONE_INSTALLED));\n localized_strings->SetString(\"extensionSettingsSuggestGallery\",\n l10n_util::GetStringFUTF16(IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY,\n ASCIIToUTF16(google_util::AppendGoogleLocaleParam(\n GURL(extension_urls::GetWebstoreLaunchURL())).spec())));\n localized_strings->SetString(\"extensionSettingsGetMoreExtensions\",\n l10n_util::GetStringFUTF16(IDS_GET_MORE_EXTENSIONS,\n ASCIIToUTF16(google_util::AppendGoogleLocaleParam(\n GURL(extension_urls::GetWebstoreLaunchURL())).spec())));\n localized_strings->SetString(\"extensionSettingsExtensionId\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_ID));\n localized_strings->SetString(\"extensionSettingsExtensionPath\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_PATH));\n localized_strings->SetString(\"extensionSettingsInspectViews\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSPECT_VIEWS));\n localized_strings->SetString(\"viewIncognito\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_VIEW_INCOGNITO));\n localized_strings->SetString(\"extensionSettingsEnable\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_ENABLE));\n localized_strings->SetString(\"extensionSettingsEnabled\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_ENABLED));\n localized_strings->SetString(\"extensionSettingsRemove\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_REMOVE));\n localized_strings->SetString(\"extensionSettingsEnableIncognito\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_ENABLE_INCOGNITO));\n localized_strings->SetString(\"extensionSettingsAllowFileAccess\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_ALLOW_FILE_ACCESS));\n localized_strings->SetString(\"extensionSettingsIncognitoWarning\",\n l10n_util::GetStringFUTF16(IDS_EXTENSIONS_INCOGNITO_WARNING,\n l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));\n localized_strings->SetString(\"extensionSettingsReload\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_RELOAD));\n localized_strings->SetString(\"extensionSettingsOptions\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS));\n localized_strings->SetString(\"extensionSettingsPolicyControlled\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED));\n localized_strings->SetString(\"extensionSettingsShowButton\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_BUTTON));\n localized_strings->SetString(\"extensionSettingsLoadUnpackedButton\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOAD_UNPACKED_BUTTON));\n localized_strings->SetString(\"extensionSettingsPackButton\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_PACK_BUTTON));\n localized_strings->SetString(\"extensionSettingsUpdateButton\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_UPDATE_BUTTON));\n localized_strings->SetString(\"extensionSettingsCrashMessage\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_CRASHED_EXTENSION));\n localized_strings->SetString(\"extensionSettingsInDevelopment\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_IN_DEVELOPMENT));\n localized_strings->SetString(\"extensionSettingsWarningsTitle\",\n l10n_util::GetStringUTF16(IDS_EXTENSION_WARNINGS_TITLE));\n localized_strings->SetString(\"extensionSettingsShowDetails\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_DETAILS));\n localized_strings->SetString(\"extensionSettingsHideDetails\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_HIDE_DETAILS));\n}\n", + "target": "void ExtensionSettingsHandler::GetLocalizedValues(\n DictionaryValue* localized_strings) {\n RegisterTitle(localized_strings, \"extensionSettings\",\n IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE);\n\n localized_strings->SetString(\"extensionSettingsVisitWebsite\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE));\n\n localized_strings->SetString(\"extensionSettingsDeveloperMode\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEVELOPER_MODE_LINK));\n localized_strings->SetString(\"extensionSettingsNoExtensions\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_NONE_INSTALLED));\n localized_strings->SetString(\"extensionSettingsSuggestGallery\",\n l10n_util::GetStringFUTF16(IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY,\n ASCIIToUTF16(google_util::AppendGoogleLocaleParam(\n GURL(extension_urls::GetWebstoreLaunchURL())).spec())));\n localized_strings->SetString(\"extensionSettingsGetMoreExtensions\",\n l10n_util::GetStringFUTF16(IDS_GET_MORE_EXTENSIONS,\n ASCIIToUTF16(google_util::AppendGoogleLocaleParam(\n GURL(extension_urls::GetWebstoreLaunchURL())).spec())));\n localized_strings->SetString(\"extensionSettingsExtensionId\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_ID));\n localized_strings->SetString(\"extensionSettingsExtensionPath\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_PATH));\n localized_strings->SetString(\"extensionSettingsInspectViews\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSPECT_VIEWS));\n localized_strings->SetString(\"viewIncognito\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_VIEW_INCOGNITO));\n localized_strings->SetString(\"extensionSettingsEnable\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_ENABLE));\n localized_strings->SetString(\"extensionSettingsEnabled\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_ENABLED));\n localized_strings->SetString(\"extensionSettingsRemove\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_REMOVE));\n localized_strings->SetString(\"extensionSettingsEnableIncognito\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_ENABLE_INCOGNITO));\n localized_strings->SetString(\"extensionSettingsAllowFileAccess\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_ALLOW_FILE_ACCESS));\n localized_strings->SetString(\"extensionSettingsIncognitoWarning\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_INCOGNITO_WARNING));\n localized_strings->SetString(\"extensionSettingsReload\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_RELOAD));\n localized_strings->SetString(\"extensionSettingsOptions\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS));\n localized_strings->SetString(\"extensionSettingsPolicyControlled\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED));\n localized_strings->SetString(\"extensionSettingsShowButton\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_BUTTON));\n localized_strings->SetString(\"extensionSettingsLoadUnpackedButton\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOAD_UNPACKED_BUTTON));\n localized_strings->SetString(\"extensionSettingsPackButton\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_PACK_BUTTON));\n localized_strings->SetString(\"extensionSettingsUpdateButton\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_UPDATE_BUTTON));\n localized_strings->SetString(\"extensionSettingsCrashMessage\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_CRASHED_EXTENSION));\n localized_strings->SetString(\"extensionSettingsInDevelopment\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_IN_DEVELOPMENT));\n localized_strings->SetString(\"extensionSettingsWarningsTitle\",\n l10n_util::GetStringUTF16(IDS_EXTENSION_WARNINGS_TITLE));\n localized_strings->SetString(\"extensionSettingsShowDetails\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_DETAILS));\n localized_strings->SetString(\"extensionSettingsHideDetails\",\n l10n_util::GetStringUTF16(IDS_EXTENSIONS_HIDE_DETAILS));\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#48f2ec5c24570c9b96bb2798a9ffe956117c5066", + "input": " virtual void TreeNodesAdded(TreeModel* model, TreeModelNode* parent,\n int start, int count) {\n added_count_++;\n }\n", + "target": " virtual void TreeNodesAdded(TreeModel* model, TreeModelNode* parent,\n virtual void TreeNodesAdded(TreeModel* model,\n TreeModelNode* parent,\n int start,\n int count) OVERRIDE {\n added_count_++;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cace1e6998293b9b025d4bbdaf5cb5b6a1c2efb4", + "input": "void SVGImage::setContainerSize(const IntSize& size)\n{\n if (!m_page || !usesContainerSize())\n return;\n\n LocalFrame* frame = m_page->mainFrame();\n SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();\n if (!rootElement)\n return;\n RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer());\n if (!renderer)\n return;\n \n FrameView* view = frameView();\n view->resize(this->containerSize());\n \n renderer->setContainerSize(size);\n }\n", + "target": "void SVGImage::setContainerSize(const IntSize& size)\n{\n if (!m_page || !usesContainerSize())\n return;\n\n LocalFrame* frame = m_page->mainFrame();\n SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement();\n if (!rootElement)\n return;\n \n FrameView* view = frameView();\n view->resize(this->containerSize());\n \n RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer());\n if (!renderer)\n return;\n renderer->setContainerSize(size);\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d2632f6483a3ceb5d8e0a5fb11142c51c43978b4", + "input": " static RList *r_bin_wasm_get_element_entries (RBinWasmObj *bin, RBinWasmSection *sec) {\n \tRList *ret = NULL;\n \tRBinWasmElementEntry *ptr = NULL;\n \n\tif (!(ret = r_list_newf ((RListFree)free))) {\n\t\treturn NULL;\n \t}\n \n \tut8* buf = bin->buf->buf + (ut32)sec->payload_data;\n \tut32 len = sec->payload_len;\n \tut32 count = sec->count;\n \tut32 i = 0, r = 0;\n \n\twhile (i < len && r < count) {\n \t\tif (!(ptr = R_NEW0 (RBinWasmElementEntry))) {\n \t\t\treturn ret;\n \t\t}\n \t\tif (!(consume_u32 (buf + i, buf + len, &ptr->index, &i))) {\n\t\t\tfree (ptr);\n\t\t\treturn ret;\n \t\t}\n \t\tif (!(consume_init_expr (buf + i, buf + len, R_BIN_WASM_END_OF_CODE, NULL, &i))) {\n\t\t\tfree (ptr);\n\t\t\treturn ret;\n \t\t}\n \t\tif (!(consume_u32 (buf + i, buf + len, &ptr->num_elem, &i))) {\n\t\t\tfree (ptr);\n\t\t\treturn ret;\n \t\t}\n \t\tut32 j = 0;\n\t\twhile (i < len && j < ptr->num_elem\t) {\n \t\t\tut32 e;\n \t\t\tif (!(consume_u32 (buf + i, buf + len, &e, &i))) {\n \t\t\t\tfree (ptr);\n \t\t\t\treturn ret;\n \t\t\t}\n \t\t}\n \t\tr_list_append (ret, ptr);\n \n \t\tr += 1;\n \t}\n \treturn ret;\n }\n", + "target": " static RList *r_bin_wasm_get_element_entries (RBinWasmObj *bin, RBinWasmSection *sec) {\n \tRList *ret = NULL;\n \tRBinWasmElementEntry *ptr = NULL;\n \n\tif (!(ret = r_list_newf ((RListFree)free))) {\n\t\treturn NULL;\n \t}\n \n \tut8* buf = bin->buf->buf + (ut32)sec->payload_data;\n\tint buflen = bin->buf->length - (ut32)sec->payload_data;\n \tut32 len = sec->payload_len;\n \tut32 count = sec->count;\n \tut32 i = 0, r = 0;\n \n\twhile (i < len && len < buflen && r < count) {\n \t\tif (!(ptr = R_NEW0 (RBinWasmElementEntry))) {\n \t\t\treturn ret;\n \t\t}\n \t\tif (!(consume_u32 (buf + i, buf + len, &ptr->index, &i))) {\n\t\t\tgoto beach;\n \t\t}\n \t\tif (!(consume_init_expr (buf + i, buf + len, R_BIN_WASM_END_OF_CODE, NULL, &i))) {\n\t\t\tgoto beach;\n \t\t}\n \t\tif (!(consume_u32 (buf + i, buf + len, &ptr->num_elem, &i))) {\n\t\t\tgoto beach;\n \t\t}\n \t\tut32 j = 0;\n\t\twhile (i < len && j < ptr->num_elem) {\n \t\t\tut32 e;\n \t\t\tif (!(consume_u32 (buf + i, buf + len, &e, &i))) {\n \t\t\t\tfree (ptr);\n \t\t\t\treturn ret;\n \t\t\t}\n \t\t}\n \t\tr_list_append (ret, ptr);\n \n \t\tr += 1;\n \t}\n\treturn ret;\nbeach:\n\tfree (ptr);\n \treturn ret;\n }\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c0da7c1c6e9ffe5006e146b6426f987238d4bf2e", + "input": " void DevToolsWindow::InspectedContentsClosing() {\n web_contents_->GetRenderViewHost()->ClosePage();\n }\n", + "target": " void DevToolsWindow::InspectedContentsClosing() {\n intercepted_page_beforeunload_ = false;\n web_contents_->GetRenderViewHost()->ClosePage();\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#afc9c683ed9db01edb357bc8c19edad4282b3a97", + "input": "static int asf_build_simple_index(AVFormatContext *s, int stream_index)\n{\n ff_asf_guid g;\n ASFContext *asf = s->priv_data;\n int64_t current_pos = avio_tell(s->pb);\n int64_t ret;\n\n if((ret = avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET)) < 0) {\n return ret;\n }\n\n if ((ret = ff_get_guid(s->pb, &g)) < 0)\n goto end;\n\n /* the data object can be followed by other top-level objects,\n * skip them until the simple index object is reached */\n while (ff_guidcmp(&g, &ff_asf_simple_index_header)) {\n int64_t gsize = avio_rl64(s->pb);\n if (gsize < 24 || avio_feof(s->pb)) {\n goto end;\n }\n avio_skip(s->pb, gsize - 24);\n if ((ret = ff_get_guid(s->pb, &g)) < 0)\n goto end;\n }\n\n {\n int64_t itime, last_pos = -1;\n int pct, ict;\n int i;\n int64_t av_unused gsize = avio_rl64(s->pb);\n if ((ret = ff_get_guid(s->pb, &g)) < 0)\n goto end;\n itime = avio_rl64(s->pb);\n pct = avio_rl32(s->pb);\n ict = avio_rl32(s->pb);\n av_log(s, AV_LOG_DEBUG,\n \"itime:0x%\"PRIx64\", pct:%d, ict:%d\\n\", itime, pct, ict);\n\n for (i = 0; i < ict; i++) {\n int pktnum = avio_rl32(s->pb);\n int pktct = avio_rl16(s->pb);\n int64_t pos = s->internal->data_offset + s->packet_size * (int64_t)pktnum;\n int64_t index_pts = FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);\n \n if (pos != last_pos) {\n av_log(s, AV_LOG_DEBUG, \"pktnum:%d, pktct:%d pts: %\"PRId64\"\\n\",\n pktnum, pktct, index_pts);\n av_add_index_entry(s->streams[stream_index], pos, index_pts,\n s->packet_size, 0, AVINDEX_KEYFRAME);\n last_pos = pos;\n }\n }\n asf->index_read = ict > 1;\n }\nend:\n avio_seek(s->pb, current_pos, SEEK_SET);\n return ret;\n}\n", + "target": "static int asf_build_simple_index(AVFormatContext *s, int stream_index)\n{\n ff_asf_guid g;\n ASFContext *asf = s->priv_data;\n int64_t current_pos = avio_tell(s->pb);\n int64_t ret;\n\n if((ret = avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET)) < 0) {\n return ret;\n }\n\n if ((ret = ff_get_guid(s->pb, &g)) < 0)\n goto end;\n\n /* the data object can be followed by other top-level objects,\n * skip them until the simple index object is reached */\n while (ff_guidcmp(&g, &ff_asf_simple_index_header)) {\n int64_t gsize = avio_rl64(s->pb);\n if (gsize < 24 || avio_feof(s->pb)) {\n goto end;\n }\n avio_skip(s->pb, gsize - 24);\n if ((ret = ff_get_guid(s->pb, &g)) < 0)\n goto end;\n }\n\n {\n int64_t itime, last_pos = -1;\n int pct, ict;\n int i;\n int64_t av_unused gsize = avio_rl64(s->pb);\n if ((ret = ff_get_guid(s->pb, &g)) < 0)\n goto end;\n itime = avio_rl64(s->pb);\n pct = avio_rl32(s->pb);\n ict = avio_rl32(s->pb);\n av_log(s, AV_LOG_DEBUG,\n \"itime:0x%\"PRIx64\", pct:%d, ict:%d\\n\", itime, pct, ict);\n\n for (i = 0; i < ict; i++) {\n int pktnum = avio_rl32(s->pb);\n int pktct = avio_rl16(s->pb);\n int64_t pos = s->internal->data_offset + s->packet_size * (int64_t)pktnum;\n int64_t index_pts = FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);\n \n if (avio_feof(s->pb)) {\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n\n if (pos != last_pos) {\n av_log(s, AV_LOG_DEBUG, \"pktnum:%d, pktct:%d pts: %\"PRId64\"\\n\",\n pktnum, pktct, index_pts);\n av_add_index_entry(s->streams[stream_index], pos, index_pts,\n s->packet_size, 0, AVINDEX_KEYFRAME);\n last_pos = pos;\n }\n }\n asf->index_read = ict > 1;\n }\nend:\n avio_seek(s->pb, current_pos, SEEK_SET);\n return ret;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#19-6100d3d66534", + "input": "def update_sources(conn, sqlite, k10plus, ai):\n \"\"\"\n Update the source table.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n old_sources = get_all_old_sources(conn, sqlite)\n\n # Check if the source table is allready filled and this is not the first checkup\n source_table_is_filled = len(old_sources) > 100\n\n for old_source in old_sources:\n if source_table_is_filled and old_source not in current_sources:\n message = \"Die SID %s ist im aktuellen Import nicht mehr vorhanden.\\nWenn dies beabsichtigt ist, bitte die SID aus der Datenbank loeschen.\" % old_source\n send_message(message)\n\n for current_source in current_sources:\n if current_source not in old_sources:\n message = \"The source %s is new in Solr.\" % current_source\n if source_table_is_filled:\n send_message(message)\n else:\n logging.info(message)\n sql = \"INSERT INTO source (source) VALUES (%s)\" % current_source\n sqlite.execute(sql)\n conn.commit()", + "target": "def update_sources(conn, sqlite, k10plus, ai):\n \"\"\"\n Update the source table.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n old_sources = get_all_old_sources(conn, sqlite)\n\n # Check if the source table is allready filled and this is not the first checkup\n source_table_is_filled = len(old_sources) > 100\n\n for old_source in old_sources:\n if source_table_is_filled and old_source not in current_sources:\n message = \"Die SID %s ist im aktuellen Import nicht mehr vorhanden.\\nWenn dies beabsichtigt ist, bitte die SID aus der Datenbank loeschen.\" % old_source\n send_message(message)\n\n for current_source in current_sources:\n if current_source not in old_sources:\n message = \"The source %s is new in Solr.\" % current_source\n if source_table_is_filled:\n send_message(message)\n else:\n logging.info(message)\n sql = \"INSERT INTO source (source) VALUES (?)\"\n sqlite.execute(sql, (current_source,))\n conn.commit()", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#b3ae5db129f88dae153880e84bdabea8ce2ca89b", + "input": "void CrosLibrary::TestApi::SetTouchpadLibrary(\n TouchpadLibrary* library, bool own) {\n library_->touchpad_lib_.SetImpl(library, own);\n}\n", + "target": "void CrosLibrary::TestApi::SetTouchpadLibrary(\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#55caa8b08c84af2b50fbc936cf334a5a93dd7db5", + "input": " SProcXFixesChangeSaveSet(ClientPtr client)\n {\n REQUEST(xXFixesChangeSaveSetReq);\n \n swaps(&stuff->length);\n swapl(&stuff->window);\n}\n", + "target": " SProcXFixesChangeSaveSet(ClientPtr client)\n {\n REQUEST(xXFixesChangeSaveSetReq);\n REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq);\n \n swaps(&stuff->length);\n swapl(&stuff->window);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "Cluster::~Cluster()\n{\n if (m_entries_count <= 0)\n return;\n BlockEntry** i = m_entries;\n BlockEntry** const j = m_entries + m_entries_count;\n while (i != j)\n {\n BlockEntry* p = *i++;\n assert(p);\n delete p;\n }\n \n delete[] m_entries;\n }\n", + "target": "Cluster::~Cluster()\n if (status < 0) { // error or underflow\n len = 1;\n return status;\n }\n \n ++pos; // consume flags byte\n assert(pos <= avail);\n\n if (pos >= block_stop)\n return E_FILE_FORMAT_INVALID;\n\n const int lacing = int(flags & 0x06) >> 1;\n\n if ((lacing != 0) && (block_stop > avail)) {\n len = static_cast(block_stop - pos);\n return E_BUFFER_NOT_FULL;\n }\n\n pos = block_stop; // consume block-part of block group\n assert(pos <= payload_stop);\n }\n\n assert(pos == payload_stop);\n\n status = CreateBlock(0x20, // BlockGroup ID\n payload_start, payload_size, discard_padding);\n if (status != 0)\n return status;\n\n m_pos = payload_stop;\n\n return 0; // success\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#796dd28aaa6b9fa76d99c42c4d5ff8b257cc2191", + "input": "grub_ext2_iterate_dir (grub_fshelp_node_t dir,\n\t\t int (*hook) (const char *filename,\n\t\t\t\t enum grub_fshelp_filetype filetype,\n\t\t\t\t grub_fshelp_node_t node,\n\t\t\t\t void *closure),\n\t\t void *closure)\n{\n unsigned int fpos = 0;\n struct grub_fshelp_node *diro = (struct grub_fshelp_node *) dir;\n\n if (! diro->inode_read)\n {\n grub_ext2_read_inode (diro->data, diro->ino, &diro->inode);\n if (grub_errno)\n\treturn 0;\n }\n\n /* Search the file. */\n if (hook)\n while (fpos < grub_le_to_cpu32 (diro->inode.size))\n {\n struct ext2_dirent dirent;\n\n grub_ext2_read_file (diro, NULL, NULL, 0, fpos, sizeof (dirent),\n\t\t\t (char *) &dirent);\n if (grub_errno)\n\treturn 0;\n\n if (dirent.direntlen == 0)\n return 0;\n \n if (dirent.namelen != 0)\n \t{\n#ifndef _MSC_VER\n\t char filename[dirent.namelen + 1]; \n#else\n \t char * filename = grub_malloc (dirent.namelen + 1);\n#endif\n \t struct grub_fshelp_node *fdiro;\n \t enum grub_fshelp_filetype type = GRUB_FSHELP_UNKNOWN;\n \n \t grub_ext2_read_file (diro, 0, 0, 0,\n \t\t\t fpos + sizeof (struct ext2_dirent),\n \t\t\t dirent.namelen, filename);\n\t if (grub_errno)\n \t return 0;\n \n \t fdiro = grub_malloc (sizeof (struct grub_fshelp_node));\n\t if (! fdiro)\n \t return 0;\n \n \t fdiro->data = diro->data;\n \t fdiro->ino = grub_le_to_cpu32 (dirent.inode);\n\n\t filename[dirent.namelen] = '\\0';\n\n\t if (dirent.filetype != FILETYPE_UNKNOWN)\n\t {\n\t fdiro->inode_read = 0;\n\n\t if (dirent.filetype == FILETYPE_DIRECTORY)\n\t\ttype = GRUB_FSHELP_DIR;\n\t else if (dirent.filetype == FILETYPE_SYMLINK)\n\t\ttype = GRUB_FSHELP_SYMLINK;\n\t else if (dirent.filetype == FILETYPE_REG)\n\t\ttype = GRUB_FSHELP_REG;\n\t }\n\t else\n\t {\n\t /* The filetype can not be read from the dirent, read\n\t\t the inode to get more information. */\n \t grub_ext2_read_inode (diro->data,\n grub_le_to_cpu32 (dirent.inode),\n \t\t\t\t &fdiro->inode);\n\t if (grub_errno)\n\t\t{\n \t\t grub_free (fdiro);\n \t\t return 0;\n \t\t}\n\n\t fdiro->inode_read = 1;\n\n\t if ((grub_le_to_cpu16 (fdiro->inode.mode)\n\t\t & FILETYPE_INO_MASK) == FILETYPE_INO_DIRECTORY)\n\t\ttype = GRUB_FSHELP_DIR;\n\t else if ((grub_le_to_cpu16 (fdiro->inode.mode)\n\t\t\t& FILETYPE_INO_MASK) == FILETYPE_INO_SYMLINK)\n\t\ttype = GRUB_FSHELP_SYMLINK;\n\t else if ((grub_le_to_cpu16 (fdiro->inode.mode)\n\t\t\t& FILETYPE_INO_MASK) == FILETYPE_INO_REG)\n \t\ttype = GRUB_FSHELP_REG;\n \t }\n \n\t if (hook (filename, type, fdiro, closure))\n \t return 1;\n \t}\n \n fpos += grub_le_to_cpu16 (dirent.direntlen);\n }\n\n return 0;\n}\n", + "target": "grub_ext2_iterate_dir (grub_fshelp_node_t dir,\n\t\t int (*hook) (const char *filename,\n\t\t\t\t enum grub_fshelp_filetype filetype,\n\t\t\t\t grub_fshelp_node_t node,\n\t\t\t\t void *closure),\n\t\t void *closure)\n{\n unsigned int fpos = 0;\n struct grub_fshelp_node *diro = (struct grub_fshelp_node *) dir;\n\n if (! diro->inode_read)\n {\n grub_ext2_read_inode (diro->data, diro->ino, &diro->inode);\n if (grub_errno)\n\treturn 0;\n }\n\n /* Search the file. */\n if (hook)\n while (fpos < grub_le_to_cpu32 (diro->inode.size))\n {\n struct ext2_dirent dirent;\n\n grub_ext2_read_file (diro, NULL, NULL, 0, fpos, sizeof (dirent),\n\t\t\t (char *) &dirent);\n if (grub_errno)\n\treturn 0;\n\n if (dirent.direntlen == 0)\n return 0;\n \n if (dirent.namelen != 0)\n \t{\n \t char * filename = grub_malloc (dirent.namelen + 1);\n \t struct grub_fshelp_node *fdiro;\n \t enum grub_fshelp_filetype type = GRUB_FSHELP_UNKNOWN;\n \nif (!filename) {\nbreak;\n}\n \t grub_ext2_read_file (diro, 0, 0, 0,\n \t\t\t fpos + sizeof (struct ext2_dirent),\n \t\t\t dirent.namelen, filename);\n\t if (grub_errno) {\n free (filename);\n \t return 0;\n\t }\n \n \t fdiro = grub_malloc (sizeof (struct grub_fshelp_node));\n\t if (! fdiro) {\n free (filename);\n \t return 0;\n }\n \n \t fdiro->data = diro->data;\n \t fdiro->ino = grub_le_to_cpu32 (dirent.inode);\n\n\t filename[dirent.namelen] = '\\0';\n\n\t if (dirent.filetype != FILETYPE_UNKNOWN)\n\t {\n\t fdiro->inode_read = 0;\n\n\t if (dirent.filetype == FILETYPE_DIRECTORY)\n\t\ttype = GRUB_FSHELP_DIR;\n\t else if (dirent.filetype == FILETYPE_SYMLINK)\n\t\ttype = GRUB_FSHELP_SYMLINK;\n\t else if (dirent.filetype == FILETYPE_REG)\n\t\ttype = GRUB_FSHELP_REG;\n\t }\n\t else\n\t {\n\t /* The filetype can not be read from the dirent, read\n\t\t the inode to get more information. */\n \t grub_ext2_read_inode (diro->data,\n grub_le_to_cpu32 (dirent.inode),\n \t\t\t\t &fdiro->inode);\n\t if (grub_errno) {\n free (filename);\n \t\t grub_free (fdiro);\n \t\t return 0;\n \t\t}\n\n\t fdiro->inode_read = 1;\n\n\t if ((grub_le_to_cpu16 (fdiro->inode.mode)\n\t\t & FILETYPE_INO_MASK) == FILETYPE_INO_DIRECTORY)\n\t\ttype = GRUB_FSHELP_DIR;\n\t else if ((grub_le_to_cpu16 (fdiro->inode.mode)\n\t\t\t& FILETYPE_INO_MASK) == FILETYPE_INO_SYMLINK)\n\t\ttype = GRUB_FSHELP_SYMLINK;\n\t else if ((grub_le_to_cpu16 (fdiro->inode.mode)\n\t\t\t& FILETYPE_INO_MASK) == FILETYPE_INO_REG)\n \t\ttype = GRUB_FSHELP_REG;\n \t }\n \n\t if (hook (filename, type, fdiro, closure)) {\n free (filename);\n \t return 1;\n }\n free (filename);\n \t}\n \n fpos += grub_le_to_cpu16 (dirent.direntlen);\n }\n\n return 0;\n}\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#243d12fdec66a4360fbb3e307a046b39b5b4ffc3", + "input": "append_utf8_value (const unsigned char *value, size_t length,\n struct stringbuf *sb)\n{\n unsigned char tmp[6];\n const unsigned char *s;\n size_t n;\n int i, nmore;\n\n if (length && (*value == ' ' || *value == '#'))\n {\n tmp[0] = '\\\\';\n tmp[1] = *value;\n put_stringbuf_mem (sb, tmp, 2);\n value++;\n length--;\n }\n if (length && value[length-1] == ' ')\n {\n tmp[0] = '\\\\';\n tmp[1] = ' ';\n put_stringbuf_mem (sb, tmp, 2);\n length--;\n }\n \n /* FIXME: check that the invalid encoding handling is correct */\n for (s=value, n=0;;)\n {\n for (value = s; n < length && !(*s & 0x80); n++, s++)\n for (value = s; n < length && !(*s & 0x80); n++, s++)\n ;\n append_quoted (sb, value, s-value, 0);\n if (n==length)\n return; /* ready */\n assert ((*s & 0x80));\n if ( (*s & 0xe0) == 0xc0 ) /* 110x xxxx */\n nmore = 1;\n else if ( (*s & 0xf0) == 0xe0 ) /* 1110 xxxx */\n nmore = 2;\n else if ( (*s & 0xf8) == 0xf0 ) /* 1111 0xxx */\n nmore = 3;\n else if ( (*s & 0xfc) == 0xf8 ) /* 1111 10xx */\n nmore = 4;\n else if ( (*s & 0xfe) == 0xfc ) /* 1111 110x */\n nmore = 5;\n else /* invalid encoding */\n nmore = 5; /* we will reduce the check length anyway */\n if (n+nmore > length)\n nmore = length - n; /* oops, encoding to short */\n \n tmp[0] = *s++; n++;\n for (i=1; i <= nmore; i++)\n {\n if ( (*s & 0xc0) != 0x80)\n break; /* invalid encoding - stop */\n tmp[i] = *s++;\n n++;\n }\n put_stringbuf_mem (sb, tmp, i);\n }\n }\n", + "target": "append_utf8_value (const unsigned char *value, size_t length,\n struct stringbuf *sb)\n{\n unsigned char tmp[6];\n const unsigned char *s;\n size_t n;\n int i, nmore;\n\n if (length && (*value == ' ' || *value == '#'))\n {\n tmp[0] = '\\\\';\n tmp[1] = *value;\n put_stringbuf_mem (sb, tmp, 2);\n value++;\n length--;\n }\n if (length && value[length-1] == ' ')\n {\n tmp[0] = '\\\\';\n tmp[1] = ' ';\n put_stringbuf_mem (sb, tmp, 2);\n length--;\n }\n \n for (s=value, n=0;;)\n {\n for (value = s; n < length && !(*s & 0x80); n++, s++)\n for (value = s; n < length && !(*s & 0x80); n++, s++)\n ;\n append_quoted (sb, value, s-value, 0);\n if (n==length)\n return; /* ready */\n if (!(*s & 0x80))\n nmore = 0; /* Not expected here: high bit not set. */\n else if ( (*s & 0xe0) == 0xc0 ) /* 110x xxxx */\n nmore = 1;\n else if ( (*s & 0xf0) == 0xe0 ) /* 1110 xxxx */\n nmore = 2;\n else if ( (*s & 0xf8) == 0xf0 ) /* 1111 0xxx */\n nmore = 3;\n else if ( (*s & 0xfc) == 0xf8 ) /* 1111 10xx */\n nmore = 4;\n else if ( (*s & 0xfe) == 0xfc ) /* 1111 110x */\n nmore = 5;\n else /* Invalid encoding */\n nmore = 0;\n \n if (!nmore)\n {\n /* Encoding error: We quote the bad byte. */\n snprintf (tmp, sizeof tmp, \"\\\\%02X\", *s);\n put_stringbuf_mem (sb, tmp, 3);\n s++; n++;\n }\n else\n {\n if (n+nmore > length)\n nmore = length - n; /* Oops, encoding to short */\n\n tmp[0] = *s++; n++;\n for (i=1; i <= nmore; i++)\n {\n if ( (*s & 0xc0) != 0x80)\n break; /* Invalid encoding - let the next cycle detect this. */\n tmp[i] = *s++;\n n++;\n }\n put_stringbuf_mem (sb, tmp, i);\n }\n }\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#88c4913f11967abfd08a8b22b4423710322ac49b", + "input": "void CCThreadProxy::stop()\n{\n TRACE_EVENT(\"CCThreadProxy::stop\", this, 0);\n ASSERT(isMainThread());\n ASSERT(m_started);\n\n CCCompletionEvent completion;\n s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnCCThread, AllowCrossThreadAccess(&completion)));\n completion.wait();\n \n ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted.\n m_layerTreeHost = 0;\n m_started = false;\n}\n", + "target": "void CCThreadProxy::stop()\n{\n TRACE_EVENT(\"CCThreadProxy::stop\", this, 0);\n ASSERT(isMainThread());\n ASSERT(m_started);\n\n CCCompletionEvent completion;\n s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnCCThread, AllowCrossThreadAccess(&completion)));\n completion.wait();\n \n m_mainThreadProxy->shutdown(); // Stop running tasks posted to us.\n\n ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted.\n m_layerTreeHost = 0;\n m_started = false;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5fc08cfb098acce49344d2e89cc27c915903f81c", + "input": "void DownloadController::CreateGETDownload(\n const content::ResourceRequestInfo::WebContentsGetter& wc_getter,\n bool must_download,\n const DownloadInfo& info) {\n DCHECK_CURRENTLY_ON(BrowserThread::IO);\n BrowserThread::PostTask(\n BrowserThread::UI, FROM_HERE,\n base::Bind(&DownloadController::StartAndroidDownload,\n base::Unretained(this),\n wc_getter, must_download, info));\n}\n", + "target": "void DownloadController::CreateGETDownload(\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d358f57009b85fb7440208afa5ba87636b491889", + "input": "void FakeBluetoothAgentManagerClient::UnregisterAgent(\n const dbus::ObjectPath& agent_path,\n const base::Closure& callback,\n const ErrorCallback& error_callback) {\n VLOG(1) << \"UnregisterAgent: \" << agent_path.value();\n if (service_provider_ != NULL) {\n error_callback.Run(bluetooth_agent_manager::kErrorInvalidArguments,\n \"Agent still registered\");\n } else {\n callback.Run();\n }\n}\n", + "target": "void FakeBluetoothAgentManagerClient::UnregisterAgent(\n const dbus::ObjectPath& agent_path,\n const base::Closure& callback,\n const ErrorCallback& error_callback) {\n VLOG(1) << \"UnregisterAgent: \" << agent_path.value();\n if (service_provider_ == NULL) {\n error_callback.Run(bluetooth_agent_manager::kErrorDoesNotExist,\n \"No agent registered\");\n } else if (service_provider_->object_path_ != agent_path) {\n error_callback.Run(bluetooth_agent_manager::kErrorDoesNotExist,\n \"Agent still registered\");\n } else {\n callback.Run();\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d", + "input": " static inline void schedule_debug(struct task_struct *prev)\n {\n #ifdef CONFIG_SCHED_STACK_END_CHECK\n\tBUG_ON(task_stack_end_corrupted(prev));\n #endif\n \n \tif (unlikely(in_atomic_preempt_off())) {\n\t\t__schedule_bug(prev);\n\t\tpreempt_count_set(PREEMPT_DISABLED);\n\t}\n\trcu_sleep_check();\n\n\tprofile_hit(SCHED_PROFILING, __builtin_return_address(0));\n\n\tschedstat_inc(this_rq(), sched_count);\n}\n", + "target": " static inline void schedule_debug(struct task_struct *prev)\n {\n #ifdef CONFIG_SCHED_STACK_END_CHECK\n\tif (task_stack_end_corrupted(prev))\n\t\tpanic(\"corrupted stack end detected inside scheduler\\n\");\n #endif\n \n \tif (unlikely(in_atomic_preempt_off())) {\n\t\t__schedule_bug(prev);\n\t\tpreempt_count_set(PREEMPT_DISABLED);\n\t}\n\trcu_sleep_check();\n\n\tprofile_hit(SCHED_PROFILING, __builtin_return_address(0));\n\n\tschedstat_inc(this_rq(), sched_count);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b51b33f2bc5d1497ddf5bd107f791c101695000d", + "input": "spnego_gss_get_mic_iov(OM_uint32 *minor_status, gss_ctx_id_t context_handle,\n \t\t gss_qop_t qop_req, gss_iov_buffer_desc *iov,\n \t\t int iov_count)\n {\n return gss_get_mic_iov(minor_status, context_handle, qop_req, iov,\n \t\t\t iov_count);\n }\n", + "target": "spnego_gss_get_mic_iov(OM_uint32 *minor_status, gss_ctx_id_t context_handle,\n \t\t gss_qop_t qop_req, gss_iov_buffer_desc *iov,\n \t\t int iov_count)\n {\n spnego_gss_ctx_id_t sc = (spnego_gss_ctx_id_t)context_handle;\n\n if (sc->ctx_handle == GSS_C_NO_CONTEXT)\n\t return (GSS_S_NO_CONTEXT);\n\n return gss_get_mic_iov(minor_status, sc->ctx_handle, qop_req, iov,\n \t\t\t iov_count);\n }\n", + "vul_type": "cwe-18", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc7b094a338c6c521f918f478e993f0f74bbea0d", + "input": " virtual size_t GetNumActiveInputMethods() {\n scoped_ptr input_methods(GetActiveInputMethods());\n return input_methods->size();\n }\n", + "target": " virtual size_t GetNumActiveInputMethods() {\n scoped_ptr input_methods(\n GetActiveInputMethods());\n return input_methods->size();\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#673ce95d481ea9368c4d4d43ac756ba1d6d9e608", + "input": "void MojoAudioInputIPC::StreamCreated(\n media::mojom::AudioInputStreamPtr stream,\n media::mojom::AudioInputStreamClientRequest stream_client_request,\n mojo::ScopedSharedBufferHandle shared_memory,\n mojo::ScopedHandle socket,\n bool initially_muted) {\n DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);\n DCHECK(delegate_);\n DCHECK(socket.is_valid());\n DCHECK(shared_memory.is_valid());\n DCHECK(!stream_);\n DCHECK(!stream_client_binding_.is_bound());\n stream_ = std::move(stream);\n stream_client_binding_.Bind(std::move(stream_client_request));\n\n base::PlatformFile socket_handle;\n auto result = mojo::UnwrapPlatformFile(std::move(socket), &socket_handle);\n DCHECK_EQ(result, MOJO_RESULT_OK);\n \n base::SharedMemoryHandle memory_handle;\n bool read_only = true;\n result = mojo::UnwrapSharedMemoryHandle(std::move(shared_memory),\n &memory_handle, nullptr, &read_only);\n DCHECK_EQ(result, MOJO_RESULT_OK);\n DCHECK(read_only);\n \n delegate_->OnStreamCreated(memory_handle, socket_handle, initially_muted);\n }\n", + "target": "void MojoAudioInputIPC::StreamCreated(\n media::mojom::AudioInputStreamPtr stream,\n media::mojom::AudioInputStreamClientRequest stream_client_request,\n mojo::ScopedSharedBufferHandle shared_memory,\n mojo::ScopedHandle socket,\n bool initially_muted) {\n DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);\n DCHECK(delegate_);\n DCHECK(socket.is_valid());\n DCHECK(shared_memory.is_valid());\n DCHECK(!stream_);\n DCHECK(!stream_client_binding_.is_bound());\n stream_ = std::move(stream);\n stream_client_binding_.Bind(std::move(stream_client_request));\n\n base::PlatformFile socket_handle;\n auto result = mojo::UnwrapPlatformFile(std::move(socket), &socket_handle);\n DCHECK_EQ(result, MOJO_RESULT_OK);\n \n base::SharedMemoryHandle memory_handle;\n mojo::UnwrappedSharedMemoryHandleProtection protection;\n result = mojo::UnwrapSharedMemoryHandle(std::move(shared_memory),\n &memory_handle, nullptr, &protection);\n DCHECK_EQ(result, MOJO_RESULT_OK);\n DCHECK_EQ(protection, mojo::UnwrappedSharedMemoryHandleProtection::kReadOnly);\n \n delegate_->OnStreamCreated(memory_handle, socket_handle, initially_muted);\n }\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f2fcfcd670257236ebf2088bbdf26f6a8ef459fe", + "input": "static int l2cap_parse_conf_req(struct sock *sk, void *data)\n{\n\tstruct l2cap_pinfo *pi = l2cap_pi(sk);\n\tstruct l2cap_conf_rsp *rsp = data;\n\tvoid *ptr = rsp->data;\n\tvoid *req = pi->conf_req;\n\tint len = pi->conf_len;\n\tint type, hint, olen;\n\tunsigned long val;\n\tstruct l2cap_conf_rfc rfc = { .mode = L2CAP_MODE_BASIC };\n\tu16 mtu = L2CAP_DEFAULT_MTU;\n\tu16 result = L2CAP_CONF_SUCCESS;\n\n\tBT_DBG(\"sk %p\", sk);\n\n\twhile (len >= L2CAP_CONF_OPT_SIZE) {\n\t\tlen -= l2cap_get_conf_opt(&req, &type, &olen, &val);\n\n\t\thint = type & L2CAP_CONF_HINT;\n\t\ttype &= L2CAP_CONF_MASK;\n\n\t\tswitch (type) {\n\t\tcase L2CAP_CONF_MTU:\n\t\t\tmtu = val;\n\t\t\tbreak;\n\n\t\tcase L2CAP_CONF_FLUSH_TO:\n\t\t\tpi->flush_to = val;\n\t\t\tbreak;\n\n\t\tcase L2CAP_CONF_QOS:\n\t\t\tbreak;\n\n\t\tcase L2CAP_CONF_RFC:\n\t\t\tif (olen == sizeof(rfc))\n\t\t\t\tmemcpy(&rfc, (void *) val, olen);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tif (hint)\n\t\t\t\tbreak;\n\n\t\t\tresult = L2CAP_CONF_UNKNOWN;\n\t\t\t*((u8 *) ptr++) = type;\n\t\t\tbreak;\n \t\t}\n \t}\n \n \tif (result == L2CAP_CONF_SUCCESS) {\n \t\t/* Configure output options and let the other side know\n \t\t * which ones we don't like. */\n \n\t\tif (rfc.mode == L2CAP_MODE_BASIC) {\n\t\t\tif (mtu < pi->omtu)\n\t\t\t\tresult = L2CAP_CONF_UNACCEPT;\n\t\t\telse {\n\t\t\t\tpi->omtu = mtu;\n\t\t\t\tpi->conf_state |= L2CAP_CONF_OUTPUT_DONE;\n\t\t\t}\n \n\t\t\tl2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu);\n\t\t} else {\n \t\t\tresult = L2CAP_CONF_UNACCEPT;\n \n \t\t\tmemset(&rfc, 0, sizeof(rfc));\n\t\t\trfc.mode = L2CAP_MODE_BASIC;\n \n\t\t\tl2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,\n \t\t\t\t\tsizeof(rfc), (unsigned long) &rfc);\n\t\t}\n\t}\n \n \trsp->scid = cpu_to_le16(pi->dcid);\n \trsp->result = cpu_to_le16(result);\n \trsp->flags = cpu_to_le16(0x0000);\n \n \treturn ptr - data;\n }\n", + "target": "static int l2cap_parse_conf_req(struct sock *sk, void *data)\n{\n\tstruct l2cap_pinfo *pi = l2cap_pi(sk);\n\tstruct l2cap_conf_rsp *rsp = data;\n\tvoid *ptr = rsp->data;\n\tvoid *req = pi->conf_req;\n\tint len = pi->conf_len;\n\tint type, hint, olen;\n\tunsigned long val;\n\tstruct l2cap_conf_rfc rfc = { .mode = L2CAP_MODE_BASIC };\n\tu16 mtu = L2CAP_DEFAULT_MTU;\n\tu16 result = L2CAP_CONF_SUCCESS;\n\n\tBT_DBG(\"sk %p\", sk);\n\n\twhile (len >= L2CAP_CONF_OPT_SIZE) {\n\t\tlen -= l2cap_get_conf_opt(&req, &type, &olen, &val);\n\n\t\thint = type & L2CAP_CONF_HINT;\n\t\ttype &= L2CAP_CONF_MASK;\n\n\t\tswitch (type) {\n\t\tcase L2CAP_CONF_MTU:\n\t\t\tmtu = val;\n\t\t\tbreak;\n\n\t\tcase L2CAP_CONF_FLUSH_TO:\n\t\t\tpi->flush_to = val;\n\t\t\tbreak;\n\n\t\tcase L2CAP_CONF_QOS:\n\t\t\tbreak;\n\n\t\tcase L2CAP_CONF_RFC:\n\t\t\tif (olen == sizeof(rfc))\n\t\t\t\tmemcpy(&rfc, (void *) val, olen);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tif (hint)\n\t\t\t\tbreak;\n\n\t\t\tresult = L2CAP_CONF_UNKNOWN;\n\t\t\t*((u8 *) ptr++) = type;\n\t\t\tbreak;\n \t\t}\n \t}\n \n\tif (pi->num_conf_rsp || pi->num_conf_req)\n\t\tgoto done;\n\n\tswitch (pi->mode) {\n\tcase L2CAP_MODE_STREAMING:\n\tcase L2CAP_MODE_ERTM:\n\t\tpi->conf_state |= L2CAP_CONF_STATE2_DEVICE;\n\t\tif (!l2cap_mode_supported(pi->mode, pi->conn->feat_mask))\n\t\t\treturn -ECONNREFUSED;\n\t\tbreak;\n\tdefault:\n\t\tpi->mode = l2cap_select_mode(rfc.mode, pi->conn->feat_mask);\n\t\tbreak;\n\t}\n\ndone:\n\tif (pi->mode != rfc.mode) {\n\t\tresult = L2CAP_CONF_UNACCEPT;\n\t\trfc.mode = pi->mode;\n\n\t\tif (pi->num_conf_rsp == 1)\n\t\t\treturn -ECONNREFUSED;\n\n\t\tl2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,\n\t\t\t\t\tsizeof(rfc), (unsigned long) &rfc);\n\t}\n\n\n \tif (result == L2CAP_CONF_SUCCESS) {\n \t\t/* Configure output options and let the other side know\n \t\t * which ones we don't like. */\n \n\t\tif (mtu < L2CAP_DEFAULT_MIN_MTU)\n\t\t\tresult = L2CAP_CONF_UNACCEPT;\n\t\telse {\n\t\t\tpi->omtu = mtu;\n\t\t\tpi->conf_state |= L2CAP_CONF_MTU_DONE;\n\t\t}\n\t\tl2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu);\n \n\t\tswitch (rfc.mode) {\n\t\tcase L2CAP_MODE_BASIC:\n\t\t\tpi->fcs = L2CAP_FCS_NONE;\n\t\t\tpi->conf_state |= L2CAP_CONF_MODE_DONE;\n\t\t\tbreak;\n\n\t\tcase L2CAP_MODE_ERTM:\n\t\t\tpi->remote_tx_win = rfc.txwin_size;\n\t\t\tpi->remote_max_tx = rfc.max_transmit;\n\t\t\tpi->max_pdu_size = rfc.max_pdu_size;\n\n\t\t\trfc.retrans_timeout = L2CAP_DEFAULT_RETRANS_TO;\n\t\t\trfc.monitor_timeout = L2CAP_DEFAULT_MONITOR_TO;\n\n\t\t\tpi->conf_state |= L2CAP_CONF_MODE_DONE;\n\t\t\tbreak;\n\n\t\tcase L2CAP_MODE_STREAMING:\n\t\t\tpi->remote_tx_win = rfc.txwin_size;\n\t\t\tpi->max_pdu_size = rfc.max_pdu_size;\n\n\t\t\tpi->conf_state |= L2CAP_CONF_MODE_DONE;\n\t\t\tbreak;\n\n\t\tdefault:\n \t\t\tresult = L2CAP_CONF_UNACCEPT;\n \n \t\t\tmemset(&rfc, 0, sizeof(rfc));\n\t\t\trfc.mode = pi->mode;\n\t\t}\n \n\t\tl2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,\n \t\t\t\t\tsizeof(rfc), (unsigned long) &rfc);\n \n\t\tif (result == L2CAP_CONF_SUCCESS)\n\t\t\tpi->conf_state |= L2CAP_CONF_OUTPUT_DONE;\n\t}\n \trsp->scid = cpu_to_le16(pi->dcid);\n \trsp->result = cpu_to_le16(result);\n \trsp->flags = cpu_to_le16(0x0000);\n \n \treturn ptr - data;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0048b4837affd153897ed1222283492070027aa9", + "input": "static void bt_for_each(struct blk_mq_hw_ctx *hctx,\n\t\tstruct blk_mq_bitmap_tags *bt, unsigned int off,\n\t\tbusy_iter_fn *fn, void *data, bool reserved)\n{\n\tstruct request *rq;\n\tint bit, i;\n\n\tfor (i = 0; i < bt->map_nr; i++) {\n\t\tstruct blk_align_bitmap *bm = &bt->map[i];\n\n \t\tfor (bit = find_first_bit(&bm->word, bm->depth);\n \t\t bit < bm->depth;\n \t\t bit = find_next_bit(&bm->word, bm->depth, bit + 1)) {\n\t\t \trq = blk_mq_tag_to_rq(hctx->tags, off + bit);\n \t\t\tif (rq->q == hctx->queue)\n \t\t\t\tfn(hctx, rq, data, reserved);\n \t\t}\n\n\t\toff += (1 << bt->bits_per_word);\n\t}\n}\n", + "target": "static void bt_for_each(struct blk_mq_hw_ctx *hctx,\n\t\tstruct blk_mq_bitmap_tags *bt, unsigned int off,\n\t\tbusy_iter_fn *fn, void *data, bool reserved)\n{\n\tstruct request *rq;\n\tint bit, i;\n\n\tfor (i = 0; i < bt->map_nr; i++) {\n\t\tstruct blk_align_bitmap *bm = &bt->map[i];\n\n \t\tfor (bit = find_first_bit(&bm->word, bm->depth);\n \t\t bit < bm->depth;\n \t\t bit = find_next_bit(&bm->word, bm->depth, bit + 1)) {\n\t\t\trq = hctx->tags->rqs[off + bit];\n \t\t\tif (rq->q == hctx->queue)\n \t\t\t\tfn(hctx, rq, data, reserved);\n \t\t}\n\n\t\toff += (1 << bt->bits_per_word);\n\t}\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#744692dc059845b2a3022119871846e74d4f6e11", + "input": "static int ext4_end_io_nolock(ext4_io_end_t *io)\n{\n\tstruct inode *inode = io->inode;\n\tloff_t offset = io->offset;\n\tssize_t size = io->size;\n\tint ret = 0;\n\n\text4_debug(\"ext4_end_io_nolock: io 0x%p from inode %lu,list->next 0x%p,\"\n\t\t \"list->prev 0x%p\\n\",\n\t io, inode->i_ino, io->list.next, io->list.prev);\n\n\tif (list_empty(&io->list))\n\t\treturn ret;\n\n \tif (io->flag != EXT4_IO_UNWRITTEN)\n \t\treturn ret;\n \n\tif (offset + size <= i_size_read(inode))\n\t\tret = ext4_convert_unwritten_extents(inode, offset, size);\n \tif (ret < 0) {\n \t\tprintk(KERN_EMERG \"%s: failed to convert unwritten\"\n \t\t\t\"extents to written extents, error is %d\"\n\t\t\t\" io is still on inode %lu aio dio list\\n\",\n __func__, ret, inode->i_ino);\n\t\treturn ret;\n\t}\n\n\t/* clear the DIO AIO unwritten flag */\n\tio->flag = 0;\n\treturn ret;\n}\n", + "target": "static int ext4_end_io_nolock(ext4_io_end_t *io)\n{\n\tstruct inode *inode = io->inode;\n\tloff_t offset = io->offset;\n\tssize_t size = io->size;\n\tint ret = 0;\n\n\text4_debug(\"ext4_end_io_nolock: io 0x%p from inode %lu,list->next 0x%p,\"\n\t\t \"list->prev 0x%p\\n\",\n\t io, inode->i_ino, io->list.next, io->list.prev);\n\n\tif (list_empty(&io->list))\n\t\treturn ret;\n\n \tif (io->flag != EXT4_IO_UNWRITTEN)\n \t\treturn ret;\n \n\tret = ext4_convert_unwritten_extents(inode, offset, size);\n \tif (ret < 0) {\n \t\tprintk(KERN_EMERG \"%s: failed to convert unwritten\"\n \t\t\t\"extents to written extents, error is %d\"\n\t\t\t\" io is still on inode %lu aio dio list\\n\",\n __func__, ret, inode->i_ino);\n\t\treturn ret;\n\t}\n\n\t/* clear the DIO AIO unwritten flag */\n\tio->flag = 0;\n\treturn ret;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7c80f9e4a588f1925b07134bb2e3689335f6c6d8", + "input": "get_endpoints(struct usbtest_dev *dev, struct usb_interface *intf)\n{\n\tint\t\t\t\ttmp;\n\tstruct usb_host_interface\t*alt;\n\tstruct usb_host_endpoint\t*in, *out;\n\tstruct usb_host_endpoint\t*iso_in, *iso_out;\n\tstruct usb_host_endpoint\t*int_in, *int_out;\n\tstruct usb_device\t\t*udev;\n\n\tfor (tmp = 0; tmp < intf->num_altsetting; tmp++) {\n\t\tunsigned\tep;\n\n\t\tin = out = NULL;\n\t\tiso_in = iso_out = NULL;\n\t\tint_in = int_out = NULL;\n\t\talt = intf->altsetting + tmp;\n\n\t\tif (override_alt >= 0 &&\n\t\t\t\toverride_alt != alt->desc.bAlternateSetting)\n\t\t\tcontinue;\n\n\t\t/* take the first altsetting with in-bulk + out-bulk;\n\t\t * ignore other endpoints and altsettings.\n\t\t */\n\t\tfor (ep = 0; ep < alt->desc.bNumEndpoints; ep++) {\n\t\t\tstruct usb_host_endpoint\t*e;\n\t\t\tint edi;\n\n\t\t\te = alt->endpoint + ep;\n\t\t\tedi = usb_endpoint_dir_in(&e->desc);\n\n\t\t\tswitch (usb_endpoint_type(&e->desc)) {\n\t\t\tcase USB_ENDPOINT_XFER_BULK:\n\t\t\t\tendpoint_update(edi, &in, &out, e);\n\t\t\t\tcontinue;\n\t\t\tcase USB_ENDPOINT_XFER_INT:\n\t\t\t\tif (dev->info->intr)\n\t\t\t\t\tendpoint_update(edi, &int_in, &int_out, e);\n\t\t\t\tcontinue;\n\t\t\tcase USB_ENDPOINT_XFER_ISOC:\n\t\t\t\tif (dev->info->iso)\n\t\t\t\t\tendpoint_update(edi, &iso_in, &iso_out, e);\n\t\t\t\t/* FALLTHROUGH */\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif ((in && out) || iso_in || iso_out || int_in || int_out)\n\t\t\tgoto found;\n\t}\n\treturn -EINVAL;\n\nfound:\n\tudev = testdev_to_usbdev(dev);\n\tdev->info->alt = alt->desc.bAlternateSetting;\n\tif (alt->desc.bAlternateSetting != 0) {\n\t\ttmp = usb_set_interface(udev,\n\t\t\t\talt->desc.bInterfaceNumber,\n\t\t\t\talt->desc.bAlternateSetting);\n\t\tif (tmp < 0)\n \t\t\treturn tmp;\n \t}\n \n\tif (in) {\n \t\tdev->in_pipe = usb_rcvbulkpipe(udev,\n \t\t\tin->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);\n \t\tdev->out_pipe = usb_sndbulkpipe(udev,\n \t\t\tout->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);\n\t}\n \tif (iso_in) {\n \t\tdev->iso_in = &iso_in->desc;\n \t\tdev->in_iso_pipe = usb_rcvisocpipe(udev,\n\t\t\t\tiso_in->desc.bEndpointAddress\n\t\t\t\t\t& USB_ENDPOINT_NUMBER_MASK);\n\t}\n\n\tif (iso_out) {\n\t\tdev->iso_out = &iso_out->desc;\n\t\tdev->out_iso_pipe = usb_sndisocpipe(udev,\n\t\t\t\tiso_out->desc.bEndpointAddress\n\t\t\t\t\t& USB_ENDPOINT_NUMBER_MASK);\n\t}\n\n\tif (int_in) {\n\t\tdev->int_in = &int_in->desc;\n\t\tdev->in_int_pipe = usb_rcvintpipe(udev,\n\t\t\t\tint_in->desc.bEndpointAddress\n\t\t\t\t\t& USB_ENDPOINT_NUMBER_MASK);\n\t}\n\n\tif (int_out) {\n\t\tdev->int_out = &int_out->desc;\n\t\tdev->out_int_pipe = usb_sndintpipe(udev,\n\t\t\t\tint_out->desc.bEndpointAddress\n\t\t\t\t\t& USB_ENDPOINT_NUMBER_MASK);\n\t}\n\treturn 0;\n}\n", + "target": "get_endpoints(struct usbtest_dev *dev, struct usb_interface *intf)\n{\n\tint\t\t\t\ttmp;\n\tstruct usb_host_interface\t*alt;\n\tstruct usb_host_endpoint\t*in, *out;\n\tstruct usb_host_endpoint\t*iso_in, *iso_out;\n\tstruct usb_host_endpoint\t*int_in, *int_out;\n\tstruct usb_device\t\t*udev;\n\n\tfor (tmp = 0; tmp < intf->num_altsetting; tmp++) {\n\t\tunsigned\tep;\n\n\t\tin = out = NULL;\n\t\tiso_in = iso_out = NULL;\n\t\tint_in = int_out = NULL;\n\t\talt = intf->altsetting + tmp;\n\n\t\tif (override_alt >= 0 &&\n\t\t\t\toverride_alt != alt->desc.bAlternateSetting)\n\t\t\tcontinue;\n\n\t\t/* take the first altsetting with in-bulk + out-bulk;\n\t\t * ignore other endpoints and altsettings.\n\t\t */\n\t\tfor (ep = 0; ep < alt->desc.bNumEndpoints; ep++) {\n\t\t\tstruct usb_host_endpoint\t*e;\n\t\t\tint edi;\n\n\t\t\te = alt->endpoint + ep;\n\t\t\tedi = usb_endpoint_dir_in(&e->desc);\n\n\t\t\tswitch (usb_endpoint_type(&e->desc)) {\n\t\t\tcase USB_ENDPOINT_XFER_BULK:\n\t\t\t\tendpoint_update(edi, &in, &out, e);\n\t\t\t\tcontinue;\n\t\t\tcase USB_ENDPOINT_XFER_INT:\n\t\t\t\tif (dev->info->intr)\n\t\t\t\t\tendpoint_update(edi, &int_in, &int_out, e);\n\t\t\t\tcontinue;\n\t\t\tcase USB_ENDPOINT_XFER_ISOC:\n\t\t\t\tif (dev->info->iso)\n\t\t\t\t\tendpoint_update(edi, &iso_in, &iso_out, e);\n\t\t\t\t/* FALLTHROUGH */\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif ((in && out) || iso_in || iso_out || int_in || int_out)\n\t\t\tgoto found;\n\t}\n\treturn -EINVAL;\n\nfound:\n\tudev = testdev_to_usbdev(dev);\n\tdev->info->alt = alt->desc.bAlternateSetting;\n\tif (alt->desc.bAlternateSetting != 0) {\n\t\ttmp = usb_set_interface(udev,\n\t\t\t\talt->desc.bInterfaceNumber,\n\t\t\t\talt->desc.bAlternateSetting);\n\t\tif (tmp < 0)\n \t\t\treturn tmp;\n \t}\n \n\tif (in)\n \t\tdev->in_pipe = usb_rcvbulkpipe(udev,\n \t\t\tin->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);\n\tif (out)\n \t\tdev->out_pipe = usb_sndbulkpipe(udev,\n \t\t\tout->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);\n\n \tif (iso_in) {\n \t\tdev->iso_in = &iso_in->desc;\n \t\tdev->in_iso_pipe = usb_rcvisocpipe(udev,\n\t\t\t\tiso_in->desc.bEndpointAddress\n\t\t\t\t\t& USB_ENDPOINT_NUMBER_MASK);\n\t}\n\n\tif (iso_out) {\n\t\tdev->iso_out = &iso_out->desc;\n\t\tdev->out_iso_pipe = usb_sndisocpipe(udev,\n\t\t\t\tiso_out->desc.bEndpointAddress\n\t\t\t\t\t& USB_ENDPOINT_NUMBER_MASK);\n\t}\n\n\tif (int_in) {\n\t\tdev->int_in = &int_in->desc;\n\t\tdev->in_int_pipe = usb_rcvintpipe(udev,\n\t\t\t\tint_in->desc.bEndpointAddress\n\t\t\t\t\t& USB_ENDPOINT_NUMBER_MASK);\n\t}\n\n\tif (int_out) {\n\t\tdev->int_out = &int_out->desc;\n\t\tdev->out_int_pipe = usb_sndintpipe(udev,\n\t\t\t\tint_out->desc.bEndpointAddress\n\t\t\t\t\t& USB_ENDPOINT_NUMBER_MASK);\n\t}\n\treturn 0;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#472271b153c5dc53c28beac55480a8d8434b2d5c", + "input": "void btsock_l2cap_signaled(int fd, int flags, uint32_t user_id)\n{\n l2cap_socket *sock;\n char drop_it = FALSE;\n\n /* We use MSG_DONTWAIT when sending data to JAVA, hence it can be accepted to hold the lock. */\n pthread_mutex_lock(&state_lock);\n sock = btsock_l2cap_find_by_id_l(user_id);\n if (sock) {\n if ((flags & SOCK_THREAD_FD_RD) && !sock->server) {\n\n if (sock->connected) {\n int size = 0;\n \n if (!(flags & SOCK_THREAD_FD_EXCEPTION) || (ioctl(sock->our_fd, FIONREAD, &size)\n == 0 && size)) {\n uint8_t *buffer = osi_malloc(L2CAP_MAX_SDU_LENGTH);\n /* Apparently we hijack the req_id (UINT32) to pass the pointer to the buffer to\n * the write complete callback, which call a free... wonder if this works on a\n * 64 bit platform? */\n if (buffer != NULL) {\n /* The socket is created with SOCK_SEQPACKET, hence we read one message at\n * the time. The maximum size of a message is allocated to ensure data is\n * not lost. This is okay to do as Android uses virtual memory, hence even\n * if we only use a fraction of the memory it should not block for others\n * to use the memory. As the definition of ioctl(FIONREAD) do not clearly\n * define what value will be returned if multiple messages are written to\n * the socket before any message is read from the socket, we could\n * potentially risk to allocate way more memory than needed. One of the use\n * cases for this socket is obex where multiple 64kbyte messages are\n * typically written to the socket in a tight loop, hence we risk the ioctl\n * will return the total amount of data in the buffer, which could be\n * multiple 64kbyte chunks.\n * UPDATE: As bluedroid cannot handle 64kbyte buffers, the size is reduced\n * to around 8kbyte - and using malloc for buffer allocation here seems to\n * be wrong\n\n * UPDATE: Since we are responsible for freeing the buffer in the\n * write_complete_ind, it is OK to use malloc. */\n \n int count = recv(fd, buffer, L2CAP_MAX_SDU_LENGTH,\n MSG_NOSIGNAL | MSG_DONTWAIT);\n APPL_TRACE_DEBUG(\"btsock_l2cap_signaled - %d bytes received from socket\",\n count);\n if (sock->fixed_chan) {\n if(BTA_JvL2capWriteFixed(sock->channel, (BD_ADDR*)&sock->addr,\n (UINT32)buffer, btsock_l2cap_cbk, buffer, count,\n (void *)user_id) != BTA_JV_SUCCESS) {\n on_l2cap_write_fixed_done(buffer, user_id);\n }\n } else {\n if(BTA_JvL2capWrite(sock->handle, (UINT32)buffer, buffer, count,\n (void *)user_id) != BTA_JV_SUCCESS) {\n on_l2cap_write_done(buffer, user_id);\n }\n }\n } else {\n APPL_TRACE_ERROR(\"Unable to allocate memory for data packet from JAVA...\")\n }\n }\n } else\n drop_it = TRUE;\n }\n if (flags & SOCK_THREAD_FD_WR) {\n if (flush_incoming_que_on_wr_signal_l(sock) && sock->connected)\n btsock_thread_add_fd(pth, sock->our_fd, BTSOCK_L2CAP, SOCK_THREAD_FD_WR, sock->id);\n\n }\n if (drop_it || (flags & SOCK_THREAD_FD_EXCEPTION)) {\n int size = 0;\n if (drop_it || ioctl(sock->our_fd, FIONREAD, &size) != 0 || size == 0)\n btsock_l2cap_free_l(sock);\n }\n }\n pthread_mutex_unlock(&state_lock);\n}\n", + "target": "void btsock_l2cap_signaled(int fd, int flags, uint32_t user_id)\n{\n l2cap_socket *sock;\n char drop_it = FALSE;\n\n /* We use MSG_DONTWAIT when sending data to JAVA, hence it can be accepted to hold the lock. */\n pthread_mutex_lock(&state_lock);\n sock = btsock_l2cap_find_by_id_l(user_id);\n if (sock) {\n if ((flags & SOCK_THREAD_FD_RD) && !sock->server) {\n\n if (sock->connected) {\n int size = 0;\n \n if (!(flags & SOCK_THREAD_FD_EXCEPTION) || (TEMP_FAILURE_RETRY(ioctl(sock->our_fd, FIONREAD, &size))\n == 0 && size)) {\n uint8_t *buffer = osi_malloc(L2CAP_MAX_SDU_LENGTH);\n /* Apparently we hijack the req_id (UINT32) to pass the pointer to the buffer to\n * the write complete callback, which call a free... wonder if this works on a\n * 64 bit platform? */\n if (buffer != NULL) {\n /* The socket is created with SOCK_SEQPACKET, hence we read one message at\n * the time. The maximum size of a message is allocated to ensure data is\n * not lost. This is okay to do as Android uses virtual memory, hence even\n * if we only use a fraction of the memory it should not block for others\n * to use the memory. As the definition of ioctl(FIONREAD) do not clearly\n * define what value will be returned if multiple messages are written to\n * the socket before any message is read from the socket, we could\n * potentially risk to allocate way more memory than needed. One of the use\n * cases for this socket is obex where multiple 64kbyte messages are\n * typically written to the socket in a tight loop, hence we risk the ioctl\n * will return the total amount of data in the buffer, which could be\n * multiple 64kbyte chunks.\n * UPDATE: As bluedroid cannot handle 64kbyte buffers, the size is reduced\n * to around 8kbyte - and using malloc for buffer allocation here seems to\n * be wrong\n\n * UPDATE: Since we are responsible for freeing the buffer in the\n * write_complete_ind, it is OK to use malloc. */\n \n int count = TEMP_FAILURE_RETRY(recv(fd, buffer, L2CAP_MAX_SDU_LENGTH,\n MSG_NOSIGNAL | MSG_DONTWAIT));\n APPL_TRACE_DEBUG(\"btsock_l2cap_signaled - %d bytes received from socket\",\n count);\n if (sock->fixed_chan) {\n if(BTA_JvL2capWriteFixed(sock->channel, (BD_ADDR*)&sock->addr,\n (UINT32)buffer, btsock_l2cap_cbk, buffer, count,\n (void *)user_id) != BTA_JV_SUCCESS) {\n on_l2cap_write_fixed_done(buffer, user_id);\n }\n } else {\n if(BTA_JvL2capWrite(sock->handle, (UINT32)buffer, buffer, count,\n (void *)user_id) != BTA_JV_SUCCESS) {\n on_l2cap_write_done(buffer, user_id);\n }\n }\n } else {\n APPL_TRACE_ERROR(\"Unable to allocate memory for data packet from JAVA...\")\n }\n }\n } else\n drop_it = TRUE;\n }\n if (flags & SOCK_THREAD_FD_WR) {\n if (flush_incoming_que_on_wr_signal_l(sock) && sock->connected)\n btsock_thread_add_fd(pth, sock->our_fd, BTSOCK_L2CAP, SOCK_THREAD_FD_WR, sock->id);\n\n }\n if (drop_it || (flags & SOCK_THREAD_FD_EXCEPTION)) {\n int size = 0;\n if (drop_it || TEMP_FAILURE_RETRY(ioctl(sock->our_fd, FIONREAD, &size)) != 0 || size == 0)\n btsock_l2cap_free_l(sock);\n }\n }\n pthread_mutex_unlock(&state_lock);\n}\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ba3b1b344017bbf36283464b51014fad15c2f3f4", + "input": " TestJavaScriptDialogManager()\n : is_fullscreen_(false), message_loop_runner_(new MessageLoopRunner) {}\n", + "target": " TestJavaScriptDialogManager()\n TestWCDelegateForDialogsAndFullscreen()\n : is_fullscreen_(false), message_loop_runner_(new MessageLoopRunner) {}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#79708b391b2e91d63b5d009ec6202c7d7ededf93", + "input": "base::Optional OpenVRGamepadHelper::GetXRGamepad(\n vr::IVRSystem* vr_system,\n uint32_t controller_id,\n vr::VRControllerState_t controller_state,\n device::mojom::XRHandedness handedness) {\n OpenVRGamepadBuilder builder(vr_system, controller_id, controller_state,\n handedness);\n \n if (!builder.TryAddAxesButton(vr::k_EButton_SteamVR_Trigger))\n return base::nullopt;\n \n if (!builder.TryAddNextUnusedAxesButton())\n return base::nullopt;\n \n if (!builder.TryAddButton(vr::k_EButton_Grip))\n builder.AddPlaceholderButton();\n \n if (!builder.TryAddNextUnusedAxesButton())\n builder.AddPlaceholderButton();\n \n for (const auto& button : kWebXRButtonOrder) {\n builder.TryAddButton(button);\n }\n \n builder.AddRemainingAxes();\n \n return builder.GetGamepad();\n }\n", + "target": "base::Optional OpenVRGamepadHelper::GetXRGamepad(\n vr::IVRSystem* vr_system,\n uint32_t controller_id,\n vr::VRControllerState_t controller_state,\n device::mojom::XRHandedness handedness) {\n OpenVRGamepadBuilder builder(vr_system, controller_id, controller_state,\n handedness);\n \n if (!builder.TryAddAxesOrTriggerButton(vr::k_EButton_SteamVR_Trigger))\n return base::nullopt;\n \n if (!builder.TryAddNextUnusedButtonWithAxes())\n return base::nullopt;\n \n bool added_placeholder_grip = false;\n if (!builder.TryAddButton(vr::k_EButton_Grip)) {\n added_placeholder_grip = true;\n builder.AddPlaceholderButton();\n }\n \n bool added_placeholder_axes = false;\n if (!builder.TryAddNextUnusedButtonWithAxes()) {\n added_placeholder_axes = true;\n builder.AddPlaceholderButton();\n }\n \n bool added_optional_buttons = false;\n for (const auto& button : kWebXRButtonOrder) {\n added_optional_buttons =\n builder.TryAddButton(button) || added_optional_buttons;\n }\n \n bool added_optional_axes = builder.AddRemainingTriggersAndAxes();\n\n // If we didn't add any optional buttons, we need to remove our placeholder\n // buttons.\n if (!(added_optional_buttons || added_optional_axes)) {\n // If we didn't add any optional buttons, see if we need to remove the most\n // recent placeholder (the secondary axes).\n // Note that if we added a placeholder axes, the only optional axes that\n // should have been added are triggers, and so we don't need to worry about\n // the order\n if (added_placeholder_axes) {\n builder.RemovePlaceholderButton();\n\n // Only if the axes button was a placeholder can we remove the grip\n // if it was also a placeholder.\n if (added_placeholder_grip) {\n builder.RemovePlaceholderButton();\n }\n }\n }\n \n return builder.GetGamepad();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#50270d98e26fa18b20ca88216c3526667b724ba7", + "input": "OMX_ERRORTYPE SoftMPEG4Encoder::initEncParams() {\n CHECK(mHandle != NULL);\n memset(mHandle, 0, sizeof(tagvideoEncControls));\n\n CHECK(mEncParams != NULL);\n memset(mEncParams, 0, sizeof(tagvideoEncOptions));\n if (!PVGetDefaultEncOption(mEncParams, 0)) {\n ALOGE(\"Failed to get default encoding parameters\");\n return OMX_ErrorUndefined;\n }\n mEncParams->encMode = mEncodeMode;\n mEncParams->encWidth[0] = mWidth;\n mEncParams->encHeight[0] = mHeight;\n mEncParams->encFrameRate[0] = mFramerate >> 16; // mFramerate is in Q16 format\n mEncParams->rcType = VBR_1;\n mEncParams->vbvDelay = 5.0f;\n\n mEncParams->profile_level = CORE_PROFILE_LEVEL2;\n mEncParams->packetSize = 32;\n mEncParams->rvlcEnable = PV_OFF;\n mEncParams->numLayers = 1;\n mEncParams->timeIncRes = 1000;\n mEncParams->tickPerSrc = ((int64_t)mEncParams->timeIncRes << 16) / mFramerate;\n\n mEncParams->bitRate[0] = mBitrate;\n mEncParams->iQuant[0] = 15;\n mEncParams->pQuant[0] = 12;\n mEncParams->quantType[0] = 0;\n mEncParams->noFrameSkipped = PV_OFF;\n\n\n if (mColorFormat != OMX_COLOR_FormatYUV420Planar || mInputDataIsMeta) {\n free(mInputFrameData);\n mInputFrameData =\n (uint8_t *) malloc((mWidth * mHeight * 3 ) >> 1);\n CHECK(mInputFrameData != NULL);\n }\n\n if (mWidth % 16 != 0 || mHeight % 16 != 0) {\n ALOGE(\"Video frame size %dx%d must be a multiple of 16\",\n mWidth, mHeight);\n return OMX_ErrorBadParameter;\n }\n\n if (mIDRFrameRefreshIntervalInSec < 0) {\n mEncParams->intraPeriod = -1;\n } else if (mIDRFrameRefreshIntervalInSec == 0) {\n mEncParams->intraPeriod = 1; // All I frames\n } else {\n mEncParams->intraPeriod =\n (mIDRFrameRefreshIntervalInSec * mFramerate) >> 16;\n }\n\n mEncParams->numIntraMB = 0;\n mEncParams->sceneDetect = PV_ON;\n mEncParams->searchRange = 16;\n mEncParams->mv8x8Enable = PV_OFF;\n mEncParams->gobHeaderInterval = 0;\n mEncParams->useACPred = PV_ON;\n mEncParams->intraDCVlcTh = 0;\n\n return OMX_ErrorNone;\n}\n", + "target": "OMX_ERRORTYPE SoftMPEG4Encoder::initEncParams() {\n CHECK(mHandle != NULL);\n memset(mHandle, 0, sizeof(tagvideoEncControls));\n\n CHECK(mEncParams != NULL);\n memset(mEncParams, 0, sizeof(tagvideoEncOptions));\n if (!PVGetDefaultEncOption(mEncParams, 0)) {\n ALOGE(\"Failed to get default encoding parameters\");\n return OMX_ErrorUndefined;\n }\n mEncParams->encMode = mEncodeMode;\n mEncParams->encWidth[0] = mWidth;\n mEncParams->encHeight[0] = mHeight;\n mEncParams->encFrameRate[0] = mFramerate >> 16; // mFramerate is in Q16 format\n mEncParams->rcType = VBR_1;\n mEncParams->vbvDelay = 5.0f;\n\n mEncParams->profile_level = CORE_PROFILE_LEVEL2;\n mEncParams->packetSize = 32;\n mEncParams->rvlcEnable = PV_OFF;\n mEncParams->numLayers = 1;\n mEncParams->timeIncRes = 1000;\n mEncParams->tickPerSrc = ((int64_t)mEncParams->timeIncRes << 16) / mFramerate;\n\n mEncParams->bitRate[0] = mBitrate;\n mEncParams->iQuant[0] = 15;\n mEncParams->pQuant[0] = 12;\n mEncParams->quantType[0] = 0;\n mEncParams->noFrameSkipped = PV_OFF;\n\n\n if (mColorFormat != OMX_COLOR_FormatYUV420Planar || mInputDataIsMeta) {\n free(mInputFrameData);\n mInputFrameData = NULL;\n if (((uint64_t)mWidth * mHeight) > ((uint64_t)INT32_MAX / 3)) {\n ALOGE(\"b/25812794, Buffer size is too big.\");\n return OMX_ErrorBadParameter;\n }\n mInputFrameData =\n (uint8_t *) malloc((mWidth * mHeight * 3 ) >> 1);\n CHECK(mInputFrameData != NULL);\n }\n\n if (mWidth % 16 != 0 || mHeight % 16 != 0) {\n ALOGE(\"Video frame size %dx%d must be a multiple of 16\",\n mWidth, mHeight);\n return OMX_ErrorBadParameter;\n }\n\n if (mIDRFrameRefreshIntervalInSec < 0) {\n mEncParams->intraPeriod = -1;\n } else if (mIDRFrameRefreshIntervalInSec == 0) {\n mEncParams->intraPeriod = 1; // All I frames\n } else {\n mEncParams->intraPeriod =\n (mIDRFrameRefreshIntervalInSec * mFramerate) >> 16;\n }\n\n mEncParams->numIntraMB = 0;\n mEncParams->sceneDetect = PV_ON;\n mEncParams->searchRange = 16;\n mEncParams->mv8x8Enable = PV_OFF;\n mEncParams->gobHeaderInterval = 0;\n mEncParams->useACPred = PV_ON;\n mEncParams->intraDCVlcTh = 0;\n\n return OMX_ErrorNone;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#acc192347665943ca674acf117e4f74a88436922", + "input": " static void copyStereo24(\n short *dst,\n const int *const *src,\n unsigned nSamples,\n unsigned /* nChannels */) {\n for (unsigned i = 0; i < nSamples; ++i) {\n *dst++ = src[0][i] >> 8;\n *dst++ = src[1][i] >> 8;\n\n }\n }\n", + "target": " static void copyStereo24(\n short *dst,\n const int * src[FLACParser::kMaxChannels],\n unsigned nSamples,\n unsigned /* nChannels */) {\n for (unsigned i = 0; i < nSamples; ++i) {\n *dst++ = src[0][i] >> 8;\n *dst++ = src[1][i] >> 8;\n\n }\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f95864afe8833fe3ad782d714b41378e860977b1", + "input": "static int read_fragment_table(long long *directory_table_end)\n {\n \tint res, i;\n\tint bytes = SQUASHFS_FRAGMENT_BYTES(sBlk.s.fragments);\n\tint indexes = SQUASHFS_FRAGMENT_INDEXES(sBlk.s.fragments);\n\tlong long fragment_table_index[indexes];\n \n \tTRACE(\"read_fragment_table: %d fragments, reading %d fragment indexes \"\n \t\t\"from 0x%llx\\n\", sBlk.s.fragments, indexes,\n \t\tsBlk.s.fragment_table_start);\n \n\tif(sBlk.s.fragments == 0) {\n\t\t*directory_table_end = sBlk.s.fragment_table_start;\n\t\treturn TRUE;\n\t}\n \tfragment_table = malloc(bytes);\n \tif(fragment_table == NULL)\n \t\tEXIT_UNSQUASH(\"read_fragment_table: failed to allocate \"\n \t\t\t\"fragment table\\n\");\n \n\tres = read_fs_bytes(fd, sBlk.s.fragment_table_start,\n\t\tSQUASHFS_FRAGMENT_INDEX_BYTES(sBlk.s.fragments),\n\t\tfragment_table_index);\n \tif(res == FALSE) {\n \t\tERROR(\"read_fragment_table: failed to read fragment table \"\n \t\t\t\"index\\n\");\n\t\treturn FALSE;\n\t}\n\tSQUASHFS_INSWAP_FRAGMENT_INDEXES(fragment_table_index, indexes);\n\n\tfor(i = 0; i < indexes; i++) {\n\t\tint expected = (i + 1) != indexes ? SQUASHFS_METADATA_SIZE :\n\t\t\t\t\tbytes & (SQUASHFS_METADATA_SIZE - 1);\n\t\tint length = read_block(fd, fragment_table_index[i], NULL,\n\t\t\texpected, ((char *) fragment_table) + (i *\n\t\t\tSQUASHFS_METADATA_SIZE));\n\t\tTRACE(\"Read fragment table block %d, from 0x%llx, length %d\\n\",\n\t\t\ti, fragment_table_index[i], length);\n\t\tif(length == FALSE) {\n\t\t\tERROR(\"read_fragment_table: failed to read fragment \"\n\t\t\t\t\"table index\\n\");\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\n \tfor(i = 0; i < sBlk.s.fragments; i++) \n \t\tSQUASHFS_INSWAP_FRAGMENT_ENTRY(&fragment_table[i]);\n \n\t*directory_table_end = fragment_table_index[0];\n \treturn TRUE;\n }\n", + "target": "static int read_fragment_table(long long *directory_table_end)\nlong long *alloc_index_table(int indexes)\n {\n\tstatic long long *alloc_table = NULL;\n\tstatic int alloc_size = 0;\n\tint length = indexes * sizeof(long long);\n\n\tif(alloc_size < length) {\n\t\tlong long *table = realloc(alloc_table, length);\n\n\t\tif(table == NULL)\n\t\t\tEXIT_UNSQUASH(\"alloc_index_table: failed to allocate \"\n\t\t\t\t\"index table\\n\");\n\n\t\talloc_table = table;\n\t\talloc_size = length;\n\t}\n\n\treturn alloc_table;\n}\n\n\nstatic int read_fragment_table(long long *table_start)\n{\n\t/*\n\t * Note on overflow limits:\n\t * Size of SBlk.s.fragments is 2^32 (unsigned int)\n\t * Max size of bytes is 2^32*16 or 2^36\n\t * Max indexes is (2^32*16)/8K or 2^23\n\t * Max length is ((2^32*16)/8K)*8 or 2^26 or 64M\n\t */\n \tint res, i;\n\tlong long bytes = SQUASHFS_FRAGMENT_BYTES((long long) sBlk.s.fragments);\n\tint indexes = SQUASHFS_FRAGMENT_INDEXES((long long) sBlk.s.fragments);\n\tint length = SQUASHFS_FRAGMENT_INDEX_BYTES((long long) sBlk.s.fragments);\n\tlong long *fragment_table_index;\n\n\t/*\n\t * The size of the index table (length bytes) should match the\n\t * table start and end points\n\t */\n\tif(length != (*table_start - sBlk.s.fragment_table_start)) {\n\t\tERROR(\"read_fragment_table: Bad fragment count in super block\\n\");\n\t\treturn FALSE;\n\t}\n \n \tTRACE(\"read_fragment_table: %d fragments, reading %d fragment indexes \"\n \t\t\"from 0x%llx\\n\", sBlk.s.fragments, indexes,\n \t\tsBlk.s.fragment_table_start);\n \n\tfragment_table_index = alloc_index_table(indexes);\n \tfragment_table = malloc(bytes);\n \tif(fragment_table == NULL)\n \t\tEXIT_UNSQUASH(\"read_fragment_table: failed to allocate \"\n \t\t\t\"fragment table\\n\");\n \n\tres = read_fs_bytes(fd, sBlk.s.fragment_table_start, length,\n\t\t\t\t\t\t\tfragment_table_index);\n \tif(res == FALSE) {\n \t\tERROR(\"read_fragment_table: failed to read fragment table \"\n \t\t\t\"index\\n\");\n\t\treturn FALSE;\n\t}\n\tSQUASHFS_INSWAP_FRAGMENT_INDEXES(fragment_table_index, indexes);\n\n\tfor(i = 0; i < indexes; i++) {\n\t\tint expected = (i + 1) != indexes ? SQUASHFS_METADATA_SIZE :\n\t\t\t\t\tbytes & (SQUASHFS_METADATA_SIZE - 1);\n\t\tint length = read_block(fd, fragment_table_index[i], NULL,\n\t\t\texpected, ((char *) fragment_table) + (i *\n\t\t\tSQUASHFS_METADATA_SIZE));\n\t\tTRACE(\"Read fragment table block %d, from 0x%llx, length %d\\n\",\n\t\t\ti, fragment_table_index[i], length);\n\t\tif(length == FALSE) {\n\t\t\tERROR(\"read_fragment_table: failed to read fragment \"\n\t\t\t\t\"table index\\n\");\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\n \tfor(i = 0; i < sBlk.s.fragments; i++) \n \t\tSQUASHFS_INSWAP_FRAGMENT_ENTRY(&fragment_table[i]);\n \n\t*table_start = fragment_table_index[0];\n \treturn TRUE;\n }\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d29216842a85c7970c536108e093963f02714498", + "input": "static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns)\n{\n\tstruct mnt_namespace *new_ns;\n\tstruct ucounts *ucounts;\n\tint ret;\n\n\tucounts = inc_mnt_namespaces(user_ns);\n\tif (!ucounts)\n\t\treturn ERR_PTR(-ENOSPC);\n\n\tnew_ns = kmalloc(sizeof(struct mnt_namespace), GFP_KERNEL);\n\tif (!new_ns) {\n\t\tdec_mnt_namespaces(ucounts);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}\n\tret = ns_alloc_inum(&new_ns->ns);\n\tif (ret) {\n\t\tkfree(new_ns);\n\t\tdec_mnt_namespaces(ucounts);\n\t\treturn ERR_PTR(ret);\n\t}\n\tnew_ns->ns.ops = &mntns_operations;\n\tnew_ns->seq = atomic64_add_return(1, &mnt_ns_seq);\n\tatomic_set(&new_ns->count, 1);\n\tnew_ns->root = NULL;\n\tINIT_LIST_HEAD(&new_ns->list);\n\tinit_waitqueue_head(&new_ns->poll);\n \tnew_ns->event = 0;\n \tnew_ns->user_ns = get_user_ns(user_ns);\n \tnew_ns->ucounts = ucounts;\n \treturn new_ns;\n }\n", + "target": "static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns)\n{\n\tstruct mnt_namespace *new_ns;\n\tstruct ucounts *ucounts;\n\tint ret;\n\n\tucounts = inc_mnt_namespaces(user_ns);\n\tif (!ucounts)\n\t\treturn ERR_PTR(-ENOSPC);\n\n\tnew_ns = kmalloc(sizeof(struct mnt_namespace), GFP_KERNEL);\n\tif (!new_ns) {\n\t\tdec_mnt_namespaces(ucounts);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}\n\tret = ns_alloc_inum(&new_ns->ns);\n\tif (ret) {\n\t\tkfree(new_ns);\n\t\tdec_mnt_namespaces(ucounts);\n\t\treturn ERR_PTR(ret);\n\t}\n\tnew_ns->ns.ops = &mntns_operations;\n\tnew_ns->seq = atomic64_add_return(1, &mnt_ns_seq);\n\tatomic_set(&new_ns->count, 1);\n\tnew_ns->root = NULL;\n\tINIT_LIST_HEAD(&new_ns->list);\n\tinit_waitqueue_head(&new_ns->poll);\n \tnew_ns->event = 0;\n \tnew_ns->user_ns = get_user_ns(user_ns);\n \tnew_ns->ucounts = ucounts;\n\tnew_ns->mounts = 0;\n\tnew_ns->pending_mounts = 0;\n \treturn new_ns;\n }\n", + "vul_type": "cwe-400", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9fd9d629fcf836bb0d6210015d33a299cf6bca34", + "input": "void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) {\n test_launcher_utils::PrepareBrowserCommandLineForTests(command_line);\n\n command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType);\n\n#if defined(OS_WIN)\n if (command_line->HasSwitch(switches::kAshBrowserTests)) {\n command_line->AppendSwitchNative(switches::kViewerLaunchViaAppId,\n win8::test::kDefaultTestAppUserModelId);\n command_line->AppendSwitch(switches::kSilentLaunch);\n }\n#endif\n\n#if defined(OS_MACOSX)\n base::FilePath subprocess_path;\n PathService::Get(base::FILE_EXE, &subprocess_path);\n subprocess_path = subprocess_path.DirName().DirName();\n DCHECK_EQ(subprocess_path.BaseName().value(), \"Contents\");\n subprocess_path =\n subprocess_path.Append(\"Versions\").Append(chrome::kChromeVersion);\n subprocess_path =\n subprocess_path.Append(chrome::kHelperProcessExecutablePath);\n command_line->AppendSwitchPath(switches::kBrowserSubprocessPath,\n subprocess_path);\n#endif\n\n if (exit_when_last_browser_closes_)\n command_line->AppendSwitch(switches::kDisableZeroBrowsersOpenForTests);\n \n if (command_line->GetArgs().empty())\n command_line->AppendArg(url::kAboutBlankURL);\n }\n", + "target": "void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) {\n test_launcher_utils::PrepareBrowserCommandLineForTests(command_line);\n\n command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType);\n\n#if defined(OS_WIN)\n if (command_line->HasSwitch(switches::kAshBrowserTests)) {\n command_line->AppendSwitchNative(switches::kViewerLaunchViaAppId,\n win8::test::kDefaultTestAppUserModelId);\n command_line->AppendSwitch(switches::kSilentLaunch);\n }\n#endif\n\n#if defined(OS_MACOSX)\n base::FilePath subprocess_path;\n PathService::Get(base::FILE_EXE, &subprocess_path);\n subprocess_path = subprocess_path.DirName().DirName();\n DCHECK_EQ(subprocess_path.BaseName().value(), \"Contents\");\n subprocess_path =\n subprocess_path.Append(\"Versions\").Append(chrome::kChromeVersion);\n subprocess_path =\n subprocess_path.Append(chrome::kHelperProcessExecutablePath);\n command_line->AppendSwitchPath(switches::kBrowserSubprocessPath,\n subprocess_path);\n#endif\n\n if (exit_when_last_browser_closes_)\n command_line->AppendSwitch(switches::kDisableZeroBrowsersOpenForTests);\n \n if (open_about_blank_on_browser_launch_ && command_line->GetArgs().empty())\n command_line->AppendArg(url::kAboutBlankURL);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#568075bbc5d16239a5cbdeb579a8768f9836f13e", + "input": "bool CSPSource::schemeMatches(const KURL& url) const\n {\n if (m_scheme.isEmpty())\n return m_policy->protocolMatchesSelf(url);\n return equalIgnoringCase(url.protocol(), m_scheme);\n }\n", + "target": "bool CSPSource::schemeMatches(const KURL& url) const\n {\n if (m_scheme.isEmpty())\n return m_policy->protocolMatchesSelf(url);\n if (equalIgnoringCase(m_scheme, \"http\"))\n return equalIgnoringCase(url.protocol(), \"http\") || equalIgnoringCase(url.protocol(), \"https\");\n if (equalIgnoringCase(m_scheme, \"ws\"))\n return equalIgnoringCase(url.protocol(), \"ws\") || equalIgnoringCase(url.protocol(), \"wss\");\n return equalIgnoringCase(url.protocol(), m_scheme);\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f435825c0f527a8e52e6ffbc3ad0bc60531d537e", + "input": "_asn1_extract_der_octet (asn1_node node, const unsigned char *der,\n\t\t\t int der_len, unsigned flags)\n{\n int len2, len3;\n int counter, counter_end;\n int result;\n\n len2 = asn1_get_length_der (der, der_len, &len3);\n if (len2 < -1)\n return ASN1_DER_ERROR;\n\n counter = len3 + 1;\n DECR_LEN(der_len, len3);\n \n if (len2 == -1)\n counter_end = der_len - 2;\n else\n counter_end = der_len;\n \n while (counter < counter_end)\n {\n DECR_LEN(der_len, 1);\n\n if (len2 >= 0)\n\t{\n\t DECR_LEN(der_len, len2+len3);\n\t _asn1_append_value (node, der + counter + len3, len2);\n\t}\n else\n\t{\t\t\t/* indefinite */\n\t DECR_LEN(der_len, len3);\n\t result =\n\t _asn1_extract_der_octet (node, der + counter + len3,\n\t\t\t\t der_len, flags);\n\t if (result != ASN1_SUCCESS)\n\t return result;\n\t len2 = 0;\n\t}\n\n counter += len2 + len3 + 1;\n }\n\n return ASN1_SUCCESS;\n\ncleanup:\n return result;\n}\n", + "target": "_asn1_extract_der_octet (asn1_node node, const unsigned char *der,\n\t\t\t int der_len, unsigned flags)\n{\n int len2, len3;\n int counter, counter_end;\n int result;\n\n len2 = asn1_get_length_der (der, der_len, &len3);\n if (len2 < -1)\n return ASN1_DER_ERROR;\n\n counter = len3 + 1;\n DECR_LEN(der_len, len3);\n \n if (len2 == -1)\n {\n if (der_len < 2)\n return ASN1_DER_ERROR;\n counter_end = der_len - 2;\n }\n else\n counter_end = der_len;\n \n if (counter_end < counter)\n return ASN1_DER_ERROR;\n\n while (counter < counter_end)\n {\n DECR_LEN(der_len, 1);\n\n if (len2 >= 0)\n\t{\n\t DECR_LEN(der_len, len2+len3);\n\t _asn1_append_value (node, der + counter + len3, len2);\n\t}\n else\n\t{\t\t\t/* indefinite */\n\t DECR_LEN(der_len, len3);\n\t result =\n\t _asn1_extract_der_octet (node, der + counter + len3,\n\t\t\t\t der_len, flags);\n\t if (result != ASN1_SUCCESS)\n\t return result;\n\t len2 = 0;\n\t}\n\n counter += len2 + len3 + 1;\n }\n\n return ASN1_SUCCESS;\n\ncleanup:\n return result;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#704620afc70cf47abb9d6a1a57f3825d2bca49cf", + "input": "static int hwahc_security_create(struct hwahc *hwahc)\n{\n\tint result;\n\tstruct wusbhc *wusbhc = &hwahc->wusbhc;\n\tstruct usb_device *usb_dev = hwahc->wa.usb_dev;\n\tstruct device *dev = &usb_dev->dev;\n\tstruct usb_security_descriptor *secd;\n\tstruct usb_encryption_descriptor *etd;\n\tvoid *itr, *top;\n\tsize_t itr_size, needed, bytes;\n\tu8 index;\n\tchar buf[64];\n\n\t/* Find the host's security descriptors in the config descr bundle */\n\tindex = (usb_dev->actconfig - usb_dev->config) /\n\t\tsizeof(usb_dev->config[0]);\n\titr = usb_dev->rawdescriptors[index];\n\titr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength);\n \ttop = itr + itr_size;\n \tresult = __usb_get_extra_descriptor(usb_dev->rawdescriptors[index],\n \t\t\tle16_to_cpu(usb_dev->actconfig->desc.wTotalLength),\n\t\t\tUSB_DT_SECURITY, (void **) &secd);\n \tif (result == -1) {\n \t\tdev_warn(dev, \"BUG? WUSB host has no security descriptors\\n\");\n \t\treturn 0;\n\t}\n\tneeded = sizeof(*secd);\n\tif (top - (void *)secd < needed) {\n\t\tdev_err(dev, \"BUG? Not enough data to process security \"\n\t\t\t\"descriptor header (%zu bytes left vs %zu needed)\\n\",\n\t\t\ttop - (void *) secd, needed);\n\t\treturn 0;\n\t}\n\tneeded = le16_to_cpu(secd->wTotalLength);\n\tif (top - (void *)secd < needed) {\n\t\tdev_err(dev, \"BUG? Not enough data to process security \"\n\t\t\t\"descriptors (%zu bytes left vs %zu needed)\\n\",\n\t\t\ttop - (void *) secd, needed);\n\t\treturn 0;\n\t}\n\t/* Walk over the sec descriptors and store CCM1's on wusbhc */\n\titr = (void *) secd + sizeof(*secd);\n\ttop = (void *) secd + le16_to_cpu(secd->wTotalLength);\n\tindex = 0;\n\tbytes = 0;\n\twhile (itr < top) {\n\t\tetd = itr;\n\t\tif (top - itr < sizeof(*etd)) {\n\t\t\tdev_err(dev, \"BUG: bad host security descriptor; \"\n\t\t\t\t\"not enough data (%zu vs %zu left)\\n\",\n\t\t\t\ttop - itr, sizeof(*etd));\n\t\t\tbreak;\n\t\t}\n\t\tif (etd->bLength < sizeof(*etd)) {\n\t\t\tdev_err(dev, \"BUG: bad host encryption descriptor; \"\n\t\t\t\t\"descriptor is too short \"\n\t\t\t\t\"(%zu vs %zu needed)\\n\",\n\t\t\t\t(size_t)etd->bLength, sizeof(*etd));\n\t\t\tbreak;\n\t\t}\n\t\titr += etd->bLength;\n\t\tbytes += snprintf(buf + bytes, sizeof(buf) - bytes,\n\t\t\t\t \"%s (0x%02x) \",\n\t\t\t\t wusb_et_name(etd->bEncryptionType),\n\t\t\t\t etd->bEncryptionValue);\n\t\twusbhc->ccm1_etd = etd;\n\t}\n\tdev_info(dev, \"supported encryption types: %s\\n\", buf);\n\tif (wusbhc->ccm1_etd == NULL) {\n\t\tdev_err(dev, \"E: host doesn't support CCM-1 crypto\\n\");\n\t\treturn 0;\n\t}\n\t/* Pretty print what we support */\n\treturn 0;\n}\n", + "target": "static int hwahc_security_create(struct hwahc *hwahc)\n{\n\tint result;\n\tstruct wusbhc *wusbhc = &hwahc->wusbhc;\n\tstruct usb_device *usb_dev = hwahc->wa.usb_dev;\n\tstruct device *dev = &usb_dev->dev;\n\tstruct usb_security_descriptor *secd;\n\tstruct usb_encryption_descriptor *etd;\n\tvoid *itr, *top;\n\tsize_t itr_size, needed, bytes;\n\tu8 index;\n\tchar buf[64];\n\n\t/* Find the host's security descriptors in the config descr bundle */\n\tindex = (usb_dev->actconfig - usb_dev->config) /\n\t\tsizeof(usb_dev->config[0]);\n\titr = usb_dev->rawdescriptors[index];\n\titr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength);\n \ttop = itr + itr_size;\n \tresult = __usb_get_extra_descriptor(usb_dev->rawdescriptors[index],\n \t\t\tle16_to_cpu(usb_dev->actconfig->desc.wTotalLength),\n\t\t\tUSB_DT_SECURITY, (void **) &secd, sizeof(*secd));\n \tif (result == -1) {\n \t\tdev_warn(dev, \"BUG? WUSB host has no security descriptors\\n\");\n \t\treturn 0;\n\t}\n\tneeded = sizeof(*secd);\n\tif (top - (void *)secd < needed) {\n\t\tdev_err(dev, \"BUG? Not enough data to process security \"\n\t\t\t\"descriptor header (%zu bytes left vs %zu needed)\\n\",\n\t\t\ttop - (void *) secd, needed);\n\t\treturn 0;\n\t}\n\tneeded = le16_to_cpu(secd->wTotalLength);\n\tif (top - (void *)secd < needed) {\n\t\tdev_err(dev, \"BUG? Not enough data to process security \"\n\t\t\t\"descriptors (%zu bytes left vs %zu needed)\\n\",\n\t\t\ttop - (void *) secd, needed);\n\t\treturn 0;\n\t}\n\t/* Walk over the sec descriptors and store CCM1's on wusbhc */\n\titr = (void *) secd + sizeof(*secd);\n\ttop = (void *) secd + le16_to_cpu(secd->wTotalLength);\n\tindex = 0;\n\tbytes = 0;\n\twhile (itr < top) {\n\t\tetd = itr;\n\t\tif (top - itr < sizeof(*etd)) {\n\t\t\tdev_err(dev, \"BUG: bad host security descriptor; \"\n\t\t\t\t\"not enough data (%zu vs %zu left)\\n\",\n\t\t\t\ttop - itr, sizeof(*etd));\n\t\t\tbreak;\n\t\t}\n\t\tif (etd->bLength < sizeof(*etd)) {\n\t\t\tdev_err(dev, \"BUG: bad host encryption descriptor; \"\n\t\t\t\t\"descriptor is too short \"\n\t\t\t\t\"(%zu vs %zu needed)\\n\",\n\t\t\t\t(size_t)etd->bLength, sizeof(*etd));\n\t\t\tbreak;\n\t\t}\n\t\titr += etd->bLength;\n\t\tbytes += snprintf(buf + bytes, sizeof(buf) - bytes,\n\t\t\t\t \"%s (0x%02x) \",\n\t\t\t\t wusb_et_name(etd->bEncryptionType),\n\t\t\t\t etd->bEncryptionValue);\n\t\twusbhc->ccm1_etd = etd;\n\t}\n\tdev_info(dev, \"supported encryption types: %s\\n\", buf);\n\tif (wusbhc->ccm1_etd == NULL) {\n\t\tdev_err(dev, \"E: host doesn't support CCM-1 crypto\\n\");\n\t\treturn 0;\n\t}\n\t/* Pretty print what we support */\n\treturn 0;\n}\n", + "vul_type": "cwe-400", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ea3d1d84be3d6f97bf50e76511c9e26af6895533", + "input": "void WebPluginImpl::didReceiveResponse(WebURLLoader* loader,\n const WebURLResponse& response) {\n static const int kHttpPartialResponseStatusCode = 206;\n static const int kHttpResponseSuccessStatusCode = 200;\n\n WebPluginResourceClient* client = GetClientFromLoader(loader);\n if (!client)\n return;\n\n ResponseInfo response_info;\n GetResponseInfo(response, &response_info);\n\n bool request_is_seekable = true;\n if (client->IsMultiByteResponseExpected()) {\n if (response.httpStatusCode() == kHttpPartialResponseStatusCode) {\n HandleHttpMultipartResponse(response, client);\n return;\n } else if (response.httpStatusCode() == kHttpResponseSuccessStatusCode) {\n if (!ReinitializePluginForResponse(loader)) {\n NOTREACHED();\n return;\n }\n\n request_is_seekable = false;\n\n delete client;\n client = NULL;\n\n for (size_t i = 0; i < clients_.size(); ++i) {\n if (clients_[i].loader.get() == loader) {\n WebPluginResourceClient* resource_client =\n delegate_->CreateResourceClient(clients_[i].id, plugin_url_,\n false, 0, NULL);\n clients_[i].client = resource_client;\n client = resource_client;\n break;\n }\n }\n\n DCHECK(client != NULL);\n }\n }\n\n loader->setDefersLoading(true);\n\n client->DidReceiveResponse(\n response_info.mime_type,\n GetAllHeaders(response),\n response_info.expected_length,\n response_info.last_modified,\n request_is_seekable);\n\n if (WebDevToolsAgent* devtools_agent = GetDevToolsAgent()) {\n ClientInfo* client_info = GetClientInfoFromLoader(loader);\n if (client_info)\n devtools_agent->didReceiveResponse(client_info->id, response);\n }\n\n const GURL& url = response.url();\n if (url.SchemeIs(\"http\") || url.SchemeIs(\"https\")) {\n if (response.httpStatusCode() < 100 || response.httpStatusCode() >= 400) {\n ClientInfo* client_info = GetClientInfoFromLoader(loader);\n if (client_info) {\n client_info->pending_failure_notification = true;\n }\n }\n }\n}\n", + "target": "void WebPluginImpl::didReceiveResponse(WebURLLoader* loader,\n const WebURLResponse& response) {\n static const int kHttpPartialResponseStatusCode = 206;\n static const int kHttpResponseSuccessStatusCode = 200;\n\n WebPluginResourceClient* client = GetClientFromLoader(loader);\n if (!client)\n return;\n\n ResponseInfo response_info;\n GetResponseInfo(response, &response_info);\n\n bool request_is_seekable = true;\n if (client->IsMultiByteResponseExpected()) {\n if (response.httpStatusCode() == kHttpPartialResponseStatusCode) {\n HandleHttpMultipartResponse(response, client);\n return;\n } else if (response.httpStatusCode() == kHttpResponseSuccessStatusCode) {\n if (!ReinitializePluginForResponse(loader)) {\n NOTREACHED();\n return;\n }\n\n request_is_seekable = false;\n\n delete client;\n client = NULL;\n\n for (size_t i = 0; i < clients_.size(); ++i) {\n if (clients_[i].loader.get() == loader) {\n WebPluginResourceClient* resource_client =\n delegate_->CreateResourceClient(clients_[i].id, plugin_url_, 0);\n clients_[i].client = resource_client;\n client = resource_client;\n break;\n }\n }\n\n DCHECK(client != NULL);\n }\n }\n\n loader->setDefersLoading(true);\n\n client->DidReceiveResponse(\n response_info.mime_type,\n GetAllHeaders(response),\n response_info.expected_length,\n response_info.last_modified,\n request_is_seekable);\n\n if (WebDevToolsAgent* devtools_agent = GetDevToolsAgent()) {\n ClientInfo* client_info = GetClientInfoFromLoader(loader);\n if (client_info)\n devtools_agent->didReceiveResponse(client_info->id, response);\n }\n\n const GURL& url = response.url();\n if (url.SchemeIs(\"http\") || url.SchemeIs(\"https\")) {\n if (response.httpStatusCode() < 100 || response.httpStatusCode() >= 400) {\n ClientInfo* client_info = GetClientInfoFromLoader(loader);\n if (client_info) {\n client_info->pending_failure_notification = true;\n }\n }\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b3ae5db129f88dae153880e84bdabea8ce2ca89b", + "input": "LoginLibrary* CrosLibrary::GetLoginLibrary() {\n return login_lib_.GetDefaultImpl(use_stub_impl_);\n}\n", + "target": "LoginLibrary* CrosLibrary::GetLoginLibrary() {\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3c8e4852477d5b1e2da877808c998dc57db9460f", + "input": "void ServiceWorkerHandler::SetRenderer(RenderProcessHost* process_host,\n RenderFrameHostImpl* frame_host) {\n process_ = process_host;\n if (!process_host) {\n ClearForceUpdate();\n context_ = nullptr;\n return;\n }\n StoragePartition* partition = process_host->GetStoragePartition();\n DCHECK(partition);\n context_ = static_cast(\n partition->GetServiceWorkerContext());\n }\n", + "target": "void ServiceWorkerHandler::SetRenderer(RenderProcessHost* process_host,\nvoid ServiceWorkerHandler::SetRenderer(int process_host_id,\n RenderFrameHostImpl* frame_host) {\n RenderProcessHost* process_host = RenderProcessHost::FromID(process_host_id);\n if (!process_host) {\n ClearForceUpdate();\n context_ = nullptr;\n return;\n }\n\n storage_partition_ =\n static_cast(process_host->GetStoragePartition());\n DCHECK(storage_partition_);\n context_ = static_cast(\n storage_partition_->GetServiceWorkerContext());\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c32cd2069ae8062b52e5b7b1faf5936bd71a583a", + "input": "void NavigationControllerImpl::RendererDidNavigateToNewPage(\n RenderFrameHostImpl* rfh,\n const FrameHostMsg_DidCommitProvisionalLoad_Params& params,\n bool is_in_page,\n bool replace_entry,\n NavigationHandleImpl* handle) {\n std::unique_ptr new_entry;\n bool update_virtual_url = false;\n\n if (is_in_page && GetLastCommittedEntry()) {\n FrameNavigationEntry* frame_entry = new FrameNavigationEntry(\n params.frame_unique_name, params.item_sequence_number,\n params.document_sequence_number, rfh->GetSiteInstance(), nullptr,\n params.url, params.referrer, params.method, params.post_id);\n new_entry = GetLastCommittedEntry()->CloneAndReplace(\n frame_entry, true, rfh->frame_tree_node(),\n delegate_->GetFrameTree()->root());\n\n CHECK(frame_entry->HasOneRef());\n \n update_virtual_url = new_entry->update_virtual_url_with_url();\n }\n \n if (!new_entry &&\n PendingEntryMatchesHandle(handle) && pending_entry_index_ == -1 &&\n (!pending_entry_->site_instance() ||\n pending_entry_->site_instance() == rfh->GetSiteInstance())) {\n new_entry = pending_entry_->Clone();\n\n update_virtual_url = new_entry->update_virtual_url_with_url();\n new_entry->GetSSL() = handle->ssl_status();\n }\n\n if (!new_entry) {\n new_entry = base::WrapUnique(new NavigationEntryImpl);\n\n GURL url = params.url;\n bool needs_update = false;\n BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary(\n &url, browser_context_, &needs_update);\n new_entry->set_update_virtual_url_with_url(needs_update);\n\n update_virtual_url = needs_update;\n new_entry->GetSSL() = handle->ssl_status();\n }\n\n new_entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR\n : PAGE_TYPE_NORMAL);\n new_entry->SetURL(params.url);\n if (update_virtual_url)\n UpdateVirtualURLToURL(new_entry.get(), params.url);\n new_entry->SetReferrer(params.referrer);\n new_entry->SetTransitionType(params.transition);\n new_entry->set_site_instance(\n static_cast(rfh->GetSiteInstance()));\n new_entry->SetOriginalRequestURL(params.original_request_url);\n new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent);\n\n FrameNavigationEntry* frame_entry =\n new_entry->GetFrameEntry(rfh->frame_tree_node());\n frame_entry->set_frame_unique_name(params.frame_unique_name);\n frame_entry->set_item_sequence_number(params.item_sequence_number);\n frame_entry->set_document_sequence_number(params.document_sequence_number);\n frame_entry->set_method(params.method);\n frame_entry->set_post_id(params.post_id);\n\n if (is_in_page && GetLastCommittedEntry()) {\n new_entry->SetTitle(GetLastCommittedEntry()->GetTitle());\n new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon();\n }\n\n DCHECK(!params.history_list_was_cleared || !replace_entry);\n if (params.history_list_was_cleared) {\n DiscardNonCommittedEntriesInternal();\n entries_.clear();\n last_committed_entry_index_ = -1;\n }\n\n InsertOrReplaceEntry(std::move(new_entry), replace_entry);\n}\n", + "target": "void NavigationControllerImpl::RendererDidNavigateToNewPage(\n RenderFrameHostImpl* rfh,\n const FrameHostMsg_DidCommitProvisionalLoad_Params& params,\n bool is_in_page,\n bool replace_entry,\n NavigationHandleImpl* handle) {\n std::unique_ptr new_entry;\n bool update_virtual_url = false;\n\n if (is_in_page && GetLastCommittedEntry()) {\n FrameNavigationEntry* frame_entry = new FrameNavigationEntry(\n params.frame_unique_name, params.item_sequence_number,\n params.document_sequence_number, rfh->GetSiteInstance(), nullptr,\n params.url, params.referrer, params.method, params.post_id);\n new_entry = GetLastCommittedEntry()->CloneAndReplace(\n frame_entry, true, rfh->frame_tree_node(),\n delegate_->GetFrameTree()->root());\n\n CHECK(frame_entry->HasOneRef());\n \n update_virtual_url = new_entry->update_virtual_url_with_url();\n\n MaybeDumpCopiedNonSameOriginEntry(\"New page navigation\", params, is_in_page,\n GetLastCommittedEntry());\n }\n \n if (!new_entry &&\n PendingEntryMatchesHandle(handle) && pending_entry_index_ == -1 &&\n (!pending_entry_->site_instance() ||\n pending_entry_->site_instance() == rfh->GetSiteInstance())) {\n new_entry = pending_entry_->Clone();\n\n update_virtual_url = new_entry->update_virtual_url_with_url();\n new_entry->GetSSL() = handle->ssl_status();\n }\n\n if (!new_entry) {\n new_entry = base::WrapUnique(new NavigationEntryImpl);\n\n GURL url = params.url;\n bool needs_update = false;\n BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary(\n &url, browser_context_, &needs_update);\n new_entry->set_update_virtual_url_with_url(needs_update);\n\n update_virtual_url = needs_update;\n new_entry->GetSSL() = handle->ssl_status();\n }\n\n new_entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR\n : PAGE_TYPE_NORMAL);\n new_entry->SetURL(params.url);\n if (update_virtual_url)\n UpdateVirtualURLToURL(new_entry.get(), params.url);\n new_entry->SetReferrer(params.referrer);\n new_entry->SetTransitionType(params.transition);\n new_entry->set_site_instance(\n static_cast(rfh->GetSiteInstance()));\n new_entry->SetOriginalRequestURL(params.original_request_url);\n new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent);\n\n FrameNavigationEntry* frame_entry =\n new_entry->GetFrameEntry(rfh->frame_tree_node());\n frame_entry->set_frame_unique_name(params.frame_unique_name);\n frame_entry->set_item_sequence_number(params.item_sequence_number);\n frame_entry->set_document_sequence_number(params.document_sequence_number);\n frame_entry->set_method(params.method);\n frame_entry->set_post_id(params.post_id);\n\n if (is_in_page && GetLastCommittedEntry()) {\n new_entry->SetTitle(GetLastCommittedEntry()->GetTitle());\n new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon();\n }\n\n DCHECK(!params.history_list_was_cleared || !replace_entry);\n if (params.history_list_was_cleared) {\n DiscardNonCommittedEntriesInternal();\n entries_.clear();\n last_committed_entry_index_ = -1;\n }\n\n InsertOrReplaceEntry(std::move(new_entry), replace_entry);\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e139b87835994d007fbd64eead6c1455d7b8cf4e", + "input": "int main(int argc, char *argv[])\n{\n char buff[1024];\n int fd, nr, nw;\n if (argc < 2) {\n fprintf(stderr,\n \"usage: %s output-filename\\n\"\n \" %s |output-command\\n\"\n \" %s :host:port\\n\", argv[0], argv[0], argv[0]);\n return 1;\n }\n fd = open_gen_fd(argv[1]);\n if (fd < 0) {\n perror(\"open_gen_fd\");\n exit(EXIT_FAILURE);\n }\n while ((nr = read(0, buff, sizeof (buff))) != 0) {\n if (nr < 0) {\n if (errno == EINTR)\n continue;\n perror(\"read\");\n exit(EXIT_FAILURE);\n }\n nw = write(fd, buff, nr);\n if (nw < 0) {\n perror(\"write\");\n exit(EXIT_FAILURE);\n }\n }\n return 0;\n }\n", + "target": "int main(int argc, char *argv[])\n{\n char buff[1024];\n int fd, nr, nw;\n if (argc < 2) {\n fprintf(stderr,\n \"usage: %s output-filename\\n\"\n \" %s |output-command\\n\"\n \" %s :host:port\\n\", argv[0], argv[0], argv[0]);\n return 1;\n }\n fd = open_gen_fd(argv[1]);\n if (fd < 0) {\n perror(\"open_gen_fd\");\n exit(EXIT_FAILURE);\n }\n while ((nr = read(0, buff, sizeof (buff))) != 0) {\n if (nr < 0) {\n if (errno == EINTR)\n continue;\n perror(\"read\");\n exit(EXIT_FAILURE);\n }\n nw = write(fd, buff, nr);\n if (nw < 0) {\n perror(\"write\");\n exit(EXIT_FAILURE);\n }\n }\n\tclose(fd);\n return 0;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#16dcd30c215801941d9890859fd79a234128fc3e", + "input": " void CleanUp(DownloadId id) {\n MockDownloadFile* file = download_file_factory_->GetExistingFile(id);\n ASSERT_TRUE(file != NULL);\n\n EXPECT_CALL(*file, Cancel());\n \n download_file_manager_->CancelDownload(id);\n \n EXPECT_TRUE(NULL == download_file_manager_->GetDownloadFile(id));\n }\n", + "target": " void CleanUp(DownloadId id) {\n MockDownloadFile* file = download_file_factory_->GetExistingFile(id);\n ASSERT_TRUE(file != NULL);\n\n EXPECT_CALL(*file, Cancel());\n \n download_file_manager_->CancelDownload(id);\n \n EXPECT_EQ(NULL, download_file_manager_->GetDownloadFile(id));\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5ec24a2642bd0854b884d1a9b51d12371373b410", + "input": "lrmd_remote_client_msg(gpointer data)\n{\n int id = 0;\n int rc = 0;\n int disconnected = 0;\n xmlNode *request = NULL;\n crm_client_t *client = data;\n\n if (client->remote->tls_handshake_complete == FALSE) {\n int rc = 0;\n\n /* Muliple calls to handshake will be required, this callback\n * will be invoked once the client sends more handshake data. */\n do {\n rc = gnutls_handshake(*client->remote->tls_session);\n\n if (rc < 0 && rc != GNUTLS_E_AGAIN) {\n crm_err(\"Remote lrmd tls handshake failed\");\n return -1;\n }\n } while (rc == GNUTLS_E_INTERRUPTED);\n\n if (rc == 0) {\n crm_debug(\"Remote lrmd tls handshake completed\");\n client->remote->tls_handshake_complete = TRUE;\n if (client->remote->auth_timeout) {\n g_source_remove(client->remote->auth_timeout);\n }\n client->remote->auth_timeout = 0;\n }\n return 0;\n }\n\n rc = crm_remote_ready(client->remote, 0);\n if (rc == 0) {\n /* no msg to read */\n return 0;\n } else if (rc < 0) {\n crm_info(\"Client disconnected during remote client read\");\n return -1;\n }\n\n crm_remote_recv(client->remote, -1, &disconnected);\n\n request = crm_remote_parse_buffer(client->remote);\n while (request) {\n crm_element_value_int(request, F_LRMD_REMOTE_MSG_ID, &id);\n crm_trace(\"processing request from remote client with remote msg id %d\", id);\n if (!client->name) {\n const char *value = crm_element_value(request, F_LRMD_CLIENTNAME);\n\n if (value) {\n client->name = strdup(value);\n }\n }\n\n lrmd_call_id++;\n if (lrmd_call_id < 1) {\n lrmd_call_id = 1;\n }\n\n crm_xml_add(request, F_LRMD_CLIENTID, client->id);\n crm_xml_add(request, F_LRMD_CLIENTNAME, client->name);\n crm_xml_add_int(request, F_LRMD_CALLID, lrmd_call_id);\n\n process_lrmd_message(client, id, request);\n free_xml(request);\n\n /* process all the messages in the current buffer */\n request = crm_remote_parse_buffer(client->remote);\n }\n\n if (disconnected) {\n crm_info(\"Client disconnect detected in tls msg dispatcher.\");\n return -1;\n }\n\n return 0;\n}\n", + "target": "lrmd_remote_client_msg(gpointer data)\n{\n int id = 0;\n int rc = 0;\n int disconnected = 0;\n xmlNode *request = NULL;\n crm_client_t *client = data;\n\n if (client->remote->tls_handshake_complete == FALSE) {\n int rc = 0;\n\n /* Muliple calls to handshake will be required, this callback\n * will be invoked once the client sends more handshake data. */\n do {\n rc = gnutls_handshake(*client->remote->tls_session);\n\n if (rc < 0 && rc != GNUTLS_E_AGAIN) {\n crm_err(\"Remote lrmd tls handshake failed\");\n return -1;\n }\n } while (rc == GNUTLS_E_INTERRUPTED);\n\n if (rc == 0) {\n crm_debug(\"Remote lrmd tls handshake completed\");\n client->remote->tls_handshake_complete = TRUE;\n if (client->remote->auth_timeout) {\n g_source_remove(client->remote->auth_timeout);\n }\n client->remote->auth_timeout = 0;\n\n /* Alert other clients of the new connection */\n notify_of_new_client(client);\n }\n return 0;\n }\n\n rc = crm_remote_ready(client->remote, 0);\n if (rc == 0) {\n /* no msg to read */\n return 0;\n } else if (rc < 0) {\n crm_info(\"Client disconnected during remote client read\");\n return -1;\n }\n\n crm_remote_recv(client->remote, -1, &disconnected);\n\n request = crm_remote_parse_buffer(client->remote);\n while (request) {\n crm_element_value_int(request, F_LRMD_REMOTE_MSG_ID, &id);\n crm_trace(\"processing request from remote client with remote msg id %d\", id);\n if (!client->name) {\n const char *value = crm_element_value(request, F_LRMD_CLIENTNAME);\n\n if (value) {\n client->name = strdup(value);\n }\n }\n\n lrmd_call_id++;\n if (lrmd_call_id < 1) {\n lrmd_call_id = 1;\n }\n\n crm_xml_add(request, F_LRMD_CLIENTID, client->id);\n crm_xml_add(request, F_LRMD_CLIENTNAME, client->name);\n crm_xml_add_int(request, F_LRMD_CALLID, lrmd_call_id);\n\n process_lrmd_message(client, id, request);\n free_xml(request);\n\n /* process all the messages in the current buffer */\n request = crm_remote_parse_buffer(client->remote);\n }\n\n if (disconnected) {\n crm_info(\"Client disconnect detected in tls msg dispatcher.\");\n return -1;\n }\n\n return 0;\n}\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f81038006b4c59a5a148dcad887371206033c28f", + "input": "status_t NuPlayer::GenericSource::initFromDataSource() {\n sp extractor;\n String8 mimeType;\n float confidence;\n sp dummy;\n bool isWidevineStreaming = false;\n\n CHECK(mDataSource != NULL);\n\n if (mIsWidevine) {\n isWidevineStreaming = SniffWVM(\n mDataSource, &mimeType, &confidence, &dummy);\n if (!isWidevineStreaming ||\n strcasecmp(\n mimeType.string(), MEDIA_MIMETYPE_CONTAINER_WVM)) {\n ALOGE(\"unsupported widevine mime: %s\", mimeType.string());\n return UNKNOWN_ERROR;\n }\n } else if (mIsStreaming) {\n if (!mDataSource->sniff(&mimeType, &confidence, &dummy)) {\n return UNKNOWN_ERROR;\n }\n isWidevineStreaming = !strcasecmp(\n mimeType.string(), MEDIA_MIMETYPE_CONTAINER_WVM);\n }\n\n if (isWidevineStreaming) {\n mCachedSource.clear();\n mDataSource = mHttpSource;\n mWVMExtractor = new WVMExtractor(mDataSource);\n mWVMExtractor->setAdaptiveStreamingMode(true);\n if (mUIDValid) {\n mWVMExtractor->setUID(mUID);\n }\n extractor = mWVMExtractor;\n } else {\n extractor = MediaExtractor::Create(mDataSource,\n mimeType.isEmpty() ? NULL : mimeType.string());\n }\n\n if (extractor == NULL) {\n return UNKNOWN_ERROR;\n }\n\n if (extractor->getDrmFlag()) {\n checkDrmStatus(mDataSource);\n }\n\n mFileMeta = extractor->getMetaData();\n if (mFileMeta != NULL) {\n int64_t duration;\n if (mFileMeta->findInt64(kKeyDuration, &duration)) {\n mDurationUs = duration;\n }\n\n if (!mIsWidevine) {\n const char *fileMime;\n if (mFileMeta->findCString(kKeyMIMEType, &fileMime)\n && !strncasecmp(fileMime, \"video/wvm\", 9)) {\n mIsWidevine = true;\n }\n }\n }\n\n int32_t totalBitrate = 0;\n\n size_t numtracks = extractor->countTracks();\n if (numtracks == 0) {\n return UNKNOWN_ERROR;\n }\n\n \n for (size_t i = 0; i < numtracks; ++i) {\n sp track = extractor->getTrack(i);\n \n sp meta = extractor->getTrackMetaData(i);\n \n const char *mime;\n CHECK(meta->findCString(kKeyMIMEType, &mime));\n\n if (!strncasecmp(mime, \"audio/\", 6)) {\n if (mAudioTrack.mSource == NULL) {\n mAudioTrack.mIndex = i;\n mAudioTrack.mSource = track;\n mAudioTrack.mPackets =\n new AnotherPacketSource(mAudioTrack.mSource->getFormat());\n\n if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_VORBIS)) {\n mAudioIsVorbis = true;\n } else {\n mAudioIsVorbis = false;\n }\n }\n } else if (!strncasecmp(mime, \"video/\", 6)) {\n if (mVideoTrack.mSource == NULL) {\n mVideoTrack.mIndex = i;\n mVideoTrack.mSource = track;\n mVideoTrack.mPackets =\n new AnotherPacketSource(mVideoTrack.mSource->getFormat());\n\n int32_t secure;\n if (meta->findInt32(kKeyRequiresSecureBuffers, &secure)\n && secure) {\n mIsSecure = true;\n if (mUIDValid) {\n extractor->setUID(mUID);\n }\n }\n\n }\n }\n \n if (track != NULL) {\n mSources.push(track);\n int64_t durationUs;\n if (meta->findInt64(kKeyDuration, &durationUs)) {\n if (durationUs > mDurationUs) {\n mDurationUs = durationUs;\n }\n }\n int32_t bitrate;\n if (totalBitrate >= 0 && meta->findInt32(kKeyBitRate, &bitrate)) {\n totalBitrate += bitrate;\n } else {\n totalBitrate = -1;\n }\n }\n }\n \n mBitrate = totalBitrate;\n\n return OK;\n}\n", + "target": "status_t NuPlayer::GenericSource::initFromDataSource() {\n sp extractor;\n String8 mimeType;\n float confidence;\n sp dummy;\n bool isWidevineStreaming = false;\n\n CHECK(mDataSource != NULL);\n\n if (mIsWidevine) {\n isWidevineStreaming = SniffWVM(\n mDataSource, &mimeType, &confidence, &dummy);\n if (!isWidevineStreaming ||\n strcasecmp(\n mimeType.string(), MEDIA_MIMETYPE_CONTAINER_WVM)) {\n ALOGE(\"unsupported widevine mime: %s\", mimeType.string());\n return UNKNOWN_ERROR;\n }\n } else if (mIsStreaming) {\n if (!mDataSource->sniff(&mimeType, &confidence, &dummy)) {\n return UNKNOWN_ERROR;\n }\n isWidevineStreaming = !strcasecmp(\n mimeType.string(), MEDIA_MIMETYPE_CONTAINER_WVM);\n }\n\n if (isWidevineStreaming) {\n mCachedSource.clear();\n mDataSource = mHttpSource;\n mWVMExtractor = new WVMExtractor(mDataSource);\n mWVMExtractor->setAdaptiveStreamingMode(true);\n if (mUIDValid) {\n mWVMExtractor->setUID(mUID);\n }\n extractor = mWVMExtractor;\n } else {\n extractor = MediaExtractor::Create(mDataSource,\n mimeType.isEmpty() ? NULL : mimeType.string());\n }\n\n if (extractor == NULL) {\n return UNKNOWN_ERROR;\n }\n\n if (extractor->getDrmFlag()) {\n checkDrmStatus(mDataSource);\n }\n\n mFileMeta = extractor->getMetaData();\n if (mFileMeta != NULL) {\n int64_t duration;\n if (mFileMeta->findInt64(kKeyDuration, &duration)) {\n mDurationUs = duration;\n }\n\n if (!mIsWidevine) {\n const char *fileMime;\n if (mFileMeta->findCString(kKeyMIMEType, &fileMime)\n && !strncasecmp(fileMime, \"video/wvm\", 9)) {\n mIsWidevine = true;\n }\n }\n }\n\n int32_t totalBitrate = 0;\n\n size_t numtracks = extractor->countTracks();\n if (numtracks == 0) {\n return UNKNOWN_ERROR;\n }\n\n \n for (size_t i = 0; i < numtracks; ++i) {\n sp track = extractor->getTrack(i);\n if (track == NULL) {\n continue;\n }\n \n sp meta = extractor->getTrackMetaData(i);\n \n const char *mime;\n CHECK(meta->findCString(kKeyMIMEType, &mime));\n\n if (!strncasecmp(mime, \"audio/\", 6)) {\n if (mAudioTrack.mSource == NULL) {\n mAudioTrack.mIndex = i;\n mAudioTrack.mSource = track;\n mAudioTrack.mPackets =\n new AnotherPacketSource(mAudioTrack.mSource->getFormat());\n\n if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_VORBIS)) {\n mAudioIsVorbis = true;\n } else {\n mAudioIsVorbis = false;\n }\n }\n } else if (!strncasecmp(mime, \"video/\", 6)) {\n if (mVideoTrack.mSource == NULL) {\n mVideoTrack.mIndex = i;\n mVideoTrack.mSource = track;\n mVideoTrack.mPackets =\n new AnotherPacketSource(mVideoTrack.mSource->getFormat());\n\n int32_t secure;\n if (meta->findInt32(kKeyRequiresSecureBuffers, &secure)\n && secure) {\n mIsSecure = true;\n if (mUIDValid) {\n extractor->setUID(mUID);\n }\n }\n\n }\n }\n \n mSources.push(track);\n int64_t durationUs;\n if (meta->findInt64(kKeyDuration, &durationUs)) {\n if (durationUs > mDurationUs) {\n mDurationUs = durationUs;\n }\n }\n\n int32_t bitrate;\n if (totalBitrate >= 0 && meta->findInt32(kKeyBitRate, &bitrate)) {\n totalBitrate += bitrate;\n } else {\n totalBitrate = -1;\n }\n }\n\n if (mSources.size() == 0) {\n ALOGE(\"b/23705695\");\n return UNKNOWN_ERROR;\n }\n \n mBitrate = totalBitrate;\n\n return OK;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d4cd2b2c0953ad7e9fa988c234eb9361be80fe81", + "input": "void InspectorPageAgent::setShowFPSCounter(ErrorString*, bool show)\n{\n bool viewMetricsOverride = m_state->getLong(PageAgentState::pageAgentScreenWidthOverride);\n m_state->setBoolean(PageAgentState::pageAgentShowFPSCounter, show);\n m_client->setShowFPSCounter(show && !viewMetricsOverride);\n updateOverridesTopOffset();\n }\n", + "target": "void InspectorPageAgent::setShowFPSCounter(ErrorString*, bool show)\n{\n bool viewMetricsOverride = m_state->getLong(PageAgentState::pageAgentScreenWidthOverride);\n m_state->setBoolean(PageAgentState::pageAgentShowFPSCounter, show);\n m_client->setShowFPSCounter(show && !viewMetricsOverride);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fad67a5b73639d7211b24fd9bdb242e82039b765", + "input": "bool ImageResource::IsAccessAllowed(\n const SecurityOrigin* security_origin,\n ImageResourceInfo::DoesCurrentFrameHaveSingleSecurityOrigin\n does_current_frame_has_single_security_origin) const {\n if (GetCORSStatus() == CORSStatus::kServiceWorkerOpaque)\n return false;\n \n if (does_current_frame_has_single_security_origin !=\n ImageResourceInfo::kHasSingleSecurityOrigin)\n return false;\n \n if (IsSameOriginOrCORSSuccessful())\n return true;\n \n return !security_origin->TaintsCanvas(GetResponse().Url());\n}\n", + "target": "bool ImageResource::IsAccessAllowed(\n const SecurityOrigin* security_origin,\n ImageResourceInfo::DoesCurrentFrameHaveSingleSecurityOrigin\n does_current_frame_has_single_security_origin) const {\n if (GetResponse().WasFetchedViaServiceWorker())\n return GetCORSStatus() != CORSStatus::kServiceWorkerOpaque;\n \n if (does_current_frame_has_single_security_origin !=\n ImageResourceInfo::kHasSingleSecurityOrigin)\n return false;\n \n DCHECK(security_origin);\n if (PassesAccessControlCheck(*security_origin))\n return true;\n \n return !security_origin->TaintsCanvas(GetResponse().Url());\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#124d3b7041f9a0ca7c43a6293e1cae4576c32fd5", + "input": "static void __iov_iter_advance_iov(struct iov_iter *i, size_t bytes)\n{\n\tif (likely(i->nr_segs == 1)) {\n\t\ti->iov_offset += bytes;\n\t} else {\n \t\tconst struct iovec *iov = i->iov;\n \t\tsize_t base = i->iov_offset;\n \n\t\twhile (bytes) {\n \t\t\tint copy = min(bytes, iov->iov_len - base);\n \n \t\t\tbytes -= copy;\n\t\t\tbase += copy;\n\t\t\tif (iov->iov_len == base) {\n\t\t\t\tiov++;\n\t\t\t\tbase = 0;\n\t\t\t}\n\t\t}\n\t\ti->iov = iov;\n\t\ti->iov_offset = base;\n\t}\n}\n", + "target": "static void __iov_iter_advance_iov(struct iov_iter *i, size_t bytes)\n{\n\tif (likely(i->nr_segs == 1)) {\n\t\ti->iov_offset += bytes;\n\t} else {\n \t\tconst struct iovec *iov = i->iov;\n \t\tsize_t base = i->iov_offset;\n \n\t\t/*\n\t\t * The !iov->iov_len check ensures we skip over unlikely\n\t\t * zero-length segments.\n\t\t */\n\t\twhile (bytes || !iov->iov_len) {\n \t\t\tint copy = min(bytes, iov->iov_len - base);\n \n \t\t\tbytes -= copy;\n\t\t\tbase += copy;\n\t\t\tif (iov->iov_len == base) {\n\t\t\t\tiov++;\n\t\t\t\tbase = 0;\n\t\t\t}\n\t\t}\n\t\ti->iov = iov;\n\t\ti->iov_offset = base;\n\t}\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#71b3c126e61177eb693423f2e18a1914205b165e", + "input": "void flush_tlb_page(struct vm_area_struct *vma, unsigned long start)\n{\n\tstruct mm_struct *mm = vma->vm_mm;\n\n \tpreempt_disable();\n \n \tif (current->active_mm == mm) {\n\t\tif (current->mm)\n \t\t\t__flush_tlb_one(start);\n\t\telse\n \t\t\tleave_mm(smp_processor_id());\n \t}\n \n \tif (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids)\n\t\tflush_tlb_others(mm_cpumask(mm), mm, start, 0UL);\n\n\tpreempt_enable();\n}\n", + "target": "void flush_tlb_page(struct vm_area_struct *vma, unsigned long start)\n{\n\tstruct mm_struct *mm = vma->vm_mm;\n\n \tpreempt_disable();\n \n \tif (current->active_mm == mm) {\n\t\tif (current->mm) {\n\t\t\t/*\n\t\t\t * Implicit full barrier (INVLPG) that synchronizes\n\t\t\t * with switch_mm.\n\t\t\t */\n \t\t\t__flush_tlb_one(start);\n\t\t} else {\n \t\t\tleave_mm(smp_processor_id());\n\n\t\t\t/* Synchronize with switch_mm. */\n\t\t\tsmp_mb();\n\t\t}\n \t}\n \n \tif (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids)\n\t\tflush_tlb_others(mm_cpumask(mm), mm, start, 0UL);\n\n\tpreempt_enable();\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#701ab8129ba9ea64f569daedca9a8603abad740f", + "input": "file_transfer_t *imcb_file_send_start(struct im_connection *ic, char *handle, char *file_name, size_t file_size)\n{\n \tbee_t *bee = ic->bee;\n \tbee_user_t *bu = bee_user_by_handle(bee, ic, handle);\n \n\tif (bee->ui->ft_in_start) {\n \t\treturn bee->ui->ft_in_start(bee, bu, file_name, file_size);\n \t} else {\n \t\treturn NULL;\n\t}\n}\n", + "target": "file_transfer_t *imcb_file_send_start(struct im_connection *ic, char *handle, char *file_name, size_t file_size)\n{\n \tbee_t *bee = ic->bee;\n \tbee_user_t *bu = bee_user_by_handle(bee, ic, handle);\n \n\tif (bee->ui->ft_in_start && bu) {\n \t\treturn bee->ui->ft_in_start(bee, bu, file_name, file_size);\n \t} else {\n \t\treturn NULL;\n\t}\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#df7e40425813c50cd252e6f5e348a81ef1acae56", + "input": "static struct ib_ucontext *hns_roce_alloc_ucontext(struct ib_device *ib_dev,\n\t\t\t\t\t\t struct ib_udata *udata)\n {\n \tint ret = 0;\n \tstruct hns_roce_ucontext *context;\n\tstruct hns_roce_ib_alloc_ucontext_resp resp;\n \tstruct hns_roce_dev *hr_dev = to_hr_dev(ib_dev);\n \n \tresp.qp_tab_size = hr_dev->caps.num_qps;\n\n\tcontext = kmalloc(sizeof(*context), GFP_KERNEL);\n\tif (!context)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tret = hns_roce_uar_alloc(hr_dev, &context->uar);\n\tif (ret)\n\t\tgoto error_fail_uar_alloc;\n\n\tif (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) {\n\t\tINIT_LIST_HEAD(&context->page_list);\n\t\tmutex_init(&context->page_mutex);\n\t}\n\n\tret = ib_copy_to_udata(udata, &resp, sizeof(resp));\n\tif (ret)\n\t\tgoto error_fail_copy_to_udata;\n\n\treturn &context->ibucontext;\n\nerror_fail_copy_to_udata:\n\thns_roce_uar_free(hr_dev, &context->uar);\n\nerror_fail_uar_alloc:\n\tkfree(context);\n\n\treturn ERR_PTR(ret);\n}\n", + "target": "static struct ib_ucontext *hns_roce_alloc_ucontext(struct ib_device *ib_dev,\n\t\t\t\t\t\t struct ib_udata *udata)\n {\n \tint ret = 0;\n \tstruct hns_roce_ucontext *context;\n\tstruct hns_roce_ib_alloc_ucontext_resp resp = {};\n \tstruct hns_roce_dev *hr_dev = to_hr_dev(ib_dev);\n \n \tresp.qp_tab_size = hr_dev->caps.num_qps;\n\n\tcontext = kmalloc(sizeof(*context), GFP_KERNEL);\n\tif (!context)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tret = hns_roce_uar_alloc(hr_dev, &context->uar);\n\tif (ret)\n\t\tgoto error_fail_uar_alloc;\n\n\tif (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) {\n\t\tINIT_LIST_HEAD(&context->page_list);\n\t\tmutex_init(&context->page_mutex);\n\t}\n\n\tret = ib_copy_to_udata(udata, &resp, sizeof(resp));\n\tif (ret)\n\t\tgoto error_fail_copy_to_udata;\n\n\treturn &context->ibucontext;\n\nerror_fail_copy_to_udata:\n\thns_roce_uar_free(hr_dev, &context->uar);\n\nerror_fail_uar_alloc:\n\tkfree(context);\n\n\treturn ERR_PTR(ret);\n}\n", + "vul_type": "cwe-665", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#94f1bb15bed84ad6c893916b7e7b9db6f1d7eec6", + "input": " static unsigned int seedsize(struct crypto_alg *alg)\n {\n \tstruct rng_alg *ralg = container_of(alg, struct rng_alg, base);\n \n\treturn alg->cra_rng.rng_make_random ?\n\t alg->cra_rng.seedsize : ralg->seedsize;\n }\n", + "target": " static unsigned int seedsize(struct crypto_alg *alg)\n {\n \tstruct rng_alg *ralg = container_of(alg, struct rng_alg, base);\n \n\treturn ralg->seedsize;\n }\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#070c4b92b8cd5390889716677a0b92444d6e087a", + "input": "static void mcf_fec_do_tx(mcf_fec_state *s)\n{\n uint32_t addr;\n uint32_t addr;\n mcf_fec_bd bd;\n int frame_size;\n int len;\n uint8_t frame[FEC_MAX_FRAME_SIZE];\n uint8_t *ptr;\n \n ptr = frame;\n ptr = frame;\n frame_size = 0;\n addr = s->tx_descriptor;\n while (1) {\n mcf_fec_read_bd(&bd, addr);\n DPRINTF(\"tx_bd %x flags %04x len %d data %08x\\n\",\n addr, bd.flags, bd.length, bd.data);\n /* Run out of descriptors to transmit. */\n break;\n }\n len = bd.length;\n if (frame_size + len > FEC_MAX_FRAME_SIZE) {\n len = FEC_MAX_FRAME_SIZE - frame_size;\n s->eir |= FEC_INT_BABT;\n }\n cpu_physical_memory_read(bd.data, ptr, len);\n ptr += len;\n frame_size += len;\n if (bd.flags & FEC_BD_L) {\n /* Last buffer in frame. */\n DPRINTF(\"Sending packet\\n\");\n qemu_send_packet(qemu_get_queue(s->nic), frame, len);\n ptr = frame;\n frame_size = 0;\n s->eir |= FEC_INT_TXF;\n }\n s->eir |= FEC_INT_TXB;\n bd.flags &= ~FEC_BD_R;\n /* Write back the modified descriptor. */\n mcf_fec_write_bd(&bd, addr);\n /* Advance to the next descriptor. */\n if ((bd.flags & FEC_BD_W) != 0) {\n addr = s->etdsr;\n } else {\n addr += 8;\n }\n }\n", + "target": "static void mcf_fec_do_tx(mcf_fec_state *s)\n{\n uint32_t addr;\n uint32_t addr;\n mcf_fec_bd bd;\n int frame_size;\n int len, descnt = 0;\n uint8_t frame[FEC_MAX_FRAME_SIZE];\n uint8_t *ptr;\n \n ptr = frame;\n ptr = frame;\n frame_size = 0;\n addr = s->tx_descriptor;\n while (descnt++ < FEC_MAX_DESC) {\n mcf_fec_read_bd(&bd, addr);\n DPRINTF(\"tx_bd %x flags %04x len %d data %08x\\n\",\n addr, bd.flags, bd.length, bd.data);\n /* Run out of descriptors to transmit. */\n break;\n }\n len = bd.length;\n if (frame_size + len > FEC_MAX_FRAME_SIZE) {\n len = FEC_MAX_FRAME_SIZE - frame_size;\n s->eir |= FEC_INT_BABT;\n }\n cpu_physical_memory_read(bd.data, ptr, len);\n ptr += len;\n frame_size += len;\n if (bd.flags & FEC_BD_L) {\n /* Last buffer in frame. */\n DPRINTF(\"Sending packet\\n\");\n qemu_send_packet(qemu_get_queue(s->nic), frame, len);\n ptr = frame;\n frame_size = 0;\n s->eir |= FEC_INT_TXF;\n }\n s->eir |= FEC_INT_TXB;\n bd.flags &= ~FEC_BD_R;\n /* Write back the modified descriptor. */\n mcf_fec_write_bd(&bd, addr);\n /* Advance to the next descriptor. */\n if ((bd.flags & FEC_BD_W) != 0) {\n addr = s->etdsr;\n } else {\n addr += 8;\n }\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a8b0ca17b80e92faab46ee7179ba9e99ccb61233", + "input": "static int __perf_event_overflow(struct perf_event *event, int nmi,\n \t\t\t\t int throttle, struct perf_sample_data *data,\n \t\t\t\t struct pt_regs *regs)\n {\n\tint events = atomic_read(&event->event_limit);\n\tstruct hw_perf_event *hwc = &event->hw;\n\tint ret = 0;\n\n\t/*\n\t * Non-sampling counters might still use the PMI to fold short\n\t * hardware counters, ignore those.\n\t */\n\tif (unlikely(!is_sampling_event(event)))\n\t\treturn 0;\n\n\tif (unlikely(hwc->interrupts >= max_samples_per_tick)) {\n\t\tif (throttle) {\n\t\t\thwc->interrupts = MAX_INTERRUPTS;\n\t\t\tperf_log_throttle(event, 0);\n\t\t\tret = 1;\n\t\t}\n\t} else\n\t\thwc->interrupts++;\n\n\tif (event->attr.freq) {\n\t\tu64 now = perf_clock();\n\t\ts64 delta = now - hwc->freq_time_stamp;\n\n\t\thwc->freq_time_stamp = now;\n\n\t\tif (delta > 0 && delta < 2*TICK_NSEC)\n\t\t\tperf_adjust_period(event, delta, hwc->last_period);\n\t}\n\n\t/*\n\t * XXX event_limit might not quite work as expected on inherited\n\t * events\n\t */\n\n\tevent->pending_kill = POLL_IN;\n \tif (events && atomic_dec_and_test(&event->event_limit)) {\n \t\tret = 1;\n \t\tevent->pending_kill = POLL_HUP;\n\t\tif (nmi) {\n\t\t\tevent->pending_disable = 1;\n\t\t\tirq_work_queue(&event->pending);\n\t\t} else\n\t\t\tperf_event_disable(event);\n \t}\n \n \tif (event->overflow_handler)\n\t\tevent->overflow_handler(event, nmi, data, regs);\n \telse\n\t\tperf_event_output(event, nmi, data, regs);\n \n \tif (event->fasync && event->pending_kill) {\n\t\tif (nmi) {\n\t\t\tevent->pending_wakeup = 1;\n\t\t\tirq_work_queue(&event->pending);\n\t\t} else\n\t\t\tperf_event_wakeup(event);\n \t}\n \n \treturn ret;\n }\n", + "target": "static int __perf_event_overflow(struct perf_event *event, int nmi,\nstatic int __perf_event_overflow(struct perf_event *event,\n \t\t\t\t int throttle, struct perf_sample_data *data,\n \t\t\t\t struct pt_regs *regs)\n {\n\tint events = atomic_read(&event->event_limit);\n\tstruct hw_perf_event *hwc = &event->hw;\n\tint ret = 0;\n\n\t/*\n\t * Non-sampling counters might still use the PMI to fold short\n\t * hardware counters, ignore those.\n\t */\n\tif (unlikely(!is_sampling_event(event)))\n\t\treturn 0;\n\n\tif (unlikely(hwc->interrupts >= max_samples_per_tick)) {\n\t\tif (throttle) {\n\t\t\thwc->interrupts = MAX_INTERRUPTS;\n\t\t\tperf_log_throttle(event, 0);\n\t\t\tret = 1;\n\t\t}\n\t} else\n\t\thwc->interrupts++;\n\n\tif (event->attr.freq) {\n\t\tu64 now = perf_clock();\n\t\ts64 delta = now - hwc->freq_time_stamp;\n\n\t\thwc->freq_time_stamp = now;\n\n\t\tif (delta > 0 && delta < 2*TICK_NSEC)\n\t\t\tperf_adjust_period(event, delta, hwc->last_period);\n\t}\n\n\t/*\n\t * XXX event_limit might not quite work as expected on inherited\n\t * events\n\t */\n\n\tevent->pending_kill = POLL_IN;\n \tif (events && atomic_dec_and_test(&event->event_limit)) {\n \t\tret = 1;\n \t\tevent->pending_kill = POLL_HUP;\n\t\tevent->pending_disable = 1;\n\t\tirq_work_queue(&event->pending);\n \t}\n \n \tif (event->overflow_handler)\n\t\tevent->overflow_handler(event, data, regs);\n \telse\n\t\tperf_event_output(event, data, regs);\n \n \tif (event->fasync && event->pending_kill) {\n\t\tevent->pending_wakeup = 1;\n\t\tirq_work_queue(&event->pending);\n \t}\n \n \treturn ret;\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#30f5bc981921d9c0221c82f38d80bd2d5c86a022", + "input": "void AutocompleteProvider::UpdateStarredStateOfMatches() {\n if (matches_.empty())\n return;\n if (!profile_)\n return;\n BookmarkModel* bookmark_model = profile_->GetBookmarkModel();\n if (!bookmark_model || !bookmark_model->IsLoaded())\n return;\n for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i)\n i->starred = bookmark_model->IsBookmarked(GURL(i->destination_url));\n}\n", + "target": "void AutocompleteProvider::UpdateStarredStateOfMatches() {\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ae66a48d272b1fdc8bf475b107ae11d95edc91f9", + "input": "NetworkChangeNotifierLinux::Thread::Thread()\n : base::Thread(\"NetworkChangeNotifier\"),\n netlink_fd_(kInvalidSocket),\n ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) {\n }\n", + "target": "NetworkChangeNotifierLinux::Thread::Thread()\nNetworkChangeNotifierLinux::Thread::Thread(dbus::Bus* bus)\n : base::Thread(\"NetworkChangeNotifier\"),\n netlink_fd_(kInvalidSocket),\n ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)),\n network_manager_api_(\n base::Bind(&NetworkChangeNotifierLinux::Thread\n ::NotifyObserversOfOnlineStateChange),\n bus) {\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a004e72b95835136d3f1ea90517f706c24c03da7", + "input": "int tls1_process_ticket(SSL *s, unsigned char *session_id, int len,\n const unsigned char *limit, SSL_SESSION **ret)\n{\n /* Point after session ID in client hello */\n const unsigned char *p = session_id + len;\n unsigned short i;\n\n *ret = NULL;\n s->tlsext_ticket_expected = 0;\n\n /*\n * If tickets disabled behave as if no ticket present to permit stateful\n * resumption.\n */\n if (SSL_get_options(s) & SSL_OP_NO_TICKET)\n return 0;\n if ((s->version <= SSL3_VERSION) || !limit)\n return 0;\n if (p >= limit)\n return -1;\n /* Skip past DTLS cookie */\n if (SSL_IS_DTLS(s)) {\n i = *(p++);\n p += i;\n if (p >= limit)\n return -1;\n }\n /* Skip past cipher list */\n n2s(p, i);\n p += i;\n if (p >= limit)\n return -1;\n /* Skip past compression algorithm list */\n i = *(p++);\n p += i;\n if (p > limit)\n return -1;\n /* Now at start of extensions */\n if ((p + 2) >= limit)\n return 0;\n n2s(p, i);\n while ((p + 4) <= limit) {\n unsigned short type, size;\n n2s(p, type);\n n2s(p, size);\n if (p + size > limit)\n return 0;\n if (type == TLSEXT_TYPE_session_ticket) {\n int r;\n */\n s->tlsext_ticket_expected = 1;\n return 1;\n }\n if (s->tls_session_secret_cb) {\n /*\n * Indicate that the ticket couldn't be decrypted rather than\n * generating the session from ticket now, trigger\n * abbreviated handshake based on external mechanism to\n * calculate the master secret later.\n */\n return 2;\n }\n r = tls_decrypt_ticket(s, p, size, session_id, len, ret);\n switch (r) {\n case 2: /* ticket couldn't be decrypted */\n s->tlsext_ticket_expected = 1;\n return 2;\n case 3: /* ticket was decrypted */\n return r;\n case 4: /* ticket decrypted but need to renew */\n s->tlsext_ticket_expected = 1;\n return 3;\n default: /* fatal error */\n return -1;\n }\n }\n p += size;\n }\n", + "target": "int tls1_process_ticket(SSL *s, unsigned char *session_id, int len,\n const unsigned char *limit, SSL_SESSION **ret)\n{\n /* Point after session ID in client hello */\n const unsigned char *p = session_id + len;\n unsigned short i;\n\n *ret = NULL;\n s->tlsext_ticket_expected = 0;\n\n /*\n * If tickets disabled behave as if no ticket present to permit stateful\n * resumption.\n */\n if (SSL_get_options(s) & SSL_OP_NO_TICKET)\n return 0;\n if ((s->version <= SSL3_VERSION) || !limit)\n return 0;\n if (p >= limit)\n return -1;\n /* Skip past DTLS cookie */\n if (SSL_IS_DTLS(s)) {\n i = *(p++);\n\n if (limit - p <= i)\n return -1;\n\n p += i;\n }\n /* Skip past cipher list */\n n2s(p, i);\n if (limit - p <= i)\n return -1;\n p += i;\n\n /* Skip past compression algorithm list */\n i = *(p++);\n if (limit - p < i)\n return -1;\n p += i;\n\n /* Now at start of extensions */\n if (limit - p <= 2)\n return 0;\n n2s(p, i);\n while (limit - p >= 4) {\n unsigned short type, size;\n n2s(p, type);\n n2s(p, size);\n if (limit - p < size)\n return 0;\n if (type == TLSEXT_TYPE_session_ticket) {\n int r;\n */\n s->tlsext_ticket_expected = 1;\n return 1;\n }\n if (s->tls_session_secret_cb) {\n /*\n * Indicate that the ticket couldn't be decrypted rather than\n * generating the session from ticket now, trigger\n * abbreviated handshake based on external mechanism to\n * calculate the master secret later.\n */\n return 2;\n }\n r = tls_decrypt_ticket(s, p, size, session_id, len, ret);\n switch (r) {\n case 2: /* ticket couldn't be decrypted */\n s->tlsext_ticket_expected = 1;\n return 2;\n case 3: /* ticket was decrypted */\n return r;\n case 4: /* ticket decrypted but need to renew */\n s->tlsext_ticket_expected = 1;\n return 3;\n default: /* fatal error */\n return -1;\n }\n }\n p += size;\n }\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d0c31f0342cefc46a3b3d80359a9779d044d4c0d", + "input": " void BlobURLRegistry::registerURL(SecurityOrigin* origin, const KURL& publicURL, URLRegistrable* blob)\n {\n ASSERT(&blob->registry() == this);\n ThreadableBlobRegistry::registerBlobURL(origin, publicURL, static_cast(blob)->url());\n }\n", + "target": " void BlobURLRegistry::registerURL(SecurityOrigin* origin, const KURL& publicURL, URLRegistrable* blob)\n {\n ASSERT(&blob->registry() == this);\n BlobRegistry::registerBlobURL(origin, publicURL, static_cast(blob)->url());\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#adca986a53b31b6da4cb22f8e755f6856daea89a", + "input": " bool WebContentsImpl::ShowingInterstitialPage() const {\n return GetRenderManager()->interstitial_page() != NULL;\n }\n", + "target": " bool WebContentsImpl::ShowingInterstitialPage() const {\n return interstitial_page_ != nullptr;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#31400a673325147e1205326008e32135a78b4d8a", + "input": "queryin(char *buf)\n{\n\tQPRS_STATE\tstate;\n\tint32\t\ti;\n\tltxtquery *query;\n\tint32\t\tcommonlen;\n\tITEM\t *ptr;\n\tNODE\t *tmp;\n\tint32\t\tpos = 0;\n\n#ifdef BS_DEBUG\n\tchar\t\tpbuf[16384],\n\t\t\t *cur;\n#endif\n\n\t/* init state */\n\tstate.buf = buf;\n\tstate.state = WAITOPERAND;\n\tstate.count = 0;\n\tstate.num = 0;\n\tstate.str = NULL;\n\n\t/* init list of operand */\n\tstate.sumlen = 0;\n\tstate.lenop = 64;\n\tstate.curop = state.op = (char *) palloc(state.lenop);\n\t*(state.curop) = '\\0';\n\n\t/* parse query & make polish notation (postfix, but in reverse order) */\n\tmakepol(&state);\n\tif (!state.num)\n\t\tereport(ERROR,\n\t\t\t\t(errcode(ERRCODE_SYNTAX_ERROR),\n \t\t\t\t errmsg(\"syntax error\"),\n \t\t\t\t errdetail(\"Empty query.\")));\n \n\t/* make finish struct */\n \tcommonlen = COMPUTESIZE(state.num, state.sumlen);\n \tquery = (ltxtquery *) palloc(commonlen);\n \tSET_VARSIZE(query, commonlen);\n \tquery->size = state.num;\n\tptr = GETQUERY(query);\n\n\t/* set item in polish notation */\n\tfor (i = 0; i < state.num; i++)\n\t{\n\t\tptr[i].type = state.str->type;\n\t\tptr[i].val = state.str->val;\n\t\tptr[i].distance = state.str->distance;\n\t\tptr[i].length = state.str->length;\n\t\tptr[i].flag = state.str->flag;\n\t\ttmp = state.str->next;\n\t\tpfree(state.str);\n\t\tstate.str = tmp;\n\t}\n\n\t/* set user friendly-operand view */\n\tmemcpy((void *) GETOPERAND(query), (void *) state.op, state.sumlen);\n\tpfree(state.op);\n\n\t/* set left operand's position for every operator */\n\tpos = 0;\n\tfindoprnd(ptr, &pos);\n\n\treturn query;\n}\n", + "target": "queryin(char *buf)\n{\n\tQPRS_STATE\tstate;\n\tint32\t\ti;\n\tltxtquery *query;\n\tint32\t\tcommonlen;\n\tITEM\t *ptr;\n\tNODE\t *tmp;\n\tint32\t\tpos = 0;\n\n#ifdef BS_DEBUG\n\tchar\t\tpbuf[16384],\n\t\t\t *cur;\n#endif\n\n\t/* init state */\n\tstate.buf = buf;\n\tstate.state = WAITOPERAND;\n\tstate.count = 0;\n\tstate.num = 0;\n\tstate.str = NULL;\n\n\t/* init list of operand */\n\tstate.sumlen = 0;\n\tstate.lenop = 64;\n\tstate.curop = state.op = (char *) palloc(state.lenop);\n\t*(state.curop) = '\\0';\n\n\t/* parse query & make polish notation (postfix, but in reverse order) */\n\tmakepol(&state);\n\tif (!state.num)\n\t\tereport(ERROR,\n\t\t\t\t(errcode(ERRCODE_SYNTAX_ERROR),\n \t\t\t\t errmsg(\"syntax error\"),\n \t\t\t\t errdetail(\"Empty query.\")));\n \n\tif (LTXTQUERY_TOO_BIG(state.num, state.sumlen))\n\t\tereport(ERROR,\n\t\t\t\t(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),\n\t\t\t\t errmsg(\"ltxtquery is too large\")));\n \tcommonlen = COMPUTESIZE(state.num, state.sumlen);\n\n \tquery = (ltxtquery *) palloc(commonlen);\n \tSET_VARSIZE(query, commonlen);\n \tquery->size = state.num;\n\tptr = GETQUERY(query);\n\n\t/* set item in polish notation */\n\tfor (i = 0; i < state.num; i++)\n\t{\n\t\tptr[i].type = state.str->type;\n\t\tptr[i].val = state.str->val;\n\t\tptr[i].distance = state.str->distance;\n\t\tptr[i].length = state.str->length;\n\t\tptr[i].flag = state.str->flag;\n\t\ttmp = state.str->next;\n\t\tpfree(state.str);\n\t\tstate.str = tmp;\n\t}\n\n\t/* set user friendly-operand view */\n\tmemcpy((void *) GETOPERAND(query), (void *) state.op, state.sumlen);\n\tpfree(state.op);\n\n\t/* set left operand's position for every operator */\n\tpos = 0;\n\tfindoprnd(ptr, &pos);\n\n\treturn query;\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6c5211a0cef0cc2854eaa387e0eb036e012904d0?w=1", + "input": "PHP_MINFO_FUNCTION(mcrypt) /* {{{ */\n{\n\tchar **modules;\n\tchar mcrypt_api_no[16];\n\tint i, count;\n\tsmart_str tmp1 = {0};\n\tsmart_str tmp2 = {0};\n\n\tmodules = mcrypt_list_algorithms(MCG(algorithms_dir), &count);\n\tif (count == 0) {\n\t\tsmart_str_appends(&tmp1, \"none\");\n\t}\n\tfor (i = 0; i < count; i++) {\n\t\tsmart_str_appends(&tmp1, modules[i]);\n\t\tsmart_str_appendc(&tmp1, ' ');\n\t}\n\tsmart_str_0(&tmp1);\n\tmcrypt_free_p(modules, count);\n\n\tmodules = mcrypt_list_modes(MCG(modes_dir), &count);\n\tif (count == 0) {\n\t\tsmart_str_appends(&tmp2, \"none\");\n\t}\n\tfor (i = 0; i < count; i++) {\n\t\tsmart_str_appends(&tmp2, modules[i]);\n\t\tsmart_str_appendc(&tmp2, ' ');\n\t}\n\tsmart_str_0 (&tmp2);\n\tmcrypt_free_p (modules, count);\n\n\tsnprintf (mcrypt_api_no, 16, \"%d\", MCRYPT_API_VERSION);\n\n\tphp_info_print_table_start();\n\tphp_info_print_table_header(2, \"mcrypt support\", \"enabled\");\n\tphp_info_print_table_header(2, \"mcrypt_filter support\", \"enabled\");\n\tphp_info_print_table_row(2, \"Version\", LIBMCRYPT_VERSION);\n\tphp_info_print_table_row(2, \"Api No\", mcrypt_api_no);\n\tphp_info_print_table_row(2, \"Supported ciphers\", tmp1.c);\n\tphp_info_print_table_row(2, \"Supported modes\", tmp2.c);\n \tsmart_str_free(&tmp1);\n \tsmart_str_free(&tmp2);\n \tphp_info_print_table_end();\n \tDISPLAY_INI_ENTRIES();\n }\n /* }}} */\n", + "target": "PHP_MINFO_FUNCTION(mcrypt) /* {{{ */\n{\n\tchar **modules;\n\tchar mcrypt_api_no[16];\n\tint i, count;\n\tsmart_str tmp1 = {0};\n\tsmart_str tmp2 = {0};\n\n\tmodules = mcrypt_list_algorithms(MCG(algorithms_dir), &count);\n\tif (count == 0) {\n\t\tsmart_str_appends(&tmp1, \"none\");\n\t}\n\tfor (i = 0; i < count; i++) {\n\t\tsmart_str_appends(&tmp1, modules[i]);\n\t\tsmart_str_appendc(&tmp1, ' ');\n\t}\n\tsmart_str_0(&tmp1);\n\tmcrypt_free_p(modules, count);\n\n\tmodules = mcrypt_list_modes(MCG(modes_dir), &count);\n\tif (count == 0) {\n\t\tsmart_str_appends(&tmp2, \"none\");\n\t}\n\tfor (i = 0; i < count; i++) {\n\t\tsmart_str_appends(&tmp2, modules[i]);\n\t\tsmart_str_appendc(&tmp2, ' ');\n\t}\n\tsmart_str_0 (&tmp2);\n\tmcrypt_free_p (modules, count);\n\n\tsnprintf (mcrypt_api_no, 16, \"%d\", MCRYPT_API_VERSION);\n\n\tphp_info_print_table_start();\n\tphp_info_print_table_header(2, \"mcrypt support\", \"enabled\");\n\tphp_info_print_table_header(2, \"mcrypt_filter support\", \"enabled\");\n\tphp_info_print_table_row(2, \"Version\", LIBMCRYPT_VERSION);\n\tphp_info_print_table_row(2, \"Api No\", mcrypt_api_no);\n\tphp_info_print_table_row(2, \"Supported ciphers\", tmp1.c);\n\tphp_info_print_table_row(2, \"Supported modes\", tmp2.c);\n \tsmart_str_free(&tmp1);\n \tsmart_str_free(&tmp2);\n \tphp_info_print_table_end();\n\n \tDISPLAY_INI_ENTRIES();\n }\n /* }}} */\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#10b3823a7619ed22d42764733eb052c4159bc8c1", + "input": "static MagickBooleanType WriteSIXELImage(const ImageInfo *image_info,Image *image)\n{\n ExceptionInfo\n *exception;\n\n MagickBooleanType\n status;\n\n register const IndexPacket\n *indexes;\n\n register ssize_t\n i,\n x;\n\n ssize_t\n opacity,\n y;\n\n sixel_output_t\n *output;\n\n unsigned char\n sixel_palette[256 * 3],\n *sixel_pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n exception=(&image->exception);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);\n opacity=(-1);\n if (image->matte == MagickFalse)\n {\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n (void) SetImageType(image,PaletteType);\n }\n else\n {\n MagickRealType\n alpha,\n beta;\n\n /*\n Identify transparent colormap index.\n */\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n (void) SetImageType(image,PaletteBilevelMatteType);\n for (i=0; i < (ssize_t) image->colors; i++)\n if (image->colormap[i].opacity != OpaqueOpacity)\n {\n if (opacity < 0)\n {\n opacity=i;\n continue;\n }\n alpha=(MagickRealType) image->colormap[i].opacity;\n beta=(MagickRealType) image->colormap[opacity].opacity;\n if (alpha > beta)\n opacity=i;\n }\n if (opacity == -1)\n {\n (void) SetImageType(image,PaletteBilevelMatteType);\n for (i=0; i < (ssize_t) image->colors; i++)\n if (image->colormap[i].opacity != OpaqueOpacity)\n {\n if (opacity < 0)\n {\n opacity=i;\n continue;\n }\n alpha=(MagickRealType) image->colormap[i].opacity;\n beta=(MagickRealType) image->colormap[opacity].opacity;\n if (alpha > beta)\n opacity=i;\n }\n }\n if (opacity >= 0)\n {\n image->colormap[opacity].red=image->transparent_color.red;\n image->colormap[opacity].green=image->transparent_color.green;\n image->colormap[opacity].blue=image->transparent_color.blue;\n }\n }\n /*\n SIXEL header.\n */\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n sixel_palette[i * 3 + 0] = ScaleQuantumToChar(image->colormap[i].red);\n sixel_palette[i * 3 + 1] = ScaleQuantumToChar(image->colormap[i].green);\n sixel_palette[i * 3 + 2] = ScaleQuantumToChar(image->colormap[i].blue);\n }\n\n /*\n Define SIXEL pixels.\n */\n output = sixel_output_create(image);\n sixel_pixels =(unsigned char *) AcquireQuantumMemory(image->columns * image->rows,1);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n (void) GetVirtualPixels(image,0,y,image->columns,1,exception);\n indexes=GetVirtualIndexQueue(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n sixel_pixels[y * image->columns + x] = (unsigned char) ((ssize_t) GetPixelIndex(indexes + x));\n }\n status = sixel_encode_impl(sixel_pixels, image->columns, image->rows,\n sixel_palette, image->colors, -1,\n output);\n sixel_pixels =(unsigned char *) RelinquishMagickMemory(sixel_pixels);\n output = (sixel_output_t *) RelinquishMagickMemory(output);\n (void) CloseBlob(image);\n return(status);\n}\n", + "target": "static MagickBooleanType WriteSIXELImage(const ImageInfo *image_info,Image *image)\n{\n ExceptionInfo\n *exception;\n\n MagickBooleanType\n status;\n\n register const IndexPacket\n *indexes;\n\n register ssize_t\n i,\n x;\n\n ssize_t\n opacity,\n y;\n\n sixel_output_t\n *output;\n\n unsigned char\n sixel_palette[256 * 3],\n *sixel_pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n exception=(&image->exception);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);\n opacity=(-1);\n if (image->matte == MagickFalse)\n {\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n (void) SetImageType(image,PaletteType);\n }\n else\n {\n MagickRealType\n alpha,\n beta;\n\n /*\n Identify transparent colormap index.\n */\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n (void) SetImageType(image,PaletteBilevelMatteType);\n for (i=0; i < (ssize_t) image->colors; i++)\n if (image->colormap[i].opacity != OpaqueOpacity)\n {\n if (opacity < 0)\n {\n opacity=i;\n continue;\n }\n alpha=(MagickRealType) image->colormap[i].opacity;\n beta=(MagickRealType) image->colormap[opacity].opacity;\n if (alpha > beta)\n opacity=i;\n }\n if (opacity == -1)\n {\n (void) SetImageType(image,PaletteBilevelMatteType);\n for (i=0; i < (ssize_t) image->colors; i++)\n if (image->colormap[i].opacity != OpaqueOpacity)\n {\n if (opacity < 0)\n {\n opacity=i;\n continue;\n }\n alpha=(MagickRealType) image->colormap[i].opacity;\n beta=(MagickRealType) image->colormap[opacity].opacity;\n if (alpha > beta)\n opacity=i;\n }\n }\n if (opacity >= 0)\n {\n image->colormap[opacity].red=image->transparent_color.red;\n image->colormap[opacity].green=image->transparent_color.green;\n image->colormap[opacity].blue=image->transparent_color.blue;\n }\n }\n /*\n SIXEL header.\n */\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n sixel_palette[i * 3 + 0] = ScaleQuantumToChar(image->colormap[i].red);\n sixel_palette[i * 3 + 1] = ScaleQuantumToChar(image->colormap[i].green);\n sixel_palette[i * 3 + 2] = ScaleQuantumToChar(image->colormap[i].blue);\n }\n\n /*\n Define SIXEL pixels.\n */\n output = sixel_output_create(image);\n sixel_pixels =(unsigned char *) AcquireQuantumMemory(image->columns , image->rows);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n (void) GetVirtualPixels(image,0,y,image->columns,1,exception);\n indexes=GetVirtualIndexQueue(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n sixel_pixels[y * image->columns + x] = (unsigned char) ((ssize_t) GetPixelIndex(indexes + x));\n }\n status = sixel_encode_impl(sixel_pixels, image->columns, image->rows,\n sixel_palette, image->colors, -1,\n output);\n sixel_pixels =(unsigned char *) RelinquishMagickMemory(sixel_pixels);\n output = (sixel_output_t *) RelinquishMagickMemory(output);\n (void) CloseBlob(image);\n return(status);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a497e47d4aec37aaf8f13509f3ef3d1f6a717d88", + "input": "static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,\n\t\t\t size_t cnt, loff_t *ppos)\n{\n\tint r, i;\n\tchar *pdata;\n\tchar *p;\n\tchar *p0;\n\tchar *p1;\n \tchar *p2;\n \tstruct debug_data *d = f->private_data;\n \n\tpdata = kmalloc(cnt, GFP_KERNEL);\n \tif (pdata == NULL)\n \t\treturn 0;\n \n\tif (copy_from_user(pdata, buf, cnt)) {\n\t\tlbs_deb_debugfs(\"Copy from user failed\\n\");\n \t\tkfree(pdata);\n \t\treturn 0;\n \t}\n \n \tp0 = pdata;\n \tfor (i = 0; i < num_of_items; i++) {\n\t\tdo {\n\t\t\tp = strstr(p0, d[i].name);\n\t\t\tif (p == NULL)\n\t\t\t\tbreak;\n\t\t\tp1 = strchr(p, '\\n');\n\t\t\tif (p1 == NULL)\n\t\t\t\tbreak;\n\t\t\tp0 = p1++;\n\t\t\tp2 = strchr(p, '=');\n\t\t\tif (!p2)\n\t\t\t\tbreak;\n\t\t\tp2++;\n\t\t\tr = simple_strtoul(p2, NULL, 0);\n\t\t\tif (d[i].size == 1)\n\t\t\t\t*((u8 *) d[i].addr) = (u8) r;\n\t\t\telse if (d[i].size == 2)\n\t\t\t\t*((u16 *) d[i].addr) = (u16) r;\n\t\t\telse if (d[i].size == 4)\n\t\t\t\t*((u32 *) d[i].addr) = (u32) r;\n\t\t\telse if (d[i].size == 8)\n\t\t\t\t*((u64 *) d[i].addr) = (u64) r;\n\t\t\tbreak;\n\t\t} while (1);\n\t}\n\tkfree(pdata);\n\n\treturn (ssize_t)cnt;\n}\n", + "target": "static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,\n\t\t\t size_t cnt, loff_t *ppos)\n{\n\tint r, i;\n\tchar *pdata;\n\tchar *p;\n\tchar *p0;\n\tchar *p1;\n \tchar *p2;\n \tstruct debug_data *d = f->private_data;\n \n\tif (cnt == 0)\n\t\treturn 0;\n\n\tpdata = kmalloc(cnt + 1, GFP_KERNEL);\n \tif (pdata == NULL)\n \t\treturn 0;\n \n\tif (copy_from_user(pdata, buf, cnt)) {\n\t\tlbs_deb_debugfs(\"Copy from user failed\\n\");\n \t\tkfree(pdata);\n \t\treturn 0;\n \t}\n\tpdata[cnt] = '\\0';\n \n \tp0 = pdata;\n \tfor (i = 0; i < num_of_items; i++) {\n\t\tdo {\n\t\t\tp = strstr(p0, d[i].name);\n\t\t\tif (p == NULL)\n\t\t\t\tbreak;\n\t\t\tp1 = strchr(p, '\\n');\n\t\t\tif (p1 == NULL)\n\t\t\t\tbreak;\n\t\t\tp0 = p1++;\n\t\t\tp2 = strchr(p, '=');\n\t\t\tif (!p2)\n\t\t\t\tbreak;\n\t\t\tp2++;\n\t\t\tr = simple_strtoul(p2, NULL, 0);\n\t\t\tif (d[i].size == 1)\n\t\t\t\t*((u8 *) d[i].addr) = (u8) r;\n\t\t\telse if (d[i].size == 2)\n\t\t\t\t*((u16 *) d[i].addr) = (u16) r;\n\t\t\telse if (d[i].size == 4)\n\t\t\t\t*((u32 *) d[i].addr) = (u32) r;\n\t\t\telse if (d[i].size == 8)\n\t\t\t\t*((u64 *) d[i].addr) = (u64) r;\n\t\t\tbreak;\n\t\t} while (1);\n\t}\n\tkfree(pdata);\n\n\treturn (ssize_t)cnt;\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#1-c0b43df0fd3d", + "input": " def _get_vdisk_attributes(self, vdisk_name):\n \"\"\"Return vdisk attributes, or None if vdisk does not exist\n\n Exception is raised if the information from system can not be\n parsed/matched to a single vdisk.\n \"\"\"\n\n ssh_cmd = 'svcinfo lsvdisk -bytes -delim ! %s ' % vdisk_name\n return self._execute_command_and_parse_attributes(ssh_cmd)", + "target": " def _get_vdisk_attributes(self, vdisk_name):\n \"\"\"Return vdisk attributes, or None if vdisk does not exist\n\n Exception is raised if the information from system can not be\n parsed/matched to a single vdisk.\n \"\"\"\n\n ssh_cmd = ['svcinfo', 'lsvdisk', '-bytes', '-delim', '!', vdisk_name]\n return self._execute_command_and_parse_attributes(ssh_cmd)", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#d358f57009b85fb7440208afa5ba87636b491889", + "input": "void BluetoothDeviceChromeOS::RequestAuthorization(\n const dbus::ObjectPath& device_path,\n const ConfirmationCallback& callback) {\n callback.Run(CANCELLED);\n}\n", + "target": "void BluetoothDeviceChromeOS::RequestAuthorization(\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#550fd08c2cebad61c548def135f67aba284c6162", + "input": "static void bond_setup(struct net_device *bond_dev)\n{\n\tstruct bonding *bond = netdev_priv(bond_dev);\n\n\t/* initialize rwlocks */\n\trwlock_init(&bond->lock);\n\trwlock_init(&bond->curr_slave_lock);\n\n\tbond->params = bonding_defaults;\n\n\t/* Initialize pointers */\n\tbond->dev = bond_dev;\n\tINIT_LIST_HEAD(&bond->vlan_list);\n\n\t/* Initialize the device entry points */\n\tether_setup(bond_dev);\n\tbond_dev->netdev_ops = &bond_netdev_ops;\n\tbond_dev->ethtool_ops = &bond_ethtool_ops;\n\tbond_set_mode_ops(bond, bond->params.mode);\n\n\tbond_dev->destructor = bond_destructor;\n\n\t/* Initialize the device options */\n \tbond_dev->tx_queue_len = 0;\n \tbond_dev->flags |= IFF_MASTER|IFF_MULTICAST;\n \tbond_dev->priv_flags |= IFF_BONDING;\n\tbond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;\n \n \t/* At first, we block adding VLANs. That's the only way to\n \t * prevent problems that occur when adding VLANs over an\n\t * empty bond. The block will be removed once non-challenged\n\t * slaves are enslaved.\n\t */\n\tbond_dev->features |= NETIF_F_VLAN_CHALLENGED;\n\n\t/* don't acquire bond device's netif_tx_lock when\n\t * transmitting */\n\tbond_dev->features |= NETIF_F_LLTX;\n\n\t/* By default, we declare the bond to be fully\n\t * VLAN hardware accelerated capable. Special\n\t * care is taken in the various xmit functions\n\t * when there are slaves that are not hw accel\n\t * capable\n\t */\n\n\tbond_dev->hw_features = BOND_VLAN_FEATURES |\n\t\t\t\tNETIF_F_HW_VLAN_TX |\n\t\t\t\tNETIF_F_HW_VLAN_RX |\n\t\t\t\tNETIF_F_HW_VLAN_FILTER;\n\n\tbond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM);\n\tbond_dev->features |= bond_dev->hw_features;\n}\n", + "target": "static void bond_setup(struct net_device *bond_dev)\n{\n\tstruct bonding *bond = netdev_priv(bond_dev);\n\n\t/* initialize rwlocks */\n\trwlock_init(&bond->lock);\n\trwlock_init(&bond->curr_slave_lock);\n\n\tbond->params = bonding_defaults;\n\n\t/* Initialize pointers */\n\tbond->dev = bond_dev;\n\tINIT_LIST_HEAD(&bond->vlan_list);\n\n\t/* Initialize the device entry points */\n\tether_setup(bond_dev);\n\tbond_dev->netdev_ops = &bond_netdev_ops;\n\tbond_dev->ethtool_ops = &bond_ethtool_ops;\n\tbond_set_mode_ops(bond, bond->params.mode);\n\n\tbond_dev->destructor = bond_destructor;\n\n\t/* Initialize the device options */\n \tbond_dev->tx_queue_len = 0;\n \tbond_dev->flags |= IFF_MASTER|IFF_MULTICAST;\n \tbond_dev->priv_flags |= IFF_BONDING;\n\tbond_dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);\n \n \t/* At first, we block adding VLANs. That's the only way to\n \t * prevent problems that occur when adding VLANs over an\n\t * empty bond. The block will be removed once non-challenged\n\t * slaves are enslaved.\n\t */\n\tbond_dev->features |= NETIF_F_VLAN_CHALLENGED;\n\n\t/* don't acquire bond device's netif_tx_lock when\n\t * transmitting */\n\tbond_dev->features |= NETIF_F_LLTX;\n\n\t/* By default, we declare the bond to be fully\n\t * VLAN hardware accelerated capable. Special\n\t * care is taken in the various xmit functions\n\t * when there are slaves that are not hw accel\n\t * capable\n\t */\n\n\tbond_dev->hw_features = BOND_VLAN_FEATURES |\n\t\t\t\tNETIF_F_HW_VLAN_TX |\n\t\t\t\tNETIF_F_HW_VLAN_RX |\n\t\t\t\tNETIF_F_HW_VLAN_FILTER;\n\n\tbond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_NO_CSUM);\n\tbond_dev->features |= bond_dev->hw_features;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#44f1431b20c16d8f8da0ce8ff7bbf2adddcdd785", + "input": "bool LayoutSVGTransformableContainer::calculateLocalTransform()\n {\n SVGGraphicsElement* element = toSVGGraphicsElement(this->element());\n ASSERT(element);\n\n SVGUseElement* useElement = nullptr;\n if (isSVGUseElement(*element)) {\n useElement = toSVGUseElement(element);\n } else if (isSVGGElement(*element) && toSVGGElement(element)->inUseShadowTree()) {\n SVGElement* correspondingElement = element->correspondingElement();\n if (isSVGUseElement(correspondingElement))\n useElement = toSVGUseElement(correspondingElement);\n }\n\n if (useElement) {\n SVGLengthContext lengthContext(useElement);\n FloatSize translation(\n useElement->x()->currentValue()->value(lengthContext),\n useElement->y()->currentValue()->value(lengthContext));\n if (translation != m_additionalTranslation)\n m_needsTransformUpdate = true;\n m_additionalTranslation = translation;\n }\n \n if (!m_needsTransformUpdate)\n return false;\n \n m_localTransform = element->calculateAnimatedLocalTransform();\n m_localTransform.translate(m_additionalTranslation.width(), m_additionalTranslation.height());\n m_needsTransformUpdate = false;\n return true;\n }\n", + "target": "bool LayoutSVGTransformableContainer::calculateLocalTransform()\nvoid LayoutSVGTransformableContainer::setNeedsTransformUpdate()\n{\n setMayNeedPaintInvalidationSubtree();\n m_needsTransformUpdate = true;\n}\n\nstatic std::pair scaleReference(const AffineTransform& transform)\n{\n return std::make_pair(transform.xScaleSquared(), transform.yScaleSquared());\n}\n\nLayoutSVGContainer::TransformChange LayoutSVGTransformableContainer::calculateLocalTransform()\n {\n SVGGraphicsElement* element = toSVGGraphicsElement(this->element());\n ASSERT(element);\n\n SVGUseElement* useElement = nullptr;\n if (isSVGUseElement(*element)) {\n useElement = toSVGUseElement(element);\n } else if (isSVGGElement(*element) && toSVGGElement(element)->inUseShadowTree()) {\n SVGElement* correspondingElement = element->correspondingElement();\n if (isSVGUseElement(correspondingElement))\n useElement = toSVGUseElement(correspondingElement);\n }\n\n if (useElement) {\n SVGLengthContext lengthContext(useElement);\n FloatSize translation(\n useElement->x()->currentValue()->value(lengthContext),\n useElement->y()->currentValue()->value(lengthContext));\n // TODO(fs): Signal this on style update instead. (Since these are\n // suppose to be presentation attributes now, this does feel a bit\n // broken...)\n if (translation != m_additionalTranslation)\n setNeedsTransformUpdate();\n m_additionalTranslation = translation;\n }\n \n if (!m_needsTransformUpdate)\n return TransformChange::None;\n \n std::pair oldScale = scaleReference(m_localTransform);\n m_localTransform = element->calculateAnimatedLocalTransform();\n m_localTransform.translate(m_additionalTranslation.width(), m_additionalTranslation.height());\n m_needsTransformUpdate = false;\n return scaleReference(m_localTransform) != oldScale\n ? TransformChange::Full : TransformChange::ScaleInvariant;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f197c1c2b441da15274e2c17a928d7760b0bb260", + "input": "void RenderViewTest::TearDown() {\n base::RunLoop().RunUntilIdle();\n \n ViewMsg_Close msg(view_->GetRoutingID());\n static_cast(view_)->OnMessageReceived(msg);\n \n std::unique_ptr leak_detector =\n base::WrapUnique(blink::WebLeakDetector::Create(this));\n\n leak_detector->PrepareForLeakDetection(view_->GetWebView()->MainFrame());\n\n view_ = nullptr;\n mock_process_.reset();\n\n RenderThreadImpl::SetRendererBlinkPlatformImplForTesting(nullptr);\n\n base::RunLoop().RunUntilIdle();\n\n#if defined(OS_WIN)\n ClearDWriteFontProxySenderForTesting();\n#endif\n\n#if defined(OS_MACOSX)\n autorelease_pool_.reset();\n#endif\n\n leak_detector->CollectGarbageAndReport();\n\n blink_platform_impl_.Shutdown();\n platform_->PlatformUninitialize();\n platform_.reset();\n params_.reset();\n command_line_.reset();\n\n test_io_thread_.reset();\n ipc_support_.reset();\n}\n", + "target": "void RenderViewTest::TearDown() {\n base::RunLoop().RunUntilIdle();\n \n // Close the main |view_| as well as any other windows that might have been\n // opened by the test.\n CloseMessageSendingRenderViewVisitor closing_visitor;\n RenderView::ForEach(&closing_visitor);\n \n std::unique_ptr leak_detector =\n base::WrapUnique(blink::WebLeakDetector::Create(this));\n\n leak_detector->PrepareForLeakDetection(view_->GetWebView()->MainFrame());\n\n view_ = nullptr;\n mock_process_.reset();\n\n RenderThreadImpl::SetRendererBlinkPlatformImplForTesting(nullptr);\n\n base::RunLoop().RunUntilIdle();\n\n#if defined(OS_WIN)\n ClearDWriteFontProxySenderForTesting();\n#endif\n\n#if defined(OS_MACOSX)\n autorelease_pool_.reset();\n#endif\n\n leak_detector->CollectGarbageAndReport();\n\n blink_platform_impl_.Shutdown();\n platform_->PlatformUninitialize();\n platform_.reset();\n params_.reset();\n command_line_.reset();\n\n test_io_thread_.reset();\n ipc_support_.reset();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8a50f99c25fb70ff43aaa82b6f9569db383f0ca8", + "input": " void ChromeInvalidationClient::Ready(\n invalidation::InvalidationClient* client) {\n ticl_state_ = NO_NOTIFICATION_ERROR;\n EmitStateChange();\n registration_manager_->SetRegisteredIds(registered_ids_);\n }\n", + "target": " void ChromeInvalidationClient::Ready(\n invalidation::InvalidationClient* client) {\n DCHECK(CalledOnValidThread());\n DCHECK_EQ(client, invalidation_client_.get());\n ticl_state_ = NO_NOTIFICATION_ERROR;\n EmitStateChange();\n registration_manager_->UpdateRegisteredIds(registered_ids_);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1dcd10aceabbc03bf571ea32b892c522cbe923de", + "input": "juniper_mlppp_print(netdissect_options *ndo,\n const struct pcap_pkthdr *h, register const u_char *p)\n{\n struct juniper_l2info_t l2info;\n\n l2info.pictype = DLT_JUNIPER_MLPPP;\n if (juniper_parse_header(ndo, p, h, &l2info) == 0)\n return l2info.header_len;\n\n /* suppress Bundle-ID if frame was captured on a child-link\n * best indicator if the cookie looks like a proto */\n if (ndo->ndo_eflag &&\n EXTRACT_16BITS(&l2info.cookie) != PPP_OSI &&\n EXTRACT_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL))\n ND_PRINT((ndo, \"Bundle-ID %u: \", l2info.bundle));\n\n p+=l2info.header_len;\n\n /* first try the LSQ protos */\n switch(l2info.proto) {\n case JUNIPER_LSQ_L3_PROTO_IPV4:\n /* IP traffic going to the RE would not have a cookie\n * -> this must be incoming IS-IS over PPP\n */\n if (l2info.cookie[4] == (JUNIPER_LSQ_COOKIE_RE|JUNIPER_LSQ_COOKIE_DIR))\n ppp_print(ndo, p, l2info.length);\n else\n ip_print(ndo, p, l2info.length);\n return l2info.header_len;\n case JUNIPER_LSQ_L3_PROTO_IPV6:\n ip6_print(ndo, p,l2info.length);\n return l2info.header_len;\n case JUNIPER_LSQ_L3_PROTO_MPLS:\n mpls_print(ndo, p, l2info.length);\n return l2info.header_len;\n case JUNIPER_LSQ_L3_PROTO_ISO:\n isoclns_print(ndo, p, l2info.length, l2info.caplen);\n return l2info.header_len;\n default:\n break;\n }\n\n /* zero length cookie ? */\n switch (EXTRACT_16BITS(&l2info.cookie)) {\n case PPP_OSI:\n ppp_print(ndo, p - 2, l2info.length + 2);\n break;\n case (PPP_ADDRESS << 8 | PPP_CONTROL): /* fall through */\n default:\n ppp_print(ndo, p, l2info.length);\n break;\n }\n\n return l2info.header_len;\n}\n", + "target": "juniper_mlppp_print(netdissect_options *ndo,\n const struct pcap_pkthdr *h, register const u_char *p)\n{\n struct juniper_l2info_t l2info;\n\n l2info.pictype = DLT_JUNIPER_MLPPP;\n if (juniper_parse_header(ndo, p, h, &l2info) == 0)\n return l2info.header_len;\n\n /* suppress Bundle-ID if frame was captured on a child-link\n * best indicator if the cookie looks like a proto */\n if (ndo->ndo_eflag &&\n EXTRACT_16BITS(&l2info.cookie) != PPP_OSI &&\n EXTRACT_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL))\n ND_PRINT((ndo, \"Bundle-ID %u: \", l2info.bundle));\n\n p+=l2info.header_len;\n\n /* first try the LSQ protos */\n switch(l2info.proto) {\n case JUNIPER_LSQ_L3_PROTO_IPV4:\n /* IP traffic going to the RE would not have a cookie\n * -> this must be incoming IS-IS over PPP\n */\n if (l2info.cookie[4] == (JUNIPER_LSQ_COOKIE_RE|JUNIPER_LSQ_COOKIE_DIR))\n ppp_print(ndo, p, l2info.length);\n else\n ip_print(ndo, p, l2info.length);\n return l2info.header_len;\n case JUNIPER_LSQ_L3_PROTO_IPV6:\n ip6_print(ndo, p,l2info.length);\n return l2info.header_len;\n case JUNIPER_LSQ_L3_PROTO_MPLS:\n mpls_print(ndo, p, l2info.length);\n return l2info.header_len;\n case JUNIPER_LSQ_L3_PROTO_ISO:\n isoclns_print(ndo, p, l2info.length);\n return l2info.header_len;\n default:\n break;\n }\n\n /* zero length cookie ? */\n switch (EXTRACT_16BITS(&l2info.cookie)) {\n case PPP_OSI:\n ppp_print(ndo, p - 2, l2info.length + 2);\n break;\n case (PPP_ADDRESS << 8 | PPP_CONTROL): /* fall through */\n default:\n ppp_print(ndo, p, l2info.length);\n break;\n }\n\n return l2info.header_len;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#870f3e99a1282023753fe8d8aed90879cbc6838f", + "input": "bool IsTraceEventArgsWhitelisted(const char* category_group_name,\n const char* event_name) {\n base::CStringTokenizer category_group_tokens(\n category_group_name, category_group_name + strlen(category_group_name),\n \",\");\n while (category_group_tokens.GetNext()) {\n const std::string& category_group_token = category_group_tokens.token();\n for (int i = 0; kEventArgsWhitelist[i][0] != NULL; ++i) {\n DCHECK(kEventArgsWhitelist[i][1]);\n \n if (base::MatchPattern(category_group_token.c_str(),\n kEventArgsWhitelist[i][0]) &&\n base::MatchPattern(event_name, kEventArgsWhitelist[i][1])) {\n return true;\n }\n }\n }\n\n return false;\n}\n", + "target": "bool IsTraceEventArgsWhitelisted(const char* category_group_name,\nbool IsTraceArgumentNameWhitelisted(const char* const* granular_filter,\n const char* arg_name) {\n for (int i = 0; granular_filter[i] != nullptr; ++i) {\n if (base::MatchPattern(arg_name, granular_filter[i]))\n return true;\n }\n\n return false;\n}\n\nbool IsTraceEventArgsWhitelisted(\n const char* category_group_name,\n const char* event_name,\n base::trace_event::ArgumentNameFilterPredicate* arg_name_filter) {\n DCHECK(arg_name_filter);\n base::CStringTokenizer category_group_tokens(\n category_group_name, category_group_name + strlen(category_group_name),\n \",\");\n while (category_group_tokens.GetNext()) {\n const std::string& category_group_token = category_group_tokens.token();\n for (int i = 0; kEventArgsWhitelist[i].category_name != nullptr; ++i) {\n const WhitelistEntry& whitelist_entry = kEventArgsWhitelist[i];\n DCHECK(whitelist_entry.event_name);\n \n if (base::MatchPattern(category_group_token.c_str(),\n whitelist_entry.category_name) &&\n base::MatchPattern(event_name, whitelist_entry.event_name)) {\n if (whitelist_entry.arg_name_filter) {\n *arg_name_filter = base::Bind(&IsTraceArgumentNameWhitelisted,\n whitelist_entry.arg_name_filter);\n }\n return true;\n }\n }\n }\n\n return false;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4dca546d04321a610c1835010b5dad85163b65e1", + "input": "process_plane(uint8 * in, int width, int height, uint8 * out, int size)\n{\n\tUNUSED(size);\n\tint indexw;\n\tint indexh;\n\tint code;\n\tint collen;\n\tint replen;\n\tint color;\n\tint x;\n\tint revcode;\n\tuint8 * last_line;\n\tuint8 * this_line;\n\tuint8 * org_in;\n\tuint8 * org_out;\n\n\torg_in = in;\n\torg_out = out;\n\tlast_line = 0;\n\tindexh = 0;\n\twhile (indexh < height)\n\t{\n\t\tout = (org_out + width * height * 4) - ((indexh + 1) * width * 4);\n\t\tcolor = 0;\n\t\tthis_line = out;\n\t\tindexw = 0;\n\t\tif (last_line == 0)\n\t\t{\n\t\t\twhile (indexw < width)\n\t\t\t{\n\t\t\t\tcode = CVAL(in);\n\t\t\t\treplen = code & 0xf;\n\t\t\t\tcollen = (code >> 4) & 0xf;\n\t\t\t\trevcode = (replen << 4) | collen;\n\t\t\t\tif ((revcode <= 47) && (revcode >= 16))\n\t\t\t\t{\n \t\t\t\t\treplen = revcode;\n \t\t\t\t\tcollen = 0;\n \t\t\t\t}\n\t\t\t\twhile (collen > 0)\n \t\t\t\t{\n \t\t\t\t\tcolor = CVAL(in);\n \t\t\t\t\t*out = color;\n \t\t\t\t\tout += 4;\n \t\t\t\t\tindexw++;\n \t\t\t\t\tcollen--;\n \t\t\t\t}\n\t\t\t\twhile (replen > 0)\n \t\t\t\t{\n \t\t\t\t\t*out = color;\n \t\t\t\t\tout += 4;\n\t\t\t\t\tindexw++;\n\t\t\t\t\treplen--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\twhile (indexw < width)\n\t\t\t{\n\t\t\t\tcode = CVAL(in);\n\t\t\t\treplen = code & 0xf;\n\t\t\t\tcollen = (code >> 4) & 0xf;\n\t\t\t\trevcode = (replen << 4) | collen;\n\t\t\t\tif ((revcode <= 47) && (revcode >= 16))\n\t\t\t\t{\n \t\t\t\t\treplen = revcode;\n \t\t\t\t\tcollen = 0;\n \t\t\t\t}\n\t\t\t\twhile (collen > 0)\n \t\t\t\t{\n \t\t\t\t\tx = CVAL(in);\n \t\t\t\t\tif (x & 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tx = x >> 1;\n\t\t\t\t\t\tx = x + 1;\n\t\t\t\t\t\tcolor = -x;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tx = x >> 1;\n\t\t\t\t\t\tcolor = x;\n\t\t\t\t\t}\n\t\t\t\t\tx = last_line[indexw * 4] + color;\n\t\t\t\t\t*out = x;\n\t\t\t\t\tout += 4;\n \t\t\t\t\tindexw++;\n \t\t\t\t\tcollen--;\n \t\t\t\t}\n\t\t\t\twhile (replen > 0)\n \t\t\t\t{\n \t\t\t\t\tx = last_line[indexw * 4] + color;\n \t\t\t\t\t*out = x;\n\t\t\t\t\tout += 4;\n\t\t\t\t\tindexw++;\n\t\t\t\t\treplen--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tindexh++;\n\t\tlast_line = this_line;\n\t}\n\treturn (int) (in - org_in);\n}\n", + "target": "process_plane(uint8 * in, int width, int height, uint8 * out, int size)\n{\n\tUNUSED(size);\n\tint indexw;\n\tint indexh;\n\tint code;\n\tint collen;\n\tint replen;\n\tint color;\n\tint x;\n\tint revcode;\n\tuint8 * last_line;\n\tuint8 * this_line;\n\tuint8 * org_in;\n\tuint8 * org_out;\n\n\torg_in = in;\n\torg_out = out;\n\tlast_line = 0;\n\tindexh = 0;\n\twhile (indexh < height)\n\t{\n\t\tout = (org_out + width * height * 4) - ((indexh + 1) * width * 4);\n\t\tcolor = 0;\n\t\tthis_line = out;\n\t\tindexw = 0;\n\t\tif (last_line == 0)\n\t\t{\n\t\t\twhile (indexw < width)\n\t\t\t{\n\t\t\t\tcode = CVAL(in);\n\t\t\t\treplen = code & 0xf;\n\t\t\t\tcollen = (code >> 4) & 0xf;\n\t\t\t\trevcode = (replen << 4) | collen;\n\t\t\t\tif ((revcode <= 47) && (revcode >= 16))\n\t\t\t\t{\n \t\t\t\t\treplen = revcode;\n \t\t\t\t\tcollen = 0;\n \t\t\t\t}\n\t\t\t\twhile (indexw < width && collen > 0)\n \t\t\t\t{\n \t\t\t\t\tcolor = CVAL(in);\n \t\t\t\t\t*out = color;\n \t\t\t\t\tout += 4;\n \t\t\t\t\tindexw++;\n \t\t\t\t\tcollen--;\n \t\t\t\t}\n\t\t\t\twhile (indexw < width && replen > 0)\n \t\t\t\t{\n \t\t\t\t\t*out = color;\n \t\t\t\t\tout += 4;\n\t\t\t\t\tindexw++;\n\t\t\t\t\treplen--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\twhile (indexw < width)\n\t\t\t{\n\t\t\t\tcode = CVAL(in);\n\t\t\t\treplen = code & 0xf;\n\t\t\t\tcollen = (code >> 4) & 0xf;\n\t\t\t\trevcode = (replen << 4) | collen;\n\t\t\t\tif ((revcode <= 47) && (revcode >= 16))\n\t\t\t\t{\n \t\t\t\t\treplen = revcode;\n \t\t\t\t\tcollen = 0;\n \t\t\t\t}\n\t\t\t\twhile (indexw < width && collen > 0)\n \t\t\t\t{\n \t\t\t\t\tx = CVAL(in);\n \t\t\t\t\tif (x & 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tx = x >> 1;\n\t\t\t\t\t\tx = x + 1;\n\t\t\t\t\t\tcolor = -x;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tx = x >> 1;\n\t\t\t\t\t\tcolor = x;\n\t\t\t\t\t}\n\t\t\t\t\tx = last_line[indexw * 4] + color;\n\t\t\t\t\t*out = x;\n\t\t\t\t\tout += 4;\n \t\t\t\t\tindexw++;\n \t\t\t\t\tcollen--;\n \t\t\t\t}\n\t\t\t\twhile (indexw < width && replen > 0)\n \t\t\t\t{\n \t\t\t\t\tx = last_line[indexw * 4] + color;\n \t\t\t\t\t*out = x;\n\t\t\t\t\tout += 4;\n\t\t\t\t\tindexw++;\n\t\t\t\t\treplen--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tindexh++;\n\t\tlast_line = this_line;\n\t}\n\treturn (int) (in - org_in);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#afca6c5b2595fc44383919fba740c194b0b76aff", + "input": "xfs_iget_cache_miss(\n\tstruct xfs_mount\t*mp,\n\tstruct xfs_perag\t*pag,\n\txfs_trans_t\t\t*tp,\n\txfs_ino_t\t\tino,\n\tstruct xfs_inode\t**ipp,\n\tint\t\t\tflags,\n\tint\t\t\tlock_flags)\n{\n\tstruct xfs_inode\t*ip;\n\tint\t\t\terror;\n\txfs_agino_t\t\tagino = XFS_INO_TO_AGINO(mp, ino);\n\tint\t\t\tiflags;\n\n\tip = xfs_inode_alloc(mp, ino);\n\tif (!ip)\n\t\treturn -ENOMEM;\n\n\terror = xfs_iread(mp, tp, ip, flags);\n\tif (error)\n\t\tgoto out_destroy;\n\n\tif (!xfs_inode_verify_forks(ip)) {\n\t\terror = -EFSCORRUPTED;\n\t\tgoto out_destroy;\n\t}\n\n\ttrace_xfs_iget_miss(ip);\n \n \n \t/*\n\t * If we are allocating a new inode, then check what was returned is\n\t * actually a free, empty inode. If we are not allocating an inode,\n\t * the check we didn't find a free inode.\n \t */\n\tif (flags & XFS_IGET_CREATE) {\n\t\tif (VFS_I(ip)->i_mode != 0) {\n\t\t\txfs_warn(mp,\n\"Corruption detected! Free inode 0x%llx not marked free on disk\",\n\t\t\t\tino);\n\t\t\terror = -EFSCORRUPTED;\n\t\t\tgoto out_destroy;\n\t\t}\n\t\tif (ip->i_d.di_nblocks != 0) {\n\t\t\txfs_warn(mp,\n\"Corruption detected! Free inode 0x%llx has blocks allocated!\",\n\t\t\t\tino);\n\t\t\terror = -EFSCORRUPTED;\n\t\t\tgoto out_destroy;\n\t\t}\n\t} else if (VFS_I(ip)->i_mode == 0) {\n\t\terror = -ENOENT;\n \t\tgoto out_destroy;\n\t}\n \n \t/*\n \t * Preload the radix tree so we can insert safely under the\n\t * write spinlock. Note that we cannot sleep inside the preload\n\t * region. Since we can be called from transaction context, don't\n\t * recurse into the file system.\n\t */\n\tif (radix_tree_preload(GFP_NOFS)) {\n\t\terror = -EAGAIN;\n\t\tgoto out_destroy;\n\t}\n\n\t/*\n\t * Because the inode hasn't been added to the radix-tree yet it can't\n\t * be found by another thread, so we can do the non-sleeping lock here.\n\t */\n\tif (lock_flags) {\n\t\tif (!xfs_ilock_nowait(ip, lock_flags))\n\t\t\tBUG();\n\t}\n\n\t/*\n\t * These values must be set before inserting the inode into the radix\n\t * tree as the moment it is inserted a concurrent lookup (allowed by the\n\t * RCU locking mechanism) can find it and that lookup must see that this\n\t * is an inode currently under construction (i.e. that XFS_INEW is set).\n\t * The ip->i_flags_lock that protects the XFS_INEW flag forms the\n\t * memory barrier that ensures this detection works correctly at lookup\n\t * time.\n\t */\n\tiflags = XFS_INEW;\n\tif (flags & XFS_IGET_DONTCACHE)\n\t\tiflags |= XFS_IDONTCACHE;\n\tip->i_udquot = NULL;\n\tip->i_gdquot = NULL;\n\tip->i_pdquot = NULL;\n\txfs_iflags_set(ip, iflags);\n\n\t/* insert the new inode */\n\tspin_lock(&pag->pag_ici_lock);\n\terror = radix_tree_insert(&pag->pag_ici_root, agino, ip);\n\tif (unlikely(error)) {\n\t\tWARN_ON(error != -EEXIST);\n\t\tXFS_STATS_INC(mp, xs_ig_dup);\n\t\terror = -EAGAIN;\n\t\tgoto out_preload_end;\n\t}\n\tspin_unlock(&pag->pag_ici_lock);\n\tradix_tree_preload_end();\n\n\t*ipp = ip;\n\treturn 0;\n\nout_preload_end:\n\tspin_unlock(&pag->pag_ici_lock);\n\tradix_tree_preload_end();\n\tif (lock_flags)\n\t\txfs_iunlock(ip, lock_flags);\nout_destroy:\n\t__destroy_inode(VFS_I(ip));\n\txfs_inode_free(ip);\n\treturn error;\n}\n", + "target": "xfs_iget_cache_miss(\n\tstruct xfs_mount\t*mp,\n\tstruct xfs_perag\t*pag,\n\txfs_trans_t\t\t*tp,\n\txfs_ino_t\t\tino,\n\tstruct xfs_inode\t**ipp,\n\tint\t\t\tflags,\n\tint\t\t\tlock_flags)\n{\n\tstruct xfs_inode\t*ip;\n\tint\t\t\terror;\n\txfs_agino_t\t\tagino = XFS_INO_TO_AGINO(mp, ino);\n\tint\t\t\tiflags;\n\n\tip = xfs_inode_alloc(mp, ino);\n\tif (!ip)\n\t\treturn -ENOMEM;\n\n\terror = xfs_iread(mp, tp, ip, flags);\n\tif (error)\n\t\tgoto out_destroy;\n\n\tif (!xfs_inode_verify_forks(ip)) {\n\t\terror = -EFSCORRUPTED;\n\t\tgoto out_destroy;\n\t}\n\n\ttrace_xfs_iget_miss(ip);\n \n \n \t/*\n\t * Check the inode free state is valid. This also detects lookup\n\t * racing with unlinks.\n \t */\n\terror = xfs_iget_check_free_state(ip, flags);\n\tif (error)\n \t\tgoto out_destroy;\n \n \t/*\n \t * Preload the radix tree so we can insert safely under the\n\t * write spinlock. Note that we cannot sleep inside the preload\n\t * region. Since we can be called from transaction context, don't\n\t * recurse into the file system.\n\t */\n\tif (radix_tree_preload(GFP_NOFS)) {\n\t\terror = -EAGAIN;\n\t\tgoto out_destroy;\n\t}\n\n\t/*\n\t * Because the inode hasn't been added to the radix-tree yet it can't\n\t * be found by another thread, so we can do the non-sleeping lock here.\n\t */\n\tif (lock_flags) {\n\t\tif (!xfs_ilock_nowait(ip, lock_flags))\n\t\t\tBUG();\n\t}\n\n\t/*\n\t * These values must be set before inserting the inode into the radix\n\t * tree as the moment it is inserted a concurrent lookup (allowed by the\n\t * RCU locking mechanism) can find it and that lookup must see that this\n\t * is an inode currently under construction (i.e. that XFS_INEW is set).\n\t * The ip->i_flags_lock that protects the XFS_INEW flag forms the\n\t * memory barrier that ensures this detection works correctly at lookup\n\t * time.\n\t */\n\tiflags = XFS_INEW;\n\tif (flags & XFS_IGET_DONTCACHE)\n\t\tiflags |= XFS_IDONTCACHE;\n\tip->i_udquot = NULL;\n\tip->i_gdquot = NULL;\n\tip->i_pdquot = NULL;\n\txfs_iflags_set(ip, iflags);\n\n\t/* insert the new inode */\n\tspin_lock(&pag->pag_ici_lock);\n\terror = radix_tree_insert(&pag->pag_ici_root, agino, ip);\n\tif (unlikely(error)) {\n\t\tWARN_ON(error != -EEXIST);\n\t\tXFS_STATS_INC(mp, xs_ig_dup);\n\t\terror = -EAGAIN;\n\t\tgoto out_preload_end;\n\t}\n\tspin_unlock(&pag->pag_ici_lock);\n\tradix_tree_preload_end();\n\n\t*ipp = ip;\n\treturn 0;\n\nout_preload_end:\n\tspin_unlock(&pag->pag_ici_lock);\n\tradix_tree_preload_end();\n\tif (lock_flags)\n\t\txfs_iunlock(ip, lock_flags);\nout_destroy:\n\t__destroy_inode(VFS_I(ip));\n\txfs_inode_free(ip);\n\treturn error;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "check_interlace_type(int PNG_CONST interlace_type)\n {\n if (interlace_type != PNG_INTERLACE_NONE)\n {\n /* This is an internal error - --interlace tests should be skipped, not\n * attempted.\n */\n fprintf(stderr, \"pngvalid: no interlace support\\n\");\n\n exit(99);\n }\n }\n", + "target": "check_interlace_type(int PNG_CONST interlace_type)\ncheck_interlace_type(int const interlace_type)\n {\n /* Prior to 1.7.0 libpng does not support the write of an interlaced image\n * unless PNG_WRITE_INTERLACING_SUPPORTED, even with do_interlace so the\n * code here does the pixel interlace itself, so:\n */\n if (interlace_type != PNG_INTERLACE_NONE)\n {\n /* This is an internal error - --interlace tests should be skipped, not\n * attempted.\n */\n fprintf(stderr, \"pngvalid: no interlace support\\n\");\n\n exit(99);\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04aaacb936a08d70862d6d9d7e8354721ae46be8", + "input": " void Verify_MakeGroupObsolete() {\n EXPECT_TRUE(delegate()->obsoleted_success_);\n EXPECT_EQ(group_.get(), delegate()->obsoleted_group_.get());\n EXPECT_TRUE(group_->is_obsolete());\n EXPECT_TRUE(storage()->usage_map_.empty());\n\n AppCacheDatabase::GroupRecord group_record;\n AppCacheDatabase::CacheRecord cache_record;\n EXPECT_FALSE(database()->FindGroup(1, &group_record));\n EXPECT_FALSE(database()->FindCache(1, &cache_record));\n\n std::vector entry_records;\n database()->FindEntriesForCache(1, &entry_records);\n EXPECT_TRUE(entry_records.empty());\n std::vector intercept_records;\n std::vector fallback_records;\n database()->FindNamespacesForCache(1, &intercept_records,\n &fallback_records);\n EXPECT_TRUE(fallback_records.empty());\n std::vector whitelist_records;\n database()->FindOnlineWhiteListForCache(1, &whitelist_records);\n EXPECT_TRUE(whitelist_records.empty());\n\n EXPECT_TRUE(storage()->usage_map_.empty());\n EXPECT_EQ(1, mock_quota_manager_proxy_->notify_storage_modified_count_);\n EXPECT_EQ(kOrigin, mock_quota_manager_proxy_->last_origin_);\n EXPECT_EQ(-kDefaultEntrySize, mock_quota_manager_proxy_->last_delta_);\n \n TestFinished();\n }\n", + "target": " void Verify_MakeGroupObsolete() {\n EXPECT_TRUE(delegate()->obsoleted_success_);\n EXPECT_EQ(group_.get(), delegate()->obsoleted_group_.get());\n EXPECT_TRUE(group_->is_obsolete());\n EXPECT_TRUE(storage()->usage_map_.empty());\n\n AppCacheDatabase::GroupRecord group_record;\n AppCacheDatabase::CacheRecord cache_record;\n EXPECT_FALSE(database()->FindGroup(1, &group_record));\n EXPECT_FALSE(database()->FindCache(1, &cache_record));\n\n std::vector entry_records;\n database()->FindEntriesForCache(1, &entry_records);\n EXPECT_TRUE(entry_records.empty());\n std::vector intercept_records;\n std::vector fallback_records;\n database()->FindNamespacesForCache(1, &intercept_records,\n &fallback_records);\n EXPECT_TRUE(fallback_records.empty());\n std::vector whitelist_records;\n database()->FindOnlineWhiteListForCache(1, &whitelist_records);\n EXPECT_TRUE(whitelist_records.empty());\n\n EXPECT_TRUE(storage()->usage_map_.empty());\n EXPECT_EQ(1, mock_quota_manager_proxy_->notify_storage_modified_count_);\n EXPECT_EQ(kOrigin, mock_quota_manager_proxy_->last_origin_);\n EXPECT_EQ(-(kDefaultEntrySize + kDefaultEntryPadding),\n mock_quota_manager_proxy_->last_delta_);\n \n TestFinished();\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b399a05453d7b3e2dfdec67865fefe6953bcc59e", + "input": " cc::FrameSinkId RenderWidgetHostViewAura::GetFrameSinkId() {\n return delegated_frame_host_ ? delegated_frame_host_->GetFrameSinkId()\n : cc::FrameSinkId();\n }\n", + "target": " cc::FrameSinkId RenderWidgetHostViewAura::GetFrameSinkId() {\n return frame_sink_id_;\n }\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ea3d1d84be3d6f97bf50e76511c9e26af6895533", + "input": "void PluginInstance::OnTimerCall(void (*func)(NPP id, uint32 timer_id),\n NPP id,\n uint32 timer_id) {\n TimerMap::iterator it = timers_.find(timer_id);\n if (it == timers_.end())\n return;\n\n TimerInfo info = it->second;\n\n func(id, timer_id);\n\n if (timers_.find(timer_id) == timers_.end())\n return;\n\n if (info.repeat) {\n message_loop_->PostDelayedTask(FROM_HERE,\n NewRunnableMethod(\n this,\n &PluginInstance::OnTimerCall,\n func,\n npp_,\n timer_id),\n info.interval);\n } else {\n timers_.erase(it);\n }\n}\n", + "target": "void PluginInstance::OnTimerCall(void (*func)(NPP id, uint32 timer_id),\n NPP id,\n uint32 timer_id) {\n TimerMap::iterator it = timers_.find(timer_id);\n if (it == timers_.end())\n return;\n\n TimerInfo info = it->second;\n\n func(id, timer_id);\n\n if (timers_.find(timer_id) == timers_.end())\n return;\n\n if (info.repeat) {\n MessageLoop::current()->PostDelayedTask(\n FROM_HERE,\n NewRunnableMethod(\n this, &PluginInstance::OnTimerCall, func, npp_, timer_id),\n info.interval);\n } else {\n timers_.erase(it);\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d04c78773f6959bcb427453f8e5b9824d5ba9eff", + "input": " INST_HANDLER (sts) {\t// STS k, Rr\n \tint r = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4);\n \tint k = (buf[3] << 8) | buf[2];\n \top->ptr = k;\n\n\tESIL_A (\"r%d,\", r);\n\t__generic_ld_st (op, \"ram\", 0, 1, 0, k, 1);\n\n\top->cycles = 2;\n}\n", + "target": " INST_HANDLER (sts) {\t// STS k, Rr\n\tif (len < 4) {\n\t\treturn;\n\t}\n \tint r = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4);\n \tint k = (buf[3] << 8) | buf[2];\n \top->ptr = k;\n\n\tESIL_A (\"r%d,\", r);\n\t__generic_ld_st (op, \"ram\", 0, 1, 0, k, 1);\n\n\top->cycles = 2;\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#92327c9ec211bd1616315abcb255861b130b97ca", + "input": "char *url_decode_r(char *to, char *url, size_t size) {\n char *s = url, // source\n *d = to, // destination\n *e = &to[size - 1]; // destination end\n\n while(*s && d < e) {\n if(unlikely(*s == '%')) {\n if(likely(s[1] && s[2])) {\n *d++ = from_hex(s[1]) << 4 | from_hex(s[2]);\n s += 2;\n }\n }\n else if(unlikely(*s == '+'))\n *d++ = ' ';\n\n else\n *d++ = *s;\n\n s++;\n }\n\n *d = '\\0';\n\n return to;\n}\n", + "target": "char *url_decode_r(char *to, char *url, size_t size) {\n char *s = url, // source\n *d = to, // destination\n *e = &to[size - 1]; // destination end\n\n while(*s && d < e) {\n if(unlikely(*s == '%')) {\n if(likely(s[1] && s[2])) {\n char t = from_hex(s[1]) << 4 | from_hex(s[2]);\n // avoid HTTP header injection\n *d++ = (char)((isprint(t))? t : ' ');\n s += 2;\n }\n }\n else if(unlikely(*s == '+'))\n *d++ = ' ';\n\n else\n *d++ = *s;\n\n s++;\n }\n\n *d = '\\0';\n\n return to;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1cda0d7c2ffb62d8331c64e703131d9cabdc03ea", + "input": "static size_t exif_convert_any_to_int(void *value, int format, int motorola_intel TSRMLS_DC)\n{\n\tint \t\ts_den;\n\tunsigned \tu_den;\n\n\tswitch(format) {\n\t\tcase TAG_FMT_SBYTE: return *(signed char *)value;\n\t\tcase TAG_FMT_BYTE: return *(uchar *)value;\n\n\t\tcase TAG_FMT_USHORT: return php_ifd_get16u(value, motorola_intel);\n\t\tcase TAG_FMT_ULONG: return php_ifd_get32u(value, motorola_intel);\n\n\t\tcase TAG_FMT_URATIONAL:\n\t\t\tu_den = php_ifd_get32u(4+(char *)value, motorola_intel);\n\t\t\tif (u_den == 0) {\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn php_ifd_get32u(value, motorola_intel) / u_den;\n\t\t\t}\n\n\t\tcase TAG_FMT_SRATIONAL:\n\t\t\ts_den = php_ifd_get32s(4+(char *)value, motorola_intel);\n \t\t\tif (s_den == 0) {\n \t\t\t\treturn 0;\n \t\t\t} else {\n\t\t\t\treturn php_ifd_get32s(value, motorola_intel) / s_den;\n \t\t\t}\n \n \t\tcase TAG_FMT_SSHORT: return php_ifd_get16u(value, motorola_intel);\n\t\tcase TAG_FMT_SLONG: return php_ifd_get32s(value, motorola_intel);\n\n\t\t/* Not sure if this is correct (never seen float used in Exif format) */\n\t\tcase TAG_FMT_SINGLE:\n#ifdef EXIF_DEBUG\n\t\t\tphp_error_docref(NULL TSRMLS_CC, E_NOTICE, \"Found value of type single\");\n#endif\n\t\t\treturn (size_t)*(float *)value;\n\t\tcase TAG_FMT_DOUBLE:\n#ifdef EXIF_DEBUG\n\t\t\tphp_error_docref(NULL TSRMLS_CC, E_NOTICE, \"Found value of type double\");\n#endif\n\t\t\treturn (size_t)*(double *)value;\n\t}\n\treturn 0;\n}\n", + "target": "static size_t exif_convert_any_to_int(void *value, int format, int motorola_intel TSRMLS_DC)\n{\n\tint \t\ts_den;\n\tunsigned \tu_den;\n\n\tswitch(format) {\n\t\tcase TAG_FMT_SBYTE: return *(signed char *)value;\n\t\tcase TAG_FMT_BYTE: return *(uchar *)value;\n\n\t\tcase TAG_FMT_USHORT: return php_ifd_get16u(value, motorola_intel);\n\t\tcase TAG_FMT_ULONG: return php_ifd_get32u(value, motorola_intel);\n\n\t\tcase TAG_FMT_URATIONAL:\n\t\t\tu_den = php_ifd_get32u(4+(char *)value, motorola_intel);\n\t\t\tif (u_den == 0) {\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn php_ifd_get32u(value, motorola_intel) / u_den;\n\t\t\t}\n\n\t\tcase TAG_FMT_SRATIONAL:\n\t\t\ts_den = php_ifd_get32s(4+(char *)value, motorola_intel);\n \t\t\tif (s_den == 0) {\n \t\t\t\treturn 0;\n \t\t\t} else {\n\t\t\t\treturn (size_t)((double)php_ifd_get32s(value, motorola_intel) / s_den);\n \t\t\t}\n \n \t\tcase TAG_FMT_SSHORT: return php_ifd_get16u(value, motorola_intel);\n\t\tcase TAG_FMT_SLONG: return php_ifd_get32s(value, motorola_intel);\n\n\t\t/* Not sure if this is correct (never seen float used in Exif format) */\n\t\tcase TAG_FMT_SINGLE:\n#ifdef EXIF_DEBUG\n\t\t\tphp_error_docref(NULL TSRMLS_CC, E_NOTICE, \"Found value of type single\");\n#endif\n\t\t\treturn (size_t)*(float *)value;\n\t\tcase TAG_FMT_DOUBLE:\n#ifdef EXIF_DEBUG\n\t\t\tphp_error_docref(NULL TSRMLS_CC, E_NOTICE, \"Found value of type double\");\n#endif\n\t\t\treturn (size_t)*(double *)value;\n\t}\n\treturn 0;\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#295c883fe3105b19bcd0f9e07d54c6b589fc5bff", + "input": "OMX_ERRORTYPE SoftAVCEncoder::internalSetParameter(\n OMX_INDEXTYPE index, const OMX_PTR params) {\n int32_t indexFull = index;\n\n switch (indexFull) {\n case OMX_IndexParamVideoBitrate:\n {\n\n OMX_VIDEO_PARAM_BITRATETYPE *bitRate =\n (OMX_VIDEO_PARAM_BITRATETYPE *) params;\n \n if (bitRate->nPortIndex != 1 ||\n bitRate->eControlRate != OMX_Video_ControlRateVariable) {\n return OMX_ErrorUndefined;\n }\n\n mBitrate = bitRate->nTargetBitrate;\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamVideoAvc:\n {\n\n OMX_VIDEO_PARAM_AVCTYPE *avcType =\n (OMX_VIDEO_PARAM_AVCTYPE *)params;\n \n if (avcType->nPortIndex != 1) {\n return OMX_ErrorUndefined;\n }\n\n if (avcType->eProfile != OMX_VIDEO_AVCProfileBaseline ||\n avcType->nRefFrames != 1 ||\n avcType->nBFrames != 0 ||\n avcType->bUseHadamard != OMX_TRUE ||\n (avcType->nAllowedPictureTypes & OMX_VIDEO_PictureTypeB) != 0 ||\n avcType->nRefIdx10ActiveMinus1 != 0 ||\n avcType->nRefIdx11ActiveMinus1 != 0 ||\n avcType->bWeightedPPrediction != OMX_FALSE ||\n avcType->bEntropyCodingCABAC != OMX_FALSE ||\n avcType->bconstIpred != OMX_FALSE ||\n avcType->bDirect8x8Inference != OMX_FALSE ||\n avcType->bDirectSpatialTemporal != OMX_FALSE ||\n avcType->nCabacInitIdc != 0) {\n return OMX_ErrorUndefined;\n }\n\n if (OK != ConvertOmxAvcLevelToAvcSpecLevel(avcType->eLevel, &mAVCEncLevel)) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n default:\n return SoftVideoEncoderOMXComponent::internalSetParameter(index, params);\n }\n}\n", + "target": "OMX_ERRORTYPE SoftAVCEncoder::internalSetParameter(\n OMX_INDEXTYPE index, const OMX_PTR params) {\n int32_t indexFull = index;\n\n switch (indexFull) {\n case OMX_IndexParamVideoBitrate:\n {\n\n OMX_VIDEO_PARAM_BITRATETYPE *bitRate =\n (OMX_VIDEO_PARAM_BITRATETYPE *) params;\n \n if (!isValidOMXParam(bitRate)) {\n return OMX_ErrorBadParameter;\n }\n\n if (bitRate->nPortIndex != 1 ||\n bitRate->eControlRate != OMX_Video_ControlRateVariable) {\n return OMX_ErrorUndefined;\n }\n\n mBitrate = bitRate->nTargetBitrate;\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamVideoAvc:\n {\n\n OMX_VIDEO_PARAM_AVCTYPE *avcType =\n (OMX_VIDEO_PARAM_AVCTYPE *)params;\n \n if (!isValidOMXParam(avcType)) {\n return OMX_ErrorBadParameter;\n }\n\n if (avcType->nPortIndex != 1) {\n return OMX_ErrorUndefined;\n }\n\n if (avcType->eProfile != OMX_VIDEO_AVCProfileBaseline ||\n avcType->nRefFrames != 1 ||\n avcType->nBFrames != 0 ||\n avcType->bUseHadamard != OMX_TRUE ||\n (avcType->nAllowedPictureTypes & OMX_VIDEO_PictureTypeB) != 0 ||\n avcType->nRefIdx10ActiveMinus1 != 0 ||\n avcType->nRefIdx11ActiveMinus1 != 0 ||\n avcType->bWeightedPPrediction != OMX_FALSE ||\n avcType->bEntropyCodingCABAC != OMX_FALSE ||\n avcType->bconstIpred != OMX_FALSE ||\n avcType->bDirect8x8Inference != OMX_FALSE ||\n avcType->bDirectSpatialTemporal != OMX_FALSE ||\n avcType->nCabacInitIdc != 0) {\n return OMX_ErrorUndefined;\n }\n\n if (OK != ConvertOmxAvcLevelToAvcSpecLevel(avcType->eLevel, &mAVCEncLevel)) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n default:\n return SoftVideoEncoderOMXComponent::internalSetParameter(index, params);\n }\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f6d8bd051c391c1c0458a30b2a7abcd939329259", + "input": "int cipso_v4_req_setattr(struct request_sock *req,\n\t\t\t const struct cipso_v4_doi *doi_def,\n\t\t\t const struct netlbl_lsm_secattr *secattr)\n{\n\tint ret_val = -EPERM;\n \tunsigned char *buf = NULL;\n \tu32 buf_len;\n \tu32 opt_len;\n\tstruct ip_options *opt = NULL;\n \tstruct inet_request_sock *req_inet;\n \n \t/* We allocate the maximum CIPSO option size here so we are probably\n\t * being a little wasteful, but it makes our life _much_ easier later\n\t * on and after all we are only talking about 40 bytes. */\n\tbuf_len = CIPSO_V4_OPT_LEN_MAX;\n\tbuf = kmalloc(buf_len, GFP_ATOMIC);\n\tif (buf == NULL) {\n\t\tret_val = -ENOMEM;\n\t\tgoto req_setattr_failure;\n\t}\n\n\tret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);\n\tif (ret_val < 0)\n\t\tgoto req_setattr_failure;\n\tbuf_len = ret_val;\n\n\t/* We can't use ip_options_get() directly because it makes a call to\n\t * ip_options_get_alloc() which allocates memory with GFP_KERNEL and\n\t * we won't always have CAP_NET_RAW even though we _always_ want to\n\t * set the IPOPT_CIPSO option. */\n\topt_len = (buf_len + 3) & ~3;\n\topt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC);\n\tif (opt == NULL) {\n \t\tret_val = -ENOMEM;\n \t\tgoto req_setattr_failure;\n \t}\n\tmemcpy(opt->__data, buf, buf_len);\n\topt->optlen = opt_len;\n\topt->cipso = sizeof(struct iphdr);\n \tkfree(buf);\n \tbuf = NULL;\n \n \treq_inet = inet_rsk(req);\n \topt = xchg(&req_inet->opt, opt);\n\tkfree(opt);\n \n \treturn 0;\n \nreq_setattr_failure:\n\tkfree(buf);\n\tkfree(opt);\n\treturn ret_val;\n}\n", + "target": "int cipso_v4_req_setattr(struct request_sock *req,\n\t\t\t const struct cipso_v4_doi *doi_def,\n\t\t\t const struct netlbl_lsm_secattr *secattr)\n{\n\tint ret_val = -EPERM;\n \tunsigned char *buf = NULL;\n \tu32 buf_len;\n \tu32 opt_len;\n\tstruct ip_options_rcu *opt = NULL;\n \tstruct inet_request_sock *req_inet;\n \n \t/* We allocate the maximum CIPSO option size here so we are probably\n\t * being a little wasteful, but it makes our life _much_ easier later\n\t * on and after all we are only talking about 40 bytes. */\n\tbuf_len = CIPSO_V4_OPT_LEN_MAX;\n\tbuf = kmalloc(buf_len, GFP_ATOMIC);\n\tif (buf == NULL) {\n\t\tret_val = -ENOMEM;\n\t\tgoto req_setattr_failure;\n\t}\n\n\tret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr);\n\tif (ret_val < 0)\n\t\tgoto req_setattr_failure;\n\tbuf_len = ret_val;\n\n\t/* We can't use ip_options_get() directly because it makes a call to\n\t * ip_options_get_alloc() which allocates memory with GFP_KERNEL and\n\t * we won't always have CAP_NET_RAW even though we _always_ want to\n\t * set the IPOPT_CIPSO option. */\n\topt_len = (buf_len + 3) & ~3;\n\topt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC);\n\tif (opt == NULL) {\n \t\tret_val = -ENOMEM;\n \t\tgoto req_setattr_failure;\n \t}\n\tmemcpy(opt->opt.__data, buf, buf_len);\n\topt->opt.optlen = opt_len;\n\topt->opt.cipso = sizeof(struct iphdr);\n \tkfree(buf);\n \tbuf = NULL;\n \n \treq_inet = inet_rsk(req);\n \topt = xchg(&req_inet->opt, opt);\n\tif (opt)\n\t\tcall_rcu(&opt->rcu, opt_kfree_rcu);\n \n \treturn 0;\n \nreq_setattr_failure:\n\tkfree(buf);\n\tkfree(opt);\n\treturn ret_val;\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": " sample(png_const_bytep row, png_byte colour_type, png_byte bit_depth,\n png_uint_32 x, unsigned int sample_index)\n {\n png_uint_32 bit_index, result;\n \n /* Find a sample index for the desired sample: */\n x *= bit_depth;\n bit_index = x;\n\n if ((colour_type & 1) == 0) /* !palette */\n {\n if (colour_type & 2)\n bit_index *= 3;\n\n if (colour_type & 4)\n bit_index += x; /* Alpha channel */\n\n /* Multiple channels; select one: */\n if (colour_type & (2+4))\n bit_index += sample_index * bit_depth;\n }\n\n /* Return the sample from the row as an integer. */\n row += bit_index >> 3;\n result = *row;\n\n if (bit_depth == 8)\n\n return result;\n \n else if (bit_depth > 8)\n return (result << 8) + *++row;\n \n /* Less than 8 bits per sample. */\n bit_index &= 7;\n return (result >> (8-bit_index-bit_depth)) & ((1U<> 3;\n result = *row;\n\n if (bit_depth == 8)\n\n return result;\n \n else if (bit_depth > 8)\n {\n if (swap16)\n return (*++row << 8) + result;\n else\n return (result << 8) + *++row;\n }\n \n /* Less than 8 bits per sample. By default PNG has the big end of\n * the egg on the left of the screen, but if littleendian is set\n * then the big end is on the right.\n */\n bit_index &= 7;\n\n if (!littleendian)\n bit_index = 8-bit_index-bit_depth;\n\n return (result >> bit_index) & ((1U< fusion_algorithm,\n const PlatformSensorProviderBase::CreateSensorCallback& callback,\n PlatformSensorProvider* provider)\n : fusion_algorithm_(std::move(fusion_algorithm)),\n result_callback_(std::move(callback)),\n mapping_(std::move(mapping)),\n provider_(provider) {\n const auto& types = fusion_algorithm_->source_types();\n DCHECK(!types.empty());\n DCHECK(std::adjacent_find(types.begin(), types.end()) == types.end());\n DCHECK(result_callback_);\n DCHECK(mapping_);\n DCHECK(provider_);\n }\n", + "target": " Factory(mojo::ScopedSharedBufferMapping mapping,\n Factory(SensorReadingSharedBuffer* reading_buffer,\n std::unique_ptr fusion_algorithm,\n const PlatformSensorProviderBase::CreateSensorCallback& callback,\n PlatformSensorProvider* provider)\n : fusion_algorithm_(std::move(fusion_algorithm)),\n result_callback_(std::move(callback)),\n reading_buffer_(reading_buffer),\n provider_(provider) {\n const auto& types = fusion_algorithm_->source_types();\n DCHECK(!types.empty());\n DCHECK(std::adjacent_find(types.begin(), types.end()) == types.end());\n DCHECK(result_callback_);\n DCHECK(reading_buffer_);\n DCHECK(provider_);\n }\n", + "vul_type": "cwe-732", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#58feadc64d191d834b68b8218eea4ba12b052b96", + "input": " void QuotaTask::DeleteSoon() {\n MessageLoop::current()->DeleteSoon(FROM_HERE, this);\n }\n", + "target": " void QuotaTask::DeleteSoon() {\n DCHECK(original_task_runner_->BelongsToCurrentThread());\n if (delete_scheduled_)\n return;\n delete_scheduled_ = true;\n MessageLoop::current()->DeleteSoon(FROM_HERE, this);\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cde93be45a8a90d8c264c776fab63487b5038a65", + "input": "static int prepend_path(const struct path *path,\n\t\t\tconst struct path *root,\n\t\t\tchar **buffer, int *buflen)\n{\n\tstruct dentry *dentry;\n\tstruct vfsmount *vfsmnt;\n\tstruct mount *mnt;\n\tint error = 0;\n\tunsigned seq, m_seq = 0;\n\tchar *bptr;\n\tint blen;\n\n\trcu_read_lock();\nrestart_mnt:\n\tread_seqbegin_or_lock(&mount_lock, &m_seq);\n\tseq = 0;\n\trcu_read_lock();\nrestart:\n\tbptr = *buffer;\n\tblen = *buflen;\n\terror = 0;\n\tdentry = path->dentry;\n\tvfsmnt = path->mnt;\n\tmnt = real_mount(vfsmnt);\n\tread_seqbegin_or_lock(&rename_lock, &seq);\n\twhile (dentry != root->dentry || vfsmnt != root->mnt) {\n\t\tstruct dentry * parent;\n \n \t\tif (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {\n \t\t\tstruct mount *parent = ACCESS_ONCE(mnt->mnt_parent);\n \t\t\t/* Global root? */\n \t\t\tif (mnt != parent) {\n \t\t\t\tdentry = ACCESS_ONCE(mnt->mnt_mountpoint);\n\t\t\t\tmnt = parent;\n\t\t\t\tvfsmnt = &mnt->mnt;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!error)\n\t\t\t\terror = is_mounted(vfsmnt) ? 1 : 2;\n\t\t\tbreak;\n\t\t}\n\t\tparent = dentry->d_parent;\n\t\tprefetch(parent);\n\t\terror = prepend_name(&bptr, &blen, &dentry->d_name);\n\t\tif (error)\n\t\t\tbreak;\n\n\t\tdentry = parent;\n\t}\n\tif (!(seq & 1))\n\t\trcu_read_unlock();\n\tif (need_seqretry(&rename_lock, seq)) {\n\t\tseq = 1;\n\t\tgoto restart;\n\t}\n\tdone_seqretry(&rename_lock, seq);\n\n\tif (!(m_seq & 1))\n\t\trcu_read_unlock();\n\tif (need_seqretry(&mount_lock, m_seq)) {\n\t\tm_seq = 1;\n\t\tgoto restart_mnt;\n\t}\n\tdone_seqretry(&mount_lock, m_seq);\n\n\tif (error >= 0 && bptr == *buffer) {\n\t\tif (--blen < 0)\n\t\t\terror = -ENAMETOOLONG;\n\t\telse\n\t\t\t*--bptr = '/';\n\t}\n\t*buffer = bptr;\n\t*buflen = blen;\n\treturn error;\n}\n", + "target": "static int prepend_path(const struct path *path,\n\t\t\tconst struct path *root,\n\t\t\tchar **buffer, int *buflen)\n{\n\tstruct dentry *dentry;\n\tstruct vfsmount *vfsmnt;\n\tstruct mount *mnt;\n\tint error = 0;\n\tunsigned seq, m_seq = 0;\n\tchar *bptr;\n\tint blen;\n\n\trcu_read_lock();\nrestart_mnt:\n\tread_seqbegin_or_lock(&mount_lock, &m_seq);\n\tseq = 0;\n\trcu_read_lock();\nrestart:\n\tbptr = *buffer;\n\tblen = *buflen;\n\terror = 0;\n\tdentry = path->dentry;\n\tvfsmnt = path->mnt;\n\tmnt = real_mount(vfsmnt);\n\tread_seqbegin_or_lock(&rename_lock, &seq);\n\twhile (dentry != root->dentry || vfsmnt != root->mnt) {\n\t\tstruct dentry * parent;\n \n \t\tif (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {\n \t\t\tstruct mount *parent = ACCESS_ONCE(mnt->mnt_parent);\n\t\t\t/* Escaped? */\n\t\t\tif (dentry != vfsmnt->mnt_root) {\n\t\t\t\tbptr = *buffer;\n\t\t\t\tblen = *buflen;\n\t\t\t\terror = 3;\n\t\t\t\tbreak;\n\t\t\t}\n \t\t\t/* Global root? */\n \t\t\tif (mnt != parent) {\n \t\t\t\tdentry = ACCESS_ONCE(mnt->mnt_mountpoint);\n\t\t\t\tmnt = parent;\n\t\t\t\tvfsmnt = &mnt->mnt;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!error)\n\t\t\t\terror = is_mounted(vfsmnt) ? 1 : 2;\n\t\t\tbreak;\n\t\t}\n\t\tparent = dentry->d_parent;\n\t\tprefetch(parent);\n\t\terror = prepend_name(&bptr, &blen, &dentry->d_name);\n\t\tif (error)\n\t\t\tbreak;\n\n\t\tdentry = parent;\n\t}\n\tif (!(seq & 1))\n\t\trcu_read_unlock();\n\tif (need_seqretry(&rename_lock, seq)) {\n\t\tseq = 1;\n\t\tgoto restart;\n\t}\n\tdone_seqretry(&rename_lock, seq);\n\n\tif (!(m_seq & 1))\n\t\trcu_read_unlock();\n\tif (need_seqretry(&mount_lock, m_seq)) {\n\t\tm_seq = 1;\n\t\tgoto restart_mnt;\n\t}\n\tdone_seqretry(&mount_lock, m_seq);\n\n\tif (error >= 0 && bptr == *buffer) {\n\t\tif (--blen < 0)\n\t\t\terror = -ENAMETOOLONG;\n\t\telse\n\t\t\t*--bptr = '/';\n\t}\n\t*buffer = bptr;\n\t*buflen = blen;\n\treturn error;\n}\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5e5571d1a431eb3c61977b6dd6ec90186ef79867", + "input": "ReadUserLogState::SetState( const ReadUserLog::FileState &state )\n{\n\tconst ReadUserLogFileState::FileState *istate;\n\tif ( !convertState(state, istate) ) {\n\t\treturn false;\n\t}\n\n\tif ( strcmp( istate->m_signature, FileStateSignature ) ) {\n\t\tm_init_error = true;\n\t\treturn false;\n\t}\n\tif ( istate->m_version != FILESTATE_VERSION ) {\n\t\tm_init_error = true;\n\t\treturn false;\n\t}\n\n\tm_base_path = istate->m_base_path;\n\n\tm_max_rotations = istate->m_max_rotations;\n\tRotation( istate->m_rotation, false, true );\n\n\tm_log_type = istate->m_log_type;\n\tm_uniq_id = istate->m_uniq_id;\n\tm_sequence = istate->m_sequence;\n\n\tm_stat_buf.st_ino = istate->m_inode;\n\tm_stat_buf.st_ctime = istate->m_ctime;\n\tm_stat_buf.st_size = istate->m_size.asint;\n\tm_stat_valid = true;\n\n\tm_offset = istate->m_offset.asint;\n\tm_event_num = istate->m_event_num.asint;\n\n\tm_log_position = istate->m_log_position.asint;\n\tm_log_record = istate->m_log_record.asint;\n\n\tm_update_time = istate->m_update_time;\n\n\tm_initialized = true;\n \n MyString str;\n GetStateString( str, \"Restored reader state\" );\n dprintf( D_FULLDEBUG, str.Value() );\n \n return true;\n }\n", + "target": "ReadUserLogState::SetState( const ReadUserLog::FileState &state )\n{\n\tconst ReadUserLogFileState::FileState *istate;\n\tif ( !convertState(state, istate) ) {\n\t\treturn false;\n\t}\n\n\tif ( strcmp( istate->m_signature, FileStateSignature ) ) {\n\t\tm_init_error = true;\n\t\treturn false;\n\t}\n\tif ( istate->m_version != FILESTATE_VERSION ) {\n\t\tm_init_error = true;\n\t\treturn false;\n\t}\n\n\tm_base_path = istate->m_base_path;\n\n\tm_max_rotations = istate->m_max_rotations;\n\tRotation( istate->m_rotation, false, true );\n\n\tm_log_type = istate->m_log_type;\n\tm_uniq_id = istate->m_uniq_id;\n\tm_sequence = istate->m_sequence;\n\n\tm_stat_buf.st_ino = istate->m_inode;\n\tm_stat_buf.st_ctime = istate->m_ctime;\n\tm_stat_buf.st_size = istate->m_size.asint;\n\tm_stat_valid = true;\n\n\tm_offset = istate->m_offset.asint;\n\tm_event_num = istate->m_event_num.asint;\n\n\tm_log_position = istate->m_log_position.asint;\n\tm_log_record = istate->m_log_record.asint;\n\n\tm_update_time = istate->m_update_time;\n\n\tm_initialized = true;\n \n MyString str;\n GetStateString( str, \"Restored reader state\" );\n dprintf( D_FULLDEBUG, \"%s\", str.Value() );\n \n return true;\n }\n", + "vul_type": "cwe-134", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#592fd47a6245508b79fe6ac819fe6d3b2c1289be", + "input": "int mount_proc_if_needed(const char *rootfs)\n{\n\tchar path[MAXPATHLEN];\n\tchar link[20];\n\tint linklen, ret;\n\tint mypid;\n\n\tret = snprintf(path, MAXPATHLEN, \"%s/proc/self\", rootfs);\n\tif (ret < 0 || ret >= MAXPATHLEN) {\n\t\tSYSERROR(\"proc path name too long\");\n\t\treturn -1;\n\t}\n\tmemset(link, 0, 20);\n\tlinklen = readlink(path, link, 20);\n\tmypid = (int)getpid();\n\tINFO(\"I am %d, /proc/self points to '%s'\", mypid, link);\n\tret = snprintf(path, MAXPATHLEN, \"%s/proc\", rootfs);\n\tif (ret < 0 || ret >= MAXPATHLEN) {\n\t\tSYSERROR(\"proc path name too long\");\n\t\treturn -1;\n\t}\n\tif (linklen < 0) /* /proc not mounted */\n\t\tgoto domount;\n\tif (atoi(link) != mypid) {\n\t\t/* wrong /procs mounted */\n\t\tumount2(path, MNT_DETACH); /* ignore failure */\n\t\tgoto domount;\n\t}\n\t/* the right proc is already mounted */\n \treturn 0;\n \n domount:\n\tif (mount(\"proc\", path, \"proc\", 0, NULL))\n \t\treturn -1;\n \tINFO(\"Mounted /proc in container for security transition\");\n \treturn 1;\n}\n", + "target": "int mount_proc_if_needed(const char *rootfs)\n{\n\tchar path[MAXPATHLEN];\n\tchar link[20];\n\tint linklen, ret;\n\tint mypid;\n\n\tret = snprintf(path, MAXPATHLEN, \"%s/proc/self\", rootfs);\n\tif (ret < 0 || ret >= MAXPATHLEN) {\n\t\tSYSERROR(\"proc path name too long\");\n\t\treturn -1;\n\t}\n\tmemset(link, 0, 20);\n\tlinklen = readlink(path, link, 20);\n\tmypid = (int)getpid();\n\tINFO(\"I am %d, /proc/self points to '%s'\", mypid, link);\n\tret = snprintf(path, MAXPATHLEN, \"%s/proc\", rootfs);\n\tif (ret < 0 || ret >= MAXPATHLEN) {\n\t\tSYSERROR(\"proc path name too long\");\n\t\treturn -1;\n\t}\n\tif (linklen < 0) /* /proc not mounted */\n\t\tgoto domount;\n\tif (atoi(link) != mypid) {\n\t\t/* wrong /procs mounted */\n\t\tumount2(path, MNT_DETACH); /* ignore failure */\n\t\tgoto domount;\n\t}\n\t/* the right proc is already mounted */\n \treturn 0;\n \n domount:\n\tif (safe_mount(\"proc\", path, \"proc\", 0, NULL, rootfs) < 0)\n \t\treturn -1;\n \tINFO(\"Mounted /proc in container for security transition\");\n \treturn 1;\n}\n", + "vul_type": "cwe-59", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d0c31f0342cefc46a3b3d80359a9779d044d4c0d", + "input": " static void registerBlobURLFromTask(void* context)\n {\n OwnPtr blobRegistryContext = adoptPtr(static_cast(context));\n blobRegistry().registerBlobURL(blobRegistryContext->url, blobRegistryContext->srcURL);\n }\n", + "target": " static void registerBlobURLFromTask(void* context)\n {\n OwnPtr blobRegistryContext = adoptPtr(static_cast(context));\n if (WebBlobRegistry* registry = blobRegistry())\n registry->registerBlobURL(blobRegistryContext->url, blobRegistryContext->srcURL);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3c036ca040c114c077e13c35baaea78e2ddbaf61", + "input": " WebTransformationMatrix WebTransformOperations::blend(const WebTransformOperations& from, double progress) const\n {\n WebTransformationMatrix toReturn;\n bool fromIdentity = from.isIdentity();\n bool toIdentity = isIdentity();\n if (fromIdentity && toIdentity)\n return toReturn;\n if (matchesTypes(from)) {\n size_t numOperations = max(fromIdentity ? 0 : from.m_private->operations.size(),\n toIdentity ? 0 : m_private->operations.size());\n for (size_t i = 0; i < numOperations; ++i) {\n WebTransformationMatrix blended = blendTransformOperations(\n fromIdentity ? 0 : &from.m_private->operations[i],\n toIdentity ? 0 : &m_private->operations[i],\n progress);\n toReturn.multiply(blended);\n }\n } else {\n toReturn = apply();\n WebTransformationMatrix fromTransform = from.apply();\n toReturn.blend(fromTransform, progress);\n }\n return toReturn;\n }\n", + "target": " WebTransformationMatrix WebTransformOperations::blend(const WebTransformOperations& from, double progress) const\n {\n WebTransformationMatrix toReturn;\n blendInternal(from, progress, toReturn);\n return toReturn;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#10-d79fe6f8970c", + "input": "def process_as_reply(email_obj):\n job_number = email_obj['subject'].split(': #')[1]\n feedback = re.findall(\"^[\\W]*([Oo\\d]){1}(?=[\\W]*)\", email_obj['content'].replace('#','').replace('link', ''))[0]\n feedback = int(0 if feedback == ('O' or 'o') else feedback)\n dcn_key = re.findall('\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}', email_obj['content'])[0]\n logger.info(f\"got feedback `{feedback}` for job #`{job_number}`\")\n with create_connection() as conn:\n was_prev_closed = pd.read_sql(f\"SELECT * FROM df_dilfo WHERE job_number={job_number}\", conn).iloc[0].closed\n if was_prev_closed:\n logger.info(f\"job was already matched successfully and logged as `closed`... skipping.\")\n return\n if feedback == 1:\n logger.info(f\"got feeback that DCN key {dcn_key} was correct\")\n update_status_query = \"UPDATE df_dilfo SET closed = 1 WHERE job_number = {}\"\n with create_connection() as conn:\n conn.cursor().execute(update_status_query.format(job_number))\n logger.info(f\"updated df_dilfo to show `closed` status for job #{job_number}\")\n with create_connection() as conn:\n df = pd.read_sql(\"SELECT * FROM df_matched\", conn)\n match_dict_input = {\n 'job_number': job_number,\n 'dcn_key': dcn_key,\n 'ground_truth': 1 if feedback == 1 else 0,\n 'multi_phase': 1 if feedback == 2 else 0,\n 'verifier': email_obj[\"sender\"],\n 'source': 'feedback',\n 'log_date': str(datetime.datetime.now().date()),\n 'validate': 0,\n }\n df = df.append(match_dict_input, ignore_index=True)\n df = df.drop_duplicates(subset=[\"job_number\", \"dcn_key\"], keep='last')\n df.to_sql('df_matched', conn, if_exists='replace', index=False)\n logger.info(\n f\"DCN key `{dcn_key}` was a \"\n f\"{'successful match' if feedback == 1 else 'mis-match'} for job \"\n f\"#{job_number}\"\n )", + "target": "def process_as_reply(email_obj):\n job_number = email_obj['subject'].split(': #')[1]\n feedback = re.findall(\"^[\\W]*([Oo\\d]){1}(?=[\\W]*)\", email_obj['content'].replace('#','').replace('link', ''))[0]\n feedback = int(0 if feedback == ('O' or 'o') else feedback)\n dcn_key = re.findall('\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}', email_obj['content'])[0]\n logger.info(f\"got feedback `{feedback}` for job #`{job_number}`\")\n with create_connection() as conn:\n was_prev_closed = pd.read_sql(\"SELECT * FROM df_dilfo WHERE job_number=?\", conn, params=[job_number]).iloc[0].closed\n if was_prev_closed:\n logger.info(f\"job was already matched successfully and logged as `closed`... skipping.\")\n return\n if feedback == 1:\n logger.info(f\"got feeback that DCN key {dcn_key} was correct\")\n update_status_query = \"UPDATE df_dilfo SET closed = 1 WHERE job_number = ?\"\n with create_connection() as conn:\n conn.cursor().execute(update_status_query, [job_number])\n logger.info(f\"updated df_dilfo to show `closed` status for job #{job_number}\")\n with create_connection() as conn:\n df = pd.read_sql(\"SELECT * FROM df_matched\", conn)\n match_dict_input = {\n 'job_number': job_number,\n 'dcn_key': dcn_key,\n 'ground_truth': 1 if feedback == 1 else 0,\n 'multi_phase': 1 if feedback == 2 else 0,\n 'verifier': email_obj[\"sender\"],\n 'source': 'feedback',\n 'log_date': str(datetime.datetime.now().date()),\n 'validate': 0,\n }\n df = df.append(match_dict_input, ignore_index=True)\n df = df.drop_duplicates(subset=[\"job_number\", \"dcn_key\"], keep='last')\n df.to_sql('df_matched', conn, if_exists='replace', index=False)\n logger.info(\n f\"DCN key `{dcn_key}` was a \"\n f\"{'successful match' if feedback == 1 else 'mis-match'} for job \"\n f\"#{job_number}\"\n )", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#38327424b40bcebe2de92d07312c89360ac9229a", + "input": "int key_reject_and_link(struct key *key,\n\t\t\tunsigned timeout,\n\t\t\tunsigned error,\n\t\t\tstruct key *keyring,\n\t\t\tstruct key *authkey)\n{\n\tstruct assoc_array_edit *edit;\n\tstruct timespec now;\n\tint ret, awaken, link_ret = 0;\n\n\tkey_check(key);\n\tkey_check(keyring);\n\n\tawaken = 0;\n\tret = -EBUSY;\n\n\tif (keyring) {\n\t\tif (keyring->restrict_link)\n\t\t\treturn -EPERM;\n\n\t\tlink_ret = __key_link_begin(keyring, &key->index_key, &edit);\n\t}\n\n\tmutex_lock(&key_construction_mutex);\n\n\t/* can't instantiate twice */\n\tif (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {\n\t\t/* mark the key as being negatively instantiated */\n\t\tatomic_inc(&key->user->nikeys);\n\t\tkey->reject_error = -error;\n\t\tsmp_wmb();\n\t\tset_bit(KEY_FLAG_NEGATIVE, &key->flags);\n\t\tset_bit(KEY_FLAG_INSTANTIATED, &key->flags);\n\t\tnow = current_kernel_time();\n\t\tkey->expiry = now.tv_sec + timeout;\n\t\tkey_schedule_gc(key->expiry + key_gc_delay);\n\n\t\tif (test_and_clear_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags))\n\t\t\tawaken = 1;\n\n\t\tret = 0;\n\n\t\t/* and link it into the destination keyring */\n\t\tif (keyring && link_ret == 0)\n\t\t\t__key_link(key, &edit);\n\n\t\t/* disable the authorisation key */\n\t\tif (authkey)\n\t\t\tkey_revoke(authkey);\n\t}\n \n \tmutex_unlock(&key_construction_mutex);\n \n\tif (keyring)\n \t\t__key_link_end(keyring, &key->index_key, edit);\n \n \t/* wake up anyone waiting for a key to be constructed */\n\tif (awaken)\n\t\twake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);\n\n\treturn ret == 0 ? link_ret : ret;\n}\n", + "target": "int key_reject_and_link(struct key *key,\n\t\t\tunsigned timeout,\n\t\t\tunsigned error,\n\t\t\tstruct key *keyring,\n\t\t\tstruct key *authkey)\n{\n\tstruct assoc_array_edit *edit;\n\tstruct timespec now;\n\tint ret, awaken, link_ret = 0;\n\n\tkey_check(key);\n\tkey_check(keyring);\n\n\tawaken = 0;\n\tret = -EBUSY;\n\n\tif (keyring) {\n\t\tif (keyring->restrict_link)\n\t\t\treturn -EPERM;\n\n\t\tlink_ret = __key_link_begin(keyring, &key->index_key, &edit);\n\t}\n\n\tmutex_lock(&key_construction_mutex);\n\n\t/* can't instantiate twice */\n\tif (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {\n\t\t/* mark the key as being negatively instantiated */\n\t\tatomic_inc(&key->user->nikeys);\n\t\tkey->reject_error = -error;\n\t\tsmp_wmb();\n\t\tset_bit(KEY_FLAG_NEGATIVE, &key->flags);\n\t\tset_bit(KEY_FLAG_INSTANTIATED, &key->flags);\n\t\tnow = current_kernel_time();\n\t\tkey->expiry = now.tv_sec + timeout;\n\t\tkey_schedule_gc(key->expiry + key_gc_delay);\n\n\t\tif (test_and_clear_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags))\n\t\t\tawaken = 1;\n\n\t\tret = 0;\n\n\t\t/* and link it into the destination keyring */\n\t\tif (keyring && link_ret == 0)\n\t\t\t__key_link(key, &edit);\n\n\t\t/* disable the authorisation key */\n\t\tif (authkey)\n\t\t\tkey_revoke(authkey);\n\t}\n \n \tmutex_unlock(&key_construction_mutex);\n \n\tif (keyring && link_ret == 0)\n \t\t__key_link_end(keyring, &key->index_key, edit);\n \n \t/* wake up anyone waiting for a key to be constructed */\n\tif (awaken)\n\t\twake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);\n\n\treturn ret == 0 ? link_ret : ret;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4504a474c069d07104237d0c03bfce7b29a42de6", + "input": "void HTMLMediaElement::ProgressEventTimerFired(TimerBase*) {\n if (network_state_ != kNetworkLoading)\n return;\n \n double time = WTF::CurrentTime();\n double timedelta = time - previous_progress_time_;\n \n if (GetWebMediaPlayer() && GetWebMediaPlayer()->DidLoadingProgress()) {\n ScheduleEvent(EventTypeNames::progress);\n previous_progress_time_ = time;\n sent_stalled_event_ = false;\n if (GetLayoutObject())\n GetLayoutObject()->UpdateFromElement();\n } else if (timedelta > 3.0 && !sent_stalled_event_) {\n ScheduleEvent(EventTypeNames::stalled);\n sent_stalled_event_ = true;\n SetShouldDelayLoadEvent(false);\n }\n}\n", + "target": "void HTMLMediaElement::ProgressEventTimerFired(TimerBase*) {\n if (network_state_ != kNetworkLoading)\n return;\n \n // If this is an cross-origin request, and we haven't discovered whether\n // the media is actually playable yet, don't fire any progress events as\n // those may let the page know information about the resource that it's\n // not supposed to know.\n if (MediaShouldBeOpaque())\n return;\n\n double time = WTF::CurrentTime();\n double timedelta = time - previous_progress_time_;\n \n if (GetWebMediaPlayer() && GetWebMediaPlayer()->DidLoadingProgress()) {\n ScheduleEvent(EventTypeNames::progress);\n previous_progress_time_ = time;\n sent_stalled_event_ = false;\n if (GetLayoutObject())\n GetLayoutObject()->UpdateFromElement();\n } else if (timedelta > 3.0 && !sent_stalled_event_) {\n ScheduleEvent(EventTypeNames::stalled);\n sent_stalled_event_ = true;\n SetShouldDelayLoadEvent(false);\n }\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0773bb9303d24473fe1185d85a424dfe159aff53", + "input": "rdpCredssp* credssp_new(freerdp* instance, rdpTransport* transport, rdpSettings* settings)\n{\n\trdpCredssp* credssp;\n\n\tcredssp = (rdpCredssp*) malloc(sizeof(rdpCredssp));\n\tZeroMemory(credssp, sizeof(rdpCredssp));\n\n\tif (credssp != NULL)\n\t{\n\t\tHKEY hKey;\n\t\tLONG status;\n\t\tDWORD dwType;\n\t\tDWORD dwSize;\n\n\t\tcredssp->instance = instance;\n\t\tcredssp->settings = settings;\n\t\tcredssp->server = settings->ServerMode;\n\t\tcredssp->transport = transport;\n\t\tcredssp->send_seq_num = 0;\n\t\tcredssp->recv_seq_num = 0;\n \t\tZeroMemory(&credssp->negoToken, sizeof(SecBuffer));\n \t\tZeroMemory(&credssp->pubKeyAuth, sizeof(SecBuffer));\n \t\tZeroMemory(&credssp->authInfo, sizeof(SecBuffer));\n \n \t\tif (credssp->server)\n \t\t{\n\t\t\tstatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T(\"Software\\\\FreeRDP\\\\Server\"),\n\t\t\t\t\t0, KEY_READ | KEY_WOW64_64KEY, &hKey);\n\n\t\t\tif (status == ERROR_SUCCESS)\n\t\t\t{\n\t\t\t\tstatus = RegQueryValueEx(hKey, _T(\"SspiModule\"), NULL, &dwType, NULL, &dwSize);\n\n\t\t\t\tif (status == ERROR_SUCCESS)\n\t\t\t\t{\n\t\t\t\t\tcredssp->SspiModule = (LPTSTR) malloc(dwSize + sizeof(TCHAR));\n\n\t\t\t\t\tstatus = RegQueryValueEx(hKey, _T(\"SspiModule\"), NULL, &dwType,\n\t\t\t\t\t\t\t(BYTE*) credssp->SspiModule, &dwSize);\n\n\t\t\t\t\tif (status == ERROR_SUCCESS)\n\t\t\t\t\t{\n\t\t\t\t\t\t_tprintf(_T(\"Using SSPI Module: %s\\n\"), credssp->SspiModule);\n\t\t\t\t\t\tRegCloseKey(hKey);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn credssp;\n}\n", + "target": "rdpCredssp* credssp_new(freerdp* instance, rdpTransport* transport, rdpSettings* settings)\n{\n\trdpCredssp* credssp;\n\n\tcredssp = (rdpCredssp*) malloc(sizeof(rdpCredssp));\n\tZeroMemory(credssp, sizeof(rdpCredssp));\n\n\tif (credssp != NULL)\n\t{\n\t\tHKEY hKey;\n\t\tLONG status;\n\t\tDWORD dwType;\n\t\tDWORD dwSize;\n\n\t\tcredssp->instance = instance;\n\t\tcredssp->settings = settings;\n\t\tcredssp->server = settings->ServerMode;\n\t\tcredssp->transport = transport;\n\t\tcredssp->send_seq_num = 0;\n\t\tcredssp->recv_seq_num = 0;\n \t\tZeroMemory(&credssp->negoToken, sizeof(SecBuffer));\n \t\tZeroMemory(&credssp->pubKeyAuth, sizeof(SecBuffer));\n \t\tZeroMemory(&credssp->authInfo, sizeof(SecBuffer));\n\t\tSecInvalidateHandle(&credssp->context);\n \n \t\tif (credssp->server)\n \t\t{\n\t\t\tstatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T(\"Software\\\\FreeRDP\\\\Server\"),\n\t\t\t\t\t0, KEY_READ | KEY_WOW64_64KEY, &hKey);\n\n\t\t\tif (status == ERROR_SUCCESS)\n\t\t\t{\n\t\t\t\tstatus = RegQueryValueEx(hKey, _T(\"SspiModule\"), NULL, &dwType, NULL, &dwSize);\n\n\t\t\t\tif (status == ERROR_SUCCESS)\n\t\t\t\t{\n\t\t\t\t\tcredssp->SspiModule = (LPTSTR) malloc(dwSize + sizeof(TCHAR));\n\n\t\t\t\t\tstatus = RegQueryValueEx(hKey, _T(\"SspiModule\"), NULL, &dwType,\n\t\t\t\t\t\t\t(BYTE*) credssp->SspiModule, &dwSize);\n\n\t\t\t\t\tif (status == ERROR_SUCCESS)\n\t\t\t\t\t{\n\t\t\t\t\t\t_tprintf(_T(\"Using SSPI Module: %s\\n\"), credssp->SspiModule);\n\t\t\t\t\t\tRegCloseKey(hKey);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn credssp;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#295c883fe3105b19bcd0f9e07d54c6b589fc5bff", + "input": "OMX_ERRORTYPE SoftOpus::internalSetParameter(\n OMX_INDEXTYPE index, const OMX_PTR params) {\n switch ((int)index) {\n case OMX_IndexParamStandardComponentRole:\n {\n\n const OMX_PARAM_COMPONENTROLETYPE *roleParams =\n (const OMX_PARAM_COMPONENTROLETYPE *)params;\n \n if (strncmp((const char *)roleParams->cRole,\n \"audio_decoder.opus\",\n OMX_MAX_STRINGNAME_SIZE - 1)) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioAndroidOpus:\n {\n\n const OMX_AUDIO_PARAM_ANDROID_OPUSTYPE *opusParams =\n (const OMX_AUDIO_PARAM_ANDROID_OPUSTYPE *)params;\n \n if (opusParams->nPortIndex != 0) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n default:\n return SimpleSoftOMXComponent::internalSetParameter(index, params);\n }\n}\n", + "target": "OMX_ERRORTYPE SoftOpus::internalSetParameter(\n OMX_INDEXTYPE index, const OMX_PTR params) {\n switch ((int)index) {\n case OMX_IndexParamStandardComponentRole:\n {\n\n const OMX_PARAM_COMPONENTROLETYPE *roleParams =\n (const OMX_PARAM_COMPONENTROLETYPE *)params;\n \n if (!isValidOMXParam(roleParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (strncmp((const char *)roleParams->cRole,\n \"audio_decoder.opus\",\n OMX_MAX_STRINGNAME_SIZE - 1)) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n case OMX_IndexParamAudioAndroidOpus:\n {\n\n const OMX_AUDIO_PARAM_ANDROID_OPUSTYPE *opusParams =\n (const OMX_AUDIO_PARAM_ANDROID_OPUSTYPE *)params;\n \n if (!isValidOMXParam(opusParams)) {\n return OMX_ErrorBadParameter;\n }\n\n if (opusParams->nPortIndex != 0) {\n return OMX_ErrorUndefined;\n }\n\n return OMX_ErrorNone;\n }\n\n default:\n return SimpleSoftOMXComponent::internalSetParameter(index, params);\n }\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#51dfe5e3b332bcea02fb4d4c7493ae841106dd9b", + "input": " bool AudioHandler::VerifyMixerConnection() {\n PulseAudioMixer::State mixer_state = mixer_->CheckState();\n if (mixer_state == PulseAudioMixer::READY)\n return true;\n if (connected_) {\n connected_ = false;\n LOG(ERROR) << \"Lost connection to PulseAudio\";\n } else {\n LOG(ERROR) << \"Mixer not valid\";\n }\n \n if ((mixer_state == PulseAudioMixer::INITIALIZING) ||\n (mixer_state == PulseAudioMixer::SHUTTING_DOWN))\n return false;\n \n if (reconnect_tries_ < kMaxReconnectTries) {\n reconnect_tries_++;\n VLOG(1) << \"Re-connecting to PulseAudio attempt \" << reconnect_tries_ << \"/\"\n << kMaxReconnectTries;\n mixer_.reset(new PulseAudioMixer());\n connected_ = mixer_->InitSync();\n if (connected_) {\n reconnect_tries_ = 0;\n return true;\n }\n LOG(ERROR) << \"Unable to re-connect to PulseAudio\";\n }\n return false;\n }\n", + "target": " bool AudioHandler::VerifyMixerConnection() {\n if (mixer_ == NULL)\n return false;\n\n AudioMixer::State mixer_state = mixer_->GetState();\n if (mixer_state == AudioMixer::READY)\n return true;\n if (connected_) {\n connected_ = false;\n LOG(ERROR) << \"Lost connection to mixer\";\n } else {\n LOG(ERROR) << \"Mixer not valid\";\n }\n \n if ((mixer_state == AudioMixer::INITIALIZING) ||\n (mixer_state == AudioMixer::SHUTTING_DOWN))\n return false;\n \n if (reconnect_tries_ < kMaxReconnectTries) {\n reconnect_tries_++;\n VLOG(1) << \"Re-connecting to mixer attempt \" << reconnect_tries_ << \"/\"\n << kMaxReconnectTries;\n\n connected_ = TryToConnect(false);\n\n if (connected_) {\n reconnect_tries_ = 0;\n return true;\n }\n LOG(ERROR) << \"Unable to re-connect to mixer\";\n }\n return false;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#67d760ab775dae4efe803b5944b0439aa3c0b04a", + "input": "znumicc_components(i_ctx_t * i_ctx_p)\n{\n ref * pnval;\n ref * pstrmval;\n stream * s;\n int ncomps, expected = 0, code;\n cmm_profile_t *picc_profile;\n os_ptr op = osp;\n\n check_type(*op, t_dictionary);\n check_dict_read(*op);\n\n code = dict_find_string(op, \"N\", &pnval);\n if (code < 0)\n return code;\n if (code == 0)\n return code;\n if (code == 0)\n return_error(gs_error_undefined);\n ncomps = pnval->value.intval;\n /* verify the DataSource entry. Create profile from stream */\n if (dict_find_string(op, \"DataSource\", &pstrmval) <= 0)\n if (picc_profile == NULL)\n return gs_throw(gs_error_VMerror, \"Creation of ICC profile failed\");\n\n picc_profile->num_comps = ncomps;\n picc_profile->profile_handle =\n gsicc_get_profile_handle_buffer(picc_profile->buffer,\n picc_profile->buffer_size,\n gs_gstate_memory(igs));\n if (picc_profile->profile_handle == NULL) {\n rc_decrement(picc_profile,\"znumicc_components\");\n make_int(op, expected);\n return 0;\n }\n picc_profile->data_cs =\n gscms_get_profile_data_space(picc_profile->profile_handle,\n picc_profile->memory);\n\n switch (picc_profile->data_cs) {\n case gsCIEXYZ:\n case gsCIELAB:\n case gsRGB:\n expected = 3;\n break;\n case gsGRAY:\n expected = 1;\n break;\n case gsCMYK:\n expected = 4;\n break;\n case gsNCHANNEL:\n expected = 0;\n break;\n case gsNAMED:\n case gsUNDEFINED:\n expected = -1;\n break;\n }\n\n make_int(op, expected);\n\n rc_decrement(picc_profile,\"zset_outputintent\");\n return 0;\n}\n", + "target": "znumicc_components(i_ctx_t * i_ctx_p)\n{\n ref * pnval;\n ref * pstrmval;\n stream * s;\n int ncomps, expected = 0, code;\n cmm_profile_t *picc_profile;\n os_ptr op = osp;\n\n check_type(*op, t_dictionary);\n check_dict_read(*op);\n\n code = dict_find_string(op, \"N\", &pnval);\n if (code < 0)\n return code;\n if (code == 0)\n return code;\n if (code == 0)\n return_error(gs_error_undefined);\n if (r_type(pnval) != t_integer)\n return gs_note_error(gs_error_typecheck);\n ncomps = pnval->value.intval;\n /* verify the DataSource entry. Create profile from stream */\n if (dict_find_string(op, \"DataSource\", &pstrmval) <= 0)\n if (picc_profile == NULL)\n return gs_throw(gs_error_VMerror, \"Creation of ICC profile failed\");\n\n picc_profile->num_comps = ncomps;\n picc_profile->profile_handle =\n gsicc_get_profile_handle_buffer(picc_profile->buffer,\n picc_profile->buffer_size,\n gs_gstate_memory(igs));\n if (picc_profile->profile_handle == NULL) {\n rc_decrement(picc_profile,\"znumicc_components\");\n make_int(op, expected);\n return 0;\n }\n picc_profile->data_cs =\n gscms_get_profile_data_space(picc_profile->profile_handle,\n picc_profile->memory);\n\n switch (picc_profile->data_cs) {\n case gsCIEXYZ:\n case gsCIELAB:\n case gsRGB:\n expected = 3;\n break;\n case gsGRAY:\n expected = 1;\n break;\n case gsCMYK:\n expected = 4;\n break;\n case gsNCHANNEL:\n expected = 0;\n break;\n case gsNAMED:\n case gsUNDEFINED:\n expected = -1;\n break;\n }\n\n make_int(op, expected);\n\n rc_decrement(picc_profile,\"zset_outputintent\");\n return 0;\n}\n", + "vul_type": "cwe-704", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6f163e07ae68654d7ac5268cbb7565f6df79ad85", + "input": "enum ImapAuthRes imap_auth_cram_md5(struct ImapData *idata, const char *method)\n{\n char ibuf[LONG_STRING * 2], obuf[LONG_STRING];\n unsigned char hmac_response[MD5_DIGEST_LEN];\n int len;\n int rc;\n\n if (!mutt_bit_isset(idata->capabilities, ACRAM_MD5))\n return IMAP_AUTH_UNAVAIL;\n\n mutt_message(_(\"Authenticating (CRAM-MD5)...\"));\n\n /* get auth info */\n if (mutt_account_getlogin(&idata->conn->account) < 0)\n return IMAP_AUTH_FAILURE;\n if (mutt_account_getpass(&idata->conn->account) < 0)\n return IMAP_AUTH_FAILURE;\n\n imap_cmd_start(idata, \"AUTHENTICATE CRAM-MD5\");\n\n /* From RFC2195:\n * The data encoded in the first ready response contains a presumptively\n * arbitrary string of random digits, a timestamp, and the fully-qualified\n * primary host name of the server. The syntax of the unencoded form must\n * correspond to that of an RFC822 'msg-id' [RFC822] as described in [POP3].\n */\n do\n rc = imap_cmd_step(idata);\n while (rc == IMAP_CMD_CONTINUE);\n\n if (rc != IMAP_CMD_RESPOND)\n {\n mutt_debug(1, \"Invalid response from server: %s\\n\", ibuf);\n goto bail;\n }\n \n len = mutt_b64_decode(obuf, idata->buf + 2);\n if (len == -1)\n {\n mutt_debug(1, \"Error decoding base64 response.\\n\");\n goto bail;\n }\n\n obuf[len] = '\\0';\n mutt_debug(2, \"CRAM challenge: %s\\n\", obuf);\n\n /* The client makes note of the data and then responds with a string\n * consisting of the user name, a space, and a 'digest'. The latter is\n * computed by applying the keyed MD5 algorithm from [KEYED-MD5] where the\n * key is a shared secret and the digested text is the timestamp (including\n * angle-brackets).\n *\n * Note: The user name shouldn't be quoted. Since the digest can't contain\n * spaces, there is no ambiguity. Some servers get this wrong, we'll work\n * around them when the bug report comes in. Until then, we'll remain\n * blissfully RFC-compliant.\n */\n hmac_md5(idata->conn->account.pass, obuf, hmac_response);\n /* dubious optimisation I saw elsewhere: make the whole string in one call */\n int off = snprintf(obuf, sizeof(obuf), \"%s \", idata->conn->account.user);\n mutt_md5_toascii(hmac_response, obuf + off);\n mutt_debug(2, \"CRAM response: %s\\n\", obuf);\n\n /* ibuf must be long enough to store the base64 encoding of obuf,\n * plus the additional debris */\n mutt_b64_encode(ibuf, obuf, strlen(obuf), sizeof(ibuf) - 2);\n mutt_str_strcat(ibuf, sizeof(ibuf), \"\\r\\n\");\n mutt_socket_send(idata->conn, ibuf);\n\n do\n rc = imap_cmd_step(idata);\n while (rc == IMAP_CMD_CONTINUE);\n\n if (rc != IMAP_CMD_OK)\n {\n mutt_debug(1, \"Error receiving server response.\\n\");\n goto bail;\n }\n\n if (imap_code(idata->buf))\n return IMAP_AUTH_SUCCESS;\n\nbail:\n mutt_error(_(\"CRAM-MD5 authentication failed.\"));\n return IMAP_AUTH_FAILURE;\n}\n", + "target": "enum ImapAuthRes imap_auth_cram_md5(struct ImapData *idata, const char *method)\n{\n char ibuf[LONG_STRING * 2], obuf[LONG_STRING];\n unsigned char hmac_response[MD5_DIGEST_LEN];\n int len;\n int rc;\n\n if (!mutt_bit_isset(idata->capabilities, ACRAM_MD5))\n return IMAP_AUTH_UNAVAIL;\n\n mutt_message(_(\"Authenticating (CRAM-MD5)...\"));\n\n /* get auth info */\n if (mutt_account_getlogin(&idata->conn->account) < 0)\n return IMAP_AUTH_FAILURE;\n if (mutt_account_getpass(&idata->conn->account) < 0)\n return IMAP_AUTH_FAILURE;\n\n imap_cmd_start(idata, \"AUTHENTICATE CRAM-MD5\");\n\n /* From RFC2195:\n * The data encoded in the first ready response contains a presumptively\n * arbitrary string of random digits, a timestamp, and the fully-qualified\n * primary host name of the server. The syntax of the unencoded form must\n * correspond to that of an RFC822 'msg-id' [RFC822] as described in [POP3].\n */\n do\n rc = imap_cmd_step(idata);\n while (rc == IMAP_CMD_CONTINUE);\n\n if (rc != IMAP_CMD_RESPOND)\n {\n mutt_debug(1, \"Invalid response from server: %s\\n\", ibuf);\n goto bail;\n }\n \n len = mutt_b64_decode(obuf, idata->buf + 2, sizeof(obuf));\n if (len == -1)\n {\n mutt_debug(1, \"Error decoding base64 response.\\n\");\n goto bail;\n }\n\n obuf[len] = '\\0';\n mutt_debug(2, \"CRAM challenge: %s\\n\", obuf);\n\n /* The client makes note of the data and then responds with a string\n * consisting of the user name, a space, and a 'digest'. The latter is\n * computed by applying the keyed MD5 algorithm from [KEYED-MD5] where the\n * key is a shared secret and the digested text is the timestamp (including\n * angle-brackets).\n *\n * Note: The user name shouldn't be quoted. Since the digest can't contain\n * spaces, there is no ambiguity. Some servers get this wrong, we'll work\n * around them when the bug report comes in. Until then, we'll remain\n * blissfully RFC-compliant.\n */\n hmac_md5(idata->conn->account.pass, obuf, hmac_response);\n /* dubious optimisation I saw elsewhere: make the whole string in one call */\n int off = snprintf(obuf, sizeof(obuf), \"%s \", idata->conn->account.user);\n mutt_md5_toascii(hmac_response, obuf + off);\n mutt_debug(2, \"CRAM response: %s\\n\", obuf);\n\n /* ibuf must be long enough to store the base64 encoding of obuf,\n * plus the additional debris */\n mutt_b64_encode(ibuf, obuf, strlen(obuf), sizeof(ibuf) - 2);\n mutt_str_strcat(ibuf, sizeof(ibuf), \"\\r\\n\");\n mutt_socket_send(idata->conn, ibuf);\n\n do\n rc = imap_cmd_step(idata);\n while (rc == IMAP_CMD_CONTINUE);\n\n if (rc != IMAP_CMD_OK)\n {\n mutt_debug(1, \"Error receiving server response.\\n\");\n goto bail;\n }\n\n if (imap_code(idata->buf))\n return IMAP_AUTH_SUCCESS;\n\nbail:\n mutt_error(_(\"CRAM-MD5 authentication failed.\"));\n return IMAP_AUTH_FAILURE;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#07908124838afcc99c577d1d3e84cef2dbd39cb7", + "input": "void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new)\n{\n unsigned char *data = NULL;\n int size;\n loff_t offs;\n\n if (new == -1)\n\tnew = FAT_EOF(fs);\n else if ((long)new == -2)\n\tnew = FAT_BAD(fs);\n switch (fs->fat_bits) {\n case 12:\n\tdata = fs->fat + cluster * 3 / 2;\n\toffs = fs->fat_start + cluster * 3 / 2;\n\tif (cluster & 1) {\n\t FAT_ENTRY prevEntry;\n\t get_fat(&prevEntry, fs->fat, cluster - 1, fs);\n\t data[0] = ((new & 0xf) << 4) | (prevEntry.value >> 8);\n \t data[1] = new >> 4;\n \t} else {\n \t FAT_ENTRY subseqEntry;\n\t if (cluster != fs->clusters - 1)\n \t\tget_fat(&subseqEntry, fs->fat, cluster + 1, fs);\n \t else\n \t\tsubseqEntry.value = 0;\n\t data[0] = new & 0xff;\n\t data[1] = (new >> 8) | ((0xff & subseqEntry.value) << 4);\n\t}\n\tsize = 2;\n\tbreak;\n case 16:\n\tdata = fs->fat + cluster * 2;\n\toffs = fs->fat_start + cluster * 2;\n\t*(unsigned short *)data = htole16(new);\n\tsize = 2;\n\tbreak;\n case 32:\n\t{\n\t FAT_ENTRY curEntry;\n\t get_fat(&curEntry, fs->fat, cluster, fs);\n\n\t data = fs->fat + cluster * 4;\n\t offs = fs->fat_start + cluster * 4;\n\t /* According to M$, the high 4 bits of a FAT32 entry are reserved and\n\t * are not part of the cluster number. So we never touch them. */\n\t *(uint32_t *)data = htole32((new & 0xfffffff) |\n\t\t\t\t\t (curEntry.reserved << 28));\n\t size = 4;\n\t}\n\tbreak;\n default:\n\tdie(\"Bad FAT entry size: %d bits.\", fs->fat_bits);\n }\n fs_write(offs, size, data);\n if (fs->nfats > 1) {\n\tfs_write(offs + fs->fat_size, size, data);\n }\n}\n", + "target": "void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new)\n{\n unsigned char *data = NULL;\n int size;\n loff_t offs;\n\n if (new == -1)\n\tnew = FAT_EOF(fs);\n else if ((long)new == -2)\n\tnew = FAT_BAD(fs);\n switch (fs->fat_bits) {\n case 12:\n\tdata = fs->fat + cluster * 3 / 2;\n\toffs = fs->fat_start + cluster * 3 / 2;\n\tif (cluster & 1) {\n\t FAT_ENTRY prevEntry;\n\t get_fat(&prevEntry, fs->fat, cluster - 1, fs);\n\t data[0] = ((new & 0xf) << 4) | (prevEntry.value >> 8);\n \t data[1] = new >> 4;\n \t} else {\n \t FAT_ENTRY subseqEntry;\n\t if (cluster != fs->clusters + 1)\n \t\tget_fat(&subseqEntry, fs->fat, cluster + 1, fs);\n \t else\n \t\tsubseqEntry.value = 0;\n\t data[0] = new & 0xff;\n\t data[1] = (new >> 8) | ((0xff & subseqEntry.value) << 4);\n\t}\n\tsize = 2;\n\tbreak;\n case 16:\n\tdata = fs->fat + cluster * 2;\n\toffs = fs->fat_start + cluster * 2;\n\t*(unsigned short *)data = htole16(new);\n\tsize = 2;\n\tbreak;\n case 32:\n\t{\n\t FAT_ENTRY curEntry;\n\t get_fat(&curEntry, fs->fat, cluster, fs);\n\n\t data = fs->fat + cluster * 4;\n\t offs = fs->fat_start + cluster * 4;\n\t /* According to M$, the high 4 bits of a FAT32 entry are reserved and\n\t * are not part of the cluster number. So we never touch them. */\n\t *(uint32_t *)data = htole32((new & 0xfffffff) |\n\t\t\t\t\t (curEntry.reserved << 28));\n\t size = 4;\n\t}\n\tbreak;\n default:\n\tdie(\"Bad FAT entry size: %d bits.\", fs->fat_bits);\n }\n fs_write(offs, size, data);\n if (fs->nfats > 1) {\n\tfs_write(offs + fs->fat_size, size, data);\n }\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#83ed75feba32e46f736fcce0d96a0445f29b96c2", + "input": "chpass_principal3_2_svc(chpass3_arg *arg, struct svc_req *rqstp)\n {\n static generic_ret ret;\n char *prime_arg;\n gss_buffer_desc client_name,\n service_name;\n OM_uint32 minor_stat;\n kadm5_server_handle_t handle;\n const char *errmsg = NULL;\n\n xdr_free(xdr_generic_ret, &ret);\n\n if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle)))\n goto exit_func;\n\n if ((ret.code = check_handle((void *)handle)))\n goto exit_func;\n\n ret.api_version = handle->api_version;\n\n if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {\n ret.code = KADM5_FAILURE;\n goto exit_func;\n }\n if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) {\n ret.code = KADM5_BAD_PRINCIPAL;\n goto exit_func;\n }\n\n if (cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ)) {\n ret.code = chpass_principal_wrapper_3((void *)handle, arg->princ,\n arg->keepold,\n arg->n_ks_tuple,\n arg->ks_tuple,\n arg->pass);\n } else if (!(CHANGEPW_SERVICE(rqstp)) &&\n kadm5int_acl_check(handle->context, rqst2name(rqstp),\n ACL_CHANGEPW, arg->princ, NULL)) {\n ret.code = kadm5_chpass_principal_3((void *)handle, arg->princ,\n arg->keepold,\n arg->n_ks_tuple,\n arg->ks_tuple,\n arg->pass);\n } else {\n log_unauth(\"kadm5_chpass_principal\", prime_arg,\n &client_name, &service_name, rqstp);\n ret.code = KADM5_AUTH_CHANGEPW;\n }\n\n if(ret.code != KADM5_AUTH_CHANGEPW) {\n if( ret.code != 0 )\n errmsg = krb5_get_error_message(handle->context, ret.code);\n\n log_done(\"kadm5_chpass_principal\", prime_arg, errmsg,\n &client_name, &service_name, rqstp);\n\n if (errmsg != NULL)\n krb5_free_error_message(handle->context, errmsg);\n }\n \n free(prime_arg);\n gss_release_buffer(&minor_stat, &client_name);\n gss_release_buffer(&minor_stat, &service_name);\nexit_func:\n free_server_handle(handle);\n return &ret;\n }\n", + "target": "chpass_principal3_2_svc(chpass3_arg *arg, struct svc_req *rqstp)\n {\n static generic_ret ret;\n char *prime_arg;\n gss_buffer_desc client_name = GSS_C_EMPTY_BUFFER;\n gss_buffer_desc service_name = GSS_C_EMPTY_BUFFER;\n OM_uint32 minor_stat;\n kadm5_server_handle_t handle;\n const char *errmsg = NULL;\n\n xdr_free(xdr_generic_ret, &ret);\n\n if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle)))\n goto exit_func;\n\n if ((ret.code = check_handle((void *)handle)))\n goto exit_func;\n\n ret.api_version = handle->api_version;\n\n if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {\n ret.code = KADM5_FAILURE;\n goto exit_func;\n }\n if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) {\n ret.code = KADM5_BAD_PRINCIPAL;\n goto exit_func;\n }\n\n if (cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ)) {\n ret.code = chpass_principal_wrapper_3((void *)handle, arg->princ,\n arg->keepold,\n arg->n_ks_tuple,\n arg->ks_tuple,\n arg->pass);\n } else if (!(CHANGEPW_SERVICE(rqstp)) &&\n kadm5int_acl_check(handle->context, rqst2name(rqstp),\n ACL_CHANGEPW, arg->princ, NULL)) {\n ret.code = kadm5_chpass_principal_3((void *)handle, arg->princ,\n arg->keepold,\n arg->n_ks_tuple,\n arg->ks_tuple,\n arg->pass);\n } else {\n log_unauth(\"kadm5_chpass_principal\", prime_arg,\n &client_name, &service_name, rqstp);\n ret.code = KADM5_AUTH_CHANGEPW;\n }\n\n if(ret.code != KADM5_AUTH_CHANGEPW) {\n if( ret.code != 0 )\n errmsg = krb5_get_error_message(handle->context, ret.code);\n\n log_done(\"kadm5_chpass_principal\", prime_arg, errmsg,\n &client_name, &service_name, rqstp);\n\n if (errmsg != NULL)\n krb5_free_error_message(handle->context, errmsg);\n }\n \n free(prime_arg);\nexit_func:\n gss_release_buffer(&minor_stat, &client_name);\n gss_release_buffer(&minor_stat, &service_name);\n free_server_handle(handle);\n return &ret;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0f177948ae2640bfe4d70f8e4248e106406b3b0a", + "input": "status_t OMXNodeInstance::configureVideoTunnelMode(\n\n OMX_U32 portIndex, OMX_BOOL tunneled, OMX_U32 audioHwSync,\n native_handle_t **sidebandHandle) {\n Mutex::Autolock autolock(mLock);\n CLOG_CONFIG(configureVideoTunnelMode, \"%s:%u tun=%d sync=%u\",\n portString(portIndex), portIndex, tunneled, audioHwSync);\n \n OMX_INDEXTYPE index;\n OMX_STRING name = const_cast(\n \"OMX.google.android.index.configureVideoTunnelMode\");\n\n OMX_ERRORTYPE err = OMX_GetExtensionIndex(mHandle, name, &index);\n if (err != OMX_ErrorNone) {\n CLOG_ERROR_IF(tunneled, getExtensionIndex, err, \"%s\", name);\n return StatusFromOMXError(err);\n }\n\n ConfigureVideoTunnelModeParams tunnelParams;\n InitOMXParams(&tunnelParams);\n tunnelParams.nPortIndex = portIndex;\n tunnelParams.bTunneled = tunneled;\n tunnelParams.nAudioHwSync = audioHwSync;\n err = OMX_SetParameter(mHandle, index, &tunnelParams);\n if (err != OMX_ErrorNone) {\n CLOG_ERROR(setParameter, err, \"%s(%#x): %s:%u tun=%d sync=%u\", name, index,\n portString(portIndex), portIndex, tunneled, audioHwSync);\n return StatusFromOMXError(err);\n }\n\n err = OMX_GetParameter(mHandle, index, &tunnelParams);\n if (err != OMX_ErrorNone) {\n CLOG_ERROR(getParameter, err, \"%s(%#x): %s:%u tun=%d sync=%u\", name, index,\n portString(portIndex), portIndex, tunneled, audioHwSync);\n return StatusFromOMXError(err);\n }\n if (sidebandHandle) {\n *sidebandHandle = (native_handle_t*)tunnelParams.pSidebandWindow;\n }\n\n return OK;\n}\n", + "target": "status_t OMXNodeInstance::configureVideoTunnelMode(\n\n OMX_U32 portIndex, OMX_BOOL tunneled, OMX_U32 audioHwSync,\n native_handle_t **sidebandHandle) {\n Mutex::Autolock autolock(mLock);\n if (mSailed) {\n android_errorWriteLog(0x534e4554, \"29422020\");\n return INVALID_OPERATION;\n }\n CLOG_CONFIG(configureVideoTunnelMode, \"%s:%u tun=%d sync=%u\",\n portString(portIndex), portIndex, tunneled, audioHwSync);\n \n OMX_INDEXTYPE index;\n OMX_STRING name = const_cast(\n \"OMX.google.android.index.configureVideoTunnelMode\");\n\n OMX_ERRORTYPE err = OMX_GetExtensionIndex(mHandle, name, &index);\n if (err != OMX_ErrorNone) {\n CLOG_ERROR_IF(tunneled, getExtensionIndex, err, \"%s\", name);\n return StatusFromOMXError(err);\n }\n\n ConfigureVideoTunnelModeParams tunnelParams;\n InitOMXParams(&tunnelParams);\n tunnelParams.nPortIndex = portIndex;\n tunnelParams.bTunneled = tunneled;\n tunnelParams.nAudioHwSync = audioHwSync;\n err = OMX_SetParameter(mHandle, index, &tunnelParams);\n if (err != OMX_ErrorNone) {\n CLOG_ERROR(setParameter, err, \"%s(%#x): %s:%u tun=%d sync=%u\", name, index,\n portString(portIndex), portIndex, tunneled, audioHwSync);\n return StatusFromOMXError(err);\n }\n\n err = OMX_GetParameter(mHandle, index, &tunnelParams);\n if (err != OMX_ErrorNone) {\n CLOG_ERROR(getParameter, err, \"%s(%#x): %s:%u tun=%d sync=%u\", name, index,\n portString(portIndex), portIndex, tunneled, audioHwSync);\n return StatusFromOMXError(err);\n }\n if (sidebandHandle) {\n *sidebandHandle = (native_handle_t*)tunnelParams.pSidebandWindow;\n }\n\n return OK;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6c5211a0cef0cc2854eaa387e0eb036e012904d0?w=1", + "input": "PHP_FUNCTION(mcrypt_generic)\n{\n\tzval *mcryptind;\n\tchar *data;\n\tint data_len;\n\tphp_mcrypt *pm;\n\tunsigned char* data_s;\n\tint block_size, data_size;\n\n \tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rs\", &mcryptind, &data, &data_len) == FAILURE) {\n \t\treturn;\n \t}\n \tZEND_FETCH_RESOURCE(pm, php_mcrypt *, &mcryptind, -1, \"MCrypt\", le_mcrypt);\n \tPHP_MCRYPT_INIT_CHECK\n \n\tif (data_len == 0) {\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"An empty string was passed\");\n\t\tRETURN_FALSE\n\t}\n\n\t/* Check blocksize */\n \tif (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */\n \t\tblock_size = mcrypt_enc_get_block_size(pm->td);\n \t\tdata_size = (((data_len - 1) / block_size) + 1) * block_size;\n \t\tdata_s = emalloc(data_size + 1);\n \t\tmemset(data_s, 0, data_size);\n \t\tmemcpy(data_s, data, data_len);\n\t} else { /* It's not a block algorithm */\n\t\tdata_size = data_len;\n\t\tdata_s = emalloc(data_size + 1);\n \t\tmemset(data_s, 0, data_size);\n \t\tmemcpy(data_s, data, data_len);\n \t}\n \tmcrypt_generic(pm->td, data_s, data_size);\n \tdata_s[data_size] = '\\0';\n \n\tRETVAL_STRINGL(data_s, data_size, 1);\n\tefree(data_s);\n}\n", + "target": "PHP_FUNCTION(mcrypt_generic)\n{\n\tzval *mcryptind;\n\tchar *data;\n\tint data_len;\n\tphp_mcrypt *pm;\n\tunsigned char* data_s;\n\tint block_size, data_size;\n\n \tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rs\", &mcryptind, &data, &data_len) == FAILURE) {\n \t\treturn;\n \t}\n\n \tZEND_FETCH_RESOURCE(pm, php_mcrypt *, &mcryptind, -1, \"MCrypt\", le_mcrypt);\n \tPHP_MCRYPT_INIT_CHECK\n \n\tif (data_len == 0) {\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"An empty string was passed\");\n\t\tRETURN_FALSE\n\t}\n\n\t/* Check blocksize */\n \tif (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */\n \t\tblock_size = mcrypt_enc_get_block_size(pm->td);\n \t\tdata_size = (((data_len - 1) / block_size) + 1) * block_size;\n\t\tif (data_size <= 0) {\n\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Integer overflow in data size\");\n\t\t\tRETURN_FALSE;\n\t\t}\n \t\tdata_s = emalloc(data_size + 1);\n \t\tmemset(data_s, 0, data_size);\n \t\tmemcpy(data_s, data, data_len);\n\t} else { /* It's not a block algorithm */\n\t\tdata_size = data_len;\n\t\tdata_s = emalloc(data_size + 1);\n \t\tmemset(data_s, 0, data_size);\n \t\tmemcpy(data_s, data, data_len);\n \t}\n\n \tmcrypt_generic(pm->td, data_s, data_size);\n \tdata_s[data_size] = '\\0';\n \n\tRETVAL_STRINGL(data_s, data_size, 1);\n\tefree(data_s);\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9a6bce9b615abca6068348c1606ba8eaf13d9ae0", + "input": "my_object_error_quark (void)\n{\n static GQuark quark = 0;\n if (!quark)\n quark = g_quark_from_static_string (\"my_object_error\");\n return quark;\n}\n", + "target": "my_object_error_quark (void)\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#91f2fa59e8ed80dfbf400add0164ee0e508e412a", + "input": "void cJSON_InitHooks(cJSON_Hooks* hooks)\n {\n\tif ( ! hooks ) {\n\t\t/* Reset hooks. */\n\t\tcJSON_malloc = malloc;\n\t\tcJSON_free = free;\n\t\treturn;\n\t}\n\tcJSON_malloc = (hooks->malloc_fn) ? hooks->malloc_fn : malloc;\n\tcJSON_free = (hooks->free_fn) ? hooks->free_fn : free;\n}\n", + "target": "void cJSON_InitHooks(cJSON_Hooks* hooks)\nstatic char* cJSON_strdup(const char* str)\n {\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6ed26f014f76f10e76e80636027a2db9dcbe1664", + "input": "void BaseRenderingContext2D::setStrokeStyle(\n const StringOrCanvasGradientOrCanvasPattern& style) {\n DCHECK(!style.IsNull());\n\n String color_string;\n CanvasStyle* canvas_style = nullptr;\n if (style.IsString()) {\n color_string = style.GetAsString();\n if (color_string == GetState().UnparsedStrokeColor())\n return;\n Color parsed_color = 0;\n if (!ParseColorOrCurrentColor(parsed_color, color_string))\n return;\n if (GetState().StrokeStyle()->IsEquivalentRGBA(parsed_color.Rgb())) {\n ModifiableState().SetUnparsedStrokeColor(color_string);\n return;\n }\n canvas_style = CanvasStyle::CreateFromRGBA(parsed_color.Rgb());\n } else if (style.IsCanvasGradient()) {\n canvas_style = CanvasStyle::CreateFromGradient(style.GetAsCanvasGradient());\n } else if (style.IsCanvasPattern()) {\n CanvasPattern* canvas_pattern = style.GetAsCanvasPattern();\n \n if (OriginClean() && !canvas_pattern->OriginClean()) {\n SetOriginTainted();\n ClearResolvedFilters();\n }\n \n canvas_style = CanvasStyle::CreateFromPattern(canvas_pattern);\n }\n\n DCHECK(canvas_style);\n\n ModifiableState().SetStrokeStyle(canvas_style);\n ModifiableState().SetUnparsedStrokeColor(color_string);\n ModifiableState().ClearResolvedFilter();\n}\n", + "target": "void BaseRenderingContext2D::setStrokeStyle(\n const StringOrCanvasGradientOrCanvasPattern& style) {\n DCHECK(!style.IsNull());\n\n String color_string;\n CanvasStyle* canvas_style = nullptr;\n if (style.IsString()) {\n color_string = style.GetAsString();\n if (color_string == GetState().UnparsedStrokeColor())\n return;\n Color parsed_color = 0;\n if (!ParseColorOrCurrentColor(parsed_color, color_string))\n return;\n if (GetState().StrokeStyle()->IsEquivalentRGBA(parsed_color.Rgb())) {\n ModifiableState().SetUnparsedStrokeColor(color_string);\n return;\n }\n canvas_style = CanvasStyle::CreateFromRGBA(parsed_color.Rgb());\n } else if (style.IsCanvasGradient()) {\n canvas_style = CanvasStyle::CreateFromGradient(style.GetAsCanvasGradient());\n } else if (style.IsCanvasPattern()) {\n CanvasPattern* canvas_pattern = style.GetAsCanvasPattern();\n \n if (!origin_tainted_by_content_ && !canvas_pattern->OriginClean())\n SetOriginTaintedByContent();\n \n canvas_style = CanvasStyle::CreateFromPattern(canvas_pattern);\n }\n\n DCHECK(canvas_style);\n\n ModifiableState().SetStrokeStyle(canvas_style);\n ModifiableState().SetUnparsedStrokeColor(color_string);\n ModifiableState().ClearResolvedFilter();\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b399a05453d7b3e2dfdec67865fefe6953bcc59e", + "input": "RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host,\n bool is_guest_view_hack)\n : host_(RenderWidgetHostImpl::From(host)),\n window_(nullptr),\n in_shutdown_(false),\n in_bounds_changed_(false),\n popup_parent_host_view_(nullptr),\n popup_child_host_view_(nullptr),\n is_loading_(false),\n has_composition_text_(false),\n background_color_(SK_ColorWHITE),\n needs_begin_frames_(false),\n needs_flush_input_(false),\n added_frame_observer_(false),\n cursor_visibility_state_in_renderer_(UNKNOWN),\n#if defined(OS_WIN)\n legacy_render_widget_host_HWND_(nullptr),\n legacy_window_destroyed_(false),\n virtual_keyboard_requested_(false),\n#endif\n has_snapped_to_boundary_(false),\n is_guest_view_hack_(is_guest_view_hack),\n device_scale_factor_(0.0f),\n event_handler_(new RenderWidgetHostViewEventHandler(host_, this, this)),\n weak_ptr_factory_(this) {\n if (!is_guest_view_hack_)\n host_->SetView(this);\n\n if (GetTextInputManager())\n GetTextInputManager()->AddObserver(this);\n\n bool overscroll_enabled = base::CommandLine::ForCurrentProcess()->\n GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != \"0\";\n SetOverscrollControllerEnabled(overscroll_enabled);\n\n selection_controller_client_.reset(\n new TouchSelectionControllerClientAura(this));\n CreateSelectionController();\n\n RenderViewHost* rvh = RenderViewHost::From(host_);\n if (rvh) {\n ignore_result(rvh->GetWebkitPreferences());\n }\n}\n", + "target": "RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host,\n bool is_guest_view_hack)\n : host_(RenderWidgetHostImpl::From(host)),\n window_(nullptr),\n in_shutdown_(false),\n in_bounds_changed_(false),\n popup_parent_host_view_(nullptr),\n popup_child_host_view_(nullptr),\n is_loading_(false),\n has_composition_text_(false),\n background_color_(SK_ColorWHITE),\n needs_begin_frames_(false),\n needs_flush_input_(false),\n added_frame_observer_(false),\n cursor_visibility_state_in_renderer_(UNKNOWN),\n#if defined(OS_WIN)\n legacy_render_widget_host_HWND_(nullptr),\n legacy_window_destroyed_(false),\n virtual_keyboard_requested_(false),\n#endif\n has_snapped_to_boundary_(false),\n is_guest_view_hack_(is_guest_view_hack),\n device_scale_factor_(0.0f),\n event_handler_(new RenderWidgetHostViewEventHandler(host_, this, this)),\n frame_sink_id_(host_->AllocateFrameSinkId(is_guest_view_hack_)),\n weak_ptr_factory_(this) {\n if (!is_guest_view_hack_)\n host_->SetView(this);\n\n if (GetTextInputManager())\n GetTextInputManager()->AddObserver(this);\n\n bool overscroll_enabled = base::CommandLine::ForCurrentProcess()->\n GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != \"0\";\n SetOverscrollControllerEnabled(overscroll_enabled);\n\n selection_controller_client_.reset(\n new TouchSelectionControllerClientAura(this));\n CreateSelectionController();\n\n RenderViewHost* rvh = RenderViewHost::From(host_);\n if (rvh) {\n ignore_result(rvh->GetWebkitPreferences());\n }\n}\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8934a7d6307267d301182f19ed162563717e29e3", + "input": "telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print)\n{\n\tint i, x;\n\tu_int c;\n\tconst u_char *osp, *p;\n#define FETCH(c, sp, length) \\\n\tdo { \\\n\t\tif (length < 1) \\\n\t\t\tgoto pktend; \\\n\t\tND_TCHECK(*sp); \\\n\t\tc = *sp++; \\\n\t\tlength--; \\\n\t} while (0)\n\n\tosp = sp;\n\n\tFETCH(c, sp, length);\n\tif (c != IAC)\n\t\tgoto pktend;\n\tFETCH(c, sp, length);\n\tif (c == IAC) {\t\t/* ! */\n\t\tif (print)\n\t\t\tND_PRINT((ndo, \"IAC IAC\"));\n\t\tgoto done;\n\t}\n\n\ti = c - TELCMD_FIRST;\n\tif (i < 0 || i > IAC - TELCMD_FIRST)\n\t\tgoto pktend;\n\n\tswitch (c) {\n\tcase DONT:\n\tcase DO:\n\tcase WONT:\n\tcase WILL:\n\tcase SB:\n\t\t/* DONT/DO/WONT/WILL x */\n\t\tFETCH(x, sp, length);\n\t\tif (x >= 0 && x < NTELOPTS) {\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \"%s %s\", telcmds[i], telopts[x]));\n\t\t} else {\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \"%s %#x\", telcmds[i], x));\n\t\t}\n\t\tif (c != SB)\n\t\t\tbreak;\n\t\t/* IAC SB .... IAC SE */\n\t\tp = sp;\n\t\twhile (length > (u_int)(p + 1 - sp)) {\n\t\t\tND_TCHECK2(*p, 2);\n\t\t\tif (p[0] == IAC && p[1] == SE)\n \t\t\t\tbreak;\n \t\t\tp++;\n \t\t}\n \t\tif (*p != IAC)\n \t\t\tgoto pktend;\n \n\t\tswitch (x) {\n\t\tcase TELOPT_AUTHENTICATION:\n\t\t\tif (p <= sp)\n\t\t\t\tbreak;\n\t\t\tFETCH(c, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %s\", STR_OR_ID(c, authcmd)));\n\t\t\tif (p <= sp)\n\t\t\t\tbreak;\n\t\t\tFETCH(c, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %s\", STR_OR_ID(c, authtype)));\n\t\t\tbreak;\n\t\tcase TELOPT_ENCRYPT:\n\t\t\tif (p <= sp)\n\t\t\t\tbreak;\n\t\t\tFETCH(c, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %s\", STR_OR_ID(c, enccmd)));\n\t\t\tif (p <= sp)\n\t\t\t\tbreak;\n\t\t\tFETCH(c, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %s\", STR_OR_ID(c, enctype)));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (p <= sp)\n\t\t\t\tbreak;\n\t\t\tFETCH(c, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %s\", STR_OR_ID(c, cmds)));\n\t\t\tbreak;\n\t\t}\n\t\twhile (p > sp) {\n\t\t\tFETCH(x, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %#x\", x));\n\t\t}\n\t\t/* terminating IAC SE */\n\t\tif (print)\n\t\t\tND_PRINT((ndo, \" SE\"));\n\t\tsp += 2;\n\t\tbreak;\n\tdefault:\n\t\tif (print)\n\t\t\tND_PRINT((ndo, \"%s\", telcmds[i]));\n\t\tgoto done;\n\t}\n\ndone:\n\treturn sp - osp;\n\ntrunc:\n\tND_PRINT((ndo, \"%s\", tstr));\npktend:\n\treturn -1;\n#undef FETCH\n}\n", + "target": "telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print)\n{\n\tint i, x;\n\tu_int c;\n\tconst u_char *osp, *p;\n#define FETCH(c, sp, length) \\\n\tdo { \\\n\t\tif (length < 1) \\\n\t\t\tgoto pktend; \\\n\t\tND_TCHECK(*sp); \\\n\t\tc = *sp++; \\\n\t\tlength--; \\\n\t} while (0)\n\n\tosp = sp;\n\n\tFETCH(c, sp, length);\n\tif (c != IAC)\n\t\tgoto pktend;\n\tFETCH(c, sp, length);\n\tif (c == IAC) {\t\t/* ! */\n\t\tif (print)\n\t\t\tND_PRINT((ndo, \"IAC IAC\"));\n\t\tgoto done;\n\t}\n\n\ti = c - TELCMD_FIRST;\n\tif (i < 0 || i > IAC - TELCMD_FIRST)\n\t\tgoto pktend;\n\n\tswitch (c) {\n\tcase DONT:\n\tcase DO:\n\tcase WONT:\n\tcase WILL:\n\tcase SB:\n\t\t/* DONT/DO/WONT/WILL x */\n\t\tFETCH(x, sp, length);\n\t\tif (x >= 0 && x < NTELOPTS) {\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \"%s %s\", telcmds[i], telopts[x]));\n\t\t} else {\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \"%s %#x\", telcmds[i], x));\n\t\t}\n\t\tif (c != SB)\n\t\t\tbreak;\n\t\t/* IAC SB .... IAC SE */\n\t\tp = sp;\n\t\twhile (length > (u_int)(p + 1 - sp)) {\n\t\t\tND_TCHECK2(*p, 2);\n\t\t\tif (p[0] == IAC && p[1] == SE)\n \t\t\t\tbreak;\n \t\t\tp++;\n \t\t}\n\t\tND_TCHECK(*p);\n \t\tif (*p != IAC)\n \t\t\tgoto pktend;\n \n\t\tswitch (x) {\n\t\tcase TELOPT_AUTHENTICATION:\n\t\t\tif (p <= sp)\n\t\t\t\tbreak;\n\t\t\tFETCH(c, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %s\", STR_OR_ID(c, authcmd)));\n\t\t\tif (p <= sp)\n\t\t\t\tbreak;\n\t\t\tFETCH(c, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %s\", STR_OR_ID(c, authtype)));\n\t\t\tbreak;\n\t\tcase TELOPT_ENCRYPT:\n\t\t\tif (p <= sp)\n\t\t\t\tbreak;\n\t\t\tFETCH(c, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %s\", STR_OR_ID(c, enccmd)));\n\t\t\tif (p <= sp)\n\t\t\t\tbreak;\n\t\t\tFETCH(c, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %s\", STR_OR_ID(c, enctype)));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (p <= sp)\n\t\t\t\tbreak;\n\t\t\tFETCH(c, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %s\", STR_OR_ID(c, cmds)));\n\t\t\tbreak;\n\t\t}\n\t\twhile (p > sp) {\n\t\t\tFETCH(x, sp, length);\n\t\t\tif (print)\n\t\t\t\tND_PRINT((ndo, \" %#x\", x));\n\t\t}\n\t\t/* terminating IAC SE */\n\t\tif (print)\n\t\t\tND_PRINT((ndo, \" SE\"));\n\t\tsp += 2;\n\t\tbreak;\n\tdefault:\n\t\tif (print)\n\t\t\tND_PRINT((ndo, \"%s\", telcmds[i]));\n\t\tgoto done;\n\t}\n\ndone:\n\treturn sp - osp;\n\ntrunc:\n\tND_PRINT((ndo, \"%s\", tstr));\npktend:\n\treturn -1;\n#undef FETCH\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f03ea5a5c2ff26e239dfd23e263b15da2d9cee93", + "input": "void RenderFrameHostImpl::OnDidAddMessageToConsole(\n int32_t level,\n const base::string16& message,\n int32_t line_no,\n const base::string16& source_id) {\n if (level < logging::LOG_VERBOSE || level > logging::LOG_FATAL) {\n bad_message::ReceivedBadMessage(\n GetProcess(), bad_message::RFH_DID_ADD_CONSOLE_MESSAGE_BAD_SEVERITY);\n return;\n }\n \n if (delegate_->DidAddMessageToConsole(level, message, line_no, source_id))\n return;\n \n const bool is_builtin_component =\n HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL()) ||\n GetContentClient()->browser()->IsBuiltinComponent(\n GetProcess()->GetBrowserContext(), GetLastCommittedOrigin());\n const bool is_off_the_record =\n GetSiteInstance()->GetBrowserContext()->IsOffTheRecord();\n \n LogConsoleMessage(level, message, line_no, is_builtin_component,\n is_off_the_record, source_id);\n }\n", + "target": "void RenderFrameHostImpl::OnDidAddMessageToConsole(\nvoid RenderFrameHostImpl::DidAddMessageToConsole(\n blink::mojom::ConsoleMessageLevel log_level,\n const base::string16& message,\n int32_t line_no,\n const base::string16& source_id) {\n // TODO(https://crbug.com/786836): Update downstream code to use\n // ConsoleMessageLevel everywhere to avoid this conversion.\n logging::LogSeverity log_severity = logging::LOG_VERBOSE;\n switch (log_level) {\n case blink::mojom::ConsoleMessageLevel::kVerbose:\n log_severity = logging::LOG_VERBOSE;\n break;\n case blink::mojom::ConsoleMessageLevel::kInfo:\n log_severity = logging::LOG_INFO;\n break;\n case blink::mojom::ConsoleMessageLevel::kWarning:\n log_severity = logging::LOG_WARNING;\n break;\n case blink::mojom::ConsoleMessageLevel::kError:\n log_severity = logging::LOG_ERROR;\n break;\n }\n \n if (delegate_->DidAddMessageToConsole(log_severity, message, line_no,\n source_id)) {\n return;\n }\n \n // Pass through log severity only on builtin components pages to limit console\n const bool is_builtin_component =\n HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL()) ||\n GetContentClient()->browser()->IsBuiltinComponent(\n GetProcess()->GetBrowserContext(), GetLastCommittedOrigin());\n const bool is_off_the_record =\n GetSiteInstance()->GetBrowserContext()->IsOffTheRecord();\n \n LogConsoleMessage(log_severity, message, line_no, is_builtin_component,\n is_off_the_record, source_id);\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b5bdf3778209179111c9f865af00940e74aa20e7", + "input": "v8::Local V8ValueConverterImpl::ToV8Array(\n v8::Isolate* isolate,\n v8::Local creation_context,\n const base::ListValue* val) const {\n v8::Local result(v8::Array::New(isolate, val->GetSize()));\n \n for (size_t i = 0; i < val->GetSize(); ++i) {\n const base::Value* child = NULL;\n CHECK(val->Get(i, &child));\n\n v8::Local child_v8 =\n ToV8ValueImpl(isolate, creation_context, child);\n CHECK(!child_v8.IsEmpty());\n \n v8::TryCatch try_catch(isolate);\n result->Set(static_cast(i), child_v8);\n if (try_catch.HasCaught())\n LOG(ERROR) << \"Setter for index \" << i << \" threw an exception.\";\n }\n \n return result;\n}\n", + "target": "v8::Local V8ValueConverterImpl::ToV8Array(\n v8::Isolate* isolate,\n v8::Local creation_context,\n const base::ListValue* val) const {\n v8::Local result(v8::Array::New(isolate, val->GetSize()));\n \n // TODO(robwu): Callers should pass in the context.\n v8::Local context = isolate->GetCurrentContext();\n\n for (size_t i = 0; i < val->GetSize(); ++i) {\n const base::Value* child = NULL;\n CHECK(val->Get(i, &child));\n\n v8::Local child_v8 =\n ToV8ValueImpl(isolate, creation_context, child);\n CHECK(!child_v8.IsEmpty());\n \n v8::Maybe maybe =\n result->CreateDataProperty(context, static_cast(i), child_v8);\n if (!maybe.IsJust() || !maybe.FromJust())\n LOG(ERROR) << \"Failed to set value at index \" << i;\n }\n \n return result;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ed6f4545a2a345697e07908c887333f5bdcc97a3", + "input": "void ScriptLoader::executeScript(const ScriptSourceCode& sourceCode)\n{\n ASSERT(m_alreadyStarted);\n\n if (sourceCode.isEmpty())\n return;\n\n RefPtr elementDocument(m_element->document());\n RefPtr contextDocument = elementDocument->contextDocument().get();\n if (!contextDocument)\n return;\n\n LocalFrame* frame = contextDocument->frame();\n\n bool shouldBypassMainWorldContentSecurityPolicy = (frame && frame->script().shouldBypassMainWorldContentSecurityPolicy()) || elementDocument->contentSecurityPolicy()->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr)) || elementDocument->contentSecurityPolicy()->allowScriptHash(sourceCode.source());\n\n if (!m_isExternalScript && (!shouldBypassMainWorldContentSecurityPolicy && !elementDocument->contentSecurityPolicy()->allowInlineScript(elementDocument->url(), m_startLineNumber)))\n return;\n \n if (m_isExternalScript && m_resource && !m_resource->mimeTypeAllowedByNosniff()) {\n contextDocument->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, \"Refused to execute script from '\" + m_resource->url().elidedString() + \"' because its MIME type ('\" + m_resource->mimeType() + \"') is not executable, and strict MIME type checking is enabled.\");\n return;\n }\n \n if (frame) {\n const bool isImportedScript = contextDocument != elementDocument;\n IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer(m_isExternalScript || isImportedScript ? contextDocument.get() : 0);\n\n if (isHTMLScriptLoader(m_element))\n contextDocument->pushCurrentScript(toHTMLScriptElement(m_element));\n\n AccessControlStatus corsCheck = NotSharableCrossOrigin;\n if (sourceCode.resource() && sourceCode.resource()->passesAccessControlCheck(m_element->document().securityOrigin()))\n corsCheck = SharableCrossOrigin;\n\n frame->script().executeScriptInMainWorld(sourceCode, corsCheck);\n\n if (isHTMLScriptLoader(m_element)) {\n ASSERT(contextDocument->currentScript() == m_element);\n contextDocument->popCurrentScript();\n }\n }\n}\n", + "target": "void ScriptLoader::executeScript(const ScriptSourceCode& sourceCode)\n{\n ASSERT(m_alreadyStarted);\n\n if (sourceCode.isEmpty())\n return;\n\n RefPtr elementDocument(m_element->document());\n RefPtr contextDocument = elementDocument->contextDocument().get();\n if (!contextDocument)\n return;\n\n LocalFrame* frame = contextDocument->frame();\n\n bool shouldBypassMainWorldContentSecurityPolicy = (frame && frame->script().shouldBypassMainWorldContentSecurityPolicy()) || elementDocument->contentSecurityPolicy()->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr)) || elementDocument->contentSecurityPolicy()->allowScriptHash(sourceCode.source());\n\n if (!m_isExternalScript && (!shouldBypassMainWorldContentSecurityPolicy && !elementDocument->contentSecurityPolicy()->allowInlineScript(elementDocument->url(), m_startLineNumber)))\n return;\n \n if (m_isExternalScript) {\n ScriptResource* resource = m_resource ? m_resource.get() : sourceCode.resource();\n if (resource && !resource->mimeTypeAllowedByNosniff()) {\n contextDocument->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, \"Refused to execute script from '\" + resource->url().elidedString() + \"' because its MIME type ('\" + resource->mimeType() + \"') is not executable, and strict MIME type checking is enabled.\");\n return;\n }\n }\n \n if (frame) {\n const bool isImportedScript = contextDocument != elementDocument;\n IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrementer(m_isExternalScript || isImportedScript ? contextDocument.get() : 0);\n\n if (isHTMLScriptLoader(m_element))\n contextDocument->pushCurrentScript(toHTMLScriptElement(m_element));\n\n AccessControlStatus corsCheck = NotSharableCrossOrigin;\n if (sourceCode.resource() && sourceCode.resource()->passesAccessControlCheck(m_element->document().securityOrigin()))\n corsCheck = SharableCrossOrigin;\n\n frame->script().executeScriptInMainWorld(sourceCode, corsCheck);\n\n if (isHTMLScriptLoader(m_element)) {\n ASSERT(contextDocument->currentScript() == m_element);\n contextDocument->popCurrentScript();\n }\n }\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b57b3967b1a42dd505dbe4fcf1e1d810e3ae3777", + "input": "SampleTable::SampleTable(const sp &source)\n : mDataSource(source),\n mChunkOffsetOffset(-1),\n mChunkOffsetType(0),\n mNumChunkOffsets(0),\n mSampleToChunkOffset(-1),\n mNumSampleToChunkOffsets(0),\n mSampleSizeOffset(-1),\n\n mSampleSizeFieldSize(0),\n mDefaultSampleSize(0),\n mNumSampleSizes(0),\n mTimeToSampleCount(0),\n mTimeToSample(),\n mSampleTimeEntries(NULL),\n mCompositionTimeDeltaEntries(NULL),\n mNumCompositionTimeDeltaEntries(0),\n mCompositionDeltaLookup(new CompositionDeltaLookup),\n mSyncSampleOffset(-1),\n mNumSyncSamples(0),\n mSyncSamples(NULL),\n mLastSyncSampleIndex(0),\n mSampleToChunkEntries(NULL) {\n mSampleIterator = new SampleIterator(this);\n}\n", + "target": "SampleTable::SampleTable(const sp &source)\n : mDataSource(source),\n mChunkOffsetOffset(-1),\n mChunkOffsetType(0),\n mNumChunkOffsets(0),\n mSampleToChunkOffset(-1),\n mNumSampleToChunkOffsets(0),\n mSampleSizeOffset(-1),\n\n mSampleSizeFieldSize(0),\n mDefaultSampleSize(0),\n mNumSampleSizes(0),\n mHasTimeToSample(false),\n mTimeToSampleCount(0),\n mTimeToSample(),\n mSampleTimeEntries(NULL),\n mCompositionTimeDeltaEntries(NULL),\n mNumCompositionTimeDeltaEntries(0),\n mCompositionDeltaLookup(new CompositionDeltaLookup),\n mSyncSampleOffset(-1),\n mNumSyncSamples(0),\n mSyncSamples(NULL),\n mLastSyncSampleIndex(0),\n mSampleToChunkEntries(NULL) {\n mSampleIterator = new SampleIterator(this);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9899d11f654474d2d54ea52ceaa2a1f4db3abd68", + "input": "SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr,\n\t\tunsigned long, data)\n{\n\tstruct task_struct *child;\n\tlong ret;\n\n\tif (request == PTRACE_TRACEME) {\n\t\tret = ptrace_traceme();\n\t\tif (!ret)\n\t\t\tarch_ptrace_attach(current);\n\t\tgoto out;\n\t}\n\n\tchild = ptrace_get_task_struct(pid);\n\tif (IS_ERR(child)) {\n\t\tret = PTR_ERR(child);\n\t\tgoto out;\n\t}\n\n\tif (request == PTRACE_ATTACH || request == PTRACE_SEIZE) {\n\t\tret = ptrace_attach(child, request, addr, data);\n\t\t/*\n\t\t * Some architectures need to do book-keeping after\n\t\t * a ptrace attach.\n\t\t */\n\t\tif (!ret)\n\t\t\tarch_ptrace_attach(child);\n\t\tgoto out_put_task_struct;\n\t}\n\n\tret = ptrace_check_attach(child, request == PTRACE_KILL ||\n\t\t\t\t request == PTRACE_INTERRUPT);\n\tif (ret < 0)\n \t\tgoto out_put_task_struct;\n \n \tret = arch_ptrace(child, request, addr, data);\n \n out_put_task_struct:\n \tput_task_struct(child);\n out:\n\treturn ret;\n}\n", + "target": "SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr,\n\t\tunsigned long, data)\n{\n\tstruct task_struct *child;\n\tlong ret;\n\n\tif (request == PTRACE_TRACEME) {\n\t\tret = ptrace_traceme();\n\t\tif (!ret)\n\t\t\tarch_ptrace_attach(current);\n\t\tgoto out;\n\t}\n\n\tchild = ptrace_get_task_struct(pid);\n\tif (IS_ERR(child)) {\n\t\tret = PTR_ERR(child);\n\t\tgoto out;\n\t}\n\n\tif (request == PTRACE_ATTACH || request == PTRACE_SEIZE) {\n\t\tret = ptrace_attach(child, request, addr, data);\n\t\t/*\n\t\t * Some architectures need to do book-keeping after\n\t\t * a ptrace attach.\n\t\t */\n\t\tif (!ret)\n\t\t\tarch_ptrace_attach(child);\n\t\tgoto out_put_task_struct;\n\t}\n\n\tret = ptrace_check_attach(child, request == PTRACE_KILL ||\n\t\t\t\t request == PTRACE_INTERRUPT);\n\tif (ret < 0)\n \t\tgoto out_put_task_struct;\n \n \tret = arch_ptrace(child, request, addr, data);\n\tif (ret || request != PTRACE_DETACH)\n\t\tptrace_unfreeze_traced(child);\n \n out_put_task_struct:\n \tput_task_struct(child);\n out:\n\treturn ret;\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ee301cb2029db8a6289c5295daa42bba7715e99a", + "input": " gplotMakeOutput(GPLOT *gplot)\n {\nchar buf[L_BUF_SIZE];\n char *cmdname;\n l_int32 ignore;\n \n PROCNAME(\"gplotMakeOutput\");\n\n if (!gplot)\n return ERROR_INT(\"gplot not defined\", procName, 1);\n\n gplotGenCommandFile(gplot);\n gplotGenDataFiles(gplot);\n cmdname = genPathname(gplot->cmdname, NULL);\n \n #ifndef _WIN32\n snprintf(buf, L_BUF_SIZE, \"gnuplot %s\", cmdname);\n #else\n snprintf(buf, L_BUF_SIZE, \"wgnuplot %s\", cmdname);\n #endif /* _WIN32 */\n \n #ifndef OS_IOS /* iOS 11 does not support system() */\n ignore = system(buf); /* gnuplot || wgnuplot */\n#endif /* !OS_IOS */\n\n LEPT_FREE(cmdname);\n return 0;\n}\n", + "target": " gplotMakeOutput(GPLOT *gplot)\n {\nchar buf[L_BUFSIZE];\n char *cmdname;\n l_int32 ignore;\n \n PROCNAME(\"gplotMakeOutput\");\n\n if (!gplot)\n return ERROR_INT(\"gplot not defined\", procName, 1);\n\n gplotGenCommandFile(gplot);\n gplotGenDataFiles(gplot);\n cmdname = genPathname(gplot->cmdname, NULL);\n \n #ifndef _WIN32\n snprintf(buf, L_BUFSIZE, \"gnuplot %s\", cmdname);\n #else\n snprintf(buf, L_BUFSIZE, \"wgnuplot %s\", cmdname);\n #endif /* _WIN32 */\n \n #ifndef OS_IOS /* iOS 11 does not support system() */\n ignore = system(buf); /* gnuplot || wgnuplot */\n#endif /* !OS_IOS */\n\n LEPT_FREE(cmdname);\n return 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c3efb8738ab59766c88855ad62c812af78490c04", + "input": " void RenderProcessHostImpl::RegisterProcessHostForSite(\n BrowserContext* browser_context,\n RenderProcessHost* process,\n const GURL& url) {\n SiteProcessMap* map =\n GetSiteProcessMapForBrowserContext(browser_context);\n \n std::string site = SiteInstance::GetSiteForURL(browser_context, url)\n .possibly_invalid_spec();\n map->RegisterProcess(site, process);\n }\n", + "target": " void RenderProcessHostImpl::RegisterProcessHostForSite(\n BrowserContext* browser_context,\n RenderProcessHost* process,\n const GURL& url) {\n SiteProcessMap* map =\n GetSiteProcessMapForBrowserContext(browser_context);\n \n // Only register valid, non-empty sites. Empty or invalid sites will not\n // use process-per-site mode. We cannot check whether the process has\n // appropriate bindings here, because the bindings have not yet been granted.\n std::string site = SiteInstance::GetSiteForURL(browser_context, url)\n .possibly_invalid_spec();\n if (!site.empty())\n map->RegisterProcess(site, process);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b4d16b4495b732888e12baf5b8a7e9bf2665e22b", + "input": "dissect_spoolss_keybuffer(tvbuff_t *tvb, int offset, packet_info *pinfo,\n\t\t\t proto_tree *tree, dcerpc_info *di, guint8 *drep)\n{\n\tguint32 size;\n\tint end_offset;\n\n\tif (di->conformant_run)\n\t\treturn offset;\n\n\t/* Dissect size and data */\n\n\toffset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,\n\t\t\t\t hf_keybuffer_size, &size);\n\n\tend_offset = offset + (size*2);\n\tif (end_offset < offset) {\n\t\t/*\n\t\t * Overflow - make the end offset one past the end of\n\t\t * the packet data, so we throw an exception (as the\n\t\t * size is almost certainly too big).\n\t\t */\n \t\tend_offset = tvb_reported_length_remaining(tvb, offset) + 1;\n \t}\n \n\twhile (offset < end_offset)\n \t\toffset = dissect_spoolss_uint16uni(\n \t\t\ttvb, offset, pinfo, tree, drep, NULL, hf_keybuffer);\n \n \treturn offset;\n }\n", + "target": "dissect_spoolss_keybuffer(tvbuff_t *tvb, int offset, packet_info *pinfo,\n\t\t\t proto_tree *tree, dcerpc_info *di, guint8 *drep)\n{\n\tguint32 size;\n\tint end_offset;\n\n\tif (di->conformant_run)\n\t\treturn offset;\n\n\t/* Dissect size and data */\n\n\toffset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,\n\t\t\t\t hf_keybuffer_size, &size);\n\n\tend_offset = offset + (size*2);\n\tif (end_offset < offset) {\n\t\t/*\n\t\t * Overflow - make the end offset one past the end of\n\t\t * the packet data, so we throw an exception (as the\n\t\t * size is almost certainly too big).\n\t\t */\n \t\tend_offset = tvb_reported_length_remaining(tvb, offset) + 1;\n \t}\n \n\twhile (offset > 0 && offset < end_offset) {\n \t\toffset = dissect_spoolss_uint16uni(\n \t\t\ttvb, offset, pinfo, tree, drep, NULL, hf_keybuffer);\n\t}\n \n \treturn offset;\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": " ContentEncoding::ContentEncoding()\n : compression_entries_(NULL),\n compression_entries_end_(NULL),\n encryption_entries_(NULL),\n\n encryption_entries_end_(NULL),\n encoding_order_(0),\n encoding_scope_(1),\n encoding_type_(0) {\n}\n", + "target": " ContentEncoding::ContentEncoding()\n : compression_entries_(NULL),\n compression_entries_end_(NULL),\n encryption_entries_(NULL),\n\n encryption_entries_end_(NULL),\n encoding_order_(0),\n encoding_scope_(1),\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#61b77165a1125a80f105f4382a99d9d7a1eb0cf2", + "input": " void HTMLLinkElement::insertedIntoDocument()\n {\n HTMLElement::insertedIntoDocument();\n document()->addStyleSheetCandidateNode(this, m_createdByParser);\n \n if (document()->hasListenerType(Document::BEFORELOAD_LISTENER)) {\n m_shouldProcessAfterAttach = true;\n return;\n }\n process();\n }\n", + "target": " void HTMLLinkElement::insertedIntoDocument()\n {\n HTMLElement::insertedIntoDocument();\n document()->addStyleSheetCandidateNode(this, m_createdByParser);\n \n process();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5472db1c7eca35822219d03be5c817d9a9258c11", + "input": "void PaintLayerScrollableArea::UpdateCompositingLayersAfterScroll() {\n PaintLayerCompositor* compositor = GetLayoutBox()->View()->Compositor();\n if (!compositor->InCompositingMode())\n return;\n\n if (UsesCompositedScrolling()) {\n DCHECK(Layer()->HasCompositedLayerMapping());\n ScrollingCoordinator* scrolling_coordinator = GetScrollingCoordinator();\n bool handled_scroll =\n Layer()->IsRootLayer() && scrolling_coordinator &&\n scrolling_coordinator->UpdateCompositedScrollOffset(this);\n \n if (!handled_scroll) {\n if (!RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {\n Layer()->GetCompositedLayerMapping()->SetNeedsGraphicsLayerUpdate(\n kGraphicsLayerUpdateSubtree);\n }\n compositor->SetNeedsCompositingUpdate(\n kCompositingUpdateAfterGeometryChange);\n }\n\n if (Layer()->IsRootLayer()) {\n LocalFrame* frame = GetLayoutBox()->GetFrame();\n if (frame && frame->View() &&\n frame->View()->HasViewportConstrainedObjects()) {\n Layer()->SetNeedsCompositingInputsUpdate();\n }\n }\n } else {\n Layer()->SetNeedsCompositingInputsUpdate();\n }\n}\n", + "target": "void PaintLayerScrollableArea::UpdateCompositingLayersAfterScroll() {\n PaintLayerCompositor* compositor = GetLayoutBox()->View()->Compositor();\n if (!compositor->InCompositingMode())\n return;\n\n if (UsesCompositedScrolling()) {\n DCHECK(Layer()->HasCompositedLayerMapping());\n ScrollingCoordinator* scrolling_coordinator = GetScrollingCoordinator();\n bool handled_scroll =\n (Layer()->IsRootLayer() ||\n RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) &&\n scrolling_coordinator &&\n scrolling_coordinator->UpdateCompositedScrollOffset(this);\n \n if (!handled_scroll) {\n if (!RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {\n Layer()->GetCompositedLayerMapping()->SetNeedsGraphicsLayerUpdate(\n kGraphicsLayerUpdateSubtree);\n }\n compositor->SetNeedsCompositingUpdate(\n kCompositingUpdateAfterGeometryChange);\n }\n\n if (Layer()->IsRootLayer()) {\n LocalFrame* frame = GetLayoutBox()->GetFrame();\n if (frame && frame->View() &&\n frame->View()->HasViewportConstrainedObjects()) {\n Layer()->SetNeedsCompositingInputsUpdate();\n }\n }\n } else {\n Layer()->SetNeedsCompositingInputsUpdate();\n }\n}\n", + "vul_type": "cwe-79", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5dc90e57abcc7f0489e7ae09a3e687e9c6f4fad5", + "input": "void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) {\n DCHECK_NE(INITIALIZED, state_);\n if (state_ == CLOSED)\n return;\n if (state_ == CONNECTING) {\n OnSentHandshakeRequest(socket, amount_sent);\n return;\n }\n if (delegate_) {\n DCHECK(state_ == OPEN || state_ == CLOSING);\n DCHECK_GT(amount_sent, 0);\n DCHECK(current_buffer_);\n current_buffer_->DidConsume(amount_sent);\n if (current_buffer_->BytesRemaining() > 0)\n return;\n\n amount_sent = send_frame_handler_->GetOriginalBufferSize();\n DCHECK_GT(amount_sent, 0);\n current_buffer_ = NULL;\n send_frame_handler_->ReleaseCurrentBuffer();\n delegate_->OnSentData(socket, amount_sent);\n MessageLoopForIO::current()->PostTask(\n FROM_HERE, NewRunnableMethod(this, &WebSocketJob::SendPending));\n }\n }\n", + "target": "void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) {\n DCHECK_NE(INITIALIZED, state_);\n if (state_ == CLOSED)\n return;\n if (state_ == CONNECTING) {\n OnSentHandshakeRequest(socket, amount_sent);\n return;\n }\n if (delegate_) {\n DCHECK(state_ == OPEN || state_ == CLOSING);\n DCHECK_GT(amount_sent, 0);\n DCHECK(current_buffer_);\n current_buffer_->DidConsume(amount_sent);\n if (current_buffer_->BytesRemaining() > 0)\n return;\n\n amount_sent = send_frame_handler_->GetOriginalBufferSize();\n DCHECK_GT(amount_sent, 0);\n current_buffer_ = NULL;\n send_frame_handler_->ReleaseCurrentBuffer();\n if (method_factory_.empty()) {\n MessageLoopForIO::current()->PostTask(\n FROM_HERE,\n method_factory_.NewRunnableMethod(&WebSocketJob::SendPending));\n }\n delegate_->OnSentData(socket, amount_sent);\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#27463ad99f738ed93c7c8b3e2e5bc8c4853a2ff2", + "input": "int hns_nic_net_xmit_hw(struct net_device *ndev,\n\t\t\tstruct sk_buff *skb,\n\t\t\tstruct hns_nic_ring_data *ring_data)\n {\n \tstruct hns_nic_priv *priv = netdev_priv(ndev);\n \tstruct hnae_ring *ring = ring_data->ring;\n\tstruct device *dev = ring_to_dev(ring);\n\tstruct netdev_queue *dev_queue;\n\tstruct skb_frag_struct *frag;\n\tint buf_num;\n\tint seg_num;\n\tdma_addr_t dma;\n\tint size, next_to_use;\n\tint i;\n\n\tswitch (priv->ops.maybe_stop_tx(&skb, &buf_num, ring)) {\n\tcase -EBUSY:\n\t\tring->stats.tx_busy++;\n\t\tgoto out_net_tx_busy;\n\tcase -ENOMEM:\n\t\tring->stats.sw_err_cnt++;\n\t\tnetdev_err(ndev, \"no memory to xmit!\\n\");\n\t\tgoto out_err_tx_ok;\n\tdefault:\n\t\tbreak;\n\t}\n\n\t/* no. of segments (plus a header) */\n\tseg_num = skb_shinfo(skb)->nr_frags + 1;\n\tnext_to_use = ring->next_to_use;\n\n\t/* fill the first part */\n\tsize = skb_headlen(skb);\n\tdma = dma_map_single(dev, skb->data, size, DMA_TO_DEVICE);\n\tif (dma_mapping_error(dev, dma)) {\n\t\tnetdev_err(ndev, \"TX head DMA map failed\\n\");\n\t\tring->stats.sw_err_cnt++;\n\t\tgoto out_err_tx_ok;\n\t}\n\tpriv->ops.fill_desc(ring, skb, size, dma, seg_num == 1 ? 1 : 0,\n\t\t\t buf_num, DESC_TYPE_SKB, ndev->mtu);\n\n\t/* fill the fragments */\n\tfor (i = 1; i < seg_num; i++) {\n\t\tfrag = &skb_shinfo(skb)->frags[i - 1];\n\t\tsize = skb_frag_size(frag);\n\t\tdma = skb_frag_dma_map(dev, frag, 0, size, DMA_TO_DEVICE);\n\t\tif (dma_mapping_error(dev, dma)) {\n\t\t\tnetdev_err(ndev, \"TX frag(%d) DMA map failed\\n\", i);\n\t\t\tring->stats.sw_err_cnt++;\n\t\t\tgoto out_map_frag_fail;\n\t\t}\n\t\tpriv->ops.fill_desc(ring, skb_frag_page(frag), size, dma,\n\t\t\t\t seg_num - 1 == i ? 1 : 0, buf_num,\n\t\t\t\t DESC_TYPE_PAGE, ndev->mtu);\n\t}\n\n\t/*complete translate all packets*/\n \tdev_queue = netdev_get_tx_queue(ndev, skb->queue_mapping);\n \tnetdev_tx_sent_queue(dev_queue, skb->len);\n \n \twmb(); /* commit all data before submit */\n \tassert(skb->queue_mapping < priv->ae_handle->q_num);\n \thnae_queue_xmit(priv->ae_handle->qs[skb->queue_mapping], buf_num);\n\tring->stats.tx_pkts++;\n\tring->stats.tx_bytes += skb->len;\n\n\treturn NETDEV_TX_OK;\n\nout_map_frag_fail:\n\n\twhile (ring->next_to_use != next_to_use) {\n\t\tunfill_desc(ring);\n\t\tif (ring->next_to_use != next_to_use)\n\t\t\tdma_unmap_page(dev,\n\t\t\t\t ring->desc_cb[ring->next_to_use].dma,\n\t\t\t\t ring->desc_cb[ring->next_to_use].length,\n\t\t\t\t DMA_TO_DEVICE);\n\t\telse\n\t\t\tdma_unmap_single(dev,\n\t\t\t\t\t ring->desc_cb[next_to_use].dma,\n\t\t\t\t\t ring->desc_cb[next_to_use].length,\n\t\t\t\t\t DMA_TO_DEVICE);\n\t}\n\nout_err_tx_ok:\n\n\tdev_kfree_skb_any(skb);\n\treturn NETDEV_TX_OK;\n\nout_net_tx_busy:\n\n\tnetif_stop_subqueue(ndev, skb->queue_mapping);\n\n\t/* Herbert's original patch had:\n\t * smp_mb__after_netif_stop_queue();\n\t * but since that doesn't exist yet, just open code it.\n\t */\n\tsmp_mb();\n\treturn NETDEV_TX_BUSY;\n}\n", + "target": "int hns_nic_net_xmit_hw(struct net_device *ndev,\nnetdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev,\n\t\t\t\tstruct sk_buff *skb,\n\t\t\t\tstruct hns_nic_ring_data *ring_data)\n {\n \tstruct hns_nic_priv *priv = netdev_priv(ndev);\n \tstruct hnae_ring *ring = ring_data->ring;\n\tstruct device *dev = ring_to_dev(ring);\n\tstruct netdev_queue *dev_queue;\n\tstruct skb_frag_struct *frag;\n\tint buf_num;\n\tint seg_num;\n\tdma_addr_t dma;\n\tint size, next_to_use;\n\tint i;\n\n\tswitch (priv->ops.maybe_stop_tx(&skb, &buf_num, ring)) {\n\tcase -EBUSY:\n\t\tring->stats.tx_busy++;\n\t\tgoto out_net_tx_busy;\n\tcase -ENOMEM:\n\t\tring->stats.sw_err_cnt++;\n\t\tnetdev_err(ndev, \"no memory to xmit!\\n\");\n\t\tgoto out_err_tx_ok;\n\tdefault:\n\t\tbreak;\n\t}\n\n\t/* no. of segments (plus a header) */\n\tseg_num = skb_shinfo(skb)->nr_frags + 1;\n\tnext_to_use = ring->next_to_use;\n\n\t/* fill the first part */\n\tsize = skb_headlen(skb);\n\tdma = dma_map_single(dev, skb->data, size, DMA_TO_DEVICE);\n\tif (dma_mapping_error(dev, dma)) {\n\t\tnetdev_err(ndev, \"TX head DMA map failed\\n\");\n\t\tring->stats.sw_err_cnt++;\n\t\tgoto out_err_tx_ok;\n\t}\n\tpriv->ops.fill_desc(ring, skb, size, dma, seg_num == 1 ? 1 : 0,\n\t\t\t buf_num, DESC_TYPE_SKB, ndev->mtu);\n\n\t/* fill the fragments */\n\tfor (i = 1; i < seg_num; i++) {\n\t\tfrag = &skb_shinfo(skb)->frags[i - 1];\n\t\tsize = skb_frag_size(frag);\n\t\tdma = skb_frag_dma_map(dev, frag, 0, size, DMA_TO_DEVICE);\n\t\tif (dma_mapping_error(dev, dma)) {\n\t\t\tnetdev_err(ndev, \"TX frag(%d) DMA map failed\\n\", i);\n\t\t\tring->stats.sw_err_cnt++;\n\t\t\tgoto out_map_frag_fail;\n\t\t}\n\t\tpriv->ops.fill_desc(ring, skb_frag_page(frag), size, dma,\n\t\t\t\t seg_num - 1 == i ? 1 : 0, buf_num,\n\t\t\t\t DESC_TYPE_PAGE, ndev->mtu);\n\t}\n\n\t/*complete translate all packets*/\n \tdev_queue = netdev_get_tx_queue(ndev, skb->queue_mapping);\n \tnetdev_tx_sent_queue(dev_queue, skb->len);\n \n\tnetif_trans_update(ndev);\n\tndev->stats.tx_bytes += skb->len;\n\tndev->stats.tx_packets++;\n\n \twmb(); /* commit all data before submit */\n \tassert(skb->queue_mapping < priv->ae_handle->q_num);\n \thnae_queue_xmit(priv->ae_handle->qs[skb->queue_mapping], buf_num);\n\tring->stats.tx_pkts++;\n\tring->stats.tx_bytes += skb->len;\n\n\treturn NETDEV_TX_OK;\n\nout_map_frag_fail:\n\n\twhile (ring->next_to_use != next_to_use) {\n\t\tunfill_desc(ring);\n\t\tif (ring->next_to_use != next_to_use)\n\t\t\tdma_unmap_page(dev,\n\t\t\t\t ring->desc_cb[ring->next_to_use].dma,\n\t\t\t\t ring->desc_cb[ring->next_to_use].length,\n\t\t\t\t DMA_TO_DEVICE);\n\t\telse\n\t\t\tdma_unmap_single(dev,\n\t\t\t\t\t ring->desc_cb[next_to_use].dma,\n\t\t\t\t\t ring->desc_cb[next_to_use].length,\n\t\t\t\t\t DMA_TO_DEVICE);\n\t}\n\nout_err_tx_ok:\n\n\tdev_kfree_skb_any(skb);\n\treturn NETDEV_TX_OK;\n\nout_net_tx_busy:\n\n\tnetif_stop_subqueue(ndev, skb->queue_mapping);\n\n\t/* Herbert's original patch had:\n\t * smp_mb__after_netif_stop_queue();\n\t * but since that doesn't exist yet, just open code it.\n\t */\n\tsmp_mb();\n\treturn NETDEV_TX_BUSY;\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5f8cf712582617d523120df67d392059eaf2fc4b", + "input": "static int usb_audio_probe(struct usb_interface *intf,\n\t\t\t const struct usb_device_id *usb_id)\n{\n\tstruct usb_device *dev = interface_to_usbdev(intf);\n\tconst struct snd_usb_audio_quirk *quirk =\n\t\t(const struct snd_usb_audio_quirk *)usb_id->driver_info;\n\tstruct snd_usb_audio *chip;\n\tint i, err;\n\tstruct usb_host_interface *alts;\n\tint ifnum;\n\tu32 id;\n\n\talts = &intf->altsetting[0];\n\tifnum = get_iface_desc(alts)->bInterfaceNumber;\n\tid = USB_ID(le16_to_cpu(dev->descriptor.idVendor),\n\t\t le16_to_cpu(dev->descriptor.idProduct));\n\tif (get_alias_id(dev, &id))\n\t\tquirk = get_alias_quirk(dev, id);\n\tif (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)\n\t\treturn -ENXIO;\n\n\terr = snd_usb_apply_boot_quirk(dev, intf, quirk, id);\n\tif (err < 0)\n\t\treturn err;\n\n\t/*\n\t * found a config. now register to ALSA\n\t */\n\n\t/* check whether it's already registered */\n\tchip = NULL;\n\tmutex_lock(®ister_mutex);\n\tfor (i = 0; i < SNDRV_CARDS; i++) {\n\t\tif (usb_chip[i] && usb_chip[i]->dev == dev) {\n\t\t\tif (atomic_read(&usb_chip[i]->shutdown)) {\n\t\t\t\tdev_err(&dev->dev, \"USB device is in the shutdown state, cannot create a card instance\\n\");\n\t\t\t\terr = -EIO;\n\t\t\t\tgoto __error;\n\t\t\t}\n\t\t\tchip = usb_chip[i];\n\t\t\tatomic_inc(&chip->active); /* avoid autopm */\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (! chip) {\n\t\t/* it's a fresh one.\n\t\t * now look for an empty slot and create a new card instance\n\t\t */\n\t\tfor (i = 0; i < SNDRV_CARDS; i++)\n\t\t\tif (!usb_chip[i] &&\n\t\t\t (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) &&\n\t\t\t (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) {\n\t\t\t\tif (enable[i]) {\n\t\t\t\t\terr = snd_usb_audio_create(intf, dev, i, quirk,\n\t\t\t\t\t\t\t\t id, &chip);\n\t\t\t\t\tif (err < 0)\n\t\t\t\t\t\tgoto __error;\n\t\t\t\t\tchip->pm_intf = intf;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (vid[i] != -1 || pid[i] != -1) {\n\t\t\t\t\tdev_info(&dev->dev,\n\t\t\t\t\t\t \"device (%04x:%04x) is disabled\\n\",\n\t\t\t\t\t\t USB_ID_VENDOR(id),\n\t\t\t\t\t\t USB_ID_PRODUCT(id));\n\t\t\t\t\terr = -ENOENT;\n\t\t\t\t\tgoto __error;\n\t\t\t\t}\n\t\t\t}\n\t\tif (!chip) {\n\t\t\tdev_err(&dev->dev, \"no available usb audio device\\n\");\n\t\t\terr = -ENODEV;\n\t\t\tgoto __error;\n\t\t}\n\t}\n\tdev_set_drvdata(&dev->dev, chip);\n\n\t/*\n\t * For devices with more than one control interface, we assume the\n\t * first contains the audio controls. We might need a more specific\n\t * check here in the future.\n\t */\n\tif (!chip->ctrl_intf)\n\t\tchip->ctrl_intf = alts;\n\n\tchip->txfr_quirk = 0;\n\terr = 1; /* continue */\n\tif (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {\n\t\t/* need some special handlings */\n\t\terr = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\tif (err > 0) {\n\t\t/* create normal USB audio interfaces */\n\t\terr = snd_usb_create_streams(chip, ifnum);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t\terr = snd_usb_create_mixer(chip, ifnum, ignore_ctl_error);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\t/* we are allowed to call snd_card_register() many times */\n\terr = snd_card_register(chip->card);\n\tif (err < 0)\n\t\tgoto __error;\n\n\tusb_chip[chip->index] = chip;\n\tchip->num_interfaces++;\n\tusb_set_intfdata(intf, chip);\n\tatomic_dec(&chip->active);\n\tmutex_unlock(®ister_mutex);\n\treturn 0;\n \n __error:\n \tif (chip) {\n \t\tif (!chip->num_interfaces)\n \t\t\tsnd_card_free(chip->card);\n\t\tatomic_dec(&chip->active);\n \t}\n \tmutex_unlock(®ister_mutex);\n \treturn err;\n}\n", + "target": "static int usb_audio_probe(struct usb_interface *intf,\n\t\t\t const struct usb_device_id *usb_id)\n{\n\tstruct usb_device *dev = interface_to_usbdev(intf);\n\tconst struct snd_usb_audio_quirk *quirk =\n\t\t(const struct snd_usb_audio_quirk *)usb_id->driver_info;\n\tstruct snd_usb_audio *chip;\n\tint i, err;\n\tstruct usb_host_interface *alts;\n\tint ifnum;\n\tu32 id;\n\n\talts = &intf->altsetting[0];\n\tifnum = get_iface_desc(alts)->bInterfaceNumber;\n\tid = USB_ID(le16_to_cpu(dev->descriptor.idVendor),\n\t\t le16_to_cpu(dev->descriptor.idProduct));\n\tif (get_alias_id(dev, &id))\n\t\tquirk = get_alias_quirk(dev, id);\n\tif (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)\n\t\treturn -ENXIO;\n\n\terr = snd_usb_apply_boot_quirk(dev, intf, quirk, id);\n\tif (err < 0)\n\t\treturn err;\n\n\t/*\n\t * found a config. now register to ALSA\n\t */\n\n\t/* check whether it's already registered */\n\tchip = NULL;\n\tmutex_lock(®ister_mutex);\n\tfor (i = 0; i < SNDRV_CARDS; i++) {\n\t\tif (usb_chip[i] && usb_chip[i]->dev == dev) {\n\t\t\tif (atomic_read(&usb_chip[i]->shutdown)) {\n\t\t\t\tdev_err(&dev->dev, \"USB device is in the shutdown state, cannot create a card instance\\n\");\n\t\t\t\terr = -EIO;\n\t\t\t\tgoto __error;\n\t\t\t}\n\t\t\tchip = usb_chip[i];\n\t\t\tatomic_inc(&chip->active); /* avoid autopm */\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (! chip) {\n\t\t/* it's a fresh one.\n\t\t * now look for an empty slot and create a new card instance\n\t\t */\n\t\tfor (i = 0; i < SNDRV_CARDS; i++)\n\t\t\tif (!usb_chip[i] &&\n\t\t\t (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) &&\n\t\t\t (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) {\n\t\t\t\tif (enable[i]) {\n\t\t\t\t\terr = snd_usb_audio_create(intf, dev, i, quirk,\n\t\t\t\t\t\t\t\t id, &chip);\n\t\t\t\t\tif (err < 0)\n\t\t\t\t\t\tgoto __error;\n\t\t\t\t\tchip->pm_intf = intf;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (vid[i] != -1 || pid[i] != -1) {\n\t\t\t\t\tdev_info(&dev->dev,\n\t\t\t\t\t\t \"device (%04x:%04x) is disabled\\n\",\n\t\t\t\t\t\t USB_ID_VENDOR(id),\n\t\t\t\t\t\t USB_ID_PRODUCT(id));\n\t\t\t\t\terr = -ENOENT;\n\t\t\t\t\tgoto __error;\n\t\t\t\t}\n\t\t\t}\n\t\tif (!chip) {\n\t\t\tdev_err(&dev->dev, \"no available usb audio device\\n\");\n\t\t\terr = -ENODEV;\n\t\t\tgoto __error;\n\t\t}\n\t}\n\tdev_set_drvdata(&dev->dev, chip);\n\n\t/*\n\t * For devices with more than one control interface, we assume the\n\t * first contains the audio controls. We might need a more specific\n\t * check here in the future.\n\t */\n\tif (!chip->ctrl_intf)\n\t\tchip->ctrl_intf = alts;\n\n\tchip->txfr_quirk = 0;\n\terr = 1; /* continue */\n\tif (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {\n\t\t/* need some special handlings */\n\t\terr = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\tif (err > 0) {\n\t\t/* create normal USB audio interfaces */\n\t\terr = snd_usb_create_streams(chip, ifnum);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t\terr = snd_usb_create_mixer(chip, ifnum, ignore_ctl_error);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\t/* we are allowed to call snd_card_register() many times */\n\terr = snd_card_register(chip->card);\n\tif (err < 0)\n\t\tgoto __error;\n\n\tusb_chip[chip->index] = chip;\n\tchip->num_interfaces++;\n\tusb_set_intfdata(intf, chip);\n\tatomic_dec(&chip->active);\n\tmutex_unlock(®ister_mutex);\n\treturn 0;\n \n __error:\n \tif (chip) {\n\t\t/* chip->active is inside the chip->card object,\n\t\t * decrement before memory is possibly returned.\n\t\t */\n\t\tatomic_dec(&chip->active);\n \t\tif (!chip->num_interfaces)\n \t\t\tsnd_card_free(chip->card);\n \t}\n \tmutex_unlock(®ister_mutex);\n \treturn err;\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ea702b80e0bbb2448e201472127288beb82ca2fe", + "input": "smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec,\n\t\tsize_t *sent)\n{\n\tint rc = 0;\n\tint i = 0;\n\tstruct msghdr smb_msg;\n\tunsigned int remaining;\n\tsize_t first_vec = 0;\n\tstruct socket *ssocket = server->ssocket;\n \n \t*sent = 0;\n \n\tif (ssocket == NULL)\n\t\treturn -ENOTSOCK; /* BB eventually add reconnect code here */\n \tsmb_msg.msg_name = (struct sockaddr *) &server->dstaddr;\n \tsmb_msg.msg_namelen = sizeof(struct sockaddr);\n \tsmb_msg.msg_control = NULL;\n\tsmb_msg.msg_controllen = 0;\n\tif (server->noblocksnd)\n\t\tsmb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL;\n\telse\n\t\tsmb_msg.msg_flags = MSG_NOSIGNAL;\n\n\tremaining = 0;\n\tfor (i = 0; i < n_vec; i++)\n\t\tremaining += iov[i].iov_len;\n\n\ti = 0;\n\twhile (remaining) {\n\t\t/*\n\t\t * If blocking send, we try 3 times, since each can block\n\t\t * for 5 seconds. For nonblocking we have to try more\n\t\t * but wait increasing amounts of time allowing time for\n\t\t * socket to clear. The overall time we wait in either\n\t\t * case to send on the socket is about 15 seconds.\n\t\t * Similarly we wait for 15 seconds for a response from\n\t\t * the server in SendReceive[2] for the server to send\n\t\t * a response back for most types of requests (except\n\t\t * SMB Write past end of file which can be slow, and\n\t\t * blocking lock operations). NFS waits slightly longer\n\t\t * than CIFS, but this can make it take longer for\n\t\t * nonresponsive servers to be detected and 15 seconds\n\t\t * is more than enough time for modern networks to\n\t\t * send a packet. In most cases if we fail to send\n\t\t * after the retries we will kill the socket and\n\t\t * reconnect which may clear the network problem.\n\t\t */\n\t\trc = kernel_sendmsg(ssocket, &smb_msg, &iov[first_vec],\n\t\t\t\t n_vec - first_vec, remaining);\n\t\tif (rc == -ENOSPC || rc == -EAGAIN) {\n\t\t\t/*\n\t\t\t * Catch if a low level driver returns -ENOSPC. This\n\t\t\t * WARN_ON will be removed by 3.10 if no one reports\n\t\t\t * seeing this.\n\t\t\t */\n\t\t\tWARN_ON_ONCE(rc == -ENOSPC);\n\t\t\ti++;\n\t\t\tif (i >= 14 || (!server->noblocksnd && (i > 2))) {\n\t\t\t\tcERROR(1, \"sends on sock %p stuck for 15 \"\n\t\t\t\t\t \"seconds\", ssocket);\n\t\t\t\trc = -EAGAIN;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tmsleep(1 << i);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (rc < 0)\n\t\t\tbreak;\n\n\t\t/* send was at least partially successful */\n\t\t*sent += rc;\n\n\t\tif (rc == remaining) {\n\t\t\tremaining = 0;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (rc > remaining) {\n\t\t\tcERROR(1, \"sent %d requested %d\", rc, remaining);\n\t\t\tbreak;\n\t\t}\n\n\t\tif (rc == 0) {\n\t\t\t/* should never happen, letting socket clear before\n\t\t\t retrying is our only obvious option here */\n\t\t\tcERROR(1, \"tcp sent no data\");\n\t\t\tmsleep(500);\n\t\t\tcontinue;\n\t\t}\n\n\t\tremaining -= rc;\n\n\t\t/* the line below resets i */\n\t\tfor (i = first_vec; i < n_vec; i++) {\n\t\t\tif (iov[i].iov_len) {\n\t\t\t\tif (rc > iov[i].iov_len) {\n\t\t\t\t\trc -= iov[i].iov_len;\n\t\t\t\t\tiov[i].iov_len = 0;\n\t\t\t\t} else {\n\t\t\t\t\tiov[i].iov_base += rc;\n\t\t\t\t\tiov[i].iov_len -= rc;\n\t\t\t\t\tfirst_vec = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ti = 0; /* in case we get ENOSPC on the next send */\n\t\trc = 0;\n\t}\n\treturn rc;\n}\n", + "target": "smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec,\n\t\tsize_t *sent)\n{\n\tint rc = 0;\n\tint i = 0;\n\tstruct msghdr smb_msg;\n\tunsigned int remaining;\n\tsize_t first_vec = 0;\n\tstruct socket *ssocket = server->ssocket;\n \n \t*sent = 0;\n \n \tsmb_msg.msg_name = (struct sockaddr *) &server->dstaddr;\n \tsmb_msg.msg_namelen = sizeof(struct sockaddr);\n \tsmb_msg.msg_control = NULL;\n\tsmb_msg.msg_controllen = 0;\n\tif (server->noblocksnd)\n\t\tsmb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL;\n\telse\n\t\tsmb_msg.msg_flags = MSG_NOSIGNAL;\n\n\tremaining = 0;\n\tfor (i = 0; i < n_vec; i++)\n\t\tremaining += iov[i].iov_len;\n\n\ti = 0;\n\twhile (remaining) {\n\t\t/*\n\t\t * If blocking send, we try 3 times, since each can block\n\t\t * for 5 seconds. For nonblocking we have to try more\n\t\t * but wait increasing amounts of time allowing time for\n\t\t * socket to clear. The overall time we wait in either\n\t\t * case to send on the socket is about 15 seconds.\n\t\t * Similarly we wait for 15 seconds for a response from\n\t\t * the server in SendReceive[2] for the server to send\n\t\t * a response back for most types of requests (except\n\t\t * SMB Write past end of file which can be slow, and\n\t\t * blocking lock operations). NFS waits slightly longer\n\t\t * than CIFS, but this can make it take longer for\n\t\t * nonresponsive servers to be detected and 15 seconds\n\t\t * is more than enough time for modern networks to\n\t\t * send a packet. In most cases if we fail to send\n\t\t * after the retries we will kill the socket and\n\t\t * reconnect which may clear the network problem.\n\t\t */\n\t\trc = kernel_sendmsg(ssocket, &smb_msg, &iov[first_vec],\n\t\t\t\t n_vec - first_vec, remaining);\n\t\tif (rc == -ENOSPC || rc == -EAGAIN) {\n\t\t\t/*\n\t\t\t * Catch if a low level driver returns -ENOSPC. This\n\t\t\t * WARN_ON will be removed by 3.10 if no one reports\n\t\t\t * seeing this.\n\t\t\t */\n\t\t\tWARN_ON_ONCE(rc == -ENOSPC);\n\t\t\ti++;\n\t\t\tif (i >= 14 || (!server->noblocksnd && (i > 2))) {\n\t\t\t\tcERROR(1, \"sends on sock %p stuck for 15 \"\n\t\t\t\t\t \"seconds\", ssocket);\n\t\t\t\trc = -EAGAIN;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tmsleep(1 << i);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (rc < 0)\n\t\t\tbreak;\n\n\t\t/* send was at least partially successful */\n\t\t*sent += rc;\n\n\t\tif (rc == remaining) {\n\t\t\tremaining = 0;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (rc > remaining) {\n\t\t\tcERROR(1, \"sent %d requested %d\", rc, remaining);\n\t\t\tbreak;\n\t\t}\n\n\t\tif (rc == 0) {\n\t\t\t/* should never happen, letting socket clear before\n\t\t\t retrying is our only obvious option here */\n\t\t\tcERROR(1, \"tcp sent no data\");\n\t\t\tmsleep(500);\n\t\t\tcontinue;\n\t\t}\n\n\t\tremaining -= rc;\n\n\t\t/* the line below resets i */\n\t\tfor (i = first_vec; i < n_vec; i++) {\n\t\t\tif (iov[i].iov_len) {\n\t\t\t\tif (rc > iov[i].iov_len) {\n\t\t\t\t\trc -= iov[i].iov_len;\n\t\t\t\t\tiov[i].iov_len = 0;\n\t\t\t\t} else {\n\t\t\t\t\tiov[i].iov_base += rc;\n\t\t\t\t\tiov[i].iov_len -= rc;\n\t\t\t\t\tfirst_vec = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ti = 0; /* in case we get ENOSPC on the next send */\n\t\trc = 0;\n\t}\n\treturn rc;\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " virtual void ResetModel() {\n last_pts_ = 0;\n bits_in_buffer_model_ = cfg_.rc_target_bitrate * cfg_.rc_buf_initial_sz;\n frame_number_ = 0;\n\n tot_frame_number_ = 0;\n first_drop_ = 0;\n num_drops_ = 0;\n for (int i = 0; i < 3; ++i) {\n bits_total_[i] = 0;\n }\n }\n", + "target": " virtual void ResetModel() {\n last_pts_ = 0;\n bits_in_buffer_model_ = cfg_.rc_target_bitrate * cfg_.rc_buf_initial_sz;\n frame_number_ = 0;\n\n tot_frame_number_ = 0;\n first_drop_ = 0;\n num_drops_ = 0;\n // Denoiser is off by default.\n denoiser_on_ = 0;\n for (int i = 0; i < 3; ++i) {\n bits_total_[i] = 0;\n }\n denoiser_offon_test_ = 0;\n denoiser_offon_period_ = -1;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#06bd3c36a733ac27962fea7d6f47168841376824", + "input": "static int ext4_write_end(struct file *file,\n\t\t\t struct address_space *mapping,\n\t\t\t loff_t pos, unsigned len, unsigned copied,\n\t\t\t struct page *page, void *fsdata)\n{\n\thandle_t *handle = ext4_journal_current_handle();\n\tstruct inode *inode = mapping->host;\n\tloff_t old_size = inode->i_size;\n\tint ret = 0, ret2;\n \tint i_size_changed = 0;\n \n \ttrace_ext4_write_end(inode, pos, len, copied);\n\tif (ext4_test_inode_state(inode, EXT4_STATE_ORDERED_MODE)) {\n\t\tret = ext4_jbd2_file_inode(handle, inode);\n\t\tif (ret) {\n\t\t\tunlock_page(page);\n\t\t\tput_page(page);\n\t\t\tgoto errout;\n\t\t}\n\t}\n \tif (ext4_has_inline_data(inode)) {\n \t\tret = ext4_write_inline_data_end(inode, pos, len,\n \t\t\t\t\t\t copied, page);\n\t\tif (ret < 0)\n\t\t\tgoto errout;\n\t\tcopied = ret;\n\t} else\n\t\tcopied = block_write_end(file, mapping, pos,\n\t\t\t\t\t len, copied, page, fsdata);\n\t/*\n\t * it's important to update i_size while still holding page lock:\n\t * page writeout could otherwise come in and zero beyond i_size.\n\t */\n\ti_size_changed = ext4_update_inode_size(inode, pos + copied);\n\tunlock_page(page);\n\tput_page(page);\n\n\tif (old_size < pos)\n\t\tpagecache_isize_extended(inode, old_size, pos);\n\t/*\n\t * Don't mark the inode dirty under page lock. First, it unnecessarily\n\t * makes the holding time of page lock longer. Second, it forces lock\n\t * ordering of page lock and transaction start for journaling\n\t * filesystems.\n\t */\n\tif (i_size_changed)\n\t\text4_mark_inode_dirty(handle, inode);\n\n\tif (pos + len > inode->i_size && ext4_can_truncate(inode))\n\t\t/* if we have allocated more blocks and copied\n\t\t * less. We will have blocks allocated outside\n\t\t * inode->i_size. So truncate them\n\t\t */\n\t\text4_orphan_add(handle, inode);\nerrout:\n\tret2 = ext4_journal_stop(handle);\n\tif (!ret)\n\t\tret = ret2;\n\n\tif (pos + len > inode->i_size) {\n\t\text4_truncate_failed_write(inode);\n\t\t/*\n\t\t * If truncate failed early the inode might still be\n\t\t * on the orphan list; we need to make sure the inode\n\t\t * is removed from the orphan list in that case.\n\t\t */\n\t\tif (inode->i_nlink)\n\t\t\text4_orphan_del(NULL, inode);\n\t}\n\n\treturn ret ? ret : copied;\n}\n", + "target": "static int ext4_write_end(struct file *file,\n\t\t\t struct address_space *mapping,\n\t\t\t loff_t pos, unsigned len, unsigned copied,\n\t\t\t struct page *page, void *fsdata)\n{\n\thandle_t *handle = ext4_journal_current_handle();\n\tstruct inode *inode = mapping->host;\n\tloff_t old_size = inode->i_size;\n\tint ret = 0, ret2;\n \tint i_size_changed = 0;\n \n \ttrace_ext4_write_end(inode, pos, len, copied);\n \tif (ext4_has_inline_data(inode)) {\n \t\tret = ext4_write_inline_data_end(inode, pos, len,\n \t\t\t\t\t\t copied, page);\n\t\tif (ret < 0)\n\t\t\tgoto errout;\n\t\tcopied = ret;\n\t} else\n\t\tcopied = block_write_end(file, mapping, pos,\n\t\t\t\t\t len, copied, page, fsdata);\n\t/*\n\t * it's important to update i_size while still holding page lock:\n\t * page writeout could otherwise come in and zero beyond i_size.\n\t */\n\ti_size_changed = ext4_update_inode_size(inode, pos + copied);\n\tunlock_page(page);\n\tput_page(page);\n\n\tif (old_size < pos)\n\t\tpagecache_isize_extended(inode, old_size, pos);\n\t/*\n\t * Don't mark the inode dirty under page lock. First, it unnecessarily\n\t * makes the holding time of page lock longer. Second, it forces lock\n\t * ordering of page lock and transaction start for journaling\n\t * filesystems.\n\t */\n\tif (i_size_changed)\n\t\text4_mark_inode_dirty(handle, inode);\n\n\tif (pos + len > inode->i_size && ext4_can_truncate(inode))\n\t\t/* if we have allocated more blocks and copied\n\t\t * less. We will have blocks allocated outside\n\t\t * inode->i_size. So truncate them\n\t\t */\n\t\text4_orphan_add(handle, inode);\nerrout:\n\tret2 = ext4_journal_stop(handle);\n\tif (!ret)\n\t\tret = ret2;\n\n\tif (pos + len > inode->i_size) {\n\t\text4_truncate_failed_write(inode);\n\t\t/*\n\t\t * If truncate failed early the inode might still be\n\t\t * on the orphan list; we need to make sure the inode\n\t\t * is removed from the orphan list in that case.\n\t\t */\n\t\tif (inode->i_nlink)\n\t\t\text4_orphan_del(NULL, inode);\n\t}\n\n\treturn ret ? ret : copied;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e0c9c0afd2fc958ffa34b697972721d81df8a56f", + "input": "void __detach_mounts(struct dentry *dentry)\n{\n\tstruct mountpoint *mp;\n\tstruct mount *mnt;\n\n\tnamespace_lock();\n\tmp = lookup_mountpoint(dentry);\n\tif (IS_ERR_OR_NULL(mp))\n\t\tgoto out_unlock;\n\n\tlock_mount_hash();\n\twhile (!hlist_empty(&mp->m_list)) {\n\t\tmnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);\n\t\tif (mnt->mnt.mnt_flags & MNT_UMOUNT) {\n\t\t\tstruct mount *p, *tmp;\n\t\t\tlist_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {\n\t\t\t\thlist_add_head(&p->mnt_umount.s_list, &unmounted);\n \t\t\t\tumount_mnt(p);\n \t\t\t}\n \t\t}\n\t\telse umount_tree(mnt, 0);\n \t}\n \tunlock_mount_hash();\n \tput_mountpoint(mp);\nout_unlock:\n\tnamespace_unlock();\n}\n", + "target": "void __detach_mounts(struct dentry *dentry)\n{\n\tstruct mountpoint *mp;\n\tstruct mount *mnt;\n\n\tnamespace_lock();\n\tmp = lookup_mountpoint(dentry);\n\tif (IS_ERR_OR_NULL(mp))\n\t\tgoto out_unlock;\n\n\tlock_mount_hash();\n\twhile (!hlist_empty(&mp->m_list)) {\n\t\tmnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);\n\t\tif (mnt->mnt.mnt_flags & MNT_UMOUNT) {\n\t\t\tstruct mount *p, *tmp;\n\t\t\tlist_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {\n\t\t\t\thlist_add_head(&p->mnt_umount.s_list, &unmounted);\n \t\t\t\tumount_mnt(p);\n \t\t\t}\n \t\t}\n\t\telse umount_tree(mnt, UMOUNT_CONNECTED);\n \t}\n \tunlock_mount_hash();\n \tput_mountpoint(mp);\nout_unlock:\n\tnamespace_unlock();\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc0b027dfadfcb8a5504f7d8052754bf8d501ab9", + "input": "void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode)\n {\n\t__nfs4_close(path, state, mode, 0);\n }\n", + "target": "void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode)\nvoid nfs4_close_state(struct path *path, struct nfs4_state *state, fmode_t fmode)\n {\n\t__nfs4_close(path, state, fmode, 0);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a81c185f34b34ef8410239506825b185b332c00b", + "input": "void CaptivePortalDetector::DetectCaptivePortal(\n const GURL& url,\n const DetectionCallback& detection_callback) {\n DCHECK(CalledOnValidThread());\n DCHECK(!FetchingURL());\n DCHECK(detection_callback_.is_null());\n\n detection_callback_ = detection_callback;\n\n url_fetcher_ = net::URLFetcher::Create(0, url, net::URLFetcher::GET, this);\n url_fetcher_->SetAutomaticallyRetryOn5xx(false);\n url_fetcher_->SetRequestContext(request_context_.get());\n \n url_fetcher_->SetLoadFlags(\n net::LOAD_BYPASS_CACHE |\n net::LOAD_DO_NOT_SAVE_COOKIES |\n net::LOAD_DO_NOT_SEND_COOKIES |\n net::LOAD_DO_NOT_SEND_AUTH_DATA);\n url_fetcher_->Start();\n}\n", + "target": "void CaptivePortalDetector::DetectCaptivePortal(\n const GURL& url,\n const DetectionCallback& detection_callback) {\n DCHECK(CalledOnValidThread());\n DCHECK(!FetchingURL());\n DCHECK(detection_callback_.is_null());\n\n detection_callback_ = detection_callback;\n\n url_fetcher_ = net::URLFetcher::Create(0, url, net::URLFetcher::GET, this);\n url_fetcher_->SetAutomaticallyRetryOn5xx(false);\n url_fetcher_->SetRequestContext(request_context_.get());\n data_use_measurement::DataUseUserData::AttachToFetcher(\n url_fetcher_.get(),\n data_use_measurement::DataUseUserData::CAPTIVE_PORTAL);\n \n url_fetcher_->SetLoadFlags(\n net::LOAD_BYPASS_CACHE |\n net::LOAD_DO_NOT_SAVE_COOKIES |\n net::LOAD_DO_NOT_SEND_COOKIES |\n net::LOAD_DO_NOT_SEND_AUTH_DATA);\n url_fetcher_->Start();\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#4-a5385cd0f2c9", + "input": "def get_last_month(db, scene):\n sql = \"select date from matches where scene='{}' order by date desc limit 1;\".format(scene)\n res = db.exec(sql)\n date = res[0][0]\n\n # If it has been more than 1 month since this last tournament,\n # go ahead and round this date up by a 1 month\n # eg, if the last tournament was 2015-01-15 (a long time ago)\n # we can assume the scene won't have more tournaments\n # So just round to 2015-02-01\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n y, m, d = today.split('-')\n cy, cm, cd = date.split('-')\n if y > cy or m > cm:\n # Add 1 to the month before we return\n # eg 2018-03-01 -> 2018-04-01\n date = get_next_month(date)\n\n return date", + "target": "def get_last_month(db, scene):\n sql = \"select date from matches where scene='{scene}' order by date desc limit 1;\"\n args = {'scene': scene}\n res = db.exec(sql, args)\n date = res[0][0]\n\n # If it has been more than 1 month since this last tournament,\n # go ahead and round this date up by a 1 month\n # eg, if the last tournament was 2015-01-15 (a long time ago)\n # we can assume the scene won't have more tournaments\n # So just round to 2015-02-01\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n y, m, d = today.split('-')\n cy, cm, cd = date.split('-')\n if y > cy or m > cm:\n # Add 1 to the month before we return\n # eg 2018-03-01 -> 2018-04-01\n date = get_next_month(date)\n\n return date", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4", + "input": "void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)\n{\n\tstruct snd_pcm_runtime *runtime;\n\tunsigned long flags;\n\n\tif (PCM_RUNTIME_CHECK(substream))\n\t\treturn;\n\truntime = substream->runtime;\n\n\tsnd_pcm_stream_lock_irqsave(substream, flags);\n\tif (!snd_pcm_running(substream) ||\n\t snd_pcm_update_hw_ptr0(substream, 1) < 0)\n\t\tgoto _end;\n\n#ifdef CONFIG_SND_PCM_TIMER\n\tif (substream->timer_running)\n \t\tsnd_timer_interrupt(substream->timer, 1);\n #endif\n _end:\n\tsnd_pcm_stream_unlock_irqrestore(substream, flags);\n \tkill_fasync(&runtime->fasync, SIGIO, POLL_IN);\n }\n", + "target": "void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)\n{\n\tstruct snd_pcm_runtime *runtime;\n\tunsigned long flags;\n\n\tif (PCM_RUNTIME_CHECK(substream))\n\t\treturn;\n\truntime = substream->runtime;\n\n\tsnd_pcm_stream_lock_irqsave(substream, flags);\n\tif (!snd_pcm_running(substream) ||\n\t snd_pcm_update_hw_ptr0(substream, 1) < 0)\n\t\tgoto _end;\n\n#ifdef CONFIG_SND_PCM_TIMER\n\tif (substream->timer_running)\n \t\tsnd_timer_interrupt(substream->timer, 1);\n #endif\n _end:\n \tkill_fasync(&runtime->fasync, SIGIO, POLL_IN);\n\tsnd_pcm_stream_unlock_irqrestore(substream, flags);\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#397d425dc26da728396e66d392d5dcb8dac30c37", + "input": "static int follow_dotdot_rcu(struct nameidata *nd)\n{\n\tstruct inode *inode = nd->inode;\n\tif (!nd->root.mnt)\n\t\tset_root_rcu(nd);\n\n\twhile (1) {\n\t\tif (path_equal(&nd->path, &nd->root))\n\t\t\tbreak;\n\t\tif (nd->path.dentry != nd->path.mnt->mnt_root) {\n\t\t\tstruct dentry *old = nd->path.dentry;\n\t\t\tstruct dentry *parent = old->d_parent;\n\t\t\tunsigned seq;\n\n\t\t\tinode = parent->d_inode;\n\t\t\tseq = read_seqcount_begin(&parent->d_seq);\n\t\t\tif (unlikely(read_seqcount_retry(&old->d_seq, nd->seq)))\n \t\t\t\treturn -ECHILD;\n \t\t\tnd->path.dentry = parent;\n \t\t\tnd->seq = seq;\n \t\t\tbreak;\n \t\t} else {\n \t\t\tstruct mount *mnt = real_mount(nd->path.mnt);\n\t\t\tstruct mount *mparent = mnt->mnt_parent;\n\t\t\tstruct dentry *mountpoint = mnt->mnt_mountpoint;\n\t\t\tstruct inode *inode2 = mountpoint->d_inode;\n\t\t\tunsigned seq = read_seqcount_begin(&mountpoint->d_seq);\n\t\t\tif (unlikely(read_seqretry(&mount_lock, nd->m_seq)))\n\t\t\t\treturn -ECHILD;\n\t\t\tif (&mparent->mnt == nd->path.mnt)\n\t\t\t\tbreak;\n\t\t\t/* we know that mountpoint was pinned */\n\t\t\tnd->path.dentry = mountpoint;\n\t\t\tnd->path.mnt = &mparent->mnt;\n\t\t\tinode = inode2;\n\t\t\tnd->seq = seq;\n\t\t}\n\t}\n\twhile (unlikely(d_mountpoint(nd->path.dentry))) {\n\t\tstruct mount *mounted;\n\t\tmounted = __lookup_mnt(nd->path.mnt, nd->path.dentry);\n\t\tif (unlikely(read_seqretry(&mount_lock, nd->m_seq)))\n\t\t\treturn -ECHILD;\n\t\tif (!mounted)\n\t\t\tbreak;\n\t\tnd->path.mnt = &mounted->mnt;\n\t\tnd->path.dentry = mounted->mnt.mnt_root;\n\t\tinode = nd->path.dentry->d_inode;\n\t\tnd->seq = read_seqcount_begin(&nd->path.dentry->d_seq);\n\t}\n\tnd->inode = inode;\n\treturn 0;\n}\n", + "target": "static int follow_dotdot_rcu(struct nameidata *nd)\n{\n\tstruct inode *inode = nd->inode;\n\tif (!nd->root.mnt)\n\t\tset_root_rcu(nd);\n\n\twhile (1) {\n\t\tif (path_equal(&nd->path, &nd->root))\n\t\t\tbreak;\n\t\tif (nd->path.dentry != nd->path.mnt->mnt_root) {\n\t\t\tstruct dentry *old = nd->path.dentry;\n\t\t\tstruct dentry *parent = old->d_parent;\n\t\t\tunsigned seq;\n\n\t\t\tinode = parent->d_inode;\n\t\t\tseq = read_seqcount_begin(&parent->d_seq);\n\t\t\tif (unlikely(read_seqcount_retry(&old->d_seq, nd->seq)))\n \t\t\t\treturn -ECHILD;\n \t\t\tnd->path.dentry = parent;\n \t\t\tnd->seq = seq;\n\t\t\tif (unlikely(!path_connected(&nd->path)))\n\t\t\t\treturn -ENOENT;\n \t\t\tbreak;\n \t\t} else {\n \t\t\tstruct mount *mnt = real_mount(nd->path.mnt);\n\t\t\tstruct mount *mparent = mnt->mnt_parent;\n\t\t\tstruct dentry *mountpoint = mnt->mnt_mountpoint;\n\t\t\tstruct inode *inode2 = mountpoint->d_inode;\n\t\t\tunsigned seq = read_seqcount_begin(&mountpoint->d_seq);\n\t\t\tif (unlikely(read_seqretry(&mount_lock, nd->m_seq)))\n\t\t\t\treturn -ECHILD;\n\t\t\tif (&mparent->mnt == nd->path.mnt)\n\t\t\t\tbreak;\n\t\t\t/* we know that mountpoint was pinned */\n\t\t\tnd->path.dentry = mountpoint;\n\t\t\tnd->path.mnt = &mparent->mnt;\n\t\t\tinode = inode2;\n\t\t\tnd->seq = seq;\n\t\t}\n\t}\n\twhile (unlikely(d_mountpoint(nd->path.dentry))) {\n\t\tstruct mount *mounted;\n\t\tmounted = __lookup_mnt(nd->path.mnt, nd->path.dentry);\n\t\tif (unlikely(read_seqretry(&mount_lock, nd->m_seq)))\n\t\t\treturn -ECHILD;\n\t\tif (!mounted)\n\t\t\tbreak;\n\t\tnd->path.mnt = &mounted->mnt;\n\t\tnd->path.dentry = mounted->mnt.mnt_root;\n\t\tinode = nd->path.dentry->d_inode;\n\t\tnd->seq = read_seqcount_begin(&nd->path.dentry->d_seq);\n\t}\n\tnd->inode = inode;\n\treturn 0;\n}\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#116d0963cadfbf55ef2ec3d13781987c4d80517a", + "input": " void PrintPreviewUI::GetPrintPreviewDataForIndex(\n int index,\n scoped_refptr* data) {\n print_preview_data_service()->GetDataEntry(preview_ui_addr_str_, index, data);\n }\n", + "target": " void PrintPreviewUI::GetPrintPreviewDataForIndex(\n int index,\n scoped_refptr* data) {\n print_preview_data_service()->GetDataEntry(id_, index, data);\n }\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ebc71865f0506a293242bd4aec97cdc7a8ef24b0", + "input": "int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signature,\n\t void *asn, EVP_PKEY *pkey)\n\t{\n\tEVP_MD_CTX ctx;\n\tconst EVP_MD *type = NULL;\n\tunsigned char *buf_in=NULL;\n\tint ret= -1,inl;\n \n int mdnid, pknid;\n \n EVP_MD_CTX_init(&ctx);\n \n /* Convert signature OID into digest and public key OIDs */\n\tif (type == NULL)\n\t\t{\n\t\tASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);\n\t\tgoto err;\n\t\t}\n\n\t/* Check public key OID matches public key type */\n\tif (EVP_PKEY_type(pknid) != pkey->ameth->pkey_id)\n\t\t{\n\t\tASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_WRONG_PUBLIC_KEY_TYPE);\n\t\tgoto err;\n\t\t}\n\n\tif (!EVP_VerifyInit_ex(&ctx,type, NULL))\n\t\t{\n\t\tASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB);\n\t\tret=0;\n\t\tgoto err;\n\t\t}\n\n\tinl = ASN1_item_i2d(asn, &buf_in, it);\n\t\n\tif (buf_in == NULL)\n\t\t{\n\t\tASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\n\tEVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);\n\n\tOPENSSL_cleanse(buf_in,(unsigned int)inl);\n\tOPENSSL_free(buf_in);\n\n\tif (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,\n\t\t\t(unsigned int)signature->length,pkey) <= 0)\n\t\t{\n\t\tASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB);\n\t\tret=0;\n\t\tgoto err;\n\t\t}\n\t/* we don't need to zero the 'ctx' because we just checked\n\t * public information */\n\t/* memset(&ctx,0,sizeof(ctx)); */\n\tret=1;\nerr:\n\tEVP_MD_CTX_cleanup(&ctx);\n\treturn(ret);\n\t}\n", + "target": "int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signature,\n\t void *asn, EVP_PKEY *pkey)\n\t{\n\tEVP_MD_CTX ctx;\n\tconst EVP_MD *type = NULL;\n\tunsigned char *buf_in=NULL;\n\tint ret= -1,inl;\n \n int mdnid, pknid;\n \n if (!pkey)\n {\n ASN1err(ASN1_F_ASN1_ITEM_VERIFY, ERR_R_PASSED_NULL_PARAMETER);\n return -1;\n }\n\n EVP_MD_CTX_init(&ctx);\n \n /* Convert signature OID into digest and public key OIDs */\n\tif (type == NULL)\n\t\t{\n\t\tASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);\n\t\tgoto err;\n\t\t}\n\n\t/* Check public key OID matches public key type */\n\tif (EVP_PKEY_type(pknid) != pkey->ameth->pkey_id)\n\t\t{\n\t\tASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_WRONG_PUBLIC_KEY_TYPE);\n\t\tgoto err;\n\t\t}\n\n\tif (!EVP_VerifyInit_ex(&ctx,type, NULL))\n\t\t{\n\t\tASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB);\n\t\tret=0;\n\t\tgoto err;\n\t\t}\n\n\tinl = ASN1_item_i2d(asn, &buf_in, it);\n\t\n\tif (buf_in == NULL)\n\t\t{\n\t\tASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\n\tEVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);\n\n\tOPENSSL_cleanse(buf_in,(unsigned int)inl);\n\tOPENSSL_free(buf_in);\n\n\tif (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,\n\t\t\t(unsigned int)signature->length,pkey) <= 0)\n\t\t{\n\t\tASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB);\n\t\tret=0;\n\t\tgoto err;\n\t\t}\n\t/* we don't need to zero the 'ctx' because we just checked\n\t * public information */\n\t/* memset(&ctx,0,sizeof(ctx)); */\n\tret=1;\nerr:\n\tEVP_MD_CTX_cleanup(&ctx);\n\treturn(ret);\n\t}\n", + "vul_type": "cwe-310", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#41f5b55ab27da6890af96f2f8f0f6dd5bc6cc93c", + "input": "void SkiaOutputSurfaceImpl::Reshape(const gfx::Size& size,\n float device_scale_factor,\n const gfx::ColorSpace& color_space,\n bool has_alpha,\n bool use_stencil) {\n DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);\n if (initialize_waitable_event_) {\n initialize_waitable_event_->Wait();\n initialize_waitable_event_ = nullptr;\n }\n \n SkSurfaceCharacterization* characterization = nullptr;\n if (characterization_.isValid()) {\n characterization_ =\n characterization_.createResized(size.width(), size.height());\n RecreateRootRecorder();\n } else {\n characterization = &characterization_;\n initialize_waitable_event_ = std::make_unique(\n base::WaitableEvent::ResetPolicy::MANUAL,\n base::WaitableEvent::InitialState::NOT_SIGNALED);\n }\n \n auto callback = base::BindOnce(\n &SkiaOutputSurfaceImplOnGpu::Reshape,\n base::Unretained(impl_on_gpu_.get()), size, device_scale_factor,\n std::move(color_space), has_alpha, use_stencil, pre_transform_,\n characterization, initialize_waitable_event_.get());\n ScheduleGpuTask(std::move(callback), std::vector());\n }\n", + "target": "void SkiaOutputSurfaceImpl::Reshape(const gfx::Size& size,\n float device_scale_factor,\n const gfx::ColorSpace& color_space,\n bool has_alpha,\n bool use_stencil) {\n DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);\n if (initialize_waitable_event_) {\n initialize_waitable_event_->Wait();\n initialize_waitable_event_.reset();\n }\n \n SkSurfaceCharacterization* characterization = nullptr;\n if (characterization_.isValid()) {\n sk_sp sk_color_space = color_space.ToSkColorSpace();\n if (!SkColorSpace::Equals(characterization_.refColorSpace().get(),\n sk_color_space.get())) {\n characterization_ = characterization_.createColorSpace(sk_color_space);\n }\n if (size.width() != characterization_.width() ||\n size.height() != characterization_.height()) {\n characterization_ =\n characterization_.createResized(size.width(), size.height());\n }\n // TODO(kylechar): Update |characterization_| if |use_alpha| changes.\n RecreateRootRecorder();\n } else {\n characterization = &characterization_;\n initialize_waitable_event_ = std::make_unique(\n base::WaitableEvent::ResetPolicy::MANUAL,\n base::WaitableEvent::InitialState::NOT_SIGNALED);\n }\n \n auto task = base::BindOnce(&SkiaOutputSurfaceImplOnGpu::Reshape,\n base::Unretained(impl_on_gpu_.get()), size,\n device_scale_factor, color_space, has_alpha,\n use_stencil, pre_transform_, characterization,\n initialize_waitable_event_.get());\n ScheduleGpuTask(std::move(task), {});\n }\n", + "vul_type": "cwe-704", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#48fae61b8a6c9b741f001d478c595b6c7c0af4d9", + "input": "DWORD SetProcessIntegrityLevel(IntegrityLevel integrity_level) {\n if (base::win::GetVersion() < base::win::VERSION_VISTA)\n return ERROR_SUCCESS;\n \n const wchar_t* integrity_level_str = GetIntegrityLevelString(integrity_level);\n if (!integrity_level_str) {\n return ERROR_SUCCESS;\n }\n \n std::wstring ace_access = SDDL_NO_READ_UP;\n ace_access += SDDL_NO_WRITE_UP;\n DWORD error = SetObjectIntegrityLabel(::GetCurrentProcess(), SE_KERNEL_OBJECT,\n ace_access.c_str(),\n integrity_level_str);\n if (ERROR_SUCCESS != error)\n return error;\n HANDLE token_handle;\n if (!::OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_DEFAULT,\n &token_handle))\n return ::GetLastError();\n\n base::win::ScopedHandle token(token_handle);\n\n return SetTokenIntegrityLevel(token.Get(), integrity_level);\n}\n", + "target": "DWORD SetProcessIntegrityLevel(IntegrityLevel integrity_level) {\n if (base::win::GetVersion() < base::win::VERSION_VISTA)\n return ERROR_SUCCESS;\n \n // We don't check for an invalid level here because we'll just let it\n // fail on the SetTokenIntegrityLevel call later on.\n if (integrity_level == INTEGRITY_LEVEL_LAST) {\n return ERROR_SUCCESS;\n }\n \n HANDLE token_handle;\n if (!::OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_DEFAULT,\n &token_handle))\n return ::GetLastError();\n\n base::win::ScopedHandle token(token_handle);\n\n return SetTokenIntegrityLevel(token.Get(), integrity_level);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5e5571d1a431eb3c61977b6dd6ec90186ef79867", + "input": "get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {\n char * name = NULL;\n int rtnVal = FALSE;\n bool found_cred=false;\n CredentialWrapper * cred = NULL;\n char * owner = NULL;\n const char * user = NULL;\n void * data = NULL;\n\n ReliSock * socket = (ReliSock*)stream;\n\n if (!socket->triedAuthentication()) {\n CondorError errstack;\n if( ! SecMan::authenticate_sock(socket, READ, &errstack) ) {\n dprintf (D_ALWAYS, \"Unable to authenticate, qutting\\n\");\n goto EXIT;\n }\n }\n\n socket->decode();\n\n if (!socket->code(name)) {\n dprintf (D_ALWAYS, \"Error receiving credential name\\n\"); \n goto EXIT;\n }\n\n user = socket->getFullyQualifiedUser();\n dprintf (D_ALWAYS, \"Authenticated as %s\\n\", user);\n\n if (strchr (name, ':')) {\n\n owner = strdup (name);\n char * pColon = strchr (owner, ':');\n *pColon = '\\0';\n \n sprintf (name, (char*)(pColon+sizeof(char)));\n \n if (strcmp (owner, user) != 0) { \n dprintf (D_ALWAYS, \"Requesting another user's (%s) credential %s\\n\", owner, name);\n\n if (!isSuperUser (user)) {\n\tdprintf (D_ALWAYS, \"User %s is NOT super user, request DENIED\\n\", user);\n\tgoto EXIT;\n } else {\n\tdprintf (D_FULLDEBUG, \"User %s is super user, request GRANTED\\n\", user);\n }\n }\n\n } else {\n owner = strdup (user);\n }\n\n dprintf (D_ALWAYS, \"sending cred %s for user %s\\n\", name, owner);\n\n credentials.Rewind();\n while (credentials.Next(cred)) {\n\t if (cred->cred->GetType() == X509_CREDENTIAL_TYPE) {\n\t\t if ((strcmp(cred->cred->GetName(), name) == 0) && \n\t\t\t (strcmp(cred->cred->GetOwner(), owner) == 0)) {\n\t\t\t found_cred=true;\n\t\t\t break; // found it\n }\n }\n }\n \n socket->encode();\n\n if (found_cred) {\n dprintf (D_FULLDEBUG, \"Found cred %s\\n\", cred->GetStorageName());\n \n int data_size;\n\n \n int rc = LoadData (cred->GetStorageName(), data, data_size);\n dprintf (D_FULLDEBUG, \"Credential::LoadData returned %d\\n\", rc);\n if (rc == 0) {\n goto EXIT;\n }\n \n socket->code (data_size);\n socket->code_bytes (data, data_size);\n dprintf (D_ALWAYS, \"Credential name %s for owner %s returned to user %s\\n\",\n\t\t\tname, owner, user);\n }\n else {\n dprintf (D_ALWAYS, \"Cannot find cred %s\\n\", name);\n int rc = CREDD_CREDENTIAL_NOT_FOUND;\n socket->code (rc);\n }\n\n rtnVal = TRUE;\nEXIT:\n if ( name != NULL) {\n\t free (name);\n }\n if ( owner != NULL) {\n\t free (owner);\n }\n if ( data != NULL) {\n\t free (data);\n }\n return rtnVal;\n}\n", + "target": "get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {\n char * name = NULL;\n int rtnVal = FALSE;\n bool found_cred=false;\n CredentialWrapper * cred = NULL;\n char * owner = NULL;\n const char * user = NULL;\n void * data = NULL;\n\n ReliSock * socket = (ReliSock*)stream;\n\n if (!socket->triedAuthentication()) {\n CondorError errstack;\n if( ! SecMan::authenticate_sock(socket, READ, &errstack) ) {\n dprintf (D_ALWAYS, \"Unable to authenticate, qutting\\n\");\n goto EXIT;\n }\n }\n\n socket->decode();\n\n if (!socket->code(name)) {\n dprintf (D_ALWAYS, \"Error receiving credential name\\n\"); \n goto EXIT;\n }\n\n user = socket->getFullyQualifiedUser();\n dprintf (D_ALWAYS, \"Authenticated as %s\\n\", user);\n\n if (strchr (name, ':')) {\n\n owner = strdup (name);\n char * pColon = strchr (owner, ':');\n *pColon = '\\0';\n \n sprintf (name, \"%s\", (char*)(pColon+sizeof(char)));\n \n if (strcmp (owner, user) != 0) { \n dprintf (D_ALWAYS, \"Requesting another user's (%s) credential %s\\n\", owner, name);\n\n if (!isSuperUser (user)) {\n\tdprintf (D_ALWAYS, \"User %s is NOT super user, request DENIED\\n\", user);\n\tgoto EXIT;\n } else {\n\tdprintf (D_FULLDEBUG, \"User %s is super user, request GRANTED\\n\", user);\n }\n }\n\n } else {\n owner = strdup (user);\n }\n\n dprintf (D_ALWAYS, \"sending cred %s for user %s\\n\", name, owner);\n\n credentials.Rewind();\n while (credentials.Next(cred)) {\n\t if (cred->cred->GetType() == X509_CREDENTIAL_TYPE) {\n\t\t if ((strcmp(cred->cred->GetName(), name) == 0) && \n\t\t\t (strcmp(cred->cred->GetOwner(), owner) == 0)) {\n\t\t\t found_cred=true;\n\t\t\t break; // found it\n }\n }\n }\n \n socket->encode();\n\n if (found_cred) {\n dprintf (D_FULLDEBUG, \"Found cred %s\\n\", cred->GetStorageName());\n \n int data_size;\n\n \n int rc = LoadData (cred->GetStorageName(), data, data_size);\n dprintf (D_FULLDEBUG, \"Credential::LoadData returned %d\\n\", rc);\n if (rc == 0) {\n goto EXIT;\n }\n \n socket->code (data_size);\n socket->code_bytes (data, data_size);\n dprintf (D_ALWAYS, \"Credential name %s for owner %s returned to user %s\\n\",\n\t\t\tname, owner, user);\n }\n else {\n dprintf (D_ALWAYS, \"Cannot find cred %s\\n\", name);\n int rc = CREDD_CREDENTIAL_NOT_FOUND;\n socket->code (rc);\n }\n\n rtnVal = TRUE;\nEXIT:\n if ( name != NULL) {\n\t free (name);\n }\n if ( owner != NULL) {\n\t free (owner);\n }\n if ( data != NULL) {\n\t free (data);\n }\n return rtnVal;\n}\n", + "vul_type": "cwe-134", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#af3ff8045bbf3e32f1a448542e73abb4c8ceb6f1", + "input": "static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,\n\t\t\t unsigned int keylen)\n {\n \treturn -ENOSYS;\n }\n", + "target": "static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,\nint shash_no_setkey(struct crypto_shash *tfm, const u8 *key,\n\t\t unsigned int keylen)\n {\n \treturn -ENOSYS;\n }\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#086ba77a6db00ed858ff07451bedee197df868c9", + "input": "static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret)\n{\n\tstruct trace_array *tr = data;\n\tstruct ftrace_event_file *ftrace_file;\n\tstruct syscall_trace_exit *entry;\n\tstruct syscall_metadata *sys_data;\n\tstruct ring_buffer_event *event;\n\tstruct ring_buffer *buffer;\n\tunsigned long irq_flags;\n\tint pc;\n \tint syscall_nr;\n \n \tsyscall_nr = trace_get_syscall_nr(current, regs);\n\tif (syscall_nr < 0)\n \t\treturn;\n \n \t/* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE()) */\n\tftrace_file = rcu_dereference_sched(tr->exit_syscall_files[syscall_nr]);\n\tif (!ftrace_file)\n\t\treturn;\n\n\tif (ftrace_trigger_soft_disabled(ftrace_file))\n\t\treturn;\n\n\tsys_data = syscall_nr_to_meta(syscall_nr);\n\tif (!sys_data)\n\t\treturn;\n\n\tlocal_save_flags(irq_flags);\n\tpc = preempt_count();\n\n\tbuffer = tr->trace_buffer.buffer;\n\tevent = trace_buffer_lock_reserve(buffer,\n\t\t\tsys_data->exit_event->event.type, sizeof(*entry),\n\t\t\tirq_flags, pc);\n\tif (!event)\n\t\treturn;\n\n\tentry = ring_buffer_event_data(event);\n\tentry->nr = syscall_nr;\n\tentry->ret = syscall_get_return_value(current, regs);\n\n\tevent_trigger_unlock_commit(ftrace_file, buffer, event, entry,\n\t\t\t\t irq_flags, pc);\n}\n", + "target": "static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret)\n{\n\tstruct trace_array *tr = data;\n\tstruct ftrace_event_file *ftrace_file;\n\tstruct syscall_trace_exit *entry;\n\tstruct syscall_metadata *sys_data;\n\tstruct ring_buffer_event *event;\n\tstruct ring_buffer *buffer;\n\tunsigned long irq_flags;\n\tint pc;\n \tint syscall_nr;\n \n \tsyscall_nr = trace_get_syscall_nr(current, regs);\n\tif (syscall_nr < 0 || syscall_nr >= NR_syscalls)\n \t\treturn;\n \n \t/* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE()) */\n\tftrace_file = rcu_dereference_sched(tr->exit_syscall_files[syscall_nr]);\n\tif (!ftrace_file)\n\t\treturn;\n\n\tif (ftrace_trigger_soft_disabled(ftrace_file))\n\t\treturn;\n\n\tsys_data = syscall_nr_to_meta(syscall_nr);\n\tif (!sys_data)\n\t\treturn;\n\n\tlocal_save_flags(irq_flags);\n\tpc = preempt_count();\n\n\tbuffer = tr->trace_buffer.buffer;\n\tevent = trace_buffer_lock_reserve(buffer,\n\t\t\tsys_data->exit_event->event.type, sizeof(*entry),\n\t\t\tirq_flags, pc);\n\tif (!event)\n\t\treturn;\n\n\tentry = ring_buffer_event_data(event);\n\tentry->nr = syscall_nr;\n\tentry->ret = syscall_get_return_value(current, regs);\n\n\tevent_trigger_unlock_commit(ftrace_file, buffer, event, entry,\n\t\t\t\t irq_flags, pc);\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7b2d314a61fd0e12f47c62996cb49ec0d1ba747a", + "input": "JBIG2Bitmap::JBIG2Bitmap(Guint segNumA, JBIG2Bitmap *bitmap):\n JBIG2Segment(segNumA)\n{\n w = bitmap->w;\n h = bitmap->h;\n line = bitmap->line;\n\n if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) {\n error(-1, \"invalid width/height\");\n data = NULL;\n return;\n }\n data = (Guchar *)gmalloc(h * line + 1);\n memcpy(data, bitmap->data, h * line);\n data[h * line] = 0;\n }\n", + "target": "JBIG2Bitmap::JBIG2Bitmap(Guint segNumA, JBIG2Bitmap *bitmap):\n JBIG2Segment(segNumA)\n{\n w = bitmap->w;\n h = bitmap->h;\n line = bitmap->line;\n\n if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) {\n error(-1, \"invalid width/height\");\n data = NULL;\n return;\n }\n data = (Guchar *)gmallocn(h, line + 1);\n memcpy(data, bitmap->data, h * line);\n data[h * line] = 0;\n }\n", + "vul_type": "cwe-189", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#df4d92549f23e1c037e83323aff58a21b3de7fe0", + "input": "static int __mkroute_input(struct sk_buff *skb,\n\t\t\t const struct fib_result *res,\n\t\t\t struct in_device *in_dev,\n\t\t\t __be32 daddr, __be32 saddr, u32 tos)\n{\n\tstruct fib_nh_exception *fnhe;\n\tstruct rtable *rth;\n\tint err;\n\tstruct in_device *out_dev;\n\tunsigned int flags = 0;\n\tbool do_cache;\n\tu32 itag = 0;\n\n\t/* get a working reference to the output device */\n\tout_dev = __in_dev_get_rcu(FIB_RES_DEV(*res));\n\tif (out_dev == NULL) {\n\t\tnet_crit_ratelimited(\"Bug in ip_route_input_slow(). Please report.\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\terr = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res),\n\t\t\t\t in_dev->dev, in_dev, &itag);\n\tif (err < 0) {\n\t\tip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,\n\t\t\t\t\t saddr);\n\n\t\tgoto cleanup;\n\t}\n \n \tdo_cache = res->fi && !itag;\n \tif (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&\n \t (IN_DEV_SHARED_MEDIA(out_dev) ||\n\t inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) {\n\t\tflags |= RTCF_DOREDIRECT;\n\t\tdo_cache = false;\n\t}\n \n \tif (skb->protocol != htons(ETH_P_IP)) {\n \t\t/* Not IP (i.e. ARP). Do not create route, if it is\n\t\t * invalid for proxy arp. DNAT routes are always valid.\n\t\t *\n\t\t * Proxy arp feature have been extended to allow, ARP\n\t\t * replies back to the same interface, to support\n\t\t * Private VLAN switch technologies. See arp.c.\n\t\t */\n\t\tif (out_dev == in_dev &&\n\t\t IN_DEV_PROXY_ARP_PVLAN(in_dev) == 0) {\n\t\t\terr = -EINVAL;\n\t\t\tgoto cleanup;\n\t\t}\n\t}\n\n\tfnhe = find_exception(&FIB_RES_NH(*res), daddr);\n\tif (do_cache) {\n\t\tif (fnhe != NULL)\n\t\t\trth = rcu_dereference(fnhe->fnhe_rth_input);\n\t\telse\n\t\t\trth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input);\n\n\t\tif (rt_cache_valid(rth)) {\n\t\t\tskb_dst_set_noref(skb, &rth->dst);\n\t\t\tgoto out;\n\t\t}\n\t}\n\n\trth = rt_dst_alloc(out_dev->dev,\n\t\t\t IN_DEV_CONF_GET(in_dev, NOPOLICY),\n\t\t\t IN_DEV_CONF_GET(out_dev, NOXFRM), do_cache);\n\tif (!rth) {\n\t\terr = -ENOBUFS;\n\t\tgoto cleanup;\n\t}\n\n\trth->rt_genid = rt_genid_ipv4(dev_net(rth->dst.dev));\n\trth->rt_flags = flags;\n\trth->rt_type = res->type;\n\trth->rt_is_input = 1;\n\trth->rt_iif \t= 0;\n\trth->rt_pmtu\t= 0;\n\trth->rt_gateway\t= 0;\n\trth->rt_uses_gateway = 0;\n\tINIT_LIST_HEAD(&rth->rt_uncached);\n\tRT_CACHE_STAT_INC(in_slow_tot);\n\n\trth->dst.input = ip_forward;\n\trth->dst.output = ip_output;\n\n\trt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag);\n\tskb_dst_set(skb, &rth->dst);\nout:\n\terr = 0;\n cleanup:\n\treturn err;\n}\n", + "target": "static int __mkroute_input(struct sk_buff *skb,\n\t\t\t const struct fib_result *res,\n\t\t\t struct in_device *in_dev,\n\t\t\t __be32 daddr, __be32 saddr, u32 tos)\n{\n\tstruct fib_nh_exception *fnhe;\n\tstruct rtable *rth;\n\tint err;\n\tstruct in_device *out_dev;\n\tunsigned int flags = 0;\n\tbool do_cache;\n\tu32 itag = 0;\n\n\t/* get a working reference to the output device */\n\tout_dev = __in_dev_get_rcu(FIB_RES_DEV(*res));\n\tif (out_dev == NULL) {\n\t\tnet_crit_ratelimited(\"Bug in ip_route_input_slow(). Please report.\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\terr = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res),\n\t\t\t\t in_dev->dev, in_dev, &itag);\n\tif (err < 0) {\n\t\tip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,\n\t\t\t\t\t saddr);\n\n\t\tgoto cleanup;\n\t}\n \n \tdo_cache = res->fi && !itag;\n \tif (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&\n\t skb->protocol == htons(ETH_P_IP) &&\n \t (IN_DEV_SHARED_MEDIA(out_dev) ||\n\t inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))\n\t\tIPCB(skb)->flags |= IPSKB_DOREDIRECT;\n \n \tif (skb->protocol != htons(ETH_P_IP)) {\n \t\t/* Not IP (i.e. ARP). Do not create route, if it is\n\t\t * invalid for proxy arp. DNAT routes are always valid.\n\t\t *\n\t\t * Proxy arp feature have been extended to allow, ARP\n\t\t * replies back to the same interface, to support\n\t\t * Private VLAN switch technologies. See arp.c.\n\t\t */\n\t\tif (out_dev == in_dev &&\n\t\t IN_DEV_PROXY_ARP_PVLAN(in_dev) == 0) {\n\t\t\terr = -EINVAL;\n\t\t\tgoto cleanup;\n\t\t}\n\t}\n\n\tfnhe = find_exception(&FIB_RES_NH(*res), daddr);\n\tif (do_cache) {\n\t\tif (fnhe != NULL)\n\t\t\trth = rcu_dereference(fnhe->fnhe_rth_input);\n\t\telse\n\t\t\trth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input);\n\n\t\tif (rt_cache_valid(rth)) {\n\t\t\tskb_dst_set_noref(skb, &rth->dst);\n\t\t\tgoto out;\n\t\t}\n\t}\n\n\trth = rt_dst_alloc(out_dev->dev,\n\t\t\t IN_DEV_CONF_GET(in_dev, NOPOLICY),\n\t\t\t IN_DEV_CONF_GET(out_dev, NOXFRM), do_cache);\n\tif (!rth) {\n\t\terr = -ENOBUFS;\n\t\tgoto cleanup;\n\t}\n\n\trth->rt_genid = rt_genid_ipv4(dev_net(rth->dst.dev));\n\trth->rt_flags = flags;\n\trth->rt_type = res->type;\n\trth->rt_is_input = 1;\n\trth->rt_iif \t= 0;\n\trth->rt_pmtu\t= 0;\n\trth->rt_gateway\t= 0;\n\trth->rt_uses_gateway = 0;\n\tINIT_LIST_HEAD(&rth->rt_uncached);\n\tRT_CACHE_STAT_INC(in_slow_tot);\n\n\trth->dst.input = ip_forward;\n\trth->dst.output = ip_output;\n\n\trt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag);\n\tskb_dst_set(skb, &rth->dst);\nout:\n\terr = 0;\n cleanup:\n\treturn err;\n}\n", + "vul_type": "cwe-17", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9a6bce9b615abca6068348c1606ba8eaf13d9ae0", + "input": "my_object_recursive1 (MyObject *obj, GArray *array, guint32 *len_ret, GError **error)\n{\n *len_ret = array->len;\n return TRUE;\n}\n", + "target": "my_object_recursive1 (MyObject *obj, GArray *array, guint32 *len_ret, GError **error)\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d", + "input": "void Segment::AppendCluster(Cluster* pCluster) {\n assert(pCluster);\n assert(pCluster->m_index >= 0);\n \n const long count = m_clusterCount + m_clusterPreloadCount;\n \n long& size = m_clusterSize;\n assert(size >= count);\n const long idx = pCluster->m_index;\n assert(idx == m_clusterCount);\n \n if (count >= size) {\n const long n = (size <= 0) ? 2048 : 2 * size;\n \n Cluster** const qq = new Cluster* [n];\n Cluster** q = qq;\n \n Cluster** p = m_clusters;\n Cluster** const pp = p + count;\n \n while (p != pp)\n *q++ = *p++;\n\n delete[] m_clusters;\n\n m_clusters = qq;\n size = n;\n\n }\n \n if (m_clusterPreloadCount > 0) {\n assert(m_clusters);\n Cluster** const p = m_clusters + m_clusterCount;\n assert(*p);\n assert((*p)->m_index < 0);\n \n Cluster** q = p + m_clusterPreloadCount;\n assert(q < (m_clusters + size));\n \n for (;;) {\n Cluster** const qq = q - 1;\n assert((*qq)->m_index < 0);\n \n *q = *qq;\n q = qq;\n\n if (q == p)\n break;\n }\n }\n\n \n m_clusters[idx] = pCluster;\n ++m_clusterCount;\n }\n", + "target": "void Segment::AppendCluster(Cluster* pCluster) {\nbool Segment::AppendCluster(Cluster* pCluster) {\n if (pCluster == NULL || pCluster->m_index < 0)\n return false;\n \n const long count = m_clusterCount + m_clusterPreloadCount;\n \n long& size = m_clusterSize;\n const long idx = pCluster->m_index;\n\n if (size < count || idx != m_clusterCount)\n return false;\n \n if (count >= size) {\n const long n = (size <= 0) ? 2048 : 2 * size;\n \n Cluster** const qq = new (std::nothrow) Cluster*[n];\n if (qq == NULL)\n return false;\n \n Cluster** q = qq;\n Cluster** p = m_clusters;\n Cluster** const pp = p + count;\n \n while (p != pp)\n *q++ = *p++;\n\n delete[] m_clusters;\n\n m_clusters = qq;\n size = n;\n\n }\n \n if (m_clusterPreloadCount > 0) {\n Cluster** const p = m_clusters + m_clusterCount;\n if (*p == NULL || (*p)->m_index >= 0)\n return false;\n \n Cluster** q = p + m_clusterPreloadCount;\n if (q >= (m_clusters + size))\n return false;\n \n for (;;) {\n Cluster** const qq = q - 1;\n if ((*qq)->m_index >= 0)\n return false;\n \n *q = *qq;\n q = qq;\n\n if (q == p)\n break;\n }\n }\n\n \n m_clusters[idx] = pCluster;\n ++m_clusterCount;\n return true;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "png_have_neon(png_structp png_ptr)\n{\n FILE *f = fopen(\"/proc/cpuinfo\", \"rb\");\n\n if (f != NULL)\n {\n /* This is a simple state machine which reads the input byte-by-byte until\n * it gets a match on the 'neon' feature or reaches the end of the stream.\n */\n static const char ch_feature[] = { 70, 69, 65, 84, 85, 82, 69, 83 };\n static const char ch_neon[] = { 78, 69, 79, 78 };\n\n enum\n {\n StartLine, Feature, Colon, StartTag, Neon, HaveNeon, SkipTag, SkipLine\n } state;\n int counter;\n\n for (state=StartLine, counter=0;;)\n {\n int ch = fgetc(f);\n\n if (ch == EOF)\n {\n /* EOF means error or end-of-file, return false; neon at EOF is\n * assumed to be a mistake.\n */\n fclose(f);\n return 0;\n }\n\n switch (state)\n {\n case StartLine:\n /* Match spaces at the start of line */\n if (ch <= 32) /* skip control characters and space */\n break;\n\n counter=0;\n state = Feature;\n /* FALL THROUGH */\n\n case Feature:\n /* Match 'FEATURE', ASCII case insensitive. */\n if ((ch & ~0x20) == ch_feature[counter])\n {\n if (++counter == (sizeof ch_feature))\n\n state = Colon;\n break;\n }\n /* did not match 'feature' */\n state = SkipLine;\n /* FALL THROUGH */\n\n case SkipLine:\n skipLine:\n /* Skip everything until we see linefeed or carriage return */\n if (ch != 10 && ch != 13)\n break;\n\n state = StartLine;\n break;\n\n case Colon:\n /* Match any number of space or tab followed by ':' */\n if (ch == 32 || ch == 9)\n break;\n\n if (ch == 58) /* i.e. ':' */\n {\n state = StartTag;\n break;\n }\n\n /* Either a bad line format or a 'feature' prefix followed by\n * other characters.\n */\n state = SkipLine;\n goto skipLine;\n\n case StartTag:\n /* Skip space characters before a tag */\n if (ch == 32 || ch == 9)\n break;\n\n state = Neon;\n counter = 0;\n /* FALL THROUGH */\n\n case Neon:\n /* Look for 'neon' tag */\n if ((ch & ~0x20) == ch_neon[counter])\n {\n if (++counter == (sizeof ch_neon))\n state = HaveNeon;\n break;\n }\n\n state = SkipTag;\n /* FALL THROUGH */\n\n case SkipTag:\n /* Skip non-space characters */\n if (ch == 10 || ch == 13)\n state = StartLine;\n\n else if (ch == 32 || ch == 9)\n state = StartTag;\n break;\n\n case HaveNeon:\n /* Have seen a 'neon' prefix, but there must be a space or new\n * line character to terminate it.\n */\n if (ch == 10 || ch == 13 || ch == 32 || ch == 9)\n {\n fclose(f);\n return 1;\n }\n\n state = SkipTag;\n break;\n\n default:\n png_error(png_ptr, \"png_have_neon: internal error (bug)\");\n }\n\n }\n }\n \n else\n png_warning(png_ptr, \"/proc/cpuinfo open failed\");\n \n return 0;\n }\n", + "target": "png_have_neon(png_structp png_ptr)\n{\n FILE *f = fopen(\"/proc/cpuinfo\", \"rb\");\n\n if (f != NULL)\n {\n /* This is a simple state machine which reads the input byte-by-byte until\n * it gets a match on the 'neon' feature or reaches the end of the stream.\n */\n static const char ch_feature[] = { 70, 69, 65, 84, 85, 82, 69, 83 };\n static const char ch_neon[] = { 78, 69, 79, 78 };\n\n enum\n {\n StartLine, Feature, Colon, StartTag, Neon, HaveNeon, SkipTag, SkipLine\n } state;\n int counter;\n\n for (state=StartLine, counter=0;;)\n {\n int ch = fgetc(f);\n\n if (ch == EOF)\n {\n /* EOF means error or end-of-file, return false; neon at EOF is\n * assumed to be a mistake.\n */\n fclose(f);\n return 0;\n }\n\n switch (state)\n {\n case StartLine:\n /* Match spaces at the start of line */\n if (ch <= 32) /* skip control characters and space */\n break;\n\n counter=0;\n state = Feature;\n /* FALL THROUGH */\n\n case Feature:\n /* Match 'FEATURE', ASCII case insensitive. */\n if ((ch & ~0x20) == ch_feature[counter])\n {\n if (++counter == (sizeof ch_feature))\n\n state = Colon;\n break;\n }\n\n /* did not match 'feature' */\n state = SkipLine;\n /* FALL THROUGH */\n\n case SkipLine:\n skipLine:\n /* Skip everything until we see linefeed or carriage return */\n if (ch != 10 && ch != 13)\n break;\n\n state = StartLine;\n break;\n\n case Colon:\n /* Match any number of space or tab followed by ':' */\n if (ch == 32 || ch == 9)\n break;\n\n if (ch == 58) /* i.e. ':' */\n {\n state = StartTag;\n break;\n }\n\n /* Either a bad line format or a 'feature' prefix followed by\n * other characters.\n */\n state = SkipLine;\n goto skipLine;\n\n case StartTag:\n /* Skip space characters before a tag */\n if (ch == 32 || ch == 9)\n break;\n\n state = Neon;\n counter = 0;\n /* FALL THROUGH */\n\n case Neon:\n /* Look for 'neon' tag */\n if ((ch & ~0x20) == ch_neon[counter])\n {\n if (++counter == (sizeof ch_neon))\n state = HaveNeon;\n break;\n }\n\n state = SkipTag;\n /* FALL THROUGH */\n\n case SkipTag:\n /* Skip non-space characters */\n if (ch == 10 || ch == 13)\n state = StartLine;\n\n else if (ch == 32 || ch == 9)\n state = StartTag;\n break;\n\n case HaveNeon:\n /* Have seen a 'neon' prefix, but there must be a space or new\n * line character to terminate it.\n */\n if (ch == 10 || ch == 13 || ch == 32 || ch == 9)\n {\n fclose(f);\n return 1;\n }\n\n state = SkipTag;\n break;\n\n default:\n png_error(png_ptr, \"png_have_neon: internal error (bug)\");\n }\n\n }\n }\n \n#ifdef PNG_WARNINGS_SUPPORTED\n else\n png_warning(png_ptr, \"/proc/cpuinfo open failed\");\n#endif\n \n return 0;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fcd3a7a671ecf2d5f46ea34787d27507a914d2f5", + "input": " void ProfileSyncService::RegisterNewDataType(syncable::ModelType data_type) {\n if (data_type_controllers_.count(data_type) > 0)\n return;\n switch (data_type) {\n case syncable::SESSIONS:\n if (CommandLine::ForCurrentProcess()->HasSwitch(\n switches::kDisableSyncTabs)) {\n return;\n }\n RegisterDataTypeController(\n new browser_sync::SessionDataTypeController(factory_.get(),\n profile_,\n this));\n return;\n default:\n break;\n }\n NOTREACHED();\n }\n", + "target": " void ProfileSyncService::RegisterNewDataType(syncable::ModelType data_type) {\n if (data_type_controllers_.count(data_type) > 0)\n return;\n NOTREACHED();\n }\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#36ae3c0a36b7456432fedce38ae2f7bd3e01a563", + "input": "kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)\n {\n \tif (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | KVM_IRQFD_FLAG_RESAMPLE))\n \t\treturn -EINVAL;\n \n \tif (args->flags & KVM_IRQFD_FLAG_DEASSIGN)\n \t\treturn kvm_irqfd_deassign(kvm, args);\n\n\treturn kvm_irqfd_assign(kvm, args);\n}\n", + "target": "kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)\n {\n \tif (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | KVM_IRQFD_FLAG_RESAMPLE))\n \t\treturn -EINVAL;\n\tif (args->gsi >= KVM_MAX_IRQ_ROUTES)\n\t\treturn -EINVAL;\n \n \tif (args->flags & KVM_IRQFD_FLAG_DEASSIGN)\n \t\treturn kvm_irqfd_deassign(kvm, args);\n\n\treturn kvm_irqfd_assign(kvm, args);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b71fc042e1124cda2ab51dfdacc2362da62779a6", + "input": "bool AsyncPixelTransfersCompletedQuery::End(\n base::subtle::Atomic32 submit_count) {\n AsyncMemoryParams mem_params;\n Buffer buffer = manager()->decoder()->GetSharedMemoryBuffer(shm_id());\n if (!buffer.shared_memory)\n return false;\n mem_params.shared_memory = buffer.shared_memory;\n mem_params.shm_size = buffer.size;\n mem_params.shm_data_offset = shm_offset();\n mem_params.shm_data_size = sizeof(QuerySync);\n \n observer_ = new AsyncPixelTransferCompletionObserverImpl(submit_count);\n \n manager()->decoder()->GetAsyncPixelTransferManager()\n ->AsyncNotifyCompletion(mem_params, observer_);\n\n return AddToPendingTransferQueue(submit_count);\n}\n", + "target": "bool AsyncPixelTransfersCompletedQuery::End(\n base::subtle::Atomic32 submit_count) {\n AsyncMemoryParams mem_params;\n Buffer buffer = manager()->decoder()->GetSharedMemoryBuffer(shm_id());\n if (!buffer.shared_memory)\n return false;\n mem_params.shared_memory = buffer.shared_memory;\n mem_params.shm_size = buffer.size;\n mem_params.shm_data_offset = shm_offset();\n mem_params.shm_data_size = sizeof(QuerySync);\n uint32 end = mem_params.shm_data_offset + mem_params.shm_data_size;\n if (end > mem_params.shm_size || end < mem_params.shm_data_offset)\n return false;\n \n observer_ = new AsyncPixelTransferCompletionObserverImpl(submit_count);\n \n manager()->decoder()->GetAsyncPixelTransferManager()\n ->AsyncNotifyCompletion(mem_params, observer_);\n\n return AddToPendingTransferQueue(submit_count);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d42b2388f7f8e0332c846675133acea151fc557a", + "input": "int main(int argc, char **argv)\n{\n\tint fmtid;\n\tint id;\n\tchar *infile;\n\tjas_stream_t *instream;\n\tjas_image_t *image;\n\tint width;\n\tint height;\n\tint depth;\n\tint numcmpts;\n\tint verbose;\n \tchar *fmtname;\n \tint debug;\n \tsize_t max_mem;\n \n \tif (jas_init()) {\n \t\tabort();\n \t}\n \n \tcmdname = argv[0];\n \n \tinfile = 0;\n \tverbose = 0;\n \tdebug = 0;\n#if defined(JAS_DEFAULT_MAX_MEM_USAGE)\n\tmax_mem = JAS_DEFAULT_MAX_MEM_USAGE;\n#endif\n\n\t/* Parse the command line options. */\n\twhile ((id = jas_getopt(argc, argv, opts)) >= 0) {\n\t\tswitch (id) {\n\t\tcase OPT_VERBOSE:\n\t\t\tverbose = 1;\n\t\t\tbreak;\n\t\tcase OPT_VERSION:\n\t\t\tprintf(\"%s\\n\", JAS_VERSION);\n\t\t\texit(EXIT_SUCCESS);\n\t\t\tbreak;\n\t\tcase OPT_DEBUG:\n\t\t\tdebug = atoi(jas_optarg);\n\t\t\tbreak;\n \t\tcase OPT_INFILE:\n \t\t\tinfile = jas_optarg;\n \t\t\tbreak;\n \t\tcase OPT_MAXMEM:\n \t\t\tmax_mem = strtoull(jas_optarg, 0, 10);\n \t\t\tbreak;\n\t\tcase OPT_HELP:\n\t\tdefault:\n\t\t\tusage();\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tjas_setdbglevel(debug);\n#if defined(JAS_DEFAULT_MAX_MEM_USAGE)\n\tjas_set_max_mem_usage(max_mem);\n#endif\n\n\t/* Open the image file. */\n\tif (infile) {\n\t\t/* The image is to be read from a file. */\n\t\tif (!(instream = jas_stream_fopen(infile, \"rb\"))) {\n\t\t\tfprintf(stderr, \"cannot open input image file %s\\n\", infile);\n\t\t\texit(EXIT_FAILURE);\n\t\t}\n\t} else {\n\t\t/* The image is to be read from standard input. */\n\t\tif (!(instream = jas_stream_fdopen(0, \"rb\"))) {\n\t\t\tfprintf(stderr, \"cannot open standard input\\n\");\n\t\t\texit(EXIT_FAILURE);\n\t\t}\n\t}\n\n\tif ((fmtid = jas_image_getfmt(instream)) < 0) {\n \t\tfprintf(stderr, \"unknown image format\\n\");\n \t}\n \n \t/* Decode the image. */\n\tif (!(image = jas_image_decode(instream, fmtid, 0))) {\n \t\tjas_stream_close(instream);\n \t\tfprintf(stderr, \"cannot load image\\n\");\n \t\treturn EXIT_FAILURE;\n\t}\n\n \t/* Close the image file. */\n \tjas_stream_close(instream);\n \n \tif (!(numcmpts = jas_image_numcmpts(image))) {\n \t\tfprintf(stderr, \"warning: image has no components\\n\");\n \t}\n\tif (numcmpts) {\n\t\twidth = jas_image_cmptwidth(image, 0);\n\t\theight = jas_image_cmptheight(image, 0);\n\t\tdepth = jas_image_cmptprec(image, 0);\n\t} else {\n\t\twidth = 0;\n \t\theight = 0;\n \t\tdepth = 0;\n \t}\n\tif (!(fmtname = jas_image_fmttostr(fmtid))) {\n\t\tabort();\n\t}\n\tprintf(\"%s %d %d %d %d %ld\\n\", fmtname, numcmpts, width, height, depth, (long) jas_image_rawsize(image));\n \n \tjas_image_destroy(image);\n \tjas_image_clearfmts();\n\n\treturn EXIT_SUCCESS;\n}\n", + "target": "int main(int argc, char **argv)\n{\n\tint fmtid;\n\tint id;\n\tchar *infile;\n\tjas_stream_t *instream;\n\tjas_image_t *image;\n\tint width;\n\tint height;\n\tint depth;\n\tint numcmpts;\n\tint verbose;\n \tchar *fmtname;\n \tint debug;\n \tsize_t max_mem;\n\tsize_t max_samples;\n\tchar optstr[32];\n \n \tif (jas_init()) {\n \t\tabort();\n \t}\n \n \tcmdname = argv[0];\n \n\tmax_samples = 64 * JAS_MEBI;\n \tinfile = 0;\n \tverbose = 0;\n \tdebug = 0;\n#if defined(JAS_DEFAULT_MAX_MEM_USAGE)\n\tmax_mem = JAS_DEFAULT_MAX_MEM_USAGE;\n#endif\n\n\t/* Parse the command line options. */\n\twhile ((id = jas_getopt(argc, argv, opts)) >= 0) {\n\t\tswitch (id) {\n\t\tcase OPT_VERBOSE:\n\t\t\tverbose = 1;\n\t\t\tbreak;\n\t\tcase OPT_VERSION:\n\t\t\tprintf(\"%s\\n\", JAS_VERSION);\n\t\t\texit(EXIT_SUCCESS);\n\t\t\tbreak;\n\t\tcase OPT_DEBUG:\n\t\t\tdebug = atoi(jas_optarg);\n\t\t\tbreak;\n \t\tcase OPT_INFILE:\n \t\t\tinfile = jas_optarg;\n \t\t\tbreak;\n\t\tcase OPT_MAXSAMPLES:\n\t\t\tmax_samples = strtoull(jas_optarg, 0, 10);\n\t\t\tbreak;\n \t\tcase OPT_MAXMEM:\n \t\t\tmax_mem = strtoull(jas_optarg, 0, 10);\n \t\t\tbreak;\n\t\tcase OPT_HELP:\n\t\tdefault:\n\t\t\tusage();\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tjas_setdbglevel(debug);\n#if defined(JAS_DEFAULT_MAX_MEM_USAGE)\n\tjas_set_max_mem_usage(max_mem);\n#endif\n\n\t/* Open the image file. */\n\tif (infile) {\n\t\t/* The image is to be read from a file. */\n\t\tif (!(instream = jas_stream_fopen(infile, \"rb\"))) {\n\t\t\tfprintf(stderr, \"cannot open input image file %s\\n\", infile);\n\t\t\texit(EXIT_FAILURE);\n\t\t}\n\t} else {\n\t\t/* The image is to be read from standard input. */\n\t\tif (!(instream = jas_stream_fdopen(0, \"rb\"))) {\n\t\t\tfprintf(stderr, \"cannot open standard input\\n\");\n\t\t\texit(EXIT_FAILURE);\n\t\t}\n\t}\n\n\tif ((fmtid = jas_image_getfmt(instream)) < 0) {\n \t\tfprintf(stderr, \"unknown image format\\n\");\n \t}\n \n\tsnprintf(optstr, sizeof(optstr), \"max_samples=%-zu\", max_samples);\n\n \t/* Decode the image. */\n\tif (!(image = jas_image_decode(instream, fmtid, optstr))) {\n \t\tjas_stream_close(instream);\n \t\tfprintf(stderr, \"cannot load image\\n\");\n \t\treturn EXIT_FAILURE;\n\t}\n\n \t/* Close the image file. */\n \tjas_stream_close(instream);\n \n\tif (!(fmtname = jas_image_fmttostr(fmtid))) {\n\t\tjas_eprintf(\"format name lookup failed\\n\");\n\t\treturn EXIT_FAILURE;\n\t}\n\n \tif (!(numcmpts = jas_image_numcmpts(image))) {\n \t\tfprintf(stderr, \"warning: image has no components\\n\");\n \t}\n\tif (numcmpts) {\n\t\twidth = jas_image_cmptwidth(image, 0);\n\t\theight = jas_image_cmptheight(image, 0);\n\t\tdepth = jas_image_cmptprec(image, 0);\n\t} else {\n\t\twidth = 0;\n \t\theight = 0;\n \t\tdepth = 0;\n \t}\n\tprintf(\"%s %d %d %d %d %ld\\n\", fmtname, numcmpts, width, height, depth,\n\t JAS_CAST(long, jas_image_rawsize(image)));\n \n \tjas_image_destroy(image);\n \tjas_image_clearfmts();\n\n\treturn EXIT_SUCCESS;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2cb006bc9d3ad16353ed49c2b75faea618156d0f", + "input": " bool AppCacheBackendImpl::SelectCacheForSharedWorker(\n int host_id, int64 appcache_id) {\n AppCacheHost* host = GetHost(host_id);\n if (!host || host->was_select_cache_called())\n return false;\n \n host->SelectCacheForSharedWorker(appcache_id);\n return true;\n }\n", + "target": " bool AppCacheBackendImpl::SelectCacheForSharedWorker(\n int host_id, int64 appcache_id) {\n AppCacheHost* host = GetHost(host_id);\n if (!host)\n return false;\n \n return host->SelectCacheForSharedWorker(appcache_id);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1", + "input": " zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char *method, int method_len, const struct _zend_literal *key TSRMLS_DC) /* {{{ */\n {\n \tspl_filesystem_object *fsobj = zend_object_store_get_object(*object_ptr TSRMLS_CC);\n \tif (fsobj->u.dir.entry.d_name[0] == '\\0' && fsobj->orig_path == NULL) {\n \t\tmethod = \"_bad_state_ex\";\n \t\tmethod_len = sizeof(\"_bad_state_ex\") - 1;\n \t\tkey = NULL;\n \t}\n \treturn zend_get_std_object_handlers()->get_method(object_ptr, method, method_len, key TSRMLS_CC);\n }\n /* }}} */\n", + "target": " zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char *method, int method_len, const struct _zend_literal *key TSRMLS_DC) /* {{{ */\n {\n \tspl_filesystem_object *fsobj = zend_object_store_get_object(*object_ptr TSRMLS_CC);\n\n \tif (fsobj->u.dir.entry.d_name[0] == '\\0' && fsobj->orig_path == NULL) {\n \t\tmethod = \"_bad_state_ex\";\n \t\tmethod_len = sizeof(\"_bad_state_ex\") - 1;\n \t\tkey = NULL;\n \t}\n\n \treturn zend_get_std_object_handlers()->get_method(object_ptr, method, method_len, key TSRMLS_CC);\n }\n /* }}} */\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#afbc71b7a78ac99810a6b22b2b0a2e85dde18794", + "input": "OneClickSigninSyncStarter::OneClickSigninSyncStarter(\n Profile* profile,\n Browser* browser,\n const std::string& session_index,\n const std::string& email,\n const std::string& password,\n StartSyncMode start_mode,\n bool force_same_tab_navigation,\n ConfirmationRequired confirmation_required)\n : start_mode_(start_mode),\n force_same_tab_navigation_(force_same_tab_navigation),\n confirmation_required_(confirmation_required),\n weak_pointer_factory_(this) {\n DCHECK(profile);\n BrowserList::AddObserver(this);\n\n Initialize(profile, browser);\n\n SigninManager* manager = SigninManagerFactory::GetForProfile(profile_);\n SigninManager::OAuthTokenFetchedCallback callback;\n callback = base::Bind(&OneClickSigninSyncStarter::ConfirmSignin,\n weak_pointer_factory_.GetWeakPtr());\n manager->StartSignInWithCredentials(session_index, email, password, callback);\n}\n", + "target": "OneClickSigninSyncStarter::OneClickSigninSyncStarter(\n Profile* profile,\n Browser* browser,\n const std::string& session_index,\n const std::string& email,\n const std::string& password,\n StartSyncMode start_mode,\n bool force_same_tab_navigation,\n ConfirmationRequired confirmation_required,\n SyncPromoUI::Source source)\n : start_mode_(start_mode),\n force_same_tab_navigation_(force_same_tab_navigation),\n confirmation_required_(confirmation_required),\n source_(source),\n weak_pointer_factory_(this) {\n DCHECK(profile);\n BrowserList::AddObserver(this);\n\n Initialize(profile, browser);\n\n SigninManager* manager = SigninManagerFactory::GetForProfile(profile_);\n SigninManager::OAuthTokenFetchedCallback callback;\n callback = base::Bind(&OneClickSigninSyncStarter::ConfirmSignin,\n weak_pointer_factory_.GetWeakPtr());\n manager->StartSignInWithCredentials(session_index, email, password, callback);\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#db29a9508a9246e77087c5531e45b2c88ec6988b", + "input": " static bool generic_new(struct nf_conn *ct, const struct sk_buff *skb,\n \t\t\tunsigned int dataoff, unsigned int *timeouts)\n {\n\treturn true;\n }\n", + "target": " static bool generic_new(struct nf_conn *ct, const struct sk_buff *skb,\n \t\t\tunsigned int dataoff, unsigned int *timeouts)\n {\n\treturn nf_generic_should_process(nf_ct_protonum(ct));\n }\n", + "vul_type": "cwe-254", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#31400a673325147e1205326008e32135a78b4d8a", + "input": "hstoreArrayToPairs(ArrayType *a, int *npairs)\n{\n\tDatum\t *key_datums;\n\tbool\t *key_nulls;\n\tint\t\t\tkey_count;\n\tPairs\t *key_pairs;\n\tint\t\t\tbufsiz;\n\tint\t\t\ti,\n\t\t\t\tj;\n\n\tdeconstruct_array(a,\n\t\t\t\t\t TEXTOID, -1, false, 'i',\n\t\t\t\t\t &key_datums, &key_nulls, &key_count);\n\n\tif (key_count == 0)\n\t{\n\t\t*npairs = 0;\n \t\treturn NULL;\n \t}\n \n \tkey_pairs = palloc(sizeof(Pairs) * key_count);\n \n \tfor (i = 0, j = 0; i < key_count; i++)\n\t{\n\t\tif (!key_nulls[i])\n\t\t{\n\t\t\tkey_pairs[j].key = VARDATA(key_datums[i]);\n\t\t\tkey_pairs[j].keylen = VARSIZE(key_datums[i]) - VARHDRSZ;\n\t\t\tkey_pairs[j].val = NULL;\n\t\t\tkey_pairs[j].vallen = 0;\n\t\t\tkey_pairs[j].needfree = 0;\n\t\t\tkey_pairs[j].isnull = 1;\n\t\t\tj++;\n\t\t}\n\t}\n\n\t*npairs = hstoreUniquePairs(key_pairs, j, &bufsiz);\n\n\treturn key_pairs;\n}\n", + "target": "hstoreArrayToPairs(ArrayType *a, int *npairs)\n{\n\tDatum\t *key_datums;\n\tbool\t *key_nulls;\n\tint\t\t\tkey_count;\n\tPairs\t *key_pairs;\n\tint\t\t\tbufsiz;\n\tint\t\t\ti,\n\t\t\t\tj;\n\n\tdeconstruct_array(a,\n\t\t\t\t\t TEXTOID, -1, false, 'i',\n\t\t\t\t\t &key_datums, &key_nulls, &key_count);\n\n\tif (key_count == 0)\n\t{\n\t\t*npairs = 0;\n \t\treturn NULL;\n \t}\n \n\t/*\n\t * A text array uses at least eight bytes per element, so any overflow in\n\t * \"key_count * sizeof(Pairs)\" is small enough for palloc() to catch.\n\t * However, credible improvements to the array format could invalidate\n\t * that assumption. Therefore, use an explicit check rather than relying\n\t * on palloc() to complain.\n\t */\n\tif (key_count > MaxAllocSize / sizeof(Pairs))\n\t\tereport(ERROR,\n\t\t\t\t(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),\n\t\t\t errmsg(\"number of pairs (%d) exceeds the maximum allowed (%d)\",\n\t\t\t\t\t key_count, (int) (MaxAllocSize / sizeof(Pairs)))));\n\n \tkey_pairs = palloc(sizeof(Pairs) * key_count);\n \n \tfor (i = 0, j = 0; i < key_count; i++)\n\t{\n\t\tif (!key_nulls[i])\n\t\t{\n\t\t\tkey_pairs[j].key = VARDATA(key_datums[i]);\n\t\t\tkey_pairs[j].keylen = VARSIZE(key_datums[i]) - VARHDRSZ;\n\t\t\tkey_pairs[j].val = NULL;\n\t\t\tkey_pairs[j].vallen = 0;\n\t\t\tkey_pairs[j].needfree = 0;\n\t\t\tkey_pairs[j].isnull = 1;\n\t\t\tj++;\n\t\t}\n\t}\n\n\t*npairs = hstoreUniquePairs(key_pairs, j, &bufsiz);\n\n\treturn key_pairs;\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e9372a1bfd3588a80fcf49aa07321f0971dd6091", + "input": "static v8::Handle V8TestNamedConstructorConstructorCallback(const v8::Arguments& args)\n{\n INC_STATS(\"DOM.TestNamedConstructor.Constructor\");\n\n if (!args.IsConstructCall())\n return V8Proxy::throwTypeError(\"DOM object constructor cannot be called as a function.\");\n\n if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)\n return args.Holder();\n\n Frame* frame = V8Proxy::retrieveFrameForCurrentContext();\n if (!frame)\n return V8Proxy::throwError(V8Proxy::ReferenceError, \"TestNamedConstructor constructor associated frame is unavailable\", args.GetIsolate());\n\n Document* document = frame->document();\n\n toV8(document, args.GetIsolate());\n \n if (args.Length() < 1)\n return V8Proxy::throwNotEnoughArgumentsError();\n \n ExceptionCode ec = 0;\n STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str1, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));\n STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str2, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));\n STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str3, MAYBE_MISSING_PARAMETER(args, 2, DefaultIsNullString));\n\n RefPtr impl = TestNamedConstructor::createForJSConstructor(document, str1, str2, str3, ec);\n v8::Handle wrapper = args.Holder();\n if (ec)\n goto fail;\n\n V8DOMWrapper::setDOMWrapper(wrapper, &V8TestNamedConstructorConstructor::info, impl.get());\n V8DOMWrapper::setJSWrapperForActiveDOMObject(impl.release(), v8::Persistent::New(wrapper), args.GetIsolate());\n return args.Holder();\n fail:\n return throwError(ec, args.GetIsolate());\n}\n", + "target": "static v8::Handle V8TestNamedConstructorConstructorCallback(const v8::Arguments& args)\n{\n INC_STATS(\"DOM.TestNamedConstructor.Constructor\");\n\n if (!args.IsConstructCall())\n return V8Proxy::throwTypeError(\"DOM object constructor cannot be called as a function.\");\n\n if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)\n return args.Holder();\n\n Frame* frame = V8Proxy::retrieveFrameForCurrentContext();\n if (!frame)\n return V8Proxy::throwError(V8Proxy::ReferenceError, \"TestNamedConstructor constructor associated frame is unavailable\", args.GetIsolate());\n\n Document* document = frame->document();\n\n toV8(document, args.GetIsolate());\n \n if (args.Length() < 1)\n return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());\n \n ExceptionCode ec = 0;\n STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str1, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));\n STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str2, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));\n STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str3, MAYBE_MISSING_PARAMETER(args, 2, DefaultIsNullString));\n\n RefPtr impl = TestNamedConstructor::createForJSConstructor(document, str1, str2, str3, ec);\n v8::Handle wrapper = args.Holder();\n if (ec)\n goto fail;\n\n V8DOMWrapper::setDOMWrapper(wrapper, &V8TestNamedConstructorConstructor::info, impl.get());\n V8DOMWrapper::setJSWrapperForActiveDOMObject(impl.release(), v8::Persistent::New(wrapper), args.GetIsolate());\n return args.Holder();\n fail:\n return throwError(ec, args.GetIsolate());\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5b4bebaa91849c592a8448bc353ab25a54ff8c44", + "input": "MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info,\n Image *images,const char *filename,ExceptionInfo *exception)\n{\n#define WriteImageTag \"Write/Image\"\n\n ExceptionInfo\n *sans_exception;\n\n ImageInfo\n *write_info;\n\n MagickBooleanType\n proceed;\n\n MagickOffsetType\n progress;\n\n MagickProgressMonitor\n progress_monitor;\n\n MagickSizeType\n number_images;\n\n MagickStatusType\n status;\n\n register Image\n *p;\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n write_info=CloneImageInfo(image_info);\n *write_info->magick='\\0';\n images=GetFirstImageInList(images);\n if (filename != (const char *) NULL)\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n (void) CopyMagickString(p->filename,filename,MagickPathExtent);\n (void) CopyMagickString(write_info->filename,images->filename,MagickPathExtent);\n sans_exception=AcquireExceptionInfo();\n (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),\n sans_exception);\n sans_exception=DestroyExceptionInfo(sans_exception);\n if (*write_info->magick == '\\0')\n (void) CopyMagickString(write_info->magick,images->magick,MagickPathExtent);\n p=images;\n for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))\n if (p->scene >= GetNextImageInList(p)->scene)\n {\n register ssize_t\n i;\n\n /*\n Generate consistent scene numbers.\n */\n i=(ssize_t) images->scene;\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n p->scene=(size_t) i++;\n break;\n }\n /*\n Write images.\n */\n status=MagickTrue;\n progress_monitor=(MagickProgressMonitor) NULL;\n progress=0;\n number_images=GetImageListLength(images);\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n {\n if (number_images != 1)\n progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,\n p->client_data);\n status&=WriteImage(write_info,p,exception);\n if (number_images != 1)\n (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);\n if (write_info->adjoin != MagickFalse)\n break;\n if (number_images != 1)\n {\n proceed=SetImageProgress(p,WriteImageTag,progress++,number_images);\n if (proceed == MagickFalse)\n break;\n }\n }\n write_info=DestroyImageInfo(write_info);\n return(status != 0 ? MagickTrue : MagickFalse);\n}\n", + "target": "MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info,\n Image *images,const char *filename,ExceptionInfo *exception)\n{\n#define WriteImageTag \"Write/Image\"\n\n ExceptionInfo\n *sans_exception;\n\n ImageInfo\n *write_info;\n\n MagickBooleanType\n proceed;\n\n MagickOffsetType\n progress;\n\n MagickProgressMonitor\n progress_monitor;\n\n MagickSizeType\n number_images;\n\n MagickStatusType\n status;\n\n register Image\n *p;\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n write_info=CloneImageInfo(image_info);\n *write_info->magick='\\0';\n images=GetFirstImageInList(images);\n if (filename != (const char *) NULL)\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n (void) CopyMagickString(p->filename,filename,MagickPathExtent);\n (void) CopyMagickString(write_info->filename,images->filename,MagickPathExtent);\n sans_exception=AcquireExceptionInfo();\n (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),\n sans_exception);\n sans_exception=DestroyExceptionInfo(sans_exception);\n if (*write_info->magick == '\\0')\n (void) CopyMagickString(write_info->magick,images->magick,MagickPathExtent);\n p=images;\n for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))\n {\n register Image\n *next;\n \n next=GetNextImageInList(p);\n if (next == (Image *) NULL)\n break;\n if (p->scene >= next->scene)\n {\n register ssize_t\n i;\n\n /*\n Generate consistent scene numbers.\n */\n i=(ssize_t) images->scene;\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n p->scene=(size_t) i++;\n break;\n }\n }\n /*\n Write images.\n */\n status=MagickTrue;\n progress_monitor=(MagickProgressMonitor) NULL;\n progress=0;\n number_images=GetImageListLength(images);\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n {\n if (number_images != 1)\n progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,\n p->client_data);\n status&=WriteImage(write_info,p,exception);\n if (number_images != 1)\n (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);\n if (write_info->adjoin != MagickFalse)\n break;\n if (number_images != 1)\n {\n proceed=SetImageProgress(p,WriteImageTag,progress++,number_images);\n if (proceed == MagickFalse)\n break;\n }\n }\n write_info=DestroyImageInfo(write_info);\n return(status != 0 ? MagickTrue : MagickFalse);\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2b0bbc4f8809c972bad134bc1a2570dbb01dea0b", + "input": "static gboolean nbd_negotiate_continue(QIOChannel *ioc,\n GIOCondition condition,\n void *opaque)\n{\n qemu_coroutine_enter(opaque);\n return TRUE;\n}\n", + "target": "static gboolean nbd_negotiate_continue(QIOChannel *ioc,\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9a271a9368eaabf99e6c2046103acb33957e63b7", + "input": "static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,\n Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk,\n int width, int height, int bandpos)\n{\n int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y;\n int clnpass_cnt = 0;\n int bpass_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_BYPASS;\n int vert_causal_ctx_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_VSC;\n \n for (y = 0; y < height; y++)\n memset(t1->data[y], 0, width * sizeof(**t1->data));\n \n /* If code-block contains no compressed data: nothing to do. */\n if (!cblk->length)\n return 0;\n\n for (y = 0; y < height + 2; y++)\n memset(t1->flags[y], 0, (width + 2) * sizeof(**t1->flags));\n\n cblk->data[cblk->length] = 0xff;\n cblk->data[cblk->length+1] = 0xff;\n ff_mqc_initdec(&t1->mqc, cblk->data);\n\n while (passno--) {\n switch(pass_t) {\n case 0:\n decode_sigpass(t1, width, height, bpno + 1, bandpos,\n bpass_csty_symbol && (clnpass_cnt >= 4),\n vert_causal_ctx_csty_symbol);\n break;\n case 1:\n decode_refpass(t1, width, height, bpno + 1);\n if (bpass_csty_symbol && clnpass_cnt >= 4)\n ff_mqc_initdec(&t1->mqc, cblk->data);\n break;\n case 2:\n decode_clnpass(s, t1, width, height, bpno + 1, bandpos,\n codsty->cblk_style & JPEG2000_CBLK_SEGSYM,\n vert_causal_ctx_csty_symbol);\n clnpass_cnt = clnpass_cnt + 1;\n if (bpass_csty_symbol && clnpass_cnt >= 4)\n ff_mqc_initdec(&t1->mqc, cblk->data);\n break;\n }\n\n pass_t++;\n if (pass_t == 3) {\n bpno--;\n pass_t = 0;\n }\n }\n return 0;\n}\n", + "target": "static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,\n Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk,\n int width, int height, int bandpos)\n{\n int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y;\n int clnpass_cnt = 0;\n int bpass_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_BYPASS;\n int vert_causal_ctx_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_VSC;\n \n av_assert0(width <= JPEG2000_MAX_CBLKW);\n av_assert0(height <= JPEG2000_MAX_CBLKH);\n\n for (y = 0; y < height; y++)\n memset(t1->data[y], 0, width * sizeof(**t1->data));\n \n /* If code-block contains no compressed data: nothing to do. */\n if (!cblk->length)\n return 0;\n\n for (y = 0; y < height + 2; y++)\n memset(t1->flags[y], 0, (width + 2) * sizeof(**t1->flags));\n\n cblk->data[cblk->length] = 0xff;\n cblk->data[cblk->length+1] = 0xff;\n ff_mqc_initdec(&t1->mqc, cblk->data);\n\n while (passno--) {\n switch(pass_t) {\n case 0:\n decode_sigpass(t1, width, height, bpno + 1, bandpos,\n bpass_csty_symbol && (clnpass_cnt >= 4),\n vert_causal_ctx_csty_symbol);\n break;\n case 1:\n decode_refpass(t1, width, height, bpno + 1);\n if (bpass_csty_symbol && clnpass_cnt >= 4)\n ff_mqc_initdec(&t1->mqc, cblk->data);\n break;\n case 2:\n decode_clnpass(s, t1, width, height, bpno + 1, bandpos,\n codsty->cblk_style & JPEG2000_CBLK_SEGSYM,\n vert_causal_ctx_csty_symbol);\n clnpass_cnt = clnpass_cnt + 1;\n if (bpass_csty_symbol && clnpass_cnt >= 4)\n ff_mqc_initdec(&t1->mqc, cblk->data);\n break;\n }\n\n pass_t++;\n if (pass_t == 3) {\n bpno--;\n pass_t = 0;\n }\n }\n return 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#af6fc858a35b90e89ea7a7ee58e66628c55c776b", + "input": " static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)\n {\n \tstruct xen_pcibk_dev_data *dev_data;\n \tint err;\n \n \tdev_data = pci_get_drvdata(dev);\n \tif (!pci_is_enabled(dev) && is_enable_cmd(value)) {\n\t\tif (unlikely(verbose_request))\n\t\t\tprintk(KERN_DEBUG DRV_NAME \": %s: enable\\n\",\n\t\t\t pci_name(dev));\n\t\terr = pci_enable_device(dev);\n\t\tif (err)\n\t\t\treturn err;\n\t\tif (dev_data)\n\t\t\tdev_data->enable_intx = 1;\n\t} else if (pci_is_enabled(dev) && !is_enable_cmd(value)) {\n\t\tif (unlikely(verbose_request))\n\t\t\tprintk(KERN_DEBUG DRV_NAME \": %s: disable\\n\",\n\t\t\t pci_name(dev));\n\t\tpci_disable_device(dev);\n\t\tif (dev_data)\n\t\t\tdev_data->enable_intx = 0;\n\t}\n\n\tif (!dev->is_busmaster && is_master_cmd(value)) {\n\t\tif (unlikely(verbose_request))\n\t\t\tprintk(KERN_DEBUG DRV_NAME \": %s: set bus master\\n\",\n\t\t\t pci_name(dev));\n\t\tpci_set_master(dev);\n\t}\n\n\tif (value & PCI_COMMAND_INVALIDATE) {\n\t\tif (unlikely(verbose_request))\n\t\t\tprintk(KERN_DEBUG\n\t\t\t DRV_NAME \": %s: enable memory-write-invalidate\\n\",\n\t\t\t pci_name(dev));\n\t\terr = pci_set_mwi(dev);\n\t\tif (err) {\n\t\t\tpr_warn(\"%s: cannot enable memory-write-invalidate (%d)\\n\",\n\t\t\t\tpci_name(dev), err);\n\t\t\tvalue &= ~PCI_COMMAND_INVALIDATE;\n \t\t}\n \t}\n \n \treturn pci_write_config_word(dev, offset, value);\n }\n", + "target": " static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)\n {\n \tstruct xen_pcibk_dev_data *dev_data;\n \tint err;\n\tu16 val;\n\tstruct pci_cmd_info *cmd = data;\n \n \tdev_data = pci_get_drvdata(dev);\n \tif (!pci_is_enabled(dev) && is_enable_cmd(value)) {\n\t\tif (unlikely(verbose_request))\n\t\t\tprintk(KERN_DEBUG DRV_NAME \": %s: enable\\n\",\n\t\t\t pci_name(dev));\n\t\terr = pci_enable_device(dev);\n\t\tif (err)\n\t\t\treturn err;\n\t\tif (dev_data)\n\t\t\tdev_data->enable_intx = 1;\n\t} else if (pci_is_enabled(dev) && !is_enable_cmd(value)) {\n\t\tif (unlikely(verbose_request))\n\t\t\tprintk(KERN_DEBUG DRV_NAME \": %s: disable\\n\",\n\t\t\t pci_name(dev));\n\t\tpci_disable_device(dev);\n\t\tif (dev_data)\n\t\t\tdev_data->enable_intx = 0;\n\t}\n\n\tif (!dev->is_busmaster && is_master_cmd(value)) {\n\t\tif (unlikely(verbose_request))\n\t\t\tprintk(KERN_DEBUG DRV_NAME \": %s: set bus master\\n\",\n\t\t\t pci_name(dev));\n\t\tpci_set_master(dev);\n\t}\n\n\tif (value & PCI_COMMAND_INVALIDATE) {\n\t\tif (unlikely(verbose_request))\n\t\t\tprintk(KERN_DEBUG\n\t\t\t DRV_NAME \": %s: enable memory-write-invalidate\\n\",\n\t\t\t pci_name(dev));\n\t\terr = pci_set_mwi(dev);\n\t\tif (err) {\n\t\t\tpr_warn(\"%s: cannot enable memory-write-invalidate (%d)\\n\",\n\t\t\t\tpci_name(dev), err);\n\t\t\tvalue &= ~PCI_COMMAND_INVALIDATE;\n \t\t}\n \t}\n \n\tcmd->val = value;\n\n\tif (!permissive && (!dev_data || !dev_data->permissive))\n\t\treturn 0;\n\n\t/* Only allow the guest to control certain bits. */\n\terr = pci_read_config_word(dev, offset, &val);\n\tif (err || val == value)\n\t\treturn err;\n\n\tvalue &= PCI_COMMAND_GUEST;\n\tvalue |= val & ~PCI_COMMAND_GUEST;\n\n \treturn pci_write_config_word(dev, offset, value);\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b15c87071f906301bccc824ce013966ca93998c7", + "input": "bool UnprivilegedProcessDelegate::LaunchProcess(\n IPC::Listener* delegate,\n ScopedHandle* process_exit_event_out) {\n DCHECK(main_task_runner_->BelongsToCurrentThread());\n std::string channel_name = GenerateIpcChannelName(this);\n\n ScopedHandle client;\n scoped_ptr server;\n if (!CreateConnectedIpcChannel(channel_name, delegate, &client, &server))\n return false;\n \n std::string pipe_handle = base::StringPrintf(\n \"%d\", reinterpret_cast(client.Get()));\n\n CommandLine command_line(binary_path_);\n command_line.AppendSwitchASCII(kDaemonPipeSwitchName, pipe_handle);\n command_line.CopySwitchesFrom(*CommandLine::ForCurrentProcess(),\n kCopiedSwitchNames,\n arraysize(kCopiedSwitchNames));\n\n ScopedHandle worker_thread;\n worker_process_.Close();\n if (!LaunchProcessWithToken(command_line.GetProgram(),\n command_line.GetCommandLineString(),\n NULL,\n true,\n 0,\n &worker_process_,\n &worker_thread)) {\n return false;\n }\n\n ScopedHandle process_exit_event;\n if (!DuplicateHandle(GetCurrentProcess(),\n worker_process_,\n GetCurrentProcess(),\n process_exit_event.Receive(),\n SYNCHRONIZE,\n FALSE,\n 0)) {\n LOG_GETLASTERROR(ERROR) << \"Failed to duplicate a handle\";\n KillProcess(CONTROL_C_EXIT);\n return false;\n }\n\n channel_ = server.Pass();\n *process_exit_event_out = process_exit_event.Pass();\n return true;\n }\n", + "target": "bool UnprivilegedProcessDelegate::LaunchProcess(\n IPC::Listener* delegate,\n ScopedHandle* process_exit_event_out) {\n DCHECK(main_task_runner_->BelongsToCurrentThread());\n std::string channel_name = GenerateIpcChannelName(this);\n\n ScopedHandle client;\n scoped_ptr server;\n ScopedHandle pipe;\n if (!CreateConnectedIpcChannel(channel_name, io_task_runner_, delegate,\n &client, &server, &pipe)) {\n return false;\n }\n \n std::string pipe_handle = base::StringPrintf(\n \"%d\", reinterpret_cast(client.Get()));\n\n CommandLine command_line(binary_path_);\n command_line.AppendSwitchASCII(kDaemonPipeSwitchName, pipe_handle);\n command_line.CopySwitchesFrom(*CommandLine::ForCurrentProcess(),\n kCopiedSwitchNames,\n arraysize(kCopiedSwitchNames));\n\n ScopedHandle worker_thread;\n worker_process_.Close();\n if (!LaunchProcessWithToken(command_line.GetProgram(),\n command_line.GetCommandLineString(),\n NULL,\n true,\n 0,\n &worker_process_,\n &worker_thread)) {\n return false;\n }\n\n ScopedHandle process_exit_event;\n if (!DuplicateHandle(GetCurrentProcess(),\n worker_process_,\n GetCurrentProcess(),\n process_exit_event.Receive(),\n SYNCHRONIZE,\n FALSE,\n 0)) {\n LOG_GETLASTERROR(ERROR) << \"Failed to duplicate a handle\";\n KillProcess(CONTROL_C_EXIT);\n return false;\n }\n\n channel_ = server.Pass();\n *process_exit_event_out = process_exit_event.Pass();\n return true;\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab", + "input": "xsltNumber(xsltTransformContextPtr ctxt, xmlNodePtr node,\n\t xmlNodePtr inst, xsltStylePreCompPtr castedComp)\n{\n#ifdef XSLT_REFACTORED\n xsltStyleItemNumberPtr comp = (xsltStyleItemNumberPtr) castedComp;\n #else\n xsltStylePreCompPtr comp = castedComp;\n #endif\n if (comp == NULL) {\n \txsltTransformError(ctxt, NULL, inst,\n \t \"xsl:number : compilation failed\\n\");\n\treturn;\n }\n\n if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL))\n\treturn;\n\n comp->numdata.doc = inst->doc;\n comp->numdata.node = inst;\n \n xsltNumberFormat(ctxt, &comp->numdata, node);\n }\n", + "target": "xsltNumber(xsltTransformContextPtr ctxt, xmlNodePtr node,\n\t xmlNodePtr inst, xsltStylePreCompPtr castedComp)\n{\n#ifdef XSLT_REFACTORED\n xsltStyleItemNumberPtr comp = (xsltStyleItemNumberPtr) castedComp;\n #else\n xsltStylePreCompPtr comp = castedComp;\n #endif\n xmlXPathContextPtr xpctxt;\n xmlNsPtr *oldXPNamespaces;\n int oldXPNsNr;\n\n if (comp == NULL) {\n \txsltTransformError(ctxt, NULL, inst,\n \t \"xsl:number : compilation failed\\n\");\n\treturn;\n }\n\n if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL))\n\treturn;\n\n comp->numdata.doc = inst->doc;\n comp->numdata.node = inst;\n \n xpctxt = ctxt->xpathCtxt;\n oldXPNsNr = xpctxt->nsNr;\n oldXPNamespaces = xpctxt->namespaces;\n\n#ifdef XSLT_REFACTORED\n if (comp->inScopeNs != NULL) {\n xpctxt->namespaces = comp->inScopeNs->list;\n xpctxt->nsNr = comp->inScopeNs->xpathNumber;\n } else {\n xpctxt->namespaces = NULL;\n xpctxt->nsNr = 0;\n }\n#else\n xpctxt->namespaces = comp->nsList;\n xpctxt->nsNr = comp->nsNr;\n#endif\n\n xsltNumberFormat(ctxt, &comp->numdata, node);\n\n xpctxt->nsNr = oldXPNsNr;\n xpctxt->namespaces = oldXPNamespaces;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8a43abefb38c5e29138e1c9c515b313363541c06", + "input": "static size_t WritePSDChannel(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n const QuantumType quantum_type, unsigned char *compact_pixels,\n MagickOffsetType size_offset,const MagickBooleanType separate,\n const CompressionType compression,ExceptionInfo *exception)\n{\n MagickBooleanType\n monochrome;\n\n QuantumInfo\n *quantum_info;\n\n register const Quantum\n *p;\n\n register ssize_t\n i;\n\n size_t\n count,\n length;\n\n ssize_t\n y;\n\n unsigned char\n *pixels;\n\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n\n#define CHUNK 16384\n\n int\n flush,\n level;\n\n unsigned char\n *compressed_pixels;\n\n z_stream\n stream;\n\n compressed_pixels=(unsigned char *) NULL;\n flush=Z_NO_FLUSH;\n#endif\n count=0;\n if (separate != MagickFalse)\n {\n size_offset=TellBlob(image)+2;\n count+=WriteCompressionStart(psd_info,image,next_image,compression,1);\n }\n if (next_image->depth > 8)\n next_image->depth=16;\n monochrome=IsImageMonochrome(image) && (image->depth == 1) ?\n MagickTrue : MagickFalse;\n quantum_info=AcquireQuantumInfo(image_info,next_image);\n if (quantum_info == (QuantumInfo *) NULL)\n return(0);\n pixels=(unsigned char *) GetQuantumPixels(quantum_info);\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (compression == ZipCompression)\n {\n compressed_pixels=(unsigned char *) AcquireQuantumMemory(CHUNK,\n sizeof(*compressed_pixels));\n if (compressed_pixels == (unsigned char *) NULL)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n memset(&stream,0,sizeof(stream));\n stream.data_type=Z_BINARY;\n level=Z_DEFAULT_COMPRESSION;\n if ((image_info->quality > 0 && image_info->quality < 10))\n level=(int) image_info->quality;\n if (deflateInit(&stream,level) != Z_OK)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n }\n#endif\n for (y=0; y < (ssize_t) next_image->rows; y++)\n {\n p=GetVirtualPixels(next_image,0,y,next_image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n length=ExportQuantumPixels(next_image,(CacheView *) NULL,quantum_info,\n quantum_type,pixels,exception);\n if (monochrome != MagickFalse)\n for (i=0; i < (ssize_t) length; i++)\n pixels[i]=(~pixels[i]);\n if (compression == RLECompression)\n {\n length=PSDPackbitsEncodeImage(image,length,pixels,compact_pixels,\n exception);\n count+=WriteBlob(image,length,compact_pixels);\n size_offset+=WritePSDOffset(psd_info,image,length,size_offset);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n else if (compression == ZipCompression)\n {\n stream.avail_in=(uInt) length;\n stream.next_in=(Bytef *) pixels;\n if (y == (ssize_t) next_image->rows-1)\n flush=Z_FINISH;\n do {\n stream.avail_out=(uInt) CHUNK;\n stream.next_out=(Bytef *) compressed_pixels;\n if (deflate(&stream,flush) == Z_STREAM_ERROR)\n break;\n length=(size_t) CHUNK-stream.avail_out;\n if (length > 0)\n count+=WriteBlob(image,length,compressed_pixels);\n } while (stream.avail_out == 0);\n }\n#endif\n else\n count+=WriteBlob(image,length,pixels);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (compression == ZipCompression)\n {\n (void) deflateEnd(&stream);\n compressed_pixels=(unsigned char *) RelinquishMagickMemory(\n compressed_pixels);\n }\n#endif\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(count);\n}\n", + "target": "static size_t WritePSDChannel(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n const QuantumType quantum_type, unsigned char *compact_pixels,\n MagickOffsetType size_offset,const MagickBooleanType separate,\n const CompressionType compression,ExceptionInfo *exception)\n{\n MagickBooleanType\n monochrome;\n\n QuantumInfo\n *quantum_info;\n\n register const Quantum\n *p;\n\n register ssize_t\n i;\n\n size_t\n count,\n length;\n\n ssize_t\n y;\n\n unsigned char\n *pixels;\n\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n\n#define CHUNK 16384\n\n int\n flush,\n level;\n\n unsigned char\n *compressed_pixels;\n\n z_stream\n stream;\n\n compressed_pixels=(unsigned char *) NULL;\n flush=Z_NO_FLUSH;\n#endif\n count=0;\n if (separate != MagickFalse)\n {\n size_offset=TellBlob(image)+2;\n count+=WriteCompressionStart(psd_info,image,next_image,compression,1);\n }\n if (next_image->depth > 8)\n next_image->depth=16;\n monochrome=IsImageMonochrome(image) && (image->depth == 1) ?\n MagickTrue : MagickFalse;\n quantum_info=AcquireQuantumInfo(image_info,next_image);\n if (quantum_info == (QuantumInfo *) NULL)\n return(0);\n pixels=(unsigned char *) GetQuantumPixels(quantum_info);\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (compression == ZipCompression)\n {\n compressed_pixels=(unsigned char *) AcquireQuantumMemory(CHUNK,\n sizeof(*compressed_pixels));\n if (compressed_pixels == (unsigned char *) NULL)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n memset(&stream,0,sizeof(stream));\n stream.data_type=Z_BINARY;\n level=Z_DEFAULT_COMPRESSION;\n if ((image_info->quality > 0 && image_info->quality < 10))\n level=(int) image_info->quality;\n if (deflateInit(&stream,level) != Z_OK)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n compressed_pixels=(unsigned char *) RelinquishMagickMemory(\n compressed_pixels);\n return(0);\n }\n }\n#endif\n for (y=0; y < (ssize_t) next_image->rows; y++)\n {\n p=GetVirtualPixels(next_image,0,y,next_image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n length=ExportQuantumPixels(next_image,(CacheView *) NULL,quantum_info,\n quantum_type,pixels,exception);\n if (monochrome != MagickFalse)\n for (i=0; i < (ssize_t) length; i++)\n pixels[i]=(~pixels[i]);\n if (compression == RLECompression)\n {\n length=PSDPackbitsEncodeImage(image,length,pixels,compact_pixels,\n exception);\n count+=WriteBlob(image,length,compact_pixels);\n size_offset+=WritePSDOffset(psd_info,image,length,size_offset);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n else if (compression == ZipCompression)\n {\n stream.avail_in=(uInt) length;\n stream.next_in=(Bytef *) pixels;\n if (y == (ssize_t) next_image->rows-1)\n flush=Z_FINISH;\n do {\n stream.avail_out=(uInt) CHUNK;\n stream.next_out=(Bytef *) compressed_pixels;\n if (deflate(&stream,flush) == Z_STREAM_ERROR)\n break;\n length=(size_t) CHUNK-stream.avail_out;\n if (length > 0)\n count+=WriteBlob(image,length,compressed_pixels);\n } while (stream.avail_out == 0);\n }\n#endif\n else\n count+=WriteBlob(image,length,pixels);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (compression == ZipCompression)\n {\n (void) deflateEnd(&stream);\n compressed_pixels=(unsigned char *) RelinquishMagickMemory(\n compressed_pixels);\n }\n#endif\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(count);\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1630f53481f445ada0a455e9979236d31a8d3bb0", + "input": "activate_desktop_file (ActivateParameters *parameters,\n NautilusFile *file)\n{\n ActivateParametersDesktop *parameters_desktop;\n char *primary, *secondary, *display_name;\n GtkWidget *dialog;\n GdkScreen *screen;\n char *uri;\n\n screen = gtk_widget_get_screen (GTK_WIDGET (parameters->parent_window));\n\n if (!nautilus_file_is_trusted_link (file))\n {\n /* copy the parts of parameters we are interested in as the orignal will be freed */\n parameters_desktop = g_new0 (ActivateParametersDesktop, 1);\n if (parameters->parent_window)\n {\n parameters_desktop->parent_window = parameters->parent_window;\n g_object_add_weak_pointer (G_OBJECT (parameters_desktop->parent_window), (gpointer *) ¶meters_desktop->parent_window);\n }\n parameters_desktop->file = nautilus_file_ref (file);\n\n primary = _(\"Untrusted application launcher\");\n display_name = nautilus_file_get_display_name (file);\n secondary =\n g_strdup_printf (_(\"The application launcher “%s” has not been marked as trusted. \"\n \"If you do not know the source of this file, launching it may be unsafe.\"\n ),\n display_name);\n\n dialog = gtk_message_dialog_new (parameters->parent_window,\n 0,\n GTK_MESSAGE_WARNING,\n GTK_BUTTONS_NONE,\n NULL);\n g_object_set (dialog,\n \"text\", primary,\n \"secondary-text\", secondary,\n NULL);\n gtk_dialog_add_button (GTK_DIALOG (dialog),\n _(\"_Launch Anyway\"), RESPONSE_RUN);\n if (nautilus_file_can_set_permissions (file))\n {\n gtk_dialog_add_button (GTK_DIALOG (dialog),\n _(\"Mark as _Trusted\"), RESPONSE_MARK_TRUSTED);\n }\n gtk_dialog_add_button (GTK_DIALOG (dialog),\n _(\"_Cancel\"), GTK_RESPONSE_CANCEL);\n gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);\n g_signal_connect (dialog, \"response\",\n G_CALLBACK (untrusted_launcher_response_callback),\n parameters_desktop);\n gtk_widget_show (dialog);\n\n g_free (display_name);\n g_free (secondary);\n return;\n }\n\n uri = nautilus_file_get_uri (file);\n DEBUG (\"Launching trusted launcher %s\", uri);\n nautilus_launch_desktop_file (screen, uri, NULL,\n parameters->parent_window);\n g_free (uri);\n}\n", + "target": "activate_desktop_file (ActivateParameters *parameters,\n NautilusFile *file)\n{\n ActivateParametersDesktop *parameters_desktop;\n char *primary, *secondary, *display_name;\n GtkWidget *dialog;\n GdkScreen *screen;\n char *uri;\n\n screen = gtk_widget_get_screen (GTK_WIDGET (parameters->parent_window));\n\n if (!nautilus_file_is_trusted_link (file))\n {\n /* copy the parts of parameters we are interested in as the orignal will be freed */\n parameters_desktop = g_new0 (ActivateParametersDesktop, 1);\n if (parameters->parent_window)\n {\n parameters_desktop->parent_window = parameters->parent_window;\n g_object_add_weak_pointer (G_OBJECT (parameters_desktop->parent_window), (gpointer *) ¶meters_desktop->parent_window);\n }\n parameters_desktop->file = nautilus_file_ref (file);\n\n primary = _(\"Untrusted application launcher\");\n display_name = nautilus_file_get_display_name (file);\n secondary =\n g_strdup_printf (_(\"The application launcher “%s” has not been marked as trusted. \"\n \"If you do not know the source of this file, launching it may be unsafe.\"\n ),\n display_name);\n\n dialog = gtk_message_dialog_new (parameters->parent_window,\n 0,\n GTK_MESSAGE_WARNING,\n GTK_BUTTONS_NONE,\n NULL);\n g_object_set (dialog,\n \"text\", primary,\n \"secondary-text\", secondary,\n NULL);\n\n gtk_dialog_add_button (GTK_DIALOG (dialog),\n _(\"_Cancel\"), GTK_RESPONSE_CANCEL);\n\n gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);\n if (nautilus_file_can_set_permissions (file))\n {\n gtk_dialog_add_button (GTK_DIALOG (dialog),\n _(\"Trust and _Launch\"), GTK_RESPONSE_OK);\n }\n g_signal_connect (dialog, \"response\",\n G_CALLBACK (untrusted_launcher_response_callback),\n parameters_desktop);\n gtk_widget_show (dialog);\n\n g_free (display_name);\n g_free (secondary);\n return;\n }\n\n uri = nautilus_file_get_uri (file);\n DEBUG (\"Launching trusted launcher %s\", uri);\n nautilus_launch_desktop_file (screen, uri, NULL,\n parameters->parent_window);\n g_free (uri);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#61cc74fbb87af6aa551a06a370590c9bc07e29d9", + "input": "void exit_io_context(void)\n{\n\tstruct io_context *ioc;\n\n\ttask_lock(current);\n\tioc = current->io_context;\n\tcurrent->io_context = NULL;\n\ttask_unlock(current);\n\n\tif (atomic_dec_and_test(&ioc->nr_tasks)) {\n\t\tif (ioc->aic && ioc->aic->exit)\n \t\t\tioc->aic->exit(ioc->aic);\n \t\tcfq_exit(ioc);\n \n\t\tput_io_context(ioc);\n \t}\n }\n", + "target": "void exit_io_context(void)\n{\n\tstruct io_context *ioc;\n\n\ttask_lock(current);\n\tioc = current->io_context;\n\tcurrent->io_context = NULL;\n\ttask_unlock(current);\n\n\tif (atomic_dec_and_test(&ioc->nr_tasks)) {\n\t\tif (ioc->aic && ioc->aic->exit)\n \t\t\tioc->aic->exit(ioc->aic);\n \t\tcfq_exit(ioc);\n \n \t}\n\tput_io_context(ioc);\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7cf563aba8f4b3bab68e9bfe43824d952241dcf7", + "input": " Core(const OAuthProviderInfo& info,\n net::URLRequestContextGetter* request_context_getter)\n : provider_info_(info),\n request_context_getter_(request_context_getter),\n delegate_(NULL) {\n }\n", + "target": " Core(const OAuthProviderInfo& info,\n net::URLRequestContextGetter* request_context_getter)\n : provider_info_(info),\n request_context_getter_(request_context_getter),\n delegate_(NULL),\n url_fetcher_type_(URL_FETCHER_NONE) {\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#14f2111f9cec919a450115ce4914f228effca58e", + "input": " void RunScrollbarButtonLatencyTest() {\n#if !defined(OS_ANDROID)\n blink::WebFloatPoint scrollbar_forward_button(795, 595);\n blink::WebMouseEvent mouse_event = SyntheticWebMouseEventBuilder::Build(\n blink::WebInputEvent::kMouseDown, scrollbar_forward_button.x,\n scrollbar_forward_button.y, 0);\n mouse_event.button = blink::WebMouseEvent::Button::kLeft;\n mouse_event.SetTimeStamp(base::TimeTicks::Now());\n GetWidgetHost()->ForwardMouseEvent(mouse_event);\n mouse_event.SetType(blink::WebInputEvent::kMouseUp);\n GetWidgetHost()->ForwardMouseEvent(mouse_event);\n RunUntilInputProcessed(GetWidgetHost());\n FetchHistogramsFromChildProcesses();\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1, \"Event.Latency.ScrollBegin.Scrollbar.TimeToScrollUpdateSwapBegin4\"));\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1,\n \"Event.Latency.ScrollBegin.Scrollbar.RendererSwapToBrowserNotified2\"));\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1,\n \"Event.Latency.ScrollBegin.Scrollbar.BrowserNotifiedToBeforeGpuSwap2\"));\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1, \"Event.Latency.ScrollBegin.Scrollbar.GpuSwap2\"));\n std::string thread_name =\n DoesScrollbarScrollOnMainThread() ? \"Main\" : \"Impl\";\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1,\n \"Event.Latency.ScrollBegin.Scrollbar.TimeToHandled2_\" + thread_name));\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1, \"Event.Latency.ScrollBegin.Scrollbar.HandledToRendererSwap2_\" +\n thread_name));\n#endif // !defined(OS_ANDROID)\n }\n", + "target": " void RunScrollbarButtonLatencyTest() {\n", + "vul_type": "cwe-281", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#82dc33da50338ac84c7b4102dc6513d897d0506a", + "input": "krb5_gss_pseudo_random(OM_uint32 *minor_status,\n gss_ctx_id_t context,\n int prf_key,\n const gss_buffer_t prf_in,\n ssize_t desired_output_len,\n gss_buffer_t prf_out)\n{\n krb5_error_code code;\n krb5_key key = NULL;\n krb5_gss_ctx_id_t ctx;\n int i;\n OM_uint32 minor;\n size_t prflen;\n krb5_data t, ns;\n unsigned char *p;\n\n prf_out->length = 0;\n prf_out->value = NULL;\n\n t.length = 0;\n t.data = NULL;\n\n ns.length = 0;\n ns.data = NULL;\n \n ctx = (krb5_gss_ctx_id_t)context;\n \n switch (prf_key) {\n case GSS_C_PRF_KEY_FULL:\n if (ctx->have_acceptor_subkey) {\n key = ctx->acceptor_subkey;\n break;\n }\n /* fallthrough */\n case GSS_C_PRF_KEY_PARTIAL:\n key = ctx->subkey;\n break;\n default:\n code = EINVAL;\n goto cleanup;\n }\n\n if (key == NULL) {\n code = EINVAL;\n goto cleanup;\n }\n\n if (desired_output_len == 0)\n return GSS_S_COMPLETE;\n\n prf_out->value = k5alloc(desired_output_len, &code);\n if (prf_out->value == NULL) {\n code = KG_INPUT_TOO_LONG;\n goto cleanup;\n }\n prf_out->length = desired_output_len;\n\n code = krb5_c_prf_length(ctx->k5_context,\n krb5_k_key_enctype(ctx->k5_context, key),\n &prflen);\n if (code != 0)\n goto cleanup;\n\n ns.length = 4 + prf_in->length;\n ns.data = k5alloc(ns.length, &code);\n if (ns.data == NULL) {\n code = KG_INPUT_TOO_LONG;\n goto cleanup;\n }\n\n t.length = prflen;\n t.data = k5alloc(t.length, &code);\n if (t.data == NULL)\n goto cleanup;\n\n memcpy(ns.data + 4, prf_in->value, prf_in->length);\n i = 0;\n p = (unsigned char *)prf_out->value;\n while (desired_output_len > 0) {\n store_32_be(i, ns.data);\n\n code = krb5_k_prf(ctx->k5_context, key, &ns, &t);\n if (code != 0)\n goto cleanup;\n\n memcpy(p, t.data, MIN(t.length, desired_output_len));\n\n p += t.length;\n desired_output_len -= t.length;\n i++;\n }\n\ncleanup:\n if (code != 0)\n gss_release_buffer(&minor, prf_out);\n krb5_free_data_contents(ctx->k5_context, &ns);\n krb5_free_data_contents(ctx->k5_context, &t);\n\n *minor_status = (OM_uint32)code;\n return (code == 0) ? GSS_S_COMPLETE : GSS_S_FAILURE;\n}\n", + "target": "krb5_gss_pseudo_random(OM_uint32 *minor_status,\n gss_ctx_id_t context,\n int prf_key,\n const gss_buffer_t prf_in,\n ssize_t desired_output_len,\n gss_buffer_t prf_out)\n{\n krb5_error_code code;\n krb5_key key = NULL;\n krb5_gss_ctx_id_t ctx;\n int i;\n OM_uint32 minor;\n size_t prflen;\n krb5_data t, ns;\n unsigned char *p;\n\n prf_out->length = 0;\n prf_out->value = NULL;\n\n t.length = 0;\n t.data = NULL;\n\n ns.length = 0;\n ns.data = NULL;\n \n ctx = (krb5_gss_ctx_id_t)context;\n if (ctx->terminated || !ctx->established) {\n *minor_status = KG_CTX_INCOMPLETE;\n return GSS_S_NO_CONTEXT;\n }\n \n switch (prf_key) {\n case GSS_C_PRF_KEY_FULL:\n if (ctx->have_acceptor_subkey) {\n key = ctx->acceptor_subkey;\n break;\n }\n /* fallthrough */\n case GSS_C_PRF_KEY_PARTIAL:\n key = ctx->subkey;\n break;\n default:\n code = EINVAL;\n goto cleanup;\n }\n\n if (key == NULL) {\n code = EINVAL;\n goto cleanup;\n }\n\n if (desired_output_len == 0)\n return GSS_S_COMPLETE;\n\n prf_out->value = k5alloc(desired_output_len, &code);\n if (prf_out->value == NULL) {\n code = KG_INPUT_TOO_LONG;\n goto cleanup;\n }\n prf_out->length = desired_output_len;\n\n code = krb5_c_prf_length(ctx->k5_context,\n krb5_k_key_enctype(ctx->k5_context, key),\n &prflen);\n if (code != 0)\n goto cleanup;\n\n ns.length = 4 + prf_in->length;\n ns.data = k5alloc(ns.length, &code);\n if (ns.data == NULL) {\n code = KG_INPUT_TOO_LONG;\n goto cleanup;\n }\n\n t.length = prflen;\n t.data = k5alloc(t.length, &code);\n if (t.data == NULL)\n goto cleanup;\n\n memcpy(ns.data + 4, prf_in->value, prf_in->length);\n i = 0;\n p = (unsigned char *)prf_out->value;\n while (desired_output_len > 0) {\n store_32_be(i, ns.data);\n\n code = krb5_k_prf(ctx->k5_context, key, &ns, &t);\n if (code != 0)\n goto cleanup;\n\n memcpy(p, t.data, MIN(t.length, desired_output_len));\n\n p += t.length;\n desired_output_len -= t.length;\n i++;\n }\n\ncleanup:\n if (code != 0)\n gss_release_buffer(&minor, prf_out);\n krb5_free_data_contents(ctx->k5_context, &ns);\n krb5_free_data_contents(ctx->k5_context, &t);\n\n *minor_status = (OM_uint32)code;\n return (code == 0) ? GSS_S_COMPLETE : GSS_S_FAILURE;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#baef1ffd73db183ca50c854e1779ed7f6e5100a8", + "input": " void SetUpCacheMetadata() {\n metadata_.reset(new GDataCacheMetadataMap(\n NULL, base::SequencedWorkerPool::SequenceToken()));\n metadata_->Initialize(cache_paths_);\n }\n", + "target": " void SetUpCacheMetadata() {\n metadata_.reset(new GDataCacheMetadataMap(\n NULL, base::SequencedWorkerPool::SequenceToken()));\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#df4d92549f23e1c037e83323aff58a21b3de7fe0", + "input": "int ip_forward(struct sk_buff *skb)\n{\n\tu32 mtu;\n\tstruct iphdr *iph;\t/* Our header */\n\tstruct rtable *rt;\t/* Route we use */\n\tstruct ip_options *opt\t= &(IPCB(skb)->opt);\n\n\t/* that should never happen */\n\tif (skb->pkt_type != PACKET_HOST)\n\t\tgoto drop;\n\n\tif (skb_warn_if_lro(skb))\n\t\tgoto drop;\n\n\tif (!xfrm4_policy_check(NULL, XFRM_POLICY_FWD, skb))\n\t\tgoto drop;\n\n\tif (IPCB(skb)->opt.router_alert && ip_call_ra_chain(skb))\n\t\treturn NET_RX_SUCCESS;\n\n\tskb_forward_csum(skb);\n\n\t/*\n\t *\tAccording to the RFC, we must first decrease the TTL field. If\n\t *\tthat reaches zero, we must reply an ICMP control message telling\n\t *\tthat the packet's lifetime expired.\n\t */\n\tif (ip_hdr(skb)->ttl <= 1)\n\t\tgoto too_many_hops;\n\n\tif (!xfrm4_route_forward(skb))\n\t\tgoto drop;\n\n\trt = skb_rtable(skb);\n\n\tif (opt->is_strictroute && rt->rt_uses_gateway)\n\t\tgoto sr_failed;\n\n\tIPCB(skb)->flags |= IPSKB_FORWARDED;\n\tmtu = ip_dst_mtu_maybe_forward(&rt->dst, true);\n\tif (!ip_may_fragment(skb) && ip_exceeds_mtu(skb, mtu)) {\n\t\tIP_INC_STATS(dev_net(rt->dst.dev), IPSTATS_MIB_FRAGFAILS);\n\t\ticmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,\n\t\t\t htonl(mtu));\n\t\tgoto drop;\n\t}\n\n\t/* We are about to mangle packet. Copy it! */\n\tif (skb_cow(skb, LL_RESERVED_SPACE(rt->dst.dev)+rt->dst.header_len))\n\t\tgoto drop;\n\tiph = ip_hdr(skb);\n\n\t/* Decrease ttl after skb cow done */\n\tip_decrease_ttl(iph);\n\n\t/*\n \t *\tWe now generate an ICMP HOST REDIRECT giving the route\n \t *\twe calculated.\n \t */\n\tif (rt->rt_flags&RTCF_DOREDIRECT && !opt->srr && !skb_sec_path(skb))\n \t\tip_rt_send_redirect(skb);\n \n \tskb->priority = rt_tos2priority(iph->tos);\n\n\treturn NF_HOOK(NFPROTO_IPV4, NF_INET_FORWARD, skb, skb->dev,\n\t\t rt->dst.dev, ip_forward_finish);\n\nsr_failed:\n\t/*\n\t *\tStrict routing permits no gatewaying\n\t */\n\t icmp_send(skb, ICMP_DEST_UNREACH, ICMP_SR_FAILED, 0);\n\t goto drop;\n\ntoo_many_hops:\n\t/* Tell the sender its packet died... */\n\tIP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_INHDRERRORS);\n\ticmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0);\ndrop:\n\tkfree_skb(skb);\n\treturn NET_RX_DROP;\n}\n", + "target": "int ip_forward(struct sk_buff *skb)\n{\n\tu32 mtu;\n\tstruct iphdr *iph;\t/* Our header */\n\tstruct rtable *rt;\t/* Route we use */\n\tstruct ip_options *opt\t= &(IPCB(skb)->opt);\n\n\t/* that should never happen */\n\tif (skb->pkt_type != PACKET_HOST)\n\t\tgoto drop;\n\n\tif (skb_warn_if_lro(skb))\n\t\tgoto drop;\n\n\tif (!xfrm4_policy_check(NULL, XFRM_POLICY_FWD, skb))\n\t\tgoto drop;\n\n\tif (IPCB(skb)->opt.router_alert && ip_call_ra_chain(skb))\n\t\treturn NET_RX_SUCCESS;\n\n\tskb_forward_csum(skb);\n\n\t/*\n\t *\tAccording to the RFC, we must first decrease the TTL field. If\n\t *\tthat reaches zero, we must reply an ICMP control message telling\n\t *\tthat the packet's lifetime expired.\n\t */\n\tif (ip_hdr(skb)->ttl <= 1)\n\t\tgoto too_many_hops;\n\n\tif (!xfrm4_route_forward(skb))\n\t\tgoto drop;\n\n\trt = skb_rtable(skb);\n\n\tif (opt->is_strictroute && rt->rt_uses_gateway)\n\t\tgoto sr_failed;\n\n\tIPCB(skb)->flags |= IPSKB_FORWARDED;\n\tmtu = ip_dst_mtu_maybe_forward(&rt->dst, true);\n\tif (!ip_may_fragment(skb) && ip_exceeds_mtu(skb, mtu)) {\n\t\tIP_INC_STATS(dev_net(rt->dst.dev), IPSTATS_MIB_FRAGFAILS);\n\t\ticmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,\n\t\t\t htonl(mtu));\n\t\tgoto drop;\n\t}\n\n\t/* We are about to mangle packet. Copy it! */\n\tif (skb_cow(skb, LL_RESERVED_SPACE(rt->dst.dev)+rt->dst.header_len))\n\t\tgoto drop;\n\tiph = ip_hdr(skb);\n\n\t/* Decrease ttl after skb cow done */\n\tip_decrease_ttl(iph);\n\n\t/*\n \t *\tWe now generate an ICMP HOST REDIRECT giving the route\n \t *\twe calculated.\n \t */\n\tif (IPCB(skb)->flags & IPSKB_DOREDIRECT && !opt->srr &&\n\t !skb_sec_path(skb))\n \t\tip_rt_send_redirect(skb);\n \n \tskb->priority = rt_tos2priority(iph->tos);\n\n\treturn NF_HOOK(NFPROTO_IPV4, NF_INET_FORWARD, skb, skb->dev,\n\t\t rt->dst.dev, ip_forward_finish);\n\nsr_failed:\n\t/*\n\t *\tStrict routing permits no gatewaying\n\t */\n\t icmp_send(skb, ICMP_DEST_UNREACH, ICMP_SR_FAILED, 0);\n\t goto drop;\n\ntoo_many_hops:\n\t/* Tell the sender its packet died... */\n\tIP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_INHDRERRORS);\n\ticmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0);\ndrop:\n\tkfree_skb(skb);\n\treturn NET_RX_DROP;\n}\n", + "vul_type": "cwe-17", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1924f747637265f563892b8f56a64391f6208194", + "input": "void StopCastCallback(\n CastConfigDelegate* cast_config,\n const CastConfigDelegate::ReceiversAndActivites& receivers_activities) {\n for (auto& item : receivers_activities) {\n CastConfigDelegate::Activity activity = item.second.activity;\n if (activity.allow_stop && activity.id.empty() == false)\n cast_config->StopCasting(activity.id);\n }\n}\n", + "target": "void StopCastCallback(\n", + "vul_type": "cwe-79", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f0c094a1b745d91ef2f9a4eae2149aac026a5789", + "input": "build_principal_va(krb5_context context, krb5_principal princ,\n unsigned int rlen, const char *realm, va_list ap)\n{\n krb5_error_code retval = 0;\n char *r = NULL;\n krb5_data *data = NULL;\n krb5_int32 count = 0;\n krb5_int32 size = 2; /* initial guess at needed space */\n char *component = NULL;\n\n data = malloc(size * sizeof(krb5_data));\n if (!data) { retval = ENOMEM; }\n \n if (!retval) {\n r = strdup(realm);\n if (!r) { retval = ENOMEM; }\n }\n \n while (!retval && (component = va_arg(ap, char *))) {\n if (count == size) {\n krb5_data *new_data = NULL;\n\n size *= 2;\n new_data = realloc(data, size * sizeof(krb5_data));\n if (new_data) {\n data = new_data;\n } else {\n retval = ENOMEM;\n }\n }\n\n if (!retval) {\n data[count].length = strlen(component);\n data[count].data = strdup(component);\n if (!data[count].data) { retval = ENOMEM; }\n count++;\n }\n }\n\n if (!retval) {\n princ->type = KRB5_NT_UNKNOWN;\n princ->magic = KV5M_PRINCIPAL;\n princ->realm = make_data(r, rlen);\n princ->data = data;\n princ->length = count;\n r = NULL; /* take ownership */\n data = NULL; /* take ownership */\n }\n\n if (data) {\n while (--count >= 0) {\n free(data[count].data);\n }\n free(data);\n }\n free(r);\n\n return retval;\n}\n", + "target": "build_principal_va(krb5_context context, krb5_principal princ,\n unsigned int rlen, const char *realm, va_list ap)\n{\n krb5_error_code retval = 0;\n char *r = NULL;\n krb5_data *data = NULL;\n krb5_int32 count = 0;\n krb5_int32 size = 2; /* initial guess at needed space */\n char *component = NULL;\n\n data = malloc(size * sizeof(krb5_data));\n if (!data) { retval = ENOMEM; }\n \n if (!retval)\n r = k5memdup0(realm, rlen, &retval);\n \n while (!retval && (component = va_arg(ap, char *))) {\n if (count == size) {\n krb5_data *new_data = NULL;\n\n size *= 2;\n new_data = realloc(data, size * sizeof(krb5_data));\n if (new_data) {\n data = new_data;\n } else {\n retval = ENOMEM;\n }\n }\n\n if (!retval) {\n data[count].length = strlen(component);\n data[count].data = strdup(component);\n if (!data[count].data) { retval = ENOMEM; }\n count++;\n }\n }\n\n if (!retval) {\n princ->type = KRB5_NT_UNKNOWN;\n princ->magic = KV5M_PRINCIPAL;\n princ->realm = make_data(r, rlen);\n princ->data = data;\n princ->length = count;\n r = NULL; /* take ownership */\n data = NULL; /* take ownership */\n }\n\n if (data) {\n while (--count >= 0) {\n free(data[count].data);\n }\n free(data);\n }\n free(r);\n\n return retval;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#350f7d4b2c76950c8e7271284de84a9756b796e1", + "input": " void SetupConnectedStreams() {\n CallbackRunLoop run_loop(runner());\n ASSERT_TRUE(client_peer_->quic_transport()->IsEncryptionEstablished());\n ASSERT_TRUE(server_peer_->quic_transport()->IsEncryptionEstablished());\n\n client_peer_->CreateStreamWithDelegate();\n ASSERT_TRUE(client_peer_->stream());\n ASSERT_TRUE(client_peer_->stream_delegate());\n\n base::RepeatingCallback callback = run_loop.CreateCallback();\n QuicPeerForTest* server_peer_ptr = server_peer_.get();\n MockP2PQuicStreamDelegate* stream_delegate =\n new MockP2PQuicStreamDelegate();\n P2PQuicStream* server_stream;\n EXPECT_CALL(*server_peer_->quic_transport_delegate(), OnStream(_))\n .WillOnce(Invoke([&callback, &server_stream,\n &stream_delegate](P2PQuicStream* stream) {\n stream->SetDelegate(stream_delegate);\n server_stream = stream;\n callback.Run();\n }));\n \n client_peer_->stream()->WriteOrBufferData(kTriggerRemoteStreamPhrase,\n /*fin=*/false, nullptr);\n run_loop.RunUntilCallbacksFired();\n server_peer_ptr->SetStreamAndDelegate(\n static_cast(server_stream),\n std::unique_ptr(stream_delegate));\n ASSERT_TRUE(client_peer_->stream());\n ASSERT_TRUE(client_peer_->stream_delegate());\n }\n", + "target": " void SetupConnectedStreams() {\n CallbackRunLoop run_loop(runner());\n ASSERT_TRUE(client_peer_->quic_transport()->IsEncryptionEstablished());\n ASSERT_TRUE(server_peer_->quic_transport()->IsEncryptionEstablished());\n\n client_peer_->CreateStreamWithDelegate();\n ASSERT_TRUE(client_peer_->stream());\n ASSERT_TRUE(client_peer_->stream_delegate());\n\n base::RepeatingCallback callback = run_loop.CreateCallback();\n QuicPeerForTest* server_peer_ptr = server_peer_.get();\n MockP2PQuicStreamDelegate* stream_delegate =\n new MockP2PQuicStreamDelegate();\n P2PQuicStream* server_stream;\n EXPECT_CALL(*server_peer_->quic_transport_delegate(), OnStream(_))\n .WillOnce(Invoke([&callback, &server_stream,\n &stream_delegate](P2PQuicStream* stream) {\n stream->SetDelegate(stream_delegate);\n server_stream = stream;\n callback.Run();\n }));\n \n client_peer_->stream()->WriteData(\n std::vector(kTriggerRemoteStreamPhrase.begin(),\n kTriggerRemoteStreamPhrase.end()),\n /*fin=*/false);\n run_loop.RunUntilCallbacksFired();\n server_peer_ptr->SetStreamAndDelegate(\n static_cast(server_stream),\n std::unique_ptr(stream_delegate));\n ASSERT_TRUE(client_peer_->stream());\n ASSERT_TRUE(client_peer_->stream_delegate());\n }\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc7b094a338c6c521f918f478e993f0f74bbea0d", + "input": " static void IBusBusNameOwnerChangedCallback(\n IBusBus* bus,\n const gchar* name, const gchar* old_name, const gchar* new_name,\n gpointer user_data) {\n DCHECK(name);\n DCHECK(old_name);\n DCHECK(new_name);\n DLOG(INFO) << \"Name owner is changed: name=\" << name\n << \", old_name=\" << old_name << \", new_name=\" << new_name;\n \n if (name != std::string(\"org.freedesktop.IBus.Config\")) {\n return;\n }\n\n const std::string empty_string;\n if (old_name != empty_string || new_name == empty_string) {\n LOG(WARNING) << \"Unexpected name owner change: name=\" << name\n << \", old_name=\" << old_name << \", new_name=\" << new_name;\n return;\n }\n \n LOG(INFO) << \"IBus config daemon is started. Recovering ibus_config_\";\n g_return_if_fail(user_data);\n InputMethodStatusConnection* self\n = static_cast(user_data);\n \n self->MaybeRestoreConnections();\n }\n", + "target": " static void IBusBusNameOwnerChangedCallback(\n void IBusBusNameOwnerChanged(IBusBus* bus,\n const gchar* name,\n const gchar* old_name,\n const gchar* new_name) {\n DCHECK(name);\n DCHECK(old_name);\n DCHECK(new_name);\n VLOG(1) << \"Name owner is changed: name=\" << name\n << \", old_name=\" << old_name << \", new_name=\" << new_name;\n \n if (name != std::string(\"org.freedesktop.IBus.Config\")) {\n return;\n }\n\n const std::string empty_string;\n if (old_name != empty_string || new_name == empty_string) {\n LOG(WARNING) << \"Unexpected name owner change: name=\" << name\n << \", old_name=\" << old_name << \", new_name=\" << new_name;\n // |OnConnectionChange| with false here to allow Chrome to\n return;\n }\n \n VLOG(1) << \"IBus config daemon is started. Recovering ibus_config_\";\n \n // successfully created, |OnConnectionChange| will be called to\n MaybeRestoreConnections();\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5a9753fca56f0eeb9f61e342b2fccffc364f9426", + "input": " void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) {\n inv_txfm_(out, dst, stride, tx_type_);\n }\n", + "target": " void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) {\n void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) {\n inv_txfm_(out, dst, stride, tx_type_);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c63f2b7fe4fe2977f858a8e36d5f48db17eff2e7", + "input": "void ExtensionTtsController::OnSpeechFinished(\n int request_id, const std::string& error_message) {\n if (!current_utterance_ || request_id != current_utterance_->id())\n return;\n current_utterance_->set_error(error_message);\n FinishCurrentUtterance();\n SpeakNextUtterance();\n}\n", + "target": "void ExtensionTtsController::OnSpeechFinished(\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c59ad14fc61393a50b2ca3e89c7ecaba7028c4c4", + "input": "PrintMsg_Print_Params::PrintMsg_Print_Params()\n : page_size(),\n content_size(),\n printable_area(),\n margin_top(0),\n margin_left(0),\n dpi(0),\n scale_factor(1.0f),\n rasterize_pdf(false),\n document_cookie(0),\n selection_only(false),\n supports_alpha_blend(false),\n preview_ui_id(-1),\n preview_request_id(0),\n is_first_request(false),\n print_scaling_option(blink::kWebPrintScalingOptionSourceSize),\n print_to_pdf(false),\n display_header_footer(false),\n title(),\n url(),\n should_print_backgrounds(false),\n printed_doc_type(printing::SkiaDocumentType::PDF) {}\n", + "target": "PrintMsg_Print_Params::PrintMsg_Print_Params()\n : page_size(),\n content_size(),\n printable_area(),\n margin_top(0),\n margin_left(0),\n dpi(0),\n scale_factor(1.0f),\n rasterize_pdf(false),\n document_cookie(0),\n selection_only(false),\n supports_alpha_blend(false),\n preview_ui_id(-1),\n preview_request_id(0),\n is_first_request(false),\n print_scaling_option(blink::kWebPrintScalingOptionSourceSize),\n print_to_pdf(false),\n display_header_footer(false),\n title(),\n url(),\n header_template(),\n footer_template(),\n should_print_backgrounds(false),\n printed_doc_type(printing::SkiaDocumentType::PDF) {}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b9dc6f65bc5e232d1c05fe34b5daadc7e8bbf1fb", + "input": "void iov_iter_pipe(struct iov_iter *i, int direction,\n\t\t\tstruct pipe_inode_info *pipe,\n \t\t\tsize_t count)\n {\n \tBUG_ON(direction != ITER_PIPE);\n \ti->type = direction;\n \ti->pipe = pipe;\n \ti->idx = (pipe->curbuf + pipe->nrbufs) & (pipe->buffers - 1);\n\ti->iov_offset = 0;\n\ti->count = count;\n}\n", + "target": "void iov_iter_pipe(struct iov_iter *i, int direction,\n\t\t\tstruct pipe_inode_info *pipe,\n \t\t\tsize_t count)\n {\n \tBUG_ON(direction != ITER_PIPE);\n\tWARN_ON(pipe->nrbufs == pipe->buffers);\n \ti->type = direction;\n \ti->pipe = pipe;\n \ti->idx = (pipe->curbuf + pipe->nrbufs) & (pipe->buffers - 1);\n\ti->iov_offset = 0;\n\ti->count = count;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-022#3-57ed4bb1cc30", + "input": " @staticmethod\n def estimate_size(task_id, taken_dirs, taken_files):\n report = AnalysisController.get_report(task_id)\n report = report[\"analysis\"]\n path = report[\"info\"][\"analysis_path\"]\n\n size_total = 0\n\n for directory in taken_dirs:\n destination = \"%s/%s\" % (path, directory)\n if os.path.isdir(destination):\n size_total += get_directory_size(destination)\n\n for filename in taken_files:\n destination = \"%s/%s\" % (path, filename)\n if os.path.isfile(destination):\n size_total += os.path.getsize(destination)\n\n # estimate file size after zipping; 60% compression rate typically\n size_estimated = size_total / 6.5\n\n return {\n \"size\": int(size_estimated),\n \"size_human\": filesizeformat(size_estimated)\n }", + "target": " @staticmethod\n def estimate_size(task_id, taken_dirs, taken_files):\n report = AnalysisController.get_report(task_id)\n report = report[\"analysis\"]\n path = report[\"info\"][\"analysis_path\"]\n\n size_total = 0\n\n for directory in taken_dirs:\n destination = \"%s/%s\" % (path, os.path.basename(directory))\n if os.path.isdir(destination):\n size_total += get_directory_size(destination)\n\n for filename in taken_files:\n destination = \"%s/%s\" % (path, os.path.basename(filename))\n if os.path.isfile(destination):\n size_total += os.path.getsize(destination)\n\n # estimate file size after zipping; 60% compression rate typically\n size_estimated = size_total / 6.5\n\n return {\n \"size\": int(size_estimated),\n \"size_human\": filesizeformat(size_estimated)\n }", + "vul_type": "cwe-022", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#c395c6e5d7e8df37a21265ff76e48fe75ceb5ae6?w=1", + "input": "void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)\n{\n\tint c;\n\tint x, y;\n\tint tox, toy;\n\tint ydest;\n\tint i;\n \tint colorMap[gdMaxColors];\n \t/* Stretch vectors */\n \tint *stx, *sty;\n \tif (overflow2(sizeof(int), srcW)) {\n \t\treturn;\n \t}\n\tif (overflow2(sizeof(int), srcH)) {\n\t\treturn;\n\t}\n\n\tstx = (int *) gdMalloc (sizeof (int) * srcW);\n\tsty = (int *) gdMalloc (sizeof (int) * srcH);\n\n\t/* Fixed by Mao Morimoto 2.0.16 */\n\tfor (i = 0; (i < srcW); i++) {\n\t\tstx[i] = dstW * (i+1) / srcW - dstW * i / srcW ;\n\t}\n\tfor (i = 0; (i < srcH); i++) {\n\t\tsty[i] = dstH * (i+1) / srcH - dstH * i / srcH ;\n\t}\n\tfor (i = 0; (i < gdMaxColors); i++) {\n\t\tcolorMap[i] = (-1);\n\t}\n\ttoy = dstY;\n\tfor (y = srcY; (y < (srcY + srcH)); y++) {\n\t\tfor (ydest = 0; (ydest < sty[y - srcY]); ydest++) {\n\t\t\ttox = dstX;\n\t\t\tfor (x = srcX; (x < (srcX + srcW)); x++) {\n\t\t\t\tint nc = 0;\n\t\t\t\tint mapTo;\n\t\t\t\tif (!stx[x - srcX]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (dst->trueColor) {\n\t\t\t\t\t/* 2.0.9: Thorben Kundinger: Maybe the source image is not a truecolor image */\n\t\t\t\t\tif (!src->trueColor) {\n\t\t\t\t\t \tint tmp = gdImageGetPixel (src, x, y);\n\t\t \t\t\t\tmapTo = gdImageGetTrueColorPixel (src, x, y);\n\t\t\t\t\t \tif (gdImageGetTransparent (src) == tmp) {\n\t\t\t\t\t\t\t/* 2.0.21, TK: not tox++ */\n\t\t\t\t\t\t\ttox += stx[x - srcX];\n\t\t\t\t\t \t\tcontinue;\n\t\t\t\t\t \t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* TK: old code follows */\n\t\t\t\t\t \tmapTo = gdImageGetTrueColorPixel (src, x, y);\n\t\t\t\t\t\t/* Added 7/24/95: support transparent copies */\n\t\t\t\t\t\tif (gdImageGetTransparent (src) == mapTo) {\n\t\t\t\t\t\t\t/* 2.0.21, TK: not tox++ */\n\t\t\t\t\t\t\ttox += stx[x - srcX];\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tc = gdImageGetPixel (src, x, y);\n\t\t\t\t\t/* Added 7/24/95: support transparent copies */\n\t\t\t\t\tif (gdImageGetTransparent (src) == c) {\n\t\t\t\t\t tox += stx[x - srcX];\n\t\t\t\t\t continue;\n\t\t\t\t\t}\n\t\t\t\t\tif (src->trueColor) {\n\t\t\t\t\t /* Remap to the palette available in the destination image. This is slow and works badly. */\n\t\t\t\t\t mapTo = gdImageColorResolveAlpha(dst, gdTrueColorGetRed(c),\n\t\t\t\t\t \t\t\t\t\t gdTrueColorGetGreen(c),\n\t\t\t\t\t \t\t\t\t\t gdTrueColorGetBlue(c),\n\t\t\t\t\t \t\t\t\t\t gdTrueColorGetAlpha (c));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* Have we established a mapping for this color? */\n\t\t\t\t\t\tif (colorMap[c] == (-1)) {\n\t\t\t\t\t\t\t/* If it's the same image, mapping is trivial */\n\t\t\t\t\t\t\tif (dst == src) {\n\t\t\t\t\t\t\t\tnc = c;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t/* Find or create the best match */\n\t\t\t\t\t\t\t\t/* 2.0.5: can't use gdTrueColorGetRed, etc with palette */\n\t\t\t\t\t\t\t\tnc = gdImageColorResolveAlpha(dst, gdImageRed(src, c),\n\t\t\t\t\t\t\t\t\t\t\t\t gdImageGreen(src, c),\n\t\t\t\t\t\t\t\t\t\t\t\t gdImageBlue(src, c),\n\t\t\t\t\t\t\t\t\t\t\t\t gdImageAlpha(src, c));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcolorMap[c] = nc;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmapTo = colorMap[c];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (i = 0; (i < stx[x - srcX]); i++) {\n\t\t\t\t\tgdImageSetPixel (dst, tox, toy, mapTo);\n\t\t\t\t\ttox++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoy++;\n\t\t}\n\t}\n\tgdFree (stx);\n\tgdFree (sty);\n}\n", + "target": "void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)\n{\n\tint c;\n\tint x, y;\n\tint tox, toy;\n\tint ydest;\n\tint i;\n \tint colorMap[gdMaxColors];\n \t/* Stretch vectors */\n \tint *stx, *sty;\n\n \tif (overflow2(sizeof(int), srcW)) {\n \t\treturn;\n \t}\n\tif (overflow2(sizeof(int), srcH)) {\n\t\treturn;\n\t}\n\n\tstx = (int *) gdMalloc (sizeof (int) * srcW);\n\tsty = (int *) gdMalloc (sizeof (int) * srcH);\n\n\t/* Fixed by Mao Morimoto 2.0.16 */\n\tfor (i = 0; (i < srcW); i++) {\n\t\tstx[i] = dstW * (i+1) / srcW - dstW * i / srcW ;\n\t}\n\tfor (i = 0; (i < srcH); i++) {\n\t\tsty[i] = dstH * (i+1) / srcH - dstH * i / srcH ;\n\t}\n\tfor (i = 0; (i < gdMaxColors); i++) {\n\t\tcolorMap[i] = (-1);\n\t}\n\ttoy = dstY;\n\tfor (y = srcY; (y < (srcY + srcH)); y++) {\n\t\tfor (ydest = 0; (ydest < sty[y - srcY]); ydest++) {\n\t\t\ttox = dstX;\n\t\t\tfor (x = srcX; (x < (srcX + srcW)); x++) {\n\t\t\t\tint nc = 0;\n\t\t\t\tint mapTo;\n\t\t\t\tif (!stx[x - srcX]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (dst->trueColor) {\n\t\t\t\t\t/* 2.0.9: Thorben Kundinger: Maybe the source image is not a truecolor image */\n\t\t\t\t\tif (!src->trueColor) {\n\t\t\t\t\t \tint tmp = gdImageGetPixel (src, x, y);\n\t\t \t\t\t\tmapTo = gdImageGetTrueColorPixel (src, x, y);\n\t\t\t\t\t \tif (gdImageGetTransparent (src) == tmp) {\n\t\t\t\t\t\t\t/* 2.0.21, TK: not tox++ */\n\t\t\t\t\t\t\ttox += stx[x - srcX];\n\t\t\t\t\t \t\tcontinue;\n\t\t\t\t\t \t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* TK: old code follows */\n\t\t\t\t\t \tmapTo = gdImageGetTrueColorPixel (src, x, y);\n\t\t\t\t\t\t/* Added 7/24/95: support transparent copies */\n\t\t\t\t\t\tif (gdImageGetTransparent (src) == mapTo) {\n\t\t\t\t\t\t\t/* 2.0.21, TK: not tox++ */\n\t\t\t\t\t\t\ttox += stx[x - srcX];\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tc = gdImageGetPixel (src, x, y);\n\t\t\t\t\t/* Added 7/24/95: support transparent copies */\n\t\t\t\t\tif (gdImageGetTransparent (src) == c) {\n\t\t\t\t\t tox += stx[x - srcX];\n\t\t\t\t\t continue;\n\t\t\t\t\t}\n\t\t\t\t\tif (src->trueColor) {\n\t\t\t\t\t /* Remap to the palette available in the destination image. This is slow and works badly. */\n\t\t\t\t\t mapTo = gdImageColorResolveAlpha(dst, gdTrueColorGetRed(c),\n\t\t\t\t\t \t\t\t\t\t gdTrueColorGetGreen(c),\n\t\t\t\t\t \t\t\t\t\t gdTrueColorGetBlue(c),\n\t\t\t\t\t \t\t\t\t\t gdTrueColorGetAlpha (c));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* Have we established a mapping for this color? */\n\t\t\t\t\t\tif (colorMap[c] == (-1)) {\n\t\t\t\t\t\t\t/* If it's the same image, mapping is trivial */\n\t\t\t\t\t\t\tif (dst == src) {\n\t\t\t\t\t\t\t\tnc = c;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t/* Find or create the best match */\n\t\t\t\t\t\t\t\t/* 2.0.5: can't use gdTrueColorGetRed, etc with palette */\n\t\t\t\t\t\t\t\tnc = gdImageColorResolveAlpha(dst, gdImageRed(src, c),\n\t\t\t\t\t\t\t\t\t\t\t\t gdImageGreen(src, c),\n\t\t\t\t\t\t\t\t\t\t\t\t gdImageBlue(src, c),\n\t\t\t\t\t\t\t\t\t\t\t\t gdImageAlpha(src, c));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcolorMap[c] = nc;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmapTo = colorMap[c];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (i = 0; (i < stx[x - srcX]); i++) {\n\t\t\t\t\tgdImageSetPixel (dst, tox, toy, mapTo);\n\t\t\t\t\ttox++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoy++;\n\t\t}\n\t}\n\tgdFree (stx);\n\tgdFree (sty);\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "image_transform_png_set_gray_to_rgb_mod(PNG_CONST image_transform *this,\n image_pixel *that, png_const_structp pp,\n PNG_CONST transform_display *display)\n {\n /* NOTE: we can actually pend the tRNS processing at this point because we\n * can correctly recognize the original pixel value even though we have\n * mapped the one gray channel to the three RGB ones, but in fact libpng\n\n * doesn't do this, so we don't either.\n */\n if ((that->colour_type & PNG_COLOR_MASK_COLOR) == 0 && that->have_tRNS)\n image_pixel_add_alpha(that, &display->this);\n \n /* Simply expand the bit depth and alter the colour type as required. */\n if (that->colour_type == PNG_COLOR_TYPE_GRAY)\n {\n /* RGB images have a bit depth at least equal to '8' */\n if (that->bit_depth < 8)\n that->sample_depth = that->bit_depth = 8;\n\n /* And just changing the colour type works here because the green and blue\n * channels are being maintained in lock-step with the red/gray:\n */\n that->colour_type = PNG_COLOR_TYPE_RGB;\n }\n\n else if (that->colour_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n that->colour_type = PNG_COLOR_TYPE_RGB_ALPHA;\n\n this->next->mod(this->next, that, pp, display);\n}\n", + "target": "image_transform_png_set_gray_to_rgb_mod(PNG_CONST image_transform *this,\nimage_transform_png_set_gray_to_rgb_mod(const image_transform *this,\n image_pixel *that, png_const_structp pp,\n const transform_display *display)\n {\n /* NOTE: we can actually pend the tRNS processing at this point because we\n * can correctly recognize the original pixel value even though we have\n * mapped the one gray channel to the three RGB ones, but in fact libpng\n\n * doesn't do this, so we don't either.\n */\n if ((that->colour_type & PNG_COLOR_MASK_COLOR) == 0 && that->have_tRNS)\n image_pixel_add_alpha(that, &display->this, 0/*!for background*/);\n \n /* Simply expand the bit depth and alter the colour type as required. */\n if (that->colour_type == PNG_COLOR_TYPE_GRAY)\n {\n /* RGB images have a bit depth at least equal to '8' */\n if (that->bit_depth < 8)\n that->sample_depth = that->bit_depth = 8;\n\n /* And just changing the colour type works here because the green and blue\n * channels are being maintained in lock-step with the red/gray:\n */\n that->colour_type = PNG_COLOR_TYPE_RGB;\n }\n\n else if (that->colour_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n that->colour_type = PNG_COLOR_TYPE_RGB_ALPHA;\n\n this->next->mod(this->next, that, pp, display);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4c023ba43c16396f0d199e2df1cfa59b88b62acc", + "input": "find_alternate_tgs(kdc_realm_t *kdc_active_realm, krb5_principal princ,\n krb5_db_entry **server_ptr, const char **status)\n{\n krb5_error_code retval;\n krb5_principal *plist = NULL, *pl2;\n krb5_data tmp;\n krb5_db_entry *server = NULL;\n\n *server_ptr = NULL;\n assert(is_cross_tgs_principal(princ));\n if ((retval = krb5_walk_realm_tree(kdc_context,\n krb5_princ_realm(kdc_context, princ),\n krb5_princ_component(kdc_context, princ, 1),\n &plist, KRB5_REALM_BRANCH_CHAR))) {\n goto cleanup;\n }\n /* move to the end */\n for (pl2 = plist; *pl2; pl2++);\n\n /* the first entry in this array is for krbtgt/local@local, so we\n ignore it */\n while (--pl2 > plist) {\n tmp = *krb5_princ_realm(kdc_context, *pl2);\n krb5_princ_set_realm(kdc_context, *pl2,\n krb5_princ_realm(kdc_context, tgs_server));\n retval = db_get_svc_princ(kdc_context, *pl2, 0, &server, status);\n krb5_princ_set_realm(kdc_context, *pl2, &tmp);\n if (retval == KRB5_KDB_NOENTRY)\n continue;\n else if (retval)\n goto cleanup;\n\n log_tgs_alt_tgt(kdc_context, server->princ);\n *server_ptr = server;\n server = NULL;\n goto cleanup;\n }\n cleanup:\n if (retval != 0)\n *status = \"UNKNOWN_SERVER\";\n \n krb5_free_realm_tree(kdc_context, plist);\n krb5_db_free_principal(kdc_context, server);\n return retval;\n}\n", + "target": "find_alternate_tgs(kdc_realm_t *kdc_active_realm, krb5_principal princ,\n krb5_db_entry **server_ptr, const char **status)\n{\n krb5_error_code retval;\n krb5_principal *plist = NULL, *pl2;\n krb5_data tmp;\n krb5_db_entry *server = NULL;\n\n *server_ptr = NULL;\n assert(is_cross_tgs_principal(princ));\n if ((retval = krb5_walk_realm_tree(kdc_context,\n krb5_princ_realm(kdc_context, princ),\n krb5_princ_component(kdc_context, princ, 1),\n &plist, KRB5_REALM_BRANCH_CHAR))) {\n goto cleanup;\n }\n /* move to the end */\n for (pl2 = plist; *pl2; pl2++);\n\n /* the first entry in this array is for krbtgt/local@local, so we\n ignore it */\n while (--pl2 > plist) {\n tmp = *krb5_princ_realm(kdc_context, *pl2);\n krb5_princ_set_realm(kdc_context, *pl2,\n krb5_princ_realm(kdc_context, tgs_server));\n retval = db_get_svc_princ(kdc_context, *pl2, 0, &server, status);\n krb5_princ_set_realm(kdc_context, *pl2, &tmp);\n if (retval == KRB5_KDB_NOENTRY)\n continue;\n else if (retval)\n goto cleanup;\n\n log_tgs_alt_tgt(kdc_context, server->princ);\n *server_ptr = server;\n server = NULL;\n goto cleanup;\n }\n cleanup:\n if (retval == 0 && server_ptr == NULL)\n retval = KRB5_KDB_NOENTRY;\n if (retval != 0)\n *status = \"UNKNOWN_SERVER\";\n \n krb5_free_realm_tree(kdc_context, plist);\n krb5_db_free_principal(kdc_context, server);\n return retval;\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-022#4-0b32e23f8f22", + "input": " def span(self, key):\n path = os.path.join(self.namespace, key)\n try:\n self.etcd.write(path, None, dir=True, prevExist=False)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error storing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to store key')", + "target": " def span(self, key):\n path = self._absolute_key(key)\n try:\n self.etcd.write(path, None, dir=True, prevExist=False)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error storing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to store key')", + "vul_type": "cwe-022", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#19190765882e272a6a2162c89acdb29110f7e3cf", + "input": "const base::Time& BaseNode::GetModificationTime() const {\n return GetEntry()->Get(syncable::MTIME);\n }\n", + "target": "const base::Time& BaseNode::GetModificationTime() const {\nint64 BaseNode::GetModificationTime() const {\n return GetEntry()->Get(syncable::MTIME);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#94f1bb15bed84ad6c893916b7e7b9db6f1d7eec6", + "input": "static int rngapi_reset(struct crypto_rng *tfm, const u8 *seed,\n\t\t\tunsigned int slen)\n{\n\tu8 *buf = NULL;\n\tu8 *src = (u8 *)seed;\n\tint err;\n\tif (slen) {\n\t\tbuf = kmalloc(slen, GFP_KERNEL);\n\t\tif (!buf)\n\t\t\treturn -ENOMEM;\n\t\tmemcpy(buf, seed, slen);\n\t\tsrc = buf;\n\t}\n\terr = crypto_old_rng_alg(tfm)->rng_reset(tfm, src, slen);\n\tkzfree(buf);\n\treturn err;\n}\n", + "target": "static int rngapi_reset(struct crypto_rng *tfm, const u8 *seed,\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "store_pool_error(png_store *ps, png_const_structp pp, PNG_CONST char *msg)\n {\n if (pp != NULL)\n png_error(pp, msg);\n\n /* Else we have to do it ourselves. png_error eventually calls store_log,\n * above. store_log accepts a NULL png_structp - it just changes what gets\n * output by store_message.\n */\n store_log(ps, pp, msg, 1 /* error */);\n}\n", + "target": "store_pool_error(png_store *ps, png_const_structp pp, PNG_CONST char *msg)\nstore_pool_error(png_store *ps, png_const_structp pp, const char *msg)\n {\n if (pp != NULL)\n png_error(pp, msg);\n\n /* Else we have to do it ourselves. png_error eventually calls store_log,\n * above. store_log accepts a NULL png_structp - it just changes what gets\n * output by store_message.\n */\n store_log(ps, pp, msg, 1 /* error */);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c4363d1ca65494cb7b271625e1ff6541a9f593c9", + "input": " void TouchEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) {\n input_event inputs[kNumTouchEvdevSlots * 6 + 1];\n ssize_t read_size = read(fd, inputs, sizeof(inputs));\n if (read_size < 0) {\n if (errno == EINTR || errno == EAGAIN)\n return;\n if (errno != ENODEV)\n PLOG(ERROR) << \"error reading device \" << path_.value();\n Stop();\n return;\n }\n\n if (ignore_events_)\n return;\n\n for (unsigned i = 0; i < read_size / sizeof(*inputs); i++) {\n if (!has_mt_) {\n EmulateMultitouchEvent(inputs[i]);\n }\n\n ProcessMultitouchEvent(inputs[i]);\n }\n}\n", + "target": " void TouchEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) {\n TRACE_EVENT1(\"evdev\",\n \"TouchEventConverterEvdev::OnFileCanReadWithoutBlocking\", \"fd\",\n fd);\n\n input_event inputs[kNumTouchEvdevSlots * 6 + 1];\n ssize_t read_size = read(fd, inputs, sizeof(inputs));\n if (read_size < 0) {\n if (errno == EINTR || errno == EAGAIN)\n return;\n if (errno != ENODEV)\n PLOG(ERROR) << \"error reading device \" << path_.value();\n Stop();\n return;\n }\n\n if (ignore_events_)\n return;\n\n for (unsigned i = 0; i < read_size / sizeof(*inputs); i++) {\n if (!has_mt_) {\n EmulateMultitouchEvent(inputs[i]);\n }\n\n ProcessMultitouchEvent(inputs[i]);\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#97aa752fee61fccdec361279adbfb17a3c60f3f4", + "input": "mysqlnd_switch_to_ssl_if_needed(\n\t\t\tMYSQLND_CONN_DATA * conn,\n\t\t\tconst MYSQLND_PACKET_GREET * const greet_packet,\n\t\t\tconst MYSQLND_OPTIONS * const options,\n\t\t\tunsigned long mysql_flags\n\t\t\tTSRMLS_DC\n\t\t)\n{\n\tenum_func_status ret = FAIL;\n\tconst MYSQLND_CHARSET * charset;\n\tMYSQLND_PACKET_AUTH * auth_packet;\n\tDBG_ENTER(\"mysqlnd_switch_to_ssl_if_needed\");\n\n\tauth_packet = conn->protocol->m.get_auth_packet(conn->protocol, FALSE TSRMLS_CC);\n\tif (!auth_packet) {\n\t\tSET_OOM_ERROR(*conn->error_info);\n\t\tgoto end;\n\t}\n\tauth_packet->client_flags = mysql_flags;\n\tauth_packet->max_packet_size = MYSQLND_ASSEMBLED_PACKET_MAX_SIZE;\n\n\tif (options->charset_name && (charset = mysqlnd_find_charset_name(options->charset_name))) {\n\t\tauth_packet->charset_no\t= charset->nr;\n\t} else {\n#if MYSQLND_UNICODE\n\t\tauth_packet->charset_no\t= 200;/* utf8 - swedish collation, check mysqlnd_charset.c */\n#else\n\t\tauth_packet->charset_no\t= greet_packet->charset_no;\n#endif\n }\n \n #ifdef MYSQLND_SSL_SUPPORTED\n if ((greet_packet->server_capabilities & CLIENT_SSL) && (mysql_flags & CLIENT_SSL)) {\n zend_bool verify = mysql_flags & CLIENT_SSL_VERIFY_SERVER_CERT? TRUE:FALSE;\n DBG_INF(\"Switching to SSL\");\n if (!PACKET_WRITE(auth_packet, conn)) {\n CONN_SET_STATE(conn, CONN_QUIT_SENT);\n SET_CLIENT_ERROR(*conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);\n goto end;\n }\n \n conn->net->m.set_client_option(conn->net, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (const char *) &verify TSRMLS_CC);\n \n if (FAIL == conn->net->m.enable_ssl(conn->net TSRMLS_CC)) {\n goto end;\n }\n }\n #endif\n ret = PASS;\n end:\n PACKET_FREE(auth_packet);\n DBG_RETURN(ret);\n }\n", + "target": "mysqlnd_switch_to_ssl_if_needed(\n\t\t\tMYSQLND_CONN_DATA * conn,\n\t\t\tconst MYSQLND_PACKET_GREET * const greet_packet,\n\t\t\tconst MYSQLND_OPTIONS * const options,\n\t\t\tunsigned long mysql_flags\n\t\t\tTSRMLS_DC\n\t\t)\n{\n\tenum_func_status ret = FAIL;\n\tconst MYSQLND_CHARSET * charset;\n\tMYSQLND_PACKET_AUTH * auth_packet;\n\tDBG_ENTER(\"mysqlnd_switch_to_ssl_if_needed\");\n\n\tauth_packet = conn->protocol->m.get_auth_packet(conn->protocol, FALSE TSRMLS_CC);\n\tif (!auth_packet) {\n\t\tSET_OOM_ERROR(*conn->error_info);\n\t\tgoto end;\n\t}\n\tauth_packet->client_flags = mysql_flags;\n\tauth_packet->max_packet_size = MYSQLND_ASSEMBLED_PACKET_MAX_SIZE;\n\n\tif (options->charset_name && (charset = mysqlnd_find_charset_name(options->charset_name))) {\n\t\tauth_packet->charset_no\t= charset->nr;\n\t} else {\n#if MYSQLND_UNICODE\n\t\tauth_packet->charset_no\t= 200;/* utf8 - swedish collation, check mysqlnd_charset.c */\n#else\n\t\tauth_packet->charset_no\t= greet_packet->charset_no;\n#endif\n }\n \n #ifdef MYSQLND_SSL_SUPPORTED\n if (mysql_flags & CLIENT_SSL) {\n zend_bool server_has_ssl = (greet_packet->server_capabilities & CLIENT_SSL)? TRUE:FALSE;\n if (server_has_ssl == FALSE) {\n goto close_conn;\n } else {\n zend_bool verify = mysql_flags & CLIENT_SSL_VERIFY_SERVER_CERT? TRUE:FALSE;\n DBG_INF(\"Switching to SSL\");\n if (!PACKET_WRITE(auth_packet, conn)) {\n goto close_conn;\n }\n \n conn->net->m.set_client_option(conn->net, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (const char *) &verify TSRMLS_CC);\n \n if (FAIL == conn->net->m.enable_ssl(conn->net TSRMLS_CC)) {\n goto end;\n }\n }\n }\n#else\n auth_packet->client_flags &= ~CLIENT_SSL;\n if (!PACKET_WRITE(auth_packet, conn)) {\n goto close_conn;\n }\n #endif\n ret = PASS;\n end:\n PACKET_FREE(auth_packet);\n DBG_RETURN(ret);\n\nclose_conn:\n CONN_SET_STATE(conn, CONN_QUIT_SENT);\n conn->m->send_close(conn TSRMLS_CC);\n SET_CLIENT_ERROR(*conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);\n PACKET_FREE(auth_packet);\n DBG_RETURN(ret);\n }\n", + "vul_type": "cwe-284", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#98095c718d7580b5d6715e5bfd8698234ecb4470", + "input": " GLboolean WebGLRenderingContextBase::isProgram(WebGLProgram* program) {\n if (!program || isContextLost())\n return 0;\n \n return ContextGL()->IsProgram(program->Object());\n }\n", + "target": " GLboolean WebGLRenderingContextBase::isProgram(WebGLProgram* program) {\n if (!program || isContextLost() || !program->Validate(ContextGroup(), this))\n return 0;\n \n return ContextGL()->IsProgram(program->Object());\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e9372a1bfd3588a80fcf49aa07321f0971dd6091", + "input": "static v8::Handle supplementalMethod2Callback(const v8::Arguments& args)\n {\n INC_STATS(\"DOM.TestInterface.supplementalMethod2\");\n if (args.Length() < 2)\n return V8Proxy::throwNotEnoughArgumentsError();\n TestInterface* imp = V8TestInterface::toNative(args.Holder());\n ExceptionCode ec = 0;\n {\n STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));\n EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle::Cast(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined))) : 0);\n ScriptExecutionContext* scriptContext = getScriptExecutionContext();\n if (!scriptContext)\n return v8::Undefined();\n RefPtr result = TestSupplemental::supplementalMethod2(imp, scriptContext, strArg, objArg, ec);\n if (UNLIKELY(ec))\n goto fail;\n return toV8(result.release(), args.GetIsolate());\n }\n fail:\n V8Proxy::setDOMException(ec, args.GetIsolate());\n return v8::Handle();\n}\n", + "target": "static v8::Handle supplementalMethod2Callback(const v8::Arguments& args)\n {\n INC_STATS(\"DOM.TestInterface.supplementalMethod2\");\n if (args.Length() < 2)\n return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());\n TestInterface* imp = V8TestInterface::toNative(args.Holder());\n ExceptionCode ec = 0;\n {\n STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));\n EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)) ? V8TestObj::toNative(v8::Handle::Cast(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined))) : 0);\n ScriptExecutionContext* scriptContext = getScriptExecutionContext();\n if (!scriptContext)\n return v8::Undefined();\n RefPtr result = TestSupplemental::supplementalMethod2(imp, scriptContext, strArg, objArg, ec);\n if (UNLIKELY(ec))\n goto fail;\n return toV8(result.release(), args.GetIsolate());\n }\n fail:\n V8Proxy::setDOMException(ec, args.GetIsolate());\n return v8::Handle();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#69d2fd2c597ffc0c217de1238b9bf4d4bceba8e6", + "input": "_gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,\n int *cs, int *vers, int *fmt, int *ncx, int *ncy,\n t_chunk_info ** chunkIdx)\n{\n\tint i;\n\tint ch;\n\tchar id[5];\n\tt_chunk_info *cidx;\n\tint sidx;\n\tint nc;\n\n\tGD2_DBG (printf (\"Reading gd2 header info\\n\"));\n\n\tfor (i = 0; i < 4; i++) {\n\t\tch = gdGetC (in);\n\t\tif (ch == EOF) {\n\t\t\tgoto fail1;\n\t\t};\n\t\tid[i] = ch;\n\t};\n\tid[4] = 0;\n\n\tGD2_DBG (printf (\"Got file code: %s\\n\", id));\n\n\t/* Equiv. of 'magick'. */\n\tif (strcmp (id, GD2_ID) != 0) {\n\t\tGD2_DBG (printf (\"Not a valid gd2 file\\n\"));\n\t\tgoto fail1;\n\t};\n\n\t/* Version */\n\tif (gdGetWord (vers, in) != 1) {\n\t\tgoto fail1;\n\t};\n\tGD2_DBG (printf (\"Version: %d\\n\", *vers));\n\n\tif ((*vers != 1) && (*vers != 2)) {\n\t\tGD2_DBG (printf (\"Bad version: %d\\n\", *vers));\n\t\tgoto fail1;\n\t};\n\n\t/* Image Size */\n\tif (!gdGetWord (sx, in)) {\n\t\tGD2_DBG (printf (\"Could not get x-size\\n\"));\n\t\tgoto fail1;\n\t}\n\tif (!gdGetWord (sy, in)) {\n\t\tGD2_DBG (printf (\"Could not get y-size\\n\"));\n\t\tgoto fail1;\n\t}\n\tGD2_DBG (printf (\"Image is %dx%d\\n\", *sx, *sy));\n\n\t/* Chunk Size (pixels, not bytes!) */\n\tif (gdGetWord (cs, in) != 1) {\n\t\tgoto fail1;\n\t};\n\tGD2_DBG (printf (\"ChunkSize: %d\\n\", *cs));\n\n\tif ((*cs < GD2_CHUNKSIZE_MIN) || (*cs > GD2_CHUNKSIZE_MAX)) {\n\t\tGD2_DBG (printf (\"Bad chunk size: %d\\n\", *cs));\n\t\tgoto fail1;\n\t};\n\n\t/* Data Format */\n\tif (gdGetWord (fmt, in) != 1) {\n\t\tgoto fail1;\n\t};\n\tGD2_DBG (printf (\"Format: %d\\n\", *fmt));\n\n\tif ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED) &&\n\t (*fmt != GD2_FMT_TRUECOLOR_RAW) &&\n\t (*fmt != GD2_FMT_TRUECOLOR_COMPRESSED)) {\n\t\tGD2_DBG (printf (\"Bad data format: %d\\n\", *fmt));\n\t\tgoto fail1;\n\t};\n\n\n\t/* # of chunks wide */\n\tif (gdGetWord (ncx, in) != 1) {\n\t\tgoto fail1;\n\t};\n\tGD2_DBG (printf (\"%d Chunks Wide\\n\", *ncx));\n\n\t/* # of chunks high */\n\tif (gdGetWord (ncy, in) != 1) {\n\t\tgoto fail1;\n\t};\n \tGD2_DBG (printf (\"%d Chunks vertically\\n\", *ncy));\n \n \tif (gd2_compressed (*fmt)) {\n \t\tnc = (*ncx) * (*ncy);\n \n \t\tGD2_DBG (printf (\"Reading %d chunk index entries\\n\", nc));\n\t\tif (overflow2(sizeof(t_chunk_info), nc)) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tsidx = sizeof (t_chunk_info) * nc;\n\t\tif (sidx <= 0) {\n\t\t\tgoto fail1;\n\t\t}\n\n\t\tcidx = gdCalloc (sidx, 1);\n\t\tif (cidx == NULL) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tfor (i = 0; i < nc; i++) {\n\t\t\tif (gdGetInt (&cidx[i].offset, in) != 1) {\n\t\t\t\tgoto fail2;\n\t\t\t};\n\t\t\tif (gdGetInt (&cidx[i].size, in) != 1) {\n\t\t\t\tgoto fail2;\n\t\t\t};\n\t\t\tif (cidx[i].offset < 0 || cidx[i].size < 0)\n\t\t\t\tgoto fail2;\n\t\t};\n\t\t*chunkIdx = cidx;\n\t};\n\n\tGD2_DBG (printf (\"gd2 header complete\\n\"));\n\n\treturn 1;\nfail2:\n\tgdFree(cidx);\nfail1:\n\treturn 0;\n}\n", + "target": "_gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,\n int *cs, int *vers, int *fmt, int *ncx, int *ncy,\n t_chunk_info ** chunkIdx)\n{\n\tint i;\n\tint ch;\n\tchar id[5];\n\tt_chunk_info *cidx;\n\tint sidx;\n\tint nc;\n\n\tGD2_DBG (printf (\"Reading gd2 header info\\n\"));\n\n\tfor (i = 0; i < 4; i++) {\n\t\tch = gdGetC (in);\n\t\tif (ch == EOF) {\n\t\t\tgoto fail1;\n\t\t};\n\t\tid[i] = ch;\n\t};\n\tid[4] = 0;\n\n\tGD2_DBG (printf (\"Got file code: %s\\n\", id));\n\n\t/* Equiv. of 'magick'. */\n\tif (strcmp (id, GD2_ID) != 0) {\n\t\tGD2_DBG (printf (\"Not a valid gd2 file\\n\"));\n\t\tgoto fail1;\n\t};\n\n\t/* Version */\n\tif (gdGetWord (vers, in) != 1) {\n\t\tgoto fail1;\n\t};\n\tGD2_DBG (printf (\"Version: %d\\n\", *vers));\n\n\tif ((*vers != 1) && (*vers != 2)) {\n\t\tGD2_DBG (printf (\"Bad version: %d\\n\", *vers));\n\t\tgoto fail1;\n\t};\n\n\t/* Image Size */\n\tif (!gdGetWord (sx, in)) {\n\t\tGD2_DBG (printf (\"Could not get x-size\\n\"));\n\t\tgoto fail1;\n\t}\n\tif (!gdGetWord (sy, in)) {\n\t\tGD2_DBG (printf (\"Could not get y-size\\n\"));\n\t\tgoto fail1;\n\t}\n\tGD2_DBG (printf (\"Image is %dx%d\\n\", *sx, *sy));\n\n\t/* Chunk Size (pixels, not bytes!) */\n\tif (gdGetWord (cs, in) != 1) {\n\t\tgoto fail1;\n\t};\n\tGD2_DBG (printf (\"ChunkSize: %d\\n\", *cs));\n\n\tif ((*cs < GD2_CHUNKSIZE_MIN) || (*cs > GD2_CHUNKSIZE_MAX)) {\n\t\tGD2_DBG (printf (\"Bad chunk size: %d\\n\", *cs));\n\t\tgoto fail1;\n\t};\n\n\t/* Data Format */\n\tif (gdGetWord (fmt, in) != 1) {\n\t\tgoto fail1;\n\t};\n\tGD2_DBG (printf (\"Format: %d\\n\", *fmt));\n\n\tif ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED) &&\n\t (*fmt != GD2_FMT_TRUECOLOR_RAW) &&\n\t (*fmt != GD2_FMT_TRUECOLOR_COMPRESSED)) {\n\t\tGD2_DBG (printf (\"Bad data format: %d\\n\", *fmt));\n\t\tgoto fail1;\n\t};\n\n\n\t/* # of chunks wide */\n\tif (gdGetWord (ncx, in) != 1) {\n\t\tgoto fail1;\n\t};\n\tGD2_DBG (printf (\"%d Chunks Wide\\n\", *ncx));\n\n\t/* # of chunks high */\n\tif (gdGetWord (ncy, in) != 1) {\n\t\tgoto fail1;\n\t};\n \tGD2_DBG (printf (\"%d Chunks vertically\\n\", *ncy));\n \n \tif (gd2_compressed (*fmt)) {\n\t\tif (*ncx <= 0 || *ncy <= 0 || *ncx > INT_MAX / *ncy) {\n\t\t\tGD2_DBG(printf (\"Illegal chunk counts: %d * %d\\n\", *ncx, *ncy));\n\t\t\tgoto fail1;\n\t\t}\n \t\tnc = (*ncx) * (*ncy);\n \n \t\tGD2_DBG (printf (\"Reading %d chunk index entries\\n\", nc));\n\t\tif (overflow2(sizeof(t_chunk_info), nc)) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tsidx = sizeof (t_chunk_info) * nc;\n\t\tif (sidx <= 0) {\n\t\t\tgoto fail1;\n\t\t}\n\n\t\tcidx = gdCalloc (sidx, 1);\n\t\tif (cidx == NULL) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tfor (i = 0; i < nc; i++) {\n\t\t\tif (gdGetInt (&cidx[i].offset, in) != 1) {\n\t\t\t\tgoto fail2;\n\t\t\t};\n\t\t\tif (gdGetInt (&cidx[i].size, in) != 1) {\n\t\t\t\tgoto fail2;\n\t\t\t};\n\t\t\tif (cidx[i].offset < 0 || cidx[i].size < 0)\n\t\t\t\tgoto fail2;\n\t\t};\n\t\t*chunkIdx = cidx;\n\t};\n\n\tGD2_DBG (printf (\"gd2 header complete\\n\"));\n\n\treturn 1;\nfail2:\n\tgdFree(cidx);\nfail1:\n\treturn 0;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#88223c5245e9b470e1e6362bfd96829562ffe6ab", + "input": "SPL_METHOD(Array, unserialize)\n{\n\tspl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);\n\n\tchar *buf;\n\tint buf_len;\n\tconst unsigned char *p, *s;\n\tphp_unserialize_data_t var_hash;\n\tzval *pmembers, *pflags = NULL;\n\tlong flags;\n\t\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &buf, &buf_len) == FAILURE) {\n\t\treturn;\n\t}\n\n\tif (buf_len == 0) {\n\t\tzend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, \"Empty serialized string cannot be empty\");\n\t\treturn;\n\t}\n\n\t/* storage */\n\ts = p = (const unsigned char*)buf;\n\tPHP_VAR_UNSERIALIZE_INIT(var_hash);\n\n\tif (*p!= 'x' || *++p != ':') {\n\t\tgoto outexcept;\n\t}\n\t++p;\n\n\tALLOC_INIT_ZVAL(pflags);\n\tif (!php_var_unserialize(&pflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE_P(pflags) != IS_LONG) {\n\t\tzval_ptr_dtor(&pflags);\n\t\tgoto outexcept;\n\t}\n\n\t--p; /* for ';' */\n\tflags = Z_LVAL_P(pflags);\n\tzval_ptr_dtor(&pflags);\n\t/* flags needs to be verified and we also need to verify whether the next\n\t * thing we get is ';'. After that we require an 'm' or somethign else\n\t * where 'm' stands for members and anything else should be an array. If\n\t * neither 'a' or 'm' follows we have an error. */\n\n\tif (*p != ';') {\n\t\tgoto outexcept;\n\t}\n\t++p;\n\n\tif (*p!='m') {\n\t\tif (*p!='a' && *p!='O' && *p!='C' && *p!='r') {\n\t\t\tgoto outexcept;\n\t\t}\n\t\tintern->ar_flags &= ~SPL_ARRAY_CLONE_MASK;\n\t\tintern->ar_flags |= flags & SPL_ARRAY_CLONE_MASK;\n\t\tzval_ptr_dtor(&intern->array);\n\t\tALLOC_INIT_ZVAL(intern->array);\n\t\tif (!php_var_unserialize(&intern->array, &p, s + buf_len, &var_hash TSRMLS_CC)) {\n\t\t\tgoto outexcept;\n\t\t}\n\t}\n\tif (*p != ';') {\n\t\tgoto outexcept;\n\t}\n\t++p;\n\n\t/* members */\n\tif (*p!= 'm' || *++p != ':') {\n\t\tgoto outexcept;\n\t}\n ++p;\n \n ALLOC_INIT_ZVAL(pmembers);\n if (!php_var_unserialize(&pmembers, &p, s + buf_len, &var_hash TSRMLS_CC)) {\n zval_ptr_dtor(&pmembers);\n goto outexcept;\n }\n\n\t/* copy members */\n\tif (!intern->std.properties) {\n\t\trebuild_object_properties(&intern->std);\n\t}\n\tzend_hash_copy(intern->std.properties, Z_ARRVAL_P(pmembers), (copy_ctor_func_t) zval_add_ref, (void *) NULL, sizeof(zval *));\n\tzval_ptr_dtor(&pmembers);\n\n\t/* done reading $serialized */\n\n\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\treturn;\n\noutexcept:\n\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\tzend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, \"Error at offset %ld of %d bytes\", (long)((char*)p - buf), buf_len);\n\treturn;\n\n} /* }}} */\n\n/* {{{ arginfo and function tbale */\n", + "target": "SPL_METHOD(Array, unserialize)\n{\n\tspl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);\n\n\tchar *buf;\n\tint buf_len;\n\tconst unsigned char *p, *s;\n\tphp_unserialize_data_t var_hash;\n\tzval *pmembers, *pflags = NULL;\n\tlong flags;\n\t\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &buf, &buf_len) == FAILURE) {\n\t\treturn;\n\t}\n\n\tif (buf_len == 0) {\n\t\tzend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, \"Empty serialized string cannot be empty\");\n\t\treturn;\n\t}\n\n\t/* storage */\n\ts = p = (const unsigned char*)buf;\n\tPHP_VAR_UNSERIALIZE_INIT(var_hash);\n\n\tif (*p!= 'x' || *++p != ':') {\n\t\tgoto outexcept;\n\t}\n\t++p;\n\n\tALLOC_INIT_ZVAL(pflags);\n\tif (!php_var_unserialize(&pflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE_P(pflags) != IS_LONG) {\n\t\tzval_ptr_dtor(&pflags);\n\t\tgoto outexcept;\n\t}\n\n\t--p; /* for ';' */\n\tflags = Z_LVAL_P(pflags);\n\tzval_ptr_dtor(&pflags);\n\t/* flags needs to be verified and we also need to verify whether the next\n\t * thing we get is ';'. After that we require an 'm' or somethign else\n\t * where 'm' stands for members and anything else should be an array. If\n\t * neither 'a' or 'm' follows we have an error. */\n\n\tif (*p != ';') {\n\t\tgoto outexcept;\n\t}\n\t++p;\n\n\tif (*p!='m') {\n\t\tif (*p!='a' && *p!='O' && *p!='C' && *p!='r') {\n\t\t\tgoto outexcept;\n\t\t}\n\t\tintern->ar_flags &= ~SPL_ARRAY_CLONE_MASK;\n\t\tintern->ar_flags |= flags & SPL_ARRAY_CLONE_MASK;\n\t\tzval_ptr_dtor(&intern->array);\n\t\tALLOC_INIT_ZVAL(intern->array);\n\t\tif (!php_var_unserialize(&intern->array, &p, s + buf_len, &var_hash TSRMLS_CC)) {\n\t\t\tgoto outexcept;\n\t\t}\n\t}\n\tif (*p != ';') {\n\t\tgoto outexcept;\n\t}\n\t++p;\n\n\t/* members */\n\tif (*p!= 'm' || *++p != ':') {\n\t\tgoto outexcept;\n\t}\n ++p;\n \n ALLOC_INIT_ZVAL(pmembers);\n if (!php_var_unserialize(&pmembers, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE_P(pmembers) != IS_ARRAY) {\n zval_ptr_dtor(&pmembers);\n goto outexcept;\n }\n\n\t/* copy members */\n\tif (!intern->std.properties) {\n\t\trebuild_object_properties(&intern->std);\n\t}\n\tzend_hash_copy(intern->std.properties, Z_ARRVAL_P(pmembers), (copy_ctor_func_t) zval_add_ref, (void *) NULL, sizeof(zval *));\n\tzval_ptr_dtor(&pmembers);\n\n\t/* done reading $serialized */\n\n\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\treturn;\n\noutexcept:\n\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\tzend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, \"Error at offset %ld of %d bytes\", (long)((char*)p - buf), buf_len);\n\treturn;\n\n} /* }}} */\n\n/* {{{ arginfo and function tbale */\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7f8cdab6fda192d15e45a3e9682b1eec427870c5", + "input": " void ShellWindowFrameView::Layout() {\n gfx::Size close_size = close_button_->GetPreferredSize();\n int closeButtonOffsetY =\n (kCaptionHeight - close_size.height()) / 2;\n int closeButtonOffsetX = closeButtonOffsetY;\n close_button_->SetBounds(\n width() - closeButtonOffsetX - close_size.width(),\n closeButtonOffsetY,\n close_size.width(),\n close_size.height());\n }\n", + "target": " void ShellWindowFrameView::Layout() {\n if (is_frameless_)\n return;\n gfx::Size close_size = close_button_->GetPreferredSize();\n int closeButtonOffsetY =\n (kCaptionHeight - close_size.height()) / 2;\n int closeButtonOffsetX = closeButtonOffsetY;\n close_button_->SetBounds(\n width() - closeButtonOffsetX - close_size.width(),\n closeButtonOffsetY,\n close_size.width(),\n close_size.height());\n }\n", + "vul_type": "cwe-79", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#430403b0029b37decf216d57f810899cab2317dd", + "input": "static void ImportCbYCrYQuantum(const Image *image,QuantumInfo *quantum_info,\n const MagickSizeType number_pixels,const unsigned char *magick_restrict p,\n Quantum *magick_restrict q,ExceptionInfo *exception)\n{\n QuantumAny\n range;\n\n register ssize_t\n x;\n\n unsigned int\n pixel;\n\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n switch (quantum_info->depth)\n {\n case 10:\n {\n Quantum\n cbcr[4];\n\n pixel=0;\n if (quantum_info->pack == MagickFalse)\n {\n register ssize_t\n i;\n\n size_t\n quantum;\n\n ssize_t\n n;\n \n n=0;\n quantum=0;\n for (x=0; x < (ssize_t) number_pixels; x+=2)\n {\n for (i=0; i < 4; i++)\n {\n switch (n % 3)\n {\n case 0:\n {\n p=PushLongPixel(quantum_info->endian,p,&pixel);\n quantum=(size_t) (ScaleShortToQuantum((unsigned short)\n (((pixel >> 22) & 0x3ff) << 6)));\n break;\n }\n case 1:\n {\n quantum=(size_t) (ScaleShortToQuantum((unsigned short)\n (((pixel >> 12) & 0x3ff) << 6)));\n break;\n }\n case 2:\n {\n quantum=(size_t) (ScaleShortToQuantum((unsigned short)\n (((pixel >> 2) & 0x3ff) << 6)));\n break;\n }\n }\n cbcr[i]=(Quantum) (quantum);\n n++;\n }\n p+=quantum_info->pad;\n SetPixelRed(image,cbcr[1],q);\n SetPixelGreen(image,cbcr[0],q);\n SetPixelBlue(image,cbcr[2],q);\n q+=GetPixelChannels(image);\n SetPixelRed(image,cbcr[3],q);\n SetPixelGreen(image,cbcr[0],q);\n SetPixelBlue(image,cbcr[2],q);\n q+=GetPixelChannels(image);\n }\n break;\n }\n }\n default:\n {\n range=GetQuantumRange(quantum_info->depth);\n for (x=0; x < (ssize_t) number_pixels; x++)\n {\n p=PushQuantumPixel(quantum_info,p,&pixel);\n SetPixelRed(image,ScaleAnyToQuantum(pixel,range),q);\n p=PushQuantumPixel(quantum_info,p,&pixel);\n SetPixelGreen(image,ScaleAnyToQuantum(pixel,range),q);\n q+=GetPixelChannels(image);\n }\n break;\n }\n }\n}\n", + "target": "static void ImportCbYCrYQuantum(const Image *image,QuantumInfo *quantum_info,\n const MagickSizeType number_pixels,const unsigned char *magick_restrict p,\n Quantum *magick_restrict q,ExceptionInfo *exception)\n{\n QuantumAny\n range;\n\n register ssize_t\n x;\n\n unsigned int\n pixel;\n\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n switch (quantum_info->depth)\n {\n case 10:\n {\n Quantum\n cbcr[4];\n\n pixel=0;\n if (quantum_info->pack == MagickFalse)\n {\n register ssize_t\n i;\n\n size_t\n quantum;\n\n ssize_t\n n;\n \n n=0;\n quantum=0;\n for (x=0; x < (ssize_t) number_pixels; x+=4)\n {\n for (i=0; i < 4; i++)\n {\n switch (n % 3)\n {\n case 0:\n {\n p=PushLongPixel(quantum_info->endian,p,&pixel);\n quantum=(size_t) (ScaleShortToQuantum((unsigned short)\n (((pixel >> 22) & 0x3ff) << 6)));\n break;\n }\n case 1:\n {\n quantum=(size_t) (ScaleShortToQuantum((unsigned short)\n (((pixel >> 12) & 0x3ff) << 6)));\n break;\n }\n case 2:\n {\n quantum=(size_t) (ScaleShortToQuantum((unsigned short)\n (((pixel >> 2) & 0x3ff) << 6)));\n break;\n }\n }\n cbcr[i]=(Quantum) (quantum);\n n++;\n }\n p+=quantum_info->pad;\n SetPixelRed(image,cbcr[1],q);\n SetPixelGreen(image,cbcr[0],q);\n SetPixelBlue(image,cbcr[2],q);\n q+=GetPixelChannels(image);\n SetPixelRed(image,cbcr[3],q);\n SetPixelGreen(image,cbcr[0],q);\n SetPixelBlue(image,cbcr[2],q);\n q+=GetPixelChannels(image);\n }\n break;\n }\n }\n default:\n {\n range=GetQuantumRange(quantum_info->depth);\n for (x=0; x < (ssize_t) number_pixels; x++)\n {\n p=PushQuantumPixel(quantum_info,p,&pixel);\n SetPixelRed(image,ScaleAnyToQuantum(pixel,range),q);\n p=PushQuantumPixel(quantum_info,p,&pixel);\n SetPixelGreen(image,ScaleAnyToQuantum(pixel,range),q);\n q+=GetPixelChannels(image);\n }\n break;\n }\n }\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24", + "input": "static int ExecuteSQL( SQLHDBC hDbc, char *szSQL, char cDelimiter, int bColumnNames, int bHTMLTable )\n{\n SQLHSTMT hStmt;\n SQLTCHAR szSepLine[32001]; \n SQLTCHAR szUcSQL[32001]; \n SQLSMALLINT cols;\n SQLINTEGER ret;\n SQLLEN nRows = 0;\n\n szSepLine[ 0 ] = 0;\n\n ansi_to_unicode( szSQL, szUcSQL );\n\n /****************************\n * EXECUTE SQL\n ***************************/\n if ( SQLAllocStmt( hDbc, &hStmt ) != SQL_SUCCESS )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, 0 );\n fprintf( stderr, \"[ISQL]ERROR: Could not SQLAllocStmt\\n\" );\n return 0;\n }\n\n if ( buseED ) {\n ret = SQLExecDirect( hStmt, szUcSQL, SQL_NTS );\n\n if ( ret == SQL_NO_DATA )\n {\n fprintf( stderr, \"[ISQL]INFO: SQLExecDirect returned SQL_NO_DATA\\n\" );\n }\n else if ( ret == SQL_SUCCESS_WITH_INFO )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]INFO: SQLExecDirect returned SQL_SUCCESS_WITH_INFO\\n\" );\n }\n else if ( ret != SQL_SUCCESS )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]ERROR: Could not SQLExecDirect\\n\" );\n SQLFreeStmt( hStmt, SQL_DROP );\n free(szSepLine);\n return 0;\n }\n }\n else {\n if ( SQLPrepare( hStmt, szUcSQL, SQL_NTS ) != SQL_SUCCESS )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]ERROR: Could not SQLPrepare\\n\" );\n SQLFreeStmt( hStmt, SQL_DROP );\n return 0;\n }\n \n ret = SQLExecute( hStmt );\n \n if ( ret == SQL_NO_DATA )\n {\n fprintf( stderr, \"[ISQL]INFO: SQLExecute returned SQL_NO_DATA\\n\" );\n }\n else if ( ret == SQL_SUCCESS_WITH_INFO )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]INFO: SQLExecute returned SQL_SUCCESS_WITH_INFO\\n\" );\n }\n else if ( ret != SQL_SUCCESS )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]ERROR: Could not SQLExecute\\n\" );\n SQLFreeStmt( hStmt, SQL_DROP );\n return 0;\n }\n }\n\n do \n {\n /*\n * check to see if it has generated a result set\n */\n\n if ( SQLNumResultCols( hStmt, &cols ) != SQL_SUCCESS )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]ERROR: Could not SQLNumResultCols\\n\" );\n SQLFreeStmt( hStmt, SQL_DROP );\n return 0;\n }\n\n if ( cols > 0 )\n {\n /****************************\n * WRITE HEADER\n ***************************/\n if ( bHTMLTable )\n WriteHeaderHTMLTable( hStmt );\n else if ( cDelimiter == 0 )\n UWriteHeaderNormal( hStmt, szSepLine );\n else if ( cDelimiter && bColumnNames )\n WriteHeaderDelimited( hStmt, cDelimiter );\n\n /****************************\n * WRITE BODY\n ***************************/\n if ( bHTMLTable )\n WriteBodyHTMLTable( hStmt );\n else if ( cDelimiter == 0 )\n nRows = WriteBodyNormal( hStmt );\n else\n WriteBodyDelimited( hStmt, cDelimiter );\n }\n\n /****************************\n * WRITE FOOTER\n ***************************/\n if ( bHTMLTable )\n WriteFooterHTMLTable( hStmt );\n else if ( cDelimiter == 0 )\n UWriteFooterNormal( hStmt, szSepLine, nRows );\n }\n while ( SQL_SUCCEEDED( SQLMoreResults( hStmt )));\n\n /****************************\n * CLEANUP\n ***************************/\n SQLFreeStmt( hStmt, SQL_DROP );\n\n return 1;\n}\n", + "target": "static int ExecuteSQL( SQLHDBC hDbc, char *szSQL, char cDelimiter, int bColumnNames, int bHTMLTable )\n{\n SQLHSTMT hStmt;\n SQLTCHAR szSepLine[32001]; \n SQLTCHAR szUcSQL[32001]; \n SQLSMALLINT cols;\n SQLINTEGER ret;\n SQLLEN nRows = 0;\n\n szSepLine[ 0 ] = 0;\n\n ansi_to_unicode( szSQL, szUcSQL );\n\n /****************************\n * EXECUTE SQL\n ***************************/\n if ( SQLAllocStmt( hDbc, &hStmt ) != SQL_SUCCESS )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, 0 );\n fprintf( stderr, \"[ISQL]ERROR: Could not SQLAllocStmt\\n\" );\n return 0;\n }\n\n if ( buseED ) {\n ret = SQLExecDirect( hStmt, szUcSQL, SQL_NTS );\n\n if ( ret == SQL_NO_DATA )\n {\n fprintf( stderr, \"[ISQL]INFO: SQLExecDirect returned SQL_NO_DATA\\n\" );\n }\n else if ( ret == SQL_SUCCESS_WITH_INFO )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]INFO: SQLExecDirect returned SQL_SUCCESS_WITH_INFO\\n\" );\n }\n else if ( ret != SQL_SUCCESS )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]ERROR: Could not SQLExecDirect\\n\" );\n SQLFreeStmt( hStmt, SQL_DROP );\n return 0;\n }\n }\n else {\n if ( SQLPrepare( hStmt, szUcSQL, SQL_NTS ) != SQL_SUCCESS )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]ERROR: Could not SQLPrepare\\n\" );\n SQLFreeStmt( hStmt, SQL_DROP );\n return 0;\n }\n \n ret = SQLExecute( hStmt );\n \n if ( ret == SQL_NO_DATA )\n {\n fprintf( stderr, \"[ISQL]INFO: SQLExecute returned SQL_NO_DATA\\n\" );\n }\n else if ( ret == SQL_SUCCESS_WITH_INFO )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]INFO: SQLExecute returned SQL_SUCCESS_WITH_INFO\\n\" );\n }\n else if ( ret != SQL_SUCCESS )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]ERROR: Could not SQLExecute\\n\" );\n SQLFreeStmt( hStmt, SQL_DROP );\n return 0;\n }\n }\n\n do \n {\n /*\n * check to see if it has generated a result set\n */\n\n if ( SQLNumResultCols( hStmt, &cols ) != SQL_SUCCESS )\n {\n if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );\n fprintf( stderr, \"[ISQL]ERROR: Could not SQLNumResultCols\\n\" );\n SQLFreeStmt( hStmt, SQL_DROP );\n return 0;\n }\n\n if ( cols > 0 )\n {\n /****************************\n * WRITE HEADER\n ***************************/\n if ( bHTMLTable )\n WriteHeaderHTMLTable( hStmt );\n else if ( cDelimiter == 0 )\n UWriteHeaderNormal( hStmt, szSepLine );\n else if ( cDelimiter && bColumnNames )\n WriteHeaderDelimited( hStmt, cDelimiter );\n\n /****************************\n * WRITE BODY\n ***************************/\n if ( bHTMLTable )\n WriteBodyHTMLTable( hStmt );\n else if ( cDelimiter == 0 )\n nRows = WriteBodyNormal( hStmt );\n else\n WriteBodyDelimited( hStmt, cDelimiter );\n }\n\n /****************************\n * WRITE FOOTER\n ***************************/\n if ( bHTMLTable )\n WriteFooterHTMLTable( hStmt );\n else if ( cDelimiter == 0 )\n UWriteFooterNormal( hStmt, szSepLine, nRows );\n }\n while ( SQL_SUCCEEDED( SQLMoreResults( hStmt )));\n\n /****************************\n * CLEANUP\n ***************************/\n SQLFreeStmt( hStmt, SQL_DROP );\n\n return 1;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d1442d85cc30ea75f7d399474ca738e0bc96f715", + "input": "static int em_call_far(struct x86_emulate_ctxt *ctxt)\n{\n \tu16 sel, old_cs;\n \tulong old_eip;\n \tint rc;\n \n\told_cs = get_segment_selector(ctxt, VCPU_SREG_CS);\n \told_eip = ctxt->_eip;\n \n \tmemcpy(&sel, ctxt->src.valptr + ctxt->op_bytes, 2);\n\tif (load_segment_descriptor(ctxt, sel, VCPU_SREG_CS))\n \t\treturn X86EMUL_CONTINUE;\n \n\tctxt->_eip = 0;\n\tmemcpy(&ctxt->_eip, ctxt->src.valptr, ctxt->op_bytes);\n \n \tctxt->src.val = old_cs;\n \trc = em_push(ctxt);\n \tif (rc != X86EMUL_CONTINUE)\n\t\treturn rc;\n \n \tctxt->src.val = old_eip;\n\treturn em_push(ctxt);\n }\n", + "target": "static int em_call_far(struct x86_emulate_ctxt *ctxt)\n{\n \tu16 sel, old_cs;\n \tulong old_eip;\n \tint rc;\n\tstruct desc_struct old_desc, new_desc;\n\tconst struct x86_emulate_ops *ops = ctxt->ops;\n\tint cpl = ctxt->ops->cpl(ctxt);\n \n \told_eip = ctxt->_eip;\n\tops->get_segment(ctxt, &old_cs, &old_desc, NULL, VCPU_SREG_CS);\n \n \tmemcpy(&sel, ctxt->src.valptr + ctxt->op_bytes, 2);\n\trc = __load_segment_descriptor(ctxt, sel, VCPU_SREG_CS, cpl, false,\n\t\t\t\t &new_desc);\n\tif (rc != X86EMUL_CONTINUE)\n \t\treturn X86EMUL_CONTINUE;\n \n\trc = assign_eip_far(ctxt, ctxt->src.val, new_desc.l);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto fail;\n \n \tctxt->src.val = old_cs;\n \trc = em_push(ctxt);\n \tif (rc != X86EMUL_CONTINUE)\n\t\tgoto fail;\n \n \tctxt->src.val = old_eip;\n\trc = em_push(ctxt);\n\t/* If we failed, we tainted the memory, but the very least we should\n\t restore cs */\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto fail;\n\treturn rc;\nfail:\n\tops->set_segment(ctxt, old_cs, &old_desc, 0, VCPU_SREG_CS);\n\treturn rc;\n\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ab5e55ff333def909d025ac45da9ffa0d88a63f2", + "input": "PassRefPtr RTCSessionDescriptionRequestImpl::create(ScriptExecutionContext* context, PassRefPtr successCallback, PassRefPtr errorCallback)\n {\n RefPtr request = adoptRef(new RTCSessionDescriptionRequestImpl(context, successCallback, errorCallback));\n request->suspendIfNeeded();\n return request.release();\n }\n", + "target": "PassRefPtr RTCSessionDescriptionRequestImpl::create(ScriptExecutionContext* context, PassRefPtr successCallback, PassRefPtr errorCallback)\nPassRefPtr RTCSessionDescriptionRequestImpl::create(ScriptExecutionContext* context, PassRefPtr successCallback, PassRefPtr errorCallback, PassRefPtr owner)\n {\n RefPtr request = adoptRef(new RTCSessionDescriptionRequestImpl(context, successCallback, errorCallback, owner));\n request->suspendIfNeeded();\n return request.release();\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4da7eefcaad044a6f919947a2a0e3d4fed87834c", + "input": " void copyFromTexture(uint32_t texture, const IntRect& sourceRect)\n {\n makeCurrent();\n int x = sourceRect.x();\n int y = sourceRect.y();\n int width = sourceRect.width();\n int height = sourceRect.height();\n\n glPushAttrib(GL_ALL_ATTRIB_BITS);\n GLint previousFBO;\n glGetIntegerv(GL_FRAMEBUFFER_BINDING, &previousFBO);\n\n GLuint originFBO;\n pGlGenFramebuffers(1, &originFBO);\n pGlBindFramebuffer(GL_READ_FRAMEBUFFER, originFBO);\n glBindTexture(GL_TEXTURE_2D, texture);\n pGlFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);\n \n#if PLATFORM(QT)\n pGlBindFramebuffer(GL_DRAW_FRAMEBUFFER, glContext()->defaultFramebufferObject());\n#elif PLATFORM(EFL)\n pGlBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);\n#endif\n pGlBlitFramebuffer(x, y, width, height, x, y, width, height, GL_COLOR_BUFFER_BIT, GL_LINEAR);\n \n pGlFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);\n glBindTexture(GL_TEXTURE_2D, 0);\n pGlBindFramebuffer(GL_FRAMEBUFFER, previousFBO);\n pGlDeleteFramebuffers(1, &originFBO);\n\n glPopAttrib();\n doneCurrent();\n }\n", + "target": " void copyFromTexture(uint32_t texture, const IntRect& sourceRect)\n {\n makeCurrent();\n int x = sourceRect.x();\n int y = sourceRect.y();\n int width = sourceRect.width();\n int height = sourceRect.height();\n\n glPushAttrib(GL_ALL_ATTRIB_BITS);\n GLint previousFBO;\n glGetIntegerv(GL_FRAMEBUFFER_BINDING, &previousFBO);\n\n GLuint originFBO;\n pGlGenFramebuffers(1, &originFBO);\n pGlBindFramebuffer(GL_READ_FRAMEBUFFER, originFBO);\n glBindTexture(GL_TEXTURE_2D, texture);\n pGlFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);\n \n pGlBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);\n pGlBlitFramebuffer(x, y, width, height, x, y, width, height, GL_COLOR_BUFFER_BIT, GL_LINEAR);\n \n pGlFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);\n glBindTexture(GL_TEXTURE_2D, 0);\n pGlBindFramebuffer(GL_FRAMEBUFFER, previousFBO);\n pGlDeleteFramebuffers(1, &originFBO);\n\n glPopAttrib();\n doneCurrent();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#70340ce072cee8a0bdcddb5f312d32567b2269f6", + "input": " H264PictureToVaapiDecodeSurface(const scoped_refptr& pic) {\n VaapiH264Picture* vaapi_pic = pic->AsVaapiH264Picture();\n CHECK(vaapi_pic);\n return vaapi_pic->dec_surface();\n}\n", + "target": " H264PictureToVaapiDecodeSurface(const scoped_refptr& pic) {\n DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);\n VaapiH264Picture* vaapi_pic = pic->AsVaapiH264Picture();\n CHECK(vaapi_pic);\n return vaapi_pic->dec_surface();\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9f9ba255a0c59544f3555c9c45512c3a2fac5fad", + "input": "bool SoftVPX::outputBufferSafe(OMX_BUFFERHEADERTYPE *outHeader) {\n uint32_t width = outputBufferWidth();\n uint32_t height = outputBufferHeight();\n\n uint64_t nFilledLen = width;\n nFilledLen *= height;\n if (nFilledLen > UINT32_MAX / 3) {\n ALOGE(\"b/29421675, nFilledLen overflow %llu w %u h %u\", nFilledLen, width, height);\n android_errorWriteLog(0x534e4554, \"29421675\");\n return false;\n } else if (outHeader->nAllocLen < outHeader->nFilledLen) {\n ALOGE(\"b/27597103, buffer too small\");\n android_errorWriteLog(0x534e4554, \"27597103\");\n return false;\n }\n\n return true;\n}\n", + "target": "bool SoftVPX::outputBufferSafe(OMX_BUFFERHEADERTYPE *outHeader) {\n uint32_t width = outputBufferWidth();\n uint32_t height = outputBufferHeight();\n\n uint64_t nFilledLen = width;\n nFilledLen *= height;\n if (nFilledLen > UINT32_MAX / 3) {\n ALOGE(\"b/29421675, nFilledLen overflow %llu w %u h %u\",\n (unsigned long long)nFilledLen, width, height);\n android_errorWriteLog(0x534e4554, \"29421675\");\n return false;\n } else if (outHeader->nAllocLen < outHeader->nFilledLen) {\n ALOGE(\"b/27597103, buffer too small\");\n android_errorWriteLog(0x534e4554, \"27597103\");\n return false;\n }\n\n return true;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9d4853418ab2f754c2b63e091c29c5529b8b86ca", + "input": "perform_gamma_threshold_tests(png_modifier *pm)\n{\n png_byte colour_type = 0;\n png_byte bit_depth = 0;\n unsigned int palette_number = 0;\n\n\n /* Don't test more than one instance of each palette - it's pointless, in\n * fact this test is somewhat excessive since libpng doesn't make this\n * decision based on colour type or bit depth!\n */\n while (next_format(&colour_type, &bit_depth, &palette_number, 1/*gamma*/))\n if (palette_number == 0)\n {\n double test_gamma = 1.0;\n while (test_gamma >= .4)\n {\n /* There's little point testing the interlacing vs non-interlacing,\n * but this can be set from the command line.\n */\n gamma_threshold_test(pm, colour_type, bit_depth, pm->interlace_type,\n test_gamma, 1/test_gamma);\n test_gamma *= .95;\n }\n\n /* And a special test for sRGB */\n gamma_threshold_test(pm, colour_type, bit_depth, pm->interlace_type,\n .45455, 2.2);\n\n if (fail(pm))\n return;\n }\n\n }\n", + "target": "perform_gamma_threshold_tests(png_modifier *pm)\n{\n png_byte colour_type = 0;\n png_byte bit_depth = 0;\n unsigned int palette_number = 0;\n\n\n /* Don't test more than one instance of each palette - it's pointless, in\n * fact this test is somewhat excessive since libpng doesn't make this\n * decision based on colour type or bit depth!\n *\n * CHANGED: now test two palettes and, as a side effect, images with and\n * without tRNS.\n */\n while (next_format(&colour_type, &bit_depth, &palette_number,\n pm->test_lbg_gamma_threshold, pm->test_tRNS))\n if (palette_number < 2)\n {\n double test_gamma = 1.0;\n while (test_gamma >= .4)\n {\n /* There's little point testing the interlacing vs non-interlacing,\n * but this can be set from the command line.\n */\n gamma_threshold_test(pm, colour_type, bit_depth, pm->interlace_type,\n test_gamma, 1/test_gamma);\n test_gamma *= .95;\n }\n\n /* And a special test for sRGB */\n gamma_threshold_test(pm, colour_type, bit_depth, pm->interlace_type,\n .45455, 2.2);\n\n if (fail(pm))\n return;\n }\n\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e9372a1bfd3588a80fcf49aa07321f0971dd6091", + "input": "v8::Handle V8DataView::setInt8Callback(const v8::Arguments& args)\n {\n INC_STATS(\"DOM.DataView.setInt8\");\n if (args.Length() < 2)\n return V8Proxy::throwNotEnoughArgumentsError();\n \n DataView* imp = V8DataView::toNative(args.Holder());\n ExceptionCode ec = 0;\n EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));\n EXCEPTION_BLOCK(int, value, toInt32(args[1]));\n imp->setInt8(byteOffset, static_cast(value), ec);\n if (UNLIKELY(ec))\n V8Proxy::setDOMException(ec, args.GetIsolate());\n return v8::Handle();\n}\n", + "target": "v8::Handle V8DataView::setInt8Callback(const v8::Arguments& args)\n {\n INC_STATS(\"DOM.DataView.setInt8\");\n if (args.Length() < 2)\n return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());\n \n DataView* imp = V8DataView::toNative(args.Holder());\n ExceptionCode ec = 0;\n EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));\n EXCEPTION_BLOCK(int, value, toInt32(args[1]));\n imp->setInt8(byteOffset, static_cast(value), ec);\n if (UNLIKELY(ec))\n V8Proxy::setDOMException(ec, args.GetIsolate());\n return v8::Handle();\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#05dafc06cd3dfeb7c4b24942e4e1ae33ff75a123", + "input": " pam_sm_close_session (pam_handle_t *pamh, int flags UNUSED,\n int argc, const char **argv)\n {\n void *cookiefile;\n int i, debug = 0;\n const char* user;\n struct passwd *tpwd = NULL;\n uid_t unlinkuid, fsuid;\n if (pam_get_user(pamh, &user, NULL) != PAM_SUCCESS)\n pam_syslog(pamh, LOG_ERR, \"error determining target user's name\");\n else {\n tpwd = pam_modutil_getpwnam(pamh, user);\n if (!tpwd)\n pam_syslog(pamh, LOG_ERR, \"error determining target user's UID\");\n else\n unlinkuid = tpwd->pw_uid;\n }\n \n /* Parse arguments. We don't understand many, so no sense in breaking\n * this into a separate function. */\n for (i = 0; i < argc; i++) {\n if (strcmp(argv[i], \"debug\") == 0) {\n debug = 1;\n continue;\n }\n if (strncmp(argv[i], \"xauthpath=\", 10) == 0) {\n continue;\n }\n if (strncmp(argv[i], \"systemuser=\", 11) == 0) {\n continue;\n }\n if (strncmp(argv[i], \"targetuser=\", 11) == 0) {\n continue;\n }\n pam_syslog(pamh, LOG_WARNING, \"unrecognized option `%s'\",\n argv[i]);\n }\n \n /* Try to retrieve the name of a file we created when the session was\n * opened. */\n if (pam_get_data(pamh, DATANAME, (const void**) &cookiefile) == PAM_SUCCESS) {\n /* We'll only try to remove the file once. */\n if (strlen((char*)cookiefile) > 0) {\n if (debug) {\n pam_syslog(pamh, LOG_DEBUG, \"removing `%s'\",\n (char*)cookiefile);\n }\n /* NFS with root_squash requires non-root user */\n if (tpwd)\n fsuid = setfsuid(unlinkuid);\n unlink((char*)cookiefile);\n if (tpwd)\n setfsuid(fsuid);\n *((char*)cookiefile) = '\\0';\n }\n }\n return PAM_SUCCESS;\n }\n", + "target": " pam_sm_close_session (pam_handle_t *pamh, int flags UNUSED,\n int argc, const char **argv)\n {\n int i, debug = 0;\n const char *user;\n const void *data;\n const char *cookiefile;\n struct passwd *tpwd;\n uid_t fsuid;\n \n /* Try to retrieve the name of a file we created when\n * the session was opened. */\n if (pam_get_data(pamh, DATANAME, &data) != PAM_SUCCESS)\n return PAM_SUCCESS;\n cookiefile = data;\n\n /* Parse arguments. We don't understand many, so\n * no sense in breaking this into a separate function. */\n for (i = 0; i < argc; i++) {\n if (strcmp(argv[i], \"debug\") == 0) {\n debug = 1;\n continue;\n }\n if (strncmp(argv[i], \"xauthpath=\", 10) == 0)\n continue;\n if (strncmp(argv[i], \"systemuser=\", 11) == 0)\n continue;\n if (strncmp(argv[i], \"targetuser=\", 11) == 0)\n continue;\n pam_syslog(pamh, LOG_WARNING, \"unrecognized option `%s'\",\n argv[i]);\n }\n \n if (pam_get_user(pamh, &user, NULL) != PAM_SUCCESS) {\n pam_syslog(pamh, LOG_ERR,\n \"error determining target user's name\");\n return PAM_SESSION_ERR;\n }\n if (!(tpwd = pam_modutil_getpwnam(pamh, user))) {\n pam_syslog(pamh, LOG_ERR,\n \"error determining target user's UID\");\n return PAM_SESSION_ERR;\n }\n\n if (debug)\n pam_syslog(pamh, LOG_DEBUG, \"removing `%s'\", cookiefile);\n fsuid = setfsuid(tpwd->pw_uid);\n unlink(cookiefile);\n setfsuid(fsuid);\n\n return PAM_SUCCESS;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4a3e17c874bc4c4c90e5b0f8ec568520964695d4", + "input": "bool DeserializeNotificationDatabaseData(const std::string& input,\n NotificationDatabaseData* output) {\n DCHECK(output);\n\n NotificationDatabaseDataProto message;\n if (!message.ParseFromString(input))\n return false;\n\n output->notification_id = message.notification_id();\n output->origin = GURL(message.origin());\n output->service_worker_registration_id =\n message.service_worker_registration_id();\n\n PlatformNotificationData* notification_data = &output->notification_data;\n const NotificationDatabaseDataProto::NotificationData& payload =\n message.notification_data();\n\n notification_data->title = base::UTF8ToUTF16(payload.title());\n\n switch (payload.direction()) {\n case NotificationDatabaseDataProto::NotificationData::LEFT_TO_RIGHT:\n notification_data->direction =\n PlatformNotificationData::DIRECTION_LEFT_TO_RIGHT;\n break;\n case NotificationDatabaseDataProto::NotificationData::RIGHT_TO_LEFT:\n notification_data->direction =\n PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT;\n break;\n case NotificationDatabaseDataProto::NotificationData::AUTO:\n notification_data->direction = PlatformNotificationData::DIRECTION_AUTO;\n break;\n }\n\n notification_data->lang = payload.lang();\n notification_data->body = base::UTF8ToUTF16(payload.body());\n notification_data->tag = payload.tag();\n notification_data->icon = GURL(payload.icon());\n\n if (payload.vibration_pattern().size() > 0) {\n notification_data->vibration_pattern.assign(\n payload.vibration_pattern().begin(), payload.vibration_pattern().end());\n }\n\n notification_data->timestamp =\n base::Time::FromInternalValue(payload.timestamp());\n notification_data->silent = payload.silent();\n notification_data->require_interaction = payload.require_interaction();\n\n if (payload.data().length()) {\n notification_data->data.assign(payload.data().begin(),\n payload.data().end());\n }\n\n for (const auto& payload_action : payload.actions()) {\n PlatformNotificationAction action;\n action.action = payload_action.action();\n action.title = base::UTF8ToUTF16(payload_action.title());\n notification_data->actions.push_back(action);\n }\n \n return true;\n}\n", + "target": "bool DeserializeNotificationDatabaseData(const std::string& input,\n NotificationDatabaseData* output) {\n DCHECK(output);\n\n NotificationDatabaseDataProto message;\n if (!message.ParseFromString(input))\n return false;\n\n output->notification_id = message.notification_id();\n output->origin = GURL(message.origin());\n output->service_worker_registration_id =\n message.service_worker_registration_id();\n\n PlatformNotificationData* notification_data = &output->notification_data;\n const NotificationDatabaseDataProto::NotificationData& payload =\n message.notification_data();\n\n notification_data->title = base::UTF8ToUTF16(payload.title());\n\n switch (payload.direction()) {\n case NotificationDatabaseDataProto::NotificationData::LEFT_TO_RIGHT:\n notification_data->direction =\n PlatformNotificationData::DIRECTION_LEFT_TO_RIGHT;\n break;\n case NotificationDatabaseDataProto::NotificationData::RIGHT_TO_LEFT:\n notification_data->direction =\n PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT;\n break;\n case NotificationDatabaseDataProto::NotificationData::AUTO:\n notification_data->direction = PlatformNotificationData::DIRECTION_AUTO;\n break;\n }\n\n notification_data->lang = payload.lang();\n notification_data->body = base::UTF8ToUTF16(payload.body());\n notification_data->tag = payload.tag();\n notification_data->icon = GURL(payload.icon());\n\n if (payload.vibration_pattern().size() > 0) {\n notification_data->vibration_pattern.assign(\n payload.vibration_pattern().begin(), payload.vibration_pattern().end());\n }\n\n notification_data->timestamp =\n base::Time::FromInternalValue(payload.timestamp());\n notification_data->silent = payload.silent();\n notification_data->require_interaction = payload.require_interaction();\n\n if (payload.data().length()) {\n notification_data->data.assign(payload.data().begin(),\n payload.data().end());\n }\n\n for (const auto& payload_action : payload.actions()) {\n PlatformNotificationAction action;\n action.action = payload_action.action();\n action.title = base::UTF8ToUTF16(payload_action.title());\n action.icon = GURL(payload_action.icon());\n notification_data->actions.push_back(action);\n }\n \n return true;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#673ce95d481ea9368c4d4d43ac756ba1d6d9e608", + "input": "media::mojom::VideoFrameDataPtr MakeVideoFrameData(\n const scoped_refptr& input) {\n if (input->metadata()->IsTrue(media::VideoFrameMetadata::END_OF_STREAM)) {\n return media::mojom::VideoFrameData::NewEosData(\n media::mojom::EosVideoFrameData::New());\n }\n\n if (input->storage_type() == media::VideoFrame::STORAGE_MOJO_SHARED_BUFFER) {\n media::MojoSharedBufferVideoFrame* mojo_frame =\n static_cast(input.get());\n \n mojo::ScopedSharedBufferHandle dup = mojo_frame->Handle().Clone(\n mojo::SharedBufferHandle::AccessMode::READ_ONLY);\n DCHECK(dup.is_valid());\n \n return media::mojom::VideoFrameData::NewSharedBufferData(\n media::mojom::SharedBufferVideoFrameData::New(\n std::move(dup), mojo_frame->MappedSize(),\n mojo_frame->stride(media::VideoFrame::kYPlane),\n mojo_frame->stride(media::VideoFrame::kUPlane),\n mojo_frame->stride(media::VideoFrame::kVPlane),\n mojo_frame->PlaneOffset(media::VideoFrame::kYPlane),\n mojo_frame->PlaneOffset(media::VideoFrame::kUPlane),\n mojo_frame->PlaneOffset(media::VideoFrame::kVPlane)));\n }\n\n if (input->HasTextures()) {\n std::vector mailbox_holder(\n media::VideoFrame::kMaxPlanes);\n size_t num_planes = media::VideoFrame::NumPlanes(input->format());\n for (size_t i = 0; i < num_planes; i++)\n mailbox_holder[i] = input->mailbox_holder(i);\n return media::mojom::VideoFrameData::NewMailboxData(\n media::mojom::MailboxVideoFrameData::New(std::move(mailbox_holder)));\n }\n\n NOTREACHED() << \"Unsupported VideoFrame conversion\";\n return nullptr;\n}\n", + "target": "media::mojom::VideoFrameDataPtr MakeVideoFrameData(\n const scoped_refptr& input) {\n if (input->metadata()->IsTrue(media::VideoFrameMetadata::END_OF_STREAM)) {\n return media::mojom::VideoFrameData::NewEosData(\n media::mojom::EosVideoFrameData::New());\n }\n\n if (input->storage_type() == media::VideoFrame::STORAGE_MOJO_SHARED_BUFFER) {\n media::MojoSharedBufferVideoFrame* mojo_frame =\n static_cast(input.get());\n \n // TODO(https://crbug.com/803136): This should duplicate as READ_ONLY, but\n // can't because there is no guarantee that the input handle is sharable as\n // read-only.\n mojo::ScopedSharedBufferHandle dup = mojo_frame->Handle().Clone(\n mojo::SharedBufferHandle::AccessMode::READ_WRITE);\n DCHECK(dup.is_valid());\n \n return media::mojom::VideoFrameData::NewSharedBufferData(\n media::mojom::SharedBufferVideoFrameData::New(\n std::move(dup), mojo_frame->MappedSize(),\n mojo_frame->stride(media::VideoFrame::kYPlane),\n mojo_frame->stride(media::VideoFrame::kUPlane),\n mojo_frame->stride(media::VideoFrame::kVPlane),\n mojo_frame->PlaneOffset(media::VideoFrame::kYPlane),\n mojo_frame->PlaneOffset(media::VideoFrame::kUPlane),\n mojo_frame->PlaneOffset(media::VideoFrame::kVPlane)));\n }\n\n if (input->HasTextures()) {\n std::vector mailbox_holder(\n media::VideoFrame::kMaxPlanes);\n size_t num_planes = media::VideoFrame::NumPlanes(input->format());\n for (size_t i = 0; i < num_planes; i++)\n mailbox_holder[i] = input->mailbox_holder(i);\n return media::mojom::VideoFrameData::NewMailboxData(\n media::mojom::MailboxVideoFrameData::New(std::move(mailbox_holder)));\n }\n\n NOTREACHED() << \"Unsupported VideoFrame conversion\";\n return nullptr;\n}\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a9cf73ea7ff78f52662c8658d93c226effbbedde", + "input": "static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features)\n{\n\tstruct sk_buff *segs = ERR_PTR(-EINVAL);\n\tunsigned int mss;\n\tunsigned int unfrag_ip6hlen, unfrag_len;\n\tstruct frag_hdr *fptr;\n\tu8 *mac_start, *prevhdr;\n\tu8 nexthdr;\n\tu8 frag_hdr_sz = sizeof(struct frag_hdr);\n\tint offset;\n\t__wsum csum;\n\n\tmss = skb_shinfo(skb)->gso_size;\n\tif (unlikely(skb->len <= mss))\n\t\tgoto out;\n\n\tif (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {\n\t\t/* Packet is from an untrusted source, reset gso_segs. */\n\t\tint type = skb_shinfo(skb)->gso_type;\n\n\t\tif (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY) ||\n\t\t\t !(type & (SKB_GSO_UDP))))\n\t\t\tgoto out;\n\n\t\tskb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss);\n\n\t\tsegs = NULL;\n\t\tgoto out;\n\t}\n\n\t/* Do software UFO. Complete and fill in the UDP checksum as HW cannot\n\t * do checksum of UDP packets sent as multiple IP fragments.\n\t */\n\toffset = skb->csum_start - skb_headroom(skb);\n\tcsum = skb_checksum(skb, offset, skb->len- offset, 0);\n\toffset += skb->csum_offset;\n\t*(__sum16 *)(skb->data + offset) = csum_fold(csum);\n \tskb->ip_summed = CHECKSUM_NONE;\n \n \t/* Check if there is enough headroom to insert fragment header. */\n\tif ((skb_headroom(skb) < frag_hdr_sz) &&\n \t pskb_expand_head(skb, frag_hdr_sz, 0, GFP_ATOMIC))\n \t\tgoto out;\n \n\t/* Find the unfragmentable header and shift it left by frag_hdr_sz\n\t * bytes to insert fragment header.\n\t */\n\tunfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr);\n\tnexthdr = *prevhdr;\n\t*prevhdr = NEXTHDR_FRAGMENT;\n\tunfrag_len = skb_network_header(skb) - skb_mac_header(skb) +\n\t\t unfrag_ip6hlen;\n\tmac_start = skb_mac_header(skb);\n\tmemmove(mac_start-frag_hdr_sz, mac_start, unfrag_len);\n\n\tskb->mac_header -= frag_hdr_sz;\n\tskb->network_header -= frag_hdr_sz;\n\n\tfptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);\n\tfptr->nexthdr = nexthdr;\n\tfptr->reserved = 0;\n\tipv6_select_ident(fptr);\n\n\t/* Fragment the skb. ipv6 header and the remaining fields of the\n\t * fragment header are updated in ipv6_gso_segment()\n\t */\n\tsegs = skb_segment(skb, features);\n\nout:\n\treturn segs;\n}\n", + "target": "static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features)\n{\n\tstruct sk_buff *segs = ERR_PTR(-EINVAL);\n\tunsigned int mss;\n\tunsigned int unfrag_ip6hlen, unfrag_len;\n\tstruct frag_hdr *fptr;\n\tu8 *mac_start, *prevhdr;\n\tu8 nexthdr;\n\tu8 frag_hdr_sz = sizeof(struct frag_hdr);\n\tint offset;\n\t__wsum csum;\n\n\tmss = skb_shinfo(skb)->gso_size;\n\tif (unlikely(skb->len <= mss))\n\t\tgoto out;\n\n\tif (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {\n\t\t/* Packet is from an untrusted source, reset gso_segs. */\n\t\tint type = skb_shinfo(skb)->gso_type;\n\n\t\tif (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY) ||\n\t\t\t !(type & (SKB_GSO_UDP))))\n\t\t\tgoto out;\n\n\t\tskb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss);\n\n\t\tsegs = NULL;\n\t\tgoto out;\n\t}\n\n\t/* Do software UFO. Complete and fill in the UDP checksum as HW cannot\n\t * do checksum of UDP packets sent as multiple IP fragments.\n\t */\n\toffset = skb->csum_start - skb_headroom(skb);\n\tcsum = skb_checksum(skb, offset, skb->len- offset, 0);\n\toffset += skb->csum_offset;\n\t*(__sum16 *)(skb->data + offset) = csum_fold(csum);\n \tskb->ip_summed = CHECKSUM_NONE;\n \n \t/* Check if there is enough headroom to insert fragment header. */\n\tif ((skb_mac_header(skb) < skb->head + frag_hdr_sz) &&\n \t pskb_expand_head(skb, frag_hdr_sz, 0, GFP_ATOMIC))\n \t\tgoto out;\n \n\t/* Find the unfragmentable header and shift it left by frag_hdr_sz\n\t * bytes to insert fragment header.\n\t */\n\tunfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr);\n\tnexthdr = *prevhdr;\n\t*prevhdr = NEXTHDR_FRAGMENT;\n\tunfrag_len = skb_network_header(skb) - skb_mac_header(skb) +\n\t\t unfrag_ip6hlen;\n\tmac_start = skb_mac_header(skb);\n\tmemmove(mac_start-frag_hdr_sz, mac_start, unfrag_len);\n\n\tskb->mac_header -= frag_hdr_sz;\n\tskb->network_header -= frag_hdr_sz;\n\n\tfptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen);\n\tfptr->nexthdr = nexthdr;\n\tfptr->reserved = 0;\n\tipv6_select_ident(fptr);\n\n\t/* Fragment the skb. ipv6 header and the remaining fields of the\n\t * fragment header are updated in ipv6_gso_segment()\n\t */\n\tsegs = skb_segment(skb, features);\n\nout:\n\treturn segs;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d2860c655357975e7b32d84e6b45e98f0dcecd7a", + "input": "log2vis_unicode (PyObject * unicode, FriBidiParType base_direction, int clean, int reordernsm)\n {\n\tPyObject *logical = NULL;\t/* input string encoded in utf-8 */\n\tPyObject *visual = NULL;\t/* output string encoded in utf-8 */\n\tPyObject *result = NULL;\t/* unicode output string */\n\tint length = PyUnicode_GET_SIZE (unicode);\n\tlogical = PyUnicode_AsUTF8String (unicode);\n\tif (logical == NULL)\n\t\tgoto cleanup;\n\tvisual = log2vis_utf8 (logical, length, base_direction, clean, reordernsm);\n\tif (visual == NULL)\n\t\tgoto cleanup;\n\tresult = PyUnicode_DecodeUTF8 (PyString_AS_STRING (visual),\n\t\t\t\t PyString_GET_SIZE (visual), \"strict\");\n cleanup:\n\tPy_XDECREF (logical);\n\tPy_XDECREF (visual);\n\treturn result;\n }\n", + "target": "log2vis_unicode (PyObject * unicode, FriBidiParType base_direction, int clean, int reordernsm)\n_pyfribidi_log2vis (PyObject * self, PyObject * args, PyObject * kw)\n {\n PyUnicodeObject *logical = NULL;\t/* input unicode or string object */\n FriBidiParType base = FRIBIDI_TYPE_RTL;\t/* optional direction */\n int clean = 0; /* optional flag to clean the string */\n int reordernsm = 1; /* optional flag to allow reordering of non spacing marks*/\n\n static char *kwargs[] =\n { \"logical\", \"base_direction\", \"clean\", \"reordernsm\", NULL };\n\n if (!PyArg_ParseTupleAndKeywords (args, kw, \"U|iii\", kwargs,\n &logical, &base, &clean, &reordernsm)) {\n return NULL;\n }\n\n /* Validate base */\n\n if (!(base == FRIBIDI_TYPE_RTL\n || base == FRIBIDI_TYPE_LTR\n || base == FRIBIDI_TYPE_ON)) {\n return PyErr_Format (PyExc_ValueError,\n \"invalid value %d: use either RTL, LTR or ON\",\n base);\n }\n\n return unicode_log2vis (logical, base, clean, reordernsm);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9afc491d6d64d54bf01f526abcc3d8344d90fa42", + "input": "bool SniffMimeType(const char* content,\n size_t content_size,\n const GURL& url,\n const std::string& type_hint,\n std::string* result) {\n DCHECK_LT(content_size, 1000000U); // sanity check\n DCHECK(content);\n DCHECK(result);\n\n bool have_enough_content = true;\n\n result->assign(type_hint);\n\n if (IsOfficeType(type_hint))\n return SniffForInvalidOfficeDocs(content, content_size, url, result);\n\n const bool hint_is_unknown_mime_type = IsUnknownMimeType(type_hint);\n \n if (hint_is_unknown_mime_type && !url.SchemeIsFile() &&\n SniffForHTML(content, content_size, &have_enough_content, result)) {\n return true;\n }\n \n const bool hint_is_text_plain = (type_hint == \"text/plain\");\n if (hint_is_unknown_mime_type || hint_is_text_plain) {\n if (!SniffBinary(content, content_size, &have_enough_content, result)) {\n if (hint_is_text_plain) {\n return have_enough_content;\n }\n }\n }\n\n if (type_hint == \"text/xml\" || type_hint == \"application/xml\") {\n if (SniffXML(content, content_size, &have_enough_content, result))\n return true;\n return have_enough_content;\n }\n\n if (SniffCRX(content, content_size, url, type_hint,\n &have_enough_content, result))\n return true;\n\n if (SniffForOfficeDocs(content, content_size, url,\n &have_enough_content, result))\n return true; // We've matched a magic number. No more content needed.\n\n if (type_hint == \"application/octet-stream\")\n return have_enough_content;\n\n if (SniffForMagicNumbers(content, content_size,\n &have_enough_content, result))\n return true; // We've matched a magic number. No more content needed.\n\n return have_enough_content;\n}\n", + "target": "bool SniffMimeType(const char* content,\n size_t content_size,\n const GURL& url,\n const std::string& type_hint,\n std::string* result) {\n DCHECK_LT(content_size, 1000000U); // sanity check\n DCHECK(content);\n DCHECK(result);\n\n bool have_enough_content = true;\n\n result->assign(type_hint);\n\n if (IsOfficeType(type_hint))\n return SniffForInvalidOfficeDocs(content, content_size, url, result);\n\n const bool hint_is_unknown_mime_type = IsUnknownMimeType(type_hint);\n \n // First check for HTML\n if (hint_is_unknown_mime_type) {\n // We're only willing to sniff HTML if the server has not supplied a mime\n // type, or if the type it did supply indicates that it doesn't know what\n // the type should be.\n if (SniffForHTML(content, content_size, &have_enough_content, result))\n return true; // We succeeded in sniffing HTML. No more content needed.\n }\n \n const bool hint_is_text_plain = (type_hint == \"text/plain\");\n if (hint_is_unknown_mime_type || hint_is_text_plain) {\n if (!SniffBinary(content, content_size, &have_enough_content, result)) {\n if (hint_is_text_plain) {\n return have_enough_content;\n }\n }\n }\n\n if (type_hint == \"text/xml\" || type_hint == \"application/xml\") {\n if (SniffXML(content, content_size, &have_enough_content, result))\n return true;\n return have_enough_content;\n }\n\n if (SniffCRX(content, content_size, url, type_hint,\n &have_enough_content, result))\n return true;\n\n if (SniffForOfficeDocs(content, content_size, url,\n &have_enough_content, result))\n return true; // We've matched a magic number. No more content needed.\n\n if (type_hint == \"application/octet-stream\")\n return have_enough_content;\n\n if (SniffForMagicNumbers(content, content_size,\n &have_enough_content, result))\n return true; // We've matched a magic number. No more content needed.\n\n return have_enough_content;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3475f5e448ddf5e48888f3d0563245cc46e3c98b", + "input": "LauncherView::LauncherView(LauncherModel* model,\n LauncherDelegate* delegate,\n ShelfLayoutManager* shelf_layout_manager)\n : model_(model),\n delegate_(delegate),\n view_model_(new views::ViewModel),\n last_visible_index_(-1),\n overflow_button_(NULL),\n dragging_(false),\n drag_view_(NULL),\n drag_offset_(0),\n start_drag_index_(-1),\n context_menu_id_(0),\n alignment_(SHELF_ALIGNMENT_BOTTOM) {\n DCHECK(model_);\n bounds_animator_.reset(new views::BoundsAnimator(this));\n bounds_animator_->AddObserver(this);\n set_context_menu_controller(this);\n focus_search_.reset(new LauncherFocusSearch(view_model_.get()));\n tooltip_.reset(new LauncherTooltipManager(alignment_, shelf_layout_manager));\n}\n", + "target": "LauncherView::LauncherView(LauncherModel* model,\n LauncherDelegate* delegate,\n ShelfLayoutManager* shelf_layout_manager)\n : model_(model),\n delegate_(delegate),\n view_model_(new views::ViewModel),\n first_visible_index_(0),\n last_visible_index_(-1),\n overflow_button_(NULL),\n dragging_(false),\n drag_view_(NULL),\n drag_offset_(0),\n start_drag_index_(-1),\n context_menu_id_(0),\n alignment_(SHELF_ALIGNMENT_BOTTOM),\n leading_inset_(kDefaultLeadingInset) {\n DCHECK(model_);\n bounds_animator_.reset(new views::BoundsAnimator(this));\n bounds_animator_->AddObserver(this);\n set_context_menu_controller(this);\n focus_search_.reset(new LauncherFocusSearch(view_model_.get()));\n tooltip_.reset(new LauncherTooltipManager(alignment_, shelf_layout_manager));\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#21f8aaee0c62708654988ce092838aa7df4d25d8", + "input": "void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,\n\t\t struct ath_node *an)\n{\n\tstruct ath_atx_tid *tid;\n\tstruct ath_atx_ac *ac;\n\tstruct ath_txq *txq;\n\tbool buffered;\n\tint tidno;\n\n \tfor (tidno = 0, tid = &an->tid[tidno];\n \t tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {\n \n\t\tif (!tid->sched)\n\t\t\tcontinue;\n \t\tac = tid->ac;\n \t\ttxq = ac->txq;\n \n \t\tath_txq_lock(sc, txq);\n \n \t\tbuffered = ath_tid_has_buffered(tid);\n \n \t\ttid->sched = false;\n\t\tlist_del(&tid->list);\n\n\t\tif (ac->sched) {\n\t\t\tac->sched = false;\n\t\t\tlist_del(&ac->list);\n\t\t}\n\n\t\tath_txq_unlock(sc, txq);\n\n\t\tieee80211_sta_set_buffered(sta, tidno, buffered);\n\t}\n}\n", + "target": "void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,\n\t\t struct ath_node *an)\n{\n\tstruct ath_atx_tid *tid;\n\tstruct ath_atx_ac *ac;\n\tstruct ath_txq *txq;\n\tbool buffered;\n\tint tidno;\n\n \tfor (tidno = 0, tid = &an->tid[tidno];\n \t tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {\n \n \t\tac = tid->ac;\n \t\ttxq = ac->txq;\n \n \t\tath_txq_lock(sc, txq);\n \n\t\tif (!tid->sched) {\n\t\t\tath_txq_unlock(sc, txq);\n\t\t\tcontinue;\n\t\t}\n\n \t\tbuffered = ath_tid_has_buffered(tid);\n \n \t\ttid->sched = false;\n\t\tlist_del(&tid->list);\n\n\t\tif (ac->sched) {\n\t\t\tac->sched = false;\n\t\t\tlist_del(&ac->list);\n\t\t}\n\n\t\tath_txq_unlock(sc, txq);\n\n\t\tieee80211_sta_set_buffered(sta, tidno, buffered);\n\t}\n}\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d5fc88e573fa58b93034b04d35a2454f5d28cad9", + "input": " nm_ip4_config_commit (const NMIP4Config *config, int ifindex, guint32 default_route_metric)\n {\n \tNMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);\n\tguint32 mtu = nm_ip4_config_get_mtu (config);\n \tint i;\n \n \tg_return_val_if_fail (ifindex > 0, FALSE);\n\tg_return_val_if_fail (ifindex > 0, FALSE);\n\tg_return_val_if_fail (config != NULL, FALSE);\n\n\t/* Addresses */\n\tnm_platform_ip4_address_sync (ifindex, priv->addresses, default_route_metric);\n\n\t/* Routes */\n\t{\n\t\tint count = nm_ip4_config_get_num_routes (config);\n\t\tGArray *routes = g_array_sized_new (FALSE, FALSE, sizeof (NMPlatformIP4Route), count);\n\t\tconst NMPlatformIP4Route *route;\n\t\tgboolean success;\n\n\t\tfor (i = 0; i < count; i++) {\n\t\t\troute = nm_ip4_config_get_route (config, i);\n\n\t\t\t/* Don't add the route if it's more specific than one of the subnets\n\t\t\t * the device already has an IP address on.\n\t\t\t */\n\t\t\tif ( route->gateway == 0\n\t\t\t && nm_ip4_config_destination_is_direct (config, route->network, route->plen))\n\t\t\t\tcontinue;\n\n\t\t\tg_array_append_vals (routes, route, 1);\n\t\t}\n\n\t\tsuccess = nm_route_manager_ip4_route_sync (nm_route_manager_get (), ifindex, routes);\n\t\tg_array_unref (routes);\n \t\t\treturn FALSE;\n \t}\n \n\t/* MTU */\n\tif (mtu && mtu != nm_platform_link_get_mtu (ifindex))\n\t\tnm_platform_link_set_mtu (ifindex, mtu);\n \treturn TRUE;\n }\n", + "target": " nm_ip4_config_commit (const NMIP4Config *config, int ifindex, guint32 default_route_metric)\n {\n \tNMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);\n \tint i;\n \n \tg_return_val_if_fail (ifindex > 0, FALSE);\n\tg_return_val_if_fail (ifindex > 0, FALSE);\n\tg_return_val_if_fail (config != NULL, FALSE);\n\n\t/* Addresses */\n\tnm_platform_ip4_address_sync (ifindex, priv->addresses, default_route_metric);\n\n\t/* Routes */\n\t{\n\t\tint count = nm_ip4_config_get_num_routes (config);\n\t\tGArray *routes = g_array_sized_new (FALSE, FALSE, sizeof (NMPlatformIP4Route), count);\n\t\tconst NMPlatformIP4Route *route;\n\t\tgboolean success;\n\n\t\tfor (i = 0; i < count; i++) {\n\t\t\troute = nm_ip4_config_get_route (config, i);\n\n\t\t\t/* Don't add the route if it's more specific than one of the subnets\n\t\t\t * the device already has an IP address on.\n\t\t\t */\n\t\t\tif ( route->gateway == 0\n\t\t\t && nm_ip4_config_destination_is_direct (config, route->network, route->plen))\n\t\t\t\tcontinue;\n\n\t\t\tg_array_append_vals (routes, route, 1);\n\t\t}\n\n\t\tsuccess = nm_route_manager_ip4_route_sync (nm_route_manager_get (), ifindex, routes);\n\t\tg_array_unref (routes);\n \t\t\treturn FALSE;\n \t}\n \n \treturn TRUE;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c5044689e50039635e7700fe2472fd632ac77176", + "input": "xmalloc (size_t size)\n {\n void *ptr = malloc (size);\n if (!ptr \n && (size != 0)) /* some libc don't like size == 0 */\n {\n perror (\"xmalloc: Memory allocation failure\");\n abort();\n }\n return ptr;\n}\n", + "target": "xmalloc (size_t size)\nxmalloc (size_t num, size_t size)\n {\n size_t res;\n if (check_mul_overflow(num, size, &res))\n abort();\n\n void *ptr = malloc (res);\n if (!ptr\n && (size != 0)) /* some libc don't like size == 0 */\n {\n perror (\"xmalloc: Memory allocation failure\");\n abort();\n }\n return ptr;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#04839626ed859623901ebd3a5fd483982186b59d", + "input": "long Cluster::CreateSimpleBlock(\n long long st,\n long long sz)\n{\n assert(m_entries);\n assert(m_entries_size > 0);\n assert(m_entries_count >= 0);\n assert(m_entries_count < m_entries_size);\n const long idx = m_entries_count;\n BlockEntry** const ppEntry = m_entries + idx;\n BlockEntry*& pEntry = *ppEntry;\n pEntry = new (std::nothrow) SimpleBlock(this, idx, st, sz);\n if (pEntry == NULL)\n return -1; //generic error\n SimpleBlock* const p = static_cast(pEntry);\n const long status = p->Parse();\n if (status == 0)\n {\n ++m_entries_count;\n return 0;\n }\n delete pEntry;\n pEntry = 0;\n return status;\n}\n", + "target": "long Cluster::CreateSimpleBlock(\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b944f670bb7a8a919daac497a4ea0536c954c201", + "input": "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec)\n{\n JSValue thisValue = exec->hostThisValue();\n if (!thisValue.inherits(&JSTestObj::s_info))\n return throwVMTypeError(exec);\n JSTestObj* castedThis = jsCast(asObject(thisValue));\n ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);\n TestObj* impl = static_cast(castedThis->impl());\n if (exec->argumentCount() < 1)\n return throwVMError(exec, createTypeError(exec, \"Not enough arguments\"));\n int nonOpt(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n\n size_t argsCount = exec->argumentCount();\n if (argsCount <= 1) {\n impl->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);\n return JSValue::encode(jsUndefined());\n }\n\n int opt1(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toInt32(exec));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n if (argsCount <= 2) {\n impl->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);\n return JSValue::encode(jsUndefined());\n }\n\n int opt2(MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined).toInt32(exec));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n impl->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);\n return JSValue::encode(jsUndefined());\n}\n", + "target": "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec)\n{\n JSValue thisValue = exec->hostThisValue();\n if (!thisValue.inherits(&JSTestObj::s_info))\n return throwVMTypeError(exec);\n JSTestObj* castedThis = jsCast(asObject(thisValue));\n ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);\n TestObj* impl = static_cast(castedThis->impl());\n if (exec->argumentCount() < 1)\n return throwVMError(exec, createNotEnoughArgumentsError(exec));\n int nonOpt(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toInt32(exec));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n\n size_t argsCount = exec->argumentCount();\n if (argsCount <= 1) {\n impl->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);\n return JSValue::encode(jsUndefined());\n }\n\n int opt1(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toInt32(exec));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n if (argsCount <= 2) {\n impl->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);\n return JSValue::encode(jsUndefined());\n }\n\n int opt2(MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined).toInt32(exec));\n if (exec->hadException())\n return JSValue::encode(jsUndefined());\n impl->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);\n return JSValue::encode(jsUndefined());\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2aa9047486dbff12d9e040f917e5f799ed2fd78b", + "input": "static int mpeg4_decode_profile_level(MpegEncContext *s, GetBitContext *gb)\n {\n \n s->avctx->profile = get_bits(gb, 4);\n s->avctx->level = get_bits(gb, 4);\n \n if (s->avctx->profile == 0 && s->avctx->level == 8) {\n s->avctx->level = 0;\n }\n \n return 0;\n}\n", + "target": "static int mpeg4_decode_profile_level(MpegEncContext *s, GetBitContext *gb)\nstatic int mpeg4_decode_profile_level(MpegEncContext *s, GetBitContext *gb, int *profile, int *level)\n {\n \n *profile = get_bits(gb, 4);\n *level = get_bits(gb, 4);\n \n if (*profile == 0 && *level == 8) {\n *level = 0;\n }\n \n return 0;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f6ac1dba5e36f338a490752a2cbef3339096d9fe", + "input": " void DrawingBuffer::RestoreAllState() {\n client_->DrawingBufferClientRestoreScissorTest();\n client_->DrawingBufferClientRestoreMaskAndClearValues();\n client_->DrawingBufferClientRestorePixelPackAlignment();\n client_->DrawingBufferClientRestoreTexture2DBinding();\n client_->DrawingBufferClientRestoreRenderbufferBinding();\n client_->DrawingBufferClientRestoreFramebufferBinding();\n client_->DrawingBufferClientRestorePixelUnpackBufferBinding();\n }\n", + "target": " void DrawingBuffer::RestoreAllState() {\n client_->DrawingBufferClientRestoreScissorTest();\n client_->DrawingBufferClientRestoreMaskAndClearValues();\n client_->DrawingBufferClientRestorePixelPackParameters();\n client_->DrawingBufferClientRestoreTexture2DBinding();\n client_->DrawingBufferClientRestoreRenderbufferBinding();\n client_->DrawingBufferClientRestoreFramebufferBinding();\n client_->DrawingBufferClientRestorePixelUnpackBufferBinding();\n client_->DrawingBufferClientRestorePixelPackBufferBinding();\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e89cfcb9090e8c98129ae9160c513f504db74599", + "input": "void Browser::TabDetachedAt(TabContents* contents, int index) {\n TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH);\n }\n", + "target": "void Browser::TabDetachedAt(TabContents* contents, int index) {\nvoid Browser::TabDetachedAt(WebContents* contents, int index) {\n TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH);\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9fdcc15962f9ff4baebe6fdd947816f43f730d50", + "input": " static void cliRefreshPrompt(void) {\n int len;\n if (config.eval_ldb) return;\n if (config.hostsocket != NULL)\n len = snprintf(config.prompt,sizeof(config.prompt),\"redis %s\",\n config.hostsocket);\n else\n len = anetFormatAddr(config.prompt, sizeof(config.prompt),\n config.hostip, config.hostport);\n /* Add [dbnum] if needed */\n if (config.dbnum != 0)\n len += snprintf(config.prompt+len,sizeof(config.prompt)-len,\"[%d]\",\n config.dbnum);\n snprintf(config.prompt+len,sizeof(config.prompt)-len,\"> \");\n }\n", + "target": " static void cliRefreshPrompt(void) {\n if (config.eval_ldb) return;\n\n sds prompt = sdsempty();\n if (config.hostsocket != NULL) {\n prompt = sdscatfmt(prompt,\"redis %s\",config.hostsocket);\n } else {\n char addr[256];\n anetFormatAddr(addr, sizeof(addr), config.hostip, config.hostport);\n prompt = sdscatlen(prompt,addr,strlen(addr));\n }\n\n /* Add [dbnum] if needed */\n if (config.dbnum != 0)\n prompt = sdscatfmt(prompt,\"[%i]\",config.dbnum);\n\n /* Copy the prompt in the static buffer. */\n prompt = sdscatlen(prompt,\"> \",2);\n snprintf(config.prompt,sizeof(config.prompt),\"%s\",prompt);\n sdsfree(prompt);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7cb8e1ae121cf6b14aa0a59cc708de630c0ef965", + "input": " void CachingPermutedEntropyProvider::ClearCache(PrefService* local_state) {\n local_state->ClearPref(prefs::kVariationsPermutedEntropyCache);\n }\n", + "target": " void CachingPermutedEntropyProvider::ClearCache(PrefService* local_state) {\n local_state->ClearPref(\n chrome_variations::prefs::kVariationsPermutedEntropyCache);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#02c8303512ebed345011f7b545e2f418799be2f0", + "input": " void LocalFileSystem::fileSystemNotAllowedInternal(\n PassRefPtrWillBeRawPtr context,\n PassRefPtr callbacks)\n {\n context->postTask(createCrossThreadTask(&reportFailure, callbacks->release(), FileError::ABORT_ERR));\n }\n", + "target": " void LocalFileSystem::fileSystemNotAllowedInternal(\n PassRefPtrWillBeRawPtr context,\n CallbackWrapper* callbacks)\n {\n context->postTask(createCrossThreadTask(&reportFailure, callbacks->release(), FileError::ABORT_ERR));\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#27c68f543e5eba779902447445dfb05ec3f5bf75", + "input": "bool Vp9Parser::ParseUncompressedHeader(const uint8_t* stream,\n off_t frame_size,\n Vp9FrameHeader* fhdr) {\n reader_.Initialize(stream, frame_size);\n fhdr->data = stream;\n fhdr->frame_size = frame_size;\n \n if (reader_.ReadLiteral(2) != 0x2)\n return false;\n\n fhdr->profile = ReadProfile();\n if (fhdr->profile >= kVp9MaxProfile) {\n DVLOG(1) << \"Unsupported bitstream profile\";\n return false;\n }\n\n fhdr->show_existing_frame = reader_.ReadBool();\n if (fhdr->show_existing_frame) {\n fhdr->frame_to_show = reader_.ReadLiteral(3);\n fhdr->show_frame = true;\n\n if (!reader_.IsValid()) {\n DVLOG(1) << \"parser reads beyond the end of buffer\";\n return false;\n }\n fhdr->uncompressed_header_size = reader_.GetBytesRead();\n return true;\n }\n\n fhdr->frame_type = static_cast(reader_.ReadBool());\n fhdr->show_frame = reader_.ReadBool();\n fhdr->error_resilient_mode = reader_.ReadBool();\n\n if (fhdr->IsKeyframe()) {\n if (!VerifySyncCode())\n return false;\n\n if (!ReadBitDepthColorSpaceSampling(fhdr))\n return false;\n \n fhdr->refresh_flags = 0xff;\n \n ReadFrameSize(fhdr);\n ReadDisplayFrameSize(fhdr);\n } else {\n if (!fhdr->show_frame)\n fhdr->intra_only = reader_.ReadBool();\n\n if (!fhdr->error_resilient_mode)\n fhdr->reset_context = reader_.ReadLiteral(2);\n\n if (fhdr->intra_only) {\n if (!VerifySyncCode())\n return false;\n\n if (fhdr->profile > 0) {\n if (!ReadBitDepthColorSpaceSampling(fhdr))\n return false;\n } else {\n fhdr->bit_depth = 8;\n fhdr->color_space = Vp9ColorSpace::BT_601;\n fhdr->subsampling_x = fhdr->subsampling_y = 1;\n }\n \n fhdr->refresh_flags = reader_.ReadLiteral(8);\n ReadFrameSize(fhdr);\n ReadDisplayFrameSize(fhdr);\n } else {\n fhdr->refresh_flags = reader_.ReadLiteral(8);\n \n for (size_t i = 0; i < kVp9NumRefsPerFrame; i++) {\n fhdr->frame_refs[i] = reader_.ReadLiteral(kVp9NumRefFramesLog2);\n fhdr->ref_sign_biases[i] = reader_.ReadBool();\n }\n\n if (!ReadFrameSizeFromRefs(fhdr))\n return false;\n ReadDisplayFrameSize(fhdr);\n\n fhdr->allow_high_precision_mv = reader_.ReadBool();\n fhdr->interp_filter = ReadInterpFilter();\n }\n }\n\n if (fhdr->error_resilient_mode) {\n fhdr->frame_parallel_decoding_mode = true;\n } else {\n fhdr->refresh_frame_context = reader_.ReadBool();\n fhdr->frame_parallel_decoding_mode = reader_.ReadBool();\n }\n \n fhdr->frame_context_idx = reader_.ReadLiteral(2);\n \n if (fhdr->IsKeyframe() || fhdr->intra_only)\n SetupPastIndependence();\n ReadLoopFilter();\n ReadQuantization(&fhdr->quant_params);\n ReadSegmentation();\n \n ReadTiles(fhdr);\n \n fhdr->first_partition_size = reader_.ReadLiteral(16);\n if (fhdr->first_partition_size == 0) {\n DVLOG(1) << \"invalid header size\";\n return false;\n }\n\n if (!reader_.IsValid()) {\n DVLOG(1) << \"parser reads beyond the end of buffer\";\n return false;\n }\n fhdr->uncompressed_header_size = reader_.GetBytesRead();\n \n SetupSegmentationDequant(fhdr->quant_params);\n SetupLoopFilter();\n UpdateSlots(fhdr);\n return true;\n }\n", + "target": "bool Vp9Parser::ParseUncompressedHeader(const uint8_t* stream,\nbool Vp9Parser::ParseUncompressedHeader(Vp9FrameHeader* fhdr) {\n reader_.Initialize(stream_, size_);\n \n if (reader_.ReadLiteral(2) != 0x2)\n return false;\n\n fhdr->profile = ReadProfile();\n if (fhdr->profile >= kVp9MaxProfile) {\n DVLOG(1) << \"Unsupported bitstream profile\";\n return false;\n }\n\n fhdr->show_existing_frame = reader_.ReadBool();\n if (fhdr->show_existing_frame) {\n fhdr->frame_to_show = reader_.ReadLiteral(3);\n fhdr->show_frame = true;\n\n if (!reader_.IsValid()) {\n DVLOG(1) << \"parser reads beyond the end of buffer\";\n return false;\n }\n fhdr->uncompressed_header_size = reader_.GetBytesRead();\n return true;\n }\n\n fhdr->frame_type = static_cast(reader_.ReadBool());\n fhdr->show_frame = reader_.ReadBool();\n fhdr->error_resilient_mode = reader_.ReadBool();\n\n if (fhdr->IsKeyframe()) {\n if (!VerifySyncCode())\n return false;\n\n if (!ReadBitDepthColorSpaceSampling(fhdr))\n return false;\n \n for (size_t i = 0; i < kVp9NumRefFrames; i++)\n fhdr->refresh_flag[i] = true;\n \n ReadFrameSize(fhdr);\n ReadDisplayFrameSize(fhdr);\n } else {\n if (!fhdr->show_frame)\n fhdr->intra_only = reader_.ReadBool();\n\n if (!fhdr->error_resilient_mode)\n fhdr->reset_context = reader_.ReadLiteral(2);\n\n if (fhdr->intra_only) {\n if (!VerifySyncCode())\n return false;\n\n if (fhdr->profile > 0) {\n if (!ReadBitDepthColorSpaceSampling(fhdr))\n return false;\n } else {\n fhdr->bit_depth = 8;\n fhdr->color_space = Vp9ColorSpace::BT_601;\n fhdr->subsampling_x = fhdr->subsampling_y = 1;\n }\n \n for (size_t i = 0; i < kVp9NumRefFrames; i++)\n fhdr->refresh_flag[i] = reader_.ReadBool();\n ReadFrameSize(fhdr);\n ReadDisplayFrameSize(fhdr);\n } else {\n for (size_t i = 0; i < kVp9NumRefFrames; i++)\n fhdr->refresh_flag[i] = reader_.ReadBool();\n \n for (size_t i = 0; i < kVp9NumRefsPerFrame; i++) {\n fhdr->frame_refs[i] = reader_.ReadLiteral(kVp9NumRefFramesLog2);\n fhdr->ref_sign_biases[i] = reader_.ReadBool();\n }\n\n if (!ReadFrameSizeFromRefs(fhdr))\n return false;\n ReadDisplayFrameSize(fhdr);\n\n fhdr->allow_high_precision_mv = reader_.ReadBool();\n fhdr->interp_filter = ReadInterpFilter();\n }\n }\n\n if (fhdr->error_resilient_mode) {\n fhdr->frame_parallel_decoding_mode = true;\n } else {\n fhdr->refresh_frame_context = reader_.ReadBool();\n fhdr->frame_parallel_decoding_mode = reader_.ReadBool();\n }\n \n fhdr->frame_context_idx = reader_.ReadLiteral(2);\n \n ReadLoopFilter(&fhdr->loop_filter);\n ReadQuantization(&fhdr->quant_params);\n ReadSegmentation(&fhdr->segment);\n \n ReadTiles(fhdr);\n \n fhdr->first_partition_size = reader_.ReadLiteral(16);\n if (fhdr->first_partition_size == 0) {\n DVLOG(1) << \"invalid header size\";\n return false;\n }\n\n if (!reader_.IsValid()) {\n DVLOG(1) << \"parser reads beyond the end of buffer\";\n return false;\n }\n fhdr->uncompressed_header_size = reader_.GetBytesRead();\n \n return true;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1924f747637265f563892b8f56a64391f6208194", + "input": " void CastCastView::ButtonPressed(views::Button* sender,\n const ui::Event& event) {\n DCHECK(sender == stop_button_);\n StopCast();\n }\n", + "target": " void CastCastView::ButtonPressed(views::Button* sender,\n const ui::Event& event) {\n DCHECK(sender == stop_button_);\n cast_config_delegate_->StopCasting();\n }\n", + "vul_type": "cwe-79", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#57e68e9cd65b4b8eb4045a1e0d0746458502554c", + "input": " void mlock_vma_page(struct page *page)\n {\n \tBUG_ON(!PageLocked(page));\n \n \tif (!TestSetPageMlocked(page)) {\n\t\tmod_zone_page_state(page_zone(page), NR_MLOCK,\n\t\t\t\t hpage_nr_pages(page));\n\t\tcount_vm_event(UNEVICTABLE_PGMLOCKED);\n\t\tif (!isolate_lru_page(page))\n\t\t\tputback_lru_page(page);\n\t}\n}\n", + "target": " void mlock_vma_page(struct page *page)\n {\n\t/* Serialize with page migration */\n \tBUG_ON(!PageLocked(page));\n \n \tif (!TestSetPageMlocked(page)) {\n\t\tmod_zone_page_state(page_zone(page), NR_MLOCK,\n\t\t\t\t hpage_nr_pages(page));\n\t\tcount_vm_event(UNEVICTABLE_PGMLOCKED);\n\t\tif (!isolate_lru_page(page))\n\t\t\tputback_lru_page(page);\n\t}\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0c4120fffa3dffe97b95c486a120eded82afe8a6", + "input": "int pdf_load_xrefs(FILE *fp, pdf_t *pdf)\n{\n int i, ver, is_linear;\n long pos, pos_count;\n char x, *c, buf[256];\n \n c = NULL;\n\n /* Count number of xrefs */\n pdf->n_xrefs = 0;\n fseek(fp, 0, SEEK_SET);\n while (get_next_eof(fp) >= 0)\n ++pdf->n_xrefs;\n\n if (!pdf->n_xrefs)\n return 0;\n \n /* Load in the start/end positions */\n fseek(fp, 0, SEEK_SET);\n pdf->xrefs = calloc(1, sizeof(xref_t) * pdf->n_xrefs);\n ver = 1;\n for (i=0; in_xrefs; i++)\n {\n /* Seek to %%EOF */\n if ((pos = get_next_eof(fp)) < 0)\n break;\n\n /* Set and increment the version */\n pdf->xrefs[i].version = ver++;\n\n /* Rewind until we find end of \"startxref\" */\n pos_count = 0;\n while (SAFE_F(fp, ((x = fgetc(fp)) != 'f')))\n fseek(fp, pos - (++pos_count), SEEK_SET);\n \n /* Suck in end of \"startxref\" to start of %%EOF */\n if (pos_count >= sizeof(buf)) {\n ERR(\"Failed to locate the startxref token. \"\n \"This might be a corrupt PDF.\\n\");\n return -1;\n }\n memset(buf, 0, sizeof(buf));\n SAFE_E(fread(buf, 1, pos_count, fp), pos_count,\n \"Failed to read startxref.\\n\");\n c = buf;\n while (*c == ' ' || *c == '\\n' || *c == '\\r')\n ++c;\n \n /* xref start position */\n pdf->xrefs[i].start = atol(c);\n\n /* If xref is 0 handle linear xref table */\n if (pdf->xrefs[i].start == 0)\n get_xref_linear_skipped(fp, &pdf->xrefs[i]);\n\n /* Non-linear, normal operation, so just find the end of the xref */\n else\n {\n /* xref end position */\n pos = ftell(fp);\n fseek(fp, pdf->xrefs[i].start, SEEK_SET);\n pdf->xrefs[i].end = get_next_eof(fp);\n\n /* Look for next EOF and xref data */\n fseek(fp, pos, SEEK_SET);\n }\n\n /* Check validity */\n if (!is_valid_xref(fp, pdf, &pdf->xrefs[i]))\n {\n is_linear = pdf->xrefs[i].is_linear;\n memset(&pdf->xrefs[i], 0, sizeof(xref_t));\n pdf->xrefs[i].is_linear = is_linear;\n rewind(fp);\n get_next_eof(fp);\n continue;\n }\n\n /* Load the entries from the xref */\n load_xref_entries(fp, &pdf->xrefs[i]);\n }\n\n /* Now we have all xref tables, if this is linearized, we need\n * to make adjustments so that things spit out properly\n */\n if (pdf->xrefs[0].is_linear)\n resolve_linearized_pdf(pdf);\n\n /* Ok now we have all xref data. Go through those versions of the \n * PDF and try to obtain creator information\n */\n load_creator(fp, pdf);\n\n return pdf->n_xrefs;\n}\n", + "target": "int pdf_load_xrefs(FILE *fp, pdf_t *pdf)\n{\n int i, ver, is_linear;\n long pos, pos_count;\n char x, *c, buf[256];\n \n c = NULL;\n\n /* Count number of xrefs */\n pdf->n_xrefs = 0;\n fseek(fp, 0, SEEK_SET);\n while (get_next_eof(fp) >= 0)\n ++pdf->n_xrefs;\n\n if (!pdf->n_xrefs)\n return 0;\n \n /* Load in the start/end positions */\n fseek(fp, 0, SEEK_SET);\n pdf->xrefs = safe_calloc(sizeof(xref_t) * pdf->n_xrefs);\n ver = 1;\n for (i=0; in_xrefs; i++)\n {\n /* Seek to %%EOF */\n if ((pos = get_next_eof(fp)) < 0)\n break;\n\n /* Set and increment the version */\n pdf->xrefs[i].version = ver++;\n\n /* Rewind until we find end of \"startxref\" */\n pos_count = 0;\n while (SAFE_F(fp, ((x = fgetc(fp)) != 'f')))\n fseek(fp, pos - (++pos_count), SEEK_SET);\n \n /* Suck in end of \"startxref\" to start of %%EOF */\n if (pos_count >= sizeof(buf)) {\n ERR(\"Failed to locate the startxref token. \"\n \"This might be a corrupt PDF.\\n\");\n return -1;\n }\n memset(buf, 0, sizeof(buf));\n SAFE_E(fread(buf, 1, pos_count, fp), pos_count,\n \"Failed to read startxref.\\n\");\n c = buf;\n while (*c == ' ' || *c == '\\n' || *c == '\\r')\n ++c;\n \n /* xref start position */\n pdf->xrefs[i].start = atol(c);\n\n /* If xref is 0 handle linear xref table */\n if (pdf->xrefs[i].start == 0)\n get_xref_linear_skipped(fp, &pdf->xrefs[i]);\n\n /* Non-linear, normal operation, so just find the end of the xref */\n else\n {\n /* xref end position */\n pos = ftell(fp);\n fseek(fp, pdf->xrefs[i].start, SEEK_SET);\n pdf->xrefs[i].end = get_next_eof(fp);\n\n /* Look for next EOF and xref data */\n fseek(fp, pos, SEEK_SET);\n }\n\n /* Check validity */\n if (!is_valid_xref(fp, pdf, &pdf->xrefs[i]))\n {\n is_linear = pdf->xrefs[i].is_linear;\n memset(&pdf->xrefs[i], 0, sizeof(xref_t));\n pdf->xrefs[i].is_linear = is_linear;\n rewind(fp);\n get_next_eof(fp);\n continue;\n }\n\n /* Load the entries from the xref */\n load_xref_entries(fp, &pdf->xrefs[i]);\n }\n\n /* Now we have all xref tables, if this is linearized, we need\n * to make adjustments so that things spit out properly\n */\n if (pdf->xrefs[0].is_linear)\n resolve_linearized_pdf(pdf);\n\n /* Ok now we have all xref data. Go through those versions of the \n * PDF and try to obtain creator information\n */\n load_creator(fp, pdf);\n\n return pdf->n_xrefs;\n}\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#4379a7fcff8190aa7ba72307b398161c32102c52", + "input": "void UpdatePolicyForEvent(const WebInputEvent* input_event,\n NavigationPolicy* policy) {\n if (!input_event)\n return;\n\n unsigned short button_number = 0;\n if (input_event->GetType() == WebInputEvent::kMouseUp) {\n const WebMouseEvent* mouse_event =\n static_cast(input_event);\n\n switch (mouse_event->button) {\n case WebMouseEvent::Button::kLeft:\n button_number = 0;\n break;\n case WebMouseEvent::Button::kMiddle:\n button_number = 1;\n break;\n case WebMouseEvent::Button::kRight:\n button_number = 2;\n break;\n default:\n return;\n }\n } else if ((WebInputEvent::IsKeyboardEventType(input_event->GetType()) &&\n static_cast(input_event)\n ->windows_key_code == VKEY_RETURN) ||\n WebInputEvent::IsGestureEventType(input_event->GetType())) {\n button_number = 0;\n } else {\n return;\n }\n\n bool ctrl = input_event->GetModifiers() & WebInputEvent::kControlKey;\n bool shift = input_event->GetModifiers() & WebInputEvent::kShiftKey;\n bool alt = input_event->GetModifiers() & WebInputEvent::kAltKey;\n bool meta = input_event->GetModifiers() & WebInputEvent::kMetaKey;\n\n NavigationPolicy user_policy = *policy;\n NavigationPolicyFromMouseEvent(button_number, ctrl, shift, alt, meta,\n &user_policy);\n \n if (user_policy == kNavigationPolicyDownload &&\n *policy != kNavigationPolicyIgnore)\n return;\n if (user_policy == kNavigationPolicyNewWindow &&\n *policy == kNavigationPolicyNewPopup)\n return;\n *policy = user_policy;\n }\n", + "target": "void UpdatePolicyForEvent(const WebInputEvent* input_event,\n NavigationPolicy* policy) {\n if (!input_event)\n return;\n\n unsigned short button_number = 0;\n if (input_event->GetType() == WebInputEvent::kMouseUp) {\n const WebMouseEvent* mouse_event =\n static_cast(input_event);\n\n switch (mouse_event->button) {\n case WebMouseEvent::Button::kLeft:\n button_number = 0;\n break;\n case WebMouseEvent::Button::kMiddle:\n button_number = 1;\n break;\n case WebMouseEvent::Button::kRight:\n button_number = 2;\n break;\n default:\n return;\n }\n } else if ((WebInputEvent::IsKeyboardEventType(input_event->GetType()) &&\n static_cast(input_event)\n ->windows_key_code == VKEY_RETURN) ||\n WebInputEvent::IsGestureEventType(input_event->GetType())) {\n button_number = 0;\n } else {\n return;\n }\n\n bool ctrl = input_event->GetModifiers() & WebInputEvent::kControlKey;\n bool shift = input_event->GetModifiers() & WebInputEvent::kShiftKey;\n bool alt = input_event->GetModifiers() & WebInputEvent::kAltKey;\n bool meta = input_event->GetModifiers() & WebInputEvent::kMetaKey;\n\n NavigationPolicy user_policy = *policy;\n NavigationPolicyFromMouseEvent(button_number, ctrl, shift, alt, meta,\n &user_policy);\n \n if (user_policy == kNavigationPolicyNewWindow &&\n *policy == kNavigationPolicyNewPopup)\n return;\n *policy = user_policy;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-089#12-0955f5d98dec", + "input": " def get_requested_month(self, date):\n data = dict()\n\n month_start, month_end = self.get_epoch_month(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}\n month_total = 0\n\n query = '''\n SELECT TimeStamp, SUM(DayYield) AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN %s AND %s\n GROUP BY TimeStamp\n '''\n\n data['data'] = list()\n for row in self.c.execute(query % (month_start, month_end)):\n data['data'].append({'time': self.convert_local_ts_to_utc(row[0], self.local_timezone), 'power': row[1]})\n month_total += row[1]\n\n data['total'] = month_total\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM ( SELECT TimeStamp FROM MonthData GROUP BY TimeStamp );\n '''\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if first_data: data['hasPrevious'] = (first_data < month_start)\n else: data['hasPrevious'] = False\n if last_data: data['hasNext'] = (last_data > month_end)\n else: data['hasNext'] = False\n\n return data", + "target": " def get_requested_month(self, date):\n data = dict()\n\n month_start, month_end = self.get_epoch_month(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}\n month_total = 0\n\n query = '''\n SELECT TimeStamp, SUM(DayYield) AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN ? AND ?\n GROUP BY TimeStamp;\n '''\n\n data['data'] = list()\n for row in self.c.execute(query, (month_start, month_end)):\n data['data'].append({'time': self.convert_local_ts_to_utc(row[0], self.local_timezone), 'power': row[1]})\n month_total += row[1]\n\n data['total'] = month_total\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM ( SELECT TimeStamp FROM MonthData GROUP BY TimeStamp );\n '''\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if first_data: data['hasPrevious'] = (first_data < month_start)\n else: data['hasPrevious'] = False\n if last_data: data['hasNext'] = (last_data > month_end)\n else: data['hasNext'] = False\n\n return data", + "vul_type": "cwe-089", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#45f6fad84cc305103b28d73482b344d7f5b76f39", + "input": "void inet6_destroy_sock(struct sock *sk)\n{\n\tstruct ipv6_pinfo *np = inet6_sk(sk);\n\tstruct sk_buff *skb;\n\tstruct ipv6_txoptions *opt;\n\n\t/* Release rx options */\n\n\tskb = xchg(&np->pktoptions, NULL);\n\tif (skb)\n\t\tkfree_skb(skb);\n\n\tskb = xchg(&np->rxpmtu, NULL);\n\tif (skb)\n\t\tkfree_skb(skb);\n\n\t/* Free flowlabels */\n\tfl6_free_socklist(sk);\n \n \t/* Free tx options */\n \n\topt = xchg(&np->opt, NULL);\n\tif (opt)\n\t\tsock_kfree_s(sk, opt, opt->tot_len);\n }\n", + "target": "void inet6_destroy_sock(struct sock *sk)\n{\n\tstruct ipv6_pinfo *np = inet6_sk(sk);\n\tstruct sk_buff *skb;\n\tstruct ipv6_txoptions *opt;\n\n\t/* Release rx options */\n\n\tskb = xchg(&np->pktoptions, NULL);\n\tif (skb)\n\t\tkfree_skb(skb);\n\n\tskb = xchg(&np->rxpmtu, NULL);\n\tif (skb)\n\t\tkfree_skb(skb);\n\n\t/* Free flowlabels */\n\tfl6_free_socklist(sk);\n \n \t/* Free tx options */\n \n\topt = xchg((__force struct ipv6_txoptions **)&np->opt, NULL);\n\tif (opt) {\n\t\tatomic_sub(opt->tot_len, &sk->sk_omem_alloc);\n\t\ttxopt_put(opt);\n\t}\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#2-88e5cf802a30", + "input": "def git_hook(strict=False, modify=False):\n \"\"\"\n Git pre-commit hook to check staged files for isort errors\n\n :param bool strict - if True, return number of errors on exit,\n causing the hook to fail. If False, return zero so it will\n just act as a warning.\n :param bool modify - if True, fix the sources if they are not\n sorted properly. If False, only report result without\n modifying anything.\n\n :return number of errors if in strict mode, 0 otherwise.\n \"\"\"\n\n # Get list of files modified and staged\n diff_cmd = \"git diff-index --cached --name-only --diff-filter=ACMRTUXB HEAD\"\n files_modified = get_lines(diff_cmd)\n\n errors = 0\n for filename in files_modified:\n if filename.endswith('.py'):\n # Get the staged contents of the file\n staged_cmd = \"git show :%s\" % filename\n staged_contents = get_output(staged_cmd)\n\n sort = SortImports(\n file_path=filename,\n file_contents=staged_contents.decode(),\n check=True\n )\n\n if sort.incorrectly_sorted:\n errors += 1\n if modify:\n SortImports(\n file_path=filename,\n file_contents=staged_contents.decode(),\n check=False,\n )\n\n return errors if strict else 0", + "target": "def git_hook(strict=False, modify=False):\n \"\"\"\n Git pre-commit hook to check staged files for isort errors\n\n :param bool strict - if True, return number of errors on exit,\n causing the hook to fail. If False, return zero so it will\n just act as a warning.\n :param bool modify - if True, fix the sources if they are not\n sorted properly. If False, only report result without\n modifying anything.\n\n :return number of errors if in strict mode, 0 otherwise.\n \"\"\"\n\n # Get list of files modified and staged\n diff_cmd = [\"git\", \"diff-index\", \"--cached\", \"--name-only\", \"--diff-filter=ACMRTUXB HEAD\"]\n files_modified = get_lines(diff_cmd)\n\n errors = 0\n for filename in files_modified:\n if filename.endswith('.py'):\n # Get the staged contents of the file\n staged_cmd = [\"git\", \"show\", \":%s\" % filename]\n staged_contents = get_output(staged_cmd)\n\n sort = SortImports(\n file_path=filename,\n file_contents=staged_contents,\n check=True\n )\n\n if sort.incorrectly_sorted:\n errors += 1\n if modify:\n SortImports(\n file_path=filename,\n file_contents=staged_contents,\n check=False,\n )\n\n return errors if strict else 0", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#14f2111f9cec919a450115ce4914f228effca58e", + "input": " void RunScrollbarThumbDragLatencyTest() {\n#if !defined(OS_ANDROID)\n blink::WebFloatPoint scrollbar_thumb(795, 30);\n blink::WebMouseEvent mouse_down = SyntheticWebMouseEventBuilder::Build(\n blink::WebInputEvent::kMouseDown, scrollbar_thumb.x, scrollbar_thumb.y,\n 0);\n mouse_down.button = blink::WebMouseEvent::Button::kLeft;\n mouse_down.SetTimeStamp(base::TimeTicks::Now());\n GetWidgetHost()->ForwardMouseEvent(mouse_down);\n blink::WebMouseEvent mouse_move = SyntheticWebMouseEventBuilder::Build(\n blink::WebInputEvent::kMouseMove, scrollbar_thumb.x,\n scrollbar_thumb.y + 10, 0);\n mouse_move.button = blink::WebMouseEvent::Button::kLeft;\n mouse_move.SetTimeStamp(base::TimeTicks::Now());\n GetWidgetHost()->ForwardMouseEvent(mouse_move);\n RunUntilInputProcessed(GetWidgetHost());\n mouse_move.SetPositionInWidget(scrollbar_thumb.x, scrollbar_thumb.y + 20);\n mouse_move.SetPositionInScreen(scrollbar_thumb.x, scrollbar_thumb.y + 20);\n GetWidgetHost()->ForwardMouseEvent(mouse_move);\n RunUntilInputProcessed(GetWidgetHost());\n blink::WebMouseEvent mouse_up = SyntheticWebMouseEventBuilder::Build(\n blink::WebInputEvent::kMouseUp, scrollbar_thumb.x,\n scrollbar_thumb.y + 20, 0);\n mouse_up.button = blink::WebMouseEvent::Button::kLeft;\n mouse_up.SetTimeStamp(base::TimeTicks::Now());\n GetWidgetHost()->ForwardMouseEvent(mouse_up);\n RunUntilInputProcessed(GetWidgetHost());\n FetchHistogramsFromChildProcesses();\n const std::string scroll_types[] = {\"ScrollBegin\", \"ScrollUpdate\"};\n for (const std::string& scroll_type : scroll_types) {\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1, \"Event.Latency.\" + scroll_type +\n \".Scrollbar.TimeToScrollUpdateSwapBegin4\"));\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1, \"Event.Latency.\" + scroll_type +\n \".Scrollbar.RendererSwapToBrowserNotified2\"));\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1, \"Event.Latency.\" + scroll_type +\n \".Scrollbar.BrowserNotifiedToBeforeGpuSwap2\"));\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1, \"Event.Latency.\" + scroll_type + \".Scrollbar.GpuSwap2\"));\n std::string thread_name =\n DoesScrollbarScrollOnMainThread() ? \"Main\" : \"Impl\";\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1, \"Event.Latency.\" + scroll_type + \".Scrollbar.TimeToHandled2_\" +\n thread_name));\n EXPECT_TRUE(VerifyRecordedSamplesForHistogram(\n 1, \"Event.Latency.\" + scroll_type +\n \".Scrollbar.HandledToRendererSwap2_\" + thread_name));\n }\n#endif // !defined(OS_ANDROID)\n }\n", + "target": " void RunScrollbarThumbDragLatencyTest() {\n", + "vul_type": "cwe-281", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f63a8daa5812afef4f06c962351687e1ff9ccb2b", + "input": " int perf_event_task_enable(void)\n {\n \tstruct perf_event *event;\n \n \tmutex_lock(¤t->perf_event_mutex);\n\tlist_for_each_entry(event, ¤t->perf_event_list, owner_entry)\n\t\tperf_event_for_each_child(event, perf_event_enable);\n \tmutex_unlock(¤t->perf_event_mutex);\n \n \treturn 0;\n }\n", + "target": " int perf_event_task_enable(void)\n {\n\tstruct perf_event_context *ctx;\n \tstruct perf_event *event;\n \n \tmutex_lock(¤t->perf_event_mutex);\n\tlist_for_each_entry(event, ¤t->perf_event_list, owner_entry) {\n\t\tctx = perf_event_ctx_lock(event);\n\t\tperf_event_for_each_child(event, _perf_event_enable);\n\t\tperf_event_ctx_unlock(event, ctx);\n\t}\n \tmutex_unlock(¤t->perf_event_mutex);\n \n \treturn 0;\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0185604c2d82c560dab2f2933a18f797e74ab5a8", + "input": " static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)\n {\n \tint start = 0;\n \tu32 prev_legacy, cur_legacy;\n \tmutex_lock(&kvm->arch.vpit->pit_state.lock);\n \tprev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY;\n\tcur_legacy = ps->flags & KVM_PIT_FLAGS_HPET_LEGACY;\n\tif (!prev_legacy && cur_legacy)\n\t\tstart = 1;\n \tmemcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels,\n \t sizeof(kvm->arch.vpit->pit_state.channels));\n \tkvm->arch.vpit->pit_state.flags = ps->flags;\n\tkvm_pit_load_count(kvm, 0, kvm->arch.vpit->pit_state.channels[0].count, start);\n \tmutex_unlock(&kvm->arch.vpit->pit_state.lock);\n \treturn 0;\n }\n", + "target": " static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)\n {\n \tint start = 0;\n\tint i;\n \tu32 prev_legacy, cur_legacy;\n \tmutex_lock(&kvm->arch.vpit->pit_state.lock);\n \tprev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY;\n\tcur_legacy = ps->flags & KVM_PIT_FLAGS_HPET_LEGACY;\n\tif (!prev_legacy && cur_legacy)\n\t\tstart = 1;\n \tmemcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels,\n \t sizeof(kvm->arch.vpit->pit_state.channels));\n \tkvm->arch.vpit->pit_state.flags = ps->flags;\n\tfor (i = 0; i < 3; i++)\n\t\tkvm_pit_load_count(kvm, i, kvm->arch.vpit->pit_state.channels[i].count, start);\n \tmutex_unlock(&kvm->arch.vpit->pit_state.lock);\n \treturn 0;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#51dfe5e3b332bcea02fb4d4c7493ae841106dd9b", + "input": "void PulseAudioMixer::EnumerateDevicesCallback(pa_context* unused,\n const pa_sink_info* sink_info,\n int eol,\n void* userdata) {\n CallbackWrapper* data =\n static_cast(userdata);\n data->instance->OnEnumerateDevices(sink_info, eol, &data->done);\n }\n", + "target": "void PulseAudioMixer::EnumerateDevicesCallback(pa_context* unused,\nvoid AudioMixerPulse::EnumerateDevicesCallback(pa_context* unused,\n const pa_sink_info* sink_info,\n int eol,\n void* userdata) {\n CallbackWrapper* data =\n static_cast(userdata);\n data->instance->OnEnumerateDevices(sink_info, eol, &data->done);\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc0b027dfadfcb8a5504f7d8052754bf8d501ab9", + "input": "nfs4_state_set_mode_locked(struct nfs4_state *state, mode_t mode)\n {\n\tif (state->state == mode)\n \t\treturn;\n \t/* NB! List reordering - see the reclaim code for why. */\n\tif ((mode & FMODE_WRITE) != (state->state & FMODE_WRITE)) {\n\t\tif (mode & FMODE_WRITE)\n \t\t\tlist_move(&state->open_states, &state->owner->so_states);\n \t\telse\n \t\t\tlist_move_tail(&state->open_states, &state->owner->so_states);\n \t}\n\tstate->state = mode;\n }\n", + "target": "nfs4_state_set_mode_locked(struct nfs4_state *state, mode_t mode)\nnfs4_state_set_mode_locked(struct nfs4_state *state, fmode_t fmode)\n {\n\tif (state->state == fmode)\n \t\treturn;\n \t/* NB! List reordering - see the reclaim code for why. */\n\tif ((fmode & FMODE_WRITE) != (state->state & FMODE_WRITE)) {\n\t\tif (fmode & FMODE_WRITE)\n \t\t\tlist_move(&state->open_states, &state->owner->so_states);\n \t\telse\n \t\t\tlist_move_tail(&state->open_states, &state->owner->so_states);\n \t}\n\tstate->state = fmode;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d0c31f0342cefc46a3b3d80359a9779d044d4c0d", + "input": "void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin* origin, const KURL& url, const KURL& srcURL)\n {\n if (origin && BlobURL::getOrigin(url) == \"null\")\n originMap()->add(url.string(), origin);\n \n if (isMainThread())\n blobRegistry().registerBlobURL(url, srcURL);\n else {\n OwnPtr context = adoptPtr(new BlobRegistryContext(url, srcURL));\n callOnMainThread(®isterBlobURLFromTask, context.leakPtr());\n }\n}\n", + "target": "void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin* origin, const KURL& url, const KURL& srcURL)\nvoid BlobRegistry::registerBlobURL(SecurityOrigin* origin, const KURL& url, const KURL& srcURL)\n {\n if (origin && BlobURL::getOrigin(url) == \"null\")\n originMap()->add(url.string(), origin);\n \n if (isMainThread()) {\n if (WebBlobRegistry* registry = blobRegistry())\n registry->registerBlobURL(url, srcURL);\n } else {\n OwnPtr context = adoptPtr(new BlobRegistryContext(url, srcURL));\n callOnMainThread(®isterBlobURLFromTask, context.leakPtr());\n }\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#1c0808d580da09fdec5a9a74ff09e103ea058dd4", + "input": "static void parse_input(h2o_http2_conn_t *conn)\n {\n size_t http2_max_concurrent_requests_per_connection = conn->super.ctx->globalconf->http2.max_concurrent_requests_per_connection;\n int perform_early_exit = 0;\n\n if (conn->num_streams.pull.half_closed + conn->num_streams.push.half_closed != http2_max_concurrent_requests_per_connection)\n perform_early_exit = 1;\n\n /* handle the input */\n while (conn->state < H2O_HTTP2_CONN_STATE_IS_CLOSING && conn->sock->input->size != 0) {\n if (perform_early_exit == 1 &&\n conn->num_streams.pull.half_closed + conn->num_streams.push.half_closed == http2_max_concurrent_requests_per_connection)\n goto EarlyExit;\n /* process a frame */\n const char *err_desc = NULL;\n ssize_t ret = conn->_read_expect(conn, (uint8_t *)conn->sock->input->bytes, conn->sock->input->size, &err_desc);\n if (ret == H2O_HTTP2_ERROR_INCOMPLETE) {\n break;\n } else if (ret < 0) {\n if (ret != H2O_HTTP2_ERROR_PROTOCOL_CLOSE_IMMEDIATELY) {\n enqueue_goaway(conn, (int)ret,\n err_desc != NULL ? (h2o_iovec_t){(char *)err_desc, strlen(err_desc)} : (h2o_iovec_t){});\n }\n close_connection(conn);\n return;\n }\n /* advance to the next frame */\n h2o_buffer_consume(&conn->sock->input, ret);\n }\n \n if (!h2o_socket_is_reading(conn->sock))\n h2o_socket_read_start(conn->sock, on_read);\n return;\n \n EarlyExit:\n if (h2o_socket_is_reading(conn->sock))\n h2o_socket_read_stop(conn->sock);\n }\n", + "target": "static void parse_input(h2o_http2_conn_t *conn)\nstatic int parse_input(h2o_http2_conn_t *conn)\n {\n size_t http2_max_concurrent_requests_per_connection = conn->super.ctx->globalconf->http2.max_concurrent_requests_per_connection;\n int perform_early_exit = 0;\n\n if (conn->num_streams.pull.half_closed + conn->num_streams.push.half_closed != http2_max_concurrent_requests_per_connection)\n perform_early_exit = 1;\n\n /* handle the input */\n while (conn->state < H2O_HTTP2_CONN_STATE_IS_CLOSING && conn->sock->input->size != 0) {\n if (perform_early_exit == 1 &&\n conn->num_streams.pull.half_closed + conn->num_streams.push.half_closed == http2_max_concurrent_requests_per_connection)\n goto EarlyExit;\n /* process a frame */\n const char *err_desc = NULL;\n ssize_t ret = conn->_read_expect(conn, (uint8_t *)conn->sock->input->bytes, conn->sock->input->size, &err_desc);\n if (ret == H2O_HTTP2_ERROR_INCOMPLETE) {\n break;\n } else if (ret < 0) {\n if (ret != H2O_HTTP2_ERROR_PROTOCOL_CLOSE_IMMEDIATELY) {\n enqueue_goaway(conn, (int)ret,\n err_desc != NULL ? (h2o_iovec_t){(char *)err_desc, strlen(err_desc)} : (h2o_iovec_t){});\n }\n return close_connection(conn);\n }\n /* advance to the next frame */\n h2o_buffer_consume(&conn->sock->input, ret);\n }\n \n if (!h2o_socket_is_reading(conn->sock))\n h2o_socket_read_start(conn->sock, on_read);\n return 0;\n \n EarlyExit:\n if (h2o_socket_is_reading(conn->sock))\n h2o_socket_read_stop(conn->sock);\n return 0;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d358f57009b85fb7440208afa5ba87636b491889", + "input": " bool BluetoothDeviceChromeOS::ExpectingConfirmation() const {\n return !confirmation_callback_.is_null();\n }\n", + "target": " bool BluetoothDeviceChromeOS::ExpectingConfirmation() const {\n return pairing_context_.get() && pairing_context_->ExpectingConfirmation();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3119b232c9c453c98d8fa8b6ae4e37ba18117cd4", + "input": "int read_escaped_char(\n yyscan_t yyscanner,\n uint8_t* escaped_char)\n{\n char text[4] = {0, 0, 0, 0};\n\n text[0] = '\\\\';\n text[1] = RE_YY_INPUT(yyscanner);\n \n if (text[1] == EOF)\n return 0;\n \n if (text[1] == 'x')\n {\n text[2] = RE_YY_INPUT(yyscanner);\n \n if (text[2] == EOF)\n return 0;\n \n text[3] = RE_YY_INPUT(yyscanner);\n \n if (text[3] == EOF)\n return 0;\n }\n \n *escaped_char = escaped_char_value(text);\n\n return 1;\n}\n", + "target": "int read_escaped_char(\n yyscan_t yyscanner,\n uint8_t* escaped_char)\n{\n char text[4] = {0, 0, 0, 0};\n\n text[0] = '\\\\';\n text[1] = RE_YY_INPUT(yyscanner);\n \n if (text[1] == EOF || text[1] == 0)\n return 0;\n \n if (text[1] == 'x')\n {\n text[2] = RE_YY_INPUT(yyscanner);\n \n if (!isxdigit(text[2]))\n return 0;\n \n text[3] = RE_YY_INPUT(yyscanner);\n \n if (!isxdigit(text[3]))\n return 0;\n }\n \n *escaped_char = escaped_char_value(text);\n\n return 1;\n}\n", + "vul_type": "cwe-476", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#2b6f22dc64d456471a1dc6df09d515771d1427c8", + "input": "u32 h264bsdInit(storage_t *pStorage, u32 noOutputReordering)\n{\n\n/* Variables */\n u32 size;\n/* Code */\n\n ASSERT(pStorage);\n\n h264bsdInitStorage(pStorage);\n\n /* allocate mbLayer to be next multiple of 64 to enable use of\n\n * specific NEON optimized \"memset\" for clearing the structure */\n size = (sizeof(macroblockLayer_t) + 63) & ~0x3F;\n \n pStorage->mbLayer = (macroblockLayer_t*)H264SwDecMalloc(size);\n if (!pStorage->mbLayer)\n return HANTRO_NOK;\n \n if (noOutputReordering)\n pStorage->noReordering = HANTRO_TRUE;\n\n return HANTRO_OK;\n}\n", + "target": "u32 h264bsdInit(storage_t *pStorage, u32 noOutputReordering)\n{\n\n/* Variables */\n u32 size;\n/* Code */\n\n ASSERT(pStorage);\n\n h264bsdInitStorage(pStorage);\n\n /* allocate mbLayer to be next multiple of 64 to enable use of\n\n * specific NEON optimized \"memset\" for clearing the structure */\n size = (sizeof(macroblockLayer_t) + 63) & ~0x3F;\n \n pStorage->mbLayer = (macroblockLayer_t*)H264SwDecMalloc(size, 1);\n if (!pStorage->mbLayer)\n return HANTRO_NOK;\n \n if (noOutputReordering)\n pStorage->noReordering = HANTRO_TRUE;\n\n return HANTRO_OK;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc0b027dfadfcb8a5504f7d8052754bf8d501ab9", + "input": "static void encode_share_access(struct xdr_stream *xdr, int open_flags)\n {\n \t__be32 *p;\n \n \tRESERVE_SPACE(8);\n\tswitch (open_flags & (FMODE_READ|FMODE_WRITE)) {\n \t\tcase FMODE_READ:\n \t\t\tWRITE32(NFS4_SHARE_ACCESS_READ);\n \t\t\tbreak;\n\t\tcase FMODE_WRITE:\n\t\t\tWRITE32(NFS4_SHARE_ACCESS_WRITE);\n\t\t\tbreak;\n\t\tcase FMODE_READ|FMODE_WRITE:\n \t\t\tWRITE32(NFS4_SHARE_ACCESS_BOTH);\n \t\t\tbreak;\n \t\tdefault:\n\t\t\tBUG();\n \t}\n \tWRITE32(0);\t\t/* for linux, share_deny = 0 always */\n }\n", + "target": "static void encode_share_access(struct xdr_stream *xdr, int open_flags)\nstatic void encode_share_access(struct xdr_stream *xdr, fmode_t fmode)\n {\n \t__be32 *p;\n \n \tRESERVE_SPACE(8);\n\tswitch (fmode & (FMODE_READ|FMODE_WRITE)) {\n \t\tcase FMODE_READ:\n \t\t\tWRITE32(NFS4_SHARE_ACCESS_READ);\n \t\t\tbreak;\n\t\tcase FMODE_WRITE:\n\t\t\tWRITE32(NFS4_SHARE_ACCESS_WRITE);\n\t\t\tbreak;\n\t\tcase FMODE_READ|FMODE_WRITE:\n \t\t\tWRITE32(NFS4_SHARE_ACCESS_BOTH);\n \t\t\tbreak;\n \t\tdefault:\n\t\t\tWRITE32(0);\n \t}\n \tWRITE32(0);\t\t/* for linux, share_deny = 0 always */\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#5f8e44741f9f216e33736ea4ec65ca9ac03036e6", + "input": " static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev)\n {\n\tstruct rtnl_link_ifmap map = {\n\t\t.mem_start = dev->mem_start,\n\t\t.mem_end = dev->mem_end,\n\t\t.base_addr = dev->base_addr,\n\t\t.irq = dev->irq,\n\t\t.dma = dev->dma,\n\t\t.port = dev->if_port,\n\t};\n \tif (nla_put(skb, IFLA_MAP, sizeof(map), &map))\n \t\treturn -EMSGSIZE;\n \n\treturn 0;\n}\n", + "target": " static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev)\n {\n\tstruct rtnl_link_ifmap map;\n\n\tmemset(&map, 0, sizeof(map));\n\tmap.mem_start = dev->mem_start;\n\tmap.mem_end = dev->mem_end;\n\tmap.base_addr = dev->base_addr;\n\tmap.irq = dev->irq;\n\tmap.dma = dev->dma;\n\tmap.port = dev->if_port;\n\n \tif (nla_put(skb, IFLA_MAP, sizeof(map), &map))\n \t\treturn -EMSGSIZE;\n \n\treturn 0;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#eee5cc2702929fd41cce28058dc6d6717f723f87", + "input": "void mark_files_ro(struct super_block *sb)\n{\n\tstruct file *f;\n\tlg_global_lock(&files_lglock);\n\tdo_file_list_for_each_entry(sb, f) {\n\t\tif (!file_count(f))\n\t\t\tcontinue;\n\t\tif (!(f->f_mode & FMODE_WRITE))\n\t\t\tcontinue;\n\t\tspin_lock(&f->f_lock);\n\t\tf->f_mode &= ~FMODE_WRITE;\n\t\tspin_unlock(&f->f_lock);\n\t\tif (file_check_writeable(f) != 0)\n\t\t\tcontinue;\n\t\t__mnt_drop_write(f->f_path.mnt);\n\t\tfile_release_write(f);\n\t} while_file_list_for_each_entry;\n\tlg_global_unlock(&files_lglock);\n}\n", + "target": "void mark_files_ro(struct super_block *sb)\n", + "vul_type": "cwe-17", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d42b2388f7f8e0332c846675133acea151fc557a", + "input": " jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x)\n {\n \tjas_matrix_t *y;\n\tint i;\n\tint j;\n \ty = jas_seq2d_create(jas_seq2d_xstart(x), jas_seq2d_ystart(x),\n \t jas_seq2d_xend(x), jas_seq2d_yend(x));\n \tassert(y);\n\tfor (i = 0; i < x->numrows_; ++i) {\n\t\tfor (j = 0; j < x->numcols_; ++j) {\n\t\t\t*jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);\n\t\t}\n\t}\n\treturn y;\n}\n", + "target": " jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x)\n {\n \tjas_matrix_t *y;\n\tjas_matind_t i;\n\tjas_matind_t j;\n \ty = jas_seq2d_create(jas_seq2d_xstart(x), jas_seq2d_ystart(x),\n \t jas_seq2d_xend(x), jas_seq2d_yend(x));\n \tassert(y);\n\tfor (i = 0; i < x->numrows_; ++i) {\n\t\tfor (j = 0; j < x->numcols_; ++j) {\n\t\t\t*jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);\n\t\t}\n\t}\n\treturn y;\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d07f5c14e811951ff9b411ceb84e7288e0d04aaf", + "input": "status_t MyOpusExtractor::readNextPacket(MediaBuffer **out) {\n if (mOffset <= mFirstDataOffset && mStartGranulePosition < 0) {\n MediaBuffer *mBuf;\n uint32_t numSamples = 0;\n uint64_t curGranulePosition = 0;\n while (true) {\n status_t err = _readNextPacket(&mBuf, /* calcVorbisTimestamp = */false);\n if (err != OK && err != ERROR_END_OF_STREAM) {\n return err;\n\n }\n if (err == ERROR_END_OF_STREAM || mCurrentPage.mPageNo > 2) {\n break;\n }\n curGranulePosition = mCurrentPage.mGranulePosition;\n numSamples += getNumSamplesInPacket(mBuf);\n mBuf->release();\n mBuf = NULL;\n }\n\n if (curGranulePosition > numSamples) {\n mStartGranulePosition = curGranulePosition - numSamples;\n } else {\n mStartGranulePosition = 0;\n }\n seekToOffset(0);\n }\n\n status_t err = _readNextPacket(out, /* calcVorbisTimestamp = */false);\n if (err != OK) {\n return err;\n }\n\n int32_t currentPageSamples;\n if ((*out)->meta_data()->findInt32(kKeyValidSamples, ¤tPageSamples)) {\n if (mOffset == mFirstDataOffset) {\n currentPageSamples -= mStartGranulePosition;\n (*out)->meta_data()->setInt32(kKeyValidSamples, currentPageSamples);\n }\n mCurGranulePosition = mCurrentPage.mGranulePosition - currentPageSamples;\n }\n\n int64_t timeUs = getTimeUsOfGranule(mCurGranulePosition);\n (*out)->meta_data()->setInt64(kKeyTime, timeUs);\n\n uint32_t frames = getNumSamplesInPacket(*out);\n mCurGranulePosition += frames;\n return OK;\n}\n", + "target": "status_t MyOpusExtractor::readNextPacket(MediaBuffer **out) {\n if (mOffset <= mFirstDataOffset && mStartGranulePosition < 0) {\n MediaBuffer *mBuf;\n uint32_t numSamples = 0;\n uint64_t curGranulePosition = 0;\n while (true) {\n status_t err = _readNextPacket(&mBuf, /* calcVorbisTimestamp = */false);\n if (err != OK && err != ERROR_END_OF_STREAM) {\n return err;\n\n }\n if (err == ERROR_END_OF_STREAM || mCurrentPage.mPageNo > 2) {\n if (mBuf != NULL) {\n mBuf->release();\n mBuf = NULL;\n }\n break;\n }\n curGranulePosition = mCurrentPage.mGranulePosition;\n numSamples += getNumSamplesInPacket(mBuf);\n mBuf->release();\n mBuf = NULL;\n }\n\n if (curGranulePosition > numSamples) {\n mStartGranulePosition = curGranulePosition - numSamples;\n } else {\n mStartGranulePosition = 0;\n }\n seekToOffset(0);\n }\n\n status_t err = _readNextPacket(out, /* calcVorbisTimestamp = */false);\n if (err != OK) {\n return err;\n }\n\n int32_t currentPageSamples;\n if ((*out)->meta_data()->findInt32(kKeyValidSamples, ¤tPageSamples)) {\n if (mOffset == mFirstDataOffset) {\n currentPageSamples -= mStartGranulePosition;\n (*out)->meta_data()->setInt32(kKeyValidSamples, currentPageSamples);\n }\n mCurGranulePosition = mCurrentPage.mGranulePosition - currentPageSamples;\n }\n\n int64_t timeUs = getTimeUsOfGranule(mCurGranulePosition);\n (*out)->meta_data()->setInt64(kKeyTime, timeUs);\n\n uint32_t frames = getNumSamplesInPacket(*out);\n mCurGranulePosition += frames;\n return OK;\n}\n", + "vul_type": "cwe-772", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#eee5cc2702929fd41cce28058dc6d6717f723f87", + "input": "static void destroy_super(struct super_block *s)\n{\n \tint i;\n \tlist_lru_destroy(&s->s_dentry_lru);\n \tlist_lru_destroy(&s->s_inode_lru);\n#ifdef CONFIG_SMP\n\tfree_percpu(s->s_files);\n#endif\n \tfor (i = 0; i < SB_FREEZE_LEVELS; i++)\n \t\tpercpu_counter_destroy(&s->s_writers.counter[i]);\n \tsecurity_sb_free(s);\n\tWARN_ON(!list_empty(&s->s_mounts));\n\tkfree(s->s_subtype);\n\tkfree(s->s_options);\n\tkfree_rcu(s, rcu);\n}\n", + "target": "static void destroy_super(struct super_block *s)\n{\n \tint i;\n \tlist_lru_destroy(&s->s_dentry_lru);\n \tlist_lru_destroy(&s->s_inode_lru);\n \tfor (i = 0; i < SB_FREEZE_LEVELS; i++)\n \t\tpercpu_counter_destroy(&s->s_writers.counter[i]);\n \tsecurity_sb_free(s);\n\tWARN_ON(!list_empty(&s->s_mounts));\n\tkfree(s->s_subtype);\n\tkfree(s->s_options);\n\tkfree_rcu(s, rcu);\n}\n", + "vul_type": "cwe-17", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#48fae61b8a6c9b741f001d478c595b6c7c0af4d9", + "input": "const wchar_t* GetIntegrityLevelString(IntegrityLevel integrity_level) {\n switch (integrity_level) {\n case INTEGRITY_LEVEL_SYSTEM:\n return L\"S-1-16-16384\";\n case INTEGRITY_LEVEL_HIGH:\n return L\"S-1-16-12288\";\n case INTEGRITY_LEVEL_MEDIUM:\n return L\"S-1-16-8192\";\n case INTEGRITY_LEVEL_MEDIUM_LOW:\n return L\"S-1-16-6144\";\n case INTEGRITY_LEVEL_LOW:\n return L\"S-1-16-4096\";\n case INTEGRITY_LEVEL_BELOW_LOW:\n return L\"S-1-16-2048\";\n case INTEGRITY_LEVEL_LAST:\n return NULL;\n }\n\n NOTREACHED();\n return NULL;\n}\n", + "target": "const wchar_t* GetIntegrityLevelString(IntegrityLevel integrity_level) {\n switch (integrity_level) {\n case INTEGRITY_LEVEL_SYSTEM:\n return L\"S-1-16-16384\";\n case INTEGRITY_LEVEL_HIGH:\n return L\"S-1-16-12288\";\n case INTEGRITY_LEVEL_MEDIUM:\n return L\"S-1-16-8192\";\n case INTEGRITY_LEVEL_MEDIUM_LOW:\n return L\"S-1-16-6144\";\n case INTEGRITY_LEVEL_LOW:\n return L\"S-1-16-4096\";\n case INTEGRITY_LEVEL_BELOW_LOW:\n return L\"S-1-16-2048\";\n case INTEGRITY_LEVEL_UNTRUSTED:\n return L\"S-1-16-0\";\n case INTEGRITY_LEVEL_LAST:\n return NULL;\n }\n\n NOTREACHED();\n return NULL;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e3a5d056633677959ad924a51758876d415e7046", + "input": "void comps_mrtree_unite(COMPS_MRTree *rt1, COMPS_MRTree *rt2) {\n COMPS_HSList *tmplist, *tmp_subnodes;\n COMPS_HSListItem *it, *it2;\n struct Pair {\n COMPS_HSList * subnodes;\n char * key;\n char added;\n } *pair, *parent_pair;\n \n pair = malloc(sizeof(struct Pair));\n pair->subnodes = rt2->subnodes;\n pair->key = NULL;\n\n tmplist = comps_hslist_create();\n comps_hslist_init(tmplist, NULL, NULL, &free);\n comps_hslist_append(tmplist, pair, 0);\n\n while (tmplist->first != NULL) {\n it = tmplist->first;\n comps_hslist_remove(tmplist, tmplist->first);\n tmp_subnodes = ((struct Pair*)it->data)->subnodes;\n parent_pair = (struct Pair*) it->data;\n free(it);\n \n pair->added = 0;\n for (it = tmp_subnodes->first; it != NULL; it=it->next) {\n pair = malloc(sizeof(struct Pair));\n pair->subnodes = ((COMPS_MRTreeData*)it->data)->subnodes;\n\n if (parent_pair->key != NULL) {\n pair->key =\n malloc(sizeof(char)\n * (strlen(((COMPS_MRTreeData*)it->data)->key)\n + strlen(parent_pair->key) + 1));\n memcpy(pair->key, parent_pair->key,\n sizeof(char) * strlen(parent_pair->key));\n memcpy(pair->key+strlen(parent_pair->key),\n ((COMPS_MRTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_MRTreeData*)it->data)->key)+1));\n } else {\n pair->key = malloc(sizeof(char)*\n (strlen(((COMPS_MRTreeData*)it->data)->key) +\n 1));\n memcpy(pair->key, ((COMPS_MRTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_MRTreeData*)it->data)->key)+1));\n }\n /* current node has data */\n if (((COMPS_MRTreeData*)it->data)->data->first != NULL) {\n for (it2 = ((COMPS_MRTreeData*)it->data)->data->first;\n it2 != NULL; it2 = it2->next) {\n comps_mrtree_set(rt1, pair->key, it2->data);\n }\n\n if (((COMPS_MRTreeData*)it->data)->subnodes->first) {\n comps_hslist_append(tmplist, pair, 0);\n } else {\n free(pair->key);\n free(pair);\n }\n /* current node hasn't data */\n } else {\n if (((COMPS_MRTreeData*)it->data)->subnodes->first) {\n comps_hslist_append(tmplist, pair, 0);\n } else {\n free(pair->key);\n free(pair);\n }\n }\n }\n free(parent_pair->key);\n free(parent_pair);\n }\n comps_hslist_destroy(&tmplist);\n}\n", + "target": "void comps_mrtree_unite(COMPS_MRTree *rt1, COMPS_MRTree *rt2) {\n COMPS_HSList *tmplist, *tmp_subnodes;\n COMPS_HSListItem *it, *it2;\n struct Pair {\n COMPS_HSList * subnodes;\n char * key;\n } *pair, *parent_pair;\n \n pair = malloc(sizeof(struct Pair));\n pair->subnodes = rt2->subnodes;\n pair->key = NULL;\n\n tmplist = comps_hslist_create();\n comps_hslist_init(tmplist, NULL, NULL, &free);\n comps_hslist_append(tmplist, pair, 0);\n\n while (tmplist->first != NULL) {\n it = tmplist->first;\n comps_hslist_remove(tmplist, tmplist->first);\n tmp_subnodes = ((struct Pair*)it->data)->subnodes;\n parent_pair = (struct Pair*) it->data;\n free(it);\n \n for (it = tmp_subnodes->first; it != NULL; it=it->next) {\n pair = malloc(sizeof(struct Pair));\n pair->subnodes = ((COMPS_MRTreeData*)it->data)->subnodes;\n\n if (parent_pair->key != NULL) {\n pair->key =\n malloc(sizeof(char)\n * (strlen(((COMPS_MRTreeData*)it->data)->key)\n + strlen(parent_pair->key) + 1));\n memcpy(pair->key, parent_pair->key,\n sizeof(char) * strlen(parent_pair->key));\n memcpy(pair->key+strlen(parent_pair->key),\n ((COMPS_MRTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_MRTreeData*)it->data)->key)+1));\n } else {\n pair->key = malloc(sizeof(char)*\n (strlen(((COMPS_MRTreeData*)it->data)->key) +\n 1));\n memcpy(pair->key, ((COMPS_MRTreeData*)it->data)->key,\n sizeof(char)*(strlen(((COMPS_MRTreeData*)it->data)->key)+1));\n }\n /* current node has data */\n if (((COMPS_MRTreeData*)it->data)->data->first != NULL) {\n for (it2 = ((COMPS_MRTreeData*)it->data)->data->first;\n it2 != NULL; it2 = it2->next) {\n comps_mrtree_set(rt1, pair->key, it2->data);\n }\n\n if (((COMPS_MRTreeData*)it->data)->subnodes->first) {\n comps_hslist_append(tmplist, pair, 0);\n } else {\n free(pair->key);\n free(pair);\n }\n /* current node hasn't data */\n } else {\n if (((COMPS_MRTreeData*)it->data)->subnodes->first) {\n comps_hslist_append(tmplist, pair, 0);\n } else {\n free(pair->key);\n free(pair);\n }\n }\n }\n free(parent_pair->key);\n free(parent_pair);\n }\n comps_hslist_destroy(&tmplist);\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#51dfe5e3b332bcea02fb4d4c7493ae841106dd9b", + "input": "PulseAudioMixer::~PulseAudioMixer() {\n PulseAudioFree();\n thread_->Stop();\n thread_.reset();\n }\n", + "target": "PulseAudioMixer::~PulseAudioMixer() {\nAudioMixerPulse::~AudioMixerPulse() {\n PulseAudioFree();\n if (thread_ != NULL) {\n thread_->Stop();\n thread_.reset();\n }\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6a7cc8ff85827fa9ac715b3a83c2d9147f33cd43?w=1", + "input": "static inline int object_common2(UNSERIALIZE_PARAMETER, long elements)\n{\n\tzval *retval_ptr = NULL;\n\tzval fname;\n\n\tif (Z_TYPE_PP(rval) != IS_OBJECT) {\n\t\treturn 0;\n\t}\n\n\tif (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_OBJPROP_PP(rval), elements, 1)) {\n \t /* We've got partially constructed object on our hands here. Wipe it. */\n \t if(Z_TYPE_PP(rval) == IS_OBJECT) {\n \t zend_hash_clean(Z_OBJPROP_PP(rval));\n \t }\n \t ZVAL_NULL(*rval);\n \t\treturn 0;\n\t}\n\n if (Z_TYPE_PP(rval) != IS_OBJECT) {\n return 0;\n }\n\n\tif (Z_OBJCE_PP(rval) != PHP_IC_ENTRY &&\n\t\tzend_hash_exists(&Z_OBJCE_PP(rval)->function_table, \"__wakeup\", sizeof(\"__wakeup\"))) {\n\t\tINIT_PZVAL(&fname);\n\t\tZVAL_STRINGL(&fname, \"__wakeup\", sizeof(\"__wakeup\") - 1, 0);\n\t\tBG(serialize_lock)++;\n\t\tcall_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);\n\t\tBG(serialize_lock)--;\n\t}\n\n\tif (retval_ptr) {\n\t\tzval_ptr_dtor(&retval_ptr);\n\t}\n\n\tif (EG(exception)) {\n\t\treturn 0;\n\t}\n\n\treturn finish_nested_data(UNSERIALIZE_PASSTHRU);\n\n}\n", + "target": "static inline int object_common2(UNSERIALIZE_PARAMETER, long elements)\n{\n\tzval *retval_ptr = NULL;\n\tzval fname;\n\n\tif (Z_TYPE_PP(rval) != IS_OBJECT) {\n\t\treturn 0;\n\t}\n\n\tif (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_OBJPROP_PP(rval), elements, 1)) {\n \t /* We've got partially constructed object on our hands here. Wipe it. */\n \t if(Z_TYPE_PP(rval) == IS_OBJECT) {\n \t zend_hash_clean(Z_OBJPROP_PP(rval));\n\t zend_object_store_ctor_failed(*rval TSRMLS_CC);\n \t }\n \t ZVAL_NULL(*rval);\n \t\treturn 0;\n\t}\n\n if (Z_TYPE_PP(rval) != IS_OBJECT) {\n return 0;\n }\n\n\tif (Z_OBJCE_PP(rval) != PHP_IC_ENTRY &&\n\t\tzend_hash_exists(&Z_OBJCE_PP(rval)->function_table, \"__wakeup\", sizeof(\"__wakeup\"))) {\n\t\tINIT_PZVAL(&fname);\n\t\tZVAL_STRINGL(&fname, \"__wakeup\", sizeof(\"__wakeup\") - 1, 0);\n\t\tBG(serialize_lock)++;\n\t\tcall_user_function_ex(CG(function_table), rval, &fname, &retval_ptr, 0, 0, 1, NULL TSRMLS_CC);\n\t\tBG(serialize_lock)--;\n\t}\n\n\tif (retval_ptr) {\n\t\tzval_ptr_dtor(&retval_ptr);\n\t}\n\n\tif (EG(exception)) {\n\t\treturn 0;\n\t}\n\n\treturn finish_nested_data(UNSERIALIZE_PASSTHRU);\n\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#16dcd30c215801941d9890859fd79a234128fc3e", + "input": "content::DownloadFile* MockDownloadFileFactory::CreateFile(\n DownloadCreateInfo* info,\n scoped_ptr stream,\n content::DownloadManager* download_manager,\n bool calculate_hash,\n const net::BoundNetLog& bound_net_log) {\n DCHECK(files_.end() == files_.find(info->download_id));\n MockDownloadFile* created_file = new MockDownloadFile();\n files_[info->download_id] = created_file;\n \n ON_CALL(*created_file, GetDownloadManager())\n .WillByDefault(Return(download_manager));\n EXPECT_CALL(*created_file, Initialize());\n\n return created_file;\n}\n", + "target": "content::DownloadFile* MockDownloadFileFactory::CreateFile(\n DownloadCreateInfo* info,\n scoped_ptr stream,\n content::DownloadManager* download_manager,\n bool calculate_hash,\n const net::BoundNetLog& bound_net_log) {\n DCHECK(files_.end() == files_.find(info->download_id));\n MockDownloadFile* created_file = new StrictMock();\n files_[info->download_id] = created_file;\n \n ON_CALL(*created_file, GetDownloadManager())\n .WillByDefault(Return(download_manager));\n EXPECT_CALL(*created_file, Initialize());\n\n return created_file;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a00183107d4b84bc8a714290e824ca9c68dac738", + "input": " IW_IMPL(unsigned int) iw_get_ui32le(const iw_byte *b)\n {\n\treturn b[0] | (b[1]<<8) | (b[2]<<16) | (b[3]<<24);\n }\n", + "target": " IW_IMPL(unsigned int) iw_get_ui32le(const iw_byte *b)\n {\n\treturn (unsigned int)b[0] | ((unsigned int)b[1]<<8) |\n\t\t((unsigned int)b[2]<<16) | ((unsigned int)b[3]<<24);\n }\n", + "vul_type": "cwe-682", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#925bcf3c3b0a28b5b78e25d9efda5c0bf27ae699", + "input": "yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *yyscanner, RE_LEX_ENVIRONMENT *lex_env)\n{\n YYUSE (yyvaluep);\n YYUSE (yyscanner);\n YYUSE (lex_env);\n if (!yymsg)\n yymsg = \"Deleting\";\n YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);\n\n YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN\n switch (yytype)\n {\n case 6: /* _CLASS_ */\n#line 96 \"re_grammar.y\" /* yacc.c:1257 */\n { yr_free(((*yyvaluep).class_vector)); }\n#line 1045 \"re_grammar.c\" /* yacc.c:1257 */\n break;\n \n case 26: /* alternative */\n#line 97 \"re_grammar.y\" /* yacc.c:1257 */\n { yr_re_node_destroy(((*yyvaluep).re_node)); }\n#line 1051 \"re_grammar.c\" /* yacc.c:1257 */\n break;\n \n case 27: /* concatenation */\n#line 98 \"re_grammar.y\" /* yacc.c:1257 */\n { yr_re_node_destroy(((*yyvaluep).re_node)); }\n#line 1057 \"re_grammar.c\" /* yacc.c:1257 */\n break;\n \n case 28: /* repeat */\n#line 99 \"re_grammar.y\" /* yacc.c:1257 */\n { yr_re_node_destroy(((*yyvaluep).re_node)); }\n#line 1063 \"re_grammar.c\" /* yacc.c:1257 */\n break;\n \n case 29: /* single */\n#line 100 \"re_grammar.y\" /* yacc.c:1257 */\n { yr_re_node_destroy(((*yyvaluep).re_node)); }\n#line 1069 \"re_grammar.c\" /* yacc.c:1257 */\n break;\n \n \n default:\n break;\n }\n YY_IGNORE_MAYBE_UNINITIALIZED_END\n}\n", + "target": "yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *yyscanner, RE_LEX_ENVIRONMENT *lex_env)\n{\n YYUSE (yyvaluep);\n YYUSE (yyscanner);\n YYUSE (lex_env);\n if (!yymsg)\n yymsg = \"Deleting\";\n YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);\n\n YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN\n switch (yytype)\n {\n case 6: /* _CLASS_ */\n#line 104 \"re_grammar.y\" /* yacc.c:1257 */\n { yr_free(((*yyvaluep).class_vector)); }\n#line 1053 \"re_grammar.c\" /* yacc.c:1257 */\n break;\n \n case 26: /* alternative */\n#line 105 \"re_grammar.y\" /* yacc.c:1257 */\n { yr_re_node_destroy(((*yyvaluep).re_node)); }\n#line 1059 \"re_grammar.c\" /* yacc.c:1257 */\n break;\n \n case 27: /* concatenation */\n#line 106 \"re_grammar.y\" /* yacc.c:1257 */\n { yr_re_node_destroy(((*yyvaluep).re_node)); }\n#line 1065 \"re_grammar.c\" /* yacc.c:1257 */\n break;\n \n case 28: /* repeat */\n#line 107 \"re_grammar.y\" /* yacc.c:1257 */\n { yr_re_node_destroy(((*yyvaluep).re_node)); }\n#line 1071 \"re_grammar.c\" /* yacc.c:1257 */\n break;\n \n case 29: /* single */\n#line 108 \"re_grammar.y\" /* yacc.c:1257 */\n { yr_re_node_destroy(((*yyvaluep).re_node)); }\n#line 1077 \"re_grammar.c\" /* yacc.c:1257 */\n break;\n \n \n default:\n break;\n }\n YY_IGNORE_MAYBE_UNINITIALIZED_END\n}\n", + "vul_type": "cwe-674", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a7278b36fcab9af469563bd7b9dadebe2ae25e48", + "input": "static bool vmxnet_tx_pkt_parse_headers(struct VmxnetTxPkt *pkt)\n{\n struct iovec *l2_hdr, *l3_hdr;\n size_t bytes_read;\n size_t full_ip6hdr_len;\n uint16_t l3_proto;\n\n assert(pkt);\n\n l2_hdr = &pkt->vec[VMXNET_TX_PKT_L2HDR_FRAG];\n l3_hdr = &pkt->vec[VMXNET_TX_PKT_L3HDR_FRAG];\n \n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags, 0, l2_hdr->iov_base,\n ETH_MAX_L2_HDR_LEN);\n if (bytes_read < ETH_MAX_L2_HDR_LEN) {\n l2_hdr->iov_len = 0;\n return false;\n } else {\n l2_hdr->iov_len = eth_get_l2_hdr_length(l2_hdr->iov_base);\n }\n \n l3_proto = eth_get_l3_proto(l2_hdr->iov_base, l2_hdr->iov_len);\n l3_hdr->iov_len = IP_HDR_GET_LEN(l3_hdr->iov_base);\n pkt->l4proto = ((struct ip_header *) l3_hdr->iov_base)->ip_p;\n\n /* copy optional IPv4 header data */\n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags,\n l2_hdr->iov_len + sizeof(struct ip_header),\n l3_hdr->iov_base + sizeof(struct ip_header),\n l3_hdr->iov_len - sizeof(struct ip_header));\n if (bytes_read < l3_hdr->iov_len - sizeof(struct ip_header)) {\n l3_hdr->iov_len = 0;\n return false;\n }\n break;\n\n case ETH_P_IPV6:\n if (!eth_parse_ipv6_hdr(pkt->raw, pkt->raw_frags, l2_hdr->iov_len,\n &pkt->l4proto, &full_ip6hdr_len)) {\n l3_hdr->iov_len = 0;\n return false;\n }\n\n l3_hdr->iov_base = g_malloc(full_ip6hdr_len);\n\n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags, l2_hdr->iov_len,\n l3_hdr->iov_base, full_ip6hdr_len);\n\n if (bytes_read < full_ip6hdr_len) {\n l3_hdr->iov_len = 0;\n return false;\n } else {\n l3_hdr->iov_len = full_ip6hdr_len;\n }\n break;\n\n default:\n l3_hdr->iov_len = 0;\n break;\n }\n", + "target": "static bool vmxnet_tx_pkt_parse_headers(struct VmxnetTxPkt *pkt)\n{\n struct iovec *l2_hdr, *l3_hdr;\n size_t bytes_read;\n size_t full_ip6hdr_len;\n uint16_t l3_proto;\n\n assert(pkt);\n\n l2_hdr = &pkt->vec[VMXNET_TX_PKT_L2HDR_FRAG];\n l3_hdr = &pkt->vec[VMXNET_TX_PKT_L3HDR_FRAG];\n \n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags, 0, l2_hdr->iov_base,\n ETH_MAX_L2_HDR_LEN);\n if (bytes_read < sizeof(struct eth_header)) {\n l2_hdr->iov_len = 0;\n return false;\n }\n\n l2_hdr->iov_len = sizeof(struct eth_header);\n switch (be16_to_cpu(PKT_GET_ETH_HDR(l2_hdr->iov_base)->h_proto)) {\n case ETH_P_VLAN:\n l2_hdr->iov_len += sizeof(struct vlan_header);\n break;\n case ETH_P_DVLAN:\n l2_hdr->iov_len += 2 * sizeof(struct vlan_header);\n break;\n }\n\n if (bytes_read < l2_hdr->iov_len) {\n l2_hdr->iov_len = 0;\n return false;\n }\n \n l3_proto = eth_get_l3_proto(l2_hdr->iov_base, l2_hdr->iov_len);\n l3_hdr->iov_len = IP_HDR_GET_LEN(l3_hdr->iov_base);\n pkt->l4proto = ((struct ip_header *) l3_hdr->iov_base)->ip_p;\n\n /* copy optional IPv4 header data */\n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags,\n l2_hdr->iov_len + sizeof(struct ip_header),\n l3_hdr->iov_base + sizeof(struct ip_header),\n l3_hdr->iov_len - sizeof(struct ip_header));\n if (bytes_read < l3_hdr->iov_len - sizeof(struct ip_header)) {\n l3_hdr->iov_len = 0;\n return false;\n }\n break;\n\n case ETH_P_IPV6:\n if (!eth_parse_ipv6_hdr(pkt->raw, pkt->raw_frags, l2_hdr->iov_len,\n &pkt->l4proto, &full_ip6hdr_len)) {\n l3_hdr->iov_len = 0;\n return false;\n }\n\n l3_hdr->iov_base = g_malloc(full_ip6hdr_len);\n\n bytes_read = iov_to_buf(pkt->raw, pkt->raw_frags, l2_hdr->iov_len,\n l3_hdr->iov_base, full_ip6hdr_len);\n\n if (bytes_read < full_ip6hdr_len) {\n l3_hdr->iov_len = 0;\n return false;\n } else {\n l3_hdr->iov_len = full_ip6hdr_len;\n }\n break;\n\n default:\n l3_hdr->iov_len = 0;\n break;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-078#0-0f5ffa5776ca", + "input": " def _get_3par_host(self, hostname):\n out = self._cli_run('showhost -verbose %s' % (hostname), None)\n LOG.debug(\"OUTPUT = \\n%s\" % (pprint.pformat(out)))\n host = {'id': None, 'name': None,\n 'domain': None,\n 'descriptors': {},\n 'iSCSIPaths': [],\n 'FCPaths': []}\n\n if out:\n err = out[0]\n if err == 'no hosts listed':\n msg = {'code': 'NON_EXISTENT_HOST',\n 'desc': \"HOST '%s' was not found\" % hostname}\n raise hpexceptions.HTTPNotFound(msg)\n\n # start parsing the lines after the header line\n for line in out[1:]:\n if line == '':\n break\n tmp = line.split(',')\n paths = {}\n\n LOG.debug(\"line = %s\" % (pprint.pformat(tmp)))\n host['id'] = tmp[0]\n host['name'] = tmp[1]\n\n portPos = tmp[4]\n LOG.debug(\"portPos = %s\" % (pprint.pformat(portPos)))\n if portPos == '---':\n portPos = None\n else:\n port = portPos.split(':')\n portPos = {'node': int(port[0]), 'slot': int(port[1]),\n 'cardPort': int(port[2])}\n\n paths['portPos'] = portPos\n\n # If FC entry\n if tmp[5] == 'n/a':\n paths['wwn'] = tmp[3]\n host['FCPaths'].append(paths)\n # else iSCSI entry\n else:\n paths['name'] = tmp[3]\n paths['ipAddr'] = tmp[5]\n host['iSCSIPaths'].append(paths)\n\n # find the offset to the description stuff\n offset = 0\n for line in out:\n if line[:15] == '---------- Host':\n break\n else:\n offset += 1\n\n info = out[offset + 2]\n tmp = info.split(':')\n host['domain'] = tmp[1]\n\n info = out[offset + 4]\n tmp = info.split(':')\n host['descriptors']['location'] = tmp[1]\n\n info = out[offset + 5]\n tmp = info.split(':')\n host['descriptors']['ipAddr'] = tmp[1]\n\n info = out[offset + 6]\n tmp = info.split(':')\n host['descriptors']['os'] = tmp[1]\n\n info = out[offset + 7]\n tmp = info.split(':')\n host['descriptors']['model'] = tmp[1]\n\n info = out[offset + 8]\n tmp = info.split(':')\n host['descriptors']['contact'] = tmp[1]\n\n info = out[offset + 9]\n tmp = info.split(':')\n host['descriptors']['comment'] = tmp[1]\n\n return host", + "target": " def _get_3par_host(self, hostname):\n out = self._cli_run(['showhost', '-verbose', hostname])\n LOG.debug(\"OUTPUT = \\n%s\" % (pprint.pformat(out)))\n host = {'id': None, 'name': None,\n 'domain': None,\n 'descriptors': {},\n 'iSCSIPaths': [],\n 'FCPaths': []}\n\n if out:\n err = out[0]\n if err == 'no hosts listed':\n msg = {'code': 'NON_EXISTENT_HOST',\n 'desc': \"HOST '%s' was not found\" % hostname}\n raise hpexceptions.HTTPNotFound(msg)\n\n # start parsing the lines after the header line\n for line in out[1:]:\n if line == '':\n break\n tmp = line.split(',')\n paths = {}\n\n LOG.debug(\"line = %s\" % (pprint.pformat(tmp)))\n host['id'] = tmp[0]\n host['name'] = tmp[1]\n\n portPos = tmp[4]\n LOG.debug(\"portPos = %s\" % (pprint.pformat(portPos)))\n if portPos == '---':\n portPos = None\n else:\n port = portPos.split(':')\n portPos = {'node': int(port[0]), 'slot': int(port[1]),\n 'cardPort': int(port[2])}\n\n paths['portPos'] = portPos\n\n # If FC entry\n if tmp[5] == 'n/a':\n paths['wwn'] = tmp[3]\n host['FCPaths'].append(paths)\n # else iSCSI entry\n else:\n paths['name'] = tmp[3]\n paths['ipAddr'] = tmp[5]\n host['iSCSIPaths'].append(paths)\n\n # find the offset to the description stuff\n offset = 0\n for line in out:\n if line[:15] == '---------- Host':\n break\n else:\n offset += 1\n\n info = out[offset + 2]\n tmp = info.split(':')\n host['domain'] = tmp[1]\n\n info = out[offset + 4]\n tmp = info.split(':')\n host['descriptors']['location'] = tmp[1]\n\n info = out[offset + 5]\n tmp = info.split(':')\n host['descriptors']['ipAddr'] = tmp[1]\n\n info = out[offset + 6]\n tmp = info.split(':')\n host['descriptors']['os'] = tmp[1]\n\n info = out[offset + 7]\n tmp = info.split(':')\n host['descriptors']['model'] = tmp[1]\n\n info = out[offset + 8]\n tmp = info.split(':')\n host['descriptors']['contact'] = tmp[1]\n\n info = out[offset + 9]\n tmp = info.split(':')\n host['descriptors']['comment'] = tmp[1]\n\n return host", + "vul_type": "cwe-078", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#baef1ffd73db183ca50c854e1779ed7f6e5100a8", + "input": "bool IsValidSymbolicLink(const FilePath& file_path,\n GDataCache::CacheSubDirectoryType sub_dir_type,\n const std::vector& cache_paths,\n std::string* reason) {\n DCHECK(sub_dir_type == GDataCache::CACHE_TYPE_PINNED ||\n sub_dir_type == GDataCache::CACHE_TYPE_OUTGOING);\n FilePath destination;\n if (!file_util::ReadSymbolicLink(file_path, &destination)) {\n *reason = \"failed to read the symlink (maybe not a symlink)\";\n return false;\n }\n if (!file_util::PathExists(destination)) {\n *reason = \"pointing to a non-existent file\";\n return false;\n }\n if (sub_dir_type == GDataCache::CACHE_TYPE_PINNED &&\n destination == FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull)) {\n return true;\n }\n if (!cache_paths[GDataCache::CACHE_TYPE_PERSISTENT].IsParent(destination)) {\n *reason = \"pointing to a file outside of persistent directory\";\n return false;\n }\n return true;\n}\n", + "target": "bool IsValidSymbolicLink(const FilePath& file_path,\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7f0126ff011142c8619b10a6e64d04d1745c503a", + "input": "void SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& result, Element* element, Namespaces* namespaces)\n {\n if (!element->isFrameOwnerElement())\n return;\n\n HTMLFrameOwnerElement* frameOwner = toHTMLFrameOwnerElement(element);\n Frame* frame = frameOwner->contentFrame();\n if (!frame)\n return;\n\n KURL url = frame->document()->url();\n if (url.isValid() && !url.isBlankURL())\n return;\n \n url = m_serializer->urlForBlankFrame(frame);\n appendAttribute(result, element, Attribute(frameOwnerURLAttributeName(*frameOwner), url.string()), namespaces);\n }\n", + "target": "void SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& result, Element* element, Namespaces* namespaces)\nvoid SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& out, Element* element, Namespaces* namespaces)\n {\n if (!element->isFrameOwnerElement())\n return;\n\n HTMLFrameOwnerElement* frameOwner = toHTMLFrameOwnerElement(element);\n Frame* frame = frameOwner->contentFrame();\n if (!frame)\n return;\n\n KURL url = frame->document()->url();\n if (url.isValid() && !url.isBlankURL())\n return;\n \n url = m_serializer->urlForBlankFrame(frame);\n appendAttribute(out, element, Attribute(frameOwnerURLAttributeName(*frameOwner), url.string()), namespaces);\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d", + "input": " long long Segment::CreateInstance(IMkvReader* pReader, long long pos,\n Segment*& pSegment) {\n assert(pReader);\n assert(pos >= 0);\n \n pSegment = NULL;\n \n long long total, available;\n\n const long status = pReader->Length(&total, &available);\n\n if (status < 0) // error\n return status;\n\n if (available < 0)\n return -1;\n\n if ((total >= 0) && (available > total))\n return -1;\n\n\n for (;;) {\n if ((total >= 0) && (pos >= total))\n return E_FILE_FORMAT_INVALID;\n\n long len;\n long long result = GetUIntLength(pReader, pos, len);\n\n if (result) // error, or too few available bytes\n return result;\n\n if ((total >= 0) && ((pos + len) > total))\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + len) > available)\n\n return pos + len;\n \n const long long idpos = pos;\n const long long id = ReadUInt(pReader, pos, len);\n \n if (id < 0) // error\n return id;\n \n pos += len; // consume ID\n \n\n result = GetUIntLength(pReader, pos, len);\n\n if (result) // error, or too few available bytes\n return result;\n\n if ((total >= 0) && ((pos + len) > total))\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + len) > available)\n return pos + len;\n\n long long size = ReadUInt(pReader, pos, len);\n\n if (size < 0) // error\n return size;\n\n pos += len; // consume length of size of element\n\n\n const long long unknown_size = (1LL << (7 * len)) - 1;\n\n if (id == 0x08538067) { // Segment ID\n if (size == unknown_size)\n size = -1;\n\n else if (total < 0)\n size = -1;\n\n else if ((pos + size) > total)\n size = -1;\n\n pSegment = new (std::nothrow) Segment(pReader, idpos,\n pos, size);\n\n if (pSegment == 0)\n return -1; // generic error\n\n return 0; // success\n }\n\n if (size == unknown_size)\n return E_FILE_FORMAT_INVALID;\n\n if ((total >= 0) && ((pos + size) > total))\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + size) > available)\n return pos + size;\n\n pos += size; // consume payload\n }\n}\n", + "target": " long long Segment::CreateInstance(IMkvReader* pReader, long long pos,\n Segment*& pSegment) {\n if (pReader == NULL || pos < 0)\n return E_PARSE_FAILED;\n \n pSegment = NULL;\n \n long long total, available;\n\n const long status = pReader->Length(&total, &available);\n\n if (status < 0) // error\n return status;\n\n if (available < 0)\n return -1;\n\n if ((total >= 0) && (available > total))\n return -1;\n\n\n for (;;) {\n if ((total >= 0) && (pos >= total))\n return E_FILE_FORMAT_INVALID;\n\n long len;\n long long result = GetUIntLength(pReader, pos, len);\n\n if (result) // error, or too few available bytes\n return result;\n\n if ((total >= 0) && ((pos + len) > total))\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + len) > available)\n\n return pos + len;\n \n const long long idpos = pos;\n const long long id = ReadID(pReader, pos, len);\n \n if (id < 0)\n return E_FILE_FORMAT_INVALID;\n \n pos += len; // consume ID\n \n\n result = GetUIntLength(pReader, pos, len);\n\n if (result) // error, or too few available bytes\n return result;\n\n if ((total >= 0) && ((pos + len) > total))\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + len) > available)\n return pos + len;\n\n long long size = ReadUInt(pReader, pos, len);\n\n if (size < 0) // error\n return size;\n\n pos += len; // consume length of size of element\n\n\n const long long unknown_size = (1LL << (7 * len)) - 1;\n\n if (id == 0x08538067) { // Segment ID\n if (size == unknown_size)\n size = -1;\n\n else if (total < 0)\n size = -1;\n\n else if ((pos + size) > total)\n size = -1;\n\n pSegment = new (std::nothrow) Segment(pReader, idpos,\n pos, size);\n\n if (pSegment == 0)\n return -1; // generic error\n\n return 0; // success\n }\n\n if (size == unknown_size)\n return E_FILE_FORMAT_INVALID;\n\n if ((total >= 0) && ((pos + size) > total))\n return E_FILE_FORMAT_INVALID;\n\n if ((pos + size) > available)\n return pos + size;\n\n pos += size; // consume payload\n }\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e93dc535728da259ec16d1c3cc393f80b25f64ae", + "input": " bool ClipboardUtil::GetUrl(IDataObject* data_object,\n base::string16* url, base::string16* title, bool convert_filenames) {\n DCHECK(data_object && url && title);\n if (!HasUrl(data_object, convert_filenames))\n return false;\n\n STGMEDIUM store;\n if (GetUrlFromHDrop(data_object, url, title))\n return true;\n\n if (GetData(data_object, Clipboard::GetMozUrlFormatType(), &store) ||\n GetData(data_object, Clipboard::GetUrlWFormatType(), &store)) {\n {\n base::win::ScopedHGlobal data(store.hGlobal);\n SplitUrlAndTitle(data.get(), url, title);\n }\n ReleaseStgMedium(&store);\n return true;\n }\n \n if (GetData(data_object, Clipboard::GetUrlFormatType(), &store)) {\n {\n base::win::ScopedHGlobal data(store.hGlobal);\n SplitUrlAndTitle(base::UTF8ToWide(data.get()), url, title);\n }\n ReleaseStgMedium(&store);\n return true;\n }\n \n if (convert_filenames) {\n return GetFileUrl(data_object, url, title);\n } else {\n return false;\n }\n }\n", + "target": " bool ClipboardUtil::GetUrl(IDataObject* data_object,\n GURL* url,\n base::string16* title,\n bool convert_filenames) {\n DCHECK(data_object && url && title);\n if (!HasUrl(data_object, convert_filenames))\n return false;\n\n STGMEDIUM store;\n if (GetUrlFromHDrop(data_object, url, title))\n return true;\n\n if (GetData(data_object, Clipboard::GetMozUrlFormatType(), &store) ||\n GetData(data_object, Clipboard::GetUrlWFormatType(), &store)) {\n {\n base::win::ScopedHGlobal data(store.hGlobal);\n SplitUrlAndTitle(data.get(), url, title);\n }\n ReleaseStgMedium(&store);\n return url->is_valid();\n }\n \n if (GetData(data_object, Clipboard::GetUrlFormatType(), &store)) {\n {\n base::win::ScopedHGlobal data(store.hGlobal);\n SplitUrlAndTitle(base::UTF8ToWide(data.get()), url, title);\n }\n ReleaseStgMedium(&store);\n return url->is_valid();\n }\n \n if (convert_filenames) {\n std::vector filenames;\n if (!GetFilenames(data_object, &filenames))\n return false;\n DCHECK_GT(filenames.size(), 0U);\n *url = net::FilePathToFileURL(base::FilePath(filenames[0]));\n return url->is_valid();\n }\n\n return false;\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#64dd153c83743af81f20924c6343652d731eeecb", + "input": "static int write_empty_blocks(struct page *page, unsigned from, unsigned to,\n\t\t\t int mode)\n{\n\tstruct inode *inode = page->mapping->host;\n\tunsigned start, end, next, blksize;\n\tsector_t block = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);\n\tint ret;\n\tblksize = 1 << inode->i_blkbits;\n\tnext = end = 0;\n\twhile (next < from) {\n\t\tnext += blksize;\n\t\tblock++;\n\t}\n\tstart = next;\n\tdo {\n\t\tnext += blksize;\n\t\tret = needs_empty_write(block, inode);\n\t\tif (unlikely(ret < 0))\n\t\t\treturn ret;\n\t\tif (ret == 0) {\n\t\t\tif (end) {\n\t\t\t\tret = __block_write_begin(page, start, end - start,\n\t\t\t\t\t\t\t gfs2_block_map);\n\t\t\t\tif (unlikely(ret))\n\t\t\t\t\treturn ret;\n\t\t\t\tret = empty_write_end(page, start, end, mode);\n\t\t\t\tif (unlikely(ret))\n\t\t\t\t\treturn ret;\n\t\t\t\tend = 0;\n\t\t\t}\n\t\t\tstart = next;\n\t\t}\n\t\telse\n\t\t\tend = next;\n\t\tblock++;\n\t} while (next < to);\n\tif (end) {\n\t\tret = __block_write_begin(page, start, end - start, gfs2_block_map);\n\t\tif (unlikely(ret))\n\t\t\treturn ret;\n\t\tret = empty_write_end(page, start, end, mode);\n\t\tif (unlikely(ret))\n\t\t\treturn ret;\n\t}\n\treturn 0;\n}\n", + "target": "static int write_empty_blocks(struct page *page, unsigned from, unsigned to,\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9afc491d6d64d54bf01f526abcc3d8344d90fa42", + "input": "GURL CreateResource(const std::string& content, const std::string& file_ext) {\n base::FilePath path;\n EXPECT_TRUE(base::CreateTemporaryFile(&path));\n EXPECT_EQ(static_cast(content.size()),\n base::WriteFile(path, content.c_str(), content.size()));\n base::FilePath path_with_extension;\n path_with_extension = path.AddExtension(FILE_PATH_LITERAL(file_ext));\n EXPECT_TRUE(base::Move(path, path_with_extension));\n return net::FilePathToFileURL(path_with_extension);\n }\n", + "target": "GURL CreateResource(const std::string& content, const std::string& file_ext) {\nGURL CreateResource(const std::string& content) {\n base::FilePath path;\n EXPECT_TRUE(base::CreateTemporaryFile(&path));\n EXPECT_EQ(static_cast(content.size()),\n base::WriteFile(path, content.c_str(), content.size()));\n return GURL(\"file:///\" + path.AsUTF8Unsafe());\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c70422f760c120480fee4de6c38804c72aa26bc1", + "input": "nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,\n\t\t\t\t\tstruct nfsd3_readdirargs *args)\n{\n\tint len;\n\tu32 max_blocksize = svc_max_payload(rqstp);\n\n\tp = decode_fh(p, &args->fh);\n\tif (!p)\n\t\treturn 0;\n\tp = xdr_decode_hyper(p, &args->cookie);\n\targs->verf = p; p += 2;\n \targs->dircount = ntohl(*p++);\n \targs->count = ntohl(*p++);\n \n \tlen = args->count = min(args->count, max_blocksize);\n \twhile (len > 0) {\n \t\tstruct page *p = *(rqstp->rq_next_page++);\n \t\tif (!args->buffer)\n \t\t\targs->buffer = page_address(p);\n \t\tlen -= PAGE_SIZE;\n \t}\n\treturn xdr_argsize_check(rqstp, p);\n }\n", + "target": "nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,\n\t\t\t\t\tstruct nfsd3_readdirargs *args)\n{\n\tint len;\n\tu32 max_blocksize = svc_max_payload(rqstp);\n\n\tp = decode_fh(p, &args->fh);\n\tif (!p)\n\t\treturn 0;\n\tp = xdr_decode_hyper(p, &args->cookie);\n\targs->verf = p; p += 2;\n \targs->dircount = ntohl(*p++);\n \targs->count = ntohl(*p++);\n \n\tif (!xdr_argsize_check(rqstp, p))\n\t\treturn 0;\n\n \tlen = args->count = min(args->count, max_blocksize);\n \twhile (len > 0) {\n \t\tstruct page *p = *(rqstp->rq_next_page++);\n \t\tif (!args->buffer)\n \t\t\targs->buffer = page_address(p);\n \t\tlen -= PAGE_SIZE;\n \t}\n\treturn 1;\n }\n", + "vul_type": "cwe-404", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a8b0ca17b80e92faab46ee7179ba9e99ccb61233", + "input": "static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)\n{\n\tunsigned long pmnc;\n\tstruct perf_sample_data data;\n\tstruct cpu_hw_events *cpuc;\n\tstruct pt_regs *regs;\n\tint idx;\n\n\t/*\n\t * Get and reset the IRQ flags\n\t */\n\tpmnc = armv7_pmnc_getreset_flags();\n\n\t/*\n\t * Did an overflow occur?\n\t */\n\tif (!armv7_pmnc_has_overflowed(pmnc))\n\t\treturn IRQ_NONE;\n\n\t/*\n\t * Handle the counter(s) overflow(s)\n\t */\n\tregs = get_irq_regs();\n\n\tperf_sample_data_init(&data, 0);\n\n\tcpuc = &__get_cpu_var(cpu_hw_events);\n\tfor (idx = 0; idx <= armpmu->num_events; ++idx) {\n\t\tstruct perf_event *event = cpuc->events[idx];\n\t\tstruct hw_perf_event *hwc;\n\n\t\tif (!test_bit(idx, cpuc->active_mask))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * We have a single interrupt for all counters. Check that\n\t\t * each counter has overflowed before we process it.\n\t\t */\n\t\tif (!armv7_pmnc_counter_has_overflowed(pmnc, idx))\n\t\t\tcontinue;\n\n\t\thwc = &event->hw;\n\t\tarmpmu_event_update(event, hwc, idx, 1);\n\t\tdata.period = event->hw.last_period;\n \t\tif (!armpmu_event_set_period(event, hwc, idx))\n \t\t\tcontinue;\n \n\t\tif (perf_event_overflow(event, 0, &data, regs))\n \t\t\tarmpmu->disable(hwc, idx);\n \t}\n \n\t/*\n\t * Handle the pending perf events.\n\t *\n\t * Note: this call *must* be run with interrupts disabled. For\n\t * platforms that can have the PMU interrupts raised as an NMI, this\n\t * will not work.\n\t */\n\tirq_work_run();\n\n\treturn IRQ_HANDLED;\n}\n", + "target": "static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)\n{\n\tunsigned long pmnc;\n\tstruct perf_sample_data data;\n\tstruct cpu_hw_events *cpuc;\n\tstruct pt_regs *regs;\n\tint idx;\n\n\t/*\n\t * Get and reset the IRQ flags\n\t */\n\tpmnc = armv7_pmnc_getreset_flags();\n\n\t/*\n\t * Did an overflow occur?\n\t */\n\tif (!armv7_pmnc_has_overflowed(pmnc))\n\t\treturn IRQ_NONE;\n\n\t/*\n\t * Handle the counter(s) overflow(s)\n\t */\n\tregs = get_irq_regs();\n\n\tperf_sample_data_init(&data, 0);\n\n\tcpuc = &__get_cpu_var(cpu_hw_events);\n\tfor (idx = 0; idx <= armpmu->num_events; ++idx) {\n\t\tstruct perf_event *event = cpuc->events[idx];\n\t\tstruct hw_perf_event *hwc;\n\n\t\tif (!test_bit(idx, cpuc->active_mask))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * We have a single interrupt for all counters. Check that\n\t\t * each counter has overflowed before we process it.\n\t\t */\n\t\tif (!armv7_pmnc_counter_has_overflowed(pmnc, idx))\n\t\t\tcontinue;\n\n\t\thwc = &event->hw;\n\t\tarmpmu_event_update(event, hwc, idx, 1);\n\t\tdata.period = event->hw.last_period;\n \t\tif (!armpmu_event_set_period(event, hwc, idx))\n \t\t\tcontinue;\n \n\t\tif (perf_event_overflow(event, &data, regs))\n \t\t\tarmpmu->disable(hwc, idx);\n \t}\n \n\t/*\n\t * Handle the pending perf events.\n\t *\n\t * Note: this call *must* be run with interrupts disabled. For\n\t * platforms that can have the PMU interrupts raised as an NMI, this\n\t * will not work.\n\t */\n\tirq_work_run();\n\n\treturn IRQ_HANDLED;\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#9f64916da20eea67121d544698676295bbb105a7", + "input": "int vnc_hextile_send_framebuffer_update(VncState *vs, int x,\n int y, int w, int h)\n{\n int i, j;\n int has_fg, has_bg;\n uint8_t *last_fg, *last_bg;\n VncDisplay *vd = vs->vd;\n \n last_fg = (uint8_t *) g_malloc(vd->server->pf.bytes_per_pixel);\n last_bg = (uint8_t *) g_malloc(vd->server->pf.bytes_per_pixel);\n has_fg = has_bg = 0;\n for (j = y; j < (y + h); j += 16) {\n for (i = x; i < (x + w); i += 16) {\n for (i = x; i < (x + w); i += 16) {\n vs->hextile.send_tile(vs, i, j,\n MIN(16, x + w - i), MIN(16, y + h - j),\n last_bg, last_fg, &has_bg, &has_fg);\n }\n }\n g_free(last_fg);\n g_free(last_bg);\n\n return 1;\n}\n void vnc_hextile_set_pixel_conversion(VncState *vs, int generic)\n {\n if (!generic) {\n switch (vs->ds->surface->pf.bits_per_pixel) {\n case 8:\n vs->hextile.send_tile = send_hextile_tile_8;\n break;\n case 16:\n vs->hextile.send_tile = send_hextile_tile_16;\n break;\n case 32:\n vs->hextile.send_tile = send_hextile_tile_32;\n break;\n }\n } else {\n switch (vs->ds->surface->pf.bits_per_pixel) {\n case 8:\n vs->hextile.send_tile = send_hextile_tile_generic_8;\n break;\n case 16:\n vs->hextile.send_tile = send_hextile_tile_generic_16;\n break;\n case 32:\n vs->hextile.send_tile = send_hextile_tile_generic_32;\n break;\n }\n }\n }\n}\n", + "target": "int vnc_hextile_send_framebuffer_update(VncState *vs, int x,\n int y, int w, int h)\n{\n int i, j;\n int has_fg, has_bg;\n uint8_t *last_fg, *last_bg;\n \n last_fg = (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES);\n last_bg = (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES);\n has_fg = has_bg = 0;\n for (j = y; j < (y + h); j += 16) {\n for (i = x; i < (x + w); i += 16) {\n for (i = x; i < (x + w); i += 16) {\n vs->hextile.send_tile(vs, i, j,\n MIN(16, x + w - i), MIN(16, y + h - j),\n last_bg, last_fg, &has_bg, &has_fg);\n }\n }\n g_free(last_fg);\n g_free(last_bg);\n\n return 1;\n}\n void vnc_hextile_set_pixel_conversion(VncState *vs, int generic)\n {\n if (!generic) {\n switch (VNC_SERVER_FB_BITS) {\n case 8:\n vs->hextile.send_tile = send_hextile_tile_8;\n break;\n case 16:\n vs->hextile.send_tile = send_hextile_tile_16;\n break;\n case 32:\n vs->hextile.send_tile = send_hextile_tile_32;\n break;\n }\n } else {\n switch (VNC_SERVER_FB_BITS) {\n case 8:\n vs->hextile.send_tile = send_hextile_tile_generic_8;\n break;\n case 16:\n vs->hextile.send_tile = send_hextile_tile_generic_16;\n break;\n case 32:\n vs->hextile.send_tile = send_hextile_tile_generic_32;\n break;\n }\n }\n }\n}\n", + "vul_type": "cwe-125", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8ee335227bbcaf1614124046aa25e53d67b11ec3", + "input": " static OPJ_BOOL bmp_read_rle8_data(FILE* IN, OPJ_UINT8* pData,\n OPJ_UINT32 stride, OPJ_UINT32 width, OPJ_UINT32 height)\n {\n OPJ_UINT32 x, y;\n OPJ_UINT8 *pix;\n const OPJ_UINT8 *beyond;\n \n beyond = pData + stride * height;\n pix = pData;\n \n x = y = 0U;\n while (y < height) {\n int c = getc(IN);\n if (c == EOF) {\n return OPJ_FALSE;\n }\n\n if (c) {\n int j, c1_int;\n OPJ_UINT8 c1;\n\n c1_int = getc(IN);\n if (c1_int == EOF) {\n return OPJ_FALSE;\n }\n c1 = (OPJ_UINT8)c1_int;\n\n for (j = 0; (j < c) && (x < width) &&\n ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {\n *pix = c1;\n }\n } else {\n c = getc(IN);\n if (c == EOF) {\n return OPJ_FALSE;\n }\n\n if (c == 0x00) { /* EOL */\n x = 0;\n ++y;\n pix = pData + y * stride + x;\n } else if (c == 0x01) { /* EOP */\n break;\n } else if (c == 0x02) { /* MOVE by dxdy */\n c = getc(IN);\n if (c == EOF) {\n return OPJ_FALSE;\n }\n x += (OPJ_UINT32)c;\n c = getc(IN);\n if (c == EOF) {\n return OPJ_FALSE;\n }\n y += (OPJ_UINT32)c;\n pix = pData + y * stride + x;\n } else { /* 03 .. 255 */\n int j;\n for (j = 0; (j < c) && (x < width) &&\n ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {\n int c1_int;\n OPJ_UINT8 c1;\n c1_int = getc(IN);\n if (c1_int == EOF) {\n return OPJ_FALSE;\n }\n c1 = (OPJ_UINT8)c1_int;\n *pix = c1;\n }\n if ((OPJ_UINT32)c & 1U) { /* skip padding byte */\n c = getc(IN);\n if (c == EOF) {\n return OPJ_FALSE;\n }\n }\n }\n }\n }/* while() */\n return OPJ_TRUE;\n }\n", + "target": " static OPJ_BOOL bmp_read_rle8_data(FILE* IN, OPJ_UINT8* pData,\n OPJ_UINT32 stride, OPJ_UINT32 width, OPJ_UINT32 height)\n {\n OPJ_UINT32 x, y, written;\n OPJ_UINT8 *pix;\n const OPJ_UINT8 *beyond;\n \n beyond = pData + stride * height;\n pix = pData;\n \n x = y = written = 0U;\n while (y < height) {\n int c = getc(IN);\n if (c == EOF) {\n return OPJ_FALSE;\n }\n\n if (c) {\n int j, c1_int;\n OPJ_UINT8 c1;\n\n c1_int = getc(IN);\n if (c1_int == EOF) {\n return OPJ_FALSE;\n }\n c1 = (OPJ_UINT8)c1_int;\n\n for (j = 0; (j < c) && (x < width) &&\n ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {\n *pix = c1;\n written++;\n }\n } else {\n c = getc(IN);\n if (c == EOF) {\n return OPJ_FALSE;\n }\n\n if (c == 0x00) { /* EOL */\n x = 0;\n ++y;\n pix = pData + y * stride + x;\n } else if (c == 0x01) { /* EOP */\n break;\n } else if (c == 0x02) { /* MOVE by dxdy */\n c = getc(IN);\n if (c == EOF) {\n return OPJ_FALSE;\n }\n x += (OPJ_UINT32)c;\n c = getc(IN);\n if (c == EOF) {\n return OPJ_FALSE;\n }\n y += (OPJ_UINT32)c;\n pix = pData + y * stride + x;\n } else { /* 03 .. 255 */\n int j;\n for (j = 0; (j < c) && (x < width) &&\n ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {\n int c1_int;\n OPJ_UINT8 c1;\n c1_int = getc(IN);\n if (c1_int == EOF) {\n return OPJ_FALSE;\n }\n c1 = (OPJ_UINT8)c1_int;\n *pix = c1;\n written++;\n }\n if ((OPJ_UINT32)c & 1U) { /* skip padding byte */\n c = getc(IN);\n if (c == EOF) {\n return OPJ_FALSE;\n }\n }\n }\n }\n }/* while() */\n\n if (written != width * height) {\n fprintf(stderr, \"warning, image's actual size does not match advertized one\\n\");\n return OPJ_FALSE;\n }\n\n return OPJ_TRUE;\n }\n", + "vul_type": "cwe-400", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d59a4441697f6253e7dc3f7ae5caad6e5fd2c778", + "input": " static sk_sp flipSkImageVertically(SkImage* input,\n AlphaDisposition alphaOp) {\n size_t width = static_cast(input->width());\n size_t height = static_cast(input->height());\n SkImageInfo info = SkImageInfo::MakeN32(input->width(), input->height(),\n (alphaOp == PremultiplyAlpha)\n ? kPremul_SkAlphaType\n : kUnpremul_SkAlphaType);\n size_t imageRowBytes = width * info.bytesPerPixel();\n RefPtr imagePixels = copySkImageData(input, info);\n if (!imagePixels)\n return nullptr;\n for (size_t i = 0; i < height / 2; i++) {\n size_t topFirstElement = i * imageRowBytes;\n size_t topLastElement = (i + 1) * imageRowBytes;\n size_t bottomFirstElement = (height - 1 - i) * imageRowBytes;\n std::swap_ranges(imagePixels->data() + topFirstElement,\n imagePixels->data() + topLastElement,\n imagePixels->data() + bottomFirstElement);\n }\n return newSkImageFromRaster(info, std::move(imagePixels), imageRowBytes);\n}\n", + "target": " static sk_sp flipSkImageVertically(SkImage* input,\n AlphaDisposition alphaOp) {\n unsigned width = static_cast(input->width());\n unsigned height = static_cast(input->height());\n SkImageInfo info = SkImageInfo::MakeN32(input->width(), input->height(),\n (alphaOp == PremultiplyAlpha)\n ? kPremul_SkAlphaType\n : kUnpremul_SkAlphaType);\n unsigned imageRowBytes = width * info.bytesPerPixel();\n RefPtr imagePixels = copySkImageData(input, info);\n if (!imagePixels)\n return nullptr;\n for (unsigned i = 0; i < height / 2; i++) {\n unsigned topFirstElement = i * imageRowBytes;\n unsigned topLastElement = (i + 1) * imageRowBytes;\n unsigned bottomFirstElement = (height - 1 - i) * imageRowBytes;\n std::swap_ranges(imagePixels->data() + topFirstElement,\n imagePixels->data() + topLastElement,\n imagePixels->data() + bottomFirstElement);\n }\n return newSkImageFromRaster(info, std::move(imagePixels), imageRowBytes);\n}\n", + "vul_type": "cwe-787", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#603af455b5641671b18d7d7d166630341d71b63f", + "input": "base::string16 TranslateInfoBarDelegate::GetLanguageDisplayableName(\n const std::string& language_code) {\n return l10n_util::GetDisplayNameForLocale(\n language_code, g_browser_process->GetApplicationLocale(), true);\n}\n", + "target": "base::string16 TranslateInfoBarDelegate::GetLanguageDisplayableName(\n", + "vul_type": "cwe-362", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#c995d4fe5e96f4d6d4a88b7867279b08e72d2579", + "input": " bool DataReductionProxySettings::IsDataReductionProxyManaged() {\n return spdy_proxy_auth_enabled_.IsManaged();\n }\n", + "target": " bool DataReductionProxySettings::IsDataReductionProxyManaged() {\n const PrefService::Preference* pref =\n GetOriginalProfilePrefs()->FindPreference(prefs::kDataSaverEnabled);\n return pref && pref->IsManaged();\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#a4150b688a754d3d10d2ca385155b1c95d77d6ae", + "input": "error::Error GLES2DecoderPassthroughImpl::DoEndQueryEXT(GLenum target,\n uint32_t submit_count) {\n if (IsEmulatedQueryTarget(target)) {\n auto active_query_iter = active_queries_.find(target);\n if (active_query_iter == active_queries_.end()) {\n InsertError(GL_INVALID_OPERATION, \"No active query on target.\");\n return error::kNoError;\n }\n if (target == GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM &&\n !pending_read_pixels_.empty()) {\n GLuint query_service_id = active_query_iter->second.service_id;\n pending_read_pixels_.back().waiting_async_pack_queries.insert(\n query_service_id);\n }\n } else {\n CheckErrorCallbackState();\n\n api()->glEndQueryFn(target);\n\n if (CheckErrorCallbackState()) {\n return error::kNoError;\n }\n }\n\n DCHECK(active_queries_.find(target) != active_queries_.end());\n ActiveQuery active_query = std::move(active_queries_[target]);\n active_queries_.erase(target);\n\n PendingQuery pending_query;\n pending_query.target = target;\n pending_query.service_id = active_query.service_id;\n pending_query.shm = std::move(active_query.shm);\n pending_query.sync = active_query.sync;\n pending_query.submit_count = submit_count;\n switch (target) {\n case GL_COMMANDS_COMPLETED_CHROMIUM:\n pending_query.commands_completed_fence = gl::GLFence::Create();\n break;\n\n case GL_READBACK_SHADOW_COPIES_UPDATED_CHROMIUM:\n pending_query.buffer_shadow_update_fence = gl::GLFence::Create();\n pending_query.buffer_shadow_updates = std::move(buffer_shadow_updates_);\n buffer_shadow_updates_.clear();\n break;\n \n default:\n break;\n }\n pending_queries_.push_back(std::move(pending_query));\n return ProcessQueries(false);\n}\n", + "target": "error::Error GLES2DecoderPassthroughImpl::DoEndQueryEXT(GLenum target,\n uint32_t submit_count) {\n if (IsEmulatedQueryTarget(target)) {\n auto active_query_iter = active_queries_.find(target);\n if (active_query_iter == active_queries_.end()) {\n InsertError(GL_INVALID_OPERATION, \"No active query on target.\");\n return error::kNoError;\n }\n if (target == GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM &&\n !pending_read_pixels_.empty()) {\n GLuint query_service_id = active_query_iter->second.service_id;\n pending_read_pixels_.back().waiting_async_pack_queries.insert(\n query_service_id);\n }\n } else {\n CheckErrorCallbackState();\n\n api()->glEndQueryFn(target);\n\n if (CheckErrorCallbackState()) {\n return error::kNoError;\n }\n }\n\n DCHECK(active_queries_.find(target) != active_queries_.end());\n ActiveQuery active_query = std::move(active_queries_[target]);\n active_queries_.erase(target);\n\n PendingQuery pending_query;\n pending_query.target = target;\n pending_query.service_id = active_query.service_id;\n pending_query.shm = std::move(active_query.shm);\n pending_query.sync = active_query.sync;\n pending_query.submit_count = submit_count;\n switch (target) {\n case GL_COMMANDS_COMPLETED_CHROMIUM:\n pending_query.commands_completed_fence = gl::GLFence::Create();\n break;\n\n case GL_READBACK_SHADOW_COPIES_UPDATED_CHROMIUM:\n pending_query.buffer_shadow_update_fence = gl::GLFence::Create();\n pending_query.buffer_shadow_updates = std::move(buffer_shadow_updates_);\n buffer_shadow_updates_.clear();\n break;\n \n case GL_PROGRAM_COMPLETION_QUERY_CHROMIUM:\n pending_query.program_service_id = linking_program_service_id_;\n break;\n\n default:\n break;\n }\n pending_queries_.push_back(std::move(pending_query));\n return ProcessQueries(false);\n}\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#db5523bcb7e0419955172709c241a188ab94e8e0", + "input": "WebInputEvent* CreateWebInputEvent(const PP_InputEvent& event) {\n scoped_ptr web_input_event;\n switch (event.type) {\n case PP_INPUTEVENT_TYPE_UNDEFINED:\n return NULL;\n case PP_INPUTEVENT_TYPE_MOUSEDOWN:\n case PP_INPUTEVENT_TYPE_MOUSEUP:\n case PP_INPUTEVENT_TYPE_MOUSEMOVE:\n case PP_INPUTEVENT_TYPE_MOUSEENTER:\n case PP_INPUTEVENT_TYPE_MOUSELEAVE:\n web_input_event.reset(BuildMouseEvent(event));\n break;\n case PP_INPUTEVENT_TYPE_MOUSEWHEEL:\n web_input_event.reset(BuildMouseWheelEvent(event));\n break;\n case PP_INPUTEVENT_TYPE_RAWKEYDOWN:\n case PP_INPUTEVENT_TYPE_KEYDOWN:\n case PP_INPUTEVENT_TYPE_KEYUP:\n web_input_event.reset(BuildKeyEvent(event));\n break;\n case PP_INPUTEVENT_TYPE_CHAR:\n web_input_event.reset(BuildCharEvent(event));\n break;\n }\n \n return web_input_event.release();\n }\n", + "target": "WebInputEvent* CreateWebInputEvent(const PP_InputEvent& event) {\n scoped_ptr web_input_event;\n switch (event.type) {\n case PP_INPUTEVENT_TYPE_UNDEFINED:\n return NULL;\n case PP_INPUTEVENT_TYPE_MOUSEDOWN:\n case PP_INPUTEVENT_TYPE_MOUSEUP:\n case PP_INPUTEVENT_TYPE_MOUSEMOVE:\n case PP_INPUTEVENT_TYPE_MOUSEENTER:\n case PP_INPUTEVENT_TYPE_MOUSELEAVE:\n case PP_INPUTEVENT_TYPE_CONTEXTMENU:\n web_input_event.reset(BuildMouseEvent(event));\n break;\n case PP_INPUTEVENT_TYPE_MOUSEWHEEL:\n web_input_event.reset(BuildMouseWheelEvent(event));\n break;\n case PP_INPUTEVENT_TYPE_RAWKEYDOWN:\n case PP_INPUTEVENT_TYPE_KEYDOWN:\n case PP_INPUTEVENT_TYPE_KEYUP:\n web_input_event.reset(BuildKeyEvent(event));\n break;\n case PP_INPUTEVENT_TYPE_CHAR:\n web_input_event.reset(BuildCharEvent(event));\n break;\n }\n \n return web_input_event.release();\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#ae6650163c66a7eff1acd6eb8b0f752dcfa8eba5", + "input": "static void lo_release(struct gendisk *disk, fmode_t mode)\n {\n\tstruct loop_device *lo = disk->private_data;\n \tint err;\n \n \tif (atomic_dec_return(&lo->lo_refcnt))\n\t\treturn;\n\n\tmutex_lock(&lo->lo_ctl_mutex);\n\tif (lo->lo_flags & LO_FLAGS_AUTOCLEAR) {\n\t\t/*\n\t\t * In autoclear mode, stop the loop thread\n\t\t * and remove configuration after last close.\n\t\t */\n\t\terr = loop_clr_fd(lo);\n\t\tif (!err)\n\t\t\treturn;\n\t} else if (lo->lo_state == Lo_bound) {\n\t\t/*\n\t\t * Otherwise keep thread (if running) and config,\n\t\t * but flush possible ongoing bios in thread.\n\t\t */\n\t\tblk_mq_freeze_queue(lo->lo_queue);\n\t\tblk_mq_unfreeze_queue(lo->lo_queue);\n\t}\n\n \tmutex_unlock(&lo->lo_ctl_mutex);\n }\n", + "target": "static void lo_release(struct gendisk *disk, fmode_t mode)\nstatic void __lo_release(struct loop_device *lo)\n {\n \tint err;\n \n \tif (atomic_dec_return(&lo->lo_refcnt))\n\t\treturn;\n\n\tmutex_lock(&lo->lo_ctl_mutex);\n\tif (lo->lo_flags & LO_FLAGS_AUTOCLEAR) {\n\t\t/*\n\t\t * In autoclear mode, stop the loop thread\n\t\t * and remove configuration after last close.\n\t\t */\n\t\terr = loop_clr_fd(lo);\n\t\tif (!err)\n\t\t\treturn;\n\t} else if (lo->lo_state == Lo_bound) {\n\t\t/*\n\t\t * Otherwise keep thread (if running) and config,\n\t\t * but flush possible ongoing bios in thread.\n\t\t */\n\t\tblk_mq_freeze_queue(lo->lo_queue);\n\t\tblk_mq_unfreeze_queue(lo->lo_queue);\n\t}\n\n \tmutex_unlock(&lo->lo_ctl_mutex);\n }\n", + "vul_type": "cwe-416", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#29014da83e5fc358d6bff0f574e9ed45e61a35ac", + "input": "WebContext* WebContext::FromBrowserContext(oxide::BrowserContext* context) {\n BrowserContextDelegate* delegate =\n static_cast(context->GetDelegate());\n if (!delegate) {\n return nullptr;\n }\n\n return delegate->context();\n }\n", + "target": "WebContext* WebContext::FromBrowserContext(oxide::BrowserContext* context) {\nWebContext* WebContext::FromBrowserContext(BrowserContext* context) {\n BrowserContextDelegate* delegate =\n static_cast(context->GetDelegate());\n if (!delegate) {\n return nullptr;\n }\n\n return delegate->context();\n }\n", + "vul_type": "cwe-20", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#8b10426dcc0246c1712a99460dd470dcb1cc4d9c", + "input": " create_response(const char *nurl, const char *method, unsigned int *rp_code)\n {\n char *page, *fpath;\n struct MHD_Response *resp = NULL;\n \n if (!strncmp(nurl, URL_BASE_API_1_1, strlen(URL_BASE_API_1_1))) {\n resp = create_response_api(nurl, method, rp_code);\n } else {\n fpath = get_path(nurl, server_data.www_dir);\n \n resp = create_response_file(nurl, method, rp_code, fpath);\n \n free(fpath);\n }\n}\n", + "target": " create_response(const char *nurl, const char *method, unsigned int *rp_code)\n {\n char *page, *fpath, *rpath;\n struct MHD_Response *resp = NULL;\n int n;\n \n if (!strncmp(nurl, URL_BASE_API_1_1, strlen(URL_BASE_API_1_1))) {\n resp = create_response_api(nurl, method, rp_code);\n } else {\n fpath = get_path(nurl, server_data.www_dir);\n \n rpath = realpath(fpath, NULL);\n if (rpath) {\n n = strlen(server_data.www_dir);\n if (!strncmp(server_data.www_dir, rpath, n))\n resp = create_response_file(nurl,\n method,\n rp_code,\n fpath);\n free(rpath);\n }\n \n free(fpath);\n }\n}\n", + "vul_type": "cwe-22", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f911e11e7f6b5c0d6f5ee694a9871de6619889f7", + "input": "std::unique_ptr EffectPaintPropertyNode::ToJSON() const {\n auto json = JSONObject::Create();\n if (Parent())\n json->SetString(\"parent\", String::Format(\"%p\", Parent()));\n json->SetString(\"localTransformSpace\",\n String::Format(\"%p\", state_.local_transform_space.get()));\n json->SetString(\"outputClip\", String::Format(\"%p\", state_.output_clip.get()));\n if (state_.color_filter != kColorFilterNone)\n json->SetInteger(\"colorFilter\", state_.color_filter);\n if (!state_.filter.IsEmpty())\n json->SetString(\"filter\", state_.filter.ToString());\n if (state_.opacity != 1.0f)\n json->SetDouble(\"opacity\", state_.opacity);\n if (state_.blend_mode != SkBlendMode::kSrcOver)\n json->SetString(\"blendMode\", SkBlendMode_Name(state_.blend_mode));\n if (state_.direct_compositing_reasons != CompositingReason::kNone) {\n json->SetString(\n \"directCompositingReasons\",\n CompositingReason::ToString(state_.direct_compositing_reasons));\n }\n if (state_.compositor_element_id) {\n json->SetString(\"compositorElementId\",\n state_.compositor_element_id.ToString().c_str());\n }\n if (state_.paint_offset != FloatPoint())\n json->SetString(\"paintOffset\", state_.paint_offset.ToString());\n return json;\n}\n", + "target": "std::unique_ptr EffectPaintPropertyNode::ToJSON() const {\n auto json = JSONObject::Create();\n if (Parent())\n json->SetString(\"parent\", String::Format(\"%p\", Parent()));\n json->SetString(\"localTransformSpace\",\n String::Format(\"%p\", state_.local_transform_space));\n json->SetString(\"outputClip\", String::Format(\"%p\", state_.output_clip));\n if (state_.color_filter != kColorFilterNone)\n json->SetInteger(\"colorFilter\", state_.color_filter);\n if (!state_.filter.IsEmpty())\n json->SetString(\"filter\", state_.filter.ToString());\n if (state_.opacity != 1.0f)\n json->SetDouble(\"opacity\", state_.opacity);\n if (state_.blend_mode != SkBlendMode::kSrcOver)\n json->SetString(\"blendMode\", SkBlendMode_Name(state_.blend_mode));\n if (state_.direct_compositing_reasons != CompositingReason::kNone) {\n json->SetString(\n \"directCompositingReasons\",\n CompositingReason::ToString(state_.direct_compositing_reasons));\n }\n if (state_.compositor_element_id) {\n json->SetString(\"compositorElementId\",\n state_.compositor_element_id.ToString().c_str());\n }\n if (state_.paint_offset != FloatPoint())\n json->SetString(\"paintOffset\", state_.paint_offset.ToString());\n return json;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7b2d314a61fd0e12f47c62996cb49ec0d1ba747a", + "input": "JBIG2Bitmap::JBIG2Bitmap(Guint segNumA, int wA, int hA):\n JBIG2Segment(segNumA)\n{\n w = wA;\n h = hA;\n line = (wA + 7) >> 3;\n\n if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) {\n error(-1, \"invalid width/height\");\n data = NULL;\n return;\n }\n data = (Guchar *)gmalloc(h * line + 1);\n data[h * line] = 0;\n }\n", + "target": "JBIG2Bitmap::JBIG2Bitmap(Guint segNumA, int wA, int hA):\n JBIG2Segment(segNumA)\n{\n w = wA;\n h = hA;\n line = (wA + 7) >> 3;\n\n if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) {\n error(-1, \"invalid width/height\");\n data = NULL;\n return;\n }\n data = (Guchar *)gmallocn(h, line + 1);\n data[h * line] = 0;\n }\n", + "vul_type": "cwe-189", + "lang": "cpp", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d661684cf6820331feae71146c35da83d794467e", + "input": "static __inline__ int scm_check_creds(struct ucred *creds)\n{\n\tconst struct cred *cred = current_cred();\n\tkuid_t uid = make_kuid(cred->user_ns, creds->uid);\n\tkgid_t gid = make_kgid(cred->user_ns, creds->gid);\n\n\tif (!uid_valid(uid) || !gid_valid(gid))\n \t\treturn -EINVAL;\n \n \tif ((creds->pid == task_tgid_vnr(current) ||\n\t ns_capable(current->nsproxy->pid_ns->user_ns, CAP_SYS_ADMIN)) &&\n \t ((uid_eq(uid, cred->uid) || uid_eq(uid, cred->euid) ||\n \t uid_eq(uid, cred->suid)) || nsown_capable(CAP_SETUID)) &&\n \t ((gid_eq(gid, cred->gid) || gid_eq(gid, cred->egid) ||\n\t gid_eq(gid, cred->sgid)) || nsown_capable(CAP_SETGID))) {\n\t return 0;\n\t}\n\treturn -EPERM;\n}\n", + "target": "static __inline__ int scm_check_creds(struct ucred *creds)\n{\n\tconst struct cred *cred = current_cred();\n\tkuid_t uid = make_kuid(cred->user_ns, creds->uid);\n\tkgid_t gid = make_kgid(cred->user_ns, creds->gid);\n\n\tif (!uid_valid(uid) || !gid_valid(gid))\n \t\treturn -EINVAL;\n \n \tif ((creds->pid == task_tgid_vnr(current) ||\n\t ns_capable(task_active_pid_ns(current)->user_ns, CAP_SYS_ADMIN)) &&\n \t ((uid_eq(uid, cred->uid) || uid_eq(uid, cred->euid) ||\n \t uid_eq(uid, cred->suid)) || nsown_capable(CAP_SETUID)) &&\n \t ((gid_eq(gid, cred->gid) || gid_eq(gid, cred->egid) ||\n\t gid_eq(gid, cred->sgid)) || nsown_capable(CAP_SETGID))) {\n\t return 0;\n\t}\n\treturn -EPERM;\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#fda4e2e85589191b123d31cdc21fd33ee70f50fd", + "input": "void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr)\n {\n\tvcpu->arch.apic->vapic_addr = vapic_addr;\n\tif (vapic_addr)\n \t\t__set_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention);\n\telse\n \t\t__clear_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention);\n }\n", + "target": "void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr)\nint kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr)\n {\n\tif (vapic_addr) {\n\t\tif (kvm_gfn_to_hva_cache_init(vcpu->kvm,\n\t\t\t\t\t&vcpu->arch.apic->vapic_cache,\n\t\t\t\t\tvapic_addr, sizeof(u32)))\n\t\t\treturn -EINVAL;\n \t\t__set_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention);\n\t} else {\n \t\t__clear_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention);\n\t}\n\n\tvcpu->arch.apic->vapic_addr = vapic_addr;\n\treturn 0;\n }\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#19190765882e272a6a2162c89acdb29110f7e3cf", + "input": "void BuildCommitCommand::ExecuteImpl(SyncSession* session) {\n ClientToServerMessage message;\n message.set_share(session->context()->account_name());\n message.set_message_contents(ClientToServerMessage::COMMIT);\n\n CommitMessage* commit_message = message.mutable_commit();\n commit_message->set_cache_guid(\n session->write_transaction()->directory()->cache_guid());\n AddExtensionsActivityToMessage(session, commit_message);\n SyncerProtoUtil::AddRequestBirthday(\n session->write_transaction()->directory(), &message);\n\n std::map > position_map;\n\n const vector& commit_ids = session->status_controller()->commit_ids();\n for (size_t i = 0; i < commit_ids.size(); i++) {\n Id id = commit_ids[i];\n SyncEntity* sync_entry =\n static_cast(commit_message->add_entries());\n sync_entry->set_id(id);\n MutableEntry meta_entry(session->write_transaction(),\n syncable::GET_BY_ID,\n id);\n CHECK(meta_entry.good());\n meta_entry.Put(syncable::SYNCING, true);\n\n DCHECK(0 != session->routing_info().count(meta_entry.GetModelType()))\n << \"Committing change to datatype that's not actively enabled.\";\n\n string name = meta_entry.Get(syncable::NON_UNIQUE_NAME);\n CHECK(!name.empty()); // Make sure this isn't an update.\n TruncateUTF8ToByteSize(name, 255, &name);\n sync_entry->set_name(name);\n\n sync_entry->set_non_unique_name(name);\n\n if (!meta_entry.Get(syncable::UNIQUE_CLIENT_TAG).empty()) {\n sync_entry->set_client_defined_unique_tag(\n meta_entry.Get(syncable::UNIQUE_CLIENT_TAG));\n }\n\n Id new_parent_id;\n if (meta_entry.Get(syncable::IS_DEL) &&\n !meta_entry.Get(syncable::PARENT_ID).ServerKnows()) {\n new_parent_id = session->write_transaction()->root_id();\n } else {\n new_parent_id = meta_entry.Get(syncable::PARENT_ID);\n }\n sync_entry->set_parent_id(new_parent_id);\n\n if (new_parent_id != meta_entry.Get(syncable::SERVER_PARENT_ID) &&\n 0 != meta_entry.Get(syncable::BASE_VERSION) &&\n syncable::CHANGES_VERSION != meta_entry.Get(syncable::BASE_VERSION)) {\n sync_entry->set_old_parent_id(meta_entry.Get(syncable::SERVER_PARENT_ID));\n }\n\n int64 version = meta_entry.Get(syncable::BASE_VERSION);\n if (syncable::CHANGES_VERSION == version || 0 == version) {\n DCHECK(!id.ServerKnows() ||\n !meta_entry.Get(syncable::UNIQUE_CLIENT_TAG).empty())\n << meta_entry;\n\n sync_entry->set_version(0);\n } else {\n DCHECK(id.ServerKnows()) << meta_entry;\n sync_entry->set_version(meta_entry.Get(syncable::BASE_VERSION));\n }\n sync_entry->set_ctime(TimeToProtoTime(meta_entry.Get(syncable::CTIME)));\n sync_entry->set_mtime(TimeToProtoTime(meta_entry.Get(syncable::MTIME)));\n \n if (meta_entry.Get(IS_DEL)) {\n sync_entry->set_deleted(true);\n } else {\n if (meta_entry.Get(SPECIFICS).HasExtension(sync_pb::bookmark)) {\n const Id& prev_id = meta_entry.Get(syncable::PREV_ID);\n string prev_id_string =\n prev_id.IsRoot() ? string() : prev_id.GetServerId();\n sync_entry->set_insert_after_item_id(prev_id_string);\n\n std::pair position_block(\n GetFirstPosition(), GetLastPosition());\n std::map >::iterator prev_pos =\n position_map.find(prev_id);\n if (prev_pos != position_map.end()) {\n position_block = prev_pos->second;\n position_map.erase(prev_pos);\n } else {\n position_block = std::make_pair(\n FindAnchorPosition(syncable::PREV_ID, meta_entry),\n FindAnchorPosition(syncable::NEXT_ID, meta_entry));\n }\n position_block.first = InterpolatePosition(position_block.first,\n position_block.second);\n\n position_map[id] = position_block;\n sync_entry->set_position_in_parent(position_block.first);\n }\n SetEntrySpecifics(&meta_entry, sync_entry);\n }\n }\n session->status_controller()->mutable_commit_message()->CopyFrom(message);\n}\n", + "target": "void BuildCommitCommand::ExecuteImpl(SyncSession* session) {\n ClientToServerMessage message;\n message.set_share(session->context()->account_name());\n message.set_message_contents(ClientToServerMessage::COMMIT);\n\n CommitMessage* commit_message = message.mutable_commit();\n commit_message->set_cache_guid(\n session->write_transaction()->directory()->cache_guid());\n AddExtensionsActivityToMessage(session, commit_message);\n SyncerProtoUtil::AddRequestBirthday(\n session->write_transaction()->directory(), &message);\n\n std::map > position_map;\n\n const vector& commit_ids = session->status_controller()->commit_ids();\n for (size_t i = 0; i < commit_ids.size(); i++) {\n Id id = commit_ids[i];\n SyncEntity* sync_entry =\n static_cast(commit_message->add_entries());\n sync_entry->set_id(id);\n MutableEntry meta_entry(session->write_transaction(),\n syncable::GET_BY_ID,\n id);\n CHECK(meta_entry.good());\n meta_entry.Put(syncable::SYNCING, true);\n\n DCHECK(0 != session->routing_info().count(meta_entry.GetModelType()))\n << \"Committing change to datatype that's not actively enabled.\";\n\n string name = meta_entry.Get(syncable::NON_UNIQUE_NAME);\n CHECK(!name.empty()); // Make sure this isn't an update.\n TruncateUTF8ToByteSize(name, 255, &name);\n sync_entry->set_name(name);\n\n sync_entry->set_non_unique_name(name);\n\n if (!meta_entry.Get(syncable::UNIQUE_CLIENT_TAG).empty()) {\n sync_entry->set_client_defined_unique_tag(\n meta_entry.Get(syncable::UNIQUE_CLIENT_TAG));\n }\n\n Id new_parent_id;\n if (meta_entry.Get(syncable::IS_DEL) &&\n !meta_entry.Get(syncable::PARENT_ID).ServerKnows()) {\n new_parent_id = session->write_transaction()->root_id();\n } else {\n new_parent_id = meta_entry.Get(syncable::PARENT_ID);\n }\n sync_entry->set_parent_id(new_parent_id);\n\n if (new_parent_id != meta_entry.Get(syncable::SERVER_PARENT_ID) &&\n 0 != meta_entry.Get(syncable::BASE_VERSION) &&\n syncable::CHANGES_VERSION != meta_entry.Get(syncable::BASE_VERSION)) {\n sync_entry->set_old_parent_id(meta_entry.Get(syncable::SERVER_PARENT_ID));\n }\n\n int64 version = meta_entry.Get(syncable::BASE_VERSION);\n if (syncable::CHANGES_VERSION == version || 0 == version) {\n DCHECK(!id.ServerKnows() ||\n !meta_entry.Get(syncable::UNIQUE_CLIENT_TAG).empty())\n << meta_entry;\n\n sync_entry->set_version(0);\n } else {\n DCHECK(id.ServerKnows()) << meta_entry;\n sync_entry->set_version(meta_entry.Get(syncable::BASE_VERSION));\n }\n sync_entry->set_ctime(ClientTimeToServerTime(\n meta_entry.Get(syncable::CTIME)));\n sync_entry->set_mtime(ClientTimeToServerTime(\n meta_entry.Get(syncable::MTIME)));\n \n if (meta_entry.Get(IS_DEL)) {\n sync_entry->set_deleted(true);\n } else {\n if (meta_entry.Get(SPECIFICS).HasExtension(sync_pb::bookmark)) {\n const Id& prev_id = meta_entry.Get(syncable::PREV_ID);\n string prev_id_string =\n prev_id.IsRoot() ? string() : prev_id.GetServerId();\n sync_entry->set_insert_after_item_id(prev_id_string);\n\n std::pair position_block(\n GetFirstPosition(), GetLastPosition());\n std::map >::iterator prev_pos =\n position_map.find(prev_id);\n if (prev_pos != position_map.end()) {\n position_block = prev_pos->second;\n position_map.erase(prev_pos);\n } else {\n position_block = std::make_pair(\n FindAnchorPosition(syncable::PREV_ID, meta_entry),\n FindAnchorPosition(syncable::NEXT_ID, meta_entry));\n }\n position_block.first = InterpolatePosition(position_block.first,\n position_block.second);\n\n position_map[id] = position_block;\n sync_entry->set_position_in_parent(position_block.first);\n }\n SetEntrySpecifics(&meta_entry, sync_entry);\n }\n }\n session->status_controller()->mutable_commit_message()->CopyFrom(message);\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7fafcfdf6377b18b2a726ea554d6e593ba44349f", + "input": "static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)\n{\n\tstruct f_midi *midi = func_to_midi(f);\n\tunsigned i;\n\tint err;\n\n\t/* we only set alt for MIDIStreaming interface */\n\tif (intf != midi->ms_id)\n\t\treturn 0;\n\n\terr = f_midi_start_ep(midi, f, midi->in_ep);\n\tif (err)\n\t\treturn err;\n\n\terr = f_midi_start_ep(midi, f, midi->out_ep);\n\tif (err)\n\t\treturn err;\n\n\t/* pre-allocate write usb requests to use on f_midi_transmit. */\n\twhile (kfifo_avail(&midi->in_req_fifo)) {\n\t\tstruct usb_request *req =\n\t\t\tmidi_alloc_ep_req(midi->in_ep, midi->buflen);\n\n\t\tif (req == NULL)\n\t\t\treturn -ENOMEM;\n\n\t\treq->length = 0;\n\t\treq->complete = f_midi_complete;\n\n\t\tkfifo_put(&midi->in_req_fifo, req);\n\t}\n\n\t/* allocate a bunch of read buffers and queue them all at once. */\n\tfor (i = 0; i < midi->qlen && err == 0; i++) {\n\t\tstruct usb_request *req =\n\t\t\tmidi_alloc_ep_req(midi->out_ep, midi->buflen);\n\n\t\tif (req == NULL)\n\t\t\treturn -ENOMEM;\n\n\t\treq->complete = f_midi_complete;\n\t\terr = usb_ep_queue(midi->out_ep, req, GFP_ATOMIC);\n \t\tif (err) {\n \t\t\tERROR(midi, \"%s: couldn't enqueue request: %d\\n\",\n \t\t\t\t midi->out_ep->name, err);\n\t\t\tfree_ep_req(midi->out_ep, req);\n \t\t\treturn err;\n \t\t}\n \t}\n\n\treturn 0;\n}\n", + "target": "static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)\n{\n\tstruct f_midi *midi = func_to_midi(f);\n\tunsigned i;\n\tint err;\n\n\t/* we only set alt for MIDIStreaming interface */\n\tif (intf != midi->ms_id)\n\t\treturn 0;\n\n\terr = f_midi_start_ep(midi, f, midi->in_ep);\n\tif (err)\n\t\treturn err;\n\n\terr = f_midi_start_ep(midi, f, midi->out_ep);\n\tif (err)\n\t\treturn err;\n\n\t/* pre-allocate write usb requests to use on f_midi_transmit. */\n\twhile (kfifo_avail(&midi->in_req_fifo)) {\n\t\tstruct usb_request *req =\n\t\t\tmidi_alloc_ep_req(midi->in_ep, midi->buflen);\n\n\t\tif (req == NULL)\n\t\t\treturn -ENOMEM;\n\n\t\treq->length = 0;\n\t\treq->complete = f_midi_complete;\n\n\t\tkfifo_put(&midi->in_req_fifo, req);\n\t}\n\n\t/* allocate a bunch of read buffers and queue them all at once. */\n\tfor (i = 0; i < midi->qlen && err == 0; i++) {\n\t\tstruct usb_request *req =\n\t\t\tmidi_alloc_ep_req(midi->out_ep, midi->buflen);\n\n\t\tif (req == NULL)\n\t\t\treturn -ENOMEM;\n\n\t\treq->complete = f_midi_complete;\n\t\terr = usb_ep_queue(midi->out_ep, req, GFP_ATOMIC);\n \t\tif (err) {\n \t\t\tERROR(midi, \"%s: couldn't enqueue request: %d\\n\",\n \t\t\t\t midi->out_ep->name, err);\n\t\t\tif (req->buf != NULL)\n\t\t\t\tfree_ep_req(midi->out_ep, req);\n \t\t\treturn err;\n \t\t}\n \t}\n\n\treturn 0;\n}\n", + "vul_type": "cwe-415", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0bfc96cb77224736dfa35c3c555d37b3646ef35e", + "input": "static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode,\n \t\t\t unsigned int cmd, unsigned long arg)\n {\n \tstruct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device;\n \n \t/*\n \t * If we are in the middle of error recovery, don't let anyone\n\t * else try and use this device. Also, if error recovery fails, it\n\t * may try and take the device offline, in which case all further\n\t * access to the device is prohibited.\n\t */\n\tif (!scsi_block_when_processing_errors(sdev))\n \t\treturn -ENODEV;\n \t \n \tif (sdev->host->hostt->compat_ioctl) {\n\t\tint ret;\n \t\tret = sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg);\n \n \t\treturn ret;\n\t}\n\n\t/* \n\t * Let the static ioctl translation table take care of it.\n\t */\n\treturn -ENOIOCTLCMD; \n}\n", + "target": "static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode,\n \t\t\t unsigned int cmd, unsigned long arg)\n {\n \tstruct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device;\n\tint ret;\n\n\tret = scsi_verify_blk_ioctl(bdev, cmd);\n\tif (ret < 0)\n\t\treturn ret;\n \n \t/*\n \t * If we are in the middle of error recovery, don't let anyone\n\t * else try and use this device. Also, if error recovery fails, it\n\t * may try and take the device offline, in which case all further\n\t * access to the device is prohibited.\n\t */\n\tif (!scsi_block_when_processing_errors(sdev))\n \t\treturn -ENODEV;\n \t \n \tif (sdev->host->hostt->compat_ioctl) {\n \t\tret = sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg);\n \n \t\treturn ret;\n\t}\n\n\t/* \n\t * Let the static ioctl translation table take care of it.\n\t */\n\treturn -ENOIOCTLCMD; \n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "cwe-079#4-62957905f62d", + "input": "def list_editor_workflows(request): \n workflows = [d.content_object.to_dict() for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]\n\n return render('editor/list_editor_workflows.mako', request, {\n 'workflows_json': json.dumps(workflows)\n })", + "target": "def list_editor_workflows(request): \n workflows = [d.content_object.to_dict() for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]\n\n return render('editor/list_editor_workflows.mako', request, {\n 'workflows_json': json.dumps(workflows, cls=JSONEncoderForHTML)\n })", + "vul_type": "cwe-079", + "lang": "python", + "source": "sven" + }, + { + "problem_id": "bigvul#validation#91f2fa59e8ed80dfbf400add0164ee0e508e412a", + "input": "cJSON *cJSON_Parse( const char *value )\n {\n\tcJSON *c;\n\tep = 0;\n\tif ( ! ( c = cJSON_New_Item() ) )\n\t\treturn 0;\t/* memory fail */\n \n\tif ( ! parse_value( c, skip( value ) ) ) {\n\t\tcJSON_Delete( c );\n\t\treturn 0;\n\t}\n \treturn c;\n }\n", + "target": "cJSON *cJSON_Parse( const char *value )\ncJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated)\n {\n\tconst char *end=0,**ep=return_parse_end?return_parse_end:&global_ep;\n\tcJSON *c=cJSON_New_Item();\n\t*ep=0;\n\tif (!c) return 0; /* memory fail */\n \n\tend=parse_value(c,skip(value),ep);\n\tif (!end)\t{cJSON_Delete(c);return 0;}\t/* parse failure. ep is set. */\n\n\t/* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */\n\tif (require_null_terminated) {end=skip(end);if (*end) {cJSON_Delete(c);*ep=end;return 0;}}\n\tif (return_parse_end) *return_parse_end=end;\n \treturn c;\n }\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0e3b0c22a5c596bdc24a391b3f02952c1c3e4f1b", + "input": "void Location::SetLocation(const String& url,\n LocalDOMWindow* current_window,\n LocalDOMWindow* entered_window,\n ExceptionState* exception_state,\n SetLocationPolicy set_location_policy) {\n if (!IsAttached())\n return;\n\n if (!current_window->GetFrame())\n return;\n\n Document* entered_document = entered_window->document();\n if (!entered_document)\n return;\n\n KURL completed_url = entered_document->CompleteURL(url);\n if (completed_url.IsNull())\n return;\n\n if (!current_window->GetFrame()->CanNavigate(*dom_window_->GetFrame(),\n completed_url)) {\n if (exception_state) {\n exception_state->ThrowSecurityError(\n \"The current window does not have permission to navigate the target \"\n \"frame to '\" +\n url + \"'.\");\n }\n return;\n }\n if (exception_state && !completed_url.IsValid()) {\n exception_state->ThrowDOMException(DOMExceptionCode::kSyntaxError,\n \"'\" + url + \"' is not a valid URL.\");\n return;\n }\n\n if (dom_window_->IsInsecureScriptAccess(*current_window, completed_url))\n return;\n \n V8DOMActivityLogger* activity_logger =\n V8DOMActivityLogger::CurrentActivityLoggerIfIsolatedWorld();\n if (activity_logger) {\n Vector argv;\n argv.push_back(\"LocalDOMWindow\");\n argv.push_back(\"url\");\n argv.push_back(entered_document->Url());\n argv.push_back(completed_url);\n activity_logger->LogEvent(\"blinkSetAttribute\", argv.size(), argv.data());\n }\n WebFrameLoadType frame_load_type = WebFrameLoadType::kStandard;\n if (set_location_policy == SetLocationPolicy::kReplaceThisFrame)\n frame_load_type = WebFrameLoadType::kReplaceCurrentItem;\n dom_window_->GetFrame()->ScheduleNavigation(*current_window->document(),\n completed_url, frame_load_type,\n UserGestureStatus::kNone);\n}\n", + "target": "void Location::SetLocation(const String& url,\n LocalDOMWindow* current_window,\n LocalDOMWindow* entered_window,\n ExceptionState* exception_state,\n SetLocationPolicy set_location_policy) {\n if (!IsAttached())\n return;\n\n if (!current_window->GetFrame())\n return;\n\n Document* entered_document = entered_window->document();\n if (!entered_document)\n return;\n\n KURL completed_url = entered_document->CompleteURL(url);\n if (completed_url.IsNull())\n return;\n\n if (!current_window->GetFrame()->CanNavigate(*dom_window_->GetFrame(),\n completed_url)) {\n if (exception_state) {\n exception_state->ThrowSecurityError(\n \"The current window does not have permission to navigate the target \"\n \"frame to '\" +\n url + \"'.\");\n }\n return;\n }\n if (exception_state && !completed_url.IsValid()) {\n exception_state->ThrowDOMException(DOMExceptionCode::kSyntaxError,\n \"'\" + url + \"' is not a valid URL.\");\n return;\n }\n\n if (dom_window_->IsInsecureScriptAccess(*current_window, completed_url))\n return;\n \n // Check the source browsing context's CSP to fulfill the CSP check\n // requirement of https://html.spec.whatwg.org/#navigate for javascript URLs.\n // Although the spec states we should perform this check on task execution,\n // we do this prior to dispatch since the parent frame's CSP may be\n // inaccessible if the target frame is out of process.\n Document* current_document = current_window->document();\n if (current_document && completed_url.ProtocolIsJavaScript() &&\n !ContentSecurityPolicy::ShouldBypassMainWorld(current_document)) {\n String script_source = DecodeURLEscapeSequences(completed_url.GetString());\n if (!current_document->GetContentSecurityPolicy()->AllowJavaScriptURLs(\n nullptr, script_source, current_document->Url(), OrdinalNumber())) {\n return;\n }\n }\n\n V8DOMActivityLogger* activity_logger =\n V8DOMActivityLogger::CurrentActivityLoggerIfIsolatedWorld();\n if (activity_logger) {\n Vector argv;\n argv.push_back(\"LocalDOMWindow\");\n argv.push_back(\"url\");\n argv.push_back(entered_document->Url());\n argv.push_back(completed_url);\n activity_logger->LogEvent(\"blinkSetAttribute\", argv.size(), argv.data());\n }\n WebFrameLoadType frame_load_type = WebFrameLoadType::kStandard;\n if (set_location_policy == SetLocationPolicy::kReplaceThisFrame)\n frame_load_type = WebFrameLoadType::kReplaceCurrentItem;\n dom_window_->GetFrame()->ScheduleNavigation(*current_window->document(),\n completed_url, frame_load_type,\n UserGestureStatus::kNone);\n}\n", + "vul_type": "cwe-20", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6a60f01228557982e6508c5919cc21fcfddf110b", + "input": " ComponentControllerImpl::ComponentControllerImpl(WebContentRunner* runner)\n : runner_(runner),\n controller_binding_(this),\n frame_observer_binding_(this) {\n DCHECK(runner);\n }\n", + "target": " ComponentControllerImpl::ComponentControllerImpl(WebContentRunner* runner)\n : runner_(runner), controller_binding_(this) {\n DCHECK(runner);\n }\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#36773850210becda3d76f27285ecd899fafdfc72", + "input": "void V8Window::namedPropertyGetterCustom(v8::Local name, const v8::PropertyCallbackInfo& info)\n{\n\n DOMWindow* window = V8Window::toNative(info.Holder());\n if (!window)\n return;\n\n Frame* frame = window->frame();\n if (!frame)\n return;\n\n AtomicString propName = toWebCoreAtomicString(name);\n Frame* child = frame->tree().scopedChild(propName);\n if (child) {\n v8SetReturnValueFast(info, child->domWindow(), window);\n return;\n }\n\n if (!info.Holder()->GetRealNamedProperty(name).IsEmpty())\n return;\n\n Document* doc = frame->document();\n \n if (doc && doc->isHTMLDocument()) {\n if (toHTMLDocument(doc)->hasNamedItem(propName.impl()) || doc->hasElementWithId(propName.impl())) {\n RefPtr items = doc->windowNamedItems(propName);\n if (!items->isEmpty()) {\n if (items->hasExactlyOneItem()) {\n v8SetReturnValueFast(info, items->item(0), window);\n return;\n }\n v8SetReturnValueFast(info, items.release(), window);\n return;\n }\n }\n }\n}\n", + "target": "void V8Window::namedPropertyGetterCustom(v8::Local name, const v8::PropertyCallbackInfo& info)\n{\n\n DOMWindow* window = V8Window::toNative(info.Holder());\n if (!window)\n return;\n\n Frame* frame = window->frame();\n if (!frame)\n return;\n\n AtomicString propName = toWebCoreAtomicString(name);\n Frame* child = frame->tree().scopedChild(propName);\n if (child) {\n v8SetReturnValueFast(info, child->domWindow(), window);\n return;\n }\n\n if (!info.Holder()->GetRealNamedProperty(name).IsEmpty())\n return;\n\n Document* doc = frame->document();\n \n if (doc && doc->isHTMLDocument()) {\n if (toHTMLDocument(doc)->hasNamedItem(propName) || doc->hasElementWithId(propName.impl())) {\n RefPtr items = doc->windowNamedItems(propName);\n if (!items->isEmpty()) {\n if (items->hasExactlyOneItem()) {\n v8SetReturnValueFast(info, items->item(0), window);\n return;\n }\n v8SetReturnValueFast(info, items.release(), window);\n return;\n }\n }\n }\n}\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#d4cd2b2c0953ad7e9fa988c234eb9361be80fe81", + "input": " bool InspectorOverlay::isEmpty()\n {\n bool hasAlwaysVisibleElements = m_highlightNode || m_eventTargetNode || m_highlightQuad || m_overrides || !m_size.isEmpty() || m_drawViewSize;\n bool hasInvisibleInInspectModeElements = !m_pausedInDebuggerMessage.isNull();\n return !(hasAlwaysVisibleElements || (hasInvisibleInInspectModeElements && !m_inspectModeEnabled));\n }\n", + "target": " bool InspectorOverlay::isEmpty()\n {\n bool hasAlwaysVisibleElements = m_highlightNode || m_eventTargetNode || m_highlightQuad || !m_size.isEmpty() || m_drawViewSize;\n bool hasInvisibleInInspectModeElements = !m_pausedInDebuggerMessage.isNull();\n return !(hasAlwaysVisibleElements || (hasInvisibleInInspectModeElements && !m_inspectModeEnabled));\n }\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#6e5714eaf77d79ae1c8b47e3e040ff5411b717ec", + "input": " unsigned int get_random_int(void)\n {\n\tstruct keydata *keyptr;\n \t__u32 *hash = get_cpu_var(get_random_int_hash);\n\tint ret;\n \n\tkeyptr = get_keyptr();\n \thash[0] += current->pid + jiffies + get_cycles();\n\tret = half_md4_transform(hash, keyptr->secret);\n \tput_cpu_var(get_random_int_hash);\n \n \treturn ret;\n}\n", + "target": " unsigned int get_random_int(void)\n {\n \t__u32 *hash = get_cpu_var(get_random_int_hash);\n\tunsigned int ret;\n \n \thash[0] += current->pid + jiffies + get_cycles();\n\tmd5_transform(hash, random_int_secret);\n\tret = hash[0];\n \tput_cpu_var(get_random_int_hash);\n \n \treturn ret;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0", + "input": "RenderProcessImpl::RenderProcessImpl()\n : ALLOW_THIS_IN_INITIALIZER_LIST(shared_mem_cache_cleaner_(\n FROM_HERE, base::TimeDelta::FromSeconds(5),\n this, &RenderProcessImpl::ClearTransportDIBCache)),\n transport_dib_next_sequence_number_(0) {\n in_process_plugins_ = InProcessPlugins();\n for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i)\n shared_mem_cache_[i] = NULL;\n\n#if defined(OS_WIN)\n if (GetModuleHandle(L\"LPK.DLL\") == NULL) {\n typedef BOOL (__stdcall *GdiInitializeLanguagePack)(int LoadedShapingDLLs);\n GdiInitializeLanguagePack gdi_init_lpk =\n reinterpret_cast(GetProcAddress(\n GetModuleHandle(L\"GDI32.DLL\"),\n \"GdiInitializeLanguagePack\"));\n DCHECK(gdi_init_lpk);\n if (gdi_init_lpk) {\n gdi_init_lpk(0);\n }\n }\n#endif\n\n webkit_glue::SetJavaScriptFlags(\n \"--debugger-auto-break\"\n \" --prof --prof-lazy\");\n\n const CommandLine& command_line = *CommandLine::ForCurrentProcess();\n if (command_line.HasSwitch(switches::kJavaScriptFlags)) {\n webkit_glue::SetJavaScriptFlags(\n command_line.GetSwitchValueASCII(switches::kJavaScriptFlags));\n }\n}\n", + "target": "RenderProcessImpl::RenderProcessImpl()\n : ALLOW_THIS_IN_INITIALIZER_LIST(shared_mem_cache_cleaner_(\n FROM_HERE, base::TimeDelta::FromSeconds(5),\n this, &RenderProcessImpl::ClearTransportDIBCache)),\n transport_dib_next_sequence_number_(0),\n enabled_bindings_(0) {\n in_process_plugins_ = InProcessPlugins();\n for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i)\n shared_mem_cache_[i] = NULL;\n\n#if defined(OS_WIN)\n if (GetModuleHandle(L\"LPK.DLL\") == NULL) {\n typedef BOOL (__stdcall *GdiInitializeLanguagePack)(int LoadedShapingDLLs);\n GdiInitializeLanguagePack gdi_init_lpk =\n reinterpret_cast(GetProcAddress(\n GetModuleHandle(L\"GDI32.DLL\"),\n \"GdiInitializeLanguagePack\"));\n DCHECK(gdi_init_lpk);\n if (gdi_init_lpk) {\n gdi_init_lpk(0);\n }\n }\n#endif\n\n webkit_glue::SetJavaScriptFlags(\n \"--debugger-auto-break\"\n \" --prof --prof-lazy\");\n\n const CommandLine& command_line = *CommandLine::ForCurrentProcess();\n if (command_line.HasSwitch(switches::kJavaScriptFlags)) {\n webkit_glue::SetJavaScriptFlags(\n command_line.GetSwitchValueASCII(switches::kJavaScriptFlags));\n }\n}\n", + "vul_type": "cwe-264", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#821a5938d100458f4d09d634041b05c860554ce0", + "input": "static int g2m_init_buffers(G2MContext *c)\n{\n int aligned_height;\n\n if (!c->framebuf || c->old_width < c->width || c->old_height < c->height) {\n c->framebuf_stride = FFALIGN(c->width * 3, 16);\n aligned_height = FFALIGN(c->height, 16);\n av_free(c->framebuf);\n c->framebuf = av_mallocz(c->framebuf_stride * aligned_height);\n if (!c->framebuf)\n return AVERROR(ENOMEM);\n }\n if (!c->synth_tile || !c->jpeg_tile ||\n c->old_tile_w < c->tile_width ||\n c->old_tile_h < c->tile_height) {\n c->tile_stride = FFALIGN(c->tile_width * 3, 16);\n aligned_height = FFALIGN(c->tile_height, 16);\n av_free(c->synth_tile);\n av_free(c->jpeg_tile);\n av_free(c->kempf_buf);\n av_free(c->kempf_flags);\n c->synth_tile = av_mallocz(c->tile_stride * aligned_height);\n c->jpeg_tile = av_mallocz(c->tile_stride * aligned_height);\n c->kempf_buf = av_mallocz((c->tile_width + 1) * aligned_height\n + FF_INPUT_BUFFER_PADDING_SIZE);\n c->kempf_flags = av_mallocz( c->tile_width * aligned_height);\n if (!c->synth_tile || !c->jpeg_tile ||\n !c->kempf_buf || !c->kempf_flags)\n return AVERROR(ENOMEM);\n }\n\n return 0;\n}\n", + "target": "static int g2m_init_buffers(G2MContext *c)\n{\n int aligned_height;\n\n if (!c->framebuf || c->old_width < c->width || c->old_height < c->height) {\n c->framebuf_stride = FFALIGN(c->width * 3, 16);\n aligned_height = FFALIGN(c->height, 16);\n av_free(c->framebuf);\n c->framebuf = av_mallocz(c->framebuf_stride * aligned_height);\n if (!c->framebuf)\n return AVERROR(ENOMEM);\n }\n if (!c->synth_tile || !c->jpeg_tile ||\n c->old_tile_w < c->tile_width ||\n c->old_tile_h < c->tile_height) {\n c->tile_stride = FFALIGN(c->tile_width, 16) * 3;\n aligned_height = FFALIGN(c->tile_height, 16);\n av_free(c->synth_tile);\n av_free(c->jpeg_tile);\n av_free(c->kempf_buf);\n av_free(c->kempf_flags);\n c->synth_tile = av_mallocz(c->tile_stride * aligned_height);\n c->jpeg_tile = av_mallocz(c->tile_stride * aligned_height);\n c->kempf_buf = av_mallocz((c->tile_width + 1) * aligned_height\n + FF_INPUT_BUFFER_PADDING_SIZE);\n c->kempf_flags = av_mallocz( c->tile_width * aligned_height);\n if (!c->synth_tile || !c->jpeg_tile ||\n !c->kempf_buf || !c->kempf_flags)\n return AVERROR(ENOMEM);\n }\n\n return 0;\n}\n", + "vul_type": "cwe-189", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1", + "input": "SPL_METHOD(SplFileObject, fputcsv)\n{\n\tspl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);\n\tchar delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape;\n \tchar *delim = NULL, *enclo = NULL, *esc = NULL;\n \tint d_len = 0, e_len = 0, esc_len = 0, ret;\n \tzval *fields = NULL;\n \tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"a|sss\", &fields, &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) {\n \t\tswitch(ZEND_NUM_ARGS())\n \t\t{\n\t\tcase 4:\n\t\t\tif (esc_len != 1) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"escape must be a character\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tescape = esc[0];\n\t\t\t/* no break */\n\t\tcase 3:\n\t\t\tif (e_len != 1) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"enclosure must be a character\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tenclosure = enclo[0];\n\t\t\t/* no break */\n\t\tcase 2:\n\t\t\tif (d_len != 1) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"delimiter must be a character\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tdelimiter = delim[0];\n\t\t\t/* no break */\n\t\tcase 1:\n\t\tcase 0:\n\t\t\tbreak;\n\t\t}\n\t\tret = php_fputcsv(intern->u.file.stream, fields, delimiter, enclosure, escape TSRMLS_CC);\n\t\tRETURN_LONG(ret);\n\t}\n}\n", + "target": "SPL_METHOD(SplFileObject, fputcsv)\n{\n\tspl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);\n\tchar delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape;\n \tchar *delim = NULL, *enclo = NULL, *esc = NULL;\n \tint d_len = 0, e_len = 0, esc_len = 0, ret;\n \tzval *fields = NULL;\n\n \tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"a|sss\", &fields, &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) {\n \t\tswitch(ZEND_NUM_ARGS())\n \t\t{\n\t\tcase 4:\n\t\t\tif (esc_len != 1) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"escape must be a character\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tescape = esc[0];\n\t\t\t/* no break */\n\t\tcase 3:\n\t\t\tif (e_len != 1) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"enclosure must be a character\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tenclosure = enclo[0];\n\t\t\t/* no break */\n\t\tcase 2:\n\t\t\tif (d_len != 1) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"delimiter must be a character\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tdelimiter = delim[0];\n\t\t\t/* no break */\n\t\tcase 1:\n\t\tcase 0:\n\t\t\tbreak;\n\t\t}\n\t\tret = php_fputcsv(intern->u.file.stream, fields, delimiter, enclosure, escape TSRMLS_CC);\n\t\tRETURN_LONG(ret);\n\t}\n}\n", + "vul_type": "cwe-190", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#3ed3c6b79a7b9a60c475dd4936ad57b0b92fd600", + "input": "WORD32 ihevcd_create(iv_obj_t *ps_codec_obj,\n\n void *pv_api_ip,\n void *pv_api_op)\n {\n ihevcd_cxa_create_op_t *ps_create_op;\n \n WORD32 ret;\n codec_t *ps_codec;\n ps_create_op = (ihevcd_cxa_create_op_t *)pv_api_op;\n \n ps_create_op->s_ivd_create_op_t.u4_error_code = 0;\n ret = ihevcd_allocate_static_bufs(&ps_codec_obj, pv_api_ip, pv_api_op);\n \n /* If allocation of some buffer fails, then free buffers allocated till then */\n if((IV_FAIL == ret) && (NULL != ps_codec_obj))\n {\n ihevcd_free_static_bufs(ps_codec_obj);\n ps_create_op->s_ivd_create_op_t.u4_error_code = IVD_MEM_ALLOC_FAILED;\n ps_create_op->s_ivd_create_op_t.u4_error_code = 1 << IVD_FATALERROR;\n \n return IV_FAIL;\n }\n ps_codec = (codec_t *)ps_codec_obj->pv_codec_handle;\n ret = ihevcd_init(ps_codec);\n\n TRACE_INIT(NULL);\n STATS_INIT();\n\n return ret;\n}\n", + "target": "WORD32 ihevcd_create(iv_obj_t *ps_codec_obj,\n\n void *pv_api_ip,\n void *pv_api_op)\n {\n ihevcd_cxa_create_ip_t *ps_create_ip;\n ihevcd_cxa_create_op_t *ps_create_op;\n \n WORD32 ret;\n codec_t *ps_codec;\n ps_create_ip = (ihevcd_cxa_create_ip_t *)pv_api_ip;\n ps_create_op = (ihevcd_cxa_create_op_t *)pv_api_op;\n \n ps_create_op->s_ivd_create_op_t.u4_error_code = 0;\n ps_codec_obj = NULL;\n ret = ihevcd_allocate_static_bufs(&ps_codec_obj, pv_api_ip, pv_api_op);\n \n /* If allocation of some buffer fails, then free buffers allocated till then */\n if(IV_FAIL == ret)\n {\n if(NULL != ps_codec_obj)\n {\n if(ps_codec_obj->pv_codec_handle)\n {\n ihevcd_free_static_bufs(ps_codec_obj);\n }\n else\n {\n void (*pf_aligned_free)(void *pv_mem_ctxt, void *pv_buf);\n void *pv_mem_ctxt;\n\n pf_aligned_free = ps_create_ip->s_ivd_create_ip_t.pf_aligned_free;\n pv_mem_ctxt = ps_create_ip->s_ivd_create_ip_t.pv_mem_ctxt;\n pf_aligned_free(pv_mem_ctxt, ps_codec_obj);\n }\n }\n ps_create_op->s_ivd_create_op_t.u4_error_code = IVD_MEM_ALLOC_FAILED;\n ps_create_op->s_ivd_create_op_t.u4_error_code = 1 << IVD_FATALERROR;\n \n return IV_FAIL;\n }\n ps_codec = (codec_t *)ps_codec_obj->pv_codec_handle;\n ret = ihevcd_init(ps_codec);\n\n TRACE_INIT(NULL);\n STATS_INIT();\n\n return ret;\n}\n", + "vul_type": "cwe-770", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#f2fcfcd670257236ebf2088bbdf26f6a8ef459fe", + "input": "static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)\n{\n\tstruct l2cap_conf_rsp *rsp = (struct l2cap_conf_rsp *)data;\n\tu16 scid, flags, result;\n\tstruct sock *sk;\n\n\tscid = __le16_to_cpu(rsp->scid);\n\tflags = __le16_to_cpu(rsp->flags);\n\tresult = __le16_to_cpu(rsp->result);\n\n\tBT_DBG(\"scid 0x%4.4x flags 0x%2.2x result 0x%2.2x\",\n\t\t\tscid, flags, result);\n\n\tsk = l2cap_get_chan_by_scid(&conn->chan_list, scid);\n\tif (!sk)\n\t\treturn 0;\n\n\tswitch (result) {\n\tcase L2CAP_CONF_SUCCESS:\n \t\tbreak;\n \n \tcase L2CAP_CONF_UNACCEPT:\n\t\tif (++l2cap_pi(sk)->conf_retry < L2CAP_CONF_MAX_RETRIES) {\n\t\t\tchar req[128];\n\t\t\t/* It does not make sense to adjust L2CAP parameters\n\t\t\t * that are currently defined in the spec. We simply\n\t\t\t * resend config request that we sent earlier. It is\n\t\t\t * stupid, but it helps qualification testing which\n\t\t\t * expects at least some response from us. */\n\t\t\tl2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,\n\t\t\t\t\t\tl2cap_build_conf_req(sk, req), req);\n\t\t\tgoto done;\n \t\t}\n \n \tdefault:\n\t\tsk->sk_state = BT_DISCONN;\n\t\tsk->sk_err = ECONNRESET;\n\t\tl2cap_sock_set_timer(sk, HZ * 5);\n\t\t{\n\t\t\tstruct l2cap_disconn_req req;\n\t\t\treq.dcid = cpu_to_le16(l2cap_pi(sk)->dcid);\n\t\t\treq.scid = cpu_to_le16(l2cap_pi(sk)->scid);\n\t\t\tl2cap_send_cmd(conn, l2cap_get_ident(conn),\n\t\t\t\t\tL2CAP_DISCONN_REQ, sizeof(req), &req);\n\t\t}\n\t\tgoto done;\n\t}\n\n\tif (flags & 0x01)\n\t\tgoto done;\n\n\tl2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE;\n\n\tif (l2cap_pi(sk)->conf_state & L2CAP_CONF_OUTPUT_DONE) {\n\t\tsk->sk_state = BT_CONNECTED;\n\t\tl2cap_chan_ready(sk);\n\t}\n\ndone:\n\tbh_unlock_sock(sk);\n\treturn 0;\n}\n", + "target": "static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)\n{\n\tstruct l2cap_conf_rsp *rsp = (struct l2cap_conf_rsp *)data;\n\tu16 scid, flags, result;\n\tstruct sock *sk;\n\n\tscid = __le16_to_cpu(rsp->scid);\n\tflags = __le16_to_cpu(rsp->flags);\n\tresult = __le16_to_cpu(rsp->result);\n\n\tBT_DBG(\"scid 0x%4.4x flags 0x%2.2x result 0x%2.2x\",\n\t\t\tscid, flags, result);\n\n\tsk = l2cap_get_chan_by_scid(&conn->chan_list, scid);\n\tif (!sk)\n\t\treturn 0;\n\n\tswitch (result) {\n\tcase L2CAP_CONF_SUCCESS:\n \t\tbreak;\n \n \tcase L2CAP_CONF_UNACCEPT:\n\t\tif (l2cap_pi(sk)->num_conf_rsp <= L2CAP_CONF_MAX_CONF_RSP) {\n\t\t\tint len = cmd->len - sizeof(*rsp);\n\t\t\tchar req[64];\n\n\t\t\t/* throw out any old stored conf requests */\n\t\t\tresult = L2CAP_CONF_SUCCESS;\n\t\t\tlen = l2cap_parse_conf_rsp(sk, rsp->data,\n\t\t\t\t\t\t\tlen, req, &result);\n\t\t\tif (len < 0) {\n\t\t\t\tstruct l2cap_disconn_req req;\n\t\t\t\treq.dcid = cpu_to_le16(l2cap_pi(sk)->dcid);\n\t\t\t\treq.scid = cpu_to_le16(l2cap_pi(sk)->scid);\n\t\t\t\tl2cap_send_cmd(conn, l2cap_get_ident(conn),\n\t\t\t\t\tL2CAP_DISCONN_REQ, sizeof(req), &req);\n\t\t\t\tgoto done;\n\t\t\t}\n\n\t\t\tl2cap_send_cmd(conn, l2cap_get_ident(conn),\n\t\t\t\t\t\tL2CAP_CONF_REQ, len, req);\n\t\t\tl2cap_pi(sk)->num_conf_req++;\n\t\t\tif (result != L2CAP_CONF_SUCCESS)\n\t\t\t\tgoto done;\n\t\t\tbreak;\n \t\t}\n \n \tdefault:\n\t\tsk->sk_state = BT_DISCONN;\n\t\tsk->sk_err = ECONNRESET;\n\t\tl2cap_sock_set_timer(sk, HZ * 5);\n\t\t{\n\t\t\tstruct l2cap_disconn_req req;\n\t\t\treq.dcid = cpu_to_le16(l2cap_pi(sk)->dcid);\n\t\t\treq.scid = cpu_to_le16(l2cap_pi(sk)->scid);\n\t\t\tl2cap_send_cmd(conn, l2cap_get_ident(conn),\n\t\t\t\t\tL2CAP_DISCONN_REQ, sizeof(req), &req);\n\t\t}\n\t\tgoto done;\n\t}\n\n\tif (flags & 0x01)\n\t\tgoto done;\n\n\tl2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE;\n\n\tif (l2cap_pi(sk)->conf_state & L2CAP_CONF_OUTPUT_DONE) {\n\t\tsk->sk_state = BT_CONNECTED;\n\t\tl2cap_chan_ready(sk);\n\t}\n\ndone:\n\tbh_unlock_sock(sk);\n\treturn 0;\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#19190765882e272a6a2162c89acdb29110f7e3cf", + "input": "DirOpenResult DirectoryBackingStore::InitializeTables() {\n sqlite_utils::SQLTransaction transaction(load_dbhandle_);\n if (SQLITE_OK != transaction.BeginExclusive()) {\n return FAILED_DISK_FULL;\n }\n int version_on_disk = GetVersion();\n int last_result = SQLITE_DONE;\n\n if (version_on_disk == 67) {\n if (MigrateVersion67To68())\n version_on_disk = 68;\n }\n if (version_on_disk == 68) {\n if (MigrateVersion68To69())\n version_on_disk = 69;\n }\n\n if (version_on_disk == 69) {\n if (MigrateVersion69To70())\n version_on_disk = 70;\n }\n\n if (version_on_disk == 70) {\n if (MigrateVersion70To71())\n version_on_disk = 71;\n }\n\n if (version_on_disk == 71) {\n if (MigrateVersion71To72())\n version_on_disk = 72;\n }\n\n if (version_on_disk == 72) {\n if (MigrateVersion72To73())\n version_on_disk = 73;\n }\n\n if (version_on_disk == 73) {\n if (MigrateVersion73To74())\n version_on_disk = 74;\n }\n\n if (version_on_disk == 74) {\n if (MigrateVersion74To75())\n version_on_disk = 75;\n }\n\n if (version_on_disk == 75) {\n if (MigrateVersion75To76())\n version_on_disk = 76;\n }\n \n if (version_on_disk == 76) {\n if (MigrateVersion76To77())\n version_on_disk = 77;\n }\n if (version_on_disk == kCurrentDBVersion && needs_column_refresh_) {\n if (!RefreshColumns())\n version_on_disk = 0;\n }\n\n if (version_on_disk != kCurrentDBVersion) {\n if (version_on_disk > kCurrentDBVersion) {\n transaction.Rollback();\n return FAILED_NEWER_VERSION;\n }\n VLOG(1) << \"Old/null sync database, version \" << version_on_disk;\n DropAllTables();\n last_result = CreateTables();\n }\n if (SQLITE_DONE == last_result) {\n {\n sqlite_utils::SQLStatement statement;\n statement.prepare(load_dbhandle_,\n \"SELECT db_create_version, db_create_time FROM share_info\");\n if (SQLITE_ROW != statement.step()) {\n transaction.Rollback();\n return FAILED_DISK_FULL;\n }\n string db_create_version = statement.column_text(0);\n int db_create_time = statement.column_int(1);\n statement.reset();\n VLOG(1) << \"DB created at \" << db_create_time << \" by version \" <<\n db_create_version;\n }\n if (SQLITE_OK == transaction.Commit())\n return OPENED;\n } else {\n transaction.Rollback();\n }\n return FAILED_DISK_FULL;\n}\n", + "target": "DirOpenResult DirectoryBackingStore::InitializeTables() {\n sqlite_utils::SQLTransaction transaction(load_dbhandle_);\n if (SQLITE_OK != transaction.BeginExclusive()) {\n return FAILED_DISK_FULL;\n }\n int version_on_disk = GetVersion();\n int last_result = SQLITE_DONE;\n\n if (version_on_disk == 67) {\n if (MigrateVersion67To68())\n version_on_disk = 68;\n }\n if (version_on_disk == 68) {\n if (MigrateVersion68To69())\n version_on_disk = 69;\n }\n\n if (version_on_disk == 69) {\n if (MigrateVersion69To70())\n version_on_disk = 70;\n }\n\n if (version_on_disk == 70) {\n if (MigrateVersion70To71())\n version_on_disk = 71;\n }\n\n if (version_on_disk == 71) {\n if (MigrateVersion71To72())\n version_on_disk = 72;\n }\n\n if (version_on_disk == 72) {\n if (MigrateVersion72To73())\n version_on_disk = 73;\n }\n\n if (version_on_disk == 73) {\n if (MigrateVersion73To74())\n version_on_disk = 74;\n }\n\n if (version_on_disk == 74) {\n if (MigrateVersion74To75())\n version_on_disk = 75;\n }\n\n if (version_on_disk == 75) {\n if (MigrateVersion75To76())\n version_on_disk = 76;\n }\n \n if (version_on_disk == kCurrentDBVersion && needs_column_refresh_) {\n if (!RefreshColumns())\n version_on_disk = 0;\n }\n\n if (version_on_disk != kCurrentDBVersion) {\n if (version_on_disk > kCurrentDBVersion) {\n transaction.Rollback();\n return FAILED_NEWER_VERSION;\n }\n VLOG(1) << \"Old/null sync database, version \" << version_on_disk;\n DropAllTables();\n last_result = CreateTables();\n }\n if (SQLITE_DONE == last_result) {\n {\n sqlite_utils::SQLStatement statement;\n statement.prepare(load_dbhandle_,\n \"SELECT db_create_version, db_create_time FROM share_info\");\n if (SQLITE_ROW != statement.step()) {\n transaction.Rollback();\n return FAILED_DISK_FULL;\n }\n string db_create_version = statement.column_text(0);\n int db_create_time = statement.column_int(1);\n statement.reset();\n VLOG(1) << \"DB created at \" << db_create_time << \" by version \" <<\n db_create_version;\n }\n if (SQLITE_OK == transaction.Commit())\n return OPENED;\n } else {\n transaction.Rollback();\n }\n return FAILED_DISK_FULL;\n}\n", + "vul_type": "unknown", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#0042fb5fd1c9d257d713b15a1f45da05cf5c1c87", + "input": "int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)\n{\n\tint i,n=0,len,nid, first, use_bn;\n\tBIGNUM *bl;\n\tunsigned long l;\n const unsigned char *p;\n char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2];\n \n if ((a == NULL) || (a->data == NULL)) {\n buf[0]='\\0';\n return(0);\n }\n \n \n if (!no_name && (nid=OBJ_obj2nid(a)) != NID_undef)\n {\n\t\ts=OBJ_nid2ln(nid);\n\t\tif (s == NULL)\n\t\t\ts=OBJ_nid2sn(nid);\n\t\tif (s)\n\t\t\t{\n\t\t\tif (buf)\n\t\t\t\tBUF_strlcpy(buf,s,buf_len);\n\t\t\tn=strlen(s);\n\t\t\treturn n;\n\t\t\t}\n\t\t}\n\n\n\tlen=a->length;\n\tp=a->data;\n\n\tfirst = 1;\n\tbl = NULL;\n\n\twhile (len > 0)\n\t\t{\n\t\tl=0;\n\t\tuse_bn = 0;\n\t\tfor (;;)\n\t\t\t{\n\t\t\tunsigned char c = *p++;\n\t\t\tlen--;\n\t\t\tif ((len == 0) && (c & 0x80))\n\t\t\t\tgoto err;\n\t\t\tif (use_bn)\n\t\t\t\t{\n\t\t\t\tif (!BN_add_word(bl, c & 0x7f))\n\t\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tl |= c & 0x7f;\n\t\t\tif (!(c & 0x80))\n\t\t\t\tbreak;\n\t\t\tif (!use_bn && (l > (ULONG_MAX >> 7L)))\n\t\t\t\t{\n\t\t\t\tif (!bl && !(bl = BN_new()))\n\t\t\t\t\tgoto err;\n\t\t\t\tif (!BN_set_word(bl, l))\n\t\t\t\t\tgoto err;\n\t\t\t\tuse_bn = 1;\n\t\t\t\t}\n\t\t\tif (use_bn)\n\t\t\t\t{\n\t\t\t\tif (!BN_lshift(bl, bl, 7))\n\t\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tl<<=7L;\n\t\t\t}\n\n\t\tif (first)\n\t\t\t{\n\t\t\tfirst = 0;\n\t\t\tif (l >= 80)\n\t\t\t\t{\n\t\t\t\ti = 2;\n\t\t\t\tif (use_bn)\n\t\t\t\t\t{\n\t\t\t\t\tif (!BN_sub_word(bl, 80))\n\t\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tl -= 80;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\ti=(int)(l/40);\n i=(int)(l/40);\n l-=(long)(i*40);\n }\n if (buf && (buf_len > 0))\n {\n *buf++ = i + '0';\n buf_len--;\n }\n n++;\n\t\tif (use_bn)\n\t\t\t{\n\t\t\tchar *bndec;\n\t\t\tbndec = BN_bn2dec(bl);\n\t\t\tif (!bndec)\n\t\t\t\tgoto err;\n\t\t\ti = strlen(bndec);\n\t\t\tif (buf)\n i = strlen(bndec);\n if (buf)\n {\n if (buf_len > 0)\n {\n *buf++ = '.';\n buf_len--;\n }\n BUF_strlcpy(buf,bndec,buf_len);\n\t\t\t\t\tbuf_len = 0;\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tbuf+=i;\n\t\t\t\t\tbuf_len-=i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tn++;\n\t\t\tn += i;\n\t\t\tOPENSSL_free(bndec);\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tBIO_snprintf(tbuf,sizeof tbuf,\".%lu\",l);\n\t\t\ti=strlen(tbuf);\n\t\t\tif (buf && (buf_len > 0))\n\t\t\t\t{\n\t\t\t\tBUF_strlcpy(buf,tbuf,buf_len);\n\t\t\t\tif (i > buf_len)\n\t\t\t\t\t{\n\t\t\t\t\tbuf += buf_len;\n\t\t\t\t\tbuf_len = 0;\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tbuf+=i;\n\t\t\t\t\tbuf_len-=i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tn+=i;\n\t\t\tl=0;\n\t\t\t}\n\t\t}\n\n\tif (bl)\n\t\tBN_free(bl);\n\treturn n;\n\n\terr:\n\tif (bl)\n\t\tBN_free(bl);\n\treturn -1;\n}\n", + "target": "int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)\n{\n\tint i,n=0,len,nid, first, use_bn;\n\tBIGNUM *bl;\n\tunsigned long l;\n const unsigned char *p;\n char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2];\n \n /* Ensure that, at every state, |buf| is NUL-terminated. */\n if (buf && buf_len > 0)\n buf[0] = '\\0';\n \n if ((a == NULL) || (a->data == NULL))\n return(0);\n \n if (!no_name && (nid=OBJ_obj2nid(a)) != NID_undef)\n {\n\t\ts=OBJ_nid2ln(nid);\n\t\tif (s == NULL)\n\t\t\ts=OBJ_nid2sn(nid);\n\t\tif (s)\n\t\t\t{\n\t\t\tif (buf)\n\t\t\t\tBUF_strlcpy(buf,s,buf_len);\n\t\t\tn=strlen(s);\n\t\t\treturn n;\n\t\t\t}\n\t\t}\n\n\n\tlen=a->length;\n\tp=a->data;\n\n\tfirst = 1;\n\tbl = NULL;\n\n\twhile (len > 0)\n\t\t{\n\t\tl=0;\n\t\tuse_bn = 0;\n\t\tfor (;;)\n\t\t\t{\n\t\t\tunsigned char c = *p++;\n\t\t\tlen--;\n\t\t\tif ((len == 0) && (c & 0x80))\n\t\t\t\tgoto err;\n\t\t\tif (use_bn)\n\t\t\t\t{\n\t\t\t\tif (!BN_add_word(bl, c & 0x7f))\n\t\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tl |= c & 0x7f;\n\t\t\tif (!(c & 0x80))\n\t\t\t\tbreak;\n\t\t\tif (!use_bn && (l > (ULONG_MAX >> 7L)))\n\t\t\t\t{\n\t\t\t\tif (!bl && !(bl = BN_new()))\n\t\t\t\t\tgoto err;\n\t\t\t\tif (!BN_set_word(bl, l))\n\t\t\t\t\tgoto err;\n\t\t\t\tuse_bn = 1;\n\t\t\t\t}\n\t\t\tif (use_bn)\n\t\t\t\t{\n\t\t\t\tif (!BN_lshift(bl, bl, 7))\n\t\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tl<<=7L;\n\t\t\t}\n\n\t\tif (first)\n\t\t\t{\n\t\t\tfirst = 0;\n\t\t\tif (l >= 80)\n\t\t\t\t{\n\t\t\t\ti = 2;\n\t\t\t\tif (use_bn)\n\t\t\t\t\t{\n\t\t\t\t\tif (!BN_sub_word(bl, 80))\n\t\t\t\t\t\tgoto err;\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tl -= 80;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\ti=(int)(l/40);\n i=(int)(l/40);\n l-=(long)(i*40);\n }\n if (buf && (buf_len > 1))\n {\n *buf++ = i + '0';\n *buf = '\\0';\n buf_len--;\n }\n n++;\n\t\tif (use_bn)\n\t\t\t{\n\t\t\tchar *bndec;\n\t\t\tbndec = BN_bn2dec(bl);\n\t\t\tif (!bndec)\n\t\t\t\tgoto err;\n\t\t\ti = strlen(bndec);\n\t\t\tif (buf)\n i = strlen(bndec);\n if (buf)\n {\n if (buf_len > 1)\n {\n *buf++ = '.';\n *buf = '\\0';\n buf_len--;\n }\n BUF_strlcpy(buf,bndec,buf_len);\n\t\t\t\t\tbuf_len = 0;\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tbuf+=i;\n\t\t\t\t\tbuf_len-=i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tn++;\n\t\t\tn += i;\n\t\t\tOPENSSL_free(bndec);\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tBIO_snprintf(tbuf,sizeof tbuf,\".%lu\",l);\n\t\t\ti=strlen(tbuf);\n\t\t\tif (buf && (buf_len > 0))\n\t\t\t\t{\n\t\t\t\tBUF_strlcpy(buf,tbuf,buf_len);\n\t\t\t\tif (i > buf_len)\n\t\t\t\t\t{\n\t\t\t\t\tbuf += buf_len;\n\t\t\t\t\tbuf_len = 0;\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\tbuf+=i;\n\t\t\t\t\tbuf_len-=i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tn+=i;\n\t\t\tl=0;\n\t\t\t}\n\t\t}\n\n\tif (bl)\n\t\tBN_free(bl);\n\treturn n;\n\n\terr:\n\tif (bl)\n\t\tBN_free(bl);\n\treturn -1;\n}\n", + "vul_type": "cwe-200", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#b51b33f2bc5d1497ddf5bd107f791c101695000d", + "input": "spnego_gss_wrap(\n\t\tOM_uint32 *minor_status,\n\t\tgss_ctx_id_t context_handle,\n\t\tint conf_req_flag,\n\t\tgss_qop_t qop_req,\n\t\tgss_buffer_t input_message_buffer,\n\t\tint *conf_state,\n \t\tgss_buffer_t output_message_buffer)\n {\n \tOM_uint32 ret;\n \tret = gss_wrap(minor_status,\n\t\t context_handle,\n \t\t conf_req_flag,\n \t\t qop_req,\n \t\t input_message_buffer,\n\t\t conf_state,\n\t\t output_message_buffer);\n\n\treturn (ret);\n}\n", + "target": "spnego_gss_wrap(\n\t\tOM_uint32 *minor_status,\n\t\tgss_ctx_id_t context_handle,\n\t\tint conf_req_flag,\n\t\tgss_qop_t qop_req,\n\t\tgss_buffer_t input_message_buffer,\n\t\tint *conf_state,\n \t\tgss_buffer_t output_message_buffer)\n {\n \tOM_uint32 ret;\n\tspnego_gss_ctx_id_t sc = (spnego_gss_ctx_id_t)context_handle;\n\n\tif (sc->ctx_handle == GSS_C_NO_CONTEXT)\n\t\treturn (GSS_S_NO_CONTEXT);\n\n \tret = gss_wrap(minor_status,\n\t\t sc->ctx_handle,\n \t\t conf_req_flag,\n \t\t qop_req,\n \t\t input_message_buffer,\n\t\t conf_state,\n\t\t output_message_buffer);\n\n\treturn (ret);\n}\n", + "vul_type": "cwe-18", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#dc7b094a338c6c521f918f478e993f0f74bbea0d", + "input": " void ChangeCurrentInputMethod(const InputMethodDescriptor& new_input_method) {\n if (current_input_method_.id != new_input_method.id) {\n previous_input_method_ = current_input_method_;\n current_input_method_ = new_input_method;\n\n if (!input_method::SetCurrentKeyboardLayoutByName(\n current_input_method_.keyboard_layout)) {\n LOG(ERROR) << \"Failed to change keyboard layout to \"\n << current_input_method_.keyboard_layout;\n }\n\n ObserverListBase::Iterator it(observers_);\n Observer* first_observer = it.GetNext();\n if (first_observer) {\n first_observer->PreferenceUpdateNeeded(this,\n previous_input_method_,\n current_input_method_);\n }\n }\n\n const size_t num_active_input_methods = GetNumActiveInputMethods();\n FOR_EACH_OBSERVER(Observer, observers_,\n InputMethodChanged(this,\n current_input_method_,\n num_active_input_methods));\n }\n", + "target": " void ChangeCurrentInputMethod(const InputMethodDescriptor& new_input_method) {\n void ChangeCurrentInputMethod(const input_method::InputMethodDescriptor&\n new_input_method) {\n if (current_input_method_.id != new_input_method.id) {\n previous_input_method_ = current_input_method_;\n current_input_method_ = new_input_method;\n\n if (!input_method::SetCurrentKeyboardLayoutByName(\n current_input_method_.keyboard_layout)) {\n LOG(ERROR) << \"Failed to change keyboard layout to \"\n << current_input_method_.keyboard_layout;\n }\n\n ObserverListBase::Iterator it(observers_);\n InputMethodLibrary::Observer* first_observer = it.GetNext();\n if (first_observer) {\n first_observer->PreferenceUpdateNeeded(this,\n previous_input_method_,\n current_input_method_);\n }\n }\n\n const size_t num_active_input_methods = GetNumActiveInputMethods();\n FOR_EACH_OBSERVER(InputMethodLibrary::Observer, observers_,\n InputMethodChanged(this,\n current_input_method_,\n num_active_input_methods));\n }\n", + "vul_type": "cwe-399", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#91f2fa59e8ed80dfbf400add0164ee0e508e412a", + "input": "cJSON *cJSON_CreateIntArray( int64_t *numbers, int count )\n{\n\tint i;\n\tcJSON *n = 0, *p = 0, *a = cJSON_CreateArray();\n\tfor ( i = 0; a && i < count; ++i ) {\n\t\tn = cJSON_CreateInt( numbers[i] );\n\t\tif ( ! i )\n\t\t\ta->child = n;\n\t\telse\n\t\t\tsuffix_object( p, n );\n\t\tp = n;\n\t}\n\treturn a;\n}\n", + "target": "cJSON *cJSON_CreateIntArray( int64_t *numbers, int count )\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + }, + { + "problem_id": "bigvul#validation#e37b620fe8f14535d737e89a4dcabaed4517bf1a", + "input": "safe_fprintf(FILE *f, const char *fmt, ...)\n{\n\tchar fmtbuff_stack[256]; /* Place to format the printf() string. */\n\tchar outbuff[256]; /* Buffer for outgoing characters. */\n\tchar *fmtbuff_heap; /* If fmtbuff_stack is too small, we use malloc */\n\tchar *fmtbuff; /* Pointer to fmtbuff_stack or fmtbuff_heap. */\n\tint fmtbuff_length;\n\tint length, n;\n\tva_list ap;\n\tconst char *p;\n\tunsigned i;\n\twchar_t wc;\n\tchar try_wc;\n\n\t/* Use a stack-allocated buffer if we can, for speed and safety. */\n\tfmtbuff_heap = NULL;\n\tfmtbuff_length = sizeof(fmtbuff_stack);\n\tfmtbuff = fmtbuff_stack;\n\n\t/* Try formatting into the stack buffer. */\n\tva_start(ap, fmt);\n\tlength = vsnprintf(fmtbuff, fmtbuff_length, fmt, ap);\n\tva_end(ap);\n\n\t/* If the result was too large, allocate a buffer on the heap. */\n\twhile (length < 0 || length >= fmtbuff_length) {\n\t\tif (length >= fmtbuff_length)\n\t\t\tfmtbuff_length = length+1;\n\t\telse if (fmtbuff_length < 8192)\n\t\t\tfmtbuff_length *= 2;\n\t\telse if (fmtbuff_length < 1000000)\n\t\t\tfmtbuff_length += fmtbuff_length / 4;\n\t\telse {\n\t\t\tlength = fmtbuff_length;\n\t\t\tfmtbuff_heap[length-1] = '\\0';\n\t\t\tbreak;\n\t\t}\n\t\tfree(fmtbuff_heap);\n\t\tfmtbuff_heap = malloc(fmtbuff_length);\n\n\t\t/* Reformat the result into the heap buffer if we can. */\n\t\tif (fmtbuff_heap != NULL) {\n\t\t\tfmtbuff = fmtbuff_heap;\n\t\t\tva_start(ap, fmt);\n\t\t\tlength = vsnprintf(fmtbuff, fmtbuff_length, fmt, ap);\n\t\t\tva_end(ap);\n\t\t} else {\n\t\t\t/* Leave fmtbuff pointing to the truncated\n\t\t\t * string in fmtbuff_stack. */\n\t\t\tlength = sizeof(fmtbuff_stack) - 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* Note: mbrtowc() has a cleaner API, but mbtowc() seems a bit\n\t * more portable, so we use that here instead. */\n\tif (mbtowc(NULL, NULL, 1) == -1) { /* Reset the shift state. */\n\t\t/* mbtowc() should never fail in practice, but\n\t\t * handle the theoretical error anyway. */\n\t\tfree(fmtbuff_heap);\n\t\treturn;\n\t}\n\n\t/* Write data, expanding unprintable characters. */\n\tp = fmtbuff;\n\ti = 0;\n\ttry_wc = 1;\n\twhile (*p != '\\0') {\n\n\t\t/* Convert to wide char, test if the wide\n\t\t * char is printable in the current locale. */\n\t\tif (try_wc && (n = mbtowc(&wc, p, length)) != -1) {\n\t\t\tlength -= n;\n\t\t\tif (iswprint(wc) && wc != L'\\\\') {\n\t\t\t\t/* Printable, copy the bytes through. */\n\t\t\t\twhile (n-- > 0)\n\t\t\t\t\toutbuff[i++] = *p++;\n\t\t\t} else {\n\t\t\t\t/* Not printable, format the bytes. */\n\t\t\t\twhile (n-- > 0)\n\t\t\t\t\ti += (unsigned)bsdtar_expand_char(\n\t\t\t\t\t outbuff, i, *p++);\n\t\t\t}\n\t\t} else {\n\t\t\t/* After any conversion failure, don't bother\n\t\t\t * trying to convert the rest. */\n\t\t\ti += (unsigned)bsdtar_expand_char(outbuff, i, *p++);\n\t\t\ttry_wc = 0;\n \t\t}\n \n \t\t/* If our output buffer is full, dump it and keep going. */\n\t\tif (i > (sizeof(outbuff) - 20)) {\n \t\t\toutbuff[i] = '\\0';\n \t\t\tfprintf(f, \"%s\", outbuff);\n \t\t\ti = 0;\n\t\t}\n\t}\n\toutbuff[i] = '\\0';\n\tfprintf(f, \"%s\", outbuff);\n\n\t/* If we allocated a heap-based formatting buffer, free it now. */\n\tfree(fmtbuff_heap);\n}\n", + "target": "safe_fprintf(FILE *f, const char *fmt, ...)\n{\n\tchar fmtbuff_stack[256]; /* Place to format the printf() string. */\n\tchar outbuff[256]; /* Buffer for outgoing characters. */\n\tchar *fmtbuff_heap; /* If fmtbuff_stack is too small, we use malloc */\n\tchar *fmtbuff; /* Pointer to fmtbuff_stack or fmtbuff_heap. */\n\tint fmtbuff_length;\n\tint length, n;\n\tva_list ap;\n\tconst char *p;\n\tunsigned i;\n\twchar_t wc;\n\tchar try_wc;\n\n\t/* Use a stack-allocated buffer if we can, for speed and safety. */\n\tfmtbuff_heap = NULL;\n\tfmtbuff_length = sizeof(fmtbuff_stack);\n\tfmtbuff = fmtbuff_stack;\n\n\t/* Try formatting into the stack buffer. */\n\tva_start(ap, fmt);\n\tlength = vsnprintf(fmtbuff, fmtbuff_length, fmt, ap);\n\tva_end(ap);\n\n\t/* If the result was too large, allocate a buffer on the heap. */\n\twhile (length < 0 || length >= fmtbuff_length) {\n\t\tif (length >= fmtbuff_length)\n\t\t\tfmtbuff_length = length+1;\n\t\telse if (fmtbuff_length < 8192)\n\t\t\tfmtbuff_length *= 2;\n\t\telse if (fmtbuff_length < 1000000)\n\t\t\tfmtbuff_length += fmtbuff_length / 4;\n\t\telse {\n\t\t\tlength = fmtbuff_length;\n\t\t\tfmtbuff_heap[length-1] = '\\0';\n\t\t\tbreak;\n\t\t}\n\t\tfree(fmtbuff_heap);\n\t\tfmtbuff_heap = malloc(fmtbuff_length);\n\n\t\t/* Reformat the result into the heap buffer if we can. */\n\t\tif (fmtbuff_heap != NULL) {\n\t\t\tfmtbuff = fmtbuff_heap;\n\t\t\tva_start(ap, fmt);\n\t\t\tlength = vsnprintf(fmtbuff, fmtbuff_length, fmt, ap);\n\t\t\tva_end(ap);\n\t\t} else {\n\t\t\t/* Leave fmtbuff pointing to the truncated\n\t\t\t * string in fmtbuff_stack. */\n\t\t\tlength = sizeof(fmtbuff_stack) - 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* Note: mbrtowc() has a cleaner API, but mbtowc() seems a bit\n\t * more portable, so we use that here instead. */\n\tif (mbtowc(NULL, NULL, 1) == -1) { /* Reset the shift state. */\n\t\t/* mbtowc() should never fail in practice, but\n\t\t * handle the theoretical error anyway. */\n\t\tfree(fmtbuff_heap);\n\t\treturn;\n\t}\n\n\t/* Write data, expanding unprintable characters. */\n\tp = fmtbuff;\n\ti = 0;\n\ttry_wc = 1;\n\twhile (*p != '\\0') {\n\n\t\t/* Convert to wide char, test if the wide\n\t\t * char is printable in the current locale. */\n\t\tif (try_wc && (n = mbtowc(&wc, p, length)) != -1) {\n\t\t\tlength -= n;\n\t\t\tif (iswprint(wc) && wc != L'\\\\') {\n\t\t\t\t/* Printable, copy the bytes through. */\n\t\t\t\twhile (n-- > 0)\n\t\t\t\t\toutbuff[i++] = *p++;\n\t\t\t} else {\n\t\t\t\t/* Not printable, format the bytes. */\n\t\t\t\twhile (n-- > 0)\n\t\t\t\t\ti += (unsigned)bsdtar_expand_char(\n\t\t\t\t\t outbuff, i, *p++);\n\t\t\t}\n\t\t} else {\n\t\t\t/* After any conversion failure, don't bother\n\t\t\t * trying to convert the rest. */\n\t\t\ti += (unsigned)bsdtar_expand_char(outbuff, i, *p++);\n\t\t\ttry_wc = 0;\n \t\t}\n \n \t\t/* If our output buffer is full, dump it and keep going. */\n\t\tif (i > (sizeof(outbuff) - 128)) {\n \t\t\toutbuff[i] = '\\0';\n \t\t\tfprintf(f, \"%s\", outbuff);\n \t\t\ti = 0;\n\t\t}\n\t}\n\toutbuff[i] = '\\0';\n\tfprintf(f, \"%s\", outbuff);\n\n\t/* If we allocated a heap-based formatting buffer, free it now. */\n\tfree(fmtbuff_heap);\n}\n", + "vul_type": "cwe-119", + "lang": "c", + "source": "bigvul" + } +] \ No newline at end of file diff --git a/sven_rl_buckets/README.md b/sven_rl_buckets/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5fb38ecc2d8c37ff75962babd2233d799666dd7e --- /dev/null +++ b/sven_rl_buckets/README.md @@ -0,0 +1,17 @@ +# `data/sven_rl_buckets/` — SVEN RL length buckets + +Produced by `scripts/convert_sven_to_dream_jsonl.py` (and similar), splitting SVEN examples by **target generation length** so RL rollout can set per-bucket `max_new_tokens` / `steps`. + +## Layout + +``` +train/ + 1_128.jsonl + 128_256.jsonl + 256_512.jsonl + 512_inf.jsonl # or similar; 512+ tokens +val/ + (same pattern) +``` + +`rl_sven.py` and config keys `dataset.sven_train_subset_dir`, `dataset.sven_train_subset_files` point here; semantics mirror `python_splits` bucketing. diff --git a/sven_rl_buckets/train/128_256.jsonl b/sven_rl_buckets/train/128_256.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..69cfbbc0d5ff1500dee6687c7b1c616d0040b142 --- /dev/null +++ b/sven_rl_buckets/train/128_256.jsonl @@ -0,0 +1,130 @@ +{"problem_id":"cwe-089#3-ab2d273c7ea4","input":"@api.route('/items/', methods=['GET'])\ndef get_item(item_id):\n sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)\n cursor = mysql.connection.cursor()\n cursor.execute(sql)\n data = cursor.fetchone()\n\n if data:\n item = {}\n for tup in zip([column[0] for column in cursor.description], data):\n item[tup[0]] = tup[1]\n else:\n return jsonify({\"error\": \"item not found\"}), 404\n\n return jsonify(item)","target":"@api.route('/items/', methods=['GET'])\ndef get_item(item_id):\n sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = %s AND auctionable = true;'''\n cursor = mysql.connection.cursor()\n cursor.execute(sql, [item_id])\n data = cursor.fetchone()\n\n if data:\n item = {}\n for tup in zip([column[0] for column in cursor.description], data):\n item[tup[0]] = tup[1]\n else:\n return jsonify({\"error\": \"item not found\"}), 404\n\n return jsonify(item)","lang":"python","vul_type":"cwe-089","target_token_count":130,"sven_meta":{"func_name":"get_item","file_name":"timf/api/views.py","commit_link":"github.com/cosileone/TimeIsMoneyFriend-API/commit/3d3b5defd26ef7d205915bf643b6b1df90a15e44","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#9-5fce4f744efa","input":" def set_language(self, lang):\n \"\"\"\n Update language of user in the User object and in the database\n :param lang: string with language tag like \"en-US\"\n :return: None\n \"\"\"\n log.debug('Updating info about user %s language '\n 'in memory & database...', self)\n\n self.language = lang\n\n query = (\"UPDATE users \"\n f\"SET language='{self.language}' \"\n f\"WHERE chat_id='{self.chat_id}'\")\n\n try:\n db.add(query)\n except DatabaseError:\n log.error(\"Can't add new language of %s to the database\", self)\n else:\n log.debug('Language updated.')","target":" def set_language(self, lang):\n \"\"\"\n Update language of user in the User object and in the database\n :param lang: string with language tag like \"en-US\"\n :return: None\n \"\"\"\n log.debug('Updating info about user %s language '\n 'in memory & database...', self)\n\n self.language = lang\n\n query = (\"UPDATE users \"\n f\"SET language=%s \"\n f\"WHERE chat_id=%s\")\n\n parameters = self.language, self.chat_id\n try:\n db.add(query, parameters)\n except DatabaseError:\n log.error(\"Can't add new language of %s to the database\", self)\n else:\n log.debug('Language updated.')","lang":"python","vul_type":"cwe-089","target_token_count":150,"sven_meta":{"func_name":"set_language","file_name":"photogpsbot/users.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#18-1fe54fefc578","input":" @staticmethod\n def upsert_mapped_projects(user_id: int, project_id: int):\n \"\"\" Adds projects to mapped_projects if it doesn't exist \"\"\"\n sql = \"select * from users where id = {0} and projects_mapped @> '{{{1}}}'\".format(user_id, project_id)\n result = db.engine.execute(sql)\n\n if result.rowcount > 0:\n return # User has previously mapped this project so return\n\n sql = '''update users\n set projects_mapped = array_append(projects_mapped, {0})\n where id = {1}'''.format(project_id, user_id)\n\n db.engine.execute(sql)","target":" @staticmethod\n def upsert_mapped_projects(user_id: int, project_id: int):\n \"\"\" Adds projects to mapped_projects if it doesn't exist \"\"\"\n sql = \"select * from users where id = :user_id and projects_mapped @> '{{:project_id}}'\"\n result = db.engine.execute(text(sql), user_id=user_id, project_id=project_id)\n\n if result.rowcount > 0:\n return # User has previously mapped this project so return\n\n sql = '''update users\n set projects_mapped = array_append(projects_mapped, :project_id)\n where id = :user_id'''\n\n db.engine.execute(text(sql), project_id=project_id, user_id=user_id)","lang":"python","vul_type":"cwe-089","target_token_count":148,"sven_meta":{"func_name":"upsert_mapped_projects","file_name":"server/models/postgis/user.py","commit_link":"github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#27-386d72f27f1b","input":"@app.route('/')\ndef render_page_name(page_name):\n query = db.query(\"select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = '%s' order by page_content.id desc limit 1\" % page_name)\n wiki_page = query.namedresult()\n has_content = False\n page_is_taken = False\n if len(wiki_page) < 1:\n content = \"\"\n else:\n page_is_taken = True\n content = wiki_page[0].content\n if len(content) > 0:\n has_content = True\n else:\n pass\n content = markdown.markdown(wiki_linkify(content))\n return render_template(\n 'pageholder.html',\n page_is_taken = page_is_taken,\n page_name = page_name,\n markdown = markdown,\n wiki_linkify = wiki_linkify,\n has_content = has_content,\n content = content\n )","target":"@app.route('/')\ndef render_page_name(page_name):\n query = db.query(\"select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = $1 order by page_content.id desc limit 1\", page_name)\n wiki_page = query.namedresult()\n has_content = False\n page_is_taken = False\n if len(wiki_page) < 1:\n content = \"\"\n else:\n page_is_taken = True\n content = wiki_page[0].content\n if len(content) > 0:\n has_content = True\n else:\n pass\n content = markdown.markdown(wiki_linkify(content))\n return render_template(\n 'pageholder.html',\n page_is_taken = page_is_taken,\n page_name = page_name,\n markdown = markdown,\n wiki_linkify = wiki_linkify,\n has_content = has_content,\n content = content\n )","lang":"python","vul_type":"cwe-089","target_token_count":214,"sven_meta":{"func_name":"render_page_name","file_name":"server.py","commit_link":"github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#32-30ee0daacdf1","input":"@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_GET_TASK.value)\ndef get_task(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n name = conn.fetchone()\n settings.close()\n if name == None:\n bot.send_message(message.chat.id, \"You should login before get tasks.\")\n else:\n bases.update.update_user(name[1], name[0], name[2])\n bot.send_message(message.chat.id, bases.problem.get_unsolved_problem(message.text, name[1]))\n set_state(message.chat.id, config.States.S_START.value)","target":"@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_GET_TASK.value)\ndef get_task(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))\n name = conn.fetchone()\n settings.close()\n if name == None:\n bot.send_message(message.chat.id, \"You should login before get tasks.\")\n else:\n bases.update.update_user(name[1], name[0], name[2])\n bot.send_message(message.chat.id, bases.problem.get_unsolved_problem(message.text, name[1]))\n set_state(message.chat.id, config.States.S_START.value)","lang":"python","vul_type":"cwe-089","target_token_count":166,"sven_meta":{"func_name":"get_task","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#33-8f0ac3b77541","input":"@bot.message_handler(commands=['stats'])\ndef stats(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n name = conn.fetchone()\n settings.close()\n if name != None:\n bases.update.update_user(name[1], name[0], name[2])\n bases.problem.create_text_stats(name[1])\n img = open(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\users\\\\\" + name[1] + \".png\", \"rb\")\n bot.send_photo(message.chat.id, img)\n img.close()\n if bases.problem.create_stats_picture(name[1]):\n bot.send_message(message.chat.id, \"Sorry, you haven't solved tasks.\")\n return 0\n img = open(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\users\\\\\" + name[1] + \".png\", \"rb\")\n bot.send_photo(message.chat.id, img)\n img.close()\n else:\n bot.send_message(message.chat.id, \"You should login before getting statistic.\")","target":"@bot.message_handler(commands=['stats'])\ndef stats(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))\n name = conn.fetchone()\n settings.close()\n if name != None:\n bases.update.update_user(name[1], name[0], name[2])\n bases.problem.create_text_stats(name[1])\n img = open(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\users\\\\\" + name[1] + \".png\", \"rb\")\n bot.send_photo(message.chat.id, img)\n img.close()\n if bases.problem.create_stats_picture(name[1]):\n bot.send_message(message.chat.id, \"Sorry, you haven't solved tasks.\")\n return 0\n img = open(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\users\\\\\" + name[1] + \".png\", \"rb\")\n bot.send_photo(message.chat.id, img)\n img.close()\n else:\n bot.send_message(message.chat.id, \"You should login before getting statistic.\")","lang":"python","vul_type":"cwe-089","target_token_count":245,"sven_meta":{"func_name":"stats","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#45-ad219ea06fab","input":"@mod.route('/add', methods=['GET', 'POST'])\ndef add():\n if request.method == 'POST':\n msg_id = int(request.form['msg_id'])\n user_id = session['logged_id']\n content = request.form['content']\n c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n sql = \"INSERT INTO comment(msg_id,user_id,content,c_time) \" + \\\n \"VALUES(%d,%d,'%s','%s');\" % (msg_id, user_id, content, c_time)\n cursor.execute(sql)\n conn.commit()\n return redirect(url_for('comment.show', msg_id=msg_id))","target":"@mod.route('/add', methods=['GET', 'POST'])\ndef add():\n if request.method == 'POST':\n msg_id = int(request.form['msg_id'])\n user_id = session['logged_id']\n content = request.form['content']\n c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n cursor.execute(\"INSERT INTO comment(msg_id,user_id,content,c_time) VALUES(%s,%s,%s,%s);\", (msg_id, user_id, content, c_time))\n conn.commit()\n return redirect(url_for('comment.show', msg_id=msg_id))","lang":"python","vul_type":"cwe-089","target_token_count":129,"sven_meta":{"func_name":"add","file_name":"flaskr/flaskr/views/comment.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#50-b5e33d982a76","input":"def fetch_issue(cursor, id):\n \"\"\"\n Fetch an issue by id along with its tags. Returns None if no issue\n with the specified id exists in the database.\n \"\"\"\n cursor.execute(f\"\"\"\n SELECT\n issue.id,\n issue.title,\n issue.description,\n tag.namespace,\n tag.predicate,\n tag.value\n FROM\n issue LEFT JOIN tag\n ON issue.id = tag.issue_id\n WHERE\n issue.id = {id}\n \"\"\")\n\n issue = None\n for row in cursor:\n if issue is None:\n issue = {\n \"id\": row[\"id\"],\n \"title\": row[\"title\"],\n \"description\": row[\"description\"],\n \"tags\": [],\n }\n # If tag exists in row, add to issue.\n if row[\"value\"]:\n issue[\"tags\"].append({\n \"namespace\": row[\"namespace\"],\n \"predicate\": row[\"predicate\"],\n \"value\": row[\"value\"],\n })\n\n return issue","target":"def fetch_issue(cursor, id):\n \"\"\"\n Fetch an issue by id along with its tags. Returns None if no issue\n with the specified id exists in the database.\n \"\"\"\n cursor.execute(\"\"\"\n SELECT\n issue.id,\n issue.title,\n issue.description,\n tag.namespace,\n tag.predicate,\n tag.value\n FROM\n issue LEFT JOIN tag\n ON issue.id = tag.issue_id\n WHERE\n issue.id = ?\n \"\"\", (id,))\n\n issue = None\n for row in cursor:\n if issue is None:\n issue = {\n \"id\": row[\"id\"],\n \"title\": row[\"title\"],\n \"description\": row[\"description\"],\n \"tags\": [],\n }\n # If tag exists in row, add to issue.\n if row[\"value\"]:\n issue[\"tags\"].append({\n \"namespace\": row[\"namespace\"],\n \"predicate\": row[\"predicate\"],\n \"value\": row[\"value\"],\n })\n\n return issue","lang":"python","vul_type":"cwe-089","target_token_count":208,"sven_meta":{"func_name":"fetch_issue","file_name":"server/server.py","commit_link":"github.com/nutty7t/tissue/commit/306dd094749bb39cbd5c74a6ded3d3b191033061","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#55-f66442e7331e","input":"def reportMatch(winner, loser):\n \"\"\"Records the outcome of a single match between two players.\n\n Args:\n winner: the id number of the player who won\n loser: the id number of the player who lost\n \"\"\"\n try:\n int(winner)\n int(loser)\n except ValueError:\n raise ValueError(\n \"\\\"winner\\\" and/or \\\"loser\\\" input are not integers.\\n\"\n \"Please use the id number of each player to report match results.\"\n )\n w = str(winner)\n l = str(loser)\n db = connect()\n c = db.cursor()\n statement = \"INSERT INTO matches values ({w}, {l})\".format(w=w, l=l)\n c.execute(statement)\n db.commit()\n db.close()","target":"def reportMatch(winner, loser):\n \"\"\"Records the outcome of a single match between two players.\n\n Args:\n winner: the id number of the player who won\n loser: the id number of the player who lost\n \"\"\"\n try:\n int(winner)\n int(loser)\n except ValueError:\n raise ValueError(\n \"\\\"winner\\\" and/or \\\"loser\\\" input are not integers.\\n\"\n \"Please use the id number of each player to report match results.\"\n )\n w = str(winner)\n l = str(loser)\n db = connect()\n c = db.cursor()\n c.execute(\"INSERT INTO matches values (%s, %s)\", (w,l))\n db.commit()\n db.close()","lang":"python","vul_type":"cwe-089","target_token_count":157,"sven_meta":{"func_name":"reportMatch","file_name":"tournament.py","commit_link":"github.com/tdnelson2/tournament-db/commit/00f3caeed0e12e806c2808d100908698777d9e98","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#57-0f34e104147e","input":"def karma_sub(name):\n karma = karma_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if karma is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES('{}',-1,0)\n '''.format(name))\n db.commit()\n logger.debug('Inserted into karmadb -1 karma for {}'.format(name))\n db.close()\n return -1\n\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n else:\n karma = karma - 1\n try:\n cursor.execute('''\n UPDATE people SET karma = {0} WHERE name = '{1}'\n '''.format(karma, name))\n db.commit()\n logger.debug('Inserted into karmadb -1 karma for {}'.format(name))\n db.close()\n return karma\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def karma_sub(name):\n karma = karma_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if karma is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES(%(name)s,-1,0)\n ''', (name, ))\n db.commit()\n logger.debug('Inserted into karmadb -1 karma for {}'.format(name))\n db.close()\n return -1\n\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n else:\n karma = karma - 1\n try:\n cursor.execute('''\n UPDATE people SET karma = %(karma)s WHERE name = %(name)s\n ''', (\n karma,\n name,\n ))\n db.commit()\n logger.debug('Inserted into karmadb -1 karma for {}'.format(name))\n db.close()\n return karma\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","target_token_count":216,"sven_meta":{"func_name":"karma_sub","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#59-e04e02754231","input":" def fetch_data(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = (\"SELECT data FROM %s WHERE identifier = '%s';\" %\n (self.table, sid)\n )\n res = self._query(query)\n try:\n data = res.dictresult()[0]['data']\n except IndexError:\n raise ObjectDoesNotExistException(id)\n try:\n ndata = pg.unescape_bytea(data)\n except:\n # insufficient PyGreSQL version\n ndata = data.replace(\"\\\\'\", \"'\")\n\n ndata = ndata.replace('\\\\000\\\\001', nonTextToken)\n ndata = ndata.replace('\\\\012', '\\n')\n return ndata","target":" def fetch_data(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = (\"SELECT data FROM %s WHERE identifier = $1;\" %\n (self.table)\n )\n res = self._query(query, sid)\n try:\n data = res.dictresult()[0]['data']\n except IndexError:\n raise ObjectDoesNotExistException(id)\n try:\n ndata = pg.unescape_bytea(data)\n except:\n # insufficient PyGreSQL version\n ndata = data.replace(\"\\\\'\", \"'\")\n\n ndata = ndata.replace('\\\\000\\\\001', nonTextToken)\n ndata = ndata.replace('\\\\012', '\\n')\n return ndata","lang":"python","vul_type":"cwe-089","target_token_count":180,"sven_meta":{"func_name":"fetch_data","file_name":"cheshire3/sql/postgresStore.py","commit_link":"github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#65-639305a91312","input":"@app.route('/get_markets')\ndef get_markets():\n asset_id = request.args.get('asset_id')\n\n if not isObject(asset_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_asset_symbols\",[[\"' + asset_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n asset_id = j_l[\"result\"][0][\"id\"]\n\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT * FROM markets WHERE aid='\"+asset_id+\"'\"\n cur.execute(query)\n results = cur.fetchall()\n con.close()\n return jsonify(results)","target":"@app.route('/get_markets')\ndef get_markets():\n asset_id = request.args.get('asset_id')\n\n if not isObject(asset_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_asset_symbols\",[[\"' + asset_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n asset_id = j_l[\"result\"][0][\"id\"]\n\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT * FROM markets WHERE aid=%s\"\n cur.execute(query, (asset_id,))\n results = cur.fetchall()\n con.close()\n return jsonify(results)","lang":"python","vul_type":"cwe-089","target_token_count":150,"sven_meta":{"func_name":"get_markets","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#67-66a9e37e968c","input":" def add_consumption_data_row(self, ts, energy_used, power_used):\n\n if power_used > 0:\n\n query = '''\n INSERT OR IGNORE INTO Consumption (\n TimeStamp,\n EnergyUsed,\n PowerUsed \n ) VALUES (\n %s,\n %s,\n %s\n );\n ''' % (ts, 0, 0)\n self.c.execute(query)\n\n query = '''\n UPDATE Consumption SET \n EnergyUsed = EnergyUsed + %s,\n PowerUsed = PowerUsed + %s\n WHERE TimeStamp = %s;\n ''' % (energy_used, power_used, ts)\n\n self.c.execute(query)\n\n self.db.commit()","target":" def add_consumption_data_row(self, ts, energy_used, power_used):\n\n if power_used > 0:\n\n query = '''\n INSERT OR IGNORE INTO Consumption (\n TimeStamp,\n EnergyUsed,\n PowerUsed \n ) VALUES (\n ?,\n ?,\n ?\n );\n '''\n self.c.execute(query, (ts, 0, 0))\n\n query = '''\n UPDATE Consumption SET \n EnergyUsed = EnergyUsed + ?,\n PowerUsed = PowerUsed + ?\n WHERE TimeStamp=?;\n '''\n\n self.c.execute(query, (energy_used, power_used, ts))\n\n self.db.commit()","lang":"python","vul_type":"cwe-089","target_token_count":133,"sven_meta":{"func_name":"add_consumption_data_row","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#73-59ee2e282e78","input":"def get_error_days(cur, error_percent):\n \"\"\"Fetches the days in which requests led to errors.\n\n Fetches the days in which the specified percentage\n of requests led to errors.\n\n Args:\n cur(obj): The cursor to execute the query.\n error_percent(int): The percentage of requests that led to errors.\n\n Return:\n True if success, False otherwise.\n \"\"\"\n query = '''SELECT to_char(log_errors.date, 'Mon DD YYYY'),\n round((log_errors.errors * 100\n / log_requests.total::numeric), 2) as percent\n FROM log_errors, log_requests\n WHERE log_errors.date = log_requests.date AND\n log_errors.errors * 100\n / log_requests.total::numeric > {}\n ORDER BY log_errors.date'''.format(error_percent)\n rows = get_data(cur, query)\n\n # Write data to txt file.\n if rows is not None:\n file = open(\"error_report.txt\", \"w\")\n for row in rows:\n file.write(\"{} - {}% errors \\n\".format(row[0], row[1]))\n file.close()\n\n return True\n else:\n return False","target":"def get_error_days(cur, error_percent):\n \"\"\"Fetches the days in which requests led to errors.\n\n Fetches the days in which the specified percentage\n of requests led to errors.\n\n Args:\n cur(obj): The cursor to execute the query.\n error_percent(int): The percentage of requests that led to errors.\n\n Return:\n True if success, False otherwise.\n \"\"\"\n data = (error_percent, )\n query = '''SELECT to_char(log_errors.date, 'Mon DD YYYY'),\n round((log_errors.errors * 100\n / log_requests.total::numeric), 2) as percent\n FROM log_errors, log_requests\n WHERE log_errors.date = log_requests.date AND\n log_errors.errors * 100\n / log_requests.total::numeric > %s\n ORDER BY log_errors.date'''\n rows = get_data(cur, query, data)\n\n # Write data to txt file.\n if rows is not None:\n file = open(\"error_report.txt\", \"w\")\n for row in rows:\n file.write(\"{} - {}% errors \\n\".format(row[0], row[1]))\n file.close()\n\n return True\n else:\n return False","lang":"python","vul_type":"cwe-089","target_token_count":256,"sven_meta":{"func_name":"get_error_days","file_name":"news_data_analysis.py","commit_link":"github.com/rrbiz662/log-analysis/commit/20fefbde3738088586a3c5679f743493d0a504f6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#80-7b9223752b15","input":"@endpoints.route(\"/h2h\")\ndef h2h():\n if db == None:\n init()\n\n player1 = request.args.get('tag1', default=\"christmasmike\")\n player2 = request.args.get('tag2', default=\"christmasmike\")\n sql = \"SELECT * FROM matches WHERE (player1 = '\"+str(player1)+\"' OR \"\\\n +\"player2 = '\"+str(player1)+\"') AND (player1 = '\"+str(player2)+\"' OR \"\\\n +\"player2 = '\"+str(player2)+\"') ORDER BY date DESC;\"\n result = db.exec(sql)\n return json.dumps(result)","target":"@endpoints.route(\"/h2h\")\ndef h2h():\n if db == None:\n init()\n\n player1 = request.args.get('tag1', default=\"christmasmike\")\n player2 = request.args.get('tag2', default=\"christmasmike\")\n sql = \"SELECT * FROM matches WHERE (player1 = '{player1}' OR \"\\\n +\"player2 = '{player1}') AND (player1 = '{player2}' OR \"\\\n +\"player2 = '{player2}') ORDER BY date DESC;\"\n args = {'player1': player1, 'player2': player2}\n result = db.exec(sql, args)\n return json.dumps(result)","lang":"python","vul_type":"cwe-089","target_token_count":143,"sven_meta":{"func_name":"h2h","file_name":"endpoints.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#85-c92d1375ff03","input":"def karma_add(name):\n karma = karma_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if karma is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES('{}',1,0)\n '''.format(name))\n db.commit()\n logger.debug('Inserted into karmadb 1 karma for {}'.format(name))\n return 1\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n else:\n karma = karma + 1\n try:\n cursor.execute('''\n UPDATE people SET karma = {0} WHERE name = '{1}'\n '''.format(karma, name))\n db.commit()\n logger.debug('Inserted into karmadb {} karma for {}'.format(\n karma, name))\n return karma\n\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n db.close()","target":"def karma_add(name):\n karma = karma_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if karma is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES(%(name)s,1,0)\n ''', name)\n db.commit()\n logger.debug('Inserted into karmadb 1 karma for {}'.format(name))\n return 1\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n else:\n karma = karma + 1\n try:\n cursor.execute('''\n UPDATE people SET karma = %(karma)s WHERE name = %(name)s\n ''', (karma, name))\n db.commit()\n logger.debug('Inserted into karmadb {} karma for {}'.format(\n karma,\n name,\n ))\n return karma\n\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n db.close()","lang":"python","vul_type":"cwe-089","target_token_count":214,"sven_meta":{"func_name":"karma_add","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#87-16bdda62dc4a","input":" def system_search(self, search):\r\n search = search.lower()\r\n conn = sqlite3.connect('data/ed.db').cursor()\r\n table = conn.execute(f\"select * from populated where lower(name) = '{search}'\")\r\n results = table.fetchone()\r\n if not results:\r\n table = conn.execute(f\"select * from systems where lower(name) = '{search}'\")\r\n results = table.fetchone()\r\n if results:\r\n keys = tuple(i[0] for i in table.description) \r\n return '\\n'.join(f'{key.replace(\"_\", \" \").title()}: {field}'\r\n for key, field in zip(keys[1:], results[1:]) if field)\r\n else:\r\n return 'No systems found.'","target":" def system_search(self, search):\r\n search = search.lower()\r\n conn = sqlite3.connect('data/ed.db').cursor()\r\n table = conn.execute('select * from populated where lower(name) = ?', (search,))\r\n results = table.fetchone()\r\n if not results:\r\n table = conn.execute('select * from systems where lower(name) = ?', (search,))\r\n results = table.fetchone()\r\n if results:\r\n keys = tuple(i[0] for i in table.description) \r\n return '\\n'.join(f'{key.replace(\"_\", \" \").title()}: {field}'\r\n for key, field in zip(keys[1:], results[1:]) if field)\r\n else:\r\n return 'No systems found.'","lang":"python","vul_type":"cwe-089","target_token_count":153,"sven_meta":{"func_name":"system_search","file_name":"eddb.py","commit_link":"github.com/BeatButton/beattie/commit/ab36b2053ee09faf4cc9a279cf7a4c010864cb29","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#89-b0a386060232","input":"@bot.message_handler(commands =['login'])\ndef get_login(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n name = conn.fetchone()\n if name != None:\n bot.send_message(message.chat.id, \"Previous handle: \" + str(name[1]))\n else:\n bot.send_message(message.chat.id, \"Previous handle: None\")\n settings.close()\n bot.send_message(message.chat.id, \"Type new handle: \")\n set_state(message.chat.id, config.States.S_LOGIN.value)","target":"@bot.message_handler(commands =['login'])\ndef get_login(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))\n name = conn.fetchone()\n if name != None:\n bot.send_message(message.chat.id, \"Previous handle: \" + str(name[1]))\n else:\n bot.send_message(message.chat.id, \"Previous handle: None\")\n settings.close()\n bot.send_message(message.chat.id, \"Type new handle: \")\n set_state(message.chat.id, config.States.S_LOGIN.value)","lang":"python","vul_type":"cwe-089","target_token_count":142,"sven_meta":{"func_name":"get_login","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#92-d8fe311dc5cc","input":" def fetch_page_name(self, page_id):\n '''\n Returns the page name corresponding to the provided page ID.\n\n Args:\n page_id: The page ID whose ID to fetch.\n\n Returns:\n str: The page name corresponding to the provided page ID.\n\n Raises:\n ValueError: If the provided page ID is invalid or does not exist.\n '''\n helpers.validate_page_id(page_id)\n\n query = 'SELECT name FROM pages WHERE id=\"{0}\"'.format(page_id)\n self.cursor.execute(query)\n\n page_name = self.cursor.fetchone()\n\n if not page_name:\n raise ValueError('Invalid page ID \"{0}\" provided. Page ID does not exist.'.format(page_id))\n\n return page_name[0].encode('utf-8').replace('_', ' ')","target":" def fetch_page_name(self, page_id):\n '''\n Returns the page name corresponding to the provided page ID.\n\n Args:\n page_id: The page ID whose ID to fetch.\n\n Returns:\n str: The page name corresponding to the provided page ID.\n\n Raises:\n ValueError: If the provided page ID is invalid or does not exist.\n '''\n helpers.validate_page_id(page_id)\n\n query = 'SELECT name FROM pages WHERE id = ?;'\n query_bindings = (page_id,)\n self.cursor.execute(query, query_bindings)\n\n page_name = self.cursor.fetchone()\n\n if not page_name:\n raise ValueError('Invalid page ID \"{0}\" provided. Page ID does not exist.'.format(page_id))\n\n return page_name[0].encode('utf-8').replace('_', ' ')","lang":"python","vul_type":"cwe-089","target_token_count":166,"sven_meta":{"func_name":"fetch_page_name","file_name":"sdow/database.py","commit_link":"github.com/jwngr/sdow/commit/4db98f3521592f17550d2b723336f33fec5e112a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#97-676dc5645c4d","input":" @staticmethod\n def auto_unlock_tasks(project_id: int):\n \"\"\"Unlock all tasks locked for longer than the auto-unlock delta\"\"\"\n expiry_delta = Task.auto_unlock_delta()\n lock_duration = (datetime.datetime.min + expiry_delta).time().isoformat()\n expiry_date = datetime.datetime.utcnow() - expiry_delta\n old_locks_query = '''SELECT t.id\n FROM tasks t, task_history th\n WHERE t.id = th.task_id\n AND t.project_id = th.project_id\n AND t.task_status IN (1,3)\n AND th.action IN ( 'LOCKED_FOR_VALIDATION','LOCKED_FOR_MAPPING' )\n AND th.action_text IS NULL\n AND t.project_id = {0}\n AND th.action_date <= '{1}'\n '''.format(project_id, str(expiry_date))\n\n old_tasks = db.engine.execute(old_locks_query)\n\n if old_tasks.rowcount == 0:\n # no tasks older than the delta found, return without further processing\n return\n\n for old_task in old_tasks:\n task = Task.get(old_task[0], project_id)\n task.auto_unlock_expired_tasks(expiry_date, lock_duration)","target":" @staticmethod\n def auto_unlock_tasks(project_id: int):\n \"\"\"Unlock all tasks locked for longer than the auto-unlock delta\"\"\"\n expiry_delta = Task.auto_unlock_delta()\n lock_duration = (datetime.datetime.min + expiry_delta).time().isoformat()\n expiry_date = datetime.datetime.utcnow() - expiry_delta\n old_locks_query = '''SELECT t.id\n FROM tasks t, task_history th\n WHERE t.id = th.task_id\n AND t.project_id = th.project_id\n AND t.task_status IN (1,3)\n AND th.action IN ( 'LOCKED_FOR_VALIDATION','LOCKED_FOR_MAPPING' )\n AND th.action_text IS NULL\n AND t.project_id = :project_id\n AND th.action_date <= :expiry_date\n '''\n\n old_tasks = db.engine.execute(text(old_locks_query), project_id=project_id, expiry_date=str(expiry_date))\n\n if old_tasks.rowcount == 0:\n # no tasks older than the delta found, return without further processing\n return\n\n for old_task in old_tasks:\n task = Task.get(old_task[0], project_id)\n task.auto_unlock_expired_tasks(expiry_date, lock_duration)","lang":"python","vul_type":"cwe-089","target_token_count":254,"sven_meta":{"func_name":"auto_unlock_tasks","file_name":"server/models/postgis/task.py","commit_link":"github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#102-e8c98c14ddc4","input":"def shame_ask(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n SELECT shame FROM people WHERE name='{}'\n '''.format(name))\n shame = cursor.fetchone()\n db.close()\n if shame is None:\n logger.debug('No shame found for name {}'.format(name))\n return shame\n else:\n shame = shame[0]\n logger.debug('shame of {} found for name {}'.format(shame, name))\n return shame\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def shame_ask(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n SELECT shame FROM people WHERE name=%(name)s\n ''', (name, ))\n shame = cursor.fetchone()\n db.close()\n if shame is None:\n logger.debug('No shame found for name {}'.format(name))\n return shame\n else:\n shame = shame[0]\n logger.debug('shame of {} found for name {}'.format(shame, name))\n return shame\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","target_token_count":130,"sven_meta":{"func_name":"shame_ask","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#104-e23a583a6767","input":"@app.route('/overview/')\ndef overview(classNum):\n\tif 'username' in session:\n\t\tclassNoSpace = classNum.split(' ')[0]+classNum.split(' ')[1]\n\n\t\t#Save the current course as a session variable.\n\t\tsession['currentCourse'] = classNoSpace\n\n\t\tconn = mysql.connect()\n\t\tcursor = conn.cursor()\n\n\t\tcursor.execute(\"SELECT courseName,courseOverview from courses where courseAbbreviation='\" + classNoSpace + \"'\")\n\t\tdata = cursor.fetchone()\n\n\t\treturn render_template('overview.html', className = classNum, courseTitle = data[0], courseOverview = data[1])\n\n\treturn redirect(url_for('index'))","target":"@app.route('/overview/')\ndef overview(classNum):\n\tif 'username' in session:\n\t\tclassNoSpace = classNum.split(' ')[0]+classNum.split(' ')[1]\n\n\t\t#Save the current course as a session variable.\n\t\tsession['currentCourse'] = classNoSpace\n\n\t\tconn = mysql.connect()\n\t\tcursor = conn.cursor()\n\n\t\tcursor.execute(\"SELECT courseName,courseOverview from courses where courseAbbreviation=%s\", (classNoSpace))\n\t\tdata = cursor.fetchone()\n\n\t\treturn render_template('overview.html', className = classNum, courseTitle = data[0], courseOverview = data[1])\n\n\treturn redirect(url_for('index'))","lang":"python","vul_type":"cwe-089","target_token_count":139,"sven_meta":{"func_name":"overview","file_name":"src/tech_track.py","commit_link":"github.com/CaitlinKennedy/Tech-Track/commit/20ef2d4010f9497b8221524edd0c706e2c6a4147","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#106-e95ef4e63837","input":"@mod.route('/edit/', methods=['GET', 'POST'])\ndef edit(cmt_id):\n m = None\n if request.method == 'GET':\n sql = \"SELECT * FROM comment where cmt_id = %d;\" % (cmt_id)\n cursor.execute(sql)\n m = cursor.fetchone()\n return render_template('comment/edit.html', m=m, cmt_id=cmt_id)\n\n if request.method == 'POST':\n content = request.form['content']\n sql = \"UPDATE comment SET content = '%s' where cmt_id = '%d';\" \\\n % (content, cmt_id)\n cursor.execute(sql)\n conn.commit()\n sql = \"SELECT msg_id FROM comment where cmt_id = %d;\" % (cmt_id)\n cursor.execute(sql)\n m = cursor.fetchone()\n flash('Edit Success!')\n return redirect(url_for('comment.show', msg_id=m[0]))\n\n return render_template('comment/edit.html', m=m, cmt_id=cmt_id)","target":"@mod.route('/edit/', methods=['GET', 'POST'])\ndef edit(cmt_id):\n m = None\n if request.method == 'GET':\n cursor.execute(\"SELECT * FROM comment where cmt_id = %s;\", (cmt_id,))\n m = cursor.fetchone()\n return render_template('comment/edit.html', m=m, cmt_id=cmt_id)\n\n if request.method == 'POST':\n content = request.form['content']\n cursor.execute(\"UPDATE comment SET content = %s where cmt_id = %s;\", (content, cmt_id))\n conn.commit()\n cursor.execute(\"SELECT msg_id FROM comment where cmt_id = %s;\", (cmt_id,))\n m = cursor.fetchone()\n flash('Edit Success!')\n return redirect(url_for('comment.show', msg_id=m[0]))\n\n return render_template('comment/edit.html', m=m, cmt_id=cmt_id)","lang":"python","vul_type":"cwe-089","target_token_count":197,"sven_meta":{"func_name":"edit","file_name":"flaskr/flaskr/views/comment.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#109-2aedafbd2363","input":"@app.route('/quiz')\ndef quiz():\n\n varga = request.args.get('varga')\n\n try:\n rows =[]\n\n with sql.connect('amara.db') as con:\n con.row_factory = sql.Row\n cur = con.cursor()\n cur.execute(\"select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada.varga = '%s' order by random() limit 1;\" % varga)\n rows = cur.fetchall();\n\n artha = rows[0][\"artha\"];\n cur.execute(\"select pada from pada where varga = '%s' and artha = '%s' order by id\" % (varga, artha));\n paryaya = cur.fetchall();\n\n return render_template('quiz.html', rows=rows, paryaya=paryaya, varga=varga)\n finally:\n con.close()","target":"@app.route('/quiz')\ndef quiz():\n\n varga = request.args.get('varga')\n\n try:\n rows =[]\n\n with sql.connect('amara.db') as con:\n con.row_factory = sql.Row\n cur = con.cursor()\n cur.execute(\"select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada.varga = ? order by random() limit 1;\", [varga])\n rows = cur.fetchall();\n\n artha = rows[0][\"artha\"];\n cur.execute(\"select pada from pada where varga = ? and artha = ? order by id\", [varga, artha]);\n paryaya = cur.fetchall();\n\n return render_template('quiz.html', rows=rows, paryaya=paryaya, varga=varga)\n finally:\n con.close()","lang":"python","vul_type":"cwe-089","target_token_count":181,"sven_meta":{"func_name":"quiz","file_name":"docker/app.py","commit_link":"github.com/aupasana/amara-quiz/commit/6ceb5dc8ec38b4a3f1399e578ab970f7e3354922","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#111-5507aa07c6d3","input":" def add_month_data_row(self, inverter_serial, ts, etoday, etotal):\n\n y = datetime.fromtimestamp(ts) - timedelta(days=1)\n y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())\n\n query = '''\n INSERT INTO MonthData (\n TimeStamp,\n Serial,\n DayYield,\n TotalYield \n ) VALUES (\n %s,\n %s,\n %s,\n %s\n );\n ''' % (y_ts, inverter_serial, etoday, etotal)\n self.c.execute(query)","target":" def add_month_data_row(self, inverter_serial, ts, etoday, etotal):\n\n y = datetime.fromtimestamp(ts) - timedelta(days=1)\n y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())\n\n query = '''\n INSERT INTO MonthData (\n TimeStamp,\n Serial,\n DayYield,\n TotalYield \n ) VALUES (\n ?,\n ?,\n ?,\n ?\n );\n '''\n self.c.execute(query, (y_ts, inverter_serial, etoday, etotal))","lang":"python","vul_type":"cwe-089","target_token_count":129,"sven_meta":{"func_name":"add_month_data_row","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#113-97865eabf44b","input":"def karma_ask(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute(\n ''' SELECT karma FROM people WHERE name='{}' '''.format(name))\n karma = cursor.fetchone()\n if karma is None:\n logger.debug('No karma found for name {}'.format(name))\n db.close()\n return karma\n else:\n karma = karma[0]\n logger.debug('karma of {} found for name {}'.format(karma, name))\n db.close()\n return karma\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def karma_ask(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute(''' SELECT karma FROM people WHERE name=%(name)s ''',\n (name, ))\n karma = cursor.fetchone()\n if karma is None:\n logger.debug('No karma found for name {}'.format(name))\n db.close()\n return karma\n else:\n karma = karma[0]\n logger.debug('karma of {} found for name {}'.format(karma, name))\n db.close()\n return karma\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","target_token_count":131,"sven_meta":{"func_name":"karma_ask","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#114-8ba35ef870da","input":" def post(self):\n \"\"\" Returns JWT upon login verification \"\"\"\n json_data = request.get_json()\n if not json_data['email']:\n return jsonify({\"msg\": \"Missing email\"}), 400\n\n data = database_utilities.execute_query(\n f\"\"\"select * from admins where email = '{json_data['email']}'\"\"\")\n if data:\n email = data[0]['email']\n access_token = create_access_token(identity=email)\n refresh_token = create_refresh_token(identity=email)\n\n resp = jsonify({\"login\": True})\n set_access_cookies(resp, access_token)\n set_refresh_cookies(resp, refresh_token)\n return resp\n else:\n return jsonify({\"msg\": \"User is not an admin\"})","target":" def post(self):\n \"\"\" Returns JWT upon login verification \"\"\"\n json_data = request.get_json()\n if not json_data['email']:\n return jsonify({\"msg\": \"Missing email\"}), 400\n\n data = database_utilities.execute_query(\n f\"\"\"select * from admins where email = %s\"\"\", (json_data['email'], ))\n if data:\n email = data[0]['email']\n access_token = create_access_token(identity=email)\n refresh_token = create_refresh_token(identity=email)\n\n resp = jsonify({\"login\": True})\n set_access_cookies(resp, access_token)\n set_refresh_cookies(resp, refresh_token)\n return resp\n else:\n return jsonify({\"msg\": \"User is not an admin\"})","lang":"python","vul_type":"cwe-089","target_token_count":154,"sven_meta":{"func_name":"post","file_name":"apis/login.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#116-da096c040939","input":" def store_metadata(self, session, key, mType, value):\n if (self.idNormalizer is not None):\n id = self.idNormalizer.process_string(session, id)\n elif type(id) == unicode:\n id = id.encode('utf-8')\n else:\n id = str(id)\n self._openContainer(session)\n query = (\"UPDATE %s SET %s = %r WHERE identifier = '%s';\" %\n (self.table, mType, value, id)\n )\n try:\n self._query(query)\n except:\n return None\n return value","target":" def store_metadata(self, session, key, mType, value):\n if (self.idNormalizer is not None):\n id = self.idNormalizer.process_string(session, id)\n elif type(id) == unicode:\n id = id.encode('utf-8')\n else:\n id = str(id)\n self._openContainer(session)\n query = (\"UPDATE %s SET %s = $1 WHERE identifier = $2;\" %\n (self.table, mType)\n )\n args = (value, id)\n try:\n self._query(query, *args)\n except:\n return None\n return value","lang":"python","vul_type":"cwe-089","target_token_count":133,"sven_meta":{"func_name":"store_metadata","file_name":"cheshire3/sql/postgresStore.py","commit_link":"github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#127-fca877dcdb2e","input":"def get_top_author(top_num):\r\n \"\"\" query the top(top_num) popular author\r\n top_num => list of [author, count]\r\n \"\"\"\r\n cmd = \"\"\"SELECT authors.name,author_result.num\r\n FROM authors JOIN\r\n (SELECT SUM(article_result.num) as num,\r\n article_result.author\r\n from (SELECT articles.title, articles.author,\r\n SUM(log.views) AS num\r\n FROM articles\r\n INNER JOIN (\r\n SELECT path, count(path) AS views\r\n FROM log GROUP BY log.path\r\n ) AS log ON log.path = '/article/'\r\n || articles.slug\r\n GROUP BY articles.title, articles.author)\r\n AS article_result\r\n GROUP BY article_result.author) as author_result\r\n ON authors.id = author_result.author\r\n ORDER BY num DESC LIMIT {}\"\"\".format(top_num)\r\n return execute_query(cmd)","target":"def get_top_author(top_num):\r\n \"\"\" query the top(top_num) popular author\r\n top_num => list of [author, count]\r\n \"\"\"\r\n cmd = \"\"\"SELECT authors.name,author_result.num\r\n FROM authors JOIN\r\n (SELECT SUM(article_result.num) as num,\r\n article_result.author\r\n from (SELECT articles.title, articles.author,\r\n SUM(log.views) AS num\r\n FROM articles\r\n INNER JOIN (\r\n SELECT path, count(path) AS views\r\n FROM log GROUP BY log.path\r\n ) AS log ON log.path = '/article/'\r\n || articles.slug\r\n GROUP BY articles.title, articles.author)\r\n AS article_result\r\n GROUP BY article_result.author) as author_result\r\n ON authors.id = author_result.author\r\n ORDER BY num DESC LIMIT %s\"\"\"\r\n data = [top_num, ]\r\n return execute_query(cmd, data)","lang":"python","vul_type":"cwe-089","target_token_count":184,"sven_meta":{"func_name":"get_top_author","file_name":"logAnalyzerDb.py","commit_link":"github.com/thugasin/udacity-homework-logAnalyzer/commit/506f25f9a1caee7f17034adf7c75e0efbc88082b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#128-8da5f7a61fa8","input":"@app.route('/get_all_referrers')\ndef get_all_referrers():\n account_id = request.args.get('account_id')\n\n if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n\n account_id = j_l[\"result\"][0][\"id\"]\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"select * from referrers where referrer='\"+account_id+\"'\"\n cur.execute(query)\n results = cur.fetchall()\n\n return jsonify(results)","target":"@app.route('/get_all_referrers')\ndef get_all_referrers():\n account_id = request.args.get('account_id')\n\n if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n\n account_id = j_l[\"result\"][0][\"id\"]\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"select * from referrers where referrer=%s\"\n cur.execute(query, (account_id,))\n results = cur.fetchall()\n\n return jsonify(results)","lang":"python","vul_type":"cwe-089","target_token_count":152,"sven_meta":{"func_name":"get_all_referrers","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#131-01c22c89c62d","input":"def findNPC(race, classe, sex,level):\n\tc, conn = getConnection()\n\tdate = now()\n\t#select image, SUM(legit) as l FROM npc WHERE race='Elf' AND class='Bard' AND sex='Male' GROUP BY image HAVING l>5 ORDER BY SUM(legit) DESC;\n\tc.execute(\"select image, avg(legit) as l FROM npc WHERE race='\"+race+\"' AND class='\"+classe+\"' AND sex='\"+sex+\"' GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC;\")\n\tconn.commit()\n\tout = c.fetchmany(5)\n\tconn.close()\n\treturn out","target":"def findNPC(race, classe, sex,level):\n\tc, conn = getConnection()\n\tdate = now()\n\t#select image, SUM(legit) as l FROM npc WHERE race='Elf' AND class='Bard' AND sex='Male' GROUP BY image HAVING l>5 ORDER BY SUM(legit) DESC;\n\tc.execute(\"select image, avg(legit) as l FROM npc WHERE race=(?) AND class=(?) AND sex=(?) GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC\",(race,classe,sex))\n\tconn.commit()\n\tout = c.fetchmany(5)\n\tconn.close()\n\treturn out","lang":"python","vul_type":"cwe-089","target_token_count":137,"sven_meta":{"func_name":"findNPC","file_name":"database.py","commit_link":"github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#132-3599b0965d3c","input":"@mod.route('/edit/', methods=['GET', 'POST'])\ndef edit(msg_id):\n m = None\n if request.method == 'GET':\n sql = \"SELECT * FROM message where msg_id = %d;\" % (msg_id)\n cursor.execute(sql)\n m = cursor.fetchone()\n return render_template('message/edit.html', m=m, msg_id=msg_id)\n\n if request.method == 'POST':\n content = request.form['content']\n sql = \"UPDATE message SET content = '%s' where msg_id = '%d';\" \\\n % (content, msg_id)\n cursor.execute(sql)\n conn.commit()\n flash('Edit Success!')\n return redirect(url_for('show_entries'))\n\n return render_template('message/edit.html', m=m, msg_id=msg_id)","target":"@mod.route('/edit/', methods=['GET', 'POST'])\ndef edit(msg_id):\n m = None\n if request.method == 'GET':\n cursor.execute(\"SELECT * FROM message where msg_id = %s;\", (msg_id,))\n m = cursor.fetchone()\n return render_template('message/edit.html', m=m, msg_id=msg_id)\n\n if request.method == 'POST':\n content = request.form['content']\n cursor.execute(\"UPDATE message SET content = %s where msg_id = %s;\", (content, msg_id))\n conn.commit()\n flash('Edit Success!')\n return redirect(url_for('show_entries'))\n\n return render_template('message/edit.html', m=m, msg_id=msg_id)","lang":"python","vul_type":"cwe-089","target_token_count":154,"sven_meta":{"func_name":"edit","file_name":"flaskr/flaskr/views/message.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#142-769f57666923","input":"@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)\ndef get_login2(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n if bases.createuserbase.check_username(message.text):\n bot.send_message(message.chat.id, \"Invalid handle.\")\n set_state(message.chat.id, config.States.S_START.value)\n return 0\n\n conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n name = conn.fetchone()\n settings.close()\n bases.update.cf_update()\n bases.createuserbase.clean_base(name[1])\n bases.createuserbase.clean_base(message.text)\n bot.send_message(message.chat.id, \"Creating base...\")\n bases.createuserbase.init_user(message.text, message.chat.id)\n bot.send_message(message.chat.id, \"Done!\")\n set_state(message.chat.id, config.States.S_START.value)","target":"@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)\ndef get_login2(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n if bases.createuserbase.check_username(message.text):\n bot.send_message(message.chat.id, \"Invalid handle.\")\n set_state(message.chat.id, config.States.S_START.value)\n return 0\n conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))\n name = conn.fetchone()\n settings.close()\n bases.update.cf_update()\n bases.createuserbase.clean_base(name[1])\n bases.createuserbase.clean_base(message.text)\n bot.send_message(message.chat.id, \"Creating base...\")\n bases.createuserbase.init_user(message.text, message.chat.id)\n bot.send_message(message.chat.id, \"Done!\")\n set_state(message.chat.id, config.States.S_START.value)","lang":"python","vul_type":"cwe-089","target_token_count":208,"sven_meta":{"func_name":"get_login2","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#148-5323a3c85084","input":"@app.route('/referrer_count')\ndef referrer_count():\n account_id = request.args.get('account_id')\n\n if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n\n account_id = j_l[\"result\"][0][\"id\"]\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"select count(*) from referrers where referrer='\"+account_id+\"'\"\n cur.execute(query)\n results = cur.fetchone()\n\n return jsonify(results)","target":"@app.route('/referrer_count')\ndef referrer_count():\n account_id = request.args.get('account_id')\n\n if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n\n account_id = j_l[\"result\"][0][\"id\"]\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"select count(*) from referrers where referrer=%s\"\n cur.execute(query, (account_id,))\n results = cur.fetchone()\n\n return jsonify(results)","lang":"python","vul_type":"cwe-089","target_token_count":148,"sven_meta":{"func_name":"referrer_count","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#158-c5b08f85f58e","input":"@mod.route('/edit', methods=['GET', 'POST'])\ndef edit():\n sql = \"SELECT * FROM users where email = '%s';\" % (session['logged_email'])\n cursor.execute(sql)\n u = cursor.fetchone()\n if request.method == 'POST':\n sql = \"UPDATE users SET nickname = '%s' where email = '%s'\" \\\n % (request.form['nickname'], session['logged_email'])\n cursor.execute(sql)\n sql = \"SELECT * FROM users where email = '%s';\" \\\n % (session['logged_email'])\n cursor.execute(sql)\n u = cursor.fetchone()\n conn.commit()\n flash('Edit Nickname Success!')\n return render_template('users/edit.html', u=u)","target":"@mod.route('/edit', methods=['GET', 'POST'])\ndef edit():\n cursor.execute(\"SELECT * FROM users where email = %s;\", (session['logged_email'],))\n u = cursor.fetchone()\n if request.method == 'POST':\n cursor.execute(\"UPDATE users SET nickname = %s where email = %s\", (request.form['nickname'], session['logged_email']))\n cursor.execute(\"SELECT * FROM users where email = %s;\", (session['logged_email'],))\n u = cursor.fetchone()\n conn.commit()\n flash('Edit Nickname Success!')\n return render_template('users/edit.html', u=u)","lang":"python","vul_type":"cwe-089","target_token_count":130,"sven_meta":{"func_name":"edit","file_name":"flaskr/flaskr/views/users.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#159-d0699c4ebd53","input":"def shame_add(name):\n shame = shame_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if shame is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES('{}',0,1)\n '''.format(name))\n db.commit()\n logger.debug('Inserted into karmadb 1 shame for {}'.format(name))\n db.close()\n return 1\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n\n else:\n shame = shame + 1\n try:\n cursor.execute('''\n UPDATE people SET shame = {0} WHERE name = '{1}'\n '''.format(shame, name))\n db.commit()\n logger.debug('Inserted into karmadb {} shame for {}'.format(\n shame, name))\n db.close()\n return shame\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def shame_add(name):\n shame = shame_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if shame is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES(%(name)s,0,1)\n ''', (name, ))\n db.commit()\n logger.debug('Inserted into karmadb 1 shame for {}'.format(name))\n db.close()\n return 1\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n\n else:\n shame = shame + 1\n try:\n cursor.execute('''\n UPDATE people SET shame = %(karma)s WHERE name = %(name)s\n ''' (\n shame,\n name,\n ))\n db.commit()\n logger.debug('Inserted into karmadb {} shame for {}'.format(\n shame, name))\n db.close()\n return shame\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","target_token_count":218,"sven_meta":{"func_name":"shame_add","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#172-c15dc924ece8","input":"@hook.command(autohelp=False)\ndef showPoll(pollID, db=None):\n \"\"\"Shows the answers for a given poll.\"\"\"\n if not db_ready: db_init(db)\n if pollID == None:\n poll = db.execute(\"SELECT pollID, question FROM polls WHERE active = 1\")\n if len(poll) == 0:\n reply(\"There's no poll open.\")\n return\n else:\n poll = db.execute(\"SELECT pollID, question FROM polls WHERE pollID = '{}'\".format(pollID))\n if len(poll) == 0:\n reply(\"No such poll found.\")\n return\n pollID = poll[0][0]\n question = poll[0][1]\n reply(question)\n for (index, answer, votes) in db.execute(\"SELECT 'index', answer, count(voteID) FROM answers LEFT JOIN votes ON votes.answerID = answers.answerID WHERE pollID = {} GROUP BY answers.answerID, 'index', answer ORDER BY 'index' ASC\".format(pollID, )):\n reply(\"%s. %s (%s)\" % (index, answer, votes))","target":"@hook.command(autohelp=False)\ndef showPoll(pollID, db=None):\n \"\"\"Shows the answers for a given poll.\"\"\"\n if not db_ready: db_init(db)\n if pollID == None:\n poll = db.execute(\"SELECT pollID, question FROM polls WHERE active = 1\")\n if len(poll) == 0:\n reply(\"There's no poll open.\")\n return\n else:\n poll = db.execute(\"SELECT pollID, question FROM polls WHERE pollID = ?\", (pollID,))\n if len(poll) == 0:\n reply(\"No such poll found.\")\n return\n pollID = poll[0][0]\n question = poll[0][1]\n reply(question)\n for (index, answer, votes) in db.execute(\"SELECT 'index', answer, count(voteID) FROM answers LEFT JOIN votes ON votes.answerID = answers.answerID WHERE pollID = ? GROUP BY answers.answerID, 'index', answer ORDER BY 'index' ASC\", (pollID, )):\n reply(\"%s. %s (%s)\" % (index, answer, votes))","lang":"python","vul_type":"cwe-089","target_token_count":237,"sven_meta":{"func_name":"showPoll","file_name":"plugins/poll.py","commit_link":"github.com/FrozenPigs/Taigabot/commit/ea9b83a66ae1f0f38a1895f3e8dfa2833d77e3a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#174-6832ed65d258","input":" def analyze_smashgg(self, urls, name):\n LOG.info('we are about to analyze scene {} with {} brackets'.format(name, len(urls)))\n for url in urls:\n # Before we process this URL, check to see if we already have\n sql = \"SELECT * FROM analyzed where base_url='{}'\".format(url)\n res = self.db.exec(sql)\n if len(res) == 0:\n\n display_name = bracket_utils.get_display_base(url)\n\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n LOG.info('About to process pro bracket {}'.format(url))\n self.data_processor.process(url, name, display_name)\n else:\n LOG.info(\"Skpping pro bracket because it has already been analyzed: {}\".format(url))","target":" def analyze_smashgg(self, urls, name):\n LOG.info('we are about to analyze scene {} with {} brackets'.format(name, len(urls)))\n for url in urls:\n # Before we process this URL, check to see if we already have\n sql = \"SELECT * FROM analyzed where base_url='{url}'\"\n args = {'url':url}\n res = self.db.exec(sql, args)\n if len(res) == 0:\n\n display_name = bracket_utils.get_display_base(url)\n\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n LOG.info('About to process pro bracket {}'.format(url))\n self.data_processor.process(url, name, display_name)\n else:\n LOG.info(\"Skpping pro bracket because it has already been analyzed: {}\".format(url))","lang":"python","vul_type":"cwe-089","target_token_count":210,"sven_meta":{"func_name":"analyze_smashgg","file_name":"validURLs.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#179-067a050b27b8","input":" @staticmethod\n def _add_to_db(user):\n \"\"\"\n Adds User object to the database\n :param user: User object with info about user\n :return: None\n \"\"\"\n query = (\"INSERT INTO users (chat_id, first_name, nickname, \"\n \"last_name, language) \"\n f\"VALUES ({user.chat_id}, '{user.first_name}', \"\n f\"'{user.nickname}', '{user.last_name}', '{user.language}')\")\n try:\n db.add(query)\n except DatabaseError:\n log.error(\"Cannot add user to the database\")\n else:\n log.info(f\"User {user} was successfully added to the users db\")","target":" @staticmethod\n def _add_to_db(user):\n \"\"\"\n Adds User object to the database\n :param user: User object with info about user\n :return: None\n \"\"\"\n query = (\"INSERT INTO users (chat_id, first_name, nickname, \"\n \"last_name, language) \"\n f\"VALUES (%s, %s, %s, %s, %s)\")\n\n parameters = (user.chat_id, user.first_name, user.nickname,\n user.last_name, user.language)\n\n try:\n db.add(query, parameters)\n except DatabaseError:\n log.error(\"Cannot add user to the database\")\n else:\n log.info(f\"User {user} was successfully added to the users db\")","lang":"python","vul_type":"cwe-089","target_token_count":155,"sven_meta":{"func_name":"_add_to_db","file_name":"photogpsbot/users.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-125#5-5be13d78c64c","input":"static void set_fdc(int drive)\n{\n\tif (drive >= 0 && drive < N_DRIVE) {\n\t\tfdc = FDC(drive);\n\t\tcurrent_drive = drive;\n\t}\n\tif (fdc != 1 && fdc != 0) {\n\t\tpr_info(\"bad fdc value\\n\");\n\t\treturn;\n\t}\n\tset_dor(fdc, ~0, 8);\n#if N_FDC > 1\n\tset_dor(1 - fdc, ~8, 0);\n#endif\n\tif (FDCS->rawcmd == 2)\n\t\treset_fdc_info(1);\n\tif (fd_inb(FD_STATUS) != STATUS_READY)\n\t\tFDCS->reset = 1;\n}","target":"static void set_fdc(int drive)\n{\n\tunsigned int new_fdc = fdc;\n\n\tif (drive >= 0 && drive < N_DRIVE) {\n\t\tnew_fdc = FDC(drive);\n\t\tcurrent_drive = drive;\n\t}\n\tif (new_fdc >= N_FDC) {\n\t\tpr_info(\"bad fdc value\\n\");\n\t\treturn;\n\t}\n\tfdc = new_fdc;\n\tset_dor(fdc, ~0, 8);\n#if N_FDC > 1\n\tset_dor(1 - fdc, ~8, 0);\n#endif\n\tif (FDCS->rawcmd == 2)\n\t\treset_fdc_info(1);\n\tif (fd_inb(FD_STATUS) != STATUS_READY)\n\t\tFDCS->reset = 1;\n}","lang":"c","vul_type":"cwe-125","target_token_count":163,"sven_meta":{"func_name":"set_fdc","file_name":"drivers/block/floppy.c","commit_link":"github.com/torvalds/linux/commit/2e90ca68b0d2f5548804f22f0dd61145516171e3","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#31-a6c623fc3d6c","input":"BOOL glyph_cache_put(rdpGlyphCache* glyphCache, UINT32 id, UINT32 index, rdpGlyph* glyph)\n{\n\trdpGlyph* prevGlyph;\n\n\tif (id > 9)\n\t{\n\t\tWLog_ERR(TAG, \"invalid glyph cache id: %\" PRIu32 \"\", id);\n\t\treturn FALSE;\n\t}\n\n\tif (index > glyphCache->glyphCache[id].number)\n\t{\n\t\tWLog_ERR(TAG, \"invalid glyph cache index: %\" PRIu32 \" in cache id: %\" PRIu32 \"\", index, id);\n\t\treturn FALSE;\n\t}\n\n\tWLog_Print(glyphCache->log, WLOG_DEBUG, \"GlyphCachePut: id: %\" PRIu32 \" index: %\" PRIu32 \"\", id,\n\t index);\n\tprevGlyph = glyphCache->glyphCache[id].entries[index];\n\n\tif (prevGlyph)\n\t\tprevGlyph->Free(glyphCache->context, prevGlyph);\n\n\tglyphCache->glyphCache[id].entries[index] = glyph;\n\treturn TRUE;\n}","target":"BOOL glyph_cache_put(rdpGlyphCache* glyphCache, UINT32 id, UINT32 index, rdpGlyph* glyph)\n{\n\trdpGlyph* prevGlyph;\n\n\tif (id > 9)\n\t{\n\t\tWLog_ERR(TAG, \"invalid glyph cache id: %\" PRIu32 \"\", id);\n\t\treturn FALSE;\n\t}\n\n\tif (index >= glyphCache->glyphCache[id].number)\n\t{\n\t\tWLog_ERR(TAG, \"invalid glyph cache index: %\" PRIu32 \" in cache id: %\" PRIu32 \"\", index, id);\n\t\treturn FALSE;\n\t}\n\n\tWLog_Print(glyphCache->log, WLOG_DEBUG, \"GlyphCachePut: id: %\" PRIu32 \" index: %\" PRIu32 \"\", id,\n\t index);\n\tprevGlyph = glyphCache->glyphCache[id].entries[index];\n\n\tif (prevGlyph)\n\t\tprevGlyph->Free(glyphCache->context, prevGlyph);\n\n\tglyphCache->glyphCache[id].entries[index] = glyph;\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-125","target_token_count":213,"sven_meta":{"func_name":"glyph_cache_put","file_name":"libfreerdp/cache/glyph.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/c0fd449ec0870b050d350d6d844b1ea6dad4bc7d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#49-834f16d59a73","input":"Status GraphConstructor::MakeEdge(Node* src, int output_index, Node* dst,\n int input_index) {\n DataType src_out = src->output_type(output_index);\n DataType dst_in = dst->input_type(input_index);\n if (!TypesCompatible(dst_in, src_out)) {\n return errors::InvalidArgument(\n \"Input \", input_index, \" of node \", dst->name(), \" was passed \",\n DataTypeString(src_out), \" from \", src->name(), \":\", output_index,\n \" incompatible with expected \", DataTypeString(dst_in), \".\");\n }\n g_->AddEdge(src, output_index, dst, input_index);\n return Status::OK();\n}","target":"Status GraphConstructor::MakeEdge(Node* src, int output_index, Node* dst,\n int input_index) {\n if (output_index >= src->num_outputs()) {\n return errors::InvalidArgument(\n \"Output \", output_index, \" of node \", src->name(),\n \" does not exist. Node only has \", src->num_outputs(), \" outputs.\");\n }\n if (input_index >= dst->num_inputs()) {\n return errors::InvalidArgument(\n \"Input \", input_index, \" of node \", dst->name(),\n \" does not exist. Node only has \", dst->num_inputs(), \" inputs.\");\n }\n\n DataType src_out = src->output_type(output_index);\n DataType dst_in = dst->input_type(input_index);\n if (!TypesCompatible(dst_in, src_out)) {\n return errors::InvalidArgument(\n \"Input \", input_index, \" of node \", dst->name(), \" was passed \",\n DataTypeString(src_out), \" from \", src->name(), \":\", output_index,\n \" incompatible with expected \", DataTypeString(dst_in), \".\");\n }\n g_->AddEdge(src, output_index, dst, input_index);\n return Status::OK();\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":248,"sven_meta":{"func_name":"tensorflow::GraphConstructor::MakeEdge","file_name":"tensorflow/core/common_runtime/graph_constructor.cc","commit_link":"github.com/tensorflow/tensorflow/commit/0cc38aaa4064fd9e79101994ce9872c6d91f816b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#100-b2130ff83dbb","input":" static bool TryParse(const char* inp, int length,\n TypedValue* buf, Variant& out,\n JSONContainerType container_type, bool is_tsimplejson) {\n SimpleParser parser(inp, length, buf, container_type, is_tsimplejson);\n bool ok = parser.parseValue();\n parser.skipSpace();\n if (!ok || parser.p != inp + length) {\n // Unsupported, malformed, or trailing garbage. Release entire stack.\n tvDecRefRange(buf, parser.top);\n return false;\n }\n out = Variant::attach(*--parser.top);\n return true;\n }","target":" static bool TryParse(const char* inp, int length,\n TypedValue* buf, Variant& out,\n JSONContainerType container_type, bool is_tsimplejson) {\n SimpleParser parser(inp, length, buf, container_type, is_tsimplejson);\n bool ok = parser.parseValue();\n if (!ok ||\n (parser.skipSpace(), parser.p != inp + length)) {\n // Unsupported, malformed, or trailing garbage. Release entire stack.\n tvDecRefRange(buf, parser.top);\n return false;\n }\n out = Variant::attach(*--parser.top);\n return true;\n }","lang":"cpp","vul_type":"cwe-125","target_token_count":129,"sven_meta":{"func_name":"HPHP::SimpleParser::TryParse","file_name":"hphp/runtime/ext/json/JSON_parser.cpp","commit_link":"github.com/facebook/hhvm/commit/bd586671a3c22eb2f07e55f11b3ce64e1f7961e7","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#109-107867ddb036","input":"static void exif_process_APP12(image_info_type *ImageInfo,\n char *buffer, size_t length) {\n size_t l1, l2=0;\n if ((l1 = php_strnlen(buffer+2, length-2)) > 0) {\n exif_iif_add_tag(ImageInfo, SECTION_APP12, \"Company\",\n TAG_NONE, TAG_FMT_STRING, l1, buffer+2);\n if (length > 2+l1+1) {\n l2 = php_strnlen(buffer+2+l1+1, length-2-l1+1);\n exif_iif_add_tag(ImageInfo, SECTION_APP12, \"Info\",\n TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1);\n }\n }\n}","target":"static void exif_process_APP12(image_info_type *ImageInfo,\n char *buffer, size_t length) {\n size_t l1, l2=0;\n if ((l1 = php_strnlen(buffer+2, length-2)) > 0) {\n exif_iif_add_tag(ImageInfo, SECTION_APP12, \"Company\",\n TAG_NONE, TAG_FMT_STRING, l1, buffer+2);\n if (length > 2+l1+1) {\n l2 = php_strnlen(buffer+2+l1+1, length-2-l1-1);\n exif_iif_add_tag(ImageInfo, SECTION_APP12, \"Info\",\n TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1);\n }\n }\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":171,"sven_meta":{"func_name":"HPHP::exif_process_APP12","file_name":"hphp/runtime/ext/gd/ext_gd.cpp","commit_link":"github.com/facebook/hhvm/commit/f1cd34e63c2a0d9702be3d41462db7bfd0ae7da3","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#118-1da1e3da1a95","input":"str_lower_case_match(OnigEncoding enc, int case_fold_flag,\n const UChar* t, const UChar* tend,\n const UChar* p, const UChar* end)\n{\n int lowlen;\n UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n while (t < tend) {\n lowlen = ONIGENC_MBC_CASE_FOLD(enc, case_fold_flag, &p, end, lowbuf);\n q = lowbuf;\n while (lowlen > 0) {\n if (*t++ != *q++) return 0;\n lowlen--;\n }\n }\n\n return 1;\n}","target":"str_lower_case_match(OnigEncoding enc, int case_fold_flag,\n const UChar* t, const UChar* tend,\n const UChar* p, const UChar* end)\n{\n int lowlen;\n UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n while (t < tend) {\n lowlen = ONIGENC_MBC_CASE_FOLD(enc, case_fold_flag, &p, end, lowbuf);\n q = lowbuf;\n while (lowlen > 0) {\n if (t >= tend) return 0;\n if (*t++ != *q++) return 0;\n lowlen--;\n }\n }\n\n return 1;\n}","lang":"c","vul_type":"cwe-125","target_token_count":156,"sven_meta":{"func_name":"str_lower_case_match","file_name":"src/regexec.c","commit_link":"github.com/kkos/oniguruma/commit/d3e402928b6eb3327f8f7d59a9edfa622fec557b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#122-16ac52020ab4","input":"static int sh_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tut8 op_MSB,op_LSB;\n\tint ret;\n\tif (!data)\n\t\treturn 0;\n\tmemset (op, '\\0', sizeof (RAnalOp));\n\top->addr = addr;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->jump = op->fail = -1;\n\top->ptr = op->val = -1;\n\n\top->size = 2;\n\n\top_MSB = anal->big_endian? data[0]: data[1];\n\top_LSB = anal->big_endian? data[1]: data[0];\n\tret = first_nibble_decode[(op_MSB>>4) & 0x0F](anal, op, (ut16)(op_MSB<<8 | op_LSB));\n\treturn ret;\n}","target":"static int sh_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tut8 op_MSB,op_LSB;\n\tint ret;\n\tif (!data || len < 2) {\n\t\treturn 0;\n\t}\n\tmemset (op, '\\0', sizeof (RAnalOp));\n\top->addr = addr;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->jump = op->fail = -1;\n\top->ptr = op->val = -1;\n\n\top->size = 2;\n\n\top_MSB = anal->big_endian? data[0]: data[1];\n\top_LSB = anal->big_endian? data[1]: data[0];\n\tret = first_nibble_decode[(op_MSB>>4) & 0x0F](anal, op, (ut16)(op_MSB<<8 | op_LSB));\n\treturn ret;\n}","lang":"c","vul_type":"cwe-125","target_token_count":191,"sven_meta":{"func_name":"sh_op","file_name":"libr/anal/p/anal_sh.c","commit_link":"github.com/radare/radare2/commit/77c47cf873dd55b396da60baa2ca83bbd39e4add","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#126-8f5d075e069e","input":"int string_rfind(const char *input, int len, const char *s, int s_len,\n int pos, bool case_sensitive) {\n assertx(input);\n assertx(s);\n if (!s_len || pos < -len || pos > len) {\n return -1;\n }\n void *ptr;\n if (case_sensitive) {\n if (pos >= 0) {\n ptr = bstrrstr(input + pos, len - pos, s, s_len);\n } else {\n ptr = bstrrstr(input, len + pos + s_len, s, s_len);\n }\n } else {\n if (pos >= 0) {\n ptr = bstrrcasestr(input + pos, len - pos, s, s_len);\n } else {\n ptr = bstrrcasestr(input, len + pos + s_len, s, s_len);\n }\n }\n if (ptr != nullptr) {\n return (int)((const char *)ptr - input);\n }\n return -1;\n}","target":"int string_rfind(const char *input, int len, const char *s, int s_len,\n int pos, bool case_sensitive) {\n assertx(input);\n assertx(s);\n if (!s_len || pos < -len || pos > len) {\n return -1;\n }\n void *ptr;\n if (case_sensitive) {\n if (pos >= 0) {\n ptr = bstrrstr(input + pos, len - pos, s, s_len);\n } else {\n ptr = bstrrstr(input, len + std::min(pos + s_len, 0), s, s_len);\n }\n } else {\n if (pos >= 0) {\n ptr = bstrrcasestr(input + pos, len - pos, s, s_len);\n } else {\n ptr = bstrrcasestr(input, len + std::min(pos + s_len, 0), s, s_len);\n }\n }\n if (ptr != nullptr) {\n return (int)((const char *)ptr - input);\n }\n return -1;\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":235,"sven_meta":{"func_name":"HPHP::string_rfind","file_name":"hphp/runtime/base/zend-string.cpp","commit_link":"github.com/facebook/hhvm/commit/46003b4ab564b2abcd8470035fc324fe36aa8c75","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-078#8-051085388770","input":"@app.route('/delete_video/')\ndef delete_video(filename):\n\tif 'username' in session:\n\t\t#os.remove(\"static/videos/{}\".format(filename))\n\t\tprint(session['username'], file=sys.stdout)\n\t\tdata=users.query.filter_by(Username=session['username']).first()\n\t\tvideo=Video.query.filter_by(UserID=data.UserID,Name=filename).first()\n\t\tif video != None:\n\t\t\tos.remove(\"static/videos/{}\".format(filename))\n\t\t\tdb.session.delete(video)\n\t\t\tdb.session.commit()\n\t\telse:\n\t\t\treturn \"Don't delete other people's videos!\"\n\t\treturn redirect(url_for('upload'))\n\treturn \"test\"","target":"@app.route('/delete_video/')\ndef delete_video(filename):\n\tif 'username' in session:\n\t\t#os.remove(\"static/videos/{}\".format(filename))\n\t\tprint(session['username'], file=sys.stdout)\n\t\tdata=users.query.filter_by(Username=session['username']).first()\n\t\tvideo=Video.query.filter_by(UserID=data.UserID,Name=filename).first()\n\t\tif video != None:\n\t\t\t#os.remove(\"static/videos/{}\".format(filename))\n\t\t\tos.system(\"rm static/videos/{}\".format(filename))\n\t\t\tdb.session.delete(video)\n\t\t\tdb.session.commit()\n\t\telse:\n\t\t\treturn \"Don't delete other people's videos!\"\n\t\treturn redirect(url_for('upload'))\n\treturn \"test\"","lang":"python","vul_type":"cwe-078","target_token_count":144,"sven_meta":{"func_name":"delete_video","file_name":"Trialwebsite/app/app.py","commit_link":"github.com/jmarcello97/CSEC-380-Project/commit/05dcd628aa5879b6e4979c43e7c635075975de09","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#15-a7e17c1eb154","input":" def extend_volume(self, volume, new_size):\n LOG.debug(_('enter: extend_volume: volume %s') % volume['id'])\n ret = self._ensure_vdisk_no_fc_mappings(volume['name'],\n allow_snaps=False)\n if not ret:\n exception_message = (_('extend_volume: Extending a volume with '\n 'snapshots is not supported.'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n extend_amt = int(new_size) - volume['size']\n ssh_cmd = ('svctask expandvdisksize -size %(amt)d -unit gb %(name)s'\n % {'amt': extend_amt, 'name': volume['name']})\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from expandvdisksize\n self._assert_ssh_return(len(out.strip()) == 0, 'extend_volume',\n ssh_cmd, out, err)\n LOG.debug(_('leave: extend_volume: volume %s') % volume['id'])","target":" def extend_volume(self, volume, new_size):\n LOG.debug(_('enter: extend_volume: volume %s') % volume['id'])\n ret = self._ensure_vdisk_no_fc_mappings(volume['name'],\n allow_snaps=False)\n if not ret:\n exception_message = (_('extend_volume: Extending a volume with '\n 'snapshots is not supported.'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n extend_amt = int(new_size) - volume['size']\n ssh_cmd = (['svctask', 'expandvdisksize', '-size', str(extend_amt),\n '-unit', 'gb', volume['name']])\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from expandvdisksize\n self._assert_ssh_return(len(out.strip()) == 0, 'extend_volume',\n ssh_cmd, out, err)\n LOG.debug(_('leave: extend_volume: volume %s') % volume['id'])","lang":"python","vul_type":"cwe-078","target_token_count":209,"sven_meta":{"func_name":"extend_volume","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#17-a67233c6bcce","input":" def _get_hostvdisk_mappings(self, host_name):\n \"\"\"Return the defined storage mappings for a host.\"\"\"\n\n return_data = {}\n ssh_cmd = 'svcinfo lshostvdiskmap -delim ! %s' % host_name\n out, err = self._run_ssh(ssh_cmd)\n\n mappings = out.strip().split('\\n')\n if len(mappings):\n header = mappings.pop(0)\n for mapping_line in mappings:\n mapping_data = self._get_hdr_dic(header, mapping_line, '!')\n return_data[mapping_data['vdisk_name']] = mapping_data\n\n return return_data","target":" def _get_hostvdisk_mappings(self, host_name):\n \"\"\"Return the defined storage mappings for a host.\"\"\"\n\n return_data = {}\n ssh_cmd = ['svcinfo', 'lshostvdiskmap', '-delim', '!', host_name]\n out, err = self._run_ssh(ssh_cmd)\n\n mappings = out.strip().split('\\n')\n if len(mappings):\n header = mappings.pop(0)\n for mapping_line in mappings:\n mapping_data = self._get_hdr_dic(header, mapping_line, '!')\n return_data[mapping_data['vdisk_name']] = mapping_data\n\n return return_data","lang":"python","vul_type":"cwe-078","target_token_count":133,"sven_meta":{"func_name":"_get_hostvdisk_mappings","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#19-2c4f06be1765","input":" def _get_vvset_from_3par(self, volume_name):\n \"\"\"Get Virtual Volume Set from 3PAR.\n\n The only way to do this currently is to try and delete the volume\n to get the error message.\n\n NOTE(walter-boring): don't call this unless you know the volume is\n already in a vvset!\n \"\"\"\n cmd = \"removevv -f %s\" % volume_name\n LOG.debug(\"Issuing remove command to find vvset name %s\" % cmd)\n out = self._cli_run(cmd, None)\n vvset_name = None\n if out and len(out) > 1:\n if out[1].startswith(\"Attempt to delete \"):\n words = out[1].split(\" \")\n vvset_name = words[len(words) - 1]\n\n return vvset_name","target":" def _get_vvset_from_3par(self, volume_name):\n \"\"\"Get Virtual Volume Set from 3PAR.\n\n The only way to do this currently is to try and delete the volume\n to get the error message.\n\n NOTE(walter-boring): don't call this unless you know the volume is\n already in a vvset!\n \"\"\"\n cmd = ['removevv', '-f', volume_name]\n LOG.debug(\"Issuing remove command to find vvset name %s\" % cmd)\n out = self._cli_run(cmd)\n vvset_name = None\n if out and len(out) > 1:\n if out[1].startswith(\"Attempt to delete \"):\n words = out[1].split(\" \")\n vvset_name = words[len(words) - 1]\n\n return vvset_name","lang":"python","vul_type":"cwe-078","target_token_count":177,"sven_meta":{"func_name":"_get_vvset_from_3par","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#21-4ed7bfadae56","input":" def _add_volume_to_volume_set(self, volume, volume_name,\n cpg, vvs_name, qos):\n if vvs_name is not None:\n # Admin has set a volume set name to add the volume to\n self._cli_run('createvvset -add %s %s' % (vvs_name,\n volume_name), None)\n else:\n vvs_name = self._get_3par_vvs_name(volume['id'])\n domain = self.get_domain(cpg)\n self._cli_run('createvvset -domain %s %s' % (domain,\n vvs_name), None)\n self._set_qos_rule(qos, vvs_name)\n self._cli_run('createvvset -add %s %s' % (vvs_name,\n volume_name), None)","target":" def _add_volume_to_volume_set(self, volume, volume_name,\n cpg, vvs_name, qos):\n if vvs_name is not None:\n # Admin has set a volume set name to add the volume to\n self._cli_run(['createvvset', '-add', vvs_name, volume_name])\n else:\n vvs_name = self._get_3par_vvs_name(volume['id'])\n domain = self.get_domain(cpg)\n self._cli_run(['createvvset', '-domain', domain, vvs_name])\n self._set_qos_rule(qos, vvs_name)\n self._cli_run(['createvvset', '-add', vvs_name, volume_name])","lang":"python","vul_type":"cwe-078","target_token_count":151,"sven_meta":{"func_name":"_add_volume_to_volume_set","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#22-9173534e3de7","input":" def test_initialize_connection(self):\n self.driver._eql_execute = self.mox.\\\n CreateMock(self.driver._eql_execute)\n volume = {'name': self.volume_name}\n self.stubs.Set(self.driver, \"_get_iscsi_properties\",\n self._fake_get_iscsi_properties)\n self.driver._eql_execute('volume', 'select', volume['name'], 'access',\n 'create', 'initiator',\n self.connector['initiator'],\n 'authmethod chap',\n 'username',\n self.configuration.eqlx_chap_login)\n self.mox.ReplayAll()\n iscsi_properties = self.driver.initialize_connection(volume,\n self.connector)\n self.assertEqual(iscsi_properties['data'],\n self._fake_get_iscsi_properties(volume))","target":" def test_initialize_connection(self):\n self.driver._eql_execute = self.mox.\\\n CreateMock(self.driver._eql_execute)\n volume = {'name': self.volume_name}\n self.stubs.Set(self.driver, \"_get_iscsi_properties\",\n self._fake_get_iscsi_properties)\n self.driver._eql_execute('volume', 'select', volume['name'], 'access',\n 'create', 'initiator',\n self.connector['initiator'],\n 'authmethod', 'chap',\n 'username',\n self.configuration.eqlx_chap_login)\n self.mox.ReplayAll()\n iscsi_properties = self.driver.initialize_connection(volume,\n self.connector)\n self.assertEqual(iscsi_properties['data'],\n self._fake_get_iscsi_properties(volume))","lang":"python","vul_type":"cwe-078","target_token_count":165,"sven_meta":{"func_name":"test_initialize_connection","file_name":"cinder/tests/test_eqlx.py","commit_link":"github.com/thatsdone/cinder/commit/9e858bebb89de05b1c9ecc27f5bd9fbff95a728e","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#28-a8345f6f520b","input":" def _get_fc_wwpns(self):\n for key in self._storage_nodes:\n node = self._storage_nodes[key]\n ssh_cmd = 'svcinfo lsnode -delim ! %s' % node['id']\n raw = self._run_ssh(ssh_cmd)\n resp = CLIResponse(raw, delim='!', with_header=False)\n wwpns = set(node['WWPN'])\n for i, s in resp.select('port_id', 'port_status'):\n if 'unconfigured' != s:\n wwpns.add(i)\n node['WWPN'] = list(wwpns)\n LOG.info(_('WWPN on node %(node)s: %(wwpn)s')\n % {'node': node['id'], 'wwpn': node['WWPN']})","target":" def _get_fc_wwpns(self):\n for key in self._storage_nodes:\n node = self._storage_nodes[key]\n ssh_cmd = ['svcinfo', 'lsnode', '-delim', '!', node['id']]\n raw = self._run_ssh(ssh_cmd)\n resp = CLIResponse(raw, delim='!', with_header=False)\n wwpns = set(node['WWPN'])\n for i, s in resp.select('port_id', 'port_status'):\n if 'unconfigured' != s:\n wwpns.add(i)\n node['WWPN'] = list(wwpns)\n LOG.info(_('WWPN on node %(node)s: %(wwpn)s')\n % {'node': node['id'], 'wwpn': node['WWPN']})","lang":"python","vul_type":"cwe-078","target_token_count":168,"sven_meta":{"func_name":"_get_fc_wwpns","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#32-af664687ce1a","input":" def add_extra_args(self, args=None):\n \"\"\"Add more args depending on how known args are set.\"\"\"\n parsed = vars(self.parse_known_args(nohelp=True)[0])\n\n # find which image mode specified if any, and add additional arguments\n image_mode = parsed.get('image_mode', None)\n if image_mode is not None and image_mode != 'none':\n self.add_image_args(image_mode)\n\n # find which task specified if any, and add its specific arguments\n task = parsed.get('task', None)\n if task is not None:\n self.add_task_args(task)\n evaltask = parsed.get('evaltask', None)\n if evaltask is not None:\n self.add_task_args(evaltask)\n\n # find which model specified if any, and add its specific arguments\n model = parsed.get('model', None)\n if model is not None:\n self.add_model_subargs(model)\n\n # reset parser-level defaults over any model-level defaults\n try:\n self.set_defaults(**self._defaults)\n except AttributeError:\n raise RuntimeError('Please file an issue on github that argparse '\n 'got an attribute error when parsing.')","target":" def add_extra_args(self, args=None):\n \"\"\"Add more args depending on how known args are set.\"\"\"\n parsed = vars(self.parse_known_args(args, nohelp=True)[0])\n\n # find which image mode specified if any, and add additional arguments\n image_mode = parsed.get('image_mode', None)\n if image_mode is not None and image_mode != 'none':\n self.add_image_args(image_mode)\n\n # find which task specified if any, and add its specific arguments\n task = parsed.get('task', None)\n if task is not None:\n self.add_task_args(task)\n evaltask = parsed.get('evaltask', None)\n if evaltask is not None:\n self.add_task_args(evaltask)\n\n # find which model specified if any, and add its specific arguments\n model = parsed.get('model', None)\n if model is not None:\n self.add_model_subargs(model)\n\n # reset parser-level defaults over any model-level defaults\n try:\n self.set_defaults(**self._defaults)\n except AttributeError:\n raise RuntimeError('Please file an issue on github that argparse '\n 'got an attribute error when parsing.')","lang":"python","vul_type":"cwe-078","target_token_count":245,"sven_meta":{"func_name":"add_extra_args","file_name":"parlai/core/params.py","commit_link":"github.com/freedombenLiu/ParlAI/commit/601668d569e1276e0b8bf2bf8fb43e391e10d170","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#35-58155d98d841","input":" def _copy_volume(self, src_name, dest_name, cpg=None, snap_cpg=None,\n tpvv=True):\n # Virtual volume sets are not supported with the -online option\n cmd = 'createvvcopy -p %s -online ' % src_name\n if snap_cpg:\n cmd += '-snp_cpg %s ' % snap_cpg\n if tpvv:\n cmd += '-tpvv '\n if cpg:\n cmd += cpg + ' '\n cmd += dest_name\n LOG.debug('Creating clone of a volume with %s' % cmd)\n self._cli_run(cmd, None)","target":" def _copy_volume(self, src_name, dest_name, cpg=None, snap_cpg=None,\n tpvv=True):\n # Virtual volume sets are not supported with the -online option\n cmd = ['createvvcopy', '-p', src_name, '-online']\n if snap_cpg:\n cmd.extend(['-snp_cpg', snap_cpg])\n if tpvv:\n cmd.append('-tpvv')\n if cpg:\n cmd.append(cpg)\n cmd.append(dest_name)\n LOG.debug('Creating clone of a volume with %s' % cmd)\n self._cli_run(cmd)","lang":"python","vul_type":"cwe-078","target_token_count":131,"sven_meta":{"func_name":"_copy_volume","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#37-ae5288192ffe","input":" def initialize_connection(self, volume, connector):\n \"\"\"Restrict access to a volume.\"\"\"\n try:\n cmd = ['volume', 'select', volume['name'], 'access', 'create',\n 'initiator', connector['initiator']]\n if self.configuration.eqlx_use_chap:\n cmd.extend(['authmethod chap', 'username',\n self.configuration.eqlx_chap_login])\n self._eql_execute(*cmd)\n iscsi_properties = self._get_iscsi_properties(volume)\n return {\n 'driver_volume_type': 'iscsi',\n 'data': iscsi_properties\n }\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_('Failed to initialize connection to volume %s'),\n volume['name'])","target":" def initialize_connection(self, volume, connector):\n \"\"\"Restrict access to a volume.\"\"\"\n try:\n cmd = ['volume', 'select', volume['name'], 'access', 'create',\n 'initiator', connector['initiator']]\n if self.configuration.eqlx_use_chap:\n cmd.extend(['authmethod', 'chap', 'username',\n self.configuration.eqlx_chap_login])\n self._eql_execute(*cmd)\n iscsi_properties = self._get_iscsi_properties(volume)\n return {\n 'driver_volume_type': 'iscsi',\n 'data': iscsi_properties\n }\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_('Failed to initialize connection to volume %s'),\n volume['name'])","lang":"python","vul_type":"cwe-078","target_token_count":162,"sven_meta":{"func_name":"initialize_connection","file_name":"cinder/volume/drivers/eqlx.py","commit_link":"github.com/thatsdone/cinder/commit/9e858bebb89de05b1c9ecc27f5bd9fbff95a728e","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#41-0485d4663ad0","input":"bool IsBlacklistedArg(const base::CommandLine::CharType* arg) {\n#if defined(OS_WIN)\n const auto converted = base::WideToUTF8(arg);\n const char* a = converted.c_str();\n#else\n const char* a = arg;\n#endif\n\n static const char* prefixes[] = {\"--\", \"-\", \"/\"};\n\n int prefix_length = 0;\n for (auto& prefix : prefixes) {\n if (base::StartsWith(a, prefix, base::CompareCase::SENSITIVE)) {\n prefix_length = strlen(prefix);\n break;\n }\n }\n\n if (prefix_length > 0) {\n a += prefix_length;\n std::string switch_name(a, strcspn(a, \"=\"));\n auto* iter = std::lower_bound(std::begin(kBlacklist), std::end(kBlacklist),\n switch_name);\n if (iter != std::end(kBlacklist) && switch_name == *iter) {\n return true;\n }\n }\n\n return false;\n}","target":"bool IsBlacklistedArg(const base::CommandLine::CharType* arg) {\n#if defined(OS_WIN)\n const auto converted = base::WideToUTF8(arg);\n const char* a = converted.c_str();\n#else\n const char* a = arg;\n#endif\n\n static const char* prefixes[] = {\"--\", \"-\", \"/\"};\n\n int prefix_length = 0;\n for (auto& prefix : prefixes) {\n if (base::StartsWith(a, prefix, base::CompareCase::SENSITIVE)) {\n prefix_length = strlen(prefix);\n break;\n }\n }\n\n if (prefix_length > 0) {\n a += prefix_length;\n std::string switch_name =\n base::ToLowerASCII(base::StringPiece(a, strcspn(a, \"=\")));\n auto* iter = std::lower_bound(std::begin(kBlacklist), std::end(kBlacklist),\n switch_name);\n if (iter != std::end(kBlacklist) && switch_name == *iter) {\n return true;\n }\n }\n\n return false;\n}","lang":"cpp","vul_type":"cwe-078","target_token_count":224,"sven_meta":{"func_name":"IsBlacklistedArg","file_name":"atom/app/command_line_args.cc","commit_link":"github.com/electron/electron/commit/ce361a12e355f9e1e99c989f1ea056c9e502dbe7","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#45-504b6b13d1ff","input":" def _call_prepare_fc_map(self, fc_map_id, source, target):\n try:\n out, err = self._run_ssh('svctask prestartfcmap %s' % fc_map_id)\n except exception.ProcessExecutionError as e:\n with excutils.save_and_reraise_exception():\n LOG.error(_('_prepare_fc_map: Failed to prepare FlashCopy '\n 'from %(source)s to %(target)s.\\n'\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'source': source,\n 'target': target,\n 'out': e.stdout,\n 'err': e.stderr})","target":" def _call_prepare_fc_map(self, fc_map_id, source, target):\n try:\n out, err = self._run_ssh(['svctask', 'prestartfcmap', fc_map_id])\n except exception.ProcessExecutionError as e:\n with excutils.save_and_reraise_exception():\n LOG.error(_('_prepare_fc_map: Failed to prepare FlashCopy '\n 'from %(source)s to %(target)s.\\n'\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'source': source,\n 'target': target,\n 'out': e.stdout,\n 'err': e.stderr})","lang":"python","vul_type":"cwe-078","target_token_count":133,"sven_meta":{"func_name":"_call_prepare_fc_map","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#49-e2be0cd0c86e","input":" def _find_host_exhaustive(self, connector, hosts):\n for host in hosts:\n ssh_cmd = 'svcinfo lshost -delim ! %s' % host\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()),\n '_find_host_exhaustive',\n ssh_cmd, out, err)\n for attr_line in out.split('\\n'):\n # If '!' not found, return the string and two empty strings\n attr_name, foo, attr_val = attr_line.partition('!')\n if (attr_name == 'iscsi_name' and\n 'initiator' in connector and\n attr_val == connector['initiator']):\n return host\n elif (attr_name == 'WWPN' and\n 'wwpns' in connector and\n attr_val.lower() in\n map(str.lower, map(str, connector['wwpns']))):\n return host\n return None","target":" def _find_host_exhaustive(self, connector, hosts):\n for host in hosts:\n ssh_cmd = ['svcinfo', 'lshost', '-delim', '!', host]\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()),\n '_find_host_exhaustive',\n ssh_cmd, out, err)\n for attr_line in out.split('\\n'):\n # If '!' not found, return the string and two empty strings\n attr_name, foo, attr_val = attr_line.partition('!')\n if (attr_name == 'iscsi_name' and\n 'initiator' in connector and\n attr_val == connector['initiator']):\n return host\n elif (attr_name == 'WWPN' and\n 'wwpns' in connector and\n attr_val.lower() in\n map(str.lower, map(str, connector['wwpns']))):\n return host\n return None","lang":"python","vul_type":"cwe-078","target_token_count":206,"sven_meta":{"func_name":"_find_host_exhaustive","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#55-ffc3a976b27f","input":" def write_section(self, section_name, section_data):\n self.write_line(\"\")\n self.write_line(\"define %s {\" % section_name)\n sorted_keys = section_data.keys()\n sorted_keys.sort()\n for key in sorted_keys:\n value = section_data[key]\n self.icinga_lines.append((\"%s%-45s%s\" % (self.indent, key, self.value_to_icinga(value))))\n self.write_line(\"}\")","target":" def write_section(self, section_name, section_data):\n self.write_line(\"\")\n self.write_line(\"define %s {\" % section_name)\n sorted_keys = section_data.keys()\n sorted_keys.sort()\n for key in sorted_keys:\n value = self.value_to_icinga(section_data[key])\n icinga_line = \"%s%-45s%s\" % (self.indent, key, value)\n\n if \"\\n\" in icinga_line or \"}\" in icinga_line:\n msg = \"Found forbidden newline or '}' character in section %r.\"\n raise Exception(msg % section_name)\n\n self.icinga_lines.append(icinga_line)\n self.write_line(\"}\")","lang":"python","vul_type":"cwe-078","target_token_count":144,"sven_meta":{"func_name":"write_section","file_name":"src/main/python/monitoring_config_generator/MonitoringConfigGenerator.py","commit_link":"github.com/Scout24/monitoring-config-generator/commit/a4b01b72d2e3d6ec2600c384a77f675fa9bbf6b7","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#58-7d028af803b1","input":"def install(filename, target):\n '''Run a package's installer script against the given target directory.'''\n print(' Unpacking %s...' % filename)\n os.system('tar xf ' + filename)\n basename = filename.split('.tar')[0]\n print(' Installing %s...' % basename)\n install_opts = '--prefix=${PWD}/%s --disable-ldconfig' % target\n os.system('%s/install.sh %s' % (basename, install_opts))\n print(' Cleaning %s...' % basename)\n os.system('rm -rf %s' % basename)","target":"def install(filename, target):\n '''Run a package's installer script against the given target directory.'''\n print(' Unpacking %s...' % filename)\n subprocess.check_call(['tar', 'xf', filename])\n basename = filename.split('.tar')[0]\n print(' Installing %s...' % basename)\n install_cmd = [os.path.join(basename, 'install.sh')]\n install_cmd += ['--prefix=' + os.path.abspath(target)]\n install_cmd += ['--disable-ldconfig']\n subprocess.check_call(install_cmd)\n print(' Cleaning %s...' % basename)\n subprocess.check_call(['rm', '-rf', basename])","lang":"python","vul_type":"cwe-078","target_token_count":133,"sven_meta":{"func_name":"install","file_name":"repack_rust.py","commit_link":"github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#60-c75fbfbaf6b5","input":" def _start_fc_map(self, fc_map_id, source, target):\n try:\n out, err = self._run_ssh('svctask startfcmap %s' % fc_map_id)\n except exception.ProcessExecutionError as e:\n with excutils.save_and_reraise_exception():\n LOG.error(_('_start_fc_map: Failed to start FlashCopy '\n 'from %(source)s to %(target)s.\\n'\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'source': source,\n 'target': target,\n 'out': e.stdout,\n 'err': e.stderr})","target":" def _start_fc_map(self, fc_map_id, source, target):\n try:\n out, err = self._run_ssh(['svctask', 'startfcmap', fc_map_id])\n except exception.ProcessExecutionError as e:\n with excutils.save_and_reraise_exception():\n LOG.error(_('_start_fc_map: Failed to start FlashCopy '\n 'from %(source)s to %(target)s.\\n'\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'source': source,\n 'target': target,\n 'out': e.stdout,\n 'err': e.stderr})","lang":"python","vul_type":"cwe-078","target_token_count":131,"sven_meta":{"func_name":"_start_fc_map","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#64-212385c8f6d5","input":" def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id):\n \"\"\"Create a 3PAR host.\n\n Create a 3PAR host, if there is already a host on the 3par using\n the same wwn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"\n out = self.common._cli_run('createhost -persona %s -domain %s %s %s'\n % (persona_id, domain,\n hostname, \" \".join(wwn)), None)\n if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)\n\n return hostname","target":" def _create_3par_fibrechan_host(self, hostname, wwns, domain, persona_id):\n \"\"\"Create a 3PAR host.\n\n Create a 3PAR host, if there is already a host on the 3par using\n the same wwn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"\n command = ['createhost', '-persona', persona_id, '-domain', domain,\n hostname]\n for wwn in wwns:\n command.append(wwn)\n\n out = self.common._cli_run(command)\n if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)\n\n return hostname","lang":"python","vul_type":"cwe-078","target_token_count":151,"sven_meta":{"func_name":"_create_3par_fibrechan_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_fc.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#72-24eb7a11baf8","input":" def extend_volume(self, volume, new_size):\n volume_name = self._get_3par_vol_name(volume['id'])\n old_size = volume.size\n growth_size = int(new_size) - old_size\n LOG.debug(\"Extending Volume %s from %s to %s, by %s GB.\" %\n (volume_name, old_size, new_size, growth_size))\n try:\n self._cli_run(\"growvv -f %s %sg\" % (volume_name, growth_size),\n None)\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error extending volume %s\") % volume)","target":" def extend_volume(self, volume, new_size):\n volume_name = self._get_3par_vol_name(volume['id'])\n old_size = volume.size\n growth_size = int(new_size) - old_size\n LOG.debug(\"Extending Volume %s from %s to %s, by %s GB.\" %\n (volume_name, old_size, new_size, growth_size))\n try:\n self._cli_run(['growvv', '-f', volume_name, '%dg' % growth_size])\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error extending volume %s\") % volume)","lang":"python","vul_type":"cwe-078","target_token_count":135,"sven_meta":{"func_name":"extend_volume","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#74-5d2134373ea7","input":" def _get_3par_hostname_from_wwn_iqn(self, wwns_iqn):\n out = self._cli_run('showhost -d', None)\n # wwns_iqn may be a list of strings or a single\n # string. So, if necessary, create a list to loop.\n if not isinstance(wwns_iqn, list):\n wwn_iqn_list = [wwns_iqn]\n else:\n wwn_iqn_list = wwns_iqn\n\n for wwn_iqn in wwn_iqn_list:\n for showhost in out:\n if (wwn_iqn.upper() in showhost.upper()):\n return showhost.split(',')[1]","target":" def _get_3par_hostname_from_wwn_iqn(self, wwns_iqn):\n out = self._cli_run(['showhost', '-d'])\n # wwns_iqn may be a list of strings or a single\n # string. So, if necessary, create a list to loop.\n if not isinstance(wwns_iqn, list):\n wwn_iqn_list = [wwns_iqn]\n else:\n wwn_iqn_list = wwns_iqn\n\n for wwn_iqn in wwn_iqn_list:\n for showhost in out:\n if (wwn_iqn.upper() in showhost.upper()):\n return showhost.split(',')[1]","lang":"python","vul_type":"cwe-078","target_token_count":151,"sven_meta":{"func_name":"_get_3par_hostname_from_wwn_iqn","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#79-e9b1b1bb52d1","input":"def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):\n # XXX see if we want to keep an external call here\n if verbose:\n zipoptions = \"-r\"\n else:\n zipoptions = \"-rq\"\n from distutils.errors import DistutilsExecError\n from distutils.spawn import spawn\n try:\n spawn([\"zip\", zipoptions, zip_filename, base_dir], dry_run=dry_run)\n except DistutilsExecError:\n # XXX really should distinguish between \"couldn't find\n # external 'zip' command\" and \"zip failed\".\n raise ExecError, \\\n (\"unable to create zip file '%s': \"\n \"could neither import the 'zipfile' module nor \"\n \"find a standalone zip utility\") % zip_filename","target":"def _call_external_zip(base_dir, zip_filename, verbose, dry_run, logger):\n # XXX see if we want to keep an external call here\n if verbose:\n zipoptions = \"-r\"\n else:\n zipoptions = \"-rq\"\n cmd = [\"zip\", zipoptions, zip_filename, base_dir]\n if logger is not None:\n logger.info(' '.join(cmd))\n if dry_run:\n return\n import subprocess\n try:\n subprocess.check_call(cmd)\n except subprocess.CalledProcessError:\n # XXX really should distinguish between \"couldn't find\n # external 'zip' command\" and \"zip failed\".\n raise ExecError, \\\n (\"unable to create zip file '%s': \"\n \"could neither import the 'zipfile' module nor \"\n \"find a standalone zip utility\") % zip_filename","lang":"python","vul_type":"cwe-078","target_token_count":178,"sven_meta":{"func_name":"_call_external_zip","file_name":"Lib/shutil.py","commit_link":"github.com/python/cpython/commit/add531a1e55b0a739b0f42582f1c9747e5649ace","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#81-495393981bea","input":" def _get_iscsi_ip_addrs(self):\n generator = self._port_conf_generator('svcinfo lsportip')\n header = next(generator, None)\n if not header:\n return\n\n for port_data in generator:\n try:\n port_node_id = port_data['node_id']\n port_ipv4 = port_data['IP_address']\n port_ipv6 = port_data['IP_address_6']\n state = port_data['state']\n except KeyError:\n self._handle_keyerror('lsportip', header)\n\n if port_node_id in self._storage_nodes and (\n state == 'configured' or state == 'online'):\n node = self._storage_nodes[port_node_id]\n if len(port_ipv4):\n node['ipv4'].append(port_ipv4)\n if len(port_ipv6):\n node['ipv6'].append(port_ipv6)","target":" def _get_iscsi_ip_addrs(self):\n generator = self._port_conf_generator(['svcinfo', 'lsportip'])\n header = next(generator, None)\n if not header:\n return\n\n for port_data in generator:\n try:\n port_node_id = port_data['node_id']\n port_ipv4 = port_data['IP_address']\n port_ipv6 = port_data['IP_address_6']\n state = port_data['state']\n except KeyError:\n self._handle_keyerror('lsportip', header)\n\n if port_node_id in self._storage_nodes and (\n state == 'configured' or state == 'online'):\n node = self._storage_nodes[port_node_id]\n if len(port_ipv4):\n node['ipv4'].append(port_ipv4)\n if len(port_ipv6):\n node['ipv6'].append(port_ipv6)","lang":"python","vul_type":"cwe-078","target_token_count":186,"sven_meta":{"func_name":"_get_iscsi_ip_addrs","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#82-08acd27637b6","input":"def talk(myText):\r\n if( myText.find( \"twitter\" ) >= 0 ):\r\n myText += \"0\"\r\n myText = myText[7:-1]\r\n try:\r\n\t myText = twitter.getTweet( myText )\r\n\texcept:\r\n\t print( \"!!!ERROR: INVALID TWITTER CREDENTIALS. Please read README.md for instructions.\")\r\n return\r\n \r\n os.system( \"espeak \\\",...\\\" 2>/dev/null\" ) # Sometimes the beginning of audio can get cut off. Insert silence.\r\n time.sleep( 0.5 )\r\n os.system( \"espeak -w speech.wav \\\"\" + myText + \"\\\" -s 130\" )\r\n audio.play(\"speech.wav\")\r\n return myText","target":"def talk(myText):\r\n if( myText.find( \"twitter\" ) >= 0 ):\r\n myText += \"0\"\r\n myText = myText[7:-1]\r\n try:\r\n\t myText = twitter.getTweet( myText )\r\n\texcept:\r\n\t print( \"!!!ERROR: INVALID TWITTER CREDENTIALS. Please read README.md for instructions.\")\r\n return\r\n \r\n os.system( \"espeak \\\",...\\\" 2>/dev/null\" ) # Sometimes the beginning of audio can get cut off. Insert silence.\r\n time.sleep( 0.5 )\r\n subprocess.call([\"espeak\", \"-w\", \"speech.wav\", myText, \"-s\", \"130\"])\r\n audio.play(\"speech.wav\")\r\n return myText","lang":"python","vul_type":"cwe-078","target_token_count":156,"sven_meta":{"func_name":"talk","file_name":"chippyRuxpin.py","commit_link":"github.com/ntc-chip-revived/ChippyRuxpin/commit/0cd7d78e4d806852fd75fee03c24cce322f76014","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#83-fc4b59b6c359","input":" def _exec_cmd(self, cmd):\n \"\"\"Executes adb commands in a new shell.\n\n This is specific to executing adb binary because stderr is not a good\n indicator of cmd execution status.\n\n Args:\n cmds: A string that is the adb command to execute.\n\n Returns:\n The output of the adb command run if exit code is 0.\n\n Raises:\n AdbError is raised if the adb command exit code is not 0.\n \"\"\"\n proc = subprocess.Popen(\n cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\n (out, err) = proc.communicate()\n ret = proc.returncode\n logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', cmd, out,\n err, ret)\n if ret == 0:\n return out\n else:\n raise AdbError(cmd=cmd, stdout=out, stderr=err, ret_code=ret)","target":" def _exec_cmd(self, args, shell):\n \"\"\"Executes adb commands.\n\n Args:\n args: string or list of strings, program arguments.\n See subprocess.Popen() documentation.\n shell: bool, True to run this command through the system shell,\n False to invoke it directly. See subprocess.Popen() docs.\n\n Returns:\n The output of the adb command run if exit code is 0.\n\n Raises:\n AdbError is raised if the adb command exit code is not 0.\n \"\"\"\n proc = subprocess.Popen(\n args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell)\n (out, err) = proc.communicate()\n ret = proc.returncode\n logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', args, out,\n err, ret)\n if ret == 0:\n return out\n else:\n raise AdbError(cmd=args, stdout=out, stderr=err, ret_code=ret)","lang":"python","vul_type":"cwe-078","target_token_count":214,"sven_meta":{"func_name":"_exec_cmd","file_name":"mobly/controllers/android_device_lib/adb.py","commit_link":"github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#85-3e6f0bd37054","input":" def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):\n \"\"\"Create a 3PAR host.\n\n Create a 3PAR host, if there is already a host on the 3par using\n the same iqn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"\n cmd = 'createhost -iscsi -persona %s -domain %s %s %s' % \\\n (persona_id, domain, hostname, iscsi_iqn)\n out = self.common._cli_run(cmd, None)\n if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)\n return hostname","target":" def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):\n \"\"\"Create a 3PAR host.\n\n Create a 3PAR host, if there is already a host on the 3par using\n the same iqn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"\n cmd = ['createhost', '-iscsi', '-persona', persona_id, '-domain',\n domain, hostname, iscsi_iqn]\n out = self.common._cli_run(cmd)\n if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)\n return hostname","lang":"python","vul_type":"cwe-078","target_token_count":145,"sven_meta":{"func_name":"_create_3par_iscsi_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_iscsi.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#87-5967b6ab37b1","input":" def process_statistics(self, metadata, _):\n args = [metadata.hostname, '-p', metadata.profile, '-g',\n ':'.join([g for g in metadata.groups])]\n for notifier in os.listdir(self.data):\n if ((notifier[-1] == '~') or\n (notifier[:2] == '.#') or\n (notifier[-4:] == '.swp') or\n (notifier in ['SCCS', '.svn', '4913'])):\n continue\n npath = self.data + '/' + notifier\n self.logger.debug(\"Running %s %s\" % (npath, \" \".join(args)))\n async_run(npath, args)","target":" def process_statistics(self, metadata, _):\n args = [metadata.hostname, '-p', metadata.profile, '-g',\n ':'.join([g for g in metadata.groups])]\n self.debug_log(\"running triggers\")\n for notifier in os.listdir(self.data):\n self.debug_log(\"running %s\" % notifier)\n if ((notifier[-1] == '~') or\n (notifier[:2] == '.#') or\n (notifier[-4:] == '.swp') or\n (notifier in ['SCCS', '.svn', '4913'])):\n continue\n npath = os.path.join(self.data, notifier)\n self.async_run([npath] + args)","lang":"python","vul_type":"cwe-078","target_token_count":152,"sven_meta":{"func_name":"process_statistics","file_name":"src/lib/Server/Plugins/Trigger.py","commit_link":"github.com/Bcfg2/bcfg2/commit/a524967e8d5c4c22e49cd619aed20c87a316c0be","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#89-9a862dd8ac73","input":"def fetch(url):\n '''Download and verify a package url.'''\n base = os.path.basename(url)\n print('Fetching %s...' % base)\n fetch_file(url + '.asc')\n fetch_file(url)\n fetch_file(url + '.sha256')\n fetch_file(url + '.asc.sha256')\n print('Verifying %s...' % base)\n # TODO: check for verification failure.\n os.system('shasum -c %s.sha256' % base)\n os.system('shasum -c %s.asc.sha256' % base)\n os.system('gpg --verify %s.asc %s' % (base, base))\n os.system('keybase verify %s.asc' % base)","target":"def fetch(url):\n '''Download and verify a package url.'''\n base = os.path.basename(url)\n print('Fetching %s...' % base)\n fetch_file(url + '.asc')\n fetch_file(url)\n fetch_file(url + '.sha256')\n fetch_file(url + '.asc.sha256')\n print('Verifying %s...' % base)\n # TODO: check for verification failure.\n subprocess.check_call(['shasum', '-c', base + '.sha256'])\n subprocess.check_call(['shasum', '-c', base + '.asc.sha256'])\n subprocess.check_call(['gpg', '--verify', base + '.asc', base])\n subprocess.check_call(['keybase', 'verify', base + '.asc'])","lang":"python","vul_type":"cwe-078","target_token_count":162,"sven_meta":{"func_name":"fetch","file_name":"repack_rust.py","commit_link":"github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#94-404301c07791","input":" def _port_conf_generator(self, cmd):\n ssh_cmd = '%s -delim !' % cmd\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return\n port_lines = out.strip().split('\\n')\n if not len(port_lines):\n return\n\n header = port_lines.pop(0)\n yield header\n for portip_line in port_lines:\n try:\n port_data = self._get_hdr_dic(header, portip_line, '!')\n except exception.VolumeBackendAPIException:\n with excutils.save_and_reraise_exception():\n self._log_cli_output_error('_port_conf_generator',\n ssh_cmd, out, err)\n yield port_data","target":" def _port_conf_generator(self, cmd):\n ssh_cmd = cmd + ['-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return\n port_lines = out.strip().split('\\n')\n if not len(port_lines):\n return\n\n header = port_lines.pop(0)\n yield header\n for portip_line in port_lines:\n try:\n port_data = self._get_hdr_dic(header, portip_line, '!')\n except exception.VolumeBackendAPIException:\n with excutils.save_and_reraise_exception():\n self._log_cli_output_error('_port_conf_generator',\n ssh_cmd, out, err)\n yield port_data","lang":"python","vul_type":"cwe-078","target_token_count":151,"sven_meta":{"func_name":"_port_conf_generator","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-476#1-f7e81e17e8e3","input":"RCMS *r_pkcs7_parse_cms (const ut8 *buffer, ut32 length) {\n\tRASN1Object *object;\n\tRCMS *container;\n\tif (!buffer || !length) {\n\t\treturn NULL;\n\t}\n\tcontainer = R_NEW0 (RCMS);\n\tif (!container) {\n\t\treturn NULL;\n\t}\n\tobject = r_asn1_create_object (buffer, length);\n\tif (!object || object->list.length != 2 || !object->list.objects[0] || object->list.objects[1]->list.length != 1) {\n\t\tr_asn1_free_object (object);\n\t\tfree (container);\n\t\treturn NULL;\n\t}\n\tcontainer->contentType = r_asn1_stringify_oid (object->list.objects[0]->sector, object->list.objects[0]->length);\n\tr_pkcs7_parse_signeddata (&container->signedData, object->list.objects[1]->list.objects[0]);\n\tr_asn1_free_object (object);\n\treturn container;\n}","target":"RCMS *r_pkcs7_parse_cms (const ut8 *buffer, ut32 length) {\n\tRASN1Object *object;\n\tRCMS *container;\n\tif (!buffer || !length) {\n\t\treturn NULL;\n\t}\n\tcontainer = R_NEW0 (RCMS);\n\tif (!container) {\n\t\treturn NULL;\n\t}\n\tobject = r_asn1_create_object (buffer, length);\n\tif (!object || object->list.length != 2 || !object->list.objects ||\n\t\t!object->list.objects[0] || !object->list.objects[1] ||\n\t\tobject->list.objects[1]->list.length != 1) {\n\t\tr_asn1_free_object (object);\n\t\tfree (container);\n\t\treturn NULL;\n\t}\n\tcontainer->contentType = r_asn1_stringify_oid (object->list.objects[0]->sector, object->list.objects[0]->length);\n\tr_pkcs7_parse_signeddata (&container->signedData, object->list.objects[1]->list.objects[0]);\n\tr_asn1_free_object (object);\n\treturn container;\n}","lang":"c","vul_type":"cwe-476","target_token_count":225,"sven_meta":{"func_name":"r_pkcs7_parse_cms","file_name":"libr/util/r_pkcs7.c","commit_link":"github.com/radare/radare2/commit/7ab66cca5bbdf6cb2d69339ef4f513d95e532dbf","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#3-06608e3e6f86","input":"static int hash_accept(struct socket *sock, struct socket *newsock, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct alg_sock *ask = alg_sk(sk);\n\tstruct hash_ctx *ctx = ask->private;\n\tstruct ahash_request *req = &ctx->req;\n\tchar state[crypto_ahash_statesize(crypto_ahash_reqtfm(req))];\n\tstruct sock *sk2;\n\tstruct alg_sock *ask2;\n\tstruct hash_ctx *ctx2;\n\tint err;\n\n\terr = crypto_ahash_export(req, state);\n\tif (err)\n\t\treturn err;\n\n\terr = af_alg_accept(ask->parent, newsock);\n\tif (err)\n\t\treturn err;\n\n\tsk2 = newsock->sk;\n\task2 = alg_sk(sk2);\n\tctx2 = ask2->private;\n\tctx2->more = 1;\n\n\terr = crypto_ahash_import(&ctx2->req, state);\n\tif (err) {\n\t\tsock_orphan(sk2);\n\t\tsock_put(sk2);\n\t}\n\n\treturn err;\n}","target":"static int hash_accept(struct socket *sock, struct socket *newsock, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct alg_sock *ask = alg_sk(sk);\n\tstruct hash_ctx *ctx = ask->private;\n\tstruct ahash_request *req = &ctx->req;\n\tchar state[crypto_ahash_statesize(crypto_ahash_reqtfm(req))];\n\tstruct sock *sk2;\n\tstruct alg_sock *ask2;\n\tstruct hash_ctx *ctx2;\n\tbool more;\n\tint err;\n\n\tlock_sock(sk);\n\tmore = ctx->more;\n\terr = more ? crypto_ahash_export(req, state) : 0;\n\trelease_sock(sk);\n\n\tif (err)\n\t\treturn err;\n\n\terr = af_alg_accept(ask->parent, newsock);\n\tif (err)\n\t\treturn err;\n\n\tsk2 = newsock->sk;\n\task2 = alg_sk(sk2);\n\tctx2 = ask2->private;\n\tctx2->more = more;\n\n\tif (!more)\n\t\treturn err;\n\n\terr = crypto_ahash_import(&ctx2->req, state);\n\tif (err) {\n\t\tsock_orphan(sk2);\n\t\tsock_put(sk2);\n\t}\n\n\treturn err;\n}","lang":"c","vul_type":"cwe-476","target_token_count":247,"sven_meta":{"func_name":"hash_accept","file_name":"crypto/algif_hash.c","commit_link":"github.com/torvalds/linux/commit/4afa5f9617927453ac04b24b584f6c718dfb4f45","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#5-5aece19c2ac4","input":"static gboolean prplcb_xfer_new_send_cb(gpointer data, gint fd, b_input_condition cond)\n{\n\tPurpleXfer *xfer = data;\n\tstruct im_connection *ic = purple_ic_by_pa(xfer->account);\n\tstruct prpl_xfer_data *px = xfer->ui_data;\n\tPurpleBuddy *buddy;\n\tconst char *who;\n\n\tbuddy = purple_find_buddy(xfer->account, xfer->who);\n\twho = buddy ? purple_buddy_get_name(buddy) : xfer->who;\n\n\t/* TODO(wilmer): After spreading some more const goodness in BitlBee,\n\t remove the evil cast below. */\n\tpx->ft = imcb_file_send_start(ic, (char *) who, xfer->filename, xfer->size);\n\tpx->ft->data = px;\n\n\tpx->ft->accept = prpl_xfer_accept;\n\tpx->ft->canceled = prpl_xfer_canceled;\n\tpx->ft->free = prpl_xfer_free;\n\tpx->ft->write_request = prpl_xfer_write_request;\n\n\treturn FALSE;\n}","target":"static gboolean prplcb_xfer_new_send_cb(gpointer data, gint fd, b_input_condition cond)\n{\n\tPurpleXfer *xfer = data;\n\tstruct im_connection *ic = purple_ic_by_pa(xfer->account);\n\tstruct prpl_xfer_data *px = xfer->ui_data;\n\tPurpleBuddy *buddy;\n\tconst char *who;\n\n\tbuddy = purple_find_buddy(xfer->account, xfer->who);\n\twho = buddy ? purple_buddy_get_name(buddy) : xfer->who;\n\n\t/* TODO(wilmer): After spreading some more const goodness in BitlBee,\n\t remove the evil cast below. */\n\tpx->ft = imcb_file_send_start(ic, (char *) who, xfer->filename, xfer->size);\n\n\tif (!px->ft) {\n\t\treturn FALSE;\n\t}\n\tpx->ft->data = px;\n\n\tpx->ft->accept = prpl_xfer_accept;\n\tpx->ft->canceled = prpl_xfer_canceled;\n\tpx->ft->free = prpl_xfer_free;\n\tpx->ft->write_request = prpl_xfer_write_request;\n\n\treturn FALSE;\n}","lang":"c","vul_type":"cwe-476","target_token_count":248,"sven_meta":{"func_name":"prplcb_xfer_new_send_cb","file_name":"protocols/purple/ft.c","commit_link":"github.com/bitlbee/bitlbee/commit/30d598ce7cd3f136ee9d7097f39fa9818a272441","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#9-5dbbc30dd12e","input":"LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,\n enum expr_value_type type, xkb_mod_mask_t *val_rtrn)\n{\n const char *str;\n xkb_mod_index_t ndx;\n const LookupModMaskPriv *arg = priv;\n const struct xkb_mod_set *mods = arg->mods;\n enum mod_type mod_type = arg->mod_type;\n\n if (type != EXPR_TYPE_INT)\n return false;\n\n str = xkb_atom_text(ctx, field);\n\n if (istreq(str, \"all\")) {\n *val_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n\n if (istreq(str, \"none\")) {\n *val_rtrn = 0;\n return true;\n }\n\n ndx = XkbModNameToIndex(mods, field, mod_type);\n if (ndx == XKB_MOD_INVALID)\n return false;\n\n *val_rtrn = (1u << ndx);\n return true;\n}","target":"LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,\n enum expr_value_type type, xkb_mod_mask_t *val_rtrn)\n{\n const char *str;\n xkb_mod_index_t ndx;\n const LookupModMaskPriv *arg = priv;\n const struct xkb_mod_set *mods = arg->mods;\n enum mod_type mod_type = arg->mod_type;\n\n if (type != EXPR_TYPE_INT)\n return false;\n\n str = xkb_atom_text(ctx, field);\n if (!str)\n return false;\n\n if (istreq(str, \"all\")) {\n *val_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n\n if (istreq(str, \"none\")) {\n *val_rtrn = 0;\n return true;\n }\n\n ndx = XkbModNameToIndex(mods, field, mod_type);\n if (ndx == XKB_MOD_INVALID)\n return false;\n\n *val_rtrn = (1u << ndx);\n return true;\n}","lang":"c","vul_type":"cwe-476","target_token_count":234,"sven_meta":{"func_name":"LookupModMask","file_name":"src/xkbcomp/expr.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/4e2ee9c3f6050d773f8bbe05bc0edb17f1ff8371","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#34-60e05cc6ab12","input":"static int nfc_genl_deactivate_target(struct sk_buff *skb,\n\t\t\t\t struct genl_info *info)\n{\n\tstruct nfc_dev *dev;\n\tu32 device_idx, target_idx;\n\tint rc;\n\n\tif (!info->attrs[NFC_ATTR_DEVICE_INDEX])\n\t\treturn -EINVAL;\n\n\tdevice_idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);\n\n\tdev = nfc_get_device(device_idx);\n\tif (!dev)\n\t\treturn -ENODEV;\n\n\ttarget_idx = nla_get_u32(info->attrs[NFC_ATTR_TARGET_INDEX]);\n\n\trc = nfc_deactivate_target(dev, target_idx, NFC_TARGET_MODE_SLEEP);\n\n\tnfc_put_device(dev);\n\treturn rc;\n}","target":"static int nfc_genl_deactivate_target(struct sk_buff *skb,\n\t\t\t\t struct genl_info *info)\n{\n\tstruct nfc_dev *dev;\n\tu32 device_idx, target_idx;\n\tint rc;\n\n\tif (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||\n\t !info->attrs[NFC_ATTR_TARGET_INDEX])\n\t\treturn -EINVAL;\n\n\tdevice_idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);\n\n\tdev = nfc_get_device(device_idx);\n\tif (!dev)\n\t\treturn -ENODEV;\n\n\ttarget_idx = nla_get_u32(info->attrs[NFC_ATTR_TARGET_INDEX]);\n\n\trc = nfc_deactivate_target(dev, target_idx, NFC_TARGET_MODE_SLEEP);\n\n\tnfc_put_device(dev);\n\treturn rc;\n}","lang":"c","vul_type":"cwe-476","target_token_count":153,"sven_meta":{"func_name":"nfc_genl_deactivate_target","file_name":"net/nfc/netlink.c","commit_link":"github.com/torvalds/linux/commit/385097a3675749cbc9e97c085c0e5dfe4269ca51","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#51-8c713e0b41bd","input":"static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm)\n{\n\tstruct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm);\n\tstruct skcipher_alg *alg = crypto_skcipher_alg(skcipher);\n\n\tif (tfm->__crt_alg->cra_type == &crypto_blkcipher_type)\n\t\treturn crypto_init_skcipher_ops_blkcipher(tfm);\n\n\tif (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type ||\n\t tfm->__crt_alg->cra_type == &crypto_givcipher_type)\n\t\treturn crypto_init_skcipher_ops_ablkcipher(tfm);\n\n\tskcipher->setkey = alg->setkey;\n\tskcipher->encrypt = alg->encrypt;\n\tskcipher->decrypt = alg->decrypt;\n\tskcipher->ivsize = alg->ivsize;\n\tskcipher->keysize = alg->max_keysize;\n\n\tif (alg->exit)\n\t\tskcipher->base.exit = crypto_skcipher_exit_tfm;\n\n\tif (alg->init)\n\t\treturn alg->init(skcipher);\n\n\treturn 0;\n}","target":"static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm)\n{\n\tstruct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm);\n\tstruct skcipher_alg *alg = crypto_skcipher_alg(skcipher);\n\n\tif (tfm->__crt_alg->cra_type == &crypto_blkcipher_type)\n\t\treturn crypto_init_skcipher_ops_blkcipher(tfm);\n\n\tif (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type ||\n\t tfm->__crt_alg->cra_type == &crypto_givcipher_type)\n\t\treturn crypto_init_skcipher_ops_ablkcipher(tfm);\n\n\tskcipher->setkey = skcipher_setkey;\n\tskcipher->encrypt = alg->encrypt;\n\tskcipher->decrypt = alg->decrypt;\n\tskcipher->ivsize = alg->ivsize;\n\tskcipher->keysize = alg->max_keysize;\n\n\tif (alg->exit)\n\t\tskcipher->base.exit = crypto_skcipher_exit_tfm;\n\n\tif (alg->init)\n\t\treturn alg->init(skcipher);\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-476","target_token_count":240,"sven_meta":{"func_name":"crypto_skcipher_init_tfm","file_name":"crypto/skcipher.c","commit_link":"github.com/torvalds/linux/commit/9933e113c2e87a9f46a40fde8dafbf801dca1ab9","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#55-c989cc3f8c86","input":"mrb_obj_clone(mrb_state *mrb, mrb_value self)\n{\n struct RObject *p;\n mrb_value clone;\n\n if (mrb_immediate_p(self)) {\n mrb_raisef(mrb, E_TYPE_ERROR, \"can't clone %S\", self);\n }\n if (mrb_type(self) == MRB_TT_SCLASS) {\n mrb_raise(mrb, E_TYPE_ERROR, \"can't clone singleton class\");\n }\n p = (struct RObject*)mrb_obj_alloc(mrb, mrb_type(self), mrb_obj_class(mrb, self));\n p->c = mrb_singleton_class_clone(mrb, self);\n mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)p->c);\n clone = mrb_obj_value(p);\n init_copy(mrb, clone, self);\n p->flags = mrb_obj_ptr(self)->flags;\n\n return clone;\n}","target":"mrb_obj_clone(mrb_state *mrb, mrb_value self)\n{\n struct RObject *p;\n mrb_value clone;\n\n if (mrb_immediate_p(self)) {\n mrb_raisef(mrb, E_TYPE_ERROR, \"can't clone %S\", self);\n }\n if (mrb_type(self) == MRB_TT_SCLASS) {\n mrb_raise(mrb, E_TYPE_ERROR, \"can't clone singleton class\");\n }\n p = (struct RObject*)mrb_obj_alloc(mrb, mrb_type(self), mrb_obj_class(mrb, self));\n p->c = mrb_singleton_class_clone(mrb, self);\n mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)p->c);\n clone = mrb_obj_value(p);\n init_copy(mrb, clone, self);\n p->flags |= mrb_obj_ptr(self)->flags & MRB_FLAG_IS_FROZEN;\n\n return clone;\n}","lang":"c","vul_type":"cwe-476","target_token_count":207,"sven_meta":{"func_name":"mrb_obj_clone","file_name":"src/kernel.c","commit_link":"github.com/mruby/mruby/commit/55edae0226409de25e59922807cb09acb45731a2","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#59-aae4857e0809","input":"int avpriv_ac3_parse_header(AC3HeaderInfo **phdr, const uint8_t *buf,\n size_t size)\n{\n GetBitContext gb;\n AC3HeaderInfo *hdr;\n int err;\n\n if (!*phdr)\n *phdr = av_mallocz(sizeof(AC3HeaderInfo));\n if (!*phdr)\n return AVERROR(ENOMEM);\n hdr = *phdr;\n\n init_get_bits8(&gb, buf, size);\n err = ff_ac3_parse_header(&gb, hdr);\n if (err < 0)\n return AVERROR_INVALIDDATA;\n\n return get_bits_count(&gb);\n}","target":"int avpriv_ac3_parse_header(AC3HeaderInfo **phdr, const uint8_t *buf,\n size_t size)\n{\n GetBitContext gb;\n AC3HeaderInfo *hdr;\n int err;\n\n if (!*phdr)\n *phdr = av_mallocz(sizeof(AC3HeaderInfo));\n if (!*phdr)\n return AVERROR(ENOMEM);\n hdr = *phdr;\n\n err = init_get_bits8(&gb, buf, size);\n if (err < 0)\n return AVERROR_INVALIDDATA;\n err = ff_ac3_parse_header(&gb, hdr);\n if (err < 0)\n return AVERROR_INVALIDDATA;\n\n return get_bits_count(&gb);\n}","lang":"c","vul_type":"cwe-476","target_token_count":156,"sven_meta":{"func_name":"avpriv_ac3_parse_header","file_name":"libavcodec/ac3_parser.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/00e8181bd97c834fe60751b0c511d4bb97875f78","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-416#2-ef37067ff03d","input":"void Magick::Image::read(MagickCore::Image *image,\n MagickCore::ExceptionInfo *exceptionInfo)\n{\n // Ensure that multiple image frames were not read.\n if (image != (MagickCore::Image *) NULL &&\n image->next != (MagickCore::Image *) NULL)\n {\n MagickCore::Image\n *next;\n\n // Destroy any extra image frames\n next=image->next;\n image->next=(MagickCore::Image *) NULL;\n next->previous=(MagickCore::Image *) NULL;\n DestroyImageList(next);\n }\n replaceImage(image);\n if (exceptionInfo->severity == MagickCore::UndefinedException &&\n image == (MagickCore::Image *) NULL)\n {\n (void) MagickCore::DestroyExceptionInfo(exceptionInfo);\n if (!quiet())\n throwExceptionExplicit(MagickCore::ImageWarning,\n \"No image was loaded.\");\n }\n ThrowImageException;\n}","target":"void Magick::Image::read(MagickCore::Image *image,\n MagickCore::ExceptionInfo *exceptionInfo)\n{\n // Ensure that multiple image frames were not read.\n if (image != (MagickCore::Image *) NULL &&\n image->next != (MagickCore::Image *) NULL)\n {\n MagickCore::Image\n *next;\n\n // Destroy any extra image frames\n next=image->next;\n image->next=(MagickCore::Image *) NULL;\n next->previous=(MagickCore::Image *) NULL;\n DestroyImageList(next);\n }\n replaceImage(image);\n if (exceptionInfo->severity == MagickCore::UndefinedException &&\n image == (MagickCore::Image *) NULL)\n {\n (void) MagickCore::DestroyExceptionInfo(exceptionInfo);\n if (!quiet())\n throwExceptionExplicit(MagickCore::ImageWarning,\n \"No image was loaded.\");\n return;\n }\n ThrowImageException;\n}","lang":"cpp","vul_type":"cwe-416","target_token_count":206,"sven_meta":{"func_name":"Magick::Image::read","file_name":"Magick++/lib/Image.cpp","commit_link":"github.com/ImageMagick/ImageMagick/commit/8c35502217c1879cb8257c617007282eee3fe1cc","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#7-131489108720","input":"void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)\n{\n\tstruct snd_pcm_runtime *runtime;\n\tunsigned long flags;\n\n\tif (PCM_RUNTIME_CHECK(substream))\n\t\treturn;\n\truntime = substream->runtime;\n\n\tsnd_pcm_stream_lock_irqsave(substream, flags);\n\tif (!snd_pcm_running(substream) ||\n\t snd_pcm_update_hw_ptr0(substream, 1) < 0)\n\t\tgoto _end;\n\n#ifdef CONFIG_SND_PCM_TIMER\n\tif (substream->timer_running)\n\t\tsnd_timer_interrupt(substream->timer, 1);\n#endif\n _end:\n\tsnd_pcm_stream_unlock_irqrestore(substream, flags);\n\tkill_fasync(&runtime->fasync, SIGIO, POLL_IN);\n}","target":"void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)\n{\n\tstruct snd_pcm_runtime *runtime;\n\tunsigned long flags;\n\n\tif (PCM_RUNTIME_CHECK(substream))\n\t\treturn;\n\truntime = substream->runtime;\n\n\tsnd_pcm_stream_lock_irqsave(substream, flags);\n\tif (!snd_pcm_running(substream) ||\n\t snd_pcm_update_hw_ptr0(substream, 1) < 0)\n\t\tgoto _end;\n\n#ifdef CONFIG_SND_PCM_TIMER\n\tif (substream->timer_running)\n\t\tsnd_timer_interrupt(substream->timer, 1);\n#endif\n _end:\n\tkill_fasync(&runtime->fasync, SIGIO, POLL_IN);\n\tsnd_pcm_stream_unlock_irqrestore(substream, flags);\n}","lang":"c","vul_type":"cwe-416","target_token_count":150,"sven_meta":{"func_name":"snd_pcm_period_elapsed","file_name":"sound/core/pcm_lib.c","commit_link":"github.com/torvalds/linux/commit/3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#9-df2b955bc940","input":"int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle)\n{\n\tstruct super_block *sb;\n\tint err;\n\tint rc;\n\n\tif (!ext4_handle_valid(handle)) {\n\t\text4_put_nojournal(handle);\n\t\treturn 0;\n\t}\n\n\tif (!handle->h_transaction) {\n\t\terr = jbd2_journal_stop(handle);\n\t\treturn handle->h_err ? handle->h_err : err;\n\t}\n\n\tsb = handle->h_transaction->t_journal->j_private;\n\terr = handle->h_err;\n\trc = jbd2_journal_stop(handle);\n\n\tif (!err)\n\t\terr = rc;\n\tif (err)\n\t\t__ext4_std_error(sb, where, line, err);\n\treturn err;\n}","target":"int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle)\n{\n\tstruct super_block *sb;\n\tint err;\n\tint rc;\n\n\tif (!ext4_handle_valid(handle)) {\n\t\text4_put_nojournal(handle);\n\t\treturn 0;\n\t}\n\n\terr = handle->h_err;\n\tif (!handle->h_transaction) {\n\t\trc = jbd2_journal_stop(handle);\n\t\treturn err ? err : rc;\n\t}\n\n\tsb = handle->h_transaction->t_journal->j_private;\n\trc = jbd2_journal_stop(handle);\n\n\tif (!err)\n\t\terr = rc;\n\tif (err)\n\t\t__ext4_std_error(sb, where, line, err);\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","target_token_count":146,"sven_meta":{"func_name":"__ext4_journal_stop","file_name":"fs/ext4/ext4_jbd2.c","commit_link":"github.com/torvalds/linux/commit/6934da9238da947628be83635e365df41064b09b","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#13-839d8f3f21fb","input":"void usb_sg_cancel(struct usb_sg_request *io)\n{\n\tunsigned long flags;\n\tint i, retval;\n\n\tspin_lock_irqsave(&io->lock, flags);\n\tif (io->status) {\n\t\tspin_unlock_irqrestore(&io->lock, flags);\n\t\treturn;\n\t}\n\t/* shut everything down */\n\tio->status = -ECONNRESET;\n\tspin_unlock_irqrestore(&io->lock, flags);\n\n\tfor (i = io->entries - 1; i >= 0; --i) {\n\t\tusb_block_urb(io->urbs[i]);\n\n\t\tretval = usb_unlink_urb(io->urbs[i]);\n\t\tif (retval != -EINPROGRESS\n\t\t && retval != -ENODEV\n\t\t && retval != -EBUSY\n\t\t && retval != -EIDRM)\n\t\t\tdev_warn(&io->dev->dev, \"%s, unlink --> %d\\n\",\n\t\t\t\t __func__, retval);\n\t}\n}","target":"void usb_sg_cancel(struct usb_sg_request *io)\n{\n\tunsigned long flags;\n\tint i, retval;\n\n\tspin_lock_irqsave(&io->lock, flags);\n\tif (io->status || io->count == 0) {\n\t\tspin_unlock_irqrestore(&io->lock, flags);\n\t\treturn;\n\t}\n\t/* shut everything down */\n\tio->status = -ECONNRESET;\n\tio->count++;\t\t/* Keep the request alive until we're done */\n\tspin_unlock_irqrestore(&io->lock, flags);\n\n\tfor (i = io->entries - 1; i >= 0; --i) {\n\t\tusb_block_urb(io->urbs[i]);\n\n\t\tretval = usb_unlink_urb(io->urbs[i]);\n\t\tif (retval != -EINPROGRESS\n\t\t && retval != -ENODEV\n\t\t && retval != -EBUSY\n\t\t && retval != -EIDRM)\n\t\t\tdev_warn(&io->dev->dev, \"%s, unlink --> %d\\n\",\n\t\t\t\t __func__, retval);\n\t}\n\n\tspin_lock_irqsave(&io->lock, flags);\n\tio->count--;\n\tif (!io->count)\n\t\tcomplete(&io->complete);\n\tspin_unlock_irqrestore(&io->lock, flags);\n}","lang":"c","vul_type":"cwe-416","target_token_count":256,"sven_meta":{"func_name":"usb_sg_cancel","file_name":"drivers/usb/core/message.c","commit_link":"github.com/torvalds/linux/commit/056ad39ee9253873522f6469c3364964a322912b","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#14-d394ae829c02","input":"void ip4_datagram_release_cb(struct sock *sk)\n{\n\tconst struct inet_sock *inet = inet_sk(sk);\n\tconst struct ip_options_rcu *inet_opt;\n\t__be32 daddr = inet->inet_daddr;\n\tstruct flowi4 fl4;\n\tstruct rtable *rt;\n\n\tif (! __sk_dst_get(sk) || __sk_dst_check(sk, 0))\n\t\treturn;\n\n\trcu_read_lock();\n\tinet_opt = rcu_dereference(inet->inet_opt);\n\tif (inet_opt && inet_opt->opt.srr)\n\t\tdaddr = inet_opt->opt.faddr;\n\trt = ip_route_output_ports(sock_net(sk), &fl4, sk, daddr,\n\t\t\t\t inet->inet_saddr, inet->inet_dport,\n\t\t\t\t inet->inet_sport, sk->sk_protocol,\n\t\t\t\t RT_CONN_FLAGS(sk), sk->sk_bound_dev_if);\n\tif (!IS_ERR(rt))\n\t\t__sk_dst_set(sk, &rt->dst);\n\trcu_read_unlock();\n}","target":"void ip4_datagram_release_cb(struct sock *sk)\n{\n\tconst struct inet_sock *inet = inet_sk(sk);\n\tconst struct ip_options_rcu *inet_opt;\n\t__be32 daddr = inet->inet_daddr;\n\tstruct dst_entry *dst;\n\tstruct flowi4 fl4;\n\tstruct rtable *rt;\n\n\trcu_read_lock();\n\n\tdst = __sk_dst_get(sk);\n\tif (!dst || !dst->obsolete || dst->ops->check(dst, 0)) {\n\t\trcu_read_unlock();\n\t\treturn;\n\t}\n\tinet_opt = rcu_dereference(inet->inet_opt);\n\tif (inet_opt && inet_opt->opt.srr)\n\t\tdaddr = inet_opt->opt.faddr;\n\trt = ip_route_output_ports(sock_net(sk), &fl4, sk, daddr,\n\t\t\t\t inet->inet_saddr, inet->inet_dport,\n\t\t\t\t inet->inet_sport, sk->sk_protocol,\n\t\t\t\t RT_CONN_FLAGS(sk), sk->sk_bound_dev_if);\n\n\tdst = !IS_ERR(rt) ? &rt->dst : NULL;\n\tsk_dst_set(sk, dst);\n\n\trcu_read_unlock();\n}","lang":"c","vul_type":"cwe-416","target_token_count":235,"sven_meta":{"func_name":"ip4_datagram_release_cb","file_name":"net/ipv4/datagram.c","commit_link":"github.com/torvalds/linux/commit/9709674e68646cee5a24e3000b3558d25412203a","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#15-2a8d605720da","input":"mark_context_stack(mrb_state *mrb, struct mrb_context *c)\n{\n size_t i;\n size_t e;\n\n if (c->stack == NULL) return;\n e = c->stack - c->stbase;\n if (c->ci) e += c->ci->nregs;\n if (c->stbase + e > c->stend) e = c->stend - c->stbase;\n for (i=0; istbase[i];\n\n if (!mrb_immediate_p(v)) {\n if (mrb_basic_ptr(v)->tt == MRB_TT_FREE) {\n c->stbase[i] = mrb_nil_value();\n }\n else {\n mrb_gc_mark(mrb, mrb_basic_ptr(v));\n }\n }\n }\n}","target":"mark_context_stack(mrb_state *mrb, struct mrb_context *c)\n{\n size_t i;\n size_t e;\n mrb_value nil;\n\n if (c->stack == NULL) return;\n e = c->stack - c->stbase;\n if (c->ci) e += c->ci->nregs;\n if (c->stbase + e > c->stend) e = c->stend - c->stbase;\n for (i=0; istbase[i];\n\n if (!mrb_immediate_p(v)) {\n mrb_gc_mark(mrb, mrb_basic_ptr(v));\n }\n }\n e = c->stend - c->stbase;\n nil = mrb_nil_value();\n for (; istbase[i] = nil;\n }\n}","lang":"c","vul_type":"cwe-416","target_token_count":193,"sven_meta":{"func_name":"mark_context_stack","file_name":"src/gc.c","commit_link":"github.com/mruby/mruby/commit/5c114c91d4ff31859fcd84cf8bf349b737b90d99","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#22-7273dbd16cf8","input":" */\nstatic int wddx_stack_destroy(wddx_stack *stack)\n{\n\tregister int i;\n\n\tif (stack->elements) {\n\t\tfor (i = 0; i < stack->top; i++) {\n\t\t\tif (((st_entry *)stack->elements[i])->data\n\t\t\t\t\t&& ((st_entry *)stack->elements[i])->type != ST_FIELD)\t{\n\t\t\t\tzval_ptr_dtor(&((st_entry *)stack->elements[i])->data);\n\t\t\t}\n\t\t\tif (((st_entry *)stack->elements[i])->varname) {\n\t\t\t\tefree(((st_entry *)stack->elements[i])->varname);\n\t\t\t}\n\t\t\tefree(stack->elements[i]);\n\t\t}\n\t\tefree(stack->elements);\n\t}\n\treturn SUCCESS;","target":" */\nstatic int wddx_stack_destroy(wddx_stack *stack)\n{\n\tregister int i;\n\n\tif (stack->elements) {\n\t\tfor (i = 0; i < stack->top; i++) {\n\t\t\tif (((st_entry *)stack->elements[i])->data\n\t\t\t\t\t&& ((st_entry *)stack->elements[i])->type != ST_FIELD)\t{\n\t\t\t\tzval_ptr_dtor(&((st_entry *)stack->elements[i])->data);\n\t\t\t}\n\t\t\tif (((st_entry *)stack->elements[i])->varname) {\n\t\t\t\tefree(((st_entry *)stack->elements[i])->varname);\n\t\t\t}\n\t\t\tefree(stack->elements[i]);\n\t\t}\n\t\tefree(stack->elements);\n\t}\n\treturn SUCCESS;","lang":"c","vul_type":"cwe-416","target_token_count":156,"sven_meta":{"func_name":"wddx_stack_destroy","file_name":"ext/wddx/wddx.c","commit_link":"github.com/php/php-src/commit/b88393f08a558eec14964a55d3c680fe67407712?w=1","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#23-e00be796edec","input":"static void regulator_ena_gpio_free(struct regulator_dev *rdev)\n{\n\tstruct regulator_enable_gpio *pin, *n;\n\n\tif (!rdev->ena_pin)\n\t\treturn;\n\n\t/* Free the GPIO only in case of no use */\n\tlist_for_each_entry_safe(pin, n, ®ulator_ena_gpio_list, list) {\n\t\tif (pin->gpiod == rdev->ena_pin->gpiod) {\n\t\t\tif (pin->request_count <= 1) {\n\t\t\t\tpin->request_count = 0;\n\t\t\t\tgpiod_put(pin->gpiod);\n\t\t\t\tlist_del(&pin->list);\n\t\t\t\tkfree(pin);\n\t\t\t} else {\n\t\t\t\tpin->request_count--;\n\t\t\t}\n\t\t}\n\t}\n}","target":"static void regulator_ena_gpio_free(struct regulator_dev *rdev)\n{\n\tstruct regulator_enable_gpio *pin, *n;\n\n\tif (!rdev->ena_pin)\n\t\treturn;\n\n\t/* Free the GPIO only in case of no use */\n\tlist_for_each_entry_safe(pin, n, ®ulator_ena_gpio_list, list) {\n\t\tif (pin->gpiod == rdev->ena_pin->gpiod) {\n\t\t\tif (pin->request_count <= 1) {\n\t\t\t\tpin->request_count = 0;\n\t\t\t\tgpiod_put(pin->gpiod);\n\t\t\t\tlist_del(&pin->list);\n\t\t\t\tkfree(pin);\n\t\t\t\trdev->ena_pin = NULL;\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tpin->request_count--;\n\t\t\t}\n\t\t}\n\t}\n}","lang":"c","vul_type":"cwe-416","target_token_count":166,"sven_meta":{"func_name":"regulator_ena_gpio_free","file_name":"drivers/regulator/core.c","commit_link":"github.com/torvalds/linux/commit/60a2362f769cf549dc466134efe71c8bf9fbaaba","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#42-65fa15009a6f","input":"void luaD_shrinkstack (lua_State *L) {\n int inuse = stackinuse(L);\n int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK;\n if (goodsize > LUAI_MAXSTACK)\n goodsize = LUAI_MAXSTACK; /* respect stack limit */\n /* if thread is currently not handling a stack overflow and its\n good size is smaller than current size, shrink its stack */\n if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) &&\n goodsize < L->stacksize)\n luaD_reallocstack(L, goodsize, 0); /* ok if that fails */\n else /* don't change stack */\n condmovestack(L,{},{}); /* (change only for debugging) */\n luaE_shrinkCI(L); /* shrink CI list */\n}","target":"void luaD_shrinkstack (lua_State *L) {\n int inuse = stackinuse(L);\n int goodsize = inuse + BASIC_STACK_SIZE;\n if (goodsize > LUAI_MAXSTACK)\n goodsize = LUAI_MAXSTACK; /* respect stack limit */\n /* if thread is currently not handling a stack overflow and its\n good size is smaller than current size, shrink its stack */\n if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && goodsize < L->stacksize)\n luaD_reallocstack(L, goodsize, 0); /* ok if that fails */\n else /* don't change stack */\n condmovestack(L,{},{}); /* (change only for debugging) */\n luaE_shrinkCI(L); /* shrink CI list */\n}","lang":"c","vul_type":"cwe-416","target_token_count":176,"sven_meta":{"func_name":"luaD_shrinkstack","file_name":"ldo.c","commit_link":"github.com/lua/lua/commit/6298903e35217ab69c279056f925fb72900ce0b7","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#51-27fb01f9c311","input":"static void ffs_user_copy_worker(struct work_struct *work)\n{\n\tstruct ffs_io_data *io_data = container_of(work, struct ffs_io_data,\n\t\t\t\t\t\t work);\n\tint ret = io_data->req->status ? io_data->req->status :\n\t\t\t\t\t io_data->req->actual;\n\n\tif (io_data->read && ret > 0) {\n\t\tuse_mm(io_data->mm);\n\t\tret = copy_to_iter(io_data->buf, ret, &io_data->data);\n\t\tif (iov_iter_count(&io_data->data))\n\t\t\tret = -EFAULT;\n\t\tunuse_mm(io_data->mm);\n\t}\n\n\tio_data->kiocb->ki_complete(io_data->kiocb, ret, ret);\n\n\tif (io_data->ffs->ffs_eventfd &&\n\t !(io_data->kiocb->ki_flags & IOCB_EVENTFD))\n\t\teventfd_signal(io_data->ffs->ffs_eventfd, 1);\n\n\tusb_ep_free_request(io_data->ep, io_data->req);\n\n\tio_data->kiocb->private = NULL;\n\tif (io_data->read)\n\t\tkfree(io_data->to_free);\n\tkfree(io_data->buf);\n\tkfree(io_data);\n}","target":"static void ffs_user_copy_worker(struct work_struct *work)\n{\n\tstruct ffs_io_data *io_data = container_of(work, struct ffs_io_data,\n\t\t\t\t\t\t work);\n\tint ret = io_data->req->status ? io_data->req->status :\n\t\t\t\t\t io_data->req->actual;\n\tbool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD;\n\n\tif (io_data->read && ret > 0) {\n\t\tuse_mm(io_data->mm);\n\t\tret = copy_to_iter(io_data->buf, ret, &io_data->data);\n\t\tif (iov_iter_count(&io_data->data))\n\t\t\tret = -EFAULT;\n\t\tunuse_mm(io_data->mm);\n\t}\n\n\tio_data->kiocb->ki_complete(io_data->kiocb, ret, ret);\n\n\tif (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd)\n\t\teventfd_signal(io_data->ffs->ffs_eventfd, 1);\n\n\tusb_ep_free_request(io_data->ep, io_data->req);\n\n\tif (io_data->read)\n\t\tkfree(io_data->to_free);\n\tkfree(io_data->buf);\n\tkfree(io_data);\n}","lang":"c","vul_type":"cwe-416","target_token_count":253,"sven_meta":{"func_name":"ffs_user_copy_worker","file_name":"drivers/usb/gadget/function/f_fs.c","commit_link":"github.com/torvalds/linux/commit/38740a5b87d53ceb89eb2c970150f6e94e00373a","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-022#0-32960ca655d6","input":"long dd_get_item_size(struct dump_dir *dd, const char *name)\n{\n long size = -1;\n char *iname = concat_path_file(dd->dd_dirname, name);\n struct stat statbuf;\n\n if (lstat(iname, &statbuf) == 0 && S_ISREG(statbuf.st_mode))\n size = statbuf.st_size;\n else\n {\n if (errno == ENOENT)\n size = 0;\n else\n perror_msg(\"Can't get size of file '%s'\", iname);\n }\n\n free(iname);\n\n return size;\n}","target":"long dd_get_item_size(struct dump_dir *dd, const char *name)\n{\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot get item size. '%s' is not a valid file name\", name);\n\n long size = -1;\n char *iname = concat_path_file(dd->dd_dirname, name);\n struct stat statbuf;\n\n if (lstat(iname, &statbuf) == 0 && S_ISREG(statbuf.st_mode))\n size = statbuf.st_size;\n else\n {\n if (errno == ENOENT)\n size = 0;\n else\n perror_msg(\"Can't get size of file '%s'\", iname);\n }\n\n free(iname);\n\n return size;\n}","lang":"c","vul_type":"cwe-022","target_token_count":161,"sven_meta":{"func_name":"dd_get_item_size","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#3-af140e22ce53","input":"std::string TarFileReader::extract(const string &_path) {\n if (_path.empty()) THROW(\"path cannot be empty\");\n if (!hasMore()) THROW(\"No more tar files\");\n\n string path = _path;\n if (SystemUtilities::isDirectory(path)) path += \"/\" + getFilename();\n\n LOG_DEBUG(5, \"Extracting: \" << path);\n\n return extract(*SystemUtilities::oopen(path));\n}","target":"std::string TarFileReader::extract(const string &_path) {\n if (_path.empty()) THROW(\"path cannot be empty\");\n if (!hasMore()) THROW(\"No more tar files\");\n\n string path = _path;\n if (SystemUtilities::isDirectory(path)) {\n path += \"/\" + getFilename();\n\n // Check that path is under the target directory\n string a = SystemUtilities::getCanonicalPath(_path);\n string b = SystemUtilities::getCanonicalPath(path);\n if (!String::startsWith(b, a))\n THROW(\"Tar path points outside of the extraction directory: \" << path);\n }\n\n LOG_DEBUG(5, \"Extracting: \" << path);\n\n switch (getType()) {\n case NORMAL_FILE: case CONTIGUOUS_FILE:\n return extract(*SystemUtilities::oopen(path));\n case DIRECTORY: SystemUtilities::ensureDirectory(path); break;\n default: THROW(\"Unsupported tar file type \" << getType());\n }\n\n return getFilename();\n}","lang":"cpp","vul_type":"cwe-022","target_token_count":207,"sven_meta":{"func_name":"TarFileReader::extract","file_name":"src/cbang/tar/TarFileReader.cpp","commit_link":"github.com/CauldronDevelopmentLLC/cbang/commit/1c1dba62bd3e6fa9d0d0c0aa21926043b75382c7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#6-babb75076496","input":"set_interface_var(const char *iface,\n\t\t const char *var, const char *name,\n\t\t uint32_t val)\n{\n\tFILE *fp;\n\tchar spath[64+IFNAMSIZ];\t/* XXX: magic constant */\n\tif (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath))\n\t\treturn -1;\n\n\tif (access(spath, F_OK) != 0)\n\t\treturn -1;\n\n\tfp = fopen(spath, \"w\");\n\tif (!fp) {\n\t\tif (name)\n\t\t\tflog(LOG_ERR, \"failed to set %s (%u) for %s: %s\",\n\t\t\t name, val, iface, strerror(errno));\n\t\treturn -1;\n\t}\n\tfprintf(fp, \"%u\", val);\n\tfclose(fp);\n\n\treturn 0;\n}","target":"set_interface_var(const char *iface,\n\t\t const char *var, const char *name,\n\t\t uint32_t val)\n{\n\tFILE *fp;\n\tchar spath[64+IFNAMSIZ];\t/* XXX: magic constant */\n\tif (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath))\n\t\treturn -1;\n\n\t/* No path traversal */\n\tif (strstr(name, \"..\") || strchr(name, '/'))\n\t\treturn -1;\n\n\tif (access(spath, F_OK) != 0)\n\t\treturn -1;\n\n\tfp = fopen(spath, \"w\");\n\tif (!fp) {\n\t\tif (name)\n\t\t\tflog(LOG_ERR, \"failed to set %s (%u) for %s: %s\",\n\t\t\t name, val, iface, strerror(errno));\n\t\treturn -1;\n\t}\n\tfprintf(fp, \"%u\", val);\n\tfclose(fp);\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-022","target_token_count":191,"sven_meta":{"func_name":"set_interface_var","file_name":"device-linux.c","commit_link":"github.com/reubenhwk/radvd/commit/92e22ca23e52066da2258df8c76a2dca8a428bcc","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#10-fde387f9e8e5","input":"def updateKey(client):\n\t\"\"\"Updates the contents of a key that already exists in our system.\n\tReturns an error if the specified key doesn't exist for the specified user.\n\t\"\"\"\n\tglobal NOT_FOUND\n\tglobal CREATED\n\n\tvalidateClient(client)\n\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateNewKeyData(token_data)\n\n\t# Use 'w' flag to replace existing key file with the new key data\n\tif os.path.isfile('keys/%s/%s.key' % (client, token_data['name'])):\n\t\twith open('keys/%s/%s.key' % (client, token_data['name']), 'w') as f:\n\t\t\tf.write(token_data['key'])\n\telse:\n\t\traise FoxlockError(NOT_FOUND, \"Key '%s' not found\" % token_data['name'])\n\n\treturn 'Key successfully updated', CREATED","target":"def updateKey(client):\n\t\"\"\"Updates the contents of a key that already exists in our system.\n\tReturns an error if the specified key doesn't exist for the specified user.\n\t\"\"\"\n\tglobal NOT_FOUND\n\tglobal CREATED\n\n\tvalidateClient(client)\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateNewKeyData(token_data)\n\tvalidateKeyName(token_data['name'])\n\n\t# Use 'w' flag to replace existing key file with the new key data\n\tif os.path.isfile('keys/%s/%s.key' % (client, token_data['name'])):\n\t\twith open('keys/%s/%s.key' % (client, token_data['name']), 'w') as f:\n\t\t\tf.write(token_data['key'])\n\telse:\n\t\traise FoxlockError(NOT_FOUND, \"Key '%s' not found\" % token_data['name'])\n\n\treturn 'Key successfully updated', CREATED","lang":"python","vul_type":"cwe-022","target_token_count":194,"sven_meta":{"func_name":"updateKey","file_name":"impl.py","commit_link":"github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#14-89325fac8183","input":" def download_check_files(self, filelist):\n # only admins and allowed users may download\n if not cherrypy.session['admin']:\n uo = self.useroptions.forUser(self.getUserId())\n if not uo.getOptionValue('media.may_download'):\n return 'not_permitted'\n # make sure nobody tries to escape from basedir\n for f in filelist:\n if '/../' in f:\n return 'invalid_file'\n # make sure all files are smaller than maximum download size\n size_limit = cherry.config['media.maximum_download_size']\n try:\n if self.model.file_size_within_limit(filelist, size_limit):\n return 'ok'\n else:\n return 'too_big'\n except OSError as e: # use OSError for python2 compatibility\n return str(e)","target":" def download_check_files(self, filelist):\n # only admins and allowed users may download\n if not cherrypy.session['admin']:\n uo = self.useroptions.forUser(self.getUserId())\n if not uo.getOptionValue('media.may_download'):\n return 'not_permitted'\n # make sure nobody tries to escape from basedir\n for f in filelist:\n # don't allow to traverse up in the file system\n if '/../' in f or f.startswith('../'):\n return 'invalid_file'\n # CVE-2015-8309: do not allow absolute file paths\n if os.path.isabs(f):\n return 'invalid_file'\n # make sure all files are smaller than maximum download size\n size_limit = cherry.config['media.maximum_download_size']\n try:\n if self.model.file_size_within_limit(filelist, size_limit):\n return 'ok'\n else:\n return 'too_big'\n except OSError as e: # use OSError for python2 compatibility\n return str(e)","lang":"python","vul_type":"cwe-022","target_token_count":223,"sven_meta":{"func_name":"download_check_files","file_name":"cherrymusicserver/httphandler.py","commit_link":"github.com/devsnd/cherrymusic/commit/62dec34a1ea0741400dd6b6c660d303dcd651e86","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#17-cf939205715a","input":"int dd_delete_item(struct dump_dir *dd, const char *name)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n char *path = concat_path_file(dd->dd_dirname, name);\n int res = unlink(path);\n\n if (res < 0)\n {\n if (errno == ENOENT)\n errno = res = 0;\n else\n perror_msg(\"Can't delete file '%s'\", path);\n }\n\n free(path);\n return res;\n}","target":"int dd_delete_item(struct dump_dir *dd, const char *name)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot delete item. '%s' is not a valid file name\", name);\n\n char *path = concat_path_file(dd->dd_dirname, name);\n int res = unlink(path);\n\n if (res < 0)\n {\n if (errno == ENOENT)\n errno = res = 0;\n else\n perror_msg(\"Can't delete file '%s'\", path);\n }\n\n free(path);\n return res;\n}","lang":"c","vul_type":"cwe-022","target_token_count":146,"sven_meta":{"func_name":"dd_delete_item","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#19-ac95273d3e18","input":"def _inject_net_into_fs(net, fs, execute=None):\n \"\"\"Inject /etc/network/interfaces into the filesystem rooted at fs.\n\n net is the contents of /etc/network/interfaces.\n \"\"\"\n netdir = os.path.join(os.path.join(fs, 'etc'), 'network')\n utils.execute('mkdir', '-p', netdir, run_as_root=True)\n utils.execute('chown', 'root:root', netdir, run_as_root=True)\n utils.execute('chmod', 755, netdir, run_as_root=True)\n netfile = os.path.join(netdir, 'interfaces')\n utils.execute('tee', netfile, process_input=net, run_as_root=True)","target":"def _inject_net_into_fs(net, fs, execute=None):\n \"\"\"Inject /etc/network/interfaces into the filesystem rooted at fs.\n\n net is the contents of /etc/network/interfaces.\n \"\"\"\n netdir = _join_and_check_path_within_fs(fs, 'etc', 'network')\n utils.execute('mkdir', '-p', netdir, run_as_root=True)\n utils.execute('chown', 'root:root', netdir, run_as_root=True)\n utils.execute('chmod', 755, netdir, run_as_root=True)\n\n netfile = os.path.join('etc', 'network', 'interfaces')\n _inject_file_into_fs(fs, netfile, net)","lang":"python","vul_type":"cwe-022","target_token_count":144,"sven_meta":{"func_name":"_inject_net_into_fs","file_name":"nova/virt/disk/api.py","commit_link":"github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#20-e5de8ad85825","input":" def canonicalize(self):\n \"\"\"::\n\n path = path.canonicalize()\n\n Canonicalize path. ::\n\n # \"/foo/baz\"\n Pyjo.Path.new('/foo/./bar/../baz').canonicalize()\n\n # \"/../baz\"\n Pyjo.Path.new('/foo/../bar/../../baz').canonicalize()\n \"\"\"\n parts = self.parts\n i = 0\n while i < len(parts):\n if parts[i] == '.' or parts[i] == '':\n parts.pop(i)\n elif i < 1 or parts[i] != '..' or parts[i - 1] == '..':\n i += 1\n else:\n i -= 1\n parts.pop(i)\n parts.pop(i)\n\n if not parts:\n self.trailing_slash = False\n\n return self","target":" def canonicalize(self):\n \"\"\"::\n\n path = path.canonicalize()\n\n Canonicalize path by resolving ``.`` and ``..``, in addition ``...`` will be\n treated as ``.`` to protect from path traversal attacks.\n\n # \"/foo/baz\"\n Pyjo.Path.new('/foo/./bar/../baz').canonicalize()\n\n # \"/../baz\"\n Pyjo.Path.new('/foo/../bar/../../baz').canonicalize()\n\n # \"/foo/bar\"\n Pyjo.Path.new('/foo/.../bar').canonicalize()\n \"\"\"\n parts = self.parts\n i = 0\n while i < len(parts):\n if parts[i] == '' or parts[i] == '.' or parts[i] == '...':\n parts.pop(i)\n elif i < 1 or parts[i] != '..' or parts[i - 1] == '..':\n i += 1\n else:\n i -= 1\n parts.pop(i)\n parts.pop(i)\n\n if not parts:\n self.trailing_slash = False\n\n return self","lang":"python","vul_type":"cwe-022","target_token_count":228,"sven_meta":{"func_name":"canonicalize","file_name":"Pyjo/Path.py","commit_link":"github.com/dex4er/Pyjoyment/commit/e4b115bc80c41615b2133091af3a74ee5d995c2e","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#21-5ecb38f4f63d","input":"CString CWebSock::GetSkinPath(const CString& sSkinName) {\n CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkinName;\n\n if (!CFile::IsDir(sRet)) {\n sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkinName;\n\n if (!CFile::IsDir(sRet)) {\n sRet = CString(_SKINDIR_) + \"/\" + sSkinName;\n }\n }\n\n return sRet + \"/\";\n}","target":"CString CWebSock::GetSkinPath(const CString& sSkinName) {\n const CString sSkin = sSkinName.Replace_n(\"/\", \"_\").Replace_n(\".\", \"_\");\n\n CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkin;\n\n if (!CFile::IsDir(sRet)) {\n sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkin;\n\n if (!CFile::IsDir(sRet)) {\n sRet = CString(_SKINDIR_) + \"/\" + sSkin;\n }\n }\n\n return sRet + \"/\";\n}","lang":"cpp","vul_type":"cwe-022","target_token_count":132,"sven_meta":{"func_name":"CWebSock::GetSkinPath","file_name":"src/WebModules.cpp","commit_link":"github.com/znc/znc/commit/a4a5aeeb17d32937d8c7d743dae9a4cc755ce773","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#22-1ebc2f1e91c2","input":"def addKey(client):\n\t\"\"\"Adds a new key with the specified name and contents.\n\tReturns an error if a key with the specified name already exists.\n\t\"\"\"\n\tglobal BAD_REQUEST\n\tglobal CREATED\n\n\tvalidateClient(client)\n\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateNewKeyData(token_data)\n\n\t# Use 'x' flag so we can throw an error if a key with this name already exists\n\ttry:\n\t\twith open('keys/%s/%s.key' % (client, token_data['name']), 'x') as f:\n\t\t\tf.write(token_data['key'])\n\texcept FileExistsError:\n\t\traise FoxlockError(BAD_REQUEST, \"Key '%s' already exists\" % token_data['name'])\n\n\treturn 'Key successfully created', CREATED","target":"def addKey(client):\n\t\"\"\"Adds a new key with the specified name and contents.\n\tReturns an error if a key with the specified name already exists.\n\t\"\"\"\n\tglobal BAD_REQUEST\n\tglobal CREATED\n\n\tvalidateClient(client)\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateNewKeyData(token_data)\n\tvalidateKeyName(token_data['name'])\n\n\t# Use 'x' flag so we can throw an error if a key with this name already exists\n\ttry:\n\t\twith open('keys/%s/%s.key' % (client, token_data['name']), 'x') as f:\n\t\t\tf.write(token_data['key'])\n\texcept FileExistsError:\n\t\traise FoxlockError(BAD_REQUEST, \"Key '%s' already exists\" % token_data['name'])\n\n\treturn 'Key successfully created', CREATED","lang":"python","vul_type":"cwe-022","target_token_count":177,"sven_meta":{"func_name":"addKey","file_name":"impl.py","commit_link":"github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#29-ccc28408d7e9","input":" def list(self, keyfilter='/'):\n path = os.path.join(self.namespace, keyfilter)\n if path != '/':\n path = path.rstrip('/')\n try:\n result = self.etcd.read(path, recursive=True)\n except etcd.EtcdKeyNotFound:\n return None\n except etcd.EtcdException as err:\n log_error(\"Error listing %s: [%r]\" % (keyfilter, repr(err)))\n raise CSStoreError('Error occurred while trying to list keys')\n\n value = set()\n for entry in result.get_subtree():\n if entry.key == path:\n continue\n name = entry.key[len(path):]\n if entry.dir and not name.endswith('/'):\n name += '/'\n value.add(name.lstrip('/'))\n return sorted(value)","target":" def list(self, keyfilter='/'):\n path = self._absolute_key(keyfilter)\n if path != '/':\n path = path.rstrip('/')\n try:\n result = self.etcd.read(path, recursive=True)\n except etcd.EtcdKeyNotFound:\n return None\n except etcd.EtcdException as err:\n log_error(\"Error listing %s: [%r]\" % (keyfilter, repr(err)))\n raise CSStoreError('Error occurred while trying to list keys')\n\n value = set()\n for entry in result.get_subtree():\n if entry.key == path:\n continue\n name = entry.key[len(path):]\n if entry.dir and not name.endswith('/'):\n name += '/'\n value.add(name.lstrip('/'))\n return sorted(value)","lang":"python","vul_type":"cwe-022","target_token_count":165,"sven_meta":{"func_name":"list","file_name":"custodia/store/etcdstore.py","commit_link":"github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#32-0c5c9d496b9b","input":" def _normalize(self, metaerrors):\n \"\"\"Normalize output format to be usable by Anaconda's linting frontend\n \"\"\"\n\n errors = []\n for error in metaerrors:\n if self.filepath not in error.get('path', ''):\n continue\n\n error_type = error.get('severity', 'X').capitalize()[0]\n if error_type == 'X':\n continue\n if error_type not in ['E', 'W']:\n error_type = 'V'\n errors.append({\n 'underline_range': True,\n 'lineno': error.get('line', 0),\n 'offset': error.get('col', 0),\n 'raw_message': error.get('message', ''),\n 'code': 0,\n 'level': error_type,\n 'message': '[{0}] {1} ({2}): {3}'.format(\n error_type,\n error.get('linter', 'none'),\n error.get('severity', 'none'),\n error.get('message')\n )\n })\n\n return errors","target":" def _normalize(self, metaerrors):\n \"\"\"Normalize output format to be usable by Anaconda's linting frontend\n \"\"\"\n\n errors = []\n for error in metaerrors:\n last_path = os.path.join(\n os.path.basename(os.path.dirname(self.filepath)),\n os.path.basename(self.filepath)\n )\n if last_path not in error.get('path', ''):\n continue\n\n error_type = error.get('severity', 'X').capitalize()[0]\n if error_type == 'X':\n continue\n if error_type not in ['E', 'W']:\n error_type = 'V'\n errors.append({\n 'underline_range': True,\n 'lineno': error.get('line', 0),\n 'offset': error.get('col', 0),\n 'raw_message': error.get('message', ''),\n 'code': 0,\n 'level': error_type,\n 'message': '[{0}] {1} ({2}): {3}'.format(\n error_type,\n error.get('linter', 'none'),\n error.get('severity', 'none'),\n error.get('message')\n )\n })\n\n return errors","lang":"python","vul_type":"cwe-022","target_token_count":244,"sven_meta":{"func_name":"_normalize","file_name":"plugin/handlers_go/anagonda/context/gometalinter.py","commit_link":"github.com/DamnWidget/anaconda_go/commit/d3db90bb8853d832927818699591b91f56f6413c","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#33-cbec5836ee49","input":"char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags)\n{\n// if (!dd->locked)\n// error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n /* Compat with old abrt dumps. Remove in abrt-2.1 */\n if (strcmp(name, \"release\") == 0)\n name = FILENAME_OS_RELEASE;\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n char *ret = load_text_file(full_path, flags);\n free(full_path);\n\n return ret;\n}","target":"char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags)\n{\n// if (!dd->locked)\n// error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n if (!str_is_correct_filename(name))\n {\n error_msg(\"Cannot load text. '%s' is not a valid file name\", name);\n if (!(flags & DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE))\n xfunc_die();\n }\n\n /* Compat with old abrt dumps. Remove in abrt-2.1 */\n if (strcmp(name, \"release\") == 0)\n name = FILENAME_OS_RELEASE;\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n char *ret = load_text_file(full_path, flags);\n free(full_path);\n\n return ret;\n}","lang":"c","vul_type":"cwe-022","target_token_count":177,"sven_meta":{"func_name":"dd_load_text_ext","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#47-b362740ea400","input":" def is_cgi(self):\n \"\"\"Test whether self.path corresponds to a CGI script,\n and return a boolean.\n\n This function sets self.cgi_info to a tuple (dir, rest)\n when it returns True, where dir is the directory part before\n the CGI script name. Note that rest begins with a\n slash if it is not empty.\n\n The default implementation tests whether the path\n begins with one of the strings in the list\n self.cgi_directories (and the next character is a '/'\n or the end of the string).\n \"\"\"\n\n path = self.path\n\n for x in self.cgi_directories:\n i = len(x)\n if path[:i] == x and (not path[i:] or path[i] == '/'):\n self.cgi_info = path[:i], path[i+1:]\n return True\n return False","target":" def is_cgi(self):\n \"\"\"Test whether self.path corresponds to a CGI script.\n\n Returns True and updates the cgi_info attribute to the tuple\n (dir, rest) if self.path requires running a CGI script.\n Returns False otherwise.\n\n The default implementation tests whether the normalized url\n path begins with one of the strings in self.cgi_directories\n (and the next character is a '/' or the end of the string).\n \"\"\"\n splitpath = _url_collapse_path_split(self.path)\n if splitpath[0] in self.cgi_directories:\n self.cgi_info = splitpath\n return True\n return False","lang":"python","vul_type":"cwe-022","target_token_count":135,"sven_meta":{"func_name":"is_cgi","file_name":"Lib/CGIHTTPServer.py","commit_link":"github.com/Ricky-Wilson/Python/commit/c5abced949e6a4b001d1dee321593e74ecadecfe","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#50-b4b02a129f3c","input":"def _inject_key_into_fs(key, fs, execute=None):\n \"\"\"Add the given public ssh key to root's authorized_keys.\n\n key is an ssh key string.\n fs is the path to the base of the filesystem into which to inject the key.\n \"\"\"\n sshdir = os.path.join(fs, 'root', '.ssh')\n utils.execute('mkdir', '-p', sshdir, run_as_root=True)\n utils.execute('chown', 'root', sshdir, run_as_root=True)\n utils.execute('chmod', '700', sshdir, run_as_root=True)\n keyfile = os.path.join(sshdir, 'authorized_keys')\n key_data = [\n '\\n',\n '# The following ssh key was injected by Nova',\n '\\n',\n key.strip(),\n '\\n',\n ]\n utils.execute('tee', '-a', keyfile,\n process_input=''.join(key_data), run_as_root=True)","target":"def _inject_key_into_fs(key, fs, execute=None):\n \"\"\"Add the given public ssh key to root's authorized_keys.\n\n key is an ssh key string.\n fs is the path to the base of the filesystem into which to inject the key.\n \"\"\"\n sshdir = _join_and_check_path_within_fs(fs, 'root', '.ssh')\n utils.execute('mkdir', '-p', sshdir, run_as_root=True)\n utils.execute('chown', 'root', sshdir, run_as_root=True)\n utils.execute('chmod', '700', sshdir, run_as_root=True)\n\n keyfile = os.path.join('root', '.ssh', 'authorized_keys')\n\n key_data = ''.join([\n '\\n',\n '# The following ssh key was injected by Nova',\n '\\n',\n key.strip(),\n '\\n',\n ])\n\n _inject_file_into_fs(fs, keyfile, key_data, append=True)","lang":"python","vul_type":"cwe-022","target_token_count":198,"sven_meta":{"func_name":"_inject_key_into_fs","file_name":"nova/virt/disk/api.py","commit_link":"github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-787#0-06ab8781d9a4","input":"rfbHandleAuthResult(rfbClient* client)\n{\n uint32_t authResult=0, reasonLen=0;\n char *reason=NULL;\n\n if (!ReadFromRFBServer(client, (char *)&authResult, 4)) return FALSE;\n\n authResult = rfbClientSwap32IfLE(authResult);\n\n switch (authResult) {\n case rfbVncAuthOK:\n rfbClientLog(\"VNC authentication succeeded\\n\");\n return TRUE;\n break;\n case rfbVncAuthFailed:\n if (client->major==3 && client->minor>7)\n {\n /* we have an error following */\n if (!ReadFromRFBServer(client, (char *)&reasonLen, 4)) return FALSE;\n reasonLen = rfbClientSwap32IfLE(reasonLen);\n reason = malloc((uint64_t)reasonLen+1);\n if (!ReadFromRFBServer(client, reason, reasonLen)) { free(reason); return FALSE; }\n reason[reasonLen]=0;\n rfbClientLog(\"VNC connection failed: %s\\n\",reason);\n free(reason);\n return FALSE;\n }\n rfbClientLog(\"VNC authentication failed\\n\");\n return FALSE;\n case rfbVncAuthTooMany:\n rfbClientLog(\"VNC authentication failed - too many tries\\n\");\n return FALSE;\n }\n\n rfbClientLog(\"Unknown VNC authentication result: %d\\n\",\n (int)authResult);\n return FALSE;\n}","target":"rfbHandleAuthResult(rfbClient* client)\n{\n uint32_t authResult=0;\n\n if (!ReadFromRFBServer(client, (char *)&authResult, 4)) return FALSE;\n\n authResult = rfbClientSwap32IfLE(authResult);\n\n switch (authResult) {\n case rfbVncAuthOK:\n rfbClientLog(\"VNC authentication succeeded\\n\");\n return TRUE;\n break;\n case rfbVncAuthFailed:\n if (client->major==3 && client->minor>7)\n {\n /* we have an error following */\n ReadReason(client);\n return FALSE;\n }\n rfbClientLog(\"VNC authentication failed\\n\");\n return FALSE;\n case rfbVncAuthTooMany:\n rfbClientLog(\"VNC authentication failed - too many tries\\n\");\n return FALSE;\n }\n\n rfbClientLog(\"Unknown VNC authentication result: %d\\n\",\n (int)authResult);\n return FALSE;\n}","lang":"c","vul_type":"cwe-787","target_token_count":215,"sven_meta":{"func_name":"rfbHandleAuthResult","file_name":"libvncclient/rfbproto.c","commit_link":"github.com/LibVNC/libvncserver/commit/e34bcbb759ca5bef85809967a268fdf214c1ad2c","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#2-159ad4048c96","input":"next_state_class(CClassNode* cc, OnigCodePoint* vs, enum CCVALTYPE* type,\n\t\t enum CCSTATE* state, ScanEnv* env)\n{\n int r;\n\n if (*state == CCS_RANGE)\n return ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE;\n\n if (*state == CCS_VALUE && *type != CCV_CLASS) {\n if (*type == CCV_SB)\n BITSET_SET_BIT(cc->bs, (int )(*vs));\n else if (*type == CCV_CODE_POINT) {\n r = add_code_range(&(cc->mbuf), env, *vs, *vs);\n if (r < 0) return r;\n }\n }\n\n *state = CCS_VALUE;\n *type = CCV_CLASS;\n return 0;\n}","target":"next_state_class(CClassNode* cc, OnigCodePoint* vs, enum CCVALTYPE* type,\n\t\t enum CCSTATE* state, ScanEnv* env)\n{\n int r;\n\n if (*state == CCS_RANGE)\n return ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE;\n\n if (*state == CCS_VALUE && *type != CCV_CLASS) {\n if (*type == CCV_SB)\n BITSET_SET_BIT(cc->bs, (int )(*vs));\n else if (*type == CCV_CODE_POINT) {\n r = add_code_range(&(cc->mbuf), env, *vs, *vs);\n if (r < 0) return r;\n }\n }\n\n if (*state != CCS_START)\n *state = CCS_VALUE;\n\n *type = CCV_CLASS;\n return 0;\n}","lang":"c","vul_type":"cwe-787","target_token_count":178,"sven_meta":{"func_name":"next_state_class","file_name":"src/regparse.c","commit_link":"github.com/kkos/oniguruma/commit/3b63d12038c8d8fc278e81c942fa9bec7c704c8b","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#11-446653130560","input":"bool Scanner::fill(size_t need)\n{\n if (eof) return false;\n\n pop_finished_files();\n\n DASSERT(bot <= tok && tok <= lim);\n size_t free = static_cast(tok - bot);\n size_t copy = static_cast(lim - tok);\n\n if (free >= need) {\n memmove(bot, tok, copy);\n shift_ptrs_and_fpos(-static_cast(free));\n }\n else {\n BSIZE += std::max(BSIZE, need);\n char * buf = new char[BSIZE + YYMAXFILL];\n if (!buf) fatal(\"out of memory\");\n\n memmove(buf, tok, copy);\n shift_ptrs_and_fpos(buf - bot);\n delete [] bot;\n bot = buf;\n\n free = BSIZE - copy;\n }\n\n if (!read(free)) {\n eof = lim;\n memset(lim, 0, YYMAXFILL);\n lim += YYMAXFILL;\n }\n\n return true;\n}","target":"bool Scanner::fill(size_t need)\n{\n if (eof) return false;\n\n pop_finished_files();\n\n DASSERT(bot <= tok && tok <= lim);\n size_t free = static_cast(tok - bot);\n size_t copy = static_cast(lim - tok);\n\n if (free >= need) {\n memmove(bot, tok, copy);\n shift_ptrs_and_fpos(-static_cast(free));\n }\n else {\n BSIZE += std::max(BSIZE, need);\n char * buf = new char[BSIZE + YYMAXFILL];\n if (!buf) fatal(\"out of memory\");\n\n memmove(buf, tok, copy);\n shift_ptrs_and_fpos(buf - tok);\n delete [] bot;\n bot = buf;\n\n free = BSIZE - copy;\n }\n\n DASSERT(lim + free <= bot + BSIZE);\n if (!read(free)) {\n eof = lim;\n memset(lim, 0, YYMAXFILL);\n lim += YYMAXFILL;\n }\n\n return true;\n}","lang":"cpp","vul_type":"cwe-787","target_token_count":230,"sven_meta":{"func_name":"re2c::Scanner::fill","file_name":"src/parse/scanner.cc","commit_link":"github.com/skvadrik/re2c/commit/c4603ba5ce229db83a2a4fb93e6d4b4e3ec3776a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#13-4472376d45c6","input":"char *enl_ipc_get(const char *msg_data)\n{\n\n\tstatic char *message = NULL;\n\tstatic unsigned short len = 0;\n\tchar buff[13], *ret_msg = NULL;\n\tregister unsigned char i;\n\tunsigned char blen;\n\n\tif (msg_data == IPC_TIMEOUT) {\n\t\treturn(IPC_TIMEOUT);\n\t}\n\tfor (i = 0; i < 12; i++) {\n\t\tbuff[i] = msg_data[i];\n\t}\n\tbuff[12] = 0;\n\tblen = strlen(buff);\n\tif (message != NULL) {\n\t\tlen += blen;\n\t\tmessage = (char *) erealloc(message, len + 1);\n\t\tstrcat(message, buff);\n\t} else {\n\t\tlen = blen;\n\t\tmessage = (char *) emalloc(len + 1);\n\t\tstrcpy(message, buff);\n\t}\n\tif (blen < 12) {\n\t\tret_msg = message;\n\t\tmessage = NULL;\n\t\tD((\"Received complete reply: \\\"%s\\\"\\n\", ret_msg));\n\t}\n\treturn(ret_msg);\n}","target":"char *enl_ipc_get(const char *msg_data)\n{\n\n\tstatic char *message = NULL;\n\tstatic size_t len = 0;\n\tchar buff[13], *ret_msg = NULL;\n\tregister unsigned char i;\n\tunsigned char blen;\n\n\tif (msg_data == IPC_TIMEOUT) {\n\t\treturn(IPC_TIMEOUT);\n\t}\n\tfor (i = 0; i < 12; i++) {\n\t\tbuff[i] = msg_data[i];\n\t}\n\tbuff[12] = 0;\n\tblen = strlen(buff);\n\tif (message != NULL) {\n\t\tlen += blen;\n\t\tmessage = (char *) erealloc(message, len + 1);\n\t\tstrcat(message, buff);\n\t} else {\n\t\tlen = blen;\n\t\tmessage = (char *) emalloc(len + 1);\n\t\tstrcpy(message, buff);\n\t}\n\tif (blen < 12) {\n\t\tret_msg = message;\n\t\tmessage = NULL;\n\t\tD((\"Received complete reply: \\\"%s\\\"\\n\", ret_msg));\n\t}\n\treturn(ret_msg);\n}","lang":"c","vul_type":"cwe-787","target_token_count":218,"sven_meta":{"func_name":"enl_ipc_get","file_name":"src/wallpaper.c","commit_link":"github.com/derf/feh/commit/f7a547b7ef8fc8ebdeaa4c28515c9d72e592fb6d","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#25-c5cd2b518aef","input":"int32_t *enc_untrusted_create_wait_queue() {\n MessageWriter input;\n MessageReader output;\n input.Push(sizeof(int32_t));\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kLocalLifetimeAllocHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_create_wait_queue\",\n 2);\n int32_t *queue = reinterpret_cast(output.next());\n int klinux_errno = output.next();\n if (queue == nullptr) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n }\n enc_untrusted_disable_waiting(queue);\n return queue;\n}","target":"int32_t *enc_untrusted_create_wait_queue() {\n MessageWriter input;\n MessageReader output;\n input.Push(sizeof(int32_t));\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kLocalLifetimeAllocHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_create_wait_queue\",\n 2);\n int32_t *queue = reinterpret_cast(output.next());\n if (!TrustedPrimitives::IsOutsideEnclave(queue, sizeof(int32_t))) {\n TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_create_wait_queue: queue should be in untrusted memory\");\n }\n int klinux_errno = output.next();\n if (queue == nullptr) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n }\n enc_untrusted_disable_waiting(queue);\n return queue;\n}","lang":"cpp","vul_type":"cwe-787","target_token_count":205,"sven_meta":{"func_name":"enc_untrusted_create_wait_queue","file_name":"asylo/platform/host_call/trusted/concurrency.cc","commit_link":"github.com/google/asylo/commit/a37fb6a0e7daf30134dbbf357c9a518a1026aa02","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#30-c1a8db8a64f6","input":"int ecall_restore(const char *input, uint64_t input_len, char **output,\n uint64_t *output_len) {\n if (!asylo::primitives::TrustedPrimitives::IsOutsideEnclave(input,\n input_len) ||\n !asylo::primitives::TrustedPrimitives::IsOutsideEnclave(\n output_len, sizeof(uint64_t))) {\n asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"ecall_restore: input/output found to not be in untrusted memory.\");\n }\n int result = 0;\n size_t tmp_output_len;\n try {\n result = asylo::Restore(input, static_cast(input_len), output,\n &tmp_output_len);\n } catch (...) {\n LOG(FATAL) << \"Uncaught exception in enclave\";\n }\n\n if (output_len) {\n *output_len = static_cast(tmp_output_len);\n }\n return result;\n}","target":"int ecall_restore(const char *input, uint64_t input_len, char **output,\n uint64_t *output_len) {\n if (!asylo::primitives::TrustedPrimitives::IsOutsideEnclave(input,\n input_len) ||\n !asylo::primitives::TrustedPrimitives::IsOutsideEnclave(\n output_len, sizeof(uint64_t)) ||\n !asylo::primitives::TrustedPrimitives::IsOutsideEnclave(output,\n *output_len)) {\n asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"ecall_restore: input/output found to not be in untrusted memory.\");\n }\n int result = 0;\n size_t tmp_output_len;\n try {\n result = asylo::Restore(input, static_cast(input_len), output,\n &tmp_output_len);\n } catch (...) {\n LOG(FATAL) << \"Uncaught exception in enclave\";\n }\n\n if (output_len) {\n *output_len = static_cast(tmp_output_len);\n }\n return result;\n}","lang":"cpp","vul_type":"cwe-787","target_token_count":239,"sven_meta":{"func_name":"ecall_restore","file_name":"asylo/platform/primitives/sgx/ecalls.cc","commit_link":"github.com/google/asylo/commit/382da2b8b09cbf928668a2445efb778f76bd9c8a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#47-fc36a5ab46ac","input":"int rds_rdma_extra_size(struct rds_rdma_args *args)\n{\n\tstruct rds_iovec vec;\n\tstruct rds_iovec __user *local_vec;\n\tint tot_pages = 0;\n\tunsigned int nr_pages;\n\tunsigned int i;\n\n\tlocal_vec = (struct rds_iovec __user *)(unsigned long) args->local_vec_addr;\n\n\t/* figure out the number of pages in the vector */\n\tfor (i = 0; i < args->nr_local; i++) {\n\t\tif (copy_from_user(&vec, &local_vec[i],\n\t\t\t\t sizeof(struct rds_iovec)))\n\t\t\treturn -EFAULT;\n\n\t\tnr_pages = rds_pages_in_vec(&vec);\n\t\tif (nr_pages == 0)\n\t\t\treturn -EINVAL;\n\n\t\ttot_pages += nr_pages;\n\n\t\t/*\n\t\t * nr_pages for one entry is limited to (UINT_MAX>>PAGE_SHIFT)+1,\n\t\t * so tot_pages cannot overflow without first going negative.\n\t\t */\n\t\tif (tot_pages < 0)\n\t\t\treturn -EINVAL;\n\t}\n\n\treturn tot_pages * sizeof(struct scatterlist);\n}","target":"int rds_rdma_extra_size(struct rds_rdma_args *args)\n{\n\tstruct rds_iovec vec;\n\tstruct rds_iovec __user *local_vec;\n\tint tot_pages = 0;\n\tunsigned int nr_pages;\n\tunsigned int i;\n\n\tlocal_vec = (struct rds_iovec __user *)(unsigned long) args->local_vec_addr;\n\n\tif (args->nr_local == 0)\n\t\treturn -EINVAL;\n\n\t/* figure out the number of pages in the vector */\n\tfor (i = 0; i < args->nr_local; i++) {\n\t\tif (copy_from_user(&vec, &local_vec[i],\n\t\t\t\t sizeof(struct rds_iovec)))\n\t\t\treturn -EFAULT;\n\n\t\tnr_pages = rds_pages_in_vec(&vec);\n\t\tif (nr_pages == 0)\n\t\t\treturn -EINVAL;\n\n\t\ttot_pages += nr_pages;\n\n\t\t/*\n\t\t * nr_pages for one entry is limited to (UINT_MAX>>PAGE_SHIFT)+1,\n\t\t * so tot_pages cannot overflow without first going negative.\n\t\t */\n\t\tif (tot_pages < 0)\n\t\t\treturn -EINVAL;\n\t}\n\n\treturn tot_pages * sizeof(struct scatterlist);\n}","lang":"c","vul_type":"cwe-787","target_token_count":240,"sven_meta":{"func_name":"rds_rdma_extra_size","file_name":"net/rds/rdma.c","commit_link":"github.com/torvalds/linux/commit/c095508770aebf1b9218e77026e48345d719b17c","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#49-d0e19e60cfd3","input":"concat_opt_exact_str(OptStr* to, UChar* s, UChar* end, OnigEncoding enc)\n{\n int i, j, len;\n UChar *p;\n\n for (i = to->len, p = s; p < end && i < OPT_EXACT_MAXLEN; ) {\n len = enclen(enc, p);\n if (i + len > OPT_EXACT_MAXLEN) break;\n for (j = 0; j < len && p < end; j++)\n to->s[i++] = *p++;\n }\n\n to->len = i;\n\n if (p >= end)\n to->reach_end = 1;\n}","target":"concat_opt_exact_str(OptStr* to, UChar* s, UChar* end, OnigEncoding enc)\n{\n int i, j, len;\n UChar *p;\n\n for (i = to->len, p = s; p < end && i < OPT_EXACT_MAXLEN; ) {\n len = enclen(enc, p);\n if (i + len >= OPT_EXACT_MAXLEN) break;\n for (j = 0; j < len && p < end; j++)\n to->s[i++] = *p++;\n }\n\n to->len = i;\n\n if (p >= end)\n to->reach_end = 1;\n}","lang":"c","vul_type":"cwe-787","target_token_count":146,"sven_meta":{"func_name":"concat_opt_exact_str","file_name":"src/regcomp.c","commit_link":"github.com/kkos/oniguruma/commit/cbe9f8bd9cfc6c3c87a60fbae58fa1a85db59df0","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-079#2-1f5e3f3e9515","input":" @auth.public\n def get(self, build_id):\n try:\n build_id = int(build_id)\n except ValueError as ex:\n self.response.write(ex.message)\n self.abort(400)\n\n build = model.Build.get_by_id(build_id)\n can_view = build and user.can_view_build_async(build).get_result()\n\n if not can_view:\n if auth.get_current_identity().is_anonymous:\n return self.redirect(gae_users.create_login_url(self.request.url))\n self.response.write('build %d not found' % build_id)\n self.abort(404)\n\n return self.redirect(str(build.url))","target":" @auth.public\n def get(self, build_id):\n try:\n build_id = int(build_id)\n except ValueError:\n self.response.write('invalid build id')\n self.abort(400)\n\n build = model.Build.get_by_id(build_id)\n can_view = build and user.can_view_build_async(build).get_result()\n\n if not can_view:\n if auth.get_current_identity().is_anonymous:\n return self.redirect(self.create_login_url(self.request.url))\n self.response.write('build %d not found' % build_id)\n self.abort(404)\n\n return self.redirect(str(build.url))","lang":"python","vul_type":"cwe-079","target_token_count":132,"sven_meta":{"func_name":"get","file_name":"appengine/cr-buildbucket/handlers.py","commit_link":"github.com/asdfghjjklllllaaa/infra/commit/2f39f3df54fb79b56744f00bcf97583b3807851f","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#4-58bb34cd48a1","input":" def respond_error(self, context, exception):\n context.respond_server_error()\n stack = traceback.format_exc()\n return \"\"\"\n \n \n\n \n\n \n
\n

\n Server error\n

\n
\n%s\n                
\n \n \n \"\"\" % stack","target":" def respond_error(self, context, exception):\n context.respond_server_error()\n stack = traceback.format_exc()\n return \"\"\"\n \n \n\n \n\n \n
\n

\n Server error\n

\n
\n%s\n                
\n \n \n \"\"\" % cgi.escape(stack)","lang":"python","vul_type":"cwe-079","target_token_count":156,"sven_meta":{"func_name":"respond_error","file_name":"ajenti/routing.py","commit_link":"github.com/Eugeny/ajenti/commit/d3fc5eb142ff16d55d158afb050af18d5ff09120","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#5-ebc94b604080","input":"@check_document_access_permission()\ndef edit_bundle(request):\n bundle_id = request.GET.get('bundle')\n doc = None\n \n if bundle_id:\n doc = Document2.objects.get(id=bundle_id)\n bundle = Bundle(document=doc)\n else:\n bundle = Bundle()\n\n coordinators = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='coordinator2')]\n\n return render('editor/bundle_editor.mako', request, {\n 'bundle_json': bundle.json,\n 'coordinators_json': json.dumps(coordinators),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user)) \n })","target":"@check_document_access_permission()\ndef edit_bundle(request):\n bundle_id = request.GET.get('bundle')\n doc = None\n \n if bundle_id:\n doc = Document2.objects.get(id=bundle_id)\n bundle = Bundle(document=doc)\n else:\n bundle = Bundle()\n\n coordinators = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='coordinator2')]\n\n return render('editor/bundle_editor.mako', request, {\n 'bundle_json': bundle.json_for_html(),\n 'coordinators_json': json.dumps(coordinators, cls=JSONEncoderForHTML),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user)) \n })","lang":"python","vul_type":"cwe-079","target_token_count":188,"sven_meta":{"func_name":"edit_bundle","file_name":"apps/oozie/src/oozie/views/editor2.py","commit_link":"github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#6-63c855d4e2b4","input":"def history_data(start_time, offset=None):\n \"\"\"Return history data.\n\n Arguments:\n start_time: select history starting from this timestamp.\n offset: number of items to skip\n \"\"\"\n # history atimes are stored as ints, ensure start_time is not a float\n start_time = int(start_time)\n hist = objreg.get('web-history')\n if offset is not None:\n entries = hist.entries_before(start_time, limit=1000, offset=offset)\n else:\n # end is 24hrs earlier than start\n end_time = start_time - 24*60*60\n entries = hist.entries_between(end_time, start_time)\n\n return [{\"url\": e.url, \"title\": e.title or e.url, \"time\": e.atime}\n for e in entries]","target":"def history_data(start_time, offset=None):\n \"\"\"Return history data.\n\n Arguments:\n start_time: select history starting from this timestamp.\n offset: number of items to skip\n \"\"\"\n # history atimes are stored as ints, ensure start_time is not a float\n start_time = int(start_time)\n hist = objreg.get('web-history')\n if offset is not None:\n entries = hist.entries_before(start_time, limit=1000, offset=offset)\n else:\n # end is 24hrs earlier than start\n end_time = start_time - 24*60*60\n entries = hist.entries_between(end_time, start_time)\n\n return [{\"url\": html.escape(e.url),\n \"title\": html.escape(e.title) or html.escape(e.url),\n \"time\": e.atime} for e in entries]","lang":"python","vul_type":"cwe-079","target_token_count":185,"sven_meta":{"func_name":"history_data","file_name":"qutebrowser/browser/qutescheme.py","commit_link":"github.com/qutebrowser/qutebrowser/commit/4c9360237f186681b1e3f2a0f30c45161cf405c7","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#9-ffe37f29f6f1","input":"@register.tag\n@basictag(takes_context=True)\ndef gravatar(context, user, size=None):\n \"\"\"\n Outputs the HTML for displaying a user's gravatar.\n\n This can take an optional size of the image (defaults to 80 if not\n specified).\n\n This is also influenced by the following settings:\n\n GRAVATAR_SIZE - Default size for gravatars\n GRAVATAR_RATING - Maximum allowed rating (g, pg, r, x)\n GRAVATAR_DEFAULT - Default image set to show if the user hasn't\n specified a gravatar (identicon, monsterid, wavatar)\n\n See http://www.gravatar.com/ for more information.\n \"\"\"\n url = get_gravatar_url(context['request'], user, size)\n\n if url:\n return ('\"%s\"' %\n (url, size, size, user.get_full_name() or user.username))\n else:\n return ''","target":"@register.tag\n@basictag(takes_context=True)\ndef gravatar(context, user, size=None):\n \"\"\"\n Outputs the HTML for displaying a user's gravatar.\n\n This can take an optional size of the image (defaults to 80 if not\n specified).\n\n This is also influenced by the following settings:\n\n GRAVATAR_SIZE - Default size for gravatars\n GRAVATAR_RATING - Maximum allowed rating (g, pg, r, x)\n GRAVATAR_DEFAULT - Default image set to show if the user hasn't\n specified a gravatar (identicon, monsterid, wavatar)\n\n See http://www.gravatar.com/ for more information.\n \"\"\"\n url = get_gravatar_url(context['request'], user, size)\n\n if url:\n return format_html(\n '\"{2}\"',\n url, size, user.get_full_name() or user.username)\n else:\n return ''","lang":"python","vul_type":"cwe-079","target_token_count":220,"sven_meta":{"func_name":"gravatar","file_name":"djblets/gravatars/templatetags/gravatars.py","commit_link":"github.com/djblets/djblets/commit/77ac64642ad530bf69e390c51fc6fdcb8914c8e7","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#11-71864406ed9e","input":"def is_safe_url(url, host=None):\n \"\"\"\n Return ``True`` if the url is a safe redirection (i.e. it doesn't point to\n a different host and uses a safe scheme).\n\n Always returns ``False`` on an empty url.\n \"\"\"\n if url is not None:\n url = url.strip()\n if not url:\n return False\n # Chrome treats \\ completely as /\n url = url.replace('\\\\', '/')\n # Chrome considers any URL with more than two slashes to be absolute, but\n # urlparse is not so flexible. Treat any url with three slashes as unsafe.\n if url.startswith('///'):\n return False\n url_info = urlparse(url)\n # Forbid URLs like http:///example.com - with a scheme, but without a hostname.\n # In that URL, example.com is not the hostname but, a path component. However,\n # Chrome will still consider example.com to be the hostname, so we must not\n # allow this syntax.\n if not url_info.netloc and url_info.scheme:\n return False\n # Forbid URLs that start with control characters. Some browsers (like\n # Chrome) ignore quite a few control characters at the start of a\n # URL and might consider the URL as scheme relative.\n if unicodedata.category(url[0])[0] == 'C':\n return False\n return ((not url_info.netloc or url_info.netloc == host) and\n (not url_info.scheme or url_info.scheme in ['http', 'https']))","target":"def is_safe_url(url, host=None):\n \"\"\"\n Return ``True`` if the url is a safe redirection (i.e. it doesn't point to\n a different host and uses a safe scheme).\n\n Always returns ``False`` on an empty url.\n \"\"\"\n if url is not None:\n url = url.strip()\n if not url:\n return False\n # Chrome treats \\ completely as / in paths but it could be part of some\n # basic auth credentials so we need to check both URLs.\n return _is_safe_url(url, host) and _is_safe_url(url.replace('\\\\', '/'), host)","lang":"python","vul_type":"cwe-079","target_token_count":132,"sven_meta":{"func_name":"is_safe_url","file_name":"django/utils/http.py","commit_link":"github.com/django/django/commit/c5544d289233f501917e25970c03ed444abbd4f0","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#16-5cfb869ae4db","input":" def mode_receive(self, request):\n \"\"\"\n This is called by render_POST when the client is telling us\n that it is ready to receive data as soon as it is available.\n This is the basis of a long-polling (comet) mechanism: the\n server will wait to reply until data is available.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = request.args.get('csessid')[0]\n self.last_alive[csessid] = (time.time(), False)\n\n dataentries = self.databuffer.get(csessid, [])\n if dataentries:\n return dataentries.pop(0)\n request.notifyFinish().addErrback(self._responseFailed, csessid, request)\n if csessid in self.requests:\n self.requests[csessid].finish() # Clear any stale request.\n self.requests[csessid] = request\n return server.NOT_DONE_YET","target":" def mode_receive(self, request):\n \"\"\"\n This is called by render_POST when the client is telling us\n that it is ready to receive data as soon as it is available.\n This is the basis of a long-polling (comet) mechanism: the\n server will wait to reply until data is available.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = cgi.escape(request.args['csessid'][0])\n self.last_alive[csessid] = (time.time(), False)\n\n dataentries = self.databuffer.get(csessid, [])\n if dataentries:\n return dataentries.pop(0)\n request.notifyFinish().addErrback(self._responseFailed, csessid, request)\n if csessid in self.requests:\n self.requests[csessid].finish() # Clear any stale request.\n self.requests[csessid] = request\n return server.NOT_DONE_YET","lang":"python","vul_type":"cwe-079","target_token_count":203,"sven_meta":{"func_name":"mode_receive","file_name":"evennia/server/portal/webclient_ajax.py","commit_link":"github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#33-b447d5f760eb","input":" def mode_input(self, request):\n \"\"\"\n This is called by render_POST when the client\n is sending data to the server.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = request.args.get('csessid')[0]\n\n self.last_alive[csessid] = (time.time(), False)\n sess = self.sessionhandler.sessions_from_csessid(csessid)\n if sess:\n sess = sess[0]\n cmdarray = json.loads(request.args.get('data')[0])\n sess.sessionhandler.data_in(sess, **{cmdarray[0]: [cmdarray[1], cmdarray[2]]})\n return '\"\"'","target":" def mode_input(self, request):\n \"\"\"\n This is called by render_POST when the client\n is sending data to the server.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = cgi.escape(request.args['csessid'][0])\n self.last_alive[csessid] = (time.time(), False)\n sess = self.sessionhandler.sessions_from_csessid(csessid)\n if sess:\n sess = sess[0]\n cmdarray = json.loads(cgi.escape(request.args.get('data')[0]))\n sess.sessionhandler.data_in(sess, **{cmdarray[0]: [cmdarray[1], cmdarray[2]]})\n return '\"\"'","lang":"python","vul_type":"cwe-079","target_token_count":149,"sven_meta":{"func_name":"mode_input","file_name":"evennia/server/portal/webclient_ajax.py","commit_link":"github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-190#10-d2e220664989","input":"void AllocateDataSet(cmsIT8* it8)\n{\n TABLE* t = GetTable(it8);\n\n if (t -> Data) return; // Already allocated\n\n t-> nSamples = atoi(cmsIT8GetProperty(it8, \"NUMBER_OF_FIELDS\"));\n t-> nPatches = atoi(cmsIT8GetProperty(it8, \"NUMBER_OF_SETS\"));\n\n t-> Data = (char**)AllocChunk (it8, ((cmsUInt32Number) t->nSamples + 1) * ((cmsUInt32Number) t->nPatches + 1) *sizeof (char*));\n if (t->Data == NULL) {\n\n SynError(it8, \"AllocateDataSet: Unable to allocate data array\");\n }\n\n}","target":"void AllocateDataSet(cmsIT8* it8)\n{\n TABLE* t = GetTable(it8);\n\n if (t -> Data) return; // Already allocated\n\n t-> nSamples = atoi(cmsIT8GetProperty(it8, \"NUMBER_OF_FIELDS\"));\n t-> nPatches = atoi(cmsIT8GetProperty(it8, \"NUMBER_OF_SETS\"));\n\n if (t -> nSamples < 0 || t->nSamples > 0x7ffe || t->nPatches < 0 || t->nPatches > 0x7ffe)\n {\n SynError(it8, \"AllocateDataSet: too much data\");\n }\n else {\n t->Data = (char**)AllocChunk(it8, ((cmsUInt32Number)t->nSamples + 1) * ((cmsUInt32Number)t->nPatches + 1) * sizeof(char*));\n if (t->Data == NULL) {\n\n SynError(it8, \"AllocateDataSet: Unable to allocate data array\");\n }\n }\n\n}","lang":"c","vul_type":"cwe-190","target_token_count":220,"sven_meta":{"func_name":"AllocateDataSet","file_name":"src/cmscgats.c","commit_link":"github.com/mm2/Little-CMS/commit/768f70ca405cd3159d990e962d54456773bb8cf8","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#12-370d7a5620d1","input":"static MagickOffsetType TIFFSeekCustomStream(const MagickOffsetType offset,\n const int whence,void *user_data)\n{\n PhotoshopProfile\n *profile;\n\n profile=(PhotoshopProfile *) user_data;\n switch (whence)\n {\n case SEEK_SET:\n default:\n {\n if (offset < 0)\n return(-1);\n profile->offset=offset;\n break;\n }\n case SEEK_CUR:\n {\n if ((profile->offset+offset) < 0)\n return(-1);\n profile->offset+=offset;\n break;\n }\n case SEEK_END:\n {\n if (((MagickOffsetType) profile->length+offset) < 0)\n return(-1);\n profile->offset=profile->length+offset;\n break;\n }\n }\n\n return(profile->offset);\n}","target":"static MagickOffsetType TIFFSeekCustomStream(const MagickOffsetType offset,\n const int whence,void *user_data)\n{\n PhotoshopProfile\n *profile;\n\n profile=(PhotoshopProfile *) user_data;\n switch (whence)\n {\n case SEEK_SET:\n default:\n {\n if (offset < 0)\n return(-1);\n profile->offset=offset;\n break;\n }\n case SEEK_CUR:\n {\n if (((offset > 0) && (profile->offset > (SSIZE_MAX-offset))) ||\n ((offset < 0) && (profile->offset < (-SSIZE_MAX-offset))))\n {\n errno=EOVERFLOW;\n return(-1);\n }\n if ((profile->offset+offset) < 0)\n return(-1);\n profile->offset+=offset;\n break;\n }\n case SEEK_END:\n {\n if (((MagickOffsetType) profile->length+offset) < 0)\n return(-1);\n profile->offset=profile->length+offset;\n break;\n }\n }\n\n return(profile->offset);\n}","lang":"c","vul_type":"cwe-190","target_token_count":230,"sven_meta":{"func_name":"TIFFSeekCustomStream","file_name":"coders/tiff.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/fe5f4b85e6b1b54d3b4588a77133c06ade46d891","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#13-581d72a38720","input":"int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,\n\t\t\t\tvoid __user *buffer, size_t *lenp,\n\t\t\t\tloff_t *ppos)\n{\n\tint ret = proc_dointvec(table, write, buffer, lenp, ppos);\n\n\tif (ret || !write)\n\t\treturn ret;\n\n\tif (sysctl_perf_cpu_time_max_percent == 100 ||\n\t sysctl_perf_cpu_time_max_percent == 0) {\n\t\tprintk(KERN_WARNING\n\t\t \"perf: Dynamic interrupt throttling disabled, can hang your system!\\n\");\n\t\tWRITE_ONCE(perf_sample_allowed_ns, 0);\n\t} else {\n\t\tupdate_perf_cpu_limits();\n\t}\n\n\treturn 0;\n}","target":"int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,\n\t\t\t\tvoid __user *buffer, size_t *lenp,\n\t\t\t\tloff_t *ppos)\n{\n\tint ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);\n\n\tif (ret || !write)\n\t\treturn ret;\n\n\tif (sysctl_perf_cpu_time_max_percent == 100 ||\n\t sysctl_perf_cpu_time_max_percent == 0) {\n\t\tprintk(KERN_WARNING\n\t\t \"perf: Dynamic interrupt throttling disabled, can hang your system!\\n\");\n\t\tWRITE_ONCE(perf_sample_allowed_ns, 0);\n\t} else {\n\t\tupdate_perf_cpu_limits();\n\t}\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-190","target_token_count":150,"sven_meta":{"func_name":"perf_cpu_time_max_percent_handler","file_name":"kernel/events/core.c","commit_link":"github.com/torvalds/linux/commit/1572e45a924f254d9570093abde46430c3172e3d","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#18-327f7d85d3c2","input":"ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)\n{\n\tGC_REFCOUNT(ht) = 1;\n\tGC_TYPE_INFO(ht) = IS_ARRAY;\n\tht->u.flags = (persistent ? HASH_FLAG_PERSISTENT : 0) | HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_STATIC_KEYS;\n\tht->nTableSize = zend_hash_check_size(nSize);\n\tht->nTableMask = HT_MIN_MASK;\n\tHT_SET_DATA_ADDR(ht, &uninitialized_bucket);\n\tht->nNumUsed = 0;\n\tht->nNumOfElements = 0;\n\tht->nInternalPointer = HT_INVALID_IDX;\n\tht->nNextFreeElement = 0;\n\tht->pDestructor = pDestructor;\n}","target":"ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)\n{\n\tGC_REFCOUNT(ht) = 1;\n\tGC_TYPE_INFO(ht) = IS_ARRAY;\n\tht->u.flags = (persistent ? HASH_FLAG_PERSISTENT : 0) | HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_STATIC_KEYS;\n\tht->nTableMask = HT_MIN_MASK;\n\tHT_SET_DATA_ADDR(ht, &uninitialized_bucket);\n\tht->nNumUsed = 0;\n\tht->nNumOfElements = 0;\n\tht->nInternalPointer = HT_INVALID_IDX;\n\tht->nNextFreeElement = 0;\n\tht->pDestructor = pDestructor;\n\tht->nTableSize = zend_hash_check_size(nSize);\n}","lang":"c","vul_type":"cwe-190","target_token_count":181,"sven_meta":{"func_name":"_zend_hash_init","file_name":"Zend/zend_hash.c","commit_link":"github.com/php/php-src/commit/4cc0286f2f3780abc6084bcdae5dce595daa3c12","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#22-4a88cdf99c78","input":"static int __get_data_block(struct inode *inode, sector_t iblock,\n\t\t\tstruct buffer_head *bh, int create, int flag,\n\t\t\tpgoff_t *next_pgofs)\n{\n\tstruct f2fs_map_blocks map;\n\tint err;\n\n\tmap.m_lblk = iblock;\n\tmap.m_len = bh->b_size >> inode->i_blkbits;\n\tmap.m_next_pgofs = next_pgofs;\n\n\terr = f2fs_map_blocks(inode, &map, create, flag);\n\tif (!err) {\n\t\tmap_bh(bh, inode->i_sb, map.m_pblk);\n\t\tbh->b_state = (bh->b_state & ~F2FS_MAP_FLAGS) | map.m_flags;\n\t\tbh->b_size = map.m_len << inode->i_blkbits;\n\t}\n\treturn err;\n}","target":"static int __get_data_block(struct inode *inode, sector_t iblock,\n\t\t\tstruct buffer_head *bh, int create, int flag,\n\t\t\tpgoff_t *next_pgofs)\n{\n\tstruct f2fs_map_blocks map;\n\tint err;\n\n\tmap.m_lblk = iblock;\n\tmap.m_len = bh->b_size >> inode->i_blkbits;\n\tmap.m_next_pgofs = next_pgofs;\n\n\terr = f2fs_map_blocks(inode, &map, create, flag);\n\tif (!err) {\n\t\tmap_bh(bh, inode->i_sb, map.m_pblk);\n\t\tbh->b_state = (bh->b_state & ~F2FS_MAP_FLAGS) | map.m_flags;\n\t\tbh->b_size = (u64)map.m_len << inode->i_blkbits;\n\t}\n\treturn err;\n}","lang":"c","vul_type":"cwe-190","target_token_count":174,"sven_meta":{"func_name":"__get_data_block","file_name":"fs/f2fs/data.c","commit_link":"github.com/torvalds/linux/commit/b86e33075ed1909d8002745b56ecf73b833db143","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#24-3e1eba9443b2","input":"PHPAPI PHP_FUNCTION(fread)\n{\n\tzval *arg1;\n\tlong len;\n\tphp_stream *stream;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rl\", &arg1, &len) == FAILURE) {\n\t\tRETURN_FALSE;\n\t}\n\n\tPHP_STREAM_TO_ZVAL(stream, &arg1);\n\n\tif (len <= 0) {\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Length parameter must be greater than 0\");\n\t\tRETURN_FALSE;\n\t}\n\n\tZ_STRVAL_P(return_value) = emalloc(len + 1);\n\tZ_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);\n\n\t/* needed because recv/read/gzread doesnt put a null at the end*/\n\tZ_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;\n\tZ_TYPE_P(return_value) = IS_STRING;\n}","target":"PHPAPI PHP_FUNCTION(fread)\n{\n\tzval *arg1;\n\tlong len;\n\tphp_stream *stream;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rl\", &arg1, &len) == FAILURE) {\n\t\tRETURN_FALSE;\n\t}\n\n\tPHP_STREAM_TO_ZVAL(stream, &arg1);\n\n\tif (len <= 0) {\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Length parameter must be greater than 0\");\n\t\tRETURN_FALSE;\n\t}\n\n\tif (len > INT_MAX) {\n\t\t/* string length is int in 5.x so we can not read more than int */\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Length parameter must be no more than %d\", INT_MAX);\n\t\tRETURN_FALSE;\n\t}\n\n\tZ_STRVAL_P(return_value) = emalloc(len + 1);\n\tZ_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);\n\n\t/* needed because recv/read/gzread doesnt put a null at the end*/\n\tZ_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;\n\tZ_TYPE_P(return_value) = IS_STRING;\n}","lang":"c","vul_type":"cwe-190","target_token_count":249,"sven_meta":{"func_name":"PHP_FUNCTION","file_name":"ext/standard/file.c","commit_link":"github.com/php/php-src/commit/abd159cce48f3e34f08e4751c568e09677d5ec9c","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#27-83253717d88f","input":"void * CAPSTONE_API cs_winkernel_malloc(size_t size)\n{\n\t// Disallow zero length allocation because they waste pool header space and,\n\t// in many cases, indicate a potential validation issue in the calling code.\n\tNT_ASSERT(size);\n\n\t// FP; a use of NonPagedPool is required for Windows 7 support\n#pragma prefast(suppress : 30030)\t\t// Allocating executable POOL_TYPE memory\n\tCS_WINKERNEL_MEMBLOCK *block = (CS_WINKERNEL_MEMBLOCK *)ExAllocatePoolWithTag(\n\t\t\tNonPagedPool, size + sizeof(CS_WINKERNEL_MEMBLOCK), CS_WINKERNEL_POOL_TAG);\n\tif (!block) {\n\t\treturn NULL;\n\t}\n\tblock->size = size;\n\n\treturn block->data;\n}","target":"void * CAPSTONE_API cs_winkernel_malloc(size_t size)\n{\n\t// Disallow zero length allocation because they waste pool header space and,\n\t// in many cases, indicate a potential validation issue in the calling code.\n\tNT_ASSERT(size);\n\n\t// FP; a use of NonPagedPool is required for Windows 7 support\n#pragma prefast(suppress : 30030)\t\t// Allocating executable POOL_TYPE memory\n\tsize_t number_of_bytes = 0;\n\tCS_WINKERNEL_MEMBLOCK *block = NULL;\n\t// A specially crafted size value can trigger the overflow.\n\t// If the sum in a value that overflows or underflows the capacity of the type,\n\t// the function returns NULL.\n\tif (!NT_SUCCESS(RtlSizeTAdd(size, sizeof(CS_WINKERNEL_MEMBLOCK), &number_of_bytes))) {\n\t\treturn NULL;\n\t}\n\tblock = (CS_WINKERNEL_MEMBLOCK *)ExAllocatePoolWithTag(\n\t\t\tNonPagedPool, number_of_bytes, CS_WINKERNEL_POOL_TAG);\n\tif (!block) {\n\t\treturn NULL;\n\t}\n\tblock->size = size;\n\n\treturn block->data;\n}","lang":"c","vul_type":"cwe-190","target_token_count":243,"sven_meta":{"func_name":"cs_winkernel_malloc","file_name":"windows/winkernel_mm.c","commit_link":"github.com/aquynh/capstone/commit/6fe86eef621b9849f51a5e1e5d73258a93440403","source_cwe_file":"cwe-190.jsonl"}} diff --git a/sven_rl_buckets/train/1_128.jsonl b/sven_rl_buckets/train/1_128.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..0b1bdf587892df66b6a89631e2b12a9520b9297c --- /dev/null +++ b/sven_rl_buckets/train/1_128.jsonl @@ -0,0 +1,196 @@ +{"problem_id":"cwe-089#2-bf3adb08a70e","input":" def tag_num_to_tag(self, tag_num):\n ''' Returns tag given tag_num. '''\n\n q = \"SELECT tag FROM tags WHERE rowid = '\" + str(tag_num) + \"'\"\n self.query(q)\n return self.c.fetchone()[0]","target":" def tag_num_to_tag(self, tag_num):\n ''' Returns tag given tag_num. '''\n\n q = \"SELECT tag FROM tags WHERE rowid = ?\"\n self.query(q, tag_num)\n return self.c.fetchone()[0]","lang":"python","vul_type":"cwe-089","target_token_count":50,"sven_meta":{"func_name":"tag_num_to_tag","file_name":"modules/query_lastfm.py","commit_link":"github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#4-dd9b47234757","input":" def getPostsByPostid(self,postid):\n sqlText=\"select users.name,post.comment from users,post where \\\n users.userid=post.userid and post.postid=%d\"%(postid)\n result=sql.queryDB(self.conn,sqlText)\n return result;","target":" def getPostsByPostid(self,postid):\n sqlText=\"select users.name,post.comment from users,post where \\\n users.userid=post.userid and post.postid=%s\"\n params=[postid]\n result=sql.queryDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","target_token_count":63,"sven_meta":{"func_name":"getPostsByPostid","file_name":"modules/post.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#5-8a3b06cb12b7","input":"\tdef getFileCacheID(self, pth):\n\t\t\"\"\"\n\t\tReturns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.\n\t\t:param pth:\n\t\t:return:\n\t\t\"\"\"\n\t\tcommand = \"SELECT file_id FROM {0} WHERE path='{1}'\".format(TABLE_NAME, pth)\n\t\tdata = self._run_command(command)\n\n\t\ttry:\n\t\t\tdata = data[0][0]\n\t\texcept IndexError:\n\t\t\tdata = None\n\n\t\treturn data","target":"\tdef getFileCacheID(self, pth):\n\t\t\"\"\"\n\t\tReturns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.\n\t\t:param pth:\n\t\t:return:\n\t\t\"\"\"\n\t\tcommand = \"SELECT file_id FROM {0} WHERE path=?;\".format(TABLE_NAME)\n\t\tparams = (pth,)\n\t\tdata = self._run_command(command, params)\n\n\t\ttry:\n\t\t\tdata = data[0][0]\n\t\texcept IndexError:\n\t\t\tdata = None\n\n\t\treturn data","lang":"python","vul_type":"cwe-089","target_token_count":110,"sven_meta":{"func_name":"getFileCacheID","file_name":"file_db.py","commit_link":"github.com/Highstaker/Picture-sender-telegram-bot/commit/db4bc6adb41e086418761426ff4958a81c30adca","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#6-bd4ef60952d1","input":"def add_post(content):\n \"\"\"Add a post to the 'database' with the current timestamp.\"\"\"\n db = psycopg2.connect(database=DBNAME)\n c = db.cursor()\n c.execute(\"insert into posts values('%s')\" % content)\n db.commit()\n db.close()","target":"def add_post(content):\n \"\"\"Add a post to the 'database' with the current timestamp.\"\"\"\n db = psycopg2.connect(database=DBNAME)\n c = db.cursor()\n c.execute(\"insert into posts values(%s)\",(content,))\n db.commit()\n db.close()","lang":"python","vul_type":"cwe-089","target_token_count":58,"sven_meta":{"func_name":"add_post","file_name":"vagrant/forum/forumdb.py","commit_link":"github.com/tfalbo/SuzyMakeup/commit/1a5d6ccf02bec303d454f87a6bb39baed30c205f","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#7-2d74566801df","input":"def getSubmissionDateFromDatabase(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = '\" + str(submission.id) + \"'\").fetchone()[0]\n database.close()","target":"def getSubmissionDateFromDatabase(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = ?\", [str(submission.id)]).fetchone()[0]\n database.close()","lang":"python","vul_type":"cwe-089","target_token_count":57,"sven_meta":{"func_name":"getSubmissionDateFromDatabase","file_name":"CheckAndPostForSeriesSubmissions.py","commit_link":"github.com/LiquidFun/Reddit-GeoGuessr-Tracking-Bot/commit/0cad2d52e24b05da32789fbc8face7a9999a71f9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#10-382d839e2a90","input":" def tid_num_to_tag_nums(self, tid_num):\n ''' Returns list of the associated tag_nums to the given tid_num. '''\n\n q = \"SELECT tag FROM tid_tag WHERE tid = '\" + str(tid_num) + \"'\"\n self.query(q)\n return [i[0] for i in self.c.fetchall()]","target":" def tid_num_to_tag_nums(self, tid_num):\n ''' Returns list of the associated tag_nums to the given tid_num. '''\n\n q = \"SELECT tag FROM tid_tag WHERE tid = ?\"\n self.query(q, tid_num)\n return [i[0] for i in self.c.fetchall()]","lang":"python","vul_type":"cwe-089","target_token_count":64,"sven_meta":{"func_name":"tid_num_to_tag_nums","file_name":"modules/query_lastfm.py","commit_link":"github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#11-7d944f03d5a9","input":"@app.route('/summary', methods=['GET'])\ndef summary():\n\tif 'username' in session:\n\n\t\tconn = mysql.connect()\n\t\tcursor = conn.cursor()\n\n\t\t#select the maximum score from the results table\n\t\tcursor.execute(\"SELECT courseConcentration FROM results WHERE total = (SELECT MAX(total) FROM (SELECT * FROM results WHERE courseId > 4) Temp) and courseId > 4 and emailAccount='\" + session['username'] + \"'\");\n\t\tcourseConcentration = cursor.fetchone()\n\n\t\treturn render_template('summary.html', courseConcentration = courseConcentration[0])\n\treturn redirect(url_for('login'))","target":"@app.route('/summary', methods=['GET'])\ndef summary():\n\tif 'username' in session:\n\n\t\tconn = mysql.connect()\n\t\tcursor = conn.cursor()\n\n\t\t#select the maximum score from the results table\n\t\tcursor.execute(\"SELECT courseConcentration FROM results WHERE total = (SELECT MAX(total) FROM (SELECT * FROM results WHERE courseId > 4) Temp) and courseId > 4 and emailAccount=%s\", (session['username']));\n\t\tcourseConcentration = cursor.fetchone()\n\n\t\treturn render_template('summary.html', courseConcentration = courseConcentration[0])\n\treturn redirect(url_for('login'))","lang":"python","vul_type":"cwe-089","target_token_count":125,"sven_meta":{"func_name":"summary","file_name":"src/tech_track.py","commit_link":"github.com/CaitlinKennedy/Tech-Track/commit/20ef2d4010f9497b8221524edd0c706e2c6a4147","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#12-20344b74d979","input":"def add_post(content):\n \"\"\"Add a post to the 'database' with the current timestamp.\"\"\"\n conn = psycopg2.connect(\"dbname=forum\")\n cursor = conn.cursor()\n cursor.execute(\"insert into posts values ('%s')\" % content)\n conn.commit()\n conn.close()","target":"def add_post(content):\n \"\"\"Add a post to the 'database' with the current timestamp.\"\"\"\n conn = psycopg2.connect(\"dbname=forum\")\n cursor = conn.cursor()\n one_post = content\n cursor.execute(\"insert into posts values (%s)\", (one_post,))\n conn.commit()\n conn.close()","lang":"python","vul_type":"cwe-089","target_token_count":66,"sven_meta":{"func_name":"add_post","file_name":"forumdb.py","commit_link":"github.com/paulc1600/DB-API-Forum/commit/069700fb4beec79182fff3c556e9cccce3230d6f","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#13-43256aa0c7d5","input":"def delete_playlist(id, db):\n db.execute(\"DELETE FROM playlist where id={id};\".format(id=id))","target":"def delete_playlist(id, db):\n db.execute(\"DELETE FROM playlist where id=%s;\", (id,))","lang":"python","vul_type":"cwe-089","target_token_count":23,"sven_meta":{"func_name":"delete_playlist","file_name":"playlist/playlist_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#14-a8b633af74d5","input":" def writeToDb(self, url):\n try:\n self.cursor.execute(\"INSERT INTO queue (url, visited) VALUES ('{}', '0');\".format(url))\n self.db.commit()\n except Exception as e:\n print(e)","target":" def writeToDb(self, url):\n try:\n self.cursor.execute(\"INSERT INTO queue (url, visited) VALUES (?, '0');\", url)\n self.db.commit()\n except Exception as e:\n print(e)","lang":"python","vul_type":"cwe-089","target_token_count":47,"sven_meta":{"func_name":"writeToDb","file_name":"beta/database.py","commit_link":"github.com/jappe999/WebScraper/commit/46a4e0843aa44d903293637afad53dfcbc37b480","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#16-352a199e5538","input":" @jwt_required\n def delete(self, email):\n \"\"\" Deletes admin with the corresponding email \"\"\"\n return database_utilities.execute_query(f\"\"\"delete from admins where email = '{email}'\"\"\")","target":" @jwt_required\n def delete(self, email):\n \"\"\" Deletes admin with the corresponding email \"\"\"\n return database_utilities.execute_query(f\"\"\"delete from admins where email = %s\"\"\", (email, ))","lang":"python","vul_type":"cwe-089","target_token_count":43,"sven_meta":{"func_name":"delete","file_name":"apis/admins.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#17-8a229c971b24","input":"def delete_playlists_videos(playlist_id, db):\n db.execute(\"DELETE FROM video where playlist_id={playlist_id};\".format(\n playlist_id=playlist_id))","target":"def delete_playlists_videos(playlist_id, db):\n db.execute(\"DELETE FROM video where playlist_id=%s;\", (playlist_id,))","lang":"python","vul_type":"cwe-089","target_token_count":29,"sven_meta":{"func_name":"delete_playlists_videos","file_name":"video/video_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#19-bfbb381c2ad4","input":"def get_first_ranked_month(db, scene, player):\n sql = \"select date from ranks where scene='{}' and player='{}' order by date limit 1;\".format(scene, player)\n res = db.exec(sql)\n date = res[0][0]\n return date","target":"def get_first_ranked_month(db, scene, player):\n sql = \"select date from ranks where scene='{scene}' and player='{player}' order by date limit 1;\"\n args = {'scene': scene, 'player': player}\n res = db.exec(sql, args)\n date = res[0][0]\n return date","lang":"python","vul_type":"cwe-089","target_token_count":71,"sven_meta":{"func_name":"get_first_ranked_month","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#20-3f7708bf024c","input":"@hook.command(adminonly=True)\ndef openPoll(question, reply=None, db=None):\n \"\"\"Creates a new poll.\"\"\"\n if not db_ready: db_init(db)\n try:\n active = db.execute(\"SELECT pollID FROM polls WHERE active = 1\").fetchone()[0]\n if active: \n reply(\"There already is an open poll.\")\n return\n except:\n db.execute(\"INSERT INTO polls (question, active) VALUES ('{}', 1)\".format(question))\n reply(\"Opened new poll: {}\".format(question))\n #reply(\"Poll opened!\")\n return","target":"@hook.command(adminonly=True)\ndef openPoll(question, reply=None, db=None):\n \"\"\"Creates a new poll.\"\"\"\n if not db_ready: db_init(db)\n try:\n active = db.execute(\"SELECT pollID FROM polls WHERE active = 1\").fetchone()[0]\n if active: \n reply(\"There already is an open poll.\")\n return\n except:\n db.execute(\"INSERT INTO polls (question, active) VALUES (?, 1)\", (question,))\n reply(\"Opened new poll: {}\".format(question))\n #reply(\"Poll opened!\")\n return","lang":"python","vul_type":"cwe-089","target_token_count":121,"sven_meta":{"func_name":"openPoll","file_name":"plugins/poll.py","commit_link":"github.com/FrozenPigs/Taigabot/commit/ea9b83a66ae1f0f38a1895f3e8dfa2833d77e3a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#22-30cbac8f5530","input":"@app.route('//history/record')\ndef view_page_record(page_name):\n content_id = request.args.get('id')\n query = db.query(\"select page_content.content, page_content.timestamp from page, page_content where page.id = page_content.page_id and page_content.id = '%s'\" % content_id)\n page_record = query.namedresult()[0]\n\n return render_template(\n 'page_record.html',\n page_name = page_name,\n page_record = page_record\n )","target":"@app.route('//history/record')\ndef view_page_record(page_name):\n content_id = request.args.get('id')\n query = db.query(\"select page_content.content, page_content.timestamp from page, page_content where page.id = page_content.page_id and page_content.id = $1\", content_id)\n page_record = query.namedresult()[0]\n\n return render_template(\n 'page_record.html',\n page_name = page_name,\n page_record = page_record\n )","lang":"python","vul_type":"cwe-089","target_token_count":103,"sven_meta":{"func_name":"view_page_record","file_name":"server.py","commit_link":"github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#23-9d36ff5295e1","input":" def update_inverter(self, inverter_serial, ts, status, etoday, etotal):\n query = '''\n UPDATE Inverters\n SET \n TimeStamp='%s', \n Status='%s', \n eToday='%s',\n eTotal='%s'\n WHERE Serial='%s';\n ''' % (ts, status, etoday, etotal, inverter_serial)\n self.c.execute(query)","target":" def update_inverter(self, inverter_serial, ts, status, etoday, etotal):\n query = '''\n UPDATE Inverters\n SET \n TimeStamp=?, \n Status=?, \n eToday=?,\n eTotal=?\n WHERE Serial=?;\n '''\n self.c.execute(query, (ts, status, etoday, etotal, inverter_serial))","lang":"python","vul_type":"cwe-089","target_token_count":81,"sven_meta":{"func_name":"update_inverter","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#24-71acb5a8ca96","input":"def insert(key, value):\n connection = psycopg2.connect(host=config['HOST'], port=config['PORT'], database=config['NAME'], user=config['USER'], password=config['PASSWORD'])\n cur = connection.cursor()\n try:\n cur.execute(\"insert into reply_map values('{}', '{}')\".format(key, value))\n connection.commit()\n except:\n pass","target":"def insert(key, value):\n connection = psycopg2.connect(host=config['HOST'], port=config['PORT'], database=config['NAME'], user=config['USER'], password=config['PASSWORD'])\n cur = connection.cursor()\n try:\n cur.execute(\"insert into reply_map values(?, ?)\", (key, value))\n connection.commit()\n except:\n pass","lang":"python","vul_type":"cwe-089","target_token_count":73,"sven_meta":{"func_name":"insert","file_name":"db.py","commit_link":"github.com/tadaren/reply_bot/commit/5aeafa7e9597a766992af9ff8189e1f050b6579b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#25-918235b7b09f","input":" def save_failure_transaction(self, user_id, project_id, money):\n self.cursor.execute(\"insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, %s, now(), 'failed' )\" % (project_id, user_id, money))\n self.db.commit()","target":" def save_failure_transaction(self, user_id, project_id, money):\n self.cursor.execute(\"insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, \"\n \"%s, now(), 'failed' )\", (project_id, user_id, money))\n self.db.commit()","lang":"python","vul_type":"cwe-089","target_token_count":68,"sven_meta":{"func_name":"save_failure_transaction","file_name":"backend/transactions/TransactionConnector.py","commit_link":"github.com/JLucka/kickstarter-dev/commit/e2ffa062697e060fdfbd2eccbb89a8c53a569e0b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#28-8b7246efe51a","input":" def tid_to_tid_num(self, tid):\n ''' Returns tid_num, given tid. '''\n\n q = \"SELECT rowid FROM tids WHERE tid = '\" + tid + \"'\"\n self.query(q)\n return self.c.fetchone()[0]","target":" def tid_to_tid_num(self, tid):\n ''' Returns tid_num, given tid. '''\n\n q = \"SELECT rowid FROM tids WHERE tid = ?\"\n self.query(q, tid)\n return self.c.fetchone()[0]","lang":"python","vul_type":"cwe-089","target_token_count":50,"sven_meta":{"func_name":"tid_to_tid_num","file_name":"modules/query_lastfm.py","commit_link":"github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#29-c3bd562d4f46","input":"def get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution):\n \"\"\"\n Get all the old sourcebyinstitution number from the SQLite database.\n \"\"\"\n query = \"\"\"\n SELECT\n titles\n FROM\n history\n WHERE\n sourcebyinstitution = \"%s\"\n ORDER BY\n titles DESC\n LIMIT 1\n \"\"\" % sourcebyinstitution\n\n sqlite.execute(query)\n for record in sqlite:\n old_sourcebyinstitution_number = record[0]\n return old_sourcebyinstitution_number","target":"def get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution):\n \"\"\"\n Get all the old sourcebyinstitution number from the SQLite database.\n \"\"\"\n query = \"\"\"\n SELECT\n titles\n FROM\n history\n WHERE\n sourcebyinstitution = ?\n ORDER BY\n titles DESC\n LIMIT 1\n \"\"\"\n\n sqlite.execute(query, (sourcebyinstitution,))\n for record in sqlite:\n old_sourcebyinstitution_number = record[0]\n return old_sourcebyinstitution_number","lang":"python","vul_type":"cwe-089","target_token_count":107,"sven_meta":{"func_name":"get_old_sourcebyinstitution_number","file_name":"bin/solrcheckup.py","commit_link":"github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#30-c6c7452a048b","input":"def top_karma(bot, trigger):\n \"\"\"\n Show karma status for the top n number of IRC users.\n \"\"\"\n try:\n top_limit = int(trigger.group(2).strip())\n except ValueError:\n top_limit = 5\n\n query = \"SELECT slug, value FROM nick_values NATURAL JOIN nicknames \\\n WHERE key = 'karma' ORDER BY value DESC LIMIT %d\"\n karmalist = bot.db.execute(query % top_limit).fetchall()\n for user in karmalist:\n bot.say(\"%s == %s\" % (user[0], user[1]))","target":"def top_karma(bot, trigger):\n \"\"\"\n Show karma status for the top n number of IRC users.\n \"\"\"\n try:\n top_limit = int(trigger.group(2).strip())\n except ValueError:\n top_limit = 5\n\n query = \"SELECT slug, value FROM nick_values NATURAL JOIN nicknames \\\n WHERE key = 'karma' ORDER BY value DESC LIMIT ?\"\n karmalist = bot.db.execute(query, str(top_limit)).fetchall()\n for user in karmalist:\n bot.say(\"%s == %s\" % (user[0], user[1]))","lang":"python","vul_type":"cwe-089","target_token_count":127,"sven_meta":{"func_name":"top_karma","file_name":"sopel_modules/karma/karma.py","commit_link":"github.com/OpCode1300/sopel-karma/commit/e4d49f7b3d88f8874c7862392f3f4c2065a25695","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#31-bc6bbc952e37","input":"def retrieve_playlist_by_id(id, db):\n db.execute(\n \"SELECT id, name, video_position from playlist WHERE id={id};\".format(id=id))\n row = db.fetchone()\n return row","target":"def retrieve_playlist_by_id(id, db):\n db.execute(\n \"SELECT id, name, video_position from playlist WHERE id=%s;\", (id,))\n row = db.fetchone()\n return row","lang":"python","vul_type":"cwe-089","target_token_count":41,"sven_meta":{"func_name":"retrieve_playlist_by_id","file_name":"playlist/playlist_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#34-e03b891fa46b","input":" @jwt_required\n def delete(self, user_id):\n \"\"\" Deletes user with the corresponding user_id \"\"\"\n return database_utilities.execute_query(f\"\"\"delete from users where user_id = '{user_id}'\"\"\")","target":" @jwt_required\n def delete(self, user_id):\n \"\"\" Deletes user with the corresponding user_id \"\"\"\n return database_utilities.execute_query(f\"\"\"delete from users where user_id = %s\"\"\", (user_id, ))","lang":"python","vul_type":"cwe-089","target_token_count":47,"sven_meta":{"func_name":"delete","file_name":"apis/users.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#35-77207dc1cf69","input":" def verify_rno(self, rno):\n query = \"SELECT COUNT(rno) FROM rides WHERE rno = {rno}\".format(rno = rno)\n self.cursor.execute(query)\n result = self.cursor.fetchone()\n if (int(result[0]) > 0):\n return True \n else:\n return False","target":" def verify_rno(self, rno):\n self.cursor.execute(\"SELECT COUNT(rno) FROM rides WHERE rno = :rno\", {'rno': rno})\n result = self.cursor.fetchone()\n if (int(result[0]) > 0):\n return True \n else:\n return False","lang":"python","vul_type":"cwe-089","target_token_count":66,"sven_meta":{"func_name":"verify_rno","file_name":"book_rides/book_rides.py","commit_link":"github.com/kenboo98/291-Mini-Project-I/commit/3080ccb687c79c83954ce703faee8fcceec8c9eb","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#37-57f0cdccbac8","input":"def add_language(lang):\n try:\n cur.execute(f\"INSERT INTO language (name) VALUES ('{lang}')\")\n except Exception as e:\n pass\n cur.execute(f\"SELECT language_id FROM language where name='{lang}'\")\n lang_id = cur.fetchone()[0]\n if conn.commit():\n return lang_id\n return lang_id","target":"def add_language(lang):\n try:\n cur.execute(\"INSERT INTO language (name) VALUES (%s)\", (lang, ))\n except Exception as e:\n pass\n cur.execute(\"SELECT language_id FROM language where name=%s\", (lang, ))\n lang_id = cur.fetchone()[0]\n if conn.commit():\n return lang_id\n return lang_id","lang":"python","vul_type":"cwe-089","target_token_count":76,"sven_meta":{"func_name":"add_language","file_name":"app.py","commit_link":"github.com/Elbertbiggs360/dvdrental/commit/ad144ae2a08a332498d0831bc255170d57ba754b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#38-4e141ada1ca1","input":"def makeJudge(judge):\n\tdb.execute(\"UPDATE players SET Judge = 1 WHERE Name = '%s' COLLATE NOCASE\" % (judge)) \n\tdatabase.commit()","target":"def makeJudge(judge):\n\tdb.execute(\"UPDATE players SET Judge = 1 WHERE Name = ? COLLATE NOCASE\", judge) \n\tdatabase.commit()","lang":"python","vul_type":"cwe-089","target_token_count":32,"sven_meta":{"func_name":"makeJudge","file_name":"plugins/database.py","commit_link":"github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#39-50ee2962ef57","input":"def isValidAdmToken(adm_token):\n conn, c = connectDB()\n req = \"SELECT * from {} where adm_token='{}'\".format(CFG(\"admintoken_table_name\"), adm_token)\n answer = bool(queryOne(c, req))\n closeDB(conn)\n return answer","target":"def isValidAdmToken(adm_token):\n conn, c = connectDB()\n req = \"SELECT * from {} where adm_token=?\".format(CFG(\"admintoken_table_name\"))\n answer = bool(queryOne(c, req, (adm_token,)))\n closeDB(conn)\n return answer","lang":"python","vul_type":"cwe-089","target_token_count":64,"sven_meta":{"func_name":"isValidAdmToken","file_name":"database.py","commit_link":"github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#41-e3f18712cf87","input":" def delete_data(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, str(id))\n query = \"DELETE FROM %s WHERE identifier = '%s';\" % (self.table, sid)\n self._query(query)\n return None","target":" def delete_data(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, str(id))\n query = \"DELETE FROM %s WHERE identifier = $1;\" % (self.table)\n self._query(query, sid)\n return None","lang":"python","vul_type":"cwe-089","target_token_count":78,"sven_meta":{"func_name":"delete_data","file_name":"cheshire3/sql/postgresStore.py","commit_link":"github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#42-8a74bbc6cd76","input":" def user_verify(self):\n eid = self.email\n code = self.password\n if eid.strip() == '':\n return\n if code.strip() == '':\n return\n query = '''select * from usr where email like\\''''+eid+'\\''\n cursor = g.conn.execute(query)\n for row in cursor:\n key = str(row.password)\n if key.strip() == code.strip():\n self.name = str(row.name)\n self.email = eid\n self.id = eid\n self.valid = True\n break","target":" def user_verify(self):\n eid = self.email\n code = self.password\n if eid.strip() == '':\n return\n if code.strip() == '':\n return\n query = 'select * from usr where email like %s'\n cursor = g.conn.execute(query, (eid, ))\n for row in cursor:\n key = str(row.password)\n if key.strip() == code.strip():\n self.name = str(row.name)\n self.email = eid\n self.id = eid\n self.valid = True\n break","lang":"python","vul_type":"cwe-089","target_token_count":114,"sven_meta":{"func_name":"user_verify","file_name":"Web-app/User.py","commit_link":"github.com/Daniel-Bu/w4111-project1/commit/fe04bedc72e62fd4c4ee046a9af29fd81e9b3340","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#43-5b68d6d2ded2","input":"@app.route('/movies/search', methods=['GET', 'POST'])\ndef search_films():\n form = SearchForm()\n if not form.validate_on_submit():\n return render_template('search.html', title='Search for films', form=form)\n search_terms = form.data['term'].split(' ')\n search_string = ' & '.join(search_terms)\n cur.execute(f\"SELECT * FROM film where fulltext @@ to_tsquery('{search_string}')\")\n res = cur.fetchall()\n return render_template('search_results.html', title='Home', res=len(res))","target":"@app.route('/movies/search', methods=['GET', 'POST'])\ndef search_films():\n form = SearchForm()\n if not form.validate_on_submit():\n return render_template('search.html', title='Search for films', form=form)\n search_terms = form.data['term'].split(' ')\n search_string = ' & '.join(search_terms)\n cur.execute(\"SELECT * FROM film where fulltext @@ to_tsquery(%s)\", (search_string, ))\n res = cur.fetchall()\n return render_template('search_results.html', title='Home', res=len(res))","lang":"python","vul_type":"cwe-089","target_token_count":118,"sven_meta":{"func_name":"search_films","file_name":"app.py","commit_link":"github.com/Elbertbiggs360/dvdrental/commit/ad144ae2a08a332498d0831bc255170d57ba754b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#44-941cab34e61e","input":"def getGameCountInSeriesSoFar(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT COUNT(*) FROM ChallengeRankings WHERE SeriesTitle = '\" + getTitle(submission) + \"' AND Date <= '\" + getSubmissionDateFromDatabase(submission) + \"'\").fetchone()[0]\n database.close()","target":"def getGameCountInSeriesSoFar(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT COUNT(*) FROM ChallengeRankings WHERE SeriesTitle = ? AND Date <= ?\", [getTitle(submission), getSubmissionDateFromDatabase(submission)]).fetchone()[0]\n database.close()","lang":"python","vul_type":"cwe-089","target_token_count":71,"sven_meta":{"func_name":"getGameCountInSeriesSoFar","file_name":"CheckAndPostForSeriesSubmissions.py","commit_link":"github.com/LiquidFun/Reddit-GeoGuessr-Tracking-Bot/commit/0cad2d52e24b05da32789fbc8face7a9999a71f9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#47-712aa7e20399","input":"@endpoints.route(\"/wins\")\ndef wins():\n if db == None:\n init()\n\n player = request.args.get('tag', default=\"christmasmike\")\n sql = \"SELECT * FROM matches WHERE winner = '\"+str(player)+\"' ORDER BY date DESC;\"\n result = db.exec(sql)\n\n result = [str(x) for x in result]\n result = '\\n'.join(result)\n return json.dumps(result)","target":"@endpoints.route(\"/wins\")\ndef wins():\n if db == None:\n init()\n\n player = request.args.get('tag', default=\"christmasmike\")\n sql = \"SELECT * FROM matches WHERE winner = '{player}' ORDER BY date DESC;\"\n args = {'player': player}\n result = db.exec(sql, args)\n\n result = [str(x) for x in result]\n result = '\\n'.join(result)\n return json.dumps(result)","lang":"python","vul_type":"cwe-089","target_token_count":97,"sven_meta":{"func_name":"wins","file_name":"endpoints.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#48-f6eba8e75930","input":" def delete_event(self, event_id):\n sql = \"\"\"DELETE FROM events\n WHERE event_id = {0}\n \"\"\".format(event_id)\n affected_count = self.cur.execute(sql)\n self.conn.commit()\n return affected_count","target":" def delete_event(self, event_id):\n sql = \"\"\"\n DELETE FROM events\n WHERE event_id = %s\n \"\"\"\n affected_count = self.cur.execute(sql, (event_id,))\n self.conn.commit()\n return affected_count","lang":"python","vul_type":"cwe-089","target_token_count":50,"sven_meta":{"func_name":"delete_event","file_name":"db/dbase.py","commit_link":"github.com/jgayfer/spirit/commit/01c846c534c8d3cf6763f8b7444a0efe2caa3799","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#49-5d136fd1fa9b","input":" def add_item(self, item):\n \"\"\"\"Add new item.\"\"\"\n if self.connection:\n self.cursor.execute('insert into item (name, shoppinglistid) values (\"%s\", \"%s\")' % (item[0], item[1]))\n self.connection.commit()","target":" def add_item(self, item):\n \"\"\"\"Add new item.\"\"\"\n if self.connection:\n t = (item[0], item[1], )\n self.cursor.execute('insert into item (name, shoppinglistid) values (?, ?)', t)\n self.connection.commit()","lang":"python","vul_type":"cwe-089","target_token_count":59,"sven_meta":{"func_name":"add_item","file_name":"ecosldb/ecosldb.py","commit_link":"github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#51-8af1fe009045","input":"def also_add(name, also):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n INSERT INTO isalso(name,also) VALUES('{}','{}')\n '''.format(name, also))\n db.commit()\n logger.debug('added to isalso name {} with value {}'.format(\n name, also))\n db.close()\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def also_add(name, also):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n INSERT INTO isalso(name,also) VALUES(%(name)s,%(also)s)\n ''', (\n name,\n also,\n ))\n db.commit()\n logger.debug('added to isalso name {} with value {}'.format(\n name, also))\n db.close()\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","target_token_count":107,"sven_meta":{"func_name":"also_add","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#52-41de02f62abf","input":" def getCommentsLike(self,commentid):\n sqlText=\"select userid from comment_like where commentid=%d\"%(commentid)\n result=sql.queryDB(self.conn,sqlText)\n return result;","target":" def getCommentsLike(self,commentid):\n sqlText=\"select userid from comment_like where commentid=%s\"\n params=[commentid]\n result=sql.queryDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","target_token_count":48,"sven_meta":{"func_name":"getCommentsLike","file_name":"modules/comment.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#53-31d5e84156ca","input":"def update_theory_base(tag, link):\n theory = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\theory.db\")\n conn = theory.cursor()\n conn.execute(\"insert into \" + str(tag) + \" values (?)\", (str(link), ))\n theory.commit()\n theory.close()","target":"def update_theory_base(tag, link):\n theory = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\theory.db\")\n conn = theory.cursor()\n conn.execute(\"insert into ? values (?)\", (tag, str(link)))\n theory.commit()\n theory.close()","lang":"python","vul_type":"cwe-089","target_token_count":59,"sven_meta":{"func_name":"update_theory_base","file_name":"bases/update.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#56-35db3764183b","input":"def getPlayer(player):\n\tdb.execute(\"SELECT * FROM players WHERE Name = '%s' COLLATE NOCASE\" % player)\n\tplayerstats = dict(db.fetchone())\n\treturn playerstats","target":"def getPlayer(player):\n\tdb.execute(\"SELECT * FROM players WHERE Name = ? COLLATE NOCASE\", player)\n\tplayerstats = dict(db.fetchone())\n\treturn playerstats","lang":"python","vul_type":"cwe-089","target_token_count":32,"sven_meta":{"func_name":"getPlayer","file_name":"plugins/database.py","commit_link":"github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#58-3c746f6afdb9","input":"@app.route('/', methods=['POST'])\ndef login():\n print('login')\n user = str(request.form['username'])\n password = str(request.form['password'])\n cur.execute('SELECT * FROM users WHERE name = \\'{}\\' AND password = \\'{}\\';'.format(user, password))\n response = cur.fetchone()\n if response != None:\n print(response, 'OK')\n return redirect(url_for('enter_test_point'))\n else:\n print(response, 'not OK')\n flash('Invalid login or password')\n return render_template('login.html')","target":"@app.route('/', methods=['POST'])\ndef login():\n print('login')\n user = str(request.form['username'])\n password = str(request.form['password'])\n cur.execute(\"SELECT * FROM users WHERE name = ? AND password = ?;\", [user, password])\n response = cur.fetchone()\n if response != None:\n print(response, 'OK')\n return redirect(url_for('enter_test_point'))\n else:\n print(response, 'not OK')\n flash('Invalid login or password')\n return render_template('login.html')","lang":"python","vul_type":"cwe-089","target_token_count":111,"sven_meta":{"func_name":"login","file_name":"app.py","commit_link":"github.com/ChemiKyle/Waterspots/commit/3f9d5099496336f3f34c48abf0cf55acaaa29011","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#60-22fafc0b298f","input":"def registerPlayer(name):\n \"\"\"Adds a player to the tournament database.\n\n The database assigns a unique serial id number for the player. (This\n should be handled by your SQL database schema, not in your Python code.)\n\n Args:\n name: the player's full name (need not be unique).\n \"\"\"\n conn = connect()\n cursor = conn.cursor()\n cursor.execute(\"INSERT INTO players (name) VALUES ('%s')\" % (name,));\n conn.commit()\n conn.close()","target":"def registerPlayer(name):\n \"\"\"Adds a player to the tournament database.\n\n The database assigns a unique serial id number for the player. (This\n should be handled by your SQL database schema, not in your Python code.)\n\n Args:\n name: the player's full name (need not be unique).\n \"\"\"\n conn = connect()\n cursor = conn.cursor()\n query = \"INSERT INTO players (name) VALUES (%s);\"\n cursor.execute(query, (name,))\n conn.commit()\n conn.close()","lang":"python","vul_type":"cwe-089","target_token_count":109,"sven_meta":{"func_name":"registerPlayer","file_name":"tournament.py","commit_link":"github.com/sarahkcaplan/tournament/commit/40aba5686059f5f398f6323b1483412c56140cc0","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#63-66613e01583d","input":"@login_manager.user_loader\ndef load_user(s_id):\n email = str(s_id)\n query = '''select * from usr where email like\\'''' + email + '\\''\n cursor = g.conn.execute(query)\n user = User()\n for row in cursor:\n user.name = str(row.name)\n user.email = str(row.email)\n break\n return user","target":"@login_manager.user_loader\ndef load_user(s_id):\n email = str(s_id)\n query = 'select * from usr where email like %s'\n cursor = g.conn.execute(query, (email, ))\n user = User()\n for row in cursor:\n user.name = str(row.name)\n user.email = str(row.email)\n break\n return user","lang":"python","vul_type":"cwe-089","target_token_count":77,"sven_meta":{"func_name":"load_user","file_name":"Web-app/Server.py","commit_link":"github.com/Daniel-Bu/w4111-project1/commit/fe04bedc72e62fd4c4ee046a9af29fd81e9b3340","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#64-38b24c4ed282","input":"@mod.route('/delete/', methods=['GET', 'POST'])\ndef delete(cmt_id):\n if request.method == 'GET':\n sql = \"SELECT msg_id FROM comment where cmt_id = %d;\" % (cmt_id)\n cursor.execute(sql)\n m = cursor.fetchone()\n sql = \"DELETE FROM comment where cmt_id = '%d';\" % (cmt_id)\n cursor.execute(sql)\n conn.commit()\n flash('Delete Success!')\n return redirect(url_for('comment.show', msg_id=m[0]))","target":"@mod.route('/delete/', methods=['GET', 'POST'])\ndef delete(cmt_id):\n if request.method == 'GET':\n cursor.execute(\"SELECT msg_id FROM comment where cmt_id = %s;\", (cmt_id,))\n m = cursor.fetchone()\n cursor.execute(\"DELETE FROM comment where cmt_id = %s;\", (cmt_id,))\n conn.commit()\n flash('Delete Success!')\n return redirect(url_for('comment.show', msg_id=m[0]))","lang":"python","vul_type":"cwe-089","target_token_count":105,"sven_meta":{"func_name":"delete","file_name":"flaskr/flaskr/views/comment.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#66-9ad9b65d6bca","input":"\tdef get_secrets(self, from_date_added=0):\n\t\tsecrets = []\n\t\tfor row in self.cursor.execute('SELECT encrypted, json_id, date_added FROM secret WHERE date_added > %s ORDER BY date_added DESC' % from_date_added):\n\t\t\taes_key, json_id, date_added = cryptlib.eciesDecrypt(row[0], self.privkey), row[1], row[2]\n\t\t\tif aes_key != None:\n\t\t\t\tsecrets.append([aes_key, json_id])\n\t\t\tfrom_date_added = max(from_date_added, date_added)\n\t\treturn (secrets, from_date_added)","target":"\tdef get_secrets(self, from_date_added=0):\n\t\tsecrets = []\n\t\tfor row in self.cursor.execute('SELECT encrypted, json_id, date_added FROM secret WHERE date_added > ? ORDER BY date_added DESC', (from_date_added,)):\n\t\t\taes_key, json_id, date_added = cryptlib.eciesDecrypt(row[0], self.privkey), row[1], row[2]\n\t\t\tif aes_key != None:\n\t\t\t\tsecrets.append([aes_key, json_id])\n\t\t\tfrom_date_added = max(from_date_added, date_added)\n\t\treturn (secrets, from_date_added)","lang":"python","vul_type":"cwe-089","target_token_count":125,"sven_meta":{"func_name":"get_secrets","file_name":"zeromail.py","commit_link":"github.com/imachug/ZeroMailProxy/commit/8f62d024c6c4c957079d147e59f26d15c07dc888","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#68-f422e9c3c8da","input":"@app.route('/lookup_assets')\ndef lookup_assets():\n start = request.args.get('start')\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT aname FROM assets WHERE aname LIKE '\"+start+\"%'\"\n cur.execute(query)\n results = cur.fetchall()\n con.close()\n return jsonify(results)","target":"@app.route('/lookup_assets')\ndef lookup_assets():\n start = request.args.get('start')\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT aname FROM assets WHERE aname LIKE %s\"\n cur.execute(query, (start+'%',))\n results = cur.fetchall()\n con.close()\n return jsonify(results)","lang":"python","vul_type":"cwe-089","target_token_count":77,"sven_meta":{"func_name":"lookup_assets","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#69-4c36459c11d6","input":"def set_state(chat_id, value):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"update users set state ='\" + str(value) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n settings.commit()\n settings.close()","target":"def set_state(chat_id, value):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"update users set state = ? where chat_id = ?\", (str(value), str(chat_id)))\n settings.commit()\n settings.close()","lang":"python","vul_type":"cwe-089","target_token_count":67,"sven_meta":{"func_name":"set_state","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#71-7a26034d4fa0","input":"def get_tournaments_during_month(db, scene, date):\n y, m, d = date.split('-')\n ym_date = '{}-{}'.format(y, m)\n sql = \"select url, date from matches where scene='{}' and date like '%{}%' group by url, date order by date\".format(scene, ym_date)\n res = db.exec(sql)\n urls = [r[0] for r in res]\n return urls","target":"def get_tournaments_during_month(db, scene, date):\n y, m, d = date.split('-')\n ym_date = '{}-{}'.format(y, m)\n sql = \"select url, date from matches where scene='{scene}' and date like '%{date}%' group by url, date order by date\"\n args = {'scene': scene, 'date': ym_date}\n res = db.exec(sql, args)\n urls = [r[0] for r in res]\n return urls","lang":"python","vul_type":"cwe-089","target_token_count":109,"sven_meta":{"func_name":"get_tournaments_during_month","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#72-aa8db41d95cf","input":" def add_input(self,data):\n connection = self.connect()\n try:\n # The following is a flaw\n query = \"INSERT INTO crimes(description) VALUES ('{}');\".format(data)\n with connection.cursor() as cursor:\n cursor.execute(query)\n connection.commit()\n finally:\n connection.close()","target":" def add_input(self,data):\n connection = self.connect()\n try:\n # The following is a flaw\n query = \"INSERT INTO crimes(description) VALUES (%s);\"\n with connection.cursor() as cursor:\n cursor.execute(query, data)\n connection.commit()\n finally:\n connection.close()","lang":"python","vul_type":"cwe-089","target_token_count":64,"sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/amrishc/crimemap/commit/51b3d51aa031d7c285295de36f5464d43debf6de","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#74-eaac2f082613","input":" def all_deposits(self,coin):\n sql = \"SELECT * FROM deposits WHERE coin='%s'\" % coin\n self.cursor.execute(sql)\n return self.cursor.fetchall()","target":" def all_deposits(self,coin):\n sql = \"SELECT * FROM deposits WHERE coin='%s'\"\n self.cursor.execute(sql, (coin,))\n return self.cursor.fetchall()","lang":"python","vul_type":"cwe-089","target_token_count":38,"sven_meta":{"func_name":"all_deposits","file_name":"deposit.py","commit_link":"github.com/ktechmidas/garlictipsbot/commit/7c262255f933cb721109ac4be752b5b7599275aa","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#75-4f88d68c214d","input":" def get_user(self):\n if not hasattr(self, '_user'):\n qs = \"select * from account_access where access_token = '%s'\" % self.access_token\n result = self.db.get(qs)\n if result:\n self._user = result\n else:\n self._user = None\n \n return self._user","target":" def get_user(self):\n if not hasattr(self, '_user'):\n qs = \"select * from account_access where access_token = %s\"\n result = self.db.get(qs, self.access_token)\n if result:\n self._user = result\n else:\n self._user = None\n \n return self._user","lang":"python","vul_type":"cwe-089","target_token_count":70,"sven_meta":{"func_name":"get_user","file_name":"src/auth.py","commit_link":"github.com/bonbondirac/tsunami/commit/396cc394bd6daaf0ee9c16b1b55a4082eeaac208","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#77-409860aa86cc","input":"def GameNewPlayed(Played, ID):\n\tdb.execute(\"UPDATE games set GamesPlayed = %i WHERE ID = %i\" % (Played, ID))\n\tdatabase.commit()","target":"def GameNewPlayed(Played, ID):\n\tdb.execute(\"UPDATE games set GamesPlayed = ? WHERE ID = ?\", Played, ID)\n\tdatabase.commit()","lang":"python","vul_type":"cwe-089","target_token_count":31,"sven_meta":{"func_name":"GameNewPlayed","file_name":"plugins/database.py","commit_link":"github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#78-db2fbd13cafe","input":"def insertNPC(name, race,classe,sex,level,image,legit):\n\tc, conn = getConnection()\n\tdate = now()\n\tc.execute(\"INSERT INTO npc VALUES ('\"+date+\"','\"+str(name)+\"','\"+race+\"','\"+classe+\"','\"+sex+\"','\"+str(level)+\"','\"+image+\"','\"+str(legit)+\"')\")\n\tconn.commit()\n\tconn.close()","target":"def insertNPC(name, race,classe,sex,level,image,legit):\n\tc, conn = getConnection()\n\tdate = now()\n\tc.execute(\"INSERT INTO npc VALUES (?,?,?,?,?,?,?,?)\",(date,str(name),race,classe,sex,str(level),image,str(legit)))\n\tconn.commit()\n\tconn.close()","lang":"python","vul_type":"cwe-089","target_token_count":66,"sven_meta":{"func_name":"insertNPC","file_name":"database.py","commit_link":"github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#79-27845e1fbbae","input":" def get(self, user_id):\n \"\"\" Fetch data for user with corresponding user_id \"\"\"\n return database_utilities.execute_query(f\"\"\"select * from users where user_id = '{user_id}'\"\"\")","target":" def get(self, user_id):\n \"\"\" Fetch data for user with corresponding user_id \"\"\"\n return database_utilities.execute_query(f\"\"\"select * from users where user_id = %s\"\"\", (user_id, ))","lang":"python","vul_type":"cwe-089","target_token_count":44,"sven_meta":{"func_name":"get","file_name":"apis/users.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#81-e21153be51c6","input":" def insertData(self,userid,post):\n sqlText=\"insert into post(userid,date,comment) \\\n values(%d,current_timestamp(0),'%s');\"%(userid,post);\n result=sql.insertDB(self.conn,sqlText)\n return result;","target":" def insertData(self,userid,post):\n sqlText=\"insert into post(userid,date,comment) \\\n values(%s,current_timestamp(0),%s);\"\n params=[userid,post];\n result=sql.insertDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","target_token_count":60,"sven_meta":{"func_name":"insertData","file_name":"modules/post.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#83-d01a5be2d975","input":" def delete_resultSet(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = \"DELETE FROM %s WHERE identifier = '%s';\" % (self.table, sid)\n self._query(query)","target":" def delete_resultSet(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = \"DELETE FROM %s WHERE identifier = $1;\" % (self.table)\n self._query(query, sid)","lang":"python","vul_type":"cwe-089","target_token_count":75,"sven_meta":{"func_name":"delete_resultSet","file_name":"cheshire3/sql/resultSetStore.py","commit_link":"github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#84-8f1fe0bb7e43","input":"def getSeriesDateFromDatabase(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT StartDate FROM SeriesTracking WHERE SeriesTitle = '\" + str(getTitle(submission)) + \"'\").fetchone()[0]\n database.close()","target":"def getSeriesDateFromDatabase(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT StartDate FROM SeriesTracking WHERE SeriesTitle = ?\", [getTitle(submission)]).fetchone()[0]\n database.close()","lang":"python","vul_type":"cwe-089","target_token_count":56,"sven_meta":{"func_name":"getSeriesDateFromDatabase","file_name":"CheckAndPostForSeriesSubmissions.py","commit_link":"github.com/LiquidFun/Reddit-GeoGuessr-Tracking-Bot/commit/0cad2d52e24b05da32789fbc8face7a9999a71f9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#86-1ee430ed7307","input":" def update_date_modified(self):\n sql = \"UPDATE jdk_entries \" + \\\n \"SET date_last_modified = \" + CURRENT_DATESTAMP + \" \" + \\\n \"WHERE jdk_entries.id = '\" + self.entry_id + \"';\"\n \n db_execute(sql)\n\n return None","target":" def update_date_modified(self):\n quote_tuple = CURRENT_DATESTAMP, self.entry_id\n\n sql = \"UPDATE jdk_entries \" + \\\n \"SET date_last_modified = ? \" + \\\n \"WHERE jdk_entries.id = ?;\"\n \n db_execute(sql, quote_tuple)\n\n return None","lang":"python","vul_type":"cwe-089","target_token_count":64,"sven_meta":{"func_name":"update_date_modified","file_name":"entry.py","commit_link":"github.com/peterlebrun/jdk/commit/000238566fbe55ba09676c3d57af04ae207235ae","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#88-91be3fa5617d","input":" def add_input(self, data):\n connection = self.connect()\n try:\n # The following introduces a deliberate security flaw - SQL Injection\n query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)\n with connection.cursor() as cursor:\n cursor.execute(query)\n connection.commit()\n finally:\n connection.close()","target":" def add_input(self, data):\n connection = self.connect()\n try:\n # The following introduces a deliberate security flaw - SQL Injection\n query = \"INSERT INTO crimes (description) VALUES (%s);\"\n with connection.cursor() as cursor:\n cursor.execute(query, data)\n connection.commit()\n finally:\n connection.close()","lang":"python","vul_type":"cwe-089","target_token_count":71,"sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/rwolf527/crimemap/commit/50b0695e0b4c46165e6146f6fac4cd6871d9fdf6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#90-d10236943389","input":" def login(self, username, password):\n select_query = \"\"\"\n SELECT client_id, username, balance, message\n FROM Clients\n WHERE username = '{}' AND password = '{}'\n LIMIT 1\n \"\"\".format(username, password)\n\n cursor = self.__conn.cursor()\n\n cursor.execute(select_query)\n user = cursor.fetchone()\n\n if(user):\n return Client(user[0], user[1], user[2], user[3])\n else:\n return False","target":" def login(self, username, password):\n select_query = \"\"\"\n SELECT client_id, username, balance, message\n FROM Clients\n WHERE username = ? AND password = ?\n LIMIT 1\n \"\"\"\n\n cursor = self.__conn.cursor()\n\n cursor.execute(select_query, (username, password))\n user = cursor.fetchone()\n\n if(user):\n return Client(user[0], user[1], user[2], user[3])\n else:\n return False","lang":"python","vul_type":"cwe-089","target_token_count":99,"sven_meta":{"func_name":"login","file_name":"Week_9/sql_manager.py","commit_link":"github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#91-75a0e0828b56","input":"def get_current_state(chat_id):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__))+\"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = '\" + str(chat_id) + \"'\")\n name = conn.fetchone()\n if name != None:\n return name[4]\n else:\n return False\n settings.close()","target":"def get_current_state(chat_id):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__))+\"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = ?\", (str(chat_id),))\n name = conn.fetchone()\n if name != None:\n return name[4]\n else:\n return False\n settings.close()","lang":"python","vul_type":"cwe-089","target_token_count":83,"sven_meta":{"func_name":"get_current_state","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#94-1d5a1c85e651","input":"def get_top_popular(top_num):\r\n \"\"\" query the top(top_num) popular articles\r\n top_num => list of [title, count]\r\n \"\"\"\r\n cmd = \"\"\"SELECT title, views FROM articles\r\n INNER JOIN (\r\n SELECT path, count(path) AS views\r\n FROM log GROUP BY log.path\r\n ) AS log\r\n ON log.path = '/article/' || articles.slug\r\n ORDER BY views DESC\r\n LIMIT {}\"\"\".format(top_num)\r\n return execute_query(cmd)","target":"def get_top_popular(top_num):\r\n \"\"\" query the top(top_num) popular articles\r\n top_num => list of [title, count]\r\n \"\"\"\r\n cmd = \"\"\"SELECT title, views FROM articles\r\n INNER JOIN (\r\n SELECT path, count(path) AS views\r\n FROM log GROUP BY log.path\r\n ) AS log\r\n ON log.path = '/article/' || articles.slug\r\n ORDER BY views DESC\r\n LIMIT %s\"\"\"\r\n data = [top_num, ]\r\n return execute_query(cmd, data)","lang":"python","vul_type":"cwe-089","target_token_count":109,"sven_meta":{"func_name":"get_top_popular","file_name":"logAnalyzerDb.py","commit_link":"github.com/thugasin/udacity-homework-logAnalyzer/commit/506f25f9a1caee7f17034adf7c75e0efbc88082b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#95-93f2b216df9f","input":"@app.route('//edit')\ndef render_page_edit(page_name):\n query = db.query(\"select page_content.content from page, page_content where page.id = page_content.page_id and page.page_name = '%s' order by page_content.id desc limit 1\" % page_name)\n wiki_page = query.namedresult()\n if len(wiki_page) > 0:\n content = wiki_page[0].content\n else:\n content = \"\"\n return render_template(\n 'edit_page.html',\n page_name = page_name,\n content = content\n )","target":"@app.route('//edit')\ndef render_page_edit(page_name):\n query = db.query(\"select page_content.content from page, page_content where page.id = page_content.page_id and page.page_name = $1 order by page_content.id desc limit 1\", page_name)\n wiki_page = query.namedresult()\n if len(wiki_page) > 0:\n content = wiki_page[0].content\n else:\n content = \"\"\n return render_template(\n 'edit_page.html',\n page_name = page_name,\n content = content\n )","lang":"python","vul_type":"cwe-089","target_token_count":120,"sven_meta":{"func_name":"render_page_edit","file_name":"server.py","commit_link":"github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#96-6488b69da8a8","input":"def get_monthly_ranks_for_scene(db, scene, tag):\n\n sql = \"SELECT date, rank FROM ranks WHERE scene='{}' AND player='{}'\".format(scene, tag)\n res = db.exec(sql)\n\n res = [r for r in res if played_during_month(db, scene, tag, get_previous_month(r[0]))]\n\n # Build up a dict of {date: rank}\n ranks = {}\n for r in res:\n ranks[r[0]] = r[1]\n\n return ranks","target":"def get_monthly_ranks_for_scene(db, scene, tag):\n\n sql = \"SELECT date, rank FROM ranks WHERE scene='{scene}' AND player='{tag}'\"\n args = {'scene': scene, 'tag': tag}\n res = db.exec(sql, args)\n\n res = [r for r in res if played_during_month(db, scene, tag, get_previous_month(r[0]))]\n\n # Build up a dict of {date: rank}\n ranks = {}\n for r in res:\n ranks[r[0]] = r[1]\n\n return ranks","lang":"python","vul_type":"cwe-089","target_token_count":121,"sven_meta":{"func_name":"get_monthly_ranks_for_scene","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#98-f23974412261","input":" def add_input(self, data):\n connection = self.connect()\n try:\n # The following introduces a deliberate security flaw. \n # See section on SQL injection below\n query = \"INSERT INTO crimes (description) VALUES('{}');\".format(data)\n with connection.cursor() as cursor:\n cursor.execute(query)\n connection.commit()\n finally:\n connection.close()","target":" def add_input(self, data):\n connection = self.connect()\n try:\n # The following introduces a deliberate security flaw. \n # See section on SQL injection below\n query = \"INSERT INTO crimes (description) VALUES(%s);\"\n with connection.cursor() as cursor:\n cursor.execute(query, data)\n connection.commit()\n finally:\n connection.close()","lang":"python","vul_type":"cwe-089","target_token_count":78,"sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/mudspringhiker/crimemap/commit/35e78962e7288c643cdde0f886ff7aa5ac77cb8c","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#99-354e8983b4ef","input":" def getAllComments(self):\n sqlText=\"select comment from comments where userid=%d order by date;\"\n allposts=sql.queryDB(self.conn,sqlText)\n return allposts;","target":" def getAllComments(self):\n sqlText=\"select comment from comments where userid=%s order by date;\"\n params = [self.userid]\n allposts=sql.queryDB(self.conn,sqlText,params)\n return allposts;","lang":"python","vul_type":"cwe-089","target_token_count":48,"sven_meta":{"func_name":"getAllComments","file_name":"modules/users.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#101-e53fadedf872","input":" def save_accepted_transaction(self, user_id, project_id, money):\n self.cursor.execute(\"update users set money = money - %s where id = %s\"%(money, user_id))\n self.cursor.execute(\"update projects set money = money + %s where id = %s\" % (money, project_id))\n self.cursor.execute(\"insert into transactions (project_id, user_id, money, timestamp, state) values (%s, %s, %s, now(), 'accepted' )\" % (project_id, user_id, money))\n self.db.commit()","target":" def save_accepted_transaction(self, user_id, project_id, money):\n self.cursor.execute(\"update users set money = money - %s where id = %s\", (money, user_id))\n self.cursor.execute(\"update projects set money = money + %s where id = %s\", (money, project_id))\n self.cursor.execute(\"insert into transactions (project_id, user_id, money, timestamp, state) values (%s, %s, \"\n \"%s, now(), 'accepted' )\", (project_id, user_id, money))\n self.db.commit()","lang":"python","vul_type":"cwe-089","target_token_count":121,"sven_meta":{"func_name":"save_accepted_transaction","file_name":"backend/transactions/TransactionConnector.py","commit_link":"github.com/JLucka/kickstarter-dev/commit/e2ffa062697e060fdfbd2eccbb89a8c53a569e0b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#103-4517a2624d92","input":"def incrementOption(cursor, poll_name, option):\n key = poll_name+\"-\"+option\n req = \"UPDATE {} SET count=count+1 WHERE name_option = '{}';\".format(CFG(\"options_table_name\"), key)\n cursor.execute(req)","target":"def incrementOption(cursor, poll_name, option):\n key = poll_name+\"-\"+option\n req = \"UPDATE {} SET count=count+1 WHERE name_option=?\".format(CFG(\"options_table_name\"))\n cursor.execute(req, (key,))","lang":"python","vul_type":"cwe-089","target_token_count":52,"sven_meta":{"func_name":"incrementOption","file_name":"database.py","commit_link":"github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#105-9e629ea7791a","input":"def addTags(tag_list, listing_id):\n \"\"\"\n Adds a list of tags tag_list for a given listing with listing_id to the database\n \"\"\"\n cur = conn.cursor()\n for x in tag_list:\n sql = \"INSERT INTO {} VALUES {}\".format(listing_tags_table_name, str((listing_id, x)))\n cur.execute(sql)","target":"def addTags(tag_list, listing_id):\n \"\"\"\n Adds a list of tags tag_list for a given listing with listing_id to the database\n \"\"\"\n cur = conn.cursor()\n for x in tag_list:\n sql = \"INSERT INTO %s VALUES (%s %s)\"\n cur.execute(sql, (listing_tags_table_name, listing_id, x))","lang":"python","vul_type":"cwe-089","target_token_count":75,"sven_meta":{"func_name":"addTags","file_name":"backend-api/backend-api.py","commit_link":"github.com/tasbir49/BreadWinner/commit/332a9f2c619be399ae94244bb8bd0977fc62bc16","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#110-a92eab0caf4a","input":" def _checkPairing():\n if winner == loser:\n raise ValueError('Attempt to match player against self')\n\n q = '''\n SELECT COUNT(*) FROM matches\n WHERE (matches.winner_id = %s AND matches.loser_id = %s)\n OR (matches.winner_id = %s AND matches.loser_id = %s);\n ''' % (winner, loser, loser, winner)\n cur.execute(q)\n if cur.fetchone()[0] > 0:\n raise ValueError('Pairing %s, %s already played' % (winner, loser))","target":" def _checkPairing():\n if winner == loser:\n raise ValueError('Attempt to match player against self')\n\n q = '''\n SELECT COUNT(*) FROM matches\n WHERE (matches.winner_id = %s AND matches.loser_id = %s)\n OR (matches.winner_id = %s AND matches.loser_id = %s);\n '''\n cur.execute(q, (winner, loser, loser, winner))\n if cur.fetchone()[0] > 0:\n raise ValueError('Pairing %s, %s already played' % (winner, loser))","lang":"python","vul_type":"cwe-089","target_token_count":120,"sven_meta":{"func_name":"reportMatch._checkPairing","file_name":"vagrant/tournament/tournament.py","commit_link":"github.com/juanchopanza/Tournament/commit/5799aee52d2cabb685800b88977257bd0964d0da","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#112-d55e105d2d54","input":"def create_playlist(name, db):\n db.execute(\n \"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);\".format(name=name))","target":"def create_playlist(name, db):\n db.execute(\n \"INSERT INTO playlist (name, video_position) VALUES(%s, 0);\", (name,))","lang":"python","vul_type":"cwe-089","target_token_count":34,"sven_meta":{"func_name":"create_playlist","file_name":"playlist/playlist_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#115-8264aa047d72","input":" def add_day_data_row(self, ts, data, prev_etotal):\n\n if data['power'] > 0:\n\n inv_serial = data['source']['serial_id']\n query = '''\n INSERT INTO DayData (\n TimeStamp,\n Serial,\n Power,\n TotalYield\n ) VALUES (\n %s,\n %s,\n %s,\n %s\n );\n ''' % (ts, inv_serial, data['power'], prev_etotal + data['energy'])\n self.c.execute(query)","target":" def add_day_data_row(self, ts, data, prev_etotal):\n\n if data['power'] > 0:\n\n inv_serial = data['source']['serial_id']\n query = '''\n INSERT INTO DayData (\n TimeStamp,\n Serial,\n Power,\n TotalYield\n ) VALUES (\n ?,\n ?,\n ?,\n ?\n );\n '''\n self.c.execute(query, (ts, inv_serial, data['power'], prev_etotal + data['energy']))","lang":"python","vul_type":"cwe-089","target_token_count":106,"sven_meta":{"func_name":"add_day_data_row","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#117-b9f77e0cbf51","input":" def get(self, space_id):\n \"\"\" Fetch data for space with the corresponding space_id \"\"\"\n return database_utilities.execute_query(\n f\"\"\"select * from spaces where space_id = '{space_id}'\"\"\")","target":" def get(self, space_id):\n \"\"\" Fetch data for space with the corresponding space_id \"\"\"\n return database_utilities.execute_query(\n f\"\"\"select * from spaces where space_id = %s\"\"\", (space_id, ))","lang":"python","vul_type":"cwe-089","target_token_count":47,"sven_meta":{"func_name":"get","file_name":"apis/spaces.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#118-053bb38c1668","input":"def check(current_num):\n try:\n cursor.execute('SELECT * FROM comics WHERE num=\"%s\"' % current_num)\n except sqlite3.OperationalError:\n cursor.execute('CREATE TABLE comics (num text)')\n return False\n else:\n return False if cursor.fetchone() is None else True","target":"def check(current_num):\n try:\n cursor.execute('SELECT * FROM comics WHERE num=?', (current_num,))\n except sqlite3.OperationalError:\n cursor.execute('CREATE TABLE comics (num text)')\n return False\n else:\n return False if cursor.fetchone() is None else True","lang":"python","vul_type":"cwe-089","target_token_count":62,"sven_meta":{"func_name":"check","file_name":"comics/check_comics.py","commit_link":"github.com/lord63/a_bunch_of_code/commit/c0d67a1312306fd1257c354bfb5d6cac7643aa29","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#119-aa8cdf5aa697","input":"@app.route('/delete_crawl', methods=['POST'])\n@is_logged_in\ndef delete_crawl():\n\n # Get Form Fields\n cid = request.form['cid']\n\n # Create cursor\n cur = mysql.connection.cursor()\n\n # Get user by username\n result = cur.execute(\"DELETE FROM Crawls WHERE cid = %s\" % cid)\n\n # Commit to DB\n mysql.connection.commit()\n\n # Close connection\n cur.close()\n\n # FIXME check if successfull first, return message\n flash('Crawl successfully removed', 'success')\n\n return redirect(url_for('dashboard'))","target":"@app.route('/delete_crawl', methods=['POST'])\n@is_logged_in\ndef delete_crawl():\n\n # Get Form Fields\n cid = request.form['cid']\n\n # Create cursor\n cur = mysql.connection.cursor()\n\n # Get user by username\n result = cur.execute(\"\"\"DELETE FROM Crawls WHERE cid = %s\"\"\" (cid,))\n\n # Commit to DB\n mysql.connection.commit()\n\n # Close connection\n cur.close()\n\n # FIXME check if successfull first, return message\n flash('Crawl successfully removed', 'success')\n\n return redirect(url_for('dashboard'))","lang":"python","vul_type":"cwe-089","target_token_count":125,"sven_meta":{"func_name":"delete_crawl","file_name":"bar.py","commit_link":"github.com/yannvon/table-detection/commit/4bad3673debf0b9491b520f0e22e9186af78c375","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#121-c2f02883f26f","input":"def new_category(category_name):\n try:\n conn = check_heroku_db()\n cur = conn.cursor()\n cur.execute('''INSERT INTO categories (cat_name) VALUES (%s)''', (category_name,))\n conn.commit()\n conn.close()\n\n except psycopg2.DatabaseError as e:\n print('Error %s' % e)\n sys.exit(1)","target":"def new_category(category_name):\n try:\n conn = check_heroku_db()\n cur = conn.cursor()\n\n query = \"INSERT INTO categories (cat_name) VALUES (%s);\"\n data = (category_name,)\n cur.execute(query, data)\n\n conn.commit()\n conn.close()\n\n except psycopg2.DatabaseError as e:\n print('Error %s' % e)\n sys.exit(1)","lang":"python","vul_type":"cwe-089","target_token_count":87,"sven_meta":{"func_name":"new_category","file_name":"db.py","commit_link":"github.com/leeorb321/expenses/commit/f93c0fa4d30787ef16420bfefc52565b98bc7fcf","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#122-32e1ae81428f","input":"def get_first_month(db, scene):\n sql = \"select date from matches where scene='{}' order by date limit 1;\".format(scene)\n res = db.exec(sql)\n date = res[0][0]\n return date","target":"def get_first_month(db, scene):\n sql = \"select date from matches where scene='{scene}' order by date limit 1;\"\n args = {'scene': scene}\n res = db.exec(sql, args)\n date = res[0][0]\n return date","lang":"python","vul_type":"cwe-089","target_token_count":57,"sven_meta":{"func_name":"get_first_month","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#123-d276815aa9c1","input":"def getOptions(poll_name):\n conn, c = connectDB()\n options_str = queryOne(c, \"SELECT options FROM {} WHERE name='{}'\".format(CFG(\"poll_table_name\"), poll_name))\n if options_str == None:\n return None\n options = options_str.split(\",\")\n closeDB(conn)\n return options","target":"def getOptions(poll_name):\n conn, c = connectDB()\n req = \"SELECT options FROM {} WHERE name=?\".format(CFG(\"poll_table_name\"))\n options_str = queryOne(c, req, (poll_name,))\n if options_str == None:\n return None\n options = options_str.split(\",\")\n closeDB(conn)\n return options","lang":"python","vul_type":"cwe-089","target_token_count":75,"sven_meta":{"func_name":"getOptions","file_name":"database.py","commit_link":"github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#124-7de1d7b024ab","input":"def retrieve_last_video_position(playlist_id, db):\n db.execute(\"SELECT max(position) as position from video WHERE playlist_id={playlist_id};\".format(\n playlist_id=playlist_id))\n row = db.fetchone()\n return row['position']","target":"def retrieve_last_video_position(playlist_id, db):\n db.execute(\n \"SELECT max(position) as position from video WHERE playlist_id=%s;\", (playlist_id,))\n row = db.fetchone()\n return row['position']","lang":"python","vul_type":"cwe-089","target_token_count":47,"sven_meta":{"func_name":"retrieve_last_video_position","file_name":"video/video_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#125-1c16c4541341","input":"@app.route('//history')\ndef view_page_history(page_name):\n query = db.query(\"select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = '%s'\" % page_name)\n page_histories = query.namedresult()\n\n return render_template(\n 'page_history.html',\n page_name = page_name,\n page_histories = page_histories\n )","target":"@app.route('//history')\ndef view_page_history(page_name):\n query = db.query(\"select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = $1\", page_name)\n page_histories = query.namedresult()\n\n return render_template(\n 'page_history.html',\n page_name = page_name,\n page_histories = page_histories\n )","lang":"python","vul_type":"cwe-089","target_token_count":92,"sven_meta":{"func_name":"view_page_history","file_name":"server.py","commit_link":"github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#126-99077d1b890e","input":" def add_input(self, data):\n connection = self.connects()\n try:\n # The following introduces a deliberate security flaw. See section on SQL injecton below\n query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(\n data)\n with connection.cursor() as cursor:\n cursor.execute(query)\n connection.commit()\n finally:\n connection.close()","target":" def add_input(self, data):\n connection = self.connects()\n try:\n # The following introduces a deliberate security flaw. See section on SQL injecton below\n query = \"INSERT INTO crimes (description) VALUES (%s);\"\n with connection.cursor() as cursor:\n cursor.execute(query, data)\n connection.commit()\n finally:\n connection.close()","lang":"python","vul_type":"cwe-089","target_token_count":77,"sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/JeremiahO/crimemap/commit/c17537fcd7aa4e2a26f7ca5cefaeb356ff646858","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#129-978c8e802e19","input":" def add_translationname(self, trname):\n \"\"\"Add new translation by item name for an item.\"\"\"\n if self.connection:\n for item in self.find_item_name([trname[0], '0']):\n self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (\"%s\", \"%s\", \"%s\")' % (item[0], trname[1], trname[2]))\n self.connection.commit()","target":" def add_translationname(self, trname):\n \"\"\"Add new translation by item name for an item.\"\"\"\n if self.connection:\n for item in self.find_item_name([trname[0], '0']):\n t = (item[0], trname[1], trname[2], )\n self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (?, ?, ?)', t)\n self.connection.commit()","lang":"python","vul_type":"cwe-089","target_token_count":93,"sven_meta":{"func_name":"add_translationname","file_name":"ecosldb/ecosldb.py","commit_link":"github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#130-5b17d184e032","input":" @staticmethod\n def get_max_task_id_for_project(project_id: int):\n \"\"\"Gets the nights task id currently in use on a project\"\"\"\n sql = \"\"\"select max(id) from tasks where project_id = {0} GROUP BY project_id\"\"\".format(project_id)\n result = db.engine.execute(sql)\n if result.rowcount == 0:\n raise NotFound()\n for row in result:\n return row[0]","target":" @staticmethod\n def get_max_task_id_for_project(project_id: int):\n \"\"\"Gets the nights task id currently in use on a project\"\"\"\n sql = \"\"\"select max(id) from tasks where project_id = :project_id GROUP BY project_id\"\"\"\n result = db.engine.execute(text(sql), project_id=project_id)\n if result.rowcount == 0:\n raise NotFound()\n for row in result:\n return row[0]","lang":"python","vul_type":"cwe-089","target_token_count":93,"sven_meta":{"func_name":"get_max_task_id_for_project","file_name":"server/models/postgis/task.py","commit_link":"github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#133-f284645044bb","input":" def add_input(self,data):\n connection = self.connect()\n\n try:\n query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)\n with connection.cursor() as cursor:\n cursor.execute(query)\n connection.commit()\n finally:\n connection.close()","target":" def add_input(self,data):\n connection = self.connect()\n\n try:\n query = \"INSERT INTO crimes (description) VALUES (%s);\"\n with connection.cursor() as cursor:\n cursor.execute(query,data)\n connection.commit()\n finally:\n connection.close()","lang":"python","vul_type":"cwe-089","target_token_count":56,"sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/sgnab/crime-map-app/commit/209b23bad13594c9cdf18d8788fcba7c8f68d37b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#137-eb6d2b3ef725","input":"@mod.route('/like/', methods=['GET', 'POST'])\ndef like(msg_id):\n if request.method == 'GET':\n user_id = session['logged_id']\n c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n sql = \"INSERT INTO like_msg(msg_id, user_id,c_time) \" + \\\n \"VALUES(%d,'%s','%s');\" % (msg_id, user_id, c_time)\n cursor.execute(sql)\n conn.commit()\n return redirect(url_for('show_entries'))","target":"@mod.route('/like/', methods=['GET', 'POST'])\ndef like(msg_id):\n if request.method == 'GET':\n user_id = session['logged_id']\n c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n cursor.execute(\"INSERT INTO like_msg(msg_id, user_id,c_time) VALUES(%s,%s,%s);\", (msg_id, user_id, c_time))\n conn.commit()\n return redirect(url_for('show_entries'))","lang":"python","vul_type":"cwe-089","target_token_count":109,"sven_meta":{"func_name":"like","file_name":"flaskr/flaskr/views/like_msg.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#138-8ef7ae917c04","input":" def tag_to_tag_num(self, tag):\n ''' Returns tag_num given tag. '''\n\n q = \"SELECT rowid FROM tags WHERE tag = '\" + tag + \"'\"\n self.query(q)\n return self.c.fetchone()[0]","target":" def tag_to_tag_num(self, tag):\n ''' Returns tag_num given tag. '''\n\n q = \"SELECT rowid FROM tags WHERE tag = ?\"\n self.query(q, tag)\n return self.c.fetchone()[0]","lang":"python","vul_type":"cwe-089","target_token_count":48,"sven_meta":{"func_name":"tag_to_tag_num","file_name":"modules/query_lastfm.py","commit_link":"github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#140-83d4de462eb9","input":" def change_message(self, new_message, logged_user):\n update_sql = \"\"\"\n UPDATE Clients\n SET message = '{}'\n WHERE client_id = '{}'\n \"\"\".format(new_message, logged_user.get_client_id())\n\n cursor = self.__conn.cursor()\n\n cursor.execute(update_sql)\n self.__conn.commit()\n logged_user.set_message(new_message)","target":" def change_message(self, new_message, logged_user):\n update_sql = \"\"\"\n UPDATE Clients\n SET message = ?\n WHERE client_id = ?\n \"\"\"\n\n cursor = self.__conn.cursor()\n\n cursor.execute(update_sql, (new_message, logged_user.get_client_id()))\n self.__conn.commit()\n logged_user.set_message(new_message)","lang":"python","vul_type":"cwe-089","target_token_count":72,"sven_meta":{"func_name":"change_message","file_name":"Week_9/sql_manager.py","commit_link":"github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#141-ed1d1bb0d18f","input":" def create_event(self, title, start_time, time_zone, server_id, description):\n sql = \"\"\"INSERT INTO events (title, start_time, time_zone, server_id, description)\n VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')\n \"\"\".format(title, start_time, time_zone, server_id, description)\n self.cur.execute(sql)\n self.conn.commit()","target":" def create_event(self, title, start_time, time_zone, server_id, description):\n sql = \"\"\"\n INSERT INTO events (title, start_time, time_zone, server_id, description)\n VALUES (%s, %s, %s, %s, %s)\n \"\"\"\n self.cur.execute(sql, (title, start_time, time_zone, server_id, description))\n self.conn.commit()","lang":"python","vul_type":"cwe-089","target_token_count":85,"sven_meta":{"func_name":"create_event","file_name":"db/dbase.py","commit_link":"github.com/jgayfer/spirit/commit/01c846c534c8d3cf6763f8b7444a0efe2caa3799","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#143-faa8f5365ec1","input":"def get_bracket_graph_data(db, tag):\n # First, we have to find out which scenes this player has brackets in\n sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{}'\".format(tag)\n scenes = db.exec(sql)\n scenes = [s[0] for s in scenes]\n\n bracket_placings_by_scene = {s: get_bracket_placings_in_scene(db, s, tag) for s in scenes}\n\n return bracket_placings_by_scene","target":"def get_bracket_graph_data(db, tag):\n # First, we have to find out which scenes this player has brackets in\n sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{tag}'\"\n args = {'tag': tag}\n scenes = db.exec(sql, args)\n scenes = [s[0] for s in scenes]\n\n bracket_placings_by_scene = {s: get_bracket_placings_in_scene(db, s, tag) for s in scenes}\n\n return bracket_placings_by_scene","lang":"python","vul_type":"cwe-089","target_token_count":110,"sven_meta":{"func_name":"get_bracket_graph_data","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#144-aacd766e8705","input":" def get(self, email):\n \"\"\" Fetch data for admin with the corresponding email \"\"\"\n return database_utilities.execute_query(f\"\"\"select * from admins where email = '{email}'\"\"\")","target":" def get(self, email):\n \"\"\" Fetch data for admin with the corresponding email \"\"\"\n return database_utilities.execute_query(f\"\"\"select * from admins where email = %s\"\"\", (email, ))","lang":"python","vul_type":"cwe-089","target_token_count":41,"sven_meta":{"func_name":"get","file_name":"apis/admins.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#145-59731aa4b3d4","input":"def insertUsage(user, command):\n\tc, conn = getConnection()\n\tdate = now()\n\tc.execute(\"INSERT INTO usage (date,user,command) VALUES ('\"+date+\"','\"+str(user)+\"','\"+command+\"')\")\n\tconn.commit()\n\tconn.close()","target":"def insertUsage(user, command):\n\tc, conn = getConnection()\n\tdate = now()\n\tc.execute(\"INSERT INTO usage (date,user,command) VALUES (?,?,?)\",(date,str(user),command))\n\tconn.commit()\n\tconn.close()","lang":"python","vul_type":"cwe-089","target_token_count":46,"sven_meta":{"func_name":"insertUsage","file_name":"database.py","commit_link":"github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#146-cb6f56984dbe","input":" def verify_email(self, member):\n query = \"SELECT COUNT(email) FROM members WHERE email = '{email}'\".format(email = member)\n self.cursor.execute(query)\n result = self.cursor.fetchone()\n if (int(result[0]) > 0):\n return True \n else:\n return False","target":" def verify_email(self, member):\n self.cursor.execute(\"SELECT COUNT(email) FROM members WHERE email = ':email'\", {'email':member})\n result = self.cursor.fetchone()\n if (int(result[0]) > 0):\n return True \n else:\n return False","lang":"python","vul_type":"cwe-089","target_token_count":59,"sven_meta":{"func_name":"verify_email","file_name":"book_rides/book_rides.py","commit_link":"github.com/kenboo98/291-Mini-Project-I/commit/3080ccb687c79c83954ce703faee8fcceec8c9eb","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#147-f53b171ae350","input":" def get_previous_yields(self, inverter_serial):\n query = '''\n SELECT TimeStamp, EToday, ETotal\n FROM Inverters\n WHERE Serial = '%s'\n ''' % (inverter_serial)\n self.c.execute(query)\n data = self.c.fetchone()\n return data[0], data[1], data[2]","target":" def get_previous_yields(self, inverter_serial):\n query = '''\n SELECT TimeStamp, EToday, ETotal\n FROM Inverters\n WHERE Serial=?\n '''\n self.c.execute(query, (inverter_serial,))\n data = self.c.fetchone()\n return data[0], data[1], data[2]","lang":"python","vul_type":"cwe-089","target_token_count":72,"sven_meta":{"func_name":"get_previous_yields","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#150-d0ae70bbe631","input":"def get_article(index):\n with conn.cursor(cursor_factory=DictCursor) as cur:\n query = \"SELECT * FROM articles WHERE index=\"+str(index)\n cur.execute(query)\n article = cur.fetchone()\n return article","target":"def get_article(index):\n with conn.cursor(cursor_factory=DictCursor) as cur:\n query = \"SELECT * FROM articles WHERE index=%s\"\n cur.execute(query, (index, ))\n article = cur.fetchone()\n return article","lang":"python","vul_type":"cwe-089","target_token_count":49,"sven_meta":{"func_name":"get_article","file_name":"app.py","commit_link":"github.com/sepehr125/arxiv-doc2vec-recommender/commit/f23a4c32e6192b145017f64734b0a9a384c9123a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#152-121b5a564d34","input":"def closeGame(ID):\n\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = %i\" % ID)\n\tdatabase.commit()","target":"def closeGame(ID):\n\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = ?\", ID)\n\tdatabase.commit()","lang":"python","vul_type":"cwe-089","target_token_count":26,"sven_meta":{"func_name":"closeGame","file_name":"plugins/database.py","commit_link":"github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#153-ff692efe12c8","input":" def cancelFollow(self,userid,friendid):\n sqlText=\"delete from friends where userid=%d and friendid=%d;\"%(userid,friendid)\n result=sql.deleteDB(self.conn,sqlText)\n return result;","target":" def cancelFollow(self,userid,friendid):\n sqlText=\"delete from friends where userid=%d and friendid=%s;\"\n params=[userid,friendid]\n result=sql.deleteDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","target_token_count":53,"sven_meta":{"func_name":"cancelFollow","file_name":"modules/users.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#154-3f53476e4249","input":" def change_pass(self, new_pass, logged_user):\n update_sql = \"\"\"\n UPDATE Clients\n SET password = '{}'\n WHERE client_id = '{}'\n \"\"\".format(new_pass, logged_user.get_client_id())\n\n cursor = self.__conn.cursor()\n\n cursor.execute(update_sql)\n self.__conn.commit()","target":" def change_pass(self, new_pass, logged_user):\n update_sql = \"\"\"\n UPDATE Clients\n SET password = ?\n WHERE client_id = ?\n \"\"\"\n\n cursor = self.__conn.cursor()\n\n cursor.execute(update_sql, (new_pass, logged_user.get_client_id()))\n self.__conn.commit()","lang":"python","vul_type":"cwe-089","target_token_count":64,"sven_meta":{"func_name":"change_pass","file_name":"Week_9/sql_manager.py","commit_link":"github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#155-a938efe96c71","input":" def getCommentsByPostid(self,postid,userid):\n sqlText=\"select (select Count(*) from comment_like where comments.commentid = comment_like.commentid) as like,(select Count(*) from comment_like where comments.commentid = comment_like.commentid and comment_like.userid=%d) as flag,commentid,name,comment from users,comments where users.userid=comments.userid and postid=%d order by date desc;\"%(userid,postid)\n result=sql.queryDB(self.conn,sqlText)\n return result;","target":" def getCommentsByPostid(self,postid,userid):\n sqlText=\"select (select Count(*) from comment_like where \\\n comments.commentid = comment_like.commentid) as like,(select Count(*) \\\n from comment_like where comments.commentid = \\\n comment_like.commentid and comment_like.userid=%s) as \\\n flag,commentid,name,comment from users,comments where \\\n users.userid=comments.userid and postid=%s order by date desc;\"\n params=[userid,postid]\n result=sql.queryDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","target_token_count":124,"sven_meta":{"func_name":"getCommentsByPostid","file_name":"modules/comment.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#157-d60196f172a8","input":" @jwt_required\n def patch(self, user_id):\n \"\"\" Replaces information of corresponding user_id with request body \"\"\"\n query = f\"\"\"update users set user_id = %s \"\"\"\n query += f\"\"\"where user_id = '{user_id}'\"\"\"\n json_data = request.get_json()\n parameters = (json_data['user_id'], )\n database_utilities.execute_query(query, parameters)","target":" @jwt_required\n def patch(self, user_id):\n \"\"\" Replaces information of corresponding user_id with request body \"\"\"\n query = f\"\"\"update users set user_id = %s \"\"\"\n query += f\"\"\"where user_id = %s\"\"\"\n json_data = request.get_json()\n parameters = (json_data['user_id'], user_id)\n database_utilities.execute_query(query, parameters)","lang":"python","vul_type":"cwe-089","target_token_count":82,"sven_meta":{"func_name":"patch","file_name":"apis/users.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#160-97ca5316fd5e","input":" def can_user_pass_that_amount_of_money(self, user_id, money):\n self.cursor.execute(\"SELECT count(id) FROM kickstarter.users where id = %s and money >= %s\" % (user_id, money))\n return self.cursor.fetchall()[0][0]","target":" def can_user_pass_that_amount_of_money(self, user_id, money):\n self.cursor.execute(\"SELECT count(id) FROM kickstarter.users where id = %s and money >= %s\", (user_id, money))\n return self.cursor.fetchall()[0][0]","lang":"python","vul_type":"cwe-089","target_token_count":56,"sven_meta":{"func_name":"can_user_pass_that_amount_of_money","file_name":"backend/transactions/TransactionConnector.py","commit_link":"github.com/JLucka/kickstarter-dev/commit/e2ffa062697e060fdfbd2eccbb89a8c53a569e0b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#161-c2c31e5ac593","input":"@endpoints.route(\"/placings\")\ndef placings():\n if db == None:\n init()\n\n tag = request.args.get('tag', default='christmas mike')\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM placings WHERE player = '{}'\".format(tag)\n results = list(db.exec(sql))\n results.sort(key=lambda x: int(x[2]))\n\n return json.dumps(results)","target":"@endpoints.route(\"/placings\")\ndef placings():\n if db == None:\n init()\n\n tag = request.args.get('tag', default='christmas mike')\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM placings WHERE player = '{tag}'\"\n args = {'tag': tag}\n results = list(db.exec(sql, args))\n results.sort(key=lambda x: int(x[2]))\n\n return json.dumps(results)","lang":"python","vul_type":"cwe-089","target_token_count":101,"sven_meta":{"func_name":"placings","file_name":"endpoints.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#162-ba9a72bb9ac5","input":"def markTokenUsedExternal(token, optStr=\"\"):\n conn, c = connectDB()\n req = \"UPDATE {} SET \\\"options_selected\\\"='{}' WHERE token='{}'\".format(CFG(\"tokens_table_name\"), \\\n optStr, token)\n c.execute(req)\n closeDB(conn)","target":"def markTokenUsedExternal(token, optStr=\"\"):\n conn, c = connectDB()\n req = \"UPDATE {} SET \\\"options_selected\\\"=? WHERE token=?\".format(CFG(\"tokens_table_name\"))\n c.execute(req, (optStr, token,))\n closeDB(conn)","lang":"python","vul_type":"cwe-089","target_token_count":59,"sven_meta":{"func_name":"markTokenUsedExternal","file_name":"database.py","commit_link":"github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#163-a2f6b9569969","input":" def get_roster(self, server_id):\n sql = \"\"\"SELECT username, role\n FROM roles\n WHERE roles.server_id = {0};\n \"\"\".format(server_id)\n self.cur.execute(sql)\n return self.cur.fetchall()","target":" def get_roster(self, server_id):\n sql = \"\"\"\n SELECT username, role\n FROM roles\n WHERE roles.server_id = %s;\n \"\"\"\n self.cur.execute(sql, (server_id,))\n return self.cur.fetchall()","lang":"python","vul_type":"cwe-089","target_token_count":51,"sven_meta":{"func_name":"get_roster","file_name":"db/dbase.py","commit_link":"github.com/jgayfer/spirit/commit/01c846c534c8d3cf6763f8b7444a0efe2caa3799","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#164-704addd83613","input":"def retrieve_video(id, playlist_id, db):\n db.execute(\"SELECT id, position from video WHERE id={id} and playlist_id={playlist_id};\".format(\n id=id, playlist_id=playlist_id))\n row = db.fetchone()\n return row","target":"def retrieve_video(id, playlist_id, db):\n db.execute(\n \"SELECT id, position from video WHERE id=%s and playlist_id=%s;\", (id, playlist_id))\n row = db.fetchone()\n return row","lang":"python","vul_type":"cwe-089","target_token_count":47,"sven_meta":{"func_name":"retrieve_video","file_name":"video/video_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#165-a207f8dcff0d","input":" def followFriends(self,userid,friendid):\n sqlText=\"insert into friends values(%d,%d);\"%(friendid,userid)\n result=sql.insertDB(self.conn,sqlText)\n return result;","target":" def followFriends(self,userid,friendid):\n sqlText=\"insert into friends values(%s,%s);\"\n params=[friendid,userid]\n result=sql.insertDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","target_token_count":50,"sven_meta":{"func_name":"followFriends","file_name":"modules/users.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#166-70853c3b7e16","input":"def getGameID(ID):\n\tdb.execute(\"SELECT * FROM games WHERE ID = %i\" % ID)\n\tID = db.fetchone()\n\treturn ID","target":"def getGameID(ID):\n\tdb.execute(\"SELECT * FROM games WHERE ID = ?\", ID)\n\tID = db.fetchone()\n\treturn ID","lang":"python","vul_type":"cwe-089","target_token_count":26,"sven_meta":{"func_name":"getGameID","file_name":"plugins/database.py","commit_link":"github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#168-93edba788617","input":" def userLogin(self):\n\n sqlName=\"select count(*) from users where name='%s' and \\\n password='%s';\"%(self.name,self.password)\n checkName=sql.queryDB(self.conn,sqlName)\n\n result=checkName[0][0]\n if result == 0:\n self.clean()\n return False\n else:\n return True","target":" def userLogin(self):\n\n sqlName=\"select count(*) from users where name=%s and password=%s;\"\n params = [self.name,self.password]\n checkName=sql.queryDB(self.conn,sqlName,params)\n result=checkName[0][0]\n if result == 0:\n self.clean()\n return False\n else:\n return True","lang":"python","vul_type":"cwe-089","target_token_count":78,"sven_meta":{"func_name":"userLogin","file_name":"modules/users.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#169-e459b0e2f2e9","input":"@app.route(\"/search\", methods = [\"POST\"])\ndef search_pages():\n search = request.form.get(\"search\")\n page = db.query(\"select title from page where title = '%s'\" % search).namedresult()\n if len(page) == 0:\n return redirect(\"/%s\" % search)\n else:\n return place_holder(search)","target":"@app.route(\"/search\", methods = [\"POST\"])\ndef search_pages():\n search = request.form.get(\"search\")\n page = db.query(\"select title from page where title = $1\", search).namedresult()\n if len(page) == 0:\n return redirect(\"/%s\" % search)\n else:\n return place_holder(search)","lang":"python","vul_type":"cwe-089","target_token_count":72,"sven_meta":{"func_name":"search_pages","file_name":"server.py","commit_link":"github.com/jcortes0309/wiki_flask/commit/a6bf5316abe2eb528adf36c8241a013fd02c5ffa","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#170-142e3022677a","input":"def get_articles_by_subject(subject):\n with conn.cursor(cursor_factory=DictCursor) as cur:\n query = \"SELECT * FROM articles WHERE subject='\" + subject + \"' ORDER BY last_submitted DESC\"\n cur.execute(query)\n articles = cur.fetchall()\n return articles","target":"def get_articles_by_subject(subject):\n with conn.cursor(cursor_factory=DictCursor) as cur:\n query = \"SELECT * FROM articles WHERE subject=%s ORDER BY last_submitted DESC\"\n cur.execute(query, (subject,))\n articles = cur.fetchall()\n return articles","lang":"python","vul_type":"cwe-089","target_token_count":56,"sven_meta":{"func_name":"get_articles_by_subject","file_name":"app.py","commit_link":"github.com/sepehr125/arxiv-doc2vec-recommender/commit/f23a4c32e6192b145017f64734b0a9a384c9123a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#171-fa88934a0d73","input":" def getQueue(self, numberOfLinks=10):\n self.cursor.execute(\"SELECT url FROM queue WHERE visited = '0' LIMIT {};\".format(numberOfLinks))\n result = self.cursor.fetchall()\n self.remove(result)\n return result","target":" def getQueue(self, numberOfLinks=10):\n self.cursor.execute(\"SELECT url FROM queue WHERE visited = '0' LIMIT ?;\", numberOfLinks)\n result = self.cursor.fetchall()\n self.remove(result)\n return result","lang":"python","vul_type":"cwe-089","target_token_count":48,"sven_meta":{"func_name":"getQueue","file_name":"beta/database.py","commit_link":"github.com/jappe999/WebScraper/commit/46a4e0843aa44d903293637afad53dfcbc37b480","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#175-daa6fec1e08c","input":"@mod.route('/test', methods=['GET', 'POST'])\ndef test():\n user_id = session['logged_id']\n sql = 'SELECT * FROM message where user_id = %d ORDER BY c_time DESC' \\\n % (user_id)\n cursor.execute(sql)\n m = cursor.fetchall()\n print(m)","target":"@mod.route('/test', methods=['GET', 'POST'])\ndef test():\n user_id = session['logged_id']\n cursor.execute('SELECT * FROM message where user_id = %s ORDER BY c_time DESC', (user_id,))\n m = cursor.fetchall()\n print(m)","lang":"python","vul_type":"cwe-089","target_token_count":59,"sven_meta":{"func_name":"test","file_name":"flaskr/flaskr/views/message.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#177-079aaccfc020","input":" def on_save(self):\n connection = get_connection()\n cursor = connection.cursor()\n cursor.execute(\n f\"insert into visitors (ip_address, user_agent, referrer, full_path, visit_time) values ('{self.ip_address}', '{self.user_agent}', '{self.referrer}', '{self.full_path}', '{self.visit_time}');\")\n connection.commit()\n connection.close()\n return 0","target":" def on_save(self):\n connection = get_connection()\n cursor = connection.cursor()\n cursor.execute(\n \"insert into visitors (ip_address, user_agent, referrer, full_path, visit_time) values (%s, %s, %s, %s, %s);\",\n (str(self.ip_address), str(self.user_agent), str(self.referrer), str(self.full_path), self.visit_time))\n connection.commit()\n connection.close()\n return 0","lang":"python","vul_type":"cwe-089","target_token_count":98,"sven_meta":{"func_name":"on_save","file_name":"experimental/python/buford/model/visitor.py","commit_link":"github.com/onewyoming/onewyoming/commit/54fc7b076fda2de74eeb55e6b75b28e09ef231c2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#180-153fe52c7749","input":" def deletePost(self,postid):\n sqlText=\"delete from post where post.postid=%d\"%(postid)\n result=sql.deleteDB(self.conn,sqlText)\n return result;","target":" def deletePost(self,postid):\n sqlText=\"delete from post where post.postid=%s\"\n params=[postid]\n result=sql.deleteDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","target_token_count":46,"sven_meta":{"func_name":"deletePost","file_name":"modules/post.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#182-9840664644de","input":" def update_title(self, title = None):\n if (not self.title):\n self.title = title\n\n # This will fall to a sql injection \n sql = \"UPDATE jdk_entries SET title = '\" + self.title + \"'\" + \\\n \"WHERE jdk_entries.id = '\" + self.entry_id + \"';\" \n\n db_execute(sql)\n \n self.update_date_modified()\n\n return None","target":" def update_title(self, title = None):\n if (not self.title):\n self.title = title\n\n quote_tuple = self.title, self.entry_id\n\n # This will fall to a sql injection \n sql = \"UPDATE jdk_entries SET title = ?\" + \\\n \"WHERE jdk_entries.id = ?;\" \n\n db_execute(sql, quote_tuple)\n \n self.update_date_modified()\n\n return None","lang":"python","vul_type":"cwe-089","target_token_count":88,"sven_meta":{"func_name":"update_title","file_name":"entry.py","commit_link":"github.com/peterlebrun/jdk/commit/000238566fbe55ba09676c3d57af04ae207235ae","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#183-6943827e6f69","input":" def add_language(self, language):\n \"\"\"\"Add new language for item translations.\"\"\"\n if self.connection:\n self.cursor.execute('insert into itemlanguage (language) values (\"%s\")' % language[0])\n self.connection.commit()","target":" def add_language(self, language):\n \"\"\"\"Add new language for item translations.\"\"\"\n if self.connection:\n t = (language[0], )\n self.cursor.execute('insert into itemlanguage (language) values (?)', t)\n self.connection.commit()","lang":"python","vul_type":"cwe-089","target_token_count":54,"sven_meta":{"func_name":"add_language","file_name":"ecosldb/ecosldb.py","commit_link":"github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-125#17-ba0354c92804","input":"static inline size_t GetPSDRowSize(Image *image)\n{\n if (image->depth == 1)\n return((image->columns+7)/8);\n else\n return(image->columns*GetPSDPacketSize(image));\n}","target":"static inline size_t GetPSDRowSize(Image *image)\n{\n if (image->depth == 1)\n return(((image->columns+7)/8)*GetPSDPacketSize(image));\n else\n return(image->columns*GetPSDPacketSize(image));\n}","lang":"c","vul_type":"cwe-125","target_token_count":59,"sven_meta":{"func_name":"GetPSDRowSize","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/5f16640725b1225e6337c62526e6577f0f88edb8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#44-66e9d87c6a51","input":"matchCurrentInput(\n\t\tconst InString *input, int pos, const widechar *passInstructions, int passIC) {\n\tint k;\n\tint kk = pos;\n\tfor (k = passIC + 2; k < passIC + 2 + passInstructions[passIC + 1]; k++)\n\t\tif (input->chars[kk] == ENDSEGMENT || passInstructions[k] != input->chars[kk++])\n\t\t\treturn 0;\n\treturn 1;\n}","target":"matchCurrentInput(\n\t\tconst InString *input, int pos, const widechar *passInstructions, int passIC) {\n\tint k;\n\tint kk = pos;\n\tfor (k = passIC + 2;\n\t\t\t((k < passIC + 2 + passInstructions[passIC + 1]) && (kk < input->length));\n\t\t\tk++)\n\t\tif (input->chars[kk] == ENDSEGMENT || passInstructions[k] != input->chars[kk++])\n\t\t\treturn 0;\n\treturn 1;\n}","lang":"c","vul_type":"cwe-125","target_token_count":111,"sven_meta":{"func_name":"matchCurrentInput","file_name":"liblouis/lou_translateString.c","commit_link":"github.com/liblouis/liblouis/commit/5e4089659bb49b3095fa541fa6387b4c40d7396e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#55-f5c736a5c6b9","input":"int pure_strcmp(const char * const s1, const char * const s2)\n{\n return pure_memcmp(s1, s2, strlen(s1) + 1U);\n}","target":"int pure_strcmp(const char * const s1, const char * const s2)\n{\n const size_t s1_len = strlen(s1);\n const size_t s2_len = strlen(s2);\n\n if (s1_len != s2_len) {\n return -1;\n }\n return pure_memcmp(s1, s2, s1_len);\n}","lang":"c","vul_type":"cwe-125","target_token_count":77,"sven_meta":{"func_name":"pure_strcmp","file_name":"src/utils.c","commit_link":"github.com/jedisct1/pure-ftpd/commit/36c6d268cb190282a2c17106acfd31863121b58e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#62-daf50b8865a3","input":"static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic)\n{\n\tioapic->rtc_status.pending_eoi = 0;\n\tbitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPUS);\n}","target":"static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic)\n{\n\tioapic->rtc_status.pending_eoi = 0;\n\tbitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID);\n}","lang":"c","vul_type":"cwe-125","target_token_count":53,"sven_meta":{"func_name":"rtc_irq_eoi_tracking_reset","file_name":"arch/x86/kvm/ioapic.c","commit_link":"github.com/torvalds/linux/commit/81cdb259fb6d8c1c4ecfeea389ff5a73c07f5755","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#76-d3549ed8811e","input":"ssize_t enc_untrusted_read(int fd, void *buf, size_t count) {\n return static_cast(EnsureInitializedAndDispatchSyscall(\n asylo::system_call::kSYS_read, fd, buf, count));\n}","target":"ssize_t enc_untrusted_read(int fd, void *buf, size_t count) {\n ssize_t ret = static_cast(EnsureInitializedAndDispatchSyscall(\n asylo::system_call::kSYS_read, fd, buf, count));\n if (ret != -1 && ret > count) {\n ::asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_read: read result exceeds requested\");\n }\n return ret;\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":104,"sven_meta":{"func_name":"enc_untrusted_read","file_name":"asylo/platform/host_call/trusted/host_calls.cc","commit_link":"github.com/google/asylo/commit/b1d120a2c7d7446d2cc58d517e20a1b184b82200","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#95-aa73fa6e51f7","input":"const TfLiteTensor* GetOptionalInputTensor(const TfLiteContext* context,\n const TfLiteNode* node, int index) {\n const bool use_tensor = index < node->inputs->size &&\n node->inputs->data[index] != kTfLiteOptionalTensor;\n if (use_tensor) {\n return GetMutableInput(context, node, index);\n }\n return nullptr;\n}","target":"const TfLiteTensor* GetOptionalInputTensor(const TfLiteContext* context,\n const TfLiteNode* node, int index) {\n return GetInput(context, node, index);\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":39,"sven_meta":{"func_name":"tflite::GetOptionalInputTensor","file_name":"tensorflow/lite/kernels/kernel_util.cc","commit_link":"github.com/tensorflow/tensorflow/commit/00302787b788c5ff04cb6f62aed5a74d936e86c0","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#99-5f94022d85cc","input":"static void ip_cmsg_recv_checksum(struct msghdr *msg, struct sk_buff *skb,\n\t\t\t\t int tlen, int offset)\n{\n\t__wsum csum = skb->csum;\n\n\tif (skb->ip_summed != CHECKSUM_COMPLETE)\n\t\treturn;\n\n\tif (offset != 0)\n\t\tcsum = csum_sub(csum,\n\t\t\t\tcsum_partial(skb_transport_header(skb) + tlen,\n\t\t\t\t\t offset, 0));\n\n\tput_cmsg(msg, SOL_IP, IP_CHECKSUM, sizeof(__wsum), &csum);\n}","target":"static void ip_cmsg_recv_checksum(struct msghdr *msg, struct sk_buff *skb,\n\t\t\t\t int tlen, int offset)\n{\n\t__wsum csum = skb->csum;\n\n\tif (skb->ip_summed != CHECKSUM_COMPLETE)\n\t\treturn;\n\n\tif (offset != 0) {\n\t\tint tend_off = skb_transport_offset(skb) + tlen;\n\t\tcsum = csum_sub(csum, skb_checksum(skb, tend_off, offset, 0));\n\t}\n\n\tput_cmsg(msg, SOL_IP, IP_CHECKSUM, sizeof(__wsum), &csum);\n}","lang":"c","vul_type":"cwe-125","target_token_count":124,"sven_meta":{"func_name":"ip_cmsg_recv_checksum","file_name":"net/ipv4/ip_sockglue.c","commit_link":"github.com/torvalds/linux/commit/ca4ef4574f1ee5252e2cd365f8f5d5bafd048f32","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#106-6cf45e7c2ef9","input":"BOOL security_fips_decrypt(BYTE* data, size_t length, rdpRdp* rdp)\n{\n\tsize_t olen;\n\n\tif (!winpr_Cipher_Update(rdp->fips_decrypt, data, length, data, &olen))\n\t\treturn FALSE;\n\n\treturn TRUE;\n}","target":"BOOL security_fips_decrypt(BYTE* data, size_t length, rdpRdp* rdp)\n{\n\tsize_t olen;\n\n\tif (!rdp || !rdp->fips_decrypt)\n\t\treturn FALSE;\n\n\tif (!winpr_Cipher_Update(rdp->fips_decrypt, data, length, data, &olen))\n\t\treturn FALSE;\n\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-125","target_token_count":76,"sven_meta":{"func_name":"security_fips_decrypt","file_name":"libfreerdp/core/security.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/d6cd14059b257318f176c0ba3ee0a348826a9ef8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#121-30f32dd44c31","input":"static int uas_switch_interface(struct usb_device *udev,\n\t\t\t\tstruct usb_interface *intf)\n{\n\tint alt;\n\n\talt = uas_find_uas_alt_setting(intf);\n\tif (alt < 0)\n\t\treturn alt;\n\n\treturn usb_set_interface(udev,\n\t\t\tintf->altsetting[0].desc.bInterfaceNumber, alt);\n}","target":"static int uas_switch_interface(struct usb_device *udev,\n\t\t\t\tstruct usb_interface *intf)\n{\n\tstruct usb_host_interface *alt;\n\n\talt = uas_find_uas_alt_setting(intf);\n\tif (!alt)\n\t\treturn -ENODEV;\n\n\treturn usb_set_interface(udev, alt->desc.bInterfaceNumber,\n\t\t\talt->desc.bAlternateSetting);\n}","lang":"c","vul_type":"cwe-125","target_token_count":75,"sven_meta":{"func_name":"uas_switch_interface","file_name":"drivers/usb/storage/uas.c","commit_link":"github.com/torvalds/linux/commit/786de92b3cb26012d3d0f00ee37adf14527f35c4","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-078#3-2749cd99d586","input":" def _cliq_run(self, verb, cliq_args, check_exit_code=True):\n \"\"\"Runs a CLIQ command over SSH, without doing any result parsing\"\"\"\n cliq_arg_strings = []\n for k, v in cliq_args.items():\n cliq_arg_strings.append(\" %s=%s\" % (k, v))\n cmd = verb + ''.join(cliq_arg_strings)\n\n return self._run_ssh(cmd, check_exit_code)","target":" def _cliq_run(self, verb, cliq_args, check_exit_code=True):\n \"\"\"Runs a CLIQ command over SSH, without doing any result parsing\"\"\"\n cmd_list = [verb]\n for k, v in cliq_args.items():\n cmd_list.append(\"%s=%s\" % (k, v))\n\n return self._run_ssh(cmd_list, check_exit_code)","lang":"python","vul_type":"cwe-078","target_token_count":81,"sven_meta":{"func_name":"_cliq_run","file_name":"cinder/volume/drivers/san/hp_lefthand.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#4-3d9210fc8110","input":" def _set_qos_rule(self, qos, vvs_name):\n max_io = self._get_qos_value(qos, 'maxIOPS')\n max_bw = self._get_qos_value(qos, 'maxBWS')\n cli_qos_string = \"\"\n if max_io is not None:\n cli_qos_string += ('-io %s ' % max_io)\n if max_bw is not None:\n cli_qos_string += ('-bw %sM ' % max_bw)\n self._cli_run('setqos %svvset:%s' %\n (cli_qos_string, vvs_name), None)","target":" def _set_qos_rule(self, qos, vvs_name):\n max_io = self._get_qos_value(qos, 'maxIOPS')\n max_bw = self._get_qos_value(qos, 'maxBWS')\n cli_qos_string = \"\"\n if max_io is not None:\n cli_qos_string += ('-io %s ' % max_io)\n if max_bw is not None:\n cli_qos_string += ('-bw %sM ' % max_bw)\n self._cli_run(['setqos', '%svvset:%s' % (cli_qos_string, vvs_name)])","lang":"python","vul_type":"cwe-078","target_token_count":127,"sven_meta":{"func_name":"_set_qos_rule","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#5-28ceb7882167","input":"def get_lines(command: str) -> List[str]:\n \"\"\"\n Run a command and return lines of output\n\n :param str command: the command to run\n :returns: list of whitespace-stripped lines output by command\n \"\"\"\n stdout = get_output(command)\n return [line.strip().decode() for line in stdout.splitlines()]","target":"def get_lines(command: List[str]) -> List[str]:\n \"\"\"\n Run a command and return lines of output\n\n :param str command: the command to run\n :returns: list of whitespace-stripped lines output by command\n \"\"\"\n stdout = get_output(command)\n return [line.strip() for line in stdout.splitlines()]","lang":"python","vul_type":"cwe-078","target_token_count":72,"sven_meta":{"func_name":"get_lines","file_name":"isort/hooks.py","commit_link":"github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#6-fe9caa64b7b7","input":" def _modify_3par_iscsi_host(self, hostname, iscsi_iqn):\n # when using -add, you can not send the persona or domain options\n self.common._cli_run('createhost -iscsi -add %s %s'\n % (hostname, iscsi_iqn), None)","target":" def _modify_3par_iscsi_host(self, hostname, iscsi_iqn):\n # when using -add, you can not send the persona or domain options\n command = ['createhost', '-iscsi', '-add', hostname, iscsi_iqn]\n self.common._cli_run(command)","lang":"python","vul_type":"cwe-078","target_token_count":66,"sven_meta":{"func_name":"_modify_3par_iscsi_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_iscsi.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#9-d568442eb4a9","input":"def whitelist(users: str):\n for user in users.split():\n call(WHITELIST_COMMAND_TEMPLATE.format(user))","target":"def whitelist(channel: discord.TextChannel, users: str):\n for user in users.split():\n if not re.match(r'^[A-Za-z0-9_]{3,16}$', user): # as per https://help.mojang.com/customer/en/portal/articles/928638-minecraft-usernames?b_id=5408\n await channel.send('\\'{}\\' is not a valid Minecraft username'.format(user))\n else:\n call(WHITELIST_COMMAND_TEMPLATE.format(user))","lang":"python","vul_type":"cwe-078","target_token_count":112,"sven_meta":{"func_name":"whitelist","file_name":"bot.py","commit_link":"github.com/thomotron/Gatekeep/commit/955660f9b3dc336ab0d5dfb4392b3ab6deac6b25","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#24-3887008d41bf","input":"@app.route('/api/uploads//logs')\ndef get_logs(sid):\n if '/' not in sid:\n path = os.path.join(app.config['UPLOAD_FOLDER'], sid)\n if os.path.isfile(os.path.join(path, app.config['LOG_FILE'])):\n return send_from_directory(directory=path,\n filename=app.config['LOG_FILE'])\n else:\n abort(404)\n else:\n abort(403)","target":"@app.route('/api/uploads//logs')\ndef get_logs(sid):\n if utils.sid_is_valid(sid):\n path = join(app.config['UPLOAD_FOLDER'], sid)\n\n if os.path.isfile(join(path, app.config['LOG_FILE'])):\n return send_from_directory(directory=path,\n filename=app.config['LOG_FILE'])\n else:\n abort(404)\n else:\n abort(404)","lang":"python","vul_type":"cwe-078","target_token_count":87,"sven_meta":{"func_name":"get_logs","file_name":"app/views.py","commit_link":"github.com/cheukyin699/genset-demo-site/commit/abb55b1a6786b0a995c2cdf77a7977a1d51cfc0d","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#29-780234f49746","input":" def ls(self, data, path):\n credentials = self._formatCredentials(data, name='current')\n\n command = (\n '{credentials} '\n 'rclone lsjson current:{path}'\n ).format(\n credentials=credentials,\n path=path,\n )\n\n try:\n result = self._execute(command)\n result = json.loads(result)\n return result\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))","target":" def ls(self, data, path):\n credentials = self._formatCredentials(data, name='current')\n command = [\n 'rclone',\n 'lsjson',\n 'current:{}'.format(path),\n ]\n\n try:\n result = self._execute(command, credentials)\n result = json.loads(result)\n return result\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))","lang":"python","vul_type":"cwe-078","target_token_count":90,"sven_meta":{"func_name":"ls","file_name":"src/backend/api/utils/rclone_connection.py","commit_link":"github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#31-0667a378a149","input":" def verify(self, data):\n credentials = self._formatCredentials(data, name='current')\n command = '{} rclone lsjson current:'.format(credentials)\n\n try:\n result = self._execute(command)\n return {\n 'result': True,\n 'message': 'Success',\n }\n except subprocess.CalledProcessError as e:\n returncode = e.returncode\n return {\n 'result': False,\n 'message': 'Exit status {}'.format(returncode),\n }","target":" def verify(self, data):\n credentials = self._formatCredentials(data, name='current')\n command = [\n 'rclone',\n 'lsjson',\n 'current:',\n ]\n\n try:\n result = self._execute(command, credentials)\n return {\n 'result': True,\n 'message': 'Success',\n }\n except subprocess.CalledProcessError as e:\n returncode = e.returncode\n return {\n 'result': False,\n 'message': 'Exit status {}'.format(returncode),\n }","lang":"python","vul_type":"cwe-078","target_token_count":112,"sven_meta":{"func_name":"verify","file_name":"src/backend/api/utils/rclone_connection.py","commit_link":"github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#33-aba413e8fa92","input":" def _get_vdisk_fc_mappings(self, vdisk_name):\n \"\"\"Return FlashCopy mappings that this vdisk is associated with.\"\"\"\n\n ssh_cmd = 'svcinfo lsvdiskfcmappings -nohdr %s' % vdisk_name\n out, err = self._run_ssh(ssh_cmd)\n\n mapping_ids = []\n if (len(out.strip())):\n lines = out.strip().split('\\n')\n mapping_ids = [line.split()[0] for line in lines]\n return mapping_ids","target":" def _get_vdisk_fc_mappings(self, vdisk_name):\n \"\"\"Return FlashCopy mappings that this vdisk is associated with.\"\"\"\n\n ssh_cmd = ['svcinfo', 'lsvdiskfcmappings', '-nohdr', vdisk_name]\n out, err = self._run_ssh(ssh_cmd)\n\n mapping_ids = []\n if (len(out.strip())):\n lines = out.strip().split('\\n')\n mapping_ids = [line.split()[0] for line in lines]\n return mapping_ids","lang":"python","vul_type":"cwe-078","target_token_count":107,"sven_meta":{"func_name":"_get_vdisk_fc_mappings","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#36-b80859948956","input":" def _get_active_nsp(self, hostname):\n \"\"\"Return the active nsp, if one exists, for the given host.\"\"\"\n result = self.common._cli_run('showvlun -a -host %s' % hostname, None)\n if result:\n # first line is header\n result = result[1:]\n for line in result:\n info = line.split(\",\")\n if info and len(info) > 4:\n return info[4]","target":" def _get_active_nsp(self, hostname):\n \"\"\"Return the active nsp, if one exists, for the given host.\"\"\"\n result = self.common._cli_run(['showvlun', '-a', '-host', hostname])\n if result:\n # first line is header\n result = result[1:]\n for line in result:\n info = line.split(\",\")\n if info and len(info) > 4:\n return info[4]","lang":"python","vul_type":"cwe-078","target_token_count":96,"sven_meta":{"func_name":"_get_active_nsp","file_name":"cinder/volume/drivers/san/hp/hp_3par_iscsi.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#38-1738ca2b645f","input":" def mkdir(self, data, path):\n credentials = self._formatCredentials(data, name='current')\n\n command = (\n '{credentials} '\n 'rclone touch current:{path}/.keep'\n ).format(\n credentials=credentials,\n path=path,\n )\n\n try:\n result = self._execute(command)\n return {\n 'message': 'Success',\n }\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))","target":" def mkdir(self, data, path):\n credentials = self._formatCredentials(data, name='current')\n command = [\n 'rclone',\n 'touch',\n 'current:{}/.keep'.format(path),\n ]\n\n try:\n result = self._execute(command, credentials)\n return {\n 'message': 'Success',\n }\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))","lang":"python","vul_type":"cwe-078","target_token_count":93,"sven_meta":{"func_name":"mkdir","file_name":"src/backend/api/utils/rclone_connection.py","commit_link":"github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#42-407563b7e25f","input":" def _remove_volume_from_volume_set(self, volume_name, vvs_name):\n self._cli_run('removevvset -f %s %s' % (vvs_name, volume_name), None)","target":" def _remove_volume_from_volume_set(self, volume_name, vvs_name):\n self._cli_run(['removevvset', '-f', vvs_name, volume_name])","lang":"python","vul_type":"cwe-078","target_token_count":37,"sven_meta":{"func_name":"_remove_volume_from_volume_set","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#44-2097a321f7c9","input":" def _add_chapsecret_to_host(self, host_name):\n \"\"\"Generate and store a randomly-generated CHAP secret for the host.\"\"\"\n\n chap_secret = utils.generate_password()\n ssh_cmd = ('svctask chhost -chapsecret \"%(chap_secret)s\" %(host_name)s'\n % {'chap_secret': chap_secret, 'host_name': host_name})\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from chhost\n self._assert_ssh_return(len(out.strip()) == 0,\n '_add_chapsecret_to_host', ssh_cmd, out, err)\n return chap_secret","target":" def _add_chapsecret_to_host(self, host_name):\n \"\"\"Generate and store a randomly-generated CHAP secret for the host.\"\"\"\n\n chap_secret = utils.generate_password()\n ssh_cmd = ['svctask', 'chhost', '-chapsecret', chap_secret, host_name]\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from chhost\n self._assert_ssh_return(len(out.strip()) == 0,\n '_add_chapsecret_to_host', ssh_cmd, out, err)\n return chap_secret","lang":"python","vul_type":"cwe-078","target_token_count":119,"sven_meta":{"func_name":"_add_chapsecret_to_host","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#47-0f61a83ed3f1","input":" def on_message( self, profile_id, profile_name, level, message, timeout ):\n if 1 == level:\n cmd = \"notify-send \"\n if timeout > 0:\n cmd = cmd + \" -t %s\" % (1000 * timeout)\n\n title = \"Back In Time (%s) : %s\" % (self.user, profile_name)\n message = message.replace(\"\\n\", ' ')\n message = message.replace(\"\\r\", '')\n\n cmd = cmd + \" \\\"%s\\\" \\\"%s\\\"\" % (title, message)\n print(cmd)\n os.system(cmd)\n return","target":" def on_message( self, profile_id, profile_name, level, message, timeout ):\n if 1 == level:\n cmd = ['notify-send']\n if timeout > 0:\n cmd.extend(['-t', str(1000 * timeout)])\n\n title = \"Back In Time (%s) : %s\" % (self.user, profile_name)\n message = message.replace(\"\\n\", ' ')\n message = message.replace(\"\\r\", '')\n\n cmd.append(title)\n cmd.append(message)\n subprocess.Popen(cmd).communicate()\n return","lang":"python","vul_type":"cwe-078","target_token_count":117,"sven_meta":{"func_name":"on_message","file_name":"qt4/plugins/notifyplugin.py","commit_link":"github.com/bit-team/backintime/commit/cef81d0da93ff601252607df3db1a48f7f6f01b3","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#48-d9e4237d3d32","input":"void pb_controller::play_file(const std::string& file) {\n\tstd::string cmdline;\n\tstd::string player = cfg->get_configvalue(\"player\");\n\tif (player == \"\")\n\t\treturn;\n\tcmdline.append(player);\n\tcmdline.append(\" \\\"\");\n\tcmdline.append(utils::replace_all(file,\"\\\"\", \"\\\\\\\"\"));\n\tcmdline.append(\"\\\"\");\n\tstfl::reset();\n\tutils::run_interactively(cmdline, \"pb_controller::play_file\");\n}","target":"void pb_controller::play_file(const std::string& file) {\n\tstd::string cmdline;\n\tstd::string player = cfg->get_configvalue(\"player\");\n\tif (player == \"\")\n\t\treturn;\n\tcmdline.append(player);\n\tcmdline.append(\" '\");\n\tcmdline.append(utils::replace_all(file,\"'\", \"%27\"));\n\tcmdline.append(\"'\");\n\tstfl::reset();\n\tutils::run_interactively(cmdline, \"pb_controller::play_file\");\n}","lang":"cpp","vul_type":"cwe-078","target_token_count":91,"sven_meta":{"func_name":"podbeuter::pb_controller::play_file","file_name":"src/pb_controller.cpp","commit_link":"github.com/akrennmair/newsbeuter/commit/c8fea2f60c18ed30bdd1bb6f798e994e51a58260","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#52-7eebfc1fd84c","input":"def get_output(command: str) -> bytes:\n \"\"\"\n Run a command and return raw output\n\n :param str command: the command to run\n :returns: the stdout output of the command\n \"\"\"\n return subprocess.check_output(command.split())","target":"def get_output(command: List[str]) -> str:\n \"\"\"\n Run a command and return raw output\n\n :param str command: the command to run\n :returns: the stdout output of the command\n \"\"\"\n result = subprocess.run(command, stdout=subprocess.PIPE, check=True)\n return result.stdout.decode()","lang":"python","vul_type":"cwe-078","target_token_count":66,"sven_meta":{"func_name":"get_output","file_name":"isort/hooks.py","commit_link":"github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#54-3e841e7e2ab2","input":"def add_user(username, password):\n encPass = crypt.crypt(password,\"22\")\n os.system(\"useradd -G docker,wheel -p \"+encPass+\" \"+username)","target":"def add_user(username, password):\n encPass = crypt.crypt(password,\"22\")\n #subprocess escapes the username stopping code injection\n subprocess.call(['useradd','-G','docker,wheel','-p',encPass,username])","lang":"python","vul_type":"cwe-078","target_token_count":50,"sven_meta":{"func_name":"add_user","file_name":"vuedj/configtitania/views.py","commit_link":"github.com/Internet-of-People/titania-os/commit/9b7805119938343fcac9dc929d8882f1d97cf14a","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#61-dc3536a3c0b9","input":"@then(parsers.parse(\"the hostname '{hostname}' should be resolved\"))\ndef resolve_hostname(busybox_pod, host, hostname):\n with host.sudo():\n # test dns resolve\n cmd_nslookup = (\"kubectl --kubeconfig=/etc/kubernetes/admin.conf\"\n \" exec -ti {0} nslookup {1}\".format(\n pod_name,\n hostname))\n res = host.run(cmd_nslookup)\n assert res.rc == 0, \"Cannot resolve {}\".format(hostname)","target":"@then(parsers.parse(\"the hostname '{hostname}' should be resolved\"))\ndef resolve_hostname(busybox_pod, host, hostname):\n with host.sudo():\n # test dns resolve\n result = host.run(\n \"kubectl --kubeconfig=/etc/kubernetes/admin.conf \"\n \"exec -ti %s nslookup %s\",\n busybox_pod,\n hostname,\n )\n\n assert result.rc == 0, \"Cannot resolve {}\".format(hostname)","lang":"python","vul_type":"cwe-078","target_token_count":94,"sven_meta":{"func_name":"resolve_hostname","file_name":"tests/post/steps/test_dns.py","commit_link":"github.com/scality/metalk8s/commit/82d92836d4ff78c623a0e06302c94cfa5ff79908","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#62-a97be4ff9b58","input":" def _modify_3par_fibrechan_host(self, hostname, wwn):\n # when using -add, you can not send the persona or domain options\n out = self.common._cli_run('createhost -add %s %s'\n % (hostname, \" \".join(wwn)), None)","target":" def _modify_3par_fibrechan_host(self, hostname, wwns):\n # when using -add, you can not send the persona or domain options\n command = ['createhost', '-add', hostname]\n for wwn in wwns:\n command.append(wwn)\n\n out = self.common._cli_run(command)","lang":"python","vul_type":"cwe-078","target_token_count":74,"sven_meta":{"func_name":"_modify_3par_fibrechan_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_fc.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#67-710824cc00da","input":" def adb_call(*args):\n clean_name = name.replace('_', '-')\n arg_str = ' '.join(str(elem) for elem in args)\n return self._exec_adb_cmd(clean_name, arg_str)","target":" def adb_call(args=None, shell=False):\n \"\"\"Wrapper for an ADB command.\n\n Args:\n args: string or list of strings, arguments to the adb command.\n See subprocess.Proc() documentation.\n shell: bool, True to run this command through the system shell,\n False to invoke it directly. See subprocess.Proc() docs.\n\n Returns:\n The output of the adb command run if exit code is 0.\n \"\"\"\n args = args or ''\n clean_name = name.replace('_', '-')\n return self._exec_adb_cmd(clean_name, args, shell=shell)","lang":"python","vul_type":"cwe-078","target_token_count":125,"sven_meta":{"func_name":"__getattr__.adb_call","file_name":"mobly/controllers/android_device_lib/adb.py","commit_link":"github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#70-1eb822794898","input":" def tcp_forward(self, host_port, device_port):\n \"\"\"Starts tcp forwarding.\n\n Args:\n host_port: Port number to use on the computer.\n device_port: Port number to use on the android device.\n \"\"\"\n self.forward('tcp:%d tcp:%d' % (host_port, device_port))","target":" def tcp_forward(self, host_port, device_port):\n \"\"\"Starts tcp forwarding.\n\n Args:\n host_port: Port number to use on the computer.\n device_port: Port number to use on the android device.\n \"\"\"\n self.forward(['tcp:%d' % host_port, 'tcp:%d' % device_port])","lang":"python","vul_type":"cwe-078","target_token_count":70,"sven_meta":{"func_name":"tcp_forward","file_name":"mobly/controllers/android_device_lib/adb.py","commit_link":"github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#73-f2f42b9cbbe4","input":" def _remove_volume_set(self, vvs_name):\n # Must first clear the QoS rules before removing the volume set\n self._cli_run('setqos -clear vvset:%s' % (vvs_name), None)\n self._cli_run('removevvset -f %s' % (vvs_name), None)","target":" def _remove_volume_set(self, vvs_name):\n # Must first clear the QoS rules before removing the volume set\n self._cli_run(['setqos', '-clear', 'vvset:%s' % (vvs_name)])\n self._cli_run(['removevvset', '-f', vvs_name])","lang":"python","vul_type":"cwe-078","target_token_count":68,"sven_meta":{"func_name":"_remove_volume_set","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#78-692aef5d8428","input":" def _cli_run(self, verb, cli_args):\n \"\"\"Runs a CLI command over SSH, without doing any result parsing.\"\"\"\n cli_arg_strings = []\n if cli_args:\n for k, v in cli_args.items():\n if k == '':\n cli_arg_strings.append(\" %s\" % k)\n else:\n cli_arg_strings.append(\" %s=%s\" % (k, v))\n\n cmd = verb + ''.join(cli_arg_strings)\n LOG.debug(\"SSH CMD = %s \" % cmd)\n\n (stdout, stderr) = self._run_ssh(cmd, False)\n\n # we have to strip out the input and exit lines\n tmp = stdout.split(\"\\r\\n\")\n out = tmp[5:len(tmp) - 2]\n return out","target":" def _cli_run(self, cmd):\n \"\"\"Runs a CLI command over SSH, without doing any result parsing.\"\"\"\n LOG.debug(\"SSH CMD = %s \" % cmd)\n\n (stdout, stderr) = self._run_ssh(cmd, False)\n\n # we have to strip out the input and exit lines\n tmp = stdout.split(\"\\r\\n\")\n out = tmp[5:len(tmp) - 2]\n return out","lang":"python","vul_type":"cwe-078","target_token_count":90,"sven_meta":{"func_name":"_cli_run","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#84-50aaf885963a","input":" def _get_conn_fc_wwpns(self, host_name):\n wwpns = []\n cmd = 'svcinfo lsfabric -host %s' % host_name\n generator = self._port_conf_generator(cmd)\n header = next(generator, None)\n if not header:\n return wwpns\n\n for port_data in generator:\n try:\n wwpns.append(port_data['local_wwpn'])\n except KeyError as e:\n self._handle_keyerror('lsfabric', header)\n\n return wwpns","target":" def _get_conn_fc_wwpns(self, host_name):\n wwpns = []\n cmd = ['svcinfo', 'lsfabric', '-host', host_name]\n generator = self._port_conf_generator(cmd)\n header = next(generator, None)\n if not header:\n return wwpns\n\n for port_data in generator:\n try:\n wwpns.append(port_data['local_wwpn'])\n except KeyError as e:\n self._handle_keyerror('lsfabric', header)\n\n return wwpns","lang":"python","vul_type":"cwe-078","target_token_count":113,"sven_meta":{"func_name":"_get_conn_fc_wwpns","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#86-b6b329d00d9b","input":" def _delete_3par_host(self, hostname):\n self._cli_run('removehost %s' % hostname, None)","target":" def _delete_3par_host(self, hostname):\n self._cli_run(['removehost', hostname])","lang":"python","vul_type":"cwe-078","target_token_count":23,"sven_meta":{"func_name":"_delete_3par_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#88-e006b7badd21","input":" def _delete_host(self, host_name):\n \"\"\"Delete a host on the storage system.\"\"\"\n\n LOG.debug(_('enter: _delete_host: host %s ') % host_name)\n\n ssh_cmd = 'svctask rmhost %s ' % host_name\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from rmhost\n self._assert_ssh_return(len(out.strip()) == 0,\n '_delete_host', ssh_cmd, out, err)\n\n LOG.debug(_('leave: _delete_host: host %s ') % host_name)","target":" def _delete_host(self, host_name):\n \"\"\"Delete a host on the storage system.\"\"\"\n\n LOG.debug(_('enter: _delete_host: host %s ') % host_name)\n\n ssh_cmd = ['svctask', 'rmhost', host_name]\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from rmhost\n self._assert_ssh_return(len(out.strip()) == 0,\n '_delete_host', ssh_cmd, out, err)\n\n LOG.debug(_('leave: _delete_host: host %s ') % host_name)","lang":"python","vul_type":"cwe-078","target_token_count":122,"sven_meta":{"func_name":"_delete_host","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-476#6-5544abd56a8e","input":"static int changedline (const Proto *p, int oldpc, int newpc) {\n while (oldpc++ < newpc) {\n if (p->lineinfo[oldpc] != 0)\n return (luaG_getfuncline(p, oldpc - 1) != luaG_getfuncline(p, newpc));\n }\n return 0; /* no line changes in the way */\n}","target":"static int changedline (const Proto *p, int oldpc, int newpc) {\n if (p->lineinfo == NULL) /* no debug information? */\n return 0;\n while (oldpc++ < newpc) {\n if (p->lineinfo[oldpc] != 0)\n return (luaG_getfuncline(p, oldpc - 1) != luaG_getfuncline(p, newpc));\n }\n return 0; /* no line changes between positions */\n}","lang":"c","vul_type":"cwe-476","target_token_count":110,"sven_meta":{"func_name":"changedline","file_name":"ldebug.c","commit_link":"github.com/lua/lua/commit/ae5b5ba529753c7a653901ffc29b5ea24c3fdf3a","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#16-e7b8e1971aa9","input":"mrb_class_real(struct RClass* cl)\n{\n if (cl == 0)\n return NULL;\n while ((cl->tt == MRB_TT_SCLASS) || (cl->tt == MRB_TT_ICLASS)) {\n cl = cl->super;\n }\n return cl;\n}","target":"mrb_class_real(struct RClass* cl)\n{\n if (cl == 0) return NULL;\n while ((cl->tt == MRB_TT_SCLASS) || (cl->tt == MRB_TT_ICLASS)) {\n cl = cl->super;\n if (cl == 0) return NULL;\n }\n return cl;\n}","lang":"c","vul_type":"cwe-476","target_token_count":76,"sven_meta":{"func_name":"mrb_class_real","file_name":"src/class.c","commit_link":"github.com/mruby/mruby/commit/faa4eaf6803bd11669bc324b4c34e7162286bfa3","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#28-da074368d1c7","input":"file_transfer_t *imcb_file_send_start(struct im_connection *ic, char *handle, char *file_name, size_t file_size)\n{\n\tbee_t *bee = ic->bee;\n\tbee_user_t *bu = bee_user_by_handle(bee, ic, handle);\n\n\tif (bee->ui->ft_in_start) {\n\t\treturn bee->ui->ft_in_start(bee, bu, file_name, file_size);\n\t} else {\n\t\treturn NULL;\n\t}\n}","target":"file_transfer_t *imcb_file_send_start(struct im_connection *ic, char *handle, char *file_name, size_t file_size)\n{\n\tbee_t *bee = ic->bee;\n\tbee_user_t *bu = bee_user_by_handle(bee, ic, handle);\n\n\tif (bee->ui->ft_in_start && bu) {\n\t\treturn bee->ui->ft_in_start(bee, bu, file_name, file_size);\n\t} else {\n\t\treturn NULL;\n\t}\n}","lang":"c","vul_type":"cwe-476","target_token_count":102,"sven_meta":{"func_name":"imcb_file_send_start","file_name":"protocols/bee_ft.c","commit_link":"github.com/bitlbee/bitlbee/commit/701ab8129ba9ea64f569daedca9a8603abad740f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#40-803fea2fbe49","input":"static void copyIPv6IfDifferent(void * dest, const void * src)\n{\n\tif(dest != src) {\n\t\tmemcpy(dest, src, sizeof(struct in6_addr));\n\t}\n}","target":"static void copyIPv6IfDifferent(void * dest, const void * src)\n{\n\tif(dest != src && src != NULL) {\n\t\tmemcpy(dest, src, sizeof(struct in6_addr));\n\t}\n}","lang":"c","vul_type":"cwe-476","target_token_count":42,"sven_meta":{"func_name":"copyIPv6IfDifferent","file_name":"miniupnpd/pcpserver.c","commit_link":"github.com/miniupnp/miniupnp/commit/cb8a02af7a5677cf608e86d57ab04241cf34e24f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#52-c11e40dd75e7","input":"static int __init fm10k_init_module(void)\n{\n\tpr_info(\"%s - version %s\\n\", fm10k_driver_string, fm10k_driver_version);\n\tpr_info(\"%s\\n\", fm10k_copyright);\n\n\t/* create driver workqueue */\n\tfm10k_workqueue = alloc_workqueue(\"%s\", WQ_MEM_RECLAIM, 0,\n\t\t\t\t\t fm10k_driver_name);\n\n\tfm10k_dbg_init();\n\n\treturn fm10k_register_pci_driver();\n}","target":"static int __init fm10k_init_module(void)\n{\n\tpr_info(\"%s - version %s\\n\", fm10k_driver_string, fm10k_driver_version);\n\tpr_info(\"%s\\n\", fm10k_copyright);\n\n\t/* create driver workqueue */\n\tfm10k_workqueue = alloc_workqueue(\"%s\", WQ_MEM_RECLAIM, 0,\n\t\t\t\t\t fm10k_driver_name);\n\tif (!fm10k_workqueue)\n\t\treturn -ENOMEM;\n\n\tfm10k_dbg_init();\n\n\treturn fm10k_register_pci_driver();\n}","lang":"c","vul_type":"cwe-476","target_token_count":120,"sven_meta":{"func_name":"fm10k_init_module","file_name":"drivers/net/ethernet/intel/fm10k/fm10k_main.c","commit_link":"github.com/torvalds/linux/commit/01ca667133d019edc9f0a1f70a272447c84ec41f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#67-65d9f9ddfcb5","input":"filter_session_io(struct io *io, int evt, void *arg)\n{\n\tstruct filter_session *fs = arg;\n\tchar *line = NULL;\n\tssize_t len;\n\n\tlog_trace(TRACE_IO, \"filter session: %p: %s %s\", fs, io_strevent(evt),\n\t io_strio(io));\n\n\tswitch (evt) {\n\tcase IO_DATAIN:\n\tnextline:\n\t\tline = io_getline(fs->io, &len);\n\t\t/* No complete line received */\n\t\tif (line == NULL)\n\t\t\treturn;\n\n\t\tfilter_data(fs->id, line);\n\n\t\tgoto nextline;\n\n\tcase IO_DISCONNECTED:\n\t\tio_free(fs->io);\n\t\tfs->io = NULL;\n\t\tbreak;\n\t}\n}","target":"filter_session_io(struct io *io, int evt, void *arg)\n{\n\tstruct filter_session *fs = arg;\n\tchar *line = NULL;\n\tssize_t len;\n\n\tlog_trace(TRACE_IO, \"filter session: %p: %s %s\", fs, io_strevent(evt),\n\t io_strio(io));\n\n\tswitch (evt) {\n\tcase IO_DATAIN:\n\tnextline:\n\t\tline = io_getline(fs->io, &len);\n\t\t/* No complete line received */\n\t\tif (line == NULL)\n\t\t\treturn;\n\n\t\tfilter_data(fs->id, line);\n\n\t\tgoto nextline;\n\t}\n}","lang":"c","vul_type":"cwe-476","target_token_count":128,"sven_meta":{"func_name":"filter_session_io","file_name":"usr.sbin/smtpd/lka_filter.c","commit_link":"github.com/openbsd/src/commit/6c3220444ed06b5796dedfd53a0f4becd903c0d1","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-416#0-eb9b3e8040bf","input":"static void disk_seqf_stop(struct seq_file *seqf, void *v)\n{\n\tstruct class_dev_iter *iter = seqf->private;\n\n\t/* stop is called even after start failed :-( */\n\tif (iter) {\n\t\tclass_dev_iter_exit(iter);\n\t\tkfree(iter);\n\t}\n}","target":"static void disk_seqf_stop(struct seq_file *seqf, void *v)\n{\n\tstruct class_dev_iter *iter = seqf->private;\n\n\t/* stop is called even after start failed :-( */\n\tif (iter) {\n\t\tclass_dev_iter_exit(iter);\n\t\tkfree(iter);\n\t\tseqf->private = NULL;\n\t}\n}","lang":"c","vul_type":"cwe-416","target_token_count":69,"sven_meta":{"func_name":"disk_seqf_stop","file_name":"block/genhd.c","commit_link":"github.com/torvalds/linux/commit/77da160530dd1dc94f6ae15a981f24e5f0021e84","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#18-e757c3320e5f","input":"ExprAppendMultiKeysymList(ExprDef *expr, ExprDef *append)\n{\n unsigned nSyms = darray_size(expr->keysym_list.syms);\n unsigned numEntries = darray_size(append->keysym_list.syms);\n\n darray_append(expr->keysym_list.symsMapIndex, nSyms);\n darray_append(expr->keysym_list.symsNumEntries, numEntries);\n darray_concat(expr->keysym_list.syms, append->keysym_list.syms);\n\n FreeStmt((ParseCommon *) &append);\n\n return expr;\n}","target":"ExprAppendMultiKeysymList(ExprDef *expr, ExprDef *append)\n{\n unsigned nSyms = darray_size(expr->keysym_list.syms);\n unsigned numEntries = darray_size(append->keysym_list.syms);\n\n darray_append(expr->keysym_list.symsMapIndex, nSyms);\n darray_append(expr->keysym_list.symsNumEntries, numEntries);\n darray_concat(expr->keysym_list.syms, append->keysym_list.syms);\n\n FreeStmt((ParseCommon *) append);\n\n return expr;\n}","lang":"c","vul_type":"cwe-416","target_token_count":121,"sven_meta":{"func_name":"ExprAppendMultiKeysymList","file_name":"src/xkbcomp/ast-build.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/c1e5ac16e77a21f87bdf3bc4dea61b037a17dddb","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#27-b1b8f495f594","input":"static int get_task_ioprio(struct task_struct *p)\n{\n\tint ret;\n\n\tret = security_task_getioprio(p);\n\tif (ret)\n\t\tgoto out;\n\tret = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, IOPRIO_NORM);\n\tif (p->io_context)\n\t\tret = p->io_context->ioprio;\nout:\n\treturn ret;\n}","target":"static int get_task_ioprio(struct task_struct *p)\n{\n\tint ret;\n\n\tret = security_task_getioprio(p);\n\tif (ret)\n\t\tgoto out;\n\tret = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, IOPRIO_NORM);\n\ttask_lock(p);\n\tif (p->io_context)\n\t\tret = p->io_context->ioprio;\n\ttask_unlock(p);\nout:\n\treturn ret;\n}","lang":"c","vul_type":"cwe-416","target_token_count":91,"sven_meta":{"func_name":"get_task_ioprio","file_name":"block/ioprio.c","commit_link":"github.com/torvalds/linux/commit/8ba8682107ee2ca3347354e018865d8e1967c5f4","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#34-361e7defc730","input":"static int hci_uart_set_proto(struct hci_uart *hu, int id)\n{\n\tconst struct hci_uart_proto *p;\n\tint err;\n\n\tp = hci_uart_get_proto(id);\n\tif (!p)\n\t\treturn -EPROTONOSUPPORT;\n\n\thu->proto = p;\n\tset_bit(HCI_UART_PROTO_READY, &hu->flags);\n\n\terr = hci_uart_register_dev(hu);\n\tif (err) {\n\t\tclear_bit(HCI_UART_PROTO_READY, &hu->flags);\n\t\treturn err;\n\t}\n\n\treturn 0;\n}","target":"static int hci_uart_set_proto(struct hci_uart *hu, int id)\n{\n\tconst struct hci_uart_proto *p;\n\tint err;\n\n\tp = hci_uart_get_proto(id);\n\tif (!p)\n\t\treturn -EPROTONOSUPPORT;\n\n\thu->proto = p;\n\n\terr = hci_uart_register_dev(hu);\n\tif (err) {\n\t\treturn err;\n\t}\n\n\tset_bit(HCI_UART_PROTO_READY, &hu->flags);\n\treturn 0;\n}","lang":"c","vul_type":"cwe-416","target_token_count":98,"sven_meta":{"func_name":"hci_uart_set_proto","file_name":"drivers/bluetooth/hci_ldisc.c","commit_link":"github.com/torvalds/linux/commit/56897b217a1d0a91c9920cb418d6b3fe922f590a","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#37-825ae2642222","input":"PlayerGeneric::~PlayerGeneric()\n{\n\tif (mixer)\n\t\tdelete mixer;\n\n\tif (player)\n\t{\n\t\tif (mixer->isActive() && !mixer->isDeviceRemoved(player))\n\t\t\tmixer->removeDevice(player);\n\t\tdelete player;\n\t}\n\n\tdelete[] audioDriverName;\n\t\n\tdelete listener;\n}","target":"PlayerGeneric::~PlayerGeneric()\n{\n\n\tif (player)\n\t{\n\t\tif (mixer && mixer->isActive() && !mixer->isDeviceRemoved(player))\n\t\t\tmixer->removeDevice(player);\n\t\tdelete player;\n\t}\n\t\n\tif (mixer)\n\t\tdelete mixer;\n\n\tdelete[] audioDriverName;\n\t\n\tdelete listener;\n}","lang":"cpp","vul_type":"cwe-416","target_token_count":68,"sven_meta":{"func_name":"PlayerGeneric::~PlayerGeneric","file_name":"src/milkyplay/PlayerGeneric.cpp","commit_link":"github.com/milkytracker/MilkyTracker/commit/7afd55c42ad80d01a339197a2d8b5461d214edaf","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#48-1b92d67df79b","input":"struct net *get_net_ns_by_id(struct net *net, int id)\n{\n\tstruct net *peer;\n\n\tif (id < 0)\n\t\treturn NULL;\n\n\trcu_read_lock();\n\tspin_lock_bh(&net->nsid_lock);\n\tpeer = idr_find(&net->netns_ids, id);\n\tif (peer)\n\t\tget_net(peer);\n\tspin_unlock_bh(&net->nsid_lock);\n\trcu_read_unlock();\n\n\treturn peer;\n}","target":"struct net *get_net_ns_by_id(struct net *net, int id)\n{\n\tstruct net *peer;\n\n\tif (id < 0)\n\t\treturn NULL;\n\n\trcu_read_lock();\n\tspin_lock_bh(&net->nsid_lock);\n\tpeer = idr_find(&net->netns_ids, id);\n\tif (peer)\n\t\tpeer = maybe_get_net(peer);\n\tspin_unlock_bh(&net->nsid_lock);\n\trcu_read_unlock();\n\n\treturn peer;\n}","lang":"c","vul_type":"cwe-416","target_token_count":95,"sven_meta":{"func_name":"get_net_ns_by_id","file_name":"net/core/net_namespace.c","commit_link":"github.com/torvalds/linux/commit/21b5944350052d2583e82dd59b19a9ba94a007f0","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#53-1f6d62676756","input":"static int snd_seq_device_dev_free(struct snd_device *device)\n{\n\tstruct snd_seq_device *dev = device->device_data;\n\n\tput_device(&dev->dev);\n\treturn 0;\n}","target":"static int snd_seq_device_dev_free(struct snd_device *device)\n{\n\tstruct snd_seq_device *dev = device->device_data;\n\n\tcancel_autoload_drivers();\n\tput_device(&dev->dev);\n\treturn 0;\n}","lang":"c","vul_type":"cwe-416","target_token_count":44,"sven_meta":{"func_name":"snd_seq_device_dev_free","file_name":"sound/core/seq_device.c","commit_link":"github.com/torvalds/linux/commit/fc27fe7e8deef2f37cba3f2be2d52b6ca5eb9d57","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-022#2-6241e4c1b809","input":"static int nntp_hcache_namer(const char *path, char *dest, size_t destlen)\n{\n return snprintf(dest, destlen, \"%s.hcache\", path);\n}","target":"static int nntp_hcache_namer(const char *path, char *dest, size_t destlen)\n{\n int count = snprintf(dest, destlen, \"%s.hcache\", path);\n\n /* Strip out any directories in the path */\n char *first = strchr(dest, '/');\n char *last = strrchr(dest, '/');\n if (first && last && (last > first))\n {\n memmove(first, last, strlen(last) + 1);\n count -= (last - first);\n }\n\n return count;\n}","lang":"c","vul_type":"cwe-022","target_token_count":112,"sven_meta":{"func_name":"nntp_hcache_namer","file_name":"newsrc.c","commit_link":"github.com/neomutt/neomutt/commit/9bfab35522301794483f8f9ed60820bdec9be59e","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#5-226e5ab02e65","input":"def _inject_file_into_fs(fs, path, contents):\n absolute_path = os.path.join(fs, path.lstrip('/'))\n parent_dir = os.path.dirname(absolute_path)\n utils.execute('mkdir', '-p', parent_dir, run_as_root=True)\n utils.execute('tee', absolute_path, process_input=contents,\n run_as_root=True)","target":"def _inject_file_into_fs(fs, path, contents, append=False):\n absolute_path = _join_and_check_path_within_fs(fs, path.lstrip('/'))\n\n parent_dir = os.path.dirname(absolute_path)\n utils.execute('mkdir', '-p', parent_dir, run_as_root=True)\n\n args = []\n if append:\n args.append('-a')\n args.append(absolute_path)\n\n kwargs = dict(process_input=contents, run_as_root=True)\n\n utils.execute('tee', *args, **kwargs)","lang":"python","vul_type":"cwe-022","target_token_count":108,"sven_meta":{"func_name":"_inject_file_into_fs","file_name":"nova/virt/disk/api.py","commit_link":"github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#7-ad0f9aabe39b","input":" def cut(self, key):\n try:\n self.etcd.delete(os.path.join(self.namespace, key))\n except etcd.EtcdKeyNotFound:\n return False\n except etcd.EtcdException as err:\n log_error(\"Error removing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to cut key')\n return True","target":" def cut(self, key):\n try:\n self.etcd.delete(self._absolute_key(key))\n except etcd.EtcdKeyNotFound:\n return False\n except etcd.EtcdException as err:\n log_error(\"Error removing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to cut key')\n return True","lang":"python","vul_type":"cwe-022","target_token_count":83,"sven_meta":{"func_name":"cut","file_name":"custodia/store/etcdstore.py","commit_link":"github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#9-bb0b57f9d8fa","input":" def candidate_paths_for_url(self, url):\n for root, prefix in self.directories:\n if url.startswith(prefix):\n yield os.path.join(root, url[len(prefix):])","target":" def candidate_paths_for_url(self, url):\n for root, prefix in self.directories:\n if url.startswith(prefix):\n path = os.path.join(root, url[len(prefix):])\n if os.path.commonprefix((root, path)) == root:\n yield path","lang":"python","vul_type":"cwe-022","target_token_count":56,"sven_meta":{"func_name":"candidate_paths_for_url","file_name":"whitenoise/base.py","commit_link":"github.com/evansd/whitenoise/commit/4d8a3ab1e97d7ddb18b3fa8b4909c92bad5529c6","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#11-3bdc24de76e9","input":"def create_basename_core(basename):\n try:\n basename = basename.casefold()\n except Exception:\n basename = basename.lower()\n\n basename = basename.replace(' ', '-')\n basename = re.sub(r'<[^>]*>', r'', basename)\n basename = re.sub(r'[^a-z0-9\\-]', r'', basename)\n basename = re.sub(r'\\-\\-', r'-', basename)\n basename = urllib.parse.quote_plus(basename)\n\n return basename","target":"def create_basename_core(basename):\n try:\n basename = basename.casefold()\n except Exception:\n basename = basename.lower()\n\n basename = re.sub(r'[ \\./]', r'-', basename)\n basename = re.sub(r'<[^>]*>', r'', basename)\n basename = re.sub(r'[^a-z0-9\\-]', r'', basename)\n basename = re.sub(r'\\-\\-', r'-', basename)\n basename = urllib.parse.quote_plus(basename)\n\n return basename","lang":"python","vul_type":"cwe-022","target_token_count":103,"sven_meta":{"func_name":"create_basename_core","file_name":"MeTal/core/utils.py","commit_link":"github.com/syegulalp/mercury/commit/3f7c7442fa49aec37577dbdb47ce11a848e7bd03","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#12-71b22f274d93","input":" def get(self, key):\n try:\n result = self.etcd.get(os.path.join(self.namespace, key))\n except etcd.EtcdException as err:\n log_error(\"Error fetching key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to get key')\n return result.value","target":" def get(self, key):\n try:\n result = self.etcd.get(self._absolute_key(key))\n except etcd.EtcdException as err:\n log_error(\"Error fetching key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to get key')\n return result.value","lang":"python","vul_type":"cwe-022","target_token_count":72,"sven_meta":{"func_name":"get","file_name":"custodia/store/etcdstore.py","commit_link":"github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#23-7d2d7dc8d2fd","input":"void dd_save_text(struct dump_dir *dd, const char *name, const char *data)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n save_binary_file(full_path, data, strlen(data), dd->dd_uid, dd->dd_gid, dd->mode);\n free(full_path);\n}","target":"void dd_save_text(struct dump_dir *dd, const char *name, const char *data)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot save text. '%s' is not a valid file name\", name);\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n save_binary_file(full_path, data, strlen(data), dd->dd_uid, dd->dd_gid, dd->mode);\n free(full_path);\n}","lang":"c","vul_type":"cwe-022","target_token_count":123,"sven_meta":{"func_name":"dd_save_text","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#25-398e401855d6","input":"void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n save_binary_file(full_path, data, size, dd->dd_uid, dd->dd_gid, dd->mode);\n free(full_path);\n}","target":"void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot save binary. '%s' is not a valid file name\", name);\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n save_binary_file(full_path, data, size, dd->dd_uid, dd->dd_gid, dd->mode);\n free(full_path);\n}","lang":"c","vul_type":"cwe-022","target_token_count":125,"sven_meta":{"func_name":"dd_save_binary","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#26-4f0f9c1b3ddc","input":"def pascal_case(value: str) -> str:\n return stringcase.pascalcase(value)","target":"def pascal_case(value: str) -> str:\n return stringcase.pascalcase(_sanitize(value))","lang":"python","vul_type":"cwe-022","target_token_count":22,"sven_meta":{"func_name":"pascal_case","file_name":"openapi_python_client/utils.py","commit_link":"github.com/openapi-generators/openapi-python-client/commit/3e7dfae5d0b3685abf1ede1bc6c086a116ac4746","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#34-0bfc2f9cdba5","input":" @staticmethod\n def _download_file(bucket, filename, local_dir):\n key = bucket.get_key(filename)\n local_filename = os.path.join(local_dir, filename)\n key.get_contents_to_filename(local_filename)\n return local_filename","target":" @staticmethod\n def _download_file(bucket, filename, local_dir):\n key = bucket.get_key(filename)\n local_filename = os.path.join(local_dir, os.path.basename(filename))\n key.get_contents_to_filename(local_filename)\n return local_filename","lang":"python","vul_type":"cwe-022","target_token_count":52,"sven_meta":{"func_name":"_download_file","file_name":"nova/image/s3.py","commit_link":"github.com/openstack/nova/commit/76363226bd8533256f7795bba358d7f4b8a6c9e6","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#42-7b8d67274477","input":"def get_paths(base_path: pathlib.Path):\n data_file = pathlib.Path(str(base_path) + \".data\")\n metadata_file = pathlib.Path(str(base_path) + \".meta\")\n\n return data_file, metadata_file","target":"def get_paths(root: str, sub_path: str) \\\n -> typing.Tuple[pathlib.Path, pathlib.Path]:\n base_path = flask.safe_join(root, sub_path)\n data_file = pathlib.Path(base_path + \".data\")\n metadata_file = pathlib.Path(base_path + \".meta\")\n\n return data_file, metadata_file","lang":"python","vul_type":"cwe-022","target_token_count":68,"sven_meta":{"func_name":"get_paths","file_name":"xhu.py","commit_link":"github.com/horazont/xmpp-http-upload/commit/82056540191e89f0cd697c81f57714c00962ed75","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#44-c2312c8f5b91","input":"def valid_id(opts, id_):\n '''\n Returns if the passed id is valid\n '''\n try:\n return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_)\n except (AttributeError, KeyError, TypeError) as e:\n return False","target":"def valid_id(opts, id_):\n '''\n Returns if the passed id is valid\n '''\n try:\n if any(x in id_ for x in ('/', '\\\\', '\\0')):\n return False\n return bool(clean_path(opts['pki_dir'], id_))\n except (AttributeError, KeyError, TypeError):\n return False","lang":"python","vul_type":"cwe-022","target_token_count":72,"sven_meta":{"func_name":"valid_id","file_name":"salt/utils/verify.py","commit_link":"github.com/saltstack/salt/commit/80d90307b07b3703428ecbb7c8bb468e28a9ae6d","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#45-df0c3974d942","input":" def get(self, path):\n return static_file(path, self.get_base_path())","target":" def get(self, path):\n path = self.sanitize_path(path)\n base_paths = self.get_base_paths()\n if hasattr(base_paths, 'split'):\n # String, so go simple\n base_path = base_paths\n else:\n base_path = self.get_first_base(base_paths, path)\n return static_file(path, base_path)","lang":"python","vul_type":"cwe-022","target_token_count":74,"sven_meta":{"func_name":"get","file_name":"seagull/routes/app.py","commit_link":"github.com/foxbunny/seagull/commit/1fb790712fe0c1d1957b31e34a8e0e6593af87a7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#46-48fed782bfed","input":"int dd_exist(const struct dump_dir *dd, const char *path)\n{\n char *full_path = concat_path_file(dd->dd_dirname, path);\n int ret = exist_file_dir(full_path);\n free(full_path);\n return ret;\n}","target":"int dd_exist(const struct dump_dir *dd, const char *path)\n{\n if (!str_is_correct_filename(path))\n error_msg_and_die(\"Cannot test existence. '%s' is not a valid file name\", path);\n\n char *full_path = concat_path_file(dd->dd_dirname, path);\n int ret = exist_file_dir(full_path);\n free(full_path);\n return ret;\n}","lang":"c","vul_type":"cwe-022","target_token_count":84,"sven_meta":{"func_name":"dd_exist","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#48-80f68c61320e","input":"def deleteKey(client):\n\t\"\"\"Deletes the specified key.\n\tReturns an error if the key doesn't exist\n\t\"\"\"\n\tglobal BAD_REQUEST\n\tglobal NOT_FOUND\n\n\tvalidateClient(client)\n\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\n\tif re.search('[^a-zA-Z0-9]', token_data['key']):\n\t\traise FoxlockError(BAD_REQUEST, 'Invalid key requested')\n\n\ttry:\n\t\tos.remove('keys/%s/%s.key' % (client, token_data['key']))\n\texcept FileNotFoundError:\n\t\traise FoxlockError(NOT_FOUND, \"Key '%s' not found\" % token_data['key'])\n\n\treturn \"Key '%s' successfully deleted\" % token_data['key']","target":"def deleteKey(client):\n\t\"\"\"Deletes the specified key.\n\tReturns an error if the key doesn't exist\n\t\"\"\"\n\tglobal NOT_FOUND\n\n\tvalidateClient(client)\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateKeyName(token_data['key'])\n\n\ttry:\n\t\tos.remove('keys/%s/%s.key' % (client, token_data['key']))\n\texcept FileNotFoundError:\n\t\traise FoxlockError(NOT_FOUND, \"Key '%s' not found\" % token_data['key'])\n\n\treturn \"Key '%s' successfully deleted\" % token_data['key']","lang":"python","vul_type":"cwe-022","target_token_count":127,"sven_meta":{"func_name":"deleteKey","file_name":"impl.py","commit_link":"github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#49-641b4cfbd863","input":" def set(self, key, value, replace=False):\n path = os.path.join(self.namespace, key)\n try:\n self.etcd.write(path, value, prevExist=replace)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error storing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to store key')","target":" def set(self, key, value, replace=False):\n path = self._absolute_key(key)\n try:\n self.etcd.write(path, value, prevExist=replace)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error storing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to store key')","lang":"python","vul_type":"cwe-022","target_token_count":103,"sven_meta":{"func_name":"set","file_name":"custodia/store/etcdstore.py","commit_link":"github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-079#7-ef681c040ce3","input":"@register.filter\ndef json_dumps(value, indent=None):\n if isinstance(value, QuerySet):\n result = serialize('json', value, indent=indent)\n else:\n result = json.dumps(value, indent=indent, cls=DjbletsJSONEncoder)\n\n return mark_safe(result)","target":"@register.filter\ndef json_dumps(value, indent=None):\n if isinstance(value, QuerySet):\n result = serialize('json', value, indent=indent)\n else:\n result = json.dumps(value, indent=indent, cls=DjbletsJSONEncoder)\n\n return mark_safe(force_text(result).translate(_safe_js_escapes))","lang":"python","vul_type":"cwe-079","target_token_count":70,"sven_meta":{"func_name":"json_dumps","file_name":"djblets/util/templatetags/djblets_js.py","commit_link":"github.com/djblets/djblets/commit/77a68c03cd619a0996f3f37337b8c39ca6643d6e","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#8-9869a184bb30","input":" def htmlvalue(self, val):\n return self.block.render_basic(val)","target":" def htmlvalue(self, val):\n \"\"\"\n Return an HTML representation of this block that is safe to be included\n in comparison views\n \"\"\"\n return escape(text_from_html(self.block.render_basic(val)))","lang":"python","vul_type":"cwe-079","target_token_count":44,"sven_meta":{"func_name":"htmlvalue","file_name":"wagtail/admin/compare.py","commit_link":"github.com/wagtail/wagtail/commit/61045ceefea114c40ac4b680af58990dbe732389","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#12-27bf8de1e44d","input":" def get_context_data(self, **kwargs):\n context = super().get_context_data(**kwargs)\n context['comments'] = self.object.comment_set.all().order_by('-time')\n context['form'] = self.get_form()\n context['md'] = markdown(self.object.content,\n extensions=[\n 'markdown.extensions.extra',\n 'markdown.extensions.codehilite',\n 'markdown.extensions.toc',\n ])\n\n return context","target":" def get_context_data(self, **kwargs):\n context = super().get_context_data(**kwargs)\n context['comments'] = self.object.comment_set.all().order_by('-time')\n context['form'] = self.get_form()\n context['md'] = safe_md(self.object.content)\n\n return context","lang":"python","vul_type":"cwe-079","target_token_count":63,"sven_meta":{"func_name":"get_context_data","file_name":"app/Index/views.py","commit_link":"github.com/Cheng-mq1216/production-practice/commit/333dc34f5feada55d1f6ff1255949ca00dec0f9c","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#14-5914b850b3e2","input":" @classmethod\n def simple_search(cls, query, using=None, index=None):\n es_search = cls.search(using=using, index=index)\n es_query = cls.get_es_query(query=query)\n highlighted_fields = [f.split('^', 1)[0] for f in cls.search_fields]\n\n es_search = es_search.query(es_query).highlight(*highlighted_fields)\n return es_search","target":" @classmethod\n def simple_search(cls, query, using=None, index=None):\n \"\"\"\n Do a search without facets.\n\n This is used in:\n\n * The Docsearch API\n * The Project Admin Search page\n \"\"\"\n\n es_search = cls.search(using=using, index=index)\n es_search = es_search.highlight_options(encoder='html')\n\n es_query = cls.get_es_query(query=query)\n highlighted_fields = [f.split('^', 1)[0] for f in cls.search_fields]\n es_search = es_search.query(es_query).highlight(*highlighted_fields)\n\n return es_search","lang":"python","vul_type":"cwe-079","target_token_count":127,"sven_meta":{"func_name":"simple_search","file_name":"readthedocs/search/documents.py","commit_link":"github.com/readthedocs/readthedocs.org/commit/1ebe494ffde18109307f205d2bd94102452f697a","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#18-d6fc2ce88441","input":"def _keyify(key):\n return _key_pattern.sub(' ', key.lower())","target":"def _keyify(key):\n key = escape(key.lower(), quote=True)\n return _key_pattern.sub(' ', key)","lang":"python","vul_type":"cwe-079","target_token_count":26,"sven_meta":{"func_name":"_keyify","file_name":"mistune.py","commit_link":"github.com/lepture/mistune/commit/5f06d724bc05580e7f203db2d4a4905fc1127f98","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#20-544180b3a8dc","input":"def make_eb_config(application_name, default_region):\n # Capture our current directory\n UTILS_DIR = os.path.dirname(os.path.abspath(__file__))\n # Create the jinja2 environment.\n # Notice the use of trim_blocks, which greatly helps control whitespace.\n j2_env = Environment(loader=FileSystemLoader(UTILS_DIR))\n return j2_env.get_template('templates/eb/config.yml').render(\n APPLICATION_NAME=application_name,\n DEFAULT_REGION=default_region\n )","target":"def make_eb_config(application_name, default_region):\n # Capture our current directory\n UTILS_DIR = os.path.dirname(os.path.abspath(__file__))\n # Create the jinja2 environment.\n # Notice the use of trim_blocks, which greatly helps control whitespace.\n j2_env = Environment(loader=FileSystemLoader(UTILS_DIR), autoescape=True)\n return j2_env.get_template('templates/eb/config.yml').render(\n APPLICATION_NAME=application_name,\n DEFAULT_REGION=default_region\n )","lang":"python","vul_type":"cwe-079","target_token_count":106,"sven_meta":{"func_name":"make_eb_config","file_name":"utils/make_eb_config.py","commit_link":"github.com/OkunaOrg/okuna-www-api/commit/8c40c66ea7c483a0cbda4c21940180af909aab99","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#21-e935be5d8294","input":" def mode_keepalive(self, request):\n \"\"\"\n This is called by render_POST when the\n client is replying to the keepalive.\n \"\"\"\n csessid = request.args.get('csessid')[0]\n self.last_alive[csessid] = (time.time(), False)\n return '\"\"'","target":" def mode_keepalive(self, request):\n \"\"\"\n This is called by render_POST when the\n client is replying to the keepalive.\n \"\"\"\n csessid = cgi.escape(request.args['csessid'][0])\n self.last_alive[csessid] = (time.time(), False)\n return '\"\"'","lang":"python","vul_type":"cwe-079","target_token_count":70,"sven_meta":{"func_name":"mode_keepalive","file_name":"evennia/server/portal/webclient_ajax.py","commit_link":"github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#22-576cdf9d07a6","input":"void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)\n{\n QWriteLocker locker(&lock);\n\n Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), ip, blocked, reason };\n m_peers.push_back(temp);\n\n if (m_peers.size() >= MAX_LOG_MESSAGES)\n m_peers.pop_front();\n\n emit newLogPeer(temp);\n}","target":"void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)\n{\n QWriteLocker locker(&lock);\n\n Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), Utils::String::toHtmlEscaped(ip), blocked, Utils::String::toHtmlEscaped(reason) };\n m_peers.push_back(temp);\n\n if (m_peers.size() >= MAX_LOG_MESSAGES)\n m_peers.pop_front();\n\n emit newLogPeer(temp);\n}","lang":"cpp","vul_type":"cwe-079","target_token_count":104,"sven_meta":{"func_name":"Logger::addPeer","file_name":"src/base/logger.cpp","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#28-2b222187be43","input":" def save(self):\n # copy the user's input from plain text to description to be processed\n self.description = self.description_plain_text\n if CE.settings.auto_cross_reference:\n self.auto_cross_ref()\n else:\n self.find_tag()\n self.slug = slugify(self.title)\n super().save()","target":" def save(self):\n # copy the user's input from plain text to description to be processed\n # uses bleach to remove potentially harmful HTML code\n self.description = bleach.clean(str(self.description_plain_text),\n tags=CE.settings.bleach_allowed,\n strip=True)\n if CE.settings.auto_cross_reference:\n self.auto_cross_ref()\n else:\n self.find_tag()\n self.slug = slugify(self.title)\n super().save()","lang":"python","vul_type":"cwe-079","target_token_count":94,"sven_meta":{"func_name":"save","file_name":"CE/models.py","commit_link":"github.com/stevetasticsteve/CLA_Hub/commit/a06d85cd0b0964f8469e5c4bc9a6c132aa0b4c37","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#30-fbdb24f62060","input":" def mode_close(self, request):\n \"\"\"\n This is called by render_POST when the client is signalling\n that it is about to be closed.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = request.args.get('csessid')[0]\n try:\n sess = self.sessionhandler.sessions_from_csessid(csessid)[0]\n sess.sessionhandler.disconnect(sess)\n except IndexError:\n self.client_disconnect(csessid)\n return '\"\"'","target":" def mode_close(self, request):\n \"\"\"\n This is called by render_POST when the client is signalling\n that it is about to be closed.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = cgi.escape(request.args['csessid'][0])\n try:\n sess = self.sessionhandler.sessions_from_csessid(csessid)[0]\n sess.sessionhandler.disconnect(sess)\n except IndexError:\n self.client_disconnect(csessid)\n return '\"\"'","lang":"python","vul_type":"cwe-079","target_token_count":105,"sven_meta":{"func_name":"mode_close","file_name":"evennia/server/portal/webclient_ajax.py","commit_link":"github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#31-692feaf28db0","input":" def get_queryset(self, **kwargs):\n queryset = Article.objects.order_by('-time')\n for i in queryset:\n i.md = markdown(i.content, extensions=[\n 'markdown.extensions.extra',\n 'markdown.extensions.codehilite',\n 'markdown.extensions.toc',\n ])\n\n return queryset","target":" def get_queryset(self, **kwargs):\n queryset = Article.objects.order_by('-time')\n for i in queryset:\n i.md = safe_md(i.content)\n\n return queryset","lang":"python","vul_type":"cwe-079","target_token_count":37,"sven_meta":{"func_name":"get_queryset","file_name":"app/Index/views.py","commit_link":"github.com/Cheng-mq1216/production-practice/commit/333dc34f5feada55d1f6ff1255949ca00dec0f9c","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#39-df317e1ae5be","input":"void Logger::addMessage(const QString &message, const Log::MsgType &type)\n{\n QWriteLocker locker(&lock);\n\n Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, message };\n m_messages.push_back(temp);\n\n if (m_messages.size() >= MAX_LOG_MESSAGES)\n m_messages.pop_front();\n\n emit newLogMessage(temp);\n}","target":"void Logger::addMessage(const QString &message, const Log::MsgType &type)\n{\n QWriteLocker locker(&lock);\n\n Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, Utils::String::toHtmlEscaped(message) };\n m_messages.push_back(temp);\n\n if (m_messages.size() >= MAX_LOG_MESSAGES)\n m_messages.pop_front();\n\n emit newLogMessage(temp);\n}","lang":"cpp","vul_type":"cwe-079","target_token_count":91,"sven_meta":{"func_name":"Logger::addMessage","file_name":"src/base/logger.cpp","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#40-9a01affe0d76","input":" @handler.unsupported_on_local_server\n @handler.get(handler.HTML)\n def get(self):\n \"\"\"Handle a get request.\"\"\"\n self.render(\n 'login.html', {\n 'apiKey': local_config.ProjectConfig().get('firebase.api_key'),\n 'authDomain': auth.auth_domain(),\n 'dest': self.request.get('dest'),\n })","target":" @handler.unsupported_on_local_server\n @handler.get(handler.HTML)\n def get(self):\n \"\"\"Handle a get request.\"\"\"\n dest = self.request.get('dest')\n base_handler.check_redirect_url(dest)\n\n self.render(\n 'login.html', {\n 'apiKey': local_config.ProjectConfig().get('firebase.api_key'),\n 'authDomain': auth.auth_domain(),\n 'dest': dest,\n })","lang":"python","vul_type":"cwe-079","target_token_count":87,"sven_meta":{"func_name":"get","file_name":"src/appengine/handlers/login.py","commit_link":"github.com/google/clusterfuzz/commit/3d66c1146550eecd4e34d47332a8616b435a21fe","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#42-b9eec320d323","input":" @property\n async def html_content(self):\n content = await self.content\n if not content:\n return ''\n return markdown(content)","target":" @property\n async def html_content(self):\n content = markupsafe.escape(await self.content)\n if not content:\n return ''\n return markdown(content)","lang":"python","vul_type":"cwe-079","target_token_count":35,"sven_meta":{"func_name":"html_content","file_name":"models/comment.py","commit_link":"github.com/dongweiming/lyanna/commit/fcefac79e4b7601e81a3b3fe0ad26ab18ee95d7d","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#43-87b0eb38c618","input":" def get_context_data(self, *args, **kwargs):\n data = super().get_context_data(*args, **kwargs)\n\n if self.request.GET.get('back', None) is not None:\n data['back_link'] = self.request.GET['back']\n\n return data","target":" def get_context_data(self, *args, **kwargs):\n data = super().get_context_data(*args, **kwargs)\n\n back = self.request.GET.get('back', None)\n parsed_back_url = urllib.parse.urlparse(back)\n\n # We only allow blank scheme, e.g. relative urls to avoid reflected XSS\n if back is not None and parsed_back_url.scheme == \"\":\n data['back_link'] = back\n\n return data","lang":"python","vul_type":"cwe-079","target_token_count":93,"sven_meta":{"func_name":"get_context_data","file_name":"socialsystem/core/views.py","commit_link":"github.com/pirati-web/socialnisystem.cz/commit/1bd25d971ac3f9ac7ae3915cc2dd86b0ceb44b53","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-190#5-c781f360c33f","input":" long WebPImage::getHeaderOffset(byte *data, long data_size,\n byte *header, long header_size) {\n long pos = -1;\n for (long i=0; i < data_size - header_size; i++) {\n if (memcmp(header, &data[i], header_size) == 0) {\n pos = i;\n break;\n }\n }\n return pos;\n }","target":" long WebPImage::getHeaderOffset(byte* data, long data_size, byte* header, long header_size)\n {\n if (data_size < header_size) { return -1; }\n long pos = -1;\n for (long i=0; i < data_size - header_size; i++) {\n if (memcmp(header, &data[i], header_size) == 0) {\n pos = i;\n break;\n }\n }\n return pos;\n }","lang":"cpp","vul_type":"cwe-190","target_token_count":104,"sven_meta":{"func_name":"Exiv2::WebPImage::getHeaderOffset","file_name":"src/webpimage.cpp","commit_link":"github.com/Exiv2/exiv2/commit/e925bc5addd881543fa503470c8a859e112cca62","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#20-39c4a938bc37","input":"int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length)\n{\n\tswitch (mem->type) {\n\tcase RXE_MEM_TYPE_DMA:\n\t\treturn 0;\n\n\tcase RXE_MEM_TYPE_MR:\n\tcase RXE_MEM_TYPE_FMR:\n\t\treturn ((iova < mem->iova) ||\n\t\t\t((iova + length) > (mem->iova + mem->length))) ?\n\t\t\t-EFAULT : 0;\n\n\tdefault:\n\t\treturn -EFAULT;\n\t}\n}","target":"int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length)\n{\n\tswitch (mem->type) {\n\tcase RXE_MEM_TYPE_DMA:\n\t\treturn 0;\n\n\tcase RXE_MEM_TYPE_MR:\n\tcase RXE_MEM_TYPE_FMR:\n\t\tif (iova < mem->iova ||\n\t\t length > mem->length ||\n\t\t iova > mem->iova + mem->length - length)\n\t\t\treturn -EFAULT;\n\t\treturn 0;\n\n\tdefault:\n\t\treturn -EFAULT;\n\t}\n}","lang":"c","vul_type":"cwe-190","target_token_count":109,"sven_meta":{"func_name":"mem_check_range","file_name":"drivers/infiniband/sw/rxe/rxe_mr.c","commit_link":"github.com/torvalds/linux/commit/647bf3d8a8e5777319da92af672289b2a6c4dc66","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#33-3d4adfe350d5","input":"SWFInput_readSBits(SWFInput input, int number)\n{\n\tint num = SWFInput_readBits(input, number);\n\n\tif ( num & (1<<(number-1)) )\n\t\treturn num - (1<references;\n debugs(29, 9, \"nonce '\" << nonce << \"' now at '\" << nonce->references << \"'.\");\n}","target":"authDigestNonceLink(digest_nonce_h * nonce)\n{\n assert(nonce != NULL);\n ++nonce->references;\n assert(nonce->references != 0); // no overflows\n debugs(29, 9, \"nonce '\" << nonce << \"' now at '\" << nonce->references << \"'.\");\n}","lang":"cpp","vul_type":"cwe-190","target_token_count":68,"sven_meta":{"func_name":"authDigestNonceLink","file_name":"src/auth/digest/Config.cc","commit_link":"github.com/squid-cache/squid/commit/eeebf0f37a72a2de08348e85ae34b02c34e9a811","source_cwe_file":"cwe-190.jsonl"}} diff --git a/sven_rl_buckets/train/256_512.jsonl b/sven_rl_buckets/train/256_512.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..07dbb7cb64b591c69bab6c49a4c8233d463daf5d --- /dev/null +++ b/sven_rl_buckets/train/256_512.jsonl @@ -0,0 +1,147 @@ +{"problem_id":"cwe-089#0-058d1db0e395","input":"def build_board(conn, game,size):\n # we'll build the empty board, and then fill in with the move list that\n # we get from the DB.\n board = []\n for i in range(size):\n board.append([\"\"]*size)\n\n\n # search for all moves that have happenend during this game.\n cursor = conn.cursor()\n cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\" % game)\n\n counts = {\"X\":0, \"O\":0}\n for move in cursor.fetchall():\n (x,y,letter) = move\n\n x = int(x)\n y = int(y)\n assert x >= 0 and x < size\n assert y >= 0 and y < size\n\n assert letter in \"XO\"\n\n assert board[x][y] == \"\"\n board[x][y] = letter\n\n counts[letter] += 1\n\n cursor.close()\n\n assert counts[\"X\"] >= counts[\"O\"]\n assert counts[\"X\"] <= counts[\"O\"]+1\n\n if counts[\"X\"] == counts[\"O\"]:\n nextPlayer = 0\n else:\n nextPlayer = 1\n letter = \"XO\"[nextPlayer]\n\n return (board,nextPlayer,letter)","target":"def build_board(conn, game,size):\n # we'll build the empty board, and then fill in with the move list that\n # we get from the DB.\n board = []\n for i in range(size):\n board.append([\"\"]*size)\n\n\n # search for all moves that have happenend during this game.\n cursor = conn.cursor()\n cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\", (game,))\n\n counts = {\"X\":0, \"O\":0}\n for move in cursor.fetchall():\n (x,y,letter) = move\n\n x = int(x)\n y = int(y)\n assert x >= 0 and x < size\n assert y >= 0 and y < size\n\n assert letter in \"XO\"\n\n assert board[x][y] == \"\"\n board[x][y] = letter\n\n counts[letter] += 1\n\n cursor.close()\n\n assert counts[\"X\"] >= counts[\"O\"]\n assert counts[\"X\"] <= counts[\"O\"]+1\n\n if counts[\"X\"] == counts[\"O\"]:\n nextPlayer = 0\n else:\n nextPlayer = 1\n letter = \"XO\"[nextPlayer]\n\n return (board,nextPlayer,letter)","lang":"python","vul_type":"cwe-089","target_token_count":271,"sven_meta":{"func_name":"build_board","file_name":"cgi/common.py","commit_link":"github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#8-24ab82d56e89","input":"@endpoints.route(\"/ranks\")\ndef ranks():\n if db == None:\n init()\n\n scene = request.args.get('scene', default='austin')\n date = request.args.get('date')\n \n # If no date was provided, pick the date of the latest tournament\n if date == None:\n sql = \"SELECT distinct date FROM ranks WHERE scene='{}' ORDER BY date DESC LIMIT 1;\".format(scene)\n res = db.exec(sql)\n date = res[0][0]\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM ranks WHERE scene = '{}' and date='{}'\".format(scene, date)\n res = db.exec(sql)\n\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n cur_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]\n\n cur_ranks[tag] = rank\n\n # Now get the ranks from last month, so we know if these players went up or down\n y, m, d = date.split('-')\n prev_date = bracket_utils.get_previous_month(date)\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM ranks WHERE scene = '{}' and date='{}'\".format(scene, prev_date)\n res = db.exec(sql)\n\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n prev_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]\n\n prev_ranks[tag] = rank\n\n return render_template('libraries/html/ranks.html', cur_ranks=cur_ranks, prev_ranks=prev_ranks, scene=scene, date=date)","target":"@endpoints.route(\"/ranks\")\ndef ranks():\n if db == None:\n init()\n\n scene = request.args.get('scene', default='austin')\n date = request.args.get('date')\n \n # If no date was provided, pick the date of the latest tournament\n if date == None:\n sql = \"SELECT distinct date FROM ranks WHERE scene='{scene}' ORDER BY date DESC LIMIT 1;\"\n args = {'scene': scene}\n res = db.exec(sql, args)\n date = res[0][0]\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM ranks WHERE scene = '{scene}' and date='{date}'\"\n args = {'scene': scene, 'date': date}\n res = db.exec(sql, args)\n\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n cur_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]\n\n cur_ranks[tag] = rank\n\n # Now get the ranks from last month, so we know if these players went up or down\n y, m, d = date.split('-')\n prev_date = bracket_utils.get_previous_month(date)\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM ranks WHERE scene = '{scene}' and date='{date}'\"\n args = {'scene': scene, 'date': prev_date}\n res = db.exec(sql, args)\n\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n prev_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]\n\n prev_ranks[tag] = rank\n\n return render_template('libraries/html/ranks.html', cur_ranks=cur_ranks, prev_ranks=prev_ranks, scene=scene, date=date)","lang":"python","vul_type":"cwe-089","target_token_count":417,"sven_meta":{"func_name":"ranks","file_name":"endpoints.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#15-1eb68ef0e0d1","input":"@frappe.whitelist(allow_guest=True)\ndef send_message(subject=\"Website Query\", message=\"\", sender=\"\", status=\"Open\"):\n\tfrom frappe.www.contact import send_message as website_send_message\n\tlead = customer = None\n\n\twebsite_send_message(subject, message, sender)\n\n\tcustomer = frappe.db.sql(\"\"\"select distinct dl.link_name from `tabDynamic Link` dl\n\t\tleft join `tabContact` c on dl.parent=c.name where dl.link_doctype='Customer'\n\t\tand c.email_id='{email_id}'\"\"\".format(email_id=sender))\n\n\tif not customer:\n\t\tlead = frappe.db.get_value('Lead', dict(email_id=sender))\n\t\tif not lead:\n\t\t\tnew_lead = frappe.get_doc(dict(\n\t\t\t\tdoctype='Lead',\n\t\t\t\temail_id = sender,\n\t\t\t\tlead_name = sender.split('@')[0].title()\n\t\t\t)).insert(ignore_permissions=True)\n\n\topportunity = frappe.get_doc(dict(\n\t\tdoctype ='Opportunity',\n\t\tenquiry_from = 'Customer' if customer else 'Lead',\n\t\tstatus = 'Open',\n\t\ttitle = subject,\n\t\tcontact_email = sender,\n\t\tto_discuss = message\n\t))\n\n\tif customer:\n\t\topportunity.customer = customer[0][0]\n\telif lead:\n\t\topportunity.lead = lead\n\telse:\n\t\topportunity.lead = new_lead.name\n\n\topportunity.insert(ignore_permissions=True)\n\n\tcomm = frappe.get_doc({\n\t\t\"doctype\":\"Communication\",\n\t\t\"subject\": subject,\n\t\t\"content\": message,\n\t\t\"sender\": sender,\n\t\t\"sent_or_received\": \"Received\",\n\t\t'reference_doctype': 'Opportunity',\n\t\t'reference_name': opportunity.name\n\t})\n\tcomm.insert(ignore_permissions=True)\n\n\treturn \"okay\"","target":"@frappe.whitelist(allow_guest=True)\ndef send_message(subject=\"Website Query\", message=\"\", sender=\"\", status=\"Open\"):\n\tfrom frappe.www.contact import send_message as website_send_message\n\tlead = customer = None\n\n\twebsite_send_message(subject, message, sender)\n\n\tcustomer = frappe.db.sql(\"\"\"select distinct dl.link_name from `tabDynamic Link` dl\n\t\tleft join `tabContact` c on dl.parent=c.name where dl.link_doctype='Customer'\n\t\tand c.email_id = %s\"\"\", sender)\n\n\tif not customer:\n\t\tlead = frappe.db.get_value('Lead', dict(email_id=sender))\n\t\tif not lead:\n\t\t\tnew_lead = frappe.get_doc(dict(\n\t\t\t\tdoctype='Lead',\n\t\t\t\temail_id = sender,\n\t\t\t\tlead_name = sender.split('@')[0].title()\n\t\t\t)).insert(ignore_permissions=True)\n\n\topportunity = frappe.get_doc(dict(\n\t\tdoctype ='Opportunity',\n\t\tenquiry_from = 'Customer' if customer else 'Lead',\n\t\tstatus = 'Open',\n\t\ttitle = subject,\n\t\tcontact_email = sender,\n\t\tto_discuss = message\n\t))\n\n\tif customer:\n\t\topportunity.customer = customer[0][0]\n\telif lead:\n\t\topportunity.lead = lead\n\telse:\n\t\topportunity.lead = new_lead.name\n\n\topportunity.insert(ignore_permissions=True)\n\n\tcomm = frappe.get_doc({\n\t\t\"doctype\":\"Communication\",\n\t\t\"subject\": subject,\n\t\t\"content\": message,\n\t\t\"sender\": sender,\n\t\t\"sent_or_received\": \"Received\",\n\t\t'reference_doctype': 'Opportunity',\n\t\t'reference_name': opportunity.name\n\t})\n\tcomm.insert(ignore_permissions=True)\n\n\treturn \"okay\"","lang":"python","vul_type":"cwe-089","target_token_count":360,"sven_meta":{"func_name":"send_message","file_name":"erpnext/templates/utils.py","commit_link":"github.com/libracore/erpnext/commit/9acb885e60f77cd4e9ea8c98bdc39c18abcac731","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#21-0039b2cd868c","input":" def view_grocery_list():\n print(\"grocery== list\")\n groceryListFrame = Frame(self)\n groceryListFrame.rowconfigure(0, weight=1)\n groceryListFrame.columnconfigure(0, weight=1)\n groceryListFrame.rowconfigure(1, weight=3)\n groceryListFrame.columnconfigure(1, weight=3)\n groceryListFrame.pack()\n\n menu.pack_forget()\n groceryButton.pack_forget()\n label.configure(text=\"Grocery List\")\n\n i = 0\n database_file = \"meal_planner.db\"\n item_array = []\n with sqlite3.connect(database_file) as conn:\n cursor = conn.cursor()\n tableName = \"ingredients_\" + str(weekNumber)\n selection = cursor.execute(\"\"\"SELECT * FROM \"\"\" + tableName)\n for result in [selection]:\n for row in result.fetchall():\n print(row)\n for ingredient in row:\n print(ingredient)\n item_array.append(str(ingredient).split())\n i = i +1\n Label(groceryListFrame, text=ingredient, font=MEDIUM_FONT, justify=LEFT).grid(row=i, column=0, sticky=\"w\")\n \n\n j = 0\n for item in item_array:\n print(item)\n\n\n returnButton = Button(menuFrame, text = \"Return to Menu\", highlightbackground=\"#e7e7e7\", command=lambda: [groceryListFrame.pack_forget(),\n menu.pack(), returnButton.pack_forget(), label.configure(text=\"Meal Planer\"),\n groceryButton.pack(side=RIGHT)])\n returnButton.pack(side=RIGHT)","target":" def view_grocery_list():\n print(\"grocery== list\")\n groceryListFrame = Frame(self)\n groceryListFrame.rowconfigure(0, weight=1)\n groceryListFrame.columnconfigure(0, weight=1)\n groceryListFrame.rowconfigure(1, weight=3)\n groceryListFrame.columnconfigure(1, weight=3)\n groceryListFrame.pack()\n\n menu.pack_forget()\n groceryButton.pack_forget()\n label.configure(text=\"Grocery List\")\n\n i = 0\n database_file = \"meal_planner.db\"\n item_array = []\n with sqlite3.connect(database_file) as conn:\n cursor = conn.cursor()\n tableName = \"ingredients_\" + str(weekNumber)\n selection = cursor.execute(\"\"\"SELECT * FROM ?;\"\"\", (tableName, ))\n for result in [selection]:\n for row in result.fetchall():\n print(row)\n for ingredient in row:\n print(ingredient)\n item_array.append(str(ingredient).split())\n i = i +1\n Label(groceryListFrame, text=ingredient, font=MEDIUM_FONT, justify=LEFT).grid(row=i, column=0, sticky=\"w\")\n \n\n j = 0\n for item in item_array:\n print(item)\n\n\n returnButton = Button(menuFrame, text = \"Return to Menu\", highlightbackground=\"#e7e7e7\", command=lambda: [groceryListFrame.pack_forget(),\n menu.pack(), returnButton.pack_forget(), label.configure(text=\"Meal Planer\"),\n groceryButton.pack(side=RIGHT)])\n returnButton.pack(side=RIGHT)","lang":"python","vul_type":"cwe-089","target_token_count":340,"sven_meta":{"func_name":"__init__.view_grocery_list","file_name":"mealPlan.py","commit_link":"github.com/trishamoyer/RecipePlanner-Python/commit/44d2ce370715d9344fad34b3b749322ab095a925","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#36-5da1a990c61b","input":" def get_requested_day(self, date):\n\n data = dict()\n\n day_start, day_end = self.get_epoch_day(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(day_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(day_end, self.local_timezone)}\n\n query = '''\n SELECT TimeStamp, SUM(Power) AS Power \n FROM DayData \n WHERE TimeStamp BETWEEN %s AND %s \n GROUP BY TimeStamp;\n '''\n\n data['data'] = list()\n for row in self.c.execute(query % (day_start, day_end)):\n data['data'].append({ 'time': row[0], 'power': row[1] })\n\n\n if self.get_datetime(date).date() == datetime.today().date():\n query = '''\n SELECT SUM(EToday) as EToday\n FROM Inverters;\n '''\n else:\n query = '''\n SELECT SUM(DayYield) AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN %s AND %s\n GROUP BY TimeStamp\n ''' % (day_start, day_end)\n self.c.execute(query)\n row = self.c.fetchone()\n if row and row[0]: data['total'] = row[0]\n else: data['total'] = 0\n\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM ( SELECT TimeStamp FROM DayData GROUP BY TimeStamp );\n '''\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if (first_data): data['hasPrevious'] = (first_data < day_start)\n else: data['hasPrevious'] = False\n\n if (last_data): data['hasNext'] = (last_data > day_end)\n else: data['hasNext'] = False\n\n #print(json.dumps(data, indent=4))\n return data","target":" def get_requested_day(self, date):\n\n data = dict()\n\n day_start, day_end = self.get_epoch_day(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(day_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(day_end, self.local_timezone)}\n\n query = '''\n SELECT TimeStamp, SUM(Power) AS Power \n FROM DayData \n WHERE TimeStamp BETWEEN ? AND ?\n GROUP BY TimeStamp;\n '''\n\n data['data'] = list()\n for row in self.c.execute(query, (day_start, day_end)):\n data['data'].append({ 'time': row[0], 'power': row[1] })\n\n\n if self.get_datetime(date).date() == datetime.today().date():\n query = '''\n SELECT SUM(EToday) as EToday\n FROM Inverters;\n '''\n self.c.execute(query)\n else:\n query = '''\n SELECT SUM(DayYield) AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN ? AND ?\n GROUP BY TimeStamp;\n '''\n self.c.execute(query, (day_start, day_end))\n\n row = self.c.fetchone()\n if row and row[0]: data['total'] = row[0]\n else: data['total'] = 0\n\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM ( SELECT TimeStamp FROM DayData GROUP BY TimeStamp );\n '''\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if (first_data): data['hasPrevious'] = (first_data < day_start)\n else: data['hasPrevious'] = False\n\n if (last_data): data['hasNext'] = (last_data > day_end)\n else: data['hasNext'] = False\n\n #print(json.dumps(data, indent=4))\n return data","lang":"python","vul_type":"cwe-089","target_token_count":407,"sven_meta":{"func_name":"get_requested_day","file_name":"util/database.py","commit_link":"github.com/philipptrenz/sunportal/commit/7eef493a168ed4e6731ff800713bfb8aee99a506","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#46-8d6ffcb96c35","input":"def get_mod_taken_together_with(code):\n '''\n Retrieves the list of modules taken together with the specified\n module code in the same semester.\n\n Returns a table of lists (up to 10 top results). Each list contains\n (specified code, module code of mod taken together, aySem, number of students)\n\n e.g. [(CS1010, CS1231, AY 16/17 Sem 1, 5)] means there are 5 students\n taking CS1010 and CS1231 together in AY 16/17 Sem 1.\n '''\n NUM_TOP_RESULTS_TO_RETURN = 10\n\n sql_command = \"SELECT sp1.moduleCode, sp2.moduleCode, sp1.acadYearAndSem, COUNT(*) \" + \\\n \"FROM studentPlans sp1, studentPlans sp2 \" + \\\n \"WHERE sp1.moduleCode = '\" + code + \"' AND \" + \\\n \"sp2.moduleCode <> sp1.moduleCode AND \" + \\\n \"sp1.studentId = sp2.studentId AND \" + \\\n \"sp1.acadYearAndSem = sp2.acadYearAndSem \" + \\\n \"GROUP BY sp1.moduleCode, sp2.moduleCode, sp1.acadYearAndSem \" + \\\n \"ORDER BY COUNT(*) DESC\"\n\n DB_CURSOR.execute(sql_command)\n\n return DB_CURSOR.fetchmany(NUM_TOP_RESULTS_TO_RETURN)","target":"def get_mod_taken_together_with(code):\n '''\n Retrieves the list of modules taken together with the specified\n module code in the same semester.\n\n Returns a table of lists (up to 10 top results). Each list contains\n (specified code, module code of mod taken together, aySem, number of students)\n\n e.g. [(CS1010, CS1231, AY 16/17 Sem 1, 5)] means there are 5 students\n taking CS1010 and CS1231 together in AY 16/17 Sem 1.\n '''\n NUM_TOP_RESULTS_TO_RETURN = 10\n\n sql_command = \"SELECT sp1.moduleCode, sp2.moduleCode, sp1.acadYearAndSem, COUNT(*) \" + \\\n \"FROM studentPlans sp1, studentPlans sp2 \" + \\\n \"WHERE sp1.moduleCode = %s AND \" + \\\n \"sp2.moduleCode <> sp1.moduleCode AND \" + \\\n \"sp1.studentId = sp2.studentId AND \" + \\\n \"sp1.acadYearAndSem = sp2.acadYearAndSem \" + \\\n \"GROUP BY sp1.moduleCode, sp2.moduleCode, sp1.acadYearAndSem \" + \\\n \"ORDER BY COUNT(*) DESC\"\n\n DB_CURSOR.execute(sql_command, (code,))\n\n return DB_CURSOR.fetchmany(NUM_TOP_RESULTS_TO_RETURN)","lang":"python","vul_type":"cwe-089","target_token_count":311,"sven_meta":{"func_name":"get_mod_taken_together_with","file_name":"components/model.py","commit_link":"github.com/nus-mtp/cs-modify/commit/79b4b1dd7eba5445751808e4c50b49d2dd08366b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#61-1df6e292d628","input":"@mod.route('/register', methods=['GET', 'POST'])\ndef register():\n if request.method == 'POST':\n error = None\n email = request.form['email'].strip()\n nickname = request.form['nickname'].strip()\n password = request.form['password'].strip()\n password2 = request.form['password2'].strip()\n\n email = email.lower()\n\n if email == \"\" or nickname == \"\" or password == \"\" or password2 == \"\":\n error = 'Please input all the information'\n elif password2 != password:\n error = 'The password is not repeated correctly'\n elif len(password) < 6:\n error = 'The password has at least 6 characters'\n elif not re.match(r'^[0-9a-zA-Z_]{0,19}@' +\n '[0-9a-zA-Z]{1,15}\\.[com,cn,net]', email):\n error = 'Please input the right email'\n\n sql = \"SELECT * FROM users where email = '%s';\" % (email)\n cursor.execute(sql)\n u = cursor.fetchone()\n\n if u is not None:\n error = 'The email has already exsit'\n\n if error is not None:\n return render_template('register.html', error=error)\n else:\n password = bcrypt.generate_password_hash(password)\n cursor.execute(\"INSERT INTO users(email,nickname,password) VALUES(%s,%s,%s);\", (email, nickname, password))\n conn.commit()\n flash('Register Success!')\n return redirect(url_for('users.login'))\n\n return render_template('register.html')","target":"@mod.route('/register', methods=['GET', 'POST'])\ndef register():\n if request.method == 'POST':\n error = None\n email = request.form['email'].strip()\n nickname = request.form['nickname'].strip()\n password = request.form['password'].strip()\n password2 = request.form['password2'].strip()\n\n email = email.lower()\n\n if email == \"\" or nickname == \"\" or password == \"\" or password2 == \"\":\n error = 'Please input all the information'\n elif password2 != password:\n error = 'The password is not repeated correctly'\n elif len(password) < 6:\n error = 'The password has at least 6 characters'\n elif not re.match(r'^[0-9a-zA-Z_]{0,19}@' +\n '[0-9a-zA-Z]{1,15}\\.[com,cn,net]', email):\n error = 'Please input the right email'\n\n cursor.execute(\"SELECT * FROM users where email = %s;\", (email,))\n u = cursor.fetchone()\n\n if u is not None:\n error = 'The email has already exsit'\n\n if error is not None:\n return render_template('register.html', error=error)\n else:\n password = bcrypt.generate_password_hash(password)\n cursor.execute(\"INSERT INTO users(email,nickname,password) VALUES(%s,%s,%s);\", (email, nickname, password))\n conn.commit()\n flash('Register Success!')\n return redirect(url_for('users.login'))\n\n return render_template('register.html')","lang":"python","vul_type":"cwe-089","target_token_count":327,"sven_meta":{"func_name":"register","file_name":"flaskr/flaskr/views/users.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#70-eb5b60e88246","input":"def _get_degree_2(user_id, cnx):\n \"\"\"Get all users of degree 2 follow that are not currently followed.\n Example:\n this user (follows) user B (follows) user B\n AND user (does NOT follow) user B\n means that user B will be in the list\n Args:\n user_id (int): id of user\n cnx: DB connection\n Returns:\n list: list of user_ids\n \"\"\"\n sql = 'WITH tmp_suggest (followed_id) AS ' \\\n '(' \\\n 'SELECT b.followed_id AS followed_id ' \\\n 'FROM ' \\\n 'tbl_follow a INNER JOIN tbl_follow b ' \\\n 'ON a.followed_id = b.follower_id ' \\\n 'WHERE a.follower_id = %s ' \\\n 'AND b.followed_id NOT IN ' \\\n '(SELECT followed_id FROM tbl_follow WHERE follower_id = %s) ' \\\n 'AND b.followed_id != %s ' \\\n ') ' \\\n 'SELECT followed_id, COUNT(*) AS num_mutual FROM tmp_suggest ' \\\n 'GROUP BY followed_id ' \\\n 'ORDER BY num_mutual DESC' % (user_id, user_id, user_id)\n with cnx.cursor() as cursor:\n cursor.execute(sql)\n res = cursor.fetchall()\n return list(map(lambda x: x[0], res))","target":"def _get_degree_2(user_id, cnx):\n \"\"\"Get all users of degree 2 follow that are not currently followed.\n Example:\n this user (follows) user B (follows) user B\n AND user (does NOT follow) user B\n means that user B will be in the list\n Args:\n user_id (int): id of user\n cnx: DB connection\n Returns:\n list: list of user_ids\n \"\"\"\n sql = 'WITH tmp_suggest (followed_id) AS ' \\\n '(' \\\n 'SELECT b.followed_id AS followed_id ' \\\n 'FROM ' \\\n 'tbl_follow a INNER JOIN tbl_follow b ' \\\n 'ON a.followed_id = b.follower_id ' \\\n 'WHERE a.follower_id = %s ' \\\n 'AND b.followed_id NOT IN ' \\\n '(SELECT followed_id FROM tbl_follow WHERE follower_id = %s) ' \\\n 'AND b.followed_id != %s ' \\\n ') ' \\\n 'SELECT followed_id, COUNT(*) AS num_mutual FROM tmp_suggest ' \\\n 'GROUP BY followed_id ' \\\n 'ORDER BY num_mutual DESC'\n with cnx.cursor() as cursor:\n cursor.execute(sql, (user_id, user_id, user_id))\n res = cursor.fetchall()\n return list(map(lambda x: x[0], res))","lang":"python","vul_type":"cwe-089","target_token_count":298,"sven_meta":{"func_name":"_get_degree_2","file_name":"server/ygoons/modules/user/follow_suggest.py","commit_link":"github.com/young-goons/rifflo-server/commit/fb311df76713b638c9486250f9badb288ffb2189","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#76-5aee3ebacea6","input":" @staticmethod\n def compare_and_update(user, message):\n \"\"\"\n This method compare a user object from the bot and his info from\n the Telegram message to check whether a user has changed his bio\n or not. If yes, the user object that represents him in the bot will\n be updated accordingly. Now this function is called only when a user\n asks the bot for showing the most popular cams\n\n :param user: user object that represents a Telegram user in this bot\n :param message: object from Telegram that contains info about user's\n message and about himself\n :return: None\n \"\"\"\n\n log.info('Checking whether user have changed his info or not...')\n msg = message.from_user\n usr_from_message = User(message.chat.id, msg.first_name, msg.username,\n msg.last_name)\n\n if user.chat_id != usr_from_message.chat_id:\n log.error(\"Wrong user to compare!\")\n return\n\n if user.first_name != usr_from_message.first_name:\n user.first_name = usr_from_message.first_name\n\n elif user.nickname != usr_from_message.nickname:\n user.nickname = usr_from_message.nickname\n\n elif user.last_name != usr_from_message.last_name:\n user.last_name = usr_from_message.last_name\n\n else:\n log.debug(\"User's info hasn't changed\")\n return\n\n log.info(\"User has changed his info\")\n log.debug(\"Updating user's info in the database...\")\n query = (f\"UPDATE users \"\n f\"SET first_name='{user.first_name}', \"\n f\"nickname='{user.nickname}', \"\n f\"last_name='{user.last_name}' \"\n f\"WHERE chat_id={user.chat_id}\")\n\n try:\n db.add(query)\n except DatabaseError:\n log.error(\"Could not update info about %s in the database\",\n user)\n else:\n log.debug(\"User's info has been updated\")","target":" @staticmethod\n def compare_and_update(user, message):\n \"\"\"\n This method compare a user object from the bot and his info from\n the Telegram message to check whether a user has changed his bio\n or not. If yes, the user object that represents him in the bot will\n be updated accordingly. Now this function is called only when a user\n asks the bot for showing the most popular cams\n\n :param user: user object that represents a Telegram user in this bot\n :param message: object from Telegram that contains info about user's\n message and about himself\n :return: None\n \"\"\"\n\n log.info('Checking whether user have changed his info or not...')\n msg = message.from_user\n usr_from_message = User(message.chat.id, msg.first_name, msg.username,\n msg.last_name)\n\n if user.chat_id != usr_from_message.chat_id:\n log.error(\"Wrong user to compare!\")\n return\n\n if user.first_name != usr_from_message.first_name:\n user.first_name = usr_from_message.first_name\n\n elif user.nickname != usr_from_message.nickname:\n user.nickname = usr_from_message.nickname\n\n elif user.last_name != usr_from_message.last_name:\n user.last_name = usr_from_message.last_name\n\n else:\n log.debug(\"User's info hasn't changed\")\n return\n\n log.info(\"User has changed his info\")\n log.debug(\"Updating user's info in the database...\")\n query = (f\"UPDATE users \"\n f\"SET first_name=%s, \"\n f\"nickname=%s, \"\n f\"last_name=%s \"\n f\"WHERE chat_id=%s\")\n\n parameters = (user.first_name, user.nickname, user.last_name,\n user.chat_id)\n\n try:\n db.add(query, parameters)\n except DatabaseError:\n log.error(\"Could not update info about %s in the database\",\n user)\n else:\n log.debug(\"User's info has been updated\")","lang":"python","vul_type":"cwe-089","target_token_count":415,"sven_meta":{"func_name":"compare_and_update","file_name":"photogpsbot/users.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#82-c90b0b529431","input":" def get_requested_month_for_inverter(self, inverter_serial, date):\n data = dict()\n\n month_start, month_end = self.get_epoch_month(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}\n month_total = 0\n\n query = '''\n SELECT TimeStamp, DayYield AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN %s AND %s AND Serial = %s\n '''\n\n data['data'] = list()\n for row in self.c.execute(query % (month_start, month_end, inverter_serial)):\n data['data'].append({'time': self.convert_local_ts_to_utc(row[0], self.local_timezone), 'power': row[1]})\n month_total += row[1]\n\n data['total'] = month_total\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM MonthData \n WHERE Serial = %s;\n ''' % inverter_serial\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if first_data: data['hasPrevious'] = (first_data < month_start)\n else: data['hasPrevious'] = False\n if last_data: data['hasNext'] = (last_data > month_end)\n else: data['hasNext'] = False\n\n return data","target":" def get_requested_month_for_inverter(self, inverter_serial, date):\n data = dict()\n\n month_start, month_end = self.get_epoch_month(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}\n month_total = 0\n\n query = '''\n SELECT TimeStamp, DayYield AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN ? AND ? AND Serial=?;\n '''\n\n data['data'] = list()\n for row in self.c.execute(query, (month_start, month_end, inverter_serial)):\n data['data'].append({'time': self.convert_local_ts_to_utc(row[0], self.local_timezone), 'power': row[1]})\n month_total += row[1]\n\n data['total'] = month_total\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM MonthData \n WHERE Serial=?;\n '''\n\n self.c.execute(query, (inverter_serial,))\n first_data, last_data = self.c.fetchone()\n\n if first_data: data['hasPrevious'] = (first_data < month_start)\n else: data['hasPrevious'] = False\n if last_data: data['hasNext'] = (last_data > month_end)\n else: data['hasNext'] = False\n\n return data","lang":"python","vul_type":"cwe-089","target_token_count":303,"sven_meta":{"func_name":"get_requested_month_for_inverter","file_name":"util/database.py","commit_link":"github.com/philipptrenz/sunportal/commit/7eef493a168ed4e6731ff800713bfb8aee99a506","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#93-c9d2dedc1961","input":"@app.route('//save', methods=['POST'])\ndef save_page_edit(page_name):\n # grab the new content from the user\n content = request.form.get('content')\n # check if 'page_name' exists in the database\n query = db.query(\"select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = '%s' order by page_content.id desc limit 1\" % page_name)\n result = query.namedresult()\n # if it doesn't exist, create a new page in the database\n if len(result) < 1:\n db.insert(\n 'page', {\n 'page_name': page_name\n }\n )\n else:\n pass\n # now that we're certain that the page exists in the database, we again grab the query\n # and insert new content in the database\n query = db.query(\"select id from page where page_name = '%s'\" % page_name)\n page_id = query.namedresult()[0].id\n db.insert(\n 'page_content', {\n 'page_id': page_id,\n 'content': content,\n 'timestamp': time.strftime(\"%Y-%m-%d %H:%M:%S\", localtime())\n }\n )\n return redirect(\"/%s\" % page_name)","target":"@app.route('//save', methods=['POST'])\ndef save_page_edit(page_name):\n # grab the new content from the user\n content = request.form.get('content')\n # check if 'page_name' exists in the database\n query = db.query(\"select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = $1 order by page_content.id desc limit 1\", page_name)\n result = query.namedresult()\n # if it doesn't exist, create a new page in the database\n if len(result) < 1:\n db.insert(\n 'page', {\n 'page_name': page_name\n }\n )\n else:\n pass\n # now that we're certain that the page exists in the database, we again grab the query\n # and insert new content in the database\n query = db.query(\"select id from page where page_name = '%s'\" % page_name)\n page_id = query.namedresult()[0].id\n db.insert(\n 'page_content', {\n 'page_id': page_id,\n 'content': content,\n 'timestamp': time.strftime(\"%Y-%m-%d %H:%M:%S\", localtime())\n }\n )\n return redirect(\"/%s\" % page_name)","lang":"python","vul_type":"cwe-089","target_token_count":291,"sven_meta":{"func_name":"save_page_edit","file_name":"server.py","commit_link":"github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#107-bbb3b629e11d","input":"def process_form():\n # see https://docs.python.org/3.4/library/cgi.html for the basic usage\n # here.\n form = cgi.FieldStorage()\n\n\n if \"player1\" not in form or \"player2\" not in form or \"size\" not in form:\n raise FormError(\"Invalid parameters.\")\n\n player1 = form[\"player1\"].value\n player2 = form[\"player2\"].value\n for c in player1+player2:\n if c not in \"_-\" and not c.isdigit() and not c.isalpha():\n raise FormError(\"Invalid parameters: The player names can only contains upper and lowercase characters, digits, underscores, and hypens\")\n return\n\n try:\n size = int(form[\"size\"].value)\n except:\n raise FormError(\"Invalid parameters: 'size' is not an integer.\")\n return\n\n if size < 2 or size > 9:\n raise FormError(\"The 'size' must be in the range 2-9, inclusive.\")\n\n\n # connect to the database\n conn = MySQLdb.connect(host = pnsdp.SQL_HOST,\n user = pnsdp.SQL_USER,\n passwd = pnsdp.SQL_PASSWD,\n db = pnsdp.SQL_DB)\n cursor = conn.cursor()\n\n # insert the new row\n cursor.execute(\"\"\"INSERT INTO games(player1,player2,size) VALUES(\"%s\",\"%s\",%d);\"\"\" % (player1,player2,size))\n\n gameID = cursor.lastrowid\n\n\n # MySQLdb has been building a transaction as we run. Commit them now, and\n # also clean up the other resources we've allocated.\n conn.commit()\n cursor.close()\n conn.close()\n\n return gameID","target":"def process_form():\n # see https://docs.python.org/3.4/library/cgi.html for the basic usage\n # here.\n form = cgi.FieldStorage()\n\n\n if \"player1\" not in form or \"player2\" not in form or \"size\" not in form:\n raise FormError(\"Invalid parameters.\")\n\n player1 = form[\"player1\"].value\n player2 = form[\"player2\"].value\n for c in player1+player2:\n if c not in \"_-\" and not c.isdigit() and not c.isalpha():\n raise FormError(\"Invalid parameters: The player names can only contains upper and lowercase characters, digits, underscores, and hypens\")\n return\n\n try:\n size = int(form[\"size\"].value)\n except:\n raise FormError(\"Invalid parameters: 'size' is not an integer.\")\n return\n\n if size < 2 or size > 9:\n raise FormError(\"The 'size' must be in the range 2-9, inclusive.\")\n\n\n # connect to the database\n conn = MySQLdb.connect(host = pnsdp.SQL_HOST,\n user = pnsdp.SQL_USER,\n passwd = pnsdp.SQL_PASSWD,\n db = pnsdp.SQL_DB)\n cursor = conn.cursor()\n\n # insert the new row\n cursor.execute(\"\"\"INSERT INTO games(player1,player2,size) VALUES(\"%s\",\"%s\",%d);\"\"\", (player1,player2,size))\n\n gameID = cursor.lastrowid\n\n\n # MySQLdb has been building a transaction as we run. Commit them now, and\n # also clean up the other resources we've allocated.\n conn.commit()\n cursor.close()\n conn.close()\n\n return gameID","lang":"python","vul_type":"cwe-089","target_token_count":373,"sven_meta":{"func_name":"process_form","file_name":"cgi/create_game.py","commit_link":"github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#108-2253646ce3a1","input":" def clean_cache(self, limit):\n \"\"\"\n Method that remove several User objects from cache - the least \n active users\n :param limit: number of the users that the method should remove\n from cache\n :return: None\n \"\"\"\n\n log.info('Figuring out the least active users...')\n # Select users that the least active recently\n user_ids = tuple(self.users.keys())\n query = ('SELECT chat_id '\n 'FROM photo_queries_table2 '\n f'WHERE chat_id in {user_ids} '\n 'GROUP BY chat_id '\n 'ORDER BY MAX(time) '\n f'LIMIT {limit}')\n\n try:\n cursor = db.execute_query(query)\n except DatabaseConnectionError:\n log.error(\"Can't figure out the least active users...\")\n return\n\n if not cursor.rowcount:\n log.warning(\"There are no users in the db\")\n return\n\n # Make list out of tuple of tuples that is returned by MySQL\n least_active_users = [chat_id[0] for chat_id in cursor.fetchall()]\n log.info('Removing %d least active users from cache...', limit)\n num_deleted_entries = 0\n for entry in least_active_users:\n log.debug('Deleting %s...', entry)\n deleted_entry = self.users.pop(entry, None)\n if deleted_entry:\n num_deleted_entries += 1\n log.debug(\"%d users were removed from cache.\", num_deleted_entries)","target":" def clean_cache(self, limit):\n \"\"\"\n Method that remove several User objects from cache - the least \n active users\n :param limit: number of the users that the method should remove\n from cache\n :return: None\n \"\"\"\n\n log.info('Figuring out the least active users...')\n # Select users that the least active recently\n user_ids = tuple(self.users.keys())\n query = ('SELECT chat_id '\n 'FROM photo_queries_table2 '\n f'WHERE chat_id in {user_ids} '\n 'GROUP BY chat_id '\n 'ORDER BY MAX(time) '\n f'LIMIT %s')\n\n parameters = limit,\n\n try:\n cursor = db.execute_query(query, parameters)\n except DatabaseConnectionError:\n log.error(\"Can't figure out the least active users...\")\n return\n\n if not cursor.rowcount:\n log.warning(\"There are no users in the db\")\n return\n\n # Make list out of tuple of tuples that is returned by MySQL\n least_active_users = [chat_id[0] for chat_id in cursor.fetchall()]\n log.info('Removing %d least active users from cache...', limit)\n num_deleted_entries = 0\n for entry in least_active_users:\n log.debug('Deleting %s...', entry)\n deleted_entry = self.users.pop(entry, None)\n if deleted_entry:\n num_deleted_entries += 1\n log.debug(\"%d users were removed from cache.\", num_deleted_entries)","lang":"python","vul_type":"cwe-089","target_token_count":310,"sven_meta":{"func_name":"clean_cache","file_name":"photogpsbot/users.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#120-a79c4d358af0","input":"@app.route('/movies/add', methods=['GET', 'POST'])\ndef add_movie():\n form = MovieForm()\n if not form.validate_on_submit():\n return render_template('new_movie.html', title='Add New Movie', form=form)\n lang_id = add_language(form.data['language'])\n movie = {\n 'title': '',\n 'description': '',\n 'release_year': 0,\n 'rental_duration': 0,\n 'rental_rate': 0.00,\n 'length': 0,\n 'replacement_cost': 0.00\n }\n for k, v in movie.items():\n movie[k] = form.data[k]\n movie['language_id'] = movie.get('language_id', lang_id)\n cur.execute(\n \"\"\"\n INSERT INTO film (title, description, release_year, language_id, rental_duration, rental_rate, length, replacement_cost)\n VALUES ('{}', '{}', {}, {}, {}, {}, {}, {})\n \"\"\".format(*[v for k, v in movie.items()])\n )\n try:\n cur.execute(f\"SELECT * FROM film where fulltext @@ to_tsquery('Dark Knight')\")\n res = cur.fetchall()\n conn.commit()\n return redirect(url_for('movies'))\n except Exception as e:\n return redirect(url_for('index'))","target":"@app.route('/movies/add', methods=['GET', 'POST'])\ndef add_movie():\n form = MovieForm()\n if not form.validate_on_submit():\n return render_template('new_movie.html', title='Add New Movie', form=form)\n lang_id = add_language(form.data['language'])\n movie = {\n 'title': '',\n 'description': '',\n 'release_year': 0,\n 'rental_duration': 0,\n 'rental_rate': 0.00,\n 'length': 0,\n 'replacement_cost': 0.00\n }\n for k, v in movie.items():\n movie[k] = form.data[k]\n movie['language_id'] = movie.get('language_id', lang_id)\n cur.execute(\n \"\"\"\n INSERT INTO film (title, description, release_year, language_id, rental_duration, rental_rate, length, replacement_cost)\n VALUES (%s, %s, %s, %s, %s, %s, %s, %s)\n \"\"\", [(v, ) for k, v in movie.items()]\n )\n try:\n cur.execute(\"SELECT * FROM film where fulltext @@ to_tsquery(%s)\", (movie['title'], ))\n res = cur.fetchall()\n conn.commit()\n return redirect(url_for('movies'))\n except Exception as e:\n return redirect(url_for('index'))","lang":"python","vul_type":"cwe-089","target_token_count":291,"sven_meta":{"func_name":"add_movie","file_name":"app.py","commit_link":"github.com/Elbertbiggs360/dvdrental/commit/ad144ae2a08a332498d0831bc255170d57ba754b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#134-6815b513f87c","input":" def fetch_resultSet(self, session, id):\n self._openContainer(session)\n\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = (\"SELECT class, data FROM %s WHERE identifier = '%s';\" %\n (self.table, sid)\n )\n res = self._query(query)\n try:\n rdict = res.dictresult()[0]\n except IndexError:\n raise ObjectDoesNotExistException('%s/%s' % (self.id, sid))\n\n data = rdict['data']\n try:\n ndata = pg.unescape_bytea(data)\n except:\n # Insufficient PyGreSQL version\n ndata = data.replace(\"\\\\'\", \"'\")\n\n ndata = ndata.replace('\\\\000', '\\x00')\n ndata = ndata.replace('\\\\012', '\\n')\n # data is res.dictresult()\n cl = rdict['class']\n rset = dynamic.buildObject(session, cl, [[]])\n rset.deserialize(session, ndata)\n rset.id = id\n\n # Update expires\n now = time.time()\n nowStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(now))\n expires = now + self.get_default(session, 'expires', 600)\n rset.timeExpires = expires\n expiresStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(expires))\n\n query = (\"UPDATE %s SET timeAccessed = '%s', expires = '%s' \"\n \"WHERE identifier = '%s';\" %\n (self.table, nowStr, expiresStr, sid)\n )\n self._query(query)\n return rset","target":" def fetch_resultSet(self, session, id):\n self._openContainer(session)\n\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = (\"SELECT class, data FROM %s WHERE identifier = $1;\" %\n (self.table)\n )\n res = self._query(query, sid)\n try:\n rdict = res.dictresult()[0]\n except IndexError:\n raise ObjectDoesNotExistException('%s/%s' % (self.id, sid))\n\n data = rdict['data']\n try:\n ndata = pg.unescape_bytea(data)\n except:\n # Insufficient PyGreSQL version\n ndata = data.replace(\"\\\\'\", \"'\")\n\n ndata = ndata.replace('\\\\000', '\\x00')\n ndata = ndata.replace('\\\\012', '\\n')\n # data is res.dictresult()\n cl = rdict['class']\n rset = dynamic.buildObject(session, cl, [[]])\n rset.deserialize(session, ndata)\n rset.id = id\n\n # Update expires\n now = time.time()\n nowStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(now))\n expires = now + self.get_default(session, 'expires', 600)\n rset.timeExpires = expires\n expiresStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(expires))\n\n query = (\"UPDATE %s SET timeAccessed = $1, expires = $2 \"\n \"WHERE identifier = $3;\" % (self.table)\n )\n self._query(query, nowStr, expiresStr, sid)\n return rset","lang":"python","vul_type":"cwe-089","target_token_count":378,"sven_meta":{"func_name":"fetch_resultSet","file_name":"cheshire3/sql/resultSetStore.py","commit_link":"github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#151-8bfb8968ccf5","input":"def create_cf_base():\n url = 'http://codeforces.com/problemset/'\n r = requests.get(url)\n max_page = 0\n soup = BeautifulSoup(r.text, \"lxml\")\n base = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\cf.db\")\n conn = base.cursor()\n conn.execute(\"create table problems (problem INTEGER, diff CHAR)\")\n for i in available_tags:\n conn.execute(\"create table \" + i + \" (problems INTEGER, diff CHAR)\")\n\n for link in soup.find_all(attrs={\"class\" : \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[3]))\n\n a = 0\n b = 0\n f = False\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/problemset/' + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n old = ''\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5 and old != s[3] + s[4]:\n a = s[3]\n b = s[4]\n old = s[3] + s[4]\n if not f:\n f = True\n last_update = old\n conn.execute(\"insert into problems values (?, ?)\", (a, b))\n if len(s) == 4 and s[3] in available_tags:\n conn.execute(\"insert into \" + s[3] + \" values (?, ?)\", (a, b))\n\n base.commit()\n base.close()\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"create table users (chat_id INTEGER, username STRING, last_update STRING, last_problem STRING, state INTEGER)\")\n conn.execute(\"create table last_update_problemset (problem STRING)\")\n conn.execute(\"insert into last_update_problemset values (?)\", (last_update, ))\n settings.commit()\n settings.close()","target":"def create_cf_base():\n url = 'http://codeforces.com/problemset/'\n r = requests.get(url)\n max_page = 0\n soup = BeautifulSoup(r.text, \"lxml\")\n base = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\cf.db\")\n conn = base.cursor()\n conn.execute(\"create table problems (problem INTEGER, diff CHAR)\")\n for i in available_tags:\n conn.execute(\"create table ? (problems INTEGER, diff CHAR)\", (i,))\n\n for link in soup.find_all(attrs={\"class\" : \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[3]))\n\n a = 0\n b = 0\n f = False\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/problemset/' + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n old = ''\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5 and old != s[3] + s[4]:\n a = s[3]\n b = s[4]\n old = s[3] + s[4]\n if not f:\n f = True\n last_update = old\n conn.execute(\"insert into problems values (?, ?)\", (a, b))\n if len(s) == 4 and s[3] in available_tags:\n conn.execute(\"insert into ? values (?, ?)\", (s[3], a, b))\n\n base.commit()\n base.close()\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"create table users (chat_id INTEGER, username STRING, last_update STRING, last_problem STRING, state INTEGER)\")\n conn.execute(\"create table last_update_problemset (problem STRING)\")\n conn.execute(\"insert into last_update_problemset values (?)\", (last_update, ))\n settings.commit()\n settings.close()","lang":"python","vul_type":"cwe-089","target_token_count":480,"sven_meta":{"func_name":"create_cf_base","file_name":"bases/createcfbase.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#156-62894e526f8a","input":" def callback(recipeName):\n menu.pack_forget()\n viewRecipeFrame.pack(expand=True, fill='both')\n groceryButton.pack_forget()\n database_file = \"meal_planner.db\"\n print(recipeName)\n with sqlite3.connect(database_file) as conn:\n cursor = conn.cursor()\n selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = \"\"\" + \"\\\"\" + recipeName + \"\\\"\")\n for result in [selection]:\n for row in result.fetchall():\n name = row[0]\n time = row[1]\n servings = row[2]\n ingredients = row[4]\n directions = row[5]\n\n string = (\"Name: {} \\n Cook time: {} \\n Number of Servings: {} \\n \".format(name, time, servings))\n secondString = (\"Ingredients: {}\".format(ingredients))\n thirdString = (\"Directions: {}\".format(directions))\n Label(viewRecipeFrame, text=string, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=secondString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=thirdString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n returnButton = Button(menuFrame, text = \"Return to Menu\", highlightbackground=\"#e7e7e7\", command=lambda: [viewRecipeFrame.pack_forget(),\n menu.pack(), returnButton.pack_forget(), label.configure(text=\"Meal Planer\"),\n groceryButton.pack(side=RIGHT)])\n returnButton.pack(side=RIGHT)","target":" def callback(recipeName):\n menu.pack_forget()\n viewRecipeFrame.pack(expand=True, fill='both')\n groceryButton.pack_forget()\n database_file = \"meal_planner.db\"\n print(recipeName)\n with sqlite3.connect(database_file) as conn:\n cursor = conn.cursor()\n selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = ?;\"\"\", (recipeName, ))\n for result in [selection]:\n for row in result.fetchall():\n name = row[0]\n time = row[1]\n servings = row[2]\n ingredients = row[4]\n directions = row[5]\n\n string = (\"Name: {} \\n Cook time: {} \\n Number of Servings: {} \\n \".format(name, time, servings))\n secondString = (\"Ingredients: {}\".format(ingredients))\n thirdString = (\"Directions: {}\".format(directions))\n Label(viewRecipeFrame, text=string, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=secondString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=thirdString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n returnButton = Button(menuFrame, text = \"Return to Menu\", highlightbackground=\"#e7e7e7\", command=lambda: [viewRecipeFrame.pack_forget(),\n menu.pack(), returnButton.pack_forget(), label.configure(text=\"Meal Planer\"),\n groceryButton.pack(side=RIGHT)])\n returnButton.pack(side=RIGHT)","lang":"python","vul_type":"cwe-089","target_token_count":377,"sven_meta":{"func_name":"__init__.callback","file_name":"mealPlan.py","commit_link":"github.com/trishamoyer/RecipePlanner-Python/commit/44d2ce370715d9344fad34b3b749322ab095a925","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#167-f3778c74e1dc","input":"@app.route('/top_proxies')\ndef top_proxies():\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT sum(amount) FROM holders\"\n cur.execute(query)\n total = cur.fetchone()\n total_votes = total[0]\n\n query = \"SELECT voting_as FROM holders WHERE voting_as<>'1.2.5' group by voting_as\"\n cur.execute(query)\n results = cur.fetchall()\n #con.close()\n\n proxies = []\n\n for p in range(0, len(results)):\n\n proxy_line = [0] * 5\n\n proxy_id = results[p][0]\n proxy_line[0] = proxy_id\n\n query = \"SELECT account_name, amount FROM holders WHERE account_id='\"+proxy_id+\"' LIMIT 1\"\n cur.execute(query)\n proxy = cur.fetchone()\n\n try:\n proxy_name = proxy[0]\n proxy_amount = proxy[1]\n except:\n proxy_name = \"unknown\"\n proxy_amount = 0\n\n\n proxy_line[1] = proxy_name\n\n query = \"SELECT amount, account_id FROM holders WHERE voting_as='\"+proxy_id+\"'\"\n cur.execute(query)\n results2 = cur.fetchall()\n\n proxy_line[2] = int(proxy_amount)\n\n for p2 in range(0, len(results2)):\n amount = results2[p2][0]\n account_id = results2[p2][1]\n proxy_line[2] = proxy_line[2] + int(amount) # total proxy votes\n proxy_line[3] = proxy_line[3] + 1 # followers\n\n if proxy_line[3] > 2:\n percentage = float(float(proxy_line[2]) * 100.0/ float(total_votes))\n proxy_line[4] = percentage\n proxies.append(proxy_line)\n\n con.close()\n\n proxies = sorted(proxies, key=lambda k: int(k[2]))\n r_proxies = proxies[::-1]\n\n return jsonify(filter(None, r_proxies))","target":"@app.route('/top_proxies')\ndef top_proxies():\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT sum(amount) FROM holders\"\n cur.execute(query)\n total = cur.fetchone()\n total_votes = total[0]\n\n query = \"SELECT voting_as FROM holders WHERE voting_as<>'1.2.5' group by voting_as\"\n cur.execute(query)\n results = cur.fetchall()\n #con.close()\n\n proxies = []\n\n for p in range(0, len(results)):\n\n proxy_line = [0] * 5\n\n proxy_id = results[p][0]\n proxy_line[0] = proxy_id\n\n query = \"SELECT account_name, amount FROM holders WHERE account_id=%s LIMIT 1\"\n cur.execute(query, (proxy_id,))\n proxy = cur.fetchone()\n\n try:\n proxy_name = proxy[0]\n proxy_amount = proxy[1]\n except:\n proxy_name = \"unknown\"\n proxy_amount = 0\n\n\n proxy_line[1] = proxy_name\n\n query = \"SELECT amount, account_id FROM holders WHERE voting_as=%s\"\n cur.execute(query, (proxy_id,))\n results2 = cur.fetchall()\n\n proxy_line[2] = int(proxy_amount)\n\n for p2 in range(0, len(results2)):\n amount = results2[p2][0]\n account_id = results2[p2][1]\n proxy_line[2] = proxy_line[2] + int(amount) # total proxy votes\n proxy_line[3] = proxy_line[3] + 1 # followers\n\n if proxy_line[3] > 2:\n percentage = float(float(proxy_line[2]) * 100.0/ float(total_votes))\n proxy_line[4] = percentage\n proxies.append(proxy_line)\n\n con.close()\n\n proxies = sorted(proxies, key=lambda k: int(k[2]))\n r_proxies = proxies[::-1]\n\n return jsonify(filter(None, r_proxies))","lang":"python","vul_type":"cwe-089","target_token_count":433,"sven_meta":{"func_name":"top_proxies","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#176-66927d1ecd10","input":" @staticmethod\n def get_last_active_users(limit):\n \"\"\"\n Get from the database a tuple of users who have been recently using\n the bot\n :param limit: integer that specifies how much users to get\n :return: tuple of tuples with users info\n \"\"\"\n log.info('Evaluating last active users with date of '\n 'last time when they used bot...')\n\n # From photo_queries_table2 we take chat_id of the last\n # active users and from 'users' table we take info about these\n # users by chat_id which is a foreign key\n query = ('SELECT p.chat_id, u.first_name, u.nickname, u.last_name, '\n 'u.language '\n 'FROM photo_queries_table2 p '\n 'INNER JOIN users u '\n 'ON p.chat_id = u.chat_id '\n 'GROUP BY u.chat_id, u.first_name, u.nickname, u.last_name, '\n 'u.language '\n 'ORDER BY MAX(time)'\n f'DESC LIMIT {limit}')\n\n try:\n cursor = db.execute_query(query)\n except DatabaseConnectionError:\n log.error(\"Cannot get the last active users because of some \"\n \"problems with the database\")\n raise\n\n last_active_users = cursor.fetchall()\n return last_active_users","target":" @staticmethod\n def get_last_active_users(limit):\n \"\"\"\n Get from the database a tuple of users who have been recently using\n the bot\n :param limit: integer that specifies how much users to get\n :return: tuple of tuples with users info\n \"\"\"\n log.info('Evaluating last active users with date of '\n 'last time when they used bot...')\n\n # From photo_queries_table2 we take chat_id of the last\n # active users and from 'users' table we take info about these\n # users by chat_id which is a foreign key\n query = ('SELECT p.chat_id, u.first_name, u.nickname, u.last_name, '\n 'u.language '\n 'FROM photo_queries_table2 p '\n 'INNER JOIN users u '\n 'ON p.chat_id = u.chat_id '\n 'GROUP BY u.chat_id, u.first_name, u.nickname, u.last_name, '\n 'u.language '\n 'ORDER BY MAX(time)'\n f'DESC LIMIT %s')\n\n parameters = limit,\n\n try:\n cursor = db.execute_query(query, parameters)\n except DatabaseConnectionError:\n log.error(\"Cannot get the last active users because of some \"\n \"problems with the database\")\n raise\n\n last_active_users = cursor.fetchall()\n return last_active_users","lang":"python","vul_type":"cwe-089","target_token_count":281,"sven_meta":{"func_name":"get_last_active_users","file_name":"photogpsbot/users.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#178-1a1f148dbb25","input":"def update_institutions(conn, sqlite, k10plus, ai):\n \"\"\"\n Update the institution table.\n \"\"\"\n current_institutions = get_all_current_institutions(k10plus, ai)\n old_institutions = get_all_old_institutions(conn, sqlite)\n\n # Check if the institution table is allready filled and this is not the first checkup\n institution_table_is_filled = len(old_institutions) > 10\n\n for old_institution in old_institutions:\n if institution_table_is_filled and old_institution not in current_institutions:\n message = \"Die ISIL %s ist im aktuellen Import nicht mehr vorhanden.\\nWenn dies beabsichtigt ist, bitte die Institution aus der Datenbank loeschen.\" % old_institution\n send_message(message)\n\n for current_institution in current_institutions:\n if current_institution == \" \" or '\"' in current_institution:\n continue\n if current_institution not in old_institutions:\n message = \"The institution %s is new in Solr.\" % current_institution\n if institution_table_is_filled:\n send_message(message)\n else:\n logging.info(message)\n sql = \"INSERT INTO institution (institution) VALUES ('%s')\" % current_institution\n sqlite.execute(sql)\n conn.commit()","target":"def update_institutions(conn, sqlite, k10plus, ai):\n \"\"\"\n Update the institution table.\n \"\"\"\n current_institutions = get_all_current_institutions(k10plus, ai)\n old_institutions = get_all_old_institutions(conn, sqlite)\n\n # Check if the institution table is allready filled and this is not the first checkup\n institution_table_is_filled = len(old_institutions) > 10\n\n for old_institution in old_institutions:\n if institution_table_is_filled and old_institution not in current_institutions:\n message = \"Die ISIL %s ist im aktuellen Import nicht mehr vorhanden.\\nWenn dies beabsichtigt ist, bitte die Institution aus der Datenbank loeschen.\" % old_institution\n send_message(message)\n\n for current_institution in current_institutions:\n if current_institution == \" \" or '\"' in current_institution:\n continue\n if current_institution not in old_institutions:\n message = \"The institution %s is new in Solr.\" % current_institution\n if institution_table_is_filled:\n send_message(message)\n else:\n logging.info(message)\n sql = \"INSERT INTO institution (institution) VALUES (?)\"\n sqlite.execute(sql, (current_institution,))\n conn.commit()","lang":"python","vul_type":"cwe-089","target_token_count":270,"sven_meta":{"func_name":"update_institutions","file_name":"bin/solrcheckup.py","commit_link":"github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#181-05b7cb5ad097","input":"@app.route('/sloka')\ndef sloka():\n\n sloka_number = request.args.get('sloka_number')\n\n sloka_number_parts = sloka_number.split('.')\n\n sloka_number_previous = \"%s.%s.%d\" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])-1)\n sloka_number_next = \"%s.%s.%d\" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])+1)\n\n try:\n with sql.connect('amara.db') as con:\n con.row_factory = sql.Row\n cur = con.cursor()\n cur.execute(\"select * from mula where sloka_number = '%s' order by sloka_line;\" % sloka_number)\n mula = cur.fetchall();\n\n cur.execute(\"select * from pada where sloka_number = '%s' order by id;\" % sloka_number)\n pada = cur.fetchall();\n\n varga = \"\"\n if len(pada) > 0:\n varga = pada[0][\"varga\"]\n\n return render_template('sloka.html', mula=mula, pada=pada, varga=varga, sloka_number=sloka_number, sloka_number_previous=sloka_number_previous, sloka_number_next=sloka_number_next)\n finally:\n con.close()","target":"@app.route('/sloka')\ndef sloka():\n\n sloka_number = request.args.get('sloka_number')\n\n sloka_number_parts = sloka_number.split('.')\n\n sloka_number_previous = \"%s.%s.%d\" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])-1)\n sloka_number_next = \"%s.%s.%d\" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])+1)\n\n try:\n with sql.connect('amara.db') as con:\n con.row_factory = sql.Row\n cur = con.cursor()\n cur.execute(\"select * from mula where sloka_number = ? order by sloka_line;\", [sloka_number])\n mula = cur.fetchall();\n\n cur.execute(\"select * from pada where sloka_number = ? order by id;\", [sloka_number])\n pada = cur.fetchall();\n\n varga = \"\"\n if len(pada) > 0:\n varga = pada[0][\"varga\"]\n\n return render_template('sloka.html', mula=mula, pada=pada, varga=varga, sloka_number=sloka_number, sloka_number_previous=sloka_number_previous, sloka_number_next=sloka_number_next)\n finally:\n con.close()","lang":"python","vul_type":"cwe-089","target_token_count":297,"sven_meta":{"func_name":"sloka","file_name":"docker/app.py","commit_link":"github.com/aupasana/amara-quiz/commit/6ceb5dc8ec38b4a3f1399e578ab970f7e3354922","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-125#2-35e661c51311","input":"static int ng_pkt(git_pkt **out, const char *line, size_t len)\n{\n\tgit_pkt_ng *pkt;\n\tconst char *ptr;\n\tsize_t alloclen;\n\n\tpkt = git__malloc(sizeof(*pkt));\n\tGITERR_CHECK_ALLOC(pkt);\n\n\tpkt->ref = NULL;\n\tpkt->type = GIT_PKT_NG;\n\n\tline += 3; /* skip \"ng \" */\n\tif (!(ptr = strchr(line, ' ')))\n\t\tgoto out_err;\n\tlen = ptr - line;\n\n\tGITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);\n\tpkt->ref = git__malloc(alloclen);\n\tGITERR_CHECK_ALLOC(pkt->ref);\n\n\tmemcpy(pkt->ref, line, len);\n\tpkt->ref[len] = '\\0';\n\n\tline = ptr + 1;\n\tif (!(ptr = strchr(line, '\\n')))\n\t\tgoto out_err;\n\tlen = ptr - line;\n\n\tGITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);\n\tpkt->msg = git__malloc(alloclen);\n\tGITERR_CHECK_ALLOC(pkt->msg);\n\n\tmemcpy(pkt->msg, line, len);\n\tpkt->msg[len] = '\\0';\n\n\t*out = (git_pkt *)pkt;\n\treturn 0;\n\nout_err:\n\tgiterr_set(GITERR_NET, \"invalid packet line\");\n\tgit__free(pkt->ref);\n\tgit__free(pkt);\n\treturn -1;\n}","target":"static int ng_pkt(git_pkt **out, const char *line, size_t len)\n{\n\tgit_pkt_ng *pkt;\n\tconst char *ptr;\n\tsize_t alloclen;\n\n\tpkt = git__malloc(sizeof(*pkt));\n\tGITERR_CHECK_ALLOC(pkt);\n\n\tpkt->ref = NULL;\n\tpkt->type = GIT_PKT_NG;\n\n\tif (len < 3)\n\t\tgoto out_err;\n\tline += 3; /* skip \"ng \" */\n\tlen -= 3;\n\tif (!(ptr = memchr(line, ' ', len)))\n\t\tgoto out_err;\n\tlen = ptr - line;\n\n\tGITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);\n\tpkt->ref = git__malloc(alloclen);\n\tGITERR_CHECK_ALLOC(pkt->ref);\n\n\tmemcpy(pkt->ref, line, len);\n\tpkt->ref[len] = '\\0';\n\n\tif (len < 1)\n\t\tgoto out_err;\n\tline = ptr + 1;\n\tlen -= 1;\n\tif (!(ptr = memchr(line, '\\n', len)))\n\t\tgoto out_err;\n\tlen = ptr - line;\n\n\tGITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);\n\tpkt->msg = git__malloc(alloclen);\n\tGITERR_CHECK_ALLOC(pkt->msg);\n\n\tmemcpy(pkt->msg, line, len);\n\tpkt->msg[len] = '\\0';\n\n\t*out = (git_pkt *)pkt;\n\treturn 0;\n\nout_err:\n\tgiterr_set(GITERR_NET, \"invalid packet line\");\n\tgit__free(pkt->ref);\n\tgit__free(pkt);\n\treturn -1;\n}","lang":"c","vul_type":"cwe-125","target_token_count":330,"sven_meta":{"func_name":"ng_pkt","file_name":"src/transports/smart_pkt.c","commit_link":"github.com/libgit2/libgit2/commit/1f9a8510e1d2f20ed7334eeeddb92c4dd8e7c649","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#11-52c63e4eb17a","input":"static x86newTokenType getToken(const char *str, size_t *begin, size_t *end) {\n\t// Skip whitespace\n\twhile (begin && isspace ((ut8)str[*begin])) {\n\t\t++(*begin);\n\t}\n\n\tif (!str[*begin]) { // null byte\n\t\t*end = *begin;\n\t\treturn TT_EOF;\n\t} else if (isalpha ((ut8)str[*begin])) { // word token\n\t\t*end = *begin;\n\t\twhile (end && isalnum ((ut8)str[*end])) {\n\t\t\t++(*end);\n\t\t}\n\t\treturn TT_WORD;\n\t} else if (isdigit ((ut8)str[*begin])) { // number token\n\t\t*end = *begin;\n\t\twhile (end && isalnum ((ut8)str[*end])) { // accept alphanumeric characters, because hex.\n\t\t\t++(*end);\n\t\t}\n\t\treturn TT_NUMBER;\n\t} else { // special character: [, ], +, *, ...\n\t\t*end = *begin + 1;\n\t\treturn TT_SPECIAL;\n\t}\n}","target":"static x86newTokenType getToken(const char *str, size_t *begin, size_t *end) {\n\tif (*begin > strlen (str)) {\n\t\treturn TT_EOF;\n\t}\n\t// Skip whitespace\n\twhile (begin && str[*begin] && isspace ((ut8)str[*begin])) {\n\t\t++(*begin);\n\t}\n\n\tif (!str[*begin]) { // null byte\n\t\t*end = *begin;\n\t\treturn TT_EOF;\n\t}\n\tif (isalpha ((ut8)str[*begin])) { // word token\n\t\t*end = *begin;\n\t\twhile (end && str[*end] && isalnum ((ut8)str[*end])) {\n\t\t\t++(*end);\n\t\t}\n\t\treturn TT_WORD;\n\t}\n\tif (isdigit ((ut8)str[*begin])) { // number token\n\t\t*end = *begin;\n\t\twhile (end && isalnum ((ut8)str[*end])) { // accept alphanumeric characters, because hex.\n\t\t\t++(*end);\n\t\t}\n\t\treturn TT_NUMBER;\n\t} else { // special character: [, ], +, *, ...\n\t\t*end = *begin + 1;\n\t\treturn TT_SPECIAL;\n\t}\n}","lang":"c","vul_type":"cwe-125","target_token_count":260,"sven_meta":{"func_name":"getToken","file_name":"libr/asm/p/asm_x86_nz.c","commit_link":"github.com/radare/radare2/commit/66191f780863ea8c66ace4040d0d04a8842e8432","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#12-f4464d5af6a0","input":"fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mrb_bool resume, mrb_bool vmexec)\n{\n struct mrb_context *c = fiber_check(mrb, self);\n struct mrb_context *old_c = mrb->c;\n mrb_value value;\n\n fiber_check_cfunc(mrb, c);\n if (resume && c->status == MRB_FIBER_TRANSFERRED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"resuming transferred fiber\");\n }\n if (c->status == MRB_FIBER_RUNNING || c->status == MRB_FIBER_RESUMED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"double resume (fib)\");\n }\n if (c->status == MRB_FIBER_TERMINATED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"resuming dead fiber\");\n }\n mrb->c->status = resume ? MRB_FIBER_RESUMED : MRB_FIBER_TRANSFERRED;\n c->prev = resume ? mrb->c : (c->prev ? c->prev : mrb->root_c);\n if (c->status == MRB_FIBER_CREATED) {\n mrb_value *b, *e;\n\n if (len >= c->stend - c->stack) {\n mrb_raise(mrb, E_FIBER_ERROR, \"too many arguments to fiber\");\n }\n b = c->stack+1;\n e = b + len;\n while (bcibase->argc = (int)len;\n value = c->stack[0] = MRB_PROC_ENV(c->ci->proc)->stack[0];\n }\n else {\n value = fiber_result(mrb, a, len);\n }\n fiber_switch_context(mrb, c);\n\n if (vmexec) {\n c->vmexec = TRUE;\n value = mrb_vm_exec(mrb, c->ci[-1].proc, c->ci->pc);\n mrb->c = old_c;\n }\n else {\n MARK_CONTEXT_MODIFY(c);\n }\n return value;\n}","target":"fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mrb_bool resume, mrb_bool vmexec)\n{\n struct mrb_context *c = fiber_check(mrb, self);\n struct mrb_context *old_c = mrb->c;\n enum mrb_fiber_state status;\n mrb_value value;\n\n fiber_check_cfunc(mrb, c);\n status = c->status;\n if (resume && status == MRB_FIBER_TRANSFERRED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"resuming transferred fiber\");\n }\n if (status == MRB_FIBER_RUNNING || status == MRB_FIBER_RESUMED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"double resume (fib)\");\n }\n if (status == MRB_FIBER_TERMINATED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"resuming dead fiber\");\n }\n old_c->status = resume ? MRB_FIBER_RESUMED : MRB_FIBER_TRANSFERRED;\n c->prev = resume ? mrb->c : (c->prev ? c->prev : mrb->root_c);\n fiber_switch_context(mrb, c);\n if (status == MRB_FIBER_CREATED) {\n mrb_value *b, *e;\n\n mrb_stack_extend(mrb, len+2); /* for receiver and (optional) block */\n b = c->stack+1;\n e = b + len;\n while (bcibase->argc = (int)len;\n value = c->stack[0] = MRB_PROC_ENV(c->ci->proc)->stack[0];\n }\n else {\n value = fiber_result(mrb, a, len);\n }\n\n if (vmexec) {\n c->vmexec = TRUE;\n value = mrb_vm_exec(mrb, c->ci[-1].proc, c->ci->pc);\n mrb->c = old_c;\n }\n else {\n MARK_CONTEXT_MODIFY(c);\n }\n return value;\n}","lang":"c","vul_type":"cwe-125","target_token_count":459,"sven_meta":{"func_name":"fiber_switch","file_name":"mrbgems/mruby-fiber/src/fiber.c","commit_link":"github.com/mruby/mruby/commit/778500563a9f7ceba996937dc886bd8cde29b42b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#26-bb743c820ecd","input":"PrimitiveStatus TrustedPrimitives::UntrustedCall(uint64_t untrusted_selector,\n MessageWriter *input,\n MessageReader *output) {\n int ret;\n\n UntrustedCacheMalloc *untrusted_cache = UntrustedCacheMalloc::Instance();\n\n SgxParams *const sgx_params =\n reinterpret_cast(untrusted_cache->Malloc(sizeof(SgxParams)));\n Cleanup clean_up(\n [sgx_params, untrusted_cache] { untrusted_cache->Free(sgx_params); });\n sgx_params->input_size = 0;\n sgx_params->input = nullptr;\n if (input) {\n sgx_params->input_size = input->MessageSize();\n if (sgx_params->input_size > 0) {\n // Allocate and copy data to |input_buffer|.\n sgx_params->input = untrusted_cache->Malloc(sgx_params->input_size);\n input->Serialize(const_cast(sgx_params->input));\n }\n }\n sgx_params->output_size = 0;\n sgx_params->output = nullptr;\n CHECK_OCALL(\n ocall_dispatch_untrusted_call(&ret, untrusted_selector, sgx_params));\n if (sgx_params->input) {\n untrusted_cache->Free(const_cast(sgx_params->input));\n }\n if (sgx_params->output) {\n // For the results obtained in |output_buffer|, copy them to |output|\n // before freeing the buffer.\n output->Deserialize(sgx_params->output, sgx_params->output_size);\n TrustedPrimitives::UntrustedLocalFree(sgx_params->output);\n }\n return PrimitiveStatus::OkStatus();\n}","target":"PrimitiveStatus TrustedPrimitives::UntrustedCall(uint64_t untrusted_selector,\n MessageWriter *input,\n MessageReader *output) {\n int ret;\n\n UntrustedCacheMalloc *untrusted_cache = UntrustedCacheMalloc::Instance();\n\n SgxParams *const sgx_params =\n reinterpret_cast(untrusted_cache->Malloc(sizeof(SgxParams)));\n Cleanup clean_up(\n [sgx_params, untrusted_cache] { untrusted_cache->Free(sgx_params); });\n sgx_params->input_size = 0;\n sgx_params->input = nullptr;\n if (input) {\n sgx_params->input_size = input->MessageSize();\n if (sgx_params->input_size > 0) {\n // Allocate and copy data to |input_buffer|.\n sgx_params->input = untrusted_cache->Malloc(sgx_params->input_size);\n input->Serialize(const_cast(sgx_params->input));\n }\n }\n sgx_params->output_size = 0;\n sgx_params->output = nullptr;\n CHECK_OCALL(\n ocall_dispatch_untrusted_call(&ret, untrusted_selector, sgx_params));\n if (sgx_params->input) {\n untrusted_cache->Free(const_cast(sgx_params->input));\n }\n if (!TrustedPrimitives::IsOutsideEnclave(sgx_params->output,\n sgx_params->output_size)) {\n TrustedPrimitives::BestEffortAbort(\n \"UntrustedCall: sgx_param output should be in untrusted memory\");\n }\n if (sgx_params->output) {\n // For the results obtained in |output_buffer|, copy them to |output|\n // before freeing the buffer.\n output->Deserialize(sgx_params->output, sgx_params->output_size);\n TrustedPrimitives::UntrustedLocalFree(sgx_params->output);\n }\n return PrimitiveStatus::OkStatus();\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":410,"sven_meta":{"func_name":"asylo::primitives::TrustedPrimitives::UntrustedCall","file_name":"asylo/platform/primitives/sgx/trusted_sgx.cc","commit_link":"github.com/google/asylo/commit/83036fd841d33baa7e039f842d131aa7881fdcc2","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#29-45f421d471b1","input":"rdpBitmapCache* bitmap_cache_new(rdpSettings* settings)\n{\n\tint i;\n\trdpBitmapCache* bitmapCache;\n\tbitmapCache = (rdpBitmapCache*)calloc(1, sizeof(rdpBitmapCache));\n\n\tif (!bitmapCache)\n\t\treturn NULL;\n\n\tbitmapCache->settings = settings;\n\tbitmapCache->update = ((freerdp*)settings->instance)->update;\n\tbitmapCache->context = bitmapCache->update->context;\n\tbitmapCache->maxCells = settings->BitmapCacheV2NumCells;\n\tbitmapCache->cells = (BITMAP_V2_CELL*)calloc(bitmapCache->maxCells, sizeof(BITMAP_V2_CELL));\n\n\tif (!bitmapCache->cells)\n\t\tgoto fail;\n\n\tfor (i = 0; i < (int)bitmapCache->maxCells; i++)\n\t{\n\t\tbitmapCache->cells[i].number = settings->BitmapCacheV2CellInfo[i].numEntries;\n\t\t/* allocate an extra entry for BITMAP_CACHE_WAITING_LIST_INDEX */\n\t\tbitmapCache->cells[i].entries =\n\t\t (rdpBitmap**)calloc((bitmapCache->cells[i].number + 1), sizeof(rdpBitmap*));\n\n\t\tif (!bitmapCache->cells[i].entries)\n\t\t\tgoto fail;\n\t}\n\n\treturn bitmapCache;\nfail:\n\n\tif (bitmapCache->cells)\n\t{\n\t\tfor (i = 0; i < (int)bitmapCache->maxCells; i++)\n\t\t\tfree(bitmapCache->cells[i].entries);\n\t}\n\n\tfree(bitmapCache);\n\treturn NULL;\n}","target":"rdpBitmapCache* bitmap_cache_new(rdpSettings* settings)\n{\n\tint i;\n\trdpBitmapCache* bitmapCache;\n\tbitmapCache = (rdpBitmapCache*)calloc(1, sizeof(rdpBitmapCache));\n\n\tif (!bitmapCache)\n\t\treturn NULL;\n\n\tbitmapCache->settings = settings;\n\tbitmapCache->update = ((freerdp*)settings->instance)->update;\n\tbitmapCache->context = bitmapCache->update->context;\n\tbitmapCache->cells =\n\t (BITMAP_V2_CELL*)calloc(settings->BitmapCacheV2NumCells, sizeof(BITMAP_V2_CELL));\n\n\tif (!bitmapCache->cells)\n\t\tgoto fail;\n\tbitmapCache->maxCells = settings->BitmapCacheV2NumCells;\n\n\tfor (i = 0; i < (int)bitmapCache->maxCells; i++)\n\t{\n\t\tbitmapCache->cells[i].number = settings->BitmapCacheV2CellInfo[i].numEntries;\n\t\t/* allocate an extra entry for BITMAP_CACHE_WAITING_LIST_INDEX */\n\t\tbitmapCache->cells[i].entries =\n\t\t (rdpBitmap**)calloc((bitmapCache->cells[i].number + 1), sizeof(rdpBitmap*));\n\n\t\tif (!bitmapCache->cells[i].entries)\n\t\t\tgoto fail;\n\t}\n\n\treturn bitmapCache;\nfail:\n\n\tif (bitmapCache->cells)\n\t{\n\t\tfor (i = 0; i < (int)bitmapCache->maxCells; i++)\n\t\t\tfree(bitmapCache->cells[i].entries);\n\t}\n\n\tfree(bitmapCache);\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-125","target_token_count":321,"sven_meta":{"func_name":"bitmap_cache_new","file_name":"libfreerdp/cache/bitmap.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/58dc36b3c883fd460199cedb6d30e58eba58298c","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#30-d8cc4cd71435","input":"ImagingPcxDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t bytes)\n{\n UINT8 n;\n UINT8* ptr;\n\n if ((state->xsize * state->bits + 7) / 8 > state->bytes) {\n state->errcode = IMAGING_CODEC_OVERRUN;\n return -1;\n }\n\n ptr = buf;\n\n for (;;) {\n\n\tif (bytes < 1)\n\t return ptr - buf;\n\n\tif ((*ptr & 0xC0) == 0xC0) {\n\n\t /* Run */\n\t if (bytes < 2)\n\t\treturn ptr - buf;\n\n\t n = ptr[0] & 0x3F;\n\n\t while (n > 0) {\n\t\tif (state->x >= state->bytes) {\n\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t break;\n\t\t}\n\t\tstate->buffer[state->x++] = ptr[1];\n\t\tn--;\n\t }\n\n\t ptr += 2; bytes -= 2;\n\n\t} else {\n\n\t /* Literal */\n\t state->buffer[state->x++] = ptr[0];\n\t ptr++; bytes--;\n\n\t}\n\n\tif (state->x >= state->bytes) {\n if (state->bytes % state->xsize && state->bytes > state->xsize) {\n int bands = state->bytes / state->xsize;\n int stride = state->bytes / bands;\n int i;\n for (i=1; i< bands; i++) { // note -- skipping first band\n memmove(&state->buffer[i*state->xsize],\n &state->buffer[i*stride],\n state->xsize);\n }\n }\n\t /* Got a full line, unpack it */\n\t state->shuffle((UINT8*) im->image[state->y + state->yoff] +\n\t\t\t state->xoff * im->pixelsize, state->buffer,\n\t\t\t state->xsize);\n\n\t state->x = 0;\n\n\t if (++state->y >= state->ysize) {\n\t\t/* End of file (errcode = 0) */\n\t\treturn -1;\n\t }\n\t}\n\n }\n}","target":"ImagingPcxDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t bytes)\n{\n UINT8 n;\n UINT8* ptr;\n\n if ((state->xsize * state->bits + 7) / 8 > state->bytes) {\n state->errcode = IMAGING_CODEC_OVERRUN;\n return -1;\n }\n\n ptr = buf;\n\n for (;;) {\n\n\tif (bytes < 1)\n\t return ptr - buf;\n\n\tif ((*ptr & 0xC0) == 0xC0) {\n\n\t /* Run */\n\t if (bytes < 2)\n\t\treturn ptr - buf;\n\n\t n = ptr[0] & 0x3F;\n\n\t while (n > 0) {\n\t\tif (state->x >= state->bytes) {\n\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t break;\n\t\t}\n\t\tstate->buffer[state->x++] = ptr[1];\n\t\tn--;\n\t }\n\n\t ptr += 2; bytes -= 2;\n\n\t} else {\n\n\t /* Literal */\n\t state->buffer[state->x++] = ptr[0];\n\t ptr++; bytes--;\n\n\t}\n\n\tif (state->x >= state->bytes) {\n if (state->bytes % state->xsize && state->bytes > state->xsize) {\n int bands = state->bytes / state->xsize;\n int stride = state->bytes / bands;\n int i;\n for (i=1; i< bands; i++) { // note -- skipping first band\n memmove(&state->buffer[i*state->xsize],\n &state->buffer[i*stride],\n state->xsize);\n }\n }\n\t /* Got a full line, unpack it */\n\t state->shuffle((UINT8*) im->image[state->y + state->yoff] +\n\t\t\t state->xoff * im->pixelsize, state->buffer,\n\t\t\t state->xsize);\n\n\t state->x = 0;\n\n\t if (++state->y >= state->ysize) {\n\t\t/* End of file (errcode = 0) */\n\t\treturn -1;\n\t }\n\t}\n\n }\n}","lang":"c","vul_type":"cwe-125","target_token_count":462,"sven_meta":{"func_name":"ImagingPcxDecode","file_name":"src/libImaging/PcxDecode.c","commit_link":"github.com/python-pillow/Pillow/commit/6a83e4324738bb0452fbe8074a995b1c73f08de7#diff-9478f2787e3ae9668a15123b165c23ac","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#45-1caa0ec74d5c","input":"static const struct usb_cdc_union_desc *\nims_pcu_get_cdc_union_desc(struct usb_interface *intf)\n{\n\tconst void *buf = intf->altsetting->extra;\n\tsize_t buflen = intf->altsetting->extralen;\n\tstruct usb_cdc_union_desc *union_desc;\n\n\tif (!buf) {\n\t\tdev_err(&intf->dev, \"Missing descriptor data\\n\");\n\t\treturn NULL;\n\t}\n\n\tif (!buflen) {\n\t\tdev_err(&intf->dev, \"Zero length descriptor\\n\");\n\t\treturn NULL;\n\t}\n\n\twhile (buflen > 0) {\n\t\tunion_desc = (struct usb_cdc_union_desc *)buf;\n\n\t\tif (union_desc->bDescriptorType == USB_DT_CS_INTERFACE &&\n\t\t union_desc->bDescriptorSubType == USB_CDC_UNION_TYPE) {\n\t\t\tdev_dbg(&intf->dev, \"Found union header\\n\");\n\t\t\treturn union_desc;\n\t\t}\n\n\t\tbuflen -= union_desc->bLength;\n\t\tbuf += union_desc->bLength;\n\t}\n\n\tdev_err(&intf->dev, \"Missing CDC union descriptor\\n\");\n\treturn NULL;","target":"static const struct usb_cdc_union_desc *\nims_pcu_get_cdc_union_desc(struct usb_interface *intf)\n{\n\tconst void *buf = intf->altsetting->extra;\n\tsize_t buflen = intf->altsetting->extralen;\n\tstruct usb_cdc_union_desc *union_desc;\n\n\tif (!buf) {\n\t\tdev_err(&intf->dev, \"Missing descriptor data\\n\");\n\t\treturn NULL;\n\t}\n\n\tif (!buflen) {\n\t\tdev_err(&intf->dev, \"Zero length descriptor\\n\");\n\t\treturn NULL;\n\t}\n\n\twhile (buflen >= sizeof(*union_desc)) {\n\t\tunion_desc = (struct usb_cdc_union_desc *)buf;\n\n\t\tif (union_desc->bLength > buflen) {\n\t\t\tdev_err(&intf->dev, \"Too large descriptor\\n\");\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (union_desc->bDescriptorType == USB_DT_CS_INTERFACE &&\n\t\t union_desc->bDescriptorSubType == USB_CDC_UNION_TYPE) {\n\t\t\tdev_dbg(&intf->dev, \"Found union header\\n\");\n\n\t\t\tif (union_desc->bLength >= sizeof(*union_desc))\n\t\t\t\treturn union_desc;\n\n\t\t\tdev_err(&intf->dev,\n\t\t\t\t\"Union descriptor to short (%d vs %zd\\n)\",\n\t\t\t\tunion_desc->bLength, sizeof(*union_desc));\n\t\t\treturn NULL;\n\t\t}\n\n\t\tbuflen -= union_desc->bLength;\n\t\tbuf += union_desc->bLength;\n\t}\n\n\tdev_err(&intf->dev, \"Missing CDC union descriptor\\n\");\n\treturn NULL;","lang":"c","vul_type":"cwe-125","target_token_count":319,"sven_meta":{"func_name":"ims_pcu_get_cdc_union_desc","file_name":"drivers/input/misc/ims-pcu.c","commit_link":"github.com/torvalds/linux/commit/ea04efee7635c9120d015dcdeeeb6988130cb67a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#48-c874577075bf","input":"int enc_untrusted_inet_pton(int af, const char *src, void *dst) {\n if (!src || !dst) {\n return 0;\n }\n\n MessageWriter input;\n input.Push(TokLinuxAfFamily(af));\n input.PushByReference(Extent{\n src, std::min(strlen(src) + 1, static_cast(INET6_ADDRSTRLEN))});\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kInetPtonHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_pton\", 3);\n\n int result = output.next();\n int klinux_errno = output.next();\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return -1;\n }\n\n auto klinux_addr_buffer = output.next();\n size_t max_size = 0;\n if (af == AF_INET) {\n max_size = sizeof(struct in_addr);\n } else if (af == AF_INET6) {\n max_size = sizeof(struct in6_addr);\n }\n memcpy(dst, klinux_addr_buffer.data(),\n std::min(klinux_addr_buffer.size(), max_size));\n return result;\n}","target":"int enc_untrusted_inet_pton(int af, const char *src, void *dst) {\n if (!src || !dst) {\n return 0;\n }\n\n MessageWriter input;\n input.Push(TokLinuxAfFamily(af));\n input.PushByReference(Extent{\n src, std::min(strlen(src) + 1, static_cast(INET6_ADDRSTRLEN))});\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kInetPtonHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_pton\", 3);\n\n int result = output.next();\n int klinux_errno = output.next();\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return -1;\n }\n\n auto klinux_addr_buffer = output.next();\n size_t max_size = 0;\n if (af == AF_INET) {\n if (klinux_addr_buffer.size() != sizeof(klinux_in_addr)) {\n ::asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_inet_pton: unexpected output size\");\n }\n max_size = sizeof(struct in_addr);\n } else if (af == AF_INET6) {\n if (klinux_addr_buffer.size() != sizeof(klinux_in6_addr)) {\n ::asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_inet_pton: unexpected output size\");\n }\n max_size = sizeof(struct in6_addr);\n }\n memcpy(dst, klinux_addr_buffer.data(),\n std::min(klinux_addr_buffer.size(), max_size));\n return result;\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":383,"sven_meta":{"func_name":"enc_untrusted_inet_pton","file_name":"asylo/platform/host_call/trusted/host_calls.cc","commit_link":"github.com/google/asylo/commit/8fed5e334131abaf9c5e17307642fbf6ce4a57ec","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#54-fe942f41e450","input":"static void voutf(struct GlobalConfig *config,\n const char *prefix,\n const char *fmt,\n va_list ap)\n{\n size_t width = (79 - strlen(prefix));\n if(!config->mute) {\n size_t len;\n char *ptr;\n char *print_buffer;\n\n print_buffer = curlx_mvaprintf(fmt, ap);\n if(!print_buffer)\n return;\n len = strlen(print_buffer);\n\n ptr = print_buffer;\n while(len > 0) {\n fputs(prefix, config->errors);\n\n if(len > width) {\n size_t cut = width-1;\n\n while(!ISSPACE(ptr[cut]) && cut) {\n cut--;\n }\n if(0 == cut)\n /* not a single cutting position was found, just cut it at the\n max text width then! */\n cut = width-1;\n\n (void)fwrite(ptr, cut + 1, 1, config->errors);\n fputs(\"\\n\", config->errors);\n ptr += cut + 1; /* skip the space too */\n len -= cut;\n }\n else {\n fputs(ptr, config->errors);\n len = 0;\n }\n }\n curl_free(print_buffer);\n }\n}","target":"static void voutf(struct GlobalConfig *config,\n const char *prefix,\n const char *fmt,\n va_list ap)\n{\n size_t width = (79 - strlen(prefix));\n if(!config->mute) {\n size_t len;\n char *ptr;\n char *print_buffer;\n\n print_buffer = curlx_mvaprintf(fmt, ap);\n if(!print_buffer)\n return;\n len = strlen(print_buffer);\n\n ptr = print_buffer;\n while(len > 0) {\n fputs(prefix, config->errors);\n\n if(len > width) {\n size_t cut = width-1;\n\n while(!ISSPACE(ptr[cut]) && cut) {\n cut--;\n }\n if(0 == cut)\n /* not a single cutting position was found, just cut it at the\n max text width then! */\n cut = width-1;\n\n (void)fwrite(ptr, cut + 1, 1, config->errors);\n fputs(\"\\n\", config->errors);\n ptr += cut + 1; /* skip the space too */\n len -= cut + 1;\n }\n else {\n fputs(ptr, config->errors);\n len = 0;\n }\n }\n curl_free(print_buffer);\n }\n}","lang":"c","vul_type":"cwe-125","target_token_count":270,"sven_meta":{"func_name":"voutf","file_name":"src/tool_msgs.c","commit_link":"github.com/curl/curl/commit/d530e92f59ae9bb2d47066c3c460b25d2ffeb211","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#56-39bb903aabe7","input":"static void read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)\n{\n int i, j, v;\n\n if (get_bits1(gb)) {\n /* intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n v = get_bits(gb, 8);\n j = s->idsp.idct_permutation[ff_zigzag_direct[i]];\n s->intra_matrix[j] = v;\n s->chroma_intra_matrix[j] = v;\n }\n }\n\n if (get_bits1(gb)) {\n /* non_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n get_bits(gb, 8);\n }\n }\n\n if (get_bits1(gb)) {\n /* chroma_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n v = get_bits(gb, 8);\n j = s->idsp.idct_permutation[ff_zigzag_direct[i]];\n s->chroma_intra_matrix[j] = v;\n }\n }\n\n if (get_bits1(gb)) {\n /* chroma_non_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n get_bits(gb, 8);\n }\n }\n\n next_start_code_studio(gb);\n}","target":"static int read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)\n{\n int i, j, v;\n\n if (get_bits1(gb)) {\n if (get_bits_left(gb) < 64*8)\n return AVERROR_INVALIDDATA;\n /* intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n v = get_bits(gb, 8);\n j = s->idsp.idct_permutation[ff_zigzag_direct[i]];\n s->intra_matrix[j] = v;\n s->chroma_intra_matrix[j] = v;\n }\n }\n\n if (get_bits1(gb)) {\n if (get_bits_left(gb) < 64*8)\n return AVERROR_INVALIDDATA;\n /* non_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n get_bits(gb, 8);\n }\n }\n\n if (get_bits1(gb)) {\n if (get_bits_left(gb) < 64*8)\n return AVERROR_INVALIDDATA;\n /* chroma_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n v = get_bits(gb, 8);\n j = s->idsp.idct_permutation[ff_zigzag_direct[i]];\n s->chroma_intra_matrix[j] = v;\n }\n }\n\n if (get_bits1(gb)) {\n if (get_bits_left(gb) < 64*8)\n return AVERROR_INVALIDDATA;\n /* chroma_non_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n get_bits(gb, 8);\n }\n }\n\n next_start_code_studio(gb);\n return 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":412,"sven_meta":{"func_name":"read_quant_matrix_ext","file_name":"libavcodec/mpeg4videodec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/5aba5b89d0b1d73164d3b81764828bb8b20ff32a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#57-cd960df54aa0","input":"QByteArray Cipher::blowfishECB(QByteArray cipherText, bool direction)\n{\n QCA::Initializer init;\n QByteArray temp = cipherText;\n\n //do padding ourselves\n if (direction)\n {\n while ((temp.length() % 8) != 0) temp.append('\\0');\n }\n else\n {\n temp = b64ToByte(temp);\n while ((temp.length() % 8) != 0) temp.append('\\0');\n }\n\n QCA::Direction dir = (direction) ? QCA::Encode : QCA::Decode;\n QCA::Cipher cipher(m_type, QCA::Cipher::ECB, QCA::Cipher::NoPadding, dir, m_key);\n QByteArray temp2 = cipher.update(QCA::MemoryRegion(temp)).toByteArray();\n temp2 += cipher.final().toByteArray();\n\n if (!cipher.ok())\n return cipherText;\n\n if (direction)\n temp2 = byteToB64(temp2);\n\n return temp2;\n}","target":"QByteArray Cipher::blowfishECB(QByteArray cipherText, bool direction)\n{\n QCA::Initializer init;\n QByteArray temp = cipherText;\n\n //do padding ourselves\n if (direction)\n {\n while ((temp.length() % 8) != 0) temp.append('\\0');\n }\n else\n {\n // ECB Blowfish encodes in blocks of 12 chars, so anything else is malformed input\n if ((temp.length() % 12) != 0)\n return cipherText;\n\n temp = b64ToByte(temp);\n while ((temp.length() % 8) != 0) temp.append('\\0');\n }\n\n QCA::Direction dir = (direction) ? QCA::Encode : QCA::Decode;\n QCA::Cipher cipher(m_type, QCA::Cipher::ECB, QCA::Cipher::NoPadding, dir, m_key);\n QByteArray temp2 = cipher.update(QCA::MemoryRegion(temp)).toByteArray();\n temp2 += cipher.final().toByteArray();\n\n if (!cipher.ok())\n return cipherText;\n\n if (direction) {\n // Sanity check\n if ((temp2.length() % 8) != 0)\n return cipherText;\n\n temp2 = byteToB64(temp2);\n }\n\n return temp2;\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":284,"sven_meta":{"func_name":"Cipher::blowfishECB","file_name":"src/core/cipher.cpp","commit_link":"github.com/quassel/quassel/commit/8b5ecd226f9208af3074b33d3b7cf5e14f55b138","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#58-591b27adce5e","input":"static int java_switch_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tut8 op_byte = data[0];\n\tut64 offset = addr - java_get_method_start ();\n\tut8 pos = (offset+1)%4 ? 1 + 4 - (offset+1)%4 : 1;\n\n\tif (op_byte == 0xaa) {\n\t\t// handle a table switch condition\n\t\tif (pos + 8 > len) {\n\t\t\treturn op->size;\n\t\t}\n\t\tint min_val = (ut32)(UINT (data, pos + 4)),\n\t\t\tmax_val = (ut32)(UINT (data, pos + 8));\n\n\t\tut32 default_loc = (ut32) (UINT (data, pos)), cur_case = 0;\n\t\top->switch_op = r_anal_switch_op_new (addr, min_val, default_loc);\n\t\tRAnalCaseOp *caseop = NULL;\n\t\tpos += 12;\n\t\tif (max_val > min_val && ((max_val - min_val)<(UT16_MAX/4))) {\n\t\t\t//caseop = r_anal_switch_op_add_case(op->switch_op, addr+default_loc, -1, addr+offset);\n\t\t\tfor (cur_case = 0; cur_case <= max_val - min_val; pos += 4, cur_case++) {\n\t\t\t\t//ut32 value = (ut32)(UINT (data, pos));\n\t\t\t\tif (pos + 4 >= len) {\n\t\t\t\t\t// switch is too big cant read further\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tint offset = (int)(ut32)(R_BIN_JAVA_UINT (data, pos));\n\t\t\t\tcaseop = r_anal_switch_op_add_case (op->switch_op,\n\t\t\t\t\taddr + pos, cur_case + min_val, addr + offset);\n\t\t\t\tif (caseop) {\n\t\t\t\t\tcaseop->bb_ref_to = addr+offset;\n\t\t\t\t\tcaseop->bb_ref_from = addr; // TODO figure this one out\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\teprintf (\"Invalid switch boundaries at 0x%\"PFMT64x\"\\n\", addr);\n\t\t}\n\t}\n\top->size = pos;\n\treturn op->size;\n}","target":"static int java_switch_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tut8 op_byte = data[0];\n\tut64 offset = addr - java_get_method_start ();\n\tut8 pos = (offset+1)%4 ? 1 + 4 - (offset+1)%4 : 1;\n\n\tif (op_byte == 0xaa) {\n\t\t// handle a table switch condition\n\t\tif (pos + 8 + 8 > len) {\n\t\t\treturn op->size;\n\t\t}\n\t\tconst int min_val = (ut32)(UINT (data, pos + 4));\n\t\tconst int max_val = (ut32)(UINT (data, pos + 8));\n\n\t\tut32 default_loc = (ut32) (UINT (data, pos)), cur_case = 0;\n\t\top->switch_op = r_anal_switch_op_new (addr, min_val, default_loc);\n\t\tRAnalCaseOp *caseop = NULL;\n\t\tpos += 12;\n\t\tif (max_val > min_val && ((max_val - min_val)<(UT16_MAX/4))) {\n\t\t\t//caseop = r_anal_switch_op_add_case(op->switch_op, addr+default_loc, -1, addr+offset);\n\t\t\tfor (cur_case = 0; cur_case <= max_val - min_val; pos += 4, cur_case++) {\n\t\t\t\t//ut32 value = (ut32)(UINT (data, pos));\n\t\t\t\tif (pos + 4 >= len) {\n\t\t\t\t\t// switch is too big cant read further\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tint offset = (int)(ut32)(R_BIN_JAVA_UINT (data, pos));\n\t\t\t\tcaseop = r_anal_switch_op_add_case (op->switch_op,\n\t\t\t\t\taddr + pos, cur_case + min_val, addr + offset);\n\t\t\t\tif (caseop) {\n\t\t\t\t\tcaseop->bb_ref_to = addr+offset;\n\t\t\t\t\tcaseop->bb_ref_from = addr; // TODO figure this one out\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\teprintf (\"Invalid switch boundaries at 0x%\"PFMT64x\"\\n\", addr);\n\t\t}\n\t}\n\top->size = pos;\n\treturn op->size;\n}","lang":"c","vul_type":"cwe-125","target_token_count":495,"sven_meta":{"func_name":"java_switch_op","file_name":"libr/anal/p/anal_java.c","commit_link":"github.com/radare/radare2/commit/224e6bc13fa353dd3b7f7a2334588f1c4229e58d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#60-42414a109884","input":"const char *enc_untrusted_inet_ntop(int af, const void *src, char *dst,\n socklen_t size) {\n if (!src || !dst) {\n errno = EFAULT;\n return nullptr;\n }\n size_t src_size = 0;\n if (af == AF_INET) {\n src_size = sizeof(struct in_addr);\n } else if (af == AF_INET6) {\n src_size = sizeof(struct in6_addr);\n } else {\n errno = EAFNOSUPPORT;\n return nullptr;\n }\n\n MessageWriter input;\n input.Push(TokLinuxAfFamily(af));\n input.PushByReference(Extent{reinterpret_cast(src), src_size});\n input.Push(size);\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kInetNtopHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_ntop\", 2);\n\n auto result = output.next();\n int klinux_errno = output.next();\n if (result.empty()) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return nullptr;\n }\n\n memcpy(dst, result.data(),\n std::min(static_cast(size),\n static_cast(INET6_ADDRSTRLEN)));\n return dst;\n}","target":"const char *enc_untrusted_inet_ntop(int af, const void *src, char *dst,\n socklen_t size) {\n if (!src || !dst) {\n errno = EFAULT;\n return nullptr;\n }\n size_t src_size = 0;\n if (af == AF_INET) {\n src_size = sizeof(struct in_addr);\n } else if (af == AF_INET6) {\n src_size = sizeof(struct in6_addr);\n } else {\n errno = EAFNOSUPPORT;\n return nullptr;\n }\n\n MessageWriter input;\n input.Push(TokLinuxAfFamily(af));\n input.PushByReference(Extent{reinterpret_cast(src), src_size});\n input.Push(size);\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kInetNtopHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_ntop\", 2);\n\n auto result = output.next();\n int klinux_errno = output.next();\n if (result.empty()) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return nullptr;\n }\n\n memcpy(\n dst, result.data(),\n std::min({static_cast(size), static_cast(result.size()),\n static_cast(INET6_ADDRSTRLEN)}));\n return dst;\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":305,"sven_meta":{"func_name":"enc_untrusted_inet_ntop","file_name":"asylo/platform/host_call/trusted/host_calls.cc","commit_link":"github.com/google/asylo/commit/6ff3b77ffe110a33a2f93848a6333f33616f02c4","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#61-a01cb3f981b3","input":"void ndpi_search_oracle(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)\n{\n struct ndpi_packet_struct *packet = &flow->packet;\n u_int16_t dport = 0, sport = 0;\n\n NDPI_LOG_DBG(ndpi_struct, \"search ORACLE\\n\");\n\n if(packet->tcp != NULL) {\n sport = ntohs(packet->tcp->source), dport = ntohs(packet->tcp->dest);\n NDPI_LOG_DBG2(ndpi_struct, \"calculating ORACLE over tcp\\n\");\n /* Oracle Database 9g,10g,11g */\n if ((dport == 1521 || sport == 1521)\n\t&& (((packet->payload[0] == 0x07) && (packet->payload[1] == 0xff) && (packet->payload[2] == 0x00))\n\t || ((packet->payload_packet_len >= 232) && ((packet->payload[0] == 0x00) || (packet->payload[0] == 0x01)) \n\t && (packet->payload[1] != 0x00)\n\t && (packet->payload[2] == 0x00)\n\t\t && (packet->payload[3] == 0x00)))) {\n NDPI_LOG_INFO(ndpi_struct, \"found oracle\\n\");\n ndpi_int_oracle_add_connection(ndpi_struct, flow);\n } else if (packet->payload_packet_len == 213 && packet->payload[0] == 0x00 &&\n packet->payload[1] == 0xd5 && packet->payload[2] == 0x00 &&\n packet->payload[3] == 0x00 ) {\n NDPI_LOG_INFO(ndpi_struct, \"found oracle\\n\");\n ndpi_int_oracle_add_connection(ndpi_struct, flow);\n }\n } else {\n NDPI_EXCLUDE_PROTO(ndpi_struct, flow);\n }\n}","target":"void ndpi_search_oracle(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)\n{\n struct ndpi_packet_struct *packet = &flow->packet;\n u_int16_t dport = 0, sport = 0;\n\n NDPI_LOG_DBG(ndpi_struct, \"search ORACLE\\n\");\n\n if(packet->tcp != NULL) {\n sport = ntohs(packet->tcp->source), dport = ntohs(packet->tcp->dest);\n NDPI_LOG_DBG2(ndpi_struct, \"calculating ORACLE over tcp\\n\");\n /* Oracle Database 9g,10g,11g */\n if ((dport == 1521 || sport == 1521)\n\t&& (((packet->payload_packet_len >= 3 && packet->payload[0] == 0x07) && (packet->payload[1] == 0xff) && (packet->payload[2] == 0x00))\n\t || ((packet->payload_packet_len >= 232) && ((packet->payload[0] == 0x00) || (packet->payload[0] == 0x01)) \n\t && (packet->payload[1] != 0x00)\n\t && (packet->payload[2] == 0x00)\n\t\t && (packet->payload[3] == 0x00)))) {\n NDPI_LOG_INFO(ndpi_struct, \"found oracle\\n\");\n ndpi_int_oracle_add_connection(ndpi_struct, flow);\n } else if (packet->payload_packet_len == 213 && packet->payload[0] == 0x00 &&\n packet->payload[1] == 0xd5 && packet->payload[2] == 0x00 &&\n packet->payload[3] == 0x00 ) {\n NDPI_LOG_INFO(ndpi_struct, \"found oracle\\n\");\n ndpi_int_oracle_add_connection(ndpi_struct, flow);\n }\n } else {\n NDPI_EXCLUDE_PROTO(ndpi_struct, flow);\n }\n}","lang":"c","vul_type":"cwe-125","target_token_count":451,"sven_meta":{"func_name":"ndpi_search_oracle","file_name":"src/lib/protocols/oracle.c","commit_link":"github.com/ntop/nDPI/commit/b69177be2fbe01c2442239a61832c44e40136c05","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#80-4a53ea1bee34","input":"static BOOL update_read_bitmap_data(rdpUpdate* update, wStream* s, BITMAP_DATA* bitmapData)\n{\n\tWINPR_UNUSED(update);\n\tif (Stream_GetRemainingLength(s) < 18)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, bitmapData->destLeft);\n\tStream_Read_UINT16(s, bitmapData->destTop);\n\tStream_Read_UINT16(s, bitmapData->destRight);\n\tStream_Read_UINT16(s, bitmapData->destBottom);\n\tStream_Read_UINT16(s, bitmapData->width);\n\tStream_Read_UINT16(s, bitmapData->height);\n\tStream_Read_UINT16(s, bitmapData->bitsPerPixel);\n\tStream_Read_UINT16(s, bitmapData->flags);\n\tStream_Read_UINT16(s, bitmapData->bitmapLength);\n\n\tif (bitmapData->flags & BITMAP_COMPRESSION)\n\t{\n\t\tif (!(bitmapData->flags & NO_BITMAP_COMPRESSION_HDR))\n\t\t{\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */\n\t\t\tStream_Read_UINT16(s, bitmapData->cbScanWidth); /* cbScanWidth (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */\n\t\t\tbitmapData->bitmapLength = bitmapData->cbCompMainBodySize;\n\t\t}\n\n\t\tbitmapData->compressed = TRUE;\n\t}\n\telse\n\t\tbitmapData->compressed = FALSE;\n\n\tif (Stream_GetRemainingLength(s) < bitmapData->bitmapLength)\n\t\treturn FALSE;\n\n\tif (bitmapData->bitmapLength > 0)\n\t{\n\t\tbitmapData->bitmapDataStream = malloc(bitmapData->bitmapLength);\n\n\t\tif (!bitmapData->bitmapDataStream)\n\t\t\treturn FALSE;\n\n\t\tmemcpy(bitmapData->bitmapDataStream, Stream_Pointer(s), bitmapData->bitmapLength);\n\t\tStream_Seek(s, bitmapData->bitmapLength);\n\t}\n\n\treturn TRUE;\n}","target":"static BOOL update_read_bitmap_data(rdpUpdate* update, wStream* s, BITMAP_DATA* bitmapData)\n{\n\tWINPR_UNUSED(update);\n\tif (Stream_GetRemainingLength(s) < 18)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, bitmapData->destLeft);\n\tStream_Read_UINT16(s, bitmapData->destTop);\n\tStream_Read_UINT16(s, bitmapData->destRight);\n\tStream_Read_UINT16(s, bitmapData->destBottom);\n\tStream_Read_UINT16(s, bitmapData->width);\n\tStream_Read_UINT16(s, bitmapData->height);\n\tStream_Read_UINT16(s, bitmapData->bitsPerPixel);\n\tStream_Read_UINT16(s, bitmapData->flags);\n\tStream_Read_UINT16(s, bitmapData->bitmapLength);\n\n\tif (bitmapData->flags & BITMAP_COMPRESSION)\n\t{\n\t\tif (!(bitmapData->flags & NO_BITMAP_COMPRESSION_HDR))\n\t\t{\n\t\t\tif (Stream_GetRemainingLength(s) < 8)\n\t\t\t\treturn FALSE;\n\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */\n\t\t\tStream_Read_UINT16(s, bitmapData->cbScanWidth); /* cbScanWidth (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */\n\t\t\tbitmapData->bitmapLength = bitmapData->cbCompMainBodySize;\n\t\t}\n\n\t\tbitmapData->compressed = TRUE;\n\t}\n\telse\n\t\tbitmapData->compressed = FALSE;\n\n\tif (Stream_GetRemainingLength(s) < bitmapData->bitmapLength)\n\t\treturn FALSE;\n\n\tif (bitmapData->bitmapLength > 0)\n\t{\n\t\tbitmapData->bitmapDataStream = malloc(bitmapData->bitmapLength);\n\n\t\tif (!bitmapData->bitmapDataStream)\n\t\t\treturn FALSE;\n\n\t\tmemcpy(bitmapData->bitmapDataStream, Stream_Pointer(s), bitmapData->bitmapLength);\n\t\tStream_Seek(s, bitmapData->bitmapLength);\n\t}\n\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-125","target_token_count":476,"sven_meta":{"func_name":"update_read_bitmap_data","file_name":"libfreerdp/core/update.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/f8890a645c221823ac133dbf991f8a65ae50d637","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#81-29bb54d2ec12","input":"static BOOL autodetect_recv_bandwidth_measure_results(rdpRdp* rdp, wStream* s,\n AUTODETECT_RSP_PDU* autodetectRspPdu)\n{\n\tBOOL success = TRUE;\n\n\tif (autodetectRspPdu->headerLength != 0x0E)\n\t\treturn FALSE;\n\n\tWLog_VRB(AUTODETECT_TAG, \"received Bandwidth Measure Results PDU\");\n\tStream_Read_UINT32(s, rdp->autodetect->bandwidthMeasureTimeDelta); /* timeDelta (4 bytes) */\n\tStream_Read_UINT32(s, rdp->autodetect->bandwidthMeasureByteCount); /* byteCount (4 bytes) */\n\n\tif (rdp->autodetect->bandwidthMeasureTimeDelta > 0)\n\t\trdp->autodetect->netCharBandwidth = rdp->autodetect->bandwidthMeasureByteCount * 8 /\n\t\t rdp->autodetect->bandwidthMeasureTimeDelta;\n\telse\n\t\trdp->autodetect->netCharBandwidth = 0;\n\n\tIFCALLRET(rdp->autodetect->BandwidthMeasureResults, success, rdp->context,\n\t autodetectRspPdu->sequenceNumber);\n\treturn success;\n}","target":"static BOOL autodetect_recv_bandwidth_measure_results(rdpRdp* rdp, wStream* s,\n AUTODETECT_RSP_PDU* autodetectRspPdu)\n{\n\tBOOL success = TRUE;\n\n\tif (autodetectRspPdu->headerLength != 0x0E)\n\t\treturn FALSE;\n\n\tWLog_VRB(AUTODETECT_TAG, \"received Bandwidth Measure Results PDU\");\n\tif (Stream_GetRemainingLength(s) < 8)\n\t\treturn -1;\n\tStream_Read_UINT32(s, rdp->autodetect->bandwidthMeasureTimeDelta); /* timeDelta (4 bytes) */\n\tStream_Read_UINT32(s, rdp->autodetect->bandwidthMeasureByteCount); /* byteCount (4 bytes) */\n\n\tif (rdp->autodetect->bandwidthMeasureTimeDelta > 0)\n\t\trdp->autodetect->netCharBandwidth = rdp->autodetect->bandwidthMeasureByteCount * 8 /\n\t\t rdp->autodetect->bandwidthMeasureTimeDelta;\n\telse\n\t\trdp->autodetect->netCharBandwidth = 0;\n\n\tIFCALLRET(rdp->autodetect->BandwidthMeasureResults, success, rdp->context,\n\t autodetectRspPdu->sequenceNumber);\n\treturn success;\n}","lang":"c","vul_type":"cwe-125","target_token_count":281,"sven_meta":{"func_name":"autodetect_recv_bandwidth_measure_results","file_name":"libfreerdp/core/autodetect.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/f5e73cc7c9cd973b516a618da877c87b80950b65","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#82-74f4e8de4f9e","input":"static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl,\n unsigned char **p,\n unsigned char *end )\n{\n int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;\n size_t len;\n ((void) ssl);\n\n /*\n * PSK parameters:\n *\n * opaque psk_identity_hint<0..2^16-1>;\n */\n if( (*p) > end - 2 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message \"\n \"(psk_identity_hint length)\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n len = (*p)[0] << 8 | (*p)[1];\n *p += 2;\n\n if( (*p) + len > end )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message \"\n \"(psk_identity_hint length)\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n /*\n * Note: we currently ignore the PKS identity hint, as we only allow one\n * PSK to be provisionned on the client. This could be changed later if\n * someone needs that feature.\n */\n *p += len;\n ret = 0;\n\n return( ret );\n}","target":"static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl,\n unsigned char **p,\n unsigned char *end )\n{\n int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;\n size_t len;\n ((void) ssl);\n\n /*\n * PSK parameters:\n *\n * opaque psk_identity_hint<0..2^16-1>;\n */\n if( (*p) > end - 2 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message \"\n \"(psk_identity_hint length)\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n len = (*p)[0] << 8 | (*p)[1];\n *p += 2;\n\n if( (*p) > end - len )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message \"\n \"(psk_identity_hint length)\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n /*\n * Note: we currently ignore the PKS identity hint, as we only allow one\n * PSK to be provisionned on the client. This could be changed later if\n * someone needs that feature.\n */\n *p += len;\n ret = 0;\n\n return( ret );\n}","lang":"c","vul_type":"cwe-125","target_token_count":292,"sven_meta":{"func_name":"ssl_parse_server_psk_hint","file_name":"library/ssl_cli.c","commit_link":"github.com/ARMmbed/mbedtls/commit/5224a7544c95552553e2e6be0b4a789956a6464e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#83-262f6cccc156","input":"static void youngcollection (lua_State *L, global_State *g) {\n GCObject **psurvival; /* to point to first non-dead survival object */\n lua_assert(g->gcstate == GCSpropagate);\n markold(g, g->survival, g->reallyold);\n markold(g, g->finobj, g->finobjrold);\n atomic(L);\n\n /* sweep nursery and get a pointer to its last live element */\n psurvival = sweepgen(L, g, &g->allgc, g->survival);\n /* sweep 'survival' and 'old' */\n sweepgen(L, g, psurvival, g->reallyold);\n g->reallyold = g->old;\n g->old = *psurvival; /* 'survival' survivals are old now */\n g->survival = g->allgc; /* all news are survivals */\n\n /* repeat for 'finobj' lists */\n psurvival = sweepgen(L, g, &g->finobj, g->finobjsur);\n /* sweep 'survival' and 'old' */\n sweepgen(L, g, psurvival, g->finobjrold);\n g->finobjrold = g->finobjold;\n g->finobjold = *psurvival; /* 'survival' survivals are old now */\n g->finobjsur = g->finobj; /* all news are survivals */\n\n sweepgen(L, g, &g->tobefnz, NULL);\n\n finishgencycle(L, g);\n}","target":"static void youngcollection (lua_State *L, global_State *g) {\n GCObject **psurvival; /* to point to first non-dead survival object */\n lua_assert(g->gcstate == GCSpropagate);\n markold(g, g->allgc, g->reallyold);\n markold(g, g->finobj, g->finobjrold);\n atomic(L);\n\n /* sweep nursery and get a pointer to its last live element */\n psurvival = sweepgen(L, g, &g->allgc, g->survival);\n /* sweep 'survival' and 'old' */\n sweepgen(L, g, psurvival, g->reallyold);\n g->reallyold = g->old;\n g->old = *psurvival; /* 'survival' survivals are old now */\n g->survival = g->allgc; /* all news are survivals */\n\n /* repeat for 'finobj' lists */\n psurvival = sweepgen(L, g, &g->finobj, g->finobjsur);\n /* sweep 'survival' and 'old' */\n sweepgen(L, g, psurvival, g->finobjrold);\n g->finobjrold = g->finobjold;\n g->finobjold = *psurvival; /* 'survival' survivals are old now */\n g->finobjsur = g->finobj; /* all news are survivals */\n\n sweepgen(L, g, &g->tobefnz, NULL);\n\n finishgencycle(L, g);\n}","lang":"c","vul_type":"cwe-125","target_token_count":353,"sven_meta":{"func_name":"youngcollection","file_name":"lgc.c","commit_link":"github.com/lua/lua/commit/127e7a6c8942b362aa3c6627f44d660a4fb75312","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#89-1c8704e60590","input":"static void hid_input_field(struct hid_device *hid, struct hid_field *field,\n\t\t\t __u8 *data, int interrupt)\n{\n\tunsigned n;\n\tunsigned count = field->report_count;\n\tunsigned offset = field->report_offset;\n\tunsigned size = field->report_size;\n\t__s32 min = field->logical_minimum;\n\t__s32 max = field->logical_maximum;\n\t__s32 *value;\n\n\tvalue = kmalloc(sizeof(__s32) * count, GFP_ATOMIC);\n\tif (!value)\n\t\treturn;\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tvalue[n] = min < 0 ?\n\t\t\tsnto32(hid_field_extract(hid, data, offset + n * size,\n\t\t\t size), size) :\n\t\t\thid_field_extract(hid, data, offset + n * size, size);\n\n\t\t/* Ignore report if ErrorRollOver */\n\t\tif (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&\n\t\t value[n] >= min && value[n] <= max &&\n\t\t field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)\n\t\t\tgoto exit;\n\t}\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tif (HID_MAIN_ITEM_VARIABLE & field->flags) {\n\t\t\thid_process_event(hid, field, &field->usage[n], value[n], interrupt);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (field->value[n] >= min && field->value[n] <= max\n\t\t\t&& field->usage[field->value[n] - min].hid\n\t\t\t&& search(value, field->value[n], count))\n\t\t\t\thid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);\n\n\t\tif (value[n] >= min && value[n] <= max\n\t\t\t&& field->usage[value[n] - min].hid\n\t\t\t&& search(field->value, value[n], count))\n\t\t\t\thid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);\n\t}\n\n\tmemcpy(field->value, value, count * sizeof(__s32));\nexit:\n\tkfree(value);\n}","target":"static void hid_input_field(struct hid_device *hid, struct hid_field *field,\n\t\t\t __u8 *data, int interrupt)\n{\n\tunsigned n;\n\tunsigned count = field->report_count;\n\tunsigned offset = field->report_offset;\n\tunsigned size = field->report_size;\n\t__s32 min = field->logical_minimum;\n\t__s32 max = field->logical_maximum;\n\t__s32 *value;\n\n\tvalue = kmalloc(sizeof(__s32) * count, GFP_ATOMIC);\n\tif (!value)\n\t\treturn;\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tvalue[n] = min < 0 ?\n\t\t\tsnto32(hid_field_extract(hid, data, offset + n * size,\n\t\t\t size), size) :\n\t\t\thid_field_extract(hid, data, offset + n * size, size);\n\n\t\t/* Ignore report if ErrorRollOver */\n\t\tif (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&\n\t\t value[n] >= min && value[n] <= max &&\n\t\t value[n] - min < field->maxusage &&\n\t\t field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)\n\t\t\tgoto exit;\n\t}\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tif (HID_MAIN_ITEM_VARIABLE & field->flags) {\n\t\t\thid_process_event(hid, field, &field->usage[n], value[n], interrupt);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (field->value[n] >= min && field->value[n] <= max\n\t\t\t&& field->value[n] - min < field->maxusage\n\t\t\t&& field->usage[field->value[n] - min].hid\n\t\t\t&& search(value, field->value[n], count))\n\t\t\t\thid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);\n\n\t\tif (value[n] >= min && value[n] <= max\n\t\t\t&& value[n] - min < field->maxusage\n\t\t\t&& field->usage[value[n] - min].hid\n\t\t\t&& search(field->value, value[n], count))\n\t\t\t\thid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);\n\t}\n\n\tmemcpy(field->value, value, count * sizeof(__s32));\nexit:\n\tkfree(value);\n}","lang":"c","vul_type":"cwe-125","target_token_count":502,"sven_meta":{"func_name":"hid_input_field","file_name":"drivers/hid/hid-core.c","commit_link":"github.com/torvalds/linux/commit/50220dead1650609206efe91f0cc116132d59b3f","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#94-9cd693faa994","input":"static UINT parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tchar* path = NULL;\n\tint status;\n\tUINT32 PathLength;\n\tStream_Seek(irp->input, 28);\n\t/* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */\n\t/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */\n\tStream_Read_UINT32(irp->input, PathLength);\n\tstatus = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*)Stream_Pointer(irp->input), PathLength / 2,\n\t &path, 0, NULL, NULL);\n\n\tif (status < 1)\n\t\tif (!(path = (char*)calloc(1, 1)))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"calloc failed!\");\n\t\t\treturn CHANNEL_RC_NO_MEMORY;\n\t\t}\n\n\tparallel->id = irp->devman->id_sequence++;\n\tparallel->file = open(parallel->path, O_RDWR);\n\n\tif (parallel->file < 0)\n\t{\n\t\tirp->IoStatus = STATUS_ACCESS_DENIED;\n\t\tparallel->id = 0;\n\t}\n\telse\n\t{\n\t\t/* all read and write operations should be non-blocking */\n\t\tif (fcntl(parallel->file, F_SETFL, O_NONBLOCK) == -1)\n\t\t{\n\t\t}\n\t}\n\n\tStream_Write_UINT32(irp->output, parallel->id);\n\tStream_Write_UINT8(irp->output, 0);\n\tfree(path);\n\treturn irp->Complete(irp);\n}","target":"static UINT parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tchar* path = NULL;\n\tint status;\n\tWCHAR* ptr;\n\tUINT32 PathLength;\n\tif (!Stream_SafeSeek(irp->input, 28))\n\t\treturn ERROR_INVALID_DATA;\n\t/* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */\n\t/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */\n\tif (Stream_GetRemainingLength(irp->input) < 4)\n\t\treturn ERROR_INVALID_DATA;\n\tStream_Read_UINT32(irp->input, PathLength);\n\tptr = (WCHAR*)Stream_Pointer(irp->input);\n\tif (!Stream_SafeSeek(irp->input, PathLength))\n\t\treturn ERROR_INVALID_DATA;\n\tstatus = ConvertFromUnicode(CP_UTF8, 0, ptr, PathLength / 2, &path, 0, NULL, NULL);\n\n\tif (status < 1)\n\t\tif (!(path = (char*)calloc(1, 1)))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"calloc failed!\");\n\t\t\treturn CHANNEL_RC_NO_MEMORY;\n\t\t}\n\n\tparallel->id = irp->devman->id_sequence++;\n\tparallel->file = open(parallel->path, O_RDWR);\n\n\tif (parallel->file < 0)\n\t{\n\t\tirp->IoStatus = STATUS_ACCESS_DENIED;\n\t\tparallel->id = 0;\n\t}\n\telse\n\t{\n\t\t/* all read and write operations should be non-blocking */\n\t\tif (fcntl(parallel->file, F_SETFL, O_NONBLOCK) == -1)\n\t\t{\n\t\t}\n\t}\n\n\tStream_Write_UINT32(irp->output, parallel->id);\n\tStream_Write_UINT8(irp->output, 0);\n\tfree(path);\n\treturn irp->Complete(irp);\n}","lang":"c","vul_type":"cwe-125","target_token_count":391,"sven_meta":{"func_name":"parallel_process_irp_create","file_name":"channels/parallel/client/parallel_main.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/795842f4096501fcefc1a7f535ccc8132feb31d7","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#101-9d01383de1a6","input":"static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter)\n{\n\tdouble width_d;\n\tdouble scale_f_d = 1.0;\n\tconst double filter_width_d = DEFAULT_BOX_RADIUS;\n\tint windows_size;\n\tunsigned int u;\n\tLineContribType *res;\n\n\tif (scale_d < 1.0) {\n\t\twidth_d = filter_width_d / scale_d;\n\t\tscale_f_d = scale_d;\n\t} else {\n\t\twidth_d= filter_width_d;\n\t}\n\n\twindows_size = 2 * (int)ceil(width_d) + 1;\n\tres = _gdContributionsAlloc(line_size, windows_size);\n\n\tfor (u = 0; u < line_size; u++) {\n\t\tconst double dCenter = (double)u / scale_d;\n\t\t/* get the significant edge points affecting the pixel */\n\t\tregister int iLeft = MAX(0, (int)floor (dCenter - width_d));\n\t\tint iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1);\n\t\tdouble dTotalWeight = 0.0;\n\t\tint iSrc;\n\n\t\tres->ContribRow[u].Left = iLeft;\n\t\tres->ContribRow[u].Right = iRight;\n\n\t\t/* Cut edge points to fit in filter window in case of spill-off */\n\t\tif (iRight - iLeft + 1 > windows_size) {\n\t\t\tif (iLeft < ((int)src_size - 1 / 2)) {\n\t\t\t\tiLeft++;\n\t\t\t} else {\n\t\t\t\tiRight--;\n\t\t\t}\n\t\t}\n\n\t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n\t\t\tdTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc)));\n\t\t}\n\n\t\tif (dTotalWeight < 0.0) {\n\t\t\t_gdContributionsFree(res);\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (dTotalWeight > 0.0) {\n\t\t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n\t\t\t\tres->ContribRow[u].Weights[iSrc-iLeft] /= dTotalWeight;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}","target":"static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter)\n{\n\tdouble width_d;\n\tdouble scale_f_d = 1.0;\n\tconst double filter_width_d = DEFAULT_BOX_RADIUS;\n\tint windows_size;\n\tunsigned int u;\n\tLineContribType *res;\n\n\tif (scale_d < 1.0) {\n\t\twidth_d = filter_width_d / scale_d;\n\t\tscale_f_d = scale_d;\n\t} else {\n\t\twidth_d= filter_width_d;\n\t}\n\n\twindows_size = 2 * (int)ceil(width_d) + 1;\n\tres = _gdContributionsAlloc(line_size, windows_size);\n\n\tfor (u = 0; u < line_size; u++) {\n\t\tconst double dCenter = (double)u / scale_d;\n\t\t/* get the significant edge points affecting the pixel */\n\t\tregister int iLeft = MAX(0, (int)floor (dCenter - width_d));\n\t\tint iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1);\n\t\tdouble dTotalWeight = 0.0;\n\t\tint iSrc;\n\n\t\t/* Cut edge points to fit in filter window in case of spill-off */\n\t\tif (iRight - iLeft + 1 > windows_size) {\n\t\t\tif (iLeft < ((int)src_size - 1 / 2)) {\n\t\t\t\tiLeft++;\n\t\t\t} else {\n\t\t\t\tiRight--;\n\t\t\t}\n\t\t}\n\n\t\tres->ContribRow[u].Left = iLeft;\n\t\tres->ContribRow[u].Right = iRight;\n\n\t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n\t\t\tdTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc)));\n\t\t}\n\n\t\tif (dTotalWeight < 0.0) {\n\t\t\t_gdContributionsFree(res);\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (dTotalWeight > 0.0) {\n\t\t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n\t\t\t\tres->ContribRow[u].Weights[iSrc-iLeft] /= dTotalWeight;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}","lang":"c","vul_type":"cwe-125","target_token_count":501,"sven_meta":{"func_name":"_gdContributionsCalc","file_name":"src/gd_interpolation.c","commit_link":"github.com/libgd/libgd/commit/4f65a3e4eedaffa1efcf9ee1eb08f0b504fbc31a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#105-5c68af241977","input":"get_uncompressed_data(struct archive_read *a, const void **buff, size_t size,\n size_t minimum)\n{\n\tstruct _7zip *zip = (struct _7zip *)a->format->data;\n\tssize_t bytes_avail;\n\n\tif (zip->codec == _7Z_COPY && zip->codec2 == (unsigned long)-1) {\n\t\t/* Copy mode. */\n\n\t\t/*\n\t\t * Note: '1' here is a performance optimization.\n\t\t * Recall that the decompression layer returns a count of\n\t\t * available bytes; asking for more than that forces the\n\t\t * decompressor to combine reads by copying data.\n\t\t */\n\t\t*buff = __archive_read_ahead(a, 1, &bytes_avail);\n\t\tif (bytes_avail <= 0) {\n\t\t\tarchive_set_error(&a->archive,\n\t\t\t ARCHIVE_ERRNO_FILE_FORMAT,\n\t\t\t \"Truncated 7-Zip file data\");\n\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tif ((size_t)bytes_avail >\n\t\t zip->uncompressed_buffer_bytes_remaining)\n\t\t\tbytes_avail = (ssize_t)\n\t\t\t zip->uncompressed_buffer_bytes_remaining;\n\t\tif ((size_t)bytes_avail > size)\n\t\t\tbytes_avail = (ssize_t)size;\n\n\t\tzip->pack_stream_bytes_unconsumed = bytes_avail;\n\t} else if (zip->uncompressed_buffer_pointer == NULL) {\n\t\t/* Decompression has failed. */\n\t\tarchive_set_error(&(a->archive),\n\t\t ARCHIVE_ERRNO_MISC, \"Damaged 7-Zip archive\");\n\t\treturn (ARCHIVE_FATAL);\n\t} else {\n\t\t/* Packed mode. */\n\t\tif (minimum > zip->uncompressed_buffer_bytes_remaining) {\n\t\t\t/*\n\t\t\t * If remaining uncompressed data size is less than\n\t\t\t * the minimum size, fill the buffer up to the\n\t\t\t * minimum size.\n\t\t\t */\n\t\t\tif (extract_pack_stream(a, minimum) < 0)\n\t\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tif (size > zip->uncompressed_buffer_bytes_remaining)\n\t\t\tbytes_avail = (ssize_t)\n\t\t\t zip->uncompressed_buffer_bytes_remaining;\n\t\telse\n\t\t\tbytes_avail = (ssize_t)size;\n\t\t*buff = zip->uncompressed_buffer_pointer;\n\t\tzip->uncompressed_buffer_pointer += bytes_avail;\n\t}\n\tzip->uncompressed_buffer_bytes_remaining -= bytes_avail;\n\treturn (bytes_avail);\n}","target":"get_uncompressed_data(struct archive_read *a, const void **buff, size_t size,\n size_t minimum)\n{\n\tstruct _7zip *zip = (struct _7zip *)a->format->data;\n\tssize_t bytes_avail;\n\n\tif (zip->codec == _7Z_COPY && zip->codec2 == (unsigned long)-1) {\n\t\t/* Copy mode. */\n\n\t\t*buff = __archive_read_ahead(a, minimum, &bytes_avail);\n\t\tif (bytes_avail <= 0) {\n\t\t\tarchive_set_error(&a->archive,\n\t\t\t ARCHIVE_ERRNO_FILE_FORMAT,\n\t\t\t \"Truncated 7-Zip file data\");\n\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tif ((size_t)bytes_avail >\n\t\t zip->uncompressed_buffer_bytes_remaining)\n\t\t\tbytes_avail = (ssize_t)\n\t\t\t zip->uncompressed_buffer_bytes_remaining;\n\t\tif ((size_t)bytes_avail > size)\n\t\t\tbytes_avail = (ssize_t)size;\n\n\t\tzip->pack_stream_bytes_unconsumed = bytes_avail;\n\t} else if (zip->uncompressed_buffer_pointer == NULL) {\n\t\t/* Decompression has failed. */\n\t\tarchive_set_error(&(a->archive),\n\t\t ARCHIVE_ERRNO_MISC, \"Damaged 7-Zip archive\");\n\t\treturn (ARCHIVE_FATAL);\n\t} else {\n\t\t/* Packed mode. */\n\t\tif (minimum > zip->uncompressed_buffer_bytes_remaining) {\n\t\t\t/*\n\t\t\t * If remaining uncompressed data size is less than\n\t\t\t * the minimum size, fill the buffer up to the\n\t\t\t * minimum size.\n\t\t\t */\n\t\t\tif (extract_pack_stream(a, minimum) < 0)\n\t\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tif (size > zip->uncompressed_buffer_bytes_remaining)\n\t\t\tbytes_avail = (ssize_t)\n\t\t\t zip->uncompressed_buffer_bytes_remaining;\n\t\telse\n\t\t\tbytes_avail = (ssize_t)size;\n\t\t*buff = zip->uncompressed_buffer_pointer;\n\t\tzip->uncompressed_buffer_pointer += bytes_avail;\n\t}\n\tzip->uncompressed_buffer_bytes_remaining -= bytes_avail;\n\treturn (bytes_avail);\n}","lang":"c","vul_type":"cwe-125","target_token_count":443,"sven_meta":{"func_name":"get_uncompressed_data","file_name":"libarchive/archive_read_support_format_7zip.c","commit_link":"github.com/libarchive/libarchive/commit/65a23f5dbee4497064e9bb467f81138a62b0dae1","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#114-b8fcefc1e15c","input":"next_line(struct archive_read *a,\n const char **b, ssize_t *avail, ssize_t *ravail, ssize_t *nl)\n{\n\tssize_t len;\n\tint quit;\n\t\n\tquit = 0;\n\tif (*avail == 0) {\n\t\t*nl = 0;\n\t\tlen = 0;\n\t} else\n\t\tlen = get_line_size(*b, *avail, nl);\n\t/*\n\t * Read bytes more while it does not reach the end of line.\n\t */\n\twhile (*nl == 0 && len == *avail && !quit) {\n\t\tssize_t diff = *ravail - *avail;\n\t\tsize_t nbytes_req = (*ravail+1023) & ~1023U;\n\t\tssize_t tested;\n\n\t\t/* Increase reading bytes if it is not enough to at least\n\t\t * new two lines. */\n\t\tif (nbytes_req < (size_t)*ravail + 160)\n\t\t\tnbytes_req <<= 1;\n\n\t\t*b = __archive_read_ahead(a, nbytes_req, avail);\n\t\tif (*b == NULL) {\n\t\t\tif (*ravail >= *avail)\n\t\t\t\treturn (0);\n\t\t\t/* Reading bytes reaches the end of file. */\n\t\t\t*b = __archive_read_ahead(a, *avail, avail);\n\t\t\tquit = 1;\n\t\t}\n\t\t*ravail = *avail;\n\t\t*b += diff;\n\t\t*avail -= diff;\n\t\ttested = len;/* Skip some bytes we already determinated. */\n\t\tlen = get_line_size(*b, *avail, nl);\n\t\tif (len >= 0)\n\t\t\tlen += tested;\n\t}\n\treturn (len);\n}","target":"next_line(struct archive_read *a,\n const char **b, ssize_t *avail, ssize_t *ravail, ssize_t *nl)\n{\n\tssize_t len;\n\tint quit;\n\t\n\tquit = 0;\n\tif (*avail == 0) {\n\t\t*nl = 0;\n\t\tlen = 0;\n\t} else\n\t\tlen = get_line_size(*b, *avail, nl);\n\t/*\n\t * Read bytes more while it does not reach the end of line.\n\t */\n\twhile (*nl == 0 && len == *avail && !quit) {\n\t\tssize_t diff = *ravail - *avail;\n\t\tsize_t nbytes_req = (*ravail+1023) & ~1023U;\n\t\tssize_t tested;\n\n\t\t/* Increase reading bytes if it is not enough to at least\n\t\t * new two lines. */\n\t\tif (nbytes_req < (size_t)*ravail + 160)\n\t\t\tnbytes_req <<= 1;\n\n\t\t*b = __archive_read_ahead(a, nbytes_req, avail);\n\t\tif (*b == NULL) {\n\t\t\tif (*ravail >= *avail)\n\t\t\t\treturn (0);\n\t\t\t/* Reading bytes reaches the end of file. */\n\t\t\t*b = __archive_read_ahead(a, *avail, avail);\n\t\t\tquit = 1;\n\t\t}\n\t\t*ravail = *avail;\n\t\t*b += diff;\n\t\t*avail -= diff;\n\t\ttested = len;/* Skip some bytes we already determinated. */\n\t\tlen = get_line_size(*b + len, *avail - len, nl);\n\t\tif (len >= 0)\n\t\t\tlen += tested;\n\t}\n\treturn (len);\n}","lang":"c","vul_type":"cwe-125","target_token_count":362,"sven_meta":{"func_name":"next_line","file_name":"libarchive/archive_read_support_format_mtree.c","commit_link":"github.com/libarchive/libarchive/commit/eec077f52bfa2d3f7103b4b74d52572ba8a15aca","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#115-fbdc1c9cafc4","input":"x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)\n{\n\tunsigned int first = 0;\n\tunsigned int last = ARR_SIZE(insn_regs_intel) - 1;\n\tunsigned int mid = ARR_SIZE(insn_regs_intel) / 2;\n\n\tif (!intel_regs_sorted) {\n\t\tmemcpy(insn_regs_intel_sorted, insn_regs_intel,\n\t\t\t\tsizeof(insn_regs_intel_sorted));\n\t\tqsort(insn_regs_intel_sorted,\n\t\t\t\tARR_SIZE(insn_regs_intel_sorted),\n\t\t\t\tsizeof(struct insn_reg), regs_cmp);\n\t\tintel_regs_sorted = true;\n\t}\n\n\twhile (first <= last) {\n\t\tif (insn_regs_intel_sorted[mid].insn < id) {\n\t\t\tfirst = mid + 1;\n\t\t} else if (insn_regs_intel_sorted[mid].insn == id) {\n\t\t\tif (access) {\n\t\t\t\t*access = insn_regs_intel_sorted[mid].access;\n\t\t\t}\n\t\t\treturn insn_regs_intel_sorted[mid].reg;\n\t\t} else {\n\t\t\tif (mid == 0)\n\t\t\t\tbreak;\n\t\t\tlast = mid - 1;\n\t\t}\n\t\tmid = (first + last) / 2;\n\t}\n\n\t// not found\n\treturn 0;\n}","target":"x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)\n{\n\tstatic bool intel_regs_sorted = false;\n\tunsigned int first = 0;\n\tunsigned int last = ARR_SIZE(insn_regs_intel) - 1;\n\tunsigned int mid;\n\n\tif (!intel_regs_sorted) {\n\t\tmemcpy(insn_regs_intel_sorted, insn_regs_intel,\n\t\t\t\tsizeof(insn_regs_intel_sorted));\n\t\tqsort(insn_regs_intel_sorted,\n\t\t\t\tARR_SIZE(insn_regs_intel_sorted),\n\t\t\t\tsizeof(struct insn_reg), regs_cmp);\n\t\tintel_regs_sorted = true;\n\t}\n\n\tif (insn_regs_intel_sorted[0].insn > id ||\n\t\t\tinsn_regs_intel_sorted[last].insn < id) {\n\t\treturn 0;\n\t}\n\n\twhile (first <= last) {\n\t\tmid = (first + last) / 2;\n\t\tif (insn_regs_intel_sorted[mid].insn < id) {\n\t\t\tfirst = mid + 1;\n\t\t} else if (insn_regs_intel_sorted[mid].insn == id) {\n\t\t\tif (access) {\n\t\t\t\t*access = insn_regs_intel_sorted[mid].access;\n\t\t\t}\n\t\t\treturn insn_regs_intel_sorted[mid].reg;\n\t\t} else {\n\t\t\tif (mid == 0)\n\t\t\t\tbreak;\n\t\t\tlast = mid - 1;\n\t\t}\n\t}\n\n\t// not found\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":297,"sven_meta":{"func_name":"X86_insn_reg_intel","file_name":"arch/X86/X86Mapping.c","commit_link":"github.com/aquynh/capstone/commit/87a25bb543c8e4c09b48d4b4a6c7db31ce58df06","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#116-19a129d340d3","input":"R_API RBinJavaAttrInfo *r_bin_java_line_number_table_attr_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 curpos, offset = 0;\n\tRBinJavaLineNumberAttribute *lnattr;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\toffset += 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR;\n\tattr->info.line_number_table_attr.line_number_table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.line_number_table_attr.line_number_table = r_list_newf (free);\n\n\tut32 linenum_len = attr->info.line_number_table_attr.line_number_table_length;\n\tRList *linenum_list = attr->info.line_number_table_attr.line_number_table;\n\tif (linenum_len > sz) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tfor (i = 0; i < linenum_len; i++) {\n\t\tcurpos = buf_offset + offset;\n\t\t// printf (\"%llx %llx \\n\", curpos, sz);\n\t\t// XXX if (curpos + 8 >= sz) break;\n\t\tlnattr = R_NEW0 (RBinJavaLineNumberAttribute);\n\t\tif (!lnattr) {\n\t\t\tbreak;\n\t\t}\n\t\tlnattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->line_number = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->file_offset = curpos;\n\t\tlnattr->size = 4;\n\t\tr_list_append (linenum_list, lnattr);\n\t}\n\tattr->size = offset;\n\treturn attr;\n}","target":"R_API RBinJavaAttrInfo *r_bin_java_line_number_table_attr_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 curpos, offset = 0;\n\tRBinJavaLineNumberAttribute *lnattr;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\toffset += 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR;\n\tattr->info.line_number_table_attr.line_number_table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.line_number_table_attr.line_number_table = r_list_newf (free);\n\n\tut32 linenum_len = attr->info.line_number_table_attr.line_number_table_length;\n\tRList *linenum_list = attr->info.line_number_table_attr.line_number_table;\n\tif (linenum_len > sz) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tfor (i = 0; i < linenum_len; i++) {\n\t\tcurpos = buf_offset + offset;\n\t\t// printf (\"%llx %llx \\n\", curpos, sz);\n\t\t// XXX if (curpos + 8 >= sz) break;\n\t\tlnattr = R_NEW0 (RBinJavaLineNumberAttribute);\n\t\tif (!lnattr) {\n\t\t\tbreak;\n\t\t}\n\t\tif (offset + 8 >= sz) {\n\t\t\tbreak;\n\t\t}\n\t\tlnattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->line_number = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->file_offset = curpos;\n\t\tlnattr->size = 4;\n\t\tr_list_append (linenum_list, lnattr);\n\t}\n\tattr->size = offset;\n\treturn attr;\n}","lang":"c","vul_type":"cwe-125","target_token_count":418,"sven_meta":{"func_name":"r_bin_java_line_number_table_attr_new","file_name":"shlr/java/class.c","commit_link":"github.com/radare/radare2/commit/eb0fb72b3c5307ec8e33effb6bf947e38cfdffe8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#119-be4fdb641998","input":" bool handleBackslash(signed char& out) {\n char ch = *p++;\n switch (ch) {\n case 0: return false;\n case '\"': out = ch; return true;\n case '\\\\': out = ch; return true;\n case '/': out = ch; return true;\n case 'b': out = '\\b'; return true;\n case 'f': out = '\\f'; return true;\n case 'n': out = '\\n'; return true;\n case 'r': out = '\\r'; return true;\n case 't': out = '\\t'; return true;\n case 'u': {\n if (UNLIKELY(is_tsimplejson)) {\n auto const ch1 = *p++;\n auto const ch2 = *p++;\n auto const dch3 = dehexchar(*p++);\n auto const dch4 = dehexchar(*p++);\n if (UNLIKELY(ch1 != '0' || ch2 != '0' || dch3 < 0 || dch4 < 0)) {\n return false;\n }\n out = (dch3 << 4) | dch4;\n return true;\n } else {\n uint16_t u16cp = 0;\n for (int i = 0; i < 4; i++) {\n auto const hexv = dehexchar(*p++);\n if (hexv < 0) return false; // includes check for end of string\n u16cp <<= 4;\n u16cp |= hexv;\n }\n if (u16cp > 0x7f) {\n return false;\n } else {\n out = u16cp;\n return true;\n }\n }\n }\n default: return false;\n }\n }","target":" bool handleBackslash(signed char& out) {\n char ch = *p++;\n switch (ch) {\n case 0: return false;\n case '\"': out = ch; return true;\n case '\\\\': out = ch; return true;\n case '/': out = ch; return true;\n case 'b': out = '\\b'; return true;\n case 'f': out = '\\f'; return true;\n case 'n': out = '\\n'; return true;\n case 'r': out = '\\r'; return true;\n case 't': out = '\\t'; return true;\n case 'u': {\n if (UNLIKELY(is_tsimplejson)) {\n auto const ch1 = *p++;\n if (UNLIKELY(ch1 != '0')) return false;\n auto const ch2 = *p++;\n if (UNLIKELY(ch2 != '0')) return false;\n auto const dch3 = dehexchar(*p++);\n if (UNLIKELY(dch3 < 0)) return false;\n auto const dch4 = dehexchar(*p++);\n if (UNLIKELY(dch4 < 0)) return false;\n out = (dch3 << 4) | dch4;\n return true;\n } else {\n uint16_t u16cp = 0;\n for (int i = 0; i < 4; i++) {\n auto const hexv = dehexchar(*p++);\n if (hexv < 0) return false; // includes check for end of string\n u16cp <<= 4;\n u16cp |= hexv;\n }\n if (u16cp > 0x7f) {\n return false;\n } else {\n out = u16cp;\n return true;\n }\n }\n }\n default: return false;\n }\n }","lang":"cpp","vul_type":"cwe-125","target_token_count":407,"sven_meta":{"func_name":"HPHP::SimpleParser::handleBackslash","file_name":"hphp/runtime/ext/json/JSON_parser.cpp","commit_link":"github.com/facebook/hhvm/commit/b3679121bb3c7017ff04b4c08402ffff5cf59b13","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#128-212b82bfb12a","input":"ssize_t enc_untrusted_recvfrom(int sockfd, void *buf, size_t len, int flags,\n struct sockaddr *src_addr, socklen_t *addrlen) {\n int klinux_flags = TokLinuxRecvSendFlag(flags);\n if (klinux_flags == 0 && flags != 0) {\n errno = EINVAL;\n return -1;\n }\n\n MessageWriter input;\n input.Push(sockfd);\n input.Push(len);\n input.Push(klinux_flags);\n MessageReader output;\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kRecvFromHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_recvfrom\", 4);\n\n int result = output.next();\n int klinux_errno = output.next();\n // recvfrom() returns -1 on failure, with errno set to indicate the cause\n // of the error.\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return result;\n }\n\n auto buffer_received = output.next();\n memcpy(buf, buffer_received.data(), std::min(len, buffer_received.size()));\n\n // If |src_addr| is not NULL, and the underlying protocol provides the source\n // address, this source address is filled in. When |src_addr| is NULL, nothing\n // is filled in; in this case, |addrlen| is not used, and should also be NULL.\n if (src_addr != nullptr && addrlen != nullptr) {\n auto klinux_sockaddr_buf = output.next();\n const struct klinux_sockaddr *klinux_addr =\n klinux_sockaddr_buf.As();\n FromkLinuxSockAddr(klinux_addr, klinux_sockaddr_buf.size(), src_addr,\n addrlen, TrustedPrimitives::BestEffortAbort);\n }\n\n return result;\n}","target":"ssize_t enc_untrusted_recvfrom(int sockfd, void *buf, size_t len, int flags,\n struct sockaddr *src_addr, socklen_t *addrlen) {\n int klinux_flags = TokLinuxRecvSendFlag(flags);\n if (klinux_flags == 0 && flags != 0) {\n errno = EINVAL;\n return -1;\n }\n\n MessageWriter input;\n input.Push(sockfd);\n input.Push(len);\n input.Push(klinux_flags);\n MessageReader output;\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kRecvFromHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_recvfrom\", 4);\n\n int result = output.next();\n int klinux_errno = output.next();\n // recvfrom() returns -1 on failure, with errno set to indicate the cause\n // of the error.\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return result;\n }\n\n if (result > len) {\n ::asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_recvfrom: result exceeds requested\");\n }\n\n auto buffer_received = output.next();\n memcpy(buf, buffer_received.data(), std::min(len, buffer_received.size()));\n\n // If |src_addr| is not NULL, and the underlying protocol provides the source\n // address, this source address is filled in. When |src_addr| is NULL, nothing\n // is filled in; in this case, |addrlen| is not used, and should also be NULL.\n if (src_addr != nullptr && addrlen != nullptr) {\n auto klinux_sockaddr_buf = output.next();\n const struct klinux_sockaddr *klinux_addr =\n klinux_sockaddr_buf.As();\n FromkLinuxSockAddr(klinux_addr, klinux_sockaddr_buf.size(), src_addr,\n addrlen, TrustedPrimitives::BestEffortAbort);\n }\n\n return result;\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":453,"sven_meta":{"func_name":"enc_untrusted_recvfrom","file_name":"asylo/platform/host_call/trusted/host_calls.cc","commit_link":"github.com/google/asylo/commit/6e158d558abd3c29a0208e30c97c9a8c5bd4230f","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-078#0-a9aaae203e4b","input":"def start():\n print(\"[*] Starting backdoor process\")\n print(\"[*] Decompressing target to tmp directory...\")\n #subprocess.call(\"jar -x %s\" % target, shell=True)\n with zipfile.ZipFile(target, 'r') as zip:\n zip.extractall(\"tmp\")\n print(\"[*] Target dumped to tmp directory\")\n\n print(\"[*] Modifying manifest file...\")\n oldmain=\"\"\n man = open(\"tmp/META-INF/MANIFEST.MF\",\"r\").read()\n with open(\"tmp/META-INF/MANIFEST.MF\",\"w\") as f:\n for l in man.split(\"\\n\"):\n if \"Main-Class\" in l:\n oldmain=l[12:]\n f.write(\"Main-Class: %s\\n\" % \"Backdoor\")\n else:\n f.write(\"%s\\n\" % l)\n print(\"[*] Manifest file modified\")\n \n print(\"[*] Modifying provided backdoor...\")\n inmain=False\n level=0\n bd=open(backdoor, \"r\").read()\n with open(\"tmp/%s\" % backdoor,'w') as f:\n for l in bd.split(\"\\n\"):\n if \"main(\" in l:\n inmain=True\n f.write(l)\n elif \"}\" in l and level<2 and inmain:\n f.write(\"%s.main(args);}\" % oldmain)\n inmain=False\n elif \"}\" in l and level>1 and inmain:\n level-=1\n f.write(l)\n elif \"{\" in l and inmain:\n level+=1\n f.write(l)\n else:\n f.write(l)\n print(\"[*] Provided backdoor successfully modified\")\n\n print(\"[*] Compiling modified backdoor...\")\n if subprocess.call(\"javac -cp tmp/ tmp/%s\" % backdoor, shell=True) != 0:\n print(\"[!] Error compiling %s\" % backdoor)\n print(\"[*] Compiled modified backdoor\")\n \n if(len(oldmain)<1):\n print(\"[!] Main-Class manifest attribute not found\")\n else:\n print(\"[*] Repackaging target jar file...\")\n createZip(\"tmp\",outfile)\n print(\"[*] Target jar successfully repackaged\")\n shutil.rmtree('tmp/')","target":"def start():\n print(\"[*] Starting backdoor process\")\n print(\"[*] Decompressing target to tmp directory...\")\n #subprocess.call(\"jar -x %s\" % target, shell=True)\n with zipfile.ZipFile(target, 'r') as zip:\n zip.extractall(\"tmp\")\n print(\"[*] Target dumped to tmp directory\")\n\n print(\"[*] Modifying manifest file...\")\n oldmain=\"\"\n man = open(\"tmp/META-INF/MANIFEST.MF\",\"r\").read()\n with open(\"tmp/META-INF/MANIFEST.MF\",\"w\") as f:\n for l in man.split(\"\\n\"):\n if \"Main-Class\" in l:\n oldmain=l[12:]\n f.write(\"Main-Class: %s\\n\" % \"Backdoor\")\n else:\n f.write(\"%s\\n\" % l)\n print(\"[*] Manifest file modified\")\n \n print(\"[*] Modifying provided backdoor...\")\n inmain=False\n level=0\n bd=open(backdoor, \"r\").read()\n with open(\"tmp/%s\" % backdoor,'w') as f:\n for l in bd.split(\"\\n\"):\n if \"main(\" in l:\n inmain=True\n f.write(l)\n elif \"}\" in l and level<2 and inmain:\n f.write(\"%s.main(args);}\" % oldmain)\n inmain=False\n elif \"}\" in l and level>1 and inmain:\n level-=1\n f.write(l)\n elif \"{\" in l and inmain:\n level+=1\n f.write(l)\n else:\n f.write(l)\n print(\"[*] Provided backdoor successfully modified\")\n\n print(\"[*] Compiling modified backdoor...\")\n #if subprocess.call(\"javac -cp tmp/ tmp/%s\" % backdoor, shell=True) != 0:\n if subprocess.call(['javac','-cp','tmp/','tmp/%s'%backdoor],shell=False) != 0:\n print(\"[!] Error compiling %s\" % backdoor)\n print(\"[*] Compiled modified backdoor\")\n \n if(len(oldmain)<1):\n print(\"[!] Main-Class manifest attribute not found\")\n else:\n print(\"[*] Repackaging target jar file...\")\n createZip(\"tmp\",outfile)\n print(\"[*] Target jar successfully repackaged\")\n shutil.rmtree('tmp/')","lang":"python","vul_type":"cwe-078","target_token_count":511,"sven_meta":{"func_name":"start","file_name":"ajar.py","commit_link":"github.com/Atticuss/ajar/commit/5ed8aba271ad20e6168f2e3bd6c25ba89b84484f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#2-c82af2e5b379","input":" def _delete_vdisk(self, name, force):\n \"\"\"Deletes existing vdisks.\n\n It is very important to properly take care of mappings before deleting\n the disk:\n 1. If no mappings, then it was a vdisk, and can be deleted\n 2. If it is the source of a flashcopy mapping and copy_rate is 0, then\n it is a vdisk that has a snapshot. If the force flag is set,\n delete the mapping and the vdisk, otherwise set the mapping to\n copy and wait (this will allow users to delete vdisks that have\n snapshots if/when the upper layers allow it).\n 3. If it is the target of a mapping and copy_rate is 0, it is a\n snapshot, and we should properly stop the mapping and delete.\n 4. If it is the source/target of a mapping and copy_rate is not 0, it\n is a clone or vdisk created from a snapshot. We wait for the copy\n to complete (the mapping will be autodeleted) and then delete the\n vdisk.\n\n \"\"\"\n\n LOG.debug(_('enter: _delete_vdisk: vdisk %s') % name)\n\n # Try to delete volume only if found on the storage\n vdisk_defined = self._is_vdisk_defined(name)\n if not vdisk_defined:\n LOG.info(_('warning: Tried to delete vdisk %s but it does not '\n 'exist.') % name)\n return\n\n self._ensure_vdisk_no_fc_mappings(name)\n\n forceflag = '-force' if force else ''\n cmd_params = {'frc': forceflag, 'name': name}\n ssh_cmd = 'svctask rmvdisk %(frc)s %(name)s' % cmd_params\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from rmvdisk\n self._assert_ssh_return(len(out.strip()) == 0,\n ('_delete_vdisk %(name)s')\n % {'name': name},\n ssh_cmd, out, err)\n LOG.debug(_('leave: _delete_vdisk: vdisk %s') % name)","target":" def _delete_vdisk(self, name, force):\n \"\"\"Deletes existing vdisks.\n\n It is very important to properly take care of mappings before deleting\n the disk:\n 1. If no mappings, then it was a vdisk, and can be deleted\n 2. If it is the source of a flashcopy mapping and copy_rate is 0, then\n it is a vdisk that has a snapshot. If the force flag is set,\n delete the mapping and the vdisk, otherwise set the mapping to\n copy and wait (this will allow users to delete vdisks that have\n snapshots if/when the upper layers allow it).\n 3. If it is the target of a mapping and copy_rate is 0, it is a\n snapshot, and we should properly stop the mapping and delete.\n 4. If it is the source/target of a mapping and copy_rate is not 0, it\n is a clone or vdisk created from a snapshot. We wait for the copy\n to complete (the mapping will be autodeleted) and then delete the\n vdisk.\n\n \"\"\"\n\n LOG.debug(_('enter: _delete_vdisk: vdisk %s') % name)\n\n # Try to delete volume only if found on the storage\n vdisk_defined = self._is_vdisk_defined(name)\n if not vdisk_defined:\n LOG.info(_('warning: Tried to delete vdisk %s but it does not '\n 'exist.') % name)\n return\n\n self._ensure_vdisk_no_fc_mappings(name)\n\n ssh_cmd = ['svctask', 'rmvdisk', '-force', name]\n if not force:\n ssh_cmd.remove('-force')\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from rmvdisk\n self._assert_ssh_return(len(out.strip()) == 0,\n ('_delete_vdisk %(name)s')\n % {'name': name},\n ssh_cmd, out, err)\n LOG.debug(_('leave: _delete_vdisk: vdisk %s') % name)","lang":"python","vul_type":"cwe-078","target_token_count":449,"sven_meta":{"func_name":"_delete_vdisk","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#7-d026c91f8556","input":"@contextmanager\ndef run_interactive_shell_command(command, **kwargs):\n \"\"\"\n Runs a command in shell and provides stdout, stderr and stdin streams.\n\n This function creates a context manager that sets up the process, returns\n to caller, closes streams and waits for process to exit on leaving.\n\n The process is opened in `universal_newlines` mode.\n\n :param command: The command to run on shell.\n :param kwargs: Additional keyword arguments to pass to `subprocess.Popen`\n that is used to spawn the process (except `shell`,\n `stdout`, `stderr`, `stdin` and `universal_newlines`, a\n `TypeError` is raised then).\n :return: A context manager yielding the process started from the\n command.\n \"\"\"\n process = Popen(command,\n shell=True,\n stdout=PIPE,\n stderr=PIPE,\n stdin=PIPE,\n universal_newlines=True,\n **kwargs)\n try:\n yield process\n finally:\n process.stdout.close()\n process.stderr.close()\n process.stdin.close()\n process.wait()","target":"@contextmanager\ndef run_interactive_shell_command(command, **kwargs):\n \"\"\"\n Runs a single command in shell and provides stdout, stderr and stdin\n streams.\n\n This function creates a context manager that sets up the process (using\n `subprocess.Popen()`), returns to caller, closes streams and waits for\n process to exit on leaving.\n\n Shell execution is disabled by default (so no shell expansion takes place).\n If you want to turn shell execution on, you can pass `shell=True` like you\n would do for `subprocess.Popen()`.\n\n The process is opened in `universal_newlines` mode by default.\n\n :param command: The command to run on shell. This parameter can either\n be a sequence of arguments that are directly passed to\n the process or a string. A string gets splitted beforehand\n using `shlex.split()`.\n :param kwargs: Additional keyword arguments to pass to `subprocess.Popen`\n that is used to spawn the process (except `stdout`,\n `stderr`, `stdin` and `universal_newlines`, a `TypeError`\n is raised then).\n :return: A context manager yielding the process started from the\n command.\n \"\"\"\n if isinstance(command, str):\n command = shlex.split(command)\n\n process = Popen(command,\n stdout=PIPE,\n stderr=PIPE,\n stdin=PIPE,\n universal_newlines=True,\n **kwargs)\n try:\n yield process\n finally:\n process.stdout.close()\n process.stderr.close()\n process.stdin.close()\n process.wait()","lang":"python","vul_type":"cwe-078","target_token_count":332,"sven_meta":{"func_name":"run_interactive_shell_command","file_name":"coalib/misc/Shell.py","commit_link":"github.com/coala/coala/commit/adc94c745e4d9f792fd9c9791c7b4cd8790d0d2f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#10-44c736f7de43","input":" def test_create_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = ('createhost -persona 1 -domain (\\'OpenStack\\',) '\n 'fakehost 123456789012345 123456789054321')\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n _run_ssh(show_host_cmd, False).AndReturn([pack(FC_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","target":" def test_create_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = (['createhost', '-persona', '1', '-domain',\n ('OpenStack',), 'fakehost', '123456789012345',\n '123456789054321'])\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n _run_ssh(show_host_cmd, False).AndReturn([pack(FC_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","lang":"python","vul_type":"cwe-078","target_token_count":304,"sven_meta":{"func_name":"test_create_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#12-67776a32016e","input":" def _execute_command_and_parse_attributes(self, ssh_cmd):\n \"\"\"Execute command on the Storwize/SVC and parse attributes.\n\n Exception is raised if the information from the system\n can not be obtained.\n\n \"\"\"\n\n LOG.debug(_('enter: _execute_command_and_parse_attributes: '\n ' command %s') % ssh_cmd)\n\n try:\n out, err = self._run_ssh(ssh_cmd)\n except exception.ProcessExecutionError as e:\n # Didn't get details from the storage, return None\n LOG.error(_('CLI Exception output:\\n command: %(cmd)s\\n '\n 'stdout: %(out)s\\n stderr: %(err)s') %\n {'cmd': ssh_cmd,\n 'out': e.stdout,\n 'err': e.stderr})\n return None\n\n self._assert_ssh_return(len(out),\n '_execute_command_and_parse_attributes',\n ssh_cmd, out, err)\n attributes = {}\n for attrib_line in out.split('\\n'):\n # If '!' not found, return the string and two empty strings\n attrib_name, foo, attrib_value = attrib_line.partition('!')\n if attrib_name is not None and len(attrib_name.strip()):\n attributes[attrib_name] = attrib_value\n\n LOG.debug(_('leave: _execute_command_and_parse_attributes:\\n'\n 'command: %(cmd)s\\n'\n 'attributes: %(attr)s')\n % {'cmd': ssh_cmd,\n 'attr': str(attributes)})\n\n return attributes","target":" def _execute_command_and_parse_attributes(self, ssh_cmd):\n \"\"\"Execute command on the Storwize/SVC and parse attributes.\n\n Exception is raised if the information from the system\n can not be obtained.\n\n \"\"\"\n\n LOG.debug(_('enter: _execute_command_and_parse_attributes: '\n ' command %s') % str(ssh_cmd))\n\n try:\n out, err = self._run_ssh(ssh_cmd)\n except exception.ProcessExecutionError as e:\n # Didn't get details from the storage, return None\n LOG.error(_('CLI Exception output:\\n command: %(cmd)s\\n '\n 'stdout: %(out)s\\n stderr: %(err)s') %\n {'cmd': ssh_cmd,\n 'out': e.stdout,\n 'err': e.stderr})\n return None\n\n self._assert_ssh_return(len(out),\n '_execute_command_and_parse_attributes',\n ssh_cmd, out, err)\n attributes = {}\n for attrib_line in out.split('\\n'):\n # If '!' not found, return the string and two empty strings\n attrib_name, foo, attrib_value = attrib_line.partition('!')\n if attrib_name is not None and len(attrib_name.strip()):\n attributes[attrib_name] = attrib_value\n\n LOG.debug(_('leave: _execute_command_and_parse_attributes:\\n'\n 'command: %(cmd)s\\n'\n 'attributes: %(attr)s')\n % {'cmd': str(ssh_cmd),\n 'attr': str(attributes)})\n\n return attributes","lang":"python","vul_type":"cwe-078","target_token_count":314,"sven_meta":{"func_name":"_execute_command_and_parse_attributes","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#13-c9d59ea8af43","input":" def test_get_iscsi_ip_active(self):\n self.flags(lock_path=self.tempdir)\n\n #record set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = 'showport'\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = 'showport -iscsi'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = 'showport -iscsiname'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n self.mox.ReplayAll()\n\n config = self.setup_configuration()\n config.hp3par_iscsi_ips = ['10.10.220.253', '10.10.220.252']\n self.setup_driver(config, set_up_fakes=False)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_vlun_cmd = 'showvlun -a -host fakehost'\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN), ''])\n\n self.mox.ReplayAll()\n\n ip = self.driver._get_iscsi_ip('fakehost')\n self.assertEqual(ip, '10.10.220.253')","target":" def test_get_iscsi_ip_active(self):\n self.flags(lock_path=self.tempdir)\n\n #record set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = ['showport']\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = ['showport', '-iscsi']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = ['showport', '-iscsiname']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n self.mox.ReplayAll()\n\n config = self.setup_configuration()\n config.hp3par_iscsi_ips = ['10.10.220.253', '10.10.220.252']\n self.setup_driver(config, set_up_fakes=False)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_vlun_cmd = ['showvlun', '-a', '-host', 'fakehost']\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN), ''])\n\n self.mox.ReplayAll()\n\n ip = self.driver._get_iscsi_ip('fakehost')\n self.assertEqual(ip, '10.10.220.253')","lang":"python","vul_type":"cwe-078","target_token_count":399,"sven_meta":{"func_name":"test_get_iscsi_ip_active","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#14-6ede8efac84b","input":" def _find_host_from_wwpn(self, connector):\n for wwpn in connector['wwpns']:\n ssh_cmd = 'svcinfo lsfabric -wwpn %s -delim !' % wwpn\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n # This WWPN is not in use\n continue\n\n host_lines = out.strip().split('\\n')\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('remote_wwpn' in header and\n 'name' in header,\n '_find_host_from_wwpn',\n ssh_cmd, out, err)\n rmt_wwpn_idx = header.index('remote_wwpn')\n name_idx = header.index('name')\n\n wwpns = map(lambda x: x.split('!')[rmt_wwpn_idx], host_lines)\n\n if wwpn in wwpns:\n # All the wwpns will be the mapping for the same\n # host from this WWPN-based query. Just pick\n # the name from first line.\n hostname = host_lines[0].split('!')[name_idx]\n return hostname\n\n # Didn't find a host\n return None","target":" def _find_host_from_wwpn(self, connector):\n for wwpn in connector['wwpns']:\n ssh_cmd = ['svcinfo', 'lsfabric', '-wwpn', wwpn, '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n # This WWPN is not in use\n continue\n\n host_lines = out.strip().split('\\n')\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('remote_wwpn' in header and\n 'name' in header,\n '_find_host_from_wwpn',\n ssh_cmd, out, err)\n rmt_wwpn_idx = header.index('remote_wwpn')\n name_idx = header.index('name')\n\n wwpns = map(lambda x: x.split('!')[rmt_wwpn_idx], host_lines)\n\n if wwpn in wwpns:\n # All the wwpns will be the mapping for the same\n # host from this WWPN-based query. Just pick\n # the name from first line.\n hostname = host_lines[0].split('!')[name_idx]\n return hostname\n\n # Didn't find a host\n return None","lang":"python","vul_type":"cwe-078","target_token_count":272,"sven_meta":{"func_name":"_find_host_from_wwpn","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#16-3601019c9a9b","input":" def _get_host_from_connector(self, connector):\n \"\"\"List the hosts defined in the storage.\n\n Return the host name with the given connection info, or None if there\n is no host fitting that information.\n\n \"\"\"\n\n prefix = self._connector_to_hostname_prefix(connector)\n LOG.debug(_('enter: _get_host_from_connector: prefix %s') % prefix)\n\n # Get list of host in the storage\n ssh_cmd = 'svcinfo lshost -delim !'\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return None\n\n # If we have FC information, we have a faster lookup option\n hostname = None\n if 'wwpns' in connector:\n hostname = self._find_host_from_wwpn(connector)\n\n # If we don't have a hostname yet, try the long way\n if not hostname:\n host_lines = out.strip().split('\\n')\n self._assert_ssh_return(len(host_lines),\n '_get_host_from_connector',\n ssh_cmd, out, err)\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('name' in header,\n '_get_host_from_connector',\n ssh_cmd, out, err)\n name_index = header.index('name')\n hosts = map(lambda x: x.split('!')[name_index], host_lines)\n hostname = self._find_host_exhaustive(connector, hosts)\n\n LOG.debug(_('leave: _get_host_from_connector: host %s') % hostname)\n\n return hostname","target":" def _get_host_from_connector(self, connector):\n \"\"\"List the hosts defined in the storage.\n\n Return the host name with the given connection info, or None if there\n is no host fitting that information.\n\n \"\"\"\n\n prefix = self._connector_to_hostname_prefix(connector)\n LOG.debug(_('enter: _get_host_from_connector: prefix %s') % prefix)\n\n # Get list of host in the storage\n ssh_cmd = ['svcinfo', 'lshost', '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return None\n\n # If we have FC information, we have a faster lookup option\n hostname = None\n if 'wwpns' in connector:\n hostname = self._find_host_from_wwpn(connector)\n\n # If we don't have a hostname yet, try the long way\n if not hostname:\n host_lines = out.strip().split('\\n')\n self._assert_ssh_return(len(host_lines),\n '_get_host_from_connector',\n ssh_cmd, out, err)\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('name' in header,\n '_get_host_from_connector',\n ssh_cmd, out, err)\n name_index = header.index('name')\n hosts = map(lambda x: x.split('!')[name_index], host_lines)\n hostname = self._find_host_exhaustive(connector, hosts)\n\n LOG.debug(_('leave: _get_host_from_connector: host %s') % hostname)\n\n return hostname","lang":"python","vul_type":"cwe-078","target_token_count":335,"sven_meta":{"func_name":"_get_host_from_connector","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#18-4a612d4393e8","input":"def main():\n global word\n print(\"Starting script... press 'ctrl+c' in terminal to turn off\")\n while True:\n if pyperclip.paste() != word and len(pyperclip.paste().split())<5:\n word = pyperclip.paste()\n wordChc=False\n req = requests.get(\"https://api-portal.dictionary.com/dcom/pageData/%s\" % word)\n wordChcURB = False\n reqURB=requests.get('https://api.urbandictionary.com/v0/define?term=%s' % word)\n try: \n data = json.loads(req.text)['data']['content'][0]['entries'][0]['posBlocks'][0]['definitions']\n except TypeError:\n os.system('notify-send \"Cant find |%s| on dictionary.com!\"' % word)\n wordChc = True\n except KeyError:\n os.system('notify-send \"Cant find |%s| on dictionary.com!\"' % word)\n wordChc = True\n\n if not wordChc:\n definitions = []\n try:\n for definition in data[:3]:\n definitions.append(cleanhtml(definition['definition']))\n definitions.append(\"------------\")\n os.system('notify-send \"definitions from dictionary.com:[{}\\n{}\"'\\\n .format(word+\"]\\n------------\",'\\n'.join(definitions)))\n except KeyError:\n os.system('notify-send \"no results in dictionary.com\"')\n try: \n dataURB = json.loads(reqURB.text)['list']\n except TypeError:\n os.system('notify-send \"Cant find |%s| on urbandictionary.com!\"' % word)\n wordChcURB = True\n except KeyError:\n os.system('notify-send \"Cant find |%s| on urbandictionary.com!\"' % word)\n wordChcURB = True\n\n if not wordChcURB: \n definitionsURB = []\n for definition in dataURB[:3]:\n definitionsURB.append(definition['definition'])\n definitionsURB.append(\"------------\")\n os.system('notify-send \"definitions from urbandictionary.com:[{}\\n{}\"'\\\n .format(word+\"]\\n------------\",'\\n'.join(definitionsURB)))\n os.system('notify-send \"Thank you for using define.py made by kelj0\"')","target":"def main():\n global word\n print(\"Starting script... press 'ctrl+c' in terminal to turn off\")\n while True:\n if pyperclip.paste() != word and len(pyperclip.paste().split())<5:\n word = pyperclip.paste()\n wordChc=False\n req = requests.get(\"https://api-portal.dictionary.com/dcom/pageData/%s\" % word)\n wordChcURB = False\n reqURB=requests.get('https://api.urbandictionary.com/v0/define?term=%s' % word)\n try: \n data = json.loads(req.text)['data']['content'][0]['entries'][0]['posBlocks'][0]['definitions']\n except TypeError:\n os.system('notify-send \"Cant find that word on dictionary.com!\"')\n wordChc = True\n except KeyError:\n os.system('notify-send \"Cant find that word on dictionary.com!\"')\n wordChc = True\n\n if not wordChc:\n definitions = []\n try:\n for definition in data[:3]:\n definitions.append(cleanhtml(definition['definition']))\n definitions.append(\"------------\")\n os.system('notify-send \"definitions from dictionary.com:\\n{}\"'.format('\\n'.join(definitions)))\n except KeyError:\n os.system('notify-send \"no results in dictionary.com\"')\n try: \n dataURB = json.loads(reqURB.text)['list']\n except TypeError:\n os.system('notify-send \"Cant find that word on urbandictionary.com!\"' % word)\n wordChcURB = True\n except KeyError:\n os.system('notify-send \"Cant find that word on urbandictionary.com!\"' % word)\n wordChcURB = True\n\n if not wordChcURB: \n definitionsURB = []\n for definition in dataURB[:3]:\n definitionsURB.append(definition['definition'])\n definitionsURB.append(\"------------\")\n os.system('notify-send \"definitions from urbandictionary.com:\\n{}\"'.format('\\n'.join(definitionsURB)))\n os.system('notify-send \"Thank you for using define.py made by kelj0\"')","lang":"python","vul_type":"cwe-078","target_token_count":470,"sven_meta":{"func_name":"main","file_name":"SmallProjects/Define/define.py","commit_link":"github.com/kelj0/LearningPython/commit/2563088bf44f4d5e7f7d65f3c41f12fdaef4a1e4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#20-3a0c17bdb6c5","input":" def _get_flashcopy_mapping_attributes(self, fc_map_id):\n LOG.debug(_('enter: _get_flashcopy_mapping_attributes: mapping %s')\n % fc_map_id)\n\n fc_ls_map_cmd = 'svcinfo lsfcmap -filtervalue id=%s -delim !' % \\\n fc_map_id\n out, err = self._run_ssh(fc_ls_map_cmd)\n if not len(out.strip()):\n return None\n\n # Get list of FlashCopy mappings\n # We expect zero or one line if mapping does not exist,\n # two lines if it does exist, otherwise error\n lines = out.strip().split('\\n')\n self._assert_ssh_return(len(lines) <= 2,\n '_get_flashcopy_mapping_attributes',\n fc_ls_map_cmd, out, err)\n\n if len(lines) == 2:\n attributes = self._get_hdr_dic(lines[0], lines[1], '!')\n else: # 0 or 1 lines\n attributes = None\n\n LOG.debug(_('leave: _get_flashcopy_mapping_attributes: mapping '\n '%(fc_map_id)s, attributes %(attributes)s') %\n {'fc_map_id': fc_map_id, 'attributes': attributes})\n\n return attributes","target":" def _get_flashcopy_mapping_attributes(self, fc_map_id):\n LOG.debug(_('enter: _get_flashcopy_mapping_attributes: mapping %s')\n % fc_map_id)\n\n fc_ls_map_cmd = ['svcinfo', 'lsfcmap', '-filtervalue',\n 'id=%s' % fc_map_id, '-delim', '!']\n out, err = self._run_ssh(fc_ls_map_cmd)\n if not len(out.strip()):\n return None\n\n # Get list of FlashCopy mappings\n # We expect zero or one line if mapping does not exist,\n # two lines if it does exist, otherwise error\n lines = out.strip().split('\\n')\n self._assert_ssh_return(len(lines) <= 2,\n '_get_flashcopy_mapping_attributes',\n fc_ls_map_cmd, out, err)\n\n if len(lines) == 2:\n attributes = self._get_hdr_dic(lines[0], lines[1], '!')\n else: # 0 or 1 lines\n attributes = None\n\n LOG.debug(_('leave: _get_flashcopy_mapping_attributes: mapping '\n '%(fc_map_id)s, attributes %(attributes)s') %\n {'fc_map_id': fc_map_id, 'attributes': attributes})\n\n return attributes","lang":"python","vul_type":"cwe-078","target_token_count":265,"sven_meta":{"func_name":"_get_flashcopy_mapping_attributes","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#23-a63bbfd97879","input":" def test_create_invalid_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = ('createhost -persona 1 -domain (\\'OpenStack\\',) '\n 'fakehost 123456789012345 123456789054321')\n create_host_ret = pack(CLI_CR +\n 'already used by host fakehost.foo (19)')\n _run_ssh(create_host_cmd, False).AndReturn([create_host_ret, ''])\n\n show_3par_cmd = 'showhost -verbose fakehost.foo'\n _run_ssh(show_3par_cmd, False).AndReturn([pack(FC_SHOWHOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n\n self.assertEquals(host['name'], 'fakehost.foo')","target":" def test_create_invalid_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = (['createhost', '-persona', '1', '-domain',\n ('OpenStack',), 'fakehost', '123456789012345',\n '123456789054321'])\n create_host_ret = pack(CLI_CR +\n 'already used by host fakehost.foo (19)')\n _run_ssh(create_host_cmd, False).AndReturn([create_host_ret, ''])\n\n show_3par_cmd = ['showhost', '-verbose', 'fakehost.foo']\n _run_ssh(show_3par_cmd, False).AndReturn([pack(FC_SHOWHOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n\n self.assertEquals(host['name'], 'fakehost.foo')","lang":"python","vul_type":"cwe-078","target_token_count":349,"sven_meta":{"func_name":"test_create_invalid_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#25-4244e117e96d","input":" def _make_fc_map(self, source, target, full_copy):\n copyflag = '' if full_copy else '-copyrate 0'\n fc_map_cli_cmd = ('svctask mkfcmap -source %(src)s -target %(tgt)s '\n '-autodelete %(copyflag)s' %\n {'src': source,\n 'tgt': target,\n 'copyflag': copyflag})\n out, err = self._run_ssh(fc_map_cli_cmd)\n self._driver_assert(\n len(out.strip()),\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find success message in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n\n # Ensure that the output is as expected\n match_obj = re.search('FlashCopy Mapping, id \\[([0-9]+)\\], '\n 'successfully created', out)\n # Make sure we got a \"successfully created\" message with vdisk id\n self._driver_assert(\n match_obj is not None,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find success message in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n\n try:\n fc_map_id = match_obj.group(1)\n self._driver_assert(\n fc_map_id is not None,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find mapping id in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n except IndexError:\n self._driver_assert(\n False,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find mapping id in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n return fc_map_id","target":" def _make_fc_map(self, source, target, full_copy):\n fc_map_cli_cmd = ['svctask', 'mkfcmap', '-source', source, '-target',\n target, '-autodelete']\n if not full_copy:\n fc_map_cli_cmd.extend(['-copyrate', '0'])\n out, err = self._run_ssh(fc_map_cli_cmd)\n self._driver_assert(\n len(out.strip()),\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find success message in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n\n # Ensure that the output is as expected\n match_obj = re.search('FlashCopy Mapping, id \\[([0-9]+)\\], '\n 'successfully created', out)\n # Make sure we got a \"successfully created\" message with vdisk id\n self._driver_assert(\n match_obj is not None,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find success message in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n\n try:\n fc_map_id = match_obj.group(1)\n self._driver_assert(\n fc_map_id is not None,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find mapping id in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n except IndexError:\n self._driver_assert(\n False,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find mapping id in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n return fc_map_id","lang":"python","vul_type":"cwe-078","target_token_count":489,"sven_meta":{"func_name":"_make_fc_map","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#26-460c5df17593","input":" def test_get_iscsi_ip(self):\n self.flags(lock_path=self.tempdir)\n\n #record driver set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = 'showport'\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = 'showport -iscsi'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = 'showport -iscsiname'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n #record\n show_vlun_cmd = 'showvlun -a -host fakehost'\n show_vlun_ret = 'no vluns listed\\r\\n'\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(show_vlun_ret), ''])\n show_vlun_cmd = 'showvlun -a -showcols Port'\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n\n self.mox.ReplayAll()\n\n config = self.setup_configuration()\n config.iscsi_ip_address = '10.10.10.10'\n config.hp3par_iscsi_ips = ['10.10.220.253', '10.10.220.252']\n self.setup_driver(config, set_up_fakes=False)\n\n ip = self.driver._get_iscsi_ip('fakehost')\n self.assertEqual(ip, '10.10.220.252')","target":" def test_get_iscsi_ip(self):\n self.flags(lock_path=self.tempdir)\n\n #record driver set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = ['showport']\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = ['showport', '-iscsi']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = ['showport', '-iscsiname']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n #record\n show_vlun_cmd = ['showvlun', '-a', '-host', 'fakehost']\n show_vlun_ret = 'no vluns listed\\r\\n'\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(show_vlun_ret), ''])\n show_vlun_cmd = ['showvlun', '-a', '-showcols', 'Port']\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n\n self.mox.ReplayAll()\n\n config = self.setup_configuration()\n config.iscsi_ip_address = '10.10.10.10'\n config.hp3par_iscsi_ips = ['10.10.220.253', '10.10.220.252']\n self.setup_driver(config, set_up_fakes=False)\n\n ip = self.driver._get_iscsi_ip('fakehost')\n self.assertEqual(ip, '10.10.220.252')","lang":"python","vul_type":"cwe-078","target_token_count":419,"sven_meta":{"func_name":"test_get_iscsi_ip","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#27-07746633810f","input":"def usage(args=None):\n '''\n Return usage information for volumes mounted on this minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' disk.usage\n '''\n if __grains__['kernel'] == 'Linux':\n cmd = 'df -P'\n elif __grains__['kernel'] == 'OpenBSD':\n cmd = 'df -kP'\n else:\n cmd = 'df'\n if args:\n cmd = cmd + ' -' + args\n ret = {}\n out = __salt__['cmd.run'](cmd).splitlines()\n for line in out:\n if not line:\n continue\n if line.startswith('Filesystem'):\n continue\n comps = line.split()\n while not comps[1].isdigit():\n comps[0] = '{0} {1}'.format(comps[0], comps[1])\n comps.pop(1)\n try:\n if __grains__['kernel'] == 'Darwin':\n ret[comps[8]] = {\n 'filesystem': comps[0],\n '512-blocks': comps[1],\n 'used': comps[2],\n 'available': comps[3],\n 'capacity': comps[4],\n 'iused': comps[5],\n 'ifree': comps[6],\n '%iused': comps[7],\n }\n else:\n ret[comps[5]] = {\n 'filesystem': comps[0],\n '1K-blocks': comps[1],\n 'used': comps[2],\n 'available': comps[3],\n 'capacity': comps[4],\n }\n except IndexError:\n log.warn(\"Problem parsing disk usage information\")\n ret = {}\n return ret","target":"def usage(args=None):\n '''\n Return usage information for volumes mounted on this minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' disk.usage\n '''\n flags = ''\n allowed = ('a', 'B', 'h', 'H', 'i', 'k', 'l', 'P', 't', 'T', 'x', 'v')\n for flag in args:\n if flag in allowed:\n flags += flag\n else:\n break\n if __grains__['kernel'] == 'Linux':\n cmd = 'df -P'\n elif __grains__['kernel'] == 'OpenBSD':\n cmd = 'df -kP'\n else:\n cmd = 'df'\n if args:\n cmd += ' -{0}'.format(flags)\n ret = {}\n out = __salt__['cmd.run'](cmd).splitlines()\n for line in out:\n if not line:\n continue\n if line.startswith('Filesystem'):\n continue\n comps = line.split()\n while not comps[1].isdigit():\n comps[0] = '{0} {1}'.format(comps[0], comps[1])\n comps.pop(1)\n try:\n if __grains__['kernel'] == 'Darwin':\n ret[comps[8]] = {\n 'filesystem': comps[0],\n '512-blocks': comps[1],\n 'used': comps[2],\n 'available': comps[3],\n 'capacity': comps[4],\n 'iused': comps[5],\n 'ifree': comps[6],\n '%iused': comps[7],\n }\n else:\n ret[comps[5]] = {\n 'filesystem': comps[0],\n '1K-blocks': comps[1],\n 'used': comps[2],\n 'available': comps[3],\n 'capacity': comps[4],\n }\n except IndexError:\n log.warn(\"Problem parsing disk usage information\")\n ret = {}\n return ret","lang":"python","vul_type":"cwe-078","target_token_count":437,"sven_meta":{"func_name":"usage","file_name":"salt/modules/disk.py","commit_link":"github.com/saltstack/salt/commit/ebdef37b7e5d2b95a01d34b211c61c61da67e46a","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#30-7c7940c704c2","input":" def _run_ssh(self, command, check_exit=True, attempts=1):\n if not self.sshpool:\n self.sshpool = utils.SSHPool(self.config.san_ip,\n self.config.san_ssh_port,\n self.config.ssh_conn_timeout,\n self.config.san_login,\n password=self.config.san_password,\n privatekey=\n self.config.san_private_key,\n min_size=\n self.config.ssh_min_pool_conn,\n max_size=\n self.config.ssh_max_pool_conn)\n try:\n total_attempts = attempts\n with self.sshpool.item() as ssh:\n while attempts > 0:\n attempts -= 1\n try:\n return self._ssh_execute(ssh, command,\n check_exit_code=check_exit)\n except Exception as e:\n LOG.error(e)\n greenthread.sleep(randint(20, 500) / 100.0)\n msg = (_(\"SSH Command failed after '%(total_attempts)r' \"\n \"attempts : '%(command)s'\") %\n {'total_attempts': total_attempts, 'command': command})\n raise paramiko.SSHException(msg)\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error running ssh command: %s\") % command)","target":" def _run_ssh(self, cmd_list, check_exit=True, attempts=1):\n utils.check_ssh_injection(cmd_list)\n command = ' '. join(cmd_list)\n\n if not self.sshpool:\n self.sshpool = utils.SSHPool(self.config.san_ip,\n self.config.san_ssh_port,\n self.config.ssh_conn_timeout,\n self.config.san_login,\n password=self.config.san_password,\n privatekey=\n self.config.san_private_key,\n min_size=\n self.config.ssh_min_pool_conn,\n max_size=\n self.config.ssh_max_pool_conn)\n try:\n total_attempts = attempts\n with self.sshpool.item() as ssh:\n while attempts > 0:\n attempts -= 1\n try:\n return self._ssh_execute(ssh, command,\n check_exit_code=check_exit)\n except Exception as e:\n LOG.error(e)\n greenthread.sleep(randint(20, 500) / 100.0)\n msg = (_(\"SSH Command failed after '%(total_attempts)r' \"\n \"attempts : '%(command)s'\") %\n {'total_attempts': total_attempts, 'command': command})\n raise paramiko.SSHException(msg)\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error running ssh command: %s\") % command)","lang":"python","vul_type":"cwe-078","target_token_count":300,"sven_meta":{"func_name":"_run_ssh","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#34-c6fd76b935a4","input":" def test_create_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = ('createhost -iscsi -persona 1 -domain '\n '(\\'OpenStack\\',) '\n 'fakehost iqn.1993-08.org.debian:01:222')\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","target":" def test_create_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = (['createhost', '-iscsi', '-persona', '1', '-domain',\n ('OpenStack',), 'fakehost',\n 'iqn.1993-08.org.debian:01:222'])\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","lang":"python","vul_type":"cwe-078","target_token_count":293,"sven_meta":{"func_name":"test_create_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#39-bb9352c88007","input":"def populate_custom_grains_and_pillar():\n '''\n Populate local salt-minion grains and pillar fields values as specified in\n config file.\n\n For example:\n\n custom_grains_pillar:\n grains:\n - selinux: selinux:enabled\n - release: osrelease\n pillar:\n - ntpserver: network_services:ntpserver\n\n Note that the core grains are already included in hubble grains -- this\n is only necessary for custom grains and pillar data.\n '''\n log.debug('Fetching custom grains and pillar details')\n grains = {}\n salt.modules.config.__opts__ = __opts__\n custom_grains = __salt__['config.get']('custom_grains_pillar:grains', [])\n for grain in custom_grains:\n for key in grain:\n if _valid_command(grain[key]):\n value = __salt__['cmd.run']('salt-call grains.get {0}'.format(grain[key])).split('\\n')[1].strip()\n grains[key] = value\n custom_pillar = __salt__['config.get']('custom_grains_pillar:pillar', [])\n for pillar in custom_pillar:\n for key in pillar:\n if _valid_command(pillar[key]):\n value = __salt__['cmd.run']('salt-call pillar.get {0}'.format(pillar[key])).split('\\n')[1].strip()\n grains[key] = value\n log.debug('Done with fetching custom grains and pillar details')\n return grains","target":"def populate_custom_grains_and_pillar():\n '''\n Populate local salt-minion grains and pillar fields values as specified in\n config file.\n\n For example:\n\n custom_grains_pillar:\n grains:\n - selinux: selinux:enabled\n - release: osrelease\n pillar:\n - ntpserver: network_services:ntpserver\n\n Note that the core grains are already included in hubble grains -- this\n is only necessary for custom grains and pillar data.\n '''\n log.debug('Fetching custom grains and pillar details')\n grains = {}\n salt.modules.config.__opts__ = __opts__\n custom_grains = __salt__['config.get']('custom_grains_pillar:grains', [])\n for grain in custom_grains:\n for key in grain:\n value = __salt__['cmd.run'](['salt-call', 'grains.get', grain[key]]).split('\\n')[1].strip()\n grains[key] = value\n custom_pillar = __salt__['config.get']('custom_grains_pillar:pillar', [])\n for pillar in custom_pillar:\n for key in pillar:\n value = __salt__['cmd.run'](['salt-call', 'pillar.get', pillar[key]]).split('\\n')[1].strip()\n grains[key] = value\n log.debug('Done with fetching custom grains and pillar details')\n return grains","lang":"python","vul_type":"cwe-078","target_token_count":302,"sven_meta":{"func_name":"populate_custom_grains_and_pillar","file_name":"hubblestack/extmods/grains/custom_grains_pillar.py","commit_link":"github.com/hubblestack/hubble/commit/d9ca4a93ea5aabb1298c5b3dbfb23e94203428b9","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#40-86bcfc95a9d4","input":" def copy(self, src_data, src_path, dst_data, dst_path, job_id=None):\n credentials = ''\n\n if src_data is None: # Local\n src = src_path\n else:\n credentials += self._formatCredentials(src_data, name='src')\n src = 'src:{}'.format(src_path)\n\n if dst_data is None: # Local\n dst = dst_path\n else:\n credentials += self._formatCredentials(dst_data, name='dst')\n dst = 'dst:{}'.format(dst_path)\n\n\n command = (\n '{credentials} '\n 'rclone copy {src} {dst} '\n '--progress '\n '--stats 2s '\n ).format(\n credentials=credentials,\n src=src,\n dst=dst,\n )\n\n logging.info(sanitize(command))\n\n if job_id is None:\n job_id = self._get_next_job_id()\n else:\n if self._job_id_exists(job_id):\n raise ValueError('rclone copy job with ID {} already exists'.fromat(job_id))\n\n self._stop_events[job_id] = threading.Event()\n\n try:\n self._execute_interactive(command, job_id)\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))\n\n return job_id","target":" def copy(self, src_data, src_path, dst_data, dst_path, job_id=None):\n credentials = {}\n\n if src_data is None: # Local\n src = src_path\n else:\n credentials.update(self._formatCredentials(src_data, name='src'))\n src = 'src:{}'.format(src_path)\n\n if dst_data is None: # Local\n dst = dst_path\n else:\n credentials.update(self._formatCredentials(dst_data, name='dst'))\n dst = 'dst:{}'.format(dst_path)\n\n command = [\n 'rclone',\n 'copy',\n src,\n dst,\n '--progress',\n '--stats', '2s',\n ]\n\n bash_command = \"{} {}\".format(\n ' '.join(\"{}='{}'\".format(key, value) for key, value in credentials.items()),\n ' '.join(command),\n )\n\n logging.info(sanitize(bash_command))\n\n if job_id is None:\n job_id = self._get_next_job_id()\n else:\n if self._job_id_exists(job_id):\n raise ValueError('rclone copy job with ID {} already exists'.fromat(job_id))\n\n self._stop_events[job_id] = threading.Event()\n\n try:\n self._execute_interactive(command, credentials, job_id)\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))\n\n return job_id","lang":"python","vul_type":"cwe-078","target_token_count":296,"sven_meta":{"func_name":"copy","file_name":"src/backend/api/utils/rclone_connection.py","commit_link":"github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#43-97660977fd9d","input":" def handle_message(self, ch, method, properties, body):\n \"\"\"\n this is a pika.basic_consumer callback\n handles client inputs, runs appropriate workflows and views\n\n Args:\n ch: amqp channel\n method: amqp method\n properties:\n body: message body\n \"\"\"\n input = {}\n try:\n self.sessid = method.routing_key\n\n input = json_decode(body)\n data = input['data']\n\n # since this comes as \"path\" we dont know if it's view or workflow yet\n #TODO: just a workaround till we modify ui to\n if 'path' in data:\n if data['path'] in settings.VIEW_URLS:\n data['view'] = data['path']\n else:\n data['wf'] = data['path']\n session = Session(self.sessid)\n\n headers = {'remote_ip': input['_zops_remote_ip']}\n\n if 'wf' in data:\n output = self._handle_workflow(session, data, headers)\n elif 'job' in data:\n\n self._handle_job(session, data, headers)\n return\n else:\n output = self._handle_view(session, data, headers)\n\n except HTTPError as e:\n import sys\n if hasattr(sys, '_called_from_test'):\n raise\n output = {'cmd': 'error', 'error': self._prepare_error_msg(e.message), \"code\": e.code}\n log.exception(\"Http error occurred\")\n except:\n self.current = Current(session=session, input=data)\n self.current.headers = headers\n import sys\n if hasattr(sys, '_called_from_test'):\n raise\n err = traceback.format_exc()\n output = {'error': self._prepare_error_msg(err), \"code\": 500}\n log.exception(\"Worker error occurred with messsage body:\\n%s\" % body)\n if 'callbackID' in input:\n output['callbackID'] = input['callbackID']\n log.info(\"OUTPUT for %s: %s\" % (self.sessid, output))\n output['reply_timestamp'] = time()\n self.send_output(output)","target":" def handle_message(self, ch, method, properties, body):\n \"\"\"\n this is a pika.basic_consumer callback\n handles client inputs, runs appropriate workflows and views\n\n Args:\n ch: amqp channel\n method: amqp method\n properties:\n body: message body\n \"\"\"\n input = {}\n headers = {}\n try:\n self.sessid = method.routing_key\n\n input = json_decode(body)\n data = input['data']\n\n # since this comes as \"path\" we dont know if it's view or workflow yet\n # TODO: just a workaround till we modify ui to\n if 'path' in data:\n if data['path'] in settings.VIEW_URLS:\n data['view'] = data['path']\n else:\n data['wf'] = data['path']\n session = Session(self.sessid)\n\n headers = {'remote_ip': input['_zops_remote_ip'],\n 'source': input['_zops_source']}\n\n if 'wf' in data:\n output = self._handle_workflow(session, data, headers)\n elif 'job' in data:\n\n self._handle_job(session, data, headers)\n return\n else:\n output = self._handle_view(session, data, headers)\n\n except HTTPError as e:\n import sys\n if hasattr(sys, '_called_from_test'):\n raise\n output = {'cmd': 'error', 'error': self._prepare_error_msg(e.message), \"code\": e.code}\n log.exception(\"Http error occurred\")\n except:\n self.current = Current(session=session, input=data)\n self.current.headers = headers\n import sys\n if hasattr(sys, '_called_from_test'):\n raise\n err = traceback.format_exc()\n output = {'error': self._prepare_error_msg(err), \"code\": 500}\n log.exception(\"Worker error occurred with messsage body:\\n%s\" % body)\n if 'callbackID' in input:\n output['callbackID'] = input['callbackID']\n log.info(\"OUTPUT for %s: %s\" % (self.sessid, output))\n output['reply_timestamp'] = time()\n self.send_output(output)","lang":"python","vul_type":"cwe-078","target_token_count":467,"sven_meta":{"func_name":"handle_message","file_name":"zengine/wf_daemon.py","commit_link":"github.com/zetaops/zengine/commit/52eafbee90f8ddf78be0c7452828d49423246851","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#50-0b3e8f1918f8","input":" def _create_vdisk(self, name, size, units, opts):\n \"\"\"Create a new vdisk.\"\"\"\n\n LOG.debug(_('enter: _create_vdisk: vdisk %s ') % name)\n\n model_update = None\n autoex = '-autoexpand' if opts['autoexpand'] else ''\n easytier = '-easytier on' if opts['easytier'] else '-easytier off'\n\n # Set space-efficient options\n if opts['rsize'] == -1:\n ssh_cmd_se_opt = ''\n else:\n ssh_cmd_se_opt = (\n '-rsize %(rsize)d%% %(autoex)s -warning %(warn)d%%' %\n {'rsize': opts['rsize'],\n 'autoex': autoex,\n 'warn': opts['warning']})\n if opts['compression']:\n ssh_cmd_se_opt = ssh_cmd_se_opt + ' -compressed'\n else:\n ssh_cmd_se_opt = ssh_cmd_se_opt + (\n ' -grainsize %d' % opts['grainsize'])\n\n ssh_cmd = ('svctask mkvdisk -name %(name)s -mdiskgrp %(mdiskgrp)s '\n '-iogrp 0 -size %(size)s -unit '\n '%(unit)s %(easytier)s %(ssh_cmd_se_opt)s'\n % {'name': name,\n 'mdiskgrp': self.configuration.storwize_svc_volpool_name,\n 'size': size, 'unit': units, 'easytier': easytier,\n 'ssh_cmd_se_opt': ssh_cmd_se_opt})\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), '_create_vdisk',\n ssh_cmd, out, err)\n\n # Ensure that the output is as expected\n match_obj = re.search('Virtual Disk, id \\[([0-9]+)\\], '\n 'successfully created', out)\n # Make sure we got a \"successfully created\" message with vdisk id\n self._driver_assert(\n match_obj is not None,\n _('_create_vdisk %(name)s - did not find '\n 'success message in CLI output.\\n '\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'name': name, 'out': str(out), 'err': str(err)})\n\n LOG.debug(_('leave: _create_vdisk: volume %s ') % name)","target":" def _create_vdisk(self, name, size, units, opts):\n \"\"\"Create a new vdisk.\"\"\"\n\n LOG.debug(_('enter: _create_vdisk: vdisk %s ') % name)\n\n model_update = None\n easytier = 'on' if opts['easytier'] else 'off'\n\n # Set space-efficient options\n if opts['rsize'] == -1:\n ssh_cmd_se_opt = []\n else:\n ssh_cmd_se_opt = ['-rsize', '%s%%' % str(opts['rsize']),\n '-autoexpand', '-warning',\n '%s%%' % str(opts['warning'])]\n if not opts['autoexpand']:\n ssh_cmd_se_opt.remove('-autoexpand')\n\n if opts['compression']:\n ssh_cmd_se_opt.append('-compressed')\n else:\n ssh_cmd_se_opt.extend(['-grainsize', str(opts['grainsize'])])\n\n ssh_cmd = ['svctask', 'mkvdisk', '-name', name, '-mdiskgrp',\n self.configuration.storwize_svc_volpool_name,\n '-iogrp', '0', '-size', size, '-unit',\n units, '-easytier', easytier] + ssh_cmd_se_opt\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), '_create_vdisk',\n ssh_cmd, out, err)\n\n # Ensure that the output is as expected\n match_obj = re.search('Virtual Disk, id \\[([0-9]+)\\], '\n 'successfully created', out)\n # Make sure we got a \"successfully created\" message with vdisk id\n self._driver_assert(\n match_obj is not None,\n _('_create_vdisk %(name)s - did not find '\n 'success message in CLI output.\\n '\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'name': name, 'out': str(out), 'err': str(err)})\n\n LOG.debug(_('leave: _create_vdisk: volume %s ') % name)","lang":"python","vul_type":"cwe-078","target_token_count":440,"sven_meta":{"func_name":"_create_vdisk","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#51-ff53f932fe8f","input":" def test_invalid_iscsi_ip(self):\n self.flags(lock_path=self.tempdir)\n\n #record driver set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = 'showport'\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = 'showport -iscsi'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = 'showport -iscsiname'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n config = self.setup_configuration()\n config.hp3par_iscsi_ips = ['10.10.220.250', '10.10.220.251']\n config.iscsi_ip_address = '10.10.10.10'\n self.mox.ReplayAll()\n\n # no valid ip addr should be configured.\n self.assertRaises(exception.InvalidInput,\n self.setup_driver,\n config,\n set_up_fakes=False)","target":" def test_invalid_iscsi_ip(self):\n self.flags(lock_path=self.tempdir)\n\n #record driver set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = ['showport']\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = ['showport', '-iscsi']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = ['showport', '-iscsiname']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n config = self.setup_configuration()\n config.hp3par_iscsi_ips = ['10.10.220.250', '10.10.220.251']\n config.iscsi_ip_address = '10.10.10.10'\n self.mox.ReplayAll()\n\n # no valid ip addr should be configured.\n self.assertRaises(exception.InvalidInput,\n self.setup_driver,\n config,\n set_up_fakes=False)","lang":"python","vul_type":"cwe-078","target_token_count":292,"sven_meta":{"func_name":"test_invalid_iscsi_ip","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#56-0f9c9f940fdd","input":" def _update_volume_stats(self):\n \"\"\"Retrieve stats info from volume group.\"\"\"\n\n LOG.debug(_(\"Updating volume stats\"))\n data = {}\n\n data['vendor_name'] = 'IBM'\n data['driver_version'] = '1.1'\n data['storage_protocol'] = list(self._enabled_protocols)\n\n data['total_capacity_gb'] = 0 # To be overwritten\n data['free_capacity_gb'] = 0 # To be overwritten\n data['reserved_percentage'] = 0\n data['QoS_support'] = False\n\n pool = self.configuration.storwize_svc_volpool_name\n #Get storage system name\n ssh_cmd = 'svcinfo lssystem -delim !'\n attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes or not attributes['name']:\n exception_message = (_('_update_volume_stats: '\n 'Could not get system name'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n backend_name = self.configuration.safe_get('volume_backend_name')\n if not backend_name:\n backend_name = '%s_%s' % (attributes['name'], pool)\n data['volume_backend_name'] = backend_name\n\n ssh_cmd = 'svcinfo lsmdiskgrp -bytes -delim ! %s' % pool\n attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes:\n LOG.error(_('Could not get pool data from the storage'))\n exception_message = (_('_update_volume_stats: '\n 'Could not get storage pool data'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n data['total_capacity_gb'] = (float(attributes['capacity']) /\n (1024 ** 3))\n data['free_capacity_gb'] = (float(attributes['free_capacity']) /\n (1024 ** 3))\n data['easytier_support'] = attributes['easy_tier'] in ['on', 'auto']\n data['compression_support'] = self._compression_enabled\n\n self._stats = data","target":" def _update_volume_stats(self):\n \"\"\"Retrieve stats info from volume group.\"\"\"\n\n LOG.debug(_(\"Updating volume stats\"))\n data = {}\n\n data['vendor_name'] = 'IBM'\n data['driver_version'] = '1.1'\n data['storage_protocol'] = list(self._enabled_protocols)\n\n data['total_capacity_gb'] = 0 # To be overwritten\n data['free_capacity_gb'] = 0 # To be overwritten\n data['reserved_percentage'] = 0\n data['QoS_support'] = False\n\n pool = self.configuration.storwize_svc_volpool_name\n #Get storage system name\n ssh_cmd = ['svcinfo', 'lssystem', '-delim', '!']\n attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes or not attributes['name']:\n exception_message = (_('_update_volume_stats: '\n 'Could not get system name'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n backend_name = self.configuration.safe_get('volume_backend_name')\n if not backend_name:\n backend_name = '%s_%s' % (attributes['name'], pool)\n data['volume_backend_name'] = backend_name\n\n ssh_cmd = ['svcinfo', 'lsmdiskgrp', '-bytes', '-delim', '!', pool]\n attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes:\n LOG.error(_('Could not get pool data from the storage'))\n exception_message = (_('_update_volume_stats: '\n 'Could not get storage pool data'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n data['total_capacity_gb'] = (float(attributes['capacity']) /\n (1024 ** 3))\n data['free_capacity_gb'] = (float(attributes['free_capacity']) /\n (1024 ** 3))\n data['easytier_support'] = attributes['easy_tier'] in ['on', 'auto']\n data['compression_support'] = self._compression_enabled\n\n self._stats = data","lang":"python","vul_type":"cwe-078","target_token_count":438,"sven_meta":{"func_name":"_update_volume_stats","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#57-8035e4e0e399","input":" def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack(NO_FC_HOST_RET), ''])\n\n create_host_cmd = ('createhost -add fakehost '\n '123456789012345 123456789054321')\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack(FC_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","target":" def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack(NO_FC_HOST_RET), ''])\n\n create_host_cmd = ['createhost', '-add', 'fakehost', '123456789012345',\n '123456789054321']\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack(FC_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","lang":"python","vul_type":"cwe-078","target_token_count":306,"sven_meta":{"func_name":"test_create_modify_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#59-a64989f2b4c7","input":" def _get_least_used_nsp(self, nspss):\n \"\"\"\"Return the nsp that has the fewest active vluns.\"\"\"\n # return only the nsp (node:server:port)\n result = self.common._cli_run('showvlun -a -showcols Port', None)\n\n # count the number of nsps (there is 1 for each active vlun)\n nsp_counts = {}\n for nsp in nspss:\n # initialize counts to zero\n nsp_counts[nsp] = 0\n\n current_least_used_nsp = None\n if result:\n # first line is header\n result = result[1:]\n for line in result:\n nsp = line.strip()\n if nsp in nsp_counts:\n nsp_counts[nsp] = nsp_counts[nsp] + 1\n\n # identify key (nsp) of least used nsp\n current_smallest_count = sys.maxint\n for (nsp, count) in nsp_counts.iteritems():\n if count < current_smallest_count:\n current_least_used_nsp = nsp\n current_smallest_count = count\n\n return current_least_used_nsp","target":" def _get_least_used_nsp(self, nspss):\n \"\"\"\"Return the nsp that has the fewest active vluns.\"\"\"\n # return only the nsp (node:server:port)\n result = self.common._cli_run(['showvlun', '-a', '-showcols', 'Port'])\n\n # count the number of nsps (there is 1 for each active vlun)\n nsp_counts = {}\n for nsp in nspss:\n # initialize counts to zero\n nsp_counts[nsp] = 0\n\n current_least_used_nsp = None\n if result:\n # first line is header\n result = result[1:]\n for line in result:\n nsp = line.strip()\n if nsp in nsp_counts:\n nsp_counts[nsp] = nsp_counts[nsp] + 1\n\n # identify key (nsp) of least used nsp\n current_smallest_count = sys.maxint\n for (nsp, count) in nsp_counts.iteritems():\n if count < current_smallest_count:\n current_least_used_nsp = nsp\n current_smallest_count = count\n\n return current_least_used_nsp","lang":"python","vul_type":"cwe-078","target_token_count":258,"sven_meta":{"func_name":"_get_least_used_nsp","file_name":"cinder/volume/drivers/san/hp/hp_3par_iscsi.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#63-30c0e48002c5","input":"def test_settings_path_skip_issue_909(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'skip =\\n'\n ' file_to_be_skipped.py\\n'\n 'skip_glob =\\n'\n ' *glob_skip*\\n')\n\n base_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')\n base_dir.join('file_to_be_skipped.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')\n\n test_run_directory = os.getcwd()\n os.chdir(str(base_dir))\n with pytest.raises(Exception): # without the settings path provided: the command should not skip & identify errors\n check_output(['isort', '--check-only'])\n results = check_output(['isort', '--check-only', '--settings-path=conf/.isort.cfg'])\n os.chdir(str(test_run_directory))\n\n assert b'skipped 2' in results.lower()","target":"def test_settings_path_skip_issue_909(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'skip =\\n'\n ' file_to_be_skipped.py\\n'\n 'skip_glob =\\n'\n ' *glob_skip*\\n')\n\n base_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')\n base_dir.join('file_to_be_skipped.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')\n\n test_run_directory = os.getcwd()\n os.chdir(str(base_dir))\n with pytest.raises(Exception): # without the settings path provided: the command should not skip & identify errors\n subprocess.run(['isort', '--check-only'], check=True)\n result = subprocess.run(\n ['isort', '--check-only', '--settings-path=conf/.isort.cfg'],\n stdout=subprocess.PIPE,\n check=True\n )\n os.chdir(str(test_run_directory))\n\n assert b'skipped 2' in result.stdout.lower()","lang":"python","vul_type":"cwe-078","target_token_count":274,"sven_meta":{"func_name":"test_settings_path_skip_issue_909","file_name":"test_isort.py","commit_link":"github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#65-c6c5f37df5b7","input":" def take_bug_report(self, test_name, begin_time):\n \"\"\"Takes a bug report on the device and stores it in a file.\n\n Args:\n test_name: Name of the test case that triggered this bug report.\n begin_time: Logline format timestamp taken when the test started.\n \"\"\"\n new_br = True\n try:\n stdout = self.adb.shell('bugreportz -v').decode('utf-8')\n # This check is necessary for builds before N, where adb shell's ret\n # code and stderr are not propagated properly.\n if 'not found' in stdout:\n new_br = False\n except adb.AdbError:\n new_br = False\n br_path = os.path.join(self.log_path, 'BugReports')\n utils.create_dir(br_path)\n base_name = ',%s,%s.txt' % (begin_time, self.serial)\n if new_br:\n base_name = base_name.replace('.txt', '.zip')\n test_name_len = utils.MAX_FILENAME_LEN - len(base_name)\n out_name = test_name[:test_name_len] + base_name\n full_out_path = os.path.join(br_path, out_name.replace(' ', r'\\ '))\n # in case device restarted, wait for adb interface to return\n self.wait_for_boot_completion()\n self.log.info('Taking bugreport for %s.', test_name)\n if new_br:\n out = self.adb.shell('bugreportz').decode('utf-8')\n if not out.startswith('OK'):\n raise DeviceError(self, 'Failed to take bugreport: %s' % out)\n br_out_path = out.split(':')[1].strip()\n self.adb.pull('%s %s' % (br_out_path, full_out_path))\n else:\n self.adb.bugreport(' > %s' % full_out_path)\n self.log.info('Bugreport for %s taken at %s.', test_name,\n full_out_path)","target":" def take_bug_report(self, test_name, begin_time):\n \"\"\"Takes a bug report on the device and stores it in a file.\n\n Args:\n test_name: Name of the test case that triggered this bug report.\n begin_time: Logline format timestamp taken when the test started.\n \"\"\"\n new_br = True\n try:\n stdout = self.adb.shell('bugreportz -v').decode('utf-8')\n # This check is necessary for builds before N, where adb shell's ret\n # code and stderr are not propagated properly.\n if 'not found' in stdout:\n new_br = False\n except adb.AdbError:\n new_br = False\n br_path = os.path.join(self.log_path, 'BugReports')\n utils.create_dir(br_path)\n base_name = ',%s,%s.txt' % (begin_time, self.serial)\n if new_br:\n base_name = base_name.replace('.txt', '.zip')\n test_name_len = utils.MAX_FILENAME_LEN - len(base_name)\n out_name = test_name[:test_name_len] + base_name\n full_out_path = os.path.join(br_path, out_name.replace(' ', r'\\ '))\n # in case device restarted, wait for adb interface to return\n self.wait_for_boot_completion()\n self.log.info('Taking bugreport for %s.', test_name)\n if new_br:\n out = self.adb.shell('bugreportz').decode('utf-8')\n if not out.startswith('OK'):\n raise DeviceError(self, 'Failed to take bugreport: %s' % out)\n br_out_path = out.split(':')[1].strip()\n self.adb.pull([br_out_path, full_out_path])\n else:\n # shell=True as this command redirects the stdout to a local file\n # using shell redirection.\n self.adb.bugreport(' > %s' % full_out_path, shell=True)\n self.log.info('Bugreport for %s taken at %s.', test_name,\n full_out_path)","lang":"python","vul_type":"cwe-078","target_token_count":434,"sven_meta":{"func_name":"take_bug_report","file_name":"mobly/controllers/android_device.py","commit_link":"github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#66-a63bbfd97879","input":" def test_create_invalid_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = ('createhost -iscsi -persona 1 -domain '\n '(\\'OpenStack\\',) '\n 'fakehost iqn.1993-08.org.debian:01:222')\n in_use_ret = pack('\\r\\nalready used by host fakehost.foo ')\n _run_ssh(create_host_cmd, False).AndReturn([in_use_ret, ''])\n\n show_3par_cmd = 'showhost -verbose fakehost.foo'\n _run_ssh(show_3par_cmd, False).AndReturn([pack(ISCSI_3PAR_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n\n self.assertEquals(host['name'], 'fakehost.foo')","target":" def test_create_invalid_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = (['createhost', '-iscsi', '-persona', '1', '-domain',\n ('OpenStack',), 'fakehost',\n 'iqn.1993-08.org.debian:01:222'])\n in_use_ret = pack('\\r\\nalready used by host fakehost.foo ')\n _run_ssh(create_host_cmd, False).AndReturn([in_use_ret, ''])\n\n show_3par_cmd = ['showhost', '-verbose', 'fakehost.foo']\n _run_ssh(show_3par_cmd, False).AndReturn([pack(ISCSI_3PAR_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n\n self.assertEquals(host['name'], 'fakehost.foo')","lang":"python","vul_type":"cwe-078","target_token_count":335,"sven_meta":{"func_name":"test_create_invalid_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#68-cfef6e3f1ddb","input":"def test_skip_paths_issue_938(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'line_length = 88\\n'\n 'multi_line_output = 4\\n'\n 'lines_after_imports = 2\\n'\n 'skip_glob =\\n'\n ' migrations/**.py\\n')\n base_dir.join('dont_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')\n\n migrations_dir = base_dir.mkdir('migrations')\n migrations_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')\n\n test_run_directory = os.getcwd()\n os.chdir(str(base_dir))\n results = check_output(['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'])\n os.chdir(str(test_run_directory))\n\n assert b'skipped' not in results.lower()\n\n os.chdir(str(base_dir))\n results = check_output(['isort', '--filter-files', '--settings-path=conf/.isort.cfg', 'dont_skip.py', 'migrations/file_glob_skip.py'])\n os.chdir(str(test_run_directory))\n\n assert b'skipped 1' in results.lower()","target":"def test_skip_paths_issue_938(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'line_length = 88\\n'\n 'multi_line_output = 4\\n'\n 'lines_after_imports = 2\\n'\n 'skip_glob =\\n'\n ' migrations/**.py\\n')\n base_dir.join('dont_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')\n\n migrations_dir = base_dir.mkdir('migrations')\n migrations_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')\n\n test_run_directory = os.getcwd()\n os.chdir(str(base_dir))\n result = subprocess.run(\n ['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'],\n stdout=subprocess.PIPE,\n check=True,\n )\n os.chdir(str(test_run_directory))\n\n assert b'skipped' not in result.stdout.lower()\n\n os.chdir(str(base_dir))\n result = subprocess.run(\n ['isort', '--filter-files', '--settings-path=conf/.isort.cfg', 'dont_skip.py', 'migrations/file_glob_skip.py'],\n stdout=subprocess.PIPE,\n check=True,\n )\n os.chdir(str(test_run_directory))\n\n assert b'skipped 1' in result.stdout.lower()","lang":"python","vul_type":"cwe-078","target_token_count":333,"sven_meta":{"func_name":"test_skip_paths_issue_938","file_name":"test_isort.py","commit_link":"github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#69-4fda1d07f940","input":" def _ensure_vdisk_no_fc_mappings(self, name, allow_snaps=True):\n # Ensure vdisk has no FlashCopy mappings\n mapping_ids = self._get_vdisk_fc_mappings(name)\n while len(mapping_ids):\n wait_for_copy = False\n for map_id in mapping_ids:\n attrs = self._get_flashcopy_mapping_attributes(map_id)\n if not attrs:\n continue\n source = attrs['source_vdisk_name']\n target = attrs['target_vdisk_name']\n copy_rate = attrs['copy_rate']\n status = attrs['status']\n\n if copy_rate == '0':\n # Case #2: A vdisk that has snapshots\n if source == name:\n if not allow_snaps:\n return False\n ssh_cmd = ('svctask chfcmap -copyrate 50 '\n '-autodelete on %s' % map_id)\n out, err = self._run_ssh(ssh_cmd)\n wait_for_copy = True\n # Case #3: A snapshot\n else:\n msg = (_('Vdisk %(name)s not involved in '\n 'mapping %(src)s -> %(tgt)s') %\n {'name': name, 'src': source, 'tgt': target})\n self._driver_assert(target == name, msg)\n if status in ['copying', 'prepared']:\n self._run_ssh('svctask stopfcmap %s' % map_id)\n elif status in ['stopping', 'preparing']:\n wait_for_copy = True\n else:\n self._run_ssh('svctask rmfcmap -force %s' % map_id)\n # Case 4: Copy in progress - wait and will autodelete\n else:\n if status == 'prepared':\n self._run_ssh('svctask stopfcmap %s' % map_id)\n self._run_ssh('svctask rmfcmap -force %s' % map_id)\n elif status == 'idle_or_copied':\n # Prepare failed\n self._run_ssh('svctask rmfcmap -force %s' % map_id)\n else:\n wait_for_copy = True\n if wait_for_copy:\n time.sleep(5)\n mapping_ids = self._get_vdisk_fc_mappings(name)\n return True","target":" def _ensure_vdisk_no_fc_mappings(self, name, allow_snaps=True):\n # Ensure vdisk has no FlashCopy mappings\n mapping_ids = self._get_vdisk_fc_mappings(name)\n while len(mapping_ids):\n wait_for_copy = False\n for map_id in mapping_ids:\n attrs = self._get_flashcopy_mapping_attributes(map_id)\n if not attrs:\n continue\n source = attrs['source_vdisk_name']\n target = attrs['target_vdisk_name']\n copy_rate = attrs['copy_rate']\n status = attrs['status']\n\n if copy_rate == '0':\n # Case #2: A vdisk that has snapshots\n if source == name:\n if not allow_snaps:\n return False\n ssh_cmd = ['svctask', 'chfcmap', '-copyrate', '50',\n '-autodelete', 'on', map_id]\n out, err = self._run_ssh(ssh_cmd)\n wait_for_copy = True\n # Case #3: A snapshot\n else:\n msg = (_('Vdisk %(name)s not involved in '\n 'mapping %(src)s -> %(tgt)s') %\n {'name': name, 'src': source, 'tgt': target})\n self._driver_assert(target == name, msg)\n if status in ['copying', 'prepared']:\n self._run_ssh(['svctask', 'stopfcmap', map_id])\n elif status in ['stopping', 'preparing']:\n wait_for_copy = True\n else:\n self._run_ssh(['svctask', 'rmfcmap', '-force',\n map_id])\n # Case 4: Copy in progress - wait and will autodelete\n else:\n if status == 'prepared':\n self._run_ssh(['svctask', 'stopfcmap', map_id])\n self._run_ssh(['svctask', 'rmfcmap', '-force', map_id])\n elif status == 'idle_or_copied':\n # Prepare failed\n self._run_ssh(['svctask', 'rmfcmap', '-force', map_id])\n else:\n wait_for_copy = True\n if wait_for_copy:\n time.sleep(5)\n mapping_ids = self._get_vdisk_fc_mappings(name)\n return True","lang":"python","vul_type":"cwe-078","target_token_count":491,"sven_meta":{"func_name":"_ensure_vdisk_no_fc_mappings","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#71-40fbd4edf7d3","input":"def repack(host, targets, channel='stable'):\n url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'\n req = requests.get(url)\n req.raise_for_status()\n manifest = toml.loads(req.content)\n if manifest['manifest-version'] != '2':\n print('ERROR: unrecognized manifest version %s.' % manifest['manifest-version'])\n return\n print('Using manifest for rust %s as of %s.' % (channel, manifest['date']))\n rustc_version, rustc = package(manifest, 'rustc', host)\n if rustc['available']:\n print('rustc %s\\n %s\\n %s' % (rustc_version, rustc['url'], rustc['hash']))\n fetch(rustc['url'])\n cargo_version, cargo = package(manifest, 'cargo', host)\n if cargo['available']:\n print('cargo %s\\n %s\\n %s' % (cargo_version, cargo['url'], cargo['hash']))\n fetch(cargo['url'])\n stds = []\n for target in targets:\n version, info = package(manifest, 'rust-std', target)\n if info['available']:\n print('rust-std %s\\n %s\\n %s' % (version, info['url'], info['hash']))\n fetch(info['url'])\n stds.append(info)\n print('Installing packages...')\n tar_basename = 'rustc-%s-repack' % host\n install_dir = 'rustc'\n os.system('rm -rf %s' % install_dir)\n install(os.path.basename(rustc['url']), install_dir)\n install(os.path.basename(cargo['url']), install_dir)\n for std in stds:\n install(os.path.basename(std['url']), install_dir)\n print('Tarring %s...' % tar_basename)\n os.system('tar cjf %s.tar.bz2 %s/*' % (tar_basename, install_dir))\n os.system('rm -rf %s' % install_dir)","target":"def repack(host, targets, channel='stable'):\n print(\"Repacking rust for %s...\" % host)\n url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'\n req = requests.get(url)\n req.raise_for_status()\n manifest = toml.loads(req.content)\n if manifest['manifest-version'] != '2':\n print('ERROR: unrecognized manifest version %s.' % manifest['manifest-version'])\n return\n print('Using manifest for rust %s as of %s.' % (channel, manifest['date']))\n rustc_version, rustc = package(manifest, 'rustc', host)\n if rustc['available']:\n print('rustc %s\\n %s\\n %s' % (rustc_version, rustc['url'], rustc['hash']))\n fetch(rustc['url'])\n cargo_version, cargo = package(manifest, 'cargo', host)\n if cargo['available']:\n print('cargo %s\\n %s\\n %s' % (cargo_version, cargo['url'], cargo['hash']))\n fetch(cargo['url'])\n stds = []\n for target in targets:\n version, info = package(manifest, 'rust-std', target)\n if info['available']:\n print('rust-std %s\\n %s\\n %s' % (version, info['url'], info['hash']))\n fetch(info['url'])\n stds.append(info)\n print('Installing packages...')\n tar_basename = 'rustc-%s-repack' % host\n install_dir = 'rustc'\n subprocess.check_call(['rm', '-rf', install_dir])\n install(os.path.basename(rustc['url']), install_dir)\n install(os.path.basename(cargo['url']), install_dir)\n for std in stds:\n install(os.path.basename(std['url']), install_dir)\n print('Tarring %s...' % tar_basename)\n subprocess.check_call(['tar', 'cjf', tar_basename + '.tar.bz2', install_dir])\n subprocess.check_call(['rm', '-rf', install_dir])","lang":"python","vul_type":"cwe-078","target_token_count":452,"sven_meta":{"func_name":"repack","file_name":"repack_rust.py","commit_link":"github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#75-ee319f181670","input":" def get_ports(self):\n # First get the active FC ports\n out = self._cli_run('showport', None)\n\n # strip out header\n # N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type,\n # Protocol,Label,Partner,FailoverState\n out = out[1:len(out) - 2]\n\n ports = {'FC': [], 'iSCSI': {}}\n for line in out:\n tmp = line.split(',')\n\n if tmp:\n if tmp[1] == 'target' and tmp[2] == 'ready':\n if tmp[6] == 'FC':\n ports['FC'].append(tmp[4])\n\n # now get the active iSCSI ports\n out = self._cli_run('showport -iscsi', None)\n\n # strip out header\n # N:S:P,State,IPAddr,Netmask,Gateway,\n # TPGT,MTU,Rate,DHCP,iSNS_Addr,iSNS_Port\n out = out[1:len(out) - 2]\n for line in out:\n tmp = line.split(',')\n\n if tmp and len(tmp) > 2:\n if tmp[1] == 'ready':\n ports['iSCSI'][tmp[2]] = {}\n\n # now get the nsp and iqn\n result = self._cli_run('showport -iscsiname', None)\n if result:\n # first line is header\n # nsp, ip,iqn\n result = result[1:]\n for line in result:\n info = line.split(\",\")\n if info and len(info) > 2:\n if info[1] in ports['iSCSI']:\n nsp = info[0]\n ip_addr = info[1]\n iqn = info[2]\n ports['iSCSI'][ip_addr] = {'nsp': nsp,\n 'iqn': iqn\n }\n\n LOG.debug(\"PORTS = %s\" % pprint.pformat(ports))\n return ports","target":" def get_ports(self):\n # First get the active FC ports\n out = self._cli_run(['showport'])\n\n # strip out header\n # N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type,\n # Protocol,Label,Partner,FailoverState\n out = out[1:len(out) - 2]\n\n ports = {'FC': [], 'iSCSI': {}}\n for line in out:\n tmp = line.split(',')\n\n if tmp:\n if tmp[1] == 'target' and tmp[2] == 'ready':\n if tmp[6] == 'FC':\n ports['FC'].append(tmp[4])\n\n # now get the active iSCSI ports\n out = self._cli_run(['showport', '-iscsi'])\n\n # strip out header\n # N:S:P,State,IPAddr,Netmask,Gateway,\n # TPGT,MTU,Rate,DHCP,iSNS_Addr,iSNS_Port\n out = out[1:len(out) - 2]\n for line in out:\n tmp = line.split(',')\n\n if tmp and len(tmp) > 2:\n if tmp[1] == 'ready':\n ports['iSCSI'][tmp[2]] = {}\n\n # now get the nsp and iqn\n result = self._cli_run(['showport', '-iscsiname'])\n if result:\n # first line is header\n # nsp, ip,iqn\n result = result[1:]\n for line in result:\n info = line.split(\",\")\n if info and len(info) > 2:\n if info[1] in ports['iSCSI']:\n nsp = info[0]\n ip_addr = info[1]\n iqn = info[2]\n ports['iSCSI'][ip_addr] = {'nsp': nsp,\n 'iqn': iqn\n }\n\n LOG.debug(\"PORTS = %s\" % pprint.pformat(ports))\n return ports","lang":"python","vul_type":"cwe-078","target_token_count":446,"sven_meta":{"func_name":"get_ports","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#76-bd3889ea8301","input":" def test_get_least_used_nsp(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_vlun_cmd = 'showvlun -a -showcols Port'\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n\n self.mox.ReplayAll()\n # in use count 11 12\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:8:1'])\n self.assertEqual(nsp, '0:2:1')\n\n # in use count 11 10\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:2:1'])\n self.assertEqual(nsp, '1:2:1')\n\n # in use count 0 10\n nsp = self.driver._get_least_used_nsp(['1:1:1', '1:2:1'])\n self.assertEqual(nsp, '1:1:1')","target":" def test_get_least_used_nsp(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_vlun_cmd = ['showvlun', '-a', '-showcols', 'Port']\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n\n self.mox.ReplayAll()\n # in use count 11 12\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:8:1'])\n self.assertEqual(nsp, '0:2:1')\n\n # in use count 11 10\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:2:1'])\n self.assertEqual(nsp, '1:2:1')\n\n # in use count 0 10\n nsp = self.driver._get_least_used_nsp(['1:1:1', '1:2:1'])\n self.assertEqual(nsp, '1:1:1')","lang":"python","vul_type":"cwe-078","target_token_count":340,"sven_meta":{"func_name":"test_get_least_used_nsp","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#77-2ae9f2223708","input":" def _cmd_to_dict(self, cmd):\n arg_list = cmd.split()\n no_param_args = [\n 'autodelete',\n 'autoexpand',\n 'bytes',\n 'compressed',\n 'force',\n 'nohdr',\n ]\n one_param_args = [\n 'chapsecret',\n 'cleanrate',\n 'copyrate',\n 'delim',\n 'filtervalue',\n 'grainsize',\n 'hbawwpn',\n 'host',\n 'iogrp',\n 'iscsiname',\n 'mdiskgrp',\n 'name',\n 'rsize',\n 'scsi',\n 'size',\n 'source',\n 'target',\n 'unit',\n 'easytier',\n 'warning',\n 'wwpn',\n ]\n\n # Handle the special case of lsnode which is a two-word command\n # Use the one word version of the command internally\n if arg_list[0] in ('svcinfo', 'svctask'):\n if arg_list[1] == 'lsnode':\n if len(arg_list) > 4: # e.g. svcinfo lsnode -delim ! \n ret = {'cmd': 'lsnode', 'node_id': arg_list[-1]}\n else:\n ret = {'cmd': 'lsnodecanister'}\n else:\n ret = {'cmd': arg_list[1]}\n arg_list.pop(0)\n else:\n ret = {'cmd': arg_list[0]}\n\n skip = False\n for i in range(1, len(arg_list)):\n if skip:\n skip = False\n continue\n if arg_list[i][0] == '-':\n if arg_list[i][1:] in no_param_args:\n ret[arg_list[i][1:]] = True\n elif arg_list[i][1:] in one_param_args:\n ret[arg_list[i][1:]] = arg_list[i + 1]\n skip = True\n else:\n raise exception.InvalidInput(\n reason=_('unrecognized argument %s') % arg_list[i])\n else:\n ret['obj'] = arg_list[i]\n return ret","target":" def _cmd_to_dict(self, arg_list):\n no_param_args = [\n 'autodelete',\n 'autoexpand',\n 'bytes',\n 'compressed',\n 'force',\n 'nohdr',\n ]\n one_param_args = [\n 'chapsecret',\n 'cleanrate',\n 'copyrate',\n 'delim',\n 'filtervalue',\n 'grainsize',\n 'hbawwpn',\n 'host',\n 'iogrp',\n 'iscsiname',\n 'mdiskgrp',\n 'name',\n 'rsize',\n 'scsi',\n 'size',\n 'source',\n 'target',\n 'unit',\n 'easytier',\n 'warning',\n 'wwpn',\n ]\n\n # Handle the special case of lsnode which is a two-word command\n # Use the one word version of the command internally\n if arg_list[0] in ('svcinfo', 'svctask'):\n if arg_list[1] == 'lsnode':\n if len(arg_list) > 4: # e.g. svcinfo lsnode -delim ! \n ret = {'cmd': 'lsnode', 'node_id': arg_list[-1]}\n else:\n ret = {'cmd': 'lsnodecanister'}\n else:\n ret = {'cmd': arg_list[1]}\n arg_list.pop(0)\n else:\n ret = {'cmd': arg_list[0]}\n\n skip = False\n for i in range(1, len(arg_list)):\n if skip:\n skip = False\n continue\n if arg_list[i][0] == '-':\n if arg_list[i][1:] in no_param_args:\n ret[arg_list[i][1:]] = True\n elif arg_list[i][1:] in one_param_args:\n ret[arg_list[i][1:]] = arg_list[i + 1]\n skip = True\n else:\n raise exception.InvalidInput(\n reason=_('unrecognized argument %s') % arg_list[i])\n else:\n ret['obj'] = arg_list[i]\n return ret","lang":"python","vul_type":"cwe-078","target_token_count":453,"sven_meta":{"func_name":"_cmd_to_dict","file_name":"cinder/tests/test_storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#80-1a5e15258113","input":" def _create_host(self, connector):\n \"\"\"Create a new host on the storage system.\n\n We create a host name and associate it with the given connection\n information.\n\n \"\"\"\n\n LOG.debug(_('enter: _create_host: host %s') % connector['host'])\n\n rand_id = str(random.randint(0, 99999999)).zfill(8)\n host_name = '%s-%s' % (self._connector_to_hostname_prefix(connector),\n rand_id)\n\n # Get all port information from the connector\n ports = []\n if 'initiator' in connector:\n ports.append('-iscsiname %s' % connector['initiator'])\n if 'wwpns' in connector:\n for wwpn in connector['wwpns']:\n ports.append('-hbawwpn %s' % wwpn)\n\n # When creating a host, we need one port\n self._driver_assert(len(ports), _('_create_host: No connector ports'))\n port1 = ports.pop(0)\n ssh_cmd = ('svctask mkhost -force %(port1)s -name \"%(host_name)s\"' %\n {'port1': port1, 'host_name': host_name})\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return('successfully created' in out,\n '_create_host', ssh_cmd, out, err)\n\n # Add any additional ports to the host\n for port in ports:\n ssh_cmd = ('svctask addhostport -force %s %s' % (port, host_name))\n out, err = self._run_ssh(ssh_cmd)\n\n LOG.debug(_('leave: _create_host: host %(host)s - %(host_name)s') %\n {'host': connector['host'], 'host_name': host_name})\n return host_name","target":" def _create_host(self, connector):\n \"\"\"Create a new host on the storage system.\n\n We create a host name and associate it with the given connection\n information.\n\n \"\"\"\n\n LOG.debug(_('enter: _create_host: host %s') % connector['host'])\n\n rand_id = str(random.randint(0, 99999999)).zfill(8)\n host_name = '%s-%s' % (self._connector_to_hostname_prefix(connector),\n rand_id)\n\n # Get all port information from the connector\n ports = []\n if 'initiator' in connector:\n ports.append('-iscsiname %s' % connector['initiator'])\n if 'wwpns' in connector:\n for wwpn in connector['wwpns']:\n ports.append('-hbawwpn %s' % wwpn)\n\n # When creating a host, we need one port\n self._driver_assert(len(ports), _('_create_host: No connector ports'))\n port1 = ports.pop(0)\n arg_name, arg_val = port1.split()\n ssh_cmd = ['svctask', 'mkhost', '-force', arg_name, arg_val, '-name',\n '\"%s\"' % host_name]\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return('successfully created' in out,\n '_create_host', ssh_cmd, out, err)\n\n # Add any additional ports to the host\n for port in ports:\n arg_name, arg_val = port.split()\n ssh_cmd = ['svctask', 'addhostport', '-force', arg_name, arg_val,\n host_name]\n out, err = self._run_ssh(ssh_cmd)\n\n LOG.debug(_('leave: _create_host: host %(host)s - %(host_name)s') %\n {'host': connector['host'], 'host_name': host_name})\n return host_name","lang":"python","vul_type":"cwe-078","target_token_count":412,"sven_meta":{"func_name":"_create_host","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#92-813e30256cf6","input":" def poll(self, poll_input):\n username = poll_input.credentials.username\n password = poll_input.credentials.password\n domain = poll_input.credentials.domain\n \n if domain is None:\n opt_str = '--ignore-certificate --authonly -u {} -p {} {}:{}'\n options = opt_str.format(\n username, password,\n poll_input.server, poll_input.port)\n else:\n opt_str = '--ignore-certificate --authonly -d {} -u {} -p {} {}:{}'\n options = opt_str.format(\n domain.domain, username, password,\n poll_input.server, poll_input.port)\n\n try:\n output = subprocess.check_output('timeout {} xfreerdp {}'.format(poll_input.timeout, options), shell=True, stderr=subprocess.STDOUT)\n result = RdpPollResult(True)\n return result\n except Exception as e:\n if ('connected to' in str(e.output) and 'Authentication failure' not in str(e.output)) or (e.returncode == 131 and 'negotiation' in str(e.output)):\n result = RdpPollResult(True)\n return result\n print(\"{{{{%s}}}}\" % e.output)\n result = RdpPollResult(False, e)\n return result","target":" def poll(self, poll_input):\n username = poll_input.credentials.username\n password = poll_input.credentials.password\n domain = poll_input.credentials.domain\n \n if domain is None:\n opt_str = '--ignore-certificate --authonly -u \\'{}\\' -p \\'{}\\' {}:{}'\n options = opt_str.format(\n username, password,\n poll_input.server, poll_input.port)\n else:\n opt_str = '--ignore-certificate --authonly -d {} -u \\'{}\\' -p \\'{}\\' {}:{}'\n options = opt_str.format(\n domain.domain, username, password,\n poll_input.server, poll_input.port)\n\n try:\n output = subprocess.check_output('timeout {} xfreerdp {}'.format(poll_input.timeout, options), shell=True, stderr=subprocess.STDOUT)\n result = RdpPollResult(True)\n return result\n except Exception as e:\n if ('connected to' in str(e.output) and 'Authentication failure' not in str(e.output)) or (e.returncode == 131 and 'negotiation' in str(e.output)):\n result = RdpPollResult(True)\n return result\n print(\"{{{{%s}}}}\" % e.output)\n result = RdpPollResult(False, e)\n return result","lang":"python","vul_type":"cwe-078","target_token_count":273,"sven_meta":{"func_name":"poll","file_name":"polling/poll_rdp.py","commit_link":"github.com/DSU-DefSecClub/ScoringEngine/commit/010eefe1ad416c0bdaa16fd59eca0dc8e3086a13","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#93-79813f98fa39","input":" def terminate_connection(self, volume, connector, **kwargs):\n \"\"\"Cleanup after an iSCSI connection has been terminated.\n\n When we clean up a terminated connection between a given connector\n and volume, we:\n 1. Translate the given connector to a host name\n 2. Remove the volume-to-host mapping if it exists\n 3. Delete the host if it has no more mappings (hosts are created\n automatically by this driver when mappings are created)\n \"\"\"\n LOG.debug(_('enter: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})\n\n vol_name = volume['name']\n host_name = self._get_host_from_connector(connector)\n # Verify that _get_host_from_connector returned the host.\n # This should always succeed as we terminate an existing connection.\n self._driver_assert(\n host_name is not None,\n _('_get_host_from_connector failed to return the host name '\n 'for connector'))\n\n # Check if vdisk-host mapping exists, remove if it does\n mapping_data = self._get_hostvdisk_mappings(host_name)\n if vol_name in mapping_data:\n ssh_cmd = 'svctask rmvdiskhostmap -host %s %s' % \\\n (host_name, vol_name)\n out, err = self._run_ssh(ssh_cmd)\n # Verify CLI behaviour - no output is returned from\n # rmvdiskhostmap\n self._assert_ssh_return(len(out.strip()) == 0,\n 'terminate_connection', ssh_cmd, out, err)\n del mapping_data[vol_name]\n else:\n LOG.error(_('terminate_connection: No mapping of volume '\n '%(vol_name)s to host %(host_name)s found') %\n {'vol_name': vol_name, 'host_name': host_name})\n\n # If this host has no more mappings, delete it\n if not mapping_data:\n self._delete_host(host_name)\n\n LOG.debug(_('leave: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})","target":" def terminate_connection(self, volume, connector, **kwargs):\n \"\"\"Cleanup after an iSCSI connection has been terminated.\n\n When we clean up a terminated connection between a given connector\n and volume, we:\n 1. Translate the given connector to a host name\n 2. Remove the volume-to-host mapping if it exists\n 3. Delete the host if it has no more mappings (hosts are created\n automatically by this driver when mappings are created)\n \"\"\"\n LOG.debug(_('enter: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})\n\n vol_name = volume['name']\n host_name = self._get_host_from_connector(connector)\n # Verify that _get_host_from_connector returned the host.\n # This should always succeed as we terminate an existing connection.\n self._driver_assert(\n host_name is not None,\n _('_get_host_from_connector failed to return the host name '\n 'for connector'))\n\n # Check if vdisk-host mapping exists, remove if it does\n mapping_data = self._get_hostvdisk_mappings(host_name)\n if vol_name in mapping_data:\n ssh_cmd = ['svctask', 'rmvdiskhostmap', '-host', host_name,\n vol_name]\n out, err = self._run_ssh(ssh_cmd)\n # Verify CLI behaviour - no output is returned from\n # rmvdiskhostmap\n self._assert_ssh_return(len(out.strip()) == 0,\n 'terminate_connection', ssh_cmd, out, err)\n del mapping_data[vol_name]\n else:\n LOG.error(_('terminate_connection: No mapping of volume '\n '%(vol_name)s to host %(host_name)s found') %\n {'vol_name': vol_name, 'host_name': host_name})\n\n # If this host has no more mappings, delete it\n if not mapping_data:\n self._delete_host(host_name)\n\n LOG.debug(_('leave: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})","lang":"python","vul_type":"cwe-078","target_token_count":458,"sven_meta":{"func_name":"terminate_connection","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-476#7-fdfc30cad0a1","input":"static ExprList *exprListAppendList(\n Parse *pParse, /* Parsing context */\n ExprList *pList, /* List to which to append. Might be NULL */\n ExprList *pAppend, /* List of values to append. Might be NULL */\n int bIntToNull\n){\n if( pAppend ){\n int i;\n int nInit = pList ? pList->nExpr : 0;\n for(i=0; inExpr; i++){\n Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0);\n if( bIntToNull && pDup && pDup->op==TK_INTEGER ){\n pDup->op = TK_NULL;\n pDup->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse);\n }\n pList = sqlite3ExprListAppend(pParse, pList, pDup);\n if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;\n }\n }\n return pList;\n}","target":"static ExprList *exprListAppendList(\n Parse *pParse, /* Parsing context */\n ExprList *pList, /* List to which to append. Might be NULL */\n ExprList *pAppend, /* List of values to append. Might be NULL */\n int bIntToNull\n){\n if( pAppend ){\n int i;\n int nInit = pList ? pList->nExpr : 0;\n for(i=0; inExpr; i++){\n Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0);\n assert( pDup==0 || !ExprHasProperty(pDup, EP_MemToken) );\n if( bIntToNull && pDup && pDup->op==TK_INTEGER ){\n pDup->op = TK_NULL;\n pDup->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse);\n pDup->u.zToken = 0;\n }\n pList = sqlite3ExprListAppend(pParse, pList, pDup);\n if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;\n }\n }\n return pList;\n}","lang":"c","vul_type":"cwe-476","target_token_count":270,"sven_meta":{"func_name":"exprListAppendList","file_name":"src/window.c","commit_link":"github.com/sqlite/sqlite/commit/75e95e1fcd52d3ec8282edb75ac8cd0814095d54","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#11-547124a10526","input":"static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len)\n{\n\tstruct sockaddr_rc *sa = (struct sockaddr_rc *) addr;\n\tstruct sock *sk = sock->sk;\n\tint chan = sa->rc_channel;\n\tint err = 0;\n\n\tBT_DBG(\"sk %p %pMR\", sk, &sa->rc_bdaddr);\n\n\tif (!addr || addr->sa_family != AF_BLUETOOTH)\n\t\treturn -EINVAL;\n\n\tlock_sock(sk);\n\n\tif (sk->sk_state != BT_OPEN) {\n\t\terr = -EBADFD;\n\t\tgoto done;\n\t}\n\n\tif (sk->sk_type != SOCK_STREAM) {\n\t\terr = -EINVAL;\n\t\tgoto done;\n\t}\n\n\twrite_lock(&rfcomm_sk_list.lock);\n\n\tif (chan && __rfcomm_get_listen_sock_by_addr(chan, &sa->rc_bdaddr)) {\n\t\terr = -EADDRINUSE;\n\t} else {\n\t\t/* Save source address */\n\t\tbacpy(&rfcomm_pi(sk)->src, &sa->rc_bdaddr);\n\t\trfcomm_pi(sk)->channel = chan;\n\t\tsk->sk_state = BT_BOUND;\n\t}\n\n\twrite_unlock(&rfcomm_sk_list.lock);\n\ndone:\n\trelease_sock(sk);\n\treturn err;\n}","target":"static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len)\n{\n\tstruct sockaddr_rc sa;\n\tstruct sock *sk = sock->sk;\n\tint len, err = 0;\n\n\tif (!addr || addr->sa_family != AF_BLUETOOTH)\n\t\treturn -EINVAL;\n\n\tmemset(&sa, 0, sizeof(sa));\n\tlen = min_t(unsigned int, sizeof(sa), addr_len);\n\tmemcpy(&sa, addr, len);\n\n\tBT_DBG(\"sk %p %pMR\", sk, &sa.rc_bdaddr);\n\n\tlock_sock(sk);\n\n\tif (sk->sk_state != BT_OPEN) {\n\t\terr = -EBADFD;\n\t\tgoto done;\n\t}\n\n\tif (sk->sk_type != SOCK_STREAM) {\n\t\terr = -EINVAL;\n\t\tgoto done;\n\t}\n\n\twrite_lock(&rfcomm_sk_list.lock);\n\n\tif (sa.rc_channel &&\n\t __rfcomm_get_listen_sock_by_addr(sa.rc_channel, &sa.rc_bdaddr)) {\n\t\terr = -EADDRINUSE;\n\t} else {\n\t\t/* Save source address */\n\t\tbacpy(&rfcomm_pi(sk)->src, &sa.rc_bdaddr);\n\t\trfcomm_pi(sk)->channel = sa.rc_channel;\n\t\tsk->sk_state = BT_BOUND;\n\t}\n\n\twrite_unlock(&rfcomm_sk_list.lock);\n\ndone:\n\trelease_sock(sk);\n\treturn err;\n}","lang":"c","vul_type":"cwe-476","target_token_count":283,"sven_meta":{"func_name":"rfcomm_sock_bind","file_name":"net/bluetooth/rfcomm/sock.c","commit_link":"github.com/torvalds/linux/commit/951b6a0717db97ce420547222647bcc40bf1eacd","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#12-61e61d4c1262","input":"AP4_HdlrAtom::AP4_HdlrAtom(AP4_UI32 size, \n AP4_UI08 version,\n AP4_UI32 flags,\n AP4_ByteStream& stream) :\n AP4_Atom(AP4_ATOM_TYPE_HDLR, size, version, flags)\n{\n AP4_UI32 predefined;\n stream.ReadUI32(predefined);\n stream.ReadUI32(m_HandlerType);\n stream.ReadUI32(m_Reserved[0]);\n stream.ReadUI32(m_Reserved[1]);\n stream.ReadUI32(m_Reserved[2]);\n \n // read the name unless it is empty\n int name_size = size-(AP4_FULL_ATOM_HEADER_SIZE+20);\n if (name_size == 0) return;\n char* name = new char[name_size+1];\n stream.Read(name, name_size);\n name[name_size] = '\\0'; // force a null termination\n // handle a special case: the Quicktime files have a pascal\n // string here, but ISO MP4 files have a C string.\n // we try to detect a pascal encoding and correct it.\n if (name[0] == name_size-1) {\n m_HandlerName = name+1;\n } else {\n m_HandlerName = name;\n }\n delete[] name;\n}","target":"AP4_HdlrAtom::AP4_HdlrAtom(AP4_UI32 size, \n AP4_UI08 version,\n AP4_UI32 flags,\n AP4_ByteStream& stream) :\n AP4_Atom(AP4_ATOM_TYPE_HDLR, size, version, flags)\n{\n AP4_UI32 predefined;\n stream.ReadUI32(predefined);\n stream.ReadUI32(m_HandlerType);\n stream.ReadUI32(m_Reserved[0]);\n stream.ReadUI32(m_Reserved[1]);\n stream.ReadUI32(m_Reserved[2]);\n \n // read the name unless it is empty\n if (size < AP4_FULL_ATOM_HEADER_SIZE+20) return;\n AP4_UI32 name_size = size-(AP4_FULL_ATOM_HEADER_SIZE+20);\n char* name = new char[name_size+1];\n if (name == NULL) return;\n stream.Read(name, name_size);\n name[name_size] = '\\0'; // force a null termination\n // handle a special case: the Quicktime files have a pascal\n // string here, but ISO MP4 files have a C string.\n // we try to detect a pascal encoding and correct it.\n if (name[0] == name_size-1) {\n m_HandlerName = name+1;\n } else {\n m_HandlerName = name;\n }\n delete[] name;\n}","lang":"cpp","vul_type":"cwe-476","target_token_count":313,"sven_meta":{"func_name":"AP4_HdlrAtom::AP4_HdlrAtom","file_name":"Source/C++/Core/Ap4HdlrAtom.cpp","commit_link":"github.com/axiomatic-systems/Bento4/commit/22192de5367fa0cee985917f092be4060b7c00b0","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#13-22d39ffa165c","input":"generatePreview (const char inFileName[],\n\t\t float exposure,\n\t\t int previewWidth,\n\t\t int &previewHeight,\n\t\t Array2D &previewPixels)\n{\n //\n // Read the input file\n //\n\n RgbaInputFile in (inFileName);\n\n Box2i dw = in.dataWindow();\n float a = in.pixelAspectRatio();\n int w = dw.max.x - dw.min.x + 1;\n int h = dw.max.y - dw.min.y + 1;\n\n Array2D pixels (h, w);\n in.setFrameBuffer (ComputeBasePointer (&pixels[0][0], dw), 1, w);\n in.readPixels (dw.min.y, dw.max.y);\n\n //\n // Make a preview image\n //\n\n previewHeight = max (int (h / (w * a) * previewWidth + .5f), 1);\n previewPixels.resizeErase (previewHeight, previewWidth);\n\n float fx = (previewWidth > 0)? (float (w - 1) / (previewWidth - 1)): 1;\n float fy = (previewHeight > 0)? (float (h - 1) / (previewHeight - 1)): 1;\n float m = Math::pow (2.f, IMATH_NAMESPACE::clamp (exposure + 2.47393f, -20.f, 20.f));\n\n for (int y = 0; y < previewHeight; ++y)\n {\n\tfor (int x = 0; x < previewWidth; ++x)\n\t{\n\t PreviewRgba &preview = previewPixels[y][x];\n\t const Rgba &pixel = pixels[int (y * fy + .5f)][int (x * fx + .5f)];\n\n\t preview.r = gamma (pixel.r, m);\n\t preview.g = gamma (pixel.g, m);\n\t preview.b = gamma (pixel.b, m);\n\t preview.a = int (IMATH_NAMESPACE::clamp (pixel.a * 255.f, 0.f, 255.f) + .5f);\n\t}\n }\n}","target":"generatePreview (const char inFileName[],\n\t\t float exposure,\n\t\t int previewWidth,\n\t\t int &previewHeight,\n\t\t Array2D &previewPixels)\n{\n //\n // Read the input file\n //\n\n RgbaInputFile in (inFileName);\n\n Box2i dw = in.dataWindow();\n float a = in.pixelAspectRatio();\n int w = dw.max.x - dw.min.x + 1;\n int h = dw.max.y - dw.min.y + 1;\n\n Array2D pixels (h, w);\n in.setFrameBuffer (ComputeBasePointer (&pixels[0][0], dw), 1, w);\n in.readPixels (dw.min.y, dw.max.y);\n\n //\n // Make a preview image\n //\n\n previewHeight = max (int (h / (w * a) * previewWidth + .5f), 1);\n previewPixels.resizeErase (previewHeight, previewWidth);\n\n float fx = (previewWidth > 1)? (float (w - 1) / (previewWidth - 1)): 1;\n float fy = (previewHeight > 1)? (float (h - 1) / (previewHeight - 1)): 1;\n float m = Math::pow (2.f, IMATH_NAMESPACE::clamp (exposure + 2.47393f, -20.f, 20.f));\n\n for (int y = 0; y < previewHeight; ++y)\n {\n\tfor (int x = 0; x < previewWidth; ++x)\n\t{\n\t PreviewRgba &preview = previewPixels[y][x];\n\t const Rgba &pixel = pixels[int (y * fy + .5f)][int (x * fx + .5f)];\n\n\t preview.r = gamma (pixel.r, m);\n\t preview.g = gamma (pixel.g, m);\n\t preview.b = gamma (pixel.b, m);\n\t preview.a = int (IMATH_NAMESPACE::clamp (pixel.a * 255.f, 0.f, 255.f) + .5f);\n\t}\n }\n}","lang":"cpp","vul_type":"cwe-476","target_token_count":462,"sven_meta":{"func_name":"generatePreview","file_name":"OpenEXR/exrmakepreview/makePreview.cpp","commit_link":"github.com/AcademySoftwareFoundation/openexr/commit/74504503cff86e986bac441213c403b0ba28d58f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#21-acf22b5978a8","input":"static int unimac_mdio_probe(struct platform_device *pdev)\n{\n\tstruct unimac_mdio_pdata *pdata = pdev->dev.platform_data;\n\tstruct unimac_mdio_priv *priv;\n\tstruct device_node *np;\n\tstruct mii_bus *bus;\n\tstruct resource *r;\n\tint ret;\n\n\tnp = pdev->dev.of_node;\n\n\tpriv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);\n\tif (!priv)\n\t\treturn -ENOMEM;\n\n\tr = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n\n\t/* Just ioremap, as this MDIO block is usually integrated into an\n\t * Ethernet MAC controller register range\n\t */\n\tpriv->base = devm_ioremap(&pdev->dev, r->start, resource_size(r));\n\tif (!priv->base) {\n\t\tdev_err(&pdev->dev, \"failed to remap register\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tpriv->mii_bus = mdiobus_alloc();\n\tif (!priv->mii_bus)\n\t\treturn -ENOMEM;\n\n\tbus = priv->mii_bus;\n\tbus->priv = priv;\n\tif (pdata) {\n\t\tbus->name = pdata->bus_name;\n\t\tpriv->wait_func = pdata->wait_func;\n\t\tpriv->wait_func_data = pdata->wait_func_data;\n\t\tbus->phy_mask = ~pdata->phy_mask;\n\t} else {\n\t\tbus->name = \"unimac MII bus\";\n\t\tpriv->wait_func_data = priv;\n\t\tpriv->wait_func = unimac_mdio_poll;\n\t}\n\tbus->parent = &pdev->dev;\n\tbus->read = unimac_mdio_read;\n\tbus->write = unimac_mdio_write;\n\tbus->reset = unimac_mdio_reset;\n\tsnprintf(bus->id, MII_BUS_ID_SIZE, \"%s-%d\", pdev->name, pdev->id);\n\n\tret = of_mdiobus_register(bus, np);\n\tif (ret) {\n\t\tdev_err(&pdev->dev, \"MDIO bus registration failed\\n\");\n\t\tgoto out_mdio_free;\n\t}\n\n\tplatform_set_drvdata(pdev, priv);\n\n\tdev_info(&pdev->dev, \"Broadcom UniMAC MDIO bus at 0x%p\\n\", priv->base);\n\n\treturn 0;\n\nout_mdio_free:\n\tmdiobus_free(bus);\n\treturn ret;\n}","target":"static int unimac_mdio_probe(struct platform_device *pdev)\n{\n\tstruct unimac_mdio_pdata *pdata = pdev->dev.platform_data;\n\tstruct unimac_mdio_priv *priv;\n\tstruct device_node *np;\n\tstruct mii_bus *bus;\n\tstruct resource *r;\n\tint ret;\n\n\tnp = pdev->dev.of_node;\n\n\tpriv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);\n\tif (!priv)\n\t\treturn -ENOMEM;\n\n\tr = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n\tif (!r)\n\t\treturn -EINVAL;\n\n\t/* Just ioremap, as this MDIO block is usually integrated into an\n\t * Ethernet MAC controller register range\n\t */\n\tpriv->base = devm_ioremap(&pdev->dev, r->start, resource_size(r));\n\tif (!priv->base) {\n\t\tdev_err(&pdev->dev, \"failed to remap register\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tpriv->mii_bus = mdiobus_alloc();\n\tif (!priv->mii_bus)\n\t\treturn -ENOMEM;\n\n\tbus = priv->mii_bus;\n\tbus->priv = priv;\n\tif (pdata) {\n\t\tbus->name = pdata->bus_name;\n\t\tpriv->wait_func = pdata->wait_func;\n\t\tpriv->wait_func_data = pdata->wait_func_data;\n\t\tbus->phy_mask = ~pdata->phy_mask;\n\t} else {\n\t\tbus->name = \"unimac MII bus\";\n\t\tpriv->wait_func_data = priv;\n\t\tpriv->wait_func = unimac_mdio_poll;\n\t}\n\tbus->parent = &pdev->dev;\n\tbus->read = unimac_mdio_read;\n\tbus->write = unimac_mdio_write;\n\tbus->reset = unimac_mdio_reset;\n\tsnprintf(bus->id, MII_BUS_ID_SIZE, \"%s-%d\", pdev->name, pdev->id);\n\n\tret = of_mdiobus_register(bus, np);\n\tif (ret) {\n\t\tdev_err(&pdev->dev, \"MDIO bus registration failed\\n\");\n\t\tgoto out_mdio_free;\n\t}\n\n\tplatform_set_drvdata(pdev, priv);\n\n\tdev_info(&pdev->dev, \"Broadcom UniMAC MDIO bus at 0x%p\\n\", priv->base);\n\n\treturn 0;\n\nout_mdio_free:\n\tmdiobus_free(bus);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-476","target_token_count":499,"sven_meta":{"func_name":"unimac_mdio_probe","file_name":"drivers/net/phy/mdio-bcm-unimac.c","commit_link":"github.com/torvalds/linux/commit/297a6961ffb8ff4dc66c9fbf53b924bd1dda05d5","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#22-65f43e486823","input":"static int hi3660_stub_clk_probe(struct platform_device *pdev)\n{\n\tstruct device *dev = &pdev->dev;\n\tstruct resource *res;\n\tunsigned int i;\n\tint ret;\n\n\t/* Use mailbox client without blocking */\n\tstub_clk_chan.cl.dev = dev;\n\tstub_clk_chan.cl.tx_done = NULL;\n\tstub_clk_chan.cl.tx_block = false;\n\tstub_clk_chan.cl.knows_txdone = false;\n\n\t/* Allocate mailbox channel */\n\tstub_clk_chan.mbox = mbox_request_channel(&stub_clk_chan.cl, 0);\n\tif (IS_ERR(stub_clk_chan.mbox))\n\t\treturn PTR_ERR(stub_clk_chan.mbox);\n\n\tres = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n\tfreq_reg = devm_ioremap(dev, res->start, resource_size(res));\n\tif (!freq_reg)\n\t\treturn -ENOMEM;\n\n\tfreq_reg += HI3660_STUB_CLOCK_DATA;\n\n\tfor (i = 0; i < HI3660_CLK_STUB_NUM; i++) {\n\t\tret = devm_clk_hw_register(&pdev->dev, &hi3660_stub_clks[i].hw);\n\t\tif (ret)\n\t\t\treturn ret;\n\t}\n\n\treturn devm_of_clk_add_hw_provider(&pdev->dev, hi3660_stub_clk_hw_get,\n\t\t\t\t\t hi3660_stub_clks);\n}","target":"static int hi3660_stub_clk_probe(struct platform_device *pdev)\n{\n\tstruct device *dev = &pdev->dev;\n\tstruct resource *res;\n\tunsigned int i;\n\tint ret;\n\n\t/* Use mailbox client without blocking */\n\tstub_clk_chan.cl.dev = dev;\n\tstub_clk_chan.cl.tx_done = NULL;\n\tstub_clk_chan.cl.tx_block = false;\n\tstub_clk_chan.cl.knows_txdone = false;\n\n\t/* Allocate mailbox channel */\n\tstub_clk_chan.mbox = mbox_request_channel(&stub_clk_chan.cl, 0);\n\tif (IS_ERR(stub_clk_chan.mbox))\n\t\treturn PTR_ERR(stub_clk_chan.mbox);\n\n\tres = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n\tif (!res)\n\t\treturn -EINVAL;\n\tfreq_reg = devm_ioremap(dev, res->start, resource_size(res));\n\tif (!freq_reg)\n\t\treturn -ENOMEM;\n\n\tfreq_reg += HI3660_STUB_CLOCK_DATA;\n\n\tfor (i = 0; i < HI3660_CLK_STUB_NUM; i++) {\n\t\tret = devm_clk_hw_register(&pdev->dev, &hi3660_stub_clks[i].hw);\n\t\tif (ret)\n\t\t\treturn ret;\n\t}\n\n\treturn devm_of_clk_add_hw_provider(&pdev->dev, hi3660_stub_clk_hw_get,\n\t\t\t\t\t hi3660_stub_clks);\n}","lang":"c","vul_type":"cwe-476","target_token_count":297,"sven_meta":{"func_name":"hi3660_stub_clk_probe","file_name":"drivers/clk/hisilicon/clk-hi3660-stub.c","commit_link":"github.com/torvalds/linux/commit/9903e41ae1f5d50c93f268ca3304d4d7c64b9311","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#24-3089607ddcee","input":"void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)\n{\n\tstruct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);\n\tbool prepare = (inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) ||\n\t\t ipv6_sk_rxinfo(sk);\n\n\tif (prepare && skb_rtable(skb)) {\n\t\t/* skb->cb is overloaded: prior to this point it is IP{6}CB\n\t\t * which has interface index (iif) as the first member of the\n\t\t * underlying inet{6}_skb_parm struct. This code then overlays\n\t\t * PKTINFO_SKB_CB and in_pktinfo also has iif as the first\n\t\t * element so the iif is picked up from the prior IPCB. If iif\n\t\t * is the loopback interface, then return the sending interface\n\t\t * (e.g., process binds socket to eth0 for Tx which is\n\t\t * redirected to loopback in the rtable/dst).\n\t\t */\n\t\tif (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)\n\t\t\tpktinfo->ipi_ifindex = inet_iif(skb);\n\n\t\tpktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);\n\t} else {\n\t\tpktinfo->ipi_ifindex = 0;\n\t\tpktinfo->ipi_spec_dst.s_addr = 0;\n\t}\n\tskb_dst_drop(skb);\n}","target":"void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)\n{\n\tstruct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);\n\tbool prepare = (inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) ||\n\t\t ipv6_sk_rxinfo(sk);\n\n\tif (prepare && skb_rtable(skb)) {\n\t\t/* skb->cb is overloaded: prior to this point it is IP{6}CB\n\t\t * which has interface index (iif) as the first member of the\n\t\t * underlying inet{6}_skb_parm struct. This code then overlays\n\t\t * PKTINFO_SKB_CB and in_pktinfo also has iif as the first\n\t\t * element so the iif is picked up from the prior IPCB. If iif\n\t\t * is the loopback interface, then return the sending interface\n\t\t * (e.g., process binds socket to eth0 for Tx which is\n\t\t * redirected to loopback in the rtable/dst).\n\t\t */\n\t\tif (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)\n\t\t\tpktinfo->ipi_ifindex = inet_iif(skb);\n\n\t\tpktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);\n\t} else {\n\t\tpktinfo->ipi_ifindex = 0;\n\t\tpktinfo->ipi_spec_dst.s_addr = 0;\n\t}\n\t/* We need to keep the dst for __ip_options_echo()\n\t * We could restrict the test to opt.ts_needtime || opt.srr,\n\t * but the following is good enough as IP options are not often used.\n\t */\n\tif (unlikely(IPCB(skb)->opt.optlen))\n\t\tskb_dst_force(skb);\n\telse\n\t\tskb_dst_drop(skb);\n}","lang":"c","vul_type":"cwe-476","target_token_count":367,"sven_meta":{"func_name":"ipv4_pktinfo_prepare","file_name":"net/ipv4/ip_sockglue.c","commit_link":"github.com/torvalds/linux/commit/34b2cef20f19c87999fff3da4071e66937db9644","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#29-fdedee012c88","input":"static int mpeg4video_probe(AVProbeData *probe_packet)\n{\n uint32_t temp_buffer = -1;\n int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0;\n int i;\n\n for (i = 0; i < probe_packet->buf_size; i++) {\n temp_buffer = (temp_buffer << 8) + probe_packet->buf[i];\n if ((temp_buffer & 0xffffff00) != 0x100)\n continue;\n\n if (temp_buffer == VOP_START_CODE)\n VOP++;\n else if (temp_buffer == VISUAL_OBJECT_START_CODE)\n VISO++;\n else if (temp_buffer < 0x120)\n VO++;\n else if (temp_buffer < 0x130)\n VOL++;\n else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) &&\n !(0x1B9 < temp_buffer && temp_buffer < 0x1C4))\n res++;\n }\n\n if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res == 0)\n return AVPROBE_SCORE_EXTENSION;\n return 0;\n}","target":"static int mpeg4video_probe(AVProbeData *probe_packet)\n{\n uint32_t temp_buffer = -1;\n int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0;\n int i;\n\n for (i = 0; i < probe_packet->buf_size; i++) {\n temp_buffer = (temp_buffer << 8) + probe_packet->buf[i];\n if (temp_buffer & 0xfffffe00)\n continue;\n if (temp_buffer < 2)\n continue;\n\n if (temp_buffer == VOP_START_CODE)\n VOP++;\n else if (temp_buffer == VISUAL_OBJECT_START_CODE)\n VISO++;\n else if (temp_buffer >= 0x100 && temp_buffer < 0x120)\n VO++;\n else if (temp_buffer >= 0x120 && temp_buffer < 0x130)\n VOL++;\n else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) &&\n !(0x1B9 < temp_buffer && temp_buffer < 0x1C4))\n res++;\n }\n\n if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res == 0)\n return AVPROBE_SCORE_EXTENSION;\n return 0;\n}","lang":"c","vul_type":"cwe-476","target_token_count":302,"sven_meta":{"func_name":"mpeg4video_probe","file_name":"libavformat/m4vdec.c","commit_link":"github.com/libav/libav/commit/e5b019725f53b79159931d3a7317107cbbfd0860","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#30-0faa609ba58a","input":"int megasas_alloc_cmds(struct megasas_instance *instance)\n{\n\tint i;\n\tint j;\n\tu16 max_cmd;\n\tstruct megasas_cmd *cmd;\n\n\tmax_cmd = instance->max_mfi_cmds;\n\n\t/*\n\t * instance->cmd_list is an array of struct megasas_cmd pointers.\n\t * Allocate the dynamic array first and then allocate individual\n\t * commands.\n\t */\n\tinstance->cmd_list = kcalloc(max_cmd, sizeof(struct megasas_cmd*), GFP_KERNEL);\n\n\tif (!instance->cmd_list) {\n\t\tdev_printk(KERN_DEBUG, &instance->pdev->dev, \"out of memory\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tmemset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) *max_cmd);\n\n\tfor (i = 0; i < max_cmd; i++) {\n\t\tinstance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd),\n\t\t\t\t\t\tGFP_KERNEL);\n\n\t\tif (!instance->cmd_list[i]) {\n\n\t\t\tfor (j = 0; j < i; j++)\n\t\t\t\tkfree(instance->cmd_list[j]);\n\n\t\t\tkfree(instance->cmd_list);\n\t\t\tinstance->cmd_list = NULL;\n\n\t\t\treturn -ENOMEM;\n\t\t}\n\t}\n\n\tfor (i = 0; i < max_cmd; i++) {\n\t\tcmd = instance->cmd_list[i];\n\t\tmemset(cmd, 0, sizeof(struct megasas_cmd));\n\t\tcmd->index = i;\n\t\tcmd->scmd = NULL;\n\t\tcmd->instance = instance;\n\n\t\tlist_add_tail(&cmd->list, &instance->cmd_pool);\n\t}\n\n\t/*\n\t * Create a frame pool and assign one frame to each cmd\n\t */\n\tif (megasas_create_frame_pool(instance)) {\n\t\tdev_printk(KERN_DEBUG, &instance->pdev->dev, \"Error creating frame DMA pool\\n\");\n\t\tmegasas_free_cmds(instance);\n\t}\n\n\treturn 0;\n}","target":"int megasas_alloc_cmds(struct megasas_instance *instance)\n{\n\tint i;\n\tint j;\n\tu16 max_cmd;\n\tstruct megasas_cmd *cmd;\n\n\tmax_cmd = instance->max_mfi_cmds;\n\n\t/*\n\t * instance->cmd_list is an array of struct megasas_cmd pointers.\n\t * Allocate the dynamic array first and then allocate individual\n\t * commands.\n\t */\n\tinstance->cmd_list = kcalloc(max_cmd, sizeof(struct megasas_cmd*), GFP_KERNEL);\n\n\tif (!instance->cmd_list) {\n\t\tdev_printk(KERN_DEBUG, &instance->pdev->dev, \"out of memory\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tmemset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) *max_cmd);\n\n\tfor (i = 0; i < max_cmd; i++) {\n\t\tinstance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd),\n\t\t\t\t\t\tGFP_KERNEL);\n\n\t\tif (!instance->cmd_list[i]) {\n\n\t\t\tfor (j = 0; j < i; j++)\n\t\t\t\tkfree(instance->cmd_list[j]);\n\n\t\t\tkfree(instance->cmd_list);\n\t\t\tinstance->cmd_list = NULL;\n\n\t\t\treturn -ENOMEM;\n\t\t}\n\t}\n\n\tfor (i = 0; i < max_cmd; i++) {\n\t\tcmd = instance->cmd_list[i];\n\t\tmemset(cmd, 0, sizeof(struct megasas_cmd));\n\t\tcmd->index = i;\n\t\tcmd->scmd = NULL;\n\t\tcmd->instance = instance;\n\n\t\tlist_add_tail(&cmd->list, &instance->cmd_pool);\n\t}\n\n\t/*\n\t * Create a frame pool and assign one frame to each cmd\n\t */\n\tif (megasas_create_frame_pool(instance)) {\n\t\tdev_printk(KERN_DEBUG, &instance->pdev->dev, \"Error creating frame DMA pool\\n\");\n\t\tmegasas_free_cmds(instance);\n\t\treturn -ENOMEM;\n\t}\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-476","target_token_count":400,"sven_meta":{"func_name":"megasas_alloc_cmds","file_name":"drivers/scsi/megaraid/megaraid_sas_base.c","commit_link":"github.com/torvalds/linux/commit/bcf3b67d16a4c8ffae0aa79de5853435e683945c","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#33-ca73e800b7fb","input":"lys_restr_dup(struct lys_module *mod, struct lys_restr *old, int size, int shallow, struct unres_schema *unres)\n{\n struct lys_restr *result;\n int i;\n\n if (!size) {\n return NULL;\n }\n\n result = calloc(size, sizeof *result);\n LY_CHECK_ERR_RETURN(!result, LOGMEM(mod->ctx), NULL);\n\n for (i = 0; i < size; i++) {\n result[i].ext_size = old[i].ext_size;\n lys_ext_dup(mod->ctx, mod, old[i].ext, old[i].ext_size, &result[i], LYEXT_PAR_RESTR, &result[i].ext, shallow, unres);\n result[i].expr = lydict_insert(mod->ctx, old[i].expr, 0);\n result[i].dsc = lydict_insert(mod->ctx, old[i].dsc, 0);\n result[i].ref = lydict_insert(mod->ctx, old[i].ref, 0);\n result[i].eapptag = lydict_insert(mod->ctx, old[i].eapptag, 0);\n result[i].emsg = lydict_insert(mod->ctx, old[i].emsg, 0);\n }\n\n return result;\n}","target":"lys_restr_dup(struct lys_module *mod, struct lys_restr *old, int size, int shallow, struct unres_schema *unres)\n{\n struct lys_restr *result;\n int i;\n\n if (!size) {\n return NULL;\n }\n\n result = calloc(size, sizeof *result);\n LY_CHECK_ERR_RETURN(!result, LOGMEM(mod->ctx), NULL);\n\n for (i = 0; i < size; i++) {\n /* copying unresolved extensions is not supported */\n if (unres_schema_find(unres, -1, (void *)&old[i].ext, UNRES_EXT) == -1) {\n result[i].ext_size = old[i].ext_size;\n lys_ext_dup(mod->ctx, mod, old[i].ext, old[i].ext_size, &result[i], LYEXT_PAR_RESTR, &result[i].ext, shallow, unres);\n }\n result[i].expr = lydict_insert(mod->ctx, old[i].expr, 0);\n result[i].dsc = lydict_insert(mod->ctx, old[i].dsc, 0);\n result[i].ref = lydict_insert(mod->ctx, old[i].ref, 0);\n result[i].eapptag = lydict_insert(mod->ctx, old[i].eapptag, 0);\n result[i].emsg = lydict_insert(mod->ctx, old[i].emsg, 0);\n }\n\n return result;\n}","lang":"c","vul_type":"cwe-476","target_token_count":315,"sven_meta":{"func_name":"lys_restr_dup","file_name":"src/tree_schema.c","commit_link":"github.com/CESNET/libyang/commit/7852b272ef77f8098c35deea6c6f09cb78176f08","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#48-61c457b51706","input":"long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)\n{\n\tstruct key *key;\n\tkey_ref_t key_ref;\n\tlong ret;\n\n\t/* find the key first */\n\tkey_ref = lookup_user_key(keyid, 0, 0);\n\tif (IS_ERR(key_ref)) {\n\t\tret = -ENOKEY;\n\t\tgoto error;\n\t}\n\n\tkey = key_ref_to_ptr(key_ref);\n\n\t/* see if we can read it directly */\n\tret = key_permission(key_ref, KEY_NEED_READ);\n\tif (ret == 0)\n\t\tgoto can_read_key;\n\tif (ret != -EACCES)\n\t\tgoto error2;\n\n\t/* we can't; see if it's searchable from this process's keyrings\n\t * - we automatically take account of the fact that it may be\n\t * dangling off an instantiation key\n\t */\n\tif (!is_key_possessed(key_ref)) {\n\t\tret = -EACCES;\n\t\tgoto error2;\n\t}\n\n\t/* the key is probably readable - now try to read it */\ncan_read_key:\n\tret = -EOPNOTSUPP;\n\tif (key->type->read) {\n\t\t/* Read the data with the semaphore held (since we might sleep)\n\t\t * to protect against the key being updated or revoked.\n\t\t */\n\t\tdown_read(&key->sem);\n\t\tret = key_validate(key);\n\t\tif (ret == 0)\n\t\t\tret = key->type->read(key, buffer, buflen);\n\t\tup_read(&key->sem);\n\t}\n\nerror2:\n\tkey_put(key);\nerror:\n\treturn ret;\n}","target":"long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)\n{\n\tstruct key *key;\n\tkey_ref_t key_ref;\n\tlong ret;\n\n\t/* find the key first */\n\tkey_ref = lookup_user_key(keyid, 0, 0);\n\tif (IS_ERR(key_ref)) {\n\t\tret = -ENOKEY;\n\t\tgoto error;\n\t}\n\n\tkey = key_ref_to_ptr(key_ref);\n\n\tif (test_bit(KEY_FLAG_NEGATIVE, &key->flags)) {\n\t\tret = -ENOKEY;\n\t\tgoto error2;\n\t}\n\n\t/* see if we can read it directly */\n\tret = key_permission(key_ref, KEY_NEED_READ);\n\tif (ret == 0)\n\t\tgoto can_read_key;\n\tif (ret != -EACCES)\n\t\tgoto error2;\n\n\t/* we can't; see if it's searchable from this process's keyrings\n\t * - we automatically take account of the fact that it may be\n\t * dangling off an instantiation key\n\t */\n\tif (!is_key_possessed(key_ref)) {\n\t\tret = -EACCES;\n\t\tgoto error2;\n\t}\n\n\t/* the key is probably readable - now try to read it */\ncan_read_key:\n\tret = -EOPNOTSUPP;\n\tif (key->type->read) {\n\t\t/* Read the data with the semaphore held (since we might sleep)\n\t\t * to protect against the key being updated or revoked.\n\t\t */\n\t\tdown_read(&key->sem);\n\t\tret = key_validate(key);\n\t\tif (ret == 0)\n\t\t\tret = key->type->read(key, buffer, buflen);\n\t\tup_read(&key->sem);\n\t}\n\nerror2:\n\tkey_put(key);\nerror:\n\treturn ret;\n}","lang":"c","vul_type":"cwe-476","target_token_count":363,"sven_meta":{"func_name":"keyctl_read_key","file_name":"security/keys/keyctl.c","commit_link":"github.com/torvalds/linux/commit/37863c43b2c6464f252862bf2e9768264e961678","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#49-d65a5d8c68df","input":"ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr,\n const char **elem_rtrn, const char **field_rtrn,\n ExprDef **index_rtrn)\n{\n switch (expr->expr.op) {\n case EXPR_IDENT:\n *elem_rtrn = NULL;\n *field_rtrn = xkb_atom_text(ctx, expr->ident.ident);\n *index_rtrn = NULL;\n return (*field_rtrn != NULL);\n case EXPR_FIELD_REF:\n *elem_rtrn = xkb_atom_text(ctx, expr->field_ref.element);\n *field_rtrn = xkb_atom_text(ctx, expr->field_ref.field);\n *index_rtrn = NULL;\n return true;\n case EXPR_ARRAY_REF:\n *elem_rtrn = xkb_atom_text(ctx, expr->array_ref.element);\n *field_rtrn = xkb_atom_text(ctx, expr->array_ref.field);\n *index_rtrn = expr->array_ref.entry;\n return true;\n default:\n break;\n }\n log_wsgo(ctx, \"Unexpected operator %d in ResolveLhs\\n\", expr->expr.op);\n return false;\n}","target":"ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr,\n const char **elem_rtrn, const char **field_rtrn,\n ExprDef **index_rtrn)\n{\n switch (expr->expr.op) {\n case EXPR_IDENT:\n *elem_rtrn = NULL;\n *field_rtrn = xkb_atom_text(ctx, expr->ident.ident);\n *index_rtrn = NULL;\n return (*field_rtrn != NULL);\n case EXPR_FIELD_REF:\n *elem_rtrn = xkb_atom_text(ctx, expr->field_ref.element);\n *field_rtrn = xkb_atom_text(ctx, expr->field_ref.field);\n *index_rtrn = NULL;\n return (*elem_rtrn != NULL && *field_rtrn != NULL);\n case EXPR_ARRAY_REF:\n *elem_rtrn = xkb_atom_text(ctx, expr->array_ref.element);\n *field_rtrn = xkb_atom_text(ctx, expr->array_ref.field);\n *index_rtrn = expr->array_ref.entry;\n\tif (expr->array_ref.element != XKB_ATOM_NONE && *elem_rtrn == NULL)\n\t\treturn false;\n\tif (*field_rtrn == NULL)\n\t\treturn false;\n return true;\n default:\n break;\n }\n log_wsgo(ctx, \"Unexpected operator %d in ResolveLhs\\n\", expr->expr.op);\n return false;\n}","lang":"c","vul_type":"cwe-476","target_token_count":313,"sven_meta":{"func_name":"ExprResolveLhs","file_name":"src/xkbcomp/expr.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/bb4909d2d8fa6b08155e449986a478101e2b2634","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#50-ff4ae20c385d","input":"tar_directory_for_file (GsfInfileTar *dir, const char *name, gboolean last)\n{\n\tconst char *s = name;\n\n\twhile (1) {\n\t\tconst char *s0 = s;\n\t\tchar *dirname;\n\n\t\t/* Find a directory component, if any. */\n\t\twhile (1) {\n\t\t\tif (*s == 0) {\n\t\t\t\tif (last && s != s0)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\treturn dir;\n\t\t\t}\n\t\t\t/* This is deliberately slash-only. */\n\t\t\tif (*s == '/')\n\t\t\t\tbreak;\n\t\t\ts++;\n\t\t}\n\n\t\tdirname = g_strndup (s0, s - s0);\n\t\twhile (*s == '/')\n\t\t\ts++;\n\n\t\tif (strcmp (dirname, \".\") != 0) {\n\t\t\tGsfInput *subdir =\n\t\t\t\tgsf_infile_child_by_name (GSF_INFILE (dir),\n\t\t\t\t\t\t\t dirname);\n\t\t\tif (subdir) {\n\t\t\t\t/* Undo the ref. */\n\t\t\t\tg_object_unref (subdir);\n\t\t\t\tdir = GSF_INFILE_TAR (subdir);\n\t\t\t} else\n\t\t\t\tdir = tar_create_dir (dir, dirname);\n\t\t}\n\n\t\tg_free (dirname);\n\t}\n}","target":"tar_directory_for_file (GsfInfileTar *dir, const char *name, gboolean last)\n{\n\tconst char *s = name;\n\n\twhile (1) {\n\t\tconst char *s0 = s;\n\t\tchar *dirname;\n\n\t\t/* Find a directory component, if any. */\n\t\twhile (1) {\n\t\t\tif (*s == 0) {\n\t\t\t\tif (last && s != s0)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\treturn dir;\n\t\t\t}\n\t\t\t/* This is deliberately slash-only. */\n\t\t\tif (*s == '/')\n\t\t\t\tbreak;\n\t\t\ts++;\n\t\t}\n\n\t\tdirname = g_strndup (s0, s - s0);\n\t\twhile (*s == '/')\n\t\t\ts++;\n\n\t\tif (strcmp (dirname, \".\") != 0) {\n\t\t\tGsfInput *subdir =\n\t\t\t\tgsf_infile_child_by_name (GSF_INFILE (dir),\n\t\t\t\t\t\t\t dirname);\n\t\t\tif (subdir) {\n\t\t\t\tdir = GSF_IS_INFILE_TAR (subdir)\n\t\t\t\t\t? GSF_INFILE_TAR (subdir)\n\t\t\t\t\t: dir;\n\t\t\t\t/* Undo the ref. */\n\t\t\t\tg_object_unref (subdir);\n\t\t\t} else\n\t\t\t\tdir = tar_create_dir (dir, dirname);\n\t\t}\n\n\t\tg_free (dirname);\n\t}\n}","lang":"c","vul_type":"cwe-476","target_token_count":275,"sven_meta":{"func_name":"tar_directory_for_file","file_name":"gsf/gsf-infile-tar.c","commit_link":"github.com/GNOME/libgsf/commit/95a8351a75758cf10b3bf6abae0b6b461f90d9e5","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#56-0bd5324e7689","input":"static int __init big_key_init(void)\n{\n\treturn register_key_type(&key_type_big_key);\n}","target":"static int __init big_key_init(void)\n{\n\tstruct crypto_skcipher *cipher;\n\tstruct crypto_rng *rng;\n\tint ret;\n\n\trng = crypto_alloc_rng(big_key_rng_name, 0, 0);\n\tif (IS_ERR(rng)) {\n\t\tpr_err(\"Can't alloc rng: %ld\\n\", PTR_ERR(rng));\n\t\treturn PTR_ERR(rng);\n\t}\n\n\tbig_key_rng = rng;\n\n\t/* seed RNG */\n\tret = crypto_rng_reset(rng, NULL, crypto_rng_seedsize(rng));\n\tif (ret) {\n\t\tpr_err(\"Can't reset rng: %d\\n\", ret);\n\t\tgoto error_rng;\n\t}\n\n\t/* init block cipher */\n\tcipher = crypto_alloc_skcipher(big_key_alg_name, 0, CRYPTO_ALG_ASYNC);\n\tif (IS_ERR(cipher)) {\n\t\tret = PTR_ERR(cipher);\n\t\tpr_err(\"Can't alloc crypto: %d\\n\", ret);\n\t\tgoto error_rng;\n\t}\n\n\tbig_key_skcipher = cipher;\n\n\tret = register_key_type(&key_type_big_key);\n\tif (ret < 0) {\n\t\tpr_err(\"Can't register type: %d\\n\", ret);\n\t\tgoto error_cipher;\n\t}\n\n\treturn 0;\n\nerror_cipher:\n\tcrypto_free_skcipher(big_key_skcipher);\nerror_rng:\n\tcrypto_free_rng(big_key_rng);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-476","target_token_count":280,"sven_meta":{"func_name":"big_key_init","file_name":"security/keys/big_key.c","commit_link":"github.com/torvalds/linux/commit/7df3e59c3d1df4f87fe874c7956ef7a3d2f4d5fb","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#58-b51548a923e2","input":"CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)\n{\n bool ok;\n XkbFile *files[LAST_KEYMAP_FILE_TYPE + 1] = { NULL };\n enum xkb_file_type type;\n struct xkb_context *ctx = keymap->ctx;\n\n /* Collect section files and check for duplicates. */\n for (file = (XkbFile *) file->defs; file;\n file = (XkbFile *) file->common.next) {\n if (file->file_type < FIRST_KEYMAP_FILE_TYPE ||\n file->file_type > LAST_KEYMAP_FILE_TYPE) {\n log_err(ctx, \"Cannot define %s in a keymap file\\n\",\n xkb_file_type_to_string(file->file_type));\n continue;\n }\n\n if (files[file->file_type]) {\n log_err(ctx,\n \"More than one %s section in keymap file; \"\n \"All sections after the first ignored\\n\",\n xkb_file_type_to_string(file->file_type));\n continue;\n }\n\n files[file->file_type] = file;\n }\n\n /*\n * Check that all required section were provided.\n * Report everything before failing.\n */\n ok = true;\n for (type = FIRST_KEYMAP_FILE_TYPE;\n type <= LAST_KEYMAP_FILE_TYPE;\n type++) {\n if (files[type] == NULL) {\n log_err(ctx, \"Required section %s missing from keymap\\n\",\n xkb_file_type_to_string(type));\n ok = false;\n }\n }\n if (!ok)\n return false;\n\n /* Compile sections. */\n for (type = FIRST_KEYMAP_FILE_TYPE;\n type <= LAST_KEYMAP_FILE_TYPE;\n type++) {\n log_dbg(ctx, \"Compiling %s \\\"%s\\\"\\n\",\n xkb_file_type_to_string(type), files[type]->name);\n\n ok = compile_file_fns[type](files[type], keymap, merge);\n if (!ok) {\n log_err(ctx, \"Failed to compile %s\\n\",\n xkb_file_type_to_string(type));\n return false;\n }\n }\n\n return UpdateDerivedKeymapFields(keymap);\n}","target":"CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)\n{\n bool ok;\n XkbFile *files[LAST_KEYMAP_FILE_TYPE + 1] = { NULL };\n enum xkb_file_type type;\n struct xkb_context *ctx = keymap->ctx;\n\n /* Collect section files and check for duplicates. */\n for (file = (XkbFile *) file->defs; file;\n file = (XkbFile *) file->common.next) {\n if (file->file_type < FIRST_KEYMAP_FILE_TYPE ||\n file->file_type > LAST_KEYMAP_FILE_TYPE) {\n if (file->file_type == FILE_TYPE_GEOMETRY) {\n log_vrb(ctx, 1,\n \"Geometry sections are not supported; ignoring\\n\");\n } else {\n log_err(ctx, \"Cannot define %s in a keymap file\\n\",\n xkb_file_type_to_string(file->file_type));\n }\n continue;\n }\n\n if (files[file->file_type]) {\n log_err(ctx,\n \"More than one %s section in keymap file; \"\n \"All sections after the first ignored\\n\",\n xkb_file_type_to_string(file->file_type));\n continue;\n }\n\n files[file->file_type] = file;\n }\n\n /*\n * Check that all required section were provided.\n * Report everything before failing.\n */\n ok = true;\n for (type = FIRST_KEYMAP_FILE_TYPE;\n type <= LAST_KEYMAP_FILE_TYPE;\n type++) {\n if (files[type] == NULL) {\n log_err(ctx, \"Required section %s missing from keymap\\n\",\n xkb_file_type_to_string(type));\n ok = false;\n }\n }\n if (!ok)\n return false;\n\n /* Compile sections. */\n for (type = FIRST_KEYMAP_FILE_TYPE;\n type <= LAST_KEYMAP_FILE_TYPE;\n type++) {\n log_dbg(ctx, \"Compiling %s \\\"%s\\\"\\n\",\n xkb_file_type_to_string(type), files[type]->name);\n\n ok = compile_file_fns[type](files[type], keymap, merge);\n if (!ok) {\n log_err(ctx, \"Failed to compile %s\\n\",\n xkb_file_type_to_string(type));\n return false;\n }\n }\n\n return UpdateDerivedKeymapFields(keymap);\n}","lang":"c","vul_type":"cwe-476","target_token_count":505,"sven_meta":{"func_name":"CompileKeymap","file_name":"src/xkbcomp/keymap.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/917636b1d0d70205a13f89062b95e3a0fc31d4ff","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#61-1e3644f547d7","input":"static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,\n\t\t\t\t struct srpt_recv_ioctx *recv_ioctx,\n\t\t\t\t struct srpt_send_ioctx *send_ioctx)\n{\n\tstruct srp_tsk_mgmt *srp_tsk;\n\tstruct se_cmd *cmd;\n\tstruct se_session *sess = ch->sess;\n\tuint64_t unpacked_lun;\n\tuint32_t tag = 0;\n\tint tcm_tmr;\n\tint rc;\n\n\tBUG_ON(!send_ioctx);\n\n\tsrp_tsk = recv_ioctx->ioctx.buf;\n\tcmd = &send_ioctx->cmd;\n\n\tpr_debug(\"recv tsk_mgmt fn %d for task_tag %lld and cmd tag %lld\"\n\t\t \" cm_id %p sess %p\\n\", srp_tsk->tsk_mgmt_func,\n\t\t srp_tsk->task_tag, srp_tsk->tag, ch->cm_id, ch->sess);\n\n\tsrpt_set_cmd_state(send_ioctx, SRPT_STATE_MGMT);\n\tsend_ioctx->cmd.tag = srp_tsk->tag;\n\ttcm_tmr = srp_tmr_to_tcm(srp_tsk->tsk_mgmt_func);\n\tif (tcm_tmr < 0) {\n\t\tsend_ioctx->cmd.se_tmr_req->response =\n\t\t\tTMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED;\n\t\tgoto fail;\n\t}\n\tunpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun,\n\t\t\t\t sizeof(srp_tsk->lun));\n\n\tif (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK) {\n\t\trc = srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag);\n\t\tif (rc < 0) {\n\t\t\tsend_ioctx->cmd.se_tmr_req->response =\n\t\t\t\t\tTMR_TASK_DOES_NOT_EXIST;\n\t\t\tgoto fail;\n\t\t}\n\t\ttag = srp_tsk->task_tag;\n\t}\n\trc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, unpacked_lun,\n\t\t\t\tsrp_tsk, tcm_tmr, GFP_KERNEL, tag,\n\t\t\t\tTARGET_SCF_ACK_KREF);\n\tif (rc != 0) {\n\t\tsend_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;\n\t\tgoto fail;\n\t}\n\treturn;\nfail:\n\ttransport_send_check_condition_and_sense(cmd, 0, 0); // XXX:\n}","target":"static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,\n\t\t\t\t struct srpt_recv_ioctx *recv_ioctx,\n\t\t\t\t struct srpt_send_ioctx *send_ioctx)\n{\n\tstruct srp_tsk_mgmt *srp_tsk;\n\tstruct se_cmd *cmd;\n\tstruct se_session *sess = ch->sess;\n\tuint64_t unpacked_lun;\n\tint tcm_tmr;\n\tint rc;\n\n\tBUG_ON(!send_ioctx);\n\n\tsrp_tsk = recv_ioctx->ioctx.buf;\n\tcmd = &send_ioctx->cmd;\n\n\tpr_debug(\"recv tsk_mgmt fn %d for task_tag %lld and cmd tag %lld\"\n\t\t \" cm_id %p sess %p\\n\", srp_tsk->tsk_mgmt_func,\n\t\t srp_tsk->task_tag, srp_tsk->tag, ch->cm_id, ch->sess);\n\n\tsrpt_set_cmd_state(send_ioctx, SRPT_STATE_MGMT);\n\tsend_ioctx->cmd.tag = srp_tsk->tag;\n\ttcm_tmr = srp_tmr_to_tcm(srp_tsk->tsk_mgmt_func);\n\tunpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun,\n\t\t\t\t sizeof(srp_tsk->lun));\n\trc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, unpacked_lun,\n\t\t\t\tsrp_tsk, tcm_tmr, GFP_KERNEL, srp_tsk->task_tag,\n\t\t\t\tTARGET_SCF_ACK_KREF);\n\tif (rc != 0) {\n\t\tsend_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;\n\t\tgoto fail;\n\t}\n\treturn;\nfail:\n\ttransport_send_check_condition_and_sense(cmd, 0, 0); // XXX:\n}","lang":"c","vul_type":"cwe-476","target_token_count":380,"sven_meta":{"func_name":"srpt_handle_tsk_mgmt","file_name":"drivers/infiniband/ulp/srpt/ib_srpt.c","commit_link":"github.com/torvalds/linux/commit/51093254bf879bc9ce96590400a87897c7498463","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#62-b93674cb7ca0","input":"ResolveStateAndPredicate(ExprDef *expr, enum xkb_match_operation *pred_rtrn,\n xkb_mod_mask_t *mods_rtrn, CompatInfo *info)\n{\n if (expr == NULL) {\n *pred_rtrn = MATCH_ANY_OR_NONE;\n *mods_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n\n *pred_rtrn = MATCH_EXACTLY;\n if (expr->expr.op == EXPR_ACTION_DECL) {\n const char *pred_txt = xkb_atom_text(info->ctx, expr->action.name);\n if (!LookupString(symInterpretMatchMaskNames, pred_txt, pred_rtrn)) {\n log_err(info->ctx,\n \"Illegal modifier predicate \\\"%s\\\"; Ignored\\n\", pred_txt);\n return false;\n }\n expr = expr->action.args;\n }\n else if (expr->expr.op == EXPR_IDENT) {\n const char *pred_txt = xkb_atom_text(info->ctx, expr->ident.ident);\n if (pred_txt && istreq(pred_txt, \"any\")) {\n *pred_rtrn = MATCH_ANY;\n *mods_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n }\n\n return ExprResolveModMask(info->ctx, expr, MOD_REAL, &info->mods,\n mods_rtrn);\n}","target":"ResolveStateAndPredicate(ExprDef *expr, enum xkb_match_operation *pred_rtrn,\n xkb_mod_mask_t *mods_rtrn, CompatInfo *info)\n{\n if (expr == NULL) {\n *pred_rtrn = MATCH_ANY_OR_NONE;\n *mods_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n\n *pred_rtrn = MATCH_EXACTLY;\n if (expr->expr.op == EXPR_ACTION_DECL) {\n const char *pred_txt = xkb_atom_text(info->ctx, expr->action.name);\n if (!LookupString(symInterpretMatchMaskNames, pred_txt, pred_rtrn) ||\n !expr->action.args) {\n log_err(info->ctx,\n \"Illegal modifier predicate \\\"%s\\\"; Ignored\\n\", pred_txt);\n return false;\n }\n expr = expr->action.args;\n }\n else if (expr->expr.op == EXPR_IDENT) {\n const char *pred_txt = xkb_atom_text(info->ctx, expr->ident.ident);\n if (pred_txt && istreq(pred_txt, \"any\")) {\n *pred_rtrn = MATCH_ANY;\n *mods_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n }\n\n return ExprResolveModMask(info->ctx, expr, MOD_REAL, &info->mods,\n mods_rtrn);\n}","lang":"c","vul_type":"cwe-476","target_token_count":298,"sven_meta":{"func_name":"ResolveStateAndPredicate","file_name":"src/xkbcomp/compat.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/96df3106d49438e442510c59acad306e94f3db4d","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#65-f8ef24f24430","input":"acc_ctx_cont(OM_uint32 *minstat,\n\t gss_buffer_t buf,\n\t gss_ctx_id_t *ctx,\n\t gss_buffer_t *responseToken,\n\t gss_buffer_t *mechListMIC,\n\t OM_uint32 *negState,\n\t send_token_flag *return_token)\n{\n\tOM_uint32 ret, tmpmin;\n\tgss_OID supportedMech;\n\tspnego_gss_ctx_id_t sc;\n\tunsigned int len;\n\tunsigned char *ptr, *bufstart;\n\n\tsc = (spnego_gss_ctx_id_t)*ctx;\n\tret = GSS_S_DEFECTIVE_TOKEN;\n\t*negState = REJECT;\n\t*minstat = 0;\n\tsupportedMech = GSS_C_NO_OID;\n\t*return_token = ERROR_TOKEN_SEND;\n\t*responseToken = *mechListMIC = GSS_C_NO_BUFFER;\n\n\tptr = bufstart = buf->value;\n#define REMAIN (buf->length - (ptr - bufstart))\n\tif (REMAIN > INT_MAX)\n\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\n\t/*\n\t * Attempt to work with old Sun SPNEGO.\n\t */\n\tif (*ptr == HEADER_ID) {\n\t\tret = g_verify_token_header(gss_mech_spnego,\n\t\t\t\t\t &len, &ptr, 0, REMAIN);\n\t\tif (ret) {\n\t\t\t*minstat = ret;\n\t\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\t\t}\n\t}\n\tif (*ptr != (CONTEXT | 0x01)) {\n\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\t}\n\tret = get_negTokenResp(minstat, ptr, REMAIN,\n\t\t\t negState, &supportedMech,\n\t\t\t responseToken, mechListMIC);\n\tif (ret != GSS_S_COMPLETE)\n\t\tgoto cleanup;\n\n\tif (*responseToken == GSS_C_NO_BUFFER &&\n\t *mechListMIC == GSS_C_NO_BUFFER) {\n\n\t\tret = GSS_S_DEFECTIVE_TOKEN;\n\t\tgoto cleanup;\n\t}\n\tif (supportedMech != GSS_C_NO_OID) {\n\t\tret = GSS_S_DEFECTIVE_TOKEN;\n\t\tgoto cleanup;\n\t}\n\tsc->firstpass = 0;\n\t*negState = ACCEPT_INCOMPLETE;\n\t*return_token = CONT_TOKEN_SEND;\ncleanup:\n\tif (supportedMech != GSS_C_NO_OID) {\n\t\tgeneric_gss_release_oid(&tmpmin, &supportedMech);\n\t}\n\treturn ret;\n#undef REMAIN\n}","target":"acc_ctx_cont(OM_uint32 *minstat,\n\t gss_buffer_t buf,\n\t gss_ctx_id_t *ctx,\n\t gss_buffer_t *responseToken,\n\t gss_buffer_t *mechListMIC,\n\t OM_uint32 *negState,\n\t send_token_flag *return_token)\n{\n\tOM_uint32 ret, tmpmin;\n\tgss_OID supportedMech;\n\tspnego_gss_ctx_id_t sc;\n\tunsigned int len;\n\tunsigned char *ptr, *bufstart;\n\n\tsc = (spnego_gss_ctx_id_t)*ctx;\n\tret = GSS_S_DEFECTIVE_TOKEN;\n\t*negState = REJECT;\n\t*minstat = 0;\n\tsupportedMech = GSS_C_NO_OID;\n\t*return_token = ERROR_TOKEN_SEND;\n\t*responseToken = *mechListMIC = GSS_C_NO_BUFFER;\n\n\tptr = bufstart = buf->value;\n#define REMAIN (buf->length - (ptr - bufstart))\n\tif (REMAIN == 0 || REMAIN > INT_MAX)\n\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\n\t/*\n\t * Attempt to work with old Sun SPNEGO.\n\t */\n\tif (*ptr == HEADER_ID) {\n\t\tret = g_verify_token_header(gss_mech_spnego,\n\t\t\t\t\t &len, &ptr, 0, REMAIN);\n\t\tif (ret) {\n\t\t\t*minstat = ret;\n\t\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\t\t}\n\t}\n\tif (*ptr != (CONTEXT | 0x01)) {\n\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\t}\n\tret = get_negTokenResp(minstat, ptr, REMAIN,\n\t\t\t negState, &supportedMech,\n\t\t\t responseToken, mechListMIC);\n\tif (ret != GSS_S_COMPLETE)\n\t\tgoto cleanup;\n\n\tif (*responseToken == GSS_C_NO_BUFFER &&\n\t *mechListMIC == GSS_C_NO_BUFFER) {\n\n\t\tret = GSS_S_DEFECTIVE_TOKEN;\n\t\tgoto cleanup;\n\t}\n\tif (supportedMech != GSS_C_NO_OID) {\n\t\tret = GSS_S_DEFECTIVE_TOKEN;\n\t\tgoto cleanup;\n\t}\n\tsc->firstpass = 0;\n\t*negState = ACCEPT_INCOMPLETE;\n\t*return_token = CONT_TOKEN_SEND;\ncleanup:\n\tif (supportedMech != GSS_C_NO_OID) {\n\t\tgeneric_gss_release_oid(&tmpmin, &supportedMech);\n\t}\n\treturn ret;\n#undef REMAIN\n}","lang":"c","vul_type":"cwe-476","target_token_count":512,"sven_meta":{"func_name":"acc_ctx_cont","file_name":"src/lib/gssapi/spnego/spnego_mech.c","commit_link":"github.com/krb5/krb5/commit/524688ce87a15fc75f87efc8c039ba4c7d5c197b","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-416#3-f862b96faa78","input":"int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)\n{\n\tstruct sctp_association *asoc = sctp_id2assoc(sk, id);\n\tstruct sctp_sock *sp = sctp_sk(sk);\n\tstruct socket *sock;\n\tint err = 0;\n\n\tif (!asoc)\n\t\treturn -EINVAL;\n\n\t/* If there is a thread waiting on more sndbuf space for\n\t * sending on this asoc, it cannot be peeled.\n\t */\n\tif (waitqueue_active(&asoc->wait))\n\t\treturn -EBUSY;\n\n\t/* An association cannot be branched off from an already peeled-off\n\t * socket, nor is this supported for tcp style sockets.\n\t */\n\tif (!sctp_style(sk, UDP))\n\t\treturn -EINVAL;\n\n\t/* Create a new socket. */\n\terr = sock_create(sk->sk_family, SOCK_SEQPACKET, IPPROTO_SCTP, &sock);\n\tif (err < 0)\n\t\treturn err;\n\n\tsctp_copy_sock(sock->sk, sk, asoc);\n\n\t/* Make peeled-off sockets more like 1-1 accepted sockets.\n\t * Set the daddr and initialize id to something more random\n\t */\n\tsp->pf->to_sk_daddr(&asoc->peer.primary_addr, sk);\n\n\t/* Populate the fields of the newsk from the oldsk and migrate the\n\t * asoc to the newsk.\n\t */\n\tsctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH);\n\n\t*sockp = sock;\n\n\treturn err;\n}","target":"int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)\n{\n\tstruct sctp_association *asoc = sctp_id2assoc(sk, id);\n\tstruct sctp_sock *sp = sctp_sk(sk);\n\tstruct socket *sock;\n\tint err = 0;\n\n\t/* Do not peel off from one netns to another one. */\n\tif (!net_eq(current->nsproxy->net_ns, sock_net(sk)))\n\t\treturn -EINVAL;\n\n\tif (!asoc)\n\t\treturn -EINVAL;\n\n\t/* If there is a thread waiting on more sndbuf space for\n\t * sending on this asoc, it cannot be peeled.\n\t */\n\tif (waitqueue_active(&asoc->wait))\n\t\treturn -EBUSY;\n\n\t/* An association cannot be branched off from an already peeled-off\n\t * socket, nor is this supported for tcp style sockets.\n\t */\n\tif (!sctp_style(sk, UDP))\n\t\treturn -EINVAL;\n\n\t/* Create a new socket. */\n\terr = sock_create(sk->sk_family, SOCK_SEQPACKET, IPPROTO_SCTP, &sock);\n\tif (err < 0)\n\t\treturn err;\n\n\tsctp_copy_sock(sock->sk, sk, asoc);\n\n\t/* Make peeled-off sockets more like 1-1 accepted sockets.\n\t * Set the daddr and initialize id to something more random\n\t */\n\tsp->pf->to_sk_daddr(&asoc->peer.primary_addr, sk);\n\n\t/* Populate the fields of the newsk from the oldsk and migrate the\n\t * asoc to the newsk.\n\t */\n\tsctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH);\n\n\t*sockp = sock;\n\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","target_token_count":369,"sven_meta":{"func_name":"sctp_do_peeloff","file_name":"net/sctp/socket.c","commit_link":"github.com/torvalds/linux/commit/df80cd9b28b9ebaa284a41df611dbf3a2d05ca74","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#6-1ad71a59d50d","input":"static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)\n{\n\tstruct xc2028_data *priv = fe->tuner_priv;\n\tstruct xc2028_ctrl *p = priv_cfg;\n\tint rc = 0;\n\n\ttuner_dbg(\"%s called\\n\", __func__);\n\n\tmutex_lock(&priv->lock);\n\n\t/*\n\t * Copy the config data.\n\t * For the firmware name, keep a local copy of the string,\n\t * in order to avoid troubles during device release.\n\t */\n\tkfree(priv->ctrl.fname);\n\tmemcpy(&priv->ctrl, p, sizeof(priv->ctrl));\n\tif (p->fname) {\n\t\tpriv->ctrl.fname = kstrdup(p->fname, GFP_KERNEL);\n\t\tif (priv->ctrl.fname == NULL)\n\t\t\trc = -ENOMEM;\n\t}\n\n\t/*\n\t * If firmware name changed, frees firmware. As free_firmware will\n\t * reset the status to NO_FIRMWARE, this forces a new request_firmware\n\t */\n\tif (!firmware_name[0] && p->fname &&\n\t priv->fname && strcmp(p->fname, priv->fname))\n\t\tfree_firmware(priv);\n\n\tif (priv->ctrl.max_len < 9)\n\t\tpriv->ctrl.max_len = 13;\n\n\tif (priv->state == XC2028_NO_FIRMWARE) {\n\t\tif (!firmware_name[0])\n\t\t\tpriv->fname = priv->ctrl.fname;\n\t\telse\n\t\t\tpriv->fname = firmware_name;\n\n\t\trc = request_firmware_nowait(THIS_MODULE, 1,\n\t\t\t\t\t priv->fname,\n\t\t\t\t\t priv->i2c_props.adap->dev.parent,\n\t\t\t\t\t GFP_KERNEL,\n\t\t\t\t\t fe, load_firmware_cb);\n\t\tif (rc < 0) {\n\t\t\ttuner_err(\"Failed to request firmware %s\\n\",\n\t\t\t\t priv->fname);\n\t\t\tpriv->state = XC2028_NODEV;\n\t\t} else\n\t\t\tpriv->state = XC2028_WAITING_FIRMWARE;\n\t}\n\tmutex_unlock(&priv->lock);\n\n\treturn rc;\n}","target":"static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)\n{\n\tstruct xc2028_data *priv = fe->tuner_priv;\n\tstruct xc2028_ctrl *p = priv_cfg;\n\tint rc = 0;\n\n\ttuner_dbg(\"%s called\\n\", __func__);\n\n\tmutex_lock(&priv->lock);\n\n\t/*\n\t * Copy the config data.\n\t * For the firmware name, keep a local copy of the string,\n\t * in order to avoid troubles during device release.\n\t */\n\tkfree(priv->ctrl.fname);\n\tpriv->ctrl.fname = NULL;\n\tmemcpy(&priv->ctrl, p, sizeof(priv->ctrl));\n\tif (p->fname) {\n\t\tpriv->ctrl.fname = kstrdup(p->fname, GFP_KERNEL);\n\t\tif (priv->ctrl.fname == NULL)\n\t\t\treturn -ENOMEM;\n\t}\n\n\t/*\n\t * If firmware name changed, frees firmware. As free_firmware will\n\t * reset the status to NO_FIRMWARE, this forces a new request_firmware\n\t */\n\tif (!firmware_name[0] && p->fname &&\n\t priv->fname && strcmp(p->fname, priv->fname))\n\t\tfree_firmware(priv);\n\n\tif (priv->ctrl.max_len < 9)\n\t\tpriv->ctrl.max_len = 13;\n\n\tif (priv->state == XC2028_NO_FIRMWARE) {\n\t\tif (!firmware_name[0])\n\t\t\tpriv->fname = priv->ctrl.fname;\n\t\telse\n\t\t\tpriv->fname = firmware_name;\n\n\t\trc = request_firmware_nowait(THIS_MODULE, 1,\n\t\t\t\t\t priv->fname,\n\t\t\t\t\t priv->i2c_props.adap->dev.parent,\n\t\t\t\t\t GFP_KERNEL,\n\t\t\t\t\t fe, load_firmware_cb);\n\t\tif (rc < 0) {\n\t\t\ttuner_err(\"Failed to request firmware %s\\n\",\n\t\t\t\t priv->fname);\n\t\t\tpriv->state = XC2028_NODEV;\n\t\t} else\n\t\t\tpriv->state = XC2028_WAITING_FIRMWARE;\n\t}\n\tmutex_unlock(&priv->lock);\n\n\treturn rc;\n}","lang":"c","vul_type":"cwe-416","target_token_count":438,"sven_meta":{"func_name":"xc2028_set_config","file_name":"drivers/media/tuners/tuner-xc2028.c","commit_link":"github.com/torvalds/linux/commit/8dfbcc4351a0b6d2f2d77f367552f48ffefafe18","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#10-daef89c72ecd","input":"int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,\n\t\t\tstruct rq_map_data *map_data,\n\t\t\tconst struct iov_iter *iter, gfp_t gfp_mask)\n{\n\tbool copy = false;\n\tunsigned long align = q->dma_pad_mask | queue_dma_alignment(q);\n\tstruct bio *bio = NULL;\n\tstruct iov_iter i;\n\tint ret;\n\n\tif (map_data)\n\t\tcopy = true;\n\telse if (iov_iter_alignment(iter) & align)\n\t\tcopy = true;\n\telse if (queue_virt_boundary(q))\n\t\tcopy = queue_virt_boundary(q) & iov_iter_gap_alignment(iter);\n\n\ti = *iter;\n\tdo {\n\t\tret =__blk_rq_map_user_iov(rq, map_data, &i, gfp_mask, copy);\n\t\tif (ret)\n\t\t\tgoto unmap_rq;\n\t\tif (!bio)\n\t\t\tbio = rq->bio;\n\t} while (iov_iter_count(&i));\n\n\tif (!bio_flagged(bio, BIO_USER_MAPPED))\n\t\trq->cmd_flags |= REQ_COPY_USER;\n\treturn 0;\n\nunmap_rq:\n\t__blk_rq_unmap_user(bio);\n\trq->bio = NULL;\n\treturn -EINVAL;\n}","target":"int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,\n\t\t\tstruct rq_map_data *map_data,\n\t\t\tconst struct iov_iter *iter, gfp_t gfp_mask)\n{\n\tbool copy = false;\n\tunsigned long align = q->dma_pad_mask | queue_dma_alignment(q);\n\tstruct bio *bio = NULL;\n\tstruct iov_iter i;\n\tint ret;\n\n\tif (!iter_is_iovec(iter))\n\t\tgoto fail;\n\n\tif (map_data)\n\t\tcopy = true;\n\telse if (iov_iter_alignment(iter) & align)\n\t\tcopy = true;\n\telse if (queue_virt_boundary(q))\n\t\tcopy = queue_virt_boundary(q) & iov_iter_gap_alignment(iter);\n\n\ti = *iter;\n\tdo {\n\t\tret =__blk_rq_map_user_iov(rq, map_data, &i, gfp_mask, copy);\n\t\tif (ret)\n\t\t\tgoto unmap_rq;\n\t\tif (!bio)\n\t\t\tbio = rq->bio;\n\t} while (iov_iter_count(&i));\n\n\tif (!bio_flagged(bio, BIO_USER_MAPPED))\n\t\trq->cmd_flags |= REQ_COPY_USER;\n\treturn 0;\n\nunmap_rq:\n\t__blk_rq_unmap_user(bio);\nfail:\n\trq->bio = NULL;\n\treturn -EINVAL;\n}","lang":"c","vul_type":"cwe-416","target_token_count":263,"sven_meta":{"func_name":"blk_rq_map_user_iov","file_name":"block/blk-map.c","commit_link":"github.com/torvalds/linux/commit/a0ac402cfcdc904f9772e1762b3fda112dcc56a0","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#12-9291b4857ded","input":"onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,\n OnigCompileInfo* ci, OnigErrorInfo* einfo)\n{\n int r;\n UChar *cpat, *cpat_end;\n\n if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL;\n\n if (ci->pattern_enc != ci->target_enc) {\n r = conv_encoding(ci->pattern_enc, ci->target_enc, pattern, pattern_end,\n &cpat, &cpat_end);\n if (r != 0) return r;\n }\n else {\n cpat = (UChar* )pattern;\n cpat_end = (UChar* )pattern_end;\n }\n\n *reg = (regex_t* )xmalloc(sizeof(regex_t));\n if (IS_NULL(*reg)) {\n r = ONIGERR_MEMORY;\n goto err2;\n }\n\n r = onig_reg_init(*reg, ci->option, ci->case_fold_flag, ci->target_enc,\n ci->syntax);\n if (r != 0) goto err;\n\n r = onig_compile(*reg, cpat, cpat_end, einfo);\n if (r != 0) {\n err:\n onig_free(*reg);\n *reg = NULL;\n }\n\n err2:\n if (cpat != pattern) xfree(cpat);\n\n return r;\n}","target":"onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,\n OnigCompileInfo* ci, OnigErrorInfo* einfo)\n{\n int r;\n UChar *cpat, *cpat_end;\n\n if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL;\n\n if (ci->pattern_enc != ci->target_enc) {\n return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION;\n }\n else {\n cpat = (UChar* )pattern;\n cpat_end = (UChar* )pattern_end;\n }\n\n *reg = (regex_t* )xmalloc(sizeof(regex_t));\n if (IS_NULL(*reg)) {\n r = ONIGERR_MEMORY;\n goto err2;\n }\n\n r = onig_reg_init(*reg, ci->option, ci->case_fold_flag, ci->target_enc,\n ci->syntax);\n if (r != 0) goto err;\n\n r = onig_compile(*reg, cpat, cpat_end, einfo);\n if (r != 0) {\n err:\n onig_free(*reg);\n *reg = NULL;\n }\n\n err2:\n if (cpat != pattern) xfree(cpat);\n\n return r;\n}","lang":"c","vul_type":"cwe-416","target_token_count":282,"sven_meta":{"func_name":"onig_new_deluxe","file_name":"src/regext.c","commit_link":"github.com/kkos/oniguruma/commit/0f7f61ed1b7b697e283e37bd2d731d0bd57adb55","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#16-a82a08b96d69","input":"int shadow_server_start(rdpShadowServer* server)\n{\n\tBOOL ipc;\n\tBOOL status;\n\tWSADATA wsaData;\n\n\tif (!server)\n\t\treturn -1;\n\n\tif (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)\n\t\treturn -1;\n\n#ifndef _WIN32\n\tsignal(SIGPIPE, SIG_IGN);\n#endif\n\tserver->screen = shadow_screen_new(server);\n\n\tif (!server->screen)\n\t{\n\t\tWLog_ERR(TAG, \"screen_new failed\");\n\t\treturn -1;\n\t}\n\n\tserver->capture = shadow_capture_new(server);\n\n\tif (!server->capture)\n\t{\n\t\tWLog_ERR(TAG, \"capture_new failed\");\n\t\treturn -1;\n\t}\n\n\t/* Bind magic:\n\t *\n\t * emtpy ... bind TCP all\n\t * ... bind local (IPC)\n\t * bind-socket,
... bind TCP to specified interface\n\t */\n\tipc = server->ipcSocket && (strncmp(bind_address, server->ipcSocket,\n\t strnlen(bind_address, sizeof(bind_address))) != 0);\n\tif (!ipc)\n\t{\n\t\tsize_t x, count;\n\t\tchar** list = CommandLineParseCommaSeparatedValuesEx(NULL, server->ipcSocket, &count);\n\t\tif (!list || (count <= 1))\n\t\t{\n\t\t\tfree(list);\n\t\t\tif (server->ipcSocket == NULL)\n\t\t\t{\n\t\t\t\tif (!open_port(server, NULL))\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tfor (x = 1; x < count; x++)\n\t\t{\n\t\t\tBOOL success = open_port(server, list[x]);\n\t\t\tif (!success)\n\t\t\t{\n\t\t\t\tfree(list);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfree(list);\n\t}\n\telse\n\t{\n\t\tstatus = server->listener->OpenLocal(server->listener, server->ipcSocket);\n\t\tif (!status)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"Problem creating local socket listener. (Port already used or \"\n\t\t\t \"insufficient permissions?)\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\tif (!(server->thread = CreateThread(NULL, 0, shadow_server_thread, (void*)server, 0, NULL)))\n\t{\n\t\treturn -1;\n\t}\n\n\treturn 0;\n}","target":"int shadow_server_start(rdpShadowServer* server)\n{\n\tBOOL ipc;\n\tBOOL status;\n\tWSADATA wsaData;\n\n\tif (!server)\n\t\treturn -1;\n\n\tif (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)\n\t\treturn -1;\n\n#ifndef _WIN32\n\tsignal(SIGPIPE, SIG_IGN);\n#endif\n\tserver->screen = shadow_screen_new(server);\n\n\tif (!server->screen)\n\t{\n\t\tWLog_ERR(TAG, \"screen_new failed\");\n\t\treturn -1;\n\t}\n\n\tserver->capture = shadow_capture_new(server);\n\n\tif (!server->capture)\n\t{\n\t\tWLog_ERR(TAG, \"capture_new failed\");\n\t\treturn -1;\n\t}\n\n\t/* Bind magic:\n\t *\n\t * emtpy ... bind TCP all\n\t * ... bind local (IPC)\n\t * bind-socket,
... bind TCP to specified interface\n\t */\n\tipc = server->ipcSocket && (strncmp(bind_address, server->ipcSocket,\n\t strnlen(bind_address, sizeof(bind_address))) != 0);\n\tif (!ipc)\n\t{\n\t\tsize_t x, count;\n\t\tchar** list = CommandLineParseCommaSeparatedValuesEx(NULL, server->ipcSocket, &count);\n\t\tif (!list || (count <= 1))\n\t\t{\n\t\t\tif (server->ipcSocket == NULL)\n\t\t\t{\n\t\t\t\tif (!open_port(server, NULL))\n\t\t\t\t{\n\t\t\t\t\tfree(list);\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfree(list);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\n\t\tfor (x = 1; x < count; x++)\n\t\t{\n\t\t\tBOOL success = open_port(server, list[x]);\n\t\t\tif (!success)\n\t\t\t{\n\t\t\t\tfree(list);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfree(list);\n\t}\n\telse\n\t{\n\t\tstatus = server->listener->OpenLocal(server->listener, server->ipcSocket);\n\t\tif (!status)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"Problem creating local socket listener. (Port already used or \"\n\t\t\t \"insufficient permissions?)\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\tif (!(server->thread = CreateThread(NULL, 0, shadow_server_thread, (void*)server, 0, NULL)))\n\t{\n\t\treturn -1;\n\t}\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-416","target_token_count":504,"sven_meta":{"func_name":"shadow_server_start","file_name":"server/shadow/shadow_server.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/6d86e20e1e7caaab4f0c7f89e36d32914dbccc52","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#19-1f066d22ef08","input":"static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,\n\tstruct user_namespace *user_ns)\n{\n\tmm->mmap = NULL;\n\tmm->mm_rb = RB_ROOT;\n\tmm->vmacache_seqnum = 0;\n\tatomic_set(&mm->mm_users, 1);\n\tatomic_set(&mm->mm_count, 1);\n\tinit_rwsem(&mm->mmap_sem);\n\tINIT_LIST_HEAD(&mm->mmlist);\n\tmm->core_state = NULL;\n\tatomic_long_set(&mm->nr_ptes, 0);\n\tmm_nr_pmds_init(mm);\n\tmm->map_count = 0;\n\tmm->locked_vm = 0;\n\tmm->pinned_vm = 0;\n\tmemset(&mm->rss_stat, 0, sizeof(mm->rss_stat));\n\tspin_lock_init(&mm->page_table_lock);\n\tmm_init_cpumask(mm);\n\tmm_init_aio(mm);\n\tmm_init_owner(mm, p);\n\tmmu_notifier_mm_init(mm);\n\tinit_tlb_flush_pending(mm);\n#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS\n\tmm->pmd_huge_pte = NULL;\n#endif\n\n\tif (current->mm) {\n\t\tmm->flags = current->mm->flags & MMF_INIT_MASK;\n\t\tmm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK;\n\t} else {\n\t\tmm->flags = default_dump_filter;\n\t\tmm->def_flags = 0;\n\t}\n\n\tif (mm_alloc_pgd(mm))\n\t\tgoto fail_nopgd;\n\n\tif (init_new_context(p, mm))\n\t\tgoto fail_nocontext;\n\n\tmm->user_ns = get_user_ns(user_ns);\n\treturn mm;\n\nfail_nocontext:\n\tmm_free_pgd(mm);\nfail_nopgd:\n\tfree_mm(mm);\n\treturn NULL;\n}","target":"static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,\n\tstruct user_namespace *user_ns)\n{\n\tmm->mmap = NULL;\n\tmm->mm_rb = RB_ROOT;\n\tmm->vmacache_seqnum = 0;\n\tatomic_set(&mm->mm_users, 1);\n\tatomic_set(&mm->mm_count, 1);\n\tinit_rwsem(&mm->mmap_sem);\n\tINIT_LIST_HEAD(&mm->mmlist);\n\tmm->core_state = NULL;\n\tatomic_long_set(&mm->nr_ptes, 0);\n\tmm_nr_pmds_init(mm);\n\tmm->map_count = 0;\n\tmm->locked_vm = 0;\n\tmm->pinned_vm = 0;\n\tmemset(&mm->rss_stat, 0, sizeof(mm->rss_stat));\n\tspin_lock_init(&mm->page_table_lock);\n\tmm_init_cpumask(mm);\n\tmm_init_aio(mm);\n\tmm_init_owner(mm, p);\n\tRCU_INIT_POINTER(mm->exe_file, NULL);\n\tmmu_notifier_mm_init(mm);\n\tinit_tlb_flush_pending(mm);\n#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS\n\tmm->pmd_huge_pte = NULL;\n#endif\n\n\tif (current->mm) {\n\t\tmm->flags = current->mm->flags & MMF_INIT_MASK;\n\t\tmm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK;\n\t} else {\n\t\tmm->flags = default_dump_filter;\n\t\tmm->def_flags = 0;\n\t}\n\n\tif (mm_alloc_pgd(mm))\n\t\tgoto fail_nopgd;\n\n\tif (init_new_context(p, mm))\n\t\tgoto fail_nocontext;\n\n\tmm->user_ns = get_user_ns(user_ns);\n\treturn mm;\n\nfail_nocontext:\n\tmm_free_pgd(mm);\nfail_nopgd:\n\tfree_mm(mm);\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-416","target_token_count":403,"sven_meta":{"func_name":"mm_init","file_name":"kernel/fork.c","commit_link":"github.com/torvalds/linux/commit/2b7e8665b4ff51c034c55df3cff76518d1a9ee3a","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#30-1190aec5743f","input":"static int kvm_ioctl_create_device(struct kvm *kvm,\n\t\t\t\t struct kvm_create_device *cd)\n{\n\tstruct kvm_device_ops *ops = NULL;\n\tstruct kvm_device *dev;\n\tbool test = cd->flags & KVM_CREATE_DEVICE_TEST;\n\tint ret;\n\n\tif (cd->type >= ARRAY_SIZE(kvm_device_ops_table))\n\t\treturn -ENODEV;\n\n\tops = kvm_device_ops_table[cd->type];\n\tif (ops == NULL)\n\t\treturn -ENODEV;\n\n\tif (test)\n\t\treturn 0;\n\n\tdev = kzalloc(sizeof(*dev), GFP_KERNEL);\n\tif (!dev)\n\t\treturn -ENOMEM;\n\n\tdev->ops = ops;\n\tdev->kvm = kvm;\n\n\tmutex_lock(&kvm->lock);\n\tret = ops->create(dev, cd->type);\n\tif (ret < 0) {\n\t\tmutex_unlock(&kvm->lock);\n\t\tkfree(dev);\n\t\treturn ret;\n\t}\n\tlist_add(&dev->vm_node, &kvm->devices);\n\tmutex_unlock(&kvm->lock);\n\n\tif (ops->init)\n\t\tops->init(dev);\n\n\tret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC);\n\tif (ret < 0) {\n\t\tops->destroy(dev);\n\t\tmutex_lock(&kvm->lock);\n\t\tlist_del(&dev->vm_node);\n\t\tmutex_unlock(&kvm->lock);\n\t\treturn ret;\n\t}\n\n\tkvm_get_kvm(kvm);\n\tcd->fd = ret;\n\treturn 0;\n}","target":"static int kvm_ioctl_create_device(struct kvm *kvm,\n\t\t\t\t struct kvm_create_device *cd)\n{\n\tstruct kvm_device_ops *ops = NULL;\n\tstruct kvm_device *dev;\n\tbool test = cd->flags & KVM_CREATE_DEVICE_TEST;\n\tint ret;\n\n\tif (cd->type >= ARRAY_SIZE(kvm_device_ops_table))\n\t\treturn -ENODEV;\n\n\tops = kvm_device_ops_table[cd->type];\n\tif (ops == NULL)\n\t\treturn -ENODEV;\n\n\tif (test)\n\t\treturn 0;\n\n\tdev = kzalloc(sizeof(*dev), GFP_KERNEL);\n\tif (!dev)\n\t\treturn -ENOMEM;\n\n\tdev->ops = ops;\n\tdev->kvm = kvm;\n\n\tmutex_lock(&kvm->lock);\n\tret = ops->create(dev, cd->type);\n\tif (ret < 0) {\n\t\tmutex_unlock(&kvm->lock);\n\t\tkfree(dev);\n\t\treturn ret;\n\t}\n\tlist_add(&dev->vm_node, &kvm->devices);\n\tmutex_unlock(&kvm->lock);\n\n\tif (ops->init)\n\t\tops->init(dev);\n\n\tret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC);\n\tif (ret < 0) {\n\t\tmutex_lock(&kvm->lock);\n\t\tlist_del(&dev->vm_node);\n\t\tmutex_unlock(&kvm->lock);\n\t\tops->destroy(dev);\n\t\treturn ret;\n\t}\n\n\tkvm_get_kvm(kvm);\n\tcd->fd = ret;\n\treturn 0;\n}","lang":"c","vul_type":"cwe-416","target_token_count":314,"sven_meta":{"func_name":"kvm_ioctl_create_device","file_name":"virt/kvm/kvm_main.c","commit_link":"github.com/torvalds/linux/commit/a0f1d21c1ccb1da66629627a74059dd7f5ac9c61","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#32-7944a99ad014","input":"archive_read_format_rar_read_data(struct archive_read *a, const void **buff,\n size_t *size, int64_t *offset)\n{\n struct rar *rar = (struct rar *)(a->format->data);\n int ret;\n\n if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {\n\t rar->has_encrypted_entries = 0;\n }\n\n if (rar->bytes_unconsumed > 0) {\n /* Consume as much as the decompressor actually used. */\n __archive_read_consume(a, rar->bytes_unconsumed);\n rar->bytes_unconsumed = 0;\n }\n\n *buff = NULL;\n if (rar->entry_eof || rar->offset_seek >= rar->unp_size) {\n *size = 0;\n *offset = rar->offset;\n if (*offset < rar->unp_size)\n *offset = rar->unp_size;\n return (ARCHIVE_EOF);\n }\n\n switch (rar->compression_method)\n {\n case COMPRESS_METHOD_STORE:\n ret = read_data_stored(a, buff, size, offset);\n break;\n\n case COMPRESS_METHOD_FASTEST:\n case COMPRESS_METHOD_FAST:\n case COMPRESS_METHOD_NORMAL:\n case COMPRESS_METHOD_GOOD:\n case COMPRESS_METHOD_BEST:\n ret = read_data_compressed(a, buff, size, offset);\n if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN)\n __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context);\n break;\n\n default:\n archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,\n \"Unsupported compression method for RAR file.\");\n ret = ARCHIVE_FATAL;\n break;\n }\n return (ret);\n}","target":"archive_read_format_rar_read_data(struct archive_read *a, const void **buff,\n size_t *size, int64_t *offset)\n{\n struct rar *rar = (struct rar *)(a->format->data);\n int ret;\n\n if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {\n\t rar->has_encrypted_entries = 0;\n }\n\n if (rar->bytes_unconsumed > 0) {\n /* Consume as much as the decompressor actually used. */\n __archive_read_consume(a, rar->bytes_unconsumed);\n rar->bytes_unconsumed = 0;\n }\n\n *buff = NULL;\n if (rar->entry_eof || rar->offset_seek >= rar->unp_size) {\n *size = 0;\n *offset = rar->offset;\n if (*offset < rar->unp_size)\n *offset = rar->unp_size;\n return (ARCHIVE_EOF);\n }\n\n switch (rar->compression_method)\n {\n case COMPRESS_METHOD_STORE:\n ret = read_data_stored(a, buff, size, offset);\n break;\n\n case COMPRESS_METHOD_FASTEST:\n case COMPRESS_METHOD_FAST:\n case COMPRESS_METHOD_NORMAL:\n case COMPRESS_METHOD_GOOD:\n case COMPRESS_METHOD_BEST:\n ret = read_data_compressed(a, buff, size, offset);\n if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN) {\n __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context);\n rar->start_new_table = 1;\n }\n break;\n\n default:\n archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,\n \"Unsupported compression method for RAR file.\");\n ret = ARCHIVE_FATAL;\n break;\n }\n return (ret);\n}","lang":"c","vul_type":"cwe-416","target_token_count":400,"sven_meta":{"func_name":"archive_read_format_rar_read_data","file_name":"libarchive/archive_read_support_format_rar.c","commit_link":"github.com/libarchive/libarchive/commit/b8592ecba2f9e451e1f5cb7ab6dcee8b8e7b3f60","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#33-81e260d134cb","input":"R_API void r_anal_bb_free(RAnalBlock *bb) {\n\tif (!bb) {\n\t\treturn;\n\t}\n\tr_anal_cond_free (bb->cond);\n\tR_FREE (bb->fingerprint);\n\tr_anal_diff_free (bb->diff);\n\tbb->diff = NULL;\n\tR_FREE (bb->op_bytes);\n\tr_anal_switch_op_free (bb->switch_op);\n\tbb->switch_op = NULL;\n\tbb->fingerprint = NULL;\n\tbb->cond = NULL;\n\tR_FREE (bb->label);\n\tR_FREE (bb->op_pos);\n\tR_FREE (bb->parent_reg_arena);\n\tif (bb->prev) {\n\t\tif (bb->prev->jumpbb == bb) {\n\t\t\tbb->prev->jumpbb = NULL;\n\t\t}\n\t\tif (bb->prev->failbb == bb) {\n\t\t\tbb->prev->failbb = NULL;\n\t\t}\n\t\tbb->prev = NULL;\n\t}\n\tif (bb->jumpbb) {\n\t\tbb->jumpbb->prev = NULL;\n\t\tbb->jumpbb = NULL;\n\t}\n\tif (bb->failbb) {\n\t\tbb->failbb->prev = NULL;\n\t\tbb->failbb = NULL;\n\t}\n\tR_FREE (bb);\n}","target":"R_API void r_anal_bb_free(RAnalBlock *bb) {\n\tif (!bb) {\n\t\treturn;\n\t}\n\tr_anal_cond_free (bb->cond);\n\tR_FREE (bb->fingerprint);\n\tr_anal_diff_free (bb->diff);\n\tbb->diff = NULL;\n\tR_FREE (bb->op_bytes);\n\tr_anal_switch_op_free (bb->switch_op);\n\tbb->switch_op = NULL;\n\tbb->fingerprint = NULL;\n\tbb->cond = NULL;\n\tR_FREE (bb->label);\n\tR_FREE (bb->op_pos);\n\tR_FREE (bb->parent_reg_arena);\n\tif (bb->prev) {\n\t\tif (bb->prev->jumpbb == bb) {\n\t\t\tbb->prev->jumpbb = NULL;\n\t\t}\n\t\tif (bb->prev->failbb == bb) {\n\t\t\tbb->prev->failbb = NULL;\n\t\t}\n\t\tbb->prev = NULL;\n\t}\n\tif (bb->jumpbb) {\n\t\tbb->jumpbb->prev = NULL;\n\t\tbb->jumpbb = NULL;\n\t}\n\tif (bb->failbb) {\n\t\tbb->failbb->prev = NULL;\n\t\tbb->failbb = NULL;\n\t}\n\tif (bb->next) {\n\t\t// avoid double free\n\t\tbb->next->prev = NULL;\n\t}\n\tR_FREE (bb); // double free\n}","lang":"c","vul_type":"cwe-416","target_token_count":295,"sven_meta":{"func_name":"r_anal_bb_free","file_name":"libr/anal/bb.c","commit_link":"github.com/radare/radare2/commit/90b71c017a7fa9732fe45fd21b245ee051b1f548","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#35-e668b1c21939","input":"static int rm_read_multi(AVFormatContext *s, AVIOContext *pb,\n AVStream *st, char *mime)\n{\n int number_of_streams = avio_rb16(pb);\n int number_of_mdpr;\n int i, ret;\n unsigned size2;\n for (i = 0; i 0) {\n st2 = avformat_new_stream(s, NULL);\n if (!st2) {\n ret = AVERROR(ENOMEM);\n return ret;\n }\n st2->id = st->id + (i<<16);\n st2->codecpar->bit_rate = st->codecpar->bit_rate;\n st2->start_time = st->start_time;\n st2->duration = st->duration;\n st2->codecpar->codec_type = AVMEDIA_TYPE_DATA;\n st2->priv_data = ff_rm_alloc_rmstream();\n if (!st2->priv_data)\n return AVERROR(ENOMEM);\n } else\n st2 = st;\n\n size2 = avio_rb32(pb);\n ret = ff_rm_read_mdpr_codecdata(s, s->pb, st2, st2->priv_data,\n size2, mime);\n if (ret < 0)\n return ret;\n }\n return 0;\n}","target":"static int rm_read_multi(AVFormatContext *s, AVIOContext *pb,\n AVStream *st, char *mime)\n{\n int number_of_streams = avio_rb16(pb);\n int number_of_mdpr;\n int i, ret;\n unsigned size2;\n for (i = 0; i 0) {\n st2 = avformat_new_stream(s, NULL);\n if (!st2) {\n ret = AVERROR(ENOMEM);\n return ret;\n }\n st2->id = st->id + (i<<16);\n st2->codecpar->bit_rate = st->codecpar->bit_rate;\n st2->start_time = st->start_time;\n st2->duration = st->duration;\n st2->codecpar->codec_type = AVMEDIA_TYPE_DATA;\n st2->priv_data = ff_rm_alloc_rmstream();\n if (!st2->priv_data)\n return AVERROR(ENOMEM);\n } else\n st2 = st;\n\n size2 = avio_rb32(pb);\n ret = ff_rm_read_mdpr_codecdata(s, s->pb, st2, st2->priv_data,\n size2, NULL);\n if (ret < 0)\n return ret;\n }\n return 0;\n}","lang":"c","vul_type":"cwe-416","target_token_count":374,"sven_meta":{"func_name":"rm_read_multi","file_name":"libavformat/rmdec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/a7e032a277452366771951e29fd0bf2bd5c029f0","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#38-285a1a2f364b","input":"vips_foreign_load_gif_scan_image( VipsForeignLoadGif *gif ) \n{\n\tVipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gif );\n\tGifFileType *file = gif->file;\n\tColorMapObject *map = file->Image.ColorMap ?\n\t\tfile->Image.ColorMap : file->SColorMap;\n\n\tGifByteType *extension;\n\n\tif( DGifGetImageDesc( gif->file ) == GIF_ERROR ) {\n\t\tvips_foreign_load_gif_error( gif ); \n\t\treturn( -1 );\n\t}\n\n\t/* Check that the frame looks sane. Perhaps giflib checks\n\t * this for us.\n\t */\n\tif( file->Image.Left < 0 ||\n\t\tfile->Image.Width < 1 ||\n\t\tfile->Image.Width > 10000 ||\n\t\tfile->Image.Left + file->Image.Width > file->SWidth ||\n\t\tfile->Image.Top < 0 ||\n\t\tfile->Image.Height < 1 ||\n\t\tfile->Image.Height > 10000 ||\n\t\tfile->Image.Top + file->Image.Height > file->SHeight ) {\n\t\tvips_error( class->nickname, \"%s\", _( \"bad frame size\" ) ); \n\t\treturn( -1 ); \n\t}\n\n\t/* Test for a non-greyscale colourmap for this frame.\n\t */\n\tif( !gif->has_colour &&\n\t\tmap ) {\n\t\tint i;\n\n\t\tfor( i = 0; i < map->ColorCount; i++ ) \n\t\t\tif( map->Colors[i].Red != map->Colors[i].Green ||\n\t\t\t\tmap->Colors[i].Green != map->Colors[i].Blue ) {\n\t\t\t\tgif->has_colour = TRUE;\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\n\t/* Step over compressed image data.\n\t */\n\tdo {\n\t\tif( vips_foreign_load_gif_code_next( gif, &extension ) ) \n\t\t\treturn( -1 );\n\t} while( extension != NULL );\n\n\treturn( 0 );\n}","target":"vips_foreign_load_gif_scan_image( VipsForeignLoadGif *gif ) \n{\n\tVipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gif );\n\tGifFileType *file = gif->file;\n\n\tColorMapObject *map;\n\tGifByteType *extension;\n\n\tif( DGifGetImageDesc( gif->file ) == GIF_ERROR ) {\n\t\tvips_foreign_load_gif_error( gif ); \n\t\treturn( -1 );\n\t}\n\n\t/* Check that the frame looks sane. Perhaps giflib checks\n\t * this for us.\n\t */\n\tif( file->Image.Left < 0 ||\n\t\tfile->Image.Width < 1 ||\n\t\tfile->Image.Width > 10000 ||\n\t\tfile->Image.Left + file->Image.Width > file->SWidth ||\n\t\tfile->Image.Top < 0 ||\n\t\tfile->Image.Height < 1 ||\n\t\tfile->Image.Height > 10000 ||\n\t\tfile->Image.Top + file->Image.Height > file->SHeight ) {\n\t\tvips_error( class->nickname, \"%s\", _( \"bad frame size\" ) ); \n\t\treturn( -1 ); \n\t}\n\n\t/* Test for a non-greyscale colourmap for this frame.\n\t */\n\tmap = file->Image.ColorMap ? file->Image.ColorMap : file->SColorMap;\n\tif( !gif->has_colour &&\n\t\tmap ) {\n\t\tint i;\n\n\t\tfor( i = 0; i < map->ColorCount; i++ ) \n\t\t\tif( map->Colors[i].Red != map->Colors[i].Green ||\n\t\t\t\tmap->Colors[i].Green != map->Colors[i].Blue ) {\n\t\t\t\tgif->has_colour = TRUE;\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\n\t/* Step over compressed image data.\n\t */\n\tdo {\n\t\tif( vips_foreign_load_gif_code_next( gif, &extension ) ) \n\t\t\treturn( -1 );\n\t} while( extension != NULL );\n\n\treturn( 0 );\n}","lang":"c","vul_type":"cwe-416","target_token_count":416,"sven_meta":{"func_name":"vips_foreign_load_gif_scan_image","file_name":"libvips/foreign/gifload.c","commit_link":"github.com/libvips/libvips/commit/ce684dd008532ea0bf9d4a1d89bacb35f4a83f4d","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#44-8d0abf8ced87","input":"static void *__ns_get_path(struct path *path, struct ns_common *ns)\n{\n\tstruct vfsmount *mnt = nsfs_mnt;\n\tstruct qstr qname = { .name = \"\", };\n\tstruct dentry *dentry;\n\tstruct inode *inode;\n\tunsigned long d;\n\n\trcu_read_lock();\n\td = atomic_long_read(&ns->stashed);\n\tif (!d)\n\t\tgoto slow;\n\tdentry = (struct dentry *)d;\n\tif (!lockref_get_not_dead(&dentry->d_lockref))\n\t\tgoto slow;\n\trcu_read_unlock();\n\tns->ops->put(ns);\ngot_it:\n\tpath->mnt = mntget(mnt);\n\tpath->dentry = dentry;\n\treturn NULL;\nslow:\n\trcu_read_unlock();\n\tinode = new_inode_pseudo(mnt->mnt_sb);\n\tif (!inode) {\n\t\tns->ops->put(ns);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}\n\tinode->i_ino = ns->inum;\n\tinode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);\n\tinode->i_flags |= S_IMMUTABLE;\n\tinode->i_mode = S_IFREG | S_IRUGO;\n\tinode->i_fop = &ns_file_operations;\n\tinode->i_private = ns;\n\n\tdentry = d_alloc_pseudo(mnt->mnt_sb, &qname);\n\tif (!dentry) {\n\t\tiput(inode);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}\n\td_instantiate(dentry, inode);\n\tdentry->d_fsdata = (void *)ns->ops;\n\td = atomic_long_cmpxchg(&ns->stashed, 0, (unsigned long)dentry);\n\tif (d) {\n\t\td_delete(dentry);\t/* make sure ->d_prune() does nothing */\n\t\tdput(dentry);\n\t\tcpu_relax();\n\t\treturn ERR_PTR(-EAGAIN);\n\t}\n\tgoto got_it;\n}","target":"static void *__ns_get_path(struct path *path, struct ns_common *ns)\n{\n\tstruct vfsmount *mnt = nsfs_mnt;\n\tstruct qstr qname = { .name = \"\", };\n\tstruct dentry *dentry;\n\tstruct inode *inode;\n\tunsigned long d;\n\n\trcu_read_lock();\n\td = atomic_long_read(&ns->stashed);\n\tif (!d)\n\t\tgoto slow;\n\tdentry = (struct dentry *)d;\n\tif (!lockref_get_not_dead(&dentry->d_lockref))\n\t\tgoto slow;\n\trcu_read_unlock();\n\tns->ops->put(ns);\ngot_it:\n\tpath->mnt = mntget(mnt);\n\tpath->dentry = dentry;\n\treturn NULL;\nslow:\n\trcu_read_unlock();\n\tinode = new_inode_pseudo(mnt->mnt_sb);\n\tif (!inode) {\n\t\tns->ops->put(ns);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}\n\tinode->i_ino = ns->inum;\n\tinode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);\n\tinode->i_flags |= S_IMMUTABLE;\n\tinode->i_mode = S_IFREG | S_IRUGO;\n\tinode->i_fop = &ns_file_operations;\n\tinode->i_private = ns;\n\n\tdentry = d_alloc_pseudo(mnt->mnt_sb, &qname);\n\tif (!dentry) {\n\t\tiput(inode);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}\n\td_instantiate(dentry, inode);\n\tdentry->d_flags |= DCACHE_RCUACCESS;\n\tdentry->d_fsdata = (void *)ns->ops;\n\td = atomic_long_cmpxchg(&ns->stashed, 0, (unsigned long)dentry);\n\tif (d) {\n\t\td_delete(dentry);\t/* make sure ->d_prune() does nothing */\n\t\tdput(dentry);\n\t\tcpu_relax();\n\t\treturn ERR_PTR(-EAGAIN);\n\t}\n\tgoto got_it;\n}","lang":"c","vul_type":"cwe-416","target_token_count":411,"sven_meta":{"func_name":"__ns_get_path","file_name":"fs/nsfs.c","commit_link":"github.com/torvalds/linux/commit/073c516ff73557a8f7315066856c04b50383ac34","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#45-e7f448494cd5","input":"PHP_FUNCTION(unserialize)\n{\n\tchar *buf = NULL;\n\tsize_t buf_len;\n\tconst unsigned char *p;\n\tphp_unserialize_data_t var_hash;\n\tzval *options = NULL, *classes = NULL;\n\tHashTable *class_hash = NULL;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS(), \"s|a\", &buf, &buf_len, &options) == FAILURE) {\n\t\tRETURN_FALSE;\n\t}\n\n\tif (buf_len == 0) {\n\t\tRETURN_FALSE;\n\t}\n\n\tp = (const unsigned char*) buf;\n\tPHP_VAR_UNSERIALIZE_INIT(var_hash);\n\tif(options != NULL) {\n\t\tclasses = zend_hash_str_find(Z_ARRVAL_P(options), \"allowed_classes\", sizeof(\"allowed_classes\")-1);\n\t\tif(classes && (Z_TYPE_P(classes) == IS_ARRAY || !zend_is_true(classes))) {\n\t\t\tALLOC_HASHTABLE(class_hash);\n\t\t\tzend_hash_init(class_hash, (Z_TYPE_P(classes) == IS_ARRAY)?zend_hash_num_elements(Z_ARRVAL_P(classes)):0, NULL, NULL, 0);\n\t\t}\n\t\tif(class_hash && Z_TYPE_P(classes) == IS_ARRAY) {\n\t\t\tzval *entry;\n\t\t\tzend_string *lcname;\n\n\t\t\tZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(classes), entry) {\n\t\t\t\tconvert_to_string_ex(entry);\n\t\t\t\tlcname = zend_string_tolower(Z_STR_P(entry));\n\t\t\t\tzend_hash_add_empty_element(class_hash, lcname);\n\t\t zend_string_release(lcname);\n\t\t\t} ZEND_HASH_FOREACH_END();\n\t\t}\n\t}\n\n\tif (!php_var_unserialize_ex(return_value, &p, p + buf_len, &var_hash, class_hash)) {\n\t\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\t\tif (class_hash) {\n\t\t\tzend_hash_destroy(class_hash);\n\t\t\tFREE_HASHTABLE(class_hash);\n\t\t}\n\t\tzval_ptr_dtor(return_value);\n\t\tif (!EG(exception)) {\n\t\t\tphp_error_docref(NULL, E_NOTICE, \"Error at offset \" ZEND_LONG_FMT \" of %zd bytes\",\n\t\t\t\t(zend_long)((char*)p - buf), buf_len);\n\t\t}\n\t\tRETURN_FALSE;\n\t}\n\t/* We should keep an reference to return_value to prevent it from being dtor\n\t in case nesting calls to unserialize */\n\tvar_push_dtor(&var_hash, return_value);\n\n\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\tif (class_hash) {\n\t\tzend_hash_destroy(class_hash);\n\t\tFREE_HASHTABLE(class_hash);\n\t}\n}","target":"PHP_FUNCTION(unserialize)\n{\n\tchar *buf = NULL;\n\tsize_t buf_len;\n\tconst unsigned char *p;\n\tphp_unserialize_data_t var_hash;\n\tzval *options = NULL, *classes = NULL;\n\tzval *retval;\n\tHashTable *class_hash = NULL;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS(), \"s|a\", &buf, &buf_len, &options) == FAILURE) {\n\t\tRETURN_FALSE;\n\t}\n\n\tif (buf_len == 0) {\n\t\tRETURN_FALSE;\n\t}\n\n\tp = (const unsigned char*) buf;\n\tPHP_VAR_UNSERIALIZE_INIT(var_hash);\n\tif(options != NULL) {\n\t\tclasses = zend_hash_str_find(Z_ARRVAL_P(options), \"allowed_classes\", sizeof(\"allowed_classes\")-1);\n\t\tif(classes && (Z_TYPE_P(classes) == IS_ARRAY || !zend_is_true(classes))) {\n\t\t\tALLOC_HASHTABLE(class_hash);\n\t\t\tzend_hash_init(class_hash, (Z_TYPE_P(classes) == IS_ARRAY)?zend_hash_num_elements(Z_ARRVAL_P(classes)):0, NULL, NULL, 0);\n\t\t}\n\t\tif(class_hash && Z_TYPE_P(classes) == IS_ARRAY) {\n\t\t\tzval *entry;\n\t\t\tzend_string *lcname;\n\n\t\t\tZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(classes), entry) {\n\t\t\t\tconvert_to_string_ex(entry);\n\t\t\t\tlcname = zend_string_tolower(Z_STR_P(entry));\n\t\t\t\tzend_hash_add_empty_element(class_hash, lcname);\n\t\t zend_string_release(lcname);\n\t\t\t} ZEND_HASH_FOREACH_END();\n\t\t}\n\t}\n\n\tretval = var_tmp_var(&var_hash);\n\tif (!php_var_unserialize_ex(retval, &p, p + buf_len, &var_hash, class_hash)) {\n\t\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\t\tif (class_hash) {\n\t\t\tzend_hash_destroy(class_hash);\n\t\t\tFREE_HASHTABLE(class_hash);\n\t\t}\n\t\tif (!EG(exception)) {\n\t\t\tphp_error_docref(NULL, E_NOTICE, \"Error at offset \" ZEND_LONG_FMT \" of %zd bytes\",\n\t\t\t\t(zend_long)((char*)p - buf), buf_len);\n\t\t}\n\t\tRETURN_FALSE;\n\t}\n\n\tZVAL_COPY(return_value, retval);\n\n\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\tif (class_hash) {\n\t\tzend_hash_destroy(class_hash);\n\t\tFREE_HASHTABLE(class_hash);\n\t}\n}","lang":"c","vul_type":"cwe-416","target_token_count":501,"sven_meta":{"func_name":"PHP_FUNCTION","file_name":"ext/standard/var.c","commit_link":"github.com/php/php-src/commit/b2af4e8868726a040234de113436c6e4f6372d17","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#52-a4ddb36a5478","input":"static void ndpi_reset_packet_line_info(struct ndpi_packet_struct *packet) {\n packet->parsed_lines = 0, packet->empty_line_position_set = 0, packet->host_line.ptr = NULL,\n packet->host_line.len = 0, packet->referer_line.ptr = NULL, packet->referer_line.len = 0,\n packet->content_line.ptr = NULL, packet->content_line.len = 0, packet->accept_line.ptr = NULL,\n packet->accept_line.len = 0, packet->user_agent_line.ptr = NULL, packet->user_agent_line.len = 0,\n packet->http_url_name.ptr = NULL, packet->http_url_name.len = 0, packet->http_encoding.ptr = NULL,\n packet->http_encoding.len = 0, packet->http_transfer_encoding.ptr = NULL, packet->http_transfer_encoding.len = 0,\n packet->http_contentlen.ptr = NULL, packet->http_contentlen.len = 0, packet->http_cookie.ptr = NULL,\n packet->http_cookie.len = 0, packet->http_origin.len = 0, packet->http_origin.ptr = NULL,\n packet->http_x_session_type.ptr = NULL, packet->http_x_session_type.len = 0, packet->server_line.ptr = NULL,\n packet->server_line.len = 0, packet->http_method.ptr = NULL, packet->http_method.len = 0,\n packet->http_response.ptr = NULL, packet->http_response.len = 0, packet->http_num_headers = 0;\n}","target":"static void ndpi_reset_packet_line_info(struct ndpi_packet_struct *packet) {\n packet->parsed_lines = 0, packet->empty_line_position_set = 0, packet->host_line.ptr = NULL,\n packet->host_line.len = 0, packet->referer_line.ptr = NULL, packet->referer_line.len = 0,\n packet->content_line.ptr = NULL, packet->content_line.len = 0, packet->accept_line.ptr = NULL,\n packet->accept_line.len = 0, packet->user_agent_line.ptr = NULL, packet->user_agent_line.len = 0,\n packet->http_url_name.ptr = NULL, packet->http_url_name.len = 0, packet->http_encoding.ptr = NULL,\n packet->http_encoding.len = 0, packet->http_transfer_encoding.ptr = NULL, packet->http_transfer_encoding.len = 0,\n packet->http_contentlen.ptr = NULL, packet->http_contentlen.len = 0, packet->content_disposition_line.ptr = NULL,\n packet->content_disposition_line.len = 0, packet->http_cookie.ptr = NULL,\n packet->http_cookie.len = 0, packet->http_origin.len = 0, packet->http_origin.ptr = NULL,\n packet->http_x_session_type.ptr = NULL, packet->http_x_session_type.len = 0, packet->server_line.ptr = NULL,\n packet->server_line.len = 0, packet->http_method.ptr = NULL, packet->http_method.len = 0,\n packet->http_response.ptr = NULL, packet->http_response.len = 0, packet->http_num_headers = 0;\n}","lang":"c","vul_type":"cwe-416","target_token_count":345,"sven_meta":{"func_name":"ndpi_reset_packet_line_info","file_name":"src/lib/ndpi_main.c","commit_link":"github.com/ntop/nDPI/commit/6a9f5e4f7c3fd5ddab3e6727b071904d76773952","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#55-c1d2c18f1f94","input":"mrb_io_initialize_copy(mrb_state *mrb, mrb_value copy)\n{\n mrb_value orig;\n mrb_value buf;\n struct mrb_io *fptr_copy;\n struct mrb_io *fptr_orig;\n mrb_bool failed = TRUE;\n\n mrb_get_args(mrb, \"o\", &orig);\n fptr_copy = (struct mrb_io *)DATA_PTR(copy);\n if (fptr_copy != NULL) {\n fptr_finalize(mrb, fptr_copy, FALSE);\n mrb_free(mrb, fptr_copy);\n }\n fptr_copy = (struct mrb_io *)mrb_io_alloc(mrb);\n fptr_orig = io_get_open_fptr(mrb, orig);\n\n DATA_TYPE(copy) = &mrb_io_type;\n DATA_PTR(copy) = fptr_copy;\n\n buf = mrb_iv_get(mrb, orig, mrb_intern_cstr(mrb, \"@buf\"));\n mrb_iv_set(mrb, copy, mrb_intern_cstr(mrb, \"@buf\"), buf);\n\n fptr_copy->fd = mrb_dup(mrb, fptr_orig->fd, &failed);\n if (failed) {\n mrb_sys_fail(mrb, 0);\n }\n mrb_fd_cloexec(mrb, fptr_copy->fd);\n\n if (fptr_orig->fd2 != -1) {\n fptr_copy->fd2 = mrb_dup(mrb, fptr_orig->fd2, &failed);\n if (failed) {\n close(fptr_copy->fd);\n mrb_sys_fail(mrb, 0);\n }\n mrb_fd_cloexec(mrb, fptr_copy->fd2);\n }\n\n fptr_copy->pid = fptr_orig->pid;\n fptr_copy->readable = fptr_orig->readable;\n fptr_copy->writable = fptr_orig->writable;\n fptr_copy->sync = fptr_orig->sync;\n fptr_copy->is_socket = fptr_orig->is_socket;\n\n return copy;\n}","target":"mrb_io_initialize_copy(mrb_state *mrb, mrb_value copy)\n{\n mrb_value orig;\n mrb_value buf;\n struct mrb_io *fptr_copy;\n struct mrb_io *fptr_orig;\n mrb_bool failed = TRUE;\n\n mrb_get_args(mrb, \"o\", &orig);\n fptr_orig = io_get_open_fptr(mrb, orig);\n fptr_copy = (struct mrb_io *)DATA_PTR(copy);\n if (fptr_copy != NULL) {\n fptr_finalize(mrb, fptr_copy, FALSE);\n mrb_free(mrb, fptr_copy);\n }\n fptr_copy = (struct mrb_io *)mrb_io_alloc(mrb);\n\n DATA_TYPE(copy) = &mrb_io_type;\n DATA_PTR(copy) = fptr_copy;\n\n buf = mrb_iv_get(mrb, orig, mrb_intern_cstr(mrb, \"@buf\"));\n mrb_iv_set(mrb, copy, mrb_intern_cstr(mrb, \"@buf\"), buf);\n\n fptr_copy->fd = mrb_dup(mrb, fptr_orig->fd, &failed);\n if (failed) {\n mrb_sys_fail(mrb, 0);\n }\n mrb_fd_cloexec(mrb, fptr_copy->fd);\n\n if (fptr_orig->fd2 != -1) {\n fptr_copy->fd2 = mrb_dup(mrb, fptr_orig->fd2, &failed);\n if (failed) {\n close(fptr_copy->fd);\n mrb_sys_fail(mrb, 0);\n }\n mrb_fd_cloexec(mrb, fptr_copy->fd2);\n }\n\n fptr_copy->pid = fptr_orig->pid;\n fptr_copy->readable = fptr_orig->readable;\n fptr_copy->writable = fptr_orig->writable;\n fptr_copy->sync = fptr_orig->sync;\n fptr_copy->is_socket = fptr_orig->is_socket;\n\n return copy;\n}","lang":"c","vul_type":"cwe-416","target_token_count":423,"sven_meta":{"func_name":"mrb_io_initialize_copy","file_name":"mrbgems/mruby-io/src/io.c","commit_link":"github.com/mruby/mruby/commit/b51b21fc63c9805862322551387d9036f2b63433","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-022#1-a631ff381000","input":" def zmi_page_request(self, *args, **kwargs):\r\n request = self.REQUEST\r\n RESPONSE = request.RESPONSE\r\n SESSION = request.SESSION\r\n self._zmi_page_request()\r\n RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822())\r\n RESPONSE.setHeader('Cache-Control', 'no-cache')\r\n RESPONSE.setHeader('Pragma', 'no-cache')\r\n RESPONSE.setHeader('Content-Type', 'text/html;charset=%s'%request['ZMS_CHARSET'])\r\n if not request.get( 'preview'):\r\n request.set( 'preview','preview')\r\n langs = self.getLanguages(request)\r\n if request.get('lang') not in langs:\r\n request.set('lang',langs[0])\r\n if request.get('manage_lang') not in self.getLocale().get_manage_langs():\r\n request.set('manage_lang',self.get_manage_lang())\r\n if not request.get('manage_tabs_message'):\r\n request.set( 'manage_tabs_message',self.getConfProperty('ZMS.manage_tabs_message',''))\r\n # manage_system\r\n if request.form.has_key('zmi-manage-system'):\r\n request.SESSION.set('zmi-manage-system',int(request.get('zmi-manage-system')))\r\n # avoid declarative urls\r\n physical_path = self.getPhysicalPath()\r\n path_to_handle = request['URL0'][len(request['BASE0']):].split('/')\r\n path = path_to_handle[:-1]\r\n if len(filter(lambda x:x.find('.')>0 or x.startswith('manage_'),path))==0:\r\n for i in range(len(path)):\r\n if path[:-(i+1)] != physical_path[:-(i+1)]:\r\n path[:-(i+1)] = physical_path[:-(i+1)]\r\n new_path = path+[path_to_handle[-1]]\r\n if path_to_handle != new_path:\r\n request.RESPONSE.redirect('/'.join(new_path))","target":" def zmi_page_request(self, *args, **kwargs):\r\n request = self.REQUEST\r\n RESPONSE = request.RESPONSE\r\n SESSION = request.SESSION\r\n self._zmi_page_request()\r\n RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822())\r\n RESPONSE.setHeader('Cache-Control', 'no-cache')\r\n RESPONSE.setHeader('Pragma', 'no-cache')\r\n RESPONSE.setHeader('Content-Type', 'text/html;charset=%s'%request['ZMS_CHARSET'])\r\n if not request.get( 'preview'):\r\n request.set( 'preview','preview')\r\n langs = self.getLanguages(request)\r\n if request.get('lang') not in langs:\r\n request.set('lang',langs[0])\r\n if request.get('manage_lang') not in self.getLocale().get_manage_langs():\r\n request.set('manage_lang',self.get_manage_lang())\r\n if not request.get('manage_tabs_message'):\r\n request.set( 'manage_tabs_message',self.getConfProperty('ZMS.manage_tabs_message',''))\r\n # manage_system\r\n if request.form.has_key('zmi-manage-system'):\r\n request.SESSION.set('zmi-manage-system',int(request.get('zmi-manage-system')))\r\n # avoid declarative urls\r\n physical_path = self.getPhysicalPath()\r\n path_to_handle = request['URL0'][len(request['BASE0']):].split('/')\r\n path = path_to_handle[:-1]\r\n if self.getDocumentElement().id in path and len(filter(lambda x:x.find('.')>0 or x.startswith('manage_'),path))==0:\r\n for i in range(len(path)):\r\n if path[:-(i+1)] != physical_path[:-(i+1)]:\r\n path[:-(i+1)] = physical_path[:-(i+1)]\r\n new_path = path+[path_to_handle[-1]]\r\n if path_to_handle != new_path:\r\n request.RESPONSE.redirect('/'.join(new_path))","lang":"python","vul_type":"cwe-022","target_token_count":419,"sven_meta":{"func_name":"zmi_page_request","file_name":"ZMSItem.py","commit_link":"github.com/zms-publishing/zms4/commit/3f28620d475220dfdb06f79787158ac50727c61a","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#15-76bee86ce6de","input":" def get_files(self, submit_id, password=None, astree=False):\n \"\"\"\n Returns files from a submitted analysis.\n @param password: The password to unlock container archives with\n @param astree: sflock option; determines the format in which the files are returned\n @return: A tree of files\n \"\"\"\n submit = Database().view_submit(submit_id)\n files, duplicates = [], []\n\n for data in submit.data[\"data\"]:\n if data[\"type\"] == \"file\":\n filename = Storage.get_filename_from_path(data[\"data\"])\n filepath = os.path.join(submit.tmp_path, data[\"data\"])\n filedata = open(filepath, \"rb\").read()\n\n unpacked = sflock.unpack(\n filepath=filename, contents=filedata,\n password=password, duplicates=duplicates\n )\n\n if astree:\n unpacked = unpacked.astree()\n\n files.append(unpacked)\n elif data[\"type\"] == \"url\":\n files.append({\n \"filename\": data[\"data\"],\n \"filepath\": \"\",\n \"relapath\": \"\",\n \"selected\": True,\n \"size\": 0,\n \"type\": \"url\",\n \"package\": \"ie\",\n \"extrpath\": [],\n \"duplicate\": False,\n \"children\": [],\n \"mime\": \"text/html\",\n \"finger\": {\n \"magic_human\": \"url\",\n \"magic\": \"url\"\n }\n })\n else:\n raise RuntimeError(\n \"Unknown data entry type: %s\" % data[\"type\"]\n )\n\n return {\n \"files\": files,\n \"path\": submit.tmp_path,\n }","target":" def get_files(self, submit_id, password=None, astree=False):\n \"\"\"\n Returns files from a submitted analysis.\n @param password: The password to unlock container archives with\n @param astree: sflock option; determines the format in which the files are returned\n @return: A tree of files\n \"\"\"\n submit = Database().view_submit(submit_id)\n files, duplicates = [], []\n\n for data in submit.data[\"data\"]:\n if data[\"type\"] == \"file\":\n filename = Storage.get_filename_from_path(data[\"data\"])\n filepath = os.path.join(submit.tmp_path, filename)\n\n unpacked = sflock.unpack(\n filepath=filepath, password=password, duplicates=duplicates\n )\n\n if astree:\n unpacked = unpacked.astree(sanitize=True)\n\n files.append(unpacked)\n elif data[\"type\"] == \"url\":\n files.append({\n \"filename\": data[\"data\"],\n \"filepath\": \"\",\n \"relapath\": \"\",\n \"selected\": True,\n \"size\": 0,\n \"type\": \"url\",\n \"package\": \"ie\",\n \"extrpath\": [],\n \"duplicate\": False,\n \"children\": [],\n \"mime\": \"text/html\",\n \"finger\": {\n \"magic_human\": \"url\",\n \"magic\": \"url\"\n }\n })\n else:\n raise RuntimeError(\n \"Unknown data entry type: %s\" % data[\"type\"]\n )\n\n return files","lang":"python","vul_type":"cwe-022","target_token_count":314,"sven_meta":{"func_name":"get_files","file_name":"cuckoo/core/submit.py","commit_link":"github.com/cuckoosandbox/cuckoo/commit/168cabf86730d56b7fa319278bf0f0034052666a","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#31-cc0c10d323d2","input":"header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)\n{\n struct ImapMbox mx;\n struct Url url;\n char cachepath[PATH_MAX];\n char mbox[PATH_MAX];\n\n if (path)\n imap_cachepath(idata, path, mbox, sizeof(mbox));\n else\n {\n if (!idata->ctx || imap_parse_path(idata->ctx->path, &mx) < 0)\n return NULL;\n\n imap_cachepath(idata, mx.mbox, mbox, sizeof(mbox));\n FREE(&mx.mbox);\n }\n\n mutt_account_tourl(&idata->conn->account, &url);\n url.path = mbox;\n url_tostring(&url, cachepath, sizeof(cachepath), U_PATH);\n\n return mutt_hcache_open(HeaderCache, cachepath, imap_hcache_namer);\n}","target":"header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)\n{\n struct ImapMbox mx;\n struct Url url;\n char cachepath[PATH_MAX];\n char mbox[PATH_MAX];\n\n if (path)\n imap_cachepath(idata, path, mbox, sizeof(mbox));\n else\n {\n if (!idata->ctx || imap_parse_path(idata->ctx->path, &mx) < 0)\n return NULL;\n\n imap_cachepath(idata, mx.mbox, mbox, sizeof(mbox));\n FREE(&mx.mbox);\n }\n\n if (strstr(mbox, \"/../\") || (strcmp(mbox, \"..\") == 0) || (strncmp(mbox, \"../\", 3) == 0))\n return NULL;\n size_t len = strlen(mbox);\n if ((len > 3) && (strcmp(mbox + len - 3, \"/..\") == 0))\n return NULL;\n\n mutt_account_tourl(&idata->conn->account, &url);\n url.path = mbox;\n url_tostring(&url, cachepath, sizeof(cachepath), U_PATH);\n\n return mutt_hcache_open(HeaderCache, cachepath, imap_hcache_namer);\n}","lang":"c","vul_type":"cwe-022","target_token_count":278,"sven_meta":{"func_name":"imap_hcache_open","file_name":"imap/util.c","commit_link":"github.com/neomutt/neomutt/commit/57971dba06346b2d7179294f4528b8d4427a7c5d","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#36-cfa530b836e2","input":"async def save(request):\n # TODO csrf\n data = await request.post()\n item = Item(data['src'])\n\n # Update name\n new_src = data.get('new_src')\n if new_src and new_src != data['src']:\n # don't need to worry about html unquote\n shutil.move(item.abspath, settings.STORAGE_DIR + new_src)\n old_backup_abspath = item.backup_abspath\n item = Item(new_src)\n if os.path.isfile(old_backup_abspath):\n shutil.move(old_backup_abspath, item.backup_abspath)\n\n # Update meta\n for field in item.FORM:\n # TODO handle .repeatable (keywords)\n item.meta[field] = [data.get(field, '')]\n\n if settings.SAVE_ORIGINALS and not os.path.isfile(item.backup_abspath):\n shutil.copyfile(item.abspath, item.backup_abspath)\n\n # WISHLIST don't write() if nothing changed\n item.meta.write()\n\n return web.Response(\n status=200,\n body=json.dumps(item.get_form_fields()).encode('utf8'),\n content_type='application/json',\n )","target":"async def save(request):\n # TODO csrf\n data = await request.post()\n item = Item(data['src'])\n\n # Update name\n new_src = data.get('new_src')\n if new_src:\n new_abspath = os.path.abspath(settings.STORAGE_DIR + new_src)\n if not new_abspath.startswith(settings.STORAGE_DIR):\n return web.Response(status=400, body=b'Invalid Request')\n\n if new_abspath != item.abspath:\n shutil.move(item.abspath, new_abspath)\n old_backup_abspath = item.backup_abspath\n item = Item(new_src)\n if os.path.isfile(old_backup_abspath):\n shutil.move(old_backup_abspath, item.backup_abspath)\n\n # Update meta\n for field in item.FORM:\n # TODO handle .repeatable (keywords)\n item.meta[field] = [data.get(field, '')]\n\n if settings.SAVE_ORIGINALS and not os.path.isfile(item.backup_abspath):\n shutil.copyfile(item.abspath, item.backup_abspath)\n\n # WISHLIST don't write() if nothing changed\n item.meta.write()\n\n return web.Response(\n status=200,\n body=json.dumps(item.get_form_fields()).encode('utf8'),\n content_type='application/json',\n )","lang":"python","vul_type":"cwe-022","target_token_count":269,"sven_meta":{"func_name":"save","file_name":"gallery/gallery.py","commit_link":"github.com/crccheck/gallery-cms/commit/60dec5c580a779ae27824ed54cb113eca25afdc0","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#40-4f5ccce9780b","input":"def new_goal():\n \"\"\"\n new goal\n \"\"\"\n\n goals_dir_check()\n\n click.echo(chalk.blue('Input a single-word name of the goal:'))\n goal_name = input().strip()\n\n if goal_name_exists(goal_name):\n click.echo(chalk.red(\n 'A goal with this name already exists. Please type \"yoda goals view\" to see a list of existing goals'))\n else:\n click.echo(chalk.blue('Input description of the goal:'))\n text = input().strip()\n\n click.echo(chalk.blue('Input due date for the goal (YYYY-MM-DD):'))\n deadline = input().strip()\n\n if os.path.isfile(GOALS_CONFIG_FILE_PATH):\n setup_data = dict(\n name=goal_name,\n text=text,\n deadline=deadline,\n status=0\n )\n append_data_into_file(setup_data, GOALS_CONFIG_FILE_PATH)\n else:\n setup_data = dict(\n entries=[\n dict(\n name=goal_name,\n text=text,\n deadline=deadline,\n status=0\n )\n ]\n )\n input_data(setup_data, GOALS_CONFIG_FILE_PATH)\n\n input_data(dict(entries=[]), get_goal_file_path(goal_name))","target":"def new_goal():\n \"\"\"\n new goal\n \"\"\"\n\n goals_dir_check()\n\n goal_name_not_ok = True\n\n click.echo(chalk.blue('Input a single-word name of the goal:'))\n while goal_name_not_ok:\n goal_name = input().strip()\n if goal_name.isalnum():\n goal_name_not_ok = False\n else:\n click.echo(chalk.red('Only alphanumeric characters can be used! Please input the goal name:'))\n\n if goal_name_exists(goal_name):\n click.echo(chalk.red(\n 'A goal with this name already exists. Please type \"yoda goals view\" to see a list of existing goals'))\n else:\n click.echo(chalk.blue('Input description of the goal:'))\n text = input().strip()\n\n click.echo(chalk.blue('Input due date for the goal (YYYY-MM-DD):'))\n incorrect_date_format = True\n while incorrect_date_format:\n deadline = input().strip()\n try:\n date_str = datetime.datetime.strptime(deadline, '%Y-%m-%d').strftime('%Y-%m-%d')\n if date_str != deadline:\n raise ValueError\n incorrect_date_format = False\n except ValueError:\n click.echo(chalk.red(\"Incorrect data format, should be YYYY-MM-DD. Please repeat:\"))\n\n if os.path.isfile(GOALS_CONFIG_FILE_PATH):\n setup_data = dict(\n name=goal_name,\n text=text,\n deadline=deadline,\n status=0\n )\n append_data_into_file(setup_data, GOALS_CONFIG_FILE_PATH)\n else:\n setup_data = dict(\n entries=[\n dict(\n name=goal_name,\n text=text,\n deadline=deadline,\n status=0\n )\n ]\n )\n input_data(setup_data, GOALS_CONFIG_FILE_PATH)\n\n input_data(dict(entries=[]), get_goal_file_path(goal_name))","lang":"python","vul_type":"cwe-022","target_token_count":388,"sven_meta":{"func_name":"new_goal","file_name":"modules/goals.py","commit_link":"github.com/yoda-pa/yoda/commit/263946316041601de75638ee303a892f2652cf40","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#41-1868f634d06d","input":"def _inject_admin_password_into_fs(admin_passwd, fs, execute=None):\n \"\"\"Set the root password to admin_passwd\n\n admin_password is a root password\n fs is the path to the base of the filesystem into which to inject\n the key.\n\n This method modifies the instance filesystem directly,\n and does not require a guest agent running in the instance.\n\n \"\"\"\n # The approach used here is to copy the password and shadow\n # files from the instance filesystem to local files, make any\n # necessary changes, and then copy them back.\n\n admin_user = 'root'\n\n fd, tmp_passwd = tempfile.mkstemp()\n os.close(fd)\n fd, tmp_shadow = tempfile.mkstemp()\n os.close(fd)\n\n utils.execute('cp', os.path.join(fs, 'etc', 'passwd'), tmp_passwd,\n run_as_root=True)\n utils.execute('cp', os.path.join(fs, 'etc', 'shadow'), tmp_shadow,\n run_as_root=True)\n _set_passwd(admin_user, admin_passwd, tmp_passwd, tmp_shadow)\n utils.execute('cp', tmp_passwd, os.path.join(fs, 'etc', 'passwd'),\n run_as_root=True)\n os.unlink(tmp_passwd)\n utils.execute('cp', tmp_shadow, os.path.join(fs, 'etc', 'shadow'),\n run_as_root=True)\n os.unlink(tmp_shadow)","target":"def _inject_admin_password_into_fs(admin_passwd, fs, execute=None):\n \"\"\"Set the root password to admin_passwd\n\n admin_password is a root password\n fs is the path to the base of the filesystem into which to inject\n the key.\n\n This method modifies the instance filesystem directly,\n and does not require a guest agent running in the instance.\n\n \"\"\"\n # The approach used here is to copy the password and shadow\n # files from the instance filesystem to local files, make any\n # necessary changes, and then copy them back.\n\n admin_user = 'root'\n\n fd, tmp_passwd = tempfile.mkstemp()\n os.close(fd)\n fd, tmp_shadow = tempfile.mkstemp()\n os.close(fd)\n\n passwd_path = _join_and_check_path_within_fs(fs, 'etc', 'passwd')\n shadow_path = _join_and_check_path_within_fs(fs, 'etc', 'shadow')\n\n utils.execute('cp', passwd_path, tmp_passwd, run_as_root=True)\n utils.execute('cp', shadow_path, tmp_shadow, run_as_root=True)\n _set_passwd(admin_user, admin_passwd, tmp_passwd, tmp_shadow)\n utils.execute('cp', tmp_passwd, passwd_path, run_as_root=True)\n os.unlink(tmp_passwd)\n utils.execute('cp', tmp_shadow, shadow_path, run_as_root=True)\n os.unlink(tmp_shadow)","lang":"python","vul_type":"cwe-022","target_token_count":289,"sven_meta":{"func_name":"_inject_admin_password_into_fs","file_name":"nova/virt/disk/api.py","commit_link":"github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-787#9-836517feae17","input":"idn2_to_ascii_4i (const uint32_t * input, size_t inlen, char * output, int flags)\n{\n uint32_t *input_u32;\n uint8_t *input_u8, *output_u8;\n size_t length;\n int rc;\n\n if (!input)\n {\n if (output)\n\t*output = 0;\n return IDN2_OK;\n }\n\n input_u32 = (uint32_t *) malloc ((inlen + 1) * sizeof(uint32_t));\n if (!input_u32)\n return IDN2_MALLOC;\n\n u32_cpy (input_u32, input, inlen);\n input_u32[inlen] = 0;\n\n input_u8 = u32_to_u8 (input_u32, inlen + 1, NULL, &length);\n free (input_u32);\n if (!input_u8)\n {\n if (errno == ENOMEM)\n\treturn IDN2_MALLOC;\n return IDN2_ENCODING_ERROR;\n }\n\n rc = idn2_lookup_u8 (input_u8, &output_u8, flags);\n free (input_u8);\n\n if (rc == IDN2_OK)\n {\n /* wow, this is ugly, but libidn manpage states:\n * char * out output zero terminated string that must have room for at\n * least 63 characters plus the terminating zero.\n */\n if (output)\n\tstrcpy (output, (const char *) output_u8);\n\n free(output_u8);\n }\n\n return rc;\n}","target":"idn2_to_ascii_4i (const uint32_t * input, size_t inlen, char * output, int flags)\n{\n uint32_t *input_u32;\n uint8_t *input_u8, *output_u8;\n size_t length;\n int rc;\n\n if (!input)\n {\n if (output)\n\t*output = 0;\n return IDN2_OK;\n }\n\n input_u32 = (uint32_t *) malloc ((inlen + 1) * sizeof(uint32_t));\n if (!input_u32)\n return IDN2_MALLOC;\n\n u32_cpy (input_u32, input, inlen);\n input_u32[inlen] = 0;\n\n input_u8 = u32_to_u8 (input_u32, inlen + 1, NULL, &length);\n free (input_u32);\n if (!input_u8)\n {\n if (errno == ENOMEM)\n\treturn IDN2_MALLOC;\n return IDN2_ENCODING_ERROR;\n }\n\n rc = idn2_lookup_u8 (input_u8, &output_u8, flags);\n free (input_u8);\n\n if (rc == IDN2_OK)\n {\n /* wow, this is ugly, but libidn manpage states:\n * char * out output zero terminated string that must have room for at\n * least 63 characters plus the terminating zero.\n */\n size_t len = strlen ((char *) output_u8);\n\n if (len > 63)\n {\n\t free (output_u8);\n\t return IDN2_TOO_BIG_DOMAIN;\n }\n\n if (output)\n\tstrcpy (output, (char *) output_u8);\n\n free (output_u8);\n }\n\n return rc;\n}","lang":"c","vul_type":"cwe-787","target_token_count":391,"sven_meta":{"func_name":"idn2_to_ascii_4i","file_name":"lib/lookup.c","commit_link":"github.com/libidn/libidn2/commit/e4d1558aa2c1c04a05066ee8600f37603890ba8c","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#21-7d71d71a0a22","input":"TfLiteStatus ResizeOutputTensor(TfLiteContext* context,\n const TfLiteTensor* data,\n const TfLiteTensor* segment_ids,\n TfLiteTensor* output) {\n int max_index = -1;\n const int segment_id_size = segment_ids->dims->data[0];\n if (segment_id_size > 0) {\n max_index = segment_ids->data.i32[segment_id_size - 1];\n }\n const int data_rank = NumDimensions(data);\n TfLiteIntArray* output_shape = TfLiteIntArrayCreate(NumDimensions(data));\n output_shape->data[0] = max_index + 1;\n for (int i = 1; i < data_rank; ++i) {\n output_shape->data[i] = data->dims->data[i];\n }\n return context->ResizeTensor(context, output, output_shape);\n}","target":"TfLiteStatus ResizeOutputTensor(TfLiteContext* context,\n const TfLiteTensor* data,\n const TfLiteTensor* segment_ids,\n TfLiteTensor* output) {\n // Segment ids should be of same cardinality as first input dimension and they\n // should be increasing by at most 1, from 0 (e.g., [0, 0, 1, 2, 3] is valid)\n const int segment_id_size = segment_ids->dims->data[0];\n TF_LITE_ENSURE_EQ(context, segment_id_size, data->dims->data[0]);\n int previous_segment_id = -1;\n for (int i = 0; i < segment_id_size; i++) {\n const int current_segment_id = GetTensorData(segment_ids)[i];\n if (i == 0) {\n TF_LITE_ENSURE_EQ(context, current_segment_id, 0);\n } else {\n int delta = current_segment_id - previous_segment_id;\n TF_LITE_ENSURE(context, delta == 0 || delta == 1);\n }\n previous_segment_id = current_segment_id;\n }\n\n const int max_index = previous_segment_id;\n\n const int data_rank = NumDimensions(data);\n TfLiteIntArray* output_shape = TfLiteIntArrayCreate(NumDimensions(data));\n output_shape->data[0] = max_index + 1;\n for (int i = 1; i < data_rank; ++i) {\n output_shape->data[i] = data->dims->data[i];\n }\n return context->ResizeTensor(context, output, output_shape);\n}","lang":"cpp","vul_type":"cwe-787","target_token_count":346,"sven_meta":{"func_name":"tflite::ops::builtin::segment_sum::ResizeOutputTensor","file_name":"tensorflow/lite/kernels/segment_sum.cc","commit_link":"github.com/tensorflow/tensorflow/commit/204945b19e44b57906c9344c0d00120eeeae178a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#31-fc99fe3f0b38","input":"static void handle_PORT(ctrl_t *ctrl, char *str)\n{\n\tint a, b, c, d, e, f;\n\tchar addr[INET_ADDRSTRLEN];\n\tstruct sockaddr_in sin;\n\n\tif (ctrl->data_sd > 0) {\n\t\tuev_io_stop(&ctrl->data_watcher);\n\t\tclose(ctrl->data_sd);\n\t\tctrl->data_sd = -1;\n\t}\n\n\t/* Convert PORT command's argument to IP address + port */\n\tsscanf(str, \"%d,%d,%d,%d,%d,%d\", &a, &b, &c, &d, &e, &f);\n\tsprintf(addr, \"%d.%d.%d.%d\", a, b, c, d);\n\n\t/* Check IPv4 address using inet_aton(), throw away converted result */\n\tif (!inet_aton(addr, &(sin.sin_addr))) {\n\t\tERR(0, \"Invalid address '%s' given to PORT command\", addr);\n\t\tsend_msg(ctrl->sd, \"500 Illegal PORT command.\\r\\n\");\n\t\treturn;\n\t}\n\n\tstrlcpy(ctrl->data_address, addr, sizeof(ctrl->data_address));\n\tctrl->data_port = e * 256 + f;\n\n\tDBG(\"Client PORT command accepted for %s:%d\", ctrl->data_address, ctrl->data_port);\n\tsend_msg(ctrl->sd, \"200 PORT command successful.\\r\\n\");\n}","target":"static void handle_PORT(ctrl_t *ctrl, char *str)\n{\n\tint a, b, c, d, e, f;\n\tchar addr[INET_ADDRSTRLEN];\n\tstruct sockaddr_in sin;\n\n\tif (ctrl->data_sd > 0) {\n\t\tuev_io_stop(&ctrl->data_watcher);\n\t\tclose(ctrl->data_sd);\n\t\tctrl->data_sd = -1;\n\t}\n\n\t/* Convert PORT command's argument to IP address + port */\n\tsscanf(str, \"%d,%d,%d,%d,%d,%d\", &a, &b, &c, &d, &e, &f);\n\tsnprintf(addr, sizeof(addr), \"%d.%d.%d.%d\", a, b, c, d);\n\n\t/* Check IPv4 address using inet_aton(), throw away converted result */\n\tif (!inet_aton(addr, &(sin.sin_addr))) {\n\t\tERR(0, \"Invalid address '%s' given to PORT command\", addr);\n\t\tsend_msg(ctrl->sd, \"500 Illegal PORT command.\\r\\n\");\n\t\treturn;\n\t}\n\n\tstrlcpy(ctrl->data_address, addr, sizeof(ctrl->data_address));\n\tctrl->data_port = e * 256 + f;\n\n\tDBG(\"Client PORT command accepted for %s:%d\", ctrl->data_address, ctrl->data_port);\n\tsend_msg(ctrl->sd, \"200 PORT command successful.\\r\\n\");\n}","lang":"c","vul_type":"cwe-787","target_token_count":293,"sven_meta":{"func_name":"handle_PORT","file_name":"src/ftpcmd.c","commit_link":"github.com/troglobit/uftpd/commit/0fb2c031ce0ace07cc19cd2cb2143c4b5a63c9dd","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#32-36a832e48755","input":"int rom_copy(uint8_t *dest, hwaddr addr, size_t size)\n{\n hwaddr end = addr + size;\n uint8_t *s, *d = dest;\n size_t l = 0;\n Rom *rom;\n\n QTAILQ_FOREACH(rom, &roms, next) {\n if (rom->fw_file) {\n continue;\n }\n if (rom->mr) {\n continue;\n }\n if (rom->addr + rom->romsize < addr) {\n continue;\n }\n if (rom->addr > end) {\n break;\n }\n\n d = dest + (rom->addr - addr);\n s = rom->data;\n l = rom->datasize;\n\n if ((d + l) > (dest + size)) {\n l = dest - d;\n }\n\n if (l > 0) {\n memcpy(d, s, l);\n }\n\n if (rom->romsize > rom->datasize) {\n /* If datasize is less than romsize, it means that we didn't\n * allocate all the ROM because the trailing data are only zeros.\n */\n\n d += l;\n l = rom->romsize - rom->datasize;\n\n if ((d + l) > (dest + size)) {\n /* Rom size doesn't fit in the destination area. Adjust to avoid\n * overflow.\n */\n l = dest - d;\n }\n\n if (l > 0) {\n memset(d, 0x0, l);\n }\n }\n }\n\n return (d + l) - dest;\n}","target":"int rom_copy(uint8_t *dest, hwaddr addr, size_t size)\n{\n hwaddr end = addr + size;\n uint8_t *s, *d = dest;\n size_t l = 0;\n Rom *rom;\n\n QTAILQ_FOREACH(rom, &roms, next) {\n if (rom->fw_file) {\n continue;\n }\n if (rom->mr) {\n continue;\n }\n if (rom->addr + rom->romsize < addr) {\n continue;\n }\n if (rom->addr > end || rom->addr < addr) {\n break;\n }\n\n d = dest + (rom->addr - addr);\n s = rom->data;\n l = rom->datasize;\n\n if ((d + l) > (dest + size)) {\n l = dest - d;\n }\n\n if (l > 0) {\n memcpy(d, s, l);\n }\n\n if (rom->romsize > rom->datasize) {\n /* If datasize is less than romsize, it means that we didn't\n * allocate all the ROM because the trailing data are only zeros.\n */\n\n d += l;\n l = rom->romsize - rom->datasize;\n\n if ((d + l) > (dest + size)) {\n /* Rom size doesn't fit in the destination area. Adjust to avoid\n * overflow.\n */\n l = dest - d;\n }\n\n if (l > 0) {\n memset(d, 0x0, l);\n }\n }\n }\n\n return (d + l) - dest;\n}","lang":"c","vul_type":"cwe-787","target_token_count":352,"sven_meta":{"func_name":"rom_copy","file_name":"hw/core/loader.c","commit_link":"github.com/qemu/qemu/commit/4f1c6cb2f9afafda05eab150fd2bd284edce6676","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#34-3eda953a2788","input":"TiledInputFile::rawTileData (int &dx, int &dy,\n\t\t\t int &lx, int &ly,\n const char *&pixelData,\n\t\t\t int &pixelDataSize)\n{\n try\n {\n Lock lock (*_data->_streamData);\n\n if (!isValidTile (dx, dy, lx, ly))\n throw IEX_NAMESPACE::ArgExc (\"Tried to read a tile outside \"\n\t\t\t \"the image file's data window.\");\n\n TileBuffer *tileBuffer = _data->getTileBuffer (0);\n\n //\n // if file is a multipart file, we have to seek to the required tile\n // since we don't know where the file pointer is\n //\n int old_dx=dx;\n int old_dy=dy;\n int old_lx=lx;\n int old_ly=ly;\n if(isMultiPart(version()))\n {\n _data->_streamData->is->seekg(_data->tileOffsets(dx,dy,lx,ly));\n }\n readNextTileData (_data->_streamData, _data, dx, dy, lx, ly,\n\t\t\t tileBuffer->buffer,\n pixelDataSize);\n if(isMultiPart(version()))\n {\n if (old_dx!=dx || old_dy !=dy || old_lx!=lx || old_ly!=ly)\n {\n throw IEX_NAMESPACE::ArgExc (\"rawTileData read the wrong tile\");\n }\n }\n pixelData = tileBuffer->buffer;\n }\n catch (IEX_NAMESPACE::BaseExc &e)\n {\n REPLACE_EXC (e, \"Error reading pixel data from image \"\n \"file \\\"\" << fileName() << \"\\\". \" << e.what());\n throw;\n }\n}","target":"TiledInputFile::rawTileData (int &dx, int &dy,\n\t\t\t int &lx, int &ly,\n const char *&pixelData,\n\t\t\t int &pixelDataSize)\n{\n try\n {\n Lock lock (*_data->_streamData);\n\n if (!isValidTile (dx, dy, lx, ly))\n throw IEX_NAMESPACE::ArgExc (\"Tried to read a tile outside \"\n\t\t\t \"the image file's data window.\");\n\n TileBuffer *tileBuffer = _data->getTileBuffer (0);\n\n //\n // if file is a multipart file, we have to seek to the required tile\n // since we don't know where the file pointer is\n //\n int old_dx=dx;\n int old_dy=dy;\n int old_lx=lx;\n int old_ly=ly;\n if(isMultiPart(version()))\n {\n _data->_streamData->is->seekg(_data->tileOffsets(dx,dy,lx,ly));\n }\n readNextTileData (_data->_streamData, _data, dx, dy, lx, ly,\n\t\t\t tileBuffer->buffer,\n pixelDataSize);\n if(isMultiPart(version()))\n {\n if (old_dx!=dx || old_dy !=dy || old_lx!=lx || old_ly!=ly)\n {\n throw IEX_NAMESPACE::ArgExc (\"rawTileData read the wrong tile\");\n }\n }\n else\n {\n if(!isValidTile (dx, dy, lx, ly) )\n {\n throw IEX_NAMESPACE::IoExc (\"rawTileData read an invalid tile\");\n }\n }\n pixelData = tileBuffer->buffer;\n }\n catch (IEX_NAMESPACE::BaseExc &e)\n {\n REPLACE_EXC (e, \"Error reading pixel data from image \"\n \"file \\\"\" << fileName() << \"\\\". \" << e.what());\n throw;\n }\n}","lang":"cpp","vul_type":"cwe-787","target_token_count":404,"sven_meta":{"func_name":"TiledInputFile::rawTileData","file_name":"OpenEXR/IlmImf/ImfTiledInputFile.cpp","commit_link":"github.com/AcademySoftwareFoundation/openexr/commit/6bb36714528a9563dd3b92720c5063a1284b86f8","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#36-c2a7543d01b7","input":"static int decode_zbuf(AVBPrint *bp, const uint8_t *data,\n const uint8_t *data_end)\n{\n z_stream zstream;\n unsigned char *buf;\n unsigned buf_size;\n int ret;\n\n zstream.zalloc = ff_png_zalloc;\n zstream.zfree = ff_png_zfree;\n zstream.opaque = NULL;\n if (inflateInit(&zstream) != Z_OK)\n return AVERROR_EXTERNAL;\n zstream.next_in = (unsigned char *)data;\n zstream.avail_in = data_end - data;\n av_bprint_init(bp, 0, -1);\n\n while (zstream.avail_in > 0) {\n av_bprint_get_buffer(bp, 1, &buf, &buf_size);\n if (!buf_size) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n zstream.next_out = buf;\n zstream.avail_out = buf_size;\n ret = inflate(&zstream, Z_PARTIAL_FLUSH);\n if (ret != Z_OK && ret != Z_STREAM_END) {\n ret = AVERROR_EXTERNAL;\n goto fail;\n }\n bp->len += zstream.next_out - buf;\n if (ret == Z_STREAM_END)\n break;\n }\n inflateEnd(&zstream);\n bp->str[bp->len] = 0;\n return 0;\n\nfail:\n inflateEnd(&zstream);\n av_bprint_finalize(bp, NULL);\n return ret;\n}","target":"static int decode_zbuf(AVBPrint *bp, const uint8_t *data,\n const uint8_t *data_end)\n{\n z_stream zstream;\n unsigned char *buf;\n unsigned buf_size;\n int ret;\n\n zstream.zalloc = ff_png_zalloc;\n zstream.zfree = ff_png_zfree;\n zstream.opaque = NULL;\n if (inflateInit(&zstream) != Z_OK)\n return AVERROR_EXTERNAL;\n zstream.next_in = (unsigned char *)data;\n zstream.avail_in = data_end - data;\n av_bprint_init(bp, 0, -1);\n\n while (zstream.avail_in > 0) {\n av_bprint_get_buffer(bp, 2, &buf, &buf_size);\n if (buf_size < 2) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n zstream.next_out = buf;\n zstream.avail_out = buf_size - 1;\n ret = inflate(&zstream, Z_PARTIAL_FLUSH);\n if (ret != Z_OK && ret != Z_STREAM_END) {\n ret = AVERROR_EXTERNAL;\n goto fail;\n }\n bp->len += zstream.next_out - buf;\n if (ret == Z_STREAM_END)\n break;\n }\n inflateEnd(&zstream);\n bp->str[bp->len] = 0;\n return 0;\n\nfail:\n inflateEnd(&zstream);\n av_bprint_finalize(bp, NULL);\n return ret;\n}","lang":"c","vul_type":"cwe-787","target_token_count":329,"sven_meta":{"func_name":"decode_zbuf","file_name":"libavcodec/pngdec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/e371f031b942d73e02c090170975561fabd5c264","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#43-37e1405ec1f6","input":"char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length)\n{\n char *buffer=NULL;\n int n=0;\n\n FILEXFER_ALLOWED_OR_CLOSE_AND_RETURN(\"\", cl, NULL);\n /*\n rfbLog(\"rfbProcessFileTransferReadBuffer(%dlen)\\n\", length);\n */\n if (length>0) {\n buffer=malloc((uint64_t)length+1);\n if (buffer!=NULL) {\n if ((n = rfbReadExact(cl, (char *)buffer, length)) <= 0) {\n if (n != 0)\n rfbLogPerror(\"rfbProcessFileTransferReadBuffer: read\");\n rfbCloseClient(cl);\n /* NOTE: don't forget to free(buffer) if you return early! */\n if (buffer!=NULL) free(buffer);\n return NULL;\n }\n /* Null Terminate */\n buffer[length]=0;\n }\n }\n return buffer;\n}","target":"char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length)\n{\n char *buffer=NULL;\n int n=0;\n\n FILEXFER_ALLOWED_OR_CLOSE_AND_RETURN(\"\", cl, NULL);\n\n /*\n We later alloc length+1, which might wrap around on 32-bit systems if length equals\n 0XFFFFFFFF, i.e. SIZE_MAX for 32-bit systems. On 64-bit systems, a length of 0XFFFFFFFF\n will safely be allocated since this check will never trigger and malloc() can digest length+1\n without problems as length is a uint32_t.\n */\n if(length == SIZE_MAX) {\n\trfbErr(\"rfbProcessFileTransferReadBuffer: too big file transfer length requested: %u\", (unsigned int)length);\n\trfbCloseClient(cl);\n\treturn NULL;\n }\n\n if (length>0) {\n buffer=malloc((size_t)length+1);\n if (buffer!=NULL) {\n if ((n = rfbReadExact(cl, (char *)buffer, length)) <= 0) {\n if (n != 0)\n rfbLogPerror(\"rfbProcessFileTransferReadBuffer: read\");\n rfbCloseClient(cl);\n /* NOTE: don't forget to free(buffer) if you return early! */\n if (buffer!=NULL) free(buffer);\n return NULL;\n }\n /* Null Terminate */\n buffer[length]=0;\n }\n }\n return buffer;\n}","lang":"c","vul_type":"cwe-787","target_token_count":324,"sven_meta":{"func_name":"rfbProcessFileTransferReadBuffer","file_name":"libvncserver/rfbserver.c","commit_link":"github.com/LibVNC/libvncserver/commit/15bb719c03cc70f14c36a843dcb16ed69b405707","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-079#1-fdc5cca261bb","input":" DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) {\n setupUi(this);\n if (size == 1)\n label->setText(tr(\"Are you sure you want to delete '%1' from the transfer list?\", \"Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?\").arg(name));\n else\n label->setText(tr(\"Are you sure you want to delete these %1 torrents from the transfer list?\", \"Are you sure you want to delete these 5 torrents from the transfer list?\").arg(QString::number(size)));\n // Icons\n lbl_warn->setPixmap(GuiIconProvider::instance()->getIcon(\"dialog-warning\").pixmap(lbl_warn->height()));\n lbl_warn->setFixedWidth(lbl_warn->height());\n rememberBtn->setIcon(GuiIconProvider::instance()->getIcon(\"object-locked\"));\n\n move(Utils::Misc::screenCenter(this));\n checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());\n connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));\n buttonBox->button(QDialogButtonBox::Cancel)->setFocus();\n }","target":" DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) {\n setupUi(this);\n if (size == 1)\n label->setText(tr(\"Are you sure you want to delete '%1' from the transfer list?\", \"Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?\").arg(Utils::String::toHtmlEscaped(name)));\n else\n label->setText(tr(\"Are you sure you want to delete these %1 torrents from the transfer list?\", \"Are you sure you want to delete these 5 torrents from the transfer list?\").arg(QString::number(size)));\n // Icons\n lbl_warn->setPixmap(GuiIconProvider::instance()->getIcon(\"dialog-warning\").pixmap(lbl_warn->height()));\n lbl_warn->setFixedWidth(lbl_warn->height());\n rememberBtn->setIcon(GuiIconProvider::instance()->getIcon(\"object-locked\"));\n\n move(Utils::Misc::screenCenter(this));\n checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());\n connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));\n buttonBox->button(QDialogButtonBox::Cancel)->setFocus();\n }","lang":"c","vul_type":"cwe-079","target_token_count":267,"sven_meta":{"func_name":"DeletionConfirmationDlg::DeletionConfirmationDlg","file_name":"src/gui/deletionconfirmationdlg.h","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#3-4412e8937473","input":"def index(request, is_mobile=False):\n hue_collections = DashboardController(request.user).get_search_collections()\n collection_id = request.GET.get('collection')\n\n if not hue_collections or not collection_id:\n return admin_collections(request, True, is_mobile)\n\n try:\n collection_doc = Document2.objects.get(id=collection_id)\n if USE_NEW_EDITOR.get():\n collection_doc.can_read_or_exception(request.user)\n else:\n collection_doc.doc.get().can_read_or_exception(request.user)\n collection = Collection2(request.user, document=collection_doc)\n except Exception, e:\n raise PopupException(e, title=_(\"Dashboard does not exist or you don't have the permission to access it.\"))\n\n query = {'qs': [{'q': ''}], 'fqs': [], 'start': 0}\n\n if request.method == 'GET':\n if 'q' in request.GET:\n query['qs'][0]['q'] = request.GET.get('q')\n if 'qd' in request.GET:\n query['qd'] = request.GET.get('qd')\n\n template = 'search.mako'\n if is_mobile:\n template = 'search_m.mako'\n\n return render(template, request, {\n 'collection': collection,\n 'query': json.dumps(query),\n 'initial': json.dumps({\n 'collections': [],\n 'layout': DEFAULT_LAYOUT,\n 'is_latest': LATEST.get(),\n 'engines': get_engines(request.user)\n }),\n 'is_owner': collection_doc.doc.get().can_write(request.user),\n 'can_edit_index': can_edit_index(request.user),\n 'is_embeddable': request.GET.get('is_embeddable', False),\n 'mobile': is_mobile,\n })","target":"def index(request, is_mobile=False):\n hue_collections = DashboardController(request.user).get_search_collections()\n collection_id = request.GET.get('collection')\n\n if not hue_collections or not collection_id:\n return admin_collections(request, True, is_mobile)\n\n try:\n collection_doc = Document2.objects.get(id=collection_id)\n if USE_NEW_EDITOR.get():\n collection_doc.can_read_or_exception(request.user)\n else:\n collection_doc.doc.get().can_read_or_exception(request.user)\n collection = Collection2(request.user, document=collection_doc)\n except Exception, e:\n raise PopupException(e, title=_(\"Dashboard does not exist or you don't have the permission to access it.\"))\n\n query = {'qs': [{'q': ''}], 'fqs': [], 'start': 0}\n\n if request.method == 'GET':\n if 'q' in request.GET:\n query['qs'][0]['q'] = antixss(request.GET.get('q', ''))\n if 'qd' in request.GET:\n query['qd'] = antixss(request.GET.get('qd', ''))\n\n template = 'search.mako'\n if is_mobile:\n template = 'search_m.mako'\n\n return render(template, request, {\n 'collection': collection,\n 'query': json.dumps(query),\n 'initial': json.dumps({\n 'collections': [],\n 'layout': DEFAULT_LAYOUT,\n 'is_latest': LATEST.get(),\n 'engines': get_engines(request.user)\n }),\n 'is_owner': collection_doc.can_write(request.user) if USE_NEW_EDITOR.get() else collection_doc.doc.get().can_write(request.user),\n 'can_edit_index': can_edit_index(request.user),\n 'is_embeddable': request.GET.get('is_embeddable', False),\n 'mobile': is_mobile,\n })","lang":"python","vul_type":"cwe-079","target_token_count":383,"sven_meta":{"func_name":"index","file_name":"desktop/libs/dashboard/src/dashboard/views.py","commit_link":"github.com/gethue/hue/commit/37b529b1f9aeb5d746599a9ed4e2288cf3ad3e1d","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#13-803f93e40115","input":"@check_document_access_permission()\ndef edit_workflow(request):\n workflow_id = request.GET.get('workflow')\n \n if workflow_id:\n wid = {}\n if workflow_id.isdigit():\n wid['id'] = workflow_id\n else:\n wid['uuid'] = workflow_id\n doc = Document2.objects.get(type='oozie-workflow2', **wid)\n workflow = Workflow(document=doc)\n else:\n doc = None\n workflow = Workflow()\n workflow.set_workspace(request.user)\n workflow.check_workspace(request.fs, request.user)\n \n workflow_data = workflow.get_data()\n\n api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))\n\n return render('editor/workflow_editor.mako', request, {\n 'layout_json': json.dumps(workflow_data['layout']),\n 'workflow_json': json.dumps(workflow_data['workflow']),\n 'credentials_json': json.dumps(credentials.credentials.keys()),\n 'workflow_properties_json': json.dumps(WORKFLOW_NODE_PROPERTIES),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'subworkflows_json': json.dumps(_get_workflows(request.user)),\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })","target":"@check_document_access_permission()\ndef edit_workflow(request):\n workflow_id = request.GET.get('workflow')\n \n if workflow_id:\n wid = {}\n if workflow_id.isdigit():\n wid['id'] = workflow_id\n else:\n wid['uuid'] = workflow_id\n doc = Document2.objects.get(type='oozie-workflow2', **wid)\n workflow = Workflow(document=doc)\n else:\n doc = None\n workflow = Workflow()\n workflow.set_workspace(request.user)\n workflow.check_workspace(request.fs, request.user)\n \n workflow_data = workflow.get_data()\n\n api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))\n\n return render('editor/workflow_editor.mako', request, {\n 'layout_json': json.dumps(workflow_data['layout'], cls=JSONEncoderForHTML),\n 'workflow_json': json.dumps(workflow_data['workflow'], cls=JSONEncoderForHTML),\n 'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),\n 'workflow_properties_json': json.dumps(WORKFLOW_NODE_PROPERTIES, cls=JSONEncoderForHTML),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'subworkflows_json': json.dumps(_get_workflows(request.user), cls=JSONEncoderForHTML),\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })","lang":"python","vul_type":"cwe-079","target_token_count":319,"sven_meta":{"func_name":"edit_workflow","file_name":"apps/oozie/src/oozie/views/editor2.py","commit_link":"github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#17-1a1121e69073","input":"@check_document_access_permission()\ndef edit_coordinator(request):\n coordinator_id = request.GET.get('coordinator')\n doc = None\n \n if coordinator_id:\n doc = Document2.objects.get(id=coordinator_id)\n coordinator = Coordinator(document=doc)\n else:\n coordinator = Coordinator()\n\n api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))\n\n workflows = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]\n\n if coordinator_id and not filter(lambda a: a['uuid'] == coordinator.data['properties']['workflow'], workflows):\n raise PopupException(_('You don\\'t have access to the workflow of this coordinator.'))\n\n return render('editor/coordinator_editor.mako', request, {\n 'coordinator_json': coordinator.json,\n 'credentials_json': json.dumps(credentials.credentials.keys()),\n 'workflows_json': json.dumps(workflows),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })","target":"@check_document_access_permission()\ndef edit_coordinator(request):\n coordinator_id = request.GET.get('coordinator')\n doc = None\n \n if coordinator_id:\n doc = Document2.objects.get(id=coordinator_id)\n coordinator = Coordinator(document=doc)\n else:\n coordinator = Coordinator()\n\n api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))\n\n workflows = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]\n\n if coordinator_id and not filter(lambda a: a['uuid'] == coordinator.data['properties']['workflow'], workflows):\n raise PopupException(_('You don\\'t have access to the workflow of this coordinator.'))\n\n return render('editor/coordinator_editor.mako', request, {\n 'coordinator_json': coordinator.json_for_html(),\n 'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),\n 'workflows_json': json.dumps(workflows, cls=JSONEncoderForHTML),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })","lang":"python","vul_type":"cwe-079","target_token_count":287,"sven_meta":{"func_name":"edit_coordinator","file_name":"apps/oozie/src/oozie/views/editor2.py","commit_link":"github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#23-dcbe3bb95c17","input":"@csrf.csrf_protect\ndef subscribe_for_tags(request):\n \"\"\"process subscription of users by tags\"\"\"\n #todo - use special separator to split tags\n tag_names = request.REQUEST.get('tags','').strip().split()\n pure_tag_names, wildcards = forms.clean_marked_tagnames(tag_names)\n if request.user.is_authenticated():\n if request.method == 'POST':\n if 'ok' in request.POST:\n request.user.mark_tags(\n pure_tag_names,\n wildcards,\n reason = 'good',\n action = 'add'\n )\n request.user.message_set.create(\n message = _('Your tag subscription was saved, thanks!')\n )\n else:\n message = _(\n 'Tag subscription was canceled (undo).'\n ) % {'url': request.path + '?tags=' + request.REQUEST['tags']}\n request.user.message_set.create(message = message)\n return HttpResponseRedirect(reverse('index'))\n else:\n data = {'tags': tag_names}\n return render(request, 'subscribe_for_tags.html', data)\n else:\n all_tag_names = pure_tag_names + wildcards\n message = _('Please sign in to subscribe for: %(tags)s') \\\n % {'tags': ', '.join(all_tag_names)}\n request.user.message_set.create(message = message)\n request.session['subscribe_for_tags'] = (pure_tag_names, wildcards)\n return HttpResponseRedirect(url_utils.get_login_url())","target":"@csrf.csrf_protect\ndef subscribe_for_tags(request):\n \"\"\"process subscription of users by tags\"\"\"\n #todo - use special separator to split tags\n tag_names = request.REQUEST.get('tags','').strip().split()\n pure_tag_names, wildcards = forms.clean_marked_tagnames(tag_names)\n if request.user.is_authenticated():\n if request.method == 'POST':\n if 'ok' in request.POST:\n request.user.mark_tags(\n pure_tag_names,\n wildcards,\n reason = 'good',\n action = 'add'\n )\n request.user.message_set.create(\n message = _('Your tag subscription was saved, thanks!')\n )\n else:\n message = _(\n 'Tag subscription was canceled (undo).'\n ) % {'url': escape(request.path) + '?tags=' + request.REQUEST['tags']}\n request.user.message_set.create(message = message)\n return HttpResponseRedirect(reverse('index'))\n else:\n data = {'tags': tag_names}\n return render(request, 'subscribe_for_tags.html', data)\n else:\n all_tag_names = pure_tag_names + wildcards\n message = _('Please sign in to subscribe for: %(tags)s') \\\n % {'tags': ', '.join(all_tag_names)}\n request.user.message_set.create(message = message)\n request.session['subscribe_for_tags'] = (pure_tag_names, wildcards)\n return HttpResponseRedirect(url_utils.get_login_url())","lang":"python","vul_type":"cwe-079","target_token_count":307,"sven_meta":{"func_name":"subscribe_for_tags","file_name":"askbot/views/commands.py","commit_link":"github.com/ASKBOT/askbot-devel/commit/a676a86b6b7a5737d4da4f59f71e037406f88d29","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#24-966e998331fa","input":"def nav_path(request):\n \"\"\"Return current path as list of items with \"name\" and \"href\" members\n\n The href members are view_directory links for directories and view_log\n links for files, but are set to None when the link would point to\n the current view\"\"\"\n\n if not request.repos:\n return []\n\n is_dir = request.pathtype == vclib.DIR\n\n # add root item\n items = []\n root_item = _item(name=request.server.escape(request.repos.name), href=None)\n if request.path_parts or request.view_func is not view_directory:\n root_item.href = request.get_url(view_func=view_directory,\n where='', pathtype=vclib.DIR,\n params={}, escape=1)\n items.append(root_item)\n\n # add path part items\n path_parts = []\n for part in request.path_parts:\n path_parts.append(part)\n is_last = len(path_parts) == len(request.path_parts)\n\n item = _item(name=part, href=None)\n\n if not is_last or (is_dir and request.view_func is not view_directory):\n item.href = request.get_url(view_func=view_directory,\n where=_path_join(path_parts),\n pathtype=vclib.DIR,\n params={}, escape=1)\n elif not is_dir and request.view_func is not view_log:\n item.href = request.get_url(view_func=view_log,\n where=_path_join(path_parts),\n pathtype=vclib.FILE,\n params={}, escape=1)\n items.append(item)\n\n return items","target":"def nav_path(request):\n \"\"\"Return current path as list of items with \"name\" and \"href\" members\n\n The href members are view_directory links for directories and view_log\n links for files, but are set to None when the link would point to\n the current view\"\"\"\n\n if not request.repos:\n return []\n\n is_dir = request.pathtype == vclib.DIR\n\n # add root item\n items = []\n root_item = _item(name=request.server.escape(request.repos.name), href=None)\n if request.path_parts or request.view_func is not view_directory:\n root_item.href = request.get_url(view_func=view_directory,\n where='', pathtype=vclib.DIR,\n params={}, escape=1)\n items.append(root_item)\n\n # add path part items\n path_parts = []\n for part in request.path_parts:\n path_parts.append(part)\n is_last = len(path_parts) == len(request.path_parts)\n\n item = _item(name=request.server.escape(part), href=None)\n\n if not is_last or (is_dir and request.view_func is not view_directory):\n item.href = request.get_url(view_func=view_directory,\n where=_path_join(path_parts),\n pathtype=vclib.DIR,\n params={}, escape=1)\n elif not is_dir and request.view_func is not view_log:\n item.href = request.get_url(view_func=view_log,\n where=_path_join(path_parts),\n pathtype=vclib.FILE,\n params={}, escape=1)\n items.append(item)\n\n return items","lang":"python","vul_type":"cwe-079","target_token_count":332,"sven_meta":{"func_name":"nav_path","file_name":"lib/viewvc.py","commit_link":"github.com/viewvc/viewvc/commit/9dcfc7daa4c940992920d3b2fbd317da20e44aad","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#29-02244c7fdbeb","input":"void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent)\n{\n clear();\n m_torrent = torrent;\n downloaded_pieces->setTorrent(m_torrent);\n pieces_availability->setTorrent(m_torrent);\n if (!m_torrent) return;\n\n // Save path\n updateSavePath(m_torrent);\n // Hash\n hash_lbl->setText(m_torrent->hash());\n PropListModel->model()->clear();\n if (m_torrent->hasMetadata()) {\n // Creation date\n lbl_creationDate->setText(m_torrent->creationDate().toString(Qt::DefaultLocaleShortDate));\n\n label_total_size_val->setText(Utils::Misc::friendlyUnit(m_torrent->totalSize()));\n\n // Comment\n comment_text->setText(Utils::Misc::parseHtmlLinks(m_torrent->comment()));\n\n // URL seeds\n loadUrlSeeds();\n\n label_created_by_val->setText(m_torrent->creator());\n\n // List files in torrent\n PropListModel->model()->setupModelData(m_torrent->info());\n filesList->setExpanded(PropListModel->index(0, 0), true);\n\n // Load file priorities\n PropListModel->model()->updateFilesPriorities(m_torrent->filePriorities());\n }\n // Load dynamic data\n loadDynamicData();\n}","target":"void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent)\n{\n clear();\n m_torrent = torrent;\n downloaded_pieces->setTorrent(m_torrent);\n pieces_availability->setTorrent(m_torrent);\n if (!m_torrent) return;\n\n // Save path\n updateSavePath(m_torrent);\n // Hash\n hash_lbl->setText(m_torrent->hash());\n PropListModel->model()->clear();\n if (m_torrent->hasMetadata()) {\n // Creation date\n lbl_creationDate->setText(m_torrent->creationDate().toString(Qt::DefaultLocaleShortDate));\n\n label_total_size_val->setText(Utils::Misc::friendlyUnit(m_torrent->totalSize()));\n\n // Comment\n comment_text->setText(Utils::Misc::parseHtmlLinks(Utils::String::toHtmlEscaped(m_torrent->comment())));\n\n // URL seeds\n loadUrlSeeds();\n\n label_created_by_val->setText(Utils::String::toHtmlEscaped(m_torrent->creator()));\n\n // List files in torrent\n PropListModel->model()->setupModelData(m_torrent->info());\n filesList->setExpanded(PropListModel->index(0, 0), true);\n\n // Load file priorities\n PropListModel->model()->updateFilesPriorities(m_torrent->filePriorities());\n }\n // Load dynamic data\n loadDynamicData();\n}","lang":"cpp","vul_type":"cwe-079","target_token_count":292,"sven_meta":{"func_name":"PropertiesWidget::loadTorrentInfos","file_name":"src/gui/properties/propertieswidget.cpp","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#32-94da25c4c470","input":"@register.tag\n@basictag(takes_context=True)\ndef screenshotcommentcounts(context, screenshot):\n \"\"\"\n Returns a JSON array of current comments for a screenshot.\n\n Each entry in the array has a dictionary containing the following keys:\n\n =========== ==================================================\n Key Description\n =========== ==================================================\n text The text of the comment\n localdraft True if this is the current user's draft comment\n x The X location of the comment's region\n y The Y location of the comment's region\n w The width of the comment's region\n h The height of the comment's region\n =========== ==================================================\n \"\"\"\n comments = {}\n user = context.get('user', None)\n\n for comment in screenshot.comments.all():\n review = get_object_or_none(comment.review)\n\n if review and (review.public or review.user == user):\n position = '%dx%d+%d+%d' % (comment.w, comment.h, \\\n comment.x, comment.y)\n\n comments.setdefault(position, []).append({\n 'id': comment.id,\n 'text': comment.text,\n 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n 'url': comment.get_review_url(),\n 'localdraft' : review.user == user and \\\n not review.public,\n 'x' : comment.x,\n 'y' : comment.y,\n 'w' : comment.w,\n 'h' : comment.h,\n })\n\n return simplejson.dumps(comments)","target":"@register.tag\n@basictag(takes_context=True)\ndef screenshotcommentcounts(context, screenshot):\n \"\"\"\n Returns a JSON array of current comments for a screenshot.\n\n Each entry in the array has a dictionary containing the following keys:\n\n =========== ==================================================\n Key Description\n =========== ==================================================\n text The text of the comment\n localdraft True if this is the current user's draft comment\n x The X location of the comment's region\n y The Y location of the comment's region\n w The width of the comment's region\n h The height of the comment's region\n =========== ==================================================\n \"\"\"\n comments = {}\n user = context.get('user', None)\n\n for comment in screenshot.comments.all():\n review = get_object_or_none(comment.review)\n\n if review and (review.public or review.user == user):\n position = '%dx%d+%d+%d' % (comment.w, comment.h, \\\n comment.x, comment.y)\n\n comments.setdefault(position, []).append({\n 'id': comment.id,\n 'text': escape(comment.text),\n 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n 'url': comment.get_review_url(),\n 'localdraft' : review.user == user and \\\n not review.public,\n 'x' : comment.x,\n 'y' : comment.y,\n 'w' : comment.w,\n 'h' : comment.h,\n })\n\n return simplejson.dumps(comments)","lang":"python","vul_type":"cwe-079","target_token_count":333,"sven_meta":{"func_name":"screenshotcommentcounts","file_name":"reviewboard/reviews/templatetags/reviewtags.py","commit_link":"github.com/reviewboard/reviewboard/commit/7a0a9d94555502278534dedcf2d75e9fccce8c3d","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#34-ad88dc49ed96","input":"def get_list_context(context=None):\n\tlist_context = frappe._dict(\n\t\ttemplate = \"templates/includes/blog/blog.html\",\n\t\tget_list = get_blog_list,\n\t\thide_filters = True,\n\t\tchildren = get_children(),\n\t\t# show_search = True,\n\t\ttitle = _('Blog')\n\t)\n\n\tcategory = frappe.local.form_dict.blog_category or frappe.local.form_dict.category\n\tif category:\n\t\tcategory_title = get_blog_category(category)\n\t\tlist_context.sub_title = _(\"Posts filed under {0}\").format(category_title)\n\t\tlist_context.title = category_title\n\n\telif frappe.local.form_dict.blogger:\n\t\tblogger = frappe.db.get_value(\"Blogger\", {\"name\": frappe.local.form_dict.blogger}, \"full_name\")\n\t\tlist_context.sub_title = _(\"Posts by {0}\").format(blogger)\n\t\tlist_context.title = blogger\n\n\telif frappe.local.form_dict.txt:\n\t\tlist_context.sub_title = _('Filtered by \"{0}\"').format(frappe.local.form_dict.txt)\n\n\tif list_context.sub_title:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"},\n\t\t\t\t\t\t\t\t{\"name\": \"Blog\", \"route\": \"/blog\"}]\n\telse:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"}]\n\n\tlist_context.update(frappe.get_doc(\"Blog Settings\", \"Blog Settings\").as_dict(no_default_fields=True))\n\treturn list_context","target":"def get_list_context(context=None):\n\tlist_context = frappe._dict(\n\t\ttemplate = \"templates/includes/blog/blog.html\",\n\t\tget_list = get_blog_list,\n\t\thide_filters = True,\n\t\tchildren = get_children(),\n\t\t# show_search = True,\n\t\ttitle = _('Blog')\n\t)\n\n\tcategory = sanitize_html(frappe.local.form_dict.blog_category or frappe.local.form_dict.category)\n\tif category:\n\t\tcategory_title = get_blog_category(category)\n\t\tlist_context.sub_title = _(\"Posts filed under {0}\").format(category_title)\n\t\tlist_context.title = category_title\n\n\telif frappe.local.form_dict.blogger:\n\t\tblogger = frappe.db.get_value(\"Blogger\", {\"name\": frappe.local.form_dict.blogger}, \"full_name\")\n\t\tlist_context.sub_title = _(\"Posts by {0}\").format(blogger)\n\t\tlist_context.title = blogger\n\n\telif frappe.local.form_dict.txt:\n\t\tlist_context.sub_title = _('Filtered by \"{0}\"').format(sanitize_html(frappe.local.form_dict.txt))\n\n\tif list_context.sub_title:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"},\n\t\t\t\t\t\t\t\t{\"name\": \"Blog\", \"route\": \"/blog\"}]\n\telse:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"}]\n\n\tlist_context.update(frappe.get_doc(\"Blog Settings\", \"Blog Settings\").as_dict(no_default_fields=True))\n\treturn list_context","lang":"python","vul_type":"cwe-079","target_token_count":296,"sven_meta":{"func_name":"get_list_context","file_name":"frappe/website/doctype/blog_post/blog_post.py","commit_link":"github.com/omirajkar/bench_frappe/commit/2fa19c25066ed17478d683666895e3266936aee6","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#35-83e51d3d3dc7","input":" def mode_init(self, request):\n \"\"\"\n This is called by render_POST when the client requests an init\n mode operation (at startup)\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = request.args.get('csessid')[0]\n\n remote_addr = request.getClientIP()\n host_string = \"%s (%s:%s)\" % (_SERVERNAME, request.getRequestHostname(), request.getHost().port)\n\n sess = AjaxWebClientSession()\n sess.client = self\n sess.init_session(\"ajax/comet\", remote_addr, self.sessionhandler)\n\n sess.csessid = csessid\n csession = _CLIENT_SESSIONS(session_key=sess.csessid)\n uid = csession and csession.get(\"webclient_authenticated_uid\", False)\n if uid:\n # the client session is already logged in\n sess.uid = uid\n sess.logged_in = True\n\n sess.sessionhandler.connect(sess)\n\n self.last_alive[csessid] = (time.time(), False)\n if not self.keep_alive:\n # the keepalive is not running; start it.\n self.keep_alive = LoopingCall(self._keepalive)\n self.keep_alive.start(_KEEPALIVE, now=False)\n\n return jsonify({'msg': host_string, 'csessid': csessid})","target":" def mode_init(self, request):\n \"\"\"\n This is called by render_POST when the client requests an init\n mode operation (at startup)\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = cgi.escape(request.args['csessid'][0])\n\n remote_addr = request.getClientIP()\n host_string = \"%s (%s:%s)\" % (_SERVERNAME, request.getRequestHostname(), request.getHost().port)\n\n sess = AjaxWebClientSession()\n sess.client = self\n sess.init_session(\"ajax/comet\", remote_addr, self.sessionhandler)\n\n sess.csessid = csessid\n csession = _CLIENT_SESSIONS(session_key=sess.csessid)\n uid = csession and csession.get(\"webclient_authenticated_uid\", False)\n if uid:\n # the client session is already logged in\n sess.uid = uid\n sess.logged_in = True\n\n sess.sessionhandler.connect(sess)\n\n self.last_alive[csessid] = (time.time(), False)\n if not self.keep_alive:\n # the keepalive is not running; start it.\n self.keep_alive = LoopingCall(self._keepalive)\n self.keep_alive.start(_KEEPALIVE, now=False)\n\n return jsonify({'msg': host_string, 'csessid': csessid})","lang":"python","vul_type":"cwe-079","target_token_count":279,"sven_meta":{"func_name":"mode_init","file_name":"evennia/server/portal/webclient_ajax.py","commit_link":"github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#36-cc81169c84c4","input":"def handle_file(u: Profile, headline: str, category: str, text: str, file):\n m: Media = Media()\n upload_base_path: str = 'uploads/' + str(date.today().year)\n high_res_file_name = upload_base_path + '/HIGHRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n low_res_file_name = upload_base_path + '/LOWRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n if not os.path.exists(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path):\n os.makedirs(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path)\n with open(high_res_file_name, 'wb+') as destination:\n for chunk in file.chunks():\n destination.write(chunk)\n # TODO crop image\n original = Image.open(high_res_file_name)\n width, height = original.size\n diameter = math.sqrt(math.pow(width, 2) + math.pow(height, 2))\n width /= diameter\n height /= diameter\n width *= IMAGE_SCALE\n height *= IMAGE_SCALE\n cropped = original.resize((int(width), int(height)), PIL.Image.LANCZOS)\n cropped.save(low_res_file_name)\n m.text = text\n m.cachedText = compile_markdown(text)\n m.category = category\n m.highResFile = \"/\" + high_res_file_name\n m.lowResFile = \"/\" + low_res_file_name\n m.headline = headline\n m.save()\n mu: MediaUpload = MediaUpload()\n mu.UID = u\n mu.MID = m\n mu.save()\n logging.info(\"Uploaded file '\" + str(file.name) + \"' and cropped it. The resulting PK is \" + str(m.pk))","target":"def handle_file(u: Profile, headline: str, category: str, text: str, file):\n m: Media = Media()\n upload_base_path: str = 'uploads/' + str(date.today().year)\n high_res_file_name = upload_base_path + '/HIGHRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n low_res_file_name = upload_base_path + '/LOWRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n if not os.path.exists(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path):\n os.makedirs(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path)\n with open(high_res_file_name, 'wb+') as destination:\n for chunk in file.chunks():\n destination.write(chunk)\n # TODO crop image\n original = Image.open(high_res_file_name)\n width, height = original.size\n diameter = math.sqrt(math.pow(width, 2) + math.pow(height, 2))\n width /= diameter\n height /= diameter\n width *= IMAGE_SCALE\n height *= IMAGE_SCALE\n cropped = original.resize((int(width), int(height)), PIL.Image.LANCZOS)\n cropped.save(low_res_file_name)\n m.text = escape(text)\n m.cachedText = compile_markdown(escape(text))\n m.category = escape(category)\n m.highResFile = \"/\" + high_res_file_name\n m.lowResFile = \"/\" + low_res_file_name\n m.headline = escape(headline)\n m.save()\n mu: MediaUpload = MediaUpload()\n mu.UID = u\n mu.MID = m\n mu.save()\n logging.info(\"Uploaded file '\" + str(file.name) + \"' and cropped it. The resulting PK is \" + str(m.pk))","lang":"python","vul_type":"cwe-079","target_token_count":369,"sven_meta":{"func_name":"handle_file","file_name":"c3shop/frontpage/management/mediatools/media_actions.py","commit_link":"github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#37-b4fe315c51a8","input":"@register.tag\n@basictag(takes_context=True)\ndef commentcounts(context, filediff, interfilediff=None):\n \"\"\"\n Returns a JSON array of current comments for a filediff, sorted by\n line number.\n\n Each entry in the array has a dictionary containing the following keys:\n\n =========== ==================================================\n Key Description\n =========== ==================================================\n comment_id The ID of the comment\n text The text of the comment\n line The first line number\n num_lines The number of lines this comment spans\n user A dictionary containing \"username\" and \"name\" keys\n for the user\n url The URL to the comment\n localdraft True if this is the current user's draft comment\n =========== ==================================================\n \"\"\"\n comment_dict = {}\n user = context.get('user', None)\n\n if interfilediff:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff=interfilediff)\n else:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff__isnull=True)\n\n for comment in query:\n review = get_object_or_none(comment.review)\n\n if review and (review.public or review.user == user):\n key = (comment.first_line, comment.num_lines)\n\n comment_dict.setdefault(key, []).append({\n 'comment_id': comment.id,\n 'text': comment.text,\n 'line': comment.first_line,\n 'num_lines': comment.num_lines,\n 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n #'timestamp': comment.timestamp,\n 'url': comment.get_review_url(),\n 'localdraft': review.user == user and \\\n not review.public,\n })\n\n comments_array = []\n\n for key, value in comment_dict.iteritems():\n comments_array.append({\n 'linenum': key[0],\n 'num_lines': key[1],\n 'comments': value,\n })\n\n comments_array.sort(cmp=lambda x, y: cmp(x['linenum'], y['linenum'] or\n cmp(x['num_lines'], y['num_lines'])))\n\n return simplejson.dumps(comments_array)","target":"@register.tag\n@basictag(takes_context=True)\ndef commentcounts(context, filediff, interfilediff=None):\n \"\"\"\n Returns a JSON array of current comments for a filediff, sorted by\n line number.\n\n Each entry in the array has a dictionary containing the following keys:\n\n =========== ==================================================\n Key Description\n =========== ==================================================\n comment_id The ID of the comment\n text The text of the comment\n line The first line number\n num_lines The number of lines this comment spans\n user A dictionary containing \"username\" and \"name\" keys\n for the user\n url The URL to the comment\n localdraft True if this is the current user's draft comment\n =========== ==================================================\n \"\"\"\n comment_dict = {}\n user = context.get('user', None)\n\n if interfilediff:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff=interfilediff)\n else:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff__isnull=True)\n\n for comment in query:\n review = get_object_or_none(comment.review)\n\n if review and (review.public or review.user == user):\n key = (comment.first_line, comment.num_lines)\n\n comment_dict.setdefault(key, []).append({\n 'comment_id': comment.id,\n 'text': escape(comment.text),\n 'line': comment.first_line,\n 'num_lines': comment.num_lines,\n 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n #'timestamp': comment.timestamp,\n 'url': comment.get_review_url(),\n 'localdraft': review.user == user and \\\n not review.public,\n })\n\n comments_array = []\n\n for key, value in comment_dict.iteritems():\n comments_array.append({\n 'linenum': key[0],\n 'num_lines': key[1],\n 'comments': value,\n })\n\n comments_array.sort(cmp=lambda x, y: cmp(x['linenum'], y['linenum'] or\n cmp(x['num_lines'], y['num_lines'])))\n\n return simplejson.dumps(comments_array)","lang":"python","vul_type":"cwe-079","target_token_count":470,"sven_meta":{"func_name":"commentcounts","file_name":"reviewboard/reviews/templatetags/reviewtags.py","commit_link":"github.com/reviewboard/reviewboard/commit/7a0a9d94555502278534dedcf2d75e9fccce8c3d","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#41-a1231ab75c3a","input":"def manipulate_reservation_action(request: HttpRequest, default_foreward_url: str):\n \"\"\"\n This function is used to alter the reservation beeing build inside\n a cookie. This function automatically crafts the required response.\n \"\"\"\n js_string: str = \"\"\n r: GroupReservation = None\n u: Profile = get_current_user(request)\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if \"srid\" in request.GET:\n if not request.GET.get(\"rid\"):\n return HttpResponseRedirect(\"/admin?error=missing%20primary%20reservation%20id\")\n srid: int = int(request.GET[\"srid\"])\n sr: SubReservation = None\n if srid == 0:\n sr = SubReservation()\n else:\n sr = SubReservation.objects.get(id=srid)\n if request.POST.get(\"notes\"):\n sr.notes = request.POST[\"notes\"]\n else:\n sr.notes = \" \"\n sr.primary_reservation = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n sr.save()\n print(request.POST)\n print(sr.notes)\n return HttpResponseRedirect(\"/admin/reservations/edit?rid=\" + str(int(request.GET[\"rid\"])) + \"&srid=\" + str(sr.id))\n if \"rid\" in request.GET:\n # update reservation\n r = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n elif u.number_of_allowed_reservations > GroupReservation.objects.all().filter(createdByUser=u).count():\n r = GroupReservation()\n r.createdByUser = u\n r.ready = False\n r.open = True\n r.pickupDate = datetime.datetime.now()\n else:\n return HttpResponseRedirect(\"/admin?error=Too%20Many%20reservations\")\n if request.POST.get(\"notes\"):\n r.notes = request.POST[\"notes\"]\n if request.POST.get(\"contact\"):\n r.responsiblePerson = str(request.POST[\"contact\"])\n if (r.createdByUser == u or o.rights > 1) and not r.submitted:\n r.save()\n else:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n response: HttpResponseRedirect = HttpResponseRedirect(forward_url + \"?rid=\" + str(r.id))\n return response","target":"def manipulate_reservation_action(request: HttpRequest, default_foreward_url: str):\n \"\"\"\n This function is used to alter the reservation beeing build inside\n a cookie. This function automatically crafts the required response.\n \"\"\"\n js_string: str = \"\"\n r: GroupReservation = None\n u: Profile = get_current_user(request)\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if \"srid\" in request.GET:\n if not request.GET.get(\"rid\"):\n return HttpResponseRedirect(\"/admin?error=missing%20primary%20reservation%20id\")\n srid: int = int(request.GET[\"srid\"])\n sr: SubReservation = None\n if srid == 0:\n sr = SubReservation()\n else:\n sr = SubReservation.objects.get(id=srid)\n if request.POST.get(\"notes\"):\n sr.notes = escape(request.POST[\"notes\"])\n else:\n sr.notes = \" \"\n sr.primary_reservation = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n sr.save()\n print(request.POST)\n print(sr.notes)\n return HttpResponseRedirect(\"/admin/reservations/edit?rid=\" + str(int(request.GET[\"rid\"])) + \"&srid=\" + str(sr.id))\n if \"rid\" in request.GET:\n # update reservation\n r = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n elif u.number_of_allowed_reservations > GroupReservation.objects.all().filter(createdByUser=u).count():\n r = GroupReservation()\n r.createdByUser = u\n r.ready = False\n r.open = True\n r.pickupDate = datetime.datetime.now()\n else:\n return HttpResponseRedirect(\"/admin?error=Too%20Many%20reservations\")\n if request.POST.get(\"notes\"):\n r.notes = escape(request.POST[\"notes\"])\n if request.POST.get(\"contact\"):\n r.responsiblePerson = escape(str(request.POST[\"contact\"]))\n if (r.createdByUser == u or o.rights > 1) and not r.submitted:\n r.save()\n else:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n response: HttpResponseRedirect = HttpResponseRedirect(forward_url + \"?rid=\" + str(r.id))\n return response","lang":"python","vul_type":"cwe-079","target_token_count":482,"sven_meta":{"func_name":"manipulate_reservation_action","file_name":"c3shop/frontpage/management/reservation_actions.py","commit_link":"github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-190#8-106070f03b78","input":"UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLength) {\n if(!isWritable() || srcLength == 0 || srcChars == NULL) {\n return *this;\n }\n\n // Perform all remaining operations relative to srcChars + srcStart.\n // From this point forward, do not use srcStart.\n srcChars += srcStart;\n\n if(srcLength < 0) {\n // get the srcLength if necessary\n if((srcLength = u_strlen(srcChars)) == 0) {\n return *this;\n }\n }\n\n int32_t oldLength = length();\n int32_t newLength = oldLength + srcLength;\n\n // Check for append onto ourself\n const UChar* oldArray = getArrayStart();\n if (isBufferWritable() &&\n oldArray < srcChars + srcLength &&\n srcChars < oldArray + oldLength) {\n // Copy into a new UnicodeString and start over\n UnicodeString copy(srcChars, srcLength);\n if (copy.isBogus()) {\n setToBogus();\n return *this;\n }\n return doAppend(copy.getArrayStart(), 0, srcLength);\n }\n\n // optimize append() onto a large-enough, owned string\n if((newLength <= getCapacity() && isBufferWritable()) ||\n cloneArrayIfNeeded(newLength, getGrowCapacity(newLength))) {\n UChar *newArray = getArrayStart();\n // Do not copy characters when\n // UChar *buffer=str.getAppendBuffer(...);\n // is followed by\n // str.append(buffer, length);\n // or\n // str.appendString(buffer, length)\n // or similar.\n if(srcChars != newArray + oldLength) {\n us_arrayCopy(srcChars, 0, newArray, oldLength, srcLength);\n }\n setLength(newLength);\n }\n return *this;\n}","target":"UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLength) {\n if(!isWritable() || srcLength == 0 || srcChars == NULL) {\n return *this;\n }\n\n // Perform all remaining operations relative to srcChars + srcStart.\n // From this point forward, do not use srcStart.\n srcChars += srcStart;\n\n if(srcLength < 0) {\n // get the srcLength if necessary\n if((srcLength = u_strlen(srcChars)) == 0) {\n return *this;\n }\n }\n\n int32_t oldLength = length();\n int32_t newLength;\n if (uprv_add32_overflow(oldLength, srcLength, &newLength)) {\n setToBogus();\n return *this;\n }\n\n // Check for append onto ourself\n const UChar* oldArray = getArrayStart();\n if (isBufferWritable() &&\n oldArray < srcChars + srcLength &&\n srcChars < oldArray + oldLength) {\n // Copy into a new UnicodeString and start over\n UnicodeString copy(srcChars, srcLength);\n if (copy.isBogus()) {\n setToBogus();\n return *this;\n }\n return doAppend(copy.getArrayStart(), 0, srcLength);\n }\n\n // optimize append() onto a large-enough, owned string\n if((newLength <= getCapacity() && isBufferWritable()) ||\n cloneArrayIfNeeded(newLength, getGrowCapacity(newLength))) {\n UChar *newArray = getArrayStart();\n // Do not copy characters when\n // UChar *buffer=str.getAppendBuffer(...);\n // is followed by\n // str.append(buffer, length);\n // or\n // str.appendString(buffer, length)\n // or similar.\n if(srcChars != newArray + oldLength) {\n us_arrayCopy(srcChars, 0, newArray, oldLength, srcLength);\n }\n setLength(newLength);\n }\n return *this;\n}","lang":"cpp","vul_type":"cwe-190","target_token_count":449,"sven_meta":{"func_name":"UnicodeString::doAppend","file_name":"icu4c/source/common/unistr.cpp","commit_link":"github.com/unicode-org/icu/commit/b7d08bc04a4296982fcef8b6b8a354a9e4e7afca","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#15-67865420feee","input":"static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info)\n{\n\tstruct uvesafb_pal_entry *entries;\n\tint shift = 16 - dac_width;\n\tint i, err = 0;\n\n\tif (info->var.bits_per_pixel == 8) {\n\t\tif (cmap->start + cmap->len > info->cmap.start +\n\t\t info->cmap.len || cmap->start < info->cmap.start)\n\t\t\treturn -EINVAL;\n\n\t\tentries = kmalloc(sizeof(*entries) * cmap->len, GFP_KERNEL);\n\t\tif (!entries)\n\t\t\treturn -ENOMEM;\n\n\t\tfor (i = 0; i < cmap->len; i++) {\n\t\t\tentries[i].red = cmap->red[i] >> shift;\n\t\t\tentries[i].green = cmap->green[i] >> shift;\n\t\t\tentries[i].blue = cmap->blue[i] >> shift;\n\t\t\tentries[i].pad = 0;\n\t\t}\n\t\terr = uvesafb_setpalette(entries, cmap->len, cmap->start, info);\n\t\tkfree(entries);\n\t} else {\n\t\t/*\n\t\t * For modes with bpp > 8, we only set the pseudo palette in\n\t\t * the fb_info struct. We rely on uvesafb_setcolreg to do all\n\t\t * sanity checking.\n\t\t */\n\t\tfor (i = 0; i < cmap->len; i++) {\n\t\t\terr |= uvesafb_setcolreg(cmap->start + i, cmap->red[i],\n\t\t\t\t\t\tcmap->green[i], cmap->blue[i],\n\t\t\t\t\t\t0, info);\n\t\t}\n\t}\n\treturn err;\n}","target":"static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info)\n{\n\tstruct uvesafb_pal_entry *entries;\n\tint shift = 16 - dac_width;\n\tint i, err = 0;\n\n\tif (info->var.bits_per_pixel == 8) {\n\t\tif (cmap->start + cmap->len > info->cmap.start +\n\t\t info->cmap.len || cmap->start < info->cmap.start)\n\t\t\treturn -EINVAL;\n\n\t\tentries = kmalloc_array(cmap->len, sizeof(*entries),\n\t\t\t\t\tGFP_KERNEL);\n\t\tif (!entries)\n\t\t\treturn -ENOMEM;\n\n\t\tfor (i = 0; i < cmap->len; i++) {\n\t\t\tentries[i].red = cmap->red[i] >> shift;\n\t\t\tentries[i].green = cmap->green[i] >> shift;\n\t\t\tentries[i].blue = cmap->blue[i] >> shift;\n\t\t\tentries[i].pad = 0;\n\t\t}\n\t\terr = uvesafb_setpalette(entries, cmap->len, cmap->start, info);\n\t\tkfree(entries);\n\t} else {\n\t\t/*\n\t\t * For modes with bpp > 8, we only set the pseudo palette in\n\t\t * the fb_info struct. We rely on uvesafb_setcolreg to do all\n\t\t * sanity checking.\n\t\t */\n\t\tfor (i = 0; i < cmap->len; i++) {\n\t\t\terr |= uvesafb_setcolreg(cmap->start + i, cmap->red[i],\n\t\t\t\t\t\tcmap->green[i], cmap->blue[i],\n\t\t\t\t\t\t0, info);\n\t\t}\n\t}\n\treturn err;\n}","lang":"c","vul_type":"cwe-190","target_token_count":355,"sven_meta":{"func_name":"uvesafb_setcmap","file_name":"drivers/video/fbdev/uvesafb.c","commit_link":"github.com/torvalds/linux/commit/9f645bcc566a1e9f921bdae7528a01ced5bc3713","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#17-d189ca95612d","input":"bool copyaudiodata (AFfilehandle infile, AFfilehandle outfile, int trackid)\n{\n\tint frameSize = afGetVirtualFrameSize(infile, trackid, 1);\n\n\tconst int kBufferFrameCount = 65536;\n\tvoid *buffer = malloc(kBufferFrameCount * frameSize);\n\n\tAFframecount totalFrames = afGetFrameCount(infile, AF_DEFAULT_TRACK);\n\tAFframecount totalFramesWritten = 0;\n\n\tbool success = true;\n\n\twhile (totalFramesWritten < totalFrames)\n\t{\n\t\tAFframecount framesToRead = totalFrames - totalFramesWritten;\n\t\tif (framesToRead > kBufferFrameCount)\n\t\t\tframesToRead = kBufferFrameCount;\n\n\t\tAFframecount framesRead = afReadFrames(infile, trackid, buffer,\n\t\t\tframesToRead);\n\n\t\tif (framesRead < framesToRead)\n\t\t{\n\t\t\tfprintf(stderr, \"Bad read of audio track data.\\n\");\n\t\t\tsuccess = false;\n\t\t\tbreak;\n\t\t}\n\n\t\tAFframecount framesWritten = afWriteFrames(outfile, trackid, buffer,\n\t\t\tframesRead);\n\n\t\tif (framesWritten < framesRead)\n\t\t{\n\t\t\tfprintf(stderr, \"Bad write of audio track data.\\n\");\n\t\t\tsuccess = false;\n\t\t\tbreak;\n\t\t}\n\n\t\ttotalFramesWritten += framesWritten;\n\t}\n\n\tfree(buffer);\n\n\treturn success;\n}","target":"bool copyaudiodata (AFfilehandle infile, AFfilehandle outfile, int trackid)\n{\n\tint frameSize = afGetVirtualFrameSize(infile, trackid, 1);\n\n\tint kBufferFrameCount = 65536;\n\tint bufferSize;\n\twhile (multiplyCheckOverflow(kBufferFrameCount, frameSize, &bufferSize))\n\t\tkBufferFrameCount /= 2;\n\tvoid *buffer = malloc(bufferSize);\n\n\tAFframecount totalFrames = afGetFrameCount(infile, AF_DEFAULT_TRACK);\n\tAFframecount totalFramesWritten = 0;\n\n\tbool success = true;\n\n\twhile (totalFramesWritten < totalFrames)\n\t{\n\t\tAFframecount framesToRead = totalFrames - totalFramesWritten;\n\t\tif (framesToRead > kBufferFrameCount)\n\t\t\tframesToRead = kBufferFrameCount;\n\n\t\tAFframecount framesRead = afReadFrames(infile, trackid, buffer,\n\t\t\tframesToRead);\n\n\t\tif (framesRead < framesToRead)\n\t\t{\n\t\t\tfprintf(stderr, \"Bad read of audio track data.\\n\");\n\t\t\tsuccess = false;\n\t\t\tbreak;\n\t\t}\n\n\t\tAFframecount framesWritten = afWriteFrames(outfile, trackid, buffer,\n\t\t\tframesRead);\n\n\t\tif (framesWritten < framesRead)\n\t\t{\n\t\t\tfprintf(stderr, \"Bad write of audio track data.\\n\");\n\t\t\tsuccess = false;\n\t\t\tbreak;\n\t\t}\n\n\t\ttotalFramesWritten += framesWritten;\n\t}\n\n\tfree(buffer);\n\n\treturn success;\n}","lang":"c","vul_type":"cwe-190","target_token_count":310,"sven_meta":{"func_name":"copyaudiodata","file_name":"sfcommands/sfconvert.c","commit_link":"github.com/antlarr/audiofile/commit/7d65f89defb092b63bcbc5d98349fb222ca73b3c","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#23-d91a1a46f304","input":"String StringUtil::Implode(const Variant& items, const String& delim,\n const bool checkIsContainer /* = true */) {\n if (checkIsContainer && !isContainer(items)) {\n throw_param_is_not_container();\n }\n int size = getContainerSize(items);\n if (size == 0) return empty_string();\n\n req::vector sitems;\n sitems.reserve(size);\n int len = 0;\n int lenDelim = delim.size();\n for (ArrayIter iter(items); iter; ++iter) {\n sitems.emplace_back(iter.second().toString());\n len += sitems.back().size() + lenDelim;\n }\n len -= lenDelim; // always one delimiter less than count of items\n assert(sitems.size() == size);\n\n String s = String(len, ReserveString);\n char *buffer = s.mutableData();\n const char *sdelim = delim.data();\n char *p = buffer;\n String &init_str = sitems[0];\n int init_len = init_str.size();\n memcpy(p, init_str.data(), init_len);\n p += init_len;\n for (int i = 1; i < size; i++) {\n String &item = sitems[i];\n memcpy(p, sdelim, lenDelim);\n p += lenDelim;\n int lenItem = item.size();\n memcpy(p, item.data(), lenItem);\n p += lenItem;\n }\n assert(p - buffer == len);\n s.setSize(len);\n return s;\n}","target":"String StringUtil::Implode(const Variant& items, const String& delim,\n const bool checkIsContainer /* = true */) {\n if (checkIsContainer && !isContainer(items)) {\n throw_param_is_not_container();\n }\n int size = getContainerSize(items);\n if (size == 0) return empty_string();\n\n req::vector sitems;\n sitems.reserve(size);\n size_t len = 0;\n size_t lenDelim = delim.size();\n for (ArrayIter iter(items); iter; ++iter) {\n sitems.emplace_back(iter.second().toString());\n len += sitems.back().size() + lenDelim;\n }\n len -= lenDelim; // always one delimiter less than count of items\n assert(sitems.size() == size);\n\n String s = String(len, ReserveString);\n char *buffer = s.mutableData();\n const char *sdelim = delim.data();\n char *p = buffer;\n String &init_str = sitems[0];\n int init_len = init_str.size();\n memcpy(p, init_str.data(), init_len);\n p += init_len;\n for (int i = 1; i < size; i++) {\n String &item = sitems[i];\n memcpy(p, sdelim, lenDelim);\n p += lenDelim;\n int lenItem = item.size();\n memcpy(p, item.data(), lenItem);\n p += lenItem;\n }\n assert(p - buffer == len);\n s.setSize(len);\n return s;\n}","lang":"cpp","vul_type":"cwe-190","target_token_count":330,"sven_meta":{"func_name":"HPHP::StringUtil::Implode","file_name":"hphp/runtime/base/string-util.cpp","commit_link":"github.com/facebook/hhvm/commit/2c9a8fcc73a151608634d3e712973d192027c271","source_cwe_file":"cwe-190.jsonl"}} diff --git a/sven_rl_buckets/train/512_inf.jsonl b/sven_rl_buckets/train/512_inf.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..ddceb6e5c4c17da1e9f43b9fe54f702090604650 --- /dev/null +++ b/sven_rl_buckets/train/512_inf.jsonl @@ -0,0 +1,247 @@ +{"problem_id":"cwe-089#1-84917ebb1e63","input":" def check_and_update_ranks(self, scene):\n # There are 2 cases here:\n # 1) Ranks have never been calculated for this scene before\n # - This means we need to calculate what the ranks were every month of this scenes history\n # - We should only do this if ranks don't already exist for this scene\n # 2) Ranks have been calculated for this scene before\n # - We already have bulk ranks. We should check if it has been more than 1 month since we last\n # calculated ranks. If so, calculate again with the brackets that have come out this month\n\n LOG.info('About to check if ranks need updating for {}'.format(scene))\n # First, do we have any ranks for this scene already?\n sql = 'select count(*) from ranks where scene=\"{}\";'.format(scene)\n res = self.db.exec(sql)\n count = res[0][0]\n\n n = 5 if (scene == 'pro' or scene == 'pro_wiiu') else constants.TOURNAMENTS_PER_RANK\n if count == 0:\n LOG.info('Detected that we need to bulk update ranks for {}'.format(scene))\n # Alright, we have nothing. Bulk update ranks\n first_month = bracket_utils.get_first_month(self.db, scene)\n last_month = bracket_utils.get_last_month(self.db, scene)\n \n # Iterate through all tournaments going month by month, and calculate ranks\n months = bracket_utils.iter_months(first_month, last_month, include_first=False, include_last=True)\n for month in months:\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)\n else:\n\n # Get the date of the last time we calculated ranks\n sql = \"select date from ranks where scene='{}' order by date desc limit 1;\".format(scene)\n res = self.db.exec(sql)\n last_rankings_date = res[0][0]\n\n # Check to see if it's been more than 1 month since we last calculated ranks\n more_than_one_month = bracket_utils.has_month_passed(last_rankings_date)\n if more_than_one_month:\n # Get only the last n tournaments, so it doesn't take too long to process\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n msg = 'Detected that we need up update monthly ranks for {}, on {}'.format(scene, today)\n LOG.info(msg)\n\n # We should only ever calculate ranks on the 1st. If today is not the first, log error\n if not today.split('-')[-1] == '1':\n LOG.exc('We are calculating ranks today, {}, but it isnt the first'.format(today))\n\n months = bracket_utils.iter_months(last_rankings_date, today, include_first=False, include_last=True)\n for month in months:\n # Make sure that we actually have matches during this month\n # Say we are trying to calculate ranks for 2018-05-01, the player would need to have matches during 2018-04-01, 2018-04-30\n prev_date = bracket_utils.get_previous_month(month)\n brackets_during_month = bracket_utils.get_tournaments_during_month(self.db, scene, prev_date)\n\n if len(brackets_during_month) > 0:\n tweet('Calculating {} ranks for {}'.format(month, scene))\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)\n\n else:\n LOG.info('It has not yet been 1 month since we calculated ranks for {}. Skipping'.format(scene))","target":" def check_and_update_ranks(self, scene):\n # There are 2 cases here:\n # 1) Ranks have never been calculated for this scene before\n # - This means we need to calculate what the ranks were every month of this scenes history\n # - We should only do this if ranks don't already exist for this scene\n # 2) Ranks have been calculated for this scene before\n # - We already have bulk ranks. We should check if it has been more than 1 month since we last\n # calculated ranks. If so, calculate again with the brackets that have come out this month\n\n LOG.info('About to check if ranks need updating for {}'.format(scene))\n # First, do we have any ranks for this scene already?\n sql = 'select count(*) from ranks where scene=\"{scene}\";'\n args = {'scene': scene}\n res = self.db.exec(sql, args)\n count = res[0][0]\n\n n = 5 if (scene == 'pro' or scene == 'pro_wiiu') else constants.TOURNAMENTS_PER_RANK\n if count == 0:\n LOG.info('Detected that we need to bulk update ranks for {}'.format(scene))\n # Alright, we have nothing. Bulk update ranks\n first_month = bracket_utils.get_first_month(self.db, scene)\n last_month = bracket_utils.get_last_month(self.db, scene)\n \n # Iterate through all tournaments going month by month, and calculate ranks\n months = bracket_utils.iter_months(first_month, last_month, include_first=False, include_last=True)\n for month in months:\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)\n else:\n\n # Get the date of the last time we calculated ranks\n sql = \"select date from ranks where scene='{scene}' order by date desc limit 1;\"\n args = {'scene': scene}\n res = self.db.exec(sql, args)\n last_rankings_date = res[0][0]\n\n # Check to see if it's been more than 1 month since we last calculated ranks\n more_than_one_month = bracket_utils.has_month_passed(last_rankings_date)\n if more_than_one_month:\n # Get only the last n tournaments, so it doesn't take too long to process\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n msg = 'Detected that we need up update monthly ranks for {}, on {}'.format(scene, today)\n LOG.info(msg)\n\n # We should only ever calculate ranks on the 1st. If today is not the first, log error\n if not today.split('-')[-1] == '1':\n LOG.exc('We are calculating ranks today, {}, but it isnt the first'.format(today))\n\n months = bracket_utils.iter_months(last_rankings_date, today, include_first=False, include_last=True)\n for month in months:\n # Make sure that we actually have matches during this month\n # Say we are trying to calculate ranks for 2018-05-01, the player would need to have matches during 2018-04-01, 2018-04-30\n prev_date = bracket_utils.get_previous_month(month)\n brackets_during_month = bracket_utils.get_tournaments_during_month(self.db, scene, prev_date)\n\n if len(brackets_during_month) > 0:\n tweet('Calculating {} ranks for {}'.format(month, scene))\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)\n\n else:\n LOG.info('It has not yet been 1 month since we calculated ranks for {}. Skipping'.format(scene))","lang":"python","vul_type":"cwe-089","target_token_count":828,"sven_meta":{"func_name":"check_and_update_ranks","file_name":"process_data.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#26-bb8002dde220","input":" @unpack\n def test_process_as_form(self, job_number, dcn_key, was_prev_matched,\n was_prev_closed, was_prev_tracked):\n email_obj = {\n 'sender' : \"Alex Roy \",\n 'subject' : \"DO NOT MODIFY MESSAGE BELOW - JUST HIT `SEND`\",\n 'date' : \"Tue, 7 May 2019 17:34:17 +0000\",\n 'content' : (\n f\"job_number={job_number}&title=TEST_ENTRY&city=Ottawa&\"\n f\"address=2562+Del+Zotto+Ave.%2C+Ottawa%2C+Ontario&\"\n f\"contractor=GCN&engineer=Goodkey&owner=Douglas+Stalker&\"\n f\"quality=2&cc_email=&link_to_cert={dcn_key}\\r\\n\"\n )\n }\n # set-up new entries in db, if necessary\n fake_dilfo_insert = \"\"\"\n INSERT INTO df_dilfo (job_number, receiver_email, closed)\n VALUES ({}, 'alex.roy616@gmail.com', {})\n \"\"\"\n fake_match_insert = \"\"\"\n INSERT INTO df_matched (job_number, verifier, ground_truth)\n VALUES ({}, 'alex.roy616@gmail.com', {})\n \"\"\"\n with create_connection() as conn:\n if was_prev_closed or was_prev_tracked:\n conn.cursor().execute(fake_dilfo_insert.format(job_number, was_prev_closed))\n if was_prev_matched:\n if was_prev_closed:\n conn.cursor().execute(fake_match_insert.format(job_number, 1))\n else:\n conn.cursor().execute(fake_match_insert.format(job_number, 0))\n with create_connection() as conn:\n df_dilfo_pre = pd.read_sql(f\"SELECT * FROM df_dilfo WHERE job_number={job_number}\", conn)\n df_matched_pre = pd.read_sql(f\"SELECT * FROM df_matched WHERE job_number={job_number}\", conn)\n process_as_form(email_obj)\n # make assertions about db now that reply has been processed\n with create_connection() as conn:\n df_dilfo_post = pd.read_sql(f\"SELECT * FROM df_dilfo WHERE job_number={job_number}\", conn)\n df_matched_post = pd.read_sql(f\"SELECT * FROM df_matched WHERE job_number={job_number}\", conn)\n self.assertEqual(len(df_dilfo_post), 1)\n self.assertEqual(bool(df_dilfo_post.iloc[0].closed), bool(was_prev_closed or dcn_key))\n self.assertEqual(any(df_matched_post.ground_truth), bool(was_prev_closed or dcn_key))\n self.assertEqual(len(df_matched_pre) + bool(dcn_key and not(was_prev_closed)), len(df_matched_post))\n self.assertEqual(list(df_matched_pre.columns), list(df_matched_post.columns))\n self.assertEqual(list(df_dilfo_pre.columns), list(df_dilfo_post.columns))","target":" @unpack\n def test_process_as_form(self, job_number, dcn_key, was_prev_matched,\n was_prev_closed, was_prev_tracked):\n email_obj = {\n 'sender' : \"Alex Roy \",\n 'subject' : \"DO NOT MODIFY MESSAGE BELOW - JUST HIT `SEND`\",\n 'date' : \"Tue, 7 May 2019 17:34:17 +0000\",\n 'content' : (\n f\"job_number={job_number}&title=TEST_ENTRY&city=Ottawa&\"\n f\"address=2562+Del+Zotto+Ave.%2C+Ottawa%2C+Ontario&\"\n f\"contractor=GCN&engineer=Goodkey&owner=Douglas+Stalker&\"\n f\"quality=2&cc_email=&link_to_cert={dcn_key}\\r\\n\"\n )\n }\n # set-up new entries in db, if necessary\n fake_dilfo_insert = \"\"\"\n INSERT INTO df_dilfo (job_number, receiver_email, closed)\n VALUES (?, 'alex.roy616@gmail.com', ?)\n \"\"\"\n fake_match_insert = \"\"\"\n INSERT INTO df_matched (job_number, verifier, ground_truth)\n VALUES (?, 'alex.roy616@gmail.com', ?)\n \"\"\"\n with create_connection() as conn:\n if was_prev_closed or was_prev_tracked:\n conn.cursor().execute(fake_dilfo_insert, [job_number, was_prev_closed])\n if was_prev_matched:\n if was_prev_closed:\n conn.cursor().execute(fake_match_insert, [job_number, 1])\n else:\n conn.cursor().execute(fake_match_insert, [job_number, 0])\n with create_connection() as conn:\n df_dilfo_pre = pd.read_sql(\"SELECT * FROM df_dilfo WHERE job_number=?\", conn, params=[job_number])\n df_matched_pre = pd.read_sql(\"SELECT * FROM df_matched WHERE job_number=?\", conn, params=[job_number])\n process_as_form(email_obj)\n # make assertions about db now that reply has been processed\n with create_connection() as conn:\n df_dilfo_post = pd.read_sql(\"SELECT * FROM df_dilfo WHERE job_number=?\", conn, params=[job_number])\n df_matched_post = pd.read_sql(\"SELECT * FROM df_matched WHERE job_number=?\", conn, params=[job_number])\n self.assertEqual(len(df_dilfo_post), 1)\n self.assertEqual(bool(df_dilfo_post.iloc[0].closed), bool(was_prev_closed or dcn_key))\n self.assertEqual(any(df_matched_post.ground_truth), bool(was_prev_closed or dcn_key))\n self.assertEqual(len(df_matched_pre) + bool(dcn_key and not(was_prev_closed)), len(df_matched_post))\n self.assertEqual(list(df_matched_pre.columns), list(df_matched_post.columns))\n self.assertEqual(list(df_dilfo_pre.columns), list(df_dilfo_post.columns))","lang":"python","vul_type":"cwe-089","target_token_count":648,"sven_meta":{"func_name":"test_process_as_form","file_name":"tests.py","commit_link":"github.com/confirmationbias616/certificate_checker/commit/9e890b9613b627e3a5995d0e4a594c8e0831e2ce","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#40-25a55ed284e5","input":" @staticmethod\n def get_mapped_projects(user_id: int, preferred_locale: str) -> UserMappedProjectsDTO:\n \"\"\" Get all projects a user has mapped on \"\"\"\n\n # This query looks scary, but we're really just creating an outer join between the query that gets the\n # counts of all mapped tasks and the query that gets counts of all validated tasks. This is necessary to\n # handle cases where users have only validated tasks on a project, or only mapped on a project.\n sql = '''SELECT p.id,\n p.status,\n p.default_locale,\n c.mapped,\n c.validated,\n st_asgeojson(p.centroid)\n FROM projects p,\n (SELECT coalesce(v.project_id, m.project_id) project_id,\n coalesce(v.validated, 0) validated,\n coalesce(m.mapped, 0) mapped\n FROM (SELECT t.project_id,\n count (t.validated_by) validated\n FROM tasks t\n WHERE t.project_id IN (SELECT unnest(projects_mapped) FROM users WHERE id = {0})\n AND t.validated_by = {0}\n GROUP BY t.project_id, t.validated_by) v\n FULL OUTER JOIN\n (SELECT t.project_id,\n count(t.mapped_by) mapped\n FROM tasks t\n WHERE t.project_id IN (SELECT unnest(projects_mapped) FROM users WHERE id = {0})\n AND t.mapped_by = {0}\n GROUP BY t.project_id, t.mapped_by) m\n ON v.project_id = m.project_id) c\n WHERE p.id = c.project_id ORDER BY p.id DESC'''.format(user_id)\n\n results = db.engine.execute(sql)\n\n if results.rowcount == 0:\n raise NotFound()\n\n mapped_projects_dto = UserMappedProjectsDTO()\n for row in results:\n mapped_project = MappedProject()\n mapped_project.project_id = row[0]\n mapped_project.status = ProjectStatus(row[1]).name\n mapped_project.tasks_mapped = row[3]\n mapped_project.tasks_validated = row[4]\n mapped_project.centroid = geojson.loads(row[5])\n\n project_info = ProjectInfo.get_dto_for_locale(row[0], preferred_locale, row[2])\n mapped_project.name = project_info.name\n\n mapped_projects_dto.mapped_projects.append(mapped_project)\n\n return mapped_projects_dto","target":" @staticmethod\n def get_mapped_projects(user_id: int, preferred_locale: str) -> UserMappedProjectsDTO:\n \"\"\" Get all projects a user has mapped on \"\"\"\n\n # This query looks scary, but we're really just creating an outer join between the query that gets the\n # counts of all mapped tasks and the query that gets counts of all validated tasks. This is necessary to\n # handle cases where users have only validated tasks on a project, or only mapped on a project.\n sql = '''SELECT p.id,\n p.status,\n p.default_locale,\n c.mapped,\n c.validated,\n st_asgeojson(p.centroid)\n FROM projects p,\n (SELECT coalesce(v.project_id, m.project_id) project_id,\n coalesce(v.validated, 0) validated,\n coalesce(m.mapped, 0) mapped\n FROM (SELECT t.project_id,\n count (t.validated_by) validated\n FROM tasks t\n WHERE t.project_id IN (SELECT unnest(projects_mapped) FROM users WHERE id = :user_id)\n AND t.validated_by = :user_id\n GROUP BY t.project_id, t.validated_by) v\n FULL OUTER JOIN\n (SELECT t.project_id,\n count(t.mapped_by) mapped\n FROM tasks t\n WHERE t.project_id IN (SELECT unnest(projects_mapped) FROM users WHERE id = :user_id)\n AND t.mapped_by = :user_id\n GROUP BY t.project_id, t.mapped_by) m\n ON v.project_id = m.project_id) c\n WHERE p.id = c.project_id ORDER BY p.id DESC'''\n\n results = db.engine.execute(text(sql), user_id=user_id)\n\n if results.rowcount == 0:\n raise NotFound()\n\n mapped_projects_dto = UserMappedProjectsDTO()\n for row in results:\n mapped_project = MappedProject()\n mapped_project.project_id = row[0]\n mapped_project.status = ProjectStatus(row[1]).name\n mapped_project.tasks_mapped = row[3]\n mapped_project.tasks_validated = row[4]\n mapped_project.centroid = geojson.loads(row[5])\n\n project_info = ProjectInfo.get_dto_for_locale(row[0], preferred_locale, row[2])\n mapped_project.name = project_info.name\n\n mapped_projects_dto.mapped_projects.append(mapped_project)\n\n return mapped_projects_dto","lang":"python","vul_type":"cwe-089","target_token_count":514,"sven_meta":{"func_name":"get_mapped_projects","file_name":"server/models/postgis/user.py","commit_link":"github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#54-a742f6eac109","input":"@app.route('/get_asset_and_volume')\ndef get_asset_and_volume():\n asset_id = request.args.get('asset_id')\n\n if not isObject(asset_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_asset_symbols\",[[\"' + asset_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n asset_id = j_l[\"result\"][0][\"id\"]\n\n #print asset_id\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"get_assets\",[[\"' + asset_id + '\"], 0]]}')\n result = ws.recv()\n j = json.loads(result)\n\n dynamic_asset_data_id = j[\"result\"][0][\"dynamic_asset_data_id\"]\n\n ws.send('{\"id\": 1, \"method\": \"call\", \"params\": [0, \"get_objects\", [[\"'+dynamic_asset_data_id+'\"]]]}')\n result2 = ws.recv()\n j2 = json.loads(result2)\n #print j2[\"result\"][0][\"current_supply\"]\n\n j[\"result\"][0][\"current_supply\"] = j2[\"result\"][0][\"current_supply\"]\n j[\"result\"][0][\"confidential_supply\"] = j2[\"result\"][0][\"confidential_supply\"]\n #print j[\"result\"]\n\n j[\"result\"][0][\"accumulated_fees\"] = j2[\"result\"][0][\"accumulated_fees\"]\n j[\"result\"][0][\"fee_pool\"] = j2[\"result\"][0][\"fee_pool\"]\n\n issuer = j[\"result\"][0][\"issuer\"]\n ws.send('{\"id\": 1, \"method\": \"call\", \"params\": [0, \"get_objects\", [[\"'+issuer+'\"]]]}')\n result3 = ws.recv()\n j3 = json.loads(result3)\n j[\"result\"][0][\"issuer_name\"] = j3[\"result\"][0][\"name\"]\n\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT volume, mcap FROM assets WHERE aid='\"+asset_id+\"'\"\n cur.execute(query)\n results = cur.fetchall()\n con.close()\n try:\n j[\"result\"][0][\"volume\"] = results[0][0]\n j[\"result\"][0][\"mcap\"] = results[0][1]\n except:\n j[\"result\"][0][\"volume\"] = 0\n j[\"result\"][0][\"mcap\"] = 0\n\n return jsonify(j[\"result\"])","target":"@app.route('/get_asset_and_volume')\ndef get_asset_and_volume():\n asset_id = request.args.get('asset_id')\n\n if not isObject(asset_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_asset_symbols\",[[\"' + asset_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n asset_id = j_l[\"result\"][0][\"id\"]\n\n #print asset_id\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"get_assets\",[[\"' + asset_id + '\"], 0]]}')\n result = ws.recv()\n j = json.loads(result)\n\n dynamic_asset_data_id = j[\"result\"][0][\"dynamic_asset_data_id\"]\n\n ws.send('{\"id\": 1, \"method\": \"call\", \"params\": [0, \"get_objects\", [[\"'+dynamic_asset_data_id+'\"]]]}')\n result2 = ws.recv()\n j2 = json.loads(result2)\n #print j2[\"result\"][0][\"current_supply\"]\n\n j[\"result\"][0][\"current_supply\"] = j2[\"result\"][0][\"current_supply\"]\n j[\"result\"][0][\"confidential_supply\"] = j2[\"result\"][0][\"confidential_supply\"]\n #print j[\"result\"]\n\n j[\"result\"][0][\"accumulated_fees\"] = j2[\"result\"][0][\"accumulated_fees\"]\n j[\"result\"][0][\"fee_pool\"] = j2[\"result\"][0][\"fee_pool\"]\n\n issuer = j[\"result\"][0][\"issuer\"]\n ws.send('{\"id\": 1, \"method\": \"call\", \"params\": [0, \"get_objects\", [[\"'+issuer+'\"]]]}')\n result3 = ws.recv()\n j3 = json.loads(result3)\n j[\"result\"][0][\"issuer_name\"] = j3[\"result\"][0][\"name\"]\n\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT volume, mcap FROM assets WHERE aid=%s\"\n cur.execute(query, (asset_id,))\n results = cur.fetchall()\n con.close()\n try:\n j[\"result\"][0][\"volume\"] = results[0][0]\n j[\"result\"][0][\"mcap\"] = results[0][1]\n except:\n j[\"result\"][0][\"volume\"] = 0\n j[\"result\"][0][\"mcap\"] = 0\n\n return jsonify(j[\"result\"])","lang":"python","vul_type":"cwe-089","target_token_count":536,"sven_meta":{"func_name":"get_asset_and_volume","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#62-4bd30e8d44e6","input":"def process_form():\n # see https://docs.python.org/3.4/library/cgi.html for the basic usage\n # here.\n form = cgi.FieldStorage()\n\n\n # connect to the database\n conn = MySQLdb.connect(host = pnsdp.SQL_HOST,\n user = pnsdp.SQL_USER,\n passwd = pnsdp.SQL_PASSWD,\n db = pnsdp.SQL_DB)\n\n\n if \"user\" not in form or \"game\" not in form:\n raise FormError(\"Invalid parameters.\")\n if \"pos\" not in form and \"resign\" not in form:\n raise FormError(\"Invalid parameters.\")\n\n game = int(form[\"game\"].value)\n\n\n (players,size,state) = get_game_info(conn, game)\n\n user = form[\"user\"].value\n if user not in players:\n raise FormError(\"Invalid player ID - player is not part of this game\")\n\n\n if \"resign\" in form:\n resign = True\n else:\n resign = False\n pos = form[\"pos\"].value.split(\",\")\n assert len(pos) == 2\n x = int(pos[0])\n y = int(pos[1])\n\n\n (board,nextPlayer,letter) = build_board(conn, game,size)\n\n if user != players[nextPlayer]:\n raise FormError(\"Internal error, incorrect player is attempting to move.\")\n\n\n if resign:\n # this user is choosing to resign. Update the game state to reflect that.\n other_player_name = players[1-nextPlayer]\n\n cursor = conn.cursor()\n cursor.execute(\"\"\"UPDATE games SET state=\"%s:resignation\" WHERE id=%d;\"\"\" % (other_player_name,game))\n cursor.close()\n\n else:\n assert x >= 0 and x < size\n assert y >= 0 and y < size\n\n assert board[x][y] == \"\"\n board[x][y] = \"XO\"[nextPlayer]\n\n # we've done all of our sanity checks. We now know enough to say that\n # it's safe to add a new move.\n cursor = conn.cursor()\n cursor.execute(\"\"\"INSERT INTO moves(gameID,x,y,letter,time) VALUES(%d,%d,%d,\"%s\",NOW());\"\"\" % (game,x,y,letter))\n\n if cursor.rowcount != 1:\n raise FormError(\"Could not make move, reason unknown.\")\n\n cursor.close()\n\n result = analyze_board(board)\n if result != \"\":\n if result == \"win\":\n result = players[nextPlayer]+\":win\"\n\n cursor = conn.cursor()\n cursor.execute(\"\"\"UPDATE games SET state=\"%s\" WHERE id=%d;\"\"\" % (result,game))\n cursor.close()\n\n # we've made changes, make sure to commit them!\n conn.commit()\n conn.close()\n\n\n # return the parms to the caller, so that they can build a good redirect\n return (user,game)","target":"def process_form():\n # see https://docs.python.org/3.4/library/cgi.html for the basic usage\n # here.\n form = cgi.FieldStorage()\n\n\n # connect to the database\n conn = MySQLdb.connect(host = pnsdp.SQL_HOST,\n user = pnsdp.SQL_USER,\n passwd = pnsdp.SQL_PASSWD,\n db = pnsdp.SQL_DB)\n\n\n if \"user\" not in form or \"game\" not in form:\n raise FormError(\"Invalid parameters.\")\n if \"pos\" not in form and \"resign\" not in form:\n raise FormError(\"Invalid parameters.\")\n\n game = int(form[\"game\"].value)\n\n\n (players,size,state) = get_game_info(conn, game)\n\n user = form[\"user\"].value\n if user not in players:\n raise FormError(\"Invalid player ID - player is not part of this game\")\n\n\n if \"resign\" in form:\n resign = True\n else:\n resign = False\n pos = form[\"pos\"].value.split(\",\")\n assert len(pos) == 2\n x = int(pos[0])\n y = int(pos[1])\n\n\n (board,nextPlayer,letter) = build_board(conn, game,size)\n\n if user != players[nextPlayer]:\n raise FormError(\"Internal error, incorrect player is attempting to move.\")\n\n\n if resign:\n # this user is choosing to resign. Update the game state to reflect that.\n other_player_name = players[1-nextPlayer]\n\n cursor = conn.cursor()\n cursor.execute(\"\"\"UPDATE games SET state=\"%s:resignation\" WHERE id=%d;\"\"\", (other_player_name,game))\n cursor.close()\n\n else:\n assert x >= 0 and x < size\n assert y >= 0 and y < size\n\n assert board[x][y] == \"\"\n board[x][y] = \"XO\"[nextPlayer]\n\n # we've done all of our sanity checks. We now know enough to say that\n # it's safe to add a new move.\n cursor = conn.cursor()\n cursor.execute(\"\"\"INSERT INTO moves(gameID,x,y,letter,time) VALUES(%d,%d,%d,\"%s\",NOW());\"\"\", (game,x,y,letter))\n\n if cursor.rowcount != 1:\n raise FormError(\"Could not make move, reason unknown.\")\n\n cursor.close()\n\n result = analyze_board(board)\n if result != \"\":\n if result == \"win\":\n result = players[nextPlayer]+\":win\"\n\n cursor = conn.cursor()\n cursor.execute(\"\"\"UPDATE games SET state=\"%s\" WHERE id=%d;\"\"\", (result,game))\n cursor.close()\n\n # we've made changes, make sure to commit them!\n conn.commit()\n conn.close()\n\n\n # return the parms to the caller, so that they can build a good redirect\n return (user,game)","lang":"python","vul_type":"cwe-089","target_token_count":617,"sven_meta":{"func_name":"process_form","file_name":"cgi/move.py","commit_link":"github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#100-015603151241","input":"def update_user(username, chat_id, last_update):\n conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\users\\\\\" + username + '.db')\n conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n cursor = conn.cursor()\n cursor2 = conn2.cursor()\n cursor_settings = settings.cursor()\n cursor_settings.execute(\"select last_problem from users where chat_id = '\" + str(chat_id) + \"'\")\n update_eq = cursor_settings.fetchone()\n cursor_settings.execute(\"select * from last_update_problemset\")\n update_base = cursor_settings.fetchone()\n last_problem = update_base[0]\n if update_eq[0] != update_base[0]:\n cursor2.execute(\"SELECT * FROM problems\")\n x = cursor2.fetchone()\n while x != None:\n cursor.execute(\"select * from result where problem = '\" + str(x[0]) + \"' and diff = '\" + str(x[1]) + \"'\")\n x2 = cursor.fetchone()\n if x2 == None:\n cursor.execute(\"insert into result values (?, ?, ? )\", (x[0], x[1], \"NULL\"))\n last_problem = x\n x = cursor2.fetchone()\n conn2.close()\n settings.close()\n if len(last_problem) == 2:\n last_problem = last_problem[0] + last_problem[1]\n\n url = 'http://codeforces.com/submissions/' + username\n r = requests.get(url)\n max_page = 1\n soup = BeautifulSoup(r.text, \"lxml\")\n\n for link in soup.find_all(attrs={\"class\": \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[4]))\n\n v = False\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/0')\n soup = BeautifulSoup(r.text, \"lxml\")\n last_try_new = soup.find(attrs={\"class\": \"status-small\"})\n last_try_new = str(last_try_new).split()\n last_try_new = str(last_try_new[2]) + str(last_try_new[3])\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n count = 0\n j = 0\n ver = soup.find_all(attrs={\"class\": \"submissionVerdictWrapper\"})\n last_try = soup.find_all(attrs={\"class\": \"status-small\"})\n for link in soup.find_all('a'):\n last_try_date = str(last_try[j]).split()\n last_try_date = str(last_try_date[2]) + str(last_try_date[3])\n if last_try_date == last_update:\n v = True\n break\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5:\n s2 = str(ver[count]).split()\n s2 = s2[5].split('\\\"')\n count += 1\n j += 1\n cursor.execute(\"select * from result where problem = '\" + s[3] + \"'and diff = '\" + s[4] + \"'\")\n x = cursor.fetchone()\n if s2[1] == 'OK' and x != None:\n cursor.execute(\n \"update result set verdict = '\" + s2[1] + \"' where problem = '\" + s[3] + \"' and diff = '\" +\n s[4] + \"'\")\n if x[2] != 'OK':\n cursor.execute(\n \"update result set verdict = '\" + s2[1] + \"' where problem = '\" + s[3] + \"' and diff = '\" +\n s[4] + \"'\")\n if v:\n break\n\n conn.commit()\n conn.close()\n\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"update users set username = '\" + str(username) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set last_update = '\" + str(last_try_new) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set last_problem = '\" + str(last_problem) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n\n settings.commit()\n settings.close()","target":"def update_user(username, chat_id, last_update):\n conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\users\\\\\" + username + '.db')\n conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n cursor = conn.cursor()\n cursor2 = conn2.cursor()\n cursor_settings = settings.cursor()\n cursor_settings.execute(\"select last_problem from users where chat_id = ?\", (str(chat_id), ))\n update_eq = cursor_settings.fetchone()\n cursor_settings.execute(\"select * from last_update_problemset\")\n update_base = cursor_settings.fetchone()\n last_problem = update_base[0]\n if update_eq[0] != update_base[0]:\n cursor2.execute(\"SELECT * FROM problems\")\n x = cursor2.fetchone()\n while x != None:\n cursor.execute(\"select * from result where problem = ? and diff = ?\", (str(x[0]), str(x[1])))\n x2 = cursor.fetchone()\n if x2 == None:\n cursor.execute(\"insert into result values (?, ?, ? )\", (x[0], x[1], \"NULL\"))\n last_problem = x\n x = cursor2.fetchone()\n conn2.close()\n settings.close()\n if len(last_problem) == 2:\n last_problem = last_problem[0] + last_problem[1]\n\n url = 'http://codeforces.com/submissions/' + username\n r = requests.get(url)\n max_page = 1\n soup = BeautifulSoup(r.text, \"lxml\")\n\n for link in soup.find_all(attrs={\"class\": \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[4]))\n\n v = False\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/0')\n soup = BeautifulSoup(r.text, \"lxml\")\n last_try_new = soup.find(attrs={\"class\": \"status-small\"})\n last_try_new = str(last_try_new).split()\n last_try_new = str(last_try_new[2]) + str(last_try_new[3])\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n count = 0\n j = 0\n ver = soup.find_all(attrs={\"class\": \"submissionVerdictWrapper\"})\n last_try = soup.find_all(attrs={\"class\": \"status-small\"})\n for link in soup.find_all('a'):\n last_try_date = str(last_try[j]).split()\n last_try_date = str(last_try_date[2]) + str(last_try_date[3])\n if last_try_date == last_update:\n v = True\n break\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5:\n s2 = str(ver[count]).split()\n s2 = s2[5].split('\\\"')\n count += 1\n j += 1\n cursor.execute(\"select * from result where problem = ? and diff = ?\", (s[3], s[4]))\n x = cursor.fetchone()\n if s2[1] == 'OK' and x != None:\n cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n if x[2] != 'OK':\n cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n if v:\n break\n\n conn.commit()\n conn.close()\n\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"update users set username = ? where chat_id = ?\", (str(username), str(chat_id)))\n conn.execute(\"update users set last_update = ? where chat_id = ?\", (str(last_try_new), str(chat_id)))\n conn.execute(\"update users set last_problem = ? where chat_id = ?\", (str(last_problem), str(chat_id)))\n\n settings.commit()\n settings.close()","lang":"python","vul_type":"cwe-089","target_token_count":949,"sven_meta":{"func_name":"update_user","file_name":"bases/update.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#135-779c261cbe66","input":"def init_user(username, chat_id):\n conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\users\\\\\" + username + '.db')\n conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n cursor = conn.cursor()\n cursor2 = conn2.cursor()\n cursor.execute(\"CREATE TABLE result (problem INTEGER, diff STRING, verdict STRING)\")\n cursor2.execute(\"SELECT * FROM problems\")\n x = cursor2.fetchone()\n while x != None:\n cursor.execute(\"insert into result values (?, ?, ? )\", (x[0], x[1], \"NULL\"))\n x = cursor2.fetchone()\n\n url = 'http://codeforces.com/submissions/' + username\n r = requests.get(url)\n max_page = 1\n soup = BeautifulSoup(r.text, \"lxml\")\n\n for link in soup.find_all(attrs={\"class\": \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[4]))\n\n old = \"\"\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/0')\n soup = BeautifulSoup(r.text, \"lxml\")\n last_try = soup.find(attrs={\"class\":\"status-small\"})\n if not last_try == None:\n last_try = str(last_try).split()\n last_try = str(last_try[2]) + str(last_try[3])\n\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n count = 0\n ver = soup.find_all(attrs={\"class\": \"submissionVerdictWrapper\"})\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5:\n s2 = str(ver[count]).split()\n s2 = s2[5].split('\\\"')\n count += 1\n cursor.execute(\"select * from result where problem = '\" + s[3] + \"'and diff = '\" + s[4] + \"'\")\n x = cursor.fetchone()\n if s2[1] == 'OK' and x != None:\n cursor.execute(\"update result set verdict = '\" + s2[1] + \"' where problem = '\" + s[3] + \"' and diff = '\" + s[4] + \"'\")\n if x != None and x[2] != 'OK':\n cursor.execute(\"update result set verdict = '\" + s2[1] +\"' where problem = '\" + s[3] + \"' and diff = '\" + s[4] + \"'\")\n\n conn.commit()\n conn.close()\n conn2.close()\n\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from last_update_problemset\")\n last_problem = conn.fetchone()\n conn.execute(\"select * from users where chat_id = '\" + str(chat_id) + \"'\")\n x = conn.fetchone()\n if x == None:\n conn.execute(\"insert into users values (?, ?, ?, ?, ?)\", (chat_id, username, str(last_try), str(last_problem[0]), 1))\n else:\n conn.execute(\"update users set username = '\" + str(username) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set last_update = '\" + str(last_try) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set last_problem = '\" + str(last_problem[0]) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set state = '\" + str(1) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n settings.commit()\n settings.close()","target":"def init_user(username, chat_id):\n conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\users\\\\\" + username + '.db')\n conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n cursor = conn.cursor()\n cursor2 = conn2.cursor()\n cursor.execute(\"CREATE TABLE result (problem INTEGER, diff STRING, verdict STRING)\")\n cursor2.execute(\"SELECT * FROM problems\")\n x = cursor2.fetchone()\n while x != None:\n cursor.execute(\"insert into result values (?, ?, ? )\", (x[0], x[1], \"NULL\"))\n x = cursor2.fetchone()\n\n url = 'http://codeforces.com/submissions/' + username\n r = requests.get(url)\n max_page = 1\n soup = BeautifulSoup(r.text, \"lxml\")\n\n for link in soup.find_all(attrs={\"class\": \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[4]))\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/0')\n soup = BeautifulSoup(r.text, \"lxml\")\n last_try = soup.find(attrs={\"class\":\"status-small\"})\n if not last_try == None:\n last_try = str(last_try).split()\n last_try = str(last_try[2]) + str(last_try[3])\n\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n count = 0\n ver = soup.find_all(attrs={\"class\": \"submissionVerdictWrapper\"})\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5:\n s2 = str(ver[count]).split()\n s2 = s2[5].split('\\\"')\n count += 1\n cursor.execute(\"select * from result where problem = ? and diff = ?\", (s[3], s[4]))\n x = cursor.fetchone()\n if s2[1] == 'OK' and x != None:\n cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n if x != None and x[2] != 'OK':\n cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n conn.commit()\n conn.close()\n conn2.close()\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from last_update_problemset\")\n last_problem = conn.fetchone()\n conn.execute(\"select * from users where chat_id = ?\", (str(chat_id),))\n x = conn.fetchone()\n if x == None:\n conn.execute(\"insert into users values (?, ?, ?, ?, ?)\", (chat_id, username, str(last_try), str(last_problem[0]), 1))\n else:\n conn.execute(\"update users set username = ? where chat_id = ?\", (str(username), str(chat_id)))\n conn.execute(\"update users set last_update = ? where chat_id = ?\", (str(last_try), str(chat_id)))\n conn.execute(\"update users set last_problem = ? where chat_id = ?\", (str(last_problem[0]), str(chat_id)))\n conn.execute(\"update users set state = ? where chat_id = ?\", (str(1), str(chat_id)))\n settings.commit()\n settings.close()","lang":"python","vul_type":"cwe-089","target_token_count":816,"sven_meta":{"func_name":"init_user","file_name":"bases/createuserbase.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#136-4ff3871df1be","input":"def process_vote(target,action,chan,mask,db,notice,conn):\n if ' ' in target: \n notice('Invalid nick')\n return\n\n try: votes2kick = database.get(db,'channels','votekick','chan',chan)\n except: votes2kick = 10\n try: votes2ban = database.get(db,'channels','voteban','chan',chan)\n except: votes2ban = 10\n\n if len(target) is 0:\n if action is 'kick': notice('Votes required to kick: {}'.format(votes2kick))\n elif action is 'ban': notice('Votes required to ban: {}'.format(votes2ban))\n return\n\n votefinished = False\n global db_ready\n if not db_ready: db_init(db)\n chan = chan.lower()\n target = target.lower()\n voter = user.format_hostmask(mask)\n voters = db.execute(\"SELECT voters FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target)).fetchone()\n\n if conn.nick.lower() in target: return \"I dont think so Tim.\"\n\n if voters: \n voters = voters[0]\n if voter in voters: \n notice(\"You have already voted.\")\n return\n else:\n voters = '{} {}'.format(voters,voter).strip()\n notice(\"Thank you for your vote!\")\n else: \n voters = voter\n\n votecount = len(voters.split(' '))\n\n if 'kick' in action: \n votemax = int(votes2kick)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"KICK {} {} :{}\".format(chan, target, \"You have been voted off the island.\"))\n if 'ban' in action:\n votemax = int(votes2ban)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"MODE {} +b {}\".format(chan, user.get_hostmask(target,db)))\n conn.send(\"KICK {} {} :\".format(chan, target, \"You have been voted off the island.\"))\n \n if votefinished: db.execute(\"DELETE FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target))\n else: db.execute(\"insert or replace into votes(chan, action, target, voters, time) values(?,?,?,?,?)\", (chan, action, target, voters, time.time()))\n \n db.commit()\n return (\"Votes to {} {}: {}/{}\".format(action, target, votecount,votemax))","target":"def process_vote(target,action,chan,mask,db,notice,conn):\n if ' ' in target: \n notice('Invalid nick')\n return\n\n try: votes2kick = database.get(db,'channels','votekick','chan',chan)\n except: votes2kick = 10\n try: votes2ban = database.get(db,'channels','voteban','chan',chan)\n except: votes2ban = 10\n\n if len(target) is 0:\n if action is 'kick': notice('Votes required to kick: {}'.format(votes2kick))\n elif action is 'ban': notice('Votes required to ban: {}'.format(votes2ban))\n return\n\n votefinished = False\n global db_ready\n if not db_ready: db_init(db)\n chan = chan.lower()\n target = target.lower()\n voter = user.format_hostmask(mask)\n voters = db.execute(\"SELECT voters FROM votes where chan=? and action=? and target like ?\", chan, action, target).fetchone()\n\n if conn.nick.lower() in target: return \"I dont think so Tim.\"\n\n if voters: \n voters = voters[0]\n if voter in voters: \n notice(\"You have already voted.\")\n return\n else:\n voters = '{} {}'.format(voters,voter).strip()\n notice(\"Thank you for your vote!\")\n else: \n voters = voter\n\n votecount = len(voters.split(' '))\n\n if 'kick' in action: \n votemax = int(votes2kick)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"KICK {} {} :{}\".format(chan, target, \"You have been voted off the island.\"))\n if 'ban' in action:\n votemax = int(votes2ban)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"MODE {} +b {}\".format(chan, user.get_hostmask(target,db)))\n conn.send(\"KICK {} {} :\".format(chan, target, \"You have been voted off the island.\"))\n \n if votefinished: db.execute(\"DELETE FROM votes where chan=? and action=? and target like ?\", chan, action, target)\n else: db.execute(\"insert or replace into votes(chan, action, target, voters, time) values(?,?,?,?,?)\", (chan, action, target, voters, time.time()))\n \n db.commit()\n return (\"Votes to {} {}: {}/{}\".format(action, target, votecount,votemax))","lang":"python","vul_type":"cwe-089","target_token_count":550,"sven_meta":{"func_name":"process_vote","file_name":"plugins/vote.py","commit_link":"github.com/gstack/uguubot/commit/700ff40be84be88964e61f8ae780564e5862460d","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#139-10b4c5e0bb61","input":"def update_history_and_sourcebyinstitution(conn, sqlite, k10plus, ai):\n \"\"\"\n Get all current sources and title numbers from Solr and log them into database.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n current_institutions = get_all_current_institutions(k10plus, ai)\n old_sourcebyinstitutions = get_all_old_sourcebyinstitutions(conn, sqlite)\n current_sourcebyinstitutions = []\n\n for source in current_sources:\n\n for institution in current_institutions:\n\n if not institution or institution == \" \" or '\"' in institution:\n continue\n\n sourcebyinstitution = \"SID \" + str(source) + \" (\" + institution + \")\"\n current_sourcebyinstitutions.append(sourcebyinstitution)\n\n params = {\n \"q\": 'source_id:%s AND institution:\"%s\"' % (source, institution),\n \"rows\": 0,\n \"wt\": \"json\"\n }\n\n # check k10plus\n result = get_solr_result(k10plus, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:\n sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n sqlite.execute(sql)\n conn.commit()\n else:\n # check ai\n result = get_solr_result(ai, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:\n # TODO: escape via sqlite\n sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n sqlite.execute(sql)\n conn.commit()\n\n if sourcebyinstitution not in old_sourcebyinstitutions:\n logging.info(\"The %s is now connected to SID %s.\", institution, source)\n sql = \"INSERT INTO sourcebyinstitution (sourcebyinstitution) VALUES ('%s')\" % sourcebyinstitution\n sqlite.execute(sql)\n conn.commit()\n\n if number != 0:\n old_sourcebyinstitution_number = get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution)\n if number < old_sourcebyinstitution_number:\n message = \"Die Anzahl der Titel hat sich bei %s gegenueber einem frueheren Import verringert.\" % (sourcebyinstitution)\n send_message(message)\n\n # requests.exceptions.ConnectionError: HTTPConnectionPool(XXXXXX): Max retries exceeded\n time.sleep(0.25)\n\n for old_sourcebyinstitution in old_sourcebyinstitutions:\n if old_sourcebyinstitution not in current_sourcebyinstitutions:\n message = \"Die %s ist nicht laenger für die SID %s angesigelt.\" % (institution, source)\n send_message(message)","target":"def update_history_and_sourcebyinstitution(conn, sqlite, k10plus, ai):\n \"\"\"\n Get all current sources and title numbers from Solr and log them into database.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n current_institutions = get_all_current_institutions(k10plus, ai)\n old_sourcebyinstitutions = get_all_old_sourcebyinstitutions(conn, sqlite)\n current_sourcebyinstitutions = []\n\n for source in current_sources:\n\n for institution in current_institutions:\n\n if not institution or institution == \" \" or '\"' in institution:\n continue\n\n sourcebyinstitution = \"SID \" + str(source) + \" (\" + institution + \")\"\n current_sourcebyinstitutions.append(sourcebyinstitution)\n\n params = {\n \"q\": 'source_id:%s AND institution:\"%s\"' % (source, institution),\n \"rows\": 0,\n \"wt\": \"json\"\n }\n\n # check k10plus\n result = get_solr_result(k10plus, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:\n sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (?, ?)'\n sqlite.execute(sql, (sourcebyinstitution, number))\n conn.commit()\n else:\n # check ai\n result = get_solr_result(ai, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:\n # TODO: escape via sqlite\n sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (?, ?)'\n sqlite.execute(sql, (sourcebyinstitution, number))\n conn.commit()\n\n if sourcebyinstitution not in old_sourcebyinstitutions:\n logging.info(\"The %s is now connected to SID %s.\", institution, source)\n sql = \"INSERT INTO sourcebyinstitution (sourcebyinstitution) VALUES (?)\"\n sqlite.execute(sql, (sourcebyinstitution))\n conn.commit()\n\n if number != 0:\n old_sourcebyinstitution_number = get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution)\n if number < old_sourcebyinstitution_number:\n message = \"Die Anzahl der Titel hat sich bei %s gegenueber einem frueheren Import verringert.\" % (sourcebyinstitution)\n send_message(message)\n\n # requests.exceptions.ConnectionError: HTTPConnectionPool(XXXXXX): Max retries exceeded\n time.sleep(0.25)\n\n for old_sourcebyinstitution in old_sourcebyinstitutions:\n if old_sourcebyinstitution not in current_sourcebyinstitutions:\n message = \"Die %s ist nicht laenger für die SID %s angesigelt.\" % (institution, source)\n send_message(message)","lang":"python","vul_type":"cwe-089","target_token_count":577,"sven_meta":{"func_name":"update_history_and_sourcebyinstitution","file_name":"bin/solrcheckup.py","commit_link":"github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#149-1317b1b9bc35","input":" def analyze_scene(self, scene):\n base_urls = scene.get_base_urls()\n users = scene.get_users()\n name = scene.get_name()\n LOG.info('found the following users for scene {}: {}'.format(name, users))\n\n # This scene might have one user who always posts the brackets on their challonge account\n for user in users:\n # Have we analyzed this user before?\n sql = \"SELECT * FROM user_analyzed WHERE user='{}';\".format(user)\n results = self.db.exec(sql)\n\n # Did we have any matches in the database?\n if len(results) > 0:\n # We have analyzed this user before. Just grab one page of brackets to see if there have been any new tournaments\n # eg, just look at /users/christmasmike?page=1 instead of all the pages that exist\n most_recent_page = bracket_utils.get_brackets_from_user(user, pages=1)\n for bracket in most_recent_page:\n LOG.info('here are the brackets from the most recent page of user {}: {}'.format(user, most_recent_page))\n # This user has already been analyzed, there's a good chance this bracket has been analyzed also\n sql = \"SELECT * FROM user_analyzed WHERE url='{}' AND user='{}';\".format(bracket, user)\n results = self.db.exec(sql)\n\n if len(results) == 0:\n # This is a new bracket that must have been published in the last hour or so\n LOG.info('found this url from a user: {} {}'.format(bracket, user))\n display_name = bracket_utils.get_display_base(bracket)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name)\n\n # mark this bracket as analyzed\n sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{}', '{}', '{}');\".format(bracket, user, name)\n self.db.exec(sql)\n\n # Tweet that we found a new bracket\n msg = \"Found new {} bracket: {}\".format(name, bracket)\n tweet(msg)\n else:\n LOG.info('url {} is not new for user {}'.format(bracket, user))\n else:\n # This is a new user, analyze all brackets\n user_urls = bracket_utils.get_brackets_from_user(user)\n for url in user_urls:\n LOG.info('found this url from a user: {} {}'.format(url, user))\n display_name = bracket_utils.get_display_base(url)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(url, name, display_name)\n\n # mark this bracket as analyzed\n sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{}', '{}', '{}');\".format(url, user, name)\n self.db.exec(sql)\n\n LOG.info('done with user {}'.format(user))\n\n\n # This scene might always call their brackets the same thing, eg weekly1, weekly2, weekly3 etc\n for base_url in base_urls:\n # attempt to load this data from the database\n LOG.info('About to start this analysis thread for scene {}'.format(scene.get_name()))\n sql = \"SELECT first,last FROM valids WHERE base_url = '\" + str(base_url) + \"';\"\n result = self.db.exec(sql)\n has_results = len(result) > 0 \n\n # Did we find a match in the database?\n if has_results:\n LOG.info(\"validURLs found values in the database\" + str(result))\n first = result[0][0]\n last = result[0][1]\n\n # Check for a new valid URL\n new_last = bracket_utils._get_last_valid_url(base_url, last-1)\n\n if not new_last == last:\n if new_last - last > 5:\n with open(\"DEBUGOUTPUT.txt\", 'a') as f:\n f.write(\"[validURLs.py:55]: found a SHIT TON of new tournaments for bracket: {}\".format(base_url))\n\n else:\n bracket = base_url.replace('###', str(new_last))\n LOG.info('Found new bracket: {}'.format(bracket))\n msg = \"Found new bracket: {}\".format(bracket)\n tweet(msg)\n\n # If there's been a new last, update the database\n sql = \"UPDATE valids SET last=\" + str(new_last) + \" where base_url = '\"+str(base_url)+\"';\"\n self.db.exec(sql)\n\n\n # Analyze each of these new brackets\n for i in range(last+1, new_last+1):\n # Since this URL is new, we have to process the data\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name, new_bracket=True)\n\n else:\n # We need to create first and last from scratch\n first = bracket_utils._get_first_valid_url(base_url)\n last = bracket_utils._get_last_valid_url(base_url, first)\n\n # This is new data, we need to put it into the db\n sql = \"INSERT INTO valids (base_url, first, last, scene) VALUES (\"\n sql += \"'\"+str(base_url)+\"', \"+str(first)+ \", \"+str(last)+\", '\"+str(name)+\"');\"\n self.db.exec(sql)\n\n for i in range(first, last+1):\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name)\n\n # Calculate ranks after each tournament so we can see how players are progressing\n if not analyzed_scenes and should_tweet:\n tweet('About to start ranking for scene {}'.format(name))\n self.data_processor.check_and_update_ranks(name)","target":" def analyze_scene(self, scene):\n base_urls = scene.get_base_urls()\n users = scene.get_users()\n name = scene.get_name()\n LOG.info('found the following users for scene {}: {}'.format(name, users))\n\n # This scene might have one user who always posts the brackets on their challonge account\n for user in users:\n # Have we analyzed this user before?\n sql = \"SELECT * FROM user_analyzed WHERE user='{user}';\"\n args = {'user': user}\n results = self.db.exec(sql, args)\n\n # Did we have any matches in the database?\n if len(results) > 0:\n # We have analyzed this user before. Just grab one page of brackets to see if there have been any new tournaments\n # eg, just look at /users/christmasmike?page=1 instead of all the pages that exist\n most_recent_page = bracket_utils.get_brackets_from_user(user, pages=1)\n for bracket in most_recent_page:\n LOG.info('here are the brackets from the most recent page of user {}: {}'.format(user, most_recent_page))\n # This user has already been analyzed, there's a good chance this bracket has been analyzed also\n sql = \"SELECT * FROM user_analyzed WHERE url='{bracket}' AND user='{user}';\"\n args = {'bracket': bracket, 'user': user}\n results = self.db.exec(sql, args)\n\n if len(results) == 0:\n # This is a new bracket that must have been published in the last hour or so\n LOG.info('found this url from a user: {} {}'.format(bracket, user))\n display_name = bracket_utils.get_display_base(bracket)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name)\n\n # mark this bracket as analyzed\n sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{bracket}', '{user}', '{name}');\"\n args = {'bracket': bracket, 'user':user, 'name':name}\n self.db.exec(sql, args)\n\n # Tweet that we found a new bracket\n msg = \"Found new {} bracket: {}\".format(name, bracket)\n tweet(msg)\n else:\n LOG.info('url {} is not new for user {}'.format(bracket, user))\n else:\n # This is a new user, analyze all brackets\n user_urls = bracket_utils.get_brackets_from_user(user)\n for url in user_urls:\n LOG.info('found this url from a user: {} {}'.format(url, user))\n display_name = bracket_utils.get_display_base(url)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(url, name, display_name)\n\n # mark this bracket as analyzed\n sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{url}', '{user}', '{name}');\"\n args = {'url': url, 'user':user, 'name':name}\n self.db.exec(sql, args)\n\n LOG.info('done with user {}'.format(user))\n\n\n # This scene might always call their brackets the same thing, eg weekly1, weekly2, weekly3 etc\n for base_url in base_urls:\n # attempt to load this data from the database\n LOG.info('About to start this analysis thread for scene {}'.format(scene.get_name()))\n sql = \"SELECT first,last FROM valids WHERE base_url = '{base_url}';\"\n args = {'base_url': base_url}\n result = self.db.exec(sql, args)\n has_results = len(result) > 0 \n\n # Did we find a match in the database?\n if has_results:\n LOG.info(\"validURLs found values in the database\" + str(result))\n first = result[0][0]\n last = result[0][1]\n\n # Check for a new valid URL\n new_last = bracket_utils._get_last_valid_url(base_url, last-1)\n\n if not new_last == last:\n if new_last - last > 5:\n with open(\"DEBUGOUTPUT.txt\", 'a') as f:\n f.write(\"[validURLs.py:55]: found a SHIT TON of new tournaments for bracket: {}\".format(base_url))\n\n else:\n bracket = base_url.replace('###', str(new_last))\n LOG.info('Found new bracket: {}'.format(bracket))\n msg = \"Found new bracket: {}\".format(bracket)\n tweet(msg)\n\n # If there's been a new last, update the database\n sql = \"UPDATE valids SET last={new_last} where base_url='{base_url}';\"\n args = {'new_last': new_last, 'base_url': base_url}\n self.db.exec(sql, args)\n\n\n # Analyze each of these new brackets\n for i in range(last+1, new_last+1):\n # Since this URL is new, we have to process the data\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name, new_bracket=True)\n\n else:\n # We need to create first and last from scratch\n first = bracket_utils._get_first_valid_url(base_url)\n last = bracket_utils._get_last_valid_url(base_url, first)\n\n # This is new data, we need to put it into the db\n sql = \"INSERT INTO valids (base_url, first, last, scene) VALUES ('{base_url}', '{first}', '{last}', '{name}');\"\n args = {'base_url': base_url, 'first': first, 'last': last, 'name': name}\n self.db.exec(sql, args)\n\n for i in range(first, last+1):\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name)\n\n # Calculate ranks after each tournament so we can see how players are progressing\n if not analyzed_scenes and should_tweet:\n tweet('About to start ranking for scene {}'.format(name))\n self.data_processor.check_and_update_ranks(name)","lang":"python","vul_type":"cwe-089","target_token_count":1595,"sven_meta":{"func_name":"analyze_scene","file_name":"validURLs.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#173-9d5d6846cb75","input":" def process_ranks(self, scene, urls, recent_date):\n PLAYER1 = 0\n PLAYER2 = 1\n WINNER = 2\n DATE = 3\n SCENE = 4\n\n # make sure if we already have calculated ranks for these players at this time, we do not do it again\n sql = \"SELECT * FROM ranks WHERE scene = '{}' AND date='{}';\".format(str(scene), recent_date)\n res = self.db.exec(sql)\n if len(res) > 0:\n LOG.info('We have already calculated ranks for {} on date {}. SKipping'.format(scene, recent_date))\n return\n\n matches = bracket_utils.get_matches_from_urls(self.db, urls)\n LOG.info('About to start processing ranks for scene {} on {}'.format(scene, recent_date))\n\n # Iterate through each match, and build up our dict\n win_loss_dict = {}\n for match in matches:\n p1 = match[PLAYER1]\n p2 = match[PLAYER2]\n winner = match[WINNER]\n date = match[DATE]\n\n #Add p1 to the dict\n if p1 not in win_loss_dict:\n win_loss_dict[p1] = {}\n\n if p2 not in win_loss_dict[p1]:\n win_loss_dict[p1][p2] = []\n\n # Add an entry to represent this match to p1\n win_loss_dict[p1][p2].append((date, winner == p1))\n\n # add p2 to the dict\n if p2 not in win_loss_dict:\n win_loss_dict[p2] = {}\n\n if p1 not in win_loss_dict[p2]:\n win_loss_dict[p2][p1] = []\n\n win_loss_dict[p2][p1].append((date, winner == p2))\n\n ranks = get_ranks(win_loss_dict)\n\n tag_rank_map = {}\n for i, x in enumerate(ranks):\n points, player = x\n rank = len(ranks) - i\n\n sql = \"INSERT INTO ranks (scene, player, rank, points, date) VALUES ('{}', '{}', '{}', '{}', '{}');\"\\\n .format(str(scene), str(player), int(rank), str(points), str(recent_date))\n self.db.exec(sql)\n\n # Only count this player if this is the scene he/she belongs to\n sql = \"SELECT scene FROM players WHERE tag='{}';\".format(player)\n res = self.db.exec(sql)\n\n if len(res) == 0 or res[0][0] == scene:\n # Also create a list to update the player web\n map = {'rank':rank, 'total_ranked':len(ranks)}\n tag_rank_map[player] = map\n\n player_web.update_ranks(tag_rank_map)","target":" def process_ranks(self, scene, urls, recent_date):\n PLAYER1 = 0\n PLAYER2 = 1\n WINNER = 2\n DATE = 3\n SCENE = 4\n\n # make sure if we already have calculated ranks for these players at this time, we do not do it again\n sql = \"SELECT * FROM ranks WHERE scene = '{scene}' AND date='{date}';\"\n args = {'scene': scene, 'date': recent_date}\n res = self.db.exec(sql, args)\n if len(res) > 0:\n LOG.info('We have already calculated ranks for {} on date {}. SKipping'.format(scene, recent_date))\n return\n\n matches = bracket_utils.get_matches_from_urls(self.db, urls)\n LOG.info('About to start processing ranks for scene {} on {}'.format(scene, recent_date))\n\n # Iterate through each match, and build up our dict\n win_loss_dict = {}\n for match in matches:\n p1 = match[PLAYER1]\n p2 = match[PLAYER2]\n winner = match[WINNER]\n date = match[DATE]\n\n #Add p1 to the dict\n if p1 not in win_loss_dict:\n win_loss_dict[p1] = {}\n\n if p2 not in win_loss_dict[p1]:\n win_loss_dict[p1][p2] = []\n\n # Add an entry to represent this match to p1\n win_loss_dict[p1][p2].append((date, winner == p1))\n\n # add p2 to the dict\n if p2 not in win_loss_dict:\n win_loss_dict[p2] = {}\n\n if p1 not in win_loss_dict[p2]:\n win_loss_dict[p2][p1] = []\n\n win_loss_dict[p2][p1].append((date, winner == p2))\n\n ranks = get_ranks(win_loss_dict)\n\n tag_rank_map = {}\n for i, x in enumerate(ranks):\n points, player = x\n rank = len(ranks) - i\n\n sql = \"INSERT INTO ranks (scene, player, rank, points, date) VALUES ('{scene}', '{player}', '{rank}', '{points}', '{recent_date}');\"\n args = {'scene': scene, 'player': player, 'rank': rank, 'points': points, 'recent_date': recent_date}\n self.db.exec(sql, args)\n\n # Only count this player if this is the scene he/she belongs to\n sql = \"SELECT scene FROM players WHERE tag='{player}';\"\n args = {'player': player}\n res = self.db.exec(sql, args)\n\n if len(res) == 0 or res[0][0] == scene:\n # Also create a list to update the player web\n map = {'rank':rank, 'total_ranked':len(ranks)}\n tag_rank_map[player] = map\n\n player_web.update_ranks(tag_rank_map)","lang":"python","vul_type":"cwe-089","target_token_count":633,"sven_meta":{"func_name":"process_ranks","file_name":"process_data.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-125#0-e3398f4505a1","input":"MagickExport Image *AdaptiveThresholdImage(const Image *image,\n const size_t width,const size_t height,const ssize_t offset,\n ExceptionInfo *exception)\n{\n#define ThresholdImageTag \"Threshold/Image\"\n\n CacheView\n *image_view,\n *threshold_view;\n\n Image\n *threshold_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n MagickPixelPacket\n zero;\n\n MagickRealType\n number_pixels;\n\n ssize_t\n y;\n\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n threshold_image=CloneImage(image,0,0,MagickTrue,exception);\n if (threshold_image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(threshold_image,DirectClass) == MagickFalse)\n {\n InheritException(exception,&threshold_image->exception);\n threshold_image=DestroyImage(threshold_image);\n return((Image *) NULL);\n }\n /*\n Local adaptive threshold.\n */\n status=MagickTrue;\n progress=0;\n GetMagickPixelPacket(image,&zero);\n number_pixels=(MagickRealType) (width*height);\n image_view=AcquireVirtualCacheView(image,exception);\n threshold_view=AcquireAuthenticCacheView(threshold_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(image,threshold_image,image->rows,1)\n#endif\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n MagickBooleanType\n sync;\n\n MagickPixelPacket\n channel_bias,\n channel_sum;\n\n register const IndexPacket\n *magick_restrict indexes;\n\n register const PixelPacket\n *magick_restrict p,\n *magick_restrict r;\n\n register IndexPacket\n *magick_restrict threshold_indexes;\n\n register PixelPacket\n *magick_restrict q;\n\n register ssize_t\n x;\n\n ssize_t\n u,\n v;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)\n height/2L,image->columns+width,height,exception);\n q=GetCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns,1,\n exception);\n if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n indexes=GetCacheViewVirtualIndexQueue(image_view);\n threshold_indexes=GetCacheViewAuthenticIndexQueue(threshold_view);\n channel_bias=zero;\n channel_sum=zero;\n r=p;\n for (v=0; v < (ssize_t) height; v++)\n {\n for (u=0; u < (ssize_t) width; u++)\n {\n if (u == (ssize_t) (width-1))\n {\n channel_bias.red+=r[u].red;\n channel_bias.green+=r[u].green;\n channel_bias.blue+=r[u].blue;\n channel_bias.opacity+=r[u].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_bias.index=(MagickRealType)\n GetPixelIndex(indexes+(r-p)+u);\n }\n channel_sum.red+=r[u].red;\n channel_sum.green+=r[u].green;\n channel_sum.blue+=r[u].blue;\n channel_sum.opacity+=r[u].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_sum.index=(MagickRealType) GetPixelIndex(indexes+(r-p)+u);\n }\n r+=image->columns+width;\n }\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n MagickPixelPacket\n mean;\n\n mean=zero;\n r=p;\n channel_sum.red-=channel_bias.red;\n channel_sum.green-=channel_bias.green;\n channel_sum.blue-=channel_bias.blue;\n channel_sum.opacity-=channel_bias.opacity;\n channel_sum.index-=channel_bias.index;\n channel_bias=zero;\n for (v=0; v < (ssize_t) height; v++)\n {\n channel_bias.red+=r[0].red;\n channel_bias.green+=r[0].green;\n channel_bias.blue+=r[0].blue;\n channel_bias.opacity+=r[0].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_bias.index=(MagickRealType) GetPixelIndex(indexes+x+(r-p)+0);\n channel_sum.red+=r[width-1].red;\n channel_sum.green+=r[width-1].green;\n channel_sum.blue+=r[width-1].blue;\n channel_sum.opacity+=r[width-1].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_sum.index=(MagickRealType) GetPixelIndex(indexes+x+(r-p)+\n width-1);\n r+=image->columns+width;\n }\n mean.red=(MagickRealType) (channel_sum.red/number_pixels+offset);\n mean.green=(MagickRealType) (channel_sum.green/number_pixels+offset);\n mean.blue=(MagickRealType) (channel_sum.blue/number_pixels+offset);\n mean.opacity=(MagickRealType) (channel_sum.opacity/number_pixels+offset);\n if (image->colorspace == CMYKColorspace)\n mean.index=(MagickRealType) (channel_sum.index/number_pixels+offset);\n SetPixelRed(q,((MagickRealType) GetPixelRed(q) <= mean.red) ?\n 0 : QuantumRange);\n SetPixelGreen(q,((MagickRealType) GetPixelGreen(q) <= mean.green) ?\n 0 : QuantumRange);\n SetPixelBlue(q,((MagickRealType) GetPixelBlue(q) <= mean.blue) ?\n 0 : QuantumRange);\n SetPixelOpacity(q,((MagickRealType) GetPixelOpacity(q) <= mean.opacity) ?\n 0 : QuantumRange);\n if (image->colorspace == CMYKColorspace)\n SetPixelIndex(threshold_indexes+x,(((MagickRealType) GetPixelIndex(\n threshold_indexes+x) <= mean.index) ? 0 : QuantumRange));\n p++;\n q++;\n }\n sync=SyncCacheViewAuthenticPixels(threshold_view,exception);\n if (sync == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(image,ThresholdImageTag,progress,image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n threshold_view=DestroyCacheView(threshold_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n threshold_image=DestroyImage(threshold_image);\n return(threshold_image);\n}","target":"MagickExport Image *AdaptiveThresholdImage(const Image *image,\n const size_t width,const size_t height,const ssize_t offset,\n ExceptionInfo *exception)\n{\n#define ThresholdImageTag \"Threshold/Image\"\n\n CacheView\n *image_view,\n *threshold_view;\n\n Image\n *threshold_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n MagickPixelPacket\n zero;\n\n MagickRealType\n number_pixels;\n\n ssize_t\n y;\n\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n threshold_image=CloneImage(image,0,0,MagickTrue,exception);\n if (threshold_image == (Image *) NULL)\n return((Image *) NULL);\n if (width == 0)\n return(threshold_image);\n if (SetImageStorageClass(threshold_image,DirectClass) == MagickFalse)\n {\n InheritException(exception,&threshold_image->exception);\n threshold_image=DestroyImage(threshold_image);\n return((Image *) NULL);\n }\n /*\n Local adaptive threshold.\n */\n status=MagickTrue;\n progress=0;\n GetMagickPixelPacket(image,&zero);\n number_pixels=(MagickRealType) (width*height);\n image_view=AcquireVirtualCacheView(image,exception);\n threshold_view=AcquireAuthenticCacheView(threshold_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(image,threshold_image,image->rows,1)\n#endif\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n MagickBooleanType\n sync;\n\n MagickPixelPacket\n channel_bias,\n channel_sum;\n\n register const IndexPacket\n *magick_restrict indexes;\n\n register const PixelPacket\n *magick_restrict p,\n *magick_restrict r;\n\n register IndexPacket\n *magick_restrict threshold_indexes;\n\n register PixelPacket\n *magick_restrict q;\n\n register ssize_t\n x;\n\n ssize_t\n u,\n v;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)\n height/2L,image->columns+width,height,exception);\n q=GetCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns,1,\n exception);\n if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n indexes=GetCacheViewVirtualIndexQueue(image_view);\n threshold_indexes=GetCacheViewAuthenticIndexQueue(threshold_view);\n channel_bias=zero;\n channel_sum=zero;\n r=p;\n for (v=0; v < (ssize_t) height; v++)\n {\n for (u=0; u < (ssize_t) width; u++)\n {\n if (u == (ssize_t) (width-1))\n {\n channel_bias.red+=r[u].red;\n channel_bias.green+=r[u].green;\n channel_bias.blue+=r[u].blue;\n channel_bias.opacity+=r[u].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_bias.index=(MagickRealType)\n GetPixelIndex(indexes+(r-p)+u);\n }\n channel_sum.red+=r[u].red;\n channel_sum.green+=r[u].green;\n channel_sum.blue+=r[u].blue;\n channel_sum.opacity+=r[u].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_sum.index=(MagickRealType) GetPixelIndex(indexes+(r-p)+u);\n }\n r+=image->columns+width;\n }\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n MagickPixelPacket\n mean;\n\n mean=zero;\n r=p;\n channel_sum.red-=channel_bias.red;\n channel_sum.green-=channel_bias.green;\n channel_sum.blue-=channel_bias.blue;\n channel_sum.opacity-=channel_bias.opacity;\n channel_sum.index-=channel_bias.index;\n channel_bias=zero;\n for (v=0; v < (ssize_t) height; v++)\n {\n channel_bias.red+=r[0].red;\n channel_bias.green+=r[0].green;\n channel_bias.blue+=r[0].blue;\n channel_bias.opacity+=r[0].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_bias.index=(MagickRealType) GetPixelIndex(indexes+x+(r-p)+0);\n channel_sum.red+=r[width-1].red;\n channel_sum.green+=r[width-1].green;\n channel_sum.blue+=r[width-1].blue;\n channel_sum.opacity+=r[width-1].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_sum.index=(MagickRealType) GetPixelIndex(indexes+x+(r-p)+\n width-1);\n r+=image->columns+width;\n }\n mean.red=(MagickRealType) (channel_sum.red/number_pixels+offset);\n mean.green=(MagickRealType) (channel_sum.green/number_pixels+offset);\n mean.blue=(MagickRealType) (channel_sum.blue/number_pixels+offset);\n mean.opacity=(MagickRealType) (channel_sum.opacity/number_pixels+offset);\n if (image->colorspace == CMYKColorspace)\n mean.index=(MagickRealType) (channel_sum.index/number_pixels+offset);\n SetPixelRed(q,((MagickRealType) GetPixelRed(q) <= mean.red) ?\n 0 : QuantumRange);\n SetPixelGreen(q,((MagickRealType) GetPixelGreen(q) <= mean.green) ?\n 0 : QuantumRange);\n SetPixelBlue(q,((MagickRealType) GetPixelBlue(q) <= mean.blue) ?\n 0 : QuantumRange);\n SetPixelOpacity(q,((MagickRealType) GetPixelOpacity(q) <= mean.opacity) ?\n 0 : QuantumRange);\n if (image->colorspace == CMYKColorspace)\n SetPixelIndex(threshold_indexes+x,(((MagickRealType) GetPixelIndex(\n threshold_indexes+x) <= mean.index) ? 0 : QuantumRange));\n p++;\n q++;\n }\n sync=SyncCacheViewAuthenticPixels(threshold_view,exception);\n if (sync == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(image,ThresholdImageTag,progress,image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n threshold_view=DestroyCacheView(threshold_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n threshold_image=DestroyImage(threshold_image);\n return(threshold_image);\n}","lang":"c","vul_type":"cwe-125","target_token_count":1615,"sven_meta":{"func_name":"AdaptiveThresholdImage","file_name":"magick/threshold.c","commit_link":"github.com/ImageMagick/ImageMagick6/commit/55e6dc49f1a381d9d511ee2f888fdc3e3c3e3953","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#1-ad0f1eaa7363","input":"MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile)\n{\n#define MaxDirectoryStack 16\n#define EXIF_DELIMITER \"\\n\"\n#define EXIF_NUM_FORMATS 12\n#define TAG_EXIF_OFFSET 0x8769\n#define TAG_INTEROP_OFFSET 0xa005\n\n typedef struct _DirectoryInfo\n {\n unsigned char\n *directory;\n\n size_t\n entry;\n } DirectoryInfo;\n\n DirectoryInfo\n directory_stack[MaxDirectoryStack];\n\n EndianType\n endian;\n\n size_t\n entry,\n length,\n number_entries;\n\n ssize_t\n id,\n level,\n offset;\n\n static int\n format_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};\n\n unsigned char\n *directory,\n *exif;\n\n /*\n Set EXIF resolution tag.\n */\n length=GetStringInfoLength(profile);\n exif=GetStringInfoDatum(profile);\n if (length < 16)\n return(MagickFalse);\n id=(ssize_t) ReadProfileShort(LSBEndian,exif);\n if ((id != 0x4949) && (id != 0x4D4D))\n {\n while (length != 0)\n {\n if (ReadProfileByte(&exif,&length) != 0x45)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x78)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x69)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x66)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x00)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x00)\n continue;\n break;\n }\n if (length < 16)\n return(MagickFalse);\n id=(ssize_t) ReadProfileShort(LSBEndian,exif);\n }\n endian=LSBEndian;\n if (id == 0x4949)\n endian=LSBEndian;\n else\n if (id == 0x4D4D)\n endian=MSBEndian;\n else\n return(MagickFalse);\n if (ReadProfileShort(endian,exif+2) != 0x002a)\n return(MagickFalse);\n /*\n This the offset to the first IFD.\n */\n offset=(ssize_t) ReadProfileLong(endian,exif+4);\n if ((offset < 0) || (size_t) offset >= length)\n return(MagickFalse);\n directory=exif+offset;\n level=0;\n entry=0;\n do\n {\n if (level > 0)\n {\n level--;\n directory=directory_stack[level].directory;\n entry=directory_stack[level].entry;\n }\n if ((directory < exif) || (directory > (exif+length-2)))\n break;\n /*\n Determine how many entries there are in the current IFD.\n */\n number_entries=ReadProfileShort(endian,directory);\n for ( ; entry < number_entries; entry++)\n {\n int\n components;\n\n register unsigned char\n *p,\n *q;\n\n size_t\n number_bytes;\n\n ssize_t\n format,\n tag_value;\n\n q=(unsigned char *) (directory+2+(12*entry));\n if (q > (exif+length-12))\n break; /* corrupt EXIF */\n tag_value=(ssize_t) ReadProfileShort(endian,q);\n format=(ssize_t) ReadProfileShort(endian,q+2);\n if ((format-1) >= EXIF_NUM_FORMATS)\n break;\n components=(ssize_t) ReadProfileLong(endian,q+4);\n if (components < 0)\n break; /* corrupt EXIF */\n number_bytes=(size_t) components*format_bytes[format];\n if ((ssize_t) number_bytes < components)\n break; /* prevent overflow */\n if (number_bytes <= 4)\n p=q+8;\n else\n {\n /*\n The directory entry contains an offset.\n */\n offset=(ssize_t) ReadProfileLong(endian,q+8);\n if ((size_t) (offset+number_bytes) > length)\n continue;\n if (~length < number_bytes)\n continue; /* prevent overflow */\n p=(unsigned char *) (exif+offset);\n }\n switch (tag_value)\n {\n case 0x011a:\n {\n (void) WriteProfileLong(endian,(size_t) (image->resolution.x+0.5),p);\n (void) WriteProfileLong(endian,1UL,p+4);\n break;\n }\n case 0x011b:\n {\n (void) WriteProfileLong(endian,(size_t) (image->resolution.y+0.5),p);\n (void) WriteProfileLong(endian,1UL,p+4);\n break;\n }\n case 0x0112:\n {\n if (number_bytes == 4)\n {\n (void) WriteProfileLong(endian,(size_t) image->orientation,p);\n break;\n }\n (void) WriteProfileShort(endian,(unsigned short) image->orientation,\n p);\n break;\n }\n case 0x0128:\n {\n if (number_bytes == 4)\n {\n (void) WriteProfileLong(endian,(size_t) (image->units+1),p);\n break;\n }\n (void) WriteProfileShort(endian,(unsigned short) (image->units+1),p);\n break;\n }\n default:\n break;\n }\n if ((tag_value == TAG_EXIF_OFFSET) || (tag_value == TAG_INTEROP_OFFSET))\n {\n offset=(ssize_t) ReadProfileLong(endian,p);\n if (((size_t) offset < length) && (level < (MaxDirectoryStack-2)))\n {\n directory_stack[level].directory=directory;\n entry++;\n directory_stack[level].entry=entry;\n level++;\n directory_stack[level].directory=exif+offset;\n directory_stack[level].entry=0;\n level++;\n if ((directory+2+(12*number_entries)) > (exif+length))\n break;\n offset=(ssize_t) ReadProfileLong(endian,directory+2+(12*\n number_entries));\n if ((offset != 0) && ((size_t) offset < length) &&\n (level < (MaxDirectoryStack-2)))\n {\n directory_stack[level].directory=exif+offset;\n directory_stack[level].entry=0;\n level++;\n }\n }\n break;\n }\n }\n } while (level > 0);\n return(MagickTrue);\n}","target":"MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile)\n{\n#define MaxDirectoryStack 16\n#define EXIF_DELIMITER \"\\n\"\n#define EXIF_NUM_FORMATS 12\n#define TAG_EXIF_OFFSET 0x8769\n#define TAG_INTEROP_OFFSET 0xa005\n\n typedef struct _DirectoryInfo\n {\n unsigned char\n *directory;\n\n size_t\n entry;\n } DirectoryInfo;\n\n DirectoryInfo\n directory_stack[MaxDirectoryStack];\n\n EndianType\n endian;\n\n size_t\n entry,\n length,\n number_entries;\n\n ssize_t\n id,\n level,\n offset;\n\n static int\n format_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};\n\n unsigned char\n *directory,\n *exif;\n\n /*\n Set EXIF resolution tag.\n */\n length=GetStringInfoLength(profile);\n exif=GetStringInfoDatum(profile);\n if (length < 16)\n return(MagickFalse);\n id=(ssize_t) ReadProfileShort(LSBEndian,exif);\n if ((id != 0x4949) && (id != 0x4D4D))\n {\n while (length != 0)\n {\n if (ReadProfileByte(&exif,&length) != 0x45)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x78)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x69)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x66)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x00)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x00)\n continue;\n break;\n }\n if (length < 16)\n return(MagickFalse);\n id=(ssize_t) ReadProfileShort(LSBEndian,exif);\n }\n endian=LSBEndian;\n if (id == 0x4949)\n endian=LSBEndian;\n else\n if (id == 0x4D4D)\n endian=MSBEndian;\n else\n return(MagickFalse);\n if (ReadProfileShort(endian,exif+2) != 0x002a)\n return(MagickFalse);\n /*\n This the offset to the first IFD.\n */\n offset=(ssize_t) ReadProfileLong(endian,exif+4);\n if ((offset < 0) || (size_t) offset >= length)\n return(MagickFalse);\n directory=exif+offset;\n level=0;\n entry=0;\n do\n {\n if (level > 0)\n {\n level--;\n directory=directory_stack[level].directory;\n entry=directory_stack[level].entry;\n }\n if ((directory < exif) || (directory > (exif+length-2)))\n break;\n /*\n Determine how many entries there are in the current IFD.\n */\n number_entries=ReadProfileShort(endian,directory);\n for ( ; entry < number_entries; entry++)\n {\n int\n components;\n\n register unsigned char\n *p,\n *q;\n\n size_t\n number_bytes;\n\n ssize_t\n format,\n tag_value;\n\n q=(unsigned char *) (directory+2+(12*entry));\n if (q > (exif+length-12))\n break; /* corrupt EXIF */\n tag_value=(ssize_t) ReadProfileShort(endian,q);\n format=(ssize_t) ReadProfileShort(endian,q+2);\n if ((format < 0) || ((format-1) >= EXIF_NUM_FORMATS))\n break;\n components=(ssize_t) ReadProfileLong(endian,q+4);\n if (components < 0)\n break; /* corrupt EXIF */\n number_bytes=(size_t) components*format_bytes[format];\n if ((ssize_t) number_bytes < components)\n break; /* prevent overflow */\n if (number_bytes <= 4)\n p=q+8;\n else\n {\n /*\n The directory entry contains an offset.\n */\n offset=(ssize_t) ReadProfileLong(endian,q+8);\n if ((size_t) (offset+number_bytes) > length)\n continue;\n if (~length < number_bytes)\n continue; /* prevent overflow */\n p=(unsigned char *) (exif+offset);\n }\n switch (tag_value)\n {\n case 0x011a:\n {\n (void) WriteProfileLong(endian,(size_t) (image->resolution.x+0.5),p);\n (void) WriteProfileLong(endian,1UL,p+4);\n break;\n }\n case 0x011b:\n {\n (void) WriteProfileLong(endian,(size_t) (image->resolution.y+0.5),p);\n (void) WriteProfileLong(endian,1UL,p+4);\n break;\n }\n case 0x0112:\n {\n if (number_bytes == 4)\n {\n (void) WriteProfileLong(endian,(size_t) image->orientation,p);\n break;\n }\n (void) WriteProfileShort(endian,(unsigned short) image->orientation,\n p);\n break;\n }\n case 0x0128:\n {\n if (number_bytes == 4)\n {\n (void) WriteProfileLong(endian,(size_t) (image->units+1),p);\n break;\n }\n (void) WriteProfileShort(endian,(unsigned short) (image->units+1),p);\n break;\n }\n default:\n break;\n }\n if ((tag_value == TAG_EXIF_OFFSET) || (tag_value == TAG_INTEROP_OFFSET))\n {\n offset=(ssize_t) ReadProfileLong(endian,p);\n if (((size_t) offset < length) && (level < (MaxDirectoryStack-2)))\n {\n directory_stack[level].directory=directory;\n entry++;\n directory_stack[level].entry=entry;\n level++;\n directory_stack[level].directory=exif+offset;\n directory_stack[level].entry=0;\n level++;\n if ((directory+2+(12*number_entries)) > (exif+length))\n break;\n offset=(ssize_t) ReadProfileLong(endian,directory+2+(12*\n number_entries));\n if ((offset != 0) && ((size_t) offset < length) &&\n (level < (MaxDirectoryStack-2)))\n {\n directory_stack[level].directory=exif+offset;\n directory_stack[level].entry=0;\n level++;\n }\n }\n break;\n }\n }\n } while (level > 0);\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-125","target_token_count":1547,"sven_meta":{"func_name":"SyncExifProfile","file_name":"MagickCore/profile.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/a7bb158b7bedd1449a34432feb3a67c8f1873bfa","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#3-1bef7c475eab","input":"lha_read_file_header_1(struct archive_read *a, struct lha *lha)\n{\n\tconst unsigned char *p;\n\tsize_t extdsize;\n\tint i, err, err2;\n\tint namelen, padding;\n\tunsigned char headersum, sum_calculated;\n\n\terr = ARCHIVE_OK;\n\n\tif ((p = __archive_read_ahead(a, H1_FIXED_SIZE, NULL)) == NULL)\n\t\treturn (truncated_error(a));\n\n\tlha->header_size = p[H1_HEADER_SIZE_OFFSET] + 2;\n\theadersum = p[H1_HEADER_SUM_OFFSET];\n\t/* Note: An extended header size is included in a compsize. */\n\tlha->compsize = archive_le32dec(p + H1_COMP_SIZE_OFFSET);\n\tlha->origsize = archive_le32dec(p + H1_ORIG_SIZE_OFFSET);\n\tlha->mtime = lha_dos_time(p + H1_DOS_TIME_OFFSET);\n\tnamelen = p[H1_NAME_LEN_OFFSET];\n\t/* Calculate a padding size. The result will be normally 0 only(?) */\n\tpadding = ((int)lha->header_size) - H1_FIXED_SIZE - namelen;\n\n\tif (namelen > 230 || padding < 0)\n\t\tgoto invalid;\n\n\tif ((p = __archive_read_ahead(a, lha->header_size, NULL)) == NULL)\n\t\treturn (truncated_error(a));\n\n\tfor (i = 0; i < namelen; i++) {\n\t\tif (p[i + H1_FILE_NAME_OFFSET] == 0xff)\n\t\t\tgoto invalid;/* Invalid filename. */\n\t}\n\tarchive_strncpy(&lha->filename, p + H1_FILE_NAME_OFFSET, namelen);\n\tlha->crc = archive_le16dec(p + H1_FILE_NAME_OFFSET + namelen);\n\tlha->setflag |= CRC_IS_SET;\n\n\tsum_calculated = lha_calcsum(0, p, 2, lha->header_size - 2);\n\t/* Consume used bytes but not include `next header size' data\n\t * since it will be consumed in lha_read_file_extended_header(). */\n\t__archive_read_consume(a, lha->header_size - 2);\n\n\t/* Read extended headers */\n\terr2 = lha_read_file_extended_header(a, lha, NULL, 2,\n\t (size_t)(lha->compsize + 2), &extdsize);\n\tif (err2 < ARCHIVE_WARN)\n\t\treturn (err2);\n\tif (err2 < err)\n\t\terr = err2;\n\t/* Get a real compressed file size. */\n\tlha->compsize -= extdsize - 2;\n\n\tif (sum_calculated != headersum) {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"LHa header sum error\");\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\treturn (err);\ninvalid:\n\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,\n\t \"Invalid LHa header\");\n\treturn (ARCHIVE_FATAL);\n}","target":"lha_read_file_header_1(struct archive_read *a, struct lha *lha)\n{\n\tconst unsigned char *p;\n\tsize_t extdsize;\n\tint i, err, err2;\n\tint namelen, padding;\n\tunsigned char headersum, sum_calculated;\n\n\terr = ARCHIVE_OK;\n\n\tif ((p = __archive_read_ahead(a, H1_FIXED_SIZE, NULL)) == NULL)\n\t\treturn (truncated_error(a));\n\n\tlha->header_size = p[H1_HEADER_SIZE_OFFSET] + 2;\n\theadersum = p[H1_HEADER_SUM_OFFSET];\n\t/* Note: An extended header size is included in a compsize. */\n\tlha->compsize = archive_le32dec(p + H1_COMP_SIZE_OFFSET);\n\tlha->origsize = archive_le32dec(p + H1_ORIG_SIZE_OFFSET);\n\tlha->mtime = lha_dos_time(p + H1_DOS_TIME_OFFSET);\n\tnamelen = p[H1_NAME_LEN_OFFSET];\n\t/* Calculate a padding size. The result will be normally 0 only(?) */\n\tpadding = ((int)lha->header_size) - H1_FIXED_SIZE - namelen;\n\n\tif (namelen > 230 || padding < 0)\n\t\tgoto invalid;\n\n\tif ((p = __archive_read_ahead(a, lha->header_size, NULL)) == NULL)\n\t\treturn (truncated_error(a));\n\n\tfor (i = 0; i < namelen; i++) {\n\t\tif (p[i + H1_FILE_NAME_OFFSET] == 0xff)\n\t\t\tgoto invalid;/* Invalid filename. */\n\t}\n\tarchive_strncpy(&lha->filename, p + H1_FILE_NAME_OFFSET, namelen);\n\tlha->crc = archive_le16dec(p + H1_FILE_NAME_OFFSET + namelen);\n\tlha->setflag |= CRC_IS_SET;\n\n\tsum_calculated = lha_calcsum(0, p, 2, lha->header_size - 2);\n\t/* Consume used bytes but not include `next header size' data\n\t * since it will be consumed in lha_read_file_extended_header(). */\n\t__archive_read_consume(a, lha->header_size - 2);\n\n\t/* Read extended headers */\n\terr2 = lha_read_file_extended_header(a, lha, NULL, 2,\n\t (size_t)(lha->compsize + 2), &extdsize);\n\tif (err2 < ARCHIVE_WARN)\n\t\treturn (err2);\n\tif (err2 < err)\n\t\terr = err2;\n\t/* Get a real compressed file size. */\n\tlha->compsize -= extdsize - 2;\n\n\tif (lha->compsize < 0)\n\t\tgoto invalid;\t/* Invalid compressed file size */\n\n\tif (sum_calculated != headersum) {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"LHa header sum error\");\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\treturn (err);\ninvalid:\n\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,\n\t \"Invalid LHa header\");\n\treturn (ARCHIVE_FATAL);\n}","lang":"c","vul_type":"cwe-125","target_token_count":658,"sven_meta":{"func_name":"lha_read_file_header_1","file_name":"libarchive/archive_read_support_format_lha.c","commit_link":"github.com/libarchive/libarchive/commit/98dcbbf0bf4854bf987557e55e55fff7abbf3ea9","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#4-75df1ad03200","input":"static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track)\n{\n AC3HeaderInfo *hdr = NULL;\n struct eac3_info *info;\n int num_blocks, ret;\n\n if (!track->eac3_priv && !(track->eac3_priv = av_mallocz(sizeof(*info))))\n return AVERROR(ENOMEM);\n info = track->eac3_priv;\n\n if (avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0) {\n /* drop the packets until we see a good one */\n if (!track->entry) {\n av_log(mov, AV_LOG_WARNING, \"Dropping invalid packet from start of the stream\\n\");\n ret = 0;\n } else\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n\n info->data_rate = FFMAX(info->data_rate, hdr->bit_rate / 1000);\n num_blocks = hdr->num_blocks;\n\n if (!info->ec3_done) {\n /* AC-3 substream must be the first one */\n if (hdr->bitstream_id <= 10 && hdr->substreamid != 0) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n\n /* this should always be the case, given that our AC-3 parser\n * concatenates dependent frames to their independent parent */\n if (hdr->frame_type == EAC3_FRAME_TYPE_INDEPENDENT) {\n /* substream ids must be incremental */\n if (hdr->substreamid > info->num_ind_sub + 1) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n\n if (hdr->substreamid == info->num_ind_sub + 1) {\n //info->num_ind_sub++;\n avpriv_request_sample(track->par, \"Multiple independent substreams\");\n ret = AVERROR_PATCHWELCOME;\n goto end;\n } else if (hdr->substreamid < info->num_ind_sub ||\n hdr->substreamid == 0 && info->substream[0].bsid) {\n info->ec3_done = 1;\n goto concatenate;\n }\n } else {\n if (hdr->substreamid != 0) {\n avpriv_request_sample(mov->fc, \"Multiple non EAC3 independent substreams\");\n ret = AVERROR_PATCHWELCOME;\n goto end;\n }\n }\n\n /* fill the info needed for the \"dec3\" atom */\n info->substream[hdr->substreamid].fscod = hdr->sr_code;\n info->substream[hdr->substreamid].bsid = hdr->bitstream_id;\n info->substream[hdr->substreamid].bsmod = hdr->bitstream_mode;\n info->substream[hdr->substreamid].acmod = hdr->channel_mode;\n info->substream[hdr->substreamid].lfeon = hdr->lfe_on;\n\n /* Parse dependent substream(s), if any */\n if (pkt->size != hdr->frame_size) {\n int cumul_size = hdr->frame_size;\n int parent = hdr->substreamid;\n\n while (cumul_size != pkt->size) {\n GetBitContext gbc;\n int i;\n ret = avpriv_ac3_parse_header(&hdr, pkt->data + cumul_size, pkt->size - cumul_size);\n if (ret < 0)\n goto end;\n if (hdr->frame_type != EAC3_FRAME_TYPE_DEPENDENT) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n info->substream[parent].num_dep_sub++;\n ret /= 8;\n\n /* header is parsed up to lfeon, but custom channel map may be needed */\n init_get_bits8(&gbc, pkt->data + cumul_size + ret, pkt->size - cumul_size - ret);\n /* skip bsid */\n skip_bits(&gbc, 5);\n /* skip volume control params */\n for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {\n skip_bits(&gbc, 5); // skip dialog normalization\n if (get_bits1(&gbc)) {\n skip_bits(&gbc, 8); // skip compression gain word\n }\n }\n /* get the dependent stream channel map, if exists */\n if (get_bits1(&gbc))\n info->substream[parent].chan_loc |= (get_bits(&gbc, 16) >> 5) & 0x1f;\n else\n info->substream[parent].chan_loc |= hdr->channel_mode;\n cumul_size += hdr->frame_size;\n }\n }\n }\n\nconcatenate:\n if (!info->num_blocks && num_blocks == 6) {\n ret = pkt->size;\n goto end;\n }\n else if (info->num_blocks + num_blocks > 6) {\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n\n if (!info->num_blocks) {\n ret = av_packet_ref(&info->pkt, pkt);\n if (!ret)\n info->num_blocks = num_blocks;\n goto end;\n } else {\n if ((ret = av_grow_packet(&info->pkt, pkt->size)) < 0)\n goto end;\n memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size);\n info->num_blocks += num_blocks;\n info->pkt.duration += pkt->duration;\n if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0)\n goto end;\n if (info->num_blocks != 6)\n goto end;\n av_packet_unref(pkt);\n av_packet_move_ref(pkt, &info->pkt);\n info->num_blocks = 0;\n }\n ret = pkt->size;\n\nend:\n av_free(hdr);\n\n return ret;\n}","target":"static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track)\n{\n AC3HeaderInfo *hdr = NULL;\n struct eac3_info *info;\n int num_blocks, ret;\n\n if (!track->eac3_priv && !(track->eac3_priv = av_mallocz(sizeof(*info))))\n return AVERROR(ENOMEM);\n info = track->eac3_priv;\n\n if (avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0) {\n /* drop the packets until we see a good one */\n if (!track->entry) {\n av_log(mov, AV_LOG_WARNING, \"Dropping invalid packet from start of the stream\\n\");\n ret = 0;\n } else\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n\n info->data_rate = FFMAX(info->data_rate, hdr->bit_rate / 1000);\n num_blocks = hdr->num_blocks;\n\n if (!info->ec3_done) {\n /* AC-3 substream must be the first one */\n if (hdr->bitstream_id <= 10 && hdr->substreamid != 0) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n\n /* this should always be the case, given that our AC-3 parser\n * concatenates dependent frames to their independent parent */\n if (hdr->frame_type == EAC3_FRAME_TYPE_INDEPENDENT) {\n /* substream ids must be incremental */\n if (hdr->substreamid > info->num_ind_sub + 1) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n\n if (hdr->substreamid == info->num_ind_sub + 1) {\n //info->num_ind_sub++;\n avpriv_request_sample(mov->fc, \"Multiple independent substreams\");\n ret = AVERROR_PATCHWELCOME;\n goto end;\n } else if (hdr->substreamid < info->num_ind_sub ||\n hdr->substreamid == 0 && info->substream[0].bsid) {\n info->ec3_done = 1;\n goto concatenate;\n }\n } else {\n if (hdr->substreamid != 0) {\n avpriv_request_sample(mov->fc, \"Multiple non EAC3 independent substreams\");\n ret = AVERROR_PATCHWELCOME;\n goto end;\n }\n }\n\n /* fill the info needed for the \"dec3\" atom */\n info->substream[hdr->substreamid].fscod = hdr->sr_code;\n info->substream[hdr->substreamid].bsid = hdr->bitstream_id;\n info->substream[hdr->substreamid].bsmod = hdr->bitstream_mode;\n info->substream[hdr->substreamid].acmod = hdr->channel_mode;\n info->substream[hdr->substreamid].lfeon = hdr->lfe_on;\n\n /* Parse dependent substream(s), if any */\n if (pkt->size != hdr->frame_size) {\n int cumul_size = hdr->frame_size;\n int parent = hdr->substreamid;\n\n while (cumul_size != pkt->size) {\n GetBitContext gbc;\n int i;\n ret = avpriv_ac3_parse_header(&hdr, pkt->data + cumul_size, pkt->size - cumul_size);\n if (ret < 0)\n goto end;\n if (hdr->frame_type != EAC3_FRAME_TYPE_DEPENDENT) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n info->substream[parent].num_dep_sub++;\n ret /= 8;\n\n /* header is parsed up to lfeon, but custom channel map may be needed */\n init_get_bits8(&gbc, pkt->data + cumul_size + ret, pkt->size - cumul_size - ret);\n /* skip bsid */\n skip_bits(&gbc, 5);\n /* skip volume control params */\n for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {\n skip_bits(&gbc, 5); // skip dialog normalization\n if (get_bits1(&gbc)) {\n skip_bits(&gbc, 8); // skip compression gain word\n }\n }\n /* get the dependent stream channel map, if exists */\n if (get_bits1(&gbc))\n info->substream[parent].chan_loc |= (get_bits(&gbc, 16) >> 5) & 0x1f;\n else\n info->substream[parent].chan_loc |= hdr->channel_mode;\n cumul_size += hdr->frame_size;\n }\n }\n }\n\nconcatenate:\n if (!info->num_blocks && num_blocks == 6) {\n ret = pkt->size;\n goto end;\n }\n else if (info->num_blocks + num_blocks > 6) {\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n\n if (!info->num_blocks) {\n ret = av_packet_ref(&info->pkt, pkt);\n if (!ret)\n info->num_blocks = num_blocks;\n goto end;\n } else {\n if ((ret = av_grow_packet(&info->pkt, pkt->size)) < 0)\n goto end;\n memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size);\n info->num_blocks += num_blocks;\n info->pkt.duration += pkt->duration;\n if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0)\n goto end;\n if (info->num_blocks != 6)\n goto end;\n av_packet_unref(pkt);\n av_packet_move_ref(pkt, &info->pkt);\n info->num_blocks = 0;\n }\n ret = pkt->size;\n\nend:\n av_free(hdr);\n\n return ret;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1296,"sven_meta":{"func_name":"handle_eac3","file_name":"libavformat/movenc.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/95556e27e2c1d56d9e18f5db34d6f756f3011148","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#6-46073c977f28","input":"static int opmov(RAsm *a, ut8 *data, const Opcode *op) {\n\tint l = 0;\n\tst64 offset = 0;\n\tint mod = 0;\n\tint base = 0;\n\tint rex = 0;\n\tut64 immediate = 0;\n\tif (op->operands[1].type & OT_CONSTANT) {\n\t\tif (!op->operands[1].is_good_flag) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (op->operands[1].immediate == -1) {\n\t\t\treturn -1;\n\t\t}\n\t\timmediate = op->operands[1].immediate * op->operands[1].sign;\n\t\tif (op->operands[0].type & OT_GPREG && !(op->operands[0].type & OT_MEMORY)) {\n\t\t\tif (a->bits == 64 && ((op->operands[0].type & OT_QWORD) | (op->operands[1].type & OT_QWORD))) {\n\t\t\t\tif (!(op->operands[1].type & OT_CONSTANT) && op->operands[1].extended) {\n\t\t\t\t\tdata[l++] = 0x49;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t} else if (op->operands[0].extended) {\n\t\t\t\tdata[l++] = 0x41;\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\t\tif (a->bits > 16) {\n\t\t\t\t\tdata[l++] = 0x66;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_BYTE) {\n\t\t\t\tdata[l++] = 0xb0 | op->operands[0].reg;\n\t\t\t\tdata[l++] = immediate;\n\t\t\t} else {\n\t\t\t\tif (a->bits == 64 &&\n\t\t\t\t\t((op->operands[0].type & OT_QWORD) |\n\t\t\t\t\t(op->operands[1].type & OT_QWORD)) &&\n\t\t\t\t\timmediate < UT32_MAX) {\n\t\t\t\t\t\tdata[l++] = 0xc7;\n\t\t\t\t \t\tdata[l++] = 0xc0 | op->operands[0].reg;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = 0xb8 | op->operands[0].reg;\n\t\t\t\t}\n\t\t\t\tdata[l++] = immediate;\n\t\t\t\tdata[l++] = immediate >> 8;\n\t\t\t\tif (!(op->operands[0].type & OT_WORD)) {\n\t\t\t\t\tdata[l++] = immediate >> 16;\n\t\t\t\t\tdata[l++] = immediate >> 24;\n\t\t\t\t}\n\t\t\t\tif (a->bits == 64 && immediate > UT32_MAX) {\n\t\t\t\t\tdata[l++] = immediate >> 32;\n\t\t\t\t\tdata[l++] = immediate >> 40;\n\t\t\t\t\tdata[l++] = immediate >> 48;\n\t\t\t\t\tdata[l++] = immediate >> 56;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (op->operands[0].type & OT_MEMORY) {\n\t\t\tif (!op->operands[0].explicit_size) {\n\t\t\t\tif (op->operands[0].type & OT_GPREG) {\n\t\t\t\t\t((Opcode *)op)->operands[0].dest_size = op->operands[0].reg_size;\n\t\t\t\t} else {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint dest_bits = 8 * ((op->operands[0].dest_size & ALL_SIZE) >> OPSIZE_SHIFT);\n\t\t\tint reg_bits = 8 * ((op->operands[0].reg_size & ALL_SIZE) >> OPSIZE_SHIFT);\n\t\t\tint offset = op->operands[0].offset * op->operands[0].offset_sign;\n\n\t\t\t//addr_size_override prefix\n\t\t\tbool use_aso = false;\n\t\t\tif (reg_bits < a->bits) {\n\t\t\t\tuse_aso = true;\n\t\t\t}\n\n\t\t\t//op_size_override prefix\n\t\t\tbool use_oso = false;\n\t\t\tif (dest_bits == 16) {\n\t\t\t\tuse_oso = true;\n\t\t\t}\n\n\t\t\tbool rip_rel = op->operands[0].regs[0] == X86R_RIP;\n\n\t\t\t//rex prefix\n\t\t\tint rex = 1 << 6;\n\t\t\tbool use_rex = false;\n\t\t\tif (dest_bits == 64) {\t\t\t//W field\n\t\t\t\tuse_rex = true;\n\t\t\t\trex |= 1 << 3;\n\t\t\t}\n\t\t\tif (op->operands[0].extended) {\t\t//B field\n\t\t\t\tuse_rex = true;\n\t\t\t\trex |= 1;\n\t\t\t}\n\n\t\t\t//opcode selection\n\t\t\tint opcode;\n\t\t\tif (dest_bits == 8) {\n\t\t\t\topcode = 0xc6;\n\t\t\t} else {\n\t\t\t\topcode = 0xc7;\n\t\t\t}\n\n\t\t\t//modrm and SIB selection\n\t\t\tint modrm = 0;\n\t\t\tint mod;\n\t\t\tint reg = 0;\n\t\t\tint rm;\n\t\t\tbool use_sib = false;\n\t\t\tint sib;\n\t\t\t//mod\n\t\t\tif (offset == 0) {\n\t\t\t\tmod = 0;\n\t\t\t} else if (offset < 128 && offset > -129) {\n\t\t\t\tmod = 1;\n\t\t\t} else {\n\t\t\t\tmod = 2;\n\t\t\t}\n\n\t\t\tif (reg_bits == 16) {\n\t\t\t\tif (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_SI) {\n\t\t\t\t\trm = B0000;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_DI) {\n\t\t\t\t\trm = B0001;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_SI) {\n\t\t\t\t\trm = B0010;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_DI) {\n\t\t\t\t\trm = B0011;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_SI && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0100;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_DI && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0101;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0111;\n\t\t\t\t} else {\n\t\t\t\t\t//TODO allow for displacement only when parser is reworked\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tmodrm = (mod << 6) | (reg << 3) | rm;\n\t\t\t} else {\n\t\t\t\t//rm\n\t\t\t\tif (op->operands[0].extended) {\n\t\t\t\t\trm = op->operands[0].reg;\n\t\t\t\t} else {\n\t\t\t\t\trm = op->operands[0].regs[0];\n\t\t\t\t}\n\t\t\t\t//[epb] alone is illegal, so we need to fake a [ebp+0]\n\t\t\t\tif (rm == 5 && mod == 0) {\n\t\t\t\t\tmod = 1;\n\t\t\t\t}\n\n\t\t\t\t//sib\n\t\t\t\tint index = op->operands[0].regs[1];\n\t\t\t\tint scale = getsib(op->operands[0].scale[1]);\n\t\t\t\tif (index != -1) {\n\t\t\t\t\tuse_sib = true;\n\t\t\t\t\tsib = (scale << 6) | (index << 3) | rm;\n\t\t\t\t} else if (rm == 4) {\n\t\t\t\t\tuse_sib = true;\n\t\t\t\t\tsib = 0x24;\n\t\t\t\t}\n\t\t\t\tif (use_sib) {\n\t\t\t\t\trm = B0100;\n\t\t\t\t}\n\t\t\t\tif (rip_rel) {\n\t\t\t\t\tmodrm = (B0000 << 6) | (reg << 3) | B0101;\n\t\t\t\t\tsib = (scale << 6) | (B0100 << 3) | B0101;\n\t\t\t\t} else {\n\t\t\t\t\tmodrm = (mod << 6) | (reg << 3) | rm;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//build the final result\n\t\t\tif (use_aso) {\n\t\t\t\tdata[l++] = 0x67;\n\t\t\t}\n\t\t\tif (use_oso) {\n\t\t\t\tdata[l++] = 0x66;\n\t\t\t}\n\t\t\tif (use_rex) {\n\t\t\t\tdata[l++] = rex;\n\t\t\t}\n\t\t\tdata[l++] = opcode;\n\t\t\tdata[l++] = modrm;\n\t\t\tif (use_sib) {\n\t\t\t\tdata[l++] = sib;\n\t\t\t}\n\t\t\t//offset\n\t\t\tif (mod == 1) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t} else if (reg_bits == 16 && mod == 2) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t} else if (mod == 2 || rip_rel) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t}\n\t\t\t//immediate\n\t\t\tint byte;\n\t\t\tfor (byte = 0; byte < dest_bits && byte < 32; byte += 8) {\n\t\t\t\tdata[l++] = (immediate >> byte);\n\t\t\t}\n\t\t}\n\t} else if (op->operands[1].type & OT_REGALL &&\n\t\t\t !(op->operands[1].type & OT_MEMORY)) {\n\t\tif (op->operands[0].type & OT_CONSTANT) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG &&\n\t\t op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\t\treturn -1;\n\t\t}\n\t\t// Check reg sizes match\n\t\tif (op->operands[0].type & OT_REGTYPE && op->operands[1].type & OT_REGTYPE) {\n\t\t\tif (!((op->operands[0].type & ALL_SIZE) &\n\t\t\t(op->operands[1].type & ALL_SIZE))) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\n\t\tif (a->bits == 64) {\n\t\t\tif (op->operands[0].extended) {\n\t\t\t\trex = 1;\n\t\t\t}\n\t\t\tif (op->operands[1].extended) {\n\t\t\t\trex += 4;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD) {\n\t\t\t\tif (!(op->operands[0].type & OT_QWORD)) {\n\t\t\t\t\tdata[l++] = 0x67;\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD &&\n\t\t\t\top->operands[0].type & OT_QWORD) {\n\t\t\t\tdata[l++] = 0x48 | rex;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_DWORD &&\n\t\t\t\top->operands[0].type & OT_DWORD) {\n\t\t\t\tdata[l++] = 0x40 | rex;\n\t\t\t}\n\t\t} else if (op->operands[0].extended && op->operands[1].extended) {\n\t\t\tdata[l++] = 0x45;\n\t\t}\n\t\toffset = op->operands[0].offset * op->operands[0].offset_sign;\n\t\tif (op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\tdata[l++] = 0x8c;\n\t\t} else {\n\t\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\t\tdata[l++] = 0x66;\n\t\t\t}\n\t\t\tdata[l++] = (op->operands[0].type & OT_BYTE) ? 0x88 : 0x89;\n\t\t}\n\n\t\tif (op->operands[0].scale[0] > 1) {\n\t\t\t\tdata[l++] = op->operands[1].reg << 3 | 4;\n\t\t\t\tdata[l++] = getsib (op->operands[0].scale[0]) << 6 |\n\t\t\t\t\t\t op->operands[0].regs[0] << 3 | 5;\n\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\tdata[l++] = offset >> 24;\n\n\t\t\t\treturn l;\n\t\t\t}\n\n\t\tif (!(op->operands[0].type & OT_MEMORY)) {\n\t\t\tif (op->operands[0].reg == X86R_UNDEFINED ||\n\t\t\t\top->operands[1].reg == X86R_UNDEFINED) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tmod = 0x3;\n\t\t\tdata[l++] = mod << 6 | op->operands[1].reg << 3 | op->operands[0].reg;\n\t\t} else if (op->operands[0].regs[0] == X86R_UNDEFINED) {\n\t\t\tdata[l++] = op->operands[1].reg << 3 | 0x5;\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t} else {\n\t\t\tif (op->operands[0].type & OT_MEMORY) {\n\t\t\t\tif (op->operands[0].regs[1] != X86R_UNDEFINED) {\n\t\t\t\t\tdata[l++] = op->operands[1].reg << 3 | 0x4;\n\t\t\t\t\tdata[l++] = op->operands[0].regs[1] << 3 | op->operands[0].regs[0];\n\t\t\t\t\treturn l;\n\t\t\t\t}\n\t\t\t\tif (offset) {\n\t\t\t\t\tmod = (offset > 128 || offset < -129) ? 0x2 : 0x1;\n\t\t\t\t}\n\t\t\t\tif (op->operands[0].regs[0] == X86R_EBP) {\n\t\t\t\t\tmod = 0x2;\n\t\t\t\t}\n\t\t\t\tdata[l++] = mod << 6 | op->operands[1].reg << 3 | op->operands[0].regs[0];\n\t\t\t\tif (op->operands[0].regs[0] == X86R_ESP) {\n\t\t\t\t\tdata[l++] = 0x24;\n\t\t\t\t}\n\t\t\t\tif (offset) {\n\t\t\t\t\tdata[l++] = offset;\n\t\t\t\t}\n\t\t\t\tif (mod == 2) {\n\t\t\t\t\t// warning C4293: '>>': shift count negative or too big, undefined behavior\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if (op->operands[1].type & OT_MEMORY) {\n\t\tif (op->operands[0].type & OT_MEMORY) {\n\t\t\treturn -1;\n\t\t}\n\t\toffset = op->operands[1].offset * op->operands[1].offset_sign;\n\t\tif (op->operands[0].reg == X86R_EAX && op->operands[1].regs[0] == X86R_UNDEFINED) {\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = 0x48;\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_BYTE) {\n\t\t\t\tdata[l++] = 0xa0;\n\t\t\t} else {\n\t\t\t\tdata[l++] = 0xa1;\n\t\t\t}\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = offset >> 32;\n\t\t\t\tdata[l++] = offset >> 40;\n\t\t\t\tdata[l++] = offset >> 48;\n\t\t\t\tdata[l++] = offset >> 54;\n\t\t\t}\n\t\t\treturn l;\n\t\t}\n\t\tif (op->operands[0].type & OT_BYTE && a->bits == 64 && op->operands[1].regs[0]) {\n\t\t\tif (op->operands[1].regs[0] >= X86R_R8 &&\n\t\t\t op->operands[0].reg < 4) {\n\t\t\t\tdata[l++] = 0x41;\n\t\t\t\tdata[l++] = 0x8a;\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | (op->operands[1].regs[0] - 8);\n\t\t\t\treturn l;\n\t\t\t}\n\t\t\treturn -1;\n\t\t}\n\n\t\tif (op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\tif (op->operands[1].scale[0] == 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tdata[l++] = SEG_REG_PREFIXES[op->operands[1].regs[0]];\n\t\t\tdata[l++] = 0x8b;\n\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x5;\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t\treturn l;\n\t\t}\n\n\t\tif (a->bits == 64) {\n\t\t\tif (op->operands[0].type & OT_QWORD) {\n\t\t\t\tif (!(op->operands[1].type & OT_QWORD)) {\n\t\t\t\t\tif (op->operands[1].regs[0] != -1) {\n\t\t\t\t\t\tdata[l++] = 0x67;\n\t\t\t\t\t}\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t} else if (op->operands[1].type & OT_DWORD) {\n\t\t\t\tdata[l++] = 0x44;\n\t\t\t} else if (!(op->operands[1].type & OT_QWORD)) {\n\t\t\t\tdata[l++] = 0x67;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD &&\n\t\t\t\top->operands[0].type & OT_QWORD) {\n\t\t\t\tdata[l++] = 0x48;\n\t\t\t}\n\t\t}\n\n\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\tdata[l++] = 0x66;\n\t\t\tdata[l++] = op->operands[1].type & OT_BYTE ? 0x8a : 0x8b;\n\t\t} else {\n\t\t\tdata[l++] = (op->operands[1].type & OT_BYTE ||\n\t\t\t\top->operands[0].type & OT_BYTE) ?\n\t\t\t\t0x8a : 0x8b;\n\t\t}\n\n\t\tif (op->operands[1].regs[0] == X86R_UNDEFINED) {\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x4;\n\t\t\t\tdata[l++] = 0x25;\n\t\t\t} else {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x5;\n\t\t\t}\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t} else {\n\t\t\tif (op->operands[1].scale[0] > 1) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 4;\n\n\t\t\t\tif (op->operands[1].scale[0] >= 2) {\n\t\t\t\t\tbase = 5;\n\t\t\t\t}\n\t\t\t\tif (base) {\n\t\t\t\t\tdata[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | base;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = getsib (op->operands[1].scale[0]) << 3 | op->operands[1].regs[0];\n\t\t\t\t}\n\t\t\t\tif (offset || base) {\n\t\t\t\t\tdata[l++] = offset;\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t\treturn l;\n\t\t\t}\n\t\t\tif (op->operands[1].regs[1] != X86R_UNDEFINED) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x4;\n\t\t\t\tdata[l++] = op->operands[1].regs[1] << 3 | op->operands[1].regs[0];\n\t\t\t\treturn l;\n\t\t\t}\n\n\t\t\tif (offset || op->operands[1].regs[0] == X86R_EBP) {\n\t\t\t\tmod = 0x2;\n\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\tmod = 0x4;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (a->bits == 64 && offset && op->operands[0].type & OT_QWORD) {\n\t\t\t\tif (op->operands[1].regs[0] == X86R_RIP) {\n\t\t\t\t\tdata[l++] = 0x5;\n\t\t\t\t} else {\n\t\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\t\tdata[l++] = 0x80 | op->operands[0].reg << 3 | op->operands[1].regs[0];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdata[l++] = 0x40 | op->operands[1].regs[0];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\tmod = 0x1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (op->operands[1].regs[0] == X86R_EIP && (op->operands[0].type & OT_DWORD)) {\n\t\t\t\t\tdata[l++] = 0x0d;\n\t\t\t\t} else if (op->operands[1].regs[0] == X86R_RIP && (op->operands[0].type & OT_QWORD)) {\n\t\t\t\t\tdata[l++] = 0x05;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = mod << 5 | op->operands[0].reg << 3 | op->operands[1].regs[0];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[1].regs[0] == X86R_ESP) {\n\t\t\t\tdata[l++] = 0x24;\n\t\t\t}\n\t\t\tif (mod >= 0x2) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tif (op->operands[1].offset > 128 || op->operands[1].regs[0] == X86R_EIP) {\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t} else if (a->bits == 64 && (offset || op->operands[1].regs[0] == X86R_RIP)) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tif (op->operands[1].offset > 127 || op->operands[1].regs[0] == X86R_RIP) {\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn l;\n}","target":"static int opmov(RAsm *a, ut8 *data, const Opcode *op) {\n\tint l = 0;\n\tst64 offset = 0;\n\tint mod = 0;\n\tint base = 0;\n\tint rex = 0;\n\tut64 immediate = 0;\n\tif (op->operands[1].type & OT_CONSTANT) {\n\t\tif (!op->operands[1].is_good_flag) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (op->operands[1].immediate == -1) {\n\t\t\treturn -1;\n\t\t}\n\t\timmediate = op->operands[1].immediate * op->operands[1].sign;\n\t\tif (op->operands[0].type & OT_GPREG && !(op->operands[0].type & OT_MEMORY)) {\n\t\t\tif (a->bits == 64 && ((op->operands[0].type & OT_QWORD) | (op->operands[1].type & OT_QWORD))) {\n\t\t\t\tif (!(op->operands[1].type & OT_CONSTANT) && op->operands[1].extended) {\n\t\t\t\t\tdata[l++] = 0x49;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t} else if (op->operands[0].extended) {\n\t\t\t\tdata[l++] = 0x41;\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\t\tif (a->bits > 16) {\n\t\t\t\t\tdata[l++] = 0x66;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_BYTE) {\n\t\t\t\tdata[l++] = 0xb0 | op->operands[0].reg;\n\t\t\t\tdata[l++] = immediate;\n\t\t\t} else {\n\t\t\t\tif (a->bits == 64 &&\n\t\t\t\t\t((op->operands[0].type & OT_QWORD) |\n\t\t\t\t\t(op->operands[1].type & OT_QWORD)) &&\n\t\t\t\t\timmediate < UT32_MAX) {\n\t\t\t\t\t\tdata[l++] = 0xc7;\n\t\t\t\t \t\tdata[l++] = 0xc0 | op->operands[0].reg;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = 0xb8 | op->operands[0].reg;\n\t\t\t\t}\n\t\t\t\tdata[l++] = immediate;\n\t\t\t\tdata[l++] = immediate >> 8;\n\t\t\t\tif (!(op->operands[0].type & OT_WORD)) {\n\t\t\t\t\tdata[l++] = immediate >> 16;\n\t\t\t\t\tdata[l++] = immediate >> 24;\n\t\t\t\t}\n\t\t\t\tif (a->bits == 64 && immediate > UT32_MAX) {\n\t\t\t\t\tdata[l++] = immediate >> 32;\n\t\t\t\t\tdata[l++] = immediate >> 40;\n\t\t\t\t\tdata[l++] = immediate >> 48;\n\t\t\t\t\tdata[l++] = immediate >> 56;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (op->operands[0].type & OT_MEMORY) {\n\t\t\tif (!op->operands[0].explicit_size) {\n\t\t\t\tif (op->operands[0].type & OT_GPREG) {\n\t\t\t\t\t((Opcode *)op)->operands[0].dest_size = op->operands[0].reg_size;\n\t\t\t\t} else {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint dest_bits = 8 * ((op->operands[0].dest_size & ALL_SIZE) >> OPSIZE_SHIFT);\n\t\t\tint reg_bits = 8 * ((op->operands[0].reg_size & ALL_SIZE) >> OPSIZE_SHIFT);\n\t\t\tint offset = op->operands[0].offset * op->operands[0].offset_sign;\n\n\t\t\t//addr_size_override prefix\n\t\t\tbool use_aso = false;\n\t\t\tif (reg_bits < a->bits) {\n\t\t\t\tuse_aso = true;\n\t\t\t}\n\n\t\t\t//op_size_override prefix\n\t\t\tbool use_oso = false;\n\t\t\tif (dest_bits == 16) {\n\t\t\t\tuse_oso = true;\n\t\t\t}\n\n\t\t\tbool rip_rel = op->operands[0].regs[0] == X86R_RIP;\n\n\t\t\t//rex prefix\n\t\t\tint rex = 1 << 6;\n\t\t\tbool use_rex = false;\n\t\t\tif (dest_bits == 64) {\t\t\t//W field\n\t\t\t\tuse_rex = true;\n\t\t\t\trex |= 1 << 3;\n\t\t\t}\n\t\t\tif (op->operands[0].extended) {\t\t//B field\n\t\t\t\tuse_rex = true;\n\t\t\t\trex |= 1;\n\t\t\t}\n\n\t\t\t//opcode selection\n\t\t\tint opcode;\n\t\t\tif (dest_bits == 8) {\n\t\t\t\topcode = 0xc6;\n\t\t\t} else {\n\t\t\t\topcode = 0xc7;\n\t\t\t}\n\n\t\t\t//modrm and SIB selection\n\t\t\tint modrm = 0;\n\t\t\tint mod;\n\t\t\tint reg = 0;\n\t\t\tint rm;\n\t\t\tbool use_sib = false;\n\t\t\tint sib;\n\t\t\t//mod\n\t\t\tif (offset == 0) {\n\t\t\t\tmod = 0;\n\t\t\t} else if (offset < 128 && offset > -129) {\n\t\t\t\tmod = 1;\n\t\t\t} else {\n\t\t\t\tmod = 2;\n\t\t\t}\n\n\t\t\tif (reg_bits == 16) {\n\t\t\t\tif (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_SI) {\n\t\t\t\t\trm = B0000;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_DI) {\n\t\t\t\t\trm = B0001;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_SI) {\n\t\t\t\t\trm = B0010;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_DI) {\n\t\t\t\t\trm = B0011;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_SI && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0100;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_DI && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0101;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0111;\n\t\t\t\t} else {\n\t\t\t\t\t//TODO allow for displacement only when parser is reworked\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tmodrm = (mod << 6) | (reg << 3) | rm;\n\t\t\t} else {\n\t\t\t\t//rm\n\t\t\t\tif (op->operands[0].extended) {\n\t\t\t\t\trm = op->operands[0].reg;\n\t\t\t\t} else {\n\t\t\t\t\trm = op->operands[0].regs[0];\n\t\t\t\t}\n\t\t\t\t//[epb] alone is illegal, so we need to fake a [ebp+0]\n\t\t\t\tif (rm == 5 && mod == 0) {\n\t\t\t\t\tmod = 1;\n\t\t\t\t}\n\n\t\t\t\t//sib\n\t\t\t\tint index = op->operands[0].regs[1];\n\t\t\t\tint scale = getsib(op->operands[0].scale[1]);\n\t\t\t\tif (index != -1) {\n\t\t\t\t\tuse_sib = true;\n\t\t\t\t\tsib = (scale << 6) | (index << 3) | rm;\n\t\t\t\t} else if (rm == 4) {\n\t\t\t\t\tuse_sib = true;\n\t\t\t\t\tsib = 0x24;\n\t\t\t\t}\n\t\t\t\tif (use_sib) {\n\t\t\t\t\trm = B0100;\n\t\t\t\t}\n\t\t\t\tif (rip_rel) {\n\t\t\t\t\tmodrm = (B0000 << 6) | (reg << 3) | B0101;\n\t\t\t\t\tsib = (scale << 6) | (B0100 << 3) | B0101;\n\t\t\t\t} else {\n\t\t\t\t\tmodrm = (mod << 6) | (reg << 3) | rm;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//build the final result\n\t\t\tif (use_aso) {\n\t\t\t\tdata[l++] = 0x67;\n\t\t\t}\n\t\t\tif (use_oso) {\n\t\t\t\tdata[l++] = 0x66;\n\t\t\t}\n\t\t\tif (use_rex) {\n\t\t\t\tdata[l++] = rex;\n\t\t\t}\n\t\t\tdata[l++] = opcode;\n\t\t\tdata[l++] = modrm;\n\t\t\tif (use_sib) {\n\t\t\t\tdata[l++] = sib;\n\t\t\t}\n\t\t\t//offset\n\t\t\tif (mod == 1) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t} else if (reg_bits == 16 && mod == 2) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t} else if (mod == 2 || rip_rel) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t}\n\t\t\t//immediate\n\t\t\tint byte;\n\t\t\tfor (byte = 0; byte < dest_bits && byte < 32; byte += 8) {\n\t\t\t\tdata[l++] = (immediate >> byte);\n\t\t\t}\n\t\t}\n\t} else if (op->operands[1].type & OT_REGALL &&\n\t\t\t !(op->operands[1].type & OT_MEMORY)) {\n\t\tif (op->operands[0].type & OT_CONSTANT) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG &&\n\t\t op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\t\treturn -1;\n\t\t}\n\t\t// Check reg sizes match\n\t\tif (op->operands[0].type & OT_REGTYPE && op->operands[1].type & OT_REGTYPE) {\n\t\t\tif (!((op->operands[0].type & ALL_SIZE) &\n\t\t\t(op->operands[1].type & ALL_SIZE))) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\n\t\tif (a->bits == 64) {\n\t\t\tif (op->operands[0].extended) {\n\t\t\t\trex = 1;\n\t\t\t}\n\t\t\tif (op->operands[1].extended) {\n\t\t\t\trex += 4;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD) {\n\t\t\t\tif (!(op->operands[0].type & OT_QWORD)) {\n\t\t\t\t\tdata[l++] = 0x67;\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD &&\n\t\t\t\top->operands[0].type & OT_QWORD) {\n\t\t\t\tdata[l++] = 0x48 | rex;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_DWORD &&\n\t\t\t\top->operands[0].type & OT_DWORD) {\n\t\t\t\tdata[l++] = 0x40 | rex;\n\t\t\t}\n\t\t} else if (op->operands[0].extended && op->operands[1].extended) {\n\t\t\tdata[l++] = 0x45;\n\t\t}\n\t\toffset = op->operands[0].offset * op->operands[0].offset_sign;\n\t\tif (op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\tdata[l++] = 0x8c;\n\t\t} else {\n\t\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\t\tdata[l++] = 0x66;\n\t\t\t}\n\t\t\tdata[l++] = (op->operands[0].type & OT_BYTE) ? 0x88 : 0x89;\n\t\t}\n\n\t\tif (op->operands[0].scale[0] > 1) {\n\t\t\t\tdata[l++] = op->operands[1].reg << 3 | 4;\n\t\t\t\tdata[l++] = getsib (op->operands[0].scale[0]) << 6 |\n\t\t\t\t\t\t op->operands[0].regs[0] << 3 | 5;\n\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\tdata[l++] = offset >> 24;\n\n\t\t\t\treturn l;\n\t\t\t}\n\n\t\tif (!(op->operands[0].type & OT_MEMORY)) {\n\t\t\tif (op->operands[0].reg == X86R_UNDEFINED ||\n\t\t\t\top->operands[1].reg == X86R_UNDEFINED) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tmod = 0x3;\n\t\t\tdata[l++] = mod << 6 | op->operands[1].reg << 3 | op->operands[0].reg;\n\t\t} else if (op->operands[0].regs[0] == X86R_UNDEFINED) {\n\t\t\tdata[l++] = op->operands[1].reg << 3 | 0x5;\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t} else {\n\t\t\tif (op->operands[0].type & OT_MEMORY) {\n\t\t\t\tif (op->operands[0].regs[1] != X86R_UNDEFINED) {\n\t\t\t\t\tdata[l++] = op->operands[1].reg << 3 | 0x4;\n\t\t\t\t\tdata[l++] = op->operands[0].regs[1] << 3 | op->operands[0].regs[0];\n\t\t\t\t\treturn l;\n\t\t\t\t}\n\t\t\t\tif (offset) {\n\t\t\t\t\tmod = (offset > 128 || offset < -129) ? 0x2 : 0x1;\n\t\t\t\t}\n\t\t\t\tif (op->operands[0].regs[0] == X86R_EBP) {\n\t\t\t\t\tmod = 0x2;\n\t\t\t\t}\n\t\t\t\tdata[l++] = mod << 6 | op->operands[1].reg << 3 | op->operands[0].regs[0];\n\t\t\t\tif (op->operands[0].regs[0] == X86R_ESP) {\n\t\t\t\t\tdata[l++] = 0x24;\n\t\t\t\t}\n\t\t\t\tif (offset) {\n\t\t\t\t\tdata[l++] = offset;\n\t\t\t\t}\n\t\t\t\tif (mod == 2) {\n\t\t\t\t\t// warning C4293: '>>': shift count negative or too big, undefined behavior\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if (op->operands[1].type & OT_MEMORY) {\n\t\tif (op->operands[0].type & OT_MEMORY) {\n\t\t\treturn -1;\n\t\t}\n\t\toffset = op->operands[1].offset * op->operands[1].offset_sign;\n\t\tif (op->operands[0].reg == X86R_EAX && op->operands[1].regs[0] == X86R_UNDEFINED) {\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = 0x48;\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_BYTE) {\n\t\t\t\tdata[l++] = 0xa0;\n\t\t\t} else {\n\t\t\t\tdata[l++] = 0xa1;\n\t\t\t}\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = offset >> 32;\n\t\t\t\tdata[l++] = offset >> 40;\n\t\t\t\tdata[l++] = offset >> 48;\n\t\t\t\tdata[l++] = offset >> 54;\n\t\t\t}\n\t\t\treturn l;\n\t\t}\n\t\tif (op->operands[0].type & OT_BYTE && a->bits == 64 && op->operands[1].regs[0]) {\n\t\t\tif (op->operands[1].regs[0] >= X86R_R8 &&\n\t\t\t op->operands[0].reg < 4) {\n\t\t\t\tdata[l++] = 0x41;\n\t\t\t\tdata[l++] = 0x8a;\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | (op->operands[1].regs[0] - 8);\n\t\t\t\treturn l;\n\t\t\t}\n\t\t\treturn -1;\n\t\t}\n\n\t\tif (op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\tif (op->operands[1].scale[0] == 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tdata[l++] = SEG_REG_PREFIXES[op->operands[1].regs[0] % 6];\n\t\t\tdata[l++] = 0x8b;\n\t\t\tdata[l++] = (((ut32)op->operands[0].reg) << 3) | 0x5;\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t\treturn l;\n\t\t}\n\n\t\tif (a->bits == 64) {\n\t\t\tif (op->operands[0].type & OT_QWORD) {\n\t\t\t\tif (!(op->operands[1].type & OT_QWORD)) {\n\t\t\t\t\tif (op->operands[1].regs[0] != -1) {\n\t\t\t\t\t\tdata[l++] = 0x67;\n\t\t\t\t\t}\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t} else if (op->operands[1].type & OT_DWORD) {\n\t\t\t\tdata[l++] = 0x44;\n\t\t\t} else if (!(op->operands[1].type & OT_QWORD)) {\n\t\t\t\tdata[l++] = 0x67;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD &&\n\t\t\t\top->operands[0].type & OT_QWORD) {\n\t\t\t\tdata[l++] = 0x48;\n\t\t\t}\n\t\t}\n\n\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\tdata[l++] = 0x66;\n\t\t\tdata[l++] = op->operands[1].type & OT_BYTE ? 0x8a : 0x8b;\n\t\t} else {\n\t\t\tdata[l++] = (op->operands[1].type & OT_BYTE ||\n\t\t\t\top->operands[0].type & OT_BYTE) ?\n\t\t\t\t0x8a : 0x8b;\n\t\t}\n\n\t\tif (op->operands[1].regs[0] == X86R_UNDEFINED) {\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x4;\n\t\t\t\tdata[l++] = 0x25;\n\t\t\t} else {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x5;\n\t\t\t}\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t} else {\n\t\t\tif (op->operands[1].scale[0] > 1) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 4;\n\n\t\t\t\tif (op->operands[1].scale[0] >= 2) {\n\t\t\t\t\tbase = 5;\n\t\t\t\t}\n\t\t\t\tif (base) {\n\t\t\t\t\tdata[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | base;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = getsib (op->operands[1].scale[0]) << 3 | op->operands[1].regs[0];\n\t\t\t\t}\n\t\t\t\tif (offset || base) {\n\t\t\t\t\tdata[l++] = offset;\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t\treturn l;\n\t\t\t}\n\t\t\tif (op->operands[1].regs[1] != X86R_UNDEFINED) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x4;\n\t\t\t\tdata[l++] = op->operands[1].regs[1] << 3 | op->operands[1].regs[0];\n\t\t\t\treturn l;\n\t\t\t}\n\n\t\t\tif (offset || op->operands[1].regs[0] == X86R_EBP) {\n\t\t\t\tmod = 0x2;\n\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\tmod = 0x4;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (a->bits == 64 && offset && op->operands[0].type & OT_QWORD) {\n\t\t\t\tif (op->operands[1].regs[0] == X86R_RIP) {\n\t\t\t\t\tdata[l++] = 0x5;\n\t\t\t\t} else {\n\t\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\t\tdata[l++] = 0x80 | op->operands[0].reg << 3 | op->operands[1].regs[0];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdata[l++] = 0x40 | op->operands[1].regs[0];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\tmod = 0x1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (op->operands[1].regs[0] == X86R_EIP && (op->operands[0].type & OT_DWORD)) {\n\t\t\t\t\tdata[l++] = 0x0d;\n\t\t\t\t} else if (op->operands[1].regs[0] == X86R_RIP && (op->operands[0].type & OT_QWORD)) {\n\t\t\t\t\tdata[l++] = 0x05;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = mod << 5 | op->operands[0].reg << 3 | op->operands[1].regs[0];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[1].regs[0] == X86R_ESP) {\n\t\t\t\tdata[l++] = 0x24;\n\t\t\t}\n\t\t\tif (mod >= 0x2) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tif (op->operands[1].offset > 128 || op->operands[1].regs[0] == X86R_EIP) {\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t} else if (a->bits == 64 && (offset || op->operands[1].regs[0] == X86R_RIP)) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tif (op->operands[1].offset > 127 || op->operands[1].regs[0] == X86R_RIP) {\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn l;\n}","lang":"c","vul_type":"cwe-125","target_token_count":5176,"sven_meta":{"func_name":"opmov","file_name":"libr/asm/p/asm_x86_nz.c","commit_link":"github.com/radare/radare2/commit/f17bfd9f1da05f30f23a4dd05e9d2363e1406948","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#7-ccfc7e06ae9d","input":"int ares_parse_a_reply(const unsigned char *abuf, int alen,\n\t\t struct hostent **host)\n{\n unsigned int qdcount, ancount;\n int status, i, rr_type, rr_class, rr_len, naddrs;\n long int len;\n int naliases;\n const unsigned char *aptr;\n char *hostname, *rr_name, *rr_data, **aliases;\n struct in_addr *addrs;\n struct hostent *hostent;\n\n /* Set *host to NULL for all failure cases. */\n *host = NULL;\n\n /* Give up if abuf doesn't have room for a header. */\n if (alen < HFIXEDSZ)\n return ARES_EBADRESP;\n\n /* Fetch the question and answer count from the header. */\n qdcount = DNS_HEADER_QDCOUNT(abuf);\n ancount = DNS_HEADER_ANCOUNT(abuf);\n if (qdcount != 1)\n return ARES_EBADRESP;\n\n /* Expand the name from the question, and skip past the question. */\n aptr = abuf + HFIXEDSZ;\n status = ares_expand_name(aptr, abuf, alen, &hostname, &len);\n if (status != ARES_SUCCESS)\n return status;\n if (aptr + len + QFIXEDSZ > abuf + alen)\n {\n free(hostname);\n return ARES_EBADRESP;\n }\n aptr += len + QFIXEDSZ;\n\n /* Allocate addresses and aliases; ancount gives an upper bound for both. */\n addrs = malloc(ancount * sizeof(struct in_addr));\n if (!addrs)\n {\n free(hostname);\n return ARES_ENOMEM;\n }\n aliases = malloc((ancount + 1) * sizeof(char *));\n if (!aliases)\n {\n free(hostname);\n free(addrs);\n return ARES_ENOMEM;\n }\n naddrs = 0;\n naliases = 0;\n\n /* Examine each answer resource record (RR) in turn. */\n for (i = 0; i < (int)ancount; i++)\n {\n /* Decode the RR up to the data field. */\n status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);\n if (status != ARES_SUCCESS)\n\tbreak;\n aptr += len;\n if (aptr + RRFIXEDSZ > abuf + alen)\n\t{\n\t free(rr_name);\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n rr_type = DNS_RR_TYPE(aptr);\n rr_class = DNS_RR_CLASS(aptr);\n rr_len = DNS_RR_LEN(aptr);\n aptr += RRFIXEDSZ;\n\n if (rr_class == C_IN && rr_type == T_A\n\t && rr_len == sizeof(struct in_addr)\n\t && strcasecmp(rr_name, hostname) == 0)\n\t{\n\t memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr));\n\t naddrs++;\n\t status = ARES_SUCCESS;\n\t}\n\n if (rr_class == C_IN && rr_type == T_CNAME)\n\t{\n\t /* Record the RR name as an alias. */\n\t aliases[naliases] = rr_name;\n\t naliases++;\n\n\t /* Decode the RR data and replace the hostname with it. */\n\t status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);\n\t if (status != ARES_SUCCESS)\n\t break;\n\t free(hostname);\n\t hostname = rr_data;\n\t}\n else\n\tfree(rr_name);\n\n aptr += rr_len;\n if (aptr > abuf + alen)\n\t{\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n }\n\n if (status == ARES_SUCCESS && naddrs == 0)\n status = ARES_ENODATA;\n if (status == ARES_SUCCESS)\n {\n /* We got our answer. Allocate memory to build the host entry. */\n aliases[naliases] = NULL;\n hostent = malloc(sizeof(struct hostent));\n if (hostent)\n\t{\n\t hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));\n\t if (hostent->h_addr_list)\n\t {\n\t /* Fill in the hostent and return successfully. */\n\t hostent->h_name = hostname;\n\t hostent->h_aliases = aliases;\n\t hostent->h_addrtype = AF_INET;\n\t hostent->h_length = sizeof(struct in_addr);\n\t for (i = 0; i < naddrs; i++)\n\t\thostent->h_addr_list[i] = (char *) &addrs[i];\n\t hostent->h_addr_list[naddrs] = NULL;\n\t *host = hostent;\n\t return ARES_SUCCESS;\n\t }\n\t free(hostent);\n\t}\n status = ARES_ENOMEM;\n }\n for (i = 0; i < naliases; i++)\n free(aliases[i]);\n free(aliases);\n free(addrs);\n free(hostname);\n return status;\n}","target":"int ares_parse_a_reply(const unsigned char *abuf, int alen,\n\t\t struct hostent **host)\n{\n unsigned int qdcount, ancount;\n int status, i, rr_type, rr_class, rr_len, naddrs;\n long int len;\n int naliases;\n const unsigned char *aptr;\n char *hostname, *rr_name, *rr_data, **aliases;\n struct in_addr *addrs;\n struct hostent *hostent;\n\n /* Set *host to NULL for all failure cases. */\n *host = NULL;\n\n /* Give up if abuf doesn't have room for a header. */\n if (alen < HFIXEDSZ)\n return ARES_EBADRESP;\n\n /* Fetch the question and answer count from the header. */\n qdcount = DNS_HEADER_QDCOUNT(abuf);\n ancount = DNS_HEADER_ANCOUNT(abuf);\n if (qdcount != 1)\n return ARES_EBADRESP;\n\n /* Expand the name from the question, and skip past the question. */\n aptr = abuf + HFIXEDSZ;\n status = ares_expand_name(aptr, abuf, alen, &hostname, &len);\n if (status != ARES_SUCCESS)\n return status;\n if (aptr + len + QFIXEDSZ > abuf + alen)\n {\n free(hostname);\n return ARES_EBADRESP;\n }\n aptr += len + QFIXEDSZ;\n\n /* Allocate addresses and aliases; ancount gives an upper bound for both. */\n addrs = malloc(ancount * sizeof(struct in_addr));\n if (!addrs)\n {\n free(hostname);\n return ARES_ENOMEM;\n }\n aliases = malloc((ancount + 1) * sizeof(char *));\n if (!aliases)\n {\n free(hostname);\n free(addrs);\n return ARES_ENOMEM;\n }\n naddrs = 0;\n naliases = 0;\n\n /* Examine each answer resource record (RR) in turn. */\n for (i = 0; i < (int)ancount; i++)\n {\n /* Decode the RR up to the data field. */\n status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);\n if (status != ARES_SUCCESS)\n\tbreak;\n aptr += len;\n if (aptr + RRFIXEDSZ > abuf + alen)\n\t{\n\t free(rr_name);\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n rr_type = DNS_RR_TYPE(aptr);\n rr_class = DNS_RR_CLASS(aptr);\n rr_len = DNS_RR_LEN(aptr);\n aptr += RRFIXEDSZ;\n if (aptr + rr_len > abuf + alen)\n\t{\n\t free(rr_name);\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n\n if (rr_class == C_IN && rr_type == T_A\n\t && rr_len == sizeof(struct in_addr)\n\t && strcasecmp(rr_name, hostname) == 0)\n\t{\n\t memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr));\n\t naddrs++;\n\t status = ARES_SUCCESS;\n\t}\n\n if (rr_class == C_IN && rr_type == T_CNAME)\n\t{\n\t /* Record the RR name as an alias. */\n\t aliases[naliases] = rr_name;\n\t naliases++;\n\n\t /* Decode the RR data and replace the hostname with it. */\n\t status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);\n\t if (status != ARES_SUCCESS)\n\t break;\n\t free(hostname);\n\t hostname = rr_data;\n\t}\n else\n\tfree(rr_name);\n\n aptr += rr_len;\n if (aptr > abuf + alen)\n\t{\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n }\n\n if (status == ARES_SUCCESS && naddrs == 0)\n status = ARES_ENODATA;\n if (status == ARES_SUCCESS)\n {\n /* We got our answer. Allocate memory to build the host entry. */\n aliases[naliases] = NULL;\n hostent = malloc(sizeof(struct hostent));\n if (hostent)\n\t{\n\t hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));\n\t if (hostent->h_addr_list)\n\t {\n\t /* Fill in the hostent and return successfully. */\n\t hostent->h_name = hostname;\n\t hostent->h_aliases = aliases;\n\t hostent->h_addrtype = AF_INET;\n\t hostent->h_length = sizeof(struct in_addr);\n\t for (i = 0; i < naddrs; i++)\n\t\thostent->h_addr_list[i] = (char *) &addrs[i];\n\t hostent->h_addr_list[naddrs] = NULL;\n\t *host = hostent;\n\t return ARES_SUCCESS;\n\t }\n\t free(hostent);\n\t}\n status = ARES_ENOMEM;\n }\n for (i = 0; i < naliases; i++)\n free(aliases[i]);\n free(aliases);\n free(addrs);\n free(hostname);\n return status;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1135,"sven_meta":{"func_name":"ares_parse_a_reply","file_name":"rutil/dns/ares/ares_parse_a_reply.c","commit_link":"github.com/resiprocate/resiprocate/commit/d67a9ca6fd06ca65d23e313bdbad1ef4dd3aa0df","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#8-42cbfbbb6725","input":"static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,\n MagickOffsetType PS_Offset,ssize_t PS_Size,ExceptionInfo *exception)\n{\n char\n postscript_file[MaxTextExtent];\n\n const MagicInfo\n *magic_info;\n\n FILE\n *ps_file;\n\n ImageInfo\n *clone_info;\n\n Image\n *image2;\n\n unsigned char\n magick[2*MaxTextExtent];\n\n\n if ((clone_info=CloneImageInfo(image_info)) == NULL)\n return(image);\n clone_info->blob=(void *) NULL;\n clone_info->length=0;\n\n /* Obtain temporary file */\n (void) AcquireUniqueFilename(postscript_file);\n ps_file=fopen_utf8(postscript_file,\"wb\");\n if (ps_file == (FILE *) NULL)\n goto FINISH;\n\n /* Copy postscript to temporary file */\n (void) SeekBlob(image,PS_Offset,SEEK_SET);\n (void) ReadBlob(image, 2*MaxTextExtent, magick);\n\n (void) SeekBlob(image,PS_Offset,SEEK_SET);\n while(PS_Size-- > 0)\n {\n (void) fputc(ReadBlobByte(image),ps_file);\n }\n (void) fclose(ps_file);\n\n /* Detect file format - Check magic.mgk configuration file. */\n magic_info=GetMagicInfo(magick,2*MaxTextExtent,exception);\n if(magic_info == (const MagicInfo *) NULL) goto FINISH_UNL;\n /* printf(\"Detected:%s \\n\",magic_info->name); */\n if(exception->severity != UndefinedException) goto FINISH_UNL;\n if(magic_info->name == (char *) NULL) goto FINISH_UNL;\n\n (void) CopyMagickMemory(clone_info->magick,magic_info->name,MaxTextExtent);\n\n /* Read nested image */\n /*FormatString(clone_info->filename,\"%s:%s\",magic_info->name,postscript_file);*/\n FormatLocaleString(clone_info->filename,MaxTextExtent,\"%s\",postscript_file);\n image2=ReadImage(clone_info,exception);\n\n if (!image2)\n goto FINISH_UNL;\n\n /*\n Replace current image with new image while copying base image\n attributes.\n */\n (void) CopyMagickMemory(image2->filename,image->filename,MaxTextExtent);\n (void) CopyMagickMemory(image2->magick_filename,image->magick_filename,MaxTextExtent);\n (void) CopyMagickMemory(image2->magick,image->magick,MaxTextExtent);\n image2->depth=image->depth;\n DestroyBlob(image2);\n image2->blob=ReferenceBlob(image->blob);\n\n if ((image->rows == 0) || (image->columns == 0))\n DeleteImageFromList(&image);\n\n AppendImageToList(&image,image2);\n\n FINISH_UNL:\n (void) RelinquishUniqueFileResource(postscript_file);\n FINISH:\n DestroyImageInfo(clone_info);\n return(image);\n}","target":"static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,\n MagickOffsetType PS_Offset,ssize_t PS_Size,ExceptionInfo *exception)\n{\n char\n postscript_file[MaxTextExtent];\n\n const MagicInfo\n *magic_info;\n\n FILE\n *ps_file;\n\n ImageInfo\n *clone_info;\n\n Image\n *image2;\n\n unsigned char\n magick[2*MaxTextExtent];\n\n\n if ((clone_info=CloneImageInfo(image_info)) == NULL)\n return(image);\n clone_info->blob=(void *) NULL;\n clone_info->length=0;\n\n /* Obtain temporary file */\n (void) AcquireUniqueFilename(postscript_file);\n ps_file=fopen_utf8(postscript_file,\"wb\");\n if (ps_file == (FILE *) NULL)\n goto FINISH;\n\n /* Copy postscript to temporary file */\n (void) SeekBlob(image,PS_Offset,SEEK_SET);\n (void) ReadBlob(image, 2*MaxTextExtent, magick);\n\n (void) SeekBlob(image,PS_Offset,SEEK_SET);\n while(PS_Size-- > 0)\n {\n (void) fputc(ReadBlobByte(image),ps_file);\n }\n (void) fclose(ps_file);\n\n /* Detect file format - Check magic.mgk configuration file. */\n magic_info=GetMagicInfo(magick,2*MaxTextExtent,exception);\n if(magic_info == (const MagicInfo *) NULL) goto FINISH_UNL;\n /* printf(\"Detected:%s \\n\",magic_info->name); */\n if(exception->severity != UndefinedException) goto FINISH_UNL;\n if(magic_info->name == (char *) NULL) goto FINISH_UNL;\n\n (void) strncpy(clone_info->magick,magic_info->name,MaxTextExtent);\n\n /* Read nested image */\n /*FormatString(clone_info->filename,\"%s:%s\",magic_info->name,postscript_file);*/\n FormatLocaleString(clone_info->filename,MaxTextExtent,\"%s\",postscript_file);\n image2=ReadImage(clone_info,exception);\n\n if (!image2)\n goto FINISH_UNL;\n\n /*\n Replace current image with new image while copying base image\n attributes.\n */\n (void) CopyMagickMemory(image2->filename,image->filename,MaxTextExtent);\n (void) CopyMagickMemory(image2->magick_filename,image->magick_filename,MaxTextExtent);\n (void) CopyMagickMemory(image2->magick,image->magick,MaxTextExtent);\n image2->depth=image->depth;\n DestroyBlob(image2);\n image2->blob=ReferenceBlob(image->blob);\n\n if ((image->rows == 0) || (image->columns == 0))\n DeleteImageFromList(&image);\n\n AppendImageToList(&image,image2);\n\n FINISH_UNL:\n (void) RelinquishUniqueFileResource(postscript_file);\n FINISH:\n DestroyImageInfo(clone_info);\n return(image);\n}","lang":"c","vul_type":"cwe-125","target_token_count":651,"sven_meta":{"func_name":"ExtractPostscript","file_name":"coders/wpg.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/a251039393f423c7858e63cab6aa98d17b8b7a41","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#9-938fa4b051f1","input":"int usb_get_bos_descriptor(struct usb_device *dev)\n{\n\tstruct device *ddev = &dev->dev;\n\tstruct usb_bos_descriptor *bos;\n\tstruct usb_dev_cap_header *cap;\n\tunsigned char *buffer;\n\tint length, total_len, num, i;\n\tint ret;\n\n\tbos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);\n\tif (!bos)\n\t\treturn -ENOMEM;\n\n\t/* Get BOS descriptor */\n\tret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE);\n\tif (ret < USB_DT_BOS_SIZE) {\n\t\tdev_err(ddev, \"unable to get BOS descriptor\\n\");\n\t\tif (ret >= 0)\n\t\t\tret = -ENOMSG;\n\t\tkfree(bos);\n\t\treturn ret;\n\t}\n\n\tlength = bos->bLength;\n\ttotal_len = le16_to_cpu(bos->wTotalLength);\n\tnum = bos->bNumDeviceCaps;\n\tkfree(bos);\n\tif (total_len < length)\n\t\treturn -EINVAL;\n\n\tdev->bos = kzalloc(sizeof(struct usb_host_bos), GFP_KERNEL);\n\tif (!dev->bos)\n\t\treturn -ENOMEM;\n\n\t/* Now let's get the whole BOS descriptor set */\n\tbuffer = kzalloc(total_len, GFP_KERNEL);\n\tif (!buffer) {\n\t\tret = -ENOMEM;\n\t\tgoto err;\n\t}\n\tdev->bos->desc = (struct usb_bos_descriptor *)buffer;\n\n\tret = usb_get_descriptor(dev, USB_DT_BOS, 0, buffer, total_len);\n\tif (ret < total_len) {\n\t\tdev_err(ddev, \"unable to get BOS descriptor set\\n\");\n\t\tif (ret >= 0)\n\t\t\tret = -ENOMSG;\n\t\tgoto err;\n\t}\n\ttotal_len -= length;\n\n\tfor (i = 0; i < num; i++) {\n\t\tbuffer += length;\n\t\tcap = (struct usb_dev_cap_header *)buffer;\n\t\tlength = cap->bLength;\n\n\t\tif (total_len < length)\n\t\t\tbreak;\n\t\ttotal_len -= length;\n\n\t\tif (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) {\n\t\t\tdev_warn(ddev, \"descriptor type invalid, skip\\n\");\n\t\t\tcontinue;\n\t\t}\n\n\t\tswitch (cap->bDevCapabilityType) {\n\t\tcase USB_CAP_TYPE_WIRELESS_USB:\n\t\t\t/* Wireless USB cap descriptor is handled by wusb */\n\t\t\tbreak;\n\t\tcase USB_CAP_TYPE_EXT:\n\t\t\tdev->bos->ext_cap =\n\t\t\t\t(struct usb_ext_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_SS_CAP_TYPE:\n\t\t\tdev->bos->ss_cap =\n\t\t\t\t(struct usb_ss_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_SSP_CAP_TYPE:\n\t\t\tdev->bos->ssp_cap =\n\t\t\t\t(struct usb_ssp_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase CONTAINER_ID_TYPE:\n\t\t\tdev->bos->ss_id =\n\t\t\t\t(struct usb_ss_container_id_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_PTM_CAP_TYPE:\n\t\t\tdev->bos->ptm_cap =\n\t\t\t\t(struct usb_ptm_cap_descriptor *)buffer;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn 0;\n\nerr:\n\tusb_release_bos_descriptor(dev);\n\treturn ret;\n}","target":"int usb_get_bos_descriptor(struct usb_device *dev)\n{\n\tstruct device *ddev = &dev->dev;\n\tstruct usb_bos_descriptor *bos;\n\tstruct usb_dev_cap_header *cap;\n\tunsigned char *buffer;\n\tint length, total_len, num, i;\n\tint ret;\n\n\tbos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);\n\tif (!bos)\n\t\treturn -ENOMEM;\n\n\t/* Get BOS descriptor */\n\tret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE);\n\tif (ret < USB_DT_BOS_SIZE) {\n\t\tdev_err(ddev, \"unable to get BOS descriptor\\n\");\n\t\tif (ret >= 0)\n\t\t\tret = -ENOMSG;\n\t\tkfree(bos);\n\t\treturn ret;\n\t}\n\n\tlength = bos->bLength;\n\ttotal_len = le16_to_cpu(bos->wTotalLength);\n\tnum = bos->bNumDeviceCaps;\n\tkfree(bos);\n\tif (total_len < length)\n\t\treturn -EINVAL;\n\n\tdev->bos = kzalloc(sizeof(struct usb_host_bos), GFP_KERNEL);\n\tif (!dev->bos)\n\t\treturn -ENOMEM;\n\n\t/* Now let's get the whole BOS descriptor set */\n\tbuffer = kzalloc(total_len, GFP_KERNEL);\n\tif (!buffer) {\n\t\tret = -ENOMEM;\n\t\tgoto err;\n\t}\n\tdev->bos->desc = (struct usb_bos_descriptor *)buffer;\n\n\tret = usb_get_descriptor(dev, USB_DT_BOS, 0, buffer, total_len);\n\tif (ret < total_len) {\n\t\tdev_err(ddev, \"unable to get BOS descriptor set\\n\");\n\t\tif (ret >= 0)\n\t\t\tret = -ENOMSG;\n\t\tgoto err;\n\t}\n\ttotal_len -= length;\n\n\tfor (i = 0; i < num; i++) {\n\t\tbuffer += length;\n\t\tcap = (struct usb_dev_cap_header *)buffer;\n\n\t\tif (total_len < sizeof(*cap) || total_len < cap->bLength) {\n\t\t\tdev->bos->desc->bNumDeviceCaps = i;\n\t\t\tbreak;\n\t\t}\n\t\tlength = cap->bLength;\n\t\ttotal_len -= length;\n\n\t\tif (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) {\n\t\t\tdev_warn(ddev, \"descriptor type invalid, skip\\n\");\n\t\t\tcontinue;\n\t\t}\n\n\t\tswitch (cap->bDevCapabilityType) {\n\t\tcase USB_CAP_TYPE_WIRELESS_USB:\n\t\t\t/* Wireless USB cap descriptor is handled by wusb */\n\t\t\tbreak;\n\t\tcase USB_CAP_TYPE_EXT:\n\t\t\tdev->bos->ext_cap =\n\t\t\t\t(struct usb_ext_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_SS_CAP_TYPE:\n\t\t\tdev->bos->ss_cap =\n\t\t\t\t(struct usb_ss_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_SSP_CAP_TYPE:\n\t\t\tdev->bos->ssp_cap =\n\t\t\t\t(struct usb_ssp_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase CONTAINER_ID_TYPE:\n\t\t\tdev->bos->ss_id =\n\t\t\t\t(struct usb_ss_container_id_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_PTM_CAP_TYPE:\n\t\t\tdev->bos->ptm_cap =\n\t\t\t\t(struct usb_ptm_cap_descriptor *)buffer;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn 0;\n\nerr:\n\tusb_release_bos_descriptor(dev);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-125","target_token_count":696,"sven_meta":{"func_name":"usb_get_bos_descriptor","file_name":"drivers/usb/core/config.c","commit_link":"github.com/torvalds/linux/commit/1c0edc3633b56000e18d82fc241e3995ca18a69e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#10-3b3caf084945","input":"Mat_VarReadNextInfo4(mat_t *mat)\n{\n int M,O,data_type,class_type;\n mat_int32_t tmp;\n long nBytes;\n size_t readresult;\n matvar_t *matvar = NULL;\n union {\n mat_uint32_t u;\n mat_uint8_t c[4];\n } endian;\n\n if ( mat == NULL || mat->fp == NULL )\n return NULL;\n else if ( NULL == (matvar = Mat_VarCalloc()) )\n return NULL;\n\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n endian.u = 0x01020304;\n\n /* See if MOPT may need byteswapping */\n if ( tmp < 0 || tmp > 4052 ) {\n if ( Mat_int32Swap(&tmp) > 4052 ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n }\n\n M = (int)floor(tmp / 1000.0);\n switch ( M ) {\n case 0:\n /* IEEE little endian */\n mat->byteswap = endian.c[0] != 4;\n break;\n case 1:\n /* IEEE big endian */\n mat->byteswap = endian.c[0] != 1;\n break;\n default:\n /* VAX, Cray, or bogus */\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= M*1000;\n O = (int)floor(tmp / 100.0);\n /* O must be zero */\n if ( 0 != O ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= O*100;\n data_type = (int)floor(tmp / 10.0);\n /* Convert the V4 data type */\n switch ( data_type ) {\n case 0:\n matvar->data_type = MAT_T_DOUBLE;\n break;\n case 1:\n matvar->data_type = MAT_T_SINGLE;\n break;\n case 2:\n matvar->data_type = MAT_T_INT32;\n break;\n case 3:\n matvar->data_type = MAT_T_INT16;\n break;\n case 4:\n matvar->data_type = MAT_T_UINT16;\n break;\n case 5:\n matvar->data_type = MAT_T_UINT8;\n break;\n default:\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= data_type*10;\n class_type = (int)floor(tmp / 1.0);\n switch ( class_type ) {\n case 0:\n matvar->class_type = MAT_C_DOUBLE;\n break;\n case 1:\n matvar->class_type = MAT_C_CHAR;\n break;\n case 2:\n matvar->class_type = MAT_C_SPARSE;\n break;\n default:\n Mat_VarFree(matvar);\n return NULL;\n }\n\n matvar->rank = 2;\n matvar->dims = (size_t*)calloc(2, sizeof(*matvar->dims));\n if ( NULL == matvar->dims ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n matvar->dims[0] = tmp;\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n matvar->dims[1] = tmp;\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n readresult = fread(&(matvar->isComplex),sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n if ( matvar->isComplex && MAT_C_CHAR == matvar->class_type ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n /* Check that the length of the variable name is at least 1 */\n if ( tmp < 1 ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n matvar->name = (char*)malloc(tmp);\n if ( NULL == matvar->name ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(matvar->name,1,tmp,(FILE*)mat->fp);\n if ( tmp != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n matvar->internal->datapos = ftell((FILE*)mat->fp);\n if ( matvar->internal->datapos == -1L ) {\n Mat_VarFree(matvar);\n Mat_Critical(\"Couldn't determine file position\");\n return NULL;\n }\n {\n int err;\n size_t tmp2 = Mat_SizeOf(matvar->data_type);\n if ( matvar->isComplex )\n tmp2 *= 2;\n err = SafeMulDims(matvar, &tmp2);\n if ( err ) {\n Mat_VarFree(matvar);\n Mat_Critical(\"Integer multiplication overflow\");\n return NULL;\n }\n\n nBytes = (long)tmp2;\n }\n (void)fseek((FILE*)mat->fp,nBytes,SEEK_CUR);\n\n return matvar;\n}","target":"Mat_VarReadNextInfo4(mat_t *mat)\n{\n int M,O,data_type,class_type;\n mat_int32_t tmp;\n long nBytes;\n size_t readresult;\n matvar_t *matvar = NULL;\n union {\n mat_uint32_t u;\n mat_uint8_t c[4];\n } endian;\n\n if ( mat == NULL || mat->fp == NULL )\n return NULL;\n else if ( NULL == (matvar = Mat_VarCalloc()) )\n return NULL;\n\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n endian.u = 0x01020304;\n\n /* See if MOPT may need byteswapping */\n if ( tmp < 0 || tmp > 4052 ) {\n if ( Mat_int32Swap(&tmp) > 4052 ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n }\n\n M = (int)floor(tmp / 1000.0);\n switch ( M ) {\n case 0:\n /* IEEE little endian */\n mat->byteswap = endian.c[0] != 4;\n break;\n case 1:\n /* IEEE big endian */\n mat->byteswap = endian.c[0] != 1;\n break;\n default:\n /* VAX, Cray, or bogus */\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= M*1000;\n O = (int)floor(tmp / 100.0);\n /* O must be zero */\n if ( 0 != O ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= O*100;\n data_type = (int)floor(tmp / 10.0);\n /* Convert the V4 data type */\n switch ( data_type ) {\n case 0:\n matvar->data_type = MAT_T_DOUBLE;\n break;\n case 1:\n matvar->data_type = MAT_T_SINGLE;\n break;\n case 2:\n matvar->data_type = MAT_T_INT32;\n break;\n case 3:\n matvar->data_type = MAT_T_INT16;\n break;\n case 4:\n matvar->data_type = MAT_T_UINT16;\n break;\n case 5:\n matvar->data_type = MAT_T_UINT8;\n break;\n default:\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= data_type*10;\n class_type = (int)floor(tmp / 1.0);\n switch ( class_type ) {\n case 0:\n matvar->class_type = MAT_C_DOUBLE;\n break;\n case 1:\n matvar->class_type = MAT_C_CHAR;\n break;\n case 2:\n matvar->class_type = MAT_C_SPARSE;\n break;\n default:\n Mat_VarFree(matvar);\n return NULL;\n }\n\n matvar->rank = 2;\n matvar->dims = (size_t*)calloc(2, sizeof(*matvar->dims));\n if ( NULL == matvar->dims ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n matvar->dims[0] = tmp;\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n matvar->dims[1] = tmp;\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n readresult = fread(&(matvar->isComplex),sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n if ( matvar->isComplex && MAT_C_CHAR == matvar->class_type ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n /* Check that the length of the variable name is at least 1 */\n if ( tmp < 1 ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n matvar->name = (char*)malloc(tmp);\n if ( NULL == matvar->name ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(matvar->name,1,tmp,(FILE*)mat->fp);\n if ( tmp != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n } else {\n matvar->name[tmp - 1] = '\\0';\n }\n\n matvar->internal->datapos = ftell((FILE*)mat->fp);\n if ( matvar->internal->datapos == -1L ) {\n Mat_VarFree(matvar);\n Mat_Critical(\"Couldn't determine file position\");\n return NULL;\n }\n {\n int err;\n size_t tmp2 = Mat_SizeOf(matvar->data_type);\n if ( matvar->isComplex )\n tmp2 *= 2;\n err = SafeMulDims(matvar, &tmp2);\n if ( err ) {\n Mat_VarFree(matvar);\n Mat_Critical(\"Integer multiplication overflow\");\n return NULL;\n }\n\n nBytes = (long)tmp2;\n }\n (void)fseek((FILE*)mat->fp,nBytes,SEEK_CUR);\n\n return matvar;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1315,"sven_meta":{"func_name":"Mat_VarReadNextInfo4","file_name":"src/mat4.c","commit_link":"github.com/tbeu/matio/commit/651a8e28099edb5fbb9e4e1d4d3238848f446c9a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#13-aa76cf73cefb","input":"start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)\n{\n ppm_source_ptr source = (ppm_source_ptr)sinfo;\n int c;\n unsigned int w, h, maxval;\n boolean need_iobuffer, use_raw_buffer, need_rescale;\n\n if (getc(source->pub.input_file) != 'P')\n ERREXIT(cinfo, JERR_PPM_NOT);\n\n c = getc(source->pub.input_file); /* subformat discriminator character */\n\n /* detect unsupported variants (ie, PBM) before trying to read header */\n switch (c) {\n case '2': /* it's a text-format PGM file */\n case '3': /* it's a text-format PPM file */\n case '5': /* it's a raw-format PGM file */\n case '6': /* it's a raw-format PPM file */\n break;\n default:\n ERREXIT(cinfo, JERR_PPM_NOT);\n break;\n }\n\n /* fetch the remaining header info */\n w = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n h = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n maxval = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n\n if (w <= 0 || h <= 0 || maxval <= 0) /* error check */\n ERREXIT(cinfo, JERR_PPM_NOT);\n\n cinfo->data_precision = BITS_IN_JSAMPLE; /* we always rescale data to this */\n cinfo->image_width = (JDIMENSION)w;\n cinfo->image_height = (JDIMENSION)h;\n source->maxval = maxval;\n\n /* initialize flags to most common settings */\n need_iobuffer = TRUE; /* do we need an I/O buffer? */\n use_raw_buffer = FALSE; /* do we map input buffer onto I/O buffer? */\n need_rescale = TRUE; /* do we need a rescale array? */\n\n switch (c) {\n case '2': /* it's a text-format PGM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_GRAYSCALE;\n TRACEMS2(cinfo, 1, JTRC_PGM_TEXT, w, h);\n if (cinfo->in_color_space == JCS_GRAYSCALE)\n source->pub.get_pixel_rows = get_text_gray_row;\n else if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_text_gray_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_text_gray_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n need_iobuffer = FALSE;\n break;\n\n case '3': /* it's a text-format PPM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_EXT_RGB;\n TRACEMS2(cinfo, 1, JTRC_PPM_TEXT, w, h);\n if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_text_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_text_rgb_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n need_iobuffer = FALSE;\n break;\n\n case '5': /* it's a raw-format PGM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_GRAYSCALE;\n TRACEMS2(cinfo, 1, JTRC_PGM, w, h);\n if (maxval > 255) {\n source->pub.get_pixel_rows = get_word_gray_row;\n } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) &&\n cinfo->in_color_space == JCS_GRAYSCALE) {\n source->pub.get_pixel_rows = get_raw_row;\n use_raw_buffer = TRUE;\n need_rescale = FALSE;\n } else {\n if (cinfo->in_color_space == JCS_GRAYSCALE)\n source->pub.get_pixel_rows = get_scaled_gray_row;\n else if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_gray_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_gray_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n }\n break;\n\n case '6': /* it's a raw-format PPM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_EXT_RGB;\n TRACEMS2(cinfo, 1, JTRC_PPM, w, h);\n if (maxval > 255) {\n source->pub.get_pixel_rows = get_word_rgb_row;\n } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) &&\n (cinfo->in_color_space == JCS_EXT_RGB\n#if RGB_RED == 0 && RGB_GREEN == 1 && RGB_BLUE == 2 && RGB_PIXELSIZE == 3\n || cinfo->in_color_space == JCS_RGB\n#endif\n )) {\n source->pub.get_pixel_rows = get_raw_row;\n use_raw_buffer = TRUE;\n need_rescale = FALSE;\n } else {\n if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_rgb_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n }\n break;\n }\n\n if (IsExtRGB(cinfo->in_color_space))\n cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];\n else if (cinfo->in_color_space == JCS_GRAYSCALE)\n cinfo->input_components = 1;\n else if (cinfo->in_color_space == JCS_CMYK)\n cinfo->input_components = 4;\n\n /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */\n if (need_iobuffer) {\n if (c == '6')\n source->buffer_width = (size_t)w * 3 *\n ((maxval <= 255) ? sizeof(U_CHAR) : (2 * sizeof(U_CHAR)));\n else\n source->buffer_width = (size_t)w *\n ((maxval <= 255) ? sizeof(U_CHAR) : (2 * sizeof(U_CHAR)));\n source->iobuffer = (U_CHAR *)\n (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,\n source->buffer_width);\n }\n\n /* Create compressor input buffer. */\n if (use_raw_buffer) {\n /* For unscaled raw-input case, we can just map it onto the I/O buffer. */\n /* Synthesize a JSAMPARRAY pointer structure */\n source->pixrow = (JSAMPROW)source->iobuffer;\n source->pub.buffer = &source->pixrow;\n source->pub.buffer_height = 1;\n } else {\n /* Need to translate anyway, so make a separate sample buffer. */\n source->pub.buffer = (*cinfo->mem->alloc_sarray)\n ((j_common_ptr)cinfo, JPOOL_IMAGE,\n (JDIMENSION)w * cinfo->input_components, (JDIMENSION)1);\n source->pub.buffer_height = 1;\n }\n\n /* Compute the rescaling array if required. */\n if (need_rescale) {\n long val, half_maxval;\n\n /* On 16-bit-int machines we have to be careful of maxval = 65535 */\n source->rescale = (JSAMPLE *)\n (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,\n (size_t)(((long)maxval + 1L) *\n sizeof(JSAMPLE)));\n half_maxval = maxval / 2;\n for (val = 0; val <= (long)maxval; val++) {\n /* The multiplication here must be done in 32 bits to avoid overflow */\n source->rescale[val] = (JSAMPLE)((val * MAXJSAMPLE + half_maxval) /\n maxval);\n }\n }\n}","target":"start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)\n{\n ppm_source_ptr source = (ppm_source_ptr)sinfo;\n int c;\n unsigned int w, h, maxval;\n boolean need_iobuffer, use_raw_buffer, need_rescale;\n\n if (getc(source->pub.input_file) != 'P')\n ERREXIT(cinfo, JERR_PPM_NOT);\n\n c = getc(source->pub.input_file); /* subformat discriminator character */\n\n /* detect unsupported variants (ie, PBM) before trying to read header */\n switch (c) {\n case '2': /* it's a text-format PGM file */\n case '3': /* it's a text-format PPM file */\n case '5': /* it's a raw-format PGM file */\n case '6': /* it's a raw-format PPM file */\n break;\n default:\n ERREXIT(cinfo, JERR_PPM_NOT);\n break;\n }\n\n /* fetch the remaining header info */\n w = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n h = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n maxval = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n\n if (w <= 0 || h <= 0 || maxval <= 0) /* error check */\n ERREXIT(cinfo, JERR_PPM_NOT);\n\n cinfo->data_precision = BITS_IN_JSAMPLE; /* we always rescale data to this */\n cinfo->image_width = (JDIMENSION)w;\n cinfo->image_height = (JDIMENSION)h;\n source->maxval = maxval;\n\n /* initialize flags to most common settings */\n need_iobuffer = TRUE; /* do we need an I/O buffer? */\n use_raw_buffer = FALSE; /* do we map input buffer onto I/O buffer? */\n need_rescale = TRUE; /* do we need a rescale array? */\n\n switch (c) {\n case '2': /* it's a text-format PGM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_GRAYSCALE;\n TRACEMS2(cinfo, 1, JTRC_PGM_TEXT, w, h);\n if (cinfo->in_color_space == JCS_GRAYSCALE)\n source->pub.get_pixel_rows = get_text_gray_row;\n else if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_text_gray_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_text_gray_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n need_iobuffer = FALSE;\n break;\n\n case '3': /* it's a text-format PPM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_EXT_RGB;\n TRACEMS2(cinfo, 1, JTRC_PPM_TEXT, w, h);\n if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_text_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_text_rgb_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n need_iobuffer = FALSE;\n break;\n\n case '5': /* it's a raw-format PGM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_GRAYSCALE;\n TRACEMS2(cinfo, 1, JTRC_PGM, w, h);\n if (maxval > 255) {\n source->pub.get_pixel_rows = get_word_gray_row;\n } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) &&\n cinfo->in_color_space == JCS_GRAYSCALE) {\n source->pub.get_pixel_rows = get_raw_row;\n use_raw_buffer = TRUE;\n need_rescale = FALSE;\n } else {\n if (cinfo->in_color_space == JCS_GRAYSCALE)\n source->pub.get_pixel_rows = get_scaled_gray_row;\n else if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_gray_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_gray_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n }\n break;\n\n case '6': /* it's a raw-format PPM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_EXT_RGB;\n TRACEMS2(cinfo, 1, JTRC_PPM, w, h);\n if (maxval > 255) {\n source->pub.get_pixel_rows = get_word_rgb_row;\n } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) &&\n (cinfo->in_color_space == JCS_EXT_RGB\n#if RGB_RED == 0 && RGB_GREEN == 1 && RGB_BLUE == 2 && RGB_PIXELSIZE == 3\n || cinfo->in_color_space == JCS_RGB\n#endif\n )) {\n source->pub.get_pixel_rows = get_raw_row;\n use_raw_buffer = TRUE;\n need_rescale = FALSE;\n } else {\n if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_rgb_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n }\n break;\n }\n\n if (IsExtRGB(cinfo->in_color_space))\n cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];\n else if (cinfo->in_color_space == JCS_GRAYSCALE)\n cinfo->input_components = 1;\n else if (cinfo->in_color_space == JCS_CMYK)\n cinfo->input_components = 4;\n\n /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */\n if (need_iobuffer) {\n if (c == '6')\n source->buffer_width = (size_t)w * 3 *\n ((maxval <= 255) ? sizeof(U_CHAR) : (2 * sizeof(U_CHAR)));\n else\n source->buffer_width = (size_t)w *\n ((maxval <= 255) ? sizeof(U_CHAR) : (2 * sizeof(U_CHAR)));\n source->iobuffer = (U_CHAR *)\n (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,\n source->buffer_width);\n }\n\n /* Create compressor input buffer. */\n if (use_raw_buffer) {\n /* For unscaled raw-input case, we can just map it onto the I/O buffer. */\n /* Synthesize a JSAMPARRAY pointer structure */\n source->pixrow = (JSAMPROW)source->iobuffer;\n source->pub.buffer = &source->pixrow;\n source->pub.buffer_height = 1;\n } else {\n /* Need to translate anyway, so make a separate sample buffer. */\n source->pub.buffer = (*cinfo->mem->alloc_sarray)\n ((j_common_ptr)cinfo, JPOOL_IMAGE,\n (JDIMENSION)w * cinfo->input_components, (JDIMENSION)1);\n source->pub.buffer_height = 1;\n }\n\n /* Compute the rescaling array if required. */\n if (need_rescale) {\n long val, half_maxval;\n\n /* On 16-bit-int machines we have to be careful of maxval = 65535 */\n source->rescale = (JSAMPLE *)\n (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,\n (size_t)(((long)MAX(maxval, 255) + 1L) *\n sizeof(JSAMPLE)));\n half_maxval = maxval / 2;\n for (val = 0; val <= (long)maxval; val++) {\n /* The multiplication here must be done in 32 bits to avoid overflow */\n source->rescale[val] = (JSAMPLE)((val * MAXJSAMPLE + half_maxval) /\n maxval);\n }\n }\n}","lang":"c","vul_type":"cwe-125","target_token_count":1939,"sven_meta":{"func_name":"start_input_ppm","file_name":"rdppm.c","commit_link":"github.com/libjpeg-turbo/libjpeg-turbo/commit/3de15e0c344d11d4b90f4a47136467053eb2d09a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#14-c8cf11256c1b","input":"static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)\n{\n\tstruct usb_device *dev = chip->dev;\n\tstruct usb_host_interface *host_iface;\n\tstruct usb_interface_descriptor *altsd;\n\tvoid *control_header;\n\tint i, protocol;\n\n\t/* find audiocontrol interface */\n\thost_iface = &usb_ifnum_to_if(dev, ctrlif)->altsetting[0];\n\tcontrol_header = snd_usb_find_csint_desc(host_iface->extra,\n\t\t\t\t\t\t host_iface->extralen,\n\t\t\t\t\t\t NULL, UAC_HEADER);\n\taltsd = get_iface_desc(host_iface);\n\tprotocol = altsd->bInterfaceProtocol;\n\n\tif (!control_header) {\n\t\tdev_err(&dev->dev, \"cannot find UAC_HEADER\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\tswitch (protocol) {\n\tdefault:\n\t\tdev_warn(&dev->dev,\n\t\t\t \"unknown interface protocol %#02x, assuming v1\\n\",\n\t\t\t protocol);\n\t\t/* fall through */\n\n\tcase UAC_VERSION_1: {\n\t\tstruct uac1_ac_header_descriptor *h1 = control_header;\n\n\t\tif (!h1->bInCollection) {\n\t\t\tdev_info(&dev->dev, \"skipping empty audio interface (v1)\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tif (h1->bLength < sizeof(*h1) + h1->bInCollection) {\n\t\t\tdev_err(&dev->dev, \"invalid UAC_HEADER (v1)\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tfor (i = 0; i < h1->bInCollection; i++)\n\t\t\tsnd_usb_create_stream(chip, ctrlif, h1->baInterfaceNr[i]);\n\n\t\tbreak;\n\t}\n\n\tcase UAC_VERSION_2: {\n\t\tstruct usb_interface_assoc_descriptor *assoc =\n\t\t\tusb_ifnum_to_if(dev, ctrlif)->intf_assoc;\n\n\t\tif (!assoc) {\n\t\t\t/*\n\t\t\t * Firmware writers cannot count to three. So to find\n\t\t\t * the IAD on the NuForce UDH-100, also check the next\n\t\t\t * interface.\n\t\t\t */\n\t\t\tstruct usb_interface *iface =\n\t\t\t\tusb_ifnum_to_if(dev, ctrlif + 1);\n\t\t\tif (iface &&\n\t\t\t iface->intf_assoc &&\n\t\t\t iface->intf_assoc->bFunctionClass == USB_CLASS_AUDIO &&\n\t\t\t iface->intf_assoc->bFunctionProtocol == UAC_VERSION_2)\n\t\t\t\tassoc = iface->intf_assoc;\n\t\t}\n\n\t\tif (!assoc) {\n\t\t\tdev_err(&dev->dev, \"Audio class v2 interfaces need an interface association\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tfor (i = 0; i < assoc->bInterfaceCount; i++) {\n\t\t\tint intf = assoc->bFirstInterface + i;\n\n\t\t\tif (intf != ctrlif)\n\t\t\t\tsnd_usb_create_stream(chip, ctrlif, intf);\n\t\t}\n\n\t\tbreak;\n\t}\n\t}\n\n\treturn 0;\n}","target":"static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)\n{\n\tstruct usb_device *dev = chip->dev;\n\tstruct usb_host_interface *host_iface;\n\tstruct usb_interface_descriptor *altsd;\n\tvoid *control_header;\n\tint i, protocol;\n\tint rest_bytes;\n\n\t/* find audiocontrol interface */\n\thost_iface = &usb_ifnum_to_if(dev, ctrlif)->altsetting[0];\n\tcontrol_header = snd_usb_find_csint_desc(host_iface->extra,\n\t\t\t\t\t\t host_iface->extralen,\n\t\t\t\t\t\t NULL, UAC_HEADER);\n\taltsd = get_iface_desc(host_iface);\n\tprotocol = altsd->bInterfaceProtocol;\n\n\tif (!control_header) {\n\t\tdev_err(&dev->dev, \"cannot find UAC_HEADER\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\trest_bytes = (void *)(host_iface->extra + host_iface->extralen) -\n\t\tcontrol_header;\n\n\t/* just to be sure -- this shouldn't hit at all */\n\tif (rest_bytes <= 0) {\n\t\tdev_err(&dev->dev, \"invalid control header\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\tswitch (protocol) {\n\tdefault:\n\t\tdev_warn(&dev->dev,\n\t\t\t \"unknown interface protocol %#02x, assuming v1\\n\",\n\t\t\t protocol);\n\t\t/* fall through */\n\n\tcase UAC_VERSION_1: {\n\t\tstruct uac1_ac_header_descriptor *h1 = control_header;\n\n\t\tif (rest_bytes < sizeof(*h1)) {\n\t\t\tdev_err(&dev->dev, \"too short v1 buffer descriptor\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tif (!h1->bInCollection) {\n\t\t\tdev_info(&dev->dev, \"skipping empty audio interface (v1)\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tif (rest_bytes < h1->bLength) {\n\t\t\tdev_err(&dev->dev, \"invalid buffer length (v1)\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tif (h1->bLength < sizeof(*h1) + h1->bInCollection) {\n\t\t\tdev_err(&dev->dev, \"invalid UAC_HEADER (v1)\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tfor (i = 0; i < h1->bInCollection; i++)\n\t\t\tsnd_usb_create_stream(chip, ctrlif, h1->baInterfaceNr[i]);\n\n\t\tbreak;\n\t}\n\n\tcase UAC_VERSION_2: {\n\t\tstruct usb_interface_assoc_descriptor *assoc =\n\t\t\tusb_ifnum_to_if(dev, ctrlif)->intf_assoc;\n\n\t\tif (!assoc) {\n\t\t\t/*\n\t\t\t * Firmware writers cannot count to three. So to find\n\t\t\t * the IAD on the NuForce UDH-100, also check the next\n\t\t\t * interface.\n\t\t\t */\n\t\t\tstruct usb_interface *iface =\n\t\t\t\tusb_ifnum_to_if(dev, ctrlif + 1);\n\t\t\tif (iface &&\n\t\t\t iface->intf_assoc &&\n\t\t\t iface->intf_assoc->bFunctionClass == USB_CLASS_AUDIO &&\n\t\t\t iface->intf_assoc->bFunctionProtocol == UAC_VERSION_2)\n\t\t\t\tassoc = iface->intf_assoc;\n\t\t}\n\n\t\tif (!assoc) {\n\t\t\tdev_err(&dev->dev, \"Audio class v2 interfaces need an interface association\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tfor (i = 0; i < assoc->bInterfaceCount; i++) {\n\t\t\tint intf = assoc->bFirstInterface + i;\n\n\t\t\tif (intf != ctrlif)\n\t\t\t\tsnd_usb_create_stream(chip, ctrlif, intf);\n\t\t}\n\n\t\tbreak;\n\t}\n\t}\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":764,"sven_meta":{"func_name":"snd_usb_create_streams","file_name":"sound/usb/card.c","commit_link":"github.com/torvalds/linux/commit/bfc81a8bc18e3c4ba0cbaa7666ff76be2f998991","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#15-6aa903c5d2a7","input":"void process_packet_tail(struct msg_digest *md)\n{\n\tstruct state *st = md->st;\n\tenum state_kind from_state = md->v1_from_state;\n\tconst struct state_v1_microcode *smc = md->smc;\n\tbool new_iv_set = md->new_iv_set;\n\tbool self_delete = FALSE;\n\n\tif (md->hdr.isa_flags & ISAKMP_FLAGS_v1_ENCRYPTION) {\n\t\tendpoint_buf b;\n\t\tdbg(\"received encrypted packet from %s\", str_endpoint(&md->sender, &b));\n\n\t\tif (st == NULL) {\n\t\t\tlibreswan_log(\n\t\t\t\t\"discarding encrypted message for an unknown ISAKMP SA\");\n\t\t\treturn;\n\t\t}\n\t\tif (st->st_skeyid_e_nss == NULL) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\"discarding encrypted message because we haven't yet negotiated keying material\");\n\t\t\treturn;\n\t\t}\n\n\t\t/* Mark as encrypted */\n\t\tmd->encrypted = TRUE;\n\n\t\t/* do the specified decryption\n\t\t *\n\t\t * IV is from st->st_iv or (if new_iv_set) st->st_new_iv.\n\t\t * The new IV is placed in st->st_new_iv\n\t\t *\n\t\t * See RFC 2409 \"IKE\" Appendix B\n\t\t *\n\t\t * XXX The IV should only be updated really if the packet\n\t\t * is successfully processed.\n\t\t * We should keep this value, check for a success return\n\t\t * value from the parsing routines and then replace.\n\t\t *\n\t\t * Each post phase 1 exchange generates IVs from\n\t\t * the last phase 1 block, not the last block sent.\n\t\t */\n\t\tconst struct encrypt_desc *e = st->st_oakley.ta_encrypt;\n\n\t\tif (pbs_left(&md->message_pbs) % e->enc_blocksize != 0) {\n\t\t\tloglog(RC_LOG_SERIOUS, \"malformed message: not a multiple of encryption blocksize\");\n\t\t\treturn;\n\t\t}\n\n\t\t/* XXX Detect weak keys */\n\n\t\t/* grab a copy of raw packet (for duplicate packet detection) */\n\t\tmd->raw_packet = clone_bytes_as_chunk(md->packet_pbs.start,\n\t\t\t\t\t\t pbs_room(&md->packet_pbs),\n\t\t\t\t\t\t \"raw packet\");\n\n\t\t/* Decrypt everything after header */\n\t\tif (!new_iv_set) {\n\t\t\tif (st->st_v1_iv.len == 0) {\n\t\t\t\tinit_phase2_iv(st, &md->hdr.isa_msgid);\n\t\t\t} else {\n\t\t\t\t/* use old IV */\n\t\t\t\trestore_new_iv(st, st->st_v1_iv);\n\t\t\t}\n\t\t}\n\n\t\tpassert(st->st_v1_new_iv.len >= e->enc_blocksize);\n\t\tst->st_v1_new_iv.len = e->enc_blocksize; /* truncate */\n\n\t\tif (DBGP(DBG_CRYPT)) {\n\t\t\tDBG_log(\"decrypting %u bytes using algorithm %s\",\n\t\t\t\t(unsigned) pbs_left(&md->message_pbs),\n\t\t\t\tst->st_oakley.ta_encrypt->common.fqn);\n\t\t\tDBG_dump_hunk(\"IV before:\", st->st_v1_new_iv);\n\t\t}\n\t\te->encrypt_ops->do_crypt(e, md->message_pbs.cur,\n\t\t\t\t\t pbs_left(&md->message_pbs),\n\t\t\t\t\t st->st_enc_key_nss,\n\t\t\t\t\t st->st_v1_new_iv.ptr, FALSE);\n\t\tif (DBGP(DBG_CRYPT)) {\n\t\t\tDBG_dump_hunk(\"IV after:\", st->st_v1_new_iv);\n\t\t\tDBG_log(\"decrypted payload (starts at offset %td):\",\n\t\t\t\tmd->message_pbs.cur - md->message_pbs.roof);\n\t\t\tDBG_dump(NULL, md->message_pbs.start,\n\t\t\t\t md->message_pbs.roof - md->message_pbs.start);\n\t\t}\n\t} else {\n\t\t/* packet was not encryped -- should it have been? */\n\n\t\tif (smc->flags & SMF_INPUT_ENCRYPTED) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"packet rejected: should have been encrypted\");\n\t\t\tSEND_NOTIFICATION(INVALID_FLAGS);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/* Digest the message.\n\t * Padding must be removed to make hashing work.\n\t * Padding comes from encryption (so this code must be after decryption).\n\t * Padding rules are described before the definition of\n\t * struct isakmp_hdr in packet.h.\n\t */\n\t{\n\t\tenum next_payload_types_ikev1 np = md->hdr.isa_np;\n\t\tlset_t needed = smc->req_payloads;\n\t\tconst char *excuse =\n\t\t\tLIN(SMF_PSK_AUTH | SMF_FIRST_ENCRYPTED_INPUT,\n\t\t\t smc->flags) ?\n\t\t\t\"probable authentication failure (mismatch of preshared secrets?): \"\n\t\t\t:\n\t\t\t\"\";\n\n\t\twhile (np != ISAKMP_NEXT_NONE) {\n\t\t\tstruct_desc *sd = v1_payload_desc(np);\n\n\t\t\tif (md->digest_roof >= elemsof(md->digest)) {\n\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t \"more than %zu payloads in message; ignored\",\n\t\t\t\t elemsof(md->digest));\n\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstruct payload_digest *const pd = md->digest + md->digest_roof;\n\n\t\t\t/*\n\t\t\t * only do this in main mode. In aggressive mode, there\n\t\t\t * is no negotiation of NAT-T method. Get it right.\n\t\t\t */\n\t\t\tif (st != NULL && st->st_connection != NULL &&\n\t\t\t (st->st_connection->policy & POLICY_AGGRESSIVE) == LEMPTY)\n\t\t\t{\n\t\t\t\tswitch (np) {\n\t\t\t\tcase ISAKMP_NEXT_NATD_RFC:\n\t\t\t\tcase ISAKMP_NEXT_NATOA_RFC:\n\t\t\t\t\tif ((st->hidden_variables.st_nat_traversal & NAT_T_WITH_RFC_VALUES) == LEMPTY) {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * don't accept NAT-D/NAT-OA reloc directly in message,\n\t\t\t\t\t\t * unless we're using NAT-T RFC\n\t\t\t\t\t\t */\n\t\t\t\t\t\tDBG(DBG_NATT,\n\t\t\t\t\t\t DBG_log(\"st_nat_traversal was: %s\",\n\t\t\t\t\t\t\t bitnamesof(natt_bit_names,\n\t\t\t\t\t\t\t\t st->hidden_variables.st_nat_traversal)));\n\t\t\t\t\t\tsd = NULL;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (sd == NULL) {\n\t\t\t\t/* payload type is out of range or requires special handling */\n\t\t\t\tswitch (np) {\n\t\t\t\tcase ISAKMP_NEXT_ID:\n\t\t\t\t\t/* ??? two kinds of ID payloads */\n\t\t\t\t\tsd = (IS_PHASE1(from_state) ||\n\t\t\t\t\t IS_PHASE15(from_state)) ?\n\t\t\t\t\t\t&isakmp_identification_desc :\n\t\t\t\t\t\t&isakmp_ipsec_identification_desc;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_NATD_DRAFTS: /* out of range */\n\t\t\t\t\t/*\n\t\t\t\t\t * ISAKMP_NEXT_NATD_DRAFTS was a private use type before RFC-3947.\n\t\t\t\t\t * Since it has the same format as ISAKMP_NEXT_NATD_RFC,\n\t\t\t\t\t * just rewrite np and sd, and carry on.\n\t\t\t\t\t */\n\t\t\t\t\tnp = ISAKMP_NEXT_NATD_RFC;\n\t\t\t\t\tsd = &isakmp_nat_d_drafts;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_NATOA_DRAFTS: /* out of range */\n\t\t\t\t\t/* NAT-OA was a private use type before RFC-3947 -- same format */\n\t\t\t\t\tnp = ISAKMP_NEXT_NATOA_RFC;\n\t\t\t\t\tsd = &isakmp_nat_oa_drafts;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_SAK: /* or ISAKMP_NEXT_NATD_BADDRAFTS */\n\t\t\t\t\t/*\n\t\t\t\t\t * Official standards say that this is ISAKMP_NEXT_SAK,\n\t\t\t\t\t * a part of Group DOI, something we don't implement.\n\t\t\t\t\t * Old non-updated Cisco gear abused this number in ancient NAT drafts.\n\t\t\t\t\t * We ignore (rather than reject) this in support of people\n\t\t\t\t\t * with crufty Cisco machines.\n\t\t\t\t\t */\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage with unsupported payload ISAKMP_NEXT_SAK (or ISAKMP_NEXT_NATD_BADDRAFTS) ignored\",\n\t\t\t\t\t\texcuse);\n\t\t\t\t\t/*\n\t\t\t\t\t * Hack to discard payload, whatever it was.\n\t\t\t\t\t * Since we are skipping the rest of the loop\n\t\t\t\t\t * body we must do some things ourself:\n\t\t\t\t\t * - demarshall the payload\n\t\t\t\t\t * - grab the next payload number (np)\n\t\t\t\t\t * - don't keep payload (don't increment pd)\n\t\t\t\t\t * - skip rest of loop body\n\t\t\t\t\t */\n\t\t\t\t\tif (!in_struct(&pd->payload, &isakmp_ignore_desc, &md->message_pbs,\n\t\t\t\t\t\t &pd->pbs)) {\n\t\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t \"%smalformed payload in packet\",\n\t\t\t\t\t\t excuse);\n\t\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tnp = pd->payload.generic.isag_np;\n\t\t\t\t\t/* NOTE: we do not increment pd! */\n\t\t\t\t\tcontinue; /* skip rest of the loop */\n\n\t\t\t\tdefault:\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage ignored because it contains an unknown or unexpected payload type (%s) at the outermost level\",\n\t\t\t\t\t excuse,\n\t\t\t\t\t enum_show(&ikev1_payload_names, np));\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(INVALID_PAYLOAD_TYPE);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpassert(sd != NULL);\n\t\t\t}\n\n\t\t\tpassert(np < LELEM_ROOF);\n\n\t\t\t{\n\t\t\t\tlset_t s = LELEM(np);\n\n\t\t\t\tif (LDISJOINT(s,\n\t\t\t\t\t needed | smc->opt_payloads |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_VID) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_N) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_D) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_CR) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_CERT))) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage ignored because it contains a payload type (%s) unexpected by state %s\",\n\t\t\t\t\t\texcuse,\n\t\t\t\t\t\tenum_show(&ikev1_payload_names, np),\n\t\t\t\t\t\tst->st_state->name);\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(INVALID_PAYLOAD_TYPE);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tDBG(DBG_PARSING,\n\t\t\t\t DBG_log(\"got payload 0x%\" PRIxLSET\" (%s) needed: 0x%\" PRIxLSET \" opt: 0x%\" PRIxLSET,\n\t\t\t\t\t s, enum_show(&ikev1_payload_names, np),\n\t\t\t\t\t needed, smc->opt_payloads));\n\t\t\t\tneeded &= ~s;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Read in the payload recording what type it\n\t\t\t * should be\n\t\t\t */\n\t\t\tpd->payload_type = np;\n\t\t\tif (!in_struct(&pd->payload, sd, &md->message_pbs,\n\t\t\t\t &pd->pbs)) {\n\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t \"%smalformed payload in packet\",\n\t\t\t\t excuse);\n\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t/* do payload-type specific debugging */\n\t\t\tswitch (np) {\n\t\t\tcase ISAKMP_NEXT_ID:\n\t\t\tcase ISAKMP_NEXT_NATOA_RFC:\n\t\t\t\t/* dump ID section */\n\t\t\t\tDBG(DBG_PARSING,\n\t\t\t\t DBG_dump(\" obj: \", pd->pbs.cur,\n\t\t\t\t\t pbs_left(&pd->pbs)));\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\t/*\n\t\t\t * Place payload at the end of the chain for this type.\n\t\t\t * This code appears in ikev1.c and ikev2.c.\n\t\t\t */\n\t\t\t{\n\t\t\t\t/* np is a proper subscript for chain[] */\n\t\t\t\tpassert(np < elemsof(md->chain));\n\t\t\t\tstruct payload_digest **p = &md->chain[np];\n\n\t\t\t\twhile (*p != NULL)\n\t\t\t\t\tp = &(*p)->next;\n\t\t\t\t*p = pd;\n\t\t\t\tpd->next = NULL;\n\t\t\t}\n\n\t\t\tnp = pd->payload.generic.isag_np;\n\t\t\tmd->digest_roof++;\n\n\t\t\t/* since we've digested one payload happily, it is probably\n\t\t\t * the case that any decryption worked. So we will not suggest\n\t\t\t * encryption failure as an excuse for subsequent payload\n\t\t\t * problems.\n\t\t\t */\n\t\t\texcuse = \"\";\n\t\t}\n\n\t\tDBG(DBG_PARSING, {\n\t\t\t if (pbs_left(&md->message_pbs) != 0)\n\t\t\t\t DBG_log(\"removing %d bytes of padding\",\n\t\t\t\t\t (int) pbs_left(&md->message_pbs));\n\t\t });\n\n\t\tmd->message_pbs.roof = md->message_pbs.cur;\n\n\t\t/* check that all mandatory payloads appeared */\n\n\t\tif (needed != 0) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"message for %s is missing payloads %s\",\n\t\t\t finite_states[from_state]->name,\n\t\t\t bitnamesof(payload_name_ikev1, needed));\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (!check_v1_HASH(smc->hash_type, smc->message, st, md)) {\n\t\t/*SEND_NOTIFICATION(INVALID_HASH_INFORMATION);*/\n\t\treturn;\n\t}\n\n\t/* more sanity checking: enforce most ordering constraints */\n\n\tif (IS_PHASE1(from_state) || IS_PHASE15(from_state)) {\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5 Exchanges:\n\t\t * \"The SA payload MUST precede all other payloads in a phase 1 exchange.\"\n\t\t */\n\t\tif (md->chain[ISAKMP_NEXT_SA] != NULL &&\n\t\t md->hdr.isa_np != ISAKMP_NEXT_SA) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"malformed Phase 1 message: does not start with an SA payload\");\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t} else if (IS_QUICK(from_state)) {\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5.5 Phase 2 - Quick Mode\n\t\t *\n\t\t * \"In Quick Mode, a HASH payload MUST immediately follow the ISAKMP\n\t\t * header and a SA payload MUST immediately follow the HASH.\"\n\t\t * [NOTE: there may be more than one SA payload, so this is not\n\t\t * totally reasonable. Probably all SAs should be so constrained.]\n\t\t *\n\t\t * \"If ISAKMP is acting as a client negotiator on behalf of another\n\t\t * party, the identities of the parties MUST be passed as IDci and\n\t\t * then IDcr.\"\n\t\t *\n\t\t * \"With the exception of the HASH, SA, and the optional ID payloads,\n\t\t * there are no payload ordering restrictions on Quick Mode.\"\n\t\t */\n\n\t\tif (md->hdr.isa_np != ISAKMP_NEXT_HASH) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"malformed Quick Mode message: does not start with a HASH payload\");\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t{\n\t\t\tstruct payload_digest *p;\n\t\t\tint i;\n\n\t\t\tp = md->chain[ISAKMP_NEXT_SA];\n\t\t\ti = 1;\n\t\t\twhile (p != NULL) {\n\t\t\t\tif (p != &md->digest[i]) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t \"malformed Quick Mode message: SA payload is in wrong position\");\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tp = p->next;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5.5 Phase 2 - Quick Mode:\n\t\t * \"If ISAKMP is acting as a client negotiator on behalf of another\n\t\t * party, the identities of the parties MUST be passed as IDci and\n\t\t * then IDcr.\"\n\t\t */\n\t\t{\n\t\t\tstruct payload_digest *id = md->chain[ISAKMP_NEXT_ID];\n\n\t\t\tif (id != NULL) {\n\t\t\t\tif (id->next == NULL ||\n\t\t\t\t id->next->next != NULL) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"malformed Quick Mode message: if any ID payload is present, there must be exactly two\");\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (id + 1 != id->next) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"malformed Quick Mode message: the ID payloads are not adjacent\");\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Ignore payloads that we don't handle:\n\t */\n\t/* XXX Handle Notifications */\n\t{\n\t\tstruct payload_digest *p = md->chain[ISAKMP_NEXT_N];\n\n\t\twhile (p != NULL) {\n\t\t\tswitch (p->payload.notification.isan_type) {\n\t\t\tcase R_U_THERE:\n\t\t\tcase R_U_THERE_ACK:\n\t\t\tcase ISAKMP_N_CISCO_LOAD_BALANCE:\n\t\t\tcase PAYLOAD_MALFORMED:\n\t\t\tcase INVALID_MESSAGE_ID:\n\t\t\tcase IPSEC_RESPONDER_LIFETIME:\n\t\t\t\tif (md->hdr.isa_xchg == ISAKMP_XCHG_INFO) {\n\t\t\t\t\t/* these are handled later on in informational() */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t/* FALL THROUGH */\n\t\t\tdefault:\n\t\t\t\tif (st == NULL) {\n\t\t\t\t\tDBG(DBG_CONTROL, DBG_log(\n\t\t\t\t\t \"ignoring informational payload %s, no corresponding state\",\n\t\t\t\t\t enum_show(& ikev1_notify_names,\n\t\t\t\t\t\t\t p->payload.notification.isan_type)));\n\t\t\t\t} else {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t \"ignoring informational payload %s, msgid=%08\" PRIx32 \", length=%d\",\n\t\t\t\t\t enum_show(&ikev1_notify_names,\n\t\t\t\t\t\t\t p->payload.notification.isan_type),\n\t\t\t\t\t st->st_v1_msgid.id,\n\t\t\t\t\t p->payload.notification.isan_length);\n\t\t\t\t\tDBG_dump_pbs(&p->pbs);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (DBGP(DBG_BASE)) {\n\t\t\t\tDBG_dump(\"info:\", p->pbs.cur,\n\t\t\t\t\t pbs_left(&p->pbs));\n\t\t\t}\n\n\t\t\tp = p->next;\n\t\t}\n\n\t\tp = md->chain[ISAKMP_NEXT_D];\n\t\twhile (p != NULL) {\n\t\t\tself_delete |= accept_delete(md, p);\n\t\t\tif (DBGP(DBG_BASE)) {\n\t\t\t\tDBG_dump(\"del:\", p->pbs.cur,\n\t\t\t\t\t pbs_left(&p->pbs));\n\t\t\t}\n\t\t\tif (md->st != st) {\n\t\t\t\tpexpect(md->st == NULL);\n\t\t\t\tdbg(\"zapping ST as accept_delete() zapped MD.ST\");\n\t\t\t\tst = md->st;\n\t\t\t}\n\t\t\tp = p->next;\n\t\t}\n\n\t\tp = md->chain[ISAKMP_NEXT_VID];\n\t\twhile (p != NULL) {\n\t\t\thandle_vendorid(md, (char *)p->pbs.cur,\n\t\t\t\t\tpbs_left(&p->pbs), FALSE);\n\t\t\tp = p->next;\n\t\t}\n\t}\n\n\tif (self_delete) {\n\t\taccept_self_delete(md);\n\t\tst = md->st;\n\t\t/* note: st ought to be NULL from here on */\n\t}\n\n\tpexpect(st == md->st);\n\tstatetime_t start = statetime_start(md->st);\n\t/*\n\t * XXX: danger - the .informational() processor deletes ST;\n\t * and then tunnels this loss through MD.ST.\n\t */\n\tcomplete_v1_state_transition(md, smc->processor(st, md));\n\tstatetime_stop(&start, \"%s()\", __func__);\n\t/* our caller will release_any_md(mdp); */\n}","target":"void process_packet_tail(struct msg_digest *md)\n{\n\tstruct state *st = md->st;\n\tenum state_kind from_state = md->v1_from_state;\n\tconst struct state_v1_microcode *smc = md->smc;\n\tbool new_iv_set = md->new_iv_set;\n\tbool self_delete = FALSE;\n\n\tif (md->hdr.isa_flags & ISAKMP_FLAGS_v1_ENCRYPTION) {\n\t\tendpoint_buf b;\n\t\tdbg(\"received encrypted packet from %s\", str_endpoint(&md->sender, &b));\n\n\t\tif (st == NULL) {\n\t\t\tlibreswan_log(\n\t\t\t\t\"discarding encrypted message for an unknown ISAKMP SA\");\n\t\t\treturn;\n\t\t}\n\t\tif (st->st_skeyid_e_nss == NULL) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\"discarding encrypted message because we haven't yet negotiated keying material\");\n\t\t\treturn;\n\t\t}\n\n\t\t/* Mark as encrypted */\n\t\tmd->encrypted = TRUE;\n\n\t\t/* do the specified decryption\n\t\t *\n\t\t * IV is from st->st_iv or (if new_iv_set) st->st_new_iv.\n\t\t * The new IV is placed in st->st_new_iv\n\t\t *\n\t\t * See RFC 2409 \"IKE\" Appendix B\n\t\t *\n\t\t * XXX The IV should only be updated really if the packet\n\t\t * is successfully processed.\n\t\t * We should keep this value, check for a success return\n\t\t * value from the parsing routines and then replace.\n\t\t *\n\t\t * Each post phase 1 exchange generates IVs from\n\t\t * the last phase 1 block, not the last block sent.\n\t\t */\n\t\tconst struct encrypt_desc *e = st->st_oakley.ta_encrypt;\n\n\t\tif (pbs_left(&md->message_pbs) % e->enc_blocksize != 0) {\n\t\t\tloglog(RC_LOG_SERIOUS, \"malformed message: not a multiple of encryption blocksize\");\n\t\t\treturn;\n\t\t}\n\n\t\t/* XXX Detect weak keys */\n\n\t\t/* grab a copy of raw packet (for duplicate packet detection) */\n\t\tmd->raw_packet = clone_bytes_as_chunk(md->packet_pbs.start,\n\t\t\t\t\t\t pbs_room(&md->packet_pbs),\n\t\t\t\t\t\t \"raw packet\");\n\n\t\t/* Decrypt everything after header */\n\t\tif (!new_iv_set) {\n\t\t\tif (st->st_v1_iv.len == 0) {\n\t\t\t\tinit_phase2_iv(st, &md->hdr.isa_msgid);\n\t\t\t} else {\n\t\t\t\t/* use old IV */\n\t\t\t\trestore_new_iv(st, st->st_v1_iv);\n\t\t\t}\n\t\t}\n\n\t\tpassert(st->st_v1_new_iv.len >= e->enc_blocksize);\n\t\tst->st_v1_new_iv.len = e->enc_blocksize; /* truncate */\n\n\t\tif (DBGP(DBG_CRYPT)) {\n\t\t\tDBG_log(\"decrypting %u bytes using algorithm %s\",\n\t\t\t\t(unsigned) pbs_left(&md->message_pbs),\n\t\t\t\tst->st_oakley.ta_encrypt->common.fqn);\n\t\t\tDBG_dump_hunk(\"IV before:\", st->st_v1_new_iv);\n\t\t}\n\t\te->encrypt_ops->do_crypt(e, md->message_pbs.cur,\n\t\t\t\t\t pbs_left(&md->message_pbs),\n\t\t\t\t\t st->st_enc_key_nss,\n\t\t\t\t\t st->st_v1_new_iv.ptr, FALSE);\n\t\tif (DBGP(DBG_CRYPT)) {\n\t\t\tDBG_dump_hunk(\"IV after:\", st->st_v1_new_iv);\n\t\t\tDBG_log(\"decrypted payload (starts at offset %td):\",\n\t\t\t\tmd->message_pbs.cur - md->message_pbs.roof);\n\t\t\tDBG_dump(NULL, md->message_pbs.start,\n\t\t\t\t md->message_pbs.roof - md->message_pbs.start);\n\t\t}\n\t} else {\n\t\t/* packet was not encryped -- should it have been? */\n\n\t\tif (smc->flags & SMF_INPUT_ENCRYPTED) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"packet rejected: should have been encrypted\");\n\t\t\tSEND_NOTIFICATION(INVALID_FLAGS);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/* Digest the message.\n\t * Padding must be removed to make hashing work.\n\t * Padding comes from encryption (so this code must be after decryption).\n\t * Padding rules are described before the definition of\n\t * struct isakmp_hdr in packet.h.\n\t */\n\t{\n\t\tenum next_payload_types_ikev1 np = md->hdr.isa_np;\n\t\tlset_t needed = smc->req_payloads;\n\t\tconst char *excuse =\n\t\t\tLIN(SMF_PSK_AUTH | SMF_FIRST_ENCRYPTED_INPUT,\n\t\t\t smc->flags) ?\n\t\t\t\"probable authentication failure (mismatch of preshared secrets?): \"\n\t\t\t:\n\t\t\t\"\";\n\n\t\twhile (np != ISAKMP_NEXT_NONE) {\n\t\t\tstruct_desc *sd = v1_payload_desc(np);\n\n\t\t\tif (md->digest_roof >= elemsof(md->digest)) {\n\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t \"more than %zu payloads in message; ignored\",\n\t\t\t\t elemsof(md->digest));\n\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstruct payload_digest *const pd = md->digest + md->digest_roof;\n\n\t\t\t/*\n\t\t\t * only do this in main mode. In aggressive mode, there\n\t\t\t * is no negotiation of NAT-T method. Get it right.\n\t\t\t */\n\t\t\tif (st != NULL && st->st_connection != NULL &&\n\t\t\t (st->st_connection->policy & POLICY_AGGRESSIVE) == LEMPTY)\n\t\t\t{\n\t\t\t\tswitch (np) {\n\t\t\t\tcase ISAKMP_NEXT_NATD_RFC:\n\t\t\t\tcase ISAKMP_NEXT_NATOA_RFC:\n\t\t\t\t\tif ((st->hidden_variables.st_nat_traversal & NAT_T_WITH_RFC_VALUES) == LEMPTY) {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * don't accept NAT-D/NAT-OA reloc directly in message,\n\t\t\t\t\t\t * unless we're using NAT-T RFC\n\t\t\t\t\t\t */\n\t\t\t\t\t\tDBG(DBG_NATT,\n\t\t\t\t\t\t DBG_log(\"st_nat_traversal was: %s\",\n\t\t\t\t\t\t\t bitnamesof(natt_bit_names,\n\t\t\t\t\t\t\t\t st->hidden_variables.st_nat_traversal)));\n\t\t\t\t\t\tsd = NULL;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (sd == NULL) {\n\t\t\t\t/* payload type is out of range or requires special handling */\n\t\t\t\tswitch (np) {\n\t\t\t\tcase ISAKMP_NEXT_ID:\n\t\t\t\t\t/* ??? two kinds of ID payloads */\n\t\t\t\t\tsd = (IS_PHASE1(from_state) ||\n\t\t\t\t\t IS_PHASE15(from_state)) ?\n\t\t\t\t\t\t&isakmp_identification_desc :\n\t\t\t\t\t\t&isakmp_ipsec_identification_desc;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_NATD_DRAFTS: /* out of range */\n\t\t\t\t\t/*\n\t\t\t\t\t * ISAKMP_NEXT_NATD_DRAFTS was a private use type before RFC-3947.\n\t\t\t\t\t * Since it has the same format as ISAKMP_NEXT_NATD_RFC,\n\t\t\t\t\t * just rewrite np and sd, and carry on.\n\t\t\t\t\t */\n\t\t\t\t\tnp = ISAKMP_NEXT_NATD_RFC;\n\t\t\t\t\tsd = &isakmp_nat_d_drafts;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_NATOA_DRAFTS: /* out of range */\n\t\t\t\t\t/* NAT-OA was a private use type before RFC-3947 -- same format */\n\t\t\t\t\tnp = ISAKMP_NEXT_NATOA_RFC;\n\t\t\t\t\tsd = &isakmp_nat_oa_drafts;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_SAK: /* or ISAKMP_NEXT_NATD_BADDRAFTS */\n\t\t\t\t\t/*\n\t\t\t\t\t * Official standards say that this is ISAKMP_NEXT_SAK,\n\t\t\t\t\t * a part of Group DOI, something we don't implement.\n\t\t\t\t\t * Old non-updated Cisco gear abused this number in ancient NAT drafts.\n\t\t\t\t\t * We ignore (rather than reject) this in support of people\n\t\t\t\t\t * with crufty Cisco machines.\n\t\t\t\t\t */\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage with unsupported payload ISAKMP_NEXT_SAK (or ISAKMP_NEXT_NATD_BADDRAFTS) ignored\",\n\t\t\t\t\t\texcuse);\n\t\t\t\t\t/*\n\t\t\t\t\t * Hack to discard payload, whatever it was.\n\t\t\t\t\t * Since we are skipping the rest of the loop\n\t\t\t\t\t * body we must do some things ourself:\n\t\t\t\t\t * - demarshall the payload\n\t\t\t\t\t * - grab the next payload number (np)\n\t\t\t\t\t * - don't keep payload (don't increment pd)\n\t\t\t\t\t * - skip rest of loop body\n\t\t\t\t\t */\n\t\t\t\t\tif (!in_struct(&pd->payload, &isakmp_ignore_desc, &md->message_pbs,\n\t\t\t\t\t\t &pd->pbs)) {\n\t\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t \"%smalformed payload in packet\",\n\t\t\t\t\t\t excuse);\n\t\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tnp = pd->payload.generic.isag_np;\n\t\t\t\t\t/* NOTE: we do not increment pd! */\n\t\t\t\t\tcontinue; /* skip rest of the loop */\n\n\t\t\t\tdefault:\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage ignored because it contains an unknown or unexpected payload type (%s) at the outermost level\",\n\t\t\t\t\t excuse,\n\t\t\t\t\t enum_show(&ikev1_payload_names, np));\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(INVALID_PAYLOAD_TYPE);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpassert(sd != NULL);\n\t\t\t}\n\n\t\t\tpassert(np < LELEM_ROOF);\n\n\t\t\t{\n\t\t\t\tlset_t s = LELEM(np);\n\n\t\t\t\tif (LDISJOINT(s,\n\t\t\t\t\t needed | smc->opt_payloads |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_VID) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_N) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_D) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_CR) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_CERT))) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage ignored because it contains a payload type (%s) unexpected by state %s\",\n\t\t\t\t\t\texcuse,\n\t\t\t\t\t\tenum_show(&ikev1_payload_names, np),\n\t\t\t\t\t\tfinite_states[smc->state]->name);\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(INVALID_PAYLOAD_TYPE);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tDBG(DBG_PARSING,\n\t\t\t\t DBG_log(\"got payload 0x%\" PRIxLSET\" (%s) needed: 0x%\" PRIxLSET \" opt: 0x%\" PRIxLSET,\n\t\t\t\t\t s, enum_show(&ikev1_payload_names, np),\n\t\t\t\t\t needed, smc->opt_payloads));\n\t\t\t\tneeded &= ~s;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Read in the payload recording what type it\n\t\t\t * should be\n\t\t\t */\n\t\t\tpd->payload_type = np;\n\t\t\tif (!in_struct(&pd->payload, sd, &md->message_pbs,\n\t\t\t\t &pd->pbs)) {\n\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t \"%smalformed payload in packet\",\n\t\t\t\t excuse);\n\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t/* do payload-type specific debugging */\n\t\t\tswitch (np) {\n\t\t\tcase ISAKMP_NEXT_ID:\n\t\t\tcase ISAKMP_NEXT_NATOA_RFC:\n\t\t\t\t/* dump ID section */\n\t\t\t\tDBG(DBG_PARSING,\n\t\t\t\t DBG_dump(\" obj: \", pd->pbs.cur,\n\t\t\t\t\t pbs_left(&pd->pbs)));\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\t/*\n\t\t\t * Place payload at the end of the chain for this type.\n\t\t\t * This code appears in ikev1.c and ikev2.c.\n\t\t\t */\n\t\t\t{\n\t\t\t\t/* np is a proper subscript for chain[] */\n\t\t\t\tpassert(np < elemsof(md->chain));\n\t\t\t\tstruct payload_digest **p = &md->chain[np];\n\n\t\t\t\twhile (*p != NULL)\n\t\t\t\t\tp = &(*p)->next;\n\t\t\t\t*p = pd;\n\t\t\t\tpd->next = NULL;\n\t\t\t}\n\n\t\t\tnp = pd->payload.generic.isag_np;\n\t\t\tmd->digest_roof++;\n\n\t\t\t/* since we've digested one payload happily, it is probably\n\t\t\t * the case that any decryption worked. So we will not suggest\n\t\t\t * encryption failure as an excuse for subsequent payload\n\t\t\t * problems.\n\t\t\t */\n\t\t\texcuse = \"\";\n\t\t}\n\n\t\tDBG(DBG_PARSING, {\n\t\t\t if (pbs_left(&md->message_pbs) != 0)\n\t\t\t\t DBG_log(\"removing %d bytes of padding\",\n\t\t\t\t\t (int) pbs_left(&md->message_pbs));\n\t\t });\n\n\t\tmd->message_pbs.roof = md->message_pbs.cur;\n\n\t\t/* check that all mandatory payloads appeared */\n\n\t\tif (needed != 0) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"message for %s is missing payloads %s\",\n\t\t\t finite_states[from_state]->name,\n\t\t\t bitnamesof(payload_name_ikev1, needed));\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (!check_v1_HASH(smc->hash_type, smc->message, st, md)) {\n\t\t/*SEND_NOTIFICATION(INVALID_HASH_INFORMATION);*/\n\t\treturn;\n\t}\n\n\t/* more sanity checking: enforce most ordering constraints */\n\n\tif (IS_PHASE1(from_state) || IS_PHASE15(from_state)) {\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5 Exchanges:\n\t\t * \"The SA payload MUST precede all other payloads in a phase 1 exchange.\"\n\t\t */\n\t\tif (md->chain[ISAKMP_NEXT_SA] != NULL &&\n\t\t md->hdr.isa_np != ISAKMP_NEXT_SA) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"malformed Phase 1 message: does not start with an SA payload\");\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t} else if (IS_QUICK(from_state)) {\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5.5 Phase 2 - Quick Mode\n\t\t *\n\t\t * \"In Quick Mode, a HASH payload MUST immediately follow the ISAKMP\n\t\t * header and a SA payload MUST immediately follow the HASH.\"\n\t\t * [NOTE: there may be more than one SA payload, so this is not\n\t\t * totally reasonable. Probably all SAs should be so constrained.]\n\t\t *\n\t\t * \"If ISAKMP is acting as a client negotiator on behalf of another\n\t\t * party, the identities of the parties MUST be passed as IDci and\n\t\t * then IDcr.\"\n\t\t *\n\t\t * \"With the exception of the HASH, SA, and the optional ID payloads,\n\t\t * there are no payload ordering restrictions on Quick Mode.\"\n\t\t */\n\n\t\tif (md->hdr.isa_np != ISAKMP_NEXT_HASH) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"malformed Quick Mode message: does not start with a HASH payload\");\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t{\n\t\t\tstruct payload_digest *p;\n\t\t\tint i;\n\n\t\t\tp = md->chain[ISAKMP_NEXT_SA];\n\t\t\ti = 1;\n\t\t\twhile (p != NULL) {\n\t\t\t\tif (p != &md->digest[i]) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t \"malformed Quick Mode message: SA payload is in wrong position\");\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tp = p->next;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5.5 Phase 2 - Quick Mode:\n\t\t * \"If ISAKMP is acting as a client negotiator on behalf of another\n\t\t * party, the identities of the parties MUST be passed as IDci and\n\t\t * then IDcr.\"\n\t\t */\n\t\t{\n\t\t\tstruct payload_digest *id = md->chain[ISAKMP_NEXT_ID];\n\n\t\t\tif (id != NULL) {\n\t\t\t\tif (id->next == NULL ||\n\t\t\t\t id->next->next != NULL) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"malformed Quick Mode message: if any ID payload is present, there must be exactly two\");\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (id + 1 != id->next) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"malformed Quick Mode message: the ID payloads are not adjacent\");\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Ignore payloads that we don't handle:\n\t */\n\t/* XXX Handle Notifications */\n\t{\n\t\tstruct payload_digest *p = md->chain[ISAKMP_NEXT_N];\n\n\t\twhile (p != NULL) {\n\t\t\tswitch (p->payload.notification.isan_type) {\n\t\t\tcase R_U_THERE:\n\t\t\tcase R_U_THERE_ACK:\n\t\t\tcase ISAKMP_N_CISCO_LOAD_BALANCE:\n\t\t\tcase PAYLOAD_MALFORMED:\n\t\t\tcase INVALID_MESSAGE_ID:\n\t\t\tcase IPSEC_RESPONDER_LIFETIME:\n\t\t\t\tif (md->hdr.isa_xchg == ISAKMP_XCHG_INFO) {\n\t\t\t\t\t/* these are handled later on in informational() */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t/* FALL THROUGH */\n\t\t\tdefault:\n\t\t\t\tif (st == NULL) {\n\t\t\t\t\tDBG(DBG_CONTROL, DBG_log(\n\t\t\t\t\t \"ignoring informational payload %s, no corresponding state\",\n\t\t\t\t\t enum_show(& ikev1_notify_names,\n\t\t\t\t\t\t\t p->payload.notification.isan_type)));\n\t\t\t\t} else {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t \"ignoring informational payload %s, msgid=%08\" PRIx32 \", length=%d\",\n\t\t\t\t\t enum_show(&ikev1_notify_names,\n\t\t\t\t\t\t\t p->payload.notification.isan_type),\n\t\t\t\t\t st->st_v1_msgid.id,\n\t\t\t\t\t p->payload.notification.isan_length);\n\t\t\t\t\tDBG_dump_pbs(&p->pbs);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (DBGP(DBG_BASE)) {\n\t\t\t\tDBG_dump(\"info:\", p->pbs.cur,\n\t\t\t\t\t pbs_left(&p->pbs));\n\t\t\t}\n\n\t\t\tp = p->next;\n\t\t}\n\n\t\tp = md->chain[ISAKMP_NEXT_D];\n\t\twhile (p != NULL) {\n\t\t\tself_delete |= accept_delete(md, p);\n\t\t\tif (DBGP(DBG_BASE)) {\n\t\t\t\tDBG_dump(\"del:\", p->pbs.cur,\n\t\t\t\t\t pbs_left(&p->pbs));\n\t\t\t}\n\t\t\tif (md->st != st) {\n\t\t\t\tpexpect(md->st == NULL);\n\t\t\t\tdbg(\"zapping ST as accept_delete() zapped MD.ST\");\n\t\t\t\tst = md->st;\n\t\t\t}\n\t\t\tp = p->next;\n\t\t}\n\n\t\tp = md->chain[ISAKMP_NEXT_VID];\n\t\twhile (p != NULL) {\n\t\t\thandle_vendorid(md, (char *)p->pbs.cur,\n\t\t\t\t\tpbs_left(&p->pbs), FALSE);\n\t\t\tp = p->next;\n\t\t}\n\t}\n\n\tif (self_delete) {\n\t\taccept_self_delete(md);\n\t\tst = md->st;\n\t\t/* note: st ought to be NULL from here on */\n\t}\n\n\tpexpect(st == md->st);\n\tstatetime_t start = statetime_start(md->st);\n\t/*\n\t * XXX: danger - the .informational() processor deletes ST;\n\t * and then tunnels this loss through MD.ST.\n\t */\n\tcomplete_v1_state_transition(md, smc->processor(st, md));\n\tstatetime_stop(&start, \"%s()\", __func__);\n\t/* our caller will release_any_md(mdp); */\n}","lang":"c","vul_type":"cwe-125","target_token_count":4306,"sven_meta":{"func_name":"process_packet_tail","file_name":"programs/pluto/ikev1.c","commit_link":"github.com/libreswan/libreswan/commit/471a3e41a449d7c753bc4edbba4239501bb62ba8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#16-8374bd40e0c6","input":"std::vector CSoundFile::GetLength(enmGetLengthResetMode adjustMode, GetLengthTarget target)\n{\n\tstd::vector results;\n\tGetLengthType retval;\n\tretval.startOrder = target.startOrder;\n\tretval.startRow = target.startRow;\n\n\t// Are we trying to reach a certain pattern position?\n\tconst bool hasSearchTarget = target.mode != GetLengthTarget::NoTarget;\n\tconst bool adjustSamplePos = (adjustMode & eAdjustSamplePositions) == eAdjustSamplePositions;\n\n\tSEQUENCEINDEX sequence = target.sequence;\n\tif(sequence >= Order.GetNumSequences()) sequence = Order.GetCurrentSequenceIndex();\n\tconst ModSequence &orderList = Order(sequence);\n\n\tGetLengthMemory memory(*this);\n\tCSoundFile::PlayState &playState = *memory.state;\n\t// Temporary visited rows vector (so that GetLength() won't interfere with the player code if the module is playing at the same time)\n\tRowVisitor visitedRows(*this, sequence);\n\n\tplayState.m_nNextRow = playState.m_nRow = target.startRow;\n\tplayState.m_nNextOrder = playState.m_nCurrentOrder = target.startOrder;\n\n\t// Fast LUTs for commands that are too weird / complicated / whatever to emulate in sample position adjust mode.\n\tstd::bitset forbiddenCommands;\n\tstd::bitset forbiddenVolCommands;\n\n\tif(adjustSamplePos)\n\t{\n\t\tforbiddenCommands.set(CMD_ARPEGGIO); forbiddenCommands.set(CMD_PORTAMENTOUP);\n\t\tforbiddenCommands.set(CMD_PORTAMENTODOWN); forbiddenCommands.set(CMD_XFINEPORTAUPDOWN);\n\t\tforbiddenCommands.set(CMD_NOTESLIDEUP); forbiddenCommands.set(CMD_NOTESLIDEUPRETRIG);\n\t\tforbiddenCommands.set(CMD_NOTESLIDEDOWN); forbiddenCommands.set(CMD_NOTESLIDEDOWNRETRIG);\n\t\tforbiddenVolCommands.set(VOLCMD_PORTAUP); forbiddenVolCommands.set(VOLCMD_PORTADOWN);\n\n\t\t// Optimize away channels for which it's pointless to adjust sample positions\n\t\tfor(CHANNELINDEX i = 0; i < GetNumChannels(); i++)\n\t\t{\n\t\t\tif(ChnSettings[i].dwFlags[CHN_MUTE]) memory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL;\n\t\t}\n\t\tif(target.mode == GetLengthTarget::SeekPosition && target.pos.order < orderList.size())\n\t\t{\n\t\t\t// If we know where to seek, we can directly rule out any channels on which a new note would be triggered right at the start.\n\t\t\tconst PATTERNINDEX seekPat = orderList[target.pos.order];\n\t\t\tif(Patterns.IsValidPat(seekPat) && Patterns[seekPat].IsValidRow(target.pos.row))\n\t\t\t{\n\t\t\t\tconst ModCommand *m = Patterns[seekPat].GetRow(target.pos.row);\n\t\t\t\tfor(CHANNELINDEX i = 0; i < GetNumChannels(); i++, m++)\n\t\t\t\t{\n\t\t\t\t\tif(m->note == NOTE_NOTECUT || m->note == NOTE_KEYOFF || (m->note == NOTE_FADE && GetNumInstruments())\n\t\t\t\t\t\t|| (m->IsNote() && !m->IsPortamento()))\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// If samples are being synced, force them to resync if tick duration changes\n\tuint32 oldTickDuration = 0;\n\n\tfor (;;)\n\t{\n\t\t// Time target reached.\n\t\tif(target.mode == GetLengthTarget::SeekSeconds && memory.elapsedTime >= target.time)\n\t\t{\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\tuint32 rowDelay = 0, tickDelay = 0;\n\t\tplayState.m_nRow = playState.m_nNextRow;\n\t\tplayState.m_nCurrentOrder = playState.m_nNextOrder;\n\n\t\tif(orderList.IsValidPat(playState.m_nCurrentOrder) && playState.m_nRow >= Patterns[orderList[playState.m_nCurrentOrder]].GetNumRows())\n\t\t{\n\t\t\tplayState.m_nRow = 0;\n\t\t\tif(m_playBehaviour[kFT2LoopE60Restart])\n\t\t\t{\n\t\t\t\tplayState.m_nRow = playState.m_nNextPatStartRow;\n\t\t\t\tplayState.m_nNextPatStartRow = 0;\n\t\t\t}\n\t\t\tplayState.m_nCurrentOrder = ++playState.m_nNextOrder;\n\t\t}\n\n\t\t// Check if pattern is valid\n\t\tplayState.m_nPattern = playState.m_nCurrentOrder < orderList.size() ? orderList[playState.m_nCurrentOrder] : orderList.GetInvalidPatIndex();\n\t\tbool positionJumpOnThisRow = false;\n\t\tbool patternBreakOnThisRow = false;\n\t\tbool patternLoopEndedOnThisRow = false, patternLoopStartedOnThisRow = false;\n\n\t\tif(!Patterns.IsValidPat(playState.m_nPattern) && playState.m_nPattern != orderList.GetInvalidPatIndex() && target.mode == GetLengthTarget::SeekPosition && playState.m_nCurrentOrder == target.pos.order)\n\t\t{\n\t\t\t// Early test: Target is inside +++ or non-existing pattern\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\twhile(playState.m_nPattern >= Patterns.Size())\n\t\t{\n\t\t\t// End of song?\n\t\t\tif((playState.m_nPattern == orderList.GetInvalidPatIndex()) || (playState.m_nCurrentOrder >= orderList.size()))\n\t\t\t{\n\t\t\t\tif(playState.m_nCurrentOrder == orderList.GetRestartPos())\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tplayState.m_nCurrentOrder = orderList.GetRestartPos();\n\t\t\t} else\n\t\t\t{\n\t\t\t\tplayState.m_nCurrentOrder++;\n\t\t\t}\n\t\t\tplayState.m_nPattern = (playState.m_nCurrentOrder < orderList.size()) ? orderList[playState.m_nCurrentOrder] : orderList.GetInvalidPatIndex();\n\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder;\n\t\t\tif((!Patterns.IsValidPat(playState.m_nPattern)) && visitedRows.IsVisited(playState.m_nCurrentOrder, 0, true))\n\t\t\t{\n\t\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t\t{\n\t\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\t\tbreak;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\t\tresults.push_back(retval);\n\t\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\t\tmemory.Reset();\n\n\t\t\t\t\tplayState.m_nCurrentOrder = playState.m_nNextOrder;\n\t\t\t\t\tplayState.m_nPattern = orderList[playState.m_nCurrentOrder];\n\t\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(playState.m_nNextOrder == ORDERINDEX_INVALID)\n\t\t{\n\t\t\t// GetFirstUnvisitedRow failed, so there is nothing more to play\n\t\t\tbreak;\n\t\t}\n\n\t\t// Skip non-existing patterns\n\t\tif(!Patterns.IsValidPat(playState.m_nPattern))\n\t\t{\n\t\t\t// If there isn't even a tune, we should probably stop here.\n\t\t\tif(playState.m_nCurrentOrder == orderList.GetRestartPos())\n\t\t\t{\n\t\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t\t{\n\t\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\t\tbreak;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\t\tresults.push_back(retval);\n\t\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\t\tmemory.Reset();\n\t\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder + 1;\n\t\t\tcontinue;\n\t\t}\n\t\t// Should never happen\n\t\tif(playState.m_nRow >= Patterns[playState.m_nPattern].GetNumRows())\n\t\t\tplayState.m_nRow = 0;\n\n\t\t// Check whether target was reached.\n\t\tif(target.mode == GetLengthTarget::SeekPosition && playState.m_nCurrentOrder == target.pos.order && playState.m_nRow == target.pos.row)\n\t\t{\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\tif(visitedRows.IsVisited(playState.m_nCurrentOrder, playState.m_nRow, true))\n\t\t{\n\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t{\n\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\tbreak;\n\t\t\t} else\n\t\t\t{\n\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\tresults.push_back(retval);\n\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\tmemory.Reset();\n\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tretval.endOrder = playState.m_nCurrentOrder;\n\t\tretval.endRow = playState.m_nRow;\n\n\t\t// Update next position\n\t\tplayState.m_nNextRow = playState.m_nRow + 1;\n\n\t\t// Jumped to invalid pattern row?\n\t\tif(playState.m_nRow >= Patterns[playState.m_nPattern].GetNumRows())\n\t\t{\n\t\t\tplayState.m_nRow = 0;\n\t\t}\n\t\t// New pattern?\n\t\tif(!playState.m_nRow)\n\t\t{\n\t\t\tfor(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++)\n\t\t\t{\n\t\t\t\tmemory.chnSettings[chn].patLoop = memory.elapsedTime;\n\t\t\t\tmemory.chnSettings[chn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t}\n\t\t}\n\n\t\tModChannel *pChn = playState.Chn;\n\t\t\n\t\t// For various effects, we need to know first how many ticks there are in this row.\n\t\tconst ModCommand *p = Patterns[playState.m_nPattern].GetpModCommand(playState.m_nRow, 0);\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, p++)\n\t\t{\n\t\t\tif(m_playBehaviour[kST3NoMutedChannels] && ChnSettings[nChn].dwFlags[CHN_MUTE])\t// not even effects are processed on muted S3M channels\n\t\t\t\tcontinue;\n\t\t\tif(p->IsPcNote())\n\t\t\t{\n#ifndef NO_PLUGINS\n\t\t\t\tif((adjustMode & eAdjust) && p->instr > 0 && p->instr <= MAX_MIXPLUGINS)\n\t\t\t\t{\n\t\t\t\t\tmemory.plugParams[std::make_pair(p->instr, p->GetValueVolCol())] = p->GetValueEffectCol();\n\t\t\t\t}\n#endif // NO_PLUGINS\n\t\t\t\tpChn[nChn].rowCommand.Clear();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tpChn[nChn].rowCommand = *p;\n\t\t\tswitch(p->command)\n\t\t\t{\n\t\t\tcase CMD_SPEED:\n\t\t\t\tSetSpeed(playState, p->param);\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_TEMPO:\n\t\t\t\tif(m_playBehaviour[kMODVBlankTiming])\n\t\t\t\t{\n\t\t\t\t\t// ProTracker MODs with VBlank timing: All Fxx parameters set the tick count.\n\t\t\t\t\tif(p->param != 0) SetSpeed(playState, p->param);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tif((p->param & 0xF0) == 0x60)\n\t\t\t\t{\n\t\t\t\t\t// Fine Pattern Delay\n\t\t\t\t\ttickDelay += (p->param & 0x0F);\n\t\t\t\t} else if((p->param & 0xF0) == 0xE0 && !rowDelay)\n\t\t\t\t{\n\t\t\t\t\t// Pattern Delay\n\t\t\t\t\tif(!(GetType() & MOD_TYPE_S3M) || (p->param & 0x0F) != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t// While Impulse Tracker *does* count S60 as a valid row delay (and thus ignores any other row delay commands on the right),\n\t\t\t\t\t\t// Scream Tracker 3 simply ignores such commands.\n\t\t\t\t\t\trowDelay = 1 + (p->param & 0x0F);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tif((p->param & 0xF0) == 0xE0)\n\t\t\t\t{\n\t\t\t\t\t// Pattern Delay\n\t\t\t\t\trowDelay = 1 + (p->param & 0x0F);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(rowDelay == 0) rowDelay = 1;\n\t\tconst uint32 numTicks = (playState.m_nMusicSpeed + tickDelay) * rowDelay;\n\t\tconst uint32 nonRowTicks = numTicks - rowDelay;\n\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++) if(!pChn->rowCommand.IsEmpty())\n\t\t{\n\t\t\tif(m_playBehaviour[kST3NoMutedChannels] && ChnSettings[nChn].dwFlags[CHN_MUTE])\t// not even effects are processed on muted S3M channels\n\t\t\t\tcontinue;\n\t\t\tModCommand::COMMAND command = pChn->rowCommand.command;\n\t\t\tModCommand::PARAM param = pChn->rowCommand.param;\n\t\t\tModCommand::NOTE note = pChn->rowCommand.note;\n\n\t\t\tif (pChn->rowCommand.instr)\n\t\t\t{\n\t\t\t\tpChn->nNewIns = pChn->rowCommand.instr;\n\t\t\t\tpChn->nLastNote = NOTE_NONE;\n\t\t\t\tmemory.chnSettings[nChn].vol = 0xFF;\n\t\t\t}\n\t\t\tif (pChn->rowCommand.IsNote()) pChn->nLastNote = note;\n\n\t\t\t// Update channel panning\n\t\t\tif(pChn->rowCommand.IsNote() || pChn->rowCommand.instr)\n\t\t\t{\n\t\t\t\tSAMPLEINDEX smp = 0;\n\t\t\t\tif(GetNumInstruments())\n\t\t\t\t{\n\t\t\t\t\tModInstrument *pIns;\n\t\t\t\t\tif(pChn->nNewIns <= GetNumInstruments() && (pIns = Instruments[pChn->nNewIns]) != nullptr)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(pIns->dwFlags[INS_SETPANNING])\n\t\t\t\t\t\t\tpChn->nPan = pIns->nPan;\n\t\t\t\t\t\tif(ModCommand::IsNote(note))\n\t\t\t\t\t\t\tsmp = pIns->Keyboard[note - NOTE_MIN];\n\t\t\t\t\t}\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tsmp = pChn->nNewIns;\n\t\t\t\t}\n\t\t\t\tif(smp > 0 && smp <= GetNumSamples() && Samples[smp].uFlags[CHN_PANNING])\n\t\t\t\t{\n\t\t\t\t\tpChn->nPan = Samples[smp].nPan;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch(pChn->rowCommand.volcmd)\n\t\t\t{\n\t\t\tcase VOLCMD_VOLUME:\n\t\t\t\tmemory.chnSettings[nChn].vol = pChn->rowCommand.vol;\n\t\t\t\tbreak;\n\t\t\tcase VOLCMD_VOLSLIDEUP:\n\t\t\tcase VOLCMD_VOLSLIDEDOWN:\n\t\t\t\tif(pChn->rowCommand.vol != 0)\n\t\t\t\t\tpChn->nOldVolParam = pChn->rowCommand.vol;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch(command)\n\t\t\t{\n\t\t\t// Position Jump\n\t\t\tcase CMD_POSITIONJUMP:\n\t\t\t\tpositionJumpOnThisRow = true;\n\t\t\t\tplayState.m_nNextOrder = static_cast(CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn));\n\t\t\t\tplayState.m_nNextPatStartRow = 0; // FT2 E60 bug\n\t\t\t\t// see https://forum.openmpt.org/index.php?topic=2769.0 - FastTracker resets Dxx if Bxx is called _after_ Dxx\n\t\t\t\t// Test case: PatternJump.mod\n\t\t\t\tif(!patternBreakOnThisRow || (GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)))\n\t\t\t\t\tplayState.m_nNextRow = 0;\n\n\t\t\t\tif (adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tpChn->nPatternLoopCount = 0;\n\t\t\t\t\tpChn->nPatternLoop = 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Pattern Break\n\t\t\tcase CMD_PATTERNBREAK:\n\t\t\t\t{\n\t\t\t\t\tROWINDEX row = PatternBreak(playState, nChn, param);\n\t\t\t\t\tif(row != ROWINDEX_INVALID)\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternBreakOnThisRow = true;\n\t\t\t\t\t\tplayState.m_nNextRow = row;\n\n\t\t\t\t\t\tif(!positionJumpOnThisRow)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpChn->nPatternLoopCount = 0;\n\t\t\t\t\t\t\tpChn->nPatternLoop = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Set Tempo\n\t\t\tcase CMD_TEMPO:\n\t\t\t\tif(!m_playBehaviour[kMODVBlankTiming])\n\t\t\t\t{\n\t\t\t\t\tTEMPO tempo(CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn), 0);\n\t\t\t\t\tif ((adjustMode & eAdjust) && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (tempo.GetInt()) pChn->nOldTempo = static_cast(tempo.GetInt()); else tempo.Set(pChn->nOldTempo);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (tempo.GetInt() >= 0x20) playState.m_nMusicTempo = tempo;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// Tempo Slide\n\t\t\t\t\t\tTEMPO tempoDiff((tempo.GetInt() & 0x0F) * nonRowTicks, 0);\n\t\t\t\t\t\tif ((tempo.GetInt() & 0xF0) == 0x10)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tplayState.m_nMusicTempo += tempoDiff;\n\t\t\t\t\t\t} else\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(tempoDiff < playState.m_nMusicTempo)\n\t\t\t\t\t\t\t\tplayState.m_nMusicTempo -= tempoDiff;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tplayState.m_nMusicTempo.Set(0);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tTEMPO tempoMin = GetModSpecifications().GetTempoMin(), tempoMax = GetModSpecifications().GetTempoMax();\n\t\t\t\t\tif(m_playBehaviour[kTempoClamp])\t// clamp tempo correctly in compatible mode\n\t\t\t\t\t{\n\t\t\t\t\t\ttempoMax.Set(255);\n\t\t\t\t\t}\n\t\t\t\t\tLimit(playState.m_nMusicTempo, tempoMin, tempoMax);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tswitch(param & 0xF0)\n\t\t\t\t{\n\t\t\t\tcase 0x90:\n\t\t\t\t\tif(param <= 0x91)\n\t\t\t\t\t{\n\t\t\t\t\t\tpChn->dwFlags.set(CHN_SURROUND, param == 0x91);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xA0:\n\t\t\t\t\t// High sample offset\n\t\t\t\t\tpChn->nOldHiOffset = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase 0xB0:\n\t\t\t\t\t// Pattern Loop\n\t\t\t\t\tif (param & 0x0F)\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternLoopEndedOnThisRow = true;\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tCHANNELINDEX firstChn = nChn, lastChn = nChn;\n\t\t\t\t\t\tif(GetType() == MOD_TYPE_S3M)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// ST3 has only one global loop memory.\n\t\t\t\t\t\t\tfirstChn = 0;\n\t\t\t\t\t\t\tlastChn = GetNumChannels() - 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(CHANNELINDEX c = firstChn; c <= lastChn; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoop = memory.elapsedTime;\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoopStart = playState.m_nRow;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpatternLoopStartedOnThisRow = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xF0:\n\t\t\t\t\t// Active macro\n\t\t\t\t\tpChn->nActiveMacro = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tswitch(param & 0xF0)\n\t\t\t\t{\n\t\t\t\tcase 0x60:\n\t\t\t\t\t// Pattern Loop\n\t\t\t\t\tif (param & 0x0F)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.m_nNextPatStartRow = memory.chnSettings[nChn].patLoopStart; // FT2 E60 bug\n\t\t\t\t\t\tpatternLoopEndedOnThisRow = true;\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternLoopStartedOnThisRow = true;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopStart = playState.m_nRow;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xF0:\n\t\t\t\t\t// Active macro\n\t\t\t\t\tpChn->nActiveMacro = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_XFINEPORTAUPDOWN:\n\t\t\t\t// ignore high offset in compatible mode\n\t\t\t\tif(((param & 0xF0) == 0xA0) && !m_playBehaviour[kFT2RestrictXCommand]) pChn->nOldHiOffset = param & 0x0F;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// The following calculations are not interesting if we just want to get the song length.\n\t\t\tif (!(adjustMode & eAdjust)) continue;\n\t\t\tswitch(command)\n\t\t\t{\n\t\t\t// Portamento Up/Down\n\t\t\tcase CMD_PORTAMENTOUP:\n\t\t\t\tif(param)\n\t\t\t\t{\n\t\t\t\t\t// FT2 compatibility: Separate effect memory for all portamento commands\n\t\t\t\t\t// Test case: Porta-LinkMem.xm\n\t\t\t\t\tif(!m_playBehaviour[kFT2PortaUpDownMemory])\n\t\t\t\t\t\tpChn->nOldPortaDown = param;\n\t\t\t\t\tpChn->nOldPortaUp = param;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CMD_PORTAMENTODOWN:\n\t\t\t\tif(param)\n\t\t\t\t{\n\t\t\t\t\t// FT2 compatibility: Separate effect memory for all portamento commands\n\t\t\t\t\t// Test case: Porta-LinkMem.xm\n\t\t\t\t\tif(!m_playBehaviour[kFT2PortaUpDownMemory])\n\t\t\t\t\t\tpChn->nOldPortaUp = param;\n\t\t\t\t\tpChn->nOldPortaDown = param;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Tone-Portamento\n\t\t\tcase CMD_TONEPORTAMENTO:\n\t\t\t\tif (param) pChn->nPortamentoSlide = param << 2;\n\t\t\t\tbreak;\n\t\t\t// Offset\n\t\t\tcase CMD_OFFSET:\n\t\t\t\tif (param) pChn->oldOffset = param << 8;\n\t\t\t\tbreak;\n\t\t\t// Volume Slide\n\t\t\tcase CMD_VOLUMESLIDE:\n\t\t\tcase CMD_TONEPORTAVOL:\n\t\t\t\tif (param) pChn->nOldVolumeSlide = param;\n\t\t\t\tbreak;\n\t\t\t// Set Volume\n\t\t\tcase CMD_VOLUME:\n\t\t\t\tmemory.chnSettings[nChn].vol = param;\n\t\t\t\tbreak;\n\t\t\t// Global Volume\n\t\t\tcase CMD_GLOBALVOLUME:\n\t\t\t\tif(!(GetType() & GLOBALVOL_7BIT_FORMATS) && param < 128) param *= 2;\n\t\t\t\t// IT compatibility 16. ST3 and IT ignore out-of-range values\n\t\t\t\tif(param <= 128)\n\t\t\t\t{\n\t\t\t\t\tplayState.m_nGlobalVolume = param * 2;\n\t\t\t\t} else if(!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)))\n\t\t\t\t{\n\t\t\t\t\tplayState.m_nGlobalVolume = 256;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Global Volume Slide\n\t\t\tcase CMD_GLOBALVOLSLIDE:\n\t\t\t\tif(m_playBehaviour[kPerChannelGlobalVolSlide])\n\t\t\t\t{\n\t\t\t\t\t// IT compatibility 16. Global volume slide params are stored per channel (FT2/IT)\n\t\t\t\t\tif (param) pChn->nOldGlobalVolSlide = param; else param = pChn->nOldGlobalVolSlide;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tif (param) playState.Chn[0].nOldGlobalVolSlide = param; else param = playState.Chn[0].nOldGlobalVolSlide;\n\t\t\t\t}\n\t\t\t\tif (((param & 0x0F) == 0x0F) && (param & 0xF0))\n\t\t\t\t{\n\t\t\t\t\tparam >>= 4;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume += param << 1;\n\t\t\t\t} else if (((param & 0xF0) == 0xF0) && (param & 0x0F))\n\t\t\t\t{\n\t\t\t\t\tparam = (param & 0x0F) << 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume -= param;\n\t\t\t\t} else if (param & 0xF0)\n\t\t\t\t{\n\t\t\t\t\tparam >>= 4;\n\t\t\t\t\tparam <<= 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume += param * nonRowTicks;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tparam = (param & 0x0F) << 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume -= param * nonRowTicks;\n\t\t\t\t}\n\t\t\t\tLimit(playState.m_nGlobalVolume, 0, 256);\n\t\t\t\tbreak;\n\t\t\tcase CMD_CHANNELVOLUME:\n\t\t\t\tif (param <= 64) pChn->nGlobalVol = param;\n\t\t\t\tbreak;\n\t\t\tcase CMD_CHANNELVOLSLIDE:\n\t\t\t\t{\n\t\t\t\t\tif (param) pChn->nOldChnVolSlide = param; else param = pChn->nOldChnVolSlide;\n\t\t\t\t\tint32 volume = pChn->nGlobalVol;\n\t\t\t\t\tif((param & 0x0F) == 0x0F && (param & 0xF0))\n\t\t\t\t\t\tvolume += (param >> 4);\t\t// Fine Up\n\t\t\t\t\telse if((param & 0xF0) == 0xF0 && (param & 0x0F))\n\t\t\t\t\t\tvolume -= (param & 0x0F);\t// Fine Down\n\t\t\t\t\telse if(param & 0x0F)\t\t\t// Down\n\t\t\t\t\t\tvolume -= (param & 0x0F) * nonRowTicks;\n\t\t\t\t\telse\t\t\t\t\t\t\t// Up\n\t\t\t\t\t\tvolume += ((param & 0xF0) >> 4) * nonRowTicks;\n\t\t\t\t\tLimit(volume, 0, 64);\n\t\t\t\t\tpChn->nGlobalVol = volume;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CMD_PANNING8:\n\t\t\t\tPanning(pChn, param, Pan8bit);\n\t\t\t\tbreak;\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tif(param < 0x10)\n\t\t\t\t{\n\t\t\t\t\t// LED filter\n\t\t\t\t\tfor(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.Chn[chn].dwFlags.set(CHN_AMIGAFILTER, !(param & 1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tMPT_FALLTHROUGH;\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tif((param & 0xF0) == 0x80)\n\t\t\t\t{\n\t\t\t\t\tPanning(pChn, (param & 0x0F), Pan4bit);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\tif (param) pChn->nOldVolumeSlide = param;\n\t\t\t\tparam = 0;\n\t\t\t\tMPT_FALLTHROUGH;\n\t\t\tcase CMD_VIBRATO:\n\t\t\t\tVibrato(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_FINEVIBRATO:\n\t\t\t\tFineVibrato(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_TREMOLO:\n\t\t\t\tTremolo(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_PANBRELLO:\n\t\t\t\tPanbrello(pChn, param);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch(pChn->rowCommand.volcmd)\n\t\t\t{\n\t\t\tcase VOLCMD_PANNING:\n\t\t\t\tPanning(pChn, pChn->rowCommand.vol, Pan6bit);\n\t\t\t\tbreak;\n\n\t\t\tcase VOLCMD_VIBRATOSPEED:\n\t\t\t\t// FT2 does not automatically enable vibrato with the \"set vibrato speed\" command\n\t\t\t\tif(m_playBehaviour[kFT2VolColVibrato])\n\t\t\t\t\tpChn->nVibratoSpeed = pChn->rowCommand.vol & 0x0F;\n\t\t\t\telse\n\t\t\t\t\tVibrato(pChn, pChn->rowCommand.vol << 4);\n\t\t\t\tbreak;\n\t\t\tcase VOLCMD_VIBRATODEPTH:\n\t\t\t\tVibrato(pChn, pChn->rowCommand.vol);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Process vibrato / tremolo / panbrello\n\t\t\tswitch(pChn->rowCommand.command)\n\t\t\t{\n\t\t\tcase CMD_VIBRATO:\n\t\t\tcase CMD_FINEVIBRATO:\n\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tuint32 vibTicks = ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && !m_SongFlags[SONG_ITOLDEFFECTS]) ? numTicks : nonRowTicks;\n\t\t\t\t\tuint32 inc = pChn->nVibratoSpeed * vibTicks;\n\t\t\t\t\tif(m_playBehaviour[kITVibratoTremoloPanbrello])\n\t\t\t\t\t\tinc *= 4;\n\t\t\t\t\tpChn->nVibratoPos += static_cast(inc);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_TREMOLO:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tuint32 tremTicks = ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && !m_SongFlags[SONG_ITOLDEFFECTS]) ? numTicks : nonRowTicks;\n\t\t\t\t\tuint32 inc = pChn->nTremoloSpeed * tremTicks;\n\t\t\t\t\tif(m_playBehaviour[kITVibratoTremoloPanbrello])\n\t\t\t\t\t\tinc *= 4;\n\t\t\t\t\tpChn->nTremoloPos += static_cast(inc);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_PANBRELLO:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\t// Panbrello effect is permanent in compatible mode, so actually apply panbrello for the last tick of this row\n\t\t\t\t\tpChn->nPanbrelloPos += static_cast(pChn->nPanbrelloSpeed * (numTicks - 1));\n\t\t\t\t\tProcessPanbrello(pChn);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Interpret F00 effect in XM files as \"stop song\"\n\t\tif(GetType() == MOD_TYPE_XM && playState.m_nMusicSpeed == uint16_max)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\n\t\tplayState.m_nCurrentRowsPerBeat = m_nDefaultRowsPerBeat;\n\t\tif(Patterns[playState.m_nPattern].GetOverrideSignature())\n\t\t{\n\t\t\tplayState.m_nCurrentRowsPerBeat = Patterns[playState.m_nPattern].GetRowsPerBeat();\n\t\t}\n\n\t\tconst uint32 tickDuration = GetTickDuration(playState);\n\t\tconst uint32 rowDuration = tickDuration * numTicks;\n\t\tmemory.elapsedTime += static_cast(rowDuration) / static_cast(m_MixerSettings.gdwMixingFreq);\n\t\tplayState.m_lTotalSampleCount += rowDuration;\n\n\t\tif(adjustSamplePos)\n\t\t{\n\t\t\t// Super experimental and dirty sample seeking\n\t\t\tpChn = playState.Chn;\n\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++)\n\t\t\t{\n\t\t\t\tif(memory.chnSettings[nChn].ticksToRender == GetLengthMemory::IGNORE_CHANNEL)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tuint32 startTick = 0;\n\t\t\t\tconst ModCommand &m = pChn->rowCommand;\n\t\t\t\tuint32 paramHi = m.param >> 4, paramLo = m.param & 0x0F;\n\t\t\t\tbool porta = m.command == CMD_TONEPORTAMENTO || m.command == CMD_TONEPORTAVOL || m.volcmd == VOLCMD_TONEPORTAMENTO;\n\t\t\t\tbool stopNote = patternLoopStartedOnThisRow;\t// It's too much trouble to keep those pattern loops in sync...\n\n\t\t\t\tif(m.instr) pChn->proTrackerOffset = 0;\n\t\t\t\tif(m.IsNote())\n\t\t\t\t{\n\t\t\t\t\tif(porta && memory.chnSettings[nChn].incChanged)\n\t\t\t\t\t{\n\t\t\t\t\t\t// If there's a portamento, the current channel increment mustn't be 0 in NoteChange()\n\t\t\t\t\t\tpChn->increment = GetChannelIncrement(pChn, pChn->nPeriod, 0);\n\t\t\t\t\t}\n\t\t\t\t\tint32 setPan = pChn->nPan;\n\t\t\t\t\tpChn->nNewNote = pChn->nLastNote;\n\t\t\t\t\tif(pChn->nNewIns != 0) InstrumentChange(pChn, pChn->nNewIns, porta);\n\t\t\t\t\tNoteChange(pChn, m.note, porta);\n\t\t\t\t\tmemory.chnSettings[nChn].incChanged = true;\n\n\t\t\t\t\tif((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xD0 && paramLo < numTicks)\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick = paramLo;\n\t\t\t\t\t} else if(m.command == CMD_DELAYCUT && paramHi < numTicks)\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick = paramHi;\n\t\t\t\t\t}\n\t\t\t\t\tif(rowDelay > 1 && startTick != 0 && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)))\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick += (playState.m_nMusicSpeed + tickDelay) * (rowDelay - 1);\n\t\t\t\t\t}\n\t\t\t\t\tif(!porta) memory.chnSettings[nChn].ticksToRender = 0;\n\n\t\t\t\t\t// Panning commands have to be re-applied after a note change with potential pan change.\n\t\t\t\t\tif(m.command == CMD_PANNING8\n\t\t\t\t\t\t|| ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && paramHi == 0x8)\n\t\t\t\t\t\t|| m.volcmd == VOLCMD_PANNING)\n\t\t\t\t\t{\n\t\t\t\t\t\tpChn->nPan = setPan;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(m.command == CMD_OFFSET)\n\t\t\t\t\t{\n\t\t\t\t\t\tbool isExtended = false;\n\t\t\t\t\t\tSmpLength offset = CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn, &isExtended);\n\t\t\t\t\t\tif(!isExtended)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toffset <<= 8;\n\t\t\t\t\t\t\tif(offset == 0) offset = pChn->oldOffset;\n\t\t\t\t\t\t\toffset += static_cast(pChn->nOldHiOffset) << 16;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tSampleOffset(*pChn, offset);\n\t\t\t\t\t} else if(m.command == CMD_OFFSETPERCENTAGE)\n\t\t\t\t\t{\n\t\t\t\t\t\tSampleOffset(*pChn, Util::muldiv_unsigned(pChn->nLength, m.param, 255));\n\t\t\t\t\t} else if(m.command == CMD_REVERSEOFFSET && pChn->pModSample != nullptr)\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\tReverseSampleOffset(*pChn, m.param);\n\t\t\t\t\t\tstartTick = playState.m_nMusicSpeed - 1;\n\t\t\t\t\t} else if(m.volcmd == VOLCMD_OFFSET)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(m.vol <= CountOf(pChn->pModSample->cues) && pChn->pModSample != nullptr)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSmpLength offset;\n\t\t\t\t\t\t\tif(m.vol == 0)\n\t\t\t\t\t\t\t\toffset = pChn->oldOffset;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toffset = pChn->oldOffset = pChn->pModSample->cues[m.vol - 1];\n\t\t\t\t\t\t\tSampleOffset(*pChn, offset);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(m.note == NOTE_KEYOFF || m.note == NOTE_NOTECUT || (m.note == NOTE_FADE && GetNumInstruments())\n\t\t\t\t\t|| ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xC0 && paramLo < numTicks)\n\t\t\t\t\t|| (m.command == CMD_DELAYCUT && paramLo != 0 && startTick + paramLo < numTicks))\n\t\t\t\t{\n\t\t\t\t\tstopNote = true;\n\t\t\t\t}\n\n\t\t\t\tif(m.command == CMD_VOLUME)\n\t\t\t\t{\n\t\t\t\t\tpChn->nVolume = m.param * 4;\n\t\t\t\t} else if(m.volcmd == VOLCMD_VOLUME)\n\t\t\t\t{\n\t\t\t\t\tpChn->nVolume = m.vol * 4;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(pChn->pModSample && !stopNote)\n\t\t\t\t{\n\t\t\t\t\t// Check if we don't want to emulate some effect and thus stop processing.\n\t\t\t\t\tif(m.command < MAX_EFFECTS)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(forbiddenCommands[m.command])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t\t} else if(m.command == CMD_MODCMDEX)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Special case: Slides using extended commands\n\t\t\t\t\t\t\tswitch(m.param & 0xF0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0x10:\n\t\t\t\t\t\t\tcase 0x20:\n\t\t\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(m.volcmd < forbiddenVolCommands.size() && forbiddenVolCommands[m.volcmd])\n\t\t\t\t\t{\n\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(stopNote)\n\t\t\t\t{\n\t\t\t\t\tpChn->Stop();\n\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender = 0;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tif(oldTickDuration != tickDuration && oldTickDuration != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch(m.command)\n\t\t\t\t\t{\n\t\t\t\t\tcase CMD_TONEPORTAVOL:\n\t\t\t\t\tcase CMD_VOLUMESLIDE:\n\t\t\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\t\t\tif(m.param || (GetType() != MOD_TYPE_MOD))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(uint32 i = 0; i < numTicks; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->isFirstTick = (i == 0);\n\t\t\t\t\t\t\t\tVolumeSlide(pChn, m.param);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CMD_MODCMDEX:\n\t\t\t\t\t\tif((m.param & 0x0F) || (GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpChn->isFirstTick = true;\n\t\t\t\t\t\t\tswitch(m.param & 0xF0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0xA0: FineVolumeUp(pChn, m.param & 0x0F, false); break;\n\t\t\t\t\t\t\tcase 0xB0: FineVolumeDown(pChn, m.param & 0x0F, false); break;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\t\t\tif(m.param == 0x9E)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Play forward\n\t\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\t\tpChn->dwFlags.reset(CHN_PINGPONGFLAG);\n\t\t\t\t\t\t} else if(m.param == 0x9F)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Reverse\n\t\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\t\tpChn->dwFlags.set(CHN_PINGPONGFLAG);\n\t\t\t\t\t\t\tif(!pChn->position.GetInt() && pChn->nLength && (m.IsNote() || !pChn->dwFlags[CHN_LOOP]))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->position.Set(pChn->nLength - 1, SamplePosition::fractMax);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if((m.param & 0xF0) == 0x70)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// TODO\n\t\t\t\t\t\t\t//ExtendedS3MCommands(nChn, param);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tpChn->isFirstTick = true;\n\t\t\t\t\tswitch(m.volcmd)\n\t\t\t\t\t{\n\t\t\t\t\tcase VOLCMD_FINEVOLUP:\t\tFineVolumeUp(pChn, m.vol, m_playBehaviour[kITVolColMemory]); break;\n\t\t\t\t\tcase VOLCMD_FINEVOLDOWN:\tFineVolumeDown(pChn, m.vol, m_playBehaviour[kITVolColMemory]); break;\n\t\t\t\t\tcase VOLCMD_VOLSLIDEUP:\n\t\t\t\t\tcase VOLCMD_VOLSLIDEDOWN:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// IT Compatibility: Volume column volume slides have their own memory\n\t\t\t\t\t\t\t// Test case: VolColMemory.it\n\t\t\t\t\t\t\tModCommand::VOL vol = m.vol;\n\t\t\t\t\t\t\tif(vol == 0 && m_playBehaviour[kITVolColMemory])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvol = pChn->nOldVolParam;\n\t\t\t\t\t\t\t\tif(vol == 0)\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(m.volcmd == VOLCMD_VOLSLIDEUP)\n\t\t\t\t\t\t\t\tvol <<= 4;\n\t\t\t\t\t\t\tfor(uint32 i = 0; i < numTicks; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->isFirstTick = (i == 0);\n\t\t\t\t\t\t\t\tVolumeSlide(pChn, vol);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(porta)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Portamento needs immediate syncing, as the pitch changes on each tick\n\t\t\t\t\t\tuint32 portaTick = memory.chnSettings[nChn].ticksToRender + startTick + 1;\n\t\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender += numTicks;\n\t\t\t\t\t\tmemory.RenderChannel(nChn, tickDuration, portaTick);\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender += (numTicks - startTick);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toldTickDuration = tickDuration;\n\n\t\t// Pattern loop is not executed in FT2 if there are any position jump or pattern break commands on the same row.\n\t\t// Pattern loop is not executed in IT if there are any position jump commands on the same row.\n\t\t// Test case for FT2 exception: PatLoop-Jumps.xm, PatLoop-Various.xm\n\t\t// Test case for IT: exception: LoopBreak.it\n\t\tif(patternLoopEndedOnThisRow\n\t\t\t&& (!m_playBehaviour[kFT2PatternLoopWithJumps] || !(positionJumpOnThisRow || patternBreakOnThisRow))\n\t\t\t&& (!m_playBehaviour[kITPatternLoopWithJumps] || !positionJumpOnThisRow))\n\t\t{\n\t\t\tstd::map startTimes;\n\t\t\t// This is really just a simple estimation for nested pattern loops. It should handle cases correctly where all parallel loops start and end on the same row.\n\t\t\t// If one of them starts or ends \"in between\", it will most likely calculate a wrong duration.\n\t\t\t// For S3M files, it's also way off.\n\t\t\tpChn = playState.Chn;\n\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++)\n\t\t\t{\n\t\t\t\tModCommand::COMMAND command = pChn->rowCommand.command;\n\t\t\t\tModCommand::PARAM param = pChn->rowCommand.param;\n\t\t\t\tif((command == CMD_S3MCMDEX && param >= 0xB1 && param <= 0xBF)\n\t\t\t\t\t|| (command == CMD_MODCMDEX && param >= 0x61 && param <= 0x6F))\n\t\t\t\t{\n\t\t\t\t\tconst double start = memory.chnSettings[nChn].patLoop;\n\t\t\t\t\tif(!startTimes[start]) startTimes[start] = 1;\n\t\t\t\t\tstartTimes[start] = mpt::lcm(startTimes[start], 1 + (param & 0x0F));\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(const auto &i : startTimes)\n\t\t\t{\n\t\t\t\tmemory.elapsedTime += (memory.elapsedTime - i.first) * (double)(i.second - 1);\n\t\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++)\n\t\t\t\t{\n\t\t\t\t\tif(memory.chnSettings[nChn].patLoop == i.first)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.m_lTotalSampleCount += (playState.m_lTotalSampleCount - memory.chnSettings[nChn].patLoopSmp) * (i.second - 1);\n\t\t\t\t\t\tif(m_playBehaviour[kITPatternLoopTargetReset] || (GetType() == MOD_TYPE_S3M))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopStart = playState.m_nRow + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(GetType() == MOD_TYPE_IT)\n\t\t\t{\n\t\t\t\t// IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0)\n\t\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++)\n\t\t\t\t{\n\t\t\t\t\tif((pChn->rowCommand.command == CMD_S3MCMDEX && pChn->rowCommand.param >= 0xB1 && pChn->rowCommand.param <= 0xBF))\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Now advance the sample positions for sample seeking on channels that are still playing\n\tif(adjustSamplePos)\n\t{\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++)\n\t\t{\n\t\t\tif(memory.chnSettings[nChn].ticksToRender != GetLengthMemory::IGNORE_CHANNEL)\n\t\t\t{\n\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\n\t\t\t}\n\t\t}\n\t}\n\n\tif(retval.targetReached || target.mode == GetLengthTarget::NoTarget)\n\t{\n\t\tretval.lastOrder = playState.m_nCurrentOrder;\n\t\tretval.lastRow = playState.m_nRow;\n\t}\n\tretval.duration = memory.elapsedTime;\n\tresults.push_back(retval);\n\n\t// Store final variables\n\tif(adjustMode & eAdjust)\n\t{\n\t\tif(retval.targetReached || target.mode == GetLengthTarget::NoTarget)\n\t\t{\n\t\t\t// Target found, or there is no target (i.e. play whole song)...\n\t\t\tm_PlayState = std::move(playState);\n\t\t\tm_PlayState.m_nNextRow = m_PlayState.m_nRow;\n\t\t\tm_PlayState.m_nFrameDelay = m_PlayState.m_nPatternDelay = 0;\n\t\t\tm_PlayState.m_nTickCount = Util::MaxValueOfType(m_PlayState.m_nTickCount) - 1;\n\t\t\tm_PlayState.m_bPositionChanged = true;\n\t\t\tfor(CHANNELINDEX n = 0; n < GetNumChannels(); n++)\n\t\t\t{\n\t\t\t\tif(m_PlayState.Chn[n].nLastNote != NOTE_NONE)\n\t\t\t\t{\n\t\t\t\t\tm_PlayState.Chn[n].nNewNote = m_PlayState.Chn[n].nLastNote;\n\t\t\t\t}\n\t\t\t\tif(memory.chnSettings[n].vol != 0xFF && !adjustSamplePos)\n\t\t\t\t{\n\t\t\t\t\tm_PlayState.Chn[n].nVolume = std::min(memory.chnSettings[n].vol, uint8(64)) * 4;\n\t\t\t\t}\n\t\t\t}\n\n#ifndef NO_PLUGINS\n\t\t\t// If there were any PC events, update plugin parameters to their latest value.\n\t\t\tstd::bitset plugSetProgram;\n\t\t\tfor(const auto ¶m : memory.plugParams)\n\t\t\t{\n\t\t\t\tPLUGINDEX plug = param.first.first - 1;\n\t\t\t\tIMixPlugin *plugin = m_MixPlugins[plug].pMixPlugin;\n\t\t\t\tif(plugin != nullptr)\n\t\t\t\t{\n\t\t\t\t\tif(!plugSetProgram[plug])\n\t\t\t\t\t{\n\t\t\t\t\t\t// Used for bridged plugins to avoid sending out individual messages for each parameter.\n\t\t\t\t\t\tplugSetProgram.set(plug);\n\t\t\t\t\t\tplugin->BeginSetProgram();\n\t\t\t\t\t}\n\t\t\t\t\tplugin->SetParameter(param.first.second, param.second / PlugParamValue(ModCommand::maxColumnValue));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(plugSetProgram.any())\n\t\t\t{\n\t\t\t\tfor(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; i++)\n\t\t\t\t{\n\t\t\t\t\tif(plugSetProgram[i])\n\t\t\t\t\t{\n\t\t\t\t\t\tm_MixPlugins[i].pMixPlugin->EndSetProgram();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n#endif // NO_PLUGINS\n\t\t} else if(adjustMode != eAdjustOnSuccess)\n\t\t{\n\t\t\t// Target not found (e.g. when jumping to a hidden sub song), reset global variables...\n\t\t\tm_PlayState.m_nMusicSpeed = m_nDefaultSpeed;\n\t\t\tm_PlayState.m_nMusicTempo = m_nDefaultTempo;\n\t\t\tm_PlayState.m_nGlobalVolume = m_nDefaultGlobalVolume;\n\t\t}\n\t\t// When adjusting the playback status, we will also want to update the visited rows vector according to the current position.\n\t\tif(sequence != Order.GetCurrentSequenceIndex())\n\t\t{\n\t\t\tOrder.SetSequence(sequence);\n\t\t}\n\t\tvisitedSongRows.Set(visitedRows);\n\t}\n\n\treturn results;\n\n}","target":"std::vector CSoundFile::GetLength(enmGetLengthResetMode adjustMode, GetLengthTarget target)\n{\n\tstd::vector results;\n\tGetLengthType retval;\n\tretval.startOrder = target.startOrder;\n\tretval.startRow = target.startRow;\n\n\t// Are we trying to reach a certain pattern position?\n\tconst bool hasSearchTarget = target.mode != GetLengthTarget::NoTarget;\n\tconst bool adjustSamplePos = (adjustMode & eAdjustSamplePositions) == eAdjustSamplePositions;\n\n\tSEQUENCEINDEX sequence = target.sequence;\n\tif(sequence >= Order.GetNumSequences()) sequence = Order.GetCurrentSequenceIndex();\n\tconst ModSequence &orderList = Order(sequence);\n\n\tGetLengthMemory memory(*this);\n\tCSoundFile::PlayState &playState = *memory.state;\n\t// Temporary visited rows vector (so that GetLength() won't interfere with the player code if the module is playing at the same time)\n\tRowVisitor visitedRows(*this, sequence);\n\n\tplayState.m_nNextRow = playState.m_nRow = target.startRow;\n\tplayState.m_nNextOrder = playState.m_nCurrentOrder = target.startOrder;\n\n\t// Fast LUTs for commands that are too weird / complicated / whatever to emulate in sample position adjust mode.\n\tstd::bitset forbiddenCommands;\n\tstd::bitset forbiddenVolCommands;\n\n\tif(adjustSamplePos)\n\t{\n\t\tforbiddenCommands.set(CMD_ARPEGGIO); forbiddenCommands.set(CMD_PORTAMENTOUP);\n\t\tforbiddenCommands.set(CMD_PORTAMENTODOWN); forbiddenCommands.set(CMD_XFINEPORTAUPDOWN);\n\t\tforbiddenCommands.set(CMD_NOTESLIDEUP); forbiddenCommands.set(CMD_NOTESLIDEUPRETRIG);\n\t\tforbiddenCommands.set(CMD_NOTESLIDEDOWN); forbiddenCommands.set(CMD_NOTESLIDEDOWNRETRIG);\n\t\tforbiddenVolCommands.set(VOLCMD_PORTAUP); forbiddenVolCommands.set(VOLCMD_PORTADOWN);\n\n\t\t// Optimize away channels for which it's pointless to adjust sample positions\n\t\tfor(CHANNELINDEX i = 0; i < GetNumChannels(); i++)\n\t\t{\n\t\t\tif(ChnSettings[i].dwFlags[CHN_MUTE]) memory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL;\n\t\t}\n\t\tif(target.mode == GetLengthTarget::SeekPosition && target.pos.order < orderList.size())\n\t\t{\n\t\t\t// If we know where to seek, we can directly rule out any channels on which a new note would be triggered right at the start.\n\t\t\tconst PATTERNINDEX seekPat = orderList[target.pos.order];\n\t\t\tif(Patterns.IsValidPat(seekPat) && Patterns[seekPat].IsValidRow(target.pos.row))\n\t\t\t{\n\t\t\t\tconst ModCommand *m = Patterns[seekPat].GetRow(target.pos.row);\n\t\t\t\tfor(CHANNELINDEX i = 0; i < GetNumChannels(); i++, m++)\n\t\t\t\t{\n\t\t\t\t\tif(m->note == NOTE_NOTECUT || m->note == NOTE_KEYOFF || (m->note == NOTE_FADE && GetNumInstruments())\n\t\t\t\t\t\t|| (m->IsNote() && !m->IsPortamento()))\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// If samples are being synced, force them to resync if tick duration changes\n\tuint32 oldTickDuration = 0;\n\n\tfor (;;)\n\t{\n\t\t// Time target reached.\n\t\tif(target.mode == GetLengthTarget::SeekSeconds && memory.elapsedTime >= target.time)\n\t\t{\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\tuint32 rowDelay = 0, tickDelay = 0;\n\t\tplayState.m_nRow = playState.m_nNextRow;\n\t\tplayState.m_nCurrentOrder = playState.m_nNextOrder;\n\n\t\tif(orderList.IsValidPat(playState.m_nCurrentOrder) && playState.m_nRow >= Patterns[orderList[playState.m_nCurrentOrder]].GetNumRows())\n\t\t{\n\t\t\tplayState.m_nRow = 0;\n\t\t\tif(m_playBehaviour[kFT2LoopE60Restart])\n\t\t\t{\n\t\t\t\tplayState.m_nRow = playState.m_nNextPatStartRow;\n\t\t\t\tplayState.m_nNextPatStartRow = 0;\n\t\t\t}\n\t\t\tplayState.m_nCurrentOrder = ++playState.m_nNextOrder;\n\t\t}\n\n\t\t// Check if pattern is valid\n\t\tplayState.m_nPattern = playState.m_nCurrentOrder < orderList.size() ? orderList[playState.m_nCurrentOrder] : orderList.GetInvalidPatIndex();\n\t\tbool positionJumpOnThisRow = false;\n\t\tbool patternBreakOnThisRow = false;\n\t\tbool patternLoopEndedOnThisRow = false, patternLoopStartedOnThisRow = false;\n\n\t\tif(!Patterns.IsValidPat(playState.m_nPattern) && playState.m_nPattern != orderList.GetInvalidPatIndex() && target.mode == GetLengthTarget::SeekPosition && playState.m_nCurrentOrder == target.pos.order)\n\t\t{\n\t\t\t// Early test: Target is inside +++ or non-existing pattern\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\twhile(playState.m_nPattern >= Patterns.Size())\n\t\t{\n\t\t\t// End of song?\n\t\t\tif((playState.m_nPattern == orderList.GetInvalidPatIndex()) || (playState.m_nCurrentOrder >= orderList.size()))\n\t\t\t{\n\t\t\t\tif(playState.m_nCurrentOrder == orderList.GetRestartPos())\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tplayState.m_nCurrentOrder = orderList.GetRestartPos();\n\t\t\t} else\n\t\t\t{\n\t\t\t\tplayState.m_nCurrentOrder++;\n\t\t\t}\n\t\t\tplayState.m_nPattern = (playState.m_nCurrentOrder < orderList.size()) ? orderList[playState.m_nCurrentOrder] : orderList.GetInvalidPatIndex();\n\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder;\n\t\t\tif((!Patterns.IsValidPat(playState.m_nPattern)) && visitedRows.IsVisited(playState.m_nCurrentOrder, 0, true))\n\t\t\t{\n\t\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t\t{\n\t\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\t\tbreak;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\t\tresults.push_back(retval);\n\t\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\t\tmemory.Reset();\n\n\t\t\t\t\tplayState.m_nCurrentOrder = playState.m_nNextOrder;\n\t\t\t\t\tplayState.m_nPattern = orderList[playState.m_nCurrentOrder];\n\t\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(playState.m_nNextOrder == ORDERINDEX_INVALID)\n\t\t{\n\t\t\t// GetFirstUnvisitedRow failed, so there is nothing more to play\n\t\t\tbreak;\n\t\t}\n\n\t\t// Skip non-existing patterns\n\t\tif(!Patterns.IsValidPat(playState.m_nPattern))\n\t\t{\n\t\t\t// If there isn't even a tune, we should probably stop here.\n\t\t\tif(playState.m_nCurrentOrder == orderList.GetRestartPos())\n\t\t\t{\n\t\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t\t{\n\t\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\t\tbreak;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\t\tresults.push_back(retval);\n\t\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\t\tmemory.Reset();\n\t\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder + 1;\n\t\t\tcontinue;\n\t\t}\n\t\t// Should never happen\n\t\tif(playState.m_nRow >= Patterns[playState.m_nPattern].GetNumRows())\n\t\t\tplayState.m_nRow = 0;\n\n\t\t// Check whether target was reached.\n\t\tif(target.mode == GetLengthTarget::SeekPosition && playState.m_nCurrentOrder == target.pos.order && playState.m_nRow == target.pos.row)\n\t\t{\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\tif(visitedRows.IsVisited(playState.m_nCurrentOrder, playState.m_nRow, true))\n\t\t{\n\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t{\n\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\tbreak;\n\t\t\t} else\n\t\t\t{\n\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\tresults.push_back(retval);\n\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\tmemory.Reset();\n\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tretval.endOrder = playState.m_nCurrentOrder;\n\t\tretval.endRow = playState.m_nRow;\n\n\t\t// Update next position\n\t\tplayState.m_nNextRow = playState.m_nRow + 1;\n\n\t\t// Jumped to invalid pattern row?\n\t\tif(playState.m_nRow >= Patterns[playState.m_nPattern].GetNumRows())\n\t\t{\n\t\t\tplayState.m_nRow = 0;\n\t\t}\n\t\t// New pattern?\n\t\tif(!playState.m_nRow)\n\t\t{\n\t\t\tfor(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++)\n\t\t\t{\n\t\t\t\tmemory.chnSettings[chn].patLoop = memory.elapsedTime;\n\t\t\t\tmemory.chnSettings[chn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t}\n\t\t}\n\n\t\tModChannel *pChn = playState.Chn;\n\t\t\n\t\t// For various effects, we need to know first how many ticks there are in this row.\n\t\tconst ModCommand *p = Patterns[playState.m_nPattern].GetpModCommand(playState.m_nRow, 0);\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, p++)\n\t\t{\n\t\t\tif(m_playBehaviour[kST3NoMutedChannels] && ChnSettings[nChn].dwFlags[CHN_MUTE])\t// not even effects are processed on muted S3M channels\n\t\t\t\tcontinue;\n\t\t\tif(p->IsPcNote())\n\t\t\t{\n#ifndef NO_PLUGINS\n\t\t\t\tif((adjustMode & eAdjust) && p->instr > 0 && p->instr <= MAX_MIXPLUGINS)\n\t\t\t\t{\n\t\t\t\t\tmemory.plugParams[std::make_pair(p->instr, p->GetValueVolCol())] = p->GetValueEffectCol();\n\t\t\t\t}\n#endif // NO_PLUGINS\n\t\t\t\tpChn[nChn].rowCommand.Clear();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tpChn[nChn].rowCommand = *p;\n\t\t\tswitch(p->command)\n\t\t\t{\n\t\t\tcase CMD_SPEED:\n\t\t\t\tSetSpeed(playState, p->param);\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_TEMPO:\n\t\t\t\tif(m_playBehaviour[kMODVBlankTiming])\n\t\t\t\t{\n\t\t\t\t\t// ProTracker MODs with VBlank timing: All Fxx parameters set the tick count.\n\t\t\t\t\tif(p->param != 0) SetSpeed(playState, p->param);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tif((p->param & 0xF0) == 0x60)\n\t\t\t\t{\n\t\t\t\t\t// Fine Pattern Delay\n\t\t\t\t\ttickDelay += (p->param & 0x0F);\n\t\t\t\t} else if((p->param & 0xF0) == 0xE0 && !rowDelay)\n\t\t\t\t{\n\t\t\t\t\t// Pattern Delay\n\t\t\t\t\tif(!(GetType() & MOD_TYPE_S3M) || (p->param & 0x0F) != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t// While Impulse Tracker *does* count S60 as a valid row delay (and thus ignores any other row delay commands on the right),\n\t\t\t\t\t\t// Scream Tracker 3 simply ignores such commands.\n\t\t\t\t\t\trowDelay = 1 + (p->param & 0x0F);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tif((p->param & 0xF0) == 0xE0)\n\t\t\t\t{\n\t\t\t\t\t// Pattern Delay\n\t\t\t\t\trowDelay = 1 + (p->param & 0x0F);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(rowDelay == 0) rowDelay = 1;\n\t\tconst uint32 numTicks = (playState.m_nMusicSpeed + tickDelay) * rowDelay;\n\t\tconst uint32 nonRowTicks = numTicks - rowDelay;\n\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++) if(!pChn->rowCommand.IsEmpty())\n\t\t{\n\t\t\tif(m_playBehaviour[kST3NoMutedChannels] && ChnSettings[nChn].dwFlags[CHN_MUTE])\t// not even effects are processed on muted S3M channels\n\t\t\t\tcontinue;\n\t\t\tModCommand::COMMAND command = pChn->rowCommand.command;\n\t\t\tModCommand::PARAM param = pChn->rowCommand.param;\n\t\t\tModCommand::NOTE note = pChn->rowCommand.note;\n\n\t\t\tif (pChn->rowCommand.instr)\n\t\t\t{\n\t\t\t\tpChn->nNewIns = pChn->rowCommand.instr;\n\t\t\t\tpChn->nLastNote = NOTE_NONE;\n\t\t\t\tmemory.chnSettings[nChn].vol = 0xFF;\n\t\t\t}\n\t\t\tif (pChn->rowCommand.IsNote()) pChn->nLastNote = note;\n\n\t\t\t// Update channel panning\n\t\t\tif(pChn->rowCommand.IsNote() || pChn->rowCommand.instr)\n\t\t\t{\n\t\t\t\tSAMPLEINDEX smp = 0;\n\t\t\t\tif(GetNumInstruments())\n\t\t\t\t{\n\t\t\t\t\tModInstrument *pIns;\n\t\t\t\t\tif(pChn->nNewIns <= GetNumInstruments() && (pIns = Instruments[pChn->nNewIns]) != nullptr)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(pIns->dwFlags[INS_SETPANNING])\n\t\t\t\t\t\t\tpChn->nPan = pIns->nPan;\n\t\t\t\t\t\tif(ModCommand::IsNote(note))\n\t\t\t\t\t\t\tsmp = pIns->Keyboard[note - NOTE_MIN];\n\t\t\t\t\t}\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tsmp = pChn->nNewIns;\n\t\t\t\t}\n\t\t\t\tif(smp > 0 && smp <= GetNumSamples() && Samples[smp].uFlags[CHN_PANNING])\n\t\t\t\t{\n\t\t\t\t\tpChn->nPan = Samples[smp].nPan;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch(pChn->rowCommand.volcmd)\n\t\t\t{\n\t\t\tcase VOLCMD_VOLUME:\n\t\t\t\tmemory.chnSettings[nChn].vol = pChn->rowCommand.vol;\n\t\t\t\tbreak;\n\t\t\tcase VOLCMD_VOLSLIDEUP:\n\t\t\tcase VOLCMD_VOLSLIDEDOWN:\n\t\t\t\tif(pChn->rowCommand.vol != 0)\n\t\t\t\t\tpChn->nOldVolParam = pChn->rowCommand.vol;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch(command)\n\t\t\t{\n\t\t\t// Position Jump\n\t\t\tcase CMD_POSITIONJUMP:\n\t\t\t\tpositionJumpOnThisRow = true;\n\t\t\t\tplayState.m_nNextOrder = static_cast(CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn));\n\t\t\t\tplayState.m_nNextPatStartRow = 0; // FT2 E60 bug\n\t\t\t\t// see https://forum.openmpt.org/index.php?topic=2769.0 - FastTracker resets Dxx if Bxx is called _after_ Dxx\n\t\t\t\t// Test case: PatternJump.mod\n\t\t\t\tif(!patternBreakOnThisRow || (GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)))\n\t\t\t\t\tplayState.m_nNextRow = 0;\n\n\t\t\t\tif (adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tpChn->nPatternLoopCount = 0;\n\t\t\t\t\tpChn->nPatternLoop = 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Pattern Break\n\t\t\tcase CMD_PATTERNBREAK:\n\t\t\t\t{\n\t\t\t\t\tROWINDEX row = PatternBreak(playState, nChn, param);\n\t\t\t\t\tif(row != ROWINDEX_INVALID)\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternBreakOnThisRow = true;\n\t\t\t\t\t\tplayState.m_nNextRow = row;\n\n\t\t\t\t\t\tif(!positionJumpOnThisRow)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpChn->nPatternLoopCount = 0;\n\t\t\t\t\t\t\tpChn->nPatternLoop = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Set Tempo\n\t\t\tcase CMD_TEMPO:\n\t\t\t\tif(!m_playBehaviour[kMODVBlankTiming])\n\t\t\t\t{\n\t\t\t\t\tTEMPO tempo(CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn), 0);\n\t\t\t\t\tif ((adjustMode & eAdjust) && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (tempo.GetInt()) pChn->nOldTempo = static_cast(tempo.GetInt()); else tempo.Set(pChn->nOldTempo);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (tempo.GetInt() >= 0x20) playState.m_nMusicTempo = tempo;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// Tempo Slide\n\t\t\t\t\t\tTEMPO tempoDiff((tempo.GetInt() & 0x0F) * nonRowTicks, 0);\n\t\t\t\t\t\tif ((tempo.GetInt() & 0xF0) == 0x10)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tplayState.m_nMusicTempo += tempoDiff;\n\t\t\t\t\t\t} else\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(tempoDiff < playState.m_nMusicTempo)\n\t\t\t\t\t\t\t\tplayState.m_nMusicTempo -= tempoDiff;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tplayState.m_nMusicTempo.Set(0);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tTEMPO tempoMin = GetModSpecifications().GetTempoMin(), tempoMax = GetModSpecifications().GetTempoMax();\n\t\t\t\t\tif(m_playBehaviour[kTempoClamp])\t// clamp tempo correctly in compatible mode\n\t\t\t\t\t{\n\t\t\t\t\t\ttempoMax.Set(255);\n\t\t\t\t\t}\n\t\t\t\t\tLimit(playState.m_nMusicTempo, tempoMin, tempoMax);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tswitch(param & 0xF0)\n\t\t\t\t{\n\t\t\t\tcase 0x90:\n\t\t\t\t\tif(param <= 0x91)\n\t\t\t\t\t{\n\t\t\t\t\t\tpChn->dwFlags.set(CHN_SURROUND, param == 0x91);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xA0:\n\t\t\t\t\t// High sample offset\n\t\t\t\t\tpChn->nOldHiOffset = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase 0xB0:\n\t\t\t\t\t// Pattern Loop\n\t\t\t\t\tif (param & 0x0F)\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternLoopEndedOnThisRow = true;\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tCHANNELINDEX firstChn = nChn, lastChn = nChn;\n\t\t\t\t\t\tif(GetType() == MOD_TYPE_S3M)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// ST3 has only one global loop memory.\n\t\t\t\t\t\t\tfirstChn = 0;\n\t\t\t\t\t\t\tlastChn = GetNumChannels() - 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(CHANNELINDEX c = firstChn; c <= lastChn; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoop = memory.elapsedTime;\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoopStart = playState.m_nRow;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpatternLoopStartedOnThisRow = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xF0:\n\t\t\t\t\t// Active macro\n\t\t\t\t\tpChn->nActiveMacro = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tswitch(param & 0xF0)\n\t\t\t\t{\n\t\t\t\tcase 0x60:\n\t\t\t\t\t// Pattern Loop\n\t\t\t\t\tif (param & 0x0F)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.m_nNextPatStartRow = memory.chnSettings[nChn].patLoopStart; // FT2 E60 bug\n\t\t\t\t\t\tpatternLoopEndedOnThisRow = true;\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternLoopStartedOnThisRow = true;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopStart = playState.m_nRow;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xF0:\n\t\t\t\t\t// Active macro\n\t\t\t\t\tpChn->nActiveMacro = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_XFINEPORTAUPDOWN:\n\t\t\t\t// ignore high offset in compatible mode\n\t\t\t\tif(((param & 0xF0) == 0xA0) && !m_playBehaviour[kFT2RestrictXCommand]) pChn->nOldHiOffset = param & 0x0F;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// The following calculations are not interesting if we just want to get the song length.\n\t\t\tif (!(adjustMode & eAdjust)) continue;\n\t\t\tswitch(command)\n\t\t\t{\n\t\t\t// Portamento Up/Down\n\t\t\tcase CMD_PORTAMENTOUP:\n\t\t\t\tif(param)\n\t\t\t\t{\n\t\t\t\t\t// FT2 compatibility: Separate effect memory for all portamento commands\n\t\t\t\t\t// Test case: Porta-LinkMem.xm\n\t\t\t\t\tif(!m_playBehaviour[kFT2PortaUpDownMemory])\n\t\t\t\t\t\tpChn->nOldPortaDown = param;\n\t\t\t\t\tpChn->nOldPortaUp = param;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CMD_PORTAMENTODOWN:\n\t\t\t\tif(param)\n\t\t\t\t{\n\t\t\t\t\t// FT2 compatibility: Separate effect memory for all portamento commands\n\t\t\t\t\t// Test case: Porta-LinkMem.xm\n\t\t\t\t\tif(!m_playBehaviour[kFT2PortaUpDownMemory])\n\t\t\t\t\t\tpChn->nOldPortaUp = param;\n\t\t\t\t\tpChn->nOldPortaDown = param;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Tone-Portamento\n\t\t\tcase CMD_TONEPORTAMENTO:\n\t\t\t\tif (param) pChn->nPortamentoSlide = param << 2;\n\t\t\t\tbreak;\n\t\t\t// Offset\n\t\t\tcase CMD_OFFSET:\n\t\t\t\tif (param) pChn->oldOffset = param << 8;\n\t\t\t\tbreak;\n\t\t\t// Volume Slide\n\t\t\tcase CMD_VOLUMESLIDE:\n\t\t\tcase CMD_TONEPORTAVOL:\n\t\t\t\tif (param) pChn->nOldVolumeSlide = param;\n\t\t\t\tbreak;\n\t\t\t// Set Volume\n\t\t\tcase CMD_VOLUME:\n\t\t\t\tmemory.chnSettings[nChn].vol = param;\n\t\t\t\tbreak;\n\t\t\t// Global Volume\n\t\t\tcase CMD_GLOBALVOLUME:\n\t\t\t\tif(!(GetType() & GLOBALVOL_7BIT_FORMATS) && param < 128) param *= 2;\n\t\t\t\t// IT compatibility 16. ST3 and IT ignore out-of-range values\n\t\t\t\tif(param <= 128)\n\t\t\t\t{\n\t\t\t\t\tplayState.m_nGlobalVolume = param * 2;\n\t\t\t\t} else if(!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)))\n\t\t\t\t{\n\t\t\t\t\tplayState.m_nGlobalVolume = 256;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Global Volume Slide\n\t\t\tcase CMD_GLOBALVOLSLIDE:\n\t\t\t\tif(m_playBehaviour[kPerChannelGlobalVolSlide])\n\t\t\t\t{\n\t\t\t\t\t// IT compatibility 16. Global volume slide params are stored per channel (FT2/IT)\n\t\t\t\t\tif (param) pChn->nOldGlobalVolSlide = param; else param = pChn->nOldGlobalVolSlide;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tif (param) playState.Chn[0].nOldGlobalVolSlide = param; else param = playState.Chn[0].nOldGlobalVolSlide;\n\t\t\t\t}\n\t\t\t\tif (((param & 0x0F) == 0x0F) && (param & 0xF0))\n\t\t\t\t{\n\t\t\t\t\tparam >>= 4;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume += param << 1;\n\t\t\t\t} else if (((param & 0xF0) == 0xF0) && (param & 0x0F))\n\t\t\t\t{\n\t\t\t\t\tparam = (param & 0x0F) << 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume -= param;\n\t\t\t\t} else if (param & 0xF0)\n\t\t\t\t{\n\t\t\t\t\tparam >>= 4;\n\t\t\t\t\tparam <<= 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume += param * nonRowTicks;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tparam = (param & 0x0F) << 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume -= param * nonRowTicks;\n\t\t\t\t}\n\t\t\t\tLimit(playState.m_nGlobalVolume, 0, 256);\n\t\t\t\tbreak;\n\t\t\tcase CMD_CHANNELVOLUME:\n\t\t\t\tif (param <= 64) pChn->nGlobalVol = param;\n\t\t\t\tbreak;\n\t\t\tcase CMD_CHANNELVOLSLIDE:\n\t\t\t\t{\n\t\t\t\t\tif (param) pChn->nOldChnVolSlide = param; else param = pChn->nOldChnVolSlide;\n\t\t\t\t\tint32 volume = pChn->nGlobalVol;\n\t\t\t\t\tif((param & 0x0F) == 0x0F && (param & 0xF0))\n\t\t\t\t\t\tvolume += (param >> 4);\t\t// Fine Up\n\t\t\t\t\telse if((param & 0xF0) == 0xF0 && (param & 0x0F))\n\t\t\t\t\t\tvolume -= (param & 0x0F);\t// Fine Down\n\t\t\t\t\telse if(param & 0x0F)\t\t\t// Down\n\t\t\t\t\t\tvolume -= (param & 0x0F) * nonRowTicks;\n\t\t\t\t\telse\t\t\t\t\t\t\t// Up\n\t\t\t\t\t\tvolume += ((param & 0xF0) >> 4) * nonRowTicks;\n\t\t\t\t\tLimit(volume, 0, 64);\n\t\t\t\t\tpChn->nGlobalVol = volume;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CMD_PANNING8:\n\t\t\t\tPanning(pChn, param, Pan8bit);\n\t\t\t\tbreak;\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tif(param < 0x10)\n\t\t\t\t{\n\t\t\t\t\t// LED filter\n\t\t\t\t\tfor(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.Chn[chn].dwFlags.set(CHN_AMIGAFILTER, !(param & 1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tMPT_FALLTHROUGH;\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tif((param & 0xF0) == 0x80)\n\t\t\t\t{\n\t\t\t\t\tPanning(pChn, (param & 0x0F), Pan4bit);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\tif (param) pChn->nOldVolumeSlide = param;\n\t\t\t\tparam = 0;\n\t\t\t\tMPT_FALLTHROUGH;\n\t\t\tcase CMD_VIBRATO:\n\t\t\t\tVibrato(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_FINEVIBRATO:\n\t\t\t\tFineVibrato(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_TREMOLO:\n\t\t\t\tTremolo(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_PANBRELLO:\n\t\t\t\tPanbrello(pChn, param);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch(pChn->rowCommand.volcmd)\n\t\t\t{\n\t\t\tcase VOLCMD_PANNING:\n\t\t\t\tPanning(pChn, pChn->rowCommand.vol, Pan6bit);\n\t\t\t\tbreak;\n\n\t\t\tcase VOLCMD_VIBRATOSPEED:\n\t\t\t\t// FT2 does not automatically enable vibrato with the \"set vibrato speed\" command\n\t\t\t\tif(m_playBehaviour[kFT2VolColVibrato])\n\t\t\t\t\tpChn->nVibratoSpeed = pChn->rowCommand.vol & 0x0F;\n\t\t\t\telse\n\t\t\t\t\tVibrato(pChn, pChn->rowCommand.vol << 4);\n\t\t\t\tbreak;\n\t\t\tcase VOLCMD_VIBRATODEPTH:\n\t\t\t\tVibrato(pChn, pChn->rowCommand.vol);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Process vibrato / tremolo / panbrello\n\t\t\tswitch(pChn->rowCommand.command)\n\t\t\t{\n\t\t\tcase CMD_VIBRATO:\n\t\t\tcase CMD_FINEVIBRATO:\n\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tuint32 vibTicks = ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && !m_SongFlags[SONG_ITOLDEFFECTS]) ? numTicks : nonRowTicks;\n\t\t\t\t\tuint32 inc = pChn->nVibratoSpeed * vibTicks;\n\t\t\t\t\tif(m_playBehaviour[kITVibratoTremoloPanbrello])\n\t\t\t\t\t\tinc *= 4;\n\t\t\t\t\tpChn->nVibratoPos += static_cast(inc);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_TREMOLO:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tuint32 tremTicks = ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && !m_SongFlags[SONG_ITOLDEFFECTS]) ? numTicks : nonRowTicks;\n\t\t\t\t\tuint32 inc = pChn->nTremoloSpeed * tremTicks;\n\t\t\t\t\tif(m_playBehaviour[kITVibratoTremoloPanbrello])\n\t\t\t\t\t\tinc *= 4;\n\t\t\t\t\tpChn->nTremoloPos += static_cast(inc);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_PANBRELLO:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\t// Panbrello effect is permanent in compatible mode, so actually apply panbrello for the last tick of this row\n\t\t\t\t\tpChn->nPanbrelloPos += static_cast(pChn->nPanbrelloSpeed * (numTicks - 1));\n\t\t\t\t\tProcessPanbrello(pChn);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Interpret F00 effect in XM files as \"stop song\"\n\t\tif(GetType() == MOD_TYPE_XM && playState.m_nMusicSpeed == uint16_max)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\n\t\tplayState.m_nCurrentRowsPerBeat = m_nDefaultRowsPerBeat;\n\t\tif(Patterns[playState.m_nPattern].GetOverrideSignature())\n\t\t{\n\t\t\tplayState.m_nCurrentRowsPerBeat = Patterns[playState.m_nPattern].GetRowsPerBeat();\n\t\t}\n\n\t\tconst uint32 tickDuration = GetTickDuration(playState);\n\t\tconst uint32 rowDuration = tickDuration * numTicks;\n\t\tmemory.elapsedTime += static_cast(rowDuration) / static_cast(m_MixerSettings.gdwMixingFreq);\n\t\tplayState.m_lTotalSampleCount += rowDuration;\n\n\t\tif(adjustSamplePos)\n\t\t{\n\t\t\t// Super experimental and dirty sample seeking\n\t\t\tpChn = playState.Chn;\n\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++)\n\t\t\t{\n\t\t\t\tif(memory.chnSettings[nChn].ticksToRender == GetLengthMemory::IGNORE_CHANNEL)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tuint32 startTick = 0;\n\t\t\t\tconst ModCommand &m = pChn->rowCommand;\n\t\t\t\tuint32 paramHi = m.param >> 4, paramLo = m.param & 0x0F;\n\t\t\t\tbool porta = m.command == CMD_TONEPORTAMENTO || m.command == CMD_TONEPORTAVOL || m.volcmd == VOLCMD_TONEPORTAMENTO;\n\t\t\t\tbool stopNote = patternLoopStartedOnThisRow;\t// It's too much trouble to keep those pattern loops in sync...\n\n\t\t\t\tif(m.instr) pChn->proTrackerOffset = 0;\n\t\t\t\tif(m.IsNote())\n\t\t\t\t{\n\t\t\t\t\tif(porta && memory.chnSettings[nChn].incChanged)\n\t\t\t\t\t{\n\t\t\t\t\t\t// If there's a portamento, the current channel increment mustn't be 0 in NoteChange()\n\t\t\t\t\t\tpChn->increment = GetChannelIncrement(pChn, pChn->nPeriod, 0);\n\t\t\t\t\t}\n\t\t\t\t\tint32 setPan = pChn->nPan;\n\t\t\t\t\tpChn->nNewNote = pChn->nLastNote;\n\t\t\t\t\tif(pChn->nNewIns != 0) InstrumentChange(pChn, pChn->nNewIns, porta);\n\t\t\t\t\tNoteChange(pChn, m.note, porta);\n\t\t\t\t\tmemory.chnSettings[nChn].incChanged = true;\n\n\t\t\t\t\tif((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xD0 && paramLo < numTicks)\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick = paramLo;\n\t\t\t\t\t} else if(m.command == CMD_DELAYCUT && paramHi < numTicks)\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick = paramHi;\n\t\t\t\t\t}\n\t\t\t\t\tif(rowDelay > 1 && startTick != 0 && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)))\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick += (playState.m_nMusicSpeed + tickDelay) * (rowDelay - 1);\n\t\t\t\t\t}\n\t\t\t\t\tif(!porta) memory.chnSettings[nChn].ticksToRender = 0;\n\n\t\t\t\t\t// Panning commands have to be re-applied after a note change with potential pan change.\n\t\t\t\t\tif(m.command == CMD_PANNING8\n\t\t\t\t\t\t|| ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && paramHi == 0x8)\n\t\t\t\t\t\t|| m.volcmd == VOLCMD_PANNING)\n\t\t\t\t\t{\n\t\t\t\t\t\tpChn->nPan = setPan;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(m.command == CMD_OFFSET)\n\t\t\t\t\t{\n\t\t\t\t\t\tbool isExtended = false;\n\t\t\t\t\t\tSmpLength offset = CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn, &isExtended);\n\t\t\t\t\t\tif(!isExtended)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toffset <<= 8;\n\t\t\t\t\t\t\tif(offset == 0) offset = pChn->oldOffset;\n\t\t\t\t\t\t\toffset += static_cast(pChn->nOldHiOffset) << 16;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tSampleOffset(*pChn, offset);\n\t\t\t\t\t} else if(m.command == CMD_OFFSETPERCENTAGE)\n\t\t\t\t\t{\n\t\t\t\t\t\tSampleOffset(*pChn, Util::muldiv_unsigned(pChn->nLength, m.param, 255));\n\t\t\t\t\t} else if(m.command == CMD_REVERSEOFFSET && pChn->pModSample != nullptr)\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\tReverseSampleOffset(*pChn, m.param);\n\t\t\t\t\t\tstartTick = playState.m_nMusicSpeed - 1;\n\t\t\t\t\t} else if(m.volcmd == VOLCMD_OFFSET)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(m.vol <= CountOf(pChn->pModSample->cues) && pChn->pModSample != nullptr)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSmpLength offset;\n\t\t\t\t\t\t\tif(m.vol == 0)\n\t\t\t\t\t\t\t\toffset = pChn->oldOffset;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toffset = pChn->oldOffset = pChn->pModSample->cues[m.vol - 1];\n\t\t\t\t\t\t\tSampleOffset(*pChn, offset);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(m.note == NOTE_KEYOFF || m.note == NOTE_NOTECUT || (m.note == NOTE_FADE && GetNumInstruments())\n\t\t\t\t\t|| ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xC0 && paramLo < numTicks)\n\t\t\t\t\t|| (m.command == CMD_DELAYCUT && paramLo != 0 && startTick + paramLo < numTicks))\n\t\t\t\t{\n\t\t\t\t\tstopNote = true;\n\t\t\t\t}\n\n\t\t\t\tif(m.command == CMD_VOLUME)\n\t\t\t\t{\n\t\t\t\t\tpChn->nVolume = m.param * 4;\n\t\t\t\t} else if(m.volcmd == VOLCMD_VOLUME)\n\t\t\t\t{\n\t\t\t\t\tpChn->nVolume = m.vol * 4;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(pChn->pModSample && !stopNote)\n\t\t\t\t{\n\t\t\t\t\t// Check if we don't want to emulate some effect and thus stop processing.\n\t\t\t\t\tif(m.command < MAX_EFFECTS)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(forbiddenCommands[m.command])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t\t} else if(m.command == CMD_MODCMDEX)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Special case: Slides using extended commands\n\t\t\t\t\t\t\tswitch(m.param & 0xF0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0x10:\n\t\t\t\t\t\t\tcase 0x20:\n\t\t\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(m.volcmd < forbiddenVolCommands.size() && forbiddenVolCommands[m.volcmd])\n\t\t\t\t\t{\n\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(stopNote)\n\t\t\t\t{\n\t\t\t\t\tpChn->Stop();\n\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender = 0;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tif(oldTickDuration != tickDuration && oldTickDuration != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch(m.command)\n\t\t\t\t\t{\n\t\t\t\t\tcase CMD_TONEPORTAVOL:\n\t\t\t\t\tcase CMD_VOLUMESLIDE:\n\t\t\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\t\t\tif(m.param || (GetType() != MOD_TYPE_MOD))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(uint32 i = 0; i < numTicks; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->isFirstTick = (i == 0);\n\t\t\t\t\t\t\t\tVolumeSlide(pChn, m.param);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CMD_MODCMDEX:\n\t\t\t\t\t\tif((m.param & 0x0F) || (GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpChn->isFirstTick = true;\n\t\t\t\t\t\t\tswitch(m.param & 0xF0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0xA0: FineVolumeUp(pChn, m.param & 0x0F, false); break;\n\t\t\t\t\t\t\tcase 0xB0: FineVolumeDown(pChn, m.param & 0x0F, false); break;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\t\t\tif(m.param == 0x9E)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Play forward\n\t\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\t\tpChn->dwFlags.reset(CHN_PINGPONGFLAG);\n\t\t\t\t\t\t} else if(m.param == 0x9F)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Reverse\n\t\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\t\tpChn->dwFlags.set(CHN_PINGPONGFLAG);\n\t\t\t\t\t\t\tif(!pChn->position.GetInt() && pChn->nLength && (m.IsNote() || !pChn->dwFlags[CHN_LOOP]))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->position.Set(pChn->nLength - 1, SamplePosition::fractMax);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if((m.param & 0xF0) == 0x70)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// TODO\n\t\t\t\t\t\t\t//ExtendedS3MCommands(nChn, param);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tpChn->isFirstTick = true;\n\t\t\t\t\tswitch(m.volcmd)\n\t\t\t\t\t{\n\t\t\t\t\tcase VOLCMD_FINEVOLUP:\t\tFineVolumeUp(pChn, m.vol, m_playBehaviour[kITVolColMemory]); break;\n\t\t\t\t\tcase VOLCMD_FINEVOLDOWN:\tFineVolumeDown(pChn, m.vol, m_playBehaviour[kITVolColMemory]); break;\n\t\t\t\t\tcase VOLCMD_VOLSLIDEUP:\n\t\t\t\t\tcase VOLCMD_VOLSLIDEDOWN:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// IT Compatibility: Volume column volume slides have their own memory\n\t\t\t\t\t\t\t// Test case: VolColMemory.it\n\t\t\t\t\t\t\tModCommand::VOL vol = m.vol;\n\t\t\t\t\t\t\tif(vol == 0 && m_playBehaviour[kITVolColMemory])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvol = pChn->nOldVolParam;\n\t\t\t\t\t\t\t\tif(vol == 0)\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(m.volcmd == VOLCMD_VOLSLIDEUP)\n\t\t\t\t\t\t\t\tvol <<= 4;\n\t\t\t\t\t\t\tfor(uint32 i = 0; i < numTicks; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->isFirstTick = (i == 0);\n\t\t\t\t\t\t\t\tVolumeSlide(pChn, vol);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(porta)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Portamento needs immediate syncing, as the pitch changes on each tick\n\t\t\t\t\t\tuint32 portaTick = memory.chnSettings[nChn].ticksToRender + startTick + 1;\n\t\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender += numTicks;\n\t\t\t\t\t\tmemory.RenderChannel(nChn, tickDuration, portaTick);\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender += (numTicks - startTick);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toldTickDuration = tickDuration;\n\n\t\t// Pattern loop is not executed in FT2 if there are any position jump or pattern break commands on the same row.\n\t\t// Pattern loop is not executed in IT if there are any position jump commands on the same row.\n\t\t// Test case for FT2 exception: PatLoop-Jumps.xm, PatLoop-Various.xm\n\t\t// Test case for IT: exception: LoopBreak.it\n\t\tif(patternLoopEndedOnThisRow\n\t\t\t&& (!m_playBehaviour[kFT2PatternLoopWithJumps] || !(positionJumpOnThisRow || patternBreakOnThisRow))\n\t\t\t&& (!m_playBehaviour[kITPatternLoopWithJumps] || !positionJumpOnThisRow))\n\t\t{\n\t\t\tstd::map startTimes;\n\t\t\t// This is really just a simple estimation for nested pattern loops. It should handle cases correctly where all parallel loops start and end on the same row.\n\t\t\t// If one of them starts or ends \"in between\", it will most likely calculate a wrong duration.\n\t\t\t// For S3M files, it's also way off.\n\t\t\tpChn = playState.Chn;\n\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++)\n\t\t\t{\n\t\t\t\tModCommand::COMMAND command = pChn->rowCommand.command;\n\t\t\t\tModCommand::PARAM param = pChn->rowCommand.param;\n\t\t\t\tif((command == CMD_S3MCMDEX && param >= 0xB1 && param <= 0xBF)\n\t\t\t\t\t|| (command == CMD_MODCMDEX && param >= 0x61 && param <= 0x6F))\n\t\t\t\t{\n\t\t\t\t\tconst double start = memory.chnSettings[nChn].patLoop;\n\t\t\t\t\tif(!startTimes[start]) startTimes[start] = 1;\n\t\t\t\t\tstartTimes[start] = mpt::lcm(startTimes[start], 1 + (param & 0x0F));\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(const auto &i : startTimes)\n\t\t\t{\n\t\t\t\tmemory.elapsedTime += (memory.elapsedTime - i.first) * (double)(i.second - 1);\n\t\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++)\n\t\t\t\t{\n\t\t\t\t\tif(memory.chnSettings[nChn].patLoop == i.first)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.m_lTotalSampleCount += (playState.m_lTotalSampleCount - memory.chnSettings[nChn].patLoopSmp) * (i.second - 1);\n\t\t\t\t\t\tif(m_playBehaviour[kITPatternLoopTargetReset] || (GetType() == MOD_TYPE_S3M))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopStart = playState.m_nRow + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(GetType() == MOD_TYPE_IT)\n\t\t\t{\n\t\t\t\t// IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0)\n\t\t\t\tpChn = playState.Chn;\n\t\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++)\n\t\t\t\t{\n\t\t\t\t\tif((pChn->rowCommand.command == CMD_S3MCMDEX && pChn->rowCommand.param >= 0xB1 && pChn->rowCommand.param <= 0xBF))\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Now advance the sample positions for sample seeking on channels that are still playing\n\tif(adjustSamplePos)\n\t{\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++)\n\t\t{\n\t\t\tif(memory.chnSettings[nChn].ticksToRender != GetLengthMemory::IGNORE_CHANNEL)\n\t\t\t{\n\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\n\t\t\t}\n\t\t}\n\t}\n\n\tif(retval.targetReached || target.mode == GetLengthTarget::NoTarget)\n\t{\n\t\tretval.lastOrder = playState.m_nCurrentOrder;\n\t\tretval.lastRow = playState.m_nRow;\n\t}\n\tretval.duration = memory.elapsedTime;\n\tresults.push_back(retval);\n\n\t// Store final variables\n\tif(adjustMode & eAdjust)\n\t{\n\t\tif(retval.targetReached || target.mode == GetLengthTarget::NoTarget)\n\t\t{\n\t\t\t// Target found, or there is no target (i.e. play whole song)...\n\t\t\tm_PlayState = std::move(playState);\n\t\t\tm_PlayState.m_nNextRow = m_PlayState.m_nRow;\n\t\t\tm_PlayState.m_nFrameDelay = m_PlayState.m_nPatternDelay = 0;\n\t\t\tm_PlayState.m_nTickCount = Util::MaxValueOfType(m_PlayState.m_nTickCount) - 1;\n\t\t\tm_PlayState.m_bPositionChanged = true;\n\t\t\tfor(CHANNELINDEX n = 0; n < GetNumChannels(); n++)\n\t\t\t{\n\t\t\t\tif(m_PlayState.Chn[n].nLastNote != NOTE_NONE)\n\t\t\t\t{\n\t\t\t\t\tm_PlayState.Chn[n].nNewNote = m_PlayState.Chn[n].nLastNote;\n\t\t\t\t}\n\t\t\t\tif(memory.chnSettings[n].vol != 0xFF && !adjustSamplePos)\n\t\t\t\t{\n\t\t\t\t\tm_PlayState.Chn[n].nVolume = std::min(memory.chnSettings[n].vol, uint8(64)) * 4;\n\t\t\t\t}\n\t\t\t}\n\n#ifndef NO_PLUGINS\n\t\t\t// If there were any PC events, update plugin parameters to their latest value.\n\t\t\tstd::bitset plugSetProgram;\n\t\t\tfor(const auto ¶m : memory.plugParams)\n\t\t\t{\n\t\t\t\tPLUGINDEX plug = param.first.first - 1;\n\t\t\t\tIMixPlugin *plugin = m_MixPlugins[plug].pMixPlugin;\n\t\t\t\tif(plugin != nullptr)\n\t\t\t\t{\n\t\t\t\t\tif(!plugSetProgram[plug])\n\t\t\t\t\t{\n\t\t\t\t\t\t// Used for bridged plugins to avoid sending out individual messages for each parameter.\n\t\t\t\t\t\tplugSetProgram.set(plug);\n\t\t\t\t\t\tplugin->BeginSetProgram();\n\t\t\t\t\t}\n\t\t\t\t\tplugin->SetParameter(param.first.second, param.second / PlugParamValue(ModCommand::maxColumnValue));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(plugSetProgram.any())\n\t\t\t{\n\t\t\t\tfor(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; i++)\n\t\t\t\t{\n\t\t\t\t\tif(plugSetProgram[i])\n\t\t\t\t\t{\n\t\t\t\t\t\tm_MixPlugins[i].pMixPlugin->EndSetProgram();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n#endif // NO_PLUGINS\n\t\t} else if(adjustMode != eAdjustOnSuccess)\n\t\t{\n\t\t\t// Target not found (e.g. when jumping to a hidden sub song), reset global variables...\n\t\t\tm_PlayState.m_nMusicSpeed = m_nDefaultSpeed;\n\t\t\tm_PlayState.m_nMusicTempo = m_nDefaultTempo;\n\t\t\tm_PlayState.m_nGlobalVolume = m_nDefaultGlobalVolume;\n\t\t}\n\t\t// When adjusting the playback status, we will also want to update the visited rows vector according to the current position.\n\t\tif(sequence != Order.GetCurrentSequenceIndex())\n\t\t{\n\t\t\tOrder.SetSequence(sequence);\n\t\t}\n\t\tvisitedSongRows.Set(visitedRows);\n\t}\n\n\treturn results;\n\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":11014,"sven_meta":{"func_name":"CSoundFile::GetLength","file_name":"soundlib/Snd_fx.cpp","commit_link":"github.com/OpenMPT/openmpt/commit/492022c7297ede682161d9c0ec2de15526424e76","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#18-0af9171e26c6","input":"static int dex_loadcode(RBinFile *arch, RBinDexObj *bin) {\n\tstruct r_bin_t *rbin = arch->rbin;\n\tint i;\n\tint *methods = NULL;\n\tint sym_count = 0;\n\n\t// doublecheck??\n\tif (!bin || bin->methods_list) {\n\t\treturn false;\n\t}\n\tbin->code_from = UT64_MAX;\n\tbin->code_to = 0;\n\tbin->methods_list = r_list_newf ((RListFree)free);\n\tif (!bin->methods_list) {\n\t\treturn false;\n\t}\n\tbin->imports_list = r_list_newf ((RListFree)free);\n\tif (!bin->imports_list) {\n\t\tr_list_free (bin->methods_list);\n\t\treturn false;\n\t}\n\tbin->classes_list = r_list_newf ((RListFree)__r_bin_class_free);\n\tif (!bin->classes_list) {\n\t\tr_list_free (bin->methods_list);\n\t\tr_list_free (bin->imports_list);\n\t\treturn false;\n\t}\n\n\tif (bin->header.method_size>bin->size) {\n\t\tbin->header.method_size = 0;\n\t\treturn false;\n\t}\n\n\t/* WrapDown the header sizes to avoid huge allocations */\n\tbin->header.method_size = R_MIN (bin->header.method_size, bin->size);\n\tbin->header.class_size = R_MIN (bin->header.class_size, bin->size);\n\tbin->header.strings_size = R_MIN (bin->header.strings_size, bin->size);\n\n\t// TODO: is this posible after R_MIN ??\n\tif (bin->header.strings_size > bin->size) {\n\t\teprintf (\"Invalid strings size\\n\");\n\t\treturn false;\n\t}\n\n\tif (bin->classes) {\n\t\tut64 amount = sizeof (int) * bin->header.method_size;\n\t\tif (amount > UT32_MAX || amount < bin->header.method_size) {\n\t\t\treturn false;\n\t\t}\n\t\tmethods = calloc (1, amount + 1);\n\t\tfor (i = 0; i < bin->header.class_size; i++) {\n\t\t\tchar *super_name, *class_name;\n\t\t\tstruct dex_class_t *c = &bin->classes[i];\n\t\t\tclass_name = dex_class_name (bin, c);\n\t\t\tsuper_name = dex_class_super_name (bin, c);\n\t\t\tif (dexdump) { \n\t\t\t\trbin->cb_printf (\"Class #%d -\\n\", i);\n\t\t\t}\n\t\t\tparse_class (arch, bin, c, i, methods, &sym_count);\n\t\t\tfree (class_name);\n\t\t\tfree (super_name);\n\t\t}\n\t}\n\n\tif (methods) {\n\t\tint import_count = 0;\n\t\tint sym_count = bin->methods_list->length;\n\n\t\tfor (i = 0; i < bin->header.method_size; i++) {\n\t\t\tint len = 0;\n\t\t\tif (methods[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (bin->methods[i].class_id > bin->header.types_size - 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (is_class_idx_in_code_classes(bin, bin->methods[i].class_id)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tchar *class_name = getstr (\n\t\t\t\tbin, bin->types[bin->methods[i].class_id]\n\t\t\t\t\t\t.descriptor_id);\n\t\t\tif (!class_name) {\n\t\t\t\tfree (class_name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlen = strlen (class_name);\n\t\t\tif (len < 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tclass_name[len - 1] = 0; // remove last char \";\"\n\t\t\tchar *method_name = dex_method_name (bin, i);\n\t\t\tchar *signature = dex_method_signature (bin, i);\n\t\t\tif (method_name && *method_name) {\n\t\t\t\tRBinImport *imp = R_NEW0 (RBinImport);\n\t\t\t\timp->name = r_str_newf (\"%s.method.%s%s\", class_name, method_name, signature);\n\t\t\t\timp->type = r_str_const (\"FUNC\");\n\t\t\t\timp->bind = r_str_const (\"NONE\");\n\t\t\t\timp->ordinal = import_count++;\n\t\t\t\tr_list_append (bin->imports_list, imp);\n\n\t\t\t\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\t\t\t\tsym->name = r_str_newf (\"imp.%s\", imp->name);\n\t\t\t\tsym->type = r_str_const (\"FUNC\");\n\t\t\t\tsym->bind = r_str_const (\"NONE\");\n\t\t\t\t//XXX so damn unsafe check buffer boundaries!!!!\n\t\t\t\t//XXX use r_buf API!!\n\t\t\t\tsym->paddr = sym->vaddr = bin->b->base + bin->header.method_offset + (sizeof (struct dex_method_t) * i) ;\n\t\t\t\tsym->ordinal = sym_count++;\n\t\t\t\tr_list_append (bin->methods_list, sym);\n\t\t\t\tsdb_num_set (mdb, sdb_fmt (0, \"method.%d\", i), sym->paddr, 0);\n\t\t\t}\n\t\t\tfree (method_name);\n\t\t\tfree (signature);\n\t\t\tfree (class_name);\n\t\t}\n\t\tfree (methods);\n\t}\n\treturn true;\n}","target":"static int dex_loadcode(RBinFile *arch, RBinDexObj *bin) {\n\tstruct r_bin_t *rbin = arch->rbin;\n\tint i;\n\tint *methods = NULL;\n\tint sym_count = 0;\n\n\t// doublecheck??\n\tif (!bin || bin->methods_list) {\n\t\treturn false;\n\t}\n\tbin->code_from = UT64_MAX;\n\tbin->code_to = 0;\n\tbin->methods_list = r_list_newf ((RListFree)free);\n\tif (!bin->methods_list) {\n\t\treturn false;\n\t}\n\tbin->imports_list = r_list_newf ((RListFree)free);\n\tif (!bin->imports_list) {\n\t\tr_list_free (bin->methods_list);\n\t\treturn false;\n\t}\n\tbin->classes_list = r_list_newf ((RListFree)__r_bin_class_free);\n\tif (!bin->classes_list) {\n\t\tr_list_free (bin->methods_list);\n\t\tr_list_free (bin->imports_list);\n\t\treturn false;\n\t}\n\n\tif (bin->header.method_size>bin->size) {\n\t\tbin->header.method_size = 0;\n\t\treturn false;\n\t}\n\n\t/* WrapDown the header sizes to avoid huge allocations */\n\tbin->header.method_size = R_MIN (bin->header.method_size, bin->size);\n\tbin->header.class_size = R_MIN (bin->header.class_size, bin->size);\n\tbin->header.strings_size = R_MIN (bin->header.strings_size, bin->size);\n\n\t// TODO: is this posible after R_MIN ??\n\tif (bin->header.strings_size > bin->size) {\n\t\teprintf (\"Invalid strings size\\n\");\n\t\treturn false;\n\t}\n\n\tif (bin->classes) {\n\t\tut64 amount = sizeof (int) * bin->header.method_size;\n\t\tif (amount > UT32_MAX || amount < bin->header.method_size) {\n\t\t\treturn false;\n\t\t}\n\t\tmethods = calloc (1, amount + 1);\n\t\tfor (i = 0; i < bin->header.class_size; i++) {\n\t\t\tchar *super_name, *class_name;\n\t\t\tstruct dex_class_t *c = &bin->classes[i];\n\t\t\tclass_name = dex_class_name (bin, c);\n\t\t\tsuper_name = dex_class_super_name (bin, c);\n\t\t\tif (dexdump) { \n\t\t\t\trbin->cb_printf (\"Class #%d -\\n\", i);\n\t\t\t}\n\t\t\tparse_class (arch, bin, c, i, methods, &sym_count);\n\t\t\tfree (class_name);\n\t\t\tfree (super_name);\n\t\t}\n\t}\n\n\tif (methods) {\n\t\tint import_count = 0;\n\t\tint sym_count = bin->methods_list->length;\n\n\t\tfor (i = 0; i < bin->header.method_size; i++) {\n\t\t\tint len = 0;\n\t\t\tif (methods[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (bin->methods[i].class_id > bin->header.types_size) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (is_class_idx_in_code_classes(bin, bin->methods[i].class_id)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tchar *class_name = getstr (\n\t\t\t\tbin, bin->types[bin->methods[i].class_id]\n\t\t\t\t\t\t.descriptor_id);\n\t\t\tif (!class_name) {\n\t\t\t\tfree (class_name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlen = strlen (class_name);\n\t\t\tif (len < 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tclass_name[len - 1] = 0; // remove last char \";\"\n\t\t\tchar *method_name = dex_method_name (bin, i);\n\t\t\tchar *signature = dex_method_signature (bin, i);\n\t\t\tif (method_name && *method_name) {\n\t\t\t\tRBinImport *imp = R_NEW0 (RBinImport);\n\t\t\t\timp->name = r_str_newf (\"%s.method.%s%s\", class_name, method_name, signature);\n\t\t\t\timp->type = r_str_const (\"FUNC\");\n\t\t\t\timp->bind = r_str_const (\"NONE\");\n\t\t\t\timp->ordinal = import_count++;\n\t\t\t\tr_list_append (bin->imports_list, imp);\n\n\t\t\t\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\t\t\t\tsym->name = r_str_newf (\"imp.%s\", imp->name);\n\t\t\t\tsym->type = r_str_const (\"FUNC\");\n\t\t\t\tsym->bind = r_str_const (\"NONE\");\n\t\t\t\t//XXX so damn unsafe check buffer boundaries!!!!\n\t\t\t\t//XXX use r_buf API!!\n\t\t\t\tsym->paddr = sym->vaddr = bin->b->base + bin->header.method_offset + (sizeof (struct dex_method_t) * i) ;\n\t\t\t\tsym->ordinal = sym_count++;\n\t\t\t\tr_list_append (bin->methods_list, sym);\n\t\t\t\tsdb_num_set (mdb, sdb_fmt (0, \"method.%d\", i), sym->paddr, 0);\n\t\t\t}\n\t\t\tfree (method_name);\n\t\t\tfree (signature);\n\t\t\tfree (class_name);\n\t\t}\n\t\tfree (methods);\n\t}\n\treturn true;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1081,"sven_meta":{"func_name":"dex_loadcode","file_name":"libr/bin/p/bin_dex.c","commit_link":"github.com/radare/radare2/commit/ead645853a63bf83d8386702cad0cf23b31d7eeb","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#19-52afbf8175d0","input":"static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n#define RMT_EQUAL_RGB 1\n#define RMT_NONE 0\n#define RMT_RAW 2\n#define RT_STANDARD 1\n#define RT_ENCODED 2\n#define RT_FORMAT_RGB 3\n\n typedef struct _SUNInfo\n {\n unsigned int\n magic,\n width,\n height,\n depth,\n length,\n type,\n maptype,\n maplength;\n } SUNInfo;\n\n Image\n *image;\n\n int\n bit;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n register Quantum\n *q;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *p;\n\n size_t\n bytes_per_line,\n extent,\n height,\n length;\n\n ssize_t\n count,\n y;\n\n SUNInfo\n sun_info;\n\n unsigned char\n *sun_data,\n *sun_pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read SUN raster header.\n */\n (void) ResetMagickMemory(&sun_info,0,sizeof(sun_info));\n sun_info.magic=ReadBlobMSBLong(image);\n do\n {\n /*\n Verify SUN identifier.\n */\n if (sun_info.magic != 0x59a66a95)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n sun_info.width=ReadBlobMSBLong(image);\n sun_info.height=ReadBlobMSBLong(image);\n sun_info.depth=ReadBlobMSBLong(image);\n sun_info.length=ReadBlobMSBLong(image);\n sun_info.type=ReadBlobMSBLong(image);\n sun_info.maptype=ReadBlobMSBLong(image);\n sun_info.maplength=ReadBlobMSBLong(image);\n extent=sun_info.height*sun_info.width;\n if ((sun_info.height != 0) && (sun_info.width != extent/sun_info.height))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.type != RT_STANDARD) && (sun_info.type != RT_ENCODED) &&\n (sun_info.type != RT_FORMAT_RGB))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.maptype == RMT_NONE) && (sun_info.maplength != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.depth == 0) || (sun_info.depth > 32))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.maptype != RMT_NONE) && (sun_info.maptype != RMT_EQUAL_RGB) &&\n (sun_info.maptype != RMT_RAW))\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n image->columns=sun_info.width;\n image->rows=sun_info.height;\n image->depth=sun_info.depth <= 8 ? sun_info.depth :\n MAGICKCORE_QUANTUM_DEPTH;\n if (sun_info.depth < 24)\n {\n size_t\n one;\n\n image->colors=sun_info.maplength;\n one=1;\n if (sun_info.maptype == RMT_NONE)\n image->colors=one << sun_info.depth;\n if (sun_info.maptype == RMT_EQUAL_RGB)\n image->colors=sun_info.maplength/3;\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n switch (sun_info.maptype)\n {\n case RMT_NONE:\n break;\n case RMT_EQUAL_RGB:\n {\n unsigned char\n *sun_colormap;\n\n /*\n Read SUN raster colormap.\n */\n sun_colormap=(unsigned char *) AcquireQuantumMemory(image->colors,\n sizeof(*sun_colormap));\n if (sun_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].red=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].green=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].blue=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap);\n break;\n }\n case RMT_RAW:\n {\n unsigned char\n *sun_colormap;\n\n /*\n Read SUN raster colormap.\n */\n sun_colormap=(unsigned char *) AcquireQuantumMemory(sun_info.maplength,\n sizeof(*sun_colormap));\n if (sun_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,sun_info.maplength,sun_colormap);\n if (count != (ssize_t) sun_info.maplength)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap);\n break;\n }\n default:\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n }\n image->alpha_trait=sun_info.depth == 32 ? BlendPixelTrait :\n UndefinedPixelTrait;\n image->columns=sun_info.width;\n image->rows=sun_info.height;\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n if ((sun_info.length*sizeof(*sun_data))/sizeof(*sun_data) !=\n sun_info.length || !sun_info.length)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n number_pixels=(MagickSizeType) image->columns*image->rows;\n if ((sun_info.type != RT_ENCODED) && \n ((number_pixels*sun_info.depth) > (8*sun_info.length)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n bytes_per_line=sun_info.width*sun_info.depth;\n sun_data=(unsigned char *) AcquireQuantumMemory((size_t) MagickMax(\n sun_info.length,bytes_per_line*sun_info.width),sizeof(*sun_data));\n if (sun_data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=(ssize_t) ReadBlob(image,sun_info.length,sun_data);\n if (count != (ssize_t) sun_info.length)\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n height=sun_info.height;\n if ((height == 0) || (sun_info.width == 0) || (sun_info.depth == 0) ||\n ((bytes_per_line/sun_info.depth) != sun_info.width))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n bytes_per_line+=15;\n bytes_per_line<<=1;\n if ((bytes_per_line >> 1) != (sun_info.width*sun_info.depth+15))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n bytes_per_line>>=4;\n sun_pixels=(unsigned char *) AcquireQuantumMemory(height,\n bytes_per_line*sizeof(*sun_pixels));\n if (sun_pixels == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (sun_info.type == RT_ENCODED)\n (void) DecodeImage(sun_data,sun_info.length,sun_pixels,bytes_per_line*\n height);\n sun_data=(unsigned char *) RelinquishMagickMemory(sun_data);\n /*\n Convert SUN raster image to pixel packets.\n */\n p=sun_pixels;\n if (sun_info.depth == 1)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < ((ssize_t) image->columns-7); x+=8)\n {\n for (bit=7; bit >= 0; bit--)\n {\n SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 : 0x01),\n q);\n q+=GetPixelChannels(image);\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=7; bit >= (int) (8-(image->columns % 8)); bit--)\n {\n SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 :\n 0x01),q);\n q+=GetPixelChannels(image);\n }\n p++;\n }\n if ((((image->columns/8)+(image->columns % 8 ? 1 : 0)) % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n else\n if (image->storage_class == PseudoClass)\n {\n if (bytes_per_line == 0)\n bytes_per_line=image->columns;\n length=image->rows*(image->columns+image->columns % 2);\n if (((sun_info.type == RT_ENCODED) &&\n (length > (bytes_per_line*image->rows))) ||\n ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p++,q);\n q+=GetPixelChannels(image);\n }\n if ((image->columns % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n size_t\n bytes_per_pixel;\n\n bytes_per_pixel=3;\n if (image->alpha_trait != UndefinedPixelTrait)\n bytes_per_pixel++;\n if (bytes_per_line == 0)\n bytes_per_line=bytes_per_pixel*image->columns;\n length=image->rows*(bytes_per_line+bytes_per_line % 2);\n if (((sun_info.type == RT_ENCODED) &&\n (length > (bytes_per_line*image->rows))) ||\n ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n if (sun_info.type == RT_STANDARD)\n {\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n }\n else\n {\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n }\n if (image->colors != 0)\n {\n SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelRed(image,q)].red),q);\n SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelGreen(image,q)].green),q);\n SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelBlue(image,q)].blue),q);\n }\n q+=GetPixelChannels(image);\n }\n if (((bytes_per_pixel*image->columns) % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n if (image->storage_class == PseudoClass)\n (void) SyncImage(image,exception);\n sun_pixels=(unsigned char *) RelinquishMagickMemory(sun_pixels);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n sun_info.magic=ReadBlobMSBLong(image);\n if (sun_info.magic == 0x59a66a95)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while (sun_info.magic == 0x59a66a95);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n#define RMT_EQUAL_RGB 1\n#define RMT_NONE 0\n#define RMT_RAW 2\n#define RT_STANDARD 1\n#define RT_ENCODED 2\n#define RT_FORMAT_RGB 3\n\n typedef struct _SUNInfo\n {\n unsigned int\n magic,\n width,\n height,\n depth,\n length,\n type,\n maptype,\n maplength;\n } SUNInfo;\n\n Image\n *image;\n\n int\n bit;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n register Quantum\n *q;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *p;\n\n size_t\n bytes_per_line,\n extent,\n height,\n length;\n\n ssize_t\n count,\n y;\n\n SUNInfo\n sun_info;\n\n unsigned char\n *sun_data,\n *sun_pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read SUN raster header.\n */\n (void) ResetMagickMemory(&sun_info,0,sizeof(sun_info));\n sun_info.magic=ReadBlobMSBLong(image);\n do\n {\n /*\n Verify SUN identifier.\n */\n if (sun_info.magic != 0x59a66a95)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n sun_info.width=ReadBlobMSBLong(image);\n sun_info.height=ReadBlobMSBLong(image);\n sun_info.depth=ReadBlobMSBLong(image);\n sun_info.length=ReadBlobMSBLong(image);\n sun_info.type=ReadBlobMSBLong(image);\n sun_info.maptype=ReadBlobMSBLong(image);\n sun_info.maplength=ReadBlobMSBLong(image);\n extent=sun_info.height*sun_info.width;\n if ((sun_info.height != 0) && (sun_info.width != extent/sun_info.height))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.type != RT_STANDARD) && (sun_info.type != RT_ENCODED) &&\n (sun_info.type != RT_FORMAT_RGB))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.maptype == RMT_NONE) && (sun_info.maplength != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.depth == 0) || (sun_info.depth > 32))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.maptype != RMT_NONE) && (sun_info.maptype != RMT_EQUAL_RGB) &&\n (sun_info.maptype != RMT_RAW))\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n image->columns=sun_info.width;\n image->rows=sun_info.height;\n image->depth=sun_info.depth <= 8 ? sun_info.depth :\n MAGICKCORE_QUANTUM_DEPTH;\n if (sun_info.depth < 24)\n {\n size_t\n one;\n\n image->colors=sun_info.maplength;\n one=1;\n if (sun_info.maptype == RMT_NONE)\n image->colors=one << sun_info.depth;\n if (sun_info.maptype == RMT_EQUAL_RGB)\n image->colors=sun_info.maplength/3;\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n switch (sun_info.maptype)\n {\n case RMT_NONE:\n break;\n case RMT_EQUAL_RGB:\n {\n unsigned char\n *sun_colormap;\n\n /*\n Read SUN raster colormap.\n */\n sun_colormap=(unsigned char *) AcquireQuantumMemory(image->colors,\n sizeof(*sun_colormap));\n if (sun_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].red=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].green=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].blue=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap);\n break;\n }\n case RMT_RAW:\n {\n unsigned char\n *sun_colormap;\n\n /*\n Read SUN raster colormap.\n */\n sun_colormap=(unsigned char *) AcquireQuantumMemory(sun_info.maplength,\n sizeof(*sun_colormap));\n if (sun_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,sun_info.maplength,sun_colormap);\n if (count != (ssize_t) sun_info.maplength)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap);\n break;\n }\n default:\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n }\n image->alpha_trait=sun_info.depth == 32 ? BlendPixelTrait :\n UndefinedPixelTrait;\n image->columns=sun_info.width;\n image->rows=sun_info.height;\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n if ((sun_info.length*sizeof(*sun_data))/sizeof(*sun_data) !=\n sun_info.length || !sun_info.length)\n ThrowReaderException(ResourceLimitError,\"ImproperImageHeader\");\n number_pixels=(MagickSizeType) image->columns*image->rows;\n if ((sun_info.type != RT_ENCODED) && \n ((number_pixels*sun_info.depth) > (8*sun_info.length)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n bytes_per_line=sun_info.width*sun_info.depth;\n sun_data=(unsigned char *) AcquireQuantumMemory((size_t) MagickMax(\n sun_info.length,bytes_per_line*sun_info.width),sizeof(*sun_data));\n if (sun_data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=(ssize_t) ReadBlob(image,sun_info.length,sun_data);\n if (count != (ssize_t) sun_info.length)\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n height=sun_info.height;\n if ((height == 0) || (sun_info.width == 0) || (sun_info.depth == 0) ||\n ((bytes_per_line/sun_info.depth) != sun_info.width))\n ThrowReaderException(ResourceLimitError,\"ImproperImageHeader\");\n bytes_per_line+=15;\n bytes_per_line<<=1;\n if ((bytes_per_line >> 1) != (sun_info.width*sun_info.depth+15))\n ThrowReaderException(ResourceLimitError,\"ImproperImageHeader\");\n bytes_per_line>>=4;\n sun_pixels=(unsigned char *) AcquireQuantumMemory(height,\n bytes_per_line*sizeof(*sun_pixels));\n if (sun_pixels == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (sun_info.type == RT_ENCODED)\n (void) DecodeImage(sun_data,sun_info.length,sun_pixels,bytes_per_line*\n height);\n else\n {\n if (sun_info.length > (height*bytes_per_line))\n ThrowReaderException(ResourceLimitError,\"ImproperImageHeader\");\n (void) CopyMagickMemory(sun_pixels,sun_data,sun_info.length);\n }\n sun_data=(unsigned char *) RelinquishMagickMemory(sun_data);\n /*\n Convert SUN raster image to pixel packets.\n */\n p=sun_pixels;\n if (sun_info.depth == 1)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < ((ssize_t) image->columns-7); x+=8)\n {\n for (bit=7; bit >= 0; bit--)\n {\n SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 : 0x01),\n q);\n q+=GetPixelChannels(image);\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=7; bit >= (int) (8-(image->columns % 8)); bit--)\n {\n SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 :\n 0x01),q);\n q+=GetPixelChannels(image);\n }\n p++;\n }\n if ((((image->columns/8)+(image->columns % 8 ? 1 : 0)) % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n else\n if (image->storage_class == PseudoClass)\n {\n if (bytes_per_line == 0)\n bytes_per_line=image->columns;\n length=image->rows*(image->columns+image->columns % 2);\n if (((sun_info.type == RT_ENCODED) &&\n (length > (bytes_per_line*image->rows))) ||\n ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p++,q);\n q+=GetPixelChannels(image);\n }\n if ((image->columns % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n size_t\n bytes_per_pixel;\n\n bytes_per_pixel=3;\n if (image->alpha_trait != UndefinedPixelTrait)\n bytes_per_pixel++;\n if (bytes_per_line == 0)\n bytes_per_line=bytes_per_pixel*image->columns;\n length=image->rows*(bytes_per_line+bytes_per_line % 2);\n if (((sun_info.type == RT_ENCODED) &&\n (length > (bytes_per_line*image->rows))) ||\n ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n if (sun_info.type == RT_STANDARD)\n {\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n }\n else\n {\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n }\n if (image->colors != 0)\n {\n SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelRed(image,q)].red),q);\n SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelGreen(image,q)].green),q);\n SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelBlue(image,q)].blue),q);\n }\n q+=GetPixelChannels(image);\n }\n if (((bytes_per_pixel*image->columns) % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n if (image->storage_class == PseudoClass)\n (void) SyncImage(image,exception);\n sun_pixels=(unsigned char *) RelinquishMagickMemory(sun_pixels);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n sun_info.magic=ReadBlobMSBLong(image);\n if (sun_info.magic == 0x59a66a95)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while (sun_info.magic == 0x59a66a95);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-125","target_token_count":3597,"sven_meta":{"func_name":"ReadSUNImage","file_name":"coders/sun.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/6b4aff0f117b978502ee5bcd6e753c17aec5a961","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#20-94262fe7e257","input":" */\nstatic void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)\n{\n\tst_entry ent;\n\twddx_stack *stack = (wddx_stack *)user_data;\n\n\tif (!strcmp(name, EL_PACKET)) {\n\t\tint i;\n\n\t\tif (atts) for (i=0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_VERSION)) {\n\t\t\t\t/* nothing for now */\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_STRING)) {\n\t\tent.type = ST_STRING;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_STRING;\n\t\tZ_STRVAL_P(ent.data) = STR_EMPTY_ALLOC();\n\t\tZ_STRLEN_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_BINARY)) {\n\t\tent.type = ST_BINARY;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_STRING;\n\t\tZ_STRVAL_P(ent.data) = STR_EMPTY_ALLOC();\n\t\tZ_STRLEN_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_CHAR)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_CHAR_CODE) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tchar tmp_buf[2];\n\n\t\t\t\tsnprintf(tmp_buf, sizeof(tmp_buf), \"%c\", (char)strtol(atts[i+1], NULL, 16));\n\t\t\t\tphp_wddx_process_data(user_data, tmp_buf, strlen(tmp_buf));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_NUMBER)) {\n\t\tent.type = ST_NUMBER;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_LONG;\n\t\tZ_LVAL_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_BOOLEAN)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_VALUE) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tent.type = ST_BOOLEAN;\n\t\t\t\tSET_STACK_VARNAME;\n\n\t\t\t\tALLOC_ZVAL(ent.data);\n\t\t\t\tINIT_PZVAL(ent.data);\n\t\t\t\tZ_TYPE_P(ent.data) = IS_BOOL;\n\t\t\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t\t\t\tphp_wddx_process_data(user_data, atts[i+1], strlen(atts[i+1]));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_NULL)) {\n\t\tent.type = ST_NULL;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZVAL_NULL(ent.data);\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_ARRAY)) {\n\t\tent.type = ST_ARRAY;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_STRUCT)) {\n\t\tent.type = ST_STRUCT;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_VAR)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_NAME) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tif (stack->varname) efree(stack->varname);\n\t\t\t\tstack->varname = estrdup(atts[i+1]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_RECORDSET)) {\n\t\tint i;\n\n\t\tent.type = ST_RECORDSET;\n\t\tSET_STACK_VARNAME;\n\t\tMAKE_STD_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], \"fieldNames\") && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tzval *tmp;\n\t\t\t\tchar *key;\n\t\t\t\tchar *p1, *p2, *endp;\n\n\t\t\t\ti++;\n\t\t\t\tendp = (char *)atts[i] + strlen(atts[i]);\n\t\t\t\tp1 = (char *)atts[i];\n\t\t\t\twhile ((p2 = php_memnstr(p1, \",\", sizeof(\",\")-1, endp)) != NULL) {\n\t\t\t\t\tkey = estrndup(p1, p2 - p1);\n\t\t\t\t\tMAKE_STD_ZVAL(tmp);\n\t\t\t\t\tarray_init(tmp);\n\t\t\t\t\tadd_assoc_zval_ex(ent.data, key, p2 - p1 + 1, tmp);\n\t\t\t\t\tp1 = p2 + sizeof(\",\")-1;\n\t\t\t\t\tefree(key);\n\t\t\t\t}\n\n\t\t\t\tif (p1 <= endp) {\n\t\t\t\t\tMAKE_STD_ZVAL(tmp);\n\t\t\t\t\tarray_init(tmp);\n\t\t\t\t\tadd_assoc_zval_ex(ent.data, p1, endp - p1 + 1, tmp);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_FIELD)) {\n\t\tint i;\n\t\tst_entry ent;\n\n\t\tent.type = ST_FIELD;\n\t\tent.varname = NULL;\n\t\tent.data = NULL;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_NAME) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tst_entry *recordset;\n\t\t\t\tzval **field;\n\n\t\t\t\tif (wddx_stack_top(stack, (void**)&recordset) == SUCCESS &&\n\t\t\t\t\trecordset->type == ST_RECORDSET &&\n\t\t\t\t\tzend_hash_find(Z_ARRVAL_P(recordset->data), (char*)atts[i+1], strlen(atts[i+1])+1, (void**)&field) == SUCCESS) {\n\t\t\t\t\tent.data = *field;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_DATETIME)) {\n\t\tent.type = ST_DATETIME;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_LONG;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t}","target":" */\nstatic void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)\n{\n\tst_entry ent;\n\twddx_stack *stack = (wddx_stack *)user_data;\n\n\tif (!strcmp(name, EL_PACKET)) {\n\t\tint i;\n\n\t\tif (atts) for (i=0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_VERSION)) {\n\t\t\t\t/* nothing for now */\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_STRING)) {\n\t\tent.type = ST_STRING;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_STRING;\n\t\tZ_STRVAL_P(ent.data) = STR_EMPTY_ALLOC();\n\t\tZ_STRLEN_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_BINARY)) {\n\t\tent.type = ST_BINARY;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_STRING;\n\t\tZ_STRVAL_P(ent.data) = STR_EMPTY_ALLOC();\n\t\tZ_STRLEN_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_CHAR)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_CHAR_CODE) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tchar tmp_buf[2];\n\n\t\t\t\tsnprintf(tmp_buf, sizeof(tmp_buf), \"%c\", (char)strtol(atts[i+1], NULL, 16));\n\t\t\t\tphp_wddx_process_data(user_data, tmp_buf, strlen(tmp_buf));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_NUMBER)) {\n\t\tent.type = ST_NUMBER;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_LONG;\n\t\tZ_LVAL_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_BOOLEAN)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_VALUE) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tent.type = ST_BOOLEAN;\n\t\t\t\tSET_STACK_VARNAME;\n\n\t\t\t\tALLOC_ZVAL(ent.data);\n\t\t\t\tINIT_PZVAL(ent.data);\n\t\t\t\tZ_TYPE_P(ent.data) = IS_BOOL;\n\t\t\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t\t\t\tphp_wddx_process_data(user_data, atts[i+1], strlen(atts[i+1]));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tent.type = ST_BOOLEAN;\n\t\t\tSET_STACK_VARNAME;\n\t\t\tZVAL_FALSE(&ent.data);\n\t\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t\t}\n\t} else if (!strcmp(name, EL_NULL)) {\n\t\tent.type = ST_NULL;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZVAL_NULL(ent.data);\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_ARRAY)) {\n\t\tent.type = ST_ARRAY;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_STRUCT)) {\n\t\tent.type = ST_STRUCT;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_VAR)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_NAME) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tif (stack->varname) efree(stack->varname);\n\t\t\t\tstack->varname = estrdup(atts[i+1]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_RECORDSET)) {\n\t\tint i;\n\n\t\tent.type = ST_RECORDSET;\n\t\tSET_STACK_VARNAME;\n\t\tMAKE_STD_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], \"fieldNames\") && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tzval *tmp;\n\t\t\t\tchar *key;\n\t\t\t\tchar *p1, *p2, *endp;\n\n\t\t\t\ti++;\n\t\t\t\tendp = (char *)atts[i] + strlen(atts[i]);\n\t\t\t\tp1 = (char *)atts[i];\n\t\t\t\twhile ((p2 = php_memnstr(p1, \",\", sizeof(\",\")-1, endp)) != NULL) {\n\t\t\t\t\tkey = estrndup(p1, p2 - p1);\n\t\t\t\t\tMAKE_STD_ZVAL(tmp);\n\t\t\t\t\tarray_init(tmp);\n\t\t\t\t\tadd_assoc_zval_ex(ent.data, key, p2 - p1 + 1, tmp);\n\t\t\t\t\tp1 = p2 + sizeof(\",\")-1;\n\t\t\t\t\tefree(key);\n\t\t\t\t}\n\n\t\t\t\tif (p1 <= endp) {\n\t\t\t\t\tMAKE_STD_ZVAL(tmp);\n\t\t\t\t\tarray_init(tmp);\n\t\t\t\t\tadd_assoc_zval_ex(ent.data, p1, endp - p1 + 1, tmp);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_FIELD)) {\n\t\tint i;\n\t\tst_entry ent;\n\n\t\tent.type = ST_FIELD;\n\t\tent.varname = NULL;\n\t\tent.data = NULL;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_NAME) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tst_entry *recordset;\n\t\t\t\tzval **field;\n\n\t\t\t\tif (wddx_stack_top(stack, (void**)&recordset) == SUCCESS &&\n\t\t\t\t\trecordset->type == ST_RECORDSET &&\n\t\t\t\t\tzend_hash_find(Z_ARRVAL_P(recordset->data), (char*)atts[i+1], strlen(atts[i+1])+1, (void**)&field) == SUCCESS) {\n\t\t\t\t\tent.data = *field;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_DATETIME)) {\n\t\tent.type = ST_DATETIME;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_LONG;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t}","lang":"c","vul_type":"cwe-125","target_token_count":1642,"sven_meta":{"func_name":"php_wddx_push_element","file_name":"ext/wddx/wddx.c","commit_link":"github.com/php/php-src/commit/66fd44209d5ffcb9b3d1bc1b9fd8e35b485040c0","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#21-40a0bf56b0e3","input":"SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)\n{\n\tstruct smb_rqst rqst;\n\tstruct smb2_negotiate_req *req;\n\tstruct smb2_negotiate_rsp *rsp;\n\tstruct kvec iov[1];\n\tstruct kvec rsp_iov;\n\tint rc = 0;\n\tint resp_buftype;\n\tstruct TCP_Server_Info *server = ses->server;\n\tint blob_offset, blob_length;\n\tchar *security_blob;\n\tint flags = CIFS_NEG_OP;\n\tunsigned int total_len;\n\n\tcifs_dbg(FYI, \"Negotiate protocol\\n\");\n\n\tif (!server) {\n\t\tWARN(1, \"%s: server is NULL!\\n\", __func__);\n\t\treturn -EIO;\n\t}\n\n\trc = smb2_plain_req_init(SMB2_NEGOTIATE, NULL, (void **) &req, &total_len);\n\tif (rc)\n\t\treturn rc;\n\n\treq->sync_hdr.SessionId = 0;\n\n\tmemset(server->preauth_sha_hash, 0, SMB2_PREAUTH_HASH_SIZE);\n\tmemset(ses->preauth_sha_hash, 0, SMB2_PREAUTH_HASH_SIZE);\n\n\tif (strcmp(ses->server->vals->version_string,\n\t\t SMB3ANY_VERSION_STRING) == 0) {\n\t\treq->Dialects[0] = cpu_to_le16(SMB30_PROT_ID);\n\t\treq->Dialects[1] = cpu_to_le16(SMB302_PROT_ID);\n\t\treq->DialectCount = cpu_to_le16(2);\n\t\ttotal_len += 4;\n\t} else if (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0) {\n\t\treq->Dialects[0] = cpu_to_le16(SMB21_PROT_ID);\n\t\treq->Dialects[1] = cpu_to_le16(SMB30_PROT_ID);\n\t\treq->Dialects[2] = cpu_to_le16(SMB302_PROT_ID);\n\t\treq->Dialects[3] = cpu_to_le16(SMB311_PROT_ID);\n\t\treq->DialectCount = cpu_to_le16(4);\n\t\ttotal_len += 8;\n\t} else {\n\t\t/* otherwise send specific dialect */\n\t\treq->Dialects[0] = cpu_to_le16(ses->server->vals->protocol_id);\n\t\treq->DialectCount = cpu_to_le16(1);\n\t\ttotal_len += 2;\n\t}\n\n\t/* only one of SMB2 signing flags may be set in SMB2 request */\n\tif (ses->sign)\n\t\treq->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_REQUIRED);\n\telse if (global_secflags & CIFSSEC_MAY_SIGN)\n\t\treq->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_ENABLED);\n\telse\n\t\treq->SecurityMode = 0;\n\n\treq->Capabilities = cpu_to_le32(ses->server->vals->req_capabilities);\n\n\t/* ClientGUID must be zero for SMB2.02 dialect */\n\tif (ses->server->vals->protocol_id == SMB20_PROT_ID)\n\t\tmemset(req->ClientGUID, 0, SMB2_CLIENT_GUID_SIZE);\n\telse {\n\t\tmemcpy(req->ClientGUID, server->client_guid,\n\t\t\tSMB2_CLIENT_GUID_SIZE);\n\t\tif ((ses->server->vals->protocol_id == SMB311_PROT_ID) ||\n\t\t (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0))\n\t\t\tassemble_neg_contexts(req, &total_len);\n\t}\n\tiov[0].iov_base = (char *)req;\n\tiov[0].iov_len = total_len;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = 1;\n\n\trc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);\n\tcifs_small_buf_release(req);\n\trsp = (struct smb2_negotiate_rsp *)rsp_iov.iov_base;\n\t/*\n\t * No tcon so can't do\n\t * cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);\n\t */\n\tif (rc == -EOPNOTSUPP) {\n\t\tcifs_dbg(VFS, \"Dialect not supported by server. Consider \"\n\t\t\t\"specifying vers=1.0 or vers=2.0 on mount for accessing\"\n\t\t\t\" older servers\\n\");\n\t\tgoto neg_exit;\n\t} else if (rc != 0)\n\t\tgoto neg_exit;\n\n\tif (strcmp(ses->server->vals->version_string,\n\t\t SMB3ANY_VERSION_STRING) == 0) {\n\t\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2.1 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t}\n\t} else if (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0) {\n\t\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) {\n\t\t\t/* ops set to 3.0 by default for default so update */\n\t\t\tses->server->ops = &smb21_operations;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID))\n\t\t\tses->server->ops = &smb311_operations;\n\t} else if (le16_to_cpu(rsp->DialectRevision) !=\n\t\t\t\tses->server->vals->protocol_id) {\n\t\t/* if requested single dialect ensure returned dialect matched */\n\t\tcifs_dbg(VFS, \"Illegal 0x%x dialect returned: not requested\\n\",\n\t\t\tle16_to_cpu(rsp->DialectRevision));\n\t\treturn -EIO;\n\t}\n\n\tcifs_dbg(FYI, \"mode 0x%x\\n\", rsp->SecurityMode);\n\n\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb2.0 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb2.1 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB30_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.0 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB302_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.02 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.1.1 dialect\\n\");\n\telse {\n\t\tcifs_dbg(VFS, \"Illegal dialect returned by server 0x%x\\n\",\n\t\t\t le16_to_cpu(rsp->DialectRevision));\n\t\trc = -EIO;\n\t\tgoto neg_exit;\n\t}\n\tserver->dialect = le16_to_cpu(rsp->DialectRevision);\n\n\t/*\n\t * Keep a copy of the hash after negprot. This hash will be\n\t * the starting hash value for all sessions made from this\n\t * server.\n\t */\n\tmemcpy(server->preauth_sha_hash, ses->preauth_sha_hash,\n\t SMB2_PREAUTH_HASH_SIZE);\n\n\t/* SMB2 only has an extended negflavor */\n\tserver->negflavor = CIFS_NEGFLAVOR_EXTENDED;\n\t/* set it to the maximum buffer size value we can send with 1 credit */\n\tserver->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),\n\t\t\t SMB2_MAX_BUFFER_SIZE);\n\tserver->max_read = le32_to_cpu(rsp->MaxReadSize);\n\tserver->max_write = le32_to_cpu(rsp->MaxWriteSize);\n\tserver->sec_mode = le16_to_cpu(rsp->SecurityMode);\n\tif ((server->sec_mode & SMB2_SEC_MODE_FLAGS_ALL) != server->sec_mode)\n\t\tcifs_dbg(FYI, \"Server returned unexpected security mode 0x%x\\n\",\n\t\t\t\tserver->sec_mode);\n\tserver->capabilities = le32_to_cpu(rsp->Capabilities);\n\t/* Internal types */\n\tserver->capabilities |= SMB2_NT_FIND | SMB2_LARGE_FILES;\n\n\tsecurity_blob = smb2_get_data_area_len(&blob_offset, &blob_length,\n\t\t\t\t\t (struct smb2_sync_hdr *)rsp);\n\t/*\n\t * See MS-SMB2 section 2.2.4: if no blob, client picks default which\n\t * for us will be\n\t *\tses->sectype = RawNTLMSSP;\n\t * but for time being this is our only auth choice so doesn't matter.\n\t * We just found a server which sets blob length to zero expecting raw.\n\t */\n\tif (blob_length == 0) {\n\t\tcifs_dbg(FYI, \"missing security blob on negprot\\n\");\n\t\tserver->sec_ntlmssp = true;\n\t}\n\n\trc = cifs_enable_signing(server, ses->sign);\n\tif (rc)\n\t\tgoto neg_exit;\n\tif (blob_length) {\n\t\trc = decode_negTokenInit(security_blob, blob_length, server);\n\t\tif (rc == 1)\n\t\t\trc = 0;\n\t\telse if (rc == 0)\n\t\t\trc = -EIO;\n\t}\n\n\tif (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) {\n\t\tif (rsp->NegotiateContextCount)\n\t\t\trc = smb311_decode_neg_context(rsp, server,\n\t\t\t\t\t\t rsp_iov.iov_len);\n\t\telse\n\t\t\tcifs_dbg(VFS, \"Missing expected negotiate contexts\\n\");\n\t}\nneg_exit:\n\tfree_rsp_buf(resp_buftype, rsp);\n\treturn rc;\n}","target":"SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)\n{\n\tstruct smb_rqst rqst;\n\tstruct smb2_negotiate_req *req;\n\tstruct smb2_negotiate_rsp *rsp;\n\tstruct kvec iov[1];\n\tstruct kvec rsp_iov;\n\tint rc = 0;\n\tint resp_buftype;\n\tstruct TCP_Server_Info *server = ses->server;\n\tint blob_offset, blob_length;\n\tchar *security_blob;\n\tint flags = CIFS_NEG_OP;\n\tunsigned int total_len;\n\n\tcifs_dbg(FYI, \"Negotiate protocol\\n\");\n\n\tif (!server) {\n\t\tWARN(1, \"%s: server is NULL!\\n\", __func__);\n\t\treturn -EIO;\n\t}\n\n\trc = smb2_plain_req_init(SMB2_NEGOTIATE, NULL, (void **) &req, &total_len);\n\tif (rc)\n\t\treturn rc;\n\n\treq->sync_hdr.SessionId = 0;\n\n\tmemset(server->preauth_sha_hash, 0, SMB2_PREAUTH_HASH_SIZE);\n\tmemset(ses->preauth_sha_hash, 0, SMB2_PREAUTH_HASH_SIZE);\n\n\tif (strcmp(ses->server->vals->version_string,\n\t\t SMB3ANY_VERSION_STRING) == 0) {\n\t\treq->Dialects[0] = cpu_to_le16(SMB30_PROT_ID);\n\t\treq->Dialects[1] = cpu_to_le16(SMB302_PROT_ID);\n\t\treq->DialectCount = cpu_to_le16(2);\n\t\ttotal_len += 4;\n\t} else if (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0) {\n\t\treq->Dialects[0] = cpu_to_le16(SMB21_PROT_ID);\n\t\treq->Dialects[1] = cpu_to_le16(SMB30_PROT_ID);\n\t\treq->Dialects[2] = cpu_to_le16(SMB302_PROT_ID);\n\t\treq->Dialects[3] = cpu_to_le16(SMB311_PROT_ID);\n\t\treq->DialectCount = cpu_to_le16(4);\n\t\ttotal_len += 8;\n\t} else {\n\t\t/* otherwise send specific dialect */\n\t\treq->Dialects[0] = cpu_to_le16(ses->server->vals->protocol_id);\n\t\treq->DialectCount = cpu_to_le16(1);\n\t\ttotal_len += 2;\n\t}\n\n\t/* only one of SMB2 signing flags may be set in SMB2 request */\n\tif (ses->sign)\n\t\treq->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_REQUIRED);\n\telse if (global_secflags & CIFSSEC_MAY_SIGN)\n\t\treq->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_ENABLED);\n\telse\n\t\treq->SecurityMode = 0;\n\n\treq->Capabilities = cpu_to_le32(ses->server->vals->req_capabilities);\n\n\t/* ClientGUID must be zero for SMB2.02 dialect */\n\tif (ses->server->vals->protocol_id == SMB20_PROT_ID)\n\t\tmemset(req->ClientGUID, 0, SMB2_CLIENT_GUID_SIZE);\n\telse {\n\t\tmemcpy(req->ClientGUID, server->client_guid,\n\t\t\tSMB2_CLIENT_GUID_SIZE);\n\t\tif ((ses->server->vals->protocol_id == SMB311_PROT_ID) ||\n\t\t (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0))\n\t\t\tassemble_neg_contexts(req, &total_len);\n\t}\n\tiov[0].iov_base = (char *)req;\n\tiov[0].iov_len = total_len;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = 1;\n\n\trc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);\n\tcifs_small_buf_release(req);\n\trsp = (struct smb2_negotiate_rsp *)rsp_iov.iov_base;\n\t/*\n\t * No tcon so can't do\n\t * cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);\n\t */\n\tif (rc == -EOPNOTSUPP) {\n\t\tcifs_dbg(VFS, \"Dialect not supported by server. Consider \"\n\t\t\t\"specifying vers=1.0 or vers=2.0 on mount for accessing\"\n\t\t\t\" older servers\\n\");\n\t\tgoto neg_exit;\n\t} else if (rc != 0)\n\t\tgoto neg_exit;\n\n\tif (strcmp(ses->server->vals->version_string,\n\t\t SMB3ANY_VERSION_STRING) == 0) {\n\t\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2.1 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t}\n\t} else if (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0) {\n\t\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) {\n\t\t\t/* ops set to 3.0 by default for default so update */\n\t\t\tses->server->ops = &smb21_operations;\n\t\t\tses->server->vals = &smb21_values;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) {\n\t\t\tses->server->ops = &smb311_operations;\n\t\t\tses->server->vals = &smb311_values;\n\t\t}\n\t} else if (le16_to_cpu(rsp->DialectRevision) !=\n\t\t\t\tses->server->vals->protocol_id) {\n\t\t/* if requested single dialect ensure returned dialect matched */\n\t\tcifs_dbg(VFS, \"Illegal 0x%x dialect returned: not requested\\n\",\n\t\t\tle16_to_cpu(rsp->DialectRevision));\n\t\treturn -EIO;\n\t}\n\n\tcifs_dbg(FYI, \"mode 0x%x\\n\", rsp->SecurityMode);\n\n\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb2.0 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb2.1 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB30_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.0 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB302_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.02 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.1.1 dialect\\n\");\n\telse {\n\t\tcifs_dbg(VFS, \"Illegal dialect returned by server 0x%x\\n\",\n\t\t\t le16_to_cpu(rsp->DialectRevision));\n\t\trc = -EIO;\n\t\tgoto neg_exit;\n\t}\n\tserver->dialect = le16_to_cpu(rsp->DialectRevision);\n\n\t/*\n\t * Keep a copy of the hash after negprot. This hash will be\n\t * the starting hash value for all sessions made from this\n\t * server.\n\t */\n\tmemcpy(server->preauth_sha_hash, ses->preauth_sha_hash,\n\t SMB2_PREAUTH_HASH_SIZE);\n\n\t/* SMB2 only has an extended negflavor */\n\tserver->negflavor = CIFS_NEGFLAVOR_EXTENDED;\n\t/* set it to the maximum buffer size value we can send with 1 credit */\n\tserver->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),\n\t\t\t SMB2_MAX_BUFFER_SIZE);\n\tserver->max_read = le32_to_cpu(rsp->MaxReadSize);\n\tserver->max_write = le32_to_cpu(rsp->MaxWriteSize);\n\tserver->sec_mode = le16_to_cpu(rsp->SecurityMode);\n\tif ((server->sec_mode & SMB2_SEC_MODE_FLAGS_ALL) != server->sec_mode)\n\t\tcifs_dbg(FYI, \"Server returned unexpected security mode 0x%x\\n\",\n\t\t\t\tserver->sec_mode);\n\tserver->capabilities = le32_to_cpu(rsp->Capabilities);\n\t/* Internal types */\n\tserver->capabilities |= SMB2_NT_FIND | SMB2_LARGE_FILES;\n\n\tsecurity_blob = smb2_get_data_area_len(&blob_offset, &blob_length,\n\t\t\t\t\t (struct smb2_sync_hdr *)rsp);\n\t/*\n\t * See MS-SMB2 section 2.2.4: if no blob, client picks default which\n\t * for us will be\n\t *\tses->sectype = RawNTLMSSP;\n\t * but for time being this is our only auth choice so doesn't matter.\n\t * We just found a server which sets blob length to zero expecting raw.\n\t */\n\tif (blob_length == 0) {\n\t\tcifs_dbg(FYI, \"missing security blob on negprot\\n\");\n\t\tserver->sec_ntlmssp = true;\n\t}\n\n\trc = cifs_enable_signing(server, ses->sign);\n\tif (rc)\n\t\tgoto neg_exit;\n\tif (blob_length) {\n\t\trc = decode_negTokenInit(security_blob, blob_length, server);\n\t\tif (rc == 1)\n\t\t\trc = 0;\n\t\telse if (rc == 0)\n\t\t\trc = -EIO;\n\t}\n\n\tif (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) {\n\t\tif (rsp->NegotiateContextCount)\n\t\t\trc = smb311_decode_neg_context(rsp, server,\n\t\t\t\t\t\t rsp_iov.iov_len);\n\t\telse\n\t\t\tcifs_dbg(VFS, \"Missing expected negotiate contexts\\n\");\n\t}\nneg_exit:\n\tfree_rsp_buf(resp_buftype, rsp);\n\treturn rc;\n}","lang":"c","vul_type":"cwe-125","target_token_count":2301,"sven_meta":{"func_name":"SMB2_negotiate","file_name":"fs/cifs/smb2pdu.c","commit_link":"github.com/torvalds/linux/commit/b57a55e2200ede754e4dc9cce4ba9402544b9365","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#22-a2da886f1883","input":"static ssize_t parse8BIM(Image *ifile, Image *ofile)\n{\n char\n brkused,\n quoted,\n *line,\n *token,\n *newstr,\n *name;\n\n int\n state,\n next;\n\n unsigned char\n dataset;\n\n unsigned int\n recnum;\n\n int\n inputlen = MaxTextExtent;\n\n MagickOffsetType\n savedpos,\n currentpos;\n\n ssize_t\n savedolen = 0L,\n outputlen = 0L;\n\n TokenInfo\n *token_info;\n\n dataset = 0;\n recnum = 0;\n line = (char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*line));\n if (line == (char *) NULL)\n return(-1);\n newstr = name = token = (char *) NULL;\n savedpos = 0;\n token_info=AcquireTokenInfo();\n while (super_fgets(&line,&inputlen,ifile)!=NULL)\n {\n state=0;\n next=0;\n\n token=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*token));\n if (token == (char *) NULL)\n break;\n newstr=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*newstr));\n if (newstr == (char *) NULL)\n break;\n while (Tokenizer(token_info,0,token,(size_t) inputlen,line,\"\",\"=\",\"\\\"\",0,\n &brkused,&next,"ed)==0)\n {\n if (state == 0)\n {\n int\n state,\n next;\n\n char\n brkused,\n quoted;\n\n state=0;\n next=0;\n while (Tokenizer(token_info,0,newstr,(size_t) inputlen,token,\"\",\"#\",\n \"\", 0,&brkused,&next,"ed)==0)\n {\n switch (state)\n {\n case 0:\n if (strcmp(newstr,\"8BIM\")==0)\n dataset = 255;\n else\n dataset = (unsigned char) StringToLong(newstr);\n break;\n case 1:\n recnum = (unsigned int) StringToUnsignedLong(newstr);\n break;\n case 2:\n name=(char *) AcquireQuantumMemory(strlen(newstr)+MaxTextExtent,\n sizeof(*name));\n if (name)\n (void) strcpy(name,newstr);\n break;\n }\n state++;\n }\n }\n else\n if (state == 1)\n {\n int\n next;\n\n ssize_t\n len;\n\n char\n brkused,\n quoted;\n\n next=0;\n len = (ssize_t) strlen(token);\n while (Tokenizer(token_info,0,newstr,(size_t) inputlen,token,\"\",\"&\",\n \"\",0,&brkused,&next,"ed)==0)\n {\n if (brkused && next > 0)\n {\n char\n *s = &token[next-1];\n\n len -= (ssize_t) convertHTMLcodes(s,(int) strlen(s));\n }\n }\n\n if (dataset == 255)\n {\n unsigned char\n nlen = 0;\n\n int\n i;\n\n if (savedolen > 0)\n {\n MagickOffsetType\n offset;\n\n ssize_t diff = outputlen - savedolen;\n currentpos = TellBlob(ofile);\n if (currentpos < 0)\n return(-1);\n offset=SeekBlob(ofile,savedpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n (void) WriteBlobMSBLong(ofile,(unsigned int) diff);\n offset=SeekBlob(ofile,currentpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n savedolen = 0L;\n }\n if (outputlen & 1)\n {\n (void) WriteBlobByte(ofile,0x00);\n outputlen++;\n }\n (void) WriteBlobString(ofile,\"8BIM\");\n (void) WriteBlobMSBShort(ofile,(unsigned short) recnum);\n outputlen += 6;\n if (name)\n nlen = (unsigned char) strlen(name);\n (void) WriteBlobByte(ofile,nlen);\n outputlen++;\n for (i=0; i 0)\n {\n MagickOffsetType\n offset;\n\n ssize_t diff = outputlen - savedolen;\n\n currentpos = TellBlob(ofile);\n if (currentpos < 0)\n return(-1);\n offset=SeekBlob(ofile,savedpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n (void) WriteBlobMSBLong(ofile,(unsigned int) diff);\n offset=SeekBlob(ofile,currentpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n savedolen = 0L;\n }\n return(outputlen);\n}","target":"static ssize_t parse8BIM(Image *ifile, Image *ofile)\n{\n char\n brkused,\n quoted,\n *line,\n *token,\n *newstr,\n *name;\n\n int\n state,\n next;\n\n unsigned char\n dataset;\n\n unsigned int\n recnum;\n\n int\n inputlen = MaxTextExtent;\n\n MagickOffsetType\n savedpos,\n currentpos;\n\n ssize_t\n savedolen = 0L,\n outputlen = 0L;\n\n TokenInfo\n *token_info;\n\n dataset = 0;\n recnum = 0;\n line = (char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*line));\n if (line == (char *) NULL)\n return(-1);\n newstr = name = token = (char *) NULL;\n savedpos = 0;\n token_info=AcquireTokenInfo();\n while (super_fgets(&line,&inputlen,ifile)!=NULL)\n {\n state=0;\n next=0;\n\n token=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*token));\n if (token == (char *) NULL)\n break;\n newstr=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*newstr));\n if (newstr == (char *) NULL)\n break;\n while (Tokenizer(token_info,0,token,(size_t) inputlen,line,\"\",\"=\",\"\\\"\",0,\n &brkused,&next,"ed)==0)\n {\n if (state == 0)\n {\n int\n state,\n next;\n\n char\n brkused,\n quoted;\n\n state=0;\n next=0;\n while (Tokenizer(token_info,0,newstr,(size_t) inputlen,token,\"\",\"#\",\n \"\", 0,&brkused,&next,"ed)==0)\n {\n switch (state)\n {\n case 0:\n if (strcmp(newstr,\"8BIM\")==0)\n dataset = 255;\n else\n dataset = (unsigned char) StringToLong(newstr);\n break;\n case 1:\n recnum = (unsigned int) StringToUnsignedLong(newstr);\n break;\n case 2:\n name=(char *) AcquireQuantumMemory(strlen(newstr)+MaxTextExtent,\n sizeof(*name));\n if (name)\n (void) strcpy(name,newstr);\n break;\n }\n state++;\n }\n }\n else\n if (state == 1)\n {\n int\n next;\n\n ssize_t\n len;\n\n char\n brkused,\n quoted;\n\n next=0;\n len = (ssize_t) strlen(token);\n while (Tokenizer(token_info,0,newstr,(size_t) inputlen,token,\"\",\"&\",\n \"\",0,&brkused,&next,"ed)==0)\n {\n if (brkused && next > 0)\n {\n char\n *s = &token[next-1];\n\n len -= (ssize_t) convertHTMLcodes(s,(int) strlen(s));\n }\n }\n\n if (dataset == 255)\n {\n unsigned char\n nlen = 0;\n\n int\n i;\n\n if (savedolen > 0)\n {\n MagickOffsetType\n offset;\n\n ssize_t diff = outputlen - savedolen;\n currentpos = TellBlob(ofile);\n if (currentpos < 0)\n return(-1);\n offset=SeekBlob(ofile,savedpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n (void) WriteBlobMSBLong(ofile,(unsigned int) diff);\n offset=SeekBlob(ofile,currentpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n savedolen = 0L;\n }\n if (outputlen & 1)\n {\n (void) WriteBlobByte(ofile,0x00);\n outputlen++;\n }\n (void) WriteBlobString(ofile,\"8BIM\");\n (void) WriteBlobMSBShort(ofile,(unsigned short) recnum);\n outputlen += 6;\n if (name)\n nlen = (unsigned char) strlen(name);\n (void) WriteBlobByte(ofile,nlen);\n outputlen++;\n for (i=0; i 0)\n (void) WriteBlobByte(ofile,(unsigned char) token[next++]);\n\n if (outputlen & 1)\n {\n (void) WriteBlobByte(ofile,0x00);\n outputlen++;\n }\n }\n else\n {\n /* patch in a fake length for now and fix it later */\n savedpos = TellBlob(ofile);\n if (savedpos < 0)\n return(-1);\n (void) WriteBlobMSBLong(ofile,0xFFFFFFFFU);\n outputlen += 4;\n savedolen = outputlen;\n }\n }\n else\n {\n if (len <= 0x7FFF)\n {\n (void) WriteBlobByte(ofile,0x1c);\n (void) WriteBlobByte(ofile,(unsigned char) dataset);\n (void) WriteBlobByte(ofile,(unsigned char) (recnum & 0xff));\n (void) WriteBlobMSBShort(ofile,(unsigned short) len);\n outputlen += 5;\n next=0;\n outputlen += len;\n while (len-- > 0)\n (void) WriteBlobByte(ofile,(unsigned char) token[next++]);\n }\n }\n }\n state++;\n }\n if (token != (char *) NULL)\n token=DestroyString(token);\n if (newstr != (char *) NULL)\n newstr=DestroyString(newstr);\n if (name != (char *) NULL)\n name=DestroyString(name);\n }\n token_info=DestroyTokenInfo(token_info);\n if (token != (char *) NULL)\n token=DestroyString(token);\n if (newstr != (char *) NULL)\n newstr=DestroyString(newstr);\n if (name != (char *) NULL)\n name=DestroyString(name);\n line=DestroyString(line);\n if (savedolen > 0)\n {\n MagickOffsetType\n offset;\n\n ssize_t diff = outputlen - savedolen;\n\n currentpos = TellBlob(ofile);\n if (currentpos < 0)\n return(-1);\n offset=SeekBlob(ofile,savedpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n (void) WriteBlobMSBLong(ofile,(unsigned int) diff);\n offset=SeekBlob(ofile,currentpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n savedolen = 0L;\n }\n return(outputlen);\n}","lang":"c","vul_type":"cwe-125","target_token_count":1616,"sven_meta":{"func_name":"parse8BIM","file_name":"coders/meta.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/97c9f438a9b3454d085895f4d1f66389fd22a0fb","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#23-045700336180","input":"int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config)\n{\n int64_t infilesize, total_samples;\n DFFFileHeader dff_file_header;\n DFFChunkHeader dff_chunk_header;\n uint32_t bcount;\n\n infilesize = DoGetFileSize (infile);\n memcpy (&dff_file_header, fourcc, 4);\n\n if ((!DoReadFile (infile, ((char *) &dff_file_header) + 4, sizeof (DFFFileHeader) - 4, &bcount) ||\n bcount != sizeof (DFFFileHeader) - 4) || strncmp (dff_file_header.formType, \"DSD \", 4)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &dff_file_header, sizeof (DFFFileHeader))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n#if 1 // this might be a little too picky...\n WavpackBigEndianToNative (&dff_file_header, DFFFileHeaderFormat);\n\n if (infilesize && !(config->qmode & QMODE_IGNORE_LENGTH) &&\n dff_file_header.ckDataSize && dff_file_header.ckDataSize + 1 && dff_file_header.ckDataSize + 12 != infilesize) {\n error_line (\"%s is not a valid .DFF file (by total size)!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n\n if (debug_logging_mode)\n error_line (\"file header indicated length = %lld\", dff_file_header.ckDataSize);\n\n#endif\n\n // loop through all elements of the DSDIFF header\n // (until the data chuck) and copy them to the output file\n\n while (1) {\n if (!DoReadFile (infile, &dff_chunk_header, sizeof (DFFChunkHeader), &bcount) ||\n bcount != sizeof (DFFChunkHeader)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &dff_chunk_header, sizeof (DFFChunkHeader))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n WavpackBigEndianToNative (&dff_chunk_header, DFFChunkHeaderFormat);\n\n if (debug_logging_mode)\n error_line (\"chunk header indicated length = %lld\", dff_chunk_header.ckDataSize);\n\n if (!strncmp (dff_chunk_header.ckID, \"FVER\", 4)) {\n uint32_t version;\n\n if (dff_chunk_header.ckDataSize != sizeof (version) ||\n !DoReadFile (infile, &version, sizeof (version), &bcount) ||\n bcount != sizeof (version)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &version, sizeof (version))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n WavpackBigEndianToNative (&version, \"L\");\n\n if (debug_logging_mode)\n error_line (\"dsdiff file version = 0x%08x\", version);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"PROP\", 4)) {\n char *prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);\n\n if (!DoReadFile (infile, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize, &bcount) ||\n bcount != dff_chunk_header.ckDataSize) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize)) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n\n if (!strncmp (prop_chunk, \"SND \", 4)) {\n char *cptr = prop_chunk + 4, *eptr = prop_chunk + dff_chunk_header.ckDataSize;\n uint16_t numChannels, chansSpecified, chanMask = 0;\n uint32_t sampleRate;\n\n while (eptr - cptr >= sizeof (dff_chunk_header)) {\n memcpy (&dff_chunk_header, cptr, sizeof (dff_chunk_header));\n cptr += sizeof (dff_chunk_header);\n WavpackBigEndianToNative (&dff_chunk_header, DFFChunkHeaderFormat);\n\n if (eptr - cptr >= dff_chunk_header.ckDataSize) {\n if (!strncmp (dff_chunk_header.ckID, \"FS \", 4) && dff_chunk_header.ckDataSize == 4) {\n memcpy (&sampleRate, cptr, sizeof (sampleRate));\n WavpackBigEndianToNative (&sampleRate, \"L\");\n cptr += dff_chunk_header.ckDataSize;\n\n if (debug_logging_mode)\n error_line (\"got sample rate of %u Hz\", sampleRate);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"CHNL\", 4) && dff_chunk_header.ckDataSize >= 2) {\n memcpy (&numChannels, cptr, sizeof (numChannels));\n WavpackBigEndianToNative (&numChannels, \"S\");\n cptr += sizeof (numChannels);\n\n chansSpecified = (int)(dff_chunk_header.ckDataSize - sizeof (numChannels)) / 4;\n\n while (chansSpecified--) {\n if (!strncmp (cptr, \"SLFT\", 4) || !strncmp (cptr, \"MLFT\", 4))\n chanMask |= 0x1;\n else if (!strncmp (cptr, \"SRGT\", 4) || !strncmp (cptr, \"MRGT\", 4))\n chanMask |= 0x2;\n else if (!strncmp (cptr, \"LS \", 4))\n chanMask |= 0x10;\n else if (!strncmp (cptr, \"RS \", 4))\n chanMask |= 0x20;\n else if (!strncmp (cptr, \"C \", 4))\n chanMask |= 0x4;\n else if (!strncmp (cptr, \"LFE \", 4))\n chanMask |= 0x8;\n else\n if (debug_logging_mode)\n error_line (\"undefined channel ID %c%c%c%c\", cptr [0], cptr [1], cptr [2], cptr [3]);\n\n cptr += 4;\n }\n\n if (debug_logging_mode)\n error_line (\"%d channels, mask = 0x%08x\", numChannels, chanMask);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"CMPR\", 4) && dff_chunk_header.ckDataSize >= 4) {\n if (strncmp (cptr, \"DSD \", 4)) {\n error_line (\"DSDIFF files must be uncompressed, not \\\"%c%c%c%c\\\"!\",\n cptr [0], cptr [1], cptr [2], cptr [3]);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n\n cptr += dff_chunk_header.ckDataSize;\n }\n else {\n if (debug_logging_mode)\n error_line (\"got PROP/SND chunk type \\\"%c%c%c%c\\\" of %d bytes\", dff_chunk_header.ckID [0],\n dff_chunk_header.ckID [1], dff_chunk_header.ckID [2], dff_chunk_header.ckID [3], dff_chunk_header.ckDataSize);\n\n cptr += dff_chunk_header.ckDataSize;\n }\n }\n else {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n }\n\n if (chanMask && (config->channel_mask || (config->qmode & QMODE_CHANS_UNASSIGNED))) {\n error_line (\"this DSDIFF file already has channel order information!\");\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n else if (chanMask)\n config->channel_mask = chanMask;\n\n config->bits_per_sample = 8;\n config->bytes_per_sample = 1;\n config->num_channels = numChannels;\n config->sample_rate = sampleRate / 8;\n config->qmode |= QMODE_DSD_MSB_FIRST;\n }\n else if (debug_logging_mode)\n error_line (\"got unknown PROP chunk type \\\"%c%c%c%c\\\" of %d bytes\",\n prop_chunk [0], prop_chunk [1], prop_chunk [2], prop_chunk [3], dff_chunk_header.ckDataSize);\n\n free (prop_chunk);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"DSD \", 4)) {\n total_samples = dff_chunk_header.ckDataSize / config->num_channels;\n break;\n }\n else { // just copy unknown chunks to output file\n\n int bytes_to_copy = (int)(((dff_chunk_header.ckDataSize) + 1) & ~(int64_t)1);\n char *buff = malloc (bytes_to_copy);\n\n if (debug_logging_mode)\n error_line (\"extra unknown chunk \\\"%c%c%c%c\\\" of %d bytes\",\n dff_chunk_header.ckID [0], dff_chunk_header.ckID [1], dff_chunk_header.ckID [2],\n dff_chunk_header.ckID [3], dff_chunk_header.ckDataSize);\n\n if (!DoReadFile (infile, buff, bytes_to_copy, &bcount) ||\n bcount != bytes_to_copy ||\n (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, buff, bytes_to_copy))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n free (buff);\n return WAVPACK_SOFT_ERROR;\n }\n\n free (buff);\n }\n }\n\n if (debug_logging_mode)\n error_line (\"setting configuration with %lld samples\", total_samples);\n\n if (!WavpackSetConfiguration64 (wpc, config, total_samples, NULL)) {\n error_line (\"%s: %s\", infilename, WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n return WAVPACK_NO_ERROR;\n}","target":"int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config)\n{\n int64_t infilesize, total_samples;\n DFFFileHeader dff_file_header;\n DFFChunkHeader dff_chunk_header;\n uint32_t bcount;\n\n infilesize = DoGetFileSize (infile);\n memcpy (&dff_file_header, fourcc, 4);\n\n if ((!DoReadFile (infile, ((char *) &dff_file_header) + 4, sizeof (DFFFileHeader) - 4, &bcount) ||\n bcount != sizeof (DFFFileHeader) - 4) || strncmp (dff_file_header.formType, \"DSD \", 4)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &dff_file_header, sizeof (DFFFileHeader))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n#if 1 // this might be a little too picky...\n WavpackBigEndianToNative (&dff_file_header, DFFFileHeaderFormat);\n\n if (infilesize && !(config->qmode & QMODE_IGNORE_LENGTH) &&\n dff_file_header.ckDataSize && dff_file_header.ckDataSize + 1 && dff_file_header.ckDataSize + 12 != infilesize) {\n error_line (\"%s is not a valid .DFF file (by total size)!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n\n if (debug_logging_mode)\n error_line (\"file header indicated length = %lld\", dff_file_header.ckDataSize);\n\n#endif\n\n // loop through all elements of the DSDIFF header\n // (until the data chuck) and copy them to the output file\n\n while (1) {\n if (!DoReadFile (infile, &dff_chunk_header, sizeof (DFFChunkHeader), &bcount) ||\n bcount != sizeof (DFFChunkHeader)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &dff_chunk_header, sizeof (DFFChunkHeader))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n WavpackBigEndianToNative (&dff_chunk_header, DFFChunkHeaderFormat);\n\n if (debug_logging_mode)\n error_line (\"chunk header indicated length = %lld\", dff_chunk_header.ckDataSize);\n\n if (!strncmp (dff_chunk_header.ckID, \"FVER\", 4)) {\n uint32_t version;\n\n if (dff_chunk_header.ckDataSize != sizeof (version) ||\n !DoReadFile (infile, &version, sizeof (version), &bcount) ||\n bcount != sizeof (version)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &version, sizeof (version))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n WavpackBigEndianToNative (&version, \"L\");\n\n if (debug_logging_mode)\n error_line (\"dsdiff file version = 0x%08x\", version);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"PROP\", 4)) {\n char *prop_chunk;\n\n if (dff_chunk_header.ckDataSize < 4 || dff_chunk_header.ckDataSize > 1024) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n\n if (debug_logging_mode)\n error_line (\"got PROP chunk of %d bytes total\", (int) dff_chunk_header.ckDataSize);\n\n prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);\n\n if (!DoReadFile (infile, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize, &bcount) ||\n bcount != dff_chunk_header.ckDataSize) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize)) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n\n if (!strncmp (prop_chunk, \"SND \", 4)) {\n char *cptr = prop_chunk + 4, *eptr = prop_chunk + dff_chunk_header.ckDataSize;\n uint16_t numChannels, chansSpecified, chanMask = 0;\n uint32_t sampleRate;\n\n while (eptr - cptr >= sizeof (dff_chunk_header)) {\n memcpy (&dff_chunk_header, cptr, sizeof (dff_chunk_header));\n cptr += sizeof (dff_chunk_header);\n WavpackBigEndianToNative (&dff_chunk_header, DFFChunkHeaderFormat);\n\n if (eptr - cptr >= dff_chunk_header.ckDataSize) {\n if (!strncmp (dff_chunk_header.ckID, \"FS \", 4) && dff_chunk_header.ckDataSize == 4) {\n memcpy (&sampleRate, cptr, sizeof (sampleRate));\n WavpackBigEndianToNative (&sampleRate, \"L\");\n cptr += dff_chunk_header.ckDataSize;\n\n if (debug_logging_mode)\n error_line (\"got sample rate of %u Hz\", sampleRate);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"CHNL\", 4) && dff_chunk_header.ckDataSize >= 2) {\n memcpy (&numChannels, cptr, sizeof (numChannels));\n WavpackBigEndianToNative (&numChannels, \"S\");\n cptr += sizeof (numChannels);\n\n chansSpecified = (int)(dff_chunk_header.ckDataSize - sizeof (numChannels)) / 4;\n\n while (chansSpecified--) {\n if (!strncmp (cptr, \"SLFT\", 4) || !strncmp (cptr, \"MLFT\", 4))\n chanMask |= 0x1;\n else if (!strncmp (cptr, \"SRGT\", 4) || !strncmp (cptr, \"MRGT\", 4))\n chanMask |= 0x2;\n else if (!strncmp (cptr, \"LS \", 4))\n chanMask |= 0x10;\n else if (!strncmp (cptr, \"RS \", 4))\n chanMask |= 0x20;\n else if (!strncmp (cptr, \"C \", 4))\n chanMask |= 0x4;\n else if (!strncmp (cptr, \"LFE \", 4))\n chanMask |= 0x8;\n else\n if (debug_logging_mode)\n error_line (\"undefined channel ID %c%c%c%c\", cptr [0], cptr [1], cptr [2], cptr [3]);\n\n cptr += 4;\n }\n\n if (debug_logging_mode)\n error_line (\"%d channels, mask = 0x%08x\", numChannels, chanMask);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"CMPR\", 4) && dff_chunk_header.ckDataSize >= 4) {\n if (strncmp (cptr, \"DSD \", 4)) {\n error_line (\"DSDIFF files must be uncompressed, not \\\"%c%c%c%c\\\"!\",\n cptr [0], cptr [1], cptr [2], cptr [3]);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n\n cptr += dff_chunk_header.ckDataSize;\n }\n else {\n if (debug_logging_mode)\n error_line (\"got PROP/SND chunk type \\\"%c%c%c%c\\\" of %d bytes\", dff_chunk_header.ckID [0],\n dff_chunk_header.ckID [1], dff_chunk_header.ckID [2], dff_chunk_header.ckID [3], dff_chunk_header.ckDataSize);\n\n cptr += dff_chunk_header.ckDataSize;\n }\n }\n else {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n }\n\n if (chanMask && (config->channel_mask || (config->qmode & QMODE_CHANS_UNASSIGNED))) {\n error_line (\"this DSDIFF file already has channel order information!\");\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n else if (chanMask)\n config->channel_mask = chanMask;\n\n config->bits_per_sample = 8;\n config->bytes_per_sample = 1;\n config->num_channels = numChannels;\n config->sample_rate = sampleRate / 8;\n config->qmode |= QMODE_DSD_MSB_FIRST;\n }\n else if (debug_logging_mode)\n error_line (\"got unknown PROP chunk type \\\"%c%c%c%c\\\" of %d bytes\",\n prop_chunk [0], prop_chunk [1], prop_chunk [2], prop_chunk [3], dff_chunk_header.ckDataSize);\n\n free (prop_chunk);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"DSD \", 4)) {\n total_samples = dff_chunk_header.ckDataSize / config->num_channels;\n break;\n }\n else { // just copy unknown chunks to output file\n\n int bytes_to_copy = (int)(((dff_chunk_header.ckDataSize) + 1) & ~(int64_t)1);\n char *buff = malloc (bytes_to_copy);\n\n if (debug_logging_mode)\n error_line (\"extra unknown chunk \\\"%c%c%c%c\\\" of %d bytes\",\n dff_chunk_header.ckID [0], dff_chunk_header.ckID [1], dff_chunk_header.ckID [2],\n dff_chunk_header.ckID [3], dff_chunk_header.ckDataSize);\n\n if (!DoReadFile (infile, buff, bytes_to_copy, &bcount) ||\n bcount != bytes_to_copy ||\n (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, buff, bytes_to_copy))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n free (buff);\n return WAVPACK_SOFT_ERROR;\n }\n\n free (buff);\n }\n }\n\n if (debug_logging_mode)\n error_line (\"setting configuration with %lld samples\", total_samples);\n\n if (!WavpackSetConfiguration64 (wpc, config, total_samples, NULL)) {\n error_line (\"%s: %s\", infilename, WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n return WAVPACK_NO_ERROR;\n}","lang":"c","vul_type":"cwe-125","target_token_count":2529,"sven_meta":{"func_name":"ParseDsdiffHeaderConfig","file_name":"cli/dsdiff.c","commit_link":"github.com/dbry/WavPack/commit/36a24c7881427d2e1e4dc1cef58f19eee0d13aec","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#24-bf5a4c19e754","input":"name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {\n\tint name_end = -1;\n\tint j = *idx;\n\tint ptr_count = 0;\n#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)\n#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0)\n#define GET8(x) do { if (j >= length) goto err; x = packet[j++]; } while (0)\n\n\tchar *cp = name_out;\n\tconst char *const end = name_out + name_out_len;\n\n\t/* Normally, names are a series of length prefixed strings terminated */\n\t/* with a length of 0 (the lengths are u8's < 63). */\n\t/* However, the length can start with a pair of 1 bits and that */\n\t/* means that the next 14 bits are a pointer within the current */\n\t/* packet. */\n\n\tfor (;;) {\n\t\tu8 label_len;\n\t\tif (j >= length) return -1;\n\t\tGET8(label_len);\n\t\tif (!label_len) break;\n\t\tif (label_len & 0xc0) {\n\t\t\tu8 ptr_low;\n\t\t\tGET8(ptr_low);\n\t\t\tif (name_end < 0) name_end = j;\n\t\t\tj = (((int)label_len & 0x3f) << 8) + ptr_low;\n\t\t\t/* Make sure that the target offset is in-bounds. */\n\t\t\tif (j < 0 || j >= length) return -1;\n\t\t\t/* If we've jumped more times than there are characters in the\n\t\t\t * message, we must have a loop. */\n\t\t\tif (++ptr_count > length) return -1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (label_len > 63) return -1;\n\t\tif (cp != name_out) {\n\t\t\tif (cp + 1 >= end) return -1;\n\t\t\t*cp++ = '.';\n\t\t}\n\t\tif (cp + label_len >= end) return -1;\n\t\tmemcpy(cp, packet + j, label_len);\n\t\tcp += label_len;\n\t\tj += label_len;\n\t}\n\tif (cp >= end) return -1;\n\t*cp = '\\0';\n\tif (name_end < 0)\n\t\t*idx = j;\n\telse\n\t\t*idx = name_end;\n\treturn 0;\n err:\n\treturn -1;\n}","target":"name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {\n\tint name_end = -1;\n\tint j = *idx;\n\tint ptr_count = 0;\n#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)\n#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0)\n#define GET8(x) do { if (j >= length) goto err; x = packet[j++]; } while (0)\n\n\tchar *cp = name_out;\n\tconst char *const end = name_out + name_out_len;\n\n\t/* Normally, names are a series of length prefixed strings terminated */\n\t/* with a length of 0 (the lengths are u8's < 63). */\n\t/* However, the length can start with a pair of 1 bits and that */\n\t/* means that the next 14 bits are a pointer within the current */\n\t/* packet. */\n\n\tfor (;;) {\n\t\tu8 label_len;\n\t\tGET8(label_len);\n\t\tif (!label_len) break;\n\t\tif (label_len & 0xc0) {\n\t\t\tu8 ptr_low;\n\t\t\tGET8(ptr_low);\n\t\t\tif (name_end < 0) name_end = j;\n\t\t\tj = (((int)label_len & 0x3f) << 8) + ptr_low;\n\t\t\t/* Make sure that the target offset is in-bounds. */\n\t\t\tif (j < 0 || j >= length) return -1;\n\t\t\t/* If we've jumped more times than there are characters in the\n\t\t\t * message, we must have a loop. */\n\t\t\tif (++ptr_count > length) return -1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (label_len > 63) return -1;\n\t\tif (cp != name_out) {\n\t\t\tif (cp + 1 >= end) return -1;\n\t\t\t*cp++ = '.';\n\t\t}\n\t\tif (cp + label_len >= end) return -1;\n\t\tif (j + label_len > length) return -1;\n\t\tmemcpy(cp, packet + j, label_len);\n\t\tcp += label_len;\n\t\tj += label_len;\n\t}\n\tif (cp >= end) return -1;\n\t*cp = '\\0';\n\tif (name_end < 0)\n\t\t*idx = j;\n\telse\n\t\t*idx = name_end;\n\treturn 0;\n err:\n\treturn -1;\n}","lang":"c","vul_type":"cwe-125","target_token_count":581,"sven_meta":{"func_name":"name_parse","file_name":"evdns.c","commit_link":"github.com/libevent/libevent/commit/96f64a022014a208105ead6c8a7066018449d86d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#25-8bc2fe794799","input":"sctp_disposition_t sctp_sf_ootb(struct net *net,\n\t\t\t\tconst struct sctp_endpoint *ep,\n\t\t\t\tconst struct sctp_association *asoc,\n\t\t\t\tconst sctp_subtype_t type,\n\t\t\t\tvoid *arg,\n\t\t\t\tsctp_cmd_seq_t *commands)\n{\n\tstruct sctp_chunk *chunk = arg;\n\tstruct sk_buff *skb = chunk->skb;\n\tsctp_chunkhdr_t *ch;\n\tsctp_errhdr_t *err;\n\t__u8 *ch_end;\n\tint ootb_shut_ack = 0;\n\tint ootb_cookie_ack = 0;\n\n\tSCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES);\n\n\tch = (sctp_chunkhdr_t *) chunk->chunk_hdr;\n\tdo {\n\t\t/* Report violation if the chunk is less then minimal */\n\t\tif (ntohs(ch->length) < sizeof(sctp_chunkhdr_t))\n\t\t\treturn sctp_sf_violation_chunklen(net, ep, asoc, type, arg,\n\t\t\t\t\t\t commands);\n\n\t\t/* Now that we know we at least have a chunk header,\n\t\t * do things that are type appropriate.\n\t\t */\n\t\tif (SCTP_CID_SHUTDOWN_ACK == ch->type)\n\t\t\tootb_shut_ack = 1;\n\n\t\t/* RFC 2960, Section 3.3.7\n\t\t * Moreover, under any circumstances, an endpoint that\n\t\t * receives an ABORT MUST NOT respond to that ABORT by\n\t\t * sending an ABORT of its own.\n\t\t */\n\t\tif (SCTP_CID_ABORT == ch->type)\n\t\t\treturn sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);\n\n\t\t/* RFC 8.4, 7) If the packet contains a \"Stale cookie\" ERROR\n\t\t * or a COOKIE ACK the SCTP Packet should be silently\n\t\t * discarded.\n\t\t */\n\n\t\tif (SCTP_CID_COOKIE_ACK == ch->type)\n\t\t\tootb_cookie_ack = 1;\n\n\t\tif (SCTP_CID_ERROR == ch->type) {\n\t\t\tsctp_walk_errors(err, ch) {\n\t\t\t\tif (SCTP_ERROR_STALE_COOKIE == err->cause) {\n\t\t\t\t\tootb_cookie_ack = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/* Report violation if chunk len overflows */\n\t\tch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));\n\t\tif (ch_end > skb_tail_pointer(skb))\n\t\t\treturn sctp_sf_violation_chunklen(net, ep, asoc, type, arg,\n\t\t\t\t\t\t commands);\n\n\t\tch = (sctp_chunkhdr_t *) ch_end;\n\t} while (ch_end < skb_tail_pointer(skb));\n\n\tif (ootb_shut_ack)\n\t\treturn sctp_sf_shut_8_4_5(net, ep, asoc, type, arg, commands);\n\telse if (ootb_cookie_ack)\n\t\treturn sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);\n\telse\n\t\treturn sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands);\n}","target":"sctp_disposition_t sctp_sf_ootb(struct net *net,\n\t\t\t\tconst struct sctp_endpoint *ep,\n\t\t\t\tconst struct sctp_association *asoc,\n\t\t\t\tconst sctp_subtype_t type,\n\t\t\t\tvoid *arg,\n\t\t\t\tsctp_cmd_seq_t *commands)\n{\n\tstruct sctp_chunk *chunk = arg;\n\tstruct sk_buff *skb = chunk->skb;\n\tsctp_chunkhdr_t *ch;\n\tsctp_errhdr_t *err;\n\t__u8 *ch_end;\n\tint ootb_shut_ack = 0;\n\tint ootb_cookie_ack = 0;\n\n\tSCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES);\n\n\tch = (sctp_chunkhdr_t *) chunk->chunk_hdr;\n\tdo {\n\t\t/* Report violation if the chunk is less then minimal */\n\t\tif (ntohs(ch->length) < sizeof(sctp_chunkhdr_t))\n\t\t\treturn sctp_sf_violation_chunklen(net, ep, asoc, type, arg,\n\t\t\t\t\t\t commands);\n\n\t\t/* Report violation if chunk len overflows */\n\t\tch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));\n\t\tif (ch_end > skb_tail_pointer(skb))\n\t\t\treturn sctp_sf_violation_chunklen(net, ep, asoc, type, arg,\n\t\t\t\t\t\t commands);\n\n\t\t/* Now that we know we at least have a chunk header,\n\t\t * do things that are type appropriate.\n\t\t */\n\t\tif (SCTP_CID_SHUTDOWN_ACK == ch->type)\n\t\t\tootb_shut_ack = 1;\n\n\t\t/* RFC 2960, Section 3.3.7\n\t\t * Moreover, under any circumstances, an endpoint that\n\t\t * receives an ABORT MUST NOT respond to that ABORT by\n\t\t * sending an ABORT of its own.\n\t\t */\n\t\tif (SCTP_CID_ABORT == ch->type)\n\t\t\treturn sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);\n\n\t\t/* RFC 8.4, 7) If the packet contains a \"Stale cookie\" ERROR\n\t\t * or a COOKIE ACK the SCTP Packet should be silently\n\t\t * discarded.\n\t\t */\n\n\t\tif (SCTP_CID_COOKIE_ACK == ch->type)\n\t\t\tootb_cookie_ack = 1;\n\n\t\tif (SCTP_CID_ERROR == ch->type) {\n\t\t\tsctp_walk_errors(err, ch) {\n\t\t\t\tif (SCTP_ERROR_STALE_COOKIE == err->cause) {\n\t\t\t\t\tootb_cookie_ack = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tch = (sctp_chunkhdr_t *) ch_end;\n\t} while (ch_end < skb_tail_pointer(skb));\n\n\tif (ootb_shut_ack)\n\t\treturn sctp_sf_shut_8_4_5(net, ep, asoc, type, arg, commands);\n\telse if (ootb_cookie_ack)\n\t\treturn sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);\n\telse\n\t\treturn sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands);\n}","lang":"c","vul_type":"cwe-125","target_token_count":670,"sven_meta":{"func_name":"sctp_sf_ootb","file_name":"net/sctp/sm_statefuns.c","commit_link":"github.com/torvalds/linux/commit/bf911e985d6bbaa328c20c3e05f4eb03de11fdd6","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#27-56896183c72d","input":"static int string_scan_range(RList *list, const ut8 *buf, int min,\n\t\t\t const ut64 from, const ut64 to, int type) {\n\tut8 tmp[R_STRING_SCAN_BUFFER_SIZE];\n\tut64 str_start, needle = from;\n\tint count = 0, i, rc, runes;\n\tint str_type = R_STRING_TYPE_DETECT;\n\n\tif (type == -1) {\n\t\ttype = R_STRING_TYPE_DETECT;\n\t}\n\tif (!buf || !min) {\n\t\treturn -1;\n\t}\n\twhile (needle < to) {\n\t\trc = r_utf8_decode (buf + needle, to - needle, NULL);\n\t\tif (!rc) {\n\t\t\tneedle++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (type == R_STRING_TYPE_DETECT) {\n\t\t\tchar *w = (char *)buf + needle + rc;\n\t\t\tif ((to - needle) > 4) {\n\t\t\t\tbool is_wide32 = needle + rc + 2 < to && !w[0] && !w[1] && !w[2] && w[3] && !w[4];\n\t\t\t\tif (is_wide32) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_WIDE32;\n\t\t\t\t} else {\n\t\t\t\t\tbool is_wide = needle + rc + 2 < to && !w[0] && w[1] && !w[2];\n\t\t\t\t\tstr_type = is_wide? R_STRING_TYPE_WIDE: R_STRING_TYPE_ASCII;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr_type = R_STRING_TYPE_ASCII;\n\t\t\t}\n\t\t} else {\n\t\t\tstr_type = type;\n\t\t}\n\n\n\t\trunes = 0;\n\t\tstr_start = needle;\n\n\t\t/* Eat a whole C string */\n\t\tfor (rc = i = 0; i < sizeof (tmp) - 3 && needle < to; i += rc) {\n\t\t\tRRune r = {0};\n\n\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\trc = r_utf32le_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc) {\n\t\t\t\t\trc = 4;\n\t\t\t\t}\n\t\t\t} else if (str_type == R_STRING_TYPE_WIDE) {\n\t\t\t\trc = r_utf16le_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc == 1) {\n\t\t\t\t\trc = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trc = r_utf8_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc > 1) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_UTF8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Invalid sequence detected */\n\t\t\tif (!rc) {\n\t\t\t\tneedle++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tneedle += rc;\n\n\t\t\tif (r_isprint (r)) {\n\t\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\t\tif (r == 0xff) {\n\t\t\t\t\t\tr = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trc = r_utf8_encode (&tmp[i], r);\n\t\t\t\trunes++;\n\t\t\t\t/* Print the escape code */\n\t\t\t} else if (r && r < 0x100 && strchr (\"\\b\\v\\f\\n\\r\\t\\a\\e\", (char)r)) {\n\t\t\t\tif ((i + 32) < sizeof (tmp) && r < 28) {\n\t\t\t\t\ttmp[i + 0] = '\\\\';\n\t\t\t\t\ttmp[i + 1] = \" abtnvfr e\"[r];\n\t\t\t\t} else {\n\t\t\t\t\t// string too long\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\trc = 2;\n\t\t\t\trunes++;\n\t\t\t} else {\n\t\t\t\t/* \\0 marks the end of C-strings */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\ttmp[i++] = '\\0';\n\n\t\tif (runes >= min) {\n\t\t\tif (str_type == R_STRING_TYPE_ASCII) {\n\t\t\t\t// reduce false positives\n\t\t\t\tint j;\n\t\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t\t\tchar ch = tmp[j];\n\t\t\t\t\tif (ch != '\\n' && ch != '\\r' && ch != '\\t') {\n\t\t\t\t\t\tif (!IS_PRINTABLE (tmp[j])) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (list) {\n\t\t\t\tRBinString *new = R_NEW0 (RBinString);\n\t\t\t\tif (!new) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tnew->type = str_type;\n\t\t\t\tnew->length = runes;\n\t\t\t\tnew->size = needle - str_start;\n\t\t\t\tnew->ordinal = count++;\n\t\t\t\t// TODO: move into adjust_offset\n\t\t\t\tswitch (str_type) {\n\t\t\t\tcase R_STRING_TYPE_WIDE:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst ut8 *p = buf + str_start - 2;\n\t\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\t\tstr_start -= 2; // \\xff\\xfe\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase R_STRING_TYPE_WIDE32:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst ut8 *p = buf + str_start - 4;\n\t\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\t\tstr_start -= 4; // \\xff\\xfe\\x00\\x00\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tnew->paddr = new->vaddr = str_start;\n\t\t\t\tnew->string = r_str_ndup ((const char *)tmp, i);\n\t\t\t\tr_list_append (list, new);\n\t\t\t} else {\n\t\t\t\t// DUMP TO STDOUT. raw dumping for rabin2 -zzz\n\t\t\t\tprintf (\"0x%08\" PFMT64x \" %s\\n\", str_start, tmp);\n\t\t\t}\n\t\t}\n\t}\n\treturn count;\n}","target":"static int string_scan_range(RList *list, const ut8 *buf, int min,\n\t\t\t const ut64 from, const ut64 to, int type) {\n\tut8 tmp[R_STRING_SCAN_BUFFER_SIZE];\n\tut64 str_start, needle = from;\n\tint count = 0, i, rc, runes;\n\tint str_type = R_STRING_TYPE_DETECT;\n\n\tif (type == -1) {\n\t\ttype = R_STRING_TYPE_DETECT;\n\t}\n\tif (!buf || !min) {\n\t\treturn -1;\n\t}\n\twhile (needle < to) {\n\t\trc = r_utf8_decode (buf + needle, to - needle, NULL);\n\t\tif (!rc) {\n\t\t\tneedle++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (type == R_STRING_TYPE_DETECT) {\n\t\t\tchar *w = (char *)buf + needle + rc;\n\t\t\tif ((to - needle) > 4) {\n\t\t\t\tbool is_wide32 = needle + rc + 2 < to && !w[0] && !w[1] && !w[2] && w[3] && !w[4];\n\t\t\t\tif (is_wide32) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_WIDE32;\n\t\t\t\t} else {\n\t\t\t\t\tbool is_wide = needle + rc + 2 < to && !w[0] && w[1] && !w[2];\n\t\t\t\t\tstr_type = is_wide? R_STRING_TYPE_WIDE: R_STRING_TYPE_ASCII;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr_type = R_STRING_TYPE_ASCII;\n\t\t\t}\n\t\t} else {\n\t\t\tstr_type = type;\n\t\t}\n\n\n\t\trunes = 0;\n\t\tstr_start = needle;\n\n\t\t/* Eat a whole C string */\n\t\tfor (rc = i = 0; i < sizeof (tmp) - 3 && needle < to; i += rc) {\n\t\t\tRRune r = {0};\n\n\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\trc = r_utf32le_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc) {\n\t\t\t\t\trc = 4;\n\t\t\t\t}\n\t\t\t} else if (str_type == R_STRING_TYPE_WIDE) {\n\t\t\t\trc = r_utf16le_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc == 1) {\n\t\t\t\t\trc = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trc = r_utf8_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc > 1) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_UTF8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Invalid sequence detected */\n\t\t\tif (!rc) {\n\t\t\t\tneedle++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tneedle += rc;\n\n\t\t\tif (r_isprint (r)) {\n\t\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\t\tif (r == 0xff) {\n\t\t\t\t\t\tr = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trc = r_utf8_encode (&tmp[i], r);\n\t\t\t\trunes++;\n\t\t\t\t/* Print the escape code */\n\t\t\t} else if (r && r < 0x100 && strchr (\"\\b\\v\\f\\n\\r\\t\\a\\e\", (char)r)) {\n\t\t\t\tif ((i + 32) < sizeof (tmp) && r < 28) {\n\t\t\t\t\ttmp[i + 0] = '\\\\';\n\t\t\t\t\ttmp[i + 1] = \" abtnvfr e\"[r];\n\t\t\t\t} else {\n\t\t\t\t\t// string too long\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\trc = 2;\n\t\t\t\trunes++;\n\t\t\t} else {\n\t\t\t\t/* \\0 marks the end of C-strings */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\ttmp[i++] = '\\0';\n\n\t\tif (runes >= min) {\n\t\t\tif (str_type == R_STRING_TYPE_ASCII) {\n\t\t\t\t// reduce false positives\n\t\t\t\tint j;\n\t\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t\t\tchar ch = tmp[j];\n\t\t\t\t\tif (ch != '\\n' && ch != '\\r' && ch != '\\t') {\n\t\t\t\t\t\tif (!IS_PRINTABLE (tmp[j])) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (list) {\n\t\t\t\tRBinString *new = R_NEW0 (RBinString);\n\t\t\t\tif (!new) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tnew->type = str_type;\n\t\t\t\tnew->length = runes;\n\t\t\t\tnew->size = needle - str_start;\n\t\t\t\tnew->ordinal = count++;\n\t\t\t\t// TODO: move into adjust_offset\n\t\t\t\tswitch (str_type) {\n\t\t\t\tcase R_STRING_TYPE_WIDE:\n\t\t\t\t\tif (str_start > 1) {\n\t\t\t\t\t\tconst ut8 *p = buf + str_start - 2;\n\t\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\t\tstr_start -= 2; // \\xff\\xfe\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase R_STRING_TYPE_WIDE32:\n\t\t\t\t\tif (str_start > 3) {\n\t\t\t\t\t\tconst ut8 *p = buf + str_start - 4;\n\t\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\t\tstr_start -= 4; // \\xff\\xfe\\x00\\x00\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tnew->paddr = new->vaddr = str_start;\n\t\t\t\tnew->string = r_str_ndup ((const char *)tmp, i);\n\t\t\t\tr_list_append (list, new);\n\t\t\t} else {\n\t\t\t\t// DUMP TO STDOUT. raw dumping for rabin2 -zzz\n\t\t\t\tprintf (\"0x%08\" PFMT64x \" %s\\n\", str_start, tmp);\n\t\t\t}\n\t\t}\n\t}\n\treturn count;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1255,"sven_meta":{"func_name":"string_scan_range","file_name":"libr/bin/bin.c","commit_link":"github.com/radare/radare2/commit/d31c4d3cbdbe01ea3ded16a584de94149ecd31d9","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#28-5666e5a8bb91","input":"static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image *image, *image2=NULL,\n *rotated_image;\n PixelPacket *q;\n\n unsigned int status;\n MATHeader MATLAB_HDR;\n size_t size;\n size_t CellType;\n QuantumInfo *quantum_info;\n ImageInfo *clone_info;\n int i;\n ssize_t ldblk;\n unsigned char *BImgBuff = NULL;\n double MinVal, MaxVal;\n size_t Unknown6;\n unsigned z, z2;\n unsigned Frames;\n int logging;\n int sample_size;\n MagickOffsetType filepos=0x80;\n BlobInfo *blob;\n size_t one;\n\n unsigned int (*ReadBlobXXXLong)(Image *image);\n unsigned short (*ReadBlobXXXShort)(Image *image);\n void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data);\n void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data);\n\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n logging = LogMagickEvent(CoderEvent,GetMagickModule(),\"enter\");\n\n /*\n Open image file.\n */\n image = AcquireImage(image_info);\n\n status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read MATLAB image.\n */\n clone_info=CloneImageInfo(image_info);\n if(ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n MATLAB_HDR.Version = ReadBlobLSBShort(image);\n if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\" Endian %c%c\",\n MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]);\n if (!strncmp(MATLAB_HDR.EndianIndicator, \"IM\", 2))\n {\n ReadBlobXXXLong = ReadBlobLSBLong;\n ReadBlobXXXShort = ReadBlobLSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesLSB;\n ReadBlobFloatsXXX = ReadBlobFloatsLSB;\n image->endian = LSBEndian;\n }\n else if (!strncmp(MATLAB_HDR.EndianIndicator, \"MI\", 2))\n {\n ReadBlobXXXLong = ReadBlobMSBLong;\n ReadBlobXXXShort = ReadBlobMSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesMSB;\n ReadBlobFloatsXXX = ReadBlobFloatsMSB;\n image->endian = MSBEndian;\n }\n else\n goto MATLAB_KO; /* unsupported endian */\n\n if (strncmp(MATLAB_HDR.identific, \"MATLAB\", 6))\nMATLAB_KO: ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n filepos = TellBlob(image);\n while(!EOFBlob(image)) /* object parser loop */\n {\n Frames = 1;\n (void) SeekBlob(image,filepos,SEEK_SET);\n /* printf(\"pos=%X\\n\",TellBlob(image)); */\n\n MATLAB_HDR.DataType = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n filepos += MATLAB_HDR.ObjectSize + 4 + 4;\n\n image2 = image;\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if(MATLAB_HDR.DataType == miCOMPRESSED)\n {\n image2 = DecompressBlock(image,MATLAB_HDR.ObjectSize,clone_info,exception);\n if(image2==NULL) continue;\n MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */\n }\n#endif\n\n if(MATLAB_HDR.DataType!=miMATRIX) continue; /* skip another objects. */\n\n MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2);\n MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2);\n\n MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2);\n MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF;\n MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF;\n\n MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2);\n if(image!=image2)\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2);\n MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeX = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeY = ReadBlobXXXLong(image2);\n\n\n switch(MATLAB_HDR.DimFlag)\n {\n case 8: z2=z=1; break; /* 2D matrix*/\n case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/\n Unknown6 = ReadBlobXXXLong(image2);\n (void) Unknown6;\n if(z!=3) ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n break;\n case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */\n if(z!=3 && z!=1)\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n Frames = ReadBlobXXXLong(image2);\n break;\n default: ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n }\n\n MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2);\n MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2);\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.StructureClass %d\",MATLAB_HDR.StructureClass);\n if (MATLAB_HDR.StructureClass != mxCHAR_CLASS &&\n MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */\n MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */\n MATLAB_HDR.StructureClass != mxINT8_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */\n MATLAB_HDR.StructureClass != mxINT16_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */\n MATLAB_HDR.StructureClass != mxINT32_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */\n MATLAB_HDR.StructureClass != mxINT64_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */\n ThrowReaderException(CoderError,\"UnsupportedCellTypeInTheMatrix\");\n\n switch (MATLAB_HDR.NameFlag)\n {\n case 0:\n size = ReadBlobXXXLong(image2); /* Object name string size */\n size = 4 * (ssize_t) ((size + 3 + 1) / 4);\n (void) SeekBlob(image2, size, SEEK_CUR);\n break;\n case 1:\n case 2:\n case 3:\n case 4:\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */\n break;\n default:\n goto MATLAB_KO;\n }\n\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.CellType: %.20g\",(double) CellType);\n\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */\n\nNEXT_FRAME:\n switch (CellType)\n {\n case miINT8:\n case miUINT8:\n sample_size = 8;\n if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL)\n image->depth = 1;\n else\n image->depth = 8; /* Byte type cell */\n ldblk = (ssize_t) MATLAB_HDR.SizeX;\n break;\n case miINT16:\n case miUINT16:\n sample_size = 16;\n image->depth = 16; /* Word type cell */\n ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX);\n break;\n case miINT32:\n case miUINT32:\n sample_size = 32;\n image->depth = 32; /* Dword type cell */\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miINT64:\n case miUINT64:\n sample_size = 64;\n image->depth = 64; /* Qword type cell */\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n case miSINGLE:\n sample_size = 32;\n image->depth = 32; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex float type cell */\n }\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miDOUBLE:\n sample_size = 64;\n image->depth = 64; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\nDisableMSCWarning(4127)\n if (sizeof(double) != 8)\nRestoreMSCWarning\n ThrowReaderException(CoderError, \"IncompatibleSizeOfDouble\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex double type cell */\n }\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n default:\n ThrowReaderException(CoderError, \"UnsupportedCellTypeInTheMatrix\");\n }\n (void) sample_size;\n image->columns = MATLAB_HDR.SizeX;\n image->rows = MATLAB_HDR.SizeY;\n quantum_info=AcquireQuantumInfo(clone_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n one=1;\n image->colors = one << image->depth;\n if (image->columns == 0 || image->rows == 0)\n goto MATLAB_KO;\n /* Image is gray when no complex flag is set and 2D Matrix */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n {\n SetImageColorspace(image,GRAYColorspace);\n image->type=GrayscaleType;\n }\n\n\n /*\n If ping is true, then only set image size and colors without\n reading any image data.\n */\n if (image_info->ping)\n {\n size_t temp = image->columns;\n image->columns = image->rows;\n image->rows = temp;\n goto done_reading; /* !!!!!! BAD !!!! */\n }\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n\n /* ----- Load raster data ----- */\n BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */\n if (BImgBuff == NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n MinVal = 0;\n MaxVal = 0;\n if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum);\n }\n\n /* Main loop for reading all scanlines */\n if(z==1) z=0; /* read grey scanlines */\n /* else read color scanlines */\n do\n {\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT set image pixels returns unexpected NULL on a row %u.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto done_reading; /* Skip image rotation, when cannot set image pixels */\n }\n if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT cannot read scanrow %u from a file.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL))\n {\n FixLogical((unsigned char *)BImgBuff,ldblk);\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n {\nImportQuantumPixelsFailed:\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to ImportQuantumPixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n break;\n }\n }\n else\n {\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n goto ImportQuantumPixelsFailed;\n\n\n if (z<=1 && /* fix only during a last pass z==0 || z==1 */\n (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64))\n FixSignedValues(q,MATLAB_HDR.SizeX);\n }\n\n if (!SyncAuthenticPixels(image,exception))\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to sync image pixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n }\n } while(z-- >= 2);\nExitLoop:\n\n\n /* Read complex part of numbers here */\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* Find Min and Max Values for complex parts of floats */\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/\n\n if (CellType==miDOUBLE || CellType==miSINGLE)\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal);\n }\n\n if (CellType==miDOUBLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff);\n InsertComplexDoubleRow((double *)BImgBuff, i, image, MinVal, MaxVal);\n }\n\n if (CellType==miSINGLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff);\n InsertComplexFloatRow((float *)BImgBuff, i, image, MinVal, MaxVal);\n }\n }\n\n /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n image->type=GrayscaleType;\n if (image->depth == 1)\n image->type=BilevelType;\n\n if(image2==image)\n image2 = NULL; /* Remove shadow copy to an image before rotation. */\n\n /* Rotate image. */\n rotated_image = RotateImage(image, 90.0, exception);\n if (rotated_image != (Image *) NULL)\n {\n /* Remove page offsets added by RotateImage */\n rotated_image->page.x=0;\n rotated_image->page.y=0;\n\n blob = rotated_image->blob;\n rotated_image->blob = image->blob;\n rotated_image->colors = image->colors;\n image->blob = blob;\n AppendImageToList(&image,rotated_image);\n DeleteImageFromList(&image);\n }\n\ndone_reading:\n\n if(image2!=NULL)\n if(image2!=image)\n {\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image);\n if (image->next == (Image *) NULL) break;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n\n /* row scan buffer is no longer needed */\n RelinquishMagickMemory(BImgBuff);\n BImgBuff = NULL;\n\n if(--Frames>0)\n {\n z = z2;\n if(image2==NULL) image2 = image;\n goto NEXT_FRAME;\n }\n\n if(image2!=NULL)\n if(image2!=image) /* Does shadow temporary decompressed image exist? */\n {\n/* CloseBlob(image2); */\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) unlink(clone_info->filename);\n }\n }\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n\n RelinquishMagickMemory(BImgBuff);\n CloseBlob(image);\n\n\n {\n Image *p;\n ssize_t scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n\n /*\n Fix scene numbers\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=scene++;\n }\n\n if(clone_info != NULL) /* cleanup garbage file from compression */\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n DestroyImageInfo(clone_info);\n clone_info = NULL;\n }\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\"return\");\n if(image==NULL)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n return (image);\n}","target":"static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image *image, *image2=NULL,\n *rotated_image;\n PixelPacket *q;\n\n unsigned int status;\n MATHeader MATLAB_HDR;\n size_t size;\n size_t CellType;\n QuantumInfo *quantum_info;\n ImageInfo *clone_info;\n int i;\n ssize_t ldblk;\n unsigned char *BImgBuff = NULL;\n double MinVal, MaxVal;\n size_t Unknown6;\n unsigned z, z2;\n unsigned Frames;\n int logging;\n int sample_size;\n MagickOffsetType filepos=0x80;\n BlobInfo *blob;\n size_t one;\n\n unsigned int (*ReadBlobXXXLong)(Image *image);\n unsigned short (*ReadBlobXXXShort)(Image *image);\n void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data);\n void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data);\n\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n logging = LogMagickEvent(CoderEvent,GetMagickModule(),\"enter\");\n\n /*\n Open image file.\n */\n image = AcquireImage(image_info);\n\n status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read MATLAB image.\n */\n clone_info=CloneImageInfo(image_info);\n if(ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n MATLAB_HDR.Version = ReadBlobLSBShort(image);\n if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\" Endian %c%c\",\n MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]);\n if (!strncmp(MATLAB_HDR.EndianIndicator, \"IM\", 2))\n {\n ReadBlobXXXLong = ReadBlobLSBLong;\n ReadBlobXXXShort = ReadBlobLSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesLSB;\n ReadBlobFloatsXXX = ReadBlobFloatsLSB;\n image->endian = LSBEndian;\n }\n else if (!strncmp(MATLAB_HDR.EndianIndicator, \"MI\", 2))\n {\n ReadBlobXXXLong = ReadBlobMSBLong;\n ReadBlobXXXShort = ReadBlobMSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesMSB;\n ReadBlobFloatsXXX = ReadBlobFloatsMSB;\n image->endian = MSBEndian;\n }\n else\n goto MATLAB_KO; /* unsupported endian */\n\n if (strncmp(MATLAB_HDR.identific, \"MATLAB\", 6))\nMATLAB_KO: ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n filepos = TellBlob(image);\n while(!EOFBlob(image)) /* object parser loop */\n {\n Frames = 1;\n (void) SeekBlob(image,filepos,SEEK_SET);\n /* printf(\"pos=%X\\n\",TellBlob(image)); */\n\n MATLAB_HDR.DataType = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n filepos += MATLAB_HDR.ObjectSize + 4 + 4;\n\n image2 = image;\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if(MATLAB_HDR.DataType == miCOMPRESSED)\n {\n image2 = DecompressBlock(image,MATLAB_HDR.ObjectSize,clone_info,exception);\n if(image2==NULL) continue;\n MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */\n }\n#endif\n\n if(MATLAB_HDR.DataType!=miMATRIX) continue; /* skip another objects. */\n\n MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2);\n MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2);\n\n MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2);\n MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF;\n MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF;\n\n MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2);\n if(image!=image2)\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2);\n MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeX = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeY = ReadBlobXXXLong(image2);\n\n\n switch(MATLAB_HDR.DimFlag)\n {\n case 8: z2=z=1; break; /* 2D matrix*/\n case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/\n Unknown6 = ReadBlobXXXLong(image2);\n (void) Unknown6;\n if(z!=3) ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n break;\n case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */\n if(z!=3 && z!=1)\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n Frames = ReadBlobXXXLong(image2);\n break;\n default: ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n }\n\n MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2);\n MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2);\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.StructureClass %d\",MATLAB_HDR.StructureClass);\n if (MATLAB_HDR.StructureClass != mxCHAR_CLASS &&\n MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */\n MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */\n MATLAB_HDR.StructureClass != mxINT8_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */\n MATLAB_HDR.StructureClass != mxINT16_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */\n MATLAB_HDR.StructureClass != mxINT32_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */\n MATLAB_HDR.StructureClass != mxINT64_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */\n ThrowReaderException(CoderError,\"UnsupportedCellTypeInTheMatrix\");\n\n switch (MATLAB_HDR.NameFlag)\n {\n case 0:\n size = ReadBlobXXXLong(image2); /* Object name string size */\n size = 4 * (ssize_t) ((size + 3 + 1) / 4);\n (void) SeekBlob(image2, size, SEEK_CUR);\n break;\n case 1:\n case 2:\n case 3:\n case 4:\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */\n break;\n default:\n goto MATLAB_KO;\n }\n\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.CellType: %.20g\",(double) CellType);\n\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */\n\nNEXT_FRAME:\n switch (CellType)\n {\n case miINT8:\n case miUINT8:\n sample_size = 8;\n if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL)\n image->depth = 1;\n else\n image->depth = 8; /* Byte type cell */\n ldblk = (ssize_t) MATLAB_HDR.SizeX;\n break;\n case miINT16:\n case miUINT16:\n sample_size = 16;\n image->depth = 16; /* Word type cell */\n ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX);\n break;\n case miINT32:\n case miUINT32:\n sample_size = 32;\n image->depth = 32; /* Dword type cell */\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miINT64:\n case miUINT64:\n sample_size = 64;\n image->depth = 64; /* Qword type cell */\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n case miSINGLE:\n sample_size = 32;\n image->depth = 32; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex float type cell */\n }\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miDOUBLE:\n sample_size = 64;\n image->depth = 64; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\nDisableMSCWarning(4127)\n if (sizeof(double) != 8)\nRestoreMSCWarning\n ThrowReaderException(CoderError, \"IncompatibleSizeOfDouble\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex double type cell */\n }\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n default:\n ThrowReaderException(CoderError, \"UnsupportedCellTypeInTheMatrix\");\n }\n (void) sample_size;\n image->columns = MATLAB_HDR.SizeX;\n image->rows = MATLAB_HDR.SizeY;\n quantum_info=AcquireQuantumInfo(clone_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n one=1;\n image->colors = one << image->depth;\n if (image->columns == 0 || image->rows == 0)\n goto MATLAB_KO;\n /* Image is gray when no complex flag is set and 2D Matrix */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n {\n SetImageColorspace(image,GRAYColorspace);\n image->type=GrayscaleType;\n }\n\n\n /*\n If ping is true, then only set image size and colors without\n reading any image data.\n */\n if (image_info->ping)\n {\n size_t temp = image->columns;\n image->columns = image->rows;\n image->rows = temp;\n goto done_reading; /* !!!!!! BAD !!!! */\n }\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n\n /* ----- Load raster data ----- */\n BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */\n if (BImgBuff == NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n MinVal = 0;\n MaxVal = 0;\n if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum);\n }\n\n /* Main loop for reading all scanlines */\n if(z==1) z=0; /* read grey scanlines */\n /* else read color scanlines */\n do\n {\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT set image pixels returns unexpected NULL on a row %u.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto done_reading; /* Skip image rotation, when cannot set image pixels */\n }\n if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT cannot read scanrow %u from a file.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL))\n {\n FixLogical((unsigned char *)BImgBuff,ldblk);\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n {\nImportQuantumPixelsFailed:\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to ImportQuantumPixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n break;\n }\n }\n else\n {\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n goto ImportQuantumPixelsFailed;\n\n\n if (z<=1 && /* fix only during a last pass z==0 || z==1 */\n (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64))\n FixSignedValues(q,MATLAB_HDR.SizeX);\n }\n\n if (!SyncAuthenticPixels(image,exception))\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to sync image pixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n }\n } while(z-- >= 2);\n quantum_info=DestroyQuantumInfo(quantum_info);\nExitLoop:\n\n\n /* Read complex part of numbers here */\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* Find Min and Max Values for complex parts of floats */\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/\n\n if (CellType==miDOUBLE || CellType==miSINGLE)\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal);\n }\n\n if (CellType==miDOUBLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff);\n InsertComplexDoubleRow((double *)BImgBuff, i, image, MinVal, MaxVal);\n }\n\n if (CellType==miSINGLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff);\n InsertComplexFloatRow((float *)BImgBuff, i, image, MinVal, MaxVal);\n }\n }\n\n /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n image->type=GrayscaleType;\n if (image->depth == 1)\n image->type=BilevelType;\n\n if(image2==image)\n image2 = NULL; /* Remove shadow copy to an image before rotation. */\n\n /* Rotate image. */\n rotated_image = RotateImage(image, 90.0, exception);\n if (rotated_image != (Image *) NULL)\n {\n /* Remove page offsets added by RotateImage */\n rotated_image->page.x=0;\n rotated_image->page.y=0;\n\n blob = rotated_image->blob;\n rotated_image->blob = image->blob;\n rotated_image->colors = image->colors;\n image->blob = blob;\n AppendImageToList(&image,rotated_image);\n DeleteImageFromList(&image);\n }\n\ndone_reading:\n\n if(image2!=NULL)\n if(image2!=image)\n {\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image);\n if (image->next == (Image *) NULL) break;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n\n /* row scan buffer is no longer needed */\n RelinquishMagickMemory(BImgBuff);\n BImgBuff = NULL;\n\n if(--Frames>0)\n {\n z = z2;\n if(image2==NULL) image2 = image;\n goto NEXT_FRAME;\n }\n\n if(image2!=NULL)\n if(image2!=image) /* Does shadow temporary decompressed image exist? */\n {\n/* CloseBlob(image2); */\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) unlink(clone_info->filename);\n }\n }\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n\n RelinquishMagickMemory(BImgBuff);\n CloseBlob(image);\n\n\n {\n Image *p;\n ssize_t scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n\n /*\n Fix scene numbers\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=scene++;\n }\n\n if(clone_info != NULL) /* cleanup garbage file from compression */\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n DestroyImageInfo(clone_info);\n clone_info = NULL;\n }\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\"return\");\n if(image==NULL)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n return (image);\n}","lang":"c","vul_type":"cwe-125","target_token_count":4439,"sven_meta":{"func_name":"ReadMATImage","file_name":"coders/mat.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/b173a352397877775c51c9a0e9d59eb6ce24c455","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#32-ae3a7812b292","input":"read_Header(struct archive_read *a, struct _7z_header_info *h,\n int check_header_id)\n{\n\tstruct _7zip *zip = (struct _7zip *)a->format->data;\n\tconst unsigned char *p;\n\tstruct _7z_folder *folders;\n\tstruct _7z_stream_info *si = &(zip->si);\n\tstruct _7zip_entry *entries;\n\tuint32_t folderIndex, indexInFolder;\n\tunsigned i;\n\tint eindex, empty_streams, sindex;\n\n\tif (check_header_id) {\n\t\t/*\n\t\t * Read Header.\n\t\t */\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\tif (*p != kHeader)\n\t\t\treturn (-1);\n\t}\n\n\t/*\n\t * Read ArchiveProperties.\n\t */\n\tif ((p = header_bytes(a, 1)) == NULL)\n\t\treturn (-1);\n\tif (*p == kArchiveProperties) {\n\t\tfor (;;) {\n\t\t\tuint64_t size;\n\t\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (*p == 0)\n\t\t\t\tbreak;\n\t\t\tif (parse_7zip_uint64(a, &size) < 0)\n\t\t\t\treturn (-1);\n\t\t}\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t}\n\n\t/*\n\t * Read MainStreamsInfo.\n\t */\n\tif (*p == kMainStreamsInfo) {\n\t\tif (read_StreamsInfo(a, &(zip->si)) < 0)\n\t\t\treturn (-1);\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t}\n\tif (*p == kEnd)\n\t\treturn (0);\n\n\t/*\n\t * Read FilesInfo.\n\t */\n\tif (*p != kFilesInfo)\n\t\treturn (-1);\n\n\tif (parse_7zip_uint64(a, &(zip->numFiles)) < 0)\n\t\treturn (-1);\n\tif (UMAX_ENTRY < zip->numFiles)\n\t\treturn (-1);\n\n\tzip->entries = calloc((size_t)zip->numFiles, sizeof(*zip->entries));\n\tif (zip->entries == NULL)\n\t\treturn (-1);\n\tentries = zip->entries;\n\n\tempty_streams = 0;\n\tfor (;;) {\n\t\tint type;\n\t\tuint64_t size;\n\t\tsize_t ll;\n\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t\tif (type == kEnd)\n\t\t\tbreak;\n\n\t\tif (parse_7zip_uint64(a, &size) < 0)\n\t\t\treturn (-1);\n\t\tif (zip->header_bytes_remaining < size)\n\t\t\treturn (-1);\n\t\tll = (size_t)size;\n\n\t\tswitch (type) {\n\t\tcase kEmptyStream:\n\t\t\th->emptyStreamBools = calloc((size_t)zip->numFiles,\n\t\t\t sizeof(*h->emptyStreamBools));\n\t\t\tif (h->emptyStreamBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(\n\t\t\t a, h->emptyStreamBools, (size_t)zip->numFiles) < 0)\n\t\t\t\treturn (-1);\n\t\t\tempty_streams = 0;\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tif (h->emptyStreamBools[i])\n\t\t\t\t\tempty_streams++;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase kEmptyFile:\n\t\t\tif (empty_streams <= 0) {\n\t\t\t\t/* Unexcepted sequence. Skip this. */\n\t\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\th->emptyFileBools = calloc(empty_streams,\n\t\t\t sizeof(*h->emptyFileBools));\n\t\t\tif (h->emptyFileBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(a, h->emptyFileBools, empty_streams) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kAnti:\n\t\t\tif (empty_streams <= 0) {\n\t\t\t\t/* Unexcepted sequence. Skip this. */\n\t\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\th->antiBools = calloc(empty_streams,\n\t\t\t sizeof(*h->antiBools));\n\t\t\tif (h->antiBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(a, h->antiBools, empty_streams) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kCTime:\n\t\tcase kATime:\n\t\tcase kMTime:\n\t\t\tif (read_Times(a, h, type) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kName:\n\t\t{\n\t\t\tunsigned char *np;\n\t\t\tsize_t nl, nb;\n\n\t\t\t/* Skip one byte. */\n\t\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tll--;\n\n\t\t\tif ((ll & 1) || ll < zip->numFiles * 4)\n\t\t\t\treturn (-1);\n\n\t\t\tzip->entry_names = malloc(ll);\n\t\t\tif (zip->entry_names == NULL)\n\t\t\t\treturn (-1);\n\t\t\tnp = zip->entry_names;\n\t\t\tnb = ll;\n\t\t\t/*\n\t\t\t * Copy whole file names.\n\t\t\t * NOTE: This loop prevents from expanding\n\t\t\t * the uncompressed buffer in order not to\n\t\t\t * use extra memory resource.\n\t\t\t */\n\t\t\twhile (nb) {\n\t\t\t\tsize_t b;\n\t\t\t\tif (nb > UBUFF_SIZE)\n\t\t\t\t\tb = UBUFF_SIZE;\n\t\t\t\telse\n\t\t\t\t\tb = nb;\n\t\t\t\tif ((p = header_bytes(a, b)) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tmemcpy(np, p, b);\n\t\t\t\tnp += b;\n\t\t\t\tnb -= b;\n\t\t\t}\n\t\t\tnp = zip->entry_names;\n\t\t\tnl = ll;\n\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tentries[i].utf16name = np;\n#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)\n\t\t\t\tentries[i].wname = (wchar_t *)np;\n#endif\n\n\t\t\t\t/* Find a terminator. */\n\t\t\t\twhile (nl >= 2 && (np[0] || np[1])) {\n\t\t\t\t\tnp += 2;\n\t\t\t\t\tnl -= 2;\n\t\t\t\t}\n\t\t\t\tif (nl < 2)\n\t\t\t\t\treturn (-1);/* Terminator not found */\n\t\t\t\tentries[i].name_len = np - entries[i].utf16name;\n\t\t\t\tnp += 2;\n\t\t\t\tnl -= 2;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase kAttributes:\n\t\t{\n\t\t\tint allAreDefined;\n\n\t\t\tif ((p = header_bytes(a, 2)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tallAreDefined = *p;\n\t\t\th->attrBools = calloc((size_t)zip->numFiles,\n\t\t\t sizeof(*h->attrBools));\n\t\t\tif (h->attrBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (allAreDefined)\n\t\t\t\tmemset(h->attrBools, 1, (size_t)zip->numFiles);\n\t\t\telse {\n\t\t\t\tif (read_Bools(a, h->attrBools,\n\t\t\t\t (size_t)zip->numFiles) < 0)\n\t\t\t\t\treturn (-1);\n\t\t\t}\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tif (h->attrBools[i]) {\n\t\t\t\t\tif ((p = header_bytes(a, 4)) == NULL)\n\t\t\t\t\t\treturn (-1);\n\t\t\t\t\tentries[i].attr = archive_le32dec(p);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase kDummy:\n\t\t\tif (ll == 0)\n\t\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/*\n\t * Set up entry's attributes.\n\t */\n\tfolders = si->ci.folders;\n\teindex = sindex = 0;\n\tfolderIndex = indexInFolder = 0;\n\tfor (i = 0; i < zip->numFiles; i++) {\n\t\tif (h->emptyStreamBools == NULL || h->emptyStreamBools[i] == 0)\n\t\t\tentries[i].flg |= HAS_STREAM;\n\t\t/* The high 16 bits of attributes is a posix file mode. */\n\t\tentries[i].mode = entries[i].attr >> 16;\n\t\tif (entries[i].flg & HAS_STREAM) {\n\t\t\tif ((size_t)sindex >= si->ss.unpack_streams)\n\t\t\t\treturn (-1);\n\t\t\tif (entries[i].mode == 0)\n\t\t\t\tentries[i].mode = AE_IFREG | 0666;\n\t\t\tif (si->ss.digestsDefined[sindex])\n\t\t\t\tentries[i].flg |= CRC32_IS_SET;\n\t\t\tentries[i].ssIndex = sindex;\n\t\t\tsindex++;\n\t\t} else {\n\t\t\tint dir;\n\t\t\tif (h->emptyFileBools == NULL)\n\t\t\t\tdir = 1;\n\t\t\telse {\n\t\t\t\tif (h->emptyFileBools[eindex])\n\t\t\t\t\tdir = 0;\n\t\t\t\telse\n\t\t\t\t\tdir = 1;\n\t\t\t\teindex++;\n\t\t\t}\n\t\t\tif (entries[i].mode == 0) {\n\t\t\t\tif (dir)\n\t\t\t\t\tentries[i].mode = AE_IFDIR | 0777;\n\t\t\t\telse\n\t\t\t\t\tentries[i].mode = AE_IFREG | 0666;\n\t\t\t} else if (dir &&\n\t\t\t (entries[i].mode & AE_IFMT) != AE_IFDIR) {\n\t\t\t\tentries[i].mode &= ~AE_IFMT;\n\t\t\t\tentries[i].mode |= AE_IFDIR;\n\t\t\t}\n\t\t\tif ((entries[i].mode & AE_IFMT) == AE_IFDIR &&\n\t\t\t entries[i].name_len >= 2 &&\n\t\t\t (entries[i].utf16name[entries[i].name_len-2] != '/' ||\n\t\t\t entries[i].utf16name[entries[i].name_len-1] != 0)) {\n\t\t\t\tentries[i].utf16name[entries[i].name_len] = '/';\n\t\t\t\tentries[i].utf16name[entries[i].name_len+1] = 0;\n\t\t\t\tentries[i].name_len += 2;\n\t\t\t}\n\t\t\tentries[i].ssIndex = -1;\n\t\t}\n\t\tif (entries[i].attr & 0x01)\n\t\t\tentries[i].mode &= ~0222;/* Read only. */\n\n\t\tif ((entries[i].flg & HAS_STREAM) == 0 && indexInFolder == 0) {\n\t\t\t/*\n\t\t\t * The entry is an empty file or a directory file,\n\t\t\t * those both have no contents.\n\t\t\t */\n\t\t\tentries[i].folderIndex = -1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (indexInFolder == 0) {\n\t\t\tfor (;;) {\n\t\t\t\tif (folderIndex >= si->ci.numFolders)\n\t\t\t\t\treturn (-1);\n\t\t\t\tif (folders[folderIndex].numUnpackStreams)\n\t\t\t\t\tbreak;\n\t\t\t\tfolderIndex++;\n\t\t\t}\n\t\t}\n\t\tentries[i].folderIndex = folderIndex;\n\t\tif ((entries[i].flg & HAS_STREAM) == 0)\n\t\t\tcontinue;\n\t\tindexInFolder++;\n\t\tif (indexInFolder >= folders[folderIndex].numUnpackStreams) {\n\t\t\tfolderIndex++;\n\t\t\tindexInFolder = 0;\n\t\t}\n\t}\n\n\treturn (0);\n}","target":"read_Header(struct archive_read *a, struct _7z_header_info *h,\n int check_header_id)\n{\n\tstruct _7zip *zip = (struct _7zip *)a->format->data;\n\tconst unsigned char *p;\n\tstruct _7z_folder *folders;\n\tstruct _7z_stream_info *si = &(zip->si);\n\tstruct _7zip_entry *entries;\n\tuint32_t folderIndex, indexInFolder;\n\tunsigned i;\n\tint eindex, empty_streams, sindex;\n\n\tif (check_header_id) {\n\t\t/*\n\t\t * Read Header.\n\t\t */\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\tif (*p != kHeader)\n\t\t\treturn (-1);\n\t}\n\n\t/*\n\t * Read ArchiveProperties.\n\t */\n\tif ((p = header_bytes(a, 1)) == NULL)\n\t\treturn (-1);\n\tif (*p == kArchiveProperties) {\n\t\tfor (;;) {\n\t\t\tuint64_t size;\n\t\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (*p == 0)\n\t\t\t\tbreak;\n\t\t\tif (parse_7zip_uint64(a, &size) < 0)\n\t\t\t\treturn (-1);\n\t\t}\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t}\n\n\t/*\n\t * Read MainStreamsInfo.\n\t */\n\tif (*p == kMainStreamsInfo) {\n\t\tif (read_StreamsInfo(a, &(zip->si)) < 0)\n\t\t\treturn (-1);\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t}\n\tif (*p == kEnd)\n\t\treturn (0);\n\n\t/*\n\t * Read FilesInfo.\n\t */\n\tif (*p != kFilesInfo)\n\t\treturn (-1);\n\n\tif (parse_7zip_uint64(a, &(zip->numFiles)) < 0)\n\t\treturn (-1);\n\tif (UMAX_ENTRY < zip->numFiles)\n\t\treturn (-1);\n\n\tzip->entries = calloc((size_t)zip->numFiles, sizeof(*zip->entries));\n\tif (zip->entries == NULL)\n\t\treturn (-1);\n\tentries = zip->entries;\n\n\tempty_streams = 0;\n\tfor (;;) {\n\t\tint type;\n\t\tuint64_t size;\n\t\tsize_t ll;\n\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t\tif (type == kEnd)\n\t\t\tbreak;\n\n\t\tif (parse_7zip_uint64(a, &size) < 0)\n\t\t\treturn (-1);\n\t\tif (zip->header_bytes_remaining < size)\n\t\t\treturn (-1);\n\t\tll = (size_t)size;\n\n\t\tswitch (type) {\n\t\tcase kEmptyStream:\n\t\t\tif (h->emptyStreamBools != NULL)\n\t\t\t\treturn (-1);\n\t\t\th->emptyStreamBools = calloc((size_t)zip->numFiles,\n\t\t\t sizeof(*h->emptyStreamBools));\n\t\t\tif (h->emptyStreamBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(\n\t\t\t a, h->emptyStreamBools, (size_t)zip->numFiles) < 0)\n\t\t\t\treturn (-1);\n\t\t\tempty_streams = 0;\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tif (h->emptyStreamBools[i])\n\t\t\t\t\tempty_streams++;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase kEmptyFile:\n\t\t\tif (empty_streams <= 0) {\n\t\t\t\t/* Unexcepted sequence. Skip this. */\n\t\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (h->emptyFileBools != NULL)\n\t\t\t\treturn (-1);\n\t\t\th->emptyFileBools = calloc(empty_streams,\n\t\t\t sizeof(*h->emptyFileBools));\n\t\t\tif (h->emptyFileBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(a, h->emptyFileBools, empty_streams) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kAnti:\n\t\t\tif (empty_streams <= 0) {\n\t\t\t\t/* Unexcepted sequence. Skip this. */\n\t\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (h->antiBools != NULL)\n\t\t\t\treturn (-1);\n\t\t\th->antiBools = calloc(empty_streams,\n\t\t\t sizeof(*h->antiBools));\n\t\t\tif (h->antiBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(a, h->antiBools, empty_streams) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kCTime:\n\t\tcase kATime:\n\t\tcase kMTime:\n\t\t\tif (read_Times(a, h, type) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kName:\n\t\t{\n\t\t\tunsigned char *np;\n\t\t\tsize_t nl, nb;\n\n\t\t\t/* Skip one byte. */\n\t\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tll--;\n\n\t\t\tif ((ll & 1) || ll < zip->numFiles * 4)\n\t\t\t\treturn (-1);\n\n\t\t\tif (zip->entry_names != NULL)\n\t\t\t\treturn (-1);\n\t\t\tzip->entry_names = malloc(ll);\n\t\t\tif (zip->entry_names == NULL)\n\t\t\t\treturn (-1);\n\t\t\tnp = zip->entry_names;\n\t\t\tnb = ll;\n\t\t\t/*\n\t\t\t * Copy whole file names.\n\t\t\t * NOTE: This loop prevents from expanding\n\t\t\t * the uncompressed buffer in order not to\n\t\t\t * use extra memory resource.\n\t\t\t */\n\t\t\twhile (nb) {\n\t\t\t\tsize_t b;\n\t\t\t\tif (nb > UBUFF_SIZE)\n\t\t\t\t\tb = UBUFF_SIZE;\n\t\t\t\telse\n\t\t\t\t\tb = nb;\n\t\t\t\tif ((p = header_bytes(a, b)) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tmemcpy(np, p, b);\n\t\t\t\tnp += b;\n\t\t\t\tnb -= b;\n\t\t\t}\n\t\t\tnp = zip->entry_names;\n\t\t\tnl = ll;\n\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tentries[i].utf16name = np;\n#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)\n\t\t\t\tentries[i].wname = (wchar_t *)np;\n#endif\n\n\t\t\t\t/* Find a terminator. */\n\t\t\t\twhile (nl >= 2 && (np[0] || np[1])) {\n\t\t\t\t\tnp += 2;\n\t\t\t\t\tnl -= 2;\n\t\t\t\t}\n\t\t\t\tif (nl < 2)\n\t\t\t\t\treturn (-1);/* Terminator not found */\n\t\t\t\tentries[i].name_len = np - entries[i].utf16name;\n\t\t\t\tnp += 2;\n\t\t\t\tnl -= 2;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase kAttributes:\n\t\t{\n\t\t\tint allAreDefined;\n\n\t\t\tif ((p = header_bytes(a, 2)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tallAreDefined = *p;\n\t\t\tif (h->attrBools != NULL)\n\t\t\t\treturn (-1);\n\t\t\th->attrBools = calloc((size_t)zip->numFiles,\n\t\t\t sizeof(*h->attrBools));\n\t\t\tif (h->attrBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (allAreDefined)\n\t\t\t\tmemset(h->attrBools, 1, (size_t)zip->numFiles);\n\t\t\telse {\n\t\t\t\tif (read_Bools(a, h->attrBools,\n\t\t\t\t (size_t)zip->numFiles) < 0)\n\t\t\t\t\treturn (-1);\n\t\t\t}\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tif (h->attrBools[i]) {\n\t\t\t\t\tif ((p = header_bytes(a, 4)) == NULL)\n\t\t\t\t\t\treturn (-1);\n\t\t\t\t\tentries[i].attr = archive_le32dec(p);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase kDummy:\n\t\t\tif (ll == 0)\n\t\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/*\n\t * Set up entry's attributes.\n\t */\n\tfolders = si->ci.folders;\n\teindex = sindex = 0;\n\tfolderIndex = indexInFolder = 0;\n\tfor (i = 0; i < zip->numFiles; i++) {\n\t\tif (h->emptyStreamBools == NULL || h->emptyStreamBools[i] == 0)\n\t\t\tentries[i].flg |= HAS_STREAM;\n\t\t/* The high 16 bits of attributes is a posix file mode. */\n\t\tentries[i].mode = entries[i].attr >> 16;\n\t\tif (entries[i].flg & HAS_STREAM) {\n\t\t\tif ((size_t)sindex >= si->ss.unpack_streams)\n\t\t\t\treturn (-1);\n\t\t\tif (entries[i].mode == 0)\n\t\t\t\tentries[i].mode = AE_IFREG | 0666;\n\t\t\tif (si->ss.digestsDefined[sindex])\n\t\t\t\tentries[i].flg |= CRC32_IS_SET;\n\t\t\tentries[i].ssIndex = sindex;\n\t\t\tsindex++;\n\t\t} else {\n\t\t\tint dir;\n\t\t\tif (h->emptyFileBools == NULL)\n\t\t\t\tdir = 1;\n\t\t\telse {\n\t\t\t\tif (h->emptyFileBools[eindex])\n\t\t\t\t\tdir = 0;\n\t\t\t\telse\n\t\t\t\t\tdir = 1;\n\t\t\t\teindex++;\n\t\t\t}\n\t\t\tif (entries[i].mode == 0) {\n\t\t\t\tif (dir)\n\t\t\t\t\tentries[i].mode = AE_IFDIR | 0777;\n\t\t\t\telse\n\t\t\t\t\tentries[i].mode = AE_IFREG | 0666;\n\t\t\t} else if (dir &&\n\t\t\t (entries[i].mode & AE_IFMT) != AE_IFDIR) {\n\t\t\t\tentries[i].mode &= ~AE_IFMT;\n\t\t\t\tentries[i].mode |= AE_IFDIR;\n\t\t\t}\n\t\t\tif ((entries[i].mode & AE_IFMT) == AE_IFDIR &&\n\t\t\t entries[i].name_len >= 2 &&\n\t\t\t (entries[i].utf16name[entries[i].name_len-2] != '/' ||\n\t\t\t entries[i].utf16name[entries[i].name_len-1] != 0)) {\n\t\t\t\tentries[i].utf16name[entries[i].name_len] = '/';\n\t\t\t\tentries[i].utf16name[entries[i].name_len+1] = 0;\n\t\t\t\tentries[i].name_len += 2;\n\t\t\t}\n\t\t\tentries[i].ssIndex = -1;\n\t\t}\n\t\tif (entries[i].attr & 0x01)\n\t\t\tentries[i].mode &= ~0222;/* Read only. */\n\n\t\tif ((entries[i].flg & HAS_STREAM) == 0 && indexInFolder == 0) {\n\t\t\t/*\n\t\t\t * The entry is an empty file or a directory file,\n\t\t\t * those both have no contents.\n\t\t\t */\n\t\t\tentries[i].folderIndex = -1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (indexInFolder == 0) {\n\t\t\tfor (;;) {\n\t\t\t\tif (folderIndex >= si->ci.numFolders)\n\t\t\t\t\treturn (-1);\n\t\t\t\tif (folders[folderIndex].numUnpackStreams)\n\t\t\t\t\tbreak;\n\t\t\t\tfolderIndex++;\n\t\t\t}\n\t\t}\n\t\tentries[i].folderIndex = folderIndex;\n\t\tif ((entries[i].flg & HAS_STREAM) == 0)\n\t\t\tcontinue;\n\t\tindexInFolder++;\n\t\tif (indexInFolder >= folders[folderIndex].numUnpackStreams) {\n\t\t\tfolderIndex++;\n\t\t\tindexInFolder = 0;\n\t\t}\n\t}\n\n\treturn (0);\n}","lang":"c","vul_type":"cwe-125","target_token_count":2534,"sven_meta":{"func_name":"read_Header","file_name":"libarchive/archive_read_support_format_7zip.c","commit_link":"github.com/libarchive/libarchive/commit/7f17c791dcfd8c0416e2cd2485b19410e47ef126","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#33-0f070717d8eb","input":"static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n#define SkipLinesOp 0x01\n#define SetColorOp 0x02\n#define SkipPixelsOp 0x03\n#define ByteDataOp 0x05\n#define RunDataOp 0x06\n#define EOFOp 0x07\n\n char\n magick[12];\n\n Image\n *image;\n\n int\n opcode,\n operand,\n status;\n\n MagickStatusType\n flags;\n\n MagickSizeType\n number_pixels;\n\n MemoryInfo\n *pixel_info;\n\n Quantum\n index;\n\n register ssize_t\n x;\n\n register Quantum\n *q;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n bits_per_pixel,\n map_length,\n number_colormaps,\n number_planes,\n one,\n offset,\n pixel_info_length;\n\n ssize_t\n count,\n y;\n\n unsigned char\n background_color[256],\n *colormap,\n pixel,\n plane,\n *pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Determine if this a RLE file.\n */\n count=ReadBlob(image,2,(unsigned char *) magick);\n if ((count != 2) || (memcmp(magick,\"\\122\\314\",2) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n do\n {\n /*\n Read image header.\n */\n image->page.x=ReadBlobLSBShort(image);\n image->page.y=ReadBlobLSBShort(image);\n image->columns=ReadBlobLSBShort(image);\n image->rows=ReadBlobLSBShort(image);\n flags=(MagickStatusType) ReadBlobByte(image);\n image->alpha_trait=flags & 0x04 ? BlendPixelTrait : UndefinedPixelTrait;\n number_planes=(size_t) ReadBlobByte(image);\n bits_per_pixel=(size_t) ReadBlobByte(image);\n number_colormaps=(size_t) ReadBlobByte(image);\n map_length=(unsigned char) ReadBlobByte(image);\n if (map_length >= 64)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n one=1;\n map_length=one << map_length;\n if ((number_planes == 0) || (number_planes == 2) || (bits_per_pixel != 8) ||\n (image->columns == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (flags & 0x02)\n {\n /*\n No background color-- initialize to black.\n */\n for (i=0; i < (ssize_t) number_planes; i++)\n background_color[i]=0;\n (void) ReadBlobByte(image);\n }\n else\n {\n /*\n Initialize background color.\n */\n p=background_color;\n for (i=0; i < (ssize_t) number_planes; i++)\n *p++=(unsigned char) ReadBlobByte(image);\n }\n if ((number_planes & 0x01) == 0)\n (void) ReadBlobByte(image);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n colormap=(unsigned char *) NULL;\n if (number_colormaps != 0)\n {\n /*\n Read image colormaps.\n */\n colormap=(unsigned char *) AcquireQuantumMemory(number_colormaps,\n 3*map_length*sizeof(*colormap));\n if (colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=colormap;\n for (i=0; i < (ssize_t) number_colormaps; i++)\n for (x=0; x < (ssize_t) map_length; x++)\n *p++=(unsigned char) ScaleShortToQuantum(ReadBlobLSBShort(image));\n }\n if ((flags & 0x08) != 0)\n {\n char\n *comment;\n\n size_t\n length;\n\n /*\n Read image comment.\n */\n length=ReadBlobLSBShort(image);\n if (length != 0)\n {\n comment=(char *) AcquireQuantumMemory(length,sizeof(*comment));\n if (comment == (char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,length-1,(unsigned char *) comment);\n comment[length-1]='\\0';\n (void) SetImageProperty(image,\"comment\",comment,exception);\n comment=DestroyString(comment);\n if ((length & 0x01) == 0)\n (void) ReadBlobByte(image);\n }\n }\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Allocate RLE pixels.\n */\n if (image->alpha_trait != UndefinedPixelTrait)\n number_planes++;\n number_pixels=(MagickSizeType) image->columns*image->rows;\n if ((number_pixels*number_planes) != (size_t) (number_pixels*number_planes))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixel_info_length=image->columns*image->rows*MagickMax(number_planes,4);\n pixel_info=AcquireVirtualMemory(pixel_info_length,sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n if ((flags & 0x01) && !(flags & 0x02))\n {\n ssize_t\n j;\n\n /*\n Set background color.\n */\n p=pixels;\n for (i=0; i < (ssize_t) number_pixels; i++)\n {\n if (image->alpha_trait == UndefinedPixelTrait)\n for (j=0; j < (ssize_t) number_planes; j++)\n *p++=background_color[j];\n else\n {\n for (j=0; j < (ssize_t) (number_planes-1); j++)\n *p++=background_color[j];\n *p++=0; /* initialize matte channel */\n }\n }\n }\n /*\n Read runlength-encoded image.\n */\n plane=0;\n x=0;\n y=0;\n opcode=ReadBlobByte(image);\n do\n {\n switch (opcode & 0x3f)\n {\n case SkipLinesOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n x=0;\n y+=operand;\n break;\n }\n case SetColorOp:\n {\n operand=ReadBlobByte(image);\n plane=(unsigned char) operand;\n if (plane == 255)\n plane=(unsigned char) (number_planes-1);\n x=0;\n break;\n }\n case SkipPixelsOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n x+=operand;\n break;\n }\n case ByteDataOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n offset=((image->rows-y-1)*image->columns*number_planes)+x*\n number_planes+plane;\n operand++;\n if (offset+((size_t) operand*number_planes) > pixel_info_length)\n {\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n p=pixels+offset;\n for (i=0; i < (ssize_t) operand; i++)\n {\n pixel=(unsigned char) ReadBlobByte(image);\n if ((y < (ssize_t) image->rows) &&\n ((x+i) < (ssize_t) image->columns))\n *p=pixel;\n p+=number_planes;\n }\n if (operand & 0x01)\n (void) ReadBlobByte(image);\n x+=operand;\n break;\n }\n case RunDataOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n pixel=(unsigned char) ReadBlobByte(image);\n (void) ReadBlobByte(image);\n offset=((image->rows-y-1)*image->columns*number_planes)+x*\n number_planes+plane;\n operand++;\n if (offset+((size_t) operand*number_planes) > pixel_info_length)\n {\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n p=pixels+offset;\n for (i=0; i < (ssize_t) operand; i++)\n {\n if ((y < (ssize_t) image->rows) &&\n ((x+i) < (ssize_t) image->columns))\n *p=pixel;\n p+=number_planes;\n }\n x+=operand;\n break;\n }\n default:\n break;\n }\n opcode=ReadBlobByte(image);\n } while (((opcode & 0x3f) != EOFOp) && (opcode != EOF));\n if (number_colormaps != 0)\n {\n MagickStatusType\n mask;\n\n /*\n Apply colormap affineation to image.\n */\n mask=(MagickStatusType) (map_length-1);\n p=pixels;\n x=(ssize_t) number_planes;\n if (number_colormaps == 1)\n for (i=0; i < (ssize_t) number_pixels; i++)\n {\n if (IsValidColormapIndex(image,*p & mask,&index,exception) ==\n MagickFalse)\n break;\n *p=colormap[(ssize_t) index];\n p++;\n }\n else\n if ((number_planes >= 3) && (number_colormaps >= 3))\n for (i=0; i < (ssize_t) number_pixels; i++)\n for (x=0; x < (ssize_t) number_planes; x++)\n {\n if (IsValidColormapIndex(image,(size_t) (x*map_length+\n (*p & mask)),&index,exception) == MagickFalse)\n break;\n *p=colormap[(ssize_t) index];\n p++;\n }\n if ((i < (ssize_t) number_pixels) || (x < (ssize_t) number_planes))\n {\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n }\n /*\n Initialize image structure.\n */\n if (number_planes >= 3)\n {\n /*\n Convert raster image to DirectClass pixel packets.\n */\n p=pixels;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n /*\n Create colormap.\n */\n if (number_colormaps == 0)\n map_length=256;\n if (AcquireImageColormap(image,map_length,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=colormap;\n if (number_colormaps == 1)\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n /*\n Pseudocolor.\n */\n image->colormap[i].red=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n image->colormap[i].green=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n image->colormap[i].blue=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n }\n else\n if (number_colormaps > 1)\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n image->colormap[i].red=(MagickRealType)\n ScaleCharToQuantum(*p);\n image->colormap[i].green=(MagickRealType)\n ScaleCharToQuantum(*(p+map_length));\n image->colormap[i].blue=(MagickRealType)\n ScaleCharToQuantum(*(p+map_length*2));\n p++;\n }\n p=pixels;\n if (image->alpha_trait == UndefinedPixelTrait)\n {\n /*\n Convert raster image to PseudoClass pixel packets.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p++,q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n (void) SyncImage(image,exception);\n }\n else\n {\n /*\n Image has a matte channel-- promote to DirectClass.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t)\n index].red),q);\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t)\n index].green),q);\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t)\n index].blue),q);\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n q+=GetPixelChannels(image);\n }\n if (x < (ssize_t) image->columns)\n break;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n image->colormap=(PixelInfo *) RelinquishMagickMemory(\n image->colormap);\n image->storage_class=DirectClass;\n image->colors=0;\n }\n }\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n (void) ReadBlobByte(image);\n count=ReadBlob(image,2,(unsigned char *) magick);\n if ((count != 0) && (memcmp(magick,\"\\122\\314\",2) == 0))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while ((count != 0) && (memcmp(magick,\"\\122\\314\",2) == 0));\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n#define SkipLinesOp 0x01\n#define SetColorOp 0x02\n#define SkipPixelsOp 0x03\n#define ByteDataOp 0x05\n#define RunDataOp 0x06\n#define EOFOp 0x07\n\n char\n magick[12];\n\n Image\n *image;\n\n int\n opcode,\n operand,\n status;\n\n MagickStatusType\n flags;\n\n MagickSizeType\n number_pixels;\n\n MemoryInfo\n *pixel_info;\n\n Quantum\n index;\n\n register ssize_t\n x;\n\n register Quantum\n *q;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n bits_per_pixel,\n map_length,\n number_colormaps,\n number_planes,\n number_planes_filled,\n one,\n offset,\n pixel_info_length;\n\n ssize_t\n count,\n y;\n\n unsigned char\n background_color[256],\n *colormap,\n pixel,\n plane,\n *pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Determine if this a RLE file.\n */\n count=ReadBlob(image,2,(unsigned char *) magick);\n if ((count != 2) || (memcmp(magick,\"\\122\\314\",2) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n do\n {\n /*\n Read image header.\n */\n image->page.x=ReadBlobLSBShort(image);\n image->page.y=ReadBlobLSBShort(image);\n image->columns=ReadBlobLSBShort(image);\n image->rows=ReadBlobLSBShort(image);\n flags=(MagickStatusType) ReadBlobByte(image);\n image->alpha_trait=flags & 0x04 ? BlendPixelTrait : UndefinedPixelTrait;\n number_planes=(size_t) ReadBlobByte(image);\n bits_per_pixel=(size_t) ReadBlobByte(image);\n number_colormaps=(size_t) ReadBlobByte(image);\n map_length=(unsigned char) ReadBlobByte(image);\n if (map_length >= 64)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n one=1;\n map_length=one << map_length;\n if ((number_planes == 0) || (number_planes == 2) || (bits_per_pixel != 8) ||\n (image->columns == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (flags & 0x02)\n {\n /*\n No background color-- initialize to black.\n */\n for (i=0; i < (ssize_t) number_planes; i++)\n background_color[i]=0;\n (void) ReadBlobByte(image);\n }\n else\n {\n /*\n Initialize background color.\n */\n p=background_color;\n for (i=0; i < (ssize_t) number_planes; i++)\n *p++=(unsigned char) ReadBlobByte(image);\n }\n if ((number_planes & 0x01) == 0)\n (void) ReadBlobByte(image);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n colormap=(unsigned char *) NULL;\n if (number_colormaps != 0)\n {\n /*\n Read image colormaps.\n */\n colormap=(unsigned char *) AcquireQuantumMemory(number_colormaps,\n 3*map_length*sizeof(*colormap));\n if (colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=colormap;\n for (i=0; i < (ssize_t) number_colormaps; i++)\n for (x=0; x < (ssize_t) map_length; x++)\n *p++=(unsigned char) ScaleShortToQuantum(ReadBlobLSBShort(image));\n }\n if ((flags & 0x08) != 0)\n {\n char\n *comment;\n\n size_t\n length;\n\n /*\n Read image comment.\n */\n length=ReadBlobLSBShort(image);\n if (length != 0)\n {\n comment=(char *) AcquireQuantumMemory(length,sizeof(*comment));\n if (comment == (char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,length-1,(unsigned char *) comment);\n comment[length-1]='\\0';\n (void) SetImageProperty(image,\"comment\",comment,exception);\n comment=DestroyString(comment);\n if ((length & 0x01) == 0)\n (void) ReadBlobByte(image);\n }\n }\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Allocate RLE pixels.\n */\n if (image->alpha_trait != UndefinedPixelTrait)\n number_planes++;\n number_pixels=(MagickSizeType) image->columns*image->rows;\n number_planes_filled=(number_planes % 2 == 0) ? number_planes :\n number_planes+1;\n if ((number_pixels*number_planes_filled) != (size_t) (number_pixels*\n number_planes_filled))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixel_info_length=image->columns*image->rows*number_planes_filled;\n pixel_info=AcquireVirtualMemory(pixel_info_length,sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n if ((flags & 0x01) && !(flags & 0x02))\n {\n ssize_t\n j;\n\n /*\n Set background color.\n */\n p=pixels;\n for (i=0; i < (ssize_t) number_pixels; i++)\n {\n if (image->alpha_trait == UndefinedPixelTrait)\n for (j=0; j < (ssize_t) number_planes; j++)\n *p++=background_color[j];\n else\n {\n for (j=0; j < (ssize_t) (number_planes-1); j++)\n *p++=background_color[j];\n *p++=0; /* initialize matte channel */\n }\n }\n }\n /*\n Read runlength-encoded image.\n */\n plane=0;\n x=0;\n y=0;\n opcode=ReadBlobByte(image);\n do\n {\n switch (opcode & 0x3f)\n {\n case SkipLinesOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n x=0;\n y+=operand;\n break;\n }\n case SetColorOp:\n {\n operand=ReadBlobByte(image);\n plane=(unsigned char) operand;\n if (plane == 255)\n plane=(unsigned char) (number_planes-1);\n x=0;\n break;\n }\n case SkipPixelsOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n x+=operand;\n break;\n }\n case ByteDataOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n offset=((image->rows-y-1)*image->columns*number_planes)+x*\n number_planes+plane;\n operand++;\n if (offset+((size_t) operand*number_planes) > pixel_info_length)\n {\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n p=pixels+offset;\n for (i=0; i < (ssize_t) operand; i++)\n {\n pixel=(unsigned char) ReadBlobByte(image);\n if ((y < (ssize_t) image->rows) &&\n ((x+i) < (ssize_t) image->columns))\n *p=pixel;\n p+=number_planes;\n }\n if (operand & 0x01)\n (void) ReadBlobByte(image);\n x+=operand;\n break;\n }\n case RunDataOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n pixel=(unsigned char) ReadBlobByte(image);\n (void) ReadBlobByte(image);\n offset=((image->rows-y-1)*image->columns*number_planes)+x*\n number_planes+plane;\n operand++;\n if (offset+((size_t) operand*number_planes) > pixel_info_length)\n {\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n p=pixels+offset;\n for (i=0; i < (ssize_t) operand; i++)\n {\n if ((y < (ssize_t) image->rows) &&\n ((x+i) < (ssize_t) image->columns))\n *p=pixel;\n p+=number_planes;\n }\n x+=operand;\n break;\n }\n default:\n break;\n }\n opcode=ReadBlobByte(image);\n } while (((opcode & 0x3f) != EOFOp) && (opcode != EOF));\n if (number_colormaps != 0)\n {\n MagickStatusType\n mask;\n\n /*\n Apply colormap affineation to image.\n */\n mask=(MagickStatusType) (map_length-1);\n p=pixels;\n x=(ssize_t) number_planes;\n if (number_colormaps == 1)\n for (i=0; i < (ssize_t) number_pixels; i++)\n {\n if (IsValidColormapIndex(image,*p & mask,&index,exception) ==\n MagickFalse)\n break;\n *p=colormap[(ssize_t) index];\n p++;\n }\n else\n if ((number_planes >= 3) && (number_colormaps >= 3))\n for (i=0; i < (ssize_t) number_pixels; i++)\n for (x=0; x < (ssize_t) number_planes; x++)\n {\n if (IsValidColormapIndex(image,(size_t) (x*map_length+\n (*p & mask)),&index,exception) == MagickFalse)\n break;\n *p=colormap[(ssize_t) index];\n p++;\n }\n if ((i < (ssize_t) number_pixels) || (x < (ssize_t) number_planes))\n {\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n }\n /*\n Initialize image structure.\n */\n if (number_planes >= 3)\n {\n /*\n Convert raster image to DirectClass pixel packets.\n */\n p=pixels;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n /*\n Create colormap.\n */\n if (number_colormaps == 0)\n map_length=256;\n if (AcquireImageColormap(image,map_length,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=colormap;\n if (number_colormaps == 1)\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n /*\n Pseudocolor.\n */\n image->colormap[i].red=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n image->colormap[i].green=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n image->colormap[i].blue=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n }\n else\n if (number_colormaps > 1)\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n image->colormap[i].red=(MagickRealType)\n ScaleCharToQuantum(*p);\n image->colormap[i].green=(MagickRealType)\n ScaleCharToQuantum(*(p+map_length));\n image->colormap[i].blue=(MagickRealType)\n ScaleCharToQuantum(*(p+map_length*2));\n p++;\n }\n p=pixels;\n if (image->alpha_trait == UndefinedPixelTrait)\n {\n /*\n Convert raster image to PseudoClass pixel packets.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p++,q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n (void) SyncImage(image,exception);\n }\n else\n {\n /*\n Image has a matte channel-- promote to DirectClass.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t)\n index].red),q);\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t)\n index].green),q);\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t)\n index].blue),q);\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n q+=GetPixelChannels(image);\n }\n if (x < (ssize_t) image->columns)\n break;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n image->colormap=(PixelInfo *) RelinquishMagickMemory(\n image->colormap);\n image->storage_class=DirectClass;\n image->colors=0;\n }\n }\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n (void) ReadBlobByte(image);\n count=ReadBlob(image,2,(unsigned char *) magick);\n if ((count != 0) && (memcmp(magick,\"\\122\\314\",2) == 0))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while ((count != 0) && (memcmp(magick,\"\\122\\314\",2) == 0));\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-125","target_token_count":4203,"sven_meta":{"func_name":"ReadRLEImage","file_name":"coders/rle.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/2ad6d33493750a28a5a655d319a8e0b16c392de1","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#34-930f3cb5a4c3","input":"bool JSON_parser(Variant &z, const char *p, int length, bool const assoc,\n int depth, int64_t options) {\n // No GC safepoints during JSON parsing, please. Code is not re-entrant.\n NoHandleSurpriseScope no_surprise(SafepointFlags);\n\n json_parser *json = s_json_parser.get(); /* the parser state */\n // Clear and reuse the thread-local string buffers. They are only freed if\n // they exceed kMaxPersistentStringBufferCapacity at exit or if the thread\n // is explicitly flushed (e.g., due to being idle).\n json->initSb(length);\n SCOPE_EXIT {\n constexpr int kMaxPersistentStringBufferCapacity = 256 * 1024;\n if (json->sb_cap > kMaxPersistentStringBufferCapacity) json->flushSb();\n };\n // SimpleParser only handles the most common set of options. Also, only use it\n // if its array nesting depth check is *more* restrictive than what the user\n // asks for, to ensure that the precise semantics of the general case is\n // applied for all nesting overflows.\n if (assoc &&\n options == (options & (k_JSON_FB_LOOSE |\n k_JSON_FB_DARRAYS |\n k_JSON_FB_DARRAYS_AND_VARRAYS |\n k_JSON_FB_HACK_ARRAYS |\n k_JSON_FB_THRIFT_SIMPLE_JSON |\n k_JSON_FB_LEGACY_HACK_ARRAYS)) &&\n depth >= SimpleParser::kMaxArrayDepth &&\n length <= RuntimeOption::EvalSimpleJsonMaxLength &&\n SimpleParser::TryParse(p, length, json->tl_buffer.tv, z,\n get_container_type_from_options(options),\n options & k_JSON_FB_THRIFT_SIMPLE_JSON)) {\n return true;\n }\n\n int b; /* the next character */\n int c; /* the next character class */\n int s; /* the next state */\n int state = 0;\n\n /**/\n bool const loose = options & k_JSON_FB_LOOSE;\n JSONContainerType const container_type =\n get_container_type_from_options(options);\n int qchr = 0;\n int8_t const *byte_class;\n int8_t const (*next_state_table)[32];\n if (loose) {\n byte_class = loose_ascii_class;\n next_state_table = loose_state_transition_table;\n } else {\n byte_class = ascii_class;\n next_state_table = state_transition_table;\n }\n /**/\n\n UncheckedBuffer *buf = &json->sb_buf;\n UncheckedBuffer *key = &json->sb_key;\n\n DataType type = kInvalidDataType;\n unsigned short escaped_bytes = 0;\n\n auto reset_type = [&] { type = kInvalidDataType; };\n\n json->depth = depth;\n // Since the stack is maintainined on a per request basis, for performance\n // reasons, it only makes sense to expand if necessary and cycles are wasted\n // contracting. Calls with a depth other than default should be rare.\n if (depth > json->stack.size()) {\n json->stack.resize(depth);\n }\n SCOPE_EXIT {\n if (json->stack.empty()) return;\n for (int i = 0; i <= json->mark; i++) {\n json->stack[i].key.reset();\n json->stack[i].val.unset();\n }\n json->mark = -1;\n };\n\n json->mark = json->top = -1;\n push(json, Mode::DONE);\n\n UTF8To16Decoder decoder(p, length, loose);\n for (;;) {\n b = decoder.decode();\n // Fast-case most common transition: append a simple string character.\n if (state == 3 && type == KindOfString) {\n while (b != '\\\"' && b != '\\\\' && b != '\\'' && b <= 127 && b >= ' ') {\n buf->append((char)b);\n b = decoder.decode();\n }\n }\n if (b == UTF8_END) break; // UTF-8 decoding finishes successfully.\n if (b == UTF8_ERROR) {\n s_json_parser->error_code = JSON_ERROR_UTF8;\n return false;\n }\n assertx(b >= 0);\n\n if ((b & 127) == b) {\n /**/\n c = byte_class[b];\n /**/\n if (c <= S_ERR) {\n s_json_parser->error_code = JSON_ERROR_CTRL_CHAR;\n return false;\n }\n } else {\n c = S_ETC;\n }\n /*\n Get the next state from the transition table.\n */\n\n /**/\n s = next_state_table[state][c];\n\n if (s == -4) {\n if (b != qchr) {\n s = 3;\n } else {\n qchr = 0;\n }\n }\n /**/\n\n if (s < 0) {\n /*\n Perform one of the predefined actions.\n */\n switch (s) {\n /*\n empty }\n */\n case -9:\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key, assoc, container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::KEY)) {\n return false;\n }\n state = 9;\n break;\n /*\n {\n */\n case -8:\n if (!push(json, Mode::KEY)) {\n s_json_parser->error_code = JSON_ERROR_DEPTH;\n return false;\n }\n\n state = 1;\n if (json->top > 0) {\n Variant &top = json->stack[json->top].val;\n /**/\n if (container_type == JSONContainerType::COLLECTIONS) {\n // stable_maps is meaningless\n top = req::make();\n } else {\n /**/\n if (!assoc) {\n top = SystemLib::AllocStdClassObject();\n /* */\n } else if (container_type == JSONContainerType::HACK_ARRAYS) {\n top = Array::CreateDict();\n } else if (container_type == JSONContainerType::DARRAYS ||\n container_type == JSONContainerType::DARRAYS_AND_VARRAYS)\n {\n top = Array::CreateDArray();\n /* */\n } else if (\n container_type == JSONContainerType::LEGACY_HACK_ARRAYS) {\n auto arr = staticEmptyDictArray()->copy();\n arr->setLegacyArray(true);\n top = arr;\n } else {\n top = Array::CreateDArray();\n }\n /**/\n }\n /**/\n json->stack[json->top].key = copy_and_clear(*key);\n reset_type();\n }\n break;\n /*\n }\n */\n case -7:\n /*** BEGIN Facebook: json_utf8_loose ***/\n /*\n If this is a trailing comma in an object definition,\n we're in Mode::KEY. In that case, throw that off the\n stack and restore Mode::OBJECT so that we pretend the\n trailing comma just didn't happen.\n */\n if (loose) {\n if (pop(json, Mode::KEY)) {\n push(json, Mode::OBJECT);\n }\n }\n /*** END Facebook: json_utf8_loose ***/\n\n if (type != kInvalidDataType &&\n json->stack[json->top].mode == Mode::OBJECT) {\n Variant mval;\n json_create_zval(mval, *buf, type, options);\n Variant &top = json->stack[json->top].val;\n object_set(json, top, copy_and_clear(*key),\n mval, assoc, container_type);\n buf->clear();\n reset_type();\n }\n\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key,\n assoc, container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::OBJECT)) {\n s_json_parser->error_code = JSON_ERROR_STATE_MISMATCH;\n return false;\n }\n state = 9;\n break;\n /*\n [\n */\n case -6:\n if (!push(json, Mode::ARRAY)) {\n s_json_parser->error_code = JSON_ERROR_DEPTH;\n return false;\n }\n state = 2;\n\n if (json->top > 0) {\n Variant &top = json->stack[json->top].val;\n /**/\n if (container_type == JSONContainerType::COLLECTIONS) {\n top = req::make();\n } else if (container_type == JSONContainerType::HACK_ARRAYS) {\n top = Array::CreateVec();\n } else if (container_type == JSONContainerType::DARRAYS_AND_VARRAYS) {\n top = Array::CreateVArray();\n } else if (container_type == JSONContainerType::DARRAYS) {\n top = Array::CreateDArray();\n } else if (container_type == JSONContainerType::LEGACY_HACK_ARRAYS) {\n auto arr = staticEmptyVecArray()->copy();\n arr->setLegacyArray(true);\n top = arr;\n } else {\n top = Array::CreateDArray();\n }\n /**/\n json->stack[json->top].key = copy_and_clear(*key);\n reset_type();\n }\n break;\n /*\n ]\n */\n case -5:\n {\n if (type != kInvalidDataType &&\n json->stack[json->top].mode == Mode::ARRAY) {\n Variant mval;\n json_create_zval(mval, *buf, type, options);\n auto& top = json->stack[json->top].val;\n if (container_type == JSONContainerType::COLLECTIONS) {\n collections::append(top.getObjectData(), mval.asTypedValue());\n } else {\n top.asArrRef().append(mval);\n }\n buf->clear();\n reset_type();\n }\n\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key, assoc,\n container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::ARRAY)) {\n s_json_parser->error_code = JSON_ERROR_STATE_MISMATCH;\n return false;\n }\n state = 9;\n }\n break;\n /*\n \"\n */\n case -4:\n switch (json->stack[json->top].mode) {\n case Mode::KEY:\n state = 27;\n std::swap(buf, key);\n reset_type();\n break;\n case Mode::ARRAY:\n case Mode::OBJECT:\n state = 9;\n break;\n case Mode::DONE:\n if (type == KindOfString) {\n z = copy_and_clear(*buf);\n state = 9;\n break;\n }\n /* fall through if not KindOfString */\n default:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n break;\n /*\n ,\n */\n case -3:\n {\n Variant mval;\n if (type != kInvalidDataType &&\n (json->stack[json->top].mode == Mode::OBJECT ||\n json->stack[json->top].mode == Mode::ARRAY)) {\n json_create_zval(mval, *buf, type, options);\n }\n\n switch (json->stack[json->top].mode) {\n case Mode::OBJECT:\n if (pop(json, Mode::OBJECT) &&\n push(json, Mode::KEY)) {\n if (type != kInvalidDataType) {\n Variant &top = json->stack[json->top].val;\n object_set(\n json,\n top,\n copy_and_clear(*key),\n mval,\n assoc,\n container_type\n );\n }\n state = 29;\n }\n break;\n case Mode::ARRAY:\n if (type != kInvalidDataType) {\n auto& top = json->stack[json->top].val;\n if (container_type == JSONContainerType::COLLECTIONS) {\n collections::append(top.getObjectData(), mval.asTypedValue());\n } else {\n top.asArrRef().append(mval);\n }\n }\n state = 28;\n break;\n default:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n buf->clear();\n reset_type();\n check_non_safepoint_surprise();\n }\n break;\n\n /**/\n /*\n : (after unquoted string)\n */\n case -10:\n if (json->stack[json->top].mode == Mode::KEY) {\n state = 27;\n std::swap(buf, key);\n reset_type();\n s = -2;\n } else {\n s = 3;\n break;\n }\n /**/\n\n /*\n :\n */\n case -2:\n if (pop(json, Mode::KEY) && push(json, Mode::OBJECT)) {\n state = 28;\n break;\n }\n /*\n syntax error\n */\n case -1:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n } else {\n /*\n Change the state and iterate.\n */\n bool is_tsimplejson = options & k_JSON_FB_THRIFT_SIMPLE_JSON;\n if (type == KindOfString) {\n if (/**/(/**/s == 3/**/ || s == 30)/**/ &&\n state != 8) {\n if (state != 4) {\n utf16_to_utf8(*buf, b);\n } else {\n switch (b) {\n case 'b': buf->append('\\b'); break;\n case 't': buf->append('\\t'); break;\n case 'n': buf->append('\\n'); break;\n case 'f': buf->append('\\f'); break;\n case 'r': buf->append('\\r'); break;\n default:\n utf16_to_utf8(*buf, b);\n break;\n }\n }\n } else if (s == 6) {\n if (UNLIKELY(is_tsimplejson)) {\n if (UNLIKELY(b != '0')) {\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n escaped_bytes = 0;\n } else {\n escaped_bytes = dehexchar(b) << 12;\n }\n } else if (s == 7) {\n if (UNLIKELY(is_tsimplejson)) {\n if (UNLIKELY(b != '0')) {\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n } else {\n escaped_bytes += dehexchar(b) << 8;\n }\n } else if (s == 8) {\n escaped_bytes += dehexchar(b) << 4;\n } else if (s == 3 && state == 8) {\n escaped_bytes += dehexchar(b);\n if (UNLIKELY(is_tsimplejson)) {\n buf->append((char)escaped_bytes);\n } else {\n utf16_to_utf8(*buf, escaped_bytes);\n }\n }\n } else if ((type == kInvalidDataType || type == KindOfNull) &&\n (c == S_DIG || c == S_ZER)) {\n type = KindOfInt64;\n buf->append((char)b);\n } else if (type == KindOfInt64 && s == 24) {\n type = KindOfDouble;\n buf->append((char)b);\n } else if ((type == kInvalidDataType || type == KindOfNull ||\n type == KindOfInt64) &&\n c == S_DOT) {\n type = KindOfDouble;\n buf->append((char)b);\n } else if (type != KindOfString && c == S_QUO) {\n type = KindOfString;\n /**/qchr = b;/**/\n } else if ((type == kInvalidDataType || type == KindOfNull ||\n type == KindOfInt64 || type == KindOfDouble) &&\n ((state == 12 && s == 9) ||\n (state == 16 && s == 9))) {\n type = KindOfBoolean;\n } else if (type == kInvalidDataType && state == 19 && s == 9) {\n type = KindOfNull;\n } else if (type != KindOfString && c > S_WSP) {\n utf16_to_utf8(*buf, b);\n }\n\n state = s;\n }\n }\n\n if (state == 9 && pop(json, Mode::DONE)) {\n s_json_parser->error_code = JSON_ERROR_NONE;\n return true;\n }\n\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n}","target":"bool JSON_parser(Variant &z, const char *p, int length, bool const assoc,\n int depth, int64_t options) {\n // No GC safepoints during JSON parsing, please. Code is not re-entrant.\n NoHandleSurpriseScope no_surprise(SafepointFlags);\n\n json_parser *json = s_json_parser.get(); /* the parser state */\n // Clear and reuse the thread-local string buffers. They are only freed if\n // they exceed kMaxPersistentStringBufferCapacity at exit or if the thread\n // is explicitly flushed (e.g., due to being idle).\n json->initSb(length);\n if (depth <= 0) {\n json->error_code = json_error_codes::JSON_ERROR_DEPTH;\n return false;\n }\n SCOPE_EXIT {\n constexpr int kMaxPersistentStringBufferCapacity = 256 * 1024;\n if (json->sb_cap > kMaxPersistentStringBufferCapacity) json->flushSb();\n };\n // SimpleParser only handles the most common set of options. Also, only use it\n // if its array nesting depth check is *more* restrictive than what the user\n // asks for, to ensure that the precise semantics of the general case is\n // applied for all nesting overflows.\n if (assoc &&\n options == (options & (k_JSON_FB_LOOSE |\n k_JSON_FB_DARRAYS |\n k_JSON_FB_DARRAYS_AND_VARRAYS |\n k_JSON_FB_HACK_ARRAYS |\n k_JSON_FB_THRIFT_SIMPLE_JSON |\n k_JSON_FB_LEGACY_HACK_ARRAYS)) &&\n depth >= SimpleParser::kMaxArrayDepth &&\n length <= RuntimeOption::EvalSimpleJsonMaxLength &&\n SimpleParser::TryParse(p, length, json->tl_buffer.tv, z,\n get_container_type_from_options(options),\n options & k_JSON_FB_THRIFT_SIMPLE_JSON)) {\n return true;\n }\n\n int b; /* the next character */\n int c; /* the next character class */\n int s; /* the next state */\n int state = 0;\n\n /**/\n bool const loose = options & k_JSON_FB_LOOSE;\n JSONContainerType const container_type =\n get_container_type_from_options(options);\n int qchr = 0;\n int8_t const *byte_class;\n int8_t const (*next_state_table)[32];\n if (loose) {\n byte_class = loose_ascii_class;\n next_state_table = loose_state_transition_table;\n } else {\n byte_class = ascii_class;\n next_state_table = state_transition_table;\n }\n /**/\n\n UncheckedBuffer *buf = &json->sb_buf;\n UncheckedBuffer *key = &json->sb_key;\n\n DataType type = kInvalidDataType;\n unsigned short escaped_bytes = 0;\n\n auto reset_type = [&] { type = kInvalidDataType; };\n\n json->depth = depth;\n // Since the stack is maintainined on a per request basis, for performance\n // reasons, it only makes sense to expand if necessary and cycles are wasted\n // contracting. Calls with a depth other than default should be rare.\n if (depth > json->stack.size()) {\n json->stack.resize(depth);\n }\n SCOPE_EXIT {\n if (json->stack.empty()) return;\n for (int i = 0; i <= json->mark; i++) {\n json->stack[i].key.reset();\n json->stack[i].val.unset();\n }\n json->mark = -1;\n };\n\n json->mark = json->top = -1;\n push(json, Mode::DONE);\n\n UTF8To16Decoder decoder(p, length, loose);\n for (;;) {\n b = decoder.decode();\n // Fast-case most common transition: append a simple string character.\n if (state == 3 && type == KindOfString) {\n while (b != '\\\"' && b != '\\\\' && b != '\\'' && b <= 127 && b >= ' ') {\n buf->append((char)b);\n b = decoder.decode();\n }\n }\n if (b == UTF8_END) break; // UTF-8 decoding finishes successfully.\n if (b == UTF8_ERROR) {\n s_json_parser->error_code = JSON_ERROR_UTF8;\n return false;\n }\n assertx(b >= 0);\n\n if ((b & 127) == b) {\n /**/\n c = byte_class[b];\n /**/\n if (c <= S_ERR) {\n s_json_parser->error_code = JSON_ERROR_CTRL_CHAR;\n return false;\n }\n } else {\n c = S_ETC;\n }\n /*\n Get the next state from the transition table.\n */\n\n /**/\n s = next_state_table[state][c];\n\n if (s == -4) {\n if (b != qchr) {\n s = 3;\n } else {\n qchr = 0;\n }\n }\n /**/\n\n if (s < 0) {\n /*\n Perform one of the predefined actions.\n */\n switch (s) {\n /*\n empty }\n */\n case -9:\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key, assoc, container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::KEY)) {\n return false;\n }\n state = 9;\n break;\n /*\n {\n */\n case -8:\n if (!push(json, Mode::KEY)) {\n s_json_parser->error_code = JSON_ERROR_DEPTH;\n return false;\n }\n\n state = 1;\n if (json->top > 0) {\n Variant &top = json->stack[json->top].val;\n /**/\n if (container_type == JSONContainerType::COLLECTIONS) {\n // stable_maps is meaningless\n top = req::make();\n } else {\n /**/\n if (!assoc) {\n top = SystemLib::AllocStdClassObject();\n /* */\n } else if (container_type == JSONContainerType::HACK_ARRAYS) {\n top = Array::CreateDict();\n } else if (container_type == JSONContainerType::DARRAYS ||\n container_type == JSONContainerType::DARRAYS_AND_VARRAYS)\n {\n top = Array::CreateDArray();\n /* */\n } else if (\n container_type == JSONContainerType::LEGACY_HACK_ARRAYS) {\n auto arr = staticEmptyDictArray()->copy();\n arr->setLegacyArray(true);\n top = arr;\n } else {\n top = Array::CreateDArray();\n }\n /**/\n }\n /**/\n json->stack[json->top].key = copy_and_clear(*key);\n reset_type();\n }\n break;\n /*\n }\n */\n case -7:\n /*** BEGIN Facebook: json_utf8_loose ***/\n /*\n If this is a trailing comma in an object definition,\n we're in Mode::KEY. In that case, throw that off the\n stack and restore Mode::OBJECT so that we pretend the\n trailing comma just didn't happen.\n */\n if (loose) {\n if (pop(json, Mode::KEY)) {\n push(json, Mode::OBJECT);\n }\n }\n /*** END Facebook: json_utf8_loose ***/\n\n if (type != kInvalidDataType &&\n json->stack[json->top].mode == Mode::OBJECT) {\n Variant mval;\n json_create_zval(mval, *buf, type, options);\n Variant &top = json->stack[json->top].val;\n object_set(json, top, copy_and_clear(*key),\n mval, assoc, container_type);\n buf->clear();\n reset_type();\n }\n\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key,\n assoc, container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::OBJECT)) {\n s_json_parser->error_code = JSON_ERROR_STATE_MISMATCH;\n return false;\n }\n state = 9;\n break;\n /*\n [\n */\n case -6:\n if (!push(json, Mode::ARRAY)) {\n s_json_parser->error_code = JSON_ERROR_DEPTH;\n return false;\n }\n state = 2;\n\n if (json->top > 0) {\n Variant &top = json->stack[json->top].val;\n /**/\n if (container_type == JSONContainerType::COLLECTIONS) {\n top = req::make();\n } else if (container_type == JSONContainerType::HACK_ARRAYS) {\n top = Array::CreateVec();\n } else if (container_type == JSONContainerType::DARRAYS_AND_VARRAYS) {\n top = Array::CreateVArray();\n } else if (container_type == JSONContainerType::DARRAYS) {\n top = Array::CreateDArray();\n } else if (container_type == JSONContainerType::LEGACY_HACK_ARRAYS) {\n auto arr = staticEmptyVecArray()->copy();\n arr->setLegacyArray(true);\n top = arr;\n } else {\n top = Array::CreateDArray();\n }\n /**/\n json->stack[json->top].key = copy_and_clear(*key);\n reset_type();\n }\n break;\n /*\n ]\n */\n case -5:\n {\n if (type != kInvalidDataType &&\n json->stack[json->top].mode == Mode::ARRAY) {\n Variant mval;\n json_create_zval(mval, *buf, type, options);\n auto& top = json->stack[json->top].val;\n if (container_type == JSONContainerType::COLLECTIONS) {\n collections::append(top.getObjectData(), mval.asTypedValue());\n } else {\n top.asArrRef().append(mval);\n }\n buf->clear();\n reset_type();\n }\n\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key, assoc,\n container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::ARRAY)) {\n s_json_parser->error_code = JSON_ERROR_STATE_MISMATCH;\n return false;\n }\n state = 9;\n }\n break;\n /*\n \"\n */\n case -4:\n switch (json->stack[json->top].mode) {\n case Mode::KEY:\n state = 27;\n std::swap(buf, key);\n reset_type();\n break;\n case Mode::ARRAY:\n case Mode::OBJECT:\n state = 9;\n break;\n case Mode::DONE:\n if (type == KindOfString) {\n z = copy_and_clear(*buf);\n state = 9;\n break;\n }\n /* fall through if not KindOfString */\n default:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n break;\n /*\n ,\n */\n case -3:\n {\n Variant mval;\n if (type != kInvalidDataType &&\n (json->stack[json->top].mode == Mode::OBJECT ||\n json->stack[json->top].mode == Mode::ARRAY)) {\n json_create_zval(mval, *buf, type, options);\n }\n\n switch (json->stack[json->top].mode) {\n case Mode::OBJECT:\n if (pop(json, Mode::OBJECT) &&\n push(json, Mode::KEY)) {\n if (type != kInvalidDataType) {\n Variant &top = json->stack[json->top].val;\n object_set(\n json,\n top,\n copy_and_clear(*key),\n mval,\n assoc,\n container_type\n );\n }\n state = 29;\n }\n break;\n case Mode::ARRAY:\n if (type != kInvalidDataType) {\n auto& top = json->stack[json->top].val;\n if (container_type == JSONContainerType::COLLECTIONS) {\n collections::append(top.getObjectData(), mval.asTypedValue());\n } else {\n top.asArrRef().append(mval);\n }\n }\n state = 28;\n break;\n default:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n buf->clear();\n reset_type();\n check_non_safepoint_surprise();\n }\n break;\n\n /**/\n /*\n : (after unquoted string)\n */\n case -10:\n if (json->stack[json->top].mode == Mode::KEY) {\n state = 27;\n std::swap(buf, key);\n reset_type();\n s = -2;\n } else {\n s = 3;\n break;\n }\n /**/\n\n /*\n :\n */\n case -2:\n if (pop(json, Mode::KEY) && push(json, Mode::OBJECT)) {\n state = 28;\n break;\n }\n /*\n syntax error\n */\n case -1:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n } else {\n /*\n Change the state and iterate.\n */\n bool is_tsimplejson = options & k_JSON_FB_THRIFT_SIMPLE_JSON;\n if (type == KindOfString) {\n if (/**/(/**/s == 3/**/ || s == 30)/**/ &&\n state != 8) {\n if (state != 4) {\n utf16_to_utf8(*buf, b);\n } else {\n switch (b) {\n case 'b': buf->append('\\b'); break;\n case 't': buf->append('\\t'); break;\n case 'n': buf->append('\\n'); break;\n case 'f': buf->append('\\f'); break;\n case 'r': buf->append('\\r'); break;\n default:\n utf16_to_utf8(*buf, b);\n break;\n }\n }\n } else if (s == 6) {\n if (UNLIKELY(is_tsimplejson)) {\n if (UNLIKELY(b != '0')) {\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n escaped_bytes = 0;\n } else {\n escaped_bytes = dehexchar(b) << 12;\n }\n } else if (s == 7) {\n if (UNLIKELY(is_tsimplejson)) {\n if (UNLIKELY(b != '0')) {\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n } else {\n escaped_bytes += dehexchar(b) << 8;\n }\n } else if (s == 8) {\n escaped_bytes += dehexchar(b) << 4;\n } else if (s == 3 && state == 8) {\n escaped_bytes += dehexchar(b);\n if (UNLIKELY(is_tsimplejson)) {\n buf->append((char)escaped_bytes);\n } else {\n utf16_to_utf8(*buf, escaped_bytes);\n }\n }\n } else if ((type == kInvalidDataType || type == KindOfNull) &&\n (c == S_DIG || c == S_ZER)) {\n type = KindOfInt64;\n buf->append((char)b);\n } else if (type == KindOfInt64 && s == 24) {\n type = KindOfDouble;\n buf->append((char)b);\n } else if ((type == kInvalidDataType || type == KindOfNull ||\n type == KindOfInt64) &&\n c == S_DOT) {\n type = KindOfDouble;\n buf->append((char)b);\n } else if (type != KindOfString && c == S_QUO) {\n type = KindOfString;\n /**/qchr = b;/**/\n } else if ((type == kInvalidDataType || type == KindOfNull ||\n type == KindOfInt64 || type == KindOfDouble) &&\n ((state == 12 && s == 9) ||\n (state == 16 && s == 9))) {\n type = KindOfBoolean;\n } else if (type == kInvalidDataType && state == 19 && s == 9) {\n type = KindOfNull;\n } else if (type != KindOfString && c > S_WSP) {\n utf16_to_utf8(*buf, b);\n }\n\n state = s;\n }\n }\n\n if (state == 9 && pop(json, Mode::DONE)) {\n s_json_parser->error_code = JSON_ERROR_NONE;\n return true;\n }\n\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":3798,"sven_meta":{"func_name":"HPHP::JSON_parser","file_name":"hphp/runtime/ext/json/JSON_parser.cpp","commit_link":"github.com/facebook/hhvm/commit/dabd48caf74995e605f1700344f1ff4a5d83441d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#35-1080ff9434a8","input":"static int jpc_pi_nextrpcl(register jpc_pi_t *pi)\n{\n\tint rlvlno;\n\tjpc_pirlvl_t *pirlvl;\n\tjpc_pchg_t *pchg;\n\tint prchind;\n\tint prcvind;\n\tint *prclyrno;\n\tint compno;\n\tjpc_picomp_t *picomp;\n\tint xstep;\n\tint ystep;\n\tuint_fast32_t r;\n\tuint_fast32_t rpx;\n\tuint_fast32_t rpy;\n\tuint_fast32_t trx0;\n\tuint_fast32_t try0;\n\n\tpchg = pi->pchg;\n\tif (!pi->prgvolfirst) {\n\t\tgoto skip;\n\t} else {\n\t\tpi->xstep = 0;\n\t\tpi->ystep = 0;\n\t\tfor (compno = 0, picomp = pi->picomps; compno < pi->numcomps;\n\t\t ++compno, ++picomp) {\n\t\t\tfor (rlvlno = 0, pirlvl = picomp->pirlvls; rlvlno <\n\t\t\t picomp->numrlvls; ++rlvlno, ++pirlvl) {\n\t\t\t\t// Check for the potential for overflow problems.\n\t\t\t\tif (pirlvl->prcwidthexpn + pi->picomp->numrlvls >\n\t\t\t\t JAS_UINTFAST32_NUMBITS - 2 ||\n\t\t\t\t pirlvl->prcheightexpn + pi->picomp->numrlvls >\n\t\t\t\t JAS_UINTFAST32_NUMBITS - 2) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\txstep = picomp->hsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t\t\t (pirlvl->prcwidthexpn + picomp->numrlvls - rlvlno - 1));\n\t\t\t\tystep = picomp->vsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t\t\t (pirlvl->prcheightexpn + picomp->numrlvls - rlvlno - 1));\n\t\t\t\tpi->xstep = (!pi->xstep) ? xstep : JAS_MIN(pi->xstep, xstep);\n\t\t\t\tpi->ystep = (!pi->ystep) ? ystep : JAS_MIN(pi->ystep, ystep);\n\t\t\t}\n\t\t}\n\t\tpi->prgvolfirst = 0;\n\t}\n\n\tfor (pi->rlvlno = pchg->rlvlnostart; pi->rlvlno < pchg->rlvlnoend &&\n\t pi->rlvlno < pi->maxrlvls; ++pi->rlvlno) {\n\t\tfor (pi->y = pi->ystart; pi->y < pi->yend; pi->y +=\n\t\t pi->ystep - (pi->y % pi->ystep)) {\n\t\t\tfor (pi->x = pi->xstart; pi->x < pi->xend; pi->x +=\n\t\t\t pi->xstep - (pi->x % pi->xstep)) {\n\t\t\t\tfor (pi->compno = pchg->compnostart,\n\t\t\t\t pi->picomp = &pi->picomps[pi->compno];\n\t\t\t\t pi->compno < JAS_CAST(int, pchg->compnoend) && pi->compno <\n\t\t\t\t pi->numcomps; ++pi->compno, ++pi->picomp) {\n\t\t\t\t\tif (pi->rlvlno >= pi->picomp->numrlvls) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tpi->pirlvl = &pi->picomp->pirlvls[pi->rlvlno];\n\t\t\t\t\tif (pi->pirlvl->numprcs == 0) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tr = pi->picomp->numrlvls - 1 - pi->rlvlno;\n\t\t\t\t\trpx = r + pi->pirlvl->prcwidthexpn;\n\t\t\t\t\trpy = r + pi->pirlvl->prcheightexpn;\n\t\t\t\t\ttrx0 = JPC_CEILDIV(pi->xstart, pi->picomp->hsamp << r);\n\t\t\t\t\ttry0 = JPC_CEILDIV(pi->ystart, pi->picomp->vsamp << r);\n\t\t\t\t\tif (((pi->x == pi->xstart &&\n\t\t\t\t\t ((trx0 << r) % (JAS_CAST(uint_fast32_t, 1) << rpx)))\n\t\t\t\t\t || !(pi->x % (JAS_CAST(uint_fast32_t, 1) << rpx))) &&\n\t\t\t\t\t ((pi->y == pi->ystart &&\n\t\t\t\t\t ((try0 << r) % (JAS_CAST(uint_fast32_t, 1) << rpy)))\n\t\t\t\t\t || !(pi->y % (JAS_CAST(uint_fast32_t, 1) << rpy)))) {\n\t\t\t\t\t\tprchind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->x,\n\t\t\t\t\t\t pi->picomp->hsamp << r), pi->pirlvl->prcwidthexpn) -\n\t\t\t\t\t\t JPC_FLOORDIVPOW2(trx0, pi->pirlvl->prcwidthexpn);\n\t\t\t\t\t\tprcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y,\n\t\t\t\t\t\t pi->picomp->vsamp << r), pi->pirlvl->prcheightexpn) -\n\t\t\t\t\t\t JPC_FLOORDIVPOW2(try0, pi->pirlvl->prcheightexpn);\n\t\t\t\t\t\tpi->prcno = prcvind * pi->pirlvl->numhprcs + prchind;\n\n\t\t\t\t\t\tassert(pi->prcno < pi->pirlvl->numprcs);\n\t\t\t\t\t\tfor (pi->lyrno = 0; pi->lyrno <\n\t\t\t\t\t\t pi->numlyrs && pi->lyrno < JAS_CAST(int,\n\t\t\t\t\t\t pchg->lyrnoend); ++pi->lyrno) {\n\t\t\t\t\t\t\tprclyrno = &pi->pirlvl->prclyrnos[pi->prcno];\n\t\t\t\t\t\t\tif (pi->lyrno >= *prclyrno) {\n\t\t\t\t\t\t\t\t++(*prclyrno);\n\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t}\nskip:\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 1;\n}","target":"static int jpc_pi_nextrpcl(register jpc_pi_t *pi)\n{\n\tint rlvlno;\n\tjpc_pirlvl_t *pirlvl;\n\tjpc_pchg_t *pchg;\n\tint prchind;\n\tint prcvind;\n\tint *prclyrno;\n\tint compno;\n\tjpc_picomp_t *picomp;\n\tint xstep;\n\tint ystep;\n\tuint_fast32_t r;\n\tuint_fast32_t rpx;\n\tuint_fast32_t rpy;\n\tuint_fast32_t trx0;\n\tuint_fast32_t try0;\n\n\tpchg = pi->pchg;\n\tif (!pi->prgvolfirst) {\n\t\tgoto skip;\n\t} else {\n\t\tpi->xstep = 0;\n\t\tpi->ystep = 0;\n\t\tfor (compno = 0, picomp = pi->picomps; compno < pi->numcomps;\n\t\t ++compno, ++picomp) {\n\t\t\tfor (rlvlno = 0, pirlvl = picomp->pirlvls; rlvlno <\n\t\t\t picomp->numrlvls; ++rlvlno, ++pirlvl) {\n\t\t\t\t// Check for the potential for overflow problems.\n\t\t\t\tif (pirlvl->prcwidthexpn + picomp->numrlvls >\n\t\t\t\t JAS_UINTFAST32_NUMBITS - 2 ||\n\t\t\t\t pirlvl->prcheightexpn + picomp->numrlvls >\n\t\t\t\t JAS_UINTFAST32_NUMBITS - 2) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\txstep = picomp->hsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t\t\t (pirlvl->prcwidthexpn + picomp->numrlvls - rlvlno - 1));\n\t\t\t\tystep = picomp->vsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t\t\t (pirlvl->prcheightexpn + picomp->numrlvls - rlvlno - 1));\n\t\t\t\tpi->xstep = (!pi->xstep) ? xstep : JAS_MIN(pi->xstep, xstep);\n\t\t\t\tpi->ystep = (!pi->ystep) ? ystep : JAS_MIN(pi->ystep, ystep);\n\t\t\t}\n\t\t}\n\t\tpi->prgvolfirst = 0;\n\t}\n\n\tfor (pi->rlvlno = pchg->rlvlnostart; pi->rlvlno < pchg->rlvlnoend &&\n\t pi->rlvlno < pi->maxrlvls; ++pi->rlvlno) {\n\t\tfor (pi->y = pi->ystart; pi->y < pi->yend; pi->y +=\n\t\t pi->ystep - (pi->y % pi->ystep)) {\n\t\t\tfor (pi->x = pi->xstart; pi->x < pi->xend; pi->x +=\n\t\t\t pi->xstep - (pi->x % pi->xstep)) {\n\t\t\t\tfor (pi->compno = pchg->compnostart,\n\t\t\t\t pi->picomp = &pi->picomps[pi->compno];\n\t\t\t\t pi->compno < JAS_CAST(int, pchg->compnoend) && pi->compno <\n\t\t\t\t pi->numcomps; ++pi->compno, ++pi->picomp) {\n\t\t\t\t\tif (pi->rlvlno >= pi->picomp->numrlvls) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tpi->pirlvl = &pi->picomp->pirlvls[pi->rlvlno];\n\t\t\t\t\tif (pi->pirlvl->numprcs == 0) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tr = pi->picomp->numrlvls - 1 - pi->rlvlno;\n\t\t\t\t\trpx = r + pi->pirlvl->prcwidthexpn;\n\t\t\t\t\trpy = r + pi->pirlvl->prcheightexpn;\n\t\t\t\t\ttrx0 = JPC_CEILDIV(pi->xstart, pi->picomp->hsamp << r);\n\t\t\t\t\ttry0 = JPC_CEILDIV(pi->ystart, pi->picomp->vsamp << r);\n\t\t\t\t\tif (((pi->x == pi->xstart &&\n\t\t\t\t\t ((trx0 << r) % (JAS_CAST(uint_fast32_t, 1) << rpx)))\n\t\t\t\t\t || !(pi->x % (JAS_CAST(uint_fast32_t, 1) << rpx))) &&\n\t\t\t\t\t ((pi->y == pi->ystart &&\n\t\t\t\t\t ((try0 << r) % (JAS_CAST(uint_fast32_t, 1) << rpy)))\n\t\t\t\t\t || !(pi->y % (JAS_CAST(uint_fast32_t, 1) << rpy)))) {\n\t\t\t\t\t\tprchind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->x,\n\t\t\t\t\t\t pi->picomp->hsamp << r), pi->pirlvl->prcwidthexpn) -\n\t\t\t\t\t\t JPC_FLOORDIVPOW2(trx0, pi->pirlvl->prcwidthexpn);\n\t\t\t\t\t\tprcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y,\n\t\t\t\t\t\t pi->picomp->vsamp << r), pi->pirlvl->prcheightexpn) -\n\t\t\t\t\t\t JPC_FLOORDIVPOW2(try0, pi->pirlvl->prcheightexpn);\n\t\t\t\t\t\tpi->prcno = prcvind * pi->pirlvl->numhprcs + prchind;\n\n\t\t\t\t\t\tassert(pi->prcno < pi->pirlvl->numprcs);\n\t\t\t\t\t\tfor (pi->lyrno = 0; pi->lyrno <\n\t\t\t\t\t\t pi->numlyrs && pi->lyrno < JAS_CAST(int,\n\t\t\t\t\t\t pchg->lyrnoend); ++pi->lyrno) {\n\t\t\t\t\t\t\tprclyrno = &pi->pirlvl->prclyrnos[pi->prcno];\n\t\t\t\t\t\t\tif (pi->lyrno >= *prclyrno) {\n\t\t\t\t\t\t\t\t++(*prclyrno);\n\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t}\nskip:\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 1;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1359,"sven_meta":{"func_name":"jpc_pi_nextrpcl","file_name":"src/libjasper/jpc/jpc_t2cod.c","commit_link":"github.com/mdadams/jasper/commit/f25486c3d4aa472fec79150f2c41ed4333395d3d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#36-08b022a35746","input":"match_at(regex_t* reg, const UChar* str, const UChar* end,\n#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE\n\t const UChar* right_range,\n#endif\n\t const UChar* sstart, UChar* sprev, OnigMatchArg* msa)\n{\n static UChar FinishCode[] = { OP_FINISH };\n\n int i, n, num_mem, best_len, pop_level;\n LengthType tlen, tlen2;\n MemNumType mem;\n RelAddrType addr;\n UChar *s, *q, *sbegin;\n int is_alloca;\n char *alloc_base;\n OnigStackType *stk_base, *stk, *stk_end;\n OnigStackType *stkp; /* used as any purpose. */\n OnigStackIndex si;\n OnigStackIndex *repeat_stk;\n OnigStackIndex *mem_start_stk, *mem_end_stk;\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n int scv;\n unsigned char* state_check_buff = msa->state_check_buff;\n int num_comb_exp_check = reg->num_comb_exp_check;\n#endif\n UChar *p = reg->p;\n OnigOptionType option = reg->options;\n OnigEncoding encode = reg->enc;\n OnigCaseFoldType case_fold_flag = reg->case_fold_flag;\n\n //n = reg->num_repeat + reg->num_mem * 2;\n pop_level = reg->stack_pop_level;\n num_mem = reg->num_mem;\n STACK_INIT(INIT_MATCH_STACK_SIZE);\n UPDATE_FOR_STACK_REALLOC;\n for (i = 1; i <= num_mem; i++) {\n mem_start_stk[i] = mem_end_stk[i] = INVALID_STACK_INDEX;\n }\n\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"match_at: str: %d, end: %d, start: %d, sprev: %d\\n\",\n\t (int )str, (int )end, (int )sstart, (int )sprev);\n fprintf(stderr, \"size: %d, start offset: %d\\n\",\n\t (int )(end - str), (int )(sstart - str));\n#endif\n\n STACK_PUSH_ENSURED(STK_ALT, FinishCode); /* bottom stack */\n best_len = ONIG_MISMATCH;\n s = (UChar* )sstart;\n while (1) {\n#ifdef ONIG_DEBUG_MATCH\n {\n UChar *q, *bp, buf[50];\n int len;\n fprintf(stderr, \"%4d> \\\"\", (int )(s - str));\n bp = buf;\n for (i = 0, q = s; i < 7 && q < end; i++) {\n\tlen = enclen(encode, q);\n\twhile (len-- > 0) *bp++ = *q++;\n }\n if (q < end) { xmemcpy(bp, \"...\\\"\", 4); bp += 4; }\n else { xmemcpy(bp, \"\\\"\", 1); bp += 1; }\n *bp = 0;\n fputs((char* )buf, stderr);\n for (i = 0; i < 20 - (bp - buf); i++) fputc(' ', stderr);\n onig_print_compiled_byte_code(stderr, p, NULL, encode);\n fprintf(stderr, \"\\n\");\n }\n#endif\n\n sbegin = s;\n switch (*p++) {\n case OP_END: MOP_IN(OP_END);\n n = s - sstart;\n if (n > best_len) {\n OnigRegion* region;\n#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE\n if (IS_FIND_LONGEST(option)) {\n if (n > msa->best_len) {\n msa->best_len = n;\n msa->best_s = (UChar* )sstart;\n }\n else\n goto end_best_len;\n }\n#endif\n best_len = n;\n region = msa->region;\n if (region) {\n#ifdef USE_POSIX_API_REGION_OPTION\n if (IS_POSIX_REGION(msa->options)) {\n posix_regmatch_t* rmt = (posix_regmatch_t* )region;\n\n rmt[0].rm_so = sstart - str;\n rmt[0].rm_eo = s - str;\n for (i = 1; i <= num_mem; i++) {\n if (mem_end_stk[i] != INVALID_STACK_INDEX) {\n if (BIT_STATUS_AT(reg->bt_mem_start, i))\n rmt[i].rm_so = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;\n else\n rmt[i].rm_so = (UChar* )((void* )(mem_start_stk[i])) - str;\n\n rmt[i].rm_eo = (BIT_STATUS_AT(reg->bt_mem_end, i)\n ? STACK_AT(mem_end_stk[i])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[i])) - str;\n }\n else {\n rmt[i].rm_so = rmt[i].rm_eo = ONIG_REGION_NOTPOS;\n }\n }\n }\n else {\n#endif /* USE_POSIX_API_REGION_OPTION */\n region->beg[0] = sstart - str;\n region->end[0] = s - str;\n for (i = 1; i <= num_mem; i++) {\n if (mem_end_stk[i] != INVALID_STACK_INDEX) {\n if (BIT_STATUS_AT(reg->bt_mem_start, i))\n region->beg[i] = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;\n else\n region->beg[i] = (UChar* )((void* )mem_start_stk[i]) - str;\n\n region->end[i] = (BIT_STATUS_AT(reg->bt_mem_end, i)\n ? STACK_AT(mem_end_stk[i])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[i])) - str;\n }\n else {\n region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS;\n }\n }\n\n#ifdef USE_CAPTURE_HISTORY\n if (reg->capture_history != 0) {\n int r;\n OnigCaptureTreeNode* node;\n\n if (IS_NULL(region->history_root)) {\n region->history_root = node = history_node_new();\n CHECK_NULL_RETURN_MEMERR(node);\n }\n else {\n node = region->history_root;\n history_tree_clear(node);\n }\n\n node->group = 0;\n node->beg = sstart - str;\n node->end = s - str;\n\n stkp = stk_base;\n r = make_capture_history_tree(region->history_root, &stkp,\n stk, (UChar* )str, reg);\n if (r < 0) {\n best_len = r; /* error code */\n goto finish;\n }\n }\n#endif /* USE_CAPTURE_HISTORY */\n#ifdef USE_POSIX_API_REGION_OPTION\n } /* else IS_POSIX_REGION() */\n#endif\n } /* if (region) */\n } /* n > best_len */\n\n#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE\n end_best_len:\n#endif\n MOP_OUT;\n\n if (IS_FIND_CONDITION(option)) {\n if (IS_FIND_NOT_EMPTY(option) && s == sstart) {\n best_len = ONIG_MISMATCH;\n goto fail; /* for retry */\n }\n if (IS_FIND_LONGEST(option) && DATA_ENSURE_CHECK1) {\n goto fail; /* for retry */\n }\n }\n\n /* default behavior: return first-matching result. */\n goto finish;\n break;\n\n case OP_EXACT1: MOP_IN(OP_EXACT1);\n#if 0\n DATA_ENSURE(1);\n if (*p != *s) goto fail;\n p++; s++;\n#endif\n if (*p != *s++) goto fail;\n DATA_ENSURE(0);\n p++;\n MOP_OUT;\n break;\n\n case OP_EXACT1_IC: MOP_IN(OP_EXACT1_IC);\n {\n int len;\n UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n DATA_ENSURE(1);\n len = ONIGENC_MBC_CASE_FOLD(encode,\n /* DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag), */\n case_fold_flag,\n &s, end, lowbuf);\n DATA_ENSURE(0);\n q = lowbuf;\n while (len-- > 0) {\n if (*p != *q) {\n goto fail;\n }\n p++; q++;\n }\n }\n MOP_OUT;\n break;\n\n case OP_EXACT2: MOP_IN(OP_EXACT2);\n DATA_ENSURE(2);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT3: MOP_IN(OP_EXACT3);\n DATA_ENSURE(3);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT4: MOP_IN(OP_EXACT4);\n DATA_ENSURE(4);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT5: MOP_IN(OP_EXACT5);\n DATA_ENSURE(5);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTN: MOP_IN(OP_EXACTN);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen);\n while (tlen-- > 0) {\n if (*p++ != *s++) goto fail;\n }\n sprev = s - 1;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTN_IC: MOP_IN(OP_EXACTN_IC);\n {\n int len;\n UChar *q, *endp, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n GET_LENGTH_INC(tlen, p);\n endp = p + tlen;\n\n while (p < endp) {\n sprev = s;\n DATA_ENSURE(1);\n len = ONIGENC_MBC_CASE_FOLD(encode,\n /* DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag), */\n case_fold_flag,\n &s, end, lowbuf);\n DATA_ENSURE(0);\n q = lowbuf;\n while (len-- > 0) {\n if (*p != *q) goto fail;\n p++; q++;\n }\n }\n }\n\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N1: MOP_IN(OP_EXACTMB2N1);\n DATA_ENSURE(2);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n break;\n\n case OP_EXACTMB2N2: MOP_IN(OP_EXACTMB2N2);\n DATA_ENSURE(4);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n sprev = s;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N3: MOP_IN(OP_EXACTMB2N3);\n DATA_ENSURE(6);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n sprev = s;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N: MOP_IN(OP_EXACTMB2N);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen * 2);\n while (tlen-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - 2;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB3N: MOP_IN(OP_EXACTMB3N);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen * 3);\n while (tlen-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - 3;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMBN: MOP_IN(OP_EXACTMBN);\n GET_LENGTH_INC(tlen, p); /* mb-len */\n GET_LENGTH_INC(tlen2, p); /* string len */\n tlen2 *= tlen;\n DATA_ENSURE(tlen2);\n while (tlen2-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - tlen;\n MOP_OUT;\n continue;\n break;\n\n case OP_CCLASS: MOP_IN(OP_CCLASS);\n DATA_ENSURE(1);\n if (BITSET_AT(((BitSetRef )p), *s) == 0) goto fail;\n p += SIZE_BITSET;\n s += enclen(encode, s); /* OP_CCLASS can match mb-code. \\D, \\S */\n MOP_OUT;\n break;\n\n case OP_CCLASS_MB: MOP_IN(OP_CCLASS_MB);\n if (! ONIGENC_IS_MBC_HEAD(encode, s)) goto fail;\n\n cclass_mb:\n GET_LENGTH_INC(tlen, p);\n {\n OnigCodePoint code;\n UChar *ss;\n int mb_len;\n\n DATA_ENSURE(1);\n mb_len = enclen(encode, s);\n DATA_ENSURE(mb_len);\n ss = s;\n s += mb_len;\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n\n#ifdef PLATFORM_UNALIGNED_WORD_ACCESS\n if (! onig_is_in_code_range(p, code)) goto fail;\n#else\n q = p;\n ALIGNMENT_RIGHT(q);\n if (! onig_is_in_code_range(q, code)) goto fail;\n#endif\n }\n p += tlen;\n MOP_OUT;\n break;\n\n case OP_CCLASS_MIX: MOP_IN(OP_CCLASS_MIX);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_HEAD(encode, s)) {\n p += SIZE_BITSET;\n goto cclass_mb;\n }\n else {\n if (BITSET_AT(((BitSetRef )p), *s) == 0)\n goto fail;\n\n p += SIZE_BITSET;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n s++;\n }\n MOP_OUT;\n break;\n\n case OP_CCLASS_NOT: MOP_IN(OP_CCLASS_NOT);\n DATA_ENSURE(1);\n if (BITSET_AT(((BitSetRef )p), *s) != 0) goto fail;\n p += SIZE_BITSET;\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_CCLASS_MB_NOT: MOP_IN(OP_CCLASS_MB_NOT);\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_HEAD(encode, s)) {\n s++;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n goto cc_mb_not_success;\n }\n\n cclass_mb_not:\n GET_LENGTH_INC(tlen, p);\n {\n OnigCodePoint code;\n UChar *ss;\n int mb_len = enclen(encode, s);\n\n if (! DATA_ENSURE_CHECK(mb_len)) {\n DATA_ENSURE(1);\n s = (UChar* )end;\n p += tlen;\n goto cc_mb_not_success;\n }\n\n ss = s;\n s += mb_len;\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n\n#ifdef PLATFORM_UNALIGNED_WORD_ACCESS\n if (onig_is_in_code_range(p, code)) goto fail;\n#else\n q = p;\n ALIGNMENT_RIGHT(q);\n if (onig_is_in_code_range(q, code)) goto fail;\n#endif\n }\n p += tlen;\n\n cc_mb_not_success:\n MOP_OUT;\n break;\n\n case OP_CCLASS_MIX_NOT: MOP_IN(OP_CCLASS_MIX_NOT);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_HEAD(encode, s)) {\n p += SIZE_BITSET;\n goto cclass_mb_not;\n }\n else {\n if (BITSET_AT(((BitSetRef )p), *s) != 0)\n goto fail;\n\n p += SIZE_BITSET;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n s++;\n }\n MOP_OUT;\n break;\n\n case OP_CCLASS_NODE: MOP_IN(OP_CCLASS_NODE);\n {\n OnigCodePoint code;\n void *node;\n int mb_len;\n UChar *ss;\n\n DATA_ENSURE(1);\n GET_POINTER_INC(node, p);\n mb_len = enclen(encode, s);\n ss = s;\n s += mb_len;\n DATA_ENSURE(0);\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n if (onig_is_code_in_cc_len(mb_len, code, node) == 0) goto fail;\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR: MOP_IN(OP_ANYCHAR);\n DATA_ENSURE(1);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n s += n;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML: MOP_IN(OP_ANYCHAR_ML);\n DATA_ENSURE(1);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n s += n;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_STAR: MOP_IN(OP_ANYCHAR_STAR);\n while (DATA_ENSURE_CHECK1) {\n STACK_PUSH_ALT(p, s, sprev);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML_STAR: MOP_IN(OP_ANYCHAR_ML_STAR);\n while (DATA_ENSURE_CHECK1) {\n STACK_PUSH_ALT(p, s, sprev);\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_STAR_PEEK_NEXT: MOP_IN(OP_ANYCHAR_STAR_PEEK_NEXT);\n while (DATA_ENSURE_CHECK1) {\n if (*p == *s) {\n STACK_PUSH_ALT(p + 1, s, sprev);\n }\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n p++;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML_STAR_PEEK_NEXT:MOP_IN(OP_ANYCHAR_ML_STAR_PEEK_NEXT);\n while (DATA_ENSURE_CHECK1) {\n if (*p == *s) {\n STACK_PUSH_ALT(p + 1, s, sprev);\n }\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n p++;\n MOP_OUT;\n break;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n case OP_STATE_CHECK_ANYCHAR_STAR: MOP_IN(OP_STATE_CHECK_ANYCHAR_STAR);\n GET_STATE_CHECK_NUM_INC(mem, p);\n while (DATA_ENSURE_CHECK1) {\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n MOP_OUT;\n break;\n\n case OP_STATE_CHECK_ANYCHAR_ML_STAR:\n MOP_IN(OP_STATE_CHECK_ANYCHAR_ML_STAR);\n\n GET_STATE_CHECK_NUM_INC(mem, p);\n while (DATA_ENSURE_CHECK1) {\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem);\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n MOP_OUT;\n break;\n#endif /* USE_COMBINATION_EXPLOSION_CHECK */\n\n case OP_WORD: MOP_IN(OP_WORD);\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_NOT_WORD: MOP_IN(OP_NOT_WORD);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_WORD_BOUND: MOP_IN(OP_WORD_BOUND);\n if (ON_STR_BEGIN(s)) {\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n }\n else if (ON_STR_END(s)) {\n if (! ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n else {\n if (ONIGENC_IS_MBC_WORD(encode, s, end)\n == ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_NOT_WORD_BOUND: MOP_IN(OP_NOT_WORD_BOUND);\n if (ON_STR_BEGIN(s)) {\n if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n }\n else if (ON_STR_END(s)) {\n if (ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n else {\n if (ONIGENC_IS_MBC_WORD(encode, s, end)\n != ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_WORD_BEGIN_END\n case OP_WORD_BEGIN: MOP_IN(OP_WORD_BEGIN);\n if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end)) {\n if (ON_STR_BEGIN(s) || !ONIGENC_IS_MBC_WORD(encode, sprev, end)) {\n MOP_OUT;\n continue;\n }\n }\n goto fail;\n break;\n\n case OP_WORD_END: MOP_IN(OP_WORD_END);\n if (!ON_STR_BEGIN(s) && ONIGENC_IS_MBC_WORD(encode, sprev, end)) {\n if (ON_STR_END(s) || !ONIGENC_IS_MBC_WORD(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n }\n goto fail;\n break;\n#endif\n\n case OP_BEGIN_BUF: MOP_IN(OP_BEGIN_BUF);\n if (! ON_STR_BEGIN(s)) goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_END_BUF: MOP_IN(OP_END_BUF);\n if (! ON_STR_END(s)) goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_BEGIN_LINE: MOP_IN(OP_BEGIN_LINE);\n if (ON_STR_BEGIN(s)) {\n if (IS_NOTBOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, sprev, end) && !ON_STR_END(s)) {\n MOP_OUT;\n continue;\n }\n goto fail;\n break;\n\n case OP_END_LINE: MOP_IN(OP_END_LINE);\n if (ON_STR_END(s)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) {\n#endif\n if (IS_NOTEOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n }\n#endif\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n#endif\n goto fail;\n break;\n\n case OP_SEMI_END_BUF: MOP_IN(OP_SEMI_END_BUF);\n if (ON_STR_END(s)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) {\n#endif\n if (IS_NOTEOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n }\n#endif\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end) &&\n ON_STR_END(s + enclen(encode, s))) {\n MOP_OUT;\n continue;\n }\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) {\n UChar* ss = s + enclen(encode, s);\n ss += enclen(encode, ss);\n if (ON_STR_END(ss)) {\n MOP_OUT;\n continue;\n }\n }\n#endif\n goto fail;\n break;\n\n case OP_BEGIN_POSITION: MOP_IN(OP_BEGIN_POSITION);\n if (s != msa->start)\n goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_START_PUSH: MOP_IN(OP_MEMORY_START_PUSH);\n GET_MEMNUM_INC(mem, p);\n STACK_PUSH_MEM_START(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_START: MOP_IN(OP_MEMORY_START);\n GET_MEMNUM_INC(mem, p);\n mem_start_stk[mem] = (OnigStackIndex )((void* )s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END_PUSH: MOP_IN(OP_MEMORY_END_PUSH);\n GET_MEMNUM_INC(mem, p);\n STACK_PUSH_MEM_END(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END: MOP_IN(OP_MEMORY_END);\n GET_MEMNUM_INC(mem, p);\n mem_end_stk[mem] = (OnigStackIndex )((void* )s);\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_SUBEXP_CALL\n case OP_MEMORY_END_PUSH_REC: MOP_IN(OP_MEMORY_END_PUSH_REC);\n GET_MEMNUM_INC(mem, p);\n STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */\n STACK_PUSH_MEM_END(mem, s);\n mem_start_stk[mem] = GET_STACK_INDEX(stkp);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END_REC: MOP_IN(OP_MEMORY_END_REC);\n GET_MEMNUM_INC(mem, p);\n mem_end_stk[mem] = (OnigStackIndex )((void* )s);\n STACK_GET_MEM_START(mem, stkp);\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n mem_start_stk[mem] = GET_STACK_INDEX(stkp);\n else\n mem_start_stk[mem] = (OnigStackIndex )((void* )stkp->u.mem.pstr);\n\n STACK_PUSH_MEM_END_MARK(mem);\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_BACKREF1: MOP_IN(OP_BACKREF1);\n mem = 1;\n goto backref;\n break;\n\n case OP_BACKREF2: MOP_IN(OP_BACKREF2);\n mem = 2;\n goto backref;\n break;\n\n case OP_BACKREFN: MOP_IN(OP_BACKREFN);\n GET_MEMNUM_INC(mem, p);\n backref:\n {\n int len;\n UChar *pstart, *pend;\n\n /* if you want to remove following line, \n you should check in parse and compile time. */\n if (mem > num_mem) goto fail;\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n STRING_CMP(pstart, s, n);\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREFN_IC: MOP_IN(OP_BACKREFN_IC);\n GET_MEMNUM_INC(mem, p);\n {\n int len;\n UChar *pstart, *pend;\n\n /* if you want to remove following line, \n you should check in parse and compile time. */\n if (mem > num_mem) goto fail;\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n STRING_CMP_IC(case_fold_flag, pstart, &s, n);\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREF_MULTI: MOP_IN(OP_BACKREF_MULTI);\n {\n int len, is_fail;\n UChar *pstart, *pend, *swork;\n\n GET_LENGTH_INC(tlen, p);\n for (i = 0; i < tlen; i++) {\n GET_MEMNUM_INC(mem, p);\n\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n swork = s;\n STRING_CMP_VALUE(pstart, swork, n, is_fail);\n if (is_fail) continue;\n s = swork;\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * (tlen - i - 1));\n break; /* success */\n }\n if (i == tlen) goto fail;\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREF_MULTI_IC: MOP_IN(OP_BACKREF_MULTI_IC);\n {\n int len, is_fail;\n UChar *pstart, *pend, *swork;\n\n GET_LENGTH_INC(tlen, p);\n for (i = 0; i < tlen; i++) {\n GET_MEMNUM_INC(mem, p);\n\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n swork = s;\n STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, n, is_fail);\n if (is_fail) continue;\n s = swork;\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * (tlen - i - 1));\n break; /* success */\n }\n if (i == tlen) goto fail;\n MOP_OUT;\n continue;\n }\n break;\n\n#ifdef USE_BACKREF_WITH_LEVEL\n case OP_BACKREF_WITH_LEVEL:\n {\n int len;\n OnigOptionType ic;\n LengthType level;\n\n GET_OPTION_INC(ic, p);\n GET_LENGTH_INC(level, p);\n GET_LENGTH_INC(tlen, p);\n\n sprev = s;\n if (backref_match_at_nested_level(reg, stk, stk_base, ic\n , case_fold_flag, (int )level, (int )tlen, p, &s, end)) {\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * tlen);\n }\n else\n goto fail;\n\n MOP_OUT;\n continue;\n }\n break;\n#endif\n\n#if 0 /* no need: IS_DYNAMIC_OPTION() == 0 */\n case OP_SET_OPTION_PUSH: MOP_IN(OP_SET_OPTION_PUSH);\n GET_OPTION_INC(option, p);\n STACK_PUSH_ALT(p, s, sprev);\n p += SIZE_OP_SET_OPTION + SIZE_OP_FAIL;\n MOP_OUT;\n continue;\n break;\n\n case OP_SET_OPTION: MOP_IN(OP_SET_OPTION);\n GET_OPTION_INC(option, p);\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_NULL_CHECK_START: MOP_IN(OP_NULL_CHECK_START);\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_PUSH_NULL_CHECK_START(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_NULL_CHECK_END: MOP_IN(OP_NULL_CHECK_END);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_NULL_CHECK(isnull, mem, s);\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n null_check_found:\n /* empty loop founded, skip next instruction */\n switch (*p++) {\n case OP_JUMP:\n case OP_PUSH:\n p += SIZE_RELADDR;\n break;\n case OP_REPEAT_INC:\n case OP_REPEAT_INC_NG:\n case OP_REPEAT_INC_SG:\n case OP_REPEAT_INC_NG_SG:\n p += SIZE_MEMNUM;\n break;\n default:\n goto unexpected_bytecode_error;\n break;\n }\n }\n }\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT\n case OP_NULL_CHECK_END_MEMST: MOP_IN(OP_NULL_CHECK_END_MEMST);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_NULL_CHECK_MEMST(isnull, mem, s, reg);\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END_MEMST: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n if (isnull == -1) goto fail;\n goto \tnull_check_found;\n }\n }\n MOP_OUT;\n continue;\n break;\n#endif\n\n#ifdef USE_SUBEXP_CALL\n case OP_NULL_CHECK_END_MEMST_PUSH:\n MOP_IN(OP_NULL_CHECK_END_MEMST_PUSH);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT\n STACK_NULL_CHECK_MEMST_REC(isnull, mem, s, reg);\n#else\n STACK_NULL_CHECK_REC(isnull, mem, s);\n#endif\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END_MEMST_PUSH: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n if (isnull == -1) goto fail;\n goto \tnull_check_found;\n }\n else {\n STACK_PUSH_NULL_CHECK_END(mem);\n }\n }\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_JUMP: MOP_IN(OP_JUMP);\n GET_RELADDR_INC(addr, p);\n p += addr;\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_PUSH: MOP_IN(OP_PUSH);\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n case OP_STATE_CHECK_PUSH: MOP_IN(OP_STATE_CHECK_PUSH);\n GET_STATE_CHECK_NUM_INC(mem, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem);\n MOP_OUT;\n continue;\n break;\n\n case OP_STATE_CHECK_PUSH_OR_JUMP: MOP_IN(OP_STATE_CHECK_PUSH_OR_JUMP);\n GET_STATE_CHECK_NUM_INC(mem, p);\n GET_RELADDR_INC(addr, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) {\n p += addr;\n }\n else {\n STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem);\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_STATE_CHECK: MOP_IN(OP_STATE_CHECK);\n GET_STATE_CHECK_NUM_INC(mem, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_STATE_CHECK(s, mem);\n MOP_OUT;\n continue;\n break;\n#endif /* USE_COMBINATION_EXPLOSION_CHECK */\n\n case OP_POP: MOP_IN(OP_POP);\n STACK_POP_ONE;\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_OR_JUMP_EXACT1: MOP_IN(OP_PUSH_OR_JUMP_EXACT1);\n GET_RELADDR_INC(addr, p);\n if (*p == *s && DATA_ENSURE_CHECK1) {\n p++;\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n }\n p += (addr + 1);\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_IF_PEEK_NEXT: MOP_IN(OP_PUSH_IF_PEEK_NEXT);\n GET_RELADDR_INC(addr, p);\n if (*p == *s) {\n p++;\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n }\n p++;\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT: MOP_IN(OP_REPEAT);\n {\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n GET_RELADDR_INC(addr, p);\n\n STACK_ENSURE(1);\n repeat_stk[mem] = GET_STACK_INDEX(stk);\n STACK_PUSH_REPEAT(mem, p);\n\n if (reg->repeat_range[mem].lower == 0) {\n STACK_PUSH_ALT(p + addr, s, sprev);\n }\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT_NG: MOP_IN(OP_REPEAT_NG);\n {\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n GET_RELADDR_INC(addr, p);\n\n STACK_ENSURE(1);\n repeat_stk[mem] = GET_STACK_INDEX(stk);\n STACK_PUSH_REPEAT(mem, p);\n\n if (reg->repeat_range[mem].lower == 0) {\n STACK_PUSH_ALT(p, s, sprev);\n p += addr;\n }\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT_INC: MOP_IN(OP_REPEAT_INC);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n si = repeat_stk[mem];\n stkp = STACK_AT(si);\n\n repeat_inc:\n stkp->u.repeat.count++;\n if (stkp->u.repeat.count >= reg->repeat_range[mem].upper) {\n /* end of repeat. Nothing to do. */\n }\n else if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) {\n STACK_PUSH_ALT(p, s, sprev);\n p = STACK_AT(si)->u.repeat.pcode; /* Don't use stkp after PUSH. */\n }\n else {\n p = stkp->u.repeat.pcode;\n }\n STACK_PUSH_REPEAT_INC(si);\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_REPEAT_INC_SG: MOP_IN(OP_REPEAT_INC_SG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n STACK_GET_REPEAT(mem, stkp);\n si = GET_STACK_INDEX(stkp);\n goto repeat_inc;\n break;\n\n case OP_REPEAT_INC_NG: MOP_IN(OP_REPEAT_INC_NG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n si = repeat_stk[mem];\n stkp = STACK_AT(si);\n\n repeat_inc_ng:\n stkp->u.repeat.count++;\n if (stkp->u.repeat.count < reg->repeat_range[mem].upper) {\n if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) {\n UChar* pcode = stkp->u.repeat.pcode;\n\n STACK_PUSH_REPEAT_INC(si);\n STACK_PUSH_ALT(pcode, s, sprev);\n }\n else {\n p = stkp->u.repeat.pcode;\n STACK_PUSH_REPEAT_INC(si);\n }\n }\n else if (stkp->u.repeat.count == reg->repeat_range[mem].upper) {\n STACK_PUSH_REPEAT_INC(si);\n }\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_REPEAT_INC_NG_SG: MOP_IN(OP_REPEAT_INC_NG_SG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n STACK_GET_REPEAT(mem, stkp);\n si = GET_STACK_INDEX(stkp);\n goto repeat_inc_ng;\n break;\n\n case OP_PUSH_POS: MOP_IN(OP_PUSH_POS);\n STACK_PUSH_POS(s, sprev);\n MOP_OUT;\n continue;\n break;\n\n case OP_POP_POS: MOP_IN(OP_POP_POS);\n {\n STACK_POS_END(stkp);\n s = stkp->u.state.pstr;\n sprev = stkp->u.state.pstr_prev;\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_POS_NOT: MOP_IN(OP_PUSH_POS_NOT);\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_POS_NOT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n break;\n\n case OP_FAIL_POS: MOP_IN(OP_FAIL_POS);\n STACK_POP_TIL_POS_NOT;\n goto fail;\n break;\n\n case OP_PUSH_STOP_BT: MOP_IN(OP_PUSH_STOP_BT);\n STACK_PUSH_STOP_BT;\n MOP_OUT;\n continue;\n break;\n\n case OP_POP_STOP_BT: MOP_IN(OP_POP_STOP_BT);\n STACK_STOP_BT_END;\n MOP_OUT;\n continue;\n break;\n\n case OP_LOOK_BEHIND: MOP_IN(OP_LOOK_BEHIND);\n GET_LENGTH_INC(tlen, p);\n s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen);\n if (IS_NULL(s)) goto fail;\n sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_LOOK_BEHIND_NOT: MOP_IN(OP_PUSH_LOOK_BEHIND_NOT);\n GET_RELADDR_INC(addr, p);\n GET_LENGTH_INC(tlen, p);\n q = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen);\n if (IS_NULL(q)) {\n /* too short case -> success. ex. /(?p + addr;\n MOP_OUT;\n continue;\n break;\n\n case OP_RETURN: MOP_IN(OP_RETURN);\n STACK_RETURN(p);\n STACK_PUSH_RETURN;\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_FINISH:\n goto finish;\n break;\n\n fail:\n MOP_OUT;\n /* fall */\n case OP_FAIL: MOP_IN(OP_FAIL);\n STACK_POP;\n p = stk->u.state.pcode;\n s = stk->u.state.pstr;\n sprev = stk->u.state.pstr_prev;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n if (stk->u.state.state_check != 0) {\n stk->type = STK_STATE_CHECK_MARK;\n stk++;\n }\n#endif\n\n MOP_OUT;\n continue;\n break;\n\n default:\n goto bytecode_error;\n\n } /* end of switch */\n sprev = sbegin;\n } /* end of while(1) */\n\n finish:\n STACK_SAVE;\n return best_len;\n\n#ifdef ONIG_DEBUG\n stack_error:\n STACK_SAVE;\n return ONIGERR_STACK_BUG;\n#endif\n\n bytecode_error:\n STACK_SAVE;\n return ONIGERR_UNDEFINED_BYTECODE;\n\n unexpected_bytecode_error:\n STACK_SAVE;\n return ONIGERR_UNEXPECTED_BYTECODE;\n}","target":"match_at(regex_t* reg, const UChar* str, const UChar* end,\n#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE\n\t const UChar* right_range,\n#endif\n\t const UChar* sstart, UChar* sprev, OnigMatchArg* msa)\n{\n static UChar FinishCode[] = { OP_FINISH };\n\n int i, n, num_mem, best_len, pop_level;\n LengthType tlen, tlen2;\n MemNumType mem;\n RelAddrType addr;\n UChar *s, *q, *sbegin;\n int is_alloca;\n char *alloc_base;\n OnigStackType *stk_base, *stk, *stk_end;\n OnigStackType *stkp; /* used as any purpose. */\n OnigStackIndex si;\n OnigStackIndex *repeat_stk;\n OnigStackIndex *mem_start_stk, *mem_end_stk;\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n int scv;\n unsigned char* state_check_buff = msa->state_check_buff;\n int num_comb_exp_check = reg->num_comb_exp_check;\n#endif\n UChar *p = reg->p;\n OnigOptionType option = reg->options;\n OnigEncoding encode = reg->enc;\n OnigCaseFoldType case_fold_flag = reg->case_fold_flag;\n\n //n = reg->num_repeat + reg->num_mem * 2;\n pop_level = reg->stack_pop_level;\n num_mem = reg->num_mem;\n STACK_INIT(INIT_MATCH_STACK_SIZE);\n UPDATE_FOR_STACK_REALLOC;\n for (i = 1; i <= num_mem; i++) {\n mem_start_stk[i] = mem_end_stk[i] = INVALID_STACK_INDEX;\n }\n\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"match_at: str: %d, end: %d, start: %d, sprev: %d\\n\",\n\t (int )str, (int )end, (int )sstart, (int )sprev);\n fprintf(stderr, \"size: %d, start offset: %d\\n\",\n\t (int )(end - str), (int )(sstart - str));\n#endif\n\n STACK_PUSH_ENSURED(STK_ALT, FinishCode); /* bottom stack */\n best_len = ONIG_MISMATCH;\n s = (UChar* )sstart;\n while (1) {\n#ifdef ONIG_DEBUG_MATCH\n {\n UChar *q, *bp, buf[50];\n int len;\n fprintf(stderr, \"%4d> \\\"\", (int )(s - str));\n bp = buf;\n for (i = 0, q = s; i < 7 && q < end; i++) {\n\tlen = enclen(encode, q);\n\twhile (len-- > 0) *bp++ = *q++;\n }\n if (q < end) { xmemcpy(bp, \"...\\\"\", 4); bp += 4; }\n else { xmemcpy(bp, \"\\\"\", 1); bp += 1; }\n *bp = 0;\n fputs((char* )buf, stderr);\n for (i = 0; i < 20 - (bp - buf); i++) fputc(' ', stderr);\n onig_print_compiled_byte_code(stderr, p, NULL, encode);\n fprintf(stderr, \"\\n\");\n }\n#endif\n\n sbegin = s;\n switch (*p++) {\n case OP_END: MOP_IN(OP_END);\n n = s - sstart;\n if (n > best_len) {\n OnigRegion* region;\n#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE\n if (IS_FIND_LONGEST(option)) {\n if (n > msa->best_len) {\n msa->best_len = n;\n msa->best_s = (UChar* )sstart;\n }\n else\n goto end_best_len;\n }\n#endif\n best_len = n;\n region = msa->region;\n if (region) {\n#ifdef USE_POSIX_API_REGION_OPTION\n if (IS_POSIX_REGION(msa->options)) {\n posix_regmatch_t* rmt = (posix_regmatch_t* )region;\n\n rmt[0].rm_so = sstart - str;\n rmt[0].rm_eo = s - str;\n for (i = 1; i <= num_mem; i++) {\n if (mem_end_stk[i] != INVALID_STACK_INDEX) {\n if (BIT_STATUS_AT(reg->bt_mem_start, i))\n rmt[i].rm_so = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;\n else\n rmt[i].rm_so = (UChar* )((void* )(mem_start_stk[i])) - str;\n\n rmt[i].rm_eo = (BIT_STATUS_AT(reg->bt_mem_end, i)\n ? STACK_AT(mem_end_stk[i])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[i])) - str;\n }\n else {\n rmt[i].rm_so = rmt[i].rm_eo = ONIG_REGION_NOTPOS;\n }\n }\n }\n else {\n#endif /* USE_POSIX_API_REGION_OPTION */\n region->beg[0] = sstart - str;\n region->end[0] = s - str;\n for (i = 1; i <= num_mem; i++) {\n if (mem_end_stk[i] != INVALID_STACK_INDEX) {\n if (BIT_STATUS_AT(reg->bt_mem_start, i))\n region->beg[i] = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;\n else\n region->beg[i] = (UChar* )((void* )mem_start_stk[i]) - str;\n\n region->end[i] = (BIT_STATUS_AT(reg->bt_mem_end, i)\n ? STACK_AT(mem_end_stk[i])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[i])) - str;\n }\n else {\n region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS;\n }\n }\n\n#ifdef USE_CAPTURE_HISTORY\n if (reg->capture_history != 0) {\n int r;\n OnigCaptureTreeNode* node;\n\n if (IS_NULL(region->history_root)) {\n region->history_root = node = history_node_new();\n CHECK_NULL_RETURN_MEMERR(node);\n }\n else {\n node = region->history_root;\n history_tree_clear(node);\n }\n\n node->group = 0;\n node->beg = sstart - str;\n node->end = s - str;\n\n stkp = stk_base;\n r = make_capture_history_tree(region->history_root, &stkp,\n stk, (UChar* )str, reg);\n if (r < 0) {\n best_len = r; /* error code */\n goto finish;\n }\n }\n#endif /* USE_CAPTURE_HISTORY */\n#ifdef USE_POSIX_API_REGION_OPTION\n } /* else IS_POSIX_REGION() */\n#endif\n } /* if (region) */\n } /* n > best_len */\n\n#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE\n end_best_len:\n#endif\n MOP_OUT;\n\n if (IS_FIND_CONDITION(option)) {\n if (IS_FIND_NOT_EMPTY(option) && s == sstart) {\n best_len = ONIG_MISMATCH;\n goto fail; /* for retry */\n }\n if (IS_FIND_LONGEST(option) && DATA_ENSURE_CHECK1) {\n goto fail; /* for retry */\n }\n }\n\n /* default behavior: return first-matching result. */\n goto finish;\n break;\n\n case OP_EXACT1: MOP_IN(OP_EXACT1);\n DATA_ENSURE(1);\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n break;\n\n case OP_EXACT1_IC: MOP_IN(OP_EXACT1_IC);\n {\n int len;\n UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n DATA_ENSURE(1);\n len = ONIGENC_MBC_CASE_FOLD(encode,\n /* DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag), */\n case_fold_flag,\n &s, end, lowbuf);\n DATA_ENSURE(0);\n q = lowbuf;\n while (len-- > 0) {\n if (*p != *q) {\n goto fail;\n }\n p++; q++;\n }\n }\n MOP_OUT;\n break;\n\n case OP_EXACT2: MOP_IN(OP_EXACT2);\n DATA_ENSURE(2);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT3: MOP_IN(OP_EXACT3);\n DATA_ENSURE(3);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT4: MOP_IN(OP_EXACT4);\n DATA_ENSURE(4);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT5: MOP_IN(OP_EXACT5);\n DATA_ENSURE(5);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTN: MOP_IN(OP_EXACTN);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen);\n while (tlen-- > 0) {\n if (*p++ != *s++) goto fail;\n }\n sprev = s - 1;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTN_IC: MOP_IN(OP_EXACTN_IC);\n {\n int len;\n UChar *q, *endp, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n GET_LENGTH_INC(tlen, p);\n endp = p + tlen;\n\n while (p < endp) {\n sprev = s;\n DATA_ENSURE(1);\n len = ONIGENC_MBC_CASE_FOLD(encode,\n /* DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag), */\n case_fold_flag,\n &s, end, lowbuf);\n DATA_ENSURE(0);\n q = lowbuf;\n while (len-- > 0) {\n if (*p != *q) goto fail;\n p++; q++;\n }\n }\n }\n\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N1: MOP_IN(OP_EXACTMB2N1);\n DATA_ENSURE(2);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n break;\n\n case OP_EXACTMB2N2: MOP_IN(OP_EXACTMB2N2);\n DATA_ENSURE(4);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n sprev = s;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N3: MOP_IN(OP_EXACTMB2N3);\n DATA_ENSURE(6);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n sprev = s;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N: MOP_IN(OP_EXACTMB2N);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen * 2);\n while (tlen-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - 2;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB3N: MOP_IN(OP_EXACTMB3N);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen * 3);\n while (tlen-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - 3;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMBN: MOP_IN(OP_EXACTMBN);\n GET_LENGTH_INC(tlen, p); /* mb-len */\n GET_LENGTH_INC(tlen2, p); /* string len */\n tlen2 *= tlen;\n DATA_ENSURE(tlen2);\n while (tlen2-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - tlen;\n MOP_OUT;\n continue;\n break;\n\n case OP_CCLASS: MOP_IN(OP_CCLASS);\n DATA_ENSURE(1);\n if (BITSET_AT(((BitSetRef )p), *s) == 0) goto fail;\n p += SIZE_BITSET;\n s += enclen(encode, s); /* OP_CCLASS can match mb-code. \\D, \\S */\n MOP_OUT;\n break;\n\n case OP_CCLASS_MB: MOP_IN(OP_CCLASS_MB);\n if (! ONIGENC_IS_MBC_HEAD(encode, s)) goto fail;\n\n cclass_mb:\n GET_LENGTH_INC(tlen, p);\n {\n OnigCodePoint code;\n UChar *ss;\n int mb_len;\n\n DATA_ENSURE(1);\n mb_len = enclen(encode, s);\n DATA_ENSURE(mb_len);\n ss = s;\n s += mb_len;\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n\n#ifdef PLATFORM_UNALIGNED_WORD_ACCESS\n if (! onig_is_in_code_range(p, code)) goto fail;\n#else\n q = p;\n ALIGNMENT_RIGHT(q);\n if (! onig_is_in_code_range(q, code)) goto fail;\n#endif\n }\n p += tlen;\n MOP_OUT;\n break;\n\n case OP_CCLASS_MIX: MOP_IN(OP_CCLASS_MIX);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_HEAD(encode, s)) {\n p += SIZE_BITSET;\n goto cclass_mb;\n }\n else {\n if (BITSET_AT(((BitSetRef )p), *s) == 0)\n goto fail;\n\n p += SIZE_BITSET;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n s++;\n }\n MOP_OUT;\n break;\n\n case OP_CCLASS_NOT: MOP_IN(OP_CCLASS_NOT);\n DATA_ENSURE(1);\n if (BITSET_AT(((BitSetRef )p), *s) != 0) goto fail;\n p += SIZE_BITSET;\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_CCLASS_MB_NOT: MOP_IN(OP_CCLASS_MB_NOT);\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_HEAD(encode, s)) {\n s++;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n goto cc_mb_not_success;\n }\n\n cclass_mb_not:\n GET_LENGTH_INC(tlen, p);\n {\n OnigCodePoint code;\n UChar *ss;\n int mb_len = enclen(encode, s);\n\n if (! DATA_ENSURE_CHECK(mb_len)) {\n DATA_ENSURE(1);\n s = (UChar* )end;\n p += tlen;\n goto cc_mb_not_success;\n }\n\n ss = s;\n s += mb_len;\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n\n#ifdef PLATFORM_UNALIGNED_WORD_ACCESS\n if (onig_is_in_code_range(p, code)) goto fail;\n#else\n q = p;\n ALIGNMENT_RIGHT(q);\n if (onig_is_in_code_range(q, code)) goto fail;\n#endif\n }\n p += tlen;\n\n cc_mb_not_success:\n MOP_OUT;\n break;\n\n case OP_CCLASS_MIX_NOT: MOP_IN(OP_CCLASS_MIX_NOT);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_HEAD(encode, s)) {\n p += SIZE_BITSET;\n goto cclass_mb_not;\n }\n else {\n if (BITSET_AT(((BitSetRef )p), *s) != 0)\n goto fail;\n\n p += SIZE_BITSET;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n s++;\n }\n MOP_OUT;\n break;\n\n case OP_CCLASS_NODE: MOP_IN(OP_CCLASS_NODE);\n {\n OnigCodePoint code;\n void *node;\n int mb_len;\n UChar *ss;\n\n DATA_ENSURE(1);\n GET_POINTER_INC(node, p);\n mb_len = enclen(encode, s);\n ss = s;\n s += mb_len;\n DATA_ENSURE(0);\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n if (onig_is_code_in_cc_len(mb_len, code, node) == 0) goto fail;\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR: MOP_IN(OP_ANYCHAR);\n DATA_ENSURE(1);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n s += n;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML: MOP_IN(OP_ANYCHAR_ML);\n DATA_ENSURE(1);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n s += n;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_STAR: MOP_IN(OP_ANYCHAR_STAR);\n while (DATA_ENSURE_CHECK1) {\n STACK_PUSH_ALT(p, s, sprev);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML_STAR: MOP_IN(OP_ANYCHAR_ML_STAR);\n while (DATA_ENSURE_CHECK1) {\n STACK_PUSH_ALT(p, s, sprev);\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_STAR_PEEK_NEXT: MOP_IN(OP_ANYCHAR_STAR_PEEK_NEXT);\n while (DATA_ENSURE_CHECK1) {\n if (*p == *s) {\n STACK_PUSH_ALT(p + 1, s, sprev);\n }\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n p++;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML_STAR_PEEK_NEXT:MOP_IN(OP_ANYCHAR_ML_STAR_PEEK_NEXT);\n while (DATA_ENSURE_CHECK1) {\n if (*p == *s) {\n STACK_PUSH_ALT(p + 1, s, sprev);\n }\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n p++;\n MOP_OUT;\n break;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n case OP_STATE_CHECK_ANYCHAR_STAR: MOP_IN(OP_STATE_CHECK_ANYCHAR_STAR);\n GET_STATE_CHECK_NUM_INC(mem, p);\n while (DATA_ENSURE_CHECK1) {\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n MOP_OUT;\n break;\n\n case OP_STATE_CHECK_ANYCHAR_ML_STAR:\n MOP_IN(OP_STATE_CHECK_ANYCHAR_ML_STAR);\n\n GET_STATE_CHECK_NUM_INC(mem, p);\n while (DATA_ENSURE_CHECK1) {\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem);\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n MOP_OUT;\n break;\n#endif /* USE_COMBINATION_EXPLOSION_CHECK */\n\n case OP_WORD: MOP_IN(OP_WORD);\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_NOT_WORD: MOP_IN(OP_NOT_WORD);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_WORD_BOUND: MOP_IN(OP_WORD_BOUND);\n if (ON_STR_BEGIN(s)) {\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n }\n else if (ON_STR_END(s)) {\n if (! ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n else {\n if (ONIGENC_IS_MBC_WORD(encode, s, end)\n == ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_NOT_WORD_BOUND: MOP_IN(OP_NOT_WORD_BOUND);\n if (ON_STR_BEGIN(s)) {\n if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n }\n else if (ON_STR_END(s)) {\n if (ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n else {\n if (ONIGENC_IS_MBC_WORD(encode, s, end)\n != ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_WORD_BEGIN_END\n case OP_WORD_BEGIN: MOP_IN(OP_WORD_BEGIN);\n if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end)) {\n if (ON_STR_BEGIN(s) || !ONIGENC_IS_MBC_WORD(encode, sprev, end)) {\n MOP_OUT;\n continue;\n }\n }\n goto fail;\n break;\n\n case OP_WORD_END: MOP_IN(OP_WORD_END);\n if (!ON_STR_BEGIN(s) && ONIGENC_IS_MBC_WORD(encode, sprev, end)) {\n if (ON_STR_END(s) || !ONIGENC_IS_MBC_WORD(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n }\n goto fail;\n break;\n#endif\n\n case OP_BEGIN_BUF: MOP_IN(OP_BEGIN_BUF);\n if (! ON_STR_BEGIN(s)) goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_END_BUF: MOP_IN(OP_END_BUF);\n if (! ON_STR_END(s)) goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_BEGIN_LINE: MOP_IN(OP_BEGIN_LINE);\n if (ON_STR_BEGIN(s)) {\n if (IS_NOTBOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, sprev, end) && !ON_STR_END(s)) {\n MOP_OUT;\n continue;\n }\n goto fail;\n break;\n\n case OP_END_LINE: MOP_IN(OP_END_LINE);\n if (ON_STR_END(s)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) {\n#endif\n if (IS_NOTEOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n }\n#endif\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n#endif\n goto fail;\n break;\n\n case OP_SEMI_END_BUF: MOP_IN(OP_SEMI_END_BUF);\n if (ON_STR_END(s)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) {\n#endif\n if (IS_NOTEOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n }\n#endif\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end) &&\n ON_STR_END(s + enclen(encode, s))) {\n MOP_OUT;\n continue;\n }\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) {\n UChar* ss = s + enclen(encode, s);\n ss += enclen(encode, ss);\n if (ON_STR_END(ss)) {\n MOP_OUT;\n continue;\n }\n }\n#endif\n goto fail;\n break;\n\n case OP_BEGIN_POSITION: MOP_IN(OP_BEGIN_POSITION);\n if (s != msa->start)\n goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_START_PUSH: MOP_IN(OP_MEMORY_START_PUSH);\n GET_MEMNUM_INC(mem, p);\n STACK_PUSH_MEM_START(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_START: MOP_IN(OP_MEMORY_START);\n GET_MEMNUM_INC(mem, p);\n mem_start_stk[mem] = (OnigStackIndex )((void* )s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END_PUSH: MOP_IN(OP_MEMORY_END_PUSH);\n GET_MEMNUM_INC(mem, p);\n STACK_PUSH_MEM_END(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END: MOP_IN(OP_MEMORY_END);\n GET_MEMNUM_INC(mem, p);\n mem_end_stk[mem] = (OnigStackIndex )((void* )s);\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_SUBEXP_CALL\n case OP_MEMORY_END_PUSH_REC: MOP_IN(OP_MEMORY_END_PUSH_REC);\n GET_MEMNUM_INC(mem, p);\n STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */\n STACK_PUSH_MEM_END(mem, s);\n mem_start_stk[mem] = GET_STACK_INDEX(stkp);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END_REC: MOP_IN(OP_MEMORY_END_REC);\n GET_MEMNUM_INC(mem, p);\n mem_end_stk[mem] = (OnigStackIndex )((void* )s);\n STACK_GET_MEM_START(mem, stkp);\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n mem_start_stk[mem] = GET_STACK_INDEX(stkp);\n else\n mem_start_stk[mem] = (OnigStackIndex )((void* )stkp->u.mem.pstr);\n\n STACK_PUSH_MEM_END_MARK(mem);\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_BACKREF1: MOP_IN(OP_BACKREF1);\n mem = 1;\n goto backref;\n break;\n\n case OP_BACKREF2: MOP_IN(OP_BACKREF2);\n mem = 2;\n goto backref;\n break;\n\n case OP_BACKREFN: MOP_IN(OP_BACKREFN);\n GET_MEMNUM_INC(mem, p);\n backref:\n {\n int len;\n UChar *pstart, *pend;\n\n /* if you want to remove following line, \n you should check in parse and compile time. */\n if (mem > num_mem) goto fail;\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n STRING_CMP(pstart, s, n);\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREFN_IC: MOP_IN(OP_BACKREFN_IC);\n GET_MEMNUM_INC(mem, p);\n {\n int len;\n UChar *pstart, *pend;\n\n /* if you want to remove following line, \n you should check in parse and compile time. */\n if (mem > num_mem) goto fail;\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n STRING_CMP_IC(case_fold_flag, pstart, &s, n);\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREF_MULTI: MOP_IN(OP_BACKREF_MULTI);\n {\n int len, is_fail;\n UChar *pstart, *pend, *swork;\n\n GET_LENGTH_INC(tlen, p);\n for (i = 0; i < tlen; i++) {\n GET_MEMNUM_INC(mem, p);\n\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n swork = s;\n STRING_CMP_VALUE(pstart, swork, n, is_fail);\n if (is_fail) continue;\n s = swork;\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * (tlen - i - 1));\n break; /* success */\n }\n if (i == tlen) goto fail;\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREF_MULTI_IC: MOP_IN(OP_BACKREF_MULTI_IC);\n {\n int len, is_fail;\n UChar *pstart, *pend, *swork;\n\n GET_LENGTH_INC(tlen, p);\n for (i = 0; i < tlen; i++) {\n GET_MEMNUM_INC(mem, p);\n\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n swork = s;\n STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, n, is_fail);\n if (is_fail) continue;\n s = swork;\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * (tlen - i - 1));\n break; /* success */\n }\n if (i == tlen) goto fail;\n MOP_OUT;\n continue;\n }\n break;\n\n#ifdef USE_BACKREF_WITH_LEVEL\n case OP_BACKREF_WITH_LEVEL:\n {\n int len;\n OnigOptionType ic;\n LengthType level;\n\n GET_OPTION_INC(ic, p);\n GET_LENGTH_INC(level, p);\n GET_LENGTH_INC(tlen, p);\n\n sprev = s;\n if (backref_match_at_nested_level(reg, stk, stk_base, ic\n , case_fold_flag, (int )level, (int )tlen, p, &s, end)) {\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * tlen);\n }\n else\n goto fail;\n\n MOP_OUT;\n continue;\n }\n break;\n#endif\n\n#if 0 /* no need: IS_DYNAMIC_OPTION() == 0 */\n case OP_SET_OPTION_PUSH: MOP_IN(OP_SET_OPTION_PUSH);\n GET_OPTION_INC(option, p);\n STACK_PUSH_ALT(p, s, sprev);\n p += SIZE_OP_SET_OPTION + SIZE_OP_FAIL;\n MOP_OUT;\n continue;\n break;\n\n case OP_SET_OPTION: MOP_IN(OP_SET_OPTION);\n GET_OPTION_INC(option, p);\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_NULL_CHECK_START: MOP_IN(OP_NULL_CHECK_START);\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_PUSH_NULL_CHECK_START(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_NULL_CHECK_END: MOP_IN(OP_NULL_CHECK_END);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_NULL_CHECK(isnull, mem, s);\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n null_check_found:\n /* empty loop founded, skip next instruction */\n switch (*p++) {\n case OP_JUMP:\n case OP_PUSH:\n p += SIZE_RELADDR;\n break;\n case OP_REPEAT_INC:\n case OP_REPEAT_INC_NG:\n case OP_REPEAT_INC_SG:\n case OP_REPEAT_INC_NG_SG:\n p += SIZE_MEMNUM;\n break;\n default:\n goto unexpected_bytecode_error;\n break;\n }\n }\n }\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT\n case OP_NULL_CHECK_END_MEMST: MOP_IN(OP_NULL_CHECK_END_MEMST);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_NULL_CHECK_MEMST(isnull, mem, s, reg);\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END_MEMST: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n if (isnull == -1) goto fail;\n goto \tnull_check_found;\n }\n }\n MOP_OUT;\n continue;\n break;\n#endif\n\n#ifdef USE_SUBEXP_CALL\n case OP_NULL_CHECK_END_MEMST_PUSH:\n MOP_IN(OP_NULL_CHECK_END_MEMST_PUSH);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT\n STACK_NULL_CHECK_MEMST_REC(isnull, mem, s, reg);\n#else\n STACK_NULL_CHECK_REC(isnull, mem, s);\n#endif\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END_MEMST_PUSH: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n if (isnull == -1) goto fail;\n goto \tnull_check_found;\n }\n else {\n STACK_PUSH_NULL_CHECK_END(mem);\n }\n }\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_JUMP: MOP_IN(OP_JUMP);\n GET_RELADDR_INC(addr, p);\n p += addr;\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_PUSH: MOP_IN(OP_PUSH);\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n case OP_STATE_CHECK_PUSH: MOP_IN(OP_STATE_CHECK_PUSH);\n GET_STATE_CHECK_NUM_INC(mem, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem);\n MOP_OUT;\n continue;\n break;\n\n case OP_STATE_CHECK_PUSH_OR_JUMP: MOP_IN(OP_STATE_CHECK_PUSH_OR_JUMP);\n GET_STATE_CHECK_NUM_INC(mem, p);\n GET_RELADDR_INC(addr, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) {\n p += addr;\n }\n else {\n STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem);\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_STATE_CHECK: MOP_IN(OP_STATE_CHECK);\n GET_STATE_CHECK_NUM_INC(mem, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_STATE_CHECK(s, mem);\n MOP_OUT;\n continue;\n break;\n#endif /* USE_COMBINATION_EXPLOSION_CHECK */\n\n case OP_POP: MOP_IN(OP_POP);\n STACK_POP_ONE;\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_OR_JUMP_EXACT1: MOP_IN(OP_PUSH_OR_JUMP_EXACT1);\n GET_RELADDR_INC(addr, p);\n if (*p == *s && DATA_ENSURE_CHECK1) {\n p++;\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n }\n p += (addr + 1);\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_IF_PEEK_NEXT: MOP_IN(OP_PUSH_IF_PEEK_NEXT);\n GET_RELADDR_INC(addr, p);\n if (*p == *s) {\n p++;\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n }\n p++;\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT: MOP_IN(OP_REPEAT);\n {\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n GET_RELADDR_INC(addr, p);\n\n STACK_ENSURE(1);\n repeat_stk[mem] = GET_STACK_INDEX(stk);\n STACK_PUSH_REPEAT(mem, p);\n\n if (reg->repeat_range[mem].lower == 0) {\n STACK_PUSH_ALT(p + addr, s, sprev);\n }\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT_NG: MOP_IN(OP_REPEAT_NG);\n {\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n GET_RELADDR_INC(addr, p);\n\n STACK_ENSURE(1);\n repeat_stk[mem] = GET_STACK_INDEX(stk);\n STACK_PUSH_REPEAT(mem, p);\n\n if (reg->repeat_range[mem].lower == 0) {\n STACK_PUSH_ALT(p, s, sprev);\n p += addr;\n }\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT_INC: MOP_IN(OP_REPEAT_INC);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n si = repeat_stk[mem];\n stkp = STACK_AT(si);\n\n repeat_inc:\n stkp->u.repeat.count++;\n if (stkp->u.repeat.count >= reg->repeat_range[mem].upper) {\n /* end of repeat. Nothing to do. */\n }\n else if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) {\n STACK_PUSH_ALT(p, s, sprev);\n p = STACK_AT(si)->u.repeat.pcode; /* Don't use stkp after PUSH. */\n }\n else {\n p = stkp->u.repeat.pcode;\n }\n STACK_PUSH_REPEAT_INC(si);\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_REPEAT_INC_SG: MOP_IN(OP_REPEAT_INC_SG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n STACK_GET_REPEAT(mem, stkp);\n si = GET_STACK_INDEX(stkp);\n goto repeat_inc;\n break;\n\n case OP_REPEAT_INC_NG: MOP_IN(OP_REPEAT_INC_NG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n si = repeat_stk[mem];\n stkp = STACK_AT(si);\n\n repeat_inc_ng:\n stkp->u.repeat.count++;\n if (stkp->u.repeat.count < reg->repeat_range[mem].upper) {\n if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) {\n UChar* pcode = stkp->u.repeat.pcode;\n\n STACK_PUSH_REPEAT_INC(si);\n STACK_PUSH_ALT(pcode, s, sprev);\n }\n else {\n p = stkp->u.repeat.pcode;\n STACK_PUSH_REPEAT_INC(si);\n }\n }\n else if (stkp->u.repeat.count == reg->repeat_range[mem].upper) {\n STACK_PUSH_REPEAT_INC(si);\n }\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_REPEAT_INC_NG_SG: MOP_IN(OP_REPEAT_INC_NG_SG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n STACK_GET_REPEAT(mem, stkp);\n si = GET_STACK_INDEX(stkp);\n goto repeat_inc_ng;\n break;\n\n case OP_PUSH_POS: MOP_IN(OP_PUSH_POS);\n STACK_PUSH_POS(s, sprev);\n MOP_OUT;\n continue;\n break;\n\n case OP_POP_POS: MOP_IN(OP_POP_POS);\n {\n STACK_POS_END(stkp);\n s = stkp->u.state.pstr;\n sprev = stkp->u.state.pstr_prev;\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_POS_NOT: MOP_IN(OP_PUSH_POS_NOT);\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_POS_NOT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n break;\n\n case OP_FAIL_POS: MOP_IN(OP_FAIL_POS);\n STACK_POP_TIL_POS_NOT;\n goto fail;\n break;\n\n case OP_PUSH_STOP_BT: MOP_IN(OP_PUSH_STOP_BT);\n STACK_PUSH_STOP_BT;\n MOP_OUT;\n continue;\n break;\n\n case OP_POP_STOP_BT: MOP_IN(OP_POP_STOP_BT);\n STACK_STOP_BT_END;\n MOP_OUT;\n continue;\n break;\n\n case OP_LOOK_BEHIND: MOP_IN(OP_LOOK_BEHIND);\n GET_LENGTH_INC(tlen, p);\n s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen);\n if (IS_NULL(s)) goto fail;\n sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_LOOK_BEHIND_NOT: MOP_IN(OP_PUSH_LOOK_BEHIND_NOT);\n GET_RELADDR_INC(addr, p);\n GET_LENGTH_INC(tlen, p);\n q = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen);\n if (IS_NULL(q)) {\n /* too short case -> success. ex. /(?p + addr;\n MOP_OUT;\n continue;\n break;\n\n case OP_RETURN: MOP_IN(OP_RETURN);\n STACK_RETURN(p);\n STACK_PUSH_RETURN;\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_FINISH:\n goto finish;\n break;\n\n fail:\n MOP_OUT;\n /* fall */\n case OP_FAIL: MOP_IN(OP_FAIL);\n STACK_POP;\n p = stk->u.state.pcode;\n s = stk->u.state.pstr;\n sprev = stk->u.state.pstr_prev;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n if (stk->u.state.state_check != 0) {\n stk->type = STK_STATE_CHECK_MARK;\n stk++;\n }\n#endif\n\n MOP_OUT;\n continue;\n break;\n\n default:\n goto bytecode_error;\n\n } /* end of switch */\n sprev = sbegin;\n } /* end of while(1) */\n\n finish:\n STACK_SAVE;\n return best_len;\n\n#ifdef ONIG_DEBUG\n stack_error:\n STACK_SAVE;\n return ONIGERR_STACK_BUG;\n#endif\n\n bytecode_error:\n STACK_SAVE;\n return ONIGERR_UNDEFINED_BYTECODE;\n\n unexpected_bytecode_error:\n STACK_SAVE;\n return ONIGERR_UNEXPECTED_BYTECODE;\n}","lang":"c","vul_type":"cwe-125","target_token_count":11007,"sven_meta":{"func_name":"match_at","file_name":"src/regexec.c","commit_link":"github.com/kkos/oniguruma/commit/690313a061f7a4fa614ec5cc8368b4f2284e059b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#37-5d5e81732393","input":"static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image\n *image;\n\n MagickBooleanType\n has_merged_image,\n skip_layers;\n\n MagickOffsetType\n offset;\n\n MagickSizeType\n length;\n\n MagickBooleanType\n status;\n\n PSDInfo\n psd_info;\n\n register ssize_t\n i;\n\n ssize_t\n count;\n\n unsigned char\n *data;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read image header.\n */\n image->endian=MSBEndian;\n count=ReadBlob(image,4,(unsigned char *) psd_info.signature);\n psd_info.version=ReadBlobMSBShort(image);\n if ((count == 0) || (LocaleNCompare(psd_info.signature,\"8BPS\",4) != 0) ||\n ((psd_info.version != 1) && (psd_info.version != 2)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n (void) ReadBlob(image,6,psd_info.reserved);\n psd_info.channels=ReadBlobMSBShort(image);\n if (psd_info.channels > MaxPSDChannels)\n ThrowReaderException(CorruptImageError,\"MaximumChannelsExceeded\");\n psd_info.rows=ReadBlobMSBLong(image);\n psd_info.columns=ReadBlobMSBLong(image);\n if ((psd_info.version == 1) && ((psd_info.rows > 30000) ||\n (psd_info.columns > 30000)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n psd_info.depth=ReadBlobMSBShort(image);\n if ((psd_info.depth != 1) && (psd_info.depth != 8) && (psd_info.depth != 16))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n psd_info.mode=ReadBlobMSBShort(image);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image is %.20g x %.20g with channels=%.20g, depth=%.20g, mode=%s\",\n (double) psd_info.columns,(double) psd_info.rows,(double)\n psd_info.channels,(double) psd_info.depth,ModeToString((PSDImageType)\n psd_info.mode));\n /*\n Initialize image.\n */\n image->depth=psd_info.depth;\n image->columns=psd_info.columns;\n image->rows=psd_info.rows;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n if (SetImageBackgroundColor(image,exception) == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n if (psd_info.mode == LabMode)\n SetImageColorspace(image,LabColorspace,exception);\n if (psd_info.mode == CMYKMode)\n {\n SetImageColorspace(image,CMYKColorspace,exception);\n image->alpha_trait=psd_info.channels > 4 ? BlendPixelTrait :\n UndefinedPixelTrait;\n }\n else if ((psd_info.mode == BitmapMode) || (psd_info.mode == GrayscaleMode) ||\n (psd_info.mode == DuotoneMode))\n {\n status=AcquireImageColormap(image,psd_info.depth != 16 ? 256 : 65536,\n exception);\n if (status == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image colormap allocated\");\n SetImageColorspace(image,GRAYColorspace,exception);\n image->alpha_trait=psd_info.channels > 1 ? BlendPixelTrait :\n UndefinedPixelTrait;\n }\n else\n image->alpha_trait=psd_info.channels > 3 ? BlendPixelTrait :\n UndefinedPixelTrait;\n /*\n Read PSD raster colormap only present for indexed and duotone images.\n */\n length=ReadBlobMSBLong(image);\n if (length != 0)\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading colormap\");\n if (psd_info.mode == DuotoneMode)\n {\n /*\n Duotone image data; the format of this data is undocumented.\n */\n data=(unsigned char *) AcquireQuantumMemory((size_t) length,\n sizeof(*data));\n if (data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ReadBlob(image,(size_t) length,data);\n data=(unsigned char *) RelinquishMagickMemory(data);\n }\n else\n {\n size_t\n number_colors;\n\n /*\n Read PSD raster colormap.\n */\n number_colors=length/3;\n if (number_colors > 65536)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (AcquireImageColormap(image,number_colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].red=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->alpha_trait=UndefinedPixelTrait;\n }\n }\n has_merged_image=MagickTrue;\n length=ReadBlobMSBLong(image);\n if (length != 0)\n {\n unsigned char\n *blocks;\n\n /*\n Image resources block.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading image resource blocks - %.20g bytes\",(double)\n ((MagickOffsetType) length));\n blocks=(unsigned char *) AcquireQuantumMemory((size_t) length,\n sizeof(*blocks));\n if (blocks == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,(size_t) length,blocks);\n if ((count != (ssize_t) length) ||\n (LocaleNCompare((char *) blocks,\"8BIM\",4) != 0))\n {\n blocks=(unsigned char *) RelinquishMagickMemory(blocks);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n ParseImageResourceBlocks(image,blocks,(size_t) length,&has_merged_image,\n exception);\n blocks=(unsigned char *) RelinquishMagickMemory(blocks);\n }\n /*\n Layer and mask block.\n */\n length=GetPSDSize(&psd_info,image);\n if (length == 8)\n {\n length=ReadBlobMSBLong(image);\n length=ReadBlobMSBLong(image);\n }\n offset=TellBlob(image);\n skip_layers=MagickFalse;\n if ((image_info->number_scenes == 1) && (image_info->scene == 0) &&\n (has_merged_image != MagickFalse))\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" read composite only\");\n skip_layers=MagickTrue;\n }\n if (length == 0)\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has no layers\");\n }\n else\n {\n if (ReadPSDLayers(image,image_info,&psd_info,skip_layers,exception) !=\n MagickTrue)\n {\n (void) CloseBlob(image);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n\n /*\n Skip the rest of the layer and mask information.\n */\n SeekBlob(image,offset+length,SEEK_SET);\n }\n /*\n If we are only \"pinging\" the image, then we're done - so return.\n */\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n /*\n Read the precombined layer, present for PSD < 4 compatibility.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading the precombined layer\");\n if ((has_merged_image != MagickFalse) || (GetImageListLength(image) == 1))\n has_merged_image=(MagickBooleanType) ReadPSDMergedImage(image_info,image,\n &psd_info,exception);\n if ((has_merged_image == MagickFalse) && (GetImageListLength(image) == 1) &&\n (length != 0))\n {\n SeekBlob(image,offset,SEEK_SET);\n status=ReadPSDLayers(image,image_info,&psd_info,MagickFalse,exception);\n if (status != MagickTrue)\n {\n (void) CloseBlob(image);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n }\n if ((has_merged_image == MagickFalse) && (GetImageListLength(image) > 1))\n {\n Image\n *merged;\n\n SetImageAlphaChannel(image,TransparentAlphaChannel,exception);\n image->background_color.alpha=TransparentAlpha;\n image->background_color.alpha_trait=BlendPixelTrait;\n merged=MergeImageLayers(image,FlattenLayer,exception);\n ReplaceImageInList(&image,merged);\n }\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image\n *image;\n\n MagickBooleanType\n has_merged_image,\n skip_layers;\n\n MagickOffsetType\n offset;\n\n MagickSizeType\n length;\n\n MagickBooleanType\n status;\n\n PSDInfo\n psd_info;\n\n register ssize_t\n i;\n\n ssize_t\n count;\n\n unsigned char\n *data;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read image header.\n */\n image->endian=MSBEndian;\n count=ReadBlob(image,4,(unsigned char *) psd_info.signature);\n psd_info.version=ReadBlobMSBShort(image);\n if ((count == 0) || (LocaleNCompare(psd_info.signature,\"8BPS\",4) != 0) ||\n ((psd_info.version != 1) && (psd_info.version != 2)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n (void) ReadBlob(image,6,psd_info.reserved);\n psd_info.channels=ReadBlobMSBShort(image);\n if (psd_info.channels > MaxPSDChannels)\n ThrowReaderException(CorruptImageError,\"MaximumChannelsExceeded\");\n psd_info.rows=ReadBlobMSBLong(image);\n psd_info.columns=ReadBlobMSBLong(image);\n if ((psd_info.version == 1) && ((psd_info.rows > 30000) ||\n (psd_info.columns > 30000)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n psd_info.depth=ReadBlobMSBShort(image);\n if ((psd_info.depth != 1) && (psd_info.depth != 8) && (psd_info.depth != 16))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n psd_info.mode=ReadBlobMSBShort(image);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image is %.20g x %.20g with channels=%.20g, depth=%.20g, mode=%s\",\n (double) psd_info.columns,(double) psd_info.rows,(double)\n psd_info.channels,(double) psd_info.depth,ModeToString((PSDImageType)\n psd_info.mode));\n /*\n Initialize image.\n */\n image->depth=psd_info.depth;\n image->columns=psd_info.columns;\n image->rows=psd_info.rows;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n if (SetImageBackgroundColor(image,exception) == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n if (psd_info.mode == LabMode)\n SetImageColorspace(image,LabColorspace,exception);\n if (psd_info.mode == CMYKMode)\n {\n SetImageColorspace(image,CMYKColorspace,exception);\n image->alpha_trait=psd_info.channels > 4 ? BlendPixelTrait :\n UndefinedPixelTrait;\n }\n else if ((psd_info.mode == BitmapMode) || (psd_info.mode == GrayscaleMode) ||\n (psd_info.mode == DuotoneMode))\n {\n status=AcquireImageColormap(image,psd_info.depth != 16 ? 256 : 65536,\n exception);\n if (status == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image colormap allocated\");\n SetImageColorspace(image,GRAYColorspace,exception);\n image->alpha_trait=psd_info.channels > 1 ? BlendPixelTrait :\n UndefinedPixelTrait;\n }\n else\n image->alpha_trait=psd_info.channels > 3 ? BlendPixelTrait :\n UndefinedPixelTrait;\n /*\n Read PSD raster colormap only present for indexed and duotone images.\n */\n length=ReadBlobMSBLong(image);\n if (length != 0)\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading colormap\");\n if (psd_info.mode == DuotoneMode)\n {\n /*\n Duotone image data; the format of this data is undocumented.\n */\n data=(unsigned char *) AcquireQuantumMemory((size_t) length,\n sizeof(*data));\n if (data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ReadBlob(image,(size_t) length,data);\n data=(unsigned char *) RelinquishMagickMemory(data);\n }\n else\n {\n size_t\n number_colors;\n\n /*\n Read PSD raster colormap.\n */\n number_colors=length/3;\n if (number_colors > 65536)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (AcquireImageColormap(image,number_colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].red=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->alpha_trait=UndefinedPixelTrait;\n }\n }\n if ((image->depth == 1) && (image->storage_class != PseudoClass))\n ThrowReaderException(CorruptImageError, \"ImproperImageHeader\");\n has_merged_image=MagickTrue;\n length=ReadBlobMSBLong(image);\n if (length != 0)\n {\n unsigned char\n *blocks;\n\n /*\n Image resources block.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading image resource blocks - %.20g bytes\",(double)\n ((MagickOffsetType) length));\n blocks=(unsigned char *) AcquireQuantumMemory((size_t) length,\n sizeof(*blocks));\n if (blocks == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,(size_t) length,blocks);\n if ((count != (ssize_t) length) ||\n (LocaleNCompare((char *) blocks,\"8BIM\",4) != 0))\n {\n blocks=(unsigned char *) RelinquishMagickMemory(blocks);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n ParseImageResourceBlocks(image,blocks,(size_t) length,&has_merged_image,\n exception);\n blocks=(unsigned char *) RelinquishMagickMemory(blocks);\n }\n /*\n Layer and mask block.\n */\n length=GetPSDSize(&psd_info,image);\n if (length == 8)\n {\n length=ReadBlobMSBLong(image);\n length=ReadBlobMSBLong(image);\n }\n offset=TellBlob(image);\n skip_layers=MagickFalse;\n if ((image_info->number_scenes == 1) && (image_info->scene == 0) &&\n (has_merged_image != MagickFalse))\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" read composite only\");\n skip_layers=MagickTrue;\n }\n if (length == 0)\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has no layers\");\n }\n else\n {\n if (ReadPSDLayers(image,image_info,&psd_info,skip_layers,exception) !=\n MagickTrue)\n {\n (void) CloseBlob(image);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n\n /*\n Skip the rest of the layer and mask information.\n */\n SeekBlob(image,offset+length,SEEK_SET);\n }\n /*\n If we are only \"pinging\" the image, then we're done - so return.\n */\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n /*\n Read the precombined layer, present for PSD < 4 compatibility.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading the precombined layer\");\n if ((has_merged_image != MagickFalse) || (GetImageListLength(image) == 1))\n has_merged_image=(MagickBooleanType) ReadPSDMergedImage(image_info,image,\n &psd_info,exception);\n if ((has_merged_image == MagickFalse) && (GetImageListLength(image) == 1) &&\n (length != 0))\n {\n SeekBlob(image,offset,SEEK_SET);\n status=ReadPSDLayers(image,image_info,&psd_info,MagickFalse,exception);\n if (status != MagickTrue)\n {\n (void) CloseBlob(image);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n }\n if ((has_merged_image == MagickFalse) && (GetImageListLength(image) > 1))\n {\n Image\n *merged;\n\n SetImageAlphaChannel(image,TransparentAlphaChannel,exception);\n image->background_color.alpha=TransparentAlpha;\n image->background_color.alpha_trait=BlendPixelTrait;\n merged=MergeImageLayers(image,FlattenLayer,exception);\n ReplaceImageInList(&image,merged);\n }\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-125","target_token_count":2402,"sven_meta":{"func_name":"ReadPSDImage","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/198fffab4daf8aea88badd9c629350e5b26ec32f","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#38-ccf27e3cd626","input":"decode_bundle(bool load, const struct nx_action_bundle *nab,\n const struct vl_mff_map *vl_mff_map, uint64_t *tlv_bitmap,\n struct ofpbuf *ofpacts)\n{\n static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);\n struct ofpact_bundle *bundle;\n uint32_t slave_type;\n size_t slaves_size, i;\n enum ofperr error;\n\n bundle = ofpact_put_BUNDLE(ofpacts);\n\n bundle->n_slaves = ntohs(nab->n_slaves);\n bundle->basis = ntohs(nab->basis);\n bundle->fields = ntohs(nab->fields);\n bundle->algorithm = ntohs(nab->algorithm);\n slave_type = ntohl(nab->slave_type);\n slaves_size = ntohs(nab->len) - sizeof *nab;\n\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n if (!flow_hash_fields_valid(bundle->fields)) {\n VLOG_WARN_RL(&rl, \"unsupported fields %d\", (int) bundle->fields);\n } else if (bundle->n_slaves > BUNDLE_MAX_SLAVES) {\n VLOG_WARN_RL(&rl, \"too many slaves\");\n } else if (bundle->algorithm != NX_BD_ALG_HRW\n && bundle->algorithm != NX_BD_ALG_ACTIVE_BACKUP) {\n VLOG_WARN_RL(&rl, \"unsupported algorithm %d\", (int) bundle->algorithm);\n } else if (slave_type != mf_nxm_header(MFF_IN_PORT)) {\n VLOG_WARN_RL(&rl, \"unsupported slave type %\"PRIu16, slave_type);\n } else {\n error = 0;\n }\n\n if (!is_all_zeros(nab->zero, sizeof nab->zero)) {\n VLOG_WARN_RL(&rl, \"reserved field is nonzero\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n\n if (load) {\n bundle->dst.ofs = nxm_decode_ofs(nab->ofs_nbits);\n bundle->dst.n_bits = nxm_decode_n_bits(nab->ofs_nbits);\n error = mf_vl_mff_mf_from_nxm_header(ntohl(nab->dst), vl_mff_map,\n &bundle->dst.field, tlv_bitmap);\n if (error) {\n return error;\n }\n\n if (bundle->dst.n_bits < 16) {\n VLOG_WARN_RL(&rl, \"bundle_load action requires at least 16 bit \"\n \"destination.\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n } else {\n if (nab->ofs_nbits || nab->dst) {\n VLOG_WARN_RL(&rl, \"bundle action has nonzero reserved fields\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n }\n\n if (slaves_size < bundle->n_slaves * sizeof(ovs_be16)) {\n VLOG_WARN_RL(&rl, \"Nicira action %s only has %\"PRIuSIZE\" bytes \"\n \"allocated for slaves. %\"PRIuSIZE\" bytes are required \"\n \"for %\"PRIu16\" slaves.\",\n load ? \"bundle_load\" : \"bundle\", slaves_size,\n bundle->n_slaves * sizeof(ovs_be16), bundle->n_slaves);\n error = OFPERR_OFPBAC_BAD_LEN;\n }\n\n for (i = 0; i < bundle->n_slaves; i++) {\n ofp_port_t ofp_port = u16_to_ofp(ntohs(((ovs_be16 *)(nab + 1))[i]));\n ofpbuf_put(ofpacts, &ofp_port, sizeof ofp_port);\n bundle = ofpacts->header;\n }\n\n ofpact_finish_BUNDLE(ofpacts, &bundle);\n if (!error) {\n error = bundle_check(bundle, OFPP_MAX, NULL);\n }\n return error;\n}","target":"decode_bundle(bool load, const struct nx_action_bundle *nab,\n const struct vl_mff_map *vl_mff_map, uint64_t *tlv_bitmap,\n struct ofpbuf *ofpacts)\n{\n static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);\n struct ofpact_bundle *bundle;\n uint32_t slave_type;\n size_t slaves_size, i;\n enum ofperr error;\n\n bundle = ofpact_put_BUNDLE(ofpacts);\n\n bundle->n_slaves = ntohs(nab->n_slaves);\n bundle->basis = ntohs(nab->basis);\n bundle->fields = ntohs(nab->fields);\n bundle->algorithm = ntohs(nab->algorithm);\n slave_type = ntohl(nab->slave_type);\n slaves_size = ntohs(nab->len) - sizeof *nab;\n\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n if (!flow_hash_fields_valid(bundle->fields)) {\n VLOG_WARN_RL(&rl, \"unsupported fields %d\", (int) bundle->fields);\n } else if (bundle->n_slaves > BUNDLE_MAX_SLAVES) {\n VLOG_WARN_RL(&rl, \"too many slaves\");\n } else if (bundle->algorithm != NX_BD_ALG_HRW\n && bundle->algorithm != NX_BD_ALG_ACTIVE_BACKUP) {\n VLOG_WARN_RL(&rl, \"unsupported algorithm %d\", (int) bundle->algorithm);\n } else if (slave_type != mf_nxm_header(MFF_IN_PORT)) {\n VLOG_WARN_RL(&rl, \"unsupported slave type %\"PRIu16, slave_type);\n } else {\n error = 0;\n }\n\n if (!is_all_zeros(nab->zero, sizeof nab->zero)) {\n VLOG_WARN_RL(&rl, \"reserved field is nonzero\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n\n if (load) {\n bundle->dst.ofs = nxm_decode_ofs(nab->ofs_nbits);\n bundle->dst.n_bits = nxm_decode_n_bits(nab->ofs_nbits);\n error = mf_vl_mff_mf_from_nxm_header(ntohl(nab->dst), vl_mff_map,\n &bundle->dst.field, tlv_bitmap);\n if (error) {\n return error;\n }\n\n if (bundle->dst.n_bits < 16) {\n VLOG_WARN_RL(&rl, \"bundle_load action requires at least 16 bit \"\n \"destination.\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n } else {\n if (nab->ofs_nbits || nab->dst) {\n VLOG_WARN_RL(&rl, \"bundle action has nonzero reserved fields\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n }\n\n if (slaves_size < bundle->n_slaves * sizeof(ovs_be16)) {\n VLOG_WARN_RL(&rl, \"Nicira action %s only has %\"PRIuSIZE\" bytes \"\n \"allocated for slaves. %\"PRIuSIZE\" bytes are required \"\n \"for %\"PRIu16\" slaves.\",\n load ? \"bundle_load\" : \"bundle\", slaves_size,\n bundle->n_slaves * sizeof(ovs_be16), bundle->n_slaves);\n error = OFPERR_OFPBAC_BAD_LEN;\n } else {\n for (i = 0; i < bundle->n_slaves; i++) {\n ofp_port_t ofp_port\n = u16_to_ofp(ntohs(((ovs_be16 *)(nab + 1))[i]));\n ofpbuf_put(ofpacts, &ofp_port, sizeof ofp_port);\n bundle = ofpacts->header;\n }\n }\n\n ofpact_finish_BUNDLE(ofpacts, &bundle);\n if (!error) {\n error = bundle_check(bundle, OFPP_MAX, NULL);\n }\n return error;\n}","lang":"c","vul_type":"cwe-125","target_token_count":873,"sven_meta":{"func_name":"decode_bundle","file_name":"lib/ofp-actions.c","commit_link":"github.com/openvswitch/ovs/commit/9237a63c47bd314b807cda0bd2216264e82edbe8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#39-afe1ff6fc805","input":"MagickExport Image *SpliceImage(const Image *image,\n const RectangleInfo *geometry,ExceptionInfo *exception)\n{\n#define SpliceImageTag \"Splice/Image\"\n\n CacheView\n *image_view,\n *splice_view;\n\n Image\n *splice_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n RectangleInfo\n splice_geometry;\n\n ssize_t\n y;\n\n /*\n Allocate splice image.\n */\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(geometry != (const RectangleInfo *) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n splice_geometry=(*geometry);\n splice_image=CloneImage(image,image->columns+splice_geometry.width,\n image->rows+splice_geometry.height,MagickTrue,exception);\n if (splice_image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(splice_image,DirectClass,exception) == MagickFalse)\n {\n splice_image=DestroyImage(splice_image);\n return((Image *) NULL);\n }\n if ((IsPixelInfoGray(&splice_image->background_color) == MagickFalse) &&\n (IsGrayColorspace(splice_image->colorspace) != MagickFalse))\n (void) SetImageColorspace(splice_image,sRGBColorspace,exception);\n if ((splice_image->background_color.alpha_trait != UndefinedPixelTrait) &&\n (splice_image->alpha_trait == UndefinedPixelTrait))\n (void) SetImageAlpha(splice_image,OpaqueAlpha,exception);\n (void) SetImageBackgroundColor(splice_image,exception);\n /*\n Respect image geometry.\n */\n switch (image->gravity)\n {\n default:\n case UndefinedGravity:\n case NorthWestGravity:\n break;\n case NorthGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n break;\n }\n case NorthEastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n break;\n }\n case WestGravity:\n {\n splice_geometry.y+=(ssize_t) splice_geometry.width/2;\n break;\n }\n case CenterGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n splice_geometry.y+=(ssize_t) splice_geometry.height/2;\n break;\n }\n case EastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n splice_geometry.y+=(ssize_t) splice_geometry.height/2;\n break;\n }\n case SouthWestGravity:\n {\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n case SouthGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n case SouthEastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n }\n /*\n Splice image.\n */\n status=MagickTrue;\n progress=0;\n image_view=AcquireVirtualCacheView(image,exception);\n splice_view=AcquireAuthenticCacheView(splice_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static,4) shared(progress,status) \\\n magick_threads(image,splice_image,1,1)\n#endif\n for (y=0; y < (ssize_t) splice_geometry.y; y++)\n {\n register const Quantum\n *restrict p;\n\n register ssize_t\n x;\n\n register Quantum\n *restrict q;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);\n q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1,\n exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < splice_geometry.x; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,p) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n for ( ; x < (ssize_t) (splice_geometry.x+splice_geometry.width); x++)\n q+=GetPixelChannels(splice_image);\n for ( ; x < (ssize_t) splice_image->columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,p) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n if (SyncCacheViewAuthenticPixels(splice_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_TransposeImage)\n#endif\n proceed=SetImageProgress(image,SpliceImageTag,progress++,\n splice_image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static,4) shared(progress,status) \\\n magick_threads(image,splice_image,1,1)\n#endif\n for (y=(ssize_t) (splice_geometry.y+splice_geometry.height);\n y < (ssize_t) splice_image->rows; y++)\n {\n register const Quantum\n *restrict p;\n\n register ssize_t\n x;\n\n register Quantum\n *restrict q;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,0,y-(ssize_t) splice_geometry.height,\n image->columns,1,exception);\n if ((y < 0) || (y >= (ssize_t) splice_image->rows))\n continue;\n q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1,\n exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < splice_geometry.x; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,q) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n for ( ; x < (ssize_t) (splice_geometry.x+splice_geometry.width); x++)\n q+=GetPixelChannels(splice_image);\n for ( ; x < (ssize_t) splice_image->columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,q) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n if (SyncCacheViewAuthenticPixels(splice_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_TransposeImage)\n#endif\n proceed=SetImageProgress(image,SpliceImageTag,progress++,\n splice_image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n splice_view=DestroyCacheView(splice_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n splice_image=DestroyImage(splice_image);\n return(splice_image);\n}","target":"MagickExport Image *SpliceImage(const Image *image,\n const RectangleInfo *geometry,ExceptionInfo *exception)\n{\n#define SpliceImageTag \"Splice/Image\"\n\n CacheView\n *image_view,\n *splice_view;\n\n Image\n *splice_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n RectangleInfo\n splice_geometry;\n\n ssize_t\n columns,\n y;\n\n /*\n Allocate splice image.\n */\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(geometry != (const RectangleInfo *) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n splice_geometry=(*geometry);\n splice_image=CloneImage(image,image->columns+splice_geometry.width,\n image->rows+splice_geometry.height,MagickTrue,exception);\n if (splice_image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(splice_image,DirectClass,exception) == MagickFalse)\n {\n splice_image=DestroyImage(splice_image);\n return((Image *) NULL);\n }\n if ((IsPixelInfoGray(&splice_image->background_color) == MagickFalse) &&\n (IsGrayColorspace(splice_image->colorspace) != MagickFalse))\n (void) SetImageColorspace(splice_image,sRGBColorspace,exception);\n if ((splice_image->background_color.alpha_trait != UndefinedPixelTrait) &&\n (splice_image->alpha_trait == UndefinedPixelTrait))\n (void) SetImageAlpha(splice_image,OpaqueAlpha,exception);\n (void) SetImageBackgroundColor(splice_image,exception);\n /*\n Respect image geometry.\n */\n switch (image->gravity)\n {\n default:\n case UndefinedGravity:\n case NorthWestGravity:\n break;\n case NorthGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n break;\n }\n case NorthEastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n break;\n }\n case WestGravity:\n {\n splice_geometry.y+=(ssize_t) splice_geometry.width/2;\n break;\n }\n case CenterGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n splice_geometry.y+=(ssize_t) splice_geometry.height/2;\n break;\n }\n case EastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n splice_geometry.y+=(ssize_t) splice_geometry.height/2;\n break;\n }\n case SouthWestGravity:\n {\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n case SouthGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n case SouthEastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n }\n /*\n Splice image.\n */\n status=MagickTrue;\n progress=0;\n columns=MagickMin(splice_geometry.x,(ssize_t) splice_image->columns);\n image_view=AcquireVirtualCacheView(image,exception);\n splice_view=AcquireAuthenticCacheView(splice_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static,4) shared(progress,status) \\\n magick_threads(image,splice_image,1,1)\n#endif\n for (y=0; y < (ssize_t) splice_geometry.y; y++)\n {\n register const Quantum\n *restrict p;\n\n register ssize_t\n x;\n\n register Quantum\n *restrict q;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,0,y,splice_image->columns,1,\n exception);\n q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1,\n exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,p) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n for ( ; x < (ssize_t) (splice_geometry.x+splice_geometry.width); x++)\n q+=GetPixelChannels(splice_image);\n for ( ; x < (ssize_t) splice_image->columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,p) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n if (SyncCacheViewAuthenticPixels(splice_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_TransposeImage)\n#endif\n proceed=SetImageProgress(image,SpliceImageTag,progress++,\n splice_image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static,4) shared(progress,status) \\\n magick_threads(image,splice_image,1,1)\n#endif\n for (y=(ssize_t) (splice_geometry.y+splice_geometry.height);\n y < (ssize_t) splice_image->rows; y++)\n {\n register const Quantum\n *restrict p;\n\n register ssize_t\n x;\n\n register Quantum\n *restrict q;\n\n if (status == MagickFalse)\n continue;\n if ((y < 0) || (y >= (ssize_t)splice_image->rows))\n continue;\n p=GetCacheViewVirtualPixels(image_view,0,y-(ssize_t) splice_geometry.height,\n splice_image->columns,1,exception);\n q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1,\n exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,q) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n for ( ; x < (ssize_t) (splice_geometry.x+splice_geometry.width); x++)\n q+=GetPixelChannels(splice_image);\n for ( ; x < (ssize_t) splice_image->columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,q) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n if (SyncCacheViewAuthenticPixels(splice_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_TransposeImage)\n#endif\n proceed=SetImageProgress(image,SpliceImageTag,progress++,\n splice_image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n splice_view=DestroyCacheView(splice_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n splice_image=DestroyImage(splice_image);\n return(splice_image);\n}","lang":"c","vul_type":"cwe-125","target_token_count":2558,"sven_meta":{"func_name":"SpliceImage","file_name":"MagickCore/transform.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/7b1cf5784b5bcd85aa9293ecf56769f68c037231","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#40-8cbe1ab126a5","input":"wrap_lines_smart(ASS_Renderer *render_priv, double max_text_width)\n{\n int i;\n GlyphInfo *cur, *s1, *e1, *s2, *s3;\n int last_space;\n int break_type;\n int exit;\n double pen_shift_x;\n double pen_shift_y;\n int cur_line;\n int run_offset;\n TextInfo *text_info = &render_priv->text_info;\n\n last_space = -1;\n text_info->n_lines = 1;\n break_type = 0;\n s1 = text_info->glyphs; // current line start\n for (i = 0; i < text_info->length; ++i) {\n int break_at = -1;\n double s_offset, len;\n cur = text_info->glyphs + i;\n s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x);\n len = d6_to_double(cur->bbox.xMax + cur->pos.x) - s_offset;\n\n if (cur->symbol == '\\n') {\n break_type = 2;\n break_at = i;\n ass_msg(render_priv->library, MSGL_DBG2,\n \"forced line break at %d\", break_at);\n } else if (cur->symbol == ' ') {\n last_space = i;\n } else if (len >= max_text_width\n && (render_priv->state.wrap_style != 2)) {\n break_type = 1;\n break_at = last_space;\n if (break_at >= 0)\n ass_msg(render_priv->library, MSGL_DBG2, \"line break at %d\",\n break_at);\n }\n\n if (break_at != -1) {\n // need to use one more line\n // marking break_at+1 as start of a new line\n int lead = break_at + 1; // the first symbol of the new line\n if (text_info->n_lines >= text_info->max_lines) {\n // Raise maximum number of lines\n text_info->max_lines *= 2;\n text_info->lines = realloc(text_info->lines,\n sizeof(LineInfo) *\n text_info->max_lines);\n }\n if (lead < text_info->length) {\n text_info->glyphs[lead].linebreak = break_type;\n last_space = -1;\n s1 = text_info->glyphs + lead;\n text_info->n_lines++;\n }\n }\n }\n#define DIFF(x,y) (((x) < (y)) ? (y - x) : (x - y))\n exit = 0;\n while (!exit && render_priv->state.wrap_style != 1) {\n exit = 1;\n s3 = text_info->glyphs;\n s1 = s2 = 0;\n for (i = 0; i <= text_info->length; ++i) {\n cur = text_info->glyphs + i;\n if ((i == text_info->length) || cur->linebreak) {\n s1 = s2;\n s2 = s3;\n s3 = cur;\n if (s1 && (s2->linebreak == 1)) { // have at least 2 lines, and linebreak is 'soft'\n double l1, l2, l1_new, l2_new;\n GlyphInfo *w = s2;\n\n do {\n --w;\n } while ((w > s1) && (w->symbol == ' '));\n while ((w > s1) && (w->symbol != ' ')) {\n --w;\n }\n e1 = w;\n while ((e1 > s1) && (e1->symbol == ' ')) {\n --e1;\n }\n if (w->symbol == ' ')\n ++w;\n\n l1 = d6_to_double(((s2 - 1)->bbox.xMax + (s2 - 1)->pos.x) -\n (s1->bbox.xMin + s1->pos.x));\n l2 = d6_to_double(((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) -\n (s2->bbox.xMin + s2->pos.x));\n l1_new = d6_to_double(\n (e1->bbox.xMax + e1->pos.x) -\n (s1->bbox.xMin + s1->pos.x));\n l2_new = d6_to_double(\n ((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) -\n (w->bbox.xMin + w->pos.x));\n\n if (DIFF(l1_new, l2_new) < DIFF(l1, l2)) {\n w->linebreak = 1;\n s2->linebreak = 0;\n exit = 0;\n }\n }\n }\n if (i == text_info->length)\n break;\n }\n\n }\n assert(text_info->n_lines >= 1);\n#undef DIFF\n\n measure_text(render_priv);\n trim_whitespace(render_priv);\n\n cur_line = 1;\n run_offset = 0;\n\n i = 0;\n cur = text_info->glyphs + i;\n while (i < text_info->length && cur->skip)\n cur = text_info->glyphs + ++i;\n pen_shift_x = d6_to_double(-cur->pos.x);\n pen_shift_y = 0.;\n\n for (i = 0; i < text_info->length; ++i) {\n cur = text_info->glyphs + i;\n if (cur->linebreak) {\n while (i < text_info->length && cur->skip && cur->symbol != '\\n')\n cur = text_info->glyphs + ++i;\n double height =\n text_info->lines[cur_line - 1].desc +\n text_info->lines[cur_line].asc;\n text_info->lines[cur_line - 1].len = i -\n text_info->lines[cur_line - 1].offset;\n text_info->lines[cur_line].offset = i;\n cur_line++;\n run_offset++;\n pen_shift_x = d6_to_double(-cur->pos.x);\n pen_shift_y += height + render_priv->settings.line_spacing;\n }\n cur->pos.x += double_to_d6(pen_shift_x);\n cur->pos.y += double_to_d6(pen_shift_y);\n }\n text_info->lines[cur_line - 1].len =\n text_info->length - text_info->lines[cur_line - 1].offset;\n\n#if 0\n // print line info\n for (i = 0; i < text_info->n_lines; i++) {\n printf(\"line %d offset %d length %d\\n\", i, text_info->lines[i].offset,\n text_info->lines[i].len);\n }\n#endif\n}","target":"wrap_lines_smart(ASS_Renderer *render_priv, double max_text_width)\n{\n int i;\n GlyphInfo *cur, *s1, *e1, *s2, *s3;\n int last_space;\n int break_type;\n int exit;\n double pen_shift_x;\n double pen_shift_y;\n int cur_line;\n int run_offset;\n TextInfo *text_info = &render_priv->text_info;\n\n last_space = -1;\n text_info->n_lines = 1;\n break_type = 0;\n s1 = text_info->glyphs; // current line start\n for (i = 0; i < text_info->length; ++i) {\n int break_at = -1;\n double s_offset, len;\n cur = text_info->glyphs + i;\n s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x);\n len = d6_to_double(cur->bbox.xMax + cur->pos.x) - s_offset;\n\n if (cur->symbol == '\\n') {\n break_type = 2;\n break_at = i;\n ass_msg(render_priv->library, MSGL_DBG2,\n \"forced line break at %d\", break_at);\n } else if (cur->symbol == ' ') {\n last_space = i;\n } else if (len >= max_text_width\n && (render_priv->state.wrap_style != 2)) {\n break_type = 1;\n break_at = last_space;\n if (break_at >= 0)\n ass_msg(render_priv->library, MSGL_DBG2, \"line break at %d\",\n break_at);\n }\n\n if (break_at != -1) {\n // need to use one more line\n // marking break_at+1 as start of a new line\n int lead = break_at + 1; // the first symbol of the new line\n if (text_info->n_lines >= text_info->max_lines) {\n // Raise maximum number of lines\n text_info->max_lines *= 2;\n text_info->lines = realloc(text_info->lines,\n sizeof(LineInfo) *\n text_info->max_lines);\n }\n if (lead < text_info->length) {\n text_info->glyphs[lead].linebreak = break_type;\n last_space = -1;\n s1 = text_info->glyphs + lead;\n text_info->n_lines++;\n }\n }\n }\n#define DIFF(x,y) (((x) < (y)) ? (y - x) : (x - y))\n exit = 0;\n while (!exit && render_priv->state.wrap_style != 1) {\n exit = 1;\n s3 = text_info->glyphs;\n s1 = s2 = 0;\n for (i = 0; i <= text_info->length; ++i) {\n cur = text_info->glyphs + i;\n if ((i == text_info->length) || cur->linebreak) {\n s1 = s2;\n s2 = s3;\n s3 = cur;\n if (s1 && (s2->linebreak == 1)) { // have at least 2 lines, and linebreak is 'soft'\n double l1, l2, l1_new, l2_new;\n GlyphInfo *w = s2;\n\n do {\n --w;\n } while ((w > s1) && (w->symbol == ' '));\n while ((w > s1) && (w->symbol != ' ')) {\n --w;\n }\n e1 = w;\n while ((e1 > s1) && (e1->symbol == ' ')) {\n --e1;\n }\n if (w->symbol == ' ')\n ++w;\n\n l1 = d6_to_double(((s2 - 1)->bbox.xMax + (s2 - 1)->pos.x) -\n (s1->bbox.xMin + s1->pos.x));\n l2 = d6_to_double(((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) -\n (s2->bbox.xMin + s2->pos.x));\n l1_new = d6_to_double(\n (e1->bbox.xMax + e1->pos.x) -\n (s1->bbox.xMin + s1->pos.x));\n l2_new = d6_to_double(\n ((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) -\n (w->bbox.xMin + w->pos.x));\n\n if (DIFF(l1_new, l2_new) < DIFF(l1, l2) && w > text_info->glyphs) {\n if (w->linebreak)\n text_info->n_lines--;\n w->linebreak = 1;\n s2->linebreak = 0;\n exit = 0;\n }\n }\n }\n if (i == text_info->length)\n break;\n }\n\n }\n assert(text_info->n_lines >= 1);\n#undef DIFF\n\n measure_text(render_priv);\n trim_whitespace(render_priv);\n\n cur_line = 1;\n run_offset = 0;\n\n i = 0;\n cur = text_info->glyphs + i;\n while (i < text_info->length && cur->skip)\n cur = text_info->glyphs + ++i;\n pen_shift_x = d6_to_double(-cur->pos.x);\n pen_shift_y = 0.;\n\n for (i = 0; i < text_info->length; ++i) {\n cur = text_info->glyphs + i;\n if (cur->linebreak) {\n while (i < text_info->length && cur->skip && cur->symbol != '\\n')\n cur = text_info->glyphs + ++i;\n double height =\n text_info->lines[cur_line - 1].desc +\n text_info->lines[cur_line].asc;\n text_info->lines[cur_line - 1].len = i -\n text_info->lines[cur_line - 1].offset;\n text_info->lines[cur_line].offset = i;\n cur_line++;\n run_offset++;\n pen_shift_x = d6_to_double(-cur->pos.x);\n pen_shift_y += height + render_priv->settings.line_spacing;\n }\n cur->pos.x += double_to_d6(pen_shift_x);\n cur->pos.y += double_to_d6(pen_shift_y);\n }\n text_info->lines[cur_line - 1].len =\n text_info->length - text_info->lines[cur_line - 1].offset;\n\n#if 0\n // print line info\n for (i = 0; i < text_info->n_lines; i++) {\n printf(\"line %d offset %d length %d\\n\", i, text_info->lines[i].offset,\n text_info->lines[i].len);\n }\n#endif\n}","lang":"c","vul_type":"cwe-125","target_token_count":1510,"sven_meta":{"func_name":"wrap_lines_smart","file_name":"libass/ass_render.c","commit_link":"github.com/libass/libass/commit/b72b283b936a600c730e00875d7d067bded3fc26","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#41-3d91dc2ab192","input":"repodata_schema2id(Repodata *data, Id *schema, int create)\n{\n int h, len, i;\n Id *sp, cid;\n Id *schematahash;\n\n if (!*schema)\n return 0;\t/* XXX: allow empty schema? */\n if ((schematahash = data->schematahash) == 0)\n {\n data->schematahash = schematahash = solv_calloc(256, sizeof(Id));\n for (i = 1; i < data->nschemata; i++)\n\t{\n\t for (sp = data->schemadata + data->schemata[i], h = 0; *sp;)\n\t h = h * 7 + *sp++;\n\t h &= 255;\n\t schematahash[h] = i;\n\t}\n data->schemadata = solv_extend_resize(data->schemadata, data->schemadatalen, sizeof(Id), SCHEMATADATA_BLOCK);\n data->schemata = solv_extend_resize(data->schemata, data->nschemata, sizeof(Id), SCHEMATA_BLOCK);\n }\n\n for (sp = schema, len = 0, h = 0; *sp; len++)\n h = h * 7 + *sp++;\n h &= 255;\n len++;\n\n cid = schematahash[h];\n if (cid)\n {\n if (!memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))\n return cid;\n /* cache conflict, do a slow search */\n for (cid = 1; cid < data->nschemata; cid++)\n if (!memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))\n return cid;\n }\n /* a new one */\n if (!create)\n return 0;\n data->schemadata = solv_extend(data->schemadata, data->schemadatalen, len, sizeof(Id), SCHEMATADATA_BLOCK);\n data->schemata = solv_extend(data->schemata, data->nschemata, 1, sizeof(Id), SCHEMATA_BLOCK);\n /* add schema */\n memcpy(data->schemadata + data->schemadatalen, schema, len * sizeof(Id));\n data->schemata[data->nschemata] = data->schemadatalen;\n data->schemadatalen += len;\n schematahash[h] = data->nschemata;\n#if 0\nfprintf(stderr, \"schema2id: new schema\\n\");\n#endif\n return data->nschemata++;\n}","target":"repodata_schema2id(Repodata *data, Id *schema, int create)\n{\n int h, len, i;\n Id *sp, cid;\n Id *schematahash;\n\n if (!*schema)\n return 0;\t/* XXX: allow empty schema? */\n if ((schematahash = data->schematahash) == 0)\n {\n data->schematahash = schematahash = solv_calloc(256, sizeof(Id));\n for (i = 1; i < data->nschemata; i++)\n\t{\n\t for (sp = data->schemadata + data->schemata[i], h = 0; *sp;)\n\t h = h * 7 + *sp++;\n\t h &= 255;\n\t schematahash[h] = i;\n\t}\n data->schemadata = solv_extend_resize(data->schemadata, data->schemadatalen, sizeof(Id), SCHEMATADATA_BLOCK);\n data->schemata = solv_extend_resize(data->schemata, data->nschemata, sizeof(Id), SCHEMATA_BLOCK);\n }\n\n for (sp = schema, len = 0, h = 0; *sp; len++)\n h = h * 7 + *sp++;\n h &= 255;\n len++;\n\n cid = schematahash[h];\n if (cid)\n {\n if ((data->schemata[cid] + len <= data->schemadatalen) &&\n\t\t\t !memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))\n return cid;\n /* cache conflict, do a slow search */\n for (cid = 1; cid < data->nschemata; cid++)\n if ((data->schemata[cid] + len <= data->schemadatalen) &&\n\t\t\t\t!memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))\n return cid;\n }\n /* a new one */\n if (!create)\n return 0;\n data->schemadata = solv_extend(data->schemadata, data->schemadatalen, len, sizeof(Id), SCHEMATADATA_BLOCK);\n data->schemata = solv_extend(data->schemata, data->nschemata, 1, sizeof(Id), SCHEMATA_BLOCK);\n /* add schema */\n memcpy(data->schemadata + data->schemadatalen, schema, len * sizeof(Id));\n data->schemata[data->nschemata] = data->schemadatalen;\n data->schemadatalen += len;\n schematahash[h] = data->nschemata;\n#if 0\nfprintf(stderr, \"schema2id: new schema\\n\");\n#endif\n return data->nschemata++;\n}","lang":"c","vul_type":"cwe-125","target_token_count":629,"sven_meta":{"func_name":"repodata_schema2id","file_name":"src/repodata.c","commit_link":"github.com/openSUSE/libsolv/commit/fdb9c9c03508990e4583046b590c30d958f272da","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#42-d4b0a41b099a","input":"MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,\n ExceptionInfo *exception)\n{\n#define ComplexImageTag \"Complex/Image\"\n\n CacheView\n *Ai_view,\n *Ar_view,\n *Bi_view,\n *Br_view,\n *Ci_view,\n *Cr_view;\n\n const char\n *artifact;\n\n const Image\n *Ai_image,\n *Ar_image,\n *Bi_image,\n *Br_image;\n\n double\n snr;\n\n Image\n *Ci_image,\n *complex_images,\n *Cr_image,\n *image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n ssize_t\n y;\n\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n if (images->next == (Image *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),ImageError,\n \"ImageSequenceRequired\",\"`%s'\",images->filename);\n return((Image *) NULL);\n }\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)\n {\n image=DestroyImageList(image);\n return(image);\n }\n image->depth=32UL;\n complex_images=NewImageList();\n AppendImageToList(&complex_images,image);\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n {\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n }\n AppendImageToList(&complex_images,image);\n /*\n Apply complex mathematics to image pixels.\n */\n artifact=GetImageArtifact(image,\"complex:snr\");\n snr=0.0;\n if (artifact != (const char *) NULL)\n snr=StringToDouble(artifact,(char **) NULL);\n Ar_image=images;\n Ai_image=images->next;\n Br_image=images;\n Bi_image=images->next;\n if ((images->next->next != (Image *) NULL) &&\n (images->next->next->next != (Image *) NULL))\n {\n Br_image=images->next->next;\n Bi_image=images->next->next->next;\n }\n Cr_image=complex_images;\n Ci_image=complex_images->next;\n Ar_view=AcquireVirtualCacheView(Ar_image,exception);\n Ai_view=AcquireVirtualCacheView(Ai_image,exception);\n Br_view=AcquireVirtualCacheView(Br_image,exception);\n Bi_view=AcquireVirtualCacheView(Bi_image,exception);\n Cr_view=AcquireAuthenticCacheView(Cr_image,exception);\n Ci_view=AcquireAuthenticCacheView(Ci_image,exception);\n status=MagickTrue;\n progress=0;\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(Cr_image,complex_images,Cr_image->rows,1L)\n#endif\n for (y=0; y < (ssize_t) Cr_image->rows; y++)\n {\n register const Quantum\n *magick_restrict Ai,\n *magick_restrict Ar,\n *magick_restrict Bi,\n *magick_restrict Br;\n\n register Quantum\n *magick_restrict Ci,\n *magick_restrict Cr;\n\n register ssize_t\n x;\n\n if (status == MagickFalse)\n continue;\n Ar=GetCacheViewVirtualPixels(Ar_view,0,y,Cr_image->columns,1,exception);\n Ai=GetCacheViewVirtualPixels(Ai_view,0,y,Cr_image->columns,1,exception);\n Br=GetCacheViewVirtualPixels(Br_view,0,y,Cr_image->columns,1,exception);\n Bi=GetCacheViewVirtualPixels(Bi_view,0,y,Cr_image->columns,1,exception);\n Cr=QueueCacheViewAuthenticPixels(Cr_view,0,y,Cr_image->columns,1,exception);\n Ci=QueueCacheViewAuthenticPixels(Ci_view,0,y,Ci_image->columns,1,exception);\n if ((Ar == (const Quantum *) NULL) || (Ai == (const Quantum *) NULL) || \n (Br == (const Quantum *) NULL) || (Bi == (const Quantum *) NULL) ||\n (Cr == (Quantum *) NULL) || (Ci == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < (ssize_t) Cr_image->columns; x++)\n {\n register ssize_t\n i;\n\n for (i=0; i < (ssize_t) GetPixelChannels(Cr_image); i++)\n {\n switch (op)\n {\n case AddComplexOperator:\n {\n Cr[i]=Ar[i]+Br[i];\n Ci[i]=Ai[i]+Bi[i];\n break;\n }\n case ConjugateComplexOperator:\n default:\n {\n Cr[i]=Ar[i];\n Ci[i]=(-Bi[i]);\n break;\n }\n case DivideComplexOperator:\n {\n double\n gamma;\n\n gamma=PerceptibleReciprocal((double) Br[i]*Br[i]+Bi[i]*Bi[i]+snr);\n Cr[i]=gamma*((double) Ar[i]*Br[i]+(double) Ai[i]*Bi[i]);\n Ci[i]=gamma*((double) Ai[i]*Br[i]-(double) Ar[i]*Bi[i]);\n break;\n }\n case MagnitudePhaseComplexOperator:\n {\n Cr[i]=sqrt((double) Ar[i]*Ar[i]+(double) Ai[i]*Ai[i]);\n Ci[i]=atan2((double) Ai[i],(double) Ar[i])/(2.0*MagickPI)+0.5;\n break;\n }\n case MultiplyComplexOperator:\n {\n Cr[i]=QuantumScale*((double) Ar[i]*Br[i]-(double) Ai[i]*Bi[i]);\n Ci[i]=QuantumScale*((double) Ai[i]*Br[i]+(double) Ar[i]*Bi[i]);\n break;\n }\n case RealImaginaryComplexOperator:\n {\n Cr[i]=Ar[i]*cos(2.0*MagickPI*(Ai[i]-0.5));\n Ci[i]=Ar[i]*sin(2.0*MagickPI*(Ai[i]-0.5));\n break;\n }\n case SubtractComplexOperator:\n {\n Cr[i]=Ar[i]-Br[i];\n Ci[i]=Ai[i]-Bi[i];\n break;\n }\n }\n }\n Ar+=GetPixelChannels(Ar_image);\n Ai+=GetPixelChannels(Ai_image);\n Br+=GetPixelChannels(Br_image);\n Bi+=GetPixelChannels(Bi_image);\n Cr+=GetPixelChannels(Cr_image);\n Ci+=GetPixelChannels(Ci_image);\n }\n if (SyncCacheViewAuthenticPixels(Ci_view,exception) == MagickFalse)\n status=MagickFalse;\n if (SyncCacheViewAuthenticPixels(Cr_view,exception) == MagickFalse)\n status=MagickFalse;\n if (images->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(images,ComplexImageTag,progress,images->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n Cr_view=DestroyCacheView(Cr_view);\n Ci_view=DestroyCacheView(Ci_view);\n Br_view=DestroyCacheView(Br_view);\n Bi_view=DestroyCacheView(Bi_view);\n Ar_view=DestroyCacheView(Ar_view);\n Ai_view=DestroyCacheView(Ai_view);\n if (status == MagickFalse)\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n}","target":"MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,\n ExceptionInfo *exception)\n{\n#define ComplexImageTag \"Complex/Image\"\n\n CacheView\n *Ai_view,\n *Ar_view,\n *Bi_view,\n *Br_view,\n *Ci_view,\n *Cr_view;\n\n const char\n *artifact;\n\n const Image\n *Ai_image,\n *Ar_image,\n *Bi_image,\n *Br_image;\n\n double\n snr;\n\n Image\n *Ci_image,\n *complex_images,\n *Cr_image,\n *image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n size_t\n number_channels;\n\n ssize_t\n y;\n\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n if (images->next == (Image *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),ImageError,\n \"ImageSequenceRequired\",\"`%s'\",images->filename);\n return((Image *) NULL);\n }\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)\n {\n image=DestroyImageList(image);\n return(image);\n }\n image->depth=32UL;\n complex_images=NewImageList();\n AppendImageToList(&complex_images,image);\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n {\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n }\n AppendImageToList(&complex_images,image);\n /*\n Apply complex mathematics to image pixels.\n */\n artifact=GetImageArtifact(image,\"complex:snr\");\n snr=0.0;\n if (artifact != (const char *) NULL)\n snr=StringToDouble(artifact,(char **) NULL);\n Ar_image=images;\n Ai_image=images->next;\n Br_image=images;\n Bi_image=images->next;\n if ((images->next->next != (Image *) NULL) &&\n (images->next->next->next != (Image *) NULL))\n {\n Br_image=images->next->next;\n Bi_image=images->next->next->next;\n }\n Cr_image=complex_images;\n Ci_image=complex_images->next;\n number_channels=MagickMin(MagickMin(MagickMin(\n Ar_image->number_channels,Ai_image->number_channels),MagickMin(\n Br_image->number_channels,Bi_image->number_channels)),MagickMin(\n Cr_image->number_channels,Ci_image->number_channels));\n Ar_view=AcquireVirtualCacheView(Ar_image,exception);\n Ai_view=AcquireVirtualCacheView(Ai_image,exception);\n Br_view=AcquireVirtualCacheView(Br_image,exception);\n Bi_view=AcquireVirtualCacheView(Bi_image,exception);\n Cr_view=AcquireAuthenticCacheView(Cr_image,exception);\n Ci_view=AcquireAuthenticCacheView(Ci_image,exception);\n status=MagickTrue;\n progress=0;\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(Cr_image,complex_images,Cr_image->rows,1L)\n#endif\n for (y=0; y < (ssize_t) Cr_image->rows; y++)\n {\n register const Quantum\n *magick_restrict Ai,\n *magick_restrict Ar,\n *magick_restrict Bi,\n *magick_restrict Br;\n\n register Quantum\n *magick_restrict Ci,\n *magick_restrict Cr;\n\n register ssize_t\n x;\n\n if (status == MagickFalse)\n continue;\n Ar=GetCacheViewVirtualPixels(Ar_view,0,y,Cr_image->columns,1,exception);\n Ai=GetCacheViewVirtualPixels(Ai_view,0,y,Cr_image->columns,1,exception);\n Br=GetCacheViewVirtualPixels(Br_view,0,y,Cr_image->columns,1,exception);\n Bi=GetCacheViewVirtualPixels(Bi_view,0,y,Cr_image->columns,1,exception);\n Cr=QueueCacheViewAuthenticPixels(Cr_view,0,y,Cr_image->columns,1,exception);\n Ci=QueueCacheViewAuthenticPixels(Ci_view,0,y,Ci_image->columns,1,exception);\n if ((Ar == (const Quantum *) NULL) || (Ai == (const Quantum *) NULL) || \n (Br == (const Quantum *) NULL) || (Bi == (const Quantum *) NULL) ||\n (Cr == (Quantum *) NULL) || (Ci == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < (ssize_t) Cr_image->columns; x++)\n {\n register ssize_t\n i;\n\n for (i=0; i < (ssize_t) number_channels; i++)\n {\n switch (op)\n {\n case AddComplexOperator:\n {\n Cr[i]=Ar[i]+Br[i];\n Ci[i]=Ai[i]+Bi[i];\n break;\n }\n case ConjugateComplexOperator:\n default:\n {\n Cr[i]=Ar[i];\n Ci[i]=(-Bi[i]);\n break;\n }\n case DivideComplexOperator:\n {\n double\n gamma;\n\n gamma=PerceptibleReciprocal((double) Br[i]*Br[i]+Bi[i]*Bi[i]+snr);\n Cr[i]=gamma*((double) Ar[i]*Br[i]+(double) Ai[i]*Bi[i]);\n Ci[i]=gamma*((double) Ai[i]*Br[i]-(double) Ar[i]*Bi[i]);\n break;\n }\n case MagnitudePhaseComplexOperator:\n {\n Cr[i]=sqrt((double) Ar[i]*Ar[i]+(double) Ai[i]*Ai[i]);\n Ci[i]=atan2((double) Ai[i],(double) Ar[i])/(2.0*MagickPI)+0.5;\n break;\n }\n case MultiplyComplexOperator:\n {\n Cr[i]=QuantumScale*((double) Ar[i]*Br[i]-(double) Ai[i]*Bi[i]);\n Ci[i]=QuantumScale*((double) Ai[i]*Br[i]+(double) Ar[i]*Bi[i]);\n break;\n }\n case RealImaginaryComplexOperator:\n {\n Cr[i]=Ar[i]*cos(2.0*MagickPI*(Ai[i]-0.5));\n Ci[i]=Ar[i]*sin(2.0*MagickPI*(Ai[i]-0.5));\n break;\n }\n case SubtractComplexOperator:\n {\n Cr[i]=Ar[i]-Br[i];\n Ci[i]=Ai[i]-Bi[i];\n break;\n }\n }\n }\n Ar+=GetPixelChannels(Ar_image);\n Ai+=GetPixelChannels(Ai_image);\n Br+=GetPixelChannels(Br_image);\n Bi+=GetPixelChannels(Bi_image);\n Cr+=GetPixelChannels(Cr_image);\n Ci+=GetPixelChannels(Ci_image);\n }\n if (SyncCacheViewAuthenticPixels(Ci_view,exception) == MagickFalse)\n status=MagickFalse;\n if (SyncCacheViewAuthenticPixels(Cr_view,exception) == MagickFalse)\n status=MagickFalse;\n if (images->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(images,ComplexImageTag,progress,images->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n Cr_view=DestroyCacheView(Cr_view);\n Ci_view=DestroyCacheView(Ci_view);\n Br_view=DestroyCacheView(Br_view);\n Bi_view=DestroyCacheView(Bi_view);\n Ar_view=DestroyCacheView(Ar_view);\n Ai_view=DestroyCacheView(Ai_view);\n if (status == MagickFalse)\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n}","lang":"c","vul_type":"cwe-125","target_token_count":1863,"sven_meta":{"func_name":"ComplexImages","file_name":"MagickCore/fourier.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/d5089971bd792311aaab5cb73460326d7ef7f32d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#43-305e4645fb0b","input":"static void ttm_put_pages(struct page **pages, unsigned npages, int flags,\n\t\t\t enum ttm_caching_state cstate)\n{\n\tstruct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate);\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\tstruct ttm_page_pool *huge = ttm_get_pool(flags, true, cstate);\n#endif\n\tunsigned long irq_flags;\n\tunsigned i;\n\n\tif (pool == NULL) {\n\t\t/* No pool for this memory type so free the pages */\n\t\ti = 0;\n\t\twhile (i < npages) {\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\t\t\tstruct page *p = pages[i];\n#endif\n\t\t\tunsigned order = 0, j;\n\n\t\t\tif (!pages[i]) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\t\t\tif (!(flags & TTM_PAGE_FLAG_DMA32) &&\n\t\t\t (npages - i) >= HPAGE_PMD_NR) {\n\t\t\t\tfor (j = 1; j < HPAGE_PMD_NR; ++j)\n\t\t\t\t\tif (p++ != pages[i + j])\n\t\t\t\t\t break;\n\n\t\t\t\tif (j == HPAGE_PMD_NR)\n\t\t\t\t\torder = HPAGE_PMD_ORDER;\n\t\t\t}\n#endif\n\n\t\t\tif (page_count(pages[i]) != 1)\n\t\t\t\tpr_err(\"Erroneous page count. Leaking pages.\\n\");\n\t\t\t__free_pages(pages[i], order);\n\n\t\t\tj = 1 << order;\n\t\t\twhile (j) {\n\t\t\t\tpages[i++] = NULL;\n\t\t\t\t--j;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\ti = 0;\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\tif (huge) {\n\t\tunsigned max_size, n2free;\n\n\t\tspin_lock_irqsave(&huge->lock, irq_flags);\n\t\twhile ((npages - i) >= HPAGE_PMD_NR) {\n\t\t\tstruct page *p = pages[i];\n\t\t\tunsigned j;\n\n\t\t\tif (!p)\n\t\t\t\tbreak;\n\n\t\t\tfor (j = 1; j < HPAGE_PMD_NR; ++j)\n\t\t\t\tif (p++ != pages[i + j])\n\t\t\t\t break;\n\n\t\t\tif (j != HPAGE_PMD_NR)\n\t\t\t\tbreak;\n\n\t\t\tlist_add_tail(&pages[i]->lru, &huge->list);\n\n\t\t\tfor (j = 0; j < HPAGE_PMD_NR; ++j)\n\t\t\t\tpages[i++] = NULL;\n\t\t\thuge->npages++;\n\t\t}\n\n\t\t/* Check that we don't go over the pool limit */\n\t\tmax_size = _manager->options.max_size;\n\t\tmax_size /= HPAGE_PMD_NR;\n\t\tif (huge->npages > max_size)\n\t\t\tn2free = huge->npages - max_size;\n\t\telse\n\t\t\tn2free = 0;\n\t\tspin_unlock_irqrestore(&huge->lock, irq_flags);\n\t\tif (n2free)\n\t\t\tttm_page_pool_free(huge, n2free, false);\n\t}\n#endif\n\n\tspin_lock_irqsave(&pool->lock, irq_flags);\n\twhile (i < npages) {\n\t\tif (pages[i]) {\n\t\t\tif (page_count(pages[i]) != 1)\n\t\t\t\tpr_err(\"Erroneous page count. Leaking pages.\\n\");\n\t\t\tlist_add_tail(&pages[i]->lru, &pool->list);\n\t\t\tpages[i] = NULL;\n\t\t\tpool->npages++;\n\t\t}\n\t\t++i;\n\t}\n\t/* Check that we don't go over the pool limit */\n\tnpages = 0;\n\tif (pool->npages > _manager->options.max_size) {\n\t\tnpages = pool->npages - _manager->options.max_size;\n\t\t/* free at least NUM_PAGES_TO_ALLOC number of pages\n\t\t * to reduce calls to set_memory_wb */\n\t\tif (npages < NUM_PAGES_TO_ALLOC)\n\t\t\tnpages = NUM_PAGES_TO_ALLOC;\n\t}\n\tspin_unlock_irqrestore(&pool->lock, irq_flags);\n\tif (npages)\n\t\tttm_page_pool_free(pool, npages, false);\n}","target":"static void ttm_put_pages(struct page **pages, unsigned npages, int flags,\n\t\t\t enum ttm_caching_state cstate)\n{\n\tstruct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate);\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\tstruct ttm_page_pool *huge = ttm_get_pool(flags, true, cstate);\n#endif\n\tunsigned long irq_flags;\n\tunsigned i;\n\n\tif (pool == NULL) {\n\t\t/* No pool for this memory type so free the pages */\n\t\ti = 0;\n\t\twhile (i < npages) {\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\t\t\tstruct page *p = pages[i];\n#endif\n\t\t\tunsigned order = 0, j;\n\n\t\t\tif (!pages[i]) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\t\t\tif (!(flags & TTM_PAGE_FLAG_DMA32) &&\n\t\t\t (npages - i) >= HPAGE_PMD_NR) {\n\t\t\t\tfor (j = 1; j < HPAGE_PMD_NR; ++j)\n\t\t\t\t\tif (++p != pages[i + j])\n\t\t\t\t\t break;\n\n\t\t\t\tif (j == HPAGE_PMD_NR)\n\t\t\t\t\torder = HPAGE_PMD_ORDER;\n\t\t\t}\n#endif\n\n\t\t\tif (page_count(pages[i]) != 1)\n\t\t\t\tpr_err(\"Erroneous page count. Leaking pages.\\n\");\n\t\t\t__free_pages(pages[i], order);\n\n\t\t\tj = 1 << order;\n\t\t\twhile (j) {\n\t\t\t\tpages[i++] = NULL;\n\t\t\t\t--j;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\ti = 0;\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\tif (huge) {\n\t\tunsigned max_size, n2free;\n\n\t\tspin_lock_irqsave(&huge->lock, irq_flags);\n\t\twhile ((npages - i) >= HPAGE_PMD_NR) {\n\t\t\tstruct page *p = pages[i];\n\t\t\tunsigned j;\n\n\t\t\tif (!p)\n\t\t\t\tbreak;\n\n\t\t\tfor (j = 1; j < HPAGE_PMD_NR; ++j)\n\t\t\t\tif (++p != pages[i + j])\n\t\t\t\t break;\n\n\t\t\tif (j != HPAGE_PMD_NR)\n\t\t\t\tbreak;\n\n\t\t\tlist_add_tail(&pages[i]->lru, &huge->list);\n\n\t\t\tfor (j = 0; j < HPAGE_PMD_NR; ++j)\n\t\t\t\tpages[i++] = NULL;\n\t\t\thuge->npages++;\n\t\t}\n\n\t\t/* Check that we don't go over the pool limit */\n\t\tmax_size = _manager->options.max_size;\n\t\tmax_size /= HPAGE_PMD_NR;\n\t\tif (huge->npages > max_size)\n\t\t\tn2free = huge->npages - max_size;\n\t\telse\n\t\t\tn2free = 0;\n\t\tspin_unlock_irqrestore(&huge->lock, irq_flags);\n\t\tif (n2free)\n\t\t\tttm_page_pool_free(huge, n2free, false);\n\t}\n#endif\n\n\tspin_lock_irqsave(&pool->lock, irq_flags);\n\twhile (i < npages) {\n\t\tif (pages[i]) {\n\t\t\tif (page_count(pages[i]) != 1)\n\t\t\t\tpr_err(\"Erroneous page count. Leaking pages.\\n\");\n\t\t\tlist_add_tail(&pages[i]->lru, &pool->list);\n\t\t\tpages[i] = NULL;\n\t\t\tpool->npages++;\n\t\t}\n\t\t++i;\n\t}\n\t/* Check that we don't go over the pool limit */\n\tnpages = 0;\n\tif (pool->npages > _manager->options.max_size) {\n\t\tnpages = pool->npages - _manager->options.max_size;\n\t\t/* free at least NUM_PAGES_TO_ALLOC number of pages\n\t\t * to reduce calls to set_memory_wb */\n\t\tif (npages < NUM_PAGES_TO_ALLOC)\n\t\t\tnpages = NUM_PAGES_TO_ALLOC;\n\t}\n\tspin_unlock_irqrestore(&pool->lock, irq_flags);\n\tif (npages)\n\t\tttm_page_pool_free(pool, npages, false);\n}","lang":"c","vul_type":"cwe-125","target_token_count":852,"sven_meta":{"func_name":"ttm_put_pages","file_name":"drivers/gpu/drm/ttm/ttm_page_alloc.c","commit_link":"github.com/torvalds/linux/commit/453393369dc9806d2455151e329c599684762428","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#46-44a508229156","input":" void Compute(OpKernelContext* ctx) override {\n const Tensor& input = ctx->input(0);\n const int depth = (axis_ == -1) ? 1 : input.dim_size(axis_);\n Tensor input_min_tensor;\n Tensor input_max_tensor;\n Tensor* output = nullptr;\n OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &output));\n if (range_given_) {\n input_min_tensor = ctx->input(1);\n input_max_tensor = ctx->input(2);\n if (axis_ == -1) {\n auto min_val = input_min_tensor.scalar()();\n auto max_val = input_max_tensor.scalar()();\n OP_REQUIRES(ctx, min_val <= max_val,\n errors::InvalidArgument(\"Invalid range: input_min \",\n min_val, \" > input_max \", max_val));\n } else {\n OP_REQUIRES(ctx, input_min_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\n \"input_min_tensor has incorrect size, was \",\n input_min_tensor.dim_size(0), \" expected \", depth,\n \" to match dim \", axis_, \" of the input \",\n input_min_tensor.shape()));\n OP_REQUIRES(ctx, input_max_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\n \"input_max_tensor has incorrect size, was \",\n input_max_tensor.dim_size(0), \" expected \", depth,\n \" to match dim \", axis_, \" of the input \",\n input_max_tensor.shape()));\n }\n } else {\n auto range_shape = (axis_ == -1) ? TensorShape({}) : TensorShape({depth});\n OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::value,\n range_shape, &input_min_tensor));\n OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::value,\n range_shape, &input_max_tensor));\n }\n\n if (axis_ == -1) {\n functor::QuantizeAndDequantizeOneScaleFunctor f;\n f(ctx->eigen_device(), input.flat(), signed_input_, num_bits_,\n range_given_, &input_min_tensor, &input_max_tensor, round_mode_,\n narrow_range_, output->flat());\n } else {\n functor::QuantizeAndDequantizePerChannelFunctor f;\n f(ctx->eigen_device(),\n input.template flat_inner_outer_dims(axis_ - 1), signed_input_,\n num_bits_, range_given_, &input_min_tensor, &input_max_tensor,\n round_mode_, narrow_range_,\n output->template flat_inner_outer_dims(axis_ - 1));\n }\n }","target":" void Compute(OpKernelContext* ctx) override {\n const Tensor& input = ctx->input(0);\n OP_REQUIRES(\n ctx, (axis_ == -1 || axis_ < input.shape().dims()),\n errors::InvalidArgument(\"Shape must be at least rank \", axis_ + 1,\n \" but is rank \", input.shape().dims()));\n const int depth = (axis_ == -1) ? 1 : input.dim_size(axis_);\n Tensor input_min_tensor;\n Tensor input_max_tensor;\n Tensor* output = nullptr;\n OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &output));\n if (range_given_) {\n input_min_tensor = ctx->input(1);\n input_max_tensor = ctx->input(2);\n if (axis_ == -1) {\n auto min_val = input_min_tensor.scalar()();\n auto max_val = input_max_tensor.scalar()();\n OP_REQUIRES(ctx, min_val <= max_val,\n errors::InvalidArgument(\"Invalid range: input_min \",\n min_val, \" > input_max \", max_val));\n } else {\n OP_REQUIRES(ctx, input_min_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\n \"input_min_tensor has incorrect size, was \",\n input_min_tensor.dim_size(0), \" expected \", depth,\n \" to match dim \", axis_, \" of the input \",\n input_min_tensor.shape()));\n OP_REQUIRES(ctx, input_max_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\n \"input_max_tensor has incorrect size, was \",\n input_max_tensor.dim_size(0), \" expected \", depth,\n \" to match dim \", axis_, \" of the input \",\n input_max_tensor.shape()));\n }\n } else {\n auto range_shape = (axis_ == -1) ? TensorShape({}) : TensorShape({depth});\n OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::value,\n range_shape, &input_min_tensor));\n OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::value,\n range_shape, &input_max_tensor));\n }\n\n if (axis_ == -1) {\n functor::QuantizeAndDequantizeOneScaleFunctor f;\n f(ctx->eigen_device(), input.flat(), signed_input_, num_bits_,\n range_given_, &input_min_tensor, &input_max_tensor, round_mode_,\n narrow_range_, output->flat());\n } else {\n functor::QuantizeAndDequantizePerChannelFunctor f;\n f(ctx->eigen_device(),\n input.template flat_inner_outer_dims(axis_ - 1), signed_input_,\n num_bits_, range_given_, &input_min_tensor, &input_max_tensor,\n round_mode_, narrow_range_,\n output->template flat_inner_outer_dims(axis_ - 1));\n }\n }","lang":"cpp","vul_type":"cwe-125","target_token_count":636,"sven_meta":{"func_name":"tensorflow::QuantizeAndDequantizeV2Op::Compute","file_name":"tensorflow/core/kernels/quantize_and_dequantize_op.cc","commit_link":"github.com/tensorflow/tensorflow/commit/eccb7ec454e6617738554a255d77f08e60ee0808","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#47-5cc0b58d4934","input":"_bson_iter_next_internal (bson_iter_t *iter, /* INOUT */\n uint32_t next_keylen, /* IN */\n const char **key, /* OUT */\n uint32_t *bson_type, /* OUT */\n bool *unsupported) /* OUT */\n{\n const uint8_t *data;\n uint32_t o;\n unsigned int len;\n\n BSON_ASSERT (iter);\n\n *unsupported = false;\n\n if (!iter->raw) {\n *key = NULL;\n *bson_type = BSON_TYPE_EOD;\n return false;\n }\n\n data = iter->raw;\n len = iter->len;\n\n iter->off = iter->next_off;\n iter->type = iter->off;\n iter->key = iter->off + 1;\n iter->d1 = 0;\n iter->d2 = 0;\n iter->d3 = 0;\n iter->d4 = 0;\n\n if (next_keylen == 0) {\n /* iterate from start to end of NULL-terminated key string */\n for (o = iter->key; o < len; o++) {\n if (!data[o]) {\n iter->d1 = ++o;\n goto fill_data_fields;\n }\n }\n } else {\n o = iter->key + next_keylen + 1;\n iter->d1 = o;\n goto fill_data_fields;\n }\n\n goto mark_invalid;\n\nfill_data_fields:\n\n *key = bson_iter_key_unsafe (iter);\n *bson_type = ITER_TYPE (iter);\n\n switch (*bson_type) {\n case BSON_TYPE_DATE_TIME:\n case BSON_TYPE_DOUBLE:\n case BSON_TYPE_INT64:\n case BSON_TYPE_TIMESTAMP:\n iter->next_off = o + 8;\n break;\n case BSON_TYPE_CODE:\n case BSON_TYPE_SYMBOL:\n case BSON_TYPE_UTF8: {\n uint32_t l;\n\n if ((o + 4) >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l > (len - (o + 4))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + 4 + l;\n\n /*\n * Make sure the string length includes the NUL byte.\n */\n if (BSON_UNLIKELY ((l == 0) || (iter->next_off >= len))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /*\n * Make sure the last byte is a NUL byte.\n */\n if (BSON_UNLIKELY ((iter->raw + iter->d2)[l - 1] != '\\0')) {\n iter->err_off = o + 4 + l - 1;\n goto mark_invalid;\n }\n } break;\n case BSON_TYPE_BINARY: {\n bson_subtype_t subtype;\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n iter->d3 = o + 5;\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l >= (len - o)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n subtype = *(iter->raw + iter->d2);\n\n if (subtype == BSON_SUBTYPE_BINARY_DEPRECATED) {\n int32_t binary_len;\n\n if (l < 4) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /* subtype 2 has a redundant length header in the data */\n memcpy (&binary_len, (iter->raw + iter->d3), sizeof (binary_len));\n binary_len = BSON_UINT32_FROM_LE (binary_len);\n if (binary_len + 4 != l) {\n iter->err_off = iter->d3;\n goto mark_invalid;\n }\n }\n\n iter->next_off = o + 5 + l;\n } break;\n case BSON_TYPE_ARRAY:\n case BSON_TYPE_DOCUMENT: {\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if ((l > len) || (l > (len - o))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + l;\n } break;\n case BSON_TYPE_OID:\n iter->next_off = o + 12;\n break;\n case BSON_TYPE_BOOL: {\n char val;\n\n if (iter->d1 >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&val, iter->raw + iter->d1, 1);\n if (val != 0x00 && val != 0x01) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + 1;\n } break;\n case BSON_TYPE_REGEX: {\n bool eor = false;\n bool eoo = false;\n\n for (; o < len; o++) {\n if (!data[o]) {\n iter->d2 = ++o;\n eor = true;\n break;\n }\n }\n\n if (!eor) {\n iter->err_off = iter->next_off;\n goto mark_invalid;\n }\n\n for (; o < len; o++) {\n if (!data[o]) {\n eoo = true;\n break;\n }\n }\n\n if (!eoo) {\n iter->err_off = iter->next_off;\n goto mark_invalid;\n }\n\n iter->next_off = o + 1;\n } break;\n case BSON_TYPE_DBPOINTER: {\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n /* Check valid string length. l counts '\\0' but not 4 bytes for itself. */\n if (l == 0 || l > (len - o - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n if (*(iter->raw + o + l + 3)) {\n /* not null terminated */\n iter->err_off = o + l + 3;\n goto mark_invalid;\n }\n\n iter->d3 = o + 4 + l;\n iter->next_off = o + 4 + l + 12;\n } break;\n case BSON_TYPE_CODEWSCOPE: {\n uint32_t l;\n uint32_t doclen;\n\n if ((len < 19) || (o >= (len - 14))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n iter->d3 = o + 8;\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if ((l < 14) || (l >= (len - o))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + l;\n\n if (iter->next_off >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&l, iter->raw + iter->d2, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l == 0 || l >= (len - o - 4 - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n if ((o + 4 + 4 + l + 4) >= iter->next_off) {\n iter->err_off = o + 4;\n goto mark_invalid;\n }\n\n iter->d4 = o + 4 + 4 + l;\n memcpy (&doclen, iter->raw + iter->d4, sizeof (doclen));\n doclen = BSON_UINT32_FROM_LE (doclen);\n\n if ((o + 4 + 4 + l + doclen) != iter->next_off) {\n iter->err_off = o + 4 + 4 + l;\n goto mark_invalid;\n }\n } break;\n case BSON_TYPE_INT32:\n iter->next_off = o + 4;\n break;\n case BSON_TYPE_DECIMAL128:\n iter->next_off = o + 16;\n break;\n case BSON_TYPE_MAXKEY:\n case BSON_TYPE_MINKEY:\n case BSON_TYPE_NULL:\n case BSON_TYPE_UNDEFINED:\n iter->next_off = o;\n break;\n default:\n *unsupported = true;\n /* FALL THROUGH */\n case BSON_TYPE_EOD:\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /*\n * Check to see if any of the field locations would overflow the\n * current BSON buffer. If so, set the error location to the offset\n * of where the field starts.\n */\n if (iter->next_off >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->err_off = 0;\n\n return true;\n\nmark_invalid:\n iter->raw = NULL;\n iter->len = 0;\n iter->next_off = 0;\n\n return false;\n}","target":"_bson_iter_next_internal (bson_iter_t *iter, /* INOUT */\n uint32_t next_keylen, /* IN */\n const char **key, /* OUT */\n uint32_t *bson_type, /* OUT */\n bool *unsupported) /* OUT */\n{\n const uint8_t *data;\n uint32_t o;\n unsigned int len;\n\n BSON_ASSERT (iter);\n\n *unsupported = false;\n\n if (!iter->raw) {\n *key = NULL;\n *bson_type = BSON_TYPE_EOD;\n return false;\n }\n\n data = iter->raw;\n len = iter->len;\n\n iter->off = iter->next_off;\n iter->type = iter->off;\n iter->key = iter->off + 1;\n iter->d1 = 0;\n iter->d2 = 0;\n iter->d3 = 0;\n iter->d4 = 0;\n\n if (next_keylen == 0) {\n /* iterate from start to end of NULL-terminated key string */\n for (o = iter->key; o < len; o++) {\n if (!data[o]) {\n iter->d1 = ++o;\n goto fill_data_fields;\n }\n }\n } else {\n o = iter->key + next_keylen + 1;\n iter->d1 = o;\n goto fill_data_fields;\n }\n\n goto mark_invalid;\n\nfill_data_fields:\n\n *key = bson_iter_key_unsafe (iter);\n *bson_type = ITER_TYPE (iter);\n\n switch (*bson_type) {\n case BSON_TYPE_DATE_TIME:\n case BSON_TYPE_DOUBLE:\n case BSON_TYPE_INT64:\n case BSON_TYPE_TIMESTAMP:\n iter->next_off = o + 8;\n break;\n case BSON_TYPE_CODE:\n case BSON_TYPE_SYMBOL:\n case BSON_TYPE_UTF8: {\n uint32_t l;\n\n if ((o + 4) >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l > (len - (o + 4))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + 4 + l;\n\n /*\n * Make sure the string length includes the NUL byte.\n */\n if (BSON_UNLIKELY ((l == 0) || (iter->next_off >= len))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /*\n * Make sure the last byte is a NUL byte.\n */\n if (BSON_UNLIKELY ((iter->raw + iter->d2)[l - 1] != '\\0')) {\n iter->err_off = o + 4 + l - 1;\n goto mark_invalid;\n }\n } break;\n case BSON_TYPE_BINARY: {\n bson_subtype_t subtype;\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n iter->d3 = o + 5;\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l >= (len - o - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n subtype = *(iter->raw + iter->d2);\n\n if (subtype == BSON_SUBTYPE_BINARY_DEPRECATED) {\n int32_t binary_len;\n\n if (l < 4) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /* subtype 2 has a redundant length header in the data */\n memcpy (&binary_len, (iter->raw + iter->d3), sizeof (binary_len));\n binary_len = BSON_UINT32_FROM_LE (binary_len);\n if (binary_len + 4 != l) {\n iter->err_off = iter->d3;\n goto mark_invalid;\n }\n }\n\n iter->next_off = o + 5 + l;\n } break;\n case BSON_TYPE_ARRAY:\n case BSON_TYPE_DOCUMENT: {\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if ((l > len) || (l > (len - o))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + l;\n } break;\n case BSON_TYPE_OID:\n iter->next_off = o + 12;\n break;\n case BSON_TYPE_BOOL: {\n char val;\n\n if (iter->d1 >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&val, iter->raw + iter->d1, 1);\n if (val != 0x00 && val != 0x01) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + 1;\n } break;\n case BSON_TYPE_REGEX: {\n bool eor = false;\n bool eoo = false;\n\n for (; o < len; o++) {\n if (!data[o]) {\n iter->d2 = ++o;\n eor = true;\n break;\n }\n }\n\n if (!eor) {\n iter->err_off = iter->next_off;\n goto mark_invalid;\n }\n\n for (; o < len; o++) {\n if (!data[o]) {\n eoo = true;\n break;\n }\n }\n\n if (!eoo) {\n iter->err_off = iter->next_off;\n goto mark_invalid;\n }\n\n iter->next_off = o + 1;\n } break;\n case BSON_TYPE_DBPOINTER: {\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n /* Check valid string length. l counts '\\0' but not 4 bytes for itself. */\n if (l == 0 || l > (len - o - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n if (*(iter->raw + o + l + 3)) {\n /* not null terminated */\n iter->err_off = o + l + 3;\n goto mark_invalid;\n }\n\n iter->d3 = o + 4 + l;\n iter->next_off = o + 4 + l + 12;\n } break;\n case BSON_TYPE_CODEWSCOPE: {\n uint32_t l;\n uint32_t doclen;\n\n if ((len < 19) || (o >= (len - 14))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n iter->d3 = o + 8;\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if ((l < 14) || (l >= (len - o))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + l;\n\n if (iter->next_off >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&l, iter->raw + iter->d2, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l == 0 || l >= (len - o - 4 - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n if ((o + 4 + 4 + l + 4) >= iter->next_off) {\n iter->err_off = o + 4;\n goto mark_invalid;\n }\n\n iter->d4 = o + 4 + 4 + l;\n memcpy (&doclen, iter->raw + iter->d4, sizeof (doclen));\n doclen = BSON_UINT32_FROM_LE (doclen);\n\n if ((o + 4 + 4 + l + doclen) != iter->next_off) {\n iter->err_off = o + 4 + 4 + l;\n goto mark_invalid;\n }\n } break;\n case BSON_TYPE_INT32:\n iter->next_off = o + 4;\n break;\n case BSON_TYPE_DECIMAL128:\n iter->next_off = o + 16;\n break;\n case BSON_TYPE_MAXKEY:\n case BSON_TYPE_MINKEY:\n case BSON_TYPE_NULL:\n case BSON_TYPE_UNDEFINED:\n iter->next_off = o;\n break;\n default:\n *unsupported = true;\n /* FALL THROUGH */\n case BSON_TYPE_EOD:\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /*\n * Check to see if any of the field locations would overflow the\n * current BSON buffer. If so, set the error location to the offset\n * of where the field starts.\n */\n if (iter->next_off >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->err_off = 0;\n\n return true;\n\nmark_invalid:\n iter->raw = NULL;\n iter->len = 0;\n iter->next_off = 0;\n\n return false;\n}","lang":"c","vul_type":"cwe-125","target_token_count":2174,"sven_meta":{"func_name":"_bson_iter_next_internal","file_name":"src/libbson/src/bson/bson-iter.c","commit_link":"github.com/mongodb/mongo-c-driver/commit/0d9a4d98bfdf4acd2c0138d4aaeb4e2e0934bd84","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#50-2ff077fe431d","input":"BYTE *DecompressRTF(variableLength *p, int *size) {\n BYTE *dst; // destination for uncompressed bytes\n BYTE *src;\n unsigned int in;\n unsigned int out;\n variableLength comp_Prebuf;\n ULONG compressedSize, uncompressedSize, magic;\n\n comp_Prebuf.size = strlen(RTF_PREBUF);\n comp_Prebuf.data = calloc(comp_Prebuf.size+1, 1);\n ALLOCCHECK_CHAR(comp_Prebuf.data);\n memcpy(comp_Prebuf.data, RTF_PREBUF, comp_Prebuf.size);\n\n src = p->data;\n in = 0;\n\n if (p->size < 20) {\n printf(\"File too small\\n\");\n return(NULL);\n }\n compressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n uncompressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n magic = SwapDWord((BYTE*)src + in, 4);\n in += 4;\n in += 4;\n\n // check size excluding the size field itself\n if (compressedSize != p->size - 4) {\n printf(\" Size Mismatch: %u != %i\\n\", compressedSize, p->size - 4);\n free(comp_Prebuf.data);\n return NULL;\n }\n\n // process the data\n if (magic == 0x414c454d) {\n // magic number that identifies the stream as a uncompressed stream\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + 4, uncompressedSize);\n } else if (magic == 0x75465a4c) {\n // magic number that identifies the stream as a compressed stream\n int flagCount = 0;\n int flags = 0;\n // Prevent overflow on 32 Bit Systems\n if (comp_Prebuf.size >= INT_MAX - uncompressedSize) {\n printf(\"Corrupted file\\n\");\n exit(-1);\n }\n dst = calloc(comp_Prebuf.size + uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);\n out = comp_Prebuf.size;\n while (out < (comp_Prebuf.size + uncompressedSize)) {\n // each flag byte flags 8 literals/references, 1 per bit\n flags = (flagCount++ % 8 == 0) ? src[in++] : flags >> 1;\n if ((flags & 1) == 1) { // each flag bit is 1 for reference, 0 for literal\n unsigned int offset = src[in++];\n unsigned int length = src[in++];\n unsigned int end;\n offset = (offset << 4) | (length >> 4); // the offset relative to block start\n length = (length & 0xF) + 2; // the number of bytes to copy\n // the decompression buffer is supposed to wrap around back\n // to the beginning when the end is reached. we save the\n // need for such a buffer by pointing straight into the data\n // buffer, and simulating this behaviour by modifying the\n // pointers appropriately.\n offset = (out / 4096) * 4096 + offset;\n if (offset >= out) // take from previous block\n offset -= 4096;\n // note: can't use System.arraycopy, because the referenced\n // bytes can cross through the current out position.\n end = offset + length;\n while ((offset < end) && (out < (comp_Prebuf.size + uncompressedSize))\n && (offset < (comp_Prebuf.size + uncompressedSize)))\n dst[out++] = dst[offset++];\n } else { // literal\n if ((out >= (comp_Prebuf.size + uncompressedSize)) ||\n (in >= p->size)) {\n printf(\"Corrupted stream\\n\");\n exit(-1);\n }\n dst[out++] = src[in++];\n }\n }\n // copy it back without the prebuffered data\n src = dst;\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + comp_Prebuf.size, uncompressedSize);\n free(src);\n *size = uncompressedSize;\n free(comp_Prebuf.data);\n return dst;\n } else { // unknown magic number\n printf(\"Unknown compression type (magic number %x)\\n\", magic);\n }\n free(comp_Prebuf.data);\n return NULL;\n}","target":"BYTE *DecompressRTF(variableLength *p, int *size) {\n BYTE *dst; // destination for uncompressed bytes\n BYTE *src;\n unsigned int in;\n unsigned int out;\n variableLength comp_Prebuf;\n ULONG compressedSize, uncompressedSize, magic;\n\n comp_Prebuf.size = strlen(RTF_PREBUF);\n comp_Prebuf.data = calloc(comp_Prebuf.size+1, 1);\n ALLOCCHECK_CHAR(comp_Prebuf.data);\n memcpy(comp_Prebuf.data, RTF_PREBUF, comp_Prebuf.size);\n\n src = p->data;\n in = 0;\n\n if (p->size < 20) {\n printf(\"File too small\\n\");\n return(NULL);\n }\n compressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n uncompressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n magic = SwapDWord((BYTE*)src + in, 4);\n in += 4;\n in += 4;\n\n // check size excluding the size field itself\n if (compressedSize != p->size - 4) {\n printf(\" Size Mismatch: %u != %i\\n\", compressedSize, p->size - 4);\n free(comp_Prebuf.data);\n return NULL;\n }\n\n // process the data\n if (magic == 0x414c454d) {\n // magic number that identifies the stream as a uncompressed stream\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + 4, uncompressedSize);\n } else if (magic == 0x75465a4c) {\n // magic number that identifies the stream as a compressed stream\n int flagCount = 0;\n int flags = 0;\n // Prevent overflow on 32 Bit Systems\n if (comp_Prebuf.size >= INT_MAX - uncompressedSize) {\n printf(\"Corrupted file\\n\");\n exit(-1);\n }\n dst = calloc(comp_Prebuf.size + uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);\n out = comp_Prebuf.size;\n while ((out < (comp_Prebuf.size + uncompressedSize)) && (in < p->size)) {\n // each flag byte flags 8 literals/references, 1 per bit\n flags = (flagCount++ % 8 == 0) ? src[in++] : flags >> 1;\n if ((flags & 1) == 1) { // each flag bit is 1 for reference, 0 for literal\n unsigned int offset = src[in++];\n unsigned int length = src[in++];\n unsigned int end;\n offset = (offset << 4) | (length >> 4); // the offset relative to block start\n length = (length & 0xF) + 2; // the number of bytes to copy\n // the decompression buffer is supposed to wrap around back\n // to the beginning when the end is reached. we save the\n // need for such a buffer by pointing straight into the data\n // buffer, and simulating this behaviour by modifying the\n // pointers appropriately.\n offset = (out / 4096) * 4096 + offset;\n if (offset >= out) // take from previous block\n offset -= 4096;\n // note: can't use System.arraycopy, because the referenced\n // bytes can cross through the current out position.\n end = offset + length;\n while ((offset < end) && (out < (comp_Prebuf.size + uncompressedSize))\n && (offset < (comp_Prebuf.size + uncompressedSize)))\n dst[out++] = dst[offset++];\n } else { // literal\n if ((out >= (comp_Prebuf.size + uncompressedSize)) ||\n (in >= p->size)) {\n printf(\"Corrupted stream\\n\");\n exit(-1);\n }\n dst[out++] = src[in++];\n }\n }\n // copy it back without the prebuffered data\n src = dst;\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + comp_Prebuf.size, uncompressedSize);\n free(src);\n *size = uncompressedSize;\n free(comp_Prebuf.data);\n return dst;\n } else { // unknown magic number\n printf(\"Unknown compression type (magic number %x)\\n\", magic);\n }\n free(comp_Prebuf.data);\n return NULL;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1004,"sven_meta":{"func_name":"DecompressRTF","file_name":"lib/ytnef.c","commit_link":"github.com/Yeraze/ytnef/commit/22f8346c8d4f0020a40d9f258fdb3bfc097359cc","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#51-57b3002d9123","input":"static Image *ReadSGIImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image\n *image;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n MemoryInfo\n *pixel_info;\n\n register Quantum\n *q;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *p;\n\n SGIInfo\n iris_info;\n\n size_t\n bytes_per_pixel,\n quantum;\n\n ssize_t\n count,\n y,\n z;\n\n unsigned char\n *pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read SGI raster header.\n */\n iris_info.magic=ReadBlobMSBShort(image);\n do\n {\n /*\n Verify SGI identifier.\n */\n if (iris_info.magic != 0x01DA)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.storage=(unsigned char) ReadBlobByte(image);\n switch (iris_info.storage)\n {\n case 0x00: image->compression=NoCompression; break;\n case 0x01: image->compression=RLECompression; break;\n default:\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n iris_info.bytes_per_pixel=(unsigned char) ReadBlobByte(image);\n if ((iris_info.bytes_per_pixel == 0) || (iris_info.bytes_per_pixel > 2))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.dimension=ReadBlobMSBShort(image);\n iris_info.columns=ReadBlobMSBShort(image);\n iris_info.rows=ReadBlobMSBShort(image);\n iris_info.depth=ReadBlobMSBShort(image);\n if ((iris_info.depth == 0) || (iris_info.depth > 4))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.minimum_value=ReadBlobMSBLong(image);\n iris_info.maximum_value=ReadBlobMSBLong(image);\n iris_info.sans=ReadBlobMSBLong(image);\n (void) ReadBlob(image,sizeof(iris_info.name),(unsigned char *)\n iris_info.name);\n iris_info.name[sizeof(iris_info.name)-1]='\\0';\n if (*iris_info.name != '\\0')\n (void) SetImageProperty(image,\"label\",iris_info.name,exception);\n iris_info.pixel_format=ReadBlobMSBLong(image);\n if (iris_info.pixel_format != 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n count=ReadBlob(image,sizeof(iris_info.filler),iris_info.filler);\n (void) count;\n image->columns=iris_info.columns;\n image->rows=iris_info.rows;\n image->depth=(size_t) MagickMin(iris_info.depth,MAGICKCORE_QUANTUM_DEPTH);\n if (iris_info.pixel_format == 0)\n image->depth=(size_t) MagickMin((size_t) 8*\n iris_info.bytes_per_pixel,MAGICKCORE_QUANTUM_DEPTH);\n if (iris_info.depth < 3)\n {\n image->storage_class=PseudoClass;\n image->colors=iris_info.bytes_per_pixel > 1 ? 65535 : 256;\n }\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Allocate SGI pixels.\n */\n bytes_per_pixel=(size_t) iris_info.bytes_per_pixel;\n number_pixels=(MagickSizeType) iris_info.columns*iris_info.rows;\n if ((4*bytes_per_pixel*number_pixels) != ((MagickSizeType) (size_t)\n (4*bytes_per_pixel*number_pixels)))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixel_info=AcquireVirtualMemory(iris_info.columns,iris_info.rows*4*\n bytes_per_pixel*sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n if ((int) iris_info.storage != 0x01)\n {\n unsigned char\n *scanline;\n\n /*\n Read standard image format.\n */\n scanline=(unsigned char *) AcquireQuantumMemory(iris_info.columns,\n bytes_per_pixel*sizeof(*scanline));\n if (scanline == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n p=pixels+bytes_per_pixel*z;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n count=ReadBlob(image,bytes_per_pixel*iris_info.columns,scanline);\n if (EOFBlob(image) != MagickFalse)\n break;\n if (bytes_per_pixel == 2)\n for (x=0; x < (ssize_t) iris_info.columns; x++)\n {\n *p=scanline[2*x];\n *(p+1)=scanline[2*x+1];\n p+=8;\n }\n else\n for (x=0; x < (ssize_t) iris_info.columns; x++)\n {\n *p=scanline[x];\n p+=4;\n }\n }\n }\n scanline=(unsigned char *) RelinquishMagickMemory(scanline);\n }\n else\n {\n MemoryInfo\n *packet_info;\n\n size_t\n *runlength;\n\n ssize_t\n offset,\n *offsets;\n\n unsigned char\n *packets;\n\n unsigned int\n data_order;\n\n /*\n Read runlength-encoded image format.\n */\n offsets=(ssize_t *) AcquireQuantumMemory((size_t) iris_info.rows,\n iris_info.depth*sizeof(*offsets));\n runlength=(size_t *) AcquireQuantumMemory(iris_info.rows,\n iris_info.depth*sizeof(*runlength));\n packet_info=AcquireVirtualMemory((size_t) iris_info.columns+10UL,4UL*\n sizeof(*packets));\n if ((offsets == (ssize_t *) NULL) ||\n (runlength == (size_t *) NULL) ||\n (packet_info == (MemoryInfo *) NULL))\n {\n if (offsets == (ssize_t *) NULL)\n offsets=(ssize_t *) RelinquishMagickMemory(offsets);\n if (runlength == (size_t *) NULL)\n runlength=(size_t *) RelinquishMagickMemory(runlength);\n if (packet_info == (MemoryInfo *) NULL)\n packet_info=RelinquishVirtualMemory(packet_info);\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n packets=(unsigned char *) GetVirtualMemoryBlob(packet_info);\n for (i=0; i < (ssize_t) (iris_info.rows*iris_info.depth); i++)\n offsets[i]=ReadBlobMSBSignedLong(image);\n for (i=0; i < (ssize_t) (iris_info.rows*iris_info.depth); i++)\n {\n runlength[i]=ReadBlobMSBLong(image);\n if (runlength[i] > (4*(size_t) iris_info.columns+10))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Check data order.\n */\n offset=0;\n data_order=0;\n for (y=0; ((y < (ssize_t) iris_info.rows) && (data_order == 0)); y++)\n for (z=0; ((z < (ssize_t) iris_info.depth) && (data_order == 0)); z++)\n {\n if (offsets[y+z*iris_info.rows] < offset)\n data_order=1;\n offset=offsets[y+z*iris_info.rows];\n }\n offset=(ssize_t) TellBlob(image);\n if (data_order == 1)\n {\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n p=pixels;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n if (offset != offsets[y+z*iris_info.rows])\n {\n offset=offsets[y+z*iris_info.rows];\n offset=(ssize_t) SeekBlob(image,(ssize_t) offset,SEEK_SET);\n }\n count=ReadBlob(image,(size_t) runlength[y+z*iris_info.rows],\n packets);\n if (EOFBlob(image) != MagickFalse)\n break;\n offset+=(ssize_t) runlength[y+z*iris_info.rows];\n status=SGIDecode(bytes_per_pixel,(ssize_t)\n (runlength[y+z*iris_info.rows]/bytes_per_pixel),packets,\n 1L*iris_info.columns,p+bytes_per_pixel*z);\n if (status == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n p+=(iris_info.columns*4*bytes_per_pixel);\n }\n }\n }\n else\n {\n MagickOffsetType\n position;\n \n position=TellBlob(image);\n p=pixels;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n if (offset != offsets[y+z*iris_info.rows])\n {\n offset=offsets[y+z*iris_info.rows];\n offset=(ssize_t) SeekBlob(image,(ssize_t) offset,SEEK_SET);\n }\n count=ReadBlob(image,(size_t) runlength[y+z*iris_info.rows],\n packets);\n if (EOFBlob(image) != MagickFalse)\n break;\n offset+=(ssize_t) runlength[y+z*iris_info.rows];\n status=SGIDecode(bytes_per_pixel,(ssize_t)\n (runlength[y+z*iris_info.rows]/bytes_per_pixel),packets,\n 1L*iris_info.columns,p+bytes_per_pixel*z);\n if (status == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n p+=(iris_info.columns*4*bytes_per_pixel);\n }\n offset=(ssize_t) SeekBlob(image,position,SEEK_SET);\n }\n packet_info=RelinquishVirtualMemory(packet_info);\n runlength=(size_t *) RelinquishMagickMemory(runlength);\n offsets=(ssize_t *) RelinquishMagickMemory(offsets);\n }\n /*\n Initialize image structure.\n */\n image->alpha_trait=iris_info.depth == 4 ? BlendPixelTrait : \n UndefinedPixelTrait;\n image->columns=iris_info.columns;\n image->rows=iris_info.rows;\n /*\n Convert SGI raster image to pixel packets.\n */\n if (image->storage_class == DirectClass)\n {\n /*\n Convert SGI image to DirectClass pixel packets.\n */\n if (bytes_per_pixel == 2)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*8*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleShortToQuantum((unsigned short)\n ((*(p+0) << 8) | (*(p+1)))),q);\n SetPixelGreen(image,ScaleShortToQuantum((unsigned short)\n ((*(p+2) << 8) | (*(p+3)))),q);\n SetPixelBlue(image,ScaleShortToQuantum((unsigned short)\n ((*(p+4) << 8) | (*(p+5)))),q);\n SetPixelAlpha(image,OpaqueAlpha,q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleShortToQuantum((unsigned short)\n ((*(p+6) << 8) | (*(p+7)))),q);\n p+=8;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*4*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleCharToQuantum(*p),q);\n SetPixelGreen(image,ScaleCharToQuantum(*(p+1)),q);\n SetPixelBlue(image,ScaleCharToQuantum(*(p+2)),q);\n SetPixelAlpha(image,OpaqueAlpha,q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*(p+3)),q);\n p+=4;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n /*\n Create grayscale map.\n */\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n /*\n Convert SGI image to PseudoClass pixel packets.\n */\n if (bytes_per_pixel == 2)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*8*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n quantum=(*p << 8);\n quantum|=(*(p+1));\n SetPixelIndex(image,(Quantum) quantum,q);\n p+=8;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*4*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p,q);\n p+=4;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n (void) SyncImage(image,exception);\n }\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n iris_info.magic=ReadBlobMSBShort(image);\n if (iris_info.magic == 0x01DA)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while (iris_info.magic == 0x01DA);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadSGIImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image\n *image;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n MemoryInfo\n *pixel_info;\n\n register Quantum\n *q;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *p;\n\n SGIInfo\n iris_info;\n\n size_t\n bytes_per_pixel,\n quantum;\n\n ssize_t\n count,\n y,\n z;\n\n unsigned char\n *pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read SGI raster header.\n */\n iris_info.magic=ReadBlobMSBShort(image);\n do\n {\n /*\n Verify SGI identifier.\n */\n if (iris_info.magic != 0x01DA)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.storage=(unsigned char) ReadBlobByte(image);\n switch (iris_info.storage)\n {\n case 0x00: image->compression=NoCompression; break;\n case 0x01: image->compression=RLECompression; break;\n default:\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n iris_info.bytes_per_pixel=(unsigned char) ReadBlobByte(image);\n if ((iris_info.bytes_per_pixel == 0) || (iris_info.bytes_per_pixel > 2))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.dimension=ReadBlobMSBShort(image);\n iris_info.columns=ReadBlobMSBShort(image);\n iris_info.rows=ReadBlobMSBShort(image);\n iris_info.depth=ReadBlobMSBShort(image);\n if ((iris_info.depth == 0) || (iris_info.depth > 4))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.minimum_value=ReadBlobMSBLong(image);\n iris_info.maximum_value=ReadBlobMSBLong(image);\n iris_info.sans=ReadBlobMSBLong(image);\n (void) ReadBlob(image,sizeof(iris_info.name),(unsigned char *)\n iris_info.name);\n iris_info.name[sizeof(iris_info.name)-1]='\\0';\n if (*iris_info.name != '\\0')\n (void) SetImageProperty(image,\"label\",iris_info.name,exception);\n iris_info.pixel_format=ReadBlobMSBLong(image);\n if (iris_info.pixel_format != 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n count=ReadBlob(image,sizeof(iris_info.filler),iris_info.filler);\n (void) count;\n image->columns=iris_info.columns;\n image->rows=iris_info.rows;\n image->depth=(size_t) MagickMin(iris_info.depth,MAGICKCORE_QUANTUM_DEPTH);\n if (iris_info.pixel_format == 0)\n image->depth=(size_t) MagickMin((size_t) 8*iris_info.bytes_per_pixel,\n MAGICKCORE_QUANTUM_DEPTH);\n if (iris_info.depth < 3)\n {\n image->storage_class=PseudoClass;\n image->colors=iris_info.bytes_per_pixel > 1 ? 65535 : 256;\n }\n if (EOFBlob(image) != MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Allocate SGI pixels.\n */\n bytes_per_pixel=(size_t) iris_info.bytes_per_pixel;\n number_pixels=(MagickSizeType) iris_info.columns*iris_info.rows;\n if ((4*bytes_per_pixel*number_pixels) != ((MagickSizeType) (size_t)\n (4*bytes_per_pixel*number_pixels)))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixel_info=AcquireVirtualMemory(iris_info.columns,iris_info.rows*4*\n bytes_per_pixel*sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n if ((int) iris_info.storage != 0x01)\n {\n unsigned char\n *scanline;\n\n /*\n Read standard image format.\n */\n scanline=(unsigned char *) AcquireQuantumMemory(iris_info.columns,\n bytes_per_pixel*sizeof(*scanline));\n if (scanline == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n p=pixels+bytes_per_pixel*z;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n count=ReadBlob(image,bytes_per_pixel*iris_info.columns,scanline);\n if (EOFBlob(image) != MagickFalse)\n break;\n if (bytes_per_pixel == 2)\n for (x=0; x < (ssize_t) iris_info.columns; x++)\n {\n *p=scanline[2*x];\n *(p+1)=scanline[2*x+1];\n p+=8;\n }\n else\n for (x=0; x < (ssize_t) iris_info.columns; x++)\n {\n *p=scanline[x];\n p+=4;\n }\n }\n }\n scanline=(unsigned char *) RelinquishMagickMemory(scanline);\n }\n else\n {\n MemoryInfo\n *packet_info;\n\n size_t\n *runlength;\n\n ssize_t\n offset,\n *offsets;\n\n unsigned char\n *packets;\n\n unsigned int\n data_order;\n\n /*\n Read runlength-encoded image format.\n */\n offsets=(ssize_t *) AcquireQuantumMemory((size_t) iris_info.rows,\n iris_info.depth*sizeof(*offsets));\n runlength=(size_t *) AcquireQuantumMemory(iris_info.rows,\n iris_info.depth*sizeof(*runlength));\n packet_info=AcquireVirtualMemory((size_t) iris_info.columns+10UL,4UL*\n sizeof(*packets));\n if ((offsets == (ssize_t *) NULL) ||\n (runlength == (size_t *) NULL) ||\n (packet_info == (MemoryInfo *) NULL))\n {\n if (offsets == (ssize_t *) NULL)\n offsets=(ssize_t *) RelinquishMagickMemory(offsets);\n if (runlength == (size_t *) NULL)\n runlength=(size_t *) RelinquishMagickMemory(runlength);\n if (packet_info == (MemoryInfo *) NULL)\n packet_info=RelinquishVirtualMemory(packet_info);\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n packets=(unsigned char *) GetVirtualMemoryBlob(packet_info);\n for (i=0; i < (ssize_t) (iris_info.rows*iris_info.depth); i++)\n offsets[i]=ReadBlobMSBSignedLong(image);\n for (i=0; i < (ssize_t) (iris_info.rows*iris_info.depth); i++)\n {\n runlength[i]=ReadBlobMSBLong(image);\n if (runlength[i] > (4*(size_t) iris_info.columns+10))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Check data order.\n */\n offset=0;\n data_order=0;\n for (y=0; ((y < (ssize_t) iris_info.rows) && (data_order == 0)); y++)\n for (z=0; ((z < (ssize_t) iris_info.depth) && (data_order == 0)); z++)\n {\n if (offsets[y+z*iris_info.rows] < offset)\n data_order=1;\n offset=offsets[y+z*iris_info.rows];\n }\n offset=(ssize_t) TellBlob(image);\n if (data_order == 1)\n {\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n p=pixels;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n if (offset != offsets[y+z*iris_info.rows])\n {\n offset=offsets[y+z*iris_info.rows];\n offset=(ssize_t) SeekBlob(image,(ssize_t) offset,SEEK_SET);\n }\n count=ReadBlob(image,(size_t) runlength[y+z*iris_info.rows],\n packets);\n if (EOFBlob(image) != MagickFalse)\n break;\n offset+=(ssize_t) runlength[y+z*iris_info.rows];\n status=SGIDecode(bytes_per_pixel,(ssize_t)\n (runlength[y+z*iris_info.rows]/bytes_per_pixel),packets,\n 1L*iris_info.columns,p+bytes_per_pixel*z);\n if (status == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n p+=(iris_info.columns*4*bytes_per_pixel);\n }\n }\n }\n else\n {\n MagickOffsetType\n position;\n \n position=TellBlob(image);\n p=pixels;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n if (offset != offsets[y+z*iris_info.rows])\n {\n offset=offsets[y+z*iris_info.rows];\n offset=(ssize_t) SeekBlob(image,(ssize_t) offset,SEEK_SET);\n }\n count=ReadBlob(image,(size_t) runlength[y+z*iris_info.rows],\n packets);\n if (EOFBlob(image) != MagickFalse)\n break;\n offset+=(ssize_t) runlength[y+z*iris_info.rows];\n status=SGIDecode(bytes_per_pixel,(ssize_t)\n (runlength[y+z*iris_info.rows]/bytes_per_pixel),packets,\n 1L*iris_info.columns,p+bytes_per_pixel*z);\n if (status == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n p+=(iris_info.columns*4*bytes_per_pixel);\n }\n offset=(ssize_t) SeekBlob(image,position,SEEK_SET);\n }\n packet_info=RelinquishVirtualMemory(packet_info);\n runlength=(size_t *) RelinquishMagickMemory(runlength);\n offsets=(ssize_t *) RelinquishMagickMemory(offsets);\n }\n /*\n Initialize image structure.\n */\n image->alpha_trait=iris_info.depth == 4 ? BlendPixelTrait : \n UndefinedPixelTrait;\n image->columns=iris_info.columns;\n image->rows=iris_info.rows;\n /*\n Convert SGI raster image to pixel packets.\n */\n if (image->storage_class == DirectClass)\n {\n /*\n Convert SGI image to DirectClass pixel packets.\n */\n if (bytes_per_pixel == 2)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*8*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleShortToQuantum((unsigned short)\n ((*(p+0) << 8) | (*(p+1)))),q);\n SetPixelGreen(image,ScaleShortToQuantum((unsigned short)\n ((*(p+2) << 8) | (*(p+3)))),q);\n SetPixelBlue(image,ScaleShortToQuantum((unsigned short)\n ((*(p+4) << 8) | (*(p+5)))),q);\n SetPixelAlpha(image,OpaqueAlpha,q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleShortToQuantum((unsigned short)\n ((*(p+6) << 8) | (*(p+7)))),q);\n p+=8;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*4*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleCharToQuantum(*p),q);\n SetPixelGreen(image,ScaleCharToQuantum(*(p+1)),q);\n SetPixelBlue(image,ScaleCharToQuantum(*(p+2)),q);\n SetPixelAlpha(image,OpaqueAlpha,q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*(p+3)),q);\n p+=4;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n /*\n Create grayscale map.\n */\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n /*\n Convert SGI image to PseudoClass pixel packets.\n */\n if (bytes_per_pixel == 2)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*8*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n quantum=(*p << 8);\n quantum|=(*(p+1));\n SetPixelIndex(image,(Quantum) quantum,q);\n p+=8;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*4*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p,q);\n p+=4;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n (void) SyncImage(image,exception);\n }\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n iris_info.magic=ReadBlobMSBShort(image);\n if (iris_info.magic == 0x01DA)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while (iris_info.magic == 0x01DA);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-125","target_token_count":3949,"sven_meta":{"func_name":"ReadSGIImage","file_name":"coders/sgi.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/7afcf9f71043df15508e46f079387bd4689a738d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#52-65ecc4d3daee","input":"static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,\n const uint8_t *buf, int buf_size,\n int first_field)\n{\n int i, cid, ret;\n int old_bit_depth = ctx->bit_depth, bitdepth;\n uint64_t header_prefix;\n if (buf_size < 0x280) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"buffer too small (%d < 640).\\n\", buf_size);\n return AVERROR_INVALIDDATA;\n }\n\n header_prefix = ff_dnxhd_parse_header_prefix(buf);\n if (header_prefix == 0) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\\n\",\n buf[0], buf[1], buf[2], buf[3], buf[4]);\n return AVERROR_INVALIDDATA;\n }\n if (buf[5] & 2) { /* interlaced */\n ctx->cur_field = buf[5] & 1;\n frame->interlaced_frame = 1;\n frame->top_field_first = first_field ^ ctx->cur_field;\n av_log(ctx->avctx, AV_LOG_DEBUG,\n \"interlaced %d, cur field %d\\n\", buf[5] & 3, ctx->cur_field);\n } else {\n ctx->cur_field = 0;\n }\n ctx->mbaff = (buf[0x6] >> 5) & 1;\n\n ctx->height = AV_RB16(buf + 0x18);\n ctx->width = AV_RB16(buf + 0x1a);\n\n switch(buf[0x21] >> 5) {\n case 1: bitdepth = 8; break;\n case 2: bitdepth = 10; break;\n case 3: bitdepth = 12; break;\n default:\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"Unknown bitdepth indicator (%d)\\n\", buf[0x21] >> 5);\n return AVERROR_INVALIDDATA;\n }\n\n cid = AV_RB32(buf + 0x28);\n\n ctx->avctx->profile = dnxhd_get_profile(cid);\n\n if ((ret = dnxhd_init_vlc(ctx, cid, bitdepth)) < 0)\n return ret;\n if (ctx->mbaff && ctx->cid_table->cid != 1260)\n av_log(ctx->avctx, AV_LOG_WARNING,\n \"Adaptive MB interlace flag in an unsupported profile.\\n\");\n\n ctx->act = buf[0x2C] & 7;\n if (ctx->act && ctx->cid_table->cid != 1256 && ctx->cid_table->cid != 1270)\n av_log(ctx->avctx, AV_LOG_WARNING,\n \"Adaptive color transform in an unsupported profile.\\n\");\n\n ctx->is_444 = (buf[0x2C] >> 6) & 1;\n if (ctx->is_444) {\n if (bitdepth == 8) {\n avpriv_request_sample(ctx->avctx, \"4:4:4 8 bits\");\n return AVERROR_INVALIDDATA;\n } else if (bitdepth == 10) {\n ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;\n ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P10\n : AV_PIX_FMT_GBRP10;\n } else {\n ctx->decode_dct_block = dnxhd_decode_dct_block_12_444;\n ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P12\n : AV_PIX_FMT_GBRP12;\n }\n } else if (bitdepth == 12) {\n ctx->decode_dct_block = dnxhd_decode_dct_block_12;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P12;\n } else if (bitdepth == 10) {\n if (ctx->avctx->profile == FF_PROFILE_DNXHR_HQX)\n ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;\n else\n ctx->decode_dct_block = dnxhd_decode_dct_block_10;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P10;\n } else {\n ctx->decode_dct_block = dnxhd_decode_dct_block_8;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P;\n }\n\n ctx->avctx->bits_per_raw_sample = ctx->bit_depth = bitdepth;\n if (ctx->bit_depth != old_bit_depth) {\n ff_blockdsp_init(&ctx->bdsp, ctx->avctx);\n ff_idctdsp_init(&ctx->idsp, ctx->avctx);\n ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable,\n ff_zigzag_direct);\n }\n\n // make sure profile size constraints are respected\n // DNx100 allows 1920->1440 and 1280->960 subsampling\n if (ctx->width != ctx->cid_table->width &&\n ctx->cid_table->width != DNXHD_VARIABLE) {\n av_reduce(&ctx->avctx->sample_aspect_ratio.num,\n &ctx->avctx->sample_aspect_ratio.den,\n ctx->width, ctx->cid_table->width, 255);\n ctx->width = ctx->cid_table->width;\n }\n\n if (buf_size < ctx->cid_table->coding_unit_size) {\n av_log(ctx->avctx, AV_LOG_ERROR, \"incorrect frame size (%d < %u).\\n\",\n buf_size, ctx->cid_table->coding_unit_size);\n return AVERROR_INVALIDDATA;\n }\n\n ctx->mb_width = (ctx->width + 15)>> 4;\n ctx->mb_height = AV_RB16(buf + 0x16c);\n\n if ((ctx->height + 15) >> 4 == ctx->mb_height && frame->interlaced_frame)\n ctx->height <<= 1;\n\n av_log(ctx->avctx, AV_LOG_VERBOSE, \"%dx%d, 4:%s %d bits, MBAFF=%d ACT=%d\\n\",\n ctx->width, ctx->height, ctx->is_444 ? \"4:4\" : \"2:2\",\n ctx->bit_depth, ctx->mbaff, ctx->act);\n\n // Newer format supports variable mb_scan_index sizes\n if (ctx->mb_height > 68 && ff_dnxhd_check_header_prefix_hr(header_prefix)) {\n ctx->data_offset = 0x170 + (ctx->mb_height << 2);\n } else {\n if (ctx->mb_height > 68 ||\n (ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"mb height too big: %d\\n\", ctx->mb_height);\n return AVERROR_INVALIDDATA;\n }\n ctx->data_offset = 0x280;\n }\n\n if (buf_size < ctx->data_offset) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"buffer too small (%d < %d).\\n\", buf_size, ctx->data_offset);\n return AVERROR_INVALIDDATA;\n }\n\n if (ctx->mb_height > FF_ARRAY_ELEMS(ctx->mb_scan_index)) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"mb_height too big (%d > %\"SIZE_SPECIFIER\").\\n\", ctx->mb_height, FF_ARRAY_ELEMS(ctx->mb_scan_index));\n return AVERROR_INVALIDDATA;\n }\n\n for (i = 0; i < ctx->mb_height; i++) {\n ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));\n ff_dlog(ctx->avctx, \"mb scan index %d, pos %d: %\"PRIu32\"\\n\",\n i, 0x170 + (i << 2), ctx->mb_scan_index[i]);\n if (buf_size - ctx->data_offset < ctx->mb_scan_index[i]) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"invalid mb scan index (%\"PRIu32\" vs %u).\\n\",\n ctx->mb_scan_index[i], buf_size - ctx->data_offset);\n return AVERROR_INVALIDDATA;\n }\n }\n\n return 0;\n}","target":"static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,\n const uint8_t *buf, int buf_size,\n int first_field)\n{\n int i, cid, ret;\n int old_bit_depth = ctx->bit_depth, bitdepth;\n uint64_t header_prefix;\n if (buf_size < 0x280) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"buffer too small (%d < 640).\\n\", buf_size);\n return AVERROR_INVALIDDATA;\n }\n\n header_prefix = ff_dnxhd_parse_header_prefix(buf);\n if (header_prefix == 0) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\\n\",\n buf[0], buf[1], buf[2], buf[3], buf[4]);\n return AVERROR_INVALIDDATA;\n }\n if (buf[5] & 2) { /* interlaced */\n ctx->cur_field = buf[5] & 1;\n frame->interlaced_frame = 1;\n frame->top_field_first = first_field ^ ctx->cur_field;\n av_log(ctx->avctx, AV_LOG_DEBUG,\n \"interlaced %d, cur field %d\\n\", buf[5] & 3, ctx->cur_field);\n } else {\n ctx->cur_field = 0;\n }\n ctx->mbaff = (buf[0x6] >> 5) & 1;\n\n ctx->height = AV_RB16(buf + 0x18);\n ctx->width = AV_RB16(buf + 0x1a);\n\n switch(buf[0x21] >> 5) {\n case 1: bitdepth = 8; break;\n case 2: bitdepth = 10; break;\n case 3: bitdepth = 12; break;\n default:\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"Unknown bitdepth indicator (%d)\\n\", buf[0x21] >> 5);\n return AVERROR_INVALIDDATA;\n }\n\n cid = AV_RB32(buf + 0x28);\n\n ctx->avctx->profile = dnxhd_get_profile(cid);\n\n if ((ret = dnxhd_init_vlc(ctx, cid, bitdepth)) < 0)\n return ret;\n if (ctx->mbaff && ctx->cid_table->cid != 1260)\n av_log(ctx->avctx, AV_LOG_WARNING,\n \"Adaptive MB interlace flag in an unsupported profile.\\n\");\n\n ctx->act = buf[0x2C] & 7;\n if (ctx->act && ctx->cid_table->cid != 1256 && ctx->cid_table->cid != 1270)\n av_log(ctx->avctx, AV_LOG_WARNING,\n \"Adaptive color transform in an unsupported profile.\\n\");\n\n ctx->is_444 = (buf[0x2C] >> 6) & 1;\n if (ctx->is_444) {\n if (bitdepth == 8) {\n avpriv_request_sample(ctx->avctx, \"4:4:4 8 bits\");\n return AVERROR_INVALIDDATA;\n } else if (bitdepth == 10) {\n ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;\n ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P10\n : AV_PIX_FMT_GBRP10;\n } else {\n ctx->decode_dct_block = dnxhd_decode_dct_block_12_444;\n ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P12\n : AV_PIX_FMT_GBRP12;\n }\n } else if (bitdepth == 12) {\n ctx->decode_dct_block = dnxhd_decode_dct_block_12;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P12;\n } else if (bitdepth == 10) {\n if (ctx->avctx->profile == FF_PROFILE_DNXHR_HQX)\n ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;\n else\n ctx->decode_dct_block = dnxhd_decode_dct_block_10;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P10;\n } else {\n ctx->decode_dct_block = dnxhd_decode_dct_block_8;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P;\n }\n\n ctx->avctx->bits_per_raw_sample = ctx->bit_depth = bitdepth;\n if (ctx->bit_depth != old_bit_depth) {\n ff_blockdsp_init(&ctx->bdsp, ctx->avctx);\n ff_idctdsp_init(&ctx->idsp, ctx->avctx);\n ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable,\n ff_zigzag_direct);\n }\n\n // make sure profile size constraints are respected\n // DNx100 allows 1920->1440 and 1280->960 subsampling\n if (ctx->width != ctx->cid_table->width &&\n ctx->cid_table->width != DNXHD_VARIABLE) {\n av_reduce(&ctx->avctx->sample_aspect_ratio.num,\n &ctx->avctx->sample_aspect_ratio.den,\n ctx->width, ctx->cid_table->width, 255);\n ctx->width = ctx->cid_table->width;\n }\n\n if (buf_size < ctx->cid_table->coding_unit_size) {\n av_log(ctx->avctx, AV_LOG_ERROR, \"incorrect frame size (%d < %u).\\n\",\n buf_size, ctx->cid_table->coding_unit_size);\n return AVERROR_INVALIDDATA;\n }\n\n ctx->mb_width = (ctx->width + 15)>> 4;\n ctx->mb_height = AV_RB16(buf + 0x16c);\n\n if ((ctx->height + 15) >> 4 == ctx->mb_height && frame->interlaced_frame)\n ctx->height <<= 1;\n\n av_log(ctx->avctx, AV_LOG_VERBOSE, \"%dx%d, 4:%s %d bits, MBAFF=%d ACT=%d\\n\",\n ctx->width, ctx->height, ctx->is_444 ? \"4:4\" : \"2:2\",\n ctx->bit_depth, ctx->mbaff, ctx->act);\n\n // Newer format supports variable mb_scan_index sizes\n if (ctx->mb_height > 68 && ff_dnxhd_check_header_prefix_hr(header_prefix)) {\n ctx->data_offset = 0x170 + (ctx->mb_height << 2);\n } else {\n if (ctx->mb_height > 68) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"mb height too big: %d\\n\", ctx->mb_height);\n return AVERROR_INVALIDDATA;\n }\n ctx->data_offset = 0x280;\n }\n if ((ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"mb height too big: %d\\n\", ctx->mb_height);\n return AVERROR_INVALIDDATA;\n }\n\n if (buf_size < ctx->data_offset) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"buffer too small (%d < %d).\\n\", buf_size, ctx->data_offset);\n return AVERROR_INVALIDDATA;\n }\n\n if (ctx->mb_height > FF_ARRAY_ELEMS(ctx->mb_scan_index)) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"mb_height too big (%d > %\"SIZE_SPECIFIER\").\\n\", ctx->mb_height, FF_ARRAY_ELEMS(ctx->mb_scan_index));\n return AVERROR_INVALIDDATA;\n }\n\n for (i = 0; i < ctx->mb_height; i++) {\n ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));\n ff_dlog(ctx->avctx, \"mb scan index %d, pos %d: %\"PRIu32\"\\n\",\n i, 0x170 + (i << 2), ctx->mb_scan_index[i]);\n if (buf_size - ctx->data_offset < ctx->mb_scan_index[i]) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"invalid mb scan index (%\"PRIu32\" vs %u).\\n\",\n ctx->mb_scan_index[i], buf_size - ctx->data_offset);\n return AVERROR_INVALIDDATA;\n }\n }\n\n return 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1993,"sven_meta":{"func_name":"dnxhd_decode_header","file_name":"libavcodec/dnxhddec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/296debd213bd6dce7647cedd34eb64e5b94cdc92","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#53-b0bf09dad50d","input":"static MagickBooleanType WriteHDRImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n char\n header[MagickPathExtent];\n\n const char\n *property;\n\n MagickBooleanType\n status;\n\n register const Quantum\n *p;\n\n register ssize_t\n i,\n x;\n\n size_t\n length;\n\n ssize_t\n count,\n y;\n\n unsigned char\n pixel[4],\n *pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n if (IsRGBColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,RGBColorspace,exception);\n /*\n Write header.\n */\n (void) ResetMagickMemory(header,' ',MagickPathExtent);\n length=CopyMagickString(header,\"#?RGBE\\n\",MagickPathExtent);\n (void) WriteBlob(image,length,(unsigned char *) header);\n property=GetImageProperty(image,\"comment\",exception);\n if ((property != (const char *) NULL) &&\n (strchr(property,'\\n') == (char *) NULL))\n {\n count=FormatLocaleString(header,MagickPathExtent,\"#%s\\n\",property);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n property=GetImageProperty(image,\"hdr:exposure\",exception);\n if (property != (const char *) NULL)\n {\n count=FormatLocaleString(header,MagickPathExtent,\"EXPOSURE=%g\\n\",\n strtod(property,(char **) NULL));\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n if (image->gamma != 0.0)\n {\n count=FormatLocaleString(header,MagickPathExtent,\"GAMMA=%g\\n\",image->gamma);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n count=FormatLocaleString(header,MagickPathExtent,\n \"PRIMARIES=%g %g %g %g %g %g %g %g\\n\",\n image->chromaticity.red_primary.x,image->chromaticity.red_primary.y,\n image->chromaticity.green_primary.x,image->chromaticity.green_primary.y,\n image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y,\n image->chromaticity.white_point.x,image->chromaticity.white_point.y);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n length=CopyMagickString(header,\"FORMAT=32-bit_rle_rgbe\\n\\n\",MagickPathExtent);\n (void) WriteBlob(image,length,(unsigned char *) header);\n count=FormatLocaleString(header,MagickPathExtent,\"-Y %.20g +X %.20g\\n\",\n (double) image->rows,(double) image->columns);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n /*\n Write HDR pixels.\n */\n pixels=(unsigned char *) AcquireQuantumMemory(image->columns,4*\n sizeof(*pixels));\n if (pixels == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n pixel[0]=2;\n pixel[1]=2;\n pixel[2]=(unsigned char) (image->columns >> 8);\n pixel[3]=(unsigned char) (image->columns & 0xff);\n count=WriteBlob(image,4*sizeof(*pixel),pixel);\n if (count != (ssize_t) (4*sizeof(*pixel)))\n break;\n }\n i=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n double\n gamma;\n\n pixel[0]=0;\n pixel[1]=0;\n pixel[2]=0;\n pixel[3]=0;\n gamma=QuantumScale*GetPixelRed(image,p);\n if ((QuantumScale*GetPixelGreen(image,p)) > gamma)\n gamma=QuantumScale*GetPixelGreen(image,p);\n if ((QuantumScale*GetPixelBlue(image,p)) > gamma)\n gamma=QuantumScale*GetPixelBlue(image,p);\n if (gamma > MagickEpsilon)\n {\n int\n exponent;\n\n gamma=frexp(gamma,&exponent)*256.0/gamma;\n pixel[0]=(unsigned char) (gamma*QuantumScale*GetPixelRed(image,p));\n pixel[1]=(unsigned char) (gamma*QuantumScale*GetPixelGreen(image,p));\n pixel[2]=(unsigned char) (gamma*QuantumScale*GetPixelBlue(image,p));\n pixel[3]=(unsigned char) (exponent+128);\n }\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n pixels[x]=pixel[0];\n pixels[x+image->columns]=pixel[1];\n pixels[x+2*image->columns]=pixel[2];\n pixels[x+3*image->columns]=pixel[3];\n }\n else\n {\n pixels[i++]=pixel[0];\n pixels[i++]=pixel[1];\n pixels[i++]=pixel[2];\n pixels[i++]=pixel[3];\n }\n p+=GetPixelChannels(image);\n }\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n for (i=0; i < 4; i++)\n length=HDRWriteRunlengthPixels(image,&pixels[i*image->columns]);\n }\n else\n {\n count=WriteBlob(image,4*image->columns*sizeof(*pixels),pixels);\n if (count != (ssize_t) (4*image->columns*sizeof(*pixels)))\n break;\n }\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n pixels=(unsigned char *) RelinquishMagickMemory(pixels);\n (void) CloseBlob(image);\n return(MagickTrue);\n}","target":"static MagickBooleanType WriteHDRImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n char\n header[MagickPathExtent];\n\n const char\n *property;\n\n MagickBooleanType\n status;\n\n register const Quantum\n *p;\n\n register ssize_t\n i,\n x;\n\n size_t\n length;\n\n ssize_t\n count,\n y;\n\n unsigned char\n pixel[4],\n *pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n if (IsRGBColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,RGBColorspace,exception);\n /*\n Write header.\n */\n (void) ResetMagickMemory(header,' ',MagickPathExtent);\n length=CopyMagickString(header,\"#?RGBE\\n\",MagickPathExtent);\n (void) WriteBlob(image,length,(unsigned char *) header);\n property=GetImageProperty(image,\"comment\",exception);\n if ((property != (const char *) NULL) &&\n (strchr(property,'\\n') == (char *) NULL))\n {\n count=FormatLocaleString(header,MagickPathExtent,\"#%s\\n\",property);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n property=GetImageProperty(image,\"hdr:exposure\",exception);\n if (property != (const char *) NULL)\n {\n count=FormatLocaleString(header,MagickPathExtent,\"EXPOSURE=%g\\n\",\n strtod(property,(char **) NULL));\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n if (image->gamma != 0.0)\n {\n count=FormatLocaleString(header,MagickPathExtent,\"GAMMA=%g\\n\",\n image->gamma);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n count=FormatLocaleString(header,MagickPathExtent,\n \"PRIMARIES=%g %g %g %g %g %g %g %g\\n\",\n image->chromaticity.red_primary.x,image->chromaticity.red_primary.y,\n image->chromaticity.green_primary.x,image->chromaticity.green_primary.y,\n image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y,\n image->chromaticity.white_point.x,image->chromaticity.white_point.y);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n length=CopyMagickString(header,\"FORMAT=32-bit_rle_rgbe\\n\\n\",MagickPathExtent);\n (void) WriteBlob(image,length,(unsigned char *) header);\n count=FormatLocaleString(header,MagickPathExtent,\"-Y %.20g +X %.20g\\n\",\n (double) image->rows,(double) image->columns);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n /*\n Write HDR pixels.\n */\n pixels=(unsigned char *) AcquireQuantumMemory(image->columns+128,4*\n sizeof(*pixels));\n if (pixels == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(pixels,0,4*(image->columns+128)*sizeof(*pixels));\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n pixel[0]=2;\n pixel[1]=2;\n pixel[2]=(unsigned char) (image->columns >> 8);\n pixel[3]=(unsigned char) (image->columns & 0xff);\n count=WriteBlob(image,4*sizeof(*pixel),pixel);\n if (count != (ssize_t) (4*sizeof(*pixel)))\n break;\n }\n i=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n double\n gamma;\n\n pixel[0]=0;\n pixel[1]=0;\n pixel[2]=0;\n pixel[3]=0;\n gamma=QuantumScale*GetPixelRed(image,p);\n if ((QuantumScale*GetPixelGreen(image,p)) > gamma)\n gamma=QuantumScale*GetPixelGreen(image,p);\n if ((QuantumScale*GetPixelBlue(image,p)) > gamma)\n gamma=QuantumScale*GetPixelBlue(image,p);\n if (gamma > MagickEpsilon)\n {\n int\n exponent;\n\n gamma=frexp(gamma,&exponent)*256.0/gamma;\n pixel[0]=(unsigned char) (gamma*QuantumScale*GetPixelRed(image,p));\n pixel[1]=(unsigned char) (gamma*QuantumScale*GetPixelGreen(image,p));\n pixel[2]=(unsigned char) (gamma*QuantumScale*GetPixelBlue(image,p));\n pixel[3]=(unsigned char) (exponent+128);\n }\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n pixels[x]=pixel[0];\n pixels[x+image->columns]=pixel[1];\n pixels[x+2*image->columns]=pixel[2];\n pixels[x+3*image->columns]=pixel[3];\n }\n else\n {\n pixels[i++]=pixel[0];\n pixels[i++]=pixel[1];\n pixels[i++]=pixel[2];\n pixels[i++]=pixel[3];\n }\n p+=GetPixelChannels(image);\n }\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n for (i=0; i < 4; i++)\n length=HDRWriteRunlengthPixels(image,&pixels[i*image->columns]);\n }\n else\n {\n count=WriteBlob(image,4*image->columns*sizeof(*pixels),pixels);\n if (count != (ssize_t) (4*image->columns*sizeof(*pixels)))\n break;\n }\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n pixels=(unsigned char *) RelinquishMagickMemory(pixels);\n (void) CloseBlob(image);\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-125","target_token_count":1554,"sven_meta":{"func_name":"WriteHDRImage","file_name":"coders/hdr.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/14e606db148d6ebcaae20f1e1d6d71903ca4a556","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#59-6b775e0c7ac6","input":"SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)\n{\n\twStream* s;\n\tsize_t length;\n\tNTLM_NEGOTIATE_MESSAGE* message;\n\tmessage = &context->NEGOTIATE_MESSAGE;\n\tZeroMemory(message, sizeof(NTLM_NEGOTIATE_MESSAGE));\n\ts = Stream_New((BYTE*)buffer->pvBuffer, buffer->cbBuffer);\n\n\tif (!s)\n\t\treturn SEC_E_INTERNAL_ERROR;\n\n\tif (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER*)message) < 0)\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tif (message->MessageType != MESSAGE_TYPE_NEGOTIATE)\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tStream_Read_UINT32(s, message->NegotiateFlags); /* NegotiateFlags (4 bytes) */\n\n\tif (!((message->NegotiateFlags & NTLMSSP_REQUEST_TARGET) &&\n\t (message->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLM) &&\n\t (message->NegotiateFlags & NTLMSSP_NEGOTIATE_UNICODE)))\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tcontext->NegotiateFlags = message->NegotiateFlags;\n\n\t/* only set if NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED is set */\n\n\tif (ntlm_read_message_fields(s, &(message->DomainName)) < 0) /* DomainNameFields (8 bytes) */\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\t/* only set if NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED is set */\n\n\tif (ntlm_read_message_fields(s, &(message->Workstation)) < 0) /* WorkstationFields (8 bytes) */\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tif (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)\n\t{\n\t\tif (ntlm_read_version_info(s, &(message->Version)) < 0) /* Version (8 bytes) */\n\t\t{\n\t\t\tStream_Free(s, FALSE);\n\t\t\treturn SEC_E_INVALID_TOKEN;\n\t\t}\n\t}\n\n\tlength = Stream_GetPosition(s);\n\tbuffer->cbBuffer = length;\n\n\tif (!sspi_SecBufferAlloc(&context->NegotiateMessage, length))\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INTERNAL_ERROR;\n\t}\n\n\tCopyMemory(context->NegotiateMessage.pvBuffer, buffer->pvBuffer, buffer->cbBuffer);\n\tcontext->NegotiateMessage.BufferType = buffer->BufferType;\n#ifdef WITH_DEBUG_NTLM\n\tWLog_DBG(TAG, \"NEGOTIATE_MESSAGE (length = %\" PRIu32 \")\", context->NegotiateMessage.cbBuffer);\n\twinpr_HexDump(TAG, WLOG_DEBUG, context->NegotiateMessage.pvBuffer,\n\t context->NegotiateMessage.cbBuffer);\n\tntlm_print_negotiate_flags(message->NegotiateFlags);\n\n\tif (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)\n\t\tntlm_print_version_info(&(message->Version));\n\n#endif\n\tcontext->state = NTLM_STATE_CHALLENGE;\n\tStream_Free(s, FALSE);\n\treturn SEC_I_CONTINUE_NEEDED;\n}","target":"SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)\n{\n\twStream* s;\n\tsize_t length;\n\tNTLM_NEGOTIATE_MESSAGE* message;\n\tmessage = &context->NEGOTIATE_MESSAGE;\n\tZeroMemory(message, sizeof(NTLM_NEGOTIATE_MESSAGE));\n\ts = Stream_New((BYTE*)buffer->pvBuffer, buffer->cbBuffer);\n\n\tif (!s)\n\t\treturn SEC_E_INTERNAL_ERROR;\n\n\tif (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER*)message) < 0)\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tif (message->MessageType != MESSAGE_TYPE_NEGOTIATE)\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tif (Stream_GetRemainingLength(s) < 4)\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\tStream_Read_UINT32(s, message->NegotiateFlags); /* NegotiateFlags (4 bytes) */\n\n\tif (!((message->NegotiateFlags & NTLMSSP_REQUEST_TARGET) &&\n\t (message->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLM) &&\n\t (message->NegotiateFlags & NTLMSSP_NEGOTIATE_UNICODE)))\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tcontext->NegotiateFlags = message->NegotiateFlags;\n\n\t/* only set if NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED is set */\n\n\tif (ntlm_read_message_fields(s, &(message->DomainName)) < 0) /* DomainNameFields (8 bytes) */\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\t/* only set if NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED is set */\n\n\tif (ntlm_read_message_fields(s, &(message->Workstation)) < 0) /* WorkstationFields (8 bytes) */\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tif (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)\n\t{\n\t\tif (ntlm_read_version_info(s, &(message->Version)) < 0) /* Version (8 bytes) */\n\t\t{\n\t\t\tStream_Free(s, FALSE);\n\t\t\treturn SEC_E_INVALID_TOKEN;\n\t\t}\n\t}\n\n\tlength = Stream_GetPosition(s);\n\tbuffer->cbBuffer = length;\n\n\tif (!sspi_SecBufferAlloc(&context->NegotiateMessage, length))\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INTERNAL_ERROR;\n\t}\n\n\tCopyMemory(context->NegotiateMessage.pvBuffer, buffer->pvBuffer, buffer->cbBuffer);\n\tcontext->NegotiateMessage.BufferType = buffer->BufferType;\n#ifdef WITH_DEBUG_NTLM\n\tWLog_DBG(TAG, \"NEGOTIATE_MESSAGE (length = %\" PRIu32 \")\", context->NegotiateMessage.cbBuffer);\n\twinpr_HexDump(TAG, WLOG_DEBUG, context->NegotiateMessage.pvBuffer,\n\t context->NegotiateMessage.cbBuffer);\n\tntlm_print_negotiate_flags(message->NegotiateFlags);\n\n\tif (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)\n\t\tntlm_print_version_info(&(message->Version));\n\n#endif\n\tcontext->state = NTLM_STATE_CHALLENGE;\n\tStream_Free(s, FALSE);\n\treturn SEC_I_CONTINUE_NEEDED;\n}","lang":"c","vul_type":"cwe-125","target_token_count":748,"sven_meta":{"func_name":"ntlm_read_NegotiateMessage","file_name":"winpr/libwinpr/sspi/NTLM/ntlm_message.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/8fa38359634a9910b91719818ab02f23c320dbae","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#63-04dded5901b6","input":"static u_int16_t concat_hash_string(struct ndpi_packet_struct *packet,\n\t\t\t\t char *buf, u_int8_t client_hash) {\n u_int16_t offset = 22, buf_out_len = 0;\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n u_int32_t len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n offset += 4;\n\n /* -1 for ';' */\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n /* ssh.kex_algorithms [C/S] */\n strncpy(buf, (const char *)&packet->payload[offset], buf_out_len = len);\n buf[buf_out_len++] = ';';\n offset += len;\n\n /* ssh.server_host_key_algorithms [None] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n offset += 4 + len;\n\n /* ssh.encryption_algorithms_client_to_server [C] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.encryption_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.mac_algorithms_client_to_server [C] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.mac_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.compression_algorithms_client_to_server [C] */\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.compression_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.languages_client_to_server [None] */\n\n /* ssh.languages_server_to_client [None] */\n\n#ifdef SSH_DEBUG\n printf(\"[SSH] %s\\n\", buf);\n#endif\n\n return(buf_out_len);\n\ninvalid_payload:\n\n#ifdef SSH_DEBUG\n printf(\"[SSH] Invalid packet payload\\n\");\n#endif\n\n return(0);\n}","target":"static u_int16_t concat_hash_string(struct ndpi_packet_struct *packet,\n\t\t\t\t char *buf, u_int8_t client_hash) {\n u_int16_t offset = 22, buf_out_len = 0;\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n u_int32_t len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n offset += 4;\n\n /* -1 for ';' */\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n /* ssh.kex_algorithms [C/S] */\n strncpy(buf, (const char *)&packet->payload[offset], buf_out_len = len);\n buf[buf_out_len++] = ';';\n offset += len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.server_host_key_algorithms [None] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n offset += 4 + len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.encryption_algorithms_client_to_server [C] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.encryption_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.mac_algorithms_client_to_server [C] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.mac_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.compression_algorithms_client_to_server [C] */\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n offset += len;\n } else\n offset += 4 + len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.compression_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.languages_client_to_server [None] */\n\n /* ssh.languages_server_to_client [None] */\n\n#ifdef SSH_DEBUG\n printf(\"[SSH] %s\\n\", buf);\n#endif\n\n return(buf_out_len);\n\ninvalid_payload:\n\n#ifdef SSH_DEBUG\n printf(\"[SSH] Invalid packet payload\\n\");\n#endif\n\n return(0);\n}","lang":"c","vul_type":"cwe-125","target_token_count":1187,"sven_meta":{"func_name":"concat_hash_string","file_name":"src/lib/protocols/ssh.c","commit_link":"github.com/ntop/nDPI/commit/3bbb0cd3296023f6f922c71d21a1c374d2b0a435","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#64-09df6d4bbb8b","input":"static ssize_t DecodePSDPixels(const size_t number_compact_pixels,\n const unsigned char *compact_pixels,const ssize_t depth,\n const size_t number_pixels,unsigned char *pixels)\n{\n#define CheckNumberCompactPixels \\\n if (packets == 0) \\\n return(i); \\\n packets--\n\n#define CheckNumberPixels(count) \\\n if (((ssize_t) i + count) > (ssize_t) number_pixels) \\\n return(i); \\\n i+=count\n\n int\n pixel;\n\n register ssize_t\n i,\n j;\n\n size_t\n length;\n\n ssize_t\n packets;\n\n packets=(ssize_t) number_compact_pixels;\n for (i=0; (packets > 1) && (i < (ssize_t) number_pixels); )\n {\n packets--;\n length=(size_t) (*compact_pixels++);\n if (length == 128)\n continue;\n if (length > 128)\n {\n length=256-length+1;\n CheckNumberCompactPixels;\n pixel=(*compact_pixels++);\n for (j=0; j < (ssize_t) length; j++)\n {\n switch (depth)\n {\n case 1:\n {\n CheckNumberPixels(8);\n *pixels++=(pixel >> 7) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 6) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 5) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 4) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 3) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 2) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 1) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 0) & 0x01 ? 0U : 255U;\n break;\n }\n case 2:\n {\n CheckNumberPixels(4);\n *pixels++=(unsigned char) ((pixel >> 6) & 0x03);\n *pixels++=(unsigned char) ((pixel >> 4) & 0x03);\n *pixels++=(unsigned char) ((pixel >> 2) & 0x03);\n *pixels++=(unsigned char) ((pixel & 0x03) & 0x03);\n break;\n }\n case 4:\n {\n CheckNumberPixels(2);\n *pixels++=(unsigned char) ((pixel >> 4) & 0xff);\n *pixels++=(unsigned char) ((pixel & 0x0f) & 0xff);\n break;\n }\n default:\n {\n CheckNumberPixels(1);\n *pixels++=(unsigned char) pixel;\n break;\n }\n }\n }\n continue;\n }\n length++;\n for (j=0; j < (ssize_t) length; j++)\n {\n switch (depth)\n {\n case 1:\n {\n CheckNumberPixels(8);\n *pixels++=(*compact_pixels >> 7) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 6) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 5) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 4) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 3) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 2) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 1) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 0) & 0x01 ? 0U : 255U;\n break;\n }\n case 2:\n {\n CheckNumberPixels(4);\n *pixels++=(*compact_pixels >> 6) & 0x03;\n *pixels++=(*compact_pixels >> 4) & 0x03;\n *pixels++=(*compact_pixels >> 2) & 0x03;\n *pixels++=(*compact_pixels & 0x03) & 0x03;\n break;\n }\n case 4:\n {\n CheckNumberPixels(2);\n *pixels++=(*compact_pixels >> 4) & 0xff;\n *pixels++=(*compact_pixels & 0x0f) & 0xff;\n break;\n }\n default:\n {\n CheckNumberPixels(1);\n *pixels++=(*compact_pixels);\n break;\n }\n }\n CheckNumberCompactPixels;\n compact_pixels++;\n }\n }\n return(i);\n}","target":"static ssize_t DecodePSDPixels(const size_t number_compact_pixels,\n const unsigned char *compact_pixels,const ssize_t depth,\n const size_t number_pixels,unsigned char *pixels)\n{\n#define CheckNumberCompactPixels \\\n if (packets == 0) \\\n return(i); \\\n packets--\n\n#define CheckNumberPixels(count) \\\n if (((ssize_t) i + count) > (ssize_t) number_pixels) \\\n return(i); \\\n i+=count\n\n int\n pixel;\n\n register ssize_t\n i,\n j;\n\n size_t\n length;\n\n ssize_t\n packets;\n\n packets=(ssize_t) number_compact_pixels;\n for (i=0; (packets > 1) && (i < (ssize_t) number_pixels); )\n {\n packets--;\n length=(size_t) (*compact_pixels++);\n if (length == 128)\n continue;\n if (length > 128)\n {\n length=256-length+1;\n CheckNumberCompactPixels;\n pixel=(*compact_pixels++);\n for (j=0; j < (ssize_t) length; j++)\n {\n switch (depth)\n {\n case 1:\n {\n CheckNumberPixels(8);\n *pixels++=(pixel >> 7) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 6) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 5) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 4) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 3) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 2) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 1) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 0) & 0x01 ? 0U : 255U;\n break;\n }\n case 2:\n {\n CheckNumberPixels(4);\n *pixels++=(unsigned char) ((pixel >> 6) & 0x03);\n *pixels++=(unsigned char) ((pixel >> 4) & 0x03);\n *pixels++=(unsigned char) ((pixel >> 2) & 0x03);\n *pixels++=(unsigned char) ((pixel & 0x03) & 0x03);\n break;\n }\n case 4:\n {\n CheckNumberPixels(2);\n *pixels++=(unsigned char) ((pixel >> 4) & 0xff);\n *pixels++=(unsigned char) ((pixel & 0x0f) & 0xff);\n break;\n }\n default:\n {\n CheckNumberPixels(1);\n *pixels++=(unsigned char) pixel;\n break;\n }\n }\n }\n continue;\n }\n length++;\n for (j=0; j < (ssize_t) length; j++)\n {\n CheckNumberCompactPixels;\n switch (depth)\n {\n case 1:\n {\n CheckNumberPixels(8);\n *pixels++=(*compact_pixels >> 7) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 6) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 5) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 4) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 3) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 2) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 1) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 0) & 0x01 ? 0U : 255U;\n break;\n }\n case 2:\n {\n CheckNumberPixels(4);\n *pixels++=(*compact_pixels >> 6) & 0x03;\n *pixels++=(*compact_pixels >> 4) & 0x03;\n *pixels++=(*compact_pixels >> 2) & 0x03;\n *pixels++=(*compact_pixels & 0x03) & 0x03;\n break;\n }\n case 4:\n {\n CheckNumberPixels(2);\n *pixels++=(*compact_pixels >> 4) & 0xff;\n *pixels++=(*compact_pixels & 0x0f) & 0xff;\n break;\n }\n default:\n {\n CheckNumberPixels(1);\n *pixels++=(*compact_pixels);\n break;\n }\n }\n compact_pixels++;\n }\n }\n return(i);\n}","lang":"c","vul_type":"cwe-125","target_token_count":1174,"sven_meta":{"func_name":"DecodePSDPixels","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/30eec879c8b446b0ea9a3bb0da1a441cc8482bc4","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#65-01c350d47b80","input":"static int _6502_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tchar addrbuf[64];\n\tconst int buffsize = sizeof (addrbuf) - 1;\n\n\tmemset (op, '\\0', sizeof (RAnalOp));\n\top->size = snes_op_get_size (1, 1, &snes_op[data[0]]);\t//snes-arch is similiar to nes/6502\n\top->addr = addr;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->id = data[0];\n\tr_strbuf_init (&op->esil);\n\tswitch (data[0]) {\n\tcase 0x02:\n\tcase 0x03:\n\tcase 0x04:\n\tcase 0x07:\n\tcase 0x0b:\n\tcase 0x0c:\n\tcase 0x0f:\n\tcase 0x12:\n\tcase 0x13:\n\tcase 0x14:\n\tcase 0x17:\n\tcase 0x1a:\n\tcase 0x1b:\n\tcase 0x1c:\n\tcase 0x1f:\n\tcase 0x22:\n\tcase 0x23:\n\tcase 0x27:\n\tcase 0x2b:\n\tcase 0x2f:\n\tcase 0x32:\n\tcase 0x33:\n\tcase 0x34:\n\tcase 0x37:\n\tcase 0x3a:\n\tcase 0x3b:\n\tcase 0x3c:\n\tcase 0x3f:\n\tcase 0x42:\n\tcase 0x43:\n\tcase 0x44:\n\tcase 0x47:\n\tcase 0x4b:\n\tcase 0x4f:\n\tcase 0x52:\n\tcase 0x53:\n\tcase 0x54:\n\tcase 0x57:\n\tcase 0x5a:\n\tcase 0x5b:\n\tcase 0x5c:\n\tcase 0x5f:\n\tcase 0x62:\n\tcase 0x63:\n\tcase 0x64:\n\tcase 0x67:\n\tcase 0x6b:\n\tcase 0x6f:\n\tcase 0x72:\n\tcase 0x73:\n\tcase 0x74:\n\tcase 0x77:\n\tcase 0x7a:\n\tcase 0x7b:\n\tcase 0x7c:\n\tcase 0x7f:\n\tcase 0x80:\n\tcase 0x82:\n\tcase 0x83:\n\tcase 0x87:\n\tcase 0x89:\n\tcase 0x8b:\n\tcase 0x8f:\n\tcase 0x92:\n\tcase 0x93:\n\tcase 0x97:\n\tcase 0x9b:\n\tcase 0x9c:\n\tcase 0x9e:\n\tcase 0x9f:\n\tcase 0xa3:\n\tcase 0xa7:\n\tcase 0xab:\n\tcase 0xaf:\n\tcase 0xb2:\n\tcase 0xb3:\n\tcase 0xb7:\n\tcase 0xbb:\n\tcase 0xbf:\n\tcase 0xc2:\n\tcase 0xc3:\n\tcase 0xc7:\n\tcase 0xcb:\n\tcase 0xcf:\n\tcase 0xd2:\n\tcase 0xd3:\n\tcase 0xd4:\n\tcase 0xd7:\n\tcase 0xda:\n\tcase 0xdb:\n\tcase 0xdc:\n\tcase 0xdf:\n\tcase 0xe2:\n\tcase 0xe3:\n\tcase 0xe7:\n\tcase 0xeb:\n\tcase 0xef:\n\tcase 0xf2:\n\tcase 0xf3:\n\tcase 0xf4:\n\tcase 0xf7:\n\tcase 0xfa:\n\tcase 0xfb:\n\tcase 0xfc:\n\tcase 0xff:\n\t\t// undocumented or not-implemented opcodes for 6502.\n\t\t// some of them might be implemented in 65816\n\t\top->size = 1;\n\t\top->type = R_ANAL_OP_TYPE_ILL;\n\t\tbreak;\n\n\t// BRK\n\tcase 0x00: // brk\n\t\top->cycles = 7;\n\t\top->type = R_ANAL_OP_TYPE_SWI;\n\t\t// override 65816 code which seems to be wrong: size is 1, but pc = pc + 2\n\t\top->size = 1;\n\t\t// PC + 2 to Stack, P to Stack B=1 D=0 I=1. \"B\" is not a flag. Only its bit is pushed on the stack\n\t\t// PC was already incremented by one at this point. Needs to incremented once more\n\t\t// New PC is Interrupt Vector: $fffe. (FIXME: Confirm this is valid for all 6502)\n\t\tr_strbuf_set (&op->esil, \",1,I,=,0,D,=,flags,0x10,|,0x100,sp,+,=[1],pc,1,+,0xfe,sp,+,=[2],3,sp,-=,0xfffe,[2],pc,=\");\n\t\tbreak;\n\n\t// FLAGS\n\tcase 0x78: // sei\n\tcase 0x58: // cli\n\tcase 0x38: // sec\n\tcase 0x18: // clc\n\tcase 0xf8: // sed\n\tcase 0xd8: // cld\n\tcase 0xb8: // clv\n\t\top->cycles = 2;\n\t\t// FIXME: what opcode for this?\n\t\top->type = R_ANAL_OP_TYPE_NOP;\n\t\t_6502_anal_esil_flags (op, data[0]);\n\t\tbreak;\n\t// BIT\n\tcase 0x24: // bit $ff\n\tcase 0x2c: // bit $ffff\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tr_strbuf_setf (&op->esil, \"a,%s,[1],&,0x80,&,!,!,N,=,a,%s,[1],&,0x40,&,!,!,V,=,a,%s,[1],&,0xff,&,!,Z,=\",addrbuf, addrbuf, addrbuf);\n\t\tbreak;\n\t// ADC\n\tcase 0x69: // adc #$ff\n\tcase 0x65: // adc $ff\n\tcase 0x75: // adc $ff,x\n\tcase 0x6d: // adc $ffff\n\tcase 0x7d: // adc $ffff,x\n\tcase 0x79: // adc $ffff,y\n\tcase 0x61: // adc ($ff,x)\n\tcase 0x71: // adc ($ff,y)\n\t\t// FIXME: update V\n\t\t// FIXME: support BCD mode\n\t\top->type = R_ANAL_OP_TYPE_ADD;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x69) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,+=,C,NUM,$c7,C,=,a,+=,$c7,C,|=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,+=,C,NUM,$c7,C,=,a,+=,$c7,C,|=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\t// fix Z\n\t\tr_strbuf_append (&op->esil, \",a,a,=,$z,Z,=\");\n\t\tbreak;\n\t// SBC\n\tcase 0xe9: // sbc #$ff\n\tcase 0xe5: // sbc $ff\n\tcase 0xf5: // sbc $ff,x\n\tcase 0xed: // sbc $ffff\n\tcase 0xfd: // sbc $ffff,x\n\tcase 0xf9: // sbc $ffff,y\n\tcase 0xe1: // sbc ($ff,x)\n\tcase 0xf1: // sbc ($ff,y)\n\t\t// FIXME: update V\n\t\t// FIXME: support BCD mode\n\t\top->type = R_ANAL_OP_TYPE_SUB;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xe9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"C,!,%s,+,a,-=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"C,!,%s,[1],+,a,-=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// fix Z and revert C\n\t\tr_strbuf_append (&op->esil, \",a,a,=,$z,Z,=,C,!=\");\n\t\tbreak;\n\t// ORA\n\tcase 0x09: // ora #$ff\n\tcase 0x05: // ora $ff\n\tcase 0x15: // ora $ff,x\n\tcase 0x0d: // ora $ffff\n\tcase 0x1d: // ora $ffff,x\n\tcase 0x19: // ora $ffff,y\n\tcase 0x01: // ora ($ff,x)\n\tcase 0x11: // ora ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_OR;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x09) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,|=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,|=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// AND\n\tcase 0x29: // and #$ff\n\tcase 0x25: // and $ff\n\tcase 0x35: // and $ff,x\n\tcase 0x2d: // and $ffff\n\tcase 0x3d: // and $ffff,x\n\tcase 0x39: // and $ffff,y\n\tcase 0x21: // and ($ff,x)\n\tcase 0x31: // and ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_AND;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x29) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,&=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,&=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// EOR\n\tcase 0x49: // eor #$ff\n\tcase 0x45: // eor $ff\n\tcase 0x55: // eor $ff,x\n\tcase 0x4d: // eor $ffff\n\tcase 0x5d: // eor $ffff,x\n\tcase 0x59: // eor $ffff,y\n\tcase 0x41: // eor ($ff,x)\n\tcase 0x51: // eor ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_XOR;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x49) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,^=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,^=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ASL\n\tcase 0x0a: // asl a\n\tcase 0x06: // asl $ff\n\tcase 0x16: // asl $ff,x\n\tcase 0x0e: // asl $ffff\n\tcase 0x1e: // asl $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_SHL;\n\t\tif (data[0] == 0x0a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,<<=,$c7,C,=,a,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],<<,%s,=[1],$c7,C,=\", addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LSR\n\tcase 0x4a: // lsr a\n\tcase 0x46: // lsr $ff\n\tcase 0x56: // lsr $ff,x\n\tcase 0x4e: // lsr $ffff\n\tcase 0x5e: // lsr $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_SHR;\n\t\tif (data[0] == 0x4a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,&,C,=,1,a,>>=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],&,C,=,1,%s,[1],>>,%s,=[1]\", addrbuf, addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ROL\n\tcase 0x2a: // rol a\n\tcase 0x26: // rol $ff\n\tcase 0x36: // rol $ff,x\n\tcase 0x2e: // rol $ffff\n\tcase 0x3e: // rol $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_ROL;\n\t\tif (data[0] == 0x2a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,<<,C,|,a,=,$c7,C,=,a,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],<<,C,|,%s,=[1],$c7,C,=\", addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ROR\n\tcase 0x6a: // ror a\n\tcase 0x66: // ror $ff\n\tcase 0x76: // ror $ff,x\n\tcase 0x6e: // ror $ffff\n\tcase 0x7e: // ror $ffff,x\n\t\t// uses N as temporary to hold C value. but in fact,\n\t\t// it is not temporary since in all ROR ops, N will have the value of C\n\t\top->type = R_ANAL_OP_TYPE_ROR;\n\t\tif (data[0] == 0x6a) {\n\t\t\tr_strbuf_set (&op->esil, \"C,N,=,1,a,&,C,=,1,a,>>,7,N,<<,|,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"C,N,=,1,%s,[1],&,C,=,1,%s,[1],>>,7,N,<<,|,%s,=[1]\", addrbuf, addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// INC\n\tcase 0xe6: // inc $ff\n\tcase 0xf6: // inc $ff,x\n\tcase 0xee: // inc $ffff\n\tcase 0xfe: // inc $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"%s,++=[1]\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// DEC\n\tcase 0xc6: // dec $ff\n\tcase 0xd6: // dec $ff,x\n\tcase 0xce: // dec $ffff\n\tcase 0xde: // dec $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"%s,--=[1]\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// INX, INY\n\tcase 0xe8: // inx\n\tcase 0xc8: // iny\n\t\top->cycles = 2;\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_inc_reg (op, data[0], \"+\");\n\t\tbreak;\n\t// DEX, DEY\n\tcase 0xca: // dex\n\tcase 0x88: // dey\n\t\top->cycles = 2;\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_inc_reg (op, data[0], \"-\");\n\t\tbreak;\n\t// CMP\n\tcase 0xc9: // cmp #$ff\n\tcase 0xc5: // cmp $ff\n\tcase 0xd5: // cmp $ff,x\n\tcase 0xcd: // cmp $ffff\n\tcase 0xdd: // cmp $ffff,x\n\tcase 0xd9: // cmp $ffff,y\n\tcase 0xc1: // cmp ($ff,x)\n\tcase 0xd1: // cmp ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xc9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// CPX\n\tcase 0xe0: // cpx #$ff\n\tcase 0xe4: // cpx $ff\n\tcase 0xec: // cpx $ffff\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tif (data[0] == 0xe0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,x,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],x,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// CPY\n\tcase 0xc0: // cpy #$ff\n\tcase 0xc4: // cpy $ff\n\tcase 0xcc: // cpy $ffff\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tif (data[0] == 0xc0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,y,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],y,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// BRANCHES\n\tcase 0x10: // bpl $ffff\n\tcase 0x30: // bmi $ffff\n\tcase 0x50: // bvc $ffff\n\tcase 0x70: // bvs $ffff\n\tcase 0x90: // bcc $ffff\n\tcase 0xb0: // bcs $ffff\n\tcase 0xd0: // bne $ffff\n\tcase 0xf0: // beq $ffff\n\t\t// FIXME: Add 1 if branch occurs to same page.\n\t\t// FIXME: Add 2 if branch occurs to different page\n\t\top->cycles = 2;\n\t\top->failcycles = 3;\n\t\top->type = R_ANAL_OP_TYPE_CJMP;\n\t\tif (data[1] <= 127)\n\t\t\top->jump = addr + data[1] + op->size;\n\t\telse\top->jump = addr - (256 - data[1]) + op->size;\n\t\top->fail = addr + op->size;\n\t\t// FIXME: add a type of conditional\n\t\t// op->cond = R_ANAL_COND_LE;\n\t\t_6502_anal_esil_ccall (op, data[0]);\n\t\tbreak;\n\t// JSR\n\tcase 0x20: // jsr $ffff\n\t\top->cycles = 6;\n\t\top->type = R_ANAL_OP_TYPE_CALL;\n\t\top->jump = data[1] | data[2] << 8;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = 2;\n\t\t// JSR pushes the address-1 of the next operation on to the stack before transferring program\n\t\t// control to the following address\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_setf (&op->esil, \"1,pc,-,0xff,sp,+,=[2],0x%04x,pc,=,2,sp,-=\", op->jump);\n\t\tbreak;\n\t// JMP\n\tcase 0x4c: // jmp $ffff\n\t\top->cycles = 3;\n\t\top->type = R_ANAL_OP_TYPE_JMP;\n\t\top->jump = data[1] | data[2] << 8;\n\t\tr_strbuf_setf (&op->esil, \"0x%04x,pc,=\", op->jump);\n\t\tbreak;\n\tcase 0x6c: // jmp ($ffff)\n\t\top->cycles = 5;\n\t\top->type = R_ANAL_OP_TYPE_UJMP;\n\t\t// FIXME: how to read memory?\n\t\t// op->jump = data[1] | data[2] << 8;\n\t\tr_strbuf_setf (&op->esil, \"0x%04x,[2],pc,=\", data[1] | data[2] << 8);\n\t\tbreak;\n\t// RTS\n\tcase 0x60: // rts\n\t\top->eob = true;\n\t\top->type = R_ANAL_OP_TYPE_RET;\n\t\top->cycles = 6;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -2;\n\t\t// Operation: PC from Stack, PC + 1 -> PC\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_set (&op->esil, \"0x101,sp,+,[2],pc,=,pc,++=,2,sp,+=\");\n\t\tbreak;\n\t// RTI\n\tcase 0x40: // rti\n\t\top->eob = true;\n\t\top->type = R_ANAL_OP_TYPE_RET;\n\t\top->cycles = 6;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -3;\n\t\t// Operation: P from Stack, PC from Stack\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_set (&op->esil, \"0x101,sp,+,[1],flags,=,0x102,sp,+,[2],pc,=,3,sp,+=\");\n\t\tbreak;\n\t// NOP\n\tcase 0xea: // nop\n\t\top->type = R_ANAL_OP_TYPE_NOP;\n\t\top->cycles = 2;\n\t\tbreak;\n\t// LDA\n\tcase 0xa9: // lda #$ff\n\tcase 0xa5: // lda $ff\n\tcase 0xb5: // lda $ff,x\n\tcase 0xad: // lda $ffff\n\tcase 0xbd: // lda $ffff,x\n\tcase 0xb9: // lda $ffff,y\n\tcase 0xa1: // lda ($ff,x)\n\tcase 0xb1: // lda ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xa9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LDX\n\tcase 0xa2: // ldx #$ff\n\tcase 0xa6: // ldx $ff\n\tcase 0xb6: // ldx $ff,y\n\tcase 0xae: // ldx $ffff\n\tcase 0xbe: // ldx $ffff,y\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'y');\n\t\tif (data[0] == 0xa2) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,x,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],x,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LDY\n\tcase 0xa0: // ldy #$ff\n\tcase 0xa4: // ldy $ff\n\tcase 0xb4: // ldy $ff,x\n\tcase 0xac: // ldy $ffff\n\tcase 0xbc: // ldy $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 'x');\n\t\tif (data[0] == 0xa0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,y,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],y,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// STA\n\tcase 0x85: // sta $ff\n\tcase 0x95: // sta $ff,x\n\tcase 0x8d: // sta $ffff\n\tcase 0x9d: // sta $ffff,x\n\tcase 0x99: // sta $ffff,y\n\tcase 0x81: // sta ($ff,x)\n\tcase 0x91: // sta ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tr_strbuf_setf (&op->esil, \"a,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// STX\n\tcase 0x86: // stx $ff\n\tcase 0x96: // stx $ff,y\n\tcase 0x8e: // stx $ffff\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'y');\n\t\tr_strbuf_setf (&op->esil, \"x,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// STY\n\tcase 0x84: // sty $ff\n\tcase 0x94: // sty $ff,x\n\tcase 0x8c: // sty $ffff\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"y,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// PHP/PHA\n\tcase 0x08: // php\n\tcase 0x48: // pha\n\t\top->type = R_ANAL_OP_TYPE_PUSH;\n\t\top->cycles = 3;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = 1;\n\t\t_6502_anal_esil_push (op, data[0]);\n\t\tbreak;\n\t// PLP,PLA\n\tcase 0x28: // plp\n\tcase 0x68: // plp\n\t\top->type = R_ANAL_OP_TYPE_POP;\n\t\top->cycles = 4;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -1;\n\t\t_6502_anal_esil_pop (op, data[0]);\n\t\tbreak;\n\t// TAX,TYA,...\n\tcase 0xaa: // tax\n\tcase 0x8a: // txa\n\tcase 0xa8: // tay\n\tcase 0x98: // tya\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\tcase 0x9a: // txs\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\top->stackop = R_ANAL_STACK_SET;\n\t\t// FIXME: should I get register X a place it here?\n\t\t// op->stackptr = get_register_x();\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\tcase 0xba: // tsx\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\top->stackop = R_ANAL_STACK_GET;\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\t}\n\treturn op->size;\n}","target":"static int _6502_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tchar addrbuf[64];\n\tconst int buffsize = sizeof (addrbuf) - 1;\n\n\tmemset (op, '\\0', sizeof (RAnalOp));\n\top->size = snes_op_get_size (1, 1, &snes_op[data[0]]);\t//snes-arch is similiar to nes/6502\n\top->addr = addr;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->id = data[0];\n\tr_strbuf_init (&op->esil);\n\tswitch (data[0]) {\n\tcase 0x02:\n\tcase 0x03:\n\tcase 0x04:\n\tcase 0x07:\n\tcase 0x0b:\n\tcase 0x0c:\n\tcase 0x0f:\n\tcase 0x12:\n\tcase 0x13:\n\tcase 0x14:\n\tcase 0x17:\n\tcase 0x1a:\n\tcase 0x1b:\n\tcase 0x1c:\n\tcase 0x1f:\n\tcase 0x22:\n\tcase 0x23:\n\tcase 0x27:\n\tcase 0x2b:\n\tcase 0x2f:\n\tcase 0x32:\n\tcase 0x33:\n\tcase 0x34:\n\tcase 0x37:\n\tcase 0x3a:\n\tcase 0x3b:\n\tcase 0x3c:\n\tcase 0x3f:\n\tcase 0x42:\n\tcase 0x43:\n\tcase 0x44:\n\tcase 0x47:\n\tcase 0x4b:\n\tcase 0x4f:\n\tcase 0x52:\n\tcase 0x53:\n\tcase 0x54:\n\tcase 0x57:\n\tcase 0x5a:\n\tcase 0x5b:\n\tcase 0x5c:\n\tcase 0x5f:\n\tcase 0x62:\n\tcase 0x63:\n\tcase 0x64:\n\tcase 0x67:\n\tcase 0x6b:\n\tcase 0x6f:\n\tcase 0x72:\n\tcase 0x73:\n\tcase 0x74:\n\tcase 0x77:\n\tcase 0x7a:\n\tcase 0x7b:\n\tcase 0x7c:\n\tcase 0x7f:\n\tcase 0x80:\n\tcase 0x82:\n\tcase 0x83:\n\tcase 0x87:\n\tcase 0x89:\n\tcase 0x8b:\n\tcase 0x8f:\n\tcase 0x92:\n\tcase 0x93:\n\tcase 0x97:\n\tcase 0x9b:\n\tcase 0x9c:\n\tcase 0x9e:\n\tcase 0x9f:\n\tcase 0xa3:\n\tcase 0xa7:\n\tcase 0xab:\n\tcase 0xaf:\n\tcase 0xb2:\n\tcase 0xb3:\n\tcase 0xb7:\n\tcase 0xbb:\n\tcase 0xbf:\n\tcase 0xc2:\n\tcase 0xc3:\n\tcase 0xc7:\n\tcase 0xcb:\n\tcase 0xcf:\n\tcase 0xd2:\n\tcase 0xd3:\n\tcase 0xd4:\n\tcase 0xd7:\n\tcase 0xda:\n\tcase 0xdb:\n\tcase 0xdc:\n\tcase 0xdf:\n\tcase 0xe2:\n\tcase 0xe3:\n\tcase 0xe7:\n\tcase 0xeb:\n\tcase 0xef:\n\tcase 0xf2:\n\tcase 0xf3:\n\tcase 0xf4:\n\tcase 0xf7:\n\tcase 0xfa:\n\tcase 0xfb:\n\tcase 0xfc:\n\tcase 0xff:\n\t\t// undocumented or not-implemented opcodes for 6502.\n\t\t// some of them might be implemented in 65816\n\t\top->size = 1;\n\t\top->type = R_ANAL_OP_TYPE_ILL;\n\t\tbreak;\n\n\t// BRK\n\tcase 0x00: // brk\n\t\top->cycles = 7;\n\t\top->type = R_ANAL_OP_TYPE_SWI;\n\t\t// override 65816 code which seems to be wrong: size is 1, but pc = pc + 2\n\t\top->size = 1;\n\t\t// PC + 2 to Stack, P to Stack B=1 D=0 I=1. \"B\" is not a flag. Only its bit is pushed on the stack\n\t\t// PC was already incremented by one at this point. Needs to incremented once more\n\t\t// New PC is Interrupt Vector: $fffe. (FIXME: Confirm this is valid for all 6502)\n\t\tr_strbuf_set (&op->esil, \",1,I,=,0,D,=,flags,0x10,|,0x100,sp,+,=[1],pc,1,+,0xfe,sp,+,=[2],3,sp,-=,0xfffe,[2],pc,=\");\n\t\tbreak;\n\n\t// FLAGS\n\tcase 0x78: // sei\n\tcase 0x58: // cli\n\tcase 0x38: // sec\n\tcase 0x18: // clc\n\tcase 0xf8: // sed\n\tcase 0xd8: // cld\n\tcase 0xb8: // clv\n\t\top->cycles = 2;\n\t\t// FIXME: what opcode for this?\n\t\top->type = R_ANAL_OP_TYPE_NOP;\n\t\t_6502_anal_esil_flags (op, data[0]);\n\t\tbreak;\n\t// BIT\n\tcase 0x24: // bit $ff\n\tcase 0x2c: // bit $ffff\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tr_strbuf_setf (&op->esil, \"a,%s,[1],&,0x80,&,!,!,N,=,a,%s,[1],&,0x40,&,!,!,V,=,a,%s,[1],&,0xff,&,!,Z,=\",addrbuf, addrbuf, addrbuf);\n\t\tbreak;\n\t// ADC\n\tcase 0x69: // adc #$ff\n\tcase 0x65: // adc $ff\n\tcase 0x75: // adc $ff,x\n\tcase 0x6d: // adc $ffff\n\tcase 0x7d: // adc $ffff,x\n\tcase 0x79: // adc $ffff,y\n\tcase 0x61: // adc ($ff,x)\n\tcase 0x71: // adc ($ff,y)\n\t\t// FIXME: update V\n\t\t// FIXME: support BCD mode\n\t\top->type = R_ANAL_OP_TYPE_ADD;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x69) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,+=,C,NUM,$c7,C,=,a,+=,$c7,C,|=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,+=,C,NUM,$c7,C,=,a,+=,$c7,C,|=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\t// fix Z\n\t\tr_strbuf_append (&op->esil, \",a,a,=,$z,Z,=\");\n\t\tbreak;\n\t// SBC\n\tcase 0xe9: // sbc #$ff\n\tcase 0xe5: // sbc $ff\n\tcase 0xf5: // sbc $ff,x\n\tcase 0xed: // sbc $ffff\n\tcase 0xfd: // sbc $ffff,x\n\tcase 0xf9: // sbc $ffff,y\n\tcase 0xe1: // sbc ($ff,x)\n\tcase 0xf1: // sbc ($ff,y)\n\t\t// FIXME: update V\n\t\t// FIXME: support BCD mode\n\t\top->type = R_ANAL_OP_TYPE_SUB;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xe9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"C,!,%s,+,a,-=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"C,!,%s,[1],+,a,-=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// fix Z and revert C\n\t\tr_strbuf_append (&op->esil, \",a,a,=,$z,Z,=,C,!=\");\n\t\tbreak;\n\t// ORA\n\tcase 0x09: // ora #$ff\n\tcase 0x05: // ora $ff\n\tcase 0x15: // ora $ff,x\n\tcase 0x0d: // ora $ffff\n\tcase 0x1d: // ora $ffff,x\n\tcase 0x19: // ora $ffff,y\n\tcase 0x01: // ora ($ff,x)\n\tcase 0x11: // ora ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_OR;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x09) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,|=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,|=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// AND\n\tcase 0x29: // and #$ff\n\tcase 0x25: // and $ff\n\tcase 0x35: // and $ff,x\n\tcase 0x2d: // and $ffff\n\tcase 0x3d: // and $ffff,x\n\tcase 0x39: // and $ffff,y\n\tcase 0x21: // and ($ff,x)\n\tcase 0x31: // and ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_AND;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x29) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,&=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,&=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// EOR\n\tcase 0x49: // eor #$ff\n\tcase 0x45: // eor $ff\n\tcase 0x55: // eor $ff,x\n\tcase 0x4d: // eor $ffff\n\tcase 0x5d: // eor $ffff,x\n\tcase 0x59: // eor $ffff,y\n\tcase 0x41: // eor ($ff,x)\n\tcase 0x51: // eor ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_XOR;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x49) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,^=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,^=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ASL\n\tcase 0x0a: // asl a\n\tcase 0x06: // asl $ff\n\tcase 0x16: // asl $ff,x\n\tcase 0x0e: // asl $ffff\n\tcase 0x1e: // asl $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_SHL;\n\t\tif (data[0] == 0x0a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,<<=,$c7,C,=,a,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],<<,%s,=[1],$c7,C,=\", addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LSR\n\tcase 0x4a: // lsr a\n\tcase 0x46: // lsr $ff\n\tcase 0x56: // lsr $ff,x\n\tcase 0x4e: // lsr $ffff\n\tcase 0x5e: // lsr $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_SHR;\n\t\tif (data[0] == 0x4a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,&,C,=,1,a,>>=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],&,C,=,1,%s,[1],>>,%s,=[1]\", addrbuf, addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ROL\n\tcase 0x2a: // rol a\n\tcase 0x26: // rol $ff\n\tcase 0x36: // rol $ff,x\n\tcase 0x2e: // rol $ffff\n\tcase 0x3e: // rol $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_ROL;\n\t\tif (data[0] == 0x2a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,<<,C,|,a,=,$c7,C,=,a,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],<<,C,|,%s,=[1],$c7,C,=\", addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ROR\n\tcase 0x6a: // ror a\n\tcase 0x66: // ror $ff\n\tcase 0x76: // ror $ff,x\n\tcase 0x6e: // ror $ffff\n\tcase 0x7e: // ror $ffff,x\n\t\t// uses N as temporary to hold C value. but in fact,\n\t\t// it is not temporary since in all ROR ops, N will have the value of C\n\t\top->type = R_ANAL_OP_TYPE_ROR;\n\t\tif (data[0] == 0x6a) {\n\t\t\tr_strbuf_set (&op->esil, \"C,N,=,1,a,&,C,=,1,a,>>,7,N,<<,|,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"C,N,=,1,%s,[1],&,C,=,1,%s,[1],>>,7,N,<<,|,%s,=[1]\", addrbuf, addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// INC\n\tcase 0xe6: // inc $ff\n\tcase 0xf6: // inc $ff,x\n\tcase 0xee: // inc $ffff\n\tcase 0xfe: // inc $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"%s,++=[1]\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// DEC\n\tcase 0xc6: // dec $ff\n\tcase 0xd6: // dec $ff,x\n\tcase 0xce: // dec $ffff\n\tcase 0xde: // dec $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"%s,--=[1]\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// INX, INY\n\tcase 0xe8: // inx\n\tcase 0xc8: // iny\n\t\top->cycles = 2;\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_inc_reg (op, data[0], \"+\");\n\t\tbreak;\n\t// DEX, DEY\n\tcase 0xca: // dex\n\tcase 0x88: // dey\n\t\top->cycles = 2;\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_inc_reg (op, data[0], \"-\");\n\t\tbreak;\n\t// CMP\n\tcase 0xc9: // cmp #$ff\n\tcase 0xc5: // cmp $ff\n\tcase 0xd5: // cmp $ff,x\n\tcase 0xcd: // cmp $ffff\n\tcase 0xdd: // cmp $ffff,x\n\tcase 0xd9: // cmp $ffff,y\n\tcase 0xc1: // cmp ($ff,x)\n\tcase 0xd1: // cmp ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xc9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// CPX\n\tcase 0xe0: // cpx #$ff\n\tcase 0xe4: // cpx $ff\n\tcase 0xec: // cpx $ffff\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tif (data[0] == 0xe0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,x,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],x,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// CPY\n\tcase 0xc0: // cpy #$ff\n\tcase 0xc4: // cpy $ff\n\tcase 0xcc: // cpy $ffff\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tif (data[0] == 0xc0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,y,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],y,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// BRANCHES\n\tcase 0x10: // bpl $ffff\n\tcase 0x30: // bmi $ffff\n\tcase 0x50: // bvc $ffff\n\tcase 0x70: // bvs $ffff\n\tcase 0x90: // bcc $ffff\n\tcase 0xb0: // bcs $ffff\n\tcase 0xd0: // bne $ffff\n\tcase 0xf0: // beq $ffff\n\t\t// FIXME: Add 1 if branch occurs to same page.\n\t\t// FIXME: Add 2 if branch occurs to different page\n\t\top->cycles = 2;\n\t\top->failcycles = 3;\n\t\top->type = R_ANAL_OP_TYPE_CJMP;\n\t\tif (len > 1) {\n\t\t\tif (data[1] <= 127) {\n\t\t\t\top->jump = addr + data[1] + op->size;\n\t\t\t} else {\n\t\t\t\top->jump = addr - (256 - data[1]) + op->size;\n\t\t\t}\n\t\t} else {\n\t\t\top->jump = addr;\n\t\t}\n\t\top->fail = addr + op->size;\n\t\t// FIXME: add a type of conditional\n\t\t// op->cond = R_ANAL_COND_LE;\n\t\t_6502_anal_esil_ccall (op, data[0]);\n\t\tbreak;\n\t// JSR\n\tcase 0x20: // jsr $ffff\n\t\top->cycles = 6;\n\t\top->type = R_ANAL_OP_TYPE_CALL;\n\t\top->jump = data[1] | data[2] << 8;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = 2;\n\t\t// JSR pushes the address-1 of the next operation on to the stack before transferring program\n\t\t// control to the following address\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_setf (&op->esil, \"1,pc,-,0xff,sp,+,=[2],0x%04x,pc,=,2,sp,-=\", op->jump);\n\t\tbreak;\n\t// JMP\n\tcase 0x4c: // jmp $ffff\n\t\top->cycles = 3;\n\t\top->type = R_ANAL_OP_TYPE_JMP;\n\t\top->jump = data[1] | data[2] << 8;\n\t\tr_strbuf_setf (&op->esil, \"0x%04x,pc,=\", op->jump);\n\t\tbreak;\n\tcase 0x6c: // jmp ($ffff)\n\t\top->cycles = 5;\n\t\top->type = R_ANAL_OP_TYPE_UJMP;\n\t\t// FIXME: how to read memory?\n\t\t// op->jump = data[1] | data[2] << 8;\n\t\tr_strbuf_setf (&op->esil, \"0x%04x,[2],pc,=\", data[1] | data[2] << 8);\n\t\tbreak;\n\t// RTS\n\tcase 0x60: // rts\n\t\top->eob = true;\n\t\top->type = R_ANAL_OP_TYPE_RET;\n\t\top->cycles = 6;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -2;\n\t\t// Operation: PC from Stack, PC + 1 -> PC\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_set (&op->esil, \"0x101,sp,+,[2],pc,=,pc,++=,2,sp,+=\");\n\t\tbreak;\n\t// RTI\n\tcase 0x40: // rti\n\t\top->eob = true;\n\t\top->type = R_ANAL_OP_TYPE_RET;\n\t\top->cycles = 6;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -3;\n\t\t// Operation: P from Stack, PC from Stack\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_set (&op->esil, \"0x101,sp,+,[1],flags,=,0x102,sp,+,[2],pc,=,3,sp,+=\");\n\t\tbreak;\n\t// NOP\n\tcase 0xea: // nop\n\t\top->type = R_ANAL_OP_TYPE_NOP;\n\t\top->cycles = 2;\n\t\tbreak;\n\t// LDA\n\tcase 0xa9: // lda #$ff\n\tcase 0xa5: // lda $ff\n\tcase 0xb5: // lda $ff,x\n\tcase 0xad: // lda $ffff\n\tcase 0xbd: // lda $ffff,x\n\tcase 0xb9: // lda $ffff,y\n\tcase 0xa1: // lda ($ff,x)\n\tcase 0xb1: // lda ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xa9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LDX\n\tcase 0xa2: // ldx #$ff\n\tcase 0xa6: // ldx $ff\n\tcase 0xb6: // ldx $ff,y\n\tcase 0xae: // ldx $ffff\n\tcase 0xbe: // ldx $ffff,y\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'y');\n\t\tif (data[0] == 0xa2) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,x,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],x,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LDY\n\tcase 0xa0: // ldy #$ff\n\tcase 0xa4: // ldy $ff\n\tcase 0xb4: // ldy $ff,x\n\tcase 0xac: // ldy $ffff\n\tcase 0xbc: // ldy $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 'x');\n\t\tif (data[0] == 0xa0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,y,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],y,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// STA\n\tcase 0x85: // sta $ff\n\tcase 0x95: // sta $ff,x\n\tcase 0x8d: // sta $ffff\n\tcase 0x9d: // sta $ffff,x\n\tcase 0x99: // sta $ffff,y\n\tcase 0x81: // sta ($ff,x)\n\tcase 0x91: // sta ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tr_strbuf_setf (&op->esil, \"a,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// STX\n\tcase 0x86: // stx $ff\n\tcase 0x96: // stx $ff,y\n\tcase 0x8e: // stx $ffff\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'y');\n\t\tr_strbuf_setf (&op->esil, \"x,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// STY\n\tcase 0x84: // sty $ff\n\tcase 0x94: // sty $ff,x\n\tcase 0x8c: // sty $ffff\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"y,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// PHP/PHA\n\tcase 0x08: // php\n\tcase 0x48: // pha\n\t\top->type = R_ANAL_OP_TYPE_PUSH;\n\t\top->cycles = 3;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = 1;\n\t\t_6502_anal_esil_push (op, data[0]);\n\t\tbreak;\n\t// PLP,PLA\n\tcase 0x28: // plp\n\tcase 0x68: // plp\n\t\top->type = R_ANAL_OP_TYPE_POP;\n\t\top->cycles = 4;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -1;\n\t\t_6502_anal_esil_pop (op, data[0]);\n\t\tbreak;\n\t// TAX,TYA,...\n\tcase 0xaa: // tax\n\tcase 0x8a: // txa\n\tcase 0xa8: // tay\n\tcase 0x98: // tya\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\tcase 0x9a: // txs\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\top->stackop = R_ANAL_STACK_SET;\n\t\t// FIXME: should I get register X a place it here?\n\t\t// op->stackptr = get_register_x();\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\tcase 0xba: // tsx\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\top->stackop = R_ANAL_STACK_GET;\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\t}\n\treturn op->size;\n}","lang":"c","vul_type":"cwe-125","target_token_count":7215,"sven_meta":{"func_name":"_6502_op","file_name":"libr/anal/p/anal_6502.c","commit_link":"github.com/radare/radare2/commit/bbb4af56003c1afdad67af0c4339267ca38b1017","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#66-22f1603b5254","input":"static int string_scan_range(RList *list, RBinFile *bf, int min,\n\t\t\t const ut64 from, const ut64 to, int type) {\n\tut8 tmp[R_STRING_SCAN_BUFFER_SIZE];\n\tut64 str_start, needle = from;\n\tint count = 0, i, rc, runes;\n\tint str_type = R_STRING_TYPE_DETECT;\n\n\tif (type == -1) {\n\t\ttype = R_STRING_TYPE_DETECT;\n\t}\n\tif (from >= to) {\n\t\teprintf (\"Invalid range to find strings 0x%llx .. 0x%llx\\n\", from, to);\n\t\treturn -1;\n\t}\n\tut8 *buf = calloc (to - from, 1);\n\tif (!buf || !min) {\n\t\treturn -1;\n\t}\n\tr_buf_read_at (bf->buf, from, buf, to - from);\n\t// may oobread\n\twhile (needle < to) {\n\t\trc = r_utf8_decode (buf + needle - from, to - needle, NULL);\n\t\tif (!rc) {\n\t\t\tneedle++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (type == R_STRING_TYPE_DETECT) {\n\t\t\tchar *w = (char *)buf + needle + rc - from;\n\t\t\tif ((to - needle) > 5) {\n\t\t\t\tbool is_wide32 = needle + rc + 2 < to && !w[0] && !w[1] && !w[2] && w[3] && !w[4];\n\t\t\t\tif (is_wide32) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_WIDE32;\n\t\t\t\t} else {\n\t\t\t\t\tbool is_wide = needle + rc + 2 < to && !w[0] && w[1] && !w[2];\n\t\t\t\t\tstr_type = is_wide? R_STRING_TYPE_WIDE: R_STRING_TYPE_ASCII;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr_type = R_STRING_TYPE_ASCII;\n\t\t\t}\n\t\t} else {\n\t\t\tstr_type = type;\n\t\t}\n\t\trunes = 0;\n\t\tstr_start = needle;\n\n\t\t/* Eat a whole C string */\n\t\tfor (rc = i = 0; i < sizeof (tmp) - 3 && needle < to; i += rc) {\n\t\t\tRRune r = {0};\n\n\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\trc = r_utf32le_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc) {\n\t\t\t\t\trc = 4;\n\t\t\t\t}\n\t\t\t} else if (str_type == R_STRING_TYPE_WIDE) {\n\t\t\t\trc = r_utf16le_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc == 1) {\n\t\t\t\t\trc = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trc = r_utf8_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc > 1) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_UTF8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Invalid sequence detected */\n\t\t\tif (!rc) {\n\t\t\t\tneedle++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tneedle += rc;\n\n\t\t\tif (r_isprint (r) && r != '\\\\') {\n\t\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\t\tif (r == 0xff) {\n\t\t\t\t\t\tr = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trc = r_utf8_encode (&tmp[i], r);\n\t\t\t\trunes++;\n\t\t\t\t/* Print the escape code */\n\t\t\t} else if (r && r < 0x100 && strchr (\"\\b\\v\\f\\n\\r\\t\\a\\033\\\\\", (char)r)) {\n\t\t\t\tif ((i + 32) < sizeof (tmp) && r < 93) {\n\t\t\t\t\ttmp[i + 0] = '\\\\';\n\t\t\t\t\ttmp[i + 1] = \" abtnvfr e \"\n\t\t\t\t\t \" \"\n\t\t\t\t\t \" \"\n\t\t\t\t\t \" \\\\\"[r];\n\t\t\t\t} else {\n\t\t\t\t\t// string too long\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\trc = 2;\n\t\t\t\trunes++;\n\t\t\t} else {\n\t\t\t\t/* \\0 marks the end of C-strings */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\ttmp[i++] = '\\0';\n\n\t\tif (runes >= min) {\n\t\t\tif (str_type == R_STRING_TYPE_ASCII) {\n\t\t\t\t// reduce false positives\n\t\t\t\tint j;\n\t\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t\t\tchar ch = tmp[j];\n\t\t\t\t\tif (ch != '\\n' && ch != '\\r' && ch != '\\t') {\n\t\t\t\t\t\tif (!IS_PRINTABLE (tmp[j])) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tRBinString *bs = R_NEW0 (RBinString);\n\t\t\tif (!bs) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbs->type = str_type;\n\t\t\tbs->length = runes;\n\t\t\tbs->size = needle - str_start;\n\t\t\tbs->ordinal = count++;\n\t\t\t// TODO: move into adjust_offset\n\t\t\tswitch (str_type) {\n\t\t\tcase R_STRING_TYPE_WIDE:\n\t\t\t\tif (str_start -from> 1) {\n\t\t\t\t\tconst ut8 *p = buf + str_start - 2 - from;\n\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\tstr_start -= 2; // \\xff\\xfe\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase R_STRING_TYPE_WIDE32:\n\t\t\t\tif (str_start -from> 3) {\n\t\t\t\t\tconst ut8 *p = buf + str_start - 4 - from;\n\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\tstr_start -= 4; // \\xff\\xfe\\x00\\x00\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbs->paddr = bs->vaddr = str_start;\n\t\t\tbs->string = r_str_ndup ((const char *)tmp, i);\n\t\t\tif (list) {\n\t\t\t\tr_list_append (list, bs);\n\t\t\t} else {\n\t\t\t\tprint_string (bs, bf);\n\t\t\t\tr_bin_string_free (bs);\n\t\t\t}\n\t\t}\n\t}\n\tfree (buf);\n\treturn count;\n}","target":"static int string_scan_range(RList *list, RBinFile *bf, int min,\n\t\t\t const ut64 from, const ut64 to, int type) {\n\tut8 tmp[R_STRING_SCAN_BUFFER_SIZE];\n\tut64 str_start, needle = from;\n\tint count = 0, i, rc, runes;\n\tint str_type = R_STRING_TYPE_DETECT;\n\n\tif (type == -1) {\n\t\ttype = R_STRING_TYPE_DETECT;\n\t}\n\tif (from >= to) {\n\t\teprintf (\"Invalid range to find strings 0x%llx .. 0x%llx\\n\", from, to);\n\t\treturn -1;\n\t}\n\tint len = to - from;\n\tut8 *buf = calloc (len, 1);\n\tif (!buf || !min) {\n\t\treturn -1;\n\t}\n\tr_buf_read_at (bf->buf, from, buf, len);\n\t// may oobread\n\twhile (needle < to) {\n\t\trc = r_utf8_decode (buf + needle - from, to - needle, NULL);\n\t\tif (!rc) {\n\t\t\tneedle++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (type == R_STRING_TYPE_DETECT) {\n\t\t\tchar *w = (char *)buf + needle + rc - from;\n\t\t\tif ((to - needle) > 5 + rc) {\n\t\t\t\tbool is_wide32 = (needle + rc + 2 < to) && (!w[0] && !w[1] && !w[2] && w[3] && !w[4]);\n\t\t\t\tif (is_wide32) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_WIDE32;\n\t\t\t\t} else {\n\t\t\t\t\tbool is_wide = needle + rc + 2 < to && !w[0] && w[1] && !w[2];\n\t\t\t\t\tstr_type = is_wide? R_STRING_TYPE_WIDE: R_STRING_TYPE_ASCII;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr_type = R_STRING_TYPE_ASCII;\n\t\t\t}\n\t\t} else {\n\t\t\tstr_type = type;\n\t\t}\n\t\trunes = 0;\n\t\tstr_start = needle;\n\n\t\t/* Eat a whole C string */\n\t\tfor (rc = i = 0; i < sizeof (tmp) - 3 && needle < to; i += rc) {\n\t\t\tRRune r = {0};\n\n\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\trc = r_utf32le_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc) {\n\t\t\t\t\trc = 4;\n\t\t\t\t}\n\t\t\t} else if (str_type == R_STRING_TYPE_WIDE) {\n\t\t\t\trc = r_utf16le_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc == 1) {\n\t\t\t\t\trc = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trc = r_utf8_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc > 1) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_UTF8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Invalid sequence detected */\n\t\t\tif (!rc) {\n\t\t\t\tneedle++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tneedle += rc;\n\n\t\t\tif (r_isprint (r) && r != '\\\\') {\n\t\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\t\tif (r == 0xff) {\n\t\t\t\t\t\tr = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trc = r_utf8_encode (&tmp[i], r);\n\t\t\t\trunes++;\n\t\t\t\t/* Print the escape code */\n\t\t\t} else if (r && r < 0x100 && strchr (\"\\b\\v\\f\\n\\r\\t\\a\\033\\\\\", (char)r)) {\n\t\t\t\tif ((i + 32) < sizeof (tmp) && r < 93) {\n\t\t\t\t\ttmp[i + 0] = '\\\\';\n\t\t\t\t\ttmp[i + 1] = \" abtnvfr e \"\n\t\t\t\t\t \" \"\n\t\t\t\t\t \" \"\n\t\t\t\t\t \" \\\\\"[r];\n\t\t\t\t} else {\n\t\t\t\t\t// string too long\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\trc = 2;\n\t\t\t\trunes++;\n\t\t\t} else {\n\t\t\t\t/* \\0 marks the end of C-strings */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\ttmp[i++] = '\\0';\n\n\t\tif (runes >= min) {\n\t\t\tif (str_type == R_STRING_TYPE_ASCII) {\n\t\t\t\t// reduce false positives\n\t\t\t\tint j;\n\t\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t\t\tchar ch = tmp[j];\n\t\t\t\t\tif (ch != '\\n' && ch != '\\r' && ch != '\\t') {\n\t\t\t\t\t\tif (!IS_PRINTABLE (tmp[j])) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tRBinString *bs = R_NEW0 (RBinString);\n\t\t\tif (!bs) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbs->type = str_type;\n\t\t\tbs->length = runes;\n\t\t\tbs->size = needle - str_start;\n\t\t\tbs->ordinal = count++;\n\t\t\t// TODO: move into adjust_offset\n\t\t\tswitch (str_type) {\n\t\t\tcase R_STRING_TYPE_WIDE:\n\t\t\t\tif (str_start -from> 1) {\n\t\t\t\t\tconst ut8 *p = buf + str_start - 2 - from;\n\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\tstr_start -= 2; // \\xff\\xfe\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase R_STRING_TYPE_WIDE32:\n\t\t\t\tif (str_start -from> 3) {\n\t\t\t\t\tconst ut8 *p = buf + str_start - 4 - from;\n\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\tstr_start -= 4; // \\xff\\xfe\\x00\\x00\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbs->paddr = bs->vaddr = str_start;\n\t\t\tbs->string = r_str_ndup ((const char *)tmp, i);\n\t\t\tif (list) {\n\t\t\t\tr_list_append (list, bs);\n\t\t\t} else {\n\t\t\t\tprint_string (bs, bf);\n\t\t\t\tr_bin_string_free (bs);\n\t\t\t}\n\t\t}\n\t}\n\tfree (buf);\n\treturn count;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1364,"sven_meta":{"func_name":"string_scan_range","file_name":"libr/bin/file.c","commit_link":"github.com/radare/radare2/commit/3fcf41ed96ffa25b38029449520c8d0a198745f3","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#67-b7bc4ae65f4b","input":"static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,\n\tstruct dvb_diseqc_master_cmd *d)\n{\n\tstruct cx24116_state *state = fe->demodulator_priv;\n\tint i, ret;\n\n\t/* Dump DiSEqC message */\n\tif (debug) {\n\t\tprintk(KERN_INFO \"cx24116: %s(\", __func__);\n\t\tfor (i = 0 ; i < d->msg_len ;) {\n\t\t\tprintk(KERN_INFO \"0x%02x\", d->msg[i]);\n\t\t\tif (++i < d->msg_len)\n\t\t\t\tprintk(KERN_INFO \", \");\n\t\t}\n\t\tprintk(\") toneburst=%d\\n\", toneburst);\n\t}\n\n\t/* Validate length */\n\tif (d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS))\n\t\treturn -EINVAL;\n\n\t/* DiSEqC message */\n\tfor (i = 0; i < d->msg_len; i++)\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i];\n\n\t/* DiSEqC message length */\n\tstate->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = d->msg_len;\n\n\t/* Command length */\n\tstate->dsec_cmd.len = CX24116_DISEQC_MSGOFS +\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_MSGLEN];\n\n\t/* DiSEqC toneburst */\n\tif (toneburst == CX24116_DISEQC_MESGCACHE)\n\t\t/* Message is cached */\n\t\treturn 0;\n\n\telse if (toneburst == CX24116_DISEQC_TONEOFF)\n\t\t/* Message is sent without burst */\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST] = 0;\n\n\telse if (toneburst == CX24116_DISEQC_TONECACHE) {\n\t\t/*\n\t\t * Message is sent with derived else cached burst\n\t\t *\n\t\t * WRITE PORT GROUP COMMAND 38\n\t\t *\n\t\t * 0/A/A: E0 10 38 F0..F3\n\t\t * 1/B/B: E0 10 38 F4..F7\n\t\t * 2/C/A: E0 10 38 F8..FB\n\t\t * 3/D/B: E0 10 38 FC..FF\n\t\t *\n\t\t * databyte[3]= 8421:8421\n\t\t * ABCD:WXYZ\n\t\t * CLR :SET\n\t\t *\n\t\t * WX= PORT SELECT 0..3 (X=TONEBURST)\n\t\t * Y = VOLTAGE (0=13V, 1=18V)\n\t\t * Z = BAND (0=LOW, 1=HIGH(22K))\n\t\t */\n\t\tif (d->msg_len >= 4 && d->msg[2] == 0x38)\n\t\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST] =\n\t\t\t\t((d->msg[3] & 4) >> 2);\n\t\tif (debug)\n\t\t\tdprintk(\"%s burst=%d\\n\", __func__,\n\t\t\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST]);\n\t}\n\n\t/* Wait for LNB ready */\n\tret = cx24116_wait_for_lnb(fe);\n\tif (ret != 0)\n\t\treturn ret;\n\n\t/* Wait for voltage/min repeat delay */\n\tmsleep(100);\n\n\t/* Command */\n\tret = cx24116_cmd_execute(fe, &state->dsec_cmd);\n\tif (ret != 0)\n\t\treturn ret;\n\t/*\n\t * Wait for send\n\t *\n\t * Eutelsat spec:\n\t * >15ms delay + (XXX determine if FW does this, see set_tone)\n\t * 13.5ms per byte +\n\t * >15ms delay +\n\t * 12.5ms burst +\n\t * >15ms delay (XXX determine if FW does this, see set_tone)\n\t */\n\tmsleep((state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) +\n\t\t((toneburst == CX24116_DISEQC_TONEOFF) ? 30 : 60));\n\n\treturn 0;\n}","target":"static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,\n\tstruct dvb_diseqc_master_cmd *d)\n{\n\tstruct cx24116_state *state = fe->demodulator_priv;\n\tint i, ret;\n\n\t/* Validate length */\n\tif (d->msg_len > sizeof(d->msg))\n return -EINVAL;\n\n\t/* Dump DiSEqC message */\n\tif (debug) {\n\t\tprintk(KERN_INFO \"cx24116: %s(\", __func__);\n\t\tfor (i = 0 ; i < d->msg_len ;) {\n\t\t\tprintk(KERN_INFO \"0x%02x\", d->msg[i]);\n\t\t\tif (++i < d->msg_len)\n\t\t\t\tprintk(KERN_INFO \", \");\n\t\t}\n\t\tprintk(\") toneburst=%d\\n\", toneburst);\n\t}\n\n\t/* DiSEqC message */\n\tfor (i = 0; i < d->msg_len; i++)\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i];\n\n\t/* DiSEqC message length */\n\tstate->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = d->msg_len;\n\n\t/* Command length */\n\tstate->dsec_cmd.len = CX24116_DISEQC_MSGOFS +\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_MSGLEN];\n\n\t/* DiSEqC toneburst */\n\tif (toneburst == CX24116_DISEQC_MESGCACHE)\n\t\t/* Message is cached */\n\t\treturn 0;\n\n\telse if (toneburst == CX24116_DISEQC_TONEOFF)\n\t\t/* Message is sent without burst */\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST] = 0;\n\n\telse if (toneburst == CX24116_DISEQC_TONECACHE) {\n\t\t/*\n\t\t * Message is sent with derived else cached burst\n\t\t *\n\t\t * WRITE PORT GROUP COMMAND 38\n\t\t *\n\t\t * 0/A/A: E0 10 38 F0..F3\n\t\t * 1/B/B: E0 10 38 F4..F7\n\t\t * 2/C/A: E0 10 38 F8..FB\n\t\t * 3/D/B: E0 10 38 FC..FF\n\t\t *\n\t\t * databyte[3]= 8421:8421\n\t\t * ABCD:WXYZ\n\t\t * CLR :SET\n\t\t *\n\t\t * WX= PORT SELECT 0..3 (X=TONEBURST)\n\t\t * Y = VOLTAGE (0=13V, 1=18V)\n\t\t * Z = BAND (0=LOW, 1=HIGH(22K))\n\t\t */\n\t\tif (d->msg_len >= 4 && d->msg[2] == 0x38)\n\t\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST] =\n\t\t\t\t((d->msg[3] & 4) >> 2);\n\t\tif (debug)\n\t\t\tdprintk(\"%s burst=%d\\n\", __func__,\n\t\t\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST]);\n\t}\n\n\t/* Wait for LNB ready */\n\tret = cx24116_wait_for_lnb(fe);\n\tif (ret != 0)\n\t\treturn ret;\n\n\t/* Wait for voltage/min repeat delay */\n\tmsleep(100);\n\n\t/* Command */\n\tret = cx24116_cmd_execute(fe, &state->dsec_cmd);\n\tif (ret != 0)\n\t\treturn ret;\n\t/*\n\t * Wait for send\n\t *\n\t * Eutelsat spec:\n\t * >15ms delay + (XXX determine if FW does this, see set_tone)\n\t * 13.5ms per byte +\n\t * >15ms delay +\n\t * 12.5ms burst +\n\t * >15ms delay (XXX determine if FW does this, see set_tone)\n\t */\n\tmsleep((state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) +\n\t\t((toneburst == CX24116_DISEQC_TONEOFF) ? 30 : 60));\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":978,"sven_meta":{"func_name":"cx24116_send_diseqc_msg","file_name":"drivers/media/dvb-frontends/cx24116.c","commit_link":"github.com/torvalds/linux/commit/1fa2337a315a2448c5434f41e00d56b01a22283c","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#68-580aee745a26","input":"void MAPIPrint(MAPIProps *p) {\n int j, i, index, h, x;\n DDWORD *ddword_ptr;\n DDWORD ddword_tmp;\n dtr thedate;\n MAPIProperty *mapi;\n variableLength *mapidata;\n variableLength vlTemp;\n int found;\n\n for (j = 0; j < p->count; j++) {\n mapi = &(p->properties[j]);\n printf(\" #%i: Type: [\", j);\n switch (PROP_TYPE(mapi->id)) {\n case PT_UNSPECIFIED:\n printf(\" NONE \"); break;\n case PT_NULL:\n printf(\" NULL \"); break;\n case PT_I2:\n printf(\" I2 \"); break;\n case PT_LONG:\n printf(\" LONG \"); break;\n case PT_R4:\n printf(\" R4 \"); break;\n case PT_DOUBLE:\n printf(\" DOUBLE \"); break;\n case PT_CURRENCY:\n printf(\"CURRENCY \"); break;\n case PT_APPTIME:\n printf(\"APP TIME \"); break;\n case PT_ERROR:\n printf(\" ERROR \"); break;\n case PT_BOOLEAN:\n printf(\" BOOLEAN \"); break;\n case PT_OBJECT:\n printf(\" OBJECT \"); break;\n case PT_I8:\n printf(\" I8 \"); break;\n case PT_STRING8:\n printf(\" STRING8 \"); break;\n case PT_UNICODE:\n printf(\" UNICODE \"); break;\n case PT_SYSTIME:\n printf(\"SYS TIME \"); break;\n case PT_CLSID:\n printf(\"OLE GUID \"); break;\n case PT_BINARY:\n printf(\" BINARY \"); break;\n default:\n printf(\"<%x>\", PROP_TYPE(mapi->id)); break;\n }\n\n printf(\"] Code: [\");\n if (mapi->custom == 1) {\n printf(\"UD:x%04x\", PROP_ID(mapi->id));\n } else {\n found = 0;\n for (index = 0; index < sizeof(MPList) / sizeof(MAPIPropertyTagList); index++) {\n if ((MPList[index].id == PROP_ID(mapi->id)) && (found == 0)) {\n printf(\"%s\", MPList[index].name);\n found = 1;\n }\n }\n if (found == 0) {\n printf(\"0x%04x\", PROP_ID(mapi->id));\n }\n }\n printf(\"]\\n\");\n if (mapi->namedproperty > 0) {\n for (i = 0; i < mapi->namedproperty; i++) {\n printf(\" Name: %s\\n\", mapi->propnames[i].data);\n }\n }\n for (i = 0; i < mapi->count; i++) {\n mapidata = &(mapi->data[i]);\n if (mapi->count > 1) {\n printf(\" [%i/%u] \", i, mapi->count);\n } else {\n printf(\" \");\n }\n printf(\"Size: %i\", mapidata->size);\n switch (PROP_TYPE(mapi->id)) {\n case PT_SYSTIME:\n MAPISysTimetoDTR(mapidata->data, &thedate);\n printf(\" Value: \");\n ddword_tmp = *((DDWORD *)mapidata->data);\n TNEFPrintDate(thedate);\n printf(\" [HEX: \");\n for (x = 0; x < sizeof(ddword_tmp); x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"] (%llu)\\n\", ddword_tmp);\n break;\n case PT_LONG:\n printf(\" Value: %li\\n\", *((long*)mapidata->data));\n break;\n case PT_I2:\n printf(\" Value: %hi\\n\", *((short int*)mapidata->data));\n break;\n case PT_BOOLEAN:\n if (mapi->data->data[0] != 0) {\n printf(\" Value: True\\n\");\n } else {\n printf(\" Value: False\\n\");\n }\n break;\n case PT_OBJECT:\n printf(\"\\n\");\n break;\n case PT_BINARY:\n if (IsCompressedRTF(mapidata) == 1) {\n printf(\" Detected Compressed RTF. \");\n printf(\"Decompressed text follows\\n\");\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n if ((vlTemp.data = (BYTE*)DecompressRTF(mapidata, &(vlTemp.size))) != NULL) {\n printf(\"%s\\n\", vlTemp.data);\n free(vlTemp.data);\n }\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n } else {\n printf(\" Value: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }\n\n }\n printf(\"]\\n\");\n }\n break;\n case PT_STRING8:\n printf(\" Value: [%s]\\n\", mapidata->data);\n if (strlen((char*)mapidata->data) != mapidata->size - 1) {\n printf(\"Detected Hidden data: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }\n\n }\n printf(\"]\\n\");\n }\n break;\n case PT_CLSID:\n printf(\" Value: \");\n printf(\"[HEX: \");\n for(x=0; x< 16; x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"]\\n\");\n break;\n default:\n printf(\" Value: [%s]\\n\", mapidata->data);\n }\n }\n }\n}","target":"void MAPIPrint(MAPIProps *p) {\n int j, i, index, h, x;\n DDWORD *ddword_ptr;\n DDWORD ddword_tmp;\n dtr thedate;\n MAPIProperty *mapi;\n variableLength *mapidata;\n variableLength vlTemp;\n int found;\n\n for (j = 0; j < p->count; j++) {\n mapi = &(p->properties[j]);\n printf(\" #%i: Type: [\", j);\n switch (PROP_TYPE(mapi->id)) {\n case PT_UNSPECIFIED:\n printf(\" NONE \"); break;\n case PT_NULL:\n printf(\" NULL \"); break;\n case PT_I2:\n printf(\" I2 \"); break;\n case PT_LONG:\n printf(\" LONG \"); break;\n case PT_R4:\n printf(\" R4 \"); break;\n case PT_DOUBLE:\n printf(\" DOUBLE \"); break;\n case PT_CURRENCY:\n printf(\"CURRENCY \"); break;\n case PT_APPTIME:\n printf(\"APP TIME \"); break;\n case PT_ERROR:\n printf(\" ERROR \"); break;\n case PT_BOOLEAN:\n printf(\" BOOLEAN \"); break;\n case PT_OBJECT:\n printf(\" OBJECT \"); break;\n case PT_I8:\n printf(\" I8 \"); break;\n case PT_STRING8:\n printf(\" STRING8 \"); break;\n case PT_UNICODE:\n printf(\" UNICODE \"); break;\n case PT_SYSTIME:\n printf(\"SYS TIME \"); break;\n case PT_CLSID:\n printf(\"OLE GUID \"); break;\n case PT_BINARY:\n printf(\" BINARY \"); break;\n default:\n printf(\"<%x>\", PROP_TYPE(mapi->id)); break;\n }\n\n printf(\"] Code: [\");\n if (mapi->custom == 1) {\n printf(\"UD:x%04x\", PROP_ID(mapi->id));\n } else {\n found = 0;\n for (index = 0; index < sizeof(MPList) / sizeof(MAPIPropertyTagList); index++) {\n if ((MPList[index].id == PROP_ID(mapi->id)) && (found == 0)) {\n printf(\"%s\", MPList[index].name);\n found = 1;\n }\n }\n if (found == 0) {\n printf(\"0x%04x\", PROP_ID(mapi->id));\n }\n }\n printf(\"]\\n\");\n if (mapi->namedproperty > 0) {\n for (i = 0; i < mapi->namedproperty; i++) {\n printf(\" Name: %s\\n\", mapi->propnames[i].data);\n }\n }\n for (i = 0; i < mapi->count; i++) {\n mapidata = &(mapi->data[i]);\n if (mapi->count > 1) {\n printf(\" [%i/%u] \", i, mapi->count);\n } else {\n printf(\" \");\n }\n printf(\"Size: %i\", mapidata->size);\n switch (PROP_TYPE(mapi->id)) {\n case PT_SYSTIME:\n MAPISysTimetoDTR(mapidata->data, &thedate);\n printf(\" Value: \");\n ddword_tmp = *((DDWORD *)mapidata->data);\n TNEFPrintDate(thedate);\n printf(\" [HEX: \");\n for (x = 0; x < sizeof(ddword_tmp); x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"] (%llu)\\n\", ddword_tmp);\n break;\n case PT_LONG:\n printf(\" Value: %i\\n\", *((int*)mapidata->data));\n break;\n case PT_I2:\n printf(\" Value: %hi\\n\", *((short int*)mapidata->data));\n break;\n case PT_BOOLEAN:\n if (mapi->data->data[0] != 0) {\n printf(\" Value: True\\n\");\n } else {\n printf(\" Value: False\\n\");\n }\n break;\n case PT_OBJECT:\n printf(\"\\n\");\n break;\n case PT_BINARY:\n if (IsCompressedRTF(mapidata) == 1) {\n printf(\" Detected Compressed RTF. \");\n printf(\"Decompressed text follows\\n\");\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n if ((vlTemp.data = (BYTE*)DecompressRTF(mapidata, &(vlTemp.size))) != NULL) {\n printf(\"%s\\n\", vlTemp.data);\n free(vlTemp.data);\n }\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n } else {\n printf(\" Value: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }\n\n }\n printf(\"]\\n\");\n }\n break;\n case PT_STRING8:\n printf(\" Value: [%s]\\n\", mapidata->data);\n if (strlen((char*)mapidata->data) != mapidata->size - 1) {\n printf(\"Detected Hidden data: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }\n\n }\n printf(\"]\\n\");\n }\n break;\n case PT_CLSID:\n printf(\" Value: \");\n printf(\"[HEX: \");\n for(x=0; x< 16; x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"]\\n\");\n break;\n default:\n printf(\" Value: [%s]\\n\", mapidata->data);\n }\n }\n }\n}","lang":"c","vul_type":"cwe-125","target_token_count":1306,"sven_meta":{"func_name":"MAPIPrint","file_name":"lib/ytnef.c","commit_link":"github.com/Yeraze/ytnef/commit/f98f5d4adc1c4bd4033638f6167c1bb95d642f89","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#69-a16ac7ebbc25","input":"static int readContigTilesIntoBuffer (TIFF* in, uint8* buf, \n uint32 imagelength, \n uint32 imagewidth, \n uint32 tw, uint32 tl,\n tsample_t spp, uint16 bps)\n {\n int status = 1;\n tsample_t sample = 0;\n tsample_t count = spp; \n uint32 row, col, trow;\n uint32 nrow, ncol;\n uint32 dst_rowsize, shift_width;\n uint32 bytes_per_sample, bytes_per_pixel;\n uint32 trailing_bits, prev_trailing_bits;\n uint32 tile_rowsize = TIFFTileRowSize(in);\n uint32 src_offset, dst_offset;\n uint32 row_offset, col_offset;\n uint8 *bufp = (uint8*) buf;\n unsigned char *src = NULL;\n unsigned char *dst = NULL;\n tsize_t tbytes = 0, tile_buffsize = 0;\n tsize_t tilesize = TIFFTileSize(in);\n unsigned char *tilebuf = NULL;\n\n bytes_per_sample = (bps + 7) / 8; \n bytes_per_pixel = ((bps * spp) + 7) / 8;\n\n if ((bps % 8) == 0)\n shift_width = 0;\n else\n {\n if (bytes_per_pixel < (bytes_per_sample + 1))\n shift_width = bytes_per_pixel;\n else\n shift_width = bytes_per_sample + 1;\n }\n\n tile_buffsize = tilesize;\n if (tilesize == 0 || tile_rowsize == 0)\n {\n TIFFError(\"readContigTilesIntoBuffer\", \"Tile size or tile rowsize is zero\");\n exit(-1);\n }\n\n if (tilesize < (tsize_t)(tl * tile_rowsize))\n {\n#ifdef DEBUG2\n TIFFError(\"readContigTilesIntoBuffer\",\n\t \"Tilesize %lu is too small, using alternate calculation %u\",\n tilesize, tl * tile_rowsize);\n#endif\n tile_buffsize = tl * tile_rowsize;\n if (tl != (tile_buffsize / tile_rowsize))\n {\n \tTIFFError(\"readContigTilesIntoBuffer\", \"Integer overflow when calculating buffer size.\");\n exit(-1);\n }\n }\n\n tilebuf = _TIFFmalloc(tile_buffsize);\n if (tilebuf == 0)\n return 0;\n\n dst_rowsize = ((imagewidth * bps * spp) + 7) / 8; \n for (row = 0; row < imagelength; row += tl)\n {\n nrow = (row + tl > imagelength) ? imagelength - row : tl;\n for (col = 0; col < imagewidth; col += tw)\n {\n tbytes = TIFFReadTile(in, tilebuf, col, row, 0, 0);\n if (tbytes < tilesize && !ignore)\n {\n\tTIFFError(TIFFFileName(in),\n\t\t \"Error, can't read tile at row %lu col %lu, Read %lu bytes of %lu\",\n\t\t (unsigned long) col, (unsigned long) row, (unsigned long)tbytes,\n (unsigned long)tilesize);\n\t\t status = 0;\n _TIFFfree(tilebuf);\n\t\t return status;\n\t}\n \n row_offset = row * dst_rowsize;\n col_offset = ((col * bps * spp) + 7)/ 8;\n bufp = buf + row_offset + col_offset;\n\n if (col + tw > imagewidth)\n\tncol = imagewidth - col;\n else\n ncol = tw;\n\n /* Each tile scanline will start on a byte boundary but it\n * has to be merged into the scanline for the entire\n * image buffer and the previous segment may not have\n * ended on a byte boundary\n */\n /* Optimization for common bit depths, all samples */\n if (((bps % 8) == 0) && (count == spp))\n {\n\tfor (trow = 0; trow < nrow; trow++)\n {\n\t src_offset = trow * tile_rowsize;\n\t _TIFFmemcpy (bufp, tilebuf + src_offset, (ncol * spp * bps) / 8);\n bufp += (imagewidth * bps * spp) / 8;\n\t }\n }\n else\n {\n\t/* Bit depths not a multiple of 8 and/or extract fewer than spp samples */\n prev_trailing_bits = trailing_bits = 0;\n trailing_bits = (ncol * bps * spp) % 8;\n\n\t/*\tfor (trow = 0; tl < nrow; trow++) */\n\tfor (trow = 0; trow < nrow; trow++)\n {\n\t src_offset = trow * tile_rowsize;\n src = tilebuf + src_offset;\n\t dst_offset = (row + trow) * dst_rowsize;\n dst = buf + dst_offset + col_offset;\n switch (shift_width)\n {\n case 0: if (extractContigSamplesBytes (src, dst, ncol, sample,\n spp, bps, count, 0, ncol))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t\trow, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n case 1: if (bps == 1)\n { \n if (extractContigSamplesShifted8bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t\t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n\t\t }\n else\n if (extractContigSamplesShifted16bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t \t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t break;\n case 2: if (extractContigSamplesShifted24bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t \t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n case 3:\n case 4:\n case 5: if (extractContigSamplesShifted32bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n default: TIFFError(\"readContigTilesIntoBuffer\", \"Unsupported bit depth %d\", bps);\n\t\t return 1;\n\t }\n }\n prev_trailing_bits += trailing_bits;\n /* if (prev_trailing_bits > 7) */\n\t/* prev_trailing_bits-= 8; */\n\t}\n }\n }\n\n _TIFFfree(tilebuf);\n return status;\n }","target":"static int readContigTilesIntoBuffer (TIFF* in, uint8* buf, \n uint32 imagelength, \n uint32 imagewidth, \n uint32 tw, uint32 tl,\n tsample_t spp, uint16 bps)\n {\n int status = 1;\n tsample_t sample = 0;\n tsample_t count = spp; \n uint32 row, col, trow;\n uint32 nrow, ncol;\n uint32 dst_rowsize, shift_width;\n uint32 bytes_per_sample, bytes_per_pixel;\n uint32 trailing_bits, prev_trailing_bits;\n uint32 tile_rowsize = TIFFTileRowSize(in);\n uint32 src_offset, dst_offset;\n uint32 row_offset, col_offset;\n uint8 *bufp = (uint8*) buf;\n unsigned char *src = NULL;\n unsigned char *dst = NULL;\n tsize_t tbytes = 0, tile_buffsize = 0;\n tsize_t tilesize = TIFFTileSize(in);\n unsigned char *tilebuf = NULL;\n\n bytes_per_sample = (bps + 7) / 8; \n bytes_per_pixel = ((bps * spp) + 7) / 8;\n\n if ((bps % 8) == 0)\n shift_width = 0;\n else\n {\n if (bytes_per_pixel < (bytes_per_sample + 1))\n shift_width = bytes_per_pixel;\n else\n shift_width = bytes_per_sample + 1;\n }\n\n tile_buffsize = tilesize;\n if (tilesize == 0 || tile_rowsize == 0)\n {\n TIFFError(\"readContigTilesIntoBuffer\", \"Tile size or tile rowsize is zero\");\n exit(-1);\n }\n\n if (tilesize < (tsize_t)(tl * tile_rowsize))\n {\n#ifdef DEBUG2\n TIFFError(\"readContigTilesIntoBuffer\",\n\t \"Tilesize %lu is too small, using alternate calculation %u\",\n tilesize, tl * tile_rowsize);\n#endif\n tile_buffsize = tl * tile_rowsize;\n if (tl != (tile_buffsize / tile_rowsize))\n {\n \tTIFFError(\"readContigTilesIntoBuffer\", \"Integer overflow when calculating buffer size.\");\n exit(-1);\n }\n }\n\n /* Add 3 padding bytes for extractContigSamplesShifted32bits */\n if( tile_buffsize > 0xFFFFFFFFU - 3 )\n {\n TIFFError(\"readContigTilesIntoBuffer\", \"Integer overflow when calculating buffer size.\");\n exit(-1);\n }\n tilebuf = _TIFFmalloc(tile_buffsize + 3);\n if (tilebuf == 0)\n return 0;\n tilebuf[tile_buffsize] = 0;\n tilebuf[tile_buffsize+1] = 0;\n tilebuf[tile_buffsize+2] = 0;\n\n dst_rowsize = ((imagewidth * bps * spp) + 7) / 8; \n for (row = 0; row < imagelength; row += tl)\n {\n nrow = (row + tl > imagelength) ? imagelength - row : tl;\n for (col = 0; col < imagewidth; col += tw)\n {\n tbytes = TIFFReadTile(in, tilebuf, col, row, 0, 0);\n if (tbytes < tilesize && !ignore)\n {\n\tTIFFError(TIFFFileName(in),\n\t\t \"Error, can't read tile at row %lu col %lu, Read %lu bytes of %lu\",\n\t\t (unsigned long) col, (unsigned long) row, (unsigned long)tbytes,\n (unsigned long)tilesize);\n\t\t status = 0;\n _TIFFfree(tilebuf);\n\t\t return status;\n\t}\n \n row_offset = row * dst_rowsize;\n col_offset = ((col * bps * spp) + 7)/ 8;\n bufp = buf + row_offset + col_offset;\n\n if (col + tw > imagewidth)\n\tncol = imagewidth - col;\n else\n ncol = tw;\n\n /* Each tile scanline will start on a byte boundary but it\n * has to be merged into the scanline for the entire\n * image buffer and the previous segment may not have\n * ended on a byte boundary\n */\n /* Optimization for common bit depths, all samples */\n if (((bps % 8) == 0) && (count == spp))\n {\n\tfor (trow = 0; trow < nrow; trow++)\n {\n\t src_offset = trow * tile_rowsize;\n\t _TIFFmemcpy (bufp, tilebuf + src_offset, (ncol * spp * bps) / 8);\n bufp += (imagewidth * bps * spp) / 8;\n\t }\n }\n else\n {\n\t/* Bit depths not a multiple of 8 and/or extract fewer than spp samples */\n prev_trailing_bits = trailing_bits = 0;\n trailing_bits = (ncol * bps * spp) % 8;\n\n\t/*\tfor (trow = 0; tl < nrow; trow++) */\n\tfor (trow = 0; trow < nrow; trow++)\n {\n\t src_offset = trow * tile_rowsize;\n src = tilebuf + src_offset;\n\t dst_offset = (row + trow) * dst_rowsize;\n dst = buf + dst_offset + col_offset;\n switch (shift_width)\n {\n case 0: if (extractContigSamplesBytes (src, dst, ncol, sample,\n spp, bps, count, 0, ncol))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t\trow, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n case 1: if (bps == 1)\n { \n if (extractContigSamplesShifted8bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t\t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n\t\t }\n else\n if (extractContigSamplesShifted16bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t \t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t break;\n case 2: if (extractContigSamplesShifted24bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t \t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n case 3:\n case 4:\n case 5: if (extractContigSamplesShifted32bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n default: TIFFError(\"readContigTilesIntoBuffer\", \"Unsupported bit depth %d\", bps);\n\t\t return 1;\n\t }\n }\n prev_trailing_bits += trailing_bits;\n /* if (prev_trailing_bits > 7) */\n\t/* prev_trailing_bits-= 8; */\n\t}\n }\n }\n\n _TIFFfree(tilebuf);\n return status;\n }","lang":"c","vul_type":"cwe-125","target_token_count":1807,"sven_meta":{"func_name":"readContigTilesIntoBuffer","file_name":"tools/tiffcrop.c","commit_link":"github.com/vadz/libtiff/commit/ae9365db1b271b62b35ce018eac8799b1d5e8a53","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#70-364945f4cea1","input":"int TNEFParse(TNEFStruct *TNEF) {\n WORD key;\n DWORD type;\n DWORD size;\n DWORD signature;\n BYTE *data;\n WORD checksum, header_checksum;\n int i;\n\n if (TNEF->IO.ReadProc == NULL) {\n printf(\"ERROR: Setup incorrectly: No ReadProc\\n\");\n return YTNEF_INCORRECT_SETUP;\n }\n\n if (TNEF->IO.InitProc != NULL) {\n DEBUG(TNEF->Debug, 2, \"About to initialize\");\n if (TNEF->IO.InitProc(&TNEF->IO) != 0) {\n return YTNEF_CANNOT_INIT_DATA;\n }\n DEBUG(TNEF->Debug, 2, \"Initialization finished\");\n }\n\n DEBUG(TNEF->Debug, 2, \"Reading Signature\");\n if (TNEF->IO.ReadProc(&TNEF->IO, sizeof(DWORD), 1, &signature) < 1) {\n printf(\"ERROR: Error reading signature\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_READING_DATA;\n }\n\n DEBUG(TNEF->Debug, 2, \"Checking Signature\");\n if (TNEFCheckForSignature(signature) < 0) {\n printf(\"ERROR: Signature does not match. Not TNEF.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NOT_TNEF_STREAM;\n }\n\n DEBUG(TNEF->Debug, 2, \"Reading Key.\");\n\n if (TNEFGetKey(TNEF, &key) < 0) {\n printf(\"ERROR: Unable to retrieve key.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NO_KEY;\n }\n\n DEBUG(TNEF->Debug, 2, \"Starting Full Processing.\");\n\n while (TNEFGetHeader(TNEF, &type, &size) == 0) {\n DEBUG2(TNEF->Debug, 2, \"Header says type=0x%X, size=%u\", type, size);\n DEBUG2(TNEF->Debug, 2, \"Header says type=%u, size=%u\", type, size);\n data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(data);\n if (TNEFRawRead(TNEF, data, size, &header_checksum) < 0) {\n printf(\"ERROR: Unable to read data.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n if (TNEFRawRead(TNEF, (BYTE *)&checksum, 2, NULL) < 0) {\n printf(\"ERROR: Unable to read checksum.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n checksum = SwapWord((BYTE *)&checksum, sizeof(WORD));\n if (checksum != header_checksum) {\n printf(\"ERROR: Checksum mismatch. Data corruption?:\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_BAD_CHECKSUM;\n }\n for (i = 0; i < (sizeof(TNEFList) / sizeof(TNEFHandler)); i++) {\n if (TNEFList[i].id == type) {\n if (TNEFList[i].handler != NULL) {\n if (TNEFList[i].handler(TNEF, i, (char*)data, size) < 0) {\n free(data);\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_IN_HANDLER;\n } else {\n // Found our handler and processed it. now time to get out\n break;\n }\n } else {\n DEBUG2(TNEF->Debug, 1, \"No handler for %s: %u bytes\",\n TNEFList[i].name, size);\n }\n }\n }\n\n free(data);\n }\n\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return 0;\n\n}","target":"int TNEFParse(TNEFStruct *TNEF) {\n WORD key;\n DWORD type;\n DWORD size;\n DWORD signature;\n BYTE *data;\n WORD checksum, header_checksum;\n int i;\n\n if (TNEF->IO.ReadProc == NULL) {\n printf(\"ERROR: Setup incorrectly: No ReadProc\\n\");\n return YTNEF_INCORRECT_SETUP;\n }\n\n if (TNEF->IO.InitProc != NULL) {\n DEBUG(TNEF->Debug, 2, \"About to initialize\");\n if (TNEF->IO.InitProc(&TNEF->IO) != 0) {\n return YTNEF_CANNOT_INIT_DATA;\n }\n DEBUG(TNEF->Debug, 2, \"Initialization finished\");\n }\n\n DEBUG(TNEF->Debug, 2, \"Reading Signature\");\n if (TNEF->IO.ReadProc(&TNEF->IO, sizeof(DWORD), 1, &signature) < 1) {\n printf(\"ERROR: Error reading signature\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_READING_DATA;\n }\n\n DEBUG(TNEF->Debug, 2, \"Checking Signature\");\n if (TNEFCheckForSignature(signature) < 0) {\n printf(\"ERROR: Signature does not match. Not TNEF.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NOT_TNEF_STREAM;\n }\n\n DEBUG(TNEF->Debug, 2, \"Reading Key.\");\n\n if (TNEFGetKey(TNEF, &key) < 0) {\n printf(\"ERROR: Unable to retrieve key.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NO_KEY;\n }\n\n DEBUG(TNEF->Debug, 2, \"Starting Full Processing.\");\n\n while (TNEFGetHeader(TNEF, &type, &size) == 0) {\n DEBUG2(TNEF->Debug, 2, \"Header says type=0x%X, size=%u\", type, size);\n DEBUG2(TNEF->Debug, 2, \"Header says type=%u, size=%u\", type, size);\n if(size == 0) {\n printf(\"ERROR: Field with size of 0\\n\");\n return YTNEF_ERROR_READING_DATA;\n }\n data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(data);\n if (TNEFRawRead(TNEF, data, size, &header_checksum) < 0) {\n printf(\"ERROR: Unable to read data.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n if (TNEFRawRead(TNEF, (BYTE *)&checksum, 2, NULL) < 0) {\n printf(\"ERROR: Unable to read checksum.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n checksum = SwapWord((BYTE *)&checksum, sizeof(WORD));\n if (checksum != header_checksum) {\n printf(\"ERROR: Checksum mismatch. Data corruption?:\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_BAD_CHECKSUM;\n }\n for (i = 0; i < (sizeof(TNEFList) / sizeof(TNEFHandler)); i++) {\n if (TNEFList[i].id == type) {\n if (TNEFList[i].handler != NULL) {\n if (TNEFList[i].handler(TNEF, i, (char*)data, size) < 0) {\n free(data);\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_IN_HANDLER;\n } else {\n // Found our handler and processed it. now time to get out\n break;\n }\n } else {\n DEBUG2(TNEF->Debug, 1, \"No handler for %s: %u bytes\",\n TNEFList[i].name, size);\n }\n }\n }\n\n free(data);\n }\n\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return 0;\n\n}","lang":"c","vul_type":"cwe-125","target_token_count":1084,"sven_meta":{"func_name":"TNEFParse","file_name":"lib/ytnef.c","commit_link":"github.com/Yeraze/ytnef/commit/3cb0f914d6427073f262e1b2b5fd973e3043cdf7","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#71-770dea509548","input":"static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )\n{\n int ret;\n const mbedtls_ssl_ciphersuite_t *ciphersuite_info =\n ssl->transform_negotiate->ciphersuite_info;\n unsigned char *p = NULL, *end = NULL;\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"=> parse server key exchange\" ) );\n\n#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA )\n {\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= skip parse server key exchange\" ) );\n ssl->state++;\n return( 0 );\n }\n ((void) p);\n ((void) end);\n#endif\n\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA )\n {\n if( ( ret = ssl_get_ecdh_params_from_cert( ssl ) ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"ssl_get_ecdh_params_from_cert\", ret );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( ret );\n }\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= skip parse server key exchange\" ) );\n ssl->state++;\n return( 0 );\n }\n ((void) p);\n ((void) end);\n#endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */\n\n if( ( ret = mbedtls_ssl_read_record( ssl ) ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_ssl_read_record\", ret );\n return( ret );\n }\n\n if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n /*\n * ServerKeyExchange may be skipped with PSK and RSA-PSK when the server\n * doesn't use a psk_identity_hint\n */\n if( ssl->in_msg[0] != MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE )\n {\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )\n {\n /* Current message is probably either\n * CertificateRequest or ServerHelloDone */\n ssl->keep_current_message = 1;\n goto exit;\n }\n\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"server key exchange message must \"\n \"not be skipped\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );\n\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n p = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );\n end = ssl->in_msg + ssl->in_hslen;\n MBEDTLS_SSL_DEBUG_BUF( 3, \"server key exchange\", p, end - p );\n\n#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK )\n {\n if( ssl_parse_server_psk_hint( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n } /* FALLTROUGH */\n#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */\n\n#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )\n ; /* nothing more to do */\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_PSK_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK )\n {\n if( ssl_parse_server_dh_params( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA )\n {\n if( ssl_parse_server_ecdh_params( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE )\n {\n ret = mbedtls_ecjpake_read_round_two( &ssl->handshake->ecjpake_ctx,\n p, end - p );\n if( ret != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_ecjpake_read_round_two\", ret );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n#if defined(MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED)\n if( mbedtls_ssl_ciphersuite_uses_server_signature( ciphersuite_info ) )\n {\n size_t sig_len, hashlen;\n unsigned char hash[64];\n mbedtls_md_type_t md_alg = MBEDTLS_MD_NONE;\n mbedtls_pk_type_t pk_alg = MBEDTLS_PK_NONE;\n unsigned char *params = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );\n size_t params_len = p - params;\n\n /*\n * Handle the digitally-signed structure\n */\n#if defined(MBEDTLS_SSL_PROTO_TLS1_2)\n if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 )\n {\n if( ssl_parse_signature_algorithm( ssl, &p, end,\n &md_alg, &pk_alg ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n if( pk_alg != mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */\n#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_1)\n if( ssl->minor_ver < MBEDTLS_SSL_MINOR_VERSION_3 )\n {\n pk_alg = mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info );\n\n /* Default hash for ECDSA is SHA-1 */\n if( pk_alg == MBEDTLS_PK_ECDSA && md_alg == MBEDTLS_MD_NONE )\n md_alg = MBEDTLS_MD_SHA1;\n }\n else\n#endif\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n /*\n * Read signature\n */\n\n if( p > end - 2 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n sig_len = ( p[0] << 8 ) | p[1];\n p += 2;\n\n if( end != p + sig_len )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n MBEDTLS_SSL_DEBUG_BUF( 3, \"signature\", p, sig_len );\n\n /*\n * Compute the hash that has been signed\n */\n#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_1)\n if( md_alg == MBEDTLS_MD_NONE )\n {\n hashlen = 36;\n ret = mbedtls_ssl_get_key_exchange_md_ssl_tls( ssl, hash, params,\n params_len );\n if( ret != 0 )\n return( ret );\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_SSL3 || MBEDTLS_SSL_PROTO_TLS1 || \\\n MBEDTLS_SSL_PROTO_TLS1_1 */\n#if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_2)\n if( md_alg != MBEDTLS_MD_NONE )\n {\n /* Info from md_alg will be used instead */\n hashlen = 0;\n ret = mbedtls_ssl_get_key_exchange_md_tls1_2( ssl, hash, params,\n params_len, md_alg );\n if( ret != 0 )\n return( ret );\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_TLS1 || MBEDTLS_SSL_PROTO_TLS1_1 || \\\n MBEDTLS_SSL_PROTO_TLS1_2 */\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n MBEDTLS_SSL_DEBUG_BUF( 3, \"parameters hash\", hash, hashlen != 0 ? hashlen :\n (unsigned int) ( mbedtls_md_get_size( mbedtls_md_info_from_type( md_alg ) ) ) );\n\n if( ssl->session_negotiate->peer_cert == NULL )\n {\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"certificate required\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n /*\n * Verify signature\n */\n if( ! mbedtls_pk_can_do( &ssl->session_negotiate->peer_cert->pk, pk_alg ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH );\n }\n\n if( ( ret = mbedtls_pk_verify( &ssl->session_negotiate->peer_cert->pk,\n md_alg, hash, hashlen, p, sig_len ) ) != 0 )\n {\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR );\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_pk_verify\", ret );\n return( ret );\n }\n }\n#endif /* MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED */\n\nexit:\n ssl->state++;\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= parse server key exchange\" ) );\n\n return( 0 );\n}","target":"static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )\n{\n int ret;\n const mbedtls_ssl_ciphersuite_t *ciphersuite_info =\n ssl->transform_negotiate->ciphersuite_info;\n unsigned char *p = NULL, *end = NULL;\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"=> parse server key exchange\" ) );\n\n#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA )\n {\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= skip parse server key exchange\" ) );\n ssl->state++;\n return( 0 );\n }\n ((void) p);\n ((void) end);\n#endif\n\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA )\n {\n if( ( ret = ssl_get_ecdh_params_from_cert( ssl ) ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"ssl_get_ecdh_params_from_cert\", ret );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( ret );\n }\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= skip parse server key exchange\" ) );\n ssl->state++;\n return( 0 );\n }\n ((void) p);\n ((void) end);\n#endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */\n\n if( ( ret = mbedtls_ssl_read_record( ssl ) ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_ssl_read_record\", ret );\n return( ret );\n }\n\n if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n /*\n * ServerKeyExchange may be skipped with PSK and RSA-PSK when the server\n * doesn't use a psk_identity_hint\n */\n if( ssl->in_msg[0] != MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE )\n {\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )\n {\n /* Current message is probably either\n * CertificateRequest or ServerHelloDone */\n ssl->keep_current_message = 1;\n goto exit;\n }\n\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"server key exchange message must \"\n \"not be skipped\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );\n\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n p = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );\n end = ssl->in_msg + ssl->in_hslen;\n MBEDTLS_SSL_DEBUG_BUF( 3, \"server key exchange\", p, end - p );\n\n#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK )\n {\n if( ssl_parse_server_psk_hint( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n } /* FALLTROUGH */\n#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */\n\n#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )\n ; /* nothing more to do */\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_PSK_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK )\n {\n if( ssl_parse_server_dh_params( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA )\n {\n if( ssl_parse_server_ecdh_params( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE )\n {\n ret = mbedtls_ecjpake_read_round_two( &ssl->handshake->ecjpake_ctx,\n p, end - p );\n if( ret != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_ecjpake_read_round_two\", ret );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n#if defined(MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED)\n if( mbedtls_ssl_ciphersuite_uses_server_signature( ciphersuite_info ) )\n {\n size_t sig_len, hashlen;\n unsigned char hash[64];\n mbedtls_md_type_t md_alg = MBEDTLS_MD_NONE;\n mbedtls_pk_type_t pk_alg = MBEDTLS_PK_NONE;\n unsigned char *params = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );\n size_t params_len = p - params;\n\n /*\n * Handle the digitally-signed structure\n */\n#if defined(MBEDTLS_SSL_PROTO_TLS1_2)\n if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 )\n {\n if( ssl_parse_signature_algorithm( ssl, &p, end,\n &md_alg, &pk_alg ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n if( pk_alg != mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */\n#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_1)\n if( ssl->minor_ver < MBEDTLS_SSL_MINOR_VERSION_3 )\n {\n pk_alg = mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info );\n\n /* Default hash for ECDSA is SHA-1 */\n if( pk_alg == MBEDTLS_PK_ECDSA && md_alg == MBEDTLS_MD_NONE )\n md_alg = MBEDTLS_MD_SHA1;\n }\n else\n#endif\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n /*\n * Read signature\n */\n\n if( p > end - 2 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n sig_len = ( p[0] << 8 ) | p[1];\n p += 2;\n\n if( p != end - sig_len )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n MBEDTLS_SSL_DEBUG_BUF( 3, \"signature\", p, sig_len );\n\n /*\n * Compute the hash that has been signed\n */\n#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_1)\n if( md_alg == MBEDTLS_MD_NONE )\n {\n hashlen = 36;\n ret = mbedtls_ssl_get_key_exchange_md_ssl_tls( ssl, hash, params,\n params_len );\n if( ret != 0 )\n return( ret );\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_SSL3 || MBEDTLS_SSL_PROTO_TLS1 || \\\n MBEDTLS_SSL_PROTO_TLS1_1 */\n#if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_2)\n if( md_alg != MBEDTLS_MD_NONE )\n {\n /* Info from md_alg will be used instead */\n hashlen = 0;\n ret = mbedtls_ssl_get_key_exchange_md_tls1_2( ssl, hash, params,\n params_len, md_alg );\n if( ret != 0 )\n return( ret );\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_TLS1 || MBEDTLS_SSL_PROTO_TLS1_1 || \\\n MBEDTLS_SSL_PROTO_TLS1_2 */\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n MBEDTLS_SSL_DEBUG_BUF( 3, \"parameters hash\", hash, hashlen != 0 ? hashlen :\n (unsigned int) ( mbedtls_md_get_size( mbedtls_md_info_from_type( md_alg ) ) ) );\n\n if( ssl->session_negotiate->peer_cert == NULL )\n {\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"certificate required\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n /*\n * Verify signature\n */\n if( ! mbedtls_pk_can_do( &ssl->session_negotiate->peer_cert->pk, pk_alg ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH );\n }\n\n if( ( ret = mbedtls_pk_verify( &ssl->session_negotiate->peer_cert->pk,\n md_alg, hash, hashlen, p, sig_len ) ) != 0 )\n {\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR );\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_pk_verify\", ret );\n return( ret );\n }\n }\n#endif /* MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED */\n\nexit:\n ssl->state++;\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= parse server key exchange\" ) );\n\n return( 0 );\n}","lang":"c","vul_type":"cwe-125","target_token_count":3155,"sven_meta":{"func_name":"ssl_parse_server_key_exchange","file_name":"library/ssl_cli.c","commit_link":"github.com/ARMmbed/mbedtls/commit/027f84c69f4ef30c0693832a6c396ef19e563ca1","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#72-0f7d2b290d97","input":"static int exif_scan_JPEG_header(image_info_type *ImageInfo) {\n int section, sn;\n int marker = 0, last_marker = M_PSEUDO, comment_correction=1;\n int ll, lh;\n unsigned char *Data;\n size_t fpos, size, got, itemlen;\n jpeg_sof_info sof_info;\n\n for(section=0;;section++) {\n // get marker byte, swallowing possible padding\n // some software does not count the length bytes of COM section\n // one company doing so is very much envolved in JPEG...\n // so we accept too\n if (last_marker==M_COM && comment_correction) {\n comment_correction = 2;\n }\n do {\n if ((marker = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n if (last_marker==M_COM && comment_correction>0) {\n if (marker!=0xFF) {\n marker = 0xff;\n comment_correction--;\n } else {\n last_marker = M_PSEUDO; /* stop skipping 0 for M_COM */\n }\n }\n } while (marker == 0xff);\n if (last_marker==M_COM && !comment_correction) {\n raise_notice(\"Image has corrupt COM section: some software set \"\n \"wrong length information\");\n }\n if (last_marker==M_COM && comment_correction)\n return M_EOI; /* ah illegal: char after COM section not 0xFF */\n\n fpos = ImageInfo->infile->tell();\n\n if (marker == 0xff) {\n // 0xff is legal padding, but if we get that many, something's wrong.\n raise_warning(\"To many padding bytes\");\n return 0;\n }\n\n /* Read the length of the section. */\n\n if ((lh = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n if ((ll = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n itemlen = (lh << 8) | ll;\n\n if (itemlen < 2) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, nullptr);\n if (sn == -1) return 0;\n Data = ImageInfo->file.list[sn].data;\n\n /* Store first two pre-read bytes. */\n Data[0] = (unsigned char)lh;\n Data[1] = (unsigned char)ll;\n\n String str = ImageInfo->infile->read(itemlen-2);\n got = str.length();\n if (got != itemlen-2) {\n raise_warning(\"Error reading from file: \"\n \"got=x%04lX(=%lu) != itemlen-2=x%04lX(=%lu)\",\n got, got, itemlen-2, itemlen-2);\n return 0;\n }\n memcpy(Data+2, str.c_str(), got);\n switch(marker) {\n case M_SOS: /* stop before hitting compressed data */\n // If reading entire image is requested, read the rest of the data.\n if (ImageInfo->read_all) {\n /* Determine how much file is left. */\n fpos = ImageInfo->infile->tell();\n size = ImageInfo->FileSize - fpos;\n sn = exif_file_sections_add(ImageInfo, M_PSEUDO, size, nullptr);\n if (sn == -1) return 0;\n Data = ImageInfo->file.list[sn].data;\n str = ImageInfo->infile->read(size);\n got = str.length();\n if (got != size) {\n raise_warning(\"Unexpected end of file reached\");\n return 0;\n }\n memcpy(Data, str.c_str(), got);\n }\n return 1;\n\n case M_EOI: /* in case it's a tables-only JPEG stream */\n raise_warning(\"No image in jpeg!\");\n return (ImageInfo->sections_found&(~FOUND_COMPUTED)) ? 1 : 0;\n\n case M_COM: /* Comment section */\n exif_process_COM(ImageInfo, (char *)Data, itemlen);\n break;\n\n case M_EXIF:\n if (!(ImageInfo->sections_found&FOUND_IFD0)) {\n /*ImageInfo->sections_found |= FOUND_EXIF;*/\n /* Seen files from some 'U-lead' software with Vivitar scanner\n that uses marker 31 later in the file (no clue what for!) */\n exif_process_APP1(ImageInfo, (char *)Data, itemlen, fpos);\n }\n break;\n\n case M_APP12:\n exif_process_APP12(ImageInfo, (char *)Data, itemlen);\n break;\n\n\n case M_SOF0:\n case M_SOF1:\n case M_SOF2:\n case M_SOF3:\n case M_SOF5:\n case M_SOF6:\n case M_SOF7:\n case M_SOF9:\n case M_SOF10:\n case M_SOF11:\n case M_SOF13:\n case M_SOF14:\n case M_SOF15:\n exif_process_SOFn(Data, marker, &sof_info);\n ImageInfo->Width = sof_info.width;\n ImageInfo->Height = sof_info.height;\n if (sof_info.num_components == 3) {\n ImageInfo->IsColor = 1;\n } else {\n ImageInfo->IsColor = 0;\n }\n break;\n default:\n /* skip any other marker silently. */\n break;\n }\n\n /* keep track of last marker */\n last_marker = marker;\n }\n return 1;\n}","target":"static int exif_scan_JPEG_header(image_info_type *ImageInfo) {\n int section, sn;\n int marker = 0, last_marker = M_PSEUDO, comment_correction=1;\n int ll, lh;\n unsigned char *Data;\n size_t fpos, size, got, itemlen;\n jpeg_sof_info sof_info;\n\n for(section=0;;section++) {\n // get marker byte, swallowing possible padding\n // some software does not count the length bytes of COM section\n // one company doing so is very much envolved in JPEG...\n // so we accept too\n if (last_marker==M_COM && comment_correction) {\n comment_correction = 2;\n }\n do {\n if ((marker = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n if (last_marker==M_COM && comment_correction>0) {\n if (marker!=0xFF) {\n marker = 0xff;\n comment_correction--;\n } else {\n last_marker = M_PSEUDO; /* stop skipping 0 for M_COM */\n }\n }\n } while (marker == 0xff);\n if (last_marker==M_COM && !comment_correction) {\n raise_notice(\"Image has corrupt COM section: some software set \"\n \"wrong length information\");\n }\n if (last_marker==M_COM && comment_correction)\n return M_EOI; /* ah illegal: char after COM section not 0xFF */\n\n fpos = ImageInfo->infile->tell();\n\n if (marker == 0xff) {\n // 0xff is legal padding, but if we get that many, something's wrong.\n raise_warning(\"To many padding bytes\");\n return 0;\n }\n\n /* Read the length of the section. */\n\n if ((lh = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n if ((ll = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n itemlen = (lh << 8) | ll;\n\n if (itemlen < 2) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, nullptr);\n if (sn == -1) return 0;\n Data = ImageInfo->file.list[sn].data;\n\n /* Store first two pre-read bytes. */\n Data[0] = (unsigned char)lh;\n Data[1] = (unsigned char)ll;\n\n String str = ImageInfo->infile->read(itemlen-2);\n got = str.length();\n if (got != itemlen-2) {\n raise_warning(\"Error reading from file: \"\n \"got=x%04lX(=%lu) != itemlen-2=x%04lX(=%lu)\",\n got, got, itemlen-2, itemlen-2);\n return 0;\n }\n memcpy(Data+2, str.c_str(), got);\n switch(marker) {\n case M_SOS: /* stop before hitting compressed data */\n // If reading entire image is requested, read the rest of the data.\n if (ImageInfo->read_all) {\n /* Determine how much file is left. */\n fpos = ImageInfo->infile->tell();\n size = ImageInfo->FileSize - fpos;\n sn = exif_file_sections_add(ImageInfo, M_PSEUDO, size, nullptr);\n if (sn == -1) return 0;\n Data = ImageInfo->file.list[sn].data;\n str = ImageInfo->infile->read(size);\n got = str.length();\n if (got != size) {\n raise_warning(\"Unexpected end of file reached\");\n return 0;\n }\n memcpy(Data, str.c_str(), got);\n }\n return 1;\n\n case M_EOI: /* in case it's a tables-only JPEG stream */\n raise_warning(\"No image in jpeg!\");\n return (ImageInfo->sections_found&(~FOUND_COMPUTED)) ? 1 : 0;\n\n case M_COM: /* Comment section */\n exif_process_COM(ImageInfo, (char *)Data, itemlen);\n break;\n\n case M_EXIF:\n if (!(ImageInfo->sections_found&FOUND_IFD0)) {\n /*ImageInfo->sections_found |= FOUND_EXIF;*/\n /* Seen files from some 'U-lead' software with Vivitar scanner\n that uses marker 31 later in the file (no clue what for!) */\n exif_process_APP1(ImageInfo, (char *)Data, itemlen, fpos);\n }\n break;\n\n case M_APP12:\n exif_process_APP12(ImageInfo, (char *)Data, itemlen);\n break;\n\n\n case M_SOF0:\n case M_SOF1:\n case M_SOF2:\n case M_SOF3:\n case M_SOF5:\n case M_SOF6:\n case M_SOF7:\n case M_SOF9:\n case M_SOF10:\n case M_SOF11:\n case M_SOF13:\n case M_SOF14:\n case M_SOF15:\n if ((itemlen - 2) < 6) {\n return 0;\n }\n\n exif_process_SOFn(Data, marker, &sof_info);\n ImageInfo->Width = sof_info.width;\n ImageInfo->Height = sof_info.height;\n if (sof_info.num_components == 3) {\n ImageInfo->IsColor = 1;\n } else {\n ImageInfo->IsColor = 0;\n }\n break;\n default:\n /* skip any other marker silently. */\n break;\n }\n\n /* keep track of last marker */\n last_marker = marker;\n }\n return 1;\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":1290,"sven_meta":{"func_name":"HPHP::exif_scan_JPEG_header","file_name":"hphp/runtime/ext/gd/ext_gd.cpp","commit_link":"github.com/facebook/hhvm/commit/f9680d21beaa9eb39d166e8810e29fbafa51ad15","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#73-8d1c73eb747a","input":"forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,\n\t\t UChar* range, UChar** low, UChar** high, UChar** low_prev)\n{\n UChar *p, *pprev = (UChar* )NULL;\n\n#ifdef ONIG_DEBUG_SEARCH\n fprintf(stderr, \"forward_search_range: str: %d, end: %d, s: %d, range: %d\\n\",\n\t (int )str, (int )end, (int )s, (int )range);\n#endif\n\n p = s;\n if (reg->dmin > 0) {\n if (ONIGENC_IS_SINGLEBYTE(reg->enc)) {\n p += reg->dmin;\n }\n else {\n UChar *q = p + reg->dmin;\n while (p < q) p += enclen(reg->enc, p);\n }\n }\n\n retry:\n switch (reg->optimize) {\n case ONIG_OPTIMIZE_EXACT:\n p = slow_search(reg->enc, reg->exact, reg->exact_end, p, end, range);\n break;\n case ONIG_OPTIMIZE_EXACT_IC:\n p = slow_search_ic(reg->enc, reg->case_fold_flag,\n reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_EXACT_BM:\n p = bm_search(reg, reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_EXACT_BM_NOT_REV:\n p = bm_search_notrev(reg, reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_MAP:\n p = map_search(reg->enc, reg->map, p, range);\n break;\n }\n\n if (p && p < range) {\n if (p - reg->dmin < s) {\n retry_gate:\n pprev = p;\n p += enclen(reg->enc, p);\n goto retry;\n }\n\n if (reg->sub_anchor) {\n UChar* prev;\n\n switch (reg->sub_anchor) {\n case ANCHOR_BEGIN_LINE:\n if (!ON_STR_BEGIN(p)) {\n prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n if (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end))\n goto retry_gate;\n }\n break;\n\n case ANCHOR_END_LINE:\n if (ON_STR_END(p)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n prev = (UChar* )onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n if (prev && ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end))\n goto retry_gate;\n#endif\n }\n else if (! ONIGENC_IS_MBC_NEWLINE(reg->enc, p, end)\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n && ! ONIGENC_IS_MBC_CRNL(reg->enc, p, end)\n#endif\n )\n goto retry_gate;\n break;\n }\n }\n\n if (reg->dmax == 0) {\n *low = p;\n if (low_prev) {\n if (*low > s)\n *low_prev = onigenc_get_prev_char_head(reg->enc, s, p);\n else\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n }\n }\n else {\n if (reg->dmax != ONIG_INFINITE_DISTANCE) {\n *low = p - reg->dmax;\n if (*low > s) {\n *low = onigenc_get_right_adjust_char_head_with_prev(reg->enc, s,\n *low, (const UChar** )low_prev);\n if (low_prev && IS_NULL(*low_prev))\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : s), *low);\n }\n else {\n if (low_prev)\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), *low);\n }\n }\n }\n /* no needs to adjust *high, *high is used as range check only */\n *high = p - reg->dmin;\n\n#ifdef ONIG_DEBUG_SEARCH\n fprintf(stderr,\n \"forward_search_range success: low: %d, high: %d, dmin: %d, dmax: %d\\n\",\n\t (int )(*low - str), (int )(*high - str), reg->dmin, reg->dmax);\n#endif\n return 1; /* success */\n }\n\n return 0; /* fail */\n}","target":"forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,\n\t\t UChar* range, UChar** low, UChar** high, UChar** low_prev)\n{\n UChar *p, *pprev = (UChar* )NULL;\n\n#ifdef ONIG_DEBUG_SEARCH\n fprintf(stderr, \"forward_search_range: str: %d, end: %d, s: %d, range: %d\\n\",\n\t (int )str, (int )end, (int )s, (int )range);\n#endif\n\n p = s;\n if (reg->dmin > 0) {\n if (ONIGENC_IS_SINGLEBYTE(reg->enc)) {\n p += reg->dmin;\n }\n else {\n UChar *q = p + reg->dmin;\n\n if (q >= end) return 0; /* fail */\n while (p < q) p += enclen(reg->enc, p);\n }\n }\n\n retry:\n switch (reg->optimize) {\n case ONIG_OPTIMIZE_EXACT:\n p = slow_search(reg->enc, reg->exact, reg->exact_end, p, end, range);\n break;\n case ONIG_OPTIMIZE_EXACT_IC:\n p = slow_search_ic(reg->enc, reg->case_fold_flag,\n reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_EXACT_BM:\n p = bm_search(reg, reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_EXACT_BM_NOT_REV:\n p = bm_search_notrev(reg, reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_MAP:\n p = map_search(reg->enc, reg->map, p, range);\n break;\n }\n\n if (p && p < range) {\n if (p - reg->dmin < s) {\n retry_gate:\n pprev = p;\n p += enclen(reg->enc, p);\n goto retry;\n }\n\n if (reg->sub_anchor) {\n UChar* prev;\n\n switch (reg->sub_anchor) {\n case ANCHOR_BEGIN_LINE:\n if (!ON_STR_BEGIN(p)) {\n prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n if (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end))\n goto retry_gate;\n }\n break;\n\n case ANCHOR_END_LINE:\n if (ON_STR_END(p)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n prev = (UChar* )onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n if (prev && ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end))\n goto retry_gate;\n#endif\n }\n else if (! ONIGENC_IS_MBC_NEWLINE(reg->enc, p, end)\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n && ! ONIGENC_IS_MBC_CRNL(reg->enc, p, end)\n#endif\n )\n goto retry_gate;\n break;\n }\n }\n\n if (reg->dmax == 0) {\n *low = p;\n if (low_prev) {\n if (*low > s)\n *low_prev = onigenc_get_prev_char_head(reg->enc, s, p);\n else\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n }\n }\n else {\n if (reg->dmax != ONIG_INFINITE_DISTANCE) {\n *low = p - reg->dmax;\n if (*low > s) {\n *low = onigenc_get_right_adjust_char_head_with_prev(reg->enc, s,\n *low, (const UChar** )low_prev);\n if (low_prev && IS_NULL(*low_prev))\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : s), *low);\n }\n else {\n if (low_prev)\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), *low);\n }\n }\n }\n /* no needs to adjust *high, *high is used as range check only */\n *high = p - reg->dmin;\n\n#ifdef ONIG_DEBUG_SEARCH\n fprintf(stderr,\n \"forward_search_range success: low: %d, high: %d, dmin: %d, dmax: %d\\n\",\n\t (int )(*low - str), (int )(*high - str), reg->dmin, reg->dmax);\n#endif\n return 1; /* success */\n }\n\n return 0; /* fail */\n}","lang":"c","vul_type":"cwe-125","target_token_count":1076,"sven_meta":{"func_name":"forward_search_range","file_name":"src/regexec.c","commit_link":"github.com/kkos/oniguruma/commit/9690d3ab1f9bcd2db8cbe1fe3ee4a5da606b8814","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#74-485098d25fb0","input":"static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n)\n{\n Mpeg4DecContext *ctx = s->avctx->priv_data;\n\n int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0,\n additional_code_len, sign, mismatch;\n VLC *cur_vlc = &ctx->studio_intra_tab[0];\n uint8_t *const scantable = s->intra_scantable.permutated;\n const uint16_t *quant_matrix;\n uint32_t flc;\n const int min = -1 * (1 << (s->avctx->bits_per_raw_sample + 6));\n const int max = ((1 << (s->avctx->bits_per_raw_sample + 6)) - 1);\n\n mismatch = 1;\n\n memset(block, 0, 64 * sizeof(int32_t));\n\n if (n < 4) {\n cc = 0;\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);\n quant_matrix = s->intra_matrix;\n } else {\n cc = (n & 1) + 1;\n if (ctx->rgb)\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);\n else\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_chroma_dc.table, STUDIO_INTRA_BITS, 2);\n quant_matrix = s->chroma_intra_matrix;\n }\n\n if (dct_dc_size < 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"illegal dct_dc_size vlc\\n\");\n return AVERROR_INVALIDDATA;\n } else if (dct_dc_size == 0) {\n dct_diff = 0;\n } else {\n dct_diff = get_xbits(&s->gb, dct_dc_size);\n\n if (dct_dc_size > 8) {\n if(!check_marker(s->avctx, &s->gb, \"dct_dc_size > 8\"))\n return AVERROR_INVALIDDATA;\n }\n\n }\n\n s->last_dc[cc] += dct_diff;\n\n if (s->mpeg_quant)\n block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision);\n else\n block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision) * (8 >> s->dct_precision);\n /* TODO: support mpeg_quant for AC coefficients */\n\n block[0] = av_clip(block[0], min, max);\n mismatch ^= block[0];\n\n /* AC Coefficients */\n while (1) {\n group = get_vlc2(&s->gb, cur_vlc->table, STUDIO_INTRA_BITS, 2);\n\n if (group < 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"illegal ac coefficient group vlc\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n additional_code_len = ac_state_tab[group][0];\n cur_vlc = &ctx->studio_intra_tab[ac_state_tab[group][1]];\n\n if (group == 0) {\n /* End of Block */\n break;\n } else if (group >= 1 && group <= 6) {\n /* Zero run length (Table B.47) */\n run = 1 << additional_code_len;\n if (additional_code_len)\n run += get_bits(&s->gb, additional_code_len);\n idx += run;\n continue;\n } else if (group >= 7 && group <= 12) {\n /* Zero run length and +/-1 level (Table B.48) */\n code = get_bits(&s->gb, additional_code_len);\n sign = code & 1;\n code >>= 1;\n run = (1 << (additional_code_len - 1)) + code;\n idx += run;\n j = scantable[idx++];\n block[j] = sign ? 1 : -1;\n } else if (group >= 13 && group <= 20) {\n /* Level value (Table B.49) */\n j = scantable[idx++];\n block[j] = get_xbits(&s->gb, additional_code_len);\n } else if (group == 21) {\n /* Escape */\n j = scantable[idx++];\n additional_code_len = s->avctx->bits_per_raw_sample + s->dct_precision + 4;\n flc = get_bits(&s->gb, additional_code_len);\n if (flc >> (additional_code_len-1))\n block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1);\n else\n block[j] = flc;\n }\n block[j] = ((8 * 2 * block[j] * quant_matrix[j] * s->qscale) >> s->dct_precision) / 32;\n block[j] = av_clip(block[j], min, max);\n mismatch ^= block[j];\n }\n\n block[63] ^= mismatch & 1;\n\n return 0;\n}","target":"static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n)\n{\n Mpeg4DecContext *ctx = s->avctx->priv_data;\n\n int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0,\n additional_code_len, sign, mismatch;\n VLC *cur_vlc = &ctx->studio_intra_tab[0];\n uint8_t *const scantable = s->intra_scantable.permutated;\n const uint16_t *quant_matrix;\n uint32_t flc;\n const int min = -1 * (1 << (s->avctx->bits_per_raw_sample + 6));\n const int max = ((1 << (s->avctx->bits_per_raw_sample + 6)) - 1);\n\n mismatch = 1;\n\n memset(block, 0, 64 * sizeof(int32_t));\n\n if (n < 4) {\n cc = 0;\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);\n quant_matrix = s->intra_matrix;\n } else {\n cc = (n & 1) + 1;\n if (ctx->rgb)\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);\n else\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_chroma_dc.table, STUDIO_INTRA_BITS, 2);\n quant_matrix = s->chroma_intra_matrix;\n }\n\n if (dct_dc_size < 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"illegal dct_dc_size vlc\\n\");\n return AVERROR_INVALIDDATA;\n } else if (dct_dc_size == 0) {\n dct_diff = 0;\n } else {\n dct_diff = get_xbits(&s->gb, dct_dc_size);\n\n if (dct_dc_size > 8) {\n if(!check_marker(s->avctx, &s->gb, \"dct_dc_size > 8\"))\n return AVERROR_INVALIDDATA;\n }\n\n }\n\n s->last_dc[cc] += dct_diff;\n\n if (s->mpeg_quant)\n block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision);\n else\n block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision) * (8 >> s->dct_precision);\n /* TODO: support mpeg_quant for AC coefficients */\n\n block[0] = av_clip(block[0], min, max);\n mismatch ^= block[0];\n\n /* AC Coefficients */\n while (1) {\n group = get_vlc2(&s->gb, cur_vlc->table, STUDIO_INTRA_BITS, 2);\n\n if (group < 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"illegal ac coefficient group vlc\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n additional_code_len = ac_state_tab[group][0];\n cur_vlc = &ctx->studio_intra_tab[ac_state_tab[group][1]];\n\n if (group == 0) {\n /* End of Block */\n break;\n } else if (group >= 1 && group <= 6) {\n /* Zero run length (Table B.47) */\n run = 1 << additional_code_len;\n if (additional_code_len)\n run += get_bits(&s->gb, additional_code_len);\n idx += run;\n continue;\n } else if (group >= 7 && group <= 12) {\n /* Zero run length and +/-1 level (Table B.48) */\n code = get_bits(&s->gb, additional_code_len);\n sign = code & 1;\n code >>= 1;\n run = (1 << (additional_code_len - 1)) + code;\n idx += run;\n if (idx > 63)\n return AVERROR_INVALIDDATA;\n j = scantable[idx++];\n block[j] = sign ? 1 : -1;\n } else if (group >= 13 && group <= 20) {\n /* Level value (Table B.49) */\n if (idx > 63)\n return AVERROR_INVALIDDATA;\n j = scantable[idx++];\n block[j] = get_xbits(&s->gb, additional_code_len);\n } else if (group == 21) {\n /* Escape */\n if (idx > 63)\n return AVERROR_INVALIDDATA;\n j = scantable[idx++];\n additional_code_len = s->avctx->bits_per_raw_sample + s->dct_precision + 4;\n flc = get_bits(&s->gb, additional_code_len);\n if (flc >> (additional_code_len-1))\n block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1);\n else\n block[j] = flc;\n }\n block[j] = ((8 * 2 * block[j] * quant_matrix[j] * s->qscale) >> s->dct_precision) / 32;\n block[j] = av_clip(block[j], min, max);\n mismatch ^= block[j];\n }\n\n block[63] ^= mismatch & 1;\n\n return 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1213,"sven_meta":{"func_name":"mpeg4_decode_studio_block","file_name":"libavcodec/mpeg4videodec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/d227ed5d598340e719eff7156b1aa0a4469e9a6a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#75-07d94099ba17","input":"S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,\n regnode ** node_p,\n UV * code_point_p,\n int * cp_count,\n I32 * flagp,\n const bool strict,\n const U32 depth\n )\n{\n /* This routine teases apart the various meanings of \\N and returns\n * accordingly. The input parameters constrain which meaning(s) is/are valid\n * in the current context.\n *\n * Exactly one of and must be non-NULL.\n *\n * If is not NULL, the context is expecting the result to be a\n * single code point. If this \\N instance turns out to a single code point,\n * the function returns TRUE and sets *code_point_p to that code point.\n *\n * If is not NULL, the context is expecting the result to be one of\n * the things representable by a regnode. If this \\N instance turns out to be\n * one such, the function generates the regnode, returns TRUE and sets *node_p\n * to point to that regnode.\n *\n * If this instance of \\N isn't legal in any context, this function will\n * generate a fatal error and not return.\n *\n * On input, RExC_parse should point to the first char following the \\N at the\n * time of the call. On successful return, RExC_parse will have been updated\n * to point to just after the sequence identified by this routine. Also\n * *flagp has been updated as needed.\n *\n * When there is some problem with the current context and this \\N instance,\n * the function returns FALSE, without advancing RExC_parse, nor setting\n * *node_p, nor *code_point_p, nor *flagp.\n *\n * If is not NULL, the caller wants to know the length (in code\n * points) that this \\N sequence matches. This is set even if the function\n * returns FALSE, as detailed below.\n *\n * There are 5 possibilities here, as detailed in the next 5 paragraphs.\n *\n * Probably the most common case is for the \\N to specify a single code point.\n * *cp_count will be set to 1, and *code_point_p will be set to that code\n * point.\n *\n * Another possibility is for the input to be an empty \\N{}, which for\n * backwards compatibility we accept. *cp_count will be set to 0. *node_p\n * will be set to a generated NOTHING node.\n *\n * Still another possibility is for the \\N to mean [^\\n]. *cp_count will be\n * set to 0. *node_p will be set to a generated REG_ANY node.\n *\n * The fourth possibility is that \\N resolves to a sequence of more than one\n * code points. *cp_count will be set to the number of code points in the\n * sequence. *node_p * will be set to a generated node returned by this\n * function calling S_reg().\n *\n * The final possibility is that it is premature to be calling this function;\n * that pass1 needs to be restarted. This can happen when this changes from\n * /d to /u rules, or when the pattern needs to be upgraded to UTF-8. The\n * latter occurs only when the fourth possibility would otherwise be in\n * effect, and is because one of those code points requires the pattern to be\n * recompiled as UTF-8. The function returns FALSE, and sets the\n * RESTART_PASS1 and NEED_UTF8 flags in *flagp, as appropriate. When this\n * happens, the caller needs to desist from continuing parsing, and return\n * this information to its caller. This is not set for when there is only one\n * code point, as this can be called as part of an ANYOF node, and they can\n * store above-Latin1 code points without the pattern having to be in UTF-8.\n *\n * For non-single-quoted regexes, the tokenizer has resolved character and\n * sequence names inside \\N{...} into their Unicode values, normalizing the\n * result into what we should see here: '\\N{U+c1.c2...}', where c1... are the\n * hex-represented code points in the sequence. This is done there because\n * the names can vary based on what charnames pragma is in scope at the time,\n * so we need a way to take a snapshot of what they resolve to at the time of\n * the original parse. [perl #56444].\n *\n * That parsing is skipped for single-quoted regexes, so we may here get\n * '\\N{NAME}'. This is a fatal error. These names have to be resolved by the\n * parser. But if the single-quoted regex is something like '\\N{U+41}', that\n * is legal and handled here. The code point is Unicode, and has to be\n * translated into the native character set for non-ASCII platforms.\n */\n\n char * endbrace; /* points to '}' following the name */\n char *endchar;\t/* Points to '.' or '}' ending cur char in the input\n stream */\n char* p = RExC_parse; /* Temporary */\n\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_GROK_BSLASH_N;\n\n GET_RE_DEBUG_FLAGS;\n\n assert(cBOOL(node_p) ^ cBOOL(code_point_p)); /* Exactly one should be set */\n assert(! (node_p && cp_count)); /* At most 1 should be set */\n\n if (cp_count) { /* Initialize return for the most common case */\n *cp_count = 1;\n }\n\n /* The [^\\n] meaning of \\N ignores spaces and comments under the /x\n * modifier. The other meanings do not, so use a temporary until we find\n * out which we are being called with */\n skip_to_be_ignored_text(pRExC_state, &p,\n FALSE /* Don't force to /x */ );\n\n /* Disambiguate between \\N meaning a named character versus \\N meaning\n * [^\\n]. The latter is assumed when the {...} following the \\N is a legal\n * quantifier, or there is no '{' at all */\n if (*p != '{' || regcurly(p)) {\n\tRExC_parse = p;\n if (cp_count) {\n *cp_count = -1;\n }\n\n\tif (! node_p) {\n return FALSE;\n }\n\n\t*node_p = reg_node(pRExC_state, REG_ANY);\n\t*flagp |= HASWIDTH|SIMPLE;\n\tMARK_NAUGHTY(1);\n Set_Node_Length(*node_p, 1); /* MJD */\n\treturn TRUE;\n }\n\n /* Here, we have decided it should be a named character or sequence */\n\n /* The test above made sure that the next real character is a '{', but\n * under the /x modifier, it could be separated by space (or a comment and\n * \\n) and this is not allowed (for consistency with \\x{...} and the\n * tokenizer handling of \\N{NAME}). */\n if (*RExC_parse != '{') {\n\tvFAIL(\"Missing braces on \\\\N{}\");\n }\n\n RExC_parse++;\t/* Skip past the '{' */\n\n endbrace = strchr(RExC_parse, '}');\n if (! endbrace) { /* no trailing brace */\n vFAIL2(\"Missing right brace on \\\\%c{}\", 'N');\n }\n else if (!( endbrace == RExC_parse\t/* nothing between the {} */\n || memBEGINs(RExC_parse, /* U+ (bad hex is checked below\n for a better error msg) */\n (STRLEN) (RExC_end - RExC_parse),\n \"U+\")))\n {\n\tRExC_parse = endbrace;\t/* position msg's '<--HERE' */\n\tvFAIL(\"\\\\N{NAME} must be resolved by the lexer\");\n }\n\n REQUIRE_UNI_RULES(flagp, FALSE); /* Unicode named chars imply Unicode\n semantics */\n\n if (endbrace == RExC_parse) { /* empty: \\N{} */\n if (strict) {\n RExC_parse++; /* Position after the \"}\" */\n vFAIL(\"Zero length \\\\N{}\");\n }\n if (cp_count) {\n *cp_count = 0;\n }\n nextchar(pRExC_state);\n\tif (! node_p) {\n return FALSE;\n }\n\n *node_p = reg_node(pRExC_state,NOTHING);\n return TRUE;\n }\n\n RExC_parse += 2;\t/* Skip past the 'U+' */\n\n /* Because toke.c has generated a special construct for us guaranteed not\n * to have NULs, we can use a str function */\n endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n\n /* Code points are separated by dots. If none, there is only one code\n * point, and is terminated by the brace */\n\n if (endchar >= endbrace) {\n\tSTRLEN length_of_hex;\n\tI32 grok_hex_flags;\n\n /* Here, exactly one code point. If that isn't what is wanted, fail */\n if (! code_point_p) {\n RExC_parse = p;\n return FALSE;\n }\n\n /* Convert code point from hex */\n\tlength_of_hex = (STRLEN)(endchar - RExC_parse);\n\tgrok_hex_flags = PERL_SCAN_ALLOW_UNDERSCORES\n | PERL_SCAN_DISALLOW_PREFIX\n\n /* No errors in the first pass (See [perl\n * #122671].) We let the code below find the\n * errors when there are multiple chars. */\n | ((SIZE_ONLY)\n ? PERL_SCAN_SILENT_ILLDIGIT\n : 0);\n\n /* This routine is the one place where both single- and double-quotish\n * \\N{U+xxxx} are evaluated. The value is a Unicode code point which\n * must be converted to native. */\n\t*code_point_p = UNI_TO_NATIVE(grok_hex(RExC_parse,\n &length_of_hex,\n &grok_hex_flags,\n NULL));\n\n\t/* The tokenizer should have guaranteed validity, but it's possible to\n * bypass it by using single quoting, so check. Don't do the check\n * here when there are multiple chars; we do it below anyway. */\n if (length_of_hex == 0\n || length_of_hex != (STRLEN)(endchar - RExC_parse) )\n {\n RExC_parse += length_of_hex;\t/* Includes all the valid */\n RExC_parse += (RExC_orig_utf8)\t/* point to after 1st invalid */\n ? UTF8SKIP(RExC_parse)\n : 1;\n /* Guard against malformed utf8 */\n if (RExC_parse >= endchar) {\n RExC_parse = endchar;\n }\n vFAIL(\"Invalid hexadecimal number in \\\\N{U+...}\");\n }\n\n RExC_parse = endbrace + 1;\n return TRUE;\n }\n else { /* Is a multiple character sequence */\n\tSV * substitute_parse;\n\tSTRLEN len;\n\tchar *orig_end = RExC_end;\n\tchar *save_start = RExC_start;\n I32 flags;\n\n /* Count the code points, if desired, in the sequence */\n if (cp_count) {\n *cp_count = 0;\n while (RExC_parse < endbrace) {\n /* Point to the beginning of the next character in the sequence. */\n RExC_parse = endchar + 1;\n endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n (*cp_count)++;\n }\n }\n\n /* Fail if caller doesn't want to handle a multi-code-point sequence.\n * But don't backup up the pointer if the caller wants to know how many\n * code points there are (they can then handle things) */\n if (! node_p) {\n if (! cp_count) {\n RExC_parse = p;\n }\n return FALSE;\n }\n\n\t/* What is done here is to convert this to a sub-pattern of the form\n * \\x{char1}\\x{char2}... and then call reg recursively to parse it\n * (enclosing in \"(?: ... )\" ). That way, it retains its atomicness,\n * while not having to worry about special handling that some code\n * points may have. */\n\n\tsubstitute_parse = newSVpvs(\"?:\");\n\n\twhile (RExC_parse < endbrace) {\n\n\t /* Convert to notation the rest of the code understands */\n\t sv_catpv(substitute_parse, \"\\\\x{\");\n\t sv_catpvn(substitute_parse, RExC_parse, endchar - RExC_parse);\n\t sv_catpv(substitute_parse, \"}\");\n\n\t /* Point to the beginning of the next character in the sequence. */\n\t RExC_parse = endchar + 1;\n\t endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n\n\t}\n sv_catpv(substitute_parse, \")\");\n\n len = SvCUR(substitute_parse);\n\n\t/* Don't allow empty number */\n\tif (len < (STRLEN) 8) {\n RExC_parse = endbrace;\n\t vFAIL(\"Invalid hexadecimal number in \\\\N{U+...}\");\n\t}\n\n RExC_parse = RExC_start = RExC_adjusted_start\n = SvPV_nolen(substitute_parse);\n\tRExC_end = RExC_parse + len;\n\n /* The values are Unicode, and therefore not subject to recoding, but\n * have to be converted to native on a non-Unicode (meaning non-ASCII)\n * platform. */\n#ifdef EBCDIC\n RExC_recode_x_to_native = 1;\n#endif\n\n *node_p = reg(pRExC_state, 1, &flags, depth+1);\n\n /* Restore the saved values */\n\tRExC_start = RExC_adjusted_start = save_start;\n\tRExC_parse = endbrace;\n\tRExC_end = orig_end;\n#ifdef EBCDIC\n RExC_recode_x_to_native = 0;\n#endif\n SvREFCNT_dec_NN(substitute_parse);\n\n if (! *node_p) {\n if (flags & (RESTART_PASS1|NEED_UTF8)) {\n *flagp = flags & (RESTART_PASS1|NEED_UTF8);\n return FALSE;\n }\n FAIL2(\"panic: reg returned NULL to grok_bslash_N, flags=%#\" UVxf,\n (UV) flags);\n }\n *flagp |= flags&(HASWIDTH|SPSTART|SIMPLE|POSTPONED);\n\n nextchar(pRExC_state);\n\n return TRUE;\n }\n}","target":"S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,\n regnode ** node_p,\n UV * code_point_p,\n int * cp_count,\n I32 * flagp,\n const bool strict,\n const U32 depth\n )\n{\n /* This routine teases apart the various meanings of \\N and returns\n * accordingly. The input parameters constrain which meaning(s) is/are valid\n * in the current context.\n *\n * Exactly one of and must be non-NULL.\n *\n * If is not NULL, the context is expecting the result to be a\n * single code point. If this \\N instance turns out to a single code point,\n * the function returns TRUE and sets *code_point_p to that code point.\n *\n * If is not NULL, the context is expecting the result to be one of\n * the things representable by a regnode. If this \\N instance turns out to be\n * one such, the function generates the regnode, returns TRUE and sets *node_p\n * to point to that regnode.\n *\n * If this instance of \\N isn't legal in any context, this function will\n * generate a fatal error and not return.\n *\n * On input, RExC_parse should point to the first char following the \\N at the\n * time of the call. On successful return, RExC_parse will have been updated\n * to point to just after the sequence identified by this routine. Also\n * *flagp has been updated as needed.\n *\n * When there is some problem with the current context and this \\N instance,\n * the function returns FALSE, without advancing RExC_parse, nor setting\n * *node_p, nor *code_point_p, nor *flagp.\n *\n * If is not NULL, the caller wants to know the length (in code\n * points) that this \\N sequence matches. This is set even if the function\n * returns FALSE, as detailed below.\n *\n * There are 5 possibilities here, as detailed in the next 5 paragraphs.\n *\n * Probably the most common case is for the \\N to specify a single code point.\n * *cp_count will be set to 1, and *code_point_p will be set to that code\n * point.\n *\n * Another possibility is for the input to be an empty \\N{}, which for\n * backwards compatibility we accept. *cp_count will be set to 0. *node_p\n * will be set to a generated NOTHING node.\n *\n * Still another possibility is for the \\N to mean [^\\n]. *cp_count will be\n * set to 0. *node_p will be set to a generated REG_ANY node.\n *\n * The fourth possibility is that \\N resolves to a sequence of more than one\n * code points. *cp_count will be set to the number of code points in the\n * sequence. *node_p * will be set to a generated node returned by this\n * function calling S_reg().\n *\n * The final possibility is that it is premature to be calling this function;\n * that pass1 needs to be restarted. This can happen when this changes from\n * /d to /u rules, or when the pattern needs to be upgraded to UTF-8. The\n * latter occurs only when the fourth possibility would otherwise be in\n * effect, and is because one of those code points requires the pattern to be\n * recompiled as UTF-8. The function returns FALSE, and sets the\n * RESTART_PASS1 and NEED_UTF8 flags in *flagp, as appropriate. When this\n * happens, the caller needs to desist from continuing parsing, and return\n * this information to its caller. This is not set for when there is only one\n * code point, as this can be called as part of an ANYOF node, and they can\n * store above-Latin1 code points without the pattern having to be in UTF-8.\n *\n * For non-single-quoted regexes, the tokenizer has resolved character and\n * sequence names inside \\N{...} into their Unicode values, normalizing the\n * result into what we should see here: '\\N{U+c1.c2...}', where c1... are the\n * hex-represented code points in the sequence. This is done there because\n * the names can vary based on what charnames pragma is in scope at the time,\n * so we need a way to take a snapshot of what they resolve to at the time of\n * the original parse. [perl #56444].\n *\n * That parsing is skipped for single-quoted regexes, so we may here get\n * '\\N{NAME}'. This is a fatal error. These names have to be resolved by the\n * parser. But if the single-quoted regex is something like '\\N{U+41}', that\n * is legal and handled here. The code point is Unicode, and has to be\n * translated into the native character set for non-ASCII platforms.\n */\n\n char * endbrace; /* points to '}' following the name */\n char *endchar;\t/* Points to '.' or '}' ending cur char in the input\n stream */\n char* p = RExC_parse; /* Temporary */\n\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_GROK_BSLASH_N;\n\n GET_RE_DEBUG_FLAGS;\n\n assert(cBOOL(node_p) ^ cBOOL(code_point_p)); /* Exactly one should be set */\n assert(! (node_p && cp_count)); /* At most 1 should be set */\n\n if (cp_count) { /* Initialize return for the most common case */\n *cp_count = 1;\n }\n\n /* The [^\\n] meaning of \\N ignores spaces and comments under the /x\n * modifier. The other meanings do not, so use a temporary until we find\n * out which we are being called with */\n skip_to_be_ignored_text(pRExC_state, &p,\n FALSE /* Don't force to /x */ );\n\n /* Disambiguate between \\N meaning a named character versus \\N meaning\n * [^\\n]. The latter is assumed when the {...} following the \\N is a legal\n * quantifier, or there is no '{' at all */\n if (*p != '{' || regcurly(p)) {\n\tRExC_parse = p;\n if (cp_count) {\n *cp_count = -1;\n }\n\n\tif (! node_p) {\n return FALSE;\n }\n\n\t*node_p = reg_node(pRExC_state, REG_ANY);\n\t*flagp |= HASWIDTH|SIMPLE;\n\tMARK_NAUGHTY(1);\n Set_Node_Length(*node_p, 1); /* MJD */\n\treturn TRUE;\n }\n\n /* Here, we have decided it should be a named character or sequence */\n\n /* The test above made sure that the next real character is a '{', but\n * under the /x modifier, it could be separated by space (or a comment and\n * \\n) and this is not allowed (for consistency with \\x{...} and the\n * tokenizer handling of \\N{NAME}). */\n if (*RExC_parse != '{') {\n\tvFAIL(\"Missing braces on \\\\N{}\");\n }\n\n RExC_parse++;\t/* Skip past the '{' */\n\n endbrace = (char *) memchr(RExC_parse, '}', RExC_end - RExC_parse);\n if (! endbrace) { /* no trailing brace */\n vFAIL2(\"Missing right brace on \\\\%c{}\", 'N');\n }\n else if (!( endbrace == RExC_parse\t/* nothing between the {} */\n || memBEGINs(RExC_parse, /* U+ (bad hex is checked below\n for a better error msg) */\n (STRLEN) (RExC_end - RExC_parse),\n \"U+\")))\n {\n\tRExC_parse = endbrace;\t/* position msg's '<--HERE' */\n\tvFAIL(\"\\\\N{NAME} must be resolved by the lexer\");\n }\n\n REQUIRE_UNI_RULES(flagp, FALSE); /* Unicode named chars imply Unicode\n semantics */\n\n if (endbrace == RExC_parse) { /* empty: \\N{} */\n if (strict) {\n RExC_parse++; /* Position after the \"}\" */\n vFAIL(\"Zero length \\\\N{}\");\n }\n if (cp_count) {\n *cp_count = 0;\n }\n nextchar(pRExC_state);\n\tif (! node_p) {\n return FALSE;\n }\n\n *node_p = reg_node(pRExC_state,NOTHING);\n return TRUE;\n }\n\n RExC_parse += 2;\t/* Skip past the 'U+' */\n\n /* Because toke.c has generated a special construct for us guaranteed not\n * to have NULs, we can use a str function */\n endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n\n /* Code points are separated by dots. If none, there is only one code\n * point, and is terminated by the brace */\n\n if (endchar >= endbrace) {\n\tSTRLEN length_of_hex;\n\tI32 grok_hex_flags;\n\n /* Here, exactly one code point. If that isn't what is wanted, fail */\n if (! code_point_p) {\n RExC_parse = p;\n return FALSE;\n }\n\n /* Convert code point from hex */\n\tlength_of_hex = (STRLEN)(endchar - RExC_parse);\n\tgrok_hex_flags = PERL_SCAN_ALLOW_UNDERSCORES\n | PERL_SCAN_DISALLOW_PREFIX\n\n /* No errors in the first pass (See [perl\n * #122671].) We let the code below find the\n * errors when there are multiple chars. */\n | ((SIZE_ONLY)\n ? PERL_SCAN_SILENT_ILLDIGIT\n : 0);\n\n /* This routine is the one place where both single- and double-quotish\n * \\N{U+xxxx} are evaluated. The value is a Unicode code point which\n * must be converted to native. */\n\t*code_point_p = UNI_TO_NATIVE(grok_hex(RExC_parse,\n &length_of_hex,\n &grok_hex_flags,\n NULL));\n\n\t/* The tokenizer should have guaranteed validity, but it's possible to\n * bypass it by using single quoting, so check. Don't do the check\n * here when there are multiple chars; we do it below anyway. */\n if (length_of_hex == 0\n || length_of_hex != (STRLEN)(endchar - RExC_parse) )\n {\n RExC_parse += length_of_hex;\t/* Includes all the valid */\n RExC_parse += (RExC_orig_utf8)\t/* point to after 1st invalid */\n ? UTF8SKIP(RExC_parse)\n : 1;\n /* Guard against malformed utf8 */\n if (RExC_parse >= endchar) {\n RExC_parse = endchar;\n }\n vFAIL(\"Invalid hexadecimal number in \\\\N{U+...}\");\n }\n\n RExC_parse = endbrace + 1;\n return TRUE;\n }\n else { /* Is a multiple character sequence */\n\tSV * substitute_parse;\n\tSTRLEN len;\n\tchar *orig_end = RExC_end;\n\tchar *save_start = RExC_start;\n I32 flags;\n\n /* Count the code points, if desired, in the sequence */\n if (cp_count) {\n *cp_count = 0;\n while (RExC_parse < endbrace) {\n /* Point to the beginning of the next character in the sequence. */\n RExC_parse = endchar + 1;\n endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n (*cp_count)++;\n }\n }\n\n /* Fail if caller doesn't want to handle a multi-code-point sequence.\n * But don't backup up the pointer if the caller wants to know how many\n * code points there are (they can then handle things) */\n if (! node_p) {\n if (! cp_count) {\n RExC_parse = p;\n }\n return FALSE;\n }\n\n\t/* What is done here is to convert this to a sub-pattern of the form\n * \\x{char1}\\x{char2}... and then call reg recursively to parse it\n * (enclosing in \"(?: ... )\" ). That way, it retains its atomicness,\n * while not having to worry about special handling that some code\n * points may have. */\n\n\tsubstitute_parse = newSVpvs(\"?:\");\n\n\twhile (RExC_parse < endbrace) {\n\n\t /* Convert to notation the rest of the code understands */\n\t sv_catpv(substitute_parse, \"\\\\x{\");\n\t sv_catpvn(substitute_parse, RExC_parse, endchar - RExC_parse);\n\t sv_catpv(substitute_parse, \"}\");\n\n\t /* Point to the beginning of the next character in the sequence. */\n\t RExC_parse = endchar + 1;\n\t endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n\n\t}\n sv_catpv(substitute_parse, \")\");\n\n len = SvCUR(substitute_parse);\n\n\t/* Don't allow empty number */\n\tif (len < (STRLEN) 8) {\n RExC_parse = endbrace;\n\t vFAIL(\"Invalid hexadecimal number in \\\\N{U+...}\");\n\t}\n\n RExC_parse = RExC_start = RExC_adjusted_start\n = SvPV_nolen(substitute_parse);\n\tRExC_end = RExC_parse + len;\n\n /* The values are Unicode, and therefore not subject to recoding, but\n * have to be converted to native on a non-Unicode (meaning non-ASCII)\n * platform. */\n#ifdef EBCDIC\n RExC_recode_x_to_native = 1;\n#endif\n\n *node_p = reg(pRExC_state, 1, &flags, depth+1);\n\n /* Restore the saved values */\n\tRExC_start = RExC_adjusted_start = save_start;\n\tRExC_parse = endbrace;\n\tRExC_end = orig_end;\n#ifdef EBCDIC\n RExC_recode_x_to_native = 0;\n#endif\n SvREFCNT_dec_NN(substitute_parse);\n\n if (! *node_p) {\n if (flags & (RESTART_PASS1|NEED_UTF8)) {\n *flagp = flags & (RESTART_PASS1|NEED_UTF8);\n return FALSE;\n }\n FAIL2(\"panic: reg returned NULL to grok_bslash_N, flags=%#\" UVxf,\n (UV) flags);\n }\n *flagp |= flags&(HASWIDTH|SPSTART|SIMPLE|POSTPONED);\n\n nextchar(pRExC_state);\n\n return TRUE;\n }\n}","lang":"c","vul_type":"cwe-125","target_token_count":3316,"sven_meta":{"func_name":"S_grok_bslash_N","file_name":"regcomp.c","commit_link":"github.com/Perl/perl5/commit/43b2f4ef399e2fd7240b4eeb0658686ad95f8e62","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#77-18555a38a752","input":"int WavpackVerifySingleBlock (unsigned char *buffer, int verify_checksum)\n{\n WavpackHeader *wphdr = (WavpackHeader *) buffer;\n uint32_t checksum_passed = 0, bcount, meta_bc;\n unsigned char *dp, meta_id, c1, c2;\n\n if (strncmp (wphdr->ckID, \"wvpk\", 4) || wphdr->ckSize + 8 < sizeof (WavpackHeader))\n return FALSE;\n\n bcount = wphdr->ckSize - sizeof (WavpackHeader) + 8;\n dp = (unsigned char *)(wphdr + 1);\n\n while (bcount >= 2) {\n meta_id = *dp++;\n c1 = *dp++;\n\n meta_bc = c1 << 1;\n bcount -= 2;\n\n if (meta_id & ID_LARGE) {\n if (bcount < 2)\n return FALSE;\n\n c1 = *dp++;\n c2 = *dp++;\n meta_bc += ((uint32_t) c1 << 9) + ((uint32_t) c2 << 17);\n bcount -= 2;\n }\n\n if (bcount < meta_bc)\n return FALSE;\n\n if (verify_checksum && (meta_id & ID_UNIQUE) == ID_BLOCK_CHECKSUM) {\n#ifdef BITSTREAM_SHORTS\n uint16_t *csptr = (uint16_t*) buffer;\n#else\n unsigned char *csptr = buffer;\n#endif\n int wcount = (int)(dp - 2 - buffer) >> 1;\n uint32_t csum = (uint32_t) -1;\n\n if ((meta_id & ID_ODD_SIZE) || meta_bc < 2 || meta_bc > 4)\n return FALSE;\n\n#ifdef BITSTREAM_SHORTS\n while (wcount--)\n csum = (csum * 3) + *csptr++;\n#else\n WavpackNativeToLittleEndian ((WavpackHeader *) buffer, WavpackHeaderFormat);\n\n while (wcount--) {\n csum = (csum * 3) + csptr [0] + (csptr [1] << 8);\n csptr += 2;\n }\n\n WavpackLittleEndianToNative ((WavpackHeader *) buffer, WavpackHeaderFormat);\n#endif\n\n if (meta_bc == 4) {\n if (*dp++ != (csum & 0xff) || *dp++ != ((csum >> 8) & 0xff) || *dp++ != ((csum >> 16) & 0xff) || *dp++ != ((csum >> 24) & 0xff))\n return FALSE;\n }\n else {\n csum ^= csum >> 16;\n\n if (*dp++ != (csum & 0xff) || *dp++ != ((csum >> 8) & 0xff))\n return FALSE;\n }\n\n checksum_passed++;\n }\n\n bcount -= meta_bc;\n dp += meta_bc;\n }\n\n return (bcount == 0) && (!verify_checksum || !(wphdr->flags & HAS_CHECKSUM) || checksum_passed);\n}","target":"int WavpackVerifySingleBlock (unsigned char *buffer, int verify_checksum)\n{\n WavpackHeader *wphdr = (WavpackHeader *) buffer;\n uint32_t checksum_passed = 0, bcount, meta_bc;\n unsigned char *dp, meta_id, c1, c2;\n\n if (strncmp (wphdr->ckID, \"wvpk\", 4) || wphdr->ckSize + 8 < sizeof (WavpackHeader))\n return FALSE;\n\n bcount = wphdr->ckSize - sizeof (WavpackHeader) + 8;\n dp = (unsigned char *)(wphdr + 1);\n\n while (bcount >= 2) {\n meta_id = *dp++;\n c1 = *dp++;\n\n meta_bc = c1 << 1;\n bcount -= 2;\n\n if (meta_id & ID_LARGE) {\n if (bcount < 2)\n return FALSE;\n\n c1 = *dp++;\n c2 = *dp++;\n meta_bc += ((uint32_t) c1 << 9) + ((uint32_t) c2 << 17);\n bcount -= 2;\n }\n\n if (bcount < meta_bc)\n return FALSE;\n\n if (verify_checksum && (meta_id & ID_UNIQUE) == ID_BLOCK_CHECKSUM) {\n#ifdef BITSTREAM_SHORTS\n uint16_t *csptr = (uint16_t*) buffer;\n#else\n unsigned char *csptr = buffer;\n#endif\n int wcount = (int)(dp - 2 - buffer) >> 1;\n uint32_t csum = (uint32_t) -1;\n\n if ((meta_id & ID_ODD_SIZE) || meta_bc < 2 || meta_bc > 4)\n return FALSE;\n\n#ifdef BITSTREAM_SHORTS\n while (wcount--)\n csum = (csum * 3) + *csptr++;\n#else\n WavpackNativeToLittleEndian ((WavpackHeader *) buffer, WavpackHeaderFormat);\n\n while (wcount--) {\n csum = (csum * 3) + csptr [0] + (csptr [1] << 8);\n csptr += 2;\n }\n\n WavpackLittleEndianToNative ((WavpackHeader *) buffer, WavpackHeaderFormat);\n#endif\n\n if (meta_bc == 4) {\n if (*dp != (csum & 0xff) || dp[1] != ((csum >> 8) & 0xff) || dp[2] != ((csum >> 16) & 0xff) || dp[3] != ((csum >> 24) & 0xff))\n return FALSE;\n }\n else {\n csum ^= csum >> 16;\n\n if (*dp != (csum & 0xff) || dp[1] != ((csum >> 8) & 0xff))\n return FALSE;\n }\n\n checksum_passed++;\n }\n\n bcount -= meta_bc;\n dp += meta_bc;\n }\n\n return (bcount == 0) && (!verify_checksum || !(wphdr->flags & HAS_CHECKSUM) || checksum_passed);\n}","lang":"c","vul_type":"cwe-125","target_token_count":709,"sven_meta":{"func_name":"WavpackVerifySingleBlock","file_name":"src/open_utils.c","commit_link":"github.com/dbry/WavPack/commit/bba5389dc598a92bdf2b297c3ea34620b6679b5b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#78-39c4e0c6097d","input":"static Image *ReadVIFFImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n#define VFF_CM_genericRGB 15\n#define VFF_CM_ntscRGB 1\n#define VFF_CM_NONE 0\n#define VFF_DEP_DECORDER 0x4\n#define VFF_DEP_NSORDER 0x8\n#define VFF_DES_RAW 0\n#define VFF_LOC_IMPLICIT 1\n#define VFF_MAPTYP_NONE 0\n#define VFF_MAPTYP_1_BYTE 1\n#define VFF_MAPTYP_2_BYTE 2\n#define VFF_MAPTYP_4_BYTE 4\n#define VFF_MAPTYP_FLOAT 5\n#define VFF_MAPTYP_DOUBLE 7\n#define VFF_MS_NONE 0\n#define VFF_MS_ONEPERBAND 1\n#define VFF_MS_SHARED 3\n#define VFF_TYP_BIT 0\n#define VFF_TYP_1_BYTE 1\n#define VFF_TYP_2_BYTE 2\n#define VFF_TYP_4_BYTE 4\n#define VFF_TYP_FLOAT 5\n#define VFF_TYP_DOUBLE 9\n\n typedef struct _ViffInfo\n {\n unsigned char\n identifier,\n file_type,\n release,\n version,\n machine_dependency,\n reserve[3];\n\n char\n comment[512];\n\n unsigned int\n rows,\n columns,\n subrows;\n\n int\n x_offset,\n y_offset;\n\n float\n x_bits_per_pixel,\n y_bits_per_pixel;\n\n unsigned int\n location_type,\n location_dimension,\n number_of_images,\n number_data_bands,\n data_storage_type,\n data_encode_scheme,\n map_scheme,\n map_storage_type,\n map_rows,\n map_columns,\n map_subrows,\n map_enable,\n maps_per_cycle,\n color_space_model;\n } ViffInfo;\n\n double\n min_value,\n scale_factor,\n value;\n\n Image\n *image;\n\n int\n bit;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n register IndexPacket\n *indexes;\n\n register ssize_t\n x;\n\n register PixelPacket\n *q;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n bytes_per_pixel,\n max_packets,\n quantum;\n\n ssize_t\n count,\n y;\n\n unsigned char\n *pixels;\n\n unsigned long\n lsb_first;\n\n ViffInfo\n viff_info;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read VIFF header (1024 bytes).\n */\n count=ReadBlob(image,1,&viff_info.identifier);\n do\n {\n /*\n Verify VIFF identifier.\n */\n if ((count != 1) || ((unsigned char) viff_info.identifier != 0xab))\n ThrowReaderException(CorruptImageError,\"NotAVIFFImage\");\n /*\n Initialize VIFF image.\n */\n (void) ReadBlob(image,sizeof(viff_info.file_type),&viff_info.file_type);\n (void) ReadBlob(image,sizeof(viff_info.release),&viff_info.release);\n (void) ReadBlob(image,sizeof(viff_info.version),&viff_info.version);\n (void) ReadBlob(image,sizeof(viff_info.machine_dependency),\n &viff_info.machine_dependency);\n (void) ReadBlob(image,sizeof(viff_info.reserve),viff_info.reserve);\n (void) ReadBlob(image,512,(unsigned char *) viff_info.comment);\n viff_info.comment[511]='\\0';\n if (strlen(viff_info.comment) > 4)\n (void) SetImageProperty(image,\"comment\",viff_info.comment);\n if ((viff_info.machine_dependency == VFF_DEP_DECORDER) ||\n (viff_info.machine_dependency == VFF_DEP_NSORDER))\n image->endian=LSBEndian;\n else\n image->endian=MSBEndian;\n viff_info.rows=ReadBlobLong(image);\n viff_info.columns=ReadBlobLong(image);\n viff_info.subrows=ReadBlobLong(image);\n viff_info.x_offset=(int) ReadBlobLong(image);\n viff_info.y_offset=(int) ReadBlobLong(image);\n viff_info.x_bits_per_pixel=(float) ReadBlobLong(image);\n viff_info.y_bits_per_pixel=(float) ReadBlobLong(image);\n viff_info.location_type=ReadBlobLong(image);\n viff_info.location_dimension=ReadBlobLong(image);\n viff_info.number_of_images=ReadBlobLong(image);\n viff_info.number_data_bands=ReadBlobLong(image);\n viff_info.data_storage_type=ReadBlobLong(image);\n viff_info.data_encode_scheme=ReadBlobLong(image);\n viff_info.map_scheme=ReadBlobLong(image);\n viff_info.map_storage_type=ReadBlobLong(image);\n viff_info.map_rows=ReadBlobLong(image);\n viff_info.map_columns=ReadBlobLong(image);\n viff_info.map_subrows=ReadBlobLong(image);\n viff_info.map_enable=ReadBlobLong(image);\n viff_info.maps_per_cycle=ReadBlobLong(image);\n viff_info.color_space_model=ReadBlobLong(image);\n for (i=0; i < 420; i++)\n (void) ReadBlobByte(image);\n if (EOFBlob(image) != MagickFalse)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n image->columns=viff_info.rows;\n image->rows=viff_info.columns;\n image->depth=viff_info.x_bits_per_pixel <= 8 ? 8UL :\n MAGICKCORE_QUANTUM_DEPTH;\n /*\n Verify that we can read this VIFF image.\n */\n number_pixels=(MagickSizeType) viff_info.columns*viff_info.rows;\n if (number_pixels != (size_t) number_pixels)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (number_pixels == 0)\n ThrowReaderException(CoderError,\"ImageColumnOrRowSizeIsNotSupported\");\n if ((viff_info.number_data_bands < 1) || (viff_info.number_data_bands > 4))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((viff_info.data_storage_type != VFF_TYP_BIT) &&\n (viff_info.data_storage_type != VFF_TYP_1_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_2_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_4_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_FLOAT) &&\n (viff_info.data_storage_type != VFF_TYP_DOUBLE))\n ThrowReaderException(CoderError,\"DataStorageTypeIsNotSupported\");\n if (viff_info.data_encode_scheme != VFF_DES_RAW)\n ThrowReaderException(CoderError,\"DataEncodingSchemeIsNotSupported\");\n if ((viff_info.map_storage_type != VFF_MAPTYP_NONE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_1_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_2_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_4_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_FLOAT) &&\n (viff_info.map_storage_type != VFF_MAPTYP_DOUBLE))\n ThrowReaderException(CoderError,\"MapStorageTypeIsNotSupported\");\n if ((viff_info.color_space_model != VFF_CM_NONE) &&\n (viff_info.color_space_model != VFF_CM_ntscRGB) &&\n (viff_info.color_space_model != VFF_CM_genericRGB))\n ThrowReaderException(CoderError,\"ColorspaceModelIsNotSupported\");\n if (viff_info.location_type != VFF_LOC_IMPLICIT)\n ThrowReaderException(CoderError,\"LocationTypeIsNotSupported\");\n if (viff_info.number_of_images != 1)\n ThrowReaderException(CoderError,\"NumberOfImagesIsNotSupported\");\n if (viff_info.map_rows == 0)\n viff_info.map_scheme=VFF_MS_NONE;\n switch ((int) viff_info.map_scheme)\n {\n case VFF_MS_NONE:\n {\n if (viff_info.number_data_bands < 3)\n {\n /*\n Create linear color ramp.\n */\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n image->colors=2;\n else\n if (viff_info.data_storage_type == VFF_MAPTYP_1_BYTE)\n image->colors=256UL;\n else\n image->colors=image->depth <= 8 ? 256UL : 65536UL;\n if (AcquireImageColormap(image,image->colors) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n break;\n }\n case VFF_MS_ONEPERBAND:\n case VFF_MS_SHARED:\n {\n unsigned char\n *viff_colormap;\n\n /*\n Allocate VIFF colormap.\n */\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_1_BYTE: bytes_per_pixel=1; break;\n case VFF_MAPTYP_2_BYTE: bytes_per_pixel=2; break;\n case VFF_MAPTYP_4_BYTE: bytes_per_pixel=4; break;\n case VFF_MAPTYP_FLOAT: bytes_per_pixel=4; break;\n case VFF_MAPTYP_DOUBLE: bytes_per_pixel=8; break;\n default: bytes_per_pixel=1; break;\n }\n image->colors=viff_info.map_columns;\n if (AcquireImageColormap(image,image->colors) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (viff_info.map_rows >\n (viff_info.map_rows*bytes_per_pixel*sizeof(*viff_colormap)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n viff_colormap=(unsigned char *) AcquireQuantumMemory(image->colors,\n viff_info.map_rows*bytes_per_pixel*sizeof(*viff_colormap));\n if (viff_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n /*\n Read VIFF raster colormap.\n */\n (void) ReadBlob(image,bytes_per_pixel*image->colors*viff_info.map_rows,\n viff_colormap);\n lsb_first=1;\n if (*(char *) &lsb_first &&\n ((viff_info.machine_dependency != VFF_DEP_DECORDER) &&\n (viff_info.machine_dependency != VFF_DEP_NSORDER)))\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_2_BYTE:\n {\n MSBOrderShort(viff_colormap,(bytes_per_pixel*image->colors*\n viff_info.map_rows));\n break;\n }\n case VFF_MAPTYP_4_BYTE:\n case VFF_MAPTYP_FLOAT:\n {\n MSBOrderLong(viff_colormap,(bytes_per_pixel*image->colors*\n viff_info.map_rows));\n break;\n }\n default: break;\n }\n for (i=0; i < (ssize_t) (viff_info.map_rows*image->colors); i++)\n {\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_2_BYTE: value=1.0*((short *) viff_colormap)[i]; break;\n case VFF_MAPTYP_4_BYTE: value=1.0*((int *) viff_colormap)[i]; break;\n case VFF_MAPTYP_FLOAT: value=((float *) viff_colormap)[i]; break;\n case VFF_MAPTYP_DOUBLE: value=((double *) viff_colormap)[i]; break;\n default: value=1.0*viff_colormap[i]; break;\n }\n if (i < (ssize_t) image->colors)\n {\n image->colormap[i].red=ScaleCharToQuantum((unsigned char) value);\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n value);\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char) value);\n }\n else\n if (i < (ssize_t) (2*image->colors))\n image->colormap[i % image->colors].green=ScaleCharToQuantum(\n (unsigned char) value);\n else\n if (i < (ssize_t) (3*image->colors))\n image->colormap[i % image->colors].blue=ScaleCharToQuantum(\n (unsigned char) value);\n }\n viff_colormap=(unsigned char *) RelinquishMagickMemory(viff_colormap);\n break;\n }\n default:\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n }\n /*\n Initialize image structure.\n */\n image->matte=viff_info.number_data_bands == 4 ? MagickTrue : MagickFalse;\n image->storage_class=\n (viff_info.number_data_bands < 3 ? PseudoClass : DirectClass);\n image->columns=viff_info.rows;\n image->rows=viff_info.columns;\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n /*\n Allocate VIFF pixels.\n */\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: bytes_per_pixel=2; break;\n case VFF_TYP_4_BYTE: bytes_per_pixel=4; break;\n case VFF_TYP_FLOAT: bytes_per_pixel=4; break;\n case VFF_TYP_DOUBLE: bytes_per_pixel=8; break;\n default: bytes_per_pixel=1; break;\n }\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n max_packets=((image->columns+7UL) >> 3UL)*image->rows;\n else\n max_packets=(size_t) (number_pixels*viff_info.number_data_bands);\n pixels=(unsigned char *) AcquireQuantumMemory(max_packets,\n bytes_per_pixel*sizeof(*pixels));\n if (pixels == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ReadBlob(image,bytes_per_pixel*max_packets,pixels);\n lsb_first=1;\n if (*(char *) &lsb_first &&\n ((viff_info.machine_dependency != VFF_DEP_DECORDER) &&\n (viff_info.machine_dependency != VFF_DEP_NSORDER)))\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE:\n {\n MSBOrderShort(pixels,bytes_per_pixel*max_packets);\n break;\n }\n case VFF_TYP_4_BYTE:\n case VFF_TYP_FLOAT:\n {\n MSBOrderLong(pixels,bytes_per_pixel*max_packets);\n break;\n }\n default: break;\n }\n min_value=0.0;\n scale_factor=1.0;\n if ((viff_info.data_storage_type != VFF_TYP_1_BYTE) &&\n (viff_info.map_scheme == VFF_MS_NONE))\n {\n double\n max_value;\n\n /*\n Determine scale factor.\n */\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[0]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[0]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[0]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[0]; break;\n default: value=1.0*pixels[0]; break;\n }\n max_value=value;\n min_value=value;\n for (i=0; i < (ssize_t) max_packets; i++)\n {\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[i]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[i]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[i]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[i]; break;\n default: value=1.0*pixels[i]; break;\n }\n if (value > max_value)\n max_value=value;\n else\n if (value < min_value)\n min_value=value;\n }\n if ((min_value == 0) && (max_value == 0))\n scale_factor=0;\n else\n if (min_value == max_value)\n {\n scale_factor=(MagickRealType) QuantumRange/min_value;\n min_value=0;\n }\n else\n scale_factor=(MagickRealType) QuantumRange/(max_value-min_value);\n }\n /*\n Convert pixels to Quantum size.\n */\n p=(unsigned char *) pixels;\n for (i=0; i < (ssize_t) max_packets; i++)\n {\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[i]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[i]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[i]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[i]; break;\n default: value=1.0*pixels[i]; break;\n }\n if (viff_info.map_scheme == VFF_MS_NONE)\n {\n value=(value-min_value)*scale_factor;\n if (value > QuantumRange)\n value=QuantumRange;\n else\n if (value < 0)\n value=0;\n }\n *p=(unsigned char) ((Quantum) value);\n p++;\n }\n /*\n Convert VIFF raster image to pixel packets.\n */\n p=(unsigned char *) pixels;\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n {\n /*\n Convert bitmap scanline.\n */\n if (image->storage_class != PseudoClass)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < (ssize_t) (image->columns-7); x+=8)\n {\n for (bit=0; bit < 8; bit++)\n {\n quantum=(size_t) ((*p) & (0x01 << bit) ? 0 : 1);\n SetPixelRed(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelGreen(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelBlue(q,quantum == 0 ? 0 : QuantumRange);\n if (image->storage_class == PseudoClass)\n SetPixelIndex(indexes+x+bit,quantum);\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=0; bit < (int) (image->columns % 8); bit++)\n {\n quantum=(size_t) ((*p) & (0x01 << bit) ? 0 : 1);\n SetPixelRed(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelGreen(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelBlue(q,quantum == 0 ? 0 : QuantumRange);\n if (image->storage_class == PseudoClass)\n SetPixelIndex(indexes+x+bit,quantum);\n }\n p++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n if (image->storage_class == PseudoClass)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n SetPixelIndex(indexes+x,*p++);\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n else\n {\n /*\n Convert DirectColor scanline.\n */\n number_pixels=(MagickSizeType) image->columns*image->rows;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(q,ScaleCharToQuantum(*p));\n SetPixelGreen(q,ScaleCharToQuantum(*(p+number_pixels)));\n SetPixelBlue(q,ScaleCharToQuantum(*(p+2*number_pixels)));\n if (image->colors != 0)\n {\n ssize_t\n index;\n\n index=(ssize_t) GetPixelRed(q);\n SetPixelRed(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].red);\n index=(ssize_t) GetPixelGreen(q);\n SetPixelGreen(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].green);\n index=(ssize_t) GetPixelRed(q);\n SetPixelBlue(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].blue);\n }\n SetPixelOpacity(q,image->matte != MagickFalse ? QuantumRange-\n ScaleCharToQuantum(*(p+number_pixels*3)) : OpaqueOpacity);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n pixels=(unsigned char *) RelinquishMagickMemory(pixels);\n if (image->storage_class == PseudoClass)\n (void) SyncImage(image);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n count=ReadBlob(image,1,&viff_info.identifier);\n if ((count != 0) && (viff_info.identifier == 0xab))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while ((count != 0) && (viff_info.identifier == 0xab));\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadVIFFImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n#define VFF_CM_genericRGB 15\n#define VFF_CM_ntscRGB 1\n#define VFF_CM_NONE 0\n#define VFF_DEP_DECORDER 0x4\n#define VFF_DEP_NSORDER 0x8\n#define VFF_DES_RAW 0\n#define VFF_LOC_IMPLICIT 1\n#define VFF_MAPTYP_NONE 0\n#define VFF_MAPTYP_1_BYTE 1\n#define VFF_MAPTYP_2_BYTE 2\n#define VFF_MAPTYP_4_BYTE 4\n#define VFF_MAPTYP_FLOAT 5\n#define VFF_MAPTYP_DOUBLE 7\n#define VFF_MS_NONE 0\n#define VFF_MS_ONEPERBAND 1\n#define VFF_MS_SHARED 3\n#define VFF_TYP_BIT 0\n#define VFF_TYP_1_BYTE 1\n#define VFF_TYP_2_BYTE 2\n#define VFF_TYP_4_BYTE 4\n#define VFF_TYP_FLOAT 5\n#define VFF_TYP_DOUBLE 9\n\n typedef struct _ViffInfo\n {\n unsigned char\n identifier,\n file_type,\n release,\n version,\n machine_dependency,\n reserve[3];\n\n char\n comment[512];\n\n unsigned int\n rows,\n columns,\n subrows;\n\n int\n x_offset,\n y_offset;\n\n float\n x_bits_per_pixel,\n y_bits_per_pixel;\n\n unsigned int\n location_type,\n location_dimension,\n number_of_images,\n number_data_bands,\n data_storage_type,\n data_encode_scheme,\n map_scheme,\n map_storage_type,\n map_rows,\n map_columns,\n map_subrows,\n map_enable,\n maps_per_cycle,\n color_space_model;\n } ViffInfo;\n\n double\n min_value,\n scale_factor,\n value;\n\n Image\n *image;\n\n int\n bit;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n register IndexPacket\n *indexes;\n\n register ssize_t\n x;\n\n register PixelPacket\n *q;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n bytes_per_pixel,\n max_packets,\n quantum;\n\n ssize_t\n count,\n y;\n\n unsigned char\n *pixels;\n\n unsigned long\n lsb_first;\n\n ViffInfo\n viff_info;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read VIFF header (1024 bytes).\n */\n count=ReadBlob(image,1,&viff_info.identifier);\n do\n {\n /*\n Verify VIFF identifier.\n */\n if ((count != 1) || ((unsigned char) viff_info.identifier != 0xab))\n ThrowReaderException(CorruptImageError,\"NotAVIFFImage\");\n /*\n Initialize VIFF image.\n */\n (void) ReadBlob(image,sizeof(viff_info.file_type),&viff_info.file_type);\n (void) ReadBlob(image,sizeof(viff_info.release),&viff_info.release);\n (void) ReadBlob(image,sizeof(viff_info.version),&viff_info.version);\n (void) ReadBlob(image,sizeof(viff_info.machine_dependency),\n &viff_info.machine_dependency);\n (void) ReadBlob(image,sizeof(viff_info.reserve),viff_info.reserve);\n (void) ReadBlob(image,512,(unsigned char *) viff_info.comment);\n viff_info.comment[511]='\\0';\n if (strlen(viff_info.comment) > 4)\n (void) SetImageProperty(image,\"comment\",viff_info.comment);\n if ((viff_info.machine_dependency == VFF_DEP_DECORDER) ||\n (viff_info.machine_dependency == VFF_DEP_NSORDER))\n image->endian=LSBEndian;\n else\n image->endian=MSBEndian;\n viff_info.rows=ReadBlobLong(image);\n viff_info.columns=ReadBlobLong(image);\n viff_info.subrows=ReadBlobLong(image);\n viff_info.x_offset=(int) ReadBlobLong(image);\n viff_info.y_offset=(int) ReadBlobLong(image);\n viff_info.x_bits_per_pixel=(float) ReadBlobLong(image);\n viff_info.y_bits_per_pixel=(float) ReadBlobLong(image);\n viff_info.location_type=ReadBlobLong(image);\n viff_info.location_dimension=ReadBlobLong(image);\n viff_info.number_of_images=ReadBlobLong(image);\n viff_info.number_data_bands=ReadBlobLong(image);\n viff_info.data_storage_type=ReadBlobLong(image);\n viff_info.data_encode_scheme=ReadBlobLong(image);\n viff_info.map_scheme=ReadBlobLong(image);\n viff_info.map_storage_type=ReadBlobLong(image);\n viff_info.map_rows=ReadBlobLong(image);\n viff_info.map_columns=ReadBlobLong(image);\n viff_info.map_subrows=ReadBlobLong(image);\n viff_info.map_enable=ReadBlobLong(image);\n viff_info.maps_per_cycle=ReadBlobLong(image);\n viff_info.color_space_model=ReadBlobLong(image);\n for (i=0; i < 420; i++)\n (void) ReadBlobByte(image);\n if (EOFBlob(image) != MagickFalse)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n image->columns=viff_info.rows;\n image->rows=viff_info.columns;\n image->depth=viff_info.x_bits_per_pixel <= 8 ? 8UL :\n MAGICKCORE_QUANTUM_DEPTH;\n /*\n Verify that we can read this VIFF image.\n */\n number_pixels=(MagickSizeType) viff_info.columns*viff_info.rows;\n if (number_pixels != (size_t) number_pixels)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (number_pixels == 0)\n ThrowReaderException(CoderError,\"ImageColumnOrRowSizeIsNotSupported\");\n if ((viff_info.number_data_bands < 1) || (viff_info.number_data_bands > 4))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((viff_info.data_storage_type != VFF_TYP_BIT) &&\n (viff_info.data_storage_type != VFF_TYP_1_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_2_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_4_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_FLOAT) &&\n (viff_info.data_storage_type != VFF_TYP_DOUBLE))\n ThrowReaderException(CoderError,\"DataStorageTypeIsNotSupported\");\n if (viff_info.data_encode_scheme != VFF_DES_RAW)\n ThrowReaderException(CoderError,\"DataEncodingSchemeIsNotSupported\");\n if ((viff_info.map_storage_type != VFF_MAPTYP_NONE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_1_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_2_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_4_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_FLOAT) &&\n (viff_info.map_storage_type != VFF_MAPTYP_DOUBLE))\n ThrowReaderException(CoderError,\"MapStorageTypeIsNotSupported\");\n if ((viff_info.color_space_model != VFF_CM_NONE) &&\n (viff_info.color_space_model != VFF_CM_ntscRGB) &&\n (viff_info.color_space_model != VFF_CM_genericRGB))\n ThrowReaderException(CoderError,\"ColorspaceModelIsNotSupported\");\n if (viff_info.location_type != VFF_LOC_IMPLICIT)\n ThrowReaderException(CoderError,\"LocationTypeIsNotSupported\");\n if (viff_info.number_of_images != 1)\n ThrowReaderException(CoderError,\"NumberOfImagesIsNotSupported\");\n if (viff_info.map_rows == 0)\n viff_info.map_scheme=VFF_MS_NONE;\n switch ((int) viff_info.map_scheme)\n {\n case VFF_MS_NONE:\n {\n if (viff_info.number_data_bands < 3)\n {\n /*\n Create linear color ramp.\n */\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n image->colors=2;\n else\n if (viff_info.data_storage_type == VFF_MAPTYP_1_BYTE)\n image->colors=256UL;\n else\n image->colors=image->depth <= 8 ? 256UL : 65536UL;\n if (AcquireImageColormap(image,image->colors) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n break;\n }\n case VFF_MS_ONEPERBAND:\n case VFF_MS_SHARED:\n {\n unsigned char\n *viff_colormap;\n\n /*\n Allocate VIFF colormap.\n */\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_1_BYTE: bytes_per_pixel=1; break;\n case VFF_MAPTYP_2_BYTE: bytes_per_pixel=2; break;\n case VFF_MAPTYP_4_BYTE: bytes_per_pixel=4; break;\n case VFF_MAPTYP_FLOAT: bytes_per_pixel=4; break;\n case VFF_MAPTYP_DOUBLE: bytes_per_pixel=8; break;\n default: bytes_per_pixel=1; break;\n }\n image->colors=viff_info.map_columns;\n if (AcquireImageColormap(image,image->colors) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (viff_info.map_rows >\n (viff_info.map_rows*bytes_per_pixel*sizeof(*viff_colormap)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n viff_colormap=(unsigned char *) AcquireQuantumMemory(image->colors,\n viff_info.map_rows*bytes_per_pixel*sizeof(*viff_colormap));\n if (viff_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n /*\n Read VIFF raster colormap.\n */\n (void) ReadBlob(image,bytes_per_pixel*image->colors*viff_info.map_rows,\n viff_colormap);\n lsb_first=1;\n if (*(char *) &lsb_first &&\n ((viff_info.machine_dependency != VFF_DEP_DECORDER) &&\n (viff_info.machine_dependency != VFF_DEP_NSORDER)))\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_2_BYTE:\n {\n MSBOrderShort(viff_colormap,(bytes_per_pixel*image->colors*\n viff_info.map_rows));\n break;\n }\n case VFF_MAPTYP_4_BYTE:\n case VFF_MAPTYP_FLOAT:\n {\n MSBOrderLong(viff_colormap,(bytes_per_pixel*image->colors*\n viff_info.map_rows));\n break;\n }\n default: break;\n }\n for (i=0; i < (ssize_t) (viff_info.map_rows*image->colors); i++)\n {\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_2_BYTE: value=1.0*((short *) viff_colormap)[i]; break;\n case VFF_MAPTYP_4_BYTE: value=1.0*((int *) viff_colormap)[i]; break;\n case VFF_MAPTYP_FLOAT: value=((float *) viff_colormap)[i]; break;\n case VFF_MAPTYP_DOUBLE: value=((double *) viff_colormap)[i]; break;\n default: value=1.0*viff_colormap[i]; break;\n }\n if (i < (ssize_t) image->colors)\n {\n image->colormap[i].red=ScaleCharToQuantum((unsigned char) value);\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n value);\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char) value);\n }\n else\n if (i < (ssize_t) (2*image->colors))\n image->colormap[i % image->colors].green=ScaleCharToQuantum(\n (unsigned char) value);\n else\n if (i < (ssize_t) (3*image->colors))\n image->colormap[i % image->colors].blue=ScaleCharToQuantum(\n (unsigned char) value);\n }\n viff_colormap=(unsigned char *) RelinquishMagickMemory(viff_colormap);\n break;\n }\n default:\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n }\n /*\n Initialize image structure.\n */\n image->matte=viff_info.number_data_bands == 4 ? MagickTrue : MagickFalse;\n image->storage_class=\n (viff_info.number_data_bands < 3 ? PseudoClass : DirectClass);\n image->columns=viff_info.rows;\n image->rows=viff_info.columns;\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n /*\n Allocate VIFF pixels.\n */\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: bytes_per_pixel=2; break;\n case VFF_TYP_4_BYTE: bytes_per_pixel=4; break;\n case VFF_TYP_FLOAT: bytes_per_pixel=4; break;\n case VFF_TYP_DOUBLE: bytes_per_pixel=8; break;\n default: bytes_per_pixel=1; break;\n }\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n max_packets=((image->columns+7UL) >> 3UL)*image->rows;\n else\n max_packets=(size_t) (number_pixels*viff_info.number_data_bands);\n pixels=(unsigned char *) AcquireQuantumMemory(MagickMax(number_pixels,\n max_packets),bytes_per_pixel*sizeof(*pixels));\n if (pixels == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ReadBlob(image,bytes_per_pixel*max_packets,pixels);\n lsb_first=1;\n if (*(char *) &lsb_first &&\n ((viff_info.machine_dependency != VFF_DEP_DECORDER) &&\n (viff_info.machine_dependency != VFF_DEP_NSORDER)))\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE:\n {\n MSBOrderShort(pixels,bytes_per_pixel*max_packets);\n break;\n }\n case VFF_TYP_4_BYTE:\n case VFF_TYP_FLOAT:\n {\n MSBOrderLong(pixels,bytes_per_pixel*max_packets);\n break;\n }\n default: break;\n }\n min_value=0.0;\n scale_factor=1.0;\n if ((viff_info.data_storage_type != VFF_TYP_1_BYTE) &&\n (viff_info.map_scheme == VFF_MS_NONE))\n {\n double\n max_value;\n\n /*\n Determine scale factor.\n */\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[0]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[0]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[0]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[0]; break;\n default: value=1.0*pixels[0]; break;\n }\n max_value=value;\n min_value=value;\n for (i=0; i < (ssize_t) max_packets; i++)\n {\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[i]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[i]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[i]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[i]; break;\n default: value=1.0*pixels[i]; break;\n }\n if (value > max_value)\n max_value=value;\n else\n if (value < min_value)\n min_value=value;\n }\n if ((min_value == 0) && (max_value == 0))\n scale_factor=0;\n else\n if (min_value == max_value)\n {\n scale_factor=(MagickRealType) QuantumRange/min_value;\n min_value=0;\n }\n else\n scale_factor=(MagickRealType) QuantumRange/(max_value-min_value);\n }\n /*\n Convert pixels to Quantum size.\n */\n p=(unsigned char *) pixels;\n for (i=0; i < (ssize_t) max_packets; i++)\n {\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[i]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[i]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[i]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[i]; break;\n default: value=1.0*pixels[i]; break;\n }\n if (viff_info.map_scheme == VFF_MS_NONE)\n {\n value=(value-min_value)*scale_factor;\n if (value > QuantumRange)\n value=QuantumRange;\n else\n if (value < 0)\n value=0;\n }\n *p=(unsigned char) ((Quantum) value);\n p++;\n }\n /*\n Convert VIFF raster image to pixel packets.\n */\n p=(unsigned char *) pixels;\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n {\n /*\n Convert bitmap scanline.\n */\n if (image->storage_class != PseudoClass)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < (ssize_t) (image->columns-7); x+=8)\n {\n for (bit=0; bit < 8; bit++)\n {\n quantum=(size_t) ((*p) & (0x01 << bit) ? 0 : 1);\n SetPixelRed(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelGreen(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelBlue(q,quantum == 0 ? 0 : QuantumRange);\n if (image->storage_class == PseudoClass)\n SetPixelIndex(indexes+x+bit,quantum);\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=0; bit < (int) (image->columns % 8); bit++)\n {\n quantum=(size_t) ((*p) & (0x01 << bit) ? 0 : 1);\n SetPixelRed(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelGreen(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelBlue(q,quantum == 0 ? 0 : QuantumRange);\n if (image->storage_class == PseudoClass)\n SetPixelIndex(indexes+x+bit,quantum);\n }\n p++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n if (image->storage_class == PseudoClass)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n SetPixelIndex(indexes+x,*p++);\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n else\n {\n /*\n Convert DirectColor scanline.\n */\n number_pixels=(MagickSizeType) image->columns*image->rows;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(q,ScaleCharToQuantum(*p));\n SetPixelGreen(q,ScaleCharToQuantum(*(p+number_pixels)));\n SetPixelBlue(q,ScaleCharToQuantum(*(p+2*number_pixels)));\n if (image->colors != 0)\n {\n ssize_t\n index;\n\n index=(ssize_t) GetPixelRed(q);\n SetPixelRed(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].red);\n index=(ssize_t) GetPixelGreen(q);\n SetPixelGreen(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].green);\n index=(ssize_t) GetPixelRed(q);\n SetPixelBlue(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].blue);\n }\n SetPixelOpacity(q,image->matte != MagickFalse ? QuantumRange-\n ScaleCharToQuantum(*(p+number_pixels*3)) : OpaqueOpacity);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n pixels=(unsigned char *) RelinquishMagickMemory(pixels);\n if (image->storage_class == PseudoClass)\n (void) SyncImage(image);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n count=ReadBlob(image,1,&viff_info.identifier);\n if ((count != 0) && (viff_info.identifier == 0xab))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while ((count != 0) && (viff_info.identifier == 0xab));\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-125","target_token_count":5526,"sven_meta":{"func_name":"ReadVIFFImage","file_name":"coders/viff.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/ca0c886abd6d3ef335eb74150cd23b89ebd17135","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#79-304310595010","input":"static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int fmt) {\n\tint stacksize = r_config_get_i (core->config, \"esil.stack.depth\");\n\tbool iotrap = r_config_get_i (core->config, \"esil.iotrap\");\n\tbool romem = r_config_get_i (core->config, \"esil.romem\");\n\tbool stats = r_config_get_i (core->config, \"esil.stats\");\n\tbool be = core->print->big_endian;\n\tbool use_color = core->print->flags & R_PRINT_FLAGS_COLOR;\n\tcore->parser->relsub = r_config_get_i (core->config, \"asm.relsub\");\n\tint ret, i, j, idx, size;\n\tconst char *color = \"\";\n\tconst char *esilstr;\n\tconst char *opexstr;\n\tRAnalHint *hint;\n\tRAnalEsil *esil = NULL;\n\tRAsmOp asmop;\n\tRAnalOp op = {0};\n\tut64 addr;\n\tbool isFirst = true;\n\tunsigned int addrsize = r_config_get_i (core->config, \"esil.addr.size\");\n\tint totalsize = 0;\n\n\t// Variables required for setting up ESIL to REIL conversion\n\tif (use_color) {\n\t\tcolor = core->cons->pal.label;\n\t}\n\tswitch (fmt) {\n\tcase 'j':\n\t\tr_cons_printf (\"[\");\n\t\tbreak;\n\tcase 'r':\n\t\t// Setup for ESIL to REIL conversion\n\t\tesil = r_anal_esil_new (stacksize, iotrap, addrsize);\n\t\tif (!esil) {\n\t\t\treturn;\n\t\t}\n\t\tr_anal_esil_to_reil_setup (esil, core->anal, romem, stats);\n\t\tr_anal_esil_set_pc (esil, core->offset);\n\t\tbreak;\n\t}\n\tfor (i = idx = ret = 0; idx < len && (!nops || (nops && i < nops)); i++, idx += ret) {\n\t\taddr = core->offset + idx;\n\t\t// TODO: use more anal hints\n\t\thint = r_anal_hint_get (core->anal, addr);\n\t\tr_asm_set_pc (core->assembler, addr);\n\t\t(void)r_asm_disassemble (core->assembler, &asmop, buf + idx, len - idx);\n\t\tret = r_anal_op (core->anal, &op, core->offset + idx, buf + idx, len - idx, R_ANAL_OP_MASK_ESIL);\n\t\tesilstr = R_STRBUF_SAFEGET (&op.esil);\n\t\topexstr = R_STRBUF_SAFEGET (&op.opex);\n\t\tchar *mnem = strdup (r_asm_op_get_asm (&asmop));\n\t\tchar *sp = strchr (mnem, ' ');\n\t\tif (sp) {\n\t\t\t*sp = 0;\n\t\t\tif (op.prefix) {\n\t\t\t\tchar *arg = strdup (sp + 1);\n\t\t\t\tchar *sp = strchr (arg, ' ');\n\t\t\t\tif (sp) {\n\t\t\t\t\t*sp = 0;\n\t\t\t\t}\n\t\t\t\tfree (mnem);\n\t\t\t\tmnem = arg;\n\t\t\t}\n\t\t}\n\t\tif (ret < 1 && fmt != 'd') {\n\t\t\teprintf (\"Oops at 0x%08\" PFMT64x \" (\", core->offset + idx);\n\t\t\tfor (i = idx, j = 0; i < core->blocksize && j < 3; ++i, ++j) {\n\t\t\t\teprintf (\"%02x \", buf[i]);\n\t\t\t}\n\t\t\teprintf (\"...)\\n\");\n\t\t\tfree (mnem);\n\t\t\tbreak;\n\t\t}\n\t\tsize = (hint && hint->size)? hint->size: op.size;\n\t\tif (fmt == 'd') {\n\t\t\tchar *opname = strdup (r_asm_op_get_asm (&asmop));\n\t\t\tif (opname) {\n\t\t\t\tr_str_split (opname, ' ');\n\t\t\t\tchar *d = r_asm_describe (core->assembler, opname);\n\t\t\t\tif (d && *d) {\n\t\t\t\t\tr_cons_printf (\"%s: %s\\n\", opname, d);\n\t\t\t\t\tfree (d);\n\t\t\t\t} else {\n\t\t\t\t\teprintf (\"Unknown opcode\\n\");\n\t\t\t\t}\n\t\t\t\tfree (opname);\n\t\t\t}\n\t\t} else if (fmt == 'e') {\n\t\t\tif (*esilstr) {\n\t\t\t\tif (use_color) {\n\t\t\t\t\tr_cons_printf (\"%s0x%\" PFMT64x Color_RESET \" %s\\n\", color, core->offset + idx, esilstr);\n\t\t\t\t} else {\n\t\t\t\t\tr_cons_printf (\"0x%\" PFMT64x \" %s\\n\", core->offset + idx, esilstr);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (fmt == 's') {\n\t\t\ttotalsize += op.size;\n\t\t} else if (fmt == 'r') {\n\t\t\tif (*esilstr) {\n\t\t\t\tif (use_color) {\n\t\t\t\t\tr_cons_printf (\"%s0x%\" PFMT64x Color_RESET \"\\n\", color, core->offset + idx);\n\t\t\t\t} else {\n\t\t\t\t\tr_cons_printf (\"0x%\" PFMT64x \"\\n\", core->offset + idx);\n\t\t\t\t}\n\t\t\t\tr_anal_esil_parse (esil, esilstr);\n\t\t\t\tr_anal_esil_dumpstack (esil);\n\t\t\t\tr_anal_esil_stack_free (esil);\n\t\t\t}\n\t\t} else if (fmt == 'j') {\n\t\t\tif (isFirst) {\n\t\t\t\tisFirst = false;\n\t\t\t} else {\n\t\t\t\tr_cons_print (\",\");\n\t\t\t}\n\t\t\tr_cons_printf (\"{\\\"opcode\\\":\\\"%s\\\",\", r_asm_op_get_asm (&asmop));\n\t\t\t{\n\t\t\t\tchar strsub[128] = { 0 };\n\t\t\t\t// pc+33\n\t\t\t\tr_parse_varsub (core->parser, NULL,\n\t\t\t\t\tcore->offset + idx,\n\t\t\t\t\tasmop.size, r_asm_op_get_asm (&asmop),\n\t\t\t\t\tstrsub, sizeof (strsub));\n\t\t\t\t{\n\t\t\t\t\tut64 killme = UT64_MAX;\n\t\t\t\t\tif (r_io_read_i (core->io, op.ptr, &killme, op.refptr, be)) {\n\t\t\t\t\t\tcore->parser->relsub_addr = killme;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 0x33->sym.xx\n\t\t\t\tchar *p = strdup (strsub);\n\t\t\t\tif (p) {\n\t\t\t\t\tr_parse_filter (core->parser, addr, core->flags, p,\n\t\t\t\t\t\t\tstrsub, sizeof (strsub), be);\n\t\t\t\t\tfree (p);\n\t\t\t\t}\n\t\t\t\tr_cons_printf (\"\\\"disasm\\\":\\\"%s\\\",\", strsub);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"mnemonic\\\":\\\"%s\\\",\", mnem);\n\t\t\tif (hint && hint->opcode) {\n\t\t\t\tr_cons_printf (\"\\\"ophint\\\":\\\"%s\\\",\", hint->opcode);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"sign\\\":%s,\", r_str_bool (op.sign));\n\t\t\tr_cons_printf (\"\\\"prefix\\\":%\" PFMT64u \",\", op.prefix);\n\t\t\tr_cons_printf (\"\\\"id\\\":%d,\", op.id);\n\t\t\tif (opexstr && *opexstr) {\n\t\t\t\tr_cons_printf (\"\\\"opex\\\":%s,\", opexstr);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"addr\\\":%\" PFMT64u \",\", core->offset + idx);\n\t\t\tr_cons_printf (\"\\\"bytes\\\":\\\"\");\n\t\t\tfor (j = 0; j < size; j++) {\n\t\t\t\tr_cons_printf (\"%02x\", buf[j + idx]);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\",\");\n\t\t\tif (op.val != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"val\\\": %\" PFMT64u \",\", op.val);\n\t\t\t}\n\t\t\tif (op.ptr != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"ptr\\\": %\" PFMT64u \",\", op.ptr);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"size\\\": %d,\", size);\n\t\t\tr_cons_printf (\"\\\"type\\\": \\\"%s\\\",\",\n\t\t\t\tr_anal_optype_to_string (op.type));\n\t\t\tif (op.reg) {\n\t\t\t\tr_cons_printf (\"\\\"reg\\\": \\\"%s\\\",\", op.reg);\n\t\t\t}\n\t\t\tif (op.ireg) {\n\t\t\t\tr_cons_printf (\"\\\"ireg\\\": \\\"%s\\\",\", op.ireg);\n\t\t\t}\n\t\t\tif (op.scale) {\n\t\t\t\tr_cons_printf (\"\\\"scale\\\":%d,\", op.scale);\n\t\t\t}\n\t\t\tif (hint && hint->esil) {\n\t\t\t\tr_cons_printf (\"\\\"esil\\\": \\\"%s\\\",\", hint->esil);\n\t\t\t} else if (*esilstr) {\n\t\t\t\tr_cons_printf (\"\\\"esil\\\": \\\"%s\\\",\", esilstr);\n\t\t\t}\n\t\t\tif (hint && hint->jump != UT64_MAX) {\n\t\t\t\top.jump = hint->jump;\n\t\t\t}\n\t\t\tif (op.jump != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"jump\\\":%\" PFMT64u \",\", op.jump);\n\t\t\t}\n\t\t\tif (hint && hint->fail != UT64_MAX) {\n\t\t\t\top.fail = hint->fail;\n\t\t\t}\n\t\t\tif (op.refptr != -1) {\n\t\t\t\tr_cons_printf (\"\\\"refptr\\\":%d,\", op.refptr);\n\t\t\t}\n\t\t\tif (op.fail != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"fail\\\":%\" PFMT64u \",\", op.fail);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"cycles\\\":%d,\", op.cycles);\n\t\t\tif (op.failcycles) {\n\t\t\t\tr_cons_printf (\"\\\"failcycles\\\":%d,\", op.failcycles);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"delay\\\":%d,\", op.delay);\n\t\t\t{\n\t\t\t\tconst char *p = r_anal_stackop_tostring (op.stackop);\n\t\t\t\tif (p && *p && strcmp (p, \"null\"))\n\t\t\t\t\tr_cons_printf (\"\\\"stack\\\":\\\"%s\\\",\", p);\n\t\t\t}\n\t\t\tif (op.stackptr) {\n\t\t\t\tr_cons_printf (\"\\\"stackptr\\\":%d,\", op.stackptr);\n\t\t\t}\n\t\t\t{\n\t\t\t\tconst char *arg = (op.type & R_ANAL_OP_TYPE_COND)\n\t\t\t\t\t? r_anal_cond_tostring (op.cond): NULL;\n\t\t\t\tif (arg) {\n\t\t\t\t\tr_cons_printf (\"\\\"cond\\\":\\\"%s\\\",\", arg);\n\t\t\t\t}\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"family\\\":\\\"%s\\\"}\", r_anal_op_family_to_string (op.family));\n\t\t} else {\n#define printline(k, fmt, arg)\\\n\t{ \\\n\t\tif (use_color)\\\n\t\t\tr_cons_printf (\"%s%s: \" Color_RESET, color, k);\\\n\t\telse\\\n\t\t\tr_cons_printf (\"%s: \", k);\\\n\t\tif (fmt) r_cons_printf (fmt, arg);\\\n\t}\n\t\t\tprintline (\"address\", \"0x%\" PFMT64x \"\\n\", core->offset + idx);\n\t\t\tprintline (\"opcode\", \"%s\\n\", r_asm_op_get_asm (&asmop));\n\t\t\tprintline (\"mnemonic\", \"%s\\n\", mnem);\n\t\t\tif (hint) {\n\t\t\t\tif (hint->opcode) {\n\t\t\t\t\tprintline (\"ophint\", \"%s\\n\", hint->opcode);\n\t\t\t\t}\n#if 0\n\t\t\t\t// addr should not override core->offset + idx.. its silly\n\t\t\t\tif (hint->addr != UT64_MAX) {\n\t\t\t\t\tprintline (\"addr\", \"0x%08\" PFMT64x \"\\n\", (hint->addr + idx));\n\t\t\t\t}\n#endif\n\t\t\t}\n\t\t\tprintline (\"prefix\", \"%\" PFMT64u \"\\n\", op.prefix);\n\t\t\tprintline (\"id\", \"%d\\n\", op.id);\n#if 0\n// no opex here to avoid lot of tests broken..and having json in here is not much useful imho\n\t\t\tif (opexstr && *opexstr) {\n\t\t\t\tprintline (\"opex\", \"%s\\n\", opexstr);\n\t\t\t}\n#endif\n\t\t\tprintline (\"bytes\", NULL, 0);\n\t\t\tfor (j = 0; j < size; j++) {\n\t\t\t\tr_cons_printf (\"%02x\", buf[j + idx]);\n\t\t\t}\n\t\t\tr_cons_newline ();\n\t\t\tif (op.val != UT64_MAX)\n\t\t\t\tprintline (\"val\", \"0x%08\" PFMT64x \"\\n\", op.val);\n\t\t\tif (op.ptr != UT64_MAX)\n\t\t\t\tprintline (\"ptr\", \"0x%08\" PFMT64x \"\\n\", op.ptr);\n\t\t\tif (op.refptr != -1)\n\t\t\t\tprintline (\"refptr\", \"%d\\n\", op.refptr);\n\t\t\tprintline (\"size\", \"%d\\n\", size);\n\t\t\tprintline (\"sign\", \"%s\\n\", r_str_bool (op.sign));\n\t\t\tprintline (\"type\", \"%s\\n\", r_anal_optype_to_string (op.type));\n\t\t\tprintline (\"cycles\", \"%d\\n\", op.cycles);\n\t\t\tif (op.failcycles) {\n\t\t\t\tprintline (\"failcycles\", \"%d\\n\", op.failcycles);\n\t\t\t}\n\t\t\t{\n\t\t\t\tconst char *t2 = r_anal_optype_to_string (op.type2);\n\t\t\t\tif (t2 && strcmp (t2, \"null\")) {\n\t\t\t\t\tprintline (\"type2\", \"%s\\n\", t2);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op.reg) {\n\t\t\t\tprintline (\"reg\", \"%s\\n\", op.reg);\n\t\t\t}\n\t\t\tif (op.ireg) {\n\t\t\t\tprintline (\"ireg\", \"%s\\n\", op.ireg);\n\t\t\t}\n\t\t\tif (op.scale) {\n\t\t\t\tprintline (\"scale\", \"%d\\n\", op.scale);\n\t\t\t}\n\t\t\tif (hint && hint->esil) {\n\t\t\t\tprintline (\"esil\", \"%s\\n\", hint->esil);\n\t\t\t} else if (*esilstr) {\n\t\t\t\tprintline (\"esil\", \"%s\\n\", esilstr);\n\t\t\t}\n\t\t\tif (hint && hint->jump != UT64_MAX) {\n\t\t\t\top.jump = hint->jump;\n\t\t\t}\n\t\t\tif (op.jump != UT64_MAX) {\n\t\t\t\tprintline (\"jump\", \"0x%08\" PFMT64x \"\\n\", op.jump);\n\t\t\t}\n\t\t\tif (op.direction != 0) {\n\t\t\t\tconst char * dir = op.direction == 1 ? \"read\"\n\t\t\t\t\t: op.direction == 2 ? \"write\"\n\t\t\t\t\t: op.direction == 4 ? \"exec\"\n\t\t\t\t\t: op.direction == 8 ? \"ref\": \"none\";\n\t\t\t\tprintline (\"direction\", \"%s\\n\", dir);\n\t\t\t}\n\t\t\tif (hint && hint->fail != UT64_MAX) {\n\t\t\t\top.fail = hint->fail;\n\t\t\t}\n\t\t\tif (op.fail != UT64_MAX) {\n\t\t\t\tprintline (\"fail\", \"0x%08\" PFMT64x \"\\n\", op.fail);\n\t\t\t}\n\t\t\tif (op.delay) {\n\t\t\t\tprintline (\"delay\", \"%d\\n\", op.delay);\n\t\t\t}\n\t\t\tprintline (\"stack\", \"%s\\n\", r_anal_stackop_tostring (op.stackop));\n\t\t\t{\n\t\t\t\tconst char *arg = (op.type & R_ANAL_OP_TYPE_COND)? r_anal_cond_tostring (op.cond): NULL;\n\t\t\t\tif (arg) {\n\t\t\t\t\tprintline (\"cond\", \"%s\\n\", arg);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintline (\"family\", \"%s\\n\", r_anal_op_family_to_string (op.family));\n\t\t\tprintline (\"stackop\", \"%s\\n\", r_anal_stackop_tostring (op.stackop));\n\t\t\tif (op.stackptr) {\n\t\t\t\tprintline (\"stackptr\", \"%\"PFMT64u\"\\n\", op.stackptr);\n\t\t\t}\n\t\t}\n\t\t//r_cons_printf (\"false: 0x%08\"PFMT64x\"\\n\", core->offset+idx);\n\t\t//free (hint);\n\t\tfree (mnem);\n\t\tr_anal_hint_free (hint);\n\t\tr_anal_op_fini (&op);\n\t}\n\tr_anal_op_fini (&op);\n\tif (fmt == 'j') {\n\t\tr_cons_printf (\"]\");\n\t\tr_cons_newline ();\n\t} else if (fmt == 's') {\n\t\tr_cons_printf (\"%d\\n\", totalsize);\n\t}\n\tr_anal_esil_free (esil);\n}","target":"static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int fmt) {\n\tint stacksize = r_config_get_i (core->config, \"esil.stack.depth\");\n\tbool iotrap = r_config_get_i (core->config, \"esil.iotrap\");\n\tbool romem = r_config_get_i (core->config, \"esil.romem\");\n\tbool stats = r_config_get_i (core->config, \"esil.stats\");\n\tbool be = core->print->big_endian;\n\tbool use_color = core->print->flags & R_PRINT_FLAGS_COLOR;\n\tcore->parser->relsub = r_config_get_i (core->config, \"asm.relsub\");\n\tint ret, i, j, idx, size;\n\tconst char *color = \"\";\n\tconst char *esilstr;\n\tconst char *opexstr;\n\tRAnalHint *hint;\n\tRAnalEsil *esil = NULL;\n\tRAsmOp asmop;\n\tRAnalOp op = {0};\n\tut64 addr;\n\tbool isFirst = true;\n\tunsigned int addrsize = r_config_get_i (core->config, \"esil.addr.size\");\n\tint totalsize = 0;\n\n\t// Variables required for setting up ESIL to REIL conversion\n\tif (use_color) {\n\t\tcolor = core->cons->pal.label;\n\t}\n\tswitch (fmt) {\n\tcase 'j':\n\t\tr_cons_printf (\"[\");\n\t\tbreak;\n\tcase 'r':\n\t\t// Setup for ESIL to REIL conversion\n\t\tesil = r_anal_esil_new (stacksize, iotrap, addrsize);\n\t\tif (!esil) {\n\t\t\treturn;\n\t\t}\n\t\tr_anal_esil_to_reil_setup (esil, core->anal, romem, stats);\n\t\tr_anal_esil_set_pc (esil, core->offset);\n\t\tbreak;\n\t}\n\tfor (i = idx = ret = 0; idx < len && (!nops || (nops && i < nops)); i++, idx += ret) {\n\t\taddr = core->offset + idx;\n\t\t// TODO: use more anal hints\n\t\thint = r_anal_hint_get (core->anal, addr);\n\t\tr_asm_set_pc (core->assembler, addr);\n\t\t(void)r_asm_disassemble (core->assembler, &asmop, buf + idx, len - idx);\n\t\tret = r_anal_op (core->anal, &op, core->offset + idx, buf + idx, len - idx, R_ANAL_OP_MASK_ESIL);\n\t\tesilstr = R_STRBUF_SAFEGET (&op.esil);\n\t\topexstr = R_STRBUF_SAFEGET (&op.opex);\n\t\tchar *mnem = strdup (r_asm_op_get_asm (&asmop));\n\t\tchar *sp = strchr (mnem, ' ');\n\t\tif (sp) {\n\t\t\t*sp = 0;\n\t\t\tif (op.prefix) {\n\t\t\t\tchar *arg = strdup (sp + 1);\n\t\t\t\tchar *sp = strchr (arg, ' ');\n\t\t\t\tif (sp) {\n\t\t\t\t\t*sp = 0;\n\t\t\t\t}\n\t\t\t\tfree (mnem);\n\t\t\t\tmnem = arg;\n\t\t\t}\n\t\t}\n\t\tif (ret < 1 && fmt != 'd') {\n\t\t\teprintf (\"Oops at 0x%08\" PFMT64x \" (\", core->offset + idx);\n\t\t\tfor (i = idx, j = 0; i < core->blocksize && j < 3; ++i, ++j) {\n\t\t\t\teprintf (\"%02x \", buf[i]);\n\t\t\t}\n\t\t\teprintf (\"...)\\n\");\n\t\t\tfree (mnem);\n\t\t\tbreak;\n\t\t}\n\t\tsize = (hint && hint->size)? hint->size: op.size;\n\t\tif (fmt == 'd') {\n\t\t\tchar *opname = strdup (r_asm_op_get_asm (&asmop));\n\t\t\tif (opname) {\n\t\t\t\tr_str_split (opname, ' ');\n\t\t\t\tchar *d = r_asm_describe (core->assembler, opname);\n\t\t\t\tif (d && *d) {\n\t\t\t\t\tr_cons_printf (\"%s: %s\\n\", opname, d);\n\t\t\t\t\tfree (d);\n\t\t\t\t} else {\n\t\t\t\t\teprintf (\"Unknown opcode\\n\");\n\t\t\t\t}\n\t\t\t\tfree (opname);\n\t\t\t}\n\t\t} else if (fmt == 'e') {\n\t\t\tif (*esilstr) {\n\t\t\t\tif (use_color) {\n\t\t\t\t\tr_cons_printf (\"%s0x%\" PFMT64x Color_RESET \" %s\\n\", color, core->offset + idx, esilstr);\n\t\t\t\t} else {\n\t\t\t\t\tr_cons_printf (\"0x%\" PFMT64x \" %s\\n\", core->offset + idx, esilstr);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (fmt == 's') {\n\t\t\ttotalsize += op.size;\n\t\t} else if (fmt == 'r') {\n\t\t\tif (*esilstr) {\n\t\t\t\tif (use_color) {\n\t\t\t\t\tr_cons_printf (\"%s0x%\" PFMT64x Color_RESET \"\\n\", color, core->offset + idx);\n\t\t\t\t} else {\n\t\t\t\t\tr_cons_printf (\"0x%\" PFMT64x \"\\n\", core->offset + idx);\n\t\t\t\t}\n\t\t\t\tr_anal_esil_parse (esil, esilstr);\n\t\t\t\tr_anal_esil_dumpstack (esil);\n\t\t\t\tr_anal_esil_stack_free (esil);\n\t\t\t}\n\t\t} else if (fmt == 'j') {\n\t\t\tif (isFirst) {\n\t\t\t\tisFirst = false;\n\t\t\t} else {\n\t\t\t\tr_cons_print (\",\");\n\t\t\t}\n\t\t\tr_cons_printf (\"{\\\"opcode\\\":\\\"%s\\\",\", r_asm_op_get_asm (&asmop));\n\t\t\t{\n\t\t\t\tchar strsub[128] = { 0 };\n\t\t\t\t// pc+33\n\t\t\t\tr_parse_varsub (core->parser, NULL,\n\t\t\t\t\tcore->offset + idx,\n\t\t\t\t\tasmop.size, r_asm_op_get_asm (&asmop),\n\t\t\t\t\tstrsub, sizeof (strsub));\n\t\t\t\t{\n\t\t\t\t\tut64 killme = UT64_MAX;\n\t\t\t\t\tif (r_io_read_i (core->io, op.ptr, &killme, op.refptr, be)) {\n\t\t\t\t\t\tcore->parser->relsub_addr = killme;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 0x33->sym.xx\n\t\t\t\tchar *p = strdup (strsub);\n\t\t\t\tif (p) {\n\t\t\t\t\tr_parse_filter (core->parser, addr, core->flags, p,\n\t\t\t\t\t\t\tstrsub, sizeof (strsub), be);\n\t\t\t\t\tfree (p);\n\t\t\t\t}\n\t\t\t\tr_cons_printf (\"\\\"disasm\\\":\\\"%s\\\",\", strsub);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"mnemonic\\\":\\\"%s\\\",\", mnem);\n\t\t\tif (hint && hint->opcode) {\n\t\t\t\tr_cons_printf (\"\\\"ophint\\\":\\\"%s\\\",\", hint->opcode);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"sign\\\":%s,\", r_str_bool (op.sign));\n\t\t\tr_cons_printf (\"\\\"prefix\\\":%\" PFMT64u \",\", op.prefix);\n\t\t\tr_cons_printf (\"\\\"id\\\":%d,\", op.id);\n\t\t\tif (opexstr && *opexstr) {\n\t\t\t\tr_cons_printf (\"\\\"opex\\\":%s,\", opexstr);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"addr\\\":%\" PFMT64u \",\", core->offset + idx);\n\t\t\tr_cons_printf (\"\\\"bytes\\\":\\\"\");\n\t\t\tfor (j = 0; j < size; j++) {\n\t\t\t\tr_cons_printf (\"%02x\", buf[j + idx]);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\",\");\n\t\t\tif (op.val != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"val\\\": %\" PFMT64u \",\", op.val);\n\t\t\t}\n\t\t\tif (op.ptr != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"ptr\\\": %\" PFMT64u \",\", op.ptr);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"size\\\": %d,\", size);\n\t\t\tr_cons_printf (\"\\\"type\\\": \\\"%s\\\",\",\n\t\t\t\tr_anal_optype_to_string (op.type));\n\t\t\tif (op.reg) {\n\t\t\t\tr_cons_printf (\"\\\"reg\\\": \\\"%s\\\",\", op.reg);\n\t\t\t}\n\t\t\tif (op.ireg) {\n\t\t\t\tr_cons_printf (\"\\\"ireg\\\": \\\"%s\\\",\", op.ireg);\n\t\t\t}\n\t\t\tif (op.scale) {\n\t\t\t\tr_cons_printf (\"\\\"scale\\\":%d,\", op.scale);\n\t\t\t}\n\t\t\tif (hint && hint->esil) {\n\t\t\t\tr_cons_printf (\"\\\"esil\\\": \\\"%s\\\",\", hint->esil);\n\t\t\t} else if (*esilstr) {\n\t\t\t\tr_cons_printf (\"\\\"esil\\\": \\\"%s\\\",\", esilstr);\n\t\t\t}\n\t\t\tif (hint && hint->jump != UT64_MAX) {\n\t\t\t\top.jump = hint->jump;\n\t\t\t}\n\t\t\tif (op.jump != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"jump\\\":%\" PFMT64u \",\", op.jump);\n\t\t\t}\n\t\t\tif (hint && hint->fail != UT64_MAX) {\n\t\t\t\top.fail = hint->fail;\n\t\t\t}\n\t\t\tif (op.refptr != -1) {\n\t\t\t\tr_cons_printf (\"\\\"refptr\\\":%d,\", op.refptr);\n\t\t\t}\n\t\t\tif (op.fail != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"fail\\\":%\" PFMT64u \",\", op.fail);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"cycles\\\":%d,\", op.cycles);\n\t\t\tif (op.failcycles) {\n\t\t\t\tr_cons_printf (\"\\\"failcycles\\\":%d,\", op.failcycles);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"delay\\\":%d,\", op.delay);\n\t\t\t{\n\t\t\t\tconst char *p = r_anal_stackop_tostring (op.stackop);\n\t\t\t\tif (p && *p && strcmp (p, \"null\"))\n\t\t\t\t\tr_cons_printf (\"\\\"stack\\\":\\\"%s\\\",\", p);\n\t\t\t}\n\t\t\tif (op.stackptr) {\n\t\t\t\tr_cons_printf (\"\\\"stackptr\\\":%d,\", op.stackptr);\n\t\t\t}\n\t\t\t{\n\t\t\t\tconst char *arg = (op.type & R_ANAL_OP_TYPE_COND)\n\t\t\t\t\t? r_anal_cond_tostring (op.cond): NULL;\n\t\t\t\tif (arg) {\n\t\t\t\t\tr_cons_printf (\"\\\"cond\\\":\\\"%s\\\",\", arg);\n\t\t\t\t}\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"family\\\":\\\"%s\\\"}\", r_anal_op_family_to_string (op.family));\n\t\t} else {\n#define printline(k, fmt, arg)\\\n\t{ \\\n\t\tif (use_color)\\\n\t\t\tr_cons_printf (\"%s%s: \" Color_RESET, color, k);\\\n\t\telse\\\n\t\t\tr_cons_printf (\"%s: \", k);\\\n\t\tif (fmt) r_cons_printf (fmt, arg);\\\n\t}\n\t\t\tprintline (\"address\", \"0x%\" PFMT64x \"\\n\", core->offset + idx);\n\t\t\tprintline (\"opcode\", \"%s\\n\", r_asm_op_get_asm (&asmop));\n\t\t\tprintline (\"mnemonic\", \"%s\\n\", mnem);\n\t\t\tif (hint) {\n\t\t\t\tif (hint->opcode) {\n\t\t\t\t\tprintline (\"ophint\", \"%s\\n\", hint->opcode);\n\t\t\t\t}\n#if 0\n\t\t\t\t// addr should not override core->offset + idx.. its silly\n\t\t\t\tif (hint->addr != UT64_MAX) {\n\t\t\t\t\tprintline (\"addr\", \"0x%08\" PFMT64x \"\\n\", (hint->addr + idx));\n\t\t\t\t}\n#endif\n\t\t\t}\n\t\t\tprintline (\"prefix\", \"%\" PFMT64u \"\\n\", op.prefix);\n\t\t\tprintline (\"id\", \"%d\\n\", op.id);\n#if 0\n// no opex here to avoid lot of tests broken..and having json in here is not much useful imho\n\t\t\tif (opexstr && *opexstr) {\n\t\t\t\tprintline (\"opex\", \"%s\\n\", opexstr);\n\t\t\t}\n#endif\n\t\t\tprintline (\"bytes\", NULL, 0);\n\t\t\tint minsz = R_MIN (len, size);\n\t\t\tminsz = R_MAX (minsz, 0);\n\t\t\tfor (j = 0; j < minsz; j++) {\n\t\t\t\tut8 ch = ((j + idx - 1) > minsz)? 0xff: buf[j + idx];\n\t\t\t\tr_cons_printf (\"%02x\", ch);\n\t\t\t}\n\t\t\tr_cons_newline ();\n\t\t\tif (op.val != UT64_MAX) {\n\t\t\t\tprintline (\"val\", \"0x%08\" PFMT64x \"\\n\", op.val);\n\t\t\t}\n\t\t\tif (op.ptr != UT64_MAX) {\n\t\t\t\tprintline (\"ptr\", \"0x%08\" PFMT64x \"\\n\", op.ptr);\n\t\t\t}\n\t\t\tif (op.refptr != -1) {\n\t\t\t\tprintline (\"refptr\", \"%d\\n\", op.refptr);\n\t\t\t}\n\t\t\tprintline (\"size\", \"%d\\n\", size);\n\t\t\tprintline (\"sign\", \"%s\\n\", r_str_bool (op.sign));\n\t\t\tprintline (\"type\", \"%s\\n\", r_anal_optype_to_string (op.type));\n\t\t\tprintline (\"cycles\", \"%d\\n\", op.cycles);\n\t\t\tif (op.failcycles) {\n\t\t\t\tprintline (\"failcycles\", \"%d\\n\", op.failcycles);\n\t\t\t}\n\t\t\t{\n\t\t\t\tconst char *t2 = r_anal_optype_to_string (op.type2);\n\t\t\t\tif (t2 && strcmp (t2, \"null\")) {\n\t\t\t\t\tprintline (\"type2\", \"%s\\n\", t2);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op.reg) {\n\t\t\t\tprintline (\"reg\", \"%s\\n\", op.reg);\n\t\t\t}\n\t\t\tif (op.ireg) {\n\t\t\t\tprintline (\"ireg\", \"%s\\n\", op.ireg);\n\t\t\t}\n\t\t\tif (op.scale) {\n\t\t\t\tprintline (\"scale\", \"%d\\n\", op.scale);\n\t\t\t}\n\t\t\tif (hint && hint->esil) {\n\t\t\t\tprintline (\"esil\", \"%s\\n\", hint->esil);\n\t\t\t} else if (*esilstr) {\n\t\t\t\tprintline (\"esil\", \"%s\\n\", esilstr);\n\t\t\t}\n\t\t\tif (hint && hint->jump != UT64_MAX) {\n\t\t\t\top.jump = hint->jump;\n\t\t\t}\n\t\t\tif (op.jump != UT64_MAX) {\n\t\t\t\tprintline (\"jump\", \"0x%08\" PFMT64x \"\\n\", op.jump);\n\t\t\t}\n\t\t\tif (op.direction != 0) {\n\t\t\t\tconst char * dir = op.direction == 1 ? \"read\"\n\t\t\t\t\t: op.direction == 2 ? \"write\"\n\t\t\t\t\t: op.direction == 4 ? \"exec\"\n\t\t\t\t\t: op.direction == 8 ? \"ref\": \"none\";\n\t\t\t\tprintline (\"direction\", \"%s\\n\", dir);\n\t\t\t}\n\t\t\tif (hint && hint->fail != UT64_MAX) {\n\t\t\t\top.fail = hint->fail;\n\t\t\t}\n\t\t\tif (op.fail != UT64_MAX) {\n\t\t\t\tprintline (\"fail\", \"0x%08\" PFMT64x \"\\n\", op.fail);\n\t\t\t}\n\t\t\tif (op.delay) {\n\t\t\t\tprintline (\"delay\", \"%d\\n\", op.delay);\n\t\t\t}\n\t\t\tprintline (\"stack\", \"%s\\n\", r_anal_stackop_tostring (op.stackop));\n\t\t\t{\n\t\t\t\tconst char *arg = (op.type & R_ANAL_OP_TYPE_COND)? r_anal_cond_tostring (op.cond): NULL;\n\t\t\t\tif (arg) {\n\t\t\t\t\tprintline (\"cond\", \"%s\\n\", arg);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintline (\"family\", \"%s\\n\", r_anal_op_family_to_string (op.family));\n\t\t\tprintline (\"stackop\", \"%s\\n\", r_anal_stackop_tostring (op.stackop));\n\t\t\tif (op.stackptr) {\n\t\t\t\tprintline (\"stackptr\", \"%\"PFMT64u\"\\n\", op.stackptr);\n\t\t\t}\n\t\t}\n\t\t//r_cons_printf (\"false: 0x%08\"PFMT64x\"\\n\", core->offset+idx);\n\t\t//free (hint);\n\t\tfree (mnem);\n\t\tr_anal_hint_free (hint);\n\t\tr_anal_op_fini (&op);\n\t}\n\tr_anal_op_fini (&op);\n\tif (fmt == 'j') {\n\t\tr_cons_printf (\"]\");\n\t\tr_cons_newline ();\n\t} else if (fmt == 's') {\n\t\tr_cons_printf (\"%d\\n\", totalsize);\n\t}\n\tr_anal_esil_free (esil);\n}","lang":"c","vul_type":"cwe-125","target_token_count":3557,"sven_meta":{"func_name":"core_anal_bytes","file_name":"libr/core/cmd_anal.c","commit_link":"github.com/radare/radare2/commit/a1bc65c3db593530775823d6d7506a457ed95267","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#84-6834109949cf","input":"static int ext4_fill_super(struct super_block *sb, void *data, int silent)\n{\n\tchar *orig_data = kstrdup(data, GFP_KERNEL);\n\tstruct buffer_head *bh;\n\tstruct ext4_super_block *es = NULL;\n\tstruct ext4_sb_info *sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);\n\text4_fsblk_t block;\n\text4_fsblk_t sb_block = get_sb_block(&data);\n\text4_fsblk_t logical_sb_block;\n\tunsigned long offset = 0;\n\tunsigned long journal_devnum = 0;\n\tunsigned long def_mount_opts;\n\tstruct inode *root;\n\tconst char *descr;\n\tint ret = -ENOMEM;\n\tint blocksize, clustersize;\n\tunsigned int db_count;\n\tunsigned int i;\n\tint needs_recovery, has_huge_files, has_bigalloc;\n\t__u64 blocks_count;\n\tint err = 0;\n\tunsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;\n\text4_group_t first_not_zeroed;\n\n\tif ((data && !orig_data) || !sbi)\n\t\tgoto out_free_base;\n\n\tsbi->s_blockgroup_lock =\n\t\tkzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);\n\tif (!sbi->s_blockgroup_lock)\n\t\tgoto out_free_base;\n\n\tsb->s_fs_info = sbi;\n\tsbi->s_sb = sb;\n\tsbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS;\n\tsbi->s_sb_block = sb_block;\n\tif (sb->s_bdev->bd_part)\n\t\tsbi->s_sectors_written_start =\n\t\t\tpart_stat_read(sb->s_bdev->bd_part, sectors[1]);\n\n\t/* Cleanup superblock name */\n\tstrreplace(sb->s_id, '/', '!');\n\n\t/* -EINVAL is default */\n\tret = -EINVAL;\n\tblocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE);\n\tif (!blocksize) {\n\t\text4_msg(sb, KERN_ERR, \"unable to set blocksize\");\n\t\tgoto out_fail;\n\t}\n\n\t/*\n\t * The ext4 superblock will not be buffer aligned for other than 1kB\n\t * block sizes. We need to calculate the offset from buffer start.\n\t */\n\tif (blocksize != EXT4_MIN_BLOCK_SIZE) {\n\t\tlogical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;\n\t\toffset = do_div(logical_sb_block, blocksize);\n\t} else {\n\t\tlogical_sb_block = sb_block;\n\t}\n\n\tif (!(bh = sb_bread_unmovable(sb, logical_sb_block))) {\n\t\text4_msg(sb, KERN_ERR, \"unable to read superblock\");\n\t\tgoto out_fail;\n\t}\n\t/*\n\t * Note: s_es must be initialized as soon as possible because\n\t * some ext4 macro-instructions depend on its value\n\t */\n\tes = (struct ext4_super_block *) (bh->b_data + offset);\n\tsbi->s_es = es;\n\tsb->s_magic = le16_to_cpu(es->s_magic);\n\tif (sb->s_magic != EXT4_SUPER_MAGIC)\n\t\tgoto cantfind_ext4;\n\tsbi->s_kbytes_written = le64_to_cpu(es->s_kbytes_written);\n\n\t/* Warn if metadata_csum and gdt_csum are both set. */\n\tif (ext4_has_feature_metadata_csum(sb) &&\n\t ext4_has_feature_gdt_csum(sb))\n\t\text4_warning(sb, \"metadata_csum and uninit_bg are \"\n\t\t\t \"redundant flags; please run fsck.\");\n\n\t/* Check for a known checksum algorithm */\n\tif (!ext4_verify_csum_type(sb, es)) {\n\t\text4_msg(sb, KERN_ERR, \"VFS: Found ext4 filesystem with \"\n\t\t\t \"unknown checksum algorithm.\");\n\t\tsilent = 1;\n\t\tgoto cantfind_ext4;\n\t}\n\n\t/* Load the checksum driver */\n\tif (ext4_has_feature_metadata_csum(sb)) {\n\t\tsbi->s_chksum_driver = crypto_alloc_shash(\"crc32c\", 0, 0);\n\t\tif (IS_ERR(sbi->s_chksum_driver)) {\n\t\t\text4_msg(sb, KERN_ERR, \"Cannot load crc32c driver.\");\n\t\t\tret = PTR_ERR(sbi->s_chksum_driver);\n\t\t\tsbi->s_chksum_driver = NULL;\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\t/* Check superblock checksum */\n\tif (!ext4_superblock_csum_verify(sb, es)) {\n\t\text4_msg(sb, KERN_ERR, \"VFS: Found ext4 filesystem with \"\n\t\t\t \"invalid superblock checksum. Run e2fsck?\");\n\t\tsilent = 1;\n\t\tret = -EFSBADCRC;\n\t\tgoto cantfind_ext4;\n\t}\n\n\t/* Precompute checksum seed for all metadata */\n\tif (ext4_has_feature_csum_seed(sb))\n\t\tsbi->s_csum_seed = le32_to_cpu(es->s_checksum_seed);\n\telse if (ext4_has_metadata_csum(sb))\n\t\tsbi->s_csum_seed = ext4_chksum(sbi, ~0, es->s_uuid,\n\t\t\t\t\t sizeof(es->s_uuid));\n\n\t/* Set defaults before we parse the mount options */\n\tdef_mount_opts = le32_to_cpu(es->s_default_mount_opts);\n\tset_opt(sb, INIT_INODE_TABLE);\n\tif (def_mount_opts & EXT4_DEFM_DEBUG)\n\t\tset_opt(sb, DEBUG);\n\tif (def_mount_opts & EXT4_DEFM_BSDGROUPS)\n\t\tset_opt(sb, GRPID);\n\tif (def_mount_opts & EXT4_DEFM_UID16)\n\t\tset_opt(sb, NO_UID32);\n\t/* xattr user namespace & acls are now defaulted on */\n\tset_opt(sb, XATTR_USER);\n#ifdef CONFIG_EXT4_FS_POSIX_ACL\n\tset_opt(sb, POSIX_ACL);\n#endif\n\t/* don't forget to enable journal_csum when metadata_csum is enabled. */\n\tif (ext4_has_metadata_csum(sb))\n\t\tset_opt(sb, JOURNAL_CHECKSUM);\n\n\tif ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)\n\t\tset_opt(sb, JOURNAL_DATA);\n\telse if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)\n\t\tset_opt(sb, ORDERED_DATA);\n\telse if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_WBACK)\n\t\tset_opt(sb, WRITEBACK_DATA);\n\n\tif (le16_to_cpu(sbi->s_es->s_errors) == EXT4_ERRORS_PANIC)\n\t\tset_opt(sb, ERRORS_PANIC);\n\telse if (le16_to_cpu(sbi->s_es->s_errors) == EXT4_ERRORS_CONTINUE)\n\t\tset_opt(sb, ERRORS_CONT);\n\telse\n\t\tset_opt(sb, ERRORS_RO);\n\t/* block_validity enabled by default; disable with noblock_validity */\n\tset_opt(sb, BLOCK_VALIDITY);\n\tif (def_mount_opts & EXT4_DEFM_DISCARD)\n\t\tset_opt(sb, DISCARD);\n\n\tsbi->s_resuid = make_kuid(&init_user_ns, le16_to_cpu(es->s_def_resuid));\n\tsbi->s_resgid = make_kgid(&init_user_ns, le16_to_cpu(es->s_def_resgid));\n\tsbi->s_commit_interval = JBD2_DEFAULT_MAX_COMMIT_AGE * HZ;\n\tsbi->s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME;\n\tsbi->s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME;\n\n\tif ((def_mount_opts & EXT4_DEFM_NOBARRIER) == 0)\n\t\tset_opt(sb, BARRIER);\n\n\t/*\n\t * enable delayed allocation by default\n\t * Use -o nodelalloc to turn it off\n\t */\n\tif (!IS_EXT3_SB(sb) && !IS_EXT2_SB(sb) &&\n\t ((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0))\n\t\tset_opt(sb, DELALLOC);\n\n\t/*\n\t * set default s_li_wait_mult for lazyinit, for the case there is\n\t * no mount option specified.\n\t */\n\tsbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT;\n\n\tif (sbi->s_es->s_mount_opts[0]) {\n\t\tchar *s_mount_opts = kstrndup(sbi->s_es->s_mount_opts,\n\t\t\t\t\t sizeof(sbi->s_es->s_mount_opts),\n\t\t\t\t\t GFP_KERNEL);\n\t\tif (!s_mount_opts)\n\t\t\tgoto failed_mount;\n\t\tif (!parse_options(s_mount_opts, sb, &journal_devnum,\n\t\t\t\t &journal_ioprio, 0)) {\n\t\t\text4_msg(sb, KERN_WARNING,\n\t\t\t\t \"failed to parse options in superblock: %s\",\n\t\t\t\t s_mount_opts);\n\t\t}\n\t\tkfree(s_mount_opts);\n\t}\n\tsbi->s_def_mount_opt = sbi->s_mount_opt;\n\tif (!parse_options((char *) data, sb, &journal_devnum,\n\t\t\t &journal_ioprio, 0))\n\t\tgoto failed_mount;\n\n\tif (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {\n\t\tprintk_once(KERN_WARNING \"EXT4-fs: Warning: mounting \"\n\t\t\t \"with data=journal disables delayed \"\n\t\t\t \"allocation and O_DIRECT support!\\n\");\n\t\tif (test_opt2(sb, EXPLICIT_DELALLOC)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and delalloc\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DIOREAD_NOLOCK)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and dioread_nolock\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DAX)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and dax\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DELALLOC))\n\t\t\tclear_opt(sb, DELALLOC);\n\t} else {\n\t\tsb->s_iflags |= SB_I_CGROUPWB;\n\t}\n\n\tsb->s_flags = (sb->s_flags & ~MS_POSIXACL) |\n\t\t(test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);\n\n\tif (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV &&\n\t (ext4_has_compat_features(sb) ||\n\t ext4_has_ro_compat_features(sb) ||\n\t ext4_has_incompat_features(sb)))\n\t\text4_msg(sb, KERN_WARNING,\n\t\t \"feature flags set on rev 0 fs, \"\n\t\t \"running e2fsck is recommended\");\n\n\tif (es->s_creator_os == cpu_to_le32(EXT4_OS_HURD)) {\n\t\tset_opt2(sb, HURD_COMPAT);\n\t\tif (ext4_has_feature_64bit(sb)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"The Hurd can't support 64-bit file systems\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\tif (IS_EXT2_SB(sb)) {\n\t\tif (ext2_feature_set_ok(sb))\n\t\t\text4_msg(sb, KERN_INFO, \"mounting ext2 file system \"\n\t\t\t\t \"using the ext4 subsystem\");\n\t\telse {\n\t\t\text4_msg(sb, KERN_ERR, \"couldn't mount as ext2 due \"\n\t\t\t\t \"to feature incompatibilities\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\tif (IS_EXT3_SB(sb)) {\n\t\tif (ext3_feature_set_ok(sb))\n\t\t\text4_msg(sb, KERN_INFO, \"mounting ext3 file system \"\n\t\t\t\t \"using the ext4 subsystem\");\n\t\telse {\n\t\t\text4_msg(sb, KERN_ERR, \"couldn't mount as ext3 due \"\n\t\t\t\t \"to feature incompatibilities\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\t/*\n\t * Check feature flags regardless of the revision level, since we\n\t * previously didn't change the revision level when setting the flags,\n\t * so there is a chance incompat flags are set on a rev 0 filesystem.\n\t */\n\tif (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY)))\n\t\tgoto failed_mount;\n\n\tblocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);\n\tif (blocksize < EXT4_MIN_BLOCK_SIZE ||\n\t blocksize > EXT4_MAX_BLOCK_SIZE) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t \"Unsupported filesystem blocksize %d (%d log_block_size)\",\n\t\t\t blocksize, le32_to_cpu(es->s_log_block_size));\n\t\tgoto failed_mount;\n\t}\n\tif (le32_to_cpu(es->s_log_block_size) >\n\t (EXT4_MAX_BLOCK_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Invalid log block size: %u\",\n\t\t\t le32_to_cpu(es->s_log_block_size));\n\t\tgoto failed_mount;\n\t}\n\n\tif (le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) > (blocksize / 4)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Number of reserved GDT blocks insanely large: %d\",\n\t\t\t le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks));\n\t\tgoto failed_mount;\n\t}\n\n\tif (sbi->s_mount_opt & EXT4_MOUNT_DAX) {\n\t\terr = bdev_dax_supported(sb, blocksize);\n\t\tif (err)\n\t\t\tgoto failed_mount;\n\t}\n\n\tif (ext4_has_feature_encrypt(sb) && es->s_encryption_level) {\n\t\text4_msg(sb, KERN_ERR, \"Unsupported encryption level %d\",\n\t\t\t es->s_encryption_level);\n\t\tgoto failed_mount;\n\t}\n\n\tif (sb->s_blocksize != blocksize) {\n\t\t/* Validate the filesystem blocksize */\n\t\tif (!sb_set_blocksize(sb, blocksize)) {\n\t\t\text4_msg(sb, KERN_ERR, \"bad block size %d\",\n\t\t\t\t\tblocksize);\n\t\t\tgoto failed_mount;\n\t\t}\n\n\t\tbrelse(bh);\n\t\tlogical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;\n\t\toffset = do_div(logical_sb_block, blocksize);\n\t\tbh = sb_bread_unmovable(sb, logical_sb_block);\n\t\tif (!bh) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Can't read superblock on 2nd try\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tes = (struct ext4_super_block *)(bh->b_data + offset);\n\t\tsbi->s_es = es;\n\t\tif (es->s_magic != cpu_to_le16(EXT4_SUPER_MAGIC)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Magic mismatch, very weird!\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\thas_huge_files = ext4_has_feature_huge_file(sb);\n\tsbi->s_bitmap_maxbytes = ext4_max_bitmap_size(sb->s_blocksize_bits,\n\t\t\t\t\t\t has_huge_files);\n\tsb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits, has_huge_files);\n\n\tif (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV) {\n\t\tsbi->s_inode_size = EXT4_GOOD_OLD_INODE_SIZE;\n\t\tsbi->s_first_ino = EXT4_GOOD_OLD_FIRST_INO;\n\t} else {\n\t\tsbi->s_inode_size = le16_to_cpu(es->s_inode_size);\n\t\tsbi->s_first_ino = le32_to_cpu(es->s_first_ino);\n\t\tif ((sbi->s_inode_size < EXT4_GOOD_OLD_INODE_SIZE) ||\n\t\t (!is_power_of_2(sbi->s_inode_size)) ||\n\t\t (sbi->s_inode_size > blocksize)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unsupported inode size: %d\",\n\t\t\t sbi->s_inode_size);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE)\n\t\t\tsb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2);\n\t}\n\n\tsbi->s_desc_size = le16_to_cpu(es->s_desc_size);\n\tif (ext4_has_feature_64bit(sb)) {\n\t\tif (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||\n\t\t sbi->s_desc_size > EXT4_MAX_DESC_SIZE ||\n\t\t !is_power_of_2(sbi->s_desc_size)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unsupported descriptor size %lu\",\n\t\t\t sbi->s_desc_size);\n\t\t\tgoto failed_mount;\n\t\t}\n\t} else\n\t\tsbi->s_desc_size = EXT4_MIN_DESC_SIZE;\n\n\tsbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);\n\tsbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);\n\n\tsbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb);\n\tif (sbi->s_inodes_per_block == 0)\n\t\tgoto cantfind_ext4;\n\tif (sbi->s_inodes_per_group < sbi->s_inodes_per_block ||\n\t sbi->s_inodes_per_group > blocksize * 8) {\n\t\text4_msg(sb, KERN_ERR, \"invalid inodes per group: %lu\\n\",\n\t\t\t sbi->s_blocks_per_group);\n\t\tgoto failed_mount;\n\t}\n\tsbi->s_itb_per_group = sbi->s_inodes_per_group /\n\t\t\t\t\tsbi->s_inodes_per_block;\n\tsbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);\n\tsbi->s_sbh = bh;\n\tsbi->s_mount_state = le16_to_cpu(es->s_state);\n\tsbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb));\n\tsbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb));\n\n\tfor (i = 0; i < 4; i++)\n\t\tsbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);\n\tsbi->s_def_hash_version = es->s_def_hash_version;\n\tif (ext4_has_feature_dir_index(sb)) {\n\t\ti = le32_to_cpu(es->s_flags);\n\t\tif (i & EXT2_FLAGS_UNSIGNED_HASH)\n\t\t\tsbi->s_hash_unsigned = 3;\n\t\telse if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) {\n#ifdef __CHAR_UNSIGNED__\n\t\t\tif (!(sb->s_flags & MS_RDONLY))\n\t\t\t\tes->s_flags |=\n\t\t\t\t\tcpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH);\n\t\t\tsbi->s_hash_unsigned = 3;\n#else\n\t\t\tif (!(sb->s_flags & MS_RDONLY))\n\t\t\t\tes->s_flags |=\n\t\t\t\t\tcpu_to_le32(EXT2_FLAGS_SIGNED_HASH);\n#endif\n\t\t}\n\t}\n\n\t/* Handle clustersize */\n\tclustersize = BLOCK_SIZE << le32_to_cpu(es->s_log_cluster_size);\n\thas_bigalloc = ext4_has_feature_bigalloc(sb);\n\tif (has_bigalloc) {\n\t\tif (clustersize < blocksize) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"cluster size (%d) smaller than \"\n\t\t\t\t \"block size (%d)\", clustersize, blocksize);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (le32_to_cpu(es->s_log_cluster_size) >\n\t\t (EXT4_MAX_CLUSTER_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"Invalid log cluster size: %u\",\n\t\t\t\t le32_to_cpu(es->s_log_cluster_size));\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tsbi->s_cluster_bits = le32_to_cpu(es->s_log_cluster_size) -\n\t\t\tle32_to_cpu(es->s_log_block_size);\n\t\tsbi->s_clusters_per_group =\n\t\t\tle32_to_cpu(es->s_clusters_per_group);\n\t\tif (sbi->s_clusters_per_group > blocksize * 8) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"#clusters per group too big: %lu\",\n\t\t\t\t sbi->s_clusters_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (sbi->s_blocks_per_group !=\n\t\t (sbi->s_clusters_per_group * (clustersize / blocksize))) {\n\t\t\text4_msg(sb, KERN_ERR, \"blocks per group (%lu) and \"\n\t\t\t\t \"clusters per group (%lu) inconsistent\",\n\t\t\t\t sbi->s_blocks_per_group,\n\t\t\t\t sbi->s_clusters_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t} else {\n\t\tif (clustersize != blocksize) {\n\t\t\text4_warning(sb, \"fragment/cluster size (%d) != \"\n\t\t\t\t \"block size (%d)\", clustersize,\n\t\t\t\t blocksize);\n\t\t\tclustersize = blocksize;\n\t\t}\n\t\tif (sbi->s_blocks_per_group > blocksize * 8) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"#blocks per group too big: %lu\",\n\t\t\t\t sbi->s_blocks_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tsbi->s_clusters_per_group = sbi->s_blocks_per_group;\n\t\tsbi->s_cluster_bits = 0;\n\t}\n\tsbi->s_cluster_ratio = clustersize / blocksize;\n\n\t/* Do we have standard group size of clustersize * 8 blocks ? */\n\tif (sbi->s_blocks_per_group == clustersize << 3)\n\t\tset_opt2(sb, STD_GROUP_SIZE);\n\n\t/*\n\t * Test whether we have more sectors than will fit in sector_t,\n\t * and whether the max offset is addressable by the page cache.\n\t */\n\terr = generic_check_addressable(sb->s_blocksize_bits,\n\t\t\t\t\text4_blocks_count(es));\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"filesystem\"\n\t\t\t \" too large to mount safely on this system\");\n\t\tif (sizeof(sector_t) < 8)\n\t\t\text4_msg(sb, KERN_WARNING, \"CONFIG_LBDAF not enabled\");\n\t\tgoto failed_mount;\n\t}\n\n\tif (EXT4_BLOCKS_PER_GROUP(sb) == 0)\n\t\tgoto cantfind_ext4;\n\n\t/* check blocks count against device size */\n\tblocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;\n\tif (blocks_count && ext4_blocks_count(es) > blocks_count) {\n\t\text4_msg(sb, KERN_WARNING, \"bad geometry: block count %llu \"\n\t\t \"exceeds size of device (%llu blocks)\",\n\t\t ext4_blocks_count(es), blocks_count);\n\t\tgoto failed_mount;\n\t}\n\n\t/*\n\t * It makes no sense for the first data block to be beyond the end\n\t * of the filesystem.\n\t */\n\tif (le32_to_cpu(es->s_first_data_block) >= ext4_blocks_count(es)) {\n\t\text4_msg(sb, KERN_WARNING, \"bad geometry: first data \"\n\t\t\t \"block %u is beyond end of filesystem (%llu)\",\n\t\t\t le32_to_cpu(es->s_first_data_block),\n\t\t\t ext4_blocks_count(es));\n\t\tgoto failed_mount;\n\t}\n\tblocks_count = (ext4_blocks_count(es) -\n\t\t\tle32_to_cpu(es->s_first_data_block) +\n\t\t\tEXT4_BLOCKS_PER_GROUP(sb) - 1);\n\tdo_div(blocks_count, EXT4_BLOCKS_PER_GROUP(sb));\n\tif (blocks_count > ((uint64_t)1<<32) - EXT4_DESC_PER_BLOCK(sb)) {\n\t\text4_msg(sb, KERN_WARNING, \"groups count too large: %u \"\n\t\t \"(block count %llu, first data block %u, \"\n\t\t \"blocks per group %lu)\", sbi->s_groups_count,\n\t\t ext4_blocks_count(es),\n\t\t le32_to_cpu(es->s_first_data_block),\n\t\t EXT4_BLOCKS_PER_GROUP(sb));\n\t\tgoto failed_mount;\n\t}\n\tsbi->s_groups_count = blocks_count;\n\tsbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count,\n\t\t\t(EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb)));\n\tdb_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /\n\t\t EXT4_DESC_PER_BLOCK(sb);\n\tsbi->s_group_desc = ext4_kvmalloc(db_count *\n\t\t\t\t\t sizeof(struct buffer_head *),\n\t\t\t\t\t GFP_KERNEL);\n\tif (sbi->s_group_desc == NULL) {\n\t\text4_msg(sb, KERN_ERR, \"not enough memory\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount;\n\t}\n\n\tbgl_lock_init(sbi->s_blockgroup_lock);\n\n\tfor (i = 0; i < db_count; i++) {\n\t\tblock = descriptor_loc(sb, logical_sb_block, i);\n\t\tsbi->s_group_desc[i] = sb_bread_unmovable(sb, block);\n\t\tif (!sbi->s_group_desc[i]) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"can't read group descriptor %d\", i);\n\t\t\tdb_count = i;\n\t\t\tgoto failed_mount2;\n\t\t}\n\t}\n\tif (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) {\n\t\text4_msg(sb, KERN_ERR, \"group descriptors corrupted!\");\n\t\tret = -EFSCORRUPTED;\n\t\tgoto failed_mount2;\n\t}\n\n\tsbi->s_gdb_count = db_count;\n\tget_random_bytes(&sbi->s_next_generation, sizeof(u32));\n\tspin_lock_init(&sbi->s_next_gen_lock);\n\n\tsetup_timer(&sbi->s_err_report, print_daily_error_info,\n\t\t(unsigned long) sb);\n\n\t/* Register extent status tree shrinker */\n\tif (ext4_es_register_shrinker(sbi))\n\t\tgoto failed_mount3;\n\n\tsbi->s_stripe = ext4_get_stripe_size(sbi);\n\tsbi->s_extent_max_zeroout_kb = 32;\n\n\t/*\n\t * set up enough so that it can read an inode\n\t */\n\tsb->s_op = &ext4_sops;\n\tsb->s_export_op = &ext4_export_ops;\n\tsb->s_xattr = ext4_xattr_handlers;\n\tsb->s_cop = &ext4_cryptops;\n#ifdef CONFIG_QUOTA\n\tsb->dq_op = &ext4_quota_operations;\n\tif (ext4_has_feature_quota(sb))\n\t\tsb->s_qcop = &dquot_quotactl_sysfile_ops;\n\telse\n\t\tsb->s_qcop = &ext4_qctl_operations;\n\tsb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;\n#endif\n\tmemcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));\n\n\tINIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */\n\tmutex_init(&sbi->s_orphan_lock);\n\n\tsb->s_root = NULL;\n\n\tneeds_recovery = (es->s_last_orphan != 0 ||\n\t\t\t ext4_has_feature_journal_needs_recovery(sb));\n\n\tif (ext4_has_feature_mmp(sb) && !(sb->s_flags & MS_RDONLY))\n\t\tif (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)))\n\t\t\tgoto failed_mount3a;\n\n\t/*\n\t * The first inode we look at is the journal inode. Don't try\n\t * root first: it may be modified in the journal!\n\t */\n\tif (!test_opt(sb, NOLOAD) && ext4_has_feature_journal(sb)) {\n\t\tif (ext4_load_journal(sb, es, journal_devnum))\n\t\t\tgoto failed_mount3a;\n\t} else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) &&\n\t\t ext4_has_feature_journal_needs_recovery(sb)) {\n\t\text4_msg(sb, KERN_ERR, \"required journal recovery \"\n\t\t \"suppressed and not mounted read-only\");\n\t\tgoto failed_mount_wq;\n\t} else {\n\t\t/* Nojournal mode, all journal mount options are illegal */\n\t\tif (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"journal_checksum, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"journal_async_commit, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"commit=%lu, fs mounted w/o journal\",\n\t\t\t\t sbi->s_commit_interval / HZ);\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (EXT4_MOUNT_DATA_FLAGS &\n\t\t (sbi->s_mount_opt ^ sbi->s_def_mount_opt)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"data=, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tsbi->s_def_mount_opt &= EXT4_MOUNT_JOURNAL_CHECKSUM;\n\t\tclear_opt(sb, JOURNAL_CHECKSUM);\n\t\tclear_opt(sb, DATA_FLAGS);\n\t\tsbi->s_journal = NULL;\n\t\tneeds_recovery = 0;\n\t\tgoto no_journal;\n\t}\n\n\tif (ext4_has_feature_64bit(sb) &&\n\t !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0,\n\t\t\t\t JBD2_FEATURE_INCOMPAT_64BIT)) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to set 64-bit journal feature\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif (!set_journal_csum_feature_set(sb)) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to set journal checksum \"\n\t\t\t \"feature set\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\t/* We have now updated the journal if required, so we can\n\t * validate the data journaling mode. */\n\tswitch (test_opt(sb, DATA_FLAGS)) {\n\tcase 0:\n\t\t/* No mode set, assume a default based on the journal\n\t\t * capabilities: ORDERED_DATA if the journal can\n\t\t * cope, else JOURNAL_DATA\n\t\t */\n\t\tif (jbd2_journal_check_available_features\n\t\t (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE))\n\t\t\tset_opt(sb, ORDERED_DATA);\n\t\telse\n\t\t\tset_opt(sb, JOURNAL_DATA);\n\t\tbreak;\n\n\tcase EXT4_MOUNT_ORDERED_DATA:\n\tcase EXT4_MOUNT_WRITEBACK_DATA:\n\t\tif (!jbd2_journal_check_available_features\n\t\t (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)) {\n\t\t\text4_msg(sb, KERN_ERR, \"Journal does not support \"\n\t\t\t \"requested data journaling mode\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\tdefault:\n\t\tbreak;\n\t}\n\tset_task_ioprio(sbi->s_journal->j_task, journal_ioprio);\n\n\tsbi->s_journal->j_commit_callback = ext4_journal_commit_callback;\n\nno_journal:\n\tsbi->s_mb_cache = ext4_xattr_create_cache();\n\tif (!sbi->s_mb_cache) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to create an mb_cache\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif ((DUMMY_ENCRYPTION_ENABLED(sbi) || ext4_has_feature_encrypt(sb)) &&\n\t (blocksize != PAGE_SIZE)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Unsupported blocksize for fs encryption\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) &&\n\t !ext4_has_feature_encrypt(sb)) {\n\t\text4_set_feature_encrypt(sb);\n\t\text4_commit_super(sb, 1);\n\t}\n\n\t/*\n\t * Get the # of file system overhead blocks from the\n\t * superblock if present.\n\t */\n\tif (es->s_overhead_clusters)\n\t\tsbi->s_overhead = le32_to_cpu(es->s_overhead_clusters);\n\telse {\n\t\terr = ext4_calculate_overhead(sb);\n\t\tif (err)\n\t\t\tgoto failed_mount_wq;\n\t}\n\n\t/*\n\t * The maximum number of concurrent works can be high and\n\t * concurrency isn't really necessary. Limit it to 1.\n\t */\n\tEXT4_SB(sb)->rsv_conversion_wq =\n\t\talloc_workqueue(\"ext4-rsv-conversion\", WQ_MEM_RECLAIM | WQ_UNBOUND, 1);\n\tif (!EXT4_SB(sb)->rsv_conversion_wq) {\n\t\tprintk(KERN_ERR \"EXT4-fs: failed to create workqueue\\n\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount4;\n\t}\n\n\t/*\n\t * The jbd2_journal_load will have done any necessary log recovery,\n\t * so we can safely mount the rest of the filesystem now.\n\t */\n\n\troot = ext4_iget(sb, EXT4_ROOT_INO);\n\tif (IS_ERR(root)) {\n\t\text4_msg(sb, KERN_ERR, \"get root inode failed\");\n\t\tret = PTR_ERR(root);\n\t\troot = NULL;\n\t\tgoto failed_mount4;\n\t}\n\tif (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {\n\t\text4_msg(sb, KERN_ERR, \"corrupt root inode, run e2fsck\");\n\t\tiput(root);\n\t\tgoto failed_mount4;\n\t}\n\tsb->s_root = d_make_root(root);\n\tif (!sb->s_root) {\n\t\text4_msg(sb, KERN_ERR, \"get root dentry failed\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount4;\n\t}\n\n\tif (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY))\n\t\tsb->s_flags |= MS_RDONLY;\n\n\t/* determine the minimum size of new large inodes, if present */\n\tif (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {\n\t\tsbi->s_want_extra_isize = sizeof(struct ext4_inode) -\n\t\t\t\t\t\t EXT4_GOOD_OLD_INODE_SIZE;\n\t\tif (ext4_has_feature_extra_isize(sb)) {\n\t\t\tif (sbi->s_want_extra_isize <\n\t\t\t le16_to_cpu(es->s_want_extra_isize))\n\t\t\t\tsbi->s_want_extra_isize =\n\t\t\t\t\tle16_to_cpu(es->s_want_extra_isize);\n\t\t\tif (sbi->s_want_extra_isize <\n\t\t\t le16_to_cpu(es->s_min_extra_isize))\n\t\t\t\tsbi->s_want_extra_isize =\n\t\t\t\t\tle16_to_cpu(es->s_min_extra_isize);\n\t\t}\n\t}\n\t/* Check if enough inode space is available */\n\tif (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >\n\t\t\t\t\t\t\tsbi->s_inode_size) {\n\t\tsbi->s_want_extra_isize = sizeof(struct ext4_inode) -\n\t\t\t\t\t\t EXT4_GOOD_OLD_INODE_SIZE;\n\t\text4_msg(sb, KERN_INFO, \"required extra inode space not\"\n\t\t\t \"available\");\n\t}\n\n\text4_set_resv_clusters(sb);\n\n\terr = ext4_setup_system_zone(sb);\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"failed to initialize system \"\n\t\t\t \"zone (%d)\", err);\n\t\tgoto failed_mount4a;\n\t}\n\n\text4_ext_init(sb);\n\terr = ext4_mb_init(sb);\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"failed to initialize mballoc (%d)\",\n\t\t\t err);\n\t\tgoto failed_mount5;\n\t}\n\n\tblock = ext4_count_free_clusters(sb);\n\text4_free_blocks_count_set(sbi->s_es, \n\t\t\t\t EXT4_C2B(sbi, block));\n\terr = percpu_counter_init(&sbi->s_freeclusters_counter, block,\n\t\t\t\t GFP_KERNEL);\n\tif (!err) {\n\t\tunsigned long freei = ext4_count_free_inodes(sb);\n\t\tsbi->s_es->s_free_inodes_count = cpu_to_le32(freei);\n\t\terr = percpu_counter_init(&sbi->s_freeinodes_counter, freei,\n\t\t\t\t\t GFP_KERNEL);\n\t}\n\tif (!err)\n\t\terr = percpu_counter_init(&sbi->s_dirs_counter,\n\t\t\t\t\t ext4_count_dirs(sb), GFP_KERNEL);\n\tif (!err)\n\t\terr = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0,\n\t\t\t\t\t GFP_KERNEL);\n\tif (!err)\n\t\terr = percpu_init_rwsem(&sbi->s_journal_flag_rwsem);\n\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"insufficient memory\");\n\t\tgoto failed_mount6;\n\t}\n\n\tif (ext4_has_feature_flex_bg(sb))\n\t\tif (!ext4_fill_flex_info(sb)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unable to initialize \"\n\t\t\t \"flex_bg meta info!\");\n\t\t\tgoto failed_mount6;\n\t\t}\n\n\terr = ext4_register_li_request(sb, first_not_zeroed);\n\tif (err)\n\t\tgoto failed_mount6;\n\n\terr = ext4_register_sysfs(sb);\n\tif (err)\n\t\tgoto failed_mount7;\n\n#ifdef CONFIG_QUOTA\n\t/* Enable quota usage during mount. */\n\tif (ext4_has_feature_quota(sb) && !(sb->s_flags & MS_RDONLY)) {\n\t\terr = ext4_enable_quotas(sb);\n\t\tif (err)\n\t\t\tgoto failed_mount8;\n\t}\n#endif /* CONFIG_QUOTA */\n\n\tEXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS;\n\text4_orphan_cleanup(sb, es);\n\tEXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;\n\tif (needs_recovery) {\n\t\text4_msg(sb, KERN_INFO, \"recovery complete\");\n\t\text4_mark_recovery_complete(sb, es);\n\t}\n\tif (EXT4_SB(sb)->s_journal) {\n\t\tif (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)\n\t\t\tdescr = \" journalled data mode\";\n\t\telse if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)\n\t\t\tdescr = \" ordered data mode\";\n\t\telse\n\t\t\tdescr = \" writeback data mode\";\n\t} else\n\t\tdescr = \"out journal\";\n\n\tif (test_opt(sb, DISCARD)) {\n\t\tstruct request_queue *q = bdev_get_queue(sb->s_bdev);\n\t\tif (!blk_queue_discard(q))\n\t\t\text4_msg(sb, KERN_WARNING,\n\t\t\t\t \"mounting with \\\"discard\\\" option, but \"\n\t\t\t\t \"the device does not support discard\");\n\t}\n\n\tif (___ratelimit(&ext4_mount_msg_ratelimit, \"EXT4-fs mount\"))\n\t\text4_msg(sb, KERN_INFO, \"mounted filesystem with%s. \"\n\t\t\t \"Opts: %.*s%s%s\", descr,\n\t\t\t (int) sizeof(sbi->s_es->s_mount_opts),\n\t\t\t sbi->s_es->s_mount_opts,\n\t\t\t *sbi->s_es->s_mount_opts ? \"; \" : \"\", orig_data);\n\n\tif (es->s_error_count)\n\t\tmod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */\n\n\t/* Enable message ratelimiting. Default is 10 messages per 5 secs. */\n\tratelimit_state_init(&sbi->s_err_ratelimit_state, 5 * HZ, 10);\n\tratelimit_state_init(&sbi->s_warning_ratelimit_state, 5 * HZ, 10);\n\tratelimit_state_init(&sbi->s_msg_ratelimit_state, 5 * HZ, 10);\n\n\tkfree(orig_data);\n#ifdef CONFIG_EXT4_FS_ENCRYPTION\n\tmemcpy(sbi->key_prefix, EXT4_KEY_DESC_PREFIX,\n\t\t\t\tEXT4_KEY_DESC_PREFIX_SIZE);\n\tsbi->key_prefix_size = EXT4_KEY_DESC_PREFIX_SIZE;\n#endif\n\treturn 0;\n\ncantfind_ext4:\n\tif (!silent)\n\t\text4_msg(sb, KERN_ERR, \"VFS: Can't find ext4 filesystem\");\n\tgoto failed_mount;\n\n#ifdef CONFIG_QUOTA\nfailed_mount8:\n\text4_unregister_sysfs(sb);\n#endif\nfailed_mount7:\n\text4_unregister_li_request(sb);\nfailed_mount6:\n\text4_mb_release(sb);\n\tif (sbi->s_flex_groups)\n\t\tkvfree(sbi->s_flex_groups);\n\tpercpu_counter_destroy(&sbi->s_freeclusters_counter);\n\tpercpu_counter_destroy(&sbi->s_freeinodes_counter);\n\tpercpu_counter_destroy(&sbi->s_dirs_counter);\n\tpercpu_counter_destroy(&sbi->s_dirtyclusters_counter);\nfailed_mount5:\n\text4_ext_release(sb);\n\text4_release_system_zone(sb);\nfailed_mount4a:\n\tdput(sb->s_root);\n\tsb->s_root = NULL;\nfailed_mount4:\n\text4_msg(sb, KERN_ERR, \"mount failed\");\n\tif (EXT4_SB(sb)->rsv_conversion_wq)\n\t\tdestroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq);\nfailed_mount_wq:\n\tif (sbi->s_mb_cache) {\n\t\text4_xattr_destroy_cache(sbi->s_mb_cache);\n\t\tsbi->s_mb_cache = NULL;\n\t}\n\tif (sbi->s_journal) {\n\t\tjbd2_journal_destroy(sbi->s_journal);\n\t\tsbi->s_journal = NULL;\n\t}\nfailed_mount3a:\n\text4_es_unregister_shrinker(sbi);\nfailed_mount3:\n\tdel_timer_sync(&sbi->s_err_report);\n\tif (sbi->s_mmp_tsk)\n\t\tkthread_stop(sbi->s_mmp_tsk);\nfailed_mount2:\n\tfor (i = 0; i < db_count; i++)\n\t\tbrelse(sbi->s_group_desc[i]);\n\tkvfree(sbi->s_group_desc);\nfailed_mount:\n\tif (sbi->s_chksum_driver)\n\t\tcrypto_free_shash(sbi->s_chksum_driver);\n#ifdef CONFIG_QUOTA\n\tfor (i = 0; i < EXT4_MAXQUOTAS; i++)\n\t\tkfree(sbi->s_qf_names[i]);\n#endif\n\text4_blkdev_remove(sbi);\n\tbrelse(bh);\nout_fail:\n\tsb->s_fs_info = NULL;\n\tkfree(sbi->s_blockgroup_lock);\nout_free_base:\n\tkfree(sbi);\n\tkfree(orig_data);\n\treturn err ? err : ret;\n}","target":"static int ext4_fill_super(struct super_block *sb, void *data, int silent)\n{\n\tchar *orig_data = kstrdup(data, GFP_KERNEL);\n\tstruct buffer_head *bh;\n\tstruct ext4_super_block *es = NULL;\n\tstruct ext4_sb_info *sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);\n\text4_fsblk_t block;\n\text4_fsblk_t sb_block = get_sb_block(&data);\n\text4_fsblk_t logical_sb_block;\n\tunsigned long offset = 0;\n\tunsigned long journal_devnum = 0;\n\tunsigned long def_mount_opts;\n\tstruct inode *root;\n\tconst char *descr;\n\tint ret = -ENOMEM;\n\tint blocksize, clustersize;\n\tunsigned int db_count;\n\tunsigned int i;\n\tint needs_recovery, has_huge_files, has_bigalloc;\n\t__u64 blocks_count;\n\tint err = 0;\n\tunsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;\n\text4_group_t first_not_zeroed;\n\n\tif ((data && !orig_data) || !sbi)\n\t\tgoto out_free_base;\n\n\tsbi->s_blockgroup_lock =\n\t\tkzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);\n\tif (!sbi->s_blockgroup_lock)\n\t\tgoto out_free_base;\n\n\tsb->s_fs_info = sbi;\n\tsbi->s_sb = sb;\n\tsbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS;\n\tsbi->s_sb_block = sb_block;\n\tif (sb->s_bdev->bd_part)\n\t\tsbi->s_sectors_written_start =\n\t\t\tpart_stat_read(sb->s_bdev->bd_part, sectors[1]);\n\n\t/* Cleanup superblock name */\n\tstrreplace(sb->s_id, '/', '!');\n\n\t/* -EINVAL is default */\n\tret = -EINVAL;\n\tblocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE);\n\tif (!blocksize) {\n\t\text4_msg(sb, KERN_ERR, \"unable to set blocksize\");\n\t\tgoto out_fail;\n\t}\n\n\t/*\n\t * The ext4 superblock will not be buffer aligned for other than 1kB\n\t * block sizes. We need to calculate the offset from buffer start.\n\t */\n\tif (blocksize != EXT4_MIN_BLOCK_SIZE) {\n\t\tlogical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;\n\t\toffset = do_div(logical_sb_block, blocksize);\n\t} else {\n\t\tlogical_sb_block = sb_block;\n\t}\n\n\tif (!(bh = sb_bread_unmovable(sb, logical_sb_block))) {\n\t\text4_msg(sb, KERN_ERR, \"unable to read superblock\");\n\t\tgoto out_fail;\n\t}\n\t/*\n\t * Note: s_es must be initialized as soon as possible because\n\t * some ext4 macro-instructions depend on its value\n\t */\n\tes = (struct ext4_super_block *) (bh->b_data + offset);\n\tsbi->s_es = es;\n\tsb->s_magic = le16_to_cpu(es->s_magic);\n\tif (sb->s_magic != EXT4_SUPER_MAGIC)\n\t\tgoto cantfind_ext4;\n\tsbi->s_kbytes_written = le64_to_cpu(es->s_kbytes_written);\n\n\t/* Warn if metadata_csum and gdt_csum are both set. */\n\tif (ext4_has_feature_metadata_csum(sb) &&\n\t ext4_has_feature_gdt_csum(sb))\n\t\text4_warning(sb, \"metadata_csum and uninit_bg are \"\n\t\t\t \"redundant flags; please run fsck.\");\n\n\t/* Check for a known checksum algorithm */\n\tif (!ext4_verify_csum_type(sb, es)) {\n\t\text4_msg(sb, KERN_ERR, \"VFS: Found ext4 filesystem with \"\n\t\t\t \"unknown checksum algorithm.\");\n\t\tsilent = 1;\n\t\tgoto cantfind_ext4;\n\t}\n\n\t/* Load the checksum driver */\n\tif (ext4_has_feature_metadata_csum(sb)) {\n\t\tsbi->s_chksum_driver = crypto_alloc_shash(\"crc32c\", 0, 0);\n\t\tif (IS_ERR(sbi->s_chksum_driver)) {\n\t\t\text4_msg(sb, KERN_ERR, \"Cannot load crc32c driver.\");\n\t\t\tret = PTR_ERR(sbi->s_chksum_driver);\n\t\t\tsbi->s_chksum_driver = NULL;\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\t/* Check superblock checksum */\n\tif (!ext4_superblock_csum_verify(sb, es)) {\n\t\text4_msg(sb, KERN_ERR, \"VFS: Found ext4 filesystem with \"\n\t\t\t \"invalid superblock checksum. Run e2fsck?\");\n\t\tsilent = 1;\n\t\tret = -EFSBADCRC;\n\t\tgoto cantfind_ext4;\n\t}\n\n\t/* Precompute checksum seed for all metadata */\n\tif (ext4_has_feature_csum_seed(sb))\n\t\tsbi->s_csum_seed = le32_to_cpu(es->s_checksum_seed);\n\telse if (ext4_has_metadata_csum(sb))\n\t\tsbi->s_csum_seed = ext4_chksum(sbi, ~0, es->s_uuid,\n\t\t\t\t\t sizeof(es->s_uuid));\n\n\t/* Set defaults before we parse the mount options */\n\tdef_mount_opts = le32_to_cpu(es->s_default_mount_opts);\n\tset_opt(sb, INIT_INODE_TABLE);\n\tif (def_mount_opts & EXT4_DEFM_DEBUG)\n\t\tset_opt(sb, DEBUG);\n\tif (def_mount_opts & EXT4_DEFM_BSDGROUPS)\n\t\tset_opt(sb, GRPID);\n\tif (def_mount_opts & EXT4_DEFM_UID16)\n\t\tset_opt(sb, NO_UID32);\n\t/* xattr user namespace & acls are now defaulted on */\n\tset_opt(sb, XATTR_USER);\n#ifdef CONFIG_EXT4_FS_POSIX_ACL\n\tset_opt(sb, POSIX_ACL);\n#endif\n\t/* don't forget to enable journal_csum when metadata_csum is enabled. */\n\tif (ext4_has_metadata_csum(sb))\n\t\tset_opt(sb, JOURNAL_CHECKSUM);\n\n\tif ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)\n\t\tset_opt(sb, JOURNAL_DATA);\n\telse if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)\n\t\tset_opt(sb, ORDERED_DATA);\n\telse if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_WBACK)\n\t\tset_opt(sb, WRITEBACK_DATA);\n\n\tif (le16_to_cpu(sbi->s_es->s_errors) == EXT4_ERRORS_PANIC)\n\t\tset_opt(sb, ERRORS_PANIC);\n\telse if (le16_to_cpu(sbi->s_es->s_errors) == EXT4_ERRORS_CONTINUE)\n\t\tset_opt(sb, ERRORS_CONT);\n\telse\n\t\tset_opt(sb, ERRORS_RO);\n\t/* block_validity enabled by default; disable with noblock_validity */\n\tset_opt(sb, BLOCK_VALIDITY);\n\tif (def_mount_opts & EXT4_DEFM_DISCARD)\n\t\tset_opt(sb, DISCARD);\n\n\tsbi->s_resuid = make_kuid(&init_user_ns, le16_to_cpu(es->s_def_resuid));\n\tsbi->s_resgid = make_kgid(&init_user_ns, le16_to_cpu(es->s_def_resgid));\n\tsbi->s_commit_interval = JBD2_DEFAULT_MAX_COMMIT_AGE * HZ;\n\tsbi->s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME;\n\tsbi->s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME;\n\n\tif ((def_mount_opts & EXT4_DEFM_NOBARRIER) == 0)\n\t\tset_opt(sb, BARRIER);\n\n\t/*\n\t * enable delayed allocation by default\n\t * Use -o nodelalloc to turn it off\n\t */\n\tif (!IS_EXT3_SB(sb) && !IS_EXT2_SB(sb) &&\n\t ((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0))\n\t\tset_opt(sb, DELALLOC);\n\n\t/*\n\t * set default s_li_wait_mult for lazyinit, for the case there is\n\t * no mount option specified.\n\t */\n\tsbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT;\n\n\tif (sbi->s_es->s_mount_opts[0]) {\n\t\tchar *s_mount_opts = kstrndup(sbi->s_es->s_mount_opts,\n\t\t\t\t\t sizeof(sbi->s_es->s_mount_opts),\n\t\t\t\t\t GFP_KERNEL);\n\t\tif (!s_mount_opts)\n\t\t\tgoto failed_mount;\n\t\tif (!parse_options(s_mount_opts, sb, &journal_devnum,\n\t\t\t\t &journal_ioprio, 0)) {\n\t\t\text4_msg(sb, KERN_WARNING,\n\t\t\t\t \"failed to parse options in superblock: %s\",\n\t\t\t\t s_mount_opts);\n\t\t}\n\t\tkfree(s_mount_opts);\n\t}\n\tsbi->s_def_mount_opt = sbi->s_mount_opt;\n\tif (!parse_options((char *) data, sb, &journal_devnum,\n\t\t\t &journal_ioprio, 0))\n\t\tgoto failed_mount;\n\n\tif (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {\n\t\tprintk_once(KERN_WARNING \"EXT4-fs: Warning: mounting \"\n\t\t\t \"with data=journal disables delayed \"\n\t\t\t \"allocation and O_DIRECT support!\\n\");\n\t\tif (test_opt2(sb, EXPLICIT_DELALLOC)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and delalloc\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DIOREAD_NOLOCK)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and dioread_nolock\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DAX)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and dax\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DELALLOC))\n\t\t\tclear_opt(sb, DELALLOC);\n\t} else {\n\t\tsb->s_iflags |= SB_I_CGROUPWB;\n\t}\n\n\tsb->s_flags = (sb->s_flags & ~MS_POSIXACL) |\n\t\t(test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);\n\n\tif (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV &&\n\t (ext4_has_compat_features(sb) ||\n\t ext4_has_ro_compat_features(sb) ||\n\t ext4_has_incompat_features(sb)))\n\t\text4_msg(sb, KERN_WARNING,\n\t\t \"feature flags set on rev 0 fs, \"\n\t\t \"running e2fsck is recommended\");\n\n\tif (es->s_creator_os == cpu_to_le32(EXT4_OS_HURD)) {\n\t\tset_opt2(sb, HURD_COMPAT);\n\t\tif (ext4_has_feature_64bit(sb)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"The Hurd can't support 64-bit file systems\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\tif (IS_EXT2_SB(sb)) {\n\t\tif (ext2_feature_set_ok(sb))\n\t\t\text4_msg(sb, KERN_INFO, \"mounting ext2 file system \"\n\t\t\t\t \"using the ext4 subsystem\");\n\t\telse {\n\t\t\text4_msg(sb, KERN_ERR, \"couldn't mount as ext2 due \"\n\t\t\t\t \"to feature incompatibilities\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\tif (IS_EXT3_SB(sb)) {\n\t\tif (ext3_feature_set_ok(sb))\n\t\t\text4_msg(sb, KERN_INFO, \"mounting ext3 file system \"\n\t\t\t\t \"using the ext4 subsystem\");\n\t\telse {\n\t\t\text4_msg(sb, KERN_ERR, \"couldn't mount as ext3 due \"\n\t\t\t\t \"to feature incompatibilities\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\t/*\n\t * Check feature flags regardless of the revision level, since we\n\t * previously didn't change the revision level when setting the flags,\n\t * so there is a chance incompat flags are set on a rev 0 filesystem.\n\t */\n\tif (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY)))\n\t\tgoto failed_mount;\n\n\tblocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);\n\tif (blocksize < EXT4_MIN_BLOCK_SIZE ||\n\t blocksize > EXT4_MAX_BLOCK_SIZE) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t \"Unsupported filesystem blocksize %d (%d log_block_size)\",\n\t\t\t blocksize, le32_to_cpu(es->s_log_block_size));\n\t\tgoto failed_mount;\n\t}\n\tif (le32_to_cpu(es->s_log_block_size) >\n\t (EXT4_MAX_BLOCK_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Invalid log block size: %u\",\n\t\t\t le32_to_cpu(es->s_log_block_size));\n\t\tgoto failed_mount;\n\t}\n\n\tif (le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) > (blocksize / 4)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Number of reserved GDT blocks insanely large: %d\",\n\t\t\t le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks));\n\t\tgoto failed_mount;\n\t}\n\n\tif (sbi->s_mount_opt & EXT4_MOUNT_DAX) {\n\t\terr = bdev_dax_supported(sb, blocksize);\n\t\tif (err)\n\t\t\tgoto failed_mount;\n\t}\n\n\tif (ext4_has_feature_encrypt(sb) && es->s_encryption_level) {\n\t\text4_msg(sb, KERN_ERR, \"Unsupported encryption level %d\",\n\t\t\t es->s_encryption_level);\n\t\tgoto failed_mount;\n\t}\n\n\tif (sb->s_blocksize != blocksize) {\n\t\t/* Validate the filesystem blocksize */\n\t\tif (!sb_set_blocksize(sb, blocksize)) {\n\t\t\text4_msg(sb, KERN_ERR, \"bad block size %d\",\n\t\t\t\t\tblocksize);\n\t\t\tgoto failed_mount;\n\t\t}\n\n\t\tbrelse(bh);\n\t\tlogical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;\n\t\toffset = do_div(logical_sb_block, blocksize);\n\t\tbh = sb_bread_unmovable(sb, logical_sb_block);\n\t\tif (!bh) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Can't read superblock on 2nd try\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tes = (struct ext4_super_block *)(bh->b_data + offset);\n\t\tsbi->s_es = es;\n\t\tif (es->s_magic != cpu_to_le16(EXT4_SUPER_MAGIC)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Magic mismatch, very weird!\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\thas_huge_files = ext4_has_feature_huge_file(sb);\n\tsbi->s_bitmap_maxbytes = ext4_max_bitmap_size(sb->s_blocksize_bits,\n\t\t\t\t\t\t has_huge_files);\n\tsb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits, has_huge_files);\n\n\tif (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV) {\n\t\tsbi->s_inode_size = EXT4_GOOD_OLD_INODE_SIZE;\n\t\tsbi->s_first_ino = EXT4_GOOD_OLD_FIRST_INO;\n\t} else {\n\t\tsbi->s_inode_size = le16_to_cpu(es->s_inode_size);\n\t\tsbi->s_first_ino = le32_to_cpu(es->s_first_ino);\n\t\tif ((sbi->s_inode_size < EXT4_GOOD_OLD_INODE_SIZE) ||\n\t\t (!is_power_of_2(sbi->s_inode_size)) ||\n\t\t (sbi->s_inode_size > blocksize)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unsupported inode size: %d\",\n\t\t\t sbi->s_inode_size);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE)\n\t\t\tsb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2);\n\t}\n\n\tsbi->s_desc_size = le16_to_cpu(es->s_desc_size);\n\tif (ext4_has_feature_64bit(sb)) {\n\t\tif (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||\n\t\t sbi->s_desc_size > EXT4_MAX_DESC_SIZE ||\n\t\t !is_power_of_2(sbi->s_desc_size)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unsupported descriptor size %lu\",\n\t\t\t sbi->s_desc_size);\n\t\t\tgoto failed_mount;\n\t\t}\n\t} else\n\t\tsbi->s_desc_size = EXT4_MIN_DESC_SIZE;\n\n\tsbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);\n\tsbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);\n\n\tsbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb);\n\tif (sbi->s_inodes_per_block == 0)\n\t\tgoto cantfind_ext4;\n\tif (sbi->s_inodes_per_group < sbi->s_inodes_per_block ||\n\t sbi->s_inodes_per_group > blocksize * 8) {\n\t\text4_msg(sb, KERN_ERR, \"invalid inodes per group: %lu\\n\",\n\t\t\t sbi->s_blocks_per_group);\n\t\tgoto failed_mount;\n\t}\n\tsbi->s_itb_per_group = sbi->s_inodes_per_group /\n\t\t\t\t\tsbi->s_inodes_per_block;\n\tsbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);\n\tsbi->s_sbh = bh;\n\tsbi->s_mount_state = le16_to_cpu(es->s_state);\n\tsbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb));\n\tsbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb));\n\n\tfor (i = 0; i < 4; i++)\n\t\tsbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);\n\tsbi->s_def_hash_version = es->s_def_hash_version;\n\tif (ext4_has_feature_dir_index(sb)) {\n\t\ti = le32_to_cpu(es->s_flags);\n\t\tif (i & EXT2_FLAGS_UNSIGNED_HASH)\n\t\t\tsbi->s_hash_unsigned = 3;\n\t\telse if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) {\n#ifdef __CHAR_UNSIGNED__\n\t\t\tif (!(sb->s_flags & MS_RDONLY))\n\t\t\t\tes->s_flags |=\n\t\t\t\t\tcpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH);\n\t\t\tsbi->s_hash_unsigned = 3;\n#else\n\t\t\tif (!(sb->s_flags & MS_RDONLY))\n\t\t\t\tes->s_flags |=\n\t\t\t\t\tcpu_to_le32(EXT2_FLAGS_SIGNED_HASH);\n#endif\n\t\t}\n\t}\n\n\t/* Handle clustersize */\n\tclustersize = BLOCK_SIZE << le32_to_cpu(es->s_log_cluster_size);\n\thas_bigalloc = ext4_has_feature_bigalloc(sb);\n\tif (has_bigalloc) {\n\t\tif (clustersize < blocksize) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"cluster size (%d) smaller than \"\n\t\t\t\t \"block size (%d)\", clustersize, blocksize);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (le32_to_cpu(es->s_log_cluster_size) >\n\t\t (EXT4_MAX_CLUSTER_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"Invalid log cluster size: %u\",\n\t\t\t\t le32_to_cpu(es->s_log_cluster_size));\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tsbi->s_cluster_bits = le32_to_cpu(es->s_log_cluster_size) -\n\t\t\tle32_to_cpu(es->s_log_block_size);\n\t\tsbi->s_clusters_per_group =\n\t\t\tle32_to_cpu(es->s_clusters_per_group);\n\t\tif (sbi->s_clusters_per_group > blocksize * 8) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"#clusters per group too big: %lu\",\n\t\t\t\t sbi->s_clusters_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (sbi->s_blocks_per_group !=\n\t\t (sbi->s_clusters_per_group * (clustersize / blocksize))) {\n\t\t\text4_msg(sb, KERN_ERR, \"blocks per group (%lu) and \"\n\t\t\t\t \"clusters per group (%lu) inconsistent\",\n\t\t\t\t sbi->s_blocks_per_group,\n\t\t\t\t sbi->s_clusters_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t} else {\n\t\tif (clustersize != blocksize) {\n\t\t\text4_warning(sb, \"fragment/cluster size (%d) != \"\n\t\t\t\t \"block size (%d)\", clustersize,\n\t\t\t\t blocksize);\n\t\t\tclustersize = blocksize;\n\t\t}\n\t\tif (sbi->s_blocks_per_group > blocksize * 8) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"#blocks per group too big: %lu\",\n\t\t\t\t sbi->s_blocks_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tsbi->s_clusters_per_group = sbi->s_blocks_per_group;\n\t\tsbi->s_cluster_bits = 0;\n\t}\n\tsbi->s_cluster_ratio = clustersize / blocksize;\n\n\t/* Do we have standard group size of clustersize * 8 blocks ? */\n\tif (sbi->s_blocks_per_group == clustersize << 3)\n\t\tset_opt2(sb, STD_GROUP_SIZE);\n\n\t/*\n\t * Test whether we have more sectors than will fit in sector_t,\n\t * and whether the max offset is addressable by the page cache.\n\t */\n\terr = generic_check_addressable(sb->s_blocksize_bits,\n\t\t\t\t\text4_blocks_count(es));\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"filesystem\"\n\t\t\t \" too large to mount safely on this system\");\n\t\tif (sizeof(sector_t) < 8)\n\t\t\text4_msg(sb, KERN_WARNING, \"CONFIG_LBDAF not enabled\");\n\t\tgoto failed_mount;\n\t}\n\n\tif (EXT4_BLOCKS_PER_GROUP(sb) == 0)\n\t\tgoto cantfind_ext4;\n\n\t/* check blocks count against device size */\n\tblocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;\n\tif (blocks_count && ext4_blocks_count(es) > blocks_count) {\n\t\text4_msg(sb, KERN_WARNING, \"bad geometry: block count %llu \"\n\t\t \"exceeds size of device (%llu blocks)\",\n\t\t ext4_blocks_count(es), blocks_count);\n\t\tgoto failed_mount;\n\t}\n\n\t/*\n\t * It makes no sense for the first data block to be beyond the end\n\t * of the filesystem.\n\t */\n\tif (le32_to_cpu(es->s_first_data_block) >= ext4_blocks_count(es)) {\n\t\text4_msg(sb, KERN_WARNING, \"bad geometry: first data \"\n\t\t\t \"block %u is beyond end of filesystem (%llu)\",\n\t\t\t le32_to_cpu(es->s_first_data_block),\n\t\t\t ext4_blocks_count(es));\n\t\tgoto failed_mount;\n\t}\n\tblocks_count = (ext4_blocks_count(es) -\n\t\t\tle32_to_cpu(es->s_first_data_block) +\n\t\t\tEXT4_BLOCKS_PER_GROUP(sb) - 1);\n\tdo_div(blocks_count, EXT4_BLOCKS_PER_GROUP(sb));\n\tif (blocks_count > ((uint64_t)1<<32) - EXT4_DESC_PER_BLOCK(sb)) {\n\t\text4_msg(sb, KERN_WARNING, \"groups count too large: %u \"\n\t\t \"(block count %llu, first data block %u, \"\n\t\t \"blocks per group %lu)\", sbi->s_groups_count,\n\t\t ext4_blocks_count(es),\n\t\t le32_to_cpu(es->s_first_data_block),\n\t\t EXT4_BLOCKS_PER_GROUP(sb));\n\t\tgoto failed_mount;\n\t}\n\tsbi->s_groups_count = blocks_count;\n\tsbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count,\n\t\t\t(EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb)));\n\tdb_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /\n\t\t EXT4_DESC_PER_BLOCK(sb);\n\tif (ext4_has_feature_meta_bg(sb)) {\n\t\tif (le32_to_cpu(es->s_first_meta_bg) >= db_count) {\n\t\t\text4_msg(sb, KERN_WARNING,\n\t\t\t\t \"first meta block group too large: %u \"\n\t\t\t\t \"(group descriptor block count %u)\",\n\t\t\t\t le32_to_cpu(es->s_first_meta_bg), db_count);\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\tsbi->s_group_desc = ext4_kvmalloc(db_count *\n\t\t\t\t\t sizeof(struct buffer_head *),\n\t\t\t\t\t GFP_KERNEL);\n\tif (sbi->s_group_desc == NULL) {\n\t\text4_msg(sb, KERN_ERR, \"not enough memory\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount;\n\t}\n\n\tbgl_lock_init(sbi->s_blockgroup_lock);\n\n\tfor (i = 0; i < db_count; i++) {\n\t\tblock = descriptor_loc(sb, logical_sb_block, i);\n\t\tsbi->s_group_desc[i] = sb_bread_unmovable(sb, block);\n\t\tif (!sbi->s_group_desc[i]) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"can't read group descriptor %d\", i);\n\t\t\tdb_count = i;\n\t\t\tgoto failed_mount2;\n\t\t}\n\t}\n\tif (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) {\n\t\text4_msg(sb, KERN_ERR, \"group descriptors corrupted!\");\n\t\tret = -EFSCORRUPTED;\n\t\tgoto failed_mount2;\n\t}\n\n\tsbi->s_gdb_count = db_count;\n\tget_random_bytes(&sbi->s_next_generation, sizeof(u32));\n\tspin_lock_init(&sbi->s_next_gen_lock);\n\n\tsetup_timer(&sbi->s_err_report, print_daily_error_info,\n\t\t(unsigned long) sb);\n\n\t/* Register extent status tree shrinker */\n\tif (ext4_es_register_shrinker(sbi))\n\t\tgoto failed_mount3;\n\n\tsbi->s_stripe = ext4_get_stripe_size(sbi);\n\tsbi->s_extent_max_zeroout_kb = 32;\n\n\t/*\n\t * set up enough so that it can read an inode\n\t */\n\tsb->s_op = &ext4_sops;\n\tsb->s_export_op = &ext4_export_ops;\n\tsb->s_xattr = ext4_xattr_handlers;\n\tsb->s_cop = &ext4_cryptops;\n#ifdef CONFIG_QUOTA\n\tsb->dq_op = &ext4_quota_operations;\n\tif (ext4_has_feature_quota(sb))\n\t\tsb->s_qcop = &dquot_quotactl_sysfile_ops;\n\telse\n\t\tsb->s_qcop = &ext4_qctl_operations;\n\tsb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;\n#endif\n\tmemcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));\n\n\tINIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */\n\tmutex_init(&sbi->s_orphan_lock);\n\n\tsb->s_root = NULL;\n\n\tneeds_recovery = (es->s_last_orphan != 0 ||\n\t\t\t ext4_has_feature_journal_needs_recovery(sb));\n\n\tif (ext4_has_feature_mmp(sb) && !(sb->s_flags & MS_RDONLY))\n\t\tif (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)))\n\t\t\tgoto failed_mount3a;\n\n\t/*\n\t * The first inode we look at is the journal inode. Don't try\n\t * root first: it may be modified in the journal!\n\t */\n\tif (!test_opt(sb, NOLOAD) && ext4_has_feature_journal(sb)) {\n\t\tif (ext4_load_journal(sb, es, journal_devnum))\n\t\t\tgoto failed_mount3a;\n\t} else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) &&\n\t\t ext4_has_feature_journal_needs_recovery(sb)) {\n\t\text4_msg(sb, KERN_ERR, \"required journal recovery \"\n\t\t \"suppressed and not mounted read-only\");\n\t\tgoto failed_mount_wq;\n\t} else {\n\t\t/* Nojournal mode, all journal mount options are illegal */\n\t\tif (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"journal_checksum, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"journal_async_commit, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"commit=%lu, fs mounted w/o journal\",\n\t\t\t\t sbi->s_commit_interval / HZ);\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (EXT4_MOUNT_DATA_FLAGS &\n\t\t (sbi->s_mount_opt ^ sbi->s_def_mount_opt)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"data=, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tsbi->s_def_mount_opt &= EXT4_MOUNT_JOURNAL_CHECKSUM;\n\t\tclear_opt(sb, JOURNAL_CHECKSUM);\n\t\tclear_opt(sb, DATA_FLAGS);\n\t\tsbi->s_journal = NULL;\n\t\tneeds_recovery = 0;\n\t\tgoto no_journal;\n\t}\n\n\tif (ext4_has_feature_64bit(sb) &&\n\t !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0,\n\t\t\t\t JBD2_FEATURE_INCOMPAT_64BIT)) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to set 64-bit journal feature\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif (!set_journal_csum_feature_set(sb)) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to set journal checksum \"\n\t\t\t \"feature set\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\t/* We have now updated the journal if required, so we can\n\t * validate the data journaling mode. */\n\tswitch (test_opt(sb, DATA_FLAGS)) {\n\tcase 0:\n\t\t/* No mode set, assume a default based on the journal\n\t\t * capabilities: ORDERED_DATA if the journal can\n\t\t * cope, else JOURNAL_DATA\n\t\t */\n\t\tif (jbd2_journal_check_available_features\n\t\t (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE))\n\t\t\tset_opt(sb, ORDERED_DATA);\n\t\telse\n\t\t\tset_opt(sb, JOURNAL_DATA);\n\t\tbreak;\n\n\tcase EXT4_MOUNT_ORDERED_DATA:\n\tcase EXT4_MOUNT_WRITEBACK_DATA:\n\t\tif (!jbd2_journal_check_available_features\n\t\t (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)) {\n\t\t\text4_msg(sb, KERN_ERR, \"Journal does not support \"\n\t\t\t \"requested data journaling mode\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\tdefault:\n\t\tbreak;\n\t}\n\tset_task_ioprio(sbi->s_journal->j_task, journal_ioprio);\n\n\tsbi->s_journal->j_commit_callback = ext4_journal_commit_callback;\n\nno_journal:\n\tsbi->s_mb_cache = ext4_xattr_create_cache();\n\tif (!sbi->s_mb_cache) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to create an mb_cache\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif ((DUMMY_ENCRYPTION_ENABLED(sbi) || ext4_has_feature_encrypt(sb)) &&\n\t (blocksize != PAGE_SIZE)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Unsupported blocksize for fs encryption\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) &&\n\t !ext4_has_feature_encrypt(sb)) {\n\t\text4_set_feature_encrypt(sb);\n\t\text4_commit_super(sb, 1);\n\t}\n\n\t/*\n\t * Get the # of file system overhead blocks from the\n\t * superblock if present.\n\t */\n\tif (es->s_overhead_clusters)\n\t\tsbi->s_overhead = le32_to_cpu(es->s_overhead_clusters);\n\telse {\n\t\terr = ext4_calculate_overhead(sb);\n\t\tif (err)\n\t\t\tgoto failed_mount_wq;\n\t}\n\n\t/*\n\t * The maximum number of concurrent works can be high and\n\t * concurrency isn't really necessary. Limit it to 1.\n\t */\n\tEXT4_SB(sb)->rsv_conversion_wq =\n\t\talloc_workqueue(\"ext4-rsv-conversion\", WQ_MEM_RECLAIM | WQ_UNBOUND, 1);\n\tif (!EXT4_SB(sb)->rsv_conversion_wq) {\n\t\tprintk(KERN_ERR \"EXT4-fs: failed to create workqueue\\n\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount4;\n\t}\n\n\t/*\n\t * The jbd2_journal_load will have done any necessary log recovery,\n\t * so we can safely mount the rest of the filesystem now.\n\t */\n\n\troot = ext4_iget(sb, EXT4_ROOT_INO);\n\tif (IS_ERR(root)) {\n\t\text4_msg(sb, KERN_ERR, \"get root inode failed\");\n\t\tret = PTR_ERR(root);\n\t\troot = NULL;\n\t\tgoto failed_mount4;\n\t}\n\tif (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {\n\t\text4_msg(sb, KERN_ERR, \"corrupt root inode, run e2fsck\");\n\t\tiput(root);\n\t\tgoto failed_mount4;\n\t}\n\tsb->s_root = d_make_root(root);\n\tif (!sb->s_root) {\n\t\text4_msg(sb, KERN_ERR, \"get root dentry failed\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount4;\n\t}\n\n\tif (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY))\n\t\tsb->s_flags |= MS_RDONLY;\n\n\t/* determine the minimum size of new large inodes, if present */\n\tif (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {\n\t\tsbi->s_want_extra_isize = sizeof(struct ext4_inode) -\n\t\t\t\t\t\t EXT4_GOOD_OLD_INODE_SIZE;\n\t\tif (ext4_has_feature_extra_isize(sb)) {\n\t\t\tif (sbi->s_want_extra_isize <\n\t\t\t le16_to_cpu(es->s_want_extra_isize))\n\t\t\t\tsbi->s_want_extra_isize =\n\t\t\t\t\tle16_to_cpu(es->s_want_extra_isize);\n\t\t\tif (sbi->s_want_extra_isize <\n\t\t\t le16_to_cpu(es->s_min_extra_isize))\n\t\t\t\tsbi->s_want_extra_isize =\n\t\t\t\t\tle16_to_cpu(es->s_min_extra_isize);\n\t\t}\n\t}\n\t/* Check if enough inode space is available */\n\tif (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >\n\t\t\t\t\t\t\tsbi->s_inode_size) {\n\t\tsbi->s_want_extra_isize = sizeof(struct ext4_inode) -\n\t\t\t\t\t\t EXT4_GOOD_OLD_INODE_SIZE;\n\t\text4_msg(sb, KERN_INFO, \"required extra inode space not\"\n\t\t\t \"available\");\n\t}\n\n\text4_set_resv_clusters(sb);\n\n\terr = ext4_setup_system_zone(sb);\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"failed to initialize system \"\n\t\t\t \"zone (%d)\", err);\n\t\tgoto failed_mount4a;\n\t}\n\n\text4_ext_init(sb);\n\terr = ext4_mb_init(sb);\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"failed to initialize mballoc (%d)\",\n\t\t\t err);\n\t\tgoto failed_mount5;\n\t}\n\n\tblock = ext4_count_free_clusters(sb);\n\text4_free_blocks_count_set(sbi->s_es, \n\t\t\t\t EXT4_C2B(sbi, block));\n\terr = percpu_counter_init(&sbi->s_freeclusters_counter, block,\n\t\t\t\t GFP_KERNEL);\n\tif (!err) {\n\t\tunsigned long freei = ext4_count_free_inodes(sb);\n\t\tsbi->s_es->s_free_inodes_count = cpu_to_le32(freei);\n\t\terr = percpu_counter_init(&sbi->s_freeinodes_counter, freei,\n\t\t\t\t\t GFP_KERNEL);\n\t}\n\tif (!err)\n\t\terr = percpu_counter_init(&sbi->s_dirs_counter,\n\t\t\t\t\t ext4_count_dirs(sb), GFP_KERNEL);\n\tif (!err)\n\t\terr = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0,\n\t\t\t\t\t GFP_KERNEL);\n\tif (!err)\n\t\terr = percpu_init_rwsem(&sbi->s_journal_flag_rwsem);\n\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"insufficient memory\");\n\t\tgoto failed_mount6;\n\t}\n\n\tif (ext4_has_feature_flex_bg(sb))\n\t\tif (!ext4_fill_flex_info(sb)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unable to initialize \"\n\t\t\t \"flex_bg meta info!\");\n\t\t\tgoto failed_mount6;\n\t\t}\n\n\terr = ext4_register_li_request(sb, first_not_zeroed);\n\tif (err)\n\t\tgoto failed_mount6;\n\n\terr = ext4_register_sysfs(sb);\n\tif (err)\n\t\tgoto failed_mount7;\n\n#ifdef CONFIG_QUOTA\n\t/* Enable quota usage during mount. */\n\tif (ext4_has_feature_quota(sb) && !(sb->s_flags & MS_RDONLY)) {\n\t\terr = ext4_enable_quotas(sb);\n\t\tif (err)\n\t\t\tgoto failed_mount8;\n\t}\n#endif /* CONFIG_QUOTA */\n\n\tEXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS;\n\text4_orphan_cleanup(sb, es);\n\tEXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;\n\tif (needs_recovery) {\n\t\text4_msg(sb, KERN_INFO, \"recovery complete\");\n\t\text4_mark_recovery_complete(sb, es);\n\t}\n\tif (EXT4_SB(sb)->s_journal) {\n\t\tif (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)\n\t\t\tdescr = \" journalled data mode\";\n\t\telse if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)\n\t\t\tdescr = \" ordered data mode\";\n\t\telse\n\t\t\tdescr = \" writeback data mode\";\n\t} else\n\t\tdescr = \"out journal\";\n\n\tif (test_opt(sb, DISCARD)) {\n\t\tstruct request_queue *q = bdev_get_queue(sb->s_bdev);\n\t\tif (!blk_queue_discard(q))\n\t\t\text4_msg(sb, KERN_WARNING,\n\t\t\t\t \"mounting with \\\"discard\\\" option, but \"\n\t\t\t\t \"the device does not support discard\");\n\t}\n\n\tif (___ratelimit(&ext4_mount_msg_ratelimit, \"EXT4-fs mount\"))\n\t\text4_msg(sb, KERN_INFO, \"mounted filesystem with%s. \"\n\t\t\t \"Opts: %.*s%s%s\", descr,\n\t\t\t (int) sizeof(sbi->s_es->s_mount_opts),\n\t\t\t sbi->s_es->s_mount_opts,\n\t\t\t *sbi->s_es->s_mount_opts ? \"; \" : \"\", orig_data);\n\n\tif (es->s_error_count)\n\t\tmod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */\n\n\t/* Enable message ratelimiting. Default is 10 messages per 5 secs. */\n\tratelimit_state_init(&sbi->s_err_ratelimit_state, 5 * HZ, 10);\n\tratelimit_state_init(&sbi->s_warning_ratelimit_state, 5 * HZ, 10);\n\tratelimit_state_init(&sbi->s_msg_ratelimit_state, 5 * HZ, 10);\n\n\tkfree(orig_data);\n#ifdef CONFIG_EXT4_FS_ENCRYPTION\n\tmemcpy(sbi->key_prefix, EXT4_KEY_DESC_PREFIX,\n\t\t\t\tEXT4_KEY_DESC_PREFIX_SIZE);\n\tsbi->key_prefix_size = EXT4_KEY_DESC_PREFIX_SIZE;\n#endif\n\treturn 0;\n\ncantfind_ext4:\n\tif (!silent)\n\t\text4_msg(sb, KERN_ERR, \"VFS: Can't find ext4 filesystem\");\n\tgoto failed_mount;\n\n#ifdef CONFIG_QUOTA\nfailed_mount8:\n\text4_unregister_sysfs(sb);\n#endif\nfailed_mount7:\n\text4_unregister_li_request(sb);\nfailed_mount6:\n\text4_mb_release(sb);\n\tif (sbi->s_flex_groups)\n\t\tkvfree(sbi->s_flex_groups);\n\tpercpu_counter_destroy(&sbi->s_freeclusters_counter);\n\tpercpu_counter_destroy(&sbi->s_freeinodes_counter);\n\tpercpu_counter_destroy(&sbi->s_dirs_counter);\n\tpercpu_counter_destroy(&sbi->s_dirtyclusters_counter);\nfailed_mount5:\n\text4_ext_release(sb);\n\text4_release_system_zone(sb);\nfailed_mount4a:\n\tdput(sb->s_root);\n\tsb->s_root = NULL;\nfailed_mount4:\n\text4_msg(sb, KERN_ERR, \"mount failed\");\n\tif (EXT4_SB(sb)->rsv_conversion_wq)\n\t\tdestroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq);\nfailed_mount_wq:\n\tif (sbi->s_mb_cache) {\n\t\text4_xattr_destroy_cache(sbi->s_mb_cache);\n\t\tsbi->s_mb_cache = NULL;\n\t}\n\tif (sbi->s_journal) {\n\t\tjbd2_journal_destroy(sbi->s_journal);\n\t\tsbi->s_journal = NULL;\n\t}\nfailed_mount3a:\n\text4_es_unregister_shrinker(sbi);\nfailed_mount3:\n\tdel_timer_sync(&sbi->s_err_report);\n\tif (sbi->s_mmp_tsk)\n\t\tkthread_stop(sbi->s_mmp_tsk);\nfailed_mount2:\n\tfor (i = 0; i < db_count; i++)\n\t\tbrelse(sbi->s_group_desc[i]);\n\tkvfree(sbi->s_group_desc);\nfailed_mount:\n\tif (sbi->s_chksum_driver)\n\t\tcrypto_free_shash(sbi->s_chksum_driver);\n#ifdef CONFIG_QUOTA\n\tfor (i = 0; i < EXT4_MAXQUOTAS; i++)\n\t\tkfree(sbi->s_qf_names[i]);\n#endif\n\text4_blkdev_remove(sbi);\n\tbrelse(bh);\nout_fail:\n\tsb->s_fs_info = NULL;\n\tkfree(sbi->s_blockgroup_lock);\nout_free_base:\n\tkfree(sbi);\n\tkfree(orig_data);\n\treturn err ? err : ret;\n}","lang":"c","vul_type":"cwe-125","target_token_count":9110,"sven_meta":{"func_name":"ext4_fill_super","file_name":"fs/ext4/super.c","commit_link":"github.com/torvalds/linux/commit/3a4b77cd47bb837b8557595ec7425f281f2ca1fe","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#85-1d1708ec7c27","input":"static int mxf_parse_structural_metadata(MXFContext *mxf)\n{\n MXFPackage *material_package = NULL;\n int i, j, k, ret;\n\n av_log(mxf->fc, AV_LOG_TRACE, \"metadata sets count %d\\n\", mxf->metadata_sets_count);\n /* TODO: handle multiple material packages (OP3x) */\n for (i = 0; i < mxf->packages_count; i++) {\n material_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[i], MaterialPackage);\n if (material_package) break;\n }\n if (!material_package) {\n av_log(mxf->fc, AV_LOG_ERROR, \"no material package found\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n mxf_add_umid_metadata(&mxf->fc->metadata, \"material_package_umid\", material_package);\n if (material_package->name && material_package->name[0])\n av_dict_set(&mxf->fc->metadata, \"material_package_name\", material_package->name, 0);\n mxf_parse_package_comments(mxf, &mxf->fc->metadata, material_package);\n\n for (i = 0; i < material_package->tracks_count; i++) {\n MXFPackage *source_package = NULL;\n MXFTrack *material_track = NULL;\n MXFTrack *source_track = NULL;\n MXFTrack *temp_track = NULL;\n MXFDescriptor *descriptor = NULL;\n MXFStructuralComponent *component = NULL;\n MXFTimecodeComponent *mxf_tc = NULL;\n UID *essence_container_ul = NULL;\n const MXFCodecUL *codec_ul = NULL;\n const MXFCodecUL *container_ul = NULL;\n const MXFCodecUL *pix_fmt_ul = NULL;\n AVStream *st;\n AVTimecode tc;\n int flags;\n\n if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i], Track))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve material track strong ref\\n\");\n continue;\n }\n\n if ((component = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, TimecodeComponent))) {\n mxf_tc = (MXFTimecodeComponent*)component;\n flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;\n if (av_timecode_init(&tc, mxf_tc->rate, flags, mxf_tc->start_frame, mxf->fc) == 0) {\n mxf_add_timecode_metadata(&mxf->fc->metadata, \"timecode\", &tc);\n }\n }\n\n if (!(material_track->sequence = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, Sequence))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve material track sequence strong ref\\n\");\n continue;\n }\n\n for (j = 0; j < material_track->sequence->structural_components_count; j++) {\n component = mxf_resolve_strong_ref(mxf, &material_track->sequence->structural_components_refs[j], TimecodeComponent);\n if (!component)\n continue;\n\n mxf_tc = (MXFTimecodeComponent*)component;\n flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;\n if (av_timecode_init(&tc, mxf_tc->rate, flags, mxf_tc->start_frame, mxf->fc) == 0) {\n mxf_add_timecode_metadata(&mxf->fc->metadata, \"timecode\", &tc);\n break;\n }\n }\n\n /* TODO: handle multiple source clips, only finds first valid source clip */\n if(material_track->sequence->structural_components_count > 1)\n av_log(mxf->fc, AV_LOG_WARNING, \"material track %d: has %d components\\n\",\n material_track->track_id, material_track->sequence->structural_components_count);\n\n for (j = 0; j < material_track->sequence->structural_components_count; j++) {\n component = mxf_resolve_sourceclip(mxf, &material_track->sequence->structural_components_refs[j]);\n if (!component)\n continue;\n\n source_package = mxf_resolve_source_package(mxf, component->source_package_ul, component->source_package_uid);\n if (!source_package) {\n av_log(mxf->fc, AV_LOG_TRACE, \"material track %d: no corresponding source package found\\n\", material_track->track_id);\n continue;\n }\n for (k = 0; k < source_package->tracks_count; k++) {\n if (!(temp_track = mxf_resolve_strong_ref(mxf, &source_package->tracks_refs[k], Track))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve source track strong ref\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail_and_free;\n }\n if (temp_track->track_id == component->source_track_id) {\n source_track = temp_track;\n break;\n }\n }\n if (!source_track) {\n av_log(mxf->fc, AV_LOG_ERROR, \"material track %d: no corresponding source track found\\n\", material_track->track_id);\n break;\n }\n\n for (k = 0; k < mxf->essence_container_data_count; k++) {\n MXFEssenceContainerData *essence_data;\n\n if (!(essence_data = mxf_resolve_strong_ref(mxf, &mxf->essence_container_data_refs[k], EssenceContainerData))) {\n av_log(mxf, AV_LOG_TRACE, \"could not resolve essence container data strong ref\\n\");\n continue;\n }\n if (!memcmp(component->source_package_ul, essence_data->package_ul, sizeof(UID)) && !memcmp(component->source_package_uid, essence_data->package_uid, sizeof(UID))) {\n source_track->body_sid = essence_data->body_sid;\n source_track->index_sid = essence_data->index_sid;\n break;\n }\n }\n\n if(source_track && component)\n break;\n }\n if (!source_track || !component || !source_package) {\n if((ret = mxf_add_metadata_stream(mxf, material_track)))\n goto fail_and_free;\n continue;\n }\n\n if (!(source_track->sequence = mxf_resolve_strong_ref(mxf, &source_track->sequence_ref, Sequence))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve source track sequence strong ref\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail_and_free;\n }\n\n /* 0001GL00.MXF.A1.mxf_opatom.mxf has the same SourcePackageID as 0001GL.MXF.V1.mxf_opatom.mxf\n * This would result in both files appearing to have two streams. Work around this by sanity checking DataDefinition */\n if (memcmp(material_track->sequence->data_definition_ul, source_track->sequence->data_definition_ul, 16)) {\n av_log(mxf->fc, AV_LOG_ERROR, \"material track %d: DataDefinition mismatch\\n\", material_track->track_id);\n continue;\n }\n\n st = avformat_new_stream(mxf->fc, NULL);\n if (!st) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not allocate stream\\n\");\n ret = AVERROR(ENOMEM);\n goto fail_and_free;\n }\n st->id = material_track->track_id;\n st->priv_data = source_track;\n\n source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType);\n descriptor = mxf_resolve_multidescriptor(mxf, source_package->descriptor, source_track->track_id);\n\n /* A SourceClip from a EssenceGroup may only be a single frame of essence data. The clips duration is then how many\n * frames its suppose to repeat for. Descriptor->duration, if present, contains the real duration of the essence data */\n if (descriptor && descriptor->duration != AV_NOPTS_VALUE)\n source_track->original_duration = st->duration = FFMIN(descriptor->duration, component->duration);\n else\n source_track->original_duration = st->duration = component->duration;\n\n if (st->duration == -1)\n st->duration = AV_NOPTS_VALUE;\n st->start_time = component->start_position;\n if (material_track->edit_rate.num <= 0 ||\n material_track->edit_rate.den <= 0) {\n av_log(mxf->fc, AV_LOG_WARNING,\n \"Invalid edit rate (%d/%d) found on stream #%d, \"\n \"defaulting to 25/1\\n\",\n material_track->edit_rate.num,\n material_track->edit_rate.den, st->index);\n material_track->edit_rate = (AVRational){25, 1};\n }\n avpriv_set_pts_info(st, 64, material_track->edit_rate.den, material_track->edit_rate.num);\n\n /* ensure SourceTrack EditRate == MaterialTrack EditRate since only\n * the former is accessible via st->priv_data */\n source_track->edit_rate = material_track->edit_rate;\n\n PRINT_KEY(mxf->fc, \"data definition ul\", source_track->sequence->data_definition_ul);\n codec_ul = mxf_get_codec_ul(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul);\n st->codecpar->codec_type = codec_ul->id;\n\n if (!descriptor) {\n av_log(mxf->fc, AV_LOG_INFO, \"source track %d: stream %d, no descriptor found\\n\", source_track->track_id, st->index);\n continue;\n }\n PRINT_KEY(mxf->fc, \"essence codec ul\", descriptor->essence_codec_ul);\n PRINT_KEY(mxf->fc, \"essence container ul\", descriptor->essence_container_ul);\n essence_container_ul = &descriptor->essence_container_ul;\n source_track->wrapping = (mxf->op == OPAtom) ? ClipWrapped : mxf_get_wrapping_kind(essence_container_ul);\n if (source_track->wrapping == UnknownWrapped)\n av_log(mxf->fc, AV_LOG_INFO, \"wrapping of stream %d is unknown\\n\", st->index);\n /* HACK: replacing the original key with mxf_encrypted_essence_container\n * is not allowed according to s429-6, try to find correct information anyway */\n if (IS_KLV_KEY(essence_container_ul, mxf_encrypted_essence_container)) {\n av_log(mxf->fc, AV_LOG_INFO, \"broken encrypted mxf file\\n\");\n for (k = 0; k < mxf->metadata_sets_count; k++) {\n MXFMetadataSet *metadata = mxf->metadata_sets[k];\n if (metadata->type == CryptoContext) {\n essence_container_ul = &((MXFCryptoContext *)metadata)->source_container_ul;\n break;\n }\n }\n }\n\n /* TODO: drop PictureEssenceCoding and SoundEssenceCompression, only check EssenceContainer */\n codec_ul = mxf_get_codec_ul(ff_mxf_codec_uls, &descriptor->essence_codec_ul);\n st->codecpar->codec_id = (enum AVCodecID)codec_ul->id;\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE) {\n codec_ul = mxf_get_codec_ul(ff_mxf_codec_uls, &descriptor->codec_ul);\n st->codecpar->codec_id = (enum AVCodecID)codec_ul->id;\n }\n\n av_log(mxf->fc, AV_LOG_VERBOSE, \"%s: Universal Label: \",\n avcodec_get_name(st->codecpar->codec_id));\n for (k = 0; k < 16; k++) {\n av_log(mxf->fc, AV_LOG_VERBOSE, \"%.2x\",\n descriptor->essence_codec_ul[k]);\n if (!(k+1 & 19) || k == 5)\n av_log(mxf->fc, AV_LOG_VERBOSE, \".\");\n }\n av_log(mxf->fc, AV_LOG_VERBOSE, \"\\n\");\n\n mxf_add_umid_metadata(&st->metadata, \"file_package_umid\", source_package);\n if (source_package->name && source_package->name[0])\n av_dict_set(&st->metadata, \"file_package_name\", source_package->name, 0);\n if (material_track->name && material_track->name[0])\n av_dict_set(&st->metadata, \"track_name\", material_track->name, 0);\n\n mxf_parse_physical_source_package(mxf, source_track, st);\n\n if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {\n source_track->intra_only = mxf_is_intra_only(descriptor);\n container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, essence_container_ul);\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE)\n st->codecpar->codec_id = container_ul->id;\n st->codecpar->width = descriptor->width;\n st->codecpar->height = descriptor->height; /* Field height, not frame height */\n switch (descriptor->frame_layout) {\n case FullFrame:\n st->codecpar->field_order = AV_FIELD_PROGRESSIVE;\n break;\n case OneField:\n /* Every other line is stored and needs to be duplicated. */\n av_log(mxf->fc, AV_LOG_INFO, \"OneField frame layout isn't currently supported\\n\");\n break; /* The correct thing to do here is fall through, but by breaking we might be\n able to decode some streams at half the vertical resolution, rather than not al all.\n It's also for compatibility with the old behavior. */\n case MixedFields:\n break;\n case SegmentedFrame:\n st->codecpar->field_order = AV_FIELD_PROGRESSIVE;\n case SeparateFields:\n av_log(mxf->fc, AV_LOG_DEBUG, \"video_line_map: (%d, %d), field_dominance: %d\\n\",\n descriptor->video_line_map[0], descriptor->video_line_map[1],\n descriptor->field_dominance);\n if ((descriptor->video_line_map[0] > 0) && (descriptor->video_line_map[1] > 0)) {\n /* Detect coded field order from VideoLineMap:\n * (even, even) => bottom field coded first\n * (even, odd) => top field coded first\n * (odd, even) => top field coded first\n * (odd, odd) => bottom field coded first\n */\n if ((descriptor->video_line_map[0] + descriptor->video_line_map[1]) % 2) {\n switch (descriptor->field_dominance) {\n case MXF_FIELD_DOMINANCE_DEFAULT:\n case MXF_FIELD_DOMINANCE_FF:\n st->codecpar->field_order = AV_FIELD_TT;\n break;\n case MXF_FIELD_DOMINANCE_FL:\n st->codecpar->field_order = AV_FIELD_TB;\n break;\n default:\n avpriv_request_sample(mxf->fc,\n \"Field dominance %d support\",\n descriptor->field_dominance);\n }\n } else {\n switch (descriptor->field_dominance) {\n case MXF_FIELD_DOMINANCE_DEFAULT:\n case MXF_FIELD_DOMINANCE_FF:\n st->codecpar->field_order = AV_FIELD_BB;\n break;\n case MXF_FIELD_DOMINANCE_FL:\n st->codecpar->field_order = AV_FIELD_BT;\n break;\n default:\n avpriv_request_sample(mxf->fc,\n \"Field dominance %d support\",\n descriptor->field_dominance);\n }\n }\n }\n /* Turn field height into frame height. */\n st->codecpar->height *= 2;\n break;\n default:\n av_log(mxf->fc, AV_LOG_INFO, \"Unknown frame layout type: %d\\n\", descriptor->frame_layout);\n }\n if (st->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {\n st->codecpar->format = descriptor->pix_fmt;\n if (st->codecpar->format == AV_PIX_FMT_NONE) {\n pix_fmt_ul = mxf_get_codec_ul(ff_mxf_pixel_format_uls,\n &descriptor->essence_codec_ul);\n st->codecpar->format = (enum AVPixelFormat)pix_fmt_ul->id;\n if (st->codecpar->format== AV_PIX_FMT_NONE) {\n st->codecpar->codec_tag = mxf_get_codec_ul(ff_mxf_codec_tag_uls,\n &descriptor->essence_codec_ul)->id;\n if (!st->codecpar->codec_tag) {\n /* support files created before RP224v10 by defaulting to UYVY422\n if subsampling is 4:2:2 and component depth is 8-bit */\n if (descriptor->horiz_subsampling == 2 &&\n descriptor->vert_subsampling == 1 &&\n descriptor->component_depth == 8) {\n st->codecpar->format = AV_PIX_FMT_UYVY422;\n }\n }\n }\n }\n }\n st->need_parsing = AVSTREAM_PARSE_HEADERS;\n if (material_track->sequence->origin) {\n av_dict_set_int(&st->metadata, \"material_track_origin\", material_track->sequence->origin, 0);\n }\n if (source_track->sequence->origin) {\n av_dict_set_int(&st->metadata, \"source_track_origin\", source_track->sequence->origin, 0);\n }\n if (descriptor->aspect_ratio.num && descriptor->aspect_ratio.den)\n st->display_aspect_ratio = descriptor->aspect_ratio;\n } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {\n container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);\n /* Only overwrite existing codec ID if it is unset or A-law, which is the default according to SMPTE RP 224. */\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE || (st->codecpar->codec_id == AV_CODEC_ID_PCM_ALAW && (enum AVCodecID)container_ul->id != AV_CODEC_ID_NONE))\n st->codecpar->codec_id = (enum AVCodecID)container_ul->id;\n st->codecpar->channels = descriptor->channels;\n st->codecpar->bits_per_coded_sample = descriptor->bits_per_sample;\n\n if (descriptor->sample_rate.den > 0) {\n st->codecpar->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;\n avpriv_set_pts_info(st, 64, descriptor->sample_rate.den, descriptor->sample_rate.num);\n } else {\n av_log(mxf->fc, AV_LOG_WARNING, \"invalid sample rate (%d/%d) \"\n \"found for stream #%d, time base forced to 1/48000\\n\",\n descriptor->sample_rate.num, descriptor->sample_rate.den,\n st->index);\n avpriv_set_pts_info(st, 64, 1, 48000);\n }\n\n /* if duration is set, rescale it from EditRate to SampleRate */\n if (st->duration != AV_NOPTS_VALUE)\n st->duration = av_rescale_q(st->duration,\n av_inv_q(material_track->edit_rate),\n st->time_base);\n\n /* TODO: implement AV_CODEC_ID_RAWAUDIO */\n if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE) {\n if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;\n else if (descriptor->bits_per_sample == 32)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE;\n } else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) {\n if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S24BE;\n else if (descriptor->bits_per_sample == 32)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S32BE;\n } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) {\n st->need_parsing = AVSTREAM_PARSE_FULL;\n }\n } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {\n enum AVMediaType type;\n container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, essence_container_ul);\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE)\n st->codecpar->codec_id = container_ul->id;\n type = avcodec_get_type(st->codecpar->codec_id);\n if (type == AVMEDIA_TYPE_SUBTITLE)\n st->codecpar->codec_type = type;\n if (container_ul->desc)\n av_dict_set(&st->metadata, \"data_type\", container_ul->desc, 0);\n }\n if (descriptor->extradata) {\n if (!ff_alloc_extradata(st->codecpar, descriptor->extradata_size)) {\n memcpy(st->codecpar->extradata, descriptor->extradata, descriptor->extradata_size);\n }\n } else if (st->codecpar->codec_id == AV_CODEC_ID_H264) {\n int coded_width = mxf_get_codec_ul(mxf_intra_only_picture_coded_width,\n &descriptor->essence_codec_ul)->id;\n if (coded_width)\n st->codecpar->width = coded_width;\n ret = ff_generate_avci_extradata(st);\n if (ret < 0)\n return ret;\n }\n if (st->codecpar->codec_type != AVMEDIA_TYPE_DATA && source_track->wrapping != FrameWrapped) {\n /* TODO: decode timestamps */\n st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;\n }\n }\n\n ret = 0;\nfail_and_free:\n return ret;\n}","target":"static int mxf_parse_structural_metadata(MXFContext *mxf)\n{\n MXFPackage *material_package = NULL;\n int i, j, k, ret;\n\n av_log(mxf->fc, AV_LOG_TRACE, \"metadata sets count %d\\n\", mxf->metadata_sets_count);\n /* TODO: handle multiple material packages (OP3x) */\n for (i = 0; i < mxf->packages_count; i++) {\n material_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[i], MaterialPackage);\n if (material_package) break;\n }\n if (!material_package) {\n av_log(mxf->fc, AV_LOG_ERROR, \"no material package found\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n mxf_add_umid_metadata(&mxf->fc->metadata, \"material_package_umid\", material_package);\n if (material_package->name && material_package->name[0])\n av_dict_set(&mxf->fc->metadata, \"material_package_name\", material_package->name, 0);\n mxf_parse_package_comments(mxf, &mxf->fc->metadata, material_package);\n\n for (i = 0; i < material_package->tracks_count; i++) {\n MXFPackage *source_package = NULL;\n MXFTrack *material_track = NULL;\n MXFTrack *source_track = NULL;\n MXFTrack *temp_track = NULL;\n MXFDescriptor *descriptor = NULL;\n MXFStructuralComponent *component = NULL;\n MXFTimecodeComponent *mxf_tc = NULL;\n UID *essence_container_ul = NULL;\n const MXFCodecUL *codec_ul = NULL;\n const MXFCodecUL *container_ul = NULL;\n const MXFCodecUL *pix_fmt_ul = NULL;\n AVStream *st;\n AVTimecode tc;\n int flags;\n\n if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i], Track))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve material track strong ref\\n\");\n continue;\n }\n\n if ((component = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, TimecodeComponent))) {\n mxf_tc = (MXFTimecodeComponent*)component;\n flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;\n if (av_timecode_init(&tc, mxf_tc->rate, flags, mxf_tc->start_frame, mxf->fc) == 0) {\n mxf_add_timecode_metadata(&mxf->fc->metadata, \"timecode\", &tc);\n }\n }\n\n if (!(material_track->sequence = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, Sequence))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve material track sequence strong ref\\n\");\n continue;\n }\n\n for (j = 0; j < material_track->sequence->structural_components_count; j++) {\n component = mxf_resolve_strong_ref(mxf, &material_track->sequence->structural_components_refs[j], TimecodeComponent);\n if (!component)\n continue;\n\n mxf_tc = (MXFTimecodeComponent*)component;\n flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;\n if (av_timecode_init(&tc, mxf_tc->rate, flags, mxf_tc->start_frame, mxf->fc) == 0) {\n mxf_add_timecode_metadata(&mxf->fc->metadata, \"timecode\", &tc);\n break;\n }\n }\n\n /* TODO: handle multiple source clips, only finds first valid source clip */\n if(material_track->sequence->structural_components_count > 1)\n av_log(mxf->fc, AV_LOG_WARNING, \"material track %d: has %d components\\n\",\n material_track->track_id, material_track->sequence->structural_components_count);\n\n for (j = 0; j < material_track->sequence->structural_components_count; j++) {\n component = mxf_resolve_sourceclip(mxf, &material_track->sequence->structural_components_refs[j]);\n if (!component)\n continue;\n\n source_package = mxf_resolve_source_package(mxf, component->source_package_ul, component->source_package_uid);\n if (!source_package) {\n av_log(mxf->fc, AV_LOG_TRACE, \"material track %d: no corresponding source package found\\n\", material_track->track_id);\n continue;\n }\n for (k = 0; k < source_package->tracks_count; k++) {\n if (!(temp_track = mxf_resolve_strong_ref(mxf, &source_package->tracks_refs[k], Track))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve source track strong ref\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail_and_free;\n }\n if (temp_track->track_id == component->source_track_id) {\n source_track = temp_track;\n break;\n }\n }\n if (!source_track) {\n av_log(mxf->fc, AV_LOG_ERROR, \"material track %d: no corresponding source track found\\n\", material_track->track_id);\n break;\n }\n\n for (k = 0; k < mxf->essence_container_data_count; k++) {\n MXFEssenceContainerData *essence_data;\n\n if (!(essence_data = mxf_resolve_strong_ref(mxf, &mxf->essence_container_data_refs[k], EssenceContainerData))) {\n av_log(mxf->fc, AV_LOG_TRACE, \"could not resolve essence container data strong ref\\n\");\n continue;\n }\n if (!memcmp(component->source_package_ul, essence_data->package_ul, sizeof(UID)) && !memcmp(component->source_package_uid, essence_data->package_uid, sizeof(UID))) {\n source_track->body_sid = essence_data->body_sid;\n source_track->index_sid = essence_data->index_sid;\n break;\n }\n }\n\n if(source_track && component)\n break;\n }\n if (!source_track || !component || !source_package) {\n if((ret = mxf_add_metadata_stream(mxf, material_track)))\n goto fail_and_free;\n continue;\n }\n\n if (!(source_track->sequence = mxf_resolve_strong_ref(mxf, &source_track->sequence_ref, Sequence))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve source track sequence strong ref\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail_and_free;\n }\n\n /* 0001GL00.MXF.A1.mxf_opatom.mxf has the same SourcePackageID as 0001GL.MXF.V1.mxf_opatom.mxf\n * This would result in both files appearing to have two streams. Work around this by sanity checking DataDefinition */\n if (memcmp(material_track->sequence->data_definition_ul, source_track->sequence->data_definition_ul, 16)) {\n av_log(mxf->fc, AV_LOG_ERROR, \"material track %d: DataDefinition mismatch\\n\", material_track->track_id);\n continue;\n }\n\n st = avformat_new_stream(mxf->fc, NULL);\n if (!st) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not allocate stream\\n\");\n ret = AVERROR(ENOMEM);\n goto fail_and_free;\n }\n st->id = material_track->track_id;\n st->priv_data = source_track;\n\n source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType);\n descriptor = mxf_resolve_multidescriptor(mxf, source_package->descriptor, source_track->track_id);\n\n /* A SourceClip from a EssenceGroup may only be a single frame of essence data. The clips duration is then how many\n * frames its suppose to repeat for. Descriptor->duration, if present, contains the real duration of the essence data */\n if (descriptor && descriptor->duration != AV_NOPTS_VALUE)\n source_track->original_duration = st->duration = FFMIN(descriptor->duration, component->duration);\n else\n source_track->original_duration = st->duration = component->duration;\n\n if (st->duration == -1)\n st->duration = AV_NOPTS_VALUE;\n st->start_time = component->start_position;\n if (material_track->edit_rate.num <= 0 ||\n material_track->edit_rate.den <= 0) {\n av_log(mxf->fc, AV_LOG_WARNING,\n \"Invalid edit rate (%d/%d) found on stream #%d, \"\n \"defaulting to 25/1\\n\",\n material_track->edit_rate.num,\n material_track->edit_rate.den, st->index);\n material_track->edit_rate = (AVRational){25, 1};\n }\n avpriv_set_pts_info(st, 64, material_track->edit_rate.den, material_track->edit_rate.num);\n\n /* ensure SourceTrack EditRate == MaterialTrack EditRate since only\n * the former is accessible via st->priv_data */\n source_track->edit_rate = material_track->edit_rate;\n\n PRINT_KEY(mxf->fc, \"data definition ul\", source_track->sequence->data_definition_ul);\n codec_ul = mxf_get_codec_ul(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul);\n st->codecpar->codec_type = codec_ul->id;\n\n if (!descriptor) {\n av_log(mxf->fc, AV_LOG_INFO, \"source track %d: stream %d, no descriptor found\\n\", source_track->track_id, st->index);\n continue;\n }\n PRINT_KEY(mxf->fc, \"essence codec ul\", descriptor->essence_codec_ul);\n PRINT_KEY(mxf->fc, \"essence container ul\", descriptor->essence_container_ul);\n essence_container_ul = &descriptor->essence_container_ul;\n source_track->wrapping = (mxf->op == OPAtom) ? ClipWrapped : mxf_get_wrapping_kind(essence_container_ul);\n if (source_track->wrapping == UnknownWrapped)\n av_log(mxf->fc, AV_LOG_INFO, \"wrapping of stream %d is unknown\\n\", st->index);\n /* HACK: replacing the original key with mxf_encrypted_essence_container\n * is not allowed according to s429-6, try to find correct information anyway */\n if (IS_KLV_KEY(essence_container_ul, mxf_encrypted_essence_container)) {\n av_log(mxf->fc, AV_LOG_INFO, \"broken encrypted mxf file\\n\");\n for (k = 0; k < mxf->metadata_sets_count; k++) {\n MXFMetadataSet *metadata = mxf->metadata_sets[k];\n if (metadata->type == CryptoContext) {\n essence_container_ul = &((MXFCryptoContext *)metadata)->source_container_ul;\n break;\n }\n }\n }\n\n /* TODO: drop PictureEssenceCoding and SoundEssenceCompression, only check EssenceContainer */\n codec_ul = mxf_get_codec_ul(ff_mxf_codec_uls, &descriptor->essence_codec_ul);\n st->codecpar->codec_id = (enum AVCodecID)codec_ul->id;\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE) {\n codec_ul = mxf_get_codec_ul(ff_mxf_codec_uls, &descriptor->codec_ul);\n st->codecpar->codec_id = (enum AVCodecID)codec_ul->id;\n }\n\n av_log(mxf->fc, AV_LOG_VERBOSE, \"%s: Universal Label: \",\n avcodec_get_name(st->codecpar->codec_id));\n for (k = 0; k < 16; k++) {\n av_log(mxf->fc, AV_LOG_VERBOSE, \"%.2x\",\n descriptor->essence_codec_ul[k]);\n if (!(k+1 & 19) || k == 5)\n av_log(mxf->fc, AV_LOG_VERBOSE, \".\");\n }\n av_log(mxf->fc, AV_LOG_VERBOSE, \"\\n\");\n\n mxf_add_umid_metadata(&st->metadata, \"file_package_umid\", source_package);\n if (source_package->name && source_package->name[0])\n av_dict_set(&st->metadata, \"file_package_name\", source_package->name, 0);\n if (material_track->name && material_track->name[0])\n av_dict_set(&st->metadata, \"track_name\", material_track->name, 0);\n\n mxf_parse_physical_source_package(mxf, source_track, st);\n\n if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {\n source_track->intra_only = mxf_is_intra_only(descriptor);\n container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, essence_container_ul);\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE)\n st->codecpar->codec_id = container_ul->id;\n st->codecpar->width = descriptor->width;\n st->codecpar->height = descriptor->height; /* Field height, not frame height */\n switch (descriptor->frame_layout) {\n case FullFrame:\n st->codecpar->field_order = AV_FIELD_PROGRESSIVE;\n break;\n case OneField:\n /* Every other line is stored and needs to be duplicated. */\n av_log(mxf->fc, AV_LOG_INFO, \"OneField frame layout isn't currently supported\\n\");\n break; /* The correct thing to do here is fall through, but by breaking we might be\n able to decode some streams at half the vertical resolution, rather than not al all.\n It's also for compatibility with the old behavior. */\n case MixedFields:\n break;\n case SegmentedFrame:\n st->codecpar->field_order = AV_FIELD_PROGRESSIVE;\n case SeparateFields:\n av_log(mxf->fc, AV_LOG_DEBUG, \"video_line_map: (%d, %d), field_dominance: %d\\n\",\n descriptor->video_line_map[0], descriptor->video_line_map[1],\n descriptor->field_dominance);\n if ((descriptor->video_line_map[0] > 0) && (descriptor->video_line_map[1] > 0)) {\n /* Detect coded field order from VideoLineMap:\n * (even, even) => bottom field coded first\n * (even, odd) => top field coded first\n * (odd, even) => top field coded first\n * (odd, odd) => bottom field coded first\n */\n if ((descriptor->video_line_map[0] + descriptor->video_line_map[1]) % 2) {\n switch (descriptor->field_dominance) {\n case MXF_FIELD_DOMINANCE_DEFAULT:\n case MXF_FIELD_DOMINANCE_FF:\n st->codecpar->field_order = AV_FIELD_TT;\n break;\n case MXF_FIELD_DOMINANCE_FL:\n st->codecpar->field_order = AV_FIELD_TB;\n break;\n default:\n avpriv_request_sample(mxf->fc,\n \"Field dominance %d support\",\n descriptor->field_dominance);\n }\n } else {\n switch (descriptor->field_dominance) {\n case MXF_FIELD_DOMINANCE_DEFAULT:\n case MXF_FIELD_DOMINANCE_FF:\n st->codecpar->field_order = AV_FIELD_BB;\n break;\n case MXF_FIELD_DOMINANCE_FL:\n st->codecpar->field_order = AV_FIELD_BT;\n break;\n default:\n avpriv_request_sample(mxf->fc,\n \"Field dominance %d support\",\n descriptor->field_dominance);\n }\n }\n }\n /* Turn field height into frame height. */\n st->codecpar->height *= 2;\n break;\n default:\n av_log(mxf->fc, AV_LOG_INFO, \"Unknown frame layout type: %d\\n\", descriptor->frame_layout);\n }\n if (st->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {\n st->codecpar->format = descriptor->pix_fmt;\n if (st->codecpar->format == AV_PIX_FMT_NONE) {\n pix_fmt_ul = mxf_get_codec_ul(ff_mxf_pixel_format_uls,\n &descriptor->essence_codec_ul);\n st->codecpar->format = (enum AVPixelFormat)pix_fmt_ul->id;\n if (st->codecpar->format== AV_PIX_FMT_NONE) {\n st->codecpar->codec_tag = mxf_get_codec_ul(ff_mxf_codec_tag_uls,\n &descriptor->essence_codec_ul)->id;\n if (!st->codecpar->codec_tag) {\n /* support files created before RP224v10 by defaulting to UYVY422\n if subsampling is 4:2:2 and component depth is 8-bit */\n if (descriptor->horiz_subsampling == 2 &&\n descriptor->vert_subsampling == 1 &&\n descriptor->component_depth == 8) {\n st->codecpar->format = AV_PIX_FMT_UYVY422;\n }\n }\n }\n }\n }\n st->need_parsing = AVSTREAM_PARSE_HEADERS;\n if (material_track->sequence->origin) {\n av_dict_set_int(&st->metadata, \"material_track_origin\", material_track->sequence->origin, 0);\n }\n if (source_track->sequence->origin) {\n av_dict_set_int(&st->metadata, \"source_track_origin\", source_track->sequence->origin, 0);\n }\n if (descriptor->aspect_ratio.num && descriptor->aspect_ratio.den)\n st->display_aspect_ratio = descriptor->aspect_ratio;\n } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {\n container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);\n /* Only overwrite existing codec ID if it is unset or A-law, which is the default according to SMPTE RP 224. */\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE || (st->codecpar->codec_id == AV_CODEC_ID_PCM_ALAW && (enum AVCodecID)container_ul->id != AV_CODEC_ID_NONE))\n st->codecpar->codec_id = (enum AVCodecID)container_ul->id;\n st->codecpar->channels = descriptor->channels;\n st->codecpar->bits_per_coded_sample = descriptor->bits_per_sample;\n\n if (descriptor->sample_rate.den > 0) {\n st->codecpar->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;\n avpriv_set_pts_info(st, 64, descriptor->sample_rate.den, descriptor->sample_rate.num);\n } else {\n av_log(mxf->fc, AV_LOG_WARNING, \"invalid sample rate (%d/%d) \"\n \"found for stream #%d, time base forced to 1/48000\\n\",\n descriptor->sample_rate.num, descriptor->sample_rate.den,\n st->index);\n avpriv_set_pts_info(st, 64, 1, 48000);\n }\n\n /* if duration is set, rescale it from EditRate to SampleRate */\n if (st->duration != AV_NOPTS_VALUE)\n st->duration = av_rescale_q(st->duration,\n av_inv_q(material_track->edit_rate),\n st->time_base);\n\n /* TODO: implement AV_CODEC_ID_RAWAUDIO */\n if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE) {\n if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;\n else if (descriptor->bits_per_sample == 32)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE;\n } else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) {\n if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S24BE;\n else if (descriptor->bits_per_sample == 32)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S32BE;\n } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) {\n st->need_parsing = AVSTREAM_PARSE_FULL;\n }\n } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {\n enum AVMediaType type;\n container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, essence_container_ul);\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE)\n st->codecpar->codec_id = container_ul->id;\n type = avcodec_get_type(st->codecpar->codec_id);\n if (type == AVMEDIA_TYPE_SUBTITLE)\n st->codecpar->codec_type = type;\n if (container_ul->desc)\n av_dict_set(&st->metadata, \"data_type\", container_ul->desc, 0);\n }\n if (descriptor->extradata) {\n if (!ff_alloc_extradata(st->codecpar, descriptor->extradata_size)) {\n memcpy(st->codecpar->extradata, descriptor->extradata, descriptor->extradata_size);\n }\n } else if (st->codecpar->codec_id == AV_CODEC_ID_H264) {\n int coded_width = mxf_get_codec_ul(mxf_intra_only_picture_coded_width,\n &descriptor->essence_codec_ul)->id;\n if (coded_width)\n st->codecpar->width = coded_width;\n ret = ff_generate_avci_extradata(st);\n if (ret < 0)\n return ret;\n }\n if (st->codecpar->codec_type != AVMEDIA_TYPE_DATA && source_track->wrapping != FrameWrapped) {\n /* TODO: decode timestamps */\n st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;\n }\n }\n\n ret = 0;\nfail_and_free:\n return ret;\n}","lang":"c","vul_type":"cwe-125","target_token_count":4819,"sven_meta":{"func_name":"mxf_parse_structural_metadata","file_name":"libavformat/mxfdec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/bab0716c7f4793ec42e05a5aa7e80d82a0dd4e75","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#86-eee50e7d1b77","input":"static void parse_hid_report_descriptor(struct gtco *device, char * report,\n\t\t\t\t\tint length)\n{\n\tstruct device *ddev = &device->intf->dev;\n\tint x, i = 0;\n\n\t/* Tag primitive vars */\n\t__u8 prefix;\n\t__u8 size;\n\t__u8 tag;\n\t__u8 type;\n\t__u8 data = 0;\n\t__u16 data16 = 0;\n\t__u32 data32 = 0;\n\n\t/* For parsing logic */\n\tint inputnum = 0;\n\t__u32 usage = 0;\n\n\t/* Global Values, indexed by TAG */\n\t__u32 globalval[TAG_GLOB_MAX];\n\t__u32 oldval[TAG_GLOB_MAX];\n\n\t/* Debug stuff */\n\tchar maintype = 'x';\n\tchar globtype[12];\n\tint indent = 0;\n\tchar indentstr[10] = \"\";\n\n\n\tdev_dbg(ddev, \"======>>>>>>PARSE<<<<<<======\\n\");\n\n\t/* Walk this report and pull out the info we need */\n\twhile (i < length) {\n\t\tprefix = report[i];\n\n\t\t/* Skip over prefix */\n\t\ti++;\n\n\t\t/* Determine data size and save the data in the proper variable */\n\t\tsize = PREF_SIZE(prefix);\n\t\tswitch (size) {\n\t\tcase 1:\n\t\t\tdata = report[i];\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tdata16 = get_unaligned_le16(&report[i]);\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tsize = 4;\n\t\t\tdata32 = get_unaligned_le32(&report[i]);\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Skip size of data */\n\t\ti += size;\n\n\t\t/* What we do depends on the tag type */\n\t\ttag = PREF_TAG(prefix);\n\t\ttype = PREF_TYPE(prefix);\n\t\tswitch (type) {\n\t\tcase TYPE_MAIN:\n\t\t\tstrcpy(globtype, \"\");\n\t\t\tswitch (tag) {\n\n\t\t\tcase TAG_MAIN_INPUT:\n\t\t\t\t/*\n\t\t\t\t * The INPUT MAIN tag signifies this is\n\t\t\t\t * information from a report. We need to\n\t\t\t\t * figure out what it is and store the\n\t\t\t\t * min/max values\n\t\t\t\t */\n\n\t\t\t\tmaintype = 'I';\n\t\t\t\tif (data == 2)\n\t\t\t\t\tstrcpy(globtype, \"Variable\");\n\t\t\t\telse if (data == 3)\n\t\t\t\t\tstrcpy(globtype, \"Var|Const\");\n\n\t\t\t\tdev_dbg(ddev, \"::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits\\n\",\n\t\t\t\t\tglobalval[TAG_GLOB_REPORT_ID], inputnum,\n\t\t\t\t\tglobalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX],\n\t\t\t\t\tglobalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN],\n\t\t\t\t\tglobalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]);\n\n\n\t\t\t\t/*\n\t\t\t\t We can assume that the first two input items\n\t\t\t\t are always the X and Y coordinates. After\n\t\t\t\t that, we look for everything else by\n\t\t\t\t local usage value\n\t\t\t\t */\n\t\t\t\tswitch (inputnum) {\n\t\t\t\tcase 0: /* X coord */\n\t\t\t\t\tdev_dbg(ddev, \"GER: X Usage: 0x%x\\n\", usage);\n\t\t\t\t\tif (device->max_X == 0) {\n\t\t\t\t\t\tdevice->max_X = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\tdevice->min_X = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 1: /* Y coord */\n\t\t\t\t\tdev_dbg(ddev, \"GER: Y Usage: 0x%x\\n\", usage);\n\t\t\t\t\tif (device->max_Y == 0) {\n\t\t\t\t\t\tdevice->max_Y = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\tdevice->min_Y = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\t/* Tilt X */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TILT_X) {\n\t\t\t\t\t\tif (device->maxtilt_X == 0) {\n\t\t\t\t\t\t\tdevice->maxtilt_X = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->mintilt_X = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Tilt Y */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TILT_Y) {\n\t\t\t\t\t\tif (device->maxtilt_Y == 0) {\n\t\t\t\t\t\t\tdevice->maxtilt_Y = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->mintilt_Y = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Pressure */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TIP_PRESSURE) {\n\t\t\t\t\t\tif (device->maxpressure == 0) {\n\t\t\t\t\t\t\tdevice->maxpressure = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->minpressure = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tinputnum++;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_OUTPUT:\n\t\t\t\tmaintype = 'O';\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_FEATURE:\n\t\t\t\tmaintype = 'F';\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_COL_START:\n\t\t\t\tmaintype = 'S';\n\n\t\t\t\tif (data == 0) {\n\t\t\t\t\tdev_dbg(ddev, \"======>>>>>> Physical\\n\");\n\t\t\t\t\tstrcpy(globtype, \"Physical\");\n\t\t\t\t} else\n\t\t\t\t\tdev_dbg(ddev, \"======>>>>>>\\n\");\n\n\t\t\t\t/* Indent the debug output */\n\t\t\t\tindent++;\n\t\t\t\tfor (x = 0; x < indent; x++)\n\t\t\t\t\tindentstr[x] = '-';\n\t\t\t\tindentstr[x] = 0;\n\n\t\t\t\t/* Save global tags */\n\t\t\t\tfor (x = 0; x < TAG_GLOB_MAX; x++)\n\t\t\t\t\toldval[x] = globalval[x];\n\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_COL_END:\n\t\t\t\tdev_dbg(ddev, \"<<<<<<======\\n\");\n\t\t\t\tmaintype = 'E';\n\t\t\t\tindent--;\n\t\t\t\tfor (x = 0; x < indent; x++)\n\t\t\t\t\tindentstr[x] = '-';\n\t\t\t\tindentstr[x] = 0;\n\n\t\t\t\t/* Copy global tags back */\n\t\t\t\tfor (x = 0; x < TAG_GLOB_MAX; x++)\n\t\t\t\t\tglobalval[x] = oldval[x];\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data);\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data16);\n\t\t\t\tbreak;\n\n\t\t\tcase 4:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data32);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase TYPE_GLOBAL:\n\t\t\tswitch (tag) {\n\t\t\tcase TAG_GLOB_USAGE:\n\t\t\t\t/*\n\t\t\t\t * First time we hit the global usage tag,\n\t\t\t\t * it should tell us the type of device\n\t\t\t\t */\n\t\t\t\tif (device->usage == 0)\n\t\t\t\t\tdevice->usage = data;\n\n\t\t\t\tstrcpy(globtype, \"USAGE\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MIN:\n\t\t\t\tstrcpy(globtype, \"LOG_MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MAX:\n\t\t\t\tstrcpy(globtype, \"LOG_MAX\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PHYS_MIN:\n\t\t\t\tstrcpy(globtype, \"PHYS_MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PHYS_MAX:\n\t\t\t\tstrcpy(globtype, \"PHYS_MAX\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_UNIT_EXP:\n\t\t\t\tstrcpy(globtype, \"EXP\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_UNIT:\n\t\t\t\tstrcpy(globtype, \"UNIT\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_SZ:\n\t\t\t\tstrcpy(globtype, \"REPORT_SZ\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_ID:\n\t\t\t\tstrcpy(globtype, \"REPORT_ID\");\n\t\t\t\t/* New report, restart numbering */\n\t\t\t\tinputnum = 0;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_CNT:\n\t\t\t\tstrcpy(globtype, \"REPORT_CNT\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PUSH:\n\t\t\t\tstrcpy(globtype, \"PUSH\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_POP:\n\t\t\t\tstrcpy(globtype, \"POP\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t/* Check to make sure we have a good tag number\n\t\t\t so we don't overflow array */\n\t\t\tif (tag < TAG_GLOB_MAX) {\n\t\t\t\tswitch (size) {\n\t\t\t\tcase 1:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data);\n\t\t\t\t\tglobalval[tag] = data;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data16);\n\t\t\t\t\tglobalval[tag] = data16;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 4:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data32);\n\t\t\t\t\tglobalval[tag] = data32;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d\\n\",\n\t\t\t\t\tindentstr, tag, size);\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase TYPE_LOCAL:\n\t\t\tswitch (tag) {\n\t\t\tcase TAG_GLOB_USAGE:\n\t\t\t\tstrcpy(globtype, \"USAGE\");\n\t\t\t\t/* Always 1 byte */\n\t\t\t\tusage = data;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MIN:\n\t\t\t\tstrcpy(globtype, \"MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MAX:\n\t\t\t\tstrcpy(globtype, \"MAX\");\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tstrcpy(globtype, \"UNKNOWN\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data);\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data16);\n\t\t\t\tbreak;\n\n\t\t\tcase 4:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data32);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\t}\n}","target":"static void parse_hid_report_descriptor(struct gtco *device, char * report,\n\t\t\t\t\tint length)\n{\n\tstruct device *ddev = &device->intf->dev;\n\tint x, i = 0;\n\n\t/* Tag primitive vars */\n\t__u8 prefix;\n\t__u8 size;\n\t__u8 tag;\n\t__u8 type;\n\t__u8 data = 0;\n\t__u16 data16 = 0;\n\t__u32 data32 = 0;\n\n\t/* For parsing logic */\n\tint inputnum = 0;\n\t__u32 usage = 0;\n\n\t/* Global Values, indexed by TAG */\n\t__u32 globalval[TAG_GLOB_MAX];\n\t__u32 oldval[TAG_GLOB_MAX];\n\n\t/* Debug stuff */\n\tchar maintype = 'x';\n\tchar globtype[12];\n\tint indent = 0;\n\tchar indentstr[10] = \"\";\n\n\n\tdev_dbg(ddev, \"======>>>>>>PARSE<<<<<<======\\n\");\n\n\t/* Walk this report and pull out the info we need */\n\twhile (i < length) {\n\t\tprefix = report[i++];\n\n\t\t/* Determine data size and save the data in the proper variable */\n\t\tsize = (1U << PREF_SIZE(prefix)) >> 1;\n\t\tif (i + size > length) {\n\t\t\tdev_err(ddev,\n\t\t\t\t\"Not enough data (need %d, have %d)\\n\",\n\t\t\t\ti + size, length);\n\t\t\tbreak;\n\t\t}\n\n\t\tswitch (size) {\n\t\tcase 1:\n\t\t\tdata = report[i];\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tdata16 = get_unaligned_le16(&report[i]);\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tdata32 = get_unaligned_le32(&report[i]);\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Skip size of data */\n\t\ti += size;\n\n\t\t/* What we do depends on the tag type */\n\t\ttag = PREF_TAG(prefix);\n\t\ttype = PREF_TYPE(prefix);\n\t\tswitch (type) {\n\t\tcase TYPE_MAIN:\n\t\t\tstrcpy(globtype, \"\");\n\t\t\tswitch (tag) {\n\n\t\t\tcase TAG_MAIN_INPUT:\n\t\t\t\t/*\n\t\t\t\t * The INPUT MAIN tag signifies this is\n\t\t\t\t * information from a report. We need to\n\t\t\t\t * figure out what it is and store the\n\t\t\t\t * min/max values\n\t\t\t\t */\n\n\t\t\t\tmaintype = 'I';\n\t\t\t\tif (data == 2)\n\t\t\t\t\tstrcpy(globtype, \"Variable\");\n\t\t\t\telse if (data == 3)\n\t\t\t\t\tstrcpy(globtype, \"Var|Const\");\n\n\t\t\t\tdev_dbg(ddev, \"::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits\\n\",\n\t\t\t\t\tglobalval[TAG_GLOB_REPORT_ID], inputnum,\n\t\t\t\t\tglobalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX],\n\t\t\t\t\tglobalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN],\n\t\t\t\t\tglobalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]);\n\n\n\t\t\t\t/*\n\t\t\t\t We can assume that the first two input items\n\t\t\t\t are always the X and Y coordinates. After\n\t\t\t\t that, we look for everything else by\n\t\t\t\t local usage value\n\t\t\t\t */\n\t\t\t\tswitch (inputnum) {\n\t\t\t\tcase 0: /* X coord */\n\t\t\t\t\tdev_dbg(ddev, \"GER: X Usage: 0x%x\\n\", usage);\n\t\t\t\t\tif (device->max_X == 0) {\n\t\t\t\t\t\tdevice->max_X = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\tdevice->min_X = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 1: /* Y coord */\n\t\t\t\t\tdev_dbg(ddev, \"GER: Y Usage: 0x%x\\n\", usage);\n\t\t\t\t\tif (device->max_Y == 0) {\n\t\t\t\t\t\tdevice->max_Y = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\tdevice->min_Y = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\t/* Tilt X */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TILT_X) {\n\t\t\t\t\t\tif (device->maxtilt_X == 0) {\n\t\t\t\t\t\t\tdevice->maxtilt_X = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->mintilt_X = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Tilt Y */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TILT_Y) {\n\t\t\t\t\t\tif (device->maxtilt_Y == 0) {\n\t\t\t\t\t\t\tdevice->maxtilt_Y = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->mintilt_Y = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Pressure */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TIP_PRESSURE) {\n\t\t\t\t\t\tif (device->maxpressure == 0) {\n\t\t\t\t\t\t\tdevice->maxpressure = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->minpressure = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tinputnum++;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_OUTPUT:\n\t\t\t\tmaintype = 'O';\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_FEATURE:\n\t\t\t\tmaintype = 'F';\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_COL_START:\n\t\t\t\tmaintype = 'S';\n\n\t\t\t\tif (data == 0) {\n\t\t\t\t\tdev_dbg(ddev, \"======>>>>>> Physical\\n\");\n\t\t\t\t\tstrcpy(globtype, \"Physical\");\n\t\t\t\t} else\n\t\t\t\t\tdev_dbg(ddev, \"======>>>>>>\\n\");\n\n\t\t\t\t/* Indent the debug output */\n\t\t\t\tindent++;\n\t\t\t\tfor (x = 0; x < indent; x++)\n\t\t\t\t\tindentstr[x] = '-';\n\t\t\t\tindentstr[x] = 0;\n\n\t\t\t\t/* Save global tags */\n\t\t\t\tfor (x = 0; x < TAG_GLOB_MAX; x++)\n\t\t\t\t\toldval[x] = globalval[x];\n\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_COL_END:\n\t\t\t\tdev_dbg(ddev, \"<<<<<<======\\n\");\n\t\t\t\tmaintype = 'E';\n\t\t\t\tindent--;\n\t\t\t\tfor (x = 0; x < indent; x++)\n\t\t\t\t\tindentstr[x] = '-';\n\t\t\t\tindentstr[x] = 0;\n\n\t\t\t\t/* Copy global tags back */\n\t\t\t\tfor (x = 0; x < TAG_GLOB_MAX; x++)\n\t\t\t\t\tglobalval[x] = oldval[x];\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data);\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data16);\n\t\t\t\tbreak;\n\n\t\t\tcase 4:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data32);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase TYPE_GLOBAL:\n\t\t\tswitch (tag) {\n\t\t\tcase TAG_GLOB_USAGE:\n\t\t\t\t/*\n\t\t\t\t * First time we hit the global usage tag,\n\t\t\t\t * it should tell us the type of device\n\t\t\t\t */\n\t\t\t\tif (device->usage == 0)\n\t\t\t\t\tdevice->usage = data;\n\n\t\t\t\tstrcpy(globtype, \"USAGE\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MIN:\n\t\t\t\tstrcpy(globtype, \"LOG_MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MAX:\n\t\t\t\tstrcpy(globtype, \"LOG_MAX\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PHYS_MIN:\n\t\t\t\tstrcpy(globtype, \"PHYS_MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PHYS_MAX:\n\t\t\t\tstrcpy(globtype, \"PHYS_MAX\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_UNIT_EXP:\n\t\t\t\tstrcpy(globtype, \"EXP\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_UNIT:\n\t\t\t\tstrcpy(globtype, \"UNIT\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_SZ:\n\t\t\t\tstrcpy(globtype, \"REPORT_SZ\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_ID:\n\t\t\t\tstrcpy(globtype, \"REPORT_ID\");\n\t\t\t\t/* New report, restart numbering */\n\t\t\t\tinputnum = 0;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_CNT:\n\t\t\t\tstrcpy(globtype, \"REPORT_CNT\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PUSH:\n\t\t\t\tstrcpy(globtype, \"PUSH\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_POP:\n\t\t\t\tstrcpy(globtype, \"POP\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t/* Check to make sure we have a good tag number\n\t\t\t so we don't overflow array */\n\t\t\tif (tag < TAG_GLOB_MAX) {\n\t\t\t\tswitch (size) {\n\t\t\t\tcase 1:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data);\n\t\t\t\t\tglobalval[tag] = data;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data16);\n\t\t\t\t\tglobalval[tag] = data16;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 4:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data32);\n\t\t\t\t\tglobalval[tag] = data32;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d\\n\",\n\t\t\t\t\tindentstr, tag, size);\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase TYPE_LOCAL:\n\t\t\tswitch (tag) {\n\t\t\tcase TAG_GLOB_USAGE:\n\t\t\t\tstrcpy(globtype, \"USAGE\");\n\t\t\t\t/* Always 1 byte */\n\t\t\t\tusage = data;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MIN:\n\t\t\t\tstrcpy(globtype, \"MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MAX:\n\t\t\t\tstrcpy(globtype, \"MAX\");\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tstrcpy(globtype, \"UNKNOWN\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data);\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data16);\n\t\t\t\tbreak;\n\n\t\t\tcase 4:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data32);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\t}\n}","lang":"c","vul_type":"cwe-125","target_token_count":2435,"sven_meta":{"func_name":"parse_hid_report_descriptor","file_name":"drivers/input/tablet/gtco.c","commit_link":"github.com/torvalds/linux/commit/a50829479f58416a013a4ccca791336af3c584c7","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#87-a7241e3007d3","input":"int fpm_log_write(char *log_format) /* {{{ */\n{\n\tchar *s, *b;\n\tchar buffer[FPM_LOG_BUFFER+1];\n\tint token, test;\n\tsize_t len, len2;\n\tstruct fpm_scoreboard_proc_s proc, *proc_p;\n\tstruct fpm_scoreboard_s *scoreboard;\n\tchar tmp[129];\n\tchar format[129];\n\ttime_t now_epoch;\n#ifdef HAVE_TIMES\n\tclock_t tms_total;\n#endif\n\n\tif (!log_format && (!fpm_log_format || fpm_log_fd == -1)) {\n\t\treturn -1;\n\t}\n\n\tif (!log_format) {\n\t\tlog_format = fpm_log_format;\n\t\ttest = 0;\n\t} else {\n\t\ttest = 1;\n\t}\n\n\tnow_epoch = time(NULL);\n\n\tif (!test) {\n\t\tscoreboard = fpm_scoreboard_get();\n\t\tif (!scoreboard) {\n\t\t\tzlog(ZLOG_WARNING, \"unable to get scoreboard while preparing the access log\");\n\t\t\treturn -1;\n\t\t}\n\t\tproc_p = fpm_scoreboard_proc_acquire(NULL, -1, 0);\n\t\tif (!proc_p) {\n\t\t\tzlog(ZLOG_WARNING, \"[pool %s] Unable to acquire shm slot while preparing the access log\", scoreboard->pool);\n\t\t\treturn -1;\n\t\t}\n\t\tproc = *proc_p;\n\t\tfpm_scoreboard_proc_release(proc_p);\n\t}\n\n\ttoken = 0;\n\n\tmemset(buffer, '\\0', sizeof(buffer));\n\tb = buffer;\n\tlen = 0;\n\n\n\ts = log_format;\n\n\twhile (*s != '\\0') {\n\t\t/* Test is we have place for 1 more char. */\n\t\tif (len >= FPM_LOG_BUFFER) {\n\t\t\tzlog(ZLOG_NOTICE, \"the log buffer is full (%d). The access log request has been truncated.\", FPM_LOG_BUFFER);\n\t\t\tlen = FPM_LOG_BUFFER;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (!token && *s == '%') {\n\t\t\ttoken = 1;\n\t\t\tmemset(format, '\\0', sizeof(format)); /* reset format */\n\t\t\ts++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (token) {\n\t\t\ttoken = 0;\n\t\t\tlen2 = 0;\n\t\t\tswitch (*s) {\n\n\t\t\t\tcase '%': /* '%' */\n\t\t\t\t\t*b = '%';\n\t\t\t\t\tlen2 = 1;\n\t\t\t\t\tbreak;\n\n#ifdef HAVE_TIMES\n\t\t\t\tcase 'C': /* %CPU */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"total\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_utime + proc.last_request_cpu.tms_stime + proc.last_request_cpu.tms_cutime + proc.last_request_cpu.tms_cstime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!strcasecmp(format, \"user\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_utime + proc.last_request_cpu.tms_cutime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!strcasecmp(format, \"system\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_stime + proc.last_request_cpu.tms_cstime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'total', 'user' or 'system' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.2f\", tms_total / fpm_scoreboard_get_tick() / (proc.cpu_duration.tv_sec + proc.cpu_duration.tv_usec / 1000000.) * 100.);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n#endif\n\n\t\t\t\tcase 'd': /* duration µs */\n\t\t\t\t\t/* seconds */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"seconds\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.3f\", proc.duration.tv_sec + proc.duration.tv_usec / 1000000.);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* miliseconds */\n\t\t\t\t\t} else if (!strcasecmp(format, \"miliseconds\") || !strcasecmp(format, \"mili\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.3f\", proc.duration.tv_sec * 1000. + proc.duration.tv_usec / 1000.);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* microseconds */\n\t\t\t\t\t} else if (!strcasecmp(format, \"microseconds\") || !strcasecmp(format, \"micro\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.duration.tv_sec * 1000000UL + proc.duration.tv_usec);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'seconds', 'mili', 'miliseconds', 'micro' or 'microseconds' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'e': /* fastcgi env */\n\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"the name of the environment variable must be set between embraces for %%%c\", *s);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tchar *env = fcgi_getenv((fcgi_request*) SG(server_context), format, strlen(format));\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", env ? env : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'f': /* script */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.script_filename ? proc.script_filename : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'l': /* content length */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%zu\", proc.content_length);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'm': /* method */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.request_method ? proc.request_method : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'M': /* memory */\n\t\t\t\t\t/* seconds */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"bytes\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%zu\", proc.memory);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* kilobytes */\n\t\t\t\t\t} else if (!strcasecmp(format, \"kilobytes\") || !strcasecmp(format, \"kilo\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.memory / 1024);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* megabytes */\n\t\t\t\t\t} else if (!strcasecmp(format, \"megabytes\") || !strcasecmp(format, \"mega\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.memory / 1024 / 1024);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'bytes', 'kilo', 'kilobytes', 'mega' or 'megabytes' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'n': /* pool name */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", scoreboard->pool[0] ? scoreboard->pool : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'o': /* header output */\n\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"the name of the header must be set between embraces for %%%c\", *s);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tsapi_header_struct *h;\n\t\t\t\t\t\tzend_llist_position pos;\n\t\t\t\t\t\tsapi_headers_struct *sapi_headers = &SG(sapi_headers);\n\t\t\t\t\t\tsize_t format_len = strlen(format);\n\n\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_first_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\twhile (h) {\n\t\t\t\t\t\t\tchar *header;\n\t\t\t\t\t\t\tif (!h->header_len) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!strstr(h->header, format)) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* test if enought char after the header name + ': ' */\n\t\t\t\t\t\t\tif (h->header_len <= format_len + 2) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (h->header[format_len] != ':' || h->header[format_len + 1] != ' ') {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\theader = h->header + format_len + 2;\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", header && *header ? header : \"-\");\n\n\t\t\t\t\t\t\t/* found, done */\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!len2) {\n\t\t\t\t\t\t\tlen2 = 1;\n\t\t\t\t\t\t\t*b = '-';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'p': /* PID */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%ld\", (long)getpid());\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'P': /* PID */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%ld\", (long)getppid());\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'q': /* query_string */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.query_string);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Q': /* '?' */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.query_string ? \"?\" : \"\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'r': /* request URI */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.request_uri);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'R': /* remote IP address */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tconst char *tmp = fcgi_get_last_client_ip();\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", tmp ? tmp : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 's': /* status */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%d\", SG(sapi_headers).http_response_code);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'T':\n\t\t\t\tcase 't': /* time */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\ttime_t *t;\n\t\t\t\t\t\tif (*s == 't') {\n\t\t\t\t\t\t\tt = &proc.accepted_epoch;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tt = &now_epoch;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\t\tstrftime(tmp, sizeof(tmp) - 1, \"%d/%b/%Y:%H:%M:%S %z\", localtime(t));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstrftime(tmp, sizeof(tmp) - 1, format, localtime(t));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", tmp);\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'u': /* remote user */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.auth_user);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase '{': /* complex var */\n\t\t\t\t\ttoken = 1;\n\t\t\t\t\t{\n\t\t\t\t\t\tchar *start;\n\t\t\t\t\t\tsize_t l;\n\n\t\t\t\t\t\tstart = ++s;\n\n\t\t\t\t\t\twhile (*s != '\\0') {\n\t\t\t\t\t\t\tif (*s == '}') {\n\t\t\t\t\t\t\t\tl = s - start;\n\n\t\t\t\t\t\t\t\tif (l >= sizeof(format) - 1) {\n\t\t\t\t\t\t\t\t\tl = sizeof(format) - 1;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tmemcpy(format, start, l);\n\t\t\t\t\t\t\t\tformat[l] = '\\0';\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ts++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (s[1] == '\\0') {\n\t\t\t\t\t\t\tzlog(ZLOG_WARNING, \"missing closing embrace in the access.format\");\n\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tzlog(ZLOG_WARNING, \"Invalid token in the access.format (%%%c)\", *s);\n\t\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\tif (*s != '}' && format[0] != '\\0') {\n\t\t\t\tzlog(ZLOG_WARNING, \"embrace is not allowed for modifier %%%c\", *s);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ts++;\n\t\t\tif (!test) {\n\t\t\t\tb += len2;\n\t\t\t\tlen += len2;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!test) {\n\t\t\t// push the normal char to the output buffer\n\t\t\t*b = *s;\n\t\t\tb++;\n\t\t\tlen++;\n\t\t}\n\t\ts++;\n\t}\n\n\tif (!test && strlen(buffer) > 0) {\n\t\tbuffer[len] = '\\n';\n\t\twrite(fpm_log_fd, buffer, len + 1);\n\t}\n\n\treturn 0;\n}","target":"int fpm_log_write(char *log_format) /* {{{ */\n{\n\tchar *s, *b;\n\tchar buffer[FPM_LOG_BUFFER+1];\n\tint token, test;\n\tsize_t len, len2;\n\tstruct fpm_scoreboard_proc_s proc, *proc_p;\n\tstruct fpm_scoreboard_s *scoreboard;\n\tchar tmp[129];\n\tchar format[129];\n\ttime_t now_epoch;\n#ifdef HAVE_TIMES\n\tclock_t tms_total;\n#endif\n\n\tif (!log_format && (!fpm_log_format || fpm_log_fd == -1)) {\n\t\treturn -1;\n\t}\n\n\tif (!log_format) {\n\t\tlog_format = fpm_log_format;\n\t\ttest = 0;\n\t} else {\n\t\ttest = 1;\n\t}\n\n\tnow_epoch = time(NULL);\n\n\tif (!test) {\n\t\tscoreboard = fpm_scoreboard_get();\n\t\tif (!scoreboard) {\n\t\t\tzlog(ZLOG_WARNING, \"unable to get scoreboard while preparing the access log\");\n\t\t\treturn -1;\n\t\t}\n\t\tproc_p = fpm_scoreboard_proc_acquire(NULL, -1, 0);\n\t\tif (!proc_p) {\n\t\t\tzlog(ZLOG_WARNING, \"[pool %s] Unable to acquire shm slot while preparing the access log\", scoreboard->pool);\n\t\t\treturn -1;\n\t\t}\n\t\tproc = *proc_p;\n\t\tfpm_scoreboard_proc_release(proc_p);\n\t}\n\n\ttoken = 0;\n\n\tmemset(buffer, '\\0', sizeof(buffer));\n\tb = buffer;\n\tlen = 0;\n\n\n\ts = log_format;\n\n\twhile (*s != '\\0') {\n\t\t/* Test is we have place for 1 more char. */\n\t\tif (len >= FPM_LOG_BUFFER) {\n\t\t\tzlog(ZLOG_NOTICE, \"the log buffer is full (%d). The access log request has been truncated.\", FPM_LOG_BUFFER);\n\t\t\tlen = FPM_LOG_BUFFER;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (!token && *s == '%') {\n\t\t\ttoken = 1;\n\t\t\tmemset(format, '\\0', sizeof(format)); /* reset format */\n\t\t\ts++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (token) {\n\t\t\ttoken = 0;\n\t\t\tlen2 = 0;\n\t\t\tswitch (*s) {\n\n\t\t\t\tcase '%': /* '%' */\n\t\t\t\t\t*b = '%';\n\t\t\t\t\tlen2 = 1;\n\t\t\t\t\tbreak;\n\n#ifdef HAVE_TIMES\n\t\t\t\tcase 'C': /* %CPU */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"total\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_utime + proc.last_request_cpu.tms_stime + proc.last_request_cpu.tms_cutime + proc.last_request_cpu.tms_cstime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!strcasecmp(format, \"user\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_utime + proc.last_request_cpu.tms_cutime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!strcasecmp(format, \"system\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_stime + proc.last_request_cpu.tms_cstime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'total', 'user' or 'system' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.2f\", tms_total / fpm_scoreboard_get_tick() / (proc.cpu_duration.tv_sec + proc.cpu_duration.tv_usec / 1000000.) * 100.);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n#endif\n\n\t\t\t\tcase 'd': /* duration µs */\n\t\t\t\t\t/* seconds */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"seconds\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.3f\", proc.duration.tv_sec + proc.duration.tv_usec / 1000000.);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* miliseconds */\n\t\t\t\t\t} else if (!strcasecmp(format, \"miliseconds\") || !strcasecmp(format, \"mili\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.3f\", proc.duration.tv_sec * 1000. + proc.duration.tv_usec / 1000.);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* microseconds */\n\t\t\t\t\t} else if (!strcasecmp(format, \"microseconds\") || !strcasecmp(format, \"micro\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.duration.tv_sec * 1000000UL + proc.duration.tv_usec);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'seconds', 'mili', 'miliseconds', 'micro' or 'microseconds' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'e': /* fastcgi env */\n\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"the name of the environment variable must be set between embraces for %%%c\", *s);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tchar *env = fcgi_getenv((fcgi_request*) SG(server_context), format, strlen(format));\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", env ? env : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'f': /* script */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.script_filename ? proc.script_filename : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'l': /* content length */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%zu\", proc.content_length);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'm': /* method */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.request_method ? proc.request_method : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'M': /* memory */\n\t\t\t\t\t/* seconds */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"bytes\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%zu\", proc.memory);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* kilobytes */\n\t\t\t\t\t} else if (!strcasecmp(format, \"kilobytes\") || !strcasecmp(format, \"kilo\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.memory / 1024);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* megabytes */\n\t\t\t\t\t} else if (!strcasecmp(format, \"megabytes\") || !strcasecmp(format, \"mega\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.memory / 1024 / 1024);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'bytes', 'kilo', 'kilobytes', 'mega' or 'megabytes' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'n': /* pool name */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", scoreboard->pool[0] ? scoreboard->pool : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'o': /* header output */\n\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"the name of the header must be set between embraces for %%%c\", *s);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tsapi_header_struct *h;\n\t\t\t\t\t\tzend_llist_position pos;\n\t\t\t\t\t\tsapi_headers_struct *sapi_headers = &SG(sapi_headers);\n\t\t\t\t\t\tsize_t format_len = strlen(format);\n\n\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_first_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\twhile (h) {\n\t\t\t\t\t\t\tchar *header;\n\t\t\t\t\t\t\tif (!h->header_len) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!strstr(h->header, format)) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* test if enought char after the header name + ': ' */\n\t\t\t\t\t\t\tif (h->header_len <= format_len + 2) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (h->header[format_len] != ':' || h->header[format_len + 1] != ' ') {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\theader = h->header + format_len + 2;\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", header && *header ? header : \"-\");\n\n\t\t\t\t\t\t\t/* found, done */\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!len2) {\n\t\t\t\t\t\t\tlen2 = 1;\n\t\t\t\t\t\t\t*b = '-';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'p': /* PID */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%ld\", (long)getpid());\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'P': /* PID */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%ld\", (long)getppid());\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'q': /* query_string */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.query_string);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Q': /* '?' */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.query_string ? \"?\" : \"\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'r': /* request URI */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.request_uri);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'R': /* remote IP address */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tconst char *tmp = fcgi_get_last_client_ip();\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", tmp ? tmp : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 's': /* status */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%d\", SG(sapi_headers).http_response_code);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'T':\n\t\t\t\tcase 't': /* time */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\ttime_t *t;\n\t\t\t\t\t\tif (*s == 't') {\n\t\t\t\t\t\t\tt = &proc.accepted_epoch;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tt = &now_epoch;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\t\tstrftime(tmp, sizeof(tmp) - 1, \"%d/%b/%Y:%H:%M:%S %z\", localtime(t));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstrftime(tmp, sizeof(tmp) - 1, format, localtime(t));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", tmp);\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'u': /* remote user */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.auth_user);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase '{': /* complex var */\n\t\t\t\t\ttoken = 1;\n\t\t\t\t\t{\n\t\t\t\t\t\tchar *start;\n\t\t\t\t\t\tsize_t l;\n\n\t\t\t\t\t\tstart = ++s;\n\n\t\t\t\t\t\twhile (*s != '\\0') {\n\t\t\t\t\t\t\tif (*s == '}') {\n\t\t\t\t\t\t\t\tl = s - start;\n\n\t\t\t\t\t\t\t\tif (l >= sizeof(format) - 1) {\n\t\t\t\t\t\t\t\t\tl = sizeof(format) - 1;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tmemcpy(format, start, l);\n\t\t\t\t\t\t\t\tformat[l] = '\\0';\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ts++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (s[1] == '\\0') {\n\t\t\t\t\t\t\tzlog(ZLOG_WARNING, \"missing closing embrace in the access.format\");\n\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tzlog(ZLOG_WARNING, \"Invalid token in the access.format (%%%c)\", *s);\n\t\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\tif (*s != '}' && format[0] != '\\0') {\n\t\t\t\tzlog(ZLOG_WARNING, \"embrace is not allowed for modifier %%%c\", *s);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ts++;\n\t\t\tif (!test) {\n\t\t\t\tb += len2;\n\t\t\t\tlen += len2;\n\t\t\t}\n\t\t\tif (len >= FPM_LOG_BUFFER) {\n\t\t\t\tzlog(ZLOG_NOTICE, \"the log buffer is full (%d). The access log request has been truncated.\", FPM_LOG_BUFFER);\n\t\t\t\tlen = FPM_LOG_BUFFER;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!test) {\n\t\t\t// push the normal char to the output buffer\n\t\t\t*b = *s;\n\t\t\tb++;\n\t\t\tlen++;\n\t\t}\n\t\ts++;\n\t}\n\n\tif (!test && strlen(buffer) > 0) {\n\t\tbuffer[len] = '\\n';\n\t\twrite(fpm_log_fd, buffer, len + 1);\n\t}\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":3025,"sven_meta":{"func_name":"fpm_log_write","file_name":"sapi/fpm/fpm/fpm_log.c","commit_link":"github.com/php/php-src/commit/2721a0148649e07ed74468f097a28899741eb58f","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#88-fa55fc6ea7ab","input":"static MagickBooleanType load_tile(Image *image,Image *tile_image,\n XCFDocInfo *inDocInfo,XCFLayerInfo *inLayerInfo,size_t data_length,\n ExceptionInfo *exception)\n{\n ssize_t\n y;\n\n register ssize_t\n x;\n\n register Quantum\n *q;\n\n ssize_t\n count;\n\n unsigned char\n *graydata;\n\n XCFPixelInfo\n *xcfdata,\n *xcfodata;\n\n xcfdata=(XCFPixelInfo *) AcquireQuantumMemory(data_length,sizeof(*xcfdata));\n if (xcfdata == (XCFPixelInfo *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n xcfodata=xcfdata;\n graydata=(unsigned char *) xcfdata; /* used by gray and indexed */\n count=ReadBlob(image,data_length,(unsigned char *) xcfdata);\n if (count != (ssize_t) data_length)\n ThrowBinaryException(CorruptImageError,\"NotEnoughPixelData\",\n image->filename);\n for (y=0; y < (ssize_t) tile_image->rows; y++)\n {\n q=GetAuthenticPixels(tile_image,0,y,tile_image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n if (inDocInfo->image_type == GIMP_GRAY)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelGray(tile_image,ScaleCharToQuantum(*graydata),q);\n SetPixelAlpha(tile_image,ScaleCharToQuantum((unsigned char)\n inLayerInfo->alpha),q);\n graydata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n else\n if (inDocInfo->image_type == GIMP_RGB)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelRed(tile_image,ScaleCharToQuantum(xcfdata->red),q);\n SetPixelGreen(tile_image,ScaleCharToQuantum(xcfdata->green),q);\n SetPixelBlue(tile_image,ScaleCharToQuantum(xcfdata->blue),q);\n SetPixelAlpha(tile_image,xcfdata->alpha == 255U ? TransparentAlpha :\n ScaleCharToQuantum((unsigned char) inLayerInfo->alpha),q);\n xcfdata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n if (SyncAuthenticPixels(tile_image,exception) == MagickFalse)\n break;\n }\n xcfodata=(XCFPixelInfo *) RelinquishMagickMemory(xcfodata);\n return MagickTrue;\n}","target":"static MagickBooleanType load_tile(Image *image,Image *tile_image,\n XCFDocInfo *inDocInfo,XCFLayerInfo *inLayerInfo,size_t data_length,\n ExceptionInfo *exception)\n{\n ssize_t\n y;\n\n register ssize_t\n x;\n\n register Quantum\n *q;\n\n ssize_t\n count;\n\n unsigned char\n *graydata;\n\n XCFPixelInfo\n *xcfdata,\n *xcfodata;\n\n xcfdata=(XCFPixelInfo *) AcquireQuantumMemory(MagickMax(data_length,\n tile_image->columns*tile_image->rows),sizeof(*xcfdata));\n if (xcfdata == (XCFPixelInfo *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n xcfodata=xcfdata;\n graydata=(unsigned char *) xcfdata; /* used by gray and indexed */\n count=ReadBlob(image,data_length,(unsigned char *) xcfdata);\n if (count != (ssize_t) data_length)\n ThrowBinaryException(CorruptImageError,\"NotEnoughPixelData\",\n image->filename);\n for (y=0; y < (ssize_t) tile_image->rows; y++)\n {\n q=GetAuthenticPixels(tile_image,0,y,tile_image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n if (inDocInfo->image_type == GIMP_GRAY)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelGray(tile_image,ScaleCharToQuantum(*graydata),q);\n SetPixelAlpha(tile_image,ScaleCharToQuantum((unsigned char)\n inLayerInfo->alpha),q);\n graydata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n else\n if (inDocInfo->image_type == GIMP_RGB)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelRed(tile_image,ScaleCharToQuantum(xcfdata->red),q);\n SetPixelGreen(tile_image,ScaleCharToQuantum(xcfdata->green),q);\n SetPixelBlue(tile_image,ScaleCharToQuantum(xcfdata->blue),q);\n SetPixelAlpha(tile_image,xcfdata->alpha == 255U ? TransparentAlpha :\n ScaleCharToQuantum((unsigned char) inLayerInfo->alpha),q);\n xcfdata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n if (SyncAuthenticPixels(tile_image,exception) == MagickFalse)\n break;\n }\n xcfodata=(XCFPixelInfo *) RelinquishMagickMemory(xcfodata);\n return MagickTrue;\n}","lang":"c","vul_type":"cwe-125","target_token_count":605,"sven_meta":{"func_name":"load_tile","file_name":"coders/xcf.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/a2e1064f288a353bc5fef7f79ccb7683759e775c","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#90-413ecd8e4ae5","input":"static void gmc_mmx(uint8_t *dst, uint8_t *src,\n int stride, int h, int ox, int oy,\n int dxx, int dxy, int dyx, int dyy,\n int shift, int r, int width, int height)\n{\n const int w = 8;\n const int ix = ox >> (16 + shift);\n const int iy = oy >> (16 + shift);\n const int oxs = ox >> 4;\n const int oys = oy >> 4;\n const int dxxs = dxx >> 4;\n const int dxys = dxy >> 4;\n const int dyxs = dyx >> 4;\n const int dyys = dyy >> 4;\n const uint16_t r4[4] = { r, r, r, r };\n const uint16_t dxy4[4] = { dxys, dxys, dxys, dxys };\n const uint16_t dyy4[4] = { dyys, dyys, dyys, dyys };\n const uint64_t shift2 = 2 * shift;\n#define MAX_STRIDE 4096U\n#define MAX_H 8U\n uint8_t edge_buf[(MAX_H + 1) * MAX_STRIDE];\n int x, y;\n\n const int dxw = (dxx - (1 << (16 + shift))) * (w - 1);\n const int dyh = (dyy - (1 << (16 + shift))) * (h - 1);\n const int dxh = dxy * (h - 1);\n const int dyw = dyx * (w - 1);\n int need_emu = (unsigned) ix >= width - w ||\n (unsigned) iy >= height - h;\n\n if ( // non-constant fullpel offset (3% of blocks)\n ((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) |\n (oy ^ (oy + dyw)) | (oy ^ (oy + dyh)) | (oy ^ (oy + dyw + dyh))) >> (16 + shift) ||\n // uses more than 16 bits of subpel mv (only at huge resolution)\n (dxx | dxy | dyx | dyy) & 15 ||\n (need_emu && (h > MAX_H || stride > MAX_STRIDE))) {\n // FIXME could still use mmx for some of the rows\n ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy,\n shift, r, width, height);\n return;\n }\n\n src += ix + iy * stride;\n if (need_emu) {\n ff_emulated_edge_mc_8(edge_buf, src, stride, stride, w + 1, h + 1, ix, iy, width, height);\n src = edge_buf;\n }\n\n __asm__ volatile (\n \"movd %0, %%mm6 \\n\\t\"\n \"pxor %%mm7, %%mm7 \\n\\t\"\n \"punpcklwd %%mm6, %%mm6 \\n\\t\"\n \"punpcklwd %%mm6, %%mm6 \\n\\t\"\n :: \"r\" (1 << shift));\n\n for (x = 0; x < w; x += 4) {\n uint16_t dx4[4] = { oxs - dxys + dxxs * (x + 0),\n oxs - dxys + dxxs * (x + 1),\n oxs - dxys + dxxs * (x + 2),\n oxs - dxys + dxxs * (x + 3) };\n uint16_t dy4[4] = { oys - dyys + dyxs * (x + 0),\n oys - dyys + dyxs * (x + 1),\n oys - dyys + dyxs * (x + 2),\n oys - dyys + dyxs * (x + 3) };\n\n for (y = 0; y < h; y++) {\n __asm__ volatile (\n \"movq %0, %%mm4 \\n\\t\"\n \"movq %1, %%mm5 \\n\\t\"\n \"paddw %2, %%mm4 \\n\\t\"\n \"paddw %3, %%mm5 \\n\\t\"\n \"movq %%mm4, %0 \\n\\t\"\n \"movq %%mm5, %1 \\n\\t\"\n \"psrlw $12, %%mm4 \\n\\t\"\n \"psrlw $12, %%mm5 \\n\\t\"\n : \"+m\" (*dx4), \"+m\" (*dy4)\n : \"m\" (*dxy4), \"m\" (*dyy4));\n\n __asm__ volatile (\n \"movq %%mm6, %%mm2 \\n\\t\"\n \"movq %%mm6, %%mm1 \\n\\t\"\n \"psubw %%mm4, %%mm2 \\n\\t\"\n \"psubw %%mm5, %%mm1 \\n\\t\"\n \"movq %%mm2, %%mm0 \\n\\t\"\n \"movq %%mm4, %%mm3 \\n\\t\"\n \"pmullw %%mm1, %%mm0 \\n\\t\" // (s - dx) * (s - dy)\n \"pmullw %%mm5, %%mm3 \\n\\t\" // dx * dy\n \"pmullw %%mm5, %%mm2 \\n\\t\" // (s - dx) * dy\n \"pmullw %%mm4, %%mm1 \\n\\t\" // dx * (s - dy)\n\n \"movd %4, %%mm5 \\n\\t\"\n \"movd %3, %%mm4 \\n\\t\"\n \"punpcklbw %%mm7, %%mm5 \\n\\t\"\n \"punpcklbw %%mm7, %%mm4 \\n\\t\"\n \"pmullw %%mm5, %%mm3 \\n\\t\" // src[1, 1] * dx * dy\n \"pmullw %%mm4, %%mm2 \\n\\t\" // src[0, 1] * (s - dx) * dy\n\n \"movd %2, %%mm5 \\n\\t\"\n \"movd %1, %%mm4 \\n\\t\"\n \"punpcklbw %%mm7, %%mm5 \\n\\t\"\n \"punpcklbw %%mm7, %%mm4 \\n\\t\"\n \"pmullw %%mm5, %%mm1 \\n\\t\" // src[1, 0] * dx * (s - dy)\n \"pmullw %%mm4, %%mm0 \\n\\t\" // src[0, 0] * (s - dx) * (s - dy)\n \"paddw %5, %%mm1 \\n\\t\"\n \"paddw %%mm3, %%mm2 \\n\\t\"\n \"paddw %%mm1, %%mm0 \\n\\t\"\n \"paddw %%mm2, %%mm0 \\n\\t\"\n\n \"psrlw %6, %%mm0 \\n\\t\"\n \"packuswb %%mm0, %%mm0 \\n\\t\"\n \"movd %%mm0, %0 \\n\\t\"\n\n : \"=m\" (dst[x + y * stride])\n : \"m\" (src[0]), \"m\" (src[1]),\n \"m\" (src[stride]), \"m\" (src[stride + 1]),\n \"m\" (*r4), \"m\" (shift2));\n src += stride;\n }\n src += 4 - h * stride;\n }\n}","target":"static void gmc_mmx(uint8_t *dst, uint8_t *src,\n int stride, int h, int ox, int oy,\n int dxx, int dxy, int dyx, int dyy,\n int shift, int r, int width, int height)\n{\n const int w = 8;\n const int ix = ox >> (16 + shift);\n const int iy = oy >> (16 + shift);\n const int oxs = ox >> 4;\n const int oys = oy >> 4;\n const int dxxs = dxx >> 4;\n const int dxys = dxy >> 4;\n const int dyxs = dyx >> 4;\n const int dyys = dyy >> 4;\n const uint16_t r4[4] = { r, r, r, r };\n const uint16_t dxy4[4] = { dxys, dxys, dxys, dxys };\n const uint16_t dyy4[4] = { dyys, dyys, dyys, dyys };\n const uint64_t shift2 = 2 * shift;\n#define MAX_STRIDE 4096U\n#define MAX_H 8U\n uint8_t edge_buf[(MAX_H + 1) * MAX_STRIDE];\n int x, y;\n\n const int dxw = (dxx - (1 << (16 + shift))) * (w - 1);\n const int dyh = (dyy - (1 << (16 + shift))) * (h - 1);\n const int dxh = dxy * (h - 1);\n const int dyw = dyx * (w - 1);\n int need_emu = (unsigned) ix >= width - w || width < w ||\n (unsigned) iy >= height - h || height< h\n ;\n\n if ( // non-constant fullpel offset (3% of blocks)\n ((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) |\n (oy ^ (oy + dyw)) | (oy ^ (oy + dyh)) | (oy ^ (oy + dyw + dyh))) >> (16 + shift) ||\n // uses more than 16 bits of subpel mv (only at huge resolution)\n (dxx | dxy | dyx | dyy) & 15 ||\n (need_emu && (h > MAX_H || stride > MAX_STRIDE))) {\n // FIXME could still use mmx for some of the rows\n ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy,\n shift, r, width, height);\n return;\n }\n\n src += ix + iy * stride;\n if (need_emu) {\n ff_emulated_edge_mc_8(edge_buf, src, stride, stride, w + 1, h + 1, ix, iy, width, height);\n src = edge_buf;\n }\n\n __asm__ volatile (\n \"movd %0, %%mm6 \\n\\t\"\n \"pxor %%mm7, %%mm7 \\n\\t\"\n \"punpcklwd %%mm6, %%mm6 \\n\\t\"\n \"punpcklwd %%mm6, %%mm6 \\n\\t\"\n :: \"r\" (1 << shift));\n\n for (x = 0; x < w; x += 4) {\n uint16_t dx4[4] = { oxs - dxys + dxxs * (x + 0),\n oxs - dxys + dxxs * (x + 1),\n oxs - dxys + dxxs * (x + 2),\n oxs - dxys + dxxs * (x + 3) };\n uint16_t dy4[4] = { oys - dyys + dyxs * (x + 0),\n oys - dyys + dyxs * (x + 1),\n oys - dyys + dyxs * (x + 2),\n oys - dyys + dyxs * (x + 3) };\n\n for (y = 0; y < h; y++) {\n __asm__ volatile (\n \"movq %0, %%mm4 \\n\\t\"\n \"movq %1, %%mm5 \\n\\t\"\n \"paddw %2, %%mm4 \\n\\t\"\n \"paddw %3, %%mm5 \\n\\t\"\n \"movq %%mm4, %0 \\n\\t\"\n \"movq %%mm5, %1 \\n\\t\"\n \"psrlw $12, %%mm4 \\n\\t\"\n \"psrlw $12, %%mm5 \\n\\t\"\n : \"+m\" (*dx4), \"+m\" (*dy4)\n : \"m\" (*dxy4), \"m\" (*dyy4));\n\n __asm__ volatile (\n \"movq %%mm6, %%mm2 \\n\\t\"\n \"movq %%mm6, %%mm1 \\n\\t\"\n \"psubw %%mm4, %%mm2 \\n\\t\"\n \"psubw %%mm5, %%mm1 \\n\\t\"\n \"movq %%mm2, %%mm0 \\n\\t\"\n \"movq %%mm4, %%mm3 \\n\\t\"\n \"pmullw %%mm1, %%mm0 \\n\\t\" // (s - dx) * (s - dy)\n \"pmullw %%mm5, %%mm3 \\n\\t\" // dx * dy\n \"pmullw %%mm5, %%mm2 \\n\\t\" // (s - dx) * dy\n \"pmullw %%mm4, %%mm1 \\n\\t\" // dx * (s - dy)\n\n \"movd %4, %%mm5 \\n\\t\"\n \"movd %3, %%mm4 \\n\\t\"\n \"punpcklbw %%mm7, %%mm5 \\n\\t\"\n \"punpcklbw %%mm7, %%mm4 \\n\\t\"\n \"pmullw %%mm5, %%mm3 \\n\\t\" // src[1, 1] * dx * dy\n \"pmullw %%mm4, %%mm2 \\n\\t\" // src[0, 1] * (s - dx) * dy\n\n \"movd %2, %%mm5 \\n\\t\"\n \"movd %1, %%mm4 \\n\\t\"\n \"punpcklbw %%mm7, %%mm5 \\n\\t\"\n \"punpcklbw %%mm7, %%mm4 \\n\\t\"\n \"pmullw %%mm5, %%mm1 \\n\\t\" // src[1, 0] * dx * (s - dy)\n \"pmullw %%mm4, %%mm0 \\n\\t\" // src[0, 0] * (s - dx) * (s - dy)\n \"paddw %5, %%mm1 \\n\\t\"\n \"paddw %%mm3, %%mm2 \\n\\t\"\n \"paddw %%mm1, %%mm0 \\n\\t\"\n \"paddw %%mm2, %%mm0 \\n\\t\"\n\n \"psrlw %6, %%mm0 \\n\\t\"\n \"packuswb %%mm0, %%mm0 \\n\\t\"\n \"movd %%mm0, %0 \\n\\t\"\n\n : \"=m\" (dst[x + y * stride])\n : \"m\" (src[0]), \"m\" (src[1]),\n \"m\" (src[stride]), \"m\" (src[stride + 1]),\n \"m\" (*r4), \"m\" (shift2));\n src += stride;\n }\n src += 4 - h * stride;\n }\n}","lang":"c","vul_type":"cwe-125","target_token_count":1816,"sven_meta":{"func_name":"gmc_mmx","file_name":"libavcodec/x86/mpegvideodsp.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/58cf31cee7a456057f337b3102a03206d833d5e8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#91-4163ff37aeef","input":"static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field)\n{\n#ifndef PB_ENABLE_MALLOC\n PB_UNUSED(wire_type);\n PB_UNUSED(field);\n PB_RETURN_ERROR(stream, \"no malloc support\");\n#else\n switch (PB_HTYPE(field->type))\n {\n case PB_HTYPE_REQUIRED:\n case PB_HTYPE_OPTIONAL:\n case PB_HTYPE_ONEOF:\n if (!check_wire_type(wire_type, field))\n PB_RETURN_ERROR(stream, \"wrong wire type\");\n\n if (PB_LTYPE_IS_SUBMSG(field->type) && *(void**)field->pField != NULL)\n {\n /* Duplicate field, have to release the old allocation first. */\n /* FIXME: Does this work correctly for oneofs? */\n pb_release_single_field(field);\n }\n \n if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)\n {\n *(pb_size_t*)field->pSize = field->tag;\n }\n\n if (PB_LTYPE(field->type) == PB_LTYPE_STRING ||\n PB_LTYPE(field->type) == PB_LTYPE_BYTES)\n {\n /* pb_dec_string and pb_dec_bytes handle allocation themselves */\n field->pData = field->pField;\n return decode_basic_field(stream, field);\n }\n else\n {\n if (!allocate_field(stream, field->pField, field->data_size, 1))\n return false;\n \n field->pData = *(void**)field->pField;\n initialize_pointer_field(field->pData, field);\n return decode_basic_field(stream, field);\n }\n \n case PB_HTYPE_REPEATED:\n if (wire_type == PB_WT_STRING\n && PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)\n {\n /* Packed array, multiple items come in at once. */\n bool status = true;\n pb_size_t *size = (pb_size_t*)field->pSize;\n size_t allocated_size = *size;\n pb_istream_t substream;\n \n if (!pb_make_string_substream(stream, &substream))\n return false;\n \n while (substream.bytes_left)\n {\n if ((size_t)*size + 1 > allocated_size)\n {\n /* Allocate more storage. This tries to guess the\n * number of remaining entries. Round the division\n * upwards. */\n allocated_size += (substream.bytes_left - 1) / field->data_size + 1;\n \n if (!allocate_field(&substream, field->pField, field->data_size, allocated_size))\n {\n status = false;\n break;\n }\n }\n\n /* Decode the array entry */\n field->pData = *(char**)field->pField + field->data_size * (*size);\n initialize_pointer_field(field->pData, field);\n if (!decode_basic_field(&substream, field))\n {\n status = false;\n break;\n }\n \n if (*size == PB_SIZE_MAX)\n {\n#ifndef PB_NO_ERRMSG\n stream->errmsg = \"too many array entries\";\n#endif\n status = false;\n break;\n }\n \n (*size)++;\n }\n if (!pb_close_string_substream(stream, &substream))\n return false;\n \n return status;\n }\n else\n {\n /* Normal repeated field, i.e. only one item at a time. */\n pb_size_t *size = (pb_size_t*)field->pSize;\n\n if (*size == PB_SIZE_MAX)\n PB_RETURN_ERROR(stream, \"too many array entries\");\n \n if (!check_wire_type(wire_type, field))\n PB_RETURN_ERROR(stream, \"wrong wire type\");\n\n (*size)++;\n if (!allocate_field(stream, field->pField, field->data_size, *size))\n return false;\n \n field->pData = *(char**)field->pField + field->data_size * (*size - 1);\n initialize_pointer_field(field->pData, field);\n return decode_basic_field(stream, field);\n }\n\n default:\n PB_RETURN_ERROR(stream, \"invalid field type\");\n }\n#endif\n}","target":"static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field)\n{\n#ifndef PB_ENABLE_MALLOC\n PB_UNUSED(wire_type);\n PB_UNUSED(field);\n PB_RETURN_ERROR(stream, \"no malloc support\");\n#else\n switch (PB_HTYPE(field->type))\n {\n case PB_HTYPE_REQUIRED:\n case PB_HTYPE_OPTIONAL:\n case PB_HTYPE_ONEOF:\n if (!check_wire_type(wire_type, field))\n PB_RETURN_ERROR(stream, \"wrong wire type\");\n\n if (PB_LTYPE_IS_SUBMSG(field->type) && *(void**)field->pField != NULL)\n {\n /* Duplicate field, have to release the old allocation first. */\n /* FIXME: Does this work correctly for oneofs? */\n pb_release_single_field(field);\n }\n \n if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)\n {\n *(pb_size_t*)field->pSize = field->tag;\n }\n\n if (PB_LTYPE(field->type) == PB_LTYPE_STRING ||\n PB_LTYPE(field->type) == PB_LTYPE_BYTES)\n {\n /* pb_dec_string and pb_dec_bytes handle allocation themselves */\n field->pData = field->pField;\n return decode_basic_field(stream, field);\n }\n else\n {\n if (!allocate_field(stream, field->pField, field->data_size, 1))\n return false;\n \n field->pData = *(void**)field->pField;\n initialize_pointer_field(field->pData, field);\n return decode_basic_field(stream, field);\n }\n \n case PB_HTYPE_REPEATED:\n if (wire_type == PB_WT_STRING\n && PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)\n {\n /* Packed array, multiple items come in at once. */\n bool status = true;\n pb_size_t *size = (pb_size_t*)field->pSize;\n size_t allocated_size = *size;\n pb_istream_t substream;\n \n if (!pb_make_string_substream(stream, &substream))\n return false;\n \n while (substream.bytes_left)\n {\n if ((size_t)*size + 1 > allocated_size)\n {\n /* Allocate more storage. This tries to guess the\n * number of remaining entries. Round the division\n * upwards. */\n allocated_size += (substream.bytes_left - 1) / field->data_size + 1;\n \n if (!allocate_field(&substream, field->pField, field->data_size, allocated_size))\n {\n status = false;\n break;\n }\n }\n\n /* Decode the array entry */\n field->pData = *(char**)field->pField + field->data_size * (*size);\n initialize_pointer_field(field->pData, field);\n if (!decode_basic_field(&substream, field))\n {\n status = false;\n break;\n }\n \n if (*size == PB_SIZE_MAX)\n {\n#ifndef PB_NO_ERRMSG\n stream->errmsg = \"too many array entries\";\n#endif\n status = false;\n break;\n }\n \n (*size)++;\n }\n if (!pb_close_string_substream(stream, &substream))\n return false;\n \n return status;\n }\n else\n {\n /* Normal repeated field, i.e. only one item at a time. */\n pb_size_t *size = (pb_size_t*)field->pSize;\n\n if (*size == PB_SIZE_MAX)\n PB_RETURN_ERROR(stream, \"too many array entries\");\n \n if (!check_wire_type(wire_type, field))\n PB_RETURN_ERROR(stream, \"wrong wire type\");\n\n if (!allocate_field(stream, field->pField, field->data_size, (size_t)(*size + 1)))\n return false;\n \n field->pData = *(char**)field->pField + field->data_size * (*size);\n (*size)++;\n initialize_pointer_field(field->pData, field);\n return decode_basic_field(stream, field);\n }\n\n default:\n PB_RETURN_ERROR(stream, \"invalid field type\");\n }\n#endif\n}","lang":"c","vul_type":"cwe-125","target_token_count":888,"sven_meta":{"func_name":"decode_pointer_field","file_name":"pb_decode.c","commit_link":"github.com/nanopb/nanopb/commit/45582f1f97f49e2abfdba1463d1e1027682d9856","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#92-e593eca4b9a7","input":"ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t bytes)\n{\n UINT8* ptr;\n int framesize;\n int c, chunks, advance;\n int l, lines;\n int i, j, x = 0, y, ymax;\n\n /* If not even the chunk size is present, we'd better leave */\n\n if (bytes < 4)\n\treturn 0;\n\n /* We don't decode anything unless we have a full chunk in the\n input buffer (on the other hand, the Python part of the driver\n makes sure this is always the case) */\n\n ptr = buf;\n\n framesize = I32(ptr);\n if (framesize < I32(ptr))\n\treturn 0;\n\n /* Make sure this is a frame chunk. The Python driver takes\n case of other chunk types. */\n\n if (I16(ptr+4) != 0xF1FA) {\n\tstate->errcode = IMAGING_CODEC_UNKNOWN;\n\treturn -1;\n }\n\n chunks = I16(ptr+6);\n ptr += 16;\n bytes -= 16;\n\n /* Process subchunks */\n for (c = 0; c < chunks; c++) {\n\tUINT8* data;\n\tif (bytes < 10) {\n\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t return -1;\n\t}\n\tdata = ptr + 6;\n\tswitch (I16(ptr+4)) {\n\tcase 4: case 11:\n\t /* FLI COLOR chunk */\n\t break; /* ignored; handled by Python code */\n\tcase 7:\n\t /* FLI SS2 chunk (word delta) */\n\t lines = I16(data); data += 2;\n\t for (l = y = 0; l < lines && y < state->ysize; l++, y++) {\n\t\tUINT8* buf = (UINT8*) im->image[y];\n\t\tint p, packets;\n\t\tpackets = I16(data); data += 2;\n\t\twhile (packets & 0x8000) {\n\t\t /* flag word */\n\t\t if (packets & 0x4000) {\n\t\t\ty += 65536 - packets; /* skip lines */\n\t\t\tif (y >= state->ysize) {\n\t\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t\t return -1;\n\t\t\t}\n\t\t\tbuf = (UINT8*) im->image[y];\n\t\t } else {\n\t\t\t/* store last byte (used if line width is odd) */\n\t\t\tbuf[state->xsize-1] = (UINT8) packets;\n\t\t }\n\t\t packets = I16(data); data += 2;\n\t\t}\n\t\tfor (p = x = 0; p < packets; p++) {\n\t\t x += data[0]; /* pixel skip */\n\t\t if (data[1] >= 128) {\n\t\t\ti = 256-data[1]; /* run */\n\t\t\tif (x + i + i > state->xsize)\n\t\t\t break;\n\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t buf[x++] = data[2];\n\t\t\t buf[x++] = data[3];\n\t\t\t}\n\t\t\tdata += 2 + 2;\n\t\t } else {\n\t\t\ti = 2 * (int) data[1]; /* chunk */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemcpy(buf + x, data + 2, i);\n\t\t\tdata += 2 + i;\n\t\t\tx += i;\n\t\t }\n\t\t}\n\t\tif (p < packets)\n\t\t break; /* didn't process all packets */\n\t }\n\t if (l < lines) {\n\t\t/* didn't process all lines */\n\t\tstate->errcode = IMAGING_CODEC_OVERRUN;\n\t\treturn -1;\n\t }\n\t break;\n\tcase 12:\n\t /* FLI LC chunk (byte delta) */\n\t y = I16(data); ymax = y + I16(data+2); data += 4;\n\t for (; y < ymax && y < state->ysize; y++) {\n\t\tUINT8* out = (UINT8*) im->image[y];\n\t\tint p, packets = *data++;\n\t\tfor (p = x = 0; p < packets; p++, x += i) {\n\t\t x += data[0]; /* skip pixels */\n\t\t if (data[1] & 0x80) {\n\t\t\ti = 256-data[1]; /* run */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemset(out + x, data[2], i);\n\t\t\tdata += 3;\n\t\t } else {\n\t\t\ti = data[1]; /* chunk */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemcpy(out + x, data + 2, i);\n\t\t\tdata += i + 2;\n\t\t }\n\t\t}\n\t\tif (p < packets)\n\t\t break; /* didn't process all packets */\n\t }\n\t if (y < ymax) {\n\t\t/* didn't process all lines */\n\t\tstate->errcode = IMAGING_CODEC_OVERRUN;\n\t\treturn -1;\n\t }\n\t break;\n\tcase 13:\n\t /* FLI BLACK chunk */\n\t for (y = 0; y < state->ysize; y++)\n\t\tmemset(im->image[y], 0, state->xsize);\n\t break;\n\tcase 15:\n\t /* FLI BRUN chunk */\n\t for (y = 0; y < state->ysize; y++) {\n\t\tUINT8* out = (UINT8*) im->image[y];\n\t\tdata += 1; /* ignore packetcount byte */\n\t\tfor (x = 0; x < state->xsize; x += i) {\n\t\t if (data[0] & 0x80) {\n\t\t\ti = 256 - data[0];\n\t\t\tif (x + i > state->xsize)\n\t\t\t break; /* safety first */\n\t\t\tmemcpy(out + x, data + 1, i);\n\t\t\tdata += i + 1;\n\t\t } else {\n\t\t\ti = data[0];\n\t\t\tif (x + i > state->xsize)\n\t\t\t break; /* safety first */\n\t\t\tmemset(out + x, data[1], i);\n\t\t\tdata += 2;\n\t\t }\n\t\t}\n\t\tif (x != state->xsize) {\n\t\t /* didn't unpack whole line */\n\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t return -1;\n\t\t}\n\t }\n\t break;\n\tcase 16:\n\t /* COPY chunk */\n\t for (y = 0; y < state->ysize; y++) {\n\t\tUINT8* buf = (UINT8*) im->image[y];\n\t\tmemcpy(buf, data, state->xsize);\n\t\tdata += state->xsize;\n\t }\n\t break;\n\tcase 18:\n\t /* PSTAMP chunk */\n\t break; /* ignored */\n\tdefault:\n\t /* unknown chunk */\n\t /* printf(\"unknown FLI/FLC chunk: %d\\n\", I16(ptr+4)); */\n\t state->errcode = IMAGING_CODEC_UNKNOWN;\n\t return -1;\n\t}\n\tadvance = I32(ptr);\n\tptr += advance;\n\tbytes -= advance;\n }\n\n return -1; /* end of frame */\n}","target":"ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t bytes)\n{\n UINT8* ptr;\n int framesize;\n int c, chunks, advance;\n int l, lines;\n int i, j, x = 0, y, ymax;\n\n /* If not even the chunk size is present, we'd better leave */\n\n if (bytes < 4)\n\treturn 0;\n\n /* We don't decode anything unless we have a full chunk in the\n input buffer */\n\n ptr = buf;\n\n framesize = I32(ptr);\n if (framesize < I32(ptr))\n\treturn 0;\n\n /* Make sure this is a frame chunk. The Python driver takes\n case of other chunk types. */\n\n if (bytes < 8) {\n state->errcode = IMAGING_CODEC_OVERRUN;\n return -1;\n }\n if (I16(ptr+4) != 0xF1FA) {\n\tstate->errcode = IMAGING_CODEC_UNKNOWN;\n\treturn -1;\n }\n\n chunks = I16(ptr+6);\n ptr += 16;\n bytes -= 16;\n\n /* Process subchunks */\n for (c = 0; c < chunks; c++) {\n\tUINT8* data;\n\tif (bytes < 10) {\n\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t return -1;\n\t}\n\tdata = ptr + 6;\n\tswitch (I16(ptr+4)) {\n\tcase 4: case 11:\n\t /* FLI COLOR chunk */\n\t break; /* ignored; handled by Python code */\n\tcase 7:\n\t /* FLI SS2 chunk (word delta) */\n\t lines = I16(data); data += 2;\n\t for (l = y = 0; l < lines && y < state->ysize; l++, y++) {\n\t\tUINT8* buf = (UINT8*) im->image[y];\n\t\tint p, packets;\n\t\tpackets = I16(data); data += 2;\n\t\twhile (packets & 0x8000) {\n\t\t /* flag word */\n\t\t if (packets & 0x4000) {\n\t\t\ty += 65536 - packets; /* skip lines */\n\t\t\tif (y >= state->ysize) {\n\t\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t\t return -1;\n\t\t\t}\n\t\t\tbuf = (UINT8*) im->image[y];\n\t\t } else {\n\t\t\t/* store last byte (used if line width is odd) */\n\t\t\tbuf[state->xsize-1] = (UINT8) packets;\n\t\t }\n\t\t packets = I16(data); data += 2;\n\t\t}\n\t\tfor (p = x = 0; p < packets; p++) {\n\t\t x += data[0]; /* pixel skip */\n\t\t if (data[1] >= 128) {\n\t\t\ti = 256-data[1]; /* run */\n\t\t\tif (x + i + i > state->xsize)\n\t\t\t break;\n\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t buf[x++] = data[2];\n\t\t\t buf[x++] = data[3];\n\t\t\t}\n\t\t\tdata += 2 + 2;\n\t\t } else {\n\t\t\ti = 2 * (int) data[1]; /* chunk */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemcpy(buf + x, data + 2, i);\n\t\t\tdata += 2 + i;\n\t\t\tx += i;\n\t\t }\n\t\t}\n\t\tif (p < packets)\n\t\t break; /* didn't process all packets */\n\t }\n\t if (l < lines) {\n\t\t/* didn't process all lines */\n\t\tstate->errcode = IMAGING_CODEC_OVERRUN;\n\t\treturn -1;\n\t }\n\t break;\n\tcase 12:\n\t /* FLI LC chunk (byte delta) */\n\t y = I16(data); ymax = y + I16(data+2); data += 4;\n\t for (; y < ymax && y < state->ysize; y++) {\n\t\tUINT8* out = (UINT8*) im->image[y];\n\t\tint p, packets = *data++;\n\t\tfor (p = x = 0; p < packets; p++, x += i) {\n\t\t x += data[0]; /* skip pixels */\n\t\t if (data[1] & 0x80) {\n\t\t\ti = 256-data[1]; /* run */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemset(out + x, data[2], i);\n\t\t\tdata += 3;\n\t\t } else {\n\t\t\ti = data[1]; /* chunk */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemcpy(out + x, data + 2, i);\n\t\t\tdata += i + 2;\n\t\t }\n\t\t}\n\t\tif (p < packets)\n\t\t break; /* didn't process all packets */\n\t }\n\t if (y < ymax) {\n\t\t/* didn't process all lines */\n\t\tstate->errcode = IMAGING_CODEC_OVERRUN;\n\t\treturn -1;\n\t }\n\t break;\n\tcase 13:\n\t /* FLI BLACK chunk */\n\t for (y = 0; y < state->ysize; y++)\n\t\tmemset(im->image[y], 0, state->xsize);\n\t break;\n\tcase 15:\n\t /* FLI BRUN chunk */\n\t for (y = 0; y < state->ysize; y++) {\n\t\tUINT8* out = (UINT8*) im->image[y];\n\t\tdata += 1; /* ignore packetcount byte */\n\t\tfor (x = 0; x < state->xsize; x += i) {\n\t\t if (data[0] & 0x80) {\n\t\t\ti = 256 - data[0];\n\t\t\tif (x + i > state->xsize)\n\t\t\t break; /* safety first */\n\t\t\tmemcpy(out + x, data + 1, i);\n\t\t\tdata += i + 1;\n\t\t } else {\n\t\t\ti = data[0];\n\t\t\tif (x + i > state->xsize)\n\t\t\t break; /* safety first */\n\t\t\tmemset(out + x, data[1], i);\n\t\t\tdata += 2;\n\t\t }\n\t\t}\n\t\tif (x != state->xsize) {\n\t\t /* didn't unpack whole line */\n\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t return -1;\n\t\t}\n\t }\n\t break;\n\tcase 16:\n\t /* COPY chunk */\n\t for (y = 0; y < state->ysize; y++) {\n\t\tUINT8* buf = (UINT8*) im->image[y];\n\t\tmemcpy(buf, data, state->xsize);\n\t\tdata += state->xsize;\n\t }\n\t break;\n\tcase 18:\n\t /* PSTAMP chunk */\n\t break; /* ignored */\n\tdefault:\n\t /* unknown chunk */\n\t /* printf(\"unknown FLI/FLC chunk: %d\\n\", I16(ptr+4)); */\n\t state->errcode = IMAGING_CODEC_UNKNOWN;\n\t return -1;\n\t}\n\tadvance = I32(ptr);\n\tptr += advance;\n\tbytes -= advance;\n }\n\n return -1; /* end of frame */\n}","lang":"c","vul_type":"cwe-125","target_token_count":1570,"sven_meta":{"func_name":"ImagingFliDecode","file_name":"src/libImaging/FliDecode.c","commit_link":"github.com/python-pillow/Pillow/commit/a09acd0decd8a87ccce939d5ff65dab59e7d365b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#93-c15a1f4b82ba","input":"int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,\n\tvoid *buf, int peekonly)\n{\n\tstruct tmComResBusInfo *bus = &dev->bus;\n\tu32 bytes_to_read, write_distance, curr_grp, curr_gwp,\n\t\tnew_grp, buf_size, space_rem;\n\tstruct tmComResInfo msg_tmp;\n\tint ret = SAA_ERR_BAD_PARAMETER;\n\n\tsaa7164_bus_verify(dev);\n\n\tif (msg == NULL)\n\t\treturn ret;\n\n\tif (msg->size > dev->bus.m_wMaxReqSize) {\n\t\tprintk(KERN_ERR \"%s() Exceeded dev->bus.m_wMaxReqSize\\n\",\n\t\t\t__func__);\n\t\treturn ret;\n\t}\n\n\tif ((peekonly == 0) && (msg->size > 0) && (buf == NULL)) {\n\t\tprintk(KERN_ERR\n\t\t\t\"%s() Missing msg buf, size should be %d bytes\\n\",\n\t\t\t__func__, msg->size);\n\t\treturn ret;\n\t}\n\n\tmutex_lock(&bus->lock);\n\n\t/* Peek the bus to see if a msg exists, if it's not what we're expecting\n\t * then return cleanly else read the message from the bus.\n\t */\n\tcurr_gwp = saa7164_readl(bus->m_dwGetWritePos);\n\tcurr_grp = saa7164_readl(bus->m_dwGetReadPos);\n\n\tif (curr_gwp == curr_grp) {\n\t\tret = SAA_ERR_EMPTY;\n\t\tgoto out;\n\t}\n\n\tbytes_to_read = sizeof(*msg);\n\n\t/* Calculate write distance to current read position */\n\twrite_distance = 0;\n\tif (curr_gwp >= curr_grp)\n\t\t/* Write doesn't wrap around the ring */\n\t\twrite_distance = curr_gwp - curr_grp;\n\telse\n\t\t/* Write wraps around the ring */\n\t\twrite_distance = curr_gwp + bus->m_dwSizeGetRing - curr_grp;\n\n\tif (bytes_to_read > write_distance) {\n\t\tprintk(KERN_ERR \"%s() No message/response found\\n\", __func__);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Calculate the new read position */\n\tnew_grp = curr_grp + bytes_to_read;\n\tif (new_grp > bus->m_dwSizeGetRing) {\n\n\t\t/* Ring wraps */\n\t\tnew_grp -= bus->m_dwSizeGetRing;\n\t\tspace_rem = bus->m_dwSizeGetRing - curr_grp;\n\n\t\tmemcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, space_rem);\n\t\tmemcpy_fromio((u8 *)&msg_tmp + space_rem, bus->m_pdwGetRing,\n\t\t\tbytes_to_read - space_rem);\n\n\t} else {\n\t\t/* No wrapping */\n\t\tmemcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, bytes_to_read);\n\t}\n\t/* Convert from little endian to CPU */\n\tmsg_tmp.size = le16_to_cpu((__force __le16)msg_tmp.size);\n\tmsg_tmp.command = le32_to_cpu((__force __le32)msg_tmp.command);\n\tmsg_tmp.controlselector = le16_to_cpu((__force __le16)msg_tmp.controlselector);\n\n\t/* No need to update the read positions, because this was a peek */\n\t/* If the caller specifically want to peek, return */\n\tif (peekonly) {\n\t\tmemcpy(msg, &msg_tmp, sizeof(*msg));\n\t\tgoto peekout;\n\t}\n\n\t/* Check if the command/response matches what is expected */\n\tif ((msg_tmp.id != msg->id) || (msg_tmp.command != msg->command) ||\n\t\t(msg_tmp.controlselector != msg->controlselector) ||\n\t\t(msg_tmp.seqno != msg->seqno) || (msg_tmp.size != msg->size)) {\n\n\t\tprintk(KERN_ERR \"%s() Unexpected msg miss-match\\n\", __func__);\n\t\tsaa7164_bus_dumpmsg(dev, msg, buf);\n\t\tsaa7164_bus_dumpmsg(dev, &msg_tmp, NULL);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Get the actual command and response from the bus */\n\tbuf_size = msg->size;\n\n\tbytes_to_read = sizeof(*msg) + msg->size;\n\t/* Calculate write distance to current read position */\n\twrite_distance = 0;\n\tif (curr_gwp >= curr_grp)\n\t\t/* Write doesn't wrap around the ring */\n\t\twrite_distance = curr_gwp - curr_grp;\n\telse\n\t\t/* Write wraps around the ring */\n\t\twrite_distance = curr_gwp + bus->m_dwSizeGetRing - curr_grp;\n\n\tif (bytes_to_read > write_distance) {\n\t\tprintk(KERN_ERR \"%s() Invalid bus state, missing msg or mangled ring, faulty H/W / bad code?\\n\",\n\t\t __func__);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Calculate the new read position */\n\tnew_grp = curr_grp + bytes_to_read;\n\tif (new_grp > bus->m_dwSizeGetRing) {\n\n\t\t/* Ring wraps */\n\t\tnew_grp -= bus->m_dwSizeGetRing;\n\t\tspace_rem = bus->m_dwSizeGetRing - curr_grp;\n\n\t\tif (space_rem < sizeof(*msg)) {\n\t\t\t/* msg wraps around the ring */\n\t\t\tmemcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, space_rem);\n\t\t\tmemcpy_fromio((u8 *)msg + space_rem, bus->m_pdwGetRing,\n\t\t\t\tsizeof(*msg) - space_rem);\n\t\t\tif (buf)\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + sizeof(*msg) -\n\t\t\t\t\tspace_rem, buf_size);\n\n\t\t} else if (space_rem == sizeof(*msg)) {\n\t\t\tmemcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));\n\t\t\tif (buf)\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing, buf_size);\n\t\t} else {\n\t\t\t/* Additional data wraps around the ring */\n\t\t\tmemcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));\n\t\t\tif (buf) {\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + curr_grp +\n\t\t\t\t\tsizeof(*msg), space_rem - sizeof(*msg));\n\t\t\t\tmemcpy_fromio(buf + space_rem - sizeof(*msg),\n\t\t\t\t\tbus->m_pdwGetRing, bytes_to_read -\n\t\t\t\t\tspace_rem);\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\t\t/* No wrapping */\n\t\tmemcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));\n\t\tif (buf)\n\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + curr_grp + sizeof(*msg),\n\t\t\t\tbuf_size);\n\t}\n\t/* Convert from little endian to CPU */\n\tmsg->size = le16_to_cpu((__force __le16)msg->size);\n\tmsg->command = le32_to_cpu((__force __le32)msg->command);\n\tmsg->controlselector = le16_to_cpu((__force __le16)msg->controlselector);\n\n\t/* Update the read positions, adjusting the ring */\n\tsaa7164_writel(bus->m_dwGetReadPos, new_grp);\n\npeekout:\n\tret = SAA_OK;\nout:\n\tmutex_unlock(&bus->lock);\n\tsaa7164_bus_verify(dev);\n\treturn ret;\n}","target":"int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,\n\tvoid *buf, int peekonly)\n{\n\tstruct tmComResBusInfo *bus = &dev->bus;\n\tu32 bytes_to_read, write_distance, curr_grp, curr_gwp,\n\t\tnew_grp, buf_size, space_rem;\n\tstruct tmComResInfo msg_tmp;\n\tint ret = SAA_ERR_BAD_PARAMETER;\n\n\tsaa7164_bus_verify(dev);\n\n\tif (msg == NULL)\n\t\treturn ret;\n\n\tif (msg->size > dev->bus.m_wMaxReqSize) {\n\t\tprintk(KERN_ERR \"%s() Exceeded dev->bus.m_wMaxReqSize\\n\",\n\t\t\t__func__);\n\t\treturn ret;\n\t}\n\n\tif ((peekonly == 0) && (msg->size > 0) && (buf == NULL)) {\n\t\tprintk(KERN_ERR\n\t\t\t\"%s() Missing msg buf, size should be %d bytes\\n\",\n\t\t\t__func__, msg->size);\n\t\treturn ret;\n\t}\n\n\tmutex_lock(&bus->lock);\n\n\t/* Peek the bus to see if a msg exists, if it's not what we're expecting\n\t * then return cleanly else read the message from the bus.\n\t */\n\tcurr_gwp = saa7164_readl(bus->m_dwGetWritePos);\n\tcurr_grp = saa7164_readl(bus->m_dwGetReadPos);\n\n\tif (curr_gwp == curr_grp) {\n\t\tret = SAA_ERR_EMPTY;\n\t\tgoto out;\n\t}\n\n\tbytes_to_read = sizeof(*msg);\n\n\t/* Calculate write distance to current read position */\n\twrite_distance = 0;\n\tif (curr_gwp >= curr_grp)\n\t\t/* Write doesn't wrap around the ring */\n\t\twrite_distance = curr_gwp - curr_grp;\n\telse\n\t\t/* Write wraps around the ring */\n\t\twrite_distance = curr_gwp + bus->m_dwSizeGetRing - curr_grp;\n\n\tif (bytes_to_read > write_distance) {\n\t\tprintk(KERN_ERR \"%s() No message/response found\\n\", __func__);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Calculate the new read position */\n\tnew_grp = curr_grp + bytes_to_read;\n\tif (new_grp > bus->m_dwSizeGetRing) {\n\n\t\t/* Ring wraps */\n\t\tnew_grp -= bus->m_dwSizeGetRing;\n\t\tspace_rem = bus->m_dwSizeGetRing - curr_grp;\n\n\t\tmemcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, space_rem);\n\t\tmemcpy_fromio((u8 *)&msg_tmp + space_rem, bus->m_pdwGetRing,\n\t\t\tbytes_to_read - space_rem);\n\n\t} else {\n\t\t/* No wrapping */\n\t\tmemcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, bytes_to_read);\n\t}\n\t/* Convert from little endian to CPU */\n\tmsg_tmp.size = le16_to_cpu((__force __le16)msg_tmp.size);\n\tmsg_tmp.command = le32_to_cpu((__force __le32)msg_tmp.command);\n\tmsg_tmp.controlselector = le16_to_cpu((__force __le16)msg_tmp.controlselector);\n\tmemcpy(msg, &msg_tmp, sizeof(*msg));\n\n\t/* No need to update the read positions, because this was a peek */\n\t/* If the caller specifically want to peek, return */\n\tif (peekonly) {\n\t\tgoto peekout;\n\t}\n\n\t/* Check if the command/response matches what is expected */\n\tif ((msg_tmp.id != msg->id) || (msg_tmp.command != msg->command) ||\n\t\t(msg_tmp.controlselector != msg->controlselector) ||\n\t\t(msg_tmp.seqno != msg->seqno) || (msg_tmp.size != msg->size)) {\n\n\t\tprintk(KERN_ERR \"%s() Unexpected msg miss-match\\n\", __func__);\n\t\tsaa7164_bus_dumpmsg(dev, msg, buf);\n\t\tsaa7164_bus_dumpmsg(dev, &msg_tmp, NULL);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Get the actual command and response from the bus */\n\tbuf_size = msg->size;\n\n\tbytes_to_read = sizeof(*msg) + msg->size;\n\t/* Calculate write distance to current read position */\n\twrite_distance = 0;\n\tif (curr_gwp >= curr_grp)\n\t\t/* Write doesn't wrap around the ring */\n\t\twrite_distance = curr_gwp - curr_grp;\n\telse\n\t\t/* Write wraps around the ring */\n\t\twrite_distance = curr_gwp + bus->m_dwSizeGetRing - curr_grp;\n\n\tif (bytes_to_read > write_distance) {\n\t\tprintk(KERN_ERR \"%s() Invalid bus state, missing msg or mangled ring, faulty H/W / bad code?\\n\",\n\t\t __func__);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Calculate the new read position */\n\tnew_grp = curr_grp + bytes_to_read;\n\tif (new_grp > bus->m_dwSizeGetRing) {\n\n\t\t/* Ring wraps */\n\t\tnew_grp -= bus->m_dwSizeGetRing;\n\t\tspace_rem = bus->m_dwSizeGetRing - curr_grp;\n\n\t\tif (space_rem < sizeof(*msg)) {\n\t\t\tif (buf)\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + sizeof(*msg) -\n\t\t\t\t\tspace_rem, buf_size);\n\n\t\t} else if (space_rem == sizeof(*msg)) {\n\t\t\tif (buf)\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing, buf_size);\n\t\t} else {\n\t\t\t/* Additional data wraps around the ring */\n\t\t\tif (buf) {\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + curr_grp +\n\t\t\t\t\tsizeof(*msg), space_rem - sizeof(*msg));\n\t\t\t\tmemcpy_fromio(buf + space_rem - sizeof(*msg),\n\t\t\t\t\tbus->m_pdwGetRing, bytes_to_read -\n\t\t\t\t\tspace_rem);\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\t\t/* No wrapping */\n\t\tif (buf)\n\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + curr_grp + sizeof(*msg),\n\t\t\t\tbuf_size);\n\t}\n\n\t/* Update the read positions, adjusting the ring */\n\tsaa7164_writel(bus->m_dwGetReadPos, new_grp);\n\npeekout:\n\tret = SAA_OK;\nout:\n\tmutex_unlock(&bus->lock);\n\tsaa7164_bus_verify(dev);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1365,"sven_meta":{"func_name":"saa7164_bus_get","file_name":"drivers/media/pci/saa7164/saa7164-bus.c","commit_link":"github.com/stoth68000/media-tree/commit/354dd3924a2e43806774953de536257548b5002c","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#96-9e62ffd3a7bc","input":"static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n char\n page_geometry[MaxTextExtent];\n\n Image\n *image;\n\n MagickBooleanType\n logging;\n\n volatile int\n first_mng_object,\n object_id,\n term_chunk_found,\n skip_to_iend;\n\n volatile ssize_t\n image_count=0;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n offset;\n\n MngBox\n default_fb,\n fb,\n previous_fb;\n\n#if defined(MNG_INSERT_LAYERS)\n PixelPacket\n mng_background_color;\n#endif\n\n register unsigned char\n *p;\n\n register ssize_t\n i;\n\n size_t\n count;\n\n ssize_t\n loop_level;\n\n volatile short\n skipping_loop;\n\n#if defined(MNG_INSERT_LAYERS)\n unsigned int\n mandatory_back=0;\n#endif\n\n volatile unsigned int\n#ifdef MNG_OBJECT_BUFFERS\n mng_background_object=0,\n#endif\n mng_type=0; /* 0: PNG or JNG; 1: MNG; 2: MNG-LC; 3: MNG-VLC */\n\n size_t\n default_frame_timeout,\n frame_timeout,\n#if defined(MNG_INSERT_LAYERS)\n image_height,\n image_width,\n#endif\n length;\n\n /* These delays are all measured in image ticks_per_second,\n * not in MNG ticks_per_second\n */\n volatile size_t\n default_frame_delay,\n final_delay,\n final_image_delay,\n frame_delay,\n#if defined(MNG_INSERT_LAYERS)\n insert_layers,\n#endif\n mng_iterations=1,\n simplicity=0,\n subframe_height=0,\n subframe_width=0;\n\n previous_fb.top=0;\n previous_fb.bottom=0;\n previous_fb.left=0;\n previous_fb.right=0;\n default_fb.top=0;\n default_fb.bottom=0;\n default_fb.left=0;\n default_fb.right=0;\n\n logging=LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter ReadOneMNGImage()\");\n\n image=mng_info->image;\n\n if (LocaleCompare(image_info->magick,\"MNG\") == 0)\n {\n char\n magic_number[MaxTextExtent];\n\n /* Verify MNG signature. */\n count=(size_t) ReadBlob(image,8,(unsigned char *) magic_number);\n if (memcmp(magic_number,\"\\212MNG\\r\\n\\032\\n\",8) != 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n /* Initialize some nonzero members of the MngInfo structure. */\n for (i=0; i < MNG_MAX_OBJECTS; i++)\n {\n mng_info->object_clip[i].right=(ssize_t) PNG_UINT_31_MAX;\n mng_info->object_clip[i].bottom=(ssize_t) PNG_UINT_31_MAX;\n }\n mng_info->exists[0]=MagickTrue;\n }\n\n skipping_loop=(-1);\n first_mng_object=MagickTrue;\n mng_type=0;\n#if defined(MNG_INSERT_LAYERS)\n insert_layers=MagickFalse; /* should be False when converting or mogrifying */\n#endif\n default_frame_delay=0;\n default_frame_timeout=0;\n frame_delay=0;\n final_delay=1;\n mng_info->ticks_per_second=1UL*image->ticks_per_second;\n object_id=0;\n skip_to_iend=MagickFalse;\n term_chunk_found=MagickFalse;\n mng_info->framing_mode=1;\n#if defined(MNG_INSERT_LAYERS)\n mandatory_back=MagickFalse;\n#endif\n#if defined(MNG_INSERT_LAYERS)\n mng_background_color=image->background_color;\n#endif\n default_fb=mng_info->frame;\n previous_fb=mng_info->frame;\n do\n {\n char\n type[MaxTextExtent];\n\n if (LocaleCompare(image_info->magick,\"MNG\") == 0)\n {\n unsigned char\n *chunk;\n\n /*\n Read a new chunk.\n */\n type[0]='\\0';\n (void) ConcatenateMagickString(type,\"errr\",MaxTextExtent);\n length=ReadBlobMSBLong(image);\n count=(size_t) ReadBlob(image,4,(unsigned char *) type);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reading MNG chunk type %c%c%c%c, length: %.20g\",\n type[0],type[1],type[2],type[3],(double) length);\n\n if (length > PNG_UINT_31_MAX)\n {\n status=MagickFalse;\n break;\n }\n\n if (count == 0)\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n\n p=NULL;\n chunk=(unsigned char *) NULL;\n\n if (length != 0)\n {\n chunk=(unsigned char *) AcquireQuantumMemory(length+\n MagickPathExtent,sizeof(*chunk));\n\n if (chunk == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n for (i=0; i < (ssize_t) length; i++)\n {\n int\n c;\n\n c=ReadBlobByte(image);\n if (c == EOF)\n break;\n chunk[i]=(unsigned char) c;\n }\n\n p=chunk;\n }\n\n (void) ReadBlobMSBLong(image); /* read crc word */\n\n#if !defined(JNG_SUPPORTED)\n if (memcmp(type,mng_JHDR,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->jhdr_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"JNGCompressNotSupported\",\"`%s'\",image->filename);\n\n mng_info->jhdr_warning++;\n }\n#endif\n if (memcmp(type,mng_DHDR,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->dhdr_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"DeltaPNGNotSupported\",\"`%s'\",image->filename);\n\n mng_info->dhdr_warning++;\n }\n if (memcmp(type,mng_MEND,4) == 0)\n break;\n\n if (skip_to_iend)\n {\n if (memcmp(type,mng_IEND,4) == 0)\n skip_to_iend=MagickFalse;\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Skip to IEND.\");\n\n continue;\n }\n\n if (memcmp(type,mng_MHDR,4) == 0)\n {\n if (length != 28)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n }\n\n mng_info->mng_width=(size_t) ((p[0] << 24) | (p[1] << 16) |\n (p[2] << 8) | p[3]);\n\n mng_info->mng_height=(size_t) ((p[4] << 24) | (p[5] << 16) |\n (p[6] << 8) | p[7]);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MNG width: %.20g\",(double) mng_info->mng_width);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MNG height: %.20g\",(double) mng_info->mng_height);\n }\n\n p+=8;\n mng_info->ticks_per_second=(size_t) mng_get_long(p);\n\n if (mng_info->ticks_per_second == 0)\n default_frame_delay=0;\n\n else\n default_frame_delay=1UL*image->ticks_per_second/\n mng_info->ticks_per_second;\n\n frame_delay=default_frame_delay;\n simplicity=0;\n\n /* Skip nominal layer count, frame count, and play time */\n p+=16;\n simplicity=(size_t) mng_get_long(p);\n\n mng_type=1; /* Full MNG */\n\n if ((simplicity != 0) && ((simplicity | 11) == 11))\n mng_type=2; /* LC */\n\n if ((simplicity != 0) && ((simplicity | 9) == 9))\n mng_type=3; /* VLC */\n\n#if defined(MNG_INSERT_LAYERS)\n if (mng_type != 3)\n insert_layers=MagickTrue;\n#endif\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n mng_info->image=image;\n }\n\n if ((mng_info->mng_width > 65535L) ||\n (mng_info->mng_height > 65535L))\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(ImageError,\"WidthOrHeightExceedsLimit\");\n }\n\n (void) FormatLocaleString(page_geometry,MaxTextExtent,\n \"%.20gx%.20g+0+0\",(double) mng_info->mng_width,(double)\n mng_info->mng_height);\n\n mng_info->frame.left=0;\n mng_info->frame.right=(ssize_t) mng_info->mng_width;\n mng_info->frame.top=0;\n mng_info->frame.bottom=(ssize_t) mng_info->mng_height;\n mng_info->clip=default_fb=previous_fb=mng_info->frame;\n\n for (i=0; i < MNG_MAX_OBJECTS; i++)\n mng_info->object_clip[i]=mng_info->frame;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_TERM,4) == 0)\n {\n int\n repeat=0;\n\n if (length != 0)\n repeat=p[0];\n\n if (repeat == 3 && length > 8)\n {\n final_delay=(png_uint_32) mng_get_long(&p[2]);\n mng_iterations=(png_uint_32) mng_get_long(&p[6]);\n\n if (mng_iterations == PNG_UINT_31_MAX)\n mng_iterations=0;\n\n image->iterations=mng_iterations;\n term_chunk_found=MagickTrue;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" repeat=%d, final_delay=%.20g, iterations=%.20g\",\n repeat,(double) final_delay, (double) image->iterations);\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_DEFI,4) == 0)\n {\n if (mng_type == 3)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"DEFI chunk found in MNG-VLC datastream\",\"`%s'\",\n image->filename);\n\n if (length > 1)\n {\n object_id=(p[0] << 8) | p[1];\n\n if (mng_type == 2 && object_id != 0)\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),\n CoderError,\"Nonzero object_id in MNG-LC datastream\",\n \"`%s'\", image->filename);\n\n if (object_id > MNG_MAX_OBJECTS)\n {\n /*\n Instead of using a warning we should allocate a larger\n MngInfo structure and continue.\n */\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(), CoderError,\n \"object id too large\",\"`%s'\",image->filename);\n object_id=MNG_MAX_OBJECTS;\n }\n\n if (mng_info->exists[object_id])\n if (mng_info->frozen[object_id])\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"DEFI cannot redefine a frozen MNG object\",\"`%s'\",\n image->filename);\n continue;\n }\n\n mng_info->exists[object_id]=MagickTrue;\n\n if (length > 2)\n mng_info->invisible[object_id]=p[2];\n\n /*\n Extract object offset info.\n */\n if (length > 11)\n {\n mng_info->x_off[object_id]=(ssize_t) ((p[4] << 24) |\n (p[5] << 16) | (p[6] << 8) | p[7]);\n\n mng_info->y_off[object_id]=(ssize_t) ((p[8] << 24) |\n (p[9] << 16) | (p[10] << 8) | p[11]);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" x_off[%d]: %.20g, y_off[%d]: %.20g\",\n object_id,(double) mng_info->x_off[object_id],\n object_id,(double) mng_info->y_off[object_id]);\n }\n }\n\n /*\n Extract object clipping info.\n */\n \n if (length > 27)\n mng_info->object_clip[object_id]=\n mng_read_box(mng_info->frame,0, &p[12]);\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_bKGD,4) == 0)\n {\n mng_info->have_global_bkgd=MagickFalse;\n\n if (length > 5)\n {\n mng_info->mng_global_bkgd.red=\n ScaleShortToQuantum((unsigned short) ((p[0] << 8) | p[1]));\n\n mng_info->mng_global_bkgd.green=\n ScaleShortToQuantum((unsigned short) ((p[2] << 8) | p[3]));\n\n mng_info->mng_global_bkgd.blue=\n ScaleShortToQuantum((unsigned short) ((p[4] << 8) | p[5]));\n\n mng_info->have_global_bkgd=MagickTrue;\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_BACK,4) == 0)\n {\n#if defined(MNG_INSERT_LAYERS)\n if (length > 6)\n mandatory_back=p[6];\n\n else\n mandatory_back=0;\n\n if (mandatory_back && length > 5)\n {\n mng_background_color.red=\n ScaleShortToQuantum((unsigned short) ((p[0] << 8) | p[1]));\n\n mng_background_color.green=\n ScaleShortToQuantum((unsigned short) ((p[2] << 8) | p[3]));\n\n mng_background_color.blue=\n ScaleShortToQuantum((unsigned short) ((p[4] << 8) | p[5]));\n\n mng_background_color.opacity=OpaqueOpacity;\n }\n\n#ifdef MNG_OBJECT_BUFFERS\n if (length > 8)\n mng_background_object=(p[7] << 8) | p[8];\n#endif\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_PLTE,4) == 0)\n {\n /* Read global PLTE. */\n\n if (length && (length < 769))\n {\n if (mng_info->global_plte == (png_colorp) NULL)\n mng_info->global_plte=(png_colorp) AcquireQuantumMemory(256,\n sizeof(*mng_info->global_plte));\n\n for (i=0; i < (ssize_t) (length/3); i++)\n {\n mng_info->global_plte[i].red=p[3*i];\n mng_info->global_plte[i].green=p[3*i+1];\n mng_info->global_plte[i].blue=p[3*i+2];\n }\n\n mng_info->global_plte_length=(unsigned int) (length/3);\n }\n#ifdef MNG_LOOSE\n for ( ; i < 256; i++)\n {\n mng_info->global_plte[i].red=i;\n mng_info->global_plte[i].green=i;\n mng_info->global_plte[i].blue=i;\n }\n\n if (length != 0)\n mng_info->global_plte_length=256;\n#endif\n else\n mng_info->global_plte_length=0;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_tRNS,4) == 0)\n {\n /* read global tRNS */\n\n if (length > 0 && length < 257)\n for (i=0; i < (ssize_t) length; i++)\n mng_info->global_trns[i]=p[i];\n\n#ifdef MNG_LOOSE\n for ( ; i < 256; i++)\n mng_info->global_trns[i]=255;\n#endif\n mng_info->global_trns_length=(unsigned int) length;\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_gAMA,4) == 0)\n {\n if (length == 4)\n {\n ssize_t\n igamma;\n\n igamma=mng_get_long(p);\n mng_info->global_gamma=((float) igamma)*0.00001;\n mng_info->have_global_gama=MagickTrue;\n }\n\n else\n mng_info->have_global_gama=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_cHRM,4) == 0)\n {\n /* Read global cHRM */\n\n if (length == 32)\n {\n mng_info->global_chrm.white_point.x=0.00001*mng_get_long(p);\n mng_info->global_chrm.white_point.y=0.00001*mng_get_long(&p[4]);\n mng_info->global_chrm.red_primary.x=0.00001*mng_get_long(&p[8]);\n mng_info->global_chrm.red_primary.y=0.00001*\n mng_get_long(&p[12]);\n mng_info->global_chrm.green_primary.x=0.00001*\n mng_get_long(&p[16]);\n mng_info->global_chrm.green_primary.y=0.00001*\n mng_get_long(&p[20]);\n mng_info->global_chrm.blue_primary.x=0.00001*\n mng_get_long(&p[24]);\n mng_info->global_chrm.blue_primary.y=0.00001*\n mng_get_long(&p[28]);\n mng_info->have_global_chrm=MagickTrue;\n }\n else\n mng_info->have_global_chrm=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_sRGB,4) == 0)\n {\n /*\n Read global sRGB.\n */\n if (length != 0)\n {\n mng_info->global_srgb_intent=\n Magick_RenderingIntent_from_PNG_RenderingIntent(p[0]);\n mng_info->have_global_srgb=MagickTrue;\n }\n else\n mng_info->have_global_srgb=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_iCCP,4) == 0)\n {\n /* To do: */\n\n /*\n Read global iCCP.\n */\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if (memcmp(type,mng_FRAM,4) == 0)\n {\n if (mng_type == 3)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"FRAM chunk found in MNG-VLC datastream\",\"`%s'\",\n image->filename);\n\n if ((mng_info->framing_mode == 2) || (mng_info->framing_mode == 4))\n image->delay=frame_delay;\n\n frame_delay=default_frame_delay;\n frame_timeout=default_frame_timeout;\n fb=default_fb;\n\n if (length > 0)\n if (p[0])\n mng_info->framing_mode=p[0];\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_mode=%d\",mng_info->framing_mode);\n\n if (length > 6)\n {\n /* Note the delay and frame clipping boundaries. */\n\n p++; /* framing mode */\n\n while (*p && ((p-chunk) < (ssize_t) length))\n p++; /* frame name */\n\n p++; /* frame name terminator */\n\n if ((p-chunk) < (ssize_t) (length-4))\n {\n int\n change_delay,\n change_timeout,\n change_clipping;\n\n change_delay=(*p++);\n change_timeout=(*p++);\n change_clipping=(*p++);\n p++; /* change_sync */\n\n if (change_delay && (p-chunk) < (ssize_t) (length-4))\n {\n frame_delay=1UL*image->ticks_per_second*\n mng_get_long(p);\n\n if (mng_info->ticks_per_second != 0)\n frame_delay/=mng_info->ticks_per_second;\n\n else\n frame_delay=PNG_UINT_31_MAX;\n\n if (change_delay == 2)\n default_frame_delay=frame_delay;\n\n p+=4;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_delay=%.20g\",(double) frame_delay);\n }\n\n if (change_timeout && (p-chunk) < (ssize_t) (length-4))\n {\n frame_timeout=1UL*image->ticks_per_second*\n mng_get_long(p);\n\n if (mng_info->ticks_per_second != 0)\n frame_timeout/=mng_info->ticks_per_second;\n\n else\n frame_timeout=PNG_UINT_31_MAX;\n\n if (change_timeout == 2)\n default_frame_timeout=frame_timeout;\n\n p+=4;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_timeout=%.20g\",(double) frame_timeout);\n }\n\n if (change_clipping && (p-chunk) < (ssize_t) (length-17))\n {\n fb=mng_read_box(previous_fb,(char) p[0],&p[1]);\n p+=17;\n previous_fb=fb;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Frame_clip: L=%.20g R=%.20g T=%.20g B=%.20g\",\n (double) fb.left,(double) fb.right,(double) fb.top,\n (double) fb.bottom);\n\n if (change_clipping == 2)\n default_fb=fb;\n }\n }\n }\n mng_info->clip=fb;\n mng_info->clip=mng_minimum_box(fb,mng_info->frame);\n\n subframe_width=(size_t) (mng_info->clip.right\n -mng_info->clip.left);\n\n subframe_height=(size_t) (mng_info->clip.bottom\n -mng_info->clip.top);\n /*\n Insert a background layer behind the frame if framing_mode is 4.\n */\n#if defined(MNG_INSERT_LAYERS)\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" subframe_width=%.20g, subframe_height=%.20g\",(double)\n subframe_width,(double) subframe_height);\n\n if (insert_layers && (mng_info->framing_mode == 4) &&\n (subframe_width) && (subframe_height))\n {\n /* Allocate next image structure. */\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n image->columns=subframe_width;\n image->rows=subframe_height;\n image->page.width=subframe_width;\n image->page.height=subframe_height;\n image->page.x=mng_info->clip.left;\n image->page.y=mng_info->clip.top;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n image->delay=0;\n (void) SetImageBackgroundColor(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Insert backgd layer, L=%.20g, R=%.20g T=%.20g, B=%.20g\",\n (double) mng_info->clip.left,(double) mng_info->clip.right,\n (double) mng_info->clip.top,(double) mng_info->clip.bottom);\n }\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_CLIP,4) == 0)\n {\n unsigned int\n first_object,\n last_object;\n\n /*\n Read CLIP.\n */\n if (length > 3)\n {\n first_object=(p[0] << 8) | p[1];\n last_object=(p[2] << 8) | p[3];\n p+=4;\n\n for (i=(int) first_object; i <= (int) last_object; i++)\n {\n if (mng_info->exists[i] && !mng_info->frozen[i])\n {\n MngBox\n box;\n\n box=mng_info->object_clip[i];\n if ((p-chunk) < (ssize_t) (length-17))\n mng_info->object_clip[i]=\n mng_read_box(box,(char) p[0],&p[1]);\n }\n }\n\n }\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_SAVE,4) == 0)\n {\n for (i=1; i < MNG_MAX_OBJECTS; i++)\n if (mng_info->exists[i])\n {\n mng_info->frozen[i]=MagickTrue;\n#ifdef MNG_OBJECT_BUFFERS\n if (mng_info->ob[i] != (MngBuffer *) NULL)\n mng_info->ob[i]->frozen=MagickTrue;\n#endif\n }\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if ((memcmp(type,mng_DISC,4) == 0) || (memcmp(type,mng_SEEK,4) == 0))\n {\n /* Read DISC or SEEK. */\n\n if ((length == 0) || !memcmp(type,mng_SEEK,4))\n {\n for (i=1; i < MNG_MAX_OBJECTS; i++)\n MngInfoDiscardObject(mng_info,i);\n }\n\n else\n {\n register ssize_t\n j;\n\n for (j=1; j < (ssize_t) length; j+=2)\n {\n i=p[j-1] << 8 | p[j];\n MngInfoDiscardObject(mng_info,i);\n }\n }\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if (memcmp(type,mng_MOVE,4) == 0)\n {\n size_t\n first_object,\n last_object;\n\n /* read MOVE */\n\n if (length > 3)\n {\n first_object=(p[0] << 8) | p[1];\n last_object=(p[2] << 8) | p[3];\n p+=4;\n\n for (i=(ssize_t) first_object; i <= (ssize_t) last_object; i++)\n {\n if (mng_info->exists[i] && !mng_info->frozen[i] &&\n (p-chunk) < (ssize_t) (length-8))\n {\n MngPair\n new_pair;\n\n MngPair\n old_pair;\n\n old_pair.a=mng_info->x_off[i];\n old_pair.b=mng_info->y_off[i];\n new_pair=mng_read_pair(old_pair,(int) p[0],&p[1]);\n mng_info->x_off[i]=new_pair.a;\n mng_info->y_off[i]=new_pair.b;\n }\n }\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_LOOP,4) == 0)\n {\n ssize_t loop_iters=1;\n if (length > 4)\n {\n loop_level=chunk[0];\n mng_info->loop_active[loop_level]=1; /* mark loop active */\n\n /* Record starting point. */\n loop_iters=mng_get_long(&chunk[1]);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" LOOP level %.20g has %.20g iterations \",\n (double) loop_level, (double) loop_iters);\n\n if (loop_iters == 0)\n skipping_loop=loop_level;\n\n else\n {\n mng_info->loop_jump[loop_level]=TellBlob(image);\n mng_info->loop_count[loop_level]=loop_iters;\n }\n\n mng_info->loop_iteration[loop_level]=0;\n }\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_ENDL,4) == 0)\n {\n if (length > 0)\n {\n loop_level=chunk[0];\n\n if (skipping_loop > 0)\n {\n if (skipping_loop == loop_level)\n {\n /*\n Found end of zero-iteration loop.\n */\n skipping_loop=(-1);\n mng_info->loop_active[loop_level]=0;\n }\n }\n\n else\n {\n if (mng_info->loop_active[loop_level] == 1)\n {\n mng_info->loop_count[loop_level]--;\n mng_info->loop_iteration[loop_level]++;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ENDL: LOOP level %.20g has %.20g remaining iters \",\n (double) loop_level,(double)\n mng_info->loop_count[loop_level]);\n\n if (mng_info->loop_count[loop_level] != 0)\n {\n offset=SeekBlob(image,\n mng_info->loop_jump[loop_level], SEEK_SET);\n\n if (offset < 0)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(\n chunk);\n ThrowReaderException(CorruptImageError,\n \"ImproperImageHeader\");\n }\n }\n\n else\n {\n short\n last_level;\n\n /*\n Finished loop.\n */\n mng_info->loop_active[loop_level]=0;\n last_level=(-1);\n for (i=0; i < loop_level; i++)\n if (mng_info->loop_active[i] == 1)\n last_level=(short) i;\n loop_level=last_level;\n }\n }\n }\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_CLON,4) == 0)\n {\n if (mng_info->clon_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CLON is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->clon_warning++;\n }\n\n if (memcmp(type,mng_MAGN,4) == 0)\n {\n png_uint_16\n magn_first,\n magn_last,\n magn_mb,\n magn_ml,\n magn_mr,\n magn_mt,\n magn_mx,\n magn_my,\n magn_methx,\n magn_methy;\n\n if (length > 1)\n magn_first=(p[0] << 8) | p[1];\n\n else\n magn_first=0;\n\n if (length > 3)\n magn_last=(p[2] << 8) | p[3];\n\n else\n magn_last=magn_first;\n#ifndef MNG_OBJECT_BUFFERS\n if (magn_first || magn_last)\n if (mng_info->magn_warning == 0)\n {\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"MAGN is not implemented yet for nonzero objects\",\n \"`%s'\",image->filename);\n\n mng_info->magn_warning++;\n }\n#endif\n if (length > 4)\n magn_methx=p[4];\n\n else\n magn_methx=0;\n\n if (length > 6)\n magn_mx=(p[5] << 8) | p[6];\n\n else\n magn_mx=1;\n\n if (magn_mx == 0)\n magn_mx=1;\n\n if (length > 8)\n magn_my=(p[7] << 8) | p[8];\n\n else\n magn_my=magn_mx;\n\n if (magn_my == 0)\n magn_my=1;\n\n if (length > 10)\n magn_ml=(p[9] << 8) | p[10];\n\n else\n magn_ml=magn_mx;\n\n if (magn_ml == 0)\n magn_ml=1;\n\n if (length > 12)\n magn_mr=(p[11] << 8) | p[12];\n\n else\n magn_mr=magn_mx;\n\n if (magn_mr == 0)\n magn_mr=1;\n\n if (length > 14)\n magn_mt=(p[13] << 8) | p[14];\n\n else\n magn_mt=magn_my;\n\n if (magn_mt == 0)\n magn_mt=1;\n\n if (length > 16)\n magn_mb=(p[15] << 8) | p[16];\n\n else\n magn_mb=magn_my;\n\n if (magn_mb == 0)\n magn_mb=1;\n\n if (length > 17)\n magn_methy=p[17];\n\n else\n magn_methy=magn_methx;\n\n\n if (magn_methx > 5 || magn_methy > 5)\n if (mng_info->magn_warning == 0)\n {\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"Unknown MAGN method in MNG datastream\",\"`%s'\",\n image->filename);\n\n mng_info->magn_warning++;\n }\n#ifdef MNG_OBJECT_BUFFERS\n /* Magnify existing objects in the range magn_first to magn_last */\n#endif\n if (magn_first == 0 || magn_last == 0)\n {\n /* Save the magnification factors for object 0 */\n mng_info->magn_mb=magn_mb;\n mng_info->magn_ml=magn_ml;\n mng_info->magn_mr=magn_mr;\n mng_info->magn_mt=magn_mt;\n mng_info->magn_mx=magn_mx;\n mng_info->magn_my=magn_my;\n mng_info->magn_methx=magn_methx;\n mng_info->magn_methy=magn_methy;\n }\n }\n\n if (memcmp(type,mng_PAST,4) == 0)\n {\n if (mng_info->past_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"PAST is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->past_warning++;\n }\n\n if (memcmp(type,mng_SHOW,4) == 0)\n {\n if (mng_info->show_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"SHOW is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->show_warning++;\n }\n\n if (memcmp(type,mng_sBIT,4) == 0)\n {\n if (length < 4)\n mng_info->have_global_sbit=MagickFalse;\n\n else\n {\n mng_info->global_sbit.gray=p[0];\n mng_info->global_sbit.red=p[0];\n mng_info->global_sbit.green=p[1];\n mng_info->global_sbit.blue=p[2];\n mng_info->global_sbit.alpha=p[3];\n mng_info->have_global_sbit=MagickTrue;\n }\n }\n if (memcmp(type,mng_pHYs,4) == 0)\n {\n if (length > 8)\n {\n mng_info->global_x_pixels_per_unit=\n (size_t) mng_get_long(p);\n mng_info->global_y_pixels_per_unit=\n (size_t) mng_get_long(&p[4]);\n mng_info->global_phys_unit_type=p[8];\n mng_info->have_global_phys=MagickTrue;\n }\n\n else\n mng_info->have_global_phys=MagickFalse;\n }\n if (memcmp(type,mng_pHYg,4) == 0)\n {\n if (mng_info->phyg_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"pHYg is not implemented.\",\"`%s'\",image->filename);\n\n mng_info->phyg_warning++;\n }\n if (memcmp(type,mng_BASI,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->basi_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"BASI is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->basi_warning++;\n#ifdef MNG_BASI_SUPPORTED\n if (length > 11)\n {\n basi_width=(size_t) ((p[0] << 24) | (p[1] << 16) |\n (p[2] << 8) | p[3]);\n basi_height=(size_t) ((p[4] << 24) | (p[5] << 16) |\n (p[6] << 8) | p[7]);\n basi_color_type=p[8];\n basi_compression_method=p[9];\n basi_filter_type=p[10];\n basi_interlace_method=p[11];\n }\n if (length > 13)\n basi_red=(p[12] << 8) & p[13];\n\n else\n basi_red=0;\n\n if (length > 15)\n basi_green=(p[14] << 8) & p[15];\n\n else\n basi_green=0;\n\n if (length > 17)\n basi_blue=(p[16] << 8) & p[17];\n\n else\n basi_blue=0;\n\n if (length > 19)\n basi_alpha=(p[18] << 8) & p[19];\n\n else\n {\n if (basi_sample_depth == 16)\n basi_alpha=65535L;\n else\n basi_alpha=255;\n }\n\n if (length > 20)\n basi_viewable=p[20];\n\n else\n basi_viewable=0;\n\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_IHDR,4)\n#if defined(JNG_SUPPORTED)\n && memcmp(type,mng_JHDR,4)\n#endif\n )\n {\n /* Not an IHDR or JHDR chunk */\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n/* Process IHDR */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Processing %c%c%c%c chunk\",type[0],type[1],type[2],type[3]);\n\n mng_info->exists[object_id]=MagickTrue;\n mng_info->viewable[object_id]=MagickTrue;\n\n if (mng_info->invisible[object_id])\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Skipping invisible object\");\n\n skip_to_iend=MagickTrue;\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n#if defined(MNG_INSERT_LAYERS)\n if (length < 8)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n image_width=(size_t) mng_get_long(p);\n image_height=(size_t) mng_get_long(&p[4]);\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n /*\n Insert a transparent background layer behind the entire animation\n if it is not full screen.\n */\n#if defined(MNG_INSERT_LAYERS)\n if (insert_layers && mng_type && first_mng_object)\n {\n if ((mng_info->clip.left > 0) || (mng_info->clip.top > 0) ||\n (image_width < mng_info->mng_width) ||\n (mng_info->clip.right < (ssize_t) mng_info->mng_width) ||\n (image_height < mng_info->mng_height) ||\n (mng_info->clip.bottom < (ssize_t) mng_info->mng_height))\n {\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n /* Make a background rectangle. */\n\n image->delay=0;\n image->columns=mng_info->mng_width;\n image->rows=mng_info->mng_height;\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=0;\n image->page.y=0;\n image->background_color=mng_background_color;\n (void) SetImageBackgroundColor(image);\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Inserted transparent background layer, W=%.20g, H=%.20g\",\n (double) mng_info->mng_width,(double) mng_info->mng_height);\n }\n }\n /*\n Insert a background layer behind the upcoming image if\n framing_mode is 3, and we haven't already inserted one.\n */\n if (insert_layers && (mng_info->framing_mode == 3) &&\n (subframe_width) && (subframe_height) && (simplicity == 0 ||\n (simplicity & 0x08)))\n {\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n image->delay=0;\n image->columns=subframe_width;\n image->rows=subframe_height;\n image->page.width=subframe_width;\n image->page.height=subframe_height;\n image->page.x=mng_info->clip.left;\n image->page.y=mng_info->clip.top;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n (void) SetImageBackgroundColor(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Insert background layer, L=%.20g, R=%.20g T=%.20g, B=%.20g\",\n (double) mng_info->clip.left,(double) mng_info->clip.right,\n (double) mng_info->clip.top,(double) mng_info->clip.bottom);\n }\n#endif /* MNG_INSERT_LAYERS */\n first_mng_object=MagickFalse;\n\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n mng_info->image=image;\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n\n if (status == MagickFalse)\n break;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n if (mng_info->framing_mode == 1 || mng_info->framing_mode == 3)\n {\n image->delay=frame_delay;\n frame_delay=default_frame_delay;\n }\n\n else\n image->delay=0;\n\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=mng_info->x_off[object_id];\n image->page.y=mng_info->y_off[object_id];\n image->iterations=mng_iterations;\n\n /*\n Seek back to the beginning of the IHDR or JHDR chunk's length field.\n */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Seeking back to beginning of %c%c%c%c chunk\",type[0],type[1],\n type[2],type[3]);\n\n offset=SeekBlob(image,-((ssize_t) length+12),SEEK_CUR);\n\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n mng_info->image=image;\n mng_info->mng_type=mng_type;\n mng_info->object_id=object_id;\n\n if (memcmp(type,mng_IHDR,4) == 0)\n image=ReadOnePNGImage(mng_info,image_info,exception);\n\n#if defined(JNG_SUPPORTED)\n else\n image=ReadOneJNGImage(mng_info,image_info,exception);\n#endif\n\n if (image == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"exit ReadJNGImage() with error\");\n\n return((Image *) NULL);\n }\n\n if (image->columns == 0 || image->rows == 0)\n {\n (void) CloseBlob(image);\n return(DestroyImageList(image));\n }\n\n mng_info->image=image;\n\n if (mng_type)\n {\n MngBox\n crop_box;\n\n if (mng_info->magn_methx || mng_info->magn_methy)\n {\n png_uint_32\n magnified_height,\n magnified_width;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Processing MNG MAGN chunk\");\n\n if (mng_info->magn_methx == 1)\n {\n magnified_width=mng_info->magn_ml;\n\n if (image->columns > 1)\n magnified_width += mng_info->magn_mr;\n\n if (image->columns > 2)\n magnified_width += (png_uint_32)\n ((image->columns-2)*(mng_info->magn_mx));\n }\n\n else\n {\n magnified_width=(png_uint_32) image->columns;\n\n if (image->columns > 1)\n magnified_width += mng_info->magn_ml-1;\n\n if (image->columns > 2)\n magnified_width += mng_info->magn_mr-1;\n\n if (image->columns > 3)\n magnified_width += (png_uint_32)\n ((image->columns-3)*(mng_info->magn_mx-1));\n }\n\n if (mng_info->magn_methy == 1)\n {\n magnified_height=mng_info->magn_mt;\n\n if (image->rows > 1)\n magnified_height += mng_info->magn_mb;\n\n if (image->rows > 2)\n magnified_height += (png_uint_32)\n ((image->rows-2)*(mng_info->magn_my));\n }\n\n else\n {\n magnified_height=(png_uint_32) image->rows;\n\n if (image->rows > 1)\n magnified_height += mng_info->magn_mt-1;\n\n if (image->rows > 2)\n magnified_height += mng_info->magn_mb-1;\n\n if (image->rows > 3)\n magnified_height += (png_uint_32)\n ((image->rows-3)*(mng_info->magn_my-1));\n }\n\n if (magnified_height > image->rows ||\n magnified_width > image->columns)\n {\n Image\n *large_image;\n\n int\n yy;\n\n ssize_t\n m,\n y;\n\n register ssize_t\n x;\n\n register PixelPacket\n *n,\n *q;\n\n PixelPacket\n *next,\n *prev;\n\n png_uint_16\n magn_methx,\n magn_methy;\n\n /* Allocate next image structure. */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocate magnified image\");\n\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n large_image=SyncNextImageInList(image);\n\n large_image->columns=magnified_width;\n large_image->rows=magnified_height;\n\n magn_methx=mng_info->magn_methx;\n magn_methy=mng_info->magn_methy;\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n#define QM unsigned short\n if (magn_methx != 1 || magn_methy != 1)\n {\n /*\n Scale pixels to unsigned shorts to prevent\n overflow of intermediate values of interpolations\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n SetPixelRed(q,ScaleQuantumToShort(\n GetPixelRed(q)));\n SetPixelGreen(q,ScaleQuantumToShort(\n GetPixelGreen(q)));\n SetPixelBlue(q,ScaleQuantumToShort(\n GetPixelBlue(q)));\n SetPixelOpacity(q,ScaleQuantumToShort(\n GetPixelOpacity(q)));\n q++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n#else\n#define QM Quantum\n#endif\n\n if (image->matte != MagickFalse)\n (void) SetImageBackgroundColor(large_image);\n\n else\n {\n large_image->background_color.opacity=OpaqueOpacity;\n (void) SetImageBackgroundColor(large_image);\n\n if (magn_methx == 4)\n magn_methx=2;\n\n if (magn_methx == 5)\n magn_methx=3;\n\n if (magn_methy == 4)\n magn_methy=2;\n\n if (magn_methy == 5)\n magn_methy=3;\n }\n\n /* magnify the rows into the right side of the large image */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Magnify the rows to %.20g\",(double) large_image->rows);\n m=(ssize_t) mng_info->magn_mt;\n yy=0;\n length=(size_t) image->columns;\n next=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*next));\n prev=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*prev));\n\n if ((prev == (PixelPacket *) NULL) ||\n (next == (PixelPacket *) NULL))\n {\n image=DestroyImageList(image);\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n\n n=GetAuthenticPixels(image,0,0,image->columns,1,exception);\n (void) CopyMagickMemory(next,n,length);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (y == 0)\n m=(ssize_t) mng_info->magn_mt;\n\n else if (magn_methy > 1 && y == (ssize_t) image->rows-2)\n m=(ssize_t) mng_info->magn_mb;\n\n else if (magn_methy <= 1 && y == (ssize_t) image->rows-1)\n m=(ssize_t) mng_info->magn_mb;\n\n else if (magn_methy > 1 && y == (ssize_t) image->rows-1)\n m=1;\n\n else\n m=(ssize_t) mng_info->magn_my;\n\n n=prev;\n prev=next;\n next=n;\n\n if (y < (ssize_t) image->rows-1)\n {\n n=GetAuthenticPixels(image,0,y+1,image->columns,1,\n exception);\n (void) CopyMagickMemory(next,n,length);\n }\n\n for (i=0; i < m; i++, yy++)\n {\n register PixelPacket\n *pixels;\n\n assert(yy < (ssize_t) large_image->rows);\n pixels=prev;\n n=next;\n q=GetAuthenticPixels(large_image,0,yy,large_image->columns,\n 1,exception);\n q+=(large_image->columns-image->columns);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n /* To do: get color as function of indexes[x] */\n /*\n if (image->storage_class == PseudoClass)\n {\n }\n */\n\n if (magn_methy <= 1)\n {\n /* replicate previous */\n SetPixelRGBO(q,(pixels));\n }\n\n else if (magn_methy == 2 || magn_methy == 4)\n {\n if (i == 0)\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n /* Interpolate */\n SetPixelRed(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelRed(n)\n -GetPixelRed(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelRed(pixels)))));\n SetPixelGreen(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelGreen(n)\n -GetPixelGreen(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelGreen(pixels)))));\n SetPixelBlue(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelBlue(n)\n -GetPixelBlue(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelBlue(pixels)))));\n\n if (image->matte != MagickFalse)\n SetPixelOpacity(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelOpacity(n)\n -GetPixelOpacity(pixels)+m))\n /((ssize_t) (m*2))+\n GetPixelOpacity(pixels)))));\n }\n\n if (magn_methy == 4)\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n SetPixelOpacity(q,\n (*pixels).opacity+0);\n else\n SetPixelOpacity(q,\n (*n).opacity+0);\n }\n }\n\n else /* if (magn_methy == 3 || magn_methy == 5) */\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n SetPixelRGBO(q,(n));\n }\n\n if (magn_methy == 5)\n {\n SetPixelOpacity(q,\n (QM) (((ssize_t) (2*i*\n (GetPixelOpacity(n)\n -GetPixelOpacity(pixels))\n +m))/((ssize_t) (m*2))\n +GetPixelOpacity(pixels)));\n }\n }\n n++;\n q++;\n pixels++;\n } /* x */\n\n if (SyncAuthenticPixels(large_image,exception) == 0)\n break;\n\n } /* i */\n } /* y */\n\n prev=(PixelPacket *) RelinquishMagickMemory(prev);\n next=(PixelPacket *) RelinquishMagickMemory(next);\n\n length=image->columns;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Delete original image\");\n\n DeleteImageFromList(&image);\n\n image=large_image;\n\n mng_info->image=image;\n\n /* magnify the columns */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Magnify the columns to %.20g\",(double) image->columns);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register PixelPacket\n *pixels;\n\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n pixels=q+(image->columns-length);\n n=pixels+1;\n\n for (x=(ssize_t) (image->columns-length);\n x < (ssize_t) image->columns; x++)\n {\n /* To do: Rewrite using Get/Set***PixelComponent() */\n\n if (x == (ssize_t) (image->columns-length))\n m=(ssize_t) mng_info->magn_ml;\n\n else if (magn_methx > 1 && x == (ssize_t) image->columns-2)\n m=(ssize_t) mng_info->magn_mr;\n\n else if (magn_methx <= 1 && x == (ssize_t) image->columns-1)\n m=(ssize_t) mng_info->magn_mr;\n\n else if (magn_methx > 1 && x == (ssize_t) image->columns-1)\n m=1;\n\n else\n m=(ssize_t) mng_info->magn_mx;\n\n for (i=0; i < m; i++)\n {\n if (magn_methx <= 1)\n {\n /* replicate previous */\n SetPixelRGBO(q,(pixels));\n }\n\n else if (magn_methx == 2 || magn_methx == 4)\n {\n if (i == 0)\n {\n SetPixelRGBO(q,(pixels));\n }\n\n /* To do: Rewrite using Get/Set***PixelComponent() */\n else\n {\n /* Interpolate */\n SetPixelRed(q,\n (QM) ((2*i*(\n GetPixelRed(n)\n -GetPixelRed(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelRed(pixels)));\n\n SetPixelGreen(q,\n (QM) ((2*i*(\n GetPixelGreen(n)\n -GetPixelGreen(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelGreen(pixels)));\n\n SetPixelBlue(q,\n (QM) ((2*i*(\n GetPixelBlue(n)\n -GetPixelBlue(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelBlue(pixels)));\n if (image->matte != MagickFalse)\n SetPixelOpacity(q,\n (QM) ((2*i*(\n GetPixelOpacity(n)\n -GetPixelOpacity(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelOpacity(pixels)));\n }\n\n if (magn_methx == 4)\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelOpacity(q,\n GetPixelOpacity(pixels)+0);\n }\n else\n {\n SetPixelOpacity(q,\n GetPixelOpacity(n)+0);\n }\n }\n }\n\n else /* if (magn_methx == 3 || magn_methx == 5) */\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n SetPixelRGBO(q,(n));\n }\n\n if (magn_methx == 5)\n {\n /* Interpolate */\n SetPixelOpacity(q,\n (QM) ((2*i*( GetPixelOpacity(n)\n -GetPixelOpacity(pixels))+m)/\n ((ssize_t) (m*2))\n +GetPixelOpacity(pixels)));\n }\n }\n q++;\n }\n n++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n if (magn_methx != 1 || magn_methy != 1)\n {\n /*\n Rescale pixels to Quantum\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n SetPixelRed(q,ScaleShortToQuantum(\n GetPixelRed(q)));\n SetPixelGreen(q,ScaleShortToQuantum(\n GetPixelGreen(q)));\n SetPixelBlue(q,ScaleShortToQuantum(\n GetPixelBlue(q)));\n SetPixelOpacity(q,ScaleShortToQuantum(\n GetPixelOpacity(q)));\n q++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n#endif\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished MAGN processing\");\n }\n }\n\n /*\n Crop_box is with respect to the upper left corner of the MNG.\n */\n crop_box.left=mng_info->image_box.left+mng_info->x_off[object_id];\n crop_box.right=mng_info->image_box.right+mng_info->x_off[object_id];\n crop_box.top=mng_info->image_box.top+mng_info->y_off[object_id];\n crop_box.bottom=mng_info->image_box.bottom+mng_info->y_off[object_id];\n crop_box=mng_minimum_box(crop_box,mng_info->clip);\n crop_box=mng_minimum_box(crop_box,mng_info->frame);\n crop_box=mng_minimum_box(crop_box,mng_info->object_clip[object_id]);\n if ((crop_box.left != (mng_info->image_box.left\n +mng_info->x_off[object_id])) ||\n (crop_box.right != (mng_info->image_box.right\n +mng_info->x_off[object_id])) ||\n (crop_box.top != (mng_info->image_box.top\n +mng_info->y_off[object_id])) ||\n (crop_box.bottom != (mng_info->image_box.bottom\n +mng_info->y_off[object_id])))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Crop the PNG image\");\n\n if ((crop_box.left < crop_box.right) &&\n (crop_box.top < crop_box.bottom))\n {\n Image\n *im;\n\n RectangleInfo\n crop_info;\n\n /*\n Crop_info is with respect to the upper left corner of\n the image.\n */\n crop_info.x=(crop_box.left-mng_info->x_off[object_id]);\n crop_info.y=(crop_box.top-mng_info->y_off[object_id]);\n crop_info.width=(size_t) (crop_box.right-crop_box.left);\n crop_info.height=(size_t) (crop_box.bottom-crop_box.top);\n image->page.width=image->columns;\n image->page.height=image->rows;\n image->page.x=0;\n image->page.y=0;\n im=CropImage(image,&crop_info,exception);\n\n if (im != (Image *) NULL)\n {\n image->columns=im->columns;\n image->rows=im->rows;\n im=DestroyImage(im);\n image->page.width=image->columns;\n image->page.height=image->rows;\n image->page.x=crop_box.left;\n image->page.y=crop_box.top;\n }\n }\n\n else\n {\n /*\n No pixels in crop area. The MNG spec still requires\n a layer, though, so make a single transparent pixel in\n the top left corner.\n */\n image->columns=1;\n image->rows=1;\n image->colors=2;\n (void) SetImageBackgroundColor(image);\n image->page.width=1;\n image->page.height=1;\n image->page.x=0;\n image->page.y=0;\n }\n }\n#ifndef PNG_READ_EMPTY_PLTE_SUPPORTED\n image=mng_info->image;\n#endif\n }\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n /* PNG does not handle depths greater than 16 so reduce it even\n * if lossy, and promote any depths > 8 to 16.\n */\n if (image->depth > 16)\n image->depth=16;\n#endif\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 8)\n if (image->depth > 8)\n {\n /* To do: fill low byte properly */\n image->depth=16;\n }\n\n if (LosslessReduceDepthOK(image) != MagickFalse)\n image->depth = 8;\n#endif\n\n GetImageException(image,exception);\n\n if (image_info->number_scenes != 0)\n {\n if (mng_info->scenes_found >\n (ssize_t) (image_info->first_scene+image_info->number_scenes))\n break;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished reading image datastream.\");\n\n } while (LocaleCompare(image_info->magick,\"MNG\") == 0);\n\n (void) CloseBlob(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished reading all image datastreams.\");\n\n#if defined(MNG_INSERT_LAYERS)\n if (insert_layers && !mng_info->image_found && (mng_info->mng_width) &&\n (mng_info->mng_height))\n {\n /*\n Insert a background layer if nothing else was found.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No images found. Inserting a background layer.\");\n\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocation failed, returning NULL.\");\n\n return(DestroyImageList(image));\n }\n image=SyncNextImageInList(image);\n }\n image->columns=mng_info->mng_width;\n image->rows=mng_info->mng_height;\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=0;\n image->page.y=0;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n\n if (image_info->ping == MagickFalse)\n (void) SetImageBackgroundColor(image);\n\n mng_info->image_found++;\n }\n#endif\n image->iterations=mng_iterations;\n\n if (mng_iterations == 1)\n image->start_loop=MagickTrue;\n\n while (GetPreviousImageInList(image) != (Image *) NULL)\n {\n image_count++;\n if (image_count > 10*mng_info->image_found)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" No beginning\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"Linked list is corrupted, beginning of list not found\",\n \"`%s'\",image_info->filename);\n\n return(DestroyImageList(image));\n }\n\n image=GetPreviousImageInList(image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Corrupt list\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"Linked list is corrupted; next_image is NULL\",\"`%s'\",\n image_info->filename);\n }\n }\n\n if (mng_info->ticks_per_second && mng_info->image_found > 1 &&\n GetNextImageInList(image) ==\n (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" First image null\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"image->next for first image is NULL but shouldn't be.\",\n \"`%s'\",image_info->filename);\n }\n\n if (mng_info->image_found == 0)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No visible images found.\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"No visible images in file\",\"`%s'\",image_info->filename);\n\n return(DestroyImageList(image));\n }\n\n if (mng_info->ticks_per_second)\n final_delay=1UL*MagickMax(image->ticks_per_second,1L)*\n final_delay/mng_info->ticks_per_second;\n\n else\n image->start_loop=MagickTrue;\n\n /* Find final nonzero image delay */\n final_image_delay=0;\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n if (image->delay)\n final_image_delay=image->delay;\n\n image=GetNextImageInList(image);\n }\n\n if (final_delay < final_image_delay)\n final_delay=final_image_delay;\n\n image->delay=final_delay;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->delay=%.20g, final_delay=%.20g\",(double) image->delay,\n (double) final_delay);\n\n if (logging != MagickFalse)\n {\n int\n scene;\n\n scene=0;\n image=GetFirstImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Before coalesce:\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene 0 delay=%.20g\",(double) image->delay);\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n image=GetNextImageInList(image);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene %.20g delay=%.20g\",(double) scene++,(double) image->delay);\n }\n }\n\n image=GetFirstImageInList(image);\n#ifdef MNG_COALESCE_LAYERS\n if (insert_layers)\n {\n Image\n *next_image,\n *next;\n\n size_t\n scene;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Coalesce Images\");\n\n scene=image->scene;\n next_image=CoalesceImages(image,&image->exception);\n\n if (next_image == (Image *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n image=DestroyImageList(image);\n image=next_image;\n\n for (next=image; next != (Image *) NULL; next=next_image)\n {\n next->page.width=mng_info->mng_width;\n next->page.height=mng_info->mng_height;\n next->page.x=0;\n next->page.y=0;\n next->scene=scene++;\n next_image=GetNextImageInList(next);\n\n if (next_image == (Image *) NULL)\n break;\n\n if (next->delay == 0)\n {\n scene--;\n next_image->previous=GetPreviousImageInList(next);\n if (GetPreviousImageInList(next) == (Image *) NULL)\n image=next_image;\n else\n next->previous->next=next_image;\n next=DestroyImage(next);\n }\n }\n }\n#endif\n\n while (GetNextImageInList(image) != (Image *) NULL)\n image=GetNextImageInList(image);\n\n image->dispose=BackgroundDispose;\n\n if (logging != MagickFalse)\n {\n int\n scene;\n\n scene=0;\n image=GetFirstImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" After coalesce:\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene 0 delay=%.20g dispose=%.20g\",(double) image->delay,\n (double) image->dispose);\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n image=GetNextImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene %.20g delay=%.20g dispose=%.20g\",(double) scene++,\n (double) image->delay,(double) image->dispose);\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" exit ReadOneJNGImage();\");\n\n return(image);\n}","target":"static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n char\n page_geometry[MaxTextExtent];\n\n Image\n *image;\n\n MagickBooleanType\n logging;\n\n volatile int\n first_mng_object,\n object_id,\n term_chunk_found,\n skip_to_iend;\n\n volatile ssize_t\n image_count=0;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n offset;\n\n MngBox\n default_fb,\n fb,\n previous_fb;\n\n#if defined(MNG_INSERT_LAYERS)\n PixelPacket\n mng_background_color;\n#endif\n\n register unsigned char\n *p;\n\n register ssize_t\n i;\n\n size_t\n count;\n\n ssize_t\n loop_level;\n\n volatile short\n skipping_loop;\n\n#if defined(MNG_INSERT_LAYERS)\n unsigned int\n mandatory_back=0;\n#endif\n\n volatile unsigned int\n#ifdef MNG_OBJECT_BUFFERS\n mng_background_object=0,\n#endif\n mng_type=0; /* 0: PNG or JNG; 1: MNG; 2: MNG-LC; 3: MNG-VLC */\n\n size_t\n default_frame_timeout,\n frame_timeout,\n#if defined(MNG_INSERT_LAYERS)\n image_height,\n image_width,\n#endif\n length;\n\n /* These delays are all measured in image ticks_per_second,\n * not in MNG ticks_per_second\n */\n volatile size_t\n default_frame_delay,\n final_delay,\n final_image_delay,\n frame_delay,\n#if defined(MNG_INSERT_LAYERS)\n insert_layers,\n#endif\n mng_iterations=1,\n simplicity=0,\n subframe_height=0,\n subframe_width=0;\n\n previous_fb.top=0;\n previous_fb.bottom=0;\n previous_fb.left=0;\n previous_fb.right=0;\n default_fb.top=0;\n default_fb.bottom=0;\n default_fb.left=0;\n default_fb.right=0;\n\n logging=LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter ReadOneMNGImage()\");\n\n image=mng_info->image;\n\n if (LocaleCompare(image_info->magick,\"MNG\") == 0)\n {\n char\n magic_number[MaxTextExtent];\n\n /* Verify MNG signature. */\n count=(size_t) ReadBlob(image,8,(unsigned char *) magic_number);\n if (memcmp(magic_number,\"\\212MNG\\r\\n\\032\\n\",8) != 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n /* Initialize some nonzero members of the MngInfo structure. */\n for (i=0; i < MNG_MAX_OBJECTS; i++)\n {\n mng_info->object_clip[i].right=(ssize_t) PNG_UINT_31_MAX;\n mng_info->object_clip[i].bottom=(ssize_t) PNG_UINT_31_MAX;\n }\n mng_info->exists[0]=MagickTrue;\n }\n\n skipping_loop=(-1);\n first_mng_object=MagickTrue;\n mng_type=0;\n#if defined(MNG_INSERT_LAYERS)\n insert_layers=MagickFalse; /* should be False when converting or mogrifying */\n#endif\n default_frame_delay=0;\n default_frame_timeout=0;\n frame_delay=0;\n final_delay=1;\n mng_info->ticks_per_second=1UL*image->ticks_per_second;\n object_id=0;\n skip_to_iend=MagickFalse;\n term_chunk_found=MagickFalse;\n mng_info->framing_mode=1;\n#if defined(MNG_INSERT_LAYERS)\n mandatory_back=MagickFalse;\n#endif\n#if defined(MNG_INSERT_LAYERS)\n mng_background_color=image->background_color;\n#endif\n default_fb=mng_info->frame;\n previous_fb=mng_info->frame;\n do\n {\n char\n type[MaxTextExtent];\n\n if (LocaleCompare(image_info->magick,\"MNG\") == 0)\n {\n unsigned char\n *chunk;\n\n /*\n Read a new chunk.\n */\n type[0]='\\0';\n (void) ConcatenateMagickString(type,\"errr\",MaxTextExtent);\n length=ReadBlobMSBLong(image);\n count=(size_t) ReadBlob(image,4,(unsigned char *) type);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reading MNG chunk type %c%c%c%c, length: %.20g\",\n type[0],type[1],type[2],type[3],(double) length);\n\n if (length > PNG_UINT_31_MAX)\n {\n status=MagickFalse;\n break;\n }\n\n if (count == 0)\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n\n p=NULL;\n chunk=(unsigned char *) NULL;\n\n if (length != 0)\n {\n chunk=(unsigned char *) AcquireQuantumMemory(length+\n MagickPathExtent,sizeof(*chunk));\n\n if (chunk == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n for (i=0; i < (ssize_t) length; i++)\n {\n int\n c;\n\n c=ReadBlobByte(image);\n if (c == EOF)\n break;\n chunk[i]=(unsigned char) c;\n }\n\n p=chunk;\n }\n\n (void) ReadBlobMSBLong(image); /* read crc word */\n\n#if !defined(JNG_SUPPORTED)\n if (memcmp(type,mng_JHDR,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->jhdr_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"JNGCompressNotSupported\",\"`%s'\",image->filename);\n\n mng_info->jhdr_warning++;\n }\n#endif\n if (memcmp(type,mng_DHDR,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->dhdr_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"DeltaPNGNotSupported\",\"`%s'\",image->filename);\n\n mng_info->dhdr_warning++;\n }\n if (memcmp(type,mng_MEND,4) == 0)\n break;\n\n if (skip_to_iend)\n {\n if (memcmp(type,mng_IEND,4) == 0)\n skip_to_iend=MagickFalse;\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Skip to IEND.\");\n\n continue;\n }\n\n if (memcmp(type,mng_MHDR,4) == 0)\n {\n if (length != 28)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n }\n\n mng_info->mng_width=(size_t) ((p[0] << 24) | (p[1] << 16) |\n (p[2] << 8) | p[3]);\n\n mng_info->mng_height=(size_t) ((p[4] << 24) | (p[5] << 16) |\n (p[6] << 8) | p[7]);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MNG width: %.20g\",(double) mng_info->mng_width);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MNG height: %.20g\",(double) mng_info->mng_height);\n }\n\n p+=8;\n mng_info->ticks_per_second=(size_t) mng_get_long(p);\n\n if (mng_info->ticks_per_second == 0)\n default_frame_delay=0;\n\n else\n default_frame_delay=1UL*image->ticks_per_second/\n mng_info->ticks_per_second;\n\n frame_delay=default_frame_delay;\n simplicity=0;\n\n /* Skip nominal layer count, frame count, and play time */\n p+=16;\n simplicity=(size_t) mng_get_long(p);\n\n mng_type=1; /* Full MNG */\n\n if ((simplicity != 0) && ((simplicity | 11) == 11))\n mng_type=2; /* LC */\n\n if ((simplicity != 0) && ((simplicity | 9) == 9))\n mng_type=3; /* VLC */\n\n#if defined(MNG_INSERT_LAYERS)\n if (mng_type != 3)\n insert_layers=MagickTrue;\n#endif\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n mng_info->image=image;\n }\n\n if ((mng_info->mng_width > 65535L) ||\n (mng_info->mng_height > 65535L))\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(ImageError,\"WidthOrHeightExceedsLimit\");\n }\n\n (void) FormatLocaleString(page_geometry,MaxTextExtent,\n \"%.20gx%.20g+0+0\",(double) mng_info->mng_width,(double)\n mng_info->mng_height);\n\n mng_info->frame.left=0;\n mng_info->frame.right=(ssize_t) mng_info->mng_width;\n mng_info->frame.top=0;\n mng_info->frame.bottom=(ssize_t) mng_info->mng_height;\n mng_info->clip=default_fb=previous_fb=mng_info->frame;\n\n for (i=0; i < MNG_MAX_OBJECTS; i++)\n mng_info->object_clip[i]=mng_info->frame;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_TERM,4) == 0)\n {\n int\n repeat=0;\n\n if (length != 0)\n repeat=p[0];\n\n if (repeat == 3 && length > 8)\n {\n final_delay=(png_uint_32) mng_get_long(&p[2]);\n mng_iterations=(png_uint_32) mng_get_long(&p[6]);\n\n if (mng_iterations == PNG_UINT_31_MAX)\n mng_iterations=0;\n\n image->iterations=mng_iterations;\n term_chunk_found=MagickTrue;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" repeat=%d, final_delay=%.20g, iterations=%.20g\",\n repeat,(double) final_delay, (double) image->iterations);\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_DEFI,4) == 0)\n {\n if (mng_type == 3)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"DEFI chunk found in MNG-VLC datastream\",\"`%s'\",\n image->filename);\n\n if (length > 1)\n {\n object_id=(p[0] << 8) | p[1];\n\n if (mng_type == 2 && object_id != 0)\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),\n CoderError,\"Nonzero object_id in MNG-LC datastream\",\n \"`%s'\", image->filename);\n\n if (object_id > MNG_MAX_OBJECTS)\n {\n /*\n Instead of using a warning we should allocate a larger\n MngInfo structure and continue.\n */\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(), CoderError,\n \"object id too large\",\"`%s'\",image->filename);\n object_id=MNG_MAX_OBJECTS;\n }\n\n if (mng_info->exists[object_id])\n if (mng_info->frozen[object_id])\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"DEFI cannot redefine a frozen MNG object\",\"`%s'\",\n image->filename);\n continue;\n }\n\n mng_info->exists[object_id]=MagickTrue;\n\n if (length > 2)\n mng_info->invisible[object_id]=p[2];\n\n /*\n Extract object offset info.\n */\n if (length > 11)\n {\n mng_info->x_off[object_id]=(ssize_t) ((p[4] << 24) |\n (p[5] << 16) | (p[6] << 8) | p[7]);\n\n mng_info->y_off[object_id]=(ssize_t) ((p[8] << 24) |\n (p[9] << 16) | (p[10] << 8) | p[11]);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" x_off[%d]: %.20g, y_off[%d]: %.20g\",\n object_id,(double) mng_info->x_off[object_id],\n object_id,(double) mng_info->y_off[object_id]);\n }\n }\n\n /*\n Extract object clipping info.\n */\n \n if (length > 27)\n mng_info->object_clip[object_id]=\n mng_read_box(mng_info->frame,0, &p[12]);\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_bKGD,4) == 0)\n {\n mng_info->have_global_bkgd=MagickFalse;\n\n if (length > 5)\n {\n mng_info->mng_global_bkgd.red=\n ScaleShortToQuantum((unsigned short) ((p[0] << 8) | p[1]));\n\n mng_info->mng_global_bkgd.green=\n ScaleShortToQuantum((unsigned short) ((p[2] << 8) | p[3]));\n\n mng_info->mng_global_bkgd.blue=\n ScaleShortToQuantum((unsigned short) ((p[4] << 8) | p[5]));\n\n mng_info->have_global_bkgd=MagickTrue;\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_BACK,4) == 0)\n {\n#if defined(MNG_INSERT_LAYERS)\n if (length > 6)\n mandatory_back=p[6];\n\n else\n mandatory_back=0;\n\n if (mandatory_back && length > 5)\n {\n mng_background_color.red=\n ScaleShortToQuantum((unsigned short) ((p[0] << 8) | p[1]));\n\n mng_background_color.green=\n ScaleShortToQuantum((unsigned short) ((p[2] << 8) | p[3]));\n\n mng_background_color.blue=\n ScaleShortToQuantum((unsigned short) ((p[4] << 8) | p[5]));\n\n mng_background_color.opacity=OpaqueOpacity;\n }\n\n#ifdef MNG_OBJECT_BUFFERS\n if (length > 8)\n mng_background_object=(p[7] << 8) | p[8];\n#endif\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_PLTE,4) == 0)\n {\n /* Read global PLTE. */\n\n if (length && (length < 769))\n {\n if (mng_info->global_plte == (png_colorp) NULL)\n mng_info->global_plte=(png_colorp) AcquireQuantumMemory(256,\n sizeof(*mng_info->global_plte));\n\n for (i=0; i < (ssize_t) (length/3); i++)\n {\n mng_info->global_plte[i].red=p[3*i];\n mng_info->global_plte[i].green=p[3*i+1];\n mng_info->global_plte[i].blue=p[3*i+2];\n }\n\n mng_info->global_plte_length=(unsigned int) (length/3);\n }\n#ifdef MNG_LOOSE\n for ( ; i < 256; i++)\n {\n mng_info->global_plte[i].red=i;\n mng_info->global_plte[i].green=i;\n mng_info->global_plte[i].blue=i;\n }\n\n if (length != 0)\n mng_info->global_plte_length=256;\n#endif\n else\n mng_info->global_plte_length=0;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_tRNS,4) == 0)\n {\n /* read global tRNS */\n\n if (length > 0 && length < 257)\n for (i=0; i < (ssize_t) length; i++)\n mng_info->global_trns[i]=p[i];\n\n#ifdef MNG_LOOSE\n for ( ; i < 256; i++)\n mng_info->global_trns[i]=255;\n#endif\n mng_info->global_trns_length=(unsigned int) length;\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_gAMA,4) == 0)\n {\n if (length == 4)\n {\n ssize_t\n igamma;\n\n igamma=mng_get_long(p);\n mng_info->global_gamma=((float) igamma)*0.00001;\n mng_info->have_global_gama=MagickTrue;\n }\n\n else\n mng_info->have_global_gama=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_cHRM,4) == 0)\n {\n /* Read global cHRM */\n\n if (length == 32)\n {\n mng_info->global_chrm.white_point.x=0.00001*mng_get_long(p);\n mng_info->global_chrm.white_point.y=0.00001*mng_get_long(&p[4]);\n mng_info->global_chrm.red_primary.x=0.00001*mng_get_long(&p[8]);\n mng_info->global_chrm.red_primary.y=0.00001*\n mng_get_long(&p[12]);\n mng_info->global_chrm.green_primary.x=0.00001*\n mng_get_long(&p[16]);\n mng_info->global_chrm.green_primary.y=0.00001*\n mng_get_long(&p[20]);\n mng_info->global_chrm.blue_primary.x=0.00001*\n mng_get_long(&p[24]);\n mng_info->global_chrm.blue_primary.y=0.00001*\n mng_get_long(&p[28]);\n mng_info->have_global_chrm=MagickTrue;\n }\n else\n mng_info->have_global_chrm=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_sRGB,4) == 0)\n {\n /*\n Read global sRGB.\n */\n if (length != 0)\n {\n mng_info->global_srgb_intent=\n Magick_RenderingIntent_from_PNG_RenderingIntent(p[0]);\n mng_info->have_global_srgb=MagickTrue;\n }\n else\n mng_info->have_global_srgb=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_iCCP,4) == 0)\n {\n /* To do: */\n\n /*\n Read global iCCP.\n */\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if (memcmp(type,mng_FRAM,4) == 0)\n {\n if (mng_type == 3)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"FRAM chunk found in MNG-VLC datastream\",\"`%s'\",\n image->filename);\n\n if ((mng_info->framing_mode == 2) || (mng_info->framing_mode == 4))\n image->delay=frame_delay;\n\n frame_delay=default_frame_delay;\n frame_timeout=default_frame_timeout;\n fb=default_fb;\n\n if (length > 0)\n if (p[0])\n mng_info->framing_mode=p[0];\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_mode=%d\",mng_info->framing_mode);\n\n if (length > 6)\n {\n /* Note the delay and frame clipping boundaries. */\n\n p++; /* framing mode */\n\n while (*p && ((p-chunk) < (ssize_t) length))\n p++; /* frame name */\n\n p++; /* frame name terminator */\n\n if ((p-chunk) < (ssize_t) (length-4))\n {\n int\n change_delay,\n change_timeout,\n change_clipping;\n\n change_delay=(*p++);\n change_timeout=(*p++);\n change_clipping=(*p++);\n p++; /* change_sync */\n\n if (change_delay && (p-chunk) < (ssize_t) (length-4))\n {\n frame_delay=1UL*image->ticks_per_second*\n mng_get_long(p);\n\n if (mng_info->ticks_per_second != 0)\n frame_delay/=mng_info->ticks_per_second;\n\n else\n frame_delay=PNG_UINT_31_MAX;\n\n if (change_delay == 2)\n default_frame_delay=frame_delay;\n\n p+=4;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_delay=%.20g\",(double) frame_delay);\n }\n\n if (change_timeout && (p-chunk) < (ssize_t) (length-4))\n {\n frame_timeout=1UL*image->ticks_per_second*\n mng_get_long(p);\n\n if (mng_info->ticks_per_second != 0)\n frame_timeout/=mng_info->ticks_per_second;\n\n else\n frame_timeout=PNG_UINT_31_MAX;\n\n if (change_timeout == 2)\n default_frame_timeout=frame_timeout;\n\n p+=4;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_timeout=%.20g\",(double) frame_timeout);\n }\n\n if (change_clipping && (p-chunk) < (ssize_t) (length-17))\n {\n fb=mng_read_box(previous_fb,(char) p[0],&p[1]);\n p+=17;\n previous_fb=fb;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Frame_clip: L=%.20g R=%.20g T=%.20g B=%.20g\",\n (double) fb.left,(double) fb.right,(double) fb.top,\n (double) fb.bottom);\n\n if (change_clipping == 2)\n default_fb=fb;\n }\n }\n }\n mng_info->clip=fb;\n mng_info->clip=mng_minimum_box(fb,mng_info->frame);\n\n subframe_width=(size_t) (mng_info->clip.right\n -mng_info->clip.left);\n\n subframe_height=(size_t) (mng_info->clip.bottom\n -mng_info->clip.top);\n /*\n Insert a background layer behind the frame if framing_mode is 4.\n */\n#if defined(MNG_INSERT_LAYERS)\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" subframe_width=%.20g, subframe_height=%.20g\",(double)\n subframe_width,(double) subframe_height);\n\n if (insert_layers && (mng_info->framing_mode == 4) &&\n (subframe_width) && (subframe_height))\n {\n /* Allocate next image structure. */\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n image->columns=subframe_width;\n image->rows=subframe_height;\n image->page.width=subframe_width;\n image->page.height=subframe_height;\n image->page.x=mng_info->clip.left;\n image->page.y=mng_info->clip.top;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n image->delay=0;\n (void) SetImageBackgroundColor(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Insert backgd layer, L=%.20g, R=%.20g T=%.20g, B=%.20g\",\n (double) mng_info->clip.left,(double) mng_info->clip.right,\n (double) mng_info->clip.top,(double) mng_info->clip.bottom);\n }\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_CLIP,4) == 0)\n {\n unsigned int\n first_object,\n last_object;\n\n /*\n Read CLIP.\n */\n if (length > 3)\n {\n first_object=(p[0] << 8) | p[1];\n last_object=(p[2] << 8) | p[3];\n p+=4;\n\n for (i=(int) first_object; i <= (int) last_object; i++)\n {\n if (mng_info->exists[i] && !mng_info->frozen[i])\n {\n MngBox\n box;\n\n box=mng_info->object_clip[i];\n if ((p-chunk) < (ssize_t) (length-17))\n mng_info->object_clip[i]=\n mng_read_box(box,(char) p[0],&p[1]);\n }\n }\n\n }\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_SAVE,4) == 0)\n {\n for (i=1; i < MNG_MAX_OBJECTS; i++)\n if (mng_info->exists[i])\n {\n mng_info->frozen[i]=MagickTrue;\n#ifdef MNG_OBJECT_BUFFERS\n if (mng_info->ob[i] != (MngBuffer *) NULL)\n mng_info->ob[i]->frozen=MagickTrue;\n#endif\n }\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if ((memcmp(type,mng_DISC,4) == 0) || (memcmp(type,mng_SEEK,4) == 0))\n {\n /* Read DISC or SEEK. */\n\n if ((length == 0) || !memcmp(type,mng_SEEK,4))\n {\n for (i=1; i < MNG_MAX_OBJECTS; i++)\n MngInfoDiscardObject(mng_info,i);\n }\n\n else\n {\n register ssize_t\n j;\n\n for (j=1; j < (ssize_t) length; j+=2)\n {\n i=p[j-1] << 8 | p[j];\n MngInfoDiscardObject(mng_info,i);\n }\n }\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if (memcmp(type,mng_MOVE,4) == 0)\n {\n size_t\n first_object,\n last_object;\n\n /* read MOVE */\n\n if (length > 3)\n {\n first_object=(p[0] << 8) | p[1];\n last_object=(p[2] << 8) | p[3];\n p+=4;\n\n for (i=(ssize_t) first_object; i <= (ssize_t) last_object; i++)\n {\n if ((i < 0) || (i >= MNG_MAX_OBJECTS))\n continue;\n if (mng_info->exists[i] && !mng_info->frozen[i] &&\n (p-chunk) < (ssize_t) (length-8))\n {\n MngPair\n new_pair;\n\n MngPair\n old_pair;\n\n old_pair.a=mng_info->x_off[i];\n old_pair.b=mng_info->y_off[i];\n new_pair=mng_read_pair(old_pair,(int) p[0],&p[1]);\n mng_info->x_off[i]=new_pair.a;\n mng_info->y_off[i]=new_pair.b;\n }\n }\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_LOOP,4) == 0)\n {\n ssize_t loop_iters=1;\n if (length > 4)\n {\n loop_level=chunk[0];\n mng_info->loop_active[loop_level]=1; /* mark loop active */\n\n /* Record starting point. */\n loop_iters=mng_get_long(&chunk[1]);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" LOOP level %.20g has %.20g iterations \",\n (double) loop_level, (double) loop_iters);\n\n if (loop_iters == 0)\n skipping_loop=loop_level;\n\n else\n {\n mng_info->loop_jump[loop_level]=TellBlob(image);\n mng_info->loop_count[loop_level]=loop_iters;\n }\n\n mng_info->loop_iteration[loop_level]=0;\n }\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_ENDL,4) == 0)\n {\n if (length > 0)\n {\n loop_level=chunk[0];\n\n if (skipping_loop > 0)\n {\n if (skipping_loop == loop_level)\n {\n /*\n Found end of zero-iteration loop.\n */\n skipping_loop=(-1);\n mng_info->loop_active[loop_level]=0;\n }\n }\n\n else\n {\n if (mng_info->loop_active[loop_level] == 1)\n {\n mng_info->loop_count[loop_level]--;\n mng_info->loop_iteration[loop_level]++;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ENDL: LOOP level %.20g has %.20g remaining iters \",\n (double) loop_level,(double)\n mng_info->loop_count[loop_level]);\n\n if (mng_info->loop_count[loop_level] != 0)\n {\n offset=SeekBlob(image,\n mng_info->loop_jump[loop_level], SEEK_SET);\n\n if (offset < 0)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(\n chunk);\n ThrowReaderException(CorruptImageError,\n \"ImproperImageHeader\");\n }\n }\n\n else\n {\n short\n last_level;\n\n /*\n Finished loop.\n */\n mng_info->loop_active[loop_level]=0;\n last_level=(-1);\n for (i=0; i < loop_level; i++)\n if (mng_info->loop_active[i] == 1)\n last_level=(short) i;\n loop_level=last_level;\n }\n }\n }\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_CLON,4) == 0)\n {\n if (mng_info->clon_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CLON is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->clon_warning++;\n }\n\n if (memcmp(type,mng_MAGN,4) == 0)\n {\n png_uint_16\n magn_first,\n magn_last,\n magn_mb,\n magn_ml,\n magn_mr,\n magn_mt,\n magn_mx,\n magn_my,\n magn_methx,\n magn_methy;\n\n if (length > 1)\n magn_first=(p[0] << 8) | p[1];\n\n else\n magn_first=0;\n\n if (length > 3)\n magn_last=(p[2] << 8) | p[3];\n\n else\n magn_last=magn_first;\n#ifndef MNG_OBJECT_BUFFERS\n if (magn_first || magn_last)\n if (mng_info->magn_warning == 0)\n {\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"MAGN is not implemented yet for nonzero objects\",\n \"`%s'\",image->filename);\n\n mng_info->magn_warning++;\n }\n#endif\n if (length > 4)\n magn_methx=p[4];\n\n else\n magn_methx=0;\n\n if (length > 6)\n magn_mx=(p[5] << 8) | p[6];\n\n else\n magn_mx=1;\n\n if (magn_mx == 0)\n magn_mx=1;\n\n if (length > 8)\n magn_my=(p[7] << 8) | p[8];\n\n else\n magn_my=magn_mx;\n\n if (magn_my == 0)\n magn_my=1;\n\n if (length > 10)\n magn_ml=(p[9] << 8) | p[10];\n\n else\n magn_ml=magn_mx;\n\n if (magn_ml == 0)\n magn_ml=1;\n\n if (length > 12)\n magn_mr=(p[11] << 8) | p[12];\n\n else\n magn_mr=magn_mx;\n\n if (magn_mr == 0)\n magn_mr=1;\n\n if (length > 14)\n magn_mt=(p[13] << 8) | p[14];\n\n else\n magn_mt=magn_my;\n\n if (magn_mt == 0)\n magn_mt=1;\n\n if (length > 16)\n magn_mb=(p[15] << 8) | p[16];\n\n else\n magn_mb=magn_my;\n\n if (magn_mb == 0)\n magn_mb=1;\n\n if (length > 17)\n magn_methy=p[17];\n\n else\n magn_methy=magn_methx;\n\n\n if (magn_methx > 5 || magn_methy > 5)\n if (mng_info->magn_warning == 0)\n {\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"Unknown MAGN method in MNG datastream\",\"`%s'\",\n image->filename);\n\n mng_info->magn_warning++;\n }\n#ifdef MNG_OBJECT_BUFFERS\n /* Magnify existing objects in the range magn_first to magn_last */\n#endif\n if (magn_first == 0 || magn_last == 0)\n {\n /* Save the magnification factors for object 0 */\n mng_info->magn_mb=magn_mb;\n mng_info->magn_ml=magn_ml;\n mng_info->magn_mr=magn_mr;\n mng_info->magn_mt=magn_mt;\n mng_info->magn_mx=magn_mx;\n mng_info->magn_my=magn_my;\n mng_info->magn_methx=magn_methx;\n mng_info->magn_methy=magn_methy;\n }\n }\n\n if (memcmp(type,mng_PAST,4) == 0)\n {\n if (mng_info->past_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"PAST is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->past_warning++;\n }\n\n if (memcmp(type,mng_SHOW,4) == 0)\n {\n if (mng_info->show_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"SHOW is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->show_warning++;\n }\n\n if (memcmp(type,mng_sBIT,4) == 0)\n {\n if (length < 4)\n mng_info->have_global_sbit=MagickFalse;\n\n else\n {\n mng_info->global_sbit.gray=p[0];\n mng_info->global_sbit.red=p[0];\n mng_info->global_sbit.green=p[1];\n mng_info->global_sbit.blue=p[2];\n mng_info->global_sbit.alpha=p[3];\n mng_info->have_global_sbit=MagickTrue;\n }\n }\n if (memcmp(type,mng_pHYs,4) == 0)\n {\n if (length > 8)\n {\n mng_info->global_x_pixels_per_unit=\n (size_t) mng_get_long(p);\n mng_info->global_y_pixels_per_unit=\n (size_t) mng_get_long(&p[4]);\n mng_info->global_phys_unit_type=p[8];\n mng_info->have_global_phys=MagickTrue;\n }\n\n else\n mng_info->have_global_phys=MagickFalse;\n }\n if (memcmp(type,mng_pHYg,4) == 0)\n {\n if (mng_info->phyg_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"pHYg is not implemented.\",\"`%s'\",image->filename);\n\n mng_info->phyg_warning++;\n }\n if (memcmp(type,mng_BASI,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->basi_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"BASI is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->basi_warning++;\n#ifdef MNG_BASI_SUPPORTED\n if (length > 11)\n {\n basi_width=(size_t) ((p[0] << 24) | (p[1] << 16) |\n (p[2] << 8) | p[3]);\n basi_height=(size_t) ((p[4] << 24) | (p[5] << 16) |\n (p[6] << 8) | p[7]);\n basi_color_type=p[8];\n basi_compression_method=p[9];\n basi_filter_type=p[10];\n basi_interlace_method=p[11];\n }\n if (length > 13)\n basi_red=(p[12] << 8) & p[13];\n\n else\n basi_red=0;\n\n if (length > 15)\n basi_green=(p[14] << 8) & p[15];\n\n else\n basi_green=0;\n\n if (length > 17)\n basi_blue=(p[16] << 8) & p[17];\n\n else\n basi_blue=0;\n\n if (length > 19)\n basi_alpha=(p[18] << 8) & p[19];\n\n else\n {\n if (basi_sample_depth == 16)\n basi_alpha=65535L;\n else\n basi_alpha=255;\n }\n\n if (length > 20)\n basi_viewable=p[20];\n\n else\n basi_viewable=0;\n\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_IHDR,4)\n#if defined(JNG_SUPPORTED)\n && memcmp(type,mng_JHDR,4)\n#endif\n )\n {\n /* Not an IHDR or JHDR chunk */\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n/* Process IHDR */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Processing %c%c%c%c chunk\",type[0],type[1],type[2],type[3]);\n\n mng_info->exists[object_id]=MagickTrue;\n mng_info->viewable[object_id]=MagickTrue;\n\n if (mng_info->invisible[object_id])\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Skipping invisible object\");\n\n skip_to_iend=MagickTrue;\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n#if defined(MNG_INSERT_LAYERS)\n if (length < 8)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n image_width=(size_t) mng_get_long(p);\n image_height=(size_t) mng_get_long(&p[4]);\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n /*\n Insert a transparent background layer behind the entire animation\n if it is not full screen.\n */\n#if defined(MNG_INSERT_LAYERS)\n if (insert_layers && mng_type && first_mng_object)\n {\n if ((mng_info->clip.left > 0) || (mng_info->clip.top > 0) ||\n (image_width < mng_info->mng_width) ||\n (mng_info->clip.right < (ssize_t) mng_info->mng_width) ||\n (image_height < mng_info->mng_height) ||\n (mng_info->clip.bottom < (ssize_t) mng_info->mng_height))\n {\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n /* Make a background rectangle. */\n\n image->delay=0;\n image->columns=mng_info->mng_width;\n image->rows=mng_info->mng_height;\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=0;\n image->page.y=0;\n image->background_color=mng_background_color;\n (void) SetImageBackgroundColor(image);\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Inserted transparent background layer, W=%.20g, H=%.20g\",\n (double) mng_info->mng_width,(double) mng_info->mng_height);\n }\n }\n /*\n Insert a background layer behind the upcoming image if\n framing_mode is 3, and we haven't already inserted one.\n */\n if (insert_layers && (mng_info->framing_mode == 3) &&\n (subframe_width) && (subframe_height) && (simplicity == 0 ||\n (simplicity & 0x08)))\n {\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n image->delay=0;\n image->columns=subframe_width;\n image->rows=subframe_height;\n image->page.width=subframe_width;\n image->page.height=subframe_height;\n image->page.x=mng_info->clip.left;\n image->page.y=mng_info->clip.top;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n (void) SetImageBackgroundColor(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Insert background layer, L=%.20g, R=%.20g T=%.20g, B=%.20g\",\n (double) mng_info->clip.left,(double) mng_info->clip.right,\n (double) mng_info->clip.top,(double) mng_info->clip.bottom);\n }\n#endif /* MNG_INSERT_LAYERS */\n first_mng_object=MagickFalse;\n\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n mng_info->image=image;\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n\n if (status == MagickFalse)\n break;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n if (mng_info->framing_mode == 1 || mng_info->framing_mode == 3)\n {\n image->delay=frame_delay;\n frame_delay=default_frame_delay;\n }\n\n else\n image->delay=0;\n\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=mng_info->x_off[object_id];\n image->page.y=mng_info->y_off[object_id];\n image->iterations=mng_iterations;\n\n /*\n Seek back to the beginning of the IHDR or JHDR chunk's length field.\n */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Seeking back to beginning of %c%c%c%c chunk\",type[0],type[1],\n type[2],type[3]);\n\n offset=SeekBlob(image,-((ssize_t) length+12),SEEK_CUR);\n\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n mng_info->image=image;\n mng_info->mng_type=mng_type;\n mng_info->object_id=object_id;\n\n if (memcmp(type,mng_IHDR,4) == 0)\n image=ReadOnePNGImage(mng_info,image_info,exception);\n\n#if defined(JNG_SUPPORTED)\n else\n image=ReadOneJNGImage(mng_info,image_info,exception);\n#endif\n\n if (image == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"exit ReadJNGImage() with error\");\n\n return((Image *) NULL);\n }\n\n if (image->columns == 0 || image->rows == 0)\n {\n (void) CloseBlob(image);\n return(DestroyImageList(image));\n }\n\n mng_info->image=image;\n\n if (mng_type)\n {\n MngBox\n crop_box;\n\n if (mng_info->magn_methx || mng_info->magn_methy)\n {\n png_uint_32\n magnified_height,\n magnified_width;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Processing MNG MAGN chunk\");\n\n if (mng_info->magn_methx == 1)\n {\n magnified_width=mng_info->magn_ml;\n\n if (image->columns > 1)\n magnified_width += mng_info->magn_mr;\n\n if (image->columns > 2)\n magnified_width += (png_uint_32)\n ((image->columns-2)*(mng_info->magn_mx));\n }\n\n else\n {\n magnified_width=(png_uint_32) image->columns;\n\n if (image->columns > 1)\n magnified_width += mng_info->magn_ml-1;\n\n if (image->columns > 2)\n magnified_width += mng_info->magn_mr-1;\n\n if (image->columns > 3)\n magnified_width += (png_uint_32)\n ((image->columns-3)*(mng_info->magn_mx-1));\n }\n\n if (mng_info->magn_methy == 1)\n {\n magnified_height=mng_info->magn_mt;\n\n if (image->rows > 1)\n magnified_height += mng_info->magn_mb;\n\n if (image->rows > 2)\n magnified_height += (png_uint_32)\n ((image->rows-2)*(mng_info->magn_my));\n }\n\n else\n {\n magnified_height=(png_uint_32) image->rows;\n\n if (image->rows > 1)\n magnified_height += mng_info->magn_mt-1;\n\n if (image->rows > 2)\n magnified_height += mng_info->magn_mb-1;\n\n if (image->rows > 3)\n magnified_height += (png_uint_32)\n ((image->rows-3)*(mng_info->magn_my-1));\n }\n\n if (magnified_height > image->rows ||\n magnified_width > image->columns)\n {\n Image\n *large_image;\n\n int\n yy;\n\n ssize_t\n m,\n y;\n\n register ssize_t\n x;\n\n register PixelPacket\n *n,\n *q;\n\n PixelPacket\n *next,\n *prev;\n\n png_uint_16\n magn_methx,\n magn_methy;\n\n /* Allocate next image structure. */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocate magnified image\");\n\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n large_image=SyncNextImageInList(image);\n\n large_image->columns=magnified_width;\n large_image->rows=magnified_height;\n\n magn_methx=mng_info->magn_methx;\n magn_methy=mng_info->magn_methy;\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n#define QM unsigned short\n if (magn_methx != 1 || magn_methy != 1)\n {\n /*\n Scale pixels to unsigned shorts to prevent\n overflow of intermediate values of interpolations\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n SetPixelRed(q,ScaleQuantumToShort(\n GetPixelRed(q)));\n SetPixelGreen(q,ScaleQuantumToShort(\n GetPixelGreen(q)));\n SetPixelBlue(q,ScaleQuantumToShort(\n GetPixelBlue(q)));\n SetPixelOpacity(q,ScaleQuantumToShort(\n GetPixelOpacity(q)));\n q++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n#else\n#define QM Quantum\n#endif\n\n if (image->matte != MagickFalse)\n (void) SetImageBackgroundColor(large_image);\n\n else\n {\n large_image->background_color.opacity=OpaqueOpacity;\n (void) SetImageBackgroundColor(large_image);\n\n if (magn_methx == 4)\n magn_methx=2;\n\n if (magn_methx == 5)\n magn_methx=3;\n\n if (magn_methy == 4)\n magn_methy=2;\n\n if (magn_methy == 5)\n magn_methy=3;\n }\n\n /* magnify the rows into the right side of the large image */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Magnify the rows to %.20g\",(double) large_image->rows);\n m=(ssize_t) mng_info->magn_mt;\n yy=0;\n length=(size_t) image->columns;\n next=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*next));\n prev=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*prev));\n\n if ((prev == (PixelPacket *) NULL) ||\n (next == (PixelPacket *) NULL))\n {\n image=DestroyImageList(image);\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n\n n=GetAuthenticPixels(image,0,0,image->columns,1,exception);\n (void) CopyMagickMemory(next,n,length);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (y == 0)\n m=(ssize_t) mng_info->magn_mt;\n\n else if (magn_methy > 1 && y == (ssize_t) image->rows-2)\n m=(ssize_t) mng_info->magn_mb;\n\n else if (magn_methy <= 1 && y == (ssize_t) image->rows-1)\n m=(ssize_t) mng_info->magn_mb;\n\n else if (magn_methy > 1 && y == (ssize_t) image->rows-1)\n m=1;\n\n else\n m=(ssize_t) mng_info->magn_my;\n\n n=prev;\n prev=next;\n next=n;\n\n if (y < (ssize_t) image->rows-1)\n {\n n=GetAuthenticPixels(image,0,y+1,image->columns,1,\n exception);\n (void) CopyMagickMemory(next,n,length);\n }\n\n for (i=0; i < m; i++, yy++)\n {\n register PixelPacket\n *pixels;\n\n assert(yy < (ssize_t) large_image->rows);\n pixels=prev;\n n=next;\n q=GetAuthenticPixels(large_image,0,yy,large_image->columns,\n 1,exception);\n q+=(large_image->columns-image->columns);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n /* To do: get color as function of indexes[x] */\n /*\n if (image->storage_class == PseudoClass)\n {\n }\n */\n\n if (magn_methy <= 1)\n {\n /* replicate previous */\n SetPixelRGBO(q,(pixels));\n }\n\n else if (magn_methy == 2 || magn_methy == 4)\n {\n if (i == 0)\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n /* Interpolate */\n SetPixelRed(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelRed(n)\n -GetPixelRed(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelRed(pixels)))));\n SetPixelGreen(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelGreen(n)\n -GetPixelGreen(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelGreen(pixels)))));\n SetPixelBlue(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelBlue(n)\n -GetPixelBlue(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelBlue(pixels)))));\n\n if (image->matte != MagickFalse)\n SetPixelOpacity(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelOpacity(n)\n -GetPixelOpacity(pixels)+m))\n /((ssize_t) (m*2))+\n GetPixelOpacity(pixels)))));\n }\n\n if (magn_methy == 4)\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n SetPixelOpacity(q,\n (*pixels).opacity+0);\n else\n SetPixelOpacity(q,\n (*n).opacity+0);\n }\n }\n\n else /* if (magn_methy == 3 || magn_methy == 5) */\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n SetPixelRGBO(q,(n));\n }\n\n if (magn_methy == 5)\n {\n SetPixelOpacity(q,\n (QM) (((ssize_t) (2*i*\n (GetPixelOpacity(n)\n -GetPixelOpacity(pixels))\n +m))/((ssize_t) (m*2))\n +GetPixelOpacity(pixels)));\n }\n }\n n++;\n q++;\n pixels++;\n } /* x */\n\n if (SyncAuthenticPixels(large_image,exception) == 0)\n break;\n\n } /* i */\n } /* y */\n\n prev=(PixelPacket *) RelinquishMagickMemory(prev);\n next=(PixelPacket *) RelinquishMagickMemory(next);\n\n length=image->columns;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Delete original image\");\n\n DeleteImageFromList(&image);\n\n image=large_image;\n\n mng_info->image=image;\n\n /* magnify the columns */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Magnify the columns to %.20g\",(double) image->columns);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register PixelPacket\n *pixels;\n\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n pixels=q+(image->columns-length);\n n=pixels+1;\n\n for (x=(ssize_t) (image->columns-length);\n x < (ssize_t) image->columns; x++)\n {\n /* To do: Rewrite using Get/Set***PixelComponent() */\n\n if (x == (ssize_t) (image->columns-length))\n m=(ssize_t) mng_info->magn_ml;\n\n else if (magn_methx > 1 && x == (ssize_t) image->columns-2)\n m=(ssize_t) mng_info->magn_mr;\n\n else if (magn_methx <= 1 && x == (ssize_t) image->columns-1)\n m=(ssize_t) mng_info->magn_mr;\n\n else if (magn_methx > 1 && x == (ssize_t) image->columns-1)\n m=1;\n\n else\n m=(ssize_t) mng_info->magn_mx;\n\n for (i=0; i < m; i++)\n {\n if (magn_methx <= 1)\n {\n /* replicate previous */\n SetPixelRGBO(q,(pixels));\n }\n\n else if (magn_methx == 2 || magn_methx == 4)\n {\n if (i == 0)\n {\n SetPixelRGBO(q,(pixels));\n }\n\n /* To do: Rewrite using Get/Set***PixelComponent() */\n else\n {\n /* Interpolate */\n SetPixelRed(q,\n (QM) ((2*i*(\n GetPixelRed(n)\n -GetPixelRed(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelRed(pixels)));\n\n SetPixelGreen(q,\n (QM) ((2*i*(\n GetPixelGreen(n)\n -GetPixelGreen(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelGreen(pixels)));\n\n SetPixelBlue(q,\n (QM) ((2*i*(\n GetPixelBlue(n)\n -GetPixelBlue(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelBlue(pixels)));\n if (image->matte != MagickFalse)\n SetPixelOpacity(q,\n (QM) ((2*i*(\n GetPixelOpacity(n)\n -GetPixelOpacity(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelOpacity(pixels)));\n }\n\n if (magn_methx == 4)\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelOpacity(q,\n GetPixelOpacity(pixels)+0);\n }\n else\n {\n SetPixelOpacity(q,\n GetPixelOpacity(n)+0);\n }\n }\n }\n\n else /* if (magn_methx == 3 || magn_methx == 5) */\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n SetPixelRGBO(q,(n));\n }\n\n if (magn_methx == 5)\n {\n /* Interpolate */\n SetPixelOpacity(q,\n (QM) ((2*i*( GetPixelOpacity(n)\n -GetPixelOpacity(pixels))+m)/\n ((ssize_t) (m*2))\n +GetPixelOpacity(pixels)));\n }\n }\n q++;\n }\n n++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n if (magn_methx != 1 || magn_methy != 1)\n {\n /*\n Rescale pixels to Quantum\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n SetPixelRed(q,ScaleShortToQuantum(\n GetPixelRed(q)));\n SetPixelGreen(q,ScaleShortToQuantum(\n GetPixelGreen(q)));\n SetPixelBlue(q,ScaleShortToQuantum(\n GetPixelBlue(q)));\n SetPixelOpacity(q,ScaleShortToQuantum(\n GetPixelOpacity(q)));\n q++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n#endif\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished MAGN processing\");\n }\n }\n\n /*\n Crop_box is with respect to the upper left corner of the MNG.\n */\n crop_box.left=mng_info->image_box.left+mng_info->x_off[object_id];\n crop_box.right=mng_info->image_box.right+mng_info->x_off[object_id];\n crop_box.top=mng_info->image_box.top+mng_info->y_off[object_id];\n crop_box.bottom=mng_info->image_box.bottom+mng_info->y_off[object_id];\n crop_box=mng_minimum_box(crop_box,mng_info->clip);\n crop_box=mng_minimum_box(crop_box,mng_info->frame);\n crop_box=mng_minimum_box(crop_box,mng_info->object_clip[object_id]);\n if ((crop_box.left != (mng_info->image_box.left\n +mng_info->x_off[object_id])) ||\n (crop_box.right != (mng_info->image_box.right\n +mng_info->x_off[object_id])) ||\n (crop_box.top != (mng_info->image_box.top\n +mng_info->y_off[object_id])) ||\n (crop_box.bottom != (mng_info->image_box.bottom\n +mng_info->y_off[object_id])))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Crop the PNG image\");\n\n if ((crop_box.left < crop_box.right) &&\n (crop_box.top < crop_box.bottom))\n {\n Image\n *im;\n\n RectangleInfo\n crop_info;\n\n /*\n Crop_info is with respect to the upper left corner of\n the image.\n */\n crop_info.x=(crop_box.left-mng_info->x_off[object_id]);\n crop_info.y=(crop_box.top-mng_info->y_off[object_id]);\n crop_info.width=(size_t) (crop_box.right-crop_box.left);\n crop_info.height=(size_t) (crop_box.bottom-crop_box.top);\n image->page.width=image->columns;\n image->page.height=image->rows;\n image->page.x=0;\n image->page.y=0;\n im=CropImage(image,&crop_info,exception);\n\n if (im != (Image *) NULL)\n {\n image->columns=im->columns;\n image->rows=im->rows;\n im=DestroyImage(im);\n image->page.width=image->columns;\n image->page.height=image->rows;\n image->page.x=crop_box.left;\n image->page.y=crop_box.top;\n }\n }\n\n else\n {\n /*\n No pixels in crop area. The MNG spec still requires\n a layer, though, so make a single transparent pixel in\n the top left corner.\n */\n image->columns=1;\n image->rows=1;\n image->colors=2;\n (void) SetImageBackgroundColor(image);\n image->page.width=1;\n image->page.height=1;\n image->page.x=0;\n image->page.y=0;\n }\n }\n#ifndef PNG_READ_EMPTY_PLTE_SUPPORTED\n image=mng_info->image;\n#endif\n }\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n /* PNG does not handle depths greater than 16 so reduce it even\n * if lossy, and promote any depths > 8 to 16.\n */\n if (image->depth > 16)\n image->depth=16;\n#endif\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 8)\n if (image->depth > 8)\n {\n /* To do: fill low byte properly */\n image->depth=16;\n }\n\n if (LosslessReduceDepthOK(image) != MagickFalse)\n image->depth = 8;\n#endif\n\n GetImageException(image,exception);\n\n if (image_info->number_scenes != 0)\n {\n if (mng_info->scenes_found >\n (ssize_t) (image_info->first_scene+image_info->number_scenes))\n break;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished reading image datastream.\");\n\n } while (LocaleCompare(image_info->magick,\"MNG\") == 0);\n\n (void) CloseBlob(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished reading all image datastreams.\");\n\n#if defined(MNG_INSERT_LAYERS)\n if (insert_layers && !mng_info->image_found && (mng_info->mng_width) &&\n (mng_info->mng_height))\n {\n /*\n Insert a background layer if nothing else was found.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No images found. Inserting a background layer.\");\n\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocation failed, returning NULL.\");\n\n return(DestroyImageList(image));\n }\n image=SyncNextImageInList(image);\n }\n image->columns=mng_info->mng_width;\n image->rows=mng_info->mng_height;\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=0;\n image->page.y=0;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n\n if (image_info->ping == MagickFalse)\n (void) SetImageBackgroundColor(image);\n\n mng_info->image_found++;\n }\n#endif\n image->iterations=mng_iterations;\n\n if (mng_iterations == 1)\n image->start_loop=MagickTrue;\n\n while (GetPreviousImageInList(image) != (Image *) NULL)\n {\n image_count++;\n if (image_count > 10*mng_info->image_found)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" No beginning\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"Linked list is corrupted, beginning of list not found\",\n \"`%s'\",image_info->filename);\n\n return(DestroyImageList(image));\n }\n\n image=GetPreviousImageInList(image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Corrupt list\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"Linked list is corrupted; next_image is NULL\",\"`%s'\",\n image_info->filename);\n }\n }\n\n if (mng_info->ticks_per_second && mng_info->image_found > 1 &&\n GetNextImageInList(image) ==\n (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" First image null\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"image->next for first image is NULL but shouldn't be.\",\n \"`%s'\",image_info->filename);\n }\n\n if (mng_info->image_found == 0)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No visible images found.\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"No visible images in file\",\"`%s'\",image_info->filename);\n\n return(DestroyImageList(image));\n }\n\n if (mng_info->ticks_per_second)\n final_delay=1UL*MagickMax(image->ticks_per_second,1L)*\n final_delay/mng_info->ticks_per_second;\n\n else\n image->start_loop=MagickTrue;\n\n /* Find final nonzero image delay */\n final_image_delay=0;\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n if (image->delay)\n final_image_delay=image->delay;\n\n image=GetNextImageInList(image);\n }\n\n if (final_delay < final_image_delay)\n final_delay=final_image_delay;\n\n image->delay=final_delay;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->delay=%.20g, final_delay=%.20g\",(double) image->delay,\n (double) final_delay);\n\n if (logging != MagickFalse)\n {\n int\n scene;\n\n scene=0;\n image=GetFirstImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Before coalesce:\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene 0 delay=%.20g\",(double) image->delay);\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n image=GetNextImageInList(image);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene %.20g delay=%.20g\",(double) scene++,(double) image->delay);\n }\n }\n\n image=GetFirstImageInList(image);\n#ifdef MNG_COALESCE_LAYERS\n if (insert_layers)\n {\n Image\n *next_image,\n *next;\n\n size_t\n scene;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Coalesce Images\");\n\n scene=image->scene;\n next_image=CoalesceImages(image,&image->exception);\n\n if (next_image == (Image *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n image=DestroyImageList(image);\n image=next_image;\n\n for (next=image; next != (Image *) NULL; next=next_image)\n {\n next->page.width=mng_info->mng_width;\n next->page.height=mng_info->mng_height;\n next->page.x=0;\n next->page.y=0;\n next->scene=scene++;\n next_image=GetNextImageInList(next);\n\n if (next_image == (Image *) NULL)\n break;\n\n if (next->delay == 0)\n {\n scene--;\n next_image->previous=GetPreviousImageInList(next);\n if (GetPreviousImageInList(next) == (Image *) NULL)\n image=next_image;\n else\n next->previous->next=next_image;\n next=DestroyImage(next);\n }\n }\n }\n#endif\n\n while (GetNextImageInList(image) != (Image *) NULL)\n image=GetNextImageInList(image);\n\n image->dispose=BackgroundDispose;\n\n if (logging != MagickFalse)\n {\n int\n scene;\n\n scene=0;\n image=GetFirstImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" After coalesce:\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene 0 delay=%.20g dispose=%.20g\",(double) image->delay,\n (double) image->dispose);\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n image=GetNextImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene %.20g delay=%.20g dispose=%.20g\",(double) scene++,\n (double) image->delay,(double) image->dispose);\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" exit ReadOneJNGImage();\");\n\n return(image);\n}","lang":"c","vul_type":"cwe-125","target_token_count":17345,"sven_meta":{"func_name":"ReadOneMNGImage","file_name":"coders/png.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/78d4c5db50fbab0b4beb69c46c6167f2c6513dec","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#97-54c7d66ff6d9","input":"static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,\n Image *image)\n{\n const char\n *mode,\n *option;\n\n CompressionType\n compression;\n\n EndianType\n endian_type;\n\n MagickBooleanType\n debug,\n status;\n\n MagickOffsetType\n scene;\n\n QuantumInfo\n *quantum_info;\n\n QuantumType\n quantum_type;\n\n register ssize_t\n i;\n\n size_t\n imageListLength;\n\n ssize_t\n y;\n\n TIFF\n *tiff;\n\n TIFFInfo\n tiff_info;\n\n uint16\n bits_per_sample,\n compress_tag,\n endian,\n photometric,\n predictor;\n\n unsigned char\n *pixels;\n\n /*\n Open TIFF file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);\n if (status == MagickFalse)\n return(status);\n (void) SetMagickThreadValue(tiff_exception,&image->exception);\n endian_type=UndefinedEndian;\n option=GetImageOption(image_info,\"tiff:endian\");\n if (option != (const char *) NULL)\n {\n if (LocaleNCompare(option,\"msb\",3) == 0)\n endian_type=MSBEndian;\n if (LocaleNCompare(option,\"lsb\",3) == 0)\n endian_type=LSBEndian;;\n }\n switch (endian_type)\n {\n case LSBEndian: mode=\"wl\"; break;\n case MSBEndian: mode=\"wb\"; break;\n default: mode=\"w\"; break;\n }\n#if defined(TIFF_VERSION_BIG)\n if (LocaleCompare(image_info->magick,\"TIFF64\") == 0)\n switch (endian_type)\n {\n case LSBEndian: mode=\"wl8\"; break;\n case MSBEndian: mode=\"wb8\"; break;\n default: mode=\"w8\"; break;\n }\n#endif\n tiff=TIFFClientOpen(image->filename,mode,(thandle_t) image,TIFFReadBlob,\n TIFFWriteBlob,TIFFSeekBlob,TIFFCloseBlob,TIFFGetBlobSize,TIFFMapBlob,\n TIFFUnmapBlob);\n if (tiff == (TIFF *) NULL)\n return(MagickFalse);\n if (image->exception.severity > ErrorException)\n {\n TIFFClose(tiff);\n return(MagickFalse);\n }\n (void) DeleteImageProfile(image,\"tiff:37724\");\n scene=0;\n debug=IsEventLogging();\n (void) debug;\n imageListLength=GetImageListLength(image);\n do\n {\n /*\n Initialize TIFF fields.\n */\n if ((image_info->type != UndefinedType) &&\n (image_info->type != OptimizeType))\n (void) SetImageType(image,image_info->type);\n compression=UndefinedCompression;\n if (image->compression != JPEGCompression)\n compression=image->compression;\n if (image_info->compression != UndefinedCompression)\n compression=image_info->compression;\n switch (compression)\n {\n case FaxCompression:\n case Group4Compression:\n {\n (void) SetImageType(image,BilevelType);\n (void) SetImageDepth(image,1);\n break;\n }\n case JPEGCompression:\n {\n (void) SetImageStorageClass(image,DirectClass);\n (void) SetImageDepth(image,8);\n break;\n }\n default:\n break;\n }\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n if ((image->storage_class != PseudoClass) && (image->depth >= 32) &&\n (quantum_info->format == UndefinedQuantumFormat) &&\n (IsHighDynamicRangeImage(image,&image->exception) != MagickFalse))\n {\n status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat);\n if (status == MagickFalse)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n }\n if ((LocaleCompare(image_info->magick,\"PTIF\") == 0) &&\n (GetPreviousImageInList(image) != (Image *) NULL))\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_REDUCEDIMAGE);\n if ((image->columns != (uint32) image->columns) ||\n (image->rows != (uint32) image->rows))\n ThrowWriterException(ImageError,\"WidthOrHeightExceedsLimit\");\n (void) TIFFSetField(tiff,TIFFTAG_IMAGELENGTH,(uint32) image->rows);\n (void) TIFFSetField(tiff,TIFFTAG_IMAGEWIDTH,(uint32) image->columns);\n switch (compression)\n {\n case FaxCompression:\n {\n compress_tag=COMPRESSION_CCITTFAX3;\n option=GetImageOption(image_info,\"quantum:polarity\");\n if (option == (const char *) NULL)\n SetQuantumMinIsWhite(quantum_info,MagickTrue);\n break;\n }\n case Group4Compression:\n {\n compress_tag=COMPRESSION_CCITTFAX4;\n option=GetImageOption(image_info,\"quantum:polarity\");\n if (option == (const char *) NULL)\n SetQuantumMinIsWhite(quantum_info,MagickTrue);\n break;\n }\n#if defined(COMPRESSION_JBIG)\n case JBIG1Compression:\n {\n compress_tag=COMPRESSION_JBIG;\n break;\n }\n#endif\n case JPEGCompression:\n {\n compress_tag=COMPRESSION_JPEG;\n break;\n }\n#if defined(COMPRESSION_LZMA)\n case LZMACompression:\n {\n compress_tag=COMPRESSION_LZMA;\n break;\n }\n#endif\n case LZWCompression:\n {\n compress_tag=COMPRESSION_LZW;\n break;\n }\n case RLECompression:\n {\n compress_tag=COMPRESSION_PACKBITS;\n break;\n }\n#if defined(COMPRESSION_WEBP)\n case WebPCompression:\n {\n compress_tag=COMPRESSION_WEBP;\n break;\n }\n#endif\n case ZipCompression:\n {\n compress_tag=COMPRESSION_ADOBE_DEFLATE;\n break;\n }\n#if defined(COMPRESSION_ZSTD)\n case ZstdCompression:\n {\n compress_tag=COMPRESSION_ZSTD;\n break;\n }\n#endif\n case NoCompression:\n default:\n {\n compress_tag=COMPRESSION_NONE;\n break;\n }\n }\n#if defined(MAGICKCORE_HAVE_TIFFISCODECCONFIGURED) || (TIFFLIB_VERSION > 20040919)\n if ((compress_tag != COMPRESSION_NONE) &&\n (TIFFIsCODECConfigured(compress_tag) == 0))\n {\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CompressionNotSupported\",\"`%s'\",CommandOptionToMnemonic(\n MagickCompressOptions,(ssize_t) compression));\n compress_tag=COMPRESSION_NONE;\n }\n#else\n switch (compress_tag)\n {\n#if defined(CCITT_SUPPORT)\n case COMPRESSION_CCITTFAX3:\n case COMPRESSION_CCITTFAX4:\n#endif\n#if defined(YCBCR_SUPPORT) && defined(JPEG_SUPPORT)\n case COMPRESSION_JPEG:\n#endif\n#if defined(LZMA_SUPPORT) && defined(COMPRESSION_LZMA)\n case COMPRESSION_LZMA:\n#endif\n#if defined(LZW_SUPPORT)\n case COMPRESSION_LZW:\n#endif\n#if defined(PACKBITS_SUPPORT)\n case COMPRESSION_PACKBITS:\n#endif\n#if defined(ZIP_SUPPORT)\n case COMPRESSION_ADOBE_DEFLATE:\n#endif\n case COMPRESSION_NONE:\n break;\n default:\n {\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CompressionNotSupported\",\"`%s'\",CommandOptionToMnemonic(\n MagickCompressOptions,(ssize_t) compression));\n compress_tag=COMPRESSION_NONE;\n break;\n }\n }\n#endif\n if (image->colorspace == CMYKColorspace)\n {\n photometric=PHOTOMETRIC_SEPARATED;\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,4);\n (void) TIFFSetField(tiff,TIFFTAG_INKSET,INKSET_CMYK);\n }\n else\n {\n /*\n Full color TIFF raster.\n */\n if (image->colorspace == LabColorspace)\n {\n photometric=PHOTOMETRIC_CIELAB;\n EncodeLabImage(image,&image->exception);\n }\n else\n if (image->colorspace == YCbCrColorspace)\n {\n photometric=PHOTOMETRIC_YCBCR;\n (void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,1,1);\n (void) SetImageStorageClass(image,DirectClass);\n (void) SetImageDepth(image,8);\n }\n else\n photometric=PHOTOMETRIC_RGB;\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,3);\n if ((image_info->type != TrueColorType) &&\n (image_info->type != TrueColorMatteType))\n {\n if ((image_info->type != PaletteType) &&\n (SetImageGray(image,&image->exception) != MagickFalse))\n {\n photometric=(uint16) (quantum_info->min_is_white !=\n MagickFalse ? PHOTOMETRIC_MINISWHITE :\n PHOTOMETRIC_MINISBLACK);\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);\n if ((image->depth == 1) && (image->matte == MagickFalse))\n SetImageMonochrome(image,&image->exception);\n }\n else\n if (image->storage_class == PseudoClass)\n {\n size_t\n depth;\n\n /*\n Colormapped TIFF raster.\n */\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);\n photometric=PHOTOMETRIC_PALETTE;\n depth=1;\n while ((GetQuantumRange(depth)+1) < image->colors)\n depth<<=1;\n status=SetQuantumDepth(image,quantum_info,depth);\n if (status == MagickFalse)\n ThrowWriterException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n }\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&endian);\n if ((compress_tag == COMPRESSION_CCITTFAX3) ||\n (compress_tag == COMPRESSION_CCITTFAX4))\n {\n if ((photometric != PHOTOMETRIC_MINISWHITE) &&\n (photometric != PHOTOMETRIC_MINISBLACK))\n {\n compress_tag=COMPRESSION_NONE;\n endian=FILLORDER_MSB2LSB;\n }\n }\n option=GetImageOption(image_info,\"tiff:fill-order\");\n if (option != (const char *) NULL)\n {\n if (LocaleNCompare(option,\"msb\",3) == 0)\n endian=FILLORDER_MSB2LSB;\n if (LocaleNCompare(option,\"lsb\",3) == 0)\n endian=FILLORDER_LSB2MSB;\n }\n (void) TIFFSetField(tiff,TIFFTAG_COMPRESSION,compress_tag);\n (void) TIFFSetField(tiff,TIFFTAG_FILLORDER,endian);\n (void) TIFFSetField(tiff,TIFFTAG_BITSPERSAMPLE,quantum_info->depth);\n if (image->matte != MagickFalse)\n {\n uint16\n extra_samples,\n sample_info[1],\n samples_per_pixel;\n\n /*\n TIFF has a matte channel.\n */\n extra_samples=1;\n sample_info[0]=EXTRASAMPLE_UNASSALPHA;\n option=GetImageOption(image_info,\"tiff:alpha\");\n if (option != (const char *) NULL)\n {\n if (LocaleCompare(option,\"associated\") == 0)\n sample_info[0]=EXTRASAMPLE_ASSOCALPHA;\n else\n if (LocaleCompare(option,\"unspecified\") == 0)\n sample_info[0]=EXTRASAMPLE_UNSPECIFIED;\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,\n &samples_per_pixel);\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,samples_per_pixel+1);\n (void) TIFFSetField(tiff,TIFFTAG_EXTRASAMPLES,extra_samples,\n &sample_info);\n if (sample_info[0] == EXTRASAMPLE_ASSOCALPHA)\n SetQuantumAlphaType(quantum_info,AssociatedQuantumAlpha);\n }\n (void) TIFFSetField(tiff,TIFFTAG_PHOTOMETRIC,photometric);\n switch (quantum_info->format)\n {\n case FloatingPointQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_IEEEFP);\n (void) TIFFSetField(tiff,TIFFTAG_SMINSAMPLEVALUE,quantum_info->minimum);\n (void) TIFFSetField(tiff,TIFFTAG_SMAXSAMPLEVALUE,quantum_info->maximum);\n break;\n }\n case SignedQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_INT);\n break;\n }\n case UnsignedQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_UINT);\n break;\n }\n default:\n break;\n }\n (void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);\n if (photometric == PHOTOMETRIC_RGB)\n if ((image_info->interlace == PlaneInterlace) ||\n (image_info->interlace == PartitionInterlace))\n (void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_SEPARATE);\n predictor=0;\n switch (compress_tag)\n {\n case COMPRESSION_JPEG:\n {\n#if defined(JPEG_SUPPORT)\n if (image_info->quality != UndefinedCompressionQuality)\n (void) TIFFSetField(tiff,TIFFTAG_JPEGQUALITY,image_info->quality);\n (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RAW);\n if (IssRGBCompatibleColorspace(image->colorspace) != MagickFalse)\n {\n const char\n *value;\n\n (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RGB);\n if (image->colorspace == YCbCrColorspace)\n {\n const char\n *sampling_factor;\n\n GeometryInfo\n geometry_info;\n\n MagickStatusType\n flags;\n\n sampling_factor=(const char *) NULL;\n value=GetImageProperty(image,\"jpeg:sampling-factor\");\n if (value != (char *) NULL)\n {\n sampling_factor=value;\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Input sampling-factors=%s\",sampling_factor);\n }\n if (image_info->sampling_factor != (char *) NULL)\n sampling_factor=image_info->sampling_factor;\n if (sampling_factor != (const char *) NULL)\n {\n flags=ParseGeometry(sampling_factor,&geometry_info);\n if ((flags & SigmaValue) == 0)\n geometry_info.sigma=geometry_info.rho;\n (void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,(uint16)\n geometry_info.rho,(uint16) geometry_info.sigma);\n }\n }\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (bits_per_sample == 12)\n (void) TIFFSetField(tiff,TIFFTAG_JPEGTABLESMODE,JPEGTABLESMODE_QUANT);\n#endif\n break;\n }\n case COMPRESSION_ADOBE_DEFLATE:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_ZIPQUALITY,(long) (\n image_info->quality == UndefinedCompressionQuality ? 7 :\n MagickMin((ssize_t) image_info->quality/10,9)));\n break;\n }\n case COMPRESSION_CCITTFAX3:\n {\n /*\n Byte-aligned EOL.\n */\n (void) TIFFSetField(tiff,TIFFTAG_GROUP3OPTIONS,4);\n break;\n }\n case COMPRESSION_CCITTFAX4:\n break;\n#if defined(LZMA_SUPPORT) && defined(COMPRESSION_LZMA)\n case COMPRESSION_LZMA:\n {\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_LZMAPRESET,(long) (\n image_info->quality == UndefinedCompressionQuality ? 7 :\n MagickMin((ssize_t) image_info->quality/10,9)));\n break;\n }\n#endif\n case COMPRESSION_LZW:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n break;\n }\n#if defined(WEBP_SUPPORT) && defined(COMPRESSION_WEBP)\n case COMPRESSION_WEBP:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_WEBP_LEVEL,mage_info->quality);\n if (image_info->quality >= 100)\n (void) TIFFSetField(tiff,TIFFTAG_WEBP_LOSSLESS,1);\n break;\n }\n#endif\n#if defined(ZSTD_SUPPORT) && defined(COMPRESSION_ZSTD)\n case COMPRESSION_ZSTD:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_ZSTD_LEVEL,22*image_info->quality/\n 100.0);\n break;\n }\n#endif\n default:\n break;\n }\n option=GetImageOption(image_info,\"tiff:predictor\");\n if (option != (const char * ) NULL)\n predictor=(size_t) strtol(option,(char **) NULL,10);\n if (predictor != 0)\n (void) TIFFSetField(tiff,TIFFTAG_PREDICTOR,predictor);\n if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))\n {\n unsigned short\n units;\n\n /*\n Set image resolution.\n */\n units=RESUNIT_NONE;\n if (image->units == PixelsPerInchResolution)\n units=RESUNIT_INCH;\n if (image->units == PixelsPerCentimeterResolution)\n units=RESUNIT_CENTIMETER;\n (void) TIFFSetField(tiff,TIFFTAG_RESOLUTIONUNIT,(uint16) units);\n (void) TIFFSetField(tiff,TIFFTAG_XRESOLUTION,image->x_resolution);\n (void) TIFFSetField(tiff,TIFFTAG_YRESOLUTION,image->y_resolution);\n if ((image->page.x < 0) || (image->page.y < 0))\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"TIFF: negative image positions unsupported\",\"%s\",\n image->filename);\n if ((image->page.x > 0) && (image->x_resolution > 0.0))\n {\n /*\n Set horizontal image position.\n */\n (void) TIFFSetField(tiff,TIFFTAG_XPOSITION,(float) image->page.x/\n image->x_resolution);\n }\n if ((image->page.y > 0) && (image->y_resolution > 0.0))\n {\n /*\n Set vertical image position.\n */\n (void) TIFFSetField(tiff,TIFFTAG_YPOSITION,(float) image->page.y/\n image->y_resolution);\n }\n }\n if (image->chromaticity.white_point.x != 0.0)\n {\n float\n chromaticity[6];\n\n /*\n Set image chromaticity.\n */\n chromaticity[0]=(float) image->chromaticity.red_primary.x;\n chromaticity[1]=(float) image->chromaticity.red_primary.y;\n chromaticity[2]=(float) image->chromaticity.green_primary.x;\n chromaticity[3]=(float) image->chromaticity.green_primary.y;\n chromaticity[4]=(float) image->chromaticity.blue_primary.x;\n chromaticity[5]=(float) image->chromaticity.blue_primary.y;\n (void) TIFFSetField(tiff,TIFFTAG_PRIMARYCHROMATICITIES,chromaticity);\n chromaticity[0]=(float) image->chromaticity.white_point.x;\n chromaticity[1]=(float) image->chromaticity.white_point.y;\n (void) TIFFSetField(tiff,TIFFTAG_WHITEPOINT,chromaticity);\n }\n if ((LocaleCompare(image_info->magick,\"PTIF\") != 0) &&\n (image_info->adjoin != MagickFalse) && (imageListLength > 1))\n {\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE);\n if (image->scene != 0)\n (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,(uint16) image->scene,\n imageListLength);\n }\n if (image->orientation != UndefinedOrientation)\n (void) TIFFSetField(tiff,TIFFTAG_ORIENTATION,(uint16) image->orientation);\n else\n (void) TIFFSetField(tiff,TIFFTAG_ORIENTATION,ORIENTATION_TOPLEFT);\n (void) TIFFSetProfiles(tiff,image);\n {\n uint16\n page,\n pages;\n\n page=(uint16) scene;\n pages=(uint16) imageListLength;\n if ((LocaleCompare(image_info->magick,\"PTIF\") != 0) &&\n (image_info->adjoin != MagickFalse) && (pages > 1))\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE);\n (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,page,pages);\n }\n (void) TIFFSetProperties(tiff,image_info,image);\nDisableMSCWarning(4127)\n if (0)\nRestoreMSCWarning\n (void) TIFFSetEXIFProperties(tiff,image);\n /*\n Write image scanlines.\n */\n if (GetTIFFInfo(image_info,tiff,&tiff_info) == MagickFalse)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n quantum_info->endian=LSBEndian;\n pixels=GetQuantumPixels(quantum_info);\n tiff_info.scanline=GetQuantumPixels(quantum_info);\n switch (photometric)\n {\n case PHOTOMETRIC_CIELAB:\n case PHOTOMETRIC_YCBCR:\n case PHOTOMETRIC_RGB:\n {\n /*\n RGB TIFF image.\n */\n switch (image_info->interlace)\n {\n case NoInterlace:\n default:\n {\n quantum_type=RGBQuantum;\n if (image->matte != MagickFalse)\n quantum_type=RGBAQuantum;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case PlaneInterlace:\n case PartitionInterlace:\n {\n /*\n Plane interlacing: RRRRRR...GGGGGG...BBBBBB...\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,RedQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,100,400);\n if (status == MagickFalse)\n break;\n }\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GreenQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,1,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,200,400);\n if (status == MagickFalse)\n break;\n }\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,BlueQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,2,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,300,400);\n if (status == MagickFalse)\n break;\n }\n if (image->matte != MagickFalse)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,\n &image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,AlphaQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,3,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,400,400);\n if (status == MagickFalse)\n break;\n }\n break;\n }\n }\n break;\n }\n case PHOTOMETRIC_SEPARATED:\n {\n /*\n CMYK TIFF image.\n */\n quantum_type=CMYKQuantum;\n if (image->matte != MagickFalse)\n quantum_type=CMYKAQuantum;\n if (image->colorspace != CMYKColorspace)\n (void) TransformImageColorspace(image,CMYKColorspace);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case PHOTOMETRIC_PALETTE:\n {\n uint16\n *blue,\n *green,\n *red;\n\n /*\n Colormapped TIFF image.\n */\n red=(uint16 *) AcquireQuantumMemory(65536,sizeof(*red));\n green=(uint16 *) AcquireQuantumMemory(65536,sizeof(*green));\n blue=(uint16 *) AcquireQuantumMemory(65536,sizeof(*blue));\n if ((red == (uint16 *) NULL) || (green == (uint16 *) NULL) ||\n (blue == (uint16 *) NULL))\n {\n if (red != (uint16 *) NULL)\n red=(uint16 *) RelinquishMagickMemory(red);\n if (green != (uint16 *) NULL)\n green=(uint16 *) RelinquishMagickMemory(green);\n if (blue != (uint16 *) NULL)\n blue=(uint16 *) RelinquishMagickMemory(blue);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n /*\n Initialize TIFF colormap.\n */\n (void) memset(red,0,65536*sizeof(*red));\n (void) memset(green,0,65536*sizeof(*green));\n (void) memset(blue,0,65536*sizeof(*blue));\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n red[i]=ScaleQuantumToShort(image->colormap[i].red);\n green[i]=ScaleQuantumToShort(image->colormap[i].green);\n blue[i]=ScaleQuantumToShort(image->colormap[i].blue);\n }\n (void) TIFFSetField(tiff,TIFFTAG_COLORMAP,red,green,blue);\n red=(uint16 *) RelinquishMagickMemory(red);\n green=(uint16 *) RelinquishMagickMemory(green);\n blue=(uint16 *) RelinquishMagickMemory(blue);\n }\n default:\n {\n /*\n Convert PseudoClass packets to contiguous grayscale scanlines.\n */\n quantum_type=IndexQuantum;\n if (image->matte != MagickFalse)\n {\n if (photometric != PHOTOMETRIC_PALETTE)\n quantum_type=GrayAlphaQuantum;\n else\n quantum_type=IndexAlphaQuantum;\n }\n else\n if (photometric != PHOTOMETRIC_PALETTE)\n quantum_type=GrayQuantum;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n }\n quantum_info=DestroyQuantumInfo(quantum_info);\n if (image->colorspace == LabColorspace)\n DecodeLabImage(image,&image->exception);\n DestroyTIFFInfo(&tiff_info);\n if (image->exception.severity > ErrorException)\n break;\nDisableMSCWarning(4127)\n if (0 && (image_info->verbose != MagickFalse))\nRestoreMSCWarning\n TIFFPrintDirectory(tiff,stdout,MagickFalse);\n (void) TIFFWriteDirectory(tiff);\n image=SyncNextImageInList(image);\n if (image == (Image *) NULL)\n break;\n status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength);\n if (status == MagickFalse)\n break;\n } while (image_info->adjoin != MagickFalse);\n TIFFClose(tiff);\n return(image->exception.severity > ErrorException ? MagickFalse : MagickTrue);\n}","target":"static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,\n Image *image)\n{\n const char\n *mode,\n *option;\n\n CompressionType\n compression;\n\n EndianType\n endian_type;\n\n MagickBooleanType\n debug,\n status;\n\n MagickOffsetType\n scene;\n\n QuantumInfo\n *quantum_info;\n\n QuantumType\n quantum_type;\n\n register ssize_t\n i;\n\n size_t\n imageListLength;\n\n ssize_t\n y;\n\n TIFF\n *tiff;\n\n TIFFInfo\n tiff_info;\n\n uint16\n bits_per_sample,\n compress_tag,\n endian,\n photometric,\n predictor;\n\n unsigned char\n *pixels;\n\n /*\n Open TIFF file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);\n if (status == MagickFalse)\n return(status);\n (void) SetMagickThreadValue(tiff_exception,&image->exception);\n endian_type=UndefinedEndian;\n option=GetImageOption(image_info,\"tiff:endian\");\n if (option != (const char *) NULL)\n {\n if (LocaleNCompare(option,\"msb\",3) == 0)\n endian_type=MSBEndian;\n if (LocaleNCompare(option,\"lsb\",3) == 0)\n endian_type=LSBEndian;;\n }\n switch (endian_type)\n {\n case LSBEndian: mode=\"wl\"; break;\n case MSBEndian: mode=\"wb\"; break;\n default: mode=\"w\"; break;\n }\n#if defined(TIFF_VERSION_BIG)\n if (LocaleCompare(image_info->magick,\"TIFF64\") == 0)\n switch (endian_type)\n {\n case LSBEndian: mode=\"wl8\"; break;\n case MSBEndian: mode=\"wb8\"; break;\n default: mode=\"w8\"; break;\n }\n#endif\n tiff=TIFFClientOpen(image->filename,mode,(thandle_t) image,TIFFReadBlob,\n TIFFWriteBlob,TIFFSeekBlob,TIFFCloseBlob,TIFFGetBlobSize,TIFFMapBlob,\n TIFFUnmapBlob);\n if (tiff == (TIFF *) NULL)\n return(MagickFalse);\n if (image->exception.severity > ErrorException)\n {\n TIFFClose(tiff);\n return(MagickFalse);\n }\n (void) DeleteImageProfile(image,\"tiff:37724\");\n scene=0;\n debug=IsEventLogging();\n (void) debug;\n imageListLength=GetImageListLength(image);\n do\n {\n /*\n Initialize TIFF fields.\n */\n if ((image_info->type != UndefinedType) &&\n (image_info->type != OptimizeType))\n (void) SetImageType(image,image_info->type);\n compression=UndefinedCompression;\n if (image->compression != JPEGCompression)\n compression=image->compression;\n if (image_info->compression != UndefinedCompression)\n compression=image_info->compression;\n switch (compression)\n {\n case FaxCompression:\n case Group4Compression:\n {\n (void) SetImageType(image,BilevelType);\n (void) SetImageDepth(image,1);\n break;\n }\n case JPEGCompression:\n {\n (void) SetImageStorageClass(image,DirectClass);\n (void) SetImageDepth(image,8);\n break;\n }\n default:\n break;\n }\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n if ((image->storage_class != PseudoClass) && (image->depth >= 32) &&\n (quantum_info->format == UndefinedQuantumFormat) &&\n (IsHighDynamicRangeImage(image,&image->exception) != MagickFalse))\n {\n status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat);\n if (status == MagickFalse)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n }\n if ((LocaleCompare(image_info->magick,\"PTIF\") == 0) &&\n (GetPreviousImageInList(image) != (Image *) NULL))\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_REDUCEDIMAGE);\n if ((image->columns != (uint32) image->columns) ||\n (image->rows != (uint32) image->rows))\n ThrowWriterException(ImageError,\"WidthOrHeightExceedsLimit\");\n (void) TIFFSetField(tiff,TIFFTAG_IMAGELENGTH,(uint32) image->rows);\n (void) TIFFSetField(tiff,TIFFTAG_IMAGEWIDTH,(uint32) image->columns);\n switch (compression)\n {\n case FaxCompression:\n {\n compress_tag=COMPRESSION_CCITTFAX3;\n option=GetImageOption(image_info,\"quantum:polarity\");\n if (option == (const char *) NULL)\n SetQuantumMinIsWhite(quantum_info,MagickTrue);\n break;\n }\n case Group4Compression:\n {\n compress_tag=COMPRESSION_CCITTFAX4;\n option=GetImageOption(image_info,\"quantum:polarity\");\n if (option == (const char *) NULL)\n SetQuantumMinIsWhite(quantum_info,MagickTrue);\n break;\n }\n#if defined(COMPRESSION_JBIG)\n case JBIG1Compression:\n {\n compress_tag=COMPRESSION_JBIG;\n break;\n }\n#endif\n case JPEGCompression:\n {\n compress_tag=COMPRESSION_JPEG;\n break;\n }\n#if defined(COMPRESSION_LZMA)\n case LZMACompression:\n {\n compress_tag=COMPRESSION_LZMA;\n break;\n }\n#endif\n case LZWCompression:\n {\n compress_tag=COMPRESSION_LZW;\n break;\n }\n case RLECompression:\n {\n compress_tag=COMPRESSION_PACKBITS;\n break;\n }\n#if defined(COMPRESSION_WEBP)\n case WebPCompression:\n {\n compress_tag=COMPRESSION_WEBP;\n break;\n }\n#endif\n case ZipCompression:\n {\n compress_tag=COMPRESSION_ADOBE_DEFLATE;\n break;\n }\n#if defined(COMPRESSION_ZSTD)\n case ZstdCompression:\n {\n compress_tag=COMPRESSION_ZSTD;\n break;\n }\n#endif\n case NoCompression:\n default:\n {\n compress_tag=COMPRESSION_NONE;\n break;\n }\n }\n#if defined(MAGICKCORE_HAVE_TIFFISCODECCONFIGURED) || (TIFFLIB_VERSION > 20040919)\n if ((compress_tag != COMPRESSION_NONE) &&\n (TIFFIsCODECConfigured(compress_tag) == 0))\n {\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CompressionNotSupported\",\"`%s'\",CommandOptionToMnemonic(\n MagickCompressOptions,(ssize_t) compression));\n compress_tag=COMPRESSION_NONE;\n }\n#else\n switch (compress_tag)\n {\n#if defined(CCITT_SUPPORT)\n case COMPRESSION_CCITTFAX3:\n case COMPRESSION_CCITTFAX4:\n#endif\n#if defined(YCBCR_SUPPORT) && defined(JPEG_SUPPORT)\n case COMPRESSION_JPEG:\n#endif\n#if defined(LZMA_SUPPORT) && defined(COMPRESSION_LZMA)\n case COMPRESSION_LZMA:\n#endif\n#if defined(LZW_SUPPORT)\n case COMPRESSION_LZW:\n#endif\n#if defined(PACKBITS_SUPPORT)\n case COMPRESSION_PACKBITS:\n#endif\n#if defined(ZIP_SUPPORT)\n case COMPRESSION_ADOBE_DEFLATE:\n#endif\n case COMPRESSION_NONE:\n break;\n default:\n {\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CompressionNotSupported\",\"`%s'\",CommandOptionToMnemonic(\n MagickCompressOptions,(ssize_t) compression));\n compress_tag=COMPRESSION_NONE;\n break;\n }\n }\n#endif\n if (image->colorspace == CMYKColorspace)\n {\n photometric=PHOTOMETRIC_SEPARATED;\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,4);\n (void) TIFFSetField(tiff,TIFFTAG_INKSET,INKSET_CMYK);\n }\n else\n {\n /*\n Full color TIFF raster.\n */\n if (image->colorspace == LabColorspace)\n {\n photometric=PHOTOMETRIC_CIELAB;\n EncodeLabImage(image,&image->exception);\n }\n else\n if (image->colorspace == YCbCrColorspace)\n {\n photometric=PHOTOMETRIC_YCBCR;\n (void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,1,1);\n (void) SetImageStorageClass(image,DirectClass);\n (void) SetImageDepth(image,8);\n }\n else\n photometric=PHOTOMETRIC_RGB;\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,3);\n if ((image_info->type != TrueColorType) &&\n (image_info->type != TrueColorMatteType))\n {\n if ((image_info->type != PaletteType) &&\n (SetImageGray(image,&image->exception) != MagickFalse))\n {\n photometric=(uint16) (quantum_info->min_is_white !=\n MagickFalse ? PHOTOMETRIC_MINISWHITE :\n PHOTOMETRIC_MINISBLACK);\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);\n if ((image->depth == 1) && (image->matte == MagickFalse))\n SetImageMonochrome(image,&image->exception);\n }\n else\n if (image->storage_class == PseudoClass)\n {\n size_t\n depth;\n\n /*\n Colormapped TIFF raster.\n */\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);\n photometric=PHOTOMETRIC_PALETTE;\n depth=1;\n while ((GetQuantumRange(depth)+1) < image->colors)\n depth<<=1;\n status=SetQuantumDepth(image,quantum_info,depth);\n if (status == MagickFalse)\n ThrowWriterException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n }\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&endian);\n if ((compress_tag == COMPRESSION_CCITTFAX3) ||\n (compress_tag == COMPRESSION_CCITTFAX4))\n {\n if ((photometric != PHOTOMETRIC_MINISWHITE) &&\n (photometric != PHOTOMETRIC_MINISBLACK))\n {\n compress_tag=COMPRESSION_NONE;\n endian=FILLORDER_MSB2LSB;\n }\n }\n option=GetImageOption(image_info,\"tiff:fill-order\");\n if (option != (const char *) NULL)\n {\n if (LocaleNCompare(option,\"msb\",3) == 0)\n endian=FILLORDER_MSB2LSB;\n if (LocaleNCompare(option,\"lsb\",3) == 0)\n endian=FILLORDER_LSB2MSB;\n }\n (void) TIFFSetField(tiff,TIFFTAG_COMPRESSION,compress_tag);\n (void) TIFFSetField(tiff,TIFFTAG_FILLORDER,endian);\n (void) TIFFSetField(tiff,TIFFTAG_BITSPERSAMPLE,quantum_info->depth);\n if (image->matte != MagickFalse)\n {\n uint16\n extra_samples,\n sample_info[1],\n samples_per_pixel;\n\n /*\n TIFF has a matte channel.\n */\n extra_samples=1;\n sample_info[0]=EXTRASAMPLE_UNASSALPHA;\n option=GetImageOption(image_info,\"tiff:alpha\");\n if (option != (const char *) NULL)\n {\n if (LocaleCompare(option,\"associated\") == 0)\n sample_info[0]=EXTRASAMPLE_ASSOCALPHA;\n else\n if (LocaleCompare(option,\"unspecified\") == 0)\n sample_info[0]=EXTRASAMPLE_UNSPECIFIED;\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,\n &samples_per_pixel);\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,samples_per_pixel+1);\n (void) TIFFSetField(tiff,TIFFTAG_EXTRASAMPLES,extra_samples,\n &sample_info);\n if (sample_info[0] == EXTRASAMPLE_ASSOCALPHA)\n SetQuantumAlphaType(quantum_info,AssociatedQuantumAlpha);\n }\n (void) TIFFSetField(tiff,TIFFTAG_PHOTOMETRIC,photometric);\n switch (quantum_info->format)\n {\n case FloatingPointQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_IEEEFP);\n (void) TIFFSetField(tiff,TIFFTAG_SMINSAMPLEVALUE,quantum_info->minimum);\n (void) TIFFSetField(tiff,TIFFTAG_SMAXSAMPLEVALUE,quantum_info->maximum);\n break;\n }\n case SignedQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_INT);\n break;\n }\n case UnsignedQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_UINT);\n break;\n }\n default:\n break;\n }\n (void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);\n if (photometric == PHOTOMETRIC_RGB)\n if ((image_info->interlace == PlaneInterlace) ||\n (image_info->interlace == PartitionInterlace))\n (void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_SEPARATE);\n predictor=0;\n switch (compress_tag)\n {\n case COMPRESSION_JPEG:\n {\n#if defined(JPEG_SUPPORT)\n if (image_info->quality != UndefinedCompressionQuality)\n (void) TIFFSetField(tiff,TIFFTAG_JPEGQUALITY,image_info->quality);\n (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RAW);\n if (IssRGBCompatibleColorspace(image->colorspace) != MagickFalse)\n {\n const char\n *value;\n\n (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RGB);\n if (image->colorspace == YCbCrColorspace)\n {\n const char\n *sampling_factor;\n\n GeometryInfo\n geometry_info;\n\n MagickStatusType\n flags;\n\n sampling_factor=(const char *) NULL;\n value=GetImageProperty(image,\"jpeg:sampling-factor\");\n if (value != (char *) NULL)\n {\n sampling_factor=value;\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Input sampling-factors=%s\",sampling_factor);\n }\n if (image_info->sampling_factor != (char *) NULL)\n sampling_factor=image_info->sampling_factor;\n if (sampling_factor != (const char *) NULL)\n {\n flags=ParseGeometry(sampling_factor,&geometry_info);\n if ((flags & SigmaValue) == 0)\n geometry_info.sigma=geometry_info.rho;\n (void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,(uint16)\n geometry_info.rho,(uint16) geometry_info.sigma);\n }\n }\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (bits_per_sample == 12)\n (void) TIFFSetField(tiff,TIFFTAG_JPEGTABLESMODE,JPEGTABLESMODE_QUANT);\n#endif\n break;\n }\n case COMPRESSION_ADOBE_DEFLATE:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_ZIPQUALITY,(long) (\n image_info->quality == UndefinedCompressionQuality ? 7 :\n MagickMin((ssize_t) image_info->quality/10,9)));\n break;\n }\n case COMPRESSION_CCITTFAX3:\n {\n /*\n Byte-aligned EOL.\n */\n (void) TIFFSetField(tiff,TIFFTAG_GROUP3OPTIONS,4);\n break;\n }\n case COMPRESSION_CCITTFAX4:\n break;\n#if defined(LZMA_SUPPORT) && defined(COMPRESSION_LZMA)\n case COMPRESSION_LZMA:\n {\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_LZMAPRESET,(long) (\n image_info->quality == UndefinedCompressionQuality ? 7 :\n MagickMin((ssize_t) image_info->quality/10,9)));\n break;\n }\n#endif\n case COMPRESSION_LZW:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n break;\n }\n#if defined(WEBP_SUPPORT) && defined(COMPRESSION_WEBP)\n case COMPRESSION_WEBP:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_WEBP_LEVEL,mage_info->quality);\n if (image_info->quality >= 100)\n (void) TIFFSetField(tiff,TIFFTAG_WEBP_LOSSLESS,1);\n break;\n }\n#endif\n#if defined(ZSTD_SUPPORT) && defined(COMPRESSION_ZSTD)\n case COMPRESSION_ZSTD:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_ZSTD_LEVEL,22*image_info->quality/\n 100.0);\n break;\n }\n#endif\n default:\n break;\n }\n option=GetImageOption(image_info,\"tiff:predictor\");\n if (option != (const char * ) NULL)\n predictor=(size_t) strtol(option,(char **) NULL,10);\n if (predictor != 0)\n (void) TIFFSetField(tiff,TIFFTAG_PREDICTOR,predictor);\n if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))\n {\n unsigned short\n units;\n\n /*\n Set image resolution.\n */\n units=RESUNIT_NONE;\n if (image->units == PixelsPerInchResolution)\n units=RESUNIT_INCH;\n if (image->units == PixelsPerCentimeterResolution)\n units=RESUNIT_CENTIMETER;\n (void) TIFFSetField(tiff,TIFFTAG_RESOLUTIONUNIT,(uint16) units);\n (void) TIFFSetField(tiff,TIFFTAG_XRESOLUTION,image->x_resolution);\n (void) TIFFSetField(tiff,TIFFTAG_YRESOLUTION,image->y_resolution);\n if ((image->page.x < 0) || (image->page.y < 0))\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"TIFF: negative image positions unsupported\",\"%s\",\n image->filename);\n if ((image->page.x > 0) && (image->x_resolution > 0.0))\n {\n /*\n Set horizontal image position.\n */\n (void) TIFFSetField(tiff,TIFFTAG_XPOSITION,(float) image->page.x/\n image->x_resolution);\n }\n if ((image->page.y > 0) && (image->y_resolution > 0.0))\n {\n /*\n Set vertical image position.\n */\n (void) TIFFSetField(tiff,TIFFTAG_YPOSITION,(float) image->page.y/\n image->y_resolution);\n }\n }\n if (image->chromaticity.white_point.x != 0.0)\n {\n float\n chromaticity[6];\n\n /*\n Set image chromaticity.\n */\n chromaticity[0]=(float) image->chromaticity.red_primary.x;\n chromaticity[1]=(float) image->chromaticity.red_primary.y;\n chromaticity[2]=(float) image->chromaticity.green_primary.x;\n chromaticity[3]=(float) image->chromaticity.green_primary.y;\n chromaticity[4]=(float) image->chromaticity.blue_primary.x;\n chromaticity[5]=(float) image->chromaticity.blue_primary.y;\n (void) TIFFSetField(tiff,TIFFTAG_PRIMARYCHROMATICITIES,chromaticity);\n chromaticity[0]=(float) image->chromaticity.white_point.x;\n chromaticity[1]=(float) image->chromaticity.white_point.y;\n (void) TIFFSetField(tiff,TIFFTAG_WHITEPOINT,chromaticity);\n }\n if ((LocaleCompare(image_info->magick,\"PTIF\") != 0) &&\n (image_info->adjoin != MagickFalse) && (imageListLength > 1))\n {\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE);\n if (image->scene != 0)\n (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,(uint16) image->scene,\n imageListLength);\n }\n if (image->orientation != UndefinedOrientation)\n (void) TIFFSetField(tiff,TIFFTAG_ORIENTATION,(uint16) image->orientation);\n else\n (void) TIFFSetField(tiff,TIFFTAG_ORIENTATION,ORIENTATION_TOPLEFT);\n (void) TIFFSetProfiles(tiff,image);\n {\n uint16\n page,\n pages;\n\n page=(uint16) scene;\n pages=(uint16) imageListLength;\n if ((LocaleCompare(image_info->magick,\"PTIF\") != 0) &&\n (image_info->adjoin != MagickFalse) && (pages > 1))\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE);\n (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,page,pages);\n }\n (void) TIFFSetProperties(tiff,image_info,image);\nDisableMSCWarning(4127)\n if (0)\nRestoreMSCWarning\n (void) TIFFSetEXIFProperties(tiff,image);\n /*\n Write image scanlines.\n */\n if (GetTIFFInfo(image_info,tiff,&tiff_info) == MagickFalse)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n quantum_info->endian=LSBEndian;\n pixels=GetQuantumPixels(quantum_info);\n tiff_info.scanline=GetQuantumPixels(quantum_info);\n switch (photometric)\n {\n case PHOTOMETRIC_CIELAB:\n case PHOTOMETRIC_YCBCR:\n case PHOTOMETRIC_RGB:\n {\n /*\n RGB TIFF image.\n */\n switch (image_info->interlace)\n {\n case NoInterlace:\n default:\n {\n quantum_type=RGBQuantum;\n if (image->matte != MagickFalse)\n quantum_type=RGBAQuantum;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case PlaneInterlace:\n case PartitionInterlace:\n {\n /*\n Plane interlacing: RRRRRR...GGGGGG...BBBBBB...\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,RedQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,100,400);\n if (status == MagickFalse)\n break;\n }\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GreenQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,1,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,200,400);\n if (status == MagickFalse)\n break;\n }\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,BlueQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,2,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,300,400);\n if (status == MagickFalse)\n break;\n }\n if (image->matte != MagickFalse)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,\n &image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,AlphaQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,3,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,400,400);\n if (status == MagickFalse)\n break;\n }\n break;\n }\n }\n break;\n }\n case PHOTOMETRIC_SEPARATED:\n {\n /*\n CMYK TIFF image.\n */\n quantum_type=CMYKQuantum;\n if (image->matte != MagickFalse)\n quantum_type=CMYKAQuantum;\n if (image->colorspace != CMYKColorspace)\n (void) TransformImageColorspace(image,CMYKColorspace);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case PHOTOMETRIC_PALETTE:\n {\n uint16\n *blue,\n *green,\n *red;\n\n /*\n Colormapped TIFF image.\n */\n red=(uint16 *) AcquireQuantumMemory(65536,sizeof(*red));\n green=(uint16 *) AcquireQuantumMemory(65536,sizeof(*green));\n blue=(uint16 *) AcquireQuantumMemory(65536,sizeof(*blue));\n if ((red == (uint16 *) NULL) || (green == (uint16 *) NULL) ||\n (blue == (uint16 *) NULL))\n {\n if (red != (uint16 *) NULL)\n red=(uint16 *) RelinquishMagickMemory(red);\n if (green != (uint16 *) NULL)\n green=(uint16 *) RelinquishMagickMemory(green);\n if (blue != (uint16 *) NULL)\n blue=(uint16 *) RelinquishMagickMemory(blue);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n /*\n Initialize TIFF colormap.\n */\n (void) memset(red,0,65536*sizeof(*red));\n (void) memset(green,0,65536*sizeof(*green));\n (void) memset(blue,0,65536*sizeof(*blue));\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n red[i]=ScaleQuantumToShort(image->colormap[i].red);\n green[i]=ScaleQuantumToShort(image->colormap[i].green);\n blue[i]=ScaleQuantumToShort(image->colormap[i].blue);\n }\n (void) TIFFSetField(tiff,TIFFTAG_COLORMAP,red,green,blue);\n red=(uint16 *) RelinquishMagickMemory(red);\n green=(uint16 *) RelinquishMagickMemory(green);\n blue=(uint16 *) RelinquishMagickMemory(blue);\n }\n default:\n {\n /*\n Convert PseudoClass packets to contiguous grayscale scanlines.\n */\n quantum_type=IndexQuantum;\n if (image->matte != MagickFalse)\n {\n if (photometric != PHOTOMETRIC_PALETTE)\n quantum_type=GrayAlphaQuantum;\n else\n quantum_type=IndexAlphaQuantum;\n }\n else\n if (photometric != PHOTOMETRIC_PALETTE)\n quantum_type=GrayQuantum;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n }\n quantum_info=DestroyQuantumInfo(quantum_info);\n if (image->colorspace == LabColorspace)\n DecodeLabImage(image,&image->exception);\n DestroyTIFFInfo(&tiff_info);\nDisableMSCWarning(4127)\n if (0 && (image_info->verbose != MagickFalse))\nRestoreMSCWarning\n TIFFPrintDirectory(tiff,stdout,MagickFalse);\n if (TIFFWriteDirectory(tiff) == 0)\n {\n status=MagickFalse;\n break;\n }\n image=SyncNextImageInList(image);\n if (image == (Image *) NULL)\n break;\n status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength);\n if (status == MagickFalse)\n break;\n } while (image_info->adjoin != MagickFalse);\n TIFFClose(tiff);\n return(status);\n}","lang":"c","vul_type":"cwe-125","target_token_count":7671,"sven_meta":{"func_name":"WriteTIFFImage","file_name":"coders/tiff.c","commit_link":"github.com/ImageMagick/ImageMagick6/commit/3c53413eb544cc567309b4c86485eae43e956112","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#98-421c9a43df34","input":"static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env,\n\t\t\t\t struct bpf_insn *insn,\n\t\t\t\t struct bpf_reg_state *dst_reg,\n\t\t\t\t struct bpf_reg_state src_reg)\n{\n\tstruct bpf_reg_state *regs = cur_regs(env);\n\tu8 opcode = BPF_OP(insn->code);\n\tbool src_known, dst_known;\n\ts64 smin_val, smax_val;\n\tu64 umin_val, umax_val;\n\tu64 insn_bitness = (BPF_CLASS(insn->code) == BPF_ALU64) ? 64 : 32;\n\n\tsmin_val = src_reg.smin_value;\n\tsmax_val = src_reg.smax_value;\n\tumin_val = src_reg.umin_value;\n\tumax_val = src_reg.umax_value;\n\tsrc_known = tnum_is_const(src_reg.var_off);\n\tdst_known = tnum_is_const(dst_reg->var_off);\n\n\tif ((src_known && (smin_val != smax_val || umin_val != umax_val)) ||\n\t smin_val > smax_val || umin_val > umax_val) {\n\t\t/* Taint dst register if offset had invalid bounds derived from\n\t\t * e.g. dead branches.\n\t\t */\n\t\t__mark_reg_unknown(dst_reg);\n\t\treturn 0;\n\t}\n\n\tif (!src_known &&\n\t opcode != BPF_ADD && opcode != BPF_SUB && opcode != BPF_AND) {\n\t\t__mark_reg_unknown(dst_reg);\n\t\treturn 0;\n\t}\n\n\tswitch (opcode) {\n\tcase BPF_ADD:\n\t\tif (signed_add_overflows(dst_reg->smin_value, smin_val) ||\n\t\t signed_add_overflows(dst_reg->smax_value, smax_val)) {\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value += smin_val;\n\t\t\tdst_reg->smax_value += smax_val;\n\t\t}\n\t\tif (dst_reg->umin_value + umin_val < umin_val ||\n\t\t dst_reg->umax_value + umax_val < umax_val) {\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\tdst_reg->umin_value += umin_val;\n\t\t\tdst_reg->umax_value += umax_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_add(dst_reg->var_off, src_reg.var_off);\n\t\tbreak;\n\tcase BPF_SUB:\n\t\tif (signed_sub_overflows(dst_reg->smin_value, smax_val) ||\n\t\t signed_sub_overflows(dst_reg->smax_value, smin_val)) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value -= smax_val;\n\t\t\tdst_reg->smax_value -= smin_val;\n\t\t}\n\t\tif (dst_reg->umin_value < umax_val) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\t/* Cannot overflow (as long as bounds are consistent) */\n\t\t\tdst_reg->umin_value -= umax_val;\n\t\t\tdst_reg->umax_value -= umin_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_sub(dst_reg->var_off, src_reg.var_off);\n\t\tbreak;\n\tcase BPF_MUL:\n\t\tdst_reg->var_off = tnum_mul(dst_reg->var_off, src_reg.var_off);\n\t\tif (smin_val < 0 || dst_reg->smin_value < 0) {\n\t\t\t/* Ain't nobody got time to multiply that sign */\n\t\t\t__mark_reg_unbounded(dst_reg);\n\t\t\t__update_reg_bounds(dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* Both values are positive, so we can work with unsigned and\n\t\t * copy the result to signed (unless it exceeds S64_MAX).\n\t\t */\n\t\tif (umax_val > U32_MAX || dst_reg->umax_value > U32_MAX) {\n\t\t\t/* Potential overflow, we know nothing */\n\t\t\t__mark_reg_unbounded(dst_reg);\n\t\t\t/* (except what we can learn from the var_off) */\n\t\t\t__update_reg_bounds(dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\tdst_reg->umin_value *= umin_val;\n\t\tdst_reg->umax_value *= umax_val;\n\t\tif (dst_reg->umax_value > S64_MAX) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\tbreak;\n\tcase BPF_AND:\n\t\tif (src_known && dst_known) {\n\t\t\t__mark_reg_known(dst_reg, dst_reg->var_off.value &\n\t\t\t\t\t\t src_reg.var_off.value);\n\t\t\tbreak;\n\t\t}\n\t\t/* We get our minimum from the var_off, since that's inherently\n\t\t * bitwise. Our maximum is the minimum of the operands' maxima.\n\t\t */\n\t\tdst_reg->var_off = tnum_and(dst_reg->var_off, src_reg.var_off);\n\t\tdst_reg->umin_value = dst_reg->var_off.value;\n\t\tdst_reg->umax_value = min(dst_reg->umax_value, umax_val);\n\t\tif (dst_reg->smin_value < 0 || smin_val < 0) {\n\t\t\t/* Lose signed bounds when ANDing negative numbers,\n\t\t\t * ain't nobody got time for that.\n\t\t\t */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\t/* ANDing two positives gives a positive, so safe to\n\t\t\t * cast result into s64.\n\t\t\t */\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_OR:\n\t\tif (src_known && dst_known) {\n\t\t\t__mark_reg_known(dst_reg, dst_reg->var_off.value |\n\t\t\t\t\t\t src_reg.var_off.value);\n\t\t\tbreak;\n\t\t}\n\t\t/* We get our maximum from the var_off, and our minimum is the\n\t\t * maximum of the operands' minima\n\t\t */\n\t\tdst_reg->var_off = tnum_or(dst_reg->var_off, src_reg.var_off);\n\t\tdst_reg->umin_value = max(dst_reg->umin_value, umin_val);\n\t\tdst_reg->umax_value = dst_reg->var_off.value |\n\t\t\t\t dst_reg->var_off.mask;\n\t\tif (dst_reg->smin_value < 0 || smin_val < 0) {\n\t\t\t/* Lose signed bounds when ORing negative numbers,\n\t\t\t * ain't nobody got time for that.\n\t\t\t */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\t/* ORing two positives gives a positive, so safe to\n\t\t\t * cast result into s64.\n\t\t\t */\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_LSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* We lose all sign bit information (except what we can pick\n\t\t * up from var_off)\n\t\t */\n\t\tdst_reg->smin_value = S64_MIN;\n\t\tdst_reg->smax_value = S64_MAX;\n\t\t/* If we might shift our top bit out, then we know nothing */\n\t\tif (dst_reg->umax_value > 1ULL << (63 - umax_val)) {\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\tdst_reg->umin_value <<= umin_val;\n\t\t\tdst_reg->umax_value <<= umax_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_lshift(dst_reg->var_off, umin_val);\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_RSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* BPF_RSH is an unsigned shift. If the value in dst_reg might\n\t\t * be negative, then either:\n\t\t * 1) src_reg might be zero, so the sign bit of the result is\n\t\t * unknown, so we lose our signed bounds\n\t\t * 2) it's known negative, thus the unsigned bounds capture the\n\t\t * signed bounds\n\t\t * 3) the signed bounds cross zero, so they tell us nothing\n\t\t * about the result\n\t\t * If the value in dst_reg is known nonnegative, then again the\n\t\t * unsigned bounts capture the signed bounds.\n\t\t * Thus, in all cases it suffices to blow away our signed bounds\n\t\t * and rely on inferring new ones from the unsigned bounds and\n\t\t * var_off of the result.\n\t\t */\n\t\tdst_reg->smin_value = S64_MIN;\n\t\tdst_reg->smax_value = S64_MAX;\n\t\tdst_reg->var_off = tnum_rshift(dst_reg->var_off, umin_val);\n\t\tdst_reg->umin_value >>= umax_val;\n\t\tdst_reg->umax_value >>= umin_val;\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_ARSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Upon reaching here, src_known is true and\n\t\t * umax_val is equal to umin_val.\n\t\t */\n\t\tdst_reg->smin_value >>= umin_val;\n\t\tdst_reg->smax_value >>= umin_val;\n\t\tdst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val);\n\n\t\t/* blow away the dst_reg umin_value/umax_value and rely on\n\t\t * dst_reg var_off to refine the result.\n\t\t */\n\t\tdst_reg->umin_value = 0;\n\t\tdst_reg->umax_value = U64_MAX;\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tdefault:\n\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\tbreak;\n\t}\n\n\tif (BPF_CLASS(insn->code) != BPF_ALU64) {\n\t\t/* 32-bit ALU ops are (32,32)->32 */\n\t\tcoerce_reg_to_size(dst_reg, 4);\n\t\tcoerce_reg_to_size(&src_reg, 4);\n\t}\n\n\t__reg_deduce_bounds(dst_reg);\n\t__reg_bound_offset(dst_reg);\n\treturn 0;\n}","target":"static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env,\n\t\t\t\t struct bpf_insn *insn,\n\t\t\t\t struct bpf_reg_state *dst_reg,\n\t\t\t\t struct bpf_reg_state src_reg)\n{\n\tstruct bpf_reg_state *regs = cur_regs(env);\n\tu8 opcode = BPF_OP(insn->code);\n\tbool src_known, dst_known;\n\ts64 smin_val, smax_val;\n\tu64 umin_val, umax_val;\n\tu64 insn_bitness = (BPF_CLASS(insn->code) == BPF_ALU64) ? 64 : 32;\n\n\tif (insn_bitness == 32) {\n\t\t/* Relevant for 32-bit RSH: Information can propagate towards\n\t\t * LSB, so it isn't sufficient to only truncate the output to\n\t\t * 32 bits.\n\t\t */\n\t\tcoerce_reg_to_size(dst_reg, 4);\n\t\tcoerce_reg_to_size(&src_reg, 4);\n\t}\n\n\tsmin_val = src_reg.smin_value;\n\tsmax_val = src_reg.smax_value;\n\tumin_val = src_reg.umin_value;\n\tumax_val = src_reg.umax_value;\n\tsrc_known = tnum_is_const(src_reg.var_off);\n\tdst_known = tnum_is_const(dst_reg->var_off);\n\n\tif ((src_known && (smin_val != smax_val || umin_val != umax_val)) ||\n\t smin_val > smax_val || umin_val > umax_val) {\n\t\t/* Taint dst register if offset had invalid bounds derived from\n\t\t * e.g. dead branches.\n\t\t */\n\t\t__mark_reg_unknown(dst_reg);\n\t\treturn 0;\n\t}\n\n\tif (!src_known &&\n\t opcode != BPF_ADD && opcode != BPF_SUB && opcode != BPF_AND) {\n\t\t__mark_reg_unknown(dst_reg);\n\t\treturn 0;\n\t}\n\n\tswitch (opcode) {\n\tcase BPF_ADD:\n\t\tif (signed_add_overflows(dst_reg->smin_value, smin_val) ||\n\t\t signed_add_overflows(dst_reg->smax_value, smax_val)) {\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value += smin_val;\n\t\t\tdst_reg->smax_value += smax_val;\n\t\t}\n\t\tif (dst_reg->umin_value + umin_val < umin_val ||\n\t\t dst_reg->umax_value + umax_val < umax_val) {\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\tdst_reg->umin_value += umin_val;\n\t\t\tdst_reg->umax_value += umax_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_add(dst_reg->var_off, src_reg.var_off);\n\t\tbreak;\n\tcase BPF_SUB:\n\t\tif (signed_sub_overflows(dst_reg->smin_value, smax_val) ||\n\t\t signed_sub_overflows(dst_reg->smax_value, smin_val)) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value -= smax_val;\n\t\t\tdst_reg->smax_value -= smin_val;\n\t\t}\n\t\tif (dst_reg->umin_value < umax_val) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\t/* Cannot overflow (as long as bounds are consistent) */\n\t\t\tdst_reg->umin_value -= umax_val;\n\t\t\tdst_reg->umax_value -= umin_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_sub(dst_reg->var_off, src_reg.var_off);\n\t\tbreak;\n\tcase BPF_MUL:\n\t\tdst_reg->var_off = tnum_mul(dst_reg->var_off, src_reg.var_off);\n\t\tif (smin_val < 0 || dst_reg->smin_value < 0) {\n\t\t\t/* Ain't nobody got time to multiply that sign */\n\t\t\t__mark_reg_unbounded(dst_reg);\n\t\t\t__update_reg_bounds(dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* Both values are positive, so we can work with unsigned and\n\t\t * copy the result to signed (unless it exceeds S64_MAX).\n\t\t */\n\t\tif (umax_val > U32_MAX || dst_reg->umax_value > U32_MAX) {\n\t\t\t/* Potential overflow, we know nothing */\n\t\t\t__mark_reg_unbounded(dst_reg);\n\t\t\t/* (except what we can learn from the var_off) */\n\t\t\t__update_reg_bounds(dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\tdst_reg->umin_value *= umin_val;\n\t\tdst_reg->umax_value *= umax_val;\n\t\tif (dst_reg->umax_value > S64_MAX) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\tbreak;\n\tcase BPF_AND:\n\t\tif (src_known && dst_known) {\n\t\t\t__mark_reg_known(dst_reg, dst_reg->var_off.value &\n\t\t\t\t\t\t src_reg.var_off.value);\n\t\t\tbreak;\n\t\t}\n\t\t/* We get our minimum from the var_off, since that's inherently\n\t\t * bitwise. Our maximum is the minimum of the operands' maxima.\n\t\t */\n\t\tdst_reg->var_off = tnum_and(dst_reg->var_off, src_reg.var_off);\n\t\tdst_reg->umin_value = dst_reg->var_off.value;\n\t\tdst_reg->umax_value = min(dst_reg->umax_value, umax_val);\n\t\tif (dst_reg->smin_value < 0 || smin_val < 0) {\n\t\t\t/* Lose signed bounds when ANDing negative numbers,\n\t\t\t * ain't nobody got time for that.\n\t\t\t */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\t/* ANDing two positives gives a positive, so safe to\n\t\t\t * cast result into s64.\n\t\t\t */\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_OR:\n\t\tif (src_known && dst_known) {\n\t\t\t__mark_reg_known(dst_reg, dst_reg->var_off.value |\n\t\t\t\t\t\t src_reg.var_off.value);\n\t\t\tbreak;\n\t\t}\n\t\t/* We get our maximum from the var_off, and our minimum is the\n\t\t * maximum of the operands' minima\n\t\t */\n\t\tdst_reg->var_off = tnum_or(dst_reg->var_off, src_reg.var_off);\n\t\tdst_reg->umin_value = max(dst_reg->umin_value, umin_val);\n\t\tdst_reg->umax_value = dst_reg->var_off.value |\n\t\t\t\t dst_reg->var_off.mask;\n\t\tif (dst_reg->smin_value < 0 || smin_val < 0) {\n\t\t\t/* Lose signed bounds when ORing negative numbers,\n\t\t\t * ain't nobody got time for that.\n\t\t\t */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\t/* ORing two positives gives a positive, so safe to\n\t\t\t * cast result into s64.\n\t\t\t */\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_LSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* We lose all sign bit information (except what we can pick\n\t\t * up from var_off)\n\t\t */\n\t\tdst_reg->smin_value = S64_MIN;\n\t\tdst_reg->smax_value = S64_MAX;\n\t\t/* If we might shift our top bit out, then we know nothing */\n\t\tif (dst_reg->umax_value > 1ULL << (63 - umax_val)) {\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\tdst_reg->umin_value <<= umin_val;\n\t\t\tdst_reg->umax_value <<= umax_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_lshift(dst_reg->var_off, umin_val);\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_RSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* BPF_RSH is an unsigned shift. If the value in dst_reg might\n\t\t * be negative, then either:\n\t\t * 1) src_reg might be zero, so the sign bit of the result is\n\t\t * unknown, so we lose our signed bounds\n\t\t * 2) it's known negative, thus the unsigned bounds capture the\n\t\t * signed bounds\n\t\t * 3) the signed bounds cross zero, so they tell us nothing\n\t\t * about the result\n\t\t * If the value in dst_reg is known nonnegative, then again the\n\t\t * unsigned bounts capture the signed bounds.\n\t\t * Thus, in all cases it suffices to blow away our signed bounds\n\t\t * and rely on inferring new ones from the unsigned bounds and\n\t\t * var_off of the result.\n\t\t */\n\t\tdst_reg->smin_value = S64_MIN;\n\t\tdst_reg->smax_value = S64_MAX;\n\t\tdst_reg->var_off = tnum_rshift(dst_reg->var_off, umin_val);\n\t\tdst_reg->umin_value >>= umax_val;\n\t\tdst_reg->umax_value >>= umin_val;\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_ARSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Upon reaching here, src_known is true and\n\t\t * umax_val is equal to umin_val.\n\t\t */\n\t\tdst_reg->smin_value >>= umin_val;\n\t\tdst_reg->smax_value >>= umin_val;\n\t\tdst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val);\n\n\t\t/* blow away the dst_reg umin_value/umax_value and rely on\n\t\t * dst_reg var_off to refine the result.\n\t\t */\n\t\tdst_reg->umin_value = 0;\n\t\tdst_reg->umax_value = U64_MAX;\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tdefault:\n\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\tbreak;\n\t}\n\n\tif (BPF_CLASS(insn->code) != BPF_ALU64) {\n\t\t/* 32-bit ALU ops are (32,32)->32 */\n\t\tcoerce_reg_to_size(dst_reg, 4);\n\t}\n\n\t__reg_deduce_bounds(dst_reg);\n\t__reg_bound_offset(dst_reg);\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":2643,"sven_meta":{"func_name":"adjust_scalar_min_max_vals","file_name":"kernel/bpf/verifier.c","commit_link":"github.com/torvalds/linux/commit/b799207e1e1816b09e7a5920fbb2d5fcf6edd681","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#102-03b25be49e8f","input":"static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,\n ExceptionInfo *exception)\n{\n char\n *attribute,\n format[MagickPathExtent],\n name[MagickPathExtent],\n *resource;\n\n const StringInfo\n *profile;\n\n const unsigned char\n *info;\n\n long\n start,\n stop;\n\n MagickBooleanType\n status;\n\n register ssize_t\n i;\n\n size_t\n length;\n\n ssize_t\n count,\n id,\n sub_number;\n\n /*\n There are no newlines in path names, so it's safe as terminator.\n */\n profile=GetImageProfile(image,\"8bim\");\n if (profile == (StringInfo *) NULL)\n return(MagickFalse);\n count=(ssize_t) sscanf(key,\"8BIM:%ld,%ld:%1024[^\\n]\\n%1024[^\\n]\",&start,&stop,\n name,format);\n if ((count != 2) && (count != 3) && (count != 4))\n return(MagickFalse);\n if (count < 4)\n (void) CopyMagickString(format,\"SVG\",MagickPathExtent);\n if (count < 3)\n *name='\\0';\n sub_number=1;\n if (*name == '#')\n sub_number=(ssize_t) StringToLong(&name[1]);\n sub_number=MagickMax(sub_number,1L);\n resource=(char *) NULL;\n status=MagickFalse;\n length=GetStringInfoLength(profile);\n info=GetStringInfoDatum(profile);\n while ((length > 0) && (status == MagickFalse))\n {\n if (ReadPropertyByte(&info,&length) != (unsigned char) '8')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'B')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'I')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'M')\n continue;\n id=(ssize_t) ReadPropertyMSBShort(&info,&length);\n if (id < (ssize_t) start)\n continue;\n if (id > (ssize_t) stop)\n continue;\n if (resource != (char *) NULL)\n resource=DestroyString(resource);\n count=(ssize_t) ReadPropertyByte(&info,&length);\n if ((count != 0) && ((size_t) count <= length))\n {\n resource=(char *) NULL;\n if (~((size_t) count) >= (MagickPathExtent-1))\n resource=(char *) AcquireQuantumMemory((size_t) count+\n MagickPathExtent,sizeof(*resource));\n if (resource != (char *) NULL)\n {\n for (i=0; i < (ssize_t) count; i++)\n resource[i]=(char) ReadPropertyByte(&info,&length);\n resource[count]='\\0';\n }\n }\n if ((count & 0x01) == 0)\n (void) ReadPropertyByte(&info,&length);\n count=(ssize_t) ReadPropertyMSBLong(&info,&length);\n if ((*name != '\\0') && (*name != '#'))\n if ((resource == (char *) NULL) || (LocaleCompare(name,resource) != 0))\n {\n /*\n No name match, scroll forward and try next.\n */\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n continue;\n }\n if ((*name == '#') && (sub_number != 1))\n {\n /*\n No numbered match, scroll forward and try next.\n */\n sub_number--;\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n continue;\n }\n /*\n We have the resource of interest.\n */\n attribute=(char *) NULL;\n if (~((size_t) count) >= (MagickPathExtent-1))\n attribute=(char *) AcquireQuantumMemory((size_t) count+MagickPathExtent,\n sizeof(*attribute));\n if (attribute != (char *) NULL)\n {\n (void) CopyMagickMemory(attribute,(char *) info,(size_t) count);\n attribute[count]='\\0';\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n if ((id <= 1999) || (id >= 2999))\n (void) SetImageProperty((Image *) image,key,(const char *)\n attribute,exception);\n else\n {\n char\n *path;\n\n if (LocaleCompare(format,\"svg\") == 0)\n path=TraceSVGClippath((unsigned char *) attribute,(size_t) count,\n image->columns,image->rows);\n else\n path=TracePSClippath((unsigned char *) attribute,(size_t) count);\n (void) SetImageProperty((Image *) image,key,(const char *) path,\n exception);\n path=DestroyString(path);\n }\n attribute=DestroyString(attribute);\n status=MagickTrue;\n }\n }\n if (resource != (char *) NULL)\n resource=DestroyString(resource);\n return(status);\n}","target":"static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,\n ExceptionInfo *exception)\n{\n char\n *attribute,\n format[MagickPathExtent],\n name[MagickPathExtent],\n *resource;\n\n const StringInfo\n *profile;\n\n const unsigned char\n *info;\n\n long\n start,\n stop;\n\n MagickBooleanType\n status;\n\n register ssize_t\n i;\n\n size_t\n length;\n\n ssize_t\n count,\n id,\n sub_number;\n\n /*\n There are no newlines in path names, so it's safe as terminator.\n */\n profile=GetImageProfile(image,\"8bim\");\n if (profile == (StringInfo *) NULL)\n return(MagickFalse);\n count=(ssize_t) sscanf(key,\"8BIM:%ld,%ld:%1024[^\\n]\\n%1024[^\\n]\",&start,&stop,\n name,format);\n if ((count != 2) && (count != 3) && (count != 4))\n return(MagickFalse);\n if (count < 4)\n (void) CopyMagickString(format,\"SVG\",MagickPathExtent);\n if (count < 3)\n *name='\\0';\n sub_number=1;\n if (*name == '#')\n sub_number=(ssize_t) StringToLong(&name[1]);\n sub_number=MagickMax(sub_number,1L);\n resource=(char *) NULL;\n status=MagickFalse;\n length=GetStringInfoLength(profile);\n info=GetStringInfoDatum(profile);\n while ((length > 0) && (status == MagickFalse))\n {\n if (ReadPropertyByte(&info,&length) != (unsigned char) '8')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'B')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'I')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'M')\n continue;\n id=(ssize_t) ReadPropertyMSBShort(&info,&length);\n if (id < (ssize_t) start)\n continue;\n if (id > (ssize_t) stop)\n continue;\n if (resource != (char *) NULL)\n resource=DestroyString(resource);\n count=(ssize_t) ReadPropertyByte(&info,&length);\n if ((count != 0) && ((size_t) count <= length))\n {\n resource=(char *) NULL;\n if (~((size_t) count) >= (MagickPathExtent-1))\n resource=(char *) AcquireQuantumMemory((size_t) count+\n MagickPathExtent,sizeof(*resource));\n if (resource != (char *) NULL)\n {\n for (i=0; i < (ssize_t) count; i++)\n resource[i]=(char) ReadPropertyByte(&info,&length);\n resource[count]='\\0';\n }\n }\n if ((count & 0x01) == 0)\n (void) ReadPropertyByte(&info,&length);\n count=(ssize_t) ReadPropertyMSBLong(&info,&length);\n if ((count < 0) || ((size_t) count > length))\n {\n length=0; \n continue;\n }\n if ((*name != '\\0') && (*name != '#'))\n if ((resource == (char *) NULL) || (LocaleCompare(name,resource) != 0))\n {\n /*\n No name match, scroll forward and try next.\n */\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n continue;\n }\n if ((*name == '#') && (sub_number != 1))\n {\n /*\n No numbered match, scroll forward and try next.\n */\n sub_number--;\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n continue;\n }\n /*\n We have the resource of interest.\n */\n attribute=(char *) NULL;\n if (~((size_t) count) >= (MagickPathExtent-1))\n attribute=(char *) AcquireQuantumMemory((size_t) count+MagickPathExtent,\n sizeof(*attribute));\n if (attribute != (char *) NULL)\n {\n (void) CopyMagickMemory(attribute,(char *) info,(size_t) count);\n attribute[count]='\\0';\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n if ((id <= 1999) || (id >= 2999))\n (void) SetImageProperty((Image *) image,key,(const char *)\n attribute,exception);\n else\n {\n char\n *path;\n\n if (LocaleCompare(format,\"svg\") == 0)\n path=TraceSVGClippath((unsigned char *) attribute,(size_t) count,\n image->columns,image->rows);\n else\n path=TracePSClippath((unsigned char *) attribute,(size_t) count);\n (void) SetImageProperty((Image *) image,key,(const char *) path,\n exception);\n path=DestroyString(path);\n }\n attribute=DestroyString(attribute);\n status=MagickTrue;\n }\n }\n if (resource != (char *) NULL)\n resource=DestroyString(resource);\n return(status);\n}","lang":"c","vul_type":"cwe-125","target_token_count":1163,"sven_meta":{"func_name":"Get8BIMProperty","file_name":"MagickCore/property.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/dd84447b63a71fa8c3f47071b09454efc667767b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#103-afe312d9814f","input":"static const char *parse_string(cJSON *item,const char *str,const char **ep)\n{\n\tconst char *ptr=str+1,*end_ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2;\n\tif (*str!='\\\"') {*ep=str;return 0;}\t/* not a string! */\n\t\n\twhile (*end_ptr!='\\\"' && *end_ptr && ++len) if (*end_ptr++ == '\\\\') end_ptr++;\t/* Skip escaped quotes. */\n\t\n\tout=(char*)cJSON_malloc(len+1);\t/* This is how long we need for the string, roughly. */\n\tif (!out) return 0;\n\titem->valuestring=out; /* assign here so out will be deleted during cJSON_Delete() later */\n\titem->type=cJSON_String;\n\t\n\tptr=str+1;ptr2=out;\n\twhile (ptr < end_ptr)\n\t{\n\t\tif (*ptr!='\\\\') *ptr2++=*ptr++;\n\t\telse\n\t\t{\n\t\t\tptr++;\n\t\t\tswitch (*ptr)\n\t\t\t{\n\t\t\t\tcase 'b': *ptr2++='\\b';\tbreak;\n\t\t\t\tcase 'f': *ptr2++='\\f';\tbreak;\n\t\t\t\tcase 'n': *ptr2++='\\n';\tbreak;\n\t\t\t\tcase 'r': *ptr2++='\\r';\tbreak;\n\t\t\t\tcase 't': *ptr2++='\\t';\tbreak;\n\t\t\t\tcase 'u':\t /* transcode utf16 to utf8. */\n\t\t\t\t\tuc=parse_hex4(ptr+1);ptr+=4;\t/* get the unicode char. */\n\t\t\t\t\tif (ptr >= end_ptr) {*ep=str;return 0;}\t/* invalid */\n\t\t\t\t\t\n\t\t\t\t\tif ((uc>=0xDC00 && uc<=0xDFFF) || uc==0) {*ep=str;return 0;}\t/* check for invalid. */\n\t\t\t\t\t\n\t\t\t\t\tif (uc>=0xD800 && uc<=0xDBFF)\t/* UTF16 surrogate pairs.\t*/\n\t\t\t\t\t{\n\t\t\t\t\t\tif (ptr+6 > end_ptr) {*ep=str;return 0;}\t/* invalid */\n\t\t\t\t\t\tif (ptr[1]!='\\\\' || ptr[2]!='u') {*ep=str;return 0;}\t/* missing second-half of surrogate. */\n\t\t\t\t\t\tuc2=parse_hex4(ptr+3);ptr+=6;\n\t\t\t\t\t\tif (uc2<0xDC00 || uc2>0xDFFF) {*ep=str;return 0;}\t/* invalid second-half of surrogate. */\n\t\t\t\t\t\tuc=0x10000 + (((uc&0x3FF)<<10) | (uc2&0x3FF));\n\t\t\t\t\t}\n\n\t\t\t\t\tlen=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len;\n\t\t\t\t\t\n\t\t\t\t\tswitch (len) {\n\t\t\t\t\t\tcase 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 1: *--ptr2 =(uc | firstByteMark[len]);\n\t\t\t\t\t}\n\t\t\t\t\tptr2+=len;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: *ptr2++=*ptr; break;\n\t\t\t}\n\t\t\tptr++;\n\t\t}\n\t}\n\t*ptr2=0;\n\tif (*ptr=='\\\"') ptr++;\n\treturn ptr;\n}","target":"static const char *parse_string(cJSON *item,const char *str,const char **ep)\n{\n\tconst char *ptr=str+1,*end_ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2;\n\tif (*str!='\\\"') {*ep=str;return 0;}\t/* not a string! */\n\n\twhile (*end_ptr!='\\\"' && *end_ptr && ++len)\n\t{\n\t if (*end_ptr++ == '\\\\')\n\t {\n\t\tif (*end_ptr == '\\0')\n\t\t{\n\t\t /* prevent buffer overflow when last input character is a backslash */\n\t\t return 0;\n\t\t}\n\t\tend_ptr++;\t/* Skip escaped quotes. */\n\t }\n\t}\n\n\tout=(char*)cJSON_malloc(len+1);\t/* This is how long we need for the string, roughly. */\n\tif (!out) return 0;\n\titem->valuestring=out; /* assign here so out will be deleted during cJSON_Delete() later */\n\titem->type=cJSON_String;\n\t\n\tptr=str+1;ptr2=out;\n\twhile (ptr < end_ptr)\n\t{\n\t\tif (*ptr!='\\\\') *ptr2++=*ptr++;\n\t\telse\n\t\t{\n\t\t\tptr++;\n\t\t\tswitch (*ptr)\n\t\t\t{\n\t\t\t\tcase 'b': *ptr2++='\\b';\tbreak;\n\t\t\t\tcase 'f': *ptr2++='\\f';\tbreak;\n\t\t\t\tcase 'n': *ptr2++='\\n';\tbreak;\n\t\t\t\tcase 'r': *ptr2++='\\r';\tbreak;\n\t\t\t\tcase 't': *ptr2++='\\t';\tbreak;\n\t\t\t\tcase 'u':\t /* transcode utf16 to utf8. */\n\t\t\t\t\tuc=parse_hex4(ptr+1);ptr+=4;\t/* get the unicode char. */\n\t\t\t\t\tif (ptr >= end_ptr) {*ep=str;return 0;}\t/* invalid */\n\t\t\t\t\t\n\t\t\t\t\tif ((uc>=0xDC00 && uc<=0xDFFF) || uc==0) {*ep=str;return 0;}\t/* check for invalid. */\n\t\t\t\t\t\n\t\t\t\t\tif (uc>=0xD800 && uc<=0xDBFF)\t/* UTF16 surrogate pairs.\t*/\n\t\t\t\t\t{\n\t\t\t\t\t\tif (ptr+6 > end_ptr) {*ep=str;return 0;}\t/* invalid */\n\t\t\t\t\t\tif (ptr[1]!='\\\\' || ptr[2]!='u') {*ep=str;return 0;}\t/* missing second-half of surrogate. */\n\t\t\t\t\t\tuc2=parse_hex4(ptr+3);ptr+=6;\n\t\t\t\t\t\tif (uc2<0xDC00 || uc2>0xDFFF) {*ep=str;return 0;}\t/* invalid second-half of surrogate. */\n\t\t\t\t\t\tuc=0x10000 + (((uc&0x3FF)<<10) | (uc2&0x3FF));\n\t\t\t\t\t}\n\n\t\t\t\t\tlen=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len;\n\t\t\t\t\t\n\t\t\t\t\tswitch (len) {\n\t\t\t\t\t\tcase 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 1: *--ptr2 =(uc | firstByteMark[len]);\n\t\t\t\t\t}\n\t\t\t\t\tptr2+=len;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: *ptr2++=*ptr; break;\n\t\t\t}\n\t\t\tptr++;\n\t\t}\n\t}\n\t*ptr2=0;\n\tif (*ptr=='\\\"') ptr++;\n\treturn ptr;\n}","lang":"c","vul_type":"cwe-125","target_token_count":830,"sven_meta":{"func_name":"parse_string","file_name":"cJSON.c","commit_link":"github.com/DaveGamble/cJSON/commit/94df772485c92866ca417d92137747b2e3b0a917","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#104-e0bbfbc00b74","input":"dbd_st_prepare(\n SV *sth,\n imp_sth_t *imp_sth,\n char *statement,\n SV *attribs)\n{\n int i;\n SV **svp;\n dTHX;\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n#if MYSQL_VERSION_ID < CALL_PLACEHOLDER_VERSION\n char *str_ptr, *str_last_ptr;\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n int limit_flag=0;\n#endif\n#endif\n int col_type, prepare_retval;\n MYSQL_BIND *bind, *bind_end;\n imp_sth_phb_t *fbind;\n#endif\n D_imp_xxh(sth);\n D_imp_dbh_from_sth;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t-> dbd_st_prepare MYSQL_VERSION_ID %d, SQL statement: %s\\n\",\n MYSQL_VERSION_ID, statement);\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n /* Set default value of 'mysql_server_prepare' attribute for sth from dbh */\n imp_sth->use_server_side_prepare= imp_dbh->use_server_side_prepare;\n if (attribs)\n {\n svp= DBD_ATTRIB_GET_SVP(attribs, \"mysql_server_prepare\", 20);\n imp_sth->use_server_side_prepare = (svp) ?\n SvTRUE(*svp) : imp_dbh->use_server_side_prepare;\n\n svp = DBD_ATTRIB_GET_SVP(attribs, \"async\", 5);\n\n if(svp && SvTRUE(*svp)) {\n#if MYSQL_ASYNC\n imp_sth->is_async = TRUE;\n imp_sth->use_server_side_prepare = FALSE;\n#else\n do_error(sth, 2000,\n \"Async support was not built into this version of DBD::mysql\", \"HY000\");\n return 0;\n#endif\n }\n }\n\n imp_sth->fetch_done= 0;\n#endif\n\n imp_sth->done_desc= 0;\n imp_sth->result= NULL;\n imp_sth->currow= 0;\n\n /* Set default value of 'mysql_use_result' attribute for sth from dbh */\n svp= DBD_ATTRIB_GET_SVP(attribs, \"mysql_use_result\", 16);\n imp_sth->use_mysql_use_result= svp ?\n SvTRUE(*svp) : imp_dbh->use_mysql_use_result;\n\n for (i= 0; i < AV_ATTRIB_LAST; i++)\n imp_sth->av_attr[i]= Nullav;\n\n /*\n Clean-up previous result set(s) for sth to prevent\n 'Commands out of sync' error \n */\n mysql_st_free_result_sets(sth, imp_sth);\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION && MYSQL_VERSION_ID < CALL_PLACEHOLDER_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tuse_server_side_prepare set, check restrictions\\n\");\n /*\n This code is here because placeholder support is not implemented for\n statements with :-\n 1. LIMIT < 5.0.7\n 2. CALL < 5.5.3 (Added support for out & inout parameters)\n In these cases we have to disable server side prepared statements\n NOTE: These checks could cause a false positive on statements which\n include columns / table names that match \"call \" or \" limit \"\n */ \n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n \"\\t\\tneed to test for LIMIT & CALL\\n\");\n#else\n \"\\t\\tneed to test for restrictions\\n\");\n#endif\n str_last_ptr = statement + strlen(statement);\n for (str_ptr= statement; str_ptr < str_last_ptr; str_ptr++)\n {\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n /*\n Place holders not supported in LIMIT's\n */\n if (limit_flag)\n {\n if (*str_ptr == '?')\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tLIMIT and ? found, set to use_server_side_prepare=0\\n\");\n /* ... then we do not want to try server side prepare (use emulation) */\n imp_sth->use_server_side_prepare= 0;\n break;\n }\n }\n else if (str_ptr < str_last_ptr - 6 &&\n isspace(*(str_ptr + 0)) &&\n tolower(*(str_ptr + 1)) == 'l' &&\n tolower(*(str_ptr + 2)) == 'i' &&\n tolower(*(str_ptr + 3)) == 'm' &&\n tolower(*(str_ptr + 4)) == 'i' &&\n tolower(*(str_ptr + 5)) == 't' &&\n isspace(*(str_ptr + 6)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"LIMIT set limit flag to 1\\n\");\n limit_flag= 1;\n }\n#endif\n /*\n Place holders not supported in CALL's\n */\n if (str_ptr < str_last_ptr - 4 &&\n tolower(*(str_ptr + 0)) == 'c' &&\n tolower(*(str_ptr + 1)) == 'a' &&\n tolower(*(str_ptr + 2)) == 'l' &&\n tolower(*(str_ptr + 3)) == 'l' &&\n isspace(*(str_ptr + 4)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"Disable PS mode for CALL()\\n\");\n imp_sth->use_server_side_prepare= 0;\n break;\n }\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tuse_server_side_prepare set\\n\");\n /* do we really need this? If we do, we should return, not just continue */\n if (imp_sth->stmt)\n fprintf(stderr,\n \"ERROR: Trying to prepare new stmt while we have \\\n already not closed one \\n\");\n\n imp_sth->stmt= mysql_stmt_init(imp_dbh->pmysql);\n\n if (! imp_sth->stmt)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tERROR: Unable to return MYSQL_STMT structure \\\n from mysql_stmt_init(): ERROR NO: %d ERROR MSG:%s\\n\",\n mysql_errno(imp_dbh->pmysql),\n mysql_error(imp_dbh->pmysql));\n }\n\n prepare_retval= mysql_stmt_prepare(imp_sth->stmt,\n statement,\n strlen(statement));\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tmysql_stmt_prepare returned %d\\n\",\n prepare_retval);\n\n if (prepare_retval)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tmysql_stmt_prepare %d %s\\n\",\n mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt));\n\n /* For commands that are not supported by server side prepared statement\n mechanism lets try to pass them through regular API */\n if (mysql_stmt_errno(imp_sth->stmt) == ER_UNSUPPORTED_PS)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tSETTING imp_sth->use_server_side_prepare to 0\\n\");\n imp_sth->use_server_side_prepare= 0;\n }\n else\n {\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_sqlstate(imp_dbh->pmysql));\n mysql_stmt_close(imp_sth->stmt);\n imp_sth->stmt= NULL;\n return FALSE;\n }\n }\n else\n {\n DBIc_NUM_PARAMS(imp_sth)= mysql_stmt_param_count(imp_sth->stmt);\n /* mysql_stmt_param_count */\n\n if (DBIc_NUM_PARAMS(imp_sth) > 0)\n {\n int has_statement_fields= imp_sth->stmt->fields != 0;\n /* Allocate memory for bind variables */\n imp_sth->bind= alloc_bind(DBIc_NUM_PARAMS(imp_sth));\n imp_sth->fbind= alloc_fbind(DBIc_NUM_PARAMS(imp_sth));\n imp_sth->has_been_bound= 0;\n\n /* Initialize ph variables with NULL values */\n for (i= 0,\n bind= imp_sth->bind,\n fbind= imp_sth->fbind,\n bind_end= bind+DBIc_NUM_PARAMS(imp_sth);\n bind < bind_end ;\n bind++, fbind++, i++ )\n {\n /*\n if this statement has a result set, field types will be\n correctly identified. If there is no result set, such as\n with an INSERT, fields will not be defined, and all buffer_type\n will default to MYSQL_TYPE_VAR_STRING\n */\n col_type= (has_statement_fields ?\n imp_sth->stmt->fields[i].type : MYSQL_TYPE_STRING);\n\n bind->buffer_type= mysql_to_perl_type(col_type);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tmysql_to_perl_type returned %d\\n\", col_type);\n\n bind->buffer= NULL;\n bind->length= &(fbind->length);\n bind->is_null= (char*) &(fbind->is_null);\n fbind->is_null= 1;\n fbind->length= 0;\n }\n }\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n /* Count the number of parameters (driver, vs server-side) */\n if (imp_sth->use_server_side_prepare == 0)\n DBIc_NUM_PARAMS(imp_sth) = count_params((imp_xxh_t *)imp_dbh, aTHX_ statement,\n imp_dbh->bind_comment_placeholders);\n#else\n DBIc_NUM_PARAMS(imp_sth) = count_params((imp_xxh_t *)imp_dbh, aTHX_ statement,\n imp_dbh->bind_comment_placeholders);\n#endif\n\n /* Allocate memory for parameters */\n imp_sth->params= alloc_param(DBIc_NUM_PARAMS(imp_sth));\n DBIc_IMPSET_on(imp_sth);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_prepare\\n\");\n return 1;\n}","target":"dbd_st_prepare(\n SV *sth,\n imp_sth_t *imp_sth,\n char *statement,\n SV *attribs)\n{\n int i;\n SV **svp;\n dTHX;\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n#if MYSQL_VERSION_ID < CALL_PLACEHOLDER_VERSION\n char *str_ptr, *str_last_ptr;\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n int limit_flag=0;\n#endif\n#endif\n int prepare_retval;\n MYSQL_BIND *bind, *bind_end;\n imp_sth_phb_t *fbind;\n#endif\n D_imp_xxh(sth);\n D_imp_dbh_from_sth;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t-> dbd_st_prepare MYSQL_VERSION_ID %d, SQL statement: %s\\n\",\n MYSQL_VERSION_ID, statement);\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n /* Set default value of 'mysql_server_prepare' attribute for sth from dbh */\n imp_sth->use_server_side_prepare= imp_dbh->use_server_side_prepare;\n if (attribs)\n {\n svp= DBD_ATTRIB_GET_SVP(attribs, \"mysql_server_prepare\", 20);\n imp_sth->use_server_side_prepare = (svp) ?\n SvTRUE(*svp) : imp_dbh->use_server_side_prepare;\n\n svp = DBD_ATTRIB_GET_SVP(attribs, \"async\", 5);\n\n if(svp && SvTRUE(*svp)) {\n#if MYSQL_ASYNC\n imp_sth->is_async = TRUE;\n imp_sth->use_server_side_prepare = FALSE;\n#else\n do_error(sth, 2000,\n \"Async support was not built into this version of DBD::mysql\", \"HY000\");\n return 0;\n#endif\n }\n }\n\n imp_sth->fetch_done= 0;\n#endif\n\n imp_sth->done_desc= 0;\n imp_sth->result= NULL;\n imp_sth->currow= 0;\n\n /* Set default value of 'mysql_use_result' attribute for sth from dbh */\n svp= DBD_ATTRIB_GET_SVP(attribs, \"mysql_use_result\", 16);\n imp_sth->use_mysql_use_result= svp ?\n SvTRUE(*svp) : imp_dbh->use_mysql_use_result;\n\n for (i= 0; i < AV_ATTRIB_LAST; i++)\n imp_sth->av_attr[i]= Nullav;\n\n /*\n Clean-up previous result set(s) for sth to prevent\n 'Commands out of sync' error \n */\n mysql_st_free_result_sets(sth, imp_sth);\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION && MYSQL_VERSION_ID < CALL_PLACEHOLDER_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tuse_server_side_prepare set, check restrictions\\n\");\n /*\n This code is here because placeholder support is not implemented for\n statements with :-\n 1. LIMIT < 5.0.7\n 2. CALL < 5.5.3 (Added support for out & inout parameters)\n In these cases we have to disable server side prepared statements\n NOTE: These checks could cause a false positive on statements which\n include columns / table names that match \"call \" or \" limit \"\n */ \n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n \"\\t\\tneed to test for LIMIT & CALL\\n\");\n#else\n \"\\t\\tneed to test for restrictions\\n\");\n#endif\n str_last_ptr = statement + strlen(statement);\n for (str_ptr= statement; str_ptr < str_last_ptr; str_ptr++)\n {\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n /*\n Place holders not supported in LIMIT's\n */\n if (limit_flag)\n {\n if (*str_ptr == '?')\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tLIMIT and ? found, set to use_server_side_prepare=0\\n\");\n /* ... then we do not want to try server side prepare (use emulation) */\n imp_sth->use_server_side_prepare= 0;\n break;\n }\n }\n else if (str_ptr < str_last_ptr - 6 &&\n isspace(*(str_ptr + 0)) &&\n tolower(*(str_ptr + 1)) == 'l' &&\n tolower(*(str_ptr + 2)) == 'i' &&\n tolower(*(str_ptr + 3)) == 'm' &&\n tolower(*(str_ptr + 4)) == 'i' &&\n tolower(*(str_ptr + 5)) == 't' &&\n isspace(*(str_ptr + 6)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"LIMIT set limit flag to 1\\n\");\n limit_flag= 1;\n }\n#endif\n /*\n Place holders not supported in CALL's\n */\n if (str_ptr < str_last_ptr - 4 &&\n tolower(*(str_ptr + 0)) == 'c' &&\n tolower(*(str_ptr + 1)) == 'a' &&\n tolower(*(str_ptr + 2)) == 'l' &&\n tolower(*(str_ptr + 3)) == 'l' &&\n isspace(*(str_ptr + 4)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"Disable PS mode for CALL()\\n\");\n imp_sth->use_server_side_prepare= 0;\n break;\n }\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tuse_server_side_prepare set\\n\");\n /* do we really need this? If we do, we should return, not just continue */\n if (imp_sth->stmt)\n fprintf(stderr,\n \"ERROR: Trying to prepare new stmt while we have \\\n already not closed one \\n\");\n\n imp_sth->stmt= mysql_stmt_init(imp_dbh->pmysql);\n\n if (! imp_sth->stmt)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tERROR: Unable to return MYSQL_STMT structure \\\n from mysql_stmt_init(): ERROR NO: %d ERROR MSG:%s\\n\",\n mysql_errno(imp_dbh->pmysql),\n mysql_error(imp_dbh->pmysql));\n }\n\n prepare_retval= mysql_stmt_prepare(imp_sth->stmt,\n statement,\n strlen(statement));\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tmysql_stmt_prepare returned %d\\n\",\n prepare_retval);\n\n if (prepare_retval)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tmysql_stmt_prepare %d %s\\n\",\n mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt));\n\n /* For commands that are not supported by server side prepared statement\n mechanism lets try to pass them through regular API */\n if (mysql_stmt_errno(imp_sth->stmt) == ER_UNSUPPORTED_PS)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tSETTING imp_sth->use_server_side_prepare to 0\\n\");\n imp_sth->use_server_side_prepare= 0;\n }\n else\n {\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_sqlstate(imp_dbh->pmysql));\n mysql_stmt_close(imp_sth->stmt);\n imp_sth->stmt= NULL;\n return FALSE;\n }\n }\n else\n {\n DBIc_NUM_PARAMS(imp_sth)= mysql_stmt_param_count(imp_sth->stmt);\n /* mysql_stmt_param_count */\n\n if (DBIc_NUM_PARAMS(imp_sth) > 0)\n {\n /* Allocate memory for bind variables */\n imp_sth->bind= alloc_bind(DBIc_NUM_PARAMS(imp_sth));\n imp_sth->fbind= alloc_fbind(DBIc_NUM_PARAMS(imp_sth));\n imp_sth->has_been_bound= 0;\n\n /* Initialize ph variables with NULL values */\n for (i= 0,\n bind= imp_sth->bind,\n fbind= imp_sth->fbind,\n bind_end= bind+DBIc_NUM_PARAMS(imp_sth);\n bind < bind_end ;\n bind++, fbind++, i++ )\n {\n bind->buffer_type= MYSQL_TYPE_STRING;\n bind->buffer= NULL;\n bind->length= &(fbind->length);\n bind->is_null= (char*) &(fbind->is_null);\n fbind->is_null= 1;\n fbind->length= 0;\n }\n }\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n /* Count the number of parameters (driver, vs server-side) */\n if (imp_sth->use_server_side_prepare == 0)\n DBIc_NUM_PARAMS(imp_sth) = count_params((imp_xxh_t *)imp_dbh, aTHX_ statement,\n imp_dbh->bind_comment_placeholders);\n#else\n DBIc_NUM_PARAMS(imp_sth) = count_params((imp_xxh_t *)imp_dbh, aTHX_ statement,\n imp_dbh->bind_comment_placeholders);\n#endif\n\n /* Allocate memory for parameters */\n imp_sth->params= alloc_param(DBIc_NUM_PARAMS(imp_sth));\n DBIc_IMPSET_on(imp_sth);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_prepare\\n\");\n return 1;\n}","lang":"c","vul_type":"cwe-125","target_token_count":2371,"sven_meta":{"func_name":"dbd_st_prepare","file_name":"dbdimp.c","commit_link":"github.com/perl5-dbi/DBD-mysql/commit/793b72b1a0baa5070adacaac0e12fd995a6fbabe","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#107-c2b8edb294d5","input":"static BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)\n{\n\tBYTE* newBitMask;\n\n\tif (Stream_GetRemainingLength(s) < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, iconInfo->cacheEntry); /* cacheEntry (2 bytes) */\n\tStream_Read_UINT8(s, iconInfo->cacheId); /* cacheId (1 byte) */\n\tStream_Read_UINT8(s, iconInfo->bpp); /* bpp (1 byte) */\n\n\tif ((iconInfo->bpp < 1) || (iconInfo->bpp > 32))\n\t{\n\t\tWLog_ERR(TAG, \"invalid bpp value %\" PRIu32 \"\", iconInfo->bpp);\n\t\treturn FALSE;\n\t}\n\n\tStream_Read_UINT16(s, iconInfo->width); /* width (2 bytes) */\n\tStream_Read_UINT16(s, iconInfo->height); /* height (2 bytes) */\n\n\t/* cbColorTable is only present when bpp is 1, 4 or 8 */\n\tswitch (iconInfo->bpp)\n\t{\n\t\tcase 1:\n\t\tcase 4:\n\t\tcase 8:\n\t\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t\t\treturn FALSE;\n\n\t\t\tStream_Read_UINT16(s, iconInfo->cbColorTable); /* cbColorTable (2 bytes) */\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\ticonInfo->cbColorTable = 0;\n\t\t\tbreak;\n\t}\n\n\tif (Stream_GetRemainingLength(s) < 4)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, iconInfo->cbBitsMask); /* cbBitsMask (2 bytes) */\n\tStream_Read_UINT16(s, iconInfo->cbBitsColor); /* cbBitsColor (2 bytes) */\n\n\tif (Stream_GetRemainingLength(s) < iconInfo->cbBitsMask + iconInfo->cbBitsColor)\n\t\treturn FALSE;\n\n\t/* bitsMask */\n\tnewBitMask = (BYTE*)realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);\n\n\tif (!newBitMask)\n\t{\n\t\tfree(iconInfo->bitsMask);\n\t\ticonInfo->bitsMask = NULL;\n\t\treturn FALSE;\n\t}\n\n\ticonInfo->bitsMask = newBitMask;\n\tStream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);\n\n\t/* colorTable */\n\tif (iconInfo->colorTable == NULL)\n\t{\n\t\tif (iconInfo->cbColorTable)\n\t\t{\n\t\t\ticonInfo->colorTable = (BYTE*)malloc(iconInfo->cbColorTable);\n\n\t\t\tif (!iconInfo->colorTable)\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\telse if (iconInfo->cbColorTable)\n\t{\n\t\tBYTE* new_tab;\n\t\tnew_tab = (BYTE*)realloc(iconInfo->colorTable, iconInfo->cbColorTable);\n\n\t\tif (!new_tab)\n\t\t{\n\t\t\tfree(iconInfo->colorTable);\n\t\t\ticonInfo->colorTable = NULL;\n\t\t\treturn FALSE;\n\t\t}\n\n\t\ticonInfo->colorTable = new_tab;\n\t}\n\telse\n\t{\n\t\tfree(iconInfo->colorTable);\n\t\ticonInfo->colorTable = NULL;\n\t}\n\n\tif (iconInfo->colorTable)\n\t\tStream_Read(s, iconInfo->colorTable, iconInfo->cbColorTable);\n\n\t/* bitsColor */\n\tnewBitMask = (BYTE*)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);\n\n\tif (!newBitMask)\n\t{\n\t\tfree(iconInfo->bitsColor);\n\t\ticonInfo->bitsColor = NULL;\n\t\treturn FALSE;\n\t}\n\n\ticonInfo->bitsColor = newBitMask;\n\tStream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);\n\treturn TRUE;\n}","target":"static BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)\n{\n\tBYTE* newBitMask;\n\n\tif (Stream_GetRemainingLength(s) < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, iconInfo->cacheEntry); /* cacheEntry (2 bytes) */\n\tStream_Read_UINT8(s, iconInfo->cacheId); /* cacheId (1 byte) */\n\tStream_Read_UINT8(s, iconInfo->bpp); /* bpp (1 byte) */\n\n\tif ((iconInfo->bpp < 1) || (iconInfo->bpp > 32))\n\t{\n\t\tWLog_ERR(TAG, \"invalid bpp value %\" PRIu32 \"\", iconInfo->bpp);\n\t\treturn FALSE;\n\t}\n\n\tStream_Read_UINT16(s, iconInfo->width); /* width (2 bytes) */\n\tStream_Read_UINT16(s, iconInfo->height); /* height (2 bytes) */\n\n\t/* cbColorTable is only present when bpp is 1, 4 or 8 */\n\tswitch (iconInfo->bpp)\n\t{\n\t\tcase 1:\n\t\tcase 4:\n\t\tcase 8:\n\t\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t\t\treturn FALSE;\n\n\t\t\tStream_Read_UINT16(s, iconInfo->cbColorTable); /* cbColorTable (2 bytes) */\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\ticonInfo->cbColorTable = 0;\n\t\t\tbreak;\n\t}\n\n\tif (Stream_GetRemainingLength(s) < 4)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, iconInfo->cbBitsMask); /* cbBitsMask (2 bytes) */\n\tStream_Read_UINT16(s, iconInfo->cbBitsColor); /* cbBitsColor (2 bytes) */\n\n\t/* bitsMask */\n\tnewBitMask = (BYTE*)realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);\n\n\tif (!newBitMask)\n\t{\n\t\tfree(iconInfo->bitsMask);\n\t\ticonInfo->bitsMask = NULL;\n\t\treturn FALSE;\n\t}\n\n\ticonInfo->bitsMask = newBitMask;\n\tif (Stream_GetRemainingLength(s) < iconInfo->cbBitsMask)\n\t\treturn FALSE;\n\tStream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);\n\n\t/* colorTable */\n\tif (iconInfo->colorTable == NULL)\n\t{\n\t\tif (iconInfo->cbColorTable)\n\t\t{\n\t\t\ticonInfo->colorTable = (BYTE*)malloc(iconInfo->cbColorTable);\n\n\t\t\tif (!iconInfo->colorTable)\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\telse if (iconInfo->cbColorTable)\n\t{\n\t\tBYTE* new_tab;\n\t\tnew_tab = (BYTE*)realloc(iconInfo->colorTable, iconInfo->cbColorTable);\n\n\t\tif (!new_tab)\n\t\t{\n\t\t\tfree(iconInfo->colorTable);\n\t\t\ticonInfo->colorTable = NULL;\n\t\t\treturn FALSE;\n\t\t}\n\n\t\ticonInfo->colorTable = new_tab;\n\t}\n\telse\n\t{\n\t\tfree(iconInfo->colorTable);\n\t\ticonInfo->colorTable = NULL;\n\t}\n\n\tif (iconInfo->colorTable)\n\t{\n\t\tif (Stream_GetRemainingLength(s) < iconInfo->cbColorTable)\n\t\t\treturn FALSE;\n\t\tStream_Read(s, iconInfo->colorTable, iconInfo->cbColorTable);\n\t}\n\n\t/* bitsColor */\n\tnewBitMask = (BYTE*)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);\n\n\tif (!newBitMask)\n\t{\n\t\tfree(iconInfo->bitsColor);\n\t\ticonInfo->bitsColor = NULL;\n\t\treturn FALSE;\n\t}\n\n\ticonInfo->bitsColor = newBitMask;\n\tif (Stream_GetRemainingLength(s) < iconInfo->cbBitsColor)\n\t\treturn FALSE;\n\tStream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-125","target_token_count":807,"sven_meta":{"func_name":"update_read_icon_info","file_name":"libfreerdp/core/window.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/6b2bc41935e53b0034fe5948aeeab4f32e80f30f","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#108-d2aa221289c8","input":"static int usbhid_parse(struct hid_device *hid)\n{\n\tstruct usb_interface *intf = to_usb_interface(hid->dev.parent);\n\tstruct usb_host_interface *interface = intf->cur_altsetting;\n\tstruct usb_device *dev = interface_to_usbdev (intf);\n\tstruct hid_descriptor *hdesc;\n\tu32 quirks = 0;\n\tunsigned int rsize = 0;\n\tchar *rdesc;\n\tint ret, n;\n\n\tquirks = usbhid_lookup_quirk(le16_to_cpu(dev->descriptor.idVendor),\n\t\t\tle16_to_cpu(dev->descriptor.idProduct));\n\n\tif (quirks & HID_QUIRK_IGNORE)\n\t\treturn -ENODEV;\n\n\t/* Many keyboards and mice don't like to be polled for reports,\n\t * so we will always set the HID_QUIRK_NOGET flag for them. */\n\tif (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT) {\n\t\tif (interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_KEYBOARD ||\n\t\t\tinterface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE)\n\t\t\t\tquirks |= HID_QUIRK_NOGET;\n\t}\n\n\tif (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) &&\n\t (!interface->desc.bNumEndpoints ||\n\t usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) {\n\t\tdbg_hid(\"class descriptor not present\\n\");\n\t\treturn -ENODEV;\n\t}\n\n\thid->version = le16_to_cpu(hdesc->bcdHID);\n\thid->country = hdesc->bCountryCode;\n\n\tfor (n = 0; n < hdesc->bNumDescriptors; n++)\n\t\tif (hdesc->desc[n].bDescriptorType == HID_DT_REPORT)\n\t\t\trsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength);\n\n\tif (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {\n\t\tdbg_hid(\"weird size of report descriptor (%u)\\n\", rsize);\n\t\treturn -EINVAL;\n\t}\n\n\trdesc = kmalloc(rsize, GFP_KERNEL);\n\tif (!rdesc)\n\t\treturn -ENOMEM;\n\n\thid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0);\n\n\tret = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber,\n\t\t\tHID_DT_REPORT, rdesc, rsize);\n\tif (ret < 0) {\n\t\tdbg_hid(\"reading report descriptor failed\\n\");\n\t\tkfree(rdesc);\n\t\tgoto err;\n\t}\n\n\tret = hid_parse_report(hid, rdesc, rsize);\n\tkfree(rdesc);\n\tif (ret) {\n\t\tdbg_hid(\"parsing report descriptor failed\\n\");\n\t\tgoto err;\n\t}\n\n\thid->quirks |= quirks;\n\n\treturn 0;\nerr:\n\treturn ret;\n}","target":"static int usbhid_parse(struct hid_device *hid)\n{\n\tstruct usb_interface *intf = to_usb_interface(hid->dev.parent);\n\tstruct usb_host_interface *interface = intf->cur_altsetting;\n\tstruct usb_device *dev = interface_to_usbdev (intf);\n\tstruct hid_descriptor *hdesc;\n\tu32 quirks = 0;\n\tunsigned int rsize = 0;\n\tchar *rdesc;\n\tint ret, n;\n\tint num_descriptors;\n\tsize_t offset = offsetof(struct hid_descriptor, desc);\n\n\tquirks = usbhid_lookup_quirk(le16_to_cpu(dev->descriptor.idVendor),\n\t\t\tle16_to_cpu(dev->descriptor.idProduct));\n\n\tif (quirks & HID_QUIRK_IGNORE)\n\t\treturn -ENODEV;\n\n\t/* Many keyboards and mice don't like to be polled for reports,\n\t * so we will always set the HID_QUIRK_NOGET flag for them. */\n\tif (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT) {\n\t\tif (interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_KEYBOARD ||\n\t\t\tinterface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE)\n\t\t\t\tquirks |= HID_QUIRK_NOGET;\n\t}\n\n\tif (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) &&\n\t (!interface->desc.bNumEndpoints ||\n\t usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) {\n\t\tdbg_hid(\"class descriptor not present\\n\");\n\t\treturn -ENODEV;\n\t}\n\n\tif (hdesc->bLength < sizeof(struct hid_descriptor)) {\n\t\tdbg_hid(\"hid descriptor is too short\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\thid->version = le16_to_cpu(hdesc->bcdHID);\n\thid->country = hdesc->bCountryCode;\n\n\tnum_descriptors = min_t(int, hdesc->bNumDescriptors,\n\t (hdesc->bLength - offset) / sizeof(struct hid_class_descriptor));\n\n\tfor (n = 0; n < num_descriptors; n++)\n\t\tif (hdesc->desc[n].bDescriptorType == HID_DT_REPORT)\n\t\t\trsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength);\n\n\tif (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {\n\t\tdbg_hid(\"weird size of report descriptor (%u)\\n\", rsize);\n\t\treturn -EINVAL;\n\t}\n\n\trdesc = kmalloc(rsize, GFP_KERNEL);\n\tif (!rdesc)\n\t\treturn -ENOMEM;\n\n\thid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0);\n\n\tret = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber,\n\t\t\tHID_DT_REPORT, rdesc, rsize);\n\tif (ret < 0) {\n\t\tdbg_hid(\"reading report descriptor failed\\n\");\n\t\tkfree(rdesc);\n\t\tgoto err;\n\t}\n\n\tret = hid_parse_report(hid, rdesc, rsize);\n\tkfree(rdesc);\n\tif (ret) {\n\t\tdbg_hid(\"parsing report descriptor failed\\n\");\n\t\tgoto err;\n\t}\n\n\thid->quirks |= quirks;\n\n\treturn 0;\nerr:\n\treturn ret;\n}","lang":"c","vul_type":"cwe-125","target_token_count":659,"sven_meta":{"func_name":"usbhid_parse","file_name":"drivers/hid/usbhid/hid-core.c","commit_link":"github.com/torvalds/linux/commit/f043bfc98c193c284e2cd768fefabe18ac2fed9b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#110-b46339d00413","input":"int modbus_reply(modbus_t *ctx, const uint8_t *req,\n int req_length, modbus_mapping_t *mb_mapping)\n{\n int offset;\n int slave;\n int function;\n uint16_t address;\n uint8_t rsp[MAX_MESSAGE_LENGTH];\n int rsp_length = 0;\n sft_t sft;\n\n if (ctx == NULL) {\n errno = EINVAL;\n return -1;\n }\n\n offset = ctx->backend->header_length;\n slave = req[offset - 1];\n function = req[offset];\n address = (req[offset + 1] << 8) + req[offset + 2];\n\n sft.slave = slave;\n sft.function = function;\n sft.t_id = ctx->backend->prepare_response_tid(req, &req_length);\n\n /* Data are flushed on illegal number of values errors. */\n switch (function) {\n case MODBUS_FC_READ_COILS:\n case MODBUS_FC_READ_DISCRETE_INPUTS: {\n unsigned int is_input = (function == MODBUS_FC_READ_DISCRETE_INPUTS);\n int start_bits = is_input ? mb_mapping->start_input_bits : mb_mapping->start_bits;\n int nb_bits = is_input ? mb_mapping->nb_input_bits : mb_mapping->nb_bits;\n uint8_t *tab_bits = is_input ? mb_mapping->tab_input_bits : mb_mapping->tab_bits;\n const char * const name = is_input ? \"read_input_bits\" : \"read_bits\";\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n /* The mapping can be shifted to reduce memory consumption and it\n doesn't always start at address zero. */\n int mapping_address = address - start_bits;\n\n if (nb < 1 || MODBUS_MAX_READ_BITS < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values %d in %s (max %d)\\n\",\n nb, name, MODBUS_MAX_READ_BITS);\n } else if (mapping_address < 0 || (mapping_address + nb) > nb_bits) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in %s\\n\",\n mapping_address < 0 ? address : address + nb, name);\n } else {\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = (nb / 8) + ((nb % 8) ? 1 : 0);\n rsp_length = response_io_status(tab_bits, mapping_address, nb,\n rsp, rsp_length);\n }\n }\n break;\n case MODBUS_FC_READ_HOLDING_REGISTERS:\n case MODBUS_FC_READ_INPUT_REGISTERS: {\n unsigned int is_input = (function == MODBUS_FC_READ_INPUT_REGISTERS);\n int start_registers = is_input ? mb_mapping->start_input_registers : mb_mapping->start_registers;\n int nb_registers = is_input ? mb_mapping->nb_input_registers : mb_mapping->nb_registers;\n uint16_t *tab_registers = is_input ? mb_mapping->tab_input_registers : mb_mapping->tab_registers;\n const char * const name = is_input ? \"read_input_registers\" : \"read_registers\";\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n /* The mapping can be shifted to reduce memory consumption and it\n doesn't always start at address zero. */\n int mapping_address = address - start_registers;\n\n if (nb < 1 || MODBUS_MAX_READ_REGISTERS < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values %d in %s (max %d)\\n\",\n nb, name, MODBUS_MAX_READ_REGISTERS);\n } else if (mapping_address < 0 || (mapping_address + nb) > nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in %s\\n\",\n mapping_address < 0 ? address : address + nb, name);\n } else {\n int i;\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = nb << 1;\n for (i = mapping_address; i < mapping_address + nb; i++) {\n rsp[rsp_length++] = tab_registers[i] >> 8;\n rsp[rsp_length++] = tab_registers[i] & 0xFF;\n }\n }\n }\n break;\n case MODBUS_FC_WRITE_SINGLE_COIL: {\n int mapping_address = address - mb_mapping->start_bits;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_bits) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_bit\\n\",\n address);\n } else {\n int data = (req[offset + 3] << 8) + req[offset + 4];\n\n if (data == 0xFF00 || data == 0x0) {\n mb_mapping->tab_bits[mapping_address] = data ? ON : OFF;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n } else {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, FALSE,\n \"Illegal data value 0x%0X in write_bit request at address %0X\\n\",\n data, address);\n }\n }\n }\n break;\n case MODBUS_FC_WRITE_SINGLE_REGISTER: {\n int mapping_address = address - mb_mapping->start_registers;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_register\\n\",\n address);\n } else {\n int data = (req[offset + 3] << 8) + req[offset + 4];\n\n mb_mapping->tab_registers[mapping_address] = data;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n }\n }\n break;\n case MODBUS_FC_WRITE_MULTIPLE_COILS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n int mapping_address = address - mb_mapping->start_bits;\n\n if (nb < 1 || MODBUS_MAX_WRITE_BITS < nb) {\n /* May be the indication has been truncated on reading because of\n * invalid address (eg. nb is 0 but the request contains values to\n * write) so it's necessary to flush. */\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal number of values %d in write_bits (max %d)\\n\",\n nb, MODBUS_MAX_WRITE_BITS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_bits) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_bits\\n\",\n mapping_address < 0 ? address : address + nb);\n } else {\n /* 6 = byte count */\n modbus_set_bits_from_bytes(mb_mapping->tab_bits, mapping_address, nb,\n &req[offset + 6]);\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* 4 to copy the bit address (2) and the quantity of bits */\n memcpy(rsp + rsp_length, req + rsp_length, 4);\n rsp_length += 4;\n }\n }\n break;\n case MODBUS_FC_WRITE_MULTIPLE_REGISTERS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n int mapping_address = address - mb_mapping->start_registers;\n\n if (nb < 1 || MODBUS_MAX_WRITE_REGISTERS < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal number of values %d in write_registers (max %d)\\n\",\n nb, MODBUS_MAX_WRITE_REGISTERS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_registers\\n\",\n mapping_address < 0 ? address : address + nb);\n } else {\n int i, j;\n for (i = mapping_address, j = 6; i < mapping_address + nb; i++, j += 2) {\n /* 6 and 7 = first value */\n mb_mapping->tab_registers[i] =\n (req[offset + j] << 8) + req[offset + j + 1];\n }\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* 4 to copy the address (2) and the no. of registers */\n memcpy(rsp + rsp_length, req + rsp_length, 4);\n rsp_length += 4;\n }\n }\n break;\n case MODBUS_FC_REPORT_SLAVE_ID: {\n int str_len;\n int byte_count_pos;\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* Skip byte count for now */\n byte_count_pos = rsp_length++;\n rsp[rsp_length++] = _REPORT_SLAVE_ID;\n /* Run indicator status to ON */\n rsp[rsp_length++] = 0xFF;\n /* LMB + length of LIBMODBUS_VERSION_STRING */\n str_len = 3 + strlen(LIBMODBUS_VERSION_STRING);\n memcpy(rsp + rsp_length, \"LMB\" LIBMODBUS_VERSION_STRING, str_len);\n rsp_length += str_len;\n rsp[byte_count_pos] = rsp_length - byte_count_pos - 1;\n }\n break;\n case MODBUS_FC_READ_EXCEPTION_STATUS:\n if (ctx->debug) {\n fprintf(stderr, \"FIXME Not implemented\\n\");\n }\n errno = ENOPROTOOPT;\n return -1;\n break;\n case MODBUS_FC_MASK_WRITE_REGISTER: {\n int mapping_address = address - mb_mapping->start_registers;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_register\\n\",\n address);\n } else {\n uint16_t data = mb_mapping->tab_registers[mapping_address];\n uint16_t and = (req[offset + 3] << 8) + req[offset + 4];\n uint16_t or = (req[offset + 5] << 8) + req[offset + 6];\n\n data = (data & and) | (or & (~and));\n mb_mapping->tab_registers[mapping_address] = data;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n }\n }\n break;\n case MODBUS_FC_WRITE_AND_READ_REGISTERS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n uint16_t address_write = (req[offset + 5] << 8) + req[offset + 6];\n int nb_write = (req[offset + 7] << 8) + req[offset + 8];\n int nb_write_bytes = req[offset + 9];\n int mapping_address = address - mb_mapping->start_registers;\n int mapping_address_write = address_write - mb_mapping->start_registers;\n\n if (nb_write < 1 || MODBUS_MAX_WR_WRITE_REGISTERS < nb_write ||\n nb < 1 || MODBUS_MAX_WR_READ_REGISTERS < nb ||\n nb_write_bytes != nb_write * 2) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values (W%d, R%d) in write_and_read_registers (max W%d, R%d)\\n\",\n nb_write, nb, MODBUS_MAX_WR_WRITE_REGISTERS, MODBUS_MAX_WR_READ_REGISTERS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_registers ||\n mapping_address < 0 ||\n (mapping_address_write + nb_write) > mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data read address 0x%0X or write address 0x%0X write_and_read_registers\\n\",\n mapping_address < 0 ? address : address + nb,\n mapping_address_write < 0 ? address_write : address_write + nb_write);\n } else {\n int i, j;\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = nb << 1;\n\n /* Write first.\n 10 and 11 are the offset of the first values to write */\n for (i = mapping_address_write, j = 10;\n i < mapping_address_write + nb_write; i++, j += 2) {\n mb_mapping->tab_registers[i] =\n (req[offset + j] << 8) + req[offset + j + 1];\n }\n\n /* and read the data for the response */\n for (i = mapping_address; i < mapping_address + nb; i++) {\n rsp[rsp_length++] = mb_mapping->tab_registers[i] >> 8;\n rsp[rsp_length++] = mb_mapping->tab_registers[i] & 0xFF;\n }\n }\n }\n break;\n\n default:\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_FUNCTION, rsp, TRUE,\n \"Unknown Modbus function code: 0x%0X\\n\", function);\n break;\n }\n\n /* Suppress any responses when the request was a broadcast */\n return (ctx->backend->backend_type == _MODBUS_BACKEND_TYPE_RTU &&\n slave == MODBUS_BROADCAST_ADDRESS) ? 0 : send_msg(ctx, rsp, rsp_length);\n}","target":"int modbus_reply(modbus_t *ctx, const uint8_t *req,\n int req_length, modbus_mapping_t *mb_mapping)\n{\n int offset;\n int slave;\n int function;\n uint16_t address;\n uint8_t rsp[MAX_MESSAGE_LENGTH];\n int rsp_length = 0;\n sft_t sft;\n\n if (ctx == NULL) {\n errno = EINVAL;\n return -1;\n }\n\n offset = ctx->backend->header_length;\n slave = req[offset - 1];\n function = req[offset];\n address = (req[offset + 1] << 8) + req[offset + 2];\n\n sft.slave = slave;\n sft.function = function;\n sft.t_id = ctx->backend->prepare_response_tid(req, &req_length);\n\n /* Data are flushed on illegal number of values errors. */\n switch (function) {\n case MODBUS_FC_READ_COILS:\n case MODBUS_FC_READ_DISCRETE_INPUTS: {\n unsigned int is_input = (function == MODBUS_FC_READ_DISCRETE_INPUTS);\n int start_bits = is_input ? mb_mapping->start_input_bits : mb_mapping->start_bits;\n int nb_bits = is_input ? mb_mapping->nb_input_bits : mb_mapping->nb_bits;\n uint8_t *tab_bits = is_input ? mb_mapping->tab_input_bits : mb_mapping->tab_bits;\n const char * const name = is_input ? \"read_input_bits\" : \"read_bits\";\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n /* The mapping can be shifted to reduce memory consumption and it\n doesn't always start at address zero. */\n int mapping_address = address - start_bits;\n\n if (nb < 1 || MODBUS_MAX_READ_BITS < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values %d in %s (max %d)\\n\",\n nb, name, MODBUS_MAX_READ_BITS);\n } else if (mapping_address < 0 || (mapping_address + nb) > nb_bits) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in %s\\n\",\n mapping_address < 0 ? address : address + nb, name);\n } else {\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = (nb / 8) + ((nb % 8) ? 1 : 0);\n rsp_length = response_io_status(tab_bits, mapping_address, nb,\n rsp, rsp_length);\n }\n }\n break;\n case MODBUS_FC_READ_HOLDING_REGISTERS:\n case MODBUS_FC_READ_INPUT_REGISTERS: {\n unsigned int is_input = (function == MODBUS_FC_READ_INPUT_REGISTERS);\n int start_registers = is_input ? mb_mapping->start_input_registers : mb_mapping->start_registers;\n int nb_registers = is_input ? mb_mapping->nb_input_registers : mb_mapping->nb_registers;\n uint16_t *tab_registers = is_input ? mb_mapping->tab_input_registers : mb_mapping->tab_registers;\n const char * const name = is_input ? \"read_input_registers\" : \"read_registers\";\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n /* The mapping can be shifted to reduce memory consumption and it\n doesn't always start at address zero. */\n int mapping_address = address - start_registers;\n\n if (nb < 1 || MODBUS_MAX_READ_REGISTERS < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values %d in %s (max %d)\\n\",\n nb, name, MODBUS_MAX_READ_REGISTERS);\n } else if (mapping_address < 0 || (mapping_address + nb) > nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in %s\\n\",\n mapping_address < 0 ? address : address + nb, name);\n } else {\n int i;\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = nb << 1;\n for (i = mapping_address; i < mapping_address + nb; i++) {\n rsp[rsp_length++] = tab_registers[i] >> 8;\n rsp[rsp_length++] = tab_registers[i] & 0xFF;\n }\n }\n }\n break;\n case MODBUS_FC_WRITE_SINGLE_COIL: {\n int mapping_address = address - mb_mapping->start_bits;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_bits) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_bit\\n\",\n address);\n } else {\n int data = (req[offset + 3] << 8) + req[offset + 4];\n\n if (data == 0xFF00 || data == 0x0) {\n mb_mapping->tab_bits[mapping_address] = data ? ON : OFF;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n } else {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, FALSE,\n \"Illegal data value 0x%0X in write_bit request at address %0X\\n\",\n data, address);\n }\n }\n }\n break;\n case MODBUS_FC_WRITE_SINGLE_REGISTER: {\n int mapping_address = address - mb_mapping->start_registers;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_register\\n\",\n address);\n } else {\n int data = (req[offset + 3] << 8) + req[offset + 4];\n\n mb_mapping->tab_registers[mapping_address] = data;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n }\n }\n break;\n case MODBUS_FC_WRITE_MULTIPLE_COILS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n int nb_bits = req[offset + 5];\n int mapping_address = address - mb_mapping->start_bits;\n\n if (nb < 1 || MODBUS_MAX_WRITE_BITS < nb || nb_bits * 8 < nb) {\n /* May be the indication has been truncated on reading because of\n * invalid address (eg. nb is 0 but the request contains values to\n * write) so it's necessary to flush. */\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal number of values %d in write_bits (max %d)\\n\",\n nb, MODBUS_MAX_WRITE_BITS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_bits) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_bits\\n\",\n mapping_address < 0 ? address : address + nb);\n } else {\n /* 6 = byte count */\n modbus_set_bits_from_bytes(mb_mapping->tab_bits, mapping_address, nb,\n &req[offset + 6]);\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* 4 to copy the bit address (2) and the quantity of bits */\n memcpy(rsp + rsp_length, req + rsp_length, 4);\n rsp_length += 4;\n }\n }\n break;\n case MODBUS_FC_WRITE_MULTIPLE_REGISTERS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n int nb_bytes = req[offset + 5];\n int mapping_address = address - mb_mapping->start_registers;\n\n if (nb < 1 || MODBUS_MAX_WRITE_REGISTERS < nb || nb_bytes * 8 < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal number of values %d in write_registers (max %d)\\n\",\n nb, MODBUS_MAX_WRITE_REGISTERS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_registers\\n\",\n mapping_address < 0 ? address : address + nb);\n } else {\n int i, j;\n for (i = mapping_address, j = 6; i < mapping_address + nb; i++, j += 2) {\n /* 6 and 7 = first value */\n mb_mapping->tab_registers[i] =\n (req[offset + j] << 8) + req[offset + j + 1];\n }\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* 4 to copy the address (2) and the no. of registers */\n memcpy(rsp + rsp_length, req + rsp_length, 4);\n rsp_length += 4;\n }\n }\n break;\n case MODBUS_FC_REPORT_SLAVE_ID: {\n int str_len;\n int byte_count_pos;\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* Skip byte count for now */\n byte_count_pos = rsp_length++;\n rsp[rsp_length++] = _REPORT_SLAVE_ID;\n /* Run indicator status to ON */\n rsp[rsp_length++] = 0xFF;\n /* LMB + length of LIBMODBUS_VERSION_STRING */\n str_len = 3 + strlen(LIBMODBUS_VERSION_STRING);\n memcpy(rsp + rsp_length, \"LMB\" LIBMODBUS_VERSION_STRING, str_len);\n rsp_length += str_len;\n rsp[byte_count_pos] = rsp_length - byte_count_pos - 1;\n }\n break;\n case MODBUS_FC_READ_EXCEPTION_STATUS:\n if (ctx->debug) {\n fprintf(stderr, \"FIXME Not implemented\\n\");\n }\n errno = ENOPROTOOPT;\n return -1;\n break;\n case MODBUS_FC_MASK_WRITE_REGISTER: {\n int mapping_address = address - mb_mapping->start_registers;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_register\\n\",\n address);\n } else {\n uint16_t data = mb_mapping->tab_registers[mapping_address];\n uint16_t and = (req[offset + 3] << 8) + req[offset + 4];\n uint16_t or = (req[offset + 5] << 8) + req[offset + 6];\n\n data = (data & and) | (or & (~and));\n mb_mapping->tab_registers[mapping_address] = data;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n }\n }\n break;\n case MODBUS_FC_WRITE_AND_READ_REGISTERS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n uint16_t address_write = (req[offset + 5] << 8) + req[offset + 6];\n int nb_write = (req[offset + 7] << 8) + req[offset + 8];\n int nb_write_bytes = req[offset + 9];\n int mapping_address = address - mb_mapping->start_registers;\n int mapping_address_write = address_write - mb_mapping->start_registers;\n\n if (nb_write < 1 || MODBUS_MAX_WR_WRITE_REGISTERS < nb_write ||\n nb < 1 || MODBUS_MAX_WR_READ_REGISTERS < nb ||\n nb_write_bytes != nb_write * 2) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values (W%d, R%d) in write_and_read_registers (max W%d, R%d)\\n\",\n nb_write, nb, MODBUS_MAX_WR_WRITE_REGISTERS, MODBUS_MAX_WR_READ_REGISTERS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_registers ||\n mapping_address < 0 ||\n (mapping_address_write + nb_write) > mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data read address 0x%0X or write address 0x%0X write_and_read_registers\\n\",\n mapping_address < 0 ? address : address + nb,\n mapping_address_write < 0 ? address_write : address_write + nb_write);\n } else {\n int i, j;\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = nb << 1;\n\n /* Write first.\n 10 and 11 are the offset of the first values to write */\n for (i = mapping_address_write, j = 10;\n i < mapping_address_write + nb_write; i++, j += 2) {\n mb_mapping->tab_registers[i] =\n (req[offset + j] << 8) + req[offset + j + 1];\n }\n\n /* and read the data for the response */\n for (i = mapping_address; i < mapping_address + nb; i++) {\n rsp[rsp_length++] = mb_mapping->tab_registers[i] >> 8;\n rsp[rsp_length++] = mb_mapping->tab_registers[i] & 0xFF;\n }\n }\n }\n break;\n\n default:\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_FUNCTION, rsp, TRUE,\n \"Unknown Modbus function code: 0x%0X\\n\", function);\n break;\n }\n\n /* Suppress any responses when the request was a broadcast */\n return (ctx->backend->backend_type == _MODBUS_BACKEND_TYPE_RTU &&\n slave == MODBUS_BROADCAST_ADDRESS) ? 0 : send_msg(ctx, rsp, rsp_length);\n}","lang":"c","vul_type":"cwe-125","target_token_count":3264,"sven_meta":{"func_name":"modbus_reply","file_name":"src/modbus.c","commit_link":"github.com/stephane/libmodbus/commit/5ccdf5ef79d742640355d1132fa9e2abc7fbaefc","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#111-da1ccb181290","input":"static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tut8 *end, *need = NULL;\n\tconst char *section_name = \"\";\n\tElf_(Shdr) *link_shdr = NULL;\n\tconst char *link_section_name = \"\";\n\tSdb *sdb_vernaux = NULL;\n\tSdb *sdb_version = NULL;\n\tSdb *sdb = NULL;\n\tint i, cnt;\n\n\tif (!bin || !bin->dynstr) {\n\t\treturn NULL;\n\t}\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn NULL;\n\t}\n\tif (shdr->sh_size < 1) {\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tif (!sdb) {\n\t\treturn NULL;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!(need = (ut8*) calloc (R_MAX (1, shdr->sh_size), sizeof (ut8)))) {\n\t\tbprintf (\"Warning: Cannot allocate memory for Elf_(Verneed)\\n\");\n\t\tgoto beach;\n\t}\n\tend = need + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"num_entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tif (shdr->sh_offset > bin->size || shdr->sh_offset + shdr->sh_size > bin->size) {\n\t\tgoto beach;\n\t}\n\tif (shdr->sh_offset + shdr->sh_size < shdr->sh_size) {\n\t\tgoto beach;\n\t}\n\ti = r_buf_read_at (bin->b, shdr->sh_offset, need, shdr->sh_size);\n\tif (i < 0)\n\t\tgoto beach;\n\t//XXX we should use DT_VERNEEDNUM instead of sh_info\n\t//TODO https://sourceware.org/ml/binutils/2014-11/msg00353.html\n\tfor (i = 0, cnt = 0; cnt < shdr->sh_info; ++cnt) {\n\t\tint j, isum;\n\t\tut8 *vstart = need + i;\n\t\tElf_(Verneed) vvn = {0};\n\t\tif (vstart + sizeof (Elf_(Verneed)) > end) {\n\t\t\tgoto beach;\n\t\t}\n\t\tElf_(Verneed) *entry = &vvn;\n\t\tchar key[32] = {0};\n\t\tsdb_version = sdb_new0 ();\n\t\tif (!sdb_version) {\n\t\t\tgoto beach;\n\t\t}\n\t\tj = 0;\n\t\tvvn.vn_version = READ16 (vstart, j)\n\t\tvvn.vn_cnt = READ16 (vstart, j)\n\t\tvvn.vn_file = READ32 (vstart, j)\n\t\tvvn.vn_aux = READ32 (vstart, j)\n\t\tvvn.vn_next = READ32 (vstart, j)\n\n\t\tsdb_num_set (sdb_version, \"vn_version\", entry->vn_version, 0);\n\t\tsdb_num_set (sdb_version, \"idx\", i, 0);\n\t\tif (entry->vn_file > bin->dynstr_size) {\n\t\t\tgoto beach;\n\t\t}\n\t\t{\n\t\t\tchar *s = r_str_ndup (&bin->dynstr[entry->vn_file], 16);\n\t\t\tsdb_set (sdb_version, \"file_name\", s, 0);\n\t\t\tfree (s);\n\t\t}\n\t\tsdb_num_set (sdb_version, \"cnt\", entry->vn_cnt, 0);\n\t\tvstart += entry->vn_aux;\n\t\tfor (j = 0, isum = i + entry->vn_aux; j < entry->vn_cnt && vstart + sizeof (Elf_(Vernaux)) <= end; ++j) {\n\t\t\tint k;\n\t\t\tElf_(Vernaux) * aux = NULL;\n\t\t\tElf_(Vernaux) vaux = {0};\n\t\t\tsdb_vernaux = sdb_new0 ();\n\t\t\tif (!sdb_vernaux) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\taux = (Elf_(Vernaux)*)&vaux;\n\t\t\tk = 0;\n\t\t\tvaux.vna_hash = READ32 (vstart, k)\n\t\t\tvaux.vna_flags = READ16 (vstart, k)\n\t\t\tvaux.vna_other = READ16 (vstart, k)\n\t\t\tvaux.vna_name = READ32 (vstart, k)\n\t\t\tvaux.vna_next = READ32 (vstart, k)\n\t\t\tif (aux->vna_name > bin->dynstr_size) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_vernaux, \"idx\", isum, 0);\n\t\t\tif (aux->vna_name > 0 && aux->vna_name + 8 < bin->dynstr_size) {\n\t\t\t\tchar name [16];\n\t\t\t\tstrncpy (name, &bin->dynstr[aux->vna_name], sizeof (name)-1);\n\t\t\t\tname[sizeof(name)-1] = 0;\n\t\t\t\tsdb_set (sdb_vernaux, \"name\", name, 0);\n\t\t\t}\n\t\t\tsdb_set (sdb_vernaux, \"flags\", get_ver_flags (aux->vna_flags), 0);\n\t\t\tsdb_num_set (sdb_vernaux, \"version\", aux->vna_other, 0);\n\t\t\tisum += aux->vna_next;\n\t\t\tvstart += aux->vna_next;\n\t\t\tsnprintf (key, sizeof (key), \"vernaux%d\", j);\n\t\t\tsdb_ns_set (sdb_version, key, sdb_vernaux);\n\t\t}\n\t\tif ((int)entry->vn_next < 0) {\n\t\t\tbprintf (\"Invalid vn_next\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += entry->vn_next;\n\t\tsnprintf (key, sizeof (key), \"version%d\", cnt );\n\t\tsdb_ns_set (sdb, key, sdb_version);\n\t\t//if entry->vn_next is 0 it iterate infinitely\n\t\tif (!entry->vn_next) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tfree (need);\n\treturn sdb;\nbeach:\n\tfree (need);\n\tsdb_free (sdb_vernaux);\n\tsdb_free (sdb_version);\n\tsdb_free (sdb);\n\treturn NULL;\n}","target":"static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tut8 *end, *need = NULL;\n\tconst char *section_name = \"\";\n\tElf_(Shdr) *link_shdr = NULL;\n\tconst char *link_section_name = \"\";\n\tSdb *sdb_vernaux = NULL;\n\tSdb *sdb_version = NULL;\n\tSdb *sdb = NULL;\n\tint i, cnt;\n\n\tif (!bin || !bin->dynstr) {\n\t\treturn NULL;\n\t}\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn NULL;\n\t}\n\tif (shdr->sh_size < 1) {\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tif (!sdb) {\n\t\treturn NULL;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!(need = (ut8*) calloc (R_MAX (1, shdr->sh_size), sizeof (ut8)))) {\n\t\tbprintf (\"Warning: Cannot allocate memory for Elf_(Verneed)\\n\");\n\t\tgoto beach;\n\t}\n\tend = need + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"num_entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tif (shdr->sh_offset > bin->size || shdr->sh_offset + shdr->sh_size > bin->size) {\n\t\tgoto beach;\n\t}\n\tif (shdr->sh_offset + shdr->sh_size < shdr->sh_size) {\n\t\tgoto beach;\n\t}\n\ti = r_buf_read_at (bin->b, shdr->sh_offset, need, shdr->sh_size);\n\tif (i < 0)\n\t\tgoto beach;\n\t//XXX we should use DT_VERNEEDNUM instead of sh_info\n\t//TODO https://sourceware.org/ml/binutils/2014-11/msg00353.html\n\tfor (i = 0, cnt = 0; cnt < shdr->sh_info; ++cnt) {\n\t\tint j, isum;\n\t\tut8 *vstart = need + i;\n\t\tElf_(Verneed) vvn = {0};\n\t\tif (vstart + sizeof (Elf_(Verneed)) > end) {\n\t\t\tgoto beach;\n\t\t}\n\t\tElf_(Verneed) *entry = &vvn;\n\t\tchar key[32] = {0};\n\t\tsdb_version = sdb_new0 ();\n\t\tif (!sdb_version) {\n\t\t\tgoto beach;\n\t\t}\n\t\tj = 0;\n\t\tvvn.vn_version = READ16 (vstart, j)\n\t\tvvn.vn_cnt = READ16 (vstart, j)\n\t\tvvn.vn_file = READ32 (vstart, j)\n\t\tvvn.vn_aux = READ32 (vstart, j)\n\t\tvvn.vn_next = READ32 (vstart, j)\n\n\t\tsdb_num_set (sdb_version, \"vn_version\", entry->vn_version, 0);\n\t\tsdb_num_set (sdb_version, \"idx\", i, 0);\n\t\tif (entry->vn_file > bin->dynstr_size) {\n\t\t\tgoto beach;\n\t\t}\n\t\t{\n\t\t\tchar *s = r_str_ndup (&bin->dynstr[entry->vn_file], 16);\n\t\t\tsdb_set (sdb_version, \"file_name\", s, 0);\n\t\t\tfree (s);\n\t\t}\n\t\tsdb_num_set (sdb_version, \"cnt\", entry->vn_cnt, 0);\n\t\tst32 vnaux = entry->vn_aux;\n\t\tif (vnaux < 1) {\n\t\t\tgoto beach;\n\t\t}\n\t\tvstart += vnaux;\n\t\tfor (j = 0, isum = i + entry->vn_aux; j < entry->vn_cnt && vstart + sizeof (Elf_(Vernaux)) <= end; ++j) {\n\t\t\tint k;\n\t\t\tElf_(Vernaux) * aux = NULL;\n\t\t\tElf_(Vernaux) vaux = {0};\n\t\t\tsdb_vernaux = sdb_new0 ();\n\t\t\tif (!sdb_vernaux) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\taux = (Elf_(Vernaux)*)&vaux;\n\t\t\tk = 0;\n\t\t\tvaux.vna_hash = READ32 (vstart, k)\n\t\t\tvaux.vna_flags = READ16 (vstart, k)\n\t\t\tvaux.vna_other = READ16 (vstart, k)\n\t\t\tvaux.vna_name = READ32 (vstart, k)\n\t\t\tvaux.vna_next = READ32 (vstart, k)\n\t\t\tif (aux->vna_name > bin->dynstr_size) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_vernaux, \"idx\", isum, 0);\n\t\t\tif (aux->vna_name > 0 && aux->vna_name + 8 < bin->dynstr_size) {\n\t\t\t\tchar name [16];\n\t\t\t\tstrncpy (name, &bin->dynstr[aux->vna_name], sizeof (name)-1);\n\t\t\t\tname[sizeof(name)-1] = 0;\n\t\t\t\tsdb_set (sdb_vernaux, \"name\", name, 0);\n\t\t\t}\n\t\t\tsdb_set (sdb_vernaux, \"flags\", get_ver_flags (aux->vna_flags), 0);\n\t\t\tsdb_num_set (sdb_vernaux, \"version\", aux->vna_other, 0);\n\t\t\tisum += aux->vna_next;\n\t\t\tvstart += aux->vna_next;\n\t\t\tsnprintf (key, sizeof (key), \"vernaux%d\", j);\n\t\t\tsdb_ns_set (sdb_version, key, sdb_vernaux);\n\t\t}\n\t\tif ((int)entry->vn_next < 0) {\n\t\t\tbprintf (\"Invalid vn_next\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += entry->vn_next;\n\t\tsnprintf (key, sizeof (key), \"version%d\", cnt );\n\t\tsdb_ns_set (sdb, key, sdb_version);\n\t\t//if entry->vn_next is 0 it iterate infinitely\n\t\tif (!entry->vn_next) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tfree (need);\n\treturn sdb;\nbeach:\n\tfree (need);\n\tsdb_free (sdb_vernaux);\n\tsdb_free (sdb_version);\n\tsdb_free (sdb);\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1577,"sven_meta":{"func_name":"store_versioninfo_gnu_verneed","file_name":"libr/bin/format/elf/elf.c","commit_link":"github.com/radare/radare2/commit/c6d0076c924891ad9948a62d89d0bcdaf965f0cd","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#112-3dc2a51b76e9","input":"static Image *ReadWPGImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n typedef struct\n {\n size_t FileId;\n MagickOffsetType DataOffset;\n unsigned int ProductType;\n unsigned int FileType;\n unsigned char MajorVersion;\n unsigned char MinorVersion;\n unsigned int EncryptKey;\n unsigned int Reserved;\n } WPGHeader;\n\n typedef struct\n {\n unsigned char RecType;\n size_t RecordLength;\n } WPGRecord;\n\n typedef struct\n {\n unsigned char Class;\n unsigned char RecType;\n size_t Extension;\n size_t RecordLength;\n } WPG2Record;\n\n typedef struct\n {\n unsigned HorizontalUnits;\n unsigned VerticalUnits;\n unsigned char PosSizePrecision;\n } WPG2Start;\n\n typedef struct\n {\n unsigned int Width;\n unsigned int Height;\n unsigned int Depth;\n unsigned int HorzRes;\n unsigned int VertRes;\n } WPGBitmapType1;\n\n typedef struct\n {\n unsigned int Width;\n unsigned int Height;\n unsigned char Depth;\n unsigned char Compression;\n } WPG2BitmapType1;\n\n typedef struct\n {\n unsigned int RotAngle;\n unsigned int LowLeftX;\n unsigned int LowLeftY;\n unsigned int UpRightX;\n unsigned int UpRightY;\n unsigned int Width;\n unsigned int Height;\n unsigned int Depth;\n unsigned int HorzRes;\n unsigned int VertRes;\n } WPGBitmapType2;\n\n typedef struct\n {\n unsigned int StartIndex;\n unsigned int NumOfEntries;\n } WPGColorMapRec;\n\n /*\n typedef struct {\n size_t PS_unknown1;\n unsigned int PS_unknown2;\n unsigned int PS_unknown3;\n } WPGPSl1Record; \n */\n\n Image\n *image;\n\n unsigned int\n status;\n\n WPGHeader\n Header;\n\n WPGRecord\n Rec;\n\n WPG2Record\n Rec2;\n\n WPG2Start StartWPG;\n\n WPGBitmapType1\n BitmapHeader1;\n\n WPG2BitmapType1\n Bitmap2Header1;\n\n WPGBitmapType2\n BitmapHeader2;\n\n WPGColorMapRec\n WPG_Palette;\n\n int\n i,\n bpp,\n WPG2Flags;\n\n ssize_t\n ldblk;\n\n size_t\n one;\n\n unsigned char\n *BImgBuff;\n\n tCTM CTM; /*current transform matrix*/\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n one=1;\n image=AcquireImage(image_info,exception);\n image->depth=8;\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read WPG image.\n */\n Header.FileId=ReadBlobLSBLong(image);\n Header.DataOffset=(MagickOffsetType) ReadBlobLSBLong(image);\n Header.ProductType=ReadBlobLSBShort(image);\n Header.FileType=ReadBlobLSBShort(image);\n Header.MajorVersion=ReadBlobByte(image);\n Header.MinorVersion=ReadBlobByte(image);\n Header.EncryptKey=ReadBlobLSBShort(image);\n Header.Reserved=ReadBlobLSBShort(image);\n\n if (Header.FileId!=0x435057FF || (Header.ProductType>>8)!=0x16)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (Header.EncryptKey!=0)\n ThrowReaderException(CoderError,\"EncryptedWPGImageFileNotSupported\");\n\n image->columns = 1;\n image->rows = 1;\n image->colors = 0;\n bpp=0;\n BitmapHeader2.RotAngle=0;\n\n switch(Header.FileType)\n {\n case 1: /* WPG level 1 */\n while(!EOFBlob(image)) /* object parser loop */\n {\n (void) SeekBlob(image,Header.DataOffset,SEEK_SET);\n if(EOFBlob(image))\n break;\n\n Rec.RecType=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rd_WP_DWORD(image,&Rec.RecordLength);\n if(EOFBlob(image))\n break;\n\n Header.DataOffset=TellBlob(image)+Rec.RecordLength;\n\n switch(Rec.RecType)\n {\n case 0x0B: /* bitmap type 1 */\n BitmapHeader1.Width=ReadBlobLSBShort(image);\n BitmapHeader1.Height=ReadBlobLSBShort(image);\n if ((BitmapHeader1.Width == 0) || (BitmapHeader1.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n BitmapHeader1.Depth=ReadBlobLSBShort(image);\n BitmapHeader1.HorzRes=ReadBlobLSBShort(image);\n BitmapHeader1.VertRes=ReadBlobLSBShort(image);\n\n if(BitmapHeader1.HorzRes && BitmapHeader1.VertRes)\n {\n image->units=PixelsPerCentimeterResolution;\n image->resolution.x=BitmapHeader1.HorzRes/470.0;\n image->resolution.y=BitmapHeader1.VertRes/470.0;\n }\n image->columns=BitmapHeader1.Width;\n image->rows=BitmapHeader1.Height;\n bpp=BitmapHeader1.Depth;\n\n goto UnpackRaster;\n\n case 0x0E: /*Color palette */\n WPG_Palette.StartIndex=ReadBlobLSBShort(image);\n WPG_Palette.NumOfEntries=ReadBlobLSBShort(image);\n\n image->colors=WPG_Palette.NumOfEntries;\n if (!AcquireImageColormap(image,image->colors,exception))\n goto NoMemory;\n for (i=WPG_Palette.StartIndex;\n i < (int)WPG_Palette.NumOfEntries; i++)\n {\n image->colormap[i].red=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n }\n break;\n \n case 0x11: /* Start PS l1 */\n if(Rec.RecordLength > 8)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+8, /* skip PS header in the wpg */\n (ssize_t) Rec.RecordLength-8,exception);\n break; \n\n case 0x14: /* bitmap type 2 */\n BitmapHeader2.RotAngle=ReadBlobLSBShort(image);\n BitmapHeader2.LowLeftX=ReadBlobLSBShort(image);\n BitmapHeader2.LowLeftY=ReadBlobLSBShort(image);\n BitmapHeader2.UpRightX=ReadBlobLSBShort(image);\n BitmapHeader2.UpRightY=ReadBlobLSBShort(image);\n BitmapHeader2.Width=ReadBlobLSBShort(image);\n BitmapHeader2.Height=ReadBlobLSBShort(image);\n if ((BitmapHeader2.Width == 0) || (BitmapHeader2.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n BitmapHeader2.Depth=ReadBlobLSBShort(image);\n BitmapHeader2.HorzRes=ReadBlobLSBShort(image);\n BitmapHeader2.VertRes=ReadBlobLSBShort(image);\n\n image->units=PixelsPerCentimeterResolution;\n image->page.width=(unsigned int)\n ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightX)/470.0);\n image->page.height=(unsigned int)\n ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightY)/470.0);\n image->page.x=(int) (BitmapHeader2.LowLeftX/470.0);\n image->page.y=(int) (BitmapHeader2.LowLeftX/470.0);\n if(BitmapHeader2.HorzRes && BitmapHeader2.VertRes)\n {\n image->resolution.x=BitmapHeader2.HorzRes/470.0;\n image->resolution.y=BitmapHeader2.VertRes/470.0;\n }\n image->columns=BitmapHeader2.Width;\n image->rows=BitmapHeader2.Height;\n bpp=BitmapHeader2.Depth;\n\n UnpackRaster: \n if ((image->colors == 0) && (bpp != 24))\n {\n image->colors=one << bpp;\n if (!AcquireImageColormap(image,image->colors,exception))\n {\n NoMemory:\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n /* printf(\"Load default colormap \\n\"); */\n for (i=0; (i < (int) image->colors) && (i < 256); i++)\n { \n image->colormap[i].red=ScaleCharToQuantum(WPG1_Palette[i].Red);\n image->colormap[i].green=ScaleCharToQuantum(WPG1_Palette[i].Green);\n image->colormap[i].blue=ScaleCharToQuantum(WPG1_Palette[i].Blue);\n }\n }\n else\n {\n if (bpp < 24)\n if ( (image->colors < (one << bpp)) && (bpp != 24) )\n image->colormap=(PixelInfo *) ResizeQuantumMemory(\n image->colormap,(size_t) (one << bpp),\n sizeof(*image->colormap));\n }\n \n if (bpp == 1)\n {\n if(image->colormap[0].red==0 &&\n image->colormap[0].green==0 &&\n image->colormap[0].blue==0 &&\n image->colormap[1].red==0 &&\n image->colormap[1].green==0 &&\n image->colormap[1].blue==0)\n { /* fix crippled monochrome palette */\n image->colormap[1].red =\n image->colormap[1].green =\n image->colormap[1].blue = QuantumRange;\n }\n } \n\n if(UnpackWPGRaster(image,bpp,exception) < 0)\n /* The raster cannot be unpacked */\n {\n DecompressionFailed:\n ThrowReaderException(CoderError,\"UnableToDecompressImage\");\n }\n\n if(Rec.RecType==0x14 && BitmapHeader2.RotAngle!=0 && !image_info->ping)\n { \n /* flop command */\n if(BitmapHeader2.RotAngle & 0x8000)\n {\n Image\n *flop_image;\n\n flop_image = FlopImage(image, exception);\n if (flop_image != (Image *) NULL) {\n DuplicateBlob(flop_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flop_image);\n }\n }\n /* flip command */\n if(BitmapHeader2.RotAngle & 0x2000)\n {\n Image\n *flip_image;\n\n flip_image = FlipImage(image, exception);\n if (flip_image != (Image *) NULL) {\n DuplicateBlob(flip_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flip_image); \n }\n }\n \n /* rotate command */\n if(BitmapHeader2.RotAngle & 0x0FFF)\n {\n Image\n *rotate_image;\n\n rotate_image=RotateImage(image,(BitmapHeader2.RotAngle &\n 0x0FFF), exception);\n if (rotate_image != (Image *) NULL) {\n DuplicateBlob(rotate_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,rotate_image); \n }\n } \n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n image->depth=8;\n if (image->next == (Image *) NULL)\n goto Finish;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n break;\n\n case 0x1B: /* Postscript l2 */\n if(Rec.RecordLength>0x3C)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+0x3C, /* skip PS l2 header in the wpg */\n (ssize_t) Rec.RecordLength-0x3C,exception);\n break;\n }\n }\n break;\n\n case 2: /* WPG level 2 */\n (void) memset(CTM,0,sizeof(CTM));\n StartWPG.PosSizePrecision = 0;\n while(!EOFBlob(image)) /* object parser loop */\n {\n (void) SeekBlob(image,Header.DataOffset,SEEK_SET);\n if(EOFBlob(image))\n break;\n\n Rec2.Class=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rec2.RecType=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rd_WP_DWORD(image,&Rec2.Extension);\n Rd_WP_DWORD(image,&Rec2.RecordLength);\n if(EOFBlob(image))\n break;\n\n Header.DataOffset=TellBlob(image)+Rec2.RecordLength;\n\n switch(Rec2.RecType)\n {\n case 1:\n StartWPG.HorizontalUnits=ReadBlobLSBShort(image);\n StartWPG.VerticalUnits=ReadBlobLSBShort(image);\n StartWPG.PosSizePrecision=ReadBlobByte(image);\n break;\n case 0x0C: /* Color palette */\n WPG_Palette.StartIndex=ReadBlobLSBShort(image);\n WPG_Palette.NumOfEntries=ReadBlobLSBShort(image);\n\n image->colors=WPG_Palette.NumOfEntries;\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n for (i=WPG_Palette.StartIndex;\n i < (int)WPG_Palette.NumOfEntries; i++)\n {\n image->colormap[i].red=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n image->colormap[i].green=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n image->colormap[i].blue=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n (void) ReadBlobByte(image); /*Opacity??*/\n }\n break;\n case 0x0E:\n Bitmap2Header1.Width=ReadBlobLSBShort(image);\n Bitmap2Header1.Height=ReadBlobLSBShort(image);\n if ((Bitmap2Header1.Width == 0) || (Bitmap2Header1.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n Bitmap2Header1.Depth=ReadBlobByte(image);\n Bitmap2Header1.Compression=ReadBlobByte(image);\n\n if(Bitmap2Header1.Compression > 1)\n continue; /*Unknown compression method */\n switch(Bitmap2Header1.Depth)\n {\n case 1:\n bpp=1;\n break;\n case 2:\n bpp=2;\n break;\n case 3:\n bpp=4;\n break;\n case 4:\n bpp=8;\n break;\n case 8:\n bpp=24;\n break;\n default:\n continue; /*Ignore raster with unknown depth*/\n }\n image->columns=Bitmap2Header1.Width;\n image->rows=Bitmap2Header1.Height; \n\n if ((image->colors == 0) && (bpp != 24))\n {\n size_t\n one;\n\n one=1;\n image->colors=one << bpp;\n if (!AcquireImageColormap(image,image->colors,exception))\n goto NoMemory;\n }\n else\n {\n if(bpp < 24)\n if( image->colors<(one << bpp) && bpp!=24 )\n image->colormap=(PixelInfo *) ResizeQuantumMemory(\n image->colormap,(size_t) (one << bpp),\n sizeof(*image->colormap));\n }\n\n\n switch(Bitmap2Header1.Compression)\n {\n case 0: /*Uncompressed raster*/\n {\n ldblk=(ssize_t) ((bpp*image->columns+7)/8);\n BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t)\n ldblk,sizeof(*BImgBuff));\n if (BImgBuff == (unsigned char *) NULL)\n goto NoMemory;\n\n for(i=0; i< (ssize_t) image->rows; i++)\n {\n (void) ReadBlob(image,ldblk,BImgBuff);\n InsertRow(image,BImgBuff,i,bpp,exception);\n }\n\n if(BImgBuff)\n BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff);;\n break;\n }\n case 1: /*RLE for WPG2 */\n {\n if( UnpackWPG2Raster(image,bpp,exception) < 0)\n goto DecompressionFailed;\n break;\n } \n }\n\n if(CTM[0][0]<0 && !image_info->ping)\n { /*?? RotAngle=360-RotAngle;*/\n Image\n *flop_image;\n\n flop_image = FlopImage(image, exception);\n if (flop_image != (Image *) NULL) {\n DuplicateBlob(flop_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flop_image);\n }\n /* Try to change CTM according to Flip - I am not sure, must be checked. \n Tx(0,0)=-1; Tx(1,0)=0; Tx(2,0)=0;\n Tx(0,1)= 0; Tx(1,1)=1; Tx(2,1)=0;\n Tx(0,2)=(WPG._2Rect.X_ur+WPG._2Rect.X_ll);\n Tx(1,2)=0; Tx(2,2)=1; */ \n }\n if(CTM[1][1]<0 && !image_info->ping)\n { /*?? RotAngle=360-RotAngle;*/\n Image\n *flip_image;\n\n flip_image = FlipImage(image, exception);\n if (flip_image != (Image *) NULL) {\n DuplicateBlob(flip_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flip_image);\n }\n /* Try to change CTM according to Flip - I am not sure, must be checked.\n float_matrix Tx(3,3);\n Tx(0,0)= 1; Tx(1,0)= 0; Tx(2,0)=0;\n Tx(0,1)= 0; Tx(1,1)=-1; Tx(2,1)=0;\n Tx(0,2)= 0; Tx(1,2)=(WPG._2Rect.Y_ur+WPG._2Rect.Y_ll);\n Tx(2,2)=1; */ \n } \n \n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n image->depth=8;\n if (image->next == (Image *) NULL)\n goto Finish;\n image=SyncNextImageInList(image);\n image->columns=image->rows=1;\n image->colors=0;\n break;\n\n case 0x12: /* Postscript WPG2*/\n i=ReadBlobLSBShort(image);\n if(Rec2.RecordLength > (unsigned int) i)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+i, /*skip PS header in the wpg2*/\n (ssize_t) (Rec2.RecordLength-i-2),exception);\n break;\n\n case 0x1B: /*bitmap rectangle*/\n WPG2Flags = LoadWPG2Flags(image,StartWPG.PosSizePrecision,NULL,&CTM);\n (void) WPG2Flags;\n break;\n }\n }\n\n break;\n\n default:\n {\n ThrowReaderException(CoderError,\"DataEncodingSchemeIsNotSupported\");\n }\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n\n Finish:\n (void) CloseBlob(image);\n\n {\n Image\n *p;\n\n ssize_t\n scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n /*\n Fix scene numbers.\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=(size_t) scene++;\n }\n if (image == (Image *) NULL)\n ThrowReaderException(CorruptImageError,\n \"ImageFileDoesNotContainAnyImageData\");\n return(image);\n}","target":"static Image *ReadWPGImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n typedef struct\n {\n size_t FileId;\n MagickOffsetType DataOffset;\n unsigned int ProductType;\n unsigned int FileType;\n unsigned char MajorVersion;\n unsigned char MinorVersion;\n unsigned int EncryptKey;\n unsigned int Reserved;\n } WPGHeader;\n\n typedef struct\n {\n unsigned char RecType;\n size_t RecordLength;\n } WPGRecord;\n\n typedef struct\n {\n unsigned char Class;\n unsigned char RecType;\n size_t Extension;\n size_t RecordLength;\n } WPG2Record;\n\n typedef struct\n {\n unsigned HorizontalUnits;\n unsigned VerticalUnits;\n unsigned char PosSizePrecision;\n } WPG2Start;\n\n typedef struct\n {\n unsigned int Width;\n unsigned int Height;\n unsigned int Depth;\n unsigned int HorzRes;\n unsigned int VertRes;\n } WPGBitmapType1;\n\n typedef struct\n {\n unsigned int Width;\n unsigned int Height;\n unsigned char Depth;\n unsigned char Compression;\n } WPG2BitmapType1;\n\n typedef struct\n {\n unsigned int RotAngle;\n unsigned int LowLeftX;\n unsigned int LowLeftY;\n unsigned int UpRightX;\n unsigned int UpRightY;\n unsigned int Width;\n unsigned int Height;\n unsigned int Depth;\n unsigned int HorzRes;\n unsigned int VertRes;\n } WPGBitmapType2;\n\n typedef struct\n {\n unsigned int StartIndex;\n unsigned int NumOfEntries;\n } WPGColorMapRec;\n\n /*\n typedef struct {\n size_t PS_unknown1;\n unsigned int PS_unknown2;\n unsigned int PS_unknown3;\n } WPGPSl1Record; \n */\n\n Image\n *image;\n\n unsigned int\n status;\n\n WPGHeader\n Header;\n\n WPGRecord\n Rec;\n\n WPG2Record\n Rec2;\n\n WPG2Start StartWPG;\n\n WPGBitmapType1\n BitmapHeader1;\n\n WPG2BitmapType1\n Bitmap2Header1;\n\n WPGBitmapType2\n BitmapHeader2;\n\n WPGColorMapRec\n WPG_Palette;\n\n int\n i,\n bpp,\n WPG2Flags;\n\n ssize_t\n ldblk;\n\n size_t\n one;\n\n unsigned char\n *BImgBuff;\n\n tCTM CTM; /*current transform matrix*/\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n one=1;\n image=AcquireImage(image_info,exception);\n image->depth=8;\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read WPG image.\n */\n Header.FileId=ReadBlobLSBLong(image);\n Header.DataOffset=(MagickOffsetType) ReadBlobLSBLong(image);\n Header.ProductType=ReadBlobLSBShort(image);\n Header.FileType=ReadBlobLSBShort(image);\n Header.MajorVersion=ReadBlobByte(image);\n Header.MinorVersion=ReadBlobByte(image);\n Header.EncryptKey=ReadBlobLSBShort(image);\n Header.Reserved=ReadBlobLSBShort(image);\n\n if (Header.FileId!=0x435057FF || (Header.ProductType>>8)!=0x16)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (Header.EncryptKey!=0)\n ThrowReaderException(CoderError,\"EncryptedWPGImageFileNotSupported\");\n\n image->columns = 1;\n image->rows = 1;\n image->colors = 0;\n bpp=0;\n BitmapHeader2.RotAngle=0;\n\n switch(Header.FileType)\n {\n case 1: /* WPG level 1 */\n while(!EOFBlob(image)) /* object parser loop */\n {\n (void) SeekBlob(image,Header.DataOffset,SEEK_SET);\n if(EOFBlob(image))\n break;\n\n Rec.RecType=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rd_WP_DWORD(image,&Rec.RecordLength);\n if(EOFBlob(image))\n break;\n\n Header.DataOffset=TellBlob(image)+Rec.RecordLength;\n\n switch(Rec.RecType)\n {\n case 0x0B: /* bitmap type 1 */\n BitmapHeader1.Width=ReadBlobLSBShort(image);\n BitmapHeader1.Height=ReadBlobLSBShort(image);\n if ((BitmapHeader1.Width == 0) || (BitmapHeader1.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n BitmapHeader1.Depth=ReadBlobLSBShort(image);\n BitmapHeader1.HorzRes=ReadBlobLSBShort(image);\n BitmapHeader1.VertRes=ReadBlobLSBShort(image);\n\n if(BitmapHeader1.HorzRes && BitmapHeader1.VertRes)\n {\n image->units=PixelsPerCentimeterResolution;\n image->resolution.x=BitmapHeader1.HorzRes/470.0;\n image->resolution.y=BitmapHeader1.VertRes/470.0;\n }\n image->columns=BitmapHeader1.Width;\n image->rows=BitmapHeader1.Height;\n bpp=BitmapHeader1.Depth;\n\n goto UnpackRaster;\n\n case 0x0E: /*Color palette */\n WPG_Palette.StartIndex=ReadBlobLSBShort(image);\n WPG_Palette.NumOfEntries=ReadBlobLSBShort(image);\n\n image->colors=WPG_Palette.NumOfEntries;\n if (!AcquireImageColormap(image,image->colors,exception))\n goto NoMemory;\n for (i=WPG_Palette.StartIndex;\n i < (int)WPG_Palette.NumOfEntries; i++)\n {\n image->colormap[i].red=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n }\n break;\n \n case 0x11: /* Start PS l1 */\n if(Rec.RecordLength > 8)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+8, /* skip PS header in the wpg */\n (ssize_t) Rec.RecordLength-8,exception);\n break; \n\n case 0x14: /* bitmap type 2 */\n BitmapHeader2.RotAngle=ReadBlobLSBShort(image);\n BitmapHeader2.LowLeftX=ReadBlobLSBShort(image);\n BitmapHeader2.LowLeftY=ReadBlobLSBShort(image);\n BitmapHeader2.UpRightX=ReadBlobLSBShort(image);\n BitmapHeader2.UpRightY=ReadBlobLSBShort(image);\n BitmapHeader2.Width=ReadBlobLSBShort(image);\n BitmapHeader2.Height=ReadBlobLSBShort(image);\n if ((BitmapHeader2.Width == 0) || (BitmapHeader2.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n BitmapHeader2.Depth=ReadBlobLSBShort(image);\n BitmapHeader2.HorzRes=ReadBlobLSBShort(image);\n BitmapHeader2.VertRes=ReadBlobLSBShort(image);\n\n image->units=PixelsPerCentimeterResolution;\n image->page.width=(unsigned int)\n ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightX)/470.0);\n image->page.height=(unsigned int)\n ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightY)/470.0);\n image->page.x=(int) (BitmapHeader2.LowLeftX/470.0);\n image->page.y=(int) (BitmapHeader2.LowLeftX/470.0);\n if(BitmapHeader2.HorzRes && BitmapHeader2.VertRes)\n {\n image->resolution.x=BitmapHeader2.HorzRes/470.0;\n image->resolution.y=BitmapHeader2.VertRes/470.0;\n }\n image->columns=BitmapHeader2.Width;\n image->rows=BitmapHeader2.Height;\n bpp=BitmapHeader2.Depth;\n\n UnpackRaster: \n if ((image->colors == 0) && (bpp != 24))\n {\n image->colors=one << bpp;\n if (!AcquireImageColormap(image,image->colors,exception))\n {\n NoMemory:\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n /* printf(\"Load default colormap \\n\"); */\n for (i=0; (i < (int) image->colors) && (i < 256); i++)\n { \n image->colormap[i].red=ScaleCharToQuantum(WPG1_Palette[i].Red);\n image->colormap[i].green=ScaleCharToQuantum(WPG1_Palette[i].Green);\n image->colormap[i].blue=ScaleCharToQuantum(WPG1_Palette[i].Blue);\n }\n }\n else\n {\n if (bpp < 24)\n if ( (image->colors < (one << bpp)) && (bpp != 24) )\n image->colormap=(PixelInfo *) ResizeQuantumMemory(\n image->colormap,(size_t) (one << bpp),\n sizeof(*image->colormap));\n }\n \n if (bpp == 1)\n {\n if(image->colormap[0].red==0 &&\n image->colormap[0].green==0 &&\n image->colormap[0].blue==0 &&\n image->colormap[1].red==0 &&\n image->colormap[1].green==0 &&\n image->colormap[1].blue==0)\n { /* fix crippled monochrome palette */\n image->colormap[1].red =\n image->colormap[1].green =\n image->colormap[1].blue = QuantumRange;\n }\n } \n\n if(UnpackWPGRaster(image,bpp,exception) < 0)\n /* The raster cannot be unpacked */\n {\n DecompressionFailed:\n ThrowReaderException(CoderError,\"UnableToDecompressImage\");\n }\n\n if(Rec.RecType==0x14 && BitmapHeader2.RotAngle!=0 && !image_info->ping)\n { \n /* flop command */\n if(BitmapHeader2.RotAngle & 0x8000)\n {\n Image\n *flop_image;\n\n flop_image = FlopImage(image, exception);\n if (flop_image != (Image *) NULL) {\n DuplicateBlob(flop_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flop_image);\n }\n }\n /* flip command */\n if(BitmapHeader2.RotAngle & 0x2000)\n {\n Image\n *flip_image;\n\n flip_image = FlipImage(image, exception);\n if (flip_image != (Image *) NULL) {\n DuplicateBlob(flip_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flip_image); \n }\n }\n \n /* rotate command */\n if(BitmapHeader2.RotAngle & 0x0FFF)\n {\n Image\n *rotate_image;\n\n rotate_image=RotateImage(image,(BitmapHeader2.RotAngle &\n 0x0FFF), exception);\n if (rotate_image != (Image *) NULL) {\n DuplicateBlob(rotate_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,rotate_image); \n }\n } \n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n image->depth=8;\n if (image->next == (Image *) NULL)\n goto Finish;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n break;\n\n case 0x1B: /* Postscript l2 */\n if(Rec.RecordLength>0x3C)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+0x3C, /* skip PS l2 header in the wpg */\n (ssize_t) Rec.RecordLength-0x3C,exception);\n break;\n }\n }\n break;\n\n case 2: /* WPG level 2 */\n (void) memset(CTM,0,sizeof(CTM));\n StartWPG.PosSizePrecision = 0;\n while(!EOFBlob(image)) /* object parser loop */\n {\n (void) SeekBlob(image,Header.DataOffset,SEEK_SET);\n if(EOFBlob(image))\n break;\n\n Rec2.Class=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rec2.RecType=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rd_WP_DWORD(image,&Rec2.Extension);\n Rd_WP_DWORD(image,&Rec2.RecordLength);\n if(EOFBlob(image))\n break;\n\n Header.DataOffset=TellBlob(image)+Rec2.RecordLength;\n\n switch(Rec2.RecType)\n {\n case 1:\n StartWPG.HorizontalUnits=ReadBlobLSBShort(image);\n StartWPG.VerticalUnits=ReadBlobLSBShort(image);\n StartWPG.PosSizePrecision=ReadBlobByte(image);\n break;\n case 0x0C: /* Color palette */\n WPG_Palette.StartIndex=ReadBlobLSBShort(image);\n WPG_Palette.NumOfEntries=ReadBlobLSBShort(image);\n\n image->colors=WPG_Palette.NumOfEntries;\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n for (i=WPG_Palette.StartIndex;\n i < (int)WPG_Palette.NumOfEntries; i++)\n {\n image->colormap[i].red=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n image->colormap[i].green=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n image->colormap[i].blue=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n (void) ReadBlobByte(image); /*Opacity??*/\n }\n break;\n case 0x0E:\n Bitmap2Header1.Width=ReadBlobLSBShort(image);\n Bitmap2Header1.Height=ReadBlobLSBShort(image);\n if ((Bitmap2Header1.Width == 0) || (Bitmap2Header1.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n Bitmap2Header1.Depth=ReadBlobByte(image);\n Bitmap2Header1.Compression=ReadBlobByte(image);\n\n if(Bitmap2Header1.Compression > 1)\n continue; /*Unknown compression method */\n switch(Bitmap2Header1.Depth)\n {\n case 1:\n bpp=1;\n break;\n case 2:\n bpp=2;\n break;\n case 3:\n bpp=4;\n break;\n case 4:\n bpp=8;\n break;\n case 8:\n bpp=24;\n break;\n default:\n continue; /*Ignore raster with unknown depth*/\n }\n image->columns=Bitmap2Header1.Width;\n image->rows=Bitmap2Header1.Height; \n\n if ((image->colors == 0) && (bpp != 24))\n {\n size_t\n one;\n\n one=1;\n image->colors=one << bpp;\n if (!AcquireImageColormap(image,image->colors,exception))\n goto NoMemory;\n }\n else\n {\n if(bpp < 24)\n if( image->colors<(one << bpp) && bpp!=24 )\n image->colormap=(PixelInfo *) ResizeQuantumMemory(\n image->colormap,(size_t) (one << bpp),\n sizeof(*image->colormap));\n }\n\n\n switch(Bitmap2Header1.Compression)\n {\n case 0: /*Uncompressed raster*/\n {\n ldblk=(ssize_t) ((bpp*image->columns+7)/8);\n BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t)\n ldblk+1,sizeof(*BImgBuff));\n if (BImgBuff == (unsigned char *) NULL)\n goto NoMemory;\n\n for(i=0; i< (ssize_t) image->rows; i++)\n {\n (void) ReadBlob(image,ldblk,BImgBuff);\n InsertRow(image,BImgBuff,i,bpp,exception);\n }\n\n if(BImgBuff)\n BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff);;\n break;\n }\n case 1: /*RLE for WPG2 */\n {\n if( UnpackWPG2Raster(image,bpp,exception) < 0)\n goto DecompressionFailed;\n break;\n } \n }\n\n if(CTM[0][0]<0 && !image_info->ping)\n { /*?? RotAngle=360-RotAngle;*/\n Image\n *flop_image;\n\n flop_image = FlopImage(image, exception);\n if (flop_image != (Image *) NULL) {\n DuplicateBlob(flop_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flop_image);\n }\n /* Try to change CTM according to Flip - I am not sure, must be checked. \n Tx(0,0)=-1; Tx(1,0)=0; Tx(2,0)=0;\n Tx(0,1)= 0; Tx(1,1)=1; Tx(2,1)=0;\n Tx(0,2)=(WPG._2Rect.X_ur+WPG._2Rect.X_ll);\n Tx(1,2)=0; Tx(2,2)=1; */ \n }\n if(CTM[1][1]<0 && !image_info->ping)\n { /*?? RotAngle=360-RotAngle;*/\n Image\n *flip_image;\n\n flip_image = FlipImage(image, exception);\n if (flip_image != (Image *) NULL) {\n DuplicateBlob(flip_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flip_image);\n }\n /* Try to change CTM according to Flip - I am not sure, must be checked.\n float_matrix Tx(3,3);\n Tx(0,0)= 1; Tx(1,0)= 0; Tx(2,0)=0;\n Tx(0,1)= 0; Tx(1,1)=-1; Tx(2,1)=0;\n Tx(0,2)= 0; Tx(1,2)=(WPG._2Rect.Y_ur+WPG._2Rect.Y_ll);\n Tx(2,2)=1; */ \n } \n \n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n image->depth=8;\n if (image->next == (Image *) NULL)\n goto Finish;\n image=SyncNextImageInList(image);\n image->columns=image->rows=1;\n image->colors=0;\n break;\n\n case 0x12: /* Postscript WPG2*/\n i=ReadBlobLSBShort(image);\n if(Rec2.RecordLength > (unsigned int) i)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+i, /*skip PS header in the wpg2*/\n (ssize_t) (Rec2.RecordLength-i-2),exception);\n break;\n\n case 0x1B: /*bitmap rectangle*/\n WPG2Flags = LoadWPG2Flags(image,StartWPG.PosSizePrecision,NULL,&CTM);\n (void) WPG2Flags;\n break;\n }\n }\n\n break;\n\n default:\n {\n ThrowReaderException(CoderError,\"DataEncodingSchemeIsNotSupported\");\n }\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n\n Finish:\n (void) CloseBlob(image);\n\n {\n Image\n *p;\n\n ssize_t\n scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n /*\n Fix scene numbers.\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=(size_t) scene++;\n }\n if (image == (Image *) NULL)\n ThrowReaderException(CorruptImageError,\n \"ImageFileDoesNotContainAnyImageData\");\n return(image);\n}","lang":"c","vul_type":"cwe-125","target_token_count":4725,"sven_meta":{"func_name":"ReadWPGImage","file_name":"coders/wpg.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/bef1e4f637d8f665bc133a9c6d30df08d983bc3a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#113-261091b252d8","input":"static void gf_m2ts_process_pmt(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *pmt, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)\n{\n\tu32 info_length, pos, desc_len, evt_type, nb_es,i;\n\tu32 nb_sections;\n\tu32 data_size;\n\tu32 nb_hevc, nb_hevc_temp, nb_shvc, nb_shvc_temp, nb_mhvc, nb_mhvc_temp;\n\tunsigned char *data;\n\tGF_M2TS_Section *section;\n\tGF_Err e = GF_OK;\n\n\t/*wait for the last section */\n\tif (!(status&GF_M2TS_TABLE_END)) return;\n\n\tnb_es = 0;\n\n\t/*skip if already received but no update detected (eg same data) */\n\tif ((status&GF_M2TS_TABLE_REPEAT) && !(status&GF_M2TS_TABLE_UPDATE)) {\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PMT_REPEAT, pmt->program);\n\t\treturn;\n\t}\n\n\tif (pmt->sec->demux_restarted) {\n\t\tpmt->sec->demux_restarted = 0;\n\t\treturn;\n\t}\n\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] PMT Found or updated\\n\"));\n\n\tnb_sections = gf_list_count(sections);\n\tif (nb_sections > 1) {\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"PMT on multiple sections not supported\\n\"));\n\t}\n\n\tsection = (GF_M2TS_Section *)gf_list_get(sections, 0);\n\tdata = section->data;\n\tdata_size = section->data_size;\n\n\tpmt->program->pcr_pid = ((data[0] & 0x1f) << 8) | data[1];\n\n\tinfo_length = ((data[2]&0xf)<<8) | data[3];\n\tif (info_length != 0) {\n\t\t/* ...Read Descriptors ... */\n\t\tu8 tag, len;\n\t\tu32 first_loop_len = 0;\n\t\ttag = data[4];\n\t\tlen = data[5];\n\t\twhile (info_length > first_loop_len) {\n\t\t\tif (tag == GF_M2TS_MPEG4_IOD_DESCRIPTOR) {\n\t\t\t\tu32 size;\n\t\t\t\tGF_BitStream *iod_bs;\n\t\t\t\tiod_bs = gf_bs_new((char *)data+8, len-2, GF_BITSTREAM_READ);\n\t\t\t\tif (pmt->program->pmt_iod) gf_odf_desc_del((GF_Descriptor *)pmt->program->pmt_iod);\n\t\t\t\te = gf_odf_parse_descriptor(iod_bs , (GF_Descriptor **) &pmt->program->pmt_iod, &size);\n\t\t\t\tgf_bs_del(iod_bs );\n\t\t\t\tif (e==GF_OK) {\n\t\t\t\t\t/*remember program number for service/program selection*/\n\t\t\t\t\tif (pmt->program->pmt_iod) pmt->program->pmt_iod->ServiceID = pmt->program->number;\n\t\t\t\t\t/*if empty IOD (freebox case), discard it and use dynamic declaration of object*/\n\t\t\t\t\tif (!gf_list_count(pmt->program->pmt_iod->ESDescriptors)) {\n\t\t\t\t\t\tgf_odf_desc_del((GF_Descriptor *)pmt->program->pmt_iod);\n\t\t\t\t\t\tpmt->program->pmt_iod = NULL;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (tag == GF_M2TS_METADATA_POINTER_DESCRIPTOR) {\n\t\t\t\tGF_BitStream *metadatapd_bs;\n\t\t\t\tGF_M2TS_MetadataPointerDescriptor *metapd;\n\t\t\t\tmetadatapd_bs = gf_bs_new((char *)data+6, len, GF_BITSTREAM_READ);\n\t\t\t\tmetapd = gf_m2ts_read_metadata_pointer_descriptor(metadatapd_bs, len);\n\t\t\t\tgf_bs_del(metadatapd_bs);\n\t\t\t\tif (metapd->application_format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t metapd->format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t metapd->carriage_flag == METADATA_CARRIAGE_SAME_TS) {\n\t\t\t\t\t/*HLS ID3 Metadata */\n\t\t\t\t\tpmt->program->metadata_pointer_descriptor = metapd;\n\t\t\t\t} else {\n\t\t\t\t\t/* don't know what to do with it for now, delete */\n\t\t\t\t\tgf_m2ts_metadata_pointer_descriptor_del(metapd);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Skipping descriptor (0x%x) and others not supported\\n\", tag));\n\t\t\t}\n\t\t\tfirst_loop_len += 2 + len;\n\t\t}\n\t}\n\tif (data_size <= 4 + info_length) return;\n\tdata += 4 + info_length;\n\tdata_size -= 4 + info_length;\n\tpos = 0;\n\n\t/* count de number of program related PMT received */\n\tfor(i=0; iprograms); i++) {\n\t\tGF_M2TS_Program *prog = (GF_M2TS_Program *)gf_list_get(ts->programs,i);\n\t\tif(prog->pmt_pid == pmt->pid) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tnb_hevc = nb_hevc_temp = nb_shvc = nb_shvc_temp = nb_mhvc = nb_mhvc_temp = 0;\n\twhile (poscc = -1;\n\t\t\tpes->flags = GF_M2TS_ES_IS_PES;\n\t\t\tif (inherit_pcr)\n\t\t\t\tpes->flags |= GF_M2TS_INHERIT_PCR;\n\t\t\tes = (GF_M2TS_ES *)pes;\n\t\t\tbreak;\n\t\tcase GF_M2TS_PRIVATE_DATA:\n\t\t\tGF_SAFEALLOC(pes, GF_M2TS_PES);\n\t\t\tif (!pes) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpes->cc = -1;\n\t\t\tpes->flags = GF_M2TS_ES_IS_PES;\n\t\t\tes = (GF_M2TS_ES *)pes;\n\t\t\tbreak;\n\t\t/* Sections */\n\t\tcase GF_M2TS_SYSTEMS_MPEG4_SECTIONS:\n\t\t\tGF_SAFEALLOC(ses, GF_M2TS_SECTION_ES);\n\t\t\tif (!ses) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tes = (GF_M2TS_ES *)ses;\n\t\t\tes->flags |= GF_M2TS_ES_IS_SECTION;\n\t\t\t/* carriage of ISO_IEC_14496 data in sections */\n\t\t\tif (stream_type == GF_M2TS_SYSTEMS_MPEG4_SECTIONS) {\n\t\t\t\t/*MPEG-4 sections need to be fully checked: if one section is lost, this means we lost\n\t\t\t\tone SL packet in the AU so we must wait for the complete section again*/\n\t\t\t\tses->sec = gf_m2ts_section_filter_new(gf_m2ts_process_mpeg4section, 0);\n\t\t\t\t/*create OD container*/\n\t\t\t\tif (!pmt->program->additional_ods) {\n\t\t\t\t\tpmt->program->additional_ods = gf_list_new();\n\t\t\t\t\tts->has_4on2 = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase GF_M2TS_13818_6_ANNEX_A:\n\t\tcase GF_M2TS_13818_6_ANNEX_B:\n\t\tcase GF_M2TS_13818_6_ANNEX_C:\n\t\tcase GF_M2TS_13818_6_ANNEX_D:\n\t\tcase GF_M2TS_PRIVATE_SECTION:\n\t\tcase GF_M2TS_QUALITY_SEC:\n\t\tcase GF_M2TS_MORE_SEC:\n\t\t\tGF_SAFEALLOC(ses, GF_M2TS_SECTION_ES);\n\t\t\tif (!ses) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tes = (GF_M2TS_ES *)ses;\n\t\t\tes->flags |= GF_M2TS_ES_IS_SECTION;\n\t\t\tes->pid = pid;\n\t\t\tes->service_id = pmt->program->number;\n\t\t\tif (stream_type == GF_M2TS_PRIVATE_SECTION) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"AIT sections on pid %d\\n\", pid));\n\t\t\t} else if (stream_type == GF_M2TS_QUALITY_SEC) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"Quality metadata sections on pid %d\\n\", pid));\n\t\t\t} else if (stream_type == GF_M2TS_MORE_SEC) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"MORE sections on pid %d\\n\", pid));\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"stream type DSM CC user private sections on pid %d \\n\", pid));\n\t\t\t}\n\t\t\t/* NULL means: trigger the call to on_event with DVB_GENERAL type and the raw section as payload */\n\t\t\tses->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t//ses->sec->service_id = pmt->program->number;\n\t\t\tbreak;\n\n\t\tcase GF_M2TS_MPE_SECTIONS:\n\t\t\tif (! ts->prefix_present) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"stream type MPE found : pid = %d \\n\", pid));\n#ifdef GPAC_ENABLE_MPE\n\t\t\t\tes = gf_dvb_mpe_section_new();\n\t\t\t\tif (es->flags & GF_M2TS_ES_IS_SECTION) {\n\t\t\t\t\t/* NULL means: trigger the call to on_event with DVB_GENERAL type and the raw section as payload */\n\t\t\t\t\t((GF_M2TS_SECTION_ES*)es)->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t\t}\n#endif\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tdefault:\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t\t//GF_LOG(/*GF_LOG_WARNING*/GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t\tbreak;\n\t\t}\n\n\t\tif (es) {\n\t\t\tes->stream_type = (stream_type==GF_M2TS_PRIVATE_DATA) ? 0 : stream_type;\n\t\t\tes->program = pmt->program;\n\t\t\tes->pid = pid;\n\t\t\tes->component_tag = -1;\n\t\t}\n\n\t\tpos += 5;\n\t\tdata += 5;\n\n\t\twhile (desc_len) {\n\t\t\tu8 tag = data[0];\n\t\t\tu32 len = data[1];\n\t\t\tif (es) {\n\t\t\t\tswitch (tag) {\n\t\t\t\tcase GF_M2TS_ISO_639_LANGUAGE_DESCRIPTOR:\n\t\t\t\t\tif (pes)\n\t\t\t\t\t\tpes->lang = GF_4CC(' ', data[2], data[3], data[4]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_MPEG4_SL_DESCRIPTOR:\n\t\t\t\t\tes->mpeg4_es_id = ( (u32) data[2] & 0x1f) << 8 | data[3];\n\t\t\t\t\tes->flags |= GF_M2TS_ES_IS_SL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_REGISTRATION_DESCRIPTOR:\n\t\t\t\t\treg_desc_format = GF_4CC(data[2], data[3], data[4], data[5]);\n\t\t\t\t\t/*cf http://www.smpte-ra.org/mpegreg/mpegreg.html*/\n\t\t\t\t\tswitch (reg_desc_format) {\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_AC3:\n\t\t\t\t\t\tes->stream_type = GF_M2TS_AUDIO_AC3;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_VC1:\n\t\t\t\t\t\tes->stream_type = GF_M2TS_VIDEO_VC1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_GPAC:\n\t\t\t\t\t\tif (len==8) {\n\t\t\t\t\t\t\tes->stream_type = GF_4CC(data[6], data[7], data[8], data[9]);\n\t\t\t\t\t\t\tes->flags |= GF_M2TS_GPAC_CODEC_ID;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"Unknown registration descriptor %s\\n\", gf_4cc_to_str(reg_desc_format) ));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_EAC3_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_AUDIO_EC3;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_DATA_BROADCAST_ID_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tu32 id = data[2]<<8 | data[3];\n\t\t\t\t\tif ((id == 0xB) && ses && !ses->sec) {\n\t\t\t\t\t\tses->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_SUBTITLING_DESCRIPTOR:\n\t\t\t\t\tif (pes) {\n\t\t\t\t\t\tpes->sub.language[0] = data[2];\n\t\t\t\t\t\tpes->sub.language[1] = data[3];\n\t\t\t\t\t\tpes->sub.language[2] = data[4];\n\t\t\t\t\t\tpes->sub.type = data[5];\n\t\t\t\t\t\tpes->sub.composition_page_id = (data[6]<<8) | data[7];\n\t\t\t\t\t\tpes->sub.ancillary_page_id = (data[8]<<8) | data[9];\n\t\t\t\t\t}\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_SUBTITLE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_STREAM_IDENTIFIER_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tes->component_tag = data[2];\n\t\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"Component Tag: %d on Program %d\\n\", es->component_tag, es->program->number));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_TELETEXT_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_TELETEXT;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_VBI_DATA_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_VBI;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_HIERARCHY_DESCRIPTOR:\n\t\t\t\t\tif (pes) {\n\t\t\t\t\t\tu8 hierarchy_embedded_layer_index;\n\t\t\t\t\t\tGF_BitStream *hbs = gf_bs_new((const char *)data, data_size, GF_BITSTREAM_READ);\n\t\t\t\t\t\t/*u32 skip = */gf_bs_read_int(hbs, 16);\n\t\t\t\t\t\t/*u8 res1 = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 temp_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 spatial_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 quality_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 hierarchy_type = */gf_bs_read_int(hbs, 4);\n\t\t\t\t\t\t/*u8 res2 = */gf_bs_read_int(hbs, 2);\n\t\t\t\t\t\t/*u8 hierarchy_layer_index = */gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\t/*u8 tref_not_present = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 res3 = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\thierarchy_embedded_layer_index = gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\t/*u8 res4 = */gf_bs_read_int(hbs, 2);\n\t\t\t\t\t\t/*u8 hierarchy_channel = */gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\tgf_bs_del(hbs);\n\n\t\t\t\t\t\tpes->depends_on_pid = 1+hierarchy_embedded_layer_index;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_METADATA_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tGF_BitStream *metadatad_bs;\n\t\t\t\t\tGF_M2TS_MetadataDescriptor *metad;\n\t\t\t\t\tmetadatad_bs = gf_bs_new((char *)data+2, len, GF_BITSTREAM_READ);\n\t\t\t\t\tmetad = gf_m2ts_read_metadata_descriptor(metadatad_bs, len);\n\t\t\t\t\tgf_bs_del(metadatad_bs);\n\t\t\t\t\tif (metad->application_format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t\t metad->format_identifier == GF_M2TS_META_ID3) {\n\t\t\t\t\t\t/*HLS ID3 Metadata */\n\t\t\t\t\t\tif (pes) {\n\t\t\t\t\t\t\tpes->metadata_descriptor = metad;\n\t\t\t\t\t\t\tpes->stream_type = GF_M2TS_METADATA_ID3_HLS;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* don't know what to do with it for now, delete */\n\t\t\t\t\t\tgf_m2ts_metadata_descriptor_del(metad);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] skipping descriptor (0x%x) not supported\\n\", tag));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdata += len+2;\n\t\t\tpos += len+2;\n\t\t\tif (desc_len < len+2) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Invalid PMT es descriptor size for PID %d\\n\", pid ) );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdesc_len-=len+2;\n\t\t}\n\n\t\tif (es && !es->stream_type) {\n\t\t\tgf_free(es);\n\t\t\tes = NULL;\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Private Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t}\n\n\t\tif (!es) continue;\n\n\t\tif (ts->ess[pid]) {\n\t\t\t//this is component reuse across programs, overwrite the previously declared stream ...\n\t\t\tif (status & GF_M2TS_TABLE_FOUND) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"[MPEG-2 TS] PID %d reused across programs %d and %d, not completely supported\\n\", pid, ts->ess[pid]->program->number, es->program->number ) );\n\n\t\t\t\t//add stream to program but don't reassign the pid table until the stream is playing (>GF_M2TS_PES_FRAMING_SKIP)\n\t\t\t\tgf_list_add(pmt->program->streams, es);\n\t\t\t\tif (!(es->flags & GF_M2TS_ES_IS_SECTION) ) gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_SKIP);\n\n\t\t\t\tnb_es++;\n\t\t\t\t//skip assignment below\n\t\t\t\tes = NULL;\n\t\t\t}\n\t\t\t/*watchout for pmt update - FIXME this likely won't work in most cases*/\n\t\t\telse {\n\n\t\t\t\tGF_M2TS_ES *o_es = ts->ess[es->pid];\n\n\t\t\t\tif ((o_es->stream_type == es->stream_type)\n\t\t\t\t && ((o_es->flags & GF_M2TS_ES_STATIC_FLAGS_MASK) == (es->flags & GF_M2TS_ES_STATIC_FLAGS_MASK))\n\t\t\t\t && (o_es->mpeg4_es_id == es->mpeg4_es_id)\n\t\t\t\t && ((o_es->flags & GF_M2TS_ES_IS_SECTION) || ((GF_M2TS_PES *)o_es)->lang == ((GF_M2TS_PES *)es)->lang)\n\t\t\t\t ) {\n\t\t\t\t\tgf_free(es);\n\t\t\t\t\tes = NULL;\n\t\t\t\t} else {\n\t\t\t\t\tgf_m2ts_es_del(o_es, ts);\n\t\t\t\t\tts->ess[es->pid] = NULL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (es) {\n\t\t\tts->ess[es->pid] = es;\n\t\t\tgf_list_add(pmt->program->streams, es);\n\t\t\tif (!(es->flags & GF_M2TS_ES_IS_SECTION) ) gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_SKIP);\n\n\t\t\tnb_es++;\n\t\t}\n\n\t\tif (es->stream_type == GF_M2TS_VIDEO_HEVC) nb_hevc++;\n\t\telse if (es->stream_type == GF_M2TS_VIDEO_HEVC_TEMPORAL) nb_hevc_temp++;\n\t\telse if (es->stream_type == GF_M2TS_VIDEO_SHVC) nb_shvc++;\n\t\telse if (es->stream_type == GF_M2TS_VIDEO_SHVC_TEMPORAL) nb_shvc_temp++;\n\t\telse if (es->stream_type == GF_M2TS_VIDEO_MHVC) nb_mhvc++;\n\t\telse if (es->stream_type == GF_M2TS_VIDEO_MHVC_TEMPORAL) nb_mhvc_temp++;\n\t}\n\n\t//Table 2-139, implied hierarchy indexes\n\tif (nb_hevc_temp + nb_shvc + nb_shvc_temp + nb_mhvc+ nb_mhvc_temp) {\n\t\tfor (i=0; iprogram->streams); i++) {\n\t\t\tGF_M2TS_PES *es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, i);\n\t\t\tif ( !(es->flags & GF_M2TS_ES_IS_PES)) continue;\n\t\t\tif (es->depends_on_pid) continue;\n\n\t\t\tswitch (es->stream_type) {\n\t\t\tcase GF_M2TS_VIDEO_HEVC_TEMPORAL:\n\t\t\t\tes->depends_on_pid = 1;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_SHVC:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 1;\n\t\t\t\telse es->depends_on_pid = 2;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_SHVC_TEMPORAL:\n\t\t\t\tes->depends_on_pid = 3;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_MHVC:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 1;\n\t\t\t\telse es->depends_on_pid = 2;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_MHVC_TEMPORAL:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 2;\n\t\t\t\telse es->depends_on_pid = 3;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (nb_es) {\n\t\tu32 i;\n\n\t\t//translate hierarchy descriptors indexes into PIDs - check whether the PMT-index rules are the same for HEVC\n\t\tfor (i=0; iprogram->streams); i++) {\n\t\t\tGF_M2TS_PES *an_es = NULL;\n\t\t\tGF_M2TS_PES *es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, i);\n\t\t\tif ( !(es->flags & GF_M2TS_ES_IS_PES)) continue;\n\t\t\tif (!es->depends_on_pid) continue;\n\n\t\t\t//fixeme we are not always assured that hierarchy_layer_index matches the stream index...\n\t\t\t//+1 is because our first stream is the PMT\n\t\t\tan_es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, es->depends_on_pid);\n\t\t\tif (an_es) {\n\t\t\t\tes->depends_on_pid = an_es->pid;\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[M2TS] Wrong dependency index in hierarchy descriptor, assuming non-scalable stream\\n\"));\n\t\t\t\tes->depends_on_pid = 0;\n\t\t\t}\n\t\t}\n\n\t\tevt_type = (status&GF_M2TS_TABLE_FOUND) ? GF_M2TS_EVT_PMT_FOUND : GF_M2TS_EVT_PMT_UPDATE;\n\t\tif (ts->on_event) ts->on_event(ts, evt_type, pmt->program);\n\t} else {\n\t\t/* if we found no new ES it's simply a repeat of the PMT */\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PMT_REPEAT, pmt->program);\n\t}\n}","target":"static void gf_m2ts_process_pmt(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *pmt, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)\n{\n\tu32 info_length, pos, desc_len, evt_type, nb_es,i;\n\tu32 nb_sections;\n\tu32 data_size;\n\tu32 nb_hevc, nb_hevc_temp, nb_shvc, nb_shvc_temp, nb_mhvc, nb_mhvc_temp;\n\tunsigned char *data;\n\tGF_M2TS_Section *section;\n\tGF_Err e = GF_OK;\n\n\t/*wait for the last section */\n\tif (!(status&GF_M2TS_TABLE_END)) return;\n\n\tnb_es = 0;\n\n\t/*skip if already received but no update detected (eg same data) */\n\tif ((status&GF_M2TS_TABLE_REPEAT) && !(status&GF_M2TS_TABLE_UPDATE)) {\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PMT_REPEAT, pmt->program);\n\t\treturn;\n\t}\n\n\tif (pmt->sec->demux_restarted) {\n\t\tpmt->sec->demux_restarted = 0;\n\t\treturn;\n\t}\n\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] PMT Found or updated\\n\"));\n\n\tnb_sections = gf_list_count(sections);\n\tif (nb_sections > 1) {\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"PMT on multiple sections not supported\\n\"));\n\t}\n\n\tsection = (GF_M2TS_Section *)gf_list_get(sections, 0);\n\tdata = section->data;\n\tdata_size = section->data_size;\n\n\tpmt->program->pcr_pid = ((data[0] & 0x1f) << 8) | data[1];\n\n\tinfo_length = ((data[2]&0xf)<<8) | data[3];\n\tif (info_length != 0) {\n\t\t/* ...Read Descriptors ... */\n\t\tu8 tag, len;\n\t\tu32 first_loop_len = 0;\n\t\ttag = data[4];\n\t\tlen = data[5];\n\t\twhile (info_length > first_loop_len) {\n\t\t\tif (tag == GF_M2TS_MPEG4_IOD_DESCRIPTOR) {\n\t\t\t\tu32 size;\n\t\t\t\tGF_BitStream *iod_bs;\n\t\t\t\tiod_bs = gf_bs_new((char *)data+8, len-2, GF_BITSTREAM_READ);\n\t\t\t\tif (pmt->program->pmt_iod) gf_odf_desc_del((GF_Descriptor *)pmt->program->pmt_iod);\n\t\t\t\te = gf_odf_parse_descriptor(iod_bs , (GF_Descriptor **) &pmt->program->pmt_iod, &size);\n\t\t\t\tgf_bs_del(iod_bs );\n\t\t\t\tif (e==GF_OK) {\n\t\t\t\t\t/*remember program number for service/program selection*/\n\t\t\t\t\tif (pmt->program->pmt_iod) pmt->program->pmt_iod->ServiceID = pmt->program->number;\n\t\t\t\t\t/*if empty IOD (freebox case), discard it and use dynamic declaration of object*/\n\t\t\t\t\tif (!gf_list_count(pmt->program->pmt_iod->ESDescriptors)) {\n\t\t\t\t\t\tgf_odf_desc_del((GF_Descriptor *)pmt->program->pmt_iod);\n\t\t\t\t\t\tpmt->program->pmt_iod = NULL;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (tag == GF_M2TS_METADATA_POINTER_DESCRIPTOR) {\n\t\t\t\tGF_BitStream *metadatapd_bs;\n\t\t\t\tGF_M2TS_MetadataPointerDescriptor *metapd;\n\t\t\t\tmetadatapd_bs = gf_bs_new((char *)data+6, len, GF_BITSTREAM_READ);\n\t\t\t\tmetapd = gf_m2ts_read_metadata_pointer_descriptor(metadatapd_bs, len);\n\t\t\t\tgf_bs_del(metadatapd_bs);\n\t\t\t\tif (metapd->application_format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t metapd->format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t metapd->carriage_flag == METADATA_CARRIAGE_SAME_TS) {\n\t\t\t\t\t/*HLS ID3 Metadata */\n\t\t\t\t\tpmt->program->metadata_pointer_descriptor = metapd;\n\t\t\t\t} else {\n\t\t\t\t\t/* don't know what to do with it for now, delete */\n\t\t\t\t\tgf_m2ts_metadata_pointer_descriptor_del(metapd);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Skipping descriptor (0x%x) and others not supported\\n\", tag));\n\t\t\t}\n\t\t\tfirst_loop_len += 2 + len;\n\t\t}\n\t}\n\tif (data_size <= 4 + info_length) return;\n\tdata += 4 + info_length;\n\tdata_size -= 4 + info_length;\n\tpos = 0;\n\n\t/* count de number of program related PMT received */\n\tfor(i=0; iprograms); i++) {\n\t\tGF_M2TS_Program *prog = (GF_M2TS_Program *)gf_list_get(ts->programs,i);\n\t\tif(prog->pmt_pid == pmt->pid) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tnb_hevc = nb_hevc_temp = nb_shvc = nb_shvc_temp = nb_mhvc = nb_mhvc_temp = 0;\n\twhile (poscc = -1;\n\t\t\tpes->flags = GF_M2TS_ES_IS_PES;\n\t\t\tif (inherit_pcr)\n\t\t\t\tpes->flags |= GF_M2TS_INHERIT_PCR;\n\t\t\tes = (GF_M2TS_ES *)pes;\n\t\t\tbreak;\n\t\tcase GF_M2TS_PRIVATE_DATA:\n\t\t\tGF_SAFEALLOC(pes, GF_M2TS_PES);\n\t\t\tif (!pes) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpes->cc = -1;\n\t\t\tpes->flags = GF_M2TS_ES_IS_PES;\n\t\t\tes = (GF_M2TS_ES *)pes;\n\t\t\tbreak;\n\t\t/* Sections */\n\t\tcase GF_M2TS_SYSTEMS_MPEG4_SECTIONS:\n\t\t\tGF_SAFEALLOC(ses, GF_M2TS_SECTION_ES);\n\t\t\tif (!ses) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tes = (GF_M2TS_ES *)ses;\n\t\t\tes->flags |= GF_M2TS_ES_IS_SECTION;\n\t\t\t/* carriage of ISO_IEC_14496 data in sections */\n\t\t\tif (stream_type == GF_M2TS_SYSTEMS_MPEG4_SECTIONS) {\n\t\t\t\t/*MPEG-4 sections need to be fully checked: if one section is lost, this means we lost\n\t\t\t\tone SL packet in the AU so we must wait for the complete section again*/\n\t\t\t\tses->sec = gf_m2ts_section_filter_new(gf_m2ts_process_mpeg4section, 0);\n\t\t\t\t/*create OD container*/\n\t\t\t\tif (!pmt->program->additional_ods) {\n\t\t\t\t\tpmt->program->additional_ods = gf_list_new();\n\t\t\t\t\tts->has_4on2 = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase GF_M2TS_13818_6_ANNEX_A:\n\t\tcase GF_M2TS_13818_6_ANNEX_B:\n\t\tcase GF_M2TS_13818_6_ANNEX_C:\n\t\tcase GF_M2TS_13818_6_ANNEX_D:\n\t\tcase GF_M2TS_PRIVATE_SECTION:\n\t\tcase GF_M2TS_QUALITY_SEC:\n\t\tcase GF_M2TS_MORE_SEC:\n\t\t\tGF_SAFEALLOC(ses, GF_M2TS_SECTION_ES);\n\t\t\tif (!ses) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tes = (GF_M2TS_ES *)ses;\n\t\t\tes->flags |= GF_M2TS_ES_IS_SECTION;\n\t\t\tes->pid = pid;\n\t\t\tes->service_id = pmt->program->number;\n\t\t\tif (stream_type == GF_M2TS_PRIVATE_SECTION) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"AIT sections on pid %d\\n\", pid));\n\t\t\t} else if (stream_type == GF_M2TS_QUALITY_SEC) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"Quality metadata sections on pid %d\\n\", pid));\n\t\t\t} else if (stream_type == GF_M2TS_MORE_SEC) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"MORE sections on pid %d\\n\", pid));\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"stream type DSM CC user private sections on pid %d \\n\", pid));\n\t\t\t}\n\t\t\t/* NULL means: trigger the call to on_event with DVB_GENERAL type and the raw section as payload */\n\t\t\tses->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t//ses->sec->service_id = pmt->program->number;\n\t\t\tbreak;\n\n\t\tcase GF_M2TS_MPE_SECTIONS:\n\t\t\tif (! ts->prefix_present) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"stream type MPE found : pid = %d \\n\", pid));\n#ifdef GPAC_ENABLE_MPE\n\t\t\t\tes = gf_dvb_mpe_section_new();\n\t\t\t\tif (es->flags & GF_M2TS_ES_IS_SECTION) {\n\t\t\t\t\t/* NULL means: trigger the call to on_event with DVB_GENERAL type and the raw section as payload */\n\t\t\t\t\t((GF_M2TS_SECTION_ES*)es)->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t\t}\n#endif\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tdefault:\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t\t//GF_LOG(/*GF_LOG_WARNING*/GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t\tbreak;\n\t\t}\n\n\t\tif (es) {\n\t\t\tes->stream_type = (stream_type==GF_M2TS_PRIVATE_DATA) ? 0 : stream_type;\n\t\t\tes->program = pmt->program;\n\t\t\tes->pid = pid;\n\t\t\tes->component_tag = -1;\n\t\t}\n\n\t\tpos += 5;\n\t\tdata += 5;\n\n\t\twhile (desc_len) {\n\t\t\tu8 tag = data[0];\n\t\t\tu32 len = data[1];\n\t\t\tif (es) {\n\t\t\t\tswitch (tag) {\n\t\t\t\tcase GF_M2TS_ISO_639_LANGUAGE_DESCRIPTOR:\n\t\t\t\t\tif (pes)\n\t\t\t\t\t\tpes->lang = GF_4CC(' ', data[2], data[3], data[4]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_MPEG4_SL_DESCRIPTOR:\n\t\t\t\t\tes->mpeg4_es_id = ( (u32) data[2] & 0x1f) << 8 | data[3];\n\t\t\t\t\tes->flags |= GF_M2TS_ES_IS_SL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_REGISTRATION_DESCRIPTOR:\n\t\t\t\t\treg_desc_format = GF_4CC(data[2], data[3], data[4], data[5]);\n\t\t\t\t\t/*cf http://www.smpte-ra.org/mpegreg/mpegreg.html*/\n\t\t\t\t\tswitch (reg_desc_format) {\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_AC3:\n\t\t\t\t\t\tes->stream_type = GF_M2TS_AUDIO_AC3;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_VC1:\n\t\t\t\t\t\tes->stream_type = GF_M2TS_VIDEO_VC1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_GPAC:\n\t\t\t\t\t\tif (len==8) {\n\t\t\t\t\t\t\tes->stream_type = GF_4CC(data[6], data[7], data[8], data[9]);\n\t\t\t\t\t\t\tes->flags |= GF_M2TS_GPAC_CODEC_ID;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"Unknown registration descriptor %s\\n\", gf_4cc_to_str(reg_desc_format) ));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_EAC3_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_AUDIO_EC3;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_DATA_BROADCAST_ID_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tu32 id = data[2]<<8 | data[3];\n\t\t\t\t\tif ((id == 0xB) && ses && !ses->sec) {\n\t\t\t\t\t\tses->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_SUBTITLING_DESCRIPTOR:\n\t\t\t\t\tif (pes) {\n\t\t\t\t\t\tpes->sub.language[0] = data[2];\n\t\t\t\t\t\tpes->sub.language[1] = data[3];\n\t\t\t\t\t\tpes->sub.language[2] = data[4];\n\t\t\t\t\t\tpes->sub.type = data[5];\n\t\t\t\t\t\tpes->sub.composition_page_id = (data[6]<<8) | data[7];\n\t\t\t\t\t\tpes->sub.ancillary_page_id = (data[8]<<8) | data[9];\n\t\t\t\t\t}\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_SUBTITLE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_STREAM_IDENTIFIER_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tes->component_tag = data[2];\n\t\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"Component Tag: %d on Program %d\\n\", es->component_tag, es->program->number));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_TELETEXT_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_TELETEXT;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_VBI_DATA_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_VBI;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_HIERARCHY_DESCRIPTOR:\n\t\t\t\t\tif (pes) {\n\t\t\t\t\t\tu8 hierarchy_embedded_layer_index;\n\t\t\t\t\t\tGF_BitStream *hbs = gf_bs_new((const char *)data, data_size, GF_BITSTREAM_READ);\n\t\t\t\t\t\t/*u32 skip = */gf_bs_read_int(hbs, 16);\n\t\t\t\t\t\t/*u8 res1 = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 temp_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 spatial_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 quality_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 hierarchy_type = */gf_bs_read_int(hbs, 4);\n\t\t\t\t\t\t/*u8 res2 = */gf_bs_read_int(hbs, 2);\n\t\t\t\t\t\t/*u8 hierarchy_layer_index = */gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\t/*u8 tref_not_present = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 res3 = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\thierarchy_embedded_layer_index = gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\t/*u8 res4 = */gf_bs_read_int(hbs, 2);\n\t\t\t\t\t\t/*u8 hierarchy_channel = */gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\tgf_bs_del(hbs);\n\n\t\t\t\t\t\tpes->depends_on_pid = 1+hierarchy_embedded_layer_index;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_METADATA_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tGF_BitStream *metadatad_bs;\n\t\t\t\t\tGF_M2TS_MetadataDescriptor *metad;\n\t\t\t\t\tmetadatad_bs = gf_bs_new((char *)data+2, len, GF_BITSTREAM_READ);\n\t\t\t\t\tmetad = gf_m2ts_read_metadata_descriptor(metadatad_bs, len);\n\t\t\t\t\tgf_bs_del(metadatad_bs);\n\t\t\t\t\tif (metad->application_format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t\t metad->format_identifier == GF_M2TS_META_ID3) {\n\t\t\t\t\t\t/*HLS ID3 Metadata */\n\t\t\t\t\t\tif (pes) {\n\t\t\t\t\t\t\tpes->metadata_descriptor = metad;\n\t\t\t\t\t\t\tpes->stream_type = GF_M2TS_METADATA_ID3_HLS;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* don't know what to do with it for now, delete */\n\t\t\t\t\t\tgf_m2ts_metadata_descriptor_del(metad);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] skipping descriptor (0x%x) not supported\\n\", tag));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdata += len+2;\n\t\t\tpos += len+2;\n\t\t\tif (desc_len < len+2) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Invalid PMT es descriptor size for PID %d\\n\", pid ) );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdesc_len-=len+2;\n\t\t}\n\n\t\tif (es && !es->stream_type) {\n\t\t\tgf_free(es);\n\t\t\tes = NULL;\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Private Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t}\n\n\t\tif (!es) continue;\n\n\t\tif (ts->ess[pid]) {\n\t\t\t//this is component reuse across programs, overwrite the previously declared stream ...\n\t\t\tif (status & GF_M2TS_TABLE_FOUND) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"[MPEG-2 TS] PID %d reused across programs %d and %d, not completely supported\\n\", pid, ts->ess[pid]->program->number, es->program->number ) );\n\n\t\t\t\t//add stream to program but don't reassign the pid table until the stream is playing (>GF_M2TS_PES_FRAMING_SKIP)\n\t\t\t\tgf_list_add(pmt->program->streams, es);\n\t\t\t\tif (!(es->flags & GF_M2TS_ES_IS_SECTION) ) gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_SKIP);\n\n\t\t\t\tnb_es++;\n\t\t\t\t//skip assignment below\n\t\t\t\tes = NULL;\n\t\t\t}\n\t\t\t/*watchout for pmt update - FIXME this likely won't work in most cases*/\n\t\t\telse {\n\n\t\t\t\tGF_M2TS_ES *o_es = ts->ess[es->pid];\n\n\t\t\t\tif ((o_es->stream_type == es->stream_type)\n\t\t\t\t && ((o_es->flags & GF_M2TS_ES_STATIC_FLAGS_MASK) == (es->flags & GF_M2TS_ES_STATIC_FLAGS_MASK))\n\t\t\t\t && (o_es->mpeg4_es_id == es->mpeg4_es_id)\n\t\t\t\t && ((o_es->flags & GF_M2TS_ES_IS_SECTION) || ((GF_M2TS_PES *)o_es)->lang == ((GF_M2TS_PES *)es)->lang)\n\t\t\t\t ) {\n\t\t\t\t\tgf_free(es);\n\t\t\t\t\tes = NULL;\n\t\t\t\t} else {\n\t\t\t\t\tgf_m2ts_es_del(o_es, ts);\n\t\t\t\t\tts->ess[es->pid] = NULL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (es) {\n\t\t\tts->ess[es->pid] = es;\n\t\t\tgf_list_add(pmt->program->streams, es);\n\t\t\tif (!(es->flags & GF_M2TS_ES_IS_SECTION) ) gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_SKIP);\n\n\t\t\tnb_es++;\n\n\t\t\tif (es->stream_type == GF_M2TS_VIDEO_HEVC) nb_hevc++;\n\t\t\telse if (es->stream_type == GF_M2TS_VIDEO_HEVC_TEMPORAL) nb_hevc_temp++;\n\t\t\telse if (es->stream_type == GF_M2TS_VIDEO_SHVC) nb_shvc++;\n\t\t\telse if (es->stream_type == GF_M2TS_VIDEO_SHVC_TEMPORAL) nb_shvc_temp++;\n\t\t\telse if (es->stream_type == GF_M2TS_VIDEO_MHVC) nb_mhvc++;\n\t\t\telse if (es->stream_type == GF_M2TS_VIDEO_MHVC_TEMPORAL) nb_mhvc_temp++;\n\t\t}\n\t}\n\n\t//Table 2-139, implied hierarchy indexes\n\tif (nb_hevc_temp + nb_shvc + nb_shvc_temp + nb_mhvc+ nb_mhvc_temp) {\n\t\tfor (i=0; iprogram->streams); i++) {\n\t\t\tGF_M2TS_PES *es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, i);\n\t\t\tif ( !(es->flags & GF_M2TS_ES_IS_PES)) continue;\n\t\t\tif (es->depends_on_pid) continue;\n\n\t\t\tswitch (es->stream_type) {\n\t\t\tcase GF_M2TS_VIDEO_HEVC_TEMPORAL:\n\t\t\t\tes->depends_on_pid = 1;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_SHVC:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 1;\n\t\t\t\telse es->depends_on_pid = 2;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_SHVC_TEMPORAL:\n\t\t\t\tes->depends_on_pid = 3;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_MHVC:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 1;\n\t\t\t\telse es->depends_on_pid = 2;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_MHVC_TEMPORAL:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 2;\n\t\t\t\telse es->depends_on_pid = 3;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (nb_es) {\n\t\tu32 i;\n\n\t\t//translate hierarchy descriptors indexes into PIDs - check whether the PMT-index rules are the same for HEVC\n\t\tfor (i=0; iprogram->streams); i++) {\n\t\t\tGF_M2TS_PES *an_es = NULL;\n\t\t\tGF_M2TS_PES *es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, i);\n\t\t\tif ( !(es->flags & GF_M2TS_ES_IS_PES)) continue;\n\t\t\tif (!es->depends_on_pid) continue;\n\n\t\t\t//fixeme we are not always assured that hierarchy_layer_index matches the stream index...\n\t\t\t//+1 is because our first stream is the PMT\n\t\t\tan_es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, es->depends_on_pid);\n\t\t\tif (an_es) {\n\t\t\t\tes->depends_on_pid = an_es->pid;\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[M2TS] Wrong dependency index in hierarchy descriptor, assuming non-scalable stream\\n\"));\n\t\t\t\tes->depends_on_pid = 0;\n\t\t\t}\n\t\t}\n\n\t\tevt_type = (status&GF_M2TS_TABLE_FOUND) ? GF_M2TS_EVT_PMT_FOUND : GF_M2TS_EVT_PMT_UPDATE;\n\t\tif (ts->on_event) ts->on_event(ts, evt_type, pmt->program);\n\t} else {\n\t\t/* if we found no new ES it's simply a repeat of the PMT */\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PMT_REPEAT, pmt->program);\n\t}\n}","lang":"c","vul_type":"cwe-125","target_token_count":5704,"sven_meta":{"func_name":"gf_m2ts_process_pmt","file_name":"src/media_tools/mpegts.c","commit_link":"github.com/gpac/gpac/commit/2320eb73afba753b39b7147be91f7be7afc0eeb7","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#117-67dbf19f3053","input":"static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)\n{\n MpegEncContext *s = &ctx->m;\n\n if (get_bits_left(gb) <= 32)\n return 0;\n\n s->partitioned_frame = 0;\n s->decode_mb = mpeg4_decode_studio_mb;\n\n decode_smpte_tc(ctx, gb);\n\n skip_bits(gb, 10); /* temporal_reference */\n skip_bits(gb, 2); /* vop_structure */\n s->pict_type = get_bits(gb, 2) + AV_PICTURE_TYPE_I; /* vop_coding_type */\n if (get_bits1(gb)) { /* vop_coded */\n skip_bits1(gb); /* top_field_first */\n skip_bits1(gb); /* repeat_first_field */\n s->progressive_frame = get_bits1(gb) ^ 1; /* progressive_frame */\n }\n\n if (s->pict_type == AV_PICTURE_TYPE_I) {\n if (get_bits1(gb))\n reset_studio_dc_predictors(s);\n }\n\n if (ctx->shape != BIN_ONLY_SHAPE) {\n s->alternate_scan = get_bits1(gb);\n s->frame_pred_frame_dct = get_bits1(gb);\n s->dct_precision = get_bits(gb, 2);\n s->intra_dc_precision = get_bits(gb, 2);\n s->q_scale_type = get_bits1(gb);\n }\n\n if (s->alternate_scan) {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n } else {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n }\n\n mpeg4_load_default_matrices(s);\n\n next_start_code_studio(gb);\n extension_and_user_data(s, gb, 4);\n\n return 0;\n}","target":"static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)\n{\n MpegEncContext *s = &ctx->m;\n\n if (get_bits_left(gb) <= 32)\n return 0;\n\n s->partitioned_frame = 0;\n s->interlaced_dct = 0;\n s->decode_mb = mpeg4_decode_studio_mb;\n\n decode_smpte_tc(ctx, gb);\n\n skip_bits(gb, 10); /* temporal_reference */\n skip_bits(gb, 2); /* vop_structure */\n s->pict_type = get_bits(gb, 2) + AV_PICTURE_TYPE_I; /* vop_coding_type */\n if (get_bits1(gb)) { /* vop_coded */\n skip_bits1(gb); /* top_field_first */\n skip_bits1(gb); /* repeat_first_field */\n s->progressive_frame = get_bits1(gb) ^ 1; /* progressive_frame */\n }\n\n if (s->pict_type == AV_PICTURE_TYPE_I) {\n if (get_bits1(gb))\n reset_studio_dc_predictors(s);\n }\n\n if (ctx->shape != BIN_ONLY_SHAPE) {\n s->alternate_scan = get_bits1(gb);\n s->frame_pred_frame_dct = get_bits1(gb);\n s->dct_precision = get_bits(gb, 2);\n s->intra_dc_precision = get_bits(gb, 2);\n s->q_scale_type = get_bits1(gb);\n }\n\n if (s->alternate_scan) {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n } else {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n }\n\n mpeg4_load_default_matrices(s);\n\n next_start_code_studio(gb);\n extension_and_user_data(s, gb, 4);\n\n return 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":636,"sven_meta":{"func_name":"decode_studio_vop_header","file_name":"libavcodec/mpeg4videodec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/1f686d023b95219db933394a7704ad9aa5f01cbb","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#120-c9b958b6c6de","input":"static OPCODE_DESC* avr_op_analyze(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, CPU_MODEL *cpu) {\n\tOPCODE_DESC *opcode_desc;\n\tut16 ins = (buf[1] << 8) | buf[0];\n\tint fail;\n\tchar *t;\n\n\t// initialize op struct\n\tmemset (op, 0, sizeof (RAnalOp));\n\top->ptr = UT64_MAX;\n\top->val = UT64_MAX;\n\top->jump = UT64_MAX;\n\tr_strbuf_init (&op->esil);\n\n\t// process opcode\n\tfor (opcode_desc = opcodes; opcode_desc->handler; opcode_desc++) {\n\t\tif ((ins & opcode_desc->mask) == opcode_desc->selector) {\n\t\t\tfail = 0;\n\n\t\t\t// copy default cycles/size values\n\t\t\top->cycles = opcode_desc->cycles;\n\t\t\top->size = opcode_desc->size;\n\t\t\top->type = opcode_desc->type;\n\t\t\top->jump = UT64_MAX;\n\t\t\top->fail = UT64_MAX;\n\t\t\t// op->fail = addr + op->size;\n\t\t\top->addr = addr;\n\n\t\t\t// start void esil expression\n\t\t\tr_strbuf_setf (&op->esil, \"\");\n\n\t\t\t// handle opcode\n\t\t\topcode_desc->handler (anal, op, buf, len, &fail, cpu);\n\t\t\tif (fail) {\n\t\t\t\tgoto INVALID_OP;\n\t\t\t}\n\t\t\tif (op->cycles <= 0) {\n\t\t\t\t// eprintf (\"opcode %s @%\"PFMT64x\" returned 0 cycles.\\n\", opcode_desc->name, op->addr);\n\t\t\t\topcode_desc->cycles = 2;\n\t\t\t}\n\t\t\top->nopcode = (op->type == R_ANAL_OP_TYPE_UNK);\n\n\t\t\t// remove trailing coma (COMETE LA COMA)\n\t\t\tt = r_strbuf_get (&op->esil);\n\t\t\tif (t && strlen (t) > 1) {\n\t\t\t\tt += strlen (t) - 1;\n\t\t\t\tif (*t == ',') {\n\t\t\t\t\t*t = '\\0';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn opcode_desc;\n\t\t}\n\t}\n\n\t// ignore reserved opcodes (if they have not been caught by the previous loop)\n\tif ((ins & 0xff00) == 0xff00 && (ins & 0xf) > 7) {\n\t\tgoto INVALID_OP;\n\t}\n\nINVALID_OP:\n\t// An unknown or invalid option has appeared.\n\t// -- Throw pokeball!\n\top->family = R_ANAL_OP_FAMILY_UNKNOWN;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->addr = addr;\n\top->fail = UT64_MAX;\n\top->jump = UT64_MAX;\n\top->ptr = UT64_MAX;\n\top->val = UT64_MAX;\n\top->nopcode = 1;\n\top->cycles = 1;\n\top->size = 2;\n\t// launch esil trap (for communicating upper layers about this weird\n\t// and stinky situation\n\tr_strbuf_set (&op->esil, \"1,$\");\n\n\treturn NULL;\n}","target":"static OPCODE_DESC* avr_op_analyze(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, CPU_MODEL *cpu) {\n\tOPCODE_DESC *opcode_desc;\n\tif (len < 2) {\n\t\treturn NULL;\n\t}\n\tut16 ins = (buf[1] << 8) | buf[0];\n\tint fail;\n\tchar *t;\n\n\t// initialize op struct\n\tmemset (op, 0, sizeof (RAnalOp));\n\top->ptr = UT64_MAX;\n\top->val = UT64_MAX;\n\top->jump = UT64_MAX;\n\tr_strbuf_init (&op->esil);\n\n\t// process opcode\n\tfor (opcode_desc = opcodes; opcode_desc->handler; opcode_desc++) {\n\t\tif ((ins & opcode_desc->mask) == opcode_desc->selector) {\n\t\t\tfail = 0;\n\n\t\t\t// copy default cycles/size values\n\t\t\top->cycles = opcode_desc->cycles;\n\t\t\top->size = opcode_desc->size;\n\t\t\top->type = opcode_desc->type;\n\t\t\top->jump = UT64_MAX;\n\t\t\top->fail = UT64_MAX;\n\t\t\t// op->fail = addr + op->size;\n\t\t\top->addr = addr;\n\n\t\t\t// start void esil expression\n\t\t\tr_strbuf_setf (&op->esil, \"\");\n\n\t\t\t// handle opcode\n\t\t\topcode_desc->handler (anal, op, buf, len, &fail, cpu);\n\t\t\tif (fail) {\n\t\t\t\tgoto INVALID_OP;\n\t\t\t}\n\t\t\tif (op->cycles <= 0) {\n\t\t\t\t// eprintf (\"opcode %s @%\"PFMT64x\" returned 0 cycles.\\n\", opcode_desc->name, op->addr);\n\t\t\t\topcode_desc->cycles = 2;\n\t\t\t}\n\t\t\top->nopcode = (op->type == R_ANAL_OP_TYPE_UNK);\n\n\t\t\t// remove trailing coma (COMETE LA COMA)\n\t\t\tt = r_strbuf_get (&op->esil);\n\t\t\tif (t && strlen (t) > 1) {\n\t\t\t\tt += strlen (t) - 1;\n\t\t\t\tif (*t == ',') {\n\t\t\t\t\t*t = '\\0';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn opcode_desc;\n\t\t}\n\t}\n\n\t// ignore reserved opcodes (if they have not been caught by the previous loop)\n\tif ((ins & 0xff00) == 0xff00 && (ins & 0xf) > 7) {\n\t\tgoto INVALID_OP;\n\t}\n\nINVALID_OP:\n\t// An unknown or invalid option has appeared.\n\t// -- Throw pokeball!\n\top->family = R_ANAL_OP_FAMILY_UNKNOWN;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->addr = addr;\n\top->fail = UT64_MAX;\n\top->jump = UT64_MAX;\n\top->ptr = UT64_MAX;\n\top->val = UT64_MAX;\n\top->nopcode = 1;\n\top->cycles = 1;\n\top->size = 2;\n\t// launch esil trap (for communicating upper layers about this weird\n\t// and stinky situation\n\tr_strbuf_set (&op->esil, \"1,$\");\n\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-125","target_token_count":691,"sven_meta":{"func_name":"avr_op_analyze","file_name":"libr/anal/p/anal_avr.c","commit_link":"github.com/radare/radare2/commit/b35530fa0681b27eba084de5527037ebfb397422","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#123-8dcf59aad1d0","input":"static MagickBooleanType ReadPSDChannelPixels(Image *image,\n const size_t channels,const size_t row,const ssize_t type,\n const unsigned char *pixels,ExceptionInfo *exception)\n{\n Quantum\n pixel;\n\n register const unsigned char\n *p;\n\n register Quantum\n *q;\n\n register ssize_t\n x;\n\n size_t\n packet_size;\n\n unsigned short\n nibble;\n\n p=pixels;\n q=GetAuthenticPixels(image,0,row,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n return MagickFalse;\n packet_size=GetPSDPacketSize(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (packet_size == 1)\n pixel=ScaleCharToQuantum(*p++);\n else\n {\n p=PushShortPixel(MSBEndian,p,&nibble);\n pixel=ScaleShortToQuantum(nibble);\n }\n switch (type)\n {\n case -1:\n {\n SetPixelAlpha(image,pixel,q);\n break;\n }\n case -2:\n case 0:\n {\n SetPixelRed(image,pixel,q);\n if (channels == 1 || type == -2)\n SetPixelGray(image,pixel,q);\n if (image->storage_class == PseudoClass)\n {\n if (packet_size == 1)\n SetPixelIndex(image,ScaleQuantumToChar(pixel),q);\n else\n SetPixelIndex(image,ScaleQuantumToShort(pixel),q);\n SetPixelViaPixelInfo(image,image->colormap+(ssize_t)\n ConstrainColormapIndex(image,GetPixelIndex(image,q),exception),q);\n if (image->depth == 1)\n {\n ssize_t\n bit,\n number_bits;\n \n number_bits=image->columns-x;\n if (number_bits > 8)\n number_bits=8;\n for (bit=0; bit < number_bits; bit++)\n {\n SetPixelIndex(image,(((unsigned char) pixel) &\n (0x01 << (7-bit))) != 0 ? 0 : 255,q);\n SetPixelViaPixelInfo(image,image->colormap+(ssize_t)\n GetPixelIndex(image,q),q);\n q+=GetPixelChannels(image);\n x++;\n }\n x--;\n continue;\n }\n }\n break;\n }\n case 1:\n {\n if (image->storage_class == PseudoClass)\n SetPixelAlpha(image,pixel,q);\n else\n SetPixelGreen(image,pixel,q);\n break;\n }\n case 2:\n {\n if (image->storage_class == PseudoClass)\n SetPixelAlpha(image,pixel,q);\n else\n SetPixelBlue(image,pixel,q);\n break;\n }\n case 3:\n {\n if (image->colorspace == CMYKColorspace)\n SetPixelBlack(image,pixel,q);\n else\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,pixel,q);\n break;\n }\n case 4:\n {\n if ((IssRGBCompatibleColorspace(image->colorspace) != MagickFalse) &&\n (channels > 3))\n break;\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,pixel,q);\n break;\n }\n default:\n break;\n }\n q+=GetPixelChannels(image);\n }\n return(SyncAuthenticPixels(image,exception));\n}","target":"static MagickBooleanType ReadPSDChannelPixels(Image *image,\n const size_t channels,const size_t row,const ssize_t type,\n const unsigned char *pixels,ExceptionInfo *exception)\n{\n Quantum\n pixel;\n\n register const unsigned char\n *p;\n\n register Quantum\n *q;\n\n register ssize_t\n x;\n\n size_t\n packet_size;\n\n unsigned short\n nibble;\n\n p=pixels;\n q=GetAuthenticPixels(image,0,row,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n return MagickFalse;\n packet_size=GetPSDPacketSize(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (packet_size == 1)\n pixel=ScaleCharToQuantum(*p++);\n else\n {\n p=PushShortPixel(MSBEndian,p,&nibble);\n pixel=ScaleShortToQuantum(nibble);\n }\n switch (type)\n {\n case -1:\n {\n SetPixelAlpha(image,pixel,q);\n break;\n }\n case -2:\n case 0:\n {\n SetPixelRed(image,pixel,q);\n if (channels == 1 || type == -2)\n SetPixelGray(image,pixel,q);\n if (image->storage_class == PseudoClass)\n {\n if (packet_size == 1)\n SetPixelIndex(image,ScaleQuantumToChar(pixel),q);\n else\n SetPixelIndex(image,ScaleQuantumToShort(pixel),q);\n SetPixelViaPixelInfo(image,image->colormap+(ssize_t)\n ConstrainColormapIndex(image,GetPixelIndex(image,q),exception),q);\n if (image->depth == 1)\n {\n ssize_t\n bit,\n number_bits;\n \n number_bits=image->columns-x;\n if (number_bits > 8)\n number_bits=8;\n for (bit=0; bit < number_bits; bit++)\n {\n SetPixelIndex(image,(((unsigned char) pixel) &\n (0x01 << (7-bit))) != 0 ? 0 : 255,q);\n SetPixelViaPixelInfo(image,image->colormap+(ssize_t)\n ConstrainColormapIndex(image,GetPixelIndex(image,q),\n exception),q);\n q+=GetPixelChannels(image);\n x++;\n }\n x--;\n continue;\n }\n }\n break;\n }\n case 1:\n {\n if (image->storage_class == PseudoClass)\n SetPixelAlpha(image,pixel,q);\n else\n SetPixelGreen(image,pixel,q);\n break;\n }\n case 2:\n {\n if (image->storage_class == PseudoClass)\n SetPixelAlpha(image,pixel,q);\n else\n SetPixelBlue(image,pixel,q);\n break;\n }\n case 3:\n {\n if (image->colorspace == CMYKColorspace)\n SetPixelBlack(image,pixel,q);\n else\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,pixel,q);\n break;\n }\n case 4:\n {\n if ((IssRGBCompatibleColorspace(image->colorspace) != MagickFalse) &&\n (channels > 3))\n break;\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,pixel,q);\n break;\n }\n default:\n break;\n }\n q+=GetPixelChannels(image);\n }\n return(SyncAuthenticPixels(image,exception));\n}","lang":"c","vul_type":"cwe-125","target_token_count":774,"sven_meta":{"func_name":"ReadPSDChannelPixels","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/e14fd0a2801f73bdc123baf4fbab97dec55919eb","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#124-e4786a824bbc","input":"static int ape_decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame_ptr, AVPacket *avpkt)\n{\n AVFrame *frame = data;\n const uint8_t *buf = avpkt->data;\n APEContext *s = avctx->priv_data;\n uint8_t *sample8;\n int16_t *sample16;\n int32_t *sample24;\n int i, ch, ret;\n int blockstodecode;\n\n /* this should never be negative, but bad things will happen if it is, so\n check it just to make sure. */\n av_assert0(s->samples >= 0);\n\n if(!s->samples){\n uint32_t nblocks, offset;\n int buf_size;\n\n if (!avpkt->size) {\n *got_frame_ptr = 0;\n return 0;\n }\n if (avpkt->size < 8) {\n av_log(avctx, AV_LOG_ERROR, \"Packet is too small\\n\");\n return AVERROR_INVALIDDATA;\n }\n buf_size = avpkt->size & ~3;\n if (buf_size != avpkt->size) {\n av_log(avctx, AV_LOG_WARNING, \"packet size is not a multiple of 4. \"\n \"extra bytes at the end will be skipped.\\n\");\n }\n if (s->fileversion < 3950) // previous versions overread two bytes\n buf_size += 2;\n av_fast_padded_malloc(&s->data, &s->data_size, buf_size);\n if (!s->data)\n return AVERROR(ENOMEM);\n s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf,\n buf_size >> 2);\n memset(s->data + (buf_size & ~3), 0, buf_size & 3);\n s->ptr = s->data;\n s->data_end = s->data + buf_size;\n\n nblocks = bytestream_get_be32(&s->ptr);\n offset = bytestream_get_be32(&s->ptr);\n if (s->fileversion >= 3900) {\n if (offset > 3) {\n av_log(avctx, AV_LOG_ERROR, \"Incorrect offset passed\\n\");\n s->data = NULL;\n return AVERROR_INVALIDDATA;\n }\n if (s->data_end - s->ptr < offset) {\n av_log(avctx, AV_LOG_ERROR, \"Packet is too small\\n\");\n return AVERROR_INVALIDDATA;\n }\n s->ptr += offset;\n } else {\n if ((ret = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0)\n return ret;\n if (s->fileversion > 3800)\n skip_bits_long(&s->gb, offset * 8);\n else\n skip_bits_long(&s->gb, offset);\n }\n\n if (!nblocks || nblocks > INT_MAX) {\n av_log(avctx, AV_LOG_ERROR, \"Invalid sample count: %\"PRIu32\".\\n\",\n nblocks);\n return AVERROR_INVALIDDATA;\n }\n\n /* Initialize the frame decoder */\n if (init_frame_decoder(s) < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Error reading frame header\\n\");\n return AVERROR_INVALIDDATA;\n }\n s->samples = nblocks;\n }\n\n if (!s->data) {\n *got_frame_ptr = 0;\n return avpkt->size;\n }\n\n blockstodecode = FFMIN(s->blocks_per_loop, s->samples);\n // for old files coefficients were not interleaved,\n // so we need to decode all of them at once\n if (s->fileversion < 3930)\n blockstodecode = s->samples;\n\n /* reallocate decoded sample buffer if needed */\n av_fast_malloc(&s->decoded_buffer, &s->decoded_size,\n 2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer));\n if (!s->decoded_buffer)\n return AVERROR(ENOMEM);\n memset(s->decoded_buffer, 0, s->decoded_size);\n s->decoded[0] = s->decoded_buffer;\n s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8);\n\n /* get output buffer */\n frame->nb_samples = blockstodecode;\n if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)\n return ret;\n\n s->error=0;\n\n if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO))\n ape_unpack_mono(s, blockstodecode);\n else\n ape_unpack_stereo(s, blockstodecode);\n emms_c();\n\n if (s->error) {\n s->samples=0;\n av_log(avctx, AV_LOG_ERROR, \"Error decoding frame\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n switch (s->bps) {\n case 8:\n for (ch = 0; ch < s->channels; ch++) {\n sample8 = (uint8_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff;\n }\n break;\n case 16:\n for (ch = 0; ch < s->channels; ch++) {\n sample16 = (int16_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample16++ = s->decoded[ch][i];\n }\n break;\n case 24:\n for (ch = 0; ch < s->channels; ch++) {\n sample24 = (int32_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample24++ = s->decoded[ch][i] << 8;\n }\n break;\n }\n\n s->samples -= blockstodecode;\n\n *got_frame_ptr = 1;\n\n return !s->samples ? avpkt->size : 0;\n}","target":"static int ape_decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame_ptr, AVPacket *avpkt)\n{\n AVFrame *frame = data;\n const uint8_t *buf = avpkt->data;\n APEContext *s = avctx->priv_data;\n uint8_t *sample8;\n int16_t *sample16;\n int32_t *sample24;\n int i, ch, ret;\n int blockstodecode;\n uint64_t decoded_buffer_size;\n\n /* this should never be negative, but bad things will happen if it is, so\n check it just to make sure. */\n av_assert0(s->samples >= 0);\n\n if(!s->samples){\n uint32_t nblocks, offset;\n int buf_size;\n\n if (!avpkt->size) {\n *got_frame_ptr = 0;\n return 0;\n }\n if (avpkt->size < 8) {\n av_log(avctx, AV_LOG_ERROR, \"Packet is too small\\n\");\n return AVERROR_INVALIDDATA;\n }\n buf_size = avpkt->size & ~3;\n if (buf_size != avpkt->size) {\n av_log(avctx, AV_LOG_WARNING, \"packet size is not a multiple of 4. \"\n \"extra bytes at the end will be skipped.\\n\");\n }\n if (s->fileversion < 3950) // previous versions overread two bytes\n buf_size += 2;\n av_fast_padded_malloc(&s->data, &s->data_size, buf_size);\n if (!s->data)\n return AVERROR(ENOMEM);\n s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf,\n buf_size >> 2);\n memset(s->data + (buf_size & ~3), 0, buf_size & 3);\n s->ptr = s->data;\n s->data_end = s->data + buf_size;\n\n nblocks = bytestream_get_be32(&s->ptr);\n offset = bytestream_get_be32(&s->ptr);\n if (s->fileversion >= 3900) {\n if (offset > 3) {\n av_log(avctx, AV_LOG_ERROR, \"Incorrect offset passed\\n\");\n s->data = NULL;\n return AVERROR_INVALIDDATA;\n }\n if (s->data_end - s->ptr < offset) {\n av_log(avctx, AV_LOG_ERROR, \"Packet is too small\\n\");\n return AVERROR_INVALIDDATA;\n }\n s->ptr += offset;\n } else {\n if ((ret = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0)\n return ret;\n if (s->fileversion > 3800)\n skip_bits_long(&s->gb, offset * 8);\n else\n skip_bits_long(&s->gb, offset);\n }\n\n if (!nblocks || nblocks > INT_MAX / 2 / sizeof(*s->decoded_buffer) - 8) {\n av_log(avctx, AV_LOG_ERROR, \"Invalid sample count: %\"PRIu32\".\\n\",\n nblocks);\n return AVERROR_INVALIDDATA;\n }\n\n /* Initialize the frame decoder */\n if (init_frame_decoder(s) < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Error reading frame header\\n\");\n return AVERROR_INVALIDDATA;\n }\n s->samples = nblocks;\n }\n\n if (!s->data) {\n *got_frame_ptr = 0;\n return avpkt->size;\n }\n\n blockstodecode = FFMIN(s->blocks_per_loop, s->samples);\n // for old files coefficients were not interleaved,\n // so we need to decode all of them at once\n if (s->fileversion < 3930)\n blockstodecode = s->samples;\n\n /* reallocate decoded sample buffer if needed */\n decoded_buffer_size = 2LL * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer);\n av_assert0(decoded_buffer_size <= INT_MAX);\n av_fast_malloc(&s->decoded_buffer, &s->decoded_size, decoded_buffer_size);\n if (!s->decoded_buffer)\n return AVERROR(ENOMEM);\n memset(s->decoded_buffer, 0, s->decoded_size);\n s->decoded[0] = s->decoded_buffer;\n s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8);\n\n /* get output buffer */\n frame->nb_samples = blockstodecode;\n if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)\n return ret;\n\n s->error=0;\n\n if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO))\n ape_unpack_mono(s, blockstodecode);\n else\n ape_unpack_stereo(s, blockstodecode);\n emms_c();\n\n if (s->error) {\n s->samples=0;\n av_log(avctx, AV_LOG_ERROR, \"Error decoding frame\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n switch (s->bps) {\n case 8:\n for (ch = 0; ch < s->channels; ch++) {\n sample8 = (uint8_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff;\n }\n break;\n case 16:\n for (ch = 0; ch < s->channels; ch++) {\n sample16 = (int16_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample16++ = s->decoded[ch][i];\n }\n break;\n case 24:\n for (ch = 0; ch < s->channels; ch++) {\n sample24 = (int32_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample24++ = s->decoded[ch][i] << 8;\n }\n break;\n }\n\n s->samples -= blockstodecode;\n\n *got_frame_ptr = 1;\n\n return !s->samples ? avpkt->size : 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1439,"sven_meta":{"func_name":"ape_decode_frame","file_name":"libavcodec/apedec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/ba4beaf6149f7241c8bd85fe853318c2f6837ad0","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#125-c598b0848e91","input":"static MagickBooleanType WriteImageChannels(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n const MagickBooleanType separate,ExceptionInfo *exception)\n{\n size_t\n channels,\n packet_size;\n\n unsigned char\n *compact_pixels;\n\n /*\n Write uncompressed pixels as separate planes.\n */\n channels=1;\n packet_size=next_image->depth > 8UL ? 2UL : 1UL;\n compact_pixels=(unsigned char *) NULL;\n if (next_image->compression == RLECompression)\n {\n compact_pixels=(unsigned char *) AcquireQuantumMemory(2*channels*\n next_image->columns,packet_size*sizeof(*compact_pixels));\n if (compact_pixels == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n if (IsImageGray(next_image) != MagickFalse)\n {\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,GrayQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n GrayQuantum,MagickTrue,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,0,1);\n }\n else\n if (next_image->storage_class == PseudoClass)\n {\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,IndexQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n IndexQuantum,MagickTrue,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,0,1);\n }\n else\n {\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateCMYK(next_image,exception);\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,RedQuantum,exception);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,GreenQuantum,exception);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,BlueQuantum,exception);\n if (next_image->colorspace == CMYKColorspace)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,BlackQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n (void) SetImageProgress(image,SaveImagesTag,0,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n RedQuantum,MagickTrue,exception);\n (void) SetImageProgress(image,SaveImagesTag,1,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n GreenQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,2,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n BlueQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,3,6);\n if (next_image->colorspace == CMYKColorspace)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n BlackQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,4,6);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,5,6);\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateCMYK(next_image,exception);\n }\n if (next_image->compression == RLECompression)\n compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);\n return(MagickTrue);\n}","target":"static MagickBooleanType WriteImageChannels(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n const MagickBooleanType separate,ExceptionInfo *exception)\n{\n size_t\n channels,\n packet_size;\n\n unsigned char\n *compact_pixels;\n\n /*\n Write uncompressed pixels as separate planes.\n */\n channels=1;\n packet_size=next_image->depth > 8UL ? 2UL : 1UL;\n compact_pixels=(unsigned char *) NULL;\n if (next_image->compression == RLECompression)\n {\n compact_pixels=(unsigned char *) AcquireQuantumMemory((2*channels*\n next_image->columns)+1,packet_size*sizeof(*compact_pixels));\n if (compact_pixels == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n if (IsImageGray(next_image) != MagickFalse)\n {\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,GrayQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n GrayQuantum,MagickTrue,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,0,1);\n }\n else\n if (next_image->storage_class == PseudoClass)\n {\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,IndexQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n IndexQuantum,MagickTrue,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,0,1);\n }\n else\n {\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateCMYK(next_image,exception);\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,RedQuantum,exception);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,GreenQuantum,exception);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,BlueQuantum,exception);\n if (next_image->colorspace == CMYKColorspace)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,BlackQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n (void) SetImageProgress(image,SaveImagesTag,0,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n RedQuantum,MagickTrue,exception);\n (void) SetImageProgress(image,SaveImagesTag,1,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n GreenQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,2,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n BlueQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,3,6);\n if (next_image->colorspace == CMYKColorspace)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n BlackQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,4,6);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,5,6);\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateCMYK(next_image,exception);\n }\n if (next_image->compression == RLECompression)\n compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-125","target_token_count":1133,"sven_meta":{"func_name":"WriteImageChannels","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/6f1879d498bcc5cce12fe0c5decb8dbc0f608e5d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#127-0d6eab7eb5af","input":"static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tconst char *section_name = \"\";\n\tconst char *link_section_name = \"\";\n\tchar *end = NULL;\n\tElf_(Shdr) *link_shdr = NULL;\n\tut8 dfs[sizeof (Elf_(Verdef))] = {0};\n\tSdb *sdb;\n\tint cnt, i;\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn false;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (shdr->sh_size < 1) {\n\t\treturn false;\n\t}\n\tElf_(Verdef) *defs = calloc (shdr->sh_size, sizeof (char));\n\tif (!defs) {\n\t\treturn false;\n\t}\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (link_shdr && bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!defs) {\n\t\tbprintf (\"Warning: Cannot allocate memory (Check Elf_(Verdef))\\n\");\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tend = (char *)defs + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tfor (cnt = 0, i = 0; i >= 0 && cnt < shdr->sh_info && ((char *)defs + i < end); ++cnt) {\n\t\tSdb *sdb_verdef = sdb_new0 ();\n\t\tchar *vstart = ((char*)defs) + i;\n\t\tchar key[32] = {0};\n\t\tElf_(Verdef) *verdef = (Elf_(Verdef)*)vstart;\n\t\tElf_(Verdaux) aux = {0};\n\t\tint j = 0;\n\t\tint isum = 0;\n\n\t\tr_buf_read_at (bin->b, shdr->sh_offset + i, dfs, sizeof (Elf_(Verdef)));\n\t\tverdef->vd_version = READ16 (dfs, j)\n\t\tverdef->vd_flags = READ16 (dfs, j)\n\t\tverdef->vd_ndx = READ16 (dfs, j)\n\t\tverdef->vd_cnt = READ16 (dfs, j)\n\t\tverdef->vd_hash = READ32 (dfs, j)\n\t\tverdef->vd_aux = READ32 (dfs, j)\n\t\tverdef->vd_next = READ32 (dfs, j)\n\t\tvstart += verdef->vd_aux;\n\t\tif (vstart > end || vstart + sizeof (Elf_(Verdaux)) > end) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tj = 0;\n\t\taux.vda_name = READ32 (vstart, j)\n\t\taux.vda_next = READ32 (vstart, j)\n\n\t\tisum = i + verdef->vd_aux;\n\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tsdb_num_set (sdb_verdef, \"idx\", i, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_version\", verdef->vd_version, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_ndx\", verdef->vd_ndx, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_cnt\", verdef->vd_cnt, 0);\n\t\tsdb_set (sdb_verdef, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\tsdb_set (sdb_verdef, \"flags\", get_ver_flags (verdef->vd_flags), 0);\n\n\t\tfor (j = 1; j < verdef->vd_cnt; ++j) {\n\t\t\tint k;\n\t\t\tSdb *sdb_parent = sdb_new0 ();\n\t\t\tisum += aux.vda_next;\n\t\t\tvstart += aux.vda_next;\n\t\t\tif (vstart > end || vstart + sizeof(Elf_(Verdaux)) > end) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tk = 0;\n\t\t\taux.vda_name = READ32 (vstart, k)\n\t\t\taux.vda_next = READ32 (vstart, k)\n\t\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_parent, \"idx\", isum, 0);\n\t\t\tsdb_num_set (sdb_parent, \"parent\", j, 0);\n\t\t\tsdb_set (sdb_parent, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\t\tsnprintf (key, sizeof (key), \"parent%d\", j - 1);\n\t\t\tsdb_ns_set (sdb_verdef, key, sdb_parent);\n\t\t}\n\n\t\tsnprintf (key, sizeof (key), \"verdef%d\", cnt);\n\t\tsdb_ns_set (sdb, key, sdb_verdef);\n\t\tif (!verdef->vd_next) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tif ((st32)verdef->vd_next < 1) {\n\t\t\teprintf (\"Warning: Invalid vd_next in the ELF version\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += verdef->vd_next;\n\t}\n\tfree (defs);\n\treturn sdb;\nout_error:\n\tfree (defs);\n\tsdb_free (sdb);\n\treturn NULL;\n}","target":"static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tconst char *section_name = \"\";\n\tconst char *link_section_name = \"\";\n\tchar *end = NULL;\n\tElf_(Shdr) *link_shdr = NULL;\n\tut8 dfs[sizeof (Elf_(Verdef))] = {0};\n\tSdb *sdb;\n\tint cnt, i;\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn false;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (shdr->sh_size < 1) {\n\t\treturn false;\n\t}\n\tElf_(Verdef) *defs = calloc (shdr->sh_size, sizeof (char));\n\tif (!defs) {\n\t\treturn false;\n\t}\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (link_shdr && bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!defs) {\n\t\tbprintf (\"Warning: Cannot allocate memory (Check Elf_(Verdef))\\n\");\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tend = (char *)defs + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tfor (cnt = 0, i = 0; i >= 0 && cnt < shdr->sh_info && ((char *)defs + i < end); ++cnt) {\n\t\tSdb *sdb_verdef = sdb_new0 ();\n\t\tchar *vstart = ((char*)defs) + i;\n\t\tchar key[32] = {0};\n\t\tElf_(Verdef) *verdef = (Elf_(Verdef)*)vstart;\n\t\tElf_(Verdaux) aux = {0};\n\t\tint j = 0;\n\t\tint isum = 0;\n\n\t\tr_buf_read_at (bin->b, shdr->sh_offset + i, dfs, sizeof (Elf_(Verdef)));\n\t\tverdef->vd_version = READ16 (dfs, j)\n\t\tverdef->vd_flags = READ16 (dfs, j)\n\t\tverdef->vd_ndx = READ16 (dfs, j)\n\t\tverdef->vd_cnt = READ16 (dfs, j)\n\t\tverdef->vd_hash = READ32 (dfs, j)\n\t\tverdef->vd_aux = READ32 (dfs, j)\n\t\tverdef->vd_next = READ32 (dfs, j)\n\t\tint vdaux = verdef->vd_aux;\n\t\tif (vdaux < 1) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tvstart += vdaux;\n\t\tif (vstart > end || vstart + sizeof (Elf_(Verdaux)) > end) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tj = 0;\n\t\taux.vda_name = READ32 (vstart, j)\n\t\taux.vda_next = READ32 (vstart, j)\n\n\t\tisum = i + verdef->vd_aux;\n\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tsdb_num_set (sdb_verdef, \"idx\", i, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_version\", verdef->vd_version, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_ndx\", verdef->vd_ndx, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_cnt\", verdef->vd_cnt, 0);\n\t\tsdb_set (sdb_verdef, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\tsdb_set (sdb_verdef, \"flags\", get_ver_flags (verdef->vd_flags), 0);\n\n\t\tfor (j = 1; j < verdef->vd_cnt; ++j) {\n\t\t\tint k;\n\t\t\tSdb *sdb_parent = sdb_new0 ();\n\t\t\tisum += aux.vda_next;\n\t\t\tvstart += aux.vda_next;\n\t\t\tif (vstart > end || vstart + sizeof(Elf_(Verdaux)) > end) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tk = 0;\n\t\t\taux.vda_name = READ32 (vstart, k)\n\t\t\taux.vda_next = READ32 (vstart, k)\n\t\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_parent, \"idx\", isum, 0);\n\t\t\tsdb_num_set (sdb_parent, \"parent\", j, 0);\n\t\t\tsdb_set (sdb_parent, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\t\tsnprintf (key, sizeof (key), \"parent%d\", j - 1);\n\t\t\tsdb_ns_set (sdb_verdef, key, sdb_parent);\n\t\t}\n\n\t\tsnprintf (key, sizeof (key), \"verdef%d\", cnt);\n\t\tsdb_ns_set (sdb, key, sdb_verdef);\n\t\tif (!verdef->vd_next) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tif ((st32)verdef->vd_next < 1) {\n\t\t\teprintf (\"Warning: Invalid vd_next in the ELF version\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += verdef->vd_next;\n\t}\n\tfree (defs);\n\treturn sdb;\nout_error:\n\tfree (defs);\n\tsdb_free (sdb);\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1443,"sven_meta":{"func_name":"store_versioninfo_gnu_verdef","file_name":"libr/bin/format/elf/elf.c","commit_link":"github.com/radare/radare2/commit/44ded3ff35b8264f54b5a900cab32ec489d9e5b9","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#129-82c7809a5755","input":"BOOL license_read_new_or_upgrade_license_packet(rdpLicense* license, wStream* s)\n{\n\tUINT32 os_major;\n\tUINT32 os_minor;\n\tUINT32 cbScope, cbCompanyName, cbProductId, cbLicenseInfo;\n\twStream* licenseStream = NULL;\n\tBOOL ret = FALSE;\n\tBYTE computedMac[16];\n\tLICENSE_BLOB* calBlob;\n\n\tDEBUG_LICENSE(\"Receiving Server New/Upgrade License Packet\");\n\n\tcalBlob = license_new_binary_blob(BB_DATA_BLOB);\n\tif (!calBlob)\n\t\treturn FALSE;\n\n\t/* EncryptedLicenseInfo */\n\tif (!license_read_encrypted_blob(license, s, calBlob))\n\t\tgoto out_free_blob;\n\n\t/* compute MAC and check it */\n\tif (Stream_GetRemainingLength(s) < 16)\n\t\tgoto out_free_blob;\n\n\tif (!security_mac_data(license->MacSaltKey, calBlob->data, calBlob->length, computedMac))\n\t\tgoto out_free_blob;\n\n\tif (memcmp(computedMac, Stream_Pointer(s), sizeof(computedMac)) != 0)\n\t{\n\t\tWLog_ERR(TAG, \"new or upgrade license MAC mismatch\");\n\t\tgoto out_free_blob;\n\t}\n\n\tif (!Stream_SafeSeek(s, 16))\n\t\tgoto out_free_blob;\n\n\tlicenseStream = Stream_New(calBlob->data, calBlob->length);\n\tif (!licenseStream)\n\t\tgoto out_free_blob;\n\n\tStream_Read_UINT16(licenseStream, os_minor);\n\tStream_Read_UINT16(licenseStream, os_major);\n\n\t/* Scope */\n\tStream_Read_UINT32(licenseStream, cbScope);\n\tif (Stream_GetRemainingLength(licenseStream) < cbScope)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Scope:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbScope);\n#endif\n\tStream_Seek(licenseStream, cbScope);\n\n\t/* CompanyName */\n\tStream_Read_UINT32(licenseStream, cbCompanyName);\n\tif (Stream_GetRemainingLength(licenseStream) < cbCompanyName)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Company name:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbCompanyName);\n#endif\n\tStream_Seek(licenseStream, cbCompanyName);\n\n\t/* productId */\n\tStream_Read_UINT32(licenseStream, cbProductId);\n\tif (Stream_GetRemainingLength(licenseStream) < cbProductId)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Product id:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbProductId);\n#endif\n\tStream_Seek(licenseStream, cbProductId);\n\n\t/* licenseInfo */\n\tStream_Read_UINT32(licenseStream, cbLicenseInfo);\n\tif (Stream_GetRemainingLength(licenseStream) < cbLicenseInfo)\n\t\tgoto out_free_stream;\n\n\tlicense->state = LICENSE_STATE_COMPLETED;\n\n\tret = TRUE;\n\tif (!license->rdp->settings->OldLicenseBehaviour)\n\t\tret = saveCal(license->rdp->settings, Stream_Pointer(licenseStream), cbLicenseInfo,\n\t\t license->rdp->settings->ClientHostname);\n\nout_free_stream:\n\tStream_Free(licenseStream, FALSE);\nout_free_blob:\n\tlicense_free_binary_blob(calBlob);\n\treturn ret;\n}","target":"BOOL license_read_new_or_upgrade_license_packet(rdpLicense* license, wStream* s)\n{\n\tUINT32 os_major;\n\tUINT32 os_minor;\n\tUINT32 cbScope, cbCompanyName, cbProductId, cbLicenseInfo;\n\twStream* licenseStream = NULL;\n\tBOOL ret = FALSE;\n\tBYTE computedMac[16];\n\tLICENSE_BLOB* calBlob;\n\n\tDEBUG_LICENSE(\"Receiving Server New/Upgrade License Packet\");\n\n\tcalBlob = license_new_binary_blob(BB_DATA_BLOB);\n\tif (!calBlob)\n\t\treturn FALSE;\n\n\t/* EncryptedLicenseInfo */\n\tif (!license_read_encrypted_blob(license, s, calBlob))\n\t\tgoto out_free_blob;\n\n\t/* compute MAC and check it */\n\tif (Stream_GetRemainingLength(s) < 16)\n\t\tgoto out_free_blob;\n\n\tif (!security_mac_data(license->MacSaltKey, calBlob->data, calBlob->length, computedMac))\n\t\tgoto out_free_blob;\n\n\tif (memcmp(computedMac, Stream_Pointer(s), sizeof(computedMac)) != 0)\n\t{\n\t\tWLog_ERR(TAG, \"new or upgrade license MAC mismatch\");\n\t\tgoto out_free_blob;\n\t}\n\n\tif (!Stream_SafeSeek(s, 16))\n\t\tgoto out_free_blob;\n\n\tlicenseStream = Stream_New(calBlob->data, calBlob->length);\n\tif (!licenseStream)\n\t\tgoto out_free_blob;\n\n\tif (Stream_GetRemainingLength(licenseStream) < 8)\n\t\tgoto out_free_stream;\n\n\tStream_Read_UINT16(licenseStream, os_minor);\n\tStream_Read_UINT16(licenseStream, os_major);\n\n\t/* Scope */\n\tStream_Read_UINT32(licenseStream, cbScope);\n\tif (Stream_GetRemainingLength(licenseStream) < cbScope)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Scope:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbScope);\n#endif\n\tStream_Seek(licenseStream, cbScope);\n\n\t/* CompanyName */\n\tif (Stream_GetRemainingLength(licenseStream) < 4)\n\t\tgoto out_free_stream;\n\tStream_Read_UINT32(licenseStream, cbCompanyName);\n\tif (Stream_GetRemainingLength(licenseStream) < cbCompanyName)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Company name:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbCompanyName);\n#endif\n\tStream_Seek(licenseStream, cbCompanyName);\n\n\t/* productId */\n\tif (Stream_GetRemainingLength(licenseStream) < 4)\n\t\tgoto out_free_stream;\n\tStream_Read_UINT32(licenseStream, cbProductId);\n\tif (Stream_GetRemainingLength(licenseStream) < cbProductId)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Product id:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbProductId);\n#endif\n\tStream_Seek(licenseStream, cbProductId);\n\n\t/* licenseInfo */\n\tif (Stream_GetRemainingLength(licenseStream) < 4)\n\t\tgoto out_free_stream;\n\tStream_Read_UINT32(licenseStream, cbLicenseInfo);\n\tif (Stream_GetRemainingLength(licenseStream) < cbLicenseInfo)\n\t\tgoto out_free_stream;\n\n\tlicense->state = LICENSE_STATE_COMPLETED;\n\n\tret = TRUE;\n\tif (!license->rdp->settings->OldLicenseBehaviour)\n\t\tret = saveCal(license->rdp->settings, Stream_Pointer(licenseStream), cbLicenseInfo,\n\t\t license->rdp->settings->ClientHostname);\n\nout_free_stream:\n\tStream_Free(licenseStream, FALSE);\nout_free_blob:\n\tlicense_free_binary_blob(calBlob);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-125","target_token_count":778,"sven_meta":{"func_name":"license_read_new_or_upgrade_license_packet","file_name":"libfreerdp/core/license.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/6ade7b4cbfd71c54b3d724e8f2d6ac76a58e879a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-078#1-2189502f1920","input":" def _map_vol_to_host(self, volume_name, host_name):\n \"\"\"Create a mapping between a volume to a host.\"\"\"\n\n LOG.debug(_('enter: _map_vol_to_host: volume %(volume_name)s to '\n 'host %(host_name)s')\n % {'volume_name': volume_name, 'host_name': host_name})\n\n # Check if this volume is already mapped to this host\n mapping_data = self._get_hostvdisk_mappings(host_name)\n\n mapped_flag = False\n result_lun = '-1'\n if volume_name in mapping_data:\n mapped_flag = True\n result_lun = mapping_data[volume_name]['SCSI_id']\n else:\n lun_used = [int(v['SCSI_id']) for v in mapping_data.values()]\n lun_used.sort()\n # Assume all luns are taken to this point, and then try to find\n # an unused one\n result_lun = str(len(lun_used))\n for index, n in enumerate(lun_used):\n if n > index:\n result_lun = str(index)\n break\n\n # Volume is not mapped to host, create a new LUN\n if not mapped_flag:\n ssh_cmd = ('svctask mkvdiskhostmap -host %(host_name)s -scsi '\n '%(result_lun)s %(volume_name)s' %\n {'host_name': host_name,\n 'result_lun': result_lun,\n 'volume_name': volume_name})\n out, err = self._run_ssh(ssh_cmd, check_exit_code=False)\n if err and err.startswith('CMMVC6071E'):\n if not self.configuration.storwize_svc_multihostmap_enabled:\n LOG.error(_('storwize_svc_multihostmap_enabled is set '\n 'to False, Not allow multi host mapping'))\n exception_msg = 'CMMVC6071E The VDisk-to-host mapping '\\\n 'was not created because the VDisk is '\\\n 'already mapped to a host.\\n\"'\n raise exception.CinderException(data=exception_msg)\n ssh_cmd = ssh_cmd.replace('mkvdiskhostmap',\n 'mkvdiskhostmap -force')\n # try to map one volume to multiple hosts\n out, err = self._run_ssh(ssh_cmd)\n LOG.warn(_('volume %s mapping to multi host') % volume_name)\n self._assert_ssh_return('successfully created' in out,\n '_map_vol_to_host', ssh_cmd, out, err)\n else:\n self._assert_ssh_return('successfully created' in out,\n '_map_vol_to_host', ssh_cmd, out, err)\n LOG.debug(_('leave: _map_vol_to_host: LUN %(result_lun)s, volume '\n '%(volume_name)s, host %(host_name)s') %\n {'result_lun': result_lun,\n 'volume_name': volume_name,\n 'host_name': host_name})\n return result_lun","target":" def _map_vol_to_host(self, volume_name, host_name):\n \"\"\"Create a mapping between a volume to a host.\"\"\"\n\n LOG.debug(_('enter: _map_vol_to_host: volume %(volume_name)s to '\n 'host %(host_name)s')\n % {'volume_name': volume_name, 'host_name': host_name})\n\n # Check if this volume is already mapped to this host\n mapping_data = self._get_hostvdisk_mappings(host_name)\n\n mapped_flag = False\n result_lun = '-1'\n if volume_name in mapping_data:\n mapped_flag = True\n result_lun = mapping_data[volume_name]['SCSI_id']\n else:\n lun_used = [int(v['SCSI_id']) for v in mapping_data.values()]\n lun_used.sort()\n # Assume all luns are taken to this point, and then try to find\n # an unused one\n result_lun = str(len(lun_used))\n for index, n in enumerate(lun_used):\n if n > index:\n result_lun = str(index)\n break\n\n # Volume is not mapped to host, create a new LUN\n if not mapped_flag:\n ssh_cmd = ['svctask', 'mkvdiskhostmap', '-host', host_name,\n '-scsi', result_lun, volume_name]\n out, err = self._run_ssh(ssh_cmd, check_exit_code=False)\n if err and err.startswith('CMMVC6071E'):\n if not self.configuration.storwize_svc_multihostmap_enabled:\n LOG.error(_('storwize_svc_multihostmap_enabled is set '\n 'to False, Not allow multi host mapping'))\n exception_msg = 'CMMVC6071E The VDisk-to-host mapping '\\\n 'was not created because the VDisk is '\\\n 'already mapped to a host.\\n\"'\n raise exception.CinderException(data=exception_msg)\n\n for i in range(len(ssh_cmd)):\n if ssh_cmd[i] == 'mkvdiskhostmap':\n ssh_cmd.insert(i + 1, '-force')\n\n # try to map one volume to multiple hosts\n out, err = self._run_ssh(ssh_cmd)\n LOG.warn(_('volume %s mapping to multi host') % volume_name)\n self._assert_ssh_return('successfully created' in out,\n '_map_vol_to_host', ssh_cmd, out, err)\n else:\n self._assert_ssh_return('successfully created' in out,\n '_map_vol_to_host', ssh_cmd, out, err)\n LOG.debug(_('leave: _map_vol_to_host: LUN %(result_lun)s, volume '\n '%(volume_name)s, host %(host_name)s') %\n {'result_lun': result_lun,\n 'volume_name': volume_name,\n 'host_name': host_name})\n return result_lun","lang":"python","vul_type":"cwe-078","target_token_count":614,"sven_meta":{"func_name":"_map_vol_to_host","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#11-2a41940b604f","input":" def do_setup(self, ctxt):\n \"\"\"Check that we have all configuration details from the storage.\"\"\"\n\n LOG.debug(_('enter: do_setup'))\n self._context = ctxt\n\n # Validate that the pool exists\n ssh_cmd = 'svcinfo lsmdiskgrp -delim ! -nohdr'\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), 'do_setup',\n ssh_cmd, out, err)\n search_text = '!%s!' % self.configuration.storwize_svc_volpool_name\n if search_text not in out:\n raise exception.InvalidInput(\n reason=(_('pool %s doesn\\'t exist')\n % self.configuration.storwize_svc_volpool_name))\n\n # Check if compression is supported\n self._compression_enabled = False\n try:\n ssh_cmd = 'svcinfo lslicense -delim !'\n out, err = self._run_ssh(ssh_cmd)\n license_lines = out.strip().split('\\n')\n for license_line in license_lines:\n name, foo, value = license_line.partition('!')\n if name in ('license_compression_enclosures',\n 'license_compression_capacity') and value != '0':\n self._compression_enabled = True\n break\n except exception.ProcessExecutionError:\n LOG.exception(_('Failed to get license information.'))\n\n # Get the iSCSI and FC names of the Storwize/SVC nodes\n ssh_cmd = 'svcinfo lsnode -delim !'\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), 'do_setup',\n ssh_cmd, out, err)\n\n nodes = out.strip().split('\\n')\n self._assert_ssh_return(len(nodes),\n 'do_setup', ssh_cmd, out, err)\n header = nodes.pop(0)\n for node_line in nodes:\n try:\n node_data = self._get_hdr_dic(header, node_line, '!')\n except exception.VolumeBackendAPIException:\n with excutils.save_and_reraise_exception():\n self._log_cli_output_error('do_setup',\n ssh_cmd, out, err)\n node = {}\n try:\n node['id'] = node_data['id']\n node['name'] = node_data['name']\n node['IO_group'] = node_data['IO_group_id']\n node['iscsi_name'] = node_data['iscsi_name']\n node['WWNN'] = node_data['WWNN']\n node['status'] = node_data['status']\n node['WWPN'] = []\n node['ipv4'] = []\n node['ipv6'] = []\n node['enabled_protocols'] = []\n if node['status'] == 'online':\n self._storage_nodes[node['id']] = node\n except KeyError:\n self._handle_keyerror('lsnode', header)\n\n # Get the iSCSI IP addresses and WWPNs of the Storwize/SVC nodes\n self._get_iscsi_ip_addrs()\n self._get_fc_wwpns()\n\n # For each node, check what connection modes it supports. Delete any\n # nodes that do not support any types (may be partially configured).\n to_delete = []\n for k, node in self._storage_nodes.iteritems():\n if ((len(node['ipv4']) or len(node['ipv6']))\n and len(node['iscsi_name'])):\n node['enabled_protocols'].append('iSCSI')\n self._enabled_protocols.add('iSCSI')\n if len(node['WWPN']):\n node['enabled_protocols'].append('FC')\n self._enabled_protocols.add('FC')\n if not len(node['enabled_protocols']):\n to_delete.append(k)\n\n for delkey in to_delete:\n del self._storage_nodes[delkey]\n\n # Make sure we have at least one node configured\n self._driver_assert(len(self._storage_nodes),\n _('do_setup: No configured nodes'))\n\n LOG.debug(_('leave: do_setup'))","target":" def do_setup(self, ctxt):\n \"\"\"Check that we have all configuration details from the storage.\"\"\"\n\n LOG.debug(_('enter: do_setup'))\n self._context = ctxt\n\n # Validate that the pool exists\n ssh_cmd = ['svcinfo', 'lsmdiskgrp', '-delim', '!', '-nohdr']\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), 'do_setup',\n ssh_cmd, out, err)\n search_text = '!%s!' % self.configuration.storwize_svc_volpool_name\n if search_text not in out:\n raise exception.InvalidInput(\n reason=(_('pool %s doesn\\'t exist')\n % self.configuration.storwize_svc_volpool_name))\n\n # Check if compression is supported\n self._compression_enabled = False\n try:\n ssh_cmd = ['svcinfo', 'lslicense', '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n license_lines = out.strip().split('\\n')\n for license_line in license_lines:\n name, foo, value = license_line.partition('!')\n if name in ('license_compression_enclosures',\n 'license_compression_capacity') and value != '0':\n self._compression_enabled = True\n break\n except exception.ProcessExecutionError:\n LOG.exception(_('Failed to get license information.'))\n\n # Get the iSCSI and FC names of the Storwize/SVC nodes\n ssh_cmd = ['svcinfo', 'lsnode', '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), 'do_setup',\n ssh_cmd, out, err)\n\n nodes = out.strip().split('\\n')\n self._assert_ssh_return(len(nodes),\n 'do_setup', ssh_cmd, out, err)\n header = nodes.pop(0)\n for node_line in nodes:\n try:\n node_data = self._get_hdr_dic(header, node_line, '!')\n except exception.VolumeBackendAPIException:\n with excutils.save_and_reraise_exception():\n self._log_cli_output_error('do_setup',\n ssh_cmd, out, err)\n node = {}\n try:\n node['id'] = node_data['id']\n node['name'] = node_data['name']\n node['IO_group'] = node_data['IO_group_id']\n node['iscsi_name'] = node_data['iscsi_name']\n node['WWNN'] = node_data['WWNN']\n node['status'] = node_data['status']\n node['WWPN'] = []\n node['ipv4'] = []\n node['ipv6'] = []\n node['enabled_protocols'] = []\n if node['status'] == 'online':\n self._storage_nodes[node['id']] = node\n except KeyError:\n self._handle_keyerror('lsnode', header)\n\n # Get the iSCSI IP addresses and WWPNs of the Storwize/SVC nodes\n self._get_iscsi_ip_addrs()\n self._get_fc_wwpns()\n\n # For each node, check what connection modes it supports. Delete any\n # nodes that do not support any types (may be partially configured).\n to_delete = []\n for k, node in self._storage_nodes.iteritems():\n if ((len(node['ipv4']) or len(node['ipv6']))\n and len(node['iscsi_name'])):\n node['enabled_protocols'].append('iSCSI')\n self._enabled_protocols.add('iSCSI')\n if len(node['WWPN']):\n node['enabled_protocols'].append('FC')\n self._enabled_protocols.add('FC')\n if not len(node['enabled_protocols']):\n to_delete.append(k)\n\n for delkey in to_delete:\n del self._storage_nodes[delkey]\n\n # Make sure we have at least one node configured\n self._driver_assert(len(self._storage_nodes),\n _('do_setup: No configured nodes'))\n\n LOG.debug(_('leave: do_setup'))","lang":"python","vul_type":"cwe-078","target_token_count":874,"sven_meta":{"func_name":"do_setup","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#46-190357285546","input":"static int bin_symbols(RCore *r, int mode, ut64 laddr, int va, ut64 at, const char *name, bool exponly, const char *args) {\n\tRBinInfo *info = r_bin_get_info (r->bin);\n\tRList *entries = r_bin_get_entries (r->bin);\n\tRBinSymbol *symbol;\n\tRBinAddr *entry;\n\tRListIter *iter;\n\tbool firstexp = true;\n\tbool printHere = false;\n\tint i = 0, lastfs = 's';\n\tbool bin_demangle = r_config_get_i (r->config, \"bin.demangle\");\n\tif (!info) {\n\t\treturn 0;\n\t}\n\n\tif (args && *args == '.') {\n\t\tprintHere = true;\n\t}\n\n\tbool is_arm = info && info->arch && !strncmp (info->arch, \"arm\", 3);\n\tconst char *lang = bin_demangle ? r_config_get (r->config, \"bin.lang\") : NULL;\n\n\tRList *symbols = r_bin_get_symbols (r->bin);\n\tr_spaces_push (&r->anal->meta_spaces, \"bin\");\n\n\tif (IS_MODE_JSON (mode) && !printHere) {\n\t\tr_cons_printf (\"[\");\n\t} else if (IS_MODE_SET (mode)) {\n\t\tr_flag_space_set (r->flags, R_FLAGS_FS_SYMBOLS);\n\t} else if (!at && exponly) {\n\t\tif (IS_MODE_RAD (mode)) {\n\t\t\tr_cons_printf (\"fs exports\\n\");\n\t\t} else if (IS_MODE_NORMAL (mode)) {\n\t\t\tr_cons_printf (printHere ? \"\" : \"[Exports]\\n\");\n\t\t}\n\t} else if (!at && !exponly) {\n\t\tif (IS_MODE_RAD (mode)) {\n\t\t\tr_cons_printf (\"fs symbols\\n\");\n\t\t} else if (IS_MODE_NORMAL (mode)) {\n\t\t\tr_cons_printf (printHere ? \"\" : \"[Symbols]\\n\");\n\t\t}\n\t}\n\tif (IS_MODE_NORMAL (mode)) {\n\t\tr_cons_printf (\"Num Paddr Vaddr Bind Type Size Name\\n\");\n\t}\n\n\n\tsize_t count = 0;\n\tr_list_foreach (symbols, iter, symbol) {\n\t\tif (!symbol->name) {\n\t\t\tcontinue;\n\t\t}\n\t\tchar *r_symbol_name = r_str_escape_utf8 (symbol->name, false, true);\n\t\tut64 addr = compute_addr (r->bin, symbol->paddr, symbol->vaddr, va);\n\t\tint len = symbol->size ? symbol->size : 32;\n\t\tSymName sn = {0};\n\n\t\tif (exponly && !isAnExport (symbol)) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif (name && strcmp (r_symbol_name, name)) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif (at && (!symbol->size || !is_in_range (at, addr, symbol->size))) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif ((printHere && !is_in_range (r->offset, symbol->paddr, len))\n\t\t\t\t&& (printHere && !is_in_range (r->offset, addr, len))) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tcount ++;\n\t\tsnInit (r, &sn, symbol, lang);\n\n\t\tif (IS_MODE_SET (mode) && (is_section_symbol (symbol) || is_file_symbol (symbol))) {\n\t\t\t/*\n\t\t\t * Skip section symbols because they will have their own flag.\n\t\t\t * Skip also file symbols because not useful for now.\n\t\t\t */\n\t\t} else if (IS_MODE_SET (mode) && is_special_symbol (symbol)) {\n\t\t\tif (is_arm) {\n\t\t\t\thandle_arm_special_symbol (r, symbol, va);\n\t\t\t}\n\t\t} else if (IS_MODE_SET (mode)) {\n\t\t\t// TODO: provide separate API in RBinPlugin to let plugins handle anal hints/metadata\n\t\t\tif (is_arm) {\n\t\t\t\thandle_arm_symbol (r, symbol, info, va);\n\t\t\t}\n\t\t\tselect_flag_space (r, symbol);\n\t\t\t/* If that's a Classed symbol (method or so) */\n\t\t\tif (sn.classname) {\n\t\t\t\tRFlagItem *fi = r_flag_get (r->flags, sn.methflag);\n\t\t\t\tif (r->bin->prefix) {\n\t\t\t\t\tchar *prname = r_str_newf (\"%s.%s\", r->bin->prefix, sn.methflag);\n\t\t\t\t\tr_name_filter (sn.methflag, -1);\n\t\t\t\t\tfree (sn.methflag);\n\t\t\t\t\tsn.methflag = prname;\n\t\t\t\t}\n\t\t\t\tif (fi) {\n\t\t\t\t\tr_flag_item_set_realname (fi, sn.methname);\n\t\t\t\t\tif ((fi->offset - r->flags->base) == addr) {\n\t\t\t\t//\t\tchar *comment = fi->comment ? strdup (fi->comment) : NULL;\n\t\t\t\t\t\tr_flag_unset (r->flags, fi);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfi = r_flag_set (r->flags, sn.methflag, addr, symbol->size);\n\t\t\t\t\tchar *comment = fi->comment ? strdup (fi->comment) : NULL;\n\t\t\t\t\tif (comment) {\n\t\t\t\t\t\tr_flag_item_set_comment (fi, comment);\n\t\t\t\t\t\tR_FREE (comment);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst char *n = sn.demname ? sn.demname : sn.name;\n\t\t\t\tconst char *fn = sn.demflag ? sn.demflag : sn.nameflag;\n\t\t\t\tchar *fnp = (r->bin->prefix) ?\n\t\t\t\t\tr_str_newf (\"%s.%s\", r->bin->prefix, fn):\n\t\t\t\t\tstrdup (fn);\n\t\t\t\tRFlagItem *fi = r_flag_set (r->flags, fnp, addr, symbol->size);\n\t\t\t\tif (fi) {\n\t\t\t\t\tr_flag_item_set_realname (fi, n);\n\t\t\t\t\tfi->demangled = (bool)(size_t)sn.demname;\n\t\t\t\t} else {\n\t\t\t\t\tif (fn) {\n\t\t\t\t\t\teprintf (\"[Warning] Can't find flag (%s)\\n\", fn);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfree (fnp);\n\t\t\t}\n\t\t\tif (sn.demname) {\n\t\t\t\tr_meta_add (r->anal, R_META_TYPE_COMMENT,\n\t\t\t\t\taddr, symbol->size, sn.demname);\n\t\t\t}\n\t\t\tr_flag_space_pop (r->flags);\n\t\t} else if (IS_MODE_JSON (mode)) {\n\t\t\tchar *str = r_str_escape_utf8_for_json (r_symbol_name, -1);\n\t\t\t// str = r_str_replace (str, \"\\\"\", \"\\\\\\\"\", 1);\n\t\t\tr_cons_printf (\"%s{\\\"name\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"demname\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"flagname\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"ordinal\\\":%d,\"\n\t\t\t\t\"\\\"bind\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"size\\\":%d,\"\n\t\t\t\t\"\\\"type\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"vaddr\\\":%\"PFMT64d\",\"\n\t\t\t\t\"\\\"paddr\\\":%\"PFMT64d\"}\",\n\t\t\t\t((exponly && firstexp) || printHere) ? \"\" : (iter->p ? \",\" : \"\"),\n\t\t\t\tstr,\n\t\t\t\tsn.demname? sn.demname: \"\",\n\t\t\t\tsn.nameflag,\n\t\t\t\tsymbol->ordinal,\n\t\t\t\tsymbol->bind,\n\t\t\t\t(int)symbol->size,\n\t\t\t\tsymbol->type,\n\t\t\t\t(ut64)addr, (ut64)symbol->paddr);\n\t\t\tfree (str);\n\t\t} else if (IS_MODE_SIMPLE (mode)) {\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tr_cons_printf (\"0x%08\"PFMT64x\" %d %s\\n\",\n\t\t\t\taddr, (int)symbol->size, name);\n\t\t} else if (IS_MODE_SIMPLEST (mode)) {\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tr_cons_printf (\"%s\\n\", name);\n\t\t} else if (IS_MODE_RAD (mode)) {\n\t\t\t/* Skip special symbols because we do not flag them and\n\t\t\t * they shouldn't be printed in the rad format either */\n\t\t\tif (is_special_symbol (symbol)) {\n\t\t\t\tgoto next;\n\t\t\t}\n\t\t\tRBinFile *binfile;\n\t\t\tRBinPlugin *plugin;\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tif (!name) {\n\t\t\t\tgoto next;\n\t\t\t}\n\t\t\tif (!strncmp (name, \"imp.\", 4)) {\n\t\t\t\tif (lastfs != 'i') {\n\t\t\t\t\tr_cons_printf (\"fs imports\\n\");\n\t\t\t\t}\n\t\t\t\tlastfs = 'i';\n\t\t\t} else {\n\t\t\t\tif (lastfs != 's') {\n\t\t\t\t\tconst char *fs = exponly? \"exports\": \"symbols\";\n\t\t\t\t\tr_cons_printf (\"fs %s\\n\", fs);\n\t\t\t\t}\n\t\t\t\tlastfs = 's';\n\t\t\t}\n\t\t\tif (r->bin->prefix || *name) { // we don't want unnamed symbol flags\n\t\t\t\tchar *flagname = construct_symbol_flagname (\"sym\", name, MAXFLAG_LEN_DEFAULT);\n\t\t\t\tif (!flagname) {\n\t\t\t\t\tgoto next;\n\t\t\t\t}\n\t\t\t\tr_cons_printf (\"\\\"f %s%s%s %u 0x%08\" PFMT64x \"\\\"\\n\",\n\t\t\t\t\tr->bin->prefix ? r->bin->prefix : \"\", r->bin->prefix ? \".\" : \"\",\n\t\t\t\t\tflagname, symbol->size, addr);\n\t\t\t\tfree (flagname);\n\t\t\t}\n\t\t\tbinfile = r_bin_cur (r->bin);\n\t\t\tplugin = r_bin_file_cur_plugin (binfile);\n\t\t\tif (plugin && plugin->name) {\n\t\t\t\tif (r_str_startswith (plugin->name, \"pe\")) {\n\t\t\t\t\tchar *module = strdup (r_symbol_name);\n\t\t\t\t\tchar *p = strstr (module, \".dll_\");\n\t\t\t\t\tif (p && strstr (module, \"imp.\")) {\n\t\t\t\t\t\tchar *symname = __filterShell (p + 5);\n\t\t\t\t\t\tchar *m = __filterShell (module);\n\t\t\t\t\t\t*p = 0;\n\t\t\t\t\t\tif (r->bin->prefix) {\n\t\t\t\t\t\t\tr_cons_printf (\"k bin/pe/%s/%d=%s.%s\\n\",\n\t\t\t\t\t\t\t\tmodule, symbol->ordinal, r->bin->prefix, symname);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tr_cons_printf (\"k bin/pe/%s/%d=%s\\n\",\n\t\t\t\t\t\t\t\tmodule, symbol->ordinal, symname);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfree (symname);\n\t\t\t\t\t\tfree (m);\n\t\t\t\t\t}\n\t\t\t\t\tfree (module);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst char *bind = symbol->bind? symbol->bind: \"NONE\";\n\t\t\tconst char *type = symbol->type? symbol->type: \"NONE\";\n\t\t\tconst char *name = r_str_get (sn.demname? sn.demname: r_symbol_name);\n\t\t\t// const char *fwd = r_str_get (symbol->forwarder);\n\t\t\tr_cons_printf (\"%03u\", symbol->ordinal);\n\t\t\tif (symbol->paddr == UT64_MAX) {\n\t\t\t\tr_cons_printf (\" ----------\");\n\t\t\t} else {\n\t\t\t\tr_cons_printf (\" 0x%08\"PFMT64x, symbol->paddr);\n\t\t\t}\n\t\t\tr_cons_printf (\" 0x%08\"PFMT64x\" %6s %6s %4d%s%s\\n\",\n\t\t\t addr, bind, type, symbol->size, *name? \" \": \"\", name);\n\t\t}\nnext:\n\t\tsnFini (&sn);\n\t\ti++;\n\t\tfree (r_symbol_name);\n\t\tif (exponly && firstexp) {\n\t\t\tfirstexp = false;\n\t\t}\n\t\tif (printHere) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (count == 0 && IS_MODE_JSON (mode)) {\n\t\tr_cons_printf (\"{}\");\n\t}\n\n\n\t//handle thumb and arm for entry point since they are not present in symbols\n\tif (is_arm) {\n\t\tr_list_foreach (entries, iter, entry) {\n\t\t\tif (IS_MODE_SET (mode)) {\n\t\t\t\thandle_arm_entry (r, entry, info, va);\n\t\t\t}\n\t\t}\n\t}\n\tif (IS_MODE_JSON (mode) && !printHere) {\n\t\tr_cons_printf (\"]\");\n\t}\n\n\tr_spaces_pop (&r->anal->meta_spaces);\n\treturn true;\n}","target":"static int bin_symbols(RCore *r, int mode, ut64 laddr, int va, ut64 at, const char *name, bool exponly, const char *args) {\n\tRBinInfo *info = r_bin_get_info (r->bin);\n\tRList *entries = r_bin_get_entries (r->bin);\n\tRBinSymbol *symbol;\n\tRBinAddr *entry;\n\tRListIter *iter;\n\tbool firstexp = true;\n\tbool printHere = false;\n\tint i = 0, lastfs = 's';\n\tbool bin_demangle = r_config_get_i (r->config, \"bin.demangle\");\n\tif (!info) {\n\t\treturn 0;\n\t}\n\n\tif (args && *args == '.') {\n\t\tprintHere = true;\n\t}\n\n\tbool is_arm = info && info->arch && !strncmp (info->arch, \"arm\", 3);\n\tconst char *lang = bin_demangle ? r_config_get (r->config, \"bin.lang\") : NULL;\n\n\tRList *symbols = r_bin_get_symbols (r->bin);\n\tr_spaces_push (&r->anal->meta_spaces, \"bin\");\n\n\tif (IS_MODE_JSON (mode) && !printHere) {\n\t\tr_cons_printf (\"[\");\n\t} else if (IS_MODE_SET (mode)) {\n\t\tr_flag_space_set (r->flags, R_FLAGS_FS_SYMBOLS);\n\t} else if (!at && exponly) {\n\t\tif (IS_MODE_RAD (mode)) {\n\t\t\tr_cons_printf (\"fs exports\\n\");\n\t\t} else if (IS_MODE_NORMAL (mode)) {\n\t\t\tr_cons_printf (printHere ? \"\" : \"[Exports]\\n\");\n\t\t}\n\t} else if (!at && !exponly) {\n\t\tif (IS_MODE_RAD (mode)) {\n\t\t\tr_cons_printf (\"fs symbols\\n\");\n\t\t} else if (IS_MODE_NORMAL (mode)) {\n\t\t\tr_cons_printf (printHere ? \"\" : \"[Symbols]\\n\");\n\t\t}\n\t}\n\tif (IS_MODE_NORMAL (mode)) {\n\t\tr_cons_printf (\"Num Paddr Vaddr Bind Type Size Name\\n\");\n\t}\n\n\n\tsize_t count = 0;\n\tr_list_foreach (symbols, iter, symbol) {\n\t\tif (!symbol->name) {\n\t\t\tcontinue;\n\t\t}\n\t\tchar *r_symbol_name = r_str_escape_utf8 (symbol->name, false, true);\n\t\tut64 addr = compute_addr (r->bin, symbol->paddr, symbol->vaddr, va);\n\t\tint len = symbol->size ? symbol->size : 32;\n\t\tSymName sn = {0};\n\n\t\tif (exponly && !isAnExport (symbol)) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif (name && strcmp (r_symbol_name, name)) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif (at && (!symbol->size || !is_in_range (at, addr, symbol->size))) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif ((printHere && !is_in_range (r->offset, symbol->paddr, len))\n\t\t\t\t&& (printHere && !is_in_range (r->offset, addr, len))) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tcount ++;\n\t\tsnInit (r, &sn, symbol, lang);\n\n\t\tif (IS_MODE_SET (mode) && (is_section_symbol (symbol) || is_file_symbol (symbol))) {\n\t\t\t/*\n\t\t\t * Skip section symbols because they will have their own flag.\n\t\t\t * Skip also file symbols because not useful for now.\n\t\t\t */\n\t\t} else if (IS_MODE_SET (mode) && is_special_symbol (symbol)) {\n\t\t\tif (is_arm) {\n\t\t\t\thandle_arm_special_symbol (r, symbol, va);\n\t\t\t}\n\t\t} else if (IS_MODE_SET (mode)) {\n\t\t\t// TODO: provide separate API in RBinPlugin to let plugins handle anal hints/metadata\n\t\t\tif (is_arm) {\n\t\t\t\thandle_arm_symbol (r, symbol, info, va);\n\t\t\t}\n\t\t\tselect_flag_space (r, symbol);\n\t\t\t/* If that's a Classed symbol (method or so) */\n\t\t\tif (sn.classname) {\n\t\t\t\tRFlagItem *fi = r_flag_get (r->flags, sn.methflag);\n\t\t\t\tif (r->bin->prefix) {\n\t\t\t\t\tchar *prname = r_str_newf (\"%s.%s\", r->bin->prefix, sn.methflag);\n\t\t\t\t\tr_name_filter (sn.methflag, -1);\n\t\t\t\t\tfree (sn.methflag);\n\t\t\t\t\tsn.methflag = prname;\n\t\t\t\t}\n\t\t\t\tif (fi) {\n\t\t\t\t\tr_flag_item_set_realname (fi, sn.methname);\n\t\t\t\t\tif ((fi->offset - r->flags->base) == addr) {\n\t\t\t\t//\t\tchar *comment = fi->comment ? strdup (fi->comment) : NULL;\n\t\t\t\t\t\tr_flag_unset (r->flags, fi);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfi = r_flag_set (r->flags, sn.methflag, addr, symbol->size);\n\t\t\t\t\tchar *comment = fi->comment ? strdup (fi->comment) : NULL;\n\t\t\t\t\tif (comment) {\n\t\t\t\t\t\tr_flag_item_set_comment (fi, comment);\n\t\t\t\t\t\tR_FREE (comment);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst char *n = sn.demname ? sn.demname : sn.name;\n\t\t\t\tconst char *fn = sn.demflag ? sn.demflag : sn.nameflag;\n\t\t\t\tchar *fnp = (r->bin->prefix) ?\n\t\t\t\t\tr_str_newf (\"%s.%s\", r->bin->prefix, fn):\n\t\t\t\t\tstrdup (fn);\n\t\t\t\tRFlagItem *fi = r_flag_set (r->flags, fnp, addr, symbol->size);\n\t\t\t\tif (fi) {\n\t\t\t\t\tr_flag_item_set_realname (fi, n);\n\t\t\t\t\tfi->demangled = (bool)(size_t)sn.demname;\n\t\t\t\t} else {\n\t\t\t\t\tif (fn) {\n\t\t\t\t\t\teprintf (\"[Warning] Can't find flag (%s)\\n\", fn);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfree (fnp);\n\t\t\t}\n\t\t\tif (sn.demname) {\n\t\t\t\tr_meta_add (r->anal, R_META_TYPE_COMMENT,\n\t\t\t\t\taddr, symbol->size, sn.demname);\n\t\t\t}\n\t\t\tr_flag_space_pop (r->flags);\n\t\t} else if (IS_MODE_JSON (mode)) {\n\t\t\tchar *str = r_str_escape_utf8_for_json (r_symbol_name, -1);\n\t\t\t// str = r_str_replace (str, \"\\\"\", \"\\\\\\\"\", 1);\n\t\t\tr_cons_printf (\"%s{\\\"name\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"demname\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"flagname\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"ordinal\\\":%d,\"\n\t\t\t\t\"\\\"bind\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"size\\\":%d,\"\n\t\t\t\t\"\\\"type\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"vaddr\\\":%\"PFMT64d\",\"\n\t\t\t\t\"\\\"paddr\\\":%\"PFMT64d\"}\",\n\t\t\t\t((exponly && firstexp) || printHere) ? \"\" : (iter->p ? \",\" : \"\"),\n\t\t\t\tstr,\n\t\t\t\tsn.demname? sn.demname: \"\",\n\t\t\t\tsn.nameflag,\n\t\t\t\tsymbol->ordinal,\n\t\t\t\tsymbol->bind,\n\t\t\t\t(int)symbol->size,\n\t\t\t\tsymbol->type,\n\t\t\t\t(ut64)addr, (ut64)symbol->paddr);\n\t\t\tfree (str);\n\t\t} else if (IS_MODE_SIMPLE (mode)) {\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tr_cons_printf (\"0x%08\"PFMT64x\" %d %s\\n\",\n\t\t\t\taddr, (int)symbol->size, name);\n\t\t} else if (IS_MODE_SIMPLEST (mode)) {\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tr_cons_printf (\"%s\\n\", name);\n\t\t} else if (IS_MODE_RAD (mode)) {\n\t\t\t/* Skip special symbols because we do not flag them and\n\t\t\t * they shouldn't be printed in the rad format either */\n\t\t\tif (is_special_symbol (symbol)) {\n\t\t\t\tgoto next;\n\t\t\t}\n\t\t\tRBinFile *binfile;\n\t\t\tRBinPlugin *plugin;\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tif (!name) {\n\t\t\t\tgoto next;\n\t\t\t}\n\t\t\tif (!strncmp (name, \"imp.\", 4)) {\n\t\t\t\tif (lastfs != 'i') {\n\t\t\t\t\tr_cons_printf (\"fs imports\\n\");\n\t\t\t\t}\n\t\t\t\tlastfs = 'i';\n\t\t\t} else {\n\t\t\t\tif (lastfs != 's') {\n\t\t\t\t\tconst char *fs = exponly? \"exports\": \"symbols\";\n\t\t\t\t\tr_cons_printf (\"fs %s\\n\", fs);\n\t\t\t\t}\n\t\t\t\tlastfs = 's';\n\t\t\t}\n\t\t\tif (r->bin->prefix || *name) { // we don't want unnamed symbol flags\n\t\t\t\tchar *flagname = construct_symbol_flagname (\"sym\", name, MAXFLAG_LEN_DEFAULT);\n\t\t\t\tif (!flagname) {\n\t\t\t\t\tgoto next;\n\t\t\t\t}\n\t\t\t\tr_cons_printf (\"\\\"f %s%s%s %u 0x%08\" PFMT64x \"\\\"\\n\",\n\t\t\t\t\tr->bin->prefix ? r->bin->prefix : \"\", r->bin->prefix ? \".\" : \"\",\n\t\t\t\t\tflagname, symbol->size, addr);\n\t\t\t\tfree (flagname);\n\t\t\t}\n\t\t\tbinfile = r_bin_cur (r->bin);\n\t\t\tplugin = r_bin_file_cur_plugin (binfile);\n\t\t\tif (plugin && plugin->name) {\n\t\t\t\tif (r_str_startswith (plugin->name, \"pe\")) {\n\t\t\t\t\tchar *module = strdup (r_symbol_name);\n\t\t\t\t\tchar *p = strstr (module, \".dll_\");\n\t\t\t\t\tif (p && strstr (module, \"imp.\")) {\n\t\t\t\t\t\tchar *symname = __filterShell (p + 5);\n\t\t\t\t\t\tchar *m = __filterShell (module);\n\t\t\t\t\t\t*p = 0;\n\t\t\t\t\t\tif (r->bin->prefix) {\n\t\t\t\t\t\t\tr_cons_printf (\"\\\"k bin/pe/%s/%d=%s.%s\\\"\\n\",\n\t\t\t\t\t\t\t\tmodule, symbol->ordinal, r->bin->prefix, symname);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tr_cons_printf (\"\\\"k bin/pe/%s/%d=%s\\\"\\n\",\n\t\t\t\t\t\t\t\tmodule, symbol->ordinal, symname);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfree (symname);\n\t\t\t\t\t\tfree (m);\n\t\t\t\t\t}\n\t\t\t\t\tfree (module);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst char *bind = symbol->bind? symbol->bind: \"NONE\";\n\t\t\tconst char *type = symbol->type? symbol->type: \"NONE\";\n\t\t\tconst char *name = r_str_get (sn.demname? sn.demname: r_symbol_name);\n\t\t\t// const char *fwd = r_str_get (symbol->forwarder);\n\t\t\tr_cons_printf (\"%03u\", symbol->ordinal);\n\t\t\tif (symbol->paddr == UT64_MAX) {\n\t\t\t\tr_cons_printf (\" ----------\");\n\t\t\t} else {\n\t\t\t\tr_cons_printf (\" 0x%08\"PFMT64x, symbol->paddr);\n\t\t\t}\n\t\t\tr_cons_printf (\" 0x%08\"PFMT64x\" %6s %6s %4d%s%s\\n\",\n\t\t\t addr, bind, type, symbol->size, *name? \" \": \"\", name);\n\t\t}\nnext:\n\t\tsnFini (&sn);\n\t\ti++;\n\t\tfree (r_symbol_name);\n\t\tif (exponly && firstexp) {\n\t\t\tfirstexp = false;\n\t\t}\n\t\tif (printHere) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (count == 0 && IS_MODE_JSON (mode)) {\n\t\tr_cons_printf (\"{}\");\n\t}\n\n\n\t//handle thumb and arm for entry point since they are not present in symbols\n\tif (is_arm) {\n\t\tr_list_foreach (entries, iter, entry) {\n\t\t\tif (IS_MODE_SET (mode)) {\n\t\t\t\thandle_arm_entry (r, entry, info, va);\n\t\t\t}\n\t\t}\n\t}\n\tif (IS_MODE_JSON (mode) && !printHere) {\n\t\tr_cons_printf (\"]\");\n\t}\n\n\tr_spaces_pop (&r->anal->meta_spaces);\n\treturn true;\n}","lang":"c","vul_type":"cwe-078","target_token_count":2673,"sven_meta":{"func_name":"bin_symbols","file_name":"libr/core/cbin.c","commit_link":"github.com/radareorg/radare2/commit/5411543a310a470b1257fb93273cdd6e8dfcb3af","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#53-d45aca8d5adb","input":"openscript(\n char_u\t*name,\n int\t\tdirectly)\t/* when TRUE execute directly */\n{\n if (curscript + 1 == NSCRIPT)\n {\n\temsg(_(e_nesting));\n\treturn;\n }\n#ifdef FEAT_EVAL\n if (ignore_script)\n\t/* Not reading from script, also don't open one. Warning message? */\n\treturn;\n#endif\n\n if (scriptin[curscript] != NULL)\t/* already reading script */\n\t++curscript;\n\t\t\t\t/* use NameBuff for expanded name */\n expand_env(name, NameBuff, MAXPATHL);\n if ((scriptin[curscript] = mch_fopen((char *)NameBuff, READBIN)) == NULL)\n {\n\tsemsg(_(e_notopen), name);\n\tif (curscript)\n\t --curscript;\n\treturn;\n }\n if (save_typebuf() == FAIL)\n\treturn;\n\n /*\n * Execute the commands from the file right now when using \":source!\"\n * after \":global\" or \":argdo\" or in a loop. Also when another command\n * follows. This means the display won't be updated. Don't do this\n * always, \"make test\" would fail.\n */\n if (directly)\n {\n\toparg_T\toa;\n\tint\toldcurscript;\n\tint\tsave_State = State;\n\tint\tsave_restart_edit = restart_edit;\n\tint\tsave_insertmode = p_im;\n\tint\tsave_finish_op = finish_op;\n\tint\tsave_msg_scroll = msg_scroll;\n\n\tState = NORMAL;\n\tmsg_scroll = FALSE;\t/* no msg scrolling in Normal mode */\n\trestart_edit = 0;\t/* don't go to Insert mode */\n\tp_im = FALSE;\t\t/* don't use 'insertmode' */\n\tclear_oparg(&oa);\n\tfinish_op = FALSE;\n\n\toldcurscript = curscript;\n\tdo\n\t{\n\t update_topline_cursor();\t// update cursor position and topline\n\t normal_cmd(&oa, FALSE);\t// execute one command\n\t vpeekc();\t\t\t// check for end of file\n\t}\n\twhile (scriptin[oldcurscript] != NULL);\n\n\tState = save_State;\n\tmsg_scroll = save_msg_scroll;\n\trestart_edit = save_restart_edit;\n\tp_im = save_insertmode;\n\tfinish_op = save_finish_op;\n }\n}","target":"openscript(\n char_u\t*name,\n int\t\tdirectly)\t/* when TRUE execute directly */\n{\n if (curscript + 1 == NSCRIPT)\n {\n\temsg(_(e_nesting));\n\treturn;\n }\n\n // Disallow sourcing a file in the sandbox, the commands would be executed\n // later, possibly outside of the sandbox.\n if (check_secure())\n\treturn;\n\n#ifdef FEAT_EVAL\n if (ignore_script)\n\t/* Not reading from script, also don't open one. Warning message? */\n\treturn;\n#endif\n\n if (scriptin[curscript] != NULL)\t/* already reading script */\n\t++curscript;\n\t\t\t\t/* use NameBuff for expanded name */\n expand_env(name, NameBuff, MAXPATHL);\n if ((scriptin[curscript] = mch_fopen((char *)NameBuff, READBIN)) == NULL)\n {\n\tsemsg(_(e_notopen), name);\n\tif (curscript)\n\t --curscript;\n\treturn;\n }\n if (save_typebuf() == FAIL)\n\treturn;\n\n /*\n * Execute the commands from the file right now when using \":source!\"\n * after \":global\" or \":argdo\" or in a loop. Also when another command\n * follows. This means the display won't be updated. Don't do this\n * always, \"make test\" would fail.\n */\n if (directly)\n {\n\toparg_T\toa;\n\tint\toldcurscript;\n\tint\tsave_State = State;\n\tint\tsave_restart_edit = restart_edit;\n\tint\tsave_insertmode = p_im;\n\tint\tsave_finish_op = finish_op;\n\tint\tsave_msg_scroll = msg_scroll;\n\n\tState = NORMAL;\n\tmsg_scroll = FALSE;\t/* no msg scrolling in Normal mode */\n\trestart_edit = 0;\t/* don't go to Insert mode */\n\tp_im = FALSE;\t\t/* don't use 'insertmode' */\n\tclear_oparg(&oa);\n\tfinish_op = FALSE;\n\n\toldcurscript = curscript;\n\tdo\n\t{\n\t update_topline_cursor();\t// update cursor position and topline\n\t normal_cmd(&oa, FALSE);\t// execute one command\n\t vpeekc();\t\t\t// check for end of file\n\t}\n\twhile (scriptin[oldcurscript] != NULL);\n\n\tState = save_State;\n\tmsg_scroll = save_msg_scroll;\n\trestart_edit = save_restart_edit;\n\tp_im = save_insertmode;\n\tfinish_op = save_finish_op;\n }\n}","lang":"c","vul_type":"cwe-078","target_token_count":533,"sven_meta":{"func_name":"openscript","file_name":"src/getchar.c","commit_link":"github.com/vim/vim/commit/53575521406739cf20bbe4e384d88e7dca11f040","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#90-c981d0654168","input":" def _formatCredentials(self, data, name):\n \"\"\"\n Credentials are of the form\n RCLONE_CONFIG_CURRENT_TYPE=s3\n ^ ^ ^ ^\n [mandatory ][name ][key][value]\n \"\"\"\n\n prefix = \"RCLONE_CONFIG_{}\".format(name.upper())\n\n credentials = ''\n credentials += \"{}_TYPE='{}' \".format(prefix, data.type)\n\n def _addCredential(credentials, env_key, data_key):\n value = getattr(data, data_key, None)\n if value is not None:\n credentials += \"{}='{}' \".format(env_key, value)\n return credentials\n\n\n if data.type == 's3':\n credentials = _addCredential(credentials,\n '{}_REGION'.format(prefix),\n 's3_region'\n )\n credentials = _addCredential(credentials,\n '{}_ACCESS_KEY_ID'.format(prefix),\n 's3_access_key_id'\n )\n credentials = _addCredential(credentials,\n '{}_SECRET_ACCESS_KEY'.format(prefix),\n 's3_secret_access_key'\n )\n\n credentials = _addCredential(credentials,\n '{}_ENDPOINT'.format(prefix),\n 's3_endpoint'\n )\n credentials = _addCredential(credentials,\n '{}_V2_AUTH'.format(prefix),\n 's3_v2_auth'\n )\n\n elif data.type == 'azureblob':\n credentials = _addCredential(credentials,\n '{}_ACCOUNT'.format(prefix),\n 'azure_account'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'azure_key'\n )\n\n elif data.type == 'swift':\n credentials = _addCredential(credentials,\n '{}_USER'.format(prefix),\n 'swift_user'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'swift_key'\n )\n credentials = _addCredential(credentials,\n '{}_AUTH'.format(prefix),\n 'swift_auth'\n )\n credentials = _addCredential(credentials,\n '{}_TENANT'.format(prefix),\n 'swift_tenant'\n )\n\n elif data.type == 'google cloud storage':\n credentials = _addCredential(credentials,\n '{}_CLIENT_ID'.format(prefix),\n 'gcp_client_id'\n )\n credentials = _addCredential(credentials,\n '{}_SERVICE_ACCOUNT_CREDENTIALS'.format(prefix),\n 'gcp_service_account_credentials'\n )\n credentials = _addCredential(credentials,\n '{}_PROJECT_NUMBER'.format(prefix),\n 'gcp_project_number'\n )\n credentials = _addCredential(credentials,\n '{}_OBJECT_ACL'.format(prefix),\n 'gcp_object_acl'\n )\n credentials = _addCredential(credentials,\n '{}_BUCKET_ACL'.format(prefix),\n 'gcp_bucket_acl'\n )\n\n else:\n logging.error(\"Connection type unknown: {}\".format(data.type))\n\n return credentials","target":" def _formatCredentials(self, data, name):\n \"\"\"\n Credentials are of the form\n RCLONE_CONFIG_CURRENT_TYPE=s3\n ^ ^ ^ ^\n [mandatory ][name ][key][value]\n \"\"\"\n\n prefix = \"RCLONE_CONFIG_{}\".format(name.upper())\n\n credentials = {}\n credentials['{}_TYPE'.format(prefix)] = data.type\n\n def _addCredential(credentials, env_key, data_key):\n value = getattr(data, data_key, None)\n if value is not None:\n credentials[env_key] = value\n return credentials\n\n\n if data.type == 's3':\n credentials = _addCredential(credentials,\n '{}_REGION'.format(prefix),\n 's3_region'\n )\n credentials = _addCredential(credentials,\n '{}_ACCESS_KEY_ID'.format(prefix),\n 's3_access_key_id'\n )\n credentials = _addCredential(credentials,\n '{}_SECRET_ACCESS_KEY'.format(prefix),\n 's3_secret_access_key'\n )\n\n credentials = _addCredential(credentials,\n '{}_ENDPOINT'.format(prefix),\n 's3_endpoint'\n )\n credentials = _addCredential(credentials,\n '{}_V2_AUTH'.format(prefix),\n 's3_v2_auth'\n )\n\n elif data.type == 'azureblob':\n credentials = _addCredential(credentials,\n '{}_ACCOUNT'.format(prefix),\n 'azure_account'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'azure_key'\n )\n\n elif data.type == 'swift':\n credentials = _addCredential(credentials,\n '{}_USER'.format(prefix),\n 'swift_user'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'swift_key'\n )\n credentials = _addCredential(credentials,\n '{}_AUTH'.format(prefix),\n 'swift_auth'\n )\n credentials = _addCredential(credentials,\n '{}_TENANT'.format(prefix),\n 'swift_tenant'\n )\n\n elif data.type == 'google cloud storage':\n credentials = _addCredential(credentials,\n '{}_CLIENT_ID'.format(prefix),\n 'gcp_client_id'\n )\n credentials = _addCredential(credentials,\n '{}_SERVICE_ACCOUNT_CREDENTIALS'.format(prefix),\n 'gcp_service_account_credentials'\n )\n credentials = _addCredential(credentials,\n '{}_PROJECT_NUMBER'.format(prefix),\n 'gcp_project_number'\n )\n credentials = _addCredential(credentials,\n '{}_OBJECT_ACL'.format(prefix),\n 'gcp_object_acl'\n )\n credentials = _addCredential(credentials,\n '{}_BUCKET_ACL'.format(prefix),\n 'gcp_bucket_acl'\n )\n\n else:\n logging.error(\"Connection type unknown: {}\".format(data.type))\n\n return credentials","lang":"python","vul_type":"cwe-078","target_token_count":591,"sven_meta":{"func_name":"_formatCredentials","file_name":"src/backend/api/utils/rclone_connection.py","commit_link":"github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#91-9c994d16240d","input":" def initHeader(self):\n \"\"\"Initialize the IP header according to the IP format definition.\n\n \"\"\"\n\n # Ethernet header\n\n # Retrieve remote MAC address\n dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n # Force ARP resolution\n p = subprocess.Popen(\"ping -c1 {}\".format(self.remoteIP), shell=True)\n p.wait()\n time.sleep(0.1)\n\n dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n raise Exception(\"Cannot resolve IP address to a MAC address for IP: '{}'\".format(self.remoteIP))\n\n # Retrieve local MAC address\n srcMacAddr = self.get_interface_addr(bytes(self.interface, 'utf-8'))[1]\n\n eth_dst = Field(name='eth.dst', domain=Raw(dstMacAddr))\n eth_src = Field(name='eth.src', domain=Raw(srcMacAddr))\n eth_type = Field(name='eth.type', domain=Raw(b\"\\x08\\x00\"))\n\n\n # IP header\n\n ip_ver = Field(\n name='ip.version', domain=BitArray(\n value=bitarray('0100'))) # IP Version 4\n ip_ihl = Field(name='ip.hdr_len', domain=BitArray(bitarray('0000')))\n ip_tos = Field(\n name='ip.tos',\n domain=Data(\n dataType=BitArray(nbBits=8),\n originalValue=bitarray('00000000'),\n svas=SVAS.PERSISTENT))\n ip_tot_len = Field(\n name='ip.len', domain=BitArray(bitarray('0000000000000000')))\n ip_id = Field(name='ip.id', domain=BitArray(nbBits=16))\n ip_flags = Field(name='ip.flags', domain=Data(dataType=BitArray(nbBits=3), originalValue=bitarray('000'), svas=SVAS.PERSISTENT))\n ip_frag_off = Field(name='ip.fragment', domain=Data(dataType=BitArray(nbBits=13), originalValue=bitarray('0000000000000'), svas=SVAS.PERSISTENT))\n ip_ttl = Field(name='ip.ttl', domain=Data(dataType=BitArray(nbBits=8), originalValue=bitarray('01000000'), svas=SVAS.PERSISTENT))\n ip_proto = Field(name='ip.proto', domain=Integer(value=self.upperProtocol, unitSize=AbstractType.UNITSIZE_8, endianness=AbstractType.ENDIAN_BIG, sign=AbstractType.SIGN_UNSIGNED))\n ip_checksum = Field(name='ip.checksum', domain=BitArray(bitarray('0000000000000000')))\n ip_saddr = Field(name='ip.src', domain=IPv4(self.localIP))\n ip_daddr = Field(\n name='ip.dst', domain=IPv4(self.remoteIP))\n ip_payload = Field(name='ip.payload', domain=Raw())\n\n ip_ihl.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id, ip_flags,\n ip_frag_off,\n ip_ttl, ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=BitArray(nbBits=4), factor=1/float(32))\n ip_tot_len.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload], dataType=Integer(unitSize=AbstractType.UNITSIZE_16, sign=AbstractType.SIGN_UNSIGNED), factor=1/float(8))\n ip_checksum.domain = InternetChecksum(fields=[ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=Raw(nbBytes=2, unitSize=AbstractType.UNITSIZE_16))\n \n self.header = Symbol(name='Ethernet layer', fields=[eth_dst,\n eth_src,\n eth_type,\n ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload])","target":" def initHeader(self):\n \"\"\"Initialize the IP header according to the IP format definition.\n\n \"\"\"\n\n # Ethernet header\n\n # Retrieve remote MAC address\n dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n # Force ARP resolution\n p = subprocess.Popen([\"/bin/ping\", \"-c1\", self.remoteIP])\n p.wait()\n time.sleep(0.1)\n\n dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n raise Exception(\"Cannot resolve IP address to a MAC address for IP: '{}'\".format(self.remoteIP))\n\n # Retrieve local MAC address\n srcMacAddr = self.get_interface_addr(bytes(self.interface, 'utf-8'))[1]\n\n eth_dst = Field(name='eth.dst', domain=Raw(dstMacAddr))\n eth_src = Field(name='eth.src', domain=Raw(srcMacAddr))\n eth_type = Field(name='eth.type', domain=Raw(b\"\\x08\\x00\"))\n\n\n # IP header\n\n ip_ver = Field(\n name='ip.version', domain=BitArray(\n value=bitarray('0100'))) # IP Version 4\n ip_ihl = Field(name='ip.hdr_len', domain=BitArray(bitarray('0000')))\n ip_tos = Field(\n name='ip.tos',\n domain=Data(\n dataType=BitArray(nbBits=8),\n originalValue=bitarray('00000000'),\n svas=SVAS.PERSISTENT))\n ip_tot_len = Field(\n name='ip.len', domain=BitArray(bitarray('0000000000000000')))\n ip_id = Field(name='ip.id', domain=BitArray(nbBits=16))\n ip_flags = Field(name='ip.flags', domain=Data(dataType=BitArray(nbBits=3), originalValue=bitarray('000'), svas=SVAS.PERSISTENT))\n ip_frag_off = Field(name='ip.fragment', domain=Data(dataType=BitArray(nbBits=13), originalValue=bitarray('0000000000000'), svas=SVAS.PERSISTENT))\n ip_ttl = Field(name='ip.ttl', domain=Data(dataType=BitArray(nbBits=8), originalValue=bitarray('01000000'), svas=SVAS.PERSISTENT))\n ip_proto = Field(name='ip.proto', domain=Integer(value=self.upperProtocol, unitSize=AbstractType.UNITSIZE_8, endianness=AbstractType.ENDIAN_BIG, sign=AbstractType.SIGN_UNSIGNED))\n ip_checksum = Field(name='ip.checksum', domain=BitArray(bitarray('0000000000000000')))\n ip_saddr = Field(name='ip.src', domain=IPv4(self.localIP))\n ip_daddr = Field(\n name='ip.dst', domain=IPv4(self.remoteIP))\n ip_payload = Field(name='ip.payload', domain=Raw())\n\n ip_ihl.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id, ip_flags,\n ip_frag_off,\n ip_ttl, ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=BitArray(nbBits=4), factor=1/float(32))\n ip_tot_len.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload], dataType=Integer(unitSize=AbstractType.UNITSIZE_16, sign=AbstractType.SIGN_UNSIGNED), factor=1/float(8))\n ip_checksum.domain = InternetChecksum(fields=[ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=Raw(nbBytes=2, unitSize=AbstractType.UNITSIZE_16))\n \n self.header = Symbol(name='Ethernet layer', fields=[eth_dst,\n eth_src,\n eth_type,\n ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload])","lang":"python","vul_type":"cwe-078","target_token_count":1073,"sven_meta":{"func_name":"initHeader","file_name":"src/netzob/Simulator/Channels/RawEthernetClient.py","commit_link":"github.com/netzob/netzob/commit/557abf64867d715497979b029efedbd2777b912e","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-476#0-3ff4fa396f41","input":"static int multiSelect(\n Parse *pParse, /* Parsing context */\n Select *p, /* The right-most of SELECTs to be coded */\n SelectDest *pDest /* What to do with query results */\n){\n int rc = SQLITE_OK; /* Success code from a subroutine */\n Select *pPrior; /* Another SELECT immediately to our left */\n Vdbe *v; /* Generate code to this VDBE */\n SelectDest dest; /* Alternative data destination */\n Select *pDelete = 0; /* Chain of simple selects to delete */\n sqlite3 *db; /* Database connection */\n\n /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only\n ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.\n */\n assert( p && p->pPrior ); /* Calling function guarantees this much */\n assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION );\n assert( p->selFlags & SF_Compound );\n db = pParse->db;\n pPrior = p->pPrior;\n dest = *pDest;\n if( pPrior->pOrderBy || pPrior->pLimit ){\n sqlite3ErrorMsg(pParse,\"%s clause should come after %s not before\",\n pPrior->pOrderBy!=0 ? \"ORDER BY\" : \"LIMIT\", selectOpName(p->op));\n rc = 1;\n goto multi_select_end;\n }\n\n v = sqlite3GetVdbe(pParse);\n assert( v!=0 ); /* The VDBE already created by calling function */\n\n /* Create the destination temporary table if necessary\n */\n if( dest.eDest==SRT_EphemTab ){\n assert( p->pEList );\n sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iSDParm, p->pEList->nExpr);\n dest.eDest = SRT_Table;\n }\n\n /* Special handling for a compound-select that originates as a VALUES clause.\n */\n if( p->selFlags & SF_MultiValue ){\n rc = multiSelectValues(pParse, p, &dest);\n if( rc>=0 ) goto multi_select_end;\n rc = SQLITE_OK;\n }\n\n /* Make sure all SELECTs in the statement have the same number of elements\n ** in their result sets.\n */\n assert( p->pEList && pPrior->pEList );\n assert( p->pEList->nExpr==pPrior->pEList->nExpr );\n\n#ifndef SQLITE_OMIT_CTE\n if( p->selFlags & SF_Recursive ){\n generateWithRecursiveQuery(pParse, p, &dest);\n }else\n#endif\n\n /* Compound SELECTs that have an ORDER BY clause are handled separately.\n */\n if( p->pOrderBy ){\n return multiSelectOrderBy(pParse, p, pDest);\n }else{\n\n#ifndef SQLITE_OMIT_EXPLAIN\n if( pPrior->pPrior==0 ){\n ExplainQueryPlan((pParse, 1, \"COMPOUND QUERY\"));\n ExplainQueryPlan((pParse, 1, \"LEFT-MOST SUBQUERY\"));\n }\n#endif\n\n /* Generate code for the left and right SELECT statements.\n */\n switch( p->op ){\n case TK_ALL: {\n int addr = 0;\n int nLimit;\n assert( !pPrior->pLimit );\n pPrior->iLimit = p->iLimit;\n pPrior->iOffset = p->iOffset;\n pPrior->pLimit = p->pLimit;\n rc = sqlite3Select(pParse, pPrior, &dest);\n p->pLimit = 0;\n if( rc ){\n goto multi_select_end;\n }\n p->pPrior = 0;\n p->iLimit = pPrior->iLimit;\n p->iOffset = pPrior->iOffset;\n if( p->iLimit ){\n addr = sqlite3VdbeAddOp1(v, OP_IfNot, p->iLimit); VdbeCoverage(v);\n VdbeComment((v, \"Jump ahead if LIMIT reached\"));\n if( p->iOffset ){\n sqlite3VdbeAddOp3(v, OP_OffsetLimit,\n p->iLimit, p->iOffset+1, p->iOffset);\n }\n }\n ExplainQueryPlan((pParse, 1, \"UNION ALL\"));\n rc = sqlite3Select(pParse, p, &dest);\n testcase( rc!=SQLITE_OK );\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n if( pPrior->pLimit\n && sqlite3ExprIsInteger(pPrior->pLimit->pLeft, &nLimit)\n && nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit) \n ){\n p->nSelectRow = sqlite3LogEst((u64)nLimit);\n }\n if( addr ){\n sqlite3VdbeJumpHere(v, addr);\n }\n break;\n }\n case TK_EXCEPT:\n case TK_UNION: {\n int unionTab; /* Cursor number of the temp table holding result */\n u8 op = 0; /* One of the SRT_ operations to apply to self */\n int priorOp; /* The SRT_ operation to apply to prior selects */\n Expr *pLimit; /* Saved values of p->nLimit */\n int addr;\n SelectDest uniondest;\n \n testcase( p->op==TK_EXCEPT );\n testcase( p->op==TK_UNION );\n priorOp = SRT_Union;\n if( dest.eDest==priorOp ){\n /* We can reuse a temporary table generated by a SELECT to our\n ** right.\n */\n assert( p->pLimit==0 ); /* Not allowed on leftward elements */\n unionTab = dest.iSDParm;\n }else{\n /* We will need to create our own temporary table to hold the\n ** intermediate results.\n */\n unionTab = pParse->nTab++;\n assert( p->pOrderBy==0 );\n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0);\n assert( p->addrOpenEphm[0] == -1 );\n p->addrOpenEphm[0] = addr;\n findRightmost(p)->selFlags |= SF_UsesEphemeral;\n assert( p->pEList );\n }\n \n /* Code the SELECT statements to our left\n */\n assert( !pPrior->pOrderBy );\n sqlite3SelectDestInit(&uniondest, priorOp, unionTab);\n rc = sqlite3Select(pParse, pPrior, &uniondest);\n if( rc ){\n goto multi_select_end;\n }\n \n /* Code the current SELECT statement\n */\n if( p->op==TK_EXCEPT ){\n op = SRT_Except;\n }else{\n assert( p->op==TK_UNION );\n op = SRT_Union;\n }\n p->pPrior = 0;\n pLimit = p->pLimit;\n p->pLimit = 0;\n uniondest.eDest = op;\n ExplainQueryPlan((pParse, 1, \"%s USING TEMP B-TREE\",\n selectOpName(p->op)));\n rc = sqlite3Select(pParse, p, &uniondest);\n testcase( rc!=SQLITE_OK );\n /* Query flattening in sqlite3Select() might refill p->pOrderBy.\n ** Be sure to delete p->pOrderBy, therefore, to avoid a memory leak. */\n sqlite3ExprListDelete(db, p->pOrderBy);\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n p->pOrderBy = 0;\n if( p->op==TK_UNION ){\n p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n }\n sqlite3ExprDelete(db, p->pLimit);\n p->pLimit = pLimit;\n p->iLimit = 0;\n p->iOffset = 0;\n \n /* Convert the data in the temporary table into whatever form\n ** it is that we currently need.\n */\n assert( unionTab==dest.iSDParm || dest.eDest!=priorOp );\n if( dest.eDest!=priorOp ){\n int iCont, iBreak, iStart;\n assert( p->pEList );\n iBreak = sqlite3VdbeMakeLabel(pParse);\n iCont = sqlite3VdbeMakeLabel(pParse);\n computeLimitRegisters(pParse, p, iBreak);\n sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v);\n iStart = sqlite3VdbeCurrentAddr(v);\n selectInnerLoop(pParse, p, unionTab,\n 0, 0, &dest, iCont, iBreak);\n sqlite3VdbeResolveLabel(v, iCont);\n sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); VdbeCoverage(v);\n sqlite3VdbeResolveLabel(v, iBreak);\n sqlite3VdbeAddOp2(v, OP_Close, unionTab, 0);\n }\n break;\n }\n default: assert( p->op==TK_INTERSECT ); {\n int tab1, tab2;\n int iCont, iBreak, iStart;\n Expr *pLimit;\n int addr;\n SelectDest intersectdest;\n int r1;\n \n /* INTERSECT is different from the others since it requires\n ** two temporary tables. Hence it has its own case. Begin\n ** by allocating the tables we will need.\n */\n tab1 = pParse->nTab++;\n tab2 = pParse->nTab++;\n assert( p->pOrderBy==0 );\n \n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0);\n assert( p->addrOpenEphm[0] == -1 );\n p->addrOpenEphm[0] = addr;\n findRightmost(p)->selFlags |= SF_UsesEphemeral;\n assert( p->pEList );\n \n /* Code the SELECTs to our left into temporary table \"tab1\".\n */\n sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1);\n rc = sqlite3Select(pParse, pPrior, &intersectdest);\n if( rc ){\n goto multi_select_end;\n }\n \n /* Code the current SELECT into temporary table \"tab2\"\n */\n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0);\n assert( p->addrOpenEphm[1] == -1 );\n p->addrOpenEphm[1] = addr;\n p->pPrior = 0;\n pLimit = p->pLimit;\n p->pLimit = 0;\n intersectdest.iSDParm = tab2;\n ExplainQueryPlan((pParse, 1, \"%s USING TEMP B-TREE\",\n selectOpName(p->op)));\n rc = sqlite3Select(pParse, p, &intersectdest);\n testcase( rc!=SQLITE_OK );\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n if( p->nSelectRow>pPrior->nSelectRow ){\n p->nSelectRow = pPrior->nSelectRow;\n }\n sqlite3ExprDelete(db, p->pLimit);\n p->pLimit = pLimit;\n \n /* Generate code to take the intersection of the two temporary\n ** tables.\n */\n assert( p->pEList );\n iBreak = sqlite3VdbeMakeLabel(pParse);\n iCont = sqlite3VdbeMakeLabel(pParse);\n computeLimitRegisters(pParse, p, iBreak);\n sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v);\n r1 = sqlite3GetTempReg(pParse);\n iStart = sqlite3VdbeAddOp2(v, OP_RowData, tab1, r1);\n sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0);\n VdbeCoverage(v);\n sqlite3ReleaseTempReg(pParse, r1);\n selectInnerLoop(pParse, p, tab1,\n 0, 0, &dest, iCont, iBreak);\n sqlite3VdbeResolveLabel(v, iCont);\n sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); VdbeCoverage(v);\n sqlite3VdbeResolveLabel(v, iBreak);\n sqlite3VdbeAddOp2(v, OP_Close, tab2, 0);\n sqlite3VdbeAddOp2(v, OP_Close, tab1, 0);\n break;\n }\n }\n \n #ifndef SQLITE_OMIT_EXPLAIN\n if( p->pNext==0 ){\n ExplainQueryPlanPop(pParse);\n }\n #endif\n }\n \n /* Compute collating sequences used by \n ** temporary tables needed to implement the compound select.\n ** Attach the KeyInfo structure to all temporary tables.\n **\n ** This section is run by the right-most SELECT statement only.\n ** SELECT statements to the left always skip this part. The right-most\n ** SELECT might also skip this part if it has no ORDER BY clause and\n ** no temp tables are required.\n */\n if( p->selFlags & SF_UsesEphemeral ){\n int i; /* Loop counter */\n KeyInfo *pKeyInfo; /* Collating sequence for the result set */\n Select *pLoop; /* For looping through SELECT statements */\n CollSeq **apColl; /* For looping through pKeyInfo->aColl[] */\n int nCol; /* Number of columns in result set */\n\n assert( p->pNext==0 );\n nCol = p->pEList->nExpr;\n pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1);\n if( !pKeyInfo ){\n rc = SQLITE_NOMEM_BKPT;\n goto multi_select_end;\n }\n for(i=0, apColl=pKeyInfo->aColl; ipDfltColl;\n }\n }\n\n for(pLoop=p; pLoop; pLoop=pLoop->pPrior){\n for(i=0; i<2; i++){\n int addr = pLoop->addrOpenEphm[i];\n if( addr<0 ){\n /* If [0] is unused then [1] is also unused. So we can\n ** always safely abort as soon as the first unused slot is found */\n assert( pLoop->addrOpenEphm[1]<0 );\n break;\n }\n sqlite3VdbeChangeP2(v, addr, nCol);\n sqlite3VdbeChangeP4(v, addr, (char*)sqlite3KeyInfoRef(pKeyInfo),\n P4_KEYINFO);\n pLoop->addrOpenEphm[i] = -1;\n }\n }\n sqlite3KeyInfoUnref(pKeyInfo);\n }\n\nmulti_select_end:\n pDest->iSdst = dest.iSdst;\n pDest->nSdst = dest.nSdst;\n sqlite3SelectDelete(db, pDelete);\n return rc;\n}","target":"static int multiSelect(\n Parse *pParse, /* Parsing context */\n Select *p, /* The right-most of SELECTs to be coded */\n SelectDest *pDest /* What to do with query results */\n){\n int rc = SQLITE_OK; /* Success code from a subroutine */\n Select *pPrior; /* Another SELECT immediately to our left */\n Vdbe *v; /* Generate code to this VDBE */\n SelectDest dest; /* Alternative data destination */\n Select *pDelete = 0; /* Chain of simple selects to delete */\n sqlite3 *db; /* Database connection */\n\n /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only\n ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.\n */\n assert( p && p->pPrior ); /* Calling function guarantees this much */\n assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION );\n assert( p->selFlags & SF_Compound );\n db = pParse->db;\n pPrior = p->pPrior;\n dest = *pDest;\n if( pPrior->pOrderBy || pPrior->pLimit ){\n sqlite3ErrorMsg(pParse,\"%s clause should come after %s not before\",\n pPrior->pOrderBy!=0 ? \"ORDER BY\" : \"LIMIT\", selectOpName(p->op));\n rc = 1;\n goto multi_select_end;\n }\n\n v = sqlite3GetVdbe(pParse);\n assert( v!=0 ); /* The VDBE already created by calling function */\n\n /* Create the destination temporary table if necessary\n */\n if( dest.eDest==SRT_EphemTab ){\n assert( p->pEList );\n sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iSDParm, p->pEList->nExpr);\n dest.eDest = SRT_Table;\n }\n\n /* Special handling for a compound-select that originates as a VALUES clause.\n */\n if( p->selFlags & SF_MultiValue ){\n rc = multiSelectValues(pParse, p, &dest);\n if( rc>=0 ) goto multi_select_end;\n rc = SQLITE_OK;\n }\n\n /* Make sure all SELECTs in the statement have the same number of elements\n ** in their result sets.\n */\n assert( p->pEList && pPrior->pEList );\n assert( p->pEList->nExpr==pPrior->pEList->nExpr );\n\n#ifndef SQLITE_OMIT_CTE\n if( p->selFlags & SF_Recursive ){\n generateWithRecursiveQuery(pParse, p, &dest);\n }else\n#endif\n\n /* Compound SELECTs that have an ORDER BY clause are handled separately.\n */\n if( p->pOrderBy ){\n return multiSelectOrderBy(pParse, p, pDest);\n }else{\n\n#ifndef SQLITE_OMIT_EXPLAIN\n if( pPrior->pPrior==0 ){\n ExplainQueryPlan((pParse, 1, \"COMPOUND QUERY\"));\n ExplainQueryPlan((pParse, 1, \"LEFT-MOST SUBQUERY\"));\n }\n#endif\n\n /* Generate code for the left and right SELECT statements.\n */\n switch( p->op ){\n case TK_ALL: {\n int addr = 0;\n int nLimit;\n assert( !pPrior->pLimit );\n pPrior->iLimit = p->iLimit;\n pPrior->iOffset = p->iOffset;\n pPrior->pLimit = p->pLimit;\n rc = sqlite3Select(pParse, pPrior, &dest);\n p->pLimit = 0;\n if( rc ){\n goto multi_select_end;\n }\n p->pPrior = 0;\n p->iLimit = pPrior->iLimit;\n p->iOffset = pPrior->iOffset;\n if( p->iLimit ){\n addr = sqlite3VdbeAddOp1(v, OP_IfNot, p->iLimit); VdbeCoverage(v);\n VdbeComment((v, \"Jump ahead if LIMIT reached\"));\n if( p->iOffset ){\n sqlite3VdbeAddOp3(v, OP_OffsetLimit,\n p->iLimit, p->iOffset+1, p->iOffset);\n }\n }\n ExplainQueryPlan((pParse, 1, \"UNION ALL\"));\n rc = sqlite3Select(pParse, p, &dest);\n testcase( rc!=SQLITE_OK );\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n if( pPrior->pLimit\n && sqlite3ExprIsInteger(pPrior->pLimit->pLeft, &nLimit)\n && nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit) \n ){\n p->nSelectRow = sqlite3LogEst((u64)nLimit);\n }\n if( addr ){\n sqlite3VdbeJumpHere(v, addr);\n }\n break;\n }\n case TK_EXCEPT:\n case TK_UNION: {\n int unionTab; /* Cursor number of the temp table holding result */\n u8 op = 0; /* One of the SRT_ operations to apply to self */\n int priorOp; /* The SRT_ operation to apply to prior selects */\n Expr *pLimit; /* Saved values of p->nLimit */\n int addr;\n SelectDest uniondest;\n \n testcase( p->op==TK_EXCEPT );\n testcase( p->op==TK_UNION );\n priorOp = SRT_Union;\n if( dest.eDest==priorOp ){\n /* We can reuse a temporary table generated by a SELECT to our\n ** right.\n */\n assert( p->pLimit==0 ); /* Not allowed on leftward elements */\n unionTab = dest.iSDParm;\n }else{\n /* We will need to create our own temporary table to hold the\n ** intermediate results.\n */\n unionTab = pParse->nTab++;\n assert( p->pOrderBy==0 );\n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0);\n assert( p->addrOpenEphm[0] == -1 );\n p->addrOpenEphm[0] = addr;\n findRightmost(p)->selFlags |= SF_UsesEphemeral;\n assert( p->pEList );\n }\n \n /* Code the SELECT statements to our left\n */\n assert( !pPrior->pOrderBy );\n sqlite3SelectDestInit(&uniondest, priorOp, unionTab);\n rc = sqlite3Select(pParse, pPrior, &uniondest);\n if( rc ){\n goto multi_select_end;\n }\n \n /* Code the current SELECT statement\n */\n if( p->op==TK_EXCEPT ){\n op = SRT_Except;\n }else{\n assert( p->op==TK_UNION );\n op = SRT_Union;\n }\n p->pPrior = 0;\n pLimit = p->pLimit;\n p->pLimit = 0;\n uniondest.eDest = op;\n ExplainQueryPlan((pParse, 1, \"%s USING TEMP B-TREE\",\n selectOpName(p->op)));\n rc = sqlite3Select(pParse, p, &uniondest);\n testcase( rc!=SQLITE_OK );\n /* Query flattening in sqlite3Select() might refill p->pOrderBy.\n ** Be sure to delete p->pOrderBy, therefore, to avoid a memory leak. */\n sqlite3ExprListDelete(db, p->pOrderBy);\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n p->pOrderBy = 0;\n if( p->op==TK_UNION ){\n p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n }\n sqlite3ExprDelete(db, p->pLimit);\n p->pLimit = pLimit;\n p->iLimit = 0;\n p->iOffset = 0;\n \n /* Convert the data in the temporary table into whatever form\n ** it is that we currently need.\n */\n assert( unionTab==dest.iSDParm || dest.eDest!=priorOp );\n if( dest.eDest!=priorOp ){\n int iCont, iBreak, iStart;\n assert( p->pEList );\n iBreak = sqlite3VdbeMakeLabel(pParse);\n iCont = sqlite3VdbeMakeLabel(pParse);\n computeLimitRegisters(pParse, p, iBreak);\n sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v);\n iStart = sqlite3VdbeCurrentAddr(v);\n selectInnerLoop(pParse, p, unionTab,\n 0, 0, &dest, iCont, iBreak);\n sqlite3VdbeResolveLabel(v, iCont);\n sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); VdbeCoverage(v);\n sqlite3VdbeResolveLabel(v, iBreak);\n sqlite3VdbeAddOp2(v, OP_Close, unionTab, 0);\n }\n break;\n }\n default: assert( p->op==TK_INTERSECT ); {\n int tab1, tab2;\n int iCont, iBreak, iStart;\n Expr *pLimit;\n int addr;\n SelectDest intersectdest;\n int r1;\n \n /* INTERSECT is different from the others since it requires\n ** two temporary tables. Hence it has its own case. Begin\n ** by allocating the tables we will need.\n */\n tab1 = pParse->nTab++;\n tab2 = pParse->nTab++;\n assert( p->pOrderBy==0 );\n \n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0);\n assert( p->addrOpenEphm[0] == -1 );\n p->addrOpenEphm[0] = addr;\n findRightmost(p)->selFlags |= SF_UsesEphemeral;\n assert( p->pEList );\n \n /* Code the SELECTs to our left into temporary table \"tab1\".\n */\n sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1);\n rc = sqlite3Select(pParse, pPrior, &intersectdest);\n if( rc ){\n goto multi_select_end;\n }\n \n /* Code the current SELECT into temporary table \"tab2\"\n */\n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0);\n assert( p->addrOpenEphm[1] == -1 );\n p->addrOpenEphm[1] = addr;\n p->pPrior = 0;\n pLimit = p->pLimit;\n p->pLimit = 0;\n intersectdest.iSDParm = tab2;\n ExplainQueryPlan((pParse, 1, \"%s USING TEMP B-TREE\",\n selectOpName(p->op)));\n rc = sqlite3Select(pParse, p, &intersectdest);\n testcase( rc!=SQLITE_OK );\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n if( p->nSelectRow>pPrior->nSelectRow ){\n p->nSelectRow = pPrior->nSelectRow;\n }\n sqlite3ExprDelete(db, p->pLimit);\n p->pLimit = pLimit;\n \n /* Generate code to take the intersection of the two temporary\n ** tables.\n */\n assert( p->pEList );\n iBreak = sqlite3VdbeMakeLabel(pParse);\n iCont = sqlite3VdbeMakeLabel(pParse);\n computeLimitRegisters(pParse, p, iBreak);\n sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v);\n r1 = sqlite3GetTempReg(pParse);\n iStart = sqlite3VdbeAddOp2(v, OP_RowData, tab1, r1);\n sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0);\n VdbeCoverage(v);\n sqlite3ReleaseTempReg(pParse, r1);\n selectInnerLoop(pParse, p, tab1,\n 0, 0, &dest, iCont, iBreak);\n sqlite3VdbeResolveLabel(v, iCont);\n sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); VdbeCoverage(v);\n sqlite3VdbeResolveLabel(v, iBreak);\n sqlite3VdbeAddOp2(v, OP_Close, tab2, 0);\n sqlite3VdbeAddOp2(v, OP_Close, tab1, 0);\n break;\n }\n }\n \n #ifndef SQLITE_OMIT_EXPLAIN\n if( p->pNext==0 ){\n ExplainQueryPlanPop(pParse);\n }\n #endif\n }\n if( pParse->nErr ) goto multi_select_end;\n \n /* Compute collating sequences used by \n ** temporary tables needed to implement the compound select.\n ** Attach the KeyInfo structure to all temporary tables.\n **\n ** This section is run by the right-most SELECT statement only.\n ** SELECT statements to the left always skip this part. The right-most\n ** SELECT might also skip this part if it has no ORDER BY clause and\n ** no temp tables are required.\n */\n if( p->selFlags & SF_UsesEphemeral ){\n int i; /* Loop counter */\n KeyInfo *pKeyInfo; /* Collating sequence for the result set */\n Select *pLoop; /* For looping through SELECT statements */\n CollSeq **apColl; /* For looping through pKeyInfo->aColl[] */\n int nCol; /* Number of columns in result set */\n\n assert( p->pNext==0 );\n nCol = p->pEList->nExpr;\n pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1);\n if( !pKeyInfo ){\n rc = SQLITE_NOMEM_BKPT;\n goto multi_select_end;\n }\n for(i=0, apColl=pKeyInfo->aColl; ipDfltColl;\n }\n }\n\n for(pLoop=p; pLoop; pLoop=pLoop->pPrior){\n for(i=0; i<2; i++){\n int addr = pLoop->addrOpenEphm[i];\n if( addr<0 ){\n /* If [0] is unused then [1] is also unused. So we can\n ** always safely abort as soon as the first unused slot is found */\n assert( pLoop->addrOpenEphm[1]<0 );\n break;\n }\n sqlite3VdbeChangeP2(v, addr, nCol);\n sqlite3VdbeChangeP4(v, addr, (char*)sqlite3KeyInfoRef(pKeyInfo),\n P4_KEYINFO);\n pLoop->addrOpenEphm[i] = -1;\n }\n }\n sqlite3KeyInfoUnref(pKeyInfo);\n }\n\nmulti_select_end:\n pDest->iSdst = dest.iSdst;\n pDest->nSdst = dest.nSdst;\n sqlite3SelectDelete(db, pDelete);\n return rc;\n}","lang":"c","vul_type":"cwe-476","target_token_count":3454,"sven_meta":{"func_name":"multiSelect","file_name":"src/select.c","commit_link":"github.com/sqlite/sqlite/commit/8428b3b437569338a9d1e10c4cd8154acbe33089","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#2-8fd70ccfcc3d","input":"static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n explicit_vr[MagickPathExtent],\n implicit_vr[MagickPathExtent],\n magick[MagickPathExtent],\n photometric[MagickPathExtent];\n\n DCMStreamInfo\n *stream_info;\n\n Image\n *image;\n\n int\n *bluemap,\n datum,\n *greenmap,\n *graymap,\n index,\n *redmap;\n\n MagickBooleanType\n explicit_file,\n explicit_retry,\n polarity,\n sequence,\n use_explicit;\n\n MagickOffsetType\n offset;\n\n Quantum\n *scale;\n\n register ssize_t\n i,\n x;\n\n register Quantum\n *q;\n\n register unsigned char\n *p;\n\n size_t\n bits_allocated,\n bytes_per_pixel,\n colors,\n depth,\n height,\n length,\n mask,\n max_value,\n number_scenes,\n quantum,\n samples_per_pixel,\n signed_data,\n significant_bits,\n status,\n width,\n window_width;\n\n ssize_t\n count,\n rescale_intercept,\n rescale_slope,\n scene,\n window_center,\n y;\n\n unsigned char\n *data;\n\n unsigned short\n group,\n element;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image->depth=8UL;\n image->endian=LSBEndian;\n /*\n Read DCM preamble.\n */\n stream_info=(DCMStreamInfo *) AcquireMagickMemory(sizeof(*stream_info));\n if (stream_info == (DCMStreamInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(stream_info,0,sizeof(*stream_info));\n count=ReadBlob(image,128,(unsigned char *) magick);\n if (count != 128)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n count=ReadBlob(image,4,(unsigned char *) magick);\n if ((count != 4) || (LocaleNCompare(magick,\"DICM\",4) != 0))\n {\n offset=SeekBlob(image,0L,SEEK_SET);\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Read DCM Medical image.\n */\n (void) CopyMagickString(photometric,\"MONOCHROME1 \",MagickPathExtent);\n bits_allocated=8;\n bytes_per_pixel=1;\n polarity=MagickFalse;\n data=(unsigned char *) NULL;\n depth=8;\n element=0;\n explicit_vr[2]='\\0';\n explicit_file=MagickFalse;\n colors=0;\n redmap=(int *) NULL;\n greenmap=(int *) NULL;\n bluemap=(int *) NULL;\n graymap=(int *) NULL;\n height=0;\n max_value=255UL;\n mask=0xffff;\n number_scenes=1;\n rescale_intercept=0;\n rescale_slope=1;\n samples_per_pixel=1;\n scale=(Quantum *) NULL;\n sequence=MagickFalse;\n signed_data=(~0UL);\n significant_bits=0;\n use_explicit=MagickFalse;\n explicit_retry = MagickFalse;\n width=0;\n window_center=0;\n window_width=0;\n for (group=0; (group != 0x7FE0) || (element != 0x0010) ||\n (sequence != MagickFalse); )\n {\n /*\n Read a group.\n */\n image->offset=(ssize_t) TellBlob(image);\n group=ReadBlobLSBShort(image);\n element=ReadBlobLSBShort(image);\n if ((group != 0x0002) && (image->endian == MSBEndian))\n {\n group=(unsigned short) ((group << 8) | ((group >> 8) & 0xFF));\n element=(unsigned short) ((element << 8) | ((element >> 8) & 0xFF));\n }\n quantum=0;\n /*\n Find corresponding VR for this group and element.\n */\n for (i=0; dicom_info[i].group < 0xffff; i++)\n if ((group == dicom_info[i].group) && (element == dicom_info[i].element))\n break;\n (void) CopyMagickString(implicit_vr,dicom_info[i].vr,MagickPathExtent);\n count=ReadBlob(image,2,(unsigned char *) explicit_vr);\n if (count != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n /*\n Check for \"explicitness\", but meta-file headers always explicit.\n */\n if ((explicit_file == MagickFalse) && (group != 0x0002))\n explicit_file=(isupper((unsigned char) *explicit_vr) != MagickFalse) &&\n (isupper((unsigned char) *(explicit_vr+1)) != MagickFalse) ?\n MagickTrue : MagickFalse;\n use_explicit=((group == 0x0002) && (explicit_retry == MagickFalse)) ||\n (explicit_file != MagickFalse) ? MagickTrue : MagickFalse;\n if ((use_explicit != MagickFalse) && (strncmp(implicit_vr,\"xs\",2) == 0))\n (void) CopyMagickString(implicit_vr,explicit_vr,MagickPathExtent);\n if ((use_explicit == MagickFalse) || (strncmp(implicit_vr,\"!!\",2) == 0))\n {\n offset=SeekBlob(image,(MagickOffsetType) -2,SEEK_CUR);\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n quantum=4;\n }\n else\n {\n /*\n Assume explicit type.\n */\n quantum=2;\n if ((strncmp(explicit_vr,\"OB\",2) == 0) ||\n (strncmp(explicit_vr,\"UN\",2) == 0) ||\n (strncmp(explicit_vr,\"OW\",2) == 0) ||\n (strncmp(explicit_vr,\"SQ\",2) == 0))\n {\n (void) ReadBlobLSBShort(image);\n quantum=4;\n }\n }\n datum=0;\n if (quantum == 4)\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedLong(image);\n else\n datum=ReadBlobSignedLong(image);\n }\n else\n if (quantum == 2)\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedShort(image);\n else\n datum=ReadBlobSignedShort(image);\n }\n quantum=0;\n length=1;\n if (datum != 0)\n {\n if ((strncmp(implicit_vr,\"SS\",2) == 0) ||\n (strncmp(implicit_vr,\"US\",2) == 0))\n quantum=2;\n else\n if ((strncmp(implicit_vr,\"UL\",2) == 0) ||\n (strncmp(implicit_vr,\"SL\",2) == 0) ||\n (strncmp(implicit_vr,\"FL\",2) == 0))\n quantum=4;\n else\n if (strncmp(implicit_vr,\"FD\",2) != 0)\n quantum=1;\n else\n quantum=8;\n if (datum != ~0)\n length=(size_t) datum/quantum;\n else\n {\n /*\n Sequence and item of undefined length.\n */\n quantum=0;\n length=0;\n }\n }\n if (image_info->verbose != MagickFalse)\n {\n /*\n Display Dicom info.\n */\n if (use_explicit == MagickFalse)\n explicit_vr[0]='\\0';\n for (i=0; dicom_info[i].description != (char *) NULL; i++)\n if ((group == dicom_info[i].group) &&\n (element == dicom_info[i].element))\n break;\n (void) FormatLocaleFile(stdout,\"0x%04lX %4ld %s-%s (0x%04lx,0x%04lx)\",\n (unsigned long) image->offset,(long) length,implicit_vr,explicit_vr,\n (unsigned long) group,(unsigned long) element);\n if (dicom_info[i].description != (char *) NULL)\n (void) FormatLocaleFile(stdout,\" %s\",dicom_info[i].description);\n (void) FormatLocaleFile(stdout,\": \");\n }\n if ((sequence == MagickFalse) && (group == 0x7FE0) && (element == 0x0010))\n {\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"\\n\");\n break;\n }\n /*\n Allocate space and read an array.\n */\n data=(unsigned char *) NULL;\n if ((length == 1) && (quantum == 1))\n datum=ReadBlobByte(image);\n else\n if ((length == 1) && (quantum == 2))\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedShort(image);\n else\n datum=ReadBlobSignedShort(image);\n }\n else\n if ((length == 1) && (quantum == 4))\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedLong(image);\n else\n datum=ReadBlobSignedLong(image);\n }\n else\n if ((quantum != 0) && (length != 0))\n {\n if (~length >= 1)\n data=(unsigned char *) AcquireQuantumMemory(length+1,quantum*\n sizeof(*data));\n if (data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n count=ReadBlob(image,(size_t) quantum*length,data);\n if (count != (ssize_t) (quantum*length))\n {\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"count=%d quantum=%d \"\n \"length=%d group=%d\\n\",(int) count,(int) quantum,(int)\n length,(int) group);\n ThrowReaderException(CorruptImageError,\n \"InsufficientImageDataInFile\");\n }\n data[length*quantum]='\\0';\n }\n else\n if ((unsigned int) datum == 0xFFFFFFFFU)\n {\n sequence=MagickTrue;\n continue;\n }\n\n if ((unsigned int) ((group << 16) | element) == 0xFFFEE0DD)\n {\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n sequence=MagickFalse;\n continue;\n }\n\n if (sequence != MagickFalse)\n {\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n continue;\n }\n\n switch (group)\n {\n case 0x0002:\n {\n switch (element)\n {\n case 0x0010:\n {\n char\n transfer_syntax[MagickPathExtent];\n\n /*\n Transfer Syntax.\n */\n if ((datum == 0) && (explicit_retry == MagickFalse))\n {\n explicit_retry=MagickTrue;\n (void) SeekBlob(image,(MagickOffsetType) 0,SEEK_SET);\n group=0;\n element=0;\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\n \"Corrupted image - trying explicit format\\n\");\n break;\n }\n *transfer_syntax='\\0';\n if (data != (unsigned char *) NULL)\n (void) CopyMagickString(transfer_syntax,(char *) data,\n MagickPathExtent);\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"transfer_syntax=%s\\n\",\n (const char *) transfer_syntax);\n if (strncmp(transfer_syntax,\"1.2.840.10008.1.2\",17) == 0)\n {\n int\n count,\n subtype,\n type;\n\n type=1;\n subtype=0;\n if (strlen(transfer_syntax) > 17)\n {\n count=sscanf(transfer_syntax+17,\".%d.%d\",&type,&subtype);\n if (count < 1)\n ThrowReaderException(CorruptImageError,\n \"ImproperImageHeader\");\n }\n switch (type)\n {\n case 1:\n {\n image->endian=LSBEndian;\n break;\n }\n case 2:\n {\n image->endian=MSBEndian;\n break;\n }\n case 4:\n {\n if ((subtype >= 80) && (subtype <= 81))\n image->compression=JPEGCompression;\n else\n if ((subtype >= 90) && (subtype <= 93))\n image->compression=JPEG2000Compression;\n else\n image->compression=JPEGCompression;\n break;\n }\n case 5:\n {\n image->compression=RLECompression;\n break;\n }\n }\n }\n break;\n }\n default:\n break;\n }\n break;\n }\n case 0x0028:\n {\n switch (element)\n {\n case 0x0002:\n {\n /*\n Samples per pixel.\n */\n samples_per_pixel=(size_t) datum;\n break;\n }\n case 0x0004:\n {\n /*\n Photometric interpretation.\n */\n for (i=0; i < (ssize_t) MagickMin(length,MagickPathExtent-1); i++)\n photometric[i]=(char) data[i];\n photometric[i]='\\0';\n polarity=LocaleCompare(photometric,\"MONOCHROME1 \") == 0 ?\n MagickTrue : MagickFalse;\n break;\n }\n case 0x0006:\n {\n /*\n Planar configuration.\n */\n if (datum == 1)\n image->interlace=PlaneInterlace;\n break;\n }\n case 0x0008:\n {\n /*\n Number of frames.\n */\n number_scenes=StringToUnsignedLong((char *) data);\n break;\n }\n case 0x0010:\n {\n /*\n Image rows.\n */\n height=(size_t) datum;\n break;\n }\n case 0x0011:\n {\n /*\n Image columns.\n */\n width=(size_t) datum;\n break;\n }\n case 0x0100:\n {\n /*\n Bits allocated.\n */\n bits_allocated=(size_t) datum;\n bytes_per_pixel=1;\n if (datum > 8)\n bytes_per_pixel=2;\n depth=bits_allocated;\n if (depth > 32)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n max_value=(1UL << bits_allocated)-1;\n break;\n }\n case 0x0101:\n {\n /*\n Bits stored.\n */\n significant_bits=(size_t) datum;\n bytes_per_pixel=1;\n if (significant_bits > 8)\n bytes_per_pixel=2;\n depth=significant_bits;\n if (depth > 32)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n max_value=(1UL << significant_bits)-1;\n mask=(size_t) GetQuantumRange(significant_bits);\n break;\n }\n case 0x0102:\n {\n /*\n High bit.\n */\n break;\n }\n case 0x0103:\n {\n /*\n Pixel representation.\n */\n signed_data=(size_t) datum;\n break;\n }\n case 0x1050:\n {\n /*\n Visible pixel range: center.\n */\n if (data != (unsigned char *) NULL)\n window_center=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1051:\n {\n /*\n Visible pixel range: width.\n */\n if (data != (unsigned char *) NULL)\n window_width=StringToUnsignedLong((char *) data);\n break;\n }\n case 0x1052:\n {\n /*\n Rescale intercept\n */\n if (data != (unsigned char *) NULL)\n rescale_intercept=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1053:\n {\n /*\n Rescale slope\n */\n if (data != (unsigned char *) NULL)\n rescale_slope=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1200:\n case 0x3006:\n {\n /*\n Populate graymap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/bytes_per_pixel);\n datum=(int) colors;\n graymap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*graymap));\n if (graymap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) colors; i++)\n if (bytes_per_pixel == 1)\n graymap[i]=(int) data[i];\n else\n graymap[i]=(int) ((short *) data)[i];\n break;\n }\n case 0x1201:\n {\n unsigned short\n index;\n\n /*\n Populate redmap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n redmap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*redmap));\n if (redmap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n redmap[i]=(int) index;\n p+=2;\n }\n break;\n }\n case 0x1202:\n {\n unsigned short\n index;\n\n /*\n Populate greenmap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n greenmap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*greenmap));\n if (greenmap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n greenmap[i]=(int) index;\n p+=2;\n }\n break;\n }\n case 0x1203:\n {\n unsigned short\n index;\n\n /*\n Populate bluemap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n bluemap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*bluemap));\n if (bluemap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n bluemap[i]=(int) index;\n p+=2;\n }\n break;\n }\n default:\n break;\n }\n break;\n }\n case 0x2050:\n {\n switch (element)\n {\n case 0x0020:\n {\n if ((data != (unsigned char *) NULL) &&\n (strncmp((char *) data,\"INVERSE\",7) == 0))\n polarity=MagickTrue;\n break;\n }\n default:\n break;\n }\n break;\n }\n default:\n break;\n }\n if (data != (unsigned char *) NULL)\n {\n char\n *attribute;\n\n for (i=0; dicom_info[i].description != (char *) NULL; i++)\n if ((group == dicom_info[i].group) &&\n (element == dicom_info[i].element))\n break;\n if (dicom_info[i].description != (char *) NULL)\n {\n attribute=AcquireString(\"dcm:\");\n (void) ConcatenateString(&attribute,dicom_info[i].description);\n for (i=0; i < (ssize_t) MagickMax(length,4); i++)\n if (isprint((int) data[i]) == MagickFalse)\n break;\n if ((i == (ssize_t) length) || (length > 4))\n {\n (void) SubstituteString(&attribute,\" \",\"\");\n (void) SetImageProperty(image,attribute,(char *) data,exception);\n }\n attribute=DestroyString(attribute);\n }\n }\n if (image_info->verbose != MagickFalse)\n {\n if (data == (unsigned char *) NULL)\n (void) FormatLocaleFile(stdout,\"%d\\n\",datum);\n else\n {\n /*\n Display group data.\n */\n for (i=0; i < (ssize_t) MagickMax(length,4); i++)\n if (isprint((int) data[i]) == MagickFalse)\n break;\n if ((i != (ssize_t) length) && (length <= 4))\n {\n ssize_t\n j;\n\n datum=0;\n for (j=(ssize_t) length-1; j >= 0; j--)\n datum=(256*datum+data[j]);\n (void) FormatLocaleFile(stdout,\"%d\",datum);\n }\n else\n for (i=0; i < (ssize_t) length; i++)\n if (isprint((int) data[i]) != MagickFalse)\n (void) FormatLocaleFile(stdout,\"%c\",data[i]);\n else\n (void) FormatLocaleFile(stdout,\"%c\",'.');\n (void) FormatLocaleFile(stdout,\"\\n\");\n }\n }\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n }\n if ((width == 0) || (height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n image->columns=(size_t) width;\n image->rows=(size_t) height;\n if (signed_data == 0xffff)\n signed_data=(size_t) (significant_bits == 16 ? 1 : 0);\n if ((image->compression == JPEGCompression) ||\n (image->compression == JPEG2000Compression))\n {\n Image\n *images;\n\n ImageInfo\n *read_info;\n\n int\n c;\n\n size_t\n length;\n\n unsigned int\n tag;\n\n /*\n Read offset table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n (void) tag;\n length=(size_t) ReadBlobLSBLong(image);\n stream_info->offset_count=length >> 2;\n if (stream_info->offset_count != 0)\n {\n MagickOffsetType\n offset;\n\n stream_info->offsets=(ssize_t *) AcquireQuantumMemory(\n stream_info->offset_count,sizeof(*stream_info->offsets));\n if (stream_info->offsets == (ssize_t *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n offset=TellBlob(image);\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]+=offset;\n }\n /*\n Handle non-native image formats.\n */\n read_info=CloneImageInfo(image_info);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n images=NewImageList();\n for (scene=0; scene < (ssize_t) number_scenes; scene++)\n {\n char\n filename[MagickPathExtent];\n\n const char\n *property;\n\n FILE\n *file;\n\n Image\n *jpeg_image;\n\n int\n unique_file;\n\n unsigned int\n tag;\n\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n length=(size_t) ReadBlobLSBLong(image);\n if (tag == 0xFFFEE0DD)\n break; /* sequence delimiter tag */\n if (tag != 0xFFFEE000)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n file=(FILE *) NULL;\n unique_file=AcquireUniqueFileResource(filename);\n if (unique_file != -1)\n file=fdopen(unique_file,\"wb\");\n if (file == (FILE *) NULL)\n {\n (void) RelinquishUniqueFileResource(filename);\n ThrowFileException(exception,FileOpenError,\n \"UnableToCreateTemporaryFile\",filename);\n break;\n }\n for ( ; length != 0; length--)\n {\n c=ReadBlobByte(image);\n if (c == EOF)\n {\n ThrowFileException(exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n break;\n }\n (void) fputc(c,file);\n }\n (void) fclose(file);\n (void) FormatLocaleString(read_info->filename,MagickPathExtent,\n \"jpeg:%s\",filename);\n if (image->compression == JPEG2000Compression)\n (void) FormatLocaleString(read_info->filename,MagickPathExtent,\n \"j2k:%s\",filename);\n jpeg_image=ReadImage(read_info,exception);\n if (jpeg_image != (Image *) NULL)\n {\n ResetImagePropertyIterator(image);\n property=GetNextImageProperty(image);\n while (property != (const char *) NULL)\n {\n (void) SetImageProperty(jpeg_image,property,\n GetImageProperty(image,property,exception),exception);\n property=GetNextImageProperty(image);\n }\n AppendImageToList(&images,jpeg_image);\n }\n (void) RelinquishUniqueFileResource(filename);\n }\n read_info=DestroyImageInfo(read_info);\n image=DestroyImage(image);\n return(GetFirstImageInList(images));\n }\n if (depth != (1UL*MAGICKCORE_QUANTUM_DEPTH))\n {\n QuantumAny\n range;\n\n size_t\n length;\n\n /*\n Compute pixel scaling table.\n */\n length=(size_t) (GetQuantumRange(depth)+1);\n scale=(Quantum *) AcquireQuantumMemory(length,sizeof(*scale));\n if (scale == (Quantum *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n range=GetQuantumRange(depth);\n for (i=0; i < (ssize_t) (GetQuantumRange(depth)+1); i++)\n scale[i]=ScaleAnyToQuantum((size_t) i,range);\n }\n if (image->compression == RLECompression)\n {\n size_t\n length;\n\n unsigned int\n tag;\n\n /*\n Read RLE offset table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n (void) tag;\n length=(size_t) ReadBlobLSBLong(image);\n stream_info->offset_count=length >> 2;\n if (stream_info->offset_count != 0)\n {\n MagickOffsetType\n offset;\n\n stream_info->offsets=(ssize_t *) AcquireQuantumMemory(\n stream_info->offset_count,sizeof(*stream_info->offsets));\n if (stream_info->offsets == (ssize_t *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n offset=TellBlob(image);\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]+=offset;\n }\n }\n for (scene=0; scene < (ssize_t) number_scenes; scene++)\n {\n if (image_info->ping != MagickFalse)\n break;\n image->columns=(size_t) width;\n image->rows=(size_t) height;\n image->depth=depth;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n break;\n image->colorspace=RGBColorspace;\n if ((image->colormap == (PixelInfo *) NULL) && (samples_per_pixel == 1))\n {\n size_t\n one;\n\n one=1;\n if (colors == 0)\n colors=one << depth;\n if (AcquireImageColormap(image,one << depth,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (redmap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=redmap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].red=(MagickRealType) index;\n }\n if (greenmap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=greenmap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].green=(MagickRealType) index;\n }\n if (bluemap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=bluemap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].blue=(MagickRealType) index;\n }\n if (graymap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=graymap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].red=(MagickRealType) index;\n image->colormap[i].green=(MagickRealType) index;\n image->colormap[i].blue=(MagickRealType) index;\n }\n }\n if (image->compression == RLECompression)\n {\n unsigned int\n tag;\n\n /*\n Read RLE segment table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n stream_info->remaining=(size_t) ReadBlobLSBLong(image);\n if ((tag != 0xFFFEE000) || (stream_info->remaining <= 64) ||\n (EOFBlob(image) != MagickFalse))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n stream_info->count=0;\n stream_info->segment_count=ReadBlobLSBLong(image);\n if (stream_info->segment_count > 1)\n {\n bytes_per_pixel=1;\n depth=8;\n }\n for (i=0; i < 15; i++)\n stream_info->segments[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n stream_info->remaining-=64;\n }\n if ((samples_per_pixel > 1) && (image->interlace == PlaneInterlace))\n {\n /*\n Convert Planar RGB DCM Medical image to pixel packets.\n */\n for (i=0; i < (ssize_t) samples_per_pixel; i++)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n switch ((int) i)\n {\n case 0:\n {\n SetPixelRed(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 1:\n {\n SetPixelGreen(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 2:\n {\n SetPixelBlue(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 3:\n {\n SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n default:\n break;\n }\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n }\n else\n {\n const char\n *option;\n\n int\n byte;\n\n PixelPacket\n pixel;\n\n /*\n Convert DCM Medical image to pixel packets.\n */\n byte=0;\n i=0;\n if ((window_center != 0) && (window_width == 0))\n window_width=(size_t) window_center;\n option=GetImageOption(image_info,\"dcm:display-range\");\n if (option != (const char *) NULL)\n {\n if (LocaleCompare(option,\"reset\") == 0)\n window_width=0;\n }\n (void) ResetMagickMemory(&pixel,0,sizeof(pixel));\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (samples_per_pixel == 1)\n {\n int\n pixel_value;\n\n if (bytes_per_pixel == 1)\n pixel_value=polarity != MagickFalse ?\n ((int) max_value-ReadDCMByte(stream_info,image)) :\n ReadDCMByte(stream_info,image);\n else\n if ((bits_allocated != 12) || (significant_bits != 12))\n {\n if (signed_data)\n pixel_value=ReadDCMSignedShort(stream_info,image);\n else\n pixel_value=ReadDCMShort(stream_info,image);\n if (polarity != MagickFalse)\n pixel_value=(int)max_value-pixel_value;\n }\n else\n {\n if ((i & 0x01) != 0)\n pixel_value=(ReadDCMByte(stream_info,image) << 8) |\n byte;\n else\n {\n pixel_value=ReadDCMSignedShort(stream_info,image);\n byte=(int) (pixel_value & 0x0f);\n pixel_value>>=4;\n }\n i++;\n }\n index=(pixel_value*rescale_slope)+rescale_intercept;\n if (window_width == 0)\n {\n if (signed_data == 1)\n index-=32767;\n }\n else\n {\n ssize_t\n window_max,\n window_min;\n\n window_min=(ssize_t) ceil((double) window_center-\n (window_width-1.0)/2.0-0.5);\n window_max=(ssize_t) floor((double) window_center+\n (window_width-1.0)/2.0+0.5);\n if ((ssize_t)index <= window_min)\n index=0;\n else\n if ((ssize_t)index > window_max)\n index=(int) max_value;\n else\n index=(int) (max_value*(((index-window_center-\n 0.5)/(window_width-1))+0.5));\n }\n index&=mask;\n index=(int) ConstrainColormapIndex(image,(size_t) index,\n exception);\n SetPixelIndex(image,(Quantum) index,q);\n pixel.red=(unsigned int) image->colormap[index].red;\n pixel.green=(unsigned int) image->colormap[index].green;\n pixel.blue=(unsigned int) image->colormap[index].blue;\n }\n else\n {\n if (bytes_per_pixel == 1)\n {\n pixel.red=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.green=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.blue=(unsigned int) ReadDCMByte(stream_info,image);\n }\n else\n {\n pixel.red=ReadDCMShort(stream_info,image);\n pixel.green=ReadDCMShort(stream_info,image);\n pixel.blue=ReadDCMShort(stream_info,image);\n }\n pixel.red&=mask;\n pixel.green&=mask;\n pixel.blue&=mask;\n if (scale != (Quantum *) NULL)\n {\n pixel.red=scale[pixel.red];\n pixel.green=scale[pixel.green];\n pixel.blue=scale[pixel.blue];\n }\n }\n SetPixelRed(image,(Quantum) pixel.red,q);\n SetPixelGreen(image,(Quantum) pixel.green,q);\n SetPixelBlue(image,(Quantum) pixel.blue,q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n if (stream_info->segment_count > 1)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (samples_per_pixel == 1)\n {\n int\n pixel_value;\n\n if (bytes_per_pixel == 1)\n pixel_value=polarity != MagickFalse ?\n ((int) max_value-ReadDCMByte(stream_info,image)) :\n ReadDCMByte(stream_info,image);\n else\n if ((bits_allocated != 12) || (significant_bits != 12))\n {\n pixel_value=(int) (polarity != MagickFalse ?\n (max_value-ReadDCMShort(stream_info,image)) :\n ReadDCMShort(stream_info,image));\n if (signed_data == 1)\n pixel_value=((signed short) pixel_value);\n }\n else\n {\n if ((i & 0x01) != 0)\n pixel_value=(ReadDCMByte(stream_info,image) << 8) |\n byte;\n else\n {\n pixel_value=ReadDCMShort(stream_info,image);\n byte=(int) (pixel_value & 0x0f);\n pixel_value>>=4;\n }\n i++;\n }\n index=(pixel_value*rescale_slope)+rescale_intercept;\n if (window_width == 0)\n {\n if (signed_data == 1)\n index-=32767;\n }\n else\n {\n ssize_t\n window_max,\n window_min;\n\n window_min=(ssize_t) ceil((double) window_center-\n (window_width-1.0)/2.0-0.5);\n window_max=(ssize_t) floor((double) window_center+\n (window_width-1.0)/2.0+0.5);\n if ((ssize_t)index <= window_min)\n index=0;\n else\n if ((ssize_t)index > window_max)\n index=(int) max_value;\n else\n index=(int) (max_value*(((index-window_center-\n 0.5)/(window_width-1))+0.5));\n }\n index&=mask;\n index=(int) ConstrainColormapIndex(image,(size_t) index,\n exception);\n SetPixelIndex(image,(Quantum) (((size_t)\n GetPixelIndex(image,q)) | (((size_t) index) << 8)),q);\n pixel.red=(unsigned int) image->colormap[index].red;\n pixel.green=(unsigned int) image->colormap[index].green;\n pixel.blue=(unsigned int) image->colormap[index].blue;\n }\n else\n {\n if (bytes_per_pixel == 1)\n {\n pixel.red=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.green=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.blue=(unsigned int) ReadDCMByte(stream_info,image);\n }\n else\n {\n pixel.red=ReadDCMShort(stream_info,image);\n pixel.green=ReadDCMShort(stream_info,image);\n pixel.blue=ReadDCMShort(stream_info,image);\n }\n pixel.red&=mask;\n pixel.green&=mask;\n pixel.blue&=mask;\n if (scale != (Quantum *) NULL)\n {\n pixel.red=scale[pixel.red];\n pixel.green=scale[pixel.green];\n pixel.blue=scale[pixel.blue];\n }\n }\n SetPixelRed(image,(Quantum) (((size_t) GetPixelRed(image,q)) |\n (((size_t) pixel.red) << 8)),q);\n SetPixelGreen(image,(Quantum) (((size_t) GetPixelGreen(image,q)) |\n (((size_t) pixel.green) << 8)),q);\n SetPixelBlue(image,(Quantum) (((size_t) GetPixelBlue(image,q)) |\n (((size_t) pixel.blue) << 8)),q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n if (SetImageGray(image,exception) != MagickFalse)\n (void) SetImageColorspace(image,GRAYColorspace,exception);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n if (scene < (ssize_t) (number_scenes-1))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n }\n /*\n Free resources.\n */\n if (stream_info->offsets != (ssize_t *) NULL)\n stream_info->offsets=(ssize_t *)\n RelinquishMagickMemory(stream_info->offsets);\n stream_info=(DCMStreamInfo *) RelinquishMagickMemory(stream_info);\n if (scale != (Quantum *) NULL)\n scale=(Quantum *) RelinquishMagickMemory(scale);\n if (graymap != (int *) NULL)\n graymap=(int *) RelinquishMagickMemory(graymap);\n if (bluemap != (int *) NULL)\n bluemap=(int *) RelinquishMagickMemory(bluemap);\n if (greenmap != (int *) NULL)\n greenmap=(int *) RelinquishMagickMemory(greenmap);\n if (redmap != (int *) NULL)\n redmap=(int *) RelinquishMagickMemory(redmap);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n explicit_vr[MagickPathExtent],\n implicit_vr[MagickPathExtent],\n magick[MagickPathExtent],\n photometric[MagickPathExtent];\n\n DCMStreamInfo\n *stream_info;\n\n Image\n *image;\n\n int\n *bluemap,\n datum,\n *greenmap,\n *graymap,\n index,\n *redmap;\n\n MagickBooleanType\n explicit_file,\n explicit_retry,\n polarity,\n sequence,\n use_explicit;\n\n MagickOffsetType\n offset;\n\n Quantum\n *scale;\n\n register ssize_t\n i,\n x;\n\n register Quantum\n *q;\n\n register unsigned char\n *p;\n\n size_t\n bits_allocated,\n bytes_per_pixel,\n colors,\n depth,\n height,\n length,\n mask,\n max_value,\n number_scenes,\n quantum,\n samples_per_pixel,\n signed_data,\n significant_bits,\n status,\n width,\n window_width;\n\n ssize_t\n count,\n rescale_intercept,\n rescale_slope,\n scene,\n window_center,\n y;\n\n unsigned char\n *data;\n\n unsigned short\n group,\n element;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image->depth=8UL;\n image->endian=LSBEndian;\n /*\n Read DCM preamble.\n */\n stream_info=(DCMStreamInfo *) AcquireMagickMemory(sizeof(*stream_info));\n if (stream_info == (DCMStreamInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(stream_info,0,sizeof(*stream_info));\n count=ReadBlob(image,128,(unsigned char *) magick);\n if (count != 128)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n count=ReadBlob(image,4,(unsigned char *) magick);\n if ((count != 4) || (LocaleNCompare(magick,\"DICM\",4) != 0))\n {\n offset=SeekBlob(image,0L,SEEK_SET);\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Read DCM Medical image.\n */\n (void) CopyMagickString(photometric,\"MONOCHROME1 \",MagickPathExtent);\n bits_allocated=8;\n bytes_per_pixel=1;\n polarity=MagickFalse;\n data=(unsigned char *) NULL;\n depth=8;\n element=0;\n explicit_vr[2]='\\0';\n explicit_file=MagickFalse;\n colors=0;\n redmap=(int *) NULL;\n greenmap=(int *) NULL;\n bluemap=(int *) NULL;\n graymap=(int *) NULL;\n height=0;\n max_value=255UL;\n mask=0xffff;\n number_scenes=1;\n rescale_intercept=0;\n rescale_slope=1;\n samples_per_pixel=1;\n scale=(Quantum *) NULL;\n sequence=MagickFalse;\n signed_data=(~0UL);\n significant_bits=0;\n use_explicit=MagickFalse;\n explicit_retry = MagickFalse;\n width=0;\n window_center=0;\n window_width=0;\n for (group=0; (group != 0x7FE0) || (element != 0x0010) ||\n (sequence != MagickFalse); )\n {\n /*\n Read a group.\n */\n image->offset=(ssize_t) TellBlob(image);\n group=ReadBlobLSBShort(image);\n element=ReadBlobLSBShort(image);\n if ((group != 0x0002) && (image->endian == MSBEndian))\n {\n group=(unsigned short) ((group << 8) | ((group >> 8) & 0xFF));\n element=(unsigned short) ((element << 8) | ((element >> 8) & 0xFF));\n }\n quantum=0;\n /*\n Find corresponding VR for this group and element.\n */\n for (i=0; dicom_info[i].group < 0xffff; i++)\n if ((group == dicom_info[i].group) && (element == dicom_info[i].element))\n break;\n (void) CopyMagickString(implicit_vr,dicom_info[i].vr,MagickPathExtent);\n count=ReadBlob(image,2,(unsigned char *) explicit_vr);\n if (count != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n /*\n Check for \"explicitness\", but meta-file headers always explicit.\n */\n if ((explicit_file == MagickFalse) && (group != 0x0002))\n explicit_file=(isupper((unsigned char) *explicit_vr) != MagickFalse) &&\n (isupper((unsigned char) *(explicit_vr+1)) != MagickFalse) ?\n MagickTrue : MagickFalse;\n use_explicit=((group == 0x0002) && (explicit_retry == MagickFalse)) ||\n (explicit_file != MagickFalse) ? MagickTrue : MagickFalse;\n if ((use_explicit != MagickFalse) && (strncmp(implicit_vr,\"xs\",2) == 0))\n (void) CopyMagickString(implicit_vr,explicit_vr,MagickPathExtent);\n if ((use_explicit == MagickFalse) || (strncmp(implicit_vr,\"!!\",2) == 0))\n {\n offset=SeekBlob(image,(MagickOffsetType) -2,SEEK_CUR);\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n quantum=4;\n }\n else\n {\n /*\n Assume explicit type.\n */\n quantum=2;\n if ((strncmp(explicit_vr,\"OB\",2) == 0) ||\n (strncmp(explicit_vr,\"UN\",2) == 0) ||\n (strncmp(explicit_vr,\"OW\",2) == 0) ||\n (strncmp(explicit_vr,\"SQ\",2) == 0))\n {\n (void) ReadBlobLSBShort(image);\n quantum=4;\n }\n }\n datum=0;\n if (quantum == 4)\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedLong(image);\n else\n datum=ReadBlobSignedLong(image);\n }\n else\n if (quantum == 2)\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedShort(image);\n else\n datum=ReadBlobSignedShort(image);\n }\n quantum=0;\n length=1;\n if (datum != 0)\n {\n if ((strncmp(implicit_vr,\"SS\",2) == 0) ||\n (strncmp(implicit_vr,\"US\",2) == 0))\n quantum=2;\n else\n if ((strncmp(implicit_vr,\"UL\",2) == 0) ||\n (strncmp(implicit_vr,\"SL\",2) == 0) ||\n (strncmp(implicit_vr,\"FL\",2) == 0))\n quantum=4;\n else\n if (strncmp(implicit_vr,\"FD\",2) != 0)\n quantum=1;\n else\n quantum=8;\n if (datum != ~0)\n length=(size_t) datum/quantum;\n else\n {\n /*\n Sequence and item of undefined length.\n */\n quantum=0;\n length=0;\n }\n }\n if (image_info->verbose != MagickFalse)\n {\n /*\n Display Dicom info.\n */\n if (use_explicit == MagickFalse)\n explicit_vr[0]='\\0';\n for (i=0; dicom_info[i].description != (char *) NULL; i++)\n if ((group == dicom_info[i].group) &&\n (element == dicom_info[i].element))\n break;\n (void) FormatLocaleFile(stdout,\"0x%04lX %4ld %s-%s (0x%04lx,0x%04lx)\",\n (unsigned long) image->offset,(long) length,implicit_vr,explicit_vr,\n (unsigned long) group,(unsigned long) element);\n if (dicom_info[i].description != (char *) NULL)\n (void) FormatLocaleFile(stdout,\" %s\",dicom_info[i].description);\n (void) FormatLocaleFile(stdout,\": \");\n }\n if ((sequence == MagickFalse) && (group == 0x7FE0) && (element == 0x0010))\n {\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"\\n\");\n break;\n }\n /*\n Allocate space and read an array.\n */\n data=(unsigned char *) NULL;\n if ((length == 1) && (quantum == 1))\n datum=ReadBlobByte(image);\n else\n if ((length == 1) && (quantum == 2))\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedShort(image);\n else\n datum=ReadBlobSignedShort(image);\n }\n else\n if ((length == 1) && (quantum == 4))\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedLong(image);\n else\n datum=ReadBlobSignedLong(image);\n }\n else\n if ((quantum != 0) && (length != 0))\n {\n if (~length >= 1)\n data=(unsigned char *) AcquireQuantumMemory(length+1,quantum*\n sizeof(*data));\n if (data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n count=ReadBlob(image,(size_t) quantum*length,data);\n if (count != (ssize_t) (quantum*length))\n {\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"count=%d quantum=%d \"\n \"length=%d group=%d\\n\",(int) count,(int) quantum,(int)\n length,(int) group);\n ThrowReaderException(CorruptImageError,\n \"InsufficientImageDataInFile\");\n }\n data[length*quantum]='\\0';\n }\n else\n if ((unsigned int) datum == 0xFFFFFFFFU)\n {\n sequence=MagickTrue;\n continue;\n }\n\n if ((unsigned int) ((group << 16) | element) == 0xFFFEE0DD)\n {\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n sequence=MagickFalse;\n continue;\n }\n\n if (sequence != MagickFalse)\n {\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n continue;\n }\n\n switch (group)\n {\n case 0x0002:\n {\n switch (element)\n {\n case 0x0010:\n {\n char\n transfer_syntax[MagickPathExtent];\n\n /*\n Transfer Syntax.\n */\n if ((datum == 0) && (explicit_retry == MagickFalse))\n {\n explicit_retry=MagickTrue;\n (void) SeekBlob(image,(MagickOffsetType) 0,SEEK_SET);\n group=0;\n element=0;\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\n \"Corrupted image - trying explicit format\\n\");\n break;\n }\n *transfer_syntax='\\0';\n if (data != (unsigned char *) NULL)\n (void) CopyMagickString(transfer_syntax,(char *) data,\n MagickPathExtent);\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"transfer_syntax=%s\\n\",\n (const char *) transfer_syntax);\n if (strncmp(transfer_syntax,\"1.2.840.10008.1.2\",17) == 0)\n {\n int\n count,\n subtype,\n type;\n\n type=1;\n subtype=0;\n if (strlen(transfer_syntax) > 17)\n {\n count=sscanf(transfer_syntax+17,\".%d.%d\",&type,&subtype);\n if (count < 1)\n ThrowReaderException(CorruptImageError,\n \"ImproperImageHeader\");\n }\n switch (type)\n {\n case 1:\n {\n image->endian=LSBEndian;\n break;\n }\n case 2:\n {\n image->endian=MSBEndian;\n break;\n }\n case 4:\n {\n if ((subtype >= 80) && (subtype <= 81))\n image->compression=JPEGCompression;\n else\n if ((subtype >= 90) && (subtype <= 93))\n image->compression=JPEG2000Compression;\n else\n image->compression=JPEGCompression;\n break;\n }\n case 5:\n {\n image->compression=RLECompression;\n break;\n }\n }\n }\n break;\n }\n default:\n break;\n }\n break;\n }\n case 0x0028:\n {\n switch (element)\n {\n case 0x0002:\n {\n /*\n Samples per pixel.\n */\n samples_per_pixel=(size_t) datum;\n break;\n }\n case 0x0004:\n {\n /*\n Photometric interpretation.\n */\n if (data == (unsigned char *) NULL)\n break;\n for (i=0; i < (ssize_t) MagickMin(length,MagickPathExtent-1); i++)\n photometric[i]=(char) data[i];\n photometric[i]='\\0';\n polarity=LocaleCompare(photometric,\"MONOCHROME1 \") == 0 ?\n MagickTrue : MagickFalse;\n break;\n }\n case 0x0006:\n {\n /*\n Planar configuration.\n */\n if (datum == 1)\n image->interlace=PlaneInterlace;\n break;\n }\n case 0x0008:\n {\n /*\n Number of frames.\n */\n if (data == (unsigned char *) NULL)\n break;\n number_scenes=StringToUnsignedLong((char *) data);\n break;\n }\n case 0x0010:\n {\n /*\n Image rows.\n */\n height=(size_t) datum;\n break;\n }\n case 0x0011:\n {\n /*\n Image columns.\n */\n width=(size_t) datum;\n break;\n }\n case 0x0100:\n {\n /*\n Bits allocated.\n */\n bits_allocated=(size_t) datum;\n bytes_per_pixel=1;\n if (datum > 8)\n bytes_per_pixel=2;\n depth=bits_allocated;\n if (depth > 32)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n max_value=(1UL << bits_allocated)-1;\n break;\n }\n case 0x0101:\n {\n /*\n Bits stored.\n */\n significant_bits=(size_t) datum;\n bytes_per_pixel=1;\n if (significant_bits > 8)\n bytes_per_pixel=2;\n depth=significant_bits;\n if (depth > 32)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n max_value=(1UL << significant_bits)-1;\n mask=(size_t) GetQuantumRange(significant_bits);\n break;\n }\n case 0x0102:\n {\n /*\n High bit.\n */\n break;\n }\n case 0x0103:\n {\n /*\n Pixel representation.\n */\n signed_data=(size_t) datum;\n break;\n }\n case 0x1050:\n {\n /*\n Visible pixel range: center.\n */\n if (data != (unsigned char *) NULL)\n window_center=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1051:\n {\n /*\n Visible pixel range: width.\n */\n if (data != (unsigned char *) NULL)\n window_width=StringToUnsignedLong((char *) data);\n break;\n }\n case 0x1052:\n {\n /*\n Rescale intercept\n */\n if (data != (unsigned char *) NULL)\n rescale_intercept=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1053:\n {\n /*\n Rescale slope\n */\n if (data != (unsigned char *) NULL)\n rescale_slope=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1200:\n case 0x3006:\n {\n /*\n Populate graymap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/bytes_per_pixel);\n datum=(int) colors;\n graymap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*graymap));\n if (graymap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) colors; i++)\n if (bytes_per_pixel == 1)\n graymap[i]=(int) data[i];\n else\n graymap[i]=(int) ((short *) data)[i];\n break;\n }\n case 0x1201:\n {\n unsigned short\n index;\n\n /*\n Populate redmap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n redmap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*redmap));\n if (redmap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n redmap[i]=(int) index;\n p+=2;\n }\n break;\n }\n case 0x1202:\n {\n unsigned short\n index;\n\n /*\n Populate greenmap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n greenmap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*greenmap));\n if (greenmap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n greenmap[i]=(int) index;\n p+=2;\n }\n break;\n }\n case 0x1203:\n {\n unsigned short\n index;\n\n /*\n Populate bluemap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n bluemap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*bluemap));\n if (bluemap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n bluemap[i]=(int) index;\n p+=2;\n }\n break;\n }\n default:\n break;\n }\n break;\n }\n case 0x2050:\n {\n switch (element)\n {\n case 0x0020:\n {\n if ((data != (unsigned char *) NULL) &&\n (strncmp((char *) data,\"INVERSE\",7) == 0))\n polarity=MagickTrue;\n break;\n }\n default:\n break;\n }\n break;\n }\n default:\n break;\n }\n if (data != (unsigned char *) NULL)\n {\n char\n *attribute;\n\n for (i=0; dicom_info[i].description != (char *) NULL; i++)\n if ((group == dicom_info[i].group) &&\n (element == dicom_info[i].element))\n break;\n if (dicom_info[i].description != (char *) NULL)\n {\n attribute=AcquireString(\"dcm:\");\n (void) ConcatenateString(&attribute,dicom_info[i].description);\n for (i=0; i < (ssize_t) MagickMax(length,4); i++)\n if (isprint((int) data[i]) == MagickFalse)\n break;\n if ((i == (ssize_t) length) || (length > 4))\n {\n (void) SubstituteString(&attribute,\" \",\"\");\n (void) SetImageProperty(image,attribute,(char *) data,exception);\n }\n attribute=DestroyString(attribute);\n }\n }\n if (image_info->verbose != MagickFalse)\n {\n if (data == (unsigned char *) NULL)\n (void) FormatLocaleFile(stdout,\"%d\\n\",datum);\n else\n {\n /*\n Display group data.\n */\n for (i=0; i < (ssize_t) MagickMax(length,4); i++)\n if (isprint((int) data[i]) == MagickFalse)\n break;\n if ((i != (ssize_t) length) && (length <= 4))\n {\n ssize_t\n j;\n\n datum=0;\n for (j=(ssize_t) length-1; j >= 0; j--)\n datum=(256*datum+data[j]);\n (void) FormatLocaleFile(stdout,\"%d\",datum);\n }\n else\n for (i=0; i < (ssize_t) length; i++)\n if (isprint((int) data[i]) != MagickFalse)\n (void) FormatLocaleFile(stdout,\"%c\",data[i]);\n else\n (void) FormatLocaleFile(stdout,\"%c\",'.');\n (void) FormatLocaleFile(stdout,\"\\n\");\n }\n }\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n }\n if ((width == 0) || (height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n image->columns=(size_t) width;\n image->rows=(size_t) height;\n if (signed_data == 0xffff)\n signed_data=(size_t) (significant_bits == 16 ? 1 : 0);\n if ((image->compression == JPEGCompression) ||\n (image->compression == JPEG2000Compression))\n {\n Image\n *images;\n\n ImageInfo\n *read_info;\n\n int\n c;\n\n size_t\n length;\n\n unsigned int\n tag;\n\n /*\n Read offset table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n (void) tag;\n length=(size_t) ReadBlobLSBLong(image);\n stream_info->offset_count=length >> 2;\n if (stream_info->offset_count != 0)\n {\n MagickOffsetType\n offset;\n\n stream_info->offsets=(ssize_t *) AcquireQuantumMemory(\n stream_info->offset_count,sizeof(*stream_info->offsets));\n if (stream_info->offsets == (ssize_t *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n offset=TellBlob(image);\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]+=offset;\n }\n /*\n Handle non-native image formats.\n */\n read_info=CloneImageInfo(image_info);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n images=NewImageList();\n for (scene=0; scene < (ssize_t) number_scenes; scene++)\n {\n char\n filename[MagickPathExtent];\n\n const char\n *property;\n\n FILE\n *file;\n\n Image\n *jpeg_image;\n\n int\n unique_file;\n\n unsigned int\n tag;\n\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n length=(size_t) ReadBlobLSBLong(image);\n if (tag == 0xFFFEE0DD)\n break; /* sequence delimiter tag */\n if (tag != 0xFFFEE000)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n file=(FILE *) NULL;\n unique_file=AcquireUniqueFileResource(filename);\n if (unique_file != -1)\n file=fdopen(unique_file,\"wb\");\n if (file == (FILE *) NULL)\n {\n (void) RelinquishUniqueFileResource(filename);\n ThrowFileException(exception,FileOpenError,\n \"UnableToCreateTemporaryFile\",filename);\n break;\n }\n for ( ; length != 0; length--)\n {\n c=ReadBlobByte(image);\n if (c == EOF)\n {\n ThrowFileException(exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n break;\n }\n (void) fputc(c,file);\n }\n (void) fclose(file);\n (void) FormatLocaleString(read_info->filename,MagickPathExtent,\n \"jpeg:%s\",filename);\n if (image->compression == JPEG2000Compression)\n (void) FormatLocaleString(read_info->filename,MagickPathExtent,\n \"j2k:%s\",filename);\n jpeg_image=ReadImage(read_info,exception);\n if (jpeg_image != (Image *) NULL)\n {\n ResetImagePropertyIterator(image);\n property=GetNextImageProperty(image);\n while (property != (const char *) NULL)\n {\n (void) SetImageProperty(jpeg_image,property,\n GetImageProperty(image,property,exception),exception);\n property=GetNextImageProperty(image);\n }\n AppendImageToList(&images,jpeg_image);\n }\n (void) RelinquishUniqueFileResource(filename);\n }\n read_info=DestroyImageInfo(read_info);\n image=DestroyImage(image);\n return(GetFirstImageInList(images));\n }\n if (depth != (1UL*MAGICKCORE_QUANTUM_DEPTH))\n {\n QuantumAny\n range;\n\n size_t\n length;\n\n /*\n Compute pixel scaling table.\n */\n length=(size_t) (GetQuantumRange(depth)+1);\n scale=(Quantum *) AcquireQuantumMemory(length,sizeof(*scale));\n if (scale == (Quantum *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n range=GetQuantumRange(depth);\n for (i=0; i <= (ssize_t) GetQuantumRange(depth); i++)\n scale[i]=ScaleAnyToQuantum((size_t) i,range);\n }\n if (image->compression == RLECompression)\n {\n size_t\n length;\n\n unsigned int\n tag;\n\n /*\n Read RLE offset table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n (void) tag;\n length=(size_t) ReadBlobLSBLong(image);\n stream_info->offset_count=length >> 2;\n if (stream_info->offset_count != 0)\n {\n MagickOffsetType\n offset;\n\n stream_info->offsets=(ssize_t *) AcquireQuantumMemory(\n stream_info->offset_count,sizeof(*stream_info->offsets));\n if (stream_info->offsets == (ssize_t *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n offset=TellBlob(image);\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]+=offset;\n }\n }\n for (scene=0; scene < (ssize_t) number_scenes; scene++)\n {\n if (image_info->ping != MagickFalse)\n break;\n image->columns=(size_t) width;\n image->rows=(size_t) height;\n image->depth=depth;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n break;\n image->colorspace=RGBColorspace;\n if ((image->colormap == (PixelInfo *) NULL) && (samples_per_pixel == 1))\n {\n size_t\n one;\n\n one=1;\n if (colors == 0)\n colors=one << depth;\n if (AcquireImageColormap(image,one << depth,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (redmap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=redmap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].red=(MagickRealType) index;\n }\n if (greenmap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=greenmap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].green=(MagickRealType) index;\n }\n if (bluemap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=bluemap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].blue=(MagickRealType) index;\n }\n if (graymap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=graymap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].red=(MagickRealType) index;\n image->colormap[i].green=(MagickRealType) index;\n image->colormap[i].blue=(MagickRealType) index;\n }\n }\n if (image->compression == RLECompression)\n {\n unsigned int\n tag;\n\n /*\n Read RLE segment table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n stream_info->remaining=(size_t) ReadBlobLSBLong(image);\n if ((tag != 0xFFFEE000) || (stream_info->remaining <= 64) ||\n (EOFBlob(image) != MagickFalse))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n stream_info->count=0;\n stream_info->segment_count=ReadBlobLSBLong(image);\n if (stream_info->segment_count > 1)\n {\n bytes_per_pixel=1;\n depth=8;\n }\n for (i=0; i < 15; i++)\n stream_info->segments[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n stream_info->remaining-=64;\n }\n if ((samples_per_pixel > 1) && (image->interlace == PlaneInterlace))\n {\n /*\n Convert Planar RGB DCM Medical image to pixel packets.\n */\n for (i=0; i < (ssize_t) samples_per_pixel; i++)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n switch ((int) i)\n {\n case 0:\n {\n SetPixelRed(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 1:\n {\n SetPixelGreen(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 2:\n {\n SetPixelBlue(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 3:\n {\n SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n default:\n break;\n }\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n }\n else\n {\n const char\n *option;\n\n int\n byte;\n\n PixelPacket\n pixel;\n\n /*\n Convert DCM Medical image to pixel packets.\n */\n byte=0;\n i=0;\n if ((window_center != 0) && (window_width == 0))\n window_width=(size_t) window_center;\n option=GetImageOption(image_info,\"dcm:display-range\");\n if (option != (const char *) NULL)\n {\n if (LocaleCompare(option,\"reset\") == 0)\n window_width=0;\n }\n (void) ResetMagickMemory(&pixel,0,sizeof(pixel));\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (samples_per_pixel == 1)\n {\n int\n pixel_value;\n\n if (bytes_per_pixel == 1)\n pixel_value=polarity != MagickFalse ?\n ((int) max_value-ReadDCMByte(stream_info,image)) :\n ReadDCMByte(stream_info,image);\n else\n if ((bits_allocated != 12) || (significant_bits != 12))\n {\n if (signed_data)\n pixel_value=ReadDCMSignedShort(stream_info,image);\n else\n pixel_value=ReadDCMShort(stream_info,image);\n if (polarity != MagickFalse)\n pixel_value=(int)max_value-pixel_value;\n }\n else\n {\n if ((i & 0x01) != 0)\n pixel_value=(ReadDCMByte(stream_info,image) << 8) |\n byte;\n else\n {\n pixel_value=ReadDCMSignedShort(stream_info,image);\n byte=(int) (pixel_value & 0x0f);\n pixel_value>>=4;\n }\n i++;\n }\n index=(pixel_value*rescale_slope)+rescale_intercept;\n if (window_width == 0)\n {\n if (signed_data == 1)\n index-=32767;\n }\n else\n {\n ssize_t\n window_max,\n window_min;\n\n window_min=(ssize_t) ceil((double) window_center-\n (window_width-1.0)/2.0-0.5);\n window_max=(ssize_t) floor((double) window_center+\n (window_width-1.0)/2.0+0.5);\n if ((ssize_t)index <= window_min)\n index=0;\n else\n if ((ssize_t)index > window_max)\n index=(int) max_value;\n else\n index=(int) (max_value*(((index-window_center-\n 0.5)/(window_width-1))+0.5));\n }\n index&=mask;\n index=(int) ConstrainColormapIndex(image,(size_t) index,\n exception);\n SetPixelIndex(image,(Quantum) index,q);\n pixel.red=(unsigned int) image->colormap[index].red;\n pixel.green=(unsigned int) image->colormap[index].green;\n pixel.blue=(unsigned int) image->colormap[index].blue;\n }\n else\n {\n if (bytes_per_pixel == 1)\n {\n pixel.red=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.green=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.blue=(unsigned int) ReadDCMByte(stream_info,image);\n }\n else\n {\n pixel.red=ReadDCMShort(stream_info,image);\n pixel.green=ReadDCMShort(stream_info,image);\n pixel.blue=ReadDCMShort(stream_info,image);\n }\n pixel.red&=mask;\n pixel.green&=mask;\n pixel.blue&=mask;\n if (scale != (Quantum *) NULL)\n {\n if (pixel.red <= GetQuantumRange(depth))\n pixel.red=scale[pixel.red];\n if (pixel.green <= GetQuantumRange(depth))\n pixel.green=scale[pixel.green];\n if (pixel.blue <= GetQuantumRange(depth))\n pixel.blue=scale[pixel.blue];\n }\n }\n SetPixelRed(image,(Quantum) pixel.red,q);\n SetPixelGreen(image,(Quantum) pixel.green,q);\n SetPixelBlue(image,(Quantum) pixel.blue,q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n if (stream_info->segment_count > 1)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (samples_per_pixel == 1)\n {\n int\n pixel_value;\n\n if (bytes_per_pixel == 1)\n pixel_value=polarity != MagickFalse ?\n ((int) max_value-ReadDCMByte(stream_info,image)) :\n ReadDCMByte(stream_info,image);\n else\n if ((bits_allocated != 12) || (significant_bits != 12))\n {\n pixel_value=(int) (polarity != MagickFalse ?\n (max_value-ReadDCMShort(stream_info,image)) :\n ReadDCMShort(stream_info,image));\n if (signed_data == 1)\n pixel_value=((signed short) pixel_value);\n }\n else\n {\n if ((i & 0x01) != 0)\n pixel_value=(ReadDCMByte(stream_info,image) << 8) |\n byte;\n else\n {\n pixel_value=ReadDCMShort(stream_info,image);\n byte=(int) (pixel_value & 0x0f);\n pixel_value>>=4;\n }\n i++;\n }\n index=(pixel_value*rescale_slope)+rescale_intercept;\n if (window_width == 0)\n {\n if (signed_data == 1)\n index-=32767;\n }\n else\n {\n ssize_t\n window_max,\n window_min;\n\n window_min=(ssize_t) ceil((double) window_center-\n (window_width-1.0)/2.0-0.5);\n window_max=(ssize_t) floor((double) window_center+\n (window_width-1.0)/2.0+0.5);\n if ((ssize_t)index <= window_min)\n index=0;\n else\n if ((ssize_t)index > window_max)\n index=(int) max_value;\n else\n index=(int) (max_value*(((index-window_center-\n 0.5)/(window_width-1))+0.5));\n }\n index&=mask;\n index=(int) ConstrainColormapIndex(image,(size_t) index,\n exception);\n SetPixelIndex(image,(Quantum) (((size_t)\n GetPixelIndex(image,q)) | (((size_t) index) << 8)),q);\n pixel.red=(unsigned int) image->colormap[index].red;\n pixel.green=(unsigned int) image->colormap[index].green;\n pixel.blue=(unsigned int) image->colormap[index].blue;\n }\n else\n {\n if (bytes_per_pixel == 1)\n {\n pixel.red=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.green=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.blue=(unsigned int) ReadDCMByte(stream_info,image);\n }\n else\n {\n pixel.red=ReadDCMShort(stream_info,image);\n pixel.green=ReadDCMShort(stream_info,image);\n pixel.blue=ReadDCMShort(stream_info,image);\n }\n pixel.red&=mask;\n pixel.green&=mask;\n pixel.blue&=mask;\n if (scale != (Quantum *) NULL)\n {\n pixel.red=scale[pixel.red];\n pixel.green=scale[pixel.green];\n pixel.blue=scale[pixel.blue];\n }\n }\n SetPixelRed(image,(Quantum) (((size_t) GetPixelRed(image,q)) |\n (((size_t) pixel.red) << 8)),q);\n SetPixelGreen(image,(Quantum) (((size_t) GetPixelGreen(image,q)) |\n (((size_t) pixel.green) << 8)),q);\n SetPixelBlue(image,(Quantum) (((size_t) GetPixelBlue(image,q)) |\n (((size_t) pixel.blue) << 8)),q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n if (SetImageGray(image,exception) != MagickFalse)\n (void) SetImageColorspace(image,GRAYColorspace,exception);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n if (scene < (ssize_t) (number_scenes-1))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n }\n /*\n Free resources.\n */\n if (stream_info->offsets != (ssize_t *) NULL)\n stream_info->offsets=(ssize_t *)\n RelinquishMagickMemory(stream_info->offsets);\n stream_info=(DCMStreamInfo *) RelinquishMagickMemory(stream_info);\n if (scale != (Quantum *) NULL)\n scale=(Quantum *) RelinquishMagickMemory(scale);\n if (graymap != (int *) NULL)\n graymap=(int *) RelinquishMagickMemory(graymap);\n if (bluemap != (int *) NULL)\n bluemap=(int *) RelinquishMagickMemory(bluemap);\n if (greenmap != (int *) NULL)\n greenmap=(int *) RelinquishMagickMemory(greenmap);\n if (redmap != (int *) NULL)\n redmap=(int *) RelinquishMagickMemory(redmap);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-476","target_token_count":10381,"sven_meta":{"func_name":"ReadDCMImage","file_name":"coders/dcm.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/5511ef530576ed18fd636baa3bb4eda3d667665d","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#4-b85f43f95e14","input":" */\nstatic void php_wddx_pop_element(void *user_data, const XML_Char *name)\n{\n\tst_entry \t\t\t*ent1, *ent2;\n\twddx_stack \t\t\t*stack = (wddx_stack *)user_data;\n\tHashTable \t\t\t*target_hash;\n\tzend_class_entry \t**pce;\n\tzval\t\t\t\t*obj;\n\tzval\t\t\t\t*tmp;\n\tTSRMLS_FETCH();\n\n/* OBJECTS_FIXME */\n\tif (stack->top == 0) {\n\t\treturn;\n\t}\n\n\tif (!strcmp(name, EL_STRING) || !strcmp(name, EL_NUMBER) ||\n\t\t!strcmp(name, EL_BOOLEAN) || !strcmp(name, EL_NULL) ||\n\t \t!strcmp(name, EL_ARRAY) || !strcmp(name, EL_STRUCT) ||\n\t\t!strcmp(name, EL_RECORDSET) || !strcmp(name, EL_BINARY) ||\n\t\t!strcmp(name, EL_DATETIME)) {\n\t\twddx_stack_top(stack, (void**)&ent1);\n\n\t\tif (!ent1->data) {\n\t\t\tif (stack->top > 1) {\n\t\t\t\tstack->top--;\n\t\t\t} else {\n\t\t\t\tstack->done = 1;\n\t\t\t}\n\t\t\tefree(ent1);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!strcmp(name, EL_BINARY)) {\n\t\t\tint new_len=0;\n\t\t\tunsigned char *new_str;\n\n\t\t\tnew_str = php_base64_decode(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data), &new_len);\n\t\t\tSTR_FREE(Z_STRVAL_P(ent1->data));\n\t\t\tZ_STRVAL_P(ent1->data) = new_str;\n\t\t\tZ_STRLEN_P(ent1->data) = new_len;\n\t\t}\n\n\t\t/* Call __wakeup() method on the object. */\n\t\tif (Z_TYPE_P(ent1->data) == IS_OBJECT) {\n\t\t\tzval *fname, *retval = NULL;\n\n\t\t\tMAKE_STD_ZVAL(fname);\n\t\t\tZVAL_STRING(fname, \"__wakeup\", 1);\n\n\t\t\tcall_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL TSRMLS_CC);\n\n\t\t\tzval_dtor(fname);\n\t\t\tFREE_ZVAL(fname);\n\t\t\tif (retval) {\n\t\t\t\tzval_ptr_dtor(&retval);\n\t\t\t}\n\t\t}\n\n\t\tif (stack->top > 1) {\n\t\t\tstack->top--;\n\t\t\twddx_stack_top(stack, (void**)&ent2);\n\n\t\t\t/* if non-existent field */\n\t\t\tif (ent2->type == ST_FIELD && ent2->data == NULL) {\n\t\t\t\tzval_ptr_dtor(&ent1->data);\n\t\t\t\tefree(ent1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (Z_TYPE_P(ent2->data) == IS_ARRAY || Z_TYPE_P(ent2->data) == IS_OBJECT) {\n\t\t\t\ttarget_hash = HASH_OF(ent2->data);\n\n\t\t\t\tif (ent1->varname) {\n\t\t\t\t\tif (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) &&\n\t\t\t\t\t\tZ_TYPE_P(ent1->data) == IS_STRING && Z_STRLEN_P(ent1->data) &&\n\t\t\t\t\t\tent2->type == ST_STRUCT && Z_TYPE_P(ent2->data) == IS_ARRAY) {\n\t\t\t\t\t\tzend_bool incomplete_class = 0;\n\n\t\t\t\t\t\tzend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));\n\t\t\t\t\t\tif (zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data),\n\t\t\t\t\t\t\t\t\t\t Z_STRLEN_P(ent1->data)+1, (void **) &pce)==FAILURE) {\n\t\t\t\t\t\t\tincomplete_class = 1;\n\t\t\t\t\t\t\tpce = &PHP_IC_ENTRY;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Initialize target object */\n\t\t\t\t\t\tMAKE_STD_ZVAL(obj);\n\t\t\t\t\t\tobject_init_ex(obj, *pce);\n\n\t\t\t\t\t\t/* Merge current hashtable with object's default properties */\n\t\t\t\t\t\tzend_hash_merge(Z_OBJPROP_P(obj),\n\t\t\t\t\t\t\t\t\t\tZ_ARRVAL_P(ent2->data),\n\t\t\t\t\t\t\t\t\t\t(void (*)(void *)) zval_add_ref,\n\t\t\t\t\t\t\t\t\t\t(void *) &tmp, sizeof(zval *), 0);\n\n\t\t\t\t\t\tif (incomplete_class) {\n\t\t\t\t\t\t\tphp_store_class_name(obj, Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Clean up old array entry */\n\t\t\t\t\t\tzval_ptr_dtor(&ent2->data);\n\n\t\t\t\t\t\t/* Set stack entry to point to the newly created object */\n\t\t\t\t\t\tent2->data = obj;\n\n\t\t\t\t\t\t/* Clean up class name var entry */\n\t\t\t\t\t\tzval_ptr_dtor(&ent1->data);\n\t\t\t\t\t} else if (Z_TYPE_P(ent2->data) == IS_OBJECT) {\n\t\t\t\t\t\tzend_class_entry *old_scope = EG(scope);\n\n\t\t\t\t\t\tEG(scope) = Z_OBJCE_P(ent2->data);\n\t\t\t\t\t\tZ_DELREF_P(ent1->data);\n\t\t\t\t\t\tadd_property_zval(ent2->data, ent1->varname, ent1->data);\n\t\t\t\t\t\tEG(scope) = old_scope;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzend_symtable_update(target_hash, ent1->varname, strlen(ent1->varname)+1, &ent1->data, sizeof(zval *), NULL);\n\t\t\t\t\t}\n\t\t\t\t\tefree(ent1->varname);\n\t\t\t\t} else\t{\n\t\t\t\t\tzend_hash_next_index_insert(target_hash, &ent1->data, sizeof(zval *), NULL);\n\t\t\t\t}\n\t\t\t}\n\t\t\tefree(ent1);\n\t\t} else {\n\t\t\tstack->done = 1;\n\t\t}\n\t} else if (!strcmp(name, EL_VAR) && stack->varname) {\n\t\tefree(stack->varname);\n\t\tstack->varname = NULL;\n\t} else if (!strcmp(name, EL_FIELD)) {\n\t\tst_entry *ent;\n\t\twddx_stack_top(stack, (void **)&ent);\n\t\tefree(ent);\n\t\tstack->top--;\n\t}","target":" */\nstatic void php_wddx_pop_element(void *user_data, const XML_Char *name)\n{\n\tst_entry \t\t\t*ent1, *ent2;\n\twddx_stack \t\t\t*stack = (wddx_stack *)user_data;\n\tHashTable \t\t\t*target_hash;\n\tzend_class_entry \t**pce;\n\tzval\t\t\t\t*obj;\n\tzval\t\t\t\t*tmp;\n\tTSRMLS_FETCH();\n\n/* OBJECTS_FIXME */\n\tif (stack->top == 0) {\n\t\treturn;\n\t}\n\n\tif (!strcmp(name, EL_STRING) || !strcmp(name, EL_NUMBER) ||\n\t\t!strcmp(name, EL_BOOLEAN) || !strcmp(name, EL_NULL) ||\n\t \t!strcmp(name, EL_ARRAY) || !strcmp(name, EL_STRUCT) ||\n\t\t!strcmp(name, EL_RECORDSET) || !strcmp(name, EL_BINARY) ||\n\t\t!strcmp(name, EL_DATETIME)) {\n\t\twddx_stack_top(stack, (void**)&ent1);\n\n\t\tif (!ent1->data) {\n\t\t\tif (stack->top > 1) {\n\t\t\t\tstack->top--;\n\t\t\t} else {\n\t\t\t\tstack->done = 1;\n\t\t\t}\n\t\t\tefree(ent1);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!strcmp(name, EL_BINARY)) {\n\t\t\tint new_len=0;\n\t\t\tunsigned char *new_str;\n\n\t\t\tnew_str = php_base64_decode(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data), &new_len);\n\t\t\tSTR_FREE(Z_STRVAL_P(ent1->data));\n\t\t\tif (new_str) {\n\t\t\t\tZ_STRVAL_P(ent1->data) = new_str;\n\t\t\t\tZ_STRLEN_P(ent1->data) = new_len;\n\t\t\t} else {\n\t\t\t\tZVAL_EMPTY_STRING(ent1->data);\n\t\t\t}\n\t\t}\n\n\t\t/* Call __wakeup() method on the object. */\n\t\tif (Z_TYPE_P(ent1->data) == IS_OBJECT) {\n\t\t\tzval *fname, *retval = NULL;\n\n\t\t\tMAKE_STD_ZVAL(fname);\n\t\t\tZVAL_STRING(fname, \"__wakeup\", 1);\n\n\t\t\tcall_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL TSRMLS_CC);\n\n\t\t\tzval_dtor(fname);\n\t\t\tFREE_ZVAL(fname);\n\t\t\tif (retval) {\n\t\t\t\tzval_ptr_dtor(&retval);\n\t\t\t}\n\t\t}\n\n\t\tif (stack->top > 1) {\n\t\t\tstack->top--;\n\t\t\twddx_stack_top(stack, (void**)&ent2);\n\n\t\t\t/* if non-existent field */\n\t\t\tif (ent2->type == ST_FIELD && ent2->data == NULL) {\n\t\t\t\tzval_ptr_dtor(&ent1->data);\n\t\t\t\tefree(ent1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (Z_TYPE_P(ent2->data) == IS_ARRAY || Z_TYPE_P(ent2->data) == IS_OBJECT) {\n\t\t\t\ttarget_hash = HASH_OF(ent2->data);\n\n\t\t\t\tif (ent1->varname) {\n\t\t\t\t\tif (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) &&\n\t\t\t\t\t\tZ_TYPE_P(ent1->data) == IS_STRING && Z_STRLEN_P(ent1->data) &&\n\t\t\t\t\t\tent2->type == ST_STRUCT && Z_TYPE_P(ent2->data) == IS_ARRAY) {\n\t\t\t\t\t\tzend_bool incomplete_class = 0;\n\n\t\t\t\t\t\tzend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));\n\t\t\t\t\t\tif (zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data),\n\t\t\t\t\t\t\t\t\t\t Z_STRLEN_P(ent1->data)+1, (void **) &pce)==FAILURE) {\n\t\t\t\t\t\t\tincomplete_class = 1;\n\t\t\t\t\t\t\tpce = &PHP_IC_ENTRY;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Initialize target object */\n\t\t\t\t\t\tMAKE_STD_ZVAL(obj);\n\t\t\t\t\t\tobject_init_ex(obj, *pce);\n\n\t\t\t\t\t\t/* Merge current hashtable with object's default properties */\n\t\t\t\t\t\tzend_hash_merge(Z_OBJPROP_P(obj),\n\t\t\t\t\t\t\t\t\t\tZ_ARRVAL_P(ent2->data),\n\t\t\t\t\t\t\t\t\t\t(void (*)(void *)) zval_add_ref,\n\t\t\t\t\t\t\t\t\t\t(void *) &tmp, sizeof(zval *), 0);\n\n\t\t\t\t\t\tif (incomplete_class) {\n\t\t\t\t\t\t\tphp_store_class_name(obj, Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Clean up old array entry */\n\t\t\t\t\t\tzval_ptr_dtor(&ent2->data);\n\n\t\t\t\t\t\t/* Set stack entry to point to the newly created object */\n\t\t\t\t\t\tent2->data = obj;\n\n\t\t\t\t\t\t/* Clean up class name var entry */\n\t\t\t\t\t\tzval_ptr_dtor(&ent1->data);\n\t\t\t\t\t} else if (Z_TYPE_P(ent2->data) == IS_OBJECT) {\n\t\t\t\t\t\tzend_class_entry *old_scope = EG(scope);\n\n\t\t\t\t\t\tEG(scope) = Z_OBJCE_P(ent2->data);\n\t\t\t\t\t\tZ_DELREF_P(ent1->data);\n\t\t\t\t\t\tadd_property_zval(ent2->data, ent1->varname, ent1->data);\n\t\t\t\t\t\tEG(scope) = old_scope;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzend_symtable_update(target_hash, ent1->varname, strlen(ent1->varname)+1, &ent1->data, sizeof(zval *), NULL);\n\t\t\t\t\t}\n\t\t\t\t\tefree(ent1->varname);\n\t\t\t\t} else\t{\n\t\t\t\t\tzend_hash_next_index_insert(target_hash, &ent1->data, sizeof(zval *), NULL);\n\t\t\t\t}\n\t\t\t}\n\t\t\tefree(ent1);\n\t\t} else {\n\t\t\tstack->done = 1;\n\t\t}\n\t} else if (!strcmp(name, EL_VAR) && stack->varname) {\n\t\tefree(stack->varname);\n\t\tstack->varname = NULL;\n\t} else if (!strcmp(name, EL_FIELD)) {\n\t\tst_entry *ent;\n\t\twddx_stack_top(stack, (void **)&ent);\n\t\tefree(ent);\n\t\tstack->top--;\n\t}","lang":"c","vul_type":"cwe-476","target_token_count":1266,"sven_meta":{"func_name":"php_wddx_pop_element","file_name":"ext/wddx/wddx.c","commit_link":"github.com/php/php-src/commit/698a691724c0a949295991e5df091ce16f899e02","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#8-f8d03e594b21","input":"static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,\n\t\t\t struct netlink_ext_ack *extack)\n{\n\tstruct net *net = sock_net(in_skb->sk);\n\tstruct rtmsg *rtm;\n\tstruct nlattr *tb[RTA_MAX+1];\n\tstruct fib_result res = {};\n\tstruct rtable *rt = NULL;\n\tstruct flowi4 fl4;\n\t__be32 dst = 0;\n\t__be32 src = 0;\n\tu32 iif;\n\tint err;\n\tint mark;\n\tstruct sk_buff *skb;\n\tu32 table_id = RT_TABLE_MAIN;\n\tkuid_t uid;\n\n\terr = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv4_policy,\n\t\t\t extack);\n\tif (err < 0)\n\t\tgoto errout;\n\n\trtm = nlmsg_data(nlh);\n\n\tskb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);\n\tif (!skb) {\n\t\terr = -ENOBUFS;\n\t\tgoto errout;\n\t}\n\n\t/* Reserve room for dummy headers, this skb can pass\n\t through good chunk of routing engine.\n\t */\n\tskb_reset_mac_header(skb);\n\tskb_reset_network_header(skb);\n\n\tsrc = tb[RTA_SRC] ? nla_get_in_addr(tb[RTA_SRC]) : 0;\n\tdst = tb[RTA_DST] ? nla_get_in_addr(tb[RTA_DST]) : 0;\n\tiif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0;\n\tmark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0;\n\tif (tb[RTA_UID])\n\t\tuid = make_kuid(current_user_ns(), nla_get_u32(tb[RTA_UID]));\n\telse\n\t\tuid = (iif ? INVALID_UID : current_uid());\n\n\t/* Bugfix: need to give ip_route_input enough of an IP header to\n\t * not gag.\n\t */\n\tip_hdr(skb)->protocol = IPPROTO_UDP;\n\tip_hdr(skb)->saddr = src;\n\tip_hdr(skb)->daddr = dst;\n\n\tskb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));\n\n\tmemset(&fl4, 0, sizeof(fl4));\n\tfl4.daddr = dst;\n\tfl4.saddr = src;\n\tfl4.flowi4_tos = rtm->rtm_tos;\n\tfl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0;\n\tfl4.flowi4_mark = mark;\n\tfl4.flowi4_uid = uid;\n\n\trcu_read_lock();\n\n\tif (iif) {\n\t\tstruct net_device *dev;\n\n\t\tdev = dev_get_by_index_rcu(net, iif);\n\t\tif (!dev) {\n\t\t\terr = -ENODEV;\n\t\t\tgoto errout_free;\n\t\t}\n\n\t\tskb->protocol\t= htons(ETH_P_IP);\n\t\tskb->dev\t= dev;\n\t\tskb->mark\t= mark;\n\t\terr = ip_route_input_rcu(skb, dst, src, rtm->rtm_tos,\n\t\t\t\t\t dev, &res);\n\n\t\trt = skb_rtable(skb);\n\t\tif (err == 0 && rt->dst.error)\n\t\t\terr = -rt->dst.error;\n\t} else {\n\t\trt = ip_route_output_key_hash_rcu(net, &fl4, &res, skb);\n\t\terr = 0;\n\t\tif (IS_ERR(rt))\n\t\t\terr = PTR_ERR(rt);\n\t\telse\n\t\t\tskb_dst_set(skb, &rt->dst);\n\t}\n\n\tif (err)\n\t\tgoto errout_free;\n\n\tif (rtm->rtm_flags & RTM_F_NOTIFY)\n\t\trt->rt_flags |= RTCF_NOTIFY;\n\n\tif (rtm->rtm_flags & RTM_F_LOOKUP_TABLE)\n\t\ttable_id = rt->rt_table_id;\n\n\tif (rtm->rtm_flags & RTM_F_FIB_MATCH)\n\t\terr = fib_dump_info(skb, NETLINK_CB(in_skb).portid,\n\t\t\t\t nlh->nlmsg_seq, RTM_NEWROUTE, table_id,\n\t\t\t\t rt->rt_type, res.prefix, res.prefixlen,\n\t\t\t\t fl4.flowi4_tos, res.fi, 0);\n\telse\n\t\terr = rt_fill_info(net, dst, src, table_id, &fl4, skb,\n\t\t\t\t NETLINK_CB(in_skb).portid, nlh->nlmsg_seq);\n\tif (err < 0)\n\t\tgoto errout_free;\n\n\trcu_read_unlock();\n\n\terr = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);\nerrout:\n\treturn err;\n\nerrout_free:\n\trcu_read_unlock();\n\tkfree_skb(skb);\n\tgoto errout;\n}","target":"static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,\n\t\t\t struct netlink_ext_ack *extack)\n{\n\tstruct net *net = sock_net(in_skb->sk);\n\tstruct rtmsg *rtm;\n\tstruct nlattr *tb[RTA_MAX+1];\n\tstruct fib_result res = {};\n\tstruct rtable *rt = NULL;\n\tstruct flowi4 fl4;\n\t__be32 dst = 0;\n\t__be32 src = 0;\n\tu32 iif;\n\tint err;\n\tint mark;\n\tstruct sk_buff *skb;\n\tu32 table_id = RT_TABLE_MAIN;\n\tkuid_t uid;\n\n\terr = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv4_policy,\n\t\t\t extack);\n\tif (err < 0)\n\t\tgoto errout;\n\n\trtm = nlmsg_data(nlh);\n\n\tskb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);\n\tif (!skb) {\n\t\terr = -ENOBUFS;\n\t\tgoto errout;\n\t}\n\n\t/* Reserve room for dummy headers, this skb can pass\n\t through good chunk of routing engine.\n\t */\n\tskb_reset_mac_header(skb);\n\tskb_reset_network_header(skb);\n\n\tsrc = tb[RTA_SRC] ? nla_get_in_addr(tb[RTA_SRC]) : 0;\n\tdst = tb[RTA_DST] ? nla_get_in_addr(tb[RTA_DST]) : 0;\n\tiif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0;\n\tmark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0;\n\tif (tb[RTA_UID])\n\t\tuid = make_kuid(current_user_ns(), nla_get_u32(tb[RTA_UID]));\n\telse\n\t\tuid = (iif ? INVALID_UID : current_uid());\n\n\t/* Bugfix: need to give ip_route_input enough of an IP header to\n\t * not gag.\n\t */\n\tip_hdr(skb)->protocol = IPPROTO_UDP;\n\tip_hdr(skb)->saddr = src;\n\tip_hdr(skb)->daddr = dst;\n\n\tskb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));\n\n\tmemset(&fl4, 0, sizeof(fl4));\n\tfl4.daddr = dst;\n\tfl4.saddr = src;\n\tfl4.flowi4_tos = rtm->rtm_tos;\n\tfl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0;\n\tfl4.flowi4_mark = mark;\n\tfl4.flowi4_uid = uid;\n\n\trcu_read_lock();\n\n\tif (iif) {\n\t\tstruct net_device *dev;\n\n\t\tdev = dev_get_by_index_rcu(net, iif);\n\t\tif (!dev) {\n\t\t\terr = -ENODEV;\n\t\t\tgoto errout_free;\n\t\t}\n\n\t\tskb->protocol\t= htons(ETH_P_IP);\n\t\tskb->dev\t= dev;\n\t\tskb->mark\t= mark;\n\t\terr = ip_route_input_rcu(skb, dst, src, rtm->rtm_tos,\n\t\t\t\t\t dev, &res);\n\n\t\trt = skb_rtable(skb);\n\t\tif (err == 0 && rt->dst.error)\n\t\t\terr = -rt->dst.error;\n\t} else {\n\t\trt = ip_route_output_key_hash_rcu(net, &fl4, &res, skb);\n\t\terr = 0;\n\t\tif (IS_ERR(rt))\n\t\t\terr = PTR_ERR(rt);\n\t\telse\n\t\t\tskb_dst_set(skb, &rt->dst);\n\t}\n\n\tif (err)\n\t\tgoto errout_free;\n\n\tif (rtm->rtm_flags & RTM_F_NOTIFY)\n\t\trt->rt_flags |= RTCF_NOTIFY;\n\n\tif (rtm->rtm_flags & RTM_F_LOOKUP_TABLE)\n\t\ttable_id = rt->rt_table_id;\n\n\tif (rtm->rtm_flags & RTM_F_FIB_MATCH) {\n\t\tif (!res.fi) {\n\t\t\terr = fib_props[res.type].error;\n\t\t\tif (!err)\n\t\t\t\terr = -EHOSTUNREACH;\n\t\t\tgoto errout_free;\n\t\t}\n\t\terr = fib_dump_info(skb, NETLINK_CB(in_skb).portid,\n\t\t\t\t nlh->nlmsg_seq, RTM_NEWROUTE, table_id,\n\t\t\t\t rt->rt_type, res.prefix, res.prefixlen,\n\t\t\t\t fl4.flowi4_tos, res.fi, 0);\n\t} else {\n\t\terr = rt_fill_info(net, dst, src, table_id, &fl4, skb,\n\t\t\t\t NETLINK_CB(in_skb).portid, nlh->nlmsg_seq);\n\t}\n\tif (err < 0)\n\t\tgoto errout_free;\n\n\trcu_read_unlock();\n\n\terr = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);\nerrout:\n\treturn err;\n\nerrout_free:\n\trcu_read_unlock();\n\tkfree_skb(skb);\n\tgoto errout;\n}","lang":"c","vul_type":"cwe-476","target_token_count":1062,"sven_meta":{"func_name":"inet_rtm_getroute","file_name":"net/ipv4/route.c","commit_link":"github.com/torvalds/linux/commit/bc3aae2bbac46dd894c89db5d5e98f7f0ef9e205","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#10-0e354a573e83","input":"validate_as_request(kdc_realm_t *kdc_active_realm,\n register krb5_kdc_req *request, krb5_db_entry client,\n krb5_db_entry server, krb5_timestamp kdc_time,\n const char **status, krb5_pa_data ***e_data)\n{\n int errcode;\n krb5_error_code ret;\n\n /*\n * If an option is set that is only allowed in TGS requests, complain.\n */\n if (request->kdc_options & AS_INVALID_OPTIONS) {\n *status = \"INVALID AS OPTIONS\";\n return KDC_ERR_BADOPTION;\n }\n\n /* The client must not be expired */\n if (client.expiration && client.expiration < kdc_time) {\n *status = \"CLIENT EXPIRED\";\n if (vague_errors)\n return(KRB_ERR_GENERIC);\n else\n return(KDC_ERR_NAME_EXP);\n }\n\n /* The client's password must not be expired, unless the server is\n a KRB5_KDC_PWCHANGE_SERVICE. */\n if (client.pw_expiration && client.pw_expiration < kdc_time &&\n !isflagset(server.attributes, KRB5_KDB_PWCHANGE_SERVICE)) {\n *status = \"CLIENT KEY EXPIRED\";\n if (vague_errors)\n return(KRB_ERR_GENERIC);\n else\n return(KDC_ERR_KEY_EXP);\n }\n\n /* The server must not be expired */\n if (server.expiration && server.expiration < kdc_time) {\n *status = \"SERVICE EXPIRED\";\n return(KDC_ERR_SERVICE_EXP);\n }\n\n /*\n * If the client requires password changing, then only allow the\n * pwchange service.\n */\n if (isflagset(client.attributes, KRB5_KDB_REQUIRES_PWCHANGE) &&\n !isflagset(server.attributes, KRB5_KDB_PWCHANGE_SERVICE)) {\n *status = \"REQUIRED PWCHANGE\";\n return(KDC_ERR_KEY_EXP);\n }\n\n /* Client and server must allow postdating tickets */\n if ((isflagset(request->kdc_options, KDC_OPT_ALLOW_POSTDATE) ||\n isflagset(request->kdc_options, KDC_OPT_POSTDATED)) &&\n (isflagset(client.attributes, KRB5_KDB_DISALLOW_POSTDATED) ||\n isflagset(server.attributes, KRB5_KDB_DISALLOW_POSTDATED))) {\n *status = \"POSTDATE NOT ALLOWED\";\n return(KDC_ERR_CANNOT_POSTDATE);\n }\n\n /*\n * A Windows KDC will return KDC_ERR_PREAUTH_REQUIRED instead of\n * KDC_ERR_POLICY in the following case:\n *\n * - KDC_OPT_FORWARDABLE is set in KDCOptions but local\n * policy has KRB5_KDB_DISALLOW_FORWARDABLE set for the\n * client, and;\n * - KRB5_KDB_REQUIRES_PRE_AUTH is set for the client but\n * preauthentication data is absent in the request.\n *\n * Hence, this check most be done after the check for preauth\n * data, and is now performed by validate_forwardable() (the\n * contents of which were previously below).\n */\n\n /* Client and server must allow proxiable tickets */\n if (isflagset(request->kdc_options, KDC_OPT_PROXIABLE) &&\n (isflagset(client.attributes, KRB5_KDB_DISALLOW_PROXIABLE) ||\n isflagset(server.attributes, KRB5_KDB_DISALLOW_PROXIABLE))) {\n *status = \"PROXIABLE NOT ALLOWED\";\n return(KDC_ERR_POLICY);\n }\n\n /* Check to see if client is locked out */\n if (isflagset(client.attributes, KRB5_KDB_DISALLOW_ALL_TIX)) {\n *status = \"CLIENT LOCKED OUT\";\n return(KDC_ERR_CLIENT_REVOKED);\n }\n\n /* Check to see if server is locked out */\n if (isflagset(server.attributes, KRB5_KDB_DISALLOW_ALL_TIX)) {\n *status = \"SERVICE LOCKED OUT\";\n return(KDC_ERR_S_PRINCIPAL_UNKNOWN);\n }\n\n /* Check to see if server is allowed to be a service */\n if (isflagset(server.attributes, KRB5_KDB_DISALLOW_SVR)) {\n *status = \"SERVICE NOT ALLOWED\";\n return(KDC_ERR_MUST_USE_USER2USER);\n }\n\n if (check_anon(kdc_active_realm, request->client, request->server) != 0) {\n *status = \"ANONYMOUS NOT ALLOWED\";\n return(KDC_ERR_POLICY);\n }\n\n /* Perform KDB module policy checks. */\n ret = krb5_db_check_policy_as(kdc_context, request, &client, &server,\n kdc_time, status, e_data);\n if (ret && ret != KRB5_PLUGIN_OP_NOTSUPP)\n return errcode_to_protocol(ret);\n\n /* Check against local policy. */\n errcode = against_local_policy_as(request, client, server,\n kdc_time, status, e_data);\n if (errcode)\n return errcode;\n\n return 0;\n}","target":"validate_as_request(kdc_realm_t *kdc_active_realm,\n register krb5_kdc_req *request, krb5_db_entry client,\n krb5_db_entry server, krb5_timestamp kdc_time,\n const char **status, krb5_pa_data ***e_data)\n{\n int errcode;\n krb5_error_code ret;\n\n /*\n * If an option is set that is only allowed in TGS requests, complain.\n */\n if (request->kdc_options & AS_INVALID_OPTIONS) {\n *status = \"INVALID AS OPTIONS\";\n return KDC_ERR_BADOPTION;\n }\n\n /* The client must not be expired */\n if (client.expiration && client.expiration < kdc_time) {\n *status = \"CLIENT EXPIRED\";\n if (vague_errors)\n return(KRB_ERR_GENERIC);\n else\n return(KDC_ERR_NAME_EXP);\n }\n\n /* The client's password must not be expired, unless the server is\n a KRB5_KDC_PWCHANGE_SERVICE. */\n if (client.pw_expiration && client.pw_expiration < kdc_time &&\n !isflagset(server.attributes, KRB5_KDB_PWCHANGE_SERVICE)) {\n *status = \"CLIENT KEY EXPIRED\";\n if (vague_errors)\n return(KRB_ERR_GENERIC);\n else\n return(KDC_ERR_KEY_EXP);\n }\n\n /* The server must not be expired */\n if (server.expiration && server.expiration < kdc_time) {\n *status = \"SERVICE EXPIRED\";\n return(KDC_ERR_SERVICE_EXP);\n }\n\n /*\n * If the client requires password changing, then only allow the\n * pwchange service.\n */\n if (isflagset(client.attributes, KRB5_KDB_REQUIRES_PWCHANGE) &&\n !isflagset(server.attributes, KRB5_KDB_PWCHANGE_SERVICE)) {\n *status = \"REQUIRED PWCHANGE\";\n return(KDC_ERR_KEY_EXP);\n }\n\n /* Client and server must allow postdating tickets */\n if ((isflagset(request->kdc_options, KDC_OPT_ALLOW_POSTDATE) ||\n isflagset(request->kdc_options, KDC_OPT_POSTDATED)) &&\n (isflagset(client.attributes, KRB5_KDB_DISALLOW_POSTDATED) ||\n isflagset(server.attributes, KRB5_KDB_DISALLOW_POSTDATED))) {\n *status = \"POSTDATE NOT ALLOWED\";\n return(KDC_ERR_CANNOT_POSTDATE);\n }\n\n /*\n * A Windows KDC will return KDC_ERR_PREAUTH_REQUIRED instead of\n * KDC_ERR_POLICY in the following case:\n *\n * - KDC_OPT_FORWARDABLE is set in KDCOptions but local\n * policy has KRB5_KDB_DISALLOW_FORWARDABLE set for the\n * client, and;\n * - KRB5_KDB_REQUIRES_PRE_AUTH is set for the client but\n * preauthentication data is absent in the request.\n *\n * Hence, this check most be done after the check for preauth\n * data, and is now performed by validate_forwardable() (the\n * contents of which were previously below).\n */\n\n /* Client and server must allow proxiable tickets */\n if (isflagset(request->kdc_options, KDC_OPT_PROXIABLE) &&\n (isflagset(client.attributes, KRB5_KDB_DISALLOW_PROXIABLE) ||\n isflagset(server.attributes, KRB5_KDB_DISALLOW_PROXIABLE))) {\n *status = \"PROXIABLE NOT ALLOWED\";\n return(KDC_ERR_POLICY);\n }\n\n /* Check to see if client is locked out */\n if (isflagset(client.attributes, KRB5_KDB_DISALLOW_ALL_TIX)) {\n *status = \"CLIENT LOCKED OUT\";\n return(KDC_ERR_CLIENT_REVOKED);\n }\n\n /* Check to see if server is locked out */\n if (isflagset(server.attributes, KRB5_KDB_DISALLOW_ALL_TIX)) {\n *status = \"SERVICE LOCKED OUT\";\n return(KDC_ERR_S_PRINCIPAL_UNKNOWN);\n }\n\n /* Check to see if server is allowed to be a service */\n if (isflagset(server.attributes, KRB5_KDB_DISALLOW_SVR)) {\n *status = \"SERVICE NOT ALLOWED\";\n return(KDC_ERR_MUST_USE_USER2USER);\n }\n\n if (check_anon(kdc_active_realm, client.princ, request->server) != 0) {\n *status = \"ANONYMOUS NOT ALLOWED\";\n return(KDC_ERR_POLICY);\n }\n\n /* Perform KDB module policy checks. */\n ret = krb5_db_check_policy_as(kdc_context, request, &client, &server,\n kdc_time, status, e_data);\n if (ret && ret != KRB5_PLUGIN_OP_NOTSUPP)\n return errcode_to_protocol(ret);\n\n /* Check against local policy. */\n errcode = against_local_policy_as(request, client, server,\n kdc_time, status, e_data);\n if (errcode)\n return errcode;\n\n return 0;\n}","lang":"c","vul_type":"cwe-476","target_token_count":1098,"sven_meta":{"func_name":"validate_as_request","file_name":"src/kdc/kdc_util.c","commit_link":"github.com/krb5/krb5/commit/93b4a6306a0026cf1cc31ac4bd8a49ba5d034ba7","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#14-8a701e8b74da","input":"int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)\n{\n\tint r;\n\t/* Assume we're using HV mode when the HV module is loaded */\n\tint hv_enabled = kvmppc_hv_ops ? 1 : 0;\n\n\tif (kvm) {\n\t\t/*\n\t\t * Hooray - we know which VM type we're running on. Depend on\n\t\t * that rather than the guess above.\n\t\t */\n\t\thv_enabled = is_kvmppc_hv_enabled(kvm);\n\t}\n\n\tswitch (ext) {\n#ifdef CONFIG_BOOKE\n\tcase KVM_CAP_PPC_BOOKE_SREGS:\n\tcase KVM_CAP_PPC_BOOKE_WATCHDOG:\n\tcase KVM_CAP_PPC_EPR:\n#else\n\tcase KVM_CAP_PPC_SEGSTATE:\n\tcase KVM_CAP_PPC_HIOR:\n\tcase KVM_CAP_PPC_PAPR:\n#endif\n\tcase KVM_CAP_PPC_UNSET_IRQ:\n\tcase KVM_CAP_PPC_IRQ_LEVEL:\n\tcase KVM_CAP_ENABLE_CAP:\n\tcase KVM_CAP_ENABLE_CAP_VM:\n\tcase KVM_CAP_ONE_REG:\n\tcase KVM_CAP_IOEVENTFD:\n\tcase KVM_CAP_DEVICE_CTRL:\n\tcase KVM_CAP_IMMEDIATE_EXIT:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_PPC_PAIRED_SINGLES:\n\tcase KVM_CAP_PPC_OSI:\n\tcase KVM_CAP_PPC_GET_PVINFO:\n#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)\n\tcase KVM_CAP_SW_TLB:\n#endif\n\t\t/* We support this only for PR */\n\t\tr = !hv_enabled;\n\t\tbreak;\n#ifdef CONFIG_KVM_MPIC\n\tcase KVM_CAP_IRQ_MPIC:\n\t\tr = 1;\n\t\tbreak;\n#endif\n\n#ifdef CONFIG_PPC_BOOK3S_64\n\tcase KVM_CAP_SPAPR_TCE:\n\tcase KVM_CAP_SPAPR_TCE_64:\n\t\t/* fallthrough */\n\tcase KVM_CAP_SPAPR_TCE_VFIO:\n\tcase KVM_CAP_PPC_RTAS:\n\tcase KVM_CAP_PPC_FIXUP_HCALL:\n\tcase KVM_CAP_PPC_ENABLE_HCALL:\n#ifdef CONFIG_KVM_XICS\n\tcase KVM_CAP_IRQ_XICS:\n#endif\n\t\tr = 1;\n\t\tbreak;\n\n\tcase KVM_CAP_PPC_ALLOC_HTAB:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif /* CONFIG_PPC_BOOK3S_64 */\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_SMT:\n\t\tr = 0;\n\t\tif (kvm) {\n\t\t\tif (kvm->arch.emul_smt_mode > 1)\n\t\t\t\tr = kvm->arch.emul_smt_mode;\n\t\t\telse\n\t\t\t\tr = kvm->arch.smt_mode;\n\t\t} else if (hv_enabled) {\n\t\t\tif (cpu_has_feature(CPU_FTR_ARCH_300))\n\t\t\t\tr = 1;\n\t\t\telse\n\t\t\t\tr = threads_per_subcore;\n\t\t}\n\t\tbreak;\n\tcase KVM_CAP_PPC_SMT_POSSIBLE:\n\t\tr = 1;\n\t\tif (hv_enabled) {\n\t\t\tif (!cpu_has_feature(CPU_FTR_ARCH_300))\n\t\t\t\tr = ((threads_per_subcore << 1) - 1);\n\t\t\telse\n\t\t\t\t/* P9 can emulate dbells, so allow any mode */\n\t\t\t\tr = 8 | 4 | 2 | 1;\n\t\t}\n\t\tbreak;\n\tcase KVM_CAP_PPC_RMA:\n\t\tr = 0;\n\t\tbreak;\n\tcase KVM_CAP_PPC_HWRNG:\n\t\tr = kvmppc_hwrng_present();\n\t\tbreak;\n\tcase KVM_CAP_PPC_MMU_RADIX:\n\t\tr = !!(hv_enabled && radix_enabled());\n\t\tbreak;\n\tcase KVM_CAP_PPC_MMU_HASH_V3:\n\t\tr = !!(hv_enabled && !radix_enabled() &&\n\t\t cpu_has_feature(CPU_FTR_ARCH_300));\n\t\tbreak;\n#endif\n\tcase KVM_CAP_SYNC_MMU:\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\t\tr = hv_enabled;\n#elif defined(KVM_ARCH_WANT_MMU_NOTIFIER)\n\t\tr = 1;\n#else\n\t\tr = 0;\n#endif\n\t\tbreak;\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_HTAB_FD:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif\n\tcase KVM_CAP_NR_VCPUS:\n\t\t/*\n\t\t * Recommending a number of CPUs is somewhat arbitrary; we\n\t\t * return the number of present CPUs for -HV (since a host\n\t\t * will have secondary threads \"offline\"), and for other KVM\n\t\t * implementations just count online CPUs.\n\t\t */\n\t\tif (hv_enabled)\n\t\t\tr = num_present_cpus();\n\t\telse\n\t\t\tr = num_online_cpus();\n\t\tbreak;\n\tcase KVM_CAP_NR_MEMSLOTS:\n\t\tr = KVM_USER_MEM_SLOTS;\n\t\tbreak;\n\tcase KVM_CAP_MAX_VCPUS:\n\t\tr = KVM_MAX_VCPUS;\n\t\tbreak;\n#ifdef CONFIG_PPC_BOOK3S_64\n\tcase KVM_CAP_PPC_GET_SMMU_INFO:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_SPAPR_MULTITCE:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_SPAPR_RESIZE_HPT:\n\t\t/* Disable this on POWER9 until code handles new HPTE format */\n\t\tr = !!hv_enabled && !cpu_has_feature(CPU_FTR_ARCH_300);\n\t\tbreak;\n#endif\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_FWNMI:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif\n\tcase KVM_CAP_PPC_HTM:\n\t\tr = cpu_has_feature(CPU_FTR_TM_COMP) &&\n\t\t is_kvmppc_hv_enabled(kvm);\n\t\tbreak;\n\tdefault:\n\t\tr = 0;\n\t\tbreak;\n\t}\n\treturn r;\n\n}","target":"int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)\n{\n\tint r;\n\t/* Assume we're using HV mode when the HV module is loaded */\n\tint hv_enabled = kvmppc_hv_ops ? 1 : 0;\n\n\tif (kvm) {\n\t\t/*\n\t\t * Hooray - we know which VM type we're running on. Depend on\n\t\t * that rather than the guess above.\n\t\t */\n\t\thv_enabled = is_kvmppc_hv_enabled(kvm);\n\t}\n\n\tswitch (ext) {\n#ifdef CONFIG_BOOKE\n\tcase KVM_CAP_PPC_BOOKE_SREGS:\n\tcase KVM_CAP_PPC_BOOKE_WATCHDOG:\n\tcase KVM_CAP_PPC_EPR:\n#else\n\tcase KVM_CAP_PPC_SEGSTATE:\n\tcase KVM_CAP_PPC_HIOR:\n\tcase KVM_CAP_PPC_PAPR:\n#endif\n\tcase KVM_CAP_PPC_UNSET_IRQ:\n\tcase KVM_CAP_PPC_IRQ_LEVEL:\n\tcase KVM_CAP_ENABLE_CAP:\n\tcase KVM_CAP_ENABLE_CAP_VM:\n\tcase KVM_CAP_ONE_REG:\n\tcase KVM_CAP_IOEVENTFD:\n\tcase KVM_CAP_DEVICE_CTRL:\n\tcase KVM_CAP_IMMEDIATE_EXIT:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_PPC_PAIRED_SINGLES:\n\tcase KVM_CAP_PPC_OSI:\n\tcase KVM_CAP_PPC_GET_PVINFO:\n#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)\n\tcase KVM_CAP_SW_TLB:\n#endif\n\t\t/* We support this only for PR */\n\t\tr = !hv_enabled;\n\t\tbreak;\n#ifdef CONFIG_KVM_MPIC\n\tcase KVM_CAP_IRQ_MPIC:\n\t\tr = 1;\n\t\tbreak;\n#endif\n\n#ifdef CONFIG_PPC_BOOK3S_64\n\tcase KVM_CAP_SPAPR_TCE:\n\tcase KVM_CAP_SPAPR_TCE_64:\n\t\t/* fallthrough */\n\tcase KVM_CAP_SPAPR_TCE_VFIO:\n\tcase KVM_CAP_PPC_RTAS:\n\tcase KVM_CAP_PPC_FIXUP_HCALL:\n\tcase KVM_CAP_PPC_ENABLE_HCALL:\n#ifdef CONFIG_KVM_XICS\n\tcase KVM_CAP_IRQ_XICS:\n#endif\n\t\tr = 1;\n\t\tbreak;\n\n\tcase KVM_CAP_PPC_ALLOC_HTAB:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif /* CONFIG_PPC_BOOK3S_64 */\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_SMT:\n\t\tr = 0;\n\t\tif (kvm) {\n\t\t\tif (kvm->arch.emul_smt_mode > 1)\n\t\t\t\tr = kvm->arch.emul_smt_mode;\n\t\t\telse\n\t\t\t\tr = kvm->arch.smt_mode;\n\t\t} else if (hv_enabled) {\n\t\t\tif (cpu_has_feature(CPU_FTR_ARCH_300))\n\t\t\t\tr = 1;\n\t\t\telse\n\t\t\t\tr = threads_per_subcore;\n\t\t}\n\t\tbreak;\n\tcase KVM_CAP_PPC_SMT_POSSIBLE:\n\t\tr = 1;\n\t\tif (hv_enabled) {\n\t\t\tif (!cpu_has_feature(CPU_FTR_ARCH_300))\n\t\t\t\tr = ((threads_per_subcore << 1) - 1);\n\t\t\telse\n\t\t\t\t/* P9 can emulate dbells, so allow any mode */\n\t\t\t\tr = 8 | 4 | 2 | 1;\n\t\t}\n\t\tbreak;\n\tcase KVM_CAP_PPC_RMA:\n\t\tr = 0;\n\t\tbreak;\n\tcase KVM_CAP_PPC_HWRNG:\n\t\tr = kvmppc_hwrng_present();\n\t\tbreak;\n\tcase KVM_CAP_PPC_MMU_RADIX:\n\t\tr = !!(hv_enabled && radix_enabled());\n\t\tbreak;\n\tcase KVM_CAP_PPC_MMU_HASH_V3:\n\t\tr = !!(hv_enabled && !radix_enabled() &&\n\t\t cpu_has_feature(CPU_FTR_ARCH_300));\n\t\tbreak;\n#endif\n\tcase KVM_CAP_SYNC_MMU:\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\t\tr = hv_enabled;\n#elif defined(KVM_ARCH_WANT_MMU_NOTIFIER)\n\t\tr = 1;\n#else\n\t\tr = 0;\n#endif\n\t\tbreak;\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_HTAB_FD:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif\n\tcase KVM_CAP_NR_VCPUS:\n\t\t/*\n\t\t * Recommending a number of CPUs is somewhat arbitrary; we\n\t\t * return the number of present CPUs for -HV (since a host\n\t\t * will have secondary threads \"offline\"), and for other KVM\n\t\t * implementations just count online CPUs.\n\t\t */\n\t\tif (hv_enabled)\n\t\t\tr = num_present_cpus();\n\t\telse\n\t\t\tr = num_online_cpus();\n\t\tbreak;\n\tcase KVM_CAP_NR_MEMSLOTS:\n\t\tr = KVM_USER_MEM_SLOTS;\n\t\tbreak;\n\tcase KVM_CAP_MAX_VCPUS:\n\t\tr = KVM_MAX_VCPUS;\n\t\tbreak;\n#ifdef CONFIG_PPC_BOOK3S_64\n\tcase KVM_CAP_PPC_GET_SMMU_INFO:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_SPAPR_MULTITCE:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_SPAPR_RESIZE_HPT:\n\t\t/* Disable this on POWER9 until code handles new HPTE format */\n\t\tr = !!hv_enabled && !cpu_has_feature(CPU_FTR_ARCH_300);\n\t\tbreak;\n#endif\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_FWNMI:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif\n\tcase KVM_CAP_PPC_HTM:\n\t\tr = cpu_has_feature(CPU_FTR_TM_COMP) && hv_enabled;\n\t\tbreak;\n\tdefault:\n\t\tr = 0;\n\t\tbreak;\n\t}\n\treturn r;\n\n}","lang":"c","vul_type":"cwe-476","target_token_count":1257,"sven_meta":{"func_name":"kvm_vm_ioctl_check_extension","file_name":"arch/powerpc/kvm/powerpc.c","commit_link":"github.com/torvalds/linux/commit/ac64115a66c18c01745bbd3c47a36b124e5fd8c0","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#15-8a8c6fe3d38e","input":"static bool handle_client_startup(PgSocket *client, PktHdr *pkt)\n{\n\tconst char *passwd;\n\tconst uint8_t *key;\n\tbool ok;\n\n\tSBuf *sbuf = &client->sbuf;\n\n\t/* don't tolerate partial packets */\n\tif (incomplete_pkt(pkt)) {\n\t\tdisconnect_client(client, true, \"client sent partial pkt in startup phase\");\n\t\treturn false;\n\t}\n\n\tif (client->wait_for_welcome) {\n\t\tif (finish_client_login(client)) {\n\t\t\t/* the packet was already parsed */\n\t\t\tsbuf_prepare_skip(sbuf, pkt->len);\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}\n\n\tswitch (pkt->type) {\n\tcase PKT_SSLREQ:\n\t\tslog_noise(client, \"C: req SSL\");\n\t\tslog_noise(client, \"P: nak\");\n\n\t\t/* reject SSL attempt */\n\t\tif (!sbuf_answer(&client->sbuf, \"N\", 1)) {\n\t\t\tdisconnect_client(client, false, \"failed to nak SSL\");\n\t\t\treturn false;\n\t\t}\n\t\tbreak;\n\tcase PKT_STARTUP_V2:\n\t\tdisconnect_client(client, true, \"Old V2 protocol not supported\");\n\t\treturn false;\n\tcase PKT_STARTUP:\n\t\tif (client->pool) {\n\t\t\tdisconnect_client(client, true, \"client re-sent startup pkt\");\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!decide_startup_pool(client, pkt))\n\t\t\treturn false;\n\n\t\tif (client->pool->db->admin) {\n\t\t\tif (!admin_pre_login(client))\n\t\t\t\treturn false;\n\t\t}\n\n\t\tif (cf_auth_type <= AUTH_TRUST || client->own_user) {\n\t\t\tif (!finish_client_login(client))\n\t\t\t\treturn false;\n\t\t} else {\n\t\t\tif (!send_client_authreq(client)) {\n\t\t\t\tdisconnect_client(client, false, \"failed to send auth req\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase 'p':\t\t/* PasswordMessage */\n\t\t/* haven't requested it */\n\t\tif (cf_auth_type <= AUTH_TRUST) {\n\t\t\tdisconnect_client(client, true, \"unrequested passwd pkt\");\n\t\t\treturn false;\n\t\t}\n\n\t\tok = mbuf_get_string(&pkt->data, &passwd);\n\t\tif (ok && check_client_passwd(client, passwd)) {\n\t\t\tif (!finish_client_login(client))\n\t\t\t\treturn false;\n\t\t} else {\n\t\t\tdisconnect_client(client, true, \"Auth failed\");\n\t\t\treturn false;\n\t\t}\n\t\tbreak;\n\tcase PKT_CANCEL:\n\t\tif (mbuf_avail_for_read(&pkt->data) == BACKENDKEY_LEN\n\t\t && mbuf_get_bytes(&pkt->data, BACKENDKEY_LEN, &key))\n\t\t{\n\t\t\tmemcpy(client->cancel_key, key, BACKENDKEY_LEN);\n\t\t\taccept_cancel_request(client);\n\t\t} else\n\t\t\tdisconnect_client(client, false, \"bad cancel request\");\n\t\treturn false;\n\tdefault:\n\t\tdisconnect_client(client, false, \"bad packet\");\n\t\treturn false;\n\t}\n\tsbuf_prepare_skip(sbuf, pkt->len);\n\tclient->request_time = get_cached_time();\n\treturn true;\n}","target":"static bool handle_client_startup(PgSocket *client, PktHdr *pkt)\n{\n\tconst char *passwd;\n\tconst uint8_t *key;\n\tbool ok;\n\n\tSBuf *sbuf = &client->sbuf;\n\n\t/* don't tolerate partial packets */\n\tif (incomplete_pkt(pkt)) {\n\t\tdisconnect_client(client, true, \"client sent partial pkt in startup phase\");\n\t\treturn false;\n\t}\n\n\tif (client->wait_for_welcome) {\n\t\tif (finish_client_login(client)) {\n\t\t\t/* the packet was already parsed */\n\t\t\tsbuf_prepare_skip(sbuf, pkt->len);\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}\n\n\tswitch (pkt->type) {\n\tcase PKT_SSLREQ:\n\t\tslog_noise(client, \"C: req SSL\");\n\t\tslog_noise(client, \"P: nak\");\n\n\t\t/* reject SSL attempt */\n\t\tif (!sbuf_answer(&client->sbuf, \"N\", 1)) {\n\t\t\tdisconnect_client(client, false, \"failed to nak SSL\");\n\t\t\treturn false;\n\t\t}\n\t\tbreak;\n\tcase PKT_STARTUP_V2:\n\t\tdisconnect_client(client, true, \"Old V2 protocol not supported\");\n\t\treturn false;\n\tcase PKT_STARTUP:\n\t\tif (client->pool) {\n\t\t\tdisconnect_client(client, true, \"client re-sent startup pkt\");\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!decide_startup_pool(client, pkt))\n\t\t\treturn false;\n\n\t\tif (client->pool->db->admin) {\n\t\t\tif (!admin_pre_login(client))\n\t\t\t\treturn false;\n\t\t}\n\n\t\tif (cf_auth_type <= AUTH_TRUST || client->own_user) {\n\t\t\tif (!finish_client_login(client))\n\t\t\t\treturn false;\n\t\t} else {\n\t\t\tif (!send_client_authreq(client)) {\n\t\t\t\tdisconnect_client(client, false, \"failed to send auth req\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase 'p':\t\t/* PasswordMessage */\n\t\t/* too early */\n\t\tif (!client->auth_user) {\n\t\t\tdisconnect_client(client, true, \"client password pkt before startup packet\");\n\t\t\treturn false;\n\t\t}\n\n\t\t/* haven't requested it */\n\t\tif (cf_auth_type <= AUTH_TRUST) {\n\t\t\tdisconnect_client(client, true, \"unrequested passwd pkt\");\n\t\t\treturn false;\n\t\t}\n\n\t\tok = mbuf_get_string(&pkt->data, &passwd);\n\t\tif (ok && check_client_passwd(client, passwd)) {\n\t\t\tif (!finish_client_login(client))\n\t\t\t\treturn false;\n\t\t} else {\n\t\t\tdisconnect_client(client, true, \"Auth failed\");\n\t\t\treturn false;\n\t\t}\n\t\tbreak;\n\tcase PKT_CANCEL:\n\t\tif (mbuf_avail_for_read(&pkt->data) == BACKENDKEY_LEN\n\t\t && mbuf_get_bytes(&pkt->data, BACKENDKEY_LEN, &key))\n\t\t{\n\t\t\tmemcpy(client->cancel_key, key, BACKENDKEY_LEN);\n\t\t\taccept_cancel_request(client);\n\t\t} else\n\t\t\tdisconnect_client(client, false, \"bad cancel request\");\n\t\treturn false;\n\tdefault:\n\t\tdisconnect_client(client, false, \"bad packet\");\n\t\treturn false;\n\t}\n\tsbuf_prepare_skip(sbuf, pkt->len);\n\tclient->request_time = get_cached_time();\n\treturn true;\n}","lang":"c","vul_type":"cwe-476","target_token_count":694,"sven_meta":{"func_name":"handle_client_startup","file_name":"src/client.c","commit_link":"github.com/pgbouncer/pgbouncer/commit/74d6e5f7de5ec736f71204b7b422af7380c19ac5","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#17-fb4fbd804bed","input":"static int nsv_read_chunk(AVFormatContext *s, int fill_header)\n{\n NSVContext *nsv = s->priv_data;\n AVIOContext *pb = s->pb;\n AVStream *st[2] = {NULL, NULL};\n NSVStream *nst;\n AVPacket *pkt;\n int i, err = 0;\n uint8_t auxcount; /* number of aux metadata, also 4 bits of vsize */\n uint32_t vsize;\n uint16_t asize;\n uint16_t auxsize;\n\n if (nsv->ahead[0].data || nsv->ahead[1].data)\n return 0; //-1; /* hey! eat what you've in your plate first! */\n\nnull_chunk_retry:\n if (pb->eof_reached)\n return -1;\n\n for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++)\n err = nsv_resync(s);\n if (err < 0)\n return err;\n if (nsv->state == NSV_FOUND_NSVS)\n err = nsv_parse_NSVs_header(s);\n if (err < 0)\n return err;\n if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF)\n return -1;\n\n auxcount = avio_r8(pb);\n vsize = avio_rl16(pb);\n asize = avio_rl16(pb);\n vsize = (vsize << 4) | (auxcount >> 4);\n auxcount &= 0x0f;\n av_log(s, AV_LOG_TRACE, \"NSV CHUNK %\"PRIu8\" aux, %\"PRIu32\" bytes video, %\"PRIu16\" bytes audio\\n\",\n auxcount, vsize, asize);\n /* skip aux stuff */\n for (i = 0; i < auxcount; i++) {\n uint32_t av_unused auxtag;\n auxsize = avio_rl16(pb);\n auxtag = avio_rl32(pb);\n avio_skip(pb, auxsize);\n vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming brain-dead */\n }\n\n if (pb->eof_reached)\n return -1;\n if (!vsize && !asize) {\n nsv->state = NSV_UNSYNC;\n goto null_chunk_retry;\n }\n\n /* map back streams to v,a */\n if (s->nb_streams > 0)\n st[s->streams[0]->id] = s->streams[0];\n if (s->nb_streams > 1)\n st[s->streams[1]->id] = s->streams[1];\n\n if (vsize && st[NSV_ST_VIDEO]) {\n nst = st[NSV_ST_VIDEO]->priv_data;\n pkt = &nsv->ahead[NSV_ST_VIDEO];\n av_get_packet(pb, pkt, vsize);\n pkt->stream_index = st[NSV_ST_VIDEO]->index;//NSV_ST_VIDEO;\n pkt->dts = nst->frame_offset;\n pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */\n for (i = 0; i < FFMIN(8, vsize); i++)\n av_log(s, AV_LOG_TRACE, \"NSV video: [%d] = %02\"PRIx8\"\\n\",\n i, pkt->data[i]);\n }\n if(st[NSV_ST_VIDEO])\n ((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset++;\n\n if (asize && st[NSV_ST_AUDIO]) {\n nst = st[NSV_ST_AUDIO]->priv_data;\n pkt = &nsv->ahead[NSV_ST_AUDIO];\n /* read raw audio specific header on the first audio chunk... */\n /* on ALL audio chunks ?? seems so! */\n if (asize && st[NSV_ST_AUDIO]->codecpar->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {\n uint8_t bps;\n uint8_t channels;\n uint16_t samplerate;\n bps = avio_r8(pb);\n channels = avio_r8(pb);\n samplerate = avio_rl16(pb);\n if (!channels || !samplerate)\n return AVERROR_INVALIDDATA;\n asize-=4;\n av_log(s, AV_LOG_TRACE, \"NSV RAWAUDIO: bps %\"PRIu8\", nchan %\"PRIu8\", srate %\"PRIu16\"\\n\",\n bps, channels, samplerate);\n if (fill_header) {\n st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */\n if (bps != 16) {\n av_log(s, AV_LOG_TRACE, \"NSV AUDIO bit/sample != 16 (%\"PRIu8\")!!!\\n\", bps);\n }\n bps /= channels; // ???\n if (bps == 8)\n st[NSV_ST_AUDIO]->codecpar->codec_id = AV_CODEC_ID_PCM_U8;\n samplerate /= 4;/* UGH ??? XXX */\n channels = 1;\n st[NSV_ST_AUDIO]->codecpar->channels = channels;\n st[NSV_ST_AUDIO]->codecpar->sample_rate = samplerate;\n av_log(s, AV_LOG_TRACE, \"NSV RAWAUDIO: bps %\"PRIu8\", nchan %\"PRIu8\", srate %\"PRIu16\"\\n\",\n bps, channels, samplerate);\n }\n }\n av_get_packet(pb, pkt, asize);\n pkt->stream_index = st[NSV_ST_AUDIO]->index;//NSV_ST_AUDIO;\n pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */\n if( nsv->state == NSV_HAS_READ_NSVS && st[NSV_ST_VIDEO] ) {\n /* on a nsvs frame we have new information on a/v sync */\n pkt->dts = (((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset-1);\n pkt->dts *= (int64_t)1000 * nsv->framerate.den;\n pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num;\n av_log(s, AV_LOG_TRACE, \"NSV AUDIO: sync:%\"PRId16\", dts:%\"PRId64,\n nsv->avsync, pkt->dts);\n }\n nst->frame_offset++;\n }\n\n nsv->state = NSV_UNSYNC;\n return 0;\n}","target":"static int nsv_read_chunk(AVFormatContext *s, int fill_header)\n{\n NSVContext *nsv = s->priv_data;\n AVIOContext *pb = s->pb;\n AVStream *st[2] = {NULL, NULL};\n NSVStream *nst;\n AVPacket *pkt;\n int i, err = 0;\n uint8_t auxcount; /* number of aux metadata, also 4 bits of vsize */\n uint32_t vsize;\n uint16_t asize;\n uint16_t auxsize;\n int ret;\n\n if (nsv->ahead[0].data || nsv->ahead[1].data)\n return 0; //-1; /* hey! eat what you've in your plate first! */\n\nnull_chunk_retry:\n if (pb->eof_reached)\n return -1;\n\n for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++)\n err = nsv_resync(s);\n if (err < 0)\n return err;\n if (nsv->state == NSV_FOUND_NSVS)\n err = nsv_parse_NSVs_header(s);\n if (err < 0)\n return err;\n if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF)\n return -1;\n\n auxcount = avio_r8(pb);\n vsize = avio_rl16(pb);\n asize = avio_rl16(pb);\n vsize = (vsize << 4) | (auxcount >> 4);\n auxcount &= 0x0f;\n av_log(s, AV_LOG_TRACE, \"NSV CHUNK %\"PRIu8\" aux, %\"PRIu32\" bytes video, %\"PRIu16\" bytes audio\\n\",\n auxcount, vsize, asize);\n /* skip aux stuff */\n for (i = 0; i < auxcount; i++) {\n uint32_t av_unused auxtag;\n auxsize = avio_rl16(pb);\n auxtag = avio_rl32(pb);\n avio_skip(pb, auxsize);\n vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming brain-dead */\n }\n\n if (pb->eof_reached)\n return -1;\n if (!vsize && !asize) {\n nsv->state = NSV_UNSYNC;\n goto null_chunk_retry;\n }\n\n /* map back streams to v,a */\n if (s->nb_streams > 0)\n st[s->streams[0]->id] = s->streams[0];\n if (s->nb_streams > 1)\n st[s->streams[1]->id] = s->streams[1];\n\n if (vsize && st[NSV_ST_VIDEO]) {\n nst = st[NSV_ST_VIDEO]->priv_data;\n pkt = &nsv->ahead[NSV_ST_VIDEO];\n if ((ret = av_get_packet(pb, pkt, vsize)) < 0)\n return ret;\n pkt->stream_index = st[NSV_ST_VIDEO]->index;//NSV_ST_VIDEO;\n pkt->dts = nst->frame_offset;\n pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */\n for (i = 0; i < FFMIN(8, vsize); i++)\n av_log(s, AV_LOG_TRACE, \"NSV video: [%d] = %02\"PRIx8\"\\n\",\n i, pkt->data[i]);\n }\n if(st[NSV_ST_VIDEO])\n ((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset++;\n\n if (asize && st[NSV_ST_AUDIO]) {\n nst = st[NSV_ST_AUDIO]->priv_data;\n pkt = &nsv->ahead[NSV_ST_AUDIO];\n /* read raw audio specific header on the first audio chunk... */\n /* on ALL audio chunks ?? seems so! */\n if (asize && st[NSV_ST_AUDIO]->codecpar->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {\n uint8_t bps;\n uint8_t channels;\n uint16_t samplerate;\n bps = avio_r8(pb);\n channels = avio_r8(pb);\n samplerate = avio_rl16(pb);\n if (!channels || !samplerate)\n return AVERROR_INVALIDDATA;\n asize-=4;\n av_log(s, AV_LOG_TRACE, \"NSV RAWAUDIO: bps %\"PRIu8\", nchan %\"PRIu8\", srate %\"PRIu16\"\\n\",\n bps, channels, samplerate);\n if (fill_header) {\n st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */\n if (bps != 16) {\n av_log(s, AV_LOG_TRACE, \"NSV AUDIO bit/sample != 16 (%\"PRIu8\")!!!\\n\", bps);\n }\n bps /= channels; // ???\n if (bps == 8)\n st[NSV_ST_AUDIO]->codecpar->codec_id = AV_CODEC_ID_PCM_U8;\n samplerate /= 4;/* UGH ??? XXX */\n channels = 1;\n st[NSV_ST_AUDIO]->codecpar->channels = channels;\n st[NSV_ST_AUDIO]->codecpar->sample_rate = samplerate;\n av_log(s, AV_LOG_TRACE, \"NSV RAWAUDIO: bps %\"PRIu8\", nchan %\"PRIu8\", srate %\"PRIu16\"\\n\",\n bps, channels, samplerate);\n }\n }\n if ((ret = av_get_packet(pb, pkt, asize)) < 0)\n return ret;\n pkt->stream_index = st[NSV_ST_AUDIO]->index;//NSV_ST_AUDIO;\n pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */\n if( nsv->state == NSV_HAS_READ_NSVS && st[NSV_ST_VIDEO] ) {\n /* on a nsvs frame we have new information on a/v sync */\n pkt->dts = (((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset-1);\n pkt->dts *= (int64_t)1000 * nsv->framerate.den;\n pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num;\n av_log(s, AV_LOG_TRACE, \"NSV AUDIO: sync:%\"PRId16\", dts:%\"PRId64,\n nsv->avsync, pkt->dts);\n }\n nst->frame_offset++;\n }\n\n nsv->state = NSV_UNSYNC;\n return 0;\n}","lang":"c","vul_type":"cwe-476","target_token_count":1553,"sven_meta":{"func_name":"nsv_read_chunk","file_name":"libavformat/nsvdec.c","commit_link":"github.com/libav/libav/commit/fe6eea99efac66839052af547426518efd970b24","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#18-1a0c52215025","input":"_kdc_as_rep(kdc_request_t r,\n\t krb5_data *reply,\n\t const char *from,\n\t struct sockaddr *from_addr,\n\t int datagram_reply)\n{\n krb5_context context = r->context;\n krb5_kdc_configuration *config = r->config;\n KDC_REQ *req = &r->req;\n KDC_REQ_BODY *b = NULL;\n AS_REP rep;\n KDCOptions f;\n krb5_enctype setype;\n krb5_error_code ret = 0;\n Key *skey;\n int found_pa = 0;\n int i, flags = HDB_F_FOR_AS_REQ;\n METHOD_DATA error_method;\n const PA_DATA *pa;\n\n memset(&rep, 0, sizeof(rep));\n error_method.len = 0;\n error_method.val = NULL;\n\n /*\n * Look for FAST armor and unwrap\n */\n ret = _kdc_fast_unwrap_request(r);\n if (ret) {\n\t_kdc_r_log(r, 0, \"FAST unwrap request from %s failed: %d\", from, ret);\n\tgoto out;\n }\n\n b = &req->req_body;\n f = b->kdc_options;\n\n if (f.canonicalize)\n\tflags |= HDB_F_CANON;\n\n if(b->sname == NULL){\n\tret = KRB5KRB_ERR_GENERIC;\n\t_kdc_set_e_text(r, \"No server in request\");\n } else{\n\tret = _krb5_principalname2krb5_principal (context,\n\t\t\t\t\t\t &r->server_princ,\n\t\t\t\t\t\t *(b->sname),\n\t\t\t\t\t\t b->realm);\n\tif (ret == 0)\n\t ret = krb5_unparse_name(context, r->server_princ, &r->server_name);\n }\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"AS-REQ malformed server name from %s\", from);\n\tgoto out;\n }\n if(b->cname == NULL){\n\tret = KRB5KRB_ERR_GENERIC;\n\t_kdc_set_e_text(r, \"No client in request\");\n } else {\n\tret = _krb5_principalname2krb5_principal (context,\n\t\t\t\t\t\t &r->client_princ,\n\t\t\t\t\t\t *(b->cname),\n\t\t\t\t\t\t b->realm);\n\tif (ret)\n\t goto out;\n\n\tret = krb5_unparse_name(context, r->client_princ, &r->client_name);\n }\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"AS-REQ malformed client name from %s\", from);\n\tgoto out;\n }\n\n kdc_log(context, config, 0, \"AS-REQ %s from %s for %s\",\n\t r->client_name, from, r->server_name);\n\n /*\n *\n */\n\n if (_kdc_is_anonymous(context, r->client_princ)) {\n\tif (!_kdc_is_anon_request(b)) {\n\t kdc_log(context, config, 0, \"Anonymous ticket w/o anonymous flag\");\n\t ret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\t goto out;\n\t}\n } else if (_kdc_is_anon_request(b)) {\n\tkdc_log(context, config, 0,\n\t\t\"Request for a anonymous ticket with non \"\n\t\t\"anonymous client name: %s\", r->client_name);\n\tret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n\n /*\n *\n */\n\n ret = _kdc_db_fetch(context, config, r->client_princ,\n\t\t\tHDB_F_GET_CLIENT | flags, NULL,\n\t\t\t&r->clientdb, &r->client);\n if(ret == HDB_ERR_NOT_FOUND_HERE) {\n\tkdc_log(context, config, 5, \"client %s does not have secrets at this KDC, need to proxy\",\n\t\tr->client_name);\n\tgoto out;\n } else if (ret == HDB_ERR_WRONG_REALM) {\n\tchar *fixed_client_name = NULL;\n\n\tret = krb5_unparse_name(context, r->client->entry.principal,\n\t\t\t\t&fixed_client_name);\n\tif (ret) {\n\t goto out;\n\t}\n\n\tkdc_log(context, config, 0, \"WRONG_REALM - %s -> %s\",\n\t\tr->client_name, fixed_client_name);\n\tfree(fixed_client_name);\n\n\tret = _kdc_fast_mk_error(context, r,\n\t\t\t\t &error_method,\n\t\t\t\t r->armor_crypto,\n\t\t\t\t &req->req_body,\n\t\t\t\t KRB5_KDC_ERR_WRONG_REALM,\n\t\t\t\t NULL,\n\t\t\t\t r->server_princ,\n\t\t\t\t NULL,\n\t\t\t\t &r->client->entry.principal->realm,\n\t\t\t\t NULL, NULL,\n\t\t\t\t reply);\n\tgoto out;\n } else if(ret){\n\tconst char *msg = krb5_get_error_message(context, ret);\n\tkdc_log(context, config, 0, \"UNKNOWN -- %s: %s\", r->client_name, msg);\n\tkrb5_free_error_message(context, msg);\n\tret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n ret = _kdc_db_fetch(context, config, r->server_princ,\n\t\t\tHDB_F_GET_SERVER|HDB_F_GET_KRBTGT | flags,\n\t\t\tNULL, NULL, &r->server);\n if(ret == HDB_ERR_NOT_FOUND_HERE) {\n\tkdc_log(context, config, 5, \"target %s does not have secrets at this KDC, need to proxy\",\n\t\tr->server_name);\n\tgoto out;\n } else if(ret){\n\tconst char *msg = krb5_get_error_message(context, ret);\n\tkdc_log(context, config, 0, \"UNKNOWN -- %s: %s\", r->server_name, msg);\n\tkrb5_free_error_message(context, msg);\n\tret = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n\n /*\n * Select a session enctype from the list of the crypto system\n * supported enctypes that is supported by the client and is one of\n * the enctype of the enctype of the service (likely krbtgt).\n *\n * The latter is used as a hint of what enctypes all KDC support,\n * to make sure a newer version of KDC won't generate a session\n * enctype that an older version of a KDC in the same realm can't\n * decrypt.\n */\n\n ret = _kdc_find_etype(context,\n\t\t\t krb5_principal_is_krbtgt(context, r->server_princ) ?\n\t\t\t config->tgt_use_strongest_session_key :\n\t\t\t config->svc_use_strongest_session_key, FALSE,\n\t\t\t r->client, b->etype.val, b->etype.len, &r->sessionetype,\n\t\t\t NULL);\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"Client (%s) from %s has no common enctypes with KDC \"\n\t\t\"to use for the session key\",\n\t\tr->client_name, from);\n\tgoto out;\n }\n\n /*\n * Pre-auth processing\n */\n\n if(req->padata){\n\tunsigned int n;\n\n\tlog_patypes(context, config, req->padata);\n\n\t/* Check if preauth matching */\n\n\tfor (n = 0; !found_pa && n < sizeof(pat) / sizeof(pat[0]); n++) {\n\t if (pat[n].validate == NULL)\n\t\tcontinue;\n\t if (r->armor_crypto == NULL && (pat[n].flags & PA_REQ_FAST))\n\t\tcontinue;\n\n\t kdc_log(context, config, 5,\n\t\t \"Looking for %s pa-data -- %s\", pat[n].name, r->client_name);\n\t i = 0;\n\t pa = _kdc_find_padata(req, &i, pat[n].type);\n\t if (pa) {\n\t\tret = pat[n].validate(r, pa);\n\t\tif (ret != 0) {\n\t\t goto out;\n\t\t}\n\t\tkdc_log(context, config, 0,\n\t\t\t\"%s pre-authentication succeeded -- %s\",\n\t\t\tpat[n].name, r->client_name);\n\t\tfound_pa = 1;\n\t\tr->et.flags.pre_authent = 1;\n\t }\n\t}\n }\n\n if (found_pa == 0) {\n\tKey *ckey = NULL;\n\tsize_t n;\n\n\tfor (n = 0; n < sizeof(pat) / sizeof(pat[0]); n++) {\n\t if ((pat[n].flags & PA_ANNOUNCE) == 0)\n\t\tcontinue;\n\t ret = krb5_padata_add(context, &error_method,\n\t\t\t\t pat[n].type, NULL, 0);\n\t if (ret)\n\t\tgoto out;\n\t}\n\n\t/*\n\t * If there is a client key, send ETYPE_INFO{,2}\n\t */\n\tret = _kdc_find_etype(context,\n\t\t\t config->preauth_use_strongest_session_key, TRUE,\n\t\t\t r->client, b->etype.val, b->etype.len, NULL, &ckey);\n\tif (ret == 0) {\n\n\t /*\n\t * RFC4120 requires:\n\t * - If the client only knows about old enctypes, then send\n\t * both info replies (we send 'info' first in the list).\n\t * - If the client is 'modern', because it knows about 'new'\n\t * enctype types, then only send the 'info2' reply.\n\t *\n\t * Before we send the full list of etype-info data, we pick\n\t * the client key we would have used anyway below, just pick\n\t * that instead.\n\t */\n\n\t if (older_enctype(ckey->key.keytype)) {\n\t\tret = get_pa_etype_info(context, config,\n\t\t\t\t\t&error_method, ckey);\n\t\tif (ret)\n\t\t goto out;\n\t }\n\t ret = get_pa_etype_info2(context, config,\n\t\t\t\t &error_method, ckey);\n\t if (ret)\n\t\tgoto out;\n\t}\n\n\t/* \n\t * send requre preauth is its required or anon is requested,\n\t * anon is today only allowed via preauth mechanisms.\n\t */\n\tif (require_preauth_p(r) || _kdc_is_anon_request(b)) {\n\t ret = KRB5KDC_ERR_PREAUTH_REQUIRED;\n\t _kdc_set_e_text(r, \"Need to use PA-ENC-TIMESTAMP/PA-PK-AS-REQ\");\n\t goto out;\n\t}\n\n\tif (ckey == NULL) {\n\t ret = KRB5KDC_ERR_CLIENT_NOTYET;\n\t _kdc_set_e_text(r, \"Doesn't have a client key available\");\n\t goto out;\n\t}\n\tkrb5_free_keyblock_contents(r->context, &r->reply_key);\n\tret = krb5_copy_keyblock_contents(r->context, &ckey->key, &r->reply_key);\n\tif (ret)\n\t goto out;\n }\n\n if (r->clientdb->hdb_auth_status) {\n\tr->clientdb->hdb_auth_status(context, r->clientdb, r->client, \n\t\t\t\t HDB_AUTH_SUCCESS);\n }\n\n /*\n * Verify flags after the user been required to prove its identity\n * with in a preauth mech.\n */\n\n ret = _kdc_check_access(context, config, r->client, r->client_name,\n\t\t\t r->server, r->server_name,\n\t\t\t req, &error_method);\n if(ret)\n\tgoto out;\n\n /*\n * Select the best encryption type for the KDC with out regard to\n * the client since the client never needs to read that data.\n */\n\n ret = _kdc_get_preferred_key(context, config,\n\t\t\t\t r->server, r->server_name,\n\t\t\t\t &setype, &skey);\n if(ret)\n\tgoto out;\n\n if(f.renew || f.validate || f.proxy || f.forwarded || f.enc_tkt_in_skey\n || (_kdc_is_anon_request(b) && !config->allow_anonymous)) {\n\tret = KRB5KDC_ERR_BADOPTION;\n\t_kdc_set_e_text(r, \"Bad KDC options\");\n\tgoto out;\n }\n\n /*\n * Build reply\n */\n\n rep.pvno = 5;\n rep.msg_type = krb_as_rep;\n\n if (_kdc_is_anonymous(context, r->client_princ)) {\n\tRealm anon_realm=KRB5_ANON_REALM;\n\tret = copy_Realm(&anon_realm, &rep.crealm);\n } else\n\tret = copy_Realm(&r->client->entry.principal->realm, &rep.crealm);\n if (ret)\n\tgoto out;\n ret = _krb5_principal2principalname(&rep.cname, r->client->entry.principal);\n if (ret)\n\tgoto out;\n\n rep.ticket.tkt_vno = 5;\n ret = copy_Realm(&r->server->entry.principal->realm, &rep.ticket.realm);\n if (ret)\n\tgoto out;\n _krb5_principal2principalname(&rep.ticket.sname,\n\t\t\t\t r->server->entry.principal);\n /* java 1.6 expects the name to be the same type, lets allow that\n * uncomplicated name-types. */\n#define CNT(sp,t) (((sp)->sname->name_type) == KRB5_NT_##t)\n if (CNT(b, UNKNOWN) || CNT(b, PRINCIPAL) || CNT(b, SRV_INST) || CNT(b, SRV_HST) || CNT(b, SRV_XHST))\n\trep.ticket.sname.name_type = b->sname->name_type;\n#undef CNT\n\n r->et.flags.initial = 1;\n if(r->client->entry.flags.forwardable && r->server->entry.flags.forwardable)\n\tr->et.flags.forwardable = f.forwardable;\n else if (f.forwardable) {\n\t_kdc_set_e_text(r, \"Ticket may not be forwardable\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n if(r->client->entry.flags.proxiable && r->server->entry.flags.proxiable)\n\tr->et.flags.proxiable = f.proxiable;\n else if (f.proxiable) {\n\t_kdc_set_e_text(r, \"Ticket may not be proxiable\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n if(r->client->entry.flags.postdate && r->server->entry.flags.postdate)\n\tr->et.flags.may_postdate = f.allow_postdate;\n else if (f.allow_postdate){\n\t_kdc_set_e_text(r, \"Ticket may not be postdate\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n\n /* check for valid set of addresses */\n if(!_kdc_check_addresses(context, config, b->addresses, from_addr)) {\n\t_kdc_set_e_text(r, \"Bad address list in requested\");\n\tret = KRB5KRB_AP_ERR_BADADDR;\n\tgoto out;\n }\n\n ret = copy_PrincipalName(&rep.cname, &r->et.cname);\n if (ret)\n\tgoto out;\n ret = copy_Realm(&rep.crealm, &r->et.crealm);\n if (ret)\n\tgoto out;\n\n {\n\ttime_t start;\n\ttime_t t;\n\t\n\tstart = r->et.authtime = kdc_time;\n\n\tif(f.postdated && req->req_body.from){\n\t ALLOC(r->et.starttime);\n\t start = *r->et.starttime = *req->req_body.from;\n\t r->et.flags.invalid = 1;\n\t r->et.flags.postdated = 1; /* XXX ??? */\n\t}\n\t_kdc_fix_time(&b->till);\n\tt = *b->till;\n\n\t/* be careful not overflowing */\n\n\tif(r->client->entry.max_life)\n\t t = start + min(t - start, *r->client->entry.max_life);\n\tif(r->server->entry.max_life)\n\t t = start + min(t - start, *r->server->entry.max_life);\n#if 0\n\tt = min(t, start + realm->max_life);\n#endif\n\tr->et.endtime = t;\n\tif(f.renewable_ok && r->et.endtime < *b->till){\n\t f.renewable = 1;\n\t if(b->rtime == NULL){\n\t\tALLOC(b->rtime);\n\t\t*b->rtime = 0;\n\t }\n\t if(*b->rtime < *b->till)\n\t\t*b->rtime = *b->till;\n\t}\n\tif(f.renewable && b->rtime){\n\t t = *b->rtime;\n\t if(t == 0)\n\t\tt = MAX_TIME;\n\t if(r->client->entry.max_renew)\n\t\tt = start + min(t - start, *r->client->entry.max_renew);\n\t if(r->server->entry.max_renew)\n\t\tt = start + min(t - start, *r->server->entry.max_renew);\n#if 0\n\t t = min(t, start + realm->max_renew);\n#endif\n\t ALLOC(r->et.renew_till);\n\t *r->et.renew_till = t;\n\t r->et.flags.renewable = 1;\n\t}\n }\n\n if (_kdc_is_anon_request(b))\n\tr->et.flags.anonymous = 1;\n\n if(b->addresses){\n\tALLOC(r->et.caddr);\n\tcopy_HostAddresses(b->addresses, r->et.caddr);\n }\n\n r->et.transited.tr_type = DOMAIN_X500_COMPRESS;\n krb5_data_zero(&r->et.transited.contents);\n\n /* The MIT ASN.1 library (obviously) doesn't tell lengths encoded\n * as 0 and as 0x80 (meaning indefinite length) apart, and is thus\n * incapable of correctly decoding SEQUENCE OF's of zero length.\n *\n * To fix this, always send at least one no-op last_req\n *\n * If there's a pw_end or valid_end we will use that,\n * otherwise just a dummy lr.\n */\n r->ek.last_req.val = malloc(2 * sizeof(*r->ek.last_req.val));\n if (r->ek.last_req.val == NULL) {\n\tret = ENOMEM;\n\tgoto out;\n }\n r->ek.last_req.len = 0;\n if (r->client->entry.pw_end\n\t&& (config->kdc_warn_pwexpire == 0\n\t || kdc_time + config->kdc_warn_pwexpire >= *r->client->entry.pw_end)) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_PW_EXPTIME;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = *r->client->entry.pw_end;\n\t++r->ek.last_req.len;\n }\n if (r->client->entry.valid_end) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_ACCT_EXPTIME;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = *r->client->entry.valid_end;\n\t++r->ek.last_req.len;\n }\n if (r->ek.last_req.len == 0) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_NONE;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = 0;\n\t++r->ek.last_req.len;\n }\n r->ek.nonce = b->nonce;\n if (r->client->entry.valid_end || r->client->entry.pw_end) {\n\tALLOC(r->ek.key_expiration);\n\tif (r->client->entry.valid_end) {\n\t if (r->client->entry.pw_end)\n\t\t*r->ek.key_expiration = min(*r->client->entry.valid_end,\n\t\t\t\t\t *r->client->entry.pw_end);\n\t else\n\t\t*r->ek.key_expiration = *r->client->entry.valid_end;\n\t} else\n\t *r->ek.key_expiration = *r->client->entry.pw_end;\n } else\n\tr->ek.key_expiration = NULL;\n r->ek.flags = r->et.flags;\n r->ek.authtime = r->et.authtime;\n if (r->et.starttime) {\n\tALLOC(r->ek.starttime);\n\t*r->ek.starttime = *r->et.starttime;\n }\n r->ek.endtime = r->et.endtime;\n if (r->et.renew_till) {\n\tALLOC(r->ek.renew_till);\n\t*r->ek.renew_till = *r->et.renew_till;\n }\n ret = copy_Realm(&rep.ticket.realm, &r->ek.srealm);\n if (ret)\n\tgoto out;\n ret = copy_PrincipalName(&rep.ticket.sname, &r->ek.sname);\n if (ret)\n\tgoto out;\n if(r->et.caddr){\n\tALLOC(r->ek.caddr);\n\tcopy_HostAddresses(r->et.caddr, r->ek.caddr);\n }\n\n /*\n * Check and session and reply keys\n */\n\n if (r->session_key.keytype == ETYPE_NULL) {\n\tret = krb5_generate_random_keyblock(context, r->sessionetype, &r->session_key);\n\tif (ret)\n\t goto out;\n }\n\n if (r->reply_key.keytype == ETYPE_NULL) {\n\t_kdc_set_e_text(r, \"Client have no reply key\");\n\tret = KRB5KDC_ERR_CLIENT_NOTYET;\n\tgoto out;\n }\n\n ret = copy_EncryptionKey(&r->session_key, &r->et.key);\n if (ret)\n\tgoto out;\n\n ret = copy_EncryptionKey(&r->session_key, &r->ek.key);\n if (ret)\n\tgoto out;\n\n if (r->outpadata.len) {\n\n\tALLOC(rep.padata);\n\tif (rep.padata == NULL) {\n\t ret = ENOMEM;\n\t goto out;\n\t}\n\tret = copy_METHOD_DATA(&r->outpadata, rep.padata);\n\tif (ret)\n\t goto out;\n }\n\n /* Add the PAC */\n if (send_pac_p(context, req)) {\n\tgenerate_pac(r, skey);\n }\n\n _kdc_log_timestamp(context, config, \"AS-REQ\", r->et.authtime, r->et.starttime,\n\t\t r->et.endtime, r->et.renew_till);\n\n /* do this as the last thing since this signs the EncTicketPart */\n ret = _kdc_add_KRB5SignedPath(context,\n\t\t\t\t config,\n\t\t\t\t r->server,\n\t\t\t\t setype,\n\t\t\t\t r->client->entry.principal,\n\t\t\t\t NULL,\n\t\t\t\t NULL,\n\t\t\t\t &r->et);\n if (ret)\n\tgoto out;\n\n log_as_req(context, config, r->reply_key.keytype, setype, b);\n\n /*\n * We always say we support FAST/enc-pa-rep\n */\n\n r->et.flags.enc_pa_rep = r->ek.flags.enc_pa_rep = 1;\n\n /*\n * Add REQ_ENC_PA_REP if client supports it\n */\n\n i = 0;\n pa = _kdc_find_padata(req, &i, KRB5_PADATA_REQ_ENC_PA_REP);\n if (pa) {\n\n\tret = add_enc_pa_rep(r);\n\tif (ret) {\n\t const char *msg = krb5_get_error_message(r->context, ret);\n\t _kdc_r_log(r, 0, \"add_enc_pa_rep failed: %s: %d\", msg, ret);\n\t krb5_free_error_message(r->context, msg);\n\t goto out;\n\t}\n }\n\n /*\n *\n */\n\n ret = _kdc_encode_reply(context, config,\n\t\t\t r->armor_crypto, req->req_body.nonce,\n\t\t\t &rep, &r->et, &r->ek, setype, r->server->entry.kvno,\n\t\t\t &skey->key, r->client->entry.kvno,\n\t\t\t &r->reply_key, 0, &r->e_text, reply);\n if (ret)\n\tgoto out;\n\n /*\n * Check if message too large\n */\n if (datagram_reply && reply->length > config->max_datagram_reply_length) {\n\tkrb5_data_free(reply);\n\tret = KRB5KRB_ERR_RESPONSE_TOO_BIG;\n\t_kdc_set_e_text(r, \"Reply packet too large\");\n }\n\nout:\n free_AS_REP(&rep);\n\n /*\n * In case of a non proxy error, build an error message.\n */\n if(ret != 0 && ret != HDB_ERR_NOT_FOUND_HERE && reply->length == 0) {\n\tret = _kdc_fast_mk_error(context, r,\n\t\t\t\t &error_method,\n\t\t\t\t r->armor_crypto,\n\t\t\t\t &req->req_body,\n\t\t\t\t ret, r->e_text,\n\t\t\t\t r->server_princ,\n\t\t\t\t &r->client_princ->name,\n\t\t\t\t &r->client_princ->realm,\n\t\t\t\t NULL, NULL,\n\t\t\t\t reply);\n\tif (ret)\n\t goto out2;\n }\nout2:\n free_EncTicketPart(&r->et);\n free_EncKDCRepPart(&r->ek);\n free_KDCFastState(&r->fast);\n\n if (error_method.len)\n\tfree_METHOD_DATA(&error_method);\n if (r->outpadata.len)\n\tfree_METHOD_DATA(&r->outpadata);\n if (r->client_princ) {\n\tkrb5_free_principal(context, r->client_princ);\n\tr->client_princ = NULL;\n }\n if (r->client_name) {\n\tfree(r->client_name);\n\tr->client_name = NULL;\n }\n if (r->server_princ){\n\tkrb5_free_principal(context, r->server_princ);\n\tr->server_princ = NULL;\n }\n if (r->server_name) {\n\tfree(r->server_name);\n\tr->server_name = NULL;\n }\n if (r->client)\n\t_kdc_free_ent(context, r->client);\n if (r->server)\n\t_kdc_free_ent(context, r->server);\n if (r->armor_crypto) {\n\tkrb5_crypto_destroy(r->context, r->armor_crypto);\n\tr->armor_crypto = NULL;\n }\n krb5_free_keyblock_contents(r->context, &r->reply_key);\n krb5_free_keyblock_contents(r->context, &r->session_key);\n return ret;\n}","target":"_kdc_as_rep(kdc_request_t r,\n\t krb5_data *reply,\n\t const char *from,\n\t struct sockaddr *from_addr,\n\t int datagram_reply)\n{\n krb5_context context = r->context;\n krb5_kdc_configuration *config = r->config;\n KDC_REQ *req = &r->req;\n KDC_REQ_BODY *b = NULL;\n AS_REP rep;\n KDCOptions f;\n krb5_enctype setype;\n krb5_error_code ret = 0;\n Key *skey;\n int found_pa = 0;\n int i, flags = HDB_F_FOR_AS_REQ;\n METHOD_DATA error_method;\n const PA_DATA *pa;\n\n memset(&rep, 0, sizeof(rep));\n error_method.len = 0;\n error_method.val = NULL;\n\n /*\n * Look for FAST armor and unwrap\n */\n ret = _kdc_fast_unwrap_request(r);\n if (ret) {\n\t_kdc_r_log(r, 0, \"FAST unwrap request from %s failed: %d\", from, ret);\n\tgoto out;\n }\n\n b = &req->req_body;\n f = b->kdc_options;\n\n if (f.canonicalize)\n\tflags |= HDB_F_CANON;\n\n if(b->sname == NULL){\n\tret = KRB5KRB_ERR_GENERIC;\n\t_kdc_set_e_text(r, \"No server in request\");\n } else{\n\tret = _krb5_principalname2krb5_principal (context,\n\t\t\t\t\t\t &r->server_princ,\n\t\t\t\t\t\t *(b->sname),\n\t\t\t\t\t\t b->realm);\n\tif (ret == 0)\n\t ret = krb5_unparse_name(context, r->server_princ, &r->server_name);\n }\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"AS-REQ malformed server name from %s\", from);\n\tgoto out;\n }\n if(b->cname == NULL){\n\tret = KRB5KRB_ERR_GENERIC;\n\t_kdc_set_e_text(r, \"No client in request\");\n } else {\n\tret = _krb5_principalname2krb5_principal (context,\n\t\t\t\t\t\t &r->client_princ,\n\t\t\t\t\t\t *(b->cname),\n\t\t\t\t\t\t b->realm);\n\tif (ret)\n\t goto out;\n\n\tret = krb5_unparse_name(context, r->client_princ, &r->client_name);\n }\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"AS-REQ malformed client name from %s\", from);\n\tgoto out;\n }\n\n kdc_log(context, config, 0, \"AS-REQ %s from %s for %s\",\n\t r->client_name, from, r->server_name);\n\n /*\n *\n */\n\n if (_kdc_is_anonymous(context, r->client_princ)) {\n\tif (!_kdc_is_anon_request(b)) {\n\t kdc_log(context, config, 0, \"Anonymous ticket w/o anonymous flag\");\n\t ret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\t goto out;\n\t}\n } else if (_kdc_is_anon_request(b)) {\n\tkdc_log(context, config, 0,\n\t\t\"Request for a anonymous ticket with non \"\n\t\t\"anonymous client name: %s\", r->client_name);\n\tret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n\n /*\n *\n */\n\n ret = _kdc_db_fetch(context, config, r->client_princ,\n\t\t\tHDB_F_GET_CLIENT | flags, NULL,\n\t\t\t&r->clientdb, &r->client);\n if(ret == HDB_ERR_NOT_FOUND_HERE) {\n\tkdc_log(context, config, 5, \"client %s does not have secrets at this KDC, need to proxy\",\n\t\tr->client_name);\n\tgoto out;\n } else if (ret == HDB_ERR_WRONG_REALM) {\n\tchar *fixed_client_name = NULL;\n\n\tret = krb5_unparse_name(context, r->client->entry.principal,\n\t\t\t\t&fixed_client_name);\n\tif (ret) {\n\t goto out;\n\t}\n\n\tkdc_log(context, config, 0, \"WRONG_REALM - %s -> %s\",\n\t\tr->client_name, fixed_client_name);\n\tfree(fixed_client_name);\n\n\tret = _kdc_fast_mk_error(context, r,\n\t\t\t\t &error_method,\n\t\t\t\t r->armor_crypto,\n\t\t\t\t &req->req_body,\n\t\t\t\t KRB5_KDC_ERR_WRONG_REALM,\n\t\t\t\t NULL,\n\t\t\t\t r->server_princ,\n\t\t\t\t NULL,\n\t\t\t\t &r->client->entry.principal->realm,\n\t\t\t\t NULL, NULL,\n\t\t\t\t reply);\n\tgoto out;\n } else if(ret){\n\tconst char *msg = krb5_get_error_message(context, ret);\n\tkdc_log(context, config, 0, \"UNKNOWN -- %s: %s\", r->client_name, msg);\n\tkrb5_free_error_message(context, msg);\n\tret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n ret = _kdc_db_fetch(context, config, r->server_princ,\n\t\t\tHDB_F_GET_SERVER|HDB_F_GET_KRBTGT | flags,\n\t\t\tNULL, NULL, &r->server);\n if(ret == HDB_ERR_NOT_FOUND_HERE) {\n\tkdc_log(context, config, 5, \"target %s does not have secrets at this KDC, need to proxy\",\n\t\tr->server_name);\n\tgoto out;\n } else if(ret){\n\tconst char *msg = krb5_get_error_message(context, ret);\n\tkdc_log(context, config, 0, \"UNKNOWN -- %s: %s\", r->server_name, msg);\n\tkrb5_free_error_message(context, msg);\n\tret = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n\n /*\n * Select a session enctype from the list of the crypto system\n * supported enctypes that is supported by the client and is one of\n * the enctype of the enctype of the service (likely krbtgt).\n *\n * The latter is used as a hint of what enctypes all KDC support,\n * to make sure a newer version of KDC won't generate a session\n * enctype that an older version of a KDC in the same realm can't\n * decrypt.\n */\n\n ret = _kdc_find_etype(context,\n\t\t\t krb5_principal_is_krbtgt(context, r->server_princ) ?\n\t\t\t config->tgt_use_strongest_session_key :\n\t\t\t config->svc_use_strongest_session_key, FALSE,\n\t\t\t r->client, b->etype.val, b->etype.len, &r->sessionetype,\n\t\t\t NULL);\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"Client (%s) from %s has no common enctypes with KDC \"\n\t\t\"to use for the session key\",\n\t\tr->client_name, from);\n\tgoto out;\n }\n\n /*\n * Pre-auth processing\n */\n\n if(req->padata){\n\tunsigned int n;\n\n\tlog_patypes(context, config, req->padata);\n\n\t/* Check if preauth matching */\n\n\tfor (n = 0; !found_pa && n < sizeof(pat) / sizeof(pat[0]); n++) {\n\t if (pat[n].validate == NULL)\n\t\tcontinue;\n\t if (r->armor_crypto == NULL && (pat[n].flags & PA_REQ_FAST))\n\t\tcontinue;\n\n\t kdc_log(context, config, 5,\n\t\t \"Looking for %s pa-data -- %s\", pat[n].name, r->client_name);\n\t i = 0;\n\t pa = _kdc_find_padata(req, &i, pat[n].type);\n\t if (pa) {\n\t\tret = pat[n].validate(r, pa);\n\t\tif (ret != 0) {\n\t\t goto out;\n\t\t}\n\t\tkdc_log(context, config, 0,\n\t\t\t\"%s pre-authentication succeeded -- %s\",\n\t\t\tpat[n].name, r->client_name);\n\t\tfound_pa = 1;\n\t\tr->et.flags.pre_authent = 1;\n\t }\n\t}\n }\n\n if (found_pa == 0) {\n\tKey *ckey = NULL;\n\tsize_t n;\n\n\tfor (n = 0; n < sizeof(pat) / sizeof(pat[0]); n++) {\n\t if ((pat[n].flags & PA_ANNOUNCE) == 0)\n\t\tcontinue;\n\t ret = krb5_padata_add(context, &error_method,\n\t\t\t\t pat[n].type, NULL, 0);\n\t if (ret)\n\t\tgoto out;\n\t}\n\n\t/*\n\t * If there is a client key, send ETYPE_INFO{,2}\n\t */\n\tret = _kdc_find_etype(context,\n\t\t\t config->preauth_use_strongest_session_key, TRUE,\n\t\t\t r->client, b->etype.val, b->etype.len, NULL, &ckey);\n\tif (ret == 0) {\n\n\t /*\n\t * RFC4120 requires:\n\t * - If the client only knows about old enctypes, then send\n\t * both info replies (we send 'info' first in the list).\n\t * - If the client is 'modern', because it knows about 'new'\n\t * enctype types, then only send the 'info2' reply.\n\t *\n\t * Before we send the full list of etype-info data, we pick\n\t * the client key we would have used anyway below, just pick\n\t * that instead.\n\t */\n\n\t if (older_enctype(ckey->key.keytype)) {\n\t\tret = get_pa_etype_info(context, config,\n\t\t\t\t\t&error_method, ckey);\n\t\tif (ret)\n\t\t goto out;\n\t }\n\t ret = get_pa_etype_info2(context, config,\n\t\t\t\t &error_method, ckey);\n\t if (ret)\n\t\tgoto out;\n\t}\n\n\t/* \n\t * send requre preauth is its required or anon is requested,\n\t * anon is today only allowed via preauth mechanisms.\n\t */\n\tif (require_preauth_p(r) || _kdc_is_anon_request(b)) {\n\t ret = KRB5KDC_ERR_PREAUTH_REQUIRED;\n\t _kdc_set_e_text(r, \"Need to use PA-ENC-TIMESTAMP/PA-PK-AS-REQ\");\n\t goto out;\n\t}\n\n\tif (ckey == NULL) {\n\t ret = KRB5KDC_ERR_CLIENT_NOTYET;\n\t _kdc_set_e_text(r, \"Doesn't have a client key available\");\n\t goto out;\n\t}\n\tkrb5_free_keyblock_contents(r->context, &r->reply_key);\n\tret = krb5_copy_keyblock_contents(r->context, &ckey->key, &r->reply_key);\n\tif (ret)\n\t goto out;\n }\n\n if (r->clientdb->hdb_auth_status) {\n\tr->clientdb->hdb_auth_status(context, r->clientdb, r->client, \n\t\t\t\t HDB_AUTH_SUCCESS);\n }\n\n /*\n * Verify flags after the user been required to prove its identity\n * with in a preauth mech.\n */\n\n ret = _kdc_check_access(context, config, r->client, r->client_name,\n\t\t\t r->server, r->server_name,\n\t\t\t req, &error_method);\n if(ret)\n\tgoto out;\n\n /*\n * Select the best encryption type for the KDC with out regard to\n * the client since the client never needs to read that data.\n */\n\n ret = _kdc_get_preferred_key(context, config,\n\t\t\t\t r->server, r->server_name,\n\t\t\t\t &setype, &skey);\n if(ret)\n\tgoto out;\n\n if(f.renew || f.validate || f.proxy || f.forwarded || f.enc_tkt_in_skey\n || (_kdc_is_anon_request(b) && !config->allow_anonymous)) {\n\tret = KRB5KDC_ERR_BADOPTION;\n\t_kdc_set_e_text(r, \"Bad KDC options\");\n\tgoto out;\n }\n\n /*\n * Build reply\n */\n\n rep.pvno = 5;\n rep.msg_type = krb_as_rep;\n\n if (_kdc_is_anonymous(context, r->client_princ)) {\n\tRealm anon_realm=KRB5_ANON_REALM;\n\tret = copy_Realm(&anon_realm, &rep.crealm);\n } else\n\tret = copy_Realm(&r->client->entry.principal->realm, &rep.crealm);\n if (ret)\n\tgoto out;\n ret = _krb5_principal2principalname(&rep.cname, r->client->entry.principal);\n if (ret)\n\tgoto out;\n\n rep.ticket.tkt_vno = 5;\n ret = copy_Realm(&r->server->entry.principal->realm, &rep.ticket.realm);\n if (ret)\n\tgoto out;\n _krb5_principal2principalname(&rep.ticket.sname,\n\t\t\t\t r->server->entry.principal);\n /* java 1.6 expects the name to be the same type, lets allow that\n * uncomplicated name-types. */\n#define CNT(sp,t) (((sp)->sname->name_type) == KRB5_NT_##t)\n if (CNT(b, UNKNOWN) || CNT(b, PRINCIPAL) || CNT(b, SRV_INST) || CNT(b, SRV_HST) || CNT(b, SRV_XHST))\n\trep.ticket.sname.name_type = b->sname->name_type;\n#undef CNT\n\n r->et.flags.initial = 1;\n if(r->client->entry.flags.forwardable && r->server->entry.flags.forwardable)\n\tr->et.flags.forwardable = f.forwardable;\n else if (f.forwardable) {\n\t_kdc_set_e_text(r, \"Ticket may not be forwardable\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n if(r->client->entry.flags.proxiable && r->server->entry.flags.proxiable)\n\tr->et.flags.proxiable = f.proxiable;\n else if (f.proxiable) {\n\t_kdc_set_e_text(r, \"Ticket may not be proxiable\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n if(r->client->entry.flags.postdate && r->server->entry.flags.postdate)\n\tr->et.flags.may_postdate = f.allow_postdate;\n else if (f.allow_postdate){\n\t_kdc_set_e_text(r, \"Ticket may not be postdate\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n\n /* check for valid set of addresses */\n if(!_kdc_check_addresses(context, config, b->addresses, from_addr)) {\n\t_kdc_set_e_text(r, \"Bad address list in requested\");\n\tret = KRB5KRB_AP_ERR_BADADDR;\n\tgoto out;\n }\n\n ret = copy_PrincipalName(&rep.cname, &r->et.cname);\n if (ret)\n\tgoto out;\n ret = copy_Realm(&rep.crealm, &r->et.crealm);\n if (ret)\n\tgoto out;\n\n {\n\ttime_t start;\n\ttime_t t;\n\t\n\tstart = r->et.authtime = kdc_time;\n\n\tif(f.postdated && req->req_body.from){\n\t ALLOC(r->et.starttime);\n\t start = *r->et.starttime = *req->req_body.from;\n\t r->et.flags.invalid = 1;\n\t r->et.flags.postdated = 1; /* XXX ??? */\n\t}\n\t_kdc_fix_time(&b->till);\n\tt = *b->till;\n\n\t/* be careful not overflowing */\n\n\tif(r->client->entry.max_life)\n\t t = start + min(t - start, *r->client->entry.max_life);\n\tif(r->server->entry.max_life)\n\t t = start + min(t - start, *r->server->entry.max_life);\n#if 0\n\tt = min(t, start + realm->max_life);\n#endif\n\tr->et.endtime = t;\n\tif(f.renewable_ok && r->et.endtime < *b->till){\n\t f.renewable = 1;\n\t if(b->rtime == NULL){\n\t\tALLOC(b->rtime);\n\t\t*b->rtime = 0;\n\t }\n\t if(*b->rtime < *b->till)\n\t\t*b->rtime = *b->till;\n\t}\n\tif(f.renewable && b->rtime){\n\t t = *b->rtime;\n\t if(t == 0)\n\t\tt = MAX_TIME;\n\t if(r->client->entry.max_renew)\n\t\tt = start + min(t - start, *r->client->entry.max_renew);\n\t if(r->server->entry.max_renew)\n\t\tt = start + min(t - start, *r->server->entry.max_renew);\n#if 0\n\t t = min(t, start + realm->max_renew);\n#endif\n\t ALLOC(r->et.renew_till);\n\t *r->et.renew_till = t;\n\t r->et.flags.renewable = 1;\n\t}\n }\n\n if (_kdc_is_anon_request(b))\n\tr->et.flags.anonymous = 1;\n\n if(b->addresses){\n\tALLOC(r->et.caddr);\n\tcopy_HostAddresses(b->addresses, r->et.caddr);\n }\n\n r->et.transited.tr_type = DOMAIN_X500_COMPRESS;\n krb5_data_zero(&r->et.transited.contents);\n\n /* The MIT ASN.1 library (obviously) doesn't tell lengths encoded\n * as 0 and as 0x80 (meaning indefinite length) apart, and is thus\n * incapable of correctly decoding SEQUENCE OF's of zero length.\n *\n * To fix this, always send at least one no-op last_req\n *\n * If there's a pw_end or valid_end we will use that,\n * otherwise just a dummy lr.\n */\n r->ek.last_req.val = malloc(2 * sizeof(*r->ek.last_req.val));\n if (r->ek.last_req.val == NULL) {\n\tret = ENOMEM;\n\tgoto out;\n }\n r->ek.last_req.len = 0;\n if (r->client->entry.pw_end\n\t&& (config->kdc_warn_pwexpire == 0\n\t || kdc_time + config->kdc_warn_pwexpire >= *r->client->entry.pw_end)) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_PW_EXPTIME;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = *r->client->entry.pw_end;\n\t++r->ek.last_req.len;\n }\n if (r->client->entry.valid_end) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_ACCT_EXPTIME;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = *r->client->entry.valid_end;\n\t++r->ek.last_req.len;\n }\n if (r->ek.last_req.len == 0) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_NONE;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = 0;\n\t++r->ek.last_req.len;\n }\n r->ek.nonce = b->nonce;\n if (r->client->entry.valid_end || r->client->entry.pw_end) {\n\tALLOC(r->ek.key_expiration);\n\tif (r->client->entry.valid_end) {\n\t if (r->client->entry.pw_end)\n\t\t*r->ek.key_expiration = min(*r->client->entry.valid_end,\n\t\t\t\t\t *r->client->entry.pw_end);\n\t else\n\t\t*r->ek.key_expiration = *r->client->entry.valid_end;\n\t} else\n\t *r->ek.key_expiration = *r->client->entry.pw_end;\n } else\n\tr->ek.key_expiration = NULL;\n r->ek.flags = r->et.flags;\n r->ek.authtime = r->et.authtime;\n if (r->et.starttime) {\n\tALLOC(r->ek.starttime);\n\t*r->ek.starttime = *r->et.starttime;\n }\n r->ek.endtime = r->et.endtime;\n if (r->et.renew_till) {\n\tALLOC(r->ek.renew_till);\n\t*r->ek.renew_till = *r->et.renew_till;\n }\n ret = copy_Realm(&rep.ticket.realm, &r->ek.srealm);\n if (ret)\n\tgoto out;\n ret = copy_PrincipalName(&rep.ticket.sname, &r->ek.sname);\n if (ret)\n\tgoto out;\n if(r->et.caddr){\n\tALLOC(r->ek.caddr);\n\tcopy_HostAddresses(r->et.caddr, r->ek.caddr);\n }\n\n /*\n * Check and session and reply keys\n */\n\n if (r->session_key.keytype == ETYPE_NULL) {\n\tret = krb5_generate_random_keyblock(context, r->sessionetype, &r->session_key);\n\tif (ret)\n\t goto out;\n }\n\n if (r->reply_key.keytype == ETYPE_NULL) {\n\t_kdc_set_e_text(r, \"Client have no reply key\");\n\tret = KRB5KDC_ERR_CLIENT_NOTYET;\n\tgoto out;\n }\n\n ret = copy_EncryptionKey(&r->session_key, &r->et.key);\n if (ret)\n\tgoto out;\n\n ret = copy_EncryptionKey(&r->session_key, &r->ek.key);\n if (ret)\n\tgoto out;\n\n if (r->outpadata.len) {\n\n\tALLOC(rep.padata);\n\tif (rep.padata == NULL) {\n\t ret = ENOMEM;\n\t goto out;\n\t}\n\tret = copy_METHOD_DATA(&r->outpadata, rep.padata);\n\tif (ret)\n\t goto out;\n }\n\n /* Add the PAC */\n if (send_pac_p(context, req)) {\n\tgenerate_pac(r, skey);\n }\n\n _kdc_log_timestamp(context, config, \"AS-REQ\", r->et.authtime, r->et.starttime,\n\t\t r->et.endtime, r->et.renew_till);\n\n /* do this as the last thing since this signs the EncTicketPart */\n ret = _kdc_add_KRB5SignedPath(context,\n\t\t\t\t config,\n\t\t\t\t r->server,\n\t\t\t\t setype,\n\t\t\t\t r->client->entry.principal,\n\t\t\t\t NULL,\n\t\t\t\t NULL,\n\t\t\t\t &r->et);\n if (ret)\n\tgoto out;\n\n log_as_req(context, config, r->reply_key.keytype, setype, b);\n\n /*\n * We always say we support FAST/enc-pa-rep\n */\n\n r->et.flags.enc_pa_rep = r->ek.flags.enc_pa_rep = 1;\n\n /*\n * Add REQ_ENC_PA_REP if client supports it\n */\n\n i = 0;\n pa = _kdc_find_padata(req, &i, KRB5_PADATA_REQ_ENC_PA_REP);\n if (pa) {\n\n\tret = add_enc_pa_rep(r);\n\tif (ret) {\n\t const char *msg = krb5_get_error_message(r->context, ret);\n\t _kdc_r_log(r, 0, \"add_enc_pa_rep failed: %s: %d\", msg, ret);\n\t krb5_free_error_message(r->context, msg);\n\t goto out;\n\t}\n }\n\n /*\n *\n */\n\n ret = _kdc_encode_reply(context, config,\n\t\t\t r->armor_crypto, req->req_body.nonce,\n\t\t\t &rep, &r->et, &r->ek, setype, r->server->entry.kvno,\n\t\t\t &skey->key, r->client->entry.kvno,\n\t\t\t &r->reply_key, 0, &r->e_text, reply);\n if (ret)\n\tgoto out;\n\n /*\n * Check if message too large\n */\n if (datagram_reply && reply->length > config->max_datagram_reply_length) {\n\tkrb5_data_free(reply);\n\tret = KRB5KRB_ERR_RESPONSE_TOO_BIG;\n\t_kdc_set_e_text(r, \"Reply packet too large\");\n }\n\nout:\n free_AS_REP(&rep);\n\n /*\n * In case of a non proxy error, build an error message.\n */\n if (ret != 0 && ret != HDB_ERR_NOT_FOUND_HERE && reply->length == 0) {\n\tret = _kdc_fast_mk_error(context, r,\n\t\t\t\t &error_method,\n\t\t\t\t r->armor_crypto,\n\t\t\t\t &req->req_body,\n\t\t\t\t ret, r->e_text,\n\t\t\t\t r->server_princ,\n\t\t\t\t r->client_princ ?\n &r->client_princ->name : NULL,\n\t\t\t\t r->client_princ ?\n &r->client_princ->realm : NULL,\n\t\t\t\t NULL, NULL,\n\t\t\t\t reply);\n\tif (ret)\n\t goto out2;\n }\nout2:\n free_EncTicketPart(&r->et);\n free_EncKDCRepPart(&r->ek);\n free_KDCFastState(&r->fast);\n\n if (error_method.len)\n\tfree_METHOD_DATA(&error_method);\n if (r->outpadata.len)\n\tfree_METHOD_DATA(&r->outpadata);\n if (r->client_princ) {\n\tkrb5_free_principal(context, r->client_princ);\n\tr->client_princ = NULL;\n }\n if (r->client_name) {\n\tfree(r->client_name);\n\tr->client_name = NULL;\n }\n if (r->server_princ){\n\tkrb5_free_principal(context, r->server_princ);\n\tr->server_princ = NULL;\n }\n if (r->server_name) {\n\tfree(r->server_name);\n\tr->server_name = NULL;\n }\n if (r->client)\n\t_kdc_free_ent(context, r->client);\n if (r->server)\n\t_kdc_free_ent(context, r->server);\n if (r->armor_crypto) {\n\tkrb5_crypto_destroy(r->context, r->armor_crypto);\n\tr->armor_crypto = NULL;\n }\n krb5_free_keyblock_contents(r->context, &r->reply_key);\n krb5_free_keyblock_contents(r->context, &r->session_key);\n return ret;\n}","lang":"c","vul_type":"cwe-476","target_token_count":5694,"sven_meta":{"func_name":"_kdc_as_rep","file_name":"kdc/kerberos5.c","commit_link":"github.com/heimdal/heimdal/commit/1a6a6e462dc2ac6111f9e02c6852ddec4849b887","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#19-71943dd4ea37","input":"formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form)\n{\n Buffer save;\n char *p;\n int spos, epos, rows, c_rows, pos, col = 0;\n Line *l;\n\n copyBuffer(&save, buf);\n gotoLine(buf, a->start.line);\n switch (form->type) {\n case FORM_TEXTAREA:\n case FORM_INPUT_TEXT:\n case FORM_INPUT_FILE:\n case FORM_INPUT_PASSWORD:\n case FORM_INPUT_CHECKBOX:\n case FORM_INPUT_RADIO:\n#ifdef MENU_SELECT\n case FORM_SELECT:\n#endif\t\t\t\t/* MENU_SELECT */\n\tspos = a->start.pos;\n\tepos = a->end.pos;\n\tbreak;\n default:\n\tspos = a->start.pos + 1;\n\tepos = a->end.pos - 1;\n }\n switch (form->type) {\n case FORM_INPUT_CHECKBOX:\n case FORM_INPUT_RADIO:\n\tif (buf->currentLine == NULL ||\n\t spos >= buf->currentLine->len || spos < 0)\n\t break;\n\tif (form->checked)\n\t buf->currentLine->lineBuf[spos] = '*';\n\telse\n\t buf->currentLine->lineBuf[spos] = ' ';\n\tbreak;\n case FORM_INPUT_TEXT:\n case FORM_INPUT_FILE:\n case FORM_INPUT_PASSWORD:\n case FORM_TEXTAREA:\n#ifdef MENU_SELECT\n case FORM_SELECT:\n\tif (form->type == FORM_SELECT) {\n\t p = form->label->ptr;\n\t updateSelectOption(form, form->select_option);\n\t}\n\telse\n#endif\t\t\t\t/* MENU_SELECT */\n\t{\n\t if (!form->value)\n\t\tbreak;\n\t p = form->value->ptr;\n\t}\n\tl = buf->currentLine;\n\tif (!l)\n\t break;\n\tif (form->type == FORM_TEXTAREA) {\n\t int n = a->y - buf->currentLine->linenumber;\n\t if (n > 0)\n\t\tfor (; l && n; l = l->prev, n--) ;\n\t else if (n < 0)\n\t\tfor (; l && n; l = l->prev, n++) ;\n\t if (!l)\n\t\tbreak;\n\t}\n\trows = form->rows ? form->rows : 1;\n\tcol = COLPOS(l, a->start.pos);\n\tfor (c_rows = 0; c_rows < rows; c_rows++, l = l->next) {\n\t if (rows > 1) {\n\t\tpos = columnPos(l, col);\n\t\ta = retrieveAnchor(buf->formitem, l->linenumber, pos);\n\t\tif (a == NULL)\n\t\t break;\n\t\tspos = a->start.pos;\n\t\tepos = a->end.pos;\n\t }\n\t if (a->start.line != a->end.line || spos > epos || epos >= l->len ||\n\t\tspos < 0 || epos < 0 || COLPOS(l, epos) < col)\n\t\tbreak;\n\t pos = form_update_line(l, &p, spos, epos, COLPOS(l, epos) - col,\n\t\t\t\t rows > 1,\n\t\t\t\t form->type == FORM_INPUT_PASSWORD);\n\t if (pos != epos) {\n\t\tshiftAnchorPosition(buf->href, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->name, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->img, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->formitem, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t }\n\t}\n\tbreak;\n }\n copyBuffer(buf, &save);\n arrangeLine(buf);\n}","target":"formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form)\n{\n Buffer save;\n char *p;\n int spos, epos, rows, c_rows, pos, col = 0;\n Line *l;\n\n copyBuffer(&save, buf);\n gotoLine(buf, a->start.line);\n switch (form->type) {\n case FORM_TEXTAREA:\n case FORM_INPUT_TEXT:\n case FORM_INPUT_FILE:\n case FORM_INPUT_PASSWORD:\n case FORM_INPUT_CHECKBOX:\n case FORM_INPUT_RADIO:\n#ifdef MENU_SELECT\n case FORM_SELECT:\n#endif\t\t\t\t/* MENU_SELECT */\n\tspos = a->start.pos;\n\tepos = a->end.pos;\n\tbreak;\n default:\n\tspos = a->start.pos + 1;\n\tepos = a->end.pos - 1;\n }\n switch (form->type) {\n case FORM_INPUT_CHECKBOX:\n case FORM_INPUT_RADIO:\n\tif (buf->currentLine == NULL ||\n\t spos >= buf->currentLine->len || spos < 0)\n\t break;\n\tif (form->checked)\n\t buf->currentLine->lineBuf[spos] = '*';\n\telse\n\t buf->currentLine->lineBuf[spos] = ' ';\n\tbreak;\n case FORM_INPUT_TEXT:\n case FORM_INPUT_FILE:\n case FORM_INPUT_PASSWORD:\n case FORM_TEXTAREA:\n#ifdef MENU_SELECT\n case FORM_SELECT:\n\tif (form->type == FORM_SELECT) {\n\t p = form->label->ptr;\n\t updateSelectOption(form, form->select_option);\n\t}\n\telse\n#endif\t\t\t\t/* MENU_SELECT */\n\t{\n\t if (!form->value)\n\t\tbreak;\n\t p = form->value->ptr;\n\t}\n\tl = buf->currentLine;\n\tif (!l)\n\t break;\n\tif (form->type == FORM_TEXTAREA) {\n\t int n = a->y - buf->currentLine->linenumber;\n\t if (n > 0)\n\t\tfor (; l && n; l = l->prev, n--) ;\n\t else if (n < 0)\n\t\tfor (; l && n; l = l->prev, n++) ;\n\t if (!l)\n\t\tbreak;\n\t}\n\trows = form->rows ? form->rows : 1;\n\tcol = COLPOS(l, a->start.pos);\n\tfor (c_rows = 0; c_rows < rows; c_rows++, l = l->next) {\n\t if (l == NULL)\n\t\tbreak;\n\t if (rows > 1) {\n\t\tpos = columnPos(l, col);\n\t\ta = retrieveAnchor(buf->formitem, l->linenumber, pos);\n\t\tif (a == NULL)\n\t\t break;\n\t\tspos = a->start.pos;\n\t\tepos = a->end.pos;\n\t }\n\t if (a->start.line != a->end.line || spos > epos || epos >= l->len ||\n\t\tspos < 0 || epos < 0 || COLPOS(l, epos) < col)\n\t\tbreak;\n\t pos = form_update_line(l, &p, spos, epos, COLPOS(l, epos) - col,\n\t\t\t\t rows > 1,\n\t\t\t\t form->type == FORM_INPUT_PASSWORD);\n\t if (pos != epos) {\n\t\tshiftAnchorPosition(buf->href, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->name, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->img, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->formitem, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t }\n\t}\n\tbreak;\n }\n copyBuffer(buf, &save);\n arrangeLine(buf);\n}","lang":"c","vul_type":"cwe-476","target_token_count":818,"sven_meta":{"func_name":"formUpdateBuffer","file_name":"form.c","commit_link":"github.com/tats/w3m/commit/7fdc83b0364005a0b5ed869230dd81752ba022e8","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#20-5706f1417726","input":"lexer_process_char_literal (parser_context_t *context_p, /**< context */\n const uint8_t *char_p, /**< characters */\n size_t length, /**< length of string */\n uint8_t literal_type, /**< final literal type */\n bool has_escape) /**< has escape sequences */\n{\n parser_list_iterator_t literal_iterator;\n lexer_literal_t *literal_p;\n uint32_t literal_index = 0;\n\n JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL\n || literal_type == LEXER_STRING_LITERAL);\n\n JERRY_ASSERT (literal_type != LEXER_IDENT_LITERAL || length <= PARSER_MAXIMUM_IDENT_LENGTH);\n JERRY_ASSERT (literal_type != LEXER_STRING_LITERAL || length <= PARSER_MAXIMUM_STRING_LENGTH);\n\n parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n {\n if (literal_p->type == literal_type\n && literal_p->prop.length == length\n && memcmp (literal_p->u.char_p, char_p, length) == 0)\n {\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n literal_p->status_flags = (uint8_t) (literal_p->status_flags & ~LEXER_FLAG_UNUSED_IDENT);\n return;\n }\n\n literal_index++;\n }\n\n JERRY_ASSERT (literal_index == context_p->literal_count);\n\n if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n {\n parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n }\n\n literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n literal_p->prop.length = (uint16_t) length;\n literal_p->type = literal_type;\n literal_p->status_flags = has_escape ? 0 : LEXER_FLAG_SOURCE_PTR;\n\n if (has_escape)\n {\n literal_p->u.char_p = (uint8_t *) jmem_heap_alloc_block (length);\n memcpy ((uint8_t *) literal_p->u.char_p, char_p, length);\n }\n else\n {\n literal_p->u.char_p = char_p;\n }\n\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n context_p->literal_count++;\n} /* lexer_process_char_literal */","target":"lexer_process_char_literal (parser_context_t *context_p, /**< context */\n const uint8_t *char_p, /**< characters */\n size_t length, /**< length of string */\n uint8_t literal_type, /**< final literal type */\n bool has_escape) /**< has escape sequences */\n{\n parser_list_iterator_t literal_iterator;\n lexer_literal_t *literal_p;\n uint32_t literal_index = 0;\n\n JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL\n || literal_type == LEXER_STRING_LITERAL);\n\n JERRY_ASSERT (literal_type != LEXER_IDENT_LITERAL || length <= PARSER_MAXIMUM_IDENT_LENGTH);\n JERRY_ASSERT (literal_type != LEXER_STRING_LITERAL || length <= PARSER_MAXIMUM_STRING_LENGTH);\n\n parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n {\n if (literal_p->type == literal_type\n && literal_p->prop.length == length\n && memcmp (literal_p->u.char_p, char_p, length) == 0)\n {\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n literal_p->status_flags = (uint8_t) (literal_p->status_flags & ~LEXER_FLAG_UNUSED_IDENT);\n return;\n }\n\n literal_index++;\n }\n\n JERRY_ASSERT (literal_index == context_p->literal_count);\n\n if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n {\n parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n }\n\n if (length == 0)\n {\n has_escape = false;\n }\n\n literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n literal_p->prop.length = (uint16_t) length;\n literal_p->type = literal_type;\n literal_p->status_flags = has_escape ? 0 : LEXER_FLAG_SOURCE_PTR;\n\n if (has_escape)\n {\n literal_p->u.char_p = (uint8_t *) jmem_heap_alloc_block (length);\n memcpy ((uint8_t *) literal_p->u.char_p, char_p, length);\n }\n else\n {\n literal_p->u.char_p = char_p;\n }\n\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n context_p->literal_count++;\n} /* lexer_process_char_literal */","lang":"c","vul_type":"cwe-476","target_token_count":550,"sven_meta":{"func_name":"lexer_process_char_literal","file_name":"jerry-core/parser/js/js-lexer.c","commit_link":"github.com/zherczeg/jerryscript/commit/03a8c630f015f63268639d3ed3bf82cff6fa77d8","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#23-e3c7f746ba2b","input":"static bool assoc_array_insert_into_terminal_node(struct assoc_array_edit *edit,\n\t\t\t\t\t\t const struct assoc_array_ops *ops,\n\t\t\t\t\t\t const void *index_key,\n\t\t\t\t\t\t struct assoc_array_walk_result *result)\n{\n\tstruct assoc_array_shortcut *shortcut, *new_s0;\n\tstruct assoc_array_node *node, *new_n0, *new_n1, *side;\n\tstruct assoc_array_ptr *ptr;\n\tunsigned long dissimilarity, base_seg, blank;\n\tsize_t keylen;\n\tbool have_meta;\n\tint level, diff;\n\tint slot, next_slot, free_slot, i, j;\n\n\tnode\t= result->terminal_node.node;\n\tlevel\t= result->terminal_node.level;\n\tedit->segment_cache[ASSOC_ARRAY_FAN_OUT] = result->terminal_node.slot;\n\n\tpr_devel(\"-->%s()\\n\", __func__);\n\n\t/* We arrived at a node which doesn't have an onward node or shortcut\n\t * pointer that we have to follow. This means that (a) the leaf we\n\t * want must go here (either by insertion or replacement) or (b) we\n\t * need to split this node and insert in one of the fragments.\n\t */\n\tfree_slot = -1;\n\n\t/* Firstly, we have to check the leaves in this node to see if there's\n\t * a matching one we should replace in place.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tif (!ptr) {\n\t\t\tfree_slot = i;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ops->compare_object(assoc_array_ptr_to_leaf(ptr), index_key)) {\n\t\t\tpr_devel(\"replace in slot %d\\n\", i);\n\t\t\tedit->leaf_p = &node->slots[i];\n\t\t\tedit->dead_leaf = node->slots[i];\n\t\t\tpr_devel(\"<--%s() = ok [replace]\\n\", __func__);\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t/* If there is a free slot in this node then we can just insert the\n\t * leaf here.\n\t */\n\tif (free_slot >= 0) {\n\t\tpr_devel(\"insert in free slot %d\\n\", free_slot);\n\t\tedit->leaf_p = &node->slots[free_slot];\n\t\tedit->adjust_count_on = node;\n\t\tpr_devel(\"<--%s() = ok [insert]\\n\", __func__);\n\t\treturn true;\n\t}\n\n\t/* The node has no spare slots - so we're either going to have to split\n\t * it or insert another node before it.\n\t *\n\t * Whatever, we're going to need at least two new nodes - so allocate\n\t * those now. We may also need a new shortcut, but we deal with that\n\t * when we need it.\n\t */\n\tnew_n0 = kzalloc(sizeof(struct assoc_array_node), GFP_KERNEL);\n\tif (!new_n0)\n\t\treturn false;\n\tedit->new_meta[0] = assoc_array_node_to_ptr(new_n0);\n\tnew_n1 = kzalloc(sizeof(struct assoc_array_node), GFP_KERNEL);\n\tif (!new_n1)\n\t\treturn false;\n\tedit->new_meta[1] = assoc_array_node_to_ptr(new_n1);\n\n\t/* We need to find out how similar the leaves are. */\n\tpr_devel(\"no spare slots\\n\");\n\thave_meta = false;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tif (assoc_array_ptr_is_meta(ptr)) {\n\t\t\tedit->segment_cache[i] = 0xff;\n\t\t\thave_meta = true;\n\t\t\tcontinue;\n\t\t}\n\t\tbase_seg = ops->get_object_key_chunk(\n\t\t\tassoc_array_ptr_to_leaf(ptr), level);\n\t\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\t\tedit->segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\t}\n\n\tif (have_meta) {\n\t\tpr_devel(\"have meta\\n\");\n\t\tgoto split_node;\n\t}\n\n\t/* The node contains only leaves */\n\tdissimilarity = 0;\n\tbase_seg = edit->segment_cache[0];\n\tfor (i = 1; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tdissimilarity |= edit->segment_cache[i] ^ base_seg;\n\n\tpr_devel(\"only leaves; dissimilarity=%lx\\n\", dissimilarity);\n\n\tif ((dissimilarity & ASSOC_ARRAY_FAN_MASK) == 0) {\n\t\t/* The old leaves all cluster in the same slot. We will need\n\t\t * to insert a shortcut if the new node wants to cluster with them.\n\t\t */\n\t\tif ((edit->segment_cache[ASSOC_ARRAY_FAN_OUT] ^ base_seg) == 0)\n\t\t\tgoto all_leaves_cluster_together;\n\n\t\t/* Otherwise we can just insert a new node ahead of the old\n\t\t * one.\n\t\t */\n\t\tgoto present_leaves_cluster_but_not_new_leaf;\n\t}\n\nsplit_node:\n\tpr_devel(\"split node\\n\");\n\n\t/* We need to split the current node; we know that the node doesn't\n\t * simply contain a full set of leaves that cluster together (it\n\t * contains meta pointers and/or non-clustering leaves).\n\t *\n\t * We need to expel at least two leaves out of a set consisting of the\n\t * leaves in the node and the new leaf.\n\t *\n\t * We need a new node (n0) to replace the current one and a new node to\n\t * take the expelled nodes (n1).\n\t */\n\tedit->set[0].to = assoc_array_node_to_ptr(new_n0);\n\tnew_n0->back_pointer = node->back_pointer;\n\tnew_n0->parent_slot = node->parent_slot;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = -1; /* Need to calculate this */\n\ndo_split_node:\n\tpr_devel(\"do_split_node\\n\");\n\n\tnew_n0->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tnew_n1->nr_leaves_on_branch = 0;\n\n\t/* Begin by finding two matching leaves. There have to be at least two\n\t * that match - even if there are meta pointers - because any leaf that\n\t * would match a slot with a meta pointer in it must be somewhere\n\t * behind that meta pointer and cannot be here. Further, given N\n\t * remaining leaf slots, we now have N+1 leaves to go in them.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tslot = edit->segment_cache[i];\n\t\tif (slot != 0xff)\n\t\t\tfor (j = i + 1; j < ASSOC_ARRAY_FAN_OUT + 1; j++)\n\t\t\t\tif (edit->segment_cache[j] == slot)\n\t\t\t\t\tgoto found_slot_for_multiple_occupancy;\n\t}\nfound_slot_for_multiple_occupancy:\n\tpr_devel(\"same slot: %x %x [%02x]\\n\", i, j, slot);\n\tBUG_ON(i >= ASSOC_ARRAY_FAN_OUT);\n\tBUG_ON(j >= ASSOC_ARRAY_FAN_OUT + 1);\n\tBUG_ON(slot >= ASSOC_ARRAY_FAN_OUT);\n\n\tnew_n1->parent_slot = slot;\n\n\t/* Metadata pointers cannot change slot */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tif (assoc_array_ptr_is_meta(node->slots[i]))\n\t\t\tnew_n0->slots[i] = node->slots[i];\n\t\telse\n\t\t\tnew_n0->slots[i] = NULL;\n\tBUG_ON(new_n0->slots[slot] != NULL);\n\tnew_n0->slots[slot] = assoc_array_node_to_ptr(new_n1);\n\n\t/* Filter the leaf pointers between the new nodes */\n\tfree_slot = -1;\n\tnext_slot = 0;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tif (assoc_array_ptr_is_meta(node->slots[i]))\n\t\t\tcontinue;\n\t\tif (edit->segment_cache[i] == slot) {\n\t\t\tnew_n1->slots[next_slot++] = node->slots[i];\n\t\t\tnew_n1->nr_leaves_on_branch++;\n\t\t} else {\n\t\t\tdo {\n\t\t\t\tfree_slot++;\n\t\t\t} while (new_n0->slots[free_slot] != NULL);\n\t\t\tnew_n0->slots[free_slot] = node->slots[i];\n\t\t}\n\t}\n\n\tpr_devel(\"filtered: f=%x n=%x\\n\", free_slot, next_slot);\n\n\tif (edit->segment_cache[ASSOC_ARRAY_FAN_OUT] != slot) {\n\t\tdo {\n\t\t\tfree_slot++;\n\t\t} while (new_n0->slots[free_slot] != NULL);\n\t\tedit->leaf_p = &new_n0->slots[free_slot];\n\t\tedit->adjust_count_on = new_n0;\n\t} else {\n\t\tedit->leaf_p = &new_n1->slots[next_slot++];\n\t\tedit->adjust_count_on = new_n1;\n\t}\n\n\tBUG_ON(next_slot <= 1);\n\n\tedit->set_backpointers_to = assoc_array_node_to_ptr(new_n0);\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tif (edit->segment_cache[i] == 0xff) {\n\t\t\tptr = node->slots[i];\n\t\t\tBUG_ON(assoc_array_ptr_is_leaf(ptr));\n\t\t\tif (assoc_array_ptr_is_node(ptr)) {\n\t\t\t\tside = assoc_array_ptr_to_node(ptr);\n\t\t\t\tedit->set_backpointers[i] = &side->back_pointer;\n\t\t\t} else {\n\t\t\t\tshortcut = assoc_array_ptr_to_shortcut(ptr);\n\t\t\t\tedit->set_backpointers[i] = &shortcut->back_pointer;\n\t\t\t}\n\t\t}\n\t}\n\n\tptr = node->back_pointer;\n\tif (!ptr)\n\t\tedit->set[0].ptr = &edit->array->root;\n\telse if (assoc_array_ptr_is_node(ptr))\n\t\tedit->set[0].ptr = &assoc_array_ptr_to_node(ptr)->slots[node->parent_slot];\n\telse\n\t\tedit->set[0].ptr = &assoc_array_ptr_to_shortcut(ptr)->next_node;\n\tedit->excised_meta[0] = assoc_array_node_to_ptr(node);\n\tpr_devel(\"<--%s() = ok [split node]\\n\", __func__);\n\treturn true;\n\npresent_leaves_cluster_but_not_new_leaf:\n\t/* All the old leaves cluster in the same slot, but the new leaf wants\n\t * to go into a different slot, so we create a new node to hold the new\n\t * leaf and a pointer to a new node holding all the old leaves.\n\t */\n\tpr_devel(\"present leaves cluster but not new leaf\\n\");\n\n\tnew_n0->back_pointer = node->back_pointer;\n\tnew_n0->parent_slot = node->parent_slot;\n\tnew_n0->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = edit->segment_cache[0];\n\tnew_n1->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tedit->adjust_count_on = new_n0;\n\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tnew_n1->slots[i] = node->slots[i];\n\n\tnew_n0->slots[edit->segment_cache[0]] = assoc_array_node_to_ptr(new_n0);\n\tedit->leaf_p = &new_n0->slots[edit->segment_cache[ASSOC_ARRAY_FAN_OUT]];\n\n\tedit->set[0].ptr = &assoc_array_ptr_to_node(node->back_pointer)->slots[node->parent_slot];\n\tedit->set[0].to = assoc_array_node_to_ptr(new_n0);\n\tedit->excised_meta[0] = assoc_array_node_to_ptr(node);\n\tpr_devel(\"<--%s() = ok [insert node before]\\n\", __func__);\n\treturn true;\n\nall_leaves_cluster_together:\n\t/* All the leaves, new and old, want to cluster together in this node\n\t * in the same slot, so we have to replace this node with a shortcut to\n\t * skip over the identical parts of the key and then place a pair of\n\t * nodes, one inside the other, at the end of the shortcut and\n\t * distribute the keys between them.\n\t *\n\t * Firstly we need to work out where the leaves start diverging as a\n\t * bit position into their keys so that we know how big the shortcut\n\t * needs to be.\n\t *\n\t * We only need to make a single pass of N of the N+1 leaves because if\n\t * any keys differ between themselves at bit X then at least one of\n\t * them must also differ with the base key at bit X or before.\n\t */\n\tpr_devel(\"all leaves cluster together\\n\");\n\tdiff = INT_MAX;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tint x = ops->diff_objects(assoc_array_ptr_to_leaf(node->slots[i]),\n\t\t\t\t\t index_key);\n\t\tif (x < diff) {\n\t\t\tBUG_ON(x < 0);\n\t\t\tdiff = x;\n\t\t}\n\t}\n\tBUG_ON(diff == INT_MAX);\n\tBUG_ON(diff < level + ASSOC_ARRAY_LEVEL_STEP);\n\n\tkeylen = round_up(diff, ASSOC_ARRAY_KEY_CHUNK_SIZE);\n\tkeylen >>= ASSOC_ARRAY_KEY_CHUNK_SHIFT;\n\n\tnew_s0 = kzalloc(sizeof(struct assoc_array_shortcut) +\n\t\t\t keylen * sizeof(unsigned long), GFP_KERNEL);\n\tif (!new_s0)\n\t\treturn false;\n\tedit->new_meta[2] = assoc_array_shortcut_to_ptr(new_s0);\n\n\tedit->set[0].to = assoc_array_shortcut_to_ptr(new_s0);\n\tnew_s0->back_pointer = node->back_pointer;\n\tnew_s0->parent_slot = node->parent_slot;\n\tnew_s0->next_node = assoc_array_node_to_ptr(new_n0);\n\tnew_n0->back_pointer = assoc_array_shortcut_to_ptr(new_s0);\n\tnew_n0->parent_slot = 0;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = -1; /* Need to calculate this */\n\n\tnew_s0->skip_to_level = level = diff & ~ASSOC_ARRAY_LEVEL_STEP_MASK;\n\tpr_devel(\"skip_to_level = %d [diff %d]\\n\", level, diff);\n\tBUG_ON(level <= 0);\n\n\tfor (i = 0; i < keylen; i++)\n\t\tnew_s0->index_key[i] =\n\t\t\tops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE);\n\n\tblank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK);\n\tpr_devel(\"blank off [%zu] %d: %lx\\n\", keylen - 1, level, blank);\n\tnew_s0->index_key[keylen - 1] &= ~blank;\n\n\t/* This now reduces to a node splitting exercise for which we'll need\n\t * to regenerate the disparity table.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tbase_seg = ops->get_object_key_chunk(assoc_array_ptr_to_leaf(ptr),\n\t\t\t\t\t\t level);\n\t\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\t\tedit->segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\t}\n\n\tbase_seg = ops->get_key_chunk(index_key, level);\n\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\tedit->segment_cache[ASSOC_ARRAY_FAN_OUT] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\tgoto do_split_node;\n}","target":"static bool assoc_array_insert_into_terminal_node(struct assoc_array_edit *edit,\n\t\t\t\t\t\t const struct assoc_array_ops *ops,\n\t\t\t\t\t\t const void *index_key,\n\t\t\t\t\t\t struct assoc_array_walk_result *result)\n{\n\tstruct assoc_array_shortcut *shortcut, *new_s0;\n\tstruct assoc_array_node *node, *new_n0, *new_n1, *side;\n\tstruct assoc_array_ptr *ptr;\n\tunsigned long dissimilarity, base_seg, blank;\n\tsize_t keylen;\n\tbool have_meta;\n\tint level, diff;\n\tint slot, next_slot, free_slot, i, j;\n\n\tnode\t= result->terminal_node.node;\n\tlevel\t= result->terminal_node.level;\n\tedit->segment_cache[ASSOC_ARRAY_FAN_OUT] = result->terminal_node.slot;\n\n\tpr_devel(\"-->%s()\\n\", __func__);\n\n\t/* We arrived at a node which doesn't have an onward node or shortcut\n\t * pointer that we have to follow. This means that (a) the leaf we\n\t * want must go here (either by insertion or replacement) or (b) we\n\t * need to split this node and insert in one of the fragments.\n\t */\n\tfree_slot = -1;\n\n\t/* Firstly, we have to check the leaves in this node to see if there's\n\t * a matching one we should replace in place.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tif (!ptr) {\n\t\t\tfree_slot = i;\n\t\t\tcontinue;\n\t\t}\n\t\tif (assoc_array_ptr_is_leaf(ptr) &&\n\t\t ops->compare_object(assoc_array_ptr_to_leaf(ptr),\n\t\t\t\t\tindex_key)) {\n\t\t\tpr_devel(\"replace in slot %d\\n\", i);\n\t\t\tedit->leaf_p = &node->slots[i];\n\t\t\tedit->dead_leaf = node->slots[i];\n\t\t\tpr_devel(\"<--%s() = ok [replace]\\n\", __func__);\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t/* If there is a free slot in this node then we can just insert the\n\t * leaf here.\n\t */\n\tif (free_slot >= 0) {\n\t\tpr_devel(\"insert in free slot %d\\n\", free_slot);\n\t\tedit->leaf_p = &node->slots[free_slot];\n\t\tedit->adjust_count_on = node;\n\t\tpr_devel(\"<--%s() = ok [insert]\\n\", __func__);\n\t\treturn true;\n\t}\n\n\t/* The node has no spare slots - so we're either going to have to split\n\t * it or insert another node before it.\n\t *\n\t * Whatever, we're going to need at least two new nodes - so allocate\n\t * those now. We may also need a new shortcut, but we deal with that\n\t * when we need it.\n\t */\n\tnew_n0 = kzalloc(sizeof(struct assoc_array_node), GFP_KERNEL);\n\tif (!new_n0)\n\t\treturn false;\n\tedit->new_meta[0] = assoc_array_node_to_ptr(new_n0);\n\tnew_n1 = kzalloc(sizeof(struct assoc_array_node), GFP_KERNEL);\n\tif (!new_n1)\n\t\treturn false;\n\tedit->new_meta[1] = assoc_array_node_to_ptr(new_n1);\n\n\t/* We need to find out how similar the leaves are. */\n\tpr_devel(\"no spare slots\\n\");\n\thave_meta = false;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tif (assoc_array_ptr_is_meta(ptr)) {\n\t\t\tedit->segment_cache[i] = 0xff;\n\t\t\thave_meta = true;\n\t\t\tcontinue;\n\t\t}\n\t\tbase_seg = ops->get_object_key_chunk(\n\t\t\tassoc_array_ptr_to_leaf(ptr), level);\n\t\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\t\tedit->segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\t}\n\n\tif (have_meta) {\n\t\tpr_devel(\"have meta\\n\");\n\t\tgoto split_node;\n\t}\n\n\t/* The node contains only leaves */\n\tdissimilarity = 0;\n\tbase_seg = edit->segment_cache[0];\n\tfor (i = 1; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tdissimilarity |= edit->segment_cache[i] ^ base_seg;\n\n\tpr_devel(\"only leaves; dissimilarity=%lx\\n\", dissimilarity);\n\n\tif ((dissimilarity & ASSOC_ARRAY_FAN_MASK) == 0) {\n\t\t/* The old leaves all cluster in the same slot. We will need\n\t\t * to insert a shortcut if the new node wants to cluster with them.\n\t\t */\n\t\tif ((edit->segment_cache[ASSOC_ARRAY_FAN_OUT] ^ base_seg) == 0)\n\t\t\tgoto all_leaves_cluster_together;\n\n\t\t/* Otherwise we can just insert a new node ahead of the old\n\t\t * one.\n\t\t */\n\t\tgoto present_leaves_cluster_but_not_new_leaf;\n\t}\n\nsplit_node:\n\tpr_devel(\"split node\\n\");\n\n\t/* We need to split the current node; we know that the node doesn't\n\t * simply contain a full set of leaves that cluster together (it\n\t * contains meta pointers and/or non-clustering leaves).\n\t *\n\t * We need to expel at least two leaves out of a set consisting of the\n\t * leaves in the node and the new leaf.\n\t *\n\t * We need a new node (n0) to replace the current one and a new node to\n\t * take the expelled nodes (n1).\n\t */\n\tedit->set[0].to = assoc_array_node_to_ptr(new_n0);\n\tnew_n0->back_pointer = node->back_pointer;\n\tnew_n0->parent_slot = node->parent_slot;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = -1; /* Need to calculate this */\n\ndo_split_node:\n\tpr_devel(\"do_split_node\\n\");\n\n\tnew_n0->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tnew_n1->nr_leaves_on_branch = 0;\n\n\t/* Begin by finding two matching leaves. There have to be at least two\n\t * that match - even if there are meta pointers - because any leaf that\n\t * would match a slot with a meta pointer in it must be somewhere\n\t * behind that meta pointer and cannot be here. Further, given N\n\t * remaining leaf slots, we now have N+1 leaves to go in them.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tslot = edit->segment_cache[i];\n\t\tif (slot != 0xff)\n\t\t\tfor (j = i + 1; j < ASSOC_ARRAY_FAN_OUT + 1; j++)\n\t\t\t\tif (edit->segment_cache[j] == slot)\n\t\t\t\t\tgoto found_slot_for_multiple_occupancy;\n\t}\nfound_slot_for_multiple_occupancy:\n\tpr_devel(\"same slot: %x %x [%02x]\\n\", i, j, slot);\n\tBUG_ON(i >= ASSOC_ARRAY_FAN_OUT);\n\tBUG_ON(j >= ASSOC_ARRAY_FAN_OUT + 1);\n\tBUG_ON(slot >= ASSOC_ARRAY_FAN_OUT);\n\n\tnew_n1->parent_slot = slot;\n\n\t/* Metadata pointers cannot change slot */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tif (assoc_array_ptr_is_meta(node->slots[i]))\n\t\t\tnew_n0->slots[i] = node->slots[i];\n\t\telse\n\t\t\tnew_n0->slots[i] = NULL;\n\tBUG_ON(new_n0->slots[slot] != NULL);\n\tnew_n0->slots[slot] = assoc_array_node_to_ptr(new_n1);\n\n\t/* Filter the leaf pointers between the new nodes */\n\tfree_slot = -1;\n\tnext_slot = 0;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tif (assoc_array_ptr_is_meta(node->slots[i]))\n\t\t\tcontinue;\n\t\tif (edit->segment_cache[i] == slot) {\n\t\t\tnew_n1->slots[next_slot++] = node->slots[i];\n\t\t\tnew_n1->nr_leaves_on_branch++;\n\t\t} else {\n\t\t\tdo {\n\t\t\t\tfree_slot++;\n\t\t\t} while (new_n0->slots[free_slot] != NULL);\n\t\t\tnew_n0->slots[free_slot] = node->slots[i];\n\t\t}\n\t}\n\n\tpr_devel(\"filtered: f=%x n=%x\\n\", free_slot, next_slot);\n\n\tif (edit->segment_cache[ASSOC_ARRAY_FAN_OUT] != slot) {\n\t\tdo {\n\t\t\tfree_slot++;\n\t\t} while (new_n0->slots[free_slot] != NULL);\n\t\tedit->leaf_p = &new_n0->slots[free_slot];\n\t\tedit->adjust_count_on = new_n0;\n\t} else {\n\t\tedit->leaf_p = &new_n1->slots[next_slot++];\n\t\tedit->adjust_count_on = new_n1;\n\t}\n\n\tBUG_ON(next_slot <= 1);\n\n\tedit->set_backpointers_to = assoc_array_node_to_ptr(new_n0);\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tif (edit->segment_cache[i] == 0xff) {\n\t\t\tptr = node->slots[i];\n\t\t\tBUG_ON(assoc_array_ptr_is_leaf(ptr));\n\t\t\tif (assoc_array_ptr_is_node(ptr)) {\n\t\t\t\tside = assoc_array_ptr_to_node(ptr);\n\t\t\t\tedit->set_backpointers[i] = &side->back_pointer;\n\t\t\t} else {\n\t\t\t\tshortcut = assoc_array_ptr_to_shortcut(ptr);\n\t\t\t\tedit->set_backpointers[i] = &shortcut->back_pointer;\n\t\t\t}\n\t\t}\n\t}\n\n\tptr = node->back_pointer;\n\tif (!ptr)\n\t\tedit->set[0].ptr = &edit->array->root;\n\telse if (assoc_array_ptr_is_node(ptr))\n\t\tedit->set[0].ptr = &assoc_array_ptr_to_node(ptr)->slots[node->parent_slot];\n\telse\n\t\tedit->set[0].ptr = &assoc_array_ptr_to_shortcut(ptr)->next_node;\n\tedit->excised_meta[0] = assoc_array_node_to_ptr(node);\n\tpr_devel(\"<--%s() = ok [split node]\\n\", __func__);\n\treturn true;\n\npresent_leaves_cluster_but_not_new_leaf:\n\t/* All the old leaves cluster in the same slot, but the new leaf wants\n\t * to go into a different slot, so we create a new node to hold the new\n\t * leaf and a pointer to a new node holding all the old leaves.\n\t */\n\tpr_devel(\"present leaves cluster but not new leaf\\n\");\n\n\tnew_n0->back_pointer = node->back_pointer;\n\tnew_n0->parent_slot = node->parent_slot;\n\tnew_n0->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = edit->segment_cache[0];\n\tnew_n1->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tedit->adjust_count_on = new_n0;\n\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tnew_n1->slots[i] = node->slots[i];\n\n\tnew_n0->slots[edit->segment_cache[0]] = assoc_array_node_to_ptr(new_n0);\n\tedit->leaf_p = &new_n0->slots[edit->segment_cache[ASSOC_ARRAY_FAN_OUT]];\n\n\tedit->set[0].ptr = &assoc_array_ptr_to_node(node->back_pointer)->slots[node->parent_slot];\n\tedit->set[0].to = assoc_array_node_to_ptr(new_n0);\n\tedit->excised_meta[0] = assoc_array_node_to_ptr(node);\n\tpr_devel(\"<--%s() = ok [insert node before]\\n\", __func__);\n\treturn true;\n\nall_leaves_cluster_together:\n\t/* All the leaves, new and old, want to cluster together in this node\n\t * in the same slot, so we have to replace this node with a shortcut to\n\t * skip over the identical parts of the key and then place a pair of\n\t * nodes, one inside the other, at the end of the shortcut and\n\t * distribute the keys between them.\n\t *\n\t * Firstly we need to work out where the leaves start diverging as a\n\t * bit position into their keys so that we know how big the shortcut\n\t * needs to be.\n\t *\n\t * We only need to make a single pass of N of the N+1 leaves because if\n\t * any keys differ between themselves at bit X then at least one of\n\t * them must also differ with the base key at bit X or before.\n\t */\n\tpr_devel(\"all leaves cluster together\\n\");\n\tdiff = INT_MAX;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tint x = ops->diff_objects(assoc_array_ptr_to_leaf(node->slots[i]),\n\t\t\t\t\t index_key);\n\t\tif (x < diff) {\n\t\t\tBUG_ON(x < 0);\n\t\t\tdiff = x;\n\t\t}\n\t}\n\tBUG_ON(diff == INT_MAX);\n\tBUG_ON(diff < level + ASSOC_ARRAY_LEVEL_STEP);\n\n\tkeylen = round_up(diff, ASSOC_ARRAY_KEY_CHUNK_SIZE);\n\tkeylen >>= ASSOC_ARRAY_KEY_CHUNK_SHIFT;\n\n\tnew_s0 = kzalloc(sizeof(struct assoc_array_shortcut) +\n\t\t\t keylen * sizeof(unsigned long), GFP_KERNEL);\n\tif (!new_s0)\n\t\treturn false;\n\tedit->new_meta[2] = assoc_array_shortcut_to_ptr(new_s0);\n\n\tedit->set[0].to = assoc_array_shortcut_to_ptr(new_s0);\n\tnew_s0->back_pointer = node->back_pointer;\n\tnew_s0->parent_slot = node->parent_slot;\n\tnew_s0->next_node = assoc_array_node_to_ptr(new_n0);\n\tnew_n0->back_pointer = assoc_array_shortcut_to_ptr(new_s0);\n\tnew_n0->parent_slot = 0;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = -1; /* Need to calculate this */\n\n\tnew_s0->skip_to_level = level = diff & ~ASSOC_ARRAY_LEVEL_STEP_MASK;\n\tpr_devel(\"skip_to_level = %d [diff %d]\\n\", level, diff);\n\tBUG_ON(level <= 0);\n\n\tfor (i = 0; i < keylen; i++)\n\t\tnew_s0->index_key[i] =\n\t\t\tops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE);\n\n\tblank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK);\n\tpr_devel(\"blank off [%zu] %d: %lx\\n\", keylen - 1, level, blank);\n\tnew_s0->index_key[keylen - 1] &= ~blank;\n\n\t/* This now reduces to a node splitting exercise for which we'll need\n\t * to regenerate the disparity table.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tbase_seg = ops->get_object_key_chunk(assoc_array_ptr_to_leaf(ptr),\n\t\t\t\t\t\t level);\n\t\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\t\tedit->segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\t}\n\n\tbase_seg = ops->get_key_chunk(index_key, level);\n\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\tedit->segment_cache[ASSOC_ARRAY_FAN_OUT] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\tgoto do_split_node;\n}","lang":"c","vul_type":"cwe-476","target_token_count":3317,"sven_meta":{"func_name":"assoc_array_insert_into_terminal_node","file_name":"lib/assoc_array.c","commit_link":"github.com/torvalds/linux/commit/8d4a2ec1e0b41b0cf9a0c5cd4511da7f8e4f3de2","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#25-9051da92bef6","input":"static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin,\n\t\t\t\t RBinDexClass *c, int MI, int MA, int paddr, int ins_size,\n\t\t\t\t int insns_size, char *class_name, int regsz,\n\t\t\t\t int debug_info_off) {\n\tstruct r_bin_t *rbin = binfile->rbin;\n\tconst ut8 *p4 = r_buf_get_at (binfile->buf, debug_info_off, NULL);\n\tconst ut8 *p4_end = p4 + binfile->buf->length - debug_info_off;\n\tut64 line_start;\n\tut64 parameters_size;\n\tut64 param_type_idx;\n\tut16 argReg = regsz - ins_size;\n\tut64 source_file_idx = c->source_file;\n\tRList *params, *debug_positions, *emitted_debug_locals = NULL; \n\tbool keep = true;\n\tif (argReg > regsz) {\n\t\treturn; // this return breaks tests\n\t}\n\tp4 = r_uleb128 (p4, p4_end - p4, &line_start);\n\tp4 = r_uleb128 (p4, p4_end - p4, ¶meters_size);\n\t// TODO: check when we should use source_file\n\t// The state machine consists of five registers\n\tut32 address = 0;\n\tut32 line = line_start;\n\tif (!(debug_positions = r_list_newf ((RListFree)free))) {\n\t\treturn;\t\n\t}\n\tif (!(emitted_debug_locals = r_list_newf ((RListFree)free))) {\n\t\tr_list_free (debug_positions);\n\t\treturn;\n\t}\n\n\tstruct dex_debug_local_t debug_locals[regsz];\n\tmemset (debug_locals, 0, sizeof (struct dex_debug_local_t) * regsz);\n\tif (!(MA & 0x0008)) {\n\t\tdebug_locals[argReg].name = \"this\";\n\t\tdebug_locals[argReg].descriptor = r_str_newf(\"%s;\", class_name);\n\t\tdebug_locals[argReg].startAddress = 0;\n\t\tdebug_locals[argReg].signature = NULL;\n\t\tdebug_locals[argReg].live = true;\n\t\targReg++;\n\t}\n\tif (!(params = dex_method_signature2 (bin, MI))) {\n\t\tr_list_free (debug_positions);\n\t\tr_list_free (emitted_debug_locals);\n\t\treturn;\n\t}\n\n\tRListIter *iter = r_list_iterator (params);\n\tchar *name;\n\tchar *type;\n\tint reg;\n\n\tr_list_foreach (params, iter, type) {\n\t\tif ((argReg >= regsz) || !type || parameters_size <= 0) {\n\t\t\tr_list_free (debug_positions);\n\t\t\tr_list_free (params);\n\t\t\tr_list_free (emitted_debug_locals);\n\t\t\treturn;\n\t\t}\n\t\tp4 = r_uleb128 (p4, p4_end - p4, ¶m_type_idx); // read uleb128p1\n\t\tparam_type_idx -= 1;\n\t\tname = getstr (bin, param_type_idx);\n\t\treg = argReg;\n\t\tswitch (type[0]) {\n\t\tcase 'D':\n\t\tcase 'J':\n\t\t\targReg += 2;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\targReg += 1;\n\t\t\tbreak;\n\t\t}\n\t\tif (name) {\n\t\t\tdebug_locals[reg].name = name;\n\t\t\tdebug_locals[reg].descriptor = type;\n\t\t\tdebug_locals[reg].signature = NULL;\n\t\t\tdebug_locals[reg].startAddress = address;\n\t\t\tdebug_locals[reg].live = true;\n\t\t}\n\t\t--parameters_size;\n\t}\n\n\tut8 opcode = *(p4++) & 0xff;\n\twhile (keep) {\n\t\tswitch (opcode) {\n\t\tcase 0x0: // DBG_END_SEQUENCE\n\t\t\tkeep = false;\n\t\t\tbreak;\n\t\tcase 0x1: // DBG_ADVANCE_PC\n\t\t\t{\n\t\t\tut64 addr_diff;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &addr_diff);\n\t\t\taddress += addr_diff;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x2: // DBG_ADVANCE_LINE\n\t\t\t{\n\t\t\tst64 line_diff = r_sleb128 (&p4, p4_end);\n\t\t\tline += line_diff;\n\t\t\t}\n\t\t\tbreak;\t\n\t\tcase 0x3: // DBG_START_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tut64 name_idx;\n\t\t\tut64 type_idx;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &name_idx); \n\t\t\tname_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &type_idx); \n\t\t\ttype_idx -= 1;\n\t\t\tif (register_num >= regsz) {\n\t\t\t\tr_list_free (debug_positions);\n\t\t\t\tr_list_free (params);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Emit what was previously there, if anything\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\t\t\tdebug_locals[register_num].name = getstr (bin, name_idx);\n\t\t\tdebug_locals[register_num].descriptor = dex_type_descriptor (bin, type_idx);\n\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\tdebug_locals[register_num].signature = NULL;\n\t\t\tdebug_locals[register_num].live = true;\n\t\t\t//eprintf(\"DBG_START_LOCAL %x %x %x\\n\", register_num, name_idx, type_idx);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x4: //DBG_START_LOCAL_EXTENDED\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tut64 name_idx;\n\t\t\tut64 type_idx;\n\t\t\tut64 sig_idx;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &name_idx);\n\t\t\tname_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &type_idx);\n\t\t\ttype_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &sig_idx);\n\t\t\tsig_idx -= 1;\n\t\t\tif (register_num >= regsz) {\n\t\t\t\tr_list_free (debug_positions);\n\t\t\t\tr_list_free (params);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Emit what was previously there, if anything\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\n\t\t\tdebug_locals[register_num].name = getstr (bin, name_idx);\n\t\t\tdebug_locals[register_num].descriptor = dex_type_descriptor (bin, type_idx);\n\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\tdebug_locals[register_num].signature = getstr (bin, sig_idx);\n\t\t\tdebug_locals[register_num].live = true;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x5: // DBG_END_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\t\t\tdebug_locals[register_num].live = false;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x6: // DBG_RESTART_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tif (!debug_locals[register_num].live) {\n\t\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\t\tdebug_locals[register_num].live = true;\n\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x7: //DBG_SET_PROLOGUE_END\n\t\t\tbreak;\n\t\tcase 0x8: //DBG_SET_PROLOGUE_BEGIN\n\t\t\tbreak;\n\t\tcase 0x9:\n\t\t\t{\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &source_file_idx);\n\t\t\tsource_file_idx--;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t{\n\t\t\tint adjusted_opcode = opcode - 0x0a;\n\t\t\taddress += (adjusted_opcode / 15);\n\t\t\tline += -4 + (adjusted_opcode % 15);\n\t\t\tstruct dex_debug_position_t *position =\n\t\t\t\tmalloc (sizeof (struct dex_debug_position_t));\n\t\t\tif (!position) {\n\t\t\t\tkeep = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tposition->source_file_idx = source_file_idx;\n\t\t\tposition->address = address;\n\t\t\tposition->line = line;\n\t\t\tr_list_append (debug_positions, position);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\topcode = *(p4++) & 0xff;\n\t}\n\n\tif (!binfile->sdb_addrinfo) {\n\t\tbinfile->sdb_addrinfo = sdb_new0 ();\n\t}\n\n\tchar *fileline;\n\tchar offset[64];\n\tchar *offset_ptr;\n\n\tRListIter *iter1;\n\tstruct dex_debug_position_t *pos;\n\tr_list_foreach (debug_positions, iter1, pos) {\n\t\tfileline = r_str_newf (\"%s|%\"PFMT64d, getstr (bin, pos->source_file_idx), pos->line);\n\t\toffset_ptr = sdb_itoa (pos->address + paddr, offset, 16);\n\t\tsdb_set (binfile->sdb_addrinfo, offset_ptr, fileline, 0);\n\t\tsdb_set (binfile->sdb_addrinfo, fileline, offset_ptr, 0);\n\t}\n\n\tif (!dexdump) {\n\t\tr_list_free (debug_positions);\n\t\tr_list_free (emitted_debug_locals);\n\t\tr_list_free (params);\n\t\treturn;\n\t}\n\n\tRListIter *iter2;\n\tstruct dex_debug_position_t *position;\n\n\trbin->cb_printf (\" positions :\\n\");\n\tr_list_foreach (debug_positions, iter2, position) {\n\t\trbin->cb_printf (\" 0x%04llx line=%llu\\n\",\n\t\t\t\t position->address, position->line);\n\t}\n\n\trbin->cb_printf (\" locals :\\n\");\n\n\tRListIter *iter3;\n\tstruct dex_debug_local_t *local;\n\tr_list_foreach (emitted_debug_locals, iter3, local) {\n\t\tif (local->signature) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s %s\\n\",\n\t\t\t\tlocal->startAddress, local->endAddress,\n\t\t\t\tlocal->reg, local->name, local->descriptor,\n\t\t\t\tlocal->signature);\n\t\t} else {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s\\n\",\n\t\t\t\tlocal->startAddress, local->endAddress,\n\t\t\t\tlocal->reg, local->name, local->descriptor);\n\t\t}\n\t}\n\n\tfor (reg = 0; reg < regsz; reg++) {\n\t\tif (debug_locals[reg].live) {\n\t\t\tif (debug_locals[reg].signature) {\n\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s \"\n\t\t\t\t\t\"%s\\n\",\n\t\t\t\t\tdebug_locals[reg].startAddress,\n\t\t\t\t\tinsns_size, reg, debug_locals[reg].name,\n\t\t\t\t\tdebug_locals[reg].descriptor,\n\t\t\t\t\tdebug_locals[reg].signature);\n\t\t\t} else {\n\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s\"\n\t\t\t\t\t\"\\n\",\n\t\t\t\t\tdebug_locals[reg].startAddress,\n\t\t\t\t\tinsns_size, reg, debug_locals[reg].name,\n\t\t\t\t\tdebug_locals[reg].descriptor);\n\t\t\t}\n\t\t}\n\t}\n\tr_list_free (debug_positions);\n\tr_list_free (emitted_debug_locals);\n\tr_list_free (params);\n}","target":"static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin,\n\t\t\t\t RBinDexClass *c, int MI, int MA, int paddr, int ins_size,\n\t\t\t\t int insns_size, char *class_name, int regsz,\n\t\t\t\t int debug_info_off) {\n\tstruct r_bin_t *rbin = binfile->rbin;\n\tconst ut8 *p4 = r_buf_get_at (binfile->buf, debug_info_off, NULL);\n\tconst ut8 *p4_end = p4 + binfile->buf->length - debug_info_off;\n\tut64 line_start;\n\tut64 parameters_size;\n\tut64 param_type_idx;\n\tut16 argReg = regsz - ins_size;\n\tut64 source_file_idx = c->source_file;\n\tRList *params, *debug_positions, *emitted_debug_locals = NULL; \n\tbool keep = true;\n\tif (argReg > regsz) {\n\t\treturn; // this return breaks tests\n\t}\n\tp4 = r_uleb128 (p4, p4_end - p4, &line_start);\n\tp4 = r_uleb128 (p4, p4_end - p4, ¶meters_size);\n\t// TODO: check when we should use source_file\n\t// The state machine consists of five registers\n\tut32 address = 0;\n\tut32 line = line_start;\n\tif (!(debug_positions = r_list_newf ((RListFree)free))) {\n\t\treturn;\t\n\t}\n\tif (!(emitted_debug_locals = r_list_newf ((RListFree)free))) {\n\t\tr_list_free (debug_positions);\n\t\treturn;\n\t}\n\n\tstruct dex_debug_local_t debug_locals[regsz];\n\tmemset (debug_locals, 0, sizeof (struct dex_debug_local_t) * regsz);\n\tif (!(MA & 0x0008)) {\n\t\tdebug_locals[argReg].name = \"this\";\n\t\tdebug_locals[argReg].descriptor = r_str_newf(\"%s;\", class_name);\n\t\tdebug_locals[argReg].startAddress = 0;\n\t\tdebug_locals[argReg].signature = NULL;\n\t\tdebug_locals[argReg].live = true;\n\t\targReg++;\n\t}\n\tif (!(params = dex_method_signature2 (bin, MI))) {\n\t\tr_list_free (debug_positions);\n\t\tr_list_free (emitted_debug_locals);\n\t\treturn;\n\t}\n\n\tRListIter *iter = r_list_iterator (params);\n\tchar *name;\n\tchar *type;\n\tint reg;\n\n\tr_list_foreach (params, iter, type) {\n\t\tif ((argReg >= regsz) || !type || parameters_size <= 0) {\n\t\t\tr_list_free (debug_positions);\n\t\t\tr_list_free (params);\n\t\t\tr_list_free (emitted_debug_locals);\n\t\t\treturn;\n\t\t}\n\t\tp4 = r_uleb128 (p4, p4_end - p4, ¶m_type_idx); // read uleb128p1\n\t\tparam_type_idx -= 1;\n\t\tname = getstr (bin, param_type_idx);\n\t\treg = argReg;\n\t\tswitch (type[0]) {\n\t\tcase 'D':\n\t\tcase 'J':\n\t\t\targReg += 2;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\targReg += 1;\n\t\t\tbreak;\n\t\t}\n\t\tif (name) {\n\t\t\tdebug_locals[reg].name = name;\n\t\t\tdebug_locals[reg].descriptor = type;\n\t\t\tdebug_locals[reg].signature = NULL;\n\t\t\tdebug_locals[reg].startAddress = address;\n\t\t\tdebug_locals[reg].live = true;\n\t\t}\n\t\t--parameters_size;\n\t}\n\n\tif (p4 <= 0) {\n\t\treturn;\n\t}\n\tut8 opcode = *(p4++) & 0xff;\n\twhile (keep) {\n\t\tswitch (opcode) {\n\t\tcase 0x0: // DBG_END_SEQUENCE\n\t\t\tkeep = false;\n\t\t\tbreak;\n\t\tcase 0x1: // DBG_ADVANCE_PC\n\t\t\t{\n\t\t\tut64 addr_diff;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &addr_diff);\n\t\t\taddress += addr_diff;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x2: // DBG_ADVANCE_LINE\n\t\t\t{\n\t\t\tst64 line_diff = r_sleb128 (&p4, p4_end);\n\t\t\tline += line_diff;\n\t\t\t}\n\t\t\tbreak;\t\n\t\tcase 0x3: // DBG_START_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tut64 name_idx;\n\t\t\tut64 type_idx;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &name_idx); \n\t\t\tname_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &type_idx); \n\t\t\ttype_idx -= 1;\n\t\t\tif (register_num >= regsz) {\n\t\t\t\tr_list_free (debug_positions);\n\t\t\t\tr_list_free (params);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Emit what was previously there, if anything\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\t\t\tdebug_locals[register_num].name = getstr (bin, name_idx);\n\t\t\tdebug_locals[register_num].descriptor = dex_type_descriptor (bin, type_idx);\n\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\tdebug_locals[register_num].signature = NULL;\n\t\t\tdebug_locals[register_num].live = true;\n\t\t\t//eprintf(\"DBG_START_LOCAL %x %x %x\\n\", register_num, name_idx, type_idx);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x4: //DBG_START_LOCAL_EXTENDED\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tut64 name_idx;\n\t\t\tut64 type_idx;\n\t\t\tut64 sig_idx;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &name_idx);\n\t\t\tname_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &type_idx);\n\t\t\ttype_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &sig_idx);\n\t\t\tsig_idx -= 1;\n\t\t\tif (register_num >= regsz) {\n\t\t\t\tr_list_free (debug_positions);\n\t\t\t\tr_list_free (params);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Emit what was previously there, if anything\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\n\t\t\tdebug_locals[register_num].name = getstr (bin, name_idx);\n\t\t\tdebug_locals[register_num].descriptor = dex_type_descriptor (bin, type_idx);\n\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\tdebug_locals[register_num].signature = getstr (bin, sig_idx);\n\t\t\tdebug_locals[register_num].live = true;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x5: // DBG_END_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\t\t\tdebug_locals[register_num].live = false;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x6: // DBG_RESTART_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tif (!debug_locals[register_num].live) {\n\t\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\t\tdebug_locals[register_num].live = true;\n\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x7: //DBG_SET_PROLOGUE_END\n\t\t\tbreak;\n\t\tcase 0x8: //DBG_SET_PROLOGUE_BEGIN\n\t\t\tbreak;\n\t\tcase 0x9:\n\t\t\t{\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &source_file_idx);\n\t\t\tsource_file_idx--;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t{\n\t\t\tint adjusted_opcode = opcode - 0x0a;\n\t\t\taddress += (adjusted_opcode / 15);\n\t\t\tline += -4 + (adjusted_opcode % 15);\n\t\t\tstruct dex_debug_position_t *position =\n\t\t\t\tmalloc (sizeof (struct dex_debug_position_t));\n\t\t\tif (!position) {\n\t\t\t\tkeep = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tposition->source_file_idx = source_file_idx;\n\t\t\tposition->address = address;\n\t\t\tposition->line = line;\n\t\t\tr_list_append (debug_positions, position);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\topcode = *(p4++) & 0xff;\n\t}\n\n\tif (!binfile->sdb_addrinfo) {\n\t\tbinfile->sdb_addrinfo = sdb_new0 ();\n\t}\n\n\tchar *fileline;\n\tchar offset[64];\n\tchar *offset_ptr;\n\n\tRListIter *iter1;\n\tstruct dex_debug_position_t *pos;\n\tr_list_foreach (debug_positions, iter1, pos) {\n\t\tfileline = r_str_newf (\"%s|%\"PFMT64d, getstr (bin, pos->source_file_idx), pos->line);\n\t\toffset_ptr = sdb_itoa (pos->address + paddr, offset, 16);\n\t\tsdb_set (binfile->sdb_addrinfo, offset_ptr, fileline, 0);\n\t\tsdb_set (binfile->sdb_addrinfo, fileline, offset_ptr, 0);\n\t}\n\n\tif (!dexdump) {\n\t\tr_list_free (debug_positions);\n\t\tr_list_free (emitted_debug_locals);\n\t\tr_list_free (params);\n\t\treturn;\n\t}\n\n\tRListIter *iter2;\n\tstruct dex_debug_position_t *position;\n\n\trbin->cb_printf (\" positions :\\n\");\n\tr_list_foreach (debug_positions, iter2, position) {\n\t\trbin->cb_printf (\" 0x%04llx line=%llu\\n\",\n\t\t\t\t position->address, position->line);\n\t}\n\n\trbin->cb_printf (\" locals :\\n\");\n\n\tRListIter *iter3;\n\tstruct dex_debug_local_t *local;\n\tr_list_foreach (emitted_debug_locals, iter3, local) {\n\t\tif (local->signature) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s %s\\n\",\n\t\t\t\tlocal->startAddress, local->endAddress,\n\t\t\t\tlocal->reg, local->name, local->descriptor,\n\t\t\t\tlocal->signature);\n\t\t} else {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s\\n\",\n\t\t\t\tlocal->startAddress, local->endAddress,\n\t\t\t\tlocal->reg, local->name, local->descriptor);\n\t\t}\n\t}\n\n\tfor (reg = 0; reg < regsz; reg++) {\n\t\tif (debug_locals[reg].live) {\n\t\t\tif (debug_locals[reg].signature) {\n\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s \"\n\t\t\t\t\t\"%s\\n\",\n\t\t\t\t\tdebug_locals[reg].startAddress,\n\t\t\t\t\tinsns_size, reg, debug_locals[reg].name,\n\t\t\t\t\tdebug_locals[reg].descriptor,\n\t\t\t\t\tdebug_locals[reg].signature);\n\t\t\t} else {\n\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s\"\n\t\t\t\t\t\"\\n\",\n\t\t\t\t\tdebug_locals[reg].startAddress,\n\t\t\t\t\tinsns_size, reg, debug_locals[reg].name,\n\t\t\t\t\tdebug_locals[reg].descriptor);\n\t\t\t}\n\t\t}\n\t}\n\tr_list_free (debug_positions);\n\tr_list_free (emitted_debug_locals);\n\tr_list_free (params);\n}","lang":"c","vul_type":"cwe-476","target_token_count":3049,"sven_meta":{"func_name":"dex_parse_debug_item","file_name":"libr/bin/p/bin_dex.c","commit_link":"github.com/radare/radare2/commit/252afb1cff9676f3ae1f341a28448bf2c8b6e308","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#26-4b27c389056e","input":"int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm,\n\t\t struct cmsghdr *cmsg)\n{\n\tstruct page *page = NULL;\n\tstruct rds_atomic_args *args;\n\tint ret = 0;\n\n\tif (cmsg->cmsg_len < CMSG_LEN(sizeof(struct rds_atomic_args))\n\t || rm->atomic.op_active)\n\t\treturn -EINVAL;\n\n\targs = CMSG_DATA(cmsg);\n\n\t/* Nonmasked & masked cmsg ops converted to masked hw ops */\n\tswitch (cmsg->cmsg_type) {\n\tcase RDS_CMSG_ATOMIC_FADD:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_FADD;\n\t\trm->atomic.op_m_fadd.add = args->fadd.add;\n\t\trm->atomic.op_m_fadd.nocarry_mask = 0;\n\t\tbreak;\n\tcase RDS_CMSG_MASKED_ATOMIC_FADD:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_FADD;\n\t\trm->atomic.op_m_fadd.add = args->m_fadd.add;\n\t\trm->atomic.op_m_fadd.nocarry_mask = args->m_fadd.nocarry_mask;\n\t\tbreak;\n\tcase RDS_CMSG_ATOMIC_CSWP:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_CSWP;\n\t\trm->atomic.op_m_cswp.compare = args->cswp.compare;\n\t\trm->atomic.op_m_cswp.swap = args->cswp.swap;\n\t\trm->atomic.op_m_cswp.compare_mask = ~0;\n\t\trm->atomic.op_m_cswp.swap_mask = ~0;\n\t\tbreak;\n\tcase RDS_CMSG_MASKED_ATOMIC_CSWP:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_CSWP;\n\t\trm->atomic.op_m_cswp.compare = args->m_cswp.compare;\n\t\trm->atomic.op_m_cswp.swap = args->m_cswp.swap;\n\t\trm->atomic.op_m_cswp.compare_mask = args->m_cswp.compare_mask;\n\t\trm->atomic.op_m_cswp.swap_mask = args->m_cswp.swap_mask;\n\t\tbreak;\n\tdefault:\n\t\tBUG(); /* should never happen */\n\t}\n\n\trm->atomic.op_notify = !!(args->flags & RDS_RDMA_NOTIFY_ME);\n\trm->atomic.op_silent = !!(args->flags & RDS_RDMA_SILENT);\n\trm->atomic.op_active = 1;\n\trm->atomic.op_recverr = rs->rs_recverr;\n\trm->atomic.op_sg = rds_message_alloc_sgs(rm, 1);\n\tif (!rm->atomic.op_sg) {\n\t\tret = -ENOMEM;\n\t\tgoto err;\n\t}\n\n\t/* verify 8 byte-aligned */\n\tif (args->local_addr & 0x7) {\n\t\tret = -EFAULT;\n\t\tgoto err;\n\t}\n\n\tret = rds_pin_pages(args->local_addr, 1, &page, 1);\n\tif (ret != 1)\n\t\tgoto err;\n\tret = 0;\n\n\tsg_set_page(rm->atomic.op_sg, page, 8, offset_in_page(args->local_addr));\n\n\tif (rm->atomic.op_notify || rm->atomic.op_recverr) {\n\t\t/* We allocate an uninitialized notifier here, because\n\t\t * we don't want to do that in the completion handler. We\n\t\t * would have to use GFP_ATOMIC there, and don't want to deal\n\t\t * with failed allocations.\n\t\t */\n\t\trm->atomic.op_notifier = kmalloc(sizeof(*rm->atomic.op_notifier), GFP_KERNEL);\n\t\tif (!rm->atomic.op_notifier) {\n\t\t\tret = -ENOMEM;\n\t\t\tgoto err;\n\t\t}\n\n\t\trm->atomic.op_notifier->n_user_token = args->user_token;\n\t\trm->atomic.op_notifier->n_status = RDS_RDMA_SUCCESS;\n\t}\n\n\trm->atomic.op_rkey = rds_rdma_cookie_key(args->cookie);\n\trm->atomic.op_remote_addr = args->remote_addr + rds_rdma_cookie_offset(args->cookie);\n\n\treturn ret;\nerr:\n\tif (page)\n\t\tput_page(page);\n\tkfree(rm->atomic.op_notifier);\n\n\treturn ret;\n}","target":"int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm,\n\t\t struct cmsghdr *cmsg)\n{\n\tstruct page *page = NULL;\n\tstruct rds_atomic_args *args;\n\tint ret = 0;\n\n\tif (cmsg->cmsg_len < CMSG_LEN(sizeof(struct rds_atomic_args))\n\t || rm->atomic.op_active)\n\t\treturn -EINVAL;\n\n\targs = CMSG_DATA(cmsg);\n\n\t/* Nonmasked & masked cmsg ops converted to masked hw ops */\n\tswitch (cmsg->cmsg_type) {\n\tcase RDS_CMSG_ATOMIC_FADD:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_FADD;\n\t\trm->atomic.op_m_fadd.add = args->fadd.add;\n\t\trm->atomic.op_m_fadd.nocarry_mask = 0;\n\t\tbreak;\n\tcase RDS_CMSG_MASKED_ATOMIC_FADD:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_FADD;\n\t\trm->atomic.op_m_fadd.add = args->m_fadd.add;\n\t\trm->atomic.op_m_fadd.nocarry_mask = args->m_fadd.nocarry_mask;\n\t\tbreak;\n\tcase RDS_CMSG_ATOMIC_CSWP:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_CSWP;\n\t\trm->atomic.op_m_cswp.compare = args->cswp.compare;\n\t\trm->atomic.op_m_cswp.swap = args->cswp.swap;\n\t\trm->atomic.op_m_cswp.compare_mask = ~0;\n\t\trm->atomic.op_m_cswp.swap_mask = ~0;\n\t\tbreak;\n\tcase RDS_CMSG_MASKED_ATOMIC_CSWP:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_CSWP;\n\t\trm->atomic.op_m_cswp.compare = args->m_cswp.compare;\n\t\trm->atomic.op_m_cswp.swap = args->m_cswp.swap;\n\t\trm->atomic.op_m_cswp.compare_mask = args->m_cswp.compare_mask;\n\t\trm->atomic.op_m_cswp.swap_mask = args->m_cswp.swap_mask;\n\t\tbreak;\n\tdefault:\n\t\tBUG(); /* should never happen */\n\t}\n\n\trm->atomic.op_notify = !!(args->flags & RDS_RDMA_NOTIFY_ME);\n\trm->atomic.op_silent = !!(args->flags & RDS_RDMA_SILENT);\n\trm->atomic.op_active = 1;\n\trm->atomic.op_recverr = rs->rs_recverr;\n\trm->atomic.op_sg = rds_message_alloc_sgs(rm, 1);\n\tif (!rm->atomic.op_sg) {\n\t\tret = -ENOMEM;\n\t\tgoto err;\n\t}\n\n\t/* verify 8 byte-aligned */\n\tif (args->local_addr & 0x7) {\n\t\tret = -EFAULT;\n\t\tgoto err;\n\t}\n\n\tret = rds_pin_pages(args->local_addr, 1, &page, 1);\n\tif (ret != 1)\n\t\tgoto err;\n\tret = 0;\n\n\tsg_set_page(rm->atomic.op_sg, page, 8, offset_in_page(args->local_addr));\n\n\tif (rm->atomic.op_notify || rm->atomic.op_recverr) {\n\t\t/* We allocate an uninitialized notifier here, because\n\t\t * we don't want to do that in the completion handler. We\n\t\t * would have to use GFP_ATOMIC there, and don't want to deal\n\t\t * with failed allocations.\n\t\t */\n\t\trm->atomic.op_notifier = kmalloc(sizeof(*rm->atomic.op_notifier), GFP_KERNEL);\n\t\tif (!rm->atomic.op_notifier) {\n\t\t\tret = -ENOMEM;\n\t\t\tgoto err;\n\t\t}\n\n\t\trm->atomic.op_notifier->n_user_token = args->user_token;\n\t\trm->atomic.op_notifier->n_status = RDS_RDMA_SUCCESS;\n\t}\n\n\trm->atomic.op_rkey = rds_rdma_cookie_key(args->cookie);\n\trm->atomic.op_remote_addr = args->remote_addr + rds_rdma_cookie_offset(args->cookie);\n\n\treturn ret;\nerr:\n\tif (page)\n\t\tput_page(page);\n\trm->atomic.op_active = 0;\n\tkfree(rm->atomic.op_notifier);\n\n\treturn ret;\n}","lang":"c","vul_type":"cwe-476","target_token_count":876,"sven_meta":{"func_name":"rds_cmsg_atomic","file_name":"net/rds/rdma.c","commit_link":"github.com/torvalds/linux/commit/7d11f77f84b27cef452cee332f4e469503084737","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#27-c7014a67838a","input":"AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream, \n AP4_UI32 type,\n AP4_UI32 size_32,\n AP4_UI64 size_64,\n AP4_Atom*& atom)\n{\n bool atom_is_large = (size_32 == 1);\n bool force_64 = (size_32==1 && ((size_64>>32) == 0));\n \n // create the atom\n if (GetContext() == AP4_ATOM_TYPE_STSD) {\n // sample entry\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n switch (type) {\n case AP4_ATOM_TYPE_MP4A:\n atom = new AP4_Mp4aSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MP4V:\n atom = new AP4_Mp4vSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MP4S:\n atom = new AP4_Mp4sSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ENCA:\n atom = new AP4_EncaSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ENCV:\n atom = new AP4_EncvSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_DRMS:\n atom = new AP4_DrmsSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_DRMI:\n atom = new AP4_DrmiSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_AVC1:\n case AP4_ATOM_TYPE_AVC2:\n case AP4_ATOM_TYPE_AVC3:\n case AP4_ATOM_TYPE_AVC4:\n case AP4_ATOM_TYPE_DVAV:\n case AP4_ATOM_TYPE_DVA1:\n atom = new AP4_AvcSampleEntry(type, size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_HEV1:\n case AP4_ATOM_TYPE_HVC1:\n case AP4_ATOM_TYPE_DVHE:\n case AP4_ATOM_TYPE_DVH1:\n atom = new AP4_HevcSampleEntry(type, size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ALAC:\n case AP4_ATOM_TYPE_AC_3:\n case AP4_ATOM_TYPE_EC_3:\n case AP4_ATOM_TYPE_DTSC:\n case AP4_ATOM_TYPE_DTSH:\n case AP4_ATOM_TYPE_DTSL:\n case AP4_ATOM_TYPE_DTSE:\n atom = new AP4_AudioSampleEntry(type, size_32, stream, *this);\n break;\n \n case AP4_ATOM_TYPE_RTP_:\n atom = new AP4_RtpHintSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_STPP:\n atom = new AP4_SubtitleSampleEntry(type, size_32, stream, *this);\n break;\n\n default: {\n // try all the external type handlers\n AP4_List::Item* handler_item = m_TypeHandlers.FirstItem();\n while (handler_item) {\n TypeHandler* handler = handler_item->GetData();\n if (AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom))) {\n break;\n }\n handler_item = handler_item->GetNext();\n }\n\n // no custom handler, create a generic entry\n if (atom == NULL) {\n atom = new AP4_UnknownSampleEntry(type, (AP4_UI32)size_64, stream);\n }\n\n break;\n }\n }\n } else {\n // regular atom\n switch (type) {\n case AP4_ATOM_TYPE_MOOV:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MoovAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MVHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MvhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MEHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MehdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MFHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MfhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TRAK:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrakAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_TREX:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrexAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HDLR:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HdlrAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TKHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TkhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TRUN:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrunAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFRA:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfraAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MFRO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MfroAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MDHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MdhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StsdAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_STSC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StscAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STCO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StcoAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_CO64:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_Co64Atom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSZ:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StszAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STZ2:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_Stz2Atom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STTS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SttsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_CTTS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_CttsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StssAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IODS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IodsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ESDS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_EsdsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_AVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AvccAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_HVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HvccAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_DVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_DvccAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HVCE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HvccAtom::Create(size_32, stream);\n atom->SetType(AP4_ATOM_TYPE_HVCE);\n break;\n\n case AP4_ATOM_TYPE_AVCE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AvccAtom::Create(size_32, stream);\n atom->SetType(AP4_ATOM_TYPE_AVCE);\n break;\n\n #if !defined(AP4_CONFIG_MINI_BUILD)\n case AP4_ATOM_TYPE_UUID: {\n AP4_UI08 uuid[16];\n AP4_Result result = stream.Read(uuid, 16);\n if (AP4_FAILED(result)) return result;\n \n if (AP4_CompareMemory(uuid, AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM, 16) == 0) {\n atom = AP4_PiffTrackEncryptionAtom::Create((AP4_UI32)size_64, stream);\n } else if (AP4_CompareMemory(uuid, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, 16) == 0) {\n atom = AP4_PiffSampleEncryptionAtom::Create((AP4_UI32)size_64, stream);\n } else {\n atom = new AP4_UnknownUuidAtom(size_64, uuid, stream);\n }\n break;\n }\n \n case AP4_ATOM_TYPE_8ID_:\n atom = new AP4_NullTerminatedStringAtom(type, size_64, stream);\n break;\n\n case AP4_ATOM_TYPE_8BDL:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_8bdlAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_DREF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_DrefAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_URL:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_UrlAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ELST:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_ElstAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_VMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_VmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_NMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_NmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SthdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_FRMA:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_FrmaAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SCHM:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SchmAtom::Create(size_32, &m_ContextStack, stream);\n break;\n\n case AP4_ATOM_TYPE_FTYP:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_FtypAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_TIMS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TimsAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_SDP_:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SdpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IKMS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IkmsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ISFM:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IsfmAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ISLT:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IsltAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ODHE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OdheAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_OHDR:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OhdrAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ODDA:\n atom = AP4_OddaAtom::Create(size_64, stream);\n break;\n\n case AP4_ATOM_TYPE_ODAF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OdafAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_GRPI:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_GrpiAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IPRO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IproAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_RTP_:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_RtpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFDT:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfdtAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TENC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TencAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SENC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SencAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SAIZ:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SaizAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SAIO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SaioAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_PDIN:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_PdinAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_BLOC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_BlocAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_AINF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AinfAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_PSSH:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_PsshAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SIDX:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SidxAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SBGP:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SbgpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SGPD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SgpdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MKID:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n if (GetContext() == AP4_ATOM_TYPE_MARL) {\n atom = AP4_MkidAtom::Create(size_32, stream);\n }\n break;\n\n case AP4_ATOM_TYPE_DEC3:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n if (GetContext() == AP4_ATOM_TYPE_EC_3 || GetContext() == AP4_ATOM_TYPE_ENCA) {\n atom = AP4_Dec3Atom::Create(size_32, stream);\n }\n break;\n\n // track ref types\n case AP4_ATOM_TYPE_HINT:\n case AP4_ATOM_TYPE_CDSC:\n case AP4_ATOM_TYPE_SYNC:\n case AP4_ATOM_TYPE_MPOD:\n case AP4_ATOM_TYPE_DPND:\n case AP4_ATOM_TYPE_IPIR:\n case AP4_ATOM_TYPE_ALIS:\n case AP4_ATOM_TYPE_CHAP:\n if (GetContext() == AP4_ATOM_TYPE_TREF) {\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrefTypeAtom::Create(type, size_32, stream);\n }\n break;\n\n #endif // AP4_CONFIG_MINI_BUILD\n\n // container atoms\n case AP4_ATOM_TYPE_MOOF:\n case AP4_ATOM_TYPE_MVEX:\n case AP4_ATOM_TYPE_TRAF:\n case AP4_ATOM_TYPE_TREF:\n case AP4_ATOM_TYPE_MFRA:\n case AP4_ATOM_TYPE_HNTI:\n case AP4_ATOM_TYPE_STBL:\n case AP4_ATOM_TYPE_MDIA:\n case AP4_ATOM_TYPE_DINF:\n case AP4_ATOM_TYPE_MINF:\n case AP4_ATOM_TYPE_SCHI:\n case AP4_ATOM_TYPE_SINF:\n case AP4_ATOM_TYPE_UDTA:\n case AP4_ATOM_TYPE_ILST:\n case AP4_ATOM_TYPE_EDTS: \n case AP4_ATOM_TYPE_MDRI:\n case AP4_ATOM_TYPE_WAVE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_ContainerAtom::Create(type, size_64, false, force_64, stream, *this);\n break;\n\n // containers, only at the top\n case AP4_ATOM_TYPE_MARL:\n if (GetContext() == 0) {\n atom = AP4_ContainerAtom::Create(type, size_64, false, force_64, stream, *this);\n }\n break;\n \n // full container atoms\n case AP4_ATOM_TYPE_META:\n case AP4_ATOM_TYPE_ODRM:\n case AP4_ATOM_TYPE_ODKM:\n atom = AP4_ContainerAtom::Create(type, size_64, true, force_64, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_FREE:\n case AP4_ATOM_TYPE_WIDE:\n case AP4_ATOM_TYPE_MDAT:\n // generic atoms\n break;\n \n default: {\n // try all the external type handlers\n AP4_List::Item* handler_item = m_TypeHandlers.FirstItem();\n while (handler_item) {\n TypeHandler* handler = handler_item->GetData();\n if (AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom))) {\n break;\n }\n handler_item = handler_item->GetNext();\n }\n\n break;\n }\n }\n }\n \n return AP4_SUCCESS;\n}","target":"AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream, \n AP4_UI32 type,\n AP4_UI32 size_32,\n AP4_UI64 size_64,\n AP4_Atom*& atom)\n{\n bool atom_is_large = (size_32 == 1);\n bool force_64 = (size_32==1 && ((size_64>>32) == 0));\n \n // create the atom\n if (GetContext() == AP4_ATOM_TYPE_STSD) {\n // sample entry\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n switch (type) {\n case AP4_ATOM_TYPE_MP4A:\n atom = new AP4_Mp4aSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MP4V:\n atom = new AP4_Mp4vSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MP4S:\n atom = new AP4_Mp4sSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ENCA:\n atom = new AP4_EncaSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ENCV:\n atom = new AP4_EncvSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_DRMS:\n atom = new AP4_DrmsSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_DRMI:\n atom = new AP4_DrmiSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_AVC1:\n case AP4_ATOM_TYPE_AVC2:\n case AP4_ATOM_TYPE_AVC3:\n case AP4_ATOM_TYPE_AVC4:\n case AP4_ATOM_TYPE_DVAV:\n case AP4_ATOM_TYPE_DVA1:\n atom = new AP4_AvcSampleEntry(type, size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_HEV1:\n case AP4_ATOM_TYPE_HVC1:\n case AP4_ATOM_TYPE_DVHE:\n case AP4_ATOM_TYPE_DVH1:\n atom = new AP4_HevcSampleEntry(type, size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ALAC:\n case AP4_ATOM_TYPE_AC_3:\n case AP4_ATOM_TYPE_EC_3:\n case AP4_ATOM_TYPE_DTSC:\n case AP4_ATOM_TYPE_DTSH:\n case AP4_ATOM_TYPE_DTSL:\n case AP4_ATOM_TYPE_DTSE:\n atom = new AP4_AudioSampleEntry(type, size_32, stream, *this);\n break;\n \n case AP4_ATOM_TYPE_RTP_:\n atom = new AP4_RtpHintSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_STPP:\n atom = new AP4_SubtitleSampleEntry(type, size_32, stream, *this);\n break;\n\n default: {\n // try all the external type handlers\n AP4_List::Item* handler_item = m_TypeHandlers.FirstItem();\n while (handler_item) {\n TypeHandler* handler = handler_item->GetData();\n if (AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom))) {\n break;\n }\n handler_item = handler_item->GetNext();\n }\n\n // no custom handler, create a generic entry\n if (atom == NULL) {\n atom = new AP4_UnknownSampleEntry(type, (AP4_UI32)size_64, stream);\n }\n\n break;\n }\n }\n } else {\n // regular atom\n switch (type) {\n case AP4_ATOM_TYPE_MOOV:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MoovAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MVHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MvhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MEHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MehdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MFHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MfhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TRAK:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrakAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_TREX:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrexAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HDLR:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HdlrAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TKHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TkhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TRUN:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrunAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFRA:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfraAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MFRO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MfroAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MDHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MdhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StsdAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_STSC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StscAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STCO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StcoAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_CO64:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_Co64Atom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSZ:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StszAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STZ2:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_Stz2Atom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STTS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SttsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_CTTS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_CttsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StssAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IODS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IodsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ESDS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_EsdsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_AVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AvccAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_HVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HvccAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_DVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_DvccAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HVCE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HvccAtom::Create(size_32, stream);\n if (atom) {\n atom->SetType(AP4_ATOM_TYPE_HVCE);\n }\n break;\n\n case AP4_ATOM_TYPE_AVCE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AvccAtom::Create(size_32, stream);\n if (atom) {\n atom->SetType(AP4_ATOM_TYPE_AVCE);\n }\n break;\n\n #if !defined(AP4_CONFIG_MINI_BUILD)\n case AP4_ATOM_TYPE_UUID: {\n AP4_UI08 uuid[16];\n AP4_Result result = stream.Read(uuid, 16);\n if (AP4_FAILED(result)) return result;\n \n if (AP4_CompareMemory(uuid, AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM, 16) == 0) {\n atom = AP4_PiffTrackEncryptionAtom::Create((AP4_UI32)size_64, stream);\n } else if (AP4_CompareMemory(uuid, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, 16) == 0) {\n atom = AP4_PiffSampleEncryptionAtom::Create((AP4_UI32)size_64, stream);\n } else {\n atom = new AP4_UnknownUuidAtom(size_64, uuid, stream);\n }\n break;\n }\n \n case AP4_ATOM_TYPE_8ID_:\n atom = new AP4_NullTerminatedStringAtom(type, size_64, stream);\n break;\n\n case AP4_ATOM_TYPE_8BDL:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_8bdlAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_DREF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_DrefAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_URL:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_UrlAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ELST:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_ElstAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_VMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_VmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_NMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_NmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SthdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_FRMA:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_FrmaAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SCHM:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SchmAtom::Create(size_32, &m_ContextStack, stream);\n break;\n\n case AP4_ATOM_TYPE_FTYP:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_FtypAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_TIMS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TimsAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_SDP_:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SdpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IKMS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IkmsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ISFM:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IsfmAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ISLT:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IsltAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ODHE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OdheAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_OHDR:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OhdrAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ODDA:\n atom = AP4_OddaAtom::Create(size_64, stream);\n break;\n\n case AP4_ATOM_TYPE_ODAF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OdafAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_GRPI:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_GrpiAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IPRO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IproAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_RTP_:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_RtpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFDT:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfdtAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TENC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TencAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SENC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SencAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SAIZ:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SaizAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SAIO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SaioAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_PDIN:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_PdinAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_BLOC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_BlocAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_AINF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AinfAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_PSSH:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_PsshAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SIDX:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SidxAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SBGP:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SbgpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SGPD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SgpdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MKID:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n if (GetContext() == AP4_ATOM_TYPE_MARL) {\n atom = AP4_MkidAtom::Create(size_32, stream);\n }\n break;\n\n case AP4_ATOM_TYPE_DEC3:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n if (GetContext() == AP4_ATOM_TYPE_EC_3 || GetContext() == AP4_ATOM_TYPE_ENCA) {\n atom = AP4_Dec3Atom::Create(size_32, stream);\n }\n break;\n\n // track ref types\n case AP4_ATOM_TYPE_HINT:\n case AP4_ATOM_TYPE_CDSC:\n case AP4_ATOM_TYPE_SYNC:\n case AP4_ATOM_TYPE_MPOD:\n case AP4_ATOM_TYPE_DPND:\n case AP4_ATOM_TYPE_IPIR:\n case AP4_ATOM_TYPE_ALIS:\n case AP4_ATOM_TYPE_CHAP:\n if (GetContext() == AP4_ATOM_TYPE_TREF) {\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrefTypeAtom::Create(type, size_32, stream);\n }\n break;\n\n #endif // AP4_CONFIG_MINI_BUILD\n\n // container atoms\n case AP4_ATOM_TYPE_MOOF:\n case AP4_ATOM_TYPE_MVEX:\n case AP4_ATOM_TYPE_TRAF:\n case AP4_ATOM_TYPE_TREF:\n case AP4_ATOM_TYPE_MFRA:\n case AP4_ATOM_TYPE_HNTI:\n case AP4_ATOM_TYPE_STBL:\n case AP4_ATOM_TYPE_MDIA:\n case AP4_ATOM_TYPE_DINF:\n case AP4_ATOM_TYPE_MINF:\n case AP4_ATOM_TYPE_SCHI:\n case AP4_ATOM_TYPE_SINF:\n case AP4_ATOM_TYPE_UDTA:\n case AP4_ATOM_TYPE_ILST:\n case AP4_ATOM_TYPE_EDTS: \n case AP4_ATOM_TYPE_MDRI:\n case AP4_ATOM_TYPE_WAVE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_ContainerAtom::Create(type, size_64, false, force_64, stream, *this);\n break;\n\n // containers, only at the top\n case AP4_ATOM_TYPE_MARL:\n if (GetContext() == 0) {\n atom = AP4_ContainerAtom::Create(type, size_64, false, force_64, stream, *this);\n }\n break;\n \n // full container atoms\n case AP4_ATOM_TYPE_META:\n case AP4_ATOM_TYPE_ODRM:\n case AP4_ATOM_TYPE_ODKM:\n atom = AP4_ContainerAtom::Create(type, size_64, true, force_64, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_FREE:\n case AP4_ATOM_TYPE_WIDE:\n case AP4_ATOM_TYPE_MDAT:\n // generic atoms\n break;\n \n default: {\n // try all the external type handlers\n AP4_List::Item* handler_item = m_TypeHandlers.FirstItem();\n while (handler_item) {\n TypeHandler* handler = handler_item->GetData();\n if (AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom))) {\n break;\n }\n handler_item = handler_item->GetNext();\n }\n\n break;\n }\n }\n }\n \n return AP4_SUCCESS;\n}","lang":"cpp","vul_type":"cwe-476","target_token_count":4761,"sven_meta":{"func_name":"AP4_AtomFactory::CreateAtomFromStream","file_name":"Source/C++/Core/Ap4AtomFactory.cpp","commit_link":"github.com/axiomatic-systems/Bento4/commit/be7185faf7f52674028977dcf501c6039ff03aa5","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#31-c1bc78913b6e","input":"IRC_PROTOCOL_CALLBACK(352)\n{\n char *pos_attr, *pos_hopcount, *pos_realname, *str_host;\n int arg_start, length;\n struct t_irc_channel *ptr_channel;\n struct t_irc_nick *ptr_nick;\n\n IRC_PROTOCOL_MIN_ARGS(5);\n\n /* silently ignore malformed 352 message (missing infos) */\n if (argc < 8)\n return WEECHAT_RC_OK;\n\n pos_attr = NULL;\n pos_hopcount = NULL;\n pos_realname = NULL;\n\n if (argc > 8)\n {\n arg_start = (strcmp (argv[8], \"*\") == 0) ? 9 : 8;\n if (argv[arg_start][0] == ':')\n {\n pos_attr = NULL;\n pos_hopcount = (argc > arg_start) ? argv[arg_start] + 1 : NULL;\n pos_realname = (argc > arg_start + 1) ? argv_eol[arg_start + 1] : NULL;\n }\n else\n {\n pos_attr = argv[arg_start];\n pos_hopcount = (argc > arg_start + 1) ? argv[arg_start + 1] + 1 : NULL;\n pos_realname = (argc > arg_start + 2) ? argv_eol[arg_start + 2] : NULL;\n }\n }\n\n ptr_channel = irc_channel_search (server, argv[3]);\n ptr_nick = (ptr_channel) ?\n irc_nick_search (server, ptr_channel, argv[7]) : NULL;\n\n /* update host in nick */\n if (ptr_nick)\n {\n length = strlen (argv[4]) + 1 + strlen (argv[5]) + 1;\n str_host = malloc (length);\n if (str_host)\n {\n snprintf (str_host, length, \"%s@%s\", argv[4], argv[5]);\n irc_nick_set_host (ptr_nick, str_host);\n free (str_host);\n }\n }\n\n /* update away flag in nick */\n if (ptr_channel && ptr_nick && pos_attr)\n {\n irc_nick_set_away (server, ptr_channel, ptr_nick,\n (pos_attr[0] == 'G') ? 1 : 0);\n }\n\n /* update realname in nick */\n if (ptr_channel && ptr_nick && pos_realname)\n {\n if (ptr_nick->realname)\n free (ptr_nick->realname);\n if (pos_realname &&\n weechat_hashtable_has_key (server->cap_list, \"extended-join\"))\n {\n ptr_nick->realname = strdup (pos_realname);\n }\n else\n {\n ptr_nick->realname = NULL;\n }\n }\n\n /* display output of who (manual who from user) */\n if (!ptr_channel || (ptr_channel->checking_whox <= 0))\n {\n weechat_printf_date_tags (\n irc_msgbuffer_get_target_buffer (\n server, NULL, command, \"who\", NULL),\n date,\n irc_protocol_tags (command, \"irc_numeric\", NULL, NULL),\n \"%s%s[%s%s%s] %s%s %s(%s%s@%s%s)%s %s%s%s%s(%s)\",\n weechat_prefix (\"network\"),\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_CHAT_CHANNEL,\n argv[3],\n IRC_COLOR_CHAT_DELIMITERS,\n irc_nick_color_for_msg (server, 1, NULL, argv[7]),\n argv[7],\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_CHAT_HOST,\n argv[4],\n argv[5],\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_RESET,\n (pos_attr) ? pos_attr : \"\",\n (pos_attr) ? \" \" : \"\",\n (pos_hopcount) ? pos_hopcount : \"\",\n (pos_hopcount) ? \" \" : \"\",\n (pos_realname) ? pos_realname : \"\");\n }\n\n return WEECHAT_RC_OK;\n}","target":"IRC_PROTOCOL_CALLBACK(352)\n{\n char *pos_attr, *pos_hopcount, *pos_realname, *str_host;\n int arg_start, length;\n struct t_irc_channel *ptr_channel;\n struct t_irc_nick *ptr_nick;\n\n IRC_PROTOCOL_MIN_ARGS(5);\n\n /* silently ignore malformed 352 message (missing infos) */\n if (argc < 8)\n return WEECHAT_RC_OK;\n\n pos_attr = NULL;\n pos_hopcount = NULL;\n pos_realname = NULL;\n\n if (argc > 8)\n {\n arg_start = ((argc > 9) && (strcmp (argv[8], \"*\") == 0)) ? 9 : 8;\n if (argv[arg_start][0] == ':')\n {\n pos_attr = NULL;\n pos_hopcount = (argc > arg_start) ? argv[arg_start] + 1 : NULL;\n pos_realname = (argc > arg_start + 1) ? argv_eol[arg_start + 1] : NULL;\n }\n else\n {\n pos_attr = argv[arg_start];\n pos_hopcount = (argc > arg_start + 1) ? argv[arg_start + 1] + 1 : NULL;\n pos_realname = (argc > arg_start + 2) ? argv_eol[arg_start + 2] : NULL;\n }\n }\n\n ptr_channel = irc_channel_search (server, argv[3]);\n ptr_nick = (ptr_channel) ?\n irc_nick_search (server, ptr_channel, argv[7]) : NULL;\n\n /* update host in nick */\n if (ptr_nick)\n {\n length = strlen (argv[4]) + 1 + strlen (argv[5]) + 1;\n str_host = malloc (length);\n if (str_host)\n {\n snprintf (str_host, length, \"%s@%s\", argv[4], argv[5]);\n irc_nick_set_host (ptr_nick, str_host);\n free (str_host);\n }\n }\n\n /* update away flag in nick */\n if (ptr_channel && ptr_nick && pos_attr)\n {\n irc_nick_set_away (server, ptr_channel, ptr_nick,\n (pos_attr[0] == 'G') ? 1 : 0);\n }\n\n /* update realname in nick */\n if (ptr_channel && ptr_nick && pos_realname)\n {\n if (ptr_nick->realname)\n free (ptr_nick->realname);\n if (pos_realname &&\n weechat_hashtable_has_key (server->cap_list, \"extended-join\"))\n {\n ptr_nick->realname = strdup (pos_realname);\n }\n else\n {\n ptr_nick->realname = NULL;\n }\n }\n\n /* display output of who (manual who from user) */\n if (!ptr_channel || (ptr_channel->checking_whox <= 0))\n {\n weechat_printf_date_tags (\n irc_msgbuffer_get_target_buffer (\n server, NULL, command, \"who\", NULL),\n date,\n irc_protocol_tags (command, \"irc_numeric\", NULL, NULL),\n \"%s%s[%s%s%s] %s%s %s(%s%s@%s%s)%s %s%s%s%s(%s)\",\n weechat_prefix (\"network\"),\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_CHAT_CHANNEL,\n argv[3],\n IRC_COLOR_CHAT_DELIMITERS,\n irc_nick_color_for_msg (server, 1, NULL, argv[7]),\n argv[7],\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_CHAT_HOST,\n argv[4],\n argv[5],\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_RESET,\n (pos_attr) ? pos_attr : \"\",\n (pos_attr) ? \" \" : \"\",\n (pos_hopcount) ? pos_hopcount : \"\",\n (pos_hopcount) ? \" \" : \"\",\n (pos_realname) ? pos_realname : \"\");\n }\n\n return WEECHAT_RC_OK;\n}","lang":"c","vul_type":"cwe-476","target_token_count":866,"sven_meta":{"func_name":"IRC_PROTOCOL_CALLBACK","file_name":"src/plugins/irc/irc-protocol.c","commit_link":"github.com/weechat/weechat/commit/9904cb6d2eb40f679d8ff6557c22d53a3e3dc75a","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#32-34050c5ba3ac","input":"xfs_attr_shortform_to_leaf(\n\tstruct xfs_da_args\t*args,\n\tstruct xfs_buf\t\t**leaf_bp)\n{\n\txfs_inode_t *dp;\n\txfs_attr_shortform_t *sf;\n\txfs_attr_sf_entry_t *sfe;\n\txfs_da_args_t nargs;\n\tchar *tmpbuffer;\n\tint error, i, size;\n\txfs_dablk_t blkno;\n\tstruct xfs_buf *bp;\n\txfs_ifork_t *ifp;\n\n\ttrace_xfs_attr_sf_to_leaf(args);\n\n\tdp = args->dp;\n\tifp = dp->i_afp;\n\tsf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;\n\tsize = be16_to_cpu(sf->hdr.totsize);\n\ttmpbuffer = kmem_alloc(size, KM_SLEEP);\n\tASSERT(tmpbuffer != NULL);\n\tmemcpy(tmpbuffer, ifp->if_u1.if_data, size);\n\tsf = (xfs_attr_shortform_t *)tmpbuffer;\n\n\txfs_idata_realloc(dp, -size, XFS_ATTR_FORK);\n\txfs_bmap_local_to_extents_empty(dp, XFS_ATTR_FORK);\n\n\tbp = NULL;\n\terror = xfs_da_grow_inode(args, &blkno);\n\tif (error) {\n\t\t/*\n\t\t * If we hit an IO error middle of the transaction inside\n\t\t * grow_inode(), we may have inconsistent data. Bail out.\n\t\t */\n\t\tif (error == -EIO)\n\t\t\tgoto out;\n\t\txfs_idata_realloc(dp, size, XFS_ATTR_FORK);\t/* try to put */\n\t\tmemcpy(ifp->if_u1.if_data, tmpbuffer, size);\t/* it back */\n\t\tgoto out;\n\t}\n\n\tASSERT(blkno == 0);\n\terror = xfs_attr3_leaf_create(args, blkno, &bp);\n\tif (error) {\n\t\terror = xfs_da_shrink_inode(args, 0, bp);\n\t\tbp = NULL;\n\t\tif (error)\n\t\t\tgoto out;\n\t\txfs_idata_realloc(dp, size, XFS_ATTR_FORK);\t/* try to put */\n\t\tmemcpy(ifp->if_u1.if_data, tmpbuffer, size);\t/* it back */\n\t\tgoto out;\n\t}\n\n\tmemset((char *)&nargs, 0, sizeof(nargs));\n\tnargs.dp = dp;\n\tnargs.geo = args->geo;\n\tnargs.firstblock = args->firstblock;\n\tnargs.dfops = args->dfops;\n\tnargs.total = args->total;\n\tnargs.whichfork = XFS_ATTR_FORK;\n\tnargs.trans = args->trans;\n\tnargs.op_flags = XFS_DA_OP_OKNOENT;\n\n\tsfe = &sf->list[0];\n\tfor (i = 0; i < sf->hdr.count; i++) {\n\t\tnargs.name = sfe->nameval;\n\t\tnargs.namelen = sfe->namelen;\n\t\tnargs.value = &sfe->nameval[nargs.namelen];\n\t\tnargs.valuelen = sfe->valuelen;\n\t\tnargs.hashval = xfs_da_hashname(sfe->nameval,\n\t\t\t\t\t\tsfe->namelen);\n\t\tnargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);\n\t\terror = xfs_attr3_leaf_lookup_int(bp, &nargs); /* set a->index */\n\t\tASSERT(error == -ENOATTR);\n\t\terror = xfs_attr3_leaf_add(bp, &nargs);\n\t\tASSERT(error != -ENOSPC);\n\t\tif (error)\n\t\t\tgoto out;\n\t\tsfe = XFS_ATTR_SF_NEXTENTRY(sfe);\n\t}\n\terror = 0;\n\t*leaf_bp = bp;\nout:\n\tkmem_free(tmpbuffer);\n\treturn error;\n}","target":"xfs_attr_shortform_to_leaf(\n\tstruct xfs_da_args\t*args,\n\tstruct xfs_buf\t\t**leaf_bp)\n{\n\txfs_inode_t *dp;\n\txfs_attr_shortform_t *sf;\n\txfs_attr_sf_entry_t *sfe;\n\txfs_da_args_t nargs;\n\tchar *tmpbuffer;\n\tint error, i, size;\n\txfs_dablk_t blkno;\n\tstruct xfs_buf *bp;\n\txfs_ifork_t *ifp;\n\n\ttrace_xfs_attr_sf_to_leaf(args);\n\n\tdp = args->dp;\n\tifp = dp->i_afp;\n\tsf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;\n\tsize = be16_to_cpu(sf->hdr.totsize);\n\ttmpbuffer = kmem_alloc(size, KM_SLEEP);\n\tASSERT(tmpbuffer != NULL);\n\tmemcpy(tmpbuffer, ifp->if_u1.if_data, size);\n\tsf = (xfs_attr_shortform_t *)tmpbuffer;\n\n\txfs_idata_realloc(dp, -size, XFS_ATTR_FORK);\n\txfs_bmap_local_to_extents_empty(dp, XFS_ATTR_FORK);\n\n\tbp = NULL;\n\terror = xfs_da_grow_inode(args, &blkno);\n\tif (error) {\n\t\t/*\n\t\t * If we hit an IO error middle of the transaction inside\n\t\t * grow_inode(), we may have inconsistent data. Bail out.\n\t\t */\n\t\tif (error == -EIO)\n\t\t\tgoto out;\n\t\txfs_idata_realloc(dp, size, XFS_ATTR_FORK);\t/* try to put */\n\t\tmemcpy(ifp->if_u1.if_data, tmpbuffer, size);\t/* it back */\n\t\tgoto out;\n\t}\n\n\tASSERT(blkno == 0);\n\terror = xfs_attr3_leaf_create(args, blkno, &bp);\n\tif (error) {\n\t\t/* xfs_attr3_leaf_create may not have instantiated a block */\n\t\tif (bp && (xfs_da_shrink_inode(args, 0, bp) != 0))\n\t\t\tgoto out;\n\t\txfs_idata_realloc(dp, size, XFS_ATTR_FORK);\t/* try to put */\n\t\tmemcpy(ifp->if_u1.if_data, tmpbuffer, size);\t/* it back */\n\t\tgoto out;\n\t}\n\n\tmemset((char *)&nargs, 0, sizeof(nargs));\n\tnargs.dp = dp;\n\tnargs.geo = args->geo;\n\tnargs.firstblock = args->firstblock;\n\tnargs.dfops = args->dfops;\n\tnargs.total = args->total;\n\tnargs.whichfork = XFS_ATTR_FORK;\n\tnargs.trans = args->trans;\n\tnargs.op_flags = XFS_DA_OP_OKNOENT;\n\n\tsfe = &sf->list[0];\n\tfor (i = 0; i < sf->hdr.count; i++) {\n\t\tnargs.name = sfe->nameval;\n\t\tnargs.namelen = sfe->namelen;\n\t\tnargs.value = &sfe->nameval[nargs.namelen];\n\t\tnargs.valuelen = sfe->valuelen;\n\t\tnargs.hashval = xfs_da_hashname(sfe->nameval,\n\t\t\t\t\t\tsfe->namelen);\n\t\tnargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);\n\t\terror = xfs_attr3_leaf_lookup_int(bp, &nargs); /* set a->index */\n\t\tASSERT(error == -ENOATTR);\n\t\terror = xfs_attr3_leaf_add(bp, &nargs);\n\t\tASSERT(error != -ENOSPC);\n\t\tif (error)\n\t\t\tgoto out;\n\t\tsfe = XFS_ATTR_SF_NEXTENTRY(sfe);\n\t}\n\terror = 0;\n\t*leaf_bp = bp;\nout:\n\tkmem_free(tmpbuffer);\n\treturn error;\n}","lang":"c","vul_type":"cwe-476","target_token_count":792,"sven_meta":{"func_name":"xfs_attr_shortform_to_leaf","file_name":"fs/xfs/libxfs/xfs_attr_leaf.c","commit_link":"github.com/torvalds/linux/commit/bb3d48dcf86a97dc25fe9fc2c11938e19cb4399a","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#35-592789b9161c","input":"static int dnxhd_find_frame_end(DNXHDParserContext *dctx,\n const uint8_t *buf, int buf_size)\n{\n ParseContext *pc = &dctx->pc;\n uint64_t state = pc->state64;\n int pic_found = pc->frame_start_found;\n int i = 0;\n\n if (!pic_found) {\n for (i = 0; i < buf_size; i++) {\n state = (state << 8) | buf[i];\n if (ff_dnxhd_check_header_prefix(state & 0xffffffffff00LL) != 0) {\n i++;\n pic_found = 1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n break;\n }\n }\n }\n\n if (pic_found && !dctx->remaining) {\n if (!buf_size) /* EOF considered as end of frame */\n return 0;\n for (; i < buf_size; i++) {\n dctx->cur_byte++;\n state = (state << 8) | buf[i];\n\n if (dctx->cur_byte == 24) {\n dctx->h = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 26) {\n dctx->w = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 42) {\n int cid = (state >> 32) & 0xFFFFFFFF;\n\n if (cid <= 0)\n continue;\n\n dctx->remaining = avpriv_dnxhd_get_frame_size(cid);\n if (dctx->remaining <= 0) {\n dctx->remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);\n if (dctx->remaining <= 0)\n return dctx->remaining;\n }\n if (buf_size - i + 47 >= dctx->remaining) {\n int remaining = dctx->remaining;\n\n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n } else {\n dctx->remaining -= buf_size;\n }\n }\n }\n } else if (pic_found) {\n if (dctx->remaining > buf_size) {\n dctx->remaining -= buf_size;\n } else {\n int remaining = dctx->remaining;\n\n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n }\n }\n pc->frame_start_found = pic_found;\n pc->state64 = state;\n return END_NOT_FOUND;\n}","target":"static int dnxhd_find_frame_end(DNXHDParserContext *dctx,\n const uint8_t *buf, int buf_size)\n{\n ParseContext *pc = &dctx->pc;\n uint64_t state = pc->state64;\n int pic_found = pc->frame_start_found;\n int i = 0;\n\n if (!pic_found) {\n for (i = 0; i < buf_size; i++) {\n state = (state << 8) | buf[i];\n if (ff_dnxhd_check_header_prefix(state & 0xffffffffff00LL) != 0) {\n i++;\n pic_found = 1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n break;\n }\n }\n }\n\n if (pic_found && !dctx->remaining) {\n if (!buf_size) /* EOF considered as end of frame */\n return 0;\n for (; i < buf_size; i++) {\n dctx->cur_byte++;\n state = (state << 8) | buf[i];\n\n if (dctx->cur_byte == 24) {\n dctx->h = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 26) {\n dctx->w = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 42) {\n int cid = (state >> 32) & 0xFFFFFFFF;\n int remaining;\n\n if (cid <= 0)\n continue;\n\n remaining = avpriv_dnxhd_get_frame_size(cid);\n if (remaining <= 0) {\n remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);\n if (remaining <= 0)\n continue;\n }\n dctx->remaining = remaining;\n if (buf_size - i + 47 >= dctx->remaining) {\n int remaining = dctx->remaining;\n\n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n } else {\n dctx->remaining -= buf_size;\n }\n }\n }\n } else if (pic_found) {\n if (dctx->remaining > buf_size) {\n dctx->remaining -= buf_size;\n } else {\n int remaining = dctx->remaining;\n\n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n }\n }\n pc->frame_start_found = pic_found;\n pc->state64 = state;\n return END_NOT_FOUND;\n}","lang":"c","vul_type":"cwe-476","target_token_count":618,"sven_meta":{"func_name":"dnxhd_find_frame_end","file_name":"libavcodec/dnxhd_parser.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/0a709e2a10b8288a0cc383547924ecfe285cef89","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#36-a1968fc7633e","input":"static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,\n\t\t\t\tu64 *cookie_ret, struct rds_mr **mr_ret)\n{\n\tstruct rds_mr *mr = NULL, *found;\n\tunsigned int nr_pages;\n\tstruct page **pages = NULL;\n\tstruct scatterlist *sg;\n\tvoid *trans_private;\n\tunsigned long flags;\n\trds_rdma_cookie_t cookie;\n\tunsigned int nents;\n\tlong i;\n\tint ret;\n\n\tif (rs->rs_bound_addr == 0) {\n\t\tret = -ENOTCONN; /* XXX not a great errno */\n\t\tgoto out;\n\t}\n\n\tif (!rs->rs_transport->get_mr) {\n\t\tret = -EOPNOTSUPP;\n\t\tgoto out;\n\t}\n\n\tnr_pages = rds_pages_in_vec(&args->vec);\n\tif (nr_pages == 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\t/* Restrict the size of mr irrespective of underlying transport\n\t * To account for unaligned mr regions, subtract one from nr_pages\n\t */\n\tif ((nr_pages - 1) > (RDS_MAX_MSG_SIZE >> PAGE_SHIFT)) {\n\t\tret = -EMSGSIZE;\n\t\tgoto out;\n\t}\n\n\trdsdebug(\"RDS: get_mr addr %llx len %llu nr_pages %u\\n\",\n\t\targs->vec.addr, args->vec.bytes, nr_pages);\n\n\t/* XXX clamp nr_pages to limit the size of this alloc? */\n\tpages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);\n\tif (!pages) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\n\tmr = kzalloc(sizeof(struct rds_mr), GFP_KERNEL);\n\tif (!mr) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\n\trefcount_set(&mr->r_refcount, 1);\n\tRB_CLEAR_NODE(&mr->r_rb_node);\n\tmr->r_trans = rs->rs_transport;\n\tmr->r_sock = rs;\n\n\tif (args->flags & RDS_RDMA_USE_ONCE)\n\t\tmr->r_use_once = 1;\n\tif (args->flags & RDS_RDMA_INVALIDATE)\n\t\tmr->r_invalidate = 1;\n\tif (args->flags & RDS_RDMA_READWRITE)\n\t\tmr->r_write = 1;\n\n\t/*\n\t * Pin the pages that make up the user buffer and transfer the page\n\t * pointers to the mr's sg array. We check to see if we've mapped\n\t * the whole region after transferring the partial page references\n\t * to the sg array so that we can have one page ref cleanup path.\n\t *\n\t * For now we have no flag that tells us whether the mapping is\n\t * r/o or r/w. We need to assume r/w, or we'll do a lot of RDMA to\n\t * the zero page.\n\t */\n\tret = rds_pin_pages(args->vec.addr, nr_pages, pages, 1);\n\tif (ret < 0)\n\t\tgoto out;\n\n\tnents = ret;\n\tsg = kcalloc(nents, sizeof(*sg), GFP_KERNEL);\n\tif (!sg) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\tWARN_ON(!nents);\n\tsg_init_table(sg, nents);\n\n\t/* Stick all pages into the scatterlist */\n\tfor (i = 0 ; i < nents; i++)\n\t\tsg_set_page(&sg[i], pages[i], PAGE_SIZE, 0);\n\n\trdsdebug(\"RDS: trans_private nents is %u\\n\", nents);\n\n\t/* Obtain a transport specific MR. If this succeeds, the\n\t * s/g list is now owned by the MR.\n\t * Note that dma_map() implies that pending writes are\n\t * flushed to RAM, so no dma_sync is needed here. */\n\ttrans_private = rs->rs_transport->get_mr(sg, nents, rs,\n\t\t\t\t\t\t &mr->r_key);\n\n\tif (IS_ERR(trans_private)) {\n\t\tfor (i = 0 ; i < nents; i++)\n\t\t\tput_page(sg_page(&sg[i]));\n\t\tkfree(sg);\n\t\tret = PTR_ERR(trans_private);\n\t\tgoto out;\n\t}\n\n\tmr->r_trans_private = trans_private;\n\n\trdsdebug(\"RDS: get_mr put_user key is %x cookie_addr %p\\n\",\n\t mr->r_key, (void *)(unsigned long) args->cookie_addr);\n\n\t/* The user may pass us an unaligned address, but we can only\n\t * map page aligned regions. So we keep the offset, and build\n\t * a 64bit cookie containing and pass that\n\t * around. */\n\tcookie = rds_rdma_make_cookie(mr->r_key, args->vec.addr & ~PAGE_MASK);\n\tif (cookie_ret)\n\t\t*cookie_ret = cookie;\n\n\tif (args->cookie_addr && put_user(cookie, (u64 __user *)(unsigned long) args->cookie_addr)) {\n\t\tret = -EFAULT;\n\t\tgoto out;\n\t}\n\n\t/* Inserting the new MR into the rbtree bumps its\n\t * reference count. */\n\tspin_lock_irqsave(&rs->rs_rdma_lock, flags);\n\tfound = rds_mr_tree_walk(&rs->rs_rdma_keys, mr->r_key, mr);\n\tspin_unlock_irqrestore(&rs->rs_rdma_lock, flags);\n\n\tBUG_ON(found && found != mr);\n\n\trdsdebug(\"RDS: get_mr key is %x\\n\", mr->r_key);\n\tif (mr_ret) {\n\t\trefcount_inc(&mr->r_refcount);\n\t\t*mr_ret = mr;\n\t}\n\n\tret = 0;\nout:\n\tkfree(pages);\n\tif (mr)\n\t\trds_mr_put(mr);\n\treturn ret;\n}","target":"static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,\n\t\t\t\tu64 *cookie_ret, struct rds_mr **mr_ret)\n{\n\tstruct rds_mr *mr = NULL, *found;\n\tunsigned int nr_pages;\n\tstruct page **pages = NULL;\n\tstruct scatterlist *sg;\n\tvoid *trans_private;\n\tunsigned long flags;\n\trds_rdma_cookie_t cookie;\n\tunsigned int nents;\n\tlong i;\n\tint ret;\n\n\tif (rs->rs_bound_addr == 0 || !rs->rs_transport) {\n\t\tret = -ENOTCONN; /* XXX not a great errno */\n\t\tgoto out;\n\t}\n\n\tif (!rs->rs_transport->get_mr) {\n\t\tret = -EOPNOTSUPP;\n\t\tgoto out;\n\t}\n\n\tnr_pages = rds_pages_in_vec(&args->vec);\n\tif (nr_pages == 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\t/* Restrict the size of mr irrespective of underlying transport\n\t * To account for unaligned mr regions, subtract one from nr_pages\n\t */\n\tif ((nr_pages - 1) > (RDS_MAX_MSG_SIZE >> PAGE_SHIFT)) {\n\t\tret = -EMSGSIZE;\n\t\tgoto out;\n\t}\n\n\trdsdebug(\"RDS: get_mr addr %llx len %llu nr_pages %u\\n\",\n\t\targs->vec.addr, args->vec.bytes, nr_pages);\n\n\t/* XXX clamp nr_pages to limit the size of this alloc? */\n\tpages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);\n\tif (!pages) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\n\tmr = kzalloc(sizeof(struct rds_mr), GFP_KERNEL);\n\tif (!mr) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\n\trefcount_set(&mr->r_refcount, 1);\n\tRB_CLEAR_NODE(&mr->r_rb_node);\n\tmr->r_trans = rs->rs_transport;\n\tmr->r_sock = rs;\n\n\tif (args->flags & RDS_RDMA_USE_ONCE)\n\t\tmr->r_use_once = 1;\n\tif (args->flags & RDS_RDMA_INVALIDATE)\n\t\tmr->r_invalidate = 1;\n\tif (args->flags & RDS_RDMA_READWRITE)\n\t\tmr->r_write = 1;\n\n\t/*\n\t * Pin the pages that make up the user buffer and transfer the page\n\t * pointers to the mr's sg array. We check to see if we've mapped\n\t * the whole region after transferring the partial page references\n\t * to the sg array so that we can have one page ref cleanup path.\n\t *\n\t * For now we have no flag that tells us whether the mapping is\n\t * r/o or r/w. We need to assume r/w, or we'll do a lot of RDMA to\n\t * the zero page.\n\t */\n\tret = rds_pin_pages(args->vec.addr, nr_pages, pages, 1);\n\tif (ret < 0)\n\t\tgoto out;\n\n\tnents = ret;\n\tsg = kcalloc(nents, sizeof(*sg), GFP_KERNEL);\n\tif (!sg) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\tWARN_ON(!nents);\n\tsg_init_table(sg, nents);\n\n\t/* Stick all pages into the scatterlist */\n\tfor (i = 0 ; i < nents; i++)\n\t\tsg_set_page(&sg[i], pages[i], PAGE_SIZE, 0);\n\n\trdsdebug(\"RDS: trans_private nents is %u\\n\", nents);\n\n\t/* Obtain a transport specific MR. If this succeeds, the\n\t * s/g list is now owned by the MR.\n\t * Note that dma_map() implies that pending writes are\n\t * flushed to RAM, so no dma_sync is needed here. */\n\ttrans_private = rs->rs_transport->get_mr(sg, nents, rs,\n\t\t\t\t\t\t &mr->r_key);\n\n\tif (IS_ERR(trans_private)) {\n\t\tfor (i = 0 ; i < nents; i++)\n\t\t\tput_page(sg_page(&sg[i]));\n\t\tkfree(sg);\n\t\tret = PTR_ERR(trans_private);\n\t\tgoto out;\n\t}\n\n\tmr->r_trans_private = trans_private;\n\n\trdsdebug(\"RDS: get_mr put_user key is %x cookie_addr %p\\n\",\n\t mr->r_key, (void *)(unsigned long) args->cookie_addr);\n\n\t/* The user may pass us an unaligned address, but we can only\n\t * map page aligned regions. So we keep the offset, and build\n\t * a 64bit cookie containing and pass that\n\t * around. */\n\tcookie = rds_rdma_make_cookie(mr->r_key, args->vec.addr & ~PAGE_MASK);\n\tif (cookie_ret)\n\t\t*cookie_ret = cookie;\n\n\tif (args->cookie_addr && put_user(cookie, (u64 __user *)(unsigned long) args->cookie_addr)) {\n\t\tret = -EFAULT;\n\t\tgoto out;\n\t}\n\n\t/* Inserting the new MR into the rbtree bumps its\n\t * reference count. */\n\tspin_lock_irqsave(&rs->rs_rdma_lock, flags);\n\tfound = rds_mr_tree_walk(&rs->rs_rdma_keys, mr->r_key, mr);\n\tspin_unlock_irqrestore(&rs->rs_rdma_lock, flags);\n\n\tBUG_ON(found && found != mr);\n\n\trdsdebug(\"RDS: get_mr key is %x\\n\", mr->r_key);\n\tif (mr_ret) {\n\t\trefcount_inc(&mr->r_refcount);\n\t\t*mr_ret = mr;\n\t}\n\n\tret = 0;\nout:\n\tkfree(pages);\n\tif (mr)\n\t\trds_mr_put(mr);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-476","target_token_count":1221,"sven_meta":{"func_name":"__rds_rdma_map","file_name":"net/rds/rdma.c","commit_link":"github.com/torvalds/linux/commit/f3069c6d33f6ae63a1668737bc78aaaa51bff7ca","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#37-7763538b1dae","input":"daemon_AuthUserPwd(char *username, char *password, char *errbuf)\n{\n#ifdef _WIN32\n\t/*\n\t * Warning: the user which launches the process must have the\n\t * SE_TCB_NAME right.\n\t * This corresponds to have the \"Act as part of the Operating System\"\n\t * turned on (administrative tools, local security settings, local\n\t * policies, user right assignment)\n\t * However, it seems to me that if you run it as a service, this\n\t * right should be provided by default.\n\t *\n\t * XXX - hopefully, this returns errors such as ERROR_LOGON_FAILURE,\n\t * which merely indicates that the user name or password is\n\t * incorrect, not whether it's the user name or the password\n\t * that's incorrect, so a client that's trying to brute-force\n\t * accounts doesn't know whether it's the user name or the\n\t * password that's incorrect, so it doesn't know whether to\n\t * stop trying to log in with a given user name and move on\n\t * to another user name.\n\t */\n\tHANDLE Token;\n\tif (LogonUser(username, \".\", password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &Token) == 0)\n\t{\n\t\tpcap_fmt_errmsg_for_win32_err(errbuf, PCAP_ERRBUF_SIZE,\n\t\t GetLastError(), \"LogonUser() failed\");\n\t\treturn -1;\n\t}\n\n\t// This call should change the current thread to the selected user.\n\t// I didn't test it.\n\tif (ImpersonateLoggedOnUser(Token) == 0)\n\t{\n\t\tpcap_fmt_errmsg_for_win32_err(errbuf, PCAP_ERRBUF_SIZE,\n\t\t GetLastError(), \"ImpersonateLoggedOnUser() failed\");\n\t\tCloseHandle(Token);\n\t\treturn -1;\n\t}\n\n\tCloseHandle(Token);\n\treturn 0;\n\n#else\n\t/*\n\t * See\n\t *\n\t *\thttp://www.unixpapa.com/incnote/passwd.html\n\t *\n\t * We use the Solaris/Linux shadow password authentication if\n\t * we have getspnam(), otherwise we just do traditional\n\t * authentication, which, on some platforms, might work, even\n\t * with shadow passwords, if we're running as root. Traditional\n\t * authenticaion won't work if we're not running as root, as\n\t * I think these days all UN*Xes either won't return the password\n\t * at all with getpwnam() or will only do so if you're root.\n\t *\n\t * XXX - perhaps what we *should* be using is PAM, if we have\n\t * it. That might hide all the details of username/password\n\t * authentication, whether it's done with a visible-to-root-\n\t * only password database or some other authentication mechanism,\n\t * behind its API.\n\t */\n\tstruct passwd *user;\n\tchar *user_password;\n#ifdef HAVE_GETSPNAM\n\tstruct spwd *usersp;\n#endif\n\n\t// This call is needed to get the uid\n\tif ((user = getpwnam(username)) == NULL)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\n#ifdef HAVE_GETSPNAM\n\t// This call is needed to get the password; otherwise 'x' is returned\n\tif ((usersp = getspnam(username)) == NULL)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\tuser_password = usersp->sp_pwdp;\n#else\n\t/*\n\t * XXX - what about other platforms?\n\t * The unixpapa.com page claims this Just Works on *BSD if you're\n\t * running as root - it's from 2000, so it doesn't indicate whether\n\t * macOS (which didn't come out until 2001, under the name Mac OS\n\t * X) behaves like the *BSDs or not, and might also work on AIX.\n\t * HP-UX does something else.\n\t *\n\t * Again, hopefully PAM hides all that.\n\t */\n\tuser_password = user->pw_passwd;\n#endif\n\n\tif (strcmp(user_password, (char *) crypt(password, user_password)) != 0)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\n\tif (setuid(user->pw_uid))\n\t{\n\t\tpcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,\n\t\t errno, \"setuid\");\n\t\treturn -1;\n\t}\n\n/*\tif (setgid(user->pw_gid))\n\t{\n\t\tpcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,\n\t\t errno, \"setgid\");\n\t\treturn -1;\n\t}\n*/\n\treturn 0;\n\n#endif\n\n}","target":"daemon_AuthUserPwd(char *username, char *password, char *errbuf)\n{\n#ifdef _WIN32\n\t/*\n\t * Warning: the user which launches the process must have the\n\t * SE_TCB_NAME right.\n\t * This corresponds to have the \"Act as part of the Operating System\"\n\t * turned on (administrative tools, local security settings, local\n\t * policies, user right assignment)\n\t * However, it seems to me that if you run it as a service, this\n\t * right should be provided by default.\n\t *\n\t * XXX - hopefully, this returns errors such as ERROR_LOGON_FAILURE,\n\t * which merely indicates that the user name or password is\n\t * incorrect, not whether it's the user name or the password\n\t * that's incorrect, so a client that's trying to brute-force\n\t * accounts doesn't know whether it's the user name or the\n\t * password that's incorrect, so it doesn't know whether to\n\t * stop trying to log in with a given user name and move on\n\t * to another user name.\n\t */\n\tHANDLE Token;\n\tif (LogonUser(username, \".\", password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &Token) == 0)\n\t{\n\t\tpcap_fmt_errmsg_for_win32_err(errbuf, PCAP_ERRBUF_SIZE,\n\t\t GetLastError(), \"LogonUser() failed\");\n\t\treturn -1;\n\t}\n\n\t// This call should change the current thread to the selected user.\n\t// I didn't test it.\n\tif (ImpersonateLoggedOnUser(Token) == 0)\n\t{\n\t\tpcap_fmt_errmsg_for_win32_err(errbuf, PCAP_ERRBUF_SIZE,\n\t\t GetLastError(), \"ImpersonateLoggedOnUser() failed\");\n\t\tCloseHandle(Token);\n\t\treturn -1;\n\t}\n\n\tCloseHandle(Token);\n\treturn 0;\n\n#else\n\t/*\n\t * See\n\t *\n\t *\thttp://www.unixpapa.com/incnote/passwd.html\n\t *\n\t * We use the Solaris/Linux shadow password authentication if\n\t * we have getspnam(), otherwise we just do traditional\n\t * authentication, which, on some platforms, might work, even\n\t * with shadow passwords, if we're running as root. Traditional\n\t * authenticaion won't work if we're not running as root, as\n\t * I think these days all UN*Xes either won't return the password\n\t * at all with getpwnam() or will only do so if you're root.\n\t *\n\t * XXX - perhaps what we *should* be using is PAM, if we have\n\t * it. That might hide all the details of username/password\n\t * authentication, whether it's done with a visible-to-root-\n\t * only password database or some other authentication mechanism,\n\t * behind its API.\n\t */\n\tstruct passwd *user;\n\tchar *user_password;\n#ifdef HAVE_GETSPNAM\n\tstruct spwd *usersp;\n#endif\n\tchar *crypt_password;\n\n\t// This call is needed to get the uid\n\tif ((user = getpwnam(username)) == NULL)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\n#ifdef HAVE_GETSPNAM\n\t// This call is needed to get the password; otherwise 'x' is returned\n\tif ((usersp = getspnam(username)) == NULL)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\tuser_password = usersp->sp_pwdp;\n#else\n\t/*\n\t * XXX - what about other platforms?\n\t * The unixpapa.com page claims this Just Works on *BSD if you're\n\t * running as root - it's from 2000, so it doesn't indicate whether\n\t * macOS (which didn't come out until 2001, under the name Mac OS\n\t * X) behaves like the *BSDs or not, and might also work on AIX.\n\t * HP-UX does something else.\n\t *\n\t * Again, hopefully PAM hides all that.\n\t */\n\tuser_password = user->pw_passwd;\n#endif\n\n\tcrypt_password = crypt(password, user_password);\n\tif (crypt_password == NULL)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed\");\n\t\treturn -1;\n\t}\n\tif (strcmp(user_password, crypt_password) != 0)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\n\tif (setuid(user->pw_uid))\n\t{\n\t\tpcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,\n\t\t errno, \"setuid\");\n\t\treturn -1;\n\t}\n\n/*\tif (setgid(user->pw_gid))\n\t{\n\t\tpcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,\n\t\t errno, \"setgid\");\n\t\treturn -1;\n\t}\n*/\n\treturn 0;\n\n#endif\n\n}","lang":"c","vul_type":"cwe-476","target_token_count":1093,"sven_meta":{"func_name":"daemon_AuthUserPwd","file_name":"rpcapd/daemon.c","commit_link":"github.com/the-tcpdump-group/libpcap/commit/437b273761adedcbd880f714bfa44afeec186a31","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#38-b39525545d30","input":"static int run(const CommandLineOptions& options)\n{\n\tIR::Module irModule;\n\n\t// Load the module.\n\tif(!loadModule(options.filename, irModule)) { return EXIT_FAILURE; }\n\tif(options.onlyCheck) { return EXIT_SUCCESS; }\n\n\t// Compile the module.\n\tRuntime::Module* module = nullptr;\n\tif(!options.precompiled) { module = Runtime::compileModule(irModule); }\n\telse\n\t{\n\t\tconst UserSection* precompiledObjectSection = nullptr;\n\t\tfor(const UserSection& userSection : irModule.userSections)\n\t\t{\n\t\t\tif(userSection.name == \"wavm.precompiled_object\")\n\t\t\t{\n\t\t\t\tprecompiledObjectSection = &userSection;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(!precompiledObjectSection)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Input file did not contain 'wavm.precompiled_object' section\");\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmodule = Runtime::loadPrecompiledModule(irModule, precompiledObjectSection->data);\n\t\t}\n\t}\n\n\t// Link the module with the intrinsic modules.\n\tCompartment* compartment = Runtime::createCompartment();\n\tContext* context = Runtime::createContext(compartment);\n\tRootResolver rootResolver(compartment);\n\n\tEmscripten::Instance* emscriptenInstance = nullptr;\n\tif(options.enableEmscripten)\n\t{\n\t\temscriptenInstance = Emscripten::instantiate(compartment, irModule);\n\t\tif(emscriptenInstance)\n\t\t{\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"env\", emscriptenInstance->env);\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"asm2wasm\", emscriptenInstance->asm2wasm);\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"global\", emscriptenInstance->global);\n\t\t}\n\t}\n\n\tif(options.enableThreadTest)\n\t{\n\t\tModuleInstance* threadTestInstance = ThreadTest::instantiate(compartment);\n\t\trootResolver.moduleNameToInstanceMap.set(\"threadTest\", threadTestInstance);\n\t}\n\n\tLinkResult linkResult = linkModule(irModule, rootResolver);\n\tif(!linkResult.success)\n\t{\n\t\tLog::printf(Log::error, \"Failed to link module:\\n\");\n\t\tfor(auto& missingImport : linkResult.missingImports)\n\t\t{\n\t\t\tLog::printf(Log::error,\n\t\t\t\t\t\t\"Missing import: module=\\\"%s\\\" export=\\\"%s\\\" type=\\\"%s\\\"\\n\",\n\t\t\t\t\t\tmissingImport.moduleName.c_str(),\n\t\t\t\t\t\tmissingImport.exportName.c_str(),\n\t\t\t\t\t\tasString(missingImport.type).c_str());\n\t\t}\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t// Instantiate the module.\n\tModuleInstance* moduleInstance = instantiateModule(\n\t\tcompartment, module, std::move(linkResult.resolvedImports), options.filename);\n\tif(!moduleInstance) { return EXIT_FAILURE; }\n\n\t// Call the module start function, if it has one.\n\tFunctionInstance* startFunction = getStartFunction(moduleInstance);\n\tif(startFunction) { invokeFunctionChecked(context, startFunction, {}); }\n\n\tif(options.enableEmscripten)\n\t{\n\t\t// Call the Emscripten global initalizers.\n\t\tEmscripten::initializeGlobals(context, irModule, moduleInstance);\n\t}\n\n\t// Look up the function export to call.\n\tFunctionInstance* functionInstance;\n\tif(!options.functionName)\n\t{\n\t\tfunctionInstance = asFunctionNullable(getInstanceExport(moduleInstance, \"main\"));\n\t\tif(!functionInstance)\n\t\t{ functionInstance = asFunctionNullable(getInstanceExport(moduleInstance, \"_main\")); }\n\t\tif(!functionInstance)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Module does not export main function\\n\");\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfunctionInstance\n\t\t\t= asFunctionNullable(getInstanceExport(moduleInstance, options.functionName));\n\t\tif(!functionInstance)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Module does not export '%s'\\n\", options.functionName);\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\tFunctionType functionType = getFunctionType(functionInstance);\n\n\t// Set up the arguments for the invoke.\n\tstd::vector invokeArgs;\n\tif(!options.functionName)\n\t{\n\t\tif(functionType.params().size() == 2)\n\t\t{\n\t\t\tMemoryInstance* defaultMemory = Runtime::getDefaultMemory(moduleInstance);\n\t\t\tif(!defaultMemory)\n\t\t\t{\n\t\t\t\tLog::printf(\n\t\t\t\t\tLog::error,\n\t\t\t\t\t\"Module does not declare a default memory object to put arguments in.\\n\");\n\t\t\t\treturn EXIT_FAILURE;\n\t\t\t}\n\n\t\t\tstd::vector argStrings;\n\t\t\targStrings.push_back(options.filename);\n\t\t\tchar** args = options.args;\n\t\t\twhile(*args) { argStrings.push_back(*args++); };\n\n\t\t\tEmscripten::injectCommandArgs(emscriptenInstance, argStrings, invokeArgs);\n\t\t}\n\t\telse if(functionType.params().size() > 0)\n\t\t{\n\t\t\tLog::printf(Log::error,\n\t\t\t\t\t\t\"WebAssembly function requires %\" PRIu64\n\t\t\t\t\t\t\" argument(s), but only 0 or 2 can be passed!\",\n\t\t\t\t\t\tfunctionType.params().size());\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(U32 i = 0; options.args[i]; ++i)\n\t\t{\n\t\t\tValue value;\n\t\t\tswitch(functionType.params()[i])\n\t\t\t{\n\t\t\tcase ValueType::i32: value = (U32)atoi(options.args[i]); break;\n\t\t\tcase ValueType::i64: value = (U64)atol(options.args[i]); break;\n\t\t\tcase ValueType::f32: value = (F32)atof(options.args[i]); break;\n\t\t\tcase ValueType::f64: value = atof(options.args[i]); break;\n\t\t\tcase ValueType::v128:\n\t\t\tcase ValueType::anyref:\n\t\t\tcase ValueType::anyfunc:\n\t\t\t\tErrors::fatalf(\"Cannot parse command-line argument for %s function parameter\",\n\t\t\t\t\t\t\t asString(functionType.params()[i]));\n\t\t\tdefault: Errors::unreachable();\n\t\t\t}\n\t\t\tinvokeArgs.push_back(value);\n\t\t}\n\t}\n\n\t// Invoke the function.\n\tTiming::Timer executionTimer;\n\tIR::ValueTuple functionResults = invokeFunctionChecked(context, functionInstance, invokeArgs);\n\tTiming::logTimer(\"Invoked function\", executionTimer);\n\n\tif(options.functionName)\n\t{\n\t\tLog::printf(Log::debug,\n\t\t\t\t\t\"%s returned: %s\\n\",\n\t\t\t\t\toptions.functionName,\n\t\t\t\t\tasString(functionResults).c_str());\n\t\treturn EXIT_SUCCESS;\n\t}\n\telse if(functionResults.size() == 1 && functionResults[0].type == ValueType::i32)\n\t{\n\t\treturn functionResults[0].i32;\n\t}\n\telse\n\t{\n\t\treturn EXIT_SUCCESS;\n\t}\n}","target":"static int run(const CommandLineOptions& options)\n{\n\tIR::Module irModule;\n\n\t// Load the module.\n\tif(!loadModule(options.filename, irModule)) { return EXIT_FAILURE; }\n\tif(options.onlyCheck) { return EXIT_SUCCESS; }\n\n\t// Compile the module.\n\tRuntime::Module* module = nullptr;\n\tif(!options.precompiled) { module = Runtime::compileModule(irModule); }\n\telse\n\t{\n\t\tconst UserSection* precompiledObjectSection = nullptr;\n\t\tfor(const UserSection& userSection : irModule.userSections)\n\t\t{\n\t\t\tif(userSection.name == \"wavm.precompiled_object\")\n\t\t\t{\n\t\t\t\tprecompiledObjectSection = &userSection;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(!precompiledObjectSection)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Input file did not contain 'wavm.precompiled_object' section\");\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmodule = Runtime::loadPrecompiledModule(irModule, precompiledObjectSection->data);\n\t\t}\n\t}\n\n\t// Link the module with the intrinsic modules.\n\tCompartment* compartment = Runtime::createCompartment();\n\tContext* context = Runtime::createContext(compartment);\n\tRootResolver rootResolver(compartment);\n\n\tEmscripten::Instance* emscriptenInstance = nullptr;\n\tif(options.enableEmscripten)\n\t{\n\t\temscriptenInstance = Emscripten::instantiate(compartment, irModule);\n\t\tif(emscriptenInstance)\n\t\t{\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"env\", emscriptenInstance->env);\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"asm2wasm\", emscriptenInstance->asm2wasm);\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"global\", emscriptenInstance->global);\n\t\t}\n\t}\n\n\tif(options.enableThreadTest)\n\t{\n\t\tModuleInstance* threadTestInstance = ThreadTest::instantiate(compartment);\n\t\trootResolver.moduleNameToInstanceMap.set(\"threadTest\", threadTestInstance);\n\t}\n\n\tLinkResult linkResult = linkModule(irModule, rootResolver);\n\tif(!linkResult.success)\n\t{\n\t\tLog::printf(Log::error, \"Failed to link module:\\n\");\n\t\tfor(auto& missingImport : linkResult.missingImports)\n\t\t{\n\t\t\tLog::printf(Log::error,\n\t\t\t\t\t\t\"Missing import: module=\\\"%s\\\" export=\\\"%s\\\" type=\\\"%s\\\"\\n\",\n\t\t\t\t\t\tmissingImport.moduleName.c_str(),\n\t\t\t\t\t\tmissingImport.exportName.c_str(),\n\t\t\t\t\t\tasString(missingImport.type).c_str());\n\t\t}\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t// Instantiate the module.\n\tModuleInstance* moduleInstance = instantiateModule(\n\t\tcompartment, module, std::move(linkResult.resolvedImports), options.filename);\n\tif(!moduleInstance) { return EXIT_FAILURE; }\n\n\t// Call the module start function, if it has one.\n\tFunctionInstance* startFunction = getStartFunction(moduleInstance);\n\tif(startFunction) { invokeFunctionChecked(context, startFunction, {}); }\n\n\tif(options.enableEmscripten)\n\t{\n\t\t// Call the Emscripten global initalizers.\n\t\tEmscripten::initializeGlobals(context, irModule, moduleInstance);\n\t}\n\n\t// Look up the function export to call.\n\tFunctionInstance* functionInstance;\n\tif(!options.functionName)\n\t{\n\t\tfunctionInstance = asFunctionNullable(getInstanceExport(moduleInstance, \"main\"));\n\t\tif(!functionInstance)\n\t\t{ functionInstance = asFunctionNullable(getInstanceExport(moduleInstance, \"_main\")); }\n\t\tif(!functionInstance)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Module does not export main function\\n\");\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfunctionInstance\n\t\t\t= asFunctionNullable(getInstanceExport(moduleInstance, options.functionName));\n\t\tif(!functionInstance)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Module does not export '%s'\\n\", options.functionName);\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\tFunctionType functionType = getFunctionType(functionInstance);\n\n\t// Set up the arguments for the invoke.\n\tstd::vector invokeArgs;\n\tif(!options.functionName)\n\t{\n\t\tif(functionType.params().size() == 2)\n\t\t{\n\t\t\tif(!emscriptenInstance)\n\t\t\t{\n\t\t\t\tLog::printf(\n\t\t\t\t\tLog::error,\n\t\t\t\t\t\"Module does not declare a default memory object to put arguments in.\\n\");\n\t\t\t\treturn EXIT_FAILURE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tstd::vector argStrings;\n\t\t\t\targStrings.push_back(options.filename);\n\t\t\t\tchar** args = options.args;\n\t\t\t\twhile(*args) { argStrings.push_back(*args++); };\n\n\t\t\t\twavmAssert(emscriptenInstance);\n\t\t\t\tEmscripten::injectCommandArgs(emscriptenInstance, argStrings, invokeArgs);\n\t\t\t}\n\t\t}\n\t\telse if(functionType.params().size() > 0)\n\t\t{\n\t\t\tLog::printf(Log::error,\n\t\t\t\t\t\t\"WebAssembly function requires %\" PRIu64\n\t\t\t\t\t\t\" argument(s), but only 0 or 2 can be passed!\",\n\t\t\t\t\t\tfunctionType.params().size());\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(U32 i = 0; options.args[i]; ++i)\n\t\t{\n\t\t\tValue value;\n\t\t\tswitch(functionType.params()[i])\n\t\t\t{\n\t\t\tcase ValueType::i32: value = (U32)atoi(options.args[i]); break;\n\t\t\tcase ValueType::i64: value = (U64)atol(options.args[i]); break;\n\t\t\tcase ValueType::f32: value = (F32)atof(options.args[i]); break;\n\t\t\tcase ValueType::f64: value = atof(options.args[i]); break;\n\t\t\tcase ValueType::v128:\n\t\t\tcase ValueType::anyref:\n\t\t\tcase ValueType::anyfunc:\n\t\t\t\tErrors::fatalf(\"Cannot parse command-line argument for %s function parameter\",\n\t\t\t\t\t\t\t asString(functionType.params()[i]));\n\t\t\tdefault: Errors::unreachable();\n\t\t\t}\n\t\t\tinvokeArgs.push_back(value);\n\t\t}\n\t}\n\n\t// Invoke the function.\n\tTiming::Timer executionTimer;\n\tIR::ValueTuple functionResults = invokeFunctionChecked(context, functionInstance, invokeArgs);\n\tTiming::logTimer(\"Invoked function\", executionTimer);\n\n\tif(options.functionName)\n\t{\n\t\tLog::printf(Log::debug,\n\t\t\t\t\t\"%s returned: %s\\n\",\n\t\t\t\t\toptions.functionName,\n\t\t\t\t\tasString(functionResults).c_str());\n\t\treturn EXIT_SUCCESS;\n\t}\n\telse if(functionResults.size() == 1 && functionResults[0].type == ValueType::i32)\n\t{\n\t\treturn functionResults[0].i32;\n\t}\n\telse\n\t{\n\t\treturn EXIT_SUCCESS;\n\t}\n}","lang":"cpp","vul_type":"cwe-476","target_token_count":1435,"sven_meta":{"func_name":"run","file_name":"Programs/wavm/wavm.cpp","commit_link":"github.com/WAVM/WAVM/commit/31d670b6489e6d708c3b04b911cdf14ac43d846d","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#39-6c6490dda5c9","input":"open_ssl_connection (rfbClient *client, int sockfd, rfbBool anonTLS, rfbCredential *cred)\n{\n SSL_CTX *ssl_ctx = NULL;\n SSL *ssl = NULL;\n int n, finished = 0;\n X509_VERIFY_PARAM *param;\n uint8_t verify_crls = cred->x509Credential.x509CrlVerifyMode;\n\n if (!(ssl_ctx = SSL_CTX_new(SSLv23_client_method())))\n {\n rfbClientLog(\"Could not create new SSL context.\\n\");\n return NULL;\n }\n\n param = X509_VERIFY_PARAM_new();\n\n /* Setup verification if not anonymous */\n if (!anonTLS)\n {\n if (cred->x509Credential.x509CACertFile)\n {\n if (!SSL_CTX_load_verify_locations(ssl_ctx, cred->x509Credential.x509CACertFile, NULL))\n {\n rfbClientLog(\"Failed to load CA certificate from %s.\\n\",\n cred->x509Credential.x509CACertFile);\n goto error_free_ctx;\n }\n } else {\n rfbClientLog(\"Using default paths for certificate verification.\\n\");\n SSL_CTX_set_default_verify_paths (ssl_ctx);\n }\n\n if (cred->x509Credential.x509CACrlFile)\n {\n if (!load_crls_from_file(cred->x509Credential.x509CACrlFile, ssl_ctx))\n {\n rfbClientLog(\"CRLs could not be loaded.\\n\");\n goto error_free_ctx;\n }\n if (verify_crls == rfbX509CrlVerifyNone) verify_crls = rfbX509CrlVerifyAll;\n }\n\n if (cred->x509Credential.x509ClientCertFile && cred->x509Credential.x509ClientKeyFile)\n {\n if (SSL_CTX_use_certificate_chain_file(ssl_ctx, cred->x509Credential.x509ClientCertFile) != 1)\n {\n rfbClientLog(\"Client certificate could not be loaded.\\n\");\n goto error_free_ctx;\n }\n\n if (SSL_CTX_use_PrivateKey_file(ssl_ctx, cred->x509Credential.x509ClientKeyFile,\n SSL_FILETYPE_PEM) != 1)\n {\n rfbClientLog(\"Client private key could not be loaded.\\n\");\n goto error_free_ctx;\n }\n\n if (SSL_CTX_check_private_key(ssl_ctx) == 0) {\n rfbClientLog(\"Client certificate and private key do not match.\\n\");\n goto error_free_ctx;\n }\n }\n\n SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL);\n\n if (verify_crls == rfbX509CrlVerifyClient) \n X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);\n else if (verify_crls == rfbX509CrlVerifyAll)\n X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);\n\n if(!X509_VERIFY_PARAM_set1_host(param, client->serverHost, strlen(client->serverHost)))\n {\n rfbClientLog(\"Could not set server name for verification.\\n\");\n goto error_free_ctx;\n }\n SSL_CTX_set1_param(ssl_ctx, param);\n }\n\n if (!(ssl = SSL_new (ssl_ctx)))\n {\n rfbClientLog(\"Could not create a new SSL session.\\n\");\n goto error_free_ctx;\n }\n\n /* TODO: finetune this list, take into account anonTLS bool */\n SSL_set_cipher_list(ssl, \"ALL\");\n\n SSL_set_fd (ssl, sockfd);\n SSL_CTX_set_app_data (ssl_ctx, client);\n\n do\n {\n n = SSL_connect(ssl);\n\t\t\n if (n != 1) \n {\n if (wait_for_data(ssl, n, 1) != 1) \n {\n finished = 1;\n SSL_shutdown(ssl);\n\n goto error_free_ssl;\n }\n }\n } while( n != 1 && finished != 1 );\n\n X509_VERIFY_PARAM_free(param);\n return ssl;\n\nerror_free_ssl:\n SSL_free(ssl);\n\nerror_free_ctx:\n X509_VERIFY_PARAM_free(param);\n SSL_CTX_free(ssl_ctx);\n\n return NULL;\n}","target":"open_ssl_connection (rfbClient *client, int sockfd, rfbBool anonTLS, rfbCredential *cred)\n{\n SSL_CTX *ssl_ctx = NULL;\n SSL *ssl = NULL;\n int n, finished = 0;\n X509_VERIFY_PARAM *param;\n uint8_t verify_crls;\n\n if (!(ssl_ctx = SSL_CTX_new(SSLv23_client_method())))\n {\n rfbClientLog(\"Could not create new SSL context.\\n\");\n return NULL;\n }\n\n param = X509_VERIFY_PARAM_new();\n\n /* Setup verification if not anonymous */\n if (!anonTLS)\n {\n verify_crls = cred->x509Credential.x509CrlVerifyMode;\n if (cred->x509Credential.x509CACertFile)\n {\n if (!SSL_CTX_load_verify_locations(ssl_ctx, cred->x509Credential.x509CACertFile, NULL))\n {\n rfbClientLog(\"Failed to load CA certificate from %s.\\n\",\n cred->x509Credential.x509CACertFile);\n goto error_free_ctx;\n }\n } else {\n rfbClientLog(\"Using default paths for certificate verification.\\n\");\n SSL_CTX_set_default_verify_paths (ssl_ctx);\n }\n\n if (cred->x509Credential.x509CACrlFile)\n {\n if (!load_crls_from_file(cred->x509Credential.x509CACrlFile, ssl_ctx))\n {\n rfbClientLog(\"CRLs could not be loaded.\\n\");\n goto error_free_ctx;\n }\n if (verify_crls == rfbX509CrlVerifyNone) verify_crls = rfbX509CrlVerifyAll;\n }\n\n if (cred->x509Credential.x509ClientCertFile && cred->x509Credential.x509ClientKeyFile)\n {\n if (SSL_CTX_use_certificate_chain_file(ssl_ctx, cred->x509Credential.x509ClientCertFile) != 1)\n {\n rfbClientLog(\"Client certificate could not be loaded.\\n\");\n goto error_free_ctx;\n }\n\n if (SSL_CTX_use_PrivateKey_file(ssl_ctx, cred->x509Credential.x509ClientKeyFile,\n SSL_FILETYPE_PEM) != 1)\n {\n rfbClientLog(\"Client private key could not be loaded.\\n\");\n goto error_free_ctx;\n }\n\n if (SSL_CTX_check_private_key(ssl_ctx) == 0) {\n rfbClientLog(\"Client certificate and private key do not match.\\n\");\n goto error_free_ctx;\n }\n }\n\n SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL);\n\n if (verify_crls == rfbX509CrlVerifyClient) \n X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);\n else if (verify_crls == rfbX509CrlVerifyAll)\n X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);\n\n if(!X509_VERIFY_PARAM_set1_host(param, client->serverHost, strlen(client->serverHost)))\n {\n rfbClientLog(\"Could not set server name for verification.\\n\");\n goto error_free_ctx;\n }\n SSL_CTX_set1_param(ssl_ctx, param);\n }\n\n if (!(ssl = SSL_new (ssl_ctx)))\n {\n rfbClientLog(\"Could not create a new SSL session.\\n\");\n goto error_free_ctx;\n }\n\n /* TODO: finetune this list, take into account anonTLS bool */\n SSL_set_cipher_list(ssl, \"ALL\");\n\n SSL_set_fd (ssl, sockfd);\n SSL_CTX_set_app_data (ssl_ctx, client);\n\n do\n {\n n = SSL_connect(ssl);\n\t\t\n if (n != 1) \n {\n if (wait_for_data(ssl, n, 1) != 1) \n {\n finished = 1;\n SSL_shutdown(ssl);\n\n goto error_free_ssl;\n }\n }\n } while( n != 1 && finished != 1 );\n\n X509_VERIFY_PARAM_free(param);\n return ssl;\n\nerror_free_ssl:\n SSL_free(ssl);\n\nerror_free_ctx:\n X509_VERIFY_PARAM_free(param);\n SSL_CTX_free(ssl_ctx);\n\n return NULL;\n}","lang":"c","vul_type":"cwe-476","target_token_count":987,"sven_meta":{"func_name":"open_ssl_connection","file_name":"libvncclient/tls_openssl.c","commit_link":"github.com/LibVNC/libvncserver/commit/33441d90a506d5f3ae9388f2752901227e430553","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#41-7bd7128f30d2","input":"archive_acl_from_text_l(struct archive_acl *acl, const char *text,\n int want_type, struct archive_string_conv *sc)\n{\n\tstruct {\n\t\tconst char *start;\n\t\tconst char *end;\n\t} field[6], name;\n\n\tconst char *s, *st;\n\tint numfields, fields, n, r, sol, ret;\n\tint type, types, tag, permset, id;\n\tsize_t len;\n\tchar sep;\n\n\tswitch (want_type) {\n\tcase ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:\n\t\twant_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;\n\t\t__LA_FALLTHROUGH;\n\tcase ARCHIVE_ENTRY_ACL_TYPE_ACCESS:\n\tcase ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:\n\t\tnumfields = 5;\n\t\tbreak;\n\tcase ARCHIVE_ENTRY_ACL_TYPE_NFS4:\n\t\tnumfields = 6;\n\t\tbreak;\n\tdefault:\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\n\tret = ARCHIVE_OK;\n\ttypes = 0;\n\n\twhile (text != NULL && *text != '\\0') {\n\t\t/*\n\t\t * Parse the fields out of the next entry,\n\t\t * advance 'text' to start of next entry.\n\t\t */\n\t\tfields = 0;\n\t\tdo {\n\t\t\tconst char *start, *end;\n\t\t\tnext_field(&text, &start, &end, &sep);\n\t\t\tif (fields < numfields) {\n\t\t\t\tfield[fields].start = start;\n\t\t\t\tfield[fields].end = end;\n\t\t\t}\n\t\t\t++fields;\n\t\t} while (sep == ':');\n\n\t\t/* Set remaining fields to blank. */\n\t\tfor (n = fields; n < numfields; ++n)\n\t\t\tfield[n].start = field[n].end = NULL;\n\n\t\tif (field[0].start != NULL && *(field[0].start) == '#') {\n\t\t\t/* Comment, skip entry */\n\t\t\tcontinue;\n\t\t}\n\n\t\tn = 0;\n\t\tsol = 0;\n\t\tid = -1;\n\t\tpermset = 0;\n\t\tname.start = name.end = NULL;\n\n\t\tif (want_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) {\n\t\t\t/* POSIX.1e ACLs */\n\t\t\t/*\n\t\t\t * Default keyword \"default:user::rwx\"\n\t\t\t * if found, we have one more field\n\t\t\t *\n\t\t\t * We also support old Solaris extension:\n\t\t\t * \"defaultuser::rwx\" is the default ACL corresponding\n\t\t\t * to \"user::rwx\", etc. valid only for first field\n\t\t\t */\n\t\t\ts = field[0].start;\n\t\t\tlen = field[0].end - field[0].start;\n\t\t\tif (*s == 'd' && (len == 1 || (len >= 7\n\t\t\t && memcmp((s + 1), \"efault\", 6) == 0))) {\n\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;\n\t\t\t\tif (len > 7)\n\t\t\t\t\tfield[0].start += 7;\n\t\t\t\telse\n\t\t\t\t\tn = 1;\n\t\t\t} else\n\t\t\t\ttype = want_type;\n\n\t\t\t/* Check for a numeric ID in field n+1 or n+3. */\n\t\t\tisint(field[n + 1].start, field[n + 1].end, &id);\n\t\t\t/* Field n+3 is optional. */\n\t\t\tif (id == -1 && fields > (n + 3))\n\t\t\t\tisint(field[n + 3].start, field[n + 3].end,\n\t\t\t\t &id);\n\n\t\t\ttag = 0;\n\t\t\ts = field[n].start;\n\t\t\tst = field[n].start + 1;\n\t\t\tlen = field[n].end - field[n].start;\n\n\t\t\tswitch (*s) {\n\t\t\tcase 'u':\n\t\t\t\tif (len == 1 || (len == 4\n\t\t\t\t && memcmp(st, \"ser\", 3) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 'g':\n\t\t\t\tif (len == 1 || (len == 5\n\t\t\t\t && memcmp(st, \"roup\", 4) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 'o':\n\t\t\t\tif (len == 1 || (len == 5\n\t\t\t\t && memcmp(st, \"ther\", 4) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_OTHER;\n\t\t\t\tbreak;\n\t\t\tcase 'm':\n\t\t\t\tif (len == 1 || (len == 4\n\t\t\t\t && memcmp(st, \"ask\", 3) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_MASK;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (tag) {\n\t\t\tcase ARCHIVE_ENTRY_ACL_OTHER:\n\t\t\tcase ARCHIVE_ENTRY_ACL_MASK:\n\t\t\t\tif (fields == (n + 2)\n\t\t\t\t && field[n + 1].start < field[n + 1].end\n\t\t\t\t && ismode(field[n + 1].start,\n\t\t\t\t field[n + 1].end, &permset)) {\n\t\t\t\t\t/* This is Solaris-style \"other:rwx\" */\n\t\t\t\t\tsol = 1;\n\t\t\t\t} else if (fields == (n + 3) &&\n\t\t\t\t field[n + 1].start < field[n + 1].end) {\n\t\t\t\t\t/* Invalid mask or other field */\n\t\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ARCHIVE_ENTRY_ACL_USER_OBJ:\n\t\t\tcase ARCHIVE_ENTRY_ACL_GROUP_OBJ:\n\t\t\t\tif (id != -1 ||\n\t\t\t\t field[n + 1].start < field[n + 1].end) {\n\t\t\t\t\tname = field[n + 1];\n\t\t\t\t\tif (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)\n\t\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER;\n\t\t\t\t\telse\n\t\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t/* Invalid tag, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Without \"default:\" we expect mode in field 3\n\t\t\t * Exception: Solaris other and mask fields\n\t\t\t */\n\t\t\tif (permset == 0 && !ismode(field[n + 2 - sol].start,\n\t\t\t field[n + 2 - sol].end, &permset)) {\n\t\t\t\t/* Invalid mode, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t} else {\n\t\t\t/* NFS4 ACLs */\n\t\t\ts = field[0].start;\n\t\t\tlen = field[0].end - field[0].start;\n\t\t\ttag = 0;\n\n\t\t\tswitch (len) {\n\t\t\tcase 4:\n\t\t\t\tif (memcmp(s, \"user\", 4) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER;\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tif (memcmp(s, \"group\", 5) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP;\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tif (memcmp(s, \"owner@\", 6) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER_OBJ;\n\t\t\t\telse if (memcmp(s, \"group@\", 6) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 9:\n\t\t\t\tif (memcmp(s, \"everyone@\", 9) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_EVERYONE;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (tag == 0) {\n\t\t\t\t/* Invalid tag, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t} else if (tag == ARCHIVE_ENTRY_ACL_USER ||\n\t\t\t tag == ARCHIVE_ENTRY_ACL_GROUP) {\n\t\t\t\tn = 1;\n\t\t\t\tname = field[1];\n\t\t\t\tisint(name.start, name.end, &id);\n\t\t\t} else\n\t\t\t\tn = 0;\n\n\t\t\tif (!is_nfs4_perms(field[1 + n].start,\n\t\t\t field[1 + n].end, &permset)) {\n\t\t\t\t/* Invalid NFSv4 perms, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!is_nfs4_flags(field[2 + n].start,\n\t\t\t field[2 + n].end, &permset)) {\n\t\t\t\t/* Invalid NFSv4 flags, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ts = field[3 + n].start;\n\t\t\tlen = field[3 + n].end - field[3 + n].start;\n\t\t\ttype = 0;\n\t\t\tif (len == 4) {\n\t\t\t\tif (memcmp(s, \"deny\", 4) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_DENY;\n\t\t\t} else if (len == 5) {\n\t\t\t\tif (memcmp(s, \"allow\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;\n\t\t\t\telse if (memcmp(s, \"audit\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_AUDIT;\n\t\t\t\telse if (memcmp(s, \"alarm\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_ALARM;\n\t\t\t}\n\t\t\tif (type == 0) {\n\t\t\t\t/* Invalid entry type, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tisint(field[4 + n].start, field[4 + n].end,\n\t\t\t &id);\n\t\t}\n\n\t\t/* Add entry to the internal list. */\n\t\tr = archive_acl_add_entry_len_l(acl, type, permset,\n\t\t tag, id, name.start, name.end - name.start, sc);\n\t\tif (r < ARCHIVE_WARN)\n\t\t\treturn (r);\n\t\tif (r != ARCHIVE_OK)\n\t\t\tret = ARCHIVE_WARN;\n\t\ttypes |= type;\n\t}\n\n\t/* Reset ACL */\n\tarchive_acl_reset(acl, types);\n\n\treturn (ret);\n}","target":"archive_acl_from_text_l(struct archive_acl *acl, const char *text,\n int want_type, struct archive_string_conv *sc)\n{\n\tstruct {\n\t\tconst char *start;\n\t\tconst char *end;\n\t} field[6], name;\n\n\tconst char *s, *st;\n\tint numfields, fields, n, r, sol, ret;\n\tint type, types, tag, permset, id;\n\tsize_t len;\n\tchar sep;\n\n\tswitch (want_type) {\n\tcase ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:\n\t\twant_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;\n\t\t__LA_FALLTHROUGH;\n\tcase ARCHIVE_ENTRY_ACL_TYPE_ACCESS:\n\tcase ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:\n\t\tnumfields = 5;\n\t\tbreak;\n\tcase ARCHIVE_ENTRY_ACL_TYPE_NFS4:\n\t\tnumfields = 6;\n\t\tbreak;\n\tdefault:\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\n\tret = ARCHIVE_OK;\n\ttypes = 0;\n\n\twhile (text != NULL && *text != '\\0') {\n\t\t/*\n\t\t * Parse the fields out of the next entry,\n\t\t * advance 'text' to start of next entry.\n\t\t */\n\t\tfields = 0;\n\t\tdo {\n\t\t\tconst char *start, *end;\n\t\t\tnext_field(&text, &start, &end, &sep);\n\t\t\tif (fields < numfields) {\n\t\t\t\tfield[fields].start = start;\n\t\t\t\tfield[fields].end = end;\n\t\t\t}\n\t\t\t++fields;\n\t\t} while (sep == ':');\n\n\t\t/* Set remaining fields to blank. */\n\t\tfor (n = fields; n < numfields; ++n)\n\t\t\tfield[n].start = field[n].end = NULL;\n\n\t\tif (field[0].start != NULL && *(field[0].start) == '#') {\n\t\t\t/* Comment, skip entry */\n\t\t\tcontinue;\n\t\t}\n\n\t\tn = 0;\n\t\tsol = 0;\n\t\tid = -1;\n\t\tpermset = 0;\n\t\tname.start = name.end = NULL;\n\n\t\tif (want_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) {\n\t\t\t/* POSIX.1e ACLs */\n\t\t\t/*\n\t\t\t * Default keyword \"default:user::rwx\"\n\t\t\t * if found, we have one more field\n\t\t\t *\n\t\t\t * We also support old Solaris extension:\n\t\t\t * \"defaultuser::rwx\" is the default ACL corresponding\n\t\t\t * to \"user::rwx\", etc. valid only for first field\n\t\t\t */\n\t\t\ts = field[0].start;\n\t\t\tlen = field[0].end - field[0].start;\n\t\t\tif (*s == 'd' && (len == 1 || (len >= 7\n\t\t\t && memcmp((s + 1), \"efault\", 6) == 0))) {\n\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;\n\t\t\t\tif (len > 7)\n\t\t\t\t\tfield[0].start += 7;\n\t\t\t\telse\n\t\t\t\t\tn = 1;\n\t\t\t} else\n\t\t\t\ttype = want_type;\n\n\t\t\t/* Check for a numeric ID in field n+1 or n+3. */\n\t\t\tisint(field[n + 1].start, field[n + 1].end, &id);\n\t\t\t/* Field n+3 is optional. */\n\t\t\tif (id == -1 && fields > (n + 3))\n\t\t\t\tisint(field[n + 3].start, field[n + 3].end,\n\t\t\t\t &id);\n\n\t\t\ttag = 0;\n\t\t\ts = field[n].start;\n\t\t\tst = field[n].start + 1;\n\t\t\tlen = field[n].end - field[n].start;\n\n\t\t\tif (len == 0) {\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tswitch (*s) {\n\t\t\tcase 'u':\n\t\t\t\tif (len == 1 || (len == 4\n\t\t\t\t && memcmp(st, \"ser\", 3) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 'g':\n\t\t\t\tif (len == 1 || (len == 5\n\t\t\t\t && memcmp(st, \"roup\", 4) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 'o':\n\t\t\t\tif (len == 1 || (len == 5\n\t\t\t\t && memcmp(st, \"ther\", 4) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_OTHER;\n\t\t\t\tbreak;\n\t\t\tcase 'm':\n\t\t\t\tif (len == 1 || (len == 4\n\t\t\t\t && memcmp(st, \"ask\", 3) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_MASK;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (tag) {\n\t\t\tcase ARCHIVE_ENTRY_ACL_OTHER:\n\t\t\tcase ARCHIVE_ENTRY_ACL_MASK:\n\t\t\t\tif (fields == (n + 2)\n\t\t\t\t && field[n + 1].start < field[n + 1].end\n\t\t\t\t && ismode(field[n + 1].start,\n\t\t\t\t field[n + 1].end, &permset)) {\n\t\t\t\t\t/* This is Solaris-style \"other:rwx\" */\n\t\t\t\t\tsol = 1;\n\t\t\t\t} else if (fields == (n + 3) &&\n\t\t\t\t field[n + 1].start < field[n + 1].end) {\n\t\t\t\t\t/* Invalid mask or other field */\n\t\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ARCHIVE_ENTRY_ACL_USER_OBJ:\n\t\t\tcase ARCHIVE_ENTRY_ACL_GROUP_OBJ:\n\t\t\t\tif (id != -1 ||\n\t\t\t\t field[n + 1].start < field[n + 1].end) {\n\t\t\t\t\tname = field[n + 1];\n\t\t\t\t\tif (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)\n\t\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER;\n\t\t\t\t\telse\n\t\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t/* Invalid tag, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Without \"default:\" we expect mode in field 3\n\t\t\t * Exception: Solaris other and mask fields\n\t\t\t */\n\t\t\tif (permset == 0 && !ismode(field[n + 2 - sol].start,\n\t\t\t field[n + 2 - sol].end, &permset)) {\n\t\t\t\t/* Invalid mode, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t} else {\n\t\t\t/* NFS4 ACLs */\n\t\t\ts = field[0].start;\n\t\t\tlen = field[0].end - field[0].start;\n\t\t\ttag = 0;\n\n\t\t\tswitch (len) {\n\t\t\tcase 4:\n\t\t\t\tif (memcmp(s, \"user\", 4) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER;\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tif (memcmp(s, \"group\", 5) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP;\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tif (memcmp(s, \"owner@\", 6) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER_OBJ;\n\t\t\t\telse if (memcmp(s, \"group@\", 6) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 9:\n\t\t\t\tif (memcmp(s, \"everyone@\", 9) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_EVERYONE;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (tag == 0) {\n\t\t\t\t/* Invalid tag, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t} else if (tag == ARCHIVE_ENTRY_ACL_USER ||\n\t\t\t tag == ARCHIVE_ENTRY_ACL_GROUP) {\n\t\t\t\tn = 1;\n\t\t\t\tname = field[1];\n\t\t\t\tisint(name.start, name.end, &id);\n\t\t\t} else\n\t\t\t\tn = 0;\n\n\t\t\tif (!is_nfs4_perms(field[1 + n].start,\n\t\t\t field[1 + n].end, &permset)) {\n\t\t\t\t/* Invalid NFSv4 perms, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!is_nfs4_flags(field[2 + n].start,\n\t\t\t field[2 + n].end, &permset)) {\n\t\t\t\t/* Invalid NFSv4 flags, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ts = field[3 + n].start;\n\t\t\tlen = field[3 + n].end - field[3 + n].start;\n\t\t\ttype = 0;\n\t\t\tif (len == 4) {\n\t\t\t\tif (memcmp(s, \"deny\", 4) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_DENY;\n\t\t\t} else if (len == 5) {\n\t\t\t\tif (memcmp(s, \"allow\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;\n\t\t\t\telse if (memcmp(s, \"audit\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_AUDIT;\n\t\t\t\telse if (memcmp(s, \"alarm\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_ALARM;\n\t\t\t}\n\t\t\tif (type == 0) {\n\t\t\t\t/* Invalid entry type, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tisint(field[4 + n].start, field[4 + n].end,\n\t\t\t &id);\n\t\t}\n\n\t\t/* Add entry to the internal list. */\n\t\tr = archive_acl_add_entry_len_l(acl, type, permset,\n\t\t tag, id, name.start, name.end - name.start, sc);\n\t\tif (r < ARCHIVE_WARN)\n\t\t\treturn (r);\n\t\tif (r != ARCHIVE_OK)\n\t\t\tret = ARCHIVE_WARN;\n\t\ttypes |= type;\n\t}\n\n\t/* Reset ACL */\n\tarchive_acl_reset(acl, types);\n\n\treturn (ret);\n}","lang":"c","vul_type":"cwe-476","target_token_count":2094,"sven_meta":{"func_name":"archive_acl_from_text_l","file_name":"libarchive/archive_acl.c","commit_link":"github.com/libarchive/libarchive/commit/15bf44fd2c1ad0e3fd87048b3fcc90c4dcff1175","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#42-f3efd5653b21","input":"int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)\n{\n int ret = 0;\n int codec_init_ok = 0;\n AVDictionary *tmp = NULL;\n const AVPixFmtDescriptor *pixdesc;\n\n if (avcodec_is_open(avctx))\n return 0;\n\n if ((!codec && !avctx->codec)) {\n av_log(avctx, AV_LOG_ERROR, \"No codec provided to avcodec_open2()\\n\");\n return AVERROR(EINVAL);\n }\n if ((codec && avctx->codec && codec != avctx->codec)) {\n av_log(avctx, AV_LOG_ERROR, \"This AVCodecContext was allocated for %s, \"\n \"but %s passed to avcodec_open2()\\n\", avctx->codec->name, codec->name);\n return AVERROR(EINVAL);\n }\n if (!codec)\n codec = avctx->codec;\n\n if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)\n return AVERROR(EINVAL);\n\n if (options)\n av_dict_copy(&tmp, *options, 0);\n\n ff_lock_avcodec(avctx, codec);\n\n avctx->internal = av_mallocz(sizeof(*avctx->internal));\n if (!avctx->internal) {\n ret = AVERROR(ENOMEM);\n goto end;\n }\n\n avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool));\n if (!avctx->internal->pool) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->to_free = av_frame_alloc();\n if (!avctx->internal->to_free) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->compat_decode_frame = av_frame_alloc();\n if (!avctx->internal->compat_decode_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->buffer_frame = av_frame_alloc();\n if (!avctx->internal->buffer_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->buffer_pkt = av_packet_alloc();\n if (!avctx->internal->buffer_pkt) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->ds.in_pkt = av_packet_alloc();\n if (!avctx->internal->ds.in_pkt) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->last_pkt_props = av_packet_alloc();\n if (!avctx->internal->last_pkt_props) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->skip_samples_multiplier = 1;\n\n if (codec->priv_data_size > 0) {\n if (!avctx->priv_data) {\n avctx->priv_data = av_mallocz(codec->priv_data_size);\n if (!avctx->priv_data) {\n ret = AVERROR(ENOMEM);\n goto end;\n }\n if (codec->priv_class) {\n *(const AVClass **)avctx->priv_data = codec->priv_class;\n av_opt_set_defaults(avctx->priv_data);\n }\n }\n if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)\n goto free_and_end;\n } else {\n avctx->priv_data = NULL;\n }\n if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)\n goto free_and_end;\n\n if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"Codec (%s) not on whitelist \\'%s\\'\\n\", codec->name, avctx->codec_whitelist);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n // only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions\n if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height &&\n (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F || avctx->codec_id == AV_CODEC_ID_DXV))) {\n if (avctx->coded_width && avctx->coded_height)\n ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);\n else if (avctx->width && avctx->height)\n ret = ff_set_dimensions(avctx, avctx->width, avctx->height);\n if (ret < 0)\n goto free_and_end;\n }\n\n if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)\n && ( av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0\n || av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)) {\n av_log(avctx, AV_LOG_WARNING, \"Ignoring invalid width/height values\\n\");\n ff_set_dimensions(avctx, 0, 0);\n }\n\n if (avctx->width > 0 && avctx->height > 0) {\n if (av_image_check_sar(avctx->width, avctx->height,\n avctx->sample_aspect_ratio) < 0) {\n av_log(avctx, AV_LOG_WARNING, \"ignoring invalid SAR: %u/%u\\n\",\n avctx->sample_aspect_ratio.num,\n avctx->sample_aspect_ratio.den);\n avctx->sample_aspect_ratio = (AVRational){ 0, 1 };\n }\n }\n\n /* if the decoder init function was already called previously,\n * free the already allocated subtitle_header before overwriting it */\n if (av_codec_is_decoder(codec))\n av_freep(&avctx->subtitle_header);\n\n if (avctx->channels > FF_SANE_NB_CHANNELS) {\n av_log(avctx, AV_LOG_ERROR, \"Too many channels: %d\\n\", avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n avctx->codec = codec;\n if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&\n avctx->codec_id == AV_CODEC_ID_NONE) {\n avctx->codec_type = codec->type;\n avctx->codec_id = codec->id;\n }\n if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type\n && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) {\n av_log(avctx, AV_LOG_ERROR, \"Codec type or id mismatches\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n avctx->frame_number = 0;\n avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);\n\n if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&\n avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {\n const char *codec_string = av_codec_is_encoder(codec) ? \"encoder\" : \"decoder\";\n AVCodec *codec2;\n av_log(avctx, AV_LOG_ERROR,\n \"The %s '%s' is experimental but experimental codecs are not enabled, \"\n \"add '-strict %d' if you want to use it.\\n\",\n codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL);\n codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id);\n if (!(codec2->capabilities & AV_CODEC_CAP_EXPERIMENTAL))\n av_log(avctx, AV_LOG_ERROR, \"Alternatively use the non experimental %s '%s'.\\n\",\n codec_string, codec2->name);\n ret = AVERROR_EXPERIMENTAL;\n goto free_and_end;\n }\n\n if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&\n (!avctx->time_base.num || !avctx->time_base.den)) {\n avctx->time_base.num = 1;\n avctx->time_base.den = avctx->sample_rate;\n }\n\n if (!HAVE_THREADS)\n av_log(avctx, AV_LOG_WARNING, \"Warning: not compiled with thread support, using thread emulation\\n\");\n\n if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {\n ff_unlock_avcodec(codec); //we will instantiate a few encoders thus kick the counter to prevent false detection of a problem\n ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);\n ff_lock_avcodec(avctx, codec);\n if (ret < 0)\n goto free_and_end;\n }\n\n if (av_codec_is_decoder(avctx->codec)) {\n ret = ff_decode_bsfs_init(avctx);\n if (ret < 0)\n goto free_and_end;\n }\n\n if (HAVE_THREADS\n && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) {\n ret = ff_thread_init(avctx);\n if (ret < 0) {\n goto free_and_end;\n }\n }\n if (!HAVE_THREADS && !(codec->capabilities & AV_CODEC_CAP_AUTO_THREADS))\n avctx->thread_count = 1;\n\n if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {\n av_log(avctx, AV_LOG_WARNING, \"The maximum value for lowres supported by the decoder is %d\\n\",\n avctx->codec->max_lowres);\n avctx->lowres = avctx->codec->max_lowres;\n }\n\n if (av_codec_is_encoder(avctx->codec)) {\n int i;\n#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\n avctx->coded_frame = av_frame_alloc();\n if (!avctx->coded_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n\n if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"The encoder timebase is not set.\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n if (avctx->codec->sample_fmts) {\n for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {\n if (avctx->sample_fmt == avctx->codec->sample_fmts[i])\n break;\n if (avctx->channels == 1 &&\n av_get_planar_sample_fmt(avctx->sample_fmt) ==\n av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {\n avctx->sample_fmt = avctx->codec->sample_fmts[i];\n break;\n }\n }\n if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {\n char buf[128];\n snprintf(buf, sizeof(buf), \"%d\", avctx->sample_fmt);\n av_log(avctx, AV_LOG_ERROR, \"Specified sample format %s is invalid or not supported\\n\",\n (char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if (avctx->codec->pix_fmts) {\n for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)\n if (avctx->pix_fmt == avctx->codec->pix_fmts[i])\n break;\n if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE\n && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG)\n && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) {\n char buf[128];\n snprintf(buf, sizeof(buf), \"%d\", avctx->pix_fmt);\n av_log(avctx, AV_LOG_ERROR, \"Specified pixel format %s is invalid or not supported\\n\",\n (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)\n avctx->color_range = AVCOL_RANGE_JPEG;\n }\n if (avctx->codec->supported_samplerates) {\n for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)\n if (avctx->sample_rate == avctx->codec->supported_samplerates[i])\n break;\n if (avctx->codec->supported_samplerates[i] == 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified sample rate %d is not supported\\n\",\n avctx->sample_rate);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if (avctx->sample_rate < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified sample rate %d is not supported\\n\",\n avctx->sample_rate);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->codec->channel_layouts) {\n if (!avctx->channel_layout) {\n av_log(avctx, AV_LOG_WARNING, \"Channel layout not specified\\n\");\n } else {\n for (i = 0; avctx->codec->channel_layouts[i] != 0; i++)\n if (avctx->channel_layout == avctx->codec->channel_layouts[i])\n break;\n if (avctx->codec->channel_layouts[i] == 0) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_ERROR, \"Specified channel layout '%s' is not supported\\n\", buf);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n }\n if (avctx->channel_layout && avctx->channels) {\n int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n if (channels != avctx->channels) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_ERROR,\n \"Channel layout '%s' with %d channels does not match number of specified channels %d\\n\",\n buf, channels, avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n } else if (avctx->channel_layout) {\n avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n }\n if (avctx->channels < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified number of channels %d is not supported\\n\",\n avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if(avctx->codec_type == AVMEDIA_TYPE_VIDEO) {\n pixdesc = av_pix_fmt_desc_get(avctx->pix_fmt);\n if ( avctx->bits_per_raw_sample < 0\n || (avctx->bits_per_raw_sample > 8 && pixdesc->comp[0].depth <= 8)) {\n av_log(avctx, AV_LOG_WARNING, \"Specified bit depth %d not possible with the specified pixel formats depth %d\\n\",\n avctx->bits_per_raw_sample, pixdesc->comp[0].depth);\n avctx->bits_per_raw_sample = pixdesc->comp[0].depth;\n }\n if (avctx->width <= 0 || avctx->height <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"dimensions not set\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)\n && avctx->bit_rate>0 && avctx->bit_rate<1000) {\n av_log(avctx, AV_LOG_WARNING, \"Bitrate %\"PRId64\" is extremely low, maybe you mean %\"PRId64\"k\\n\", avctx->bit_rate, avctx->bit_rate);\n }\n\n if (!avctx->rc_initial_buffer_occupancy)\n avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;\n\n if (avctx->ticks_per_frame && avctx->time_base.num &&\n avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {\n av_log(avctx, AV_LOG_ERROR,\n \"ticks_per_frame %d too large for the timebase %d/%d.\",\n avctx->ticks_per_frame,\n avctx->time_base.num,\n avctx->time_base.den);\n goto free_and_end;\n }\n\n if (avctx->hw_frames_ctx) {\n AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;\n if (frames_ctx->format != avctx->pix_fmt) {\n av_log(avctx, AV_LOG_ERROR,\n \"Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&\n avctx->sw_pix_fmt != frames_ctx->sw_format) {\n av_log(avctx, AV_LOG_ERROR,\n \"Mismatching AVCodecContext.sw_pix_fmt (%s) \"\n \"and AVHWFramesContext.sw_format (%s)\\n\",\n av_get_pix_fmt_name(avctx->sw_pix_fmt),\n av_get_pix_fmt_name(frames_ctx->sw_format));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n avctx->sw_pix_fmt = frames_ctx->sw_format;\n }\n }\n\n avctx->pts_correction_num_faulty_pts =\n avctx->pts_correction_num_faulty_dts = 0;\n avctx->pts_correction_last_pts =\n avctx->pts_correction_last_dts = INT64_MIN;\n\n if ( !CONFIG_GRAY && avctx->flags & AV_CODEC_FLAG_GRAY\n && avctx->codec_descriptor->type == AVMEDIA_TYPE_VIDEO)\n av_log(avctx, AV_LOG_WARNING,\n \"gray decoding requested but not enabled at configuration time\\n\");\n\n if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME)\n || avctx->internal->frame_thread_encoder)) {\n ret = avctx->codec->init(avctx);\n if (ret < 0) {\n goto free_and_end;\n }\n codec_init_ok = 1;\n }\n\n ret=0;\n\n if (av_codec_is_decoder(avctx->codec)) {\n if (!avctx->bit_rate)\n avctx->bit_rate = get_bit_rate(avctx);\n /* validate channel layout from the decoder */\n if (avctx->channel_layout) {\n int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n if (!avctx->channels)\n avctx->channels = channels;\n else if (channels != avctx->channels) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_WARNING,\n \"Channel layout '%s' with %d channels does not match specified number of channels %d: \"\n \"ignoring specified channel layout\\n\",\n buf, channels, avctx->channels);\n avctx->channel_layout = 0;\n }\n }\n if (avctx->channels && avctx->channels < 0 ||\n avctx->channels > FF_SANE_NB_CHANNELS) {\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->bits_per_coded_sample < 0) {\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->sub_charenc) {\n if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {\n av_log(avctx, AV_LOG_ERROR, \"Character encoding is only \"\n \"supported with subtitles codecs\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) {\n av_log(avctx, AV_LOG_WARNING, \"Codec '%s' is bitmap-based, \"\n \"subtitles character encoding will be ignored\\n\",\n avctx->codec_descriptor->name);\n avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_DO_NOTHING;\n } else {\n /* input character encoding is set for a text based subtitle\n * codec at this point */\n if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_AUTOMATIC)\n avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_PRE_DECODER;\n\n if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_PRE_DECODER) {\n#if CONFIG_ICONV\n iconv_t cd = iconv_open(\"UTF-8\", avctx->sub_charenc);\n if (cd == (iconv_t)-1) {\n ret = AVERROR(errno);\n av_log(avctx, AV_LOG_ERROR, \"Unable to open iconv context \"\n \"with input character encoding \\\"%s\\\"\\n\", avctx->sub_charenc);\n goto free_and_end;\n }\n iconv_close(cd);\n#else\n av_log(avctx, AV_LOG_ERROR, \"Character encoding subtitles \"\n \"conversion needs a libavcodec built with iconv support \"\n \"for this codec\\n\");\n ret = AVERROR(ENOSYS);\n goto free_and_end;\n#endif\n }\n }\n }\n\n#if FF_API_AVCTX_TIMEBASE\n if (avctx->framerate.num > 0 && avctx->framerate.den > 0)\n avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));\n#endif\n }\n if (codec->priv_data_size > 0 && avctx->priv_data && codec->priv_class) {\n av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);\n }\n\nend:\n ff_unlock_avcodec(codec);\n if (options) {\n av_dict_free(options);\n *options = tmp;\n }\n\n return ret;\nfree_and_end:\n if (avctx->codec &&\n (codec_init_ok ||\n (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP)))\n avctx->codec->close(avctx);\n\n if (codec->priv_class && codec->priv_data_size)\n av_opt_free(avctx->priv_data);\n av_opt_free(avctx);\n\n#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\n av_frame_free(&avctx->coded_frame);\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n\n av_dict_free(&tmp);\n av_freep(&avctx->priv_data);\n if (avctx->internal) {\n av_frame_free(&avctx->internal->to_free);\n av_frame_free(&avctx->internal->compat_decode_frame);\n av_frame_free(&avctx->internal->buffer_frame);\n av_packet_free(&avctx->internal->buffer_pkt);\n av_packet_free(&avctx->internal->last_pkt_props);\n\n av_packet_free(&avctx->internal->ds.in_pkt);\n ff_decode_bsfs_uninit(avctx);\n\n av_freep(&avctx->internal->pool);\n }\n av_freep(&avctx->internal);\n avctx->codec = NULL;\n goto end;\n}","target":"int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)\n{\n int ret = 0;\n int codec_init_ok = 0;\n AVDictionary *tmp = NULL;\n const AVPixFmtDescriptor *pixdesc;\n\n if (avcodec_is_open(avctx))\n return 0;\n\n if ((!codec && !avctx->codec)) {\n av_log(avctx, AV_LOG_ERROR, \"No codec provided to avcodec_open2()\\n\");\n return AVERROR(EINVAL);\n }\n if ((codec && avctx->codec && codec != avctx->codec)) {\n av_log(avctx, AV_LOG_ERROR, \"This AVCodecContext was allocated for %s, \"\n \"but %s passed to avcodec_open2()\\n\", avctx->codec->name, codec->name);\n return AVERROR(EINVAL);\n }\n if (!codec)\n codec = avctx->codec;\n\n if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)\n return AVERROR(EINVAL);\n\n if (options)\n av_dict_copy(&tmp, *options, 0);\n\n ff_lock_avcodec(avctx, codec);\n\n avctx->internal = av_mallocz(sizeof(*avctx->internal));\n if (!avctx->internal) {\n ret = AVERROR(ENOMEM);\n goto end;\n }\n\n avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool));\n if (!avctx->internal->pool) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->to_free = av_frame_alloc();\n if (!avctx->internal->to_free) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->compat_decode_frame = av_frame_alloc();\n if (!avctx->internal->compat_decode_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->buffer_frame = av_frame_alloc();\n if (!avctx->internal->buffer_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->buffer_pkt = av_packet_alloc();\n if (!avctx->internal->buffer_pkt) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->ds.in_pkt = av_packet_alloc();\n if (!avctx->internal->ds.in_pkt) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->last_pkt_props = av_packet_alloc();\n if (!avctx->internal->last_pkt_props) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->skip_samples_multiplier = 1;\n\n if (codec->priv_data_size > 0) {\n if (!avctx->priv_data) {\n avctx->priv_data = av_mallocz(codec->priv_data_size);\n if (!avctx->priv_data) {\n ret = AVERROR(ENOMEM);\n goto end;\n }\n if (codec->priv_class) {\n *(const AVClass **)avctx->priv_data = codec->priv_class;\n av_opt_set_defaults(avctx->priv_data);\n }\n }\n if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)\n goto free_and_end;\n } else {\n avctx->priv_data = NULL;\n }\n if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)\n goto free_and_end;\n\n if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"Codec (%s) not on whitelist \\'%s\\'\\n\", codec->name, avctx->codec_whitelist);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n // only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions\n if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height &&\n (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F || avctx->codec_id == AV_CODEC_ID_DXV))) {\n if (avctx->coded_width && avctx->coded_height)\n ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);\n else if (avctx->width && avctx->height)\n ret = ff_set_dimensions(avctx, avctx->width, avctx->height);\n if (ret < 0)\n goto free_and_end;\n }\n\n if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)\n && ( av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0\n || av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)) {\n av_log(avctx, AV_LOG_WARNING, \"Ignoring invalid width/height values\\n\");\n ff_set_dimensions(avctx, 0, 0);\n }\n\n if (avctx->width > 0 && avctx->height > 0) {\n if (av_image_check_sar(avctx->width, avctx->height,\n avctx->sample_aspect_ratio) < 0) {\n av_log(avctx, AV_LOG_WARNING, \"ignoring invalid SAR: %u/%u\\n\",\n avctx->sample_aspect_ratio.num,\n avctx->sample_aspect_ratio.den);\n avctx->sample_aspect_ratio = (AVRational){ 0, 1 };\n }\n }\n\n /* if the decoder init function was already called previously,\n * free the already allocated subtitle_header before overwriting it */\n if (av_codec_is_decoder(codec))\n av_freep(&avctx->subtitle_header);\n\n if (avctx->channels > FF_SANE_NB_CHANNELS) {\n av_log(avctx, AV_LOG_ERROR, \"Too many channels: %d\\n\", avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n avctx->codec = codec;\n if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&\n avctx->codec_id == AV_CODEC_ID_NONE) {\n avctx->codec_type = codec->type;\n avctx->codec_id = codec->id;\n }\n if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type\n && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) {\n av_log(avctx, AV_LOG_ERROR, \"Codec type or id mismatches\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n avctx->frame_number = 0;\n avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);\n\n if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&\n avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {\n const char *codec_string = av_codec_is_encoder(codec) ? \"encoder\" : \"decoder\";\n AVCodec *codec2;\n av_log(avctx, AV_LOG_ERROR,\n \"The %s '%s' is experimental but experimental codecs are not enabled, \"\n \"add '-strict %d' if you want to use it.\\n\",\n codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL);\n codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id);\n if (!(codec2->capabilities & AV_CODEC_CAP_EXPERIMENTAL))\n av_log(avctx, AV_LOG_ERROR, \"Alternatively use the non experimental %s '%s'.\\n\",\n codec_string, codec2->name);\n ret = AVERROR_EXPERIMENTAL;\n goto free_and_end;\n }\n\n if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&\n (!avctx->time_base.num || !avctx->time_base.den)) {\n avctx->time_base.num = 1;\n avctx->time_base.den = avctx->sample_rate;\n }\n\n if (!HAVE_THREADS)\n av_log(avctx, AV_LOG_WARNING, \"Warning: not compiled with thread support, using thread emulation\\n\");\n\n if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {\n ff_unlock_avcodec(codec); //we will instantiate a few encoders thus kick the counter to prevent false detection of a problem\n ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);\n ff_lock_avcodec(avctx, codec);\n if (ret < 0)\n goto free_and_end;\n }\n\n if (av_codec_is_decoder(avctx->codec)) {\n ret = ff_decode_bsfs_init(avctx);\n if (ret < 0)\n goto free_and_end;\n }\n\n if (HAVE_THREADS\n && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) {\n ret = ff_thread_init(avctx);\n if (ret < 0) {\n goto free_and_end;\n }\n }\n if (!HAVE_THREADS && !(codec->capabilities & AV_CODEC_CAP_AUTO_THREADS))\n avctx->thread_count = 1;\n\n if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {\n av_log(avctx, AV_LOG_WARNING, \"The maximum value for lowres supported by the decoder is %d\\n\",\n avctx->codec->max_lowres);\n avctx->lowres = avctx->codec->max_lowres;\n }\n\n if (av_codec_is_encoder(avctx->codec)) {\n int i;\n#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\n avctx->coded_frame = av_frame_alloc();\n if (!avctx->coded_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n\n if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"The encoder timebase is not set.\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n if (avctx->codec->sample_fmts) {\n for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {\n if (avctx->sample_fmt == avctx->codec->sample_fmts[i])\n break;\n if (avctx->channels == 1 &&\n av_get_planar_sample_fmt(avctx->sample_fmt) ==\n av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {\n avctx->sample_fmt = avctx->codec->sample_fmts[i];\n break;\n }\n }\n if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {\n char buf[128];\n snprintf(buf, sizeof(buf), \"%d\", avctx->sample_fmt);\n av_log(avctx, AV_LOG_ERROR, \"Specified sample format %s is invalid or not supported\\n\",\n (char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if (avctx->codec->pix_fmts) {\n for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)\n if (avctx->pix_fmt == avctx->codec->pix_fmts[i])\n break;\n if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE\n && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG)\n && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) {\n char buf[128];\n snprintf(buf, sizeof(buf), \"%d\", avctx->pix_fmt);\n av_log(avctx, AV_LOG_ERROR, \"Specified pixel format %s is invalid or not supported\\n\",\n (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)\n avctx->color_range = AVCOL_RANGE_JPEG;\n }\n if (avctx->codec->supported_samplerates) {\n for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)\n if (avctx->sample_rate == avctx->codec->supported_samplerates[i])\n break;\n if (avctx->codec->supported_samplerates[i] == 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified sample rate %d is not supported\\n\",\n avctx->sample_rate);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if (avctx->sample_rate < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified sample rate %d is not supported\\n\",\n avctx->sample_rate);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->codec->channel_layouts) {\n if (!avctx->channel_layout) {\n av_log(avctx, AV_LOG_WARNING, \"Channel layout not specified\\n\");\n } else {\n for (i = 0; avctx->codec->channel_layouts[i] != 0; i++)\n if (avctx->channel_layout == avctx->codec->channel_layouts[i])\n break;\n if (avctx->codec->channel_layouts[i] == 0) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_ERROR, \"Specified channel layout '%s' is not supported\\n\", buf);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n }\n if (avctx->channel_layout && avctx->channels) {\n int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n if (channels != avctx->channels) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_ERROR,\n \"Channel layout '%s' with %d channels does not match number of specified channels %d\\n\",\n buf, channels, avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n } else if (avctx->channel_layout) {\n avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n }\n if (avctx->channels < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified number of channels %d is not supported\\n\",\n avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if(avctx->codec_type == AVMEDIA_TYPE_VIDEO) {\n pixdesc = av_pix_fmt_desc_get(avctx->pix_fmt);\n if ( avctx->bits_per_raw_sample < 0\n || (avctx->bits_per_raw_sample > 8 && pixdesc->comp[0].depth <= 8)) {\n av_log(avctx, AV_LOG_WARNING, \"Specified bit depth %d not possible with the specified pixel formats depth %d\\n\",\n avctx->bits_per_raw_sample, pixdesc->comp[0].depth);\n avctx->bits_per_raw_sample = pixdesc->comp[0].depth;\n }\n if (avctx->width <= 0 || avctx->height <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"dimensions not set\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)\n && avctx->bit_rate>0 && avctx->bit_rate<1000) {\n av_log(avctx, AV_LOG_WARNING, \"Bitrate %\"PRId64\" is extremely low, maybe you mean %\"PRId64\"k\\n\", avctx->bit_rate, avctx->bit_rate);\n }\n\n if (!avctx->rc_initial_buffer_occupancy)\n avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;\n\n if (avctx->ticks_per_frame && avctx->time_base.num &&\n avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {\n av_log(avctx, AV_LOG_ERROR,\n \"ticks_per_frame %d too large for the timebase %d/%d.\",\n avctx->ticks_per_frame,\n avctx->time_base.num,\n avctx->time_base.den);\n goto free_and_end;\n }\n\n if (avctx->hw_frames_ctx) {\n AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;\n if (frames_ctx->format != avctx->pix_fmt) {\n av_log(avctx, AV_LOG_ERROR,\n \"Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&\n avctx->sw_pix_fmt != frames_ctx->sw_format) {\n av_log(avctx, AV_LOG_ERROR,\n \"Mismatching AVCodecContext.sw_pix_fmt (%s) \"\n \"and AVHWFramesContext.sw_format (%s)\\n\",\n av_get_pix_fmt_name(avctx->sw_pix_fmt),\n av_get_pix_fmt_name(frames_ctx->sw_format));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n avctx->sw_pix_fmt = frames_ctx->sw_format;\n }\n }\n\n avctx->pts_correction_num_faulty_pts =\n avctx->pts_correction_num_faulty_dts = 0;\n avctx->pts_correction_last_pts =\n avctx->pts_correction_last_dts = INT64_MIN;\n\n if ( !CONFIG_GRAY && avctx->flags & AV_CODEC_FLAG_GRAY\n && avctx->codec_descriptor->type == AVMEDIA_TYPE_VIDEO)\n av_log(avctx, AV_LOG_WARNING,\n \"gray decoding requested but not enabled at configuration time\\n\");\n\n if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME)\n || avctx->internal->frame_thread_encoder)) {\n ret = avctx->codec->init(avctx);\n if (ret < 0) {\n goto free_and_end;\n }\n codec_init_ok = 1;\n }\n\n ret=0;\n\n if (av_codec_is_decoder(avctx->codec)) {\n if (!avctx->bit_rate)\n avctx->bit_rate = get_bit_rate(avctx);\n /* validate channel layout from the decoder */\n if (avctx->channel_layout) {\n int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n if (!avctx->channels)\n avctx->channels = channels;\n else if (channels != avctx->channels) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_WARNING,\n \"Channel layout '%s' with %d channels does not match specified number of channels %d: \"\n \"ignoring specified channel layout\\n\",\n buf, channels, avctx->channels);\n avctx->channel_layout = 0;\n }\n }\n if (avctx->channels && avctx->channels < 0 ||\n avctx->channels > FF_SANE_NB_CHANNELS) {\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->bits_per_coded_sample < 0) {\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->sub_charenc) {\n if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {\n av_log(avctx, AV_LOG_ERROR, \"Character encoding is only \"\n \"supported with subtitles codecs\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) {\n av_log(avctx, AV_LOG_WARNING, \"Codec '%s' is bitmap-based, \"\n \"subtitles character encoding will be ignored\\n\",\n avctx->codec_descriptor->name);\n avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_DO_NOTHING;\n } else {\n /* input character encoding is set for a text based subtitle\n * codec at this point */\n if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_AUTOMATIC)\n avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_PRE_DECODER;\n\n if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_PRE_DECODER) {\n#if CONFIG_ICONV\n iconv_t cd = iconv_open(\"UTF-8\", avctx->sub_charenc);\n if (cd == (iconv_t)-1) {\n ret = AVERROR(errno);\n av_log(avctx, AV_LOG_ERROR, \"Unable to open iconv context \"\n \"with input character encoding \\\"%s\\\"\\n\", avctx->sub_charenc);\n goto free_and_end;\n }\n iconv_close(cd);\n#else\n av_log(avctx, AV_LOG_ERROR, \"Character encoding subtitles \"\n \"conversion needs a libavcodec built with iconv support \"\n \"for this codec\\n\");\n ret = AVERROR(ENOSYS);\n goto free_and_end;\n#endif\n }\n }\n }\n\n#if FF_API_AVCTX_TIMEBASE\n if (avctx->framerate.num > 0 && avctx->framerate.den > 0)\n avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));\n#endif\n }\n if (codec->priv_data_size > 0 && avctx->priv_data && codec->priv_class) {\n av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);\n }\n\nend:\n ff_unlock_avcodec(codec);\n if (options) {\n av_dict_free(options);\n *options = tmp;\n }\n\n return ret;\nfree_and_end:\n if (avctx->codec && avctx->codec->close &&\n (codec_init_ok ||\n (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP)))\n avctx->codec->close(avctx);\n\n if (codec->priv_class && codec->priv_data_size)\n av_opt_free(avctx->priv_data);\n av_opt_free(avctx);\n\n#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\n av_frame_free(&avctx->coded_frame);\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n\n av_dict_free(&tmp);\n av_freep(&avctx->priv_data);\n if (avctx->internal) {\n av_frame_free(&avctx->internal->to_free);\n av_frame_free(&avctx->internal->compat_decode_frame);\n av_frame_free(&avctx->internal->buffer_frame);\n av_packet_free(&avctx->internal->buffer_pkt);\n av_packet_free(&avctx->internal->last_pkt_props);\n\n av_packet_free(&avctx->internal->ds.in_pkt);\n ff_decode_bsfs_uninit(avctx);\n\n av_freep(&avctx->internal->pool);\n }\n av_freep(&avctx->internal);\n avctx->codec = NULL;\n goto end;\n}","lang":"c","vul_type":"cwe-476","target_token_count":5423,"sven_meta":{"func_name":"avcodec_open2","file_name":"libavcodec/utils.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/8df6884832ec413cf032dfaa45c23b1c7876670c","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#43-14b5450892d5","input":"TfLiteStatus Subgraph::Invoke() {\n if (!consistent_) {\n ReportError(\"Invoke called on model that is not consistent.\");\n return kTfLiteError;\n }\n\n TfLiteStatus status = kTfLiteOk;\n if (state_ == kStateUninvokable) {\n ReportError(\"Invoke called on model that is not ready.\");\n return kTfLiteError;\n } else if (memory_planner_ && !memory_planner_->HasNonPersistentMemory()) {\n ReportError(\"Non-persistent memory is not available.\");\n return kTfLiteError;\n }\n\n // This is only needed for UseNNAPI(true);\n if (should_apply_nnapi_delegate_ && !applied_nnapi_delegate_) {\n TF_LITE_ENSURE_OK(&context_, ModifyGraphWithDelegate(NnApiDelegate()));\n // only need to modify the graph once upon the first invocation.\n applied_nnapi_delegate_ = true;\n }\n\n // Invocations are always done in node order.\n // Note that calling Invoke repeatedly will cause the original memory plan to\n // be reused, unless either ResizeInputTensor() or AllocateTensors() has been\n // called.\n for (int execution_plan_index = 0;\n execution_plan_index < execution_plan_.size(); execution_plan_index++) {\n if (execution_plan_index == next_execution_plan_index_to_prepare_) {\n TF_LITE_ENSURE_STATUS(PrepareOpsAndTensors());\n TF_LITE_ENSURE(&context_, next_execution_plan_index_to_prepare_ >=\n execution_plan_index);\n }\n int node_index = execution_plan_[execution_plan_index];\n TfLiteNode& node = nodes_and_registration_[node_index].first;\n const TfLiteRegistration& registration =\n nodes_and_registration_[node_index].second;\n\n const char* op_name = nullptr;\n if (profiler_) op_name = GetTFLiteOpName(registration);\n TFLITE_SCOPED_TAGGED_OPERATOR_PROFILE(profiler_.get(), op_name, node_index);\n\n // TODO(ycling): This is an extra loop through inputs to check if the data\n // need to be copied from Delegate buffer to raw memory, which is often not\n // needed. We may want to cache this in prepare to know if this needs to be\n // done for a node or not.\n for (int i = 0; i < node.inputs->size; ++i) {\n int tensor_index = node.inputs->data[i];\n if (tensor_index == kTfLiteOptionalTensor) {\n continue;\n }\n TfLiteTensor* tensor = &tensors_[tensor_index];\n if (tensor->delegate && tensor->delegate != node.delegate &&\n tensor->data_is_stale) {\n TF_LITE_ENSURE_STATUS(EnsureTensorDataIsReadable(tensor_index));\n }\n }\n\n if (check_cancelled_func_ != nullptr &&\n check_cancelled_func_(cancellation_data_)) {\n ReportError(\"Client requested cancel during Invoke()\");\n return kTfLiteError;\n }\n\n EnsureTensorsVectorCapacity();\n tensor_resized_since_op_invoke_ = false;\n if (OpInvoke(registration, &node) != kTfLiteOk) {\n return ReportOpError(&context_, node, registration, node_index,\n \"failed to invoke\");\n }\n\n // Force execution prep for downstream ops if the latest op triggered the\n // resize of a dynamic tensor.\n if (tensor_resized_since_op_invoke_ &&\n HasDynamicTensor(context_, node.outputs)) {\n next_execution_plan_index_to_prepare_ = execution_plan_index + 1;\n\n // This happens when an intermediate dynamic tensor is resized.\n // We don't have to prepare all the ops, but we need to recompute\n // the allocation plan.\n if (next_execution_plan_index_to_plan_allocation_ >\n next_execution_plan_index_to_prepare_) {\n next_execution_plan_index_to_plan_allocation_ =\n next_execution_plan_index_to_prepare_;\n if (memory_planner_) {\n TF_LITE_ENSURE_STATUS(memory_planner_->ResetAllocationsAfter(\n next_execution_plan_index_to_plan_allocation_ - 1));\n }\n }\n }\n }\n\n return status;\n}","target":"TfLiteStatus Subgraph::Invoke() {\n if (!consistent_) {\n ReportError(\"Invoke called on model that is not consistent.\");\n return kTfLiteError;\n }\n\n TfLiteStatus status = kTfLiteOk;\n if (state_ == kStateUninvokable) {\n ReportError(\"Invoke called on model that is not ready.\");\n return kTfLiteError;\n } else if (memory_planner_ && !memory_planner_->HasNonPersistentMemory()) {\n ReportError(\"Non-persistent memory is not available.\");\n return kTfLiteError;\n }\n\n // This is only needed for UseNNAPI(true);\n if (should_apply_nnapi_delegate_ && !applied_nnapi_delegate_) {\n TF_LITE_ENSURE_OK(&context_, ModifyGraphWithDelegate(NnApiDelegate()));\n // only need to modify the graph once upon the first invocation.\n applied_nnapi_delegate_ = true;\n }\n\n // Invocations are always done in node order.\n // Note that calling Invoke repeatedly will cause the original memory plan to\n // be reused, unless either ResizeInputTensor() or AllocateTensors() has been\n // called.\n for (int execution_plan_index = 0;\n execution_plan_index < execution_plan_.size(); execution_plan_index++) {\n if (execution_plan_index == next_execution_plan_index_to_prepare_) {\n TF_LITE_ENSURE_STATUS(PrepareOpsAndTensors());\n TF_LITE_ENSURE(&context_, next_execution_plan_index_to_prepare_ >=\n execution_plan_index);\n }\n int node_index = execution_plan_[execution_plan_index];\n TfLiteNode& node = nodes_and_registration_[node_index].first;\n const TfLiteRegistration& registration =\n nodes_and_registration_[node_index].second;\n\n const char* op_name = nullptr;\n if (profiler_) op_name = GetTFLiteOpName(registration);\n TFLITE_SCOPED_TAGGED_OPERATOR_PROFILE(profiler_.get(), op_name, node_index);\n\n // TODO(ycling): This is an extra loop through inputs to check if the data\n // need to be copied from Delegate buffer to raw memory, which is often not\n // needed. We may want to cache this in prepare to know if this needs to be\n // done for a node or not.\n for (int i = 0; i < node.inputs->size; ++i) {\n int tensor_index = node.inputs->data[i];\n if (tensor_index == kTfLiteOptionalTensor) {\n continue;\n }\n TfLiteTensor* tensor = &tensors_[tensor_index];\n if (tensor->delegate && tensor->delegate != node.delegate &&\n tensor->data_is_stale) {\n TF_LITE_ENSURE_STATUS(EnsureTensorDataIsReadable(tensor_index));\n }\n if (tensor->data.raw == nullptr && tensor->bytes > 0) {\n if (registration.builtin_code == kTfLiteBuiltinReshape && i == 1) {\n // In general, having a tensor here with no buffer will be an error.\n // However, for the reshape operator, the second input tensor is only\n // used for the shape, not for the data. Thus, null buffer is ok.\n continue;\n } else {\n // In all other cases, we need to return an error as otherwise we will\n // trigger a null pointer dereference (likely).\n ReportError(\"Input tensor %d lacks data\", tensor_index);\n return kTfLiteError;\n }\n }\n }\n\n if (check_cancelled_func_ != nullptr &&\n check_cancelled_func_(cancellation_data_)) {\n ReportError(\"Client requested cancel during Invoke()\");\n return kTfLiteError;\n }\n\n EnsureTensorsVectorCapacity();\n tensor_resized_since_op_invoke_ = false;\n if (OpInvoke(registration, &node) != kTfLiteOk) {\n return ReportOpError(&context_, node, registration, node_index,\n \"failed to invoke\");\n }\n\n // Force execution prep for downstream ops if the latest op triggered the\n // resize of a dynamic tensor.\n if (tensor_resized_since_op_invoke_ &&\n HasDynamicTensor(context_, node.outputs)) {\n next_execution_plan_index_to_prepare_ = execution_plan_index + 1;\n\n // This happens when an intermediate dynamic tensor is resized.\n // We don't have to prepare all the ops, but we need to recompute\n // the allocation plan.\n if (next_execution_plan_index_to_plan_allocation_ >\n next_execution_plan_index_to_prepare_) {\n next_execution_plan_index_to_plan_allocation_ =\n next_execution_plan_index_to_prepare_;\n if (memory_planner_) {\n TF_LITE_ENSURE_STATUS(memory_planner_->ResetAllocationsAfter(\n next_execution_plan_index_to_plan_allocation_ - 1));\n }\n }\n }\n }\n\n return status;\n}","lang":"cpp","vul_type":"cwe-476","target_token_count":1038,"sven_meta":{"func_name":"tflite::Subgraph::Invoke","file_name":"tensorflow/lite/core/subgraph.cc","commit_link":"github.com/tensorflow/tensorflow/commit/0b5662bc2be13a8c8f044d925d87fb6e56247cd8","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#44-0d6eab7eb5af","input":"static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tconst char *section_name = \"\";\n\tconst char *link_section_name = \"\";\n\tchar *end = NULL;\n\tElf_(Shdr) *link_shdr = NULL;\n\tut8 dfs[sizeof (Elf_(Verdef))] = {0};\n\tSdb *sdb;\n\tint cnt, i;\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn false;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (shdr->sh_size < 1 || shdr->sh_size > SIZE_MAX) {\n\t\treturn false;\n\t}\n\tElf_(Verdef) *defs = calloc (shdr->sh_size, sizeof (char));\n\tif (!defs) {\n\t\treturn false;\n\t}\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (link_shdr && bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!defs) {\n\t\tbprintf (\"Warning: Cannot allocate memory (Check Elf_(Verdef))\\n\");\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tend = (char *)defs + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tfor (cnt = 0, i = 0; i >= 0 && cnt < shdr->sh_info && ((char *)defs + i < end); ++cnt) {\n\t\tSdb *sdb_verdef = sdb_new0 ();\n\t\tchar *vstart = ((char*)defs) + i;\n\t\tchar key[32] = {0};\n\t\tElf_(Verdef) *verdef = (Elf_(Verdef)*)vstart;\n\t\tElf_(Verdaux) aux = {0};\n\t\tint j = 0;\n\t\tint isum = 0;\n\n\t\tr_buf_read_at (bin->b, shdr->sh_offset + i, dfs, sizeof (Elf_(Verdef)));\n\t\tverdef->vd_version = READ16 (dfs, j)\n\t\tverdef->vd_flags = READ16 (dfs, j)\n\t\tverdef->vd_ndx = READ16 (dfs, j)\n\t\tverdef->vd_cnt = READ16 (dfs, j)\n\t\tverdef->vd_hash = READ32 (dfs, j)\n\t\tverdef->vd_aux = READ32 (dfs, j)\n\t\tverdef->vd_next = READ32 (dfs, j)\n\t\tint vdaux = verdef->vd_aux;\n\t\tif (vdaux < 1) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tvstart += vdaux;\n\t\tif (vstart > end || vstart + sizeof (Elf_(Verdaux)) > end) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tj = 0;\n\t\taux.vda_name = READ32 (vstart, j)\n\t\taux.vda_next = READ32 (vstart, j)\n\n\t\tisum = i + verdef->vd_aux;\n\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tsdb_num_set (sdb_verdef, \"idx\", i, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_version\", verdef->vd_version, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_ndx\", verdef->vd_ndx, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_cnt\", verdef->vd_cnt, 0);\n\t\tsdb_set (sdb_verdef, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\tsdb_set (sdb_verdef, \"flags\", get_ver_flags (verdef->vd_flags), 0);\n\n\t\tfor (j = 1; j < verdef->vd_cnt; ++j) {\n\t\t\tint k;\n\t\t\tSdb *sdb_parent = sdb_new0 ();\n\t\t\tisum += aux.vda_next;\n\t\t\tvstart += aux.vda_next;\n\t\t\tif (vstart > end || vstart + sizeof(Elf_(Verdaux)) > end) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tk = 0;\n\t\t\taux.vda_name = READ32 (vstart, k)\n\t\t\taux.vda_next = READ32 (vstart, k)\n\t\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_parent, \"idx\", isum, 0);\n\t\t\tsdb_num_set (sdb_parent, \"parent\", j, 0);\n\t\t\tsdb_set (sdb_parent, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\t\tsnprintf (key, sizeof (key), \"parent%d\", j - 1);\n\t\t\tsdb_ns_set (sdb_verdef, key, sdb_parent);\n\t\t}\n\n\t\tsnprintf (key, sizeof (key), \"verdef%d\", cnt);\n\t\tsdb_ns_set (sdb, key, sdb_verdef);\n\t\tif (!verdef->vd_next) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tif ((st32)verdef->vd_next < 1) {\n\t\t\teprintf (\"Warning: Invalid vd_next in the ELF version\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += verdef->vd_next;\n\t}\n\tfree (defs);\n\treturn sdb;\nout_error:\n\tfree (defs);\n\tsdb_free (sdb);\n\treturn NULL;\n}","target":"static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tconst char *section_name = \"\";\n\tconst char *link_section_name = \"\";\n\tchar *end = NULL;\n\tElf_(Shdr) *link_shdr = NULL;\n\tut8 dfs[sizeof (Elf_(Verdef))] = {0};\n\tSdb *sdb;\n\tint cnt, i;\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn false;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (shdr->sh_size < 1 || shdr->sh_size > SIZE_MAX) {\n\t\treturn false;\n\t}\n\tElf_(Verdef) *defs = calloc (shdr->sh_size, sizeof (char));\n\tif (!defs) {\n\t\treturn false;\n\t}\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (link_shdr && bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!defs) {\n\t\tbprintf (\"Warning: Cannot allocate memory (Check Elf_(Verdef))\\n\");\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tend = (char *)defs + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tfor (cnt = 0, i = 0; i >= 0 && cnt < shdr->sh_info && (end - (char *)defs > i); ++cnt) {\n\t\tSdb *sdb_verdef = sdb_new0 ();\n\t\tchar *vstart = ((char*)defs) + i;\n\t\tchar key[32] = {0};\n\t\tElf_(Verdef) *verdef = (Elf_(Verdef)*)vstart;\n\t\tElf_(Verdaux) aux = {0};\n\t\tint j = 0;\n\t\tint isum = 0;\n\n\t\tr_buf_read_at (bin->b, shdr->sh_offset + i, dfs, sizeof (Elf_(Verdef)));\n\t\tverdef->vd_version = READ16 (dfs, j)\n\t\tverdef->vd_flags = READ16 (dfs, j)\n\t\tverdef->vd_ndx = READ16 (dfs, j)\n\t\tverdef->vd_cnt = READ16 (dfs, j)\n\t\tverdef->vd_hash = READ32 (dfs, j)\n\t\tverdef->vd_aux = READ32 (dfs, j)\n\t\tverdef->vd_next = READ32 (dfs, j)\n\t\tint vdaux = verdef->vd_aux;\n\t\tif (vdaux < 1 || (char *)UINTPTR_MAX - vstart < vdaux) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tvstart += vdaux;\n\t\tif (vstart > end || end - vstart < sizeof (Elf_(Verdaux))) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tj = 0;\n\t\taux.vda_name = READ32 (vstart, j)\n\t\taux.vda_next = READ32 (vstart, j)\n\n\t\tisum = i + verdef->vd_aux;\n\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tsdb_num_set (sdb_verdef, \"idx\", i, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_version\", verdef->vd_version, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_ndx\", verdef->vd_ndx, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_cnt\", verdef->vd_cnt, 0);\n\t\tsdb_set (sdb_verdef, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\tsdb_set (sdb_verdef, \"flags\", get_ver_flags (verdef->vd_flags), 0);\n\n\t\tfor (j = 1; j < verdef->vd_cnt; ++j) {\n\t\t\tint k;\n\t\t\tSdb *sdb_parent = sdb_new0 ();\n\t\t\tisum += aux.vda_next;\n\t\t\tvstart += aux.vda_next;\n\t\t\tif (vstart > end || end - vstart < sizeof (Elf_(Verdaux))) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tk = 0;\n\t\t\taux.vda_name = READ32 (vstart, k)\n\t\t\taux.vda_next = READ32 (vstart, k)\n\t\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_parent, \"idx\", isum, 0);\n\t\t\tsdb_num_set (sdb_parent, \"parent\", j, 0);\n\t\t\tsdb_set (sdb_parent, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\t\tsnprintf (key, sizeof (key), \"parent%d\", j - 1);\n\t\t\tsdb_ns_set (sdb_verdef, key, sdb_parent);\n\t\t}\n\n\t\tsnprintf (key, sizeof (key), \"verdef%d\", cnt);\n\t\tsdb_ns_set (sdb, key, sdb_verdef);\n\t\tif (!verdef->vd_next) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tif ((st32)verdef->vd_next < 1) {\n\t\t\teprintf (\"Warning: Invalid vd_next in the ELF version\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += verdef->vd_next;\n\t}\n\tfree (defs);\n\treturn sdb;\nout_error:\n\tfree (defs);\n\tsdb_free (sdb);\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-476","target_token_count":1465,"sven_meta":{"func_name":"store_versioninfo_gnu_verdef","file_name":"libr/bin/format/elf/elf.c","commit_link":"github.com/radare/radare2/commit/62e39f34b2705131a2d08aff0c2e542c6a52cf0e","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#45-2478f58af2a6","input":"upnp_redirect(const char * rhost, unsigned short eport,\n const char * iaddr, unsigned short iport,\n const char * protocol, const char * desc,\n unsigned int leaseduration)\n{\n\tint proto, r;\n\tchar iaddr_old[32];\n\tchar rhost_old[32];\n\tunsigned short iport_old;\n\tstruct in_addr address;\n\tunsigned int timestamp;\n\n\tproto = proto_atoi(protocol);\n\tif(inet_aton(iaddr, &address) <= 0) {\n\t\tsyslog(LOG_ERR, \"inet_aton(%s) FAILED\", iaddr);\n\t\treturn -1;\n\t}\n\n\tif(!check_upnp_rule_against_permissions(upnppermlist, num_upnpperm,\n\t eport, address, iport)) {\n\t\tsyslog(LOG_INFO, \"redirection permission check failed for \"\n\t\t \"%hu->%s:%hu %s\", eport, iaddr, iport, protocol);\n\t\treturn -3;\n\t}\n\t/* IGDv1 (WANIPConnection:1 Service Template Version 1.01 / Nov 12, 2001)\n\t * - 2.2.20.PortMappingDescription :\n\t * Overwriting Previous / Existing Port Mappings:\n\t * If the RemoteHost, ExternalPort, PortMappingProtocol and InternalClient\n\t * are exactly the same as an existing mapping, the existing mapping values\n\t * for InternalPort, PortMappingDescription, PortMappingEnabled and\n\t * PortMappingLeaseDuration are overwritten.\n\t * Rejecting a New Port Mapping:\n\t * In cases where the RemoteHost, ExternalPort and PortMappingProtocol\n\t * are the same as an existing mapping, but the InternalClient is\n\t * different, the action is rejected with an appropriate error.\n\t * Add or Reject New Port Mapping behavior based on vendor implementation:\n\t * In cases where the ExternalPort, PortMappingProtocol and InternalClient\n\t * are the same, but RemoteHost is different, the vendor can choose to\n\t * support both mappings simultaneously, or reject the second mapping\n\t * with an appropriate error.\n\t *\n\t * - 2.4.16.AddPortMapping\n\t * This action creates a new port mapping or overwrites an existing\n\t * mapping with the same internal client. If the ExternalPort and\n\t * PortMappingProtocol pair is already mapped to another internal client,\n\t * an error is returned.\n\t *\n\t * IGDv2 (WANIPConnection:2 Service Standardized DCP (SDCP) Sep 10, 2010)\n\t * Protocol ExternalPort RemoteHost InternalClient Result\n\t * = = ≠ ≠ Failure\n\t * = = ≠ = Failure or success\n\t * (vendor specific)\n\t * = = = ≠ Failure\n\t * = = = = Success (overwrite)\n\t */\n\trhost_old[0] = '\\0';\n\tr = get_redirect_rule(ext_if_name, eport, proto,\n\t iaddr_old, sizeof(iaddr_old), &iport_old, 0, 0,\n\t rhost_old, sizeof(rhost_old),\n\t ×tamp, 0, 0);\n\tif(r == 0) {\n\t\tif(strcmp(iaddr, iaddr_old)==0 &&\n\t\t ((rhost == NULL && rhost_old[0]=='\\0') ||\n\t\t (rhost && (strcmp(rhost, \"*\") == 0) && rhost_old[0]=='\\0') ||\n\t\t (rhost && (strcmp(rhost, rhost_old) == 0)))) {\n\t\t\tsyslog(LOG_INFO, \"updating existing port mapping %hu %s (rhost '%s') => %s:%hu\",\n\t\t\t\teport, protocol, rhost_old, iaddr_old, iport_old);\n\t\t\ttimestamp = (leaseduration > 0) ? upnp_time() + leaseduration : 0;\n\t\t\tif(iport != iport_old) {\n\t\t\t\tr = update_portmapping(ext_if_name, eport, proto, iport, desc, timestamp);\n\t\t\t} else {\n\t\t\t\tr = update_portmapping_desc_timestamp(ext_if_name, eport, proto, desc, timestamp);\n\t\t\t}\n#ifdef ENABLE_LEASEFILE\n\t\t\tif(r == 0) {\n\t\t\t\tlease_file_remove(eport, proto);\n\t\t\t\tlease_file_add(eport, iaddr, iport, proto, desc, timestamp);\n\t\t\t}\n#endif /* ENABLE_LEASEFILE */\n\t\t\treturn r;\n\t\t} else {\n\t\t\tsyslog(LOG_INFO, \"port %hu %s (rhost '%s') already redirected to %s:%hu\",\n\t\t\t\teport, protocol, rhost_old, iaddr_old, iport_old);\n\t\t\treturn -2;\n\t\t}\n#ifdef CHECK_PORTINUSE\n\t} else if (port_in_use(ext_if_name, eport, proto, iaddr, iport) > 0) {\n\t\tsyslog(LOG_INFO, \"port %hu protocol %s already in use\",\n\t\t eport, protocol);\n\t\treturn -4;\n#endif /* CHECK_PORTINUSE */\n\t} else {\n\t\ttimestamp = (leaseduration > 0) ? upnp_time() + leaseduration : 0;\n\t\tsyslog(LOG_INFO, \"redirecting port %hu to %s:%hu protocol %s for: %s\",\n\t\t\teport, iaddr, iport, protocol, desc);\n\t\treturn upnp_redirect_internal(rhost, eport, iaddr, iport, proto,\n\t\t desc, timestamp);\n\t}\n}","target":"upnp_redirect(const char * rhost, unsigned short eport,\n const char * iaddr, unsigned short iport,\n const char * protocol, const char * desc,\n unsigned int leaseduration)\n{\n\tint proto, r;\n\tchar iaddr_old[32];\n\tchar rhost_old[32];\n\tunsigned short iport_old;\n\tstruct in_addr address;\n\tunsigned int timestamp;\n\n\tproto = proto_atoi(protocol);\n\tif(inet_aton(iaddr, &address) <= 0) {\n\t\tsyslog(LOG_ERR, \"inet_aton(%s) FAILED\", iaddr);\n\t\treturn -1;\n\t}\n\n\tif(!check_upnp_rule_against_permissions(upnppermlist, num_upnpperm,\n\t eport, address, iport)) {\n\t\tsyslog(LOG_INFO, \"redirection permission check failed for \"\n\t\t \"%hu->%s:%hu %s\", eport, iaddr, iport, protocol);\n\t\treturn -3;\n\t}\n\n\tif (desc == NULL)\n\t\tdesc = \"\";\t/* assume empty description */\n\n\t/* IGDv1 (WANIPConnection:1 Service Template Version 1.01 / Nov 12, 2001)\n\t * - 2.2.20.PortMappingDescription :\n\t * Overwriting Previous / Existing Port Mappings:\n\t * If the RemoteHost, ExternalPort, PortMappingProtocol and InternalClient\n\t * are exactly the same as an existing mapping, the existing mapping values\n\t * for InternalPort, PortMappingDescription, PortMappingEnabled and\n\t * PortMappingLeaseDuration are overwritten.\n\t * Rejecting a New Port Mapping:\n\t * In cases where the RemoteHost, ExternalPort and PortMappingProtocol\n\t * are the same as an existing mapping, but the InternalClient is\n\t * different, the action is rejected with an appropriate error.\n\t * Add or Reject New Port Mapping behavior based on vendor implementation:\n\t * In cases where the ExternalPort, PortMappingProtocol and InternalClient\n\t * are the same, but RemoteHost is different, the vendor can choose to\n\t * support both mappings simultaneously, or reject the second mapping\n\t * with an appropriate error.\n\t *\n\t * - 2.4.16.AddPortMapping\n\t * This action creates a new port mapping or overwrites an existing\n\t * mapping with the same internal client. If the ExternalPort and\n\t * PortMappingProtocol pair is already mapped to another internal client,\n\t * an error is returned.\n\t *\n\t * IGDv2 (WANIPConnection:2 Service Standardized DCP (SDCP) Sep 10, 2010)\n\t * Protocol ExternalPort RemoteHost InternalClient Result\n\t * = = ≠ ≠ Failure\n\t * = = ≠ = Failure or success\n\t * (vendor specific)\n\t * = = = ≠ Failure\n\t * = = = = Success (overwrite)\n\t */\n\trhost_old[0] = '\\0';\n\tr = get_redirect_rule(ext_if_name, eport, proto,\n\t iaddr_old, sizeof(iaddr_old), &iport_old, 0, 0,\n\t rhost_old, sizeof(rhost_old),\n\t ×tamp, 0, 0);\n\tif(r == 0) {\n\t\tif(strcmp(iaddr, iaddr_old)==0 &&\n\t\t ((rhost == NULL && rhost_old[0]=='\\0') ||\n\t\t (rhost && (strcmp(rhost, \"*\") == 0) && rhost_old[0]=='\\0') ||\n\t\t (rhost && (strcmp(rhost, rhost_old) == 0)))) {\n\t\t\tsyslog(LOG_INFO, \"updating existing port mapping %hu %s (rhost '%s') => %s:%hu\",\n\t\t\t\teport, protocol, rhost_old, iaddr_old, iport_old);\n\t\t\ttimestamp = (leaseduration > 0) ? upnp_time() + leaseduration : 0;\n\t\t\tif(iport != iport_old) {\n\t\t\t\tr = update_portmapping(ext_if_name, eport, proto, iport, desc, timestamp);\n\t\t\t} else {\n\t\t\t\tr = update_portmapping_desc_timestamp(ext_if_name, eport, proto, desc, timestamp);\n\t\t\t}\n#ifdef ENABLE_LEASEFILE\n\t\t\tif(r == 0) {\n\t\t\t\tlease_file_remove(eport, proto);\n\t\t\t\tlease_file_add(eport, iaddr, iport, proto, desc, timestamp);\n\t\t\t}\n#endif /* ENABLE_LEASEFILE */\n\t\t\treturn r;\n\t\t} else {\n\t\t\tsyslog(LOG_INFO, \"port %hu %s (rhost '%s') already redirected to %s:%hu\",\n\t\t\t\teport, protocol, rhost_old, iaddr_old, iport_old);\n\t\t\treturn -2;\n\t\t}\n#ifdef CHECK_PORTINUSE\n\t} else if (port_in_use(ext_if_name, eport, proto, iaddr, iport) > 0) {\n\t\tsyslog(LOG_INFO, \"port %hu protocol %s already in use\",\n\t\t eport, protocol);\n\t\treturn -4;\n#endif /* CHECK_PORTINUSE */\n\t} else {\n\t\ttimestamp = (leaseduration > 0) ? upnp_time() + leaseduration : 0;\n\t\tsyslog(LOG_INFO, \"redirecting port %hu to %s:%hu protocol %s for: %s\",\n\t\t\teport, iaddr, iport, protocol, desc);\n\t\treturn upnp_redirect_internal(rhost, eport, iaddr, iport, proto,\n\t\t desc, timestamp);\n\t}\n}","lang":"c","vul_type":"cwe-476","target_token_count":1198,"sven_meta":{"func_name":"upnp_redirect","file_name":"miniupnpd/upnpredirect.c","commit_link":"github.com/miniupnp/miniupnp/commit/f321c2066b96d18afa5158dfa2d2873a2957ef38","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#46-fb6fee9ea8da","input":"static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,\n const ImageInfo *IMimage_info,Image *IMimage,ExceptionInfo *exception)\n{\n char\n im_vers[32],\n libpng_runv[32],\n libpng_vers[32],\n zlib_runv[32],\n zlib_vers[32];\n\n Image\n *image;\n\n ImageInfo\n *image_info;\n\n char\n s[2];\n\n const char\n *name,\n *property,\n *value;\n\n const StringInfo\n *profile;\n\n int\n num_passes,\n pass,\n ping_wrote_caNv;\n\n png_byte\n ping_trans_alpha[256];\n\n png_color\n palette[257];\n\n png_color_16\n ping_background,\n ping_trans_color;\n\n png_info\n *ping_info;\n\n png_struct\n *ping;\n\n png_uint_32\n ping_height,\n ping_width;\n\n ssize_t\n y;\n\n MagickBooleanType\n image_matte,\n logging,\n matte,\n\n ping_have_blob,\n ping_have_cheap_transparency,\n ping_have_color,\n ping_have_non_bw,\n ping_have_PLTE,\n ping_have_bKGD,\n ping_have_eXIf,\n ping_have_iCCP,\n ping_have_pHYs,\n ping_have_sRGB,\n ping_have_tRNS,\n\n ping_exclude_bKGD,\n ping_exclude_cHRM,\n ping_exclude_date,\n /* ping_exclude_EXIF, */\n ping_exclude_eXIf,\n ping_exclude_gAMA,\n ping_exclude_iCCP,\n /* ping_exclude_iTXt, */\n ping_exclude_oFFs,\n ping_exclude_pHYs,\n ping_exclude_sRGB,\n ping_exclude_tEXt,\n ping_exclude_tIME,\n /* ping_exclude_tRNS, */\n ping_exclude_vpAg,\n ping_exclude_caNv,\n ping_exclude_zCCP, /* hex-encoded iCCP */\n ping_exclude_zTXt,\n\n ping_preserve_colormap,\n ping_preserve_iCCP,\n ping_need_colortype_warning,\n\n status,\n tried_332,\n tried_333,\n tried_444;\n\n MemoryInfo\n *volatile pixel_info;\n\n QuantumInfo\n *quantum_info;\n\n PNGErrorInfo\n error_info;\n\n register ssize_t\n i,\n x;\n\n unsigned char\n *ping_pixels;\n\n volatile int\n image_colors,\n ping_bit_depth,\n ping_color_type,\n ping_interlace_method,\n ping_compression_method,\n ping_filter_method,\n ping_num_trans;\n\n volatile size_t\n image_depth,\n old_bit_depth;\n\n size_t\n quality,\n rowbytes,\n save_image_depth;\n\n int\n j,\n number_colors,\n number_opaque,\n number_semitransparent,\n number_transparent,\n ping_pHYs_unit_type;\n\n png_uint_32\n ping_pHYs_x_resolution,\n ping_pHYs_y_resolution;\n\n logging=LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter WriteOnePNGImage()\");\n\n image = CloneImage(IMimage,0,0,MagickFalse,exception);\n image_info=(ImageInfo *) CloneImageInfo(IMimage_info);\n if (image_info == (ImageInfo *) NULL)\n ThrowWriterException(ResourceLimitError, \"MemoryAllocationFailed\");\n\n /* Define these outside of the following \"if logging()\" block so they will\n * show in debuggers.\n */\n *im_vers='\\0';\n (void) ConcatenateMagickString(im_vers,\n MagickLibVersionText,MagickPathExtent);\n (void) ConcatenateMagickString(im_vers,\n MagickLibAddendum,MagickPathExtent);\n\n *libpng_vers='\\0';\n (void) ConcatenateMagickString(libpng_vers,\n PNG_LIBPNG_VER_STRING,32);\n *libpng_runv='\\0';\n (void) ConcatenateMagickString(libpng_runv,\n png_get_libpng_ver(NULL),32);\n\n *zlib_vers='\\0';\n (void) ConcatenateMagickString(zlib_vers,\n ZLIB_VERSION,32);\n *zlib_runv='\\0';\n (void) ConcatenateMagickString(zlib_runv,\n zlib_version,32);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" IM version = %s\",\n im_vers);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Libpng version = %s\",\n libpng_vers);\n if (LocaleCompare(libpng_vers,libpng_runv) != 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" running with %s\",\n libpng_runv);\n }\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Zlib version = %s\",\n zlib_vers);\n if (LocaleCompare(zlib_vers,zlib_runv) != 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" running with %s\",\n zlib_runv);\n }\n }\n\n /* Initialize some stuff */\n ping_bit_depth=0,\n ping_color_type=0,\n ping_interlace_method=0,\n ping_compression_method=0,\n ping_filter_method=0,\n ping_num_trans = 0;\n\n ping_background.red = 0;\n ping_background.green = 0;\n ping_background.blue = 0;\n ping_background.gray = 0;\n ping_background.index = 0;\n\n ping_trans_color.red=0;\n ping_trans_color.green=0;\n ping_trans_color.blue=0;\n ping_trans_color.gray=0;\n\n ping_pHYs_unit_type = 0;\n ping_pHYs_x_resolution = 0;\n ping_pHYs_y_resolution = 0;\n\n ping_have_blob=MagickFalse;\n ping_have_cheap_transparency=MagickFalse;\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n ping_have_PLTE=MagickFalse;\n ping_have_bKGD=MagickFalse;\n ping_have_eXIf=MagickTrue;\n ping_have_iCCP=MagickFalse;\n ping_have_pHYs=MagickFalse;\n ping_have_sRGB=MagickFalse;\n ping_have_tRNS=MagickFalse;\n\n ping_exclude_bKGD=mng_info->ping_exclude_bKGD;\n ping_exclude_caNv=mng_info->ping_exclude_caNv;\n ping_exclude_cHRM=mng_info->ping_exclude_cHRM;\n ping_exclude_date=mng_info->ping_exclude_date;\n ping_exclude_eXIf=mng_info->ping_exclude_eXIf;\n ping_exclude_gAMA=mng_info->ping_exclude_gAMA;\n ping_exclude_iCCP=mng_info->ping_exclude_iCCP;\n /* ping_exclude_iTXt=mng_info->ping_exclude_iTXt; */\n ping_exclude_oFFs=mng_info->ping_exclude_oFFs;\n ping_exclude_pHYs=mng_info->ping_exclude_pHYs;\n ping_exclude_sRGB=mng_info->ping_exclude_sRGB;\n ping_exclude_tEXt=mng_info->ping_exclude_tEXt;\n ping_exclude_tIME=mng_info->ping_exclude_tIME;\n /* ping_exclude_tRNS=mng_info->ping_exclude_tRNS; */\n ping_exclude_vpAg=mng_info->ping_exclude_vpAg;\n ping_exclude_zCCP=mng_info->ping_exclude_zCCP; /* hex-encoded iCCP in zTXt */\n ping_exclude_zTXt=mng_info->ping_exclude_zTXt;\n\n ping_preserve_colormap = mng_info->ping_preserve_colormap;\n ping_preserve_iCCP = mng_info->ping_preserve_iCCP;\n ping_need_colortype_warning = MagickFalse;\n\n /* Recognize the ICC sRGB profile and convert it to the sRGB chunk,\n * i.e., eliminate the ICC profile and set image->rendering_intent.\n * Note that this will not involve any changes to the actual pixels\n * but merely passes information to applications that read the resulting\n * PNG image.\n *\n * To do: recognize other variants of the sRGB profile, using the CRC to\n * verify all recognized variants including the 7 already known.\n *\n * Work around libpng16+ rejecting some \"known invalid sRGB profiles\".\n *\n * Use something other than image->rendering_intent to record the fact\n * that the sRGB profile was found.\n *\n * Record the ICC version (currently v2 or v4) of the incoming sRGB ICC\n * profile. Record the Blackpoint Compensation, if any.\n */\n if (ping_exclude_sRGB == MagickFalse && ping_preserve_iCCP == MagickFalse)\n {\n char\n *name;\n\n const StringInfo\n *profile;\n\n ResetImageProfileIterator(image);\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n\n {\n int\n icheck,\n got_crc=0;\n\n\n png_uint_32\n length,\n profile_crc=0;\n\n unsigned char\n *data;\n\n length=(png_uint_32) GetStringInfoLength(profile);\n\n for (icheck=0; sRGB_info[icheck].len > 0; icheck++)\n {\n if (length == sRGB_info[icheck].len)\n {\n if (got_crc == 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Got a %lu-byte ICC profile (potentially sRGB)\",\n (unsigned long) length);\n\n data=GetStringInfoDatum(profile);\n profile_crc=crc32(0,data,length);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" with crc=%8x\",(unsigned int) profile_crc);\n got_crc++;\n }\n\n if (profile_crc == sRGB_info[icheck].crc)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" It is sRGB with rendering intent = %s\",\n Magick_RenderingIntentString_from_PNG_RenderingIntent(\n sRGB_info[icheck].intent));\n if (image->rendering_intent==UndefinedIntent)\n {\n image->rendering_intent=\n Magick_RenderingIntent_from_PNG_RenderingIntent(\n sRGB_info[icheck].intent);\n }\n ping_exclude_iCCP = MagickTrue;\n ping_exclude_zCCP = MagickTrue;\n ping_have_sRGB = MagickTrue;\n break;\n }\n }\n }\n if (sRGB_info[icheck].len == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Got %lu-byte ICC profile not recognized as sRGB\",\n (unsigned long) length);\n }\n }\n name=GetNextImageProfile(image);\n }\n }\n\n number_opaque = 0;\n number_semitransparent = 0;\n number_transparent = 0;\n\n if (logging != MagickFalse)\n {\n if (image->storage_class == UndefinedClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=UndefinedClass\");\n if (image->storage_class == DirectClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=DirectClass\");\n if (image->storage_class == PseudoClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=PseudoClass\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(), image->taint ?\n \" image->taint=MagickTrue\":\n \" image->taint=MagickFalse\");\n }\n\n if (image->storage_class == PseudoClass &&\n (mng_info->write_png8 || mng_info->write_png24 || mng_info->write_png32 ||\n mng_info->write_png48 || mng_info->write_png64 ||\n (mng_info->write_png_colortype != 1 &&\n mng_info->write_png_colortype != 5)))\n {\n (void) SyncImage(image,exception);\n image->storage_class = DirectClass;\n }\n\n if (ping_preserve_colormap == MagickFalse)\n {\n if (image->storage_class != PseudoClass && image->colormap != NULL)\n {\n /* Free the bogus colormap; it can cause trouble later */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Freeing bogus colormap\");\n (void) RelinquishMagickMemory(image->colormap);\n image->colormap=NULL;\n }\n }\n\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n\n /*\n Sometimes we get PseudoClass images whose RGB values don't match\n the colors in the colormap. This code syncs the RGB values.\n */\n if (image->depth <= 8 && image->taint && image->storage_class == PseudoClass)\n (void) SyncImage(image,exception);\n\n#if (MAGICKCORE_QUANTUM_DEPTH == 8)\n if (image->depth > 8)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reducing PNG bit depth to 8 since this is a Q8 build.\");\n\n image->depth=8;\n }\n#endif\n\n /* Respect the -depth option */\n if (image->depth < 4)\n {\n register Quantum\n *r;\n\n if (image->depth > 2)\n {\n /* Scale to 4-bit */\n LBR04PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR04PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR04PacketRGBO(image->colormap[i]);\n }\n }\n }\n else if (image->depth > 1)\n {\n /* Scale to 2-bit */\n LBR02PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR02PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR02PacketRGBO(image->colormap[i]);\n }\n }\n }\n else\n {\n /* Scale to 1-bit */\n LBR01PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR01PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR01PacketRGBO(image->colormap[i]);\n }\n }\n }\n }\n\n /* To do: set to next higher multiple of 8 */\n if (image->depth < 8)\n image->depth=8;\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n /* PNG does not handle depths greater than 16 so reduce it even\n * if lossy\n */\n if (image->depth > 8)\n image->depth=16;\n#endif\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 8)\n if (image->depth > 8)\n {\n /* To do: fill low byte properly */\n image->depth=16;\n }\n\n if (image->depth == 16 && mng_info->write_png_depth != 16)\n if (mng_info->write_png8 ||\n LosslessReduceDepthOK(image,exception) != MagickFalse)\n image->depth = 8;\n#endif\n\n image_colors = (int) image->colors;\n number_opaque = (int) image->colors;\n number_transparent = 0;\n number_semitransparent = 0;\n\n if (mng_info->write_png_colortype &&\n (mng_info->write_png_colortype > 4 || (mng_info->write_png_depth >= 8 &&\n mng_info->write_png_colortype < 4 &&\n image->alpha_trait == UndefinedPixelTrait)))\n {\n /* Avoid the expensive BUILD_PALETTE operation if we're sure that we\n * are not going to need the result.\n */\n if (mng_info->write_png_colortype == 1 ||\n mng_info->write_png_colortype == 5)\n ping_have_color=MagickFalse;\n\n if (image->alpha_trait != UndefinedPixelTrait)\n {\n number_transparent = 2;\n number_semitransparent = 1;\n }\n }\n\n if (mng_info->write_png_colortype < 7)\n {\n /* BUILD_PALETTE\n *\n * Normally we run this just once, but in the case of writing PNG8\n * we reduce the transparency to binary and run again, then if there\n * are still too many colors we reduce to a simple 4-4-4-1, then 3-3-3-1\n * RGBA palette and run again, and then to a simple 3-3-2-1 RGBA\n * palette. Then (To do) we take care of a final reduction that is only\n * needed if there are still 256 colors present and one of them has both\n * transparent and opaque instances.\n */\n\n tried_332 = MagickFalse;\n tried_333 = MagickFalse;\n tried_444 = MagickFalse;\n\n for (j=0; j<6; j++)\n {\n /*\n * Sometimes we get DirectClass images that have 256 colors or fewer.\n * This code will build a colormap.\n *\n * Also, sometimes we get PseudoClass images with an out-of-date\n * colormap. This code will replace the colormap with a new one.\n * Sometimes we get PseudoClass images that have more than 256 colors.\n * This code will delete the colormap and change the image to\n * DirectClass.\n *\n * If image->alpha_trait is MagickFalse, we ignore the alpha channel\n * even though it sometimes contains left-over non-opaque values.\n *\n * Also we gather some information (number of opaque, transparent,\n * and semitransparent pixels, and whether the image has any non-gray\n * pixels or only black-and-white pixels) that we might need later.\n *\n * Even if the user wants to force GrayAlpha or RGBA (colortype 4 or 6)\n * we need to check for bogus non-opaque values, at least.\n */\n\n int\n n;\n\n PixelInfo\n opaque[260],\n semitransparent[260],\n transparent[260];\n\n register const Quantum\n *s;\n\n register Quantum\n *q,\n *r;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter BUILD_PALETTE:\");\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->columns=%.20g\",(double) image->columns);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->rows=%.20g\",(double) image->rows);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->alpha_trait=%.20g\",(double) image->alpha_trait);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->depth=%.20g\",(double) image->depth);\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Original colormap:\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" i (red,green,blue,alpha)\");\n\n for (i=0; i < 256; i++)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n\n for (i=image->colors - 10; i < (ssize_t) image->colors; i++)\n {\n if (i > 255)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n }\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d\",(int) image->colors);\n\n if (image->colors == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" (zero means unknown)\");\n\n if (ping_preserve_colormap == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Regenerate the colormap\");\n }\n\n image_colors=0;\n number_opaque = 0;\n number_semitransparent = 0;\n number_transparent = 0;\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (image->alpha_trait == UndefinedPixelTrait ||\n GetPixelAlpha(image,q) == OpaqueAlpha)\n {\n if (number_opaque < 259)\n {\n if (number_opaque == 0)\n {\n GetPixelInfoPixel(image, q, opaque);\n opaque[0].alpha=OpaqueAlpha;\n number_opaque=1;\n }\n\n for (i=0; i< (ssize_t) number_opaque; i++)\n {\n if (Magick_png_color_equal(image,q,opaque+i))\n break;\n }\n\n if (i == (ssize_t) number_opaque && number_opaque < 259)\n {\n number_opaque++;\n GetPixelInfoPixel(image, q, opaque+i);\n opaque[i].alpha=OpaqueAlpha;\n }\n }\n }\n else if (GetPixelAlpha(image,q) == TransparentAlpha)\n {\n if (number_transparent < 259)\n {\n if (number_transparent == 0)\n {\n GetPixelInfoPixel(image, q, transparent);\n ping_trans_color.red=(unsigned short)\n GetPixelRed(image,q);\n ping_trans_color.green=(unsigned short)\n GetPixelGreen(image,q);\n ping_trans_color.blue=(unsigned short)\n GetPixelBlue(image,q);\n ping_trans_color.gray=(unsigned short)\n GetPixelGray(image,q);\n number_transparent = 1;\n }\n\n for (i=0; i< (ssize_t) number_transparent; i++)\n {\n if (Magick_png_color_equal(image,q,transparent+i))\n break;\n }\n\n if (i == (ssize_t) number_transparent &&\n number_transparent < 259)\n {\n number_transparent++;\n GetPixelInfoPixel(image,q,transparent+i);\n }\n }\n }\n else\n {\n if (number_semitransparent < 259)\n {\n if (number_semitransparent == 0)\n {\n GetPixelInfoPixel(image,q,semitransparent);\n number_semitransparent = 1;\n }\n\n for (i=0; i< (ssize_t) number_semitransparent; i++)\n {\n if (Magick_png_color_equal(image,q,semitransparent+i)\n && GetPixelAlpha(image,q) ==\n semitransparent[i].alpha)\n break;\n }\n\n if (i == (ssize_t) number_semitransparent &&\n number_semitransparent < 259)\n {\n number_semitransparent++;\n GetPixelInfoPixel(image, q, semitransparent+i);\n }\n }\n }\n q+=GetPixelChannels(image);\n }\n }\n\n if (mng_info->write_png8 == MagickFalse &&\n ping_exclude_bKGD == MagickFalse)\n {\n /* Add the background color to the palette, if it\n * isn't already there.\n */\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Check colormap for background (%d,%d,%d)\",\n (int) image->background_color.red,\n (int) image->background_color.green,\n (int) image->background_color.blue);\n }\n for (i=0; ibackground_color.red &&\n opaque[i].green == image->background_color.green &&\n opaque[i].blue == image->background_color.blue)\n break;\n }\n if (number_opaque < 259 && i == number_opaque)\n {\n opaque[i] = image->background_color;\n ping_background.index = i;\n number_opaque++;\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",(int) i);\n }\n\n }\n else if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No room in the colormap to add background color\");\n }\n\n image_colors=number_opaque+number_transparent+number_semitransparent;\n\n if (logging != MagickFalse)\n {\n if (image_colors > 256)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has more than 256 colors\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has %d colors\",image_colors);\n }\n\n if (ping_preserve_colormap != MagickFalse)\n break;\n\n if (mng_info->write_png_colortype != 7) /* We won't need this info */\n {\n ping_have_color=MagickFalse;\n ping_have_non_bw=MagickFalse;\n\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"incompatible colorspace\");\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n }\n\n if(image_colors > 256)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n s=q;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelRed(image,s) != GetPixelGreen(image,s) ||\n GetPixelRed(image,s) != GetPixelBlue(image,s))\n {\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n break;\n }\n s+=GetPixelChannels(image);\n }\n\n if (ping_have_color != MagickFalse)\n break;\n\n /* Worst case is black-and-white; we are looking at every\n * pixel twice.\n */\n\n if (ping_have_non_bw == MagickFalse)\n {\n s=q;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelRed(image,s) != 0 &&\n GetPixelRed(image,s) != QuantumRange)\n {\n ping_have_non_bw=MagickTrue;\n break;\n }\n s+=GetPixelChannels(image);\n }\n }\n }\n }\n }\n\n if (image_colors < 257)\n {\n PixelInfo\n colormap[260];\n\n /*\n * Initialize image colormap.\n */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Sort the new colormap\");\n\n /* Sort palette, transparent first */;\n\n n = 0;\n\n for (i=0; iping_exclude_tRNS == MagickFalse ||\n (number_transparent == 0 && number_semitransparent == 0)) &&\n (((mng_info->write_png_colortype-1) ==\n PNG_COLOR_TYPE_PALETTE) ||\n (mng_info->write_png_colortype == 0)))\n {\n if (logging != MagickFalse)\n {\n if (n != (ssize_t) image_colors)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_colors (%d) and n (%d) don't match\",\n image_colors, n);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" AcquireImageColormap\");\n }\n\n image->colors = image_colors;\n\n if (AcquireImageColormap(image,image_colors,exception) ==\n MagickFalse)\n ThrowWriterException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n\n for (i=0; i< (ssize_t) image_colors; i++)\n image->colormap[i] = colormap[i];\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d (%d)\",\n (int) image->colors, image_colors);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Update the pixel indexes\");\n }\n\n /* Sync the pixel indices with the new colormap */\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n for (i=0; i< (ssize_t) image_colors; i++)\n {\n if ((image->alpha_trait == UndefinedPixelTrait ||\n image->colormap[i].alpha == GetPixelAlpha(image,q)) &&\n image->colormap[i].red == GetPixelRed(image,q) &&\n image->colormap[i].green == GetPixelGreen(image,q) &&\n image->colormap[i].blue == GetPixelBlue(image,q))\n {\n SetPixelIndex(image,i,q);\n break;\n }\n }\n q+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d\", (int) image->colors);\n\n if (image->colormap != NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" i (red,green,blue,alpha)\");\n\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n if (i < 300 || i >= (ssize_t) image->colors - 10)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n }\n }\n\n if (number_transparent < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_transparent = %d\",\n number_transparent);\n else\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_transparent > 256\");\n\n if (number_opaque < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_opaque = %d\",\n number_opaque);\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_opaque > 256\");\n\n if (number_semitransparent < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_semitransparent = %d\",\n number_semitransparent);\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_semitransparent > 256\");\n\n if (ping_have_non_bw == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" All pixels and the background are black or white\");\n\n else if (ping_have_color == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" All pixels and the background are gray\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" At least one pixel or the background is non-gray\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Exit BUILD_PALETTE:\");\n }\n\n if (mng_info->write_png8 == MagickFalse)\n break;\n\n /* Make any reductions necessary for the PNG8 format */\n if (image_colors <= 256 &&\n image_colors != 0 && image->colormap != NULL &&\n number_semitransparent == 0 &&\n number_transparent <= 1)\n break;\n\n /* PNG8 can't have semitransparent colors so we threshold the\n * opacity to 0 or OpaqueOpacity, and PNG8 can only have one\n * transparent color so if more than one is transparent we merge\n * them into image->background_color.\n */\n if (number_semitransparent != 0 || number_transparent > 1)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Thresholding the alpha channel to binary\");\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) < OpaqueAlpha/2)\n {\n SetPixelViaPixelInfo(image,&image->background_color,r);\n SetPixelAlpha(image,TransparentAlpha,r);\n }\n else\n SetPixelAlpha(image,OpaqueAlpha,r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n\n if (image_colors != 0 && image_colors <= 256 &&\n image->colormap != NULL)\n for (i=0; icolormap[i].alpha =\n (image->colormap[i].alpha > TransparentAlpha/2 ?\n TransparentAlpha : OpaqueAlpha);\n }\n continue;\n }\n\n /* PNG8 can't have more than 256 colors so we quantize the pixels and\n * background color to the 4-4-4-1, 3-3-3-1 or 3-3-2-1 palette. If the\n * image is mostly gray, the 4-4-4-1 palette is likely to end up with 256\n * colors or less.\n */\n if (tried_444 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 4-4-4\");\n\n tried_444 = MagickTrue;\n\n LBR04PacketRGB(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 4-4-4\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR04PixelRGB(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 4-4-4\");\n\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (tried_333 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 3-3-3\");\n\n tried_333 = MagickTrue;\n\n LBR03PacketRGB(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 3-3-3-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR03RGB(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 3-3-3-1\");\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (tried_332 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 3-3-2\");\n\n tried_332 = MagickTrue;\n\n /* Red and green were already done so we only quantize the blue\n * channel\n */\n\n LBR02PacketBlue(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 3-3-2-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR02PixelBlue(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 3-3-2-1\");\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (image_colors == 0 || image_colors > 256)\n {\n /* Take care of special case with 256 opaque colors + 1 transparent\n * color. We don't need to quantize to 2-3-2-1; we only need to\n * eliminate one color, so we'll merge the two darkest red\n * colors (0x49, 0, 0) -> (0x24, 0, 0).\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Merging two dark red background colors to 3-3-2-1\");\n\n if (ScaleQuantumToChar(image->background_color.red) == 0x49 &&\n ScaleQuantumToChar(image->background_color.green) == 0x00 &&\n ScaleQuantumToChar(image->background_color.blue) == 0x00)\n {\n image->background_color.red=ScaleCharToQuantum(0x24);\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Merging two dark red pixel colors to 3-3-2-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (ScaleQuantumToChar(GetPixelRed(image,r)) == 0x49 &&\n ScaleQuantumToChar(GetPixelGreen(image,r)) == 0x00 &&\n ScaleQuantumToChar(GetPixelBlue(image,r)) == 0x00 &&\n GetPixelAlpha(image,r) == OpaqueAlpha)\n {\n SetPixelRed(image,ScaleCharToQuantum(0x24),r);\n }\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n\n }\n }\n\n else\n {\n for (i=0; icolormap[i].red) == 0x49 &&\n ScaleQuantumToChar(image->colormap[i].green) == 0x00 &&\n ScaleQuantumToChar(image->colormap[i].blue) == 0x00)\n {\n image->colormap[i].red=ScaleCharToQuantum(0x24);\n }\n }\n }\n }\n }\n }\n /* END OF BUILD_PALETTE */\n\n /* If we are excluding the tRNS chunk and there is transparency,\n * then we must write a Gray-Alpha (color-type 4) or RGBA (color-type 6)\n * PNG.\n */\n if (mng_info->ping_exclude_tRNS != MagickFalse &&\n (number_transparent != 0 || number_semitransparent != 0))\n {\n unsigned int colortype=mng_info->write_png_colortype;\n\n if (ping_have_color == MagickFalse)\n mng_info->write_png_colortype = 5;\n\n else\n mng_info->write_png_colortype = 7;\n\n if (colortype != 0 &&\n mng_info->write_png_colortype != colortype)\n ping_need_colortype_warning=MagickTrue;\n\n }\n\n /* See if cheap transparency is possible. It is only possible\n * when there is a single transparent color, no semitransparent\n * color, and no opaque color that has the same RGB components\n * as the transparent color. We only need this information if\n * we are writing a PNG with colortype 0 or 2, and we have not\n * excluded the tRNS chunk.\n */\n if (number_transparent == 1 &&\n mng_info->write_png_colortype < 4)\n {\n ping_have_cheap_transparency = MagickTrue;\n\n if (number_semitransparent != 0)\n ping_have_cheap_transparency = MagickFalse;\n\n else if (image_colors == 0 || image_colors > 256 ||\n image->colormap == NULL)\n {\n register const Quantum\n *q;\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,q) != TransparentAlpha &&\n (unsigned short) GetPixelRed(image,q) ==\n ping_trans_color.red &&\n (unsigned short) GetPixelGreen(image,q) ==\n ping_trans_color.green &&\n (unsigned short) GetPixelBlue(image,q) ==\n ping_trans_color.blue)\n {\n ping_have_cheap_transparency = MagickFalse;\n break;\n }\n\n q+=GetPixelChannels(image);\n }\n\n if (ping_have_cheap_transparency == MagickFalse)\n break;\n }\n }\n else\n {\n /* Assuming that image->colormap[0] is the one transparent color\n * and that all others are opaque.\n */\n if (image_colors > 1)\n for (i=1; icolormap[i].red == image->colormap[0].red &&\n image->colormap[i].green == image->colormap[0].green &&\n image->colormap[i].blue == image->colormap[0].blue)\n {\n ping_have_cheap_transparency = MagickFalse;\n break;\n }\n }\n\n if (logging != MagickFalse)\n {\n if (ping_have_cheap_transparency == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Cheap transparency is not possible.\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Cheap transparency is possible.\");\n }\n }\n else\n ping_have_cheap_transparency = MagickFalse;\n\n image_depth=image->depth;\n\n quantum_info = (QuantumInfo *) NULL;\n number_colors=0;\n image_colors=(int) image->colors;\n image_matte=image->alpha_trait !=\n UndefinedPixelTrait ? MagickTrue : MagickFalse;\n\n if (mng_info->write_png_colortype < 5)\n mng_info->IsPalette=image->storage_class == PseudoClass &&\n image_colors <= 256 && image->colormap != NULL;\n else\n mng_info->IsPalette = MagickFalse;\n\n if ((mng_info->write_png_colortype == 4 || mng_info->write_png8) &&\n (image->colors == 0 || image->colormap == NULL))\n {\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n (void) ThrowMagickException(exception,GetMagickModule(),CoderError,\n \"Cannot write PNG8 or color-type 3; colormap is NULL\",\n \"`%s'\",IMimage->filename);\n return(MagickFalse);\n }\n\n /*\n Allocate the PNG structures\n */\n#ifdef PNG_USER_MEM_SUPPORTED\n error_info.image=image;\n error_info.exception=exception;\n ping=png_create_write_struct_2(PNG_LIBPNG_VER_STRING,&error_info,\n MagickPNGErrorHandler,MagickPNGWarningHandler,(void *) NULL,\n (png_malloc_ptr) Magick_png_malloc,(png_free_ptr) Magick_png_free);\n\n#else\n ping=png_create_write_struct(PNG_LIBPNG_VER_STRING,&error_info,\n MagickPNGErrorHandler,MagickPNGWarningHandler);\n\n#endif\n if (ping == (png_struct *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n ping_info=png_create_info_struct(ping);\n\n if (ping_info == (png_info *) NULL)\n {\n png_destroy_write_struct(&ping,(png_info **) NULL);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n\n png_set_write_fn(ping,image,png_put_data,png_flush_data);\n pixel_info=(MemoryInfo *) NULL;\n\n if (setjmp(png_jmpbuf(ping)))\n {\n /*\n PNG write failed.\n */\n#ifdef PNG_DEBUG\n if (image_info->verbose)\n (void) printf(\"PNG write has failed.\\n\");\n#endif\n png_destroy_write_struct(&ping,&ping_info);\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n UnlockSemaphoreInfo(ping_semaphore);\n#endif\n\n if (pixel_info != (MemoryInfo *) NULL)\n pixel_info=RelinquishVirtualMemory(pixel_info);\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n\n if (ping_have_blob != MagickFalse)\n (void) CloseBlob(image);\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n return(MagickFalse);\n }\n\n /* { For navigation to end of SETJMP-protected block. Within this\n * block, use png_error() instead of Throwing an Exception, to ensure\n * that libpng is able to clean up, and that the semaphore is unlocked.\n */\n\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n LockSemaphoreInfo(ping_semaphore);\n#endif\n\n#ifdef PNG_BENIGN_ERRORS_SUPPORTED\n /* Allow benign errors */\n png_set_benign_errors(ping, 1);\n#endif\n\n#ifdef PNG_SET_USER_LIMITS_SUPPORTED\n /* Reject images with too many rows or columns */\n png_set_user_limits(ping,\n (png_uint_32) MagickMin(0x7fffffffL,\n GetMagickResourceLimit(WidthResource)),\n (png_uint_32) MagickMin(0x7fffffffL,\n GetMagickResourceLimit(HeightResource)));\n#endif /* PNG_SET_USER_LIMITS_SUPPORTED */\n\n /*\n Prepare PNG for writing.\n */\n\n#if defined(PNG_MNG_FEATURES_SUPPORTED)\n if (mng_info->write_mng)\n {\n (void) png_permit_mng_features(ping,PNG_ALL_MNG_FEATURES);\n# ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED\n /* Disable new libpng-1.5.10 feature when writing a MNG because\n * zero-length PLTE is OK\n */\n png_set_check_for_invalid_index (ping, 0);\n# endif\n }\n\n#else\n# ifdef PNG_WRITE_EMPTY_PLTE_SUPPORTED\n if (mng_info->write_mng)\n png_permit_empty_plte(ping,MagickTrue);\n\n# endif\n#endif\n\n x=0;\n\n ping_width=(png_uint_32) image->columns;\n ping_height=(png_uint_32) image->rows;\n\n if (mng_info->write_png8 || mng_info->write_png24 || mng_info->write_png32)\n image_depth=8;\n\n if (mng_info->write_png48 || mng_info->write_png64)\n image_depth=16;\n\n if (mng_info->write_png_depth != 0)\n image_depth=mng_info->write_png_depth;\n\n /* Adjust requested depth to next higher valid depth if necessary */\n if (image_depth > 8)\n image_depth=16;\n\n if ((image_depth > 4) && (image_depth < 8))\n image_depth=8;\n\n if (image_depth == 3)\n image_depth=4;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" width=%.20g\",(double) ping_width);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" height=%.20g\",(double) ping_height);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_matte=%.20g\",(double) image->alpha_trait);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->depth=%.20g\",(double) image->depth);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative ping_bit_depth=%.20g\",(double) image_depth);\n }\n\n save_image_depth=image_depth;\n ping_bit_depth=(png_byte) save_image_depth;\n\n\n#if defined(PNG_pHYs_SUPPORTED)\n if (ping_exclude_pHYs == MagickFalse)\n {\n if ((image->resolution.x != 0) && (image->resolution.y != 0) &&\n (!mng_info->write_mng || !mng_info->equal_physs))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up pHYs chunk\");\n\n if (image->units == PixelsPerInchResolution)\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_METER;\n ping_pHYs_x_resolution=\n (png_uint_32) ((100.0*image->resolution.x+0.5)/2.54);\n ping_pHYs_y_resolution=\n (png_uint_32) ((100.0*image->resolution.y+0.5)/2.54);\n }\n\n else if (image->units == PixelsPerCentimeterResolution)\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_METER;\n ping_pHYs_x_resolution=(png_uint_32) (100.0*image->resolution.x+0.5);\n ping_pHYs_y_resolution=(png_uint_32) (100.0*image->resolution.y+0.5);\n }\n\n else\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_UNKNOWN;\n ping_pHYs_x_resolution=(png_uint_32) image->resolution.x;\n ping_pHYs_y_resolution=(png_uint_32) image->resolution.y;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Set up PNG pHYs chunk: xres: %.20g, yres: %.20g, units: %d.\",\n (double) ping_pHYs_x_resolution,(double) ping_pHYs_y_resolution,\n (int) ping_pHYs_unit_type);\n ping_have_pHYs = MagickTrue;\n }\n }\n#endif\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if ((!mng_info->adjoin || !mng_info->equal_backgrounds))\n {\n unsigned int\n mask;\n\n mask=0xffff;\n if (ping_bit_depth == 8)\n mask=0x00ff;\n\n if (ping_bit_depth == 4)\n mask=0x000f;\n\n if (ping_bit_depth == 2)\n mask=0x0003;\n\n if (ping_bit_depth == 1)\n mask=0x0001;\n\n ping_background.red=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.red) & mask);\n\n ping_background.green=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.green) & mask);\n\n ping_background.blue=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.blue) & mask);\n\n ping_background.gray=(png_uint_16) ping_background.green;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk (1)\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_bit_depth=%d\",ping_bit_depth);\n }\n\n ping_have_bKGD = MagickTrue;\n }\n\n /*\n Select the color type.\n */\n matte=image_matte;\n old_bit_depth=0;\n\n if (mng_info->IsPalette && mng_info->write_png8)\n {\n /* To do: make this a function cause it's used twice, except\n for reducing the sample depth from 8. */\n\n number_colors=image_colors;\n\n ping_have_tRNS=MagickFalse;\n\n /*\n Set image palette.\n */\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up PLTE chunk with %d colors (%d)\",\n number_colors, image_colors);\n\n for (i=0; i < (ssize_t) number_colors; i++)\n {\n palette[i].red=ScaleQuantumToChar(image->colormap[i].red);\n palette[i].green=ScaleQuantumToChar(image->colormap[i].green);\n palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n#if MAGICKCORE_QUANTUM_DEPTH == 8\n \" %3ld (%3d,%3d,%3d)\",\n#else\n \" %5ld (%5d,%5d,%5d)\",\n#endif\n (long) i,palette[i].red,palette[i].green,palette[i].blue);\n\n }\n\n ping_have_PLTE=MagickTrue;\n image_depth=ping_bit_depth;\n ping_num_trans=0;\n\n if (matte != MagickFalse)\n {\n /*\n Identify which colormap entry is transparent.\n */\n assert(number_colors <= 256);\n assert(image->colormap != NULL);\n\n for (i=0; i < (ssize_t) number_transparent; i++)\n ping_trans_alpha[i]=0;\n\n\n ping_num_trans=(unsigned short) (number_transparent +\n number_semitransparent);\n\n if (ping_num_trans == 0)\n ping_have_tRNS=MagickFalse;\n\n else\n ping_have_tRNS=MagickTrue;\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n /*\n * Identify which colormap entry is the background color.\n */\n\n for (i=0; i < (ssize_t) MagickMax(1L*number_colors-1L,1L); i++)\n if (IsPNGColorEqual(ping_background,image->colormap[i]))\n break;\n\n ping_background.index=(png_byte) i;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n }\n }\n } /* end of write_png8 */\n\n else if (mng_info->write_png_colortype == 1)\n {\n image_matte=MagickFalse;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;\n }\n\n else if (mng_info->write_png24 || mng_info->write_png48 ||\n mng_info->write_png_colortype == 3)\n {\n image_matte=MagickFalse;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n }\n\n else if (mng_info->write_png32 || mng_info->write_png64 ||\n mng_info->write_png_colortype == 7)\n {\n image_matte=MagickTrue;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA;\n }\n\n else /* mng_info->write_pngNN not specified */\n {\n image_depth=ping_bit_depth;\n\n if (mng_info->write_png_colortype != 0)\n {\n ping_color_type=(png_byte) mng_info->write_png_colortype-1;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||\n ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA)\n image_matte=MagickTrue;\n\n else\n image_matte=MagickFalse;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG colortype %d was specified:\",(int) ping_color_type);\n }\n\n else /* write_png_colortype not specified */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Selecting PNG colortype:\");\n\n ping_color_type=(png_byte) ((matte != MagickFalse)?\n PNG_COLOR_TYPE_RGB_ALPHA:PNG_COLOR_TYPE_RGB);\n\n if (image_info->type == TrueColorType)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n image_matte=MagickFalse;\n }\n\n if (image_info->type == TrueColorAlphaType)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA;\n image_matte=MagickTrue;\n }\n\n if (image_info->type == PaletteType ||\n image_info->type == PaletteAlphaType)\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (mng_info->write_png_colortype == 0 &&\n image_info->type == UndefinedType)\n {\n if (ping_have_color == MagickFalse)\n {\n if (image_matte == MagickFalse)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;\n image_matte=MagickFalse;\n }\n\n else\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY_ALPHA;\n image_matte=MagickTrue;\n }\n }\n else\n {\n if (image_matte == MagickFalse)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n image_matte=MagickFalse;\n }\n\n else\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGBA;\n image_matte=MagickTrue;\n }\n }\n }\n\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Selected PNG colortype=%d\",ping_color_type);\n\n if (ping_bit_depth < 8)\n {\n if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||\n ping_color_type == PNG_COLOR_TYPE_RGB ||\n ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA)\n ping_bit_depth=8;\n }\n\n old_bit_depth=ping_bit_depth;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (image->alpha_trait == UndefinedPixelTrait &&\n ping_have_non_bw == MagickFalse)\n ping_bit_depth=1;\n }\n\n if (ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n size_t one = 1;\n ping_bit_depth=1;\n\n if (image->colors == 0)\n {\n /* DO SOMETHING */\n png_error(ping,\"image has 0 colors\");\n }\n\n while ((int) (one << ping_bit_depth) < (ssize_t) image_colors)\n ping_bit_depth <<= 1;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number of colors: %.20g\",(double) image_colors);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative PNG bit depth: %d\",ping_bit_depth);\n }\n\n if (ping_bit_depth < (int) mng_info->write_png_depth)\n ping_bit_depth = mng_info->write_png_depth;\n }\n\n image_depth=ping_bit_depth;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative PNG color type: %s (%.20g)\",\n PngColorTypeToString(ping_color_type),\n (double) ping_color_type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_info->type: %.20g\",(double) image_info->type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_depth: %.20g\",(double) image_depth);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n\n \" image->depth: %.20g\",(double) image->depth);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_bit_depth: %.20g\",(double) ping_bit_depth);\n }\n\n if (matte != MagickFalse)\n {\n if (mng_info->IsPalette)\n {\n if (mng_info->write_png_colortype == 0)\n {\n ping_color_type=PNG_COLOR_TYPE_GRAY_ALPHA;\n\n if (ping_have_color != MagickFalse)\n ping_color_type=PNG_COLOR_TYPE_RGBA;\n }\n\n /*\n * Determine if there is any transparent color.\n */\n if (number_transparent + number_semitransparent == 0)\n {\n /*\n No transparent pixels are present. Change 4 or 6 to 0 or 2.\n */\n\n image_matte=MagickFalse;\n\n if (mng_info->write_png_colortype == 0)\n ping_color_type&=0x03;\n }\n\n else\n {\n unsigned int\n mask;\n\n mask=0xffff;\n\n if (ping_bit_depth == 8)\n mask=0x00ff;\n\n if (ping_bit_depth == 4)\n mask=0x000f;\n\n if (ping_bit_depth == 2)\n mask=0x0003;\n\n if (ping_bit_depth == 1)\n mask=0x0001;\n\n ping_trans_color.red=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].red) & mask);\n\n ping_trans_color.green=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].green) & mask);\n\n ping_trans_color.blue=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].blue) & mask);\n\n ping_trans_color.gray=(png_uint_16)\n (ScaleQuantumToShort(GetPixelInfoIntensity(image,\n image->colormap)) & mask);\n\n ping_trans_color.index=(png_byte) 0;\n\n ping_have_tRNS=MagickTrue;\n }\n\n if (ping_have_tRNS != MagickFalse)\n {\n /*\n * Determine if there is one and only one transparent color\n * and if so if it is fully transparent.\n */\n if (ping_have_cheap_transparency == MagickFalse)\n ping_have_tRNS=MagickFalse;\n }\n\n if (ping_have_tRNS != MagickFalse)\n {\n if (mng_info->write_png_colortype == 0)\n ping_color_type &= 0x03; /* changes 4 or 6 to 0 or 2 */\n\n if (image_depth == 8)\n {\n ping_trans_color.red&=0xff;\n ping_trans_color.green&=0xff;\n ping_trans_color.blue&=0xff;\n ping_trans_color.gray&=0xff;\n }\n }\n }\n else\n {\n if (image_depth == 8)\n {\n ping_trans_color.red&=0xff;\n ping_trans_color.green&=0xff;\n ping_trans_color.blue&=0xff;\n ping_trans_color.gray&=0xff;\n }\n }\n }\n\n matte=image_matte;\n\n if (ping_have_tRNS != MagickFalse)\n image_matte=MagickFalse;\n\n if ((mng_info->IsPalette) &&\n mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE &&\n ping_have_color == MagickFalse &&\n (image_matte == MagickFalse || image_depth >= 8))\n {\n size_t one=1;\n\n if (image_matte != MagickFalse)\n ping_color_type=PNG_COLOR_TYPE_GRAY_ALPHA;\n\n else if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n ping_color_type=PNG_COLOR_TYPE_GRAY;\n\n if (save_image_depth == 16 && image_depth == 8)\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color (0)\");\n }\n ping_trans_color.gray*=0x0101;\n }\n }\n\n if (image_depth > MAGICKCORE_QUANTUM_DEPTH)\n image_depth=MAGICKCORE_QUANTUM_DEPTH;\n\n if ((image_colors == 0) ||\n ((ssize_t) (image_colors-1) > (ssize_t) MaxColormapSize))\n image_colors=(int) (one << image_depth);\n\n if (image_depth > 8)\n ping_bit_depth=16;\n\n else\n {\n ping_bit_depth=8;\n if ((int) ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n if(!mng_info->write_png_depth)\n {\n ping_bit_depth=1;\n\n while ((int) (one << ping_bit_depth)\n < (ssize_t) image_colors)\n ping_bit_depth <<= 1;\n }\n }\n\n else if (ping_color_type ==\n PNG_COLOR_TYPE_GRAY && image_colors < 17 &&\n mng_info->IsPalette)\n {\n /* Check if grayscale is reducible */\n\n int\n depth_4_ok=MagickTrue,\n depth_2_ok=MagickTrue,\n depth_1_ok=MagickTrue;\n\n for (i=0; i < (ssize_t) image_colors; i++)\n {\n unsigned char\n intensity;\n\n intensity=ScaleQuantumToChar(image->colormap[i].red);\n\n if ((intensity & 0x0f) != ((intensity & 0xf0) >> 4))\n depth_4_ok=depth_2_ok=depth_1_ok=MagickFalse;\n else if ((intensity & 0x03) != ((intensity & 0x0c) >> 2))\n depth_2_ok=depth_1_ok=MagickFalse;\n else if ((intensity & 0x01) != ((intensity & 0x02) >> 1))\n depth_1_ok=MagickFalse;\n }\n\n if (depth_1_ok && mng_info->write_png_depth <= 1)\n ping_bit_depth=1;\n\n else if (depth_2_ok && mng_info->write_png_depth <= 2)\n ping_bit_depth=2;\n\n else if (depth_4_ok && mng_info->write_png_depth <= 4)\n ping_bit_depth=4;\n }\n }\n\n image_depth=ping_bit_depth;\n }\n\n else\n\n if (mng_info->IsPalette)\n {\n number_colors=image_colors;\n\n if (image_depth <= 8)\n {\n /*\n Set image palette.\n */\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (!(mng_info->have_write_global_plte && matte == MagickFalse))\n {\n for (i=0; i < (ssize_t) number_colors; i++)\n {\n palette[i].red=ScaleQuantumToChar(image->colormap[i].red);\n palette[i].green=\n ScaleQuantumToChar(image->colormap[i].green);\n palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up PLTE chunk with %d colors\",\n number_colors);\n\n ping_have_PLTE=MagickTrue;\n }\n\n /* color_type is PNG_COLOR_TYPE_PALETTE */\n if (mng_info->write_png_depth == 0)\n {\n size_t\n one;\n\n ping_bit_depth=1;\n one=1;\n\n while ((one << ping_bit_depth) < (size_t) number_colors)\n ping_bit_depth <<= 1;\n }\n\n ping_num_trans=0;\n\n if (matte != MagickFalse)\n {\n /*\n * Set up trans_colors array.\n */\n assert(number_colors <= 256);\n\n ping_num_trans=(unsigned short) (number_transparent +\n number_semitransparent);\n\n if (ping_num_trans == 0)\n ping_have_tRNS=MagickFalse;\n\n else\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color (1)\");\n }\n ping_have_tRNS=MagickTrue;\n\n for (i=0; i < ping_num_trans; i++)\n {\n ping_trans_alpha[i]= (png_byte)\n ScaleQuantumToChar(image->colormap[i].alpha);\n }\n }\n }\n }\n }\n\n else\n {\n\n if (image_depth < 8)\n image_depth=8;\n\n if ((save_image_depth == 16) && (image_depth == 8))\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color from (%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n\n ping_trans_color.red*=0x0101;\n ping_trans_color.green*=0x0101;\n ping_trans_color.blue*=0x0101;\n ping_trans_color.gray*=0x0101;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" to (%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n }\n }\n\n if (ping_bit_depth < (ssize_t) mng_info->write_png_depth)\n ping_bit_depth = (ssize_t) mng_info->write_png_depth;\n\n /*\n Adjust background and transparency samples in sub-8-bit grayscale files.\n */\n if (ping_bit_depth < 8 && ping_color_type ==\n PNG_COLOR_TYPE_GRAY)\n {\n png_uint_16\n maxval;\n\n size_t\n one=1;\n\n maxval=(png_uint_16) ((one << ping_bit_depth)-1);\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n\n ping_background.gray=(png_uint_16) ((maxval/65535.)*\n (ScaleQuantumToShort(((GetPixelInfoIntensity(image,\n &image->background_color))) +.5)));\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk (2)\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n\n ping_have_bKGD = MagickTrue;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color.gray from %d\",\n (int)ping_trans_color.gray);\n\n ping_trans_color.gray=(png_uint_16) ((maxval/255.)*(\n ping_trans_color.gray)+.5);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" to %d\", (int)ping_trans_color.gray);\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if (mng_info->IsPalette && (int) ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n /*\n Identify which colormap entry is the background color.\n */\n\n number_colors=image_colors;\n\n for (i=0; i < (ssize_t) MagickMax(1L*number_colors,1L); i++)\n if (IsPNGColorEqual(image->background_color,image->colormap[i]))\n break;\n\n ping_background.index=(png_byte) i;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk with index=%d\",(int) i);\n }\n\n if (i < (ssize_t) number_colors)\n {\n ping_have_bKGD = MagickTrue;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background =(%d,%d,%d)\",\n (int) ping_background.red,\n (int) ping_background.green,\n (int) ping_background.blue);\n }\n }\n\n else /* Can't happen */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No room in PLTE to add bKGD color\");\n ping_have_bKGD = MagickFalse;\n }\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG color type: %s (%d)\", PngColorTypeToString(ping_color_type),\n ping_color_type);\n /*\n Initialize compression level and filtering.\n */\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up deflate compression\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression buffer size: 32768\");\n }\n\n png_set_compression_buffer_size(ping,32768L);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression mem level: 9\");\n\n png_set_compression_mem_level(ping, 9);\n\n /* Untangle the \"-quality\" setting:\n\n Undefined is 0; the default is used.\n Default is 75\n\n 10's digit:\n\n 0 or omitted: Use Z_HUFFMAN_ONLY strategy with the\n zlib default compression level\n\n 1-9: the zlib compression level\n\n 1's digit:\n\n 0-4: the PNG filter method\n\n 5: libpng adaptive filtering if compression level > 5\n libpng filter type \"none\" if compression level <= 5\n or if image is grayscale or palette\n\n 6: libpng adaptive filtering\n\n 7: \"LOCO\" filtering (intrapixel differing) if writing\n a MNG, otherwise \"none\". Did not work in IM-6.7.0-9\n and earlier because of a missing \"else\".\n\n 8: Z_RLE strategy (or Z_HUFFMAN_ONLY if quality < 10), adaptive\n filtering. Unused prior to IM-6.7.0-10, was same as 6\n\n 9: Z_RLE strategy (or Z_HUFFMAN_ONLY if quality < 10), no PNG filters\n Unused prior to IM-6.7.0-10, was same as 6\n\n Note that using the -quality option, not all combinations of\n PNG filter type, zlib compression level, and zlib compression\n strategy are possible. This will be addressed soon in a\n release that accomodates \"-define png:compression-strategy\", etc.\n\n */\n\n quality=image_info->quality == UndefinedCompressionQuality ? 75UL :\n image_info->quality;\n\n if (quality <= 9)\n {\n if (mng_info->write_png_compression_strategy == 0)\n mng_info->write_png_compression_strategy = Z_HUFFMAN_ONLY+1;\n }\n\n else if (mng_info->write_png_compression_level == 0)\n {\n int\n level;\n\n level=(int) MagickMin((ssize_t) quality/10,9);\n\n mng_info->write_png_compression_level = level+1;\n }\n\n if (mng_info->write_png_compression_strategy == 0)\n {\n if ((quality %10) == 8 || (quality %10) == 9)\n#ifdef Z_RLE /* Z_RLE was added to zlib-1.2.0 */\n mng_info->write_png_compression_strategy=Z_RLE+1;\n#else\n mng_info->write_png_compression_strategy = Z_DEFAULT_STRATEGY+1;\n#endif\n }\n\n if (mng_info->write_png_compression_filter == 0)\n mng_info->write_png_compression_filter=((int) quality % 10) + 1;\n\n if (logging != MagickFalse)\n {\n if (mng_info->write_png_compression_level)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression level: %d\",\n (int) mng_info->write_png_compression_level-1);\n\n if (mng_info->write_png_compression_strategy)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression strategy: %d\",\n (int) mng_info->write_png_compression_strategy-1);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up filtering\");\n\n if (mng_info->write_png_compression_filter == 6)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: ADAPTIVE\");\n else if (mng_info->write_png_compression_filter == 0 ||\n mng_info->write_png_compression_filter == 1)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: NONE\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: %d\",\n (int) mng_info->write_png_compression_filter-1);\n }\n\n if (mng_info->write_png_compression_level != 0)\n png_set_compression_level(ping,mng_info->write_png_compression_level-1);\n\n if (mng_info->write_png_compression_filter == 6)\n {\n if (((int) ping_color_type == PNG_COLOR_TYPE_GRAY) ||\n ((int) ping_color_type == PNG_COLOR_TYPE_PALETTE) ||\n (quality < 50))\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n else\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_ALL_FILTERS);\n }\n else if (mng_info->write_png_compression_filter == 7 ||\n mng_info->write_png_compression_filter == 10)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_ALL_FILTERS);\n\n else if (mng_info->write_png_compression_filter == 8)\n {\n#if defined(PNG_MNG_FEATURES_SUPPORTED) && defined(PNG_INTRAPIXEL_DIFFERENCING)\n if (mng_info->write_mng)\n {\n if (((int) ping_color_type == PNG_COLOR_TYPE_RGB) ||\n ((int) ping_color_type == PNG_COLOR_TYPE_RGBA))\n ping_filter_method=PNG_INTRAPIXEL_DIFFERENCING;\n }\n#endif\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n }\n\n else if (mng_info->write_png_compression_filter == 9)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n\n else if (mng_info->write_png_compression_filter != 0)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,\n mng_info->write_png_compression_filter-1);\n\n if (mng_info->write_png_compression_strategy != 0)\n png_set_compression_strategy(ping,\n mng_info->write_png_compression_strategy-1);\n\n ping_interlace_method=image_info->interlace != NoInterlace;\n\n if (mng_info->write_mng)\n png_set_sig_bytes(ping,8);\n\n /* Bail out if cannot meet defined png:bit-depth or png:color-type */\n\n if (mng_info->write_png_colortype != 0)\n {\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_GRAY)\n if (ping_have_color != MagickFalse)\n {\n ping_color_type = PNG_COLOR_TYPE_RGB;\n\n if (ping_bit_depth < 8)\n ping_bit_depth=8;\n }\n\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_GRAY_ALPHA)\n if (ping_have_color != MagickFalse)\n ping_color_type = PNG_COLOR_TYPE_RGB_ALPHA;\n }\n\n if (ping_need_colortype_warning != MagickFalse ||\n ((mng_info->write_png_depth &&\n (int) mng_info->write_png_depth != ping_bit_depth) ||\n (mng_info->write_png_colortype &&\n ((int) mng_info->write_png_colortype-1 != ping_color_type &&\n mng_info->write_png_colortype != 7 &&\n !(mng_info->write_png_colortype == 5 && ping_color_type == 0)))))\n {\n if (logging != MagickFalse)\n {\n if (ping_need_colortype_warning != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image has transparency but tRNS chunk was excluded\");\n }\n\n if (mng_info->write_png_depth)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:bit-depth=%u, Computed depth=%u\",\n mng_info->write_png_depth,\n ping_bit_depth);\n }\n\n if (mng_info->write_png_colortype)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:color-type=%u, Computed color type=%u\",\n mng_info->write_png_colortype-1,\n ping_color_type);\n }\n }\n\n png_warning(ping,\n \"Cannot write image with defined png:bit-depth or png:color-type.\");\n }\n\n if (image_matte != MagickFalse && image->alpha_trait == UndefinedPixelTrait)\n {\n /* Add an opaque matte channel */\n image->alpha_trait = BlendPixelTrait;\n (void) SetImageAlpha(image,OpaqueAlpha,exception);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Added an opaque matte channel\");\n }\n\n if (number_transparent != 0 || number_semitransparent != 0)\n {\n if (ping_color_type < 4)\n {\n ping_have_tRNS=MagickTrue;\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting ping_have_tRNS=MagickTrue.\");\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG header chunks\");\n\n png_set_IHDR(ping,ping_info,ping_width,ping_height,\n ping_bit_depth,ping_color_type,\n ping_interlace_method,ping_compression_method,\n ping_filter_method);\n\n if (ping_color_type == 3 && ping_have_PLTE != MagickFalse)\n {\n png_set_PLTE(ping,ping_info,palette,number_colors);\n\n if (logging != MagickFalse)\n {\n for (i=0; i< (ssize_t) number_colors; i++)\n {\n if (i < ping_num_trans)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PLTE[%d] = (%d,%d,%d), tRNS[%d] = (%d)\",\n (int) i,\n (int) palette[i].red,\n (int) palette[i].green,\n (int) palette[i].blue,\n (int) i,\n (int) ping_trans_alpha[i]);\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PLTE[%d] = (%d,%d,%d)\",\n (int) i,\n (int) palette[i].red,\n (int) palette[i].green,\n (int) palette[i].blue);\n }\n }\n }\n\n /* Only write the iCCP chunk if we are not writing the sRGB chunk. */\n if (ping_exclude_sRGB != MagickFalse ||\n (!png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n {\n if ((ping_exclude_tEXt == MagickFalse ||\n ping_exclude_zTXt == MagickFalse) &&\n (ping_exclude_iCCP == MagickFalse || ping_exclude_zCCP == MagickFalse))\n {\n ResetImageProfileIterator(image);\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n#ifdef PNG_WRITE_iCCP_SUPPORTED\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n {\n ping_have_iCCP = MagickTrue;\n if (ping_exclude_iCCP == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up iCCP chunk\");\n\n png_set_iCCP(ping,ping_info,(png_charp) name,0,\n#if (PNG_LIBPNG_VER < 10500)\n (png_charp) GetStringInfoDatum(profile),\n#else\n (const png_byte *) GetStringInfoDatum(profile),\n#endif\n (png_uint_32) GetStringInfoLength(profile));\n }\n else\n {\n /* Do not write hex-encoded ICC chunk */\n name=GetNextImageProfile(image);\n continue;\n }\n }\n#endif /* WRITE_iCCP */\n\n if (LocaleCompare(name,\"exif\") == 0)\n {\n /* Do not write hex-encoded ICC chunk; we will\n write it later as an eXIf chunk */\n name=GetNextImageProfile(image);\n continue;\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up zTXt chunk with uuencoded %s profile\",\n name);\n Magick_png_write_raw_profile(image_info,ping,ping_info,\n (unsigned char *) name,(unsigned char *) name,\n GetStringInfoDatum(profile),\n (png_uint_32) GetStringInfoLength(profile));\n }\n name=GetNextImageProfile(image);\n }\n }\n }\n\n#if defined(PNG_WRITE_sRGB_SUPPORTED)\n if ((mng_info->have_write_global_srgb == 0) &&\n ping_have_iCCP != MagickTrue &&\n (ping_have_sRGB != MagickFalse ||\n png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n {\n if (ping_exclude_sRGB == MagickFalse)\n {\n /*\n Note image rendering intent.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up sRGB chunk\");\n\n (void) png_set_sRGB(ping,ping_info,(\n Magick_RenderingIntent_to_PNG_RenderingIntent(\n image->rendering_intent)));\n\n ping_have_sRGB = MagickTrue;\n }\n }\n\n if ((!mng_info->write_mng) || (!png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n#endif\n {\n if (ping_exclude_gAMA == MagickFalse &&\n ping_have_iCCP == MagickFalse &&\n ping_have_sRGB == MagickFalse &&\n (ping_exclude_sRGB == MagickFalse ||\n (image->gamma < .45 || image->gamma > .46)))\n {\n if ((mng_info->have_write_global_gama == 0) && (image->gamma != 0.0))\n {\n /*\n Note image gamma.\n To do: check for cHRM+gAMA == sRGB, and write sRGB instead.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up gAMA chunk\");\n\n png_set_gAMA(ping,ping_info,image->gamma);\n }\n }\n\n if (ping_exclude_cHRM == MagickFalse && ping_have_sRGB == MagickFalse)\n {\n if ((mng_info->have_write_global_chrm == 0) &&\n (image->chromaticity.red_primary.x != 0.0))\n {\n /*\n Note image chromaticity.\n Note: if cHRM+gAMA == sRGB write sRGB instead.\n */\n PrimaryInfo\n bp,\n gp,\n rp,\n wp;\n\n wp=image->chromaticity.white_point;\n rp=image->chromaticity.red_primary;\n gp=image->chromaticity.green_primary;\n bp=image->chromaticity.blue_primary;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up cHRM chunk\");\n\n png_set_cHRM(ping,ping_info,wp.x,wp.y,rp.x,rp.y,gp.x,gp.y,\n bp.x,bp.y);\n }\n }\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if (ping_have_bKGD != MagickFalse)\n {\n png_set_bKGD(ping,ping_info,&ping_background);\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background color = (%d,%d,%d)\",\n (int) ping_background.red,\n (int) ping_background.green,\n (int) ping_background.blue);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" index = %d, gray=%d\",\n (int) ping_background.index,\n (int) ping_background.gray);\n }\n }\n }\n\n if (ping_exclude_pHYs == MagickFalse)\n {\n if (ping_have_pHYs != MagickFalse)\n {\n png_set_pHYs(ping,ping_info,\n ping_pHYs_x_resolution,\n ping_pHYs_y_resolution,\n ping_pHYs_unit_type);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up pHYs chunk\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" x_resolution=%lu\",\n (unsigned long) ping_pHYs_x_resolution);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" y_resolution=%lu\",\n (unsigned long) ping_pHYs_y_resolution);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" unit_type=%lu\",\n (unsigned long) ping_pHYs_unit_type);\n }\n }\n }\n\n#if defined(PNG_tIME_SUPPORTED)\n if (ping_exclude_tIME == MagickFalse)\n {\n const char\n *timestamp;\n\n if (image->taint == MagickFalse)\n {\n timestamp=GetImageOption(image_info,\"png:tIME\");\n\n if (timestamp == (const char *) NULL)\n timestamp=GetImageProperty(image,\"png:tIME\",exception);\n }\n\n else\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reset tIME in tainted image\");\n\n timestamp=GetImageProperty(image,\"date:modify\",exception);\n }\n\n if (timestamp != (const char *) NULL)\n write_tIME_chunk(image,ping,ping_info,timestamp,exception);\n }\n#endif\n\n if (mng_info->need_blob != MagickFalse)\n {\n if (OpenBlob(image_info,image,WriteBinaryBlobMode,exception) ==\n MagickFalse)\n png_error(ping,\"WriteBlob Failed\");\n\n ping_have_blob=MagickTrue;\n }\n\n png_write_info_before_PLTE(ping, ping_info);\n\n if (ping_have_tRNS != MagickFalse && ping_color_type < 4)\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Calling png_set_tRNS with num_trans=%d\",ping_num_trans);\n }\n\n if (ping_color_type == 3)\n (void) png_set_tRNS(ping, ping_info,\n ping_trans_alpha,\n ping_num_trans,\n NULL);\n\n else\n {\n (void) png_set_tRNS(ping, ping_info,\n NULL,\n 0,\n &ping_trans_color);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" tRNS color =(%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n }\n }\n\n /* write any png-chunk-b profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-b\",logging);\n\n png_write_info(ping,ping_info);\n\n /* write any PNG-chunk-m profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-m\",logging);\n\n ping_wrote_caNv = MagickFalse;\n\n /* write caNv chunk */\n if (ping_exclude_caNv == MagickFalse)\n {\n if ((image->page.width != 0 && image->page.width != image->columns) ||\n (image->page.height != 0 && image->page.height != image->rows) ||\n image->page.x != 0 || image->page.y != 0)\n {\n unsigned char\n chunk[20];\n\n (void) WriteBlobMSBULong(image,16L); /* data length=8 */\n PNGType(chunk,mng_caNv);\n LogPNGChunk(logging,mng_caNv,16L);\n PNGLong(chunk+4,(png_uint_32) image->page.width);\n PNGLong(chunk+8,(png_uint_32) image->page.height);\n PNGsLong(chunk+12,(png_int_32) image->page.x);\n PNGsLong(chunk+16,(png_int_32) image->page.y);\n (void) WriteBlob(image,20,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,20));\n ping_wrote_caNv = MagickTrue;\n }\n }\n\n#if defined(PNG_oFFs_SUPPORTED)\n if (ping_exclude_oFFs == MagickFalse && ping_wrote_caNv == MagickFalse)\n {\n if (image->page.x || image->page.y)\n {\n png_set_oFFs(ping,ping_info,(png_int_32) image->page.x,\n (png_int_32) image->page.y, 0);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up oFFs chunk with x=%d, y=%d, units=0\",\n (int) image->page.x, (int) image->page.y);\n }\n }\n#endif\n\n /* write vpAg chunk (deprecated, replaced by caNv) */\n if (ping_exclude_vpAg == MagickFalse && ping_wrote_caNv == MagickFalse)\n {\n if ((image->page.width != 0 && image->page.width != image->columns) ||\n (image->page.height != 0 && image->page.height != image->rows))\n {\n unsigned char\n chunk[14];\n\n (void) WriteBlobMSBULong(image,9L); /* data length=8 */\n PNGType(chunk,mng_vpAg);\n LogPNGChunk(logging,mng_vpAg,9L);\n PNGLong(chunk+4,(png_uint_32) image->page.width);\n PNGLong(chunk+8,(png_uint_32) image->page.height);\n chunk[12]=0; /* unit = pixels */\n (void) WriteBlob(image,13,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,13));\n }\n }\n\n#if (PNG_LIBPNG_VER == 10206)\n /* avoid libpng-1.2.6 bug by setting PNG_HAVE_IDAT flag */\n#define PNG_HAVE_IDAT 0x04\n ping->mode |= PNG_HAVE_IDAT;\n#undef PNG_HAVE_IDAT\n#endif\n\n png_set_packing(ping);\n /*\n Allocate memory.\n */\n rowbytes=image->columns;\n if (image_depth > 8)\n rowbytes*=2;\n switch (ping_color_type)\n {\n case PNG_COLOR_TYPE_RGB:\n rowbytes*=3;\n break;\n\n case PNG_COLOR_TYPE_GRAY_ALPHA:\n rowbytes*=2;\n break;\n\n case PNG_COLOR_TYPE_RGBA:\n rowbytes*=4;\n break;\n\n default:\n break;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG image data\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocating %.20g bytes of memory for pixels\",(double) rowbytes);\n }\n pixel_info=AcquireVirtualMemory(rowbytes,sizeof(*ping_pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n png_error(ping,\"Allocation of memory for pixels failed\");\n ping_pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n\n /*\n Initialize image scanlines.\n */\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n png_error(ping,\"Memory allocation for quantum_info failed\");\n quantum_info->format=UndefinedQuantumFormat;\n SetQuantumDepth(image,quantum_info,image_depth);\n (void) SetQuantumEndian(image,quantum_info,MSBEndian);\n num_passes=png_set_interlace_handling(ping);\n\n if ((!mng_info->write_png8 && !mng_info->write_png24 &&\n !mng_info->write_png48 && !mng_info->write_png64 &&\n !mng_info->write_png32) &&\n (mng_info->IsPalette ||\n (image_info->type == BilevelType)) &&\n image_matte == MagickFalse &&\n ping_have_non_bw == MagickFalse)\n {\n /* Palette, Bilevel, or Opaque Monochrome */\n register const Quantum\n *p;\n\n SetQuantumDepth(image,quantum_info,8);\n for (pass=0; pass < num_passes; pass++)\n {\n /*\n Convert PseudoClass image to a PNG monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (0)\");\n\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (mng_info->IsPalette)\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_PALETTE &&\n mng_info->write_png_depth &&\n mng_info->write_png_depth != old_bit_depth)\n {\n /* Undo pixel scaling */\n for (i=0; i < (ssize_t) image->columns; i++)\n *(ping_pixels+i)=(unsigned char) (*(ping_pixels+i)\n >> (8-old_bit_depth));\n }\n }\n\n else\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n }\n\n if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE)\n for (i=0; i < (ssize_t) image->columns; i++)\n *(ping_pixels+i)=(unsigned char) ((*(ping_pixels+i) > 127) ?\n 255 : 0);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (1)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n\n else /* Not Palette, Bilevel, or Opaque Monochrome */\n {\n if ((!mng_info->write_png8 && !mng_info->write_png24 &&\n !mng_info->write_png48 && !mng_info->write_png64 &&\n !mng_info->write_png32) && (image_matte != MagickFalse ||\n (ping_bit_depth >= MAGICKCORE_QUANTUM_DEPTH)) &&\n (mng_info->IsPalette) && ping_have_color == MagickFalse)\n {\n register const Quantum\n *p;\n\n for (pass=0; pass < num_passes; pass++)\n {\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (mng_info->IsPalette)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY PNG pixels (2)\");\n }\n\n else /* PNG_COLOR_TYPE_GRAY_ALPHA */\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (2)\");\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,exception);\n }\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (2)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n\n else\n {\n register const Quantum\n *p;\n\n for (pass=0; pass < num_passes; pass++)\n {\n if ((image_depth > 8) ||\n mng_info->write_png24 ||\n mng_info->write_png32 ||\n mng_info->write_png48 ||\n mng_info->write_png64 ||\n (!mng_info->write_png8 && !mng_info->IsPalette))\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (image->storage_class == DirectClass)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n }\n\n else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,\n exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (3)\");\n }\n\n else if (image_matte != MagickFalse)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RGBAQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RGBQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (3)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n\n else\n /* not ((image_depth > 8) ||\n mng_info->write_png24 || mng_info->write_png32 ||\n mng_info->write_png48 || mng_info->write_png64 ||\n (!mng_info->write_png8 && !mng_info->IsPalette))\n */\n {\n if ((ping_color_type != PNG_COLOR_TYPE_GRAY) &&\n (ping_color_type != PNG_COLOR_TYPE_GRAY_ALPHA))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" pass %d, Image Is not GRAY or GRAY_ALPHA\",pass);\n\n SetQuantumDepth(image,quantum_info,8);\n image_depth=8;\n }\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" pass %d, Image Is RGB, 16-bit GRAY, or GRAY_ALPHA\",\n pass);\n\n p=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n SetQuantumDepth(image,quantum_info,image->depth);\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n }\n\n else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (4)\");\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,\n exception);\n }\n\n else\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,IndexQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y <= 2)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of non-gray pixels (4)\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_pixels[0]=%d,ping_pixels[1]=%d\",\n (int)ping_pixels[0],(int)ping_pixels[1]);\n }\n }\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n }\n }\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Wrote PNG image data\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Width: %.20g\",(double) ping_width);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Height: %.20g\",(double) ping_height);\n\n if (mng_info->write_png_depth)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:bit-depth: %d\",mng_info->write_png_depth);\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG bit-depth written: %d\",ping_bit_depth);\n\n if (mng_info->write_png_colortype)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:color-type: %d\",mng_info->write_png_colortype-1);\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG color-type written: %d\",ping_color_type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG Interlace method: %d\",ping_interlace_method);\n }\n /*\n Generate text chunks after IDAT.\n */\n if (ping_exclude_tEXt == MagickFalse || ping_exclude_zTXt == MagickFalse)\n {\n ResetImagePropertyIterator(image);\n property=GetNextImageProperty(image);\n while (property != (const char *) NULL)\n {\n png_textp\n text;\n\n value=GetImageProperty(image,property,exception);\n\n /* Don't write any \"png:\" or \"jpeg:\" properties; those are just for\n * \"identify\" or for passing through to another JPEG\n */\n if ((LocaleNCompare(property,\"png:\",4) != 0 &&\n LocaleNCompare(property,\"jpeg:\",5) != 0) &&\n\n\n /* Suppress density and units if we wrote a pHYs chunk */\n (ping_exclude_pHYs != MagickFalse ||\n LocaleCompare(property,\"density\") != 0 ||\n LocaleCompare(property,\"units\") != 0) &&\n\n /* Suppress the IM-generated Date:create and Date:modify */\n (ping_exclude_date == MagickFalse ||\n LocaleNCompare(property, \"Date:\",5) != 0))\n {\n if (value != (const char *) NULL)\n {\n\n#if PNG_LIBPNG_VER >= 10400\n text=(png_textp) png_malloc(ping,\n (png_alloc_size_t) sizeof(png_text));\n#else\n text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text));\n#endif\n text[0].key=(char *) property;\n text[0].text=(char *) value;\n text[0].text_length=strlen(value);\n\n if (ping_exclude_tEXt != MagickFalse)\n text[0].compression=PNG_TEXT_COMPRESSION_zTXt;\n\n else if (ping_exclude_zTXt != MagickFalse)\n text[0].compression=PNG_TEXT_COMPRESSION_NONE;\n\n else\n {\n text[0].compression=image_info->compression == NoCompression ||\n (image_info->compression == UndefinedCompression &&\n text[0].text_length < 128) ? PNG_TEXT_COMPRESSION_NONE :\n PNG_TEXT_COMPRESSION_zTXt ;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up text chunk\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" keyword: '%s'\",text[0].key);\n }\n\n png_set_text(ping,ping_info,text,1);\n png_free(ping,text);\n }\n }\n property=GetNextImageProperty(image);\n }\n }\n\n /* write any PNG-chunk-e profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-e\",logging);\n\n /* write exIf profile */\n if (ping_have_eXIf != MagickFalse && ping_exclude_eXIf == MagickFalse)\n {\n char\n *name;\n\n ResetImageProfileIterator(image);\n\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n if (LocaleCompare(name,\"exif\") == 0)\n {\n const StringInfo\n *profile;\n\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n png_uint_32\n length;\n\n unsigned char\n chunk[4],\n *data;\n\n StringInfo\n *ping_profile;\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Have eXIf profile\");\n\n ping_profile=CloneStringInfo(profile);\n data=GetStringInfoDatum(ping_profile),\n length=(png_uint_32) GetStringInfoLength(ping_profile);\n\n PNGType(chunk,mng_eXIf);\n if (length < 7)\n {\n ping_profile=DestroyStringInfo(ping_profile);\n break; /* otherwise crashes */\n }\n\n /* skip the \"Exif\\0\\0\" JFIF Exif Header ID */\n length -= 6;\n\n LogPNGChunk(logging,chunk,length);\n (void) WriteBlobMSBULong(image,length);\n (void) WriteBlob(image,4,chunk);\n (void) WriteBlob(image,length,data+6);\n (void) WriteBlobMSBULong(image,crc32(crc32(0,chunk,4),\n data+6, (uInt) length));\n ping_profile=DestroyStringInfo(ping_profile);\n break;\n }\n }\n name=GetNextImageProfile(image);\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG end info\");\n\n png_write_end(ping,ping_info);\n\n if (mng_info->need_fram && (int) image->dispose == BackgroundDispose)\n {\n if (mng_info->page.x || mng_info->page.y ||\n (ping_width != mng_info->page.width) ||\n (ping_height != mng_info->page.height))\n {\n unsigned char\n chunk[32];\n\n /*\n Write FRAM 4 with clipping boundaries followed by FRAM 1.\n */\n (void) WriteBlobMSBULong(image,27L); /* data length=27 */\n PNGType(chunk,mng_FRAM);\n LogPNGChunk(logging,mng_FRAM,27L);\n chunk[4]=4;\n chunk[5]=0; /* frame name separator (no name) */\n chunk[6]=1; /* flag for changing delay, for next frame only */\n chunk[7]=0; /* flag for changing frame timeout */\n chunk[8]=1; /* flag for changing frame clipping for next frame */\n chunk[9]=0; /* flag for changing frame sync_id */\n PNGLong(chunk+10,(png_uint_32) (0L)); /* temporary 0 delay */\n chunk[14]=0; /* clipping boundaries delta type */\n PNGLong(chunk+15,(png_uint_32) (mng_info->page.x)); /* left cb */\n PNGLong(chunk+19,\n (png_uint_32) (mng_info->page.x + ping_width));\n PNGLong(chunk+23,(png_uint_32) (mng_info->page.y)); /* top cb */\n PNGLong(chunk+27,\n (png_uint_32) (mng_info->page.y + ping_height));\n (void) WriteBlob(image,31,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,31));\n mng_info->old_framing_mode=4;\n mng_info->framing_mode=1;\n }\n\n else\n mng_info->framing_mode=3;\n }\n if (mng_info->write_mng && !mng_info->need_fram &&\n ((int) image->dispose == 3))\n png_error(ping, \"Cannot convert GIF with disposal method 3 to MNG-LC\");\n\n /*\n Free PNG resources.\n */\n\n png_destroy_write_struct(&ping,&ping_info);\n\n pixel_info=RelinquishVirtualMemory(pixel_info);\n\n if (ping_have_blob != MagickFalse)\n (void) CloseBlob(image);\n\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n\n /* Store bit depth actually written */\n s[0]=(char) ping_bit_depth;\n s[1]='\\0';\n\n (void) SetImageProperty(IMimage,\"png:bit-depth-written\",s,exception);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" exit WriteOnePNGImage()\");\n\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n UnlockSemaphoreInfo(ping_semaphore);\n#endif\n\n /* } for navigation to beginning of SETJMP-protected block. Revert to\n * Throwing an Exception when an error occurs.\n */\n\n return(MagickTrue);\n/* End write one PNG image */\n\n}","target":"static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,\n const ImageInfo *IMimage_info,Image *IMimage,ExceptionInfo *exception)\n{\n char\n im_vers[32],\n libpng_runv[32],\n libpng_vers[32],\n zlib_runv[32],\n zlib_vers[32];\n\n Image\n *image;\n\n ImageInfo\n *image_info;\n\n char\n s[2];\n\n const char\n *name,\n *property,\n *value;\n\n const StringInfo\n *profile;\n\n int\n num_passes,\n pass,\n ping_wrote_caNv;\n\n png_byte\n ping_trans_alpha[256];\n\n png_color\n palette[257];\n\n png_color_16\n ping_background,\n ping_trans_color;\n\n png_info\n *ping_info;\n\n png_struct\n *ping;\n\n png_uint_32\n ping_height,\n ping_width;\n\n ssize_t\n y;\n\n MagickBooleanType\n image_matte,\n logging,\n matte,\n\n ping_have_blob,\n ping_have_cheap_transparency,\n ping_have_color,\n ping_have_non_bw,\n ping_have_PLTE,\n ping_have_bKGD,\n ping_have_eXIf,\n ping_have_iCCP,\n ping_have_pHYs,\n ping_have_sRGB,\n ping_have_tRNS,\n\n ping_exclude_bKGD,\n ping_exclude_cHRM,\n ping_exclude_date,\n /* ping_exclude_EXIF, */\n ping_exclude_eXIf,\n ping_exclude_gAMA,\n ping_exclude_iCCP,\n /* ping_exclude_iTXt, */\n ping_exclude_oFFs,\n ping_exclude_pHYs,\n ping_exclude_sRGB,\n ping_exclude_tEXt,\n ping_exclude_tIME,\n /* ping_exclude_tRNS, */\n ping_exclude_vpAg,\n ping_exclude_caNv,\n ping_exclude_zCCP, /* hex-encoded iCCP */\n ping_exclude_zTXt,\n\n ping_preserve_colormap,\n ping_preserve_iCCP,\n ping_need_colortype_warning,\n\n status,\n tried_332,\n tried_333,\n tried_444;\n\n MemoryInfo\n *volatile pixel_info;\n\n QuantumInfo\n *quantum_info;\n\n PNGErrorInfo\n error_info;\n\n register ssize_t\n i,\n x;\n\n unsigned char\n *ping_pixels;\n\n volatile int\n image_colors,\n ping_bit_depth,\n ping_color_type,\n ping_interlace_method,\n ping_compression_method,\n ping_filter_method,\n ping_num_trans;\n\n volatile size_t\n image_depth,\n old_bit_depth;\n\n size_t\n quality,\n rowbytes,\n save_image_depth;\n\n int\n j,\n number_colors,\n number_opaque,\n number_semitransparent,\n number_transparent,\n ping_pHYs_unit_type;\n\n png_uint_32\n ping_pHYs_x_resolution,\n ping_pHYs_y_resolution;\n\n logging=LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter WriteOnePNGImage()\");\n\n image = CloneImage(IMimage,0,0,MagickFalse,exception);\n if (image == (Image *) NULL)\n return(MagickFalse);\n image_info=(ImageInfo *) CloneImageInfo(IMimage_info);\n if (image_info == (ImageInfo *) NULL)\n ThrowWriterException(ResourceLimitError, \"MemoryAllocationFailed\");\n\n /* Define these outside of the following \"if logging()\" block so they will\n * show in debuggers.\n */\n *im_vers='\\0';\n (void) ConcatenateMagickString(im_vers,\n MagickLibVersionText,MagickPathExtent);\n (void) ConcatenateMagickString(im_vers,\n MagickLibAddendum,MagickPathExtent);\n\n *libpng_vers='\\0';\n (void) ConcatenateMagickString(libpng_vers,\n PNG_LIBPNG_VER_STRING,32);\n *libpng_runv='\\0';\n (void) ConcatenateMagickString(libpng_runv,\n png_get_libpng_ver(NULL),32);\n\n *zlib_vers='\\0';\n (void) ConcatenateMagickString(zlib_vers,\n ZLIB_VERSION,32);\n *zlib_runv='\\0';\n (void) ConcatenateMagickString(zlib_runv,\n zlib_version,32);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" IM version = %s\",\n im_vers);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Libpng version = %s\",\n libpng_vers);\n if (LocaleCompare(libpng_vers,libpng_runv) != 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" running with %s\",\n libpng_runv);\n }\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Zlib version = %s\",\n zlib_vers);\n if (LocaleCompare(zlib_vers,zlib_runv) != 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" running with %s\",\n zlib_runv);\n }\n }\n\n /* Initialize some stuff */\n ping_bit_depth=0,\n ping_color_type=0,\n ping_interlace_method=0,\n ping_compression_method=0,\n ping_filter_method=0,\n ping_num_trans = 0;\n\n ping_background.red = 0;\n ping_background.green = 0;\n ping_background.blue = 0;\n ping_background.gray = 0;\n ping_background.index = 0;\n\n ping_trans_color.red=0;\n ping_trans_color.green=0;\n ping_trans_color.blue=0;\n ping_trans_color.gray=0;\n\n ping_pHYs_unit_type = 0;\n ping_pHYs_x_resolution = 0;\n ping_pHYs_y_resolution = 0;\n\n ping_have_blob=MagickFalse;\n ping_have_cheap_transparency=MagickFalse;\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n ping_have_PLTE=MagickFalse;\n ping_have_bKGD=MagickFalse;\n ping_have_eXIf=MagickTrue;\n ping_have_iCCP=MagickFalse;\n ping_have_pHYs=MagickFalse;\n ping_have_sRGB=MagickFalse;\n ping_have_tRNS=MagickFalse;\n\n ping_exclude_bKGD=mng_info->ping_exclude_bKGD;\n ping_exclude_caNv=mng_info->ping_exclude_caNv;\n ping_exclude_cHRM=mng_info->ping_exclude_cHRM;\n ping_exclude_date=mng_info->ping_exclude_date;\n ping_exclude_eXIf=mng_info->ping_exclude_eXIf;\n ping_exclude_gAMA=mng_info->ping_exclude_gAMA;\n ping_exclude_iCCP=mng_info->ping_exclude_iCCP;\n /* ping_exclude_iTXt=mng_info->ping_exclude_iTXt; */\n ping_exclude_oFFs=mng_info->ping_exclude_oFFs;\n ping_exclude_pHYs=mng_info->ping_exclude_pHYs;\n ping_exclude_sRGB=mng_info->ping_exclude_sRGB;\n ping_exclude_tEXt=mng_info->ping_exclude_tEXt;\n ping_exclude_tIME=mng_info->ping_exclude_tIME;\n /* ping_exclude_tRNS=mng_info->ping_exclude_tRNS; */\n ping_exclude_vpAg=mng_info->ping_exclude_vpAg;\n ping_exclude_zCCP=mng_info->ping_exclude_zCCP; /* hex-encoded iCCP in zTXt */\n ping_exclude_zTXt=mng_info->ping_exclude_zTXt;\n\n ping_preserve_colormap = mng_info->ping_preserve_colormap;\n ping_preserve_iCCP = mng_info->ping_preserve_iCCP;\n ping_need_colortype_warning = MagickFalse;\n\n /* Recognize the ICC sRGB profile and convert it to the sRGB chunk,\n * i.e., eliminate the ICC profile and set image->rendering_intent.\n * Note that this will not involve any changes to the actual pixels\n * but merely passes information to applications that read the resulting\n * PNG image.\n *\n * To do: recognize other variants of the sRGB profile, using the CRC to\n * verify all recognized variants including the 7 already known.\n *\n * Work around libpng16+ rejecting some \"known invalid sRGB profiles\".\n *\n * Use something other than image->rendering_intent to record the fact\n * that the sRGB profile was found.\n *\n * Record the ICC version (currently v2 or v4) of the incoming sRGB ICC\n * profile. Record the Blackpoint Compensation, if any.\n */\n if (ping_exclude_sRGB == MagickFalse && ping_preserve_iCCP == MagickFalse)\n {\n char\n *name;\n\n const StringInfo\n *profile;\n\n ResetImageProfileIterator(image);\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n\n {\n int\n icheck,\n got_crc=0;\n\n\n png_uint_32\n length,\n profile_crc=0;\n\n unsigned char\n *data;\n\n length=(png_uint_32) GetStringInfoLength(profile);\n\n for (icheck=0; sRGB_info[icheck].len > 0; icheck++)\n {\n if (length == sRGB_info[icheck].len)\n {\n if (got_crc == 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Got a %lu-byte ICC profile (potentially sRGB)\",\n (unsigned long) length);\n\n data=GetStringInfoDatum(profile);\n profile_crc=crc32(0,data,length);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" with crc=%8x\",(unsigned int) profile_crc);\n got_crc++;\n }\n\n if (profile_crc == sRGB_info[icheck].crc)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" It is sRGB with rendering intent = %s\",\n Magick_RenderingIntentString_from_PNG_RenderingIntent(\n sRGB_info[icheck].intent));\n if (image->rendering_intent==UndefinedIntent)\n {\n image->rendering_intent=\n Magick_RenderingIntent_from_PNG_RenderingIntent(\n sRGB_info[icheck].intent);\n }\n ping_exclude_iCCP = MagickTrue;\n ping_exclude_zCCP = MagickTrue;\n ping_have_sRGB = MagickTrue;\n break;\n }\n }\n }\n if (sRGB_info[icheck].len == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Got %lu-byte ICC profile not recognized as sRGB\",\n (unsigned long) length);\n }\n }\n name=GetNextImageProfile(image);\n }\n }\n\n number_opaque = 0;\n number_semitransparent = 0;\n number_transparent = 0;\n\n if (logging != MagickFalse)\n {\n if (image->storage_class == UndefinedClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=UndefinedClass\");\n if (image->storage_class == DirectClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=DirectClass\");\n if (image->storage_class == PseudoClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=PseudoClass\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(), image->taint ?\n \" image->taint=MagickTrue\":\n \" image->taint=MagickFalse\");\n }\n\n if (image->storage_class == PseudoClass &&\n (mng_info->write_png8 || mng_info->write_png24 || mng_info->write_png32 ||\n mng_info->write_png48 || mng_info->write_png64 ||\n (mng_info->write_png_colortype != 1 &&\n mng_info->write_png_colortype != 5)))\n {\n (void) SyncImage(image,exception);\n image->storage_class = DirectClass;\n }\n\n if (ping_preserve_colormap == MagickFalse)\n {\n if (image->storage_class != PseudoClass && image->colormap != NULL)\n {\n /* Free the bogus colormap; it can cause trouble later */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Freeing bogus colormap\");\n (void) RelinquishMagickMemory(image->colormap);\n image->colormap=NULL;\n }\n }\n\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n\n /*\n Sometimes we get PseudoClass images whose RGB values don't match\n the colors in the colormap. This code syncs the RGB values.\n */\n if (image->depth <= 8 && image->taint && image->storage_class == PseudoClass)\n (void) SyncImage(image,exception);\n\n#if (MAGICKCORE_QUANTUM_DEPTH == 8)\n if (image->depth > 8)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reducing PNG bit depth to 8 since this is a Q8 build.\");\n\n image->depth=8;\n }\n#endif\n\n /* Respect the -depth option */\n if (image->depth < 4)\n {\n register Quantum\n *r;\n\n if (image->depth > 2)\n {\n /* Scale to 4-bit */\n LBR04PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR04PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR04PacketRGBO(image->colormap[i]);\n }\n }\n }\n else if (image->depth > 1)\n {\n /* Scale to 2-bit */\n LBR02PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR02PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR02PacketRGBO(image->colormap[i]);\n }\n }\n }\n else\n {\n /* Scale to 1-bit */\n LBR01PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR01PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR01PacketRGBO(image->colormap[i]);\n }\n }\n }\n }\n\n /* To do: set to next higher multiple of 8 */\n if (image->depth < 8)\n image->depth=8;\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n /* PNG does not handle depths greater than 16 so reduce it even\n * if lossy\n */\n if (image->depth > 8)\n image->depth=16;\n#endif\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 8)\n if (image->depth > 8)\n {\n /* To do: fill low byte properly */\n image->depth=16;\n }\n\n if (image->depth == 16 && mng_info->write_png_depth != 16)\n if (mng_info->write_png8 ||\n LosslessReduceDepthOK(image,exception) != MagickFalse)\n image->depth = 8;\n#endif\n\n image_colors = (int) image->colors;\n number_opaque = (int) image->colors;\n number_transparent = 0;\n number_semitransparent = 0;\n\n if (mng_info->write_png_colortype &&\n (mng_info->write_png_colortype > 4 || (mng_info->write_png_depth >= 8 &&\n mng_info->write_png_colortype < 4 &&\n image->alpha_trait == UndefinedPixelTrait)))\n {\n /* Avoid the expensive BUILD_PALETTE operation if we're sure that we\n * are not going to need the result.\n */\n if (mng_info->write_png_colortype == 1 ||\n mng_info->write_png_colortype == 5)\n ping_have_color=MagickFalse;\n\n if (image->alpha_trait != UndefinedPixelTrait)\n {\n number_transparent = 2;\n number_semitransparent = 1;\n }\n }\n\n if (mng_info->write_png_colortype < 7)\n {\n /* BUILD_PALETTE\n *\n * Normally we run this just once, but in the case of writing PNG8\n * we reduce the transparency to binary and run again, then if there\n * are still too many colors we reduce to a simple 4-4-4-1, then 3-3-3-1\n * RGBA palette and run again, and then to a simple 3-3-2-1 RGBA\n * palette. Then (To do) we take care of a final reduction that is only\n * needed if there are still 256 colors present and one of them has both\n * transparent and opaque instances.\n */\n\n tried_332 = MagickFalse;\n tried_333 = MagickFalse;\n tried_444 = MagickFalse;\n\n for (j=0; j<6; j++)\n {\n /*\n * Sometimes we get DirectClass images that have 256 colors or fewer.\n * This code will build a colormap.\n *\n * Also, sometimes we get PseudoClass images with an out-of-date\n * colormap. This code will replace the colormap with a new one.\n * Sometimes we get PseudoClass images that have more than 256 colors.\n * This code will delete the colormap and change the image to\n * DirectClass.\n *\n * If image->alpha_trait is MagickFalse, we ignore the alpha channel\n * even though it sometimes contains left-over non-opaque values.\n *\n * Also we gather some information (number of opaque, transparent,\n * and semitransparent pixels, and whether the image has any non-gray\n * pixels or only black-and-white pixels) that we might need later.\n *\n * Even if the user wants to force GrayAlpha or RGBA (colortype 4 or 6)\n * we need to check for bogus non-opaque values, at least.\n */\n\n int\n n;\n\n PixelInfo\n opaque[260],\n semitransparent[260],\n transparent[260];\n\n register const Quantum\n *s;\n\n register Quantum\n *q,\n *r;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter BUILD_PALETTE:\");\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->columns=%.20g\",(double) image->columns);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->rows=%.20g\",(double) image->rows);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->alpha_trait=%.20g\",(double) image->alpha_trait);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->depth=%.20g\",(double) image->depth);\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Original colormap:\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" i (red,green,blue,alpha)\");\n\n for (i=0; i < 256; i++)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n\n for (i=image->colors - 10; i < (ssize_t) image->colors; i++)\n {\n if (i > 255)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n }\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d\",(int) image->colors);\n\n if (image->colors == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" (zero means unknown)\");\n\n if (ping_preserve_colormap == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Regenerate the colormap\");\n }\n\n image_colors=0;\n number_opaque = 0;\n number_semitransparent = 0;\n number_transparent = 0;\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (image->alpha_trait == UndefinedPixelTrait ||\n GetPixelAlpha(image,q) == OpaqueAlpha)\n {\n if (number_opaque < 259)\n {\n if (number_opaque == 0)\n {\n GetPixelInfoPixel(image, q, opaque);\n opaque[0].alpha=OpaqueAlpha;\n number_opaque=1;\n }\n\n for (i=0; i< (ssize_t) number_opaque; i++)\n {\n if (Magick_png_color_equal(image,q,opaque+i))\n break;\n }\n\n if (i == (ssize_t) number_opaque && number_opaque < 259)\n {\n number_opaque++;\n GetPixelInfoPixel(image, q, opaque+i);\n opaque[i].alpha=OpaqueAlpha;\n }\n }\n }\n else if (GetPixelAlpha(image,q) == TransparentAlpha)\n {\n if (number_transparent < 259)\n {\n if (number_transparent == 0)\n {\n GetPixelInfoPixel(image, q, transparent);\n ping_trans_color.red=(unsigned short)\n GetPixelRed(image,q);\n ping_trans_color.green=(unsigned short)\n GetPixelGreen(image,q);\n ping_trans_color.blue=(unsigned short)\n GetPixelBlue(image,q);\n ping_trans_color.gray=(unsigned short)\n GetPixelGray(image,q);\n number_transparent = 1;\n }\n\n for (i=0; i< (ssize_t) number_transparent; i++)\n {\n if (Magick_png_color_equal(image,q,transparent+i))\n break;\n }\n\n if (i == (ssize_t) number_transparent &&\n number_transparent < 259)\n {\n number_transparent++;\n GetPixelInfoPixel(image,q,transparent+i);\n }\n }\n }\n else\n {\n if (number_semitransparent < 259)\n {\n if (number_semitransparent == 0)\n {\n GetPixelInfoPixel(image,q,semitransparent);\n number_semitransparent = 1;\n }\n\n for (i=0; i< (ssize_t) number_semitransparent; i++)\n {\n if (Magick_png_color_equal(image,q,semitransparent+i)\n && GetPixelAlpha(image,q) ==\n semitransparent[i].alpha)\n break;\n }\n\n if (i == (ssize_t) number_semitransparent &&\n number_semitransparent < 259)\n {\n number_semitransparent++;\n GetPixelInfoPixel(image, q, semitransparent+i);\n }\n }\n }\n q+=GetPixelChannels(image);\n }\n }\n\n if (mng_info->write_png8 == MagickFalse &&\n ping_exclude_bKGD == MagickFalse)\n {\n /* Add the background color to the palette, if it\n * isn't already there.\n */\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Check colormap for background (%d,%d,%d)\",\n (int) image->background_color.red,\n (int) image->background_color.green,\n (int) image->background_color.blue);\n }\n for (i=0; ibackground_color.red &&\n opaque[i].green == image->background_color.green &&\n opaque[i].blue == image->background_color.blue)\n break;\n }\n if (number_opaque < 259 && i == number_opaque)\n {\n opaque[i] = image->background_color;\n ping_background.index = i;\n number_opaque++;\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",(int) i);\n }\n\n }\n else if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No room in the colormap to add background color\");\n }\n\n image_colors=number_opaque+number_transparent+number_semitransparent;\n\n if (logging != MagickFalse)\n {\n if (image_colors > 256)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has more than 256 colors\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has %d colors\",image_colors);\n }\n\n if (ping_preserve_colormap != MagickFalse)\n break;\n\n if (mng_info->write_png_colortype != 7) /* We won't need this info */\n {\n ping_have_color=MagickFalse;\n ping_have_non_bw=MagickFalse;\n\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"incompatible colorspace\");\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n }\n\n if(image_colors > 256)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n s=q;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelRed(image,s) != GetPixelGreen(image,s) ||\n GetPixelRed(image,s) != GetPixelBlue(image,s))\n {\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n break;\n }\n s+=GetPixelChannels(image);\n }\n\n if (ping_have_color != MagickFalse)\n break;\n\n /* Worst case is black-and-white; we are looking at every\n * pixel twice.\n */\n\n if (ping_have_non_bw == MagickFalse)\n {\n s=q;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelRed(image,s) != 0 &&\n GetPixelRed(image,s) != QuantumRange)\n {\n ping_have_non_bw=MagickTrue;\n break;\n }\n s+=GetPixelChannels(image);\n }\n }\n }\n }\n }\n\n if (image_colors < 257)\n {\n PixelInfo\n colormap[260];\n\n /*\n * Initialize image colormap.\n */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Sort the new colormap\");\n\n /* Sort palette, transparent first */;\n\n n = 0;\n\n for (i=0; iping_exclude_tRNS == MagickFalse ||\n (number_transparent == 0 && number_semitransparent == 0)) &&\n (((mng_info->write_png_colortype-1) ==\n PNG_COLOR_TYPE_PALETTE) ||\n (mng_info->write_png_colortype == 0)))\n {\n if (logging != MagickFalse)\n {\n if (n != (ssize_t) image_colors)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_colors (%d) and n (%d) don't match\",\n image_colors, n);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" AcquireImageColormap\");\n }\n\n image->colors = image_colors;\n\n if (AcquireImageColormap(image,image_colors,exception) ==\n MagickFalse)\n ThrowWriterException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n\n for (i=0; i< (ssize_t) image_colors; i++)\n image->colormap[i] = colormap[i];\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d (%d)\",\n (int) image->colors, image_colors);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Update the pixel indexes\");\n }\n\n /* Sync the pixel indices with the new colormap */\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n for (i=0; i< (ssize_t) image_colors; i++)\n {\n if ((image->alpha_trait == UndefinedPixelTrait ||\n image->colormap[i].alpha == GetPixelAlpha(image,q)) &&\n image->colormap[i].red == GetPixelRed(image,q) &&\n image->colormap[i].green == GetPixelGreen(image,q) &&\n image->colormap[i].blue == GetPixelBlue(image,q))\n {\n SetPixelIndex(image,i,q);\n break;\n }\n }\n q+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d\", (int) image->colors);\n\n if (image->colormap != NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" i (red,green,blue,alpha)\");\n\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n if (i < 300 || i >= (ssize_t) image->colors - 10)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n }\n }\n\n if (number_transparent < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_transparent = %d\",\n number_transparent);\n else\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_transparent > 256\");\n\n if (number_opaque < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_opaque = %d\",\n number_opaque);\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_opaque > 256\");\n\n if (number_semitransparent < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_semitransparent = %d\",\n number_semitransparent);\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_semitransparent > 256\");\n\n if (ping_have_non_bw == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" All pixels and the background are black or white\");\n\n else if (ping_have_color == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" All pixels and the background are gray\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" At least one pixel or the background is non-gray\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Exit BUILD_PALETTE:\");\n }\n\n if (mng_info->write_png8 == MagickFalse)\n break;\n\n /* Make any reductions necessary for the PNG8 format */\n if (image_colors <= 256 &&\n image_colors != 0 && image->colormap != NULL &&\n number_semitransparent == 0 &&\n number_transparent <= 1)\n break;\n\n /* PNG8 can't have semitransparent colors so we threshold the\n * opacity to 0 or OpaqueOpacity, and PNG8 can only have one\n * transparent color so if more than one is transparent we merge\n * them into image->background_color.\n */\n if (number_semitransparent != 0 || number_transparent > 1)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Thresholding the alpha channel to binary\");\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) < OpaqueAlpha/2)\n {\n SetPixelViaPixelInfo(image,&image->background_color,r);\n SetPixelAlpha(image,TransparentAlpha,r);\n }\n else\n SetPixelAlpha(image,OpaqueAlpha,r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n\n if (image_colors != 0 && image_colors <= 256 &&\n image->colormap != NULL)\n for (i=0; icolormap[i].alpha =\n (image->colormap[i].alpha > TransparentAlpha/2 ?\n TransparentAlpha : OpaqueAlpha);\n }\n continue;\n }\n\n /* PNG8 can't have more than 256 colors so we quantize the pixels and\n * background color to the 4-4-4-1, 3-3-3-1 or 3-3-2-1 palette. If the\n * image is mostly gray, the 4-4-4-1 palette is likely to end up with 256\n * colors or less.\n */\n if (tried_444 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 4-4-4\");\n\n tried_444 = MagickTrue;\n\n LBR04PacketRGB(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 4-4-4\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR04PixelRGB(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 4-4-4\");\n\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (tried_333 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 3-3-3\");\n\n tried_333 = MagickTrue;\n\n LBR03PacketRGB(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 3-3-3-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR03RGB(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 3-3-3-1\");\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (tried_332 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 3-3-2\");\n\n tried_332 = MagickTrue;\n\n /* Red and green were already done so we only quantize the blue\n * channel\n */\n\n LBR02PacketBlue(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 3-3-2-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR02PixelBlue(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 3-3-2-1\");\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (image_colors == 0 || image_colors > 256)\n {\n /* Take care of special case with 256 opaque colors + 1 transparent\n * color. We don't need to quantize to 2-3-2-1; we only need to\n * eliminate one color, so we'll merge the two darkest red\n * colors (0x49, 0, 0) -> (0x24, 0, 0).\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Merging two dark red background colors to 3-3-2-1\");\n\n if (ScaleQuantumToChar(image->background_color.red) == 0x49 &&\n ScaleQuantumToChar(image->background_color.green) == 0x00 &&\n ScaleQuantumToChar(image->background_color.blue) == 0x00)\n {\n image->background_color.red=ScaleCharToQuantum(0x24);\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Merging two dark red pixel colors to 3-3-2-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (ScaleQuantumToChar(GetPixelRed(image,r)) == 0x49 &&\n ScaleQuantumToChar(GetPixelGreen(image,r)) == 0x00 &&\n ScaleQuantumToChar(GetPixelBlue(image,r)) == 0x00 &&\n GetPixelAlpha(image,r) == OpaqueAlpha)\n {\n SetPixelRed(image,ScaleCharToQuantum(0x24),r);\n }\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n\n }\n }\n\n else\n {\n for (i=0; icolormap[i].red) == 0x49 &&\n ScaleQuantumToChar(image->colormap[i].green) == 0x00 &&\n ScaleQuantumToChar(image->colormap[i].blue) == 0x00)\n {\n image->colormap[i].red=ScaleCharToQuantum(0x24);\n }\n }\n }\n }\n }\n }\n /* END OF BUILD_PALETTE */\n\n /* If we are excluding the tRNS chunk and there is transparency,\n * then we must write a Gray-Alpha (color-type 4) or RGBA (color-type 6)\n * PNG.\n */\n if (mng_info->ping_exclude_tRNS != MagickFalse &&\n (number_transparent != 0 || number_semitransparent != 0))\n {\n unsigned int colortype=mng_info->write_png_colortype;\n\n if (ping_have_color == MagickFalse)\n mng_info->write_png_colortype = 5;\n\n else\n mng_info->write_png_colortype = 7;\n\n if (colortype != 0 &&\n mng_info->write_png_colortype != colortype)\n ping_need_colortype_warning=MagickTrue;\n\n }\n\n /* See if cheap transparency is possible. It is only possible\n * when there is a single transparent color, no semitransparent\n * color, and no opaque color that has the same RGB components\n * as the transparent color. We only need this information if\n * we are writing a PNG with colortype 0 or 2, and we have not\n * excluded the tRNS chunk.\n */\n if (number_transparent == 1 &&\n mng_info->write_png_colortype < 4)\n {\n ping_have_cheap_transparency = MagickTrue;\n\n if (number_semitransparent != 0)\n ping_have_cheap_transparency = MagickFalse;\n\n else if (image_colors == 0 || image_colors > 256 ||\n image->colormap == NULL)\n {\n register const Quantum\n *q;\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,q) != TransparentAlpha &&\n (unsigned short) GetPixelRed(image,q) ==\n ping_trans_color.red &&\n (unsigned short) GetPixelGreen(image,q) ==\n ping_trans_color.green &&\n (unsigned short) GetPixelBlue(image,q) ==\n ping_trans_color.blue)\n {\n ping_have_cheap_transparency = MagickFalse;\n break;\n }\n\n q+=GetPixelChannels(image);\n }\n\n if (ping_have_cheap_transparency == MagickFalse)\n break;\n }\n }\n else\n {\n /* Assuming that image->colormap[0] is the one transparent color\n * and that all others are opaque.\n */\n if (image_colors > 1)\n for (i=1; icolormap[i].red == image->colormap[0].red &&\n image->colormap[i].green == image->colormap[0].green &&\n image->colormap[i].blue == image->colormap[0].blue)\n {\n ping_have_cheap_transparency = MagickFalse;\n break;\n }\n }\n\n if (logging != MagickFalse)\n {\n if (ping_have_cheap_transparency == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Cheap transparency is not possible.\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Cheap transparency is possible.\");\n }\n }\n else\n ping_have_cheap_transparency = MagickFalse;\n\n image_depth=image->depth;\n\n quantum_info = (QuantumInfo *) NULL;\n number_colors=0;\n image_colors=(int) image->colors;\n image_matte=image->alpha_trait !=\n UndefinedPixelTrait ? MagickTrue : MagickFalse;\n\n if (mng_info->write_png_colortype < 5)\n mng_info->IsPalette=image->storage_class == PseudoClass &&\n image_colors <= 256 && image->colormap != NULL;\n else\n mng_info->IsPalette = MagickFalse;\n\n if ((mng_info->write_png_colortype == 4 || mng_info->write_png8) &&\n (image->colors == 0 || image->colormap == NULL))\n {\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n (void) ThrowMagickException(exception,GetMagickModule(),CoderError,\n \"Cannot write PNG8 or color-type 3; colormap is NULL\",\n \"`%s'\",IMimage->filename);\n return(MagickFalse);\n }\n\n /*\n Allocate the PNG structures\n */\n#ifdef PNG_USER_MEM_SUPPORTED\n error_info.image=image;\n error_info.exception=exception;\n ping=png_create_write_struct_2(PNG_LIBPNG_VER_STRING,&error_info,\n MagickPNGErrorHandler,MagickPNGWarningHandler,(void *) NULL,\n (png_malloc_ptr) Magick_png_malloc,(png_free_ptr) Magick_png_free);\n\n#else\n ping=png_create_write_struct(PNG_LIBPNG_VER_STRING,&error_info,\n MagickPNGErrorHandler,MagickPNGWarningHandler);\n\n#endif\n if (ping == (png_struct *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n ping_info=png_create_info_struct(ping);\n\n if (ping_info == (png_info *) NULL)\n {\n png_destroy_write_struct(&ping,(png_info **) NULL);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n\n png_set_write_fn(ping,image,png_put_data,png_flush_data);\n pixel_info=(MemoryInfo *) NULL;\n\n if (setjmp(png_jmpbuf(ping)))\n {\n /*\n PNG write failed.\n */\n#ifdef PNG_DEBUG\n if (image_info->verbose)\n (void) printf(\"PNG write has failed.\\n\");\n#endif\n png_destroy_write_struct(&ping,&ping_info);\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n UnlockSemaphoreInfo(ping_semaphore);\n#endif\n\n if (pixel_info != (MemoryInfo *) NULL)\n pixel_info=RelinquishVirtualMemory(pixel_info);\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n\n if (ping_have_blob != MagickFalse)\n (void) CloseBlob(image);\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n return(MagickFalse);\n }\n\n /* { For navigation to end of SETJMP-protected block. Within this\n * block, use png_error() instead of Throwing an Exception, to ensure\n * that libpng is able to clean up, and that the semaphore is unlocked.\n */\n\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n LockSemaphoreInfo(ping_semaphore);\n#endif\n\n#ifdef PNG_BENIGN_ERRORS_SUPPORTED\n /* Allow benign errors */\n png_set_benign_errors(ping, 1);\n#endif\n\n#ifdef PNG_SET_USER_LIMITS_SUPPORTED\n /* Reject images with too many rows or columns */\n png_set_user_limits(ping,\n (png_uint_32) MagickMin(0x7fffffffL,\n GetMagickResourceLimit(WidthResource)),\n (png_uint_32) MagickMin(0x7fffffffL,\n GetMagickResourceLimit(HeightResource)));\n#endif /* PNG_SET_USER_LIMITS_SUPPORTED */\n\n /*\n Prepare PNG for writing.\n */\n\n#if defined(PNG_MNG_FEATURES_SUPPORTED)\n if (mng_info->write_mng)\n {\n (void) png_permit_mng_features(ping,PNG_ALL_MNG_FEATURES);\n# ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED\n /* Disable new libpng-1.5.10 feature when writing a MNG because\n * zero-length PLTE is OK\n */\n png_set_check_for_invalid_index (ping, 0);\n# endif\n }\n\n#else\n# ifdef PNG_WRITE_EMPTY_PLTE_SUPPORTED\n if (mng_info->write_mng)\n png_permit_empty_plte(ping,MagickTrue);\n\n# endif\n#endif\n\n x=0;\n\n ping_width=(png_uint_32) image->columns;\n ping_height=(png_uint_32) image->rows;\n\n if (mng_info->write_png8 || mng_info->write_png24 || mng_info->write_png32)\n image_depth=8;\n\n if (mng_info->write_png48 || mng_info->write_png64)\n image_depth=16;\n\n if (mng_info->write_png_depth != 0)\n image_depth=mng_info->write_png_depth;\n\n /* Adjust requested depth to next higher valid depth if necessary */\n if (image_depth > 8)\n image_depth=16;\n\n if ((image_depth > 4) && (image_depth < 8))\n image_depth=8;\n\n if (image_depth == 3)\n image_depth=4;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" width=%.20g\",(double) ping_width);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" height=%.20g\",(double) ping_height);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_matte=%.20g\",(double) image->alpha_trait);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->depth=%.20g\",(double) image->depth);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative ping_bit_depth=%.20g\",(double) image_depth);\n }\n\n save_image_depth=image_depth;\n ping_bit_depth=(png_byte) save_image_depth;\n\n\n#if defined(PNG_pHYs_SUPPORTED)\n if (ping_exclude_pHYs == MagickFalse)\n {\n if ((image->resolution.x != 0) && (image->resolution.y != 0) &&\n (!mng_info->write_mng || !mng_info->equal_physs))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up pHYs chunk\");\n\n if (image->units == PixelsPerInchResolution)\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_METER;\n ping_pHYs_x_resolution=\n (png_uint_32) ((100.0*image->resolution.x+0.5)/2.54);\n ping_pHYs_y_resolution=\n (png_uint_32) ((100.0*image->resolution.y+0.5)/2.54);\n }\n\n else if (image->units == PixelsPerCentimeterResolution)\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_METER;\n ping_pHYs_x_resolution=(png_uint_32) (100.0*image->resolution.x+0.5);\n ping_pHYs_y_resolution=(png_uint_32) (100.0*image->resolution.y+0.5);\n }\n\n else\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_UNKNOWN;\n ping_pHYs_x_resolution=(png_uint_32) image->resolution.x;\n ping_pHYs_y_resolution=(png_uint_32) image->resolution.y;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Set up PNG pHYs chunk: xres: %.20g, yres: %.20g, units: %d.\",\n (double) ping_pHYs_x_resolution,(double) ping_pHYs_y_resolution,\n (int) ping_pHYs_unit_type);\n ping_have_pHYs = MagickTrue;\n }\n }\n#endif\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if ((!mng_info->adjoin || !mng_info->equal_backgrounds))\n {\n unsigned int\n mask;\n\n mask=0xffff;\n if (ping_bit_depth == 8)\n mask=0x00ff;\n\n if (ping_bit_depth == 4)\n mask=0x000f;\n\n if (ping_bit_depth == 2)\n mask=0x0003;\n\n if (ping_bit_depth == 1)\n mask=0x0001;\n\n ping_background.red=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.red) & mask);\n\n ping_background.green=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.green) & mask);\n\n ping_background.blue=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.blue) & mask);\n\n ping_background.gray=(png_uint_16) ping_background.green;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk (1)\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_bit_depth=%d\",ping_bit_depth);\n }\n\n ping_have_bKGD = MagickTrue;\n }\n\n /*\n Select the color type.\n */\n matte=image_matte;\n old_bit_depth=0;\n\n if (mng_info->IsPalette && mng_info->write_png8)\n {\n /* To do: make this a function cause it's used twice, except\n for reducing the sample depth from 8. */\n\n number_colors=image_colors;\n\n ping_have_tRNS=MagickFalse;\n\n /*\n Set image palette.\n */\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up PLTE chunk with %d colors (%d)\",\n number_colors, image_colors);\n\n for (i=0; i < (ssize_t) number_colors; i++)\n {\n palette[i].red=ScaleQuantumToChar(image->colormap[i].red);\n palette[i].green=ScaleQuantumToChar(image->colormap[i].green);\n palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n#if MAGICKCORE_QUANTUM_DEPTH == 8\n \" %3ld (%3d,%3d,%3d)\",\n#else\n \" %5ld (%5d,%5d,%5d)\",\n#endif\n (long) i,palette[i].red,palette[i].green,palette[i].blue);\n\n }\n\n ping_have_PLTE=MagickTrue;\n image_depth=ping_bit_depth;\n ping_num_trans=0;\n\n if (matte != MagickFalse)\n {\n /*\n Identify which colormap entry is transparent.\n */\n assert(number_colors <= 256);\n assert(image->colormap != NULL);\n\n for (i=0; i < (ssize_t) number_transparent; i++)\n ping_trans_alpha[i]=0;\n\n\n ping_num_trans=(unsigned short) (number_transparent +\n number_semitransparent);\n\n if (ping_num_trans == 0)\n ping_have_tRNS=MagickFalse;\n\n else\n ping_have_tRNS=MagickTrue;\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n /*\n * Identify which colormap entry is the background color.\n */\n\n for (i=0; i < (ssize_t) MagickMax(1L*number_colors-1L,1L); i++)\n if (IsPNGColorEqual(ping_background,image->colormap[i]))\n break;\n\n ping_background.index=(png_byte) i;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n }\n }\n } /* end of write_png8 */\n\n else if (mng_info->write_png_colortype == 1)\n {\n image_matte=MagickFalse;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;\n }\n\n else if (mng_info->write_png24 || mng_info->write_png48 ||\n mng_info->write_png_colortype == 3)\n {\n image_matte=MagickFalse;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n }\n\n else if (mng_info->write_png32 || mng_info->write_png64 ||\n mng_info->write_png_colortype == 7)\n {\n image_matte=MagickTrue;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA;\n }\n\n else /* mng_info->write_pngNN not specified */\n {\n image_depth=ping_bit_depth;\n\n if (mng_info->write_png_colortype != 0)\n {\n ping_color_type=(png_byte) mng_info->write_png_colortype-1;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||\n ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA)\n image_matte=MagickTrue;\n\n else\n image_matte=MagickFalse;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG colortype %d was specified:\",(int) ping_color_type);\n }\n\n else /* write_png_colortype not specified */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Selecting PNG colortype:\");\n\n ping_color_type=(png_byte) ((matte != MagickFalse)?\n PNG_COLOR_TYPE_RGB_ALPHA:PNG_COLOR_TYPE_RGB);\n\n if (image_info->type == TrueColorType)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n image_matte=MagickFalse;\n }\n\n if (image_info->type == TrueColorAlphaType)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA;\n image_matte=MagickTrue;\n }\n\n if (image_info->type == PaletteType ||\n image_info->type == PaletteAlphaType)\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (mng_info->write_png_colortype == 0 &&\n image_info->type == UndefinedType)\n {\n if (ping_have_color == MagickFalse)\n {\n if (image_matte == MagickFalse)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;\n image_matte=MagickFalse;\n }\n\n else\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY_ALPHA;\n image_matte=MagickTrue;\n }\n }\n else\n {\n if (image_matte == MagickFalse)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n image_matte=MagickFalse;\n }\n\n else\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGBA;\n image_matte=MagickTrue;\n }\n }\n }\n\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Selected PNG colortype=%d\",ping_color_type);\n\n if (ping_bit_depth < 8)\n {\n if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||\n ping_color_type == PNG_COLOR_TYPE_RGB ||\n ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA)\n ping_bit_depth=8;\n }\n\n old_bit_depth=ping_bit_depth;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (image->alpha_trait == UndefinedPixelTrait &&\n ping_have_non_bw == MagickFalse)\n ping_bit_depth=1;\n }\n\n if (ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n size_t one = 1;\n ping_bit_depth=1;\n\n if (image->colors == 0)\n {\n /* DO SOMETHING */\n png_error(ping,\"image has 0 colors\");\n }\n\n while ((int) (one << ping_bit_depth) < (ssize_t) image_colors)\n ping_bit_depth <<= 1;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number of colors: %.20g\",(double) image_colors);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative PNG bit depth: %d\",ping_bit_depth);\n }\n\n if (ping_bit_depth < (int) mng_info->write_png_depth)\n ping_bit_depth = mng_info->write_png_depth;\n }\n\n image_depth=ping_bit_depth;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative PNG color type: %s (%.20g)\",\n PngColorTypeToString(ping_color_type),\n (double) ping_color_type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_info->type: %.20g\",(double) image_info->type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_depth: %.20g\",(double) image_depth);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n\n \" image->depth: %.20g\",(double) image->depth);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_bit_depth: %.20g\",(double) ping_bit_depth);\n }\n\n if (matte != MagickFalse)\n {\n if (mng_info->IsPalette)\n {\n if (mng_info->write_png_colortype == 0)\n {\n ping_color_type=PNG_COLOR_TYPE_GRAY_ALPHA;\n\n if (ping_have_color != MagickFalse)\n ping_color_type=PNG_COLOR_TYPE_RGBA;\n }\n\n /*\n * Determine if there is any transparent color.\n */\n if (number_transparent + number_semitransparent == 0)\n {\n /*\n No transparent pixels are present. Change 4 or 6 to 0 or 2.\n */\n\n image_matte=MagickFalse;\n\n if (mng_info->write_png_colortype == 0)\n ping_color_type&=0x03;\n }\n\n else\n {\n unsigned int\n mask;\n\n mask=0xffff;\n\n if (ping_bit_depth == 8)\n mask=0x00ff;\n\n if (ping_bit_depth == 4)\n mask=0x000f;\n\n if (ping_bit_depth == 2)\n mask=0x0003;\n\n if (ping_bit_depth == 1)\n mask=0x0001;\n\n ping_trans_color.red=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].red) & mask);\n\n ping_trans_color.green=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].green) & mask);\n\n ping_trans_color.blue=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].blue) & mask);\n\n ping_trans_color.gray=(png_uint_16)\n (ScaleQuantumToShort(GetPixelInfoIntensity(image,\n image->colormap)) & mask);\n\n ping_trans_color.index=(png_byte) 0;\n\n ping_have_tRNS=MagickTrue;\n }\n\n if (ping_have_tRNS != MagickFalse)\n {\n /*\n * Determine if there is one and only one transparent color\n * and if so if it is fully transparent.\n */\n if (ping_have_cheap_transparency == MagickFalse)\n ping_have_tRNS=MagickFalse;\n }\n\n if (ping_have_tRNS != MagickFalse)\n {\n if (mng_info->write_png_colortype == 0)\n ping_color_type &= 0x03; /* changes 4 or 6 to 0 or 2 */\n\n if (image_depth == 8)\n {\n ping_trans_color.red&=0xff;\n ping_trans_color.green&=0xff;\n ping_trans_color.blue&=0xff;\n ping_trans_color.gray&=0xff;\n }\n }\n }\n else\n {\n if (image_depth == 8)\n {\n ping_trans_color.red&=0xff;\n ping_trans_color.green&=0xff;\n ping_trans_color.blue&=0xff;\n ping_trans_color.gray&=0xff;\n }\n }\n }\n\n matte=image_matte;\n\n if (ping_have_tRNS != MagickFalse)\n image_matte=MagickFalse;\n\n if ((mng_info->IsPalette) &&\n mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE &&\n ping_have_color == MagickFalse &&\n (image_matte == MagickFalse || image_depth >= 8))\n {\n size_t one=1;\n\n if (image_matte != MagickFalse)\n ping_color_type=PNG_COLOR_TYPE_GRAY_ALPHA;\n\n else if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n ping_color_type=PNG_COLOR_TYPE_GRAY;\n\n if (save_image_depth == 16 && image_depth == 8)\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color (0)\");\n }\n ping_trans_color.gray*=0x0101;\n }\n }\n\n if (image_depth > MAGICKCORE_QUANTUM_DEPTH)\n image_depth=MAGICKCORE_QUANTUM_DEPTH;\n\n if ((image_colors == 0) ||\n ((ssize_t) (image_colors-1) > (ssize_t) MaxColormapSize))\n image_colors=(int) (one << image_depth);\n\n if (image_depth > 8)\n ping_bit_depth=16;\n\n else\n {\n ping_bit_depth=8;\n if ((int) ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n if(!mng_info->write_png_depth)\n {\n ping_bit_depth=1;\n\n while ((int) (one << ping_bit_depth)\n < (ssize_t) image_colors)\n ping_bit_depth <<= 1;\n }\n }\n\n else if (ping_color_type ==\n PNG_COLOR_TYPE_GRAY && image_colors < 17 &&\n mng_info->IsPalette)\n {\n /* Check if grayscale is reducible */\n\n int\n depth_4_ok=MagickTrue,\n depth_2_ok=MagickTrue,\n depth_1_ok=MagickTrue;\n\n for (i=0; i < (ssize_t) image_colors; i++)\n {\n unsigned char\n intensity;\n\n intensity=ScaleQuantumToChar(image->colormap[i].red);\n\n if ((intensity & 0x0f) != ((intensity & 0xf0) >> 4))\n depth_4_ok=depth_2_ok=depth_1_ok=MagickFalse;\n else if ((intensity & 0x03) != ((intensity & 0x0c) >> 2))\n depth_2_ok=depth_1_ok=MagickFalse;\n else if ((intensity & 0x01) != ((intensity & 0x02) >> 1))\n depth_1_ok=MagickFalse;\n }\n\n if (depth_1_ok && mng_info->write_png_depth <= 1)\n ping_bit_depth=1;\n\n else if (depth_2_ok && mng_info->write_png_depth <= 2)\n ping_bit_depth=2;\n\n else if (depth_4_ok && mng_info->write_png_depth <= 4)\n ping_bit_depth=4;\n }\n }\n\n image_depth=ping_bit_depth;\n }\n\n else\n\n if (mng_info->IsPalette)\n {\n number_colors=image_colors;\n\n if (image_depth <= 8)\n {\n /*\n Set image palette.\n */\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (!(mng_info->have_write_global_plte && matte == MagickFalse))\n {\n for (i=0; i < (ssize_t) number_colors; i++)\n {\n palette[i].red=ScaleQuantumToChar(image->colormap[i].red);\n palette[i].green=\n ScaleQuantumToChar(image->colormap[i].green);\n palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up PLTE chunk with %d colors\",\n number_colors);\n\n ping_have_PLTE=MagickTrue;\n }\n\n /* color_type is PNG_COLOR_TYPE_PALETTE */\n if (mng_info->write_png_depth == 0)\n {\n size_t\n one;\n\n ping_bit_depth=1;\n one=1;\n\n while ((one << ping_bit_depth) < (size_t) number_colors)\n ping_bit_depth <<= 1;\n }\n\n ping_num_trans=0;\n\n if (matte != MagickFalse)\n {\n /*\n * Set up trans_colors array.\n */\n assert(number_colors <= 256);\n\n ping_num_trans=(unsigned short) (number_transparent +\n number_semitransparent);\n\n if (ping_num_trans == 0)\n ping_have_tRNS=MagickFalse;\n\n else\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color (1)\");\n }\n ping_have_tRNS=MagickTrue;\n\n for (i=0; i < ping_num_trans; i++)\n {\n ping_trans_alpha[i]= (png_byte)\n ScaleQuantumToChar(image->colormap[i].alpha);\n }\n }\n }\n }\n }\n\n else\n {\n\n if (image_depth < 8)\n image_depth=8;\n\n if ((save_image_depth == 16) && (image_depth == 8))\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color from (%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n\n ping_trans_color.red*=0x0101;\n ping_trans_color.green*=0x0101;\n ping_trans_color.blue*=0x0101;\n ping_trans_color.gray*=0x0101;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" to (%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n }\n }\n\n if (ping_bit_depth < (ssize_t) mng_info->write_png_depth)\n ping_bit_depth = (ssize_t) mng_info->write_png_depth;\n\n /*\n Adjust background and transparency samples in sub-8-bit grayscale files.\n */\n if (ping_bit_depth < 8 && ping_color_type ==\n PNG_COLOR_TYPE_GRAY)\n {\n png_uint_16\n maxval;\n\n size_t\n one=1;\n\n maxval=(png_uint_16) ((one << ping_bit_depth)-1);\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n\n ping_background.gray=(png_uint_16) ((maxval/65535.)*\n (ScaleQuantumToShort(((GetPixelInfoIntensity(image,\n &image->background_color))) +.5)));\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk (2)\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n\n ping_have_bKGD = MagickTrue;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color.gray from %d\",\n (int)ping_trans_color.gray);\n\n ping_trans_color.gray=(png_uint_16) ((maxval/255.)*(\n ping_trans_color.gray)+.5);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" to %d\", (int)ping_trans_color.gray);\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if (mng_info->IsPalette && (int) ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n /*\n Identify which colormap entry is the background color.\n */\n\n number_colors=image_colors;\n\n for (i=0; i < (ssize_t) MagickMax(1L*number_colors,1L); i++)\n if (IsPNGColorEqual(image->background_color,image->colormap[i]))\n break;\n\n ping_background.index=(png_byte) i;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk with index=%d\",(int) i);\n }\n\n if (i < (ssize_t) number_colors)\n {\n ping_have_bKGD = MagickTrue;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background =(%d,%d,%d)\",\n (int) ping_background.red,\n (int) ping_background.green,\n (int) ping_background.blue);\n }\n }\n\n else /* Can't happen */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No room in PLTE to add bKGD color\");\n ping_have_bKGD = MagickFalse;\n }\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG color type: %s (%d)\", PngColorTypeToString(ping_color_type),\n ping_color_type);\n /*\n Initialize compression level and filtering.\n */\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up deflate compression\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression buffer size: 32768\");\n }\n\n png_set_compression_buffer_size(ping,32768L);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression mem level: 9\");\n\n png_set_compression_mem_level(ping, 9);\n\n /* Untangle the \"-quality\" setting:\n\n Undefined is 0; the default is used.\n Default is 75\n\n 10's digit:\n\n 0 or omitted: Use Z_HUFFMAN_ONLY strategy with the\n zlib default compression level\n\n 1-9: the zlib compression level\n\n 1's digit:\n\n 0-4: the PNG filter method\n\n 5: libpng adaptive filtering if compression level > 5\n libpng filter type \"none\" if compression level <= 5\n or if image is grayscale or palette\n\n 6: libpng adaptive filtering\n\n 7: \"LOCO\" filtering (intrapixel differing) if writing\n a MNG, otherwise \"none\". Did not work in IM-6.7.0-9\n and earlier because of a missing \"else\".\n\n 8: Z_RLE strategy (or Z_HUFFMAN_ONLY if quality < 10), adaptive\n filtering. Unused prior to IM-6.7.0-10, was same as 6\n\n 9: Z_RLE strategy (or Z_HUFFMAN_ONLY if quality < 10), no PNG filters\n Unused prior to IM-6.7.0-10, was same as 6\n\n Note that using the -quality option, not all combinations of\n PNG filter type, zlib compression level, and zlib compression\n strategy are possible. This will be addressed soon in a\n release that accomodates \"-define png:compression-strategy\", etc.\n\n */\n\n quality=image_info->quality == UndefinedCompressionQuality ? 75UL :\n image_info->quality;\n\n if (quality <= 9)\n {\n if (mng_info->write_png_compression_strategy == 0)\n mng_info->write_png_compression_strategy = Z_HUFFMAN_ONLY+1;\n }\n\n else if (mng_info->write_png_compression_level == 0)\n {\n int\n level;\n\n level=(int) MagickMin((ssize_t) quality/10,9);\n\n mng_info->write_png_compression_level = level+1;\n }\n\n if (mng_info->write_png_compression_strategy == 0)\n {\n if ((quality %10) == 8 || (quality %10) == 9)\n#ifdef Z_RLE /* Z_RLE was added to zlib-1.2.0 */\n mng_info->write_png_compression_strategy=Z_RLE+1;\n#else\n mng_info->write_png_compression_strategy = Z_DEFAULT_STRATEGY+1;\n#endif\n }\n\n if (mng_info->write_png_compression_filter == 0)\n mng_info->write_png_compression_filter=((int) quality % 10) + 1;\n\n if (logging != MagickFalse)\n {\n if (mng_info->write_png_compression_level)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression level: %d\",\n (int) mng_info->write_png_compression_level-1);\n\n if (mng_info->write_png_compression_strategy)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression strategy: %d\",\n (int) mng_info->write_png_compression_strategy-1);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up filtering\");\n\n if (mng_info->write_png_compression_filter == 6)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: ADAPTIVE\");\n else if (mng_info->write_png_compression_filter == 0 ||\n mng_info->write_png_compression_filter == 1)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: NONE\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: %d\",\n (int) mng_info->write_png_compression_filter-1);\n }\n\n if (mng_info->write_png_compression_level != 0)\n png_set_compression_level(ping,mng_info->write_png_compression_level-1);\n\n if (mng_info->write_png_compression_filter == 6)\n {\n if (((int) ping_color_type == PNG_COLOR_TYPE_GRAY) ||\n ((int) ping_color_type == PNG_COLOR_TYPE_PALETTE) ||\n (quality < 50))\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n else\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_ALL_FILTERS);\n }\n else if (mng_info->write_png_compression_filter == 7 ||\n mng_info->write_png_compression_filter == 10)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_ALL_FILTERS);\n\n else if (mng_info->write_png_compression_filter == 8)\n {\n#if defined(PNG_MNG_FEATURES_SUPPORTED) && defined(PNG_INTRAPIXEL_DIFFERENCING)\n if (mng_info->write_mng)\n {\n if (((int) ping_color_type == PNG_COLOR_TYPE_RGB) ||\n ((int) ping_color_type == PNG_COLOR_TYPE_RGBA))\n ping_filter_method=PNG_INTRAPIXEL_DIFFERENCING;\n }\n#endif\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n }\n\n else if (mng_info->write_png_compression_filter == 9)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n\n else if (mng_info->write_png_compression_filter != 0)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,\n mng_info->write_png_compression_filter-1);\n\n if (mng_info->write_png_compression_strategy != 0)\n png_set_compression_strategy(ping,\n mng_info->write_png_compression_strategy-1);\n\n ping_interlace_method=image_info->interlace != NoInterlace;\n\n if (mng_info->write_mng)\n png_set_sig_bytes(ping,8);\n\n /* Bail out if cannot meet defined png:bit-depth or png:color-type */\n\n if (mng_info->write_png_colortype != 0)\n {\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_GRAY)\n if (ping_have_color != MagickFalse)\n {\n ping_color_type = PNG_COLOR_TYPE_RGB;\n\n if (ping_bit_depth < 8)\n ping_bit_depth=8;\n }\n\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_GRAY_ALPHA)\n if (ping_have_color != MagickFalse)\n ping_color_type = PNG_COLOR_TYPE_RGB_ALPHA;\n }\n\n if (ping_need_colortype_warning != MagickFalse ||\n ((mng_info->write_png_depth &&\n (int) mng_info->write_png_depth != ping_bit_depth) ||\n (mng_info->write_png_colortype &&\n ((int) mng_info->write_png_colortype-1 != ping_color_type &&\n mng_info->write_png_colortype != 7 &&\n !(mng_info->write_png_colortype == 5 && ping_color_type == 0)))))\n {\n if (logging != MagickFalse)\n {\n if (ping_need_colortype_warning != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image has transparency but tRNS chunk was excluded\");\n }\n\n if (mng_info->write_png_depth)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:bit-depth=%u, Computed depth=%u\",\n mng_info->write_png_depth,\n ping_bit_depth);\n }\n\n if (mng_info->write_png_colortype)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:color-type=%u, Computed color type=%u\",\n mng_info->write_png_colortype-1,\n ping_color_type);\n }\n }\n\n png_warning(ping,\n \"Cannot write image with defined png:bit-depth or png:color-type.\");\n }\n\n if (image_matte != MagickFalse && image->alpha_trait == UndefinedPixelTrait)\n {\n /* Add an opaque matte channel */\n image->alpha_trait = BlendPixelTrait;\n (void) SetImageAlpha(image,OpaqueAlpha,exception);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Added an opaque matte channel\");\n }\n\n if (number_transparent != 0 || number_semitransparent != 0)\n {\n if (ping_color_type < 4)\n {\n ping_have_tRNS=MagickTrue;\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting ping_have_tRNS=MagickTrue.\");\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG header chunks\");\n\n png_set_IHDR(ping,ping_info,ping_width,ping_height,\n ping_bit_depth,ping_color_type,\n ping_interlace_method,ping_compression_method,\n ping_filter_method);\n\n if (ping_color_type == 3 && ping_have_PLTE != MagickFalse)\n {\n png_set_PLTE(ping,ping_info,palette,number_colors);\n\n if (logging != MagickFalse)\n {\n for (i=0; i< (ssize_t) number_colors; i++)\n {\n if (i < ping_num_trans)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PLTE[%d] = (%d,%d,%d), tRNS[%d] = (%d)\",\n (int) i,\n (int) palette[i].red,\n (int) palette[i].green,\n (int) palette[i].blue,\n (int) i,\n (int) ping_trans_alpha[i]);\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PLTE[%d] = (%d,%d,%d)\",\n (int) i,\n (int) palette[i].red,\n (int) palette[i].green,\n (int) palette[i].blue);\n }\n }\n }\n\n /* Only write the iCCP chunk if we are not writing the sRGB chunk. */\n if (ping_exclude_sRGB != MagickFalse ||\n (!png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n {\n if ((ping_exclude_tEXt == MagickFalse ||\n ping_exclude_zTXt == MagickFalse) &&\n (ping_exclude_iCCP == MagickFalse || ping_exclude_zCCP == MagickFalse))\n {\n ResetImageProfileIterator(image);\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n#ifdef PNG_WRITE_iCCP_SUPPORTED\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n {\n ping_have_iCCP = MagickTrue;\n if (ping_exclude_iCCP == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up iCCP chunk\");\n\n png_set_iCCP(ping,ping_info,(png_charp) name,0,\n#if (PNG_LIBPNG_VER < 10500)\n (png_charp) GetStringInfoDatum(profile),\n#else\n (const png_byte *) GetStringInfoDatum(profile),\n#endif\n (png_uint_32) GetStringInfoLength(profile));\n }\n else\n {\n /* Do not write hex-encoded ICC chunk */\n name=GetNextImageProfile(image);\n continue;\n }\n }\n#endif /* WRITE_iCCP */\n\n if (LocaleCompare(name,\"exif\") == 0)\n {\n /* Do not write hex-encoded ICC chunk; we will\n write it later as an eXIf chunk */\n name=GetNextImageProfile(image);\n continue;\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up zTXt chunk with uuencoded %s profile\",\n name);\n Magick_png_write_raw_profile(image_info,ping,ping_info,\n (unsigned char *) name,(unsigned char *) name,\n GetStringInfoDatum(profile),\n (png_uint_32) GetStringInfoLength(profile));\n }\n name=GetNextImageProfile(image);\n }\n }\n }\n\n#if defined(PNG_WRITE_sRGB_SUPPORTED)\n if ((mng_info->have_write_global_srgb == 0) &&\n ping_have_iCCP != MagickTrue &&\n (ping_have_sRGB != MagickFalse ||\n png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n {\n if (ping_exclude_sRGB == MagickFalse)\n {\n /*\n Note image rendering intent.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up sRGB chunk\");\n\n (void) png_set_sRGB(ping,ping_info,(\n Magick_RenderingIntent_to_PNG_RenderingIntent(\n image->rendering_intent)));\n\n ping_have_sRGB = MagickTrue;\n }\n }\n\n if ((!mng_info->write_mng) || (!png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n#endif\n {\n if (ping_exclude_gAMA == MagickFalse &&\n ping_have_iCCP == MagickFalse &&\n ping_have_sRGB == MagickFalse &&\n (ping_exclude_sRGB == MagickFalse ||\n (image->gamma < .45 || image->gamma > .46)))\n {\n if ((mng_info->have_write_global_gama == 0) && (image->gamma != 0.0))\n {\n /*\n Note image gamma.\n To do: check for cHRM+gAMA == sRGB, and write sRGB instead.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up gAMA chunk\");\n\n png_set_gAMA(ping,ping_info,image->gamma);\n }\n }\n\n if (ping_exclude_cHRM == MagickFalse && ping_have_sRGB == MagickFalse)\n {\n if ((mng_info->have_write_global_chrm == 0) &&\n (image->chromaticity.red_primary.x != 0.0))\n {\n /*\n Note image chromaticity.\n Note: if cHRM+gAMA == sRGB write sRGB instead.\n */\n PrimaryInfo\n bp,\n gp,\n rp,\n wp;\n\n wp=image->chromaticity.white_point;\n rp=image->chromaticity.red_primary;\n gp=image->chromaticity.green_primary;\n bp=image->chromaticity.blue_primary;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up cHRM chunk\");\n\n png_set_cHRM(ping,ping_info,wp.x,wp.y,rp.x,rp.y,gp.x,gp.y,\n bp.x,bp.y);\n }\n }\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if (ping_have_bKGD != MagickFalse)\n {\n png_set_bKGD(ping,ping_info,&ping_background);\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background color = (%d,%d,%d)\",\n (int) ping_background.red,\n (int) ping_background.green,\n (int) ping_background.blue);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" index = %d, gray=%d\",\n (int) ping_background.index,\n (int) ping_background.gray);\n }\n }\n }\n\n if (ping_exclude_pHYs == MagickFalse)\n {\n if (ping_have_pHYs != MagickFalse)\n {\n png_set_pHYs(ping,ping_info,\n ping_pHYs_x_resolution,\n ping_pHYs_y_resolution,\n ping_pHYs_unit_type);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up pHYs chunk\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" x_resolution=%lu\",\n (unsigned long) ping_pHYs_x_resolution);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" y_resolution=%lu\",\n (unsigned long) ping_pHYs_y_resolution);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" unit_type=%lu\",\n (unsigned long) ping_pHYs_unit_type);\n }\n }\n }\n\n#if defined(PNG_tIME_SUPPORTED)\n if (ping_exclude_tIME == MagickFalse)\n {\n const char\n *timestamp;\n\n if (image->taint == MagickFalse)\n {\n timestamp=GetImageOption(image_info,\"png:tIME\");\n\n if (timestamp == (const char *) NULL)\n timestamp=GetImageProperty(image,\"png:tIME\",exception);\n }\n\n else\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reset tIME in tainted image\");\n\n timestamp=GetImageProperty(image,\"date:modify\",exception);\n }\n\n if (timestamp != (const char *) NULL)\n write_tIME_chunk(image,ping,ping_info,timestamp,exception);\n }\n#endif\n\n if (mng_info->need_blob != MagickFalse)\n {\n if (OpenBlob(image_info,image,WriteBinaryBlobMode,exception) ==\n MagickFalse)\n png_error(ping,\"WriteBlob Failed\");\n\n ping_have_blob=MagickTrue;\n }\n\n png_write_info_before_PLTE(ping, ping_info);\n\n if (ping_have_tRNS != MagickFalse && ping_color_type < 4)\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Calling png_set_tRNS with num_trans=%d\",ping_num_trans);\n }\n\n if (ping_color_type == 3)\n (void) png_set_tRNS(ping, ping_info,\n ping_trans_alpha,\n ping_num_trans,\n NULL);\n\n else\n {\n (void) png_set_tRNS(ping, ping_info,\n NULL,\n 0,\n &ping_trans_color);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" tRNS color =(%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n }\n }\n\n /* write any png-chunk-b profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-b\",logging);\n\n png_write_info(ping,ping_info);\n\n /* write any PNG-chunk-m profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-m\",logging);\n\n ping_wrote_caNv = MagickFalse;\n\n /* write caNv chunk */\n if (ping_exclude_caNv == MagickFalse)\n {\n if ((image->page.width != 0 && image->page.width != image->columns) ||\n (image->page.height != 0 && image->page.height != image->rows) ||\n image->page.x != 0 || image->page.y != 0)\n {\n unsigned char\n chunk[20];\n\n (void) WriteBlobMSBULong(image,16L); /* data length=8 */\n PNGType(chunk,mng_caNv);\n LogPNGChunk(logging,mng_caNv,16L);\n PNGLong(chunk+4,(png_uint_32) image->page.width);\n PNGLong(chunk+8,(png_uint_32) image->page.height);\n PNGsLong(chunk+12,(png_int_32) image->page.x);\n PNGsLong(chunk+16,(png_int_32) image->page.y);\n (void) WriteBlob(image,20,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,20));\n ping_wrote_caNv = MagickTrue;\n }\n }\n\n#if defined(PNG_oFFs_SUPPORTED)\n if (ping_exclude_oFFs == MagickFalse && ping_wrote_caNv == MagickFalse)\n {\n if (image->page.x || image->page.y)\n {\n png_set_oFFs(ping,ping_info,(png_int_32) image->page.x,\n (png_int_32) image->page.y, 0);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up oFFs chunk with x=%d, y=%d, units=0\",\n (int) image->page.x, (int) image->page.y);\n }\n }\n#endif\n\n /* write vpAg chunk (deprecated, replaced by caNv) */\n if (ping_exclude_vpAg == MagickFalse && ping_wrote_caNv == MagickFalse)\n {\n if ((image->page.width != 0 && image->page.width != image->columns) ||\n (image->page.height != 0 && image->page.height != image->rows))\n {\n unsigned char\n chunk[14];\n\n (void) WriteBlobMSBULong(image,9L); /* data length=8 */\n PNGType(chunk,mng_vpAg);\n LogPNGChunk(logging,mng_vpAg,9L);\n PNGLong(chunk+4,(png_uint_32) image->page.width);\n PNGLong(chunk+8,(png_uint_32) image->page.height);\n chunk[12]=0; /* unit = pixels */\n (void) WriteBlob(image,13,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,13));\n }\n }\n\n#if (PNG_LIBPNG_VER == 10206)\n /* avoid libpng-1.2.6 bug by setting PNG_HAVE_IDAT flag */\n#define PNG_HAVE_IDAT 0x04\n ping->mode |= PNG_HAVE_IDAT;\n#undef PNG_HAVE_IDAT\n#endif\n\n png_set_packing(ping);\n /*\n Allocate memory.\n */\n rowbytes=image->columns;\n if (image_depth > 8)\n rowbytes*=2;\n switch (ping_color_type)\n {\n case PNG_COLOR_TYPE_RGB:\n rowbytes*=3;\n break;\n\n case PNG_COLOR_TYPE_GRAY_ALPHA:\n rowbytes*=2;\n break;\n\n case PNG_COLOR_TYPE_RGBA:\n rowbytes*=4;\n break;\n\n default:\n break;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG image data\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocating %.20g bytes of memory for pixels\",(double) rowbytes);\n }\n pixel_info=AcquireVirtualMemory(rowbytes,sizeof(*ping_pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n png_error(ping,\"Allocation of memory for pixels failed\");\n ping_pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n\n /*\n Initialize image scanlines.\n */\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n png_error(ping,\"Memory allocation for quantum_info failed\");\n quantum_info->format=UndefinedQuantumFormat;\n SetQuantumDepth(image,quantum_info,image_depth);\n (void) SetQuantumEndian(image,quantum_info,MSBEndian);\n num_passes=png_set_interlace_handling(ping);\n\n if ((!mng_info->write_png8 && !mng_info->write_png24 &&\n !mng_info->write_png48 && !mng_info->write_png64 &&\n !mng_info->write_png32) &&\n (mng_info->IsPalette ||\n (image_info->type == BilevelType)) &&\n image_matte == MagickFalse &&\n ping_have_non_bw == MagickFalse)\n {\n /* Palette, Bilevel, or Opaque Monochrome */\n register const Quantum\n *p;\n\n SetQuantumDepth(image,quantum_info,8);\n for (pass=0; pass < num_passes; pass++)\n {\n /*\n Convert PseudoClass image to a PNG monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (0)\");\n\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (mng_info->IsPalette)\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_PALETTE &&\n mng_info->write_png_depth &&\n mng_info->write_png_depth != old_bit_depth)\n {\n /* Undo pixel scaling */\n for (i=0; i < (ssize_t) image->columns; i++)\n *(ping_pixels+i)=(unsigned char) (*(ping_pixels+i)\n >> (8-old_bit_depth));\n }\n }\n\n else\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n }\n\n if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE)\n for (i=0; i < (ssize_t) image->columns; i++)\n *(ping_pixels+i)=(unsigned char) ((*(ping_pixels+i) > 127) ?\n 255 : 0);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (1)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n\n else /* Not Palette, Bilevel, or Opaque Monochrome */\n {\n if ((!mng_info->write_png8 && !mng_info->write_png24 &&\n !mng_info->write_png48 && !mng_info->write_png64 &&\n !mng_info->write_png32) && (image_matte != MagickFalse ||\n (ping_bit_depth >= MAGICKCORE_QUANTUM_DEPTH)) &&\n (mng_info->IsPalette) && ping_have_color == MagickFalse)\n {\n register const Quantum\n *p;\n\n for (pass=0; pass < num_passes; pass++)\n {\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (mng_info->IsPalette)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY PNG pixels (2)\");\n }\n\n else /* PNG_COLOR_TYPE_GRAY_ALPHA */\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (2)\");\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,exception);\n }\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (2)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n\n else\n {\n register const Quantum\n *p;\n\n for (pass=0; pass < num_passes; pass++)\n {\n if ((image_depth > 8) ||\n mng_info->write_png24 ||\n mng_info->write_png32 ||\n mng_info->write_png48 ||\n mng_info->write_png64 ||\n (!mng_info->write_png8 && !mng_info->IsPalette))\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (image->storage_class == DirectClass)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n }\n\n else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,\n exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (3)\");\n }\n\n else if (image_matte != MagickFalse)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RGBAQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RGBQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (3)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n\n else\n /* not ((image_depth > 8) ||\n mng_info->write_png24 || mng_info->write_png32 ||\n mng_info->write_png48 || mng_info->write_png64 ||\n (!mng_info->write_png8 && !mng_info->IsPalette))\n */\n {\n if ((ping_color_type != PNG_COLOR_TYPE_GRAY) &&\n (ping_color_type != PNG_COLOR_TYPE_GRAY_ALPHA))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" pass %d, Image Is not GRAY or GRAY_ALPHA\",pass);\n\n SetQuantumDepth(image,quantum_info,8);\n image_depth=8;\n }\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" pass %d, Image Is RGB, 16-bit GRAY, or GRAY_ALPHA\",\n pass);\n\n p=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n SetQuantumDepth(image,quantum_info,image->depth);\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n }\n\n else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (4)\");\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,\n exception);\n }\n\n else\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,IndexQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y <= 2)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of non-gray pixels (4)\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_pixels[0]=%d,ping_pixels[1]=%d\",\n (int)ping_pixels[0],(int)ping_pixels[1]);\n }\n }\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n }\n }\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Wrote PNG image data\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Width: %.20g\",(double) ping_width);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Height: %.20g\",(double) ping_height);\n\n if (mng_info->write_png_depth)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:bit-depth: %d\",mng_info->write_png_depth);\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG bit-depth written: %d\",ping_bit_depth);\n\n if (mng_info->write_png_colortype)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:color-type: %d\",mng_info->write_png_colortype-1);\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG color-type written: %d\",ping_color_type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG Interlace method: %d\",ping_interlace_method);\n }\n /*\n Generate text chunks after IDAT.\n */\n if (ping_exclude_tEXt == MagickFalse || ping_exclude_zTXt == MagickFalse)\n {\n ResetImagePropertyIterator(image);\n property=GetNextImageProperty(image);\n while (property != (const char *) NULL)\n {\n png_textp\n text;\n\n value=GetImageProperty(image,property,exception);\n\n /* Don't write any \"png:\" or \"jpeg:\" properties; those are just for\n * \"identify\" or for passing through to another JPEG\n */\n if ((LocaleNCompare(property,\"png:\",4) != 0 &&\n LocaleNCompare(property,\"jpeg:\",5) != 0) &&\n\n\n /* Suppress density and units if we wrote a pHYs chunk */\n (ping_exclude_pHYs != MagickFalse ||\n LocaleCompare(property,\"density\") != 0 ||\n LocaleCompare(property,\"units\") != 0) &&\n\n /* Suppress the IM-generated Date:create and Date:modify */\n (ping_exclude_date == MagickFalse ||\n LocaleNCompare(property, \"Date:\",5) != 0))\n {\n if (value != (const char *) NULL)\n {\n\n#if PNG_LIBPNG_VER >= 10400\n text=(png_textp) png_malloc(ping,\n (png_alloc_size_t) sizeof(png_text));\n#else\n text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text));\n#endif\n text[0].key=(char *) property;\n text[0].text=(char *) value;\n text[0].text_length=strlen(value);\n\n if (ping_exclude_tEXt != MagickFalse)\n text[0].compression=PNG_TEXT_COMPRESSION_zTXt;\n\n else if (ping_exclude_zTXt != MagickFalse)\n text[0].compression=PNG_TEXT_COMPRESSION_NONE;\n\n else\n {\n text[0].compression=image_info->compression == NoCompression ||\n (image_info->compression == UndefinedCompression &&\n text[0].text_length < 128) ? PNG_TEXT_COMPRESSION_NONE :\n PNG_TEXT_COMPRESSION_zTXt ;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up text chunk\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" keyword: '%s'\",text[0].key);\n }\n\n png_set_text(ping,ping_info,text,1);\n png_free(ping,text);\n }\n }\n property=GetNextImageProperty(image);\n }\n }\n\n /* write any PNG-chunk-e profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-e\",logging);\n\n /* write exIf profile */\n if (ping_have_eXIf != MagickFalse && ping_exclude_eXIf == MagickFalse)\n {\n char\n *name;\n\n ResetImageProfileIterator(image);\n\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n if (LocaleCompare(name,\"exif\") == 0)\n {\n const StringInfo\n *profile;\n\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n png_uint_32\n length;\n\n unsigned char\n chunk[4],\n *data;\n\n StringInfo\n *ping_profile;\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Have eXIf profile\");\n\n ping_profile=CloneStringInfo(profile);\n data=GetStringInfoDatum(ping_profile),\n length=(png_uint_32) GetStringInfoLength(ping_profile);\n\n PNGType(chunk,mng_eXIf);\n if (length < 7)\n {\n ping_profile=DestroyStringInfo(ping_profile);\n break; /* otherwise crashes */\n }\n\n /* skip the \"Exif\\0\\0\" JFIF Exif Header ID */\n length -= 6;\n\n LogPNGChunk(logging,chunk,length);\n (void) WriteBlobMSBULong(image,length);\n (void) WriteBlob(image,4,chunk);\n (void) WriteBlob(image,length,data+6);\n (void) WriteBlobMSBULong(image,crc32(crc32(0,chunk,4),\n data+6, (uInt) length));\n ping_profile=DestroyStringInfo(ping_profile);\n break;\n }\n }\n name=GetNextImageProfile(image);\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG end info\");\n\n png_write_end(ping,ping_info);\n\n if (mng_info->need_fram && (int) image->dispose == BackgroundDispose)\n {\n if (mng_info->page.x || mng_info->page.y ||\n (ping_width != mng_info->page.width) ||\n (ping_height != mng_info->page.height))\n {\n unsigned char\n chunk[32];\n\n /*\n Write FRAM 4 with clipping boundaries followed by FRAM 1.\n */\n (void) WriteBlobMSBULong(image,27L); /* data length=27 */\n PNGType(chunk,mng_FRAM);\n LogPNGChunk(logging,mng_FRAM,27L);\n chunk[4]=4;\n chunk[5]=0; /* frame name separator (no name) */\n chunk[6]=1; /* flag for changing delay, for next frame only */\n chunk[7]=0; /* flag for changing frame timeout */\n chunk[8]=1; /* flag for changing frame clipping for next frame */\n chunk[9]=0; /* flag for changing frame sync_id */\n PNGLong(chunk+10,(png_uint_32) (0L)); /* temporary 0 delay */\n chunk[14]=0; /* clipping boundaries delta type */\n PNGLong(chunk+15,(png_uint_32) (mng_info->page.x)); /* left cb */\n PNGLong(chunk+19,\n (png_uint_32) (mng_info->page.x + ping_width));\n PNGLong(chunk+23,(png_uint_32) (mng_info->page.y)); /* top cb */\n PNGLong(chunk+27,\n (png_uint_32) (mng_info->page.y + ping_height));\n (void) WriteBlob(image,31,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,31));\n mng_info->old_framing_mode=4;\n mng_info->framing_mode=1;\n }\n\n else\n mng_info->framing_mode=3;\n }\n if (mng_info->write_mng && !mng_info->need_fram &&\n ((int) image->dispose == 3))\n png_error(ping, \"Cannot convert GIF with disposal method 3 to MNG-LC\");\n\n /*\n Free PNG resources.\n */\n\n png_destroy_write_struct(&ping,&ping_info);\n\n pixel_info=RelinquishVirtualMemory(pixel_info);\n\n if (ping_have_blob != MagickFalse)\n (void) CloseBlob(image);\n\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n\n /* Store bit depth actually written */\n s[0]=(char) ping_bit_depth;\n s[1]='\\0';\n\n (void) SetImageProperty(IMimage,\"png:bit-depth-written\",s,exception);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" exit WriteOnePNGImage()\");\n\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n UnlockSemaphoreInfo(ping_semaphore);\n#endif\n\n /* } for navigation to beginning of SETJMP-protected block. Revert to\n * Throwing an Exception when an error occurs.\n */\n\n return(MagickTrue);\n/* End write one PNG image */\n\n}","lang":"c","vul_type":"cwe-476","target_token_count":28095,"sven_meta":{"func_name":"WriteOnePNGImage","file_name":"coders/png.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/816ecab6c532ae086ff4186b3eaf4aa7092d536f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#47-1bf6e0cbc1c9","input":"static MagickBooleanType ReadPSDChannel(Image *image,\n const ImageInfo *image_info,const PSDInfo *psd_info,LayerInfo* layer_info,\n const size_t channel,const PSDCompressionType compression,\n ExceptionInfo *exception)\n{\n Image\n *channel_image,\n *mask;\n\n MagickOffsetType\n offset;\n\n MagickBooleanType\n status;\n\n channel_image=image;\n mask=(Image *) NULL;\n if (layer_info->channel_info[channel].type < -1)\n {\n const char\n *option;\n /*\n Ignore mask that is not a user supplied layer mask, if the mask is\n disabled or if the flags have unsupported values.\n */\n option=GetImageOption(image_info,\"psd:preserve-opacity-mask\");\n if ((layer_info->channel_info[channel].type != -2) ||\n (layer_info->mask.flags > 2) || ((layer_info->mask.flags & 0x02) &&\n (IsStringTrue(option) == MagickFalse)))\n {\n SeekBlob(image,layer_info->channel_info[channel].size-2,SEEK_CUR);\n return(MagickTrue);\n }\n mask=CloneImage(image,layer_info->mask.page.width,\n layer_info->mask.page.height,MagickFalse,exception);\n mask->matte=MagickFalse;\n channel_image=mask;\n }\n\n offset=TellBlob(image);\n status=MagickTrue;\n switch(compression)\n {\n case Raw:\n status=ReadPSDChannelRaw(channel_image,psd_info->channels,\n layer_info->channel_info[channel].type,exception);\n break;\n case RLE:\n {\n MagickOffsetType\n *sizes;\n\n sizes=ReadPSDRLESizes(channel_image,psd_info,channel_image->rows);\n if (sizes == (MagickOffsetType *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n status=ReadPSDChannelRLE(channel_image,psd_info,\n layer_info->channel_info[channel].type,sizes,exception);\n sizes=(MagickOffsetType *) RelinquishMagickMemory(sizes);\n }\n break;\n case ZipWithPrediction:\n case ZipWithoutPrediction:\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n status=ReadPSDChannelZip(channel_image,layer_info->channels,\n layer_info->channel_info[channel].type,compression,\n layer_info->channel_info[channel].size-2,exception);\n#else\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateWarning,\"DelegateLibrarySupportNotBuiltIn\",\n \"'%s' (ZLIB)\",image->filename);\n#endif\n break;\n default:\n (void) ThrowMagickException(exception,GetMagickModule(),TypeWarning,\n \"CompressionNotSupported\",\"'%.20g'\",(double) compression);\n break;\n }\n\n SeekBlob(image,offset+layer_info->channel_info[channel].size-2,SEEK_SET);\n if (status == MagickFalse)\n {\n if (mask != (Image *) NULL)\n DestroyImage(mask);\n ThrowBinaryException(CoderError,\"UnableToDecompressImage\",\n image->filename);\n }\n layer_info->mask.image=mask;\n return(status);\n}","target":"static MagickBooleanType ReadPSDChannel(Image *image,\n const ImageInfo *image_info,const PSDInfo *psd_info,LayerInfo* layer_info,\n const size_t channel,const PSDCompressionType compression,\n ExceptionInfo *exception)\n{\n Image\n *channel_image,\n *mask;\n\n MagickOffsetType\n offset;\n\n MagickBooleanType\n status;\n\n channel_image=image;\n mask=(Image *) NULL;\n if (layer_info->channel_info[channel].type < -1)\n {\n const char\n *option;\n /*\n Ignore mask that is not a user supplied layer mask, if the mask is\n disabled or if the flags have unsupported values.\n */\n option=GetImageOption(image_info,\"psd:preserve-opacity-mask\");\n if ((layer_info->channel_info[channel].type != -2) ||\n (layer_info->mask.flags > 2) || ((layer_info->mask.flags & 0x02) &&\n (IsStringTrue(option) == MagickFalse)))\n {\n SeekBlob(image,layer_info->channel_info[channel].size-2,SEEK_CUR);\n return(MagickTrue);\n }\n mask=CloneImage(image,layer_info->mask.page.width,\n layer_info->mask.page.height,MagickFalse,exception);\n if (mask != (Image *) NULL)\n {\n mask->matte=MagickFalse;\n channel_image=mask;\n }\n }\n\n offset=TellBlob(image);\n status=MagickTrue;\n switch(compression)\n {\n case Raw:\n status=ReadPSDChannelRaw(channel_image,psd_info->channels,\n layer_info->channel_info[channel].type,exception);\n break;\n case RLE:\n {\n MagickOffsetType\n *sizes;\n\n sizes=ReadPSDRLESizes(channel_image,psd_info,channel_image->rows);\n if (sizes == (MagickOffsetType *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n status=ReadPSDChannelRLE(channel_image,psd_info,\n layer_info->channel_info[channel].type,sizes,exception);\n sizes=(MagickOffsetType *) RelinquishMagickMemory(sizes);\n }\n break;\n case ZipWithPrediction:\n case ZipWithoutPrediction:\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n status=ReadPSDChannelZip(channel_image,layer_info->channels,\n layer_info->channel_info[channel].type,compression,\n layer_info->channel_info[channel].size-2,exception);\n#else\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateWarning,\"DelegateLibrarySupportNotBuiltIn\",\n \"'%s' (ZLIB)\",image->filename);\n#endif\n break;\n default:\n (void) ThrowMagickException(exception,GetMagickModule(),TypeWarning,\n \"CompressionNotSupported\",\"'%.20g'\",(double) compression);\n break;\n }\n\n SeekBlob(image,offset+layer_info->channel_info[channel].size-2,SEEK_SET);\n if (status == MagickFalse)\n {\n if (mask != (Image *) NULL)\n DestroyImage(mask);\n ThrowBinaryException(CoderError,\"UnableToDecompressImage\",\n image->filename);\n }\n layer_info->mask.image=mask;\n return(status);\n}","lang":"c","vul_type":"cwe-476","target_token_count":719,"sven_meta":{"func_name":"ReadPSDChannel","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/7f2dc7a1afc067d0c89f12c82bcdec0445fb1b94","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#53-47c4612a587b","input":"static void parse_class(RBinFile *binfile, RBinDexObj *bin, RBinDexClass *c,\n\t\t\t int class_index, int *methods, int *sym_count) {\n\tstruct r_bin_t *rbin = binfile->rbin;\n\n\tchar *class_name;\n\tint z;\n\tconst ut8 *p, *p_end;\n\n\tif (!c) {\n\t\treturn;\n\t}\n\n\tclass_name = dex_class_name (bin, c);\n\tclass_name = r_str_replace (class_name, \";\", \"\", 0); //TODO: move to func\n\n\tif (!class_name || !*class_name) {\n\t\treturn;\n\t}\n\n\tRBinClass *cls = R_NEW0 (RBinClass);\n\tif (!cls) {\n\t\treturn;\n\t}\n\tcls->name = class_name;\n\tcls->index = class_index;\n\tcls->addr = bin->header.class_offset + class_index * DEX_CLASS_SIZE;\n\tcls->methods = r_list_new ();\n\tif (!cls->methods) {\n\t\tfree (cls);\n\t\treturn;\n\t}\n\tcls->fields = r_list_new ();\n\tif (!cls->fields) {\n\t\tr_list_free (cls->methods);\n\t\tfree (cls);\n\t\treturn;\n\t}\n\tr_list_append (bin->classes_list, cls);\n\tif (dexdump) {\n\t\trbin->cb_printf (\" Class descriptor : '%s;'\\n\", class_name);\n\t\trbin->cb_printf (\n\t\t\t\" Access flags : 0x%04x (%s)\\n\", c->access_flags,\n\t\t\tcreateAccessFlagStr (c->access_flags, kAccessForClass));\n\t\trbin->cb_printf (\" Superclass : '%s'\\n\",\n\t\t\t\t dex_class_super_name (bin, c));\n\t\trbin->cb_printf (\" Interfaces -\\n\");\n\t}\n\n\tif (c->interfaces_offset > 0 &&\n\t bin->header.data_offset < c->interfaces_offset &&\n\t c->interfaces_offset <\n\t\t bin->header.data_offset + bin->header.data_size) {\n\t\tp = r_buf_get_at (binfile->buf, c->interfaces_offset, NULL);\n\t\tint types_list_size = r_read_le32(p);\n\t\tif (types_list_size < 0 || types_list_size >= bin->header.types_size ) {\n\t\t\treturn;\n\t\t}\n\t\tfor (z = 0; z < types_list_size; z++) {\n\t\t\tint t = r_read_le16 (p + 4 + z * 2);\n\t\t\tif (t > 0 && t < bin->header.types_size ) {\n\t\t\t\tint tid = bin->types[t].descriptor_id;\n\t\t\t\tif (dexdump) {\n\t\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\t\" #%d : '%s'\\n\",\n\t\t\t\t\t\tz, getstr (bin, tid));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: this is quite ugly\n\tif (!c || !c->class_data_offset) {\n\t\tif (dexdump) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" Static fields -\\n Instance fields \"\n\t\t\t\t\"-\\n Direct methods -\\n Virtual methods \"\n\t\t\t\t\"-\\n\");\n\t\t}\n\t} else {\n\t\t// TODO: move to func, def or inline\n\t\t// class_data_offset => [class_offset, class_defs_off+class_defs_size*32]\n\t\tif (bin->header.class_offset > c->class_data_offset ||\n\t\t c->class_data_offset <\n\t\t\t bin->header.class_offset +\n\t\t\t\t bin->header.class_size * DEX_CLASS_SIZE) {\n\t\t\treturn;\n\t\t}\n\n\t\tp = r_buf_get_at (binfile->buf, c->class_data_offset, NULL);\n\t\tp_end = p + binfile->buf->length - c->class_data_offset;\n\t\t//XXX check for NULL!!\n\t\tc->class_data = (struct dex_class_data_item_t *)malloc (\n\t\t\tsizeof (struct dex_class_data_item_t));\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->static_fields_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->instance_fields_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->direct_methods_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->virtual_methods_size);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Static fields -\\n\"); \n\t\t}\n\t\tp = parse_dex_class_fields (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->static_fields_size, true);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Instance fields -\\n\");\n\t\t}\n\t\tp = parse_dex_class_fields (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->instance_fields_size, false);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Direct methods -\\n\");\n\t\t}\n\t\tp = parse_dex_class_method (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->direct_methods_size, methods, true);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Virtual methods -\\n\");\n\t\t}\n\t\tp = parse_dex_class_method (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->virtual_methods_size, methods, false);\n\t}\n\n\tif (dexdump) { \n\t\tchar *source_file = getstr (bin, c->source_file);\n\t\tif (!source_file) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" source_file_idx : %d (unknown)\\n\\n\",\n\t\t\t\tc->source_file);\n\t\t} else {\n\t\t\trbin->cb_printf (\" source_file_idx : %d (%s)\\n\\n\",\n\t\t\t\t\t c->source_file, source_file);\n\t\t}\n\t}\n\t// TODO:!!!!\n\t// FIX: FREE BEFORE ALLOCATE!!!\n\t//free (class_name);\n}","target":"static void parse_class(RBinFile *binfile, RBinDexObj *bin, RBinDexClass *c,\n\t\t\t int class_index, int *methods, int *sym_count) {\n\tstruct r_bin_t *rbin = binfile->rbin;\n\n\tchar *class_name;\n\tint z;\n\tconst ut8 *p, *p_end;\n\n\tif (!c) {\n\t\treturn;\n\t}\n\n\tclass_name = dex_class_name (bin, c);\n\tclass_name = r_str_replace (class_name, \";\", \"\", 0); //TODO: move to func\n\n\tif (!class_name || !*class_name) {\n\t\treturn;\n\t}\n\n\tRBinClass *cls = R_NEW0 (RBinClass);\n\tif (!cls) {\n\t\treturn;\n\t}\n\tcls->name = class_name;\n\tcls->index = class_index;\n\tcls->addr = bin->header.class_offset + class_index * DEX_CLASS_SIZE;\n\tcls->methods = r_list_new ();\n\tif (!cls->methods) {\n\t\tfree (cls);\n\t\treturn;\n\t}\n\tcls->fields = r_list_new ();\n\tif (!cls->fields) {\n\t\tr_list_free (cls->methods);\n\t\tfree (cls);\n\t\treturn;\n\t}\n\tr_list_append (bin->classes_list, cls);\n\tif (dexdump) {\n\t\trbin->cb_printf (\" Class descriptor : '%s;'\\n\", class_name);\n\t\trbin->cb_printf (\n\t\t\t\" Access flags : 0x%04x (%s)\\n\", c->access_flags,\n\t\t\tcreateAccessFlagStr (c->access_flags, kAccessForClass));\n\t\trbin->cb_printf (\" Superclass : '%s'\\n\",\n\t\t\t\t dex_class_super_name (bin, c));\n\t\trbin->cb_printf (\" Interfaces -\\n\");\n\t}\n\n\tif (c->interfaces_offset > 0 &&\n\t bin->header.data_offset < c->interfaces_offset &&\n\t c->interfaces_offset <\n\t\t bin->header.data_offset + bin->header.data_size) {\n\t\tp = r_buf_get_at (binfile->buf, c->interfaces_offset, NULL);\n\t\tint types_list_size = r_read_le32 (p);\n\t\tif (types_list_size < 0 || types_list_size >= bin->header.types_size ) {\n\t\t\treturn;\n\t\t}\n\t\tfor (z = 0; z < types_list_size; z++) {\n\t\t\tint t = r_read_le16 (p + 4 + z * 2);\n\t\t\tif (t > 0 && t < bin->header.types_size ) {\n\t\t\t\tint tid = bin->types[t].descriptor_id;\n\t\t\t\tif (dexdump) {\n\t\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\t\" #%d : '%s'\\n\",\n\t\t\t\t\t\tz, getstr (bin, tid));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: this is quite ugly\n\tif (!c || !c->class_data_offset) {\n\t\tif (dexdump) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" Static fields -\\n Instance fields \"\n\t\t\t\t\"-\\n Direct methods -\\n Virtual methods \"\n\t\t\t\t\"-\\n\");\n\t\t}\n\t} else {\n\t\t// TODO: move to func, def or inline\n\t\t// class_data_offset => [class_offset, class_defs_off+class_defs_size*32]\n\t\tif (bin->header.class_offset > c->class_data_offset ||\n\t\t c->class_data_offset <\n\t\t\t bin->header.class_offset +\n\t\t\t\t bin->header.class_size * DEX_CLASS_SIZE) {\n\t\t\treturn;\n\t\t}\n\n\t\tp = r_buf_get_at (binfile->buf, c->class_data_offset, NULL);\n\t\tp_end = p + binfile->buf->length - c->class_data_offset;\n\t\t//XXX check for NULL!!\n\t\tc->class_data = (struct dex_class_data_item_t *)malloc (\n\t\t\tsizeof (struct dex_class_data_item_t));\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->static_fields_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->instance_fields_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->direct_methods_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->virtual_methods_size);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Static fields -\\n\"); \n\t\t}\n\t\tp = parse_dex_class_fields (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->static_fields_size, true);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Instance fields -\\n\");\n\t\t}\n\t\tp = parse_dex_class_fields (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->instance_fields_size, false);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Direct methods -\\n\");\n\t\t}\n\t\tp = parse_dex_class_method (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->direct_methods_size, methods, true);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Virtual methods -\\n\");\n\t\t}\n\t\tp = parse_dex_class_method (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->virtual_methods_size, methods, false);\n\t}\n\n\tif (dexdump) { \n\t\tchar *source_file = getstr (bin, c->source_file);\n\t\tif (!source_file) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" source_file_idx : %d (unknown)\\n\\n\",\n\t\t\t\tc->source_file);\n\t\t} else {\n\t\t\trbin->cb_printf (\" source_file_idx : %d (%s)\\n\\n\",\n\t\t\t\t\t c->source_file, source_file);\n\t\t}\n\t}\n\t// TODO:!!!!\n\t// FIX: FREE BEFORE ALLOCATE!!!\n\t//free (class_name);\n}","lang":"c","vul_type":"cwe-476","target_token_count":1340,"sven_meta":{"func_name":"parse_class","file_name":"libr/bin/p/bin_dex.c","commit_link":"github.com/radare/radare2/commit/1ea23bd6040441a21fbcfba69dce9a01af03f989","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#54-5706f1417726","input":"lexer_process_char_literal (parser_context_t *context_p, /**< context */\n const uint8_t *char_p, /**< characters */\n size_t length, /**< length of string */\n uint8_t literal_type, /**< final literal type */\n bool has_escape) /**< has escape sequences */\n{\n parser_list_iterator_t literal_iterator;\n lexer_literal_t *literal_p;\n uint32_t literal_index = 0;\n\n JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL\n || literal_type == LEXER_STRING_LITERAL);\n\n JERRY_ASSERT (literal_type != LEXER_IDENT_LITERAL || length <= PARSER_MAXIMUM_IDENT_LENGTH);\n JERRY_ASSERT (literal_type != LEXER_STRING_LITERAL || length <= PARSER_MAXIMUM_STRING_LENGTH);\n\n parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n {\n if (literal_p->type == literal_type\n && literal_p->prop.length == length\n && memcmp (literal_p->u.char_p, char_p, length) == 0)\n {\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n literal_p->status_flags = (uint8_t) (literal_p->status_flags & ~LEXER_FLAG_UNUSED_IDENT);\n return;\n }\n\n literal_index++;\n }\n\n JERRY_ASSERT (literal_index == context_p->literal_count);\n\n if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n {\n parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n }\n\n literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n literal_p->prop.length = (uint16_t) length;\n literal_p->type = literal_type;\n literal_p->status_flags = has_escape ? 0 : LEXER_FLAG_SOURCE_PTR;\n\n if (has_escape)\n {\n literal_p->u.char_p = (uint8_t *) jmem_heap_alloc_block (length);\n memcpy ((uint8_t *) literal_p->u.char_p, char_p, length);\n }\n else\n {\n literal_p->u.char_p = char_p;\n }\n\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n context_p->literal_count++;\n} /* lexer_process_char_literal */","target":"lexer_process_char_literal (parser_context_t *context_p, /**< context */\n const uint8_t *char_p, /**< characters */\n size_t length, /**< length of string */\n uint8_t literal_type, /**< final literal type */\n bool has_escape) /**< has escape sequences */\n{\n parser_list_iterator_t literal_iterator;\n lexer_literal_t *literal_p;\n uint32_t literal_index = 0;\n\n JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL\n || literal_type == LEXER_STRING_LITERAL);\n\n JERRY_ASSERT (literal_type != LEXER_IDENT_LITERAL || length <= PARSER_MAXIMUM_IDENT_LENGTH);\n JERRY_ASSERT (literal_type != LEXER_STRING_LITERAL || length <= PARSER_MAXIMUM_STRING_LENGTH);\n\n parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n {\n if (literal_p->type == literal_type\n && literal_p->prop.length == length\n && memcmp (literal_p->u.char_p, char_p, length) == 0)\n {\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n literal_p->status_flags = (uint8_t) (literal_p->status_flags & ~LEXER_FLAG_UNUSED_IDENT);\n return;\n }\n\n literal_index++;\n }\n\n JERRY_ASSERT (literal_index == context_p->literal_count);\n\n if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n {\n parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n }\n\n if (length == 0)\n {\n has_escape = false;\n }\n\n literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n literal_p->prop.length = (uint16_t) length;\n literal_p->type = literal_type;\n literal_p->status_flags = has_escape ? 0 : LEXER_FLAG_SOURCE_PTR;\n\n if (has_escape)\n {\n literal_p->u.char_p = (uint8_t *) jmem_heap_alloc_block (length);\n memcpy ((uint8_t *) literal_p->u.char_p, char_p, length);\n }\n else\n {\n literal_p->u.char_p = char_p;\n }\n\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n context_p->literal_count++;\n} /* lexer_process_char_literal */","lang":"c","vul_type":"cwe-476","target_token_count":550,"sven_meta":{"func_name":"lexer_process_char_literal","file_name":"jerry-core/parser/js/js-lexer.c","commit_link":"github.com/jerryscript-project/jerryscript/commit/e58f2880df608652aff7fd35c45b242467ec0e79","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#57-a893d6045904","input":"static int flattenSubquery(\n Parse *pParse, /* Parsing context */\n Select *p, /* The parent or outer SELECT statement */\n int iFrom, /* Index in p->pSrc->a[] of the inner subquery */\n int isAgg /* True if outer SELECT uses aggregate functions */\n){\n const char *zSavedAuthContext = pParse->zAuthContext;\n Select *pParent; /* Current UNION ALL term of the other query */\n Select *pSub; /* The inner query or \"subquery\" */\n Select *pSub1; /* Pointer to the rightmost select in sub-query */\n SrcList *pSrc; /* The FROM clause of the outer query */\n SrcList *pSubSrc; /* The FROM clause of the subquery */\n int iParent; /* VDBE cursor number of the pSub result set temp table */\n int iNewParent = -1;/* Replacement table for iParent */\n int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */ \n int i; /* Loop counter */\n Expr *pWhere; /* The WHERE clause */\n struct SrcList_item *pSubitem; /* The subquery */\n sqlite3 *db = pParse->db;\n\n /* Check to see if flattening is permitted. Return 0 if not.\n */\n assert( p!=0 );\n assert( p->pPrior==0 );\n if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0;\n pSrc = p->pSrc;\n assert( pSrc && iFrom>=0 && iFromnSrc );\n pSubitem = &pSrc->a[iFrom];\n iParent = pSubitem->iCursor;\n pSub = pSubitem->pSelect;\n assert( pSub!=0 );\n\n#ifndef SQLITE_OMIT_WINDOWFUNC\n if( p->pWin || pSub->pWin ) return 0; /* Restriction (25) */\n#endif\n\n pSubSrc = pSub->pSrc;\n assert( pSubSrc );\n /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,\n ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET\n ** because they could be computed at compile-time. But when LIMIT and OFFSET\n ** became arbitrary expressions, we were forced to add restrictions (13)\n ** and (14). */\n if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */\n if( pSub->pLimit && pSub->pLimit->pRight ) return 0; /* Restriction (14) */\n if( (p->selFlags & SF_Compound)!=0 && pSub->pLimit ){\n return 0; /* Restriction (15) */\n }\n if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */\n if( pSub->selFlags & SF_Distinct ) return 0; /* Restriction (4) */\n if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){\n return 0; /* Restrictions (8)(9) */\n }\n if( p->pOrderBy && pSub->pOrderBy ){\n return 0; /* Restriction (11) */\n }\n if( isAgg && pSub->pOrderBy ) return 0; /* Restriction (16) */\n if( pSub->pLimit && p->pWhere ) return 0; /* Restriction (19) */\n if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){\n return 0; /* Restriction (21) */\n }\n if( pSub->selFlags & (SF_Recursive) ){\n return 0; /* Restrictions (22) */\n }\n\n /*\n ** If the subquery is the right operand of a LEFT JOIN, then the\n ** subquery may not be a join itself (3a). Example of why this is not\n ** allowed:\n **\n ** t1 LEFT OUTER JOIN (t2 JOIN t3)\n **\n ** If we flatten the above, we would get\n **\n ** (t1 LEFT OUTER JOIN t2) JOIN t3\n **\n ** which is not at all the same thing.\n **\n ** If the subquery is the right operand of a LEFT JOIN, then the outer\n ** query cannot be an aggregate. (3c) This is an artifact of the way\n ** aggregates are processed - there is no mechanism to determine if\n ** the LEFT JOIN table should be all-NULL.\n **\n ** See also tickets #306, #350, and #3300.\n */\n if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){\n isLeftJoin = 1;\n if( pSubSrc->nSrc>1 || isAgg || IsVirtual(pSubSrc->a[0].pTab) ){\n /* (3a) (3c) (3b) */\n return 0;\n }\n }\n#ifdef SQLITE_EXTRA_IFNULLROW\n else if( iFrom>0 && !isAgg ){\n /* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for\n ** every reference to any result column from subquery in a join, even\n ** though they are not necessary. This will stress-test the OP_IfNullRow \n ** opcode. */\n isLeftJoin = -1;\n }\n#endif\n\n /* Restriction (17): If the sub-query is a compound SELECT, then it must\n ** use only the UNION ALL operator. And none of the simple select queries\n ** that make up the compound SELECT are allowed to be aggregate or distinct\n ** queries.\n */\n if( pSub->pPrior ){\n if( pSub->pOrderBy ){\n return 0; /* Restriction (20) */\n }\n if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){\n return 0; /* (17d1), (17d2), or (17d3) */\n }\n for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){\n testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );\n testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );\n assert( pSub->pSrc!=0 );\n assert( pSub->pEList->nExpr==pSub1->pEList->nExpr );\n if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */\n || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */\n || pSub1->pSrc->nSrc<1 /* (17c) */\n ){\n return 0;\n }\n testcase( pSub1->pSrc->nSrc>1 );\n }\n\n /* Restriction (18). */\n if( p->pOrderBy ){\n int ii;\n for(ii=0; iipOrderBy->nExpr; ii++){\n if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0;\n }\n }\n }\n\n /* Ex-restriction (23):\n ** The only way that the recursive part of a CTE can contain a compound\n ** subquery is for the subquery to be one term of a join. But if the\n ** subquery is a join, then the flattening has already been stopped by\n ** restriction (17d3)\n */\n assert( (p->selFlags & SF_Recursive)==0 || pSub->pPrior==0 );\n\n /***** If we reach this point, flattening is permitted. *****/\n SELECTTRACE(1,pParse,p,(\"flatten %u.%p from term %d\\n\",\n pSub->selId, pSub, iFrom));\n\n /* Authorize the subquery */\n pParse->zAuthContext = pSubitem->zName;\n TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);\n testcase( i==SQLITE_DENY );\n pParse->zAuthContext = zSavedAuthContext;\n\n /* If the sub-query is a compound SELECT statement, then (by restrictions\n ** 17 and 18 above) it must be a UNION ALL and the parent query must \n ** be of the form:\n **\n ** SELECT FROM () \n **\n ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block\n ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or \n ** OFFSET clauses and joins them to the left-hand-side of the original\n ** using UNION ALL operators. In this case N is the number of simple\n ** select statements in the compound sub-query.\n **\n ** Example:\n **\n ** SELECT a+1 FROM (\n ** SELECT x FROM tab\n ** UNION ALL\n ** SELECT y FROM tab\n ** UNION ALL\n ** SELECT abs(z*2) FROM tab2\n ** ) WHERE a!=5 ORDER BY 1\n **\n ** Transformed into:\n **\n ** SELECT x+1 FROM tab WHERE x+1!=5\n ** UNION ALL\n ** SELECT y+1 FROM tab WHERE y+1!=5\n ** UNION ALL\n ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5\n ** ORDER BY 1\n **\n ** We call this the \"compound-subquery flattening\".\n */\n for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){\n Select *pNew;\n ExprList *pOrderBy = p->pOrderBy;\n Expr *pLimit = p->pLimit;\n Select *pPrior = p->pPrior;\n p->pOrderBy = 0;\n p->pSrc = 0;\n p->pPrior = 0;\n p->pLimit = 0;\n pNew = sqlite3SelectDup(db, p, 0);\n p->pLimit = pLimit;\n p->pOrderBy = pOrderBy;\n p->pSrc = pSrc;\n p->op = TK_ALL;\n if( pNew==0 ){\n p->pPrior = pPrior;\n }else{\n pNew->pPrior = pPrior;\n if( pPrior ) pPrior->pNext = pNew;\n pNew->pNext = p;\n p->pPrior = pNew;\n SELECTTRACE(2,pParse,p,(\"compound-subquery flattener\"\n \" creates %u as peer\\n\",pNew->selId));\n }\n if( db->mallocFailed ) return 1;\n }\n\n /* Begin flattening the iFrom-th entry of the FROM clause \n ** in the outer query.\n */\n pSub = pSub1 = pSubitem->pSelect;\n\n /* Delete the transient table structure associated with the\n ** subquery\n */\n sqlite3DbFree(db, pSubitem->zDatabase);\n sqlite3DbFree(db, pSubitem->zName);\n sqlite3DbFree(db, pSubitem->zAlias);\n pSubitem->zDatabase = 0;\n pSubitem->zName = 0;\n pSubitem->zAlias = 0;\n pSubitem->pSelect = 0;\n\n /* Defer deleting the Table object associated with the\n ** subquery until code generation is\n ** complete, since there may still exist Expr.pTab entries that\n ** refer to the subquery even after flattening. Ticket #3346.\n **\n ** pSubitem->pTab is always non-NULL by test restrictions and tests above.\n */\n if( ALWAYS(pSubitem->pTab!=0) ){\n Table *pTabToDel = pSubitem->pTab;\n if( pTabToDel->nTabRef==1 ){\n Parse *pToplevel = sqlite3ParseToplevel(pParse);\n pTabToDel->pNextZombie = pToplevel->pZombieTab;\n pToplevel->pZombieTab = pTabToDel;\n }else{\n pTabToDel->nTabRef--;\n }\n pSubitem->pTab = 0;\n }\n\n /* The following loop runs once for each term in a compound-subquery\n ** flattening (as described above). If we are doing a different kind\n ** of flattening - a flattening other than a compound-subquery flattening -\n ** then this loop only runs once.\n **\n ** This loop moves all of the FROM elements of the subquery into the\n ** the FROM clause of the outer query. Before doing this, remember\n ** the cursor number for the original outer query FROM element in\n ** iParent. The iParent cursor will never be used. Subsequent code\n ** will scan expressions looking for iParent references and replace\n ** those references with expressions that resolve to the subquery FROM\n ** elements we are now copying in.\n */\n for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){\n int nSubSrc;\n u8 jointype = 0;\n assert( pSub!=0 );\n pSubSrc = pSub->pSrc; /* FROM clause of subquery */\n nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */\n pSrc = pParent->pSrc; /* FROM clause of the outer query */\n\n if( pSrc ){\n assert( pParent==p ); /* First time through the loop */\n jointype = pSubitem->fg.jointype;\n }else{\n assert( pParent!=p ); /* 2nd and subsequent times through the loop */\n pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);\n if( pSrc==0 ) break;\n pParent->pSrc = pSrc;\n }\n\n /* The subquery uses a single slot of the FROM clause of the outer\n ** query. If the subquery has more than one element in its FROM clause,\n ** then expand the outer query to make space for it to hold all elements\n ** of the subquery.\n **\n ** Example:\n **\n ** SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB;\n **\n ** The outer query has 3 slots in its FROM clause. One slot of the\n ** outer query (the middle slot) is used by the subquery. The next\n ** block of code will expand the outer query FROM clause to 4 slots.\n ** The middle slot is expanded to two slots in order to make space\n ** for the two elements in the FROM clause of the subquery.\n */\n if( nSubSrc>1 ){\n pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1);\n if( pSrc==0 ) break;\n pParent->pSrc = pSrc;\n }\n\n /* Transfer the FROM clause terms from the subquery into the\n ** outer query.\n */\n for(i=0; ia[i+iFrom].pUsing);\n assert( pSrc->a[i+iFrom].fg.isTabFunc==0 );\n pSrc->a[i+iFrom] = pSubSrc->a[i];\n iNewParent = pSubSrc->a[i].iCursor;\n memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));\n }\n pSrc->a[iFrom].fg.jointype = jointype;\n \n /* Now begin substituting subquery result set expressions for \n ** references to the iParent in the outer query.\n ** \n ** Example:\n **\n ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;\n ** \\ \\_____________ subquery __________/ /\n ** \\_____________________ outer query ______________________________/\n **\n ** We look at every expression in the outer query and every place we see\n ** \"a\" we substitute \"x*3\" and every place we see \"b\" we substitute \"y+10\".\n */\n if( pSub->pOrderBy ){\n /* At this point, any non-zero iOrderByCol values indicate that the\n ** ORDER BY column expression is identical to the iOrderByCol'th\n ** expression returned by SELECT statement pSub. Since these values\n ** do not necessarily correspond to columns in SELECT statement pParent,\n ** zero them before transfering the ORDER BY clause.\n **\n ** Not doing this may cause an error if a subsequent call to this\n ** function attempts to flatten a compound sub-query into pParent\n ** (the only way this can happen is if the compound sub-query is\n ** currently part of pSub->pSrc). See ticket [d11a6e908f]. */\n ExprList *pOrderBy = pSub->pOrderBy;\n for(i=0; inExpr; i++){\n pOrderBy->a[i].u.x.iOrderByCol = 0;\n }\n assert( pParent->pOrderBy==0 );\n pParent->pOrderBy = pOrderBy;\n pSub->pOrderBy = 0;\n }\n pWhere = pSub->pWhere;\n pSub->pWhere = 0;\n if( isLeftJoin>0 ){\n sqlite3SetJoinExpr(pWhere, iNewParent);\n }\n pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere);\n if( db->mallocFailed==0 ){\n SubstContext x;\n x.pParse = pParse;\n x.iTable = iParent;\n x.iNewTable = iNewParent;\n x.isLeftJoin = isLeftJoin;\n x.pEList = pSub->pEList;\n substSelect(&x, pParent, 0);\n }\n \n /* The flattened query is a compound if either the inner or the\n ** outer query is a compound. */\n pParent->selFlags |= pSub->selFlags & SF_Compound;\n assert( (pSub->selFlags & SF_Distinct)==0 ); /* restriction (17b) */\n \n /*\n ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;\n **\n ** One is tempted to try to add a and b to combine the limits. But this\n ** does not work if either limit is negative.\n */\n if( pSub->pLimit ){\n pParent->pLimit = pSub->pLimit;\n pSub->pLimit = 0;\n }\n }\n\n /* Finially, delete what is left of the subquery and return\n ** success.\n */\n sqlite3SelectDelete(db, pSub1);\n\n#if SELECTTRACE_ENABLED\n if( sqlite3SelectTrace & 0x100 ){\n SELECTTRACE(0x100,pParse,p,(\"After flattening:\\n\"));\n sqlite3TreeViewSelect(0, p, 0);\n }\n#endif\n\n return 1;\n}","target":"static int flattenSubquery(\n Parse *pParse, /* Parsing context */\n Select *p, /* The parent or outer SELECT statement */\n int iFrom, /* Index in p->pSrc->a[] of the inner subquery */\n int isAgg /* True if outer SELECT uses aggregate functions */\n){\n const char *zSavedAuthContext = pParse->zAuthContext;\n Select *pParent; /* Current UNION ALL term of the other query */\n Select *pSub; /* The inner query or \"subquery\" */\n Select *pSub1; /* Pointer to the rightmost select in sub-query */\n SrcList *pSrc; /* The FROM clause of the outer query */\n SrcList *pSubSrc; /* The FROM clause of the subquery */\n int iParent; /* VDBE cursor number of the pSub result set temp table */\n int iNewParent = -1;/* Replacement table for iParent */\n int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */ \n int i; /* Loop counter */\n Expr *pWhere; /* The WHERE clause */\n struct SrcList_item *pSubitem; /* The subquery */\n sqlite3 *db = pParse->db;\n\n /* Check to see if flattening is permitted. Return 0 if not.\n */\n assert( p!=0 );\n assert( p->pPrior==0 );\n if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0;\n pSrc = p->pSrc;\n assert( pSrc && iFrom>=0 && iFromnSrc );\n pSubitem = &pSrc->a[iFrom];\n iParent = pSubitem->iCursor;\n pSub = pSubitem->pSelect;\n assert( pSub!=0 );\n\n#ifndef SQLITE_OMIT_WINDOWFUNC\n if( p->pWin || pSub->pWin ) return 0; /* Restriction (25) */\n#endif\n\n pSubSrc = pSub->pSrc;\n assert( pSubSrc );\n /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,\n ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET\n ** because they could be computed at compile-time. But when LIMIT and OFFSET\n ** became arbitrary expressions, we were forced to add restrictions (13)\n ** and (14). */\n if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */\n if( pSub->pLimit && pSub->pLimit->pRight ) return 0; /* Restriction (14) */\n if( (p->selFlags & SF_Compound)!=0 && pSub->pLimit ){\n return 0; /* Restriction (15) */\n }\n if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */\n if( pSub->selFlags & SF_Distinct ) return 0; /* Restriction (4) */\n if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){\n return 0; /* Restrictions (8)(9) */\n }\n if( p->pOrderBy && pSub->pOrderBy ){\n return 0; /* Restriction (11) */\n }\n if( isAgg && pSub->pOrderBy ) return 0; /* Restriction (16) */\n if( pSub->pLimit && p->pWhere ) return 0; /* Restriction (19) */\n if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){\n return 0; /* Restriction (21) */\n }\n if( pSub->selFlags & (SF_Recursive) ){\n return 0; /* Restrictions (22) */\n }\n\n /*\n ** If the subquery is the right operand of a LEFT JOIN, then the\n ** subquery may not be a join itself (3a). Example of why this is not\n ** allowed:\n **\n ** t1 LEFT OUTER JOIN (t2 JOIN t3)\n **\n ** If we flatten the above, we would get\n **\n ** (t1 LEFT OUTER JOIN t2) JOIN t3\n **\n ** which is not at all the same thing.\n **\n ** If the subquery is the right operand of a LEFT JOIN, then the outer\n ** query cannot be an aggregate. (3c) This is an artifact of the way\n ** aggregates are processed - there is no mechanism to determine if\n ** the LEFT JOIN table should be all-NULL.\n **\n ** See also tickets #306, #350, and #3300.\n */\n if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){\n isLeftJoin = 1;\n if( pSubSrc->nSrc>1 /* (3a) */\n || isAgg /* (3b) */\n || IsVirtual(pSubSrc->a[0].pTab) /* (3c) */\n || (p->selFlags & SF_Distinct)!=0 /* (3d) */\n ){\n return 0;\n }\n }\n#ifdef SQLITE_EXTRA_IFNULLROW\n else if( iFrom>0 && !isAgg ){\n /* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for\n ** every reference to any result column from subquery in a join, even\n ** though they are not necessary. This will stress-test the OP_IfNullRow \n ** opcode. */\n isLeftJoin = -1;\n }\n#endif\n\n /* Restriction (17): If the sub-query is a compound SELECT, then it must\n ** use only the UNION ALL operator. And none of the simple select queries\n ** that make up the compound SELECT are allowed to be aggregate or distinct\n ** queries.\n */\n if( pSub->pPrior ){\n if( pSub->pOrderBy ){\n return 0; /* Restriction (20) */\n }\n if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){\n return 0; /* (17d1), (17d2), or (17d3) */\n }\n for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){\n testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );\n testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );\n assert( pSub->pSrc!=0 );\n assert( pSub->pEList->nExpr==pSub1->pEList->nExpr );\n if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */\n || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */\n || pSub1->pSrc->nSrc<1 /* (17c) */\n ){\n return 0;\n }\n testcase( pSub1->pSrc->nSrc>1 );\n }\n\n /* Restriction (18). */\n if( p->pOrderBy ){\n int ii;\n for(ii=0; iipOrderBy->nExpr; ii++){\n if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0;\n }\n }\n }\n\n /* Ex-restriction (23):\n ** The only way that the recursive part of a CTE can contain a compound\n ** subquery is for the subquery to be one term of a join. But if the\n ** subquery is a join, then the flattening has already been stopped by\n ** restriction (17d3)\n */\n assert( (p->selFlags & SF_Recursive)==0 || pSub->pPrior==0 );\n\n /***** If we reach this point, flattening is permitted. *****/\n SELECTTRACE(1,pParse,p,(\"flatten %u.%p from term %d\\n\",\n pSub->selId, pSub, iFrom));\n\n /* Authorize the subquery */\n pParse->zAuthContext = pSubitem->zName;\n TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);\n testcase( i==SQLITE_DENY );\n pParse->zAuthContext = zSavedAuthContext;\n\n /* If the sub-query is a compound SELECT statement, then (by restrictions\n ** 17 and 18 above) it must be a UNION ALL and the parent query must \n ** be of the form:\n **\n ** SELECT FROM () \n **\n ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block\n ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or \n ** OFFSET clauses and joins them to the left-hand-side of the original\n ** using UNION ALL operators. In this case N is the number of simple\n ** select statements in the compound sub-query.\n **\n ** Example:\n **\n ** SELECT a+1 FROM (\n ** SELECT x FROM tab\n ** UNION ALL\n ** SELECT y FROM tab\n ** UNION ALL\n ** SELECT abs(z*2) FROM tab2\n ** ) WHERE a!=5 ORDER BY 1\n **\n ** Transformed into:\n **\n ** SELECT x+1 FROM tab WHERE x+1!=5\n ** UNION ALL\n ** SELECT y+1 FROM tab WHERE y+1!=5\n ** UNION ALL\n ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5\n ** ORDER BY 1\n **\n ** We call this the \"compound-subquery flattening\".\n */\n for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){\n Select *pNew;\n ExprList *pOrderBy = p->pOrderBy;\n Expr *pLimit = p->pLimit;\n Select *pPrior = p->pPrior;\n p->pOrderBy = 0;\n p->pSrc = 0;\n p->pPrior = 0;\n p->pLimit = 0;\n pNew = sqlite3SelectDup(db, p, 0);\n p->pLimit = pLimit;\n p->pOrderBy = pOrderBy;\n p->pSrc = pSrc;\n p->op = TK_ALL;\n if( pNew==0 ){\n p->pPrior = pPrior;\n }else{\n pNew->pPrior = pPrior;\n if( pPrior ) pPrior->pNext = pNew;\n pNew->pNext = p;\n p->pPrior = pNew;\n SELECTTRACE(2,pParse,p,(\"compound-subquery flattener\"\n \" creates %u as peer\\n\",pNew->selId));\n }\n if( db->mallocFailed ) return 1;\n }\n\n /* Begin flattening the iFrom-th entry of the FROM clause \n ** in the outer query.\n */\n pSub = pSub1 = pSubitem->pSelect;\n\n /* Delete the transient table structure associated with the\n ** subquery\n */\n sqlite3DbFree(db, pSubitem->zDatabase);\n sqlite3DbFree(db, pSubitem->zName);\n sqlite3DbFree(db, pSubitem->zAlias);\n pSubitem->zDatabase = 0;\n pSubitem->zName = 0;\n pSubitem->zAlias = 0;\n pSubitem->pSelect = 0;\n\n /* Defer deleting the Table object associated with the\n ** subquery until code generation is\n ** complete, since there may still exist Expr.pTab entries that\n ** refer to the subquery even after flattening. Ticket #3346.\n **\n ** pSubitem->pTab is always non-NULL by test restrictions and tests above.\n */\n if( ALWAYS(pSubitem->pTab!=0) ){\n Table *pTabToDel = pSubitem->pTab;\n if( pTabToDel->nTabRef==1 ){\n Parse *pToplevel = sqlite3ParseToplevel(pParse);\n pTabToDel->pNextZombie = pToplevel->pZombieTab;\n pToplevel->pZombieTab = pTabToDel;\n }else{\n pTabToDel->nTabRef--;\n }\n pSubitem->pTab = 0;\n }\n\n /* The following loop runs once for each term in a compound-subquery\n ** flattening (as described above). If we are doing a different kind\n ** of flattening - a flattening other than a compound-subquery flattening -\n ** then this loop only runs once.\n **\n ** This loop moves all of the FROM elements of the subquery into the\n ** the FROM clause of the outer query. Before doing this, remember\n ** the cursor number for the original outer query FROM element in\n ** iParent. The iParent cursor will never be used. Subsequent code\n ** will scan expressions looking for iParent references and replace\n ** those references with expressions that resolve to the subquery FROM\n ** elements we are now copying in.\n */\n for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){\n int nSubSrc;\n u8 jointype = 0;\n assert( pSub!=0 );\n pSubSrc = pSub->pSrc; /* FROM clause of subquery */\n nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */\n pSrc = pParent->pSrc; /* FROM clause of the outer query */\n\n if( pSrc ){\n assert( pParent==p ); /* First time through the loop */\n jointype = pSubitem->fg.jointype;\n }else{\n assert( pParent!=p ); /* 2nd and subsequent times through the loop */\n pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);\n if( pSrc==0 ) break;\n pParent->pSrc = pSrc;\n }\n\n /* The subquery uses a single slot of the FROM clause of the outer\n ** query. If the subquery has more than one element in its FROM clause,\n ** then expand the outer query to make space for it to hold all elements\n ** of the subquery.\n **\n ** Example:\n **\n ** SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB;\n **\n ** The outer query has 3 slots in its FROM clause. One slot of the\n ** outer query (the middle slot) is used by the subquery. The next\n ** block of code will expand the outer query FROM clause to 4 slots.\n ** The middle slot is expanded to two slots in order to make space\n ** for the two elements in the FROM clause of the subquery.\n */\n if( nSubSrc>1 ){\n pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1);\n if( pSrc==0 ) break;\n pParent->pSrc = pSrc;\n }\n\n /* Transfer the FROM clause terms from the subquery into the\n ** outer query.\n */\n for(i=0; ia[i+iFrom].pUsing);\n assert( pSrc->a[i+iFrom].fg.isTabFunc==0 );\n pSrc->a[i+iFrom] = pSubSrc->a[i];\n iNewParent = pSubSrc->a[i].iCursor;\n memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));\n }\n pSrc->a[iFrom].fg.jointype = jointype;\n \n /* Now begin substituting subquery result set expressions for \n ** references to the iParent in the outer query.\n ** \n ** Example:\n **\n ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;\n ** \\ \\_____________ subquery __________/ /\n ** \\_____________________ outer query ______________________________/\n **\n ** We look at every expression in the outer query and every place we see\n ** \"a\" we substitute \"x*3\" and every place we see \"b\" we substitute \"y+10\".\n */\n if( pSub->pOrderBy ){\n /* At this point, any non-zero iOrderByCol values indicate that the\n ** ORDER BY column expression is identical to the iOrderByCol'th\n ** expression returned by SELECT statement pSub. Since these values\n ** do not necessarily correspond to columns in SELECT statement pParent,\n ** zero them before transfering the ORDER BY clause.\n **\n ** Not doing this may cause an error if a subsequent call to this\n ** function attempts to flatten a compound sub-query into pParent\n ** (the only way this can happen is if the compound sub-query is\n ** currently part of pSub->pSrc). See ticket [d11a6e908f]. */\n ExprList *pOrderBy = pSub->pOrderBy;\n for(i=0; inExpr; i++){\n pOrderBy->a[i].u.x.iOrderByCol = 0;\n }\n assert( pParent->pOrderBy==0 );\n pParent->pOrderBy = pOrderBy;\n pSub->pOrderBy = 0;\n }\n pWhere = pSub->pWhere;\n pSub->pWhere = 0;\n if( isLeftJoin>0 ){\n sqlite3SetJoinExpr(pWhere, iNewParent);\n }\n pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere);\n if( db->mallocFailed==0 ){\n SubstContext x;\n x.pParse = pParse;\n x.iTable = iParent;\n x.iNewTable = iNewParent;\n x.isLeftJoin = isLeftJoin;\n x.pEList = pSub->pEList;\n substSelect(&x, pParent, 0);\n }\n \n /* The flattened query is a compound if either the inner or the\n ** outer query is a compound. */\n pParent->selFlags |= pSub->selFlags & SF_Compound;\n assert( (pSub->selFlags & SF_Distinct)==0 ); /* restriction (17b) */\n \n /*\n ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;\n **\n ** One is tempted to try to add a and b to combine the limits. But this\n ** does not work if either limit is negative.\n */\n if( pSub->pLimit ){\n pParent->pLimit = pSub->pLimit;\n pSub->pLimit = 0;\n }\n }\n\n /* Finially, delete what is left of the subquery and return\n ** success.\n */\n sqlite3SelectDelete(db, pSub1);\n\n#if SELECTTRACE_ENABLED\n if( sqlite3SelectTrace & 0x100 ){\n SELECTTRACE(0x100,pParse,p,(\"After flattening:\\n\"));\n sqlite3TreeViewSelect(0, p, 0);\n }\n#endif\n\n return 1;\n}","lang":"c","vul_type":"cwe-476","target_token_count":4393,"sven_meta":{"func_name":"flattenSubquery","file_name":"src/select.c","commit_link":"github.com/sqlite/sqlite/commit/396afe6f6aa90a31303c183e11b2b2d4b7956b35","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#60-5f6e218f67f8","input":"static int mailimf_group_parse(const char * message, size_t length,\n\t\t\t size_t * indx,\n\t\t\t struct mailimf_group ** result)\n{\n size_t cur_token;\n char * display_name;\n struct mailimf_mailbox_list * mailbox_list;\n struct mailimf_group * group;\n int r;\n int res;\n\n cur_token = * indx;\n\n mailbox_list = NULL;\n\n r = mailimf_display_name_parse(message, length, &cur_token, &display_name);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto err;\n }\n\n r = mailimf_colon_parse(message, length, &cur_token);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto free_display_name;\n }\n\n r = mailimf_mailbox_list_parse(message, length, &cur_token, &mailbox_list);\n switch (r) {\n case MAILIMF_NO_ERROR:\n break;\n case MAILIMF_ERROR_PARSE:\n r = mailimf_cfws_parse(message, length, &cur_token);\n if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {\n res = r;\n goto free_display_name;\n }\n break;\n default:\n res = r;\n goto free_display_name;\n }\n\n r = mailimf_semi_colon_parse(message, length, &cur_token);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto free_mailbox_list;\n }\n\n group = mailimf_group_new(display_name, mailbox_list);\n if (group == NULL) {\n res = MAILIMF_ERROR_MEMORY;\n goto free_mailbox_list;\n }\n\n * indx = cur_token;\n * result = group;\n\n return MAILIMF_NO_ERROR;\n\n free_mailbox_list:\n if (mailbox_list != NULL) {\n mailimf_mailbox_list_free(mailbox_list);\n }\n free_display_name:\n mailimf_display_name_free(display_name);\n err:\n return res;\n}","target":"static int mailimf_group_parse(const char * message, size_t length,\n\t\t\t size_t * indx,\n\t\t\t struct mailimf_group ** result)\n{\n size_t cur_token;\n char * display_name;\n struct mailimf_mailbox_list * mailbox_list;\n struct mailimf_group * group;\n int r;\n int res;\n clist * list;\n\n cur_token = * indx;\n\n mailbox_list = NULL;\n\n r = mailimf_display_name_parse(message, length, &cur_token, &display_name);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto err;\n }\n\n r = mailimf_colon_parse(message, length, &cur_token);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto free_display_name;\n }\n\n r = mailimf_mailbox_list_parse(message, length, &cur_token, &mailbox_list);\n switch (r) {\n case MAILIMF_NO_ERROR:\n break;\n case MAILIMF_ERROR_PARSE:\n r = mailimf_cfws_parse(message, length, &cur_token);\n if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {\n res = r;\n goto free_display_name;\n }\n list = clist_new();\n if (list == NULL) {\n res = MAILIMF_ERROR_MEMORY;\n goto free_display_name;\n }\n mailbox_list = mailimf_mailbox_list_new(list);\n if (mailbox_list == NULL) {\n res = MAILIMF_ERROR_MEMORY;\n clist_free(list);\n goto free_display_name;\n }\n break;\n default:\n res = r;\n goto free_display_name;\n }\n\n r = mailimf_semi_colon_parse(message, length, &cur_token);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto free_mailbox_list;\n }\n\n group = mailimf_group_new(display_name, mailbox_list);\n if (group == NULL) {\n res = MAILIMF_ERROR_MEMORY;\n goto free_mailbox_list;\n }\n\n * indx = cur_token;\n * result = group;\n\n return MAILIMF_NO_ERROR;\n\n free_mailbox_list:\n if (mailbox_list != NULL) {\n mailimf_mailbox_list_free(mailbox_list);\n }\n free_display_name:\n mailimf_display_name_free(display_name);\n err:\n return res;\n}","lang":"c","vul_type":"cwe-476","target_token_count":528,"sven_meta":{"func_name":"mailimf_group_parse","file_name":"src/low-level/imf/mailimf.c","commit_link":"github.com/dinhviethoa/libetpan/commit/1fe8fbc032ccda1db9af66d93016b49c16c1f22d","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#63-efa1be432df8","input":"GetOutboundPinholeTimeout(struct upnphttp * h, const char * action, const char * ns)\n{\n\tint r;\n\n\tstatic const char resp[] =\n\t\t\"\"\n\t\t\"%d\"\n\t\t\"\";\n\n\tchar body[512];\n\tint bodylen;\n\tstruct NameValueParserData data;\n\tchar * int_ip, * int_port, * rem_host, * rem_port, * protocol;\n\tint opt=0;\n\t/*int proto=0;*/\n\tunsigned short iport, rport;\n\n\tif (GETFLAG(IPV6FCFWDISABLEDMASK))\n\t{\n\t\tSoapError(h, 702, \"FirewallDisabled\");\n\t\treturn;\n\t}\n\n\tParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);\n\tint_ip = GetValueFromNameValueList(&data, \"InternalClient\");\n\tint_port = GetValueFromNameValueList(&data, \"InternalPort\");\n\trem_host = GetValueFromNameValueList(&data, \"RemoteHost\");\n\trem_port = GetValueFromNameValueList(&data, \"RemotePort\");\n\tprotocol = GetValueFromNameValueList(&data, \"Protocol\");\n\n\trport = (unsigned short)atoi(rem_port);\n\tiport = (unsigned short)atoi(int_port);\n\t/*proto = atoi(protocol);*/\n\n\tsyslog(LOG_INFO, \"%s: retrieving timeout for outbound pinhole from [%s]:%hu to [%s]:%hu protocol %s\", action, int_ip, iport,rem_host, rport, protocol);\n\n\t/* TODO */\n\tr = -1;/*upnp_check_outbound_pinhole(proto, &opt);*/\n\n\tswitch(r)\n\t{\n\t\tcase 1:\t/* success */\n\t\t\tbodylen = snprintf(body, sizeof(body), resp,\n\t\t\t action, ns/*\"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1\"*/,\n\t\t\t opt, action);\n\t\t\tBuildSendAndCloseSoapResp(h, body, bodylen);\n\t\t\tbreak;\n\t\tcase -5:\t/* Protocol not supported */\n\t\t\tSoapError(h, 705, \"ProtocolNotSupported\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tSoapError(h, 501, \"ActionFailed\");\n\t}\n\tClearNameValueList(&data);\n}","target":"GetOutboundPinholeTimeout(struct upnphttp * h, const char * action, const char * ns)\n{\n\tint r;\n\n\tstatic const char resp[] =\n\t\t\"\"\n\t\t\"%d\"\n\t\t\"\";\n\n\tchar body[512];\n\tint bodylen;\n\tstruct NameValueParserData data;\n\tchar * int_ip, * int_port, * rem_host, * rem_port, * protocol;\n\tint opt=0;\n\t/*int proto=0;*/\n\tunsigned short iport, rport;\n\n\tif (GETFLAG(IPV6FCFWDISABLEDMASK))\n\t{\n\t\tSoapError(h, 702, \"FirewallDisabled\");\n\t\treturn;\n\t}\n\n\tParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);\n\tint_ip = GetValueFromNameValueList(&data, \"InternalClient\");\n\tint_port = GetValueFromNameValueList(&data, \"InternalPort\");\n\trem_host = GetValueFromNameValueList(&data, \"RemoteHost\");\n\trem_port = GetValueFromNameValueList(&data, \"RemotePort\");\n\tprotocol = GetValueFromNameValueList(&data, \"Protocol\");\n\n\tif (!int_port || !ext_port || !protocol)\n\t{\n\t\tClearNameValueList(&data);\n\t\tSoapError(h, 402, \"Invalid Args\");\n\t\treturn;\n\t}\n\n\trport = (unsigned short)atoi(rem_port);\n\tiport = (unsigned short)atoi(int_port);\n\t/*proto = atoi(protocol);*/\n\n\tsyslog(LOG_INFO, \"%s: retrieving timeout for outbound pinhole from [%s]:%hu to [%s]:%hu protocol %s\", action, int_ip, iport,rem_host, rport, protocol);\n\n\t/* TODO */\n\tr = -1;/*upnp_check_outbound_pinhole(proto, &opt);*/\n\n\tswitch(r)\n\t{\n\t\tcase 1:\t/* success */\n\t\t\tbodylen = snprintf(body, sizeof(body), resp,\n\t\t\t action, ns/*\"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1\"*/,\n\t\t\t opt, action);\n\t\t\tBuildSendAndCloseSoapResp(h, body, bodylen);\n\t\t\tbreak;\n\t\tcase -5:\t/* Protocol not supported */\n\t\t\tSoapError(h, 705, \"ProtocolNotSupported\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tSoapError(h, 501, \"ActionFailed\");\n\t}\n\tClearNameValueList(&data);\n}","lang":"c","vul_type":"cwe-476","target_token_count":551,"sven_meta":{"func_name":"GetOutboundPinholeTimeout","file_name":"miniupnpd/upnpsoap.c","commit_link":"github.com/miniupnp/miniupnp/commit/13585f15c7f7dc28bbbba1661efb280d530d114c","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#64-4fe8f4cc8f7e","input":"AP4_AtomSampleTable::GetSample(AP4_Ordinal index, \n AP4_Sample& sample)\n{\n AP4_Result result;\n\n // check that we have an stsc atom\n if (!m_StscAtom) {\n return AP4_ERROR_INVALID_FORMAT;\n }\n \n // check that we have a chunk offset table\n if (m_StcoAtom == NULL && m_Co64Atom == NULL) {\n return AP4_ERROR_INVALID_FORMAT;\n }\n\n // MP4 uses 1-based indexes internally, so adjust by one\n index++;\n\n // find out in which chunk this sample is located\n AP4_Ordinal chunk, skip, desc;\n result = m_StscAtom->GetChunkForSample(index, chunk, skip, desc);\n if (AP4_FAILED(result)) return result;\n \n // check that the result is within bounds\n if (skip > index) return AP4_ERROR_INTERNAL;\n\n // get the atom offset for this chunk\n AP4_UI64 offset;\n if (m_StcoAtom) {\n AP4_UI32 offset_32;\n result = m_StcoAtom->GetChunkOffset(chunk, offset_32);\n offset = offset_32;\n } else {\n result = m_Co64Atom->GetChunkOffset(chunk, offset);\n }\n if (AP4_FAILED(result)) return result;\n \n // compute the additional offset inside the chunk\n for (unsigned int i = index-skip; i < index; i++) {\n AP4_Size size = 0;\n if (m_StszAtom) {\n result = m_StszAtom->GetSampleSize(i, size); \n } else if (m_Stz2Atom) {\n result = m_Stz2Atom->GetSampleSize(i, size); \n } else {\n result = AP4_ERROR_INVALID_FORMAT;\n }\n if (AP4_FAILED(result)) return result;\n offset += size;\n }\n\n // set the description index\n sample.SetDescriptionIndex(desc-1); // adjust for 0-based indexes\n\n // set the dts and cts\n AP4_UI32 cts_offset = 0;\n AP4_UI64 dts = 0;\n AP4_UI32 duration = 0;\n result = m_SttsAtom->GetDts(index, dts, &duration);\n if (AP4_FAILED(result)) return result;\n sample.SetDuration(duration);\n sample.SetDts(dts);\n if (m_CttsAtom == NULL) {\n sample.SetCts(dts);\n } else {\n result = m_CttsAtom->GetCtsOffset(index, cts_offset); \n\t if (AP4_FAILED(result)) return result;\n sample.SetCtsDelta(cts_offset);\n } \n\n // set the size\n AP4_Size sample_size = 0;\n if (m_StszAtom) {\n result = m_StszAtom->GetSampleSize(index, sample_size); \n } else if (m_Stz2Atom) {\n result = m_Stz2Atom->GetSampleSize(index, sample_size); \n } else {\n result = AP4_ERROR_INVALID_FORMAT;\n }\n if (AP4_FAILED(result)) return result;\n sample.SetSize(sample_size);\n\n // set the sync flag\n if (m_StssAtom == NULL) {\n sample.SetSync(true);\n } else {\n sample.SetSync(m_StssAtom->IsSampleSync(index));\n }\n\n // set the offset\n sample.SetOffset(offset);\n\n // set the data stream\n sample.SetDataStream(m_SampleStream);\n\n\n return AP4_SUCCESS;\n}","target":"AP4_AtomSampleTable::GetSample(AP4_Ordinal index, \n AP4_Sample& sample)\n{\n AP4_Result result;\n\n // check that we have an stsc atom\n if (!m_StscAtom) {\n return AP4_ERROR_INVALID_FORMAT;\n }\n \n // check that we have a chunk offset table\n if (m_StcoAtom == NULL && m_Co64Atom == NULL) {\n return AP4_ERROR_INVALID_FORMAT;\n }\n\n // MP4 uses 1-based indexes internally, so adjust by one\n index++;\n\n // find out in which chunk this sample is located\n AP4_Ordinal chunk, skip, desc;\n result = m_StscAtom->GetChunkForSample(index, chunk, skip, desc);\n if (AP4_FAILED(result)) return result;\n \n // check that the result is within bounds\n if (skip > index) return AP4_ERROR_INTERNAL;\n\n // get the atom offset for this chunk\n AP4_UI64 offset;\n if (m_StcoAtom) {\n AP4_UI32 offset_32;\n result = m_StcoAtom->GetChunkOffset(chunk, offset_32);\n offset = offset_32;\n } else {\n result = m_Co64Atom->GetChunkOffset(chunk, offset);\n }\n if (AP4_FAILED(result)) return result;\n \n // compute the additional offset inside the chunk\n for (unsigned int i = index-skip; i < index; i++) {\n AP4_Size size = 0;\n if (m_StszAtom) {\n result = m_StszAtom->GetSampleSize(i, size); \n } else if (m_Stz2Atom) {\n result = m_Stz2Atom->GetSampleSize(i, size); \n } else {\n result = AP4_ERROR_INVALID_FORMAT;\n }\n if (AP4_FAILED(result)) return result;\n offset += size;\n }\n\n // set the description index\n sample.SetDescriptionIndex(desc-1); // adjust for 0-based indexes\n\n // set the dts and cts\n AP4_UI32 cts_offset = 0;\n AP4_UI64 dts = 0;\n AP4_UI32 duration = 0;\n if (m_SttsAtom) {\n result = m_SttsAtom->GetDts(index, dts, &duration);\n if (AP4_FAILED(result)) return result;\n }\n sample.SetDuration(duration);\n sample.SetDts(dts);\n if (m_CttsAtom == NULL) {\n sample.SetCts(dts);\n } else {\n result = m_CttsAtom->GetCtsOffset(index, cts_offset); \n\t if (AP4_FAILED(result)) return result;\n sample.SetCtsDelta(cts_offset);\n } \n\n // set the size\n AP4_Size sample_size = 0;\n if (m_StszAtom) {\n result = m_StszAtom->GetSampleSize(index, sample_size); \n } else if (m_Stz2Atom) {\n result = m_Stz2Atom->GetSampleSize(index, sample_size); \n } else {\n result = AP4_ERROR_INVALID_FORMAT;\n }\n if (AP4_FAILED(result)) return result;\n sample.SetSize(sample_size);\n\n // set the sync flag\n if (m_StssAtom == NULL) {\n sample.SetSync(true);\n } else {\n sample.SetSync(m_StssAtom->IsSampleSync(index));\n }\n\n // set the offset\n sample.SetOffset(offset);\n\n // set the data stream\n sample.SetDataStream(m_SampleStream);\n\n\n return AP4_SUCCESS;\n}","lang":"cpp","vul_type":"cwe-476","target_token_count":802,"sven_meta":{"func_name":"AP4_AtomSampleTable::GetSample","file_name":"Source/C++/Core/Ap4AtomSampleTable.cpp","commit_link":"github.com/axiomatic-systems/Bento4/commit/2f267f89f957088197f4b1fc254632d1645b415d","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#66-006733e045af","input":"static int chmd_read_headers(struct mspack_system *sys, struct mspack_file *fh,\n\t\t\t struct mschmd_header *chm, int entire)\n{\n unsigned int section, name_len, x, errors, num_chunks;\n unsigned char buf[0x54], *chunk = NULL, *name, *p, *end;\n struct mschmd_file *fi, *link = NULL;\n off_t offset, length;\n int num_entries;\n\n /* initialise pointers */\n chm->files = NULL;\n chm->sysfiles = NULL;\n chm->chunk_cache = NULL;\n chm->sec0.base.chm = chm;\n chm->sec0.base.id = 0;\n chm->sec1.base.chm = chm;\n chm->sec1.base.id = 1;\n chm->sec1.content = NULL;\n chm->sec1.control = NULL;\n chm->sec1.spaninfo = NULL;\n chm->sec1.rtable = NULL;\n\n /* read the first header */\n if (sys->read(fh, &buf[0], chmhead_SIZEOF) != chmhead_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n /* check ITSF signature */\n if (EndGetI32(&buf[chmhead_Signature]) != 0x46535449) {\n return MSPACK_ERR_SIGNATURE;\n }\n\n /* check both header GUIDs */\n if (mspack_memcmp(&buf[chmhead_GUID1], &guids[0], 32L) != 0) {\n D((\"incorrect GUIDs\"))\n return MSPACK_ERR_SIGNATURE;\n }\n\n chm->version = EndGetI32(&buf[chmhead_Version]);\n chm->timestamp = EndGetM32(&buf[chmhead_Timestamp]);\n chm->language = EndGetI32(&buf[chmhead_LanguageID]);\n if (chm->version > 3) {\n sys->message(fh, \"WARNING; CHM version > 3\");\n }\n\n /* read the header section table */\n if (sys->read(fh, &buf[0], chmhst3_SIZEOF) != chmhst3_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n /* chmhst3_OffsetCS0 does not exist in version 1 or 2 CHM files.\n * The offset will be corrected later, once HS1 is read.\n */\n if (read_off64(&offset, &buf[chmhst_OffsetHS0], sys, fh) ||\n read_off64(&chm->dir_offset, &buf[chmhst_OffsetHS1], sys, fh) ||\n read_off64(&chm->sec0.offset, &buf[chmhst3_OffsetCS0], sys, fh))\n {\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* seek to header section 0 */\n if (sys->seek(fh, offset, MSPACK_SYS_SEEK_START)) {\n return MSPACK_ERR_SEEK;\n }\n\n /* read header section 0 */\n if (sys->read(fh, &buf[0], chmhs0_SIZEOF) != chmhs0_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n if (read_off64(&chm->length, &buf[chmhs0_FileLen], sys, fh)) {\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* seek to header section 1 */\n if (sys->seek(fh, chm->dir_offset, MSPACK_SYS_SEEK_START)) {\n return MSPACK_ERR_SEEK;\n }\n\n /* read header section 1 */\n if (sys->read(fh, &buf[0], chmhs1_SIZEOF) != chmhs1_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n chm->dir_offset = sys->tell(fh);\n chm->chunk_size = EndGetI32(&buf[chmhs1_ChunkSize]);\n chm->density = EndGetI32(&buf[chmhs1_Density]);\n chm->depth = EndGetI32(&buf[chmhs1_Depth]);\n chm->index_root = EndGetI32(&buf[chmhs1_IndexRoot]);\n chm->num_chunks = EndGetI32(&buf[chmhs1_NumChunks]);\n chm->first_pmgl = EndGetI32(&buf[chmhs1_FirstPMGL]);\n chm->last_pmgl = EndGetI32(&buf[chmhs1_LastPMGL]);\n\n if (chm->version < 3) {\n /* versions before 3 don't have chmhst3_OffsetCS0 */\n chm->sec0.offset = chm->dir_offset + (chm->chunk_size * chm->num_chunks);\n }\n\n /* check if content offset or file size is wrong */\n if (chm->sec0.offset > chm->length) {\n D((\"content section begins after file has ended\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n \n /* ensure there are chunks and that chunk size is\n * large enough for signature and num_entries */\n if (chm->chunk_size < (pmgl_Entries + 2)) {\n D((\"chunk size not large enough\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n if (chm->num_chunks == 0) {\n D((\"no chunks\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* The chunk_cache data structure is not great; large values for num_chunks\n * or num_chunks*chunk_size can exhaust all memory. Until a better chunk\n * cache is implemented, put arbitrary limits on num_chunks and chunk size.\n */\n if (chm->num_chunks > 100000) {\n D((\"more than 100,000 chunks\"))\n return MSPACK_ERR_DATAFORMAT;\n } \n if ((off_t)chm->chunk_size * (off_t)chm->num_chunks > chm->length) {\n D((\"chunks larger than entire file\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* common sense checks on header section 1 fields */\n if ((chm->chunk_size & (chm->chunk_size - 1)) != 0) {\n sys->message(fh, \"WARNING; chunk size is not a power of two\");\n }\n if (chm->first_pmgl != 0) {\n sys->message(fh, \"WARNING; first PMGL chunk is not zero\");\n }\n if (chm->first_pmgl > chm->last_pmgl) {\n D((\"first pmgl chunk is after last pmgl chunk\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n if (chm->index_root != 0xFFFFFFFF && chm->index_root >= chm->num_chunks) {\n D((\"index_root outside valid range\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* if we are doing a quick read, stop here! */\n if (!entire) {\n return MSPACK_ERR_OK;\n }\n\n /* seek to the first PMGL chunk, and reduce the number of chunks to read */\n if ((x = chm->first_pmgl) != 0) {\n if (sys->seek(fh,(off_t) (x * chm->chunk_size), MSPACK_SYS_SEEK_CUR)) {\n return MSPACK_ERR_SEEK;\n }\n }\n num_chunks = chm->last_pmgl - x + 1;\n\n if (!(chunk = (unsigned char *) sys->alloc(sys, (size_t)chm->chunk_size))) {\n return MSPACK_ERR_NOMEMORY;\n }\n\n /* read and process all chunks from FirstPMGL to LastPMGL */\n errors = 0;\n while (num_chunks--) {\n /* read next chunk */\n if (sys->read(fh, chunk, (int)chm->chunk_size) != (int)chm->chunk_size) {\n sys->free(chunk);\n return MSPACK_ERR_READ;\n }\n\n /* process only directory (PMGL) chunks */\n if (EndGetI32(&chunk[pmgl_Signature]) != 0x4C474D50) continue;\n\n if (EndGetI32(&chunk[pmgl_QuickRefSize]) < 2) {\n sys->message(fh, \"WARNING; PMGL quickref area is too small\");\n }\n if (EndGetI32(&chunk[pmgl_QuickRefSize]) > \n\t((int)chm->chunk_size - pmgl_Entries))\n {\n sys->message(fh, \"WARNING; PMGL quickref area is too large\");\n }\n\n p = &chunk[pmgl_Entries];\n end = &chunk[chm->chunk_size - 2];\n num_entries = EndGetI16(end);\n\n while (num_entries--) {\n READ_ENCINT(name_len);\n if (name_len > (unsigned int) (end - p)) goto chunk_end;\n /* consider blank filenames to be an error */\n if (name_len == 0) goto chunk_end;\n name = p; p += name_len;\n\n READ_ENCINT(section);\n READ_ENCINT(offset);\n READ_ENCINT(length);\n\n /* empty files and directory names are stored as a file entry at\n * offset 0 with length 0. We want to keep empty files, but not\n * directory names, which end with a \"/\" */\n if ((offset == 0) && (length == 0)) {\n\tif ((name_len > 0) && (name[name_len-1] == '/')) continue;\n }\n\n if (section > 1) {\n\tsys->message(fh, \"invalid section number '%u'.\", section);\n\tcontinue;\n }\n\n if (!(fi = (struct mschmd_file *) sys->alloc(sys, sizeof(struct mschmd_file) + name_len + 1))) {\n\tsys->free(chunk);\n\treturn MSPACK_ERR_NOMEMORY;\n }\n\n fi->next = NULL;\n fi->filename = (char *) &fi[1];\n fi->section = ((section == 0) ? (struct mschmd_section *) (&chm->sec0)\n\t\t : (struct mschmd_section *) (&chm->sec1));\n fi->offset = offset;\n fi->length = length;\n sys->copy(name, fi->filename, (size_t) name_len);\n fi->filename[name_len] = '\\0';\n\n if (name[0] == ':' && name[1] == ':') {\n\t/* system file */\n\tif (mspack_memcmp(&name[2], &content_name[2], 31L) == 0) {\n\t if (mspack_memcmp(&name[33], &content_name[33], 8L) == 0) {\n\t chm->sec1.content = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &control_name[33], 11L) == 0) {\n\t chm->sec1.control = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &spaninfo_name[33], 8L) == 0) {\n\t chm->sec1.spaninfo = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &rtable_name[33], 72L) == 0) {\n\t chm->sec1.rtable = fi;\n\t }\n\t}\n\tfi->next = chm->sysfiles;\n\tchm->sysfiles = fi;\n }\n else {\n\t/* normal file */\n\tif (link) link->next = fi; else chm->files = fi;\n\tlink = fi;\n }\n }\n\n /* this is reached either when num_entries runs out, or if\n * reading data from the chunk reached a premature end of chunk */\n chunk_end:\n if (num_entries >= 0) {\n D((\"chunk ended before all entries could be read\"))\n errors++;\n }\n\n }\n sys->free(chunk);\n return (errors > 0) ? MSPACK_ERR_DATAFORMAT : MSPACK_ERR_OK;\n}","target":"static int chmd_read_headers(struct mspack_system *sys, struct mspack_file *fh,\n\t\t\t struct mschmd_header *chm, int entire)\n{\n unsigned int section, name_len, x, errors, num_chunks;\n unsigned char buf[0x54], *chunk = NULL, *name, *p, *end;\n struct mschmd_file *fi, *link = NULL;\n off_t offset, length;\n int num_entries;\n\n /* initialise pointers */\n chm->files = NULL;\n chm->sysfiles = NULL;\n chm->chunk_cache = NULL;\n chm->sec0.base.chm = chm;\n chm->sec0.base.id = 0;\n chm->sec1.base.chm = chm;\n chm->sec1.base.id = 1;\n chm->sec1.content = NULL;\n chm->sec1.control = NULL;\n chm->sec1.spaninfo = NULL;\n chm->sec1.rtable = NULL;\n\n /* read the first header */\n if (sys->read(fh, &buf[0], chmhead_SIZEOF) != chmhead_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n /* check ITSF signature */\n if (EndGetI32(&buf[chmhead_Signature]) != 0x46535449) {\n return MSPACK_ERR_SIGNATURE;\n }\n\n /* check both header GUIDs */\n if (mspack_memcmp(&buf[chmhead_GUID1], &guids[0], 32L) != 0) {\n D((\"incorrect GUIDs\"))\n return MSPACK_ERR_SIGNATURE;\n }\n\n chm->version = EndGetI32(&buf[chmhead_Version]);\n chm->timestamp = EndGetM32(&buf[chmhead_Timestamp]);\n chm->language = EndGetI32(&buf[chmhead_LanguageID]);\n if (chm->version > 3) {\n sys->message(fh, \"WARNING; CHM version > 3\");\n }\n\n /* read the header section table */\n if (sys->read(fh, &buf[0], chmhst3_SIZEOF) != chmhst3_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n /* chmhst3_OffsetCS0 does not exist in version 1 or 2 CHM files.\n * The offset will be corrected later, once HS1 is read.\n */\n if (read_off64(&offset, &buf[chmhst_OffsetHS0], sys, fh) ||\n read_off64(&chm->dir_offset, &buf[chmhst_OffsetHS1], sys, fh) ||\n read_off64(&chm->sec0.offset, &buf[chmhst3_OffsetCS0], sys, fh))\n {\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* seek to header section 0 */\n if (sys->seek(fh, offset, MSPACK_SYS_SEEK_START)) {\n return MSPACK_ERR_SEEK;\n }\n\n /* read header section 0 */\n if (sys->read(fh, &buf[0], chmhs0_SIZEOF) != chmhs0_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n if (read_off64(&chm->length, &buf[chmhs0_FileLen], sys, fh)) {\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* seek to header section 1 */\n if (sys->seek(fh, chm->dir_offset, MSPACK_SYS_SEEK_START)) {\n return MSPACK_ERR_SEEK;\n }\n\n /* read header section 1 */\n if (sys->read(fh, &buf[0], chmhs1_SIZEOF) != chmhs1_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n chm->dir_offset = sys->tell(fh);\n chm->chunk_size = EndGetI32(&buf[chmhs1_ChunkSize]);\n chm->density = EndGetI32(&buf[chmhs1_Density]);\n chm->depth = EndGetI32(&buf[chmhs1_Depth]);\n chm->index_root = EndGetI32(&buf[chmhs1_IndexRoot]);\n chm->num_chunks = EndGetI32(&buf[chmhs1_NumChunks]);\n chm->first_pmgl = EndGetI32(&buf[chmhs1_FirstPMGL]);\n chm->last_pmgl = EndGetI32(&buf[chmhs1_LastPMGL]);\n\n if (chm->version < 3) {\n /* versions before 3 don't have chmhst3_OffsetCS0 */\n chm->sec0.offset = chm->dir_offset + (chm->chunk_size * chm->num_chunks);\n }\n\n /* check if content offset or file size is wrong */\n if (chm->sec0.offset > chm->length) {\n D((\"content section begins after file has ended\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n \n /* ensure there are chunks and that chunk size is\n * large enough for signature and num_entries */\n if (chm->chunk_size < (pmgl_Entries + 2)) {\n D((\"chunk size not large enough\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n if (chm->num_chunks == 0) {\n D((\"no chunks\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* The chunk_cache data structure is not great; large values for num_chunks\n * or num_chunks*chunk_size can exhaust all memory. Until a better chunk\n * cache is implemented, put arbitrary limits on num_chunks and chunk size.\n */\n if (chm->num_chunks > 100000) {\n D((\"more than 100,000 chunks\"))\n return MSPACK_ERR_DATAFORMAT;\n } \n if ((off_t)chm->chunk_size * (off_t)chm->num_chunks > chm->length) {\n D((\"chunks larger than entire file\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* common sense checks on header section 1 fields */\n if ((chm->chunk_size & (chm->chunk_size - 1)) != 0) {\n sys->message(fh, \"WARNING; chunk size is not a power of two\");\n }\n if (chm->first_pmgl != 0) {\n sys->message(fh, \"WARNING; first PMGL chunk is not zero\");\n }\n if (chm->first_pmgl > chm->last_pmgl) {\n D((\"first pmgl chunk is after last pmgl chunk\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n if (chm->index_root != 0xFFFFFFFF && chm->index_root >= chm->num_chunks) {\n D((\"index_root outside valid range\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* if we are doing a quick read, stop here! */\n if (!entire) {\n return MSPACK_ERR_OK;\n }\n\n /* seek to the first PMGL chunk, and reduce the number of chunks to read */\n if ((x = chm->first_pmgl) != 0) {\n if (sys->seek(fh,(off_t) (x * chm->chunk_size), MSPACK_SYS_SEEK_CUR)) {\n return MSPACK_ERR_SEEK;\n }\n }\n num_chunks = chm->last_pmgl - x + 1;\n\n if (!(chunk = (unsigned char *) sys->alloc(sys, (size_t)chm->chunk_size))) {\n return MSPACK_ERR_NOMEMORY;\n }\n\n /* read and process all chunks from FirstPMGL to LastPMGL */\n errors = 0;\n while (num_chunks--) {\n /* read next chunk */\n if (sys->read(fh, chunk, (int)chm->chunk_size) != (int)chm->chunk_size) {\n sys->free(chunk);\n return MSPACK_ERR_READ;\n }\n\n /* process only directory (PMGL) chunks */\n if (EndGetI32(&chunk[pmgl_Signature]) != 0x4C474D50) continue;\n\n if (EndGetI32(&chunk[pmgl_QuickRefSize]) < 2) {\n sys->message(fh, \"WARNING; PMGL quickref area is too small\");\n }\n if (EndGetI32(&chunk[pmgl_QuickRefSize]) > \n\t((int)chm->chunk_size - pmgl_Entries))\n {\n sys->message(fh, \"WARNING; PMGL quickref area is too large\");\n }\n\n p = &chunk[pmgl_Entries];\n end = &chunk[chm->chunk_size - 2];\n num_entries = EndGetI16(end);\n\n while (num_entries--) {\n READ_ENCINT(name_len);\n if (name_len > (unsigned int) (end - p)) goto chunk_end;\n name = p; p += name_len;\n READ_ENCINT(section);\n READ_ENCINT(offset);\n READ_ENCINT(length);\n\n /* ignore blank or one-char (e.g. \"/\") filenames we'd return as blank */\n if (name_len < 2 || !name[0] || !name[1]) continue;\n\n /* empty files and directory names are stored as a file entry at\n * offset 0 with length 0. We want to keep empty files, but not\n * directory names, which end with a \"/\" */\n if ((offset == 0) && (length == 0)) {\n\tif ((name_len > 0) && (name[name_len-1] == '/')) continue;\n }\n\n if (section > 1) {\n\tsys->message(fh, \"invalid section number '%u'.\", section);\n\tcontinue;\n }\n\n if (!(fi = (struct mschmd_file *) sys->alloc(sys, sizeof(struct mschmd_file) + name_len + 1))) {\n\tsys->free(chunk);\n\treturn MSPACK_ERR_NOMEMORY;\n }\n\n fi->next = NULL;\n fi->filename = (char *) &fi[1];\n fi->section = ((section == 0) ? (struct mschmd_section *) (&chm->sec0)\n\t\t : (struct mschmd_section *) (&chm->sec1));\n fi->offset = offset;\n fi->length = length;\n sys->copy(name, fi->filename, (size_t) name_len);\n fi->filename[name_len] = '\\0';\n\n if (name[0] == ':' && name[1] == ':') {\n\t/* system file */\n\tif (mspack_memcmp(&name[2], &content_name[2], 31L) == 0) {\n\t if (mspack_memcmp(&name[33], &content_name[33], 8L) == 0) {\n\t chm->sec1.content = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &control_name[33], 11L) == 0) {\n\t chm->sec1.control = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &spaninfo_name[33], 8L) == 0) {\n\t chm->sec1.spaninfo = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &rtable_name[33], 72L) == 0) {\n\t chm->sec1.rtable = fi;\n\t }\n\t}\n\tfi->next = chm->sysfiles;\n\tchm->sysfiles = fi;\n }\n else {\n\t/* normal file */\n\tif (link) link->next = fi; else chm->files = fi;\n\tlink = fi;\n }\n }\n\n /* this is reached either when num_entries runs out, or if\n * reading data from the chunk reached a premature end of chunk */\n chunk_end:\n if (num_entries >= 0) {\n D((\"chunk ended before all entries could be read\"))\n errors++;\n }\n\n }\n sys->free(chunk);\n return (errors > 0) ? MSPACK_ERR_DATAFORMAT : MSPACK_ERR_OK;\n}","lang":"c","vul_type":"cwe-476","target_token_count":2691,"sven_meta":{"func_name":"chmd_read_headers","file_name":"libmspack/mspack/chmd.c","commit_link":"github.com/kyz/libmspack/commit/8759da8db6ec9e866cb8eb143313f397f925bb4f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#68-bfea35aae0ef","input":"int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)\n{\n\tint rc = X86EMUL_CONTINUE;\n\tint mode = ctxt->mode;\n\tint def_op_bytes, def_ad_bytes, goffset, simd_prefix;\n\tbool op_prefix = false;\n\tbool has_seg_override = false;\n\tstruct opcode opcode;\n\n\tctxt->memop.type = OP_NONE;\n\tctxt->memopp = NULL;\n\tctxt->_eip = ctxt->eip;\n\tctxt->fetch.ptr = ctxt->fetch.data;\n\tctxt->fetch.end = ctxt->fetch.data + insn_len;\n\tctxt->opcode_len = 1;\n\tif (insn_len > 0)\n\t\tmemcpy(ctxt->fetch.data, insn, insn_len);\n\telse {\n\t\trc = __do_insn_fetch_bytes(ctxt, 1);\n\t\tif (rc != X86EMUL_CONTINUE)\n\t\t\treturn rc;\n\t}\n\n\tswitch (mode) {\n\tcase X86EMUL_MODE_REAL:\n\tcase X86EMUL_MODE_VM86:\n\tcase X86EMUL_MODE_PROT16:\n\t\tdef_op_bytes = def_ad_bytes = 2;\n\t\tbreak;\n\tcase X86EMUL_MODE_PROT32:\n\t\tdef_op_bytes = def_ad_bytes = 4;\n\t\tbreak;\n#ifdef CONFIG_X86_64\n\tcase X86EMUL_MODE_PROT64:\n\t\tdef_op_bytes = 4;\n\t\tdef_ad_bytes = 8;\n\t\tbreak;\n#endif\n\tdefault:\n\t\treturn EMULATION_FAILED;\n\t}\n\n\tctxt->op_bytes = def_op_bytes;\n\tctxt->ad_bytes = def_ad_bytes;\n\n\t/* Legacy prefixes. */\n\tfor (;;) {\n\t\tswitch (ctxt->b = insn_fetch(u8, ctxt)) {\n\t\tcase 0x66:\t/* operand-size override */\n\t\t\top_prefix = true;\n\t\t\t/* switch between 2/4 bytes */\n\t\t\tctxt->op_bytes = def_op_bytes ^ 6;\n\t\t\tbreak;\n\t\tcase 0x67:\t/* address-size override */\n\t\t\tif (mode == X86EMUL_MODE_PROT64)\n\t\t\t\t/* switch between 4/8 bytes */\n\t\t\t\tctxt->ad_bytes = def_ad_bytes ^ 12;\n\t\t\telse\n\t\t\t\t/* switch between 2/4 bytes */\n\t\t\t\tctxt->ad_bytes = def_ad_bytes ^ 6;\n\t\t\tbreak;\n\t\tcase 0x26:\t/* ES override */\n\t\tcase 0x2e:\t/* CS override */\n\t\tcase 0x36:\t/* SS override */\n\t\tcase 0x3e:\t/* DS override */\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = (ctxt->b >> 3) & 3;\n\t\t\tbreak;\n\t\tcase 0x64:\t/* FS override */\n\t\tcase 0x65:\t/* GS override */\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = ctxt->b & 7;\n\t\t\tbreak;\n\t\tcase 0x40 ... 0x4f: /* REX */\n\t\t\tif (mode != X86EMUL_MODE_PROT64)\n\t\t\t\tgoto done_prefixes;\n\t\t\tctxt->rex_prefix = ctxt->b;\n\t\t\tcontinue;\n\t\tcase 0xf0:\t/* LOCK */\n\t\t\tctxt->lock_prefix = 1;\n\t\t\tbreak;\n\t\tcase 0xf2:\t/* REPNE/REPNZ */\n\t\tcase 0xf3:\t/* REP/REPE/REPZ */\n\t\t\tctxt->rep_prefix = ctxt->b;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tgoto done_prefixes;\n\t\t}\n\n\t\t/* Any legacy prefix after a REX prefix nullifies its effect. */\n\n\t\tctxt->rex_prefix = 0;\n\t}\n\ndone_prefixes:\n\n\t/* REX prefix. */\n\tif (ctxt->rex_prefix & 8)\n\t\tctxt->op_bytes = 8;\t/* REX.W */\n\n\t/* Opcode byte(s). */\n\topcode = opcode_table[ctxt->b];\n\t/* Two-byte opcode? */\n\tif (ctxt->b == 0x0f) {\n\t\tctxt->opcode_len = 2;\n\t\tctxt->b = insn_fetch(u8, ctxt);\n\t\topcode = twobyte_table[ctxt->b];\n\n\t\t/* 0F_38 opcode map */\n\t\tif (ctxt->b == 0x38) {\n\t\t\tctxt->opcode_len = 3;\n\t\t\tctxt->b = insn_fetch(u8, ctxt);\n\t\t\topcode = opcode_map_0f_38[ctxt->b];\n\t\t}\n\t}\n\tctxt->d = opcode.flags;\n\n\tif (ctxt->d & ModRM)\n\t\tctxt->modrm = insn_fetch(u8, ctxt);\n\n\t/* vex-prefix instructions are not implemented */\n\tif (ctxt->opcode_len == 1 && (ctxt->b == 0xc5 || ctxt->b == 0xc4) &&\n\t (mode == X86EMUL_MODE_PROT64 || (ctxt->modrm & 0xc0) == 0xc0)) {\n\t\tctxt->d = NotImpl;\n\t}\n\n\twhile (ctxt->d & GroupMask) {\n\t\tswitch (ctxt->d & GroupMask) {\n\t\tcase Group:\n\t\t\tgoffset = (ctxt->modrm >> 3) & 7;\n\t\t\topcode = opcode.u.group[goffset];\n\t\t\tbreak;\n\t\tcase GroupDual:\n\t\t\tgoffset = (ctxt->modrm >> 3) & 7;\n\t\t\tif ((ctxt->modrm >> 6) == 3)\n\t\t\t\topcode = opcode.u.gdual->mod3[goffset];\n\t\t\telse\n\t\t\t\topcode = opcode.u.gdual->mod012[goffset];\n\t\t\tbreak;\n\t\tcase RMExt:\n\t\t\tgoffset = ctxt->modrm & 7;\n\t\t\topcode = opcode.u.group[goffset];\n\t\t\tbreak;\n\t\tcase Prefix:\n\t\t\tif (ctxt->rep_prefix && op_prefix)\n\t\t\t\treturn EMULATION_FAILED;\n\t\t\tsimd_prefix = op_prefix ? 0x66 : ctxt->rep_prefix;\n\t\t\tswitch (simd_prefix) {\n\t\t\tcase 0x00: opcode = opcode.u.gprefix->pfx_no; break;\n\t\t\tcase 0x66: opcode = opcode.u.gprefix->pfx_66; break;\n\t\t\tcase 0xf2: opcode = opcode.u.gprefix->pfx_f2; break;\n\t\t\tcase 0xf3: opcode = opcode.u.gprefix->pfx_f3; break;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase Escape:\n\t\t\tif (ctxt->modrm > 0xbf)\n\t\t\t\topcode = opcode.u.esc->high[ctxt->modrm - 0xc0];\n\t\t\telse\n\t\t\t\topcode = opcode.u.esc->op[(ctxt->modrm >> 3) & 7];\n\t\t\tbreak;\n\t\tcase InstrDual:\n\t\t\tif ((ctxt->modrm >> 6) == 3)\n\t\t\t\topcode = opcode.u.idual->mod3;\n\t\t\telse\n\t\t\t\topcode = opcode.u.idual->mod012;\n\t\t\tbreak;\n\t\tcase ModeDual:\n\t\t\tif (ctxt->mode == X86EMUL_MODE_PROT64)\n\t\t\t\topcode = opcode.u.mdual->mode64;\n\t\t\telse\n\t\t\t\topcode = opcode.u.mdual->mode32;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn EMULATION_FAILED;\n\t\t}\n\n\t\tctxt->d &= ~(u64)GroupMask;\n\t\tctxt->d |= opcode.flags;\n\t}\n\n\t/* Unrecognised? */\n\tif (ctxt->d == 0)\n\t\treturn EMULATION_FAILED;\n\n\tctxt->execute = opcode.u.execute;\n\n\tif (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD)))\n\t\treturn EMULATION_FAILED;\n\n\tif (unlikely(ctxt->d &\n\t (NotImpl|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm|NearBranch|\n\t No16))) {\n\t\t/*\n\t\t * These are copied unconditionally here, and checked unconditionally\n\t\t * in x86_emulate_insn.\n\t\t */\n\t\tctxt->check_perm = opcode.check_perm;\n\t\tctxt->intercept = opcode.intercept;\n\n\t\tif (ctxt->d & NotImpl)\n\t\t\treturn EMULATION_FAILED;\n\n\t\tif (mode == X86EMUL_MODE_PROT64) {\n\t\t\tif (ctxt->op_bytes == 4 && (ctxt->d & Stack))\n\t\t\t\tctxt->op_bytes = 8;\n\t\t\telse if (ctxt->d & NearBranch)\n\t\t\t\tctxt->op_bytes = 8;\n\t\t}\n\n\t\tif (ctxt->d & Op3264) {\n\t\t\tif (mode == X86EMUL_MODE_PROT64)\n\t\t\t\tctxt->op_bytes = 8;\n\t\t\telse\n\t\t\t\tctxt->op_bytes = 4;\n\t\t}\n\n\t\tif ((ctxt->d & No16) && ctxt->op_bytes == 2)\n\t\t\tctxt->op_bytes = 4;\n\n\t\tif (ctxt->d & Sse)\n\t\t\tctxt->op_bytes = 16;\n\t\telse if (ctxt->d & Mmx)\n\t\t\tctxt->op_bytes = 8;\n\t}\n\n\t/* ModRM and SIB bytes. */\n\tif (ctxt->d & ModRM) {\n\t\trc = decode_modrm(ctxt, &ctxt->memop);\n\t\tif (!has_seg_override) {\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = ctxt->modrm_seg;\n\t\t}\n\t} else if (ctxt->d & MemAbs)\n\t\trc = decode_abs(ctxt, &ctxt->memop);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\tif (!has_seg_override)\n\t\tctxt->seg_override = VCPU_SREG_DS;\n\n\tctxt->memop.addr.mem.seg = ctxt->seg_override;\n\n\t/*\n\t * Decode and fetch the source operand: register, memory\n\t * or immediate.\n\t */\n\trc = decode_operand(ctxt, &ctxt->src, (ctxt->d >> SrcShift) & OpMask);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\t/*\n\t * Decode and fetch the second source operand: register, memory\n\t * or immediate.\n\t */\n\trc = decode_operand(ctxt, &ctxt->src2, (ctxt->d >> Src2Shift) & OpMask);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\t/* Decode and fetch the destination operand: register or memory. */\n\trc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask);\n\n\tif (ctxt->rip_relative)\n\t\tctxt->memopp->addr.mem.ea = address_mask(ctxt,\n\t\t\t\t\tctxt->memopp->addr.mem.ea + ctxt->_eip);\n\ndone:\n\treturn (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK;\n}","target":"int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)\n{\n\tint rc = X86EMUL_CONTINUE;\n\tint mode = ctxt->mode;\n\tint def_op_bytes, def_ad_bytes, goffset, simd_prefix;\n\tbool op_prefix = false;\n\tbool has_seg_override = false;\n\tstruct opcode opcode;\n\n\tctxt->memop.type = OP_NONE;\n\tctxt->memopp = NULL;\n\tctxt->_eip = ctxt->eip;\n\tctxt->fetch.ptr = ctxt->fetch.data;\n\tctxt->fetch.end = ctxt->fetch.data + insn_len;\n\tctxt->opcode_len = 1;\n\tif (insn_len > 0)\n\t\tmemcpy(ctxt->fetch.data, insn, insn_len);\n\telse {\n\t\trc = __do_insn_fetch_bytes(ctxt, 1);\n\t\tif (rc != X86EMUL_CONTINUE)\n\t\t\treturn rc;\n\t}\n\n\tswitch (mode) {\n\tcase X86EMUL_MODE_REAL:\n\tcase X86EMUL_MODE_VM86:\n\tcase X86EMUL_MODE_PROT16:\n\t\tdef_op_bytes = def_ad_bytes = 2;\n\t\tbreak;\n\tcase X86EMUL_MODE_PROT32:\n\t\tdef_op_bytes = def_ad_bytes = 4;\n\t\tbreak;\n#ifdef CONFIG_X86_64\n\tcase X86EMUL_MODE_PROT64:\n\t\tdef_op_bytes = 4;\n\t\tdef_ad_bytes = 8;\n\t\tbreak;\n#endif\n\tdefault:\n\t\treturn EMULATION_FAILED;\n\t}\n\n\tctxt->op_bytes = def_op_bytes;\n\tctxt->ad_bytes = def_ad_bytes;\n\n\t/* Legacy prefixes. */\n\tfor (;;) {\n\t\tswitch (ctxt->b = insn_fetch(u8, ctxt)) {\n\t\tcase 0x66:\t/* operand-size override */\n\t\t\top_prefix = true;\n\t\t\t/* switch between 2/4 bytes */\n\t\t\tctxt->op_bytes = def_op_bytes ^ 6;\n\t\t\tbreak;\n\t\tcase 0x67:\t/* address-size override */\n\t\t\tif (mode == X86EMUL_MODE_PROT64)\n\t\t\t\t/* switch between 4/8 bytes */\n\t\t\t\tctxt->ad_bytes = def_ad_bytes ^ 12;\n\t\t\telse\n\t\t\t\t/* switch between 2/4 bytes */\n\t\t\t\tctxt->ad_bytes = def_ad_bytes ^ 6;\n\t\t\tbreak;\n\t\tcase 0x26:\t/* ES override */\n\t\tcase 0x2e:\t/* CS override */\n\t\tcase 0x36:\t/* SS override */\n\t\tcase 0x3e:\t/* DS override */\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = (ctxt->b >> 3) & 3;\n\t\t\tbreak;\n\t\tcase 0x64:\t/* FS override */\n\t\tcase 0x65:\t/* GS override */\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = ctxt->b & 7;\n\t\t\tbreak;\n\t\tcase 0x40 ... 0x4f: /* REX */\n\t\t\tif (mode != X86EMUL_MODE_PROT64)\n\t\t\t\tgoto done_prefixes;\n\t\t\tctxt->rex_prefix = ctxt->b;\n\t\t\tcontinue;\n\t\tcase 0xf0:\t/* LOCK */\n\t\t\tctxt->lock_prefix = 1;\n\t\t\tbreak;\n\t\tcase 0xf2:\t/* REPNE/REPNZ */\n\t\tcase 0xf3:\t/* REP/REPE/REPZ */\n\t\t\tctxt->rep_prefix = ctxt->b;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tgoto done_prefixes;\n\t\t}\n\n\t\t/* Any legacy prefix after a REX prefix nullifies its effect. */\n\n\t\tctxt->rex_prefix = 0;\n\t}\n\ndone_prefixes:\n\n\t/* REX prefix. */\n\tif (ctxt->rex_prefix & 8)\n\t\tctxt->op_bytes = 8;\t/* REX.W */\n\n\t/* Opcode byte(s). */\n\topcode = opcode_table[ctxt->b];\n\t/* Two-byte opcode? */\n\tif (ctxt->b == 0x0f) {\n\t\tctxt->opcode_len = 2;\n\t\tctxt->b = insn_fetch(u8, ctxt);\n\t\topcode = twobyte_table[ctxt->b];\n\n\t\t/* 0F_38 opcode map */\n\t\tif (ctxt->b == 0x38) {\n\t\t\tctxt->opcode_len = 3;\n\t\t\tctxt->b = insn_fetch(u8, ctxt);\n\t\t\topcode = opcode_map_0f_38[ctxt->b];\n\t\t}\n\t}\n\tctxt->d = opcode.flags;\n\n\tif (ctxt->d & ModRM)\n\t\tctxt->modrm = insn_fetch(u8, ctxt);\n\n\t/* vex-prefix instructions are not implemented */\n\tif (ctxt->opcode_len == 1 && (ctxt->b == 0xc5 || ctxt->b == 0xc4) &&\n\t (mode == X86EMUL_MODE_PROT64 || (ctxt->modrm & 0xc0) == 0xc0)) {\n\t\tctxt->d = NotImpl;\n\t}\n\n\twhile (ctxt->d & GroupMask) {\n\t\tswitch (ctxt->d & GroupMask) {\n\t\tcase Group:\n\t\t\tgoffset = (ctxt->modrm >> 3) & 7;\n\t\t\topcode = opcode.u.group[goffset];\n\t\t\tbreak;\n\t\tcase GroupDual:\n\t\t\tgoffset = (ctxt->modrm >> 3) & 7;\n\t\t\tif ((ctxt->modrm >> 6) == 3)\n\t\t\t\topcode = opcode.u.gdual->mod3[goffset];\n\t\t\telse\n\t\t\t\topcode = opcode.u.gdual->mod012[goffset];\n\t\t\tbreak;\n\t\tcase RMExt:\n\t\t\tgoffset = ctxt->modrm & 7;\n\t\t\topcode = opcode.u.group[goffset];\n\t\t\tbreak;\n\t\tcase Prefix:\n\t\t\tif (ctxt->rep_prefix && op_prefix)\n\t\t\t\treturn EMULATION_FAILED;\n\t\t\tsimd_prefix = op_prefix ? 0x66 : ctxt->rep_prefix;\n\t\t\tswitch (simd_prefix) {\n\t\t\tcase 0x00: opcode = opcode.u.gprefix->pfx_no; break;\n\t\t\tcase 0x66: opcode = opcode.u.gprefix->pfx_66; break;\n\t\t\tcase 0xf2: opcode = opcode.u.gprefix->pfx_f2; break;\n\t\t\tcase 0xf3: opcode = opcode.u.gprefix->pfx_f3; break;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase Escape:\n\t\t\tif (ctxt->modrm > 0xbf)\n\t\t\t\topcode = opcode.u.esc->high[ctxt->modrm - 0xc0];\n\t\t\telse\n\t\t\t\topcode = opcode.u.esc->op[(ctxt->modrm >> 3) & 7];\n\t\t\tbreak;\n\t\tcase InstrDual:\n\t\t\tif ((ctxt->modrm >> 6) == 3)\n\t\t\t\topcode = opcode.u.idual->mod3;\n\t\t\telse\n\t\t\t\topcode = opcode.u.idual->mod012;\n\t\t\tbreak;\n\t\tcase ModeDual:\n\t\t\tif (ctxt->mode == X86EMUL_MODE_PROT64)\n\t\t\t\topcode = opcode.u.mdual->mode64;\n\t\t\telse\n\t\t\t\topcode = opcode.u.mdual->mode32;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn EMULATION_FAILED;\n\t\t}\n\n\t\tctxt->d &= ~(u64)GroupMask;\n\t\tctxt->d |= opcode.flags;\n\t}\n\n\t/* Unrecognised? */\n\tif (ctxt->d == 0)\n\t\treturn EMULATION_FAILED;\n\n\tctxt->execute = opcode.u.execute;\n\n\tif (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD)))\n\t\treturn EMULATION_FAILED;\n\n\tif (unlikely(ctxt->d &\n\t (NotImpl|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm|NearBranch|\n\t No16))) {\n\t\t/*\n\t\t * These are copied unconditionally here, and checked unconditionally\n\t\t * in x86_emulate_insn.\n\t\t */\n\t\tctxt->check_perm = opcode.check_perm;\n\t\tctxt->intercept = opcode.intercept;\n\n\t\tif (ctxt->d & NotImpl)\n\t\t\treturn EMULATION_FAILED;\n\n\t\tif (mode == X86EMUL_MODE_PROT64) {\n\t\t\tif (ctxt->op_bytes == 4 && (ctxt->d & Stack))\n\t\t\t\tctxt->op_bytes = 8;\n\t\t\telse if (ctxt->d & NearBranch)\n\t\t\t\tctxt->op_bytes = 8;\n\t\t}\n\n\t\tif (ctxt->d & Op3264) {\n\t\t\tif (mode == X86EMUL_MODE_PROT64)\n\t\t\t\tctxt->op_bytes = 8;\n\t\t\telse\n\t\t\t\tctxt->op_bytes = 4;\n\t\t}\n\n\t\tif ((ctxt->d & No16) && ctxt->op_bytes == 2)\n\t\t\tctxt->op_bytes = 4;\n\n\t\tif (ctxt->d & Sse)\n\t\t\tctxt->op_bytes = 16;\n\t\telse if (ctxt->d & Mmx)\n\t\t\tctxt->op_bytes = 8;\n\t}\n\n\t/* ModRM and SIB bytes. */\n\tif (ctxt->d & ModRM) {\n\t\trc = decode_modrm(ctxt, &ctxt->memop);\n\t\tif (!has_seg_override) {\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = ctxt->modrm_seg;\n\t\t}\n\t} else if (ctxt->d & MemAbs)\n\t\trc = decode_abs(ctxt, &ctxt->memop);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\tif (!has_seg_override)\n\t\tctxt->seg_override = VCPU_SREG_DS;\n\n\tctxt->memop.addr.mem.seg = ctxt->seg_override;\n\n\t/*\n\t * Decode and fetch the source operand: register, memory\n\t * or immediate.\n\t */\n\trc = decode_operand(ctxt, &ctxt->src, (ctxt->d >> SrcShift) & OpMask);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\t/*\n\t * Decode and fetch the second source operand: register, memory\n\t * or immediate.\n\t */\n\trc = decode_operand(ctxt, &ctxt->src2, (ctxt->d >> Src2Shift) & OpMask);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\t/* Decode and fetch the destination operand: register or memory. */\n\trc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask);\n\n\tif (ctxt->rip_relative && likely(ctxt->memopp))\n\t\tctxt->memopp->addr.mem.ea = address_mask(ctxt,\n\t\t\t\t\tctxt->memopp->addr.mem.ea + ctxt->_eip);\n\ndone:\n\treturn (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK;\n}","lang":"c","vul_type":"cwe-476","target_token_count":2344,"sven_meta":{"func_name":"x86_decode_insn","file_name":"arch/x86/kvm/emulate.c","commit_link":"github.com/torvalds/linux/commit/d9092f52d7e61dd1557f2db2400ddb430e85937e","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#69-06c6e0f8aaad","input":"int expand_downwards(struct vm_area_struct *vma,\n\t\t\t\t unsigned long address)\n{\n\tstruct mm_struct *mm = vma->vm_mm;\n\tstruct vm_area_struct *prev;\n\tint error;\n\n\taddress &= PAGE_MASK;\n\terror = security_mmap_addr(address);\n\tif (error)\n\t\treturn error;\n\n\t/* Enforce stack_guard_gap */\n\tprev = vma->vm_prev;\n\t/* Check that both stack segments have the same anon_vma? */\n\tif (prev && !(prev->vm_flags & VM_GROWSDOWN) &&\n\t\t\t(prev->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {\n\t\tif (address - prev->vm_end < stack_guard_gap)\n\t\t\treturn -ENOMEM;\n\t}\n\n\t/* We must make sure the anon_vma is allocated. */\n\tif (unlikely(anon_vma_prepare(vma)))\n\t\treturn -ENOMEM;\n\n\t/*\n\t * vma->vm_start/vm_end cannot change under us because the caller\n\t * is required to hold the mmap_sem in read mode. We need the\n\t * anon_vma lock to serialize against concurrent expand_stacks.\n\t */\n\tanon_vma_lock_write(vma->anon_vma);\n\n\t/* Somebody else might have raced and expanded it already */\n\tif (address < vma->vm_start) {\n\t\tunsigned long size, grow;\n\n\t\tsize = vma->vm_end - address;\n\t\tgrow = (vma->vm_start - address) >> PAGE_SHIFT;\n\n\t\terror = -ENOMEM;\n\t\tif (grow <= vma->vm_pgoff) {\n\t\t\terror = acct_stack_growth(vma, size, grow);\n\t\t\tif (!error) {\n\t\t\t\t/*\n\t\t\t\t * vma_gap_update() doesn't support concurrent\n\t\t\t\t * updates, but we only hold a shared mmap_sem\n\t\t\t\t * lock here, so we need to protect against\n\t\t\t\t * concurrent vma expansions.\n\t\t\t\t * anon_vma_lock_write() doesn't help here, as\n\t\t\t\t * we don't guarantee that all growable vmas\n\t\t\t\t * in a mm share the same root anon vma.\n\t\t\t\t * So, we reuse mm->page_table_lock to guard\n\t\t\t\t * against concurrent vma expansions.\n\t\t\t\t */\n\t\t\t\tspin_lock(&mm->page_table_lock);\n\t\t\t\tif (vma->vm_flags & VM_LOCKED)\n\t\t\t\t\tmm->locked_vm += grow;\n\t\t\t\tvm_stat_account(mm, vma->vm_flags, grow);\n\t\t\t\tanon_vma_interval_tree_pre_update_vma(vma);\n\t\t\t\tvma->vm_start = address;\n\t\t\t\tvma->vm_pgoff -= grow;\n\t\t\t\tanon_vma_interval_tree_post_update_vma(vma);\n\t\t\t\tvma_gap_update(vma);\n\t\t\t\tspin_unlock(&mm->page_table_lock);\n\n\t\t\t\tperf_event_mmap(vma);\n\t\t\t}\n\t\t}\n\t}\n\tanon_vma_unlock_write(vma->anon_vma);\n\tkhugepaged_enter_vma_merge(vma, vma->vm_flags);\n\tvalidate_mm(mm);\n\treturn error;\n}","target":"int expand_downwards(struct vm_area_struct *vma,\n\t\t\t\t unsigned long address)\n{\n\tstruct mm_struct *mm = vma->vm_mm;\n\tstruct vm_area_struct *prev;\n\tint error = 0;\n\n\taddress &= PAGE_MASK;\n\tif (address < mmap_min_addr)\n\t\treturn -EPERM;\n\n\t/* Enforce stack_guard_gap */\n\tprev = vma->vm_prev;\n\t/* Check that both stack segments have the same anon_vma? */\n\tif (prev && !(prev->vm_flags & VM_GROWSDOWN) &&\n\t\t\t(prev->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {\n\t\tif (address - prev->vm_end < stack_guard_gap)\n\t\t\treturn -ENOMEM;\n\t}\n\n\t/* We must make sure the anon_vma is allocated. */\n\tif (unlikely(anon_vma_prepare(vma)))\n\t\treturn -ENOMEM;\n\n\t/*\n\t * vma->vm_start/vm_end cannot change under us because the caller\n\t * is required to hold the mmap_sem in read mode. We need the\n\t * anon_vma lock to serialize against concurrent expand_stacks.\n\t */\n\tanon_vma_lock_write(vma->anon_vma);\n\n\t/* Somebody else might have raced and expanded it already */\n\tif (address < vma->vm_start) {\n\t\tunsigned long size, grow;\n\n\t\tsize = vma->vm_end - address;\n\t\tgrow = (vma->vm_start - address) >> PAGE_SHIFT;\n\n\t\terror = -ENOMEM;\n\t\tif (grow <= vma->vm_pgoff) {\n\t\t\terror = acct_stack_growth(vma, size, grow);\n\t\t\tif (!error) {\n\t\t\t\t/*\n\t\t\t\t * vma_gap_update() doesn't support concurrent\n\t\t\t\t * updates, but we only hold a shared mmap_sem\n\t\t\t\t * lock here, so we need to protect against\n\t\t\t\t * concurrent vma expansions.\n\t\t\t\t * anon_vma_lock_write() doesn't help here, as\n\t\t\t\t * we don't guarantee that all growable vmas\n\t\t\t\t * in a mm share the same root anon vma.\n\t\t\t\t * So, we reuse mm->page_table_lock to guard\n\t\t\t\t * against concurrent vma expansions.\n\t\t\t\t */\n\t\t\t\tspin_lock(&mm->page_table_lock);\n\t\t\t\tif (vma->vm_flags & VM_LOCKED)\n\t\t\t\t\tmm->locked_vm += grow;\n\t\t\t\tvm_stat_account(mm, vma->vm_flags, grow);\n\t\t\t\tanon_vma_interval_tree_pre_update_vma(vma);\n\t\t\t\tvma->vm_start = address;\n\t\t\t\tvma->vm_pgoff -= grow;\n\t\t\t\tanon_vma_interval_tree_post_update_vma(vma);\n\t\t\t\tvma_gap_update(vma);\n\t\t\t\tspin_unlock(&mm->page_table_lock);\n\n\t\t\t\tperf_event_mmap(vma);\n\t\t\t}\n\t\t}\n\t}\n\tanon_vma_unlock_write(vma->anon_vma);\n\tkhugepaged_enter_vma_merge(vma, vma->vm_flags);\n\tvalidate_mm(mm);\n\treturn error;\n}","lang":"c","vul_type":"cwe-476","target_token_count":620,"sven_meta":{"func_name":"expand_downwards","file_name":"mm/mmap.c","commit_link":"github.com/torvalds/linux/commit/0a1d52994d440e21def1c2174932410b4f2a98a1","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-416#1-c9c73052250c","input":"dbd_st_fetch(SV *sth, imp_sth_t* imp_sth)\n{\n dTHX;\n int num_fields, ChopBlanks, i, rc;\n unsigned long *lengths;\n AV *av;\n int av_length, av_readonly;\n MYSQL_ROW cols;\n D_imp_dbh_from_sth;\n MYSQL* svsock= imp_dbh->pmysql;\n imp_sth_fbh_t *fbh;\n D_imp_xxh(sth);\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n MYSQL_BIND *buffer;\n#endif\n MYSQL_FIELD *fields;\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t-> dbd_st_fetch\\n\");\n\n#if MYSQL_ASYNC\n if(imp_dbh->async_query_in_flight) {\n if(mysql_db_async_result(sth, &imp_sth->result) <= 0) {\n return Nullav;\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (!DBIc_ACTIVE(imp_sth) )\n {\n do_error(sth, JW_ERR_SEQUENCE, \"no statement executing\\n\",NULL);\n return Nullav;\n }\n\n if (imp_sth->fetch_done)\n {\n do_error(sth, JW_ERR_SEQUENCE, \"fetch() but fetch already done\",NULL);\n return Nullav;\n }\n\n if (!imp_sth->done_desc)\n {\n if (!dbd_describe(sth, imp_sth))\n {\n do_error(sth, JW_ERR_SEQUENCE, \"Error while describe result set.\",\n NULL);\n return Nullav;\n }\n }\n }\n#endif\n\n ChopBlanks = DBIc_is(imp_sth, DBIcf_ChopBlanks);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tdbd_st_fetch for %p, chopblanks %d\\n\",\n sth, ChopBlanks);\n\n if (!imp_sth->result)\n {\n do_error(sth, JW_ERR_SEQUENCE, \"fetch() without execute()\" ,NULL);\n return Nullav;\n }\n\n /* fix from 2.9008 */\n imp_dbh->pmysql->net.last_errno = 0;\n\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch calling mysql_fetch\\n\");\n\n if ((rc= mysql_stmt_fetch(imp_sth->stmt)))\n {\n if (rc == 1)\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_stmt_sqlstate(imp_sth->stmt));\n\n#if MYSQL_VERSION_ID >= MYSQL_VERSION_5_0 \n if (rc == MYSQL_DATA_TRUNCATED) {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch data truncated\\n\");\n goto process;\n }\n#endif\n\n if (rc == MYSQL_NO_DATA)\n {\n /* Update row_num to affected_rows value */\n imp_sth->row_num= mysql_stmt_affected_rows(imp_sth->stmt);\n imp_sth->fetch_done=1;\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch no data\\n\");\n }\n\n dbd_st_finish(sth, imp_sth);\n\n return Nullav;\n }\n\nprocess:\n imp_sth->currow++;\n\n av= DBIc_DBISTATE(imp_sth)->get_fbav(imp_sth);\n num_fields=mysql_stmt_field_count(imp_sth->stmt);\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tdbd_st_fetch called mysql_fetch, rc %d num_fields %d\\n\",\n rc, num_fields);\n\n for (\n buffer= imp_sth->buffer,\n fbh= imp_sth->fbh,\n i= 0;\n i < num_fields;\n i++,\n fbh++,\n buffer++\n )\n {\n SV *sv= AvARRAY(av)[i]; /* Note: we (re)use the SV in the AV\t*/\n STRLEN len;\n\n /* This is wrong, null is not being set correctly\n * This is not the way to determine length (this would break blobs!)\n */\n if (fbh->is_null)\n (void) SvOK_off(sv); /* Field is NULL, return undef */\n else\n {\n /* In case of BLOB/TEXT fields we allocate only 8192 bytes\n in dbd_describe() for data. Here we know real size of field\n so we should increase buffer size and refetch column value\n */\n if (fbh->length > buffer->buffer_length || fbh->error)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tRefetch BLOB/TEXT column: %d, length: %lu, error: %d\\n\",\n i, fbh->length, fbh->error);\n\n Renew(fbh->data, fbh->length, char);\n buffer->buffer_length= fbh->length;\n buffer->buffer= (char *) fbh->data;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) {\n int j;\n int m = MIN(*buffer->length, buffer->buffer_length);\n char *ptr = (char*)buffer->buffer;\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\t\\tbefore buffer->buffer: \");\n for (j = 0; j < m; j++) {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"%c\", *ptr++);\n }\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\n\");\n }\n\n /*TODO: Use offset instead of 0 to fetch only remain part of data*/\n if (mysql_stmt_fetch_column(imp_sth->stmt, buffer , i, 0))\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_stmt_sqlstate(imp_sth->stmt));\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) {\n int j;\n int m = MIN(*buffer->length, buffer->buffer_length);\n char *ptr = (char*)buffer->buffer;\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\t\\tafter buffer->buffer: \");\n for (j = 0; j < m; j++) {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"%c\", *ptr++);\n }\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\n\");\n }\n }\n\n /* This does look a lot like Georg's PHP driver doesn't it? --Brian */\n /* Credit due to Georg - mysqli_api.c ;) --PMG */\n switch (buffer->buffer_type) {\n case MYSQL_TYPE_DOUBLE:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tst_fetch double data %f\\n\", fbh->ddata);\n sv_setnv(sv, fbh->ddata);\n break;\n\n case MYSQL_TYPE_LONG:\n case MYSQL_TYPE_LONGLONG:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tst_fetch int data %\"IVdf\", unsigned? %d\\n\",\n fbh->ldata, buffer->is_unsigned);\n if (buffer->is_unsigned)\n sv_setuv(sv, fbh->ldata);\n else\n sv_setiv(sv, fbh->ldata);\n\n break;\n\n case MYSQL_TYPE_BIT:\n sv_setpvn(sv, fbh->data, fbh->length);\n\n break;\n\n default:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tERROR IN st_fetch_string\");\n len= fbh->length;\n\t /* ChopBlanks server-side prepared statement */\n if (ChopBlanks)\n {\n /* \n see bottom of:\n http://www.mysql.org/doc/refman/5.0/en/c-api-datatypes.html\n */\n if (fbh->charsetnr != 63)\n while (len && fbh->data[len-1] == ' ') { --len; }\n }\n\t /* END OF ChopBlanks */\n\n sv_setpvn(sv, fbh->data, len);\n\n\t/* UTF8 */\n /*HELMUT*/\n#if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n\n#if MYSQL_VERSION_ID >= FIELD_CHARSETNR_VERSION \n /* SHOW COLLATION WHERE Id = 63; -- 63 == charset binary, collation binary */\n if ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && fbh->charsetnr != 63)\n#else\n\tif ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && !(fbh->flags & BINARY_FLAG))\n#endif\n\t sv_utf8_decode(sv);\n#endif\n\t/* END OF UTF8 */\n break;\n\n }\n\n }\n }\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, %d cols\\n\", num_fields);\n\n return av;\n }\n else\n {\n#endif\n\n imp_sth->currow++;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch result set details\\n\");\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\timp_sth->result=%p\\n\", imp_sth->result);\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_num_fields=%u\\n\",\n mysql_num_fields(imp_sth->result));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_num_rows=%llu\\n\",\n mysql_num_rows(imp_sth->result));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_affected_rows=%llu\\n\",\n mysql_affected_rows(imp_dbh->pmysql));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch for %p, currow= %d\\n\",\n sth,imp_sth->currow);\n }\n\n if (!(cols= mysql_fetch_row(imp_sth->result)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch, no more rows to fetch\");\n }\n if (mysql_errno(imp_dbh->pmysql))\n do_error(sth, mysql_errno(imp_dbh->pmysql),\n mysql_error(imp_dbh->pmysql),\n mysql_sqlstate(imp_dbh->pmysql));\n\n\n#if MYSQL_VERSION_ID >= MULTIPLE_RESULT_SET_VERSION\n if (!mysql_more_results(svsock))\n#endif\n dbd_st_finish(sth, imp_sth);\n return Nullav;\n }\n\n num_fields= mysql_num_fields(imp_sth->result);\n fields= mysql_fetch_fields(imp_sth->result);\n lengths= mysql_fetch_lengths(imp_sth->result);\n\n if ((av= DBIc_FIELDS_AV(imp_sth)) != Nullav)\n {\n av_length= av_len(av)+1;\n\n if (av_length != num_fields) /* Resize array if necessary */\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, size of results array(%d) != num_fields(%d)\\n\",\n av_length, num_fields);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, result fields(%d)\\n\",\n DBIc_NUM_FIELDS(imp_sth));\n\n av_readonly = SvREADONLY(av);\n\n if (av_readonly)\n SvREADONLY_off( av ); /* DBI sets this readonly */\n\n while (av_length < num_fields)\n {\n av_store(av, av_length++, newSV(0));\n }\n\n while (av_length > num_fields)\n {\n SvREFCNT_dec(av_pop(av));\n av_length--;\n }\n if (av_readonly)\n SvREADONLY_on(av);\n }\n }\n\n av= DBIc_DBISTATE(imp_sth)->get_fbav(imp_sth);\n\n for (i= 0; i < num_fields; ++i)\n {\n char *col= cols[i];\n SV *sv= AvARRAY(av)[i]; /* Note: we (re)use the SV in the AV\t*/\n\n if (col)\n {\n STRLEN len= lengths[i];\n if (ChopBlanks)\n {\n while (len && col[len-1] == ' ')\n {\t--len; }\n }\n\n /* Set string value returned from mysql server */\n sv_setpvn(sv, col, len);\n\n switch (mysql_to_perl_type(fields[i].type)) {\n case MYSQL_TYPE_DOUBLE:\n /* Coerce to dobule and set scalar as NV */\n (void) SvNV(sv);\n SvNOK_only(sv);\n break;\n\n case MYSQL_TYPE_LONG:\n case MYSQL_TYPE_LONGLONG:\n /* Coerce to integer and set scalar as UV resp. IV */\n if (fields[i].flags & UNSIGNED_FLAG)\n {\n (void) SvUV(sv);\n SvIOK_only_UV(sv);\n }\n else\n {\n (void) SvIV(sv);\n SvIOK_only(sv);\n }\n break;\n\n#if MYSQL_VERSION_ID > NEW_DATATYPE_VERSION\n case MYSQL_TYPE_BIT:\n /* Let it as binary string */\n break;\n#endif\n\n default:\n\t/* UTF8 */\n /*HELMUT*/\n#if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n\n /* see bottom of: http://www.mysql.org/doc/refman/5.0/en/c-api-datatypes.html */\n if ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && fields[i].charsetnr != 63)\n\t sv_utf8_decode(sv);\n#endif\n\t/* END OF UTF8 */\n break;\n }\n }\n else\n (void) SvOK_off(sv); /* Field is NULL, return undef */\n }\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, %d cols\\n\", num_fields);\n return av;\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n }\n#endif\n\n}","target":"dbd_st_fetch(SV *sth, imp_sth_t* imp_sth)\n{\n dTHX;\n int num_fields, ChopBlanks, i, rc;\n unsigned long *lengths;\n AV *av;\n int av_length, av_readonly;\n MYSQL_ROW cols;\n D_imp_dbh_from_sth;\n MYSQL* svsock= imp_dbh->pmysql;\n imp_sth_fbh_t *fbh;\n D_imp_xxh(sth);\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n MYSQL_BIND *buffer;\n#endif\n MYSQL_FIELD *fields;\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t-> dbd_st_fetch\\n\");\n\n#if MYSQL_ASYNC\n if(imp_dbh->async_query_in_flight) {\n if(mysql_db_async_result(sth, &imp_sth->result) <= 0) {\n return Nullav;\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (!DBIc_ACTIVE(imp_sth) )\n {\n do_error(sth, JW_ERR_SEQUENCE, \"no statement executing\\n\",NULL);\n return Nullav;\n }\n\n if (imp_sth->fetch_done)\n {\n do_error(sth, JW_ERR_SEQUENCE, \"fetch() but fetch already done\",NULL);\n return Nullav;\n }\n\n if (!imp_sth->done_desc)\n {\n if (!dbd_describe(sth, imp_sth))\n {\n do_error(sth, JW_ERR_SEQUENCE, \"Error while describe result set.\",\n NULL);\n return Nullav;\n }\n }\n }\n#endif\n\n ChopBlanks = DBIc_is(imp_sth, DBIcf_ChopBlanks);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tdbd_st_fetch for %p, chopblanks %d\\n\",\n sth, ChopBlanks);\n\n if (!imp_sth->result)\n {\n do_error(sth, JW_ERR_SEQUENCE, \"fetch() without execute()\" ,NULL);\n return Nullav;\n }\n\n /* fix from 2.9008 */\n imp_dbh->pmysql->net.last_errno = 0;\n\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch calling mysql_fetch\\n\");\n\n if ((rc= mysql_stmt_fetch(imp_sth->stmt)))\n {\n if (rc == 1)\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_stmt_sqlstate(imp_sth->stmt));\n\n#if MYSQL_VERSION_ID >= MYSQL_VERSION_5_0 \n if (rc == MYSQL_DATA_TRUNCATED) {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch data truncated\\n\");\n goto process;\n }\n#endif\n\n if (rc == MYSQL_NO_DATA)\n {\n /* Update row_num to affected_rows value */\n imp_sth->row_num= mysql_stmt_affected_rows(imp_sth->stmt);\n imp_sth->fetch_done=1;\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch no data\\n\");\n }\n\n dbd_st_finish(sth, imp_sth);\n\n return Nullav;\n }\n\nprocess:\n imp_sth->currow++;\n\n av= DBIc_DBISTATE(imp_sth)->get_fbav(imp_sth);\n num_fields=mysql_stmt_field_count(imp_sth->stmt);\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tdbd_st_fetch called mysql_fetch, rc %d num_fields %d\\n\",\n rc, num_fields);\n\n for (\n buffer= imp_sth->buffer,\n fbh= imp_sth->fbh,\n i= 0;\n i < num_fields;\n i++,\n fbh++,\n buffer++\n )\n {\n SV *sv= AvARRAY(av)[i]; /* Note: we (re)use the SV in the AV\t*/\n STRLEN len;\n\n /* This is wrong, null is not being set correctly\n * This is not the way to determine length (this would break blobs!)\n */\n if (fbh->is_null)\n (void) SvOK_off(sv); /* Field is NULL, return undef */\n else\n {\n /* In case of BLOB/TEXT fields we allocate only 8192 bytes\n in dbd_describe() for data. Here we know real size of field\n so we should increase buffer size and refetch column value\n */\n if (fbh->length > buffer->buffer_length || fbh->error)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tRefetch BLOB/TEXT column: %d, length: %lu, error: %d\\n\",\n i, fbh->length, fbh->error);\n\n Renew(fbh->data, fbh->length, char);\n buffer->buffer_length= fbh->length;\n buffer->buffer= (char *) fbh->data;\n imp_sth->stmt->bind[i].buffer_length = fbh->length;\n imp_sth->stmt->bind[i].buffer = (char *)fbh->data;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) {\n int j;\n int m = MIN(*buffer->length, buffer->buffer_length);\n char *ptr = (char*)buffer->buffer;\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\t\\tbefore buffer->buffer: \");\n for (j = 0; j < m; j++) {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"%c\", *ptr++);\n }\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\n\");\n }\n\n /*TODO: Use offset instead of 0 to fetch only remain part of data*/\n if (mysql_stmt_fetch_column(imp_sth->stmt, buffer , i, 0))\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_stmt_sqlstate(imp_sth->stmt));\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) {\n int j;\n int m = MIN(*buffer->length, buffer->buffer_length);\n char *ptr = (char*)buffer->buffer;\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\t\\tafter buffer->buffer: \");\n for (j = 0; j < m; j++) {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"%c\", *ptr++);\n }\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\n\");\n }\n }\n\n /* This does look a lot like Georg's PHP driver doesn't it? --Brian */\n /* Credit due to Georg - mysqli_api.c ;) --PMG */\n switch (buffer->buffer_type) {\n case MYSQL_TYPE_DOUBLE:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tst_fetch double data %f\\n\", fbh->ddata);\n sv_setnv(sv, fbh->ddata);\n break;\n\n case MYSQL_TYPE_LONG:\n case MYSQL_TYPE_LONGLONG:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tst_fetch int data %\"IVdf\", unsigned? %d\\n\",\n fbh->ldata, buffer->is_unsigned);\n if (buffer->is_unsigned)\n sv_setuv(sv, fbh->ldata);\n else\n sv_setiv(sv, fbh->ldata);\n\n break;\n\n case MYSQL_TYPE_BIT:\n sv_setpvn(sv, fbh->data, fbh->length);\n\n break;\n\n default:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tERROR IN st_fetch_string\");\n len= fbh->length;\n\t /* ChopBlanks server-side prepared statement */\n if (ChopBlanks)\n {\n /* \n see bottom of:\n http://www.mysql.org/doc/refman/5.0/en/c-api-datatypes.html\n */\n if (fbh->charsetnr != 63)\n while (len && fbh->data[len-1] == ' ') { --len; }\n }\n\t /* END OF ChopBlanks */\n\n sv_setpvn(sv, fbh->data, len);\n\n\t/* UTF8 */\n /*HELMUT*/\n#if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n\n#if MYSQL_VERSION_ID >= FIELD_CHARSETNR_VERSION \n /* SHOW COLLATION WHERE Id = 63; -- 63 == charset binary, collation binary */\n if ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && fbh->charsetnr != 63)\n#else\n\tif ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && !(fbh->flags & BINARY_FLAG))\n#endif\n\t sv_utf8_decode(sv);\n#endif\n\t/* END OF UTF8 */\n break;\n\n }\n\n }\n }\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, %d cols\\n\", num_fields);\n\n return av;\n }\n else\n {\n#endif\n\n imp_sth->currow++;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch result set details\\n\");\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\timp_sth->result=%p\\n\", imp_sth->result);\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_num_fields=%u\\n\",\n mysql_num_fields(imp_sth->result));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_num_rows=%llu\\n\",\n mysql_num_rows(imp_sth->result));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_affected_rows=%llu\\n\",\n mysql_affected_rows(imp_dbh->pmysql));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch for %p, currow= %d\\n\",\n sth,imp_sth->currow);\n }\n\n if (!(cols= mysql_fetch_row(imp_sth->result)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch, no more rows to fetch\");\n }\n if (mysql_errno(imp_dbh->pmysql))\n do_error(sth, mysql_errno(imp_dbh->pmysql),\n mysql_error(imp_dbh->pmysql),\n mysql_sqlstate(imp_dbh->pmysql));\n\n\n#if MYSQL_VERSION_ID >= MULTIPLE_RESULT_SET_VERSION\n if (!mysql_more_results(svsock))\n#endif\n dbd_st_finish(sth, imp_sth);\n return Nullav;\n }\n\n num_fields= mysql_num_fields(imp_sth->result);\n fields= mysql_fetch_fields(imp_sth->result);\n lengths= mysql_fetch_lengths(imp_sth->result);\n\n if ((av= DBIc_FIELDS_AV(imp_sth)) != Nullav)\n {\n av_length= av_len(av)+1;\n\n if (av_length != num_fields) /* Resize array if necessary */\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, size of results array(%d) != num_fields(%d)\\n\",\n av_length, num_fields);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, result fields(%d)\\n\",\n DBIc_NUM_FIELDS(imp_sth));\n\n av_readonly = SvREADONLY(av);\n\n if (av_readonly)\n SvREADONLY_off( av ); /* DBI sets this readonly */\n\n while (av_length < num_fields)\n {\n av_store(av, av_length++, newSV(0));\n }\n\n while (av_length > num_fields)\n {\n SvREFCNT_dec(av_pop(av));\n av_length--;\n }\n if (av_readonly)\n SvREADONLY_on(av);\n }\n }\n\n av= DBIc_DBISTATE(imp_sth)->get_fbav(imp_sth);\n\n for (i= 0; i < num_fields; ++i)\n {\n char *col= cols[i];\n SV *sv= AvARRAY(av)[i]; /* Note: we (re)use the SV in the AV\t*/\n\n if (col)\n {\n STRLEN len= lengths[i];\n if (ChopBlanks)\n {\n while (len && col[len-1] == ' ')\n {\t--len; }\n }\n\n /* Set string value returned from mysql server */\n sv_setpvn(sv, col, len);\n\n switch (mysql_to_perl_type(fields[i].type)) {\n case MYSQL_TYPE_DOUBLE:\n /* Coerce to dobule and set scalar as NV */\n (void) SvNV(sv);\n SvNOK_only(sv);\n break;\n\n case MYSQL_TYPE_LONG:\n case MYSQL_TYPE_LONGLONG:\n /* Coerce to integer and set scalar as UV resp. IV */\n if (fields[i].flags & UNSIGNED_FLAG)\n {\n (void) SvUV(sv);\n SvIOK_only_UV(sv);\n }\n else\n {\n (void) SvIV(sv);\n SvIOK_only(sv);\n }\n break;\n\n#if MYSQL_VERSION_ID > NEW_DATATYPE_VERSION\n case MYSQL_TYPE_BIT:\n /* Let it as binary string */\n break;\n#endif\n\n default:\n\t/* UTF8 */\n /*HELMUT*/\n#if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n\n /* see bottom of: http://www.mysql.org/doc/refman/5.0/en/c-api-datatypes.html */\n if ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && fields[i].charsetnr != 63)\n\t sv_utf8_decode(sv);\n#endif\n\t/* END OF UTF8 */\n break;\n }\n }\n else\n (void) SvOK_off(sv); /* Field is NULL, return undef */\n }\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, %d cols\\n\", num_fields);\n return av;\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n }\n#endif\n\n}","lang":"c","vul_type":"cwe-416","target_token_count":3485,"sven_meta":{"func_name":"dbd_st_fetch","file_name":"dbdimp.c","commit_link":"github.com/perl5-dbi/DBD-mysql/commit/3619c170461a3107a258d1fd2d00ed4832adb1b1","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#4-9262b517762c","input":"AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd,\n void *dummy,\n const char *arg)\n{\n const char *endp = ap_strrchr_c(arg, '>');\n const char *limited_methods;\n void *tog = cmd->cmd->cmd_data;\n apr_int64_t limited = 0;\n apr_int64_t old_limited = cmd->limited;\n const char *errmsg;\n\n if (endp == NULL) {\n return unclosed_directive(cmd);\n }\n\n limited_methods = apr_pstrmemdup(cmd->temp_pool, arg, endp - arg);\n\n if (!limited_methods[0]) {\n return missing_container_arg(cmd);\n }\n\n while (limited_methods[0]) {\n char *method = ap_getword_conf(cmd->temp_pool, &limited_methods);\n int methnum;\n\n /* check for builtin or module registered method number */\n methnum = ap_method_number_of(method);\n\n if (methnum == M_TRACE && !tog) {\n return \"TRACE cannot be controlled by , see TraceEnable\";\n }\n else if (methnum == M_INVALID) {\n /* method has not been registered yet, but resource restriction\n * is always checked before method handling, so register it.\n */\n methnum = ap_method_register(cmd->pool,\n apr_pstrdup(cmd->pool, method));\n }\n\n limited |= (AP_METHOD_BIT << methnum);\n }\n\n /* Killing two features with one function,\n * if (tog == NULL) , else \n */\n limited = tog ? ~limited : limited;\n\n if (!(old_limited & limited)) {\n return apr_pstrcat(cmd->pool, cmd->cmd->name,\n \"> directive excludes all methods\", NULL);\n }\n else if ((old_limited & limited) == old_limited) {\n return apr_pstrcat(cmd->pool, cmd->cmd->name,\n \"> directive specifies methods already excluded\",\n NULL);\n }\n\n cmd->limited &= limited;\n\n errmsg = ap_walk_config(cmd->directive->first_child, cmd, cmd->context);\n\n cmd->limited = old_limited;\n\n return errmsg;\n}","target":"AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd,\n void *dummy,\n const char *arg)\n{\n const char *endp = ap_strrchr_c(arg, '>');\n const char *limited_methods;\n void *tog = cmd->cmd->cmd_data;\n apr_int64_t limited = 0;\n apr_int64_t old_limited = cmd->limited;\n const char *errmsg;\n\n if (endp == NULL) {\n return unclosed_directive(cmd);\n }\n\n limited_methods = apr_pstrmemdup(cmd->temp_pool, arg, endp - arg);\n\n if (!limited_methods[0]) {\n return missing_container_arg(cmd);\n }\n\n while (limited_methods[0]) {\n char *method = ap_getword_conf(cmd->temp_pool, &limited_methods);\n int methnum;\n\n /* check for builtin or module registered method number */\n methnum = ap_method_number_of(method);\n\n if (methnum == M_TRACE && !tog) {\n return \"TRACE cannot be controlled by , see TraceEnable\";\n }\n else if (methnum == M_INVALID) {\n /* method has not been registered yet, but resource restriction\n * is always checked before method handling, so register it.\n */\n if (cmd->pool == cmd->temp_pool) {\n /* In .htaccess, we can't globally register new methods. */\n return apr_psprintf(cmd->pool, \"Could not register method '%s' \"\n \"for %s from .htaccess configuration\",\n method, cmd->cmd->name);\n }\n methnum = ap_method_register(cmd->pool,\n apr_pstrdup(cmd->pool, method));\n }\n\n limited |= (AP_METHOD_BIT << methnum);\n }\n\n /* Killing two features with one function,\n * if (tog == NULL) , else \n */\n limited = tog ? ~limited : limited;\n\n if (!(old_limited & limited)) {\n return apr_pstrcat(cmd->pool, cmd->cmd->name,\n \"> directive excludes all methods\", NULL);\n }\n else if ((old_limited & limited) == old_limited) {\n return apr_pstrcat(cmd->pool, cmd->cmd->name,\n \"> directive specifies methods already excluded\",\n NULL);\n }\n\n cmd->limited &= limited;\n\n errmsg = ap_walk_config(cmd->directive->first_child, cmd, cmd->context);\n\n cmd->limited = old_limited;\n\n return errmsg;\n}","lang":"c","vul_type":"cwe-416","target_token_count":539,"sven_meta":{"func_name":"ap_limit_section","file_name":"server/core.c","commit_link":"github.com/apache/httpd/commit/29afdd2550b3d30a8defece2b95ae81edcf66ac9","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#5-425877cf51e9","input":"static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)\n{\n\tint ret;\n\tstruct fd f;\n\tstruct sock *sock;\n\tstruct inode *inode;\n\tstruct mqueue_inode_info *info;\n\tstruct sk_buff *nc;\n\n\taudit_mq_notify(mqdes, notification);\n\n\tnc = NULL;\n\tsock = NULL;\n\tif (notification != NULL) {\n\t\tif (unlikely(notification->sigev_notify != SIGEV_NONE &&\n\t\t\t notification->sigev_notify != SIGEV_SIGNAL &&\n\t\t\t notification->sigev_notify != SIGEV_THREAD))\n\t\t\treturn -EINVAL;\n\t\tif (notification->sigev_notify == SIGEV_SIGNAL &&\n\t\t\t!valid_signal(notification->sigev_signo)) {\n\t\t\treturn -EINVAL;\n\t\t}\n\t\tif (notification->sigev_notify == SIGEV_THREAD) {\n\t\t\tlong timeo;\n\n\t\t\t/* create the notify skb */\n\t\t\tnc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL);\n\t\t\tif (!nc) {\n\t\t\t\tret = -ENOMEM;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tif (copy_from_user(nc->data,\n\t\t\t\t\tnotification->sigev_value.sival_ptr,\n\t\t\t\t\tNOTIFY_COOKIE_LEN)) {\n\t\t\t\tret = -EFAULT;\n\t\t\t\tgoto out;\n\t\t\t}\n\n\t\t\t/* TODO: add a header? */\n\t\t\tskb_put(nc, NOTIFY_COOKIE_LEN);\n\t\t\t/* and attach it to the socket */\nretry:\n\t\t\tf = fdget(notification->sigev_signo);\n\t\t\tif (!f.file) {\n\t\t\t\tret = -EBADF;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tsock = netlink_getsockbyfilp(f.file);\n\t\t\tfdput(f);\n\t\t\tif (IS_ERR(sock)) {\n\t\t\t\tret = PTR_ERR(sock);\n\t\t\t\tsock = NULL;\n\t\t\t\tgoto out;\n\t\t\t}\n\n\t\t\ttimeo = MAX_SCHEDULE_TIMEOUT;\n\t\t\tret = netlink_attachskb(sock, nc, &timeo, NULL);\n\t\t\tif (ret == 1)\n\t\t\t\tgoto retry;\n\t\t\tif (ret) {\n\t\t\t\tsock = NULL;\n\t\t\t\tnc = NULL;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t}\n\t}\n\n\tf = fdget(mqdes);\n\tif (!f.file) {\n\t\tret = -EBADF;\n\t\tgoto out;\n\t}\n\n\tinode = file_inode(f.file);\n\tif (unlikely(f.file->f_op != &mqueue_file_operations)) {\n\t\tret = -EBADF;\n\t\tgoto out_fput;\n\t}\n\tinfo = MQUEUE_I(inode);\n\n\tret = 0;\n\tspin_lock(&info->lock);\n\tif (notification == NULL) {\n\t\tif (info->notify_owner == task_tgid(current)) {\n\t\t\tremove_notification(info);\n\t\t\tinode->i_atime = inode->i_ctime = current_time(inode);\n\t\t}\n\t} else if (info->notify_owner != NULL) {\n\t\tret = -EBUSY;\n\t} else {\n\t\tswitch (notification->sigev_notify) {\n\t\tcase SIGEV_NONE:\n\t\t\tinfo->notify.sigev_notify = SIGEV_NONE;\n\t\t\tbreak;\n\t\tcase SIGEV_THREAD:\n\t\t\tinfo->notify_sock = sock;\n\t\t\tinfo->notify_cookie = nc;\n\t\t\tsock = NULL;\n\t\t\tnc = NULL;\n\t\t\tinfo->notify.sigev_notify = SIGEV_THREAD;\n\t\t\tbreak;\n\t\tcase SIGEV_SIGNAL:\n\t\t\tinfo->notify.sigev_signo = notification->sigev_signo;\n\t\t\tinfo->notify.sigev_value = notification->sigev_value;\n\t\t\tinfo->notify.sigev_notify = SIGEV_SIGNAL;\n\t\t\tbreak;\n\t\t}\n\n\t\tinfo->notify_owner = get_pid(task_tgid(current));\n\t\tinfo->notify_user_ns = get_user_ns(current_user_ns());\n\t\tinode->i_atime = inode->i_ctime = current_time(inode);\n\t}\n\tspin_unlock(&info->lock);\nout_fput:\n\tfdput(f);\nout:\n\tif (sock)\n\t\tnetlink_detachskb(sock, nc);\n\telse if (nc)\n\t\tdev_kfree_skb(nc);\n\n\treturn ret;\n}","target":"static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)\n{\n\tint ret;\n\tstruct fd f;\n\tstruct sock *sock;\n\tstruct inode *inode;\n\tstruct mqueue_inode_info *info;\n\tstruct sk_buff *nc;\n\n\taudit_mq_notify(mqdes, notification);\n\n\tnc = NULL;\n\tsock = NULL;\n\tif (notification != NULL) {\n\t\tif (unlikely(notification->sigev_notify != SIGEV_NONE &&\n\t\t\t notification->sigev_notify != SIGEV_SIGNAL &&\n\t\t\t notification->sigev_notify != SIGEV_THREAD))\n\t\t\treturn -EINVAL;\n\t\tif (notification->sigev_notify == SIGEV_SIGNAL &&\n\t\t\t!valid_signal(notification->sigev_signo)) {\n\t\t\treturn -EINVAL;\n\t\t}\n\t\tif (notification->sigev_notify == SIGEV_THREAD) {\n\t\t\tlong timeo;\n\n\t\t\t/* create the notify skb */\n\t\t\tnc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL);\n\t\t\tif (!nc) {\n\t\t\t\tret = -ENOMEM;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tif (copy_from_user(nc->data,\n\t\t\t\t\tnotification->sigev_value.sival_ptr,\n\t\t\t\t\tNOTIFY_COOKIE_LEN)) {\n\t\t\t\tret = -EFAULT;\n\t\t\t\tgoto out;\n\t\t\t}\n\n\t\t\t/* TODO: add a header? */\n\t\t\tskb_put(nc, NOTIFY_COOKIE_LEN);\n\t\t\t/* and attach it to the socket */\nretry:\n\t\t\tf = fdget(notification->sigev_signo);\n\t\t\tif (!f.file) {\n\t\t\t\tret = -EBADF;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tsock = netlink_getsockbyfilp(f.file);\n\t\t\tfdput(f);\n\t\t\tif (IS_ERR(sock)) {\n\t\t\t\tret = PTR_ERR(sock);\n\t\t\t\tsock = NULL;\n\t\t\t\tgoto out;\n\t\t\t}\n\n\t\t\ttimeo = MAX_SCHEDULE_TIMEOUT;\n\t\t\tret = netlink_attachskb(sock, nc, &timeo, NULL);\n\t\t\tif (ret == 1) {\n\t\t\t\tsock = NULL;\n\t\t\t\tgoto retry;\n\t\t\t}\n\t\t\tif (ret) {\n\t\t\t\tsock = NULL;\n\t\t\t\tnc = NULL;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t}\n\t}\n\n\tf = fdget(mqdes);\n\tif (!f.file) {\n\t\tret = -EBADF;\n\t\tgoto out;\n\t}\n\n\tinode = file_inode(f.file);\n\tif (unlikely(f.file->f_op != &mqueue_file_operations)) {\n\t\tret = -EBADF;\n\t\tgoto out_fput;\n\t}\n\tinfo = MQUEUE_I(inode);\n\n\tret = 0;\n\tspin_lock(&info->lock);\n\tif (notification == NULL) {\n\t\tif (info->notify_owner == task_tgid(current)) {\n\t\t\tremove_notification(info);\n\t\t\tinode->i_atime = inode->i_ctime = current_time(inode);\n\t\t}\n\t} else if (info->notify_owner != NULL) {\n\t\tret = -EBUSY;\n\t} else {\n\t\tswitch (notification->sigev_notify) {\n\t\tcase SIGEV_NONE:\n\t\t\tinfo->notify.sigev_notify = SIGEV_NONE;\n\t\t\tbreak;\n\t\tcase SIGEV_THREAD:\n\t\t\tinfo->notify_sock = sock;\n\t\t\tinfo->notify_cookie = nc;\n\t\t\tsock = NULL;\n\t\t\tnc = NULL;\n\t\t\tinfo->notify.sigev_notify = SIGEV_THREAD;\n\t\t\tbreak;\n\t\tcase SIGEV_SIGNAL:\n\t\t\tinfo->notify.sigev_signo = notification->sigev_signo;\n\t\t\tinfo->notify.sigev_value = notification->sigev_value;\n\t\t\tinfo->notify.sigev_notify = SIGEV_SIGNAL;\n\t\t\tbreak;\n\t\t}\n\n\t\tinfo->notify_owner = get_pid(task_tgid(current));\n\t\tinfo->notify_user_ns = get_user_ns(current_user_ns());\n\t\tinode->i_atime = inode->i_ctime = current_time(inode);\n\t}\n\tspin_unlock(&info->lock);\nout_fput:\n\tfdput(f);\nout:\n\tif (sock)\n\t\tnetlink_detachskb(sock, nc);\n\telse if (nc)\n\t\tdev_kfree_skb(nc);\n\n\treturn ret;\n}","lang":"c","vul_type":"cwe-416","target_token_count":824,"sven_meta":{"func_name":"do_mq_notify","file_name":"ipc/mqueue.c","commit_link":"github.com/torvalds/linux/commit/f991af3daabaecff34684fd51fac80319d1baad1","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#8-baaf9cd04744","input":"int wwunpack(uint8_t *exe, uint32_t exesz, uint8_t *wwsect, struct cli_exe_section *sects, uint16_t scount, uint32_t pe, int desc) {\n uint8_t *structs = wwsect + 0x2a1, *compd, *ccur, *unpd, *ucur, bc;\n uint32_t src, srcend, szd, bt, bits;\n int error=0, i;\n\n cli_dbgmsg(\"in wwunpack\\n\");\n while (1) {\n if (!CLI_ISCONTAINED(wwsect, sects[scount].rsz, structs, 17)) {\n cli_dbgmsg(\"WWPack: Array of structs out of section\\n\");\n break;\n }\n src = sects[scount].rva - cli_readint32(structs); /* src delta / dst delta - not used / dwords / end of src */\n structs+=8;\n szd = cli_readint32(structs) * 4;\n structs+=4;\n srcend = cli_readint32(structs);\n structs+=4;\n\n unpd = ucur = exe+src+srcend+4-szd;\n if (!szd || !CLI_ISCONTAINED(exe, exesz, unpd, szd)) {\n cli_dbgmsg(\"WWPack: Compressed data out of file\\n\");\n break;\n }\n cli_dbgmsg(\"WWP: src: %x, szd: %x, srcend: %x - %x\\n\", src, szd, srcend, srcend+4-szd);\n if (!(compd = cli_malloc(szd))) {\n cli_dbgmsg(\"WWPack: Unable to allocate memory for compd\\n\");\n break;\n }\n memcpy(compd, unpd, szd);\n memset(unpd, -1, szd); /*FIXME*/\n ccur=compd;\n \n RESEED;\n while(!error) {\n uint32_t backbytes, backsize;\n uint8_t saved;\n\n BIT;\n if (!bits) { /* BYTE copy */\n\tif(ccur-compd>=szd || !CLI_ISCONTAINED(exe, exesz, ucur, 1))\n\t error=1;\n\telse\n\t *ucur++=*ccur++;\n\tcontinue;\n }\n\n BITS(2);\n if(bits==3) { /* WORD backcopy */\n\tuint8_t shifted, subbed = 31;\n\tBITS(2);\n\tshifted = bits + 5;\n\tif(bits>=2) {\n\t shifted++;\n\t subbed += 0x80;\n\t}\n\tbackbytes = (1< exesz || pe+7 > exesz || pe+0x28 > exesz ||\n\t\tpe+0x50 > exesz || pe+0x14 > exesz) \n\treturn CL_EFORMAT;\n exe[pe+6]=(uint8_t)scount;\n exe[pe+7]=(uint8_t)(scount>>8);\n cli_writeint32(&exe[pe+0x28], cli_readint32(wwsect+0x295)+sects[scount].rva+0x299);\n cli_writeint32(&exe[pe+0x50], cli_readint32(&exe[pe+0x50])-sects[scount].vsz);\n\n structs = &exe[(0xffff&cli_readint32(&exe[pe+0x14]))+pe+0x18];\n for(i=0 ; i=szd || !CLI_ISCONTAINED(exe, exesz, ucur, 1))\n\t error=1;\n\telse\n\t *ucur++=*ccur++;\n\tcontinue;\n }\n\n BITS(2);\n if(bits==3) { /* WORD backcopy */\n\tuint8_t shifted, subbed = 31;\n\tBITS(2);\n\tshifted = bits + 5;\n\tif(bits>=2) {\n\t shifted++;\n\t subbed += 0x80;\n\t}\n\tbackbytes = (1< exesz || pe+7 > exesz || pe+0x28 > exesz ||\n\t\tpe+0x50 > exesz || pe+0x14 > exesz) \n\treturn CL_EFORMAT;\n exe[pe+6]=(uint8_t)scount;\n exe[pe+7]=(uint8_t)(scount>>8);\n if (!CLI_ISCONTAINED(wwsect, sects[scount].rsz, wwsect+0x295, 4) ||\n !CLI_ISCONTAINED(wwsect, sects[scount].rsz, wwsect+0x295+sects[scount].rva, 4) ||\n !CLI_ISCONTAINED(wwsect, sects[scount].rsz, wwsect+0x295+sects[scount].rva+0x299, 4)) {\n cli_dbgmsg(\"WWPack: unpack memory address out of bounds.\\n\");\n return CL_EFORMAT;\n }\n cli_writeint32(&exe[pe+0x28], cli_readint32(wwsect+0x295)+sects[scount].rva+0x299);\n cli_writeint32(&exe[pe+0x50], cli_readint32(&exe[pe+0x50])-sects[scount].vsz);\n\n structs = &exe[(0xffff&cli_readint32(&exe[pe+0x14]))+pe+0x18];\n for(i=0 ; itlx = 0;\n\tcmpt->tly = 0;\n\tcmpt->sampperx = 0;\n\tcmpt->samppery = 0;\n\tcmpt->width = 0;\n\tcmpt->height = 0;\n\tcmpt->prec = 0;\n\tcmpt->sgnd = -1;\n\tcmpt->data = 0;\n\n\tif (!(tvp = jas_tvparser_create(buf))) {\n\t\tgoto error;\n\t}\n\twhile (!(id = jas_tvparser_next(tvp))) {\n\t\tswitch (jas_taginfo_nonull(jas_taginfos_lookup(mif_tags,\n\t\t jas_tvparser_gettag(tvp)))->id) {\n\t\tcase MIF_TLX:\n\t\t\tcmpt->tlx = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_TLY:\n\t\t\tcmpt->tly = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_WIDTH:\n\t\t\tcmpt->width = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_HEIGHT:\n\t\t\tcmpt->height = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_HSAMP:\n\t\t\tcmpt->sampperx = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_VSAMP:\n\t\t\tcmpt->samppery = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_PREC:\n\t\t\tcmpt->prec = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_SGND:\n\t\t\tcmpt->sgnd = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_DATA:\n\t\t\tif (!(cmpt->data = jas_strdup(jas_tvparser_getval(tvp)))) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\tjas_tvparser_destroy(tvp);\n\tif (!cmpt->sampperx || !cmpt->samppery) {\n\t\tgoto error;\n\t}\n\tif (mif_hdr_addcmpt(hdr, hdr->numcmpts, cmpt)) {\n\t\tgoto error;\n\t}\n\treturn 0;\n\nerror:\n\tif (cmpt) {\n\t\tmif_cmpt_destroy(cmpt);\n\t}\n\tif (tvp) {\n\t\tjas_tvparser_destroy(tvp);\n\t}\n\treturn -1;\n}","target":"static int mif_process_cmpt(mif_hdr_t *hdr, char *buf)\n{\n\tjas_tvparser_t *tvp;\n\tmif_cmpt_t *cmpt;\n\tint id;\n\n\tcmpt = 0;\n\ttvp = 0;\n\n\tif (!(cmpt = mif_cmpt_create())) {\n\t\tgoto error;\n\t}\n\tcmpt->tlx = 0;\n\tcmpt->tly = 0;\n\tcmpt->sampperx = 0;\n\tcmpt->samppery = 0;\n\tcmpt->width = 0;\n\tcmpt->height = 0;\n\tcmpt->prec = 0;\n\tcmpt->sgnd = -1;\n\tcmpt->data = 0;\n\n\tif (!(tvp = jas_tvparser_create(buf))) {\n\t\tgoto error;\n\t}\n\twhile (!(id = jas_tvparser_next(tvp))) {\n\t\tswitch (jas_taginfo_nonull(jas_taginfos_lookup(mif_tags,\n\t\t jas_tvparser_gettag(tvp)))->id) {\n\t\tcase MIF_TLX:\n\t\t\tcmpt->tlx = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_TLY:\n\t\t\tcmpt->tly = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_WIDTH:\n\t\t\tcmpt->width = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_HEIGHT:\n\t\t\tcmpt->height = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_HSAMP:\n\t\t\tcmpt->sampperx = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_VSAMP:\n\t\t\tcmpt->samppery = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_PREC:\n\t\t\tcmpt->prec = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_SGND:\n\t\t\tcmpt->sgnd = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_DATA:\n\t\t\tif (!(cmpt->data = jas_strdup(jas_tvparser_getval(tvp)))) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!cmpt->sampperx || !cmpt->samppery) {\n\t\tgoto error;\n\t}\n\tif (mif_hdr_addcmpt(hdr, hdr->numcmpts, cmpt)) {\n\t\tgoto error;\n\t}\n\tjas_tvparser_destroy(tvp);\n\treturn 0;\n\nerror:\n\tif (cmpt) {\n\t\tmif_cmpt_destroy(cmpt);\n\t}\n\tif (tvp) {\n\t\tjas_tvparser_destroy(tvp);\n\t}\n\treturn -1;\n}","lang":"c","vul_type":"cwe-416","target_token_count":574,"sven_meta":{"func_name":"mif_process_cmpt","file_name":"src/libjasper/mif/mif_cod.c","commit_link":"github.com/mdadams/jasper/commit/df5d2867e8004e51e18b89865bc4aa69229227b3","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#17-81092e48d8c0","input":"CURLcode Curl_close(struct Curl_easy *data)\n{\n struct Curl_multi *m;\n\n if(!data)\n return CURLE_OK;\n\n Curl_expire_clear(data); /* shut off timers */\n\n m = data->multi;\n if(m)\n /* This handle is still part of a multi handle, take care of this first\n and detach this handle from there. */\n curl_multi_remove_handle(data->multi, data);\n\n if(data->multi_easy)\n /* when curl_easy_perform() is used, it creates its own multi handle to\n use and this is the one */\n curl_multi_cleanup(data->multi_easy);\n\n /* Destroy the timeout list that is held in the easy handle. It is\n /normally/ done by curl_multi_remove_handle() but this is \"just in\n case\" */\n Curl_llist_destroy(&data->state.timeoutlist, NULL);\n\n data->magic = 0; /* force a clear AFTER the possibly enforced removal from\n the multi handle, since that function uses the magic\n field! */\n\n if(data->state.rangestringalloc)\n free(data->state.range);\n\n /* freed here just in case DONE wasn't called */\n Curl_free_request_state(data);\n\n /* Close down all open SSL info and sessions */\n Curl_ssl_close_all(data);\n Curl_safefree(data->state.first_host);\n Curl_safefree(data->state.scratch);\n Curl_ssl_free_certinfo(data);\n\n /* Cleanup possible redirect junk */\n free(data->req.newurl);\n data->req.newurl = NULL;\n\n if(data->change.referer_alloc) {\n Curl_safefree(data->change.referer);\n data->change.referer_alloc = FALSE;\n }\n data->change.referer = NULL;\n\n Curl_up_free(data);\n Curl_safefree(data->state.buffer);\n Curl_safefree(data->state.headerbuff);\n Curl_safefree(data->state.ulbuf);\n Curl_flush_cookies(data, 1);\n Curl_digest_cleanup(data);\n Curl_safefree(data->info.contenttype);\n Curl_safefree(data->info.wouldredirect);\n\n /* this destroys the channel and we cannot use it anymore after this */\n Curl_resolver_cleanup(data->state.resolver);\n\n Curl_http2_cleanup_dependencies(data);\n Curl_convert_close(data);\n\n /* No longer a dirty share, if it exists */\n if(data->share) {\n Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);\n data->share->dirty--;\n Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);\n }\n\n /* destruct wildcard structures if it is needed */\n Curl_wildcard_dtor(&data->wildcard);\n Curl_freeset(data);\n free(data);\n return CURLE_OK;\n}","target":"CURLcode Curl_close(struct Curl_easy *data)\n{\n struct Curl_multi *m;\n\n if(!data)\n return CURLE_OK;\n\n Curl_expire_clear(data); /* shut off timers */\n\n m = data->multi;\n if(m)\n /* This handle is still part of a multi handle, take care of this first\n and detach this handle from there. */\n curl_multi_remove_handle(data->multi, data);\n\n if(data->multi_easy) {\n /* when curl_easy_perform() is used, it creates its own multi handle to\n use and this is the one */\n curl_multi_cleanup(data->multi_easy);\n data->multi_easy = NULL;\n }\n\n /* Destroy the timeout list that is held in the easy handle. It is\n /normally/ done by curl_multi_remove_handle() but this is \"just in\n case\" */\n Curl_llist_destroy(&data->state.timeoutlist, NULL);\n\n data->magic = 0; /* force a clear AFTER the possibly enforced removal from\n the multi handle, since that function uses the magic\n field! */\n\n if(data->state.rangestringalloc)\n free(data->state.range);\n\n /* freed here just in case DONE wasn't called */\n Curl_free_request_state(data);\n\n /* Close down all open SSL info and sessions */\n Curl_ssl_close_all(data);\n Curl_safefree(data->state.first_host);\n Curl_safefree(data->state.scratch);\n Curl_ssl_free_certinfo(data);\n\n /* Cleanup possible redirect junk */\n free(data->req.newurl);\n data->req.newurl = NULL;\n\n if(data->change.referer_alloc) {\n Curl_safefree(data->change.referer);\n data->change.referer_alloc = FALSE;\n }\n data->change.referer = NULL;\n\n Curl_up_free(data);\n Curl_safefree(data->state.buffer);\n Curl_safefree(data->state.headerbuff);\n Curl_safefree(data->state.ulbuf);\n Curl_flush_cookies(data, 1);\n Curl_digest_cleanup(data);\n Curl_safefree(data->info.contenttype);\n Curl_safefree(data->info.wouldredirect);\n\n /* this destroys the channel and we cannot use it anymore after this */\n Curl_resolver_cleanup(data->state.resolver);\n\n Curl_http2_cleanup_dependencies(data);\n Curl_convert_close(data);\n\n /* No longer a dirty share, if it exists */\n if(data->share) {\n Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);\n data->share->dirty--;\n Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);\n }\n\n /* destruct wildcard structures if it is needed */\n Curl_wildcard_dtor(&data->wildcard);\n Curl_freeset(data);\n free(data);\n return CURLE_OK;\n}","lang":"c","vul_type":"cwe-416","target_token_count":605,"sven_meta":{"func_name":"Curl_close","file_name":"lib/url.c","commit_link":"github.com/curl/curl/commit/81d135d67155c5295b1033679c606165d4e28f3f","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#20-1e72969746fc","input":"PHP_MINIT_FUNCTION(spl_array)\n{\n\tREGISTER_SPL_STD_CLASS_EX(ArrayObject, spl_array_object_new, spl_funcs_ArrayObject);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Serializable);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Countable);\n\tmemcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers));\n\n\tspl_handler_ArrayObject.clone_obj = spl_array_object_clone;\n\tspl_handler_ArrayObject.read_dimension = spl_array_read_dimension;\n\tspl_handler_ArrayObject.write_dimension = spl_array_write_dimension;\n\tspl_handler_ArrayObject.unset_dimension = spl_array_unset_dimension;\n\tspl_handler_ArrayObject.has_dimension = spl_array_has_dimension;\n\tspl_handler_ArrayObject.count_elements = spl_array_object_count_elements;\n\n\tspl_handler_ArrayObject.get_properties = spl_array_get_properties;\n\tspl_handler_ArrayObject.get_debug_info = spl_array_get_debug_info;\n\tspl_handler_ArrayObject.get_gc = spl_array_get_gc;\n\tspl_handler_ArrayObject.read_property = spl_array_read_property;\n\tspl_handler_ArrayObject.write_property = spl_array_write_property;\n\tspl_handler_ArrayObject.get_property_ptr_ptr = spl_array_get_property_ptr_ptr;\n\tspl_handler_ArrayObject.has_property = spl_array_has_property;\n\tspl_handler_ArrayObject.unset_property = spl_array_unset_property;\n\n\tspl_handler_ArrayObject.compare_objects = spl_array_compare_objects;\n\n\tREGISTER_SPL_STD_CLASS_EX(ArrayIterator, spl_array_object_new, spl_funcs_ArrayIterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Iterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Serializable);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable);\n\tmemcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers));\n\tspl_ce_ArrayIterator->get_iterator = spl_array_get_iterator;\n\n\tREGISTER_SPL_SUB_CLASS_EX(RecursiveArrayIterator, ArrayIterator, spl_array_object_new, spl_funcs_RecursiveArrayIterator);\n\tREGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator);\n\tspl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator;\n\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayObject, \"STD_PROP_LIST\", SPL_ARRAY_STD_PROP_LIST);\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayObject, \"ARRAY_AS_PROPS\", SPL_ARRAY_ARRAY_AS_PROPS);\n\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, \"STD_PROP_LIST\", SPL_ARRAY_STD_PROP_LIST);\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, \"ARRAY_AS_PROPS\", SPL_ARRAY_ARRAY_AS_PROPS);\n\n\tREGISTER_SPL_CLASS_CONST_LONG(RecursiveArrayIterator, \"CHILD_ARRAYS_ONLY\", SPL_ARRAY_CHILD_ARRAYS_ONLY);\n\n\treturn SUCCESS;\n}","target":"PHP_MINIT_FUNCTION(spl_array)\n{\n\tREGISTER_SPL_STD_CLASS_EX(ArrayObject, spl_array_object_new, spl_funcs_ArrayObject);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Serializable);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Countable);\n\tmemcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers));\n\n\tspl_handler_ArrayObject.clone_obj = spl_array_object_clone;\n\tspl_handler_ArrayObject.read_dimension = spl_array_read_dimension;\n\tspl_handler_ArrayObject.write_dimension = spl_array_write_dimension;\n\tspl_handler_ArrayObject.unset_dimension = spl_array_unset_dimension;\n\tspl_handler_ArrayObject.has_dimension = spl_array_has_dimension;\n\tspl_handler_ArrayObject.count_elements = spl_array_object_count_elements;\n\n\tspl_handler_ArrayObject.get_properties = spl_array_get_properties;\n\tspl_handler_ArrayObject.get_debug_info = spl_array_get_debug_info;\n\tspl_handler_ArrayObject.get_gc = spl_array_get_gc;\n\tspl_handler_ArrayObject.read_property = spl_array_read_property;\n\tspl_handler_ArrayObject.write_property = spl_array_write_property;\n\tspl_handler_ArrayObject.get_property_ptr_ptr = spl_array_get_property_ptr_ptr;\n\tspl_handler_ArrayObject.has_property = spl_array_has_property;\n\tspl_handler_ArrayObject.unset_property = spl_array_unset_property;\n\n\tspl_handler_ArrayObject.compare_objects = spl_array_compare_objects;\n\n\tREGISTER_SPL_STD_CLASS_EX(ArrayIterator, spl_array_object_new, spl_funcs_ArrayIterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Iterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Serializable);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable);\n\tmemcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers));\n\tspl_ce_ArrayIterator->get_iterator = spl_array_get_iterator;\n\n\tREGISTER_SPL_SUB_CLASS_EX(RecursiveArrayIterator, ArrayIterator, spl_array_object_new, spl_funcs_RecursiveArrayIterator);\n\tREGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator);\n\tspl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator;\n\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayObject, \"STD_PROP_LIST\", SPL_ARRAY_STD_PROP_LIST);\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayObject, \"ARRAY_AS_PROPS\", SPL_ARRAY_ARRAY_AS_PROPS);\n\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, \"STD_PROP_LIST\", SPL_ARRAY_STD_PROP_LIST);\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, \"ARRAY_AS_PROPS\", SPL_ARRAY_ARRAY_AS_PROPS);\n\n\tREGISTER_SPL_CLASS_CONST_LONG(RecursiveArrayIterator, \"CHILD_ARRAYS_ONLY\", SPL_ARRAY_CHILD_ARRAYS_ONLY);\n\n\treturn SUCCESS;\n}","lang":"c","vul_type":"cwe-416","target_token_count":600,"sven_meta":{"func_name":"PHP_MINIT_FUNCTION","file_name":"ext/spl/spl_array.c","commit_link":"github.com/php/php-src/commit/3f627e580acfdaf0595ae3b115b8bec677f203ee?w=1","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#21-b37ea06419b0","input":"static long do_get_mempolicy(int *policy, nodemask_t *nmask,\n\t\t\t unsigned long addr, unsigned long flags)\n{\n\tint err;\n\tstruct mm_struct *mm = current->mm;\n\tstruct vm_area_struct *vma = NULL;\n\tstruct mempolicy *pol = current->mempolicy;\n\n\tif (flags &\n\t\t~(unsigned long)(MPOL_F_NODE|MPOL_F_ADDR|MPOL_F_MEMS_ALLOWED))\n\t\treturn -EINVAL;\n\n\tif (flags & MPOL_F_MEMS_ALLOWED) {\n\t\tif (flags & (MPOL_F_NODE|MPOL_F_ADDR))\n\t\t\treturn -EINVAL;\n\t\t*policy = 0;\t/* just so it's initialized */\n\t\ttask_lock(current);\n\t\t*nmask = cpuset_current_mems_allowed;\n\t\ttask_unlock(current);\n\t\treturn 0;\n\t}\n\n\tif (flags & MPOL_F_ADDR) {\n\t\t/*\n\t\t * Do NOT fall back to task policy if the\n\t\t * vma/shared policy at addr is NULL. We\n\t\t * want to return MPOL_DEFAULT in this case.\n\t\t */\n\t\tdown_read(&mm->mmap_sem);\n\t\tvma = find_vma_intersection(mm, addr, addr+1);\n\t\tif (!vma) {\n\t\t\tup_read(&mm->mmap_sem);\n\t\t\treturn -EFAULT;\n\t\t}\n\t\tif (vma->vm_ops && vma->vm_ops->get_policy)\n\t\t\tpol = vma->vm_ops->get_policy(vma, addr);\n\t\telse\n\t\t\tpol = vma->vm_policy;\n\t} else if (addr)\n\t\treturn -EINVAL;\n\n\tif (!pol)\n\t\tpol = &default_policy;\t/* indicates default behavior */\n\n\tif (flags & MPOL_F_NODE) {\n\t\tif (flags & MPOL_F_ADDR) {\n\t\t\terr = lookup_node(addr);\n\t\t\tif (err < 0)\n\t\t\t\tgoto out;\n\t\t\t*policy = err;\n\t\t} else if (pol == current->mempolicy &&\n\t\t\t\tpol->mode == MPOL_INTERLEAVE) {\n\t\t\t*policy = next_node_in(current->il_prev, pol->v.nodes);\n\t\t} else {\n\t\t\terr = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t} else {\n\t\t*policy = pol == &default_policy ? MPOL_DEFAULT :\n\t\t\t\t\t\tpol->mode;\n\t\t/*\n\t\t * Internal mempolicy flags must be masked off before exposing\n\t\t * the policy to userspace.\n\t\t */\n\t\t*policy |= (pol->flags & MPOL_MODE_FLAGS);\n\t}\n\n\tif (vma) {\n\t\tup_read(¤t->mm->mmap_sem);\n\t\tvma = NULL;\n\t}\n\n\terr = 0;\n\tif (nmask) {\n\t\tif (mpol_store_user_nodemask(pol)) {\n\t\t\t*nmask = pol->w.user_nodemask;\n\t\t} else {\n\t\t\ttask_lock(current);\n\t\t\tget_policy_nodemask(pol, nmask);\n\t\t\ttask_unlock(current);\n\t\t}\n\t}\n\n out:\n\tmpol_cond_put(pol);\n\tif (vma)\n\t\tup_read(¤t->mm->mmap_sem);\n\treturn err;\n}","target":"static long do_get_mempolicy(int *policy, nodemask_t *nmask,\n\t\t\t unsigned long addr, unsigned long flags)\n{\n\tint err;\n\tstruct mm_struct *mm = current->mm;\n\tstruct vm_area_struct *vma = NULL;\n\tstruct mempolicy *pol = current->mempolicy;\n\n\tif (flags &\n\t\t~(unsigned long)(MPOL_F_NODE|MPOL_F_ADDR|MPOL_F_MEMS_ALLOWED))\n\t\treturn -EINVAL;\n\n\tif (flags & MPOL_F_MEMS_ALLOWED) {\n\t\tif (flags & (MPOL_F_NODE|MPOL_F_ADDR))\n\t\t\treturn -EINVAL;\n\t\t*policy = 0;\t/* just so it's initialized */\n\t\ttask_lock(current);\n\t\t*nmask = cpuset_current_mems_allowed;\n\t\ttask_unlock(current);\n\t\treturn 0;\n\t}\n\n\tif (flags & MPOL_F_ADDR) {\n\t\t/*\n\t\t * Do NOT fall back to task policy if the\n\t\t * vma/shared policy at addr is NULL. We\n\t\t * want to return MPOL_DEFAULT in this case.\n\t\t */\n\t\tdown_read(&mm->mmap_sem);\n\t\tvma = find_vma_intersection(mm, addr, addr+1);\n\t\tif (!vma) {\n\t\t\tup_read(&mm->mmap_sem);\n\t\t\treturn -EFAULT;\n\t\t}\n\t\tif (vma->vm_ops && vma->vm_ops->get_policy)\n\t\t\tpol = vma->vm_ops->get_policy(vma, addr);\n\t\telse\n\t\t\tpol = vma->vm_policy;\n\t} else if (addr)\n\t\treturn -EINVAL;\n\n\tif (!pol)\n\t\tpol = &default_policy;\t/* indicates default behavior */\n\n\tif (flags & MPOL_F_NODE) {\n\t\tif (flags & MPOL_F_ADDR) {\n\t\t\terr = lookup_node(addr);\n\t\t\tif (err < 0)\n\t\t\t\tgoto out;\n\t\t\t*policy = err;\n\t\t} else if (pol == current->mempolicy &&\n\t\t\t\tpol->mode == MPOL_INTERLEAVE) {\n\t\t\t*policy = next_node_in(current->il_prev, pol->v.nodes);\n\t\t} else {\n\t\t\terr = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t} else {\n\t\t*policy = pol == &default_policy ? MPOL_DEFAULT :\n\t\t\t\t\t\tpol->mode;\n\t\t/*\n\t\t * Internal mempolicy flags must be masked off before exposing\n\t\t * the policy to userspace.\n\t\t */\n\t\t*policy |= (pol->flags & MPOL_MODE_FLAGS);\n\t}\n\n\terr = 0;\n\tif (nmask) {\n\t\tif (mpol_store_user_nodemask(pol)) {\n\t\t\t*nmask = pol->w.user_nodemask;\n\t\t} else {\n\t\t\ttask_lock(current);\n\t\t\tget_policy_nodemask(pol, nmask);\n\t\t\ttask_unlock(current);\n\t\t}\n\t}\n\n out:\n\tmpol_cond_put(pol);\n\tif (vma)\n\t\tup_read(¤t->mm->mmap_sem);\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","target_token_count":634,"sven_meta":{"func_name":"do_get_mempolicy","file_name":"mm/mempolicy.c","commit_link":"github.com/torvalds/linux/commit/73223e4e2e3867ebf033a5a8eb2e5df0158ccc99","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#24-e19cb1ec270e","input":"static int usb_console_setup(struct console *co, char *options)\n{\n\tstruct usbcons_info *info = &usbcons_info;\n\tint baud = 9600;\n\tint bits = 8;\n\tint parity = 'n';\n\tint doflow = 0;\n\tint cflag = CREAD | HUPCL | CLOCAL;\n\tchar *s;\n\tstruct usb_serial *serial;\n\tstruct usb_serial_port *port;\n\tint retval;\n\tstruct tty_struct *tty = NULL;\n\tstruct ktermios dummy;\n\n\tif (options) {\n\t\tbaud = simple_strtoul(options, NULL, 10);\n\t\ts = options;\n\t\twhile (*s >= '0' && *s <= '9')\n\t\t\ts++;\n\t\tif (*s)\n\t\t\tparity = *s++;\n\t\tif (*s)\n\t\t\tbits = *s++ - '0';\n\t\tif (*s)\n\t\t\tdoflow = (*s++ == 'r');\n\t}\n\t\n\t/* Sane default */\n\tif (baud == 0)\n\t\tbaud = 9600;\n\n\tswitch (bits) {\n\tcase 7:\n\t\tcflag |= CS7;\n\t\tbreak;\n\tdefault:\n\tcase 8:\n\t\tcflag |= CS8;\n\t\tbreak;\n\t}\n\tswitch (parity) {\n\tcase 'o': case 'O':\n\t\tcflag |= PARODD;\n\t\tbreak;\n\tcase 'e': case 'E':\n\t\tcflag |= PARENB;\n\t\tbreak;\n\t}\n\tco->cflag = cflag;\n\n\t/*\n\t * no need to check the index here: if the index is wrong, console\n\t * code won't call us\n\t */\n\tport = usb_serial_port_get_by_minor(co->index);\n\tif (port == NULL) {\n\t\t/* no device is connected yet, sorry :( */\n\t\tpr_err(\"No USB device connected to ttyUSB%i\\n\", co->index);\n\t\treturn -ENODEV;\n\t}\n\tserial = port->serial;\n\n\tretval = usb_autopm_get_interface(serial->interface);\n\tif (retval)\n\t\tgoto error_get_interface;\n\n\ttty_port_tty_set(&port->port, NULL);\n\n\tinfo->port = port;\n\n\t++port->port.count;\n\tif (!tty_port_initialized(&port->port)) {\n\t\tif (serial->type->set_termios) {\n\t\t\t/*\n\t\t\t * allocate a fake tty so the driver can initialize\n\t\t\t * the termios structure, then later call set_termios to\n\t\t\t * configure according to command line arguments\n\t\t\t */\n\t\t\ttty = kzalloc(sizeof(*tty), GFP_KERNEL);\n\t\t\tif (!tty) {\n\t\t\t\tretval = -ENOMEM;\n\t\t\t\tgoto reset_open_count;\n\t\t\t}\n\t\t\tkref_init(&tty->kref);\n\t\t\ttty->driver = usb_serial_tty_driver;\n\t\t\ttty->index = co->index;\n\t\t\tinit_ldsem(&tty->ldisc_sem);\n\t\t\tspin_lock_init(&tty->files_lock);\n\t\t\tINIT_LIST_HEAD(&tty->tty_files);\n\t\t\tkref_get(&tty->driver->kref);\n\t\t\t__module_get(tty->driver->owner);\n\t\t\ttty->ops = &usb_console_fake_tty_ops;\n\t\t\ttty_init_termios(tty);\n\t\t\ttty_port_tty_set(&port->port, tty);\n\t\t}\n\n\t\t/* only call the device specific open if this\n\t\t * is the first time the port is opened */\n\t\tretval = serial->type->open(NULL, port);\n\t\tif (retval) {\n\t\t\tdev_err(&port->dev, \"could not open USB console port\\n\");\n\t\t\tgoto fail;\n\t\t}\n\n\t\tif (serial->type->set_termios) {\n\t\t\ttty->termios.c_cflag = cflag;\n\t\t\ttty_termios_encode_baud_rate(&tty->termios, baud, baud);\n\t\t\tmemset(&dummy, 0, sizeof(struct ktermios));\n\t\t\tserial->type->set_termios(tty, port, &dummy);\n\n\t\t\ttty_port_tty_set(&port->port, NULL);\n\t\t\ttty_kref_put(tty);\n\t\t}\n\t\ttty_port_set_initialized(&port->port, 1);\n\t}\n\t/* Now that any required fake tty operations are completed restore\n\t * the tty port count */\n\t--port->port.count;\n\t/* The console is special in terms of closing the device so\n\t * indicate this port is now acting as a system console. */\n\tport->port.console = 1;\n\n\tmutex_unlock(&serial->disc_mutex);\n\treturn retval;\n\n fail:\n\ttty_port_tty_set(&port->port, NULL);\n\ttty_kref_put(tty);\n reset_open_count:\n\tport->port.count = 0;\n\tusb_autopm_put_interface(serial->interface);\n error_get_interface:\n\tusb_serial_put(serial);\n\tmutex_unlock(&serial->disc_mutex);\n\treturn retval;\n}","target":"static int usb_console_setup(struct console *co, char *options)\n{\n\tstruct usbcons_info *info = &usbcons_info;\n\tint baud = 9600;\n\tint bits = 8;\n\tint parity = 'n';\n\tint doflow = 0;\n\tint cflag = CREAD | HUPCL | CLOCAL;\n\tchar *s;\n\tstruct usb_serial *serial;\n\tstruct usb_serial_port *port;\n\tint retval;\n\tstruct tty_struct *tty = NULL;\n\tstruct ktermios dummy;\n\n\tif (options) {\n\t\tbaud = simple_strtoul(options, NULL, 10);\n\t\ts = options;\n\t\twhile (*s >= '0' && *s <= '9')\n\t\t\ts++;\n\t\tif (*s)\n\t\t\tparity = *s++;\n\t\tif (*s)\n\t\t\tbits = *s++ - '0';\n\t\tif (*s)\n\t\t\tdoflow = (*s++ == 'r');\n\t}\n\t\n\t/* Sane default */\n\tif (baud == 0)\n\t\tbaud = 9600;\n\n\tswitch (bits) {\n\tcase 7:\n\t\tcflag |= CS7;\n\t\tbreak;\n\tdefault:\n\tcase 8:\n\t\tcflag |= CS8;\n\t\tbreak;\n\t}\n\tswitch (parity) {\n\tcase 'o': case 'O':\n\t\tcflag |= PARODD;\n\t\tbreak;\n\tcase 'e': case 'E':\n\t\tcflag |= PARENB;\n\t\tbreak;\n\t}\n\tco->cflag = cflag;\n\n\t/*\n\t * no need to check the index here: if the index is wrong, console\n\t * code won't call us\n\t */\n\tport = usb_serial_port_get_by_minor(co->index);\n\tif (port == NULL) {\n\t\t/* no device is connected yet, sorry :( */\n\t\tpr_err(\"No USB device connected to ttyUSB%i\\n\", co->index);\n\t\treturn -ENODEV;\n\t}\n\tserial = port->serial;\n\n\tretval = usb_autopm_get_interface(serial->interface);\n\tif (retval)\n\t\tgoto error_get_interface;\n\n\ttty_port_tty_set(&port->port, NULL);\n\n\tinfo->port = port;\n\n\t++port->port.count;\n\tif (!tty_port_initialized(&port->port)) {\n\t\tif (serial->type->set_termios) {\n\t\t\t/*\n\t\t\t * allocate a fake tty so the driver can initialize\n\t\t\t * the termios structure, then later call set_termios to\n\t\t\t * configure according to command line arguments\n\t\t\t */\n\t\t\ttty = kzalloc(sizeof(*tty), GFP_KERNEL);\n\t\t\tif (!tty) {\n\t\t\t\tretval = -ENOMEM;\n\t\t\t\tgoto reset_open_count;\n\t\t\t}\n\t\t\tkref_init(&tty->kref);\n\t\t\ttty->driver = usb_serial_tty_driver;\n\t\t\ttty->index = co->index;\n\t\t\tinit_ldsem(&tty->ldisc_sem);\n\t\t\tspin_lock_init(&tty->files_lock);\n\t\t\tINIT_LIST_HEAD(&tty->tty_files);\n\t\t\tkref_get(&tty->driver->kref);\n\t\t\t__module_get(tty->driver->owner);\n\t\t\ttty->ops = &usb_console_fake_tty_ops;\n\t\t\ttty_init_termios(tty);\n\t\t\ttty_port_tty_set(&port->port, tty);\n\t\t}\n\n\t\t/* only call the device specific open if this\n\t\t * is the first time the port is opened */\n\t\tretval = serial->type->open(NULL, port);\n\t\tif (retval) {\n\t\t\tdev_err(&port->dev, \"could not open USB console port\\n\");\n\t\t\tgoto fail;\n\t\t}\n\n\t\tif (serial->type->set_termios) {\n\t\t\ttty->termios.c_cflag = cflag;\n\t\t\ttty_termios_encode_baud_rate(&tty->termios, baud, baud);\n\t\t\tmemset(&dummy, 0, sizeof(struct ktermios));\n\t\t\tserial->type->set_termios(tty, port, &dummy);\n\n\t\t\ttty_port_tty_set(&port->port, NULL);\n\t\t\ttty_kref_put(tty);\n\t\t}\n\t\ttty_port_set_initialized(&port->port, 1);\n\t}\n\t/* Now that any required fake tty operations are completed restore\n\t * the tty port count */\n\t--port->port.count;\n\t/* The console is special in terms of closing the device so\n\t * indicate this port is now acting as a system console. */\n\tport->port.console = 1;\n\n\tmutex_unlock(&serial->disc_mutex);\n\treturn retval;\n\n fail:\n\ttty_port_tty_set(&port->port, NULL);\n\ttty_kref_put(tty);\n reset_open_count:\n\tport->port.count = 0;\n\tinfo->port = NULL;\n\tusb_autopm_put_interface(serial->interface);\n error_get_interface:\n\tusb_serial_put(serial);\n\tmutex_unlock(&serial->disc_mutex);\n\treturn retval;\n}","lang":"c","vul_type":"cwe-416","target_token_count":1009,"sven_meta":{"func_name":"usb_console_setup","file_name":"drivers/usb/serial/console.c","commit_link":"github.com/torvalds/linux/commit/299d7572e46f98534033a9e65973f13ad1ce9047","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#25-7fd54bf29395","input":"static int ipxitf_ioctl(unsigned int cmd, void __user *arg)\n{\n\tint rc = -EINVAL;\n\tstruct ifreq ifr;\n\tint val;\n\n\tswitch (cmd) {\n\tcase SIOCSIFADDR: {\n\t\tstruct sockaddr_ipx *sipx;\n\t\tstruct ipx_interface_definition f;\n\n\t\trc = -EFAULT;\n\t\tif (copy_from_user(&ifr, arg, sizeof(ifr)))\n\t\t\tbreak;\n\t\tsipx = (struct sockaddr_ipx *)&ifr.ifr_addr;\n\t\trc = -EINVAL;\n\t\tif (sipx->sipx_family != AF_IPX)\n\t\t\tbreak;\n\t\tf.ipx_network = sipx->sipx_network;\n\t\tmemcpy(f.ipx_device, ifr.ifr_name,\n\t\t\tsizeof(f.ipx_device));\n\t\tmemcpy(f.ipx_node, sipx->sipx_node, IPX_NODE_LEN);\n\t\tf.ipx_dlink_type = sipx->sipx_type;\n\t\tf.ipx_special = sipx->sipx_special;\n\n\t\tif (sipx->sipx_action == IPX_DLTITF)\n\t\t\trc = ipxitf_delete(&f);\n\t\telse\n\t\t\trc = ipxitf_create(&f);\n\t\tbreak;\n\t}\n\tcase SIOCGIFADDR: {\n\t\tstruct sockaddr_ipx *sipx;\n\t\tstruct ipx_interface *ipxif;\n\t\tstruct net_device *dev;\n\n\t\trc = -EFAULT;\n\t\tif (copy_from_user(&ifr, arg, sizeof(ifr)))\n\t\t\tbreak;\n\t\tsipx = (struct sockaddr_ipx *)&ifr.ifr_addr;\n\t\tdev = __dev_get_by_name(&init_net, ifr.ifr_name);\n\t\trc = -ENODEV;\n\t\tif (!dev)\n\t\t\tbreak;\n\t\tipxif = ipxitf_find_using_phys(dev,\n\t\t\t\t\t ipx_map_frame_type(sipx->sipx_type));\n\t\trc = -EADDRNOTAVAIL;\n\t\tif (!ipxif)\n\t\t\tbreak;\n\n\t\tsipx->sipx_family\t= AF_IPX;\n\t\tsipx->sipx_network\t= ipxif->if_netnum;\n\t\tmemcpy(sipx->sipx_node, ipxif->if_node,\n\t\t\tsizeof(sipx->sipx_node));\n\t\trc = -EFAULT;\n\t\tif (copy_to_user(arg, &ifr, sizeof(ifr)))\n\t\t\tbreak;\n\t\tipxitf_put(ipxif);\n\t\trc = 0;\n\t\tbreak;\n\t}\n\tcase SIOCAIPXITFCRT:\n\t\trc = -EFAULT;\n\t\tif (get_user(val, (unsigned char __user *) arg))\n\t\t\tbreak;\n\t\trc = 0;\n\t\tipxcfg_auto_create_interfaces = val;\n\t\tbreak;\n\tcase SIOCAIPXPRISLT:\n\t\trc = -EFAULT;\n\t\tif (get_user(val, (unsigned char __user *) arg))\n\t\t\tbreak;\n\t\trc = 0;\n\t\tipxcfg_set_auto_select(val);\n\t\tbreak;\n\t}\n\n\treturn rc;\n}","target":"static int ipxitf_ioctl(unsigned int cmd, void __user *arg)\n{\n\tint rc = -EINVAL;\n\tstruct ifreq ifr;\n\tint val;\n\n\tswitch (cmd) {\n\tcase SIOCSIFADDR: {\n\t\tstruct sockaddr_ipx *sipx;\n\t\tstruct ipx_interface_definition f;\n\n\t\trc = -EFAULT;\n\t\tif (copy_from_user(&ifr, arg, sizeof(ifr)))\n\t\t\tbreak;\n\t\tsipx = (struct sockaddr_ipx *)&ifr.ifr_addr;\n\t\trc = -EINVAL;\n\t\tif (sipx->sipx_family != AF_IPX)\n\t\t\tbreak;\n\t\tf.ipx_network = sipx->sipx_network;\n\t\tmemcpy(f.ipx_device, ifr.ifr_name,\n\t\t\tsizeof(f.ipx_device));\n\t\tmemcpy(f.ipx_node, sipx->sipx_node, IPX_NODE_LEN);\n\t\tf.ipx_dlink_type = sipx->sipx_type;\n\t\tf.ipx_special = sipx->sipx_special;\n\n\t\tif (sipx->sipx_action == IPX_DLTITF)\n\t\t\trc = ipxitf_delete(&f);\n\t\telse\n\t\t\trc = ipxitf_create(&f);\n\t\tbreak;\n\t}\n\tcase SIOCGIFADDR: {\n\t\tstruct sockaddr_ipx *sipx;\n\t\tstruct ipx_interface *ipxif;\n\t\tstruct net_device *dev;\n\n\t\trc = -EFAULT;\n\t\tif (copy_from_user(&ifr, arg, sizeof(ifr)))\n\t\t\tbreak;\n\t\tsipx = (struct sockaddr_ipx *)&ifr.ifr_addr;\n\t\tdev = __dev_get_by_name(&init_net, ifr.ifr_name);\n\t\trc = -ENODEV;\n\t\tif (!dev)\n\t\t\tbreak;\n\t\tipxif = ipxitf_find_using_phys(dev,\n\t\t\t\t\t ipx_map_frame_type(sipx->sipx_type));\n\t\trc = -EADDRNOTAVAIL;\n\t\tif (!ipxif)\n\t\t\tbreak;\n\n\t\tsipx->sipx_family\t= AF_IPX;\n\t\tsipx->sipx_network\t= ipxif->if_netnum;\n\t\tmemcpy(sipx->sipx_node, ipxif->if_node,\n\t\t\tsizeof(sipx->sipx_node));\n\t\trc = 0;\n\t\tif (copy_to_user(arg, &ifr, sizeof(ifr)))\n\t\t\trc = -EFAULT;\n\t\tipxitf_put(ipxif);\n\t\tbreak;\n\t}\n\tcase SIOCAIPXITFCRT:\n\t\trc = -EFAULT;\n\t\tif (get_user(val, (unsigned char __user *) arg))\n\t\t\tbreak;\n\t\trc = 0;\n\t\tipxcfg_auto_create_interfaces = val;\n\t\tbreak;\n\tcase SIOCAIPXPRISLT:\n\t\trc = -EFAULT;\n\t\tif (get_user(val, (unsigned char __user *) arg))\n\t\t\tbreak;\n\t\trc = 0;\n\t\tipxcfg_set_auto_select(val);\n\t\tbreak;\n\t}\n\n\treturn rc;\n}","lang":"c","vul_type":"cwe-416","target_token_count":617,"sven_meta":{"func_name":"ipxitf_ioctl","file_name":"net/ipx/af_ipx.c","commit_link":"github.com/torvalds/linux/commit/ee0d8d8482345ff97a75a7d747efc309f13b0d80","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#26-f3045cf99036","input":"static PHP_MINIT_FUNCTION(zip)\n{\n#ifdef PHP_ZIP_USE_OO\n\tzend_class_entry ce;\n\n\tmemcpy(&zip_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));\n\tzip_object_handlers.clone_obj\t\t= NULL;\n\tzip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr;\n\n\tzip_object_handlers.get_gc = php_zip_get_gc;\n\tzip_object_handlers.get_properties = php_zip_get_properties;\n\tzip_object_handlers.read_property\t= php_zip_read_property;\n\tzip_object_handlers.has_property\t= php_zip_has_property;\n\n\tINIT_CLASS_ENTRY(ce, \"ZipArchive\", zip_class_functions);\n\tce.create_object = php_zip_object_new;\n\tzip_class_entry = zend_register_internal_class(&ce TSRMLS_CC);\n\n\tzend_hash_init(&zip_prop_handlers, 0, NULL, NULL, 1);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"status\", php_zip_status, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"statusSys\", php_zip_status_sys, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"numFiles\", php_zip_get_num_files, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"filename\", NULL, NULL, php_zipobj_get_filename, IS_STRING TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"comment\", NULL, php_zipobj_get_zip_comment, NULL, IS_STRING TSRMLS_CC);\n\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CREATE\", ZIP_CREATE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"EXCL\", ZIP_EXCL);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CHECKCONS\", ZIP_CHECKCONS);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"OVERWRITE\", ZIP_OVERWRITE);\n\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_NOCASE\", ZIP_FL_NOCASE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_NODIR\", ZIP_FL_NODIR);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_COMPRESSED\", ZIP_FL_COMPRESSED);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_UNCHANGED\", ZIP_FL_UNCHANGED);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFAULT\", ZIP_CM_DEFAULT);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_STORE\", ZIP_CM_STORE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_SHRINK\", ZIP_CM_SHRINK);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_1\", ZIP_CM_REDUCE_1);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_2\", ZIP_CM_REDUCE_2);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_3\", ZIP_CM_REDUCE_3);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_4\", ZIP_CM_REDUCE_4);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_IMPLODE\", ZIP_CM_IMPLODE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFLATE\", ZIP_CM_DEFLATE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFLATE64\", ZIP_CM_DEFLATE64);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_PKWARE_IMPLODE\", ZIP_CM_PKWARE_IMPLODE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_BZIP2\", ZIP_CM_BZIP2);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_LZMA\", ZIP_CM_LZMA);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_TERSE\", ZIP_CM_TERSE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_LZ77\", ZIP_CM_LZ77);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_WAVPACK\", ZIP_CM_WAVPACK);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_PPMD\", ZIP_CM_PPMD);\n\n\t/* Error code */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_OK\",\t\t\tZIP_ER_OK);\t\t\t/* N No error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_MULTIDISK\",\tZIP_ER_MULTIDISK);\t/* N Multi-disk zip archives not supported */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_RENAME\",\t\tZIP_ER_RENAME);\t\t/* S Renaming temporary file failed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CLOSE\",\t\tZIP_ER_CLOSE);\t\t/* S Closing zip archive failed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_SEEK\",\t\tZIP_ER_SEEK);\t\t/* S Seek error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_READ\",\t\tZIP_ER_READ);\t\t/* S Read error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_WRITE\",\t\tZIP_ER_WRITE);\t\t/* S Write error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CRC\",\t\t\tZIP_ER_CRC);\t\t/* N CRC error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_ZIPCLOSED\",\tZIP_ER_ZIPCLOSED);\t/* N Containing zip archive was closed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_NOENT\",\t\tZIP_ER_NOENT);\t\t/* N No such file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_EXISTS\",\t\tZIP_ER_EXISTS);\t\t/* N File already exists */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_OPEN\",\t\tZIP_ER_OPEN);\t\t/* S Can't open file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_TMPOPEN\",\t\tZIP_ER_TMPOPEN);\t/* S Failure to create temporary file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_ZLIB\",\t\tZIP_ER_ZLIB);\t\t/* Z Zlib error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_MEMORY\",\t\tZIP_ER_MEMORY);\t\t/* N Malloc failure */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CHANGED\",\t\tZIP_ER_CHANGED);\t/* N Entry has been changed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_COMPNOTSUPP\",\tZIP_ER_COMPNOTSUPP);/* N Compression method not supported */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_EOF\",\t\t\tZIP_ER_EOF);\t\t/* N Premature EOF */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INVAL\",\t\tZIP_ER_INVAL);\t\t/* N Invalid argument */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_NOZIP\",\t\tZIP_ER_NOZIP);\t\t/* N Not a zip archive */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INTERNAL\",\tZIP_ER_INTERNAL);\t/* N Internal error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INCONS\",\t\tZIP_ER_INCONS);\t\t/* N Zip archive inconsistent */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_REMOVE\",\t\tZIP_ER_REMOVE);\t\t/* S Can't remove file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_DELETED\", \tZIP_ER_DELETED);\t/* N Entry has been deleted */\n\n\tphp_register_url_stream_wrapper(\"zip\", &php_stream_zip_wrapper TSRMLS_CC);\n#endif\n\n\tle_zip_dir = zend_register_list_destructors_ex(php_zip_free_dir, NULL, le_zip_dir_name, module_number);\n\tle_zip_entry = zend_register_list_destructors_ex(php_zip_free_entry, NULL, le_zip_entry_name, module_number);\n\n\treturn SUCCESS;\n}","target":"static PHP_MINIT_FUNCTION(zip)\n{\n#ifdef PHP_ZIP_USE_OO\n\tzend_class_entry ce;\n\n\tmemcpy(&zip_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));\n\tzip_object_handlers.clone_obj\t\t= NULL;\n\tzip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr;\n\n\tzip_object_handlers.get_gc = php_zip_get_gc;\n\tzip_object_handlers.get_properties = php_zip_get_properties;\n\tzip_object_handlers.read_property\t= php_zip_read_property;\n\tzip_object_handlers.has_property\t= php_zip_has_property;\n\n\tINIT_CLASS_ENTRY(ce, \"ZipArchive\", zip_class_functions);\n\tce.create_object = php_zip_object_new;\n\tzip_class_entry = zend_register_internal_class(&ce TSRMLS_CC);\n\n\tzend_hash_init(&zip_prop_handlers, 0, NULL, NULL, 1);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"status\", php_zip_status, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"statusSys\", php_zip_status_sys, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"numFiles\", php_zip_get_num_files, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"filename\", NULL, NULL, php_zipobj_get_filename, IS_STRING TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"comment\", NULL, php_zipobj_get_zip_comment, NULL, IS_STRING TSRMLS_CC);\n\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CREATE\", ZIP_CREATE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"EXCL\", ZIP_EXCL);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CHECKCONS\", ZIP_CHECKCONS);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"OVERWRITE\", ZIP_OVERWRITE);\n\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_NOCASE\", ZIP_FL_NOCASE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_NODIR\", ZIP_FL_NODIR);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_COMPRESSED\", ZIP_FL_COMPRESSED);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_UNCHANGED\", ZIP_FL_UNCHANGED);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFAULT\", ZIP_CM_DEFAULT);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_STORE\", ZIP_CM_STORE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_SHRINK\", ZIP_CM_SHRINK);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_1\", ZIP_CM_REDUCE_1);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_2\", ZIP_CM_REDUCE_2);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_3\", ZIP_CM_REDUCE_3);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_4\", ZIP_CM_REDUCE_4);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_IMPLODE\", ZIP_CM_IMPLODE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFLATE\", ZIP_CM_DEFLATE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFLATE64\", ZIP_CM_DEFLATE64);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_PKWARE_IMPLODE\", ZIP_CM_PKWARE_IMPLODE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_BZIP2\", ZIP_CM_BZIP2);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_LZMA\", ZIP_CM_LZMA);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_TERSE\", ZIP_CM_TERSE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_LZ77\", ZIP_CM_LZ77);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_WAVPACK\", ZIP_CM_WAVPACK);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_PPMD\", ZIP_CM_PPMD);\n\n\t/* Error code */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_OK\",\t\t\tZIP_ER_OK);\t\t\t/* N No error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_MULTIDISK\",\tZIP_ER_MULTIDISK);\t/* N Multi-disk zip archives not supported */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_RENAME\",\t\tZIP_ER_RENAME);\t\t/* S Renaming temporary file failed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CLOSE\",\t\tZIP_ER_CLOSE);\t\t/* S Closing zip archive failed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_SEEK\",\t\tZIP_ER_SEEK);\t\t/* S Seek error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_READ\",\t\tZIP_ER_READ);\t\t/* S Read error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_WRITE\",\t\tZIP_ER_WRITE);\t\t/* S Write error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CRC\",\t\t\tZIP_ER_CRC);\t\t/* N CRC error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_ZIPCLOSED\",\tZIP_ER_ZIPCLOSED);\t/* N Containing zip archive was closed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_NOENT\",\t\tZIP_ER_NOENT);\t\t/* N No such file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_EXISTS\",\t\tZIP_ER_EXISTS);\t\t/* N File already exists */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_OPEN\",\t\tZIP_ER_OPEN);\t\t/* S Can't open file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_TMPOPEN\",\t\tZIP_ER_TMPOPEN);\t/* S Failure to create temporary file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_ZLIB\",\t\tZIP_ER_ZLIB);\t\t/* Z Zlib error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_MEMORY\",\t\tZIP_ER_MEMORY);\t\t/* N Malloc failure */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CHANGED\",\t\tZIP_ER_CHANGED);\t/* N Entry has been changed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_COMPNOTSUPP\",\tZIP_ER_COMPNOTSUPP);/* N Compression method not supported */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_EOF\",\t\t\tZIP_ER_EOF);\t\t/* N Premature EOF */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INVAL\",\t\tZIP_ER_INVAL);\t\t/* N Invalid argument */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_NOZIP\",\t\tZIP_ER_NOZIP);\t\t/* N Not a zip archive */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INTERNAL\",\tZIP_ER_INTERNAL);\t/* N Internal error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INCONS\",\t\tZIP_ER_INCONS);\t\t/* N Zip archive inconsistent */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_REMOVE\",\t\tZIP_ER_REMOVE);\t\t/* S Can't remove file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_DELETED\", \tZIP_ER_DELETED);\t/* N Entry has been deleted */\n\n\tphp_register_url_stream_wrapper(\"zip\", &php_stream_zip_wrapper TSRMLS_CC);\n#endif\n\n\tle_zip_dir = zend_register_list_destructors_ex(php_zip_free_dir, NULL, le_zip_dir_name, module_number);\n\tle_zip_entry = zend_register_list_destructors_ex(php_zip_free_entry, NULL, le_zip_entry_name, module_number);\n\n\treturn SUCCESS;\n}","lang":"c","vul_type":"cwe-416","target_token_count":1510,"sven_meta":{"func_name":"PHP_MINIT_FUNCTION","file_name":"ext/zip/php_zip.c","commit_link":"github.com/php/php-src/commit/f6aef68089221c5ea047d4a74224ee3deead99a6?w=1","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#28-29e0547979e2","input":"MagickExport MagickBooleanType SetImageType(Image *image,const ImageType type)\n{\n const char\n *artifact;\n\n ImageInfo\n *image_info;\n\n MagickBooleanType\n status;\n\n QuantizeInfo\n *quantize_info;\n\n assert(image != (Image *) NULL);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n assert(image->signature == MagickSignature);\n status=MagickTrue;\n image_info=AcquireImageInfo();\n image_info->dither=image->dither;\n artifact=GetImageArtifact(image,\"dither\");\n if (artifact != (const char *) NULL)\n (void) SetImageOption(image_info,\"dither\",artifact);\n switch (type)\n {\n case BilevelType:\n {\n if (SetImageMonochrome(image,&image->exception) == MagickFalse)\n {\n status=TransformImageColorspace(image,GRAYColorspace);\n (void) NormalizeImage(image);\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->number_colors=2;\n quantize_info->colorspace=GRAYColorspace;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n }\n image->colors=2;\n image->matte=MagickFalse;\n break;\n }\n case GrayscaleType:\n {\n if (SetImageGray(image,&image->exception) == MagickFalse)\n status=TransformImageColorspace(image,GRAYColorspace);\n image->matte=MagickFalse;\n break;\n }\n case GrayscaleMatteType:\n {\n if (SetImageGray(image,&image->exception) == MagickFalse)\n status=TransformImageColorspace(image,GRAYColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case PaletteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n {\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->number_colors=256;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n }\n image->matte=MagickFalse;\n break;\n }\n case PaletteBilevelMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n (void) BilevelImageChannel(image,AlphaChannel,(double) QuantumRange/2.0);\n quantize_info=AcquireQuantizeInfo(image_info);\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n break;\n }\n case PaletteMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->colorspace=TransparentColorspace;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n break;\n }\n case TrueColorType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n image->matte=MagickFalse;\n break;\n }\n case TrueColorMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case ColorSeparationType:\n {\n if (image->colorspace != CMYKColorspace)\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);\n status=TransformImageColorspace(image,CMYKColorspace);\n }\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n image->matte=MagickFalse;\n break;\n }\n case ColorSeparationMatteType:\n {\n if (image->colorspace != CMYKColorspace)\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);\n status=TransformImageColorspace(image,CMYKColorspace);\n }\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case OptimizeType:\n case UndefinedType:\n break;\n }\n image_info=DestroyImageInfo(image_info);\n if (status == MagickFalse)\n return(MagickFalse);\n image->type=type;\n return(MagickTrue);\n}","target":"MagickExport MagickBooleanType SetImageType(Image *image,const ImageType type)\n{\n const char\n *artifact;\n\n ImageInfo\n *image_info;\n\n MagickBooleanType\n status;\n\n QuantizeInfo\n *quantize_info;\n\n assert(image != (Image *) NULL);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n assert(image->signature == MagickSignature);\n status=MagickTrue;\n image_info=AcquireImageInfo();\n image_info->dither=image->dither;\n artifact=GetImageArtifact(image,\"dither\");\n if (artifact != (const char *) NULL)\n (void) SetImageOption(image_info,\"dither\",artifact);\n switch (type)\n {\n case BilevelType:\n {\n if (SetImageMonochrome(image,&image->exception) == MagickFalse)\n {\n status=TransformImageColorspace(image,GRAYColorspace);\n (void) NormalizeImage(image);\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->number_colors=2;\n quantize_info->colorspace=GRAYColorspace;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n }\n status=AcquireImageColormap(image,2);\n image->matte=MagickFalse;\n break;\n }\n case GrayscaleType:\n {\n if (SetImageGray(image,&image->exception) == MagickFalse)\n status=TransformImageColorspace(image,GRAYColorspace);\n image->matte=MagickFalse;\n break;\n }\n case GrayscaleMatteType:\n {\n if (SetImageGray(image,&image->exception) == MagickFalse)\n status=TransformImageColorspace(image,GRAYColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case PaletteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n {\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->number_colors=256;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n }\n image->matte=MagickFalse;\n break;\n }\n case PaletteBilevelMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n (void) BilevelImageChannel(image,AlphaChannel,(double) QuantumRange/2.0);\n quantize_info=AcquireQuantizeInfo(image_info);\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n break;\n }\n case PaletteMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->colorspace=TransparentColorspace;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n break;\n }\n case TrueColorType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n image->matte=MagickFalse;\n break;\n }\n case TrueColorMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case ColorSeparationType:\n {\n if (image->colorspace != CMYKColorspace)\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);\n status=TransformImageColorspace(image,CMYKColorspace);\n }\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n image->matte=MagickFalse;\n break;\n }\n case ColorSeparationMatteType:\n {\n if (image->colorspace != CMYKColorspace)\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);\n status=TransformImageColorspace(image,CMYKColorspace);\n }\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case OptimizeType:\n case UndefinedType:\n break;\n }\n image_info=DestroyImageInfo(image_info);\n if (status == MagickFalse)\n return(MagickFalse);\n image->type=type;\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-416","target_token_count":1277,"sven_meta":{"func_name":"SetImageType","file_name":"magick/attribute.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/d63a3c5729df59f183e9e110d5d8385d17caaad0","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#29-741e251af25b","input":"updateDevice(const struct header * headers, time_t t)\n{\n\tstruct device ** pp = &devlist;\n\tstruct device * p = *pp;\t/* = devlist; */\n\twhile(p)\n\t{\n\t\tif( p->headers[HEADER_NT].l == headers[HEADER_NT].l\n\t\t && (0==memcmp(p->headers[HEADER_NT].p, headers[HEADER_NT].p, headers[HEADER_NT].l))\n\t\t && p->headers[HEADER_USN].l == headers[HEADER_USN].l\n\t\t && (0==memcmp(p->headers[HEADER_USN].p, headers[HEADER_USN].p, headers[HEADER_USN].l)) )\n\t\t{\n\t\t\t/*printf(\"found! %d\\n\", (int)(t - p->t));*/\n\t\t\tsyslog(LOG_DEBUG, \"device updated : %.*s\", headers[HEADER_USN].l, headers[HEADER_USN].p);\n\t\t\tp->t = t;\n\t\t\t/* update Location ! */\n\t\t\tif(headers[HEADER_LOCATION].l > p->headers[HEADER_LOCATION].l)\n\t\t\t{\n\t\t\t\tstruct device * tmp;\n\t\t\t\ttmp = realloc(p, sizeof(struct device)\n\t\t\t\t + headers[0].l+headers[1].l+headers[2].l);\n\t\t\t\tif(!tmp)\t/* allocation error */\n\t\t\t\t{\n\t\t\t\t\tsyslog(LOG_ERR, \"updateDevice() : memory allocation error\");\n\t\t\t\t\tfree(p);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tp = tmp;\n\t\t\t\t*pp = p;\n\t\t\t}\n\t\t\tmemcpy(p->data + p->headers[0].l + p->headers[1].l,\n\t\t\t headers[2].p, headers[2].l);\n\t\t\t/* TODO : check p->headers[HEADER_LOCATION].l */\n\t\t\treturn 0;\n\t\t}\n\t\tpp = &p->next;\n\t\tp = *pp;\t/* p = p->next; */\n\t}\n\tsyslog(LOG_INFO, \"new device discovered : %.*s\",\n\t headers[HEADER_USN].l, headers[HEADER_USN].p);\n\t/* add */\n\t{\n\t\tchar * pc;\n\t\tint i;\n\t\tp = malloc( sizeof(struct device)\n\t\t + headers[0].l+headers[1].l+headers[2].l );\n\t\tif(!p) {\n\t\t\tsyslog(LOG_ERR, \"updateDevice(): cannot allocate memory\");\n\t\t\treturn -1;\n\t\t}\n\t\tp->next = devlist;\n\t\tp->t = t;\n\t\tpc = p->data;\n\t\tfor(i = 0; i < 3; i++)\n\t\t{\n\t\t\tp->headers[i].p = pc;\n\t\t\tp->headers[i].l = headers[i].l;\n\t\t\tmemcpy(pc, headers[i].p, headers[i].l);\n\t\t\tpc += headers[i].l;\n\t\t}\n\t\tdevlist = p;\n\t\tsendNotifications(NOTIF_NEW, p, NULL);\n\t}\n\treturn 1;\n}","target":"updateDevice(const struct header * headers, time_t t)\n{\n\tstruct device ** pp = &devlist;\n\tstruct device * p = *pp;\t/* = devlist; */\n\twhile(p)\n\t{\n\t\tif( p->headers[HEADER_NT].l == headers[HEADER_NT].l\n\t\t && (0==memcmp(p->headers[HEADER_NT].p, headers[HEADER_NT].p, headers[HEADER_NT].l))\n\t\t && p->headers[HEADER_USN].l == headers[HEADER_USN].l\n\t\t && (0==memcmp(p->headers[HEADER_USN].p, headers[HEADER_USN].p, headers[HEADER_USN].l)) )\n\t\t{\n\t\t\t/*printf(\"found! %d\\n\", (int)(t - p->t));*/\n\t\t\tsyslog(LOG_DEBUG, \"device updated : %.*s\", headers[HEADER_USN].l, headers[HEADER_USN].p);\n\t\t\tp->t = t;\n\t\t\t/* update Location ! */\n\t\t\tif(headers[HEADER_LOCATION].l > p->headers[HEADER_LOCATION].l)\n\t\t\t{\n\t\t\t\tstruct device * tmp;\n\t\t\t\ttmp = realloc(p, sizeof(struct device)\n\t\t\t\t + headers[0].l+headers[1].l+headers[2].l);\n\t\t\t\tif(!tmp)\t/* allocation error */\n\t\t\t\t{\n\t\t\t\t\tsyslog(LOG_ERR, \"updateDevice() : memory allocation error\");\n\t\t\t\t\t*pp = p->next;\t/* remove \"p\" from the list */\n\t\t\t\t\tfree(p);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tp = tmp;\n\t\t\t\t*pp = p;\n\t\t\t}\n\t\t\tmemcpy(p->data + p->headers[0].l + p->headers[1].l,\n\t\t\t headers[2].p, headers[2].l);\n\t\t\t/* TODO : check p->headers[HEADER_LOCATION].l */\n\t\t\treturn 0;\n\t\t}\n\t\tpp = &p->next;\n\t\tp = *pp;\t/* p = p->next; */\n\t}\n\tsyslog(LOG_INFO, \"new device discovered : %.*s\",\n\t headers[HEADER_USN].l, headers[HEADER_USN].p);\n\t/* add */\n\t{\n\t\tchar * pc;\n\t\tint i;\n\t\tp = malloc( sizeof(struct device)\n\t\t + headers[0].l+headers[1].l+headers[2].l );\n\t\tif(!p) {\n\t\t\tsyslog(LOG_ERR, \"updateDevice(): cannot allocate memory\");\n\t\t\treturn -1;\n\t\t}\n\t\tp->next = devlist;\n\t\tp->t = t;\n\t\tpc = p->data;\n\t\tfor(i = 0; i < 3; i++)\n\t\t{\n\t\t\tp->headers[i].p = pc;\n\t\t\tp->headers[i].l = headers[i].l;\n\t\t\tmemcpy(pc, headers[i].p, headers[i].l);\n\t\t\tpc += headers[i].l;\n\t\t}\n\t\tdevlist = p;\n\t\tsendNotifications(NOTIF_NEW, p, NULL);\n\t}\n\treturn 1;\n}","lang":"c","vul_type":"cwe-416","target_token_count":643,"sven_meta":{"func_name":"updateDevice","file_name":"minissdpd/minissdpd.c","commit_link":"github.com/miniupnp/miniupnp/commit/cd506a67e174a45c6a202eff182a712955ed6d6f","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#31-9f4e2a873583","input":"SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,\n\t unsigned int *nbytes, char **buf, int *buf_type)\n{\n\tstruct smb_rqst rqst;\n\tint resp_buftype, rc = -EACCES;\n\tstruct smb2_read_plain_req *req = NULL;\n\tstruct smb2_read_rsp *rsp = NULL;\n\tstruct kvec iov[1];\n\tstruct kvec rsp_iov;\n\tunsigned int total_len;\n\tint flags = CIFS_LOG_ERROR;\n\tstruct cifs_ses *ses = io_parms->tcon->ses;\n\n\t*nbytes = 0;\n\trc = smb2_new_read_req((void **)&req, &total_len, io_parms, NULL, 0, 0);\n\tif (rc)\n\t\treturn rc;\n\n\tif (smb3_encryption_required(io_parms->tcon))\n\t\tflags |= CIFS_TRANSFORM_REQ;\n\n\tiov[0].iov_base = (char *)req;\n\tiov[0].iov_len = total_len;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = 1;\n\n\trc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);\n\tcifs_small_buf_release(req);\n\n\trsp = (struct smb2_read_rsp *)rsp_iov.iov_base;\n\n\tif (rc) {\n\t\tif (rc != -ENODATA) {\n\t\t\tcifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE);\n\t\t\tcifs_dbg(VFS, \"Send error in read = %d\\n\", rc);\n\t\t\ttrace_smb3_read_err(xid, req->PersistentFileId,\n\t\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t\t io_parms->offset, io_parms->length,\n\t\t\t\t\t rc);\n\t\t} else\n\t\t\ttrace_smb3_read_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t io_parms->offset, 0);\n\t\tfree_rsp_buf(resp_buftype, rsp_iov.iov_base);\n\t\treturn rc == -ENODATA ? 0 : rc;\n\t} else\n\t\ttrace_smb3_read_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t io_parms->offset, io_parms->length);\n\n\t*nbytes = le32_to_cpu(rsp->DataLength);\n\tif ((*nbytes > CIFS_MAX_MSGSIZE) ||\n\t (*nbytes > io_parms->length)) {\n\t\tcifs_dbg(FYI, \"bad length %d for count %d\\n\",\n\t\t\t *nbytes, io_parms->length);\n\t\trc = -EIO;\n\t\t*nbytes = 0;\n\t}\n\n\tif (*buf) {\n\t\tmemcpy(*buf, (char *)rsp + rsp->DataOffset, *nbytes);\n\t\tfree_rsp_buf(resp_buftype, rsp_iov.iov_base);\n\t} else if (resp_buftype != CIFS_NO_BUFFER) {\n\t\t*buf = rsp_iov.iov_base;\n\t\tif (resp_buftype == CIFS_SMALL_BUFFER)\n\t\t\t*buf_type = CIFS_SMALL_BUFFER;\n\t\telse if (resp_buftype == CIFS_LARGE_BUFFER)\n\t\t\t*buf_type = CIFS_LARGE_BUFFER;\n\t}\n\treturn rc;\n}","target":"SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,\n\t unsigned int *nbytes, char **buf, int *buf_type)\n{\n\tstruct smb_rqst rqst;\n\tint resp_buftype, rc = -EACCES;\n\tstruct smb2_read_plain_req *req = NULL;\n\tstruct smb2_read_rsp *rsp = NULL;\n\tstruct kvec iov[1];\n\tstruct kvec rsp_iov;\n\tunsigned int total_len;\n\tint flags = CIFS_LOG_ERROR;\n\tstruct cifs_ses *ses = io_parms->tcon->ses;\n\n\t*nbytes = 0;\n\trc = smb2_new_read_req((void **)&req, &total_len, io_parms, NULL, 0, 0);\n\tif (rc)\n\t\treturn rc;\n\n\tif (smb3_encryption_required(io_parms->tcon))\n\t\tflags |= CIFS_TRANSFORM_REQ;\n\n\tiov[0].iov_base = (char *)req;\n\tiov[0].iov_len = total_len;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = 1;\n\n\trc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);\n\trsp = (struct smb2_read_rsp *)rsp_iov.iov_base;\n\n\tif (rc) {\n\t\tif (rc != -ENODATA) {\n\t\t\tcifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE);\n\t\t\tcifs_dbg(VFS, \"Send error in read = %d\\n\", rc);\n\t\t\ttrace_smb3_read_err(xid, req->PersistentFileId,\n\t\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t\t io_parms->offset, io_parms->length,\n\t\t\t\t\t rc);\n\t\t} else\n\t\t\ttrace_smb3_read_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t io_parms->offset, 0);\n\t\tfree_rsp_buf(resp_buftype, rsp_iov.iov_base);\n\t\treturn rc == -ENODATA ? 0 : rc;\n\t} else\n\t\ttrace_smb3_read_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t io_parms->offset, io_parms->length);\n\n\tcifs_small_buf_release(req);\n\n\t*nbytes = le32_to_cpu(rsp->DataLength);\n\tif ((*nbytes > CIFS_MAX_MSGSIZE) ||\n\t (*nbytes > io_parms->length)) {\n\t\tcifs_dbg(FYI, \"bad length %d for count %d\\n\",\n\t\t\t *nbytes, io_parms->length);\n\t\trc = -EIO;\n\t\t*nbytes = 0;\n\t}\n\n\tif (*buf) {\n\t\tmemcpy(*buf, (char *)rsp + rsp->DataOffset, *nbytes);\n\t\tfree_rsp_buf(resp_buftype, rsp_iov.iov_base);\n\t} else if (resp_buftype != CIFS_NO_BUFFER) {\n\t\t*buf = rsp_iov.iov_base;\n\t\tif (resp_buftype == CIFS_SMALL_BUFFER)\n\t\t\t*buf_type = CIFS_SMALL_BUFFER;\n\t\telse if (resp_buftype == CIFS_LARGE_BUFFER)\n\t\t\t*buf_type = CIFS_LARGE_BUFFER;\n\t}\n\treturn rc;\n}","lang":"c","vul_type":"cwe-416","target_token_count":717,"sven_meta":{"func_name":"SMB2_read","file_name":"fs/cifs/smb2pdu.c","commit_link":"github.com/torvalds/linux/commit/088aaf17aa79300cab14dbee2569c58cfafd7d6e","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#36-664f886f3ef2","input":"Error HeifContext::interpret_heif_file()\n{\n m_all_images.clear();\n m_top_level_images.clear();\n m_primary_image.reset();\n\n\n // --- reference all non-hidden images\n\n std::vector image_IDs = m_heif_file->get_item_IDs();\n\n bool primary_is_grid = false;\n for (heif_item_id id : image_IDs) {\n auto infe_box = m_heif_file->get_infe_box(id);\n if (!infe_box) {\n // TODO(farindk): Should we return an error instead of skipping the invalid id?\n continue;\n }\n\n if (item_type_is_image(infe_box->get_item_type())) {\n auto image = std::make_shared(this, id);\n m_all_images.insert(std::make_pair(id, image));\n\n if (!infe_box->is_hidden_item()) {\n if (id==m_heif_file->get_primary_image_ID()) {\n image->set_primary(true);\n m_primary_image = image;\n primary_is_grid = infe_box->get_item_type() == \"grid\";\n }\n\n m_top_level_images.push_back(image);\n }\n }\n }\n\n\n if (!m_primary_image) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"'pitm' box references a non-existing image\");\n }\n\n\n // --- remove thumbnails from top-level images and assign to their respective image\n\n auto iref_box = m_heif_file->get_iref_box();\n if (iref_box) {\n // m_top_level_images.clear();\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::vector references = iref_box->get_references_from(image->get_id());\n\n for (const Box_iref::Reference& ref : references) {\n uint32_t type = ref.header.get_short_type();\n\n if (type==fourcc(\"thmb\")) {\n // --- this is a thumbnail image, attach to the main image\n\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Too many thumbnail references\");\n }\n\n image->set_is_thumbnail_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (master_iter == m_all_images.end()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Thumbnail references a non-existing image\");\n }\n\n if (master_iter->second->is_thumbnail()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Thumbnail references another thumbnail\");\n }\n\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive thumbnail image detected\");\n }\n master_iter->second->add_thumbnail(image);\n\n remove_top_level_image(image);\n }\n else if (type==fourcc(\"auxl\")) {\n\n // --- this is an auxiliary image\n // check whether it is an alpha channel and attach to the main image if yes\n\n std::vector properties;\n Error err = m_heif_file->get_properties(image->get_id(), properties);\n if (err) {\n return err;\n }\n\n std::shared_ptr auxC_property;\n for (const auto& property : properties) {\n auto auxC = std::dynamic_pointer_cast(property.property);\n if (auxC) {\n auxC_property = auxC;\n }\n }\n\n if (!auxC_property) {\n std::stringstream sstr;\n sstr << \"No auxC property for image \" << image->get_id();\n return Error(heif_error_Invalid_input,\n heif_suberror_Auxiliary_image_type_unspecified,\n sstr.str());\n }\n\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Too many auxiliary image references\");\n }\n\n\n // alpha channel\n\n if (auxC_property->get_aux_type() == \"urn:mpeg:avc:2015:auxid:1\" ||\n auxC_property->get_aux_type() == \"urn:mpeg:hevc:2015:auxid:1\") {\n image->set_is_alpha_channel_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive alpha image detected\");\n }\n master_iter->second->set_alpha_channel(image);\n }\n\n\n // depth channel\n\n if (auxC_property->get_aux_type() == \"urn:mpeg:hevc:2015:auxid:2\") {\n image->set_is_depth_channel_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive depth image detected\");\n }\n master_iter->second->set_depth_channel(image);\n\n auto subtypes = auxC_property->get_subtypes();\n\n std::vector> sei_messages;\n Error err = decode_hevc_aux_sei_messages(subtypes, sei_messages);\n\n for (auto& msg : sei_messages) {\n auto depth_msg = std::dynamic_pointer_cast(msg);\n if (depth_msg) {\n image->set_depth_representation_info(*depth_msg);\n }\n }\n }\n\n remove_top_level_image(image);\n }\n else {\n // 'image' is a normal image, keep it as a top-level image\n }\n }\n }\n }\n\n\n // --- check that HEVC images have an hvcC property\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::shared_ptr infe = m_heif_file->get_infe_box(image->get_id());\n if (infe->get_item_type() == \"hvc1\") {\n\n auto ipma = m_heif_file->get_ipma_box();\n auto ipco = m_heif_file->get_ipco_box();\n\n if (!ipco->get_property_for_item_ID(image->get_id(), ipma, fourcc(\"hvcC\"))) {\n return Error(heif_error_Invalid_input,\n heif_suberror_No_hvcC_box,\n \"No hvcC property in hvc1 type image\");\n }\n }\n }\n\n\n // --- read through properties for each image and extract image resolutions\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::vector properties;\n\n Error err = m_heif_file->get_properties(pair.first, properties);\n if (err) {\n return err;\n }\n\n bool ispe_read = false;\n bool primary_colr_set = false;\n for (const auto& prop : properties) {\n auto ispe = std::dynamic_pointer_cast(prop.property);\n if (ispe) {\n uint32_t width = ispe->get_width();\n uint32_t height = ispe->get_height();\n\n\n // --- check whether the image size is \"too large\"\n\n if (width >= static_cast(MAX_IMAGE_WIDTH) ||\n height >= static_cast(MAX_IMAGE_HEIGHT)) {\n std::stringstream sstr;\n sstr << \"Image size \" << width << \"x\" << height << \" exceeds the maximum image size \"\n << MAX_IMAGE_WIDTH << \"x\" << MAX_IMAGE_HEIGHT << \"\\n\";\n\n return Error(heif_error_Memory_allocation_error,\n heif_suberror_Security_limit_exceeded,\n sstr.str());\n }\n\n image->set_resolution(width, height);\n image->set_ispe_resolution(width, height);\n ispe_read = true;\n }\n\n if (ispe_read) {\n auto clap = std::dynamic_pointer_cast(prop.property);\n if (clap) {\n image->set_resolution( clap->get_width_rounded(),\n clap->get_height_rounded() );\n }\n\n auto irot = std::dynamic_pointer_cast(prop.property);\n if (irot) {\n if (irot->get_rotation()==90 ||\n irot->get_rotation()==270) {\n // swap width and height\n image->set_resolution( image->get_height(),\n image->get_width() );\n }\n }\n }\n\n auto colr = std::dynamic_pointer_cast(prop.property);\n if (colr) {\n auto profile = colr->get_color_profile();\n\n image->set_color_profile(profile);\n\n // if this is a grid item we assign the first one's color profile\n // to the main image which is supposed to be a grid\n\n // TODO: this condition is not correct. It would also classify a secondary image as a 'grid item'.\n // We have to set the grid-image color profile in another way...\n const bool is_grid_item = !image->is_primary() && !image->is_alpha_channel() && !image->is_depth_channel();\n\n if (primary_is_grid &&\n !primary_colr_set &&\n is_grid_item) {\n m_primary_image->set_color_profile(profile);\n primary_colr_set = true;\n }\n }\n }\n }\n\n\n // --- read metadata and assign to image\n\n for (heif_item_id id : image_IDs) {\n std::string item_type = m_heif_file->get_item_type(id);\n std::string content_type = m_heif_file->get_content_type(id);\n if (item_type == \"Exif\" ||\n (item_type==\"mime\" && content_type==\"application/rdf+xml\")) {\n std::shared_ptr metadata = std::make_shared();\n metadata->item_id = id;\n metadata->item_type = item_type;\n metadata->content_type = content_type;\n\n Error err = m_heif_file->get_compressed_image_data(id, &(metadata->m_data));\n if (err) {\n return err;\n }\n\n //std::cerr.write((const char*)data.data(), data.size());\n\n\n // --- assign metadata to the image\n\n if (iref_box) {\n std::vector references = iref_box->get_references_from(id);\n for (const auto& ref : references) {\n if (ref.header.get_short_type() == fourcc(\"cdsc\")) {\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Exif data not correctly assigned to image\");\n }\n\n uint32_t exif_image_id = refs[0];\n auto img_iter = m_all_images.find(exif_image_id);\n if (img_iter == m_all_images.end()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Exif data assigned to non-existing image\");\n }\n\n img_iter->second->add_metadata(metadata);\n }\n }\n }\n }\n }\n\n return Error::Ok;\n}","target":"Error HeifContext::interpret_heif_file()\n{\n m_all_images.clear();\n m_top_level_images.clear();\n m_primary_image.reset();\n\n\n // --- reference all non-hidden images\n\n std::vector image_IDs = m_heif_file->get_item_IDs();\n\n bool primary_is_grid = false;\n for (heif_item_id id : image_IDs) {\n auto infe_box = m_heif_file->get_infe_box(id);\n if (!infe_box) {\n // TODO(farindk): Should we return an error instead of skipping the invalid id?\n continue;\n }\n\n if (item_type_is_image(infe_box->get_item_type())) {\n auto image = std::make_shared(this, id);\n m_all_images.insert(std::make_pair(id, image));\n\n if (!infe_box->is_hidden_item()) {\n if (id==m_heif_file->get_primary_image_ID()) {\n image->set_primary(true);\n m_primary_image = image;\n primary_is_grid = infe_box->get_item_type() == \"grid\";\n }\n\n m_top_level_images.push_back(image);\n }\n }\n }\n\n\n if (!m_primary_image) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"'pitm' box references a non-existing image\");\n }\n\n\n // --- remove thumbnails from top-level images and assign to their respective image\n\n auto iref_box = m_heif_file->get_iref_box();\n if (iref_box) {\n // m_top_level_images.clear();\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::vector references = iref_box->get_references_from(image->get_id());\n\n for (const Box_iref::Reference& ref : references) {\n uint32_t type = ref.header.get_short_type();\n\n if (type==fourcc(\"thmb\")) {\n // --- this is a thumbnail image, attach to the main image\n\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Too many thumbnail references\");\n }\n\n image->set_is_thumbnail_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (master_iter == m_all_images.end()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Thumbnail references a non-existing image\");\n }\n\n if (master_iter->second->is_thumbnail()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Thumbnail references another thumbnail\");\n }\n\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive thumbnail image detected\");\n }\n master_iter->second->add_thumbnail(image);\n\n remove_top_level_image(image);\n }\n else if (type==fourcc(\"auxl\")) {\n\n // --- this is an auxiliary image\n // check whether it is an alpha channel and attach to the main image if yes\n\n std::vector properties;\n Error err = m_heif_file->get_properties(image->get_id(), properties);\n if (err) {\n return err;\n }\n\n std::shared_ptr auxC_property;\n for (const auto& property : properties) {\n auto auxC = std::dynamic_pointer_cast(property.property);\n if (auxC) {\n auxC_property = auxC;\n }\n }\n\n if (!auxC_property) {\n std::stringstream sstr;\n sstr << \"No auxC property for image \" << image->get_id();\n return Error(heif_error_Invalid_input,\n heif_suberror_Auxiliary_image_type_unspecified,\n sstr.str());\n }\n\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Too many auxiliary image references\");\n }\n\n\n // alpha channel\n\n if (auxC_property->get_aux_type() == \"urn:mpeg:avc:2015:auxid:1\" ||\n auxC_property->get_aux_type() == \"urn:mpeg:hevc:2015:auxid:1\") {\n image->set_is_alpha_channel_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (master_iter == m_all_images.end()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Non-existing alpha image referenced\");\n }\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive alpha image detected\");\n }\n master_iter->second->set_alpha_channel(image);\n }\n\n\n // depth channel\n\n if (auxC_property->get_aux_type() == \"urn:mpeg:hevc:2015:auxid:2\") {\n image->set_is_depth_channel_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive depth image detected\");\n }\n master_iter->second->set_depth_channel(image);\n\n auto subtypes = auxC_property->get_subtypes();\n\n std::vector> sei_messages;\n Error err = decode_hevc_aux_sei_messages(subtypes, sei_messages);\n\n for (auto& msg : sei_messages) {\n auto depth_msg = std::dynamic_pointer_cast(msg);\n if (depth_msg) {\n image->set_depth_representation_info(*depth_msg);\n }\n }\n }\n\n remove_top_level_image(image);\n }\n else {\n // 'image' is a normal image, keep it as a top-level image\n }\n }\n }\n }\n\n\n // --- check that HEVC images have an hvcC property\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::shared_ptr infe = m_heif_file->get_infe_box(image->get_id());\n if (infe->get_item_type() == \"hvc1\") {\n\n auto ipma = m_heif_file->get_ipma_box();\n auto ipco = m_heif_file->get_ipco_box();\n\n if (!ipco->get_property_for_item_ID(image->get_id(), ipma, fourcc(\"hvcC\"))) {\n return Error(heif_error_Invalid_input,\n heif_suberror_No_hvcC_box,\n \"No hvcC property in hvc1 type image\");\n }\n }\n }\n\n\n // --- read through properties for each image and extract image resolutions\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::vector properties;\n\n Error err = m_heif_file->get_properties(pair.first, properties);\n if (err) {\n return err;\n }\n\n bool ispe_read = false;\n bool primary_colr_set = false;\n for (const auto& prop : properties) {\n auto ispe = std::dynamic_pointer_cast(prop.property);\n if (ispe) {\n uint32_t width = ispe->get_width();\n uint32_t height = ispe->get_height();\n\n\n // --- check whether the image size is \"too large\"\n\n if (width >= static_cast(MAX_IMAGE_WIDTH) ||\n height >= static_cast(MAX_IMAGE_HEIGHT)) {\n std::stringstream sstr;\n sstr << \"Image size \" << width << \"x\" << height << \" exceeds the maximum image size \"\n << MAX_IMAGE_WIDTH << \"x\" << MAX_IMAGE_HEIGHT << \"\\n\";\n\n return Error(heif_error_Memory_allocation_error,\n heif_suberror_Security_limit_exceeded,\n sstr.str());\n }\n\n image->set_resolution(width, height);\n image->set_ispe_resolution(width, height);\n ispe_read = true;\n }\n\n if (ispe_read) {\n auto clap = std::dynamic_pointer_cast(prop.property);\n if (clap) {\n image->set_resolution( clap->get_width_rounded(),\n clap->get_height_rounded() );\n }\n\n auto irot = std::dynamic_pointer_cast(prop.property);\n if (irot) {\n if (irot->get_rotation()==90 ||\n irot->get_rotation()==270) {\n // swap width and height\n image->set_resolution( image->get_height(),\n image->get_width() );\n }\n }\n }\n\n auto colr = std::dynamic_pointer_cast(prop.property);\n if (colr) {\n auto profile = colr->get_color_profile();\n\n image->set_color_profile(profile);\n\n // if this is a grid item we assign the first one's color profile\n // to the main image which is supposed to be a grid\n\n // TODO: this condition is not correct. It would also classify a secondary image as a 'grid item'.\n // We have to set the grid-image color profile in another way...\n const bool is_grid_item = !image->is_primary() && !image->is_alpha_channel() && !image->is_depth_channel();\n\n if (primary_is_grid &&\n !primary_colr_set &&\n is_grid_item) {\n m_primary_image->set_color_profile(profile);\n primary_colr_set = true;\n }\n }\n }\n }\n\n\n // --- read metadata and assign to image\n\n for (heif_item_id id : image_IDs) {\n std::string item_type = m_heif_file->get_item_type(id);\n std::string content_type = m_heif_file->get_content_type(id);\n if (item_type == \"Exif\" ||\n (item_type==\"mime\" && content_type==\"application/rdf+xml\")) {\n std::shared_ptr metadata = std::make_shared();\n metadata->item_id = id;\n metadata->item_type = item_type;\n metadata->content_type = content_type;\n\n Error err = m_heif_file->get_compressed_image_data(id, &(metadata->m_data));\n if (err) {\n return err;\n }\n\n //std::cerr.write((const char*)data.data(), data.size());\n\n\n // --- assign metadata to the image\n\n if (iref_box) {\n std::vector references = iref_box->get_references_from(id);\n for (const auto& ref : references) {\n if (ref.header.get_short_type() == fourcc(\"cdsc\")) {\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Exif data not correctly assigned to image\");\n }\n\n uint32_t exif_image_id = refs[0];\n auto img_iter = m_all_images.find(exif_image_id);\n if (img_iter == m_all_images.end()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Exif data assigned to non-existing image\");\n }\n\n img_iter->second->add_metadata(metadata);\n }\n }\n }\n }\n }\n\n return Error::Ok;\n}","lang":"cpp","vul_type":"cwe-416","target_token_count":2617,"sven_meta":{"func_name":"HeifContext::interpret_heif_file","file_name":"libheif/heif_context.cc","commit_link":"github.com/strukturag/libheif/commit/995a4283d8ed2d0d2c1ceb1a577b993df2f0e014","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#39-5e2ddff81c75","input":"static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image *image, *image2=NULL,\n *rotated_image;\n register Quantum *q;\n\n unsigned int status;\n MATHeader MATLAB_HDR;\n size_t size;\n size_t CellType;\n QuantumInfo *quantum_info;\n ImageInfo *clone_info;\n int i;\n ssize_t ldblk;\n unsigned char *BImgBuff = NULL;\n double MinVal, MaxVal;\n unsigned z, z2;\n unsigned Frames;\n int logging;\n int sample_size;\n MagickOffsetType filepos=0x80;\n BlobInfo *blob;\n size_t one;\n\n unsigned int (*ReadBlobXXXLong)(Image *image);\n unsigned short (*ReadBlobXXXShort)(Image *image);\n void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data);\n void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data);\n\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n logging = LogMagickEvent(CoderEvent,GetMagickModule(),\"enter\");\n\n /*\n Open image file.\n */\n image = AcquireImage(image_info,exception);\n\n status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read MATLAB image.\n */\n quantum_info=(QuantumInfo *) NULL;\n clone_info=(ImageInfo *) NULL;\n if (ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (strncmp(MATLAB_HDR.identific,\"MATLAB\",6) != 0)\n {\n image2=ReadMATImageV4(image_info,image,exception);\n if (image2 == NULL)\n goto MATLAB_KO;\n image=image2;\n goto END_OF_READING;\n }\n MATLAB_HDR.Version = ReadBlobLSBShort(image);\n if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Endian %c%c\",\n MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]);\n if (!strncmp(MATLAB_HDR.EndianIndicator, \"IM\", 2))\n {\n ReadBlobXXXLong = ReadBlobLSBLong;\n ReadBlobXXXShort = ReadBlobLSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesLSB;\n ReadBlobFloatsXXX = ReadBlobFloatsLSB;\n image->endian = LSBEndian;\n }\n else if (!strncmp(MATLAB_HDR.EndianIndicator, \"MI\", 2))\n {\n ReadBlobXXXLong = ReadBlobMSBLong;\n ReadBlobXXXShort = ReadBlobMSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesMSB;\n ReadBlobFloatsXXX = ReadBlobFloatsMSB;\n image->endian = MSBEndian;\n }\n else\n goto MATLAB_KO; /* unsupported endian */\n\n if (strncmp(MATLAB_HDR.identific, \"MATLAB\", 6))\n {\nMATLAB_KO:\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n if (clone_info != (ImageInfo *) NULL)\n clone_info=DestroyImageInfo(clone_info);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n filepos = TellBlob(image);\n while(!EOFBlob(image)) /* object parser loop */\n {\n Frames = 1;\n (void) SeekBlob(image,filepos,SEEK_SET);\n /* printf(\"pos=%X\\n\",TellBlob(image)); */\n\n MATLAB_HDR.DataType = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n if((MagickSizeType) (MATLAB_HDR.ObjectSize+filepos) > GetBlobSize(image))\n goto MATLAB_KO;\n filepos += MATLAB_HDR.ObjectSize + 4 + 4;\n\n clone_info=CloneImageInfo(image_info);\n image2 = image;\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if(MATLAB_HDR.DataType == miCOMPRESSED)\n {\n image2 = decompress_block(image,&MATLAB_HDR.ObjectSize,clone_info,exception);\n if(image2==NULL) continue;\n MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */\n }\n#endif\n\n if (MATLAB_HDR.DataType!=miMATRIX)\n {\n clone_info=DestroyImageInfo(clone_info);\n continue; /* skip another objects. */\n }\n\n MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2);\n MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2);\n\n MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2);\n MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF;\n MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF;\n\n MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2);\n if(image!=image2)\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2);\n MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeX = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeY = ReadBlobXXXLong(image2);\n\n\n switch(MATLAB_HDR.DimFlag)\n {\n case 8: z2=z=1; break; /* 2D matrix*/\n case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/\n (void) ReadBlobXXXLong(image2);\n if(z!=3) ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n break;\n case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */\n if(z!=3 && z!=1)\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n Frames = ReadBlobXXXLong(image2);\n if (Frames == 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n break;\n default:\n if (clone_info != (ImageInfo *) NULL)\n clone_info=DestroyImageInfo(clone_info);\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n }\n\n MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2);\n MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2);\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.StructureClass %d\",MATLAB_HDR.StructureClass);\n if (MATLAB_HDR.StructureClass != mxCHAR_CLASS &&\n MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */\n MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */\n MATLAB_HDR.StructureClass != mxINT8_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */\n MATLAB_HDR.StructureClass != mxINT16_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */\n MATLAB_HDR.StructureClass != mxINT32_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */\n MATLAB_HDR.StructureClass != mxINT64_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */\n ThrowReaderException(CoderError,\"UnsupportedCellTypeInTheMatrix\");\n\n switch (MATLAB_HDR.NameFlag)\n {\n case 0:\n size = ReadBlobXXXLong(image2); /* Object name string size */\n size = 4 * (ssize_t) ((size + 3 + 1) / 4);\n (void) SeekBlob(image2, size, SEEK_CUR);\n break;\n case 1:\n case 2:\n case 3:\n case 4:\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */\n break;\n default:\n goto MATLAB_KO;\n }\n\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.CellType: %.20g\",(double) CellType);\n\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */\n\n NEXT_FRAME:\n switch (CellType)\n {\n case miINT8:\n case miUINT8:\n sample_size = 8;\n if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL)\n image->depth = 1;\n else\n image->depth = 8; /* Byte type cell */\n ldblk = (ssize_t) MATLAB_HDR.SizeX;\n break;\n case miINT16:\n case miUINT16:\n sample_size = 16;\n image->depth = 16; /* Word type cell */\n ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX);\n break;\n case miINT32:\n case miUINT32:\n sample_size = 32;\n image->depth = 32; /* Dword type cell */\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miINT64:\n case miUINT64:\n sample_size = 64;\n image->depth = 64; /* Qword type cell */\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n case miSINGLE:\n sample_size = 32;\n image->depth = 32; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex float type cell */\n }\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miDOUBLE:\n sample_size = 64;\n image->depth = 64; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\nDisableMSCWarning(4127)\n if (sizeof(double) != 8)\nRestoreMSCWarning\n ThrowReaderException(CoderError, \"IncompatibleSizeOfDouble\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex double type cell */\n }\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n default:\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n if (clone_info)\n clone_info=DestroyImageInfo(clone_info);\n ThrowReaderException(CoderError, \"UnsupportedCellTypeInTheMatrix\");\n }\n (void) sample_size;\n image->columns = MATLAB_HDR.SizeX;\n image->rows = MATLAB_HDR.SizeY;\n one=1;\n image->colors = one << image->depth;\n if (image->columns == 0 || image->rows == 0)\n goto MATLAB_KO;\n if((unsigned long)ldblk*MATLAB_HDR.SizeY > MATLAB_HDR.ObjectSize)\n goto MATLAB_KO;\n /* Image is gray when no complex flag is set and 2D Matrix */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n {\n image->type=GrayscaleType;\n SetImageColorspace(image,GRAYColorspace,exception);\n }\n\n\n /*\n If ping is true, then only set image size and colors without\n reading any image data.\n */\n if (image_info->ping)\n {\n size_t temp = image->columns;\n image->columns = image->rows;\n image->rows = temp;\n goto done_reading; /* !!!!!! BAD !!!! */\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n {\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n return(DestroyImageList(image));\n }\n quantum_info=AcquireQuantumInfo(clone_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n /* ----- Load raster data ----- */\n BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */\n if (BImgBuff == NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(BImgBuff,0,ldblk*sizeof(double));\n\n MinVal = 0;\n MaxVal = 0;\n if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum);\n }\n\n /* Main loop for reading all scanlines */\n if(z==1) z=0; /* read grey scanlines */\n /* else read color scanlines */\n do\n {\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT set image pixels returns unexpected NULL on a row %u.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto done_reading; /* Skip image rotation, when cannot set image pixels */\n }\n if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT cannot read scanrow %u from a file.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL))\n {\n FixLogical((unsigned char *)BImgBuff,ldblk);\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n {\nImportQuantumPixelsFailed:\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to ImportQuantumPixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n break;\n }\n }\n else\n {\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n goto ImportQuantumPixelsFailed;\n\n\n if (z<=1 && /* fix only during a last pass z==0 || z==1 */\n (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64))\n FixSignedValues(image,q,MATLAB_HDR.SizeX);\n }\n\n if (!SyncAuthenticPixels(image,exception))\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to sync image pixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n }\n } while(z-- >= 2);\nExitLoop:\n\n\n /* Read complex part of numbers here */\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* Find Min and Max Values for complex parts of floats */\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/\n\n if (CellType==miDOUBLE || CellType==miSINGLE)\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal);\n }\n\n if (CellType==miDOUBLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff);\n InsertComplexDoubleRow(image, (double *)BImgBuff, i, MinVal, MaxVal,\n exception);\n }\n\n if (CellType==miSINGLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff);\n InsertComplexFloatRow(image,(float *)BImgBuff,i,MinVal,MaxVal,\n exception);\n }\n }\n\n /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n image->type=GrayscaleType;\n if (image->depth == 1)\n image->type=BilevelType;\n\n if(image2==image)\n image2 = NULL; /* Remove shadow copy to an image before rotation. */\n\n /* Rotate image. */\n rotated_image = RotateImage(image, 90.0, exception);\n if (rotated_image != (Image *) NULL)\n {\n /* Remove page offsets added by RotateImage */\n rotated_image->page.x=0;\n rotated_image->page.y=0;\n\n blob = rotated_image->blob;\n rotated_image->blob = image->blob;\n rotated_image->colors = image->colors;\n image->blob = blob;\n AppendImageToList(&image,rotated_image);\n DeleteImageFromList(&image);\n }\n\ndone_reading:\n\n if(image2!=NULL)\n if(image2!=image)\n {\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n if (image->next == (Image *) NULL) break;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n\n /* row scan buffer is no longer needed */\n RelinquishMagickMemory(BImgBuff);\n BImgBuff = NULL;\n\n if(--Frames>0)\n {\n z = z2;\n if(image2==NULL) image2 = image;\n goto NEXT_FRAME;\n }\n if ((image2!=NULL) && (image2!=image)) /* Does shadow temporary decompressed image exist? */\n {\n/* CloseBlob(image2); */\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n if (clone_info)\n clone_info=DestroyImageInfo(clone_info);\n }\n\n RelinquishMagickMemory(BImgBuff);\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\nEND_OF_READING:\n if (clone_info)\n clone_info=DestroyImageInfo(clone_info);\n CloseBlob(image);\n\n\n {\n Image *p;\n ssize_t scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n\n /*\n Fix scene numbers\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=scene++;\n }\n\n if(clone_info != NULL) /* cleanup garbage file from compression */\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n DestroyImageInfo(clone_info);\n clone_info = NULL;\n }\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\"return\");\n if (image==NULL)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\")\n else\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n return (image);\n}","target":"static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image *image, *image2=NULL,\n *rotated_image;\n register Quantum *q;\n\n unsigned int status;\n MATHeader MATLAB_HDR;\n size_t size;\n size_t CellType;\n QuantumInfo *quantum_info;\n ImageInfo *clone_info;\n int i;\n ssize_t ldblk;\n unsigned char *BImgBuff = NULL;\n double MinVal, MaxVal;\n unsigned z, z2;\n unsigned Frames;\n int logging;\n int sample_size;\n MagickOffsetType filepos=0x80;\n BlobInfo *blob;\n size_t one;\n\n unsigned int (*ReadBlobXXXLong)(Image *image);\n unsigned short (*ReadBlobXXXShort)(Image *image);\n void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data);\n void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data);\n\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n logging = LogMagickEvent(CoderEvent,GetMagickModule(),\"enter\");\n\n /*\n Open image file.\n */\n image = AcquireImage(image_info,exception);\n\n status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read MATLAB image.\n */\n quantum_info=(QuantumInfo *) NULL;\n clone_info=(ImageInfo *) NULL;\n if (ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (strncmp(MATLAB_HDR.identific,\"MATLAB\",6) != 0)\n {\n image2=ReadMATImageV4(image_info,image,exception);\n if (image2 == NULL)\n goto MATLAB_KO;\n image=image2;\n goto END_OF_READING;\n }\n MATLAB_HDR.Version = ReadBlobLSBShort(image);\n if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Endian %c%c\",\n MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]);\n if (!strncmp(MATLAB_HDR.EndianIndicator, \"IM\", 2))\n {\n ReadBlobXXXLong = ReadBlobLSBLong;\n ReadBlobXXXShort = ReadBlobLSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesLSB;\n ReadBlobFloatsXXX = ReadBlobFloatsLSB;\n image->endian = LSBEndian;\n }\n else if (!strncmp(MATLAB_HDR.EndianIndicator, \"MI\", 2))\n {\n ReadBlobXXXLong = ReadBlobMSBLong;\n ReadBlobXXXShort = ReadBlobMSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesMSB;\n ReadBlobFloatsXXX = ReadBlobFloatsMSB;\n image->endian = MSBEndian;\n }\n else\n goto MATLAB_KO; /* unsupported endian */\n\n if (strncmp(MATLAB_HDR.identific, \"MATLAB\", 6))\n {\nMATLAB_KO:\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n if (clone_info != (ImageInfo *) NULL)\n clone_info=DestroyImageInfo(clone_info);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n filepos = TellBlob(image);\n while(!EOFBlob(image)) /* object parser loop */\n {\n Frames = 1;\n (void) SeekBlob(image,filepos,SEEK_SET);\n /* printf(\"pos=%X\\n\",TellBlob(image)); */\n\n MATLAB_HDR.DataType = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n if((MagickSizeType) (MATLAB_HDR.ObjectSize+filepos) > GetBlobSize(image))\n goto MATLAB_KO;\n filepos += MATLAB_HDR.ObjectSize + 4 + 4;\n\n clone_info=CloneImageInfo(image_info);\n image2 = image;\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if(MATLAB_HDR.DataType == miCOMPRESSED)\n {\n image2 = decompress_block(image,&MATLAB_HDR.ObjectSize,clone_info,exception);\n if(image2==NULL) continue;\n MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */\n }\n#endif\n\n if (MATLAB_HDR.DataType!=miMATRIX)\n {\n clone_info=DestroyImageInfo(clone_info);\n continue; /* skip another objects. */\n }\n\n MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2);\n MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2);\n\n MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2);\n MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF;\n MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF;\n\n MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2);\n if(image!=image2)\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2);\n MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeX = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeY = ReadBlobXXXLong(image2);\n\n\n switch(MATLAB_HDR.DimFlag)\n {\n case 8: z2=z=1; break; /* 2D matrix*/\n case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/\n (void) ReadBlobXXXLong(image2);\n if(z!=3) ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n break;\n case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */\n if(z!=3 && z!=1)\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n Frames = ReadBlobXXXLong(image2);\n if (Frames == 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n break;\n default:\n if (clone_info != (ImageInfo *) NULL)\n clone_info=DestroyImageInfo(clone_info);\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n }\n\n MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2);\n MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2);\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.StructureClass %d\",MATLAB_HDR.StructureClass);\n if (MATLAB_HDR.StructureClass != mxCHAR_CLASS &&\n MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */\n MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */\n MATLAB_HDR.StructureClass != mxINT8_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */\n MATLAB_HDR.StructureClass != mxINT16_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */\n MATLAB_HDR.StructureClass != mxINT32_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */\n MATLAB_HDR.StructureClass != mxINT64_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */\n ThrowReaderException(CoderError,\"UnsupportedCellTypeInTheMatrix\");\n\n switch (MATLAB_HDR.NameFlag)\n {\n case 0:\n size = ReadBlobXXXLong(image2); /* Object name string size */\n size = 4 * (ssize_t) ((size + 3 + 1) / 4);\n (void) SeekBlob(image2, size, SEEK_CUR);\n break;\n case 1:\n case 2:\n case 3:\n case 4:\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */\n break;\n default:\n goto MATLAB_KO;\n }\n\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.CellType: %.20g\",(double) CellType);\n\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */\n\n NEXT_FRAME:\n switch (CellType)\n {\n case miINT8:\n case miUINT8:\n sample_size = 8;\n if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL)\n image->depth = 1;\n else\n image->depth = 8; /* Byte type cell */\n ldblk = (ssize_t) MATLAB_HDR.SizeX;\n break;\n case miINT16:\n case miUINT16:\n sample_size = 16;\n image->depth = 16; /* Word type cell */\n ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX);\n break;\n case miINT32:\n case miUINT32:\n sample_size = 32;\n image->depth = 32; /* Dword type cell */\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miINT64:\n case miUINT64:\n sample_size = 64;\n image->depth = 64; /* Qword type cell */\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n case miSINGLE:\n sample_size = 32;\n image->depth = 32; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex float type cell */\n }\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miDOUBLE:\n sample_size = 64;\n image->depth = 64; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\nDisableMSCWarning(4127)\n if (sizeof(double) != 8)\nRestoreMSCWarning\n ThrowReaderException(CoderError, \"IncompatibleSizeOfDouble\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex double type cell */\n }\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n default:\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n if (clone_info)\n clone_info=DestroyImageInfo(clone_info);\n ThrowReaderException(CoderError, \"UnsupportedCellTypeInTheMatrix\");\n }\n (void) sample_size;\n image->columns = MATLAB_HDR.SizeX;\n image->rows = MATLAB_HDR.SizeY;\n one=1;\n image->colors = one << image->depth;\n if (image->columns == 0 || image->rows == 0)\n goto MATLAB_KO;\n if((unsigned long)ldblk*MATLAB_HDR.SizeY > MATLAB_HDR.ObjectSize)\n goto MATLAB_KO;\n /* Image is gray when no complex flag is set and 2D Matrix */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n {\n image->type=GrayscaleType;\n SetImageColorspace(image,GRAYColorspace,exception);\n }\n\n\n /*\n If ping is true, then only set image size and colors without\n reading any image data.\n */\n if (image_info->ping)\n {\n size_t temp = image->columns;\n image->columns = image->rows;\n image->rows = temp;\n goto done_reading; /* !!!!!! BAD !!!! */\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n {\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n return(DestroyImageList(image));\n }\n quantum_info=AcquireQuantumInfo(clone_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n /* ----- Load raster data ----- */\n BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */\n if (BImgBuff == NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(BImgBuff,0,ldblk*sizeof(double));\n\n MinVal = 0;\n MaxVal = 0;\n if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum);\n }\n\n /* Main loop for reading all scanlines */\n if(z==1) z=0; /* read grey scanlines */\n /* else read color scanlines */\n do\n {\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT set image pixels returns unexpected NULL on a row %u.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto done_reading; /* Skip image rotation, when cannot set image pixels */\n }\n if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT cannot read scanrow %u from a file.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL))\n {\n FixLogical((unsigned char *)BImgBuff,ldblk);\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n {\nImportQuantumPixelsFailed:\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to ImportQuantumPixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n break;\n }\n }\n else\n {\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n goto ImportQuantumPixelsFailed;\n\n\n if (z<=1 && /* fix only during a last pass z==0 || z==1 */\n (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64))\n FixSignedValues(image,q,MATLAB_HDR.SizeX);\n }\n\n if (!SyncAuthenticPixels(image,exception))\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to sync image pixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n }\n } while(z-- >= 2);\nExitLoop:\n\n\n /* Read complex part of numbers here */\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* Find Min and Max Values for complex parts of floats */\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/\n\n if (CellType==miDOUBLE || CellType==miSINGLE)\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal);\n }\n\n if (CellType==miDOUBLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff);\n InsertComplexDoubleRow(image, (double *)BImgBuff, i, MinVal, MaxVal,\n exception);\n }\n\n if (CellType==miSINGLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff);\n InsertComplexFloatRow(image,(float *)BImgBuff,i,MinVal,MaxVal,\n exception);\n }\n }\n\n /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n image->type=GrayscaleType;\n if (image->depth == 1)\n image->type=BilevelType;\n\n if(image2==image)\n image2 = NULL; /* Remove shadow copy to an image before rotation. */\n\n /* Rotate image. */\n rotated_image = RotateImage(image, 90.0, exception);\n if (rotated_image != (Image *) NULL)\n {\n /* Remove page offsets added by RotateImage */\n rotated_image->page.x=0;\n rotated_image->page.y=0;\n\n blob = rotated_image->blob;\n rotated_image->blob = image->blob;\n rotated_image->colors = image->colors;\n image->blob = blob;\n AppendImageToList(&image,rotated_image);\n DeleteImageFromList(&image);\n }\n\ndone_reading:\n\n if(image2!=NULL)\n if(image2!=image)\n {\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n if (image->next == (Image *) NULL) break;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n\n /* row scan buffer is no longer needed */\n RelinquishMagickMemory(BImgBuff);\n BImgBuff = NULL;\n\n if(--Frames>0)\n {\n z = z2;\n if(image2==NULL) image2 = image;\n goto NEXT_FRAME;\n }\n if ((image2!=NULL) && (image2!=image)) /* Does shadow temporary decompressed image exist? */\n {\n/* CloseBlob(image2); */\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n if (clone_info)\n clone_info=DestroyImageInfo(clone_info);\n }\n\n RelinquishMagickMemory(BImgBuff);\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\nEND_OF_READING:\n CloseBlob(image);\n\n\n {\n Image *p;\n ssize_t scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n if (tmp == image2)\n image2=(Image *) NULL;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n\n /*\n Fix scene numbers\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=scene++;\n }\n\n if(clone_info != NULL) /* cleanup garbage file from compression */\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n DestroyImageInfo(clone_info);\n clone_info = NULL;\n }\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\"return\");\n if (image==NULL)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\")\n else\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n return (image);\n}","lang":"c","vul_type":"cwe-416","target_token_count":4907,"sven_meta":{"func_name":"ReadMATImage","file_name":"coders/mat.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/04178de2247e353fc095846784b9a10fefdbf890","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#40-b0163fcddb5c","input":"static OPJ_BOOL opj_j2k_write_mco( opj_j2k_t *p_j2k,\n struct opj_stream_private *p_stream,\n struct opj_event_mgr * p_manager\n )\n{\n OPJ_BYTE * l_current_data = 00;\n OPJ_UINT32 l_mco_size;\n opj_tcp_t * l_tcp = 00;\n opj_simple_mcc_decorrelation_data_t * l_mcc_record;\n OPJ_UINT32 i;\n\n /* preconditions */\n assert(p_j2k != 00);\n assert(p_manager != 00);\n assert(p_stream != 00);\n\n l_tcp =&(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]);\n l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data;\n\n l_mco_size = 5 + l_tcp->m_nb_mcc_records;\n if (l_mco_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) {\n\n OPJ_BYTE *new_header_tile_data = (OPJ_BYTE *) opj_realloc(p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_mco_size);\n if (! new_header_tile_data) {\n opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data);\n p_j2k->m_specific_param.m_encoder.m_header_tile_data = NULL;\n p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0;\n opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to write MCO marker\\n\");\n return OPJ_FALSE;\n }\n p_j2k->m_specific_param.m_encoder.m_header_tile_data = new_header_tile_data;\n p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = l_mco_size;\n }\n\n opj_write_bytes(l_current_data,J2K_MS_MCO,2); /* MCO */\n l_current_data += 2;\n\n opj_write_bytes(l_current_data,l_mco_size-2,2); /* Lmco */\n l_current_data += 2;\n\n opj_write_bytes(l_current_data,l_tcp->m_nb_mcc_records,1); /* Nmco : only one tranform stage*/\n ++l_current_data;\n\n l_mcc_record = l_tcp->m_mcc_records;\n for (i=0;im_nb_mcc_records;++i) {\n opj_write_bytes(l_current_data,l_mcc_record->m_index,1);/* Imco -> use the mcc indicated by 1*/\n ++l_current_data;\n\n ++l_mcc_record;\n }\n\n if (opj_stream_write_data(p_stream,p_j2k->m_specific_param.m_encoder.m_header_tile_data,l_mco_size,p_manager) != l_mco_size) {\n return OPJ_FALSE;\n }\n\n return OPJ_TRUE;\n}","target":"static OPJ_BOOL opj_j2k_write_mco( opj_j2k_t *p_j2k,\n struct opj_stream_private *p_stream,\n struct opj_event_mgr * p_manager\n )\n{\n OPJ_BYTE * l_current_data = 00;\n OPJ_UINT32 l_mco_size;\n opj_tcp_t * l_tcp = 00;\n opj_simple_mcc_decorrelation_data_t * l_mcc_record;\n OPJ_UINT32 i;\n\n /* preconditions */\n assert(p_j2k != 00);\n assert(p_manager != 00);\n assert(p_stream != 00);\n\n l_tcp =&(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]);\n\t\n l_mco_size = 5 + l_tcp->m_nb_mcc_records;\n if (l_mco_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) {\n\n OPJ_BYTE *new_header_tile_data = (OPJ_BYTE *) opj_realloc(p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_mco_size);\n if (! new_header_tile_data) {\n opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data);\n p_j2k->m_specific_param.m_encoder.m_header_tile_data = NULL;\n p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0;\n opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to write MCO marker\\n\");\n return OPJ_FALSE;\n }\n p_j2k->m_specific_param.m_encoder.m_header_tile_data = new_header_tile_data;\n p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = l_mco_size;\n }\n l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data;\n\n\n opj_write_bytes(l_current_data,J2K_MS_MCO,2); /* MCO */\n l_current_data += 2;\n\n opj_write_bytes(l_current_data,l_mco_size-2,2); /* Lmco */\n l_current_data += 2;\n\n opj_write_bytes(l_current_data,l_tcp->m_nb_mcc_records,1); /* Nmco : only one tranform stage*/\n ++l_current_data;\n\n l_mcc_record = l_tcp->m_mcc_records;\n for (i=0;im_nb_mcc_records;++i) {\n opj_write_bytes(l_current_data,l_mcc_record->m_index,1);/* Imco -> use the mcc indicated by 1*/\n ++l_current_data;\n ++l_mcc_record;\n }\n\n if (opj_stream_write_data(p_stream,p_j2k->m_specific_param.m_encoder.m_header_tile_data,l_mco_size,p_manager) != l_mco_size) {\n return OPJ_FALSE;\n }\n\n return OPJ_TRUE;\n}","lang":"c","vul_type":"cwe-416","target_token_count":641,"sven_meta":{"func_name":"opj_j2k_write_mco","file_name":"src/lib/openjp2/j2k.c","commit_link":"github.com/uclouvain/openjpeg/commit/940100c28ae28931722290794889cf84a92c5f6f","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#41-7c0967581c5b","input":"tcpmss_mangle_packet(struct sk_buff *skb,\n\t\t const struct xt_action_param *par,\n\t\t unsigned int family,\n\t\t unsigned int tcphoff,\n\t\t unsigned int minlen)\n{\n\tconst struct xt_tcpmss_info *info = par->targinfo;\n\tstruct tcphdr *tcph;\n\tint len, tcp_hdrlen;\n\tunsigned int i;\n\t__be16 oldval;\n\tu16 newmss;\n\tu8 *opt;\n\n\t/* This is a fragment, no TCP header is available */\n\tif (par->fragoff != 0)\n\t\treturn 0;\n\n\tif (!skb_make_writable(skb, skb->len))\n\t\treturn -1;\n\n\tlen = skb->len - tcphoff;\n\tif (len < (int)sizeof(struct tcphdr))\n\t\treturn -1;\n\n\ttcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);\n\ttcp_hdrlen = tcph->doff * 4;\n\n\tif (len < tcp_hdrlen)\n\t\treturn -1;\n\n\tif (info->mss == XT_TCPMSS_CLAMP_PMTU) {\n\t\tstruct net *net = xt_net(par);\n\t\tunsigned int in_mtu = tcpmss_reverse_mtu(net, skb, family);\n\t\tunsigned int min_mtu = min(dst_mtu(skb_dst(skb)), in_mtu);\n\n\t\tif (min_mtu <= minlen) {\n\t\t\tnet_err_ratelimited(\"unknown or invalid path-MTU (%u)\\n\",\n\t\t\t\t\t min_mtu);\n\t\t\treturn -1;\n\t\t}\n\t\tnewmss = min_mtu - minlen;\n\t} else\n\t\tnewmss = info->mss;\n\n\topt = (u_int8_t *)tcph;\n\tfor (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += optlen(opt, i)) {\n\t\tif (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) {\n\t\t\tu_int16_t oldmss;\n\n\t\t\toldmss = (opt[i+2] << 8) | opt[i+3];\n\n\t\t\t/* Never increase MSS, even when setting it, as\n\t\t\t * doing so results in problems for hosts that rely\n\t\t\t * on MSS being set correctly.\n\t\t\t */\n\t\t\tif (oldmss <= newmss)\n\t\t\t\treturn 0;\n\n\t\t\topt[i+2] = (newmss & 0xff00) >> 8;\n\t\t\topt[i+3] = newmss & 0x00ff;\n\n\t\t\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t\t\t htons(oldmss), htons(newmss),\n\t\t\t\t\t\t false);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t/* There is data after the header so the option can't be added\n\t * without moving it, and doing so may make the SYN packet\n\t * itself too large. Accept the packet unmodified instead.\n\t */\n\tif (len > tcp_hdrlen)\n\t\treturn 0;\n\n\t/*\n\t * MSS Option not found ?! add it..\n\t */\n\tif (skb_tailroom(skb) < TCPOLEN_MSS) {\n\t\tif (pskb_expand_head(skb, 0,\n\t\t\t\t TCPOLEN_MSS - skb_tailroom(skb),\n\t\t\t\t GFP_ATOMIC))\n\t\t\treturn -1;\n\t\ttcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);\n\t}\n\n\tskb_put(skb, TCPOLEN_MSS);\n\n\t/*\n\t * IPv4: RFC 1122 states \"If an MSS option is not received at\n\t * connection setup, TCP MUST assume a default send MSS of 536\".\n\t * IPv6: RFC 2460 states IPv6 has a minimum MTU of 1280 and a minimum\n\t * length IPv6 header of 60, ergo the default MSS value is 1220\n\t * Since no MSS was provided, we must use the default values\n\t */\n\tif (xt_family(par) == NFPROTO_IPV4)\n\t\tnewmss = min(newmss, (u16)536);\n\telse\n\t\tnewmss = min(newmss, (u16)1220);\n\n\topt = (u_int8_t *)tcph + sizeof(struct tcphdr);\n\tmemmove(opt + TCPOLEN_MSS, opt, len - sizeof(struct tcphdr));\n\n\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t htons(len), htons(len + TCPOLEN_MSS), true);\n\topt[0] = TCPOPT_MSS;\n\topt[1] = TCPOLEN_MSS;\n\topt[2] = (newmss & 0xff00) >> 8;\n\topt[3] = newmss & 0x00ff;\n\n\tinet_proto_csum_replace4(&tcph->check, skb, 0, *((__be32 *)opt), false);\n\n\toldval = ((__be16 *)tcph)[6];\n\ttcph->doff += TCPOLEN_MSS/4;\n\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t oldval, ((__be16 *)tcph)[6], false);\n\treturn TCPOLEN_MSS;\n}","target":"tcpmss_mangle_packet(struct sk_buff *skb,\n\t\t const struct xt_action_param *par,\n\t\t unsigned int family,\n\t\t unsigned int tcphoff,\n\t\t unsigned int minlen)\n{\n\tconst struct xt_tcpmss_info *info = par->targinfo;\n\tstruct tcphdr *tcph;\n\tint len, tcp_hdrlen;\n\tunsigned int i;\n\t__be16 oldval;\n\tu16 newmss;\n\tu8 *opt;\n\n\t/* This is a fragment, no TCP header is available */\n\tif (par->fragoff != 0)\n\t\treturn 0;\n\n\tif (!skb_make_writable(skb, skb->len))\n\t\treturn -1;\n\n\tlen = skb->len - tcphoff;\n\tif (len < (int)sizeof(struct tcphdr))\n\t\treturn -1;\n\n\ttcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);\n\ttcp_hdrlen = tcph->doff * 4;\n\n\tif (len < tcp_hdrlen || tcp_hdrlen < sizeof(struct tcphdr))\n\t\treturn -1;\n\n\tif (info->mss == XT_TCPMSS_CLAMP_PMTU) {\n\t\tstruct net *net = xt_net(par);\n\t\tunsigned int in_mtu = tcpmss_reverse_mtu(net, skb, family);\n\t\tunsigned int min_mtu = min(dst_mtu(skb_dst(skb)), in_mtu);\n\n\t\tif (min_mtu <= minlen) {\n\t\t\tnet_err_ratelimited(\"unknown or invalid path-MTU (%u)\\n\",\n\t\t\t\t\t min_mtu);\n\t\t\treturn -1;\n\t\t}\n\t\tnewmss = min_mtu - minlen;\n\t} else\n\t\tnewmss = info->mss;\n\n\topt = (u_int8_t *)tcph;\n\tfor (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += optlen(opt, i)) {\n\t\tif (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) {\n\t\t\tu_int16_t oldmss;\n\n\t\t\toldmss = (opt[i+2] << 8) | opt[i+3];\n\n\t\t\t/* Never increase MSS, even when setting it, as\n\t\t\t * doing so results in problems for hosts that rely\n\t\t\t * on MSS being set correctly.\n\t\t\t */\n\t\t\tif (oldmss <= newmss)\n\t\t\t\treturn 0;\n\n\t\t\topt[i+2] = (newmss & 0xff00) >> 8;\n\t\t\topt[i+3] = newmss & 0x00ff;\n\n\t\t\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t\t\t htons(oldmss), htons(newmss),\n\t\t\t\t\t\t false);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t/* There is data after the header so the option can't be added\n\t * without moving it, and doing so may make the SYN packet\n\t * itself too large. Accept the packet unmodified instead.\n\t */\n\tif (len > tcp_hdrlen)\n\t\treturn 0;\n\n\t/* tcph->doff has 4 bits, do not wrap it to 0 */\n\tif (tcp_hdrlen >= 15 * 4)\n\t\treturn 0;\n\n\t/*\n\t * MSS Option not found ?! add it..\n\t */\n\tif (skb_tailroom(skb) < TCPOLEN_MSS) {\n\t\tif (pskb_expand_head(skb, 0,\n\t\t\t\t TCPOLEN_MSS - skb_tailroom(skb),\n\t\t\t\t GFP_ATOMIC))\n\t\t\treturn -1;\n\t\ttcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);\n\t}\n\n\tskb_put(skb, TCPOLEN_MSS);\n\n\t/*\n\t * IPv4: RFC 1122 states \"If an MSS option is not received at\n\t * connection setup, TCP MUST assume a default send MSS of 536\".\n\t * IPv6: RFC 2460 states IPv6 has a minimum MTU of 1280 and a minimum\n\t * length IPv6 header of 60, ergo the default MSS value is 1220\n\t * Since no MSS was provided, we must use the default values\n\t */\n\tif (xt_family(par) == NFPROTO_IPV4)\n\t\tnewmss = min(newmss, (u16)536);\n\telse\n\t\tnewmss = min(newmss, (u16)1220);\n\n\topt = (u_int8_t *)tcph + sizeof(struct tcphdr);\n\tmemmove(opt + TCPOLEN_MSS, opt, len - sizeof(struct tcphdr));\n\n\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t htons(len), htons(len + TCPOLEN_MSS), true);\n\topt[0] = TCPOPT_MSS;\n\topt[1] = TCPOLEN_MSS;\n\topt[2] = (newmss & 0xff00) >> 8;\n\topt[3] = newmss & 0x00ff;\n\n\tinet_proto_csum_replace4(&tcph->check, skb, 0, *((__be32 *)opt), false);\n\n\toldval = ((__be16 *)tcph)[6];\n\ttcph->doff += TCPOLEN_MSS/4;\n\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t oldval, ((__be16 *)tcph)[6], false);\n\treturn TCPOLEN_MSS;\n}","lang":"c","vul_type":"cwe-416","target_token_count":1165,"sven_meta":{"func_name":"tcpmss_mangle_packet","file_name":"net/netfilter/xt_TCPMSS.c","commit_link":"github.com/torvalds/linux/commit/2638fd0f92d4397884fd991d8f4925cb3f081901","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#43-3d68ccabe9a1","input":"mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)\n{\n /* mrb_assert(mrb_proc_cfunc_p(proc)) */\n mrb_irep *irep = proc->body.irep;\n mrb_value *pool = irep->pool;\n mrb_sym *syms = irep->syms;\n mrb_code i;\n int ai = mrb_gc_arena_save(mrb);\n struct mrb_jmpbuf *prev_jmp = mrb->jmp;\n struct mrb_jmpbuf c_jmp;\n\n#ifdef DIRECT_THREADED\n static void *optable[] = {\n &&L_OP_NOP, &&L_OP_MOVE,\n &&L_OP_LOADL, &&L_OP_LOADI, &&L_OP_LOADSYM, &&L_OP_LOADNIL,\n &&L_OP_LOADSELF, &&L_OP_LOADT, &&L_OP_LOADF,\n &&L_OP_GETGLOBAL, &&L_OP_SETGLOBAL, &&L_OP_GETSPECIAL, &&L_OP_SETSPECIAL,\n &&L_OP_GETIV, &&L_OP_SETIV, &&L_OP_GETCV, &&L_OP_SETCV,\n &&L_OP_GETCONST, &&L_OP_SETCONST, &&L_OP_GETMCNST, &&L_OP_SETMCNST,\n &&L_OP_GETUPVAR, &&L_OP_SETUPVAR,\n &&L_OP_JMP, &&L_OP_JMPIF, &&L_OP_JMPNOT,\n &&L_OP_ONERR, &&L_OP_RESCUE, &&L_OP_POPERR, &&L_OP_RAISE, &&L_OP_EPUSH, &&L_OP_EPOP,\n &&L_OP_SEND, &&L_OP_SENDB, &&L_OP_FSEND,\n &&L_OP_CALL, &&L_OP_SUPER, &&L_OP_ARGARY, &&L_OP_ENTER,\n &&L_OP_KARG, &&L_OP_KDICT, &&L_OP_RETURN, &&L_OP_TAILCALL, &&L_OP_BLKPUSH,\n &&L_OP_ADD, &&L_OP_ADDI, &&L_OP_SUB, &&L_OP_SUBI, &&L_OP_MUL, &&L_OP_DIV,\n &&L_OP_EQ, &&L_OP_LT, &&L_OP_LE, &&L_OP_GT, &&L_OP_GE,\n &&L_OP_ARRAY, &&L_OP_ARYCAT, &&L_OP_ARYPUSH, &&L_OP_AREF, &&L_OP_ASET, &&L_OP_APOST,\n &&L_OP_STRING, &&L_OP_STRCAT, &&L_OP_HASH,\n &&L_OP_LAMBDA, &&L_OP_RANGE, &&L_OP_OCLASS,\n &&L_OP_CLASS, &&L_OP_MODULE, &&L_OP_EXEC,\n &&L_OP_METHOD, &&L_OP_SCLASS, &&L_OP_TCLASS,\n &&L_OP_DEBUG, &&L_OP_STOP, &&L_OP_ERR,\n };\n#endif\n\n mrb_bool exc_catched = FALSE;\nRETRY_TRY_BLOCK:\n\n MRB_TRY(&c_jmp) {\n\n if (exc_catched) {\n exc_catched = FALSE;\n if (mrb->exc && mrb->exc->tt == MRB_TT_BREAK)\n goto L_BREAK;\n goto L_RAISE;\n }\n mrb->jmp = &c_jmp;\n mrb->c->ci->proc = proc;\n mrb->c->ci->nregs = irep->nregs;\n\n#define regs (mrb->c->stack)\n INIT_DISPATCH {\n CASE(OP_NOP) {\n /* do nothing */\n NEXT;\n }\n\n CASE(OP_MOVE) {\n /* A B R(A) := R(B) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n regs[a] = regs[b];\n NEXT;\n }\n\n CASE(OP_LOADL) {\n /* A Bx R(A) := Pool(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n#ifdef MRB_WORD_BOXING\n mrb_value val = pool[bx];\n#ifndef MRB_WITHOUT_FLOAT\n if (mrb_float_p(val)) {\n val = mrb_float_value(mrb, mrb_float(val));\n }\n#endif\n regs[a] = val;\n#else\n regs[a] = pool[bx];\n#endif\n NEXT;\n }\n\n CASE(OP_LOADI) {\n /* A sBx R(A) := sBx */\n int a = GETARG_A(i);\n mrb_int bx = GETARG_sBx(i);\n SET_INT_VALUE(regs[a], bx);\n NEXT;\n }\n\n CASE(OP_LOADSYM) {\n /* A Bx R(A) := Syms(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n SET_SYM_VALUE(regs[a], syms[bx]);\n NEXT;\n }\n\n CASE(OP_LOADSELF) {\n /* A R(A) := self */\n int a = GETARG_A(i);\n regs[a] = regs[0];\n NEXT;\n }\n\n CASE(OP_LOADT) {\n /* A R(A) := true */\n int a = GETARG_A(i);\n SET_TRUE_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_LOADF) {\n /* A R(A) := false */\n int a = GETARG_A(i);\n SET_FALSE_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_GETGLOBAL) {\n /* A Bx R(A) := getglobal(Syms(Bx)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_gv_get(mrb, syms[bx]);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETGLOBAL) {\n /* A Bx setglobal(Syms(Bx), R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_gv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETSPECIAL) {\n /* A Bx R(A) := Special[Bx] */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_vm_special_get(mrb, bx);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETSPECIAL) {\n /* A Bx Special[Bx] := R(A) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_special_set(mrb, bx, regs[a]);\n NEXT;\n }\n\n CASE(OP_GETIV) {\n /* A Bx R(A) := ivget(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_vm_iv_get(mrb, syms[bx]);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETIV) {\n /* A Bx ivset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_iv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETCV) {\n /* A Bx R(A) := cvget(Syms(Bx)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val;\n ERR_PC_SET(mrb, pc);\n val = mrb_vm_cv_get(mrb, syms[bx]);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETCV) {\n /* A Bx cvset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_cv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETCONST) {\n /* A Bx R(A) := constget(Syms(Bx)) */\n mrb_value val;\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_sym sym = syms[bx];\n\n ERR_PC_SET(mrb, pc);\n val = mrb_vm_const_get(mrb, sym);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETCONST) {\n /* A Bx constset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_const_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETMCNST) {\n /* A Bx R(A) := R(A)::Syms(Bx) */\n mrb_value val;\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n\n ERR_PC_SET(mrb, pc);\n val = mrb_const_get(mrb, regs[a], syms[bx]);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETMCNST) {\n /* A Bx R(A+1)::Syms(Bx) := R(A) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_const_set(mrb, regs[a+1], syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETUPVAR) {\n /* A B C R(A) := uvget(B,C) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value *regs_a = regs + a;\n struct REnv *e = uvenv(mrb, c);\n\n if (!e) {\n *regs_a = mrb_nil_value();\n }\n else {\n *regs_a = e->stack[b];\n }\n NEXT;\n }\n\n CASE(OP_SETUPVAR) {\n /* A B C uvset(B,C,R(A)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n\n struct REnv *e = uvenv(mrb, c);\n\n if (e) {\n mrb_value *regs_a = regs + a;\n\n if (b < MRB_ENV_STACK_LEN(e)) {\n e->stack[b] = *regs_a;\n mrb_write_barrier(mrb, (struct RBasic*)e);\n }\n }\n NEXT;\n }\n\n CASE(OP_JMP) {\n /* sBx pc+=sBx */\n int sbx = GETARG_sBx(i);\n pc += sbx;\n JUMP;\n }\n\n CASE(OP_JMPIF) {\n /* A sBx if R(A) pc+=sBx */\n int a = GETARG_A(i);\n int sbx = GETARG_sBx(i);\n if (mrb_test(regs[a])) {\n pc += sbx;\n JUMP;\n }\n NEXT;\n }\n\n CASE(OP_JMPNOT) {\n /* A sBx if !R(A) pc+=sBx */\n int a = GETARG_A(i);\n int sbx = GETARG_sBx(i);\n if (!mrb_test(regs[a])) {\n pc += sbx;\n JUMP;\n }\n NEXT;\n }\n\n CASE(OP_ONERR) {\n /* sBx pc+=sBx on exception */\n int sbx = GETARG_sBx(i);\n if (mrb->c->rsize <= mrb->c->ci->ridx) {\n if (mrb->c->rsize == 0) mrb->c->rsize = RESCUE_STACK_INIT_SIZE;\n else mrb->c->rsize *= 2;\n mrb->c->rescue = (mrb_code **)mrb_realloc(mrb, mrb->c->rescue, sizeof(mrb_code*) * mrb->c->rsize);\n }\n mrb->c->rescue[mrb->c->ci->ridx++] = pc + sbx;\n NEXT;\n }\n\n CASE(OP_RESCUE) {\n /* A B R(A) := exc; clear(exc); R(B) := matched (bool) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value exc;\n\n if (c == 0) {\n exc = mrb_obj_value(mrb->exc);\n mrb->exc = 0;\n }\n else { /* continued; exc taken from R(A) */\n exc = regs[a];\n }\n if (b != 0) {\n mrb_value e = regs[b];\n struct RClass *ec;\n\n switch (mrb_type(e)) {\n case MRB_TT_CLASS:\n case MRB_TT_MODULE:\n break;\n default:\n {\n mrb_value exc;\n\n exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR,\n \"class or module required for rescue clause\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n ec = mrb_class_ptr(e);\n regs[b] = mrb_bool_value(mrb_obj_is_kind_of(mrb, exc, ec));\n }\n if (a != 0 && c == 0) {\n regs[a] = exc;\n }\n NEXT;\n }\n\n CASE(OP_POPERR) {\n /* A A.times{rescue_pop()} */\n int a = GETARG_A(i);\n\n mrb->c->ci->ridx -= a;\n NEXT;\n }\n\n CASE(OP_RAISE) {\n /* A raise(R(A)) */\n int a = GETARG_A(i);\n\n mrb_exc_set(mrb, regs[a]);\n goto L_RAISE;\n }\n\n CASE(OP_EPUSH) {\n /* Bx ensure_push(SEQ[Bx]) */\n int bx = GETARG_Bx(i);\n struct RProc *p;\n\n p = mrb_closure_new(mrb, irep->reps[bx]);\n /* push ensure_stack */\n if (mrb->c->esize <= mrb->c->eidx+1) {\n if (mrb->c->esize == 0) mrb->c->esize = ENSURE_STACK_INIT_SIZE;\n else mrb->c->esize *= 2;\n mrb->c->ensure = (struct RProc **)mrb_realloc(mrb, mrb->c->ensure, sizeof(struct RProc*) * mrb->c->esize);\n }\n mrb->c->ensure[mrb->c->eidx++] = p;\n mrb->c->ensure[mrb->c->eidx] = NULL;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_EPOP) {\n /* A A.times{ensure_pop().call} */\n int a = GETARG_A(i);\n mrb_callinfo *ci = mrb->c->ci;\n int n, epos = ci->epos;\n mrb_value self = regs[0];\n struct RClass *target_class = ci->target_class;\n\n if (mrb->c->eidx <= epos) {\n NEXT;\n }\n\n if (a > mrb->c->eidx - epos)\n a = mrb->c->eidx - epos;\n pc = pc + 1;\n for (n=0; nc->ensure[epos+n];\n mrb->c->ensure[epos+n] = NULL;\n if (proc == NULL) continue;\n irep = proc->body.irep;\n ci = cipush(mrb);\n ci->mid = ci[-1].mid;\n ci->argc = 0;\n ci->proc = proc;\n ci->stackent = mrb->c->stack;\n ci->nregs = irep->nregs;\n ci->target_class = target_class;\n ci->pc = pc;\n ci->acc = ci[-1].nregs;\n mrb->c->stack += ci->acc;\n stack_extend(mrb, ci->nregs);\n regs[0] = self;\n pc = irep->iseq;\n }\n pool = irep->pool;\n syms = irep->syms;\n mrb->c->eidx = epos;\n JUMP;\n }\n\n CASE(OP_LOADNIL) {\n /* A R(A) := nil */\n int a = GETARG_A(i);\n\n SET_NIL_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_SENDB) {\n /* A B C R(A) := call(R(A),Syms(B),R(A+1),...,R(A+C),&R(A+C+1))*/\n /* fall through */\n };\n\n L_SEND:\n CASE(OP_SEND) {\n /* A B C R(A) := call(R(A),Syms(B),R(A+1),...,R(A+C)) */\n int a = GETARG_A(i);\n int n = GETARG_C(i);\n int argc = (n == CALL_MAXARGS) ? -1 : n;\n int bidx = (argc < 0) ? a+2 : a+n+1;\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci = mrb->c->ci;\n mrb_value recv, blk;\n mrb_sym mid = syms[GETARG_B(i)];\n\n mrb_assert(bidx < ci->nregs);\n\n recv = regs[a];\n if (GET_OPCODE(i) != OP_SENDB) {\n SET_NIL_VALUE(regs[bidx]);\n blk = regs[bidx];\n }\n else {\n blk = regs[bidx];\n if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {\n blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, \"Proc\", \"to_proc\");\n /* The stack might have been reallocated during mrb_convert_type(),\n see #3622 */\n regs[bidx] = blk;\n }\n }\n c = mrb_class(mrb, recv);\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m) || (missing == mrb->c->ci->mid && mrb_obj_eq(mrb, regs[0], recv))) {\n mrb_value args = (argc < 0) ? regs[a+1] : mrb_ary_new_from_values(mrb, n, regs+a+1);\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n if (argc >= 0) {\n if (a+2 >= irep->nregs) {\n stack_extend(mrb, a+3);\n }\n regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1);\n regs[a+2] = blk;\n argc = -1;\n }\n mrb_ary_unshift(mrb, regs[a+1], mrb_symbol_value(mid));\n mid = missing;\n }\n\n /* push callinfo */\n ci = cipush(mrb);\n ci->mid = mid;\n ci->stackent = mrb->c->stack;\n ci->target_class = c;\n ci->argc = argc;\n\n ci->pc = pc + 1;\n ci->acc = a;\n\n /* prepare stack */\n mrb->c->stack += a;\n\n if (MRB_METHOD_CFUNC_P(m)) {\n ci->nregs = (argc < 0) ? 3 : n+2;\n if (MRB_METHOD_PROC_P(m)) {\n struct RProc *p = MRB_METHOD_PROC(m);\n\n ci->proc = p;\n recv = p->body.func(mrb, recv);\n }\n else {\n recv = MRB_METHOD_FUNC(m)(mrb, recv);\n }\n mrb_gc_arena_restore(mrb, ai);\n mrb_gc_arena_shrink(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n ci = mrb->c->ci;\n if (GET_OPCODE(i) == OP_SENDB) {\n if (mrb_type(blk) == MRB_TT_PROC) {\n struct RProc *p = mrb_proc_ptr(blk);\n if (p && !MRB_PROC_STRICT_P(p) && MRB_PROC_ENV(p) == ci[-1].env) {\n p->flags |= MRB_PROC_ORPHAN;\n }\n }\n }\n if (!ci->target_class) { /* return from context modifying method (resume/yield) */\n if (ci->acc == CI_ACC_RESUMED) {\n mrb->jmp = prev_jmp;\n return recv;\n }\n else {\n mrb_assert(!MRB_PROC_CFUNC_P(ci[-1].proc));\n proc = ci[-1].proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n }\n }\n mrb->c->stack[0] = recv;\n /* pop stackpos */\n mrb->c->stack = ci->stackent;\n pc = ci->pc;\n cipop(mrb);\n JUMP;\n }\n else {\n /* setup environment for calling method */\n proc = ci->proc = MRB_METHOD_PROC(m);\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, (argc < 0 && ci->nregs < 3) ? 3 : ci->nregs);\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_FSEND) {\n /* A B C R(A) := fcall(R(A),Syms(B),R(A+1),... ,R(A+C-1)) */\n /* not implemented yet */\n NEXT;\n }\n\n CASE(OP_CALL) {\n /* A R(A) := self.call(frame.argc, frame.argv) */\n mrb_callinfo *ci;\n mrb_value recv = mrb->c->stack[0];\n struct RProc *m = mrb_proc_ptr(recv);\n\n /* replace callinfo */\n ci = mrb->c->ci;\n ci->target_class = MRB_PROC_TARGET_CLASS(m);\n ci->proc = m;\n if (MRB_PROC_ENV_P(m)) {\n mrb_sym mid;\n struct REnv *e = MRB_PROC_ENV(m);\n\n mid = e->mid;\n if (mid) ci->mid = mid;\n if (!e->stack) {\n e->stack = mrb->c->stack;\n }\n }\n\n /* prepare stack */\n if (MRB_PROC_CFUNC_P(m)) {\n recv = MRB_PROC_CFUNC(m)(mrb, recv);\n mrb_gc_arena_restore(mrb, ai);\n mrb_gc_arena_shrink(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n /* pop stackpos */\n ci = mrb->c->ci;\n mrb->c->stack = ci->stackent;\n regs[ci->acc] = recv;\n pc = ci->pc;\n cipop(mrb);\n irep = mrb->c->ci->proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n JUMP;\n }\n else {\n /* setup environment for calling method */\n proc = m;\n irep = m->body.irep;\n if (!irep) {\n mrb->c->stack[0] = mrb_nil_value();\n goto L_RETURN;\n }\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, ci->nregs);\n if (ci->argc < 0) {\n if (irep->nregs > 3) {\n stack_clear(regs+3, irep->nregs-3);\n }\n }\n else if (ci->argc+2 < irep->nregs) {\n stack_clear(regs+ci->argc+2, irep->nregs-ci->argc-2);\n }\n if (MRB_PROC_ENV_P(m)) {\n regs[0] = MRB_PROC_ENV(m)->stack[0];\n }\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_SUPER) {\n /* A C R(A) := super(R(A+1),... ,R(A+C+1)) */\n int a = GETARG_A(i);\n int n = GETARG_C(i);\n int argc = (n == CALL_MAXARGS) ? -1 : n;\n int bidx = (argc < 0) ? a+2 : a+n+1;\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci = mrb->c->ci;\n mrb_value recv, blk;\n mrb_sym mid = ci->mid;\n struct RClass* target_class = MRB_PROC_TARGET_CLASS(ci->proc);\n\n mrb_assert(bidx < ci->nregs);\n\n if (mid == 0 || !target_class) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, \"super called outside of method\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (target_class->tt == MRB_TT_MODULE) {\n target_class = ci->target_class;\n if (target_class->tt != MRB_TT_ICLASS) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_RUNTIME_ERROR, \"superclass info lost [mruby limitations]\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n recv = regs[0];\n if (!mrb_obj_is_kind_of(mrb, recv, target_class)) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR,\n \"self has wrong type to call super in this context\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n blk = regs[bidx];\n if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {\n blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, \"Proc\", \"to_proc\");\n /* The stack or ci stack might have been reallocated during\n mrb_convert_type(), see #3622 and #3784 */\n regs[bidx] = blk;\n ci = mrb->c->ci;\n }\n c = target_class->super;\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n\n if (mid != missing) {\n c = mrb_class(mrb, recv);\n }\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value args = (argc < 0) ? regs[a+1] : mrb_ary_new_from_values(mrb, n, regs+a+1);\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n mid = missing;\n if (argc >= 0) {\n if (a+2 >= ci->nregs) {\n stack_extend(mrb, a+3);\n }\n regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1);\n regs[a+2] = blk;\n argc = -1;\n }\n mrb_ary_unshift(mrb, regs[a+1], mrb_symbol_value(ci->mid));\n }\n\n /* push callinfo */\n ci = cipush(mrb);\n ci->mid = mid;\n ci->stackent = mrb->c->stack;\n ci->target_class = c;\n ci->pc = pc + 1;\n ci->argc = argc;\n\n /* prepare stack */\n mrb->c->stack += a;\n mrb->c->stack[0] = recv;\n\n if (MRB_METHOD_CFUNC_P(m)) {\n mrb_value v;\n ci->nregs = (argc < 0) ? 3 : n+2;\n if (MRB_METHOD_PROC_P(m)) {\n ci->proc = MRB_METHOD_PROC(m);\n }\n v = MRB_METHOD_CFUNC(m)(mrb, recv);\n mrb_gc_arena_restore(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n ci = mrb->c->ci;\n if (!ci->target_class) { /* return from context modifying method (resume/yield) */\n if (ci->acc == CI_ACC_RESUMED) {\n mrb->jmp = prev_jmp;\n return v;\n }\n else {\n mrb_assert(!MRB_PROC_CFUNC_P(ci[-1].proc));\n proc = ci[-1].proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n }\n }\n mrb->c->stack[0] = v;\n /* pop stackpos */\n mrb->c->stack = ci->stackent;\n pc = ci->pc;\n cipop(mrb);\n JUMP;\n }\n else {\n /* fill callinfo */\n ci->acc = a;\n\n /* setup environment for calling method */\n proc = ci->proc = MRB_METHOD_PROC(m);\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, (argc < 0 && ci->nregs < 3) ? 3 : ci->nregs);\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_ARGARY) {\n /* A Bx R(A) := argument array (16=6:1:5:4) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n int m1 = (bx>>10)&0x3f;\n int r = (bx>>9)&0x1;\n int m2 = (bx>>4)&0x1f;\n int lv = (bx>>0)&0xf;\n mrb_value *stack;\n\n if (mrb->c->ci->mid == 0 || mrb->c->ci->target_class == NULL) {\n mrb_value exc;\n\n L_NOSUPER:\n exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, \"super called outside of method\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (lv == 0) stack = regs + 1;\n else {\n struct REnv *e = uvenv(mrb, lv-1);\n if (!e) goto L_NOSUPER;\n if (MRB_ENV_STACK_LEN(e) <= m1+r+m2+1)\n goto L_NOSUPER;\n stack = e->stack + 1;\n }\n if (r == 0) {\n regs[a] = mrb_ary_new_from_values(mrb, m1+m2, stack);\n }\n else {\n mrb_value *pp = NULL;\n struct RArray *rest;\n int len = 0;\n\n if (mrb_array_p(stack[m1])) {\n struct RArray *ary = mrb_ary_ptr(stack[m1]);\n\n pp = ARY_PTR(ary);\n len = (int)ARY_LEN(ary);\n }\n regs[a] = mrb_ary_new_capa(mrb, m1+len+m2);\n rest = mrb_ary_ptr(regs[a]);\n if (m1 > 0) {\n stack_copy(ARY_PTR(rest), stack, m1);\n }\n if (len > 0) {\n stack_copy(ARY_PTR(rest)+m1, pp, len);\n }\n if (m2 > 0) {\n stack_copy(ARY_PTR(rest)+m1+len, stack+m1+1, m2);\n }\n ARY_SET_LEN(rest, m1+len+m2);\n }\n regs[a+1] = stack[m1+r+m2];\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ENTER) {\n /* Ax arg setup according to flags (23=5:5:1:5:5:1:1) */\n /* number of optional arguments times OP_JMP should follow */\n mrb_aspec ax = GETARG_Ax(i);\n int m1 = MRB_ASPEC_REQ(ax);\n int o = MRB_ASPEC_OPT(ax);\n int r = MRB_ASPEC_REST(ax);\n int m2 = MRB_ASPEC_POST(ax);\n /* unused\n int k = MRB_ASPEC_KEY(ax);\n int kd = MRB_ASPEC_KDICT(ax);\n int b = MRB_ASPEC_BLOCK(ax);\n */\n int argc = mrb->c->ci->argc;\n mrb_value *argv = regs+1;\n mrb_value *argv0 = argv;\n int len = m1 + o + r + m2;\n mrb_value *blk = &argv[argc < 0 ? 1 : argc];\n\n if (argc < 0) {\n struct RArray *ary = mrb_ary_ptr(regs[1]);\n argv = ARY_PTR(ary);\n argc = (int)ARY_LEN(ary);\n mrb_gc_protect(mrb, regs[1]);\n }\n if (mrb->c->ci->proc && MRB_PROC_STRICT_P(mrb->c->ci->proc)) {\n if (argc >= 0) {\n if (argc < m1 + m2 || (r == 0 && argc > len)) {\n argnum_error(mrb, m1+m2);\n goto L_RAISE;\n }\n }\n }\n else if (len > 1 && argc == 1 && mrb_array_p(argv[0])) {\n mrb_gc_protect(mrb, argv[0]);\n argc = (int)RARRAY_LEN(argv[0]);\n argv = RARRAY_PTR(argv[0]);\n }\n if (argc < len) {\n int mlen = m2;\n if (argc < m1+m2) {\n if (m1 < argc)\n mlen = argc - m1;\n else\n mlen = 0;\n }\n regs[len+1] = *blk; /* move block */\n SET_NIL_VALUE(regs[argc+1]);\n if (argv0 != argv) {\n value_move(®s[1], argv, argc-mlen); /* m1 + o */\n }\n if (argc < m1) {\n stack_clear(®s[argc+1], m1-argc);\n }\n if (mlen) {\n value_move(®s[len-m2+1], &argv[argc-mlen], mlen);\n }\n if (mlen < m2) {\n stack_clear(®s[len-m2+mlen+1], m2-mlen);\n }\n if (r) {\n regs[m1+o+1] = mrb_ary_new_capa(mrb, 0);\n }\n if (o == 0 || argc < m1+m2) pc++;\n else\n pc += argc - m1 - m2 + 1;\n }\n else {\n int rnum = 0;\n if (argv0 != argv) {\n regs[len+1] = *blk; /* move block */\n value_move(®s[1], argv, m1+o);\n }\n if (r) {\n rnum = argc-m1-o-m2;\n regs[m1+o+1] = mrb_ary_new_from_values(mrb, rnum, argv+m1+o);\n }\n if (m2) {\n if (argc-m2 > m1) {\n value_move(®s[m1+o+r+1], &argv[m1+o+rnum], m2);\n }\n }\n if (argv0 == argv) {\n regs[len+1] = *blk; /* move block */\n }\n pc += o + 1;\n }\n mrb->c->ci->argc = len;\n /* clear local (but non-argument) variables */\n if (irep->nlocals-len-2 > 0) {\n stack_clear(®s[len+2], irep->nlocals-len-2);\n }\n JUMP;\n }\n\n CASE(OP_KARG) {\n /* A B C R(A) := kdict[Syms(B)]; if C kdict.rm(Syms(B)) */\n /* if C == 2; raise unless kdict.empty? */\n /* OP_JMP should follow to skip init code */\n NEXT;\n }\n\n CASE(OP_KDICT) {\n /* A C R(A) := kdict */\n NEXT;\n }\n\n L_RETURN:\n i = MKOP_AB(OP_RETURN, GETARG_A(i), OP_R_NORMAL);\n /* fall through */\n CASE(OP_RETURN) {\n /* A B return R(A) (B=normal,in-block return/break) */\n mrb_callinfo *ci;\n\n#define ecall_adjust() do {\\\n ptrdiff_t cioff = ci - mrb->c->cibase;\\\n ecall(mrb);\\\n ci = mrb->c->cibase + cioff;\\\n} while (0)\n\n ci = mrb->c->ci;\n if (ci->mid) {\n mrb_value blk;\n\n if (ci->argc < 0) {\n blk = regs[2];\n }\n else {\n blk = regs[ci->argc+1];\n }\n if (mrb_type(blk) == MRB_TT_PROC) {\n struct RProc *p = mrb_proc_ptr(blk);\n\n if (!MRB_PROC_STRICT_P(p) &&\n ci > mrb->c->cibase && MRB_PROC_ENV(p) == ci[-1].env) {\n p->flags |= MRB_PROC_ORPHAN;\n }\n }\n }\n\n if (mrb->exc) {\n mrb_callinfo *ci0;\n\n L_RAISE:\n ci0 = ci = mrb->c->ci;\n if (ci == mrb->c->cibase) {\n if (ci->ridx == 0) goto L_FTOP;\n goto L_RESCUE;\n }\n while (ci[0].ridx == ci[-1].ridx) {\n cipop(mrb);\n mrb->c->stack = ci->stackent;\n if (ci->acc == CI_ACC_SKIP && prev_jmp) {\n mrb->jmp = prev_jmp;\n MRB_THROW(prev_jmp);\n }\n ci = mrb->c->ci;\n if (ci == mrb->c->cibase) {\n if (ci->ridx == 0) {\n L_FTOP: /* fiber top */\n if (mrb->c == mrb->root_c) {\n mrb->c->stack = mrb->c->stbase;\n goto L_STOP;\n }\n else {\n struct mrb_context *c = mrb->c;\n\n while (c->eidx > ci->epos) {\n ecall_adjust();\n }\n if (c->fib) {\n mrb_write_barrier(mrb, (struct RBasic*)c->fib);\n }\n mrb->c->status = MRB_FIBER_TERMINATED;\n mrb->c = c->prev;\n c->prev = NULL;\n goto L_RAISE;\n }\n }\n break;\n }\n /* call ensure only when we skip this callinfo */\n if (ci[0].ridx == ci[-1].ridx) {\n while (mrb->c->eidx > ci->epos) {\n ecall_adjust();\n }\n }\n }\n L_RESCUE:\n if (ci->ridx == 0) goto L_STOP;\n proc = ci->proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n if (ci < ci0) {\n mrb->c->stack = ci[1].stackent;\n }\n stack_extend(mrb, irep->nregs);\n pc = mrb->c->rescue[--ci->ridx];\n }\n else {\n int acc;\n mrb_value v;\n struct RProc *dst;\n\n ci = mrb->c->ci;\n v = regs[GETARG_A(i)];\n mrb_gc_protect(mrb, v);\n switch (GETARG_B(i)) {\n case OP_R_RETURN:\n /* Fall through to OP_R_NORMAL otherwise */\n if (ci->acc >=0 && MRB_PROC_ENV_P(proc) && !MRB_PROC_STRICT_P(proc)) {\n mrb_callinfo *cibase = mrb->c->cibase;\n dst = top_proc(mrb, proc);\n\n if (MRB_PROC_ENV_P(dst)) {\n struct REnv *e = MRB_PROC_ENV(dst);\n\n if (!MRB_ENV_STACK_SHARED_P(e) || e->cxt != mrb->c) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n }\n while (cibase <= ci && ci->proc != dst) {\n if (ci->acc < 0) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n ci--;\n }\n if (ci <= cibase) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n break;\n }\n case OP_R_NORMAL:\n NORMAL_RETURN:\n if (ci == mrb->c->cibase) {\n struct mrb_context *c;\n\n if (!mrb->c->prev) { /* toplevel return */\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n if (mrb->c->prev->ci == mrb->c->prev->cibase) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_FIBER_ERROR, \"double resume\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n while (mrb->c->eidx > 0) {\n ecall(mrb);\n }\n /* automatic yield at the end */\n c = mrb->c;\n c->status = MRB_FIBER_TERMINATED;\n mrb->c = c->prev;\n c->prev = NULL;\n mrb->c->status = MRB_FIBER_RUNNING;\n ci = mrb->c->ci;\n }\n break;\n case OP_R_BREAK:\n if (MRB_PROC_STRICT_P(proc)) goto NORMAL_RETURN;\n if (MRB_PROC_ORPHAN_P(proc)) { \n mrb_value exc;\n\n L_BREAK_ERROR:\n exc = mrb_exc_new_str_lit(mrb, E_LOCALJUMP_ERROR,\n \"break from proc-closure\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (!MRB_PROC_ENV_P(proc) || !MRB_ENV_STACK_SHARED_P(MRB_PROC_ENV(proc))) {\n goto L_BREAK_ERROR;\n }\n else {\n struct REnv *e = MRB_PROC_ENV(proc);\n\n if (e == mrb->c->cibase->env && proc != mrb->c->cibase->proc) {\n goto L_BREAK_ERROR;\n }\n if (e->cxt != mrb->c) {\n goto L_BREAK_ERROR;\n }\n }\n while (mrb->c->eidx > mrb->c->ci->epos) {\n ecall_adjust();\n }\n /* break from fiber block */\n if (ci == mrb->c->cibase && ci->pc) {\n struct mrb_context *c = mrb->c;\n\n mrb->c = c->prev;\n c->prev = NULL;\n ci = mrb->c->ci;\n }\n if (ci->acc < 0) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->c->vmexec = FALSE;\n mrb->exc = (struct RObject*)break_new(mrb, proc, v);\n mrb->jmp = prev_jmp;\n MRB_THROW(prev_jmp);\n }\n if (FALSE) {\n L_BREAK:\n v = ((struct RBreak*)mrb->exc)->val;\n proc = ((struct RBreak*)mrb->exc)->proc;\n mrb->exc = NULL;\n ci = mrb->c->ci;\n }\n mrb->c->stack = ci->stackent;\n proc = proc->upper;\n while (mrb->c->cibase < ci && ci[-1].proc != proc) {\n if (ci[-1].acc == CI_ACC_SKIP) {\n while (ci < mrb->c->ci) {\n cipop(mrb);\n }\n goto L_BREAK_ERROR;\n }\n ci--;\n }\n if (ci == mrb->c->cibase) {\n goto L_BREAK_ERROR;\n }\n break;\n default:\n /* cannot happen */\n break;\n }\n while (ci < mrb->c->ci) {\n cipop(mrb);\n }\n ci[0].ridx = ci[-1].ridx;\n while (mrb->c->eidx > ci->epos) {\n ecall_adjust();\n }\n if (mrb->c->vmexec && !ci->target_class) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->c->vmexec = FALSE;\n mrb->jmp = prev_jmp;\n return v;\n }\n acc = ci->acc;\n mrb->c->stack = ci->stackent;\n cipop(mrb);\n if (acc == CI_ACC_SKIP || acc == CI_ACC_DIRECT) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->jmp = prev_jmp;\n return v;\n }\n pc = ci->pc;\n ci = mrb->c->ci;\n DEBUG(fprintf(stderr, \"from :%s\\n\", mrb_sym2name(mrb, ci->mid)));\n proc = mrb->c->ci->proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n\n regs[acc] = v;\n mrb_gc_arena_restore(mrb, ai);\n }\n JUMP;\n }\n\n CASE(OP_TAILCALL) {\n /* A B C return call(R(A),Syms(B),R(A+1),... ,R(A+C+1)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int n = GETARG_C(i);\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci;\n mrb_value recv;\n mrb_sym mid = syms[b];\n\n recv = regs[a];\n c = mrb_class(mrb, recv);\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value sym = mrb_symbol_value(mid);\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value args;\n\n if (n == CALL_MAXARGS) {\n args = regs[a+1];\n }\n else {\n args = mrb_ary_new_from_values(mrb, n, regs+a+1);\n }\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n mid = missing;\n if (n == CALL_MAXARGS) {\n mrb_ary_unshift(mrb, regs[a+1], sym);\n }\n else {\n value_move(regs+a+2, regs+a+1, ++n);\n regs[a+1] = sym;\n }\n }\n\n /* replace callinfo */\n ci = mrb->c->ci;\n ci->mid = mid;\n ci->target_class = c;\n if (n == CALL_MAXARGS) {\n ci->argc = -1;\n }\n else {\n ci->argc = n;\n }\n\n /* move stack */\n value_move(mrb->c->stack, ®s[a], ci->argc+1);\n\n if (MRB_METHOD_CFUNC_P(m)) {\n mrb_value v = MRB_METHOD_CFUNC(m)(mrb, recv);\n mrb->c->stack[0] = v;\n mrb_gc_arena_restore(mrb, ai);\n goto L_RETURN;\n }\n else {\n /* setup environment for calling method */\n struct RProc *p = MRB_METHOD_PROC(m);\n irep = p->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n if (ci->argc < 0) {\n stack_extend(mrb, (irep->nregs < 3) ? 3 : irep->nregs);\n }\n else {\n stack_extend(mrb, irep->nregs);\n }\n pc = irep->iseq;\n }\n JUMP;\n }\n\n CASE(OP_BLKPUSH) {\n /* A Bx R(A) := block (16=6:1:5:4) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n int m1 = (bx>>10)&0x3f;\n int r = (bx>>9)&0x1;\n int m2 = (bx>>4)&0x1f;\n int lv = (bx>>0)&0xf;\n mrb_value *stack;\n\n if (lv == 0) stack = regs + 1;\n else {\n struct REnv *e = uvenv(mrb, lv-1);\n if (!e || (!MRB_ENV_STACK_SHARED_P(e) && e->mid == 0) ||\n MRB_ENV_STACK_LEN(e) <= m1+r+m2+1) {\n localjump_error(mrb, LOCALJUMP_ERROR_YIELD);\n goto L_RAISE;\n }\n stack = e->stack + 1;\n }\n if (mrb_nil_p(stack[m1+r+m2])) {\n localjump_error(mrb, LOCALJUMP_ERROR_YIELD);\n goto L_RAISE;\n }\n regs[a] = stack[m1+r+m2];\n NEXT;\n }\n\n#define TYPES2(a,b) ((((uint16_t)(a))<<8)|(((uint16_t)(b))&0xff))\n#define OP_MATH_BODY(op,v1,v2) do {\\\n v1(regs[a]) = v1(regs[a]) op v2(regs[a+1]);\\\n} while(0)\n\n CASE(OP_ADD) {\n /* A B C R(A) := R(A)+R(A+1) (Syms[B]=:+,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n mrb_value *regs_a = regs + a;\n\n x = mrb_fixnum(regs_a[0]);\n y = mrb_fixnum(regs_a[1]);\n if (mrb_int_add_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs_a[0], (mrb_float)x + (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x + y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x + y);\n }\n#else\n OP_MATH_BODY(+,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x + y);\n }\n#else\n OP_MATH_BODY(+,mrb_float,mrb_float);\n#endif\n break;\n#endif\n case TYPES2(MRB_TT_STRING,MRB_TT_STRING):\n regs[a] = mrb_str_plus(mrb, regs[a], regs[a+1]);\n break;\n default:\n goto L_SEND;\n }\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_SUB) {\n /* A B C R(A) := R(A)-R(A+1) (Syms[B]=:-,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n\n x = mrb_fixnum(regs[a]);\n y = mrb_fixnum(regs[a+1]);\n if (mrb_int_sub_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x - y);\n }\n#else\n OP_MATH_BODY(-,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x - y);\n }\n#else\n OP_MATH_BODY(-,mrb_float,mrb_float);\n#endif\n break;\n#endif\n default:\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_MUL) {\n /* A B C R(A) := R(A)*R(A+1) (Syms[B]=:*,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n\n x = mrb_fixnum(regs[a]);\n y = mrb_fixnum(regs[a+1]);\n if (mrb_int_mul_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x * (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x * y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x * y);\n }\n#else\n OP_MATH_BODY(*,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x * y);\n }\n#else\n OP_MATH_BODY(*,mrb_float,mrb_float);\n#endif\n break;\n#endif\n default:\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_DIV) {\n /* A B C R(A) := R(A)/R(A+1) (Syms[B]=:/,C=1)*/\n int a = GETARG_A(i);\n#ifndef MRB_WITHOUT_FLOAT\n double x, y, f;\n#endif\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n#ifdef MRB_WITHOUT_FLOAT\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_INT_VALUE(regs[a], y ? x / y : 0);\n }\n break;\n#else\n x = (mrb_float)mrb_fixnum(regs[a]);\n y = (mrb_float)mrb_fixnum(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n x = (mrb_float)mrb_fixnum(regs[a]);\n y = mrb_float(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n x = mrb_float(regs[a]);\n y = (mrb_float)mrb_fixnum(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n x = mrb_float(regs[a]);\n y = mrb_float(regs[a+1]);\n break;\n#endif\n default:\n goto L_SEND;\n }\n\n#ifndef MRB_WITHOUT_FLOAT\n if (y == 0) {\n if (x > 0) f = INFINITY;\n else if (x < 0) f = -INFINITY;\n else /* if (x == 0) */ f = NAN;\n }\n else {\n f = x / y;\n }\n SET_FLOAT_VALUE(mrb, regs[a], f);\n#endif\n NEXT;\n }\n\n CASE(OP_ADDI) {\n /* A B C R(A) := R(A)+C (Syms[B]=:+)*/\n int a = GETARG_A(i);\n\n /* need to check if + is overridden */\n switch (mrb_type(regs[a])) {\n case MRB_TT_FIXNUM:\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_int y = GETARG_C(i);\n mrb_int z;\n\n if (mrb_int_add_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x + (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case MRB_TT_FLOAT:\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n SET_FLOAT_VALUE(mrb, regs[a], x + GETARG_C(i));\n }\n#else\n mrb_float(regs[a]) += GETARG_C(i);\n#endif\n break;\n#endif\n default:\n SET_INT_VALUE(regs[a+1], GETARG_C(i));\n i = MKOP_ABC(OP_SEND, a, GETARG_B(i), 1);\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_SUBI) {\n /* A B C R(A) := R(A)-C (Syms[B]=:-)*/\n int a = GETARG_A(i);\n mrb_value *regs_a = regs + a;\n\n /* need to check if + is overridden */\n switch (mrb_type(regs_a[0])) {\n case MRB_TT_FIXNUM:\n {\n mrb_int x = mrb_fixnum(regs_a[0]);\n mrb_int y = GETARG_C(i);\n mrb_int z;\n\n if (mrb_int_sub_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs_a[0], (mrb_float)x - (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs_a[0], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case MRB_TT_FLOAT:\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n SET_FLOAT_VALUE(mrb, regs[a], x - GETARG_C(i));\n }\n#else\n mrb_float(regs_a[0]) -= GETARG_C(i);\n#endif\n break;\n#endif\n default:\n SET_INT_VALUE(regs_a[1], GETARG_C(i));\n i = MKOP_ABC(OP_SEND, a, GETARG_B(i), 1);\n goto L_SEND;\n }\n NEXT;\n }\n\n#define OP_CMP_BODY(op,v1,v2) (v1(regs[a]) op v2(regs[a+1]))\n\n#ifdef MRB_WITHOUT_FLOAT\n#define OP_CMP(op) do {\\\n int result;\\\n /* need to check if - is overridden */\\\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_fixnum);\\\n break;\\\n default:\\\n goto L_SEND;\\\n }\\\n if (result) {\\\n SET_TRUE_VALUE(regs[a]);\\\n }\\\n else {\\\n SET_FALSE_VALUE(regs[a]);\\\n }\\\n} while(0)\n#else\n#define OP_CMP(op) do {\\\n int result;\\\n /* need to check if - is overridden */\\\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_fixnum);\\\n break;\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_float);\\\n break;\\\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_float,mrb_fixnum);\\\n break;\\\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\\\n result = OP_CMP_BODY(op,mrb_float,mrb_float);\\\n break;\\\n default:\\\n goto L_SEND;\\\n }\\\n if (result) {\\\n SET_TRUE_VALUE(regs[a]);\\\n }\\\n else {\\\n SET_FALSE_VALUE(regs[a]);\\\n }\\\n} while(0)\n#endif\n\n CASE(OP_EQ) {\n /* A B C R(A) := R(A)==R(A+1) (Syms[B]=:==,C=1)*/\n int a = GETARG_A(i);\n if (mrb_obj_eq(mrb, regs[a], regs[a+1])) {\n SET_TRUE_VALUE(regs[a]);\n }\n else {\n OP_CMP(==);\n }\n NEXT;\n }\n\n CASE(OP_LT) {\n /* A B C R(A) := R(A)R(A+1) (Syms[B]=:>,C=1)*/\n int a = GETARG_A(i);\n OP_CMP(>);\n NEXT;\n }\n\n CASE(OP_GE) {\n /* A B C R(A) := R(A)>=R(A+1) (Syms[B]=:>=,C=1)*/\n int a = GETARG_A(i);\n OP_CMP(>=);\n NEXT;\n }\n\n CASE(OP_ARRAY) {\n /* A B C R(A) := ary_new(R(B),R(B+1)..R(B+C)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value v = mrb_ary_new_from_values(mrb, c, ®s[b]);\n regs[a] = v;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ARYCAT) {\n /* A B mrb_ary_concat(R(A),R(B)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n mrb_value splat = mrb_ary_splat(mrb, regs[b]);\n mrb_ary_concat(mrb, regs[a], splat);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ARYPUSH) {\n /* A B R(A).push(R(B)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n mrb_ary_push(mrb, regs[a], regs[b]);\n NEXT;\n }\n\n CASE(OP_AREF) {\n /* A B C R(A) := R(B)[C] */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value v = regs[b];\n\n if (!mrb_array_p(v)) {\n if (c == 0) {\n regs[a] = v;\n }\n else {\n SET_NIL_VALUE(regs[a]);\n }\n }\n else {\n v = mrb_ary_ref(mrb, v, c);\n regs[a] = v;\n }\n NEXT;\n }\n\n CASE(OP_ASET) {\n /* A B C R(B)[C] := R(A) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_ary_set(mrb, regs[b], c, regs[a]);\n NEXT;\n }\n\n CASE(OP_APOST) {\n /* A B C *R(A),R(A+1)..R(A+C) := R(A) */\n int a = GETARG_A(i);\n mrb_value v = regs[a];\n int pre = GETARG_B(i);\n int post = GETARG_C(i);\n struct RArray *ary;\n int len, idx;\n\n if (!mrb_array_p(v)) {\n v = mrb_ary_new_from_values(mrb, 1, ®s[a]);\n }\n ary = mrb_ary_ptr(v);\n len = (int)ARY_LEN(ary);\n if (len > pre + post) {\n v = mrb_ary_new_from_values(mrb, len - pre - post, ARY_PTR(ary)+pre);\n regs[a++] = v;\n while (post--) {\n regs[a++] = ARY_PTR(ary)[len-post-1];\n }\n }\n else {\n v = mrb_ary_new_capa(mrb, 0);\n regs[a++] = v;\n for (idx=0; idx+prereps[b];\n\n if (c & OP_L_CAPTURE) {\n p = mrb_closure_new(mrb, nirep);\n }\n else {\n p = mrb_proc_new(mrb, nirep);\n p->flags |= MRB_PROC_SCOPE;\n }\n if (c & OP_L_STRICT) p->flags |= MRB_PROC_STRICT;\n regs[a] = mrb_obj_value(p);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_OCLASS) {\n /* A R(A) := ::Object */\n regs[GETARG_A(i)] = mrb_obj_value(mrb->object_class);\n NEXT;\n }\n\n CASE(OP_CLASS) {\n /* A B R(A) := newclass(R(A),Syms(B),R(A+1)) */\n struct RClass *c = 0, *baseclass;\n int a = GETARG_A(i);\n mrb_value base, super;\n mrb_sym id = syms[GETARG_B(i)];\n\n base = regs[a];\n super = regs[a+1];\n if (mrb_nil_p(base)) {\n baseclass = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc);\n base = mrb_obj_value(baseclass);\n }\n c = mrb_vm_define_class(mrb, base, super, id);\n regs[a] = mrb_obj_value(c);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_MODULE) {\n /* A B R(A) := newmodule(R(A),Syms(B)) */\n struct RClass *c = 0, *baseclass;\n int a = GETARG_A(i);\n mrb_value base;\n mrb_sym id = syms[GETARG_B(i)];\n\n base = regs[a];\n if (mrb_nil_p(base)) {\n baseclass = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc);\n base = mrb_obj_value(baseclass);\n }\n c = mrb_vm_define_module(mrb, base, id);\n regs[a] = mrb_obj_value(c);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_EXEC) {\n /* A Bx R(A) := blockexec(R(A),SEQ[Bx]) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_callinfo *ci;\n mrb_value recv = regs[a];\n struct RProc *p;\n mrb_irep *nirep = irep->reps[bx];\n\n /* prepare closure */\n p = mrb_proc_new(mrb, nirep);\n p->c = NULL;\n mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)proc);\n MRB_PROC_SET_TARGET_CLASS(p, mrb_class_ptr(recv));\n p->flags |= MRB_PROC_SCOPE;\n\n /* prepare call stack */\n ci = cipush(mrb);\n ci->pc = pc + 1;\n ci->acc = a;\n ci->mid = 0;\n ci->stackent = mrb->c->stack;\n ci->argc = 0;\n ci->target_class = mrb_class_ptr(recv);\n\n /* prepare stack */\n mrb->c->stack += a;\n\n /* setup block to call */\n ci->proc = p;\n\n irep = p->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, ci->nregs);\n stack_clear(regs+1, ci->nregs-1);\n pc = irep->iseq;\n JUMP;\n }\n\n CASE(OP_METHOD) {\n /* A B R(A).newmethod(Syms(B),R(A+1)) */\n int a = GETARG_A(i);\n struct RClass *c = mrb_class_ptr(regs[a]);\n struct RProc *p = mrb_proc_ptr(regs[a+1]);\n mrb_method_t m;\n\n MRB_METHOD_FROM_PROC(m, p);\n mrb_define_method_raw(mrb, c, syms[GETARG_B(i)], m);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_SCLASS) {\n /* A B R(A) := R(B).singleton_class */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n\n regs[a] = mrb_singleton_class(mrb, regs[b]);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_TCLASS) {\n /* A R(A) := target_class */\n if (!mrb->c->ci->target_class) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR, \"no target class or module\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n regs[GETARG_A(i)] = mrb_obj_value(mrb->c->ci->target_class);\n NEXT;\n }\n\n CASE(OP_RANGE) {\n /* A B C R(A) := range_new(R(B),R(B+1),C) */\n int b = GETARG_B(i);\n mrb_value val = mrb_range_new(mrb, regs[b], regs[b+1], GETARG_C(i));\n regs[GETARG_A(i)] = val;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_DEBUG) {\n /* A B C debug print R(A),R(B),R(C) */\n#ifdef MRB_ENABLE_DEBUG_HOOK\n mrb->debug_op_hook(mrb, irep, pc, regs);\n#else\n#ifndef MRB_DISABLE_STDIO\n printf(\"OP_DEBUG %d %d %d\\n\", GETARG_A(i), GETARG_B(i), GETARG_C(i));\n#else\n abort();\n#endif\n#endif\n NEXT;\n }\n\n CASE(OP_STOP) {\n /* stop VM */\n L_STOP:\n while (mrb->c->eidx > 0) {\n ecall(mrb);\n }\n ERR_PC_CLR(mrb);\n mrb->jmp = prev_jmp;\n if (mrb->exc) {\n return mrb_obj_value(mrb->exc);\n }\n return regs[irep->nlocals];\n }\n\n CASE(OP_ERR) {\n /* Bx raise RuntimeError with message Lit(Bx) */\n mrb_value msg = mrb_str_dup(mrb, pool[GETARG_Bx(i)]);\n mrb_value exc;\n\n if (GETARG_A(i) == 0) {\n exc = mrb_exc_new_str(mrb, E_RUNTIME_ERROR, msg);\n }\n else {\n exc = mrb_exc_new_str(mrb, E_LOCALJUMP_ERROR, msg);\n }\n ERR_PC_SET(mrb, pc);\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n END_DISPATCH;\n#undef regs\n\n }\n MRB_CATCH(&c_jmp) {\n exc_catched = TRUE;\n goto RETRY_TRY_BLOCK;\n }\n MRB_END_EXC(&c_jmp);\n}","target":"mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)\n{\n /* mrb_assert(mrb_proc_cfunc_p(proc)) */\n mrb_irep *irep = proc->body.irep;\n mrb_value *pool = irep->pool;\n mrb_sym *syms = irep->syms;\n mrb_code i;\n int ai = mrb_gc_arena_save(mrb);\n struct mrb_jmpbuf *prev_jmp = mrb->jmp;\n struct mrb_jmpbuf c_jmp;\n\n#ifdef DIRECT_THREADED\n static void *optable[] = {\n &&L_OP_NOP, &&L_OP_MOVE,\n &&L_OP_LOADL, &&L_OP_LOADI, &&L_OP_LOADSYM, &&L_OP_LOADNIL,\n &&L_OP_LOADSELF, &&L_OP_LOADT, &&L_OP_LOADF,\n &&L_OP_GETGLOBAL, &&L_OP_SETGLOBAL, &&L_OP_GETSPECIAL, &&L_OP_SETSPECIAL,\n &&L_OP_GETIV, &&L_OP_SETIV, &&L_OP_GETCV, &&L_OP_SETCV,\n &&L_OP_GETCONST, &&L_OP_SETCONST, &&L_OP_GETMCNST, &&L_OP_SETMCNST,\n &&L_OP_GETUPVAR, &&L_OP_SETUPVAR,\n &&L_OP_JMP, &&L_OP_JMPIF, &&L_OP_JMPNOT,\n &&L_OP_ONERR, &&L_OP_RESCUE, &&L_OP_POPERR, &&L_OP_RAISE, &&L_OP_EPUSH, &&L_OP_EPOP,\n &&L_OP_SEND, &&L_OP_SENDB, &&L_OP_FSEND,\n &&L_OP_CALL, &&L_OP_SUPER, &&L_OP_ARGARY, &&L_OP_ENTER,\n &&L_OP_KARG, &&L_OP_KDICT, &&L_OP_RETURN, &&L_OP_TAILCALL, &&L_OP_BLKPUSH,\n &&L_OP_ADD, &&L_OP_ADDI, &&L_OP_SUB, &&L_OP_SUBI, &&L_OP_MUL, &&L_OP_DIV,\n &&L_OP_EQ, &&L_OP_LT, &&L_OP_LE, &&L_OP_GT, &&L_OP_GE,\n &&L_OP_ARRAY, &&L_OP_ARYCAT, &&L_OP_ARYPUSH, &&L_OP_AREF, &&L_OP_ASET, &&L_OP_APOST,\n &&L_OP_STRING, &&L_OP_STRCAT, &&L_OP_HASH,\n &&L_OP_LAMBDA, &&L_OP_RANGE, &&L_OP_OCLASS,\n &&L_OP_CLASS, &&L_OP_MODULE, &&L_OP_EXEC,\n &&L_OP_METHOD, &&L_OP_SCLASS, &&L_OP_TCLASS,\n &&L_OP_DEBUG, &&L_OP_STOP, &&L_OP_ERR,\n };\n#endif\n\n mrb_bool exc_catched = FALSE;\nRETRY_TRY_BLOCK:\n\n MRB_TRY(&c_jmp) {\n\n if (exc_catched) {\n exc_catched = FALSE;\n if (mrb->exc && mrb->exc->tt == MRB_TT_BREAK)\n goto L_BREAK;\n goto L_RAISE;\n }\n mrb->jmp = &c_jmp;\n mrb->c->ci->proc = proc;\n mrb->c->ci->nregs = irep->nregs;\n\n#define regs (mrb->c->stack)\n INIT_DISPATCH {\n CASE(OP_NOP) {\n /* do nothing */\n NEXT;\n }\n\n CASE(OP_MOVE) {\n /* A B R(A) := R(B) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n regs[a] = regs[b];\n NEXT;\n }\n\n CASE(OP_LOADL) {\n /* A Bx R(A) := Pool(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n#ifdef MRB_WORD_BOXING\n mrb_value val = pool[bx];\n#ifndef MRB_WITHOUT_FLOAT\n if (mrb_float_p(val)) {\n val = mrb_float_value(mrb, mrb_float(val));\n }\n#endif\n regs[a] = val;\n#else\n regs[a] = pool[bx];\n#endif\n NEXT;\n }\n\n CASE(OP_LOADI) {\n /* A sBx R(A) := sBx */\n int a = GETARG_A(i);\n mrb_int bx = GETARG_sBx(i);\n SET_INT_VALUE(regs[a], bx);\n NEXT;\n }\n\n CASE(OP_LOADSYM) {\n /* A Bx R(A) := Syms(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n SET_SYM_VALUE(regs[a], syms[bx]);\n NEXT;\n }\n\n CASE(OP_LOADSELF) {\n /* A R(A) := self */\n int a = GETARG_A(i);\n regs[a] = regs[0];\n NEXT;\n }\n\n CASE(OP_LOADT) {\n /* A R(A) := true */\n int a = GETARG_A(i);\n SET_TRUE_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_LOADF) {\n /* A R(A) := false */\n int a = GETARG_A(i);\n SET_FALSE_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_GETGLOBAL) {\n /* A Bx R(A) := getglobal(Syms(Bx)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_gv_get(mrb, syms[bx]);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETGLOBAL) {\n /* A Bx setglobal(Syms(Bx), R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_gv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETSPECIAL) {\n /* A Bx R(A) := Special[Bx] */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_vm_special_get(mrb, bx);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETSPECIAL) {\n /* A Bx Special[Bx] := R(A) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_special_set(mrb, bx, regs[a]);\n NEXT;\n }\n\n CASE(OP_GETIV) {\n /* A Bx R(A) := ivget(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_vm_iv_get(mrb, syms[bx]);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETIV) {\n /* A Bx ivset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_iv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETCV) {\n /* A Bx R(A) := cvget(Syms(Bx)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val;\n ERR_PC_SET(mrb, pc);\n val = mrb_vm_cv_get(mrb, syms[bx]);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETCV) {\n /* A Bx cvset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_cv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETCONST) {\n /* A Bx R(A) := constget(Syms(Bx)) */\n mrb_value val;\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_sym sym = syms[bx];\n\n ERR_PC_SET(mrb, pc);\n val = mrb_vm_const_get(mrb, sym);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETCONST) {\n /* A Bx constset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_const_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETMCNST) {\n /* A Bx R(A) := R(A)::Syms(Bx) */\n mrb_value val;\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n\n ERR_PC_SET(mrb, pc);\n val = mrb_const_get(mrb, regs[a], syms[bx]);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETMCNST) {\n /* A Bx R(A+1)::Syms(Bx) := R(A) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_const_set(mrb, regs[a+1], syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETUPVAR) {\n /* A B C R(A) := uvget(B,C) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value *regs_a = regs + a;\n struct REnv *e = uvenv(mrb, c);\n\n if (e && b < MRB_ENV_STACK_LEN(e)) {\n *regs_a = e->stack[b];\n }\n else {\n *regs_a = mrb_nil_value();\n }\n NEXT;\n }\n\n CASE(OP_SETUPVAR) {\n /* A B C uvset(B,C,R(A)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n\n struct REnv *e = uvenv(mrb, c);\n\n if (e) {\n mrb_value *regs_a = regs + a;\n\n if (b < MRB_ENV_STACK_LEN(e)) {\n e->stack[b] = *regs_a;\n mrb_write_barrier(mrb, (struct RBasic*)e);\n }\n }\n NEXT;\n }\n\n CASE(OP_JMP) {\n /* sBx pc+=sBx */\n int sbx = GETARG_sBx(i);\n pc += sbx;\n JUMP;\n }\n\n CASE(OP_JMPIF) {\n /* A sBx if R(A) pc+=sBx */\n int a = GETARG_A(i);\n int sbx = GETARG_sBx(i);\n if (mrb_test(regs[a])) {\n pc += sbx;\n JUMP;\n }\n NEXT;\n }\n\n CASE(OP_JMPNOT) {\n /* A sBx if !R(A) pc+=sBx */\n int a = GETARG_A(i);\n int sbx = GETARG_sBx(i);\n if (!mrb_test(regs[a])) {\n pc += sbx;\n JUMP;\n }\n NEXT;\n }\n\n CASE(OP_ONERR) {\n /* sBx pc+=sBx on exception */\n int sbx = GETARG_sBx(i);\n if (mrb->c->rsize <= mrb->c->ci->ridx) {\n if (mrb->c->rsize == 0) mrb->c->rsize = RESCUE_STACK_INIT_SIZE;\n else mrb->c->rsize *= 2;\n mrb->c->rescue = (mrb_code **)mrb_realloc(mrb, mrb->c->rescue, sizeof(mrb_code*) * mrb->c->rsize);\n }\n mrb->c->rescue[mrb->c->ci->ridx++] = pc + sbx;\n NEXT;\n }\n\n CASE(OP_RESCUE) {\n /* A B R(A) := exc; clear(exc); R(B) := matched (bool) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value exc;\n\n if (c == 0) {\n exc = mrb_obj_value(mrb->exc);\n mrb->exc = 0;\n }\n else { /* continued; exc taken from R(A) */\n exc = regs[a];\n }\n if (b != 0) {\n mrb_value e = regs[b];\n struct RClass *ec;\n\n switch (mrb_type(e)) {\n case MRB_TT_CLASS:\n case MRB_TT_MODULE:\n break;\n default:\n {\n mrb_value exc;\n\n exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR,\n \"class or module required for rescue clause\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n ec = mrb_class_ptr(e);\n regs[b] = mrb_bool_value(mrb_obj_is_kind_of(mrb, exc, ec));\n }\n if (a != 0 && c == 0) {\n regs[a] = exc;\n }\n NEXT;\n }\n\n CASE(OP_POPERR) {\n /* A A.times{rescue_pop()} */\n int a = GETARG_A(i);\n\n mrb->c->ci->ridx -= a;\n NEXT;\n }\n\n CASE(OP_RAISE) {\n /* A raise(R(A)) */\n int a = GETARG_A(i);\n\n mrb_exc_set(mrb, regs[a]);\n goto L_RAISE;\n }\n\n CASE(OP_EPUSH) {\n /* Bx ensure_push(SEQ[Bx]) */\n int bx = GETARG_Bx(i);\n struct RProc *p;\n\n p = mrb_closure_new(mrb, irep->reps[bx]);\n /* push ensure_stack */\n if (mrb->c->esize <= mrb->c->eidx+1) {\n if (mrb->c->esize == 0) mrb->c->esize = ENSURE_STACK_INIT_SIZE;\n else mrb->c->esize *= 2;\n mrb->c->ensure = (struct RProc **)mrb_realloc(mrb, mrb->c->ensure, sizeof(struct RProc*) * mrb->c->esize);\n }\n mrb->c->ensure[mrb->c->eidx++] = p;\n mrb->c->ensure[mrb->c->eidx] = NULL;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_EPOP) {\n /* A A.times{ensure_pop().call} */\n int a = GETARG_A(i);\n mrb_callinfo *ci = mrb->c->ci;\n int n, epos = ci->epos;\n mrb_value self = regs[0];\n struct RClass *target_class = ci->target_class;\n\n if (mrb->c->eidx <= epos) {\n NEXT;\n }\n\n if (a > mrb->c->eidx - epos)\n a = mrb->c->eidx - epos;\n pc = pc + 1;\n for (n=0; nc->ensure[epos+n];\n mrb->c->ensure[epos+n] = NULL;\n if (proc == NULL) continue;\n irep = proc->body.irep;\n ci = cipush(mrb);\n ci->mid = ci[-1].mid;\n ci->argc = 0;\n ci->proc = proc;\n ci->stackent = mrb->c->stack;\n ci->nregs = irep->nregs;\n ci->target_class = target_class;\n ci->pc = pc;\n ci->acc = ci[-1].nregs;\n mrb->c->stack += ci->acc;\n stack_extend(mrb, ci->nregs);\n regs[0] = self;\n pc = irep->iseq;\n }\n pool = irep->pool;\n syms = irep->syms;\n mrb->c->eidx = epos;\n JUMP;\n }\n\n CASE(OP_LOADNIL) {\n /* A R(A) := nil */\n int a = GETARG_A(i);\n\n SET_NIL_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_SENDB) {\n /* A B C R(A) := call(R(A),Syms(B),R(A+1),...,R(A+C),&R(A+C+1))*/\n /* fall through */\n };\n\n L_SEND:\n CASE(OP_SEND) {\n /* A B C R(A) := call(R(A),Syms(B),R(A+1),...,R(A+C)) */\n int a = GETARG_A(i);\n int n = GETARG_C(i);\n int argc = (n == CALL_MAXARGS) ? -1 : n;\n int bidx = (argc < 0) ? a+2 : a+n+1;\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci = mrb->c->ci;\n mrb_value recv, blk;\n mrb_sym mid = syms[GETARG_B(i)];\n\n mrb_assert(bidx < ci->nregs);\n\n recv = regs[a];\n if (GET_OPCODE(i) != OP_SENDB) {\n SET_NIL_VALUE(regs[bidx]);\n blk = regs[bidx];\n }\n else {\n blk = regs[bidx];\n if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {\n blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, \"Proc\", \"to_proc\");\n /* The stack might have been reallocated during mrb_convert_type(),\n see #3622 */\n regs[bidx] = blk;\n }\n }\n c = mrb_class(mrb, recv);\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m) || (missing == mrb->c->ci->mid && mrb_obj_eq(mrb, regs[0], recv))) {\n mrb_value args = (argc < 0) ? regs[a+1] : mrb_ary_new_from_values(mrb, n, regs+a+1);\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n if (argc >= 0) {\n if (a+2 >= irep->nregs) {\n stack_extend(mrb, a+3);\n }\n regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1);\n regs[a+2] = blk;\n argc = -1;\n }\n mrb_ary_unshift(mrb, regs[a+1], mrb_symbol_value(mid));\n mid = missing;\n }\n\n /* push callinfo */\n ci = cipush(mrb);\n ci->mid = mid;\n ci->stackent = mrb->c->stack;\n ci->target_class = c;\n ci->argc = argc;\n\n ci->pc = pc + 1;\n ci->acc = a;\n\n /* prepare stack */\n mrb->c->stack += a;\n\n if (MRB_METHOD_CFUNC_P(m)) {\n ci->nregs = (argc < 0) ? 3 : n+2;\n if (MRB_METHOD_PROC_P(m)) {\n struct RProc *p = MRB_METHOD_PROC(m);\n\n ci->proc = p;\n recv = p->body.func(mrb, recv);\n }\n else {\n recv = MRB_METHOD_FUNC(m)(mrb, recv);\n }\n mrb_gc_arena_restore(mrb, ai);\n mrb_gc_arena_shrink(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n ci = mrb->c->ci;\n if (GET_OPCODE(i) == OP_SENDB) {\n if (mrb_type(blk) == MRB_TT_PROC) {\n struct RProc *p = mrb_proc_ptr(blk);\n if (p && !MRB_PROC_STRICT_P(p) && MRB_PROC_ENV(p) == ci[-1].env) {\n p->flags |= MRB_PROC_ORPHAN;\n }\n }\n }\n if (!ci->target_class) { /* return from context modifying method (resume/yield) */\n if (ci->acc == CI_ACC_RESUMED) {\n mrb->jmp = prev_jmp;\n return recv;\n }\n else {\n mrb_assert(!MRB_PROC_CFUNC_P(ci[-1].proc));\n proc = ci[-1].proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n }\n }\n mrb->c->stack[0] = recv;\n /* pop stackpos */\n mrb->c->stack = ci->stackent;\n pc = ci->pc;\n cipop(mrb);\n JUMP;\n }\n else {\n /* setup environment for calling method */\n proc = ci->proc = MRB_METHOD_PROC(m);\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, (argc < 0 && ci->nregs < 3) ? 3 : ci->nregs);\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_FSEND) {\n /* A B C R(A) := fcall(R(A),Syms(B),R(A+1),... ,R(A+C-1)) */\n /* not implemented yet */\n NEXT;\n }\n\n CASE(OP_CALL) {\n /* A R(A) := self.call(frame.argc, frame.argv) */\n mrb_callinfo *ci;\n mrb_value recv = mrb->c->stack[0];\n struct RProc *m = mrb_proc_ptr(recv);\n\n /* replace callinfo */\n ci = mrb->c->ci;\n ci->target_class = MRB_PROC_TARGET_CLASS(m);\n ci->proc = m;\n if (MRB_PROC_ENV_P(m)) {\n mrb_sym mid;\n struct REnv *e = MRB_PROC_ENV(m);\n\n mid = e->mid;\n if (mid) ci->mid = mid;\n if (!e->stack) {\n e->stack = mrb->c->stack;\n }\n }\n\n /* prepare stack */\n if (MRB_PROC_CFUNC_P(m)) {\n recv = MRB_PROC_CFUNC(m)(mrb, recv);\n mrb_gc_arena_restore(mrb, ai);\n mrb_gc_arena_shrink(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n /* pop stackpos */\n ci = mrb->c->ci;\n mrb->c->stack = ci->stackent;\n regs[ci->acc] = recv;\n pc = ci->pc;\n cipop(mrb);\n irep = mrb->c->ci->proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n JUMP;\n }\n else {\n /* setup environment for calling method */\n proc = m;\n irep = m->body.irep;\n if (!irep) {\n mrb->c->stack[0] = mrb_nil_value();\n goto L_RETURN;\n }\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, ci->nregs);\n if (ci->argc < 0) {\n if (irep->nregs > 3) {\n stack_clear(regs+3, irep->nregs-3);\n }\n }\n else if (ci->argc+2 < irep->nregs) {\n stack_clear(regs+ci->argc+2, irep->nregs-ci->argc-2);\n }\n if (MRB_PROC_ENV_P(m)) {\n regs[0] = MRB_PROC_ENV(m)->stack[0];\n }\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_SUPER) {\n /* A C R(A) := super(R(A+1),... ,R(A+C+1)) */\n int a = GETARG_A(i);\n int n = GETARG_C(i);\n int argc = (n == CALL_MAXARGS) ? -1 : n;\n int bidx = (argc < 0) ? a+2 : a+n+1;\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci = mrb->c->ci;\n mrb_value recv, blk;\n mrb_sym mid = ci->mid;\n struct RClass* target_class = MRB_PROC_TARGET_CLASS(ci->proc);\n\n mrb_assert(bidx < ci->nregs);\n\n if (mid == 0 || !target_class) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, \"super called outside of method\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (target_class->tt == MRB_TT_MODULE) {\n target_class = ci->target_class;\n if (target_class->tt != MRB_TT_ICLASS) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_RUNTIME_ERROR, \"superclass info lost [mruby limitations]\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n recv = regs[0];\n if (!mrb_obj_is_kind_of(mrb, recv, target_class)) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR,\n \"self has wrong type to call super in this context\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n blk = regs[bidx];\n if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {\n blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, \"Proc\", \"to_proc\");\n /* The stack or ci stack might have been reallocated during\n mrb_convert_type(), see #3622 and #3784 */\n regs[bidx] = blk;\n ci = mrb->c->ci;\n }\n c = target_class->super;\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n\n if (mid != missing) {\n c = mrb_class(mrb, recv);\n }\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value args = (argc < 0) ? regs[a+1] : mrb_ary_new_from_values(mrb, n, regs+a+1);\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n mid = missing;\n if (argc >= 0) {\n if (a+2 >= ci->nregs) {\n stack_extend(mrb, a+3);\n }\n regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1);\n regs[a+2] = blk;\n argc = -1;\n }\n mrb_ary_unshift(mrb, regs[a+1], mrb_symbol_value(ci->mid));\n }\n\n /* push callinfo */\n ci = cipush(mrb);\n ci->mid = mid;\n ci->stackent = mrb->c->stack;\n ci->target_class = c;\n ci->pc = pc + 1;\n ci->argc = argc;\n\n /* prepare stack */\n mrb->c->stack += a;\n mrb->c->stack[0] = recv;\n\n if (MRB_METHOD_CFUNC_P(m)) {\n mrb_value v;\n ci->nregs = (argc < 0) ? 3 : n+2;\n if (MRB_METHOD_PROC_P(m)) {\n ci->proc = MRB_METHOD_PROC(m);\n }\n v = MRB_METHOD_CFUNC(m)(mrb, recv);\n mrb_gc_arena_restore(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n ci = mrb->c->ci;\n if (!ci->target_class) { /* return from context modifying method (resume/yield) */\n if (ci->acc == CI_ACC_RESUMED) {\n mrb->jmp = prev_jmp;\n return v;\n }\n else {\n mrb_assert(!MRB_PROC_CFUNC_P(ci[-1].proc));\n proc = ci[-1].proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n }\n }\n mrb->c->stack[0] = v;\n /* pop stackpos */\n mrb->c->stack = ci->stackent;\n pc = ci->pc;\n cipop(mrb);\n JUMP;\n }\n else {\n /* fill callinfo */\n ci->acc = a;\n\n /* setup environment for calling method */\n proc = ci->proc = MRB_METHOD_PROC(m);\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, (argc < 0 && ci->nregs < 3) ? 3 : ci->nregs);\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_ARGARY) {\n /* A Bx R(A) := argument array (16=6:1:5:4) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n int m1 = (bx>>10)&0x3f;\n int r = (bx>>9)&0x1;\n int m2 = (bx>>4)&0x1f;\n int lv = (bx>>0)&0xf;\n mrb_value *stack;\n\n if (mrb->c->ci->mid == 0 || mrb->c->ci->target_class == NULL) {\n mrb_value exc;\n\n L_NOSUPER:\n exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, \"super called outside of method\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (lv == 0) stack = regs + 1;\n else {\n struct REnv *e = uvenv(mrb, lv-1);\n if (!e) goto L_NOSUPER;\n if (MRB_ENV_STACK_LEN(e) <= m1+r+m2+1)\n goto L_NOSUPER;\n stack = e->stack + 1;\n }\n if (r == 0) {\n regs[a] = mrb_ary_new_from_values(mrb, m1+m2, stack);\n }\n else {\n mrb_value *pp = NULL;\n struct RArray *rest;\n int len = 0;\n\n if (mrb_array_p(stack[m1])) {\n struct RArray *ary = mrb_ary_ptr(stack[m1]);\n\n pp = ARY_PTR(ary);\n len = (int)ARY_LEN(ary);\n }\n regs[a] = mrb_ary_new_capa(mrb, m1+len+m2);\n rest = mrb_ary_ptr(regs[a]);\n if (m1 > 0) {\n stack_copy(ARY_PTR(rest), stack, m1);\n }\n if (len > 0) {\n stack_copy(ARY_PTR(rest)+m1, pp, len);\n }\n if (m2 > 0) {\n stack_copy(ARY_PTR(rest)+m1+len, stack+m1+1, m2);\n }\n ARY_SET_LEN(rest, m1+len+m2);\n }\n regs[a+1] = stack[m1+r+m2];\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ENTER) {\n /* Ax arg setup according to flags (23=5:5:1:5:5:1:1) */\n /* number of optional arguments times OP_JMP should follow */\n mrb_aspec ax = GETARG_Ax(i);\n int m1 = MRB_ASPEC_REQ(ax);\n int o = MRB_ASPEC_OPT(ax);\n int r = MRB_ASPEC_REST(ax);\n int m2 = MRB_ASPEC_POST(ax);\n /* unused\n int k = MRB_ASPEC_KEY(ax);\n int kd = MRB_ASPEC_KDICT(ax);\n int b = MRB_ASPEC_BLOCK(ax);\n */\n int argc = mrb->c->ci->argc;\n mrb_value *argv = regs+1;\n mrb_value *argv0 = argv;\n int len = m1 + o + r + m2;\n mrb_value *blk = &argv[argc < 0 ? 1 : argc];\n\n if (argc < 0) {\n struct RArray *ary = mrb_ary_ptr(regs[1]);\n argv = ARY_PTR(ary);\n argc = (int)ARY_LEN(ary);\n mrb_gc_protect(mrb, regs[1]);\n }\n if (mrb->c->ci->proc && MRB_PROC_STRICT_P(mrb->c->ci->proc)) {\n if (argc >= 0) {\n if (argc < m1 + m2 || (r == 0 && argc > len)) {\n argnum_error(mrb, m1+m2);\n goto L_RAISE;\n }\n }\n }\n else if (len > 1 && argc == 1 && mrb_array_p(argv[0])) {\n mrb_gc_protect(mrb, argv[0]);\n argc = (int)RARRAY_LEN(argv[0]);\n argv = RARRAY_PTR(argv[0]);\n }\n if (argc < len) {\n int mlen = m2;\n if (argc < m1+m2) {\n if (m1 < argc)\n mlen = argc - m1;\n else\n mlen = 0;\n }\n regs[len+1] = *blk; /* move block */\n SET_NIL_VALUE(regs[argc+1]);\n if (argv0 != argv) {\n value_move(®s[1], argv, argc-mlen); /* m1 + o */\n }\n if (argc < m1) {\n stack_clear(®s[argc+1], m1-argc);\n }\n if (mlen) {\n value_move(®s[len-m2+1], &argv[argc-mlen], mlen);\n }\n if (mlen < m2) {\n stack_clear(®s[len-m2+mlen+1], m2-mlen);\n }\n if (r) {\n regs[m1+o+1] = mrb_ary_new_capa(mrb, 0);\n }\n if (o == 0 || argc < m1+m2) pc++;\n else\n pc += argc - m1 - m2 + 1;\n }\n else {\n int rnum = 0;\n if (argv0 != argv) {\n regs[len+1] = *blk; /* move block */\n value_move(®s[1], argv, m1+o);\n }\n if (r) {\n rnum = argc-m1-o-m2;\n regs[m1+o+1] = mrb_ary_new_from_values(mrb, rnum, argv+m1+o);\n }\n if (m2) {\n if (argc-m2 > m1) {\n value_move(®s[m1+o+r+1], &argv[m1+o+rnum], m2);\n }\n }\n if (argv0 == argv) {\n regs[len+1] = *blk; /* move block */\n }\n pc += o + 1;\n }\n mrb->c->ci->argc = len;\n /* clear local (but non-argument) variables */\n if (irep->nlocals-len-2 > 0) {\n stack_clear(®s[len+2], irep->nlocals-len-2);\n }\n JUMP;\n }\n\n CASE(OP_KARG) {\n /* A B C R(A) := kdict[Syms(B)]; if C kdict.rm(Syms(B)) */\n /* if C == 2; raise unless kdict.empty? */\n /* OP_JMP should follow to skip init code */\n NEXT;\n }\n\n CASE(OP_KDICT) {\n /* A C R(A) := kdict */\n NEXT;\n }\n\n L_RETURN:\n i = MKOP_AB(OP_RETURN, GETARG_A(i), OP_R_NORMAL);\n /* fall through */\n CASE(OP_RETURN) {\n /* A B return R(A) (B=normal,in-block return/break) */\n mrb_callinfo *ci;\n\n#define ecall_adjust() do {\\\n ptrdiff_t cioff = ci - mrb->c->cibase;\\\n ecall(mrb);\\\n ci = mrb->c->cibase + cioff;\\\n} while (0)\n\n ci = mrb->c->ci;\n if (ci->mid) {\n mrb_value blk;\n\n if (ci->argc < 0) {\n blk = regs[2];\n }\n else {\n blk = regs[ci->argc+1];\n }\n if (mrb_type(blk) == MRB_TT_PROC) {\n struct RProc *p = mrb_proc_ptr(blk);\n\n if (!MRB_PROC_STRICT_P(p) &&\n ci > mrb->c->cibase && MRB_PROC_ENV(p) == ci[-1].env) {\n p->flags |= MRB_PROC_ORPHAN;\n }\n }\n }\n\n if (mrb->exc) {\n mrb_callinfo *ci0;\n\n L_RAISE:\n ci0 = ci = mrb->c->ci;\n if (ci == mrb->c->cibase) {\n if (ci->ridx == 0) goto L_FTOP;\n goto L_RESCUE;\n }\n while (ci[0].ridx == ci[-1].ridx) {\n cipop(mrb);\n mrb->c->stack = ci->stackent;\n if (ci->acc == CI_ACC_SKIP && prev_jmp) {\n mrb->jmp = prev_jmp;\n MRB_THROW(prev_jmp);\n }\n ci = mrb->c->ci;\n if (ci == mrb->c->cibase) {\n if (ci->ridx == 0) {\n L_FTOP: /* fiber top */\n if (mrb->c == mrb->root_c) {\n mrb->c->stack = mrb->c->stbase;\n goto L_STOP;\n }\n else {\n struct mrb_context *c = mrb->c;\n\n while (c->eidx > ci->epos) {\n ecall_adjust();\n }\n if (c->fib) {\n mrb_write_barrier(mrb, (struct RBasic*)c->fib);\n }\n mrb->c->status = MRB_FIBER_TERMINATED;\n mrb->c = c->prev;\n c->prev = NULL;\n goto L_RAISE;\n }\n }\n break;\n }\n /* call ensure only when we skip this callinfo */\n if (ci[0].ridx == ci[-1].ridx) {\n while (mrb->c->eidx > ci->epos) {\n ecall_adjust();\n }\n }\n }\n L_RESCUE:\n if (ci->ridx == 0) goto L_STOP;\n proc = ci->proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n if (ci < ci0) {\n mrb->c->stack = ci[1].stackent;\n }\n stack_extend(mrb, irep->nregs);\n pc = mrb->c->rescue[--ci->ridx];\n }\n else {\n int acc;\n mrb_value v;\n struct RProc *dst;\n\n ci = mrb->c->ci;\n v = regs[GETARG_A(i)];\n mrb_gc_protect(mrb, v);\n switch (GETARG_B(i)) {\n case OP_R_RETURN:\n /* Fall through to OP_R_NORMAL otherwise */\n if (ci->acc >=0 && MRB_PROC_ENV_P(proc) && !MRB_PROC_STRICT_P(proc)) {\n mrb_callinfo *cibase = mrb->c->cibase;\n dst = top_proc(mrb, proc);\n\n if (MRB_PROC_ENV_P(dst)) {\n struct REnv *e = MRB_PROC_ENV(dst);\n\n if (!MRB_ENV_STACK_SHARED_P(e) || e->cxt != mrb->c) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n }\n while (cibase <= ci && ci->proc != dst) {\n if (ci->acc < 0) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n ci--;\n }\n if (ci <= cibase) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n break;\n }\n case OP_R_NORMAL:\n NORMAL_RETURN:\n if (ci == mrb->c->cibase) {\n struct mrb_context *c;\n\n if (!mrb->c->prev) { /* toplevel return */\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n if (mrb->c->prev->ci == mrb->c->prev->cibase) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_FIBER_ERROR, \"double resume\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n while (mrb->c->eidx > 0) {\n ecall(mrb);\n }\n /* automatic yield at the end */\n c = mrb->c;\n c->status = MRB_FIBER_TERMINATED;\n mrb->c = c->prev;\n c->prev = NULL;\n mrb->c->status = MRB_FIBER_RUNNING;\n ci = mrb->c->ci;\n }\n break;\n case OP_R_BREAK:\n if (MRB_PROC_STRICT_P(proc)) goto NORMAL_RETURN;\n if (MRB_PROC_ORPHAN_P(proc)) { \n mrb_value exc;\n\n L_BREAK_ERROR:\n exc = mrb_exc_new_str_lit(mrb, E_LOCALJUMP_ERROR,\n \"break from proc-closure\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (!MRB_PROC_ENV_P(proc) || !MRB_ENV_STACK_SHARED_P(MRB_PROC_ENV(proc))) {\n goto L_BREAK_ERROR;\n }\n else {\n struct REnv *e = MRB_PROC_ENV(proc);\n\n if (e == mrb->c->cibase->env && proc != mrb->c->cibase->proc) {\n goto L_BREAK_ERROR;\n }\n if (e->cxt != mrb->c) {\n goto L_BREAK_ERROR;\n }\n }\n while (mrb->c->eidx > mrb->c->ci->epos) {\n ecall_adjust();\n }\n /* break from fiber block */\n if (ci == mrb->c->cibase && ci->pc) {\n struct mrb_context *c = mrb->c;\n\n mrb->c = c->prev;\n c->prev = NULL;\n ci = mrb->c->ci;\n }\n if (ci->acc < 0) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->c->vmexec = FALSE;\n mrb->exc = (struct RObject*)break_new(mrb, proc, v);\n mrb->jmp = prev_jmp;\n MRB_THROW(prev_jmp);\n }\n if (FALSE) {\n L_BREAK:\n v = ((struct RBreak*)mrb->exc)->val;\n proc = ((struct RBreak*)mrb->exc)->proc;\n mrb->exc = NULL;\n ci = mrb->c->ci;\n }\n mrb->c->stack = ci->stackent;\n proc = proc->upper;\n while (mrb->c->cibase < ci && ci[-1].proc != proc) {\n if (ci[-1].acc == CI_ACC_SKIP) {\n while (ci < mrb->c->ci) {\n cipop(mrb);\n }\n goto L_BREAK_ERROR;\n }\n ci--;\n }\n if (ci == mrb->c->cibase) {\n goto L_BREAK_ERROR;\n }\n break;\n default:\n /* cannot happen */\n break;\n }\n while (ci < mrb->c->ci) {\n cipop(mrb);\n }\n ci[0].ridx = ci[-1].ridx;\n while (mrb->c->eidx > ci->epos) {\n ecall_adjust();\n }\n if (mrb->c->vmexec && !ci->target_class) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->c->vmexec = FALSE;\n mrb->jmp = prev_jmp;\n return v;\n }\n acc = ci->acc;\n mrb->c->stack = ci->stackent;\n cipop(mrb);\n if (acc == CI_ACC_SKIP || acc == CI_ACC_DIRECT) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->jmp = prev_jmp;\n return v;\n }\n pc = ci->pc;\n ci = mrb->c->ci;\n DEBUG(fprintf(stderr, \"from :%s\\n\", mrb_sym2name(mrb, ci->mid)));\n proc = mrb->c->ci->proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n\n regs[acc] = v;\n mrb_gc_arena_restore(mrb, ai);\n }\n JUMP;\n }\n\n CASE(OP_TAILCALL) {\n /* A B C return call(R(A),Syms(B),R(A+1),... ,R(A+C+1)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int n = GETARG_C(i);\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci;\n mrb_value recv;\n mrb_sym mid = syms[b];\n\n recv = regs[a];\n c = mrb_class(mrb, recv);\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value sym = mrb_symbol_value(mid);\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value args;\n\n if (n == CALL_MAXARGS) {\n args = regs[a+1];\n }\n else {\n args = mrb_ary_new_from_values(mrb, n, regs+a+1);\n }\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n mid = missing;\n if (n == CALL_MAXARGS) {\n mrb_ary_unshift(mrb, regs[a+1], sym);\n }\n else {\n value_move(regs+a+2, regs+a+1, ++n);\n regs[a+1] = sym;\n }\n }\n\n /* replace callinfo */\n ci = mrb->c->ci;\n ci->mid = mid;\n ci->target_class = c;\n if (n == CALL_MAXARGS) {\n ci->argc = -1;\n }\n else {\n ci->argc = n;\n }\n\n /* move stack */\n value_move(mrb->c->stack, ®s[a], ci->argc+1);\n\n if (MRB_METHOD_CFUNC_P(m)) {\n mrb_value v = MRB_METHOD_CFUNC(m)(mrb, recv);\n mrb->c->stack[0] = v;\n mrb_gc_arena_restore(mrb, ai);\n goto L_RETURN;\n }\n else {\n /* setup environment for calling method */\n struct RProc *p = MRB_METHOD_PROC(m);\n irep = p->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n if (ci->argc < 0) {\n stack_extend(mrb, (irep->nregs < 3) ? 3 : irep->nregs);\n }\n else {\n stack_extend(mrb, irep->nregs);\n }\n pc = irep->iseq;\n }\n JUMP;\n }\n\n CASE(OP_BLKPUSH) {\n /* A Bx R(A) := block (16=6:1:5:4) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n int m1 = (bx>>10)&0x3f;\n int r = (bx>>9)&0x1;\n int m2 = (bx>>4)&0x1f;\n int lv = (bx>>0)&0xf;\n mrb_value *stack;\n\n if (lv == 0) stack = regs + 1;\n else {\n struct REnv *e = uvenv(mrb, lv-1);\n if (!e || (!MRB_ENV_STACK_SHARED_P(e) && e->mid == 0) ||\n MRB_ENV_STACK_LEN(e) <= m1+r+m2+1) {\n localjump_error(mrb, LOCALJUMP_ERROR_YIELD);\n goto L_RAISE;\n }\n stack = e->stack + 1;\n }\n if (mrb_nil_p(stack[m1+r+m2])) {\n localjump_error(mrb, LOCALJUMP_ERROR_YIELD);\n goto L_RAISE;\n }\n regs[a] = stack[m1+r+m2];\n NEXT;\n }\n\n#define TYPES2(a,b) ((((uint16_t)(a))<<8)|(((uint16_t)(b))&0xff))\n#define OP_MATH_BODY(op,v1,v2) do {\\\n v1(regs[a]) = v1(regs[a]) op v2(regs[a+1]);\\\n} while(0)\n\n CASE(OP_ADD) {\n /* A B C R(A) := R(A)+R(A+1) (Syms[B]=:+,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n mrb_value *regs_a = regs + a;\n\n x = mrb_fixnum(regs_a[0]);\n y = mrb_fixnum(regs_a[1]);\n if (mrb_int_add_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs_a[0], (mrb_float)x + (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x + y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x + y);\n }\n#else\n OP_MATH_BODY(+,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x + y);\n }\n#else\n OP_MATH_BODY(+,mrb_float,mrb_float);\n#endif\n break;\n#endif\n case TYPES2(MRB_TT_STRING,MRB_TT_STRING):\n regs[a] = mrb_str_plus(mrb, regs[a], regs[a+1]);\n break;\n default:\n goto L_SEND;\n }\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_SUB) {\n /* A B C R(A) := R(A)-R(A+1) (Syms[B]=:-,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n\n x = mrb_fixnum(regs[a]);\n y = mrb_fixnum(regs[a+1]);\n if (mrb_int_sub_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x - y);\n }\n#else\n OP_MATH_BODY(-,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x - y);\n }\n#else\n OP_MATH_BODY(-,mrb_float,mrb_float);\n#endif\n break;\n#endif\n default:\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_MUL) {\n /* A B C R(A) := R(A)*R(A+1) (Syms[B]=:*,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n\n x = mrb_fixnum(regs[a]);\n y = mrb_fixnum(regs[a+1]);\n if (mrb_int_mul_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x * (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x * y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x * y);\n }\n#else\n OP_MATH_BODY(*,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x * y);\n }\n#else\n OP_MATH_BODY(*,mrb_float,mrb_float);\n#endif\n break;\n#endif\n default:\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_DIV) {\n /* A B C R(A) := R(A)/R(A+1) (Syms[B]=:/,C=1)*/\n int a = GETARG_A(i);\n#ifndef MRB_WITHOUT_FLOAT\n double x, y, f;\n#endif\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n#ifdef MRB_WITHOUT_FLOAT\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_INT_VALUE(regs[a], y ? x / y : 0);\n }\n break;\n#else\n x = (mrb_float)mrb_fixnum(regs[a]);\n y = (mrb_float)mrb_fixnum(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n x = (mrb_float)mrb_fixnum(regs[a]);\n y = mrb_float(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n x = mrb_float(regs[a]);\n y = (mrb_float)mrb_fixnum(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n x = mrb_float(regs[a]);\n y = mrb_float(regs[a+1]);\n break;\n#endif\n default:\n goto L_SEND;\n }\n\n#ifndef MRB_WITHOUT_FLOAT\n if (y == 0) {\n if (x > 0) f = INFINITY;\n else if (x < 0) f = -INFINITY;\n else /* if (x == 0) */ f = NAN;\n }\n else {\n f = x / y;\n }\n SET_FLOAT_VALUE(mrb, regs[a], f);\n#endif\n NEXT;\n }\n\n CASE(OP_ADDI) {\n /* A B C R(A) := R(A)+C (Syms[B]=:+)*/\n int a = GETARG_A(i);\n\n /* need to check if + is overridden */\n switch (mrb_type(regs[a])) {\n case MRB_TT_FIXNUM:\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_int y = GETARG_C(i);\n mrb_int z;\n\n if (mrb_int_add_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x + (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case MRB_TT_FLOAT:\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n SET_FLOAT_VALUE(mrb, regs[a], x + GETARG_C(i));\n }\n#else\n mrb_float(regs[a]) += GETARG_C(i);\n#endif\n break;\n#endif\n default:\n SET_INT_VALUE(regs[a+1], GETARG_C(i));\n i = MKOP_ABC(OP_SEND, a, GETARG_B(i), 1);\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_SUBI) {\n /* A B C R(A) := R(A)-C (Syms[B]=:-)*/\n int a = GETARG_A(i);\n mrb_value *regs_a = regs + a;\n\n /* need to check if + is overridden */\n switch (mrb_type(regs_a[0])) {\n case MRB_TT_FIXNUM:\n {\n mrb_int x = mrb_fixnum(regs_a[0]);\n mrb_int y = GETARG_C(i);\n mrb_int z;\n\n if (mrb_int_sub_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs_a[0], (mrb_float)x - (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs_a[0], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case MRB_TT_FLOAT:\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n SET_FLOAT_VALUE(mrb, regs[a], x - GETARG_C(i));\n }\n#else\n mrb_float(regs_a[0]) -= GETARG_C(i);\n#endif\n break;\n#endif\n default:\n SET_INT_VALUE(regs_a[1], GETARG_C(i));\n i = MKOP_ABC(OP_SEND, a, GETARG_B(i), 1);\n goto L_SEND;\n }\n NEXT;\n }\n\n#define OP_CMP_BODY(op,v1,v2) (v1(regs[a]) op v2(regs[a+1]))\n\n#ifdef MRB_WITHOUT_FLOAT\n#define OP_CMP(op) do {\\\n int result;\\\n /* need to check if - is overridden */\\\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_fixnum);\\\n break;\\\n default:\\\n goto L_SEND;\\\n }\\\n if (result) {\\\n SET_TRUE_VALUE(regs[a]);\\\n }\\\n else {\\\n SET_FALSE_VALUE(regs[a]);\\\n }\\\n} while(0)\n#else\n#define OP_CMP(op) do {\\\n int result;\\\n /* need to check if - is overridden */\\\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_fixnum);\\\n break;\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_float);\\\n break;\\\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_float,mrb_fixnum);\\\n break;\\\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\\\n result = OP_CMP_BODY(op,mrb_float,mrb_float);\\\n break;\\\n default:\\\n goto L_SEND;\\\n }\\\n if (result) {\\\n SET_TRUE_VALUE(regs[a]);\\\n }\\\n else {\\\n SET_FALSE_VALUE(regs[a]);\\\n }\\\n} while(0)\n#endif\n\n CASE(OP_EQ) {\n /* A B C R(A) := R(A)==R(A+1) (Syms[B]=:==,C=1)*/\n int a = GETARG_A(i);\n if (mrb_obj_eq(mrb, regs[a], regs[a+1])) {\n SET_TRUE_VALUE(regs[a]);\n }\n else {\n OP_CMP(==);\n }\n NEXT;\n }\n\n CASE(OP_LT) {\n /* A B C R(A) := R(A)R(A+1) (Syms[B]=:>,C=1)*/\n int a = GETARG_A(i);\n OP_CMP(>);\n NEXT;\n }\n\n CASE(OP_GE) {\n /* A B C R(A) := R(A)>=R(A+1) (Syms[B]=:>=,C=1)*/\n int a = GETARG_A(i);\n OP_CMP(>=);\n NEXT;\n }\n\n CASE(OP_ARRAY) {\n /* A B C R(A) := ary_new(R(B),R(B+1)..R(B+C)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value v = mrb_ary_new_from_values(mrb, c, ®s[b]);\n regs[a] = v;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ARYCAT) {\n /* A B mrb_ary_concat(R(A),R(B)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n mrb_value splat = mrb_ary_splat(mrb, regs[b]);\n mrb_ary_concat(mrb, regs[a], splat);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ARYPUSH) {\n /* A B R(A).push(R(B)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n mrb_ary_push(mrb, regs[a], regs[b]);\n NEXT;\n }\n\n CASE(OP_AREF) {\n /* A B C R(A) := R(B)[C] */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value v = regs[b];\n\n if (!mrb_array_p(v)) {\n if (c == 0) {\n regs[a] = v;\n }\n else {\n SET_NIL_VALUE(regs[a]);\n }\n }\n else {\n v = mrb_ary_ref(mrb, v, c);\n regs[a] = v;\n }\n NEXT;\n }\n\n CASE(OP_ASET) {\n /* A B C R(B)[C] := R(A) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_ary_set(mrb, regs[b], c, regs[a]);\n NEXT;\n }\n\n CASE(OP_APOST) {\n /* A B C *R(A),R(A+1)..R(A+C) := R(A) */\n int a = GETARG_A(i);\n mrb_value v = regs[a];\n int pre = GETARG_B(i);\n int post = GETARG_C(i);\n struct RArray *ary;\n int len, idx;\n\n if (!mrb_array_p(v)) {\n v = mrb_ary_new_from_values(mrb, 1, ®s[a]);\n }\n ary = mrb_ary_ptr(v);\n len = (int)ARY_LEN(ary);\n if (len > pre + post) {\n v = mrb_ary_new_from_values(mrb, len - pre - post, ARY_PTR(ary)+pre);\n regs[a++] = v;\n while (post--) {\n regs[a++] = ARY_PTR(ary)[len-post-1];\n }\n }\n else {\n v = mrb_ary_new_capa(mrb, 0);\n regs[a++] = v;\n for (idx=0; idx+prereps[b];\n\n if (c & OP_L_CAPTURE) {\n p = mrb_closure_new(mrb, nirep);\n }\n else {\n p = mrb_proc_new(mrb, nirep);\n p->flags |= MRB_PROC_SCOPE;\n }\n if (c & OP_L_STRICT) p->flags |= MRB_PROC_STRICT;\n regs[a] = mrb_obj_value(p);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_OCLASS) {\n /* A R(A) := ::Object */\n regs[GETARG_A(i)] = mrb_obj_value(mrb->object_class);\n NEXT;\n }\n\n CASE(OP_CLASS) {\n /* A B R(A) := newclass(R(A),Syms(B),R(A+1)) */\n struct RClass *c = 0, *baseclass;\n int a = GETARG_A(i);\n mrb_value base, super;\n mrb_sym id = syms[GETARG_B(i)];\n\n base = regs[a];\n super = regs[a+1];\n if (mrb_nil_p(base)) {\n baseclass = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc);\n base = mrb_obj_value(baseclass);\n }\n c = mrb_vm_define_class(mrb, base, super, id);\n regs[a] = mrb_obj_value(c);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_MODULE) {\n /* A B R(A) := newmodule(R(A),Syms(B)) */\n struct RClass *c = 0, *baseclass;\n int a = GETARG_A(i);\n mrb_value base;\n mrb_sym id = syms[GETARG_B(i)];\n\n base = regs[a];\n if (mrb_nil_p(base)) {\n baseclass = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc);\n base = mrb_obj_value(baseclass);\n }\n c = mrb_vm_define_module(mrb, base, id);\n regs[a] = mrb_obj_value(c);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_EXEC) {\n /* A Bx R(A) := blockexec(R(A),SEQ[Bx]) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_callinfo *ci;\n mrb_value recv = regs[a];\n struct RProc *p;\n mrb_irep *nirep = irep->reps[bx];\n\n /* prepare closure */\n p = mrb_proc_new(mrb, nirep);\n p->c = NULL;\n mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)proc);\n MRB_PROC_SET_TARGET_CLASS(p, mrb_class_ptr(recv));\n p->flags |= MRB_PROC_SCOPE;\n\n /* prepare call stack */\n ci = cipush(mrb);\n ci->pc = pc + 1;\n ci->acc = a;\n ci->mid = 0;\n ci->stackent = mrb->c->stack;\n ci->argc = 0;\n ci->target_class = mrb_class_ptr(recv);\n\n /* prepare stack */\n mrb->c->stack += a;\n\n /* setup block to call */\n ci->proc = p;\n\n irep = p->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, ci->nregs);\n stack_clear(regs+1, ci->nregs-1);\n pc = irep->iseq;\n JUMP;\n }\n\n CASE(OP_METHOD) {\n /* A B R(A).newmethod(Syms(B),R(A+1)) */\n int a = GETARG_A(i);\n struct RClass *c = mrb_class_ptr(regs[a]);\n struct RProc *p = mrb_proc_ptr(regs[a+1]);\n mrb_method_t m;\n\n MRB_METHOD_FROM_PROC(m, p);\n mrb_define_method_raw(mrb, c, syms[GETARG_B(i)], m);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_SCLASS) {\n /* A B R(A) := R(B).singleton_class */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n\n regs[a] = mrb_singleton_class(mrb, regs[b]);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_TCLASS) {\n /* A R(A) := target_class */\n if (!mrb->c->ci->target_class) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR, \"no target class or module\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n regs[GETARG_A(i)] = mrb_obj_value(mrb->c->ci->target_class);\n NEXT;\n }\n\n CASE(OP_RANGE) {\n /* A B C R(A) := range_new(R(B),R(B+1),C) */\n int b = GETARG_B(i);\n mrb_value val = mrb_range_new(mrb, regs[b], regs[b+1], GETARG_C(i));\n regs[GETARG_A(i)] = val;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_DEBUG) {\n /* A B C debug print R(A),R(B),R(C) */\n#ifdef MRB_ENABLE_DEBUG_HOOK\n mrb->debug_op_hook(mrb, irep, pc, regs);\n#else\n#ifndef MRB_DISABLE_STDIO\n printf(\"OP_DEBUG %d %d %d\\n\", GETARG_A(i), GETARG_B(i), GETARG_C(i));\n#else\n abort();\n#endif\n#endif\n NEXT;\n }\n\n CASE(OP_STOP) {\n /* stop VM */\n L_STOP:\n while (mrb->c->eidx > 0) {\n ecall(mrb);\n }\n ERR_PC_CLR(mrb);\n mrb->jmp = prev_jmp;\n if (mrb->exc) {\n return mrb_obj_value(mrb->exc);\n }\n return regs[irep->nlocals];\n }\n\n CASE(OP_ERR) {\n /* Bx raise RuntimeError with message Lit(Bx) */\n mrb_value msg = mrb_str_dup(mrb, pool[GETARG_Bx(i)]);\n mrb_value exc;\n\n if (GETARG_A(i) == 0) {\n exc = mrb_exc_new_str(mrb, E_RUNTIME_ERROR, msg);\n }\n else {\n exc = mrb_exc_new_str(mrb, E_LOCALJUMP_ERROR, msg);\n }\n ERR_PC_SET(mrb, pc);\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n END_DISPATCH;\n#undef regs\n\n }\n MRB_CATCH(&c_jmp) {\n exc_catched = TRUE;\n goto RETRY_TRY_BLOCK;\n }\n MRB_END_EXC(&c_jmp);\n}","lang":"c","vul_type":"cwe-416","target_token_count":17003,"sven_meta":{"func_name":"mrb_vm_exec","file_name":"src/vm.c","commit_link":"github.com/mruby/mruby/commit/1905091634a6a2925c911484434448e568330626","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#46-95fbddccd7dd","input":"static MagickBooleanType TraceBezier(MVGInfo *mvg_info,\n const size_t number_coordinates)\n{\n double\n alpha,\n *coefficients,\n weight;\n\n PointInfo\n end,\n point,\n *points;\n\n PrimitiveInfo\n *primitive_info;\n\n register PrimitiveInfo\n *p;\n\n register ssize_t\n i,\n j;\n\n size_t\n control_points,\n quantum;\n\n /*\n Allocate coefficients.\n */\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n quantum=number_coordinates;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n {\n for (j=i+1; j < (ssize_t) number_coordinates; j++)\n {\n alpha=fabs(primitive_info[j].point.x-primitive_info[i].point.x);\n if (alpha > (double) SSIZE_MAX)\n {\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n if (alpha > (double) quantum)\n quantum=(size_t) alpha;\n alpha=fabs(primitive_info[j].point.y-primitive_info[i].point.y);\n if (alpha > (double) SSIZE_MAX)\n {\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n if (alpha > (double) quantum)\n quantum=(size_t) alpha;\n }\n }\n quantum=MagickMin(quantum/number_coordinates,BezierQuantum);\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n coefficients=(double *) AcquireQuantumMemory(number_coordinates,\n sizeof(*coefficients));\n points=(PointInfo *) AcquireQuantumMemory(quantum,number_coordinates*\n sizeof(*points));\n if ((coefficients == (double *) NULL) || (points == (PointInfo *) NULL))\n {\n if (points != (PointInfo *) NULL)\n points=(PointInfo *) RelinquishMagickMemory(points);\n if (coefficients != (double *) NULL)\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n control_points=quantum*number_coordinates;\n if (CheckPrimitiveExtent(mvg_info,control_points+1) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n /*\n Compute bezier points.\n */\n end=primitive_info[number_coordinates-1].point;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n coefficients[i]=Permutate((ssize_t) number_coordinates-1,i);\n weight=0.0;\n for (i=0; i < (ssize_t) control_points; i++)\n {\n p=primitive_info;\n point.x=0.0;\n point.y=0.0;\n alpha=pow((double) (1.0-weight),(double) number_coordinates-1.0);\n for (j=0; j < (ssize_t) number_coordinates; j++)\n {\n point.x+=alpha*coefficients[j]*p->point.x;\n point.y+=alpha*coefficients[j]*p->point.y;\n alpha*=weight/(1.0-weight);\n p++;\n }\n points[i]=point;\n weight+=1.0/control_points;\n }\n /*\n Bezier curves are just short segmented polys.\n */\n p=primitive_info;\n for (i=0; i < (ssize_t) control_points; i++)\n {\n if (TracePoint(p,points[i]) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n p+=p->coordinates;\n }\n if (TracePoint(p,end) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n p+=p->coordinates;\n primitive_info->coordinates=(size_t) (p-primitive_info);\n primitive_info->closed_subpath=MagickFalse;\n for (i=0; i < (ssize_t) primitive_info->coordinates; i++)\n {\n p->primitive=primitive_info->primitive;\n p--;\n }\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickTrue);\n}","target":"static MagickBooleanType TraceBezier(MVGInfo *mvg_info,\n const size_t number_coordinates)\n{\n double\n alpha,\n *coefficients,\n weight;\n\n PointInfo\n end,\n point,\n *points;\n\n PrimitiveInfo\n *primitive_info;\n\n register PrimitiveInfo\n *p;\n\n register ssize_t\n i,\n j;\n\n size_t\n control_points,\n quantum;\n\n /*\n Allocate coefficients.\n */\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n quantum=number_coordinates;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n {\n for (j=i+1; j < (ssize_t) number_coordinates; j++)\n {\n alpha=fabs(primitive_info[j].point.x-primitive_info[i].point.x);\n if (alpha > (double) SSIZE_MAX)\n {\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n if (alpha > (double) quantum)\n quantum=(size_t) alpha;\n alpha=fabs(primitive_info[j].point.y-primitive_info[i].point.y);\n if (alpha > (double) SSIZE_MAX)\n {\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n if (alpha > (double) quantum)\n quantum=(size_t) alpha;\n }\n }\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n quantum=MagickMin(quantum/number_coordinates,BezierQuantum);\n coefficients=(double *) AcquireQuantumMemory(number_coordinates,\n sizeof(*coefficients));\n points=(PointInfo *) AcquireQuantumMemory(quantum,number_coordinates*\n sizeof(*points));\n if ((coefficients == (double *) NULL) || (points == (PointInfo *) NULL))\n {\n if (points != (PointInfo *) NULL)\n points=(PointInfo *) RelinquishMagickMemory(points);\n if (coefficients != (double *) NULL)\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n control_points=quantum*number_coordinates;\n if (CheckPrimitiveExtent(mvg_info,control_points+1) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n /*\n Compute bezier points.\n */\n end=primitive_info[number_coordinates-1].point;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n coefficients[i]=Permutate((ssize_t) number_coordinates-1,i);\n weight=0.0;\n for (i=0; i < (ssize_t) control_points; i++)\n {\n p=primitive_info;\n point.x=0.0;\n point.y=0.0;\n alpha=pow((double) (1.0-weight),(double) number_coordinates-1.0);\n for (j=0; j < (ssize_t) number_coordinates; j++)\n {\n point.x+=alpha*coefficients[j]*p->point.x;\n point.y+=alpha*coefficients[j]*p->point.y;\n alpha*=weight/(1.0-weight);\n p++;\n }\n points[i]=point;\n weight+=1.0/control_points;\n }\n /*\n Bezier curves are just short segmented polys.\n */\n p=primitive_info;\n for (i=0; i < (ssize_t) control_points; i++)\n {\n if (TracePoint(p,points[i]) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n p+=p->coordinates;\n }\n if (TracePoint(p,end) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n p+=p->coordinates;\n primitive_info->coordinates=(size_t) (p-primitive_info);\n primitive_info->closed_subpath=MagickFalse;\n for (i=0; i < (ssize_t) primitive_info->coordinates; i++)\n {\n p->primitive=primitive_info->primitive;\n p--;\n }\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-416","target_token_count":1099,"sven_meta":{"func_name":"TraceBezier","file_name":"MagickCore/draw.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/ecf7c6b288e11e7e7f75387c5e9e93e423b98397","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#47-a7f7a11bdb20","input":"static int parse_playlist(HLSContext *c, const char *url,\n struct playlist *pls, AVIOContext *in)\n{\n int ret = 0, is_segment = 0, is_variant = 0;\n int64_t duration = 0;\n enum KeyType key_type = KEY_NONE;\n uint8_t iv[16] = \"\";\n int has_iv = 0;\n char key[MAX_URL_SIZE] = \"\";\n char line[MAX_URL_SIZE];\n const char *ptr;\n int close_in = 0;\n int64_t seg_offset = 0;\n int64_t seg_size = -1;\n uint8_t *new_url = NULL;\n struct variant_info variant_info;\n char tmp_str[MAX_URL_SIZE];\n struct segment *cur_init_section = NULL;\n\n if (!in) {\n#if 1\n AVDictionary *opts = NULL;\n close_in = 1;\n /* Some HLS servers don't like being sent the range header */\n av_dict_set(&opts, \"seekable\", \"0\", 0);\n\n // broker prior HTTP options that should be consistent across requests\n av_dict_set(&opts, \"user-agent\", c->user_agent, 0);\n av_dict_set(&opts, \"cookies\", c->cookies, 0);\n av_dict_set(&opts, \"headers\", c->headers, 0);\n\n ret = avio_open2(&in, url, AVIO_FLAG_READ,\n c->interrupt_callback, &opts);\n av_dict_free(&opts);\n if (ret < 0)\n return ret;\n#else\n ret = open_in(c, &in, url);\n if (ret < 0)\n return ret;\n close_in = 1;\n#endif\n }\n\n if (av_opt_get(in, \"location\", AV_OPT_SEARCH_CHILDREN, &new_url) >= 0)\n url = new_url;\n\n read_chomp_line(in, line, sizeof(line));\n if (strcmp(line, \"#EXTM3U\")) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n if (pls) {\n free_segment_list(pls);\n pls->finished = 0;\n pls->type = PLS_TYPE_UNSPECIFIED;\n }\n while (!avio_feof(in)) {\n read_chomp_line(in, line, sizeof(line));\n if (av_strstart(line, \"#EXT-X-STREAM-INF:\", &ptr)) {\n is_variant = 1;\n memset(&variant_info, 0, sizeof(variant_info));\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,\n &variant_info);\n } else if (av_strstart(line, \"#EXT-X-KEY:\", &ptr)) {\n struct key_info info = {{0}};\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_key_args,\n &info);\n key_type = KEY_NONE;\n has_iv = 0;\n if (!strcmp(info.method, \"AES-128\"))\n key_type = KEY_AES_128;\n if (!strcmp(info.method, \"SAMPLE-AES\"))\n key_type = KEY_SAMPLE_AES;\n if (!strncmp(info.iv, \"0x\", 2) || !strncmp(info.iv, \"0X\", 2)) {\n ff_hex_to_data(iv, info.iv + 2);\n has_iv = 1;\n }\n av_strlcpy(key, info.uri, sizeof(key));\n } else if (av_strstart(line, \"#EXT-X-MEDIA:\", &ptr)) {\n struct rendition_info info = {{0}};\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_rendition_args,\n &info);\n new_rendition(c, &info, url);\n } else if (av_strstart(line, \"#EXT-X-TARGETDURATION:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n pls->target_duration = atoi(ptr) * AV_TIME_BASE;\n } else if (av_strstart(line, \"#EXT-X-MEDIA-SEQUENCE:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n pls->start_seq_no = atoi(ptr);\n } else if (av_strstart(line, \"#EXT-X-PLAYLIST-TYPE:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n if (!strcmp(ptr, \"EVENT\"))\n pls->type = PLS_TYPE_EVENT;\n else if (!strcmp(ptr, \"VOD\"))\n pls->type = PLS_TYPE_VOD;\n } else if (av_strstart(line, \"#EXT-X-MAP:\", &ptr)) {\n struct init_section_info info = {{0}};\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_init_section_args,\n &info);\n cur_init_section = new_init_section(pls, &info, url);\n } else if (av_strstart(line, \"#EXT-X-ENDLIST\", &ptr)) {\n if (pls)\n pls->finished = 1;\n } else if (av_strstart(line, \"#EXTINF:\", &ptr)) {\n is_segment = 1;\n duration = atof(ptr) * AV_TIME_BASE;\n } else if (av_strstart(line, \"#EXT-X-BYTERANGE:\", &ptr)) {\n seg_size = atoi(ptr);\n ptr = strchr(ptr, '@');\n if (ptr)\n seg_offset = atoi(ptr+1);\n } else if (av_strstart(line, \"#\", NULL)) {\n continue;\n } else if (line[0]) {\n if (is_variant) {\n if (!new_variant(c, &variant_info, line, url)) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n is_variant = 0;\n }\n if (is_segment) {\n struct segment *seg;\n if (!pls) {\n if (!new_variant(c, 0, url, NULL)) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n pls = c->playlists[c->n_playlists - 1];\n }\n seg = av_malloc(sizeof(struct segment));\n if (!seg) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n seg->duration = duration;\n seg->key_type = key_type;\n if (has_iv) {\n memcpy(seg->iv, iv, sizeof(iv));\n } else {\n int seq = pls->start_seq_no + pls->n_segments;\n memset(seg->iv, 0, sizeof(seg->iv));\n AV_WB32(seg->iv + 12, seq);\n }\n\n if (key_type != KEY_NONE) {\n ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, key);\n seg->key = av_strdup(tmp_str);\n if (!seg->key) {\n av_free(seg);\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n } else {\n seg->key = NULL;\n }\n\n ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, line);\n seg->url = av_strdup(tmp_str);\n if (!seg->url) {\n av_free(seg->key);\n av_free(seg);\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n\n dynarray_add(&pls->segments, &pls->n_segments, seg);\n is_segment = 0;\n\n seg->size = seg_size;\n if (seg_size >= 0) {\n seg->url_offset = seg_offset;\n seg_offset += seg_size;\n seg_size = -1;\n } else {\n seg->url_offset = 0;\n seg_offset = 0;\n }\n\n seg->init_section = cur_init_section;\n }\n }\n }\n if (pls)\n pls->last_load_time = av_gettime_relative();\n\nfail:\n av_free(new_url);\n if (close_in)\n avio_close(in);\n return ret;\n}","target":"static int parse_playlist(HLSContext *c, const char *url,\n struct playlist *pls, AVIOContext *in)\n{\n int ret = 0, is_segment = 0, is_variant = 0;\n int64_t duration = 0;\n enum KeyType key_type = KEY_NONE;\n uint8_t iv[16] = \"\";\n int has_iv = 0;\n char key[MAX_URL_SIZE] = \"\";\n char line[MAX_URL_SIZE];\n const char *ptr;\n int close_in = 0;\n int64_t seg_offset = 0;\n int64_t seg_size = -1;\n uint8_t *new_url = NULL;\n struct variant_info variant_info;\n char tmp_str[MAX_URL_SIZE];\n struct segment *cur_init_section = NULL;\n\n if (!in) {\n#if 1\n AVDictionary *opts = NULL;\n close_in = 1;\n /* Some HLS servers don't like being sent the range header */\n av_dict_set(&opts, \"seekable\", \"0\", 0);\n\n // broker prior HTTP options that should be consistent across requests\n av_dict_set(&opts, \"user-agent\", c->user_agent, 0);\n av_dict_set(&opts, \"cookies\", c->cookies, 0);\n av_dict_set(&opts, \"headers\", c->headers, 0);\n\n ret = avio_open2(&in, url, AVIO_FLAG_READ,\n c->interrupt_callback, &opts);\n av_dict_free(&opts);\n if (ret < 0)\n return ret;\n#else\n ret = open_in(c, &in, url);\n if (ret < 0)\n return ret;\n close_in = 1;\n#endif\n }\n\n if (av_opt_get(in, \"location\", AV_OPT_SEARCH_CHILDREN, &new_url) >= 0)\n url = new_url;\n\n read_chomp_line(in, line, sizeof(line));\n if (strcmp(line, \"#EXTM3U\")) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n if (pls) {\n free_segment_list(pls);\n pls->finished = 0;\n pls->type = PLS_TYPE_UNSPECIFIED;\n }\n while (!avio_feof(in)) {\n read_chomp_line(in, line, sizeof(line));\n if (av_strstart(line, \"#EXT-X-STREAM-INF:\", &ptr)) {\n is_variant = 1;\n memset(&variant_info, 0, sizeof(variant_info));\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,\n &variant_info);\n } else if (av_strstart(line, \"#EXT-X-KEY:\", &ptr)) {\n struct key_info info = {{0}};\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_key_args,\n &info);\n key_type = KEY_NONE;\n has_iv = 0;\n if (!strcmp(info.method, \"AES-128\"))\n key_type = KEY_AES_128;\n if (!strcmp(info.method, \"SAMPLE-AES\"))\n key_type = KEY_SAMPLE_AES;\n if (!strncmp(info.iv, \"0x\", 2) || !strncmp(info.iv, \"0X\", 2)) {\n ff_hex_to_data(iv, info.iv + 2);\n has_iv = 1;\n }\n av_strlcpy(key, info.uri, sizeof(key));\n } else if (av_strstart(line, \"#EXT-X-MEDIA:\", &ptr)) {\n struct rendition_info info = {{0}};\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_rendition_args,\n &info);\n new_rendition(c, &info, url);\n } else if (av_strstart(line, \"#EXT-X-TARGETDURATION:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n pls->target_duration = atoi(ptr) * AV_TIME_BASE;\n } else if (av_strstart(line, \"#EXT-X-MEDIA-SEQUENCE:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n pls->start_seq_no = atoi(ptr);\n } else if (av_strstart(line, \"#EXT-X-PLAYLIST-TYPE:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n if (!strcmp(ptr, \"EVENT\"))\n pls->type = PLS_TYPE_EVENT;\n else if (!strcmp(ptr, \"VOD\"))\n pls->type = PLS_TYPE_VOD;\n } else if (av_strstart(line, \"#EXT-X-MAP:\", &ptr)) {\n struct init_section_info info = {{0}};\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_init_section_args,\n &info);\n cur_init_section = new_init_section(pls, &info, url);\n } else if (av_strstart(line, \"#EXT-X-ENDLIST\", &ptr)) {\n if (pls)\n pls->finished = 1;\n } else if (av_strstart(line, \"#EXTINF:\", &ptr)) {\n is_segment = 1;\n duration = atof(ptr) * AV_TIME_BASE;\n } else if (av_strstart(line, \"#EXT-X-BYTERANGE:\", &ptr)) {\n seg_size = atoi(ptr);\n ptr = strchr(ptr, '@');\n if (ptr)\n seg_offset = atoi(ptr+1);\n } else if (av_strstart(line, \"#\", NULL)) {\n continue;\n } else if (line[0]) {\n if (is_variant) {\n if (!new_variant(c, &variant_info, line, url)) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n is_variant = 0;\n }\n if (is_segment) {\n struct segment *seg;\n if (!pls) {\n if (!new_variant(c, 0, url, NULL)) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n pls = c->playlists[c->n_playlists - 1];\n }\n seg = av_malloc(sizeof(struct segment));\n if (!seg) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n if (has_iv) {\n memcpy(seg->iv, iv, sizeof(iv));\n } else {\n int seq = pls->start_seq_no + pls->n_segments;\n memset(seg->iv, 0, sizeof(seg->iv));\n AV_WB32(seg->iv + 12, seq);\n }\n\n if (key_type != KEY_NONE) {\n ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, key);\n seg->key = av_strdup(tmp_str);\n if (!seg->key) {\n av_free(seg);\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n } else {\n seg->key = NULL;\n }\n\n ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, line);\n seg->url = av_strdup(tmp_str);\n if (!seg->url) {\n av_free(seg->key);\n av_free(seg);\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n\n if (duration < 0.001 * AV_TIME_BASE) {\n duration = 0.001 * AV_TIME_BASE;\n }\n seg->duration = duration;\n seg->key_type = key_type;\n dynarray_add(&pls->segments, &pls->n_segments, seg);\n is_segment = 0;\n\n seg->size = seg_size;\n if (seg_size >= 0) {\n seg->url_offset = seg_offset;\n seg_offset += seg_size;\n seg_size = -1;\n } else {\n seg->url_offset = 0;\n seg_offset = 0;\n }\n\n seg->init_section = cur_init_section;\n }\n }\n }\n if (pls)\n pls->last_load_time = av_gettime_relative();\n\nfail:\n av_free(new_url);\n if (close_in)\n avio_close(in);\n return ret;\n}","lang":"c","vul_type":"cwe-416","target_token_count":1791,"sven_meta":{"func_name":"parse_playlist","file_name":"libavformat/hls.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/6959358683c7533f586c07a766acc5fe9544d8b2","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#49-c723aaeff572","input":"static int usb_audio_probe(struct usb_interface *intf,\n\t\t\t const struct usb_device_id *usb_id)\n{\n\tstruct usb_device *dev = interface_to_usbdev(intf);\n\tconst struct snd_usb_audio_quirk *quirk =\n\t\t(const struct snd_usb_audio_quirk *)usb_id->driver_info;\n\tstruct snd_usb_audio *chip;\n\tint i, err;\n\tstruct usb_host_interface *alts;\n\tint ifnum;\n\tu32 id;\n\n\talts = &intf->altsetting[0];\n\tifnum = get_iface_desc(alts)->bInterfaceNumber;\n\tid = USB_ID(le16_to_cpu(dev->descriptor.idVendor),\n\t\t le16_to_cpu(dev->descriptor.idProduct));\n\tif (get_alias_id(dev, &id))\n\t\tquirk = get_alias_quirk(dev, id);\n\tif (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)\n\t\treturn -ENXIO;\n\n\terr = snd_usb_apply_boot_quirk(dev, intf, quirk, id);\n\tif (err < 0)\n\t\treturn err;\n\n\t/*\n\t * found a config. now register to ALSA\n\t */\n\n\t/* check whether it's already registered */\n\tchip = NULL;\n\tmutex_lock(®ister_mutex);\n\tfor (i = 0; i < SNDRV_CARDS; i++) {\n\t\tif (usb_chip[i] && usb_chip[i]->dev == dev) {\n\t\t\tif (atomic_read(&usb_chip[i]->shutdown)) {\n\t\t\t\tdev_err(&dev->dev, \"USB device is in the shutdown state, cannot create a card instance\\n\");\n\t\t\t\terr = -EIO;\n\t\t\t\tgoto __error;\n\t\t\t}\n\t\t\tchip = usb_chip[i];\n\t\t\tatomic_inc(&chip->active); /* avoid autopm */\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (! chip) {\n\t\t/* it's a fresh one.\n\t\t * now look for an empty slot and create a new card instance\n\t\t */\n\t\tfor (i = 0; i < SNDRV_CARDS; i++)\n\t\t\tif (!usb_chip[i] &&\n\t\t\t (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) &&\n\t\t\t (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) {\n\t\t\t\tif (enable[i]) {\n\t\t\t\t\terr = snd_usb_audio_create(intf, dev, i, quirk,\n\t\t\t\t\t\t\t\t id, &chip);\n\t\t\t\t\tif (err < 0)\n\t\t\t\t\t\tgoto __error;\n\t\t\t\t\tchip->pm_intf = intf;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (vid[i] != -1 || pid[i] != -1) {\n\t\t\t\t\tdev_info(&dev->dev,\n\t\t\t\t\t\t \"device (%04x:%04x) is disabled\\n\",\n\t\t\t\t\t\t USB_ID_VENDOR(id),\n\t\t\t\t\t\t USB_ID_PRODUCT(id));\n\t\t\t\t\terr = -ENOENT;\n\t\t\t\t\tgoto __error;\n\t\t\t\t}\n\t\t\t}\n\t\tif (!chip) {\n\t\t\tdev_err(&dev->dev, \"no available usb audio device\\n\");\n\t\t\terr = -ENODEV;\n\t\t\tgoto __error;\n\t\t}\n\t}\n\tdev_set_drvdata(&dev->dev, chip);\n\n\t/*\n\t * For devices with more than one control interface, we assume the\n\t * first contains the audio controls. We might need a more specific\n\t * check here in the future.\n\t */\n\tif (!chip->ctrl_intf)\n\t\tchip->ctrl_intf = alts;\n\n\tchip->txfr_quirk = 0;\n\terr = 1; /* continue */\n\tif (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {\n\t\t/* need some special handlings */\n\t\terr = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\tif (err > 0) {\n\t\t/* create normal USB audio interfaces */\n\t\terr = snd_usb_create_streams(chip, ifnum);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t\terr = snd_usb_create_mixer(chip, ifnum, ignore_ctl_error);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\t/* we are allowed to call snd_card_register() many times */\n\terr = snd_card_register(chip->card);\n\tif (err < 0)\n\t\tgoto __error;\n\n\tusb_chip[chip->index] = chip;\n\tchip->num_interfaces++;\n\tusb_set_intfdata(intf, chip);\n\tatomic_dec(&chip->active);\n\tmutex_unlock(®ister_mutex);\n\treturn 0;\n\n __error:\n\tif (chip) {\n\t\tif (!chip->num_interfaces)\n\t\t\tsnd_card_free(chip->card);\n\t\tatomic_dec(&chip->active);\n\t}\n\tmutex_unlock(®ister_mutex);\n\treturn err;\n}","target":"static int usb_audio_probe(struct usb_interface *intf,\n\t\t\t const struct usb_device_id *usb_id)\n{\n\tstruct usb_device *dev = interface_to_usbdev(intf);\n\tconst struct snd_usb_audio_quirk *quirk =\n\t\t(const struct snd_usb_audio_quirk *)usb_id->driver_info;\n\tstruct snd_usb_audio *chip;\n\tint i, err;\n\tstruct usb_host_interface *alts;\n\tint ifnum;\n\tu32 id;\n\n\talts = &intf->altsetting[0];\n\tifnum = get_iface_desc(alts)->bInterfaceNumber;\n\tid = USB_ID(le16_to_cpu(dev->descriptor.idVendor),\n\t\t le16_to_cpu(dev->descriptor.idProduct));\n\tif (get_alias_id(dev, &id))\n\t\tquirk = get_alias_quirk(dev, id);\n\tif (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)\n\t\treturn -ENXIO;\n\n\terr = snd_usb_apply_boot_quirk(dev, intf, quirk, id);\n\tif (err < 0)\n\t\treturn err;\n\n\t/*\n\t * found a config. now register to ALSA\n\t */\n\n\t/* check whether it's already registered */\n\tchip = NULL;\n\tmutex_lock(®ister_mutex);\n\tfor (i = 0; i < SNDRV_CARDS; i++) {\n\t\tif (usb_chip[i] && usb_chip[i]->dev == dev) {\n\t\t\tif (atomic_read(&usb_chip[i]->shutdown)) {\n\t\t\t\tdev_err(&dev->dev, \"USB device is in the shutdown state, cannot create a card instance\\n\");\n\t\t\t\terr = -EIO;\n\t\t\t\tgoto __error;\n\t\t\t}\n\t\t\tchip = usb_chip[i];\n\t\t\tatomic_inc(&chip->active); /* avoid autopm */\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (! chip) {\n\t\t/* it's a fresh one.\n\t\t * now look for an empty slot and create a new card instance\n\t\t */\n\t\tfor (i = 0; i < SNDRV_CARDS; i++)\n\t\t\tif (!usb_chip[i] &&\n\t\t\t (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) &&\n\t\t\t (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) {\n\t\t\t\tif (enable[i]) {\n\t\t\t\t\terr = snd_usb_audio_create(intf, dev, i, quirk,\n\t\t\t\t\t\t\t\t id, &chip);\n\t\t\t\t\tif (err < 0)\n\t\t\t\t\t\tgoto __error;\n\t\t\t\t\tchip->pm_intf = intf;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (vid[i] != -1 || pid[i] != -1) {\n\t\t\t\t\tdev_info(&dev->dev,\n\t\t\t\t\t\t \"device (%04x:%04x) is disabled\\n\",\n\t\t\t\t\t\t USB_ID_VENDOR(id),\n\t\t\t\t\t\t USB_ID_PRODUCT(id));\n\t\t\t\t\terr = -ENOENT;\n\t\t\t\t\tgoto __error;\n\t\t\t\t}\n\t\t\t}\n\t\tif (!chip) {\n\t\t\tdev_err(&dev->dev, \"no available usb audio device\\n\");\n\t\t\terr = -ENODEV;\n\t\t\tgoto __error;\n\t\t}\n\t}\n\tdev_set_drvdata(&dev->dev, chip);\n\n\t/*\n\t * For devices with more than one control interface, we assume the\n\t * first contains the audio controls. We might need a more specific\n\t * check here in the future.\n\t */\n\tif (!chip->ctrl_intf)\n\t\tchip->ctrl_intf = alts;\n\n\tchip->txfr_quirk = 0;\n\terr = 1; /* continue */\n\tif (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {\n\t\t/* need some special handlings */\n\t\terr = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\tif (err > 0) {\n\t\t/* create normal USB audio interfaces */\n\t\terr = snd_usb_create_streams(chip, ifnum);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t\terr = snd_usb_create_mixer(chip, ifnum, ignore_ctl_error);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\t/* we are allowed to call snd_card_register() many times */\n\terr = snd_card_register(chip->card);\n\tif (err < 0)\n\t\tgoto __error;\n\n\tusb_chip[chip->index] = chip;\n\tchip->num_interfaces++;\n\tusb_set_intfdata(intf, chip);\n\tatomic_dec(&chip->active);\n\tmutex_unlock(®ister_mutex);\n\treturn 0;\n\n __error:\n\tif (chip) {\n\t\t/* chip->active is inside the chip->card object,\n\t\t * decrement before memory is possibly returned.\n\t\t */\n\t\tatomic_dec(&chip->active);\n\t\tif (!chip->num_interfaces)\n\t\t\tsnd_card_free(chip->card);\n\t}\n\tmutex_unlock(®ister_mutex);\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","target_token_count":1012,"sven_meta":{"func_name":"usb_audio_probe","file_name":"sound/usb/card.c","commit_link":"github.com/torvalds/linux/commit/5f8cf712582617d523120df67d392059eaf2fc4b","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#50-7f3ac9ed10fc","input":"GF_Err audio_sample_entry_Read(GF_Box *s, GF_BitStream *bs)\n{\n\tGF_MPEGAudioSampleEntryBox *ptr;\n\tchar *data;\n\tu8 a, b, c, d;\n\tu32 i, size, v, nb_alnum;\n\tGF_Err e;\n\tu64 pos, start;\n\n\tptr = (GF_MPEGAudioSampleEntryBox *)s;\n\n\tstart = gf_bs_get_position(bs);\n\tgf_bs_seek(bs, start + 8);\n\tv = gf_bs_read_u16(bs);\n\tif (v)\n\t\tptr->is_qtff = 1;\n\n\t//try to disambiguate QTFF v1 and MP4 v1 audio sample entries ...\n\tif (v==1) {\n\t\t//go to end of ISOM audio sample entry, skip 4 byte (box size field), read 4 bytes (box type) and check if this looks like a box\n\t\tgf_bs_seek(bs, start + 8 + 20 + 4);\n\t\ta = gf_bs_read_u8(bs);\n\t\tb = gf_bs_read_u8(bs);\n\t\tc = gf_bs_read_u8(bs);\n\t\td = gf_bs_read_u8(bs);\n\t\tnb_alnum = 0;\n\t\tif (isalnum(a)) nb_alnum++;\n\t\tif (isalnum(b)) nb_alnum++;\n\t\tif (isalnum(c)) nb_alnum++;\n\t\tif (isalnum(d)) nb_alnum++;\n\t\tif (nb_alnum>2) ptr->is_qtff = 0;\n\t}\n\n\tgf_bs_seek(bs, start);\n\te = gf_isom_audio_sample_entry_read((GF_AudioSampleEntryBox*)s, bs);\n\tif (e) return e;\n\tpos = gf_bs_get_position(bs);\n\tsize = (u32) s->size;\n\n\t//when cookie is set on bs, always convert qtff-style mp4a to isobmff-style\n\t//since the conversion is done in addBox and we don't have the bitstream there (arg...), flag the box\n \tif (gf_bs_get_cookie(bs)) {\n \t\tptr->is_qtff |= 1<<16;\n \t}\n\n\te = gf_isom_box_array_read(s, bs, audio_sample_entry_AddBox);\n\tif (!e) return GF_OK;\n\tif (size<8) return GF_ISOM_INVALID_FILE;\n\n\t/*hack for some weird files (possibly recorded with live.com tools, needs further investigations)*/\n\tgf_bs_seek(bs, pos);\n\tdata = (char*)gf_malloc(sizeof(char) * size);\n\tgf_bs_read_data(bs, data, size);\n\tfor (i=0; iesd) {\n\t\t\t\tgf_isom_box_del((GF_Box *)ptr->esd);\n\t\t\t\tptr->esd=NULL;\n\t\t\t}\n\n\t\t\te = gf_isom_box_parse((GF_Box **)&ptr->esd, mybs);\n\n\t\t\tif (e==GF_OK) {\n\t\t\t\tgf_isom_box_add_for_dump_mode((GF_Box*)ptr, (GF_Box*)ptr->esd);\n\t\t\t} else if (ptr->esd) {\n\t\t\t\tgf_isom_box_del((GF_Box *)ptr->esd);\n\t\t\t\tptr->esd=NULL;\n\t\t\t}\n\n\t\t\tgf_bs_del(mybs);\n\t\t\tbreak;\n\t\t}\n\t}\n\tgf_free(data);\n\treturn e;\n}","target":"GF_Err audio_sample_entry_Read(GF_Box *s, GF_BitStream *bs)\n{\n\tGF_MPEGAudioSampleEntryBox *ptr;\n\tchar *data;\n\tu8 a, b, c, d;\n\tu32 i, size, v, nb_alnum;\n\tGF_Err e;\n\tu64 pos, start;\n\n\tptr = (GF_MPEGAudioSampleEntryBox *)s;\n\n\tstart = gf_bs_get_position(bs);\n\tgf_bs_seek(bs, start + 8);\n\tv = gf_bs_read_u16(bs);\n\tif (v)\n\t\tptr->is_qtff = 1;\n\n\t//try to disambiguate QTFF v1 and MP4 v1 audio sample entries ...\n\tif (v==1) {\n\t\t//go to end of ISOM audio sample entry, skip 4 byte (box size field), read 4 bytes (box type) and check if this looks like a box\n\t\tgf_bs_seek(bs, start + 8 + 20 + 4);\n\t\ta = gf_bs_read_u8(bs);\n\t\tb = gf_bs_read_u8(bs);\n\t\tc = gf_bs_read_u8(bs);\n\t\td = gf_bs_read_u8(bs);\n\t\tnb_alnum = 0;\n\t\tif (isalnum(a)) nb_alnum++;\n\t\tif (isalnum(b)) nb_alnum++;\n\t\tif (isalnum(c)) nb_alnum++;\n\t\tif (isalnum(d)) nb_alnum++;\n\t\tif (nb_alnum>2) ptr->is_qtff = 0;\n\t}\n\n\tgf_bs_seek(bs, start);\n\te = gf_isom_audio_sample_entry_read((GF_AudioSampleEntryBox*)s, bs);\n\tif (e) return e;\n\tpos = gf_bs_get_position(bs);\n\tsize = (u32) s->size;\n\n\t//when cookie is set on bs, always convert qtff-style mp4a to isobmff-style\n\t//since the conversion is done in addBox and we don't have the bitstream there (arg...), flag the box\n \tif (gf_bs_get_cookie(bs)) {\n \t\tptr->is_qtff |= 1<<16;\n \t}\n\n\te = gf_isom_box_array_read(s, bs, audio_sample_entry_AddBox);\n\tif (!e) return GF_OK;\n\tif (size<8) return GF_ISOM_INVALID_FILE;\n\n\t/*hack for some weird files (possibly recorded with live.com tools, needs further investigations)*/\n\tgf_bs_seek(bs, pos);\n\tdata = (char*)gf_malloc(sizeof(char) * size);\n\tgf_bs_read_data(bs, data, size);\n\tfor (i=0; iesd) {\n\t\t\t\tif (!use_dump_mode) gf_isom_box_del((GF_Box *)ptr->esd);\n\t\t\t\tptr->esd=NULL;\n\t\t\t}\n\n\t\t\te = gf_isom_box_parse((GF_Box **)&ptr->esd, mybs);\n\n\t\t\tif (e==GF_OK) {\n\t\t\t\tgf_isom_box_add_for_dump_mode((GF_Box*)ptr, (GF_Box*)ptr->esd);\n\t\t\t} else if (ptr->esd) {\n\t\t\t\tgf_isom_box_del((GF_Box *)ptr->esd);\n\t\t\t\tptr->esd=NULL;\n\t\t\t}\n\n\t\t\tgf_bs_del(mybs);\n\t\t\tbreak;\n\t\t}\n\t}\n\tgf_free(data);\n\treturn e;\n}","lang":"c","vul_type":"cwe-416","target_token_count":805,"sven_meta":{"func_name":"audio_sample_entry_Read","file_name":"src/isomedia/box_code_base.c","commit_link":"github.com/gpac/gpac/commit/6063b1a011c3f80cee25daade18154e15e4c058c","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#54-eada77edac3e","input":"int __mdiobus_register(struct mii_bus *bus, struct module *owner)\n{\n\tstruct mdio_device *mdiodev;\n\tint i, err;\n\tstruct gpio_desc *gpiod;\n\n\tif (NULL == bus || NULL == bus->name ||\n\t NULL == bus->read || NULL == bus->write)\n\t\treturn -EINVAL;\n\n\tBUG_ON(bus->state != MDIOBUS_ALLOCATED &&\n\t bus->state != MDIOBUS_UNREGISTERED);\n\n\tbus->owner = owner;\n\tbus->dev.parent = bus->parent;\n\tbus->dev.class = &mdio_bus_class;\n\tbus->dev.groups = NULL;\n\tdev_set_name(&bus->dev, \"%s\", bus->id);\n\n\terr = device_register(&bus->dev);\n\tif (err) {\n\t\tpr_err(\"mii_bus %s failed to register\\n\", bus->id);\n\t\tput_device(&bus->dev);\n\t\treturn -EINVAL;\n\t}\n\n\tmutex_init(&bus->mdio_lock);\n\n\t/* de-assert bus level PHY GPIO reset */\n\tgpiod = devm_gpiod_get_optional(&bus->dev, \"reset\", GPIOD_OUT_LOW);\n\tif (IS_ERR(gpiod)) {\n\t\tdev_err(&bus->dev, \"mii_bus %s couldn't get reset GPIO\\n\",\n\t\t\tbus->id);\n\t\tdevice_del(&bus->dev);\n\t\treturn PTR_ERR(gpiod);\n\t} else\tif (gpiod) {\n\t\tbus->reset_gpiod = gpiod;\n\n\t\tgpiod_set_value_cansleep(gpiod, 1);\n\t\tudelay(bus->reset_delay_us);\n\t\tgpiod_set_value_cansleep(gpiod, 0);\n\t}\n\n\tif (bus->reset)\n\t\tbus->reset(bus);\n\n\tfor (i = 0; i < PHY_MAX_ADDR; i++) {\n\t\tif ((bus->phy_mask & (1 << i)) == 0) {\n\t\t\tstruct phy_device *phydev;\n\n\t\t\tphydev = mdiobus_scan(bus, i);\n\t\t\tif (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) {\n\t\t\t\terr = PTR_ERR(phydev);\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\tmdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device);\n\n\tbus->state = MDIOBUS_REGISTERED;\n\tpr_info(\"%s: probed\\n\", bus->name);\n\treturn 0;\n\nerror:\n\twhile (--i >= 0) {\n\t\tmdiodev = bus->mdio_map[i];\n\t\tif (!mdiodev)\n\t\t\tcontinue;\n\n\t\tmdiodev->device_remove(mdiodev);\n\t\tmdiodev->device_free(mdiodev);\n\t}\n\n\t/* Put PHYs in RESET to save power */\n\tif (bus->reset_gpiod)\n\t\tgpiod_set_value_cansleep(bus->reset_gpiod, 1);\n\n\tdevice_del(&bus->dev);\n\treturn err;\n}","target":"int __mdiobus_register(struct mii_bus *bus, struct module *owner)\n{\n\tstruct mdio_device *mdiodev;\n\tint i, err;\n\tstruct gpio_desc *gpiod;\n\n\tif (NULL == bus || NULL == bus->name ||\n\t NULL == bus->read || NULL == bus->write)\n\t\treturn -EINVAL;\n\n\tBUG_ON(bus->state != MDIOBUS_ALLOCATED &&\n\t bus->state != MDIOBUS_UNREGISTERED);\n\n\tbus->owner = owner;\n\tbus->dev.parent = bus->parent;\n\tbus->dev.class = &mdio_bus_class;\n\tbus->dev.groups = NULL;\n\tdev_set_name(&bus->dev, \"%s\", bus->id);\n\n\terr = device_register(&bus->dev);\n\tif (err) {\n\t\tpr_err(\"mii_bus %s failed to register\\n\", bus->id);\n\t\treturn -EINVAL;\n\t}\n\n\tmutex_init(&bus->mdio_lock);\n\n\t/* de-assert bus level PHY GPIO reset */\n\tgpiod = devm_gpiod_get_optional(&bus->dev, \"reset\", GPIOD_OUT_LOW);\n\tif (IS_ERR(gpiod)) {\n\t\tdev_err(&bus->dev, \"mii_bus %s couldn't get reset GPIO\\n\",\n\t\t\tbus->id);\n\t\tdevice_del(&bus->dev);\n\t\treturn PTR_ERR(gpiod);\n\t} else\tif (gpiod) {\n\t\tbus->reset_gpiod = gpiod;\n\n\t\tgpiod_set_value_cansleep(gpiod, 1);\n\t\tudelay(bus->reset_delay_us);\n\t\tgpiod_set_value_cansleep(gpiod, 0);\n\t}\n\n\tif (bus->reset)\n\t\tbus->reset(bus);\n\n\tfor (i = 0; i < PHY_MAX_ADDR; i++) {\n\t\tif ((bus->phy_mask & (1 << i)) == 0) {\n\t\t\tstruct phy_device *phydev;\n\n\t\t\tphydev = mdiobus_scan(bus, i);\n\t\t\tif (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) {\n\t\t\t\terr = PTR_ERR(phydev);\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\tmdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device);\n\n\tbus->state = MDIOBUS_REGISTERED;\n\tpr_info(\"%s: probed\\n\", bus->name);\n\treturn 0;\n\nerror:\n\twhile (--i >= 0) {\n\t\tmdiodev = bus->mdio_map[i];\n\t\tif (!mdiodev)\n\t\t\tcontinue;\n\n\t\tmdiodev->device_remove(mdiodev);\n\t\tmdiodev->device_free(mdiodev);\n\t}\n\n\t/* Put PHYs in RESET to save power */\n\tif (bus->reset_gpiod)\n\t\tgpiod_set_value_cansleep(bus->reset_gpiod, 1);\n\n\tdevice_del(&bus->dev);\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","target_token_count":613,"sven_meta":{"func_name":"__mdiobus_register","file_name":"drivers/net/phy/mdio_bus.c","commit_link":"github.com/torvalds/linux/commit/6ff7b060535e87c2ae14dd8548512abfdda528fb","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#56-67ec0f6f947a","input":"SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,\n\t unsigned int *nbytes, struct kvec *iov, int n_vec)\n{\n\tstruct smb_rqst rqst;\n\tint rc = 0;\n\tstruct smb2_write_req *req = NULL;\n\tstruct smb2_write_rsp *rsp = NULL;\n\tint resp_buftype;\n\tstruct kvec rsp_iov;\n\tint flags = 0;\n\tunsigned int total_len;\n\n\t*nbytes = 0;\n\n\tif (n_vec < 1)\n\t\treturn rc;\n\n\trc = smb2_plain_req_init(SMB2_WRITE, io_parms->tcon, (void **) &req,\n\t\t\t &total_len);\n\tif (rc)\n\t\treturn rc;\n\n\tif (io_parms->tcon->ses->server == NULL)\n\t\treturn -ECONNABORTED;\n\n\tif (smb3_encryption_required(io_parms->tcon))\n\t\tflags |= CIFS_TRANSFORM_REQ;\n\n\treq->sync_hdr.ProcessId = cpu_to_le32(io_parms->pid);\n\n\treq->PersistentFileId = io_parms->persistent_fid;\n\treq->VolatileFileId = io_parms->volatile_fid;\n\treq->WriteChannelInfoOffset = 0;\n\treq->WriteChannelInfoLength = 0;\n\treq->Channel = 0;\n\treq->Length = cpu_to_le32(io_parms->length);\n\treq->Offset = cpu_to_le64(io_parms->offset);\n\treq->DataOffset = cpu_to_le16(\n\t\t\t\toffsetof(struct smb2_write_req, Buffer));\n\treq->RemainingBytes = 0;\n\n\ttrace_smb3_write_enter(xid, io_parms->persistent_fid,\n\t\tio_parms->tcon->tid, io_parms->tcon->ses->Suid,\n\t\tio_parms->offset, io_parms->length);\n\n\tiov[0].iov_base = (char *)req;\n\t/* 1 for Buffer */\n\tiov[0].iov_len = total_len - 1;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = n_vec + 1;\n\n\trc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst,\n\t\t\t &resp_buftype, flags, &rsp_iov);\n\tcifs_small_buf_release(req);\n\trsp = (struct smb2_write_rsp *)rsp_iov.iov_base;\n\n\tif (rc) {\n\t\ttrace_smb3_write_err(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid,\n\t\t\t\t io_parms->tcon->ses->Suid,\n\t\t\t\t io_parms->offset, io_parms->length, rc);\n\t\tcifs_stats_fail_inc(io_parms->tcon, SMB2_WRITE_HE);\n\t\tcifs_dbg(VFS, \"Send error in write = %d\\n\", rc);\n\t} else {\n\t\t*nbytes = le32_to_cpu(rsp->DataLength);\n\t\ttrace_smb3_write_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid,\n\t\t\t\t io_parms->tcon->ses->Suid,\n\t\t\t\t io_parms->offset, *nbytes);\n\t}\n\n\tfree_rsp_buf(resp_buftype, rsp);\n\treturn rc;\n}","target":"SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,\n\t unsigned int *nbytes, struct kvec *iov, int n_vec)\n{\n\tstruct smb_rqst rqst;\n\tint rc = 0;\n\tstruct smb2_write_req *req = NULL;\n\tstruct smb2_write_rsp *rsp = NULL;\n\tint resp_buftype;\n\tstruct kvec rsp_iov;\n\tint flags = 0;\n\tunsigned int total_len;\n\n\t*nbytes = 0;\n\n\tif (n_vec < 1)\n\t\treturn rc;\n\n\trc = smb2_plain_req_init(SMB2_WRITE, io_parms->tcon, (void **) &req,\n\t\t\t &total_len);\n\tif (rc)\n\t\treturn rc;\n\n\tif (io_parms->tcon->ses->server == NULL)\n\t\treturn -ECONNABORTED;\n\n\tif (smb3_encryption_required(io_parms->tcon))\n\t\tflags |= CIFS_TRANSFORM_REQ;\n\n\treq->sync_hdr.ProcessId = cpu_to_le32(io_parms->pid);\n\n\treq->PersistentFileId = io_parms->persistent_fid;\n\treq->VolatileFileId = io_parms->volatile_fid;\n\treq->WriteChannelInfoOffset = 0;\n\treq->WriteChannelInfoLength = 0;\n\treq->Channel = 0;\n\treq->Length = cpu_to_le32(io_parms->length);\n\treq->Offset = cpu_to_le64(io_parms->offset);\n\treq->DataOffset = cpu_to_le16(\n\t\t\t\toffsetof(struct smb2_write_req, Buffer));\n\treq->RemainingBytes = 0;\n\n\ttrace_smb3_write_enter(xid, io_parms->persistent_fid,\n\t\tio_parms->tcon->tid, io_parms->tcon->ses->Suid,\n\t\tio_parms->offset, io_parms->length);\n\n\tiov[0].iov_base = (char *)req;\n\t/* 1 for Buffer */\n\tiov[0].iov_len = total_len - 1;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = n_vec + 1;\n\n\trc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst,\n\t\t\t &resp_buftype, flags, &rsp_iov);\n\trsp = (struct smb2_write_rsp *)rsp_iov.iov_base;\n\n\tif (rc) {\n\t\ttrace_smb3_write_err(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid,\n\t\t\t\t io_parms->tcon->ses->Suid,\n\t\t\t\t io_parms->offset, io_parms->length, rc);\n\t\tcifs_stats_fail_inc(io_parms->tcon, SMB2_WRITE_HE);\n\t\tcifs_dbg(VFS, \"Send error in write = %d\\n\", rc);\n\t} else {\n\t\t*nbytes = le32_to_cpu(rsp->DataLength);\n\t\ttrace_smb3_write_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid,\n\t\t\t\t io_parms->tcon->ses->Suid,\n\t\t\t\t io_parms->offset, *nbytes);\n\t}\n\n\tcifs_small_buf_release(req);\n\tfree_rsp_buf(resp_buftype, rsp);\n\treturn rc;\n}","lang":"c","vul_type":"cwe-416","target_token_count":673,"sven_meta":{"func_name":"SMB2_write","file_name":"fs/cifs/smb2pdu.c","commit_link":"github.com/torvalds/linux/commit/6a3eb3360667170988f8a6477f6686242061488a","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-022#4-1e7893debf07","input":"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n GDBusMethodInvocation *invocation,\n gpointer user_data)\n{\n reset_timeout();\n\n uid_t caller_uid;\n GVariant *response;\n\n caller_uid = get_caller_uid(connection, invocation, caller);\n\n log_notice(\"caller_uid:%ld method:'%s'\", (long)caller_uid, method_name);\n\n if (caller_uid == (uid_t) -1)\n return;\n\n if (g_strcmp0(method_name, \"NewProblem\") == 0)\n {\n char *error = NULL;\n char *problem_id = handle_new_problem(g_variant_get_child_value(parameters, 0), caller_uid, &error);\n if (!problem_id)\n {\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n /* else */\n response = g_variant_new(\"(s)\", problem_id);\n g_dbus_method_invocation_return_value(invocation, response);\n free(problem_id);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"GetProblems\") == 0)\n {\n GList *dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n //I was told that g_dbus_method frees the response\n //g_variant_unref(response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetAllProblems\") == 0)\n {\n /*\n - so, we have UID,\n - if it's 0, then we don't have to check anything and just return all directories\n - if uid != 0 then we want to ask for authorization\n */\n if (caller_uid != 0)\n {\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n }\n\n GList * dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetForeignProblems\") == 0)\n {\n GList * dirs = get_problem_dirs_not_accessible_by_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"ChownProblemDir\") == 0)\n {\n const gchar *problem_dir;\n g_variant_get(parameters, \"(&s)\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int ddstat = fdump_dir_stat_for_uid(dir_fd, caller_uid);\n if (ddstat < 0)\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"requested directory does not exist '%s'\", problem_dir);\n }\n else\n {\n perror_msg(\"can't get stat of '%s'\", problem_dir);\n }\n\n return_InvalidProblemDir_error(invocation, problem_dir);\n\n close(dir_fd);\n return;\n }\n\n if (ddstat & DD_STAT_OWNED_BY_UID)\n { //caller seems to be in group with access to this dir, so no action needed\n log_notice(\"caller has access to the requested directory %s\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, NULL);\n close(dir_fd);\n return;\n }\n\n if ((ddstat & DD_STAT_ACCESSIBLE_BY_UID) == 0 &&\n polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int chown_res = dd_chown(dd, caller_uid);\n if (chown_res != 0)\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.ChownError\",\n _(\"Chowning directory failed. Check system logs for more details.\"));\n else\n g_dbus_method_invocation_return_value(invocation, NULL);\n\n dd_close(dd);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetInfo\") == 0)\n {\n /* Parameter tuple is (sas) */\n\n\t/* Get 1st param - problem dir name */\n const gchar *problem_dir;\n g_variant_get_child(parameters, 0, \"&s\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n close(dir_fd);\n return;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n\t/* Get 2nd param - vector of element names */\n GVariant *array = g_variant_get_child_value(parameters, 1);\n GList *elements = string_list_from_variant(array);\n g_variant_unref(array);\n\n GVariantBuilder *builder = NULL;\n for (GList *l = elements; l; l = l->next)\n {\n const char *element_name = (const char*)l->data;\n char *value = dd_load_text_ext(dd, element_name, 0\n | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE\n | DD_FAIL_QUIETLY_ENOENT\n | DD_FAIL_QUIETLY_EACCES);\n log_notice(\"element '%s' %s\", element_name, value ? \"fetched\" : \"not found\");\n if (value)\n {\n if (!builder)\n builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);\n\n /* g_variant_builder_add makes a copy. No need to xstrdup here */\n g_variant_builder_add(builder, \"{ss}\", element_name, value);\n free(value);\n }\n }\n list_free_with_free(elements);\n dd_close(dd);\n /* It is OK to call g_variant_new(\"(a{ss})\", NULL) because */\n /* G_VARIANT_TYPE_TUPLE allows NULL value */\n GVariant *response = g_variant_new(\"(a{ss})\", builder);\n\n if (builder)\n g_variant_builder_unref(builder);\n\n log_info(\"GetInfo: returning value for '%s'\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"SetElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n const char *value;\n\n g_variant_get(parameters, \"(&s&s&s)\", &problem_id, &element, &value);\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n /* Is it good idea to make it static? Is it possible to change the max size while a single run? */\n const double max_dir_size = g_settings_nMaxCrashReportsSize * (1024 * 1024);\n const long item_size = dd_get_item_size(dd, element);\n if (item_size < 0)\n {\n log_notice(\"Can't get size of '%s/%s'\", problem_id, element);\n char *error = xasprintf(_(\"Can't get size of '%s'\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n return;\n }\n\n const double requested_size = (double)strlen(value) - item_size;\n /* Don't want to check the size limit in case of reducing of size */\n if (requested_size > 0\n && requested_size > (max_dir_size - get_dirsize(g_settings_dump_location)))\n {\n log_notice(\"No problem space left in '%s' (requested Bytes %f)\", problem_id, requested_size);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n _(\"No problem space left\"));\n }\n else\n {\n dd_save_text(dd, element, value);\n g_dbus_method_invocation_return_value(invocation, NULL);\n }\n\n dd_close(dd);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n\n g_variant_get(parameters, \"(&s&s)\", &problem_id, &element);\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n const int res = dd_delete_item(dd, element);\n dd_close(dd);\n\n if (res != 0)\n {\n log_notice(\"Can't delete the element '%s' from the problem directory '%s'\", element, problem_id);\n char *error = xasprintf(_(\"Can't delete the element '%s' from the problem directory '%s'\"), element, problem_id);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteProblem\") == 0)\n {\n /* Dbus parameters are always tuples.\n * In this case, it's (as) - a tuple of one element (array of strings).\n * Need to fetch the array:\n */\n GVariant *array = g_variant_get_child_value(parameters, 0);\n GList *problem_dirs = string_list_from_variant(array);\n g_variant_unref(array);\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n log_notice(\"dir_name:'%s'\", dir_name);\n if (!allowed_problem_dir(dir_name))\n {\n return_InvalidProblemDir_error(invocation, dir_name);\n goto ret;\n }\n }\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n\n int dir_fd = dd_openfd(dir_name);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", dir_name);\n return_InvalidProblemDir_error(invocation, dir_name);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", dir_name);\n close(dir_fd);\n continue;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n { // if user didn't provide correct credentials, just move to the next dir\n close(dir_fd);\n continue;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, dir_name, /*flags:*/ 0);\n if (dd)\n {\n if (dd_delete(dd) != 0)\n {\n error_msg(\"Failed to delete problem directory '%s'\", dir_name);\n dd_close(dd);\n }\n }\n }\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n ret:\n list_free_with_free(problem_dirs);\n return;\n }\n\n if (g_strcmp0(method_name, \"FindProblemByElementInTimeRange\") == 0)\n {\n const gchar *element;\n const gchar *value;\n glong timestamp_from;\n glong timestamp_to;\n gboolean all;\n\n g_variant_get_child(parameters, 0, \"&s\", &element);\n g_variant_get_child(parameters, 1, \"&s\", &value);\n g_variant_get_child(parameters, 2, \"x\", ×tamp_from);\n g_variant_get_child(parameters, 3, \"x\", ×tamp_to);\n g_variant_get_child(parameters, 4, \"b\", &all);\n\n if (all && polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n\n GList *dirs = get_problem_dirs_for_element_in_time(caller_uid, element, value, timestamp_from,\n timestamp_to);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"Quit\") == 0)\n {\n g_dbus_method_invocation_return_value(invocation, NULL);\n g_main_loop_quit(loop);\n return;\n }\n}","target":"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n GDBusMethodInvocation *invocation,\n gpointer user_data)\n{\n reset_timeout();\n\n uid_t caller_uid;\n GVariant *response;\n\n caller_uid = get_caller_uid(connection, invocation, caller);\n\n log_notice(\"caller_uid:%ld method:'%s'\", (long)caller_uid, method_name);\n\n if (caller_uid == (uid_t) -1)\n return;\n\n if (g_strcmp0(method_name, \"NewProblem\") == 0)\n {\n char *error = NULL;\n char *problem_id = handle_new_problem(g_variant_get_child_value(parameters, 0), caller_uid, &error);\n if (!problem_id)\n {\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n /* else */\n response = g_variant_new(\"(s)\", problem_id);\n g_dbus_method_invocation_return_value(invocation, response);\n free(problem_id);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"GetProblems\") == 0)\n {\n GList *dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n //I was told that g_dbus_method frees the response\n //g_variant_unref(response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetAllProblems\") == 0)\n {\n /*\n - so, we have UID,\n - if it's 0, then we don't have to check anything and just return all directories\n - if uid != 0 then we want to ask for authorization\n */\n if (caller_uid != 0)\n {\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n }\n\n GList * dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetForeignProblems\") == 0)\n {\n GList * dirs = get_problem_dirs_not_accessible_by_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"ChownProblemDir\") == 0)\n {\n const gchar *problem_dir;\n g_variant_get(parameters, \"(&s)\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int ddstat = fdump_dir_stat_for_uid(dir_fd, caller_uid);\n if (ddstat < 0)\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"requested directory does not exist '%s'\", problem_dir);\n }\n else\n {\n perror_msg(\"can't get stat of '%s'\", problem_dir);\n }\n\n return_InvalidProblemDir_error(invocation, problem_dir);\n\n close(dir_fd);\n return;\n }\n\n if (ddstat & DD_STAT_OWNED_BY_UID)\n { //caller seems to be in group with access to this dir, so no action needed\n log_notice(\"caller has access to the requested directory %s\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, NULL);\n close(dir_fd);\n return;\n }\n\n if ((ddstat & DD_STAT_ACCESSIBLE_BY_UID) == 0 &&\n polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int chown_res = dd_chown(dd, caller_uid);\n if (chown_res != 0)\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.ChownError\",\n _(\"Chowning directory failed. Check system logs for more details.\"));\n else\n g_dbus_method_invocation_return_value(invocation, NULL);\n\n dd_close(dd);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetInfo\") == 0)\n {\n /* Parameter tuple is (sas) */\n\n\t/* Get 1st param - problem dir name */\n const gchar *problem_dir;\n g_variant_get_child(parameters, 0, \"&s\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n close(dir_fd);\n return;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n\t/* Get 2nd param - vector of element names */\n GVariant *array = g_variant_get_child_value(parameters, 1);\n GList *elements = string_list_from_variant(array);\n g_variant_unref(array);\n\n GVariantBuilder *builder = NULL;\n for (GList *l = elements; l; l = l->next)\n {\n const char *element_name = (const char*)l->data;\n char *value = dd_load_text_ext(dd, element_name, 0\n | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE\n | DD_FAIL_QUIETLY_ENOENT\n | DD_FAIL_QUIETLY_EACCES);\n log_notice(\"element '%s' %s\", element_name, value ? \"fetched\" : \"not found\");\n if (value)\n {\n if (!builder)\n builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);\n\n /* g_variant_builder_add makes a copy. No need to xstrdup here */\n g_variant_builder_add(builder, \"{ss}\", element_name, value);\n free(value);\n }\n }\n list_free_with_free(elements);\n dd_close(dd);\n /* It is OK to call g_variant_new(\"(a{ss})\", NULL) because */\n /* G_VARIANT_TYPE_TUPLE allows NULL value */\n GVariant *response = g_variant_new(\"(a{ss})\", builder);\n\n if (builder)\n g_variant_builder_unref(builder);\n\n log_info(\"GetInfo: returning value for '%s'\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"SetElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n const char *value;\n\n g_variant_get(parameters, \"(&s&s&s)\", &problem_id, &element, &value);\n\n if (!allowed_problem_dir(problem_id))\n {\n return_InvalidProblemDir_error(invocation, problem_id);\n return;\n }\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n /* Is it good idea to make it static? Is it possible to change the max size while a single run? */\n const double max_dir_size = g_settings_nMaxCrashReportsSize * (1024 * 1024);\n const long item_size = dd_get_item_size(dd, element);\n if (item_size < 0)\n {\n log_notice(\"Can't get size of '%s/%s'\", problem_id, element);\n char *error = xasprintf(_(\"Can't get size of '%s'\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n return;\n }\n\n const double requested_size = (double)strlen(value) - item_size;\n /* Don't want to check the size limit in case of reducing of size */\n if (requested_size > 0\n && requested_size > (max_dir_size - get_dirsize(g_settings_dump_location)))\n {\n log_notice(\"No problem space left in '%s' (requested Bytes %f)\", problem_id, requested_size);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n _(\"No problem space left\"));\n }\n else\n {\n dd_save_text(dd, element, value);\n g_dbus_method_invocation_return_value(invocation, NULL);\n }\n\n dd_close(dd);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n\n g_variant_get(parameters, \"(&s&s)\", &problem_id, &element);\n\n if (!allowed_problem_dir(problem_id))\n {\n return_InvalidProblemDir_error(invocation, problem_id);\n return;\n }\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n const int res = dd_delete_item(dd, element);\n dd_close(dd);\n\n if (res != 0)\n {\n log_notice(\"Can't delete the element '%s' from the problem directory '%s'\", element, problem_id);\n char *error = xasprintf(_(\"Can't delete the element '%s' from the problem directory '%s'\"), element, problem_id);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteProblem\") == 0)\n {\n /* Dbus parameters are always tuples.\n * In this case, it's (as) - a tuple of one element (array of strings).\n * Need to fetch the array:\n */\n GVariant *array = g_variant_get_child_value(parameters, 0);\n GList *problem_dirs = string_list_from_variant(array);\n g_variant_unref(array);\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n log_notice(\"dir_name:'%s'\", dir_name);\n if (!allowed_problem_dir(dir_name))\n {\n return_InvalidProblemDir_error(invocation, dir_name);\n goto ret;\n }\n }\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n\n int dir_fd = dd_openfd(dir_name);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", dir_name);\n return_InvalidProblemDir_error(invocation, dir_name);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", dir_name);\n close(dir_fd);\n continue;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n { // if user didn't provide correct credentials, just move to the next dir\n close(dir_fd);\n continue;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, dir_name, /*flags:*/ 0);\n if (dd)\n {\n if (dd_delete(dd) != 0)\n {\n error_msg(\"Failed to delete problem directory '%s'\", dir_name);\n dd_close(dd);\n }\n }\n }\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n ret:\n list_free_with_free(problem_dirs);\n return;\n }\n\n if (g_strcmp0(method_name, \"FindProblemByElementInTimeRange\") == 0)\n {\n const gchar *element;\n const gchar *value;\n glong timestamp_from;\n glong timestamp_to;\n gboolean all;\n\n g_variant_get_child(parameters, 0, \"&s\", &element);\n g_variant_get_child(parameters, 1, \"&s\", &value);\n g_variant_get_child(parameters, 2, \"x\", ×tamp_from);\n g_variant_get_child(parameters, 3, \"x\", ×tamp_to);\n g_variant_get_child(parameters, 4, \"b\", &all);\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name\", element);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n if (all && polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n\n GList *dirs = get_problem_dirs_for_element_in_time(caller_uid, element, value, timestamp_from,\n timestamp_to);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"Quit\") == 0)\n {\n g_dbus_method_invocation_return_value(invocation, NULL);\n g_main_loop_quit(loop);\n return;\n }\n}","lang":"c","vul_type":"cwe-022","target_token_count":3609,"sven_meta":{"func_name":"handle_method_call","file_name":"src/dbus/abrt-dbus.c","commit_link":"github.com/abrt/abrt/commit/7a47f57975be0d285a2f20758e4572dca6d9cdd3","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#8-467508569625","input":"wiki_handle_http_request(HttpRequest *req)\n{\n HttpResponse *res = http_response_new(req);\n char *page = http_request_get_path_info(req); \n char *command = http_request_get_query_string(req); \n char *wikitext = \"\";\n\n util_dehttpize(page); \t/* remove any encoding on the requested\n\t\t\t\t page name. */\n\n if (!strcmp(page, \"/\"))\n {\n if (access(\"WikiHome\", R_OK) != 0)\n\twiki_redirect(res, \"/WikiHome?create\");\n page = \"/WikiHome\";\n }\n\n if (!strcmp(page, \"/styles.css\"))\n {\n /* Return CSS page */\n http_response_set_content_type(res, \"text/css\");\n http_response_printf(res, \"%s\", CssData);\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"/favicon.ico\"))\n {\n /* Return favicon */\n http_response_set_content_type(res, \"image/ico\");\n http_response_set_data(res, FaviconData, FaviconDataLen);\n http_response_send(res);\n exit(0);\n }\n\n\n page = page + 1; \t\t/* skip slash */\n\n if (!strncmp(page, \"api/\", 4))\n {\n char *p;\n\n page += 4; \n for (p=page; *p != '\\0'; p++)\n\tif (*p=='?') { *p ='\\0'; break; }\n \n wiki_handle_rest_call(req, res, page); \n exit(0);\n }\n\n /* A little safety. issue a malformed request for any paths,\n * There shouldn't need to be any..\n */\n if (strchr(page, '/'))\n {\n http_response_set_status(res, 404, \"Not Found\");\n http_response_printf(res, \"404 Not Found\\n\");\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"Changes\"))\n {\n wiki_show_changes_page(res);\n }\n else if (!strcmp(page, \"ChangesRss\"))\n {\n wiki_show_changes_page_rss(res);\n }\n else if (!strcmp(page, \"Search\"))\n {\n wiki_show_search_results_page(res, http_request_param_get(req, \"expr\"));\n }\n else if (!strcmp(page, \"Create\"))\n {\n if ( (wikitext = http_request_param_get(req, \"title\")) != NULL)\n\t{\n\t /* create page and redirect */\n\t wiki_redirect(res, http_request_param_get(req, \"title\"));\n\t}\n else\n\t{\n\t /* show create page form */\n\t wiki_show_create_page(res);\n\t}\n }\n else\n {\n /* TODO: dont blindly write wikitext data to disk */\n if ( (wikitext = http_request_param_get(req, \"wikitext\")) != NULL)\n\t{\n\t file_write(page, wikitext);\t \n\t}\n\n if (access(page, R_OK) == 0) \t/* page exists */\n\t{\n\t wikitext = file_read(page);\n\t \n\t if (!strcmp(command, \"edit\"))\n\t {\n\t /* print edit page */\n\t wiki_show_edit_page(res, wikitext, page);\n\t }\n\t else\n\t {\n\t wiki_show_page(res, wikitext, page);\n\t }\n\t}\n else\n\t{\n\t if (!strcmp(command, \"create\"))\n\t {\n\t wiki_show_edit_page(res, NULL, page);\n\t }\n\t else\n\t {\n\t char buf[1024];\n\t snprintf(buf, 1024, \"%s?create\", page);\n\t wiki_redirect(res, buf);\n\t }\n\t}\n }\n\n}","target":"wiki_handle_http_request(HttpRequest *req)\n{\n HttpResponse *res = http_response_new(req);\n char *page = http_request_get_path_info(req); \n char *command = http_request_get_query_string(req); \n char *wikitext = \"\";\n\n util_dehttpize(page); \t/* remove any encoding on the requested\n\t\t\t\t page name. */\n\n if (!strcmp(page, \"/\"))\n {\n if (access(\"WikiHome\", R_OK) != 0)\n\twiki_redirect(res, \"/WikiHome?create\");\n page = \"/WikiHome\";\n }\n\n if (!strcmp(page, \"/styles.css\"))\n {\n /* Return CSS page */\n http_response_set_content_type(res, \"text/css\");\n http_response_printf(res, \"%s\", CssData);\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"/favicon.ico\"))\n {\n /* Return favicon */\n http_response_set_content_type(res, \"image/ico\");\n http_response_set_data(res, FaviconData, FaviconDataLen);\n http_response_send(res);\n exit(0);\n }\n\n\n page = page + 1; \t\t/* skip slash */\n\n if (!strncmp(page, \"api/\", 4))\n {\n char *p;\n\n page += 4; \n for (p=page; *p != '\\0'; p++)\n\tif (*p=='?') { *p ='\\0'; break; }\n \n wiki_handle_rest_call(req, res, page); \n exit(0);\n }\n\n /* A little safety. issue a malformed request for any paths,\n * There shouldn't need to be any..\n */\n if (!page_name_is_good(page))\n {\n http_response_set_status(res, 404, \"Not Found\");\n http_response_printf(res, \"404 Not Found\\n\");\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"Changes\"))\n {\n wiki_show_changes_page(res);\n }\n else if (!strcmp(page, \"ChangesRss\"))\n {\n wiki_show_changes_page_rss(res);\n }\n else if (!strcmp(page, \"Search\"))\n {\n wiki_show_search_results_page(res, http_request_param_get(req, \"expr\"));\n }\n else if (!strcmp(page, \"Create\"))\n {\n if ( (wikitext = http_request_param_get(req, \"title\")) != NULL)\n\t{\n\t /* create page and redirect */\n\t wiki_redirect(res, http_request_param_get(req, \"title\"));\n\t}\n else\n\t{\n\t /* show create page form */\n\t wiki_show_create_page(res);\n\t}\n }\n else\n {\n /* TODO: dont blindly write wikitext data to disk */\n if ( (wikitext = http_request_param_get(req, \"wikitext\")) != NULL)\n\t{\n\t file_write(page, wikitext);\t \n\t}\n\n if (access(page, R_OK) == 0) \t/* page exists */\n\t{\n\t wikitext = file_read(page);\n\t \n\t if (!strcmp(command, \"edit\"))\n\t {\n\t /* print edit page */\n\t wiki_show_edit_page(res, wikitext, page);\n\t }\n\t else\n\t {\n\t wiki_show_page(res, wikitext, page);\n\t }\n\t}\n else\n\t{\n\t if (!strcmp(command, \"create\"))\n\t {\n\t wiki_show_edit_page(res, NULL, page);\n\t }\n\t else\n\t {\n\t char buf[1024];\n\t snprintf(buf, 1024, \"%s?create\", page);\n\t wiki_redirect(res, buf);\n\t }\n\t}\n }\n\n}","lang":"c","vul_type":"cwe-022","target_token_count":795,"sven_meta":{"func_name":"wiki_handle_http_request","file_name":"src/wiki.c","commit_link":"github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#13-055305645a7a","input":"PHYSICALPATH_FUNC(mod_alias_physical_handler) {\n\tplugin_data *p = p_d;\n\tint uri_len, basedir_len;\n\tchar *uri_ptr;\n\tsize_t k;\n\n\tif (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON;\n\n\tmod_alias_patch_connection(srv, con, p);\n\n\t/* not to include the tailing slash */\n\tbasedir_len = buffer_string_length(con->physical.basedir);\n\tif ('/' == con->physical.basedir->ptr[basedir_len-1]) --basedir_len;\n\turi_len = buffer_string_length(con->physical.path) - basedir_len;\n\turi_ptr = con->physical.path->ptr + basedir_len;\n\n\tfor (k = 0; k < p->conf.alias->used; k++) {\n\t\tdata_string *ds = (data_string *)p->conf.alias->data[k];\n\t\tint alias_len = buffer_string_length(ds->key);\n\n\t\tif (alias_len > uri_len) continue;\n\t\tif (buffer_is_empty(ds->key)) continue;\n\n\t\tif (0 == (con->conf.force_lowercase_filenames ?\n\t\t\t\t\tstrncasecmp(uri_ptr, ds->key->ptr, alias_len) :\n\t\t\t\t\tstrncmp(uri_ptr, ds->key->ptr, alias_len))) {\n\t\t\t/* matched */\n\n\t\t\tbuffer_copy_buffer(con->physical.basedir, ds->value);\n\t\t\tbuffer_copy_buffer(srv->tmp_buf, ds->value);\n\t\t\tbuffer_append_string(srv->tmp_buf, uri_ptr + alias_len);\n\t\t\tbuffer_copy_buffer(con->physical.path, srv->tmp_buf);\n\n\t\t\treturn HANDLER_GO_ON;\n\t\t}\n\t}\n\n\t/* not found */\n\treturn HANDLER_GO_ON;\n}","target":"PHYSICALPATH_FUNC(mod_alias_physical_handler) {\n\tplugin_data *p = p_d;\n\tint uri_len, basedir_len;\n\tchar *uri_ptr;\n\tsize_t k;\n\n\tif (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON;\n\n\tmod_alias_patch_connection(srv, con, p);\n\n\t/* not to include the tailing slash */\n\tbasedir_len = buffer_string_length(con->physical.basedir);\n\tif ('/' == con->physical.basedir->ptr[basedir_len-1]) --basedir_len;\n\turi_len = buffer_string_length(con->physical.path) - basedir_len;\n\turi_ptr = con->physical.path->ptr + basedir_len;\n\n\tfor (k = 0; k < p->conf.alias->used; k++) {\n\t\tdata_string *ds = (data_string *)p->conf.alias->data[k];\n\t\tint alias_len = buffer_string_length(ds->key);\n\n\t\tif (alias_len > uri_len) continue;\n\t\tif (buffer_is_empty(ds->key)) continue;\n\n\t\tif (0 == (con->conf.force_lowercase_filenames ?\n\t\t\t\t\tstrncasecmp(uri_ptr, ds->key->ptr, alias_len) :\n\t\t\t\t\tstrncmp(uri_ptr, ds->key->ptr, alias_len))) {\n\t\t\t/* matched */\n\n\t\t\t/* check for path traversal in url-path following alias if key\n\t\t\t * does not end in slash, but replacement value ends in slash */\n\t\t\tif (uri_ptr[alias_len] == '.') {\n\t\t\t\tchar *s = uri_ptr + alias_len + 1;\n\t\t\t\tif (*s == '.') ++s;\n\t\t\t\tif (*s == '/' || *s == '\\0') {\n\t\t\t\t\tsize_t vlen = buffer_string_length(ds->value);\n\t\t\t\t\tif (0 != alias_len && ds->key->ptr[alias_len-1] != '/'\n\t\t\t\t\t && 0 != vlen && ds->value->ptr[vlen-1] == '/') {\n\t\t\t\t\t\tcon->http_status = 403;\n\t\t\t\t\t\treturn HANDLER_FINISHED;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbuffer_copy_buffer(con->physical.basedir, ds->value);\n\t\t\tbuffer_copy_buffer(srv->tmp_buf, ds->value);\n\t\t\tbuffer_append_string(srv->tmp_buf, uri_ptr + alias_len);\n\t\t\tbuffer_copy_buffer(con->physical.path, srv->tmp_buf);\n\n\t\t\treturn HANDLER_GO_ON;\n\t\t}\n\t}\n\n\t/* not found */\n\treturn HANDLER_GO_ON;\n}","lang":"c","vul_type":"cwe-022","target_token_count":513,"sven_meta":{"func_name":"PHYSICALPATH_FUNC","file_name":"src/mod_alias.c","commit_link":"github.com/lighttpd/lighttpd1.4/commit/2105dae0f9d7a964375ce681e53cb165375f84c1","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#16-e17ea3436592","input":" def handle(self, keepalive=True, initial_timeout=None):\n # we are requested to skip processing and keep the previous values\n if self.skip:\n return self.response.handle()\n\n # default to no keepalive in case something happens while even trying ensure we have a request\n self.keepalive = False\n\n self.headers = HTTPHeaders()\n\n # if initial_timeout is set, only wait that long for the initial request line\n if initial_timeout:\n self.connection.settimeout(initial_timeout)\n else:\n self.connection.settimeout(self.timeout)\n\n # get request line\n try:\n # ignore empty lines waiting on request\n request = '\\r\\n'\n while request == '\\r\\n':\n request = self.rfile.readline(max_line_size + 1).decode(http_encoding)\n # if read hits timeout or has some other error, ignore the request\n except Exception:\n return True\n\n # ignore empty requests\n if not request:\n return True\n\n # we have a request, go back to normal timeout\n if initial_timeout:\n self.connection.settimeout(self.timeout)\n\n # remove \\r\\n from the end\n self.request_line = request[:-2]\n\n # set some reasonable defaults in case the worst happens and we need to tell the client\n self.method = ''\n self.resource = '/'\n\n try:\n # HTTP Status 414\n if len(request) > max_line_size:\n raise HTTPError(414)\n\n # HTTP Status 400\n if request[-2:] != '\\r\\n':\n raise HTTPError(400)\n\n # try the request line and error out if can't parse it\n try:\n self.method, self.resource, self.request_http = self.request_line.split()\n # HTTP Status 400\n except ValueError:\n raise HTTPError(400)\n\n # HTTP Status 505\n if self.request_http != http_version:\n raise HTTPError(505)\n\n # read and parse request headers\n while True:\n line = self.rfile.readline(max_line_size + 1).decode(http_encoding)\n\n # hit end of headers\n if line == '\\r\\n':\n break\n\n self.headers.add(line)\n\n # if we are requested to close the connection after we finish, do so\n if self.headers.get('Connection') == 'close':\n self.keepalive = False\n # else since we are sure we have a request and have read all of the request data, keepalive for more later (if allowed)\n else:\n self.keepalive = keepalive\n\n # find a matching regex to handle the request with\n for regex, handler in self.server.routes.items():\n match = regex.match(self.resource)\n if match:\n # create a dictionary of groups\n groups = match.groupdict()\n values = groups.values()\n\n for idx, group in enumerate(match.groups()):\n if group not in values:\n groups[idx] = group\n\n # create handler\n self.handler = handler(self, self.response, groups)\n break\n # HTTP Status 404\n # if loop is not broken (handler is not found), raise a 404\n else:\n raise HTTPError(404)\n # use DummyHandler so the error is raised again when ready for response\n except Exception as error:\n self.handler = DummyHandler(self, self.response, (), error)\n finally:\n # we finished listening and handling early errors and so let a response class now finish up the job of talking\n return self.response.handle()","target":" def handle(self, keepalive=True, initial_timeout=None):\n # we are requested to skip processing and keep the previous values\n if self.skip:\n return self.response.handle()\n\n # default to no keepalive in case something happens while even trying ensure we have a request\n self.keepalive = False\n\n self.headers = HTTPHeaders()\n\n # if initial_timeout is set, only wait that long for the initial request line\n if initial_timeout:\n self.connection.settimeout(initial_timeout)\n else:\n self.connection.settimeout(self.timeout)\n\n # get request line\n try:\n # ignore empty lines waiting on request\n request = '\\r\\n'\n while request == '\\r\\n':\n request = self.rfile.readline(max_line_size + 1).decode(http_encoding)\n # if read hits timeout or has some other error, ignore the request\n except Exception:\n return True\n\n # ignore empty requests\n if not request:\n return True\n\n # we have a request, go back to normal timeout\n if initial_timeout:\n self.connection.settimeout(self.timeout)\n\n # remove \\r\\n from the end\n self.request_line = request[:-2]\n\n # set some reasonable defaults in case the worst happens and we need to tell the client\n self.method = ''\n self.resource = '/'\n\n try:\n # HTTP Status 414\n if len(request) > max_line_size:\n raise HTTPError(414)\n\n # HTTP Status 400\n if request[-2:] != '\\r\\n':\n raise HTTPError(400)\n\n # try the request line and error out if can't parse it\n try:\n self.method, resource, self.request_http = self.request_line.split()\n self.resource = urllib.parse.unquote(resource)\n # HTTP Status 400\n except ValueError:\n raise HTTPError(400)\n\n # HTTP Status 505\n if self.request_http != http_version:\n raise HTTPError(505)\n\n # read and parse request headers\n while True:\n line = self.rfile.readline(max_line_size + 1).decode(http_encoding)\n\n # hit end of headers\n if line == '\\r\\n':\n break\n\n self.headers.add(line)\n\n # if we are requested to close the connection after we finish, do so\n if self.headers.get('Connection') == 'close':\n self.keepalive = False\n # else since we are sure we have a request and have read all of the request data, keepalive for more later (if allowed)\n else:\n self.keepalive = keepalive\n\n # find a matching regex to handle the request with\n for regex, handler in self.server.routes.items():\n match = regex.match(self.resource)\n if match:\n # create a dictionary of groups\n groups = match.groupdict()\n values = groups.values()\n\n for idx, group in enumerate(match.groups()):\n if group not in values:\n groups[idx] = group\n\n # create handler\n self.handler = handler(self, self.response, groups)\n break\n # HTTP Status 404\n # if loop is not broken (handler is not found), raise a 404\n else:\n raise HTTPError(404)\n # use DummyHandler so the error is raised again when ready for response\n except Exception as error:\n self.handler = DummyHandler(self, self.response, (), error)\n finally:\n # we finished listening and handling early errors and so let a response class now finish up the job of talking\n return self.response.handle()","lang":"python","vul_type":"cwe-022","target_token_count":770,"sven_meta":{"func_name":"handle","file_name":"fooster/web/web.py","commit_link":"github.com/fkmclane/python-fooster-web/commit/80202a6d3788ad1212a162d19785c600025e6aa4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#18-341b4fb32824","input":"\tdef render(self, request):\n\t\taction = \"download\"\n\t\tif \"action\" in request.args:\n\t\t\taction = request.args[\"action\"][0]\n\n\t\tif \"file\" in request.args:\n\t\t\tfilename = request.args[\"file\"][0].decode('utf-8', 'ignore').encode('utf-8')\n\t\t\tfilename = re.sub(\"^/+\", \"/\", os.path.realpath(filename))\n\n\t\t\tif not os.path.exists(filename):\n\t\t\t\treturn \"File '%s' not found\" % (filename)\n\n\t\t\tif action == \"stream\":\n\t\t\t\tname = \"stream\"\n\t\t\t\tif \"name\" in request.args:\n\t\t\t\t\tname = request.args[\"name\"][0]\n\n\t\t\t\tport = config.OpenWebif.port.value\n\t\t\t\tproto = 'http'\n\t\t\t\tif request.isSecure():\n\t\t\t\t\tport = config.OpenWebif.https_port.value\n\t\t\t\t\tproto = 'https'\n\t\t\t\tourhost = request.getHeader('host')\n\t\t\t\tm = re.match('.+\\:(\\d+)$', ourhost)\n\t\t\t\tif m is not None:\n\t\t\t\t\tport = m.group(1)\n\n\t\t\t\tresponse = \"#EXTM3U\\n#EXTVLCOPT--http-reconnect=true\\n#EXTINF:-1,%s\\n%s://%s:%s/file?action=download&file=%s\" % (name, proto, request.getRequestHostname(), port, quote(filename))\n\t\t\t\trequest.setHeader(\"Content-Disposition\", 'attachment;filename=\"%s.m3u\"' % name)\n\t\t\t\trequest.setHeader(\"Content-Type\", \"application/x-mpegurl\")\n\t\t\t\treturn response\n\t\t\telif action == \"delete\":\n\t\t\t\trequest.setResponseCode(http.OK)\n\t\t\t\treturn \"TODO: DELETE FILE: %s\" % (filename)\n\t\t\telif action == \"download\":\n\t\t\t\trequest.setHeader(\"Content-Disposition\", \"attachment;filename=\\\"%s\\\"\" % (filename.split('/')[-1]))\n\t\t\t\trfile = static.File(filename, defaultType = \"application/octet-stream\")\n\t\t\t\treturn rfile.render(request)\n\t\t\telse: \n\t\t\t\treturn \"wrong action parameter\"\n\n\t\tif \"dir\" in request.args:\n\t\t\tpath = request.args[\"dir\"][0]\n\t\t\tpattern = '*'\n\t\t\tdata = []\n\t\t\tif \"pattern\" in request.args:\n\t\t\t\tpattern = request.args[\"pattern\"][0]\n\t\t\tdirectories = []\n\t\t\tfiles = []\n\t\t\tif fileExists(path):\n\t\t\t\ttry:\n\t\t\t\t\tfiles = glob.glob(path+'/'+pattern)\n\t\t\t\texcept:\n\t\t\t\t\tfiles = []\n\t\t\t\tfiles.sort()\n\t\t\t\ttmpfiles = files[:]\n\t\t\t\tfor x in tmpfiles:\n\t\t\t\t\tif os.path.isdir(x):\n\t\t\t\t\t\tdirectories.append(x + '/')\n\t\t\t\t\t\tfiles.remove(x)\n\t\t\t\tdata.append({\"result\": True,\"dirs\": directories,\"files\": files})\n\t\t\telse:\n\t\t\t\tdata.append({\"result\": False,\"message\": \"path %s not exits\" % (path)})\n\t\t\trequest.setHeader(\"content-type\", \"application/json; charset=utf-8\")\n\t\t\treturn json.dumps(data, indent=2)","target":"\tdef render(self, request):\n\t\taction = \"download\"\n\t\tif \"action\" in request.args:\n\t\t\taction = request.args[\"action\"][0]\n\n\t\tif \"file\" in request.args:\n\t\t\tfilename = lenient_force_utf_8(request.args[\"file\"][0])\n\t\t\tfilename = sanitise_filename_slashes(os.path.realpath(filename))\n\n\t\t\tif not os.path.exists(filename):\n\t\t\t\treturn \"File '%s' not found\" % (filename)\n\n\t\t\tif action == \"stream\":\n\t\t\t\tname = \"stream\"\n\t\t\t\tif \"name\" in request.args:\n\t\t\t\t\tname = request.args[\"name\"][0]\n\n\t\t\t\tport = config.OpenWebif.port.value\n\t\t\t\tproto = 'http'\n\t\t\t\tif request.isSecure():\n\t\t\t\t\tport = config.OpenWebif.https_port.value\n\t\t\t\t\tproto = 'https'\n\t\t\t\tourhost = request.getHeader('host')\n\t\t\t\tm = re.match('.+\\:(\\d+)$', ourhost)\n\t\t\t\tif m is not None:\n\t\t\t\t\tport = m.group(1)\n\n\t\t\t\tresponse = \"#EXTM3U\\n#EXTVLCOPT--http-reconnect=true\\n#EXTINF:-1,%s\\n%s://%s:%s/file?action=download&file=%s\" % (name, proto, request.getRequestHostname(), port, quote(filename))\n\t\t\t\trequest.setHeader(\"Content-Disposition\", 'attachment;filename=\"%s.m3u\"' % name)\n\t\t\t\trequest.setHeader(\"Content-Type\", \"application/x-mpegurl\")\n\t\t\t\treturn response\n\t\t\telif action == \"delete\":\n\t\t\t\trequest.setResponseCode(http.OK)\n\t\t\t\treturn \"TODO: DELETE FILE: %s\" % (filename)\n\t\t\telif action == \"download\":\n\t\t\t\trequest.setHeader(\"Content-Disposition\", \"attachment;filename=\\\"%s\\\"\" % (filename.split('/')[-1]))\n\t\t\t\trfile = static.File(filename, defaultType = \"application/octet-stream\")\n\t\t\t\treturn rfile.render(request)\n\t\t\telse: \n\t\t\t\treturn \"wrong action parameter\"\n\n\t\tif \"dir\" in request.args:\n\t\t\tpath = request.args[\"dir\"][0]\n\t\t\tpattern = '*'\n\t\t\tdata = []\n\t\t\tif \"pattern\" in request.args:\n\t\t\t\tpattern = request.args[\"pattern\"][0]\n\t\t\tdirectories = []\n\t\t\tfiles = []\n\t\t\tif fileExists(path):\n\t\t\t\ttry:\n\t\t\t\t\tfiles = glob.glob(path+'/'+pattern)\n\t\t\t\texcept:\n\t\t\t\t\tfiles = []\n\t\t\t\tfiles.sort()\n\t\t\t\ttmpfiles = files[:]\n\t\t\t\tfor x in tmpfiles:\n\t\t\t\t\tif os.path.isdir(x):\n\t\t\t\t\t\tdirectories.append(x + '/')\n\t\t\t\t\t\tfiles.remove(x)\n\t\t\t\tdata.append({\"result\": True,\"dirs\": directories,\"files\": files})\n\t\t\telse:\n\t\t\t\tdata.append({\"result\": False,\"message\": \"path %s not exits\" % (path)})\n\t\t\trequest.setHeader(\"content-type\", \"application/json; charset=utf-8\")\n\t\t\treturn json.dumps(data, indent=2)","lang":"python","vul_type":"cwe-022","target_token_count":580,"sven_meta":{"func_name":"render","file_name":"plugin/controllers/file.py","commit_link":"github.com/E2OpenPlugins/e2openplugin-OpenWebif/commit/a846b7664eda3a4c51a452e00638cf7337dc2013","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#24-d81ce033326b","input":" def misc_file_checks(self):\n\n print_header(\"MISC FILE CHECKS\")\n\n #\n # Check for recommended and mandatory files\n #\n\n filenames = (\"manifest.json\", \"LICENSE\", \"README.md\",\n \"scripts/install\", \"scripts/remove\",\n \"scripts/upgrade\",\n \"scripts/backup\", \"scripts/restore\")\n non_mandatory = (\"script/backup\", \"script/restore\")\n\n for filename in filenames:\n if file_exists(self.path + \"/\" + filename):\n continue\n elif filename in non_mandatory:\n print_warning(\"Consider adding a file %s\" % filename)\n else:\n print_error(\"File %s is mandatory\" % filename)\n\n #\n # Deprecated php-fpm.ini thing\n #\n\n if file_exists(self.path + \"/conf/php-fpm.ini\"):\n print_warning(\n \"Using a separate php-fpm.ini file is deprecated. \"\n \"Please merge your php-fpm directives directly in the pool file. \"\n \"(c.f. https://github.com/YunoHost-Apps/nextcloud_ynh/issues/138 )\"\n )\n\n #\n # Deprecated usage of 'add_header' in nginx conf\n #\n\n for filename in os.listdir(self.path + \"/conf\"):\n if not os.path.isfile(self.path + \"/conf/\" + filename):\n continue\n content = open(self.path + \"/conf/\" + filename).read()\n if \"location\" in content and \"add_header\" in content:\n print_warning(\n \"Do not use 'add_header' in the nginx conf. Use 'more_set_headers' instead. \"\n \"(See https://www.peterbe.com/plog/be-very-careful-with-your-add_header-in-nginx \"\n \"and https://github.com/openresty/headers-more-nginx-module#more_set_headers )\"\n )","target":" def misc_file_checks(self):\n\n print_header(\"MISC FILE CHECKS\")\n\n #\n # Check for recommended and mandatory files\n #\n\n filenames = (\"manifest.json\", \"LICENSE\", \"README.md\",\n \"scripts/install\", \"scripts/remove\",\n \"scripts/upgrade\",\n \"scripts/backup\", \"scripts/restore\")\n non_mandatory = (\"script/backup\", \"script/restore\")\n\n for filename in filenames:\n if file_exists(self.path + \"/\" + filename):\n continue\n elif filename in non_mandatory:\n print_warning(\"Consider adding a file %s\" % filename)\n else:\n print_error(\"File %s is mandatory\" % filename)\n\n #\n # Deprecated php-fpm.ini thing\n #\n\n if file_exists(self.path + \"/conf/php-fpm.ini\"):\n print_warning(\n \"Using a separate php-fpm.ini file is deprecated. \"\n \"Please merge your php-fpm directives directly in the pool file. \"\n \"(c.f. https://github.com/YunoHost-Apps/nextcloud_ynh/issues/138 )\"\n )\n\n #\n # Analyze nginx conf\n # - Deprecated usage of 'add_header' in nginx conf\n # - Spot path traversal issue vulnerability\n #\n\n for filename in os.listdir(self.path + \"/conf\"):\n # Ignore subdirs or filename not containing nginx in the name\n if not os.path.isfile(self.path + \"/conf/\" + filename) or \"nginx\" not in filename:\n continue\n\n #\n # 'add_header' usage\n #\n content = open(self.path + \"/conf/\" + filename).read()\n if \"location\" in content and \"add_header\" in content:\n print_warning(\n \"Do not use 'add_header' in the nginx conf. Use 'more_set_headers' instead. \"\n \"(See https://www.peterbe.com/plog/be-very-careful-with-your-add_header-in-nginx \"\n \"and https://github.com/openresty/headers-more-nginx-module#more_set_headers )\"\n )\n\n #\n # Path traversal issues\n #\n lines = open(self.path + \"/conf/\" + filename).readlines()\n lines = [line.strip() for line in lines if not line.strip().startswith(\"#\")]\n # Let's find the first location line\n location_line = None\n path_traversal_vulnerable = False\n lines_iter = lines.__iter__()\n for line in lines_iter:\n if line.startswith(\"location\"):\n location_line = line\n break\n # Look at the next lines for an 'alias' directive\n if location_line is not None:\n for line in lines_iter:\n if line.startswith(\"location\"):\n # Entering a new location block ... abort here\n # and assume there's no alias block later...\n break\n if line.startswith(\"alias\"):\n # We should definitely check for path traversal issue\n # Does the location target ends with / ?\n target = location_line.split()[-2]\n if not target.endswith(\"/\"):\n path_traversal_vulnerable = True\n break\n if path_traversal_vulnerable:\n print_warning(\n \"The nginx configuration appears vulnerable to path traversal as explained in \"\n \"https://www.acunetix.com/vulnerabilities/web/path-traversal-via-misconfigured-nginx-alias/\\n\"\n \"To fix it, look at the first lines of the nginx conf of the example app : \"\n \"https://github.com/YunoHost/example_ynh/blob/master/conf/nginx.conf\"\n )","lang":"python","vul_type":"cwe-022","target_token_count":754,"sven_meta":{"func_name":"misc_file_checks","file_name":"package_linter.py","commit_link":"github.com/YunoHost/package_linter/commit/f6e98894cfe841aedaa7efd590937f0255193913","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#27-665b62e9178c","input":"cleanup_pathname(struct archive_write_disk *a)\n{\n\tchar *dest, *src;\n\tchar separator = '\\0';\n\n\tdest = src = a->name;\n\tif (*src == '\\0') {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Invalid empty pathname\");\n\t\treturn (ARCHIVE_FAILED);\n\t}\n\n#if defined(__CYGWIN__)\n\tcleanup_pathname_win(a);\n#endif\n\t/* Skip leading '/'. */\n\tif (*src == '/')\n\t\tseparator = *src++;\n\n\t/* Scan the pathname one element at a time. */\n\tfor (;;) {\n\t\t/* src points to first char after '/' */\n\t\tif (src[0] == '\\0') {\n\t\t\tbreak;\n\t\t} else if (src[0] == '/') {\n\t\t\t/* Found '//', ignore second one. */\n\t\t\tsrc++;\n\t\t\tcontinue;\n\t\t} else if (src[0] == '.') {\n\t\t\tif (src[1] == '\\0') {\n\t\t\t\t/* Ignore trailing '.' */\n\t\t\t\tbreak;\n\t\t\t} else if (src[1] == '/') {\n\t\t\t\t/* Skip './'. */\n\t\t\t\tsrc += 2;\n\t\t\t\tcontinue;\n\t\t\t} else if (src[1] == '.') {\n\t\t\t\tif (src[2] == '/' || src[2] == '\\0') {\n\t\t\t\t\t/* Conditionally warn about '..' */\n\t\t\t\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {\n\t\t\t\t\t\tarchive_set_error(&a->archive,\n\t\t\t\t\t\t ARCHIVE_ERRNO_MISC,\n\t\t\t\t\t\t \"Path contains '..'\");\n\t\t\t\t\t\treturn (ARCHIVE_FAILED);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Note: Under no circumstances do we\n\t\t\t\t * remove '..' elements. In\n\t\t\t\t * particular, restoring\n\t\t\t\t * '/foo/../bar/' should create the\n\t\t\t\t * 'foo' dir as a side-effect.\n\t\t\t\t */\n\t\t\t}\n\t\t}\n\n\t\t/* Copy current element, including leading '/'. */\n\t\tif (separator)\n\t\t\t*dest++ = '/';\n\t\twhile (*src != '\\0' && *src != '/') {\n\t\t\t*dest++ = *src++;\n\t\t}\n\n\t\tif (*src == '\\0')\n\t\t\tbreak;\n\n\t\t/* Skip '/' separator. */\n\t\tseparator = *src++;\n\t}\n\t/*\n\t * We've just copied zero or more path elements, not including the\n\t * final '/'.\n\t */\n\tif (dest == a->name) {\n\t\t/*\n\t\t * Nothing got copied. The path must have been something\n\t\t * like '.' or '/' or './' or '/././././/./'.\n\t\t */\n\t\tif (separator)\n\t\t\t*dest++ = '/';\n\t\telse\n\t\t\t*dest++ = '.';\n\t}\n\t/* Terminate the result. */\n\t*dest = '\\0';\n\treturn (ARCHIVE_OK);\n}","target":"cleanup_pathname(struct archive_write_disk *a)\n{\n\tchar *dest, *src;\n\tchar separator = '\\0';\n\n\tdest = src = a->name;\n\tif (*src == '\\0') {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Invalid empty pathname\");\n\t\treturn (ARCHIVE_FAILED);\n\t}\n\n#if defined(__CYGWIN__)\n\tcleanup_pathname_win(a);\n#endif\n\t/* Skip leading '/'. */\n\tif (*src == '/') {\n\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {\n\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t\t \"Path is absolute\");\n\t\t\treturn (ARCHIVE_FAILED);\n\t\t}\n\n\t\tseparator = *src++;\n\t}\n\n\t/* Scan the pathname one element at a time. */\n\tfor (;;) {\n\t\t/* src points to first char after '/' */\n\t\tif (src[0] == '\\0') {\n\t\t\tbreak;\n\t\t} else if (src[0] == '/') {\n\t\t\t/* Found '//', ignore second one. */\n\t\t\tsrc++;\n\t\t\tcontinue;\n\t\t} else if (src[0] == '.') {\n\t\t\tif (src[1] == '\\0') {\n\t\t\t\t/* Ignore trailing '.' */\n\t\t\t\tbreak;\n\t\t\t} else if (src[1] == '/') {\n\t\t\t\t/* Skip './'. */\n\t\t\t\tsrc += 2;\n\t\t\t\tcontinue;\n\t\t\t} else if (src[1] == '.') {\n\t\t\t\tif (src[2] == '/' || src[2] == '\\0') {\n\t\t\t\t\t/* Conditionally warn about '..' */\n\t\t\t\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {\n\t\t\t\t\t\tarchive_set_error(&a->archive,\n\t\t\t\t\t\t ARCHIVE_ERRNO_MISC,\n\t\t\t\t\t\t \"Path contains '..'\");\n\t\t\t\t\t\treturn (ARCHIVE_FAILED);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Note: Under no circumstances do we\n\t\t\t\t * remove '..' elements. In\n\t\t\t\t * particular, restoring\n\t\t\t\t * '/foo/../bar/' should create the\n\t\t\t\t * 'foo' dir as a side-effect.\n\t\t\t\t */\n\t\t\t}\n\t\t}\n\n\t\t/* Copy current element, including leading '/'. */\n\t\tif (separator)\n\t\t\t*dest++ = '/';\n\t\twhile (*src != '\\0' && *src != '/') {\n\t\t\t*dest++ = *src++;\n\t\t}\n\n\t\tif (*src == '\\0')\n\t\t\tbreak;\n\n\t\t/* Skip '/' separator. */\n\t\tseparator = *src++;\n\t}\n\t/*\n\t * We've just copied zero or more path elements, not including the\n\t * final '/'.\n\t */\n\tif (dest == a->name) {\n\t\t/*\n\t\t * Nothing got copied. The path must have been something\n\t\t * like '.' or '/' or './' or '/././././/./'.\n\t\t */\n\t\tif (separator)\n\t\t\t*dest++ = '/';\n\t\telse\n\t\t\t*dest++ = '.';\n\t}\n\t/* Terminate the result. */\n\t*dest = '\\0';\n\treturn (ARCHIVE_OK);\n}","lang":"c","vul_type":"cwe-022","target_token_count":648,"sven_meta":{"func_name":"cleanup_pathname","file_name":"libarchive/archive_write_disk_posix.c","commit_link":"github.com/libarchive/libarchive/commit/59357157706d47c365b2227739e17daba3607526","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#28-21c0ac75823c","input":"struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)\n{\n INITIALIZE_LIBREPORT();\n\n char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER);\n\n if (!type)\n {\n error_msg(_(\"Missing required item: '%s'\"), FILENAME_ANALYZER);\n return NULL;\n }\n\n uid_t uid = (uid_t)-1L;\n char *uid_str = problem_data_get_content_or_NULL(problem_data, FILENAME_UID);\n\n if (uid_str)\n {\n char *endptr;\n errno = 0;\n long val = strtol(uid_str, &endptr, 10);\n\n if (errno != 0 || endptr == uid_str || *endptr != '\\0' || INT_MAX < val)\n {\n error_msg(_(\"uid value is not valid: '%s'\"), uid_str);\n return NULL;\n }\n\n uid = (uid_t)val;\n }\n\n struct timeval tv;\n if (gettimeofday(&tv, NULL) < 0)\n {\n perror_msg(\"gettimeofday()\");\n return NULL;\n }\n\n char *problem_id = xasprintf(\"%s-%s.%ld-%lu\"NEW_PD_SUFFIX, type, iso_date_string(&(tv.tv_sec)), (long)tv.tv_usec, (long)getpid());\n\n log_info(\"Saving to %s/%s with uid %d\", base_dir_name, problem_id, uid);\n\n struct dump_dir *dd;\n if (base_dir_name)\n dd = try_dd_create(base_dir_name, problem_id, uid);\n else\n {\n /* Try /var/run/abrt */\n dd = try_dd_create(LOCALSTATEDIR\"/run/abrt\", problem_id, uid);\n /* Try $HOME/tmp */\n if (!dd)\n {\n char *home = getenv(\"HOME\");\n if (home && home[0])\n {\n home = concat_path_file(home, \"tmp\");\n /*mkdir(home, 0777); - do we want this? */\n dd = try_dd_create(home, problem_id, uid);\n free(home);\n }\n }\n//TODO: try user's home dir obtained by getpwuid(getuid())?\n /* Try system temporary directory */\n if (!dd)\n dd = try_dd_create(LARGE_DATA_TMP_DIR, problem_id, uid);\n }\n\n if (!dd) /* try_dd_create() already emitted the error message */\n goto ret;\n\n GHashTableIter iter;\n char *name;\n struct problem_item *value;\n g_hash_table_iter_init(&iter, problem_data);\n while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value))\n {\n if (value->flags & CD_FLAG_BIN)\n {\n char *dest = concat_path_file(dd->dd_dirname, name);\n log_info(\"copying '%s' to '%s'\", value->content, dest);\n off_t copied = copy_file(value->content, dest, DEFAULT_DUMP_DIR_MODE | S_IROTH);\n if (copied < 0)\n error_msg(\"Can't copy %s to %s\", value->content, dest);\n else\n log_info(\"copied %li bytes\", (unsigned long)copied);\n free(dest);\n\n continue;\n }\n\n /* only files should contain '/' and those are handled earlier */\n if (name[0] == '.' || strchr(name, '/'))\n {\n error_msg(\"Problem data field name contains disallowed chars: '%s'\", name);\n continue;\n }\n\n dd_save_text(dd, name, value->content);\n }\n\n /* need to create basic files AFTER we save the pd to dump_dir\n * otherwise we can't skip already created files like in case when\n * reporting from anaconda where we can't read /etc/{system,redhat}-release\n * and os_release is taken from anaconda\n */\n dd_create_basic_files(dd, uid, NULL);\n\n problem_id[strlen(problem_id) - strlen(NEW_PD_SUFFIX)] = '\\0';\n char* new_path = concat_path_file(base_dir_name, problem_id);\n log_info(\"Renaming from '%s' to '%s'\", dd->dd_dirname, new_path);\n dd_rename(dd, new_path);\n\n ret:\n free(problem_id);\n return dd;\n}","target":"struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)\n{\n INITIALIZE_LIBREPORT();\n\n char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER);\n\n if (!type)\n {\n error_msg(_(\"Missing required item: '%s'\"), FILENAME_ANALYZER);\n return NULL;\n }\n\n if (!str_is_correct_filename(type))\n {\n error_msg(_(\"'%s' is not correct file name\"), FILENAME_ANALYZER);\n return NULL;\n }\n\n uid_t uid = (uid_t)-1L;\n char *uid_str = problem_data_get_content_or_NULL(problem_data, FILENAME_UID);\n\n if (uid_str)\n {\n char *endptr;\n errno = 0;\n long val = strtol(uid_str, &endptr, 10);\n\n if (errno != 0 || endptr == uid_str || *endptr != '\\0' || INT_MAX < val)\n {\n error_msg(_(\"uid value is not valid: '%s'\"), uid_str);\n return NULL;\n }\n\n uid = (uid_t)val;\n }\n\n struct timeval tv;\n if (gettimeofday(&tv, NULL) < 0)\n {\n perror_msg(\"gettimeofday()\");\n return NULL;\n }\n\n char *problem_id = xasprintf(\"%s-%s.%ld-%lu\"NEW_PD_SUFFIX, type, iso_date_string(&(tv.tv_sec)), (long)tv.tv_usec, (long)getpid());\n\n log_info(\"Saving to %s/%s with uid %d\", base_dir_name, problem_id, uid);\n\n struct dump_dir *dd;\n if (base_dir_name)\n dd = try_dd_create(base_dir_name, problem_id, uid);\n else\n {\n /* Try /var/run/abrt */\n dd = try_dd_create(LOCALSTATEDIR\"/run/abrt\", problem_id, uid);\n /* Try $HOME/tmp */\n if (!dd)\n {\n char *home = getenv(\"HOME\");\n if (home && home[0])\n {\n home = concat_path_file(home, \"tmp\");\n /*mkdir(home, 0777); - do we want this? */\n dd = try_dd_create(home, problem_id, uid);\n free(home);\n }\n }\n//TODO: try user's home dir obtained by getpwuid(getuid())?\n /* Try system temporary directory */\n if (!dd)\n dd = try_dd_create(LARGE_DATA_TMP_DIR, problem_id, uid);\n }\n\n if (!dd) /* try_dd_create() already emitted the error message */\n goto ret;\n\n GHashTableIter iter;\n char *name;\n struct problem_item *value;\n g_hash_table_iter_init(&iter, problem_data);\n while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value))\n {\n if (!str_is_correct_filename(name))\n {\n error_msg(\"Problem data field name contains disallowed chars: '%s'\", name);\n continue;\n }\n\n if (value->flags & CD_FLAG_BIN)\n {\n char *dest = concat_path_file(dd->dd_dirname, name);\n log_info(\"copying '%s' to '%s'\", value->content, dest);\n off_t copied = copy_file(value->content, dest, DEFAULT_DUMP_DIR_MODE | S_IROTH);\n if (copied < 0)\n error_msg(\"Can't copy %s to %s\", value->content, dest);\n else\n log_info(\"copied %li bytes\", (unsigned long)copied);\n free(dest);\n\n continue;\n }\n\n dd_save_text(dd, name, value->content);\n }\n\n /* need to create basic files AFTER we save the pd to dump_dir\n * otherwise we can't skip already created files like in case when\n * reporting from anaconda where we can't read /etc/{system,redhat}-release\n * and os_release is taken from anaconda\n */\n dd_create_basic_files(dd, uid, NULL);\n\n problem_id[strlen(problem_id) - strlen(NEW_PD_SUFFIX)] = '\\0';\n char* new_path = concat_path_file(base_dir_name, problem_id);\n log_info(\"Renaming from '%s' to '%s'\", dd->dd_dirname, new_path);\n dd_rename(dd, new_path);\n\n ret:\n free(problem_id);\n return dd;\n}","lang":"c","vul_type":"cwe-022","target_token_count":950,"sven_meta":{"func_name":"create_dump_dir_from_problem_data","file_name":"src/lib/create_dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#30-323dff97d0b5","input":"local void process(char *path)\n{\n int method = -1; /* get_header() return value */\n size_t len; /* length of base name (minus suffix) */\n struct stat st; /* to get file type and mod time */\n /* all compressed suffixes for decoding search, in length order */\n static char *sufs[] = {\".z\", \"-z\", \"_z\", \".Z\", \".gz\", \"-gz\", \".zz\", \"-zz\",\n \".zip\", \".ZIP\", \".tgz\", NULL};\n\n /* open input file with name in, descriptor ind -- set name and mtime */\n if (path == NULL) {\n strcpy(g.inf, \"\");\n g.ind = 0;\n g.name = NULL;\n g.mtime = g.headis & 2 ?\n (fstat(g.ind, &st) ? time(NULL) : st.st_mtime) : 0;\n len = 0;\n }\n else {\n /* set input file name (already set if recursed here) */\n if (path != g.inf) {\n strncpy(g.inf, path, sizeof(g.inf));\n if (g.inf[sizeof(g.inf) - 1])\n bail(\"name too long: \", path);\n }\n len = strlen(g.inf);\n\n /* try to stat input file -- if not there and decoding, look for that\n name with compressed suffixes */\n if (lstat(g.inf, &st)) {\n if (errno == ENOENT && (g.list || g.decode)) {\n char **try = sufs;\n do {\n if (*try == NULL || len + strlen(*try) >= sizeof(g.inf))\n break;\n strcpy(g.inf + len, *try++);\n errno = 0;\n } while (lstat(g.inf, &st) && errno == ENOENT);\n }\n#ifdef EOVERFLOW\n if (errno == EOVERFLOW || errno == EFBIG)\n bail(g.inf,\n \" too large -- not compiled with large file support\");\n#endif\n if (errno) {\n g.inf[len] = 0;\n complain(\"%s does not exist -- skipping\", g.inf);\n return;\n }\n len = strlen(g.inf);\n }\n\n /* only process regular files, but allow symbolic links if -f,\n recurse into directory if -r */\n if ((st.st_mode & S_IFMT) != S_IFREG &&\n (st.st_mode & S_IFMT) != S_IFLNK &&\n (st.st_mode & S_IFMT) != S_IFDIR) {\n complain(\"%s is a special file or device -- skipping\", g.inf);\n return;\n }\n if ((st.st_mode & S_IFMT) == S_IFLNK && !g.force && !g.pipeout) {\n complain(\"%s is a symbolic link -- skipping\", g.inf);\n return;\n }\n if ((st.st_mode & S_IFMT) == S_IFDIR && !g.recurse) {\n complain(\"%s is a directory -- skipping\", g.inf);\n return;\n }\n\n /* recurse into directory (assumes Unix) */\n if ((st.st_mode & S_IFMT) == S_IFDIR) {\n char *roll, *item, *cut, *base, *bigger;\n size_t len, hold;\n DIR *here;\n struct dirent *next;\n\n /* accumulate list of entries (need to do this, since readdir()\n behavior not defined if directory modified between calls) */\n here = opendir(g.inf);\n if (here == NULL)\n return;\n hold = 512;\n roll = MALLOC(hold);\n if (roll == NULL)\n bail(\"not enough memory\", \"\");\n *roll = 0;\n item = roll;\n while ((next = readdir(here)) != NULL) {\n if (next->d_name[0] == 0 ||\n (next->d_name[0] == '.' && (next->d_name[1] == 0 ||\n (next->d_name[1] == '.' && next->d_name[2] == 0))))\n continue;\n len = strlen(next->d_name) + 1;\n if (item + len + 1 > roll + hold) {\n do { /* make roll bigger */\n hold <<= 1;\n } while (item + len + 1 > roll + hold);\n bigger = REALLOC(roll, hold);\n if (bigger == NULL) {\n FREE(roll);\n bail(\"not enough memory\", \"\");\n }\n item = bigger + (item - roll);\n roll = bigger;\n }\n strcpy(item, next->d_name);\n item += len;\n *item = 0;\n }\n closedir(here);\n\n /* run process() for each entry in the directory */\n cut = base = g.inf + strlen(g.inf);\n if (base > g.inf && base[-1] != (unsigned char)'/') {\n if ((size_t)(base - g.inf) >= sizeof(g.inf))\n bail(\"path too long\", g.inf);\n *base++ = '/';\n }\n item = roll;\n while (*item) {\n strncpy(base, item, sizeof(g.inf) - (base - g.inf));\n if (g.inf[sizeof(g.inf) - 1]) {\n strcpy(g.inf + (sizeof(g.inf) - 4), \"...\");\n bail(\"path too long: \", g.inf);\n }\n process(g.inf);\n item += strlen(item) + 1;\n }\n *cut = 0;\n\n /* release list of entries */\n FREE(roll);\n return;\n }\n\n /* don't compress .gz (or provided suffix) files, unless -f */\n if (!(g.force || g.list || g.decode) && len >= strlen(g.sufx) &&\n strcmp(g.inf + len - strlen(g.sufx), g.sufx) == 0) {\n complain(\"%s ends with %s -- skipping\", g.inf, g.sufx);\n return;\n }\n\n /* create output file only if input file has compressed suffix */\n if (g.decode == 1 && !g.pipeout && !g.list) {\n int suf = compressed_suffix(g.inf);\n if (suf == 0) {\n complain(\"%s does not have compressed suffix -- skipping\",\n g.inf);\n return;\n }\n len -= suf;\n }\n\n /* open input file */\n g.ind = open(g.inf, O_RDONLY, 0);\n if (g.ind < 0)\n bail(\"read error on \", g.inf);\n\n /* prepare gzip header information for compression */\n g.name = g.headis & 1 ? justname(g.inf) : NULL;\n g.mtime = g.headis & 2 ? st.st_mtime : 0;\n }\n SET_BINARY_MODE(g.ind);\n\n /* if decoding or testing, try to read gzip header */\n g.hname = NULL;\n if (g.decode) {\n in_init();\n method = get_header(1);\n if (method != 8 && method != 257 &&\n /* gzip -cdf acts like cat on uncompressed input */\n !(method == -2 && g.force && g.pipeout && g.decode != 2 &&\n !g.list)) {\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n if (method != -1)\n complain(method < 0 ? \"%s is not compressed -- skipping\" :\n \"%s has unknown compression method -- skipping\",\n g.inf);\n return;\n }\n\n /* if requested, test input file (possibly a special list) */\n if (g.decode == 2) {\n if (method == 8)\n infchk();\n else {\n unlzw();\n if (g.list) {\n g.in_tot -= 3;\n show_info(method, 0, g.out_tot, 0);\n }\n }\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n }\n\n /* if requested, just list information about input file */\n if (g.list) {\n list_info();\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n\n /* create output file out, descriptor outd */\n if (path == NULL || g.pipeout) {\n /* write to stdout */\n g.outf = MALLOC(strlen(\"\") + 1);\n if (g.outf == NULL)\n bail(\"not enough memory\", \"\");\n strcpy(g.outf, \"\");\n g.outd = 1;\n if (!g.decode && !g.force && isatty(g.outd))\n bail(\"trying to write compressed data to a terminal\",\n \" (use -f to force)\");\n }\n else {\n char *to, *repl;\n\n /* use header name for output when decompressing with -N */\n to = g.inf;\n if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {\n to = g.hname;\n len = strlen(g.hname);\n }\n\n /* replace .tgz with .tar when decoding */\n repl = g.decode && strcmp(to + len, \".tgz\") ? \"\" : \".tar\";\n\n /* create output file and open to write */\n g.outf = MALLOC(len + (g.decode ? strlen(repl) : strlen(g.sufx)) + 1);\n if (g.outf == NULL)\n bail(\"not enough memory\", \"\");\n memcpy(g.outf, to, len);\n strcpy(g.outf + len, g.decode ? repl : g.sufx);\n g.outd = open(g.outf, O_CREAT | O_TRUNC | O_WRONLY |\n (g.force ? 0 : O_EXCL), 0600);\n\n /* if exists and not -f, give user a chance to overwrite */\n if (g.outd < 0 && errno == EEXIST && isatty(0) && g.verbosity) {\n int ch, reply;\n\n fprintf(stderr, \"%s exists -- overwrite (y/n)? \", g.outf);\n fflush(stderr);\n reply = -1;\n do {\n ch = getchar();\n if (reply < 0 && ch != ' ' && ch != '\\t')\n reply = ch == 'y' || ch == 'Y' ? 1 : 0;\n } while (ch != EOF && ch != '\\n' && ch != '\\r');\n if (reply == 1)\n g.outd = open(g.outf, O_CREAT | O_TRUNC | O_WRONLY,\n 0600);\n }\n\n /* if exists and no overwrite, report and go on to next */\n if (g.outd < 0 && errno == EEXIST) {\n complain(\"%s exists -- skipping\", g.outf);\n RELEASE(g.outf);\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n\n /* if some other error, give up */\n if (g.outd < 0)\n bail(\"write error on \", g.outf);\n }\n SET_BINARY_MODE(g.outd);\n RELEASE(g.hname);\n\n /* process ind to outd */\n if (g.verbosity > 1)\n fprintf(stderr, \"%s to %s \", g.inf, g.outf);\n if (g.decode) {\n if (method == 8)\n infchk();\n else if (method == 257)\n unlzw();\n else\n cat();\n }\n#ifndef NOTHREAD\n else if (g.procs > 1)\n parallel_compress();\n#endif\n else\n single_compress(0);\n if (g.verbosity > 1) {\n putc('\\n', stderr);\n fflush(stderr);\n }\n\n /* finish up, copy attributes, set times, delete original */\n if (g.ind != 0)\n close(g.ind);\n if (g.outd != 1) {\n if (close(g.outd))\n bail(\"write error on \", g.outf);\n g.outd = -1; /* now prevent deletion on interrupt */\n if (g.ind != 0) {\n copymeta(g.inf, g.outf);\n if (!g.keep)\n unlink(g.inf);\n }\n if (g.decode && (g.headis & 2) != 0 && g.stamp)\n touch(g.outf, g.stamp);\n }\n RELEASE(g.outf);\n}","target":"local void process(char *path)\n{\n int method = -1; /* get_header() return value */\n size_t len; /* length of base name (minus suffix) */\n struct stat st; /* to get file type and mod time */\n /* all compressed suffixes for decoding search, in length order */\n static char *sufs[] = {\".z\", \"-z\", \"_z\", \".Z\", \".gz\", \"-gz\", \".zz\", \"-zz\",\n \".zip\", \".ZIP\", \".tgz\", NULL};\n\n /* open input file with name in, descriptor ind -- set name and mtime */\n if (path == NULL) {\n strcpy(g.inf, \"\");\n g.ind = 0;\n g.name = NULL;\n g.mtime = g.headis & 2 ?\n (fstat(g.ind, &st) ? time(NULL) : st.st_mtime) : 0;\n len = 0;\n }\n else {\n /* set input file name (already set if recursed here) */\n if (path != g.inf) {\n strncpy(g.inf, path, sizeof(g.inf));\n if (g.inf[sizeof(g.inf) - 1])\n bail(\"name too long: \", path);\n }\n len = strlen(g.inf);\n\n /* try to stat input file -- if not there and decoding, look for that\n name with compressed suffixes */\n if (lstat(g.inf, &st)) {\n if (errno == ENOENT && (g.list || g.decode)) {\n char **try = sufs;\n do {\n if (*try == NULL || len + strlen(*try) >= sizeof(g.inf))\n break;\n strcpy(g.inf + len, *try++);\n errno = 0;\n } while (lstat(g.inf, &st) && errno == ENOENT);\n }\n#ifdef EOVERFLOW\n if (errno == EOVERFLOW || errno == EFBIG)\n bail(g.inf,\n \" too large -- not compiled with large file support\");\n#endif\n if (errno) {\n g.inf[len] = 0;\n complain(\"%s does not exist -- skipping\", g.inf);\n return;\n }\n len = strlen(g.inf);\n }\n\n /* only process regular files, but allow symbolic links if -f,\n recurse into directory if -r */\n if ((st.st_mode & S_IFMT) != S_IFREG &&\n (st.st_mode & S_IFMT) != S_IFLNK &&\n (st.st_mode & S_IFMT) != S_IFDIR) {\n complain(\"%s is a special file or device -- skipping\", g.inf);\n return;\n }\n if ((st.st_mode & S_IFMT) == S_IFLNK && !g.force && !g.pipeout) {\n complain(\"%s is a symbolic link -- skipping\", g.inf);\n return;\n }\n if ((st.st_mode & S_IFMT) == S_IFDIR && !g.recurse) {\n complain(\"%s is a directory -- skipping\", g.inf);\n return;\n }\n\n /* recurse into directory (assumes Unix) */\n if ((st.st_mode & S_IFMT) == S_IFDIR) {\n char *roll, *item, *cut, *base, *bigger;\n size_t len, hold;\n DIR *here;\n struct dirent *next;\n\n /* accumulate list of entries (need to do this, since readdir()\n behavior not defined if directory modified between calls) */\n here = opendir(g.inf);\n if (here == NULL)\n return;\n hold = 512;\n roll = MALLOC(hold);\n if (roll == NULL)\n bail(\"not enough memory\", \"\");\n *roll = 0;\n item = roll;\n while ((next = readdir(here)) != NULL) {\n if (next->d_name[0] == 0 ||\n (next->d_name[0] == '.' && (next->d_name[1] == 0 ||\n (next->d_name[1] == '.' && next->d_name[2] == 0))))\n continue;\n len = strlen(next->d_name) + 1;\n if (item + len + 1 > roll + hold) {\n do { /* make roll bigger */\n hold <<= 1;\n } while (item + len + 1 > roll + hold);\n bigger = REALLOC(roll, hold);\n if (bigger == NULL) {\n FREE(roll);\n bail(\"not enough memory\", \"\");\n }\n item = bigger + (item - roll);\n roll = bigger;\n }\n strcpy(item, next->d_name);\n item += len;\n *item = 0;\n }\n closedir(here);\n\n /* run process() for each entry in the directory */\n cut = base = g.inf + strlen(g.inf);\n if (base > g.inf && base[-1] != (unsigned char)'/') {\n if ((size_t)(base - g.inf) >= sizeof(g.inf))\n bail(\"path too long\", g.inf);\n *base++ = '/';\n }\n item = roll;\n while (*item) {\n strncpy(base, item, sizeof(g.inf) - (base - g.inf));\n if (g.inf[sizeof(g.inf) - 1]) {\n strcpy(g.inf + (sizeof(g.inf) - 4), \"...\");\n bail(\"path too long: \", g.inf);\n }\n process(g.inf);\n item += strlen(item) + 1;\n }\n *cut = 0;\n\n /* release list of entries */\n FREE(roll);\n return;\n }\n\n /* don't compress .gz (or provided suffix) files, unless -f */\n if (!(g.force || g.list || g.decode) && len >= strlen(g.sufx) &&\n strcmp(g.inf + len - strlen(g.sufx), g.sufx) == 0) {\n complain(\"%s ends with %s -- skipping\", g.inf, g.sufx);\n return;\n }\n\n /* create output file only if input file has compressed suffix */\n if (g.decode == 1 && !g.pipeout && !g.list) {\n int suf = compressed_suffix(g.inf);\n if (suf == 0) {\n complain(\"%s does not have compressed suffix -- skipping\",\n g.inf);\n return;\n }\n len -= suf;\n }\n\n /* open input file */\n g.ind = open(g.inf, O_RDONLY, 0);\n if (g.ind < 0)\n bail(\"read error on \", g.inf);\n\n /* prepare gzip header information for compression */\n g.name = g.headis & 1 ? justname(g.inf) : NULL;\n g.mtime = g.headis & 2 ? st.st_mtime : 0;\n }\n SET_BINARY_MODE(g.ind);\n\n /* if decoding or testing, try to read gzip header */\n g.hname = NULL;\n if (g.decode) {\n in_init();\n method = get_header(1);\n if (method != 8 && method != 257 &&\n /* gzip -cdf acts like cat on uncompressed input */\n !(method == -2 && g.force && g.pipeout && g.decode != 2 &&\n !g.list)) {\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n if (method != -1)\n complain(method < 0 ? \"%s is not compressed -- skipping\" :\n \"%s has unknown compression method -- skipping\",\n g.inf);\n return;\n }\n\n /* if requested, test input file (possibly a special list) */\n if (g.decode == 2) {\n if (method == 8)\n infchk();\n else {\n unlzw();\n if (g.list) {\n g.in_tot -= 3;\n show_info(method, 0, g.out_tot, 0);\n }\n }\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n }\n\n /* if requested, just list information about input file */\n if (g.list) {\n list_info();\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n\n /* create output file out, descriptor outd */\n if (path == NULL || g.pipeout) {\n /* write to stdout */\n g.outf = MALLOC(strlen(\"\") + 1);\n if (g.outf == NULL)\n bail(\"not enough memory\", \"\");\n strcpy(g.outf, \"\");\n g.outd = 1;\n if (!g.decode && !g.force && isatty(g.outd))\n bail(\"trying to write compressed data to a terminal\",\n \" (use -f to force)\");\n }\n else {\n char *to = g.inf, *sufx = \"\";\n size_t pre = 0;\n\n /* select parts of the output file name */\n if (g.decode) {\n /* for -dN or -dNT, use the path from the input file and the name\n from the header, stripping any path in the header name */\n if ((g.headis & 1) != 0 && g.hname != NULL) {\n pre = justname(g.inf) - g.inf;\n to = justname(g.hname);\n len = strlen(to);\n }\n /* for -d or -dNn, replace abbreviated suffixes */\n else if (strcmp(to + len, \".tgz\") == 0)\n sufx = \".tar\";\n }\n else\n /* add appropriate suffix when compressing */\n sufx = g.sufx;\n\n /* create output file and open to write */\n g.outf = MALLOC(pre + len + strlen(sufx) + 1);\n if (g.outf == NULL)\n bail(\"not enough memory\", \"\");\n memcpy(g.outf, g.inf, pre);\n memcpy(g.outf + pre, to, len);\n strcpy(g.outf + pre + len, sufx);\n g.outd = open(g.outf, O_CREAT | O_TRUNC | O_WRONLY |\n (g.force ? 0 : O_EXCL), 0600);\n\n /* if exists and not -f, give user a chance to overwrite */\n if (g.outd < 0 && errno == EEXIST && isatty(0) && g.verbosity) {\n int ch, reply;\n\n fprintf(stderr, \"%s exists -- overwrite (y/n)? \", g.outf);\n fflush(stderr);\n reply = -1;\n do {\n ch = getchar();\n if (reply < 0 && ch != ' ' && ch != '\\t')\n reply = ch == 'y' || ch == 'Y' ? 1 : 0;\n } while (ch != EOF && ch != '\\n' && ch != '\\r');\n if (reply == 1)\n g.outd = open(g.outf, O_CREAT | O_TRUNC | O_WRONLY,\n 0600);\n }\n\n /* if exists and no overwrite, report and go on to next */\n if (g.outd < 0 && errno == EEXIST) {\n complain(\"%s exists -- skipping\", g.outf);\n RELEASE(g.outf);\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n\n /* if some other error, give up */\n if (g.outd < 0)\n bail(\"write error on \", g.outf);\n }\n SET_BINARY_MODE(g.outd);\n RELEASE(g.hname);\n\n /* process ind to outd */\n if (g.verbosity > 1)\n fprintf(stderr, \"%s to %s \", g.inf, g.outf);\n if (g.decode) {\n if (method == 8)\n infchk();\n else if (method == 257)\n unlzw();\n else\n cat();\n }\n#ifndef NOTHREAD\n else if (g.procs > 1)\n parallel_compress();\n#endif\n else\n single_compress(0);\n if (g.verbosity > 1) {\n putc('\\n', stderr);\n fflush(stderr);\n }\n\n /* finish up, copy attributes, set times, delete original */\n if (g.ind != 0)\n close(g.ind);\n if (g.outd != 1) {\n if (close(g.outd))\n bail(\"write error on \", g.outf);\n g.outd = -1; /* now prevent deletion on interrupt */\n if (g.ind != 0) {\n copymeta(g.inf, g.outf);\n if (!g.keep)\n unlink(g.inf);\n }\n if (g.decode && (g.headis & 2) != 0 && g.stamp)\n touch(g.outf, g.stamp);\n }\n RELEASE(g.outf);\n}","lang":"c","vul_type":"cwe-022","target_token_count":2786,"sven_meta":{"func_name":"process","file_name":"pigz.c","commit_link":"github.com/madler/pigz/commit/fdad1406b3ec809f4954ff7cdf9e99eb18c2458f","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#35-894b15cd85fa","input":"bool Utility::UnZip(const QString &zippath, const QString &destpath)\n{\n int res = 0;\n QDir dir(destpath);\n if (!cp437) {\n cp437 = new QCodePage437Codec();\n }\n#ifdef Q_OS_WIN32\n zlib_filefunc64_def ffunc;\n fill_win32_filefunc64W(&ffunc);\n unzFile zfile = unzOpen2_64(Utility::QStringToStdWString(QDir::toNativeSeparators(zippath)).c_str(), &ffunc);\n#else\n unzFile zfile = unzOpen64(QDir::toNativeSeparators(zippath).toUtf8().constData());\n#endif\n\n if ((zfile == NULL) || (!IsFileReadable(zippath)) || (!dir.exists())) {\n return false;\n }\n\n res = unzGoToFirstFile(zfile);\n\n if (res == UNZ_OK) {\n do {\n // Get the name of the file in the archive.\n char file_name[MAX_PATH] = {0};\n unz_file_info64 file_info;\n unzGetCurrentFileInfo64(zfile, &file_info, file_name, MAX_PATH, NULL, 0, NULL, 0);\n QString qfile_name;\n QString cp437_file_name;\n qfile_name = QString::fromUtf8(file_name);\n if (!(file_info.flag & (1<<11))) {\n // General purpose bit 11 says the filename is utf-8 encoded. If not set then\n // IBM 437 encoding might be used.\n cp437_file_name = cp437->toUnicode(file_name);\n }\n\n // If there is no file name then we can't do anything with it.\n if (!qfile_name.isEmpty()) {\n // We use the dir object to create the path in the temporary directory.\n // Unfortunately, we need a dir ojbect to do this as it's not a static function.\n // Full file path in the temporary directory.\n QString file_path = destpath + \"/\" + qfile_name;\n QFileInfo qfile_info(file_path);\n\n // Is this entry a directory?\n if (file_info.uncompressed_size == 0 && qfile_name.endsWith('/')) {\n dir.mkpath(qfile_name);\n continue;\n } else {\n dir.mkpath(qfile_info.path());\n }\n\n // Open the file entry in the archive for reading.\n if (unzOpenCurrentFile(zfile) != UNZ_OK) {\n unzClose(zfile);\n return false;\n }\n\n // Open the file on disk to write the entry in the archive to.\n QFile entry(file_path);\n\n if (!entry.open(QIODevice::WriteOnly | QIODevice::Truncate)) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n return false;\n }\n\n // Buffered reading and writing.\n char buff[BUFF_SIZE] = {0};\n int read = 0;\n\n while ((read = unzReadCurrentFile(zfile, buff, BUFF_SIZE)) > 0) {\n entry.write(buff, read);\n }\n\n entry.close();\n\n // Read errors are marked by a negative read amount.\n if (read < 0) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n return false;\n }\n\n // The file was read but the CRC did not match.\n // We don't check the read file size vs the uncompressed file size\n // because if they're different there should be a CRC error.\n if (unzCloseCurrentFile(zfile) == UNZ_CRCERROR) {\n unzClose(zfile);\n return false;\n }\n\n if (!cp437_file_name.isEmpty() && cp437_file_name != qfile_name) {\n QString cp437_file_path = destpath + \"/\" + cp437_file_name;\n QFile::copy(file_path, cp437_file_path);\n }\n }\n } while ((res = unzGoToNextFile(zfile)) == UNZ_OK);\n }\n\n if (res != UNZ_END_OF_LIST_OF_FILE) {\n unzClose(zfile);\n return false;\n }\n\n unzClose(zfile);\n return true;\n}","target":"bool Utility::UnZip(const QString &zippath, const QString &destpath)\n{\n int res = 0;\n QDir dir(destpath);\n if (!cp437) {\n cp437 = new QCodePage437Codec();\n }\n#ifdef Q_OS_WIN32\n zlib_filefunc64_def ffunc;\n fill_win32_filefunc64W(&ffunc);\n unzFile zfile = unzOpen2_64(Utility::QStringToStdWString(QDir::toNativeSeparators(zippath)).c_str(), &ffunc);\n#else\n unzFile zfile = unzOpen64(QDir::toNativeSeparators(zippath).toUtf8().constData());\n#endif\n\n if ((zfile == NULL) || (!IsFileReadable(zippath)) || (!dir.exists())) {\n return false;\n }\n\n res = unzGoToFirstFile(zfile);\n\n if (res == UNZ_OK) {\n do {\n // Get the name of the file in the archive.\n char file_name[MAX_PATH] = {0};\n unz_file_info64 file_info;\n unzGetCurrentFileInfo64(zfile, &file_info, file_name, MAX_PATH, NULL, 0, NULL, 0);\n QString qfile_name;\n QString cp437_file_name;\n qfile_name = QString::fromUtf8(file_name);\n if (!(file_info.flag & (1<<11))) {\n // General purpose bit 11 says the filename is utf-8 encoded. If not set then\n // IBM 437 encoding might be used.\n cp437_file_name = cp437->toUnicode(file_name);\n }\n\n // If there is no file name then we can't do anything with it.\n if (!qfile_name.isEmpty()) {\n\n\t // for security reasons against maliciously crafted zip archives\n\t // we need the file path to always be inside the target folder \n\t // and not outside, so we will remove all illegal backslashes\n\t // and all relative upward paths segments \"/../\" from the zip's local \n\t // file name/path before prepending the target folder to create \n\t // the final path\n\n\t QString original_path = qfile_name;\n\t bool evil_or_corrupt_epub = false;\n\n\t if (qfile_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n\t qfile_name = \"/\" + qfile_name.replace(\"\\\\\",\"\");\n\n\t if (qfile_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n\t qfile_name = qfile_name.replace(\"/../\",\"/\");\n\n\t while(qfile_name.startsWith(\"/\")) { \n\t\t qfile_name = qfile_name.remove(0,1);\n\t }\n \n\t if (cp437_file_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n\t cp437_file_name = \"/\" + cp437_file_name.replace(\"\\\\\",\"\");\n\n\t if (cp437_file_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n\t cp437_file_name = cp437_file_name.replace(\"/../\",\"/\");\n\n\t while(cp437_file_name.startsWith(\"/\")) { \n\t\t cp437_file_name = cp437_file_name.remove(0,1);\n\t }\n\n\t if (evil_or_corrupt_epub) {\n\t\t unzCloseCurrentFile(zfile);\n\t\t unzClose(zfile);\n\t\t // throw (UNZIPLoadParseError(QString(QObject::tr(\"Possible evil or corrupt zip file name: %1\")).arg(original_path).toStdString()));\n return false;\n\t }\n\n // We use the dir object to create the path in the temporary directory.\n // Unfortunately, we need a dir ojbect to do this as it's not a static function.\n // Full file path in the temporary directory.\n QString file_path = destpath + \"/\" + qfile_name;\n QFileInfo qfile_info(file_path);\n\n // Is this entry a directory?\n if (file_info.uncompressed_size == 0 && qfile_name.endsWith('/')) {\n dir.mkpath(qfile_name);\n continue;\n } else {\n dir.mkpath(qfile_info.path());\n }\n\n // Open the file entry in the archive for reading.\n if (unzOpenCurrentFile(zfile) != UNZ_OK) {\n unzClose(zfile);\n return false;\n }\n\n // Open the file on disk to write the entry in the archive to.\n QFile entry(file_path);\n\n if (!entry.open(QIODevice::WriteOnly | QIODevice::Truncate)) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n return false;\n }\n\n // Buffered reading and writing.\n char buff[BUFF_SIZE] = {0};\n int read = 0;\n\n while ((read = unzReadCurrentFile(zfile, buff, BUFF_SIZE)) > 0) {\n entry.write(buff, read);\n }\n\n entry.close();\n\n // Read errors are marked by a negative read amount.\n if (read < 0) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n return false;\n }\n\n // The file was read but the CRC did not match.\n // We don't check the read file size vs the uncompressed file size\n // because if they're different there should be a CRC error.\n if (unzCloseCurrentFile(zfile) == UNZ_CRCERROR) {\n unzClose(zfile);\n return false;\n }\n\n if (!cp437_file_name.isEmpty() && cp437_file_name != qfile_name) {\n QString cp437_file_path = destpath + \"/\" + cp437_file_name;\n QFile::copy(file_path, cp437_file_path);\n }\n }\n } while ((res = unzGoToNextFile(zfile)) == UNZ_OK);\n }\n\n if (res != UNZ_END_OF_LIST_OF_FILE) {\n unzClose(zfile);\n return false;\n }\n\n unzClose(zfile);\n return true;\n}","lang":"cpp","vul_type":"cwe-022","target_token_count":1308,"sven_meta":{"func_name":"Utility::UnZip","file_name":"src/Misc/Utility.cpp","commit_link":"github.com/Sigil-Ebook/Sigil/commit/0979ba8d10c96ebca330715bfd4494ea0e019a8f","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#37-bdc96a61de99","input":"wiki_handle_rest_call(HttpRequest *req, \n\t\t HttpResponse *res,\n\t\t char *func)\n{\n\n if (func != NULL && *func != '\\0')\n {\n if (!strcmp(func, \"page/get\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && (access(page, R_OK) == 0)) \n\t {\n\t http_response_printf(res, \"%s\", file_read(page));\n\t http_response_send(res);\n\t return;\n\t } \n\t}\n else if (!strcmp(func, \"page/set\"))\n\t{\n\t char *wikitext = NULL, *page = NULL;\n\t if( ( (wikitext = http_request_param_get(req, \"text\")) != NULL)\n\t && ( (page = http_request_param_get(req, \"page\")) != NULL))\n\t {\n\t file_write(page, wikitext);\t \n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return;\n\t }\n\t}\n else if (!strcmp(func, \"page/delete\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && (unlink(page) > 0))\n\t {\n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"page/exists\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && (access(page, R_OK) == 0)) \n\t {\n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"pages\") || !strcmp(func, \"search\"))\n\t{\n\t WikiPageList **pages = NULL;\n\t int n_pages, i;\n\t char *expr = http_request_param_get(req, \"expr\");\n\n\t if (expr == NULL)\n\t expr = http_request_get_query_string(req);\n\t \n\t pages = wiki_get_pages(&n_pages, expr);\n\n\t if (pages)\n\t {\n\t for (i=0; imtime);\n\t\t strftime(datebuf, sizeof(datebuf), \"%Y-%m-%d %H:%M\", pTm);\n\t\t http_response_printf(res, \"%s\\t%s\\n\", pages[i]->name, datebuf);\n\t\t}\n\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n }\n\n http_response_set_status(res, 500, \"Error\");\n http_response_printf(res, \"Failed\\n\");\n http_response_send(res);\n\n return; \n}","target":"wiki_handle_rest_call(HttpRequest *req, \n\t\t HttpResponse *res,\n\t\t char *func)\n{\n\n if (func != NULL && *func != '\\0')\n {\n if (!strcmp(func, \"page/get\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && page_name_is_good(page) && (access(page, R_OK) == 0))\n\t {\n\t http_response_printf(res, \"%s\", file_read(page));\n\t http_response_send(res);\n\t return;\n\t } \n\t}\n else if (!strcmp(func, \"page/set\"))\n\t{\n\t char *wikitext = NULL, *page = NULL;\n\t if( ( (wikitext = http_request_param_get(req, \"text\")) != NULL)\n\t && ( (page = http_request_param_get(req, \"page\")) != NULL))\n\t {\n\t if (page_name_is_good(page))\n\t {\n\t file_write(page, wikitext);\n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return;\n\t }\n\t }\n\t}\n else if (!strcmp(func, \"page/delete\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && page_name_is_good(page) && (unlink(page) > 0))\n\t {\n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"page/exists\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && page_name_is_good(page) && (access(page, R_OK) == 0))\n\t {\n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"pages\") || !strcmp(func, \"search\"))\n\t{\n\t WikiPageList **pages = NULL;\n\t int n_pages, i;\n\t char *expr = http_request_param_get(req, \"expr\");\n\n\t if (expr == NULL)\n\t expr = http_request_get_query_string(req);\n\t \n\t pages = wiki_get_pages(&n_pages, expr);\n\n\t if (pages)\n\t {\n\t for (i=0; imtime);\n\t\t strftime(datebuf, sizeof(datebuf), \"%Y-%m-%d %H:%M\", pTm);\n\t\t http_response_printf(res, \"%s\\t%s\\n\", pages[i]->name, datebuf);\n\t\t}\n\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n }\n\n http_response_set_status(res, 500, \"Error\");\n http_response_printf(res, \"Failed\\n\");\n http_response_send(res);\n\n return; \n}","lang":"c","vul_type":"cwe-022","target_token_count":671,"sven_meta":{"func_name":"wiki_handle_rest_call","file_name":"src/wiki.c","commit_link":"github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#38-1e7893debf07","input":"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n GDBusMethodInvocation *invocation,\n gpointer user_data)\n{\n reset_timeout();\n\n uid_t caller_uid;\n GVariant *response;\n\n caller_uid = get_caller_uid(connection, invocation, caller);\n\n log_notice(\"caller_uid:%ld method:'%s'\", (long)caller_uid, method_name);\n\n if (caller_uid == (uid_t) -1)\n return;\n\n if (g_strcmp0(method_name, \"NewProblem\") == 0)\n {\n char *error = NULL;\n char *problem_id = handle_new_problem(g_variant_get_child_value(parameters, 0), caller_uid, &error);\n if (!problem_id)\n {\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n /* else */\n response = g_variant_new(\"(s)\", problem_id);\n g_dbus_method_invocation_return_value(invocation, response);\n free(problem_id);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"GetProblems\") == 0)\n {\n GList *dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n //I was told that g_dbus_method frees the response\n //g_variant_unref(response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetAllProblems\") == 0)\n {\n /*\n - so, we have UID,\n - if it's 0, then we don't have to check anything and just return all directories\n - if uid != 0 then we want to ask for authorization\n */\n if (caller_uid != 0)\n {\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n }\n\n GList * dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetForeignProblems\") == 0)\n {\n GList * dirs = get_problem_dirs_not_accessible_by_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"ChownProblemDir\") == 0)\n {\n const gchar *problem_dir;\n g_variant_get(parameters, \"(&s)\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int ddstat = fdump_dir_stat_for_uid(dir_fd, caller_uid);\n if (ddstat < 0)\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"requested directory does not exist '%s'\", problem_dir);\n }\n else\n {\n perror_msg(\"can't get stat of '%s'\", problem_dir);\n }\n\n return_InvalidProblemDir_error(invocation, problem_dir);\n\n close(dir_fd);\n return;\n }\n\n if (ddstat & DD_STAT_OWNED_BY_UID)\n { //caller seems to be in group with access to this dir, so no action needed\n log_notice(\"caller has access to the requested directory %s\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, NULL);\n close(dir_fd);\n return;\n }\n\n if ((ddstat & DD_STAT_ACCESSIBLE_BY_UID) == 0 &&\n polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int chown_res = dd_chown(dd, caller_uid);\n if (chown_res != 0)\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.ChownError\",\n _(\"Chowning directory failed. Check system logs for more details.\"));\n else\n g_dbus_method_invocation_return_value(invocation, NULL);\n\n dd_close(dd);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetInfo\") == 0)\n {\n /* Parameter tuple is (sas) */\n\n\t/* Get 1st param - problem dir name */\n const gchar *problem_dir;\n g_variant_get_child(parameters, 0, \"&s\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n close(dir_fd);\n return;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n\t/* Get 2nd param - vector of element names */\n GVariant *array = g_variant_get_child_value(parameters, 1);\n GList *elements = string_list_from_variant(array);\n g_variant_unref(array);\n\n GVariantBuilder *builder = NULL;\n for (GList *l = elements; l; l = l->next)\n {\n const char *element_name = (const char*)l->data;\n char *value = dd_load_text_ext(dd, element_name, 0\n | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE\n | DD_FAIL_QUIETLY_ENOENT\n | DD_FAIL_QUIETLY_EACCES);\n log_notice(\"element '%s' %s\", element_name, value ? \"fetched\" : \"not found\");\n if (value)\n {\n if (!builder)\n builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);\n\n /* g_variant_builder_add makes a copy. No need to xstrdup here */\n g_variant_builder_add(builder, \"{ss}\", element_name, value);\n free(value);\n }\n }\n list_free_with_free(elements);\n dd_close(dd);\n /* It is OK to call g_variant_new(\"(a{ss})\", NULL) because */\n /* G_VARIANT_TYPE_TUPLE allows NULL value */\n GVariant *response = g_variant_new(\"(a{ss})\", builder);\n\n if (builder)\n g_variant_builder_unref(builder);\n\n log_info(\"GetInfo: returning value for '%s'\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"SetElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n const char *value;\n\n g_variant_get(parameters, \"(&s&s&s)\", &problem_id, &element, &value);\n\n if (element == NULL || element[0] == '\\0' || strlen(element) > 64)\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n /* Is it good idea to make it static? Is it possible to change the max size while a single run? */\n const double max_dir_size = g_settings_nMaxCrashReportsSize * (1024 * 1024);\n const long item_size = dd_get_item_size(dd, element);\n if (item_size < 0)\n {\n log_notice(\"Can't get size of '%s/%s'\", problem_id, element);\n char *error = xasprintf(_(\"Can't get size of '%s'\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n return;\n }\n\n const double requested_size = (double)strlen(value) - item_size;\n /* Don't want to check the size limit in case of reducing of size */\n if (requested_size > 0\n && requested_size > (max_dir_size - get_dirsize(g_settings_dump_location)))\n {\n log_notice(\"No problem space left in '%s' (requested Bytes %f)\", problem_id, requested_size);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n _(\"No problem space left\"));\n }\n else\n {\n dd_save_text(dd, element, value);\n g_dbus_method_invocation_return_value(invocation, NULL);\n }\n\n dd_close(dd);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n\n g_variant_get(parameters, \"(&s&s)\", &problem_id, &element);\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n const int res = dd_delete_item(dd, element);\n dd_close(dd);\n\n if (res != 0)\n {\n log_notice(\"Can't delete the element '%s' from the problem directory '%s'\", element, problem_id);\n char *error = xasprintf(_(\"Can't delete the element '%s' from the problem directory '%s'\"), element, problem_id);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteProblem\") == 0)\n {\n /* Dbus parameters are always tuples.\n * In this case, it's (as) - a tuple of one element (array of strings).\n * Need to fetch the array:\n */\n GVariant *array = g_variant_get_child_value(parameters, 0);\n GList *problem_dirs = string_list_from_variant(array);\n g_variant_unref(array);\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n log_notice(\"dir_name:'%s'\", dir_name);\n if (!allowed_problem_dir(dir_name))\n {\n return_InvalidProblemDir_error(invocation, dir_name);\n goto ret;\n }\n }\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n\n int dir_fd = dd_openfd(dir_name);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", dir_name);\n return_InvalidProblemDir_error(invocation, dir_name);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", dir_name);\n close(dir_fd);\n continue;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n { // if user didn't provide correct credentials, just move to the next dir\n close(dir_fd);\n continue;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, dir_name, /*flags:*/ 0);\n if (dd)\n {\n if (dd_delete(dd) != 0)\n {\n error_msg(\"Failed to delete problem directory '%s'\", dir_name);\n dd_close(dd);\n }\n }\n }\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n ret:\n list_free_with_free(problem_dirs);\n return;\n }\n\n if (g_strcmp0(method_name, \"FindProblemByElementInTimeRange\") == 0)\n {\n const gchar *element;\n const gchar *value;\n glong timestamp_from;\n glong timestamp_to;\n gboolean all;\n\n g_variant_get_child(parameters, 0, \"&s\", &element);\n g_variant_get_child(parameters, 1, \"&s\", &value);\n g_variant_get_child(parameters, 2, \"x\", ×tamp_from);\n g_variant_get_child(parameters, 3, \"x\", ×tamp_to);\n g_variant_get_child(parameters, 4, \"b\", &all);\n\n if (all && polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n\n GList *dirs = get_problem_dirs_for_element_in_time(caller_uid, element, value, timestamp_from,\n timestamp_to);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"Quit\") == 0)\n {\n g_dbus_method_invocation_return_value(invocation, NULL);\n g_main_loop_quit(loop);\n return;\n }\n}","target":"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n GDBusMethodInvocation *invocation,\n gpointer user_data)\n{\n reset_timeout();\n\n uid_t caller_uid;\n GVariant *response;\n\n caller_uid = get_caller_uid(connection, invocation, caller);\n\n log_notice(\"caller_uid:%ld method:'%s'\", (long)caller_uid, method_name);\n\n if (caller_uid == (uid_t) -1)\n return;\n\n if (g_strcmp0(method_name, \"NewProblem\") == 0)\n {\n char *error = NULL;\n char *problem_id = handle_new_problem(g_variant_get_child_value(parameters, 0), caller_uid, &error);\n if (!problem_id)\n {\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n /* else */\n response = g_variant_new(\"(s)\", problem_id);\n g_dbus_method_invocation_return_value(invocation, response);\n free(problem_id);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"GetProblems\") == 0)\n {\n GList *dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n //I was told that g_dbus_method frees the response\n //g_variant_unref(response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetAllProblems\") == 0)\n {\n /*\n - so, we have UID,\n - if it's 0, then we don't have to check anything and just return all directories\n - if uid != 0 then we want to ask for authorization\n */\n if (caller_uid != 0)\n {\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n }\n\n GList * dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetForeignProblems\") == 0)\n {\n GList * dirs = get_problem_dirs_not_accessible_by_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"ChownProblemDir\") == 0)\n {\n const gchar *problem_dir;\n g_variant_get(parameters, \"(&s)\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int ddstat = fdump_dir_stat_for_uid(dir_fd, caller_uid);\n if (ddstat < 0)\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"requested directory does not exist '%s'\", problem_dir);\n }\n else\n {\n perror_msg(\"can't get stat of '%s'\", problem_dir);\n }\n\n return_InvalidProblemDir_error(invocation, problem_dir);\n\n close(dir_fd);\n return;\n }\n\n if (ddstat & DD_STAT_OWNED_BY_UID)\n { //caller seems to be in group with access to this dir, so no action needed\n log_notice(\"caller has access to the requested directory %s\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, NULL);\n close(dir_fd);\n return;\n }\n\n if ((ddstat & DD_STAT_ACCESSIBLE_BY_UID) == 0 &&\n polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int chown_res = dd_chown(dd, caller_uid);\n if (chown_res != 0)\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.ChownError\",\n _(\"Chowning directory failed. Check system logs for more details.\"));\n else\n g_dbus_method_invocation_return_value(invocation, NULL);\n\n dd_close(dd);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetInfo\") == 0)\n {\n /* Parameter tuple is (sas) */\n\n\t/* Get 1st param - problem dir name */\n const gchar *problem_dir;\n g_variant_get_child(parameters, 0, \"&s\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n close(dir_fd);\n return;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n\t/* Get 2nd param - vector of element names */\n GVariant *array = g_variant_get_child_value(parameters, 1);\n GList *elements = string_list_from_variant(array);\n g_variant_unref(array);\n\n GVariantBuilder *builder = NULL;\n for (GList *l = elements; l; l = l->next)\n {\n const char *element_name = (const char*)l->data;\n char *value = dd_load_text_ext(dd, element_name, 0\n | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE\n | DD_FAIL_QUIETLY_ENOENT\n | DD_FAIL_QUIETLY_EACCES);\n log_notice(\"element '%s' %s\", element_name, value ? \"fetched\" : \"not found\");\n if (value)\n {\n if (!builder)\n builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);\n\n /* g_variant_builder_add makes a copy. No need to xstrdup here */\n g_variant_builder_add(builder, \"{ss}\", element_name, value);\n free(value);\n }\n }\n list_free_with_free(elements);\n dd_close(dd);\n /* It is OK to call g_variant_new(\"(a{ss})\", NULL) because */\n /* G_VARIANT_TYPE_TUPLE allows NULL value */\n GVariant *response = g_variant_new(\"(a{ss})\", builder);\n\n if (builder)\n g_variant_builder_unref(builder);\n\n log_info(\"GetInfo: returning value for '%s'\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"SetElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n const char *value;\n\n g_variant_get(parameters, \"(&s&s&s)\", &problem_id, &element, &value);\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n /* Is it good idea to make it static? Is it possible to change the max size while a single run? */\n const double max_dir_size = g_settings_nMaxCrashReportsSize * (1024 * 1024);\n const long item_size = dd_get_item_size(dd, element);\n if (item_size < 0)\n {\n log_notice(\"Can't get size of '%s/%s'\", problem_id, element);\n char *error = xasprintf(_(\"Can't get size of '%s'\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n return;\n }\n\n const double requested_size = (double)strlen(value) - item_size;\n /* Don't want to check the size limit in case of reducing of size */\n if (requested_size > 0\n && requested_size > (max_dir_size - get_dirsize(g_settings_dump_location)))\n {\n log_notice(\"No problem space left in '%s' (requested Bytes %f)\", problem_id, requested_size);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n _(\"No problem space left\"));\n }\n else\n {\n dd_save_text(dd, element, value);\n g_dbus_method_invocation_return_value(invocation, NULL);\n }\n\n dd_close(dd);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n\n g_variant_get(parameters, \"(&s&s)\", &problem_id, &element);\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n const int res = dd_delete_item(dd, element);\n dd_close(dd);\n\n if (res != 0)\n {\n log_notice(\"Can't delete the element '%s' from the problem directory '%s'\", element, problem_id);\n char *error = xasprintf(_(\"Can't delete the element '%s' from the problem directory '%s'\"), element, problem_id);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteProblem\") == 0)\n {\n /* Dbus parameters are always tuples.\n * In this case, it's (as) - a tuple of one element (array of strings).\n * Need to fetch the array:\n */\n GVariant *array = g_variant_get_child_value(parameters, 0);\n GList *problem_dirs = string_list_from_variant(array);\n g_variant_unref(array);\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n log_notice(\"dir_name:'%s'\", dir_name);\n if (!allowed_problem_dir(dir_name))\n {\n return_InvalidProblemDir_error(invocation, dir_name);\n goto ret;\n }\n }\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n\n int dir_fd = dd_openfd(dir_name);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", dir_name);\n return_InvalidProblemDir_error(invocation, dir_name);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", dir_name);\n close(dir_fd);\n continue;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n { // if user didn't provide correct credentials, just move to the next dir\n close(dir_fd);\n continue;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, dir_name, /*flags:*/ 0);\n if (dd)\n {\n if (dd_delete(dd) != 0)\n {\n error_msg(\"Failed to delete problem directory '%s'\", dir_name);\n dd_close(dd);\n }\n }\n }\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n ret:\n list_free_with_free(problem_dirs);\n return;\n }\n\n if (g_strcmp0(method_name, \"FindProblemByElementInTimeRange\") == 0)\n {\n const gchar *element;\n const gchar *value;\n glong timestamp_from;\n glong timestamp_to;\n gboolean all;\n\n g_variant_get_child(parameters, 0, \"&s\", &element);\n g_variant_get_child(parameters, 1, \"&s\", &value);\n g_variant_get_child(parameters, 2, \"x\", ×tamp_from);\n g_variant_get_child(parameters, 3, \"x\", ×tamp_to);\n g_variant_get_child(parameters, 4, \"b\", &all);\n\n if (all && polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n\n GList *dirs = get_problem_dirs_for_element_in_time(caller_uid, element, value, timestamp_from,\n timestamp_to);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"Quit\") == 0)\n {\n g_dbus_method_invocation_return_value(invocation, NULL);\n g_main_loop_quit(loop);\n return;\n }\n}","lang":"c","vul_type":"cwe-022","target_token_count":3466,"sven_meta":{"func_name":"handle_method_call","file_name":"src/dbus/abrt-dbus.c","commit_link":"github.com/abrt/abrt/commit/f3c2a6af3455b2882e28570e8a04f1c2d4500d5b","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#39-17d4a82c5000","input":"static bool extractFileTo(zip* zip, const std::string &file, std::string& to,\n char* buf, size_t len) {\n auto sep = file.rfind('/');\n if (sep != std::string::npos) {\n auto path = to + file.substr(0, sep);\n if (!HHVM_FN(is_dir)(path) && !HHVM_FN(mkdir)(path, 0777, true)) {\n return false;\n }\n\n if (sep == file.length() - 1) {\n return true;\n }\n }\n\n to.append(file);\n struct zip_stat zipStat;\n if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n return false;\n }\n\n auto zipFile = zip_fopen_index(zip, zipStat.index, 0);\n FAIL_IF_INVALID_PTR(zipFile);\n\n auto outFile = fopen(to.c_str(), \"wb\");\n if (outFile == nullptr) {\n zip_fclose(zipFile);\n return false;\n }\n\n for (auto n = zip_fread(zipFile, buf, len); n != 0;\n n = zip_fread(zipFile, buf, len)) {\n if (n < 0 || fwrite(buf, sizeof(char), n, outFile) != n) {\n zip_fclose(zipFile);\n fclose(outFile);\n remove(to.c_str());\n return false;\n }\n }\n\n zip_fclose(zipFile);\n if (fclose(outFile) != 0) {\n return false;\n }\n\n return true;\n}","target":"static bool extractFileTo(zip* zip, const std::string &file, std::string& to,\n char* buf, size_t len) {\n\n struct zip_stat zipStat;\n // Verify the file to be extracted is actually in the zip file\n if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n return false;\n }\n\n auto clean_file = file;\n auto sep = std::string::npos;\n // Normally would just use std::string::rfind here, but if we want to be\n // consistent between Windows and Linux, even if techincally Linux won't use\n // backslash for a separator, we are checking for both types.\n int idx = file.length() - 1;\n while (idx >= 0) {\n if (FileUtil::isDirSeparator(file[idx])) {\n sep = idx;\n break;\n }\n idx--;\n }\n if (sep != std::string::npos) {\n // make_relative_path so we do not try to put files or dirs in bad\n // places. This securely \"cleans\" the file.\n clean_file = make_relative_path(file);\n std::string path = to + clean_file;\n bool is_dir_only = true;\n if (sep < file.length() - 1) { // not just a directory\n auto clean_file_dir = HHVM_FN(dirname)(clean_file);\n path = to + clean_file_dir.toCppString();\n is_dir_only = false;\n }\n\n // Make sure the directory path to extract to exists or can be created\n if (!HHVM_FN(is_dir)(path) && !HHVM_FN(mkdir)(path, 0777, true)) {\n return false;\n }\n\n // If we have a good directory to extract to above, we now check whether\n // the \"file\" parameter passed in is a directory or actually a file.\n if (is_dir_only) { // directory, like /usr/bin/\n return true;\n }\n // otherwise file is actually a file, so we actually extract.\n }\n\n // We have ensured that clean_file will be added to a relative path by the\n // time we get here.\n to.append(clean_file);\n\n auto zipFile = zip_fopen_index(zip, zipStat.index, 0);\n FAIL_IF_INVALID_PTR(zipFile);\n\n auto outFile = fopen(to.c_str(), \"wb\");\n if (outFile == nullptr) {\n zip_fclose(zipFile);\n return false;\n }\n\n for (auto n = zip_fread(zipFile, buf, len); n != 0;\n n = zip_fread(zipFile, buf, len)) {\n if (n < 0 || fwrite(buf, sizeof(char), n, outFile) != n) {\n zip_fclose(zipFile);\n fclose(outFile);\n remove(to.c_str());\n return false;\n }\n }\n\n zip_fclose(zipFile);\n if (fclose(outFile) != 0) {\n return false;\n }\n\n return true;\n}","lang":"cpp","vul_type":"cwe-022","target_token_count":656,"sven_meta":{"func_name":"HPHP::extractFileTo","file_name":"hphp/runtime/ext/zip/ext_zip.cpp","commit_link":"github.com/facebook/hhvm/commit/65c95a01541dd2fbc9c978ac53bed235b5376686","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#43-d7a867fffdf8","input":"char *compose_path(ctrl_t *ctrl, char *path)\n{\n\tstruct stat st;\n\tstatic char rpath[PATH_MAX];\n\tchar *name, *ptr;\n\tchar dir[PATH_MAX] = { 0 };\n\n\tstrlcpy(dir, ctrl->cwd, sizeof(dir));\n\tDBG(\"Compose path from cwd: %s, arg: %s\", ctrl->cwd, path ?: \"\");\n\tif (!path || !strlen(path))\n\t\tgoto check;\n\n\tif (path) {\n\t\tif (path[0] != '/') {\n\t\t\tif (dir[strlen(dir) - 1] != '/')\n\t\t\t\tstrlcat(dir, \"/\", sizeof(dir));\n\t\t}\n\t\tstrlcat(dir, path, sizeof(dir));\n\t}\n\ncheck:\n\twhile ((ptr = strstr(dir, \"//\")))\n\t\tmemmove(ptr, &ptr[1], strlen(&ptr[1]) + 1);\n\n\tif (!chrooted) {\n\t\tsize_t len = strlen(home);\n\n\t\tDBG(\"Server path from CWD: %s\", dir);\n\t\tif (len > 0 && home[len - 1] == '/')\n\t\t\tlen--;\n\t\tmemmove(dir + len, dir, strlen(dir) + 1);\n\t\tmemcpy(dir, home, len);\n\t\tDBG(\"Resulting non-chroot path: %s\", dir);\n\t}\n\n\t/*\n\t * Handle directories slightly differently, since dirname() on a\n\t * directory returns the parent directory. So, just squash ..\n\t */\n\tif (!stat(dir, &st) && S_ISDIR(st.st_mode)) {\n\t\tif (!realpath(dir, rpath))\n\t\t\treturn NULL;\n\t} else {\n\t\t/*\n\t\t * Check realpath() of directory containing the file, a\n\t\t * STOR may want to save a new file. Then append the\n\t\t * file and return it.\n\t\t */\n\t\tname = basename(path);\n\t\tptr = dirname(dir);\n\n\t\tmemset(rpath, 0, sizeof(rpath));\n\t\tif (!realpath(ptr, rpath)) {\n\t\t\tINFO(\"Failed realpath(%s): %m\", ptr);\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (rpath[1] != 0)\n\t\t\tstrlcat(rpath, \"/\", sizeof(rpath));\n\t\tstrlcat(rpath, name, sizeof(rpath));\n\t}\n\n\tif (!chrooted && strncmp(dir, home, strlen(home))) {\n\t\tDBG(\"Failed non-chroot dir:%s vs home:%s\", dir, home);\n\t\treturn NULL;\n\t}\n\n\treturn rpath;\n}","target":"char *compose_path(ctrl_t *ctrl, char *path)\n{\n\tstruct stat st;\n\tstatic char rpath[PATH_MAX];\n\tchar *name, *ptr;\n\tchar dir[PATH_MAX] = { 0 };\n\n\tstrlcpy(dir, ctrl->cwd, sizeof(dir));\n\tDBG(\"Compose path from cwd: %s, arg: %s\", ctrl->cwd, path ?: \"\");\n\tif (!path || !strlen(path))\n\t\tgoto check;\n\n\tif (path) {\n\t\tif (path[0] != '/') {\n\t\t\tif (dir[strlen(dir) - 1] != '/')\n\t\t\t\tstrlcat(dir, \"/\", sizeof(dir));\n\t\t}\n\t\tstrlcat(dir, path, sizeof(dir));\n\t}\n\ncheck:\n\twhile ((ptr = strstr(dir, \"//\")))\n\t\tmemmove(ptr, &ptr[1], strlen(&ptr[1]) + 1);\n\n\tif (!chrooted) {\n\t\tsize_t len = strlen(home);\n\n\t\tDBG(\"Server path from CWD: %s\", dir);\n\t\tif (len > 0 && home[len - 1] == '/')\n\t\t\tlen--;\n\t\tmemmove(dir + len, dir, strlen(dir) + 1);\n\t\tmemcpy(dir, home, len);\n\t\tDBG(\"Resulting non-chroot path: %s\", dir);\n\t}\n\n\t/*\n\t * Handle directories slightly differently, since dirname() on a\n\t * directory returns the parent directory. So, just squash ..\n\t */\n\tif (!stat(dir, &st) && S_ISDIR(st.st_mode)) {\n\t\tif (!realpath(dir, rpath))\n\t\t\treturn NULL;\n\t} else {\n\t\t/*\n\t\t * Check realpath() of directory containing the file, a\n\t\t * STOR may want to save a new file. Then append the\n\t\t * file and return it.\n\t\t */\n\t\tname = basename(path);\n\t\tptr = dirname(dir);\n\n\t\tmemset(rpath, 0, sizeof(rpath));\n\t\tif (!realpath(ptr, rpath)) {\n\t\t\tINFO(\"Failed realpath(%s): %m\", ptr);\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (rpath[1] != 0)\n\t\t\tstrlcat(rpath, \"/\", sizeof(rpath));\n\t\tstrlcat(rpath, name, sizeof(rpath));\n\t}\n\n\tif (!chrooted && strncmp(rpath, home, strlen(home))) {\n\t\tDBG(\"Failed non-chroot dir:%s vs home:%s\", dir, home);\n\t\treturn NULL;\n\t}\n\n\treturn rpath;\n}","lang":"c","vul_type":"cwe-022","target_token_count":513,"sven_meta":{"func_name":"compose_path","file_name":"src/common.c","commit_link":"github.com/troglobit/uftpd/commit/455b47d3756aed162d2d0ef7f40b549f3b5b30fe","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-787#1-4b11beb4e976","input":"jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int y, Jbig2ComposeOp op)\n{\n uint32_t w, h;\n uint32_t shift;\n uint32_t leftbyte;\n uint8_t *ss;\n uint8_t *dd;\n uint8_t leftmask, rightmask;\n int early = x >= 0;\n int late;\n uint32_t bytewidth;\n uint32_t syoffset = 0;\n\n if (src == NULL)\n return 0;\n\n /* This code takes a src image and combines it onto dst at offset (x,y), with operation op. */\n\n /* Data is packed msb first within a byte, so with bits numbered: 01234567.\n * Second byte is: 89abcdef. So to combine into a run, we use:\n * (s[0]<<8) | s[1] == 0123456789abcdef.\n * To read from src into dst at offset 3, we need to read:\n * read: 0123456789abcdef...\n * write: 0123456798abcdef...\n * In general, to read from src and write into dst at offset x, we need to shift\n * down by (x&7) bits to allow for bit alignment. So shift = x&7.\n * So the 'central' part of our runs will see us doing:\n * *d++ op= ((s[0]<<8)|s[1])>>shift;\n * with special cases on the left and right edges of the run to mask.\n * With the left hand edge, we have to be careful not to 'underread' the start of\n * the src image; this is what the early flag is about. Similarly we have to be\n * careful not to read off the right hand edge; this is what the late flag is for.\n */\n\n /* clip */\n w = src->width;\n h = src->height;\n shift = (x & 7);\n ss = src->data - early;\n\n if (x < 0) {\n if (w < (uint32_t) -x)\n w = 0;\n else\n w += x;\n ss += (-x-1)>>3;\n x = 0;\n }\n if (y < 0) {\n if (h < (uint32_t) -y)\n h = 0;\n else\n h += y;\n syoffset = -y * src->stride;\n y = 0;\n }\n if ((uint32_t)x + w > dst->width)\n {\n if (dst->width < (uint32_t)x)\n w = 0;\n else\n w = dst->width - x;\n }\n if ((uint32_t)y + h > dst->height)\n {\n if (dst->height < (uint32_t)y)\n h = 0;\n else\n h = dst->height - y;\n }\n#ifdef JBIG2_DEBUG\n jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, \"compositing %dx%d at (%d, %d) after clipping\", w, h, x, y);\n#endif\n\n /* check for zero clipping region */\n if ((w <= 0) || (h <= 0)) {\n#ifdef JBIG2_DEBUG\n jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, \"zero clipping region\");\n#endif\n return 0;\n }\n\n leftbyte = (uint32_t) x >> 3;\n dd = dst->data + y * dst->stride + leftbyte;\n bytewidth = (((uint32_t) x + w - 1) >> 3) - leftbyte + 1;\n leftmask = 255>>(x&7);\n rightmask = (((x+w)&7) == 0) ? 255 : ~(255>>((x+w)&7));\n if (bytewidth == 1)\n leftmask &= rightmask;\n late = (ss + bytewidth >= src->data + ((src->width+7)>>3));\n ss += syoffset;\n\n switch(op)\n {\n case JBIG2_COMPOSE_OR:\n jbig2_image_compose_opt_OR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_AND:\n jbig2_image_compose_opt_AND(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_XOR:\n jbig2_image_compose_opt_XOR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_XNOR:\n jbig2_image_compose_opt_XNOR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_REPLACE:\n jbig2_image_compose_opt_REPLACE(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n }\n\n return 0;\n}","target":"jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int y, Jbig2ComposeOp op)\n{\n uint32_t w, h;\n uint32_t shift;\n uint32_t leftbyte;\n uint8_t *ss;\n uint8_t *dd;\n uint8_t leftmask, rightmask;\n int early = x >= 0;\n int late;\n uint32_t bytewidth;\n uint32_t syoffset = 0;\n\n if (src == NULL)\n return 0;\n\n if ((UINT32_MAX - src->width < (x > 0 ? x : -x)) ||\n (UINT32_MAX - src->height < (y > 0 ? y : -y)))\n {\n#ifdef JBIG2_DEBUG\n jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, \"overflow in compose_image\");\n#endif\n return 0;\n }\n\n /* This code takes a src image and combines it onto dst at offset (x,y), with operation op. */\n\n /* Data is packed msb first within a byte, so with bits numbered: 01234567.\n * Second byte is: 89abcdef. So to combine into a run, we use:\n * (s[0]<<8) | s[1] == 0123456789abcdef.\n * To read from src into dst at offset 3, we need to read:\n * read: 0123456789abcdef...\n * write: 0123456798abcdef...\n * In general, to read from src and write into dst at offset x, we need to shift\n * down by (x&7) bits to allow for bit alignment. So shift = x&7.\n * So the 'central' part of our runs will see us doing:\n * *d++ op= ((s[0]<<8)|s[1])>>shift;\n * with special cases on the left and right edges of the run to mask.\n * With the left hand edge, we have to be careful not to 'underread' the start of\n * the src image; this is what the early flag is about. Similarly we have to be\n * careful not to read off the right hand edge; this is what the late flag is for.\n */\n\n /* clip */\n w = src->width;\n h = src->height;\n shift = (x & 7);\n ss = src->data - early;\n\n if (x < 0) {\n if (w < (uint32_t) -x)\n w = 0;\n else\n w += x;\n ss += (-x-1)>>3;\n x = 0;\n }\n if (y < 0) {\n if (h < (uint32_t) -y)\n h = 0;\n else\n h += y;\n syoffset = -y * src->stride;\n y = 0;\n }\n if ((uint32_t)x + w > dst->width)\n {\n if (dst->width < (uint32_t)x)\n w = 0;\n else\n w = dst->width - x;\n }\n if ((uint32_t)y + h > dst->height)\n {\n if (dst->height < (uint32_t)y)\n h = 0;\n else\n h = dst->height - y;\n }\n#ifdef JBIG2_DEBUG\n jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, \"compositing %dx%d at (%d, %d) after clipping\", w, h, x, y);\n#endif\n\n /* check for zero clipping region */\n if ((w <= 0) || (h <= 0)) {\n#ifdef JBIG2_DEBUG\n jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, \"zero clipping region\");\n#endif\n return 0;\n }\n\n leftbyte = (uint32_t) x >> 3;\n dd = dst->data + y * dst->stride + leftbyte;\n bytewidth = (((uint32_t) x + w - 1) >> 3) - leftbyte + 1;\n leftmask = 255>>(x&7);\n rightmask = (((x+w)&7) == 0) ? 255 : ~(255>>((x+w)&7));\n if (bytewidth == 1)\n leftmask &= rightmask;\n late = (ss + bytewidth >= src->data + ((src->width+7)>>3));\n ss += syoffset;\n\n switch(op)\n {\n case JBIG2_COMPOSE_OR:\n jbig2_image_compose_opt_OR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_AND:\n jbig2_image_compose_opt_AND(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_XOR:\n jbig2_image_compose_opt_XOR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_XNOR:\n jbig2_image_compose_opt_XNOR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_REPLACE:\n jbig2_image_compose_opt_REPLACE(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n }\n\n return 0;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1333,"sven_meta":{"func_name":"jbig2_image_compose","file_name":"jbig2_image.c","commit_link":"github.com/ArtifexSoftware/jbig2dec/commit/0726320a4b55078e9d8deb590e477d598b3da66e","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#3-ef6277c3d03d","input":"int mpol_parse_str(char *str, struct mempolicy **mpol)\n{\n\tstruct mempolicy *new = NULL;\n\tunsigned short mode_flags;\n\tnodemask_t nodes;\n\tchar *nodelist = strchr(str, ':');\n\tchar *flags = strchr(str, '=');\n\tint err = 1, mode;\n\n\tif (flags)\n\t\t*flags++ = '\\0';\t/* terminate mode string */\n\n\tif (nodelist) {\n\t\t/* NUL-terminate mode or flags string */\n\t\t*nodelist++ = '\\0';\n\t\tif (nodelist_parse(nodelist, nodes))\n\t\t\tgoto out;\n\t\tif (!nodes_subset(nodes, node_states[N_MEMORY]))\n\t\t\tgoto out;\n\t} else\n\t\tnodes_clear(nodes);\n\n\tmode = match_string(policy_modes, MPOL_MAX, str);\n\tif (mode < 0)\n\t\tgoto out;\n\n\tswitch (mode) {\n\tcase MPOL_PREFERRED:\n\t\t/*\n\t\t * Insist on a nodelist of one node only\n\t\t */\n\t\tif (nodelist) {\n\t\t\tchar *rest = nodelist;\n\t\t\twhile (isdigit(*rest))\n\t\t\t\trest++;\n\t\t\tif (*rest)\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase MPOL_INTERLEAVE:\n\t\t/*\n\t\t * Default to online nodes with memory if no nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\tnodes = node_states[N_MEMORY];\n\t\tbreak;\n\tcase MPOL_LOCAL:\n\t\t/*\n\t\t * Don't allow a nodelist; mpol_new() checks flags\n\t\t */\n\t\tif (nodelist)\n\t\t\tgoto out;\n\t\tmode = MPOL_PREFERRED;\n\t\tbreak;\n\tcase MPOL_DEFAULT:\n\t\t/*\n\t\t * Insist on a empty nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\terr = 0;\n\t\tgoto out;\n\tcase MPOL_BIND:\n\t\t/*\n\t\t * Insist on a nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\tgoto out;\n\t}\n\n\tmode_flags = 0;\n\tif (flags) {\n\t\t/*\n\t\t * Currently, we only support two mutually exclusive\n\t\t * mode flags.\n\t\t */\n\t\tif (!strcmp(flags, \"static\"))\n\t\t\tmode_flags |= MPOL_F_STATIC_NODES;\n\t\telse if (!strcmp(flags, \"relative\"))\n\t\t\tmode_flags |= MPOL_F_RELATIVE_NODES;\n\t\telse\n\t\t\tgoto out;\n\t}\n\n\tnew = mpol_new(mode, mode_flags, &nodes);\n\tif (IS_ERR(new))\n\t\tgoto out;\n\n\t/*\n\t * Save nodes for mpol_to_str() to show the tmpfs mount options\n\t * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo.\n\t */\n\tif (mode != MPOL_PREFERRED)\n\t\tnew->v.nodes = nodes;\n\telse if (nodelist)\n\t\tnew->v.preferred_node = first_node(nodes);\n\telse\n\t\tnew->flags |= MPOL_F_LOCAL;\n\n\t/*\n\t * Save nodes for contextualization: this will be used to \"clone\"\n\t * the mempolicy in a specific context [cpuset] at a later time.\n\t */\n\tnew->w.user_nodemask = nodes;\n\n\terr = 0;\n\nout:\n\t/* Restore string for error message */\n\tif (nodelist)\n\t\t*--nodelist = ':';\n\tif (flags)\n\t\t*--flags = '=';\n\tif (!err)\n\t\t*mpol = new;\n\treturn err;\n}","target":"int mpol_parse_str(char *str, struct mempolicy **mpol)\n{\n\tstruct mempolicy *new = NULL;\n\tunsigned short mode_flags;\n\tnodemask_t nodes;\n\tchar *nodelist = strchr(str, ':');\n\tchar *flags = strchr(str, '=');\n\tint err = 1, mode;\n\n\tif (flags)\n\t\t*flags++ = '\\0';\t/* terminate mode string */\n\n\tif (nodelist) {\n\t\t/* NUL-terminate mode or flags string */\n\t\t*nodelist++ = '\\0';\n\t\tif (nodelist_parse(nodelist, nodes))\n\t\t\tgoto out;\n\t\tif (!nodes_subset(nodes, node_states[N_MEMORY]))\n\t\t\tgoto out;\n\t} else\n\t\tnodes_clear(nodes);\n\n\tmode = match_string(policy_modes, MPOL_MAX, str);\n\tif (mode < 0)\n\t\tgoto out;\n\n\tswitch (mode) {\n\tcase MPOL_PREFERRED:\n\t\t/*\n\t\t * Insist on a nodelist of one node only, although later\n\t\t * we use first_node(nodes) to grab a single node, so here\n\t\t * nodelist (or nodes) cannot be empty.\n\t\t */\n\t\tif (nodelist) {\n\t\t\tchar *rest = nodelist;\n\t\t\twhile (isdigit(*rest))\n\t\t\t\trest++;\n\t\t\tif (*rest)\n\t\t\t\tgoto out;\n\t\t\tif (nodes_empty(nodes))\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase MPOL_INTERLEAVE:\n\t\t/*\n\t\t * Default to online nodes with memory if no nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\tnodes = node_states[N_MEMORY];\n\t\tbreak;\n\tcase MPOL_LOCAL:\n\t\t/*\n\t\t * Don't allow a nodelist; mpol_new() checks flags\n\t\t */\n\t\tif (nodelist)\n\t\t\tgoto out;\n\t\tmode = MPOL_PREFERRED;\n\t\tbreak;\n\tcase MPOL_DEFAULT:\n\t\t/*\n\t\t * Insist on a empty nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\terr = 0;\n\t\tgoto out;\n\tcase MPOL_BIND:\n\t\t/*\n\t\t * Insist on a nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\tgoto out;\n\t}\n\n\tmode_flags = 0;\n\tif (flags) {\n\t\t/*\n\t\t * Currently, we only support two mutually exclusive\n\t\t * mode flags.\n\t\t */\n\t\tif (!strcmp(flags, \"static\"))\n\t\t\tmode_flags |= MPOL_F_STATIC_NODES;\n\t\telse if (!strcmp(flags, \"relative\"))\n\t\t\tmode_flags |= MPOL_F_RELATIVE_NODES;\n\t\telse\n\t\t\tgoto out;\n\t}\n\n\tnew = mpol_new(mode, mode_flags, &nodes);\n\tif (IS_ERR(new))\n\t\tgoto out;\n\n\t/*\n\t * Save nodes for mpol_to_str() to show the tmpfs mount options\n\t * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo.\n\t */\n\tif (mode != MPOL_PREFERRED)\n\t\tnew->v.nodes = nodes;\n\telse if (nodelist)\n\t\tnew->v.preferred_node = first_node(nodes);\n\telse\n\t\tnew->flags |= MPOL_F_LOCAL;\n\n\t/*\n\t * Save nodes for contextualization: this will be used to \"clone\"\n\t * the mempolicy in a specific context [cpuset] at a later time.\n\t */\n\tnew->w.user_nodemask = nodes;\n\n\terr = 0;\n\nout:\n\t/* Restore string for error message */\n\tif (nodelist)\n\t\t*--nodelist = ':';\n\tif (flags)\n\t\t*--flags = '=';\n\tif (!err)\n\t\t*mpol = new;\n\treturn err;\n}","lang":"c","vul_type":"cwe-787","target_token_count":746,"sven_meta":{"func_name":"mpol_parse_str","file_name":"mm/mempolicy.c","commit_link":"github.com/torvalds/linux/commit/aa9f7d5172fac9bf1f09e678c35e287a40a7b7dd","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#4-c0c883b6ed3a","input":"keycompare_mb (const struct line *a, const struct line *b)\n{\n struct keyfield *key = keylist;\n\n /* For the first iteration only, the key positions have been\n precomputed for us. */\n char *texta = a->keybeg;\n char *textb = b->keybeg;\n char *lima = a->keylim;\n char *limb = b->keylim;\n\n size_t mblength_a, mblength_b;\n wchar_t wc_a, wc_b;\n mbstate_t state_a, state_b;\n\n int diff = 0;\n\n memset (&state_a, '\\0', sizeof(mbstate_t));\n memset (&state_b, '\\0', sizeof(mbstate_t));\n /* Ignore keys with start after end. */\n if (a->keybeg - a->keylim > 0)\n return 0;\n\n\n /* Ignore and/or translate chars before comparing. */\n# define IGNORE_CHARS(NEW_LEN, LEN, TEXT, COPY, WC, MBLENGTH, STATE) \\\n do \\\n { \\\n wchar_t uwc; \\\n char mbc[MB_LEN_MAX]; \\\n mbstate_t state_wc; \\\n \\\n for (NEW_LEN = i = 0; i < LEN;) \\\n { \\\n mbstate_t state_bak; \\\n \\\n state_bak = STATE; \\\n MBLENGTH = mbrtowc (&WC, TEXT + i, LEN - i, &STATE); \\\n \\\n if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1 \\\n || MBLENGTH == 0) \\\n { \\\n if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \\\n STATE = state_bak; \\\n if (!ignore) \\\n COPY[NEW_LEN++] = TEXT[i]; \\\n i++; \\\n continue; \\\n } \\\n \\\n if (ignore) \\\n { \\\n if ((ignore == nonprinting && !iswprint (WC)) \\\n || (ignore == nondictionary \\\n && !iswalnum (WC) && !iswblank (WC))) \\\n { \\\n i += MBLENGTH; \\\n continue; \\\n } \\\n } \\\n \\\n if (translate) \\\n { \\\n \\\n uwc = towupper(WC); \\\n if (WC == uwc) \\\n { \\\n memcpy (mbc, TEXT + i, MBLENGTH); \\\n i += MBLENGTH; \\\n } \\\n else \\\n { \\\n i += MBLENGTH; \\\n WC = uwc; \\\n memset (&state_wc, '\\0', sizeof (mbstate_t)); \\\n \\\n MBLENGTH = wcrtomb (mbc, WC, &state_wc); \\\n assert (MBLENGTH != (size_t)-1 && MBLENGTH != 0); \\\n } \\\n \\\n for (j = 0; j < MBLENGTH; j++) \\\n COPY[NEW_LEN++] = mbc[j]; \\\n } \\\n else \\\n for (j = 0; j < MBLENGTH; j++) \\\n COPY[NEW_LEN++] = TEXT[i++]; \\\n } \\\n COPY[NEW_LEN] = '\\0'; \\\n } \\\n while (0)\n\n /* Actually compare the fields. */\n\n for (;;)\n {\n /* Find the lengths. */\n size_t lena = lima <= texta ? 0 : lima - texta;\n size_t lenb = limb <= textb ? 0 : limb - textb;\n\n char enda IF_LINT (= 0);\n char endb IF_LINT (= 0);\n\n char const *translate = key->translate;\n bool const *ignore = key->ignore;\n\n if (ignore || translate)\n {\n char *copy_a = (char *) xmalloc (lena + 1 + lenb + 1);\n char *copy_b = copy_a + lena + 1;\n size_t new_len_a, new_len_b;\n size_t i, j;\n\n IGNORE_CHARS (new_len_a, lena, texta, copy_a,\n wc_a, mblength_a, state_a);\n IGNORE_CHARS (new_len_b, lenb, textb, copy_b,\n wc_b, mblength_b, state_b);\n texta = copy_a; textb = copy_b;\n lena = new_len_a; lenb = new_len_b;\n }\n else\n {\n /* Use the keys in-place, temporarily null-terminated. */\n enda = texta[lena]; texta[lena] = '\\0';\n endb = textb[lenb]; textb[lenb] = '\\0';\n }\n\n if (key->random)\n diff = compare_random (texta, lena, textb, lenb);\n else if (key->numeric | key->general_numeric | key->human_numeric)\n {\n char savea = *lima, saveb = *limb;\n\n *lima = *limb = '\\0';\n diff = (key->numeric ? numcompare (texta, textb)\n : key->general_numeric ? general_numcompare (texta, textb)\n : human_numcompare (texta, textb));\n *lima = savea, *limb = saveb;\n }\n else if (key->version)\n diff = filevercmp (texta, textb);\n else if (key->month)\n diff = getmonth (texta, lena, NULL) - getmonth (textb, lenb, NULL);\n else if (lena == 0)\n diff = - NONZERO (lenb);\n else if (lenb == 0)\n diff = 1;\n else if (hard_LC_COLLATE && !folding)\n {\n diff = xmemcoll0 (texta, lena + 1, textb, lenb + 1);\n }\n else\n {\n diff = memcmp (texta, textb, MIN (lena, lenb));\n if (diff == 0)\n diff = lena < lenb ? -1 : lena != lenb;\n }\n\n if (ignore || translate)\n free (texta);\n else\n {\n texta[lena] = enda;\n textb[lenb] = endb;\n }\n\n if (diff)\n goto not_equal;\n\n key = key->next;\n if (! key)\n break;\n\n /* Find the beginning and limit of the next field. */\n if (key->eword != -1)\n lima = limfield (a, key), limb = limfield (b, key);\n else\n lima = a->text + a->length - 1, limb = b->text + b->length - 1;\n\n if (key->sword != -1)\n texta = begfield (a, key), textb = begfield (b, key);\n else\n {\n texta = a->text, textb = b->text;\n if (key->skipsblanks)\n {\n while (texta < lima && ismbblank (texta, lima - texta, &mblength_a))\n texta += mblength_a;\n while (textb < limb && ismbblank (textb, limb - textb, &mblength_b))\n textb += mblength_b;\n }\n }\n }\n\nnot_equal:\n if (key && key->reverse)\n return -diff;\n else\n return diff;\n}","target":"keycompare_mb (const struct line *a, const struct line *b)\n{\n struct keyfield *key = keylist;\n\n /* For the first iteration only, the key positions have been\n precomputed for us. */\n char *texta = a->keybeg;\n char *textb = b->keybeg;\n char *lima = a->keylim;\n char *limb = b->keylim;\n\n size_t mblength_a, mblength_b;\n wchar_t wc_a, wc_b;\n mbstate_t state_a, state_b;\n\n int diff = 0;\n\n memset (&state_a, '\\0', sizeof(mbstate_t));\n memset (&state_b, '\\0', sizeof(mbstate_t));\n /* Ignore keys with start after end. */\n if (a->keybeg - a->keylim > 0)\n return 0;\n\n\n /* Ignore and/or translate chars before comparing. */\n# define IGNORE_CHARS(NEW_LEN, LEN, TEXT, COPY, WC, MBLENGTH, STATE) \\\n do \\\n { \\\n wchar_t uwc; \\\n char mbc[MB_LEN_MAX]; \\\n mbstate_t state_wc; \\\n \\\n for (NEW_LEN = i = 0; i < LEN;) \\\n { \\\n mbstate_t state_bak; \\\n \\\n state_bak = STATE; \\\n MBLENGTH = mbrtowc (&WC, TEXT + i, LEN - i, &STATE); \\\n \\\n if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1 \\\n || MBLENGTH == 0) \\\n { \\\n if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \\\n STATE = state_bak; \\\n if (!ignore) \\\n COPY[NEW_LEN++] = TEXT[i]; \\\n i++; \\\n continue; \\\n } \\\n \\\n if (ignore) \\\n { \\\n if ((ignore == nonprinting && !iswprint (WC)) \\\n || (ignore == nondictionary \\\n && !iswalnum (WC) && !iswblank (WC))) \\\n { \\\n i += MBLENGTH; \\\n continue; \\\n } \\\n } \\\n \\\n if (translate) \\\n { \\\n \\\n uwc = towupper(WC); \\\n if (WC == uwc) \\\n { \\\n memcpy (mbc, TEXT + i, MBLENGTH); \\\n i += MBLENGTH; \\\n } \\\n else \\\n { \\\n i += MBLENGTH; \\\n WC = uwc; \\\n memset (&state_wc, '\\0', sizeof (mbstate_t)); \\\n \\\n MBLENGTH = wcrtomb (mbc, WC, &state_wc); \\\n assert (MBLENGTH != (size_t)-1 && MBLENGTH != 0); \\\n } \\\n \\\n for (j = 0; j < MBLENGTH; j++) \\\n COPY[NEW_LEN++] = mbc[j]; \\\n } \\\n else \\\n for (j = 0; j < MBLENGTH; j++) \\\n COPY[NEW_LEN++] = TEXT[i++]; \\\n } \\\n COPY[NEW_LEN] = '\\0'; \\\n } \\\n while (0)\n\n /* Actually compare the fields. */\n\n for (;;)\n {\n /* Find the lengths. */\n size_t lena = lima <= texta ? 0 : lima - texta;\n size_t lenb = limb <= textb ? 0 : limb - textb;\n\n char enda IF_LINT (= 0);\n char endb IF_LINT (= 0);\n\n char const *translate = key->translate;\n bool const *ignore = key->ignore;\n\n if (ignore || translate)\n {\n if (SIZE_MAX - lenb - 2 < lena)\n xalloc_die ();\n char *copy_a = (char *) xnmalloc (lena + lenb + 2, MB_CUR_MAX);\n char *copy_b = copy_a + lena * MB_CUR_MAX + 1;\n size_t new_len_a, new_len_b;\n size_t i, j;\n\n IGNORE_CHARS (new_len_a, lena, texta, copy_a,\n wc_a, mblength_a, state_a);\n IGNORE_CHARS (new_len_b, lenb, textb, copy_b,\n wc_b, mblength_b, state_b);\n texta = copy_a; textb = copy_b;\n lena = new_len_a; lenb = new_len_b;\n }\n else\n {\n /* Use the keys in-place, temporarily null-terminated. */\n enda = texta[lena]; texta[lena] = '\\0';\n endb = textb[lenb]; textb[lenb] = '\\0';\n }\n\n if (key->random)\n diff = compare_random (texta, lena, textb, lenb);\n else if (key->numeric | key->general_numeric | key->human_numeric)\n {\n char savea = *lima, saveb = *limb;\n\n *lima = *limb = '\\0';\n diff = (key->numeric ? numcompare (texta, textb)\n : key->general_numeric ? general_numcompare (texta, textb)\n : human_numcompare (texta, textb));\n *lima = savea, *limb = saveb;\n }\n else if (key->version)\n diff = filevercmp (texta, textb);\n else if (key->month)\n diff = getmonth (texta, lena, NULL) - getmonth (textb, lenb, NULL);\n else if (lena == 0)\n diff = - NONZERO (lenb);\n else if (lenb == 0)\n diff = 1;\n else if (hard_LC_COLLATE && !folding)\n {\n diff = xmemcoll0 (texta, lena + 1, textb, lenb + 1);\n }\n else\n {\n diff = memcmp (texta, textb, MIN (lena, lenb));\n if (diff == 0)\n diff = lena < lenb ? -1 : lena != lenb;\n }\n\n if (ignore || translate)\n free (texta);\n else\n {\n texta[lena] = enda;\n textb[lenb] = endb;\n }\n\n if (diff)\n goto not_equal;\n\n key = key->next;\n if (! key)\n break;\n\n /* Find the beginning and limit of the next field. */\n if (key->eword != -1)\n lima = limfield (a, key), limb = limfield (b, key);\n else\n lima = a->text + a->length - 1, limb = b->text + b->length - 1;\n\n if (key->sword != -1)\n texta = begfield (a, key), textb = begfield (b, key);\n else\n {\n texta = a->text, textb = b->text;\n if (key->skipsblanks)\n {\n while (texta < lima && ismbblank (texta, lima - texta, &mblength_a))\n texta += mblength_a;\n while (textb < limb && ismbblank (textb, limb - textb, &mblength_b))\n textb += mblength_b;\n }\n }\n }\n\nnot_equal:\n if (key && key->reverse)\n return -diff;\n else\n return diff;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1732,"sven_meta":{"func_name":"keycompare_mb","file_name":"src/sort.c","commit_link":"github.com/pixelb/coreutils/commit/bea5e36cc876ed627bb5e0eca36fdfaa6465e940","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#5-46586135959f","input":"next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,\n\t int* vs_israw, int v_israw,\n\t enum CCVALTYPE intype, enum CCVALTYPE* type,\n\t enum CCSTATE* state, ScanEnv* env)\n{\n int r;\n\n switch (*state) {\n case CCS_VALUE:\n if (*type == CCV_SB) {\n BITSET_SET_BIT(cc->bs, (int )(*vs));\n }\n else if (*type == CCV_CODE_POINT) {\n r = add_code_range(&(cc->mbuf), env, *vs, *vs);\n if (r < 0) return r;\n }\n break;\n\n case CCS_RANGE:\n if (intype == *type) {\n if (intype == CCV_SB) {\n if (*vs > 0xff || v > 0xff)\n return ONIGERR_INVALID_CODE_POINT_VALUE;\n\n if (*vs > v) {\n if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC))\n goto ccs_range_end;\n else\n return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS;\n }\n bitset_set_range(cc->bs, (int )*vs, (int )v);\n }\n else {\n r = add_code_range(&(cc->mbuf), env, *vs, v);\n if (r < 0) return r;\n }\n }\n else {\n#if 0\n if (intype == CCV_CODE_POINT && *type == CCV_SB) {\n#endif\n if (*vs > v) {\n if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC))\n goto ccs_range_end;\n else\n return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS;\n }\n bitset_set_range(cc->bs, (int )*vs, (int )(v < 0xff ? v : 0xff));\n r = add_code_range(&(cc->mbuf), env, (OnigCodePoint )*vs, v);\n if (r < 0) return r;\n#if 0\n }\n else\n return ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE;\n#endif\n }\n ccs_range_end:\n *state = CCS_COMPLETE;\n break;\n\n case CCS_COMPLETE:\n case CCS_START:\n *state = CCS_VALUE;\n break;\n\n default:\n break;\n }\n\n *vs_israw = v_israw;\n *vs = v;\n *type = intype;\n return 0;\n}","target":"next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,\n\t int* vs_israw, int v_israw,\n\t enum CCVALTYPE intype, enum CCVALTYPE* type,\n\t enum CCSTATE* state, ScanEnv* env)\n{\n int r;\n\n switch (*state) {\n case CCS_VALUE:\n if (*type == CCV_SB) {\n if (*vs > 0xff)\n return ONIGERR_INVALID_CODE_POINT_VALUE;\n\n BITSET_SET_BIT(cc->bs, (int )(*vs));\n }\n else if (*type == CCV_CODE_POINT) {\n r = add_code_range(&(cc->mbuf), env, *vs, *vs);\n if (r < 0) return r;\n }\n break;\n\n case CCS_RANGE:\n if (intype == *type) {\n if (intype == CCV_SB) {\n if (*vs > 0xff || v > 0xff)\n return ONIGERR_INVALID_CODE_POINT_VALUE;\n\n if (*vs > v) {\n if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC))\n goto ccs_range_end;\n else\n return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS;\n }\n bitset_set_range(cc->bs, (int )*vs, (int )v);\n }\n else {\n r = add_code_range(&(cc->mbuf), env, *vs, v);\n if (r < 0) return r;\n }\n }\n else {\n#if 0\n if (intype == CCV_CODE_POINT && *type == CCV_SB) {\n#endif\n if (*vs > v) {\n if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC))\n goto ccs_range_end;\n else\n return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS;\n }\n bitset_set_range(cc->bs, (int )*vs, (int )(v < 0xff ? v : 0xff));\n r = add_code_range(&(cc->mbuf), env, (OnigCodePoint )*vs, v);\n if (r < 0) return r;\n#if 0\n }\n else\n return ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE;\n#endif\n }\n ccs_range_end:\n *state = CCS_COMPLETE;\n break;\n\n case CCS_COMPLETE:\n case CCS_START:\n *state = CCS_VALUE;\n break;\n\n default:\n break;\n }\n\n *vs_israw = v_israw;\n *vs = v;\n *type = intype;\n return 0;\n}","lang":"c","vul_type":"cwe-787","target_token_count":577,"sven_meta":{"func_name":"next_state_val","file_name":"src/regparse.c","commit_link":"github.com/kkos/oniguruma/commit/b4bf968ad52afe14e60a2dc8a95d3555c543353a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#6-ca81f6b34f54","input":"static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,\n CodedBitstreamFragment *frag,\n int header)\n{\n AVBufferRef *data_ref;\n uint8_t *data;\n size_t data_size;\n int unit, start, end, marker, next_start, next_marker;\n int err, i, j, length;\n\n if (frag->data_size < 4) {\n // Definitely too short to be meaningful.\n return AVERROR_INVALIDDATA;\n }\n\n for (i = 0; i + 1 < frag->data_size && frag->data[i] != 0xff; i++);\n if (i > 0) {\n av_log(ctx->log_ctx, AV_LOG_WARNING, \"Discarding %d bytes at \"\n \"beginning of image.\\n\", i);\n }\n for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size && frag->data[i]) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"no SOI marker found.\\n\");\n return AVERROR_INVALIDDATA;\n }\n marker = frag->data[i];\n if (marker != JPEG_MARKER_SOI) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: first \"\n \"marker is %02x, should be SOI.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"no image content found.\\n\");\n return AVERROR_INVALIDDATA;\n }\n marker = frag->data[i];\n start = i + 1;\n\n for (unit = 0;; unit++) {\n if (marker == JPEG_MARKER_EOI) {\n break;\n } else if (marker == JPEG_MARKER_SOS) {\n for (i = start; i + 1 < frag->data_size; i++) {\n if (frag->data[i] != 0xff)\n continue;\n end = i;\n for (++i; i + 1 < frag->data_size &&\n frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n next_marker = -1;\n } else {\n if (frag->data[i] == 0x00)\n continue;\n next_marker = frag->data[i];\n next_start = i + 1;\n }\n break;\n }\n } else {\n i = start;\n if (i + 2 > frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"truncated at %02x marker.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n length = AV_RB16(frag->data + i);\n if (i + length > frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"truncated at %02x marker segment.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n end = start + length;\n\n i = end;\n if (frag->data[i] != 0xff) {\n next_marker = -1;\n } else {\n for (++i; i + 1 < frag->data_size &&\n frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n next_marker = -1;\n } else {\n next_marker = frag->data[i];\n next_start = i + 1;\n }\n }\n }\n\n if (marker == JPEG_MARKER_SOS) {\n length = AV_RB16(frag->data + start);\n\n data_ref = NULL;\n data = av_malloc(end - start +\n AV_INPUT_BUFFER_PADDING_SIZE);\n if (!data)\n return AVERROR(ENOMEM);\n\n memcpy(data, frag->data + start, length);\n for (i = start + length, j = length; i < end; i++, j++) {\n if (frag->data[i] == 0xff) {\n while (frag->data[i] == 0xff)\n ++i;\n data[j] = 0xff;\n } else {\n data[j] = frag->data[i];\n }\n }\n data_size = j;\n\n memset(data + data_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);\n\n } else {\n data = frag->data + start;\n data_size = end - start;\n data_ref = frag->data_ref;\n }\n\n err = ff_cbs_insert_unit_data(ctx, frag, unit, marker,\n data, data_size, data_ref);\n if (err < 0)\n return err;\n\n if (next_marker == -1)\n break;\n marker = next_marker;\n start = next_start;\n }\n\n return 0;\n}","target":"static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,\n CodedBitstreamFragment *frag,\n int header)\n{\n AVBufferRef *data_ref;\n uint8_t *data;\n size_t data_size;\n int unit, start, end, marker, next_start, next_marker;\n int err, i, j, length;\n\n if (frag->data_size < 4) {\n // Definitely too short to be meaningful.\n return AVERROR_INVALIDDATA;\n }\n\n for (i = 0; i + 1 < frag->data_size && frag->data[i] != 0xff; i++);\n if (i > 0) {\n av_log(ctx->log_ctx, AV_LOG_WARNING, \"Discarding %d bytes at \"\n \"beginning of image.\\n\", i);\n }\n for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size && frag->data[i]) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"no SOI marker found.\\n\");\n return AVERROR_INVALIDDATA;\n }\n marker = frag->data[i];\n if (marker != JPEG_MARKER_SOI) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: first \"\n \"marker is %02x, should be SOI.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"no image content found.\\n\");\n return AVERROR_INVALIDDATA;\n }\n marker = frag->data[i];\n start = i + 1;\n\n for (unit = 0;; unit++) {\n if (marker == JPEG_MARKER_EOI) {\n break;\n } else if (marker == JPEG_MARKER_SOS) {\n for (i = start; i + 1 < frag->data_size; i++) {\n if (frag->data[i] != 0xff)\n continue;\n end = i;\n for (++i; i + 1 < frag->data_size &&\n frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n next_marker = -1;\n } else {\n if (frag->data[i] == 0x00)\n continue;\n next_marker = frag->data[i];\n next_start = i + 1;\n }\n break;\n }\n } else {\n i = start;\n if (i + 2 > frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"truncated at %02x marker.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n length = AV_RB16(frag->data + i);\n if (i + length > frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"truncated at %02x marker segment.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n end = start + length;\n\n i = end;\n if (frag->data[i] != 0xff) {\n next_marker = -1;\n } else {\n for (++i; i + 1 < frag->data_size &&\n frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n next_marker = -1;\n } else {\n next_marker = frag->data[i];\n next_start = i + 1;\n }\n }\n }\n\n if (marker == JPEG_MARKER_SOS) {\n length = AV_RB16(frag->data + start);\n\n if (length > end - start)\n return AVERROR_INVALIDDATA;\n\n data_ref = NULL;\n data = av_malloc(end - start +\n AV_INPUT_BUFFER_PADDING_SIZE);\n if (!data)\n return AVERROR(ENOMEM);\n\n memcpy(data, frag->data + start, length);\n for (i = start + length, j = length; i < end; i++, j++) {\n if (frag->data[i] == 0xff) {\n while (frag->data[i] == 0xff)\n ++i;\n data[j] = 0xff;\n } else {\n data[j] = frag->data[i];\n }\n }\n data_size = j;\n\n memset(data + data_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);\n\n } else {\n data = frag->data + start;\n data_size = end - start;\n data_ref = frag->data_ref;\n }\n\n err = ff_cbs_insert_unit_data(ctx, frag, unit, marker,\n data, data_size, data_ref);\n if (err < 0)\n return err;\n\n if (next_marker == -1)\n break;\n marker = next_marker;\n start = next_start;\n }\n\n return 0;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1142,"sven_meta":{"func_name":"cbs_jpeg_split_fragment","file_name":"libavcodec/cbs_jpeg.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/1812352d767ccf5431aa440123e2e260a4db2726","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#7-9f95cd1e2f00","input":"void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,\n int linesize_align[AV_NUM_DATA_POINTERS])\n{\n int i;\n int w_align = 1;\n int h_align = 1;\n AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);\n\n if (desc) {\n w_align = 1 << desc->log2_chroma_w;\n h_align = 1 << desc->log2_chroma_h;\n }\n\n switch (s->pix_fmt) {\n case AV_PIX_FMT_YUV420P:\n case AV_PIX_FMT_YUYV422:\n case AV_PIX_FMT_YVYU422:\n case AV_PIX_FMT_UYVY422:\n case AV_PIX_FMT_YUV422P:\n case AV_PIX_FMT_YUV440P:\n case AV_PIX_FMT_YUV444P:\n case AV_PIX_FMT_GBRP:\n case AV_PIX_FMT_GBRAP:\n case AV_PIX_FMT_GRAY8:\n case AV_PIX_FMT_GRAY16BE:\n case AV_PIX_FMT_GRAY16LE:\n case AV_PIX_FMT_YUVJ420P:\n case AV_PIX_FMT_YUVJ422P:\n case AV_PIX_FMT_YUVJ440P:\n case AV_PIX_FMT_YUVJ444P:\n case AV_PIX_FMT_YUVA420P:\n case AV_PIX_FMT_YUVA422P:\n case AV_PIX_FMT_YUVA444P:\n case AV_PIX_FMT_YUV420P9LE:\n case AV_PIX_FMT_YUV420P9BE:\n case AV_PIX_FMT_YUV420P10LE:\n case AV_PIX_FMT_YUV420P10BE:\n case AV_PIX_FMT_YUV420P12LE:\n case AV_PIX_FMT_YUV420P12BE:\n case AV_PIX_FMT_YUV420P14LE:\n case AV_PIX_FMT_YUV420P14BE:\n case AV_PIX_FMT_YUV420P16LE:\n case AV_PIX_FMT_YUV420P16BE:\n case AV_PIX_FMT_YUVA420P9LE:\n case AV_PIX_FMT_YUVA420P9BE:\n case AV_PIX_FMT_YUVA420P10LE:\n case AV_PIX_FMT_YUVA420P10BE:\n case AV_PIX_FMT_YUVA420P16LE:\n case AV_PIX_FMT_YUVA420P16BE:\n case AV_PIX_FMT_YUV422P9LE:\n case AV_PIX_FMT_YUV422P9BE:\n case AV_PIX_FMT_YUV422P10LE:\n case AV_PIX_FMT_YUV422P10BE:\n case AV_PIX_FMT_YUV422P12LE:\n case AV_PIX_FMT_YUV422P12BE:\n case AV_PIX_FMT_YUV422P14LE:\n case AV_PIX_FMT_YUV422P14BE:\n case AV_PIX_FMT_YUV422P16LE:\n case AV_PIX_FMT_YUV422P16BE:\n case AV_PIX_FMT_YUVA422P9LE:\n case AV_PIX_FMT_YUVA422P9BE:\n case AV_PIX_FMT_YUVA422P10LE:\n case AV_PIX_FMT_YUVA422P10BE:\n case AV_PIX_FMT_YUVA422P16LE:\n case AV_PIX_FMT_YUVA422P16BE:\n case AV_PIX_FMT_YUV440P10LE:\n case AV_PIX_FMT_YUV440P10BE:\n case AV_PIX_FMT_YUV440P12LE:\n case AV_PIX_FMT_YUV440P12BE:\n case AV_PIX_FMT_YUV444P9LE:\n case AV_PIX_FMT_YUV444P9BE:\n case AV_PIX_FMT_YUV444P10LE:\n case AV_PIX_FMT_YUV444P10BE:\n case AV_PIX_FMT_YUV444P12LE:\n case AV_PIX_FMT_YUV444P12BE:\n case AV_PIX_FMT_YUV444P14LE:\n case AV_PIX_FMT_YUV444P14BE:\n case AV_PIX_FMT_YUV444P16LE:\n case AV_PIX_FMT_YUV444P16BE:\n case AV_PIX_FMT_YUVA444P9LE:\n case AV_PIX_FMT_YUVA444P9BE:\n case AV_PIX_FMT_YUVA444P10LE:\n case AV_PIX_FMT_YUVA444P10BE:\n case AV_PIX_FMT_YUVA444P16LE:\n case AV_PIX_FMT_YUVA444P16BE:\n case AV_PIX_FMT_GBRP9LE:\n case AV_PIX_FMT_GBRP9BE:\n case AV_PIX_FMT_GBRP10LE:\n case AV_PIX_FMT_GBRP10BE:\n case AV_PIX_FMT_GBRP12LE:\n case AV_PIX_FMT_GBRP12BE:\n case AV_PIX_FMT_GBRP14LE:\n case AV_PIX_FMT_GBRP14BE:\n case AV_PIX_FMT_GBRP16LE:\n case AV_PIX_FMT_GBRP16BE:\n case AV_PIX_FMT_GBRAP12LE:\n case AV_PIX_FMT_GBRAP12BE:\n case AV_PIX_FMT_GBRAP16LE:\n case AV_PIX_FMT_GBRAP16BE:\n w_align = 16; //FIXME assume 16 pixel per macroblock\n h_align = 16 * 2; // interlaced needs 2 macroblocks height\n break;\n case AV_PIX_FMT_YUV411P:\n case AV_PIX_FMT_YUVJ411P:\n case AV_PIX_FMT_UYYVYY411:\n w_align = 32;\n h_align = 16 * 2;\n break;\n case AV_PIX_FMT_YUV410P:\n if (s->codec_id == AV_CODEC_ID_SVQ1) {\n w_align = 64;\n h_align = 64;\n }\n break;\n case AV_PIX_FMT_RGB555:\n if (s->codec_id == AV_CODEC_ID_RPZA) {\n w_align = 4;\n h_align = 4;\n }\n break;\n case AV_PIX_FMT_PAL8:\n case AV_PIX_FMT_BGR8:\n case AV_PIX_FMT_RGB8:\n if (s->codec_id == AV_CODEC_ID_SMC ||\n s->codec_id == AV_CODEC_ID_CINEPAK) {\n w_align = 4;\n h_align = 4;\n }\n if (s->codec_id == AV_CODEC_ID_JV) {\n w_align = 8;\n h_align = 8;\n }\n break;\n case AV_PIX_FMT_BGR24:\n if ((s->codec_id == AV_CODEC_ID_MSZH) ||\n (s->codec_id == AV_CODEC_ID_ZLIB)) {\n w_align = 4;\n h_align = 4;\n }\n break;\n case AV_PIX_FMT_RGB24:\n if (s->codec_id == AV_CODEC_ID_CINEPAK) {\n w_align = 4;\n h_align = 4;\n }\n break;\n default:\n break;\n }\n\n if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {\n w_align = FFMAX(w_align, 8);\n }\n\n *width = FFALIGN(*width, w_align);\n *height = FFALIGN(*height, h_align);\n if (s->codec_id == AV_CODEC_ID_H264 || s->lowres) {\n // some of the optimized chroma MC reads one line too much\n // which is also done in mpeg decoders with lowres > 0\n *height += 2;\n\n // H.264 uses edge emulation for out of frame motion vectors, for this\n // it requires a temporary area large enough to hold a 21x21 block,\n // increasing witdth ensure that the temporary area is large enough,\n // the next rounded up width is 32\n *width = FFMAX(*width, 32);\n }\n\n for (i = 0; i < 4; i++)\n linesize_align[i] = STRIDE_ALIGN;\n}","target":"void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,\n int linesize_align[AV_NUM_DATA_POINTERS])\n{\n int i;\n int w_align = 1;\n int h_align = 1;\n AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);\n\n if (desc) {\n w_align = 1 << desc->log2_chroma_w;\n h_align = 1 << desc->log2_chroma_h;\n }\n\n switch (s->pix_fmt) {\n case AV_PIX_FMT_YUV420P:\n case AV_PIX_FMT_YUYV422:\n case AV_PIX_FMT_YVYU422:\n case AV_PIX_FMT_UYVY422:\n case AV_PIX_FMT_YUV422P:\n case AV_PIX_FMT_YUV440P:\n case AV_PIX_FMT_YUV444P:\n case AV_PIX_FMT_GBRP:\n case AV_PIX_FMT_GBRAP:\n case AV_PIX_FMT_GRAY8:\n case AV_PIX_FMT_GRAY16BE:\n case AV_PIX_FMT_GRAY16LE:\n case AV_PIX_FMT_YUVJ420P:\n case AV_PIX_FMT_YUVJ422P:\n case AV_PIX_FMT_YUVJ440P:\n case AV_PIX_FMT_YUVJ444P:\n case AV_PIX_FMT_YUVA420P:\n case AV_PIX_FMT_YUVA422P:\n case AV_PIX_FMT_YUVA444P:\n case AV_PIX_FMT_YUV420P9LE:\n case AV_PIX_FMT_YUV420P9BE:\n case AV_PIX_FMT_YUV420P10LE:\n case AV_PIX_FMT_YUV420P10BE:\n case AV_PIX_FMT_YUV420P12LE:\n case AV_PIX_FMT_YUV420P12BE:\n case AV_PIX_FMT_YUV420P14LE:\n case AV_PIX_FMT_YUV420P14BE:\n case AV_PIX_FMT_YUV420P16LE:\n case AV_PIX_FMT_YUV420P16BE:\n case AV_PIX_FMT_YUVA420P9LE:\n case AV_PIX_FMT_YUVA420P9BE:\n case AV_PIX_FMT_YUVA420P10LE:\n case AV_PIX_FMT_YUVA420P10BE:\n case AV_PIX_FMT_YUVA420P16LE:\n case AV_PIX_FMT_YUVA420P16BE:\n case AV_PIX_FMT_YUV422P9LE:\n case AV_PIX_FMT_YUV422P9BE:\n case AV_PIX_FMT_YUV422P10LE:\n case AV_PIX_FMT_YUV422P10BE:\n case AV_PIX_FMT_YUV422P12LE:\n case AV_PIX_FMT_YUV422P12BE:\n case AV_PIX_FMT_YUV422P14LE:\n case AV_PIX_FMT_YUV422P14BE:\n case AV_PIX_FMT_YUV422P16LE:\n case AV_PIX_FMT_YUV422P16BE:\n case AV_PIX_FMT_YUVA422P9LE:\n case AV_PIX_FMT_YUVA422P9BE:\n case AV_PIX_FMT_YUVA422P10LE:\n case AV_PIX_FMT_YUVA422P10BE:\n case AV_PIX_FMT_YUVA422P16LE:\n case AV_PIX_FMT_YUVA422P16BE:\n case AV_PIX_FMT_YUV440P10LE:\n case AV_PIX_FMT_YUV440P10BE:\n case AV_PIX_FMT_YUV440P12LE:\n case AV_PIX_FMT_YUV440P12BE:\n case AV_PIX_FMT_YUV444P9LE:\n case AV_PIX_FMT_YUV444P9BE:\n case AV_PIX_FMT_YUV444P10LE:\n case AV_PIX_FMT_YUV444P10BE:\n case AV_PIX_FMT_YUV444P12LE:\n case AV_PIX_FMT_YUV444P12BE:\n case AV_PIX_FMT_YUV444P14LE:\n case AV_PIX_FMT_YUV444P14BE:\n case AV_PIX_FMT_YUV444P16LE:\n case AV_PIX_FMT_YUV444P16BE:\n case AV_PIX_FMT_YUVA444P9LE:\n case AV_PIX_FMT_YUVA444P9BE:\n case AV_PIX_FMT_YUVA444P10LE:\n case AV_PIX_FMT_YUVA444P10BE:\n case AV_PIX_FMT_YUVA444P16LE:\n case AV_PIX_FMT_YUVA444P16BE:\n case AV_PIX_FMT_GBRP9LE:\n case AV_PIX_FMT_GBRP9BE:\n case AV_PIX_FMT_GBRP10LE:\n case AV_PIX_FMT_GBRP10BE:\n case AV_PIX_FMT_GBRP12LE:\n case AV_PIX_FMT_GBRP12BE:\n case AV_PIX_FMT_GBRP14LE:\n case AV_PIX_FMT_GBRP14BE:\n case AV_PIX_FMT_GBRP16LE:\n case AV_PIX_FMT_GBRP16BE:\n case AV_PIX_FMT_GBRAP12LE:\n case AV_PIX_FMT_GBRAP12BE:\n case AV_PIX_FMT_GBRAP16LE:\n case AV_PIX_FMT_GBRAP16BE:\n w_align = 16; //FIXME assume 16 pixel per macroblock\n h_align = 16 * 2; // interlaced needs 2 macroblocks height\n break;\n case AV_PIX_FMT_YUV411P:\n case AV_PIX_FMT_YUVJ411P:\n case AV_PIX_FMT_UYYVYY411:\n w_align = 32;\n h_align = 16 * 2;\n break;\n case AV_PIX_FMT_YUV410P:\n if (s->codec_id == AV_CODEC_ID_SVQ1) {\n w_align = 64;\n h_align = 64;\n }\n break;\n case AV_PIX_FMT_RGB555:\n if (s->codec_id == AV_CODEC_ID_RPZA) {\n w_align = 4;\n h_align = 4;\n }\n if (s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {\n w_align = 8;\n h_align = 8;\n }\n break;\n case AV_PIX_FMT_PAL8:\n case AV_PIX_FMT_BGR8:\n case AV_PIX_FMT_RGB8:\n if (s->codec_id == AV_CODEC_ID_SMC ||\n s->codec_id == AV_CODEC_ID_CINEPAK) {\n w_align = 4;\n h_align = 4;\n }\n if (s->codec_id == AV_CODEC_ID_JV ||\n s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {\n w_align = 8;\n h_align = 8;\n }\n break;\n case AV_PIX_FMT_BGR24:\n if ((s->codec_id == AV_CODEC_ID_MSZH) ||\n (s->codec_id == AV_CODEC_ID_ZLIB)) {\n w_align = 4;\n h_align = 4;\n }\n break;\n case AV_PIX_FMT_RGB24:\n if (s->codec_id == AV_CODEC_ID_CINEPAK) {\n w_align = 4;\n h_align = 4;\n }\n break;\n default:\n break;\n }\n\n if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {\n w_align = FFMAX(w_align, 8);\n }\n\n *width = FFALIGN(*width, w_align);\n *height = FFALIGN(*height, h_align);\n if (s->codec_id == AV_CODEC_ID_H264 || s->lowres) {\n // some of the optimized chroma MC reads one line too much\n // which is also done in mpeg decoders with lowres > 0\n *height += 2;\n\n // H.264 uses edge emulation for out of frame motion vectors, for this\n // it requires a temporary area large enough to hold a 21x21 block,\n // increasing witdth ensure that the temporary area is large enough,\n // the next rounded up width is 32\n *width = FFMAX(*width, 32);\n }\n\n for (i = 0; i < 4; i++)\n linesize_align[i] = STRIDE_ALIGN;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1935,"sven_meta":{"func_name":"avcodec_align_dimensions2","file_name":"libavcodec/utils.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/2080bc33717955a0e4268e738acf8c1eeddbf8cb","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#8-a540590b95c1","input":"int ContentLine_Analyzer::DoDeliverOnce(int len, const u_char* data)\n\t{\n\tconst u_char* data_start = data;\n\n\tif ( len <= 0 )\n\t\treturn 0;\n\n\tfor ( ; len > 0; --len, ++data )\n\t\t{\n\t\tif ( offset >= buf_len )\n\t\t\tInitBuffer(buf_len * 2);\n\n\t\tint c = data[0];\n\n#define EMIT_LINE \\\n\t{ \\\n\tbuf[offset] = '\\0'; \\\n\tint seq_len = data + 1 - data_start; \\\n\tseq_delivered_in_lines = seq + seq_len; \\\n\tlast_char = c; \\\n\tForwardStream(offset, buf, IsOrig()); \\\n\toffset = 0; \\\n\treturn seq_len; \\\n\t}\n\n\t\tswitch ( c ) {\n\t\tcase '\\r':\n\t\t\t// Look ahead for '\\n'.\n\t\t\tif ( len > 1 && data[1] == '\\n' )\n\t\t\t\t{\n\t\t\t\t--len; ++data;\n\t\t\t\tlast_char = c;\n\t\t\t\tc = data[0];\n\t\t\t\tEMIT_LINE\n\t\t\t\t}\n\n\t\t\telse if ( CR_LF_as_EOL & CR_as_EOL )\n\t\t\t\tEMIT_LINE\n\n\t\t\telse\n\t\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\n\t\tcase '\\n':\n\t\t\tif ( last_char == '\\r' )\n\t\t\t\t{\n\t\t\t\t--offset; // remove '\\r'\n\t\t\t\tEMIT_LINE\n\t\t\t\t}\n\n\t\t\telse if ( CR_LF_as_EOL & LF_as_EOL )\n\t\t\t\tEMIT_LINE\n\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tif ( ! suppress_weirds && Conn()->FlagEvent(SINGULAR_LF) )\n\t\t\t\t\tConn()->Weird(\"line_terminated_with_single_LF\");\n\t\t\t\tbuf[offset++] = c;\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\tcase '\\0':\n\t\t\tif ( flag_NULs )\n\t\t\t\tCheckNUL();\n\t\t\telse\n\t\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\t\t}\n\n\t\tif ( last_char == '\\r' )\n\t\t\tif ( ! suppress_weirds && Conn()->FlagEvent(SINGULAR_CR) )\n\t\t\t\tConn()->Weird(\"line_terminated_with_single_CR\");\n\n\t\tlast_char = c;\n\t\t}\n\n\treturn data - data_start;\n\t}","target":"int ContentLine_Analyzer::DoDeliverOnce(int len, const u_char* data)\n\t{\n\tconst u_char* data_start = data;\n\n\tif ( len <= 0 )\n\t\treturn 0;\n\n\tfor ( ; len > 0; --len, ++data )\n\t\t{\n\t\tif ( offset >= buf_len )\n\t\t\tInitBuffer(buf_len * 2);\n\n\t\tint c = data[0];\n\n#define EMIT_LINE \\\n\t{ \\\n\tbuf[offset] = '\\0'; \\\n\tint seq_len = data + 1 - data_start; \\\n\tseq_delivered_in_lines = seq + seq_len; \\\n\tlast_char = c; \\\n\tForwardStream(offset, buf, IsOrig()); \\\n\toffset = 0; \\\n\treturn seq_len; \\\n\t}\n\n\t\tswitch ( c ) {\n\t\tcase '\\r':\n\t\t\t// Look ahead for '\\n'.\n\t\t\tif ( len > 1 && data[1] == '\\n' )\n\t\t\t\t{\n\t\t\t\t--len; ++data;\n\t\t\t\tlast_char = c;\n\t\t\t\tc = data[0];\n\t\t\t\tEMIT_LINE\n\t\t\t\t}\n\n\t\t\telse if ( CR_LF_as_EOL & CR_as_EOL )\n\t\t\t\tEMIT_LINE\n\n\t\t\telse\n\t\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\n\t\tcase '\\n':\n\t\t\tif ( last_char == '\\r' )\n\t\t\t\t{\n\t\t\t\t// Weird corner-case:\n\t\t\t\t// this can happen if we see a \\r at the end of a packet where crlf is\n\t\t\t\t// set to CR_as_EOL | LF_as_EOL, with the packet causing crlf to be set to\n\t\t\t\t// 0 and the next packet beginning with a \\n. In this case we just swallow\n\t\t\t\t// the character and re-set last_char.\n\t\t\t\tif ( offset == 0 )\n\t\t\t\t\t{\n\t\t\t\t\tlast_char = c;\n\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t--offset; // remove '\\r'\n\t\t\t\tEMIT_LINE\n\t\t\t\t}\n\n\t\t\telse if ( CR_LF_as_EOL & LF_as_EOL )\n\t\t\t\tEMIT_LINE\n\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tif ( ! suppress_weirds && Conn()->FlagEvent(SINGULAR_LF) )\n\t\t\t\t\tConn()->Weird(\"line_terminated_with_single_LF\");\n\t\t\t\tbuf[offset++] = c;\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\tcase '\\0':\n\t\t\tif ( flag_NULs )\n\t\t\t\tCheckNUL();\n\t\t\telse\n\t\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\t\t}\n\n\t\tif ( last_char == '\\r' )\n\t\t\tif ( ! suppress_weirds && Conn()->FlagEvent(SINGULAR_CR) )\n\t\t\t\tConn()->Weird(\"line_terminated_with_single_CR\");\n\n\t\tlast_char = c;\n\t\t}\n\n\treturn data - data_start;\n\t}","lang":"cpp","vul_type":"cwe-787","target_token_count":586,"sven_meta":{"func_name":"ContentLine_Analyzer::DoDeliverOnce","file_name":"src/analyzer/protocol/tcp/ContentLine.cc","commit_link":"github.com/bro/bro/commit/6c0f101a62489b1c5927b4ed63b0e1d37db40282","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#10-9007af95bfe5","input":"static int blosc_c(struct thread_context* thread_context, int32_t bsize,\n int32_t leftoverblock, int32_t ntbytes, int32_t maxbytes,\n const uint8_t* src, const int32_t offset, uint8_t* dest,\n uint8_t* tmp, uint8_t* tmp2) {\n blosc2_context* context = thread_context->parent_context;\n int dont_split = (context->header_flags & 0x10) >> 4;\n int dict_training = context->use_dict && context->dict_cdict == NULL;\n int32_t j, neblock, nstreams;\n int32_t cbytes; /* number of compressed bytes in split */\n int32_t ctbytes = 0; /* number of compressed bytes in block */\n int64_t maxout;\n int32_t typesize = context->typesize;\n const char* compname;\n int accel;\n const uint8_t* _src;\n uint8_t *_tmp = tmp, *_tmp2 = tmp2;\n uint8_t *_tmp3 = thread_context->tmp4;\n int last_filter_index = last_filter(context->filters, 'c');\n bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;\n\n if (last_filter_index >= 0 || context->prefilter != NULL) {\n /* Apply the filter pipeline just for the prefilter */\n if (memcpyed && context->prefilter != NULL) {\n // We only need the prefilter output\n _src = pipeline_c(thread_context, bsize, src, offset, dest, _tmp2, _tmp3);\n\n if (_src == NULL) {\n return -9; // signals a problem with the filter pipeline\n }\n return bsize;\n }\n /* Apply regular filter pipeline */\n _src = pipeline_c(thread_context, bsize, src, offset, _tmp, _tmp2, _tmp3);\n\n if (_src == NULL) {\n return -9; // signals a problem with the filter pipeline\n }\n } else {\n _src = src + offset;\n }\n\n assert(context->clevel > 0);\n\n /* Calculate acceleration for different compressors */\n accel = get_accel(context);\n\n /* The number of compressed data streams for this block */\n if (!dont_split && !leftoverblock && !dict_training) {\n nstreams = (int32_t)typesize;\n }\n else {\n nstreams = 1;\n }\n neblock = bsize / nstreams;\n for (j = 0; j < nstreams; j++) {\n if (!dict_training) {\n dest += sizeof(int32_t);\n ntbytes += sizeof(int32_t);\n ctbytes += sizeof(int32_t);\n }\n\n // See if we have a run here\n const uint8_t* ip = (uint8_t*)_src + j * neblock;\n const uint8_t* ipbound = (uint8_t*)_src + (j + 1) * neblock;\n if (get_run(ip, ipbound)) {\n // A run. Encode the repeated byte as a negative length in the length of the split.\n int32_t value = _src[j * neblock];\n _sw32(dest - 4, -value);\n continue;\n }\n\n maxout = neblock;\n #if defined(HAVE_SNAPPY)\n if (context->compcode == BLOSC_SNAPPY) {\n maxout = (int32_t)snappy_max_compressed_length((size_t)neblock);\n }\n #endif /* HAVE_SNAPPY */\n if (ntbytes + maxout > maxbytes) {\n /* avoid buffer * overrun */\n maxout = (int64_t)maxbytes - (int64_t)ntbytes;\n if (maxout <= 0) {\n return 0; /* non-compressible block */\n }\n }\n if (dict_training) {\n // We are in the build dict state, so don't compress\n // TODO: copy only a percentage for sampling\n memcpy(dest, _src + j * neblock, (unsigned int)neblock);\n cbytes = (int32_t)neblock;\n }\n else if (context->compcode == BLOSC_BLOSCLZ) {\n cbytes = blosclz_compress(context->clevel, _src + j * neblock,\n (int)neblock, dest, (int)maxout);\n }\n #if defined(HAVE_LZ4)\n else if (context->compcode == BLOSC_LZ4) {\n void *hash_table = NULL;\n #ifdef HAVE_IPP\n hash_table = (void*)thread_context->lz4_hash_table;\n #endif\n cbytes = lz4_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, accel, hash_table);\n }\n else if (context->compcode == BLOSC_LZ4HC) {\n cbytes = lz4hc_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_LZ4 */\n #if defined(HAVE_LIZARD)\n else if (context->compcode == BLOSC_LIZARD) {\n cbytes = lizard_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, accel);\n }\n #endif /* HAVE_LIZARD */\n #if defined(HAVE_SNAPPY)\n else if (context->compcode == BLOSC_SNAPPY) {\n cbytes = snappy_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout);\n }\n #endif /* HAVE_SNAPPY */\n #if defined(HAVE_ZLIB)\n else if (context->compcode == BLOSC_ZLIB) {\n cbytes = zlib_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_ZLIB */\n #if defined(HAVE_ZSTD)\n else if (context->compcode == BLOSC_ZSTD) {\n cbytes = zstd_wrap_compress(thread_context,\n (char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_ZSTD */\n\n else {\n blosc_compcode_to_compname(context->compcode, &compname);\n fprintf(stderr, \"Blosc has not been compiled with '%s' \", compname);\n fprintf(stderr, \"compression support. Please use one having it.\");\n return -5; /* signals no compression support */\n }\n\n if (cbytes > maxout) {\n /* Buffer overrun caused by compression (should never happen) */\n return -1;\n }\n if (cbytes < 0) {\n /* cbytes should never be negative */\n return -2;\n }\n if (!dict_training) {\n if (cbytes == 0 || cbytes == neblock) {\n /* The compressor has been unable to compress data at all. */\n /* Before doing the copy, check that we are not running into a\n buffer overflow. */\n if ((ntbytes + neblock) > maxbytes) {\n return 0; /* Non-compressible data */\n }\n memcpy(dest, _src + j * neblock, (unsigned int)neblock);\n cbytes = neblock;\n }\n _sw32(dest - 4, cbytes);\n }\n dest += cbytes;\n ntbytes += cbytes;\n ctbytes += cbytes;\n } /* Closes j < nstreams */\n\n //printf(\"c%d\", ctbytes);\n return ctbytes;\n}","target":"static int blosc_c(struct thread_context* thread_context, int32_t bsize,\n int32_t leftoverblock, int32_t ntbytes, int32_t destsize,\n const uint8_t* src, const int32_t offset, uint8_t* dest,\n uint8_t* tmp, uint8_t* tmp2) {\n blosc2_context* context = thread_context->parent_context;\n int dont_split = (context->header_flags & 0x10) >> 4;\n int dict_training = context->use_dict && context->dict_cdict == NULL;\n int32_t j, neblock, nstreams;\n int32_t cbytes; /* number of compressed bytes in split */\n int32_t ctbytes = 0; /* number of compressed bytes in block */\n int64_t maxout;\n int32_t typesize = context->typesize;\n const char* compname;\n int accel;\n const uint8_t* _src;\n uint8_t *_tmp = tmp, *_tmp2 = tmp2;\n uint8_t *_tmp3 = thread_context->tmp4;\n int last_filter_index = last_filter(context->filters, 'c');\n bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;\n\n if (last_filter_index >= 0 || context->prefilter != NULL) {\n /* Apply the filter pipeline just for the prefilter */\n if (memcpyed && context->prefilter != NULL) {\n // We only need the prefilter output\n _src = pipeline_c(thread_context, bsize, src, offset, dest, _tmp2, _tmp3);\n\n if (_src == NULL) {\n return -9; // signals a problem with the filter pipeline\n }\n return bsize;\n }\n /* Apply regular filter pipeline */\n _src = pipeline_c(thread_context, bsize, src, offset, _tmp, _tmp2, _tmp3);\n\n if (_src == NULL) {\n return -9; // signals a problem with the filter pipeline\n }\n } else {\n _src = src + offset;\n }\n\n assert(context->clevel > 0);\n\n /* Calculate acceleration for different compressors */\n accel = get_accel(context);\n\n /* The number of compressed data streams for this block */\n if (!dont_split && !leftoverblock && !dict_training) {\n nstreams = (int32_t)typesize;\n }\n else {\n nstreams = 1;\n }\n neblock = bsize / nstreams;\n for (j = 0; j < nstreams; j++) {\n if (!dict_training) {\n dest += sizeof(int32_t);\n ntbytes += sizeof(int32_t);\n ctbytes += sizeof(int32_t);\n }\n\n // See if we have a run here\n const uint8_t* ip = (uint8_t*)_src + j * neblock;\n const uint8_t* ipbound = (uint8_t*)_src + (j + 1) * neblock;\n if (get_run(ip, ipbound)) {\n // A run. Encode the repeated byte as a negative length in the length of the split.\n int32_t value = _src[j * neblock];\n if (ntbytes > destsize) {\n /* Not enough space to write out compressed block size */\n return -1;\n }\n _sw32(dest - 4, -value);\n continue;\n }\n\n maxout = neblock;\n #if defined(HAVE_SNAPPY)\n if (context->compcode == BLOSC_SNAPPY) {\n maxout = (int32_t)snappy_max_compressed_length((size_t)neblock);\n }\n #endif /* HAVE_SNAPPY */\n if (ntbytes + maxout > destsize) {\n /* avoid buffer * overrun */\n maxout = (int64_t)destsize - (int64_t)ntbytes;\n if (maxout <= 0) {\n return 0; /* non-compressible block */\n }\n }\n if (dict_training) {\n // We are in the build dict state, so don't compress\n // TODO: copy only a percentage for sampling\n memcpy(dest, _src + j * neblock, (unsigned int)neblock);\n cbytes = (int32_t)neblock;\n }\n else if (context->compcode == BLOSC_BLOSCLZ) {\n cbytes = blosclz_compress(context->clevel, _src + j * neblock,\n (int)neblock, dest, (int)maxout);\n }\n #if defined(HAVE_LZ4)\n else if (context->compcode == BLOSC_LZ4) {\n void *hash_table = NULL;\n #ifdef HAVE_IPP\n hash_table = (void*)thread_context->lz4_hash_table;\n #endif\n cbytes = lz4_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, accel, hash_table);\n }\n else if (context->compcode == BLOSC_LZ4HC) {\n cbytes = lz4hc_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_LZ4 */\n #if defined(HAVE_LIZARD)\n else if (context->compcode == BLOSC_LIZARD) {\n cbytes = lizard_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, accel);\n }\n #endif /* HAVE_LIZARD */\n #if defined(HAVE_SNAPPY)\n else if (context->compcode == BLOSC_SNAPPY) {\n cbytes = snappy_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout);\n }\n #endif /* HAVE_SNAPPY */\n #if defined(HAVE_ZLIB)\n else if (context->compcode == BLOSC_ZLIB) {\n cbytes = zlib_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_ZLIB */\n #if defined(HAVE_ZSTD)\n else if (context->compcode == BLOSC_ZSTD) {\n cbytes = zstd_wrap_compress(thread_context,\n (char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_ZSTD */\n\n else {\n blosc_compcode_to_compname(context->compcode, &compname);\n fprintf(stderr, \"Blosc has not been compiled with '%s' \", compname);\n fprintf(stderr, \"compression support. Please use one having it.\");\n return -5; /* signals no compression support */\n }\n\n if (cbytes > maxout) {\n /* Buffer overrun caused by compression (should never happen) */\n return -1;\n }\n if (cbytes < 0) {\n /* cbytes should never be negative */\n return -2;\n }\n if (!dict_training) {\n if (cbytes == 0 || cbytes == neblock) {\n /* The compressor has been unable to compress data at all. */\n /* Before doing the copy, check that we are not running into a\n buffer overflow. */\n if ((ntbytes + neblock) > destsize) {\n return 0; /* Non-compressible data */\n }\n memcpy(dest, _src + j * neblock, (unsigned int)neblock);\n cbytes = neblock;\n }\n _sw32(dest - 4, cbytes);\n }\n dest += cbytes;\n ntbytes += cbytes;\n ctbytes += cbytes;\n } /* Closes j < nstreams */\n\n //printf(\"c%d\", ctbytes);\n return ctbytes;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1825,"sven_meta":{"func_name":"blosc_c","file_name":"blosc/blosc2.c","commit_link":"github.com/Blosc/c-blosc2/commit/c4c6470e88210afc95262c8b9fcc27e30ca043ee","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#12-670696a3597d","input":"input_csi_dispatch_sgr_colon(struct input_ctx *ictx, u_int i)\n{\n\tstruct grid_cell\t*gc = &ictx->cell.cell;\n\tchar\t\t\t*s = ictx->param_list[i].str, *copy, *ptr, *out;\n\tint\t\t\t p[8];\n\tu_int\t\t\t n;\n\tconst char\t\t*errstr;\n\n\tfor (n = 0; n < nitems(p); n++)\n\t\tp[n] = -1;\n\tn = 0;\n\n\tptr = copy = xstrdup(s);\n\twhile ((out = strsep(&ptr, \":\")) != NULL) {\n\t\tif (*out != '\\0') {\n\t\t\tp[n++] = strtonum(out, 0, INT_MAX, &errstr);\n\t\t\tif (errstr != NULL || n == nitems(p)) {\n\t\t\t\tfree(copy);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else\n\t\t\tn++;\n\t\tlog_debug(\"%s: %u = %d\", __func__, n - 1, p[n - 1]);\n\t}\n\tfree(copy);\n\n\tif (n == 0)\n\t\treturn;\n\tif (p[0] == 4) {\n\t\tif (n != 2)\n\t\t\treturn;\n\t\tswitch (p[1]) {\n\t\tcase 0:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_2;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_3;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_4;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_5;\n\t\t\tbreak;\n\t\t}\n\t\treturn;\n\t}\n\tif (n < 2 || (p[0] != 38 && p[0] != 48 && p[0] != 58))\n\t\treturn;\n\tswitch (p[1]) {\n\tcase 2:\n\t\tif (n < 3)\n\t\t\tbreak;\n\t\tif (n == 5)\n\t\t\ti = 2;\n\t\telse\n\t\t\ti = 3;\n\t\tif (n < i + 3)\n\t\t\tbreak;\n\t\tinput_csi_dispatch_sgr_rgb_do(ictx, p[0], p[i], p[i + 1],\n\t\t p[i + 2]);\n\t\tbreak;\n\tcase 5:\n\t\tif (n < 3)\n\t\t\tbreak;\n\t\tinput_csi_dispatch_sgr_256_do(ictx, p[0], p[2]);\n\t\tbreak;\n\t}\n}","target":"input_csi_dispatch_sgr_colon(struct input_ctx *ictx, u_int i)\n{\n\tstruct grid_cell\t*gc = &ictx->cell.cell;\n\tchar\t\t\t*s = ictx->param_list[i].str, *copy, *ptr, *out;\n\tint\t\t\t p[8];\n\tu_int\t\t\t n;\n\tconst char\t\t*errstr;\n\n\tfor (n = 0; n < nitems(p); n++)\n\t\tp[n] = -1;\n\tn = 0;\n\n\tptr = copy = xstrdup(s);\n\twhile ((out = strsep(&ptr, \":\")) != NULL) {\n\t\tif (*out != '\\0') {\n\t\t\tp[n++] = strtonum(out, 0, INT_MAX, &errstr);\n\t\t\tif (errstr != NULL || n == nitems(p)) {\n\t\t\t\tfree(copy);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tn++;\n\t\t\tif (n == nitems(p)) {\n\t\t\t\tfree(copy);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tlog_debug(\"%s: %u = %d\", __func__, n - 1, p[n - 1]);\n\t}\n\tfree(copy);\n\n\tif (n == 0)\n\t\treturn;\n\tif (p[0] == 4) {\n\t\tif (n != 2)\n\t\t\treturn;\n\t\tswitch (p[1]) {\n\t\tcase 0:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_2;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_3;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_4;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_5;\n\t\t\tbreak;\n\t\t}\n\t\treturn;\n\t}\n\tif (n < 2 || (p[0] != 38 && p[0] != 48 && p[0] != 58))\n\t\treturn;\n\tswitch (p[1]) {\n\tcase 2:\n\t\tif (n < 3)\n\t\t\tbreak;\n\t\tif (n == 5)\n\t\t\ti = 2;\n\t\telse\n\t\t\ti = 3;\n\t\tif (n < i + 3)\n\t\t\tbreak;\n\t\tinput_csi_dispatch_sgr_rgb_do(ictx, p[0], p[i], p[i + 1],\n\t\t p[i + 2]);\n\t\tbreak;\n\tcase 5:\n\t\tif (n < 3)\n\t\t\tbreak;\n\t\tinput_csi_dispatch_sgr_256_do(ictx, p[0], p[2]);\n\t\tbreak;\n\t}\n}","lang":"c","vul_type":"cwe-787","target_token_count":659,"sven_meta":{"func_name":"input_csi_dispatch_sgr_colon","file_name":"input.c","commit_link":"github.com/tmux/tmux/commit/a868bacb46e3c900530bed47a1c6f85b0fbe701c","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#14-c2de46ef5043","input":"static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)\n{\n\tbool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;\n\tu32 chunk_size = mr->chunk_size, headroom = mr->headroom;\n\tunsigned int chunks, chunks_per_page;\n\tu64 addr = mr->addr, size = mr->len;\n\tint size_chk, err;\n\n\tif (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {\n\t\t/* Strictly speaking we could support this, if:\n\t\t * - huge pages, or*\n\t\t * - using an IOMMU, or\n\t\t * - making sure the memory area is consecutive\n\t\t * but for now, we simply say \"computer says no\".\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif (mr->flags & ~(XDP_UMEM_UNALIGNED_CHUNK_FLAG |\n\t\t\tXDP_UMEM_USES_NEED_WAKEUP))\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks && !is_power_of_2(chunk_size))\n\t\treturn -EINVAL;\n\n\tif (!PAGE_ALIGNED(addr)) {\n\t\t/* Memory area has to be page size aligned. For\n\t\t * simplicity, this might change.\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif ((addr + size) < addr)\n\t\treturn -EINVAL;\n\n\tchunks = (unsigned int)div_u64(size, chunk_size);\n\tif (chunks == 0)\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks) {\n\t\tchunks_per_page = PAGE_SIZE / chunk_size;\n\t\tif (chunks < chunks_per_page || chunks % chunks_per_page)\n\t\t\treturn -EINVAL;\n\t}\n\n\tsize_chk = chunk_size - headroom - XDP_PACKET_HEADROOM;\n\tif (size_chk < 0)\n\t\treturn -EINVAL;\n\n\tumem->address = (unsigned long)addr;\n\tumem->chunk_mask = unaligned_chunks ? XSK_UNALIGNED_BUF_ADDR_MASK\n\t\t\t\t\t : ~((u64)chunk_size - 1);\n\tumem->size = size;\n\tumem->headroom = headroom;\n\tumem->chunk_size_nohr = chunk_size - headroom;\n\tumem->npgs = size / PAGE_SIZE;\n\tumem->pgs = NULL;\n\tumem->user = NULL;\n\tumem->flags = mr->flags;\n\tINIT_LIST_HEAD(&umem->xsk_list);\n\tspin_lock_init(&umem->xsk_list_lock);\n\n\trefcount_set(&umem->users, 1);\n\n\terr = xdp_umem_account_pages(umem);\n\tif (err)\n\t\treturn err;\n\n\terr = xdp_umem_pin_pages(umem);\n\tif (err)\n\t\tgoto out_account;\n\n\tumem->pages = kvcalloc(umem->npgs, sizeof(*umem->pages),\n\t\t\t GFP_KERNEL_ACCOUNT);\n\tif (!umem->pages) {\n\t\terr = -ENOMEM;\n\t\tgoto out_pin;\n\t}\n\n\terr = xdp_umem_map_pages(umem);\n\tif (!err)\n\t\treturn 0;\n\n\tkvfree(umem->pages);\n\nout_pin:\n\txdp_umem_unpin_pages(umem);\nout_account:\n\txdp_umem_unaccount_pages(umem);\n\treturn err;\n}","target":"static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)\n{\n\tbool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;\n\tu32 chunk_size = mr->chunk_size, headroom = mr->headroom;\n\tunsigned int chunks, chunks_per_page;\n\tu64 addr = mr->addr, size = mr->len;\n\tint err;\n\n\tif (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {\n\t\t/* Strictly speaking we could support this, if:\n\t\t * - huge pages, or*\n\t\t * - using an IOMMU, or\n\t\t * - making sure the memory area is consecutive\n\t\t * but for now, we simply say \"computer says no\".\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif (mr->flags & ~(XDP_UMEM_UNALIGNED_CHUNK_FLAG |\n\t\t\tXDP_UMEM_USES_NEED_WAKEUP))\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks && !is_power_of_2(chunk_size))\n\t\treturn -EINVAL;\n\n\tif (!PAGE_ALIGNED(addr)) {\n\t\t/* Memory area has to be page size aligned. For\n\t\t * simplicity, this might change.\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif ((addr + size) < addr)\n\t\treturn -EINVAL;\n\n\tchunks = (unsigned int)div_u64(size, chunk_size);\n\tif (chunks == 0)\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks) {\n\t\tchunks_per_page = PAGE_SIZE / chunk_size;\n\t\tif (chunks < chunks_per_page || chunks % chunks_per_page)\n\t\t\treturn -EINVAL;\n\t}\n\n\tif (headroom >= chunk_size - XDP_PACKET_HEADROOM)\n\t\treturn -EINVAL;\n\n\tumem->address = (unsigned long)addr;\n\tumem->chunk_mask = unaligned_chunks ? XSK_UNALIGNED_BUF_ADDR_MASK\n\t\t\t\t\t : ~((u64)chunk_size - 1);\n\tumem->size = size;\n\tumem->headroom = headroom;\n\tumem->chunk_size_nohr = chunk_size - headroom;\n\tumem->npgs = size / PAGE_SIZE;\n\tumem->pgs = NULL;\n\tumem->user = NULL;\n\tumem->flags = mr->flags;\n\tINIT_LIST_HEAD(&umem->xsk_list);\n\tspin_lock_init(&umem->xsk_list_lock);\n\n\trefcount_set(&umem->users, 1);\n\n\terr = xdp_umem_account_pages(umem);\n\tif (err)\n\t\treturn err;\n\n\terr = xdp_umem_pin_pages(umem);\n\tif (err)\n\t\tgoto out_account;\n\n\tumem->pages = kvcalloc(umem->npgs, sizeof(*umem->pages),\n\t\t\t GFP_KERNEL_ACCOUNT);\n\tif (!umem->pages) {\n\t\terr = -ENOMEM;\n\t\tgoto out_pin;\n\t}\n\n\terr = xdp_umem_map_pages(umem);\n\tif (!err)\n\t\treturn 0;\n\n\tkvfree(umem->pages);\n\nout_pin:\n\txdp_umem_unpin_pages(umem);\nout_account:\n\txdp_umem_unaccount_pages(umem);\n\treturn err;\n}","lang":"c","vul_type":"cwe-787","target_token_count":685,"sven_meta":{"func_name":"xdp_umem_reg","file_name":"net/xdp/xdp_umem.c","commit_link":"github.com/torvalds/linux/commit/99e3a236dd43d06c65af0a2ef9cb44306aef6e02","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#15-b8122127aa08","input":"void gps_tracker( void )\n{\n\tssize_t unused;\n int gpsd_sock;\n char line[256], *temp;\n struct sockaddr_in gpsd_addr;\n int ret, is_json, pos;\n fd_set read_fd;\n struct timeval timeout;\n\n /* attempt to connect to localhost, port 2947 */\n\n pos = 0;\n gpsd_sock = socket( AF_INET, SOCK_STREAM, 0 );\n\n if( gpsd_sock < 0 ) {\n return;\n }\n\n gpsd_addr.sin_family = AF_INET;\n gpsd_addr.sin_port = htons( 2947 );\n gpsd_addr.sin_addr.s_addr = inet_addr( \"127.0.0.1\" );\n\n if( connect( gpsd_sock, (struct sockaddr *) &gpsd_addr,\n sizeof( gpsd_addr ) ) < 0 ) {\n return;\n }\n\n // Check if it's GPSd < 2.92 or the new one\n // 2.92+ immediately send stuff\n // < 2.92 requires to send PVTAD command\n FD_ZERO(&read_fd);\n FD_SET(gpsd_sock, &read_fd);\n timeout.tv_sec = 1;\n timeout.tv_usec = 0;\n is_json = select(gpsd_sock + 1, &read_fd, NULL, NULL, &timeout);\n if (is_json) {\n \t/*\n\t\t\t{\"class\":\"VERSION\",\"release\":\"2.95\",\"rev\":\"2010-11-16T21:12:35\",\"proto_major\":3,\"proto_minor\":3}\n\t\t\t?WATCH={\"json\":true};\n\t\t\t{\"class\":\"DEVICES\",\"devices\":[]}\n \t */\n\n\n \t// Get the crap and ignore it: {\"class\":\"VERSION\",\"release\":\"2.95\",\"rev\":\"2010-11-16T21:12:35\",\"proto_major\":3,\"proto_minor\":3}\n \tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n \t\treturn;\n\n \tis_json = (line[0] == '{');\n \tif (is_json) {\n\t\t\t// Send ?WATCH={\"json\":true};\n\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\tstrcpy(line, \"?WATCH={\\\"json\\\":true};\\n\");\n\t\t\tif( send( gpsd_sock, line, 22, 0 ) != 22 )\n\t\t\t\treturn;\n\n\t\t\t// Check that we have devices\n\t\t\tmemset(line, 0, sizeof(line));\n\t\t\tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n\t\t\t\treturn;\n\n\t\t\t// Stop processing if there is no device\n\t\t\tif (strncmp(line, \"{\\\"class\\\":\\\"DEVICES\\\",\\\"devices\\\":[]}\", 32) == 0) {\n\t\t\t\tclose(gpsd_sock);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tpos = strlen(line);\n\t\t\t}\n \t}\n }\n\n /* loop reading the GPS coordinates */\n\n while( G.do_exit == 0 )\n {\n usleep( 500000 );\n memset( G.gps_loc, 0, sizeof( float ) * 5 );\n\n /* read position, speed, heading, altitude */\n if (is_json) {\n \t// Format definition: http://catb.org/gpsd/gpsd_json.html\n\n \tif (pos == sizeof( line )) {\n \t\tmemset(line, 0, sizeof(line));\n \t\tpos = 0;\n \t}\n\n \t// New version, JSON\n \tif( recv( gpsd_sock, line + pos, sizeof( line ) - 1, 0 ) <= 0 )\n \t\treturn;\n\n \t// search for TPV class: {\"class\":\"TPV\"\n \ttemp = strstr(line, \"{\\\"class\\\":\\\"TPV\\\"\");\n \tif (temp == NULL) {\n \t\tcontinue;\n \t}\n\n \t// Make sure the data we have is complete\n \tif (strchr(temp, '}') == NULL) {\n \t\t// Move the data at the beginning of the buffer;\n \t\tpos = strlen(temp);\n \t\tif (temp != line) {\n \t\t\tmemmove(line, temp, pos);\n \t\t\tmemset(line + pos, 0, sizeof(line) - pos);\n \t\t}\n \t}\n\n\t\t\t// Example line: {\"class\":\"TPV\",\"tag\":\"MID2\",\"device\":\"/dev/ttyUSB0\",\"time\":1350957517.000,\"ept\":0.005,\"lat\":46.878936576,\"lon\":-115.832602964,\"alt\":1968.382,\"track\":0.0000,\"speed\":0.000,\"climb\":0.000,\"mode\":3}\n\n \t// Latitude\n \ttemp = strstr(temp, \"\\\"lat\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[0]);\n\n\t\t\t// Longitude\n\t\t\ttemp = strstr(temp, \"\\\"lon\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[1]);\n\n\t\t\t// Altitude\n\t\t\ttemp = strstr(temp, \"\\\"alt\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[4]);\n\n\t\t\t// Speed\n\t\t\ttemp = strstr(temp, \"\\\"speed\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[2]);\n\n\t\t\t// No more heading\n\n\t\t\t// Get the next TPV class\n\t\t\ttemp = strstr(temp, \"{\\\"class\\\":\\\"TPV\\\"\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\t\tpos = 0;\n\t\t\t} else {\n\t\t\t\tpos = strlen(temp);\n\t\t\t\tmemmove(line, temp, pos);\n\t\t\t\tmemset(line + pos, 0, sizeof(line) - pos);\n\t\t\t}\n\n } else {\n \tmemset( line, 0, sizeof( line ) );\n\n\t\t\tsnprintf( line, sizeof( line ) - 1, \"PVTAD\\r\\n\" );\n\t\t\tif( send( gpsd_sock, line, 7, 0 ) != 7 )\n\t\t\t\treturn;\n\n\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n\t\t\t\treturn;\n\n\t\t\tif( memcmp( line, \"GPSD,P=\", 7 ) != 0 )\n\t\t\t\tcontinue;\n\n\t\t\t/* make sure the coordinates are present */\n\n\t\t\tif( line[7] == '?' )\n\t\t\t\tcontinue;\n\n\t\t\tret = sscanf( line + 7, \"%f %f\", &G.gps_loc[0], &G.gps_loc[1] );\n\n\t\t\tif( ( temp = strstr( line, \"V=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[2] ); /* speed */\n\n\t\t\tif( ( temp = strstr( line, \"T=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[3] ); /* heading */\n\n\t\t\tif( ( temp = strstr( line, \"A=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[4] ); /* altitude */\n }\n\n if (G.record_data)\n\t\t\tfputs( line, G.f_gps );\n\n\t\tG.save_gps = 1;\n\n if (G.do_exit == 0)\n\t\t{\n\t\t\tunused = write( G.gc_pipe[1], G.gps_loc, sizeof( float ) * 5 );\n\t\t\tkill( getppid(), SIGUSR2 );\n\t\t}\n }\n}","target":"void gps_tracker( void )\n{\n\tssize_t unused;\n int gpsd_sock;\n char line[256], *temp;\n struct sockaddr_in gpsd_addr;\n int ret, is_json, pos;\n fd_set read_fd;\n struct timeval timeout;\n\n /* attempt to connect to localhost, port 2947 */\n\n pos = 0;\n gpsd_sock = socket( AF_INET, SOCK_STREAM, 0 );\n\n if( gpsd_sock < 0 ) {\n return;\n }\n\n gpsd_addr.sin_family = AF_INET;\n gpsd_addr.sin_port = htons( 2947 );\n gpsd_addr.sin_addr.s_addr = inet_addr( \"127.0.0.1\" );\n\n if( connect( gpsd_sock, (struct sockaddr *) &gpsd_addr,\n sizeof( gpsd_addr ) ) < 0 ) {\n return;\n }\n\n // Check if it's GPSd < 2.92 or the new one\n // 2.92+ immediately send stuff\n // < 2.92 requires to send PVTAD command\n FD_ZERO(&read_fd);\n FD_SET(gpsd_sock, &read_fd);\n timeout.tv_sec = 1;\n timeout.tv_usec = 0;\n is_json = select(gpsd_sock + 1, &read_fd, NULL, NULL, &timeout);\n if (is_json) {\n \t/*\n\t\t\t{\"class\":\"VERSION\",\"release\":\"2.95\",\"rev\":\"2010-11-16T21:12:35\",\"proto_major\":3,\"proto_minor\":3}\n\t\t\t?WATCH={\"json\":true};\n\t\t\t{\"class\":\"DEVICES\",\"devices\":[]}\n \t */\n\n\n \t// Get the crap and ignore it: {\"class\":\"VERSION\",\"release\":\"2.95\",\"rev\":\"2010-11-16T21:12:35\",\"proto_major\":3,\"proto_minor\":3}\n \tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n \t\treturn;\n\n \tis_json = (line[0] == '{');\n \tif (is_json) {\n\t\t\t// Send ?WATCH={\"json\":true};\n\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\tstrcpy(line, \"?WATCH={\\\"json\\\":true};\\n\");\n\t\t\tif( send( gpsd_sock, line, 22, 0 ) != 22 )\n\t\t\t\treturn;\n\n\t\t\t// Check that we have devices\n\t\t\tmemset(line, 0, sizeof(line));\n\t\t\tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n\t\t\t\treturn;\n\n\t\t\t// Stop processing if there is no device\n\t\t\tif (strncmp(line, \"{\\\"class\\\":\\\"DEVICES\\\",\\\"devices\\\":[]}\", 32) == 0) {\n\t\t\t\tclose(gpsd_sock);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tpos = strlen(line);\n\t\t\t}\n \t}\n }\n\n /* loop reading the GPS coordinates */\n\n while( G.do_exit == 0 )\n {\n usleep( 500000 );\n memset( G.gps_loc, 0, sizeof( float ) * 5 );\n\n /* read position, speed, heading, altitude */\n if (is_json) {\n \t// Format definition: http://catb.org/gpsd/gpsd_json.html\n\n \tif (pos == sizeof( line )) {\n \t\tmemset(line, 0, sizeof(line));\n \t\tpos = 0;\n \t}\n\n \t// New version, JSON\n \tif( recv( gpsd_sock, line + pos, sizeof( line ) - pos - 1, 0 ) <= 0 )\n \t\treturn;\n\n \t// search for TPV class: {\"class\":\"TPV\"\n \ttemp = strstr(line, \"{\\\"class\\\":\\\"TPV\\\"\");\n \tif (temp == NULL) {\n \t\tcontinue;\n \t}\n\n \t// Make sure the data we have is complete\n \tif (strchr(temp, '}') == NULL) {\n \t\t// Move the data at the beginning of the buffer;\n \t\tpos = strlen(temp);\n \t\tif (temp != line) {\n \t\t\tmemmove(line, temp, pos);\n \t\t\tmemset(line + pos, 0, sizeof(line) - pos);\n \t\t}\n \t}\n\n\t\t\t// Example line: {\"class\":\"TPV\",\"tag\":\"MID2\",\"device\":\"/dev/ttyUSB0\",\"time\":1350957517.000,\"ept\":0.005,\"lat\":46.878936576,\"lon\":-115.832602964,\"alt\":1968.382,\"track\":0.0000,\"speed\":0.000,\"climb\":0.000,\"mode\":3}\n\n \t// Latitude\n \ttemp = strstr(temp, \"\\\"lat\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[0]);\n\n\t\t\t// Longitude\n\t\t\ttemp = strstr(temp, \"\\\"lon\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[1]);\n\n\t\t\t// Altitude\n\t\t\ttemp = strstr(temp, \"\\\"alt\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[4]);\n\n\t\t\t// Speed\n\t\t\ttemp = strstr(temp, \"\\\"speed\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[2]);\n\n\t\t\t// No more heading\n\n\t\t\t// Get the next TPV class\n\t\t\ttemp = strstr(temp, \"{\\\"class\\\":\\\"TPV\\\"\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\t\tpos = 0;\n\t\t\t} else {\n\t\t\t\tpos = strlen(temp);\n\t\t\t\tmemmove(line, temp, pos);\n\t\t\t\tmemset(line + pos, 0, sizeof(line) - pos);\n\t\t\t}\n\n } else {\n \tmemset( line, 0, sizeof( line ) );\n\n\t\t\tsnprintf( line, sizeof( line ) - 1, \"PVTAD\\r\\n\" );\n\t\t\tif( send( gpsd_sock, line, 7, 0 ) != 7 )\n\t\t\t\treturn;\n\n\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n\t\t\t\treturn;\n\n\t\t\tif( memcmp( line, \"GPSD,P=\", 7 ) != 0 )\n\t\t\t\tcontinue;\n\n\t\t\t/* make sure the coordinates are present */\n\n\t\t\tif( line[7] == '?' )\n\t\t\t\tcontinue;\n\n\t\t\tret = sscanf( line + 7, \"%f %f\", &G.gps_loc[0], &G.gps_loc[1] );\n\n\t\t\tif( ( temp = strstr( line, \"V=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[2] ); /* speed */\n\n\t\t\tif( ( temp = strstr( line, \"T=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[3] ); /* heading */\n\n\t\t\tif( ( temp = strstr( line, \"A=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[4] ); /* altitude */\n }\n\n if (G.record_data)\n\t\t\tfputs( line, G.f_gps );\n\n\t\tG.save_gps = 1;\n\n if (G.do_exit == 0)\n\t\t{\n\t\t\tunused = write( G.gc_pipe[1], G.gps_loc, sizeof( float ) * 5 );\n\t\t\tkill( getppid(), SIGUSR2 );\n\t\t}\n }\n}","lang":"c","vul_type":"cwe-787","target_token_count":1757,"sven_meta":{"func_name":"gps_tracker","file_name":"src/airodump-ng.c","commit_link":"github.com/aircrack-ng/aircrack-ng/commit/ff70494dd389ba570dbdbf36f217c28d4381c6b5/","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#16-a9d906d18163","input":"int tcp_test(const char* ip_str, const short port)\n{\n int sock, i;\n struct sockaddr_in s_in;\n int packetsize = 1024;\n unsigned char packet[packetsize];\n struct timeval tv, tv2, tv3;\n int caplen = 0;\n int times[REQUESTS];\n int min, avg, max, len;\n struct net_hdr nh;\n\n tv3.tv_sec=0;\n tv3.tv_usec=1;\n\n s_in.sin_family = PF_INET;\n s_in.sin_port = htons(port);\n if (!inet_aton(ip_str, &s_in.sin_addr))\n return -1;\n\n if ((sock = socket(s_in.sin_family, SOCK_STREAM, IPPROTO_TCP)) == -1)\n return -1;\n\n /* avoid blocking on reading the socket */\n if( fcntl( sock, F_SETFL, O_NONBLOCK ) < 0 )\n {\n perror( \"fcntl(O_NONBLOCK) failed\" );\n return( 1 );\n }\n\n gettimeofday( &tv, NULL );\n\n while (1) //waiting for relayed packet\n {\n if (connect(sock, (struct sockaddr*) &s_in, sizeof(s_in)) == -1)\n {\n if(errno != EINPROGRESS && errno != EALREADY)\n {\n perror(\"connect\");\n close(sock);\n\n printf(\"Failed to connect\\n\");\n\n return -1;\n }\n }\n else\n {\n gettimeofday( &tv2, NULL );\n break;\n }\n\n gettimeofday( &tv2, NULL );\n //wait 3000ms for a successful connect\n if (((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec)) > (3000*1000))\n {\n printf(\"Connection timed out\\n\");\n close(sock);\n return(-1);\n }\n usleep(10);\n }\n\n PCT; printf(\"TCP connection successful\\n\");\n\n //trying to identify airserv-ng\n memset(&nh, 0, sizeof(nh));\n// command: GET_CHAN\n nh.nh_type\t= 2;\n nh.nh_len\t= htonl(0);\n\n if (send(sock, &nh, sizeof(nh), 0) != sizeof(nh))\n {\n perror(\"send\");\n return -1;\n }\n\n gettimeofday( &tv, NULL );\n i=0;\n\n while (1) //waiting for GET_CHAN answer\n {\n caplen = read(sock, &nh, sizeof(nh));\n\n if(caplen == -1)\n {\n if( errno != EAGAIN )\n {\n perror(\"read\");\n return -1;\n }\n }\n\n if( (unsigned)caplen == sizeof(nh))\n {\n len = ntohl(nh.nh_len);\n if( nh.nh_type == 1 && i==0 )\n {\n i=1;\n caplen = read(sock, packet, len);\n if(caplen == len)\n {\n i=2;\n break;\n }\n else\n {\n i=0;\n }\n }\n else\n {\n caplen = read(sock, packet, len);\n }\n }\n\n gettimeofday( &tv2, NULL );\n //wait 1000ms for an answer\n if (((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec)) > (1000*1000))\n {\n break;\n }\n if(caplen == -1)\n usleep(10);\n }\n\n if(i==2)\n {\n PCT; printf(\"airserv-ng found\\n\");\n }\n else\n {\n PCT; printf(\"airserv-ng NOT found\\n\");\n }\n\n close(sock);\n\n for(i=0; i (1000*1000))\n {\n break;\n }\n //simple \"high-precision\" usleep\n select(1, NULL, NULL, NULL, &tv3);\n }\n times[i] = ((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec));\n printf( \"\\r%d/%d\\r\", i, REQUESTS);\n fflush(stdout);\n close(sock);\n }\n\n min = INT_MAX;\n avg = 0;\n max = 0;\n\n for(i=0; i max) max = times[i];\n avg += times[i];\n }\n avg /= REQUESTS;\n\n PCT; printf(\"ping %s:%d (min/avg/max): %.3fms/%.3fms/%.3fms\\n\", ip_str, port, min/1000.0, avg/1000.0, max/1000.0);\n\n return 0;\n}","target":"int tcp_test(const char* ip_str, const short port)\n{\n int sock, i;\n struct sockaddr_in s_in;\n int packetsize = 1024;\n unsigned char packet[packetsize];\n struct timeval tv, tv2, tv3;\n int caplen = 0;\n int times[REQUESTS];\n int min, avg, max, len;\n struct net_hdr nh;\n\n tv3.tv_sec=0;\n tv3.tv_usec=1;\n\n s_in.sin_family = PF_INET;\n s_in.sin_port = htons(port);\n if (!inet_aton(ip_str, &s_in.sin_addr))\n return -1;\n\n if ((sock = socket(s_in.sin_family, SOCK_STREAM, IPPROTO_TCP)) == -1)\n return -1;\n\n /* avoid blocking on reading the socket */\n if( fcntl( sock, F_SETFL, O_NONBLOCK ) < 0 )\n {\n perror( \"fcntl(O_NONBLOCK) failed\" );\n return( 1 );\n }\n\n gettimeofday( &tv, NULL );\n\n while (1) //waiting for relayed packet\n {\n if (connect(sock, (struct sockaddr*) &s_in, sizeof(s_in)) == -1)\n {\n if(errno != EINPROGRESS && errno != EALREADY)\n {\n perror(\"connect\");\n close(sock);\n\n printf(\"Failed to connect\\n\");\n\n return -1;\n }\n }\n else\n {\n gettimeofday( &tv2, NULL );\n break;\n }\n\n gettimeofday( &tv2, NULL );\n //wait 3000ms for a successful connect\n if (((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec)) > (3000*1000))\n {\n printf(\"Connection timed out\\n\");\n close(sock);\n return(-1);\n }\n usleep(10);\n }\n\n PCT; printf(\"TCP connection successful\\n\");\n\n //trying to identify airserv-ng\n memset(&nh, 0, sizeof(nh));\n// command: GET_CHAN\n nh.nh_type\t= 2;\n nh.nh_len\t= htonl(0);\n\n if (send(sock, &nh, sizeof(nh), 0) != sizeof(nh))\n {\n perror(\"send\");\n return -1;\n }\n\n gettimeofday( &tv, NULL );\n i=0;\n\n while (1) //waiting for GET_CHAN answer\n {\n caplen = read(sock, &nh, sizeof(nh));\n\n if(caplen == -1)\n {\n if( errno != EAGAIN )\n {\n perror(\"read\");\n return -1;\n }\n }\n\n if( (unsigned)caplen == sizeof(nh))\n {\n len = ntohl(nh.nh_len);\n if (len > 1024 || len < 0)\n continue;\n if( nh.nh_type == 1 && i==0 )\n {\n i=1;\n caplen = read(sock, packet, len);\n if(caplen == len)\n {\n i=2;\n break;\n }\n else\n {\n i=0;\n }\n }\n else\n {\n caplen = read(sock, packet, len);\n }\n }\n\n gettimeofday( &tv2, NULL );\n //wait 1000ms for an answer\n if (((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec)) > (1000*1000))\n {\n break;\n }\n if(caplen == -1)\n usleep(10);\n }\n\n if(i==2)\n {\n PCT; printf(\"airserv-ng found\\n\");\n }\n else\n {\n PCT; printf(\"airserv-ng NOT found\\n\");\n }\n\n close(sock);\n\n for(i=0; i (1000*1000))\n {\n break;\n }\n //simple \"high-precision\" usleep\n select(1, NULL, NULL, NULL, &tv3);\n }\n times[i] = ((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec));\n printf( \"\\r%d/%d\\r\", i, REQUESTS);\n fflush(stdout);\n close(sock);\n }\n\n min = INT_MAX;\n avg = 0;\n max = 0;\n\n for(i=0; i max) max = times[i];\n avg += times[i];\n }\n avg /= REQUESTS;\n\n PCT; printf(\"ping %s:%d (min/avg/max): %.3fms/%.3fms/%.3fms\\n\", ip_str, port, min/1000.0, avg/1000.0, max/1000.0);\n\n return 0;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1404,"sven_meta":{"func_name":"tcp_test","file_name":"src/aireplay-ng.c","commit_link":"github.com/aircrack-ng/aircrack-ng/commit/091b153f294b9b695b0b2831e65936438b550d7b","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#17-ad3ac11840a9","input":"mapi_attr_read (size_t len, unsigned char *buf)\n{\n size_t idx = 0;\n uint32 i,j;\n assert(len > 4);\n uint32 num_properties = GETINT32(buf+idx);\n MAPI_Attr** attrs = CHECKED_XMALLOC (MAPI_Attr*, (num_properties + 1));\n\n idx += 4;\n\n if (!attrs) return NULL;\n for (i = 0; i < num_properties; i++)\n {\n\tMAPI_Attr* a = attrs[i] = CHECKED_XCALLOC(MAPI_Attr, 1);\n\tMAPI_Value* v = NULL;\n\n\tCHECKINT16(idx, len); a->type = GETINT16(buf+idx); idx += 2;\n\tCHECKINT16(idx, len); a->name = GETINT16(buf+idx); idx += 2;\n\n\t/* handle special case of GUID prefixed properties */\n\tif (a->name & GUID_EXISTS_FLAG)\n\t{\n\t /* copy GUID */\n\t a->guid = CHECKED_XMALLOC(GUID, 1);\n\t copy_guid_from_buf(a->guid, buf+idx, len);\n\t idx += sizeof (GUID);\n\n\t CHECKINT32(idx, len); a->num_names = GETINT32(buf+idx); idx += 4;\n\t if (a->num_names > 0)\n\t {\n\t\t/* FIXME: do something useful here! */\n\t\tsize_t i;\n\n\t\ta->names = CHECKED_XCALLOC(VarLenData, a->num_names);\n\n\t\tfor (i = 0; i < a->num_names; i++)\n\t\t{\n\t\t size_t j;\n\n\t\t CHECKINT32(idx, len); a->names[i].len = GETINT32(buf+idx); idx += 4;\n\n\t\t /* read the data into a buffer */\n\t\t a->names[i].data \n\t\t\t= CHECKED_XMALLOC(unsigned char, a->names[i].len);\n\t\t for (j = 0; j < (a->names[i].len >> 1); j++)\n\t\t\ta->names[i].data[j] = (buf+idx)[j*2];\n\n\t\t /* But what are we going to do with it? */\n\t\t \n\t\t idx += pad_to_4byte(a->names[i].len);\n\t\t}\n\t }\n\t else\n\t {\n\t\t/* get the 'real' name */\n\t\tCHECKINT32(idx, len); a->name = GETINT32(buf+idx); idx+= 4;\n\t }\n\t}\n\n\t/* \n\t * Multi-value types and string/object/binary types have\n\t * multiple values \n\t */\n\tif (a->type & MULTI_VALUE_FLAG ||\n\t a->type == szMAPI_STRING ||\n\t a->type == szMAPI_UNICODE_STRING ||\n\t a->type == szMAPI_OBJECT ||\n\t a->type == szMAPI_BINARY)\n\t{\n\t CHECKINT32(idx, len); a->num_values = GETINT32(buf+idx);\n\t idx += 4;\n\t}\n else\n {\n\t a->num_values = 1;\n }\n\n\t/* Amend the type in case of multi-value type */\n\tif (a->type & MULTI_VALUE_FLAG)\n\t{\n\t a->type -= MULTI_VALUE_FLAG;\n\t}\n\n\n\tv = alloc_mapi_values (a);\n\n\tfor (j = 0; j < a->num_values; j++) \n\t{\n\t switch (a->type)\n\t {\n\t case szMAPI_SHORT:\t/* 2 bytes */\n\t\tv->len = 2;\n\t\tCHECKINT16(idx, len); v->data.bytes2 = GETINT16(buf+idx);\n\t\tidx += 4;\t/* assume padding of 2, advance by 4! */\n\t\tbreak;\n\n\t case szMAPI_INT:\t/* 4 bytes */\n\t\tv->len = 4;\n\t\tCHECKINT32(idx, len); v->data.bytes4 = GETINT32(buf+idx);\n\t\tidx += 4;\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_FLOAT:\t/* 4 bytes */\n\t case szMAPI_BOOLEAN: /* this should be 2 bytes + 2 padding */\n\t\tv->len = 4;\n\t\tCHECKINT32(idx, len); v->data.bytes4 = GETINT32(buf+idx);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_SYSTIME: /* 8 bytes */\n\t\tv->len = 8;\n\t\tCHECKINT32(idx, len); v->data.bytes8[0] = GETINT32(buf+idx);\n\t\tCHECKINT32(idx+4, len); v->data.bytes8[1] = GETINT32(buf+idx+4);\n\t\tidx += 8;\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_DOUBLE:\t/* 8 bytes */\n\t case szMAPI_APPTIME:\n\t case szMAPI_CURRENCY:\n\t case szMAPI_INT8BYTE:\n\t\tv->len = 8;\n\t\tCHECKINT32(idx, len); v->data.bytes8[0] = GETINT32(buf+idx);\n\t\tCHECKINT32(idx+4, len); v->data.bytes8[1] = GETINT32(buf+idx+4);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_CLSID:\n\t\tv->len = sizeof (GUID);\n\t\tcopy_guid_from_buf(&v->data.guid, buf+idx, len);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_STRING:\n\t case szMAPI_UNICODE_STRING:\n\t case szMAPI_OBJECT:\n\t case szMAPI_BINARY:\n\t\tCHECKINT32(idx, len); v->len = GETINT32(buf+idx); idx += 4;\n\n\t\tif (a->type == szMAPI_UNICODE_STRING)\n\t\t{\n\t\t v->data.buf = (unsigned char*)unicode_to_utf8(v->len, buf+idx);\n\t\t}\n\t\telse\n\t\t{\n\t\t v->data.buf = CHECKED_XMALLOC(unsigned char, v->len);\n\t\t memmove (v->data.buf, buf+idx, v->len);\n\t\t}\n\n\t\tidx += pad_to_4byte(v->len);\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_NULL:\t/* illegal in input tnef streams */\n\t case szMAPI_ERROR:\n\t case szMAPI_UNSPECIFIED:\n\t\tfprintf (stderr,\n\t\t\t \"Invalid attribute, input file may be corrupted\\n\");\n\t\tif (!ENCODE_SKIP) exit (1);\n\n\t\treturn NULL;\n\n\t default:\t\t/* should never get here */\n\t\tfprintf (stderr,\n\t\t\t \"Undefined attribute, input file may be corrupted\\n\");\n\t\tif (!ENCODE_SKIP) exit (1);\n\n\t\treturn NULL;\n\n\t }\n\t if (DEBUG_ON) mapi_attr_dump (attrs[i]);\n\t}\n }\n attrs[i] = NULL;\n\n return attrs;\n}","target":"mapi_attr_read (size_t len, unsigned char *buf)\n{\n size_t idx = 0;\n uint32 i,j;\n assert(len > 4);\n uint32 num_properties = GETINT32(buf+idx);\n assert((num_properties+1) != 0);\n MAPI_Attr** attrs = CHECKED_XMALLOC (MAPI_Attr*, (num_properties + 1));\n\n idx += 4;\n\n if (!attrs) return NULL;\n for (i = 0; i < num_properties; i++)\n {\n\tMAPI_Attr* a = attrs[i] = CHECKED_XCALLOC(MAPI_Attr, 1);\n\tMAPI_Value* v = NULL;\n\n\tCHECKINT16(idx, len); a->type = GETINT16(buf+idx); idx += 2;\n\tCHECKINT16(idx, len); a->name = GETINT16(buf+idx); idx += 2;\n\n\t/* handle special case of GUID prefixed properties */\n\tif (a->name & GUID_EXISTS_FLAG)\n\t{\n\t /* copy GUID */\n\t a->guid = CHECKED_XMALLOC(GUID, 1);\n\t copy_guid_from_buf(a->guid, buf+idx, len);\n\t idx += sizeof (GUID);\n\n\t CHECKINT32(idx, len); a->num_names = GETINT32(buf+idx); idx += 4;\n\t if (a->num_names > 0)\n\t {\n\t\t/* FIXME: do something useful here! */\n\t\tsize_t i;\n\n\t\ta->names = CHECKED_XCALLOC(VarLenData, a->num_names);\n\n\t\tfor (i = 0; i < a->num_names; i++)\n\t\t{\n\t\t size_t j;\n\n\t\t CHECKINT32(idx, len); a->names[i].len = GETINT32(buf+idx); idx += 4;\n\n\t\t /* read the data into a buffer */\n\t\t a->names[i].data \n\t\t\t= CHECKED_XMALLOC(unsigned char, a->names[i].len);\n\t\t assert((idx+(a->names[i].len*2)) <= len);\n\t\t for (j = 0; j < (a->names[i].len >> 1); j++)\n\t\t\ta->names[i].data[j] = (buf+idx)[j*2];\n\n\t\t /* But what are we going to do with it? */\n\t\t \n\t\t idx += pad_to_4byte(a->names[i].len);\n\t\t}\n\t }\n\t else\n\t {\n\t\t/* get the 'real' name */\n\t\tCHECKINT32(idx, len); a->name = GETINT32(buf+idx); idx+= 4;\n\t }\n\t}\n\n\t/* \n\t * Multi-value types and string/object/binary types have\n\t * multiple values \n\t */\n\tif (a->type & MULTI_VALUE_FLAG ||\n\t a->type == szMAPI_STRING ||\n\t a->type == szMAPI_UNICODE_STRING ||\n\t a->type == szMAPI_OBJECT ||\n\t a->type == szMAPI_BINARY)\n\t{\n\t CHECKINT32(idx, len); a->num_values = GETINT32(buf+idx);\n\t idx += 4;\n\t}\n else\n {\n\t a->num_values = 1;\n }\n\n\t/* Amend the type in case of multi-value type */\n\tif (a->type & MULTI_VALUE_FLAG)\n\t{\n\t a->type -= MULTI_VALUE_FLAG;\n\t}\n\n\n\tv = alloc_mapi_values (a);\n\n\tfor (j = 0; j < a->num_values; j++) \n\t{\n\t switch (a->type)\n\t {\n\t case szMAPI_SHORT:\t/* 2 bytes */\n\t\tv->len = 2;\n\t\tCHECKINT16(idx, len); v->data.bytes2 = GETINT16(buf+idx);\n\t\tidx += 4;\t/* assume padding of 2, advance by 4! */\n\t\tbreak;\n\n\t case szMAPI_INT:\t/* 4 bytes */\n\t\tv->len = 4;\n\t\tCHECKINT32(idx, len); v->data.bytes4 = GETINT32(buf+idx);\n\t\tidx += 4;\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_FLOAT:\t/* 4 bytes */\n\t case szMAPI_BOOLEAN: /* this should be 2 bytes + 2 padding */\n\t\tv->len = 4;\n\t\tCHECKINT32(idx, len); v->data.bytes4 = GETINT32(buf+idx);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_SYSTIME: /* 8 bytes */\n\t\tv->len = 8;\n\t\tCHECKINT32(idx, len); v->data.bytes8[0] = GETINT32(buf+idx);\n\t\tCHECKINT32(idx+4, len); v->data.bytes8[1] = GETINT32(buf+idx+4);\n\t\tidx += 8;\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_DOUBLE:\t/* 8 bytes */\n\t case szMAPI_APPTIME:\n\t case szMAPI_CURRENCY:\n\t case szMAPI_INT8BYTE:\n\t\tv->len = 8;\n\t\tCHECKINT32(idx, len); v->data.bytes8[0] = GETINT32(buf+idx);\n\t\tCHECKINT32(idx+4, len); v->data.bytes8[1] = GETINT32(buf+idx+4);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_CLSID:\n\t\tv->len = sizeof (GUID);\n\t\tcopy_guid_from_buf(&v->data.guid, buf+idx, len);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_STRING:\n\t case szMAPI_UNICODE_STRING:\n\t case szMAPI_OBJECT:\n\t case szMAPI_BINARY:\n\t\tCHECKINT32(idx, len); v->len = GETINT32(buf+idx); idx += 4;\n\n\t\tassert(v->len + idx <= len);\n\n\t\tif (a->type == szMAPI_UNICODE_STRING)\n\t\t{\n\t\t assert(v->len != 0);\n\t\t v->data.buf = (unsigned char*)unicode_to_utf8(v->len, buf+idx);\n\t\t}\n\t\telse\n\t\t{\n\t\t v->data.buf = CHECKED_XMALLOC(unsigned char, v->len);\n\t\t memmove (v->data.buf, buf+idx, v->len);\n\t\t}\n\n\t\tidx += pad_to_4byte(v->len);\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_NULL:\t/* illegal in input tnef streams */\n\t case szMAPI_ERROR:\n\t case szMAPI_UNSPECIFIED:\n\t\tfprintf (stderr,\n\t\t\t \"Invalid attribute, input file may be corrupted\\n\");\n\t\tif (!ENCODE_SKIP) exit (1);\n\n\t\treturn NULL;\n\n\t default:\t\t/* should never get here */\n\t\tfprintf (stderr,\n\t\t\t \"Undefined attribute, input file may be corrupted\\n\");\n\t\tif (!ENCODE_SKIP) exit (1);\n\n\t\treturn NULL;\n\n\t }\n\t if (DEBUG_ON) mapi_attr_dump (attrs[i]);\n\t}\n }\n attrs[i] = NULL;\n\n return attrs;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1527,"sven_meta":{"func_name":"mapi_attr_read","file_name":"src/mapi_attr.c","commit_link":"github.com/verdammelt/tnef/commit/1a17af1ed0c791aec44dbdc9eab91218cc1e335a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#18-825667bd2f54","input":"static size_t WritePSDChannel(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n const QuantumType quantum_type, unsigned char *compact_pixels,\n MagickOffsetType size_offset,const MagickBooleanType separate,\n ExceptionInfo *exception)\n{\n int\n y;\n\n MagickBooleanType\n monochrome;\n\n QuantumInfo\n *quantum_info;\n\n register const Quantum\n *p;\n\n register ssize_t\n i;\n\n size_t\n count,\n length;\n\n unsigned char\n *pixels;\n\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n\n#define CHUNK 16384\n\n int\n flush,\n level;\n\n unsigned char\n *compressed_pixels;\n\n z_stream\n stream;\n\n compressed_pixels=(unsigned char *) NULL;\n flush=Z_NO_FLUSH;\n#endif\n count=0;\n if (separate != MagickFalse)\n {\n size_offset=TellBlob(image)+2;\n count+=WriteCompressionStart(psd_info,image,next_image,1);\n }\n if (next_image->depth > 8)\n next_image->depth=16;\n monochrome=IsImageMonochrome(image) && (image->depth == 1) ?\n MagickTrue : MagickFalse;\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n return(0);\n pixels=(unsigned char *) GetQuantumPixels(quantum_info);\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (next_image->compression == ZipCompression)\n {\n compressed_pixels=(unsigned char *) AcquireQuantumMemory(CHUNK,\n sizeof(*compressed_pixels));\n if (compressed_pixels == (unsigned char *) NULL)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n ResetMagickMemory(&stream,0,sizeof(stream));\n stream.data_type=Z_BINARY;\n level=Z_DEFAULT_COMPRESSION;\n if ((image_info->quality > 0 && image_info->quality < 10))\n level=(int) image_info->quality;\n if (deflateInit(&stream,level) != Z_OK)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n }\n#endif\n for (y=0; y < (ssize_t) next_image->rows; y++)\n {\n p=GetVirtualPixels(next_image,0,y,next_image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n length=ExportQuantumPixels(next_image,(CacheView *) NULL,quantum_info,\n quantum_type,pixels,exception);\n if (monochrome != MagickFalse)\n for (i=0; i < (ssize_t) length; i++)\n pixels[i]=(~pixels[i]);\n if (next_image->compression == RLECompression)\n {\n length=PSDPackbitsEncodeImage(image,length,pixels,compact_pixels,\n exception);\n count+=WriteBlob(image,length,compact_pixels);\n size_offset+=WritePSDOffset(psd_info,image,length,size_offset);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n else if (next_image->compression == ZipCompression)\n {\n stream.avail_in=(uInt) length;\n stream.next_in=(Bytef *) pixels;\n if (y == (ssize_t) next_image->rows-1)\n flush=Z_FINISH;\n do {\n stream.avail_out=(uInt) CHUNK;\n stream.next_out=(Bytef *) compressed_pixels;\n if (deflate(&stream,flush) == Z_STREAM_ERROR)\n break;\n length=(size_t) CHUNK-stream.avail_out;\n if (length > 0)\n count+=WriteBlob(image,length,compressed_pixels);\n } while (stream.avail_out == 0);\n }\n#endif\n else\n count+=WriteBlob(image,length,pixels);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (next_image->compression == ZipCompression)\n {\n (void) deflateEnd(&stream);\n compressed_pixels=(unsigned char *) RelinquishMagickMemory(\n compressed_pixels);\n }\n#endif\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(count);\n}","target":"static size_t WritePSDChannel(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n const QuantumType quantum_type, unsigned char *compact_pixels,\n MagickOffsetType size_offset,const MagickBooleanType separate,\n ExceptionInfo *exception)\n{\n int\n y;\n\n MagickBooleanType\n monochrome;\n\n QuantumInfo\n *quantum_info;\n\n register const Quantum\n *p;\n\n register ssize_t\n i;\n\n size_t\n count,\n length;\n\n unsigned char\n *pixels;\n\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n\n#define CHUNK 16384\n\n int\n flush,\n level;\n\n unsigned char\n *compressed_pixels;\n\n z_stream\n stream;\n\n compressed_pixels=(unsigned char *) NULL;\n flush=Z_NO_FLUSH;\n#endif\n count=0;\n if (separate != MagickFalse)\n {\n size_offset=TellBlob(image)+2;\n count+=WriteCompressionStart(psd_info,image,next_image,1);\n }\n if (next_image->depth > 8)\n next_image->depth=16;\n monochrome=IsImageMonochrome(image) && (image->depth == 1) ?\n MagickTrue : MagickFalse;\n quantum_info=AcquireQuantumInfo(image_info,next_image);\n if (quantum_info == (QuantumInfo *) NULL)\n return(0);\n pixels=(unsigned char *) GetQuantumPixels(quantum_info);\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (next_image->compression == ZipCompression)\n {\n compressed_pixels=(unsigned char *) AcquireQuantumMemory(CHUNK,\n sizeof(*compressed_pixels));\n if (compressed_pixels == (unsigned char *) NULL)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n ResetMagickMemory(&stream,0,sizeof(stream));\n stream.data_type=Z_BINARY;\n level=Z_DEFAULT_COMPRESSION;\n if ((image_info->quality > 0 && image_info->quality < 10))\n level=(int) image_info->quality;\n if (deflateInit(&stream,level) != Z_OK)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n }\n#endif\n for (y=0; y < (ssize_t) next_image->rows; y++)\n {\n p=GetVirtualPixels(next_image,0,y,next_image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n length=ExportQuantumPixels(next_image,(CacheView *) NULL,quantum_info,\n quantum_type,pixels,exception);\n if (monochrome != MagickFalse)\n for (i=0; i < (ssize_t) length; i++)\n pixels[i]=(~pixels[i]);\n if (next_image->compression == RLECompression)\n {\n length=PSDPackbitsEncodeImage(image,length,pixels,compact_pixels,\n exception);\n count+=WriteBlob(image,length,compact_pixels);\n size_offset+=WritePSDOffset(psd_info,image,length,size_offset);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n else if (next_image->compression == ZipCompression)\n {\n stream.avail_in=(uInt) length;\n stream.next_in=(Bytef *) pixels;\n if (y == (ssize_t) next_image->rows-1)\n flush=Z_FINISH;\n do {\n stream.avail_out=(uInt) CHUNK;\n stream.next_out=(Bytef *) compressed_pixels;\n if (deflate(&stream,flush) == Z_STREAM_ERROR)\n break;\n length=(size_t) CHUNK-stream.avail_out;\n if (length > 0)\n count+=WriteBlob(image,length,compressed_pixels);\n } while (stream.avail_out == 0);\n }\n#endif\n else\n count+=WriteBlob(image,length,pixels);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (next_image->compression == ZipCompression)\n {\n (void) deflateEnd(&stream);\n compressed_pixels=(unsigned char *) RelinquishMagickMemory(\n compressed_pixels);\n }\n#endif\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(count);\n}","lang":"c","vul_type":"cwe-787","target_token_count":925,"sven_meta":{"func_name":"WritePSDChannel","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/91cc3f36f2ccbd485a0456bab9aebe63b635da88","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#19-a0a0ea5b4471","input":"int flb_gzip_compress(void *in_data, size_t in_len,\n void **out_data, size_t *out_len)\n{\n int flush;\n int status;\n int footer_start;\n uint8_t *pb;\n size_t out_size;\n void *out_buf;\n z_stream strm;\n mz_ulong crc;\n\n out_size = in_len + 32;\n out_buf = flb_malloc(out_size);\n if (!out_buf) {\n flb_errno();\n flb_error(\"[gzip] could not allocate outgoing buffer\");\n return -1;\n }\n\n /* Initialize streaming buffer context */\n memset(&strm, '\\0', sizeof(strm));\n strm.zalloc = Z_NULL;\n strm.zfree = Z_NULL;\n strm.opaque = Z_NULL;\n strm.next_in = in_data;\n strm.avail_in = in_len;\n strm.total_out = 0;\n\n /* Deflate mode */\n deflateInit2(&strm, Z_DEFAULT_COMPRESSION,\n Z_DEFLATED, -Z_DEFAULT_WINDOW_BITS, 9, Z_DEFAULT_STRATEGY);\n\n /*\n * Miniz don't support GZip format directly, instead we will:\n *\n * - append manual GZip magic bytes\n * - deflate raw content\n * - append manual CRC32 data\n */\n gzip_header(out_buf);\n\n /* Header offset */\n pb = (uint8_t *) out_buf + FLB_GZIP_HEADER_OFFSET;\n\n flush = Z_NO_FLUSH;\n while (1) {\n strm.next_out = pb + strm.total_out;\n strm.avail_out = out_size - (pb - (uint8_t *) out_buf);\n\n if (strm.avail_in == 0) {\n flush = Z_FINISH;\n }\n\n status = deflate(&strm, flush);\n if (status == Z_STREAM_END) {\n break;\n }\n else if (status != Z_OK) {\n deflateEnd(&strm);\n return -1;\n }\n }\n\n if (deflateEnd(&strm) != Z_OK) {\n flb_free(out_buf);\n return -1;\n }\n *out_len = strm.total_out;\n\n /* Construct the gzip checksum (CRC32 footer) */\n footer_start = FLB_GZIP_HEADER_OFFSET + *out_len;\n pb = (uint8_t *) out_buf + footer_start;\n\n crc = mz_crc32(MZ_CRC32_INIT, in_data, in_len);\n *pb++ = crc & 0xFF;\n *pb++ = (crc >> 8) & 0xFF;\n *pb++ = (crc >> 16) & 0xFF;\n *pb++ = (crc >> 24) & 0xFF;\n *pb++ = in_len & 0xFF;\n *pb++ = (in_len >> 8) & 0xFF;\n *pb++ = (in_len >> 16) & 0xFF;\n *pb++ = (in_len >> 24) & 0xFF;\n\n /* Set the real buffer size for the caller */\n *out_len += FLB_GZIP_HEADER_OFFSET + 8;\n *out_data = out_buf;\n\n return 0;\n}","target":"int flb_gzip_compress(void *in_data, size_t in_len,\n void **out_data, size_t *out_len)\n{\n int flush;\n int status;\n int footer_start;\n uint8_t *pb;\n size_t out_size;\n void *out_buf;\n z_stream strm;\n mz_ulong crc;\n\n\n /*\n * GZIP relies on an algorithm with worst-case expansion\n * of 5 bytes per 32KB data. This means we need to create a variable\n * length output, that depends on the input length.\n * See RFC 1951 for details.\n */\n int max_input_expansion = ((int)(in_len / 32000) + 1) * 5;\n\n /*\n * Max compressed size is equal to sum of:\n * 10 byte header\n * 8 byte foot\n * max input expansion\n * size of input\n */\n out_size = 10 + 8 + max_input_expansion + in_len;\n out_buf = flb_malloc(out_size);\n\n if (!out_buf) {\n flb_errno();\n flb_error(\"[gzip] could not allocate outgoing buffer\");\n return -1;\n }\n\n /* Initialize streaming buffer context */\n memset(&strm, '\\0', sizeof(strm));\n strm.zalloc = Z_NULL;\n strm.zfree = Z_NULL;\n strm.opaque = Z_NULL;\n strm.next_in = in_data;\n strm.avail_in = in_len;\n strm.total_out = 0;\n\n /* Deflate mode */\n deflateInit2(&strm, Z_DEFAULT_COMPRESSION,\n Z_DEFLATED, -Z_DEFAULT_WINDOW_BITS, 9, Z_DEFAULT_STRATEGY);\n\n /*\n * Miniz don't support GZip format directly, instead we will:\n *\n * - append manual GZip magic bytes\n * - deflate raw content\n * - append manual CRC32 data\n */\n gzip_header(out_buf);\n\n /* Header offset */\n pb = (uint8_t *) out_buf + FLB_GZIP_HEADER_OFFSET;\n\n flush = Z_NO_FLUSH;\n while (1) {\n strm.next_out = pb + strm.total_out;\n strm.avail_out = out_size - (pb - (uint8_t *) out_buf);\n\n if (strm.avail_in == 0) {\n flush = Z_FINISH;\n }\n\n status = deflate(&strm, flush);\n if (status == Z_STREAM_END) {\n break;\n }\n else if (status != Z_OK) {\n deflateEnd(&strm);\n return -1;\n }\n }\n\n if (deflateEnd(&strm) != Z_OK) {\n flb_free(out_buf);\n return -1;\n }\n *out_len = strm.total_out;\n\n /* Construct the gzip checksum (CRC32 footer) */\n footer_start = FLB_GZIP_HEADER_OFFSET + *out_len;\n pb = (uint8_t *) out_buf + footer_start;\n\n crc = mz_crc32(MZ_CRC32_INIT, in_data, in_len);\n *pb++ = crc & 0xFF;\n *pb++ = (crc >> 8) & 0xFF;\n *pb++ = (crc >> 16) & 0xFF;\n *pb++ = (crc >> 24) & 0xFF;\n *pb++ = in_len & 0xFF;\n *pb++ = (in_len >> 8) & 0xFF;\n *pb++ = (in_len >> 16) & 0xFF;\n *pb++ = (in_len >> 24) & 0xFF;\n\n /* Set the real buffer size for the caller */\n *out_len += FLB_GZIP_HEADER_OFFSET + 8;\n *out_data = out_buf;\n\n return 0;\n}","lang":"c","vul_type":"cwe-787","target_token_count":843,"sven_meta":{"func_name":"flb_gzip_compress","file_name":"src/flb_gzip.c","commit_link":"github.com/fluent/fluent-bit/commit/cadff53c093210404aed01c4cf586adb8caa07af","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#20-0a526cba418b","input":"sc_oberthur_read_file(struct sc_pkcs15_card *p15card, const char *in_path,\n\t\tunsigned char **out, size_t *out_len,\n\t\tint verify_pin)\n{\n\tstruct sc_context *ctx = p15card->card->ctx;\n\tstruct sc_card *card = p15card->card;\n\tstruct sc_file *file = NULL;\n\tstruct sc_path path;\n\tsize_t sz;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tif (!in_path || !out || !out_len)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, \"Cannot read oberthur file\");\n\n\tsc_log(ctx, \"read file '%s'; verify_pin:%i\", in_path, verify_pin);\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\tsc_format_path(in_path, &path);\n\trv = sc_select_file(card, &path, &file);\n\tif (rv != SC_SUCCESS) {\n\t\tsc_file_free(file);\n\t\tLOG_TEST_RET(ctx, rv, \"Cannot select oberthur file to read\");\n\t}\n\n\tif (file->ef_structure == SC_FILE_EF_TRANSPARENT)\n\t\tsz = file->size;\n\telse\n\t\tsz = (file->record_length + 2) * file->record_count;\n\n\t*out = calloc(sz, 1);\n\tif (*out == NULL) {\n\t\tsc_file_free(file);\n\t\tLOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, \"Cannot read oberthur file\");\n\t}\n\n\tif (file->ef_structure == SC_FILE_EF_TRANSPARENT) {\n\t\trv = sc_read_binary(card, 0, *out, sz, 0);\n\t}\n\telse\t{\n\t\tint rec;\n\t\tint offs = 0;\n\t\tint rec_len = file->record_length;\n\n\t\tfor (rec = 1; ; rec++) {\n\t\t\trv = sc_read_record(card, rec, *out + offs + 2, rec_len, SC_RECORD_BY_REC_NR);\n\t\t\tif (rv == SC_ERROR_RECORD_NOT_FOUND) {\n\t\t\t\trv = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (rv < 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\trec_len = rv;\n\n\t\t\t*(*out + offs) = 'R';\n\t\t\t*(*out + offs + 1) = rv;\n\n\t\t\toffs += rv + 2;\n\t\t}\n\n\t\tsz = offs;\n\t}\n\n\tsc_log(ctx, \"read oberthur file result %i\", rv);\n\tif (verify_pin && rv == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED) {\n\t\tstruct sc_pkcs15_object *objs[0x10], *pin_obj = NULL;\n\t\tconst struct sc_acl_entry *acl = sc_file_get_acl_entry(file, SC_AC_OP_READ);\n\t\tint ii;\n\n\t\trv = sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_AUTH_PIN, objs, 0x10);\n\t\tif (rv != SC_SUCCESS) {\n\t\t\tsc_file_free(file);\n\t\t\tLOG_TEST_RET(ctx, rv, \"Cannot read oberthur file: get AUTH objects error\");\n\t\t}\n\n\t\tfor (ii=0; iidata;\n\t\t\tsc_log(ctx, \"compare PIN/ACL refs:%i/%i, method:%i/%i\",\n\t\t\t\t\tauth_info->attrs.pin.reference, acl->key_ref, auth_info->auth_method, acl->method);\n\t\t\tif (auth_info->attrs.pin.reference == (int)acl->key_ref && auth_info->auth_method == (unsigned)acl->method) {\n\t\t\t\tpin_obj = objs[ii];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!pin_obj || !pin_obj->content.value) {\n\t\t\trv = SC_ERROR_SECURITY_STATUS_NOT_SATISFIED;\n\t\t}\n\t\telse {\n\t\t\trv = sc_pkcs15_verify_pin(p15card, pin_obj, pin_obj->content.value, pin_obj->content.len);\n\t\t\tif (!rv)\n\t\t\t\trv = sc_oberthur_read_file(p15card, in_path, out, out_len, 0);\n\t\t}\n\t};\n\n\tsc_file_free(file);\n\n\tif (rv < 0) {\n\t\tfree(*out);\n\t\t*out = NULL;\n\t\t*out_len = 0;\n\t}\n\n\t*out_len = sz;\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}","target":"sc_oberthur_read_file(struct sc_pkcs15_card *p15card, const char *in_path,\n\t\tunsigned char **out, size_t *out_len,\n\t\tint verify_pin)\n{\n\tstruct sc_context *ctx = p15card->card->ctx;\n\tstruct sc_card *card = p15card->card;\n\tstruct sc_file *file = NULL;\n\tstruct sc_path path;\n\tsize_t sz;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tif (!in_path || !out || !out_len)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, \"Cannot read oberthur file\");\n\n\tsc_log(ctx, \"read file '%s'; verify_pin:%i\", in_path, verify_pin);\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\tsc_format_path(in_path, &path);\n\trv = sc_select_file(card, &path, &file);\n\tif (rv != SC_SUCCESS) {\n\t\tsc_file_free(file);\n\t\tLOG_TEST_RET(ctx, rv, \"Cannot select oberthur file to read\");\n\t}\n\n\tif (file->ef_structure == SC_FILE_EF_TRANSPARENT)\n\t\tsz = file->size;\n\telse\n\t\tsz = (file->record_length + 2) * file->record_count;\n\n\t*out = calloc(sz, 1);\n\tif (*out == NULL) {\n\t\tsc_file_free(file);\n\t\tLOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, \"Cannot read oberthur file\");\n\t}\n\n\tif (file->ef_structure == SC_FILE_EF_TRANSPARENT) {\n\t\trv = sc_read_binary(card, 0, *out, sz, 0);\n\t}\n\telse\t{\n\t\tsize_t rec;\n\t\tsize_t offs = 0;\n\t\tsize_t rec_len = file->record_length;\n\n\t\tfor (rec = 1; ; rec++) {\n\t\t\tif (rec > file->record_count) {\n\t\t\t\trv = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\trv = sc_read_record(card, rec, *out + offs + 2, rec_len, SC_RECORD_BY_REC_NR);\n\t\t\tif (rv == SC_ERROR_RECORD_NOT_FOUND) {\n\t\t\t\trv = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (rv < 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\trec_len = rv;\n\n\t\t\t*(*out + offs) = 'R';\n\t\t\t*(*out + offs + 1) = rv;\n\n\t\t\toffs += rv + 2;\n\t\t}\n\n\t\tsz = offs;\n\t}\n\n\tsc_log(ctx, \"read oberthur file result %i\", rv);\n\tif (verify_pin && rv == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED) {\n\t\tstruct sc_pkcs15_object *objs[0x10], *pin_obj = NULL;\n\t\tconst struct sc_acl_entry *acl = sc_file_get_acl_entry(file, SC_AC_OP_READ);\n\t\tint ii;\n\n\t\trv = sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_AUTH_PIN, objs, 0x10);\n\t\tif (rv != SC_SUCCESS) {\n\t\t\tsc_file_free(file);\n\t\t\tLOG_TEST_RET(ctx, rv, \"Cannot read oberthur file: get AUTH objects error\");\n\t\t}\n\n\t\tfor (ii=0; iidata;\n\t\t\tsc_log(ctx, \"compare PIN/ACL refs:%i/%i, method:%i/%i\",\n\t\t\t\t\tauth_info->attrs.pin.reference, acl->key_ref, auth_info->auth_method, acl->method);\n\t\t\tif (auth_info->attrs.pin.reference == (int)acl->key_ref && auth_info->auth_method == (unsigned)acl->method) {\n\t\t\t\tpin_obj = objs[ii];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!pin_obj || !pin_obj->content.value) {\n\t\t\trv = SC_ERROR_SECURITY_STATUS_NOT_SATISFIED;\n\t\t}\n\t\telse {\n\t\t\trv = sc_pkcs15_verify_pin(p15card, pin_obj, pin_obj->content.value, pin_obj->content.len);\n\t\t\tif (!rv)\n\t\t\t\trv = sc_oberthur_read_file(p15card, in_path, out, out_len, 0);\n\t\t}\n\t};\n\n\tsc_file_free(file);\n\n\tif (rv < 0) {\n\t\tfree(*out);\n\t\t*out = NULL;\n\t\t*out_len = 0;\n\t}\n\n\t*out_len = sz;\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}","lang":"c","vul_type":"cwe-787","target_token_count":963,"sven_meta":{"func_name":"sc_oberthur_read_file","file_name":"src/libopensc/pkcs15-oberthur.c","commit_link":"github.com/OpenSC/OpenSC/commit/6903aebfddc466d966c7b865fae34572bf3ed23e","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#22-7485c08e0f2e","input":"int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,\n\t\t\t const struct host_cmd_ds_command *resp)\n{\n\tu8 *curr = (u8 *) &resp->params.get_wmm_status;\n\tuint16_t resp_len = le16_to_cpu(resp->size), tlv_len;\n\tint mask = IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK;\n\tbool valid = true;\n\n\tstruct mwifiex_ie_types_data *tlv_hdr;\n\tstruct mwifiex_ie_types_wmm_queue_status *tlv_wmm_qstatus;\n\tstruct ieee_types_wmm_parameter *wmm_param_ie = NULL;\n\tstruct mwifiex_wmm_ac_status *ac_status;\n\n\tmwifiex_dbg(priv->adapter, INFO,\n\t\t \"info: WMM: WMM_GET_STATUS cmdresp received: %d\\n\",\n\t\t resp_len);\n\n\twhile ((resp_len >= sizeof(tlv_hdr->header)) && valid) {\n\t\ttlv_hdr = (struct mwifiex_ie_types_data *) curr;\n\t\ttlv_len = le16_to_cpu(tlv_hdr->header.len);\n\n\t\tif (resp_len < tlv_len + sizeof(tlv_hdr->header))\n\t\t\tbreak;\n\n\t\tswitch (le16_to_cpu(tlv_hdr->header.type)) {\n\t\tcase TLV_TYPE_WMMQSTATUS:\n\t\t\ttlv_wmm_qstatus =\n\t\t\t\t(struct mwifiex_ie_types_wmm_queue_status *)\n\t\t\t\ttlv_hdr;\n\t\t\tmwifiex_dbg(priv->adapter, CMD,\n\t\t\t\t \"info: CMD_RESP: WMM_GET_STATUS:\\t\"\n\t\t\t\t \"QSTATUS TLV: %d, %d, %d\\n\",\n\t\t\t\t tlv_wmm_qstatus->queue_index,\n\t\t\t\t tlv_wmm_qstatus->flow_required,\n\t\t\t\t tlv_wmm_qstatus->disabled);\n\n\t\t\tac_status = &priv->wmm.ac_status[tlv_wmm_qstatus->\n\t\t\t\t\t\t\t queue_index];\n\t\t\tac_status->disabled = tlv_wmm_qstatus->disabled;\n\t\t\tac_status->flow_required =\n\t\t\t\t\t\ttlv_wmm_qstatus->flow_required;\n\t\t\tac_status->flow_created = tlv_wmm_qstatus->flow_created;\n\t\t\tbreak;\n\n\t\tcase WLAN_EID_VENDOR_SPECIFIC:\n\t\t\t/*\n\t\t\t * Point the regular IEEE IE 2 bytes into the Marvell IE\n\t\t\t * and setup the IEEE IE type and length byte fields\n\t\t\t */\n\n\t\t\twmm_param_ie =\n\t\t\t\t(struct ieee_types_wmm_parameter *) (curr +\n\t\t\t\t\t\t\t\t 2);\n\t\t\twmm_param_ie->vend_hdr.len = (u8) tlv_len;\n\t\t\twmm_param_ie->vend_hdr.element_id =\n\t\t\t\t\t\tWLAN_EID_VENDOR_SPECIFIC;\n\n\t\t\tmwifiex_dbg(priv->adapter, CMD,\n\t\t\t\t \"info: CMD_RESP: WMM_GET_STATUS:\\t\"\n\t\t\t\t \"WMM Parameter Set Count: %d\\n\",\n\t\t\t\t wmm_param_ie->qos_info_bitmap & mask);\n\n\t\t\tmemcpy((u8 *) &priv->curr_bss_params.bss_descriptor.\n\t\t\t wmm_ie, wmm_param_ie,\n\t\t\t wmm_param_ie->vend_hdr.len + 2);\n\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tvalid = false;\n\t\t\tbreak;\n\t\t}\n\n\t\tcurr += (tlv_len + sizeof(tlv_hdr->header));\n\t\tresp_len -= (tlv_len + sizeof(tlv_hdr->header));\n\t}\n\n\tmwifiex_wmm_setup_queue_priorities(priv, wmm_param_ie);\n\tmwifiex_wmm_setup_ac_downgrade(priv);\n\n\treturn 0;\n}","target":"int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,\n\t\t\t const struct host_cmd_ds_command *resp)\n{\n\tu8 *curr = (u8 *) &resp->params.get_wmm_status;\n\tuint16_t resp_len = le16_to_cpu(resp->size), tlv_len;\n\tint mask = IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK;\n\tbool valid = true;\n\n\tstruct mwifiex_ie_types_data *tlv_hdr;\n\tstruct mwifiex_ie_types_wmm_queue_status *tlv_wmm_qstatus;\n\tstruct ieee_types_wmm_parameter *wmm_param_ie = NULL;\n\tstruct mwifiex_wmm_ac_status *ac_status;\n\n\tmwifiex_dbg(priv->adapter, INFO,\n\t\t \"info: WMM: WMM_GET_STATUS cmdresp received: %d\\n\",\n\t\t resp_len);\n\n\twhile ((resp_len >= sizeof(tlv_hdr->header)) && valid) {\n\t\ttlv_hdr = (struct mwifiex_ie_types_data *) curr;\n\t\ttlv_len = le16_to_cpu(tlv_hdr->header.len);\n\n\t\tif (resp_len < tlv_len + sizeof(tlv_hdr->header))\n\t\t\tbreak;\n\n\t\tswitch (le16_to_cpu(tlv_hdr->header.type)) {\n\t\tcase TLV_TYPE_WMMQSTATUS:\n\t\t\ttlv_wmm_qstatus =\n\t\t\t\t(struct mwifiex_ie_types_wmm_queue_status *)\n\t\t\t\ttlv_hdr;\n\t\t\tmwifiex_dbg(priv->adapter, CMD,\n\t\t\t\t \"info: CMD_RESP: WMM_GET_STATUS:\\t\"\n\t\t\t\t \"QSTATUS TLV: %d, %d, %d\\n\",\n\t\t\t\t tlv_wmm_qstatus->queue_index,\n\t\t\t\t tlv_wmm_qstatus->flow_required,\n\t\t\t\t tlv_wmm_qstatus->disabled);\n\n\t\t\tac_status = &priv->wmm.ac_status[tlv_wmm_qstatus->\n\t\t\t\t\t\t\t queue_index];\n\t\t\tac_status->disabled = tlv_wmm_qstatus->disabled;\n\t\t\tac_status->flow_required =\n\t\t\t\t\t\ttlv_wmm_qstatus->flow_required;\n\t\t\tac_status->flow_created = tlv_wmm_qstatus->flow_created;\n\t\t\tbreak;\n\n\t\tcase WLAN_EID_VENDOR_SPECIFIC:\n\t\t\t/*\n\t\t\t * Point the regular IEEE IE 2 bytes into the Marvell IE\n\t\t\t * and setup the IEEE IE type and length byte fields\n\t\t\t */\n\n\t\t\twmm_param_ie =\n\t\t\t\t(struct ieee_types_wmm_parameter *) (curr +\n\t\t\t\t\t\t\t\t 2);\n\t\t\twmm_param_ie->vend_hdr.len = (u8) tlv_len;\n\t\t\twmm_param_ie->vend_hdr.element_id =\n\t\t\t\t\t\tWLAN_EID_VENDOR_SPECIFIC;\n\n\t\t\tmwifiex_dbg(priv->adapter, CMD,\n\t\t\t\t \"info: CMD_RESP: WMM_GET_STATUS:\\t\"\n\t\t\t\t \"WMM Parameter Set Count: %d\\n\",\n\t\t\t\t wmm_param_ie->qos_info_bitmap & mask);\n\n\t\t\tif (wmm_param_ie->vend_hdr.len + 2 >\n\t\t\t\tsizeof(struct ieee_types_wmm_parameter))\n\t\t\t\tbreak;\n\n\t\t\tmemcpy((u8 *) &priv->curr_bss_params.bss_descriptor.\n\t\t\t wmm_ie, wmm_param_ie,\n\t\t\t wmm_param_ie->vend_hdr.len + 2);\n\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tvalid = false;\n\t\t\tbreak;\n\t\t}\n\n\t\tcurr += (tlv_len + sizeof(tlv_hdr->header));\n\t\tresp_len -= (tlv_len + sizeof(tlv_hdr->header));\n\t}\n\n\tmwifiex_wmm_setup_queue_priorities(priv, wmm_param_ie);\n\tmwifiex_wmm_setup_ac_downgrade(priv);\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-787","target_token_count":760,"sven_meta":{"func_name":"mwifiex_ret_wmm_get_status","file_name":"drivers/net/wireless/marvell/mwifiex/wmm.c","commit_link":"github.com/torvalds/linux/commit/3a9b153c5591548612c3955c9600a98150c81875","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#23-df154c19bd19","input":"static PyObject* patch(PyObject* self, PyObject* args)\n{\n char *origData, *newData, *diffBlock, *extraBlock, *diffPtr, *extraPtr;\n Py_ssize_t origDataLength, newDataLength, diffBlockLength, extraBlockLength;\n PyObject *controlTuples, *tuple, *results;\n off_t oldpos, newpos, x, y, z;\n int i, j, numTuples;\n\n if (!PyArg_ParseTuple(args, \"s#nO!s#s#\",\n &origData, &origDataLength, &newDataLength,\n &PyList_Type, &controlTuples,\n &diffBlock, &diffBlockLength,\n &extraBlock, &extraBlockLength))\n return NULL;\n\n /* allocate the memory for the new data */\n newData = PyMem_Malloc(newDataLength + 1);\n if (!newData)\n return PyErr_NoMemory();\n\n oldpos = 0;\n newpos = 0;\n diffPtr = diffBlock;\n extraPtr = extraBlock;\n numTuples = PyList_GET_SIZE(controlTuples);\n for (i = 0; i < numTuples; i++) {\n tuple = PyList_GET_ITEM(controlTuples, i);\n if (!PyTuple_Check(tuple)) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_TypeError, \"expecting tuple\");\n return NULL;\n }\n if (PyTuple_GET_SIZE(tuple) != 3) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_TypeError, \"expecting tuple of size 3\");\n return NULL;\n }\n x = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 0));\n y = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 1));\n z = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 2));\n if (newpos + x > newDataLength ||\n diffPtr + x > diffBlock + diffBlockLength ||\n extraPtr + y > extraBlock + extraBlockLength) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_ValueError, \"corrupt patch (overflow)\");\n return NULL;\n }\n memcpy(newData + newpos, diffPtr, x);\n diffPtr += x;\n for (j = 0; j < x; j++)\n if ((oldpos + j >= 0) && (oldpos + j < origDataLength))\n newData[newpos + j] += origData[oldpos + j];\n newpos += x;\n oldpos += x;\n memcpy(newData + newpos, extraPtr, y);\n extraPtr += y;\n newpos += y;\n oldpos += z;\n }\n\n /* confirm that a valid patch was applied */\n if (newpos != newDataLength ||\n diffPtr != diffBlock + diffBlockLength ||\n extraPtr != extraBlock + extraBlockLength) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_ValueError, \"corrupt patch (underflow)\");\n return NULL;\n }\n\n results = PyBytes_FromStringAndSize(newData, newDataLength);\n PyMem_Free(newData);\n return results;\n}","target":"static PyObject* patch(PyObject* self, PyObject* args)\n{\n char *origData, *newData, *diffBlock, *extraBlock, *diffPtr, *extraPtr;\n Py_ssize_t origDataLength, newDataLength, diffBlockLength, extraBlockLength;\n PyObject *controlTuples, *tuple, *results;\n off_t oldpos, newpos, x, y, z;\n int i, j, numTuples;\n\n if (!PyArg_ParseTuple(args, \"s#nO!s#s#\",\n &origData, &origDataLength, &newDataLength,\n &PyList_Type, &controlTuples,\n &diffBlock, &diffBlockLength,\n &extraBlock, &extraBlockLength))\n return NULL;\n\n /* allocate the memory for the new data */\n newData = PyMem_Malloc(newDataLength + 1);\n if (!newData)\n return PyErr_NoMemory();\n\n oldpos = 0;\n newpos = 0;\n diffPtr = diffBlock;\n extraPtr = extraBlock;\n numTuples = PyList_GET_SIZE(controlTuples);\n for (i = 0; i < numTuples; i++) {\n tuple = PyList_GET_ITEM(controlTuples, i);\n if (!PyTuple_Check(tuple)) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_TypeError, \"expecting tuple\");\n return NULL;\n }\n if (PyTuple_GET_SIZE(tuple) != 3) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_TypeError, \"expecting tuple of size 3\");\n return NULL;\n }\n x = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 0));\n y = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 1));\n z = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 2));\n if (newpos + x > newDataLength ||\n diffPtr + x > diffBlock + diffBlockLength) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_ValueError, \"corrupt patch (overflow)\");\n return NULL;\n }\n memcpy(newData + newpos, diffPtr, x);\n diffPtr += x;\n for (j = 0; j < x; j++)\n if ((oldpos + j >= 0) && (oldpos + j < origDataLength))\n newData[newpos + j] += origData[oldpos + j];\n newpos += x;\n oldpos += x;\n if (newpos + y > newDataLength ||\n extraPtr + y > extraBlock + extraBlockLength) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_ValueError, \"corrupt patch (overflow)\");\n return NULL;\n }\n memcpy(newData + newpos, extraPtr, y);\n extraPtr += y;\n newpos += y;\n oldpos += z;\n }\n\n /* confirm that a valid patch was applied */\n if (newpos != newDataLength ||\n diffPtr != diffBlock + diffBlockLength ||\n extraPtr != extraBlock + extraBlockLength) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_ValueError, \"corrupt patch (underflow)\");\n return NULL;\n }\n\n results = PyBytes_FromStringAndSize(newData, newDataLength);\n PyMem_Free(newData);\n return results;\n}","lang":"c","vul_type":"cwe-787","target_token_count":726,"sven_meta":{"func_name":"patch","file_name":"bsdiff4/core.c","commit_link":"github.com/ilanschnell/bsdiff4/commit/49a4cee2feef7deaf9d89e5e793a8824930284d7","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#24-0c418166dabe","input":"HandleRFBServerMessage(rfbClient* client)\n{\n rfbServerToClientMsg msg;\n\n if (client->serverPort==-1)\n client->vncRec->readTimestamp = TRUE;\n if (!ReadFromRFBServer(client, (char *)&msg, 1))\n return FALSE;\n\n switch (msg.type) {\n\n case rfbSetColourMapEntries:\n {\n /* TODO:\n int i;\n uint16_t rgb[3];\n XColor xc;\n\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n\t\t\t sz_rfbSetColourMapEntriesMsg - 1))\n return FALSE;\n\n msg.scme.firstColour = rfbClientSwap16IfLE(msg.scme.firstColour);\n msg.scme.nColours = rfbClientSwap16IfLE(msg.scme.nColours);\n\n for (i = 0; i < msg.scme.nColours; i++) {\n if (!ReadFromRFBServer(client, (char *)rgb, 6))\n\treturn FALSE;\n xc.pixel = msg.scme.firstColour + i;\n xc.red = rfbClientSwap16IfLE(rgb[0]);\n xc.green = rfbClientSwap16IfLE(rgb[1]);\n xc.blue = rfbClientSwap16IfLE(rgb[2]);\n xc.flags = DoRed|DoGreen|DoBlue;\n XStoreColor(dpy, cmap, &xc);\n }\n */\n\n break;\n }\n\n case rfbFramebufferUpdate:\n {\n rfbFramebufferUpdateRectHeader rect;\n int linesToRead;\n int bytesPerLine;\n int i;\n\n if (!ReadFromRFBServer(client, ((char *)&msg.fu) + 1,\n\t\t\t sz_rfbFramebufferUpdateMsg - 1))\n return FALSE;\n\n msg.fu.nRects = rfbClientSwap16IfLE(msg.fu.nRects);\n\n for (i = 0; i < msg.fu.nRects; i++) {\n if (!ReadFromRFBServer(client, (char *)&rect, sz_rfbFramebufferUpdateRectHeader))\n\treturn FALSE;\n\n rect.encoding = rfbClientSwap32IfLE(rect.encoding);\n if (rect.encoding == rfbEncodingLastRect)\n\tbreak;\n\n rect.r.x = rfbClientSwap16IfLE(rect.r.x);\n rect.r.y = rfbClientSwap16IfLE(rect.r.y);\n rect.r.w = rfbClientSwap16IfLE(rect.r.w);\n rect.r.h = rfbClientSwap16IfLE(rect.r.h);\n\n\n if (rect.encoding == rfbEncodingXCursor ||\n\t rect.encoding == rfbEncodingRichCursor) {\n\n\tif (!HandleCursorShape(client,\n\t\t\t rect.r.x, rect.r.y, rect.r.w, rect.r.h,\n\t\t\t rect.encoding)) {\n\t return FALSE;\n\t}\n\tcontinue;\n }\n\n if (rect.encoding == rfbEncodingPointerPos) {\n\tif (!client->HandleCursorPos(client,rect.r.x, rect.r.y)) {\n\t return FALSE;\n\t}\n\tcontinue;\n }\n \n if (rect.encoding == rfbEncodingKeyboardLedState) {\n /* OK! We have received a keyboard state message!!! */\n client->KeyboardLedStateEnabled = 1;\n if (client->HandleKeyboardLedState!=NULL)\n client->HandleKeyboardLedState(client, rect.r.x, 0);\n /* stash it for the future */\n client->CurrentKeyboardLedState = rect.r.x;\n continue;\n }\n\n if (rect.encoding == rfbEncodingNewFBSize) {\n\tclient->width = rect.r.w;\n\tclient->height = rect.r.h;\n\tclient->updateRect.x = client->updateRect.y = 0;\n\tclient->updateRect.w = client->width;\n\tclient->updateRect.h = client->height;\n\tif (!client->MallocFrameBuffer(client))\n\t return FALSE;\n\tSendFramebufferUpdateRequest(client, 0, 0, rect.r.w, rect.r.h, FALSE);\n\trfbClientLog(\"Got new framebuffer size: %dx%d\\n\", rect.r.w, rect.r.h);\n\tcontinue;\n }\n\n /* rect.r.w=byte count */\n if (rect.encoding == rfbEncodingSupportedMessages) {\n int loop;\n if (!ReadFromRFBServer(client, (char *)&client->supportedMessages, sz_rfbSupportedMessages))\n return FALSE;\n\n /* msgs is two sets of bit flags of supported messages client2server[] and server2client[] */\n /* currently ignored by this library */\n\n rfbClientLog(\"client2server supported messages (bit flags)\\n\");\n for (loop=0;loop<32;loop+=8)\n rfbClientLog(\"%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\\n\", loop,\n client->supportedMessages.client2server[loop], client->supportedMessages.client2server[loop+1],\n client->supportedMessages.client2server[loop+2], client->supportedMessages.client2server[loop+3],\n client->supportedMessages.client2server[loop+4], client->supportedMessages.client2server[loop+5],\n client->supportedMessages.client2server[loop+6], client->supportedMessages.client2server[loop+7]);\n\n rfbClientLog(\"server2client supported messages (bit flags)\\n\");\n for (loop=0;loop<32;loop+=8)\n rfbClientLog(\"%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\\n\", loop,\n client->supportedMessages.server2client[loop], client->supportedMessages.server2client[loop+1],\n client->supportedMessages.server2client[loop+2], client->supportedMessages.server2client[loop+3],\n client->supportedMessages.server2client[loop+4], client->supportedMessages.server2client[loop+5],\n client->supportedMessages.server2client[loop+6], client->supportedMessages.server2client[loop+7]);\n continue;\n }\n\n /* rect.r.w=byte count, rect.r.h=# of encodings */\n if (rect.encoding == rfbEncodingSupportedEncodings) {\n char *buffer;\n buffer = malloc(rect.r.w);\n if (!ReadFromRFBServer(client, buffer, rect.r.w))\n {\n free(buffer);\n return FALSE;\n }\n\n /* buffer now contains rect.r.h # of uint32_t encodings that the server supports */\n /* currently ignored by this library */\n free(buffer);\n continue;\n }\n\n /* rect.r.w=byte count */\n if (rect.encoding == rfbEncodingServerIdentity) {\n char *buffer;\n buffer = malloc(rect.r.w+1);\n if (!ReadFromRFBServer(client, buffer, rect.r.w))\n {\n free(buffer);\n return FALSE;\n }\n buffer[rect.r.w]=0; /* null terminate, just in case */\n rfbClientLog(\"Connected to Server \\\"%s\\\"\\n\", buffer);\n free(buffer);\n continue;\n }\n\n /* rfbEncodingUltraZip is a collection of subrects. x = # of subrects, and h is always 0 */\n if (rect.encoding != rfbEncodingUltraZip)\n {\n if ((rect.r.x + rect.r.w > client->width) ||\n\t (rect.r.y + rect.r.h > client->height))\n\t {\n\t rfbClientLog(\"Rect too large: %dx%d at (%d, %d)\\n\",\n\t \t rect.r.w, rect.r.h, rect.r.x, rect.r.y);\n\t return FALSE;\n }\n\n /* UltraVNC with scaling, will send rectangles with a zero W or H\n *\n if ((rect.encoding != rfbEncodingTight) && \n (rect.r.h * rect.r.w == 0))\n {\n\t rfbClientLog(\"Zero size rect - ignoring (encoding=%d (0x%08x) %dx, %dy, %dw, %dh)\\n\", rect.encoding, rect.encoding, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n\t continue;\n }\n */\n \n /* If RichCursor encoding is used, we should prevent collisions\n\t between framebuffer updates and cursor drawing operations. */\n client->SoftCursorLockArea(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n }\n\n switch (rect.encoding) {\n\n case rfbEncodingRaw: {\n\tint y=rect.r.y, h=rect.r.h;\n\n\tbytesPerLine = rect.r.w * client->format.bitsPerPixel / 8;\n\t/* RealVNC 4.x-5.x on OSX can induce bytesPerLine==0, \n\t usually during GPU accel. */\n\t/* Regardless of cause, do not divide by zero. */\n\tlinesToRead = bytesPerLine ? (RFB_BUFFER_SIZE / bytesPerLine) : 0;\n\n\twhile (linesToRead && h > 0) {\n\t if (linesToRead > h)\n\t linesToRead = h;\n\n\t if (!ReadFromRFBServer(client, client->buffer,bytesPerLine * linesToRead))\n\t return FALSE;\n\n\t client->GotBitmap(client, (uint8_t *)client->buffer,\n\t\t\t rect.r.x, y, rect.r.w,linesToRead);\n\n\t h -= linesToRead;\n\t y += linesToRead;\n\n\t}\n\tbreak;\n } \n\n case rfbEncodingCopyRect:\n {\n\trfbCopyRect cr;\n\n\tif (!ReadFromRFBServer(client, (char *)&cr, sz_rfbCopyRect))\n\t return FALSE;\n\n\tcr.srcX = rfbClientSwap16IfLE(cr.srcX);\n\tcr.srcY = rfbClientSwap16IfLE(cr.srcY);\n\n\t/* If RichCursor encoding is used, we should extend our\n\t \"cursor lock area\" (previously set to destination\n\t rectangle) to the source rectangle as well. */\n\tclient->SoftCursorLockArea(client,\n\t\t\t\t cr.srcX, cr.srcY, rect.r.w, rect.r.h);\n\n client->GotCopyRect(client, cr.srcX, cr.srcY, rect.r.w, rect.r.h,\n rect.r.x, rect.r.y);\n\n\tbreak;\n }\n\n case rfbEncodingRRE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleRRE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleRRE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleRRE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingCoRRE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleCoRRE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleCoRRE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleCoRRE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingHextile:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleHextile8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleHextile16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleHextile32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingUltra:\n {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleUltra8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 16:\n if (!HandleUltra16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 32:\n if (!HandleUltra32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n }\n break;\n }\n case rfbEncodingUltraZip:\n {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleUltraZip8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 16:\n if (!HandleUltraZip16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 32:\n if (!HandleUltraZip32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n }\n break;\n }\n\n case rfbEncodingTRLE:\n\t {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleTRLE8(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n break;\n case 16:\n if (client->si.format.greenMax > 0x1F) {\n if (!HandleTRLE16(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else {\n if (!HandleTRLE15(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n }\n break;\n case 32: {\n uint32_t maxColor =\n (client->format.redMax << client->format.redShift) |\n (client->format.greenMax << client->format.greenShift) |\n (client->format.blueMax << client->format.blueShift);\n if ((client->format.bigEndian && (maxColor & 0xff) == 0) ||\n (!client->format.bigEndian && (maxColor & 0xff000000) == 0)) {\n if (!HandleTRLE24(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else if (!client->format.bigEndian && (maxColor & 0xff) == 0) {\n if (!HandleTRLE24Up(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else if (client->format.bigEndian && (maxColor & 0xff000000) == 0) {\n if (!HandleTRLE24Down(client, rect.r.x, rect.r.y, rect.r.w,\n rect.r.h))\n return FALSE;\n } else if (!HandleTRLE32(client, rect.r.x, rect.r.y, rect.r.w,\n rect.r.h))\n return FALSE;\n break;\n }\n }\n break;\n }\n\n#ifdef LIBVNCSERVER_HAVE_LIBZ\n case rfbEncodingZlib:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleZlib8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleZlib16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleZlib32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n#ifdef LIBVNCSERVER_HAVE_LIBJPEG\n case rfbEncodingTight:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleTight8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleTight16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleTight32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n#endif\n case rfbEncodingZRLE:\n\t/* Fail safe for ZYWRLE unsupport VNC server. */\n\tclient->appData.qualityLevel = 9;\n\t/* fall through */\n case rfbEncodingZYWRLE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleZRLE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (client->si.format.greenMax > 0x1F) {\n\t if (!HandleZRLE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else {\n\t if (!HandleZRLE15(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t }\n\t break;\n\tcase 32:\n\t{\n\t uint32_t maxColor=(client->format.redMax<format.redShift)|\n\t\t(client->format.greenMax<format.greenShift)|\n\t\t(client->format.blueMax<format.blueShift);\n\t if ((client->format.bigEndian && (maxColor&0xff)==0) ||\n\t (!client->format.bigEndian && (maxColor&0xff000000)==0)) {\n\t if (!HandleZRLE24(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (!client->format.bigEndian && (maxColor&0xff)==0) {\n\t if (!HandleZRLE24Up(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (client->format.bigEndian && (maxColor&0xff000000)==0) {\n\t if (!HandleZRLE24Down(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (!HandleZRLE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\t}\n\tbreak;\n }\n\n#endif\n\n default:\n\t {\n\t rfbBool handled = FALSE;\n\t rfbClientProtocolExtension* e;\n\n\t for(e = rfbClientExtensions; !handled && e; e = e->next)\n\t if(e->handleEncoding && e->handleEncoding(client, &rect))\n\t handled = TRUE;\n\n\t if(!handled) {\n\t rfbClientLog(\"Unknown rect encoding %d\\n\",\n\t\t (int)rect.encoding);\n\t return FALSE;\n\t }\n\t }\n }\n\n /* Now we may discard \"soft cursor locks\". */\n client->SoftCursorUnlockScreen(client);\n\n client->GotFrameBufferUpdate(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n }\n\n if (!SendIncrementalFramebufferUpdateRequest(client))\n return FALSE;\n\n if (client->FinishedFrameBufferUpdate)\n client->FinishedFrameBufferUpdate(client);\n\n break;\n }\n\n case rfbBell:\n {\n client->Bell(client);\n\n break;\n }\n\n case rfbServerCutText:\n {\n char *buffer;\n\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n\t\t\t sz_rfbServerCutTextMsg - 1))\n return FALSE;\n\n msg.sct.length = rfbClientSwap32IfLE(msg.sct.length);\n\n if (msg.sct.length > 1<<20) {\n\t rfbClientErr(\"Ignoring too big cut text length sent by server: %u B > 1 MB\\n\", (unsigned int)msg.sct.length);\n\t return FALSE;\n } \n\n buffer = malloc((uint64_t)msg.sct.length+1);\n\n if (!ReadFromRFBServer(client, buffer, msg.sct.length)) {\n free(buffer);\n return FALSE;\n }\n\n buffer[msg.sct.length] = 0;\n\n if (client->GotXCutText)\n client->GotXCutText(client, buffer, msg.sct.length);\n\n free(buffer);\n\n break;\n }\n\n case rfbTextChat:\n {\n char *buffer=NULL;\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbTextChatMsg- 1))\n return FALSE;\n msg.tc.length = rfbClientSwap32IfLE(msg.sct.length);\n switch(msg.tc.length) {\n case rfbTextChatOpen:\n rfbClientLog(\"Received TextChat Open\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatOpen, NULL);\n break;\n case rfbTextChatClose:\n rfbClientLog(\"Received TextChat Close\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatClose, NULL);\n break;\n case rfbTextChatFinished:\n rfbClientLog(\"Received TextChat Finished\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatFinished, NULL);\n break;\n default:\n buffer=malloc(msg.tc.length+1);\n if (!ReadFromRFBServer(client, buffer, msg.tc.length))\n {\n free(buffer);\n return FALSE;\n }\n /* Null Terminate */\n buffer[msg.tc.length]=0;\n rfbClientLog(\"Received TextChat \\\"%s\\\"\\n\", buffer);\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)msg.tc.length, buffer);\n free(buffer);\n break;\n }\n break;\n }\n\n case rfbXvp:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbXvpMsg -1))\n return FALSE;\n\n SetClient2Server(client, rfbXvp);\n /* technically, we only care what we can *send* to the server\n * but, we set Server2Client Just in case it ever becomes useful\n */\n SetServer2Client(client, rfbXvp);\n\n if(client->HandleXvpMsg)\n client->HandleXvpMsg(client, msg.xvp.version, msg.xvp.code);\n\n break;\n }\n\n case rfbResizeFrameBuffer:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbResizeFrameBufferMsg -1))\n return FALSE;\n client->width = rfbClientSwap16IfLE(msg.rsfb.framebufferWidth);\n client->height = rfbClientSwap16IfLE(msg.rsfb.framebufferHeigth);\n client->updateRect.x = client->updateRect.y = 0;\n client->updateRect.w = client->width;\n client->updateRect.h = client->height;\n if (!client->MallocFrameBuffer(client))\n return FALSE;\n\n SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE);\n rfbClientLog(\"Got new framebuffer size: %dx%d\\n\", client->width, client->height);\n break;\n }\n\n case rfbPalmVNCReSizeFrameBuffer:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbPalmVNCReSizeFrameBufferMsg -1))\n return FALSE;\n client->width = rfbClientSwap16IfLE(msg.prsfb.buffer_w);\n client->height = rfbClientSwap16IfLE(msg.prsfb.buffer_h);\n client->updateRect.x = client->updateRect.y = 0;\n client->updateRect.w = client->width;\n client->updateRect.h = client->height;\n if (!client->MallocFrameBuffer(client))\n return FALSE;\n SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE);\n rfbClientLog(\"Got new framebuffer size: %dx%d\\n\", client->width, client->height);\n break;\n }\n\n default:\n {\n rfbBool handled = FALSE;\n rfbClientProtocolExtension* e;\n\n for(e = rfbClientExtensions; !handled && e; e = e->next)\n\tif(e->handleMessage && e->handleMessage(client, &msg))\n\t handled = TRUE;\n\n if(!handled) {\n\tchar buffer[256];\n\trfbClientLog(\"Unknown message type %d from VNC server\\n\",msg.type);\n\tReadFromRFBServer(client, buffer, 256);\n\treturn FALSE;\n }\n }\n }\n\n return TRUE;\n}","target":"HandleRFBServerMessage(rfbClient* client)\n{\n rfbServerToClientMsg msg;\n\n if (client->serverPort==-1)\n client->vncRec->readTimestamp = TRUE;\n if (!ReadFromRFBServer(client, (char *)&msg, 1))\n return FALSE;\n\n switch (msg.type) {\n\n case rfbSetColourMapEntries:\n {\n /* TODO:\n int i;\n uint16_t rgb[3];\n XColor xc;\n\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n\t\t\t sz_rfbSetColourMapEntriesMsg - 1))\n return FALSE;\n\n msg.scme.firstColour = rfbClientSwap16IfLE(msg.scme.firstColour);\n msg.scme.nColours = rfbClientSwap16IfLE(msg.scme.nColours);\n\n for (i = 0; i < msg.scme.nColours; i++) {\n if (!ReadFromRFBServer(client, (char *)rgb, 6))\n\treturn FALSE;\n xc.pixel = msg.scme.firstColour + i;\n xc.red = rfbClientSwap16IfLE(rgb[0]);\n xc.green = rfbClientSwap16IfLE(rgb[1]);\n xc.blue = rfbClientSwap16IfLE(rgb[2]);\n xc.flags = DoRed|DoGreen|DoBlue;\n XStoreColor(dpy, cmap, &xc);\n }\n */\n\n break;\n }\n\n case rfbFramebufferUpdate:\n {\n rfbFramebufferUpdateRectHeader rect;\n int linesToRead;\n int bytesPerLine;\n int i;\n\n if (!ReadFromRFBServer(client, ((char *)&msg.fu) + 1,\n\t\t\t sz_rfbFramebufferUpdateMsg - 1))\n return FALSE;\n\n msg.fu.nRects = rfbClientSwap16IfLE(msg.fu.nRects);\n\n for (i = 0; i < msg.fu.nRects; i++) {\n if (!ReadFromRFBServer(client, (char *)&rect, sz_rfbFramebufferUpdateRectHeader))\n\treturn FALSE;\n\n rect.encoding = rfbClientSwap32IfLE(rect.encoding);\n if (rect.encoding == rfbEncodingLastRect)\n\tbreak;\n\n rect.r.x = rfbClientSwap16IfLE(rect.r.x);\n rect.r.y = rfbClientSwap16IfLE(rect.r.y);\n rect.r.w = rfbClientSwap16IfLE(rect.r.w);\n rect.r.h = rfbClientSwap16IfLE(rect.r.h);\n\n\n if (rect.encoding == rfbEncodingXCursor ||\n\t rect.encoding == rfbEncodingRichCursor) {\n\n\tif (!HandleCursorShape(client,\n\t\t\t rect.r.x, rect.r.y, rect.r.w, rect.r.h,\n\t\t\t rect.encoding)) {\n\t return FALSE;\n\t}\n\tcontinue;\n }\n\n if (rect.encoding == rfbEncodingPointerPos) {\n\tif (!client->HandleCursorPos(client,rect.r.x, rect.r.y)) {\n\t return FALSE;\n\t}\n\tcontinue;\n }\n \n if (rect.encoding == rfbEncodingKeyboardLedState) {\n /* OK! We have received a keyboard state message!!! */\n client->KeyboardLedStateEnabled = 1;\n if (client->HandleKeyboardLedState!=NULL)\n client->HandleKeyboardLedState(client, rect.r.x, 0);\n /* stash it for the future */\n client->CurrentKeyboardLedState = rect.r.x;\n continue;\n }\n\n if (rect.encoding == rfbEncodingNewFBSize) {\n\tclient->width = rect.r.w;\n\tclient->height = rect.r.h;\n\tclient->updateRect.x = client->updateRect.y = 0;\n\tclient->updateRect.w = client->width;\n\tclient->updateRect.h = client->height;\n\tif (!client->MallocFrameBuffer(client))\n\t return FALSE;\n\tSendFramebufferUpdateRequest(client, 0, 0, rect.r.w, rect.r.h, FALSE);\n\trfbClientLog(\"Got new framebuffer size: %dx%d\\n\", rect.r.w, rect.r.h);\n\tcontinue;\n }\n\n /* rect.r.w=byte count */\n if (rect.encoding == rfbEncodingSupportedMessages) {\n int loop;\n if (!ReadFromRFBServer(client, (char *)&client->supportedMessages, sz_rfbSupportedMessages))\n return FALSE;\n\n /* msgs is two sets of bit flags of supported messages client2server[] and server2client[] */\n /* currently ignored by this library */\n\n rfbClientLog(\"client2server supported messages (bit flags)\\n\");\n for (loop=0;loop<32;loop+=8)\n rfbClientLog(\"%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\\n\", loop,\n client->supportedMessages.client2server[loop], client->supportedMessages.client2server[loop+1],\n client->supportedMessages.client2server[loop+2], client->supportedMessages.client2server[loop+3],\n client->supportedMessages.client2server[loop+4], client->supportedMessages.client2server[loop+5],\n client->supportedMessages.client2server[loop+6], client->supportedMessages.client2server[loop+7]);\n\n rfbClientLog(\"server2client supported messages (bit flags)\\n\");\n for (loop=0;loop<32;loop+=8)\n rfbClientLog(\"%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\\n\", loop,\n client->supportedMessages.server2client[loop], client->supportedMessages.server2client[loop+1],\n client->supportedMessages.server2client[loop+2], client->supportedMessages.server2client[loop+3],\n client->supportedMessages.server2client[loop+4], client->supportedMessages.server2client[loop+5],\n client->supportedMessages.server2client[loop+6], client->supportedMessages.server2client[loop+7]);\n continue;\n }\n\n /* rect.r.w=byte count, rect.r.h=# of encodings */\n if (rect.encoding == rfbEncodingSupportedEncodings) {\n char *buffer;\n buffer = malloc(rect.r.w);\n if (!ReadFromRFBServer(client, buffer, rect.r.w))\n {\n free(buffer);\n return FALSE;\n }\n\n /* buffer now contains rect.r.h # of uint32_t encodings that the server supports */\n /* currently ignored by this library */\n free(buffer);\n continue;\n }\n\n /* rect.r.w=byte count */\n if (rect.encoding == rfbEncodingServerIdentity) {\n char *buffer;\n buffer = malloc(rect.r.w+1);\n if (!ReadFromRFBServer(client, buffer, rect.r.w))\n {\n free(buffer);\n return FALSE;\n }\n buffer[rect.r.w]=0; /* null terminate, just in case */\n rfbClientLog(\"Connected to Server \\\"%s\\\"\\n\", buffer);\n free(buffer);\n continue;\n }\n\n /* rfbEncodingUltraZip is a collection of subrects. x = # of subrects, and h is always 0 */\n if (rect.encoding != rfbEncodingUltraZip)\n {\n if ((rect.r.x + rect.r.w > client->width) ||\n\t (rect.r.y + rect.r.h > client->height))\n\t {\n\t rfbClientLog(\"Rect too large: %dx%d at (%d, %d)\\n\",\n\t \t rect.r.w, rect.r.h, rect.r.x, rect.r.y);\n\t return FALSE;\n }\n\n /* UltraVNC with scaling, will send rectangles with a zero W or H\n *\n if ((rect.encoding != rfbEncodingTight) && \n (rect.r.h * rect.r.w == 0))\n {\n\t rfbClientLog(\"Zero size rect - ignoring (encoding=%d (0x%08x) %dx, %dy, %dw, %dh)\\n\", rect.encoding, rect.encoding, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n\t continue;\n }\n */\n \n /* If RichCursor encoding is used, we should prevent collisions\n\t between framebuffer updates and cursor drawing operations. */\n client->SoftCursorLockArea(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n }\n\n switch (rect.encoding) {\n\n case rfbEncodingRaw: {\n\tint y=rect.r.y, h=rect.r.h;\n\n\tbytesPerLine = rect.r.w * client->format.bitsPerPixel / 8;\n\t/* RealVNC 4.x-5.x on OSX can induce bytesPerLine==0, \n\t usually during GPU accel. */\n\t/* Regardless of cause, do not divide by zero. */\n\tlinesToRead = bytesPerLine ? (RFB_BUFFER_SIZE / bytesPerLine) : 0;\n\n\twhile (linesToRead && h > 0) {\n\t if (linesToRead > h)\n\t linesToRead = h;\n\n\t if (!ReadFromRFBServer(client, client->buffer,bytesPerLine * linesToRead))\n\t return FALSE;\n\n\t client->GotBitmap(client, (uint8_t *)client->buffer,\n\t\t\t rect.r.x, y, rect.r.w,linesToRead);\n\n\t h -= linesToRead;\n\t y += linesToRead;\n\n\t}\n\tbreak;\n } \n\n case rfbEncodingCopyRect:\n {\n\trfbCopyRect cr;\n\n\tif (!ReadFromRFBServer(client, (char *)&cr, sz_rfbCopyRect))\n\t return FALSE;\n\n\tcr.srcX = rfbClientSwap16IfLE(cr.srcX);\n\tcr.srcY = rfbClientSwap16IfLE(cr.srcY);\n\n\t/* If RichCursor encoding is used, we should extend our\n\t \"cursor lock area\" (previously set to destination\n\t rectangle) to the source rectangle as well. */\n\tclient->SoftCursorLockArea(client,\n\t\t\t\t cr.srcX, cr.srcY, rect.r.w, rect.r.h);\n\n client->GotCopyRect(client, cr.srcX, cr.srcY, rect.r.w, rect.r.h,\n rect.r.x, rect.r.y);\n\n\tbreak;\n }\n\n case rfbEncodingRRE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleRRE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleRRE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleRRE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingCoRRE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleCoRRE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleCoRRE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleCoRRE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingHextile:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleHextile8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleHextile16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleHextile32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingUltra:\n {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleUltra8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 16:\n if (!HandleUltra16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 32:\n if (!HandleUltra32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n }\n break;\n }\n case rfbEncodingUltraZip:\n {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleUltraZip8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 16:\n if (!HandleUltraZip16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 32:\n if (!HandleUltraZip32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n }\n break;\n }\n\n case rfbEncodingTRLE:\n\t {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleTRLE8(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n break;\n case 16:\n if (client->si.format.greenMax > 0x1F) {\n if (!HandleTRLE16(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else {\n if (!HandleTRLE15(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n }\n break;\n case 32: {\n uint32_t maxColor =\n (client->format.redMax << client->format.redShift) |\n (client->format.greenMax << client->format.greenShift) |\n (client->format.blueMax << client->format.blueShift);\n if ((client->format.bigEndian && (maxColor & 0xff) == 0) ||\n (!client->format.bigEndian && (maxColor & 0xff000000) == 0)) {\n if (!HandleTRLE24(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else if (!client->format.bigEndian && (maxColor & 0xff) == 0) {\n if (!HandleTRLE24Up(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else if (client->format.bigEndian && (maxColor & 0xff000000) == 0) {\n if (!HandleTRLE24Down(client, rect.r.x, rect.r.y, rect.r.w,\n rect.r.h))\n return FALSE;\n } else if (!HandleTRLE32(client, rect.r.x, rect.r.y, rect.r.w,\n rect.r.h))\n return FALSE;\n break;\n }\n }\n break;\n }\n\n#ifdef LIBVNCSERVER_HAVE_LIBZ\n case rfbEncodingZlib:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleZlib8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleZlib16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleZlib32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n#ifdef LIBVNCSERVER_HAVE_LIBJPEG\n case rfbEncodingTight:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleTight8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleTight16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleTight32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n#endif\n case rfbEncodingZRLE:\n\t/* Fail safe for ZYWRLE unsupport VNC server. */\n\tclient->appData.qualityLevel = 9;\n\t/* fall through */\n case rfbEncodingZYWRLE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleZRLE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (client->si.format.greenMax > 0x1F) {\n\t if (!HandleZRLE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else {\n\t if (!HandleZRLE15(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t }\n\t break;\n\tcase 32:\n\t{\n\t uint32_t maxColor=(client->format.redMax<format.redShift)|\n\t\t(client->format.greenMax<format.greenShift)|\n\t\t(client->format.blueMax<format.blueShift);\n\t if ((client->format.bigEndian && (maxColor&0xff)==0) ||\n\t (!client->format.bigEndian && (maxColor&0xff000000)==0)) {\n\t if (!HandleZRLE24(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (!client->format.bigEndian && (maxColor&0xff)==0) {\n\t if (!HandleZRLE24Up(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (client->format.bigEndian && (maxColor&0xff000000)==0) {\n\t if (!HandleZRLE24Down(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (!HandleZRLE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\t}\n\tbreak;\n }\n\n#endif\n\n default:\n\t {\n\t rfbBool handled = FALSE;\n\t rfbClientProtocolExtension* e;\n\n\t for(e = rfbClientExtensions; !handled && e; e = e->next)\n\t if(e->handleEncoding && e->handleEncoding(client, &rect))\n\t handled = TRUE;\n\n\t if(!handled) {\n\t rfbClientLog(\"Unknown rect encoding %d\\n\",\n\t\t (int)rect.encoding);\n\t return FALSE;\n\t }\n\t }\n }\n\n /* Now we may discard \"soft cursor locks\". */\n client->SoftCursorUnlockScreen(client);\n\n client->GotFrameBufferUpdate(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n }\n\n if (!SendIncrementalFramebufferUpdateRequest(client))\n return FALSE;\n\n if (client->FinishedFrameBufferUpdate)\n client->FinishedFrameBufferUpdate(client);\n\n break;\n }\n\n case rfbBell:\n {\n client->Bell(client);\n\n break;\n }\n\n case rfbServerCutText:\n {\n char *buffer;\n\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n\t\t\t sz_rfbServerCutTextMsg - 1))\n return FALSE;\n\n msg.sct.length = rfbClientSwap32IfLE(msg.sct.length);\n\n if (msg.sct.length > 1<<20) {\n\t rfbClientErr(\"Ignoring too big cut text length sent by server: %u B > 1 MB\\n\", (unsigned int)msg.sct.length);\n\t return FALSE;\n } \n\n buffer = malloc(msg.sct.length+1);\n\n if (!ReadFromRFBServer(client, buffer, msg.sct.length)) {\n free(buffer);\n return FALSE;\n }\n\n buffer[msg.sct.length] = 0;\n\n if (client->GotXCutText)\n client->GotXCutText(client, buffer, msg.sct.length);\n\n free(buffer);\n\n break;\n }\n\n case rfbTextChat:\n {\n char *buffer=NULL;\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbTextChatMsg- 1))\n return FALSE;\n msg.tc.length = rfbClientSwap32IfLE(msg.sct.length);\n switch(msg.tc.length) {\n case rfbTextChatOpen:\n rfbClientLog(\"Received TextChat Open\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatOpen, NULL);\n break;\n case rfbTextChatClose:\n rfbClientLog(\"Received TextChat Close\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatClose, NULL);\n break;\n case rfbTextChatFinished:\n rfbClientLog(\"Received TextChat Finished\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatFinished, NULL);\n break;\n default:\n buffer=malloc(msg.tc.length+1);\n if (!ReadFromRFBServer(client, buffer, msg.tc.length))\n {\n free(buffer);\n return FALSE;\n }\n /* Null Terminate */\n buffer[msg.tc.length]=0;\n rfbClientLog(\"Received TextChat \\\"%s\\\"\\n\", buffer);\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)msg.tc.length, buffer);\n free(buffer);\n break;\n }\n break;\n }\n\n case rfbXvp:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbXvpMsg -1))\n return FALSE;\n\n SetClient2Server(client, rfbXvp);\n /* technically, we only care what we can *send* to the server\n * but, we set Server2Client Just in case it ever becomes useful\n */\n SetServer2Client(client, rfbXvp);\n\n if(client->HandleXvpMsg)\n client->HandleXvpMsg(client, msg.xvp.version, msg.xvp.code);\n\n break;\n }\n\n case rfbResizeFrameBuffer:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbResizeFrameBufferMsg -1))\n return FALSE;\n client->width = rfbClientSwap16IfLE(msg.rsfb.framebufferWidth);\n client->height = rfbClientSwap16IfLE(msg.rsfb.framebufferHeigth);\n client->updateRect.x = client->updateRect.y = 0;\n client->updateRect.w = client->width;\n client->updateRect.h = client->height;\n if (!client->MallocFrameBuffer(client))\n return FALSE;\n\n SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE);\n rfbClientLog(\"Got new framebuffer size: %dx%d\\n\", client->width, client->height);\n break;\n }\n\n case rfbPalmVNCReSizeFrameBuffer:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbPalmVNCReSizeFrameBufferMsg -1))\n return FALSE;\n client->width = rfbClientSwap16IfLE(msg.prsfb.buffer_w);\n client->height = rfbClientSwap16IfLE(msg.prsfb.buffer_h);\n client->updateRect.x = client->updateRect.y = 0;\n client->updateRect.w = client->width;\n client->updateRect.h = client->height;\n if (!client->MallocFrameBuffer(client))\n return FALSE;\n SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE);\n rfbClientLog(\"Got new framebuffer size: %dx%d\\n\", client->width, client->height);\n break;\n }\n\n default:\n {\n rfbBool handled = FALSE;\n rfbClientProtocolExtension* e;\n\n for(e = rfbClientExtensions; !handled && e; e = e->next)\n\tif(e->handleMessage && e->handleMessage(client, &msg))\n\t handled = TRUE;\n\n if(!handled) {\n\tchar buffer[256];\n\trfbClientLog(\"Unknown message type %d from VNC server\\n\",msg.type);\n\tReadFromRFBServer(client, buffer, 256);\n\treturn FALSE;\n }\n }\n }\n\n return TRUE;\n}","lang":"c","vul_type":"cwe-787","target_token_count":5542,"sven_meta":{"func_name":"HandleRFBServerMessage","file_name":"libvncclient/rfbproto.c","commit_link":"github.com/LibVNC/libvncserver/commit/a64c3b37af9a6c8f8009d7516874b8d266b42bae","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#26-1432e8be7f87","input":"bool FromkLinuxSockAddr(const struct klinux_sockaddr *input,\n socklen_t input_len, struct sockaddr *output,\n socklen_t *output_len,\n void (*abort_handler)(const char *)) {\n if (!input || !output || !output_len || input_len == 0) {\n output = nullptr;\n return false;\n }\n\n int16_t klinux_family = input->klinux_sa_family;\n if (klinux_family == kLinux_AF_UNIX) {\n struct klinux_sockaddr_un *klinux_sockaddr_un_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_un sockaddr_un_out;\n sockaddr_un_out.sun_family = AF_UNIX;\n InitializeToZeroArray(sockaddr_un_out.sun_path);\n ReinterpretCopyArray(\n sockaddr_un_out.sun_path, klinux_sockaddr_un_in->klinux_sun_path,\n std::min(sizeof(sockaddr_un_out.sun_path),\n sizeof(klinux_sockaddr_un_in->klinux_sun_path)));\n CopySockaddr(&sockaddr_un_out, sizeof(sockaddr_un_out), output, output_len);\n } else if (klinux_family == kLinux_AF_INET) {\n struct klinux_sockaddr_in *klinux_sockaddr_in_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_in sockaddr_in_out;\n sockaddr_in_out.sin_family = AF_INET;\n sockaddr_in_out.sin_port = klinux_sockaddr_in_in->klinux_sin_port;\n InitializeToZeroSingle(&sockaddr_in_out.sin_addr);\n ReinterpretCopySingle(&sockaddr_in_out.sin_addr,\n &klinux_sockaddr_in_in->klinux_sin_addr);\n InitializeToZeroArray(sockaddr_in_out.sin_zero);\n ReinterpretCopyArray(sockaddr_in_out.sin_zero,\n klinux_sockaddr_in_in->klinux_sin_zero);\n CopySockaddr(&sockaddr_in_out, sizeof(sockaddr_in_out), output, output_len);\n } else if (klinux_family == kLinux_AF_INET6) {\n struct klinux_sockaddr_in6 *klinux_sockaddr_in6_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_in6 sockaddr_in6_out;\n sockaddr_in6_out.sin6_family = AF_INET6;\n sockaddr_in6_out.sin6_port = klinux_sockaddr_in6_in->klinux_sin6_port;\n sockaddr_in6_out.sin6_flowinfo =\n klinux_sockaddr_in6_in->klinux_sin6_flowinfo;\n sockaddr_in6_out.sin6_scope_id =\n klinux_sockaddr_in6_in->klinux_sin6_scope_id;\n InitializeToZeroSingle(&sockaddr_in6_out.sin6_addr);\n ReinterpretCopySingle(&sockaddr_in6_out.sin6_addr,\n &klinux_sockaddr_in6_in->klinux_sin6_addr);\n CopySockaddr(&sockaddr_in6_out, sizeof(sockaddr_in6_out), output,\n output_len);\n } else if (klinux_family == kLinux_AF_UNSPEC) {\n output = nullptr;\n *output_len = 0;\n } else {\n if (abort_handler != nullptr) {\n std::string message = absl::StrCat(\n \"Type conversion error - Unsupported AF family: \", klinux_family);\n abort_handler(message.c_str());\n } else {\n abort();\n }\n }\n return true;\n}","target":"bool FromkLinuxSockAddr(const struct klinux_sockaddr *input,\n socklen_t input_len, struct sockaddr *output,\n socklen_t *output_len,\n void (*abort_handler)(const char *)) {\n if (!input || !output || !output_len || input_len == 0) {\n output = nullptr;\n return false;\n }\n\n int16_t klinux_family = input->klinux_sa_family;\n if (klinux_family == kLinux_AF_UNIX) {\n if (input_len < sizeof(struct klinux_sockaddr_un)) {\n return false;\n }\n\n struct klinux_sockaddr_un *klinux_sockaddr_un_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_un sockaddr_un_out;\n sockaddr_un_out.sun_family = AF_UNIX;\n InitializeToZeroArray(sockaddr_un_out.sun_path);\n ReinterpretCopyArray(\n sockaddr_un_out.sun_path, klinux_sockaddr_un_in->klinux_sun_path,\n std::min(sizeof(sockaddr_un_out.sun_path),\n sizeof(klinux_sockaddr_un_in->klinux_sun_path)));\n CopySockaddr(&sockaddr_un_out, sizeof(sockaddr_un_out), output, output_len);\n } else if (klinux_family == kLinux_AF_INET) {\n if (input_len < sizeof(struct klinux_sockaddr_in)) {\n return false;\n }\n struct klinux_sockaddr_in *klinux_sockaddr_in_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_in sockaddr_in_out;\n sockaddr_in_out.sin_family = AF_INET;\n sockaddr_in_out.sin_port = klinux_sockaddr_in_in->klinux_sin_port;\n InitializeToZeroSingle(&sockaddr_in_out.sin_addr);\n ReinterpretCopySingle(&sockaddr_in_out.sin_addr,\n &klinux_sockaddr_in_in->klinux_sin_addr);\n InitializeToZeroArray(sockaddr_in_out.sin_zero);\n ReinterpretCopyArray(sockaddr_in_out.sin_zero,\n klinux_sockaddr_in_in->klinux_sin_zero);\n CopySockaddr(&sockaddr_in_out, sizeof(sockaddr_in_out), output, output_len);\n } else if (klinux_family == kLinux_AF_INET6) {\n if (input_len < sizeof(struct klinux_sockaddr_in6)) {\n return false;\n }\n\n struct klinux_sockaddr_in6 *klinux_sockaddr_in6_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_in6 sockaddr_in6_out;\n sockaddr_in6_out.sin6_family = AF_INET6;\n sockaddr_in6_out.sin6_port = klinux_sockaddr_in6_in->klinux_sin6_port;\n sockaddr_in6_out.sin6_flowinfo =\n klinux_sockaddr_in6_in->klinux_sin6_flowinfo;\n sockaddr_in6_out.sin6_scope_id =\n klinux_sockaddr_in6_in->klinux_sin6_scope_id;\n InitializeToZeroSingle(&sockaddr_in6_out.sin6_addr);\n ReinterpretCopySingle(&sockaddr_in6_out.sin6_addr,\n &klinux_sockaddr_in6_in->klinux_sin6_addr);\n CopySockaddr(&sockaddr_in6_out, sizeof(sockaddr_in6_out), output,\n output_len);\n } else if (klinux_family == kLinux_AF_UNSPEC) {\n output = nullptr;\n *output_len = 0;\n } else {\n if (abort_handler != nullptr) {\n std::string message = absl::StrCat(\n \"Type conversion error - Unsupported AF family: \", klinux_family);\n abort_handler(message.c_str());\n } else {\n abort();\n }\n }\n return true;\n}","lang":"cpp","vul_type":"cwe-787","target_token_count":819,"sven_meta":{"func_name":"FromkLinuxSockAddr","file_name":"asylo/platform/system_call/type_conversions/manual_types_functions.cc","commit_link":"github.com/google/asylo/commit/bda9772e7872b0d2b9bee32930cf7a4983837b39","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#27-23fb5e8487de","input":"opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,\n\t\t\t\t\t\t\t\t\t\topj_cp_t *p_cp,\n\t\t\t\t\t\t\t\t\t\tOPJ_UINT32 p_tile_no)\n{\n\t/* loop */\n\tOPJ_UINT32 pino;\n\tOPJ_UINT32 compno, resno;\n\n\t/* to store w, h, dx and dy fro all components and resolutions */\n\tOPJ_UINT32 * l_tmp_data;\n\tOPJ_UINT32 ** l_tmp_ptr;\n\n\t/* encoding prameters to set */\n\tOPJ_UINT32 l_max_res;\n\tOPJ_UINT32 l_max_prec;\n\tOPJ_INT32 l_tx0,l_tx1,l_ty0,l_ty1;\n\tOPJ_UINT32 l_dx_min,l_dy_min;\n\tOPJ_UINT32 l_bound;\n\tOPJ_UINT32 l_step_p , l_step_c , l_step_r , l_step_l ;\n\tOPJ_UINT32 l_data_stride;\n\n\t/* pointers */\n\topj_pi_iterator_t *l_pi = 00;\n\topj_tcp_t *l_tcp = 00;\n\tconst opj_tccp_t *l_tccp = 00;\n\topj_pi_comp_t *l_current_comp = 00;\n\topj_image_comp_t * l_img_comp = 00;\n\topj_pi_iterator_t * l_current_pi = 00;\n\tOPJ_UINT32 * l_encoding_value_ptr = 00;\n\n\t/* preconditions in debug */\n\tassert(p_cp != 00);\n\tassert(p_image != 00);\n\tassert(p_tile_no < p_cp->tw * p_cp->th);\n\n\t/* initializations */\n\tl_tcp = &p_cp->tcps[p_tile_no];\n\tl_bound = l_tcp->numpocs+1;\n\n\tl_data_stride = 4 * OPJ_J2K_MAXRLVLS;\n\tl_tmp_data = (OPJ_UINT32*)opj_malloc(\n\t\tl_data_stride * p_image->numcomps * sizeof(OPJ_UINT32));\n\tif\n\t\t(! l_tmp_data)\n\t{\n\t\treturn 00;\n\t}\n\tl_tmp_ptr = (OPJ_UINT32**)opj_malloc(\n\t\tp_image->numcomps * sizeof(OPJ_UINT32 *));\n\tif\n\t\t(! l_tmp_ptr)\n\t{\n\t\topj_free(l_tmp_data);\n\t\treturn 00;\n\t}\n\n\t/* memory allocation for pi */\n\tl_pi = opj_pi_create(p_image, p_cp, p_tile_no);\n\tif (!l_pi) {\n\t\topj_free(l_tmp_data);\n\t\topj_free(l_tmp_ptr);\n\t\treturn 00;\n\t}\n\n\tl_encoding_value_ptr = l_tmp_data;\n\t/* update pointer array */\n\tfor\n\t\t(compno = 0; compno < p_image->numcomps; ++compno)\n\t{\n\t\tl_tmp_ptr[compno] = l_encoding_value_ptr;\n\t\tl_encoding_value_ptr += l_data_stride;\n\t}\n\t/* get encoding parameters */\n\topj_get_all_encoding_parameters(p_image,p_cp,p_tile_no,&l_tx0,&l_tx1,&l_ty0,&l_ty1,&l_dx_min,&l_dy_min,&l_max_prec,&l_max_res,l_tmp_ptr);\n\n\t/* step calculations */\n\tl_step_p = 1;\n\tl_step_c = l_max_prec * l_step_p;\n\tl_step_r = p_image->numcomps * l_step_c;\n\tl_step_l = l_max_res * l_step_r;\n\n\t/* set values for first packet iterator */\n\tl_current_pi = l_pi;\n\n\t/* memory allocation for include */\n\tl_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));\n\tif\n\t\t(!l_current_pi->include)\n\t{\n\t\topj_free(l_tmp_data);\n\t\topj_free(l_tmp_ptr);\n\t\topj_pi_destroy(l_pi, l_bound);\n\t\treturn 00;\n\t}\n\n\t/* special treatment for the first packet iterator */\n\tl_current_comp = l_current_pi->comps;\n\tl_img_comp = p_image->comps;\n\tl_tccp = l_tcp->tccps;\n\n\tl_current_pi->tx0 = l_tx0;\n\tl_current_pi->ty0 = l_ty0;\n\tl_current_pi->tx1 = l_tx1;\n\tl_current_pi->ty1 = l_ty1;\n\n\t/*l_current_pi->dx = l_img_comp->dx;*/\n\t/*l_current_pi->dy = l_img_comp->dy;*/\n\n\tl_current_pi->step_p = l_step_p;\n\tl_current_pi->step_c = l_step_c;\n\tl_current_pi->step_r = l_step_r;\n\tl_current_pi->step_l = l_step_l;\n\n\t/* allocation for components and number of components has already been calculated by opj_pi_create */\n\tfor\n\t\t(compno = 0; compno < l_current_pi->numcomps; ++compno)\n\t{\n\t\topj_pi_resolution_t *l_res = l_current_comp->resolutions;\n\t\tl_encoding_value_ptr = l_tmp_ptr[compno];\n\n\t\tl_current_comp->dx = l_img_comp->dx;\n\t\tl_current_comp->dy = l_img_comp->dy;\n\t\t/* resolutions have already been initialized */\n\t\tfor\n\t\t\t(resno = 0; resno < l_current_comp->numresolutions; resno++)\n\t\t{\n\t\t\tl_res->pdx = *(l_encoding_value_ptr++);\n\t\t\tl_res->pdy = *(l_encoding_value_ptr++);\n\t\t\tl_res->pw = *(l_encoding_value_ptr++);\n\t\t\tl_res->ph = *(l_encoding_value_ptr++);\n\t\t\t++l_res;\n\t\t}\n\t\t++l_current_comp;\n\t\t++l_img_comp;\n\t\t++l_tccp;\n\t}\n\t++l_current_pi;\n\n\tfor (pino = 1 ; pinocomps;\n\t\tl_img_comp = p_image->comps;\n\t\tl_tccp = l_tcp->tccps;\n\n\t\tl_current_pi->tx0 = l_tx0;\n\t\tl_current_pi->ty0 = l_ty0;\n\t\tl_current_pi->tx1 = l_tx1;\n\t\tl_current_pi->ty1 = l_ty1;\n\t\t/*l_current_pi->dx = l_dx_min;*/\n\t\t/*l_current_pi->dy = l_dy_min;*/\n\t\tl_current_pi->step_p = l_step_p;\n\t\tl_current_pi->step_c = l_step_c;\n\t\tl_current_pi->step_r = l_step_r;\n\t\tl_current_pi->step_l = l_step_l;\n\n\t\t/* allocation for components and number of components has already been calculated by opj_pi_create */\n\t\tfor\n\t\t\t(compno = 0; compno < l_current_pi->numcomps; ++compno)\n\t\t{\n\t\t\topj_pi_resolution_t *l_res = l_current_comp->resolutions;\n\t\t\tl_encoding_value_ptr = l_tmp_ptr[compno];\n\n\t\t\tl_current_comp->dx = l_img_comp->dx;\n\t\t\tl_current_comp->dy = l_img_comp->dy;\n\t\t\t/* resolutions have already been initialized */\n\t\t\tfor\n\t\t\t\t(resno = 0; resno < l_current_comp->numresolutions; resno++)\n\t\t\t{\n\t\t\t\tl_res->pdx = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->pdy = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->pw = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->ph = *(l_encoding_value_ptr++);\n\t\t\t\t++l_res;\n\t\t\t}\n\t\t\t++l_current_comp;\n\t\t\t++l_img_comp;\n\t\t\t++l_tccp;\n\t\t}\n\t\t/* special treatment*/\n\t\tl_current_pi->include = (l_current_pi-1)->include;\n\t\t++l_current_pi;\n\t}\n\topj_free(l_tmp_data);\n\tl_tmp_data = 00;\n\topj_free(l_tmp_ptr);\n\tl_tmp_ptr = 00;\n\tif\n\t\t(l_tcp->POC)\n\t{\n\t\topj_pi_update_decode_poc (l_pi,l_tcp,l_max_prec,l_max_res);\n\t}\n\telse\n\t{\n\t\topj_pi_update_decode_not_poc(l_pi,l_tcp,l_max_prec,l_max_res);\n\t}\n\treturn l_pi;\n}","target":"opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,\n\t\t\t\t\t\t\t\t\t\topj_cp_t *p_cp,\n\t\t\t\t\t\t\t\t\t\tOPJ_UINT32 p_tile_no)\n{\n\t/* loop */\n\tOPJ_UINT32 pino;\n\tOPJ_UINT32 compno, resno;\n\n\t/* to store w, h, dx and dy fro all components and resolutions */\n\tOPJ_UINT32 * l_tmp_data;\n\tOPJ_UINT32 ** l_tmp_ptr;\n\n\t/* encoding prameters to set */\n\tOPJ_UINT32 l_max_res;\n\tOPJ_UINT32 l_max_prec;\n\tOPJ_INT32 l_tx0,l_tx1,l_ty0,l_ty1;\n\tOPJ_UINT32 l_dx_min,l_dy_min;\n\tOPJ_UINT32 l_bound;\n\tOPJ_UINT32 l_step_p , l_step_c , l_step_r , l_step_l ;\n\tOPJ_UINT32 l_data_stride;\n\n\t/* pointers */\n\topj_pi_iterator_t *l_pi = 00;\n\topj_tcp_t *l_tcp = 00;\n\tconst opj_tccp_t *l_tccp = 00;\n\topj_pi_comp_t *l_current_comp = 00;\n\topj_image_comp_t * l_img_comp = 00;\n\topj_pi_iterator_t * l_current_pi = 00;\n\tOPJ_UINT32 * l_encoding_value_ptr = 00;\n\n\t/* preconditions in debug */\n\tassert(p_cp != 00);\n\tassert(p_image != 00);\n\tassert(p_tile_no < p_cp->tw * p_cp->th);\n\n\t/* initializations */\n\tl_tcp = &p_cp->tcps[p_tile_no];\n\tl_bound = l_tcp->numpocs+1;\n\n\tl_data_stride = 4 * OPJ_J2K_MAXRLVLS;\n\tl_tmp_data = (OPJ_UINT32*)opj_malloc(\n\t\tl_data_stride * p_image->numcomps * sizeof(OPJ_UINT32));\n\tif\n\t\t(! l_tmp_data)\n\t{\n\t\treturn 00;\n\t}\n\tl_tmp_ptr = (OPJ_UINT32**)opj_malloc(\n\t\tp_image->numcomps * sizeof(OPJ_UINT32 *));\n\tif\n\t\t(! l_tmp_ptr)\n\t{\n\t\topj_free(l_tmp_data);\n\t\treturn 00;\n\t}\n\n\t/* memory allocation for pi */\n\tl_pi = opj_pi_create(p_image, p_cp, p_tile_no);\n\tif (!l_pi) {\n\t\topj_free(l_tmp_data);\n\t\topj_free(l_tmp_ptr);\n\t\treturn 00;\n\t}\n\n\tl_encoding_value_ptr = l_tmp_data;\n\t/* update pointer array */\n\tfor\n\t\t(compno = 0; compno < p_image->numcomps; ++compno)\n\t{\n\t\tl_tmp_ptr[compno] = l_encoding_value_ptr;\n\t\tl_encoding_value_ptr += l_data_stride;\n\t}\n\t/* get encoding parameters */\n\topj_get_all_encoding_parameters(p_image,p_cp,p_tile_no,&l_tx0,&l_tx1,&l_ty0,&l_ty1,&l_dx_min,&l_dy_min,&l_max_prec,&l_max_res,l_tmp_ptr);\n\n\t/* step calculations */\n\tl_step_p = 1;\n\tl_step_c = l_max_prec * l_step_p;\n\tl_step_r = p_image->numcomps * l_step_c;\n\tl_step_l = l_max_res * l_step_r;\n\n\t/* set values for first packet iterator */\n\tl_current_pi = l_pi;\n\n\t/* memory allocation for include */\n\t/* prevent an integer overflow issue */\n\tl_current_pi->include = 00;\n\tif (l_step_l <= (SIZE_MAX / (l_tcp->numlayers + 1U)))\n\t{\n\t\tl_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));\n\t}\n\n\tif\n\t\t(!l_current_pi->include)\n\t{\n\t\topj_free(l_tmp_data);\n\t\topj_free(l_tmp_ptr);\n\t\topj_pi_destroy(l_pi, l_bound);\n\t\treturn 00;\n\t}\n\n\t/* special treatment for the first packet iterator */\n\tl_current_comp = l_current_pi->comps;\n\tl_img_comp = p_image->comps;\n\tl_tccp = l_tcp->tccps;\n\n\tl_current_pi->tx0 = l_tx0;\n\tl_current_pi->ty0 = l_ty0;\n\tl_current_pi->tx1 = l_tx1;\n\tl_current_pi->ty1 = l_ty1;\n\n\t/*l_current_pi->dx = l_img_comp->dx;*/\n\t/*l_current_pi->dy = l_img_comp->dy;*/\n\n\tl_current_pi->step_p = l_step_p;\n\tl_current_pi->step_c = l_step_c;\n\tl_current_pi->step_r = l_step_r;\n\tl_current_pi->step_l = l_step_l;\n\n\t/* allocation for components and number of components has already been calculated by opj_pi_create */\n\tfor\n\t\t(compno = 0; compno < l_current_pi->numcomps; ++compno)\n\t{\n\t\topj_pi_resolution_t *l_res = l_current_comp->resolutions;\n\t\tl_encoding_value_ptr = l_tmp_ptr[compno];\n\n\t\tl_current_comp->dx = l_img_comp->dx;\n\t\tl_current_comp->dy = l_img_comp->dy;\n\t\t/* resolutions have already been initialized */\n\t\tfor\n\t\t\t(resno = 0; resno < l_current_comp->numresolutions; resno++)\n\t\t{\n\t\t\tl_res->pdx = *(l_encoding_value_ptr++);\n\t\t\tl_res->pdy = *(l_encoding_value_ptr++);\n\t\t\tl_res->pw = *(l_encoding_value_ptr++);\n\t\t\tl_res->ph = *(l_encoding_value_ptr++);\n\t\t\t++l_res;\n\t\t}\n\t\t++l_current_comp;\n\t\t++l_img_comp;\n\t\t++l_tccp;\n\t}\n\t++l_current_pi;\n\n\tfor (pino = 1 ; pinocomps;\n\t\tl_img_comp = p_image->comps;\n\t\tl_tccp = l_tcp->tccps;\n\n\t\tl_current_pi->tx0 = l_tx0;\n\t\tl_current_pi->ty0 = l_ty0;\n\t\tl_current_pi->tx1 = l_tx1;\n\t\tl_current_pi->ty1 = l_ty1;\n\t\t/*l_current_pi->dx = l_dx_min;*/\n\t\t/*l_current_pi->dy = l_dy_min;*/\n\t\tl_current_pi->step_p = l_step_p;\n\t\tl_current_pi->step_c = l_step_c;\n\t\tl_current_pi->step_r = l_step_r;\n\t\tl_current_pi->step_l = l_step_l;\n\n\t\t/* allocation for components and number of components has already been calculated by opj_pi_create */\n\t\tfor\n\t\t\t(compno = 0; compno < l_current_pi->numcomps; ++compno)\n\t\t{\n\t\t\topj_pi_resolution_t *l_res = l_current_comp->resolutions;\n\t\t\tl_encoding_value_ptr = l_tmp_ptr[compno];\n\n\t\t\tl_current_comp->dx = l_img_comp->dx;\n\t\t\tl_current_comp->dy = l_img_comp->dy;\n\t\t\t/* resolutions have already been initialized */\n\t\t\tfor\n\t\t\t\t(resno = 0; resno < l_current_comp->numresolutions; resno++)\n\t\t\t{\n\t\t\t\tl_res->pdx = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->pdy = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->pw = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->ph = *(l_encoding_value_ptr++);\n\t\t\t\t++l_res;\n\t\t\t}\n\t\t\t++l_current_comp;\n\t\t\t++l_img_comp;\n\t\t\t++l_tccp;\n\t\t}\n\t\t/* special treatment*/\n\t\tl_current_pi->include = (l_current_pi-1)->include;\n\t\t++l_current_pi;\n\t}\n\topj_free(l_tmp_data);\n\tl_tmp_data = 00;\n\topj_free(l_tmp_ptr);\n\tl_tmp_ptr = 00;\n\tif\n\t\t(l_tcp->POC)\n\t{\n\t\topj_pi_update_decode_poc (l_pi,l_tcp,l_max_prec,l_max_res);\n\t}\n\telse\n\t{\n\t\topj_pi_update_decode_not_poc(l_pi,l_tcp,l_max_prec,l_max_res);\n\t}\n\treturn l_pi;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1806,"sven_meta":{"func_name":"opj_pi_create_decode","file_name":"src/lib/openjp2/pi.c","commit_link":"github.com/uclouvain/openjpeg/commit/c16bc057ba3f125051c9966cf1f5b68a05681de4","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#28-125310adc074","input":"static void opj_j2k_set_cinema_parameters(opj_cparameters_t *parameters,\n opj_image_t *image, opj_event_mgr_t *p_manager)\n{\n /* Configure cinema parameters */\n int i;\n\n /* No tiling */\n parameters->tile_size_on = OPJ_FALSE;\n parameters->cp_tdx = 1;\n parameters->cp_tdy = 1;\n\n /* One tile part for each component */\n parameters->tp_flag = 'C';\n parameters->tp_on = 1;\n\n /* Tile and Image shall be at (0,0) */\n parameters->cp_tx0 = 0;\n parameters->cp_ty0 = 0;\n parameters->image_offset_x0 = 0;\n parameters->image_offset_y0 = 0;\n\n /* Codeblock size= 32*32 */\n parameters->cblockw_init = 32;\n parameters->cblockh_init = 32;\n\n /* Codeblock style: no mode switch enabled */\n parameters->mode = 0;\n\n /* No ROI */\n parameters->roi_compno = -1;\n\n /* No subsampling */\n parameters->subsampling_dx = 1;\n parameters->subsampling_dy = 1;\n\n /* 9-7 transform */\n parameters->irreversible = 1;\n\n /* Number of layers */\n if (parameters->tcp_numlayers > 1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"1 single quality layer\"\n \"-> Number of layers forced to 1 (rather than %d)\\n\"\n \"-> Rate of the last layer (%3.1f) will be used\",\n parameters->tcp_numlayers,\n parameters->tcp_rates[parameters->tcp_numlayers - 1]);\n parameters->tcp_rates[0] = parameters->tcp_rates[parameters->tcp_numlayers - 1];\n parameters->tcp_numlayers = 1;\n }\n\n /* Resolution levels */\n switch (parameters->rsiz) {\n case OPJ_PROFILE_CINEMA_2K:\n if (parameters->numresolution > 6) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 (2k dc profile) requires:\\n\"\n \"Number of decomposition levels <= 5\\n\"\n \"-> Number of decomposition levels forced to 5 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 6;\n }\n break;\n case OPJ_PROFILE_CINEMA_4K:\n if (parameters->numresolution < 2) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"Number of decomposition levels >= 1 && <= 6\\n\"\n \"-> Number of decomposition levels forced to 1 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 1;\n } else if (parameters->numresolution > 7) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"Number of decomposition levels >= 1 && <= 6\\n\"\n \"-> Number of decomposition levels forced to 6 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 7;\n }\n break;\n default :\n break;\n }\n\n /* Precincts */\n parameters->csty |= 0x01;\n parameters->res_spec = parameters->numresolution - 1;\n for (i = 0; i < parameters->res_spec; i++) {\n parameters->prcw_init[i] = 256;\n parameters->prch_init[i] = 256;\n }\n\n /* The progression order shall be CPRL */\n parameters->prog_order = OPJ_CPRL;\n\n /* Progression order changes for 4K, disallowed for 2K */\n if (parameters->rsiz == OPJ_PROFILE_CINEMA_4K) {\n parameters->numpocs = (OPJ_UINT32)opj_j2k_initialise_4K_poc(parameters->POC,\n parameters->numresolution);\n } else {\n parameters->numpocs = 0;\n }\n\n /* Limited bit-rate */\n parameters->cp_disto_alloc = 1;\n if (parameters->max_cs_size <= 0) {\n /* No rate has been introduced, 24 fps is assumed */\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1302083 compressed bytes @ 24fps\\n\"\n \"As no rate has been given, this limit will be used.\\n\");\n } else if (parameters->max_cs_size > OPJ_CINEMA_24_CS) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1302083 compressed bytes @ 24fps\\n\"\n \"-> Specified rate exceeds this limit. Rate will be forced to 1302083 bytes.\\n\");\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n }\n\n if (parameters->max_comp_size <= 0) {\n /* No rate has been introduced, 24 fps is assumed */\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1041666 compressed bytes @ 24fps\\n\"\n \"As no rate has been given, this limit will be used.\\n\");\n } else if (parameters->max_comp_size > OPJ_CINEMA_24_COMP) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1041666 compressed bytes @ 24fps\\n\"\n \"-> Specified rate exceeds this limit. Rate will be forced to 1041666 bytes.\\n\");\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n }\n\n parameters->tcp_rates[0] = (OPJ_FLOAT32)(image->numcomps * image->comps[0].w *\n image->comps[0].h * image->comps[0].prec) /\n (OPJ_FLOAT32)(((OPJ_UINT32)parameters->max_cs_size) * 8 * image->comps[0].dx *\n image->comps[0].dy);\n\n}","target":"static void opj_j2k_set_cinema_parameters(opj_cparameters_t *parameters,\n opj_image_t *image, opj_event_mgr_t *p_manager)\n{\n /* Configure cinema parameters */\n int i;\n\n /* No tiling */\n parameters->tile_size_on = OPJ_FALSE;\n parameters->cp_tdx = 1;\n parameters->cp_tdy = 1;\n\n /* One tile part for each component */\n parameters->tp_flag = 'C';\n parameters->tp_on = 1;\n\n /* Tile and Image shall be at (0,0) */\n parameters->cp_tx0 = 0;\n parameters->cp_ty0 = 0;\n parameters->image_offset_x0 = 0;\n parameters->image_offset_y0 = 0;\n\n /* Codeblock size= 32*32 */\n parameters->cblockw_init = 32;\n parameters->cblockh_init = 32;\n\n /* Codeblock style: no mode switch enabled */\n parameters->mode = 0;\n\n /* No ROI */\n parameters->roi_compno = -1;\n\n /* No subsampling */\n parameters->subsampling_dx = 1;\n parameters->subsampling_dy = 1;\n\n /* 9-7 transform */\n parameters->irreversible = 1;\n\n /* Number of layers */\n if (parameters->tcp_numlayers > 1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"1 single quality layer\"\n \"-> Number of layers forced to 1 (rather than %d)\\n\"\n \"-> Rate of the last layer (%3.1f) will be used\",\n parameters->tcp_numlayers,\n parameters->tcp_rates[parameters->tcp_numlayers - 1]);\n parameters->tcp_rates[0] = parameters->tcp_rates[parameters->tcp_numlayers - 1];\n parameters->tcp_numlayers = 1;\n }\n\n /* Resolution levels */\n switch (parameters->rsiz) {\n case OPJ_PROFILE_CINEMA_2K:\n if (parameters->numresolution > 6) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 (2k dc profile) requires:\\n\"\n \"Number of decomposition levels <= 5\\n\"\n \"-> Number of decomposition levels forced to 5 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 6;\n }\n break;\n case OPJ_PROFILE_CINEMA_4K:\n if (parameters->numresolution < 2) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"Number of decomposition levels >= 1 && <= 6\\n\"\n \"-> Number of decomposition levels forced to 1 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 1;\n } else if (parameters->numresolution > 7) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"Number of decomposition levels >= 1 && <= 6\\n\"\n \"-> Number of decomposition levels forced to 6 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 7;\n }\n break;\n default :\n break;\n }\n\n /* Precincts */\n parameters->csty |= 0x01;\n if (parameters->numresolution == 1) {\n parameters->res_spec = 1;\n parameters->prcw_init[0] = 128;\n parameters->prch_init[0] = 128;\n } else {\n parameters->res_spec = parameters->numresolution - 1;\n for (i = 0; i < parameters->res_spec; i++) {\n parameters->prcw_init[i] = 256;\n parameters->prch_init[i] = 256;\n }\n }\n\n /* The progression order shall be CPRL */\n parameters->prog_order = OPJ_CPRL;\n\n /* Progression order changes for 4K, disallowed for 2K */\n if (parameters->rsiz == OPJ_PROFILE_CINEMA_4K) {\n parameters->numpocs = (OPJ_UINT32)opj_j2k_initialise_4K_poc(parameters->POC,\n parameters->numresolution);\n } else {\n parameters->numpocs = 0;\n }\n\n /* Limited bit-rate */\n parameters->cp_disto_alloc = 1;\n if (parameters->max_cs_size <= 0) {\n /* No rate has been introduced, 24 fps is assumed */\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1302083 compressed bytes @ 24fps\\n\"\n \"As no rate has been given, this limit will be used.\\n\");\n } else if (parameters->max_cs_size > OPJ_CINEMA_24_CS) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1302083 compressed bytes @ 24fps\\n\"\n \"-> Specified rate exceeds this limit. Rate will be forced to 1302083 bytes.\\n\");\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n }\n\n if (parameters->max_comp_size <= 0) {\n /* No rate has been introduced, 24 fps is assumed */\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1041666 compressed bytes @ 24fps\\n\"\n \"As no rate has been given, this limit will be used.\\n\");\n } else if (parameters->max_comp_size > OPJ_CINEMA_24_COMP) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1041666 compressed bytes @ 24fps\\n\"\n \"-> Specified rate exceeds this limit. Rate will be forced to 1041666 bytes.\\n\");\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n }\n\n parameters->tcp_rates[0] = (OPJ_FLOAT32)(image->numcomps * image->comps[0].w *\n image->comps[0].h * image->comps[0].prec) /\n (OPJ_FLOAT32)(((OPJ_UINT32)parameters->max_cs_size) * 8 * image->comps[0].dx *\n image->comps[0].dy);\n\n}","lang":"c","vul_type":"cwe-787","target_token_count":1626,"sven_meta":{"func_name":"opj_j2k_set_cinema_parameters","file_name":"src/lib/openjp2/j2k.c","commit_link":"github.com/uclouvain/openjpeg/commit/4241ae6fbbf1de9658764a80944dc8108f2b4154","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#29-88e64b87e45e","input":"void * adminchild(struct clientparam* param) {\n int i, res;\n char * buf;\n char username[256];\n char *sb;\n char *req = NULL;\n struct printparam pp;\n int contentlen = 0;\n int isform = 0;\n\n pp.inbuf = 0;\n pp.cp = param;\n\n buf = myalloc(LINESIZE);\n if(!buf) {RETURN(555);}\n i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '\\n', conf.timeouts[STRING_S]);\n if(i<5 || ((buf[0]!='G' || buf[1]!='E' || buf[2]!='T' || buf[3]!=' ' || buf[4]!='/') && \n\t (buf[0]!='P' || buf[1]!='O' || buf[2]!='S' || buf[3]!='T' || buf[4]!=' ' || buf[5]!='/')))\n {\n\tRETURN(701);\n }\n buf[i] = 0;\n sb = strchr(buf+5, ' ');\n if(!sb){\n\tRETURN(702);\n }\n *sb = 0;\n req = mystrdup(buf + ((*buf == 'P')? 6 : 5));\n while((i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '\\n', conf.timeouts[STRING_S])) > 2){\n\tbuf[i] = 0;\n\tif(i > 19 && (!strncasecmp(buf, \"authorization\", 13))){\n\t\tsb = strchr(buf, ':');\n\t\tif(!sb)continue;\n\t\t++sb;\n\t\twhile(isspace(*sb))sb++;\n\t\tif(!*sb || strncasecmp(sb, \"basic\", 5)){\n\t\t\tcontinue;\n\t\t}\n\t\tsb+=5;\n\t\twhile(isspace(*sb))sb++;\n\t\ti = de64((unsigned char *)sb, (unsigned char *)username, 255);\n\t\tif(i<=0)continue;\n\t\tusername[i] = 0;\n\t\tsb = strchr((char *)username, ':');\n\t\tif(sb){\n\t\t\t*sb = 0;\n\t\t\tif(param->password)myfree(param->password);\n\t\t\tparam->password = (unsigned char *)mystrdup(sb+1);\n\t\t}\n\t\tif(param->username) myfree(param->username);\n\t\tparam->username = (unsigned char *)mystrdup(username);\n\t\tcontinue;\n\t}\n\telse if(i > 15 && (!strncasecmp(buf, \"content-length:\", 15))){\n\t\tsb = buf + 15;\n\t\twhile(isspace(*sb))sb++;\n\t\tcontentlen = atoi(sb);\n\t}\n\telse if(i > 13 && (!strncasecmp(buf, \"content-type:\", 13))){\n\t\tsb = buf + 13;\n\t\twhile(isspace(*sb))sb++;\n\t\tif(!strncasecmp(sb, \"x-www-form-urlencoded\", 21)) isform = 1;\n\t}\n }\n param->operation = ADMIN;\n if(isform && contentlen) {\n\tprintstr(&pp, \"HTTP/1.0 100 Continue\\r\\n\\r\\n\");\n\tstdpr(&pp, NULL, 0);\n }\n res = (*param->srv->authfunc)(param);\n if(res && res != 10) {\n\tprintstr(&pp, authreq);\n\tRETURN(res);\n }\n if(param->srv->singlepacket || param->redirected){\n\tif(*req == 'C') req[1] = 0;\n\telse *req = 0;\n }\n sprintf(buf, ok, conf.stringtable?(char *)conf.stringtable[2]:\"3proxy\", conf.stringtable?(char *)conf.stringtable[2]:\"3[APA3A] tiny proxy\", conf.stringtable?(char *)conf.stringtable[3]:\"\");\n if(*req != 'S') printstr(&pp, buf);\n switch(*req){\n\tcase 'C':\n\t\tprintstr(&pp, counters);\n\t\t{\n\t\t\tstruct trafcount *cp; \n\t\t\tint num = 0;\n\t\t\tfor(cp = conf.trafcounter; cp; cp = cp->next, num++){\n\t\t\t int inbuf = 0;\n\n\t\t\t if(cp->ace && (param->srv->singlepacket || param->redirected)){\n\t\t\t\tif(!ACLmatches(cp->ace, param))continue;\n\t\t\t }\n\t\t\t if(req[1] == 'S' && atoi(req+2) == num) cp->disabled=0;\n\t\t\t if(req[1] == 'D' && atoi(req+2) == num) cp->disabled=1;\n\t\t\t inbuf += sprintf(buf,\t\"\"\n\t\t\t\t\t\t\"%s%s\",\n\t\t\t\t\t\t(cp->comment)?cp->comment:\" \",\n\t\t\t\t\t\t(cp->disabled)?'S':'D',\n\t\t\t\t\t\tnum,\n\t\t\t\t\t\t(cp->disabled)?\"NO\":\"YES\"\n\t\t\t\t\t);\n\t\t\t if(!cp->ace || !cp->ace->users){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printuserlist(buf+inbuf, LINESIZE-800, cp->ace->users, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->src){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printiplist(buf+inbuf, LINESIZE-512, cp->ace->src, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->dst){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printiplist(buf+inbuf, LINESIZE-512, cp->ace->dst, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->ports){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printportlist(buf+inbuf, LINESIZE-128, cp->ace->ports, \",
\\r\\n\");\n\t\t\t }\n\t\t\t if(cp->type == NONE) {\n\t\t\t inbuf += sprintf(buf+inbuf,\t\n\t\t\t\t\t\"exclude from limitation\\r\\n\"\n\t\t\t\t );\n\t\t\t }\n\t\t\t else {\n\t\t\t inbuf += sprintf(buf+inbuf,\t\n\t\t\t\t\t\"%\"PRINTF_INT64_MODIFIER\"u\"\n\t\t\t\t\t\"MB%s\"\n\t\t\t\t\t\"%\"PRINTF_INT64_MODIFIER\"u\"\n\t\t\t\t\t\"%s\",\n\t\t\t\t cp->traflim64 / (1024 * 1024),\n\t\t\t\t rotations[cp->type],\n\t\t\t\t cp->traf64,\n\t\t\t\t cp->cleared?ctime(&cp->cleared):\"never\"\n\t\t\t\t);\n\t\t\t inbuf += sprintf(buf + inbuf,\n\t\t\t\t\t\"%s\"\n\t\t\t\t\t\"%i\"\n\t\t\t\t\t\"\\r\\n\",\n\n\t\t\t\t cp->updated?ctime(&cp->updated):\"never\",\n\t\t\t\t cp->number\n\t\t\t\t);\n\t\t\t }\n\t\t\t printstr(&pp, buf);\n\t\t\t}\n\n\t\t}\n\t\tprintstr(&pp, counterstail);\n\t\tbreak;\n\t\t\n\tcase 'R':\n\t\tconf.needreload = 1;\n\t\tprintstr(&pp, \"

Reload scheduled

\");\n\t\tbreak;\n\tcase 'S':\n\t\t{\n\t\t\tif(req[1] == 'X'){\n\t\t\t\tprintstr(&pp, style);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tprintstr(&pp, xml);\n\t\t\tprintval(conf.services, TYPE_SERVER, 0, &pp);\n\t\t\tprintstr(&pp, postxml);\n\t\t}\n\t\t\tbreak;\n\tcase 'F':\n\t\t{\n\t\t\tFILE *fp;\n\t\t\tchar buf[256];\n\n\t\t\tfp = confopen();\n\t\t\tif(!fp){\n\t\t\t\tprintstr(&pp, \"

Failed to open config file

\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\tprintstr(&pp, \"

Please be careful editing config file remotely

\");\n\t\t\t\tprintstr(&pp, \"

\");\n\t\t\tbreak;\n\t\t}\n\tcase 'U':\n\t\t{\n\t\t\tint l=0;\n\t\t\tint error = 0;\n\n\t\t\tif(!writable || fseek(writable, 0, 0)){\n\t\t\t\terror = 1;\n\t\t\t}\n\t\t\twhile((i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '+', conf.timeouts[STRING_S])) > 0){\n\t\t\t\tif(i > (contentlen - l)) i = (contentlen - l);\n\t\t\t\tbuf[i] = 0;\n\t\t\t\tif(!l){\n\t\t\t\t\tif(strncasecmp(buf, \"conffile=\", 9)) error = 1;\n\t\t\t\t}\n\t\t\t\tif(!error){\n\t\t\t\t\tdecodeurl((unsigned char *)buf, 1);\n\t\t\t\t\tfprintf(writable, \"%s\", l? buf : buf + 9);\n\t\t\t\t}\n\t\t\t\tl += i;\n\t\t\t\tif(l >= contentlen) break;\n\t\t\t}\n\t\t\tif(writable && !error){\n\t\t\t\tfflush(writable);\n#ifndef _WINCE\n\t\t\t\tftruncate(fileno(writable), ftell(writable));\n#endif\n\t\t\t}\n\t\t\tprintstr(&pp, error? \"

Config file is not writable

Make sure you have \\\"writable\\\" command in configuration file\":\n\t\t\t\t\t\t\"

Configuration updated

\");\n\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tprintstr(&pp, (char *)conf.stringtable[WEBBANNERS]);\n\t\tbreak;\n }\n if(*req != 'S') printstr(&pp, tail);\n\nCLEANRET:\n\n\n printstr(&pp, NULL);\n if(buf) myfree(buf);\n (*param->srv->logfunc)(param, (unsigned char *)req);\n if(req)myfree(req);\n freeparam(param);\n return (NULL);\n}","target":"void * adminchild(struct clientparam* param) {\n int i, res;\n char * buf;\n char username[256];\n char *sb;\n char *req = NULL;\n struct printparam pp;\n unsigned contentlen = 0;\n int isform = 0;\n\n pp.inbuf = 0;\n pp.cp = param;\n\n buf = myalloc(LINESIZE);\n if(!buf) {RETURN(555);}\n i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '\\n', conf.timeouts[STRING_S]);\n if(i<5 || ((buf[0]!='G' || buf[1]!='E' || buf[2]!='T' || buf[3]!=' ' || buf[4]!='/') && \n\t (buf[0]!='P' || buf[1]!='O' || buf[2]!='S' || buf[3]!='T' || buf[4]!=' ' || buf[5]!='/')))\n {\n\tRETURN(701);\n }\n buf[i] = 0;\n sb = strchr(buf+5, ' ');\n if(!sb){\n\tRETURN(702);\n }\n *sb = 0;\n req = mystrdup(buf + ((*buf == 'P')? 6 : 5));\n while((i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '\\n', conf.timeouts[STRING_S])) > 2){\n\tbuf[i] = 0;\n\tif(i > 19 && (!strncasecmp(buf, \"authorization\", 13))){\n\t\tsb = strchr(buf, ':');\n\t\tif(!sb)continue;\n\t\t++sb;\n\t\twhile(isspace(*sb))sb++;\n\t\tif(!*sb || strncasecmp(sb, \"basic\", 5)){\n\t\t\tcontinue;\n\t\t}\n\t\tsb+=5;\n\t\twhile(isspace(*sb))sb++;\n\t\ti = de64((unsigned char *)sb, (unsigned char *)username, 255);\n\t\tif(i<=0)continue;\n\t\tusername[i] = 0;\n\t\tsb = strchr((char *)username, ':');\n\t\tif(sb){\n\t\t\t*sb = 0;\n\t\t\tif(param->password)myfree(param->password);\n\t\t\tparam->password = (unsigned char *)mystrdup(sb+1);\n\t\t}\n\t\tif(param->username) myfree(param->username);\n\t\tparam->username = (unsigned char *)mystrdup(username);\n\t\tcontinue;\n\t}\n\telse if(i > 15 && (!strncasecmp(buf, \"content-length:\", 15))){\n\t\tsb = buf + 15;\n\t\twhile(isspace(*sb))sb++;\n\t\tsscanf(sb, \"%u\", &contentlen);\n\t\tif(contentlen > LINESIZE*1024) contentlen = 0;\n\t}\n\telse if(i > 13 && (!strncasecmp(buf, \"content-type:\", 13))){\n\t\tsb = buf + 13;\n\t\twhile(isspace(*sb))sb++;\n\t\tif(!strncasecmp(sb, \"x-www-form-urlencoded\", 21)) isform = 1;\n\t}\n }\n param->operation = ADMIN;\n if(isform && contentlen) {\n\tprintstr(&pp, \"HTTP/1.0 100 Continue\\r\\n\\r\\n\");\n\tstdpr(&pp, NULL, 0);\n }\n res = (*param->srv->authfunc)(param);\n if(res && res != 10) {\n\tprintstr(&pp, authreq);\n\tRETURN(res);\n }\n if(param->srv->singlepacket || param->redirected){\n\tif(*req == 'C') req[1] = 0;\n\telse *req = 0;\n }\n sprintf(buf, ok, conf.stringtable?(char *)conf.stringtable[2]:\"3proxy\", conf.stringtable?(char *)conf.stringtable[2]:\"3[APA3A] tiny proxy\", conf.stringtable?(char *)conf.stringtable[3]:\"\");\n if(*req != 'S') printstr(&pp, buf);\n switch(*req){\n\tcase 'C':\n\t\tprintstr(&pp, counters);\n\t\t{\n\t\t\tstruct trafcount *cp; \n\t\t\tint num = 0;\n\t\t\tfor(cp = conf.trafcounter; cp; cp = cp->next, num++){\n\t\t\t int inbuf = 0;\n\n\t\t\t if(cp->ace && (param->srv->singlepacket || param->redirected)){\n\t\t\t\tif(!ACLmatches(cp->ace, param))continue;\n\t\t\t }\n\t\t\t if(req[1] == 'S' && atoi(req+2) == num) cp->disabled=0;\n\t\t\t if(req[1] == 'D' && atoi(req+2) == num) cp->disabled=1;\n\t\t\t inbuf += sprintf(buf,\t\"\"\n\t\t\t\t\t\t\"%s%s\",\n\t\t\t\t\t\t(cp->comment)?cp->comment:\" \",\n\t\t\t\t\t\t(cp->disabled)?'S':'D',\n\t\t\t\t\t\tnum,\n\t\t\t\t\t\t(cp->disabled)?\"NO\":\"YES\"\n\t\t\t\t\t);\n\t\t\t if(!cp->ace || !cp->ace->users){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printuserlist(buf+inbuf, LINESIZE-800, cp->ace->users, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->src){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printiplist(buf+inbuf, LINESIZE-512, cp->ace->src, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->dst){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printiplist(buf+inbuf, LINESIZE-512, cp->ace->dst, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->ports){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printportlist(buf+inbuf, LINESIZE-128, cp->ace->ports, \",
\\r\\n\");\n\t\t\t }\n\t\t\t if(cp->type == NONE) {\n\t\t\t inbuf += sprintf(buf+inbuf,\t\n\t\t\t\t\t\"exclude from limitation\\r\\n\"\n\t\t\t\t );\n\t\t\t }\n\t\t\t else {\n\t\t\t inbuf += sprintf(buf+inbuf,\t\n\t\t\t\t\t\"%\"PRINTF_INT64_MODIFIER\"u\"\n\t\t\t\t\t\"MB%s\"\n\t\t\t\t\t\"%\"PRINTF_INT64_MODIFIER\"u\"\n\t\t\t\t\t\"%s\",\n\t\t\t\t cp->traflim64 / (1024 * 1024),\n\t\t\t\t rotations[cp->type],\n\t\t\t\t cp->traf64,\n\t\t\t\t cp->cleared?ctime(&cp->cleared):\"never\"\n\t\t\t\t);\n\t\t\t inbuf += sprintf(buf + inbuf,\n\t\t\t\t\t\"%s\"\n\t\t\t\t\t\"%i\"\n\t\t\t\t\t\"\\r\\n\",\n\n\t\t\t\t cp->updated?ctime(&cp->updated):\"never\",\n\t\t\t\t cp->number\n\t\t\t\t);\n\t\t\t }\n\t\t\t printstr(&pp, buf);\n\t\t\t}\n\n\t\t}\n\t\tprintstr(&pp, counterstail);\n\t\tbreak;\n\t\t\n\tcase 'R':\n\t\tconf.needreload = 1;\n\t\tprintstr(&pp, \"

Reload scheduled

\");\n\t\tbreak;\n\tcase 'S':\n\t\t{\n\t\t\tif(req[1] == 'X'){\n\t\t\t\tprintstr(&pp, style);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tprintstr(&pp, xml);\n\t\t\tprintval(conf.services, TYPE_SERVER, 0, &pp);\n\t\t\tprintstr(&pp, postxml);\n\t\t}\n\t\t\tbreak;\n\tcase 'F':\n\t\t{\n\t\t\tFILE *fp;\n\t\t\tchar buf[256];\n\n\t\t\tfp = confopen();\n\t\t\tif(!fp){\n\t\t\t\tprintstr(&pp, \"

Failed to open config file

\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\tprintstr(&pp, \"

Please be careful editing config file remotely

\");\n\t\t\t\tprintstr(&pp, \"

\");\n\t\t\tbreak;\n\t\t}\n\tcase 'U':\n\t\t{\n\t\t\tunsigned l=0;\n\t\t\tint error = 0;\n\n\t\t\tif(!writable || !contentlen || fseek(writable, 0, 0)){\n\t\t\t\terror = 1;\n\t\t\t}\n\t\t\twhile(l < contentlen && (i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, (contentlen - l) > LINESIZE - 1?LINESIZE - 1:contentlen - l, '+', conf.timeouts[STRING_S])) > 0){\n\t\t\t\tif(i > (contentlen - l)) i = (contentlen - l);\n\t\t\t\tif(!l){\n\t\t\t\t\tif(i<9 || strncasecmp(buf, \"conffile=\", 9)) error = 1;\n\t\t\t\t}\n\t\t\t\tif(!error){\n\t\t\t\t\tbuf[i] = 0;\n\t\t\t\t\tdecodeurl((unsigned char *)buf, 1);\n\t\t\t\t\tfprintf(writable, \"%s\", l? buf : buf + 9);\n\t\t\t\t}\n\t\t\t\tl += i;\n\t\t\t}\n\t\t\tif(writable && !error){\n\t\t\t\tfflush(writable);\n#ifndef _WINCE\n\t\t\t\tftruncate(fileno(writable), ftell(writable));\n#endif\n\t\t\t}\n\t\t\tprintstr(&pp, error? \"

Config file is not writable

Make sure you have \\\"writable\\\" command in configuration file\":\n\t\t\t\t\t\t\"

Configuration updated

\");\n\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tprintstr(&pp, (char *)conf.stringtable[WEBBANNERS]);\n\t\tbreak;\n }\n if(*req != 'S') printstr(&pp, tail);\n\nCLEANRET:\n\n\n printstr(&pp, NULL);\n if(buf) myfree(buf);\n (*param->srv->logfunc)(param, (unsigned char *)req);\n if(req)myfree(req);\n freeparam(param);\n return (NULL);\n}","lang":"c","vul_type":"cwe-787","target_token_count":2356,"sven_meta":{"func_name":"adminchild","file_name":"src/webadmin.c","commit_link":"github.com/z3APA3A/3proxy/commit/3b67dc844789dc0f00e934270c7b349bcb547865","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#33-dc72d21d516c","input":"NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)\n{\n\tstatic const char module[] = \"NeXTDecode\";\n\tunsigned char *bp, *op;\n\ttmsize_t cc;\n\tuint8* row;\n\ttmsize_t scanline, n;\n\n\t(void) s;\n\t/*\n\t * Each scanline is assumed to start off as all\n\t * white (we assume a PhotometricInterpretation\n\t * of ``min-is-black'').\n\t */\n\tfor (op = (unsigned char*) buf, cc = occ; cc-- > 0;)\n\t\t*op++ = 0xff;\n\n\tbp = (unsigned char *)tif->tif_rawcp;\n\tcc = tif->tif_rawcc;\n\tscanline = tif->tif_scanlinesize;\n\tif (occ % scanline)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Fractional scanlines cannot be read\");\n\t\treturn (0);\n\t}\n\tfor (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline) {\n\t\tn = *bp++, cc--;\n\t\tswitch (n) {\n\t\tcase LITERALROW:\n\t\t\t/*\n\t\t\t * The entire scanline is given as literal values.\n\t\t\t */\n\t\t\tif (cc < scanline)\n\t\t\t\tgoto bad;\n\t\t\t_TIFFmemcpy(row, bp, scanline);\n\t\t\tbp += scanline;\n\t\t\tcc -= scanline;\n\t\t\tbreak;\n\t\tcase LITERALSPAN: {\n\t\t\ttmsize_t off;\n\t\t\t/*\n\t\t\t * The scanline has a literal span that begins at some\n\t\t\t * offset.\n\t\t\t */\n\t\t\tif( cc < 4 )\n\t\t\t\tgoto bad;\n\t\t\toff = (bp[0] * 256) + bp[1];\n\t\t\tn = (bp[2] * 256) + bp[3];\n\t\t\tif (cc < 4+n || off+n > scanline)\n\t\t\t\tgoto bad;\n\t\t\t_TIFFmemcpy(row+off, bp+4, n);\n\t\t\tbp += 4+n;\n\t\t\tcc -= 4+n;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tuint32 npixels = 0, grey;\n\t\t\tuint32 imagewidth = tif->tif_dir.td_imagewidth;\n if( isTiled(tif) )\n imagewidth = tif->tif_dir.td_tilewidth;\n\n\t\t\t/*\n\t\t\t * The scanline is composed of a sequence of constant\n\t\t\t * color ``runs''. We shift into ``run mode'' and\n\t\t\t * interpret bytes as codes of the form\n\t\t\t * until we've filled the scanline.\n\t\t\t */\n\t\t\top = row;\n\t\t\tfor (;;) {\n\t\t\t\tgrey = (uint32)((n>>6) & 0x3);\n\t\t\t\tn &= 0x3f;\n\t\t\t\t/*\n\t\t\t\t * Ensure the run does not exceed the scanline\n\t\t\t\t * bounds, potentially resulting in a security\n\t\t\t\t * issue.\n\t\t\t\t */\n\t\t\t\twhile (n-- > 0 && npixels < imagewidth)\n\t\t\t\t\tSETPIXEL(op, grey);\n\t\t\t\tif (npixels >= imagewidth)\n\t\t\t\t\tbreak;\n\t\t\t\tif (cc == 0)\n\t\t\t\t\tgoto bad;\n\t\t\t\tn = *bp++, cc--;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\t}\n\t}\n\ttif->tif_rawcp = (uint8*) bp;\n\ttif->tif_rawcc = cc;\n\treturn (1);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, module, \"Not enough data for scanline %ld\",\n\t (long) tif->tif_row);\n\treturn (0);\n}","target":"NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)\n{\n\tstatic const char module[] = \"NeXTDecode\";\n\tunsigned char *bp, *op;\n\ttmsize_t cc;\n\tuint8* row;\n\ttmsize_t scanline, n;\n\n\t(void) s;\n\t/*\n\t * Each scanline is assumed to start off as all\n\t * white (we assume a PhotometricInterpretation\n\t * of ``min-is-black'').\n\t */\n\tfor (op = (unsigned char*) buf, cc = occ; cc-- > 0;)\n\t\t*op++ = 0xff;\n\n\tbp = (unsigned char *)tif->tif_rawcp;\n\tcc = tif->tif_rawcc;\n\tscanline = tif->tif_scanlinesize;\n\tif (occ % scanline)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Fractional scanlines cannot be read\");\n\t\treturn (0);\n\t}\n\tfor (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline) {\n\t\tn = *bp++, cc--;\n\t\tswitch (n) {\n\t\tcase LITERALROW:\n\t\t\t/*\n\t\t\t * The entire scanline is given as literal values.\n\t\t\t */\n\t\t\tif (cc < scanline)\n\t\t\t\tgoto bad;\n\t\t\t_TIFFmemcpy(row, bp, scanline);\n\t\t\tbp += scanline;\n\t\t\tcc -= scanline;\n\t\t\tbreak;\n\t\tcase LITERALSPAN: {\n\t\t\ttmsize_t off;\n\t\t\t/*\n\t\t\t * The scanline has a literal span that begins at some\n\t\t\t * offset.\n\t\t\t */\n\t\t\tif( cc < 4 )\n\t\t\t\tgoto bad;\n\t\t\toff = (bp[0] * 256) + bp[1];\n\t\t\tn = (bp[2] * 256) + bp[3];\n\t\t\tif (cc < 4+n || off+n > scanline)\n\t\t\t\tgoto bad;\n\t\t\t_TIFFmemcpy(row+off, bp+4, n);\n\t\t\tbp += 4+n;\n\t\t\tcc -= 4+n;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tuint32 npixels = 0, grey;\n\t\t\tuint32 imagewidth = tif->tif_dir.td_imagewidth;\n if( isTiled(tif) )\n imagewidth = tif->tif_dir.td_tilewidth;\n tmsize_t op_offset = 0;\n\n\t\t\t/*\n\t\t\t * The scanline is composed of a sequence of constant\n\t\t\t * color ``runs''. We shift into ``run mode'' and\n\t\t\t * interpret bytes as codes of the form\n\t\t\t * until we've filled the scanline.\n\t\t\t */\n\t\t\top = row;\n\t\t\tfor (;;) {\n\t\t\t\tgrey = (uint32)((n>>6) & 0x3);\n\t\t\t\tn &= 0x3f;\n\t\t\t\t/*\n\t\t\t\t * Ensure the run does not exceed the scanline\n\t\t\t\t * bounds, potentially resulting in a security\n\t\t\t\t * issue.\n\t\t\t\t */\n\t\t\t\twhile (n-- > 0 && npixels < imagewidth && op_offset < scanline)\n\t\t\t\t\tSETPIXEL(op, grey);\n\t\t\t\tif (npixels >= imagewidth)\n\t\t\t\t\tbreak;\n if (op_offset >= scanline ) {\n TIFFErrorExt(tif->tif_clientdata, module, \"Invalid data for scanline %ld\",\n (long) tif->tif_row);\n return (0);\n }\n\t\t\t\tif (cc == 0)\n\t\t\t\t\tgoto bad;\n\t\t\t\tn = *bp++, cc--;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\t}\n\t}\n\ttif->tif_rawcp = (uint8*) bp;\n\ttif->tif_rawcc = cc;\n\treturn (1);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, module, \"Not enough data for scanline %ld\",\n\t (long) tif->tif_row);\n\treturn (0);\n}","lang":"c","vul_type":"cwe-787","target_token_count":846,"sven_meta":{"func_name":"NeXTDecode","file_name":"libtiff/tif_next.c","commit_link":"github.com/vadz/libtiff/commit/b18012dae552f85dcc5c57d3bf4e997a15b1cc1c","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#35-1b5cf111d8be","input":"static int tcos_decipher(sc_card_t *card, const u8 * crgram, size_t crgram_len, u8 * out, size_t outlen)\n{\n\tsc_context_t *ctx;\n\tsc_apdu_t apdu;\n\tu8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n\tu8 sbuf[SC_MAX_APDU_BUFFER_SIZE];\n\ttcos_data *data;\n\tint tcos3, r;\n\n\tassert(card != NULL && crgram != NULL && out != NULL);\n\tctx = card->ctx;\n\ttcos3=(card->type==SC_CARD_TYPE_TCOS_V3);\n\tdata=(tcos_data *)card->drv_data;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx,\n\t\t\"TCOS3:%d PKCS1:%d\\n\",tcos3,\n\t\t!!(data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1));\n\n\tsc_format_apdu(card, &apdu, crgram_len>255 ? SC_APDU_CASE_4_EXT : SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86);\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.le = crgram_len;\n\n\tapdu.data = sbuf;\n\tapdu.lc = apdu.datalen = crgram_len+1;\n\tsbuf[0] = tcos3 ? 0x00 : ((data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) ? 0x81 : 0x02);\n\tmemcpy(sbuf+1, crgram, crgram_len);\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tif (apdu.sw1==0x90 && apdu.sw2==0x00) {\n\t\tsize_t len= (apdu.resplen>outlen) ? outlen : apdu.resplen;\n\t\tunsigned int offset=0;\n\t\tif(tcos3 && (data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) && apdu.resp[0]==0 && apdu.resp[1]==2) {\n\t\t\toffset=2; while(offsetctx, SC_LOG_DEBUG_VERBOSE, len-offset);\n\t}\n\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2));\n}","target":"static int tcos_decipher(sc_card_t *card, const u8 * crgram, size_t crgram_len, u8 * out, size_t outlen)\n{\n\tsc_context_t *ctx;\n\tsc_apdu_t apdu;\n\tu8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n\tu8 sbuf[SC_MAX_APDU_BUFFER_SIZE];\n\ttcos_data *data;\n\tint tcos3, r;\n\n\tassert(card != NULL && crgram != NULL && out != NULL);\n\tctx = card->ctx;\n\ttcos3=(card->type==SC_CARD_TYPE_TCOS_V3);\n\tdata=(tcos_data *)card->drv_data;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx,\n\t\t\"TCOS3:%d PKCS1:%d\\n\",tcos3,\n\t\t!!(data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1));\n\n\tsc_format_apdu(card, &apdu, crgram_len>255 ? SC_APDU_CASE_4_EXT : SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86);\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.le = crgram_len;\n\n\tapdu.data = sbuf;\n\tapdu.lc = apdu.datalen = crgram_len+1;\n\tsbuf[0] = tcos3 ? 0x00 : ((data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) ? 0x81 : 0x02);\n\tif (sizeof sbuf - 1 < crgram_len)\n\t\treturn SC_ERROR_INVALID_ARGUMENTS;\n\tmemcpy(sbuf+1, crgram, crgram_len);\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tif (apdu.sw1==0x90 && apdu.sw2==0x00) {\n\t\tsize_t len= (apdu.resplen>outlen) ? outlen : apdu.resplen;\n\t\tunsigned int offset=0;\n\t\tif(tcos3 && (data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) && apdu.resp[0]==0 && apdu.resp[1]==2) {\n\t\t\toffset=2; while(offsetctx, SC_LOG_DEBUG_VERBOSE, len-offset);\n\t}\n\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2));\n}","lang":"c","vul_type":"cwe-787","target_token_count":574,"sven_meta":{"func_name":"tcos_decipher","file_name":"src/libopensc/card-tcos.c","commit_link":"github.com/OpenSC/OpenSC/commit/9d294de90d1cc66956389856e60b6944b27b4817","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#37-0f22a40e83a8","input":"MultiPartInputFile::Data::chunkOffsetReconstruction(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream& is, const vector& parts)\n{\n //\n // Reconstruct broken chunk offset tables. Stop once we received any exception.\n //\n\n Int64 position = is.tellg();\n\n \n //\n // check we understand all the parts available: if not, we cannot continue\n // exceptions thrown here should trickle back up to the constructor\n //\n \n for (size_t i = 0; i < parts.size(); i++)\n {\n Header& header=parts[i]->header;\n \n //\n // do we have a valid type entry?\n // we only need them for true multipart files or single part non-image (deep) files\n //\n if(!header.hasType() && (isMultiPart(version) || isNonImage(version)))\n {\n throw IEX_NAMESPACE::ArgExc(\"cannot reconstruct incomplete file: part with missing type\");\n }\n if(!isSupportedType(header.type()))\n {\n throw IEX_NAMESPACE::ArgExc(\"cannot reconstruct incomplete file: part with unknown type \"+header.type());\n }\n }\n \n \n // how many chunks should we read? We should stop when we reach the end\n size_t total_chunks = 0;\n \n // for tiled-based parts, array of (pointers to) tileOffsets objects\n // to create mapping between tile coordinates and chunk table indices\n \n \n vector tileOffsets(parts.size());\n \n // for scanline-based parts, number of scanlines in each chunk\n vector rowsizes(parts.size());\n \n for(size_t i = 0 ; i < parts.size() ; i++)\n {\n total_chunks += parts[i]->chunkOffsets.size();\n if (isTiled(parts[i]->header.type()))\n {\n tileOffsets[i] = createTileOffsets(parts[i]->header);\n }else{\n tileOffsets[i] = NULL;\n // (TODO) fix this so that it doesn't need to be revised for future compression types.\n switch(parts[i]->header.compression())\n {\n case DWAB_COMPRESSION :\n rowsizes[i] = 256;\n break;\n case PIZ_COMPRESSION :\n case B44_COMPRESSION :\n case B44A_COMPRESSION :\n case DWAA_COMPRESSION :\n rowsizes[i]=32;\n break;\n case ZIP_COMPRESSION :\n case PXR24_COMPRESSION :\n rowsizes[i]=16;\n break;\n case ZIPS_COMPRESSION :\n case RLE_COMPRESSION :\n case NO_COMPRESSION :\n rowsizes[i]=1;\n break;\n default :\n throw(IEX_NAMESPACE::ArgExc(\"Unknown compression method in chunk offset reconstruction\"));\n }\n }\n }\n \n try\n {\n \n //\n // \n //\n \n Int64 chunk_start = position;\n for (size_t i = 0; i < total_chunks ; i++)\n {\n //\n // do we have a part number?\n //\n \n int partNumber = 0;\n if(isMultiPart(version))\n {\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, partNumber);\n }\n \n \n \n if(partNumber<0 || partNumber> static_cast(parts.size()))\n {\n throw IEX_NAMESPACE::IoExc(\"part number out of range\");\n }\n \n Header& header = parts[partNumber]->header;\n\n // size of chunk NOT including multipart field\n \n Int64 size_of_chunk=0;\n\n if (isTiled(header.type()))\n {\n //\n // \n //\n int tilex,tiley,levelx,levely;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, tilex);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, tiley);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, levelx);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, levely);\n \n //std::cout << \"chunk_start for \" << tilex <<',' << tiley << ',' << levelx << ' ' << levely << ':' << chunk_start << std::endl;\n \n \n if(!tileOffsets[partNumber])\n {\n // this shouldn't actually happen - we should have allocated a valid\n // tileOffsets for any part which isTiled\n throw IEX_NAMESPACE::IoExc(\"part not tiled\");\n \n }\n \n if(!tileOffsets[partNumber]->isValidTile(tilex,tiley,levelx,levely))\n {\n throw IEX_NAMESPACE::IoExc(\"invalid tile coordinates\");\n }\n \n (*tileOffsets[partNumber])(tilex,tiley,levelx,levely)=chunk_start;\n \n // compute chunk sizes - different procedure for deep tiles and regular\n // ones\n if(header.type()==DEEPTILE)\n {\n Int64 packed_offset;\n Int64 packed_sample;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_offset);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_sample);\n \n //add 40 byte header to packed sizes (tile coordinates, packed sizes, unpacked size)\n size_of_chunk=packed_offset+packed_sample+40;\n }\n else\n {\n \n // regular image has 20 bytes of header, 4 byte chunksize;\n int chunksize;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, chunksize);\n size_of_chunk=chunksize+20;\n }\n }\n else\n {\n int y_coordinate;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, y_coordinate);\n \n \n if(y_coordinate < header.dataWindow().min.y || y_coordinate > header.dataWindow().max.y)\n {\n throw IEX_NAMESPACE::IoExc(\"y out of range\");\n }\n y_coordinate -= header.dataWindow().min.y;\n y_coordinate /= rowsizes[partNumber]; \n \n if(y_coordinate < 0 || y_coordinate >= int(parts[partNumber]->chunkOffsets.size()))\n {\n throw IEX_NAMESPACE::IoExc(\"chunk index out of range\");\n }\n \n parts[partNumber]->chunkOffsets[y_coordinate]=chunk_start;\n \n if(header.type()==DEEPSCANLINE)\n {\n Int64 packed_offset;\n Int64 packed_sample;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_offset);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_sample);\n \n \n size_of_chunk=packed_offset+packed_sample+28;\n }\n else\n {\n int chunksize;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, chunksize); \n size_of_chunk=chunksize+8;\n }\n \n }\n \n if(isMultiPart(version))\n {\n chunk_start+=4;\n }\n \n chunk_start+=size_of_chunk;\n \n is.seekg(chunk_start);\n \n }\n \n }\n catch (...)\n {\n //\n // Suppress all exceptions. This functions is\n // called only to reconstruct the line offset\n // table for incomplete files, and exceptions\n // are likely.\n //\n }\n\n // copy tiled part data back to chunk offsets\n \n for(size_t partNumber=0;partNumber > > offsets = tileOffsets[partNumber]->getOffsets();\n for (size_t l = 0; l < offsets.size(); l++)\n for (size_t y = 0; y < offsets[l].size(); y++)\n for (size_t x = 0; x < offsets[l][y].size(); x++)\n {\n parts[ partNumber ]->chunkOffsets[pos] = offsets[l][y][x];\n pos++;\n }\n delete tileOffsets[partNumber];\n }\n }\n\n is.clear();\n is.seekg (position);\n}","target":"MultiPartInputFile::Data::chunkOffsetReconstruction(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream& is, const vector& parts)\n{\n //\n // Reconstruct broken chunk offset tables. Stop once we received any exception.\n //\n\n Int64 position = is.tellg();\n\n \n //\n // check we understand all the parts available: if not, we cannot continue\n // exceptions thrown here should trickle back up to the constructor\n //\n \n for (size_t i = 0; i < parts.size(); i++)\n {\n Header& header=parts[i]->header;\n \n //\n // do we have a valid type entry?\n // we only need them for true multipart files or single part non-image (deep) files\n //\n if(!header.hasType() && (isMultiPart(version) || isNonImage(version)))\n {\n throw IEX_NAMESPACE::ArgExc(\"cannot reconstruct incomplete file: part with missing type\");\n }\n if(!isSupportedType(header.type()))\n {\n throw IEX_NAMESPACE::ArgExc(\"cannot reconstruct incomplete file: part with unknown type \"+header.type());\n }\n }\n \n \n // how many chunks should we read? We should stop when we reach the end\n size_t total_chunks = 0;\n \n // for tiled-based parts, array of (pointers to) tileOffsets objects\n // to create mapping between tile coordinates and chunk table indices\n \n \n vector tileOffsets(parts.size());\n \n // for scanline-based parts, number of scanlines in each chunk\n vector rowsizes(parts.size());\n \n for(size_t i = 0 ; i < parts.size() ; i++)\n {\n total_chunks += parts[i]->chunkOffsets.size();\n if (isTiled(parts[i]->header.type()))\n {\n tileOffsets[i] = createTileOffsets(parts[i]->header);\n }else{\n tileOffsets[i] = NULL;\n // (TODO) fix this so that it doesn't need to be revised for future compression types.\n switch(parts[i]->header.compression())\n {\n case DWAB_COMPRESSION :\n rowsizes[i] = 256;\n break;\n case PIZ_COMPRESSION :\n case B44_COMPRESSION :\n case B44A_COMPRESSION :\n case DWAA_COMPRESSION :\n rowsizes[i]=32;\n break;\n case ZIP_COMPRESSION :\n case PXR24_COMPRESSION :\n rowsizes[i]=16;\n break;\n case ZIPS_COMPRESSION :\n case RLE_COMPRESSION :\n case NO_COMPRESSION :\n rowsizes[i]=1;\n break;\n default :\n throw(IEX_NAMESPACE::ArgExc(\"Unknown compression method in chunk offset reconstruction\"));\n }\n }\n }\n \n try\n {\n \n //\n // \n //\n \n Int64 chunk_start = position;\n for (size_t i = 0; i < total_chunks ; i++)\n {\n //\n // do we have a part number?\n //\n \n int partNumber = 0;\n if(isMultiPart(version))\n {\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, partNumber);\n }\n \n \n \n if(partNumber<0 || partNumber>= static_cast(parts.size()))\n {\n throw IEX_NAMESPACE::IoExc(\"part number out of range\");\n }\n \n Header& header = parts[partNumber]->header;\n\n // size of chunk NOT including multipart field\n \n Int64 size_of_chunk=0;\n\n if (isTiled(header.type()))\n {\n //\n // \n //\n int tilex,tiley,levelx,levely;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, tilex);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, tiley);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, levelx);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, levely);\n \n //std::cout << \"chunk_start for \" << tilex <<',' << tiley << ',' << levelx << ' ' << levely << ':' << chunk_start << std::endl;\n \n \n if(!tileOffsets[partNumber])\n {\n // this shouldn't actually happen - we should have allocated a valid\n // tileOffsets for any part which isTiled\n throw IEX_NAMESPACE::IoExc(\"part not tiled\");\n \n }\n \n if(!tileOffsets[partNumber]->isValidTile(tilex,tiley,levelx,levely))\n {\n throw IEX_NAMESPACE::IoExc(\"invalid tile coordinates\");\n }\n \n (*tileOffsets[partNumber])(tilex,tiley,levelx,levely)=chunk_start;\n \n // compute chunk sizes - different procedure for deep tiles and regular\n // ones\n if(header.type()==DEEPTILE)\n {\n Int64 packed_offset;\n Int64 packed_sample;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_offset);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_sample);\n \n //add 40 byte header to packed sizes (tile coordinates, packed sizes, unpacked size)\n size_of_chunk=packed_offset+packed_sample+40;\n }\n else\n {\n \n // regular image has 20 bytes of header, 4 byte chunksize;\n int chunksize;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, chunksize);\n size_of_chunk=chunksize+20;\n }\n }\n else\n {\n int y_coordinate;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, y_coordinate);\n \n \n if(y_coordinate < header.dataWindow().min.y || y_coordinate > header.dataWindow().max.y)\n {\n throw IEX_NAMESPACE::IoExc(\"y out of range\");\n }\n y_coordinate -= header.dataWindow().min.y;\n y_coordinate /= rowsizes[partNumber]; \n \n if(y_coordinate < 0 || y_coordinate >= int(parts[partNumber]->chunkOffsets.size()))\n {\n throw IEX_NAMESPACE::IoExc(\"chunk index out of range\");\n }\n \n parts[partNumber]->chunkOffsets[y_coordinate]=chunk_start;\n \n if(header.type()==DEEPSCANLINE)\n {\n Int64 packed_offset;\n Int64 packed_sample;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_offset);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_sample);\n \n \n size_of_chunk=packed_offset+packed_sample+28;\n }\n else\n {\n int chunksize;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, chunksize); \n size_of_chunk=chunksize+8;\n }\n \n }\n \n if(isMultiPart(version))\n {\n chunk_start+=4;\n }\n \n chunk_start+=size_of_chunk;\n \n is.seekg(chunk_start);\n \n }\n \n }\n catch (...)\n {\n //\n // Suppress all exceptions. This functions is\n // called only to reconstruct the line offset\n // table for incomplete files, and exceptions\n // are likely.\n //\n }\n\n // copy tiled part data back to chunk offsets\n \n for(size_t partNumber=0;partNumber > > offsets = tileOffsets[partNumber]->getOffsets();\n for (size_t l = 0; l < offsets.size(); l++)\n for (size_t y = 0; y < offsets[l].size(); y++)\n for (size_t x = 0; x < offsets[l][y].size(); x++)\n {\n parts[ partNumber ]->chunkOffsets[pos] = offsets[l][y][x];\n pos++;\n }\n delete tileOffsets[partNumber];\n }\n }\n\n is.clear();\n is.seekg (position);\n}","lang":"cpp","vul_type":"cwe-787","target_token_count":1892,"sven_meta":{"func_name":"MultiPartInputFile::Data::chunkOffsetReconstruction","file_name":"OpenEXR/IlmImf/ImfMultiPartInputFile.cpp","commit_link":"github.com/AcademySoftwareFoundation/openexr/commit/8b5370c688a7362673c3a5256d93695617a4cd9a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#38-f636ecbbf371","input":"make_canonical(struct ly_ctx *ctx, int type, const char **value, void *data1, void *data2)\n{\n const uint16_t buf_len = 511;\n char buf[buf_len + 1];\n struct lys_type_bit **bits = NULL;\n struct lyxp_expr *exp;\n const char *module_name, *cur_expr, *end;\n int i, j, count;\n int64_t num;\n uint64_t unum;\n uint8_t c;\n\n#define LOGBUF(str) LOGERR(ctx, LY_EINVAL, \"Value \\\"%s\\\" is too long.\", str)\n\n switch (type) {\n case LY_TYPE_BITS:\n bits = (struct lys_type_bit **)data1;\n count = *((int *)data2);\n /* in canonical form, the bits are ordered by their position */\n buf[0] = '\\0';\n for (i = 0; i < count; i++) {\n if (!bits[i]) {\n /* bit not set */\n continue;\n }\n if (buf[0]) {\n LY_CHECK_ERR_RETURN(strlen(buf) + 1 + strlen(bits[i]->name) > buf_len, LOGBUF(bits[i]->name), -1);\n sprintf(buf + strlen(buf), \" %s\", bits[i]->name);\n } else {\n LY_CHECK_ERR_RETURN(strlen(bits[i]->name) > buf_len, LOGBUF(bits[i]->name), -1);\n strcpy(buf, bits[i]->name);\n }\n }\n break;\n\n case LY_TYPE_IDENT:\n module_name = (const char *)data1;\n /* identity must always have a prefix */\n if (!strchr(*value, ':')) {\n sprintf(buf, \"%s:%s\", module_name, *value);\n } else {\n strcpy(buf, *value);\n }\n break;\n\n case LY_TYPE_INST:\n exp = lyxp_parse_expr(ctx, *value);\n LY_CHECK_ERR_RETURN(!exp, LOGINT(ctx), -1);\n\n module_name = NULL;\n count = 0;\n for (i = 0; (unsigned)i < exp->used; ++i) {\n cur_expr = &exp->expr[exp->expr_pos[i]];\n\n /* copy WS */\n if (i && ((end = exp->expr + exp->expr_pos[i - 1] + exp->tok_len[i - 1]) != cur_expr)) {\n if (count + (cur_expr - end) > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(end);\n return -1;\n }\n strncpy(&buf[count], end, cur_expr - end);\n count += cur_expr - end;\n }\n\n if ((exp->tokens[i] == LYXP_TOKEN_NAMETEST) && (end = strnchr(cur_expr, ':', exp->tok_len[i]))) {\n /* get the module name with \":\" */\n ++end;\n j = end - cur_expr;\n\n if (!module_name || strncmp(cur_expr, module_name, j)) {\n /* print module name with colon, it does not equal to the parent one */\n if (count + j > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(cur_expr);\n return -1;\n }\n strncpy(&buf[count], cur_expr, j);\n count += j;\n }\n module_name = cur_expr;\n\n /* copy the rest */\n if (count + (exp->tok_len[i] - j) > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(end);\n return -1;\n }\n strncpy(&buf[count], end, exp->tok_len[i] - j);\n count += exp->tok_len[i] - j;\n } else {\n if (count + exp->tok_len[i] > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(&exp->expr[exp->expr_pos[i]]);\n return -1;\n }\n strncpy(&buf[count], &exp->expr[exp->expr_pos[i]], exp->tok_len[i]);\n count += exp->tok_len[i];\n }\n }\n if (count > buf_len) {\n LOGINT(ctx);\n lyxp_expr_free(exp);\n return -1;\n }\n buf[count] = '\\0';\n\n lyxp_expr_free(exp);\n break;\n\n case LY_TYPE_DEC64:\n num = *((int64_t *)data1);\n c = *((uint8_t *)data2);\n if (num) {\n count = sprintf(buf, \"%\"PRId64\" \", num);\n if ( (num > 0 && (count - 1) <= c)\n || (count - 2) <= c ) {\n /* we have 0. value, print the value with the leading zeros\n * (one for 0. and also keep the correct with of num according\n * to fraction-digits value)\n * for (num<0) - extra character for '-' sign */\n count = sprintf(buf, \"%0*\"PRId64\" \", (num > 0) ? (c + 1) : (c + 2), num);\n }\n for (i = c, j = 1; i > 0 ; i--) {\n if (j && i > 1 && buf[count - 2] == '0') {\n /* we have trailing zero to skip */\n buf[count - 1] = '\\0';\n } else {\n j = 0;\n buf[count - 1] = buf[count - 2];\n }\n count--;\n }\n buf[count - 1] = '.';\n } else {\n /* zero */\n sprintf(buf, \"0.0\");\n }\n break;\n\n case LY_TYPE_INT8:\n case LY_TYPE_INT16:\n case LY_TYPE_INT32:\n case LY_TYPE_INT64:\n num = *((int64_t *)data1);\n sprintf(buf, \"%\"PRId64, num);\n break;\n\n case LY_TYPE_UINT8:\n case LY_TYPE_UINT16:\n case LY_TYPE_UINT32:\n case LY_TYPE_UINT64:\n unum = *((uint64_t *)data1);\n sprintf(buf, \"%\"PRIu64, unum);\n break;\n\n default:\n /* should not be even called - just do nothing */\n return 0;\n }\n\n if (strcmp(buf, *value)) {\n lydict_remove(ctx, *value);\n *value = lydict_insert(ctx, buf, 0);\n return 1;\n }\n\n return 0;\n\n#undef LOGBUF\n}","target":"make_canonical(struct ly_ctx *ctx, int type, const char **value, void *data1, void *data2)\n{\n const uint16_t buf_len = 511;\n char buf[buf_len + 1];\n struct lys_type_bit **bits = NULL;\n struct lyxp_expr *exp;\n const char *module_name, *cur_expr, *end;\n int i, j, count;\n int64_t num;\n uint64_t unum;\n uint8_t c;\n\n#define LOGBUF(str) LOGERR(ctx, LY_EINVAL, \"Value \\\"%s\\\" is too long.\", str)\n\n switch (type) {\n case LY_TYPE_BITS:\n bits = (struct lys_type_bit **)data1;\n count = *((int *)data2);\n /* in canonical form, the bits are ordered by their position */\n buf[0] = '\\0';\n for (i = 0; i < count; i++) {\n if (!bits[i]) {\n /* bit not set */\n continue;\n }\n if (buf[0]) {\n LY_CHECK_ERR_RETURN(strlen(buf) + 1 + strlen(bits[i]->name) > buf_len, LOGBUF(bits[i]->name), -1);\n sprintf(buf + strlen(buf), \" %s\", bits[i]->name);\n } else {\n LY_CHECK_ERR_RETURN(strlen(bits[i]->name) > buf_len, LOGBUF(bits[i]->name), -1);\n strcpy(buf, bits[i]->name);\n }\n }\n break;\n\n case LY_TYPE_IDENT:\n module_name = (const char *)data1;\n /* identity must always have a prefix */\n if (!strchr(*value, ':')) {\n LY_CHECK_ERR_RETURN(strlen(module_name) + 1 + strlen(*value) > buf_len, LOGBUF(*value), -1);\n sprintf(buf, \"%s:%s\", module_name, *value);\n } else {\n LY_CHECK_ERR_RETURN(strlen(*value) > buf_len, LOGBUF(*value), -1);\n strcpy(buf, *value);\n }\n break;\n\n case LY_TYPE_INST:\n exp = lyxp_parse_expr(ctx, *value);\n LY_CHECK_ERR_RETURN(!exp, LOGINT(ctx), -1);\n\n module_name = NULL;\n count = 0;\n for (i = 0; (unsigned)i < exp->used; ++i) {\n cur_expr = &exp->expr[exp->expr_pos[i]];\n\n /* copy WS */\n if (i && ((end = exp->expr + exp->expr_pos[i - 1] + exp->tok_len[i - 1]) != cur_expr)) {\n if (count + (cur_expr - end) > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(end);\n return -1;\n }\n strncpy(&buf[count], end, cur_expr - end);\n count += cur_expr - end;\n }\n\n if ((exp->tokens[i] == LYXP_TOKEN_NAMETEST) && (end = strnchr(cur_expr, ':', exp->tok_len[i]))) {\n /* get the module name with \":\" */\n ++end;\n j = end - cur_expr;\n\n if (!module_name || strncmp(cur_expr, module_name, j)) {\n /* print module name with colon, it does not equal to the parent one */\n if (count + j > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(cur_expr);\n return -1;\n }\n strncpy(&buf[count], cur_expr, j);\n count += j;\n }\n module_name = cur_expr;\n\n /* copy the rest */\n if (count + (exp->tok_len[i] - j) > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(end);\n return -1;\n }\n strncpy(&buf[count], end, exp->tok_len[i] - j);\n count += exp->tok_len[i] - j;\n } else {\n if (count + exp->tok_len[i] > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(&exp->expr[exp->expr_pos[i]]);\n return -1;\n }\n strncpy(&buf[count], &exp->expr[exp->expr_pos[i]], exp->tok_len[i]);\n count += exp->tok_len[i];\n }\n }\n if (count > buf_len) {\n LOGINT(ctx);\n lyxp_expr_free(exp);\n return -1;\n }\n buf[count] = '\\0';\n\n lyxp_expr_free(exp);\n break;\n\n case LY_TYPE_DEC64:\n num = *((int64_t *)data1);\n c = *((uint8_t *)data2);\n if (num) {\n count = sprintf(buf, \"%\"PRId64\" \", num);\n if ( (num > 0 && (count - 1) <= c)\n || (count - 2) <= c ) {\n /* we have 0. value, print the value with the leading zeros\n * (one for 0. and also keep the correct with of num according\n * to fraction-digits value)\n * for (num<0) - extra character for '-' sign */\n count = sprintf(buf, \"%0*\"PRId64\" \", (num > 0) ? (c + 1) : (c + 2), num);\n }\n for (i = c, j = 1; i > 0 ; i--) {\n if (j && i > 1 && buf[count - 2] == '0') {\n /* we have trailing zero to skip */\n buf[count - 1] = '\\0';\n } else {\n j = 0;\n buf[count - 1] = buf[count - 2];\n }\n count--;\n }\n buf[count - 1] = '.';\n } else {\n /* zero */\n sprintf(buf, \"0.0\");\n }\n break;\n\n case LY_TYPE_INT8:\n case LY_TYPE_INT16:\n case LY_TYPE_INT32:\n case LY_TYPE_INT64:\n num = *((int64_t *)data1);\n sprintf(buf, \"%\"PRId64, num);\n break;\n\n case LY_TYPE_UINT8:\n case LY_TYPE_UINT16:\n case LY_TYPE_UINT32:\n case LY_TYPE_UINT64:\n unum = *((uint64_t *)data1);\n sprintf(buf, \"%\"PRIu64, unum);\n break;\n\n default:\n /* should not be even called - just do nothing */\n return 0;\n }\n\n if (strcmp(buf, *value)) {\n lydict_remove(ctx, *value);\n *value = lydict_insert(ctx, buf, 0);\n return 1;\n }\n\n return 0;\n\n#undef LOGBUF\n}","lang":"c","vul_type":"cwe-787","target_token_count":1476,"sven_meta":{"func_name":"make_canonical","file_name":"src/parser.c","commit_link":"github.com/CESNET/libyang/commit/6980afae2ff9fcd6d67508b0a3f694d75fd059d6","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#39-08fcb7df1d7e","input":"static int decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame, AVPacket *avpkt)\n{\n EXRContext *s = avctx->priv_data;\n ThreadFrame frame = { .f = data };\n AVFrame *picture = data;\n uint8_t *ptr;\n\n int i, y, ret, ymax;\n int planes;\n int out_line_size;\n int nb_blocks; /* nb scanline or nb tile */\n uint64_t start_offset_table;\n uint64_t start_next_scanline;\n PutByteContext offset_table_writer;\n\n bytestream2_init(&s->gb, avpkt->data, avpkt->size);\n\n if ((ret = decode_header(s, picture)) < 0)\n return ret;\n\n switch (s->pixel_type) {\n case EXR_FLOAT:\n case EXR_HALF:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n } else {\n /* todo: change this when a floating point pixel format with luma with alpha is implemented */\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRPF32;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAYF32;\n }\n }\n break;\n case EXR_UINT:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGBA64;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_YA16;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGB48;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAY16;\n }\n }\n break;\n default:\n av_log(avctx, AV_LOG_ERROR, \"Missing channel list.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if (s->apply_trc_type != AVCOL_TRC_UNSPECIFIED)\n avctx->color_trc = s->apply_trc_type;\n\n switch (s->compression) {\n case EXR_RAW:\n case EXR_RLE:\n case EXR_ZIP1:\n s->scan_lines_per_block = 1;\n break;\n case EXR_PXR24:\n case EXR_ZIP16:\n s->scan_lines_per_block = 16;\n break;\n case EXR_PIZ:\n case EXR_B44:\n case EXR_B44A:\n s->scan_lines_per_block = 32;\n break;\n default:\n avpriv_report_missing_feature(avctx, \"Compression %d\", s->compression);\n return AVERROR_PATCHWELCOME;\n }\n\n /* Verify the xmin, xmax, ymin and ymax before setting the actual image size.\n * It's possible for the data window can larger or outside the display window */\n if (s->xmin > s->xmax || s->ymin > s->ymax ||\n s->ydelta == 0xFFFFFFFF || s->xdelta == 0xFFFFFFFF) {\n av_log(avctx, AV_LOG_ERROR, \"Wrong or missing size information.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if ((ret = ff_set_dimensions(avctx, s->w, s->h)) < 0)\n return ret;\n\n s->desc = av_pix_fmt_desc_get(avctx->pix_fmt);\n if (!s->desc)\n return AVERROR_INVALIDDATA;\n\n if (s->desc->flags & AV_PIX_FMT_FLAG_FLOAT) {\n planes = s->desc->nb_components;\n out_line_size = avctx->width * 4;\n } else {\n planes = 1;\n out_line_size = avctx->width * 2 * s->desc->nb_components;\n }\n\n if (s->is_tile) {\n nb_blocks = ((s->xdelta + s->tile_attr.xSize - 1) / s->tile_attr.xSize) *\n ((s->ydelta + s->tile_attr.ySize - 1) / s->tile_attr.ySize);\n } else { /* scanline */\n nb_blocks = (s->ydelta + s->scan_lines_per_block - 1) /\n s->scan_lines_per_block;\n }\n\n if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)\n return ret;\n\n if (bytestream2_get_bytes_left(&s->gb)/8 < nb_blocks)\n return AVERROR_INVALIDDATA;\n\n // check offset table and recreate it if need\n if (!s->is_tile && bytestream2_peek_le64(&s->gb) == 0) {\n av_log(s->avctx, AV_LOG_DEBUG, \"recreating invalid scanline offset table\\n\");\n\n start_offset_table = bytestream2_tell(&s->gb);\n start_next_scanline = start_offset_table + nb_blocks * 8;\n bytestream2_init_writer(&offset_table_writer, &avpkt->data[start_offset_table], nb_blocks * 8);\n\n for (y = 0; y < nb_blocks; y++) {\n /* write offset of prev scanline in offset table */\n bytestream2_put_le64(&offset_table_writer, start_next_scanline);\n\n /* get len of next scanline */\n bytestream2_seek(&s->gb, start_next_scanline + 4, SEEK_SET);/* skip line number */\n start_next_scanline += (bytestream2_get_le32(&s->gb) + 8);\n }\n bytestream2_seek(&s->gb, start_offset_table, SEEK_SET);\n }\n\n // save pointer we are going to use in decode_block\n s->buf = avpkt->data;\n s->buf_size = avpkt->size;\n\n // Zero out the start if ymin is not 0\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i];\n for (y = 0; y < s->ymin; y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n s->picture = picture;\n\n avctx->execute2(avctx, decode_block, s->thread_data, NULL, nb_blocks);\n\n ymax = FFMAX(0, s->ymax + 1);\n // Zero out the end if ymax+1 is not h\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i] + (ymax * picture->linesize[i]);\n for (y = ymax; y < avctx->height; y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n picture->pict_type = AV_PICTURE_TYPE_I;\n *got_frame = 1;\n\n return avpkt->size;\n}","target":"static int decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame, AVPacket *avpkt)\n{\n EXRContext *s = avctx->priv_data;\n ThreadFrame frame = { .f = data };\n AVFrame *picture = data;\n uint8_t *ptr;\n\n int i, y, ret, ymax;\n int planes;\n int out_line_size;\n int nb_blocks; /* nb scanline or nb tile */\n uint64_t start_offset_table;\n uint64_t start_next_scanline;\n PutByteContext offset_table_writer;\n\n bytestream2_init(&s->gb, avpkt->data, avpkt->size);\n\n if ((ret = decode_header(s, picture)) < 0)\n return ret;\n\n switch (s->pixel_type) {\n case EXR_FLOAT:\n case EXR_HALF:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n } else {\n /* todo: change this when a floating point pixel format with luma with alpha is implemented */\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRPF32;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAYF32;\n }\n }\n break;\n case EXR_UINT:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGBA64;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_YA16;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGB48;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAY16;\n }\n }\n break;\n default:\n av_log(avctx, AV_LOG_ERROR, \"Missing channel list.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if (s->apply_trc_type != AVCOL_TRC_UNSPECIFIED)\n avctx->color_trc = s->apply_trc_type;\n\n switch (s->compression) {\n case EXR_RAW:\n case EXR_RLE:\n case EXR_ZIP1:\n s->scan_lines_per_block = 1;\n break;\n case EXR_PXR24:\n case EXR_ZIP16:\n s->scan_lines_per_block = 16;\n break;\n case EXR_PIZ:\n case EXR_B44:\n case EXR_B44A:\n s->scan_lines_per_block = 32;\n break;\n default:\n avpriv_report_missing_feature(avctx, \"Compression %d\", s->compression);\n return AVERROR_PATCHWELCOME;\n }\n\n /* Verify the xmin, xmax, ymin and ymax before setting the actual image size.\n * It's possible for the data window can larger or outside the display window */\n if (s->xmin > s->xmax || s->ymin > s->ymax ||\n s->ydelta == 0xFFFFFFFF || s->xdelta == 0xFFFFFFFF) {\n av_log(avctx, AV_LOG_ERROR, \"Wrong or missing size information.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if ((ret = ff_set_dimensions(avctx, s->w, s->h)) < 0)\n return ret;\n\n s->desc = av_pix_fmt_desc_get(avctx->pix_fmt);\n if (!s->desc)\n return AVERROR_INVALIDDATA;\n\n if (s->desc->flags & AV_PIX_FMT_FLAG_FLOAT) {\n planes = s->desc->nb_components;\n out_line_size = avctx->width * 4;\n } else {\n planes = 1;\n out_line_size = avctx->width * 2 * s->desc->nb_components;\n }\n\n if (s->is_tile) {\n nb_blocks = ((s->xdelta + s->tile_attr.xSize - 1) / s->tile_attr.xSize) *\n ((s->ydelta + s->tile_attr.ySize - 1) / s->tile_attr.ySize);\n } else { /* scanline */\n nb_blocks = (s->ydelta + s->scan_lines_per_block - 1) /\n s->scan_lines_per_block;\n }\n\n if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)\n return ret;\n\n if (bytestream2_get_bytes_left(&s->gb)/8 < nb_blocks)\n return AVERROR_INVALIDDATA;\n\n // check offset table and recreate it if need\n if (!s->is_tile && bytestream2_peek_le64(&s->gb) == 0) {\n av_log(s->avctx, AV_LOG_DEBUG, \"recreating invalid scanline offset table\\n\");\n\n start_offset_table = bytestream2_tell(&s->gb);\n start_next_scanline = start_offset_table + nb_blocks * 8;\n bytestream2_init_writer(&offset_table_writer, &avpkt->data[start_offset_table], nb_blocks * 8);\n\n for (y = 0; y < nb_blocks; y++) {\n /* write offset of prev scanline in offset table */\n bytestream2_put_le64(&offset_table_writer, start_next_scanline);\n\n /* get len of next scanline */\n bytestream2_seek(&s->gb, start_next_scanline + 4, SEEK_SET);/* skip line number */\n start_next_scanline += (bytestream2_get_le32(&s->gb) + 8);\n }\n bytestream2_seek(&s->gb, start_offset_table, SEEK_SET);\n }\n\n // save pointer we are going to use in decode_block\n s->buf = avpkt->data;\n s->buf_size = avpkt->size;\n\n // Zero out the start if ymin is not 0\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i];\n for (y = 0; y < FFMIN(s->ymin, s->h); y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n s->picture = picture;\n\n avctx->execute2(avctx, decode_block, s->thread_data, NULL, nb_blocks);\n\n ymax = FFMAX(0, s->ymax + 1);\n // Zero out the end if ymax+1 is not h\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i] + (ymax * picture->linesize[i]);\n for (y = ymax; y < avctx->height; y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n picture->pict_type = AV_PICTURE_TYPE_I;\n *got_frame = 1;\n\n return avpkt->size;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1577,"sven_meta":{"func_name":"decode_frame","file_name":"libavcodec/exr.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/3e5959b3457f7f1856d997261e6ac672bba49e8b","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#40-c9bf2469a925","input":"static void add_password(AUTH_HDR *request, unsigned char type, CONST char *password, char *secret)\n{\n\tMD5_CTX md5_secret, my_md5;\n\tunsigned char misc[AUTH_VECTOR_LEN];\n\tint i;\n\tint length = strlen(password);\n\tunsigned char hashed[256 + AUTH_PASS_LEN];\t/* can't be longer than this */\n\tunsigned char *vector;\n\tattribute_t *attr;\n\n\tif (length > MAXPASS) {\t\t\t\t/* shorten the password for now */\n\t\tlength = MAXPASS;\n\t}\n\n\tif (length == 0) {\n\t\tlength = AUTH_PASS_LEN;\t\t\t/* 0 maps to 16 */\n\t} if ((length & (AUTH_PASS_LEN - 1)) != 0) {\n\t\tlength += (AUTH_PASS_LEN - 1);\t\t/* round it up */\n\t\tlength &= ~(AUTH_PASS_LEN - 1);\t\t/* chop it off */\n\t}\t\t\t\t\t\t/* 16*N maps to itself */\n\n\tmemset(hashed, 0, length);\n\tmemcpy(hashed, password, strlen(password));\n\n\tattr = find_attribute(request, PW_PASSWORD);\n\n\tif (type == PW_PASSWORD) {\n\t\tvector = request->vector;\n\t} else {\n\t\tvector = attr->data;\t\t\t/* attr CANNOT be NULL here. */\n\t}\n\n\t/* ************************************************************ */\n\t/* encrypt the password */\n\t/* password : e[0] = p[0] ^ MD5(secret + vector) */\n\tMD5Init(&md5_secret);\n\tMD5Update(&md5_secret, (unsigned char *) secret, strlen(secret));\n\tmy_md5 = md5_secret;\t\t\t\t/* so we won't re-do the hash later */\n\tMD5Update(&my_md5, vector, AUTH_VECTOR_LEN);\n\tMD5Final(misc, &my_md5);\t\t\t/* set the final vector */\n\txor(hashed, misc, AUTH_PASS_LEN);\n\n\t/* For each step through, e[i] = p[i] ^ MD5(secret + e[i-1]) */\n\tfor (i = 1; i < (length >> 4); i++) {\n\t\tmy_md5 = md5_secret;\t\t\t/* grab old value of the hash */\n\t\tMD5Update(&my_md5, &hashed[(i-1) * AUTH_PASS_LEN], AUTH_PASS_LEN);\n\t\tMD5Final(misc, &my_md5);\t\t\t/* set the final vector */\n\t\txor(&hashed[i * AUTH_PASS_LEN], misc, AUTH_PASS_LEN);\n\t}\n\n\tif (type == PW_OLD_PASSWORD) {\n\t\tattr = find_attribute(request, PW_OLD_PASSWORD);\n\t}\n\n\tif (!attr) {\n\t\tadd_attribute(request, type, hashed, length);\n\t} else {\n\t\tmemcpy(attr->data, hashed, length); /* overwrite the packet */\n\t}\n}","target":"static void add_password(AUTH_HDR *request, unsigned char type, CONST char *password, char *secret)\n{\n\tMD5_CTX md5_secret, my_md5;\n\tunsigned char misc[AUTH_VECTOR_LEN];\n\tint i;\n\tint length = strlen(password);\n\tunsigned char hashed[256 + AUTH_PASS_LEN];\t/* can't be longer than this */\n\tunsigned char *vector;\n\tattribute_t *attr;\n\n\tif (length > MAXPASS) {\t\t\t\t/* shorten the password for now */\n\t\tlength = MAXPASS;\n\t}\n\n\tif (length == 0) {\n\t\tlength = AUTH_PASS_LEN;\t\t\t/* 0 maps to 16 */\n\t} if ((length & (AUTH_PASS_LEN - 1)) != 0) {\n\t\tlength += (AUTH_PASS_LEN - 1);\t\t/* round it up */\n\t\tlength &= ~(AUTH_PASS_LEN - 1);\t\t/* chop it off */\n\t}\t\t\t\t\t\t/* 16*N maps to itself */\n\n\tmemset(hashed, 0, length);\n\tmemcpy(hashed, password, length);\n\n\tattr = find_attribute(request, PW_PASSWORD);\n\n\tif (type == PW_PASSWORD) {\n\t\tvector = request->vector;\n\t} else {\n\t\tvector = attr->data;\t\t\t/* attr CANNOT be NULL here. */\n\t}\n\n\t/* ************************************************************ */\n\t/* encrypt the password */\n\t/* password : e[0] = p[0] ^ MD5(secret + vector) */\n\tMD5Init(&md5_secret);\n\tMD5Update(&md5_secret, (unsigned char *) secret, strlen(secret));\n\tmy_md5 = md5_secret;\t\t\t\t/* so we won't re-do the hash later */\n\tMD5Update(&my_md5, vector, AUTH_VECTOR_LEN);\n\tMD5Final(misc, &my_md5);\t\t\t/* set the final vector */\n\txor(hashed, misc, AUTH_PASS_LEN);\n\n\t/* For each step through, e[i] = p[i] ^ MD5(secret + e[i-1]) */\n\tfor (i = 1; i < (length >> 4); i++) {\n\t\tmy_md5 = md5_secret;\t\t\t/* grab old value of the hash */\n\t\tMD5Update(&my_md5, &hashed[(i-1) * AUTH_PASS_LEN], AUTH_PASS_LEN);\n\t\tMD5Final(misc, &my_md5);\t\t\t/* set the final vector */\n\t\txor(&hashed[i * AUTH_PASS_LEN], misc, AUTH_PASS_LEN);\n\t}\n\n\tif (type == PW_OLD_PASSWORD) {\n\t\tattr = find_attribute(request, PW_OLD_PASSWORD);\n\t}\n\n\tif (!attr) {\n\t\tadd_attribute(request, type, hashed, length);\n\t} else {\n\t\tmemcpy(attr->data, hashed, length); /* overwrite the packet */\n\t}\n}","lang":"c","vul_type":"cwe-787","target_token_count":576,"sven_meta":{"func_name":"add_password","file_name":"src/pam_radius_auth.c","commit_link":"github.com/FreeRADIUS/pam_radius/commit/01173ec2426627dbb1e0d96c06c3ffa0b14d36d0","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#41-63d2fc7811e0","input":"unicode_unfold_key(OnigCodePoint code)\n{\n static const struct ByUnfoldKey wordlist[] =\n {\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0x1040a, 3267, 1},\n\n {0x1e0a, 1727, 1},\n\n {0x040a, 1016, 1},\n\n {0x010a, 186, 1},\n\n {0x1f0a, 2088, 1},\n\n {0x2c0a, 2451, 1},\n\n {0x0189, 619, 1},\n\n {0x1f89, 134, 2},\n\n {0x1f85, 154, 2},\n\n {0x0389, 733, 1},\n\n {0x03ff, 724, 1},\n\n {0xab89, 1523, 1},\n\n {0xab85, 1511, 1},\n\n {0x10c89, 3384, 1},\n\n {0x10c85, 3372, 1},\n\n {0x1e84, 1911, 1},\n\n {0x03f5, 752, 1},\n\n {0x0184, 360, 1},\n\n {0x1f84, 149, 2},\n\n {0x2c84, 2592, 1},\n\n {0x017d, 351, 1},\n\n {0x1ff3, 96, 2},\n\n {0xab84, 1508, 1},\n\n {0xa784, 3105, 1},\n\n {0x10c84, 3369, 1},\n\n {0xab7d, 1487, 1},\n\n {0xa77d, 1706, 1},\n\n {0x1e98, 38, 2},\n\n {0x0498, 1106, 1},\n\n {0x0198, 375, 1},\n\n {0x1f98, 169, 2},\n\n {0x2c98, 2622, 1},\n\n {0x0398, 762, 1},\n\n {0xa684, 2940, 1},\n\n {0xab98, 1568, 1},\n\n {0xa798, 3123, 1},\n\n {0x10c98, 3429, 1},\n\n {0x050a, 1277, 1},\n\n {0x1ffb, 2265, 1},\n\n {0x1e96, 16, 2},\n\n {0x0496, 1103, 1},\n\n {0x0196, 652, 1},\n\n {0x1f96, 199, 2},\n\n {0x2c96, 2619, 1},\n\n {0x0396, 756, 1},\n\n {0xa698, 2970, 1},\n\n {0xab96, 1562, 1},\n\n {0xa796, 3120, 1},\n\n {0x10c96, 3423, 1},\n\n {0x1feb, 2259, 1},\n\n {0x2ceb, 2736, 1},\n\n {0x1e90, 1929, 1},\n\n {0x0490, 1094, 1},\n\n {0x0190, 628, 1},\n\n {0x1f90, 169, 2},\n\n {0x2c90, 2610, 1},\n\n {0x0390, 25, 3},\n\n {0xa696, 2967, 1},\n\n {0xab90, 1544, 1},\n\n {0xa790, 3114, 1},\n\n {0x10c90, 3405, 1},\n\n {0x01d7, 444, 1},\n\n {0x1fd7, 31, 3},\n\n {0x1ea6, 1947, 1},\n\n {0x04a6, 1127, 1},\n\n {0x01a6, 676, 1},\n\n {0x1fa6, 239, 2},\n\n {0x2ca6, 2643, 1},\n\n {0x03a6, 810, 1},\n\n {0xa690, 2958, 1},\n\n {0xaba6, 1610, 1},\n\n {0xa7a6, 3144, 1},\n\n {0x10ca6, 3471, 1},\n\n {0x1ea4, 1944, 1},\n\n {0x04a4, 1124, 1},\n\n {0x01a4, 390, 1},\n\n {0x1fa4, 229, 2},\n\n {0x2ca4, 2640, 1},\n\n {0x03a4, 804, 1},\n\n {0x10a6, 2763, 1},\n\n {0xaba4, 1604, 1},\n\n {0xa7a4, 3141, 1},\n\n {0x10ca4, 3465, 1},\n\n {0x1ea0, 1938, 1},\n\n {0x04a0, 1118, 1},\n\n {0x01a0, 384, 1},\n\n {0x1fa0, 209, 2},\n\n {0x2ca0, 2634, 1},\n\n {0x03a0, 792, 1},\n\n {0x10a4, 2757, 1},\n\n {0xaba0, 1592, 1},\n\n {0xa7a0, 3135, 1},\n\n {0x10ca0, 3453, 1},\n\n {0x1eb2, 1965, 1},\n\n {0x04b2, 1145, 1},\n\n {0x01b2, 694, 1},\n\n {0x1fb2, 249, 2},\n\n {0x2cb2, 2661, 1},\n\n {0x03fd, 718, 1},\n\n {0x10a0, 2745, 1},\n\n {0xabb2, 1646, 1},\n\n {0xa7b2, 703, 1},\n\n {0x10cb2, 3507, 1},\n\n {0x1eac, 1956, 1},\n\n {0x04ac, 1136, 1},\n\n {0x01ac, 396, 1},\n\n {0x1fac, 229, 2},\n\n {0x2cac, 2652, 1},\n\n {0x0537, 1352, 1},\n\n {0x10b2, 2799, 1},\n\n {0xabac, 1628, 1},\n\n {0xa7ac, 637, 1},\n\n {0x10cac, 3489, 1},\n\n {0x1eaa, 1953, 1},\n\n {0x04aa, 1133, 1},\n\n {0x00dd, 162, 1},\n\n {0x1faa, 219, 2},\n\n {0x2caa, 2649, 1},\n\n {0x03aa, 824, 1},\n\n {0x10ac, 2781, 1},\n\n {0xabaa, 1622, 1},\n\n {0xa7aa, 646, 1},\n\n {0x10caa, 3483, 1},\n\n {0x1ea8, 1950, 1},\n\n {0x04a8, 1130, 1},\n\n {0x020a, 517, 1},\n\n {0x1fa8, 209, 2},\n\n {0x2ca8, 2646, 1},\n\n {0x03a8, 817, 1},\n\n {0x10aa, 2775, 1},\n\n {0xaba8, 1616, 1},\n\n {0xa7a8, 3147, 1},\n\n {0x10ca8, 3477, 1},\n\n {0x1ea2, 1941, 1},\n\n {0x04a2, 1121, 1},\n\n {0x01a2, 387, 1},\n\n {0x1fa2, 219, 2},\n\n {0x2ca2, 2637, 1},\n\n {0x118a6, 3528, 1},\n\n {0x10a8, 2769, 1},\n\n {0xaba2, 1598, 1},\n\n {0xa7a2, 3138, 1},\n\n {0x10ca2, 3459, 1},\n\n {0x2ced, 2739, 1},\n\n {0x1fe9, 2283, 1},\n\n {0x1fe7, 47, 3},\n\n {0x1eb0, 1962, 1},\n\n {0x04b0, 1142, 1},\n\n {0x118a4, 3522, 1},\n\n {0x10a2, 2751, 1},\n\n {0x2cb0, 2658, 1},\n\n {0x03b0, 41, 3},\n\n {0x1fe3, 41, 3},\n\n {0xabb0, 1640, 1},\n\n {0xa7b0, 706, 1},\n\n {0x10cb0, 3501, 1},\n\n {0x01d9, 447, 1},\n\n {0x1fd9, 2277, 1},\n\n {0x118a0, 3510, 1},\n\n {0x00df, 24, 2},\n\n {0x00d9, 150, 1},\n\n {0xab77, 1469, 1},\n\n {0x10b0, 2793, 1},\n\n {0x1eae, 1959, 1},\n\n {0x04ae, 1139, 1},\n\n {0x01ae, 685, 1},\n\n {0x1fae, 239, 2},\n\n {0x2cae, 2655, 1},\n\n {0x118b2, 3564, 1},\n\n {0xab73, 1457, 1},\n\n {0xabae, 1634, 1},\n\n {0xab71, 1451, 1},\n\n {0x10cae, 3495, 1},\n\n {0x1e2a, 1775, 1},\n\n {0x042a, 968, 1},\n\n {0x012a, 234, 1},\n\n {0x1f2a, 2130, 1},\n\n {0x2c2a, 2547, 1},\n\n {0x118ac, 3546, 1},\n\n {0x10ae, 2787, 1},\n\n {0x0535, 1346, 1},\n\n {0xa72a, 2988, 1},\n\n {0x1e9a, 0, 2},\n\n {0x049a, 1109, 1},\n\n {0xff37, 3225, 1},\n\n {0x1f9a, 179, 2},\n\n {0x2c9a, 2625, 1},\n\n {0x039a, 772, 1},\n\n {0x118aa, 3540, 1},\n\n {0xab9a, 1574, 1},\n\n {0xa79a, 3126, 1},\n\n {0x10c9a, 3435, 1},\n\n {0x1e94, 1935, 1},\n\n {0x0494, 1100, 1},\n\n {0x0194, 640, 1},\n\n {0x1f94, 189, 2},\n\n {0x2c94, 2616, 1},\n\n {0x0394, 749, 1},\n\n {0x118a8, 3534, 1},\n\n {0xab94, 1556, 1},\n\n {0xa69a, 2973, 1},\n\n {0x10c94, 3417, 1},\n\n {0x10402, 3243, 1},\n\n {0x1e02, 1715, 1},\n\n {0x0402, 992, 1},\n\n {0x0102, 174, 1},\n\n {0x0533, 1340, 1},\n\n {0x2c02, 2427, 1},\n\n {0x118a2, 3516, 1},\n\n {0x052a, 1325, 1},\n\n {0xa694, 2964, 1},\n\n {0x1e92, 1932, 1},\n\n {0x0492, 1097, 1},\n\n {0x2165, 2307, 1},\n\n {0x1f92, 179, 2},\n\n {0x2c92, 2613, 1},\n\n {0x0392, 742, 1},\n\n {0x2161, 2295, 1},\n\n {0xab92, 1550, 1},\n\n {0xa792, 3117, 1},\n\n {0x10c92, 3411, 1},\n\n {0x118b0, 3558, 1},\n\n {0x1f5f, 2199, 1},\n\n {0x1e8e, 1926, 1},\n\n {0x048e, 1091, 1},\n\n {0x018e, 453, 1},\n\n {0x1f8e, 159, 2},\n\n {0x2c8e, 2607, 1},\n\n {0x038e, 833, 1},\n\n {0xa692, 2961, 1},\n\n {0xab8e, 1538, 1},\n\n {0x0055, 59, 1},\n\n {0x10c8e, 3399, 1},\n\n {0x1f5d, 2196, 1},\n\n {0x212a, 27, 1},\n\n {0x04cb, 1181, 1},\n\n {0x01cb, 425, 1},\n\n {0x1fcb, 2241, 1},\n\n {0x118ae, 3552, 1},\n\n {0x0502, 1265, 1},\n\n {0x00cb, 111, 1},\n\n {0xa68e, 2955, 1},\n\n {0x1e8a, 1920, 1},\n\n {0x048a, 1085, 1},\n\n {0x018a, 622, 1},\n\n {0x1f8a, 139, 2},\n\n {0x2c8a, 2601, 1},\n\n {0x038a, 736, 1},\n\n {0x2c67, 2571, 1},\n\n {0xab8a, 1526, 1},\n\n {0x1e86, 1914, 1},\n\n {0x10c8a, 3387, 1},\n\n {0x0186, 616, 1},\n\n {0x1f86, 159, 2},\n\n {0x2c86, 2595, 1},\n\n {0x0386, 727, 1},\n\n {0xff35, 3219, 1},\n\n {0xab86, 1514, 1},\n\n {0xa786, 3108, 1},\n\n {0x10c86, 3375, 1},\n\n {0xa68a, 2949, 1},\n\n {0x0555, 1442, 1},\n\n {0x1ebc, 1980, 1},\n\n {0x04bc, 1160, 1},\n\n {0x01bc, 411, 1},\n\n {0x1fbc, 62, 2},\n\n {0x2cbc, 2676, 1},\n\n {0x1f5b, 2193, 1},\n\n {0xa686, 2943, 1},\n\n {0xabbc, 1676, 1},\n\n {0x1eb8, 1974, 1},\n\n {0x04b8, 1154, 1},\n\n {0x01b8, 408, 1},\n\n {0x1fb8, 2268, 1},\n\n {0x2cb8, 2670, 1},\n\n {0x01db, 450, 1},\n\n {0x1fdb, 2247, 1},\n\n {0xabb8, 1664, 1},\n\n {0x10bc, 2829, 1},\n\n {0x00db, 156, 1},\n\n {0x1eb6, 1971, 1},\n\n {0x04b6, 1151, 1},\n\n {0xff33, 3213, 1},\n\n {0x1fb6, 58, 2},\n\n {0x2cb6, 2667, 1},\n\n {0xff2a, 3186, 1},\n\n {0x10b8, 2817, 1},\n\n {0xabb6, 1658, 1},\n\n {0xa7b6, 3153, 1},\n\n {0x10426, 3351, 1},\n\n {0x1e26, 1769, 1},\n\n {0x0426, 956, 1},\n\n {0x0126, 228, 1},\n\n {0x0053, 52, 1},\n\n {0x2c26, 2535, 1},\n\n {0x0057, 65, 1},\n\n {0x10b6, 2811, 1},\n\n {0x022a, 562, 1},\n\n {0xa726, 2982, 1},\n\n {0x1e2e, 1781, 1},\n\n {0x042e, 980, 1},\n\n {0x012e, 240, 1},\n\n {0x1f2e, 2142, 1},\n\n {0x2c2e, 2559, 1},\n {0xffffffff, -1, 0},\n\n {0x2167, 2313, 1},\n {0xffffffff, -1, 0},\n\n {0xa72e, 2994, 1},\n\n {0x1e2c, 1778, 1},\n\n {0x042c, 974, 1},\n\n {0x012c, 237, 1},\n\n {0x1f2c, 2136, 1},\n\n {0x2c2c, 2553, 1},\n\n {0x1f6f, 2223, 1},\n\n {0x2c6f, 604, 1},\n\n {0xabbf, 1685, 1},\n\n {0xa72c, 2991, 1},\n\n {0x1e28, 1772, 1},\n\n {0x0428, 962, 1},\n\n {0x0128, 231, 1},\n\n {0x1f28, 2124, 1},\n\n {0x2c28, 2541, 1},\n {0xffffffff, -1, 0},\n\n {0x0553, 1436, 1},\n\n {0x10bf, 2838, 1},\n\n {0xa728, 2985, 1},\n\n {0x0526, 1319, 1},\n\n {0x0202, 505, 1},\n\n {0x1e40, 1808, 1},\n\n {0x10424, 3345, 1},\n\n {0x1e24, 1766, 1},\n\n {0x0424, 950, 1},\n\n {0x0124, 225, 1},\n {0xffffffff, -1, 0},\n\n {0x2c24, 2529, 1},\n\n {0x052e, 1331, 1},\n\n {0xa740, 3018, 1},\n\n {0x118bc, 3594, 1},\n\n {0xa724, 2979, 1},\n\n {0x1ef2, 2061, 1},\n\n {0x04f2, 1241, 1},\n\n {0x01f2, 483, 1},\n\n {0x1ff2, 257, 2},\n\n {0x2cf2, 2742, 1},\n\n {0x052c, 1328, 1},\n\n {0x118b8, 3582, 1},\n\n {0xa640, 2865, 1},\n\n {0x10422, 3339, 1},\n\n {0x1e22, 1763, 1},\n\n {0x0422, 944, 1},\n\n {0x0122, 222, 1},\n\n {0x2126, 820, 1},\n\n {0x2c22, 2523, 1},\n\n {0x0528, 1322, 1},\n\n {0x01f1, 483, 1},\n\n {0x118b6, 3576, 1},\n\n {0xa722, 2976, 1},\n\n {0x03f1, 796, 1},\n\n {0x1ebe, 1983, 1},\n\n {0x04be, 1163, 1},\n\n {0xfb02, 12, 2},\n\n {0x1fbe, 767, 1},\n\n {0x2cbe, 2679, 1},\n\n {0x01b5, 405, 1},\n\n {0x0540, 1379, 1},\n\n {0xabbe, 1682, 1},\n\n {0x0524, 1316, 1},\n\n {0x00b5, 779, 1},\n\n {0xabb5, 1655, 1},\n\n {0x1eba, 1977, 1},\n\n {0x04ba, 1157, 1},\n\n {0x216f, 2337, 1},\n\n {0x1fba, 2226, 1},\n\n {0x2cba, 2673, 1},\n\n {0x10be, 2835, 1},\n\n {0x0051, 46, 1},\n\n {0xabba, 1670, 1},\n\n {0x10b5, 2808, 1},\n\n {0x1e6e, 1878, 1},\n\n {0x046e, 1055, 1},\n\n {0x016e, 330, 1},\n\n {0x1f6e, 2220, 1},\n\n {0x2c6e, 664, 1},\n\n {0x118bf, 3603, 1},\n\n {0x0522, 1313, 1},\n\n {0x10ba, 2823, 1},\n\n {0xa76e, 3087, 1},\n\n {0x1eb4, 1968, 1},\n\n {0x04b4, 1148, 1},\n\n {0x2c75, 2583, 1},\n\n {0x1fb4, 50, 2},\n\n {0x2cb4, 2664, 1},\n\n {0xab75, 1463, 1},\n\n {0x1ec2, 1989, 1},\n\n {0xabb4, 1652, 1},\n\n {0xa7b4, 3150, 1},\n\n {0x1fc2, 253, 2},\n\n {0x2cc2, 2685, 1},\n\n {0x03c2, 800, 1},\n\n {0x00c2, 83, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff26, 3174, 1},\n\n {0x10b4, 2805, 1},\n\n {0x1eca, 2001, 1},\n\n {0x0551, 1430, 1},\n\n {0x01ca, 425, 1},\n\n {0x1fca, 2238, 1},\n\n {0x2cca, 2697, 1},\n\n {0x10c2, 2847, 1},\n\n {0x00ca, 108, 1},\n\n {0xff2e, 3198, 1},\n\n {0x1e8c, 1923, 1},\n\n {0x048c, 1088, 1},\n\n {0x0226, 556, 1},\n\n {0x1f8c, 149, 2},\n\n {0x2c8c, 2604, 1},\n\n {0x038c, 830, 1},\n {0xffffffff, -1, 0},\n\n {0xab8c, 1532, 1},\n\n {0xff2c, 3192, 1},\n\n {0x10c8c, 3393, 1},\n\n {0x1ec4, 1992, 1},\n\n {0x022e, 568, 1},\n\n {0x01c4, 417, 1},\n\n {0x1fc4, 54, 2},\n\n {0x2cc4, 2688, 1},\n {0xffffffff, -1, 0},\n\n {0x00c4, 89, 1},\n\n {0xff28, 3180, 1},\n\n {0xa68c, 2952, 1},\n\n {0x01cf, 432, 1},\n\n {0x022c, 565, 1},\n\n {0x118be, 3600, 1},\n\n {0x03cf, 839, 1},\n\n {0x00cf, 123, 1},\n\n {0x118b5, 3573, 1},\n {0xffffffff, -1, 0},\n\n {0x10c4, 2853, 1},\n\n {0x216e, 2334, 1},\n\n {0x24cb, 2406, 1},\n\n {0x0228, 559, 1},\n\n {0xff24, 3168, 1},\n {0xffffffff, -1, 0},\n\n {0x118ba, 3588, 1},\n\n {0x1efe, 2079, 1},\n\n {0x04fe, 1259, 1},\n\n {0x01fe, 499, 1},\n\n {0x1e9e, 24, 2},\n\n {0x049e, 1115, 1},\n\n {0x03fe, 721, 1},\n\n {0x1f9e, 199, 2},\n\n {0x2c9e, 2631, 1},\n\n {0x039e, 786, 1},\n\n {0x0224, 553, 1},\n\n {0xab9e, 1586, 1},\n\n {0xa79e, 3132, 1},\n\n {0x10c9e, 3447, 1},\n\n {0x01f7, 414, 1},\n\n {0x1ff7, 67, 3},\n\n {0xff22, 3162, 1},\n\n {0x03f7, 884, 1},\n\n {0x118b4, 3570, 1},\n\n {0x049c, 1112, 1},\n\n {0x019c, 661, 1},\n\n {0x1f9c, 189, 2},\n\n {0x2c9c, 2628, 1},\n\n {0x039c, 779, 1},\n\n {0x24bc, 2361, 1},\n\n {0xab9c, 1580, 1},\n\n {0xa79c, 3129, 1},\n\n {0x10c9c, 3441, 1},\n\n {0x0222, 550, 1},\n\n {0x1e7c, 1899, 1},\n\n {0x047c, 1076, 1},\n\n {0x1e82, 1908, 1},\n\n {0x24b8, 2349, 1},\n\n {0x0182, 357, 1},\n\n {0x1f82, 139, 2},\n\n {0x2c82, 2589, 1},\n\n {0xab7c, 1484, 1},\n {0xffffffff, -1, 0},\n\n {0xab82, 1502, 1},\n\n {0xa782, 3102, 1},\n\n {0x10c82, 3363, 1},\n\n {0x2c63, 1709, 1},\n\n {0x24b6, 2343, 1},\n\n {0x1e80, 1905, 1},\n\n {0x0480, 1082, 1},\n\n {0x1f59, 2190, 1},\n\n {0x1f80, 129, 2},\n\n {0x2c80, 2586, 1},\n\n {0x0059, 71, 1},\n\n {0xa682, 2937, 1},\n\n {0xab80, 1496, 1},\n\n {0xa780, 3099, 1},\n\n {0x10c80, 3357, 1},\n {0xffffffff, -1, 0},\n\n {0x1e4c, 1826, 1},\n\n {0x0145, 270, 1},\n\n {0x014c, 279, 1},\n\n {0x1f4c, 2184, 1},\n\n {0x0345, 767, 1},\n\n {0x0045, 12, 1},\n\n {0x004c, 31, 1},\n\n {0xa680, 2934, 1},\n\n {0xa74c, 3036, 1},\n\n {0x1e4a, 1823, 1},\n\n {0x01d5, 441, 1},\n\n {0x014a, 276, 1},\n\n {0x1f4a, 2178, 1},\n\n {0x03d5, 810, 1},\n\n {0x00d5, 141, 1},\n\n {0x004a, 24, 1},\n\n {0x24bf, 2370, 1},\n\n {0xa74a, 3033, 1},\n\n {0xa64c, 2883, 1},\n\n {0x1041c, 3321, 1},\n\n {0x1e1c, 1754, 1},\n\n {0x041c, 926, 1},\n\n {0x011c, 213, 1},\n\n {0x1f1c, 2118, 1},\n\n {0x2c1c, 2505, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xa64a, 2880, 1},\n\n {0x1041a, 3315, 1},\n\n {0x1e1a, 1751, 1},\n\n {0x041a, 920, 1},\n\n {0x011a, 210, 1},\n\n {0x1f1a, 2112, 1},\n\n {0x2c1a, 2499, 1},\n\n {0xabbd, 1679, 1},\n\n {0x0545, 1394, 1},\n\n {0x054c, 1415, 1},\n\n {0x10418, 3309, 1},\n\n {0x1e18, 1748, 1},\n\n {0x0418, 914, 1},\n\n {0x0118, 207, 1},\n\n {0x1f18, 2106, 1},\n\n {0x2c18, 2493, 1},\n\n {0x10bd, 2832, 1},\n\n {0x2163, 2301, 1},\n\n {0x054a, 1409, 1},\n\n {0x1040e, 3279, 1},\n\n {0x1e0e, 1733, 1},\n\n {0x040e, 1028, 1},\n\n {0x010e, 192, 1},\n\n {0x1f0e, 2100, 1},\n\n {0x2c0e, 2463, 1},\n\n {0x1efc, 2076, 1},\n\n {0x04fc, 1256, 1},\n\n {0x01fc, 496, 1},\n\n {0x1ffc, 96, 2},\n\n {0x051c, 1304, 1},\n\n {0x1040c, 3273, 1},\n\n {0x1e0c, 1730, 1},\n\n {0x040c, 1022, 1},\n\n {0x010c, 189, 1},\n\n {0x1f0c, 2094, 1},\n\n {0x2c0c, 2457, 1},\n\n {0x1f6d, 2217, 1},\n\n {0x2c6d, 607, 1},\n\n {0x051a, 1301, 1},\n\n {0x24be, 2367, 1},\n\n {0x10408, 3261, 1},\n\n {0x1e08, 1724, 1},\n\n {0x0408, 1010, 1},\n\n {0x0108, 183, 1},\n\n {0x1f08, 2082, 1},\n\n {0x2c08, 2445, 1},\n\n {0x04c9, 1178, 1},\n\n {0x0518, 1298, 1},\n\n {0x1fc9, 2235, 1},\n {0xffffffff, -1, 0},\n\n {0x24ba, 2355, 1},\n\n {0x00c9, 105, 1},\n\n {0x10416, 3303, 1},\n\n {0x1e16, 1745, 1},\n\n {0x0416, 908, 1},\n\n {0x0116, 204, 1},\n\n {0x050e, 1283, 1},\n\n {0x2c16, 2487, 1},\n\n {0x10414, 3297, 1},\n\n {0x1e14, 1742, 1},\n\n {0x0414, 902, 1},\n\n {0x0114, 201, 1},\n\n {0x042b, 971, 1},\n\n {0x2c14, 2481, 1},\n\n {0x1f2b, 2133, 1},\n\n {0x2c2b, 2550, 1},\n {0xffffffff, -1, 0},\n\n {0x050c, 1280, 1},\n\n {0x10406, 3255, 1},\n\n {0x1e06, 1721, 1},\n\n {0x0406, 1004, 1},\n\n {0x0106, 180, 1},\n\n {0x13fb, 1697, 1},\n\n {0x2c06, 2439, 1},\n\n {0x24c2, 2379, 1},\n\n {0x118bd, 3597, 1},\n {0xffffffff, -1, 0},\n\n {0x0508, 1274, 1},\n\n {0x10404, 3249, 1},\n\n {0x1e04, 1718, 1},\n\n {0x0404, 998, 1},\n\n {0x0104, 177, 1},\n\n {0x1f95, 194, 2},\n\n {0x2c04, 2433, 1},\n\n {0x0395, 752, 1},\n\n {0x24ca, 2403, 1},\n\n {0xab95, 1559, 1},\n\n {0x0531, 1334, 1},\n\n {0x10c95, 3420, 1},\n\n {0x0516, 1295, 1},\n\n {0x1e6c, 1875, 1},\n\n {0x046c, 1052, 1},\n\n {0x016c, 327, 1},\n\n {0x1f6c, 2214, 1},\n\n {0x216d, 2331, 1},\n\n {0x0514, 1292, 1},\n\n {0x0245, 697, 1},\n\n {0x024c, 598, 1},\n\n {0xa76c, 3084, 1},\n\n {0x10400, 3237, 1},\n\n {0x1e00, 1712, 1},\n\n {0x0400, 986, 1},\n\n {0x0100, 171, 1},\n\n {0x24c4, 2385, 1},\n\n {0x2c00, 2421, 1},\n\n {0x0506, 1271, 1},\n\n {0x024a, 595, 1},\n\n {0x1fab, 224, 2},\n\n {0xa66c, 2931, 1},\n\n {0x03ab, 827, 1},\n\n {0x24cf, 2418, 1},\n\n {0xabab, 1625, 1},\n\n {0xa7ab, 631, 1},\n\n {0x10cab, 3486, 1},\n {0xffffffff, -1, 0},\n\n {0x0504, 1268, 1},\n {0xffffffff, -1, 0},\n\n {0x021c, 544, 1},\n\n {0x01a9, 679, 1},\n\n {0x1fa9, 214, 2},\n\n {0x10ab, 2778, 1},\n\n {0x03a9, 820, 1},\n\n {0x212b, 92, 1},\n\n {0xaba9, 1619, 1},\n\n {0x1e88, 1917, 1},\n\n {0x10ca9, 3480, 1},\n\n {0x021a, 541, 1},\n\n {0x1f88, 129, 2},\n\n {0x2c88, 2598, 1},\n\n {0x0388, 730, 1},\n\n {0x13fd, 1703, 1},\n\n {0xab88, 1520, 1},\n\n {0x10a9, 2772, 1},\n\n {0x10c88, 3381, 1},\n {0xffffffff, -1, 0},\n\n {0x0218, 538, 1},\n\n {0x0500, 1262, 1},\n\n {0x1f4d, 2187, 1},\n\n {0x01a7, 393, 1},\n\n {0x1fa7, 244, 2},\n\n {0x004d, 34, 1},\n\n {0x03a7, 814, 1},\n\n {0xa688, 2946, 1},\n\n {0xaba7, 1613, 1},\n\n {0x020e, 523, 1},\n\n {0x10ca7, 3474, 1},\n\n {0x1e6a, 1872, 1},\n\n {0x046a, 1049, 1},\n\n {0x016a, 324, 1},\n\n {0x1f6a, 2208, 1},\n {0xffffffff, -1, 0},\n\n {0x216c, 2328, 1},\n\n {0x10a7, 2766, 1},\n\n {0x01d1, 435, 1},\n\n {0xa76a, 3081, 1},\n\n {0x020c, 520, 1},\n\n {0x03d1, 762, 1},\n\n {0x00d1, 129, 1},\n\n {0x1e68, 1869, 1},\n\n {0x0468, 1046, 1},\n\n {0x0168, 321, 1},\n\n {0x1f68, 2202, 1},\n {0xffffffff, -1, 0},\n\n {0xff31, 3207, 1},\n\n {0xa66a, 2928, 1},\n\n {0x0208, 514, 1},\n\n {0xa768, 3078, 1},\n\n {0x1e64, 1863, 1},\n\n {0x0464, 1040, 1},\n\n {0x0164, 315, 1},\n\n {0x054d, 1418, 1},\n\n {0x2c64, 673, 1},\n {0xffffffff, -1, 0},\n\n {0xff2b, 3189, 1},\n {0xffffffff, -1, 0},\n\n {0xa764, 3072, 1},\n\n {0xa668, 2925, 1},\n\n {0x0216, 535, 1},\n {0xffffffff, -1, 0},\n\n {0x118ab, 3543, 1},\n\n {0x1e62, 1860, 1},\n\n {0x0462, 1037, 1},\n\n {0x0162, 312, 1},\n\n {0x0214, 532, 1},\n\n {0x2c62, 655, 1},\n\n {0xa664, 2919, 1},\n\n {0x1ed2, 2013, 1},\n\n {0x04d2, 1193, 1},\n\n {0xa762, 3069, 1},\n\n {0x1fd2, 20, 3},\n\n {0x2cd2, 2709, 1},\n\n {0x118a9, 3537, 1},\n\n {0x00d2, 132, 1},\n\n {0x0206, 511, 1},\n\n {0x10420, 3333, 1},\n\n {0x1e20, 1760, 1},\n\n {0x0420, 938, 1},\n\n {0x0120, 219, 1},\n\n {0xa662, 2916, 1},\n\n {0x2c20, 2517, 1},\n\n {0x1e60, 1856, 1},\n\n {0x0460, 1034, 1},\n\n {0x0160, 309, 1},\n\n {0x0204, 508, 1},\n\n {0x2c60, 2562, 1},\n {0xffffffff, -1, 0},\n\n {0x24bd, 2364, 1},\n\n {0x216a, 2322, 1},\n\n {0xa760, 3066, 1},\n {0xffffffff, -1, 0},\n\n {0xfb16, 125, 2},\n\n {0x118a7, 3531, 1},\n\n {0x1efa, 2073, 1},\n\n {0x04fa, 1253, 1},\n\n {0x01fa, 493, 1},\n\n {0x1ffa, 2262, 1},\n\n {0xfb14, 109, 2},\n\n {0x03fa, 887, 1},\n\n {0xa660, 2913, 1},\n\n {0x2168, 2316, 1},\n\n {0x01b7, 700, 1},\n\n {0x1fb7, 10, 3},\n\n {0x1f6b, 2211, 1},\n\n {0x2c6b, 2577, 1},\n\n {0x0200, 502, 1},\n\n {0xabb7, 1661, 1},\n\n {0xfb06, 29, 2},\n\n {0x1e56, 1841, 1},\n\n {0x2164, 2304, 1},\n\n {0x0156, 294, 1},\n\n {0x1f56, 62, 3},\n\n {0x0520, 1310, 1},\n\n {0x004f, 40, 1},\n\n {0x0056, 62, 1},\n\n {0x10b7, 2814, 1},\n\n {0xa756, 3051, 1},\n\n {0xfb04, 5, 3},\n\n {0x1e78, 1893, 1},\n\n {0x0478, 1070, 1},\n\n {0x0178, 168, 1},\n\n {0x1e54, 1838, 1},\n\n {0x2162, 2298, 1},\n\n {0x0154, 291, 1},\n\n {0x1f54, 57, 3},\n\n {0xab78, 1472, 1},\n\n {0xa656, 2898, 1},\n\n {0x0054, 56, 1},\n\n {0x1e52, 1835, 1},\n\n {0xa754, 3048, 1},\n\n {0x0152, 288, 1},\n\n {0x1f52, 52, 3},\n\n {0x24c9, 2400, 1},\n\n {0x1e32, 1787, 1},\n\n {0x0052, 49, 1},\n\n {0x0132, 243, 1},\n\n {0xa752, 3045, 1},\n {0xffffffff, -1, 0},\n\n {0xfb00, 4, 2},\n\n {0xa654, 2895, 1},\n {0xffffffff, -1, 0},\n\n {0xa732, 2997, 1},\n\n {0x2160, 2292, 1},\n\n {0x054f, 1424, 1},\n\n {0x0556, 1445, 1},\n\n {0x1e50, 1832, 1},\n\n {0xa652, 2892, 1},\n\n {0x0150, 285, 1},\n\n {0x1f50, 84, 2},\n\n {0x017b, 348, 1},\n\n {0x1e4e, 1829, 1},\n\n {0x0050, 43, 1},\n\n {0x014e, 282, 1},\n\n {0xa750, 3042, 1},\n\n {0xab7b, 1481, 1},\n\n {0xa77b, 3093, 1},\n\n {0x004e, 37, 1},\n\n {0x0554, 1439, 1},\n\n {0xa74e, 3039, 1},\n\n {0x1e48, 1820, 1},\n {0xffffffff, -1, 0},\n\n {0x216b, 2325, 1},\n\n {0x1f48, 2172, 1},\n\n {0xa650, 2889, 1},\n\n {0x0552, 1433, 1},\n\n {0x0048, 21, 1},\n {0xffffffff, -1, 0},\n\n {0xa748, 3030, 1},\n\n {0xa64e, 2886, 1},\n\n {0x0532, 1337, 1},\n\n {0x1041e, 3327, 1},\n\n {0x1e1e, 1757, 1},\n\n {0x041e, 932, 1},\n\n {0x011e, 216, 1},\n\n {0x118b7, 3579, 1},\n\n {0x2c1e, 2511, 1},\n {0xffffffff, -1, 0},\n\n {0xa648, 2877, 1},\n\n {0x1ff9, 2253, 1},\n {0xffffffff, -1, 0},\n\n {0x03f9, 878, 1},\n\n {0x0550, 1427, 1},\n\n {0x10412, 3291, 1},\n\n {0x1e12, 1739, 1},\n\n {0x0412, 896, 1},\n\n {0x0112, 198, 1},\n\n {0x054e, 1421, 1},\n\n {0x2c12, 2475, 1},\n\n {0x10410, 3285, 1},\n\n {0x1e10, 1736, 1},\n\n {0x0410, 890, 1},\n\n {0x0110, 195, 1},\n {0xffffffff, -1, 0},\n\n {0x2c10, 2469, 1},\n\n {0x2132, 2289, 1},\n\n {0x0548, 1403, 1},\n\n {0x1ef8, 2070, 1},\n\n {0x04f8, 1250, 1},\n\n {0x01f8, 490, 1},\n\n {0x1ff8, 2250, 1},\n\n {0x0220, 381, 1},\n\n {0x1ee2, 2037, 1},\n\n {0x04e2, 1217, 1},\n\n {0x01e2, 462, 1},\n\n {0x1fe2, 36, 3},\n\n {0x2ce2, 2733, 1},\n\n {0x03e2, 857, 1},\n\n {0x051e, 1307, 1},\n\n {0x1ede, 2031, 1},\n\n {0x04de, 1211, 1},\n\n {0x01de, 456, 1},\n {0xffffffff, -1, 0},\n\n {0x2cde, 2727, 1},\n\n {0x03de, 851, 1},\n\n {0x00de, 165, 1},\n\n {0x1f69, 2205, 1},\n\n {0x2c69, 2574, 1},\n\n {0x1eda, 2025, 1},\n\n {0x04da, 1205, 1},\n\n {0x0512, 1289, 1},\n\n {0x1fda, 2244, 1},\n\n {0x2cda, 2721, 1},\n\n {0x03da, 845, 1},\n\n {0x00da, 153, 1},\n {0xffffffff, -1, 0},\n\n {0x0510, 1286, 1},\n\n {0x1ed8, 2022, 1},\n\n {0x04d8, 1202, 1},\n {0xffffffff, -1, 0},\n\n {0x1fd8, 2274, 1},\n\n {0x2cd8, 2718, 1},\n\n {0x03d8, 842, 1},\n\n {0x00d8, 147, 1},\n\n {0x1ed6, 2019, 1},\n\n {0x04d6, 1199, 1},\n {0xffffffff, -1, 0},\n\n {0x1fd6, 76, 2},\n\n {0x2cd6, 2715, 1},\n\n {0x03d6, 792, 1},\n\n {0x00d6, 144, 1},\n\n {0x1ec8, 1998, 1},\n {0xffffffff, -1, 0},\n\n {0x01c8, 421, 1},\n\n {0x1fc8, 2232, 1},\n\n {0x2cc8, 2694, 1},\n\n {0xff32, 3210, 1},\n\n {0x00c8, 102, 1},\n\n {0x04c7, 1175, 1},\n\n {0x01c7, 421, 1},\n\n {0x1fc7, 15, 3},\n\n {0x1ec0, 1986, 1},\n\n {0x04c0, 1187, 1},\n\n {0x00c7, 99, 1},\n {0xffffffff, -1, 0},\n\n {0x2cc0, 2682, 1},\n\n {0x0179, 345, 1},\n\n {0x00c0, 77, 1},\n\n {0x0232, 574, 1},\n\n {0x01b3, 402, 1},\n\n {0x1fb3, 62, 2},\n\n {0xab79, 1475, 1},\n\n {0xa779, 3090, 1},\n\n {0x10c7, 2859, 1},\n\n {0xabb3, 1649, 1},\n\n {0xa7b3, 3156, 1},\n\n {0x1fa5, 234, 2},\n\n {0x10c0, 2841, 1},\n\n {0x03a5, 807, 1},\n {0xffffffff, -1, 0},\n\n {0xaba5, 1607, 1},\n\n {0x01b1, 691, 1},\n\n {0x10ca5, 3468, 1},\n\n {0x10b3, 2802, 1},\n\n {0x2169, 2319, 1},\n\n {0x024e, 601, 1},\n\n {0xabb1, 1643, 1},\n\n {0xa7b1, 682, 1},\n\n {0x10cb1, 3504, 1},\n\n {0x10a5, 2760, 1},\n {0xffffffff, -1, 0},\n\n {0x01af, 399, 1},\n\n {0x1faf, 244, 2},\n {0xffffffff, -1, 0},\n\n {0x0248, 592, 1},\n\n {0x10b1, 2796, 1},\n\n {0xabaf, 1637, 1},\n\n {0x1fad, 234, 2},\n\n {0x10caf, 3498, 1},\n\n {0x04cd, 1184, 1},\n\n {0x01cd, 429, 1},\n\n {0xabad, 1631, 1},\n\n {0xa7ad, 658, 1},\n\n {0x10cad, 3492, 1},\n\n {0x00cd, 117, 1},\n\n {0x10af, 2790, 1},\n\n {0x021e, 547, 1},\n\n {0x1fa3, 224, 2},\n {0xffffffff, -1, 0},\n\n {0x03a3, 800, 1},\n\n {0x10ad, 2784, 1},\n\n {0xaba3, 1601, 1},\n {0xffffffff, -1, 0},\n\n {0x10ca3, 3462, 1},\n\n {0x10cd, 2862, 1},\n\n {0x1fa1, 214, 2},\n\n {0x24b7, 2346, 1},\n\n {0x03a1, 796, 1},\n\n {0x0212, 529, 1},\n\n {0xaba1, 1595, 1},\n\n {0x10a3, 2754, 1},\n\n {0x10ca1, 3456, 1},\n\n {0x01d3, 438, 1},\n\n {0x1fd3, 25, 3},\n\n {0x0210, 526, 1},\n {0xffffffff, -1, 0},\n\n {0x00d3, 135, 1},\n\n {0x1e97, 34, 2},\n\n {0x10a1, 2748, 1},\n\n {0x0197, 649, 1},\n\n {0x1f97, 204, 2},\n {0xffffffff, -1, 0},\n\n {0x0397, 759, 1},\n\n {0x1041d, 3324, 1},\n\n {0xab97, 1565, 1},\n\n {0x041d, 929, 1},\n\n {0x10c97, 3426, 1},\n\n {0x1f1d, 2121, 1},\n\n {0x2c1d, 2508, 1},\n\n {0x1e72, 1884, 1},\n\n {0x0472, 1061, 1},\n\n {0x0172, 336, 1},\n\n {0x118b3, 3567, 1},\n\n {0x2c72, 2580, 1},\n\n {0x0372, 712, 1},\n\n {0x1041b, 3318, 1},\n\n {0xab72, 1454, 1},\n\n {0x041b, 923, 1},\n\n {0x118a5, 3525, 1},\n\n {0x1f1b, 2115, 1},\n\n {0x2c1b, 2502, 1},\n\n {0x1e70, 1881, 1},\n\n {0x0470, 1058, 1},\n\n {0x0170, 333, 1},\n\n {0x118b1, 3561, 1},\n\n {0x2c70, 610, 1},\n\n {0x0370, 709, 1},\n\n {0x1e46, 1817, 1},\n\n {0xab70, 1448, 1},\n\n {0x1e66, 1866, 1},\n\n {0x0466, 1043, 1},\n\n {0x0166, 318, 1},\n\n {0x1e44, 1814, 1},\n\n {0x0046, 15, 1},\n\n {0x118af, 3555, 1},\n\n {0xa746, 3027, 1},\n {0xffffffff, -1, 0},\n\n {0xa766, 3075, 1},\n\n {0x0044, 9, 1},\n\n {0x118ad, 3549, 1},\n\n {0xa744, 3024, 1},\n\n {0x1e7a, 1896, 1},\n\n {0x047a, 1073, 1},\n\n {0x1e3a, 1799, 1},\n {0xffffffff, -1, 0},\n\n {0xa646, 2874, 1},\n\n {0x1f3a, 2154, 1},\n\n {0xa666, 2922, 1},\n\n {0xab7a, 1478, 1},\n\n {0x118a3, 3519, 1},\n\n {0xa644, 2871, 1},\n\n {0xa73a, 3009, 1},\n {0xffffffff, -1, 0},\n\n {0x1ef4, 2064, 1},\n\n {0x04f4, 1244, 1},\n\n {0x01f4, 487, 1},\n\n {0x1ff4, 101, 2},\n\n {0x118a1, 3513, 1},\n\n {0x03f4, 762, 1},\n\n {0x1eec, 2052, 1},\n\n {0x04ec, 1232, 1},\n\n {0x01ec, 477, 1},\n\n {0x1fec, 2286, 1},\n\n {0x0546, 1397, 1},\n\n {0x03ec, 872, 1},\n {0xffffffff, -1, 0},\n\n {0x013f, 261, 1},\n\n {0x1f3f, 2169, 1},\n\n {0x0544, 1391, 1},\n\n {0x1eea, 2049, 1},\n\n {0x04ea, 1229, 1},\n\n {0x01ea, 474, 1},\n\n {0x1fea, 2256, 1},\n {0xffffffff, -1, 0},\n\n {0x03ea, 869, 1},\n\n {0x1ee8, 2046, 1},\n\n {0x04e8, 1226, 1},\n\n {0x01e8, 471, 1},\n\n {0x1fe8, 2280, 1},\n\n {0x053a, 1361, 1},\n\n {0x03e8, 866, 1},\n\n {0x1ee6, 2043, 1},\n\n {0x04e6, 1223, 1},\n\n {0x01e6, 468, 1},\n\n {0x1fe6, 88, 2},\n\n {0x1f4b, 2181, 1},\n\n {0x03e6, 863, 1},\n\n {0x1e5e, 1853, 1},\n\n {0x004b, 27, 1},\n\n {0x015e, 306, 1},\n\n {0x2166, 2310, 1},\n\n {0x1ee4, 2040, 1},\n\n {0x04e4, 1220, 1},\n\n {0x01e4, 465, 1},\n\n {0x1fe4, 80, 2},\n\n {0xa75e, 3063, 1},\n\n {0x03e4, 860, 1},\n\n {0x1ee0, 2034, 1},\n\n {0x04e0, 1214, 1},\n\n {0x01e0, 459, 1},\n\n {0x053f, 1376, 1},\n\n {0x2ce0, 2730, 1},\n\n {0x03e0, 854, 1},\n\n {0x1edc, 2028, 1},\n\n {0x04dc, 1208, 1},\n\n {0xa65e, 2910, 1},\n {0xffffffff, -1, 0},\n\n {0x2cdc, 2724, 1},\n\n {0x03dc, 848, 1},\n\n {0x00dc, 159, 1},\n\n {0x1ed0, 2010, 1},\n\n {0x04d0, 1190, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x2cd0, 2706, 1},\n\n {0x03d0, 742, 1},\n\n {0x00d0, 126, 1},\n\n {0x1ecc, 2004, 1},\n\n {0x054b, 1412, 1},\n {0xffffffff, -1, 0},\n\n {0x1fcc, 71, 2},\n\n {0x2ccc, 2700, 1},\n\n {0x1ec6, 1995, 1},\n\n {0x00cc, 114, 1},\n {0xffffffff, -1, 0},\n\n {0x1fc6, 67, 2},\n\n {0x2cc6, 2691, 1},\n\n {0x24c8, 2397, 1},\n\n {0x00c6, 96, 1},\n\n {0x04c5, 1172, 1},\n\n {0x01c5, 417, 1},\n {0xffffffff, -1, 0},\n\n {0x1fbb, 2229, 1},\n\n {0x24c7, 2394, 1},\n\n {0x00c5, 92, 1},\n\n {0x1fb9, 2271, 1},\n\n {0xabbb, 1673, 1},\n\n {0x24c0, 2373, 1},\n\n {0x04c3, 1169, 1},\n\n {0xabb9, 1667, 1},\n\n {0x1fc3, 71, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x00c3, 86, 1},\n\n {0x10c5, 2856, 1},\n\n {0x10bb, 2826, 1},\n\n {0x1ed4, 2016, 1},\n\n {0x04d4, 1196, 1},\n\n {0x10b9, 2820, 1},\n\n {0x13fc, 1700, 1},\n\n {0x2cd4, 2712, 1},\n\n {0x0246, 589, 1},\n\n {0x00d4, 138, 1},\n\n {0x10c3, 2850, 1},\n {0xffffffff, -1, 0},\n\n {0xff3a, 3234, 1},\n\n {0x0244, 688, 1},\n\n {0x019f, 670, 1},\n\n {0x1f9f, 204, 2},\n {0xffffffff, -1, 0},\n\n {0x039f, 789, 1},\n {0xffffffff, -1, 0},\n\n {0xab9f, 1589, 1},\n {0xffffffff, -1, 0},\n\n {0x10c9f, 3450, 1},\n\n {0x019d, 667, 1},\n\n {0x1f9d, 194, 2},\n\n {0x023a, 2565, 1},\n\n {0x039d, 783, 1},\n\n {0x1e5a, 1847, 1},\n\n {0xab9d, 1583, 1},\n\n {0x015a, 300, 1},\n\n {0x10c9d, 3444, 1},\n\n {0x1e9b, 1856, 1},\n\n {0x24cd, 2412, 1},\n\n {0x005a, 74, 1},\n\n {0x1f9b, 184, 2},\n\n {0xa75a, 3057, 1},\n\n {0x039b, 776, 1},\n\n {0x1ece, 2007, 1},\n\n {0xab9b, 1577, 1},\n\n {0x1e99, 42, 2},\n\n {0x10c9b, 3438, 1},\n\n {0x2cce, 2703, 1},\n\n {0x1f99, 174, 2},\n\n {0x00ce, 120, 1},\n\n {0x0399, 767, 1},\n\n {0xa65a, 2904, 1},\n\n {0xab99, 1571, 1},\n {0xffffffff, -1, 0},\n\n {0x10c99, 3432, 1},\n\n {0x0193, 634, 1},\n\n {0x1f93, 184, 2},\n\n {0x1e58, 1844, 1},\n\n {0x0393, 746, 1},\n\n {0x0158, 297, 1},\n\n {0xab93, 1553, 1},\n {0xffffffff, -1, 0},\n\n {0x10c93, 3414, 1},\n\n {0x0058, 68, 1},\n\n {0x042d, 977, 1},\n\n {0xa758, 3054, 1},\n\n {0x1f2d, 2139, 1},\n\n {0x2c2d, 2556, 1},\n\n {0x118bb, 3591, 1},\n\n {0x0191, 369, 1},\n\n {0x1f91, 174, 2},\n\n {0x118b9, 3585, 1},\n\n {0x0391, 739, 1},\n {0xffffffff, -1, 0},\n\n {0xab91, 1547, 1},\n\n {0xa658, 2901, 1},\n\n {0x10c91, 3408, 1},\n\n {0x018f, 625, 1},\n\n {0x1f8f, 164, 2},\n {0xffffffff, -1, 0},\n\n {0x038f, 836, 1},\n {0xffffffff, -1, 0},\n\n {0xab8f, 1541, 1},\n {0xffffffff, -1, 0},\n\n {0x10c8f, 3402, 1},\n\n {0x018b, 366, 1},\n\n {0x1f8b, 144, 2},\n {0xffffffff, -1, 0},\n\n {0x0187, 363, 1},\n\n {0x1f87, 164, 2},\n\n {0xab8b, 1529, 1},\n\n {0xa78b, 3111, 1},\n\n {0x10c8b, 3390, 1},\n\n {0xab87, 1517, 1},\n\n {0x04c1, 1166, 1},\n\n {0x10c87, 3378, 1},\n\n {0x1e7e, 1902, 1},\n\n {0x047e, 1079, 1},\n {0xffffffff, -1, 0},\n\n {0x00c1, 80, 1},\n\n {0x2c7e, 580, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xab7e, 1490, 1},\n\n {0xa77e, 3096, 1},\n\n {0x1e76, 1890, 1},\n\n {0x0476, 1067, 1},\n\n {0x0176, 342, 1},\n\n {0x1e42, 1811, 1},\n\n {0x10c1, 2844, 1},\n\n {0x0376, 715, 1},\n\n {0x1e36, 1793, 1},\n\n {0xab76, 1466, 1},\n\n {0x0136, 249, 1},\n\n {0x0042, 3, 1},\n\n {0x1e3e, 1805, 1},\n\n {0xa742, 3021, 1},\n\n {0x1e38, 1796, 1},\n\n {0x1f3e, 2166, 1},\n\n {0xa736, 3003, 1},\n\n {0x1f38, 2148, 1},\n {0xffffffff, -1, 0},\n\n {0x0587, 105, 2},\n\n {0xa73e, 3015, 1},\n {0xffffffff, -1, 0},\n\n {0xa738, 3006, 1},\n\n {0xa642, 2868, 1},\n\n {0x1e5c, 1850, 1},\n\n {0x1e34, 1790, 1},\n\n {0x015c, 303, 1},\n\n {0x0134, 246, 1},\n\n {0x1ef6, 2067, 1},\n\n {0x04f6, 1247, 1},\n\n {0x01f6, 372, 1},\n\n {0x1ff6, 92, 2},\n\n {0xa75c, 3060, 1},\n\n {0xa734, 3000, 1},\n\n {0x1ef0, 2058, 1},\n\n {0x04f0, 1238, 1},\n\n {0x01f0, 20, 2},\n {0xffffffff, -1, 0},\n\n {0x1e30, 1784, 1},\n\n {0x03f0, 772, 1},\n\n {0x0130, 261, 2},\n\n {0x0542, 1385, 1},\n\n {0xa65c, 2907, 1},\n\n {0x1f83, 144, 2},\n\n {0x0536, 1349, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xab83, 1505, 1},\n\n {0x053e, 1373, 1},\n\n {0x10c83, 3366, 1},\n\n {0x0538, 1355, 1},\n\n {0x1eee, 2055, 1},\n\n {0x04ee, 1235, 1},\n\n {0x01ee, 480, 1},\n\n {0x1f8d, 154, 2},\n {0xffffffff, -1, 0},\n\n {0x03ee, 875, 1},\n {0xffffffff, -1, 0},\n\n {0xab8d, 1535, 1},\n\n {0xa78d, 643, 1},\n\n {0x10c8d, 3396, 1},\n\n {0x0534, 1343, 1},\n\n {0x0181, 613, 1},\n\n {0x1f81, 134, 2},\n\n {0x013d, 258, 1},\n\n {0x1f3d, 2163, 1},\n {0xffffffff, -1, 0},\n\n {0xab81, 1499, 1},\n\n {0x017f, 52, 1},\n\n {0x10c81, 3360, 1},\n\n {0x2c7f, 583, 1},\n\n {0x037f, 881, 1},\n\n {0xff2d, 3195, 1},\n\n {0xab7f, 1493, 1},\n\n {0x1e74, 1887, 1},\n\n {0x0474, 1064, 1},\n\n {0x0174, 339, 1},\n\n {0x1e3c, 1802, 1},\n\n {0x0149, 46, 2},\n\n {0x1f49, 2175, 1},\n\n {0x1f3c, 2160, 1},\n\n {0xab74, 1460, 1},\n\n {0x0049, 3606, 1},\n\n {0x0143, 267, 1},\n\n {0x24cc, 2409, 1},\n\n {0xa73c, 3012, 1},\n {0xffffffff, -1, 0},\n\n {0x0043, 6, 1},\n\n {0x0141, 264, 1},\n\n {0x24c6, 2391, 1},\n\n {0x013b, 255, 1},\n\n {0x1f3b, 2157, 1},\n\n {0x0041, 0, 1},\n\n {0x0139, 252, 1},\n\n {0x1f39, 2151, 1},\n\n {0x24c5, 2388, 1},\n\n {0x24bb, 2358, 1},\n\n {0x13fa, 1694, 1},\n\n {0x053d, 1370, 1},\n\n {0x24b9, 2352, 1},\n\n {0x0429, 965, 1},\n\n {0x2183, 2340, 1},\n\n {0x1f29, 2127, 1},\n\n {0x2c29, 2544, 1},\n\n {0x24c3, 2382, 1},\n\n {0x10427, 3354, 1},\n\n {0x10425, 3348, 1},\n\n {0x0427, 959, 1},\n\n {0x0425, 953, 1},\n {0xffffffff, -1, 0},\n\n {0x2c27, 2538, 1},\n\n {0x2c25, 2532, 1},\n\n {0x0549, 1406, 1},\n\n {0x053c, 1367, 1},\n\n {0x10423, 3342, 1},\n {0xffffffff, -1, 0},\n\n {0x0423, 947, 1},\n\n {0x0543, 1388, 1},\n {0xffffffff, -1, 0},\n\n {0x2c23, 2526, 1},\n\n {0xff36, 3222, 1},\n {0xffffffff, -1, 0},\n\n {0x0541, 1382, 1},\n\n {0x10421, 3336, 1},\n\n {0x053b, 1364, 1},\n\n {0x0421, 941, 1},\n\n {0xff38, 3228, 1},\n\n {0x0539, 1358, 1},\n\n {0x2c21, 2520, 1},\n\n {0x10419, 3312, 1},\n\n {0x10417, 3306, 1},\n\n {0x0419, 917, 1},\n\n {0x0417, 911, 1},\n\n {0x1f19, 2109, 1},\n\n {0x2c19, 2496, 1},\n\n {0x2c17, 2490, 1},\n\n {0x023e, 2568, 1},\n\n {0xff34, 3216, 1},\n\n {0x10415, 3300, 1},\n\n {0x10413, 3294, 1},\n\n {0x0415, 905, 1},\n\n {0x0413, 899, 1},\n {0xffffffff, -1, 0},\n\n {0x2c15, 2484, 1},\n\n {0x2c13, 2478, 1},\n {0xffffffff, -1, 0},\n\n {0x24ce, 2415, 1},\n\n {0x1040f, 3282, 1},\n {0xffffffff, -1, 0},\n\n {0x040f, 1031, 1},\n\n {0xff30, 3204, 1},\n\n {0x1f0f, 2103, 1},\n\n {0x2c0f, 2466, 1},\n\n {0x1040d, 3276, 1},\n {0xffffffff, -1, 0},\n\n {0x040d, 1025, 1},\n\n {0x0147, 273, 1},\n\n {0x1f0d, 2097, 1},\n\n {0x2c0d, 2460, 1},\n\n {0x1040b, 3270, 1},\n\n {0x0047, 18, 1},\n\n {0x040b, 1019, 1},\n\n {0x0230, 571, 1},\n\n {0x1f0b, 2091, 1},\n\n {0x2c0b, 2454, 1},\n\n {0x10409, 3264, 1},\n\n {0x10405, 3252, 1},\n\n {0x0409, 1013, 1},\n\n {0x0405, 1001, 1},\n\n {0x1f09, 2085, 1},\n\n {0x2c09, 2448, 1},\n\n {0x2c05, 2436, 1},\n\n {0x10403, 3246, 1},\n\n {0x10401, 3240, 1},\n\n {0x0403, 995, 1},\n\n {0x0401, 989, 1},\n {0xffffffff, -1, 0},\n\n {0x2c03, 2430, 1},\n\n {0x2c01, 2424, 1},\n\n {0x13f9, 1691, 1},\n\n {0x042f, 983, 1},\n {0xffffffff, -1, 0},\n\n {0x1f2f, 2145, 1},\n\n {0x1041f, 3330, 1},\n {0xffffffff, -1, 0},\n\n {0x041f, 935, 1},\n\n {0x023d, 378, 1},\n\n {0x10411, 3288, 1},\n\n {0x2c1f, 2514, 1},\n\n {0x0411, 893, 1},\n\n {0x0547, 1400, 1},\n {0xffffffff, -1, 0},\n\n {0x2c11, 2472, 1},\n\n {0x10407, 3258, 1},\n {0xffffffff, -1, 0},\n\n {0x0407, 1007, 1},\n\n {0x24c1, 2376, 1},\n {0xffffffff, -1, 0},\n\n {0x2c07, 2442, 1},\n {0xffffffff, -1, 0},\n\n {0x13f8, 1688, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff39, 3231, 1},\n {0xffffffff, -1, 0},\n\n {0x0243, 354, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x0241, 586, 1},\n\n {0xff29, 3183, 1},\n\n {0x023b, 577, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff27, 3177, 1},\n\n {0xff25, 3171, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff23, 3165, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff21, 3159, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0xfb17, 117, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff2f, 3201, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xfb15, 113, 2},\n\n {0xfb13, 121, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0xfb05, 29, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xfb03, 0, 3},\n\n {0xfb01, 8, 2}\n };\n\n if (0 == 0)\n {\n int key = hash(&code);\n\n if (key <= MAX_HASH_VALUE && key >= 0)\n {\n OnigCodePoint gcode = wordlist[key].code;\n\n if (code == gcode)\n return &wordlist[key];\n }\n }\n return 0;\n}","target":"unicode_unfold_key(OnigCodePoint code)\n{\n static const struct ByUnfoldKey wordlist[] =\n {\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0x1040a, 3267, 1},\n\n {0x1e0a, 1727, 1},\n\n {0x040a, 1016, 1},\n\n {0x010a, 186, 1},\n\n {0x1f0a, 2088, 1},\n\n {0x2c0a, 2451, 1},\n\n {0x0189, 619, 1},\n\n {0x1f89, 134, 2},\n\n {0x1f85, 154, 2},\n\n {0x0389, 733, 1},\n\n {0x03ff, 724, 1},\n\n {0xab89, 1523, 1},\n\n {0xab85, 1511, 1},\n\n {0x10c89, 3384, 1},\n\n {0x10c85, 3372, 1},\n\n {0x1e84, 1911, 1},\n\n {0x03f5, 752, 1},\n\n {0x0184, 360, 1},\n\n {0x1f84, 149, 2},\n\n {0x2c84, 2592, 1},\n\n {0x017d, 351, 1},\n\n {0x1ff3, 96, 2},\n\n {0xab84, 1508, 1},\n\n {0xa784, 3105, 1},\n\n {0x10c84, 3369, 1},\n\n {0xab7d, 1487, 1},\n\n {0xa77d, 1706, 1},\n\n {0x1e98, 38, 2},\n\n {0x0498, 1106, 1},\n\n {0x0198, 375, 1},\n\n {0x1f98, 169, 2},\n\n {0x2c98, 2622, 1},\n\n {0x0398, 762, 1},\n\n {0xa684, 2940, 1},\n\n {0xab98, 1568, 1},\n\n {0xa798, 3123, 1},\n\n {0x10c98, 3429, 1},\n\n {0x050a, 1277, 1},\n\n {0x1ffb, 2265, 1},\n\n {0x1e96, 16, 2},\n\n {0x0496, 1103, 1},\n\n {0x0196, 652, 1},\n\n {0x1f96, 199, 2},\n\n {0x2c96, 2619, 1},\n\n {0x0396, 756, 1},\n\n {0xa698, 2970, 1},\n\n {0xab96, 1562, 1},\n\n {0xa796, 3120, 1},\n\n {0x10c96, 3423, 1},\n\n {0x1feb, 2259, 1},\n\n {0x2ceb, 2736, 1},\n\n {0x1e90, 1929, 1},\n\n {0x0490, 1094, 1},\n\n {0x0190, 628, 1},\n\n {0x1f90, 169, 2},\n\n {0x2c90, 2610, 1},\n\n {0x0390, 25, 3},\n\n {0xa696, 2967, 1},\n\n {0xab90, 1544, 1},\n\n {0xa790, 3114, 1},\n\n {0x10c90, 3405, 1},\n\n {0x01d7, 444, 1},\n\n {0x1fd7, 31, 3},\n\n {0x1ea6, 1947, 1},\n\n {0x04a6, 1127, 1},\n\n {0x01a6, 676, 1},\n\n {0x1fa6, 239, 2},\n\n {0x2ca6, 2643, 1},\n\n {0x03a6, 810, 1},\n\n {0xa690, 2958, 1},\n\n {0xaba6, 1610, 1},\n\n {0xa7a6, 3144, 1},\n\n {0x10ca6, 3471, 1},\n\n {0x1ea4, 1944, 1},\n\n {0x04a4, 1124, 1},\n\n {0x01a4, 390, 1},\n\n {0x1fa4, 229, 2},\n\n {0x2ca4, 2640, 1},\n\n {0x03a4, 804, 1},\n\n {0x10a6, 2763, 1},\n\n {0xaba4, 1604, 1},\n\n {0xa7a4, 3141, 1},\n\n {0x10ca4, 3465, 1},\n\n {0x1ea0, 1938, 1},\n\n {0x04a0, 1118, 1},\n\n {0x01a0, 384, 1},\n\n {0x1fa0, 209, 2},\n\n {0x2ca0, 2634, 1},\n\n {0x03a0, 792, 1},\n\n {0x10a4, 2757, 1},\n\n {0xaba0, 1592, 1},\n\n {0xa7a0, 3135, 1},\n\n {0x10ca0, 3453, 1},\n\n {0x1eb2, 1965, 1},\n\n {0x04b2, 1145, 1},\n\n {0x01b2, 694, 1},\n\n {0x1fb2, 249, 2},\n\n {0x2cb2, 2661, 1},\n\n {0x03fd, 718, 1},\n\n {0x10a0, 2745, 1},\n\n {0xabb2, 1646, 1},\n\n {0xa7b2, 703, 1},\n\n {0x10cb2, 3507, 1},\n\n {0x1eac, 1956, 1},\n\n {0x04ac, 1136, 1},\n\n {0x01ac, 396, 1},\n\n {0x1fac, 229, 2},\n\n {0x2cac, 2652, 1},\n\n {0x0537, 1352, 1},\n\n {0x10b2, 2799, 1},\n\n {0xabac, 1628, 1},\n\n {0xa7ac, 637, 1},\n\n {0x10cac, 3489, 1},\n\n {0x1eaa, 1953, 1},\n\n {0x04aa, 1133, 1},\n\n {0x00dd, 162, 1},\n\n {0x1faa, 219, 2},\n\n {0x2caa, 2649, 1},\n\n {0x03aa, 824, 1},\n\n {0x10ac, 2781, 1},\n\n {0xabaa, 1622, 1},\n\n {0xa7aa, 646, 1},\n\n {0x10caa, 3483, 1},\n\n {0x1ea8, 1950, 1},\n\n {0x04a8, 1130, 1},\n\n {0x020a, 517, 1},\n\n {0x1fa8, 209, 2},\n\n {0x2ca8, 2646, 1},\n\n {0x03a8, 817, 1},\n\n {0x10aa, 2775, 1},\n\n {0xaba8, 1616, 1},\n\n {0xa7a8, 3147, 1},\n\n {0x10ca8, 3477, 1},\n\n {0x1ea2, 1941, 1},\n\n {0x04a2, 1121, 1},\n\n {0x01a2, 387, 1},\n\n {0x1fa2, 219, 2},\n\n {0x2ca2, 2637, 1},\n\n {0x118a6, 3528, 1},\n\n {0x10a8, 2769, 1},\n\n {0xaba2, 1598, 1},\n\n {0xa7a2, 3138, 1},\n\n {0x10ca2, 3459, 1},\n\n {0x2ced, 2739, 1},\n\n {0x1fe9, 2283, 1},\n\n {0x1fe7, 47, 3},\n\n {0x1eb0, 1962, 1},\n\n {0x04b0, 1142, 1},\n\n {0x118a4, 3522, 1},\n\n {0x10a2, 2751, 1},\n\n {0x2cb0, 2658, 1},\n\n {0x03b0, 41, 3},\n\n {0x1fe3, 41, 3},\n\n {0xabb0, 1640, 1},\n\n {0xa7b0, 706, 1},\n\n {0x10cb0, 3501, 1},\n\n {0x01d9, 447, 1},\n\n {0x1fd9, 2277, 1},\n\n {0x118a0, 3510, 1},\n\n {0x00df, 24, 2},\n\n {0x00d9, 150, 1},\n\n {0xab77, 1469, 1},\n\n {0x10b0, 2793, 1},\n\n {0x1eae, 1959, 1},\n\n {0x04ae, 1139, 1},\n\n {0x01ae, 685, 1},\n\n {0x1fae, 239, 2},\n\n {0x2cae, 2655, 1},\n\n {0x118b2, 3564, 1},\n\n {0xab73, 1457, 1},\n\n {0xabae, 1634, 1},\n\n {0xab71, 1451, 1},\n\n {0x10cae, 3495, 1},\n\n {0x1e2a, 1775, 1},\n\n {0x042a, 968, 1},\n\n {0x012a, 234, 1},\n\n {0x1f2a, 2130, 1},\n\n {0x2c2a, 2547, 1},\n\n {0x118ac, 3546, 1},\n\n {0x10ae, 2787, 1},\n\n {0x0535, 1346, 1},\n\n {0xa72a, 2988, 1},\n\n {0x1e9a, 0, 2},\n\n {0x049a, 1109, 1},\n\n {0xff37, 3225, 1},\n\n {0x1f9a, 179, 2},\n\n {0x2c9a, 2625, 1},\n\n {0x039a, 772, 1},\n\n {0x118aa, 3540, 1},\n\n {0xab9a, 1574, 1},\n\n {0xa79a, 3126, 1},\n\n {0x10c9a, 3435, 1},\n\n {0x1e94, 1935, 1},\n\n {0x0494, 1100, 1},\n\n {0x0194, 640, 1},\n\n {0x1f94, 189, 2},\n\n {0x2c94, 2616, 1},\n\n {0x0394, 749, 1},\n\n {0x118a8, 3534, 1},\n\n {0xab94, 1556, 1},\n\n {0xa69a, 2973, 1},\n\n {0x10c94, 3417, 1},\n\n {0x10402, 3243, 1},\n\n {0x1e02, 1715, 1},\n\n {0x0402, 992, 1},\n\n {0x0102, 174, 1},\n\n {0x0533, 1340, 1},\n\n {0x2c02, 2427, 1},\n\n {0x118a2, 3516, 1},\n\n {0x052a, 1325, 1},\n\n {0xa694, 2964, 1},\n\n {0x1e92, 1932, 1},\n\n {0x0492, 1097, 1},\n\n {0x2165, 2307, 1},\n\n {0x1f92, 179, 2},\n\n {0x2c92, 2613, 1},\n\n {0x0392, 742, 1},\n\n {0x2161, 2295, 1},\n\n {0xab92, 1550, 1},\n\n {0xa792, 3117, 1},\n\n {0x10c92, 3411, 1},\n\n {0x118b0, 3558, 1},\n\n {0x1f5f, 2199, 1},\n\n {0x1e8e, 1926, 1},\n\n {0x048e, 1091, 1},\n\n {0x018e, 453, 1},\n\n {0x1f8e, 159, 2},\n\n {0x2c8e, 2607, 1},\n\n {0x038e, 833, 1},\n\n {0xa692, 2961, 1},\n\n {0xab8e, 1538, 1},\n\n {0x0055, 59, 1},\n\n {0x10c8e, 3399, 1},\n\n {0x1f5d, 2196, 1},\n\n {0x212a, 27, 1},\n\n {0x04cb, 1181, 1},\n\n {0x01cb, 425, 1},\n\n {0x1fcb, 2241, 1},\n\n {0x118ae, 3552, 1},\n\n {0x0502, 1265, 1},\n\n {0x00cb, 111, 1},\n\n {0xa68e, 2955, 1},\n\n {0x1e8a, 1920, 1},\n\n {0x048a, 1085, 1},\n\n {0x018a, 622, 1},\n\n {0x1f8a, 139, 2},\n\n {0x2c8a, 2601, 1},\n\n {0x038a, 736, 1},\n\n {0x2c67, 2571, 1},\n\n {0xab8a, 1526, 1},\n\n {0x1e86, 1914, 1},\n\n {0x10c8a, 3387, 1},\n\n {0x0186, 616, 1},\n\n {0x1f86, 159, 2},\n\n {0x2c86, 2595, 1},\n\n {0x0386, 727, 1},\n\n {0xff35, 3219, 1},\n\n {0xab86, 1514, 1},\n\n {0xa786, 3108, 1},\n\n {0x10c86, 3375, 1},\n\n {0xa68a, 2949, 1},\n\n {0x0555, 1442, 1},\n\n {0x1ebc, 1980, 1},\n\n {0x04bc, 1160, 1},\n\n {0x01bc, 411, 1},\n\n {0x1fbc, 62, 2},\n\n {0x2cbc, 2676, 1},\n\n {0x1f5b, 2193, 1},\n\n {0xa686, 2943, 1},\n\n {0xabbc, 1676, 1},\n\n {0x1eb8, 1974, 1},\n\n {0x04b8, 1154, 1},\n\n {0x01b8, 408, 1},\n\n {0x1fb8, 2268, 1},\n\n {0x2cb8, 2670, 1},\n\n {0x01db, 450, 1},\n\n {0x1fdb, 2247, 1},\n\n {0xabb8, 1664, 1},\n\n {0x10bc, 2829, 1},\n\n {0x00db, 156, 1},\n\n {0x1eb6, 1971, 1},\n\n {0x04b6, 1151, 1},\n\n {0xff33, 3213, 1},\n\n {0x1fb6, 58, 2},\n\n {0x2cb6, 2667, 1},\n\n {0xff2a, 3186, 1},\n\n {0x10b8, 2817, 1},\n\n {0xabb6, 1658, 1},\n\n {0xa7b6, 3153, 1},\n\n {0x10426, 3351, 1},\n\n {0x1e26, 1769, 1},\n\n {0x0426, 956, 1},\n\n {0x0126, 228, 1},\n\n {0x0053, 52, 1},\n\n {0x2c26, 2535, 1},\n\n {0x0057, 65, 1},\n\n {0x10b6, 2811, 1},\n\n {0x022a, 562, 1},\n\n {0xa726, 2982, 1},\n\n {0x1e2e, 1781, 1},\n\n {0x042e, 980, 1},\n\n {0x012e, 240, 1},\n\n {0x1f2e, 2142, 1},\n\n {0x2c2e, 2559, 1},\n {0xffffffff, -1, 0},\n\n {0x2167, 2313, 1},\n {0xffffffff, -1, 0},\n\n {0xa72e, 2994, 1},\n\n {0x1e2c, 1778, 1},\n\n {0x042c, 974, 1},\n\n {0x012c, 237, 1},\n\n {0x1f2c, 2136, 1},\n\n {0x2c2c, 2553, 1},\n\n {0x1f6f, 2223, 1},\n\n {0x2c6f, 604, 1},\n\n {0xabbf, 1685, 1},\n\n {0xa72c, 2991, 1},\n\n {0x1e28, 1772, 1},\n\n {0x0428, 962, 1},\n\n {0x0128, 231, 1},\n\n {0x1f28, 2124, 1},\n\n {0x2c28, 2541, 1},\n {0xffffffff, -1, 0},\n\n {0x0553, 1436, 1},\n\n {0x10bf, 2838, 1},\n\n {0xa728, 2985, 1},\n\n {0x0526, 1319, 1},\n\n {0x0202, 505, 1},\n\n {0x1e40, 1808, 1},\n\n {0x10424, 3345, 1},\n\n {0x1e24, 1766, 1},\n\n {0x0424, 950, 1},\n\n {0x0124, 225, 1},\n {0xffffffff, -1, 0},\n\n {0x2c24, 2529, 1},\n\n {0x052e, 1331, 1},\n\n {0xa740, 3018, 1},\n\n {0x118bc, 3594, 1},\n\n {0xa724, 2979, 1},\n\n {0x1ef2, 2061, 1},\n\n {0x04f2, 1241, 1},\n\n {0x01f2, 483, 1},\n\n {0x1ff2, 257, 2},\n\n {0x2cf2, 2742, 1},\n\n {0x052c, 1328, 1},\n\n {0x118b8, 3582, 1},\n\n {0xa640, 2865, 1},\n\n {0x10422, 3339, 1},\n\n {0x1e22, 1763, 1},\n\n {0x0422, 944, 1},\n\n {0x0122, 222, 1},\n\n {0x2126, 820, 1},\n\n {0x2c22, 2523, 1},\n\n {0x0528, 1322, 1},\n\n {0x01f1, 483, 1},\n\n {0x118b6, 3576, 1},\n\n {0xa722, 2976, 1},\n\n {0x03f1, 796, 1},\n\n {0x1ebe, 1983, 1},\n\n {0x04be, 1163, 1},\n\n {0xfb02, 12, 2},\n\n {0x1fbe, 767, 1},\n\n {0x2cbe, 2679, 1},\n\n {0x01b5, 405, 1},\n\n {0x0540, 1379, 1},\n\n {0xabbe, 1682, 1},\n\n {0x0524, 1316, 1},\n\n {0x00b5, 779, 1},\n\n {0xabb5, 1655, 1},\n\n {0x1eba, 1977, 1},\n\n {0x04ba, 1157, 1},\n\n {0x216f, 2337, 1},\n\n {0x1fba, 2226, 1},\n\n {0x2cba, 2673, 1},\n\n {0x10be, 2835, 1},\n\n {0x0051, 46, 1},\n\n {0xabba, 1670, 1},\n\n {0x10b5, 2808, 1},\n\n {0x1e6e, 1878, 1},\n\n {0x046e, 1055, 1},\n\n {0x016e, 330, 1},\n\n {0x1f6e, 2220, 1},\n\n {0x2c6e, 664, 1},\n\n {0x118bf, 3603, 1},\n\n {0x0522, 1313, 1},\n\n {0x10ba, 2823, 1},\n\n {0xa76e, 3087, 1},\n\n {0x1eb4, 1968, 1},\n\n {0x04b4, 1148, 1},\n\n {0x2c75, 2583, 1},\n\n {0x1fb4, 50, 2},\n\n {0x2cb4, 2664, 1},\n\n {0xab75, 1463, 1},\n\n {0x1ec2, 1989, 1},\n\n {0xabb4, 1652, 1},\n\n {0xa7b4, 3150, 1},\n\n {0x1fc2, 253, 2},\n\n {0x2cc2, 2685, 1},\n\n {0x03c2, 800, 1},\n\n {0x00c2, 83, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff26, 3174, 1},\n\n {0x10b4, 2805, 1},\n\n {0x1eca, 2001, 1},\n\n {0x0551, 1430, 1},\n\n {0x01ca, 425, 1},\n\n {0x1fca, 2238, 1},\n\n {0x2cca, 2697, 1},\n\n {0x10c2, 2847, 1},\n\n {0x00ca, 108, 1},\n\n {0xff2e, 3198, 1},\n\n {0x1e8c, 1923, 1},\n\n {0x048c, 1088, 1},\n\n {0x0226, 556, 1},\n\n {0x1f8c, 149, 2},\n\n {0x2c8c, 2604, 1},\n\n {0x038c, 830, 1},\n {0xffffffff, -1, 0},\n\n {0xab8c, 1532, 1},\n\n {0xff2c, 3192, 1},\n\n {0x10c8c, 3393, 1},\n\n {0x1ec4, 1992, 1},\n\n {0x022e, 568, 1},\n\n {0x01c4, 417, 1},\n\n {0x1fc4, 54, 2},\n\n {0x2cc4, 2688, 1},\n {0xffffffff, -1, 0},\n\n {0x00c4, 89, 1},\n\n {0xff28, 3180, 1},\n\n {0xa68c, 2952, 1},\n\n {0x01cf, 432, 1},\n\n {0x022c, 565, 1},\n\n {0x118be, 3600, 1},\n\n {0x03cf, 839, 1},\n\n {0x00cf, 123, 1},\n\n {0x118b5, 3573, 1},\n {0xffffffff, -1, 0},\n\n {0x10c4, 2853, 1},\n\n {0x216e, 2334, 1},\n\n {0x24cb, 2406, 1},\n\n {0x0228, 559, 1},\n\n {0xff24, 3168, 1},\n {0xffffffff, -1, 0},\n\n {0x118ba, 3588, 1},\n\n {0x1efe, 2079, 1},\n\n {0x04fe, 1259, 1},\n\n {0x01fe, 499, 1},\n\n {0x1e9e, 24, 2},\n\n {0x049e, 1115, 1},\n\n {0x03fe, 721, 1},\n\n {0x1f9e, 199, 2},\n\n {0x2c9e, 2631, 1},\n\n {0x039e, 786, 1},\n\n {0x0224, 553, 1},\n\n {0xab9e, 1586, 1},\n\n {0xa79e, 3132, 1},\n\n {0x10c9e, 3447, 1},\n\n {0x01f7, 414, 1},\n\n {0x1ff7, 67, 3},\n\n {0xff22, 3162, 1},\n\n {0x03f7, 884, 1},\n\n {0x118b4, 3570, 1},\n\n {0x049c, 1112, 1},\n\n {0x019c, 661, 1},\n\n {0x1f9c, 189, 2},\n\n {0x2c9c, 2628, 1},\n\n {0x039c, 779, 1},\n\n {0x24bc, 2361, 1},\n\n {0xab9c, 1580, 1},\n\n {0xa79c, 3129, 1},\n\n {0x10c9c, 3441, 1},\n\n {0x0222, 550, 1},\n\n {0x1e7c, 1899, 1},\n\n {0x047c, 1076, 1},\n\n {0x1e82, 1908, 1},\n\n {0x24b8, 2349, 1},\n\n {0x0182, 357, 1},\n\n {0x1f82, 139, 2},\n\n {0x2c82, 2589, 1},\n\n {0xab7c, 1484, 1},\n {0xffffffff, -1, 0},\n\n {0xab82, 1502, 1},\n\n {0xa782, 3102, 1},\n\n {0x10c82, 3363, 1},\n\n {0x2c63, 1709, 1},\n\n {0x24b6, 2343, 1},\n\n {0x1e80, 1905, 1},\n\n {0x0480, 1082, 1},\n\n {0x1f59, 2190, 1},\n\n {0x1f80, 129, 2},\n\n {0x2c80, 2586, 1},\n\n {0x0059, 71, 1},\n\n {0xa682, 2937, 1},\n\n {0xab80, 1496, 1},\n\n {0xa780, 3099, 1},\n\n {0x10c80, 3357, 1},\n {0xffffffff, -1, 0},\n\n {0x1e4c, 1826, 1},\n\n {0x0145, 270, 1},\n\n {0x014c, 279, 1},\n\n {0x1f4c, 2184, 1},\n\n {0x0345, 767, 1},\n\n {0x0045, 12, 1},\n\n {0x004c, 31, 1},\n\n {0xa680, 2934, 1},\n\n {0xa74c, 3036, 1},\n\n {0x1e4a, 1823, 1},\n\n {0x01d5, 441, 1},\n\n {0x014a, 276, 1},\n\n {0x1f4a, 2178, 1},\n\n {0x03d5, 810, 1},\n\n {0x00d5, 141, 1},\n\n {0x004a, 24, 1},\n\n {0x24bf, 2370, 1},\n\n {0xa74a, 3033, 1},\n\n {0xa64c, 2883, 1},\n\n {0x1041c, 3321, 1},\n\n {0x1e1c, 1754, 1},\n\n {0x041c, 926, 1},\n\n {0x011c, 213, 1},\n\n {0x1f1c, 2118, 1},\n\n {0x2c1c, 2505, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xa64a, 2880, 1},\n\n {0x1041a, 3315, 1},\n\n {0x1e1a, 1751, 1},\n\n {0x041a, 920, 1},\n\n {0x011a, 210, 1},\n\n {0x1f1a, 2112, 1},\n\n {0x2c1a, 2499, 1},\n\n {0xabbd, 1679, 1},\n\n {0x0545, 1394, 1},\n\n {0x054c, 1415, 1},\n\n {0x10418, 3309, 1},\n\n {0x1e18, 1748, 1},\n\n {0x0418, 914, 1},\n\n {0x0118, 207, 1},\n\n {0x1f18, 2106, 1},\n\n {0x2c18, 2493, 1},\n\n {0x10bd, 2832, 1},\n\n {0x2163, 2301, 1},\n\n {0x054a, 1409, 1},\n\n {0x1040e, 3279, 1},\n\n {0x1e0e, 1733, 1},\n\n {0x040e, 1028, 1},\n\n {0x010e, 192, 1},\n\n {0x1f0e, 2100, 1},\n\n {0x2c0e, 2463, 1},\n\n {0x1efc, 2076, 1},\n\n {0x04fc, 1256, 1},\n\n {0x01fc, 496, 1},\n\n {0x1ffc, 96, 2},\n\n {0x051c, 1304, 1},\n\n {0x1040c, 3273, 1},\n\n {0x1e0c, 1730, 1},\n\n {0x040c, 1022, 1},\n\n {0x010c, 189, 1},\n\n {0x1f0c, 2094, 1},\n\n {0x2c0c, 2457, 1},\n\n {0x1f6d, 2217, 1},\n\n {0x2c6d, 607, 1},\n\n {0x051a, 1301, 1},\n\n {0x24be, 2367, 1},\n\n {0x10408, 3261, 1},\n\n {0x1e08, 1724, 1},\n\n {0x0408, 1010, 1},\n\n {0x0108, 183, 1},\n\n {0x1f08, 2082, 1},\n\n {0x2c08, 2445, 1},\n\n {0x04c9, 1178, 1},\n\n {0x0518, 1298, 1},\n\n {0x1fc9, 2235, 1},\n {0xffffffff, -1, 0},\n\n {0x24ba, 2355, 1},\n\n {0x00c9, 105, 1},\n\n {0x10416, 3303, 1},\n\n {0x1e16, 1745, 1},\n\n {0x0416, 908, 1},\n\n {0x0116, 204, 1},\n\n {0x050e, 1283, 1},\n\n {0x2c16, 2487, 1},\n\n {0x10414, 3297, 1},\n\n {0x1e14, 1742, 1},\n\n {0x0414, 902, 1},\n\n {0x0114, 201, 1},\n\n {0x042b, 971, 1},\n\n {0x2c14, 2481, 1},\n\n {0x1f2b, 2133, 1},\n\n {0x2c2b, 2550, 1},\n {0xffffffff, -1, 0},\n\n {0x050c, 1280, 1},\n\n {0x10406, 3255, 1},\n\n {0x1e06, 1721, 1},\n\n {0x0406, 1004, 1},\n\n {0x0106, 180, 1},\n\n {0x13fb, 1697, 1},\n\n {0x2c06, 2439, 1},\n\n {0x24c2, 2379, 1},\n\n {0x118bd, 3597, 1},\n {0xffffffff, -1, 0},\n\n {0x0508, 1274, 1},\n\n {0x10404, 3249, 1},\n\n {0x1e04, 1718, 1},\n\n {0x0404, 998, 1},\n\n {0x0104, 177, 1},\n\n {0x1f95, 194, 2},\n\n {0x2c04, 2433, 1},\n\n {0x0395, 752, 1},\n\n {0x24ca, 2403, 1},\n\n {0xab95, 1559, 1},\n\n {0x0531, 1334, 1},\n\n {0x10c95, 3420, 1},\n\n {0x0516, 1295, 1},\n\n {0x1e6c, 1875, 1},\n\n {0x046c, 1052, 1},\n\n {0x016c, 327, 1},\n\n {0x1f6c, 2214, 1},\n\n {0x216d, 2331, 1},\n\n {0x0514, 1292, 1},\n\n {0x0245, 697, 1},\n\n {0x024c, 598, 1},\n\n {0xa76c, 3084, 1},\n\n {0x10400, 3237, 1},\n\n {0x1e00, 1712, 1},\n\n {0x0400, 986, 1},\n\n {0x0100, 171, 1},\n\n {0x24c4, 2385, 1},\n\n {0x2c00, 2421, 1},\n\n {0x0506, 1271, 1},\n\n {0x024a, 595, 1},\n\n {0x1fab, 224, 2},\n\n {0xa66c, 2931, 1},\n\n {0x03ab, 827, 1},\n\n {0x24cf, 2418, 1},\n\n {0xabab, 1625, 1},\n\n {0xa7ab, 631, 1},\n\n {0x10cab, 3486, 1},\n {0xffffffff, -1, 0},\n\n {0x0504, 1268, 1},\n {0xffffffff, -1, 0},\n\n {0x021c, 544, 1},\n\n {0x01a9, 679, 1},\n\n {0x1fa9, 214, 2},\n\n {0x10ab, 2778, 1},\n\n {0x03a9, 820, 1},\n\n {0x212b, 92, 1},\n\n {0xaba9, 1619, 1},\n\n {0x1e88, 1917, 1},\n\n {0x10ca9, 3480, 1},\n\n {0x021a, 541, 1},\n\n {0x1f88, 129, 2},\n\n {0x2c88, 2598, 1},\n\n {0x0388, 730, 1},\n\n {0x13fd, 1703, 1},\n\n {0xab88, 1520, 1},\n\n {0x10a9, 2772, 1},\n\n {0x10c88, 3381, 1},\n {0xffffffff, -1, 0},\n\n {0x0218, 538, 1},\n\n {0x0500, 1262, 1},\n\n {0x1f4d, 2187, 1},\n\n {0x01a7, 393, 1},\n\n {0x1fa7, 244, 2},\n\n {0x004d, 34, 1},\n\n {0x03a7, 814, 1},\n\n {0xa688, 2946, 1},\n\n {0xaba7, 1613, 1},\n\n {0x020e, 523, 1},\n\n {0x10ca7, 3474, 1},\n\n {0x1e6a, 1872, 1},\n\n {0x046a, 1049, 1},\n\n {0x016a, 324, 1},\n\n {0x1f6a, 2208, 1},\n {0xffffffff, -1, 0},\n\n {0x216c, 2328, 1},\n\n {0x10a7, 2766, 1},\n\n {0x01d1, 435, 1},\n\n {0xa76a, 3081, 1},\n\n {0x020c, 520, 1},\n\n {0x03d1, 762, 1},\n\n {0x00d1, 129, 1},\n\n {0x1e68, 1869, 1},\n\n {0x0468, 1046, 1},\n\n {0x0168, 321, 1},\n\n {0x1f68, 2202, 1},\n {0xffffffff, -1, 0},\n\n {0xff31, 3207, 1},\n\n {0xa66a, 2928, 1},\n\n {0x0208, 514, 1},\n\n {0xa768, 3078, 1},\n\n {0x1e64, 1863, 1},\n\n {0x0464, 1040, 1},\n\n {0x0164, 315, 1},\n\n {0x054d, 1418, 1},\n\n {0x2c64, 673, 1},\n {0xffffffff, -1, 0},\n\n {0xff2b, 3189, 1},\n {0xffffffff, -1, 0},\n\n {0xa764, 3072, 1},\n\n {0xa668, 2925, 1},\n\n {0x0216, 535, 1},\n {0xffffffff, -1, 0},\n\n {0x118ab, 3543, 1},\n\n {0x1e62, 1860, 1},\n\n {0x0462, 1037, 1},\n\n {0x0162, 312, 1},\n\n {0x0214, 532, 1},\n\n {0x2c62, 655, 1},\n\n {0xa664, 2919, 1},\n\n {0x1ed2, 2013, 1},\n\n {0x04d2, 1193, 1},\n\n {0xa762, 3069, 1},\n\n {0x1fd2, 20, 3},\n\n {0x2cd2, 2709, 1},\n\n {0x118a9, 3537, 1},\n\n {0x00d2, 132, 1},\n\n {0x0206, 511, 1},\n\n {0x10420, 3333, 1},\n\n {0x1e20, 1760, 1},\n\n {0x0420, 938, 1},\n\n {0x0120, 219, 1},\n\n {0xa662, 2916, 1},\n\n {0x2c20, 2517, 1},\n\n {0x1e60, 1856, 1},\n\n {0x0460, 1034, 1},\n\n {0x0160, 309, 1},\n\n {0x0204, 508, 1},\n\n {0x2c60, 2562, 1},\n {0xffffffff, -1, 0},\n\n {0x24bd, 2364, 1},\n\n {0x216a, 2322, 1},\n\n {0xa760, 3066, 1},\n {0xffffffff, -1, 0},\n\n {0xfb16, 125, 2},\n\n {0x118a7, 3531, 1},\n\n {0x1efa, 2073, 1},\n\n {0x04fa, 1253, 1},\n\n {0x01fa, 493, 1},\n\n {0x1ffa, 2262, 1},\n\n {0xfb14, 109, 2},\n\n {0x03fa, 887, 1},\n\n {0xa660, 2913, 1},\n\n {0x2168, 2316, 1},\n\n {0x01b7, 700, 1},\n\n {0x1fb7, 10, 3},\n\n {0x1f6b, 2211, 1},\n\n {0x2c6b, 2577, 1},\n\n {0x0200, 502, 1},\n\n {0xabb7, 1661, 1},\n\n {0xfb06, 29, 2},\n\n {0x1e56, 1841, 1},\n\n {0x2164, 2304, 1},\n\n {0x0156, 294, 1},\n\n {0x1f56, 62, 3},\n\n {0x0520, 1310, 1},\n\n {0x004f, 40, 1},\n\n {0x0056, 62, 1},\n\n {0x10b7, 2814, 1},\n\n {0xa756, 3051, 1},\n\n {0xfb04, 5, 3},\n\n {0x1e78, 1893, 1},\n\n {0x0478, 1070, 1},\n\n {0x0178, 168, 1},\n\n {0x1e54, 1838, 1},\n\n {0x2162, 2298, 1},\n\n {0x0154, 291, 1},\n\n {0x1f54, 57, 3},\n\n {0xab78, 1472, 1},\n\n {0xa656, 2898, 1},\n\n {0x0054, 56, 1},\n\n {0x1e52, 1835, 1},\n\n {0xa754, 3048, 1},\n\n {0x0152, 288, 1},\n\n {0x1f52, 52, 3},\n\n {0x24c9, 2400, 1},\n\n {0x1e32, 1787, 1},\n\n {0x0052, 49, 1},\n\n {0x0132, 243, 1},\n\n {0xa752, 3045, 1},\n {0xffffffff, -1, 0},\n\n {0xfb00, 4, 2},\n\n {0xa654, 2895, 1},\n {0xffffffff, -1, 0},\n\n {0xa732, 2997, 1},\n\n {0x2160, 2292, 1},\n\n {0x054f, 1424, 1},\n\n {0x0556, 1445, 1},\n\n {0x1e50, 1832, 1},\n\n {0xa652, 2892, 1},\n\n {0x0150, 285, 1},\n\n {0x1f50, 84, 2},\n\n {0x017b, 348, 1},\n\n {0x1e4e, 1829, 1},\n\n {0x0050, 43, 1},\n\n {0x014e, 282, 1},\n\n {0xa750, 3042, 1},\n\n {0xab7b, 1481, 1},\n\n {0xa77b, 3093, 1},\n\n {0x004e, 37, 1},\n\n {0x0554, 1439, 1},\n\n {0xa74e, 3039, 1},\n\n {0x1e48, 1820, 1},\n {0xffffffff, -1, 0},\n\n {0x216b, 2325, 1},\n\n {0x1f48, 2172, 1},\n\n {0xa650, 2889, 1},\n\n {0x0552, 1433, 1},\n\n {0x0048, 21, 1},\n {0xffffffff, -1, 0},\n\n {0xa748, 3030, 1},\n\n {0xa64e, 2886, 1},\n\n {0x0532, 1337, 1},\n\n {0x1041e, 3327, 1},\n\n {0x1e1e, 1757, 1},\n\n {0x041e, 932, 1},\n\n {0x011e, 216, 1},\n\n {0x118b7, 3579, 1},\n\n {0x2c1e, 2511, 1},\n {0xffffffff, -1, 0},\n\n {0xa648, 2877, 1},\n\n {0x1ff9, 2253, 1},\n {0xffffffff, -1, 0},\n\n {0x03f9, 878, 1},\n\n {0x0550, 1427, 1},\n\n {0x10412, 3291, 1},\n\n {0x1e12, 1739, 1},\n\n {0x0412, 896, 1},\n\n {0x0112, 198, 1},\n\n {0x054e, 1421, 1},\n\n {0x2c12, 2475, 1},\n\n {0x10410, 3285, 1},\n\n {0x1e10, 1736, 1},\n\n {0x0410, 890, 1},\n\n {0x0110, 195, 1},\n {0xffffffff, -1, 0},\n\n {0x2c10, 2469, 1},\n\n {0x2132, 2289, 1},\n\n {0x0548, 1403, 1},\n\n {0x1ef8, 2070, 1},\n\n {0x04f8, 1250, 1},\n\n {0x01f8, 490, 1},\n\n {0x1ff8, 2250, 1},\n\n {0x0220, 381, 1},\n\n {0x1ee2, 2037, 1},\n\n {0x04e2, 1217, 1},\n\n {0x01e2, 462, 1},\n\n {0x1fe2, 36, 3},\n\n {0x2ce2, 2733, 1},\n\n {0x03e2, 857, 1},\n\n {0x051e, 1307, 1},\n\n {0x1ede, 2031, 1},\n\n {0x04de, 1211, 1},\n\n {0x01de, 456, 1},\n {0xffffffff, -1, 0},\n\n {0x2cde, 2727, 1},\n\n {0x03de, 851, 1},\n\n {0x00de, 165, 1},\n\n {0x1f69, 2205, 1},\n\n {0x2c69, 2574, 1},\n\n {0x1eda, 2025, 1},\n\n {0x04da, 1205, 1},\n\n {0x0512, 1289, 1},\n\n {0x1fda, 2244, 1},\n\n {0x2cda, 2721, 1},\n\n {0x03da, 845, 1},\n\n {0x00da, 153, 1},\n {0xffffffff, -1, 0},\n\n {0x0510, 1286, 1},\n\n {0x1ed8, 2022, 1},\n\n {0x04d8, 1202, 1},\n {0xffffffff, -1, 0},\n\n {0x1fd8, 2274, 1},\n\n {0x2cd8, 2718, 1},\n\n {0x03d8, 842, 1},\n\n {0x00d8, 147, 1},\n\n {0x1ed6, 2019, 1},\n\n {0x04d6, 1199, 1},\n {0xffffffff, -1, 0},\n\n {0x1fd6, 76, 2},\n\n {0x2cd6, 2715, 1},\n\n {0x03d6, 792, 1},\n\n {0x00d6, 144, 1},\n\n {0x1ec8, 1998, 1},\n {0xffffffff, -1, 0},\n\n {0x01c8, 421, 1},\n\n {0x1fc8, 2232, 1},\n\n {0x2cc8, 2694, 1},\n\n {0xff32, 3210, 1},\n\n {0x00c8, 102, 1},\n\n {0x04c7, 1175, 1},\n\n {0x01c7, 421, 1},\n\n {0x1fc7, 15, 3},\n\n {0x1ec0, 1986, 1},\n\n {0x04c0, 1187, 1},\n\n {0x00c7, 99, 1},\n {0xffffffff, -1, 0},\n\n {0x2cc0, 2682, 1},\n\n {0x0179, 345, 1},\n\n {0x00c0, 77, 1},\n\n {0x0232, 574, 1},\n\n {0x01b3, 402, 1},\n\n {0x1fb3, 62, 2},\n\n {0xab79, 1475, 1},\n\n {0xa779, 3090, 1},\n\n {0x10c7, 2859, 1},\n\n {0xabb3, 1649, 1},\n\n {0xa7b3, 3156, 1},\n\n {0x1fa5, 234, 2},\n\n {0x10c0, 2841, 1},\n\n {0x03a5, 807, 1},\n {0xffffffff, -1, 0},\n\n {0xaba5, 1607, 1},\n\n {0x01b1, 691, 1},\n\n {0x10ca5, 3468, 1},\n\n {0x10b3, 2802, 1},\n\n {0x2169, 2319, 1},\n\n {0x024e, 601, 1},\n\n {0xabb1, 1643, 1},\n\n {0xa7b1, 682, 1},\n\n {0x10cb1, 3504, 1},\n\n {0x10a5, 2760, 1},\n {0xffffffff, -1, 0},\n\n {0x01af, 399, 1},\n\n {0x1faf, 244, 2},\n {0xffffffff, -1, 0},\n\n {0x0248, 592, 1},\n\n {0x10b1, 2796, 1},\n\n {0xabaf, 1637, 1},\n\n {0x1fad, 234, 2},\n\n {0x10caf, 3498, 1},\n\n {0x04cd, 1184, 1},\n\n {0x01cd, 429, 1},\n\n {0xabad, 1631, 1},\n\n {0xa7ad, 658, 1},\n\n {0x10cad, 3492, 1},\n\n {0x00cd, 117, 1},\n\n {0x10af, 2790, 1},\n\n {0x021e, 547, 1},\n\n {0x1fa3, 224, 2},\n {0xffffffff, -1, 0},\n\n {0x03a3, 800, 1},\n\n {0x10ad, 2784, 1},\n\n {0xaba3, 1601, 1},\n {0xffffffff, -1, 0},\n\n {0x10ca3, 3462, 1},\n\n {0x10cd, 2862, 1},\n\n {0x1fa1, 214, 2},\n\n {0x24b7, 2346, 1},\n\n {0x03a1, 796, 1},\n\n {0x0212, 529, 1},\n\n {0xaba1, 1595, 1},\n\n {0x10a3, 2754, 1},\n\n {0x10ca1, 3456, 1},\n\n {0x01d3, 438, 1},\n\n {0x1fd3, 25, 3},\n\n {0x0210, 526, 1},\n {0xffffffff, -1, 0},\n\n {0x00d3, 135, 1},\n\n {0x1e97, 34, 2},\n\n {0x10a1, 2748, 1},\n\n {0x0197, 649, 1},\n\n {0x1f97, 204, 2},\n {0xffffffff, -1, 0},\n\n {0x0397, 759, 1},\n\n {0x1041d, 3324, 1},\n\n {0xab97, 1565, 1},\n\n {0x041d, 929, 1},\n\n {0x10c97, 3426, 1},\n\n {0x1f1d, 2121, 1},\n\n {0x2c1d, 2508, 1},\n\n {0x1e72, 1884, 1},\n\n {0x0472, 1061, 1},\n\n {0x0172, 336, 1},\n\n {0x118b3, 3567, 1},\n\n {0x2c72, 2580, 1},\n\n {0x0372, 712, 1},\n\n {0x1041b, 3318, 1},\n\n {0xab72, 1454, 1},\n\n {0x041b, 923, 1},\n\n {0x118a5, 3525, 1},\n\n {0x1f1b, 2115, 1},\n\n {0x2c1b, 2502, 1},\n\n {0x1e70, 1881, 1},\n\n {0x0470, 1058, 1},\n\n {0x0170, 333, 1},\n\n {0x118b1, 3561, 1},\n\n {0x2c70, 610, 1},\n\n {0x0370, 709, 1},\n\n {0x1e46, 1817, 1},\n\n {0xab70, 1448, 1},\n\n {0x1e66, 1866, 1},\n\n {0x0466, 1043, 1},\n\n {0x0166, 318, 1},\n\n {0x1e44, 1814, 1},\n\n {0x0046, 15, 1},\n\n {0x118af, 3555, 1},\n\n {0xa746, 3027, 1},\n {0xffffffff, -1, 0},\n\n {0xa766, 3075, 1},\n\n {0x0044, 9, 1},\n\n {0x118ad, 3549, 1},\n\n {0xa744, 3024, 1},\n\n {0x1e7a, 1896, 1},\n\n {0x047a, 1073, 1},\n\n {0x1e3a, 1799, 1},\n {0xffffffff, -1, 0},\n\n {0xa646, 2874, 1},\n\n {0x1f3a, 2154, 1},\n\n {0xa666, 2922, 1},\n\n {0xab7a, 1478, 1},\n\n {0x118a3, 3519, 1},\n\n {0xa644, 2871, 1},\n\n {0xa73a, 3009, 1},\n {0xffffffff, -1, 0},\n\n {0x1ef4, 2064, 1},\n\n {0x04f4, 1244, 1},\n\n {0x01f4, 487, 1},\n\n {0x1ff4, 101, 2},\n\n {0x118a1, 3513, 1},\n\n {0x03f4, 762, 1},\n\n {0x1eec, 2052, 1},\n\n {0x04ec, 1232, 1},\n\n {0x01ec, 477, 1},\n\n {0x1fec, 2286, 1},\n\n {0x0546, 1397, 1},\n\n {0x03ec, 872, 1},\n {0xffffffff, -1, 0},\n\n {0x013f, 261, 1},\n\n {0x1f3f, 2169, 1},\n\n {0x0544, 1391, 1},\n\n {0x1eea, 2049, 1},\n\n {0x04ea, 1229, 1},\n\n {0x01ea, 474, 1},\n\n {0x1fea, 2256, 1},\n {0xffffffff, -1, 0},\n\n {0x03ea, 869, 1},\n\n {0x1ee8, 2046, 1},\n\n {0x04e8, 1226, 1},\n\n {0x01e8, 471, 1},\n\n {0x1fe8, 2280, 1},\n\n {0x053a, 1361, 1},\n\n {0x03e8, 866, 1},\n\n {0x1ee6, 2043, 1},\n\n {0x04e6, 1223, 1},\n\n {0x01e6, 468, 1},\n\n {0x1fe6, 88, 2},\n\n {0x1f4b, 2181, 1},\n\n {0x03e6, 863, 1},\n\n {0x1e5e, 1853, 1},\n\n {0x004b, 27, 1},\n\n {0x015e, 306, 1},\n\n {0x2166, 2310, 1},\n\n {0x1ee4, 2040, 1},\n\n {0x04e4, 1220, 1},\n\n {0x01e4, 465, 1},\n\n {0x1fe4, 80, 2},\n\n {0xa75e, 3063, 1},\n\n {0x03e4, 860, 1},\n\n {0x1ee0, 2034, 1},\n\n {0x04e0, 1214, 1},\n\n {0x01e0, 459, 1},\n\n {0x053f, 1376, 1},\n\n {0x2ce0, 2730, 1},\n\n {0x03e0, 854, 1},\n\n {0x1edc, 2028, 1},\n\n {0x04dc, 1208, 1},\n\n {0xa65e, 2910, 1},\n {0xffffffff, -1, 0},\n\n {0x2cdc, 2724, 1},\n\n {0x03dc, 848, 1},\n\n {0x00dc, 159, 1},\n\n {0x1ed0, 2010, 1},\n\n {0x04d0, 1190, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x2cd0, 2706, 1},\n\n {0x03d0, 742, 1},\n\n {0x00d0, 126, 1},\n\n {0x1ecc, 2004, 1},\n\n {0x054b, 1412, 1},\n {0xffffffff, -1, 0},\n\n {0x1fcc, 71, 2},\n\n {0x2ccc, 2700, 1},\n\n {0x1ec6, 1995, 1},\n\n {0x00cc, 114, 1},\n {0xffffffff, -1, 0},\n\n {0x1fc6, 67, 2},\n\n {0x2cc6, 2691, 1},\n\n {0x24c8, 2397, 1},\n\n {0x00c6, 96, 1},\n\n {0x04c5, 1172, 1},\n\n {0x01c5, 417, 1},\n {0xffffffff, -1, 0},\n\n {0x1fbb, 2229, 1},\n\n {0x24c7, 2394, 1},\n\n {0x00c5, 92, 1},\n\n {0x1fb9, 2271, 1},\n\n {0xabbb, 1673, 1},\n\n {0x24c0, 2373, 1},\n\n {0x04c3, 1169, 1},\n\n {0xabb9, 1667, 1},\n\n {0x1fc3, 71, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x00c3, 86, 1},\n\n {0x10c5, 2856, 1},\n\n {0x10bb, 2826, 1},\n\n {0x1ed4, 2016, 1},\n\n {0x04d4, 1196, 1},\n\n {0x10b9, 2820, 1},\n\n {0x13fc, 1700, 1},\n\n {0x2cd4, 2712, 1},\n\n {0x0246, 589, 1},\n\n {0x00d4, 138, 1},\n\n {0x10c3, 2850, 1},\n {0xffffffff, -1, 0},\n\n {0xff3a, 3234, 1},\n\n {0x0244, 688, 1},\n\n {0x019f, 670, 1},\n\n {0x1f9f, 204, 2},\n {0xffffffff, -1, 0},\n\n {0x039f, 789, 1},\n {0xffffffff, -1, 0},\n\n {0xab9f, 1589, 1},\n {0xffffffff, -1, 0},\n\n {0x10c9f, 3450, 1},\n\n {0x019d, 667, 1},\n\n {0x1f9d, 194, 2},\n\n {0x023a, 2565, 1},\n\n {0x039d, 783, 1},\n\n {0x1e5a, 1847, 1},\n\n {0xab9d, 1583, 1},\n\n {0x015a, 300, 1},\n\n {0x10c9d, 3444, 1},\n\n {0x1e9b, 1856, 1},\n\n {0x24cd, 2412, 1},\n\n {0x005a, 74, 1},\n\n {0x1f9b, 184, 2},\n\n {0xa75a, 3057, 1},\n\n {0x039b, 776, 1},\n\n {0x1ece, 2007, 1},\n\n {0xab9b, 1577, 1},\n\n {0x1e99, 42, 2},\n\n {0x10c9b, 3438, 1},\n\n {0x2cce, 2703, 1},\n\n {0x1f99, 174, 2},\n\n {0x00ce, 120, 1},\n\n {0x0399, 767, 1},\n\n {0xa65a, 2904, 1},\n\n {0xab99, 1571, 1},\n {0xffffffff, -1, 0},\n\n {0x10c99, 3432, 1},\n\n {0x0193, 634, 1},\n\n {0x1f93, 184, 2},\n\n {0x1e58, 1844, 1},\n\n {0x0393, 746, 1},\n\n {0x0158, 297, 1},\n\n {0xab93, 1553, 1},\n {0xffffffff, -1, 0},\n\n {0x10c93, 3414, 1},\n\n {0x0058, 68, 1},\n\n {0x042d, 977, 1},\n\n {0xa758, 3054, 1},\n\n {0x1f2d, 2139, 1},\n\n {0x2c2d, 2556, 1},\n\n {0x118bb, 3591, 1},\n\n {0x0191, 369, 1},\n\n {0x1f91, 174, 2},\n\n {0x118b9, 3585, 1},\n\n {0x0391, 739, 1},\n {0xffffffff, -1, 0},\n\n {0xab91, 1547, 1},\n\n {0xa658, 2901, 1},\n\n {0x10c91, 3408, 1},\n\n {0x018f, 625, 1},\n\n {0x1f8f, 164, 2},\n {0xffffffff, -1, 0},\n\n {0x038f, 836, 1},\n {0xffffffff, -1, 0},\n\n {0xab8f, 1541, 1},\n {0xffffffff, -1, 0},\n\n {0x10c8f, 3402, 1},\n\n {0x018b, 366, 1},\n\n {0x1f8b, 144, 2},\n {0xffffffff, -1, 0},\n\n {0x0187, 363, 1},\n\n {0x1f87, 164, 2},\n\n {0xab8b, 1529, 1},\n\n {0xa78b, 3111, 1},\n\n {0x10c8b, 3390, 1},\n\n {0xab87, 1517, 1},\n\n {0x04c1, 1166, 1},\n\n {0x10c87, 3378, 1},\n\n {0x1e7e, 1902, 1},\n\n {0x047e, 1079, 1},\n {0xffffffff, -1, 0},\n\n {0x00c1, 80, 1},\n\n {0x2c7e, 580, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xab7e, 1490, 1},\n\n {0xa77e, 3096, 1},\n\n {0x1e76, 1890, 1},\n\n {0x0476, 1067, 1},\n\n {0x0176, 342, 1},\n\n {0x1e42, 1811, 1},\n\n {0x10c1, 2844, 1},\n\n {0x0376, 715, 1},\n\n {0x1e36, 1793, 1},\n\n {0xab76, 1466, 1},\n\n {0x0136, 249, 1},\n\n {0x0042, 3, 1},\n\n {0x1e3e, 1805, 1},\n\n {0xa742, 3021, 1},\n\n {0x1e38, 1796, 1},\n\n {0x1f3e, 2166, 1},\n\n {0xa736, 3003, 1},\n\n {0x1f38, 2148, 1},\n {0xffffffff, -1, 0},\n\n {0x0587, 105, 2},\n\n {0xa73e, 3015, 1},\n {0xffffffff, -1, 0},\n\n {0xa738, 3006, 1},\n\n {0xa642, 2868, 1},\n\n {0x1e5c, 1850, 1},\n\n {0x1e34, 1790, 1},\n\n {0x015c, 303, 1},\n\n {0x0134, 246, 1},\n\n {0x1ef6, 2067, 1},\n\n {0x04f6, 1247, 1},\n\n {0x01f6, 372, 1},\n\n {0x1ff6, 92, 2},\n\n {0xa75c, 3060, 1},\n\n {0xa734, 3000, 1},\n\n {0x1ef0, 2058, 1},\n\n {0x04f0, 1238, 1},\n\n {0x01f0, 20, 2},\n {0xffffffff, -1, 0},\n\n {0x1e30, 1784, 1},\n\n {0x03f0, 772, 1},\n\n {0x0130, 261, 2},\n\n {0x0542, 1385, 1},\n\n {0xa65c, 2907, 1},\n\n {0x1f83, 144, 2},\n\n {0x0536, 1349, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xab83, 1505, 1},\n\n {0x053e, 1373, 1},\n\n {0x10c83, 3366, 1},\n\n {0x0538, 1355, 1},\n\n {0x1eee, 2055, 1},\n\n {0x04ee, 1235, 1},\n\n {0x01ee, 480, 1},\n\n {0x1f8d, 154, 2},\n {0xffffffff, -1, 0},\n\n {0x03ee, 875, 1},\n {0xffffffff, -1, 0},\n\n {0xab8d, 1535, 1},\n\n {0xa78d, 643, 1},\n\n {0x10c8d, 3396, 1},\n\n {0x0534, 1343, 1},\n\n {0x0181, 613, 1},\n\n {0x1f81, 134, 2},\n\n {0x013d, 258, 1},\n\n {0x1f3d, 2163, 1},\n {0xffffffff, -1, 0},\n\n {0xab81, 1499, 1},\n\n {0x017f, 52, 1},\n\n {0x10c81, 3360, 1},\n\n {0x2c7f, 583, 1},\n\n {0x037f, 881, 1},\n\n {0xff2d, 3195, 1},\n\n {0xab7f, 1493, 1},\n\n {0x1e74, 1887, 1},\n\n {0x0474, 1064, 1},\n\n {0x0174, 339, 1},\n\n {0x1e3c, 1802, 1},\n\n {0x0149, 46, 2},\n\n {0x1f49, 2175, 1},\n\n {0x1f3c, 2160, 1},\n\n {0xab74, 1460, 1},\n\n {0x0049, 3606, 1},\n\n {0x0143, 267, 1},\n\n {0x24cc, 2409, 1},\n\n {0xa73c, 3012, 1},\n {0xffffffff, -1, 0},\n\n {0x0043, 6, 1},\n\n {0x0141, 264, 1},\n\n {0x24c6, 2391, 1},\n\n {0x013b, 255, 1},\n\n {0x1f3b, 2157, 1},\n\n {0x0041, 0, 1},\n\n {0x0139, 252, 1},\n\n {0x1f39, 2151, 1},\n\n {0x24c5, 2388, 1},\n\n {0x24bb, 2358, 1},\n\n {0x13fa, 1694, 1},\n\n {0x053d, 1370, 1},\n\n {0x24b9, 2352, 1},\n\n {0x0429, 965, 1},\n\n {0x2183, 2340, 1},\n\n {0x1f29, 2127, 1},\n\n {0x2c29, 2544, 1},\n\n {0x24c3, 2382, 1},\n\n {0x10427, 3354, 1},\n\n {0x10425, 3348, 1},\n\n {0x0427, 959, 1},\n\n {0x0425, 953, 1},\n {0xffffffff, -1, 0},\n\n {0x2c27, 2538, 1},\n\n {0x2c25, 2532, 1},\n\n {0x0549, 1406, 1},\n\n {0x053c, 1367, 1},\n\n {0x10423, 3342, 1},\n {0xffffffff, -1, 0},\n\n {0x0423, 947, 1},\n\n {0x0543, 1388, 1},\n {0xffffffff, -1, 0},\n\n {0x2c23, 2526, 1},\n\n {0xff36, 3222, 1},\n {0xffffffff, -1, 0},\n\n {0x0541, 1382, 1},\n\n {0x10421, 3336, 1},\n\n {0x053b, 1364, 1},\n\n {0x0421, 941, 1},\n\n {0xff38, 3228, 1},\n\n {0x0539, 1358, 1},\n\n {0x2c21, 2520, 1},\n\n {0x10419, 3312, 1},\n\n {0x10417, 3306, 1},\n\n {0x0419, 917, 1},\n\n {0x0417, 911, 1},\n\n {0x1f19, 2109, 1},\n\n {0x2c19, 2496, 1},\n\n {0x2c17, 2490, 1},\n\n {0x023e, 2568, 1},\n\n {0xff34, 3216, 1},\n\n {0x10415, 3300, 1},\n\n {0x10413, 3294, 1},\n\n {0x0415, 905, 1},\n\n {0x0413, 899, 1},\n {0xffffffff, -1, 0},\n\n {0x2c15, 2484, 1},\n\n {0x2c13, 2478, 1},\n {0xffffffff, -1, 0},\n\n {0x24ce, 2415, 1},\n\n {0x1040f, 3282, 1},\n {0xffffffff, -1, 0},\n\n {0x040f, 1031, 1},\n\n {0xff30, 3204, 1},\n\n {0x1f0f, 2103, 1},\n\n {0x2c0f, 2466, 1},\n\n {0x1040d, 3276, 1},\n {0xffffffff, -1, 0},\n\n {0x040d, 1025, 1},\n\n {0x0147, 273, 1},\n\n {0x1f0d, 2097, 1},\n\n {0x2c0d, 2460, 1},\n\n {0x1040b, 3270, 1},\n\n {0x0047, 18, 1},\n\n {0x040b, 1019, 1},\n\n {0x0230, 571, 1},\n\n {0x1f0b, 2091, 1},\n\n {0x2c0b, 2454, 1},\n\n {0x10409, 3264, 1},\n\n {0x10405, 3252, 1},\n\n {0x0409, 1013, 1},\n\n {0x0405, 1001, 1},\n\n {0x1f09, 2085, 1},\n\n {0x2c09, 2448, 1},\n\n {0x2c05, 2436, 1},\n\n {0x10403, 3246, 1},\n\n {0x10401, 3240, 1},\n\n {0x0403, 995, 1},\n\n {0x0401, 989, 1},\n {0xffffffff, -1, 0},\n\n {0x2c03, 2430, 1},\n\n {0x2c01, 2424, 1},\n\n {0x13f9, 1691, 1},\n\n {0x042f, 983, 1},\n {0xffffffff, -1, 0},\n\n {0x1f2f, 2145, 1},\n\n {0x1041f, 3330, 1},\n {0xffffffff, -1, 0},\n\n {0x041f, 935, 1},\n\n {0x023d, 378, 1},\n\n {0x10411, 3288, 1},\n\n {0x2c1f, 2514, 1},\n\n {0x0411, 893, 1},\n\n {0x0547, 1400, 1},\n {0xffffffff, -1, 0},\n\n {0x2c11, 2472, 1},\n\n {0x10407, 3258, 1},\n {0xffffffff, -1, 0},\n\n {0x0407, 1007, 1},\n\n {0x24c1, 2376, 1},\n {0xffffffff, -1, 0},\n\n {0x2c07, 2442, 1},\n {0xffffffff, -1, 0},\n\n {0x13f8, 1688, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff39, 3231, 1},\n {0xffffffff, -1, 0},\n\n {0x0243, 354, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x0241, 586, 1},\n\n {0xff29, 3183, 1},\n\n {0x023b, 577, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff27, 3177, 1},\n\n {0xff25, 3171, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff23, 3165, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff21, 3159, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0xfb17, 117, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff2f, 3201, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xfb15, 113, 2},\n\n {0xfb13, 121, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0xfb05, 29, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xfb03, 0, 3},\n\n {0xfb01, 8, 2}\n };\n\n if (0 == 0)\n {\n int key = hash(&code);\n\n if (key <= MAX_HASH_VALUE && key >= 0)\n {\n OnigCodePoint gcode = wordlist[key].code;\n\n if (code == gcode && wordlist[key].index >= 0)\n return &wordlist[key];\n }\n }\n return 0;\n}","lang":"c","vul_type":"cwe-787","target_token_count":25166,"sven_meta":{"func_name":"unicode_unfold_key","file_name":"src/unicode_unfold_key.c","commit_link":"github.com/kkos/oniguruma/commit/166a6c3999bf06b4de0ab4ce6b088a468cc4029f","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#42-21d2d1055117","input":"PHP_FUNCTION(imagegammacorrect)\n{\n\tzval *IM;\n\tgdImagePtr im;\n\tint i;\n\tdouble input, output;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rdd\", &IM, &input, &output) == FAILURE) {\n\t\treturn;\n\t}\n\n\tZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, \"Image\", le_gd);\n\n\tif (gdImageTrueColor(im))\t{\n\t\tint x, y, c;\n\n\t\tfor (y = 0; y < gdImageSY(im); y++)\t{\n\t\t\tfor (x = 0; x < gdImageSX(im); x++)\t{\n\t\t\t\tc = gdImageGetPixel(im, x, y);\n\t\t\t\tgdImageSetPixel(im, x, y,\n\t\t\t\t\tgdTrueColorAlpha(\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetRed(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetGreen(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\tgdTrueColorGetAlpha(c)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tRETURN_TRUE;\n\t}\n\n\tfor (i = 0; i < gdImageColorsTotal(im); i++) {\n\t\tim->red[i] = (int)((pow((pow((im->red[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t\tim->green[i] = (int)((pow((pow((im->green[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t\tim->blue[i] = (int)((pow((pow((im->blue[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t}\n\n\tRETURN_TRUE;\n}","target":"PHP_FUNCTION(imagegammacorrect)\n{\n\tzval *IM;\n\tgdImagePtr im;\n\tint i;\n\tdouble input, output;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rdd\", &IM, &input, &output) == FAILURE) {\n\t\treturn;\n\t}\n\n\tif ( input <= 0.0 || output <= 0.0 ) {\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Gamma values should be positive\");\n\t\tRETURN_FALSE;\n\t}\n\n\tZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, \"Image\", le_gd);\n\n\tif (gdImageTrueColor(im))\t{\n\t\tint x, y, c;\n\n\t\tfor (y = 0; y < gdImageSY(im); y++)\t{\n\t\t\tfor (x = 0; x < gdImageSX(im); x++)\t{\n\t\t\t\tc = gdImageGetPixel(im, x, y);\n\t\t\t\tgdImageSetPixel(im, x, y,\n\t\t\t\t\tgdTrueColorAlpha(\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetRed(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetGreen(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\tgdTrueColorGetAlpha(c)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tRETURN_TRUE;\n\t}\n\n\tfor (i = 0; i < gdImageColorsTotal(im); i++) {\n\t\tim->red[i] = (int)((pow((pow((im->red[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t\tim->green[i] = (int)((pow((pow((im->green[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t\tim->blue[i] = (int)((pow((pow((im->blue[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t}\n\n\tRETURN_TRUE;\n}","lang":"c","vul_type":"cwe-787","target_token_count":541,"sven_meta":{"func_name":"PHP_FUNCTION","file_name":"ext/gd/gd.c","commit_link":"github.com/php/php-src/commit/1bd103df00f49cf4d4ade2cfe3f456ac058a4eae","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#44-b0622fbb6b76","input":"static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *buf, int size)\n{\n int i, j, ret;\n int64_t off;\n int val_1;\n int num_video;\n AVIOContext pb0, *pb = &pb0;\n\n ffio_init_context(pb, buf, size, 0, NULL, NULL, NULL, NULL);\n\n ffio_read_varlen(pb); // track_header_len\n avio_r8(pb); // '1'\n\n val_1 = ffio_read_varlen(pb);\n\n for (i=0;iid = i;\n\n st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;\n st->codecpar->codec_id = AV_CODEC_ID_VP6;\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb);\n avio_r8(pb); // '3'\n avio_r8(pb); // val_7\n num = avio_rl32(pb); // frame_time\n den = avio_rl32(pb); // time_base\n avpriv_set_pts_info(st, 64, num, den);\n st->nb_frames = avio_rl32(pb); // n frames\n st->codecpar->width = avio_rl16(pb); // width\n st->codecpar->height = avio_rl16(pb); // height\n avio_r8(pb); // val_8\n avio_rl32(pb); // val_9\n\n avio_seek(pb, off, SEEK_SET);\n }\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb); // val_10\n avio_r8(pb); // '4'\n viv->num_audio = avio_r8(pb);\n avio_seek(pb, off, SEEK_SET);\n\n if (viv->num_audio != 1)\n av_log(s, AV_LOG_WARNING, \"number of audio tracks %d is not 1\\n\", viv->num_audio);\n\n for(i=0;inum_audio;i++) {\n int q;\n AVStream *st = avformat_new_stream(s, NULL);\n if (!st)\n return AVERROR(ENOMEM);\n\n st->id = num_video + i;\n\n st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;\n st->codecpar->codec_id = AV_CODEC_ID_VORBIS;\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb); // length\n avio_r8(pb); // '5'\n avio_r8(pb); //codec_id\n avio_rl16(pb); //codec_subid\n st->codecpar->channels = avio_rl16(pb); // channels\n st->codecpar->sample_rate = avio_rl32(pb); // sample_rate\n avio_seek(pb, 10, SEEK_CUR); // data_1\n q = avio_r8(pb);\n avio_seek(pb, q, SEEK_CUR); // data_2\n avio_r8(pb); // zeropad\n\n if (avio_tell(pb) < off) {\n int num_data;\n int xd_size = 0;\n int data_len[256];\n int offset = 1;\n uint8_t *p;\n ffio_read_varlen(pb); // val_13\n avio_r8(pb); // '19'\n ffio_read_varlen(pb); // len_3\n num_data = avio_r8(pb);\n for (j = 0; j < num_data; j++) {\n uint64_t len = ffio_read_varlen(pb);\n if (len > INT_MAX/2 - xd_size) {\n return AVERROR_INVALIDDATA;\n }\n data_len[j] = len;\n xd_size += len;\n }\n\n ret = ff_alloc_extradata(st->codecpar, 64 + xd_size + xd_size / 255);\n if (ret < 0)\n return ret;\n\n p = st->codecpar->extradata;\n p[0] = 2;\n\n for (j = 0; j < num_data - 1; j++) {\n unsigned delta = av_xiphlacing(&p[offset], data_len[j]);\n if (delta > data_len[j]) {\n return AVERROR_INVALIDDATA;\n }\n offset += delta;\n }\n\n for (j = 0; j < num_data; j++) {\n int ret = avio_read(pb, &p[offset], data_len[j]);\n if (ret < data_len[j]) {\n st->codecpar->extradata_size = 0;\n av_freep(&st->codecpar->extradata);\n break;\n }\n offset += data_len[j];\n }\n\n if (offset < st->codecpar->extradata_size)\n st->codecpar->extradata_size = offset;\n }\n }\n\n return 0;\n}","target":"static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *buf, int size)\n{\n int i, j, ret;\n int64_t off;\n int val_1;\n int num_video;\n AVIOContext pb0, *pb = &pb0;\n\n ffio_init_context(pb, buf, size, 0, NULL, NULL, NULL, NULL);\n\n ffio_read_varlen(pb); // track_header_len\n avio_r8(pb); // '1'\n\n val_1 = ffio_read_varlen(pb);\n\n for (i=0;iid = i;\n\n st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;\n st->codecpar->codec_id = AV_CODEC_ID_VP6;\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb);\n avio_r8(pb); // '3'\n avio_r8(pb); // val_7\n num = avio_rl32(pb); // frame_time\n den = avio_rl32(pb); // time_base\n avpriv_set_pts_info(st, 64, num, den);\n st->nb_frames = avio_rl32(pb); // n frames\n st->codecpar->width = avio_rl16(pb); // width\n st->codecpar->height = avio_rl16(pb); // height\n avio_r8(pb); // val_8\n avio_rl32(pb); // val_9\n\n avio_seek(pb, off, SEEK_SET);\n }\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb); // val_10\n avio_r8(pb); // '4'\n viv->num_audio = avio_r8(pb);\n avio_seek(pb, off, SEEK_SET);\n\n if (viv->num_audio != 1)\n av_log(s, AV_LOG_WARNING, \"number of audio tracks %d is not 1\\n\", viv->num_audio);\n\n for(i=0;inum_audio;i++) {\n int q;\n AVStream *st = avformat_new_stream(s, NULL);\n if (!st)\n return AVERROR(ENOMEM);\n\n st->id = num_video + i;\n\n st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;\n st->codecpar->codec_id = AV_CODEC_ID_VORBIS;\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb); // length\n avio_r8(pb); // '5'\n avio_r8(pb); //codec_id\n avio_rl16(pb); //codec_subid\n st->codecpar->channels = avio_rl16(pb); // channels\n st->codecpar->sample_rate = avio_rl32(pb); // sample_rate\n avio_seek(pb, 10, SEEK_CUR); // data_1\n q = avio_r8(pb);\n avio_seek(pb, q, SEEK_CUR); // data_2\n avio_r8(pb); // zeropad\n\n if (avio_tell(pb) < off) {\n int num_data;\n int xd_size = 1;\n int data_len[256];\n int offset = 1;\n uint8_t *p;\n ffio_read_varlen(pb); // val_13\n avio_r8(pb); // '19'\n ffio_read_varlen(pb); // len_3\n num_data = avio_r8(pb);\n for (j = 0; j < num_data; j++) {\n uint64_t len = ffio_read_varlen(pb);\n if (len > INT_MAX/2 - xd_size) {\n return AVERROR_INVALIDDATA;\n }\n data_len[j] = len;\n xd_size += len + 1 + len/255;\n }\n\n ret = ff_alloc_extradata(st->codecpar, xd_size);\n if (ret < 0)\n return ret;\n\n p = st->codecpar->extradata;\n p[0] = 2;\n\n for (j = 0; j < num_data - 1; j++) {\n unsigned delta = av_xiphlacing(&p[offset], data_len[j]);\n av_assert0(delta <= xd_size - offset);\n offset += delta;\n }\n\n for (j = 0; j < num_data; j++) {\n int ret = avio_read(pb, &p[offset], data_len[j]);\n if (ret < data_len[j]) {\n st->codecpar->extradata_size = 0;\n av_freep(&st->codecpar->extradata);\n break;\n }\n av_assert0(data_len[j] <= xd_size - offset);\n offset += data_len[j];\n }\n\n if (offset < st->codecpar->extradata_size)\n st->codecpar->extradata_size = offset;\n }\n }\n\n return 0;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1341,"sven_meta":{"func_name":"track_header","file_name":"libavformat/vividas.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/27a99e2c7d450fef15594671eef4465c8a166bd7","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#45-ce6c4f95924c","input":" yaffsfs_istat(TSK_FS_INFO *fs, TSK_FS_ISTAT_FLAG_ENUM flags, FILE * hFile, TSK_INUM_T inum,\n TSK_DADDR_T numblock, int32_t sec_skew)\n{\n TSK_FS_META *fs_meta;\n TSK_FS_FILE *fs_file;\n YAFFSFS_INFO *yfs = (YAFFSFS_INFO *)fs;\n char ls[12];\n YAFFSFS_PRINT_ADDR print;\n char timeBuf[32];\n YaffsCacheObject * obj = NULL;\n YaffsCacheVersion * version = NULL;\n YaffsHeader * header = NULL;\n\n yaffscache_version_find_by_inode(yfs, inum, &version, &obj);\n\n if ((fs_file = tsk_fs_file_open_meta(fs, NULL, inum)) == NULL) {\n return 1;\n }\n fs_meta = fs_file->meta;\n\n tsk_fprintf(hFile, \"inode: %\" PRIuINUM \"\\n\", inum);\n tsk_fprintf(hFile, \"%sAllocated\\n\",\n (fs_meta->flags & TSK_FS_META_FLAG_ALLOC) ? \"\" : \"Not \");\n\n if (fs_meta->link)\n tsk_fprintf(hFile, \"symbolic link to: %s\\n\", fs_meta->link);\n\n tsk_fprintf(hFile, \"uid / gid: %\" PRIuUID \" / %\" PRIuGID \"\\n\",\n fs_meta->uid, fs_meta->gid);\n\n tsk_fs_meta_make_ls(fs_meta, ls, sizeof(ls));\n tsk_fprintf(hFile, \"mode: %s\\n\", ls);\n\n tsk_fprintf(hFile, \"size: %\" PRIdOFF \"\\n\", fs_meta->size);\n tsk_fprintf(hFile, \"num of links: %d\\n\", fs_meta->nlink);\n\n if(version != NULL){\n yaffsfs_read_header(yfs, &header, version->ycv_header_chunk->ycc_offset);\n if(header != NULL){\n tsk_fprintf(hFile, \"Name: %s\\n\", header->name);\n }\n }\n\n if (sec_skew != 0) {\n tsk_fprintf(hFile, \"\\nAdjusted Inode Times:\\n\");\n fs_meta->mtime -= sec_skew;\n fs_meta->atime -= sec_skew;\n fs_meta->ctime -= sec_skew;\n\n tsk_fprintf(hFile, \"Accessed:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->atime, timeBuf));\n tsk_fprintf(hFile, \"File Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->mtime, timeBuf));\n tsk_fprintf(hFile, \"Inode Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->ctime, timeBuf));\n\n fs_meta->mtime += sec_skew;\n fs_meta->atime += sec_skew;\n fs_meta->ctime += sec_skew;\n\n tsk_fprintf(hFile, \"\\nOriginal Inode Times:\\n\");\n }\n else {\n tsk_fprintf(hFile, \"\\nInode Times:\\n\");\n }\n\n tsk_fprintf(hFile, \"Accessed:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->atime, timeBuf));\n tsk_fprintf(hFile, \"File Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->mtime, timeBuf));\n tsk_fprintf(hFile, \"Inode Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->ctime, timeBuf));\n\n if(version != NULL){\n tsk_fprintf(hFile, \"\\nHeader Chunk:\\n\");\n tsk_fprintf(hFile, \"%\" PRIuDADDR \"\\n\", (version->ycv_header_chunk->ycc_offset / (yfs->page_size + yfs->spare_size)));\n }\n\n if (numblock > 0) {\n TSK_OFF_T lower_size = numblock * fs->block_size;\n fs_meta->size = (lower_size < fs_meta->size)?(lower_size):(fs_meta->size);\n }\n tsk_fprintf(hFile, \"\\nData Chunks:\\n\");\n\n\n if (flags & TSK_FS_ISTAT_RUNLIST){\n const TSK_FS_ATTR *fs_attr_default =\n tsk_fs_file_attr_get_type(fs_file,\n TSK_FS_ATTR_TYPE_DEFAULT, 0, 0);\n if (fs_attr_default && (fs_attr_default->flags & TSK_FS_ATTR_NONRES)) {\n if (tsk_fs_attr_print(fs_attr_default, hFile)) {\n tsk_fprintf(hFile, \"\\nError creating run lists \");\n tsk_error_print(hFile);\n tsk_error_reset();\n }\n }\n }\n else {\n print.idx = 0;\n print.hFile = hFile;\n\n if (tsk_fs_file_walk(fs_file, TSK_FS_FILE_WALK_FLAG_AONLY,\n (TSK_FS_FILE_WALK_CB)print_addr_act, (void *)&print)) {\n tsk_fprintf(hFile, \"\\nError reading file: \");\n tsk_error_print(hFile);\n tsk_error_reset();\n }\n else if (print.idx != 0) {\n tsk_fprintf(hFile, \"\\n\");\n }\n }\n\n tsk_fs_file_close(fs_file);\n\n return 0;\n}","target":" yaffsfs_istat(TSK_FS_INFO *fs, TSK_FS_ISTAT_FLAG_ENUM flags, FILE * hFile, TSK_INUM_T inum,\n TSK_DADDR_T numblock, int32_t sec_skew)\n{\n TSK_FS_META *fs_meta;\n TSK_FS_FILE *fs_file;\n YAFFSFS_INFO *yfs = (YAFFSFS_INFO *)fs;\n char ls[12];\n YAFFSFS_PRINT_ADDR print;\n char timeBuf[128];\n YaffsCacheObject * obj = NULL;\n YaffsCacheVersion * version = NULL;\n YaffsHeader * header = NULL;\n\n yaffscache_version_find_by_inode(yfs, inum, &version, &obj);\n\n if ((fs_file = tsk_fs_file_open_meta(fs, NULL, inum)) == NULL) {\n return 1;\n }\n fs_meta = fs_file->meta;\n\n tsk_fprintf(hFile, \"inode: %\" PRIuINUM \"\\n\", inum);\n tsk_fprintf(hFile, \"%sAllocated\\n\",\n (fs_meta->flags & TSK_FS_META_FLAG_ALLOC) ? \"\" : \"Not \");\n\n if (fs_meta->link)\n tsk_fprintf(hFile, \"symbolic link to: %s\\n\", fs_meta->link);\n\n tsk_fprintf(hFile, \"uid / gid: %\" PRIuUID \" / %\" PRIuGID \"\\n\",\n fs_meta->uid, fs_meta->gid);\n\n tsk_fs_meta_make_ls(fs_meta, ls, sizeof(ls));\n tsk_fprintf(hFile, \"mode: %s\\n\", ls);\n\n tsk_fprintf(hFile, \"size: %\" PRIdOFF \"\\n\", fs_meta->size);\n tsk_fprintf(hFile, \"num of links: %d\\n\", fs_meta->nlink);\n\n if(version != NULL){\n yaffsfs_read_header(yfs, &header, version->ycv_header_chunk->ycc_offset);\n if(header != NULL){\n tsk_fprintf(hFile, \"Name: %s\\n\", header->name);\n }\n }\n\n if (sec_skew != 0) {\n tsk_fprintf(hFile, \"\\nAdjusted Inode Times:\\n\");\n fs_meta->mtime -= sec_skew;\n fs_meta->atime -= sec_skew;\n fs_meta->ctime -= sec_skew;\n\n tsk_fprintf(hFile, \"Accessed:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->atime, timeBuf));\n tsk_fprintf(hFile, \"File Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->mtime, timeBuf));\n tsk_fprintf(hFile, \"Inode Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->ctime, timeBuf));\n\n fs_meta->mtime += sec_skew;\n fs_meta->atime += sec_skew;\n fs_meta->ctime += sec_skew;\n\n tsk_fprintf(hFile, \"\\nOriginal Inode Times:\\n\");\n }\n else {\n tsk_fprintf(hFile, \"\\nInode Times:\\n\");\n }\n\n tsk_fprintf(hFile, \"Accessed:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->atime, timeBuf));\n tsk_fprintf(hFile, \"File Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->mtime, timeBuf));\n tsk_fprintf(hFile, \"Inode Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->ctime, timeBuf));\n\n if(version != NULL){\n tsk_fprintf(hFile, \"\\nHeader Chunk:\\n\");\n tsk_fprintf(hFile, \"%\" PRIuDADDR \"\\n\", (version->ycv_header_chunk->ycc_offset / (yfs->page_size + yfs->spare_size)));\n }\n\n if (numblock > 0) {\n TSK_OFF_T lower_size = numblock * fs->block_size;\n fs_meta->size = (lower_size < fs_meta->size)?(lower_size):(fs_meta->size);\n }\n tsk_fprintf(hFile, \"\\nData Chunks:\\n\");\n\n\n if (flags & TSK_FS_ISTAT_RUNLIST){\n const TSK_FS_ATTR *fs_attr_default =\n tsk_fs_file_attr_get_type(fs_file,\n TSK_FS_ATTR_TYPE_DEFAULT, 0, 0);\n if (fs_attr_default && (fs_attr_default->flags & TSK_FS_ATTR_NONRES)) {\n if (tsk_fs_attr_print(fs_attr_default, hFile)) {\n tsk_fprintf(hFile, \"\\nError creating run lists \");\n tsk_error_print(hFile);\n tsk_error_reset();\n }\n }\n }\n else {\n print.idx = 0;\n print.hFile = hFile;\n\n if (tsk_fs_file_walk(fs_file, TSK_FS_FILE_WALK_FLAG_AONLY,\n (TSK_FS_FILE_WALK_CB)print_addr_act, (void *)&print)) {\n tsk_fprintf(hFile, \"\\nError reading file: \");\n tsk_error_print(hFile);\n tsk_error_reset();\n }\n else if (print.idx != 0) {\n tsk_fprintf(hFile, \"\\n\");\n }\n }\n\n tsk_fs_file_close(fs_file);\n\n return 0;\n}","lang":"cpp","vul_type":"cwe-787","target_token_count":1180,"sven_meta":{"func_name":"yaffsfs_istat","file_name":"tsk/fs/yaffs.cpp","commit_link":"github.com/sleuthkit/sleuthkit/commit/459ae818fc8dae717549810150de4d191ce158f1","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#46-2fb4764cdb9e","input":"static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)\n{\n ExceptionInfo\n *exception;\n\n int\n bit;\n\n ssize_t\n x;\n\n register PixelPacket\n *q;\n\n IndexPacket\n index;\n\n register IndexPacket\n *indexes;\n\n exception=(&image->exception);\n switch (bpp)\n {\n case 1: /* Convert bitmap scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-7); x+=8)\n {\n for (bit=0; bit < 8; bit++)\n {\n index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);\n SetPixelIndex(indexes+x+bit,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=0; bit < (ssize_t) (image->columns % 8); bit++)\n {\n index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);\n SetPixelIndex(indexes+x+bit,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n p++;\n }\n if (!SyncAuthenticPixels(image,exception))\n break;\n break;\n }\n case 2: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-1); x+=2)\n {\n index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p) & 0x3);\n SetPixelIndex(indexes+x+1,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if ((image->columns % 4) != 0)\n {\n index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n if ((image->columns % 4) >= 1)\n\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n if ((image->columns % 4) >= 2)\n\n {\n index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n }\n p++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n break;\n }\n\n case 4: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-1); x+=2)\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p) & 0x0f);\n SetPixelIndex(indexes+x+1,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if ((image->columns % 2) != 0)\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n break;\n }\n case 8: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL) break;\n indexes=GetAuthenticIndexQueue(image);\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n index=ConstrainColormapIndex(image,*p);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n break;\n\n case 24: /* Convert DirectColor scanline. */\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(q,ScaleCharToQuantum(*p++));\n SetPixelGreen(q,ScaleCharToQuantum(*p++));\n SetPixelBlue(q,ScaleCharToQuantum(*p++));\n q++;\n }\n if (!SyncAuthenticPixels(image,exception))\n break;\n break;\n }\n}","target":"static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)\n{\n ExceptionInfo\n *exception;\n\n int\n bit;\n\n ssize_t\n x;\n\n register PixelPacket\n *q;\n\n IndexPacket\n index;\n\n register IndexPacket\n *indexes;\n\n exception=(&image->exception);\n switch (bpp)\n {\n case 1: /* Convert bitmap scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-7); x+=8)\n {\n for (bit=0; bit < 8; bit++)\n {\n index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);\n SetPixelIndex(indexes+x+bit,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=0; bit < (ssize_t) (image->columns % 8); bit++)\n {\n index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);\n SetPixelIndex(indexes+x+bit,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n p++;\n }\n if (!SyncAuthenticPixels(image,exception))\n break;\n break;\n }\n case 2: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-1); x+=4)\n {\n index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p) & 0x3);\n SetPixelIndex(indexes+x+1,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if ((image->columns % 4) != 0)\n {\n index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n if ((image->columns % 4) >= 1)\n\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n if ((image->columns % 4) >= 2)\n\n {\n index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n }\n p++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n break;\n }\n\n case 4: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-1); x+=2)\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p) & 0x0f);\n SetPixelIndex(indexes+x+1,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if ((image->columns % 2) != 0)\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n break;\n }\n case 8: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL) break;\n indexes=GetAuthenticIndexQueue(image);\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n index=ConstrainColormapIndex(image,*p);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n break;\n\n case 24: /* Convert DirectColor scanline. */\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(q,ScaleCharToQuantum(*p++));\n SetPixelGreen(q,ScaleCharToQuantum(*p++));\n SetPixelBlue(q,ScaleCharToQuantum(*p++));\n q++;\n }\n if (!SyncAuthenticPixels(image,exception))\n break;\n break;\n }\n}","lang":"c","vul_type":"cwe-787","target_token_count":1451,"sven_meta":{"func_name":"InsertRow","file_name":"coders/wpg.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/b6ae2f9e0ab13343c0281732d479757a8e8979c7","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#48-61fd22b24328","input":"static int decode_frame(AVCodecContext *avctx,\n void *data, int *got_frame,\n AVPacket *avpkt)\n{\n PicContext *s = avctx->priv_data;\n AVFrame *frame = data;\n uint32_t *palette;\n int bits_per_plane, bpp, etype, esize, npal, pos_after_pal;\n int i, x, y, plane, tmp, ret, val;\n\n bytestream2_init(&s->g, avpkt->data, avpkt->size);\n\n if (bytestream2_get_bytes_left(&s->g) < 11)\n return AVERROR_INVALIDDATA;\n\n if (bytestream2_get_le16u(&s->g) != 0x1234)\n return AVERROR_INVALIDDATA;\n\n s->width = bytestream2_get_le16u(&s->g);\n s->height = bytestream2_get_le16u(&s->g);\n bytestream2_skip(&s->g, 4);\n tmp = bytestream2_get_byteu(&s->g);\n bits_per_plane = tmp & 0xF;\n s->nb_planes = (tmp >> 4) + 1;\n bpp = bits_per_plane * s->nb_planes;\n if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {\n avpriv_request_sample(avctx, \"Unsupported bit depth\");\n return AVERROR_PATCHWELCOME;\n }\n\n if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) {\n bytestream2_skip(&s->g, 2);\n etype = bytestream2_get_le16(&s->g);\n esize = bytestream2_get_le16(&s->g);\n if (bytestream2_get_bytes_left(&s->g) < esize)\n return AVERROR_INVALIDDATA;\n } else {\n etype = -1;\n esize = 0;\n }\n\n avctx->pix_fmt = AV_PIX_FMT_PAL8;\n\n if (av_image_check_size(s->width, s->height, 0, avctx) < 0)\n return -1;\n if (s->width != avctx->width && s->height != avctx->height) {\n ret = ff_set_dimensions(avctx, s->width, s->height);\n if (ret < 0)\n return ret;\n }\n\n if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)\n return ret;\n memset(frame->data[0], 0, s->height * frame->linesize[0]);\n frame->pict_type = AV_PICTURE_TYPE_I;\n frame->palette_has_changed = 1;\n\n pos_after_pal = bytestream2_tell(&s->g) + esize;\n palette = (uint32_t*)frame->data[1];\n if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->g) < 6) {\n int idx = bytestream2_get_byte(&s->g);\n npal = 4;\n for (i = 0; i < npal; i++)\n palette[i] = ff_cga_palette[ cga_mode45_index[idx][i] ];\n } else if (etype == 2) {\n npal = FFMIN(esize, 16);\n for (i = 0; i < npal; i++) {\n int pal_idx = bytestream2_get_byte(&s->g);\n palette[i] = ff_cga_palette[FFMIN(pal_idx, 15)];\n }\n } else if (etype == 3) {\n npal = FFMIN(esize, 16);\n for (i = 0; i < npal; i++) {\n int pal_idx = bytestream2_get_byte(&s->g);\n palette[i] = ff_ega_palette[FFMIN(pal_idx, 63)];\n }\n } else if (etype == 4 || etype == 5) {\n npal = FFMIN(esize / 3, 256);\n for (i = 0; i < npal; i++) {\n palette[i] = bytestream2_get_be24(&s->g) << 2;\n palette[i] |= 0xFFU << 24 | palette[i] >> 6 & 0x30303;\n }\n } else {\n if (bpp == 1) {\n npal = 2;\n palette[0] = 0xFF000000;\n palette[1] = 0xFFFFFFFF;\n } else if (bpp == 2) {\n npal = 4;\n for (i = 0; i < npal; i++)\n palette[i] = ff_cga_palette[ cga_mode45_index[0][i] ];\n } else {\n npal = 16;\n memcpy(palette, ff_cga_palette, npal * 4);\n }\n }\n // fill remaining palette entries\n memset(palette + npal, 0, AVPALETTE_SIZE - npal * 4);\n // skip remaining palette bytes\n bytestream2_seek(&s->g, pos_after_pal, SEEK_SET);\n\n val = 0;\n y = s->height - 1;\n if (bytestream2_get_le16(&s->g)) {\n x = 0;\n plane = 0;\n while (bytestream2_get_bytes_left(&s->g) >= 6) {\n int stop_size, marker, t1, t2;\n\n t1 = bytestream2_get_bytes_left(&s->g);\n t2 = bytestream2_get_le16(&s->g);\n stop_size = t1 - FFMIN(t1, t2);\n // ignore uncompressed block size\n bytestream2_skip(&s->g, 2);\n marker = bytestream2_get_byte(&s->g);\n\n while (plane < s->nb_planes &&\n bytestream2_get_bytes_left(&s->g) > stop_size) {\n int run = 1;\n val = bytestream2_get_byte(&s->g);\n if (val == marker) {\n run = bytestream2_get_byte(&s->g);\n if (run == 0)\n run = bytestream2_get_le16(&s->g);\n val = bytestream2_get_byte(&s->g);\n }\n if (!bytestream2_get_bytes_left(&s->g))\n break;\n\n if (bits_per_plane == 8) {\n picmemset_8bpp(s, frame, val, run, &x, &y);\n if (y < 0)\n goto finish;\n } else {\n picmemset(s, frame, val, run, &x, &y, &plane, bits_per_plane);\n }\n }\n }\n\n if (x < avctx->width) {\n int run = (y + 1) * avctx->width - x;\n if (bits_per_plane == 8)\n picmemset_8bpp(s, frame, val, run, &x, &y);\n else\n picmemset(s, frame, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane);\n }\n } else {\n while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) {\n memcpy(frame->data[0] + y * frame->linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g)));\n bytestream2_skip(&s->g, avctx->width);\n y--;\n }\n }\nfinish:\n\n *got_frame = 1;\n return avpkt->size;\n}","target":"static int decode_frame(AVCodecContext *avctx,\n void *data, int *got_frame,\n AVPacket *avpkt)\n{\n PicContext *s = avctx->priv_data;\n AVFrame *frame = data;\n uint32_t *palette;\n int bits_per_plane, bpp, etype, esize, npal, pos_after_pal;\n int i, x, y, plane, tmp, ret, val;\n\n bytestream2_init(&s->g, avpkt->data, avpkt->size);\n\n if (bytestream2_get_bytes_left(&s->g) < 11)\n return AVERROR_INVALIDDATA;\n\n if (bytestream2_get_le16u(&s->g) != 0x1234)\n return AVERROR_INVALIDDATA;\n\n s->width = bytestream2_get_le16u(&s->g);\n s->height = bytestream2_get_le16u(&s->g);\n bytestream2_skip(&s->g, 4);\n tmp = bytestream2_get_byteu(&s->g);\n bits_per_plane = tmp & 0xF;\n s->nb_planes = (tmp >> 4) + 1;\n bpp = bits_per_plane * s->nb_planes;\n if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {\n avpriv_request_sample(avctx, \"Unsupported bit depth\");\n return AVERROR_PATCHWELCOME;\n }\n\n if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) {\n bytestream2_skip(&s->g, 2);\n etype = bytestream2_get_le16(&s->g);\n esize = bytestream2_get_le16(&s->g);\n if (bytestream2_get_bytes_left(&s->g) < esize)\n return AVERROR_INVALIDDATA;\n } else {\n etype = -1;\n esize = 0;\n }\n\n avctx->pix_fmt = AV_PIX_FMT_PAL8;\n\n if (av_image_check_size(s->width, s->height, 0, avctx) < 0)\n return -1;\n if (s->width != avctx->width || s->height != avctx->height) {\n ret = ff_set_dimensions(avctx, s->width, s->height);\n if (ret < 0)\n return ret;\n }\n\n if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)\n return ret;\n memset(frame->data[0], 0, s->height * frame->linesize[0]);\n frame->pict_type = AV_PICTURE_TYPE_I;\n frame->palette_has_changed = 1;\n\n pos_after_pal = bytestream2_tell(&s->g) + esize;\n palette = (uint32_t*)frame->data[1];\n if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->g) < 6) {\n int idx = bytestream2_get_byte(&s->g);\n npal = 4;\n for (i = 0; i < npal; i++)\n palette[i] = ff_cga_palette[ cga_mode45_index[idx][i] ];\n } else if (etype == 2) {\n npal = FFMIN(esize, 16);\n for (i = 0; i < npal; i++) {\n int pal_idx = bytestream2_get_byte(&s->g);\n palette[i] = ff_cga_palette[FFMIN(pal_idx, 15)];\n }\n } else if (etype == 3) {\n npal = FFMIN(esize, 16);\n for (i = 0; i < npal; i++) {\n int pal_idx = bytestream2_get_byte(&s->g);\n palette[i] = ff_ega_palette[FFMIN(pal_idx, 63)];\n }\n } else if (etype == 4 || etype == 5) {\n npal = FFMIN(esize / 3, 256);\n for (i = 0; i < npal; i++) {\n palette[i] = bytestream2_get_be24(&s->g) << 2;\n palette[i] |= 0xFFU << 24 | palette[i] >> 6 & 0x30303;\n }\n } else {\n if (bpp == 1) {\n npal = 2;\n palette[0] = 0xFF000000;\n palette[1] = 0xFFFFFFFF;\n } else if (bpp == 2) {\n npal = 4;\n for (i = 0; i < npal; i++)\n palette[i] = ff_cga_palette[ cga_mode45_index[0][i] ];\n } else {\n npal = 16;\n memcpy(palette, ff_cga_palette, npal * 4);\n }\n }\n // fill remaining palette entries\n memset(palette + npal, 0, AVPALETTE_SIZE - npal * 4);\n // skip remaining palette bytes\n bytestream2_seek(&s->g, pos_after_pal, SEEK_SET);\n\n val = 0;\n y = s->height - 1;\n if (bytestream2_get_le16(&s->g)) {\n x = 0;\n plane = 0;\n while (bytestream2_get_bytes_left(&s->g) >= 6) {\n int stop_size, marker, t1, t2;\n\n t1 = bytestream2_get_bytes_left(&s->g);\n t2 = bytestream2_get_le16(&s->g);\n stop_size = t1 - FFMIN(t1, t2);\n // ignore uncompressed block size\n bytestream2_skip(&s->g, 2);\n marker = bytestream2_get_byte(&s->g);\n\n while (plane < s->nb_planes &&\n bytestream2_get_bytes_left(&s->g) > stop_size) {\n int run = 1;\n val = bytestream2_get_byte(&s->g);\n if (val == marker) {\n run = bytestream2_get_byte(&s->g);\n if (run == 0)\n run = bytestream2_get_le16(&s->g);\n val = bytestream2_get_byte(&s->g);\n }\n if (!bytestream2_get_bytes_left(&s->g))\n break;\n\n if (bits_per_plane == 8) {\n picmemset_8bpp(s, frame, val, run, &x, &y);\n if (y < 0)\n goto finish;\n } else {\n picmemset(s, frame, val, run, &x, &y, &plane, bits_per_plane);\n }\n }\n }\n\n if (x < avctx->width) {\n int run = (y + 1) * avctx->width - x;\n if (bits_per_plane == 8)\n picmemset_8bpp(s, frame, val, run, &x, &y);\n else\n picmemset(s, frame, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane);\n }\n } else {\n while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) {\n memcpy(frame->data[0] + y * frame->linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g)));\n bytestream2_skip(&s->g, avctx->width);\n y--;\n }\n }\nfinish:\n\n *got_frame = 1;\n return avpkt->size;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1779,"sven_meta":{"func_name":"decode_frame","file_name":"libavcodec/pictordec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/8c2ea3030af7b40a3c4275696fb5c76cdb80950a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-079#0-04f62704d43f","input":" def init_settings(self, ipython_app, kernel_manager, contents_manager,\n cluster_manager, session_manager, kernel_spec_manager,\n config_manager,\n log, base_url, default_url, settings_overrides,\n jinja_env_options=None):\n\n _template_path = settings_overrides.get(\n \"template_path\",\n ipython_app.template_file_path,\n )\n if isinstance(_template_path, py3compat.string_types):\n _template_path = (_template_path,)\n template_path = [os.path.expanduser(path) for path in _template_path]\n\n jenv_opt = jinja_env_options if jinja_env_options else {}\n env = Environment(loader=FileSystemLoader(template_path), **jenv_opt)\n \n sys_info = get_sys_info()\n if sys_info['commit_source'] == 'repository':\n # don't cache (rely on 304) when working from master\n version_hash = ''\n else:\n # reset the cache on server restart\n version_hash = datetime.datetime.now().strftime(\"%Y%m%d%H%M%S\")\n\n settings = dict(\n # basics\n log_function=log_request,\n base_url=base_url,\n default_url=default_url,\n template_path=template_path,\n static_path=ipython_app.static_file_path,\n static_handler_class = FileFindHandler,\n static_url_prefix = url_path_join(base_url,'/static/'),\n static_handler_args = {\n # don't cache custom.js\n 'no_cache_paths': [url_path_join(base_url, 'static', 'custom')],\n },\n version_hash=version_hash,\n \n # authentication\n cookie_secret=ipython_app.cookie_secret,\n login_url=url_path_join(base_url,'/login'),\n login_handler_class=ipython_app.login_handler_class,\n logout_handler_class=ipython_app.logout_handler_class,\n password=ipython_app.password,\n\n # managers\n kernel_manager=kernel_manager,\n contents_manager=contents_manager,\n cluster_manager=cluster_manager,\n session_manager=session_manager,\n kernel_spec_manager=kernel_spec_manager,\n config_manager=config_manager,\n\n # IPython stuff\n jinja_template_vars=ipython_app.jinja_template_vars,\n nbextensions_path=ipython_app.nbextensions_path,\n websocket_url=ipython_app.websocket_url,\n mathjax_url=ipython_app.mathjax_url,\n config=ipython_app.config,\n jinja2_env=env,\n terminals_available=False, # Set later if terminals are available\n )\n\n # allow custom overrides for the tornado web app.\n settings.update(settings_overrides)\n return settings","target":" def init_settings(self, ipython_app, kernel_manager, contents_manager,\n cluster_manager, session_manager, kernel_spec_manager,\n config_manager,\n log, base_url, default_url, settings_overrides,\n jinja_env_options=None):\n\n _template_path = settings_overrides.get(\n \"template_path\",\n ipython_app.template_file_path,\n )\n if isinstance(_template_path, py3compat.string_types):\n _template_path = (_template_path,)\n template_path = [os.path.expanduser(path) for path in _template_path]\n\n jenv_opt = {\"autoescape\": True}\n jenv_opt.update(jinja_env_options if jinja_env_options else {})\n\n env = Environment(loader=FileSystemLoader(template_path), **jenv_opt)\n \n sys_info = get_sys_info()\n if sys_info['commit_source'] == 'repository':\n # don't cache (rely on 304) when working from master\n version_hash = ''\n else:\n # reset the cache on server restart\n version_hash = datetime.datetime.now().strftime(\"%Y%m%d%H%M%S\")\n\n settings = dict(\n # basics\n log_function=log_request,\n base_url=base_url,\n default_url=default_url,\n template_path=template_path,\n static_path=ipython_app.static_file_path,\n static_handler_class = FileFindHandler,\n static_url_prefix = url_path_join(base_url,'/static/'),\n static_handler_args = {\n # don't cache custom.js\n 'no_cache_paths': [url_path_join(base_url, 'static', 'custom')],\n },\n version_hash=version_hash,\n \n # authentication\n cookie_secret=ipython_app.cookie_secret,\n login_url=url_path_join(base_url,'/login'),\n login_handler_class=ipython_app.login_handler_class,\n logout_handler_class=ipython_app.logout_handler_class,\n password=ipython_app.password,\n\n # managers\n kernel_manager=kernel_manager,\n contents_manager=contents_manager,\n cluster_manager=cluster_manager,\n session_manager=session_manager,\n kernel_spec_manager=kernel_spec_manager,\n config_manager=config_manager,\n\n # IPython stuff\n jinja_template_vars=ipython_app.jinja_template_vars,\n nbextensions_path=ipython_app.nbextensions_path,\n websocket_url=ipython_app.websocket_url,\n mathjax_url=ipython_app.mathjax_url,\n config=ipython_app.config,\n jinja2_env=env,\n terminals_available=False, # Set later if terminals are available\n )\n\n # allow custom overrides for the tornado web app.\n settings.update(settings_overrides)\n return settings","lang":"python","vul_type":"cwe-079","target_token_count":558,"sven_meta":{"func_name":"init_settings","file_name":"IPython/html/notebookapp.py","commit_link":"github.com/ipython/ipython/commit/3ab41641cf6fce3860c73d5cf4645aa12e1e5892","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#10-dcd7d2696a16","input":"QStandardItem* PeerListWidget::addPeer(const QString& ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)\n{\n int row = m_listModel->rowCount();\n // Adding Peer to peer list\n m_listModel->insertRow(row);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip, Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP_HIDDEN), ip);\n if (m_resolveCountries) {\n const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());\n if (!ico.isNull()) {\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);\n const QString countryName = Net::GeoIPManager::CountryName(peer.country());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), countryName, Qt::ToolTipRole);\n }\n else {\n m_missingFlags.insert(ip);\n }\n }\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), peer.connectionType());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flags());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flagsDescription(), Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), peer.client());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PROGRESS), peer.progress());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payloadDownSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::UP_SPEED), peer.payloadUpSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_DOWN), peer.totalDownload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());\n QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\";\")));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\"\\n\")), Qt::ToolTipRole);\n\n return m_listModel->item(row, PeerListDelegate::IP);\n}","target":"QStandardItem* PeerListWidget::addPeer(const QString& ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)\n{\n int row = m_listModel->rowCount();\n // Adding Peer to peer list\n m_listModel->insertRow(row);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip, Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP_HIDDEN), ip);\n if (m_resolveCountries) {\n const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());\n if (!ico.isNull()) {\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);\n const QString countryName = Net::GeoIPManager::CountryName(peer.country());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), countryName, Qt::ToolTipRole);\n }\n else {\n m_missingFlags.insert(ip);\n }\n }\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), peer.connectionType());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flags());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flagsDescription(), Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), Utils::String::toHtmlEscaped(peer.client()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PROGRESS), peer.progress());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payloadDownSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::UP_SPEED), peer.payloadUpSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_DOWN), peer.totalDownload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());\n QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\";\")));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\"\\n\")), Qt::ToolTipRole);\n\n return m_listModel->item(row, PeerListDelegate::IP);\n}","lang":"cpp","vul_type":"cwe-079","target_token_count":629,"sven_meta":{"func_name":"PeerListWidget::addPeer","file_name":"src/gui/properties/peerlistwidget.cpp","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#15-223341fd9637","input":"bool WddxPacket::recursiveAddVar(const String& varName,\n const Variant& varVariant,\n bool hasVarTag) {\n\n bool isArray = varVariant.isArray();\n bool isObject = varVariant.isObject();\n\n if (isArray || isObject) {\n if (hasVarTag) {\n m_packetString += \"\";\n }\n\n Array varAsArray;\n Object varAsObject = varVariant.toObject();\n if (isArray) varAsArray = varVariant.toArray();\n if (isObject) varAsArray = varAsObject.toArray();\n\n int length = varAsArray.length();\n if (length > 0) {\n ArrayIter it = ArrayIter(varAsArray);\n if (it.first().isString()) isObject = true;\n if (isObject) {\n m_packetString += \"\";\n if (!isArray) {\n m_packetString += \"\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"\";\n }\n } else {\n m_packetString += \"\";\n }\n for (ArrayIter it(varAsArray); it; ++it) {\n Variant key = it.first();\n Variant value = it.second();\n recursiveAddVar(key.toString(), value, isObject);\n }\n if (isObject) {\n m_packetString += \"\";\n }\n else {\n m_packetString += \"\";\n }\n }\n else {\n //empty object\n if (isObject) {\n m_packetString += \"\";\n if (!isArray) {\n m_packetString += \"\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"\";\n }\n m_packetString += \"\";\n }\n }\n if (hasVarTag) {\n m_packetString += \"\";\n }\n return true;\n }\n\n std::string varType = getDataTypeString(varVariant.getType()).data();\n if (!getWddxEncoded(varType, \"\", varName, false).empty()) {\n std::string varValue = varVariant.toString().data();\n if (varType.compare(\"boolean\") == 0) {\n varValue = varVariant.toBoolean() ? \"true\" : \"false\";\n }\n m_packetString += getWddxEncoded(varType, varValue, varName, hasVarTag);\n return true;\n }\n\n return false;\n}","target":"bool WddxPacket::recursiveAddVar(const String& varName,\n const Variant& varVariant,\n bool hasVarTag) {\n\n bool isArray = varVariant.isArray();\n bool isObject = varVariant.isObject();\n\n if (isArray || isObject) {\n if (hasVarTag) {\n m_packetString += \"\";\n }\n\n Array varAsArray;\n Object varAsObject = varVariant.toObject();\n if (isArray) varAsArray = varVariant.toArray();\n if (isObject) varAsArray = varAsObject.toArray();\n\n int length = varAsArray.length();\n if (length > 0) {\n ArrayIter it = ArrayIter(varAsArray);\n if (it.first().isString()) isObject = true;\n if (isObject) {\n m_packetString += \"\";\n if (!isArray) {\n m_packetString += \"\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"\";\n }\n } else {\n m_packetString += \"\";\n }\n for (ArrayIter it(varAsArray); it; ++it) {\n Variant key = it.first();\n Variant value = it.second();\n recursiveAddVar(key.toString(), value, isObject);\n }\n if (isObject) {\n m_packetString += \"\";\n }\n else {\n m_packetString += \"\";\n }\n }\n else {\n //empty object\n if (isObject) {\n m_packetString += \"\";\n if (!isArray) {\n m_packetString += \"\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"\";\n }\n m_packetString += \"\";\n }\n }\n if (hasVarTag) {\n m_packetString += \"\";\n }\n return true;\n }\n\n std::string varType = getDataTypeString(varVariant.getType()).data();\n if (!getWddxEncoded(varType, \"\", varName, false).empty()) {\n std::string varValue;\n if (varType.compare(\"boolean\") == 0) {\n varValue = varVariant.toBoolean() ? \"true\" : \"false\";\n } else {\n varValue = StringUtil::HtmlEncode(varVariant.toString(),\n StringUtil::QuoteStyle::Double,\n \"UTF-8\", false, false).toCppString();\n }\n m_packetString += getWddxEncoded(varType, varValue, varName, hasVarTag);\n return true;\n }\n\n return false;\n}","lang":"cpp","vul_type":"cwe-079","target_token_count":605,"sven_meta":{"func_name":"HPHP::WddxPacket::recursiveAddVar","file_name":"hphp/runtime/ext/wddx/ext_wddx.cpp","commit_link":"github.com/facebook/hhvm/commit/324701c9fd31beb4f070f1b7ef78b115fbdfec34","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#19-9f4c6cd26f57","input":"@login_required(redirect_field_name='', login_url='/403')\n@require_POST\n@require_AJAX\n@transaction.atomic\ndef batch_edit_translations(request):\n \"\"\"Perform an action on a list of translations.\n\n Available actions are defined in `ACTIONS_FN_MAP`. Arguments to this view\n are defined in `models.BatchActionsForm`.\n\n \"\"\"\n form = forms.BatchActionsForm(request.POST)\n if not form.is_valid():\n return HttpResponseBadRequest(form.errors.as_json())\n\n locale = get_object_or_404(Locale, code=form.cleaned_data['locale'])\n entities = Entity.objects.filter(pk__in=form.cleaned_data['entities'])\n\n if not entities.exists():\n return JsonResponse({'count': 0})\n\n # Batch editing is only available to translators. Check if user has\n # translate permissions for all of the projects in passed entities.\n # Also make sure projects are not enabled in read-only mode for a locale.\n projects_pk = entities.values_list('resource__project__pk', flat=True)\n projects = Project.objects.filter(pk__in=projects_pk.distinct())\n\n for project in projects:\n if (\n not request.user.can_translate(project=project, locale=locale)\n or readonly_exists(projects, locale)\n ):\n return HttpResponseForbidden(\n \"Forbidden: You don't have permission for batch editing\"\n )\n\n # Find all impacted active translations, including plural forms.\n active_translations = Translation.objects.filter(\n active=True,\n locale=locale,\n entity__in=entities,\n )\n\n # Execute the actual action.\n action_function = ACTIONS_FN_MAP[form.cleaned_data['action']]\n action_status = action_function(\n form,\n request.user,\n active_translations,\n locale,\n )\n\n if action_status.get('error'):\n return JsonResponse(action_status)\n\n invalid_translation_count = len(action_status.get('invalid_translation_pks', []))\n if action_status['count'] == 0:\n return JsonResponse({\n 'count': 0,\n 'invalid_translation_count': invalid_translation_count,\n })\n\n update_stats(action_status['translated_resources'], locale)\n mark_changed_translation(action_status['changed_entities'], locale)\n\n # Update latest translation.\n if action_status['latest_translation_pk']:\n Translation.objects.get(\n pk=action_status['latest_translation_pk']\n ).update_latest_translation()\n\n update_translation_memory(\n action_status['changed_translation_pks'],\n project,\n locale\n )\n\n return JsonResponse({\n 'count': action_status['count'],\n 'invalid_translation_count': invalid_translation_count,\n })","target":"@login_required(redirect_field_name='', login_url='/403')\n@require_POST\n@require_AJAX\n@transaction.atomic\ndef batch_edit_translations(request):\n \"\"\"Perform an action on a list of translations.\n\n Available actions are defined in `ACTIONS_FN_MAP`. Arguments to this view\n are defined in `models.BatchActionsForm`.\n\n \"\"\"\n form = forms.BatchActionsForm(request.POST)\n if not form.is_valid():\n return HttpResponseBadRequest(form.errors.as_json(escape_html=True))\n\n locale = get_object_or_404(Locale, code=form.cleaned_data['locale'])\n entities = Entity.objects.filter(pk__in=form.cleaned_data['entities'])\n\n if not entities.exists():\n return JsonResponse({'count': 0})\n\n # Batch editing is only available to translators. Check if user has\n # translate permissions for all of the projects in passed entities.\n # Also make sure projects are not enabled in read-only mode for a locale.\n projects_pk = entities.values_list('resource__project__pk', flat=True)\n projects = Project.objects.filter(pk__in=projects_pk.distinct())\n\n for project in projects:\n if (\n not request.user.can_translate(project=project, locale=locale)\n or readonly_exists(projects, locale)\n ):\n return HttpResponseForbidden(\n \"Forbidden: You don't have permission for batch editing\"\n )\n\n # Find all impacted active translations, including plural forms.\n active_translations = Translation.objects.filter(\n active=True,\n locale=locale,\n entity__in=entities,\n )\n\n # Execute the actual action.\n action_function = ACTIONS_FN_MAP[form.cleaned_data['action']]\n action_status = action_function(\n form,\n request.user,\n active_translations,\n locale,\n )\n\n if action_status.get('error'):\n return JsonResponse(action_status)\n\n invalid_translation_count = len(action_status.get('invalid_translation_pks', []))\n if action_status['count'] == 0:\n return JsonResponse({\n 'count': 0,\n 'invalid_translation_count': invalid_translation_count,\n })\n\n update_stats(action_status['translated_resources'], locale)\n mark_changed_translation(action_status['changed_entities'], locale)\n\n # Update latest translation.\n if action_status['latest_translation_pk']:\n Translation.objects.get(\n pk=action_status['latest_translation_pk']\n ).update_latest_translation()\n\n update_translation_memory(\n action_status['changed_translation_pks'],\n project,\n locale\n )\n\n return JsonResponse({\n 'count': action_status['count'],\n 'invalid_translation_count': invalid_translation_count,\n })","lang":"python","vul_type":"cwe-079","target_token_count":540,"sven_meta":{"func_name":"batch_edit_translations","file_name":"pontoon/batch/views.py","commit_link":"github.com/onefork/pontoon-sr/commit/fc07ed9c68e08d41f74c078b4e7727f1a0888be8","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#25-a78acea86ee7","input":" def __init__(self, *args, **kwargs):\n \"\"\"\n Takes two additional keyword arguments:\n\n :param cartpos: The cart position the form should be for\n :param event: The event this belongs to\n \"\"\"\n cartpos = self.cartpos = kwargs.pop('cartpos', None)\n orderpos = self.orderpos = kwargs.pop('orderpos', None)\n pos = cartpos or orderpos\n item = pos.item\n questions = pos.item.questions_to_ask\n event = kwargs.pop('event')\n\n super().__init__(*args, **kwargs)\n\n if item.admission and event.settings.attendee_names_asked:\n self.fields['attendee_name_parts'] = NamePartsFormField(\n max_length=255,\n required=event.settings.attendee_names_required,\n scheme=event.settings.name_scheme,\n label=_('Attendee name'),\n initial=(cartpos.attendee_name_parts if cartpos else orderpos.attendee_name_parts),\n )\n if item.admission and event.settings.attendee_emails_asked:\n self.fields['attendee_email'] = forms.EmailField(\n required=event.settings.attendee_emails_required,\n label=_('Attendee email'),\n initial=(cartpos.attendee_email if cartpos else orderpos.attendee_email)\n )\n\n for q in questions:\n # Do we already have an answer? Provide it as the initial value\n answers = [a for a in pos.answerlist if a.question_id == q.id]\n if answers:\n initial = answers[0]\n else:\n initial = None\n tz = pytz.timezone(event.settings.timezone)\n help_text = rich_text(q.help_text)\n if q.type == Question.TYPE_BOOLEAN:\n if q.required:\n # For some reason, django-bootstrap3 does not set the required attribute\n # itself.\n widget = forms.CheckboxInput(attrs={'required': 'required'})\n else:\n widget = forms.CheckboxInput()\n\n if initial:\n initialbool = (initial.answer == \"True\")\n else:\n initialbool = False\n\n field = forms.BooleanField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=initialbool, widget=widget,\n )\n elif q.type == Question.TYPE_NUMBER:\n field = forms.DecimalField(\n label=q.question, required=q.required,\n help_text=q.help_text,\n initial=initial.answer if initial else None,\n min_value=Decimal('0.00'),\n )\n elif q.type == Question.TYPE_STRING:\n field = forms.CharField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_TEXT:\n field = forms.CharField(\n label=q.question, required=q.required,\n help_text=help_text,\n widget=forms.Textarea,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE:\n field = forms.ModelChoiceField(\n queryset=q.options,\n label=q.question, required=q.required,\n help_text=help_text,\n widget=forms.Select,\n empty_label='',\n initial=initial.options.first() if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE_MULTIPLE:\n field = forms.ModelMultipleChoiceField(\n queryset=q.options,\n label=q.question, required=q.required,\n help_text=help_text,\n widget=forms.CheckboxSelectMultiple,\n initial=initial.options.all() if initial else None,\n )\n elif q.type == Question.TYPE_FILE:\n field = forms.FileField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=initial.file if initial else None,\n widget=UploadedFileWidget(position=pos, event=event, answer=initial),\n )\n elif q.type == Question.TYPE_DATE:\n field = forms.DateField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).date() if initial and initial.answer else None,\n widget=DatePickerWidget(),\n )\n elif q.type == Question.TYPE_TIME:\n field = forms.TimeField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).time() if initial and initial.answer else None,\n widget=TimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n elif q.type == Question.TYPE_DATETIME:\n field = SplitDateTimeField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).astimezone(tz) if initial and initial.answer else None,\n widget=SplitDateTimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n field.question = q\n if answers:\n # Cache the answer object for later use\n field.answer = answers[0]\n self.fields['question_%s' % q.id] = field\n\n responses = question_form_fields.send(sender=event, position=pos)\n data = pos.meta_info_data\n for r, response in sorted(responses, key=lambda r: str(r[0])):\n for key, value in response.items():\n # We need to be this explicit, since OrderedDict.update does not retain ordering\n self.fields[key] = value\n value.initial = data.get('question_form_data', {}).get(key)","target":" def __init__(self, *args, **kwargs):\n \"\"\"\n Takes two additional keyword arguments:\n\n :param cartpos: The cart position the form should be for\n :param event: The event this belongs to\n \"\"\"\n cartpos = self.cartpos = kwargs.pop('cartpos', None)\n orderpos = self.orderpos = kwargs.pop('orderpos', None)\n pos = cartpos or orderpos\n item = pos.item\n questions = pos.item.questions_to_ask\n event = kwargs.pop('event')\n\n super().__init__(*args, **kwargs)\n\n if item.admission and event.settings.attendee_names_asked:\n self.fields['attendee_name_parts'] = NamePartsFormField(\n max_length=255,\n required=event.settings.attendee_names_required,\n scheme=event.settings.name_scheme,\n label=_('Attendee name'),\n initial=(cartpos.attendee_name_parts if cartpos else orderpos.attendee_name_parts),\n )\n if item.admission and event.settings.attendee_emails_asked:\n self.fields['attendee_email'] = forms.EmailField(\n required=event.settings.attendee_emails_required,\n label=_('Attendee email'),\n initial=(cartpos.attendee_email if cartpos else orderpos.attendee_email)\n )\n\n for q in questions:\n # Do we already have an answer? Provide it as the initial value\n answers = [a for a in pos.answerlist if a.question_id == q.id]\n if answers:\n initial = answers[0]\n else:\n initial = None\n tz = pytz.timezone(event.settings.timezone)\n help_text = rich_text(q.help_text)\n label = escape(q.question) # django-bootstrap3 calls mark_safe\n if q.type == Question.TYPE_BOOLEAN:\n if q.required:\n # For some reason, django-bootstrap3 does not set the required attribute\n # itself.\n widget = forms.CheckboxInput(attrs={'required': 'required'})\n else:\n widget = forms.CheckboxInput()\n\n if initial:\n initialbool = (initial.answer == \"True\")\n else:\n initialbool = False\n\n field = forms.BooleanField(\n label=label, required=q.required,\n help_text=help_text,\n initial=initialbool, widget=widget,\n )\n elif q.type == Question.TYPE_NUMBER:\n field = forms.DecimalField(\n label=label, required=q.required,\n help_text=q.help_text,\n initial=initial.answer if initial else None,\n min_value=Decimal('0.00'),\n )\n elif q.type == Question.TYPE_STRING:\n field = forms.CharField(\n label=label, required=q.required,\n help_text=help_text,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_TEXT:\n field = forms.CharField(\n label=label, required=q.required,\n help_text=help_text,\n widget=forms.Textarea,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE:\n field = forms.ModelChoiceField(\n queryset=q.options,\n label=label, required=q.required,\n help_text=help_text,\n widget=forms.Select,\n empty_label='',\n initial=initial.options.first() if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE_MULTIPLE:\n field = forms.ModelMultipleChoiceField(\n queryset=q.options,\n label=label, required=q.required,\n help_text=help_text,\n widget=forms.CheckboxSelectMultiple,\n initial=initial.options.all() if initial else None,\n )\n elif q.type == Question.TYPE_FILE:\n field = forms.FileField(\n label=label, required=q.required,\n help_text=help_text,\n initial=initial.file if initial else None,\n widget=UploadedFileWidget(position=pos, event=event, answer=initial),\n )\n elif q.type == Question.TYPE_DATE:\n field = forms.DateField(\n label=label, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).date() if initial and initial.answer else None,\n widget=DatePickerWidget(),\n )\n elif q.type == Question.TYPE_TIME:\n field = forms.TimeField(\n label=label, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).time() if initial and initial.answer else None,\n widget=TimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n elif q.type == Question.TYPE_DATETIME:\n field = SplitDateTimeField(\n label=label, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).astimezone(tz) if initial and initial.answer else None,\n widget=SplitDateTimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n field.question = q\n if answers:\n # Cache the answer object for later use\n field.answer = answers[0]\n self.fields['question_%s' % q.id] = field\n\n responses = question_form_fields.send(sender=event, position=pos)\n data = pos.meta_info_data\n for r, response in sorted(responses, key=lambda r: str(r[0])):\n for key, value in response.items():\n # We need to be this explicit, since OrderedDict.update does not retain ordering\n self.fields[key] = value\n value.initial = data.get('question_form_data', {}).get(key)","lang":"python","vul_type":"cwe-079","target_token_count":1149,"sven_meta":{"func_name":"__init__","file_name":"src/pretix/base/forms/questions.py","commit_link":"github.com/pretix/pretix/commit/affc6254a8316643d4afe9e8b7f8cd288c86ca1f","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#26-72e8a1a5efee","input":"def link_dialog(request):\n # list of wiki pages\n name = request.values.get(\"pagename\", \"\")\n if name:\n from MoinMoin import search\n # XXX error handling!\n searchresult = search.searchPages(request, 't:\"%s\"' % name)\n\n pages = [p.page_name for p in searchresult.hits]\n pages.sort()\n pages[0:0] = [name]\n page_list = '''\n \n \n \n \n \n''' % \"\\n\".join(['' % (wikiutil.escape(page), wikiutil.escape(page))\n for page in pages])\n else:\n page_list = \"\"\n\n # list of interwiki names\n interwiki_list = wikiutil.load_wikimap(request)\n interwiki = interwiki_list.keys()\n interwiki.sort()\n iwpreferred = request.cfg.interwiki_preferred[:]\n if not iwpreferred or iwpreferred and iwpreferred[-1] is not None:\n resultlist = iwpreferred\n for iw in interwiki:\n if not iw in iwpreferred:\n resultlist.append(iw)\n else:\n resultlist = iwpreferred[:-1]\n interwiki = \"\\n\".join(\n ['' % (wikiutil.escape(key), wikiutil.escape(key))\n for key in resultlist])\n\n # wiki url\n url_prefix_static = request.cfg.url_prefix_static\n scriptname = request.script_root + '/'\n action = scriptname\n basepage = wikiutil.escape(request.page.page_name)\n request.write(u'''\n\n\n\n\n\n \n Link Properties\n \n \n \n \n \n \n \n
\n Link Type
\n \n
\n
\n
\n \n \n \n \n
\n
\n \n \n \n \n \n \n \n \n %(page_list)s\n
\n Page Name
\n \n
\n \n
\n
\n
\n
\n
\n \n \n \n \n
\n \n \n \n \n
\n Wiki:PageName
\n :\n \n
\n
\n
\n
\n \n \n \n \n \n \n
\n Protocol
\n \n
 \n URL
\n \n
\n
\n
\n
\n \n\n''' % locals())","target":"def link_dialog(request):\n # list of wiki pages\n name = request.values.get(\"pagename\", \"\")\n name_escaped = wikiutil.escape(name)\n if name:\n from MoinMoin import search\n # XXX error handling!\n searchresult = search.searchPages(request, 't:\"%s\"' % name)\n\n pages = [p.page_name for p in searchresult.hits]\n pages.sort()\n pages[0:0] = [name]\n page_list = '''\n \n \n \n \n \n''' % \"\\n\".join(['' % (wikiutil.escape(page), wikiutil.escape(page))\n for page in pages])\n else:\n page_list = \"\"\n\n # list of interwiki names\n interwiki_list = wikiutil.load_wikimap(request)\n interwiki = interwiki_list.keys()\n interwiki.sort()\n iwpreferred = request.cfg.interwiki_preferred[:]\n if not iwpreferred or iwpreferred and iwpreferred[-1] is not None:\n resultlist = iwpreferred\n for iw in interwiki:\n if not iw in iwpreferred:\n resultlist.append(iw)\n else:\n resultlist = iwpreferred[:-1]\n interwiki = \"\\n\".join(\n ['' % (wikiutil.escape(key), wikiutil.escape(key))\n for key in resultlist])\n\n # wiki url\n url_prefix_static = request.cfg.url_prefix_static\n scriptname = request.script_root + '/'\n action = scriptname\n basepage = wikiutil.escape(request.page.page_name)\n request.write(u'''\n\n\n\n\n\n \n Link Properties\n \n \n \n \n \n \n \n
\n Link Type
\n \n
\n
\n
\n \n \n \n \n
\n
\n \n \n \n \n \n \n \n \n %(page_list)s\n
\n Page Name
\n \n
\n \n
\n
\n
\n
\n
\n \n \n \n \n
\n \n \n \n \n
\n Wiki:PageName
\n :\n \n
\n
\n
\n
\n \n \n \n \n \n \n
\n Protocol
\n \n
 \n URL
\n \n
\n
\n
\n
\n \n\n''' % locals())","lang":"python","vul_type":"cwe-079","target_token_count":1577,"sven_meta":{"func_name":"link_dialog","file_name":"MoinMoin/action/fckdialog.py","commit_link":"github.com/moinwiki/moin-1.9/commit/70955a8eae091cc88fd9a6e510177e70289ec024","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#27-645ac2c41fe8","input":"def action_save_user(request: HttpRequest, default_forward_url: str = \"/admin/users\"):\n \"\"\"\n This functions saves the changes to the user or adds a new one. It completely creates the HttpResponse\n :param request: the HttpRequest\n :param default_forward_url: The URL to forward to if nothing was specified\n :return: The crafted HttpResponse\n \"\"\"\n forward_url = default_forward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if not request.user.is_authenticated:\n return HttpResponseForbidden()\n profile = Profile.objects.get(authuser=request.user)\n if profile.rights < 2:\n return HttpResponseForbidden()\n try:\n if request.GET.get(\"user_id\"):\n pid = int(request.GET[\"user_id\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n user: Profile = Profile.objects.get(pk=pid)\n user.displayName = displayname\n user.dect = dect\n user.notes = notes\n user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])\n if request.POST.get(\"active\"):\n user.active = magic.parse_bool(request.POST[\"active\"])\n au: User = user.authuser\n if check_password_conformity(pw1, pw2):\n logging.log(logging.INFO, \"Set password for user: \" + user.displayName)\n au.set_password(pw1)\n else:\n logging.log(logging.INFO, \"Failed to set password for: \" + user.displayName)\n au.email = mail\n au.save()\n user.save()\n else:\n # assume new user\n username = str(request.POST[\"username\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n if not check_password_conformity(pw1, pw2):\n recreate_form('password mismatch')\n auth_user: User = User.objects.create_user(username=username, email=mail, password=pw1)\n auth_user.save()\n user: Profile = Profile()\n user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])\n user.displayName = displayname\n user.authuser = auth_user\n user.dect = dect\n user.notes = notes\n user.active = True\n user.save()\n pass\n pass\n except Exception as e:\n return HttpResponseBadRequest(str(e))\n return redirect(forward_url)","target":"def action_save_user(request: HttpRequest, default_forward_url: str = \"/admin/users\"):\n \"\"\"\n This functions saves the changes to the user or adds a new one. It completely creates the HttpResponse\n :param request: the HttpRequest\n :param default_forward_url: The URL to forward to if nothing was specified\n :return: The crafted HttpResponse\n \"\"\"\n forward_url = default_forward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if not request.user.is_authenticated:\n return HttpResponseForbidden()\n profile = Profile.objects.get(authuser=request.user)\n if profile.rights < 2:\n return HttpResponseForbidden()\n try:\n if request.GET.get(\"user_id\"):\n pid = int(request.GET[\"user_id\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n user: Profile = Profile.objects.get(pk=pid)\n user.displayName = escape(displayname)\n user.dect = dect\n user.notes = escape(notes)\n user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])\n if request.POST.get(\"active\"):\n user.active = magic.parse_bool(request.POST[\"active\"])\n au: User = user.authuser\n if check_password_conformity(pw1, pw2):\n logging.log(logging.INFO, \"Set password for user: \" + user.displayName)\n au.set_password(pw1)\n else:\n logging.log(logging.INFO, \"Failed to set password for: \" + user.displayName)\n au.email = escape(mail)\n au.save()\n user.save()\n else:\n # assume new user\n username = str(request.POST[\"username\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n if not check_password_conformity(pw1, pw2):\n recreate_form('password mismatch')\n auth_user: User = User.objects.create_user(username=escape(username), email=escape(mail), password=pw1)\n auth_user.save()\n user: Profile = Profile()\n user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])\n user.displayName = escape(displayname)\n user.authuser = auth_user\n user.dect = dect\n user.notes = escape(notes)\n user.active = True\n user.save()\n pass\n pass\n except Exception as e:\n return HttpResponseBadRequest(str(e))\n return redirect(forward_url)","lang":"python","vul_type":"cwe-079","target_token_count":632,"sven_meta":{"func_name":"action_save_user","file_name":"c3shop/frontpage/management/edit_user.py","commit_link":"github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#38-72821e099e31","input":"static int oidc_handle_session_management_iframe_rp(request_rec *r, oidc_cfg *c,\n\t\toidc_session_t *session, const char *client_id,\n\t\tconst char *check_session_iframe) {\n\n\toidc_debug(r, \"enter\");\n\n\tconst char *java_script =\n\t\t\t\" \\n\";\n\n\t/* determine the origin for the check_session_iframe endpoint */\n\tchar *origin = apr_pstrdup(r->pool, check_session_iframe);\n\tapr_uri_t uri;\n\tapr_uri_parse(r->pool, check_session_iframe, &uri);\n\tchar *p = strstr(origin, uri.path);\n\t*p = '\\0';\n\n\t/* the element identifier for the OP iframe */\n\tconst char *op_iframe_id = \"openidc-op\";\n\n\t/* restore the OP session_state from the session */\n\tconst char *session_state = oidc_session_get_session_state(r, session);\n\tif (session_state == NULL) {\n\t\toidc_warn(r,\n\t\t\t\t\"no session_state found in the session; the OP does probably not support session management!?\");\n\t\treturn DONE;\n\t}\n\n\tchar *s_poll_interval = NULL;\n\toidc_util_get_request_parameter(r, \"poll\", &s_poll_interval);\n\tif (s_poll_interval == NULL)\n\t\ts_poll_interval = \"3000\";\n\n\tconst char *redirect_uri = oidc_get_redirect_uri(r, c);\n\tjava_script = apr_psprintf(r->pool, java_script, origin, client_id,\n\t\t\tsession_state, op_iframe_id, s_poll_interval, redirect_uri,\n\t\t\tredirect_uri);\n\n\treturn oidc_util_html_send(r, NULL, java_script, \"setTimer\", NULL, DONE);\n}","target":"static int oidc_handle_session_management_iframe_rp(request_rec *r, oidc_cfg *c,\n\t\toidc_session_t *session, const char *client_id,\n\t\tconst char *check_session_iframe) {\n\n\toidc_debug(r, \"enter\");\n\n\tconst char *java_script =\n\t\t\t\" \\n\";\n\n\t/* determine the origin for the check_session_iframe endpoint */\n\tchar *origin = apr_pstrdup(r->pool, check_session_iframe);\n\tapr_uri_t uri;\n\tapr_uri_parse(r->pool, check_session_iframe, &uri);\n\tchar *p = strstr(origin, uri.path);\n\t*p = '\\0';\n\n\t/* the element identifier for the OP iframe */\n\tconst char *op_iframe_id = \"openidc-op\";\n\n\t/* restore the OP session_state from the session */\n\tconst char *session_state = oidc_session_get_session_state(r, session);\n\tif (session_state == NULL) {\n\t\toidc_warn(r,\n\t\t\t\t\"no session_state found in the session; the OP does probably not support session management!?\");\n\t\treturn DONE;\n\t}\n\n\tchar *s_poll_interval = NULL;\n\toidc_util_get_request_parameter(r, \"poll\", &s_poll_interval);\n\tint poll_interval = s_poll_interval ? strtol(s_poll_interval, NULL, 10) : 0;\n\tif ((poll_interval <= 0) || (poll_interval > 3600 * 24))\n\t\tpoll_interval = 3000;\n\n\tconst char *redirect_uri = oidc_get_redirect_uri(r, c);\n\tjava_script = apr_psprintf(r->pool, java_script, origin, client_id,\n\t\t\tsession_state, op_iframe_id, poll_interval, redirect_uri,\n\t\t\tredirect_uri);\n\n\treturn oidc_util_html_send(r, NULL, java_script, \"setTimer\", NULL, DONE);\n}","lang":"c","vul_type":"cwe-079","target_token_count":797,"sven_meta":{"func_name":"oidc_handle_session_management_iframe_rp","file_name":"src/mod_auth_openidc.c","commit_link":"github.com/zmartzone/mod_auth_openidc/commit/132a4111bf3791e76437619a66336dce2ce4c79b","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#44-71bd584b82b3","input":"def add_article_action(request: HttpRequest, default_foreward_url: str):\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n else:\n forward_url = \"/admin\"\n if \"rid\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=Missing%20reservation%20id%20in%20request\")\n u: Profile = get_current_user(request)\n current_reservation = GroupReservation.objects.get(id=str(request.GET[\"rid\"]))\n if current_reservation.createdByUser != u and u.rights < 2:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n if current_reservation.submitted == True:\n return HttpResponseRedirect(\"/admin?error=Already%20submitted\")\n # Test for multiple or single article\n if \"article_id\" in request.POST:\n # Actual adding of article\n aid: int = int(request.GET.get(\"article_id\"))\n quantity: int = int(request.POST[\"quantity\"])\n notes: str = request.POST[\"notes\"]\n ar = ArticleRequested()\n ar.AID = Article.objects.get(id=aid)\n ar.RID = current_reservation\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))\n ar.amount = quantity\n ar.notes = notes\n ar.save()\n # Actual adding of multiple articles\n else:\n if \"group_id\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=missing%20group%20id\")\n g: ArticleGroup = ArticleGroup.objects.get(id=int(request.GET[\"group_id\"]))\n for art in Article.objects.all().filter(group=g):\n if str(\"quantity_\" + str(art.id)) not in request.POST or str(\"notes_\" + str(art.id)) not in request.POST:\n return HttpResponseRedirect(\"/admin?error=Missing%20article%20data%20in%20request\")\n amount = int(request.POST[\"quantity_\" + str(art.id)])\n if amount > 0:\n ar = ArticleRequested()\n ar.AID = art\n ar.RID = current_reservation\n ar.amount = amount\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))\n ar.notes = str(request.POST[str(\"notes_\" + str(art.id))])\n ar.save()\n if \"srid\" in request.GET:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id) + \"&srid=\" + request.GET[\"srid\"])\n else:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id))\n return response","target":"def add_article_action(request: HttpRequest, default_foreward_url: str):\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n else:\n forward_url = \"/admin\"\n if \"rid\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=Missing%20reservation%20id%20in%20request\")\n u: Profile = get_current_user(request)\n current_reservation = GroupReservation.objects.get(id=str(request.GET[\"rid\"]))\n if current_reservation.createdByUser != u and u.rights < 2:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n if current_reservation.submitted == True:\n return HttpResponseRedirect(\"/admin?error=Already%20submitted\")\n # Test for multiple or single article\n if \"article_id\" in request.POST:\n # Actual adding of article\n aid: int = int(request.GET.get(\"article_id\"))\n quantity: int = int(request.POST[\"quantity\"])\n notes: str = escape(request.POST[\"notes\"])\n ar = ArticleRequested()\n ar.AID = Article.objects.get(id=aid)\n ar.RID = current_reservation\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))\n ar.amount = quantity\n ar.notes = notes\n ar.save()\n # Actual adding of multiple articles\n else:\n if \"group_id\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=missing%20group%20id\")\n g: ArticleGroup = ArticleGroup.objects.get(id=int(request.GET[\"group_id\"]))\n for art in Article.objects.all().filter(group=g):\n if str(\"quantity_\" + str(art.id)) not in request.POST or str(\"notes_\" + str(art.id)) not in request.POST:\n return HttpResponseRedirect(\"/admin?error=Missing%20article%20data%20in%20request\")\n amount = int(request.POST[\"quantity_\" + str(art.id)])\n if amount > 0:\n ar = ArticleRequested()\n ar.AID = art\n ar.RID = current_reservation\n ar.amount = amount\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))\n ar.notes = escape(str(request.POST[str(\"notes_\" + str(art.id))]))\n ar.save()\n if \"srid\" in request.GET:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id) + \"&srid=\" + request.GET[\"srid\"])\n else:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id))\n return response","lang":"python","vul_type":"cwe-079","target_token_count":583,"sven_meta":{"func_name":"add_article_action","file_name":"c3shop/frontpage/management/reservation_actions.py","commit_link":"github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-190#0-b49215d0e77b","input":"int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, UINT8* buffer, Py_ssize_t bytes) {\n TIFFSTATE *clientstate = (TIFFSTATE *)state->context;\n char *filename = \"tempfile.tif\";\n char *mode = \"r\";\n TIFF *tiff;\n\n /* buffer is the encoded file, bytes is the length of the encoded file */\n /* it all ends up in state->buffer, which is a uint8* from Imaging.h */\n\n TRACE((\"in decoder: bytes %d\\n\", bytes));\n TRACE((\"State: count %d, state %d, x %d, y %d, ystep %d\\n\", state->count, state->state,\n state->x, state->y, state->ystep));\n TRACE((\"State: xsize %d, ysize %d, xoff %d, yoff %d \\n\", state->xsize, state->ysize,\n state->xoff, state->yoff));\n TRACE((\"State: bits %d, bytes %d \\n\", state->bits, state->bytes));\n TRACE((\"Buffer: %p: %c%c%c%c\\n\", buffer, (char)buffer[0], (char)buffer[1],(char)buffer[2], (char)buffer[3]));\n TRACE((\"State->Buffer: %c%c%c%c\\n\", (char)state->buffer[0], (char)state->buffer[1],(char)state->buffer[2], (char)state->buffer[3]));\n TRACE((\"Image: mode %s, type %d, bands: %d, xsize %d, ysize %d \\n\",\n im->mode, im->type, im->bands, im->xsize, im->ysize));\n TRACE((\"Image: image8 %p, image32 %p, image %p, block %p \\n\",\n im->image8, im->image32, im->image, im->block));\n TRACE((\"Image: pixelsize: %d, linesize %d \\n\",\n im->pixelsize, im->linesize));\n\n dump_state(clientstate);\n clientstate->size = bytes;\n clientstate->eof = clientstate->size;\n clientstate->loc = 0;\n clientstate->data = (tdata_t)buffer;\n clientstate->flrealloc = 0;\n dump_state(clientstate);\n\n TIFFSetWarningHandler(NULL);\n TIFFSetWarningHandlerExt(NULL);\n\n if (clientstate->fp) {\n TRACE((\"Opening using fd: %d\\n\",clientstate->fp));\n lseek(clientstate->fp,0,SEEK_SET); // Sometimes, I get it set to the end.\n tiff = TIFFFdOpen(clientstate->fp, filename, mode);\n } else {\n TRACE((\"Opening from string\\n\"));\n tiff = TIFFClientOpen(filename, mode,\n (thandle_t) clientstate,\n _tiffReadProc, _tiffWriteProc,\n _tiffSeekProc, _tiffCloseProc, _tiffSizeProc,\n _tiffMapProc, _tiffUnmapProc);\n }\n\n if (!tiff){\n TRACE((\"Error, didn't get the tiff\\n\"));\n state->errcode = IMAGING_CODEC_BROKEN;\n return -1;\n }\n\n if (clientstate->ifd){\n int rv;\n uint32 ifdoffset = clientstate->ifd;\n TRACE((\"reading tiff ifd %u\\n\", ifdoffset));\n rv = TIFFSetSubDirectory(tiff, ifdoffset);\n if (!rv){\n TRACE((\"error in TIFFSetSubDirectory\"));\n return -1;\n }\n }\n\n if (TIFFIsTiled(tiff)) {\n UINT32 x, y, tile_y, row_byte_size;\n UINT32 tile_width, tile_length, current_tile_width;\n UINT8 *new_data;\n\n TIFFGetField(tiff, TIFFTAG_TILEWIDTH, &tile_width);\n TIFFGetField(tiff, TIFFTAG_TILELENGTH, &tile_length);\n\n // We could use TIFFTileSize, but for YCbCr data it returns subsampled data size\n row_byte_size = (tile_width * state->bits + 7) / 8;\n state->bytes = row_byte_size * tile_length;\n\n /* overflow check for malloc */\n if (state->bytes > INT_MAX - 1) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n\n /* realloc to fit whole tile */\n new_data = realloc (state->buffer, state->bytes);\n if (!new_data) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n\n state->buffer = new_data;\n\n TRACE((\"TIFFTileSize: %d\\n\", state->bytes));\n\n for (y = state->yoff; y < state->ysize; y += tile_length) {\n for (x = state->xoff; x < state->xsize; x += tile_width) {\n if (ReadTile(tiff, x, y, (UINT32*) state->buffer) == -1) {\n TRACE((\"Decode Error, Tile at %dx%d\\n\", x, y));\n state->errcode = IMAGING_CODEC_BROKEN;\n TIFFClose(tiff);\n return -1;\n }\n\n TRACE((\"Read tile at %dx%d; \\n\\n\", x, y));\n\n current_tile_width = min(tile_width, state->xsize - x);\n\n // iterate over each line in the tile and stuff data into image\n for (tile_y = 0; tile_y < min(tile_length, state->ysize - y); tile_y++) {\n TRACE((\"Writing tile data at %dx%d using tile_width: %d; \\n\", tile_y + y, x, current_tile_width));\n\n // UINT8 * bbb = state->buffer + tile_y * row_byte_size;\n // TRACE((\"chars: %x%x%x%x\\n\", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3]));\n\n state->shuffle((UINT8*) im->image[tile_y + y] + x * im->pixelsize,\n state->buffer + tile_y * row_byte_size,\n current_tile_width\n );\n }\n }\n }\n } else {\n UINT32 strip_row, row_byte_size;\n UINT8 *new_data;\n UINT32 rows_per_strip;\n int ret;\n\n ret = TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_strip);\n if (ret != 1) {\n rows_per_strip = state->ysize;\n }\n TRACE((\"RowsPerStrip: %u \\n\", rows_per_strip));\n\n // We could use TIFFStripSize, but for YCbCr data it returns subsampled data size\n row_byte_size = (state->xsize * state->bits + 7) / 8;\n state->bytes = rows_per_strip * row_byte_size;\n\n TRACE((\"StripSize: %d \\n\", state->bytes));\n\n /* realloc to fit whole strip */\n new_data = realloc (state->buffer, state->bytes);\n if (!new_data) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n\n state->buffer = new_data;\n\n for (; state->y < state->ysize; state->y += rows_per_strip) {\n if (ReadStrip(tiff, state->y, (UINT32 *)state->buffer) == -1) {\n TRACE((\"Decode Error, strip %d\\n\", TIFFComputeStrip(tiff, state->y, 0)));\n state->errcode = IMAGING_CODEC_BROKEN;\n TIFFClose(tiff);\n return -1;\n }\n\n TRACE((\"Decoded strip for row %d \\n\", state->y));\n\n // iterate over each row in the strip and stuff data into image\n for (strip_row = 0; strip_row < min(rows_per_strip, state->ysize - state->y); strip_row++) {\n TRACE((\"Writing data into line %d ; \\n\", state->y + strip_row));\n\n // UINT8 * bbb = state->buffer + strip_row * (state->bytes / rows_per_strip);\n // TRACE((\"chars: %x %x %x %x\\n\", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3]));\n\n state->shuffle((UINT8*) im->image[state->y + state->yoff + strip_row] +\n state->xoff * im->pixelsize,\n state->buffer + strip_row * row_byte_size,\n state->xsize);\n }\n }\n }\n\n TIFFClose(tiff);\n TRACE((\"Done Decoding, Returning \\n\"));\n // Returning -1 here to force ImageFile.load to break, rather than\n // even think about looping back around.\n return -1;\n}","target":"int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, UINT8* buffer, Py_ssize_t bytes) {\n TIFFSTATE *clientstate = (TIFFSTATE *)state->context;\n char *filename = \"tempfile.tif\";\n char *mode = \"r\";\n TIFF *tiff;\n\n /* buffer is the encoded file, bytes is the length of the encoded file */\n /* it all ends up in state->buffer, which is a uint8* from Imaging.h */\n\n TRACE((\"in decoder: bytes %d\\n\", bytes));\n TRACE((\"State: count %d, state %d, x %d, y %d, ystep %d\\n\", state->count, state->state,\n state->x, state->y, state->ystep));\n TRACE((\"State: xsize %d, ysize %d, xoff %d, yoff %d \\n\", state->xsize, state->ysize,\n state->xoff, state->yoff));\n TRACE((\"State: bits %d, bytes %d \\n\", state->bits, state->bytes));\n TRACE((\"Buffer: %p: %c%c%c%c\\n\", buffer, (char)buffer[0], (char)buffer[1],(char)buffer[2], (char)buffer[3]));\n TRACE((\"State->Buffer: %c%c%c%c\\n\", (char)state->buffer[0], (char)state->buffer[1],(char)state->buffer[2], (char)state->buffer[3]));\n TRACE((\"Image: mode %s, type %d, bands: %d, xsize %d, ysize %d \\n\",\n im->mode, im->type, im->bands, im->xsize, im->ysize));\n TRACE((\"Image: image8 %p, image32 %p, image %p, block %p \\n\",\n im->image8, im->image32, im->image, im->block));\n TRACE((\"Image: pixelsize: %d, linesize %d \\n\",\n im->pixelsize, im->linesize));\n\n dump_state(clientstate);\n clientstate->size = bytes;\n clientstate->eof = clientstate->size;\n clientstate->loc = 0;\n clientstate->data = (tdata_t)buffer;\n clientstate->flrealloc = 0;\n dump_state(clientstate);\n\n TIFFSetWarningHandler(NULL);\n TIFFSetWarningHandlerExt(NULL);\n\n if (clientstate->fp) {\n TRACE((\"Opening using fd: %d\\n\",clientstate->fp));\n lseek(clientstate->fp,0,SEEK_SET); // Sometimes, I get it set to the end.\n tiff = TIFFFdOpen(clientstate->fp, filename, mode);\n } else {\n TRACE((\"Opening from string\\n\"));\n tiff = TIFFClientOpen(filename, mode,\n (thandle_t) clientstate,\n _tiffReadProc, _tiffWriteProc,\n _tiffSeekProc, _tiffCloseProc, _tiffSizeProc,\n _tiffMapProc, _tiffUnmapProc);\n }\n\n if (!tiff){\n TRACE((\"Error, didn't get the tiff\\n\"));\n state->errcode = IMAGING_CODEC_BROKEN;\n return -1;\n }\n\n if (clientstate->ifd){\n int rv;\n uint32 ifdoffset = clientstate->ifd;\n TRACE((\"reading tiff ifd %u\\n\", ifdoffset));\n rv = TIFFSetSubDirectory(tiff, ifdoffset);\n if (!rv){\n TRACE((\"error in TIFFSetSubDirectory\"));\n return -1;\n }\n }\n\n if (TIFFIsTiled(tiff)) {\n UINT32 x, y, tile_y, row_byte_size;\n UINT32 tile_width, tile_length, current_tile_width;\n UINT8 *new_data;\n\n TIFFGetField(tiff, TIFFTAG_TILEWIDTH, &tile_width);\n TIFFGetField(tiff, TIFFTAG_TILELENGTH, &tile_length);\n\n // We could use TIFFTileSize, but for YCbCr data it returns subsampled data size\n row_byte_size = (tile_width * state->bits + 7) / 8;\n\n /* overflow check for realloc */\n if (INT_MAX / row_byte_size < tile_length) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n \n state->bytes = row_byte_size * tile_length;\n\n /* realloc to fit whole tile */\n /* malloc check above */\n new_data = realloc (state->buffer, state->bytes);\n if (!new_data) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n\n state->buffer = new_data;\n\n TRACE((\"TIFFTileSize: %d\\n\", state->bytes));\n\n for (y = state->yoff; y < state->ysize; y += tile_length) {\n for (x = state->xoff; x < state->xsize; x += tile_width) {\n if (ReadTile(tiff, x, y, (UINT32*) state->buffer) == -1) {\n TRACE((\"Decode Error, Tile at %dx%d\\n\", x, y));\n state->errcode = IMAGING_CODEC_BROKEN;\n TIFFClose(tiff);\n return -1;\n }\n\n TRACE((\"Read tile at %dx%d; \\n\\n\", x, y));\n\n current_tile_width = min(tile_width, state->xsize - x);\n\n // iterate over each line in the tile and stuff data into image\n for (tile_y = 0; tile_y < min(tile_length, state->ysize - y); tile_y++) {\n TRACE((\"Writing tile data at %dx%d using tile_width: %d; \\n\", tile_y + y, x, current_tile_width));\n\n // UINT8 * bbb = state->buffer + tile_y * row_byte_size;\n // TRACE((\"chars: %x%x%x%x\\n\", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3]));\n\n state->shuffle((UINT8*) im->image[tile_y + y] + x * im->pixelsize,\n state->buffer + tile_y * row_byte_size,\n current_tile_width\n );\n }\n }\n }\n } else {\n UINT32 strip_row, row_byte_size;\n UINT8 *new_data;\n UINT32 rows_per_strip;\n int ret;\n\n ret = TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_strip);\n if (ret != 1) {\n rows_per_strip = state->ysize;\n }\n TRACE((\"RowsPerStrip: %u \\n\", rows_per_strip));\n\n // We could use TIFFStripSize, but for YCbCr data it returns subsampled data size\n row_byte_size = (state->xsize * state->bits + 7) / 8;\n\n /* overflow check for realloc */\n if (INT_MAX / row_byte_size < rows_per_strip) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n \n state->bytes = rows_per_strip * row_byte_size;\n\n TRACE((\"StripSize: %d \\n\", state->bytes));\n\n /* realloc to fit whole strip */\n /* malloc check above */\n new_data = realloc (state->buffer, state->bytes);\n if (!new_data) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n\n state->buffer = new_data;\n\n for (; state->y < state->ysize; state->y += rows_per_strip) {\n if (ReadStrip(tiff, state->y, (UINT32 *)state->buffer) == -1) {\n TRACE((\"Decode Error, strip %d\\n\", TIFFComputeStrip(tiff, state->y, 0)));\n state->errcode = IMAGING_CODEC_BROKEN;\n TIFFClose(tiff);\n return -1;\n }\n\n TRACE((\"Decoded strip for row %d \\n\", state->y));\n\n // iterate over each row in the strip and stuff data into image\n for (strip_row = 0; strip_row < min(rows_per_strip, state->ysize - state->y); strip_row++) {\n TRACE((\"Writing data into line %d ; \\n\", state->y + strip_row));\n\n // UINT8 * bbb = state->buffer + strip_row * (state->bytes / rows_per_strip);\n // TRACE((\"chars: %x %x %x %x\\n\", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3]));\n\n state->shuffle((UINT8*) im->image[state->y + state->yoff + strip_row] +\n state->xoff * im->pixelsize,\n state->buffer + strip_row * row_byte_size,\n state->xsize);\n }\n }\n }\n\n TIFFClose(tiff);\n TRACE((\"Done Decoding, Returning \\n\"));\n // Returning -1 here to force ImageFile.load to break, rather than\n // even think about looping back around.\n return -1;\n}","lang":"c","vul_type":"cwe-190","target_token_count":2037,"sven_meta":{"func_name":"ImagingLibTiffDecode","file_name":"src/libImaging/TiffDecode.c","commit_link":"github.com/python-pillow/Pillow/commit/4e2def2539ec13e53a82e06c4b3daf00454100c4","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#1-37247d4b40f2","input":"static int futex_requeue(u32 __user *uaddr1, unsigned int flags,\n\t\t\t u32 __user *uaddr2, int nr_wake, int nr_requeue,\n\t\t\t u32 *cmpval, int requeue_pi)\n{\n\tunion futex_key key1 = FUTEX_KEY_INIT, key2 = FUTEX_KEY_INIT;\n\tint drop_count = 0, task_count = 0, ret;\n\tstruct futex_pi_state *pi_state = NULL;\n\tstruct futex_hash_bucket *hb1, *hb2;\n\tstruct futex_q *this, *next;\n\tDEFINE_WAKE_Q(wake_q);\n\n\t/*\n\t * When PI not supported: return -ENOSYS if requeue_pi is true,\n\t * consequently the compiler knows requeue_pi is always false past\n\t * this point which will optimize away all the conditional code\n\t * further down.\n\t */\n\tif (!IS_ENABLED(CONFIG_FUTEX_PI) && requeue_pi)\n\t\treturn -ENOSYS;\n\n\tif (requeue_pi) {\n\t\t/*\n\t\t * Requeue PI only works on two distinct uaddrs. This\n\t\t * check is only valid for private futexes. See below.\n\t\t */\n\t\tif (uaddr1 == uaddr2)\n\t\t\treturn -EINVAL;\n\n\t\t/*\n\t\t * requeue_pi requires a pi_state, try to allocate it now\n\t\t * without any locks in case it fails.\n\t\t */\n\t\tif (refill_pi_state_cache())\n\t\t\treturn -ENOMEM;\n\t\t/*\n\t\t * requeue_pi must wake as many tasks as it can, up to nr_wake\n\t\t * + nr_requeue, since it acquires the rt_mutex prior to\n\t\t * returning to userspace, so as to not leave the rt_mutex with\n\t\t * waiters and no owner. However, second and third wake-ups\n\t\t * cannot be predicted as they involve race conditions with the\n\t\t * first wake and a fault while looking up the pi_state. Both\n\t\t * pthread_cond_signal() and pthread_cond_broadcast() should\n\t\t * use nr_wake=1.\n\t\t */\n\t\tif (nr_wake != 1)\n\t\t\treturn -EINVAL;\n\t}\n\nretry:\n\tret = get_futex_key(uaddr1, flags & FLAGS_SHARED, &key1, VERIFY_READ);\n\tif (unlikely(ret != 0))\n\t\tgoto out;\n\tret = get_futex_key(uaddr2, flags & FLAGS_SHARED, &key2,\n\t\t\t requeue_pi ? VERIFY_WRITE : VERIFY_READ);\n\tif (unlikely(ret != 0))\n\t\tgoto out_put_key1;\n\n\t/*\n\t * The check above which compares uaddrs is not sufficient for\n\t * shared futexes. We need to compare the keys:\n\t */\n\tif (requeue_pi && match_futex(&key1, &key2)) {\n\t\tret = -EINVAL;\n\t\tgoto out_put_keys;\n\t}\n\n\thb1 = hash_futex(&key1);\n\thb2 = hash_futex(&key2);\n\nretry_private:\n\thb_waiters_inc(hb2);\n\tdouble_lock_hb(hb1, hb2);\n\n\tif (likely(cmpval != NULL)) {\n\t\tu32 curval;\n\n\t\tret = get_futex_value_locked(&curval, uaddr1);\n\n\t\tif (unlikely(ret)) {\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\n\t\t\tret = get_user(curval, uaddr1);\n\t\t\tif (ret)\n\t\t\t\tgoto out_put_keys;\n\n\t\t\tif (!(flags & FLAGS_SHARED))\n\t\t\t\tgoto retry_private;\n\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tgoto retry;\n\t\t}\n\t\tif (curval != *cmpval) {\n\t\t\tret = -EAGAIN;\n\t\t\tgoto out_unlock;\n\t\t}\n\t}\n\n\tif (requeue_pi && (task_count - nr_wake < nr_requeue)) {\n\t\t/*\n\t\t * Attempt to acquire uaddr2 and wake the top waiter. If we\n\t\t * intend to requeue waiters, force setting the FUTEX_WAITERS\n\t\t * bit. We force this here where we are able to easily handle\n\t\t * faults rather in the requeue loop below.\n\t\t */\n\t\tret = futex_proxy_trylock_atomic(uaddr2, hb1, hb2, &key1,\n\t\t\t\t\t\t &key2, &pi_state, nr_requeue);\n\n\t\t/*\n\t\t * At this point the top_waiter has either taken uaddr2 or is\n\t\t * waiting on it. If the former, then the pi_state will not\n\t\t * exist yet, look it up one more time to ensure we have a\n\t\t * reference to it. If the lock was taken, ret contains the\n\t\t * vpid of the top waiter task.\n\t\t * If the lock was not taken, we have pi_state and an initial\n\t\t * refcount on it. In case of an error we have nothing.\n\t\t */\n\t\tif (ret > 0) {\n\t\t\tWARN_ON(pi_state);\n\t\t\tdrop_count++;\n\t\t\ttask_count++;\n\t\t\t/*\n\t\t\t * If we acquired the lock, then the user space value\n\t\t\t * of uaddr2 should be vpid. It cannot be changed by\n\t\t\t * the top waiter as it is blocked on hb2 lock if it\n\t\t\t * tries to do so. If something fiddled with it behind\n\t\t\t * our back the pi state lookup might unearth it. So\n\t\t\t * we rather use the known value than rereading and\n\t\t\t * handing potential crap to lookup_pi_state.\n\t\t\t *\n\t\t\t * If that call succeeds then we have pi_state and an\n\t\t\t * initial refcount on it.\n\t\t\t */\n\t\t\tret = lookup_pi_state(uaddr2, ret, hb2, &key2, &pi_state);\n\t\t}\n\n\t\tswitch (ret) {\n\t\tcase 0:\n\t\t\t/* We hold a reference on the pi state. */\n\t\t\tbreak;\n\n\t\t\t/* If the above failed, then pi_state is NULL */\n\t\tcase -EFAULT:\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tret = fault_in_user_writeable(uaddr2);\n\t\t\tif (!ret)\n\t\t\t\tgoto retry;\n\t\t\tgoto out;\n\t\tcase -EAGAIN:\n\t\t\t/*\n\t\t\t * Two reasons for this:\n\t\t\t * - Owner is exiting and we just wait for the\n\t\t\t * exit to complete.\n\t\t\t * - The user space value changed.\n\t\t\t */\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tcond_resched();\n\t\t\tgoto retry;\n\t\tdefault:\n\t\t\tgoto out_unlock;\n\t\t}\n\t}\n\n\tplist_for_each_entry_safe(this, next, &hb1->chain, list) {\n\t\tif (task_count - nr_wake >= nr_requeue)\n\t\t\tbreak;\n\n\t\tif (!match_futex(&this->key, &key1))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always\n\t\t * be paired with each other and no other futex ops.\n\t\t *\n\t\t * We should never be requeueing a futex_q with a pi_state,\n\t\t * which is awaiting a futex_unlock_pi().\n\t\t */\n\t\tif ((requeue_pi && !this->rt_waiter) ||\n\t\t (!requeue_pi && this->rt_waiter) ||\n\t\t this->pi_state) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * Wake nr_wake waiters. For requeue_pi, if we acquired the\n\t\t * lock, we already woke the top_waiter. If not, it will be\n\t\t * woken by futex_unlock_pi().\n\t\t */\n\t\tif (++task_count <= nr_wake && !requeue_pi) {\n\t\t\tmark_wake_futex(&wake_q, this);\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Ensure we requeue to the expected futex for requeue_pi. */\n\t\tif (requeue_pi && !match_futex(this->requeue_pi_key, &key2)) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * Requeue nr_requeue waiters and possibly one more in the case\n\t\t * of requeue_pi if we couldn't acquire the lock atomically.\n\t\t */\n\t\tif (requeue_pi) {\n\t\t\t/*\n\t\t\t * Prepare the waiter to take the rt_mutex. Take a\n\t\t\t * refcount on the pi_state and store the pointer in\n\t\t\t * the futex_q object of the waiter.\n\t\t\t */\n\t\t\tget_pi_state(pi_state);\n\t\t\tthis->pi_state = pi_state;\n\t\t\tret = rt_mutex_start_proxy_lock(&pi_state->pi_mutex,\n\t\t\t\t\t\t\tthis->rt_waiter,\n\t\t\t\t\t\t\tthis->task);\n\t\t\tif (ret == 1) {\n\t\t\t\t/*\n\t\t\t\t * We got the lock. We do neither drop the\n\t\t\t\t * refcount on pi_state nor clear\n\t\t\t\t * this->pi_state because the waiter needs the\n\t\t\t\t * pi_state for cleaning up the user space\n\t\t\t\t * value. It will drop the refcount after\n\t\t\t\t * doing so.\n\t\t\t\t */\n\t\t\t\trequeue_pi_wake_futex(this, &key2, hb2);\n\t\t\t\tdrop_count++;\n\t\t\t\tcontinue;\n\t\t\t} else if (ret) {\n\t\t\t\t/*\n\t\t\t\t * rt_mutex_start_proxy_lock() detected a\n\t\t\t\t * potential deadlock when we tried to queue\n\t\t\t\t * that waiter. Drop the pi_state reference\n\t\t\t\t * which we took above and remove the pointer\n\t\t\t\t * to the state from the waiters futex_q\n\t\t\t\t * object.\n\t\t\t\t */\n\t\t\t\tthis->pi_state = NULL;\n\t\t\t\tput_pi_state(pi_state);\n\t\t\t\t/*\n\t\t\t\t * We stop queueing more waiters and let user\n\t\t\t\t * space deal with the mess.\n\t\t\t\t */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\trequeue_futex(this, hb1, hb2, &key2);\n\t\tdrop_count++;\n\t}\n\n\t/*\n\t * We took an extra initial reference to the pi_state either\n\t * in futex_proxy_trylock_atomic() or in lookup_pi_state(). We\n\t * need to drop it here again.\n\t */\n\tput_pi_state(pi_state);\n\nout_unlock:\n\tdouble_unlock_hb(hb1, hb2);\n\twake_up_q(&wake_q);\n\thb_waiters_dec(hb2);\n\n\t/*\n\t * drop_futex_key_refs() must be called outside the spinlocks. During\n\t * the requeue we moved futex_q's from the hash bucket at key1 to the\n\t * one at key2 and updated their key pointer. We no longer need to\n\t * hold the references to key1.\n\t */\n\twhile (--drop_count >= 0)\n\t\tdrop_futex_key_refs(&key1);\n\nout_put_keys:\n\tput_futex_key(&key2);\nout_put_key1:\n\tput_futex_key(&key1);\nout:\n\treturn ret ? ret : task_count;\n}","target":"static int futex_requeue(u32 __user *uaddr1, unsigned int flags,\n\t\t\t u32 __user *uaddr2, int nr_wake, int nr_requeue,\n\t\t\t u32 *cmpval, int requeue_pi)\n{\n\tunion futex_key key1 = FUTEX_KEY_INIT, key2 = FUTEX_KEY_INIT;\n\tint drop_count = 0, task_count = 0, ret;\n\tstruct futex_pi_state *pi_state = NULL;\n\tstruct futex_hash_bucket *hb1, *hb2;\n\tstruct futex_q *this, *next;\n\tDEFINE_WAKE_Q(wake_q);\n\n\tif (nr_wake < 0 || nr_requeue < 0)\n\t\treturn -EINVAL;\n\n\t/*\n\t * When PI not supported: return -ENOSYS if requeue_pi is true,\n\t * consequently the compiler knows requeue_pi is always false past\n\t * this point which will optimize away all the conditional code\n\t * further down.\n\t */\n\tif (!IS_ENABLED(CONFIG_FUTEX_PI) && requeue_pi)\n\t\treturn -ENOSYS;\n\n\tif (requeue_pi) {\n\t\t/*\n\t\t * Requeue PI only works on two distinct uaddrs. This\n\t\t * check is only valid for private futexes. See below.\n\t\t */\n\t\tif (uaddr1 == uaddr2)\n\t\t\treturn -EINVAL;\n\n\t\t/*\n\t\t * requeue_pi requires a pi_state, try to allocate it now\n\t\t * without any locks in case it fails.\n\t\t */\n\t\tif (refill_pi_state_cache())\n\t\t\treturn -ENOMEM;\n\t\t/*\n\t\t * requeue_pi must wake as many tasks as it can, up to nr_wake\n\t\t * + nr_requeue, since it acquires the rt_mutex prior to\n\t\t * returning to userspace, so as to not leave the rt_mutex with\n\t\t * waiters and no owner. However, second and third wake-ups\n\t\t * cannot be predicted as they involve race conditions with the\n\t\t * first wake and a fault while looking up the pi_state. Both\n\t\t * pthread_cond_signal() and pthread_cond_broadcast() should\n\t\t * use nr_wake=1.\n\t\t */\n\t\tif (nr_wake != 1)\n\t\t\treturn -EINVAL;\n\t}\n\nretry:\n\tret = get_futex_key(uaddr1, flags & FLAGS_SHARED, &key1, VERIFY_READ);\n\tif (unlikely(ret != 0))\n\t\tgoto out;\n\tret = get_futex_key(uaddr2, flags & FLAGS_SHARED, &key2,\n\t\t\t requeue_pi ? VERIFY_WRITE : VERIFY_READ);\n\tif (unlikely(ret != 0))\n\t\tgoto out_put_key1;\n\n\t/*\n\t * The check above which compares uaddrs is not sufficient for\n\t * shared futexes. We need to compare the keys:\n\t */\n\tif (requeue_pi && match_futex(&key1, &key2)) {\n\t\tret = -EINVAL;\n\t\tgoto out_put_keys;\n\t}\n\n\thb1 = hash_futex(&key1);\n\thb2 = hash_futex(&key2);\n\nretry_private:\n\thb_waiters_inc(hb2);\n\tdouble_lock_hb(hb1, hb2);\n\n\tif (likely(cmpval != NULL)) {\n\t\tu32 curval;\n\n\t\tret = get_futex_value_locked(&curval, uaddr1);\n\n\t\tif (unlikely(ret)) {\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\n\t\t\tret = get_user(curval, uaddr1);\n\t\t\tif (ret)\n\t\t\t\tgoto out_put_keys;\n\n\t\t\tif (!(flags & FLAGS_SHARED))\n\t\t\t\tgoto retry_private;\n\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tgoto retry;\n\t\t}\n\t\tif (curval != *cmpval) {\n\t\t\tret = -EAGAIN;\n\t\t\tgoto out_unlock;\n\t\t}\n\t}\n\n\tif (requeue_pi && (task_count - nr_wake < nr_requeue)) {\n\t\t/*\n\t\t * Attempt to acquire uaddr2 and wake the top waiter. If we\n\t\t * intend to requeue waiters, force setting the FUTEX_WAITERS\n\t\t * bit. We force this here where we are able to easily handle\n\t\t * faults rather in the requeue loop below.\n\t\t */\n\t\tret = futex_proxy_trylock_atomic(uaddr2, hb1, hb2, &key1,\n\t\t\t\t\t\t &key2, &pi_state, nr_requeue);\n\n\t\t/*\n\t\t * At this point the top_waiter has either taken uaddr2 or is\n\t\t * waiting on it. If the former, then the pi_state will not\n\t\t * exist yet, look it up one more time to ensure we have a\n\t\t * reference to it. If the lock was taken, ret contains the\n\t\t * vpid of the top waiter task.\n\t\t * If the lock was not taken, we have pi_state and an initial\n\t\t * refcount on it. In case of an error we have nothing.\n\t\t */\n\t\tif (ret > 0) {\n\t\t\tWARN_ON(pi_state);\n\t\t\tdrop_count++;\n\t\t\ttask_count++;\n\t\t\t/*\n\t\t\t * If we acquired the lock, then the user space value\n\t\t\t * of uaddr2 should be vpid. It cannot be changed by\n\t\t\t * the top waiter as it is blocked on hb2 lock if it\n\t\t\t * tries to do so. If something fiddled with it behind\n\t\t\t * our back the pi state lookup might unearth it. So\n\t\t\t * we rather use the known value than rereading and\n\t\t\t * handing potential crap to lookup_pi_state.\n\t\t\t *\n\t\t\t * If that call succeeds then we have pi_state and an\n\t\t\t * initial refcount on it.\n\t\t\t */\n\t\t\tret = lookup_pi_state(uaddr2, ret, hb2, &key2, &pi_state);\n\t\t}\n\n\t\tswitch (ret) {\n\t\tcase 0:\n\t\t\t/* We hold a reference on the pi state. */\n\t\t\tbreak;\n\n\t\t\t/* If the above failed, then pi_state is NULL */\n\t\tcase -EFAULT:\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tret = fault_in_user_writeable(uaddr2);\n\t\t\tif (!ret)\n\t\t\t\tgoto retry;\n\t\t\tgoto out;\n\t\tcase -EAGAIN:\n\t\t\t/*\n\t\t\t * Two reasons for this:\n\t\t\t * - Owner is exiting and we just wait for the\n\t\t\t * exit to complete.\n\t\t\t * - The user space value changed.\n\t\t\t */\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tcond_resched();\n\t\t\tgoto retry;\n\t\tdefault:\n\t\t\tgoto out_unlock;\n\t\t}\n\t}\n\n\tplist_for_each_entry_safe(this, next, &hb1->chain, list) {\n\t\tif (task_count - nr_wake >= nr_requeue)\n\t\t\tbreak;\n\n\t\tif (!match_futex(&this->key, &key1))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always\n\t\t * be paired with each other and no other futex ops.\n\t\t *\n\t\t * We should never be requeueing a futex_q with a pi_state,\n\t\t * which is awaiting a futex_unlock_pi().\n\t\t */\n\t\tif ((requeue_pi && !this->rt_waiter) ||\n\t\t (!requeue_pi && this->rt_waiter) ||\n\t\t this->pi_state) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * Wake nr_wake waiters. For requeue_pi, if we acquired the\n\t\t * lock, we already woke the top_waiter. If not, it will be\n\t\t * woken by futex_unlock_pi().\n\t\t */\n\t\tif (++task_count <= nr_wake && !requeue_pi) {\n\t\t\tmark_wake_futex(&wake_q, this);\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Ensure we requeue to the expected futex for requeue_pi. */\n\t\tif (requeue_pi && !match_futex(this->requeue_pi_key, &key2)) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * Requeue nr_requeue waiters and possibly one more in the case\n\t\t * of requeue_pi if we couldn't acquire the lock atomically.\n\t\t */\n\t\tif (requeue_pi) {\n\t\t\t/*\n\t\t\t * Prepare the waiter to take the rt_mutex. Take a\n\t\t\t * refcount on the pi_state and store the pointer in\n\t\t\t * the futex_q object of the waiter.\n\t\t\t */\n\t\t\tget_pi_state(pi_state);\n\t\t\tthis->pi_state = pi_state;\n\t\t\tret = rt_mutex_start_proxy_lock(&pi_state->pi_mutex,\n\t\t\t\t\t\t\tthis->rt_waiter,\n\t\t\t\t\t\t\tthis->task);\n\t\t\tif (ret == 1) {\n\t\t\t\t/*\n\t\t\t\t * We got the lock. We do neither drop the\n\t\t\t\t * refcount on pi_state nor clear\n\t\t\t\t * this->pi_state because the waiter needs the\n\t\t\t\t * pi_state for cleaning up the user space\n\t\t\t\t * value. It will drop the refcount after\n\t\t\t\t * doing so.\n\t\t\t\t */\n\t\t\t\trequeue_pi_wake_futex(this, &key2, hb2);\n\t\t\t\tdrop_count++;\n\t\t\t\tcontinue;\n\t\t\t} else if (ret) {\n\t\t\t\t/*\n\t\t\t\t * rt_mutex_start_proxy_lock() detected a\n\t\t\t\t * potential deadlock when we tried to queue\n\t\t\t\t * that waiter. Drop the pi_state reference\n\t\t\t\t * which we took above and remove the pointer\n\t\t\t\t * to the state from the waiters futex_q\n\t\t\t\t * object.\n\t\t\t\t */\n\t\t\t\tthis->pi_state = NULL;\n\t\t\t\tput_pi_state(pi_state);\n\t\t\t\t/*\n\t\t\t\t * We stop queueing more waiters and let user\n\t\t\t\t * space deal with the mess.\n\t\t\t\t */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\trequeue_futex(this, hb1, hb2, &key2);\n\t\tdrop_count++;\n\t}\n\n\t/*\n\t * We took an extra initial reference to the pi_state either\n\t * in futex_proxy_trylock_atomic() or in lookup_pi_state(). We\n\t * need to drop it here again.\n\t */\n\tput_pi_state(pi_state);\n\nout_unlock:\n\tdouble_unlock_hb(hb1, hb2);\n\twake_up_q(&wake_q);\n\thb_waiters_dec(hb2);\n\n\t/*\n\t * drop_futex_key_refs() must be called outside the spinlocks. During\n\t * the requeue we moved futex_q's from the hash bucket at key1 to the\n\t * one at key2 and updated their key pointer. We no longer need to\n\t * hold the references to key1.\n\t */\n\twhile (--drop_count >= 0)\n\t\tdrop_futex_key_refs(&key1);\n\nout_put_keys:\n\tput_futex_key(&key2);\nout_put_key1:\n\tput_futex_key(&key1);\nout:\n\treturn ret ? ret : task_count;\n}","lang":"c","vul_type":"cwe-190","target_token_count":2369,"sven_meta":{"func_name":"futex_requeue","file_name":"kernel/futex.c","commit_link":"github.com/torvalds/linux/commit/fbe0e839d1e22d88810f3ee3e2f1479be4c0aa4a","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#2-8f341a600992","input":"static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, int *fmt, int *ncx, int *ncy, t_chunk_info ** chunkIdx)\n{\n\tint i;\n\tint ch;\n\tchar id[5];\n\tt_chunk_info *cidx;\n\tint sidx;\n\tint nc;\n\n\tGD2_DBG(php_gd_error(\"Reading gd2 header info\"));\n\n\tfor (i = 0; i < 4; i++) {\n\t\tch = gdGetC(in);\n\t\tif (ch == EOF) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tid[i] = ch;\n\t}\n\tid[4] = 0;\n\n\tGD2_DBG(php_gd_error(\"Got file code: %s\", id));\n\n\t/* Equiv. of 'magick'. */\n\tif (strcmp(id, GD2_ID) != 0) {\n\t\tGD2_DBG(php_gd_error(\"Not a valid gd2 file\"));\n\t\tgoto fail1;\n\t}\n\n\t/* Version */\n\tif (gdGetWord(vers, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Version: %d\", *vers));\n\n\tif ((*vers != 1) && (*vers != 2)) {\n\t\tGD2_DBG(php_gd_error(\"Bad version: %d\", *vers));\n\t\tgoto fail1;\n\t}\n\n\t/* Image Size */\n\tif (!gdGetWord(sx, in)) {\n\t\tGD2_DBG(php_gd_error(\"Could not get x-size\"));\n\t\tgoto fail1;\n\t}\n\tif (!gdGetWord(sy, in)) {\n\t\tGD2_DBG(php_gd_error(\"Could not get y-size\"));\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Image is %dx%d\", *sx, *sy));\n\n\t/* Chunk Size (pixels, not bytes!) */\n\tif (gdGetWord(cs, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"ChunkSize: %d\", *cs));\n\n\tif ((*cs < GD2_CHUNKSIZE_MIN) || (*cs > GD2_CHUNKSIZE_MAX)) {\n\t\tGD2_DBG(php_gd_error(\"Bad chunk size: %d\", *cs));\n\t\tgoto fail1;\n\t}\n\n\t/* Data Format */\n\tif (gdGetWord(fmt, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Format: %d\", *fmt));\n\n\tif ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED) && (*fmt != GD2_FMT_TRUECOLOR_RAW) && (*fmt != GD2_FMT_TRUECOLOR_COMPRESSED)) {\n\t\tGD2_DBG(php_gd_error(\"Bad data format: %d\", *fmt));\n\t\tgoto fail1;\n\t}\n\n\t/* # of chunks wide */\n\tif (gdGetWord(ncx, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"%d Chunks Wide\", *ncx));\n\n\t/* # of chunks high */\n\tif (gdGetWord(ncy, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"%d Chunks vertically\", *ncy));\n\n\tif (gd2_compressed(*fmt)) {\n\t\tnc = (*ncx) * (*ncy);\n\t\tGD2_DBG(php_gd_error(\"Reading %d chunk index entries\", nc));\n\t\tsidx = sizeof(t_chunk_info) * nc;\n\t\tif (sidx <= 0) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tcidx = gdCalloc(sidx, 1);\n\t\tfor (i = 0; i < nc; i++) {\n\t\t\tif (gdGetInt(&cidx[i].offset, in) != 1) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t\tif (gdGetInt(&cidx[i].size, in) != 1) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t\tif (cidx[i].offset < 0 || cidx[i].size < 0) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t}\n\t\t*chunkIdx = cidx;\n\t}\n\n\tGD2_DBG(php_gd_error(\"gd2 header complete\"));\n\n\treturn 1;\n\nfail1:\n\treturn 0;\n}","target":"static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, int *fmt, int *ncx, int *ncy, t_chunk_info ** chunkIdx)\n{\n\tint i;\n\tint ch;\n\tchar id[5];\n\tt_chunk_info *cidx;\n\tint sidx;\n\tint nc;\n\n\tGD2_DBG(php_gd_error(\"Reading gd2 header info\"));\n\n\tfor (i = 0; i < 4; i++) {\n\t\tch = gdGetC(in);\n\t\tif (ch == EOF) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tid[i] = ch;\n\t}\n\tid[4] = 0;\n\n\tGD2_DBG(php_gd_error(\"Got file code: %s\", id));\n\n\t/* Equiv. of 'magick'. */\n\tif (strcmp(id, GD2_ID) != 0) {\n\t\tGD2_DBG(php_gd_error(\"Not a valid gd2 file\"));\n\t\tgoto fail1;\n\t}\n\n\t/* Version */\n\tif (gdGetWord(vers, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Version: %d\", *vers));\n\n\tif ((*vers != 1) && (*vers != 2)) {\n\t\tGD2_DBG(php_gd_error(\"Bad version: %d\", *vers));\n\t\tgoto fail1;\n\t}\n\n\t/* Image Size */\n\tif (!gdGetWord(sx, in)) {\n\t\tGD2_DBG(php_gd_error(\"Could not get x-size\"));\n\t\tgoto fail1;\n\t}\n\tif (!gdGetWord(sy, in)) {\n\t\tGD2_DBG(php_gd_error(\"Could not get y-size\"));\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Image is %dx%d\", *sx, *sy));\n\n\t/* Chunk Size (pixels, not bytes!) */\n\tif (gdGetWord(cs, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"ChunkSize: %d\", *cs));\n\n\tif ((*cs < GD2_CHUNKSIZE_MIN) || (*cs > GD2_CHUNKSIZE_MAX)) {\n\t\tGD2_DBG(php_gd_error(\"Bad chunk size: %d\", *cs));\n\t\tgoto fail1;\n\t}\n\n\t/* Data Format */\n\tif (gdGetWord(fmt, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Format: %d\", *fmt));\n\n\tif ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED) && (*fmt != GD2_FMT_TRUECOLOR_RAW) && (*fmt != GD2_FMT_TRUECOLOR_COMPRESSED)) {\n\t\tGD2_DBG(php_gd_error(\"Bad data format: %d\", *fmt));\n\t\tgoto fail1;\n\t}\n\n\t/* # of chunks wide */\n\tif (gdGetWord(ncx, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"%d Chunks Wide\", *ncx));\n\n\t/* # of chunks high */\n\tif (gdGetWord(ncy, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"%d Chunks vertically\", *ncy));\n\n\tif (gd2_compressed(*fmt)) {\n\t\tnc = (*ncx) * (*ncy);\n\t\tGD2_DBG(php_gd_error(\"Reading %d chunk index entries\", nc));\n\t\tif (overflow2(sidx, nc)) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tsidx = sizeof(t_chunk_info) * nc;\n\t\tif (sidx <= 0) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tcidx = gdCalloc(sidx, 1);\n\t\tif (cidx == NULL) {\n\t\t\tgoto fail1;\n\t\t}\n\n\t\tfor (i = 0; i < nc; i++) {\n\t\t\tif (gdGetInt(&cidx[i].offset, in) != 1) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t\tif (gdGetInt(&cidx[i].size, in) != 1) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t\tif (cidx[i].offset < 0 || cidx[i].size < 0) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t}\n\t\t*chunkIdx = cidx;\n\t}\n\n\tGD2_DBG(php_gd_error(\"gd2 header complete\"));\n\n\treturn 1;\n\nfail1:\n\treturn 0;\n}","lang":"c","vul_type":"cwe-190","target_token_count":993,"sven_meta":{"func_name":"_gd2GetHeader","file_name":"ext/gd/libgd/gd_gd2.c","commit_link":"github.com/php/php-src/commit/7722455726bec8c53458a32851d2a87982cf0eac","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#3-00b7d721271b","input":"static int jpc_pi_nextcprl(register jpc_pi_t *pi)\n{\n\tint rlvlno;\n\tjpc_pirlvl_t *pirlvl;\n\tjpc_pchg_t *pchg;\n\tint prchind;\n\tint prcvind;\n\tint *prclyrno;\n\tuint_fast32_t trx0;\n\tuint_fast32_t try0;\n\tuint_fast32_t r;\n\tuint_fast32_t rpx;\n\tuint_fast32_t rpy;\n\n\tpchg = pi->pchg;\n\tif (!pi->prgvolfirst) {\n\t\tgoto skip;\n\t} else {\n\t\tpi->prgvolfirst = 0;\n\t}\n\n\tfor (pi->compno = pchg->compnostart, pi->picomp =\n\t &pi->picomps[pi->compno]; pi->compno < JAS_CAST(int, pchg->compnoend) && pi->compno < pi->numcomps; ++pi->compno,\n\t ++pi->picomp) {\n\t\tpirlvl = pi->picomp->pirlvls;\n\t\tpi->xstep = pi->picomp->hsamp * (1 << (pirlvl->prcwidthexpn +\n\t\t pi->picomp->numrlvls - 1));\n\t\tpi->ystep = pi->picomp->vsamp * (1 << (pirlvl->prcheightexpn +\n\t\t pi->picomp->numrlvls - 1));\n\t\tfor (rlvlno = 1, pirlvl = &pi->picomp->pirlvls[1];\n\t\t rlvlno < pi->picomp->numrlvls; ++rlvlno, ++pirlvl) {\n\t\t\tpi->xstep = JAS_MIN(pi->xstep, pi->picomp->hsamp * (1 <<\n\t\t\t (pirlvl->prcwidthexpn + pi->picomp->numrlvls -\n\t\t\t rlvlno - 1)));\n\t\t\tpi->ystep = JAS_MIN(pi->ystep, pi->picomp->vsamp * (1 <<\n\t\t\t (pirlvl->prcheightexpn + pi->picomp->numrlvls -\n\t\t\t rlvlno - 1)));\n\t\t}\n\t\tfor (pi->y = pi->ystart; pi->y < pi->yend;\n\t\t pi->y += pi->ystep - (pi->y % pi->ystep)) {\n\t\t\tfor (pi->x = pi->xstart; pi->x < pi->xend;\n\t\t\t pi->x += pi->xstep - (pi->x % pi->xstep)) {\n\t\t\t\tfor (pi->rlvlno = pchg->rlvlnostart,\n\t\t\t\t pi->pirlvl = &pi->picomp->pirlvls[pi->rlvlno];\n\t\t\t\t pi->rlvlno < pi->picomp->numrlvls && pi->rlvlno <\n\t\t\t\t pchg->rlvlnoend; ++pi->rlvlno, ++pi->pirlvl) {\n\t\t\t\t\tif (pi->pirlvl->numprcs == 0) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tr = pi->picomp->numrlvls - 1 - pi->rlvlno;\n\t\t\t\t\ttrx0 = JPC_CEILDIV(pi->xstart, pi->picomp->hsamp << r);\n\t\t\t\t\ttry0 = JPC_CEILDIV(pi->ystart, pi->picomp->vsamp << r);\n\t\t\t\t\trpx = r + pi->pirlvl->prcwidthexpn;\n\t\t\t\t\trpy = r + pi->pirlvl->prcheightexpn;\n\t\t\t\t\tif (((pi->x == pi->xstart && ((trx0 << r) % (1 << rpx))) ||\n\t\t\t\t\t !(pi->x % (pi->picomp->hsamp << rpx))) &&\n\t\t\t\t\t ((pi->y == pi->ystart && ((try0 << r) % (1 << rpy))) ||\n\t\t\t\t\t !(pi->y % (pi->picomp->vsamp << rpy)))) {\n\t\t\t\t\t\tprchind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->x, pi->picomp->hsamp\n\t\t\t\t\t\t << r), pi->pirlvl->prcwidthexpn) - JPC_FLOORDIVPOW2(trx0,\n\t\t\t\t\t\t pi->pirlvl->prcwidthexpn);\n\t\t\t\t\t\tprcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y, pi->picomp->vsamp\n\t\t\t\t\t\t << r), pi->pirlvl->prcheightexpn) - JPC_FLOORDIVPOW2(try0,\n\t\t\t\t\t\t pi->pirlvl->prcheightexpn);\n\t\t\t\t\t\tpi->prcno = prcvind *\n\t\t\t\t\t\t pi->pirlvl->numhprcs +\n\t\t\t\t\t\t prchind;\n\t\t\t\t\t\tassert(pi->prcno <\n\t\t\t\t\t\t pi->pirlvl->numprcs);\n\t\t\t\t\t\tfor (pi->lyrno = 0; pi->lyrno <\n\t\t\t\t\t\t pi->numlyrs && pi->lyrno < JAS_CAST(int, pchg->lyrnoend); ++pi->lyrno) {\n\t\t\t\t\t\t\tprclyrno = &pi->pirlvl->prclyrnos[pi->prcno];\n\t\t\t\t\t\t\tif (pi->lyrno >= *prclyrno) {\n\t\t\t\t\t\t\t\t++(*prclyrno);\n\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t}\nskip:\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 1;\n}","target":"static int jpc_pi_nextcprl(register jpc_pi_t *pi)\n{\n\tint rlvlno;\n\tjpc_pirlvl_t *pirlvl;\n\tjpc_pchg_t *pchg;\n\tint prchind;\n\tint prcvind;\n\tint *prclyrno;\n\tuint_fast32_t trx0;\n\tuint_fast32_t try0;\n\tuint_fast32_t r;\n\tuint_fast32_t rpx;\n\tuint_fast32_t rpy;\n\n\tpchg = pi->pchg;\n\tif (!pi->prgvolfirst) {\n\t\tgoto skip;\n\t} else {\n\t\tpi->prgvolfirst = 0;\n\t}\n\n\tfor (pi->compno = pchg->compnostart, pi->picomp =\n\t &pi->picomps[pi->compno]; pi->compno < JAS_CAST(int, pchg->compnoend) && pi->compno < pi->numcomps; ++pi->compno,\n\t ++pi->picomp) {\n\t\tpirlvl = pi->picomp->pirlvls;\n\t\tpi->xstep = pi->picomp->hsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t (pirlvl->prcwidthexpn + pi->picomp->numrlvls - 1));\n\t\tpi->ystep = pi->picomp->vsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t (pirlvl->prcheightexpn + pi->picomp->numrlvls - 1));\n\t\tfor (rlvlno = 1, pirlvl = &pi->picomp->pirlvls[1];\n\t\t rlvlno < pi->picomp->numrlvls; ++rlvlno, ++pirlvl) {\n\t\t\tpi->xstep = JAS_MIN(pi->xstep, pi->picomp->hsamp *\n\t\t\t (JAS_CAST(uint_fast32_t, 1) << (pirlvl->prcwidthexpn +\n\t\t\t pi->picomp->numrlvls - rlvlno - 1)));\n\t\t\tpi->ystep = JAS_MIN(pi->ystep, pi->picomp->vsamp *\n\t\t\t (JAS_CAST(uint_fast32_t, 1) << (pirlvl->prcheightexpn +\n\t\t\t pi->picomp->numrlvls - rlvlno - 1)));\n\t\t}\n\t\tfor (pi->y = pi->ystart; pi->y < pi->yend;\n\t\t pi->y += pi->ystep - (pi->y % pi->ystep)) {\n\t\t\tfor (pi->x = pi->xstart; pi->x < pi->xend;\n\t\t\t pi->x += pi->xstep - (pi->x % pi->xstep)) {\n\t\t\t\tfor (pi->rlvlno = pchg->rlvlnostart,\n\t\t\t\t pi->pirlvl = &pi->picomp->pirlvls[pi->rlvlno];\n\t\t\t\t pi->rlvlno < pi->picomp->numrlvls && pi->rlvlno <\n\t\t\t\t pchg->rlvlnoend; ++pi->rlvlno, ++pi->pirlvl) {\n\t\t\t\t\tif (pi->pirlvl->numprcs == 0) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tr = pi->picomp->numrlvls - 1 - pi->rlvlno;\n\t\t\t\t\ttrx0 = JPC_CEILDIV(pi->xstart, pi->picomp->hsamp << r);\n\t\t\t\t\ttry0 = JPC_CEILDIV(pi->ystart, pi->picomp->vsamp << r);\n\t\t\t\t\trpx = r + pi->pirlvl->prcwidthexpn;\n\t\t\t\t\trpy = r + pi->pirlvl->prcheightexpn;\n\t\t\t\t\tif (((pi->x == pi->xstart && ((trx0 << r) % (1 << rpx))) ||\n\t\t\t\t\t !(pi->x % (pi->picomp->hsamp << rpx))) &&\n\t\t\t\t\t ((pi->y == pi->ystart && ((try0 << r) % (1 << rpy))) ||\n\t\t\t\t\t !(pi->y % (pi->picomp->vsamp << rpy)))) {\n\t\t\t\t\t\tprchind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->x, pi->picomp->hsamp\n\t\t\t\t\t\t << r), pi->pirlvl->prcwidthexpn) - JPC_FLOORDIVPOW2(trx0,\n\t\t\t\t\t\t pi->pirlvl->prcwidthexpn);\n\t\t\t\t\t\tprcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y, pi->picomp->vsamp\n\t\t\t\t\t\t << r), pi->pirlvl->prcheightexpn) - JPC_FLOORDIVPOW2(try0,\n\t\t\t\t\t\t pi->pirlvl->prcheightexpn);\n\t\t\t\t\t\tpi->prcno = prcvind *\n\t\t\t\t\t\t pi->pirlvl->numhprcs +\n\t\t\t\t\t\t prchind;\n\t\t\t\t\t\tassert(pi->prcno <\n\t\t\t\t\t\t pi->pirlvl->numprcs);\n\t\t\t\t\t\tfor (pi->lyrno = 0; pi->lyrno <\n\t\t\t\t\t\t pi->numlyrs && pi->lyrno < JAS_CAST(int, pchg->lyrnoend); ++pi->lyrno) {\n\t\t\t\t\t\t\tprclyrno = &pi->pirlvl->prclyrnos[pi->prcno];\n\t\t\t\t\t\t\tif (pi->lyrno >= *prclyrno) {\n\t\t\t\t\t\t\t\t++(*prclyrno);\n\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t}\nskip:\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 1;\n}","lang":"c","vul_type":"cwe-190","target_token_count":1251,"sven_meta":{"func_name":"jpc_pi_nextcprl","file_name":"src/libjasper/jpc/jpc_t2cod.c","commit_link":"github.com/mdadams/jasper/commit/1f0dfe5a42911b6880a1445f13f6d615ddb55387","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#4-78c452b20932","input":"static inline void process_get_command(conn *c, token_t *tokens, size_t ntokens, bool return_cas) {\n char *key;\n size_t nkey;\n int i = 0;\n item *it;\n token_t *key_token = &tokens[KEY_TOKEN];\n char *suffix;\n assert(c != NULL);\n\n do {\n while(key_token->length != 0) {\n\n key = key_token->value;\n nkey = key_token->length;\n\n if(nkey > KEY_MAX_LENGTH) {\n out_string(c, \"CLIENT_ERROR bad command line format\");\n while (i-- > 0) {\n item_remove(*(c->ilist + i));\n }\n return;\n }\n\n it = item_get(key, nkey, c, DO_UPDATE);\n if (settings.detail_enabled) {\n stats_prefix_record_get(key, nkey, NULL != it);\n }\n if (it) {\n if (i >= c->isize) {\n item **new_list = realloc(c->ilist, sizeof(item *) * c->isize * 2);\n if (new_list) {\n c->isize *= 2;\n c->ilist = new_list;\n } else {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n item_remove(it);\n break;\n }\n }\n\n /*\n * Construct the response. Each hit adds three elements to the\n * outgoing data list:\n * \"VALUE \"\n * key\n * \" \" + flags + \" \" + data length + \"\\r\\n\" + data (with \\r\\n)\n */\n\n if (return_cas || !settings.inline_ascii_response)\n {\n MEMCACHED_COMMAND_GET(c->sfd, ITEM_key(it), it->nkey,\n it->nbytes, ITEM_get_cas(it));\n /* Goofy mid-flight realloc. */\n if (i >= c->suffixsize) {\n char **new_suffix_list = realloc(c->suffixlist,\n sizeof(char *) * c->suffixsize * 2);\n if (new_suffix_list) {\n c->suffixsize *= 2;\n c->suffixlist = new_suffix_list;\n } else {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n item_remove(it);\n break;\n }\n }\n\n suffix = do_cache_alloc(c->thread->suffix_cache);\n if (suffix == NULL) {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n out_of_memory(c, \"SERVER_ERROR out of memory making CAS suffix\");\n item_remove(it);\n while (i-- > 0) {\n item_remove(*(c->ilist + i));\n }\n return;\n }\n *(c->suffixlist + i) = suffix;\n int suffix_len = make_ascii_get_suffix(suffix, it, return_cas);\n if (add_iov(c, \"VALUE \", 6) != 0 ||\n add_iov(c, ITEM_key(it), it->nkey) != 0 ||\n (settings.inline_ascii_response && add_iov(c, ITEM_suffix(it), it->nsuffix - 2) != 0) ||\n add_iov(c, suffix, suffix_len) != 0)\n {\n item_remove(it);\n break;\n }\n if ((it->it_flags & ITEM_CHUNKED) == 0) {\n add_iov(c, ITEM_data(it), it->nbytes);\n } else if (add_chunked_item_iovs(c, it, it->nbytes) != 0) {\n item_remove(it);\n break;\n }\n }\n else\n {\n MEMCACHED_COMMAND_GET(c->sfd, ITEM_key(it), it->nkey,\n it->nbytes, ITEM_get_cas(it));\n if (add_iov(c, \"VALUE \", 6) != 0 ||\n add_iov(c, ITEM_key(it), it->nkey) != 0)\n {\n item_remove(it);\n break;\n }\n if ((it->it_flags & ITEM_CHUNKED) == 0)\n {\n if (add_iov(c, ITEM_suffix(it), it->nsuffix + it->nbytes) != 0)\n {\n item_remove(it);\n break;\n }\n } else if (add_iov(c, ITEM_suffix(it), it->nsuffix) != 0 ||\n add_chunked_item_iovs(c, it, it->nbytes) != 0) {\n item_remove(it);\n break;\n }\n }\n\n\n if (settings.verbose > 1) {\n int ii;\n fprintf(stderr, \">%d sending key \", c->sfd);\n for (ii = 0; ii < it->nkey; ++ii) {\n fprintf(stderr, \"%c\", key[ii]);\n }\n fprintf(stderr, \"\\n\");\n }\n\n /* item_get() has incremented it->refcount for us */\n pthread_mutex_lock(&c->thread->stats.mutex);\n c->thread->stats.slab_stats[ITEM_clsid(it)].get_hits++;\n c->thread->stats.get_cmds++;\n pthread_mutex_unlock(&c->thread->stats.mutex);\n *(c->ilist + i) = it;\n i++;\n\n } else {\n pthread_mutex_lock(&c->thread->stats.mutex);\n c->thread->stats.get_misses++;\n c->thread->stats.get_cmds++;\n pthread_mutex_unlock(&c->thread->stats.mutex);\n MEMCACHED_COMMAND_GET(c->sfd, key, nkey, -1, 0);\n }\n\n key_token++;\n }\n\n /*\n * If the command string hasn't been fully processed, get the next set\n * of tokens.\n */\n if(key_token->value != NULL) {\n ntokens = tokenize_command(key_token->value, tokens, MAX_TOKENS);\n key_token = tokens;\n }\n\n } while(key_token->value != NULL);\n\n c->icurr = c->ilist;\n c->ileft = i;\n if (return_cas || !settings.inline_ascii_response) {\n c->suffixcurr = c->suffixlist;\n c->suffixleft = i;\n }\n\n if (settings.verbose > 1)\n fprintf(stderr, \">%d END\\n\", c->sfd);\n\n /*\n If the loop was terminated because of out-of-memory, it is not\n reliable to add END\\r\\n to the buffer, because it might not end\n in \\r\\n. So we send SERVER_ERROR instead.\n */\n if (key_token->value != NULL || add_iov(c, \"END\\r\\n\", 5) != 0\n || (IS_UDP(c->transport) && build_udp_headers(c) != 0)) {\n out_of_memory(c, \"SERVER_ERROR out of memory writing get response\");\n }\n else {\n conn_set_state(c, conn_mwrite);\n c->msgcurr = 0;\n }\n}","target":"static inline void process_get_command(conn *c, token_t *tokens, size_t ntokens, bool return_cas) {\n char *key;\n size_t nkey;\n int i = 0;\n item *it;\n token_t *key_token = &tokens[KEY_TOKEN];\n char *suffix;\n assert(c != NULL);\n\n do {\n while(key_token->length != 0) {\n\n key = key_token->value;\n nkey = key_token->length;\n\n if(nkey > KEY_MAX_LENGTH) {\n out_string(c, \"CLIENT_ERROR bad command line format\");\n while (i-- > 0) {\n item_remove(*(c->ilist + i));\n }\n return;\n }\n\n it = limited_get(key, nkey, c);\n if (settings.detail_enabled) {\n stats_prefix_record_get(key, nkey, NULL != it);\n }\n if (it) {\n if (i >= c->isize) {\n item **new_list = realloc(c->ilist, sizeof(item *) * c->isize * 2);\n if (new_list) {\n c->isize *= 2;\n c->ilist = new_list;\n } else {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n item_remove(it);\n break;\n }\n }\n\n /*\n * Construct the response. Each hit adds three elements to the\n * outgoing data list:\n * \"VALUE \"\n * key\n * \" \" + flags + \" \" + data length + \"\\r\\n\" + data (with \\r\\n)\n */\n\n if (return_cas || !settings.inline_ascii_response)\n {\n MEMCACHED_COMMAND_GET(c->sfd, ITEM_key(it), it->nkey,\n it->nbytes, ITEM_get_cas(it));\n /* Goofy mid-flight realloc. */\n if (i >= c->suffixsize) {\n char **new_suffix_list = realloc(c->suffixlist,\n sizeof(char *) * c->suffixsize * 2);\n if (new_suffix_list) {\n c->suffixsize *= 2;\n c->suffixlist = new_suffix_list;\n } else {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n item_remove(it);\n break;\n }\n }\n\n suffix = do_cache_alloc(c->thread->suffix_cache);\n if (suffix == NULL) {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n out_of_memory(c, \"SERVER_ERROR out of memory making CAS suffix\");\n item_remove(it);\n while (i-- > 0) {\n item_remove(*(c->ilist + i));\n }\n return;\n }\n *(c->suffixlist + i) = suffix;\n int suffix_len = make_ascii_get_suffix(suffix, it, return_cas);\n if (add_iov(c, \"VALUE \", 6) != 0 ||\n add_iov(c, ITEM_key(it), it->nkey) != 0 ||\n (settings.inline_ascii_response && add_iov(c, ITEM_suffix(it), it->nsuffix - 2) != 0) ||\n add_iov(c, suffix, suffix_len) != 0)\n {\n item_remove(it);\n break;\n }\n if ((it->it_flags & ITEM_CHUNKED) == 0) {\n add_iov(c, ITEM_data(it), it->nbytes);\n } else if (add_chunked_item_iovs(c, it, it->nbytes) != 0) {\n item_remove(it);\n break;\n }\n }\n else\n {\n MEMCACHED_COMMAND_GET(c->sfd, ITEM_key(it), it->nkey,\n it->nbytes, ITEM_get_cas(it));\n if (add_iov(c, \"VALUE \", 6) != 0 ||\n add_iov(c, ITEM_key(it), it->nkey) != 0)\n {\n item_remove(it);\n break;\n }\n if ((it->it_flags & ITEM_CHUNKED) == 0)\n {\n if (add_iov(c, ITEM_suffix(it), it->nsuffix + it->nbytes) != 0)\n {\n item_remove(it);\n break;\n }\n } else if (add_iov(c, ITEM_suffix(it), it->nsuffix) != 0 ||\n add_chunked_item_iovs(c, it, it->nbytes) != 0) {\n item_remove(it);\n break;\n }\n }\n\n\n if (settings.verbose > 1) {\n int ii;\n fprintf(stderr, \">%d sending key \", c->sfd);\n for (ii = 0; ii < it->nkey; ++ii) {\n fprintf(stderr, \"%c\", key[ii]);\n }\n fprintf(stderr, \"\\n\");\n }\n\n /* item_get() has incremented it->refcount for us */\n pthread_mutex_lock(&c->thread->stats.mutex);\n c->thread->stats.slab_stats[ITEM_clsid(it)].get_hits++;\n c->thread->stats.get_cmds++;\n pthread_mutex_unlock(&c->thread->stats.mutex);\n *(c->ilist + i) = it;\n i++;\n\n } else {\n pthread_mutex_lock(&c->thread->stats.mutex);\n c->thread->stats.get_misses++;\n c->thread->stats.get_cmds++;\n pthread_mutex_unlock(&c->thread->stats.mutex);\n MEMCACHED_COMMAND_GET(c->sfd, key, nkey, -1, 0);\n }\n\n key_token++;\n }\n\n /*\n * If the command string hasn't been fully processed, get the next set\n * of tokens.\n */\n if(key_token->value != NULL) {\n ntokens = tokenize_command(key_token->value, tokens, MAX_TOKENS);\n key_token = tokens;\n }\n\n } while(key_token->value != NULL);\n\n c->icurr = c->ilist;\n c->ileft = i;\n if (return_cas || !settings.inline_ascii_response) {\n c->suffixcurr = c->suffixlist;\n c->suffixleft = i;\n }\n\n if (settings.verbose > 1)\n fprintf(stderr, \">%d END\\n\", c->sfd);\n\n /*\n If the loop was terminated because of out-of-memory, it is not\n reliable to add END\\r\\n to the buffer, because it might not end\n in \\r\\n. So we send SERVER_ERROR instead.\n */\n if (key_token->value != NULL || add_iov(c, \"END\\r\\n\", 5) != 0\n || (IS_UDP(c->transport) && build_udp_headers(c) != 0)) {\n out_of_memory(c, \"SERVER_ERROR out of memory writing get response\");\n }\n else {\n conn_set_state(c, conn_mwrite);\n c->msgcurr = 0;\n }\n}","lang":"c","vul_type":"cwe-190","target_token_count":1491,"sven_meta":{"func_name":"process_get_command","file_name":"memcached.c","commit_link":"github.com/memcached/memcached/commit/a8c4a82787b8b6c256d61bd5c42fb7f92d1bae00","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#6-c2a66c3aa481","input":"int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,\n\t\t\tint cpu_id)\n{\n\tstruct ring_buffer_per_cpu *cpu_buffer;\n\tunsigned long nr_pages;\n\tint cpu, err = 0;\n\n\t/*\n\t * Always succeed at resizing a non-existent buffer:\n\t */\n\tif (!buffer)\n\t\treturn size;\n\n\t/* Make sure the requested buffer exists */\n\tif (cpu_id != RING_BUFFER_ALL_CPUS &&\n\t !cpumask_test_cpu(cpu_id, buffer->cpumask))\n\t\treturn size;\n\n\tsize = DIV_ROUND_UP(size, BUF_PAGE_SIZE);\n\tsize *= BUF_PAGE_SIZE;\n\n\t/* we need a minimum of two pages */\n\tif (size < BUF_PAGE_SIZE * 2)\n\t\tsize = BUF_PAGE_SIZE * 2;\n\n\tnr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);\n\n\t/*\n\t * Don't succeed if resizing is disabled, as a reader might be\n\t * manipulating the ring buffer and is expecting a sane state while\n\t * this is true.\n\t */\n\tif (atomic_read(&buffer->resize_disabled))\n\t\treturn -EBUSY;\n\n\t/* prevent another thread from changing buffer sizes */\n\tmutex_lock(&buffer->mutex);\n\n\tif (cpu_id == RING_BUFFER_ALL_CPUS) {\n\t\t/* calculate the pages to update */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\n\t\t\tcpu_buffer->nr_pages_to_update = nr_pages -\n\t\t\t\t\t\t\tcpu_buffer->nr_pages;\n\t\t\t/*\n\t\t\t * nothing more to do for removing pages or no update\n\t\t\t */\n\t\t\tif (cpu_buffer->nr_pages_to_update <= 0)\n\t\t\t\tcontinue;\n\t\t\t/*\n\t\t\t * to add pages, make sure all new pages can be\n\t\t\t * allocated without receiving ENOMEM\n\t\t\t */\n\t\t\tINIT_LIST_HEAD(&cpu_buffer->new_pages);\n\t\t\tif (__rb_allocate_pages(cpu_buffer->nr_pages_to_update,\n\t\t\t\t\t\t&cpu_buffer->new_pages, cpu)) {\n\t\t\t\t/* not enough memory for new pages */\n\t\t\t\terr = -ENOMEM;\n\t\t\t\tgoto out_err;\n\t\t\t}\n\t\t}\n\n\t\tget_online_cpus();\n\t\t/*\n\t\t * Fire off all the required work handlers\n\t\t * We can't schedule on offline CPUs, but it's not necessary\n\t\t * since we can change their buffer sizes without any race.\n\t\t */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\tif (!cpu_buffer->nr_pages_to_update)\n\t\t\t\tcontinue;\n\n\t\t\t/* Can't run something on an offline CPU. */\n\t\t\tif (!cpu_online(cpu)) {\n\t\t\t\trb_update_pages(cpu_buffer);\n\t\t\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\t\t} else {\n\t\t\t\tschedule_work_on(cpu,\n\t\t\t\t\t\t&cpu_buffer->update_pages_work);\n\t\t\t}\n\t\t}\n\n\t\t/* wait for all the updates to complete */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\tif (!cpu_buffer->nr_pages_to_update)\n\t\t\t\tcontinue;\n\n\t\t\tif (cpu_online(cpu))\n\t\t\t\twait_for_completion(&cpu_buffer->update_done);\n\t\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\t}\n\n\t\tput_online_cpus();\n\t} else {\n\t\t/* Make sure this CPU has been intitialized */\n\t\tif (!cpumask_test_cpu(cpu_id, buffer->cpumask))\n\t\t\tgoto out;\n\n\t\tcpu_buffer = buffer->buffers[cpu_id];\n\n\t\tif (nr_pages == cpu_buffer->nr_pages)\n\t\t\tgoto out;\n\n\t\tcpu_buffer->nr_pages_to_update = nr_pages -\n\t\t\t\t\t\tcpu_buffer->nr_pages;\n\n\t\tINIT_LIST_HEAD(&cpu_buffer->new_pages);\n\t\tif (cpu_buffer->nr_pages_to_update > 0 &&\n\t\t\t__rb_allocate_pages(cpu_buffer->nr_pages_to_update,\n\t\t\t\t\t &cpu_buffer->new_pages, cpu_id)) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto out_err;\n\t\t}\n\n\t\tget_online_cpus();\n\n\t\t/* Can't run something on an offline CPU. */\n\t\tif (!cpu_online(cpu_id))\n\t\t\trb_update_pages(cpu_buffer);\n\t\telse {\n\t\t\tschedule_work_on(cpu_id,\n\t\t\t\t\t &cpu_buffer->update_pages_work);\n\t\t\twait_for_completion(&cpu_buffer->update_done);\n\t\t}\n\n\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\tput_online_cpus();\n\t}\n\n out:\n\t/*\n\t * The ring buffer resize can happen with the ring buffer\n\t * enabled, so that the update disturbs the tracing as little\n\t * as possible. But if the buffer is disabled, we do not need\n\t * to worry about that, and we can take the time to verify\n\t * that the buffer is not corrupt.\n\t */\n\tif (atomic_read(&buffer->record_disabled)) {\n\t\tatomic_inc(&buffer->record_disabled);\n\t\t/*\n\t\t * Even though the buffer was disabled, we must make sure\n\t\t * that it is truly disabled before calling rb_check_pages.\n\t\t * There could have been a race between checking\n\t\t * record_disable and incrementing it.\n\t\t */\n\t\tsynchronize_sched();\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\trb_check_pages(cpu_buffer);\n\t\t}\n\t\tatomic_dec(&buffer->record_disabled);\n\t}\n\n\tmutex_unlock(&buffer->mutex);\n\treturn size;\n\n out_err:\n\tfor_each_buffer_cpu(buffer, cpu) {\n\t\tstruct buffer_page *bpage, *tmp;\n\n\t\tcpu_buffer = buffer->buffers[cpu];\n\t\tcpu_buffer->nr_pages_to_update = 0;\n\n\t\tif (list_empty(&cpu_buffer->new_pages))\n\t\t\tcontinue;\n\n\t\tlist_for_each_entry_safe(bpage, tmp, &cpu_buffer->new_pages,\n\t\t\t\t\tlist) {\n\t\t\tlist_del_init(&bpage->list);\n\t\t\tfree_buffer_page(bpage);\n\t\t}\n\t}\n\tmutex_unlock(&buffer->mutex);\n\treturn err;\n}","target":"int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,\n\t\t\tint cpu_id)\n{\n\tstruct ring_buffer_per_cpu *cpu_buffer;\n\tunsigned long nr_pages;\n\tint cpu, err = 0;\n\n\t/*\n\t * Always succeed at resizing a non-existent buffer:\n\t */\n\tif (!buffer)\n\t\treturn size;\n\n\t/* Make sure the requested buffer exists */\n\tif (cpu_id != RING_BUFFER_ALL_CPUS &&\n\t !cpumask_test_cpu(cpu_id, buffer->cpumask))\n\t\treturn size;\n\n\tnr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);\n\n\t/* we need a minimum of two pages */\n\tif (nr_pages < 2)\n\t\tnr_pages = 2;\n\n\tsize = nr_pages * BUF_PAGE_SIZE;\n\n\t/*\n\t * Don't succeed if resizing is disabled, as a reader might be\n\t * manipulating the ring buffer and is expecting a sane state while\n\t * this is true.\n\t */\n\tif (atomic_read(&buffer->resize_disabled))\n\t\treturn -EBUSY;\n\n\t/* prevent another thread from changing buffer sizes */\n\tmutex_lock(&buffer->mutex);\n\n\tif (cpu_id == RING_BUFFER_ALL_CPUS) {\n\t\t/* calculate the pages to update */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\n\t\t\tcpu_buffer->nr_pages_to_update = nr_pages -\n\t\t\t\t\t\t\tcpu_buffer->nr_pages;\n\t\t\t/*\n\t\t\t * nothing more to do for removing pages or no update\n\t\t\t */\n\t\t\tif (cpu_buffer->nr_pages_to_update <= 0)\n\t\t\t\tcontinue;\n\t\t\t/*\n\t\t\t * to add pages, make sure all new pages can be\n\t\t\t * allocated without receiving ENOMEM\n\t\t\t */\n\t\t\tINIT_LIST_HEAD(&cpu_buffer->new_pages);\n\t\t\tif (__rb_allocate_pages(cpu_buffer->nr_pages_to_update,\n\t\t\t\t\t\t&cpu_buffer->new_pages, cpu)) {\n\t\t\t\t/* not enough memory for new pages */\n\t\t\t\terr = -ENOMEM;\n\t\t\t\tgoto out_err;\n\t\t\t}\n\t\t}\n\n\t\tget_online_cpus();\n\t\t/*\n\t\t * Fire off all the required work handlers\n\t\t * We can't schedule on offline CPUs, but it's not necessary\n\t\t * since we can change their buffer sizes without any race.\n\t\t */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\tif (!cpu_buffer->nr_pages_to_update)\n\t\t\t\tcontinue;\n\n\t\t\t/* Can't run something on an offline CPU. */\n\t\t\tif (!cpu_online(cpu)) {\n\t\t\t\trb_update_pages(cpu_buffer);\n\t\t\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\t\t} else {\n\t\t\t\tschedule_work_on(cpu,\n\t\t\t\t\t\t&cpu_buffer->update_pages_work);\n\t\t\t}\n\t\t}\n\n\t\t/* wait for all the updates to complete */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\tif (!cpu_buffer->nr_pages_to_update)\n\t\t\t\tcontinue;\n\n\t\t\tif (cpu_online(cpu))\n\t\t\t\twait_for_completion(&cpu_buffer->update_done);\n\t\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\t}\n\n\t\tput_online_cpus();\n\t} else {\n\t\t/* Make sure this CPU has been intitialized */\n\t\tif (!cpumask_test_cpu(cpu_id, buffer->cpumask))\n\t\t\tgoto out;\n\n\t\tcpu_buffer = buffer->buffers[cpu_id];\n\n\t\tif (nr_pages == cpu_buffer->nr_pages)\n\t\t\tgoto out;\n\n\t\tcpu_buffer->nr_pages_to_update = nr_pages -\n\t\t\t\t\t\tcpu_buffer->nr_pages;\n\n\t\tINIT_LIST_HEAD(&cpu_buffer->new_pages);\n\t\tif (cpu_buffer->nr_pages_to_update > 0 &&\n\t\t\t__rb_allocate_pages(cpu_buffer->nr_pages_to_update,\n\t\t\t\t\t &cpu_buffer->new_pages, cpu_id)) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto out_err;\n\t\t}\n\n\t\tget_online_cpus();\n\n\t\t/* Can't run something on an offline CPU. */\n\t\tif (!cpu_online(cpu_id))\n\t\t\trb_update_pages(cpu_buffer);\n\t\telse {\n\t\t\tschedule_work_on(cpu_id,\n\t\t\t\t\t &cpu_buffer->update_pages_work);\n\t\t\twait_for_completion(&cpu_buffer->update_done);\n\t\t}\n\n\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\tput_online_cpus();\n\t}\n\n out:\n\t/*\n\t * The ring buffer resize can happen with the ring buffer\n\t * enabled, so that the update disturbs the tracing as little\n\t * as possible. But if the buffer is disabled, we do not need\n\t * to worry about that, and we can take the time to verify\n\t * that the buffer is not corrupt.\n\t */\n\tif (atomic_read(&buffer->record_disabled)) {\n\t\tatomic_inc(&buffer->record_disabled);\n\t\t/*\n\t\t * Even though the buffer was disabled, we must make sure\n\t\t * that it is truly disabled before calling rb_check_pages.\n\t\t * There could have been a race between checking\n\t\t * record_disable and incrementing it.\n\t\t */\n\t\tsynchronize_sched();\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\trb_check_pages(cpu_buffer);\n\t\t}\n\t\tatomic_dec(&buffer->record_disabled);\n\t}\n\n\tmutex_unlock(&buffer->mutex);\n\treturn size;\n\n out_err:\n\tfor_each_buffer_cpu(buffer, cpu) {\n\t\tstruct buffer_page *bpage, *tmp;\n\n\t\tcpu_buffer = buffer->buffers[cpu];\n\t\tcpu_buffer->nr_pages_to_update = 0;\n\n\t\tif (list_empty(&cpu_buffer->new_pages))\n\t\t\tcontinue;\n\n\t\tlist_for_each_entry_safe(bpage, tmp, &cpu_buffer->new_pages,\n\t\t\t\t\tlist) {\n\t\t\tlist_del_init(&bpage->list);\n\t\t\tfree_buffer_page(bpage);\n\t\t}\n\t}\n\tmutex_unlock(&buffer->mutex);\n\treturn err;\n}","lang":"c","vul_type":"cwe-190","target_token_count":1205,"sven_meta":{"func_name":"ring_buffer_resize","file_name":"kernel/trace/ring_buffer.c","commit_link":"github.com/torvalds/linux/commit/59643d1535eb220668692a5359de22545af579f6","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#7-9f59655978f4","input":"static pngquant_error rwpng_read_image24_libpng(FILE *infile, png24_image *mainprog_ptr, int verbose)\n{\n png_structp png_ptr = NULL;\n png_infop info_ptr = NULL;\n png_size_t rowbytes;\n int color_type, bit_depth;\n\n png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr,\n rwpng_error_handler, verbose ? rwpng_warning_stderr_handler : rwpng_warning_silent_handler);\n if (!png_ptr) {\n return PNG_OUT_OF_MEMORY_ERROR; /* out of memory */\n }\n\n info_ptr = png_create_info_struct(png_ptr);\n if (!info_ptr) {\n png_destroy_read_struct(&png_ptr, NULL, NULL);\n return PNG_OUT_OF_MEMORY_ERROR; /* out of memory */\n }\n\n /* setjmp() must be called in every function that calls a non-trivial\n * libpng function */\n\n if (setjmp(mainprog_ptr->jmpbuf)) {\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return LIBPNG_FATAL_ERROR; /* fatal libpng error (via longjmp()) */\n }\n\n#if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && defined(PNG_SET_OPTION_SUPPORTED)\n png_set_option(png_ptr, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON);\n#endif\n\n#if PNG_LIBPNG_VER >= 10500 && defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)\n /* copy standard chunks too */\n png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_IF_SAFE, (png_const_bytep)\"pHYs\\0iTXt\\0tEXt\\0zTXt\", 4);\n#endif\n png_set_read_user_chunk_fn(png_ptr, &mainprog_ptr->chunks, read_chunk_callback);\n\n struct rwpng_read_data read_data = {infile, 0};\n png_set_read_fn(png_ptr, &read_data, user_read_data);\n\n png_read_info(png_ptr, info_ptr); /* read all PNG info up to image data */\n\n /* alternatively, could make separate calls to png_get_image_width(),\n * etc., but want bit_depth and color_type for later [don't care about\n * compression_type and filter_type => NULLs] */\n\n png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width, &mainprog_ptr->height,\n &bit_depth, &color_type, NULL, NULL, NULL);\n\n // For overflow safety reject images that won't fit in 32-bit\n if (mainprog_ptr->width > INT_MAX/mainprog_ptr->height) {\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return PNG_OUT_OF_MEMORY_ERROR; /* not quite true, but whatever */\n }\n\n /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,\n * transparency chunks to full alpha channel; strip 16-bit-per-sample\n * images to 8 bits per sample; and convert grayscale to RGB[A] */\n\n /* GRR TO DO: preserve all safe-to-copy ancillary PNG chunks */\n\n if (!(color_type & PNG_COLOR_MASK_ALPHA)) {\n#ifdef PNG_READ_FILLER_SUPPORTED\n png_set_expand(png_ptr);\n png_set_filler(png_ptr, 65535L, PNG_FILLER_AFTER);\n#else\n fprintf(stderr, \"pngquant readpng: image is neither RGBA nor GA\\n\");\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n mainprog_ptr->retval = WRONG_INPUT_COLOR_TYPE;\n return mainprog_ptr->retval;\n#endif\n }\n\n if (bit_depth == 16) {\n png_set_strip_16(png_ptr);\n }\n\n if (!(color_type & PNG_COLOR_MASK_COLOR)) {\n png_set_gray_to_rgb(png_ptr);\n }\n\n /* get source gamma for gamma correction, or use sRGB default */\n double gamma = 0.45455;\n if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {\n mainprog_ptr->input_color = RWPNG_SRGB;\n mainprog_ptr->output_color = RWPNG_SRGB;\n } else {\n png_get_gAMA(png_ptr, info_ptr, &gamma);\n if (gamma > 0 && gamma <= 1.0) {\n mainprog_ptr->input_color = RWPNG_GAMA_ONLY;\n mainprog_ptr->output_color = RWPNG_GAMA_ONLY;\n } else {\n fprintf(stderr, \"pngquant readpng: ignored out-of-range gamma %f\\n\", gamma);\n mainprog_ptr->input_color = RWPNG_NONE;\n mainprog_ptr->output_color = RWPNG_NONE;\n gamma = 0.45455;\n }\n }\n mainprog_ptr->gamma = gamma;\n\n png_set_interlace_handling(png_ptr);\n\n /* all transformations have been registered; now update info_ptr data,\n * get rowbytes and channels, and allocate image memory */\n\n png_read_update_info(png_ptr, info_ptr);\n\n rowbytes = png_get_rowbytes(png_ptr, info_ptr);\n\n if ((mainprog_ptr->rgba_data = malloc(rowbytes * mainprog_ptr->height)) == NULL) {\n fprintf(stderr, \"pngquant readpng: unable to allocate image data\\n\");\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return PNG_OUT_OF_MEMORY_ERROR;\n }\n\n png_bytepp row_pointers = rwpng_create_row_pointers(info_ptr, png_ptr, mainprog_ptr->rgba_data, mainprog_ptr->height, 0);\n\n /* now we can go ahead and just read the whole image */\n\n png_read_image(png_ptr, row_pointers);\n\n /* and we're done! (png_read_end() can be omitted if no processing of\n * post-IDAT text/time/etc. is desired) */\n\n png_read_end(png_ptr, NULL);\n\n#if USE_LCMS\n#if PNG_LIBPNG_VER < 10500\n png_charp ProfileData;\n#else\n png_bytep ProfileData;\n#endif\n png_uint_32 ProfileLen;\n\n cmsHPROFILE hInProfile = NULL;\n\n /* color_type is read from the image before conversion to RGBA */\n int COLOR_PNG = color_type & PNG_COLOR_MASK_COLOR;\n\n /* embedded ICC profile */\n if (png_get_iCCP(png_ptr, info_ptr, &(png_charp){0}, &(int){0}, &ProfileData, &ProfileLen)) {\n\n hInProfile = cmsOpenProfileFromMem(ProfileData, ProfileLen);\n cmsColorSpaceSignature colorspace = cmsGetColorSpace(hInProfile);\n\n /* only RGB (and GRAY) valid for PNGs */\n if (colorspace == cmsSigRgbData && COLOR_PNG) {\n mainprog_ptr->input_color = RWPNG_ICCP;\n mainprog_ptr->output_color = RWPNG_SRGB;\n } else {\n if (colorspace == cmsSigGrayData && !COLOR_PNG) {\n mainprog_ptr->input_color = RWPNG_ICCP_WARN_GRAY;\n mainprog_ptr->output_color = RWPNG_SRGB;\n }\n cmsCloseProfile(hInProfile);\n hInProfile = NULL;\n }\n }\n\n /* build RGB profile from cHRM and gAMA */\n if (hInProfile == NULL && COLOR_PNG &&\n !png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB) &&\n png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA) &&\n png_get_valid(png_ptr, info_ptr, PNG_INFO_cHRM)) {\n\n cmsCIExyY WhitePoint;\n cmsCIExyYTRIPLE Primaries;\n\n png_get_cHRM(png_ptr, info_ptr, &WhitePoint.x, &WhitePoint.y,\n &Primaries.Red.x, &Primaries.Red.y,\n &Primaries.Green.x, &Primaries.Green.y,\n &Primaries.Blue.x, &Primaries.Blue.y);\n\n WhitePoint.Y = Primaries.Red.Y = Primaries.Green.Y = Primaries.Blue.Y = 1.0;\n\n cmsToneCurve *GammaTable[3];\n GammaTable[0] = GammaTable[1] = GammaTable[2] = cmsBuildGamma(NULL, 1/gamma);\n\n hInProfile = cmsCreateRGBProfile(&WhitePoint, &Primaries, GammaTable);\n\n cmsFreeToneCurve(GammaTable[0]);\n\n mainprog_ptr->input_color = RWPNG_GAMA_CHRM;\n mainprog_ptr->output_color = RWPNG_SRGB;\n }\n\n /* transform image to sRGB colorspace */\n if (hInProfile != NULL) {\n\n cmsHPROFILE hOutProfile = cmsCreate_sRGBProfile();\n cmsHTRANSFORM hTransform = cmsCreateTransform(hInProfile, TYPE_RGBA_8,\n hOutProfile, TYPE_RGBA_8,\n INTENT_PERCEPTUAL,\n omp_get_max_threads() > 1 ? cmsFLAGS_NOCACHE : 0);\n\n #pragma omp parallel for \\\n if (mainprog_ptr->height*mainprog_ptr->width > 8000) \\\n schedule(static)\n for (unsigned int i = 0; i < mainprog_ptr->height; i++) {\n /* It is safe to use the same block for input and output,\n when both are of the same TYPE. */\n cmsDoTransform(hTransform, row_pointers[i],\n row_pointers[i],\n mainprog_ptr->width);\n }\n\n cmsDeleteTransform(hTransform);\n cmsCloseProfile(hOutProfile);\n cmsCloseProfile(hInProfile);\n\n mainprog_ptr->gamma = 0.45455;\n }\n#endif\n\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n\n mainprog_ptr->file_size = read_data.bytes_read;\n mainprog_ptr->row_pointers = (unsigned char **)row_pointers;\n\n return SUCCESS;\n}","target":"static pngquant_error rwpng_read_image24_libpng(FILE *infile, png24_image *mainprog_ptr, int verbose)\n{\n png_structp png_ptr = NULL;\n png_infop info_ptr = NULL;\n png_size_t rowbytes;\n int color_type, bit_depth;\n\n png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr,\n rwpng_error_handler, verbose ? rwpng_warning_stderr_handler : rwpng_warning_silent_handler);\n if (!png_ptr) {\n return PNG_OUT_OF_MEMORY_ERROR; /* out of memory */\n }\n\n info_ptr = png_create_info_struct(png_ptr);\n if (!info_ptr) {\n png_destroy_read_struct(&png_ptr, NULL, NULL);\n return PNG_OUT_OF_MEMORY_ERROR; /* out of memory */\n }\n\n /* setjmp() must be called in every function that calls a non-trivial\n * libpng function */\n\n if (setjmp(mainprog_ptr->jmpbuf)) {\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return LIBPNG_FATAL_ERROR; /* fatal libpng error (via longjmp()) */\n }\n\n#if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && defined(PNG_SET_OPTION_SUPPORTED)\n png_set_option(png_ptr, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON);\n#endif\n\n#if PNG_LIBPNG_VER >= 10500 && defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)\n /* copy standard chunks too */\n png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_IF_SAFE, (png_const_bytep)\"pHYs\\0iTXt\\0tEXt\\0zTXt\", 4);\n#endif\n png_set_read_user_chunk_fn(png_ptr, &mainprog_ptr->chunks, read_chunk_callback);\n\n struct rwpng_read_data read_data = {infile, 0};\n png_set_read_fn(png_ptr, &read_data, user_read_data);\n\n png_read_info(png_ptr, info_ptr); /* read all PNG info up to image data */\n\n /* alternatively, could make separate calls to png_get_image_width(),\n * etc., but want bit_depth and color_type for later [don't care about\n * compression_type and filter_type => NULLs] */\n\n png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width, &mainprog_ptr->height,\n &bit_depth, &color_type, NULL, NULL, NULL);\n\n /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,\n * transparency chunks to full alpha channel; strip 16-bit-per-sample\n * images to 8 bits per sample; and convert grayscale to RGB[A] */\n\n /* GRR TO DO: preserve all safe-to-copy ancillary PNG chunks */\n\n if (!(color_type & PNG_COLOR_MASK_ALPHA)) {\n#ifdef PNG_READ_FILLER_SUPPORTED\n png_set_expand(png_ptr);\n png_set_filler(png_ptr, 65535L, PNG_FILLER_AFTER);\n#else\n fprintf(stderr, \"pngquant readpng: image is neither RGBA nor GA\\n\");\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n mainprog_ptr->retval = WRONG_INPUT_COLOR_TYPE;\n return mainprog_ptr->retval;\n#endif\n }\n\n if (bit_depth == 16) {\n png_set_strip_16(png_ptr);\n }\n\n if (!(color_type & PNG_COLOR_MASK_COLOR)) {\n png_set_gray_to_rgb(png_ptr);\n }\n\n /* get source gamma for gamma correction, or use sRGB default */\n double gamma = 0.45455;\n if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {\n mainprog_ptr->input_color = RWPNG_SRGB;\n mainprog_ptr->output_color = RWPNG_SRGB;\n } else {\n png_get_gAMA(png_ptr, info_ptr, &gamma);\n if (gamma > 0 && gamma <= 1.0) {\n mainprog_ptr->input_color = RWPNG_GAMA_ONLY;\n mainprog_ptr->output_color = RWPNG_GAMA_ONLY;\n } else {\n fprintf(stderr, \"pngquant readpng: ignored out-of-range gamma %f\\n\", gamma);\n mainprog_ptr->input_color = RWPNG_NONE;\n mainprog_ptr->output_color = RWPNG_NONE;\n gamma = 0.45455;\n }\n }\n mainprog_ptr->gamma = gamma;\n\n png_set_interlace_handling(png_ptr);\n\n /* all transformations have been registered; now update info_ptr data,\n * get rowbytes and channels, and allocate image memory */\n\n png_read_update_info(png_ptr, info_ptr);\n\n rowbytes = png_get_rowbytes(png_ptr, info_ptr);\n\n // For overflow safety reject images that won't fit in 32-bit\n if (rowbytes > INT_MAX/mainprog_ptr->height) {\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return PNG_OUT_OF_MEMORY_ERROR;\n }\n\n if ((mainprog_ptr->rgba_data = malloc(rowbytes * mainprog_ptr->height)) == NULL) {\n fprintf(stderr, \"pngquant readpng: unable to allocate image data\\n\");\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return PNG_OUT_OF_MEMORY_ERROR;\n }\n\n png_bytepp row_pointers = rwpng_create_row_pointers(info_ptr, png_ptr, mainprog_ptr->rgba_data, mainprog_ptr->height, 0);\n\n /* now we can go ahead and just read the whole image */\n\n png_read_image(png_ptr, row_pointers);\n\n /* and we're done! (png_read_end() can be omitted if no processing of\n * post-IDAT text/time/etc. is desired) */\n\n png_read_end(png_ptr, NULL);\n\n#if USE_LCMS\n#if PNG_LIBPNG_VER < 10500\n png_charp ProfileData;\n#else\n png_bytep ProfileData;\n#endif\n png_uint_32 ProfileLen;\n\n cmsHPROFILE hInProfile = NULL;\n\n /* color_type is read from the image before conversion to RGBA */\n int COLOR_PNG = color_type & PNG_COLOR_MASK_COLOR;\n\n /* embedded ICC profile */\n if (png_get_iCCP(png_ptr, info_ptr, &(png_charp){0}, &(int){0}, &ProfileData, &ProfileLen)) {\n\n hInProfile = cmsOpenProfileFromMem(ProfileData, ProfileLen);\n cmsColorSpaceSignature colorspace = cmsGetColorSpace(hInProfile);\n\n /* only RGB (and GRAY) valid for PNGs */\n if (colorspace == cmsSigRgbData && COLOR_PNG) {\n mainprog_ptr->input_color = RWPNG_ICCP;\n mainprog_ptr->output_color = RWPNG_SRGB;\n } else {\n if (colorspace == cmsSigGrayData && !COLOR_PNG) {\n mainprog_ptr->input_color = RWPNG_ICCP_WARN_GRAY;\n mainprog_ptr->output_color = RWPNG_SRGB;\n }\n cmsCloseProfile(hInProfile);\n hInProfile = NULL;\n }\n }\n\n /* build RGB profile from cHRM and gAMA */\n if (hInProfile == NULL && COLOR_PNG &&\n !png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB) &&\n png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA) &&\n png_get_valid(png_ptr, info_ptr, PNG_INFO_cHRM)) {\n\n cmsCIExyY WhitePoint;\n cmsCIExyYTRIPLE Primaries;\n\n png_get_cHRM(png_ptr, info_ptr, &WhitePoint.x, &WhitePoint.y,\n &Primaries.Red.x, &Primaries.Red.y,\n &Primaries.Green.x, &Primaries.Green.y,\n &Primaries.Blue.x, &Primaries.Blue.y);\n\n WhitePoint.Y = Primaries.Red.Y = Primaries.Green.Y = Primaries.Blue.Y = 1.0;\n\n cmsToneCurve *GammaTable[3];\n GammaTable[0] = GammaTable[1] = GammaTable[2] = cmsBuildGamma(NULL, 1/gamma);\n\n hInProfile = cmsCreateRGBProfile(&WhitePoint, &Primaries, GammaTable);\n\n cmsFreeToneCurve(GammaTable[0]);\n\n mainprog_ptr->input_color = RWPNG_GAMA_CHRM;\n mainprog_ptr->output_color = RWPNG_SRGB;\n }\n\n /* transform image to sRGB colorspace */\n if (hInProfile != NULL) {\n\n cmsHPROFILE hOutProfile = cmsCreate_sRGBProfile();\n cmsHTRANSFORM hTransform = cmsCreateTransform(hInProfile, TYPE_RGBA_8,\n hOutProfile, TYPE_RGBA_8,\n INTENT_PERCEPTUAL,\n omp_get_max_threads() > 1 ? cmsFLAGS_NOCACHE : 0);\n\n #pragma omp parallel for \\\n if (mainprog_ptr->height*mainprog_ptr->width > 8000) \\\n schedule(static)\n for (unsigned int i = 0; i < mainprog_ptr->height; i++) {\n /* It is safe to use the same block for input and output,\n when both are of the same TYPE. */\n cmsDoTransform(hTransform, row_pointers[i],\n row_pointers[i],\n mainprog_ptr->width);\n }\n\n cmsDeleteTransform(hTransform);\n cmsCloseProfile(hOutProfile);\n cmsCloseProfile(hInProfile);\n\n mainprog_ptr->gamma = 0.45455;\n }\n#endif\n\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n\n mainprog_ptr->file_size = read_data.bytes_read;\n mainprog_ptr->row_pointers = (unsigned char **)row_pointers;\n\n return SUCCESS;\n}","lang":"c","vul_type":"cwe-190","target_token_count":2115,"sven_meta":{"func_name":"rwpng_read_image24_libpng","file_name":"rwpng.c","commit_link":"github.com/pornel/pngquant/commit/b7c217680cda02dddced245d237ebe8c383be285","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#9-86715854d32a","input":"static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n BMPInfo\n bmp_info;\n\n const char\n *option;\n\n const StringInfo\n *profile;\n\n MagickBooleanType\n have_color_info,\n status;\n\n MagickOffsetType\n scene;\n\n MemoryInfo\n *pixel_info;\n\n register const Quantum\n *p;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *q;\n\n size_t\n bytes_per_line,\n type;\n\n ssize_t\n y;\n\n unsigned char\n *bmp_data,\n *pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n type=4;\n if (LocaleCompare(image_info->magick,\"BMP2\") == 0)\n type=2;\n else\n if (LocaleCompare(image_info->magick,\"BMP3\") == 0)\n type=3;\n\n option=GetImageOption(image_info,\"bmp:format\");\n if (option != (char *) NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Format=%s\",option);\n\n if (LocaleCompare(option,\"bmp2\") == 0)\n type=2;\n if (LocaleCompare(option,\"bmp3\") == 0)\n type=3;\n if (LocaleCompare(option,\"bmp4\") == 0)\n type=4;\n }\n\n scene=0;\n do\n {\n /*\n Initialize BMP raster file header.\n */\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n (void) ResetMagickMemory(&bmp_info,0,sizeof(bmp_info));\n bmp_info.file_size=14+12;\n if (type > 2)\n bmp_info.file_size+=28;\n bmp_info.offset_bits=bmp_info.file_size;\n bmp_info.compression=BI_RGB;\n if ((image->storage_class == PseudoClass) && (image->colors > 256))\n (void) SetImageStorageClass(image,DirectClass,exception);\n if (image->storage_class != DirectClass)\n {\n /*\n Colormapped BMP raster.\n */\n bmp_info.bits_per_pixel=8;\n if (image->colors <= 2)\n bmp_info.bits_per_pixel=1;\n else\n if (image->colors <= 16)\n bmp_info.bits_per_pixel=4;\n else\n if (image->colors <= 256)\n bmp_info.bits_per_pixel=8;\n if (image_info->compression == RLECompression)\n bmp_info.bits_per_pixel=8;\n bmp_info.number_colors=1U << bmp_info.bits_per_pixel;\n if (image->alpha_trait != UndefinedPixelTrait)\n (void) SetImageStorageClass(image,DirectClass,exception);\n else\n if ((size_t) bmp_info.number_colors < image->colors)\n (void) SetImageStorageClass(image,DirectClass,exception);\n else\n {\n bmp_info.file_size+=3*(1UL << bmp_info.bits_per_pixel);\n bmp_info.offset_bits+=3*(1UL << bmp_info.bits_per_pixel);\n if (type > 2)\n {\n bmp_info.file_size+=(1UL << bmp_info.bits_per_pixel);\n bmp_info.offset_bits+=(1UL << bmp_info.bits_per_pixel);\n }\n }\n }\n if (image->storage_class == DirectClass)\n {\n /*\n Full color BMP raster.\n */\n bmp_info.number_colors=0;\n bmp_info.bits_per_pixel=(unsigned short)\n ((type > 3) && (image->alpha_trait != UndefinedPixelTrait) ? 32 : 24);\n bmp_info.compression=(unsigned int) ((type > 3) &&\n (image->alpha_trait != UndefinedPixelTrait) ? BI_BITFIELDS : BI_RGB);\n if ((type == 3) && (image->alpha_trait != UndefinedPixelTrait))\n {\n option=GetImageOption(image_info,\"bmp3:alpha\");\n if (IsStringTrue(option))\n bmp_info.bits_per_pixel=32;\n }\n }\n bytes_per_line=4*((image->columns*bmp_info.bits_per_pixel+31)/32);\n bmp_info.ba_offset=0;\n profile=GetImageProfile(image,\"icc\");\n have_color_info=(image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL) || (image->gamma != 0.0) ? MagickTrue :\n MagickFalse;\n if (type == 2)\n bmp_info.size=12;\n else\n if ((type == 3) || ((image->alpha_trait == UndefinedPixelTrait) &&\n (have_color_info == MagickFalse)))\n {\n type=3;\n bmp_info.size=40;\n }\n else\n {\n int\n extra_size;\n\n bmp_info.size=108;\n extra_size=68;\n if ((image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL))\n {\n bmp_info.size=124;\n extra_size+=16;\n }\n bmp_info.file_size+=extra_size;\n bmp_info.offset_bits+=extra_size;\n }\n bmp_info.width=(ssize_t) image->columns;\n bmp_info.height=(ssize_t) image->rows;\n bmp_info.planes=1;\n bmp_info.image_size=(unsigned int) (bytes_per_line*image->rows);\n bmp_info.file_size+=bmp_info.image_size;\n bmp_info.x_pixels=75*39;\n bmp_info.y_pixels=75*39;\n switch (image->units)\n {\n case UndefinedResolution:\n case PixelsPerInchResolution:\n {\n bmp_info.x_pixels=(unsigned int) (100.0*image->resolution.x/2.54);\n bmp_info.y_pixels=(unsigned int) (100.0*image->resolution.y/2.54);\n break;\n }\n case PixelsPerCentimeterResolution:\n {\n bmp_info.x_pixels=(unsigned int) (100.0*image->resolution.x);\n bmp_info.y_pixels=(unsigned int) (100.0*image->resolution.y);\n break;\n }\n }\n bmp_info.colors_important=bmp_info.number_colors;\n /*\n Convert MIFF to BMP raster pixels.\n */\n pixel_info=AcquireVirtualMemory((size_t) bmp_info.image_size,\n sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n (void) ResetMagickMemory(pixels,0,(size_t) bmp_info.image_size);\n switch (bmp_info.bits_per_pixel)\n {\n case 1:\n {\n size_t\n bit,\n byte;\n\n /*\n Convert PseudoClass image to a BMP monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n ssize_t\n offset;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n bit=0;\n byte=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n byte<<=1;\n byte|=GetPixelIndex(image,p) != 0 ? 0x01 : 0x00;\n bit++;\n if (bit == 8)\n {\n *q++=(unsigned char) byte;\n bit=0;\n byte=0;\n }\n p+=GetPixelChannels(image);\n }\n if (bit != 0)\n {\n *q++=(unsigned char) (byte << (8-bit));\n x++;\n }\n offset=(ssize_t) (image->columns+7)/8;\n for (x=offset; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 4:\n {\n size_t\n byte,\n nibble;\n\n ssize_t\n offset;\n\n /*\n Convert PseudoClass image to a BMP monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n nibble=0;\n byte=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n byte<<=4;\n byte|=((size_t) GetPixelIndex(image,p) & 0x0f);\n nibble++;\n if (nibble == 2)\n {\n *q++=(unsigned char) byte;\n nibble=0;\n byte=0;\n }\n p+=GetPixelChannels(image);\n }\n if (nibble != 0)\n {\n *q++=(unsigned char) (byte << 4);\n x++;\n }\n offset=(ssize_t) (image->columns+1)/2;\n for (x=offset; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 8:\n {\n /*\n Convert PseudoClass packet to BMP pixel.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=(unsigned char) GetPixelIndex(image,p);\n p+=GetPixelChannels(image);\n }\n for ( ; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 24:\n {\n /*\n Convert DirectClass packet to BMP BGR888.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(GetPixelBlue(image,p));\n *q++=ScaleQuantumToChar(GetPixelGreen(image,p));\n *q++=ScaleQuantumToChar(GetPixelRed(image,p));\n p+=GetPixelChannels(image);\n }\n for (x=3L*(ssize_t) image->columns; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 32:\n {\n /*\n Convert DirectClass packet to ARGB8888 pixel.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(GetPixelBlue(image,p));\n *q++=ScaleQuantumToChar(GetPixelGreen(image,p));\n *q++=ScaleQuantumToChar(GetPixelRed(image,p));\n *q++=ScaleQuantumToChar(GetPixelAlpha(image,p));\n p+=GetPixelChannels(image);\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n }\n if ((type > 2) && (bmp_info.bits_per_pixel == 8))\n if (image_info->compression != NoCompression)\n {\n MemoryInfo\n *rle_info;\n\n /*\n Convert run-length encoded raster pixels.\n */\n rle_info=AcquireVirtualMemory((size_t) (2*(bytes_per_line+2)+2),\n (image->rows+2)*sizeof(*pixels));\n if (rle_info == (MemoryInfo *) NULL)\n {\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n bmp_data=(unsigned char *) GetVirtualMemoryBlob(rle_info);\n bmp_info.file_size-=bmp_info.image_size;\n bmp_info.image_size=(unsigned int) EncodeImage(image,bytes_per_line,\n pixels,bmp_data);\n bmp_info.file_size+=bmp_info.image_size;\n pixel_info=RelinquishVirtualMemory(pixel_info);\n pixel_info=rle_info;\n pixels=bmp_data;\n bmp_info.compression=BI_RLE8;\n }\n /*\n Write BMP for Windows, all versions, 14-byte header.\n */\n if (image->debug != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing BMP version %.20g datastream\",(double) type);\n if (image->storage_class == DirectClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Storage class=DirectClass\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Storage class=PseudoClass\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image depth=%.20g\",(double) image->depth);\n if (image->alpha_trait != UndefinedPixelTrait)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Matte=True\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Matte=MagickFalse\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" BMP bits_per_pixel=%.20g\",(double) bmp_info.bits_per_pixel);\n switch ((int) bmp_info.compression)\n {\n case BI_RGB:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_RGB\");\n break;\n }\n case BI_RLE8:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_RLE8\");\n break;\n }\n case BI_BITFIELDS:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_BITFIELDS\");\n break;\n }\n default:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=UNKNOWN (%lu)\",bmp_info.compression);\n break;\n }\n }\n if (bmp_info.number_colors == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number_colors=unspecified\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number_colors=%lu\",bmp_info.number_colors);\n }\n (void) WriteBlob(image,2,(unsigned char *) \"BM\");\n (void) WriteBlobLSBLong(image,bmp_info.file_size);\n (void) WriteBlobLSBLong(image,bmp_info.ba_offset); /* always 0 */\n (void) WriteBlobLSBLong(image,bmp_info.offset_bits);\n if (type == 2)\n {\n /*\n Write 12-byte version 2 bitmap header.\n */\n (void) WriteBlobLSBLong(image,bmp_info.size);\n (void) WriteBlobLSBSignedShort(image,(signed short) bmp_info.width);\n (void) WriteBlobLSBSignedShort(image,(signed short) bmp_info.height);\n (void) WriteBlobLSBShort(image,bmp_info.planes);\n (void) WriteBlobLSBShort(image,bmp_info.bits_per_pixel);\n }\n else\n {\n /*\n Write 40-byte version 3+ bitmap header.\n */\n (void) WriteBlobLSBLong(image,bmp_info.size);\n (void) WriteBlobLSBSignedLong(image,(signed int) bmp_info.width);\n (void) WriteBlobLSBSignedLong(image,(signed int) bmp_info.height);\n (void) WriteBlobLSBShort(image,bmp_info.planes);\n (void) WriteBlobLSBShort(image,bmp_info.bits_per_pixel);\n (void) WriteBlobLSBLong(image,bmp_info.compression);\n (void) WriteBlobLSBLong(image,bmp_info.image_size);\n (void) WriteBlobLSBLong(image,bmp_info.x_pixels);\n (void) WriteBlobLSBLong(image,bmp_info.y_pixels);\n (void) WriteBlobLSBLong(image,bmp_info.number_colors);\n (void) WriteBlobLSBLong(image,bmp_info.colors_important);\n }\n if ((type > 3) && ((image->alpha_trait != UndefinedPixelTrait) ||\n (have_color_info != MagickFalse)))\n {\n /*\n Write the rest of the 108-byte BMP Version 4 header.\n */\n (void) WriteBlobLSBLong(image,0x00ff0000U); /* Red mask */\n (void) WriteBlobLSBLong(image,0x0000ff00U); /* Green mask */\n (void) WriteBlobLSBLong(image,0x000000ffU); /* Blue mask */\n (void) WriteBlobLSBLong(image,0xff000000U); /* Alpha mask */\n (void) WriteBlobLSBLong(image,0x73524742U); /* sRGB */\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.red_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.red_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.red_primary.x+\n image->chromaticity.red_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.green_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.green_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.green_primary.x+\n image->chromaticity.green_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.blue_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.blue_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.blue_primary.x+\n image->chromaticity.blue_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.x*0x10000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.y*0x10000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.z*0x10000));\n if ((image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL))\n {\n ssize_t\n intent;\n\n switch ((int) image->rendering_intent)\n {\n case SaturationIntent:\n {\n intent=LCS_GM_BUSINESS;\n break;\n }\n case RelativeIntent:\n {\n intent=LCS_GM_GRAPHICS;\n break;\n }\n case PerceptualIntent:\n {\n intent=LCS_GM_IMAGES;\n break;\n }\n case AbsoluteIntent:\n {\n intent=LCS_GM_ABS_COLORIMETRIC;\n break;\n }\n default:\n {\n intent=0;\n break;\n }\n }\n (void) WriteBlobLSBLong(image,(unsigned int) intent);\n (void) WriteBlobLSBLong(image,0x00); /* dummy profile data */\n (void) WriteBlobLSBLong(image,0x00); /* dummy profile length */\n (void) WriteBlobLSBLong(image,0x00); /* reserved */\n }\n }\n if (image->storage_class == PseudoClass)\n {\n unsigned char\n *bmp_colormap;\n\n /*\n Dump colormap to file.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Colormap: %.20g entries\",(double) image->colors);\n bmp_colormap=(unsigned char *) AcquireQuantumMemory((size_t) (1UL <<\n bmp_info.bits_per_pixel),4*sizeof(*bmp_colormap));\n if (bmp_colormap == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n q=bmp_colormap;\n for (i=0; i < (ssize_t) MagickMin((ssize_t) image->colors,(ssize_t) bmp_info.number_colors); i++)\n {\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].blue));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].green));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].red));\n if (type > 2)\n *q++=(unsigned char) 0x0;\n }\n for ( ; i < (ssize_t) (1UL << bmp_info.bits_per_pixel); i++)\n {\n *q++=(unsigned char) 0x00;\n *q++=(unsigned char) 0x00;\n *q++=(unsigned char) 0x00;\n if (type > 2)\n *q++=(unsigned char) 0x00;\n }\n if (type <= 2)\n (void) WriteBlob(image,(size_t) (3*(1L << bmp_info.bits_per_pixel)),\n bmp_colormap);\n else\n (void) WriteBlob(image,(size_t) (4*(1L << bmp_info.bits_per_pixel)),\n bmp_colormap);\n bmp_colormap=(unsigned char *) RelinquishMagickMemory(bmp_colormap);\n }\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Pixels: %lu bytes\",bmp_info.image_size);\n (void) WriteBlob(image,(size_t) bmp_info.image_size,pixels);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (GetNextImageInList(image) == (Image *) NULL)\n break;\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,SaveImagesTag,scene++,\n GetImageListLength(image));\n if (status == MagickFalse)\n break;\n } while (image_info->adjoin != MagickFalse);\n (void) CloseBlob(image);\n return(MagickTrue);\n}","target":"static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n BMPInfo\n bmp_info;\n\n const char\n *option;\n\n const StringInfo\n *profile;\n\n MagickBooleanType\n have_color_info,\n status;\n\n MagickOffsetType\n scene;\n\n MemoryInfo\n *pixel_info;\n\n register const Quantum\n *p;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *q;\n\n size_t\n bytes_per_line,\n type;\n\n ssize_t\n y;\n\n unsigned char\n *bmp_data,\n *pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n type=4;\n if (LocaleCompare(image_info->magick,\"BMP2\") == 0)\n type=2;\n else\n if (LocaleCompare(image_info->magick,\"BMP3\") == 0)\n type=3;\n\n option=GetImageOption(image_info,\"bmp:format\");\n if (option != (char *) NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Format=%s\",option);\n\n if (LocaleCompare(option,\"bmp2\") == 0)\n type=2;\n if (LocaleCompare(option,\"bmp3\") == 0)\n type=3;\n if (LocaleCompare(option,\"bmp4\") == 0)\n type=4;\n }\n\n scene=0;\n do\n {\n /*\n Initialize BMP raster file header.\n */\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n (void) ResetMagickMemory(&bmp_info,0,sizeof(bmp_info));\n bmp_info.file_size=14+12;\n if (type > 2)\n bmp_info.file_size+=28;\n bmp_info.offset_bits=bmp_info.file_size;\n bmp_info.compression=BI_RGB;\n if ((image->storage_class == PseudoClass) && (image->colors > 256))\n (void) SetImageStorageClass(image,DirectClass,exception);\n if (image->storage_class != DirectClass)\n {\n /*\n Colormapped BMP raster.\n */\n bmp_info.bits_per_pixel=8;\n if (image->colors <= 2)\n bmp_info.bits_per_pixel=1;\n else\n if (image->colors <= 16)\n bmp_info.bits_per_pixel=4;\n else\n if (image->colors <= 256)\n bmp_info.bits_per_pixel=8;\n if (image_info->compression == RLECompression)\n bmp_info.bits_per_pixel=8;\n bmp_info.number_colors=1U << bmp_info.bits_per_pixel;\n if (image->alpha_trait != UndefinedPixelTrait)\n (void) SetImageStorageClass(image,DirectClass,exception);\n else\n if ((size_t) bmp_info.number_colors < image->colors)\n (void) SetImageStorageClass(image,DirectClass,exception);\n else\n {\n bmp_info.file_size+=3*(1UL << bmp_info.bits_per_pixel);\n bmp_info.offset_bits+=3*(1UL << bmp_info.bits_per_pixel);\n if (type > 2)\n {\n bmp_info.file_size+=(1UL << bmp_info.bits_per_pixel);\n bmp_info.offset_bits+=(1UL << bmp_info.bits_per_pixel);\n }\n }\n }\n if (image->storage_class == DirectClass)\n {\n /*\n Full color BMP raster.\n */\n bmp_info.number_colors=0;\n bmp_info.bits_per_pixel=(unsigned short)\n ((type > 3) && (image->alpha_trait != UndefinedPixelTrait) ? 32 : 24);\n bmp_info.compression=(unsigned int) ((type > 3) &&\n (image->alpha_trait != UndefinedPixelTrait) ? BI_BITFIELDS : BI_RGB);\n if ((type == 3) && (image->alpha_trait != UndefinedPixelTrait))\n {\n option=GetImageOption(image_info,\"bmp3:alpha\");\n if (IsStringTrue(option))\n bmp_info.bits_per_pixel=32;\n }\n }\n bytes_per_line=4*((image->columns*bmp_info.bits_per_pixel+31)/32);\n bmp_info.ba_offset=0;\n profile=GetImageProfile(image,\"icc\");\n have_color_info=(image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL) || (image->gamma != 0.0) ? MagickTrue :\n MagickFalse;\n if (type == 2)\n bmp_info.size=12;\n else\n if ((type == 3) || ((image->alpha_trait == UndefinedPixelTrait) &&\n (have_color_info == MagickFalse)))\n {\n type=3;\n bmp_info.size=40;\n }\n else\n {\n int\n extra_size;\n\n bmp_info.size=108;\n extra_size=68;\n if ((image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL))\n {\n bmp_info.size=124;\n extra_size+=16;\n }\n bmp_info.file_size+=extra_size;\n bmp_info.offset_bits+=extra_size;\n }\n if ((image->columns != (signed int) image->columns) ||\n (image->rows != (signed int) image->rows))\n ThrowWriterException(ImageError,\"WidthOrHeightExceedsLimit\");\n bmp_info.width=(ssize_t) image->columns;\n bmp_info.height=(ssize_t) image->rows;\n bmp_info.planes=1;\n bmp_info.image_size=(unsigned long) (bytes_per_line*image->rows);\n bmp_info.file_size+=bmp_info.image_size;\n bmp_info.x_pixels=75*39;\n bmp_info.y_pixels=75*39;\n switch (image->units)\n {\n case UndefinedResolution:\n case PixelsPerInchResolution:\n {\n bmp_info.x_pixels=(unsigned int) (100.0*image->resolution.x/2.54);\n bmp_info.y_pixels=(unsigned int) (100.0*image->resolution.y/2.54);\n break;\n }\n case PixelsPerCentimeterResolution:\n {\n bmp_info.x_pixels=(unsigned int) (100.0*image->resolution.x);\n bmp_info.y_pixels=(unsigned int) (100.0*image->resolution.y);\n break;\n }\n }\n bmp_info.colors_important=bmp_info.number_colors;\n /*\n Convert MIFF to BMP raster pixels.\n */\n pixel_info=AcquireVirtualMemory((size_t) bmp_info.image_size,\n sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n (void) ResetMagickMemory(pixels,0,(size_t) bmp_info.image_size);\n switch (bmp_info.bits_per_pixel)\n {\n case 1:\n {\n size_t\n bit,\n byte;\n\n /*\n Convert PseudoClass image to a BMP monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n ssize_t\n offset;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n bit=0;\n byte=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n byte<<=1;\n byte|=GetPixelIndex(image,p) != 0 ? 0x01 : 0x00;\n bit++;\n if (bit == 8)\n {\n *q++=(unsigned char) byte;\n bit=0;\n byte=0;\n }\n p+=GetPixelChannels(image);\n }\n if (bit != 0)\n {\n *q++=(unsigned char) (byte << (8-bit));\n x++;\n }\n offset=(ssize_t) (image->columns+7)/8;\n for (x=offset; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 4:\n {\n size_t\n byte,\n nibble;\n\n ssize_t\n offset;\n\n /*\n Convert PseudoClass image to a BMP monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n nibble=0;\n byte=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n byte<<=4;\n byte|=((size_t) GetPixelIndex(image,p) & 0x0f);\n nibble++;\n if (nibble == 2)\n {\n *q++=(unsigned char) byte;\n nibble=0;\n byte=0;\n }\n p+=GetPixelChannels(image);\n }\n if (nibble != 0)\n {\n *q++=(unsigned char) (byte << 4);\n x++;\n }\n offset=(ssize_t) (image->columns+1)/2;\n for (x=offset; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 8:\n {\n /*\n Convert PseudoClass packet to BMP pixel.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=(unsigned char) GetPixelIndex(image,p);\n p+=GetPixelChannels(image);\n }\n for ( ; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 24:\n {\n /*\n Convert DirectClass packet to BMP BGR888.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(GetPixelBlue(image,p));\n *q++=ScaleQuantumToChar(GetPixelGreen(image,p));\n *q++=ScaleQuantumToChar(GetPixelRed(image,p));\n p+=GetPixelChannels(image);\n }\n for (x=3L*(ssize_t) image->columns; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 32:\n {\n /*\n Convert DirectClass packet to ARGB8888 pixel.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(GetPixelBlue(image,p));\n *q++=ScaleQuantumToChar(GetPixelGreen(image,p));\n *q++=ScaleQuantumToChar(GetPixelRed(image,p));\n *q++=ScaleQuantumToChar(GetPixelAlpha(image,p));\n p+=GetPixelChannels(image);\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n }\n if ((type > 2) && (bmp_info.bits_per_pixel == 8))\n if (image_info->compression != NoCompression)\n {\n MemoryInfo\n *rle_info;\n\n /*\n Convert run-length encoded raster pixels.\n */\n rle_info=AcquireVirtualMemory((size_t) (2*(bytes_per_line+2)+2),\n (image->rows+2)*sizeof(*pixels));\n if (rle_info == (MemoryInfo *) NULL)\n {\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n bmp_data=(unsigned char *) GetVirtualMemoryBlob(rle_info);\n bmp_info.file_size-=bmp_info.image_size;\n bmp_info.image_size=(unsigned int) EncodeImage(image,bytes_per_line,\n pixels,bmp_data);\n bmp_info.file_size+=bmp_info.image_size;\n pixel_info=RelinquishVirtualMemory(pixel_info);\n pixel_info=rle_info;\n pixels=bmp_data;\n bmp_info.compression=BI_RLE8;\n }\n /*\n Write BMP for Windows, all versions, 14-byte header.\n */\n if (image->debug != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing BMP version %.20g datastream\",(double) type);\n if (image->storage_class == DirectClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Storage class=DirectClass\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Storage class=PseudoClass\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image depth=%.20g\",(double) image->depth);\n if (image->alpha_trait != UndefinedPixelTrait)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Matte=True\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Matte=MagickFalse\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" BMP bits_per_pixel=%.20g\",(double) bmp_info.bits_per_pixel);\n switch ((int) bmp_info.compression)\n {\n case BI_RGB:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_RGB\");\n break;\n }\n case BI_RLE8:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_RLE8\");\n break;\n }\n case BI_BITFIELDS:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_BITFIELDS\");\n break;\n }\n default:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=UNKNOWN (%lu)\",bmp_info.compression);\n break;\n }\n }\n if (bmp_info.number_colors == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number_colors=unspecified\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number_colors=%lu\",bmp_info.number_colors);\n }\n (void) WriteBlob(image,2,(unsigned char *) \"BM\");\n (void) WriteBlobLSBLong(image,bmp_info.file_size);\n (void) WriteBlobLSBLong(image,bmp_info.ba_offset); /* always 0 */\n (void) WriteBlobLSBLong(image,bmp_info.offset_bits);\n if (type == 2)\n {\n /*\n Write 12-byte version 2 bitmap header.\n */\n (void) WriteBlobLSBLong(image,bmp_info.size);\n (void) WriteBlobLSBSignedShort(image,(signed short) bmp_info.width);\n (void) WriteBlobLSBSignedShort(image,(signed short) bmp_info.height);\n (void) WriteBlobLSBShort(image,bmp_info.planes);\n (void) WriteBlobLSBShort(image,bmp_info.bits_per_pixel);\n }\n else\n {\n /*\n Write 40-byte version 3+ bitmap header.\n */\n (void) WriteBlobLSBLong(image,bmp_info.size);\n (void) WriteBlobLSBSignedLong(image,(signed int) bmp_info.width);\n (void) WriteBlobLSBSignedLong(image,(signed int) bmp_info.height);\n (void) WriteBlobLSBShort(image,bmp_info.planes);\n (void) WriteBlobLSBShort(image,bmp_info.bits_per_pixel);\n (void) WriteBlobLSBLong(image,bmp_info.compression);\n (void) WriteBlobLSBLong(image,bmp_info.image_size);\n (void) WriteBlobLSBLong(image,bmp_info.x_pixels);\n (void) WriteBlobLSBLong(image,bmp_info.y_pixels);\n (void) WriteBlobLSBLong(image,bmp_info.number_colors);\n (void) WriteBlobLSBLong(image,bmp_info.colors_important);\n }\n if ((type > 3) && ((image->alpha_trait != UndefinedPixelTrait) ||\n (have_color_info != MagickFalse)))\n {\n /*\n Write the rest of the 108-byte BMP Version 4 header.\n */\n (void) WriteBlobLSBLong(image,0x00ff0000U); /* Red mask */\n (void) WriteBlobLSBLong(image,0x0000ff00U); /* Green mask */\n (void) WriteBlobLSBLong(image,0x000000ffU); /* Blue mask */\n (void) WriteBlobLSBLong(image,0xff000000U); /* Alpha mask */\n (void) WriteBlobLSBLong(image,0x73524742U); /* sRGB */\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.red_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.red_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.red_primary.x+\n image->chromaticity.red_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.green_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.green_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.green_primary.x+\n image->chromaticity.green_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.blue_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.blue_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.blue_primary.x+\n image->chromaticity.blue_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.x*0x10000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.y*0x10000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.z*0x10000));\n if ((image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL))\n {\n ssize_t\n intent;\n\n switch ((int) image->rendering_intent)\n {\n case SaturationIntent:\n {\n intent=LCS_GM_BUSINESS;\n break;\n }\n case RelativeIntent:\n {\n intent=LCS_GM_GRAPHICS;\n break;\n }\n case PerceptualIntent:\n {\n intent=LCS_GM_IMAGES;\n break;\n }\n case AbsoluteIntent:\n {\n intent=LCS_GM_ABS_COLORIMETRIC;\n break;\n }\n default:\n {\n intent=0;\n break;\n }\n }\n (void) WriteBlobLSBLong(image,(unsigned int) intent);\n (void) WriteBlobLSBLong(image,0x00); /* dummy profile data */\n (void) WriteBlobLSBLong(image,0x00); /* dummy profile length */\n (void) WriteBlobLSBLong(image,0x00); /* reserved */\n }\n }\n if (image->storage_class == PseudoClass)\n {\n unsigned char\n *bmp_colormap;\n\n /*\n Dump colormap to file.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Colormap: %.20g entries\",(double) image->colors);\n bmp_colormap=(unsigned char *) AcquireQuantumMemory((size_t) (1UL <<\n bmp_info.bits_per_pixel),4*sizeof(*bmp_colormap));\n if (bmp_colormap == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n q=bmp_colormap;\n for (i=0; i < (ssize_t) MagickMin((ssize_t) image->colors,(ssize_t) bmp_info.number_colors); i++)\n {\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].blue));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].green));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].red));\n if (type > 2)\n *q++=(unsigned char) 0x0;\n }\n for ( ; i < (ssize_t) (1UL << bmp_info.bits_per_pixel); i++)\n {\n *q++=(unsigned char) 0x00;\n *q++=(unsigned char) 0x00;\n *q++=(unsigned char) 0x00;\n if (type > 2)\n *q++=(unsigned char) 0x00;\n }\n if (type <= 2)\n (void) WriteBlob(image,(size_t) (3*(1L << bmp_info.bits_per_pixel)),\n bmp_colormap);\n else\n (void) WriteBlob(image,(size_t) (4*(1L << bmp_info.bits_per_pixel)),\n bmp_colormap);\n bmp_colormap=(unsigned char *) RelinquishMagickMemory(bmp_colormap);\n }\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Pixels: %lu bytes\",bmp_info.image_size);\n (void) WriteBlob(image,(size_t) bmp_info.image_size,pixels);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (GetNextImageInList(image) == (Image *) NULL)\n break;\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,SaveImagesTag,scene++,\n GetImageListLength(image));\n if (status == MagickFalse)\n break;\n } while (image_info->adjoin != MagickFalse);\n (void) CloseBlob(image);\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-190","target_token_count":5718,"sven_meta":{"func_name":"WriteBMPImage","file_name":"coders/bmp.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/4cc6ec8a4197d4c008577127736bf7985d632323","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#11-869fec8c60f9","input":"vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)\n{\n\tstruct drm_vc4_submit_cl *args = exec->args;\n\tvoid *temp = NULL;\n\tvoid *bin;\n\tint ret = 0;\n\tuint32_t bin_offset = 0;\n\tuint32_t shader_rec_offset = roundup(bin_offset + args->bin_cl_size,\n\t\t\t\t\t 16);\n\tuint32_t uniforms_offset = shader_rec_offset + args->shader_rec_size;\n\tuint32_t exec_size = uniforms_offset + args->uniforms_size;\n\tuint32_t temp_size = exec_size + (sizeof(struct vc4_shader_state) *\n\t\t\t\t\t args->shader_rec_count);\n\tstruct vc4_bo *bo;\n\n\tif (uniforms_offset < shader_rec_offset ||\n\t exec_size < uniforms_offset ||\n\t args->shader_rec_count >= (UINT_MAX /\n\t\t\t\t\t sizeof(struct vc4_shader_state)) ||\n\t temp_size < exec_size) {\n\t\tDRM_ERROR(\"overflow in exec arguments\\n\");\n\t\tgoto fail;\n\t}\n\n\t/* Allocate space where we'll store the copied in user command lists\n\t * and shader records.\n\t *\n\t * We don't just copy directly into the BOs because we need to\n\t * read the contents back for validation, and I think the\n\t * bo->vaddr is uncached access.\n\t */\n\ttemp = drm_malloc_ab(temp_size, 1);\n\tif (!temp) {\n\t\tDRM_ERROR(\"Failed to allocate storage for copying \"\n\t\t\t \"in bin/render CLs.\\n\");\n\t\tret = -ENOMEM;\n\t\tgoto fail;\n\t}\n\tbin = temp + bin_offset;\n\texec->shader_rec_u = temp + shader_rec_offset;\n\texec->uniforms_u = temp + uniforms_offset;\n\texec->shader_state = temp + exec_size;\n\texec->shader_state_size = args->shader_rec_count;\n\n\tif (copy_from_user(bin,\n\t\t\t (void __user *)(uintptr_t)args->bin_cl,\n\t\t\t args->bin_cl_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->shader_rec_u,\n\t\t\t (void __user *)(uintptr_t)args->shader_rec,\n\t\t\t args->shader_rec_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->uniforms_u,\n\t\t\t (void __user *)(uintptr_t)args->uniforms,\n\t\t\t args->uniforms_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tbo = vc4_bo_create(dev, exec_size, true);\n\tif (IS_ERR(bo)) {\n\t\tDRM_ERROR(\"Couldn't allocate BO for binning\\n\");\n\t\tret = PTR_ERR(bo);\n\t\tgoto fail;\n\t}\n\texec->exec_bo = &bo->base;\n\n\tlist_add_tail(&to_vc4_bo(&exec->exec_bo->base)->unref_head,\n\t\t &exec->unref_list);\n\n\texec->ct0ca = exec->exec_bo->paddr + bin_offset;\n\n\texec->bin_u = bin;\n\n\texec->shader_rec_v = exec->exec_bo->vaddr + shader_rec_offset;\n\texec->shader_rec_p = exec->exec_bo->paddr + shader_rec_offset;\n\texec->shader_rec_size = args->shader_rec_size;\n\n\texec->uniforms_v = exec->exec_bo->vaddr + uniforms_offset;\n\texec->uniforms_p = exec->exec_bo->paddr + uniforms_offset;\n\texec->uniforms_size = args->uniforms_size;\n\n\tret = vc4_validate_bin_cl(dev,\n\t\t\t\t exec->exec_bo->vaddr + bin_offset,\n\t\t\t\t bin,\n\t\t\t\t exec);\n\tif (ret)\n\t\tgoto fail;\n\n\tret = vc4_validate_shader_recs(dev, exec);\n\tif (ret)\n\t\tgoto fail;\n\n\t/* Block waiting on any previous rendering into the CS's VBO,\n\t * IB, or textures, so that pixels are actually written by the\n\t * time we try to read them.\n\t */\n\tret = vc4_wait_for_seqno(dev, exec->bin_dep_seqno, ~0ull, true);\n\nfail:\n\tdrm_free_large(temp);\n\treturn ret;\n}","target":"vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)\n{\n\tstruct drm_vc4_submit_cl *args = exec->args;\n\tvoid *temp = NULL;\n\tvoid *bin;\n\tint ret = 0;\n\tuint32_t bin_offset = 0;\n\tuint32_t shader_rec_offset = roundup(bin_offset + args->bin_cl_size,\n\t\t\t\t\t 16);\n\tuint32_t uniforms_offset = shader_rec_offset + args->shader_rec_size;\n\tuint32_t exec_size = uniforms_offset + args->uniforms_size;\n\tuint32_t temp_size = exec_size + (sizeof(struct vc4_shader_state) *\n\t\t\t\t\t args->shader_rec_count);\n\tstruct vc4_bo *bo;\n\n\tif (shader_rec_offset < args->bin_cl_size ||\n\t uniforms_offset < shader_rec_offset ||\n\t exec_size < uniforms_offset ||\n\t args->shader_rec_count >= (UINT_MAX /\n\t\t\t\t\t sizeof(struct vc4_shader_state)) ||\n\t temp_size < exec_size) {\n\t\tDRM_ERROR(\"overflow in exec arguments\\n\");\n\t\tgoto fail;\n\t}\n\n\t/* Allocate space where we'll store the copied in user command lists\n\t * and shader records.\n\t *\n\t * We don't just copy directly into the BOs because we need to\n\t * read the contents back for validation, and I think the\n\t * bo->vaddr is uncached access.\n\t */\n\ttemp = drm_malloc_ab(temp_size, 1);\n\tif (!temp) {\n\t\tDRM_ERROR(\"Failed to allocate storage for copying \"\n\t\t\t \"in bin/render CLs.\\n\");\n\t\tret = -ENOMEM;\n\t\tgoto fail;\n\t}\n\tbin = temp + bin_offset;\n\texec->shader_rec_u = temp + shader_rec_offset;\n\texec->uniforms_u = temp + uniforms_offset;\n\texec->shader_state = temp + exec_size;\n\texec->shader_state_size = args->shader_rec_count;\n\n\tif (copy_from_user(bin,\n\t\t\t (void __user *)(uintptr_t)args->bin_cl,\n\t\t\t args->bin_cl_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->shader_rec_u,\n\t\t\t (void __user *)(uintptr_t)args->shader_rec,\n\t\t\t args->shader_rec_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->uniforms_u,\n\t\t\t (void __user *)(uintptr_t)args->uniforms,\n\t\t\t args->uniforms_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tbo = vc4_bo_create(dev, exec_size, true);\n\tif (IS_ERR(bo)) {\n\t\tDRM_ERROR(\"Couldn't allocate BO for binning\\n\");\n\t\tret = PTR_ERR(bo);\n\t\tgoto fail;\n\t}\n\texec->exec_bo = &bo->base;\n\n\tlist_add_tail(&to_vc4_bo(&exec->exec_bo->base)->unref_head,\n\t\t &exec->unref_list);\n\n\texec->ct0ca = exec->exec_bo->paddr + bin_offset;\n\n\texec->bin_u = bin;\n\n\texec->shader_rec_v = exec->exec_bo->vaddr + shader_rec_offset;\n\texec->shader_rec_p = exec->exec_bo->paddr + shader_rec_offset;\n\texec->shader_rec_size = args->shader_rec_size;\n\n\texec->uniforms_v = exec->exec_bo->vaddr + uniforms_offset;\n\texec->uniforms_p = exec->exec_bo->paddr + uniforms_offset;\n\texec->uniforms_size = args->uniforms_size;\n\n\tret = vc4_validate_bin_cl(dev,\n\t\t\t\t exec->exec_bo->vaddr + bin_offset,\n\t\t\t\t bin,\n\t\t\t\t exec);\n\tif (ret)\n\t\tgoto fail;\n\n\tret = vc4_validate_shader_recs(dev, exec);\n\tif (ret)\n\t\tgoto fail;\n\n\t/* Block waiting on any previous rendering into the CS's VBO,\n\t * IB, or textures, so that pixels are actually written by the\n\t * time we try to read them.\n\t */\n\tret = vc4_wait_for_seqno(dev, exec->bin_dep_seqno, ~0ull, true);\n\nfail:\n\tdrm_free_large(temp);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-190","target_token_count":862,"sven_meta":{"func_name":"vc4_get_bcl","file_name":"drivers/gpu/drm/vc4/vc4_gem.c","commit_link":"github.com/torvalds/linux/commit/0f2ff82e11c86c05d051cae32b58226392d33bbf","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#14-3a776e8ed71c","input":"int git_delta_apply(\n\tvoid **out,\n\tsize_t *out_len,\n\tconst unsigned char *base,\n\tsize_t base_len,\n\tconst unsigned char *delta,\n\tsize_t delta_len)\n{\n\tconst unsigned char *delta_end = delta + delta_len;\n\tsize_t base_sz, res_sz, alloc_sz;\n\tunsigned char *res_dp;\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\t/*\n\t * Check that the base size matches the data we were given;\n\t * if not we would underflow while accessing data from the\n\t * base object, resulting in data corruption or segfault.\n\t */\n\tif ((hdr_sz(&base_sz, &delta, delta_end) < 0) || (base_sz != base_len)) {\n\t\tgiterr_set(GITERR_INVALID, \"failed to apply delta: base size does not match given data\");\n\t\treturn -1;\n\t}\n\n\tif (hdr_sz(&res_sz, &delta, delta_end) < 0) {\n\t\tgiterr_set(GITERR_INVALID, \"failed to apply delta: base size does not match given data\");\n\t\treturn -1;\n\t}\n\n\tGITERR_CHECK_ALLOC_ADD(&alloc_sz, res_sz, 1);\n\tres_dp = git__malloc(alloc_sz);\n\tGITERR_CHECK_ALLOC(res_dp);\n\n\tres_dp[res_sz] = '\\0';\n\t*out = res_dp;\n\t*out_len = res_sz;\n\n\twhile (delta < delta_end) {\n\t\tunsigned char cmd = *delta++;\n\t\tif (cmd & 0x80) {\n\t\t\t/* cmd is a copy instruction; copy from the base. */\n\t\t\tsize_t off = 0, len = 0;\n\n#define ADD_DELTA(o, shift) { if (delta < delta_end) (o) |= ((unsigned) *delta++ << shift); else goto fail; }\n\t\t\tif (cmd & 0x01) ADD_DELTA(off, 0UL);\n\t\t\tif (cmd & 0x02) ADD_DELTA(off, 8UL);\n\t\t\tif (cmd & 0x04) ADD_DELTA(off, 16UL);\n\t\t\tif (cmd & 0x08) ADD_DELTA(off, 24UL);\n\n\t\t\tif (cmd & 0x10) ADD_DELTA(len, 0UL);\n\t\t\tif (cmd & 0x20) ADD_DELTA(len, 8UL);\n\t\t\tif (cmd & 0x40) ADD_DELTA(len, 16UL);\n\t\t\tif (!len) len = 0x10000;\n#undef ADD_DELTA\n\n\t\t\tif (base_len < off + len || res_sz < len)\n\t\t\t\tgoto fail;\n\t\t\tmemcpy(res_dp, base + off, len);\n\t\t\tres_dp += len;\n\t\t\tres_sz -= len;\n\n\t\t} else if (cmd) {\n\t\t\t/*\n\t\t\t * cmd is a literal insert instruction; copy from\n\t\t\t * the delta stream itself.\n\t\t\t */\n\t\t\tif (delta_end - delta < cmd || res_sz < cmd)\n\t\t\t\tgoto fail;\n\t\t\tmemcpy(res_dp, delta, cmd);\n\t\t\tdelta += cmd;\n\t\t\tres_dp += cmd;\n\t\t\tres_sz -= cmd;\n\n\t\t} else {\n\t\t\t/* cmd == 0 is reserved for future encodings. */\n\t\t\tgoto fail;\n\t\t}\n\t}\n\n\tif (delta != delta_end || res_sz)\n\t\tgoto fail;\n\treturn 0;\n\nfail:\n\tgit__free(*out);\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\tgiterr_set(GITERR_INVALID, \"failed to apply delta\");\n\treturn -1;\n}","target":"int git_delta_apply(\n\tvoid **out,\n\tsize_t *out_len,\n\tconst unsigned char *base,\n\tsize_t base_len,\n\tconst unsigned char *delta,\n\tsize_t delta_len)\n{\n\tconst unsigned char *delta_end = delta + delta_len;\n\tsize_t base_sz, res_sz, alloc_sz;\n\tunsigned char *res_dp;\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\t/*\n\t * Check that the base size matches the data we were given;\n\t * if not we would underflow while accessing data from the\n\t * base object, resulting in data corruption or segfault.\n\t */\n\tif ((hdr_sz(&base_sz, &delta, delta_end) < 0) || (base_sz != base_len)) {\n\t\tgiterr_set(GITERR_INVALID, \"failed to apply delta: base size does not match given data\");\n\t\treturn -1;\n\t}\n\n\tif (hdr_sz(&res_sz, &delta, delta_end) < 0) {\n\t\tgiterr_set(GITERR_INVALID, \"failed to apply delta: base size does not match given data\");\n\t\treturn -1;\n\t}\n\n\tGITERR_CHECK_ALLOC_ADD(&alloc_sz, res_sz, 1);\n\tres_dp = git__malloc(alloc_sz);\n\tGITERR_CHECK_ALLOC(res_dp);\n\n\tres_dp[res_sz] = '\\0';\n\t*out = res_dp;\n\t*out_len = res_sz;\n\n\twhile (delta < delta_end) {\n\t\tunsigned char cmd = *delta++;\n\t\tif (cmd & 0x80) {\n\t\t\t/* cmd is a copy instruction; copy from the base. */\n\t\t\tsize_t off = 0, len = 0, end;\n\n#define ADD_DELTA(o, shift) { if (delta < delta_end) (o) |= ((unsigned) *delta++ << shift); else goto fail; }\n\t\t\tif (cmd & 0x01) ADD_DELTA(off, 0UL);\n\t\t\tif (cmd & 0x02) ADD_DELTA(off, 8UL);\n\t\t\tif (cmd & 0x04) ADD_DELTA(off, 16UL);\n\t\t\tif (cmd & 0x08) ADD_DELTA(off, 24UL);\n\n\t\t\tif (cmd & 0x10) ADD_DELTA(len, 0UL);\n\t\t\tif (cmd & 0x20) ADD_DELTA(len, 8UL);\n\t\t\tif (cmd & 0x40) ADD_DELTA(len, 16UL);\n\t\t\tif (!len) len = 0x10000;\n#undef ADD_DELTA\n\n\t\t\tif (GIT_ADD_SIZET_OVERFLOW(&end, off, len) ||\n\t\t\t base_len < end || res_sz < len)\n\t\t\t\tgoto fail;\n\n\t\t\tmemcpy(res_dp, base + off, len);\n\t\t\tres_dp += len;\n\t\t\tres_sz -= len;\n\n\t\t} else if (cmd) {\n\t\t\t/*\n\t\t\t * cmd is a literal insert instruction; copy from\n\t\t\t * the delta stream itself.\n\t\t\t */\n\t\t\tif (delta_end - delta < cmd || res_sz < cmd)\n\t\t\t\tgoto fail;\n\t\t\tmemcpy(res_dp, delta, cmd);\n\t\t\tdelta += cmd;\n\t\t\tres_dp += cmd;\n\t\t\tres_sz -= cmd;\n\n\t\t} else {\n\t\t\t/* cmd == 0 is reserved for future encodings. */\n\t\t\tgoto fail;\n\t\t}\n\t}\n\n\tif (delta != delta_end || res_sz)\n\t\tgoto fail;\n\treturn 0;\n\nfail:\n\tgit__free(*out);\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\tgiterr_set(GITERR_INVALID, \"failed to apply delta\");\n\treturn -1;\n}","lang":"c","vul_type":"cwe-190","target_token_count":753,"sven_meta":{"func_name":"git_delta_apply","file_name":"src/delta.c","commit_link":"github.com/libgit2/libgit2/commit/c1577110467b701dcbcf9439ac225ea851b47d22","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#16-dbb2414fe9f7","input":"static int b_unpack (lua_State *L) {\n Header h;\n const char *fmt = luaL_checkstring(L, 1);\n size_t ld;\n const char *data = luaL_checklstring(L, 2, &ld);\n size_t pos = luaL_optinteger(L, 3, 1) - 1;\n int n = 0; /* number of results */\n defaultoptions(&h);\n while (*fmt) {\n int opt = *fmt++;\n size_t size = optsize(L, opt, &fmt);\n pos += gettoalign(pos, &h, opt, size);\n luaL_argcheck(L, pos+size <= ld, 2, \"data string too short\");\n /* stack space for item + next position */\n luaL_checkstack(L, 2, \"too many results\");\n switch (opt) {\n case 'b': case 'B': case 'h': case 'H':\n case 'l': case 'L': case 'T': case 'i': case 'I': { /* integer types */\n int issigned = islower(opt);\n lua_Number res = getinteger(data+pos, h.endian, issigned, size);\n lua_pushnumber(L, res); n++;\n break;\n }\n case 'x': {\n break;\n }\n case 'f': {\n float f;\n memcpy(&f, data+pos, size);\n correctbytes((char *)&f, sizeof(f), h.endian);\n lua_pushnumber(L, f); n++;\n break;\n }\n case 'd': {\n double d;\n memcpy(&d, data+pos, size);\n correctbytes((char *)&d, sizeof(d), h.endian);\n lua_pushnumber(L, d); n++;\n break;\n }\n case 'c': {\n if (size == 0) {\n if (n == 0 || !lua_isnumber(L, -1))\n luaL_error(L, \"format 'c0' needs a previous size\");\n size = lua_tonumber(L, -1);\n lua_pop(L, 1); n--;\n luaL_argcheck(L, size <= ld && pos <= ld - size,\n 2, \"data string too short\");\n }\n lua_pushlstring(L, data+pos, size); n++;\n break;\n }\n case 's': {\n const char *e = (const char *)memchr(data+pos, '\\0', ld - pos);\n if (e == NULL)\n luaL_error(L, \"unfinished string in data\");\n size = (e - (data+pos)) + 1;\n lua_pushlstring(L, data+pos, size - 1); n++;\n break;\n }\n default: controloptions(L, opt, &fmt, &h);\n }\n pos += size;\n }\n lua_pushinteger(L, pos + 1); /* next position */\n return n + 1;\n}","target":"static int b_unpack (lua_State *L) {\n Header h;\n const char *fmt = luaL_checkstring(L, 1);\n size_t ld;\n const char *data = luaL_checklstring(L, 2, &ld);\n size_t pos = luaL_optinteger(L, 3, 1);\n luaL_argcheck(L, pos > 0, 3, \"offset must be 1 or greater\");\n pos--; /* Lua indexes are 1-based, but here we want 0-based for C\n * pointer math. */\n int n = 0; /* number of results */\n defaultoptions(&h);\n while (*fmt) {\n int opt = *fmt++;\n size_t size = optsize(L, opt, &fmt);\n pos += gettoalign(pos, &h, opt, size);\n luaL_argcheck(L, size <= ld && pos <= ld - size,\n 2, \"data string too short\");\n /* stack space for item + next position */\n luaL_checkstack(L, 2, \"too many results\");\n switch (opt) {\n case 'b': case 'B': case 'h': case 'H':\n case 'l': case 'L': case 'T': case 'i': case 'I': { /* integer types */\n int issigned = islower(opt);\n lua_Number res = getinteger(data+pos, h.endian, issigned, size);\n lua_pushnumber(L, res); n++;\n break;\n }\n case 'x': {\n break;\n }\n case 'f': {\n float f;\n memcpy(&f, data+pos, size);\n correctbytes((char *)&f, sizeof(f), h.endian);\n lua_pushnumber(L, f); n++;\n break;\n }\n case 'd': {\n double d;\n memcpy(&d, data+pos, size);\n correctbytes((char *)&d, sizeof(d), h.endian);\n lua_pushnumber(L, d); n++;\n break;\n }\n case 'c': {\n if (size == 0) {\n if (n == 0 || !lua_isnumber(L, -1))\n luaL_error(L, \"format 'c0' needs a previous size\");\n size = lua_tonumber(L, -1);\n lua_pop(L, 1); n--;\n luaL_argcheck(L, size <= ld && pos <= ld - size,\n 2, \"data string too short\");\n }\n lua_pushlstring(L, data+pos, size); n++;\n break;\n }\n case 's': {\n const char *e = (const char *)memchr(data+pos, '\\0', ld - pos);\n if (e == NULL)\n luaL_error(L, \"unfinished string in data\");\n size = (e - (data+pos)) + 1;\n lua_pushlstring(L, data+pos, size - 1); n++;\n break;\n }\n default: controloptions(L, opt, &fmt, &h);\n }\n pos += size;\n }\n lua_pushinteger(L, pos + 1); /* next position */\n return n + 1;\n}","lang":"c","vul_type":"cwe-190","target_token_count":689,"sven_meta":{"func_name":"b_unpack","file_name":"deps/lua/src/lua_struct.c","commit_link":"github.com/antirez/redis/commit/e89086e09a38cc6713bcd4b9c29abf92cf393936","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#19-04842805da95","input":"REGEXP *\nPerl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,\n\t\t OP *expr, const regexp_engine* eng, REGEXP *old_re,\n\t\t bool *is_bare_re, const U32 orig_rx_flags, const U32 pm_flags)\n{\n dVAR;\n REGEXP *Rx; /* Capital 'R' means points to a REGEXP */\n STRLEN plen;\n char *exp;\n regnode *scan;\n I32 flags;\n SSize_t minlen = 0;\n U32 rx_flags;\n SV *pat;\n SV** new_patternp = patternp;\n\n /* these are all flags - maybe they should be turned\n * into a single int with different bit masks */\n I32 sawlookahead = 0;\n I32 sawplus = 0;\n I32 sawopen = 0;\n I32 sawminmod = 0;\n\n regex_charset initial_charset = get_regex_charset(orig_rx_flags);\n bool recompile = 0;\n bool runtime_code = 0;\n scan_data_t data;\n RExC_state_t RExC_state;\n RExC_state_t * const pRExC_state = &RExC_state;\n#ifdef TRIE_STUDY_OPT\n int restudied = 0;\n RExC_state_t copyRExC_state;\n#endif\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_RE_OP_COMPILE;\n\n DEBUG_r(if (!PL_colorset) reginitcolors());\n\n /* Initialize these here instead of as-needed, as is quick and avoids\n * having to test them each time otherwise */\n if (! PL_InBitmap) {\n#ifdef DEBUGGING\n char * dump_len_string;\n#endif\n\n /* This is calculated here, because the Perl program that generates the\n * static global ones doesn't currently have access to\n * NUM_ANYOF_CODE_POINTS */\n\tPL_InBitmap = _new_invlist(2);\n\tPL_InBitmap = _add_range_to_invlist(PL_InBitmap, 0,\n NUM_ANYOF_CODE_POINTS - 1);\n#ifdef DEBUGGING\n dump_len_string = PerlEnv_getenv(\"PERL_DUMP_RE_MAX_LEN\");\n if ( ! dump_len_string\n || ! grok_atoUV(dump_len_string, (UV *)&PL_dump_re_max_len, NULL))\n {\n PL_dump_re_max_len = 60; /* A reasonable default */\n }\n#endif\n }\n\n pRExC_state->warn_text = NULL;\n pRExC_state->unlexed_names = NULL;\n pRExC_state->code_blocks = NULL;\n\n if (is_bare_re)\n\t*is_bare_re = FALSE;\n\n if (expr && (expr->op_type == OP_LIST ||\n\t\t(expr->op_type == OP_NULL && expr->op_targ == OP_LIST))) {\n\t/* allocate code_blocks if needed */\n\tOP *o;\n\tint ncode = 0;\n\n\tfor (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o))\n\t if (o->op_type == OP_NULL && (o->op_flags & OPf_SPECIAL))\n\t\tncode++; /* count of DO blocks */\n\n\tif (ncode)\n pRExC_state->code_blocks = S_alloc_code_blocks(aTHX_ ncode);\n }\n\n if (!pat_count) {\n /* compile-time pattern with just OP_CONSTs and DO blocks */\n\n int n;\n OP *o;\n\n /* find how many CONSTs there are */\n assert(expr);\n n = 0;\n if (expr->op_type == OP_CONST)\n n = 1;\n else\n for (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o)) {\n if (o->op_type == OP_CONST)\n n++;\n }\n\n /* fake up an SV array */\n\n assert(!new_patternp);\n Newx(new_patternp, n, SV*);\n SAVEFREEPV(new_patternp);\n pat_count = n;\n\n n = 0;\n if (expr->op_type == OP_CONST)\n new_patternp[n] = cSVOPx_sv(expr);\n else\n for (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o)) {\n if (o->op_type == OP_CONST)\n new_patternp[n++] = cSVOPo_sv;\n }\n\n }\n\n DEBUG_PARSE_r(Perl_re_printf( aTHX_\n \"Assembling pattern from %d elements%s\\n\", pat_count,\n orig_rx_flags & RXf_SPLIT ? \" for split\" : \"\"));\n\n /* set expr to the first arg op */\n\n if (pRExC_state->code_blocks && pRExC_state->code_blocks->count\n && expr->op_type != OP_CONST)\n {\n expr = cLISTOPx(expr)->op_first;\n assert( expr->op_type == OP_PUSHMARK\n || (expr->op_type == OP_NULL && expr->op_targ == OP_PUSHMARK)\n || expr->op_type == OP_PADRANGE);\n expr = OpSIBLING(expr);\n }\n\n pat = S_concat_pat(aTHX_ pRExC_state, NULL, new_patternp, pat_count,\n expr, &recompile, NULL);\n\n /* handle bare (possibly after overloading) regex: foo =~ $re */\n {\n SV *re = pat;\n if (SvROK(re))\n re = SvRV(re);\n if (SvTYPE(re) == SVt_REGEXP) {\n if (is_bare_re)\n *is_bare_re = TRUE;\n SvREFCNT_inc(re);\n DEBUG_PARSE_r(Perl_re_printf( aTHX_\n \"Precompiled pattern%s\\n\",\n orig_rx_flags & RXf_SPLIT ? \" for split\" : \"\"));\n\n return (REGEXP*)re;\n }\n }\n\n exp = SvPV_nomg(pat, plen);\n\n if (!eng->op_comp) {\n\tif ((SvUTF8(pat) && IN_BYTES)\n\t\t|| SvGMAGICAL(pat) || SvAMAGIC(pat))\n\t{\n\t /* make a temporary copy; either to convert to bytes,\n\t * or to avoid repeating get-magic / overloaded stringify */\n\t pat = newSVpvn_flags(exp, plen, SVs_TEMP |\n\t\t\t\t\t(IN_BYTES ? 0 : SvUTF8(pat)));\n\t}\n\treturn CALLREGCOMP_ENG(eng, pat, orig_rx_flags);\n }\n\n /* ignore the utf8ness if the pattern is 0 length */\n RExC_utf8 = RExC_orig_utf8 = (plen == 0 || IN_BYTES) ? 0 : SvUTF8(pat);\n RExC_uni_semantics = 0;\n RExC_contains_locale = 0;\n RExC_strict = cBOOL(pm_flags & RXf_PMf_STRICT);\n RExC_in_script_run = 0;\n RExC_study_started = 0;\n pRExC_state->runtime_code_qr = NULL;\n RExC_frame_head= NULL;\n RExC_frame_last= NULL;\n RExC_frame_count= 0;\n RExC_latest_warn_offset = 0;\n RExC_use_BRANCHJ = 0;\n RExC_total_parens = 0;\n RExC_open_parens = NULL;\n RExC_close_parens = NULL;\n RExC_paren_names = NULL;\n RExC_size = 0;\n RExC_seen_d_op = FALSE;\n#ifdef DEBUGGING\n RExC_paren_name_list = NULL;\n#endif\n\n DEBUG_r({\n RExC_mysv1= sv_newmortal();\n RExC_mysv2= sv_newmortal();\n });\n\n DEBUG_COMPILE_r({\n SV *dsv= sv_newmortal();\n RE_PV_QUOTED_DECL(s, RExC_utf8, dsv, exp, plen, PL_dump_re_max_len);\n Perl_re_printf( aTHX_ \"%sCompiling REx%s %s\\n\",\n PL_colors[4], PL_colors[5], s);\n });\n\n /* we jump here if we have to recompile, e.g., from upgrading the pattern\n * to utf8 */\n\n if ((pm_flags & PMf_USE_RE_EVAL)\n\t\t/* this second condition covers the non-regex literal case,\n\t\t * i.e. $foo =~ '(?{})'. */\n\t\t|| (IN_PERL_COMPILETIME && (PL_hints & HINT_RE_EVAL))\n )\n\truntime_code = S_has_runtime_code(aTHX_ pRExC_state, exp, plen);\n\n redo_parse:\n /* return old regex if pattern hasn't changed */\n /* XXX: note in the below we have to check the flags as well as the\n * pattern.\n *\n * Things get a touch tricky as we have to compare the utf8 flag\n * independently from the compile flags. */\n\n if ( old_re\n && !recompile\n && !!RX_UTF8(old_re) == !!RExC_utf8\n && ( RX_COMPFLAGS(old_re) == ( orig_rx_flags & RXf_PMf_FLAGCOPYMASK ) )\n\t&& RX_PRECOMP(old_re)\n\t&& RX_PRELEN(old_re) == plen\n && memEQ(RX_PRECOMP(old_re), exp, plen)\n\t&& !runtime_code /* with runtime code, always recompile */ )\n {\n return old_re;\n }\n\n /* Allocate the pattern's SV */\n RExC_rx_sv = Rx = (REGEXP*) newSV_type(SVt_REGEXP);\n RExC_rx = ReANY(Rx);\n if ( RExC_rx == NULL )\n FAIL(\"Regexp out of space\");\n\n rx_flags = orig_rx_flags;\n\n if ( (UTF || RExC_uni_semantics)\n && initial_charset == REGEX_DEPENDS_CHARSET)\n {\n\n\t/* Set to use unicode semantics if the pattern is in utf8 and has the\n\t * 'depends' charset specified, as it means unicode when utf8 */\n\tset_regex_charset(&rx_flags, REGEX_UNICODE_CHARSET);\n RExC_uni_semantics = 1;\n }\n\n RExC_pm_flags = pm_flags;\n\n if (runtime_code) {\n assert(TAINTING_get || !TAINT_get);\n\tif (TAINT_get)\n\t Perl_croak(aTHX_ \"Eval-group in insecure regular expression\");\n\n\tif (!S_compile_runtime_code(aTHX_ pRExC_state, exp, plen)) {\n\t /* whoops, we have a non-utf8 pattern, whilst run-time code\n\t * got compiled as utf8. Try again with a utf8 pattern */\n S_pat_upgrade_to_utf8(aTHX_ pRExC_state, &exp, &plen,\n pRExC_state->code_blocks ? pRExC_state->code_blocks->count : 0);\n goto redo_parse;\n\t}\n }\n assert(!pRExC_state->runtime_code_qr);\n\n RExC_sawback = 0;\n\n RExC_seen = 0;\n RExC_maxlen = 0;\n RExC_in_lookbehind = 0;\n RExC_seen_zerolen = *exp == '^' ? -1 : 0;\n#ifdef EBCDIC\n RExC_recode_x_to_native = 0;\n#endif\n RExC_in_multi_char_class = 0;\n\n RExC_start = RExC_copy_start_in_constructed = RExC_copy_start_in_input = RExC_precomp = exp;\n RExC_precomp_end = RExC_end = exp + plen;\n RExC_nestroot = 0;\n RExC_whilem_seen = 0;\n RExC_end_op = NULL;\n RExC_recurse = NULL;\n RExC_study_chunk_recursed = NULL;\n RExC_study_chunk_recursed_bytes= 0;\n RExC_recurse_count = 0;\n pRExC_state->code_index = 0;\n\n /* Initialize the string in the compiled pattern. This is so that there is\n * something to output if necessary */\n set_regex_pv(pRExC_state, Rx);\n\n DEBUG_PARSE_r({\n Perl_re_printf( aTHX_\n \"Starting parse and generation\\n\");\n RExC_lastnum=0;\n RExC_lastparse=NULL;\n });\n\n /* Allocate space and zero-initialize. Note, the two step process\n of zeroing when in debug mode, thus anything assigned has to\n happen after that */\n if (! RExC_size) {\n\n /* On the first pass of the parse, we guess how big this will be. Then\n * we grow in one operation to that amount and then give it back. As\n * we go along, we re-allocate what we need.\n *\n * XXX Currently the guess is essentially that the pattern will be an\n * EXACT node with one byte input, one byte output. This is crude, and\n * better heuristics are welcome.\n *\n * On any subsequent passes, we guess what we actually computed in the\n * latest earlier pass. Such a pass probably didn't complete so is\n * missing stuff. We could improve those guesses by knowing where the\n * parse stopped, and use the length so far plus apply the above\n * assumption to what's left. */\n RExC_size = STR_SZ(RExC_end - RExC_start);\n }\n\n Newxc(RExC_rxi, sizeof(regexp_internal) + RExC_size, char, regexp_internal);\n if ( RExC_rxi == NULL )\n FAIL(\"Regexp out of space\");\n\n Zero(RExC_rxi, sizeof(regexp_internal) + RExC_size, char);\n RXi_SET( RExC_rx, RExC_rxi );\n\n /* We start from 0 (over from 0 in the case this is a reparse. The first\n * node parsed will give back any excess memory we have allocated so far).\n * */\n RExC_size = 0;\n\n /* non-zero initialization begins here */\n RExC_rx->engine= eng;\n RExC_rx->extflags = rx_flags;\n RXp_COMPFLAGS(RExC_rx) = orig_rx_flags & RXf_PMf_FLAGCOPYMASK;\n\n if (pm_flags & PMf_IS_QR) {\n\tRExC_rxi->code_blocks = pRExC_state->code_blocks;\n if (RExC_rxi->code_blocks) {\n RExC_rxi->code_blocks->refcnt++;\n }\n }\n\n RExC_rx->intflags = 0;\n\n RExC_flags = rx_flags;\t/* don't let top level (?i) bleed */\n RExC_parse = exp;\n\n /* This NUL is guaranteed because the pattern comes from an SV*, and the sv\n * code makes sure the final byte is an uncounted NUL. But should this\n * ever not be the case, lots of things could read beyond the end of the\n * buffer: loops like\n * while(isFOO(*RExC_parse)) RExC_parse++;\n * strchr(RExC_parse, \"foo\");\n * etc. So it is worth noting. */\n assert(*RExC_end == '\\0');\n\n RExC_naughty = 0;\n RExC_npar = 1;\n RExC_parens_buf_size = 0;\n RExC_emit_start = RExC_rxi->program;\n pRExC_state->code_index = 0;\n\n *((char*) RExC_emit_start) = (char) REG_MAGIC;\n RExC_emit = 1;\n\n /* Do the parse */\n if (reg(pRExC_state, 0, &flags, 1)) {\n\n /* Success!, But we may need to redo the parse knowing how many parens\n * there actually are */\n if (IN_PARENS_PASS) {\n flags |= RESTART_PARSE;\n }\n\n /* We have that number in RExC_npar */\n RExC_total_parens = RExC_npar;\n }\n else if (! MUST_RESTART(flags)) {\n\tReREFCNT_dec(Rx);\n Perl_croak(aTHX_ \"panic: reg returned failure to re_op_compile, flags=%#\" UVxf, (UV) flags);\n }\n\n /* Here, we either have success, or we have to redo the parse for some reason */\n if (MUST_RESTART(flags)) {\n\n /* It's possible to write a regexp in ascii that represents Unicode\n codepoints outside of the byte range, such as via \\x{100}. If we\n detect such a sequence we have to convert the entire pattern to utf8\n and then recompile, as our sizing calculation will have been based\n on 1 byte == 1 character, but we will need to use utf8 to encode\n at least some part of the pattern, and therefore must convert the whole\n thing.\n -- dmq */\n if (flags & NEED_UTF8) {\n\n /* We have stored the offset of the final warning output so far.\n * That must be adjusted. Any variant characters between the start\n * of the pattern and this warning count for 2 bytes in the final,\n * so just add them again */\n if (UNLIKELY(RExC_latest_warn_offset > 0)) {\n RExC_latest_warn_offset +=\n variant_under_utf8_count((U8 *) exp, (U8 *) exp\n + RExC_latest_warn_offset);\n }\n S_pat_upgrade_to_utf8(aTHX_ pRExC_state, &exp, &plen,\n pRExC_state->code_blocks ? pRExC_state->code_blocks->count : 0);\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"Need to redo parse after upgrade\\n\"));\n }\n else {\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"Need to redo parse\\n\"));\n }\n\n if (ALL_PARENS_COUNTED) {\n /* Make enough room for all the known parens, and zero it */\n Renew(RExC_open_parens, RExC_total_parens, regnode_offset);\n Zero(RExC_open_parens, RExC_total_parens, regnode_offset);\n RExC_open_parens[0] = 1; /* +1 for REG_MAGIC */\n\n Renew(RExC_close_parens, RExC_total_parens, regnode_offset);\n Zero(RExC_close_parens, RExC_total_parens, regnode_offset);\n }\n else { /* Parse did not complete. Reinitialize the parentheses\n structures */\n RExC_total_parens = 0;\n if (RExC_open_parens) {\n Safefree(RExC_open_parens);\n RExC_open_parens = NULL;\n }\n if (RExC_close_parens) {\n Safefree(RExC_close_parens);\n RExC_close_parens = NULL;\n }\n }\n\n /* Clean up what we did in this parse */\n SvREFCNT_dec_NN(RExC_rx_sv);\n\n goto redo_parse;\n }\n\n /* Here, we have successfully parsed and generated the pattern's program\n * for the regex engine. We are ready to finish things up and look for\n * optimizations. */\n\n /* Update the string to compile, with correct modifiers, etc */\n set_regex_pv(pRExC_state, Rx);\n\n RExC_rx->nparens = RExC_total_parens - 1;\n\n /* Uses the upper 4 bits of the FLAGS field, so keep within that size */\n if (RExC_whilem_seen > 15)\n RExC_whilem_seen = 15;\n\n DEBUG_PARSE_r({\n Perl_re_printf( aTHX_\n \"Required size %\" IVdf \" nodes\\n\", (IV)RExC_size);\n RExC_lastnum=0;\n RExC_lastparse=NULL;\n });\n\n#ifdef RE_TRACK_PATTERN_OFFSETS\n DEBUG_OFFSETS_r(Perl_re_printf( aTHX_\n \"%s %\" UVuf \" bytes for offset annotations.\\n\",\n RExC_offsets ? \"Got\" : \"Couldn't get\",\n (UV)((RExC_offsets[0] * 2 + 1))));\n DEBUG_OFFSETS_r(if (RExC_offsets) {\n const STRLEN len = RExC_offsets[0];\n STRLEN i;\n GET_RE_DEBUG_FLAGS_DECL;\n Perl_re_printf( aTHX_\n \"Offsets: [%\" UVuf \"]\\n\\t\", (UV)RExC_offsets[0]);\n for (i = 1; i <= len; i++) {\n if (RExC_offsets[i*2-1] || RExC_offsets[i*2])\n Perl_re_printf( aTHX_ \"%\" UVuf \":%\" UVuf \"[%\" UVuf \"] \",\n (UV)i, (UV)RExC_offsets[i*2-1], (UV)RExC_offsets[i*2]);\n }\n Perl_re_printf( aTHX_ \"\\n\");\n });\n\n#else\n SetProgLen(RExC_rxi,RExC_size);\n#endif\n\n DEBUG_OPTIMISE_r(\n Perl_re_printf( aTHX_ \"Starting post parse optimization\\n\");\n );\n\n /* XXXX To minimize changes to RE engine we always allocate\n 3-units-long substrs field. */\n Newx(RExC_rx->substrs, 1, struct reg_substr_data);\n if (RExC_recurse_count) {\n Newx(RExC_recurse, RExC_recurse_count, regnode *);\n SAVEFREEPV(RExC_recurse);\n }\n\n if (RExC_seen & REG_RECURSE_SEEN) {\n /* Note, RExC_total_parens is 1 + the number of parens in a pattern.\n * So its 1 if there are no parens. */\n RExC_study_chunk_recursed_bytes= (RExC_total_parens >> 3) +\n ((RExC_total_parens & 0x07) != 0);\n Newx(RExC_study_chunk_recursed,\n RExC_study_chunk_recursed_bytes * RExC_total_parens, U8);\n SAVEFREEPV(RExC_study_chunk_recursed);\n }\n\n reStudy:\n RExC_rx->minlen = minlen = sawlookahead = sawplus = sawopen = sawminmod = 0;\n DEBUG_r(\n RExC_study_chunk_recursed_count= 0;\n );\n Zero(RExC_rx->substrs, 1, struct reg_substr_data);\n if (RExC_study_chunk_recursed) {\n Zero(RExC_study_chunk_recursed,\n RExC_study_chunk_recursed_bytes * RExC_total_parens, U8);\n }\n\n\n#ifdef TRIE_STUDY_OPT\n if (!restudied) {\n StructCopy(&zero_scan_data, &data, scan_data_t);\n copyRExC_state = RExC_state;\n } else {\n U32 seen=RExC_seen;\n DEBUG_OPTIMISE_r(Perl_re_printf( aTHX_ \"Restudying\\n\"));\n\n RExC_state = copyRExC_state;\n if (seen & REG_TOP_LEVEL_BRANCHES_SEEN)\n RExC_seen |= REG_TOP_LEVEL_BRANCHES_SEEN;\n else\n RExC_seen &= ~REG_TOP_LEVEL_BRANCHES_SEEN;\n\tStructCopy(&zero_scan_data, &data, scan_data_t);\n }\n#else\n StructCopy(&zero_scan_data, &data, scan_data_t);\n#endif\n\n /* Dig out information for optimizations. */\n RExC_rx->extflags = RExC_flags; /* was pm_op */\n /*dmq: removed as part of de-PMOP: pm->op_pmflags = RExC_flags; */\n\n if (UTF)\n\tSvUTF8_on(Rx);\t/* Unicode in it? */\n RExC_rxi->regstclass = NULL;\n if (RExC_naughty >= TOO_NAUGHTY)\t/* Probably an expensive pattern. */\n\tRExC_rx->intflags |= PREGf_NAUGHTY;\n scan = RExC_rxi->program + 1;\t\t/* First BRANCH. */\n\n /* testing for BRANCH here tells us whether there is \"must appear\"\n data in the pattern. If there is then we can use it for optimisations */\n if (!(RExC_seen & REG_TOP_LEVEL_BRANCHES_SEEN)) { /* Only one top-level choice.\n */\n\tSSize_t fake;\n\tSTRLEN longest_length[2];\n\tregnode_ssc ch_class; /* pointed to by data */\n\tint stclass_flag;\n\tSSize_t last_close = 0; /* pointed to by data */\n regnode *first= scan;\n regnode *first_next= regnext(first);\n int i;\n\n\t/*\n\t * Skip introductions and multiplicators >= 1\n\t * so that we can extract the 'meat' of the pattern that must\n\t * match in the large if() sequence following.\n\t * NOTE that EXACT is NOT covered here, as it is normally\n\t * picked up by the optimiser separately.\n\t *\n\t * This is unfortunate as the optimiser isnt handling lookahead\n\t * properly currently.\n\t *\n\t */\n\twhile ((OP(first) == OPEN && (sawopen = 1)) ||\n\t /* An OR of *one* alternative - should not happen now. */\n\t (OP(first) == BRANCH && OP(first_next) != BRANCH) ||\n\t /* for now we can't handle lookbehind IFMATCH*/\n\t (OP(first) == IFMATCH && !first->flags && (sawlookahead = 1)) ||\n\t (OP(first) == PLUS) ||\n\t (OP(first) == MINMOD) ||\n\t /* An {n,m} with n>0 */\n\t (PL_regkind[OP(first)] == CURLY && ARG1(first) > 0) ||\n\t (OP(first) == NOTHING && PL_regkind[OP(first_next)] != END ))\n\t{\n\t\t/*\n\t\t * the only op that could be a regnode is PLUS, all the rest\n\t\t * will be regnode_1 or regnode_2.\n\t\t *\n * (yves doesn't think this is true)\n\t\t */\n\t\tif (OP(first) == PLUS)\n\t\t sawplus = 1;\n else {\n if (OP(first) == MINMOD)\n sawminmod = 1;\n\t\t first += regarglen[OP(first)];\n }\n\t\tfirst = NEXTOPER(first);\n\t\tfirst_next= regnext(first);\n\t}\n\n\t/* Starting-point info. */\n again:\n DEBUG_PEEP(\"first:\", first, 0, 0);\n /* Ignore EXACT as we deal with it later. */\n\tif (PL_regkind[OP(first)] == EXACT) {\n\t if ( OP(first) == EXACT\n || OP(first) == EXACT_ONLY8\n || OP(first) == EXACTL)\n {\n\t\tNOOP;\t/* Empty, get anchored substr later. */\n }\n\t else\n\t\tRExC_rxi->regstclass = first;\n\t}\n#ifdef TRIE_STCLASS\n\telse if (PL_regkind[OP(first)] == TRIE &&\n\t ((reg_trie_data *)RExC_rxi->data->data[ ARG(first) ])->minlen>0)\n\t{\n /* this can happen only on restudy */\n RExC_rxi->regstclass = construct_ahocorasick_from_trie(pRExC_state, (regnode *)first, 0);\n\t}\n#endif\n\telse if (REGNODE_SIMPLE(OP(first)))\n\t RExC_rxi->regstclass = first;\n\telse if (PL_regkind[OP(first)] == BOUND ||\n\t\t PL_regkind[OP(first)] == NBOUND)\n\t RExC_rxi->regstclass = first;\n\telse if (PL_regkind[OP(first)] == BOL) {\n RExC_rx->intflags |= (OP(first) == MBOL\n ? PREGf_ANCH_MBOL\n : PREGf_ANCH_SBOL);\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n\telse if (OP(first) == GPOS) {\n RExC_rx->intflags |= PREGf_ANCH_GPOS;\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n\telse if ((!sawopen || !RExC_sawback) &&\n !sawlookahead &&\n\t (OP(first) == STAR &&\n\t PL_regkind[OP(NEXTOPER(first))] == REG_ANY) &&\n !(RExC_rx->intflags & PREGf_ANCH) && !pRExC_state->code_blocks)\n\t{\n\t /* turn .* into ^.* with an implied $*=1 */\n\t const int type =\n\t\t(OP(NEXTOPER(first)) == REG_ANY)\n ? PREGf_ANCH_MBOL\n : PREGf_ANCH_SBOL;\n RExC_rx->intflags |= (type | PREGf_IMPLICIT);\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n if (sawplus && !sawminmod && !sawlookahead\n && (!sawopen || !RExC_sawback)\n\t && !pRExC_state->code_blocks) /* May examine pos and $& */\n\t /* x+ must match at the 1st pos of run of x's */\n\t RExC_rx->intflags |= PREGf_SKIP;\n\n\t/* Scan is after the zeroth branch, first is atomic matcher. */\n#ifdef TRIE_STUDY_OPT\n\tDEBUG_PARSE_r(\n\t if (!restudied)\n Perl_re_printf( aTHX_ \"first at %\" IVdf \"\\n\",\n\t\t\t (IV)(first - scan + 1))\n );\n#else\n\tDEBUG_PARSE_r(\n Perl_re_printf( aTHX_ \"first at %\" IVdf \"\\n\",\n\t (IV)(first - scan + 1))\n );\n#endif\n\n\n\t/*\n\t* If there's something expensive in the r.e., find the\n\t* longest literal string that must appear and make it the\n\t* regmust. Resolve ties in favor of later strings, since\n\t* the regstart check works with the beginning of the r.e.\n\t* and avoiding duplication strengthens checking. Not a\n\t* strong reason, but sufficient in the absence of others.\n\t* [Now we resolve ties in favor of the earlier string if\n\t* it happens that c_offset_min has been invalidated, since the\n\t* earlier string may buy us something the later one won't.]\n\t*/\n\n\tdata.substrs[0].str = newSVpvs(\"\");\n\tdata.substrs[1].str = newSVpvs(\"\");\n\tdata.last_found = newSVpvs(\"\");\n\tdata.cur_is_floating = 0; /* initially any found substring is fixed */\n\tENTER_with_name(\"study_chunk\");\n\tSAVEFREESV(data.substrs[0].str);\n\tSAVEFREESV(data.substrs[1].str);\n\tSAVEFREESV(data.last_found);\n\tfirst = scan;\n\tif (!RExC_rxi->regstclass) {\n\t ssc_init(pRExC_state, &ch_class);\n\t data.start_class = &ch_class;\n\t stclass_flag = SCF_DO_STCLASS_AND;\n\t} else\t\t\t\t/* XXXX Check for BOUND? */\n\t stclass_flag = 0;\n\tdata.last_closep = &last_close;\n\n DEBUG_RExC_seen();\n /*\n * MAIN ENTRY FOR study_chunk() FOR m/PATTERN/\n * (NO top level branches)\n */\n\tminlen = study_chunk(pRExC_state, &first, &minlen, &fake,\n scan + RExC_size, /* Up to end */\n &data, -1, 0, NULL,\n SCF_DO_SUBSTR | SCF_WHILEM_VISITED_POS | stclass_flag\n | (restudied ? SCF_TRIE_DOING_RESTUDY : 0),\n 0);\n\n\n CHECK_RESTUDY_GOTO_butfirst(LEAVE_with_name(\"study_chunk\"));\n\n\n\tif ( RExC_total_parens == 1 && !data.cur_is_floating\n\t && data.last_start_min == 0 && data.last_end > 0\n\t && !RExC_seen_zerolen\n && !(RExC_seen & REG_VERBARG_SEEN)\n && !(RExC_seen & REG_GPOS_SEEN)\n ){\n\t RExC_rx->extflags |= RXf_CHECK_ALL;\n }\n\tscan_commit(pRExC_state, &data,&minlen, 0);\n\n\n /* XXX this is done in reverse order because that's the way the\n * code was before it was parameterised. Don't know whether it\n * actually needs doing in reverse order. DAPM */\n for (i = 1; i >= 0; i--) {\n longest_length[i] = CHR_SVLEN(data.substrs[i].str);\n\n if ( !( i\n && SvCUR(data.substrs[0].str) /* ok to leave SvCUR */\n && data.substrs[0].min_offset\n == data.substrs[1].min_offset\n && SvCUR(data.substrs[0].str)\n == SvCUR(data.substrs[1].str)\n )\n && S_setup_longest (aTHX_ pRExC_state,\n &(RExC_rx->substrs->data[i]),\n &(data.substrs[i]),\n longest_length[i]))\n {\n RExC_rx->substrs->data[i].min_offset =\n data.substrs[i].min_offset - data.substrs[i].lookbehind;\n\n RExC_rx->substrs->data[i].max_offset = data.substrs[i].max_offset;\n /* Don't offset infinity */\n if (data.substrs[i].max_offset < SSize_t_MAX)\n RExC_rx->substrs->data[i].max_offset -= data.substrs[i].lookbehind;\n SvREFCNT_inc_simple_void_NN(data.substrs[i].str);\n }\n else {\n RExC_rx->substrs->data[i].substr = NULL;\n RExC_rx->substrs->data[i].utf8_substr = NULL;\n longest_length[i] = 0;\n }\n }\n\n\tLEAVE_with_name(\"study_chunk\");\n\n\tif (RExC_rxi->regstclass\n\t && (OP(RExC_rxi->regstclass) == REG_ANY || OP(RExC_rxi->regstclass) == SANY))\n\t RExC_rxi->regstclass = NULL;\n\n\tif ((!(RExC_rx->substrs->data[0].substr || RExC_rx->substrs->data[0].utf8_substr)\n || RExC_rx->substrs->data[0].min_offset)\n\t && stclass_flag\n && ! (ANYOF_FLAGS(data.start_class) & SSC_MATCHES_EMPTY_STRING)\n\t && is_ssc_worth_it(pRExC_state, data.start_class))\n\t{\n\t const U32 n = add_data(pRExC_state, STR_WITH_LEN(\"f\"));\n\n ssc_finalize(pRExC_state, data.start_class);\n\n\t Newx(RExC_rxi->data->data[n], 1, regnode_ssc);\n\t StructCopy(data.start_class,\n\t\t (regnode_ssc*)RExC_rxi->data->data[n],\n\t\t regnode_ssc);\n\t RExC_rxi->regstclass = (regnode*)RExC_rxi->data->data[n];\n\t RExC_rx->intflags &= ~PREGf_SKIP;\t/* Used in find_byclass(). */\n\t DEBUG_COMPILE_r({ SV *sv = sv_newmortal();\n regprop(RExC_rx, sv, (regnode*)data.start_class, NULL, pRExC_state);\n Perl_re_printf( aTHX_\n\t\t\t\t \"synthetic stclass \\\"%s\\\".\\n\",\n\t\t\t\t SvPVX_const(sv));});\n data.start_class = NULL;\n\t}\n\n /* A temporary algorithm prefers floated substr to fixed one of\n * same length to dig more info. */\n\ti = (longest_length[0] <= longest_length[1]);\n RExC_rx->substrs->check_ix = i;\n RExC_rx->check_end_shift = RExC_rx->substrs->data[i].end_shift;\n RExC_rx->check_substr = RExC_rx->substrs->data[i].substr;\n RExC_rx->check_utf8 = RExC_rx->substrs->data[i].utf8_substr;\n RExC_rx->check_offset_min = RExC_rx->substrs->data[i].min_offset;\n RExC_rx->check_offset_max = RExC_rx->substrs->data[i].max_offset;\n if (!i && (RExC_rx->intflags & (PREGf_ANCH_SBOL|PREGf_ANCH_GPOS)))\n RExC_rx->intflags |= PREGf_NOSCAN;\n\n\tif ((RExC_rx->check_substr || RExC_rx->check_utf8) ) {\n\t RExC_rx->extflags |= RXf_USE_INTUIT;\n\t if (SvTAIL(RExC_rx->check_substr ? RExC_rx->check_substr : RExC_rx->check_utf8))\n\t\tRExC_rx->extflags |= RXf_INTUIT_TAIL;\n\t}\n\n\t/* XXX Unneeded? dmq (shouldn't as this is handled elsewhere)\n\tif ( (STRLEN)minlen < longest_length[1] )\n minlen= longest_length[1];\n if ( (STRLEN)minlen < longest_length[0] )\n minlen= longest_length[0];\n */\n }\n else {\n\t/* Several toplevels. Best we can is to set minlen. */\n\tSSize_t fake;\n\tregnode_ssc ch_class;\n\tSSize_t last_close = 0;\n\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"\\nMulti Top Level\\n\"));\n\n\tscan = RExC_rxi->program + 1;\n\tssc_init(pRExC_state, &ch_class);\n\tdata.start_class = &ch_class;\n\tdata.last_closep = &last_close;\n\n DEBUG_RExC_seen();\n /*\n * MAIN ENTRY FOR study_chunk() FOR m/P1|P2|.../\n * (patterns WITH top level branches)\n */\n\tminlen = study_chunk(pRExC_state,\n &scan, &minlen, &fake, scan + RExC_size, &data, -1, 0, NULL,\n SCF_DO_STCLASS_AND|SCF_WHILEM_VISITED_POS|(restudied\n ? SCF_TRIE_DOING_RESTUDY\n : 0),\n 0);\n\n CHECK_RESTUDY_GOTO_butfirst(NOOP);\n\n\tRExC_rx->check_substr = NULL;\n RExC_rx->check_utf8 = NULL;\n RExC_rx->substrs->data[0].substr = NULL;\n RExC_rx->substrs->data[0].utf8_substr = NULL;\n RExC_rx->substrs->data[1].substr = NULL;\n RExC_rx->substrs->data[1].utf8_substr = NULL;\n\n if (! (ANYOF_FLAGS(data.start_class) & SSC_MATCHES_EMPTY_STRING)\n\t && is_ssc_worth_it(pRExC_state, data.start_class))\n {\n\t const U32 n = add_data(pRExC_state, STR_WITH_LEN(\"f\"));\n\n ssc_finalize(pRExC_state, data.start_class);\n\n\t Newx(RExC_rxi->data->data[n], 1, regnode_ssc);\n\t StructCopy(data.start_class,\n\t\t (regnode_ssc*)RExC_rxi->data->data[n],\n\t\t regnode_ssc);\n\t RExC_rxi->regstclass = (regnode*)RExC_rxi->data->data[n];\n\t RExC_rx->intflags &= ~PREGf_SKIP;\t/* Used in find_byclass(). */\n\t DEBUG_COMPILE_r({ SV* sv = sv_newmortal();\n regprop(RExC_rx, sv, (regnode*)data.start_class, NULL, pRExC_state);\n Perl_re_printf( aTHX_\n\t\t\t\t \"synthetic stclass \\\"%s\\\".\\n\",\n\t\t\t\t SvPVX_const(sv));});\n data.start_class = NULL;\n\t}\n }\n\n if (RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN) {\n RExC_rx->extflags |= RXf_UNBOUNDED_QUANTIFIER_SEEN;\n RExC_rx->maxlen = REG_INFTY;\n }\n else {\n RExC_rx->maxlen = RExC_maxlen;\n }\n\n /* Guard against an embedded (?=) or (?<=) with a longer minlen than\n the \"real\" pattern. */\n DEBUG_OPTIMISE_r({\n Perl_re_printf( aTHX_ \"minlen: %\" IVdf \" RExC_rx->minlen:%\" IVdf \" maxlen:%\" IVdf \"\\n\",\n (IV)minlen, (IV)RExC_rx->minlen, (IV)RExC_maxlen);\n });\n RExC_rx->minlenret = minlen;\n if (RExC_rx->minlen < minlen)\n RExC_rx->minlen = minlen;\n\n if (RExC_seen & REG_RECURSE_SEEN ) {\n RExC_rx->intflags |= PREGf_RECURSE_SEEN;\n Newx(RExC_rx->recurse_locinput, RExC_rx->nparens + 1, char *);\n }\n if (RExC_seen & REG_GPOS_SEEN)\n RExC_rx->intflags |= PREGf_GPOS_SEEN;\n if (RExC_seen & REG_LOOKBEHIND_SEEN)\n RExC_rx->extflags |= RXf_NO_INPLACE_SUBST; /* inplace might break the\n lookbehind */\n if (pRExC_state->code_blocks)\n\tRExC_rx->extflags |= RXf_EVAL_SEEN;\n if (RExC_seen & REG_VERBARG_SEEN)\n {\n\tRExC_rx->intflags |= PREGf_VERBARG_SEEN;\n RExC_rx->extflags |= RXf_NO_INPLACE_SUBST; /* don't understand this! Yves */\n }\n if (RExC_seen & REG_CUTGROUP_SEEN)\n\tRExC_rx->intflags |= PREGf_CUTGROUP_SEEN;\n if (pm_flags & PMf_USE_RE_EVAL)\n\tRExC_rx->intflags |= PREGf_USE_RE_EVAL;\n if (RExC_paren_names)\n RXp_PAREN_NAMES(RExC_rx) = MUTABLE_HV(SvREFCNT_inc(RExC_paren_names));\n else\n RXp_PAREN_NAMES(RExC_rx) = NULL;\n\n /* If we have seen an anchor in our pattern then we set the extflag RXf_IS_ANCHORED\n * so it can be used in pp.c */\n if (RExC_rx->intflags & PREGf_ANCH)\n RExC_rx->extflags |= RXf_IS_ANCHORED;\n\n\n {\n /* this is used to identify \"special\" patterns that might result\n * in Perl NOT calling the regex engine and instead doing the match \"itself\",\n * particularly special cases in split//. By having the regex compiler\n * do this pattern matching at a regop level (instead of by inspecting the pattern)\n * we avoid weird issues with equivalent patterns resulting in different behavior,\n * AND we allow non Perl engines to get the same optimizations by the setting the\n * flags appropriately - Yves */\n regnode *first = RExC_rxi->program + 1;\n U8 fop = OP(first);\n regnode *next = regnext(first);\n U8 nop = OP(next);\n\n if (PL_regkind[fop] == NOTHING && nop == END)\n RExC_rx->extflags |= RXf_NULL;\n else if ((fop == MBOL || (fop == SBOL && !first->flags)) && nop == END)\n /* when fop is SBOL first->flags will be true only when it was\n * produced by parsing /\\A/, and not when parsing /^/. This is\n * very important for the split code as there we want to\n * treat /^/ as /^/m, but we do not want to treat /\\A/ as /^/m.\n * See rt #122761 for more details. -- Yves */\n RExC_rx->extflags |= RXf_START_ONLY;\n else if (fop == PLUS\n && PL_regkind[nop] == POSIXD && FLAGS(next) == _CC_SPACE\n && nop == END)\n RExC_rx->extflags |= RXf_WHITE;\n else if ( RExC_rx->extflags & RXf_SPLIT\n && (fop == EXACT || fop == EXACT_ONLY8 || fop == EXACTL)\n && STR_LEN(first) == 1\n && *(STRING(first)) == ' '\n && nop == END )\n RExC_rx->extflags |= (RXf_SKIPWHITE|RXf_WHITE);\n\n }\n\n if (RExC_contains_locale) {\n RXp_EXTFLAGS(RExC_rx) |= RXf_TAINTED;\n }\n\n#ifdef DEBUGGING\n if (RExC_paren_names) {\n RExC_rxi->name_list_idx = add_data( pRExC_state, STR_WITH_LEN(\"a\"));\n RExC_rxi->data->data[RExC_rxi->name_list_idx]\n = (void*)SvREFCNT_inc(RExC_paren_name_list);\n } else\n#endif\n RExC_rxi->name_list_idx = 0;\n\n while ( RExC_recurse_count > 0 ) {\n const regnode *scan = RExC_recurse[ --RExC_recurse_count ];\n /*\n * This data structure is set up in study_chunk() and is used\n * to calculate the distance between a GOSUB regopcode and\n * the OPEN/CURLYM (CURLYM's are special and can act like OPEN's)\n * it refers to.\n *\n * If for some reason someone writes code that optimises\n * away a GOSUB opcode then the assert should be changed to\n * an if(scan) to guard the ARG2L_SET() - Yves\n *\n */\n assert(scan && OP(scan) == GOSUB);\n ARG2L_SET( scan, RExC_open_parens[ARG(scan)] - REGNODE_OFFSET(scan));\n }\n\n Newxz(RExC_rx->offs, RExC_total_parens, regexp_paren_pair);\n /* assume we don't need to swap parens around before we match */\n DEBUG_TEST_r({\n Perl_re_printf( aTHX_ \"study_chunk_recursed_count: %lu\\n\",\n (unsigned long)RExC_study_chunk_recursed_count);\n });\n DEBUG_DUMP_r({\n DEBUG_RExC_seen();\n Perl_re_printf( aTHX_ \"Final program:\\n\");\n regdump(RExC_rx);\n });\n\n if (RExC_open_parens) {\n Safefree(RExC_open_parens);\n RExC_open_parens = NULL;\n }\n if (RExC_close_parens) {\n Safefree(RExC_close_parens);\n RExC_close_parens = NULL;\n }\n\n#ifdef USE_ITHREADS\n /* under ithreads the ?pat? PMf_USED flag on the pmop is simulated\n * by setting the regexp SV to readonly-only instead. If the\n * pattern's been recompiled, the USEDness should remain. */\n if (old_re && SvREADONLY(old_re))\n SvREADONLY_on(Rx);\n#endif\n return Rx;","target":"REGEXP *\nPerl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,\n\t\t OP *expr, const regexp_engine* eng, REGEXP *old_re,\n\t\t bool *is_bare_re, const U32 orig_rx_flags, const U32 pm_flags)\n{\n dVAR;\n REGEXP *Rx; /* Capital 'R' means points to a REGEXP */\n STRLEN plen;\n char *exp;\n regnode *scan;\n I32 flags;\n SSize_t minlen = 0;\n U32 rx_flags;\n SV *pat;\n SV** new_patternp = patternp;\n\n /* these are all flags - maybe they should be turned\n * into a single int with different bit masks */\n I32 sawlookahead = 0;\n I32 sawplus = 0;\n I32 sawopen = 0;\n I32 sawminmod = 0;\n\n regex_charset initial_charset = get_regex_charset(orig_rx_flags);\n bool recompile = 0;\n bool runtime_code = 0;\n scan_data_t data;\n RExC_state_t RExC_state;\n RExC_state_t * const pRExC_state = &RExC_state;\n#ifdef TRIE_STUDY_OPT\n int restudied = 0;\n RExC_state_t copyRExC_state;\n#endif\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_RE_OP_COMPILE;\n\n DEBUG_r(if (!PL_colorset) reginitcolors());\n\n /* Initialize these here instead of as-needed, as is quick and avoids\n * having to test them each time otherwise */\n if (! PL_InBitmap) {\n#ifdef DEBUGGING\n char * dump_len_string;\n#endif\n\n /* This is calculated here, because the Perl program that generates the\n * static global ones doesn't currently have access to\n * NUM_ANYOF_CODE_POINTS */\n\tPL_InBitmap = _new_invlist(2);\n\tPL_InBitmap = _add_range_to_invlist(PL_InBitmap, 0,\n NUM_ANYOF_CODE_POINTS - 1);\n#ifdef DEBUGGING\n dump_len_string = PerlEnv_getenv(\"PERL_DUMP_RE_MAX_LEN\");\n if ( ! dump_len_string\n || ! grok_atoUV(dump_len_string, (UV *)&PL_dump_re_max_len, NULL))\n {\n PL_dump_re_max_len = 60; /* A reasonable default */\n }\n#endif\n }\n\n pRExC_state->warn_text = NULL;\n pRExC_state->unlexed_names = NULL;\n pRExC_state->code_blocks = NULL;\n\n if (is_bare_re)\n\t*is_bare_re = FALSE;\n\n if (expr && (expr->op_type == OP_LIST ||\n\t\t(expr->op_type == OP_NULL && expr->op_targ == OP_LIST))) {\n\t/* allocate code_blocks if needed */\n\tOP *o;\n\tint ncode = 0;\n\n\tfor (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o))\n\t if (o->op_type == OP_NULL && (o->op_flags & OPf_SPECIAL))\n\t\tncode++; /* count of DO blocks */\n\n\tif (ncode)\n pRExC_state->code_blocks = S_alloc_code_blocks(aTHX_ ncode);\n }\n\n if (!pat_count) {\n /* compile-time pattern with just OP_CONSTs and DO blocks */\n\n int n;\n OP *o;\n\n /* find how many CONSTs there are */\n assert(expr);\n n = 0;\n if (expr->op_type == OP_CONST)\n n = 1;\n else\n for (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o)) {\n if (o->op_type == OP_CONST)\n n++;\n }\n\n /* fake up an SV array */\n\n assert(!new_patternp);\n Newx(new_patternp, n, SV*);\n SAVEFREEPV(new_patternp);\n pat_count = n;\n\n n = 0;\n if (expr->op_type == OP_CONST)\n new_patternp[n] = cSVOPx_sv(expr);\n else\n for (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o)) {\n if (o->op_type == OP_CONST)\n new_patternp[n++] = cSVOPo_sv;\n }\n\n }\n\n DEBUG_PARSE_r(Perl_re_printf( aTHX_\n \"Assembling pattern from %d elements%s\\n\", pat_count,\n orig_rx_flags & RXf_SPLIT ? \" for split\" : \"\"));\n\n /* set expr to the first arg op */\n\n if (pRExC_state->code_blocks && pRExC_state->code_blocks->count\n && expr->op_type != OP_CONST)\n {\n expr = cLISTOPx(expr)->op_first;\n assert( expr->op_type == OP_PUSHMARK\n || (expr->op_type == OP_NULL && expr->op_targ == OP_PUSHMARK)\n || expr->op_type == OP_PADRANGE);\n expr = OpSIBLING(expr);\n }\n\n pat = S_concat_pat(aTHX_ pRExC_state, NULL, new_patternp, pat_count,\n expr, &recompile, NULL);\n\n /* handle bare (possibly after overloading) regex: foo =~ $re */\n {\n SV *re = pat;\n if (SvROK(re))\n re = SvRV(re);\n if (SvTYPE(re) == SVt_REGEXP) {\n if (is_bare_re)\n *is_bare_re = TRUE;\n SvREFCNT_inc(re);\n DEBUG_PARSE_r(Perl_re_printf( aTHX_\n \"Precompiled pattern%s\\n\",\n orig_rx_flags & RXf_SPLIT ? \" for split\" : \"\"));\n\n return (REGEXP*)re;\n }\n }\n\n exp = SvPV_nomg(pat, plen);\n\n if (!eng->op_comp) {\n\tif ((SvUTF8(pat) && IN_BYTES)\n\t\t|| SvGMAGICAL(pat) || SvAMAGIC(pat))\n\t{\n\t /* make a temporary copy; either to convert to bytes,\n\t * or to avoid repeating get-magic / overloaded stringify */\n\t pat = newSVpvn_flags(exp, plen, SVs_TEMP |\n\t\t\t\t\t(IN_BYTES ? 0 : SvUTF8(pat)));\n\t}\n\treturn CALLREGCOMP_ENG(eng, pat, orig_rx_flags);\n }\n\n /* ignore the utf8ness if the pattern is 0 length */\n RExC_utf8 = RExC_orig_utf8 = (plen == 0 || IN_BYTES) ? 0 : SvUTF8(pat);\n RExC_uni_semantics = 0;\n RExC_contains_locale = 0;\n RExC_strict = cBOOL(pm_flags & RXf_PMf_STRICT);\n RExC_in_script_run = 0;\n RExC_study_started = 0;\n pRExC_state->runtime_code_qr = NULL;\n RExC_frame_head= NULL;\n RExC_frame_last= NULL;\n RExC_frame_count= 0;\n RExC_latest_warn_offset = 0;\n RExC_use_BRANCHJ = 0;\n RExC_total_parens = 0;\n RExC_open_parens = NULL;\n RExC_close_parens = NULL;\n RExC_paren_names = NULL;\n RExC_size = 0;\n RExC_seen_d_op = FALSE;\n#ifdef DEBUGGING\n RExC_paren_name_list = NULL;\n#endif\n\n DEBUG_r({\n RExC_mysv1= sv_newmortal();\n RExC_mysv2= sv_newmortal();\n });\n\n DEBUG_COMPILE_r({\n SV *dsv= sv_newmortal();\n RE_PV_QUOTED_DECL(s, RExC_utf8, dsv, exp, plen, PL_dump_re_max_len);\n Perl_re_printf( aTHX_ \"%sCompiling REx%s %s\\n\",\n PL_colors[4], PL_colors[5], s);\n });\n\n /* we jump here if we have to recompile, e.g., from upgrading the pattern\n * to utf8 */\n\n if ((pm_flags & PMf_USE_RE_EVAL)\n\t\t/* this second condition covers the non-regex literal case,\n\t\t * i.e. $foo =~ '(?{})'. */\n\t\t|| (IN_PERL_COMPILETIME && (PL_hints & HINT_RE_EVAL))\n )\n\truntime_code = S_has_runtime_code(aTHX_ pRExC_state, exp, plen);\n\n redo_parse:\n /* return old regex if pattern hasn't changed */\n /* XXX: note in the below we have to check the flags as well as the\n * pattern.\n *\n * Things get a touch tricky as we have to compare the utf8 flag\n * independently from the compile flags. */\n\n if ( old_re\n && !recompile\n && !!RX_UTF8(old_re) == !!RExC_utf8\n && ( RX_COMPFLAGS(old_re) == ( orig_rx_flags & RXf_PMf_FLAGCOPYMASK ) )\n\t&& RX_PRECOMP(old_re)\n\t&& RX_PRELEN(old_re) == plen\n && memEQ(RX_PRECOMP(old_re), exp, plen)\n\t&& !runtime_code /* with runtime code, always recompile */ )\n {\n return old_re;\n }\n\n /* Allocate the pattern's SV */\n RExC_rx_sv = Rx = (REGEXP*) newSV_type(SVt_REGEXP);\n RExC_rx = ReANY(Rx);\n if ( RExC_rx == NULL )\n FAIL(\"Regexp out of space\");\n\n rx_flags = orig_rx_flags;\n\n if ( (UTF || RExC_uni_semantics)\n && initial_charset == REGEX_DEPENDS_CHARSET)\n {\n\n\t/* Set to use unicode semantics if the pattern is in utf8 and has the\n\t * 'depends' charset specified, as it means unicode when utf8 */\n\tset_regex_charset(&rx_flags, REGEX_UNICODE_CHARSET);\n RExC_uni_semantics = 1;\n }\n\n RExC_pm_flags = pm_flags;\n\n if (runtime_code) {\n assert(TAINTING_get || !TAINT_get);\n\tif (TAINT_get)\n\t Perl_croak(aTHX_ \"Eval-group in insecure regular expression\");\n\n\tif (!S_compile_runtime_code(aTHX_ pRExC_state, exp, plen)) {\n\t /* whoops, we have a non-utf8 pattern, whilst run-time code\n\t * got compiled as utf8. Try again with a utf8 pattern */\n S_pat_upgrade_to_utf8(aTHX_ pRExC_state, &exp, &plen,\n pRExC_state->code_blocks ? pRExC_state->code_blocks->count : 0);\n goto redo_parse;\n\t}\n }\n assert(!pRExC_state->runtime_code_qr);\n\n RExC_sawback = 0;\n\n RExC_seen = 0;\n RExC_maxlen = 0;\n RExC_in_lookbehind = 0;\n RExC_seen_zerolen = *exp == '^' ? -1 : 0;\n#ifdef EBCDIC\n RExC_recode_x_to_native = 0;\n#endif\n RExC_in_multi_char_class = 0;\n\n RExC_start = RExC_copy_start_in_constructed = RExC_copy_start_in_input = RExC_precomp = exp;\n RExC_precomp_end = RExC_end = exp + plen;\n RExC_nestroot = 0;\n RExC_whilem_seen = 0;\n RExC_end_op = NULL;\n RExC_recurse = NULL;\n RExC_study_chunk_recursed = NULL;\n RExC_study_chunk_recursed_bytes= 0;\n RExC_recurse_count = 0;\n pRExC_state->code_index = 0;\n\n /* Initialize the string in the compiled pattern. This is so that there is\n * something to output if necessary */\n set_regex_pv(pRExC_state, Rx);\n\n DEBUG_PARSE_r({\n Perl_re_printf( aTHX_\n \"Starting parse and generation\\n\");\n RExC_lastnum=0;\n RExC_lastparse=NULL;\n });\n\n /* Allocate space and zero-initialize. Note, the two step process\n of zeroing when in debug mode, thus anything assigned has to\n happen after that */\n if (! RExC_size) {\n\n /* On the first pass of the parse, we guess how big this will be. Then\n * we grow in one operation to that amount and then give it back. As\n * we go along, we re-allocate what we need.\n *\n * XXX Currently the guess is essentially that the pattern will be an\n * EXACT node with one byte input, one byte output. This is crude, and\n * better heuristics are welcome.\n *\n * On any subsequent passes, we guess what we actually computed in the\n * latest earlier pass. Such a pass probably didn't complete so is\n * missing stuff. We could improve those guesses by knowing where the\n * parse stopped, and use the length so far plus apply the above\n * assumption to what's left. */\n RExC_size = STR_SZ(RExC_end - RExC_start);\n }\n\n Newxc(RExC_rxi, sizeof(regexp_internal) + RExC_size, char, regexp_internal);\n if ( RExC_rxi == NULL )\n FAIL(\"Regexp out of space\");\n\n Zero(RExC_rxi, sizeof(regexp_internal) + RExC_size, char);\n RXi_SET( RExC_rx, RExC_rxi );\n\n /* We start from 0 (over from 0 in the case this is a reparse. The first\n * node parsed will give back any excess memory we have allocated so far).\n * */\n RExC_size = 0;\n\n /* non-zero initialization begins here */\n RExC_rx->engine= eng;\n RExC_rx->extflags = rx_flags;\n RXp_COMPFLAGS(RExC_rx) = orig_rx_flags & RXf_PMf_FLAGCOPYMASK;\n\n if (pm_flags & PMf_IS_QR) {\n\tRExC_rxi->code_blocks = pRExC_state->code_blocks;\n if (RExC_rxi->code_blocks) {\n RExC_rxi->code_blocks->refcnt++;\n }\n }\n\n RExC_rx->intflags = 0;\n\n RExC_flags = rx_flags;\t/* don't let top level (?i) bleed */\n RExC_parse = exp;\n\n /* This NUL is guaranteed because the pattern comes from an SV*, and the sv\n * code makes sure the final byte is an uncounted NUL. But should this\n * ever not be the case, lots of things could read beyond the end of the\n * buffer: loops like\n * while(isFOO(*RExC_parse)) RExC_parse++;\n * strchr(RExC_parse, \"foo\");\n * etc. So it is worth noting. */\n assert(*RExC_end == '\\0');\n\n RExC_naughty = 0;\n RExC_npar = 1;\n RExC_parens_buf_size = 0;\n RExC_emit_start = RExC_rxi->program;\n pRExC_state->code_index = 0;\n\n *((char*) RExC_emit_start) = (char) REG_MAGIC;\n RExC_emit = 1;\n\n /* Do the parse */\n if (reg(pRExC_state, 0, &flags, 1)) {\n\n /* Success!, But we may need to redo the parse knowing how many parens\n * there actually are */\n if (IN_PARENS_PASS) {\n flags |= RESTART_PARSE;\n }\n\n /* We have that number in RExC_npar */\n RExC_total_parens = RExC_npar;\n\n /* XXX For backporting, use long jumps if there is any possibility of\n * overflow */\n if (RExC_size > U16_MAX && ! RExC_use_BRANCHJ) {\n RExC_use_BRANCHJ = TRUE;\n flags |= RESTART_PARSE;\n }\n }\n else if (! MUST_RESTART(flags)) {\n\tReREFCNT_dec(Rx);\n Perl_croak(aTHX_ \"panic: reg returned failure to re_op_compile, flags=%#\" UVxf, (UV) flags);\n }\n\n /* Here, we either have success, or we have to redo the parse for some reason */\n if (MUST_RESTART(flags)) {\n\n /* It's possible to write a regexp in ascii that represents Unicode\n codepoints outside of the byte range, such as via \\x{100}. If we\n detect such a sequence we have to convert the entire pattern to utf8\n and then recompile, as our sizing calculation will have been based\n on 1 byte == 1 character, but we will need to use utf8 to encode\n at least some part of the pattern, and therefore must convert the whole\n thing.\n -- dmq */\n if (flags & NEED_UTF8) {\n\n /* We have stored the offset of the final warning output so far.\n * That must be adjusted. Any variant characters between the start\n * of the pattern and this warning count for 2 bytes in the final,\n * so just add them again */\n if (UNLIKELY(RExC_latest_warn_offset > 0)) {\n RExC_latest_warn_offset +=\n variant_under_utf8_count((U8 *) exp, (U8 *) exp\n + RExC_latest_warn_offset);\n }\n S_pat_upgrade_to_utf8(aTHX_ pRExC_state, &exp, &plen,\n pRExC_state->code_blocks ? pRExC_state->code_blocks->count : 0);\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"Need to redo parse after upgrade\\n\"));\n }\n else {\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"Need to redo parse\\n\"));\n }\n\n if (ALL_PARENS_COUNTED) {\n /* Make enough room for all the known parens, and zero it */\n Renew(RExC_open_parens, RExC_total_parens, regnode_offset);\n Zero(RExC_open_parens, RExC_total_parens, regnode_offset);\n RExC_open_parens[0] = 1; /* +1 for REG_MAGIC */\n\n Renew(RExC_close_parens, RExC_total_parens, regnode_offset);\n Zero(RExC_close_parens, RExC_total_parens, regnode_offset);\n }\n else { /* Parse did not complete. Reinitialize the parentheses\n structures */\n RExC_total_parens = 0;\n if (RExC_open_parens) {\n Safefree(RExC_open_parens);\n RExC_open_parens = NULL;\n }\n if (RExC_close_parens) {\n Safefree(RExC_close_parens);\n RExC_close_parens = NULL;\n }\n }\n\n /* Clean up what we did in this parse */\n SvREFCNT_dec_NN(RExC_rx_sv);\n\n goto redo_parse;\n }\n\n /* Here, we have successfully parsed and generated the pattern's program\n * for the regex engine. We are ready to finish things up and look for\n * optimizations. */\n\n /* Update the string to compile, with correct modifiers, etc */\n set_regex_pv(pRExC_state, Rx);\n\n RExC_rx->nparens = RExC_total_parens - 1;\n\n /* Uses the upper 4 bits of the FLAGS field, so keep within that size */\n if (RExC_whilem_seen > 15)\n RExC_whilem_seen = 15;\n\n DEBUG_PARSE_r({\n Perl_re_printf( aTHX_\n \"Required size %\" IVdf \" nodes\\n\", (IV)RExC_size);\n RExC_lastnum=0;\n RExC_lastparse=NULL;\n });\n\n#ifdef RE_TRACK_PATTERN_OFFSETS\n DEBUG_OFFSETS_r(Perl_re_printf( aTHX_\n \"%s %\" UVuf \" bytes for offset annotations.\\n\",\n RExC_offsets ? \"Got\" : \"Couldn't get\",\n (UV)((RExC_offsets[0] * 2 + 1))));\n DEBUG_OFFSETS_r(if (RExC_offsets) {\n const STRLEN len = RExC_offsets[0];\n STRLEN i;\n GET_RE_DEBUG_FLAGS_DECL;\n Perl_re_printf( aTHX_\n \"Offsets: [%\" UVuf \"]\\n\\t\", (UV)RExC_offsets[0]);\n for (i = 1; i <= len; i++) {\n if (RExC_offsets[i*2-1] || RExC_offsets[i*2])\n Perl_re_printf( aTHX_ \"%\" UVuf \":%\" UVuf \"[%\" UVuf \"] \",\n (UV)i, (UV)RExC_offsets[i*2-1], (UV)RExC_offsets[i*2]);\n }\n Perl_re_printf( aTHX_ \"\\n\");\n });\n\n#else\n SetProgLen(RExC_rxi,RExC_size);\n#endif\n\n DEBUG_OPTIMISE_r(\n Perl_re_printf( aTHX_ \"Starting post parse optimization\\n\");\n );\n\n /* XXXX To minimize changes to RE engine we always allocate\n 3-units-long substrs field. */\n Newx(RExC_rx->substrs, 1, struct reg_substr_data);\n if (RExC_recurse_count) {\n Newx(RExC_recurse, RExC_recurse_count, regnode *);\n SAVEFREEPV(RExC_recurse);\n }\n\n if (RExC_seen & REG_RECURSE_SEEN) {\n /* Note, RExC_total_parens is 1 + the number of parens in a pattern.\n * So its 1 if there are no parens. */\n RExC_study_chunk_recursed_bytes= (RExC_total_parens >> 3) +\n ((RExC_total_parens & 0x07) != 0);\n Newx(RExC_study_chunk_recursed,\n RExC_study_chunk_recursed_bytes * RExC_total_parens, U8);\n SAVEFREEPV(RExC_study_chunk_recursed);\n }\n\n reStudy:\n RExC_rx->minlen = minlen = sawlookahead = sawplus = sawopen = sawminmod = 0;\n DEBUG_r(\n RExC_study_chunk_recursed_count= 0;\n );\n Zero(RExC_rx->substrs, 1, struct reg_substr_data);\n if (RExC_study_chunk_recursed) {\n Zero(RExC_study_chunk_recursed,\n RExC_study_chunk_recursed_bytes * RExC_total_parens, U8);\n }\n\n\n#ifdef TRIE_STUDY_OPT\n if (!restudied) {\n StructCopy(&zero_scan_data, &data, scan_data_t);\n copyRExC_state = RExC_state;\n } else {\n U32 seen=RExC_seen;\n DEBUG_OPTIMISE_r(Perl_re_printf( aTHX_ \"Restudying\\n\"));\n\n RExC_state = copyRExC_state;\n if (seen & REG_TOP_LEVEL_BRANCHES_SEEN)\n RExC_seen |= REG_TOP_LEVEL_BRANCHES_SEEN;\n else\n RExC_seen &= ~REG_TOP_LEVEL_BRANCHES_SEEN;\n\tStructCopy(&zero_scan_data, &data, scan_data_t);\n }\n#else\n StructCopy(&zero_scan_data, &data, scan_data_t);\n#endif\n\n /* Dig out information for optimizations. */\n RExC_rx->extflags = RExC_flags; /* was pm_op */\n /*dmq: removed as part of de-PMOP: pm->op_pmflags = RExC_flags; */\n\n if (UTF)\n\tSvUTF8_on(Rx);\t/* Unicode in it? */\n RExC_rxi->regstclass = NULL;\n if (RExC_naughty >= TOO_NAUGHTY)\t/* Probably an expensive pattern. */\n\tRExC_rx->intflags |= PREGf_NAUGHTY;\n scan = RExC_rxi->program + 1;\t\t/* First BRANCH. */\n\n /* testing for BRANCH here tells us whether there is \"must appear\"\n data in the pattern. If there is then we can use it for optimisations */\n if (!(RExC_seen & REG_TOP_LEVEL_BRANCHES_SEEN)) { /* Only one top-level choice.\n */\n\tSSize_t fake;\n\tSTRLEN longest_length[2];\n\tregnode_ssc ch_class; /* pointed to by data */\n\tint stclass_flag;\n\tSSize_t last_close = 0; /* pointed to by data */\n regnode *first= scan;\n regnode *first_next= regnext(first);\n int i;\n\n\t/*\n\t * Skip introductions and multiplicators >= 1\n\t * so that we can extract the 'meat' of the pattern that must\n\t * match in the large if() sequence following.\n\t * NOTE that EXACT is NOT covered here, as it is normally\n\t * picked up by the optimiser separately.\n\t *\n\t * This is unfortunate as the optimiser isnt handling lookahead\n\t * properly currently.\n\t *\n\t */\n\twhile ((OP(first) == OPEN && (sawopen = 1)) ||\n\t /* An OR of *one* alternative - should not happen now. */\n\t (OP(first) == BRANCH && OP(first_next) != BRANCH) ||\n\t /* for now we can't handle lookbehind IFMATCH*/\n\t (OP(first) == IFMATCH && !first->flags && (sawlookahead = 1)) ||\n\t (OP(first) == PLUS) ||\n\t (OP(first) == MINMOD) ||\n\t /* An {n,m} with n>0 */\n\t (PL_regkind[OP(first)] == CURLY && ARG1(first) > 0) ||\n\t (OP(first) == NOTHING && PL_regkind[OP(first_next)] != END ))\n\t{\n\t\t/*\n\t\t * the only op that could be a regnode is PLUS, all the rest\n\t\t * will be regnode_1 or regnode_2.\n\t\t *\n * (yves doesn't think this is true)\n\t\t */\n\t\tif (OP(first) == PLUS)\n\t\t sawplus = 1;\n else {\n if (OP(first) == MINMOD)\n sawminmod = 1;\n\t\t first += regarglen[OP(first)];\n }\n\t\tfirst = NEXTOPER(first);\n\t\tfirst_next= regnext(first);\n\t}\n\n\t/* Starting-point info. */\n again:\n DEBUG_PEEP(\"first:\", first, 0, 0);\n /* Ignore EXACT as we deal with it later. */\n\tif (PL_regkind[OP(first)] == EXACT) {\n\t if ( OP(first) == EXACT\n || OP(first) == EXACT_ONLY8\n || OP(first) == EXACTL)\n {\n\t\tNOOP;\t/* Empty, get anchored substr later. */\n }\n\t else\n\t\tRExC_rxi->regstclass = first;\n\t}\n#ifdef TRIE_STCLASS\n\telse if (PL_regkind[OP(first)] == TRIE &&\n\t ((reg_trie_data *)RExC_rxi->data->data[ ARG(first) ])->minlen>0)\n\t{\n /* this can happen only on restudy */\n RExC_rxi->regstclass = construct_ahocorasick_from_trie(pRExC_state, (regnode *)first, 0);\n\t}\n#endif\n\telse if (REGNODE_SIMPLE(OP(first)))\n\t RExC_rxi->regstclass = first;\n\telse if (PL_regkind[OP(first)] == BOUND ||\n\t\t PL_regkind[OP(first)] == NBOUND)\n\t RExC_rxi->regstclass = first;\n\telse if (PL_regkind[OP(first)] == BOL) {\n RExC_rx->intflags |= (OP(first) == MBOL\n ? PREGf_ANCH_MBOL\n : PREGf_ANCH_SBOL);\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n\telse if (OP(first) == GPOS) {\n RExC_rx->intflags |= PREGf_ANCH_GPOS;\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n\telse if ((!sawopen || !RExC_sawback) &&\n !sawlookahead &&\n\t (OP(first) == STAR &&\n\t PL_regkind[OP(NEXTOPER(first))] == REG_ANY) &&\n !(RExC_rx->intflags & PREGf_ANCH) && !pRExC_state->code_blocks)\n\t{\n\t /* turn .* into ^.* with an implied $*=1 */\n\t const int type =\n\t\t(OP(NEXTOPER(first)) == REG_ANY)\n ? PREGf_ANCH_MBOL\n : PREGf_ANCH_SBOL;\n RExC_rx->intflags |= (type | PREGf_IMPLICIT);\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n if (sawplus && !sawminmod && !sawlookahead\n && (!sawopen || !RExC_sawback)\n\t && !pRExC_state->code_blocks) /* May examine pos and $& */\n\t /* x+ must match at the 1st pos of run of x's */\n\t RExC_rx->intflags |= PREGf_SKIP;\n\n\t/* Scan is after the zeroth branch, first is atomic matcher. */\n#ifdef TRIE_STUDY_OPT\n\tDEBUG_PARSE_r(\n\t if (!restudied)\n Perl_re_printf( aTHX_ \"first at %\" IVdf \"\\n\",\n\t\t\t (IV)(first - scan + 1))\n );\n#else\n\tDEBUG_PARSE_r(\n Perl_re_printf( aTHX_ \"first at %\" IVdf \"\\n\",\n\t (IV)(first - scan + 1))\n );\n#endif\n\n\n\t/*\n\t* If there's something expensive in the r.e., find the\n\t* longest literal string that must appear and make it the\n\t* regmust. Resolve ties in favor of later strings, since\n\t* the regstart check works with the beginning of the r.e.\n\t* and avoiding duplication strengthens checking. Not a\n\t* strong reason, but sufficient in the absence of others.\n\t* [Now we resolve ties in favor of the earlier string if\n\t* it happens that c_offset_min has been invalidated, since the\n\t* earlier string may buy us something the later one won't.]\n\t*/\n\n\tdata.substrs[0].str = newSVpvs(\"\");\n\tdata.substrs[1].str = newSVpvs(\"\");\n\tdata.last_found = newSVpvs(\"\");\n\tdata.cur_is_floating = 0; /* initially any found substring is fixed */\n\tENTER_with_name(\"study_chunk\");\n\tSAVEFREESV(data.substrs[0].str);\n\tSAVEFREESV(data.substrs[1].str);\n\tSAVEFREESV(data.last_found);\n\tfirst = scan;\n\tif (!RExC_rxi->regstclass) {\n\t ssc_init(pRExC_state, &ch_class);\n\t data.start_class = &ch_class;\n\t stclass_flag = SCF_DO_STCLASS_AND;\n\t} else\t\t\t\t/* XXXX Check for BOUND? */\n\t stclass_flag = 0;\n\tdata.last_closep = &last_close;\n\n DEBUG_RExC_seen();\n /*\n * MAIN ENTRY FOR study_chunk() FOR m/PATTERN/\n * (NO top level branches)\n */\n\tminlen = study_chunk(pRExC_state, &first, &minlen, &fake,\n scan + RExC_size, /* Up to end */\n &data, -1, 0, NULL,\n SCF_DO_SUBSTR | SCF_WHILEM_VISITED_POS | stclass_flag\n | (restudied ? SCF_TRIE_DOING_RESTUDY : 0),\n 0);\n\n\n CHECK_RESTUDY_GOTO_butfirst(LEAVE_with_name(\"study_chunk\"));\n\n\n\tif ( RExC_total_parens == 1 && !data.cur_is_floating\n\t && data.last_start_min == 0 && data.last_end > 0\n\t && !RExC_seen_zerolen\n && !(RExC_seen & REG_VERBARG_SEEN)\n && !(RExC_seen & REG_GPOS_SEEN)\n ){\n\t RExC_rx->extflags |= RXf_CHECK_ALL;\n }\n\tscan_commit(pRExC_state, &data,&minlen, 0);\n\n\n /* XXX this is done in reverse order because that's the way the\n * code was before it was parameterised. Don't know whether it\n * actually needs doing in reverse order. DAPM */\n for (i = 1; i >= 0; i--) {\n longest_length[i] = CHR_SVLEN(data.substrs[i].str);\n\n if ( !( i\n && SvCUR(data.substrs[0].str) /* ok to leave SvCUR */\n && data.substrs[0].min_offset\n == data.substrs[1].min_offset\n && SvCUR(data.substrs[0].str)\n == SvCUR(data.substrs[1].str)\n )\n && S_setup_longest (aTHX_ pRExC_state,\n &(RExC_rx->substrs->data[i]),\n &(data.substrs[i]),\n longest_length[i]))\n {\n RExC_rx->substrs->data[i].min_offset =\n data.substrs[i].min_offset - data.substrs[i].lookbehind;\n\n RExC_rx->substrs->data[i].max_offset = data.substrs[i].max_offset;\n /* Don't offset infinity */\n if (data.substrs[i].max_offset < SSize_t_MAX)\n RExC_rx->substrs->data[i].max_offset -= data.substrs[i].lookbehind;\n SvREFCNT_inc_simple_void_NN(data.substrs[i].str);\n }\n else {\n RExC_rx->substrs->data[i].substr = NULL;\n RExC_rx->substrs->data[i].utf8_substr = NULL;\n longest_length[i] = 0;\n }\n }\n\n\tLEAVE_with_name(\"study_chunk\");\n\n\tif (RExC_rxi->regstclass\n\t && (OP(RExC_rxi->regstclass) == REG_ANY || OP(RExC_rxi->regstclass) == SANY))\n\t RExC_rxi->regstclass = NULL;\n\n\tif ((!(RExC_rx->substrs->data[0].substr || RExC_rx->substrs->data[0].utf8_substr)\n || RExC_rx->substrs->data[0].min_offset)\n\t && stclass_flag\n && ! (ANYOF_FLAGS(data.start_class) & SSC_MATCHES_EMPTY_STRING)\n\t && is_ssc_worth_it(pRExC_state, data.start_class))\n\t{\n\t const U32 n = add_data(pRExC_state, STR_WITH_LEN(\"f\"));\n\n ssc_finalize(pRExC_state, data.start_class);\n\n\t Newx(RExC_rxi->data->data[n], 1, regnode_ssc);\n\t StructCopy(data.start_class,\n\t\t (regnode_ssc*)RExC_rxi->data->data[n],\n\t\t regnode_ssc);\n\t RExC_rxi->regstclass = (regnode*)RExC_rxi->data->data[n];\n\t RExC_rx->intflags &= ~PREGf_SKIP;\t/* Used in find_byclass(). */\n\t DEBUG_COMPILE_r({ SV *sv = sv_newmortal();\n regprop(RExC_rx, sv, (regnode*)data.start_class, NULL, pRExC_state);\n Perl_re_printf( aTHX_\n\t\t\t\t \"synthetic stclass \\\"%s\\\".\\n\",\n\t\t\t\t SvPVX_const(sv));});\n data.start_class = NULL;\n\t}\n\n /* A temporary algorithm prefers floated substr to fixed one of\n * same length to dig more info. */\n\ti = (longest_length[0] <= longest_length[1]);\n RExC_rx->substrs->check_ix = i;\n RExC_rx->check_end_shift = RExC_rx->substrs->data[i].end_shift;\n RExC_rx->check_substr = RExC_rx->substrs->data[i].substr;\n RExC_rx->check_utf8 = RExC_rx->substrs->data[i].utf8_substr;\n RExC_rx->check_offset_min = RExC_rx->substrs->data[i].min_offset;\n RExC_rx->check_offset_max = RExC_rx->substrs->data[i].max_offset;\n if (!i && (RExC_rx->intflags & (PREGf_ANCH_SBOL|PREGf_ANCH_GPOS)))\n RExC_rx->intflags |= PREGf_NOSCAN;\n\n\tif ((RExC_rx->check_substr || RExC_rx->check_utf8) ) {\n\t RExC_rx->extflags |= RXf_USE_INTUIT;\n\t if (SvTAIL(RExC_rx->check_substr ? RExC_rx->check_substr : RExC_rx->check_utf8))\n\t\tRExC_rx->extflags |= RXf_INTUIT_TAIL;\n\t}\n\n\t/* XXX Unneeded? dmq (shouldn't as this is handled elsewhere)\n\tif ( (STRLEN)minlen < longest_length[1] )\n minlen= longest_length[1];\n if ( (STRLEN)minlen < longest_length[0] )\n minlen= longest_length[0];\n */\n }\n else {\n\t/* Several toplevels. Best we can is to set minlen. */\n\tSSize_t fake;\n\tregnode_ssc ch_class;\n\tSSize_t last_close = 0;\n\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"\\nMulti Top Level\\n\"));\n\n\tscan = RExC_rxi->program + 1;\n\tssc_init(pRExC_state, &ch_class);\n\tdata.start_class = &ch_class;\n\tdata.last_closep = &last_close;\n\n DEBUG_RExC_seen();\n /*\n * MAIN ENTRY FOR study_chunk() FOR m/P1|P2|.../\n * (patterns WITH top level branches)\n */\n\tminlen = study_chunk(pRExC_state,\n &scan, &minlen, &fake, scan + RExC_size, &data, -1, 0, NULL,\n SCF_DO_STCLASS_AND|SCF_WHILEM_VISITED_POS|(restudied\n ? SCF_TRIE_DOING_RESTUDY\n : 0),\n 0);\n\n CHECK_RESTUDY_GOTO_butfirst(NOOP);\n\n\tRExC_rx->check_substr = NULL;\n RExC_rx->check_utf8 = NULL;\n RExC_rx->substrs->data[0].substr = NULL;\n RExC_rx->substrs->data[0].utf8_substr = NULL;\n RExC_rx->substrs->data[1].substr = NULL;\n RExC_rx->substrs->data[1].utf8_substr = NULL;\n\n if (! (ANYOF_FLAGS(data.start_class) & SSC_MATCHES_EMPTY_STRING)\n\t && is_ssc_worth_it(pRExC_state, data.start_class))\n {\n\t const U32 n = add_data(pRExC_state, STR_WITH_LEN(\"f\"));\n\n ssc_finalize(pRExC_state, data.start_class);\n\n\t Newx(RExC_rxi->data->data[n], 1, regnode_ssc);\n\t StructCopy(data.start_class,\n\t\t (regnode_ssc*)RExC_rxi->data->data[n],\n\t\t regnode_ssc);\n\t RExC_rxi->regstclass = (regnode*)RExC_rxi->data->data[n];\n\t RExC_rx->intflags &= ~PREGf_SKIP;\t/* Used in find_byclass(). */\n\t DEBUG_COMPILE_r({ SV* sv = sv_newmortal();\n regprop(RExC_rx, sv, (regnode*)data.start_class, NULL, pRExC_state);\n Perl_re_printf( aTHX_\n\t\t\t\t \"synthetic stclass \\\"%s\\\".\\n\",\n\t\t\t\t SvPVX_const(sv));});\n data.start_class = NULL;\n\t}\n }\n\n if (RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN) {\n RExC_rx->extflags |= RXf_UNBOUNDED_QUANTIFIER_SEEN;\n RExC_rx->maxlen = REG_INFTY;\n }\n else {\n RExC_rx->maxlen = RExC_maxlen;\n }\n\n /* Guard against an embedded (?=) or (?<=) with a longer minlen than\n the \"real\" pattern. */\n DEBUG_OPTIMISE_r({\n Perl_re_printf( aTHX_ \"minlen: %\" IVdf \" RExC_rx->minlen:%\" IVdf \" maxlen:%\" IVdf \"\\n\",\n (IV)minlen, (IV)RExC_rx->minlen, (IV)RExC_maxlen);\n });\n RExC_rx->minlenret = minlen;\n if (RExC_rx->minlen < minlen)\n RExC_rx->minlen = minlen;\n\n if (RExC_seen & REG_RECURSE_SEEN ) {\n RExC_rx->intflags |= PREGf_RECURSE_SEEN;\n Newx(RExC_rx->recurse_locinput, RExC_rx->nparens + 1, char *);\n }\n if (RExC_seen & REG_GPOS_SEEN)\n RExC_rx->intflags |= PREGf_GPOS_SEEN;\n if (RExC_seen & REG_LOOKBEHIND_SEEN)\n RExC_rx->extflags |= RXf_NO_INPLACE_SUBST; /* inplace might break the\n lookbehind */\n if (pRExC_state->code_blocks)\n\tRExC_rx->extflags |= RXf_EVAL_SEEN;\n if (RExC_seen & REG_VERBARG_SEEN)\n {\n\tRExC_rx->intflags |= PREGf_VERBARG_SEEN;\n RExC_rx->extflags |= RXf_NO_INPLACE_SUBST; /* don't understand this! Yves */\n }\n if (RExC_seen & REG_CUTGROUP_SEEN)\n\tRExC_rx->intflags |= PREGf_CUTGROUP_SEEN;\n if (pm_flags & PMf_USE_RE_EVAL)\n\tRExC_rx->intflags |= PREGf_USE_RE_EVAL;\n if (RExC_paren_names)\n RXp_PAREN_NAMES(RExC_rx) = MUTABLE_HV(SvREFCNT_inc(RExC_paren_names));\n else\n RXp_PAREN_NAMES(RExC_rx) = NULL;\n\n /* If we have seen an anchor in our pattern then we set the extflag RXf_IS_ANCHORED\n * so it can be used in pp.c */\n if (RExC_rx->intflags & PREGf_ANCH)\n RExC_rx->extflags |= RXf_IS_ANCHORED;\n\n\n {\n /* this is used to identify \"special\" patterns that might result\n * in Perl NOT calling the regex engine and instead doing the match \"itself\",\n * particularly special cases in split//. By having the regex compiler\n * do this pattern matching at a regop level (instead of by inspecting the pattern)\n * we avoid weird issues with equivalent patterns resulting in different behavior,\n * AND we allow non Perl engines to get the same optimizations by the setting the\n * flags appropriately - Yves */\n regnode *first = RExC_rxi->program + 1;\n U8 fop = OP(first);\n regnode *next = regnext(first);\n U8 nop = OP(next);\n\n if (PL_regkind[fop] == NOTHING && nop == END)\n RExC_rx->extflags |= RXf_NULL;\n else if ((fop == MBOL || (fop == SBOL && !first->flags)) && nop == END)\n /* when fop is SBOL first->flags will be true only when it was\n * produced by parsing /\\A/, and not when parsing /^/. This is\n * very important for the split code as there we want to\n * treat /^/ as /^/m, but we do not want to treat /\\A/ as /^/m.\n * See rt #122761 for more details. -- Yves */\n RExC_rx->extflags |= RXf_START_ONLY;\n else if (fop == PLUS\n && PL_regkind[nop] == POSIXD && FLAGS(next) == _CC_SPACE\n && nop == END)\n RExC_rx->extflags |= RXf_WHITE;\n else if ( RExC_rx->extflags & RXf_SPLIT\n && (fop == EXACT || fop == EXACT_ONLY8 || fop == EXACTL)\n && STR_LEN(first) == 1\n && *(STRING(first)) == ' '\n && nop == END )\n RExC_rx->extflags |= (RXf_SKIPWHITE|RXf_WHITE);\n\n }\n\n if (RExC_contains_locale) {\n RXp_EXTFLAGS(RExC_rx) |= RXf_TAINTED;\n }\n\n#ifdef DEBUGGING\n if (RExC_paren_names) {\n RExC_rxi->name_list_idx = add_data( pRExC_state, STR_WITH_LEN(\"a\"));\n RExC_rxi->data->data[RExC_rxi->name_list_idx]\n = (void*)SvREFCNT_inc(RExC_paren_name_list);\n } else\n#endif\n RExC_rxi->name_list_idx = 0;\n\n while ( RExC_recurse_count > 0 ) {\n const regnode *scan = RExC_recurse[ --RExC_recurse_count ];\n /*\n * This data structure is set up in study_chunk() and is used\n * to calculate the distance between a GOSUB regopcode and\n * the OPEN/CURLYM (CURLYM's are special and can act like OPEN's)\n * it refers to.\n *\n * If for some reason someone writes code that optimises\n * away a GOSUB opcode then the assert should be changed to\n * an if(scan) to guard the ARG2L_SET() - Yves\n *\n */\n assert(scan && OP(scan) == GOSUB);\n ARG2L_SET( scan, RExC_open_parens[ARG(scan)] - REGNODE_OFFSET(scan));\n }\n\n Newxz(RExC_rx->offs, RExC_total_parens, regexp_paren_pair);\n /* assume we don't need to swap parens around before we match */\n DEBUG_TEST_r({\n Perl_re_printf( aTHX_ \"study_chunk_recursed_count: %lu\\n\",\n (unsigned long)RExC_study_chunk_recursed_count);\n });\n DEBUG_DUMP_r({\n DEBUG_RExC_seen();\n Perl_re_printf( aTHX_ \"Final program:\\n\");\n regdump(RExC_rx);\n });\n\n if (RExC_open_parens) {\n Safefree(RExC_open_parens);\n RExC_open_parens = NULL;\n }\n if (RExC_close_parens) {\n Safefree(RExC_close_parens);\n RExC_close_parens = NULL;\n }\n\n#ifdef USE_ITHREADS\n /* under ithreads the ?pat? PMf_USED flag on the pmop is simulated\n * by setting the regexp SV to readonly-only instead. If the\n * pattern's been recompiled, the USEDness should remain. */\n if (old_re && SvREADONLY(old_re))\n SvREADONLY_on(Rx);\n#endif\n return Rx;","lang":"c","vul_type":"cwe-190","target_token_count":10490,"sven_meta":{"func_name":"Perl_re_op_compile","file_name":"regcomp.c","commit_link":"github.com/perl/perl5/commit/3295b48defa0f8570114877b063fe546dd348b3c","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#21-eda854d3b1f5","input":"static int set_geometry(unsigned int cmd, struct floppy_struct *g,\n\t\t\t int drive, int type, struct block_device *bdev)\n{\n\tint cnt;\n\n\t/* sanity checking for parameters. */\n\tif (g->sect <= 0 ||\n\t g->head <= 0 ||\n\t /* check for zero in F_SECT_PER_TRACK */\n\t (unsigned char)((g->sect << 2) >> FD_SIZECODE(g)) == 0 ||\n\t g->track <= 0 || g->track > UDP->tracks >> STRETCH(g) ||\n\t /* check if reserved bits are set */\n\t (g->stretch & ~(FD_STRETCH | FD_SWAPSIDES | FD_SECTBASEMASK)) != 0)\n\t\treturn -EINVAL;\n\tif (type) {\n\t\tif (!capable(CAP_SYS_ADMIN))\n\t\t\treturn -EPERM;\n\t\tmutex_lock(&open_lock);\n\t\tif (lock_fdc(drive)) {\n\t\t\tmutex_unlock(&open_lock);\n\t\t\treturn -EINTR;\n\t\t}\n\t\tfloppy_type[type] = *g;\n\t\tfloppy_type[type].name = \"user format\";\n\t\tfor (cnt = type << 2; cnt < (type << 2) + 4; cnt++)\n\t\t\tfloppy_sizes[cnt] = floppy_sizes[cnt + 0x80] =\n\t\t\t floppy_type[type].size + 1;\n\t\tprocess_fd_request();\n\t\tfor (cnt = 0; cnt < N_DRIVE; cnt++) {\n\t\t\tstruct block_device *bdev = opened_bdev[cnt];\n\t\t\tif (!bdev || ITYPE(drive_state[cnt].fd_device) != type)\n\t\t\t\tcontinue;\n\t\t\t__invalidate_device(bdev, true);\n\t\t}\n\t\tmutex_unlock(&open_lock);\n\t} else {\n\t\tint oldStretch;\n\n\t\tif (lock_fdc(drive))\n\t\t\treturn -EINTR;\n\t\tif (cmd != FDDEFPRM) {\n\t\t\t/* notice a disk change immediately, else\n\t\t\t * we lose our settings immediately*/\n\t\t\tif (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)\n\t\t\t\treturn -EINTR;\n\t\t}\n\t\toldStretch = g->stretch;\n\t\tuser_params[drive] = *g;\n\t\tif (buffer_drive == drive)\n\t\t\tSUPBOUND(buffer_max, user_params[drive].sect);\n\t\tcurrent_type[drive] = &user_params[drive];\n\t\tfloppy_sizes[drive] = user_params[drive].size;\n\t\tif (cmd == FDDEFPRM)\n\t\t\tDRS->keep_data = -1;\n\t\telse\n\t\t\tDRS->keep_data = 1;\n\t\t/* invalidation. Invalidate only when needed, i.e.\n\t\t * when there are already sectors in the buffer cache\n\t\t * whose number will change. This is useful, because\n\t\t * mtools often changes the geometry of the disk after\n\t\t * looking at the boot block */\n\t\tif (DRS->maxblock > user_params[drive].sect ||\n\t\t DRS->maxtrack ||\n\t\t ((user_params[drive].sect ^ oldStretch) &\n\t\t (FD_SWAPSIDES | FD_SECTBASEMASK)))\n\t\t\tinvalidate_drive(bdev);\n\t\telse\n\t\t\tprocess_fd_request();\n\t}\n\treturn 0;\n}","target":"static int set_geometry(unsigned int cmd, struct floppy_struct *g,\n\t\t\t int drive, int type, struct block_device *bdev)\n{\n\tint cnt;\n\n\t/* sanity checking for parameters. */\n\tif ((int)g->sect <= 0 ||\n\t (int)g->head <= 0 ||\n\t /* check for overflow in max_sector */\n\t (int)(g->sect * g->head) <= 0 ||\n\t /* check for zero in F_SECT_PER_TRACK */\n\t (unsigned char)((g->sect << 2) >> FD_SIZECODE(g)) == 0 ||\n\t g->track <= 0 || g->track > UDP->tracks >> STRETCH(g) ||\n\t /* check if reserved bits are set */\n\t (g->stretch & ~(FD_STRETCH | FD_SWAPSIDES | FD_SECTBASEMASK)) != 0)\n\t\treturn -EINVAL;\n\tif (type) {\n\t\tif (!capable(CAP_SYS_ADMIN))\n\t\t\treturn -EPERM;\n\t\tmutex_lock(&open_lock);\n\t\tif (lock_fdc(drive)) {\n\t\t\tmutex_unlock(&open_lock);\n\t\t\treturn -EINTR;\n\t\t}\n\t\tfloppy_type[type] = *g;\n\t\tfloppy_type[type].name = \"user format\";\n\t\tfor (cnt = type << 2; cnt < (type << 2) + 4; cnt++)\n\t\t\tfloppy_sizes[cnt] = floppy_sizes[cnt + 0x80] =\n\t\t\t floppy_type[type].size + 1;\n\t\tprocess_fd_request();\n\t\tfor (cnt = 0; cnt < N_DRIVE; cnt++) {\n\t\t\tstruct block_device *bdev = opened_bdev[cnt];\n\t\t\tif (!bdev || ITYPE(drive_state[cnt].fd_device) != type)\n\t\t\t\tcontinue;\n\t\t\t__invalidate_device(bdev, true);\n\t\t}\n\t\tmutex_unlock(&open_lock);\n\t} else {\n\t\tint oldStretch;\n\n\t\tif (lock_fdc(drive))\n\t\t\treturn -EINTR;\n\t\tif (cmd != FDDEFPRM) {\n\t\t\t/* notice a disk change immediately, else\n\t\t\t * we lose our settings immediately*/\n\t\t\tif (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)\n\t\t\t\treturn -EINTR;\n\t\t}\n\t\toldStretch = g->stretch;\n\t\tuser_params[drive] = *g;\n\t\tif (buffer_drive == drive)\n\t\t\tSUPBOUND(buffer_max, user_params[drive].sect);\n\t\tcurrent_type[drive] = &user_params[drive];\n\t\tfloppy_sizes[drive] = user_params[drive].size;\n\t\tif (cmd == FDDEFPRM)\n\t\t\tDRS->keep_data = -1;\n\t\telse\n\t\t\tDRS->keep_data = 1;\n\t\t/* invalidation. Invalidate only when needed, i.e.\n\t\t * when there are already sectors in the buffer cache\n\t\t * whose number will change. This is useful, because\n\t\t * mtools often changes the geometry of the disk after\n\t\t * looking at the boot block */\n\t\tif (DRS->maxblock > user_params[drive].sect ||\n\t\t DRS->maxtrack ||\n\t\t ((user_params[drive].sect ^ oldStretch) &\n\t\t (FD_SWAPSIDES | FD_SECTBASEMASK)))\n\t\t\tinvalidate_drive(bdev);\n\t\telse\n\t\t\tprocess_fd_request();\n\t}\n\treturn 0;\n}","lang":"c","vul_type":"cwe-190","target_token_count":706,"sven_meta":{"func_name":"set_geometry","file_name":"drivers/block/floppy.c","commit_link":"github.com/torvalds/linux/commit/da99466ac243f15fbba65bd261bfc75ffa1532b6","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#25-af023b90e4d1","input":"int amqp_handle_input(amqp_connection_state_t state, amqp_bytes_t received_data,\n amqp_frame_t *decoded_frame) {\n size_t bytes_consumed;\n void *raw_frame;\n\n /* Returning frame_type of zero indicates either insufficient input,\n or a complete, ignored frame was read. */\n decoded_frame->frame_type = 0;\n\n if (received_data.len == 0) {\n return AMQP_STATUS_OK;\n }\n\n if (state->state == CONNECTION_STATE_IDLE) {\n state->state = CONNECTION_STATE_HEADER;\n }\n\n bytes_consumed = consume_data(state, &received_data);\n\n /* do we have target_size data yet? if not, return with the\n expectation that more will arrive */\n if (state->inbound_offset < state->target_size) {\n return (int)bytes_consumed;\n }\n\n raw_frame = state->inbound_buffer.bytes;\n\n switch (state->state) {\n case CONNECTION_STATE_INITIAL:\n /* check for a protocol header from the server */\n if (memcmp(raw_frame, \"AMQP\", 4) == 0) {\n decoded_frame->frame_type = AMQP_PSEUDOFRAME_PROTOCOL_HEADER;\n decoded_frame->channel = 0;\n\n decoded_frame->payload.protocol_header.transport_high =\n amqp_d8(amqp_offset(raw_frame, 4));\n decoded_frame->payload.protocol_header.transport_low =\n amqp_d8(amqp_offset(raw_frame, 5));\n decoded_frame->payload.protocol_header.protocol_version_major =\n amqp_d8(amqp_offset(raw_frame, 6));\n decoded_frame->payload.protocol_header.protocol_version_minor =\n amqp_d8(amqp_offset(raw_frame, 7));\n\n return_to_idle(state);\n return (int)bytes_consumed;\n }\n\n /* it's not a protocol header; fall through to process it as a\n regular frame header */\n\n case CONNECTION_STATE_HEADER: {\n amqp_channel_t channel;\n amqp_pool_t *channel_pool;\n /* frame length is 3 bytes in */\n channel = amqp_d16(amqp_offset(raw_frame, 1));\n\n state->target_size =\n amqp_d32(amqp_offset(raw_frame, 3)) + HEADER_SIZE + FOOTER_SIZE;\n\n if ((size_t)state->frame_max < state->target_size) {\n return AMQP_STATUS_BAD_AMQP_DATA;\n }\n\n channel_pool = amqp_get_or_create_channel_pool(state, channel);\n if (NULL == channel_pool) {\n return AMQP_STATUS_NO_MEMORY;\n }\n\n amqp_pool_alloc_bytes(channel_pool, state->target_size,\n &state->inbound_buffer);\n if (NULL == state->inbound_buffer.bytes) {\n return AMQP_STATUS_NO_MEMORY;\n }\n memcpy(state->inbound_buffer.bytes, state->header_buffer, HEADER_SIZE);\n raw_frame = state->inbound_buffer.bytes;\n\n state->state = CONNECTION_STATE_BODY;\n\n bytes_consumed += consume_data(state, &received_data);\n\n /* do we have target_size data yet? if not, return with the\n expectation that more will arrive */\n if (state->inbound_offset < state->target_size) {\n return (int)bytes_consumed;\n }\n }\n /* fall through to process body */\n\n case CONNECTION_STATE_BODY: {\n amqp_bytes_t encoded;\n int res;\n amqp_pool_t *channel_pool;\n\n /* Check frame end marker (footer) */\n if (amqp_d8(amqp_offset(raw_frame, state->target_size - 1)) !=\n AMQP_FRAME_END) {\n return AMQP_STATUS_BAD_AMQP_DATA;\n }\n\n decoded_frame->frame_type = amqp_d8(amqp_offset(raw_frame, 0));\n decoded_frame->channel = amqp_d16(amqp_offset(raw_frame, 1));\n\n channel_pool =\n amqp_get_or_create_channel_pool(state, decoded_frame->channel);\n if (NULL == channel_pool) {\n return AMQP_STATUS_NO_MEMORY;\n }\n\n switch (decoded_frame->frame_type) {\n case AMQP_FRAME_METHOD:\n decoded_frame->payload.method.id =\n amqp_d32(amqp_offset(raw_frame, HEADER_SIZE));\n encoded.bytes = amqp_offset(raw_frame, HEADER_SIZE + 4);\n encoded.len = state->target_size - HEADER_SIZE - 4 - FOOTER_SIZE;\n\n res = amqp_decode_method(decoded_frame->payload.method.id,\n channel_pool, encoded,\n &decoded_frame->payload.method.decoded);\n if (res < 0) {\n return res;\n }\n\n break;\n\n case AMQP_FRAME_HEADER:\n decoded_frame->payload.properties.class_id =\n amqp_d16(amqp_offset(raw_frame, HEADER_SIZE));\n /* unused 2-byte weight field goes here */\n decoded_frame->payload.properties.body_size =\n amqp_d64(amqp_offset(raw_frame, HEADER_SIZE + 4));\n encoded.bytes = amqp_offset(raw_frame, HEADER_SIZE + 12);\n encoded.len = state->target_size - HEADER_SIZE - 12 - FOOTER_SIZE;\n decoded_frame->payload.properties.raw = encoded;\n\n res = amqp_decode_properties(\n decoded_frame->payload.properties.class_id, channel_pool, encoded,\n &decoded_frame->payload.properties.decoded);\n if (res < 0) {\n return res;\n }\n\n break;\n\n case AMQP_FRAME_BODY:\n decoded_frame->payload.body_fragment.len =\n state->target_size - HEADER_SIZE - FOOTER_SIZE;\n decoded_frame->payload.body_fragment.bytes =\n amqp_offset(raw_frame, HEADER_SIZE);\n break;\n\n case AMQP_FRAME_HEARTBEAT:\n break;\n\n default:\n /* Ignore the frame */\n decoded_frame->frame_type = 0;\n break;\n }\n\n return_to_idle(state);\n return (int)bytes_consumed;\n }\n\n default:\n amqp_abort(\"Internal error: invalid amqp_connection_state_t->state %d\",\n state->state);\n }\n}","target":"int amqp_handle_input(amqp_connection_state_t state, amqp_bytes_t received_data,\n amqp_frame_t *decoded_frame) {\n size_t bytes_consumed;\n void *raw_frame;\n\n /* Returning frame_type of zero indicates either insufficient input,\n or a complete, ignored frame was read. */\n decoded_frame->frame_type = 0;\n\n if (received_data.len == 0) {\n return AMQP_STATUS_OK;\n }\n\n if (state->state == CONNECTION_STATE_IDLE) {\n state->state = CONNECTION_STATE_HEADER;\n }\n\n bytes_consumed = consume_data(state, &received_data);\n\n /* do we have target_size data yet? if not, return with the\n expectation that more will arrive */\n if (state->inbound_offset < state->target_size) {\n return (int)bytes_consumed;\n }\n\n raw_frame = state->inbound_buffer.bytes;\n\n switch (state->state) {\n case CONNECTION_STATE_INITIAL:\n /* check for a protocol header from the server */\n if (memcmp(raw_frame, \"AMQP\", 4) == 0) {\n decoded_frame->frame_type = AMQP_PSEUDOFRAME_PROTOCOL_HEADER;\n decoded_frame->channel = 0;\n\n decoded_frame->payload.protocol_header.transport_high =\n amqp_d8(amqp_offset(raw_frame, 4));\n decoded_frame->payload.protocol_header.transport_low =\n amqp_d8(amqp_offset(raw_frame, 5));\n decoded_frame->payload.protocol_header.protocol_version_major =\n amqp_d8(amqp_offset(raw_frame, 6));\n decoded_frame->payload.protocol_header.protocol_version_minor =\n amqp_d8(amqp_offset(raw_frame, 7));\n\n return_to_idle(state);\n return (int)bytes_consumed;\n }\n\n /* it's not a protocol header; fall through to process it as a\n regular frame header */\n\n case CONNECTION_STATE_HEADER: {\n amqp_channel_t channel;\n amqp_pool_t *channel_pool;\n uint32_t frame_size;\n\n channel = amqp_d16(amqp_offset(raw_frame, 1));\n\n /* frame length is 3 bytes in */\n frame_size = amqp_d32(amqp_offset(raw_frame, 3));\n /* To prevent the target_size calculation below from overflowing, check\n * that the stated frame_size is smaller than a signed 32-bit. Given\n * the library only allows configuring frame_max as an int32_t, and\n * frame_size is uint32_t, the math below is safe from overflow. */\n if (frame_size >= INT32_MAX) {\n return AMQP_STATUS_BAD_AMQP_DATA;\n }\n\n state->target_size = frame_size + HEADER_SIZE + FOOTER_SIZE;\n if ((size_t)state->frame_max < state->target_size) {\n return AMQP_STATUS_BAD_AMQP_DATA;\n }\n\n channel_pool = amqp_get_or_create_channel_pool(state, channel);\n if (NULL == channel_pool) {\n return AMQP_STATUS_NO_MEMORY;\n }\n\n amqp_pool_alloc_bytes(channel_pool, state->target_size,\n &state->inbound_buffer);\n if (NULL == state->inbound_buffer.bytes) {\n return AMQP_STATUS_NO_MEMORY;\n }\n memcpy(state->inbound_buffer.bytes, state->header_buffer, HEADER_SIZE);\n raw_frame = state->inbound_buffer.bytes;\n\n state->state = CONNECTION_STATE_BODY;\n\n bytes_consumed += consume_data(state, &received_data);\n\n /* do we have target_size data yet? if not, return with the\n expectation that more will arrive */\n if (state->inbound_offset < state->target_size) {\n return (int)bytes_consumed;\n }\n }\n /* fall through to process body */\n\n case CONNECTION_STATE_BODY: {\n amqp_bytes_t encoded;\n int res;\n amqp_pool_t *channel_pool;\n\n /* Check frame end marker (footer) */\n if (amqp_d8(amqp_offset(raw_frame, state->target_size - 1)) !=\n AMQP_FRAME_END) {\n return AMQP_STATUS_BAD_AMQP_DATA;\n }\n\n decoded_frame->frame_type = amqp_d8(amqp_offset(raw_frame, 0));\n decoded_frame->channel = amqp_d16(amqp_offset(raw_frame, 1));\n\n channel_pool =\n amqp_get_or_create_channel_pool(state, decoded_frame->channel);\n if (NULL == channel_pool) {\n return AMQP_STATUS_NO_MEMORY;\n }\n\n switch (decoded_frame->frame_type) {\n case AMQP_FRAME_METHOD:\n decoded_frame->payload.method.id =\n amqp_d32(amqp_offset(raw_frame, HEADER_SIZE));\n encoded.bytes = amqp_offset(raw_frame, HEADER_SIZE + 4);\n encoded.len = state->target_size - HEADER_SIZE - 4 - FOOTER_SIZE;\n\n res = amqp_decode_method(decoded_frame->payload.method.id,\n channel_pool, encoded,\n &decoded_frame->payload.method.decoded);\n if (res < 0) {\n return res;\n }\n\n break;\n\n case AMQP_FRAME_HEADER:\n decoded_frame->payload.properties.class_id =\n amqp_d16(amqp_offset(raw_frame, HEADER_SIZE));\n /* unused 2-byte weight field goes here */\n decoded_frame->payload.properties.body_size =\n amqp_d64(amqp_offset(raw_frame, HEADER_SIZE + 4));\n encoded.bytes = amqp_offset(raw_frame, HEADER_SIZE + 12);\n encoded.len = state->target_size - HEADER_SIZE - 12 - FOOTER_SIZE;\n decoded_frame->payload.properties.raw = encoded;\n\n res = amqp_decode_properties(\n decoded_frame->payload.properties.class_id, channel_pool, encoded,\n &decoded_frame->payload.properties.decoded);\n if (res < 0) {\n return res;\n }\n\n break;\n\n case AMQP_FRAME_BODY:\n decoded_frame->payload.body_fragment.len =\n state->target_size - HEADER_SIZE - FOOTER_SIZE;\n decoded_frame->payload.body_fragment.bytes =\n amqp_offset(raw_frame, HEADER_SIZE);\n break;\n\n case AMQP_FRAME_HEARTBEAT:\n break;\n\n default:\n /* Ignore the frame */\n decoded_frame->frame_type = 0;\n break;\n }\n\n return_to_idle(state);\n return (int)bytes_consumed;\n }\n\n default:\n amqp_abort(\"Internal error: invalid amqp_connection_state_t->state %d\",\n state->state);\n }\n}","lang":"c","vul_type":"cwe-190","target_token_count":1382,"sven_meta":{"func_name":"amqp_handle_input","file_name":"librabbitmq/amqp_connection.c","commit_link":"github.com/alanxz/rabbitmq-c/commit/fc85be7123050b91b054e45b91c78d3241a5047a","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#26-ae952943b38a","input":"choose_volume(struct archive_read *a, struct iso9660 *iso9660)\n{\n\tstruct file_info *file;\n\tint64_t skipsize;\n\tstruct vd *vd;\n\tconst void *block;\n\tchar seenJoliet;\n\n\tvd = &(iso9660->primary);\n\tif (!iso9660->opt_support_joliet)\n\t\tiso9660->seenJoliet = 0;\n\tif (iso9660->seenJoliet &&\n\t\tvd->location > iso9660->joliet.location)\n\t\t/* This condition is unlikely; by way of caution. */\n\t\tvd = &(iso9660->joliet);\n\n\tskipsize = LOGICAL_BLOCK_SIZE * vd->location;\n\tskipsize = __archive_read_consume(a, skipsize);\n\tif (skipsize < 0)\n\t\treturn ((int)skipsize);\n\tiso9660->current_position = skipsize;\n\n\tblock = __archive_read_ahead(a, vd->size, NULL);\n\tif (block == NULL) {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Failed to read full block when scanning \"\n\t\t \"ISO9660 directory list\");\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\n\t/*\n\t * While reading Root Directory, flag seenJoliet must be zero to\n\t * avoid converting special name 0x00(Current Directory) and\n\t * next byte to UCS2.\n\t */\n\tseenJoliet = iso9660->seenJoliet;/* Save flag. */\n\tiso9660->seenJoliet = 0;\n\tfile = parse_file_info(a, NULL, block);\n\tif (file == NULL)\n\t\treturn (ARCHIVE_FATAL);\n\tiso9660->seenJoliet = seenJoliet;\n\n\t/*\n\t * If the iso image has both RockRidge and Joliet, we preferentially\n\t * use RockRidge Extensions rather than Joliet ones.\n\t */\n\tif (vd == &(iso9660->primary) && iso9660->seenRockridge\n\t && iso9660->seenJoliet)\n\t\tiso9660->seenJoliet = 0;\n\n\tif (vd == &(iso9660->primary) && !iso9660->seenRockridge\n\t && iso9660->seenJoliet) {\n\t\t/* Switch reading data from primary to joliet. */\n\t\tvd = &(iso9660->joliet);\n\t\tskipsize = LOGICAL_BLOCK_SIZE * vd->location;\n\t\tskipsize -= iso9660->current_position;\n\t\tskipsize = __archive_read_consume(a, skipsize);\n\t\tif (skipsize < 0)\n\t\t\treturn ((int)skipsize);\n\t\tiso9660->current_position += skipsize;\n\n\t\tblock = __archive_read_ahead(a, vd->size, NULL);\n\t\tif (block == NULL) {\n\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t\t \"Failed to read full block when scanning \"\n\t\t\t \"ISO9660 directory list\");\n\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tiso9660->seenJoliet = 0;\n\t\tfile = parse_file_info(a, NULL, block);\n\t\tif (file == NULL)\n\t\t\treturn (ARCHIVE_FATAL);\n\t\tiso9660->seenJoliet = seenJoliet;\n\t}\n\n\t/* Store the root directory in the pending list. */\n\tif (add_entry(a, iso9660, file) != ARCHIVE_OK)\n\t\treturn (ARCHIVE_FATAL);\n\tif (iso9660->seenRockridge) {\n\t\ta->archive.archive_format = ARCHIVE_FORMAT_ISO9660_ROCKRIDGE;\n\t\ta->archive.archive_format_name =\n\t\t \"ISO9660 with Rockridge extensions\";\n\t}\n\n\treturn (ARCHIVE_OK);\n}","target":"choose_volume(struct archive_read *a, struct iso9660 *iso9660)\n{\n\tstruct file_info *file;\n\tint64_t skipsize;\n\tstruct vd *vd;\n\tconst void *block;\n\tchar seenJoliet;\n\n\tvd = &(iso9660->primary);\n\tif (!iso9660->opt_support_joliet)\n\t\tiso9660->seenJoliet = 0;\n\tif (iso9660->seenJoliet &&\n\t\tvd->location > iso9660->joliet.location)\n\t\t/* This condition is unlikely; by way of caution. */\n\t\tvd = &(iso9660->joliet);\n\n\tskipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location;\n\tskipsize = __archive_read_consume(a, skipsize);\n\tif (skipsize < 0)\n\t\treturn ((int)skipsize);\n\tiso9660->current_position = skipsize;\n\n\tblock = __archive_read_ahead(a, vd->size, NULL);\n\tif (block == NULL) {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Failed to read full block when scanning \"\n\t\t \"ISO9660 directory list\");\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\n\t/*\n\t * While reading Root Directory, flag seenJoliet must be zero to\n\t * avoid converting special name 0x00(Current Directory) and\n\t * next byte to UCS2.\n\t */\n\tseenJoliet = iso9660->seenJoliet;/* Save flag. */\n\tiso9660->seenJoliet = 0;\n\tfile = parse_file_info(a, NULL, block);\n\tif (file == NULL)\n\t\treturn (ARCHIVE_FATAL);\n\tiso9660->seenJoliet = seenJoliet;\n\n\t/*\n\t * If the iso image has both RockRidge and Joliet, we preferentially\n\t * use RockRidge Extensions rather than Joliet ones.\n\t */\n\tif (vd == &(iso9660->primary) && iso9660->seenRockridge\n\t && iso9660->seenJoliet)\n\t\tiso9660->seenJoliet = 0;\n\n\tif (vd == &(iso9660->primary) && !iso9660->seenRockridge\n\t && iso9660->seenJoliet) {\n\t\t/* Switch reading data from primary to joliet. */\n\t\tvd = &(iso9660->joliet);\n\t\tskipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location;\n\t\tskipsize -= iso9660->current_position;\n\t\tskipsize = __archive_read_consume(a, skipsize);\n\t\tif (skipsize < 0)\n\t\t\treturn ((int)skipsize);\n\t\tiso9660->current_position += skipsize;\n\n\t\tblock = __archive_read_ahead(a, vd->size, NULL);\n\t\tif (block == NULL) {\n\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t\t \"Failed to read full block when scanning \"\n\t\t\t \"ISO9660 directory list\");\n\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tiso9660->seenJoliet = 0;\n\t\tfile = parse_file_info(a, NULL, block);\n\t\tif (file == NULL)\n\t\t\treturn (ARCHIVE_FATAL);\n\t\tiso9660->seenJoliet = seenJoliet;\n\t}\n\n\t/* Store the root directory in the pending list. */\n\tif (add_entry(a, iso9660, file) != ARCHIVE_OK)\n\t\treturn (ARCHIVE_FATAL);\n\tif (iso9660->seenRockridge) {\n\t\ta->archive.archive_format = ARCHIVE_FORMAT_ISO9660_ROCKRIDGE;\n\t\ta->archive.archive_format_name =\n\t\t \"ISO9660 with Rockridge extensions\";\n\t}\n\n\treturn (ARCHIVE_OK);\n}","lang":"c","vul_type":"cwe-190","target_token_count":874,"sven_meta":{"func_name":"choose_volume","file_name":"libarchive/archive_read_support_format_iso9660.c","commit_link":"github.com/libarchive/libarchive/commit/3ad08e01b4d253c66ae56414886089684155af22","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#28-47d3aafa3fe0","input":"hfs_cat_traverse(HFS_INFO * hfs,\n TSK_HFS_BTREE_CB a_cb, void *ptr)\n{\n TSK_FS_INFO *fs = &(hfs->fs_info);\n uint32_t cur_node; /* node id of the current node */\n char *node;\n\n uint16_t nodesize;\n uint8_t is_done = 0;\n\n tsk_error_reset();\n\n nodesize = tsk_getu16(fs->endian, hfs->catalog_header.nodesize);\n if ((node = (char *) tsk_malloc(nodesize)) == NULL)\n return 1;\n\n /* start at root node */\n cur_node = tsk_getu32(fs->endian, hfs->catalog_header.rootNode);\n\n /* if the root node is zero, then the extents btree is empty */\n /* if no files have overflow extents, the Extents B-tree still\n exists on disk, but is an empty B-tree containing only\n the header node */\n if (cur_node == 0) {\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: \"\n \"empty extents btree\\n\");\n free(node);\n return 1;\n }\n\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: starting at \"\n \"root node %\" PRIu32 \"; nodesize = %\"\n PRIu16 \"\\n\", cur_node, nodesize);\n\n /* Recurse down to the needed leaf nodes and then go forward */\n is_done = 0;\n while (is_done == 0) {\n TSK_OFF_T cur_off; /* start address of cur_node */\n uint16_t num_rec; /* number of records in this node */\n ssize_t cnt;\n hfs_btree_node *node_desc;\n\n // sanity check\n if (cur_node > tsk_getu32(fs->endian,\n hfs->catalog_header.totalNodes)) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: Node %d too large for file\", cur_node);\n free(node);\n return 1;\n }\n\n // read the current node\n cur_off = cur_node * nodesize;\n cnt = tsk_fs_attr_read(hfs->catalog_attr, cur_off,\n node, nodesize, 0);\n if (cnt != nodesize) {\n if (cnt >= 0) {\n tsk_error_reset();\n tsk_error_set_errno(TSK_ERR_FS_READ);\n }\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Error reading node %d at offset %\"\n PRIuOFF, cur_node, cur_off);\n free(node);\n return 1;\n }\n\n // process the header / descriptor\n if (nodesize < sizeof(hfs_btree_node)) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: Node size %d is too small to be valid\", nodesize);\n free(node);\n return 1;\n }\n node_desc = (hfs_btree_node *) node;\n num_rec = tsk_getu16(fs->endian, node_desc->num_rec);\n\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: node %\" PRIu32\n \" @ %\" PRIu64 \" has %\" PRIu16 \" records\\n\",\n cur_node, cur_off, num_rec);\n\n if (num_rec == 0) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr(\"hfs_cat_traverse: zero records in node %\"\n PRIu32, cur_node);\n free(node);\n return 1;\n }\n\n /* With an index node, find the record with the largest key that is smaller\n * to or equal to cnid */\n if (node_desc->type == HFS_BT_NODE_TYPE_IDX) {\n uint32_t next_node = 0;\n int rec;\n\n for (rec = 0; rec < num_rec; ++rec) {\n size_t rec_off;\n hfs_btree_key_cat *key;\n uint8_t retval;\n uint16_t keylen;\n\n // get the record offset in the node\n rec_off =\n tsk_getu16(fs->endian,\n &node[nodesize - (rec + 1) * 2]);\n if (rec_off > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, (int) rec_off,\n nodesize);\n free(node);\n return 1;\n }\n\n key = (hfs_btree_key_cat *) & node[rec_off];\n\n keylen = 2 + tsk_getu16(hfs->fs_info.endian, key->key_len);\n if ((keylen) > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: length of key %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, keylen, nodesize);\n free(node);\n return 1;\n }\n\n\n /*\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: record %\" PRIu16\n \" ; keylen %\" PRIu16 \" (%\" PRIu32 \")\\n\", rec,\n tsk_getu16(fs->endian, key->key_len),\n tsk_getu32(fs->endian, key->parent_cnid));\n */\n\n\n /* save the info from this record unless it is too big */\n retval =\n a_cb(hfs, HFS_BT_NODE_TYPE_IDX, key,\n cur_off + rec_off, ptr);\n if (retval == HFS_BTREE_CB_ERR) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Callback returned error\");\n free(node);\n return 1;\n }\n // record the closest entry\n else if ((retval == HFS_BTREE_CB_IDX_LT)\n || (next_node == 0)) {\n hfs_btree_index_record *idx_rec;\n int keylen =\n 2 + hfs_get_idxkeylen(hfs, tsk_getu16(fs->endian,\n key->key_len), &(hfs->catalog_header));\n if (rec_off + keylen > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record and keylength %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node,\n (int) rec_off + keylen, nodesize);\n free(node);\n return 1;\n }\n idx_rec =\n (hfs_btree_index_record *) & node[rec_off +\n keylen];\n next_node = tsk_getu32(fs->endian, idx_rec->childNode);\n }\n if (retval == HFS_BTREE_CB_IDX_EQGT) {\n // move down to the next node\n break;\n }\n }\n // check if we found a relevant node\n if (next_node == 0) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: did not find any keys in index node %d\",\n cur_node);\n is_done = 1;\n break;\n }\n // TODO: Handle multinode loops\n if (next_node == cur_node) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: node %d references itself as next node\",\n cur_node);\n is_done = 1;\n break;\n }\n cur_node = next_node;\n }\n\n /* With a leaf, we look for the specific record. */\n else if (node_desc->type == HFS_BT_NODE_TYPE_LEAF) {\n int rec;\n\n for (rec = 0; rec < num_rec; ++rec) {\n size_t rec_off;\n hfs_btree_key_cat *key;\n uint8_t retval;\n uint16_t keylen;\n\n // get the record offset in the node\n rec_off =\n tsk_getu16(fs->endian,\n &node[nodesize - (rec + 1) * 2]);\n if (rec_off > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record %d in leaf node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, (int) rec_off,\n nodesize);\n free(node);\n return 1;\n }\n key = (hfs_btree_key_cat *) & node[rec_off];\n\n keylen = 2 + tsk_getu16(hfs->fs_info.endian, key->key_len);\n if ((keylen) > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: length of key %d in leaf node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, keylen, nodesize);\n free(node);\n return 1;\n }\n\n /*\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: record %\" PRIu16\n \"; keylen %\" PRIu16 \" (%\" PRIu32 \")\\n\", rec,\n tsk_getu16(fs->endian, key->key_len),\n tsk_getu32(fs->endian, key->parent_cnid));\n */\n // rec_cnid = tsk_getu32(fs->endian, key->file_id);\n\n retval =\n a_cb(hfs, HFS_BT_NODE_TYPE_LEAF, key,\n cur_off + rec_off, ptr);\n if (retval == HFS_BTREE_CB_LEAF_STOP) {\n is_done = 1;\n break;\n }\n else if (retval == HFS_BTREE_CB_ERR) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Callback returned error\");\n free(node);\n return 1;\n }\n }\n\n // move right to the next node if we got this far\n if (is_done == 0) {\n cur_node = tsk_getu32(fs->endian, node_desc->flink);\n if (cur_node == 0) {\n is_done = 1;\n }\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: moving forward to next leaf\");\n }\n }\n else {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr(\"hfs_cat_traverse: btree node %\" PRIu32\n \" (%\" PRIu64 \") is neither index nor leaf (%\" PRIu8 \")\",\n cur_node, cur_off, node_desc->type);\n free(node);\n return 1;\n }\n }\n free(node);\n return 0;\n}","target":"hfs_cat_traverse(HFS_INFO * hfs,\n TSK_HFS_BTREE_CB a_cb, void *ptr)\n{\n TSK_FS_INFO *fs = &(hfs->fs_info);\n uint32_t cur_node; /* node id of the current node */\n char *node;\n\n uint16_t nodesize;\n uint8_t is_done = 0;\n\n tsk_error_reset();\n\n nodesize = tsk_getu16(fs->endian, hfs->catalog_header.nodesize);\n if ((node = (char *) tsk_malloc(nodesize)) == NULL)\n return 1;\n\n /* start at root node */\n cur_node = tsk_getu32(fs->endian, hfs->catalog_header.rootNode);\n\n /* if the root node is zero, then the extents btree is empty */\n /* if no files have overflow extents, the Extents B-tree still\n exists on disk, but is an empty B-tree containing only\n the header node */\n if (cur_node == 0) {\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: \"\n \"empty extents btree\\n\");\n free(node);\n return 1;\n }\n\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: starting at \"\n \"root node %\" PRIu32 \"; nodesize = %\"\n PRIu16 \"\\n\", cur_node, nodesize);\n\n /* Recurse down to the needed leaf nodes and then go forward */\n is_done = 0;\n while (is_done == 0) {\n TSK_OFF_T cur_off; /* start address of cur_node */\n uint16_t num_rec; /* number of records in this node */\n ssize_t cnt;\n hfs_btree_node *node_desc;\n\n // sanity check\n if (cur_node > tsk_getu32(fs->endian,\n hfs->catalog_header.totalNodes)) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: Node %d too large for file\", cur_node);\n free(node);\n return 1;\n }\n\n // read the current node\n cur_off = cur_node * nodesize;\n cnt = tsk_fs_attr_read(hfs->catalog_attr, cur_off,\n node, nodesize, 0);\n if (cnt != nodesize) {\n if (cnt >= 0) {\n tsk_error_reset();\n tsk_error_set_errno(TSK_ERR_FS_READ);\n }\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Error reading node %d at offset %\"\n PRIuOFF, cur_node, cur_off);\n free(node);\n return 1;\n }\n\n // process the header / descriptor\n if (nodesize < sizeof(hfs_btree_node)) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: Node size %d is too small to be valid\", nodesize);\n free(node);\n return 1;\n }\n node_desc = (hfs_btree_node *) node;\n num_rec = tsk_getu16(fs->endian, node_desc->num_rec);\n\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: node %\" PRIu32\n \" @ %\" PRIu64 \" has %\" PRIu16 \" records\\n\",\n cur_node, cur_off, num_rec);\n\n if (num_rec == 0) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr(\"hfs_cat_traverse: zero records in node %\"\n PRIu32, cur_node);\n free(node);\n return 1;\n }\n\n /* With an index node, find the record with the largest key that is smaller\n * to or equal to cnid */\n if (node_desc->type == HFS_BT_NODE_TYPE_IDX) {\n uint32_t next_node = 0;\n int rec;\n\n for (rec = 0; rec < num_rec; ++rec) {\n size_t rec_off;\n hfs_btree_key_cat *key;\n uint8_t retval;\n int keylen;\n\n // get the record offset in the node\n rec_off =\n tsk_getu16(fs->endian,\n &node[nodesize - (rec + 1) * 2]);\n if (rec_off > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, (int) rec_off,\n nodesize);\n free(node);\n return 1;\n }\n\n key = (hfs_btree_key_cat *) & node[rec_off];\n\n keylen = 2 + tsk_getu16(hfs->fs_info.endian, key->key_len);\n if ((keylen) > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: length of key %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, keylen, nodesize);\n free(node);\n return 1;\n }\n\n\n /*\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: record %\" PRIu16\n \" ; keylen %\" PRIu16 \" (%\" PRIu32 \")\\n\", rec,\n tsk_getu16(fs->endian, key->key_len),\n tsk_getu32(fs->endian, key->parent_cnid));\n */\n\n\n /* save the info from this record unless it is too big */\n retval =\n a_cb(hfs, HFS_BT_NODE_TYPE_IDX, key,\n cur_off + rec_off, ptr);\n if (retval == HFS_BTREE_CB_ERR) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Callback returned error\");\n free(node);\n return 1;\n }\n // record the closest entry\n else if ((retval == HFS_BTREE_CB_IDX_LT)\n || (next_node == 0)) {\n hfs_btree_index_record *idx_rec;\n int keylen =\n 2 + hfs_get_idxkeylen(hfs, tsk_getu16(fs->endian,\n key->key_len), &(hfs->catalog_header));\n if (rec_off + keylen > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record and keylength %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node,\n (int) rec_off + keylen, nodesize);\n free(node);\n return 1;\n }\n idx_rec =\n (hfs_btree_index_record *) & node[rec_off +\n keylen];\n next_node = tsk_getu32(fs->endian, idx_rec->childNode);\n }\n if (retval == HFS_BTREE_CB_IDX_EQGT) {\n // move down to the next node\n break;\n }\n }\n // check if we found a relevant node\n if (next_node == 0) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: did not find any keys in index node %d\",\n cur_node);\n is_done = 1;\n break;\n }\n // TODO: Handle multinode loops\n if (next_node == cur_node) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: node %d references itself as next node\",\n cur_node);\n is_done = 1;\n break;\n }\n cur_node = next_node;\n }\n\n /* With a leaf, we look for the specific record. */\n else if (node_desc->type == HFS_BT_NODE_TYPE_LEAF) {\n int rec;\n\n for (rec = 0; rec < num_rec; ++rec) {\n size_t rec_off;\n hfs_btree_key_cat *key;\n uint8_t retval;\n int keylen;\n\n // get the record offset in the node\n rec_off =\n tsk_getu16(fs->endian,\n &node[nodesize - (rec + 1) * 2]);\n if (rec_off > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record %d in leaf node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, (int) rec_off,\n nodesize);\n free(node);\n return 1;\n }\n key = (hfs_btree_key_cat *) & node[rec_off];\n\n keylen = 2 + tsk_getu16(hfs->fs_info.endian, key->key_len);\n if ((keylen) > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: length of key %d in leaf node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, keylen, nodesize);\n free(node);\n return 1;\n }\n\n /*\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: record %\" PRIu16\n \"; keylen %\" PRIu16 \" (%\" PRIu32 \")\\n\", rec,\n tsk_getu16(fs->endian, key->key_len),\n tsk_getu32(fs->endian, key->parent_cnid));\n */\n // rec_cnid = tsk_getu32(fs->endian, key->file_id);\n\n retval =\n a_cb(hfs, HFS_BT_NODE_TYPE_LEAF, key,\n cur_off + rec_off, ptr);\n if (retval == HFS_BTREE_CB_LEAF_STOP) {\n is_done = 1;\n break;\n }\n else if (retval == HFS_BTREE_CB_ERR) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Callback returned error\");\n free(node);\n return 1;\n }\n }\n\n // move right to the next node if we got this far\n if (is_done == 0) {\n cur_node = tsk_getu32(fs->endian, node_desc->flink);\n if (cur_node == 0) {\n is_done = 1;\n }\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: moving forward to next leaf\");\n }\n }\n else {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr(\"hfs_cat_traverse: btree node %\" PRIu32\n \" (%\" PRIu64 \") is neither index nor leaf (%\" PRIu8 \")\",\n cur_node, cur_off, node_desc->type);\n free(node);\n return 1;\n }\n }\n free(node);\n return 0;\n}","lang":"c","vul_type":"cwe-190","target_token_count":2573,"sven_meta":{"func_name":"hfs_cat_traverse","file_name":"tsk/fs/hfs.c","commit_link":"github.com/sleuthkit/sleuthkit/commit/114cd3d0aac8bd1aeaf4b33840feb0163d342d5b","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#29-39add5cb3df0","input":"PyImaging_MapBuffer(PyObject* self, PyObject* args)\n{\n Py_ssize_t y, size;\n Imaging im;\n\n PyObject* target;\n Py_buffer view;\n char* mode;\n char* codec;\n PyObject* bbox;\n Py_ssize_t offset;\n int xsize, ysize;\n int stride;\n int ystep;\n\n if (!PyArg_ParseTuple(args, \"O(ii)sOn(sii)\", &target, &xsize, &ysize,\n &codec, &bbox, &offset, &mode, &stride, &ystep))\n return NULL;\n\n if (!PyImaging_CheckBuffer(target)) {\n PyErr_SetString(PyExc_TypeError, \"expected string or buffer\");\n return NULL;\n }\n\n if (stride <= 0) {\n if (!strcmp(mode, \"L\") || !strcmp(mode, \"P\"))\n stride = xsize;\n else if (!strncmp(mode, \"I;16\", 4))\n stride = xsize * 2;\n else\n stride = xsize * 4;\n }\n\n size = (Py_ssize_t) ysize * stride;\n\n /* check buffer size */\n if (PyImaging_GetBuffer(target, &view) < 0)\n return NULL;\n\n if (view.len < 0) {\n PyErr_SetString(PyExc_ValueError, \"buffer has negative size\");\n return NULL;\n }\n if (offset + size > view.len) {\n PyErr_SetString(PyExc_ValueError, \"buffer is not large enough\");\n return NULL;\n }\n\n im = ImagingNewPrologueSubtype(\n mode, xsize, ysize, sizeof(ImagingBufferInstance)\n );\n if (!im)\n return NULL;\n\n /* setup file pointers */\n if (ystep > 0)\n for (y = 0; y < ysize; y++)\n im->image[y] = (char*)view.buf + offset + y * stride;\n else\n for (y = 0; y < ysize; y++)\n im->image[ysize-y-1] = (char*)view.buf + offset + y * stride;\n\n im->destroy = mapping_destroy_buffer;\n\n Py_INCREF(target);\n ((ImagingBufferInstance*) im)->target = target;\n ((ImagingBufferInstance*) im)->view = view;\n\n if (!ImagingNewEpilogue(im))\n return NULL;\n\n return PyImagingNew(im);\n}","target":"PyImaging_MapBuffer(PyObject* self, PyObject* args)\n{\n Py_ssize_t y, size;\n Imaging im;\n\n PyObject* target;\n Py_buffer view;\n char* mode;\n char* codec;\n PyObject* bbox;\n Py_ssize_t offset;\n int xsize, ysize;\n int stride;\n int ystep;\n\n if (!PyArg_ParseTuple(args, \"O(ii)sOn(sii)\", &target, &xsize, &ysize,\n &codec, &bbox, &offset, &mode, &stride, &ystep))\n return NULL;\n\n if (!PyImaging_CheckBuffer(target)) {\n PyErr_SetString(PyExc_TypeError, \"expected string or buffer\");\n return NULL;\n }\n\n if (stride <= 0) {\n if (!strcmp(mode, \"L\") || !strcmp(mode, \"P\"))\n stride = xsize;\n else if (!strncmp(mode, \"I;16\", 4))\n stride = xsize * 2;\n else\n stride = xsize * 4;\n }\n\n if (ysize > INT_MAX / stride) {\n PyErr_SetString(PyExc_MemoryError, \"Integer overflow in ysize\");\n return NULL;\n }\n\n size = (Py_ssize_t) ysize * stride;\n\n if (offset > SIZE_MAX - size) {\n PyErr_SetString(PyExc_MemoryError, \"Integer overflow in offset\");\n return NULL;\n } \n\n /* check buffer size */\n if (PyImaging_GetBuffer(target, &view) < 0)\n return NULL;\n\n if (view.len < 0) {\n PyErr_SetString(PyExc_ValueError, \"buffer has negative size\");\n return NULL;\n }\n if (offset + size > view.len) {\n PyErr_SetString(PyExc_ValueError, \"buffer is not large enough\");\n return NULL;\n }\n\n im = ImagingNewPrologueSubtype(\n mode, xsize, ysize, sizeof(ImagingBufferInstance)\n );\n if (!im)\n return NULL;\n\n /* setup file pointers */\n if (ystep > 0)\n for (y = 0; y < ysize; y++)\n im->image[y] = (char*)view.buf + offset + y * stride;\n else\n for (y = 0; y < ysize; y++)\n im->image[ysize-y-1] = (char*)view.buf + offset + y * stride;\n\n im->destroy = mapping_destroy_buffer;\n\n Py_INCREF(target);\n ((ImagingBufferInstance*) im)->target = target;\n ((ImagingBufferInstance*) im)->view = view;\n\n if (!ImagingNewEpilogue(im))\n return NULL;\n\n return PyImagingNew(im);\n}","lang":"c","vul_type":"cwe-190","target_token_count":593,"sven_meta":{"func_name":"PyImaging_MapBuffer","file_name":"map.c","commit_link":"github.com/python-pillow/Pillow/commit/c50ebe6459a131a1ea8ca531f10da616d3ceaa0f","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#30-7f971d67599a","input":"static int read_entry(\n\tgit_index_entry **out,\n\tsize_t *out_size,\n\tgit_index *index,\n\tconst void *buffer,\n\tsize_t buffer_size,\n\tconst char *last)\n{\n\tsize_t path_length, entry_size;\n\tconst char *path_ptr;\n\tstruct entry_short source;\n\tgit_index_entry entry = {{0}};\n\tbool compressed = index->version >= INDEX_VERSION_NUMBER_COMP;\n\tchar *tmp_path = NULL;\n\n\tif (INDEX_FOOTER_SIZE + minimal_entry_size > buffer_size)\n\t\treturn -1;\n\n\t/* buffer is not guaranteed to be aligned */\n\tmemcpy(&source, buffer, sizeof(struct entry_short));\n\n\tentry.ctime.seconds = (git_time_t)ntohl(source.ctime.seconds);\n\tentry.ctime.nanoseconds = ntohl(source.ctime.nanoseconds);\n\tentry.mtime.seconds = (git_time_t)ntohl(source.mtime.seconds);\n\tentry.mtime.nanoseconds = ntohl(source.mtime.nanoseconds);\n\tentry.dev = ntohl(source.dev);\n\tentry.ino = ntohl(source.ino);\n\tentry.mode = ntohl(source.mode);\n\tentry.uid = ntohl(source.uid);\n\tentry.gid = ntohl(source.gid);\n\tentry.file_size = ntohl(source.file_size);\n\tgit_oid_cpy(&entry.id, &source.oid);\n\tentry.flags = ntohs(source.flags);\n\n\tif (entry.flags & GIT_IDXENTRY_EXTENDED) {\n\t\tuint16_t flags_raw;\n\t\tsize_t flags_offset;\n\n\t\tflags_offset = offsetof(struct entry_long, flags_extended);\n\t\tmemcpy(&flags_raw, (const char *) buffer + flags_offset,\n\t\t\tsizeof(flags_raw));\n\t\tflags_raw = ntohs(flags_raw);\n\n\t\tmemcpy(&entry.flags_extended, &flags_raw, sizeof(flags_raw));\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_long, path);\n\t} else\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_short, path);\n\n\tif (!compressed) {\n\t\tpath_length = entry.flags & GIT_IDXENTRY_NAMEMASK;\n\n\t\t/* if this is a very long string, we must find its\n\t\t * real length without overflowing */\n\t\tif (path_length == 0xFFF) {\n\t\t\tconst char *path_end;\n\n\t\t\tpath_end = memchr(path_ptr, '\\0', buffer_size);\n\t\t\tif (path_end == NULL)\n\t\t\t\treturn -1;\n\n\t\t\tpath_length = path_end - path_ptr;\n\t\t}\n\n\t\tentry_size = index_entry_size(path_length, 0, entry.flags);\n\t\tentry.path = (char *)path_ptr;\n\t} else {\n\t\tsize_t varint_len;\n\t\tsize_t strip_len = git_decode_varint((const unsigned char *)path_ptr,\n\t\t\t\t\t\t &varint_len);\n\t\tsize_t last_len = strlen(last);\n\t\tsize_t prefix_len = last_len - strip_len;\n\t\tsize_t suffix_len = strlen(path_ptr + varint_len);\n\t\tsize_t path_len;\n\n\t\tif (varint_len == 0)\n\t\t\treturn index_error_invalid(\"incorrect prefix length\");\n\n\t\tGITERR_CHECK_ALLOC_ADD(&path_len, prefix_len, suffix_len);\n\t\tGITERR_CHECK_ALLOC_ADD(&path_len, path_len, 1);\n\t\ttmp_path = git__malloc(path_len);\n\t\tGITERR_CHECK_ALLOC(tmp_path);\n\n\t\tmemcpy(tmp_path, last, prefix_len);\n\t\tmemcpy(tmp_path + prefix_len, path_ptr + varint_len, suffix_len + 1);\n\t\tentry_size = index_entry_size(suffix_len, varint_len, entry.flags);\n\t\tentry.path = tmp_path;\n\t}\n\n\tif (entry_size == 0)\n\t\treturn -1;\n\n\tif (INDEX_FOOTER_SIZE + entry_size > buffer_size)\n\t\treturn -1;\n\n\tif (index_entry_dup(out, index, &entry) < 0) {\n\t\tgit__free(tmp_path);\n\t\treturn -1;\n\t}\n\n\tgit__free(tmp_path);\n\t*out_size = entry_size;\n\treturn 0;\n}","target":"static int read_entry(\n\tgit_index_entry **out,\n\tsize_t *out_size,\n\tgit_index *index,\n\tconst void *buffer,\n\tsize_t buffer_size,\n\tconst char *last)\n{\n\tsize_t path_length, entry_size;\n\tconst char *path_ptr;\n\tstruct entry_short source;\n\tgit_index_entry entry = {{0}};\n\tbool compressed = index->version >= INDEX_VERSION_NUMBER_COMP;\n\tchar *tmp_path = NULL;\n\n\tif (INDEX_FOOTER_SIZE + minimal_entry_size > buffer_size)\n\t\treturn -1;\n\n\t/* buffer is not guaranteed to be aligned */\n\tmemcpy(&source, buffer, sizeof(struct entry_short));\n\n\tentry.ctime.seconds = (git_time_t)ntohl(source.ctime.seconds);\n\tentry.ctime.nanoseconds = ntohl(source.ctime.nanoseconds);\n\tentry.mtime.seconds = (git_time_t)ntohl(source.mtime.seconds);\n\tentry.mtime.nanoseconds = ntohl(source.mtime.nanoseconds);\n\tentry.dev = ntohl(source.dev);\n\tentry.ino = ntohl(source.ino);\n\tentry.mode = ntohl(source.mode);\n\tentry.uid = ntohl(source.uid);\n\tentry.gid = ntohl(source.gid);\n\tentry.file_size = ntohl(source.file_size);\n\tgit_oid_cpy(&entry.id, &source.oid);\n\tentry.flags = ntohs(source.flags);\n\n\tif (entry.flags & GIT_IDXENTRY_EXTENDED) {\n\t\tuint16_t flags_raw;\n\t\tsize_t flags_offset;\n\n\t\tflags_offset = offsetof(struct entry_long, flags_extended);\n\t\tmemcpy(&flags_raw, (const char *) buffer + flags_offset,\n\t\t\tsizeof(flags_raw));\n\t\tflags_raw = ntohs(flags_raw);\n\n\t\tmemcpy(&entry.flags_extended, &flags_raw, sizeof(flags_raw));\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_long, path);\n\t} else\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_short, path);\n\n\tif (!compressed) {\n\t\tpath_length = entry.flags & GIT_IDXENTRY_NAMEMASK;\n\n\t\t/* if this is a very long string, we must find its\n\t\t * real length without overflowing */\n\t\tif (path_length == 0xFFF) {\n\t\t\tconst char *path_end;\n\n\t\t\tpath_end = memchr(path_ptr, '\\0', buffer_size);\n\t\t\tif (path_end == NULL)\n\t\t\t\treturn -1;\n\n\t\t\tpath_length = path_end - path_ptr;\n\t\t}\n\n\t\tentry_size = index_entry_size(path_length, 0, entry.flags);\n\t\tentry.path = (char *)path_ptr;\n\t} else {\n\t\tsize_t varint_len, last_len, prefix_len, suffix_len, path_len;\n\t\tuintmax_t strip_len;\n\n\t\tstrip_len = git_decode_varint((const unsigned char *)path_ptr, &varint_len);\n\t\tlast_len = strlen(last);\n\n\t\tif (varint_len == 0 || last_len < strip_len)\n\t\t\treturn index_error_invalid(\"incorrect prefix length\");\n\n\t\tprefix_len = last_len - strip_len;\n\t\tsuffix_len = strlen(path_ptr + varint_len);\n\n\t\tGITERR_CHECK_ALLOC_ADD(&path_len, prefix_len, suffix_len);\n\t\tGITERR_CHECK_ALLOC_ADD(&path_len, path_len, 1);\n\t\ttmp_path = git__malloc(path_len);\n\t\tGITERR_CHECK_ALLOC(tmp_path);\n\n\t\tmemcpy(tmp_path, last, prefix_len);\n\t\tmemcpy(tmp_path + prefix_len, path_ptr + varint_len, suffix_len + 1);\n\t\tentry_size = index_entry_size(suffix_len, varint_len, entry.flags);\n\t\tentry.path = tmp_path;\n\t}\n\n\tif (entry_size == 0)\n\t\treturn -1;\n\n\tif (INDEX_FOOTER_SIZE + entry_size > buffer_size)\n\t\treturn -1;\n\n\tif (index_entry_dup(out, index, &entry) < 0) {\n\t\tgit__free(tmp_path);\n\t\treturn -1;\n\t}\n\n\tgit__free(tmp_path);\n\t*out_size = entry_size;\n\treturn 0;\n}","lang":"c","vul_type":"cwe-190","target_token_count":807,"sven_meta":{"func_name":"read_entry","file_name":"src/index.c","commit_link":"github.com/libgit2/libgit2/commit/3207ddb0103543da8ad2139ec6539f590f9900c1","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#31-9f21ef4303c1","input":"read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss,\n struct _7z_folder *f, size_t numFolders)\n{\n\tconst unsigned char *p;\n\tuint64_t *usizes;\n\tsize_t unpack_streams;\n\tint type;\n\tunsigned i;\n\tuint32_t numDigests;\n\n\tmemset(ss, 0, sizeof(*ss));\n\n\tfor (i = 0; i < numFolders; i++)\n\t\tf[i].numUnpackStreams = 1;\n\n\tif ((p = header_bytes(a, 1)) == NULL)\n\t\treturn (-1);\n\ttype = *p;\n\n\tif (type == kNumUnPackStream) {\n\t\tunpack_streams = 0;\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (parse_7zip_uint64(a, &(f[i].numUnpackStreams)) < 0)\n\t\t\t\treturn (-1);\n\t\t\tif (UMAX_ENTRY < f[i].numUnpackStreams)\n\t\t\t\treturn (-1);\n\t\t\tunpack_streams += (size_t)f[i].numUnpackStreams;\n\t\t}\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t} else\n\t\tunpack_streams = numFolders;\n\n\tss->unpack_streams = unpack_streams;\n\tif (unpack_streams) {\n\t\tss->unpackSizes = calloc(unpack_streams,\n\t\t sizeof(*ss->unpackSizes));\n\t\tss->digestsDefined = calloc(unpack_streams,\n\t\t sizeof(*ss->digestsDefined));\n\t\tss->digests = calloc(unpack_streams,\n\t\t sizeof(*ss->digests));\n\t\tif (ss->unpackSizes == NULL || ss->digestsDefined == NULL ||\n\t\t ss->digests == NULL)\n\t\t\treturn (-1);\n\t}\n\n\tusizes = ss->unpackSizes;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tunsigned pack;\n\t\tuint64_t sum;\n\n\t\tif (f[i].numUnpackStreams == 0)\n\t\t\tcontinue;\n\n\t\tsum = 0;\n\t\tif (type == kSize) {\n\t\t\tfor (pack = 1; pack < f[i].numUnpackStreams; pack++) {\n\t\t\t\tif (parse_7zip_uint64(a, usizes) < 0)\n\t\t\t\t\treturn (-1);\n\t\t\t\tsum += *usizes++;\n\t\t\t}\n\t\t}\n\t\t*usizes++ = folder_uncompressed_size(&f[i]) - sum;\n\t}\n\n\tif (type == kSize) {\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\tfor (i = 0; i < unpack_streams; i++) {\n\t\tss->digestsDefined[i] = 0;\n\t\tss->digests[i] = 0;\n\t}\n\n\tnumDigests = 0;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tif (f[i].numUnpackStreams != 1 || !f[i].digest_defined)\n\t\t\tnumDigests += (uint32_t)f[i].numUnpackStreams;\n\t}\n\n\tif (type == kCRC) {\n\t\tstruct _7z_digests tmpDigests;\n\t\tunsigned char *digestsDefined = ss->digestsDefined;\n\t\tuint32_t * digests = ss->digests;\n\t\tint di = 0;\n\n\t\tmemset(&tmpDigests, 0, sizeof(tmpDigests));\n\t\tif (read_Digests(a, &(tmpDigests), numDigests) < 0) {\n\t\t\tfree_Digest(&tmpDigests);\n\t\t\treturn (-1);\n\t\t}\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (f[i].numUnpackStreams == 1 && f[i].digest_defined) {\n\t\t\t\t*digestsDefined++ = 1;\n\t\t\t\t*digests++ = f[i].digest;\n\t\t\t} else {\n\t\t\t\tunsigned j;\n\n\t\t\t\tfor (j = 0; j < f[i].numUnpackStreams;\n\t\t\t\t j++, di++) {\n\t\t\t\t\t*digestsDefined++ =\n\t\t\t\t\t tmpDigests.defineds[di];\n\t\t\t\t\t*digests++ =\n\t\t\t\t\t tmpDigests.digests[di];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfree_Digest(&tmpDigests);\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\t/*\n\t * Must be kEnd.\n\t */\n\tif (type != kEnd)\n\t\treturn (-1);\n\treturn (0);\n}","target":"read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss,\n struct _7z_folder *f, size_t numFolders)\n{\n\tconst unsigned char *p;\n\tuint64_t *usizes;\n\tsize_t unpack_streams;\n\tint type;\n\tunsigned i;\n\tuint32_t numDigests;\n\n\tmemset(ss, 0, sizeof(*ss));\n\n\tfor (i = 0; i < numFolders; i++)\n\t\tf[i].numUnpackStreams = 1;\n\n\tif ((p = header_bytes(a, 1)) == NULL)\n\t\treturn (-1);\n\ttype = *p;\n\n\tif (type == kNumUnPackStream) {\n\t\tunpack_streams = 0;\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (parse_7zip_uint64(a, &(f[i].numUnpackStreams)) < 0)\n\t\t\t\treturn (-1);\n\t\t\tif (UMAX_ENTRY < f[i].numUnpackStreams)\n\t\t\t\treturn (-1);\n\t\t\tif (unpack_streams > SIZE_MAX - UMAX_ENTRY) {\n\t\t\t\treturn (-1);\n\t\t\t}\n\t\t\tunpack_streams += (size_t)f[i].numUnpackStreams;\n\t\t}\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t} else\n\t\tunpack_streams = numFolders;\n\n\tss->unpack_streams = unpack_streams;\n\tif (unpack_streams) {\n\t\tss->unpackSizes = calloc(unpack_streams,\n\t\t sizeof(*ss->unpackSizes));\n\t\tss->digestsDefined = calloc(unpack_streams,\n\t\t sizeof(*ss->digestsDefined));\n\t\tss->digests = calloc(unpack_streams,\n\t\t sizeof(*ss->digests));\n\t\tif (ss->unpackSizes == NULL || ss->digestsDefined == NULL ||\n\t\t ss->digests == NULL)\n\t\t\treturn (-1);\n\t}\n\n\tusizes = ss->unpackSizes;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tunsigned pack;\n\t\tuint64_t sum;\n\n\t\tif (f[i].numUnpackStreams == 0)\n\t\t\tcontinue;\n\n\t\tsum = 0;\n\t\tif (type == kSize) {\n\t\t\tfor (pack = 1; pack < f[i].numUnpackStreams; pack++) {\n\t\t\t\tif (parse_7zip_uint64(a, usizes) < 0)\n\t\t\t\t\treturn (-1);\n\t\t\t\tsum += *usizes++;\n\t\t\t}\n\t\t}\n\t\t*usizes++ = folder_uncompressed_size(&f[i]) - sum;\n\t}\n\n\tif (type == kSize) {\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\tfor (i = 0; i < unpack_streams; i++) {\n\t\tss->digestsDefined[i] = 0;\n\t\tss->digests[i] = 0;\n\t}\n\n\tnumDigests = 0;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tif (f[i].numUnpackStreams != 1 || !f[i].digest_defined)\n\t\t\tnumDigests += (uint32_t)f[i].numUnpackStreams;\n\t}\n\n\tif (type == kCRC) {\n\t\tstruct _7z_digests tmpDigests;\n\t\tunsigned char *digestsDefined = ss->digestsDefined;\n\t\tuint32_t * digests = ss->digests;\n\t\tint di = 0;\n\n\t\tmemset(&tmpDigests, 0, sizeof(tmpDigests));\n\t\tif (read_Digests(a, &(tmpDigests), numDigests) < 0) {\n\t\t\tfree_Digest(&tmpDigests);\n\t\t\treturn (-1);\n\t\t}\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (f[i].numUnpackStreams == 1 && f[i].digest_defined) {\n\t\t\t\t*digestsDefined++ = 1;\n\t\t\t\t*digests++ = f[i].digest;\n\t\t\t} else {\n\t\t\t\tunsigned j;\n\n\t\t\t\tfor (j = 0; j < f[i].numUnpackStreams;\n\t\t\t\t j++, di++) {\n\t\t\t\t\t*digestsDefined++ =\n\t\t\t\t\t tmpDigests.defineds[di];\n\t\t\t\t\t*digests++ =\n\t\t\t\t\t tmpDigests.digests[di];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfree_Digest(&tmpDigests);\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\t/*\n\t * Must be kEnd.\n\t */\n\tif (type != kEnd)\n\t\treturn (-1);\n\treturn (0);\n}","lang":"c","vul_type":"cwe-190","target_token_count":992,"sven_meta":{"func_name":"read_SubStreamsInfo","file_name":"libarchive/archive_read_support_format_7zip.c","commit_link":"github.com/libarchive/libarchive/commit/e79ef306afe332faf22e9b442a2c6b59cb175573","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#32-4f469965a46d","input":"static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,\n const BYTE* pSrcData, UINT32 DstWidth, UINT32 DstHeight,\n UINT32 bpp, UINT32 length, BOOL compressed,\n UINT32 codecId)\n{\n\tUINT32 SrcSize = length;\n\trdpGdi* gdi = context->gdi;\n\tbitmap->compressed = FALSE;\n\tbitmap->format = gdi->dstFormat;\n\tbitmap->length = DstWidth * DstHeight * GetBytesPerPixel(bitmap->format);\n\tbitmap->data = (BYTE*) _aligned_malloc(bitmap->length, 16);\n\n\tif (!bitmap->data)\n\t\treturn FALSE;\n\n\tif (compressed)\n\t{\n\t\tif (bpp < 32)\n\t\t{\n\t\t\tif (!interleaved_decompress(context->codecs->interleaved,\n\t\t\t pSrcData, SrcSize,\n\t\t\t DstWidth, DstHeight,\n\t\t\t bpp,\n\t\t\t bitmap->data, bitmap->format,\n\t\t\t 0, 0, 0, DstWidth, DstHeight,\n\t\t\t &gdi->palette))\n\t\t\t\treturn FALSE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (!planar_decompress(context->codecs->planar, pSrcData, SrcSize,\n\t\t\t DstWidth, DstHeight,\n\t\t\t bitmap->data, bitmap->format, 0, 0, 0,\n\t\t\t DstWidth, DstHeight, TRUE))\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tconst UINT32 SrcFormat = gdi_get_pixel_format(bpp);\n\t\tconst size_t sbpp = GetBytesPerPixel(SrcFormat);\n\t\tconst size_t dbpp = GetBytesPerPixel(bitmap->format);\n\n\t\tif ((sbpp == 0) || (dbpp == 0))\n\t\t\treturn FALSE;\n\t\telse\n\t\t{\n\t\t\tconst size_t dstSize = SrcSize * dbpp / sbpp;\n\n\t\t\tif (dstSize < bitmap->length)\n\t\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (!freerdp_image_copy(bitmap->data, bitmap->format, 0, 0, 0,\n\t\t DstWidth, DstHeight, pSrcData, SrcFormat,\n\t\t 0, 0, 0, &gdi->palette, FREERDP_FLIP_VERTICAL))\n\t\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}","target":"static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,\n const BYTE* pSrcData, UINT32 DstWidth, UINT32 DstHeight,\n UINT32 bpp, UINT32 length, BOOL compressed,\n UINT32 codecId)\n{\n\tUINT32 SrcSize = length;\n\trdpGdi* gdi = context->gdi;\n\tUINT32 size = DstWidth * DstHeight;\n\tbitmap->compressed = FALSE;\n\tbitmap->format = gdi->dstFormat;\n\n\tif ((GetBytesPerPixel(bitmap->format) == 0) ||\n\t (DstWidth == 0) || (DstHeight == 0) || (DstWidth > UINT32_MAX / DstHeight) ||\n\t (size > (UINT32_MAX / GetBytesPerPixel(bitmap->format))))\n\t\treturn FALSE;\n\n\tsize *= GetBytesPerPixel(bitmap->format);\n\tbitmap->length = size;\n\tbitmap->data = (BYTE*) _aligned_malloc(bitmap->length, 16);\n\n\tif (!bitmap->data)\n\t\treturn FALSE;\n\n\tif (compressed)\n\t{\n\t\tif (bpp < 32)\n\t\t{\n\t\t\tif (!interleaved_decompress(context->codecs->interleaved,\n\t\t\t pSrcData, SrcSize,\n\t\t\t DstWidth, DstHeight,\n\t\t\t bpp,\n\t\t\t bitmap->data, bitmap->format,\n\t\t\t 0, 0, 0, DstWidth, DstHeight,\n\t\t\t &gdi->palette))\n\t\t\t\treturn FALSE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (!planar_decompress(context->codecs->planar, pSrcData, SrcSize,\n\t\t\t DstWidth, DstHeight,\n\t\t\t bitmap->data, bitmap->format, 0, 0, 0,\n\t\t\t DstWidth, DstHeight, TRUE))\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tconst UINT32 SrcFormat = gdi_get_pixel_format(bpp);\n\t\tconst size_t sbpp = GetBytesPerPixel(SrcFormat);\n\t\tconst size_t dbpp = GetBytesPerPixel(bitmap->format);\n\n\t\tif ((sbpp == 0) || (dbpp == 0))\n\t\t\treturn FALSE;\n\t\telse\n\t\t{\n\t\t\tconst size_t dstSize = SrcSize * dbpp / sbpp;\n\n\t\t\tif (dstSize < bitmap->length)\n\t\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (!freerdp_image_copy(bitmap->data, bitmap->format, 0, 0, 0,\n\t\t DstWidth, DstHeight, pSrcData, SrcFormat,\n\t\t 0, 0, 0, &gdi->palette, FREERDP_FLIP_VERTICAL))\n\t\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-190","target_token_count":591,"sven_meta":{"func_name":"gdi_Bitmap_Decompress","file_name":"libfreerdp/gdi/graphics.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/09b9d4f1994a674c4ec85b4947aa656eda1aed8a","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#34-ffd4a1e27be9","input":"layer_resize(int layer, int x_size, int y_size)\n{\n\tint old_height;\n\tint old_width;\n\tstruct map_tile* tile;\n\tint tile_width;\n\tint tile_height;\n\tstruct map_tile* tilemap;\n\tstruct map_trigger* trigger;\n\tstruct map_zone* zone;\n\n\tint x, y, i;\n\n\told_width = s_map->layers[layer].width;\n\told_height = s_map->layers[layer].height;\n\n\t// allocate a new tilemap and copy the old layer tiles into it. we can't simply realloc\n\t// because the tilemap is a 2D array.\n\tif (!(tilemap = malloc(x_size * y_size * sizeof(struct map_tile))))\n\t\treturn false;\n\tfor (x = 0; x < x_size; ++x) {\n\t\tfor (y = 0; y < y_size; ++y) {\n\t\t\tif (x < old_width && y < old_height) {\n\t\t\t\ttilemap[x + y * x_size] = s_map->layers[layer].tilemap[x + y * old_width];\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttile = &tilemap[x + y * x_size];\n\t\t\t\ttile->frames_left = tileset_get_delay(s_map->tileset, 0);\n\t\t\t\ttile->tile_index = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\t// free the old tilemap and substitute the new one\n\tfree(s_map->layers[layer].tilemap);\n\ts_map->layers[layer].tilemap = tilemap;\n\ts_map->layers[layer].width = x_size;\n\ts_map->layers[layer].height = y_size;\n\n\t// if we resize the largest layer, the overall map size will change.\n\t// recalcuate it.\n\ttileset_get_size(s_map->tileset, &tile_width, &tile_height);\n\ts_map->width = 0;\n\ts_map->height = 0;\n\tfor (i = 0; i < s_map->num_layers; ++i) {\n\t\tif (!s_map->layers[i].is_parallax) {\n\t\t\ts_map->width = fmax(s_map->width, s_map->layers[i].width * tile_width);\n\t\t\ts_map->height = fmax(s_map->height, s_map->layers[i].height * tile_height);\n\t\t}\n\t}\n\n\t// ensure zones and triggers remain in-bounds. if any are completely\n\t// out-of-bounds, delete them.\n\tfor (i = (int)vector_len(s_map->zones) - 1; i >= 0; --i) {\n\t\tzone = vector_get(s_map->zones, i);\n\t\tif (zone->bounds.x1 >= s_map->width || zone->bounds.y1 >= s_map->height)\n\t\t\tvector_remove(s_map->zones, i);\n\t\telse {\n\t\t\tif (zone->bounds.x2 > s_map->width)\n\t\t\t\tzone->bounds.x2 = s_map->width;\n\t\t\tif (zone->bounds.y2 > s_map->height)\n\t\t\t\tzone->bounds.y2 = s_map->height;\n\t\t}\n\t}\n\tfor (i = (int)vector_len(s_map->triggers) - 1; i >= 0; --i) {\n\t\ttrigger = vector_get(s_map->triggers, i);\n\t\tif (trigger->x >= s_map->width || trigger->y >= s_map->height)\n\t\t\tvector_remove(s_map->triggers, i);\n\t}\n\n\treturn true;\n}","target":"layer_resize(int layer, int x_size, int y_size)\n{\n\tint old_height;\n\tint old_width;\n\tstruct map_tile* tile;\n\tint tile_width;\n\tint tile_height;\n\tstruct map_tile* tilemap;\n\tstruct map_trigger* trigger;\n\tstruct map_zone* zone;\n\tsize_t tilemap_size;\n\n\tint x, y, i;\n\n\told_width = s_map->layers[layer].width;\n\told_height = s_map->layers[layer].height;\n\n\t// allocate a new tilemap and copy the old layer tiles into it. we can't simply realloc\n\t// because the tilemap is a 2D array.\n\ttilemap_size = x_size * y_size * sizeof(struct map_tile);\n\tif (x_size == 0 || tilemap_size / x_size / sizeof(struct map_tile) != y_size\n\t\t|| !(tilemap = malloc(tilemap_size)))\n\t\treturn false;\n\tfor (x = 0; x < x_size; ++x) {\n\t\tfor (y = 0; y < y_size; ++y) {\n\t\t\tif (x < old_width && y < old_height) {\n\t\t\t\ttilemap[x + y * x_size] = s_map->layers[layer].tilemap[x + y * old_width];\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttile = &tilemap[x + y * x_size];\n\t\t\t\ttile->frames_left = tileset_get_delay(s_map->tileset, 0);\n\t\t\t\ttile->tile_index = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\t// free the old tilemap and substitute the new one\n\tfree(s_map->layers[layer].tilemap);\n\ts_map->layers[layer].tilemap = tilemap;\n\ts_map->layers[layer].width = x_size;\n\ts_map->layers[layer].height = y_size;\n\n\t// if we resize the largest layer, the overall map size will change.\n\t// recalcuate it.\n\ttileset_get_size(s_map->tileset, &tile_width, &tile_height);\n\ts_map->width = 0;\n\ts_map->height = 0;\n\tfor (i = 0; i < s_map->num_layers; ++i) {\n\t\tif (!s_map->layers[i].is_parallax) {\n\t\t\ts_map->width = fmax(s_map->width, s_map->layers[i].width * tile_width);\n\t\t\ts_map->height = fmax(s_map->height, s_map->layers[i].height * tile_height);\n\t\t}\n\t}\n\n\t// ensure zones and triggers remain in-bounds. if any are completely\n\t// out-of-bounds, delete them.\n\tfor (i = (int)vector_len(s_map->zones) - 1; i >= 0; --i) {\n\t\tzone = vector_get(s_map->zones, i);\n\t\tif (zone->bounds.x1 >= s_map->width || zone->bounds.y1 >= s_map->height)\n\t\t\tvector_remove(s_map->zones, i);\n\t\telse {\n\t\t\tif (zone->bounds.x2 > s_map->width)\n\t\t\t\tzone->bounds.x2 = s_map->width;\n\t\t\tif (zone->bounds.y2 > s_map->height)\n\t\t\t\tzone->bounds.y2 = s_map->height;\n\t\t}\n\t}\n\tfor (i = (int)vector_len(s_map->triggers) - 1; i >= 0; --i) {\n\t\ttrigger = vector_get(s_map->triggers, i);\n\t\tif (trigger->x >= s_map->width || trigger->y >= s_map->height)\n\t\t\tvector_remove(s_map->triggers, i);\n\t}\n\n\treturn true;\n}","lang":"c","vul_type":"cwe-190","target_token_count":760,"sven_meta":{"func_name":"layer_resize","file_name":"src/minisphere/map_engine.c","commit_link":"github.com/fatcerberus/minisphere/commit/252c1ca184cb38e1acb917aa0e451c5f08519996","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#35-2e83f7a124b9","input":"static MagickRealType ApplyEvaluateOperator(RandomInfo *random_info,\n const Quantum pixel,const MagickEvaluateOperator op,\n const MagickRealType value)\n{\n MagickRealType\n result;\n\n result=0.0;\n switch (op)\n {\n case UndefinedEvaluateOperator:\n break;\n case AbsEvaluateOperator:\n {\n result=(MagickRealType) fabs((double) (pixel+value));\n break;\n }\n case AddEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case AddModulusEvaluateOperator:\n {\n /*\n This returns a 'floored modulus' of the addition which is a\n positive result. It differs from % or fmod() which returns a\n 'truncated modulus' result, where floor() is replaced by trunc()\n and could return a negative result (which is clipped).\n */\n result=pixel+value;\n result-=(QuantumRange+1.0)*floor((double) result/(QuantumRange+1.0));\n break;\n }\n case AndEvaluateOperator:\n {\n result=(MagickRealType) ((size_t) pixel & (size_t) (value+0.5));\n break;\n }\n case CosineEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*(0.5*cos((double) (2.0*MagickPI*\n QuantumScale*pixel*value))+0.5));\n break;\n }\n case DivideEvaluateOperator:\n {\n result=pixel/(value == 0.0 ? 1.0 : value);\n break;\n }\n case ExponentialEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*exp((double) (value*QuantumScale*\n pixel)));\n break;\n }\n case GaussianNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n GaussianNoise,value);\n break;\n }\n case ImpulseNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n ImpulseNoise,value);\n break;\n }\n case LaplacianNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n LaplacianNoise,value);\n break;\n }\n case LeftShiftEvaluateOperator:\n {\n result=(MagickRealType) ((size_t) pixel << (size_t) (value+0.5));\n break;\n }\n case LogEvaluateOperator:\n {\n if ((QuantumScale*pixel) >= MagickEpsilon)\n result=(MagickRealType) (QuantumRange*log((double) (QuantumScale*value*\n pixel+1.0))/log((double) (value+1.0)));\n break;\n }\n case MaxEvaluateOperator:\n {\n result=(MagickRealType) EvaluateMax((double) pixel,value);\n break;\n }\n case MeanEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case MedianEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case MinEvaluateOperator:\n {\n result=(MagickRealType) MagickMin((double) pixel,value);\n break;\n }\n case MultiplicativeNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n MultiplicativeGaussianNoise,value);\n break;\n }\n case MultiplyEvaluateOperator:\n {\n result=(MagickRealType) (value*pixel);\n break;\n }\n case OrEvaluateOperator:\n {\n result=(MagickRealType) ((size_t) pixel | (size_t) (value+0.5));\n break;\n }\n case PoissonNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n PoissonNoise,value);\n break;\n }\n case PowEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*pow((double) (QuantumScale*pixel),\n (double) value));\n break;\n }\n case RightShiftEvaluateOperator:\n {\n result=(MagickRealType) ((size_t) pixel >> (size_t) (value+0.5));\n break;\n }\n case RootMeanSquareEvaluateOperator:\n {\n result=(MagickRealType) (pixel*pixel+value);\n break;\n }\n case SetEvaluateOperator:\n {\n result=value;\n break;\n }\n case SineEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*(0.5*sin((double) (2.0*MagickPI*\n QuantumScale*pixel*value))+0.5));\n break;\n }\n case SubtractEvaluateOperator:\n {\n result=(MagickRealType) (pixel-value);\n break;\n }\n case SumEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case ThresholdEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel <= value) ? 0 :\n QuantumRange);\n break;\n }\n case ThresholdBlackEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel <= value) ? 0 : pixel);\n break;\n }\n case ThresholdWhiteEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel > value) ? QuantumRange :\n pixel);\n break;\n }\n case UniformNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n UniformNoise,value);\n break;\n }\n case XorEvaluateOperator:\n {\n result=(MagickRealType) ((size_t) pixel ^ (size_t) (value+0.5));\n break;\n }\n }\n return(result);\n}","target":"static MagickRealType ApplyEvaluateOperator(RandomInfo *random_info,\n const Quantum pixel,const MagickEvaluateOperator op,\n const MagickRealType value)\n{\n MagickRealType\n result;\n\n result=0.0;\n switch (op)\n {\n case UndefinedEvaluateOperator:\n break;\n case AbsEvaluateOperator:\n {\n result=(MagickRealType) fabs((double) (pixel+value));\n break;\n }\n case AddEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case AddModulusEvaluateOperator:\n {\n /*\n This returns a 'floored modulus' of the addition which is a\n positive result. It differs from % or fmod() which returns a\n 'truncated modulus' result, where floor() is replaced by trunc()\n and could return a negative result (which is clipped).\n */\n result=pixel+value;\n result-=(QuantumRange+1.0)*floor((double) result/(QuantumRange+1.0));\n break;\n }\n case AndEvaluateOperator:\n {\n result=(MagickRealType) ((ssize_t) pixel & (ssize_t) (value+0.5));\n break;\n }\n case CosineEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*(0.5*cos((double) (2.0*MagickPI*\n QuantumScale*pixel*value))+0.5));\n break;\n }\n case DivideEvaluateOperator:\n {\n result=pixel/(value == 0.0 ? 1.0 : value);\n break;\n }\n case ExponentialEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*exp((double) (value*QuantumScale*\n pixel)));\n break;\n }\n case GaussianNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n GaussianNoise,value);\n break;\n }\n case ImpulseNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n ImpulseNoise,value);\n break;\n }\n case LaplacianNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n LaplacianNoise,value);\n break;\n }\n case LeftShiftEvaluateOperator:\n {\n result=(MagickRealType) ((ssize_t) pixel << (ssize_t) (value+0.5));\n break;\n }\n case LogEvaluateOperator:\n {\n if ((QuantumScale*pixel) >= MagickEpsilon)\n result=(MagickRealType) (QuantumRange*log((double) (QuantumScale*value*\n pixel+1.0))/log((double) (value+1.0)));\n break;\n }\n case MaxEvaluateOperator:\n {\n result=(MagickRealType) EvaluateMax((double) pixel,value);\n break;\n }\n case MeanEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case MedianEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case MinEvaluateOperator:\n {\n result=(MagickRealType) MagickMin((double) pixel,value);\n break;\n }\n case MultiplicativeNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n MultiplicativeGaussianNoise,value);\n break;\n }\n case MultiplyEvaluateOperator:\n {\n result=(MagickRealType) (value*pixel);\n break;\n }\n case OrEvaluateOperator:\n {\n result=(MagickRealType) ((ssize_t) pixel | (ssize_t) (value+0.5));\n break;\n }\n case PoissonNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n PoissonNoise,value);\n break;\n }\n case PowEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*pow((double) (QuantumScale*pixel),\n (double) value));\n break;\n }\n case RightShiftEvaluateOperator:\n {\n result=(MagickRealType) ((ssize_t) pixel >> (ssize_t) (value+0.5));\n break;\n }\n case RootMeanSquareEvaluateOperator:\n {\n result=(MagickRealType) (pixel*pixel+value);\n break;\n }\n case SetEvaluateOperator:\n {\n result=value;\n break;\n }\n case SineEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*(0.5*sin((double) (2.0*MagickPI*\n QuantumScale*pixel*value))+0.5));\n break;\n }\n case SubtractEvaluateOperator:\n {\n result=(MagickRealType) (pixel-value);\n break;\n }\n case SumEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case ThresholdEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel <= value) ? 0 :\n QuantumRange);\n break;\n }\n case ThresholdBlackEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel <= value) ? 0 : pixel);\n break;\n }\n case ThresholdWhiteEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel > value) ? QuantumRange :\n pixel);\n break;\n }\n case UniformNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n UniformNoise,value);\n break;\n }\n case XorEvaluateOperator:\n {\n result=(MagickRealType) ((ssize_t) pixel ^ (ssize_t) (value+0.5));\n break;\n }\n }\n return(result);\n}","lang":"c","vul_type":"cwe-190","target_token_count":1303,"sven_meta":{"func_name":"ApplyEvaluateOperator","file_name":"magick/statistic.c","commit_link":"github.com/ImageMagick/ImageMagick6/commit/3e21bc8a58b4ae38d24c7e283837cc279f35b6a5","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#37-122859b8778f","input":"static int jpc_dec_process_siz(jpc_dec_t *dec, jpc_ms_t *ms)\n{\n\tjpc_siz_t *siz = &ms->parms.siz;\n\tint compno;\n\tint tileno;\n\tjpc_dec_tile_t *tile;\n\tjpc_dec_tcomp_t *tcomp;\n\tint htileno;\n\tint vtileno;\n\tjpc_dec_cmpt_t *cmpt;\n\n\tdec->xstart = siz->xoff;\n\tdec->ystart = siz->yoff;\n\tdec->xend = siz->width;\n\tdec->yend = siz->height;\n\tdec->tilewidth = siz->tilewidth;\n\tdec->tileheight = siz->tileheight;\n\tdec->tilexoff = siz->tilexoff;\n\tdec->tileyoff = siz->tileyoff;\n\tdec->numcomps = siz->numcomps;\n\tif (!(dec->cp = jpc_dec_cp_create(dec->numcomps))) {\n\t\treturn -1;\n\t}\n\n\tif (!(dec->cmpts = jas_alloc2(dec->numcomps, sizeof(jpc_dec_cmpt_t)))) {\n\t\treturn -1;\n\t}\n\n\tfor (compno = 0, cmpt = dec->cmpts; compno < dec->numcomps; ++compno,\n\t ++cmpt) {\n\t\tcmpt->prec = siz->comps[compno].prec;\n\t\tcmpt->sgnd = siz->comps[compno].sgnd;\n\t\tcmpt->hstep = siz->comps[compno].hsamp;\n\t\tcmpt->vstep = siz->comps[compno].vsamp;\n\t\tcmpt->width = JPC_CEILDIV(dec->xend, cmpt->hstep) -\n\t\t JPC_CEILDIV(dec->xstart, cmpt->hstep);\n\t\tcmpt->height = JPC_CEILDIV(dec->yend, cmpt->vstep) -\n\t\t JPC_CEILDIV(dec->ystart, cmpt->vstep);\n\t\tcmpt->hsubstep = 0;\n\t\tcmpt->vsubstep = 0;\n\t}\n\n\tdec->image = 0;\n\n\tdec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth);\n\tdec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight);\n\tdec->numtiles = dec->numhtiles * dec->numvtiles;\n\tJAS_DBGLOG(10, (\"numtiles = %d; numhtiles = %d; numvtiles = %d;\\n\",\n\t dec->numtiles, dec->numhtiles, dec->numvtiles));\n\tif (!(dec->tiles = jas_alloc2(dec->numtiles, sizeof(jpc_dec_tile_t)))) {\n\t\treturn -1;\n\t}\n\n\tfor (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno,\n\t ++tile) {\n\t\thtileno = tileno % dec->numhtiles;\n\t\tvtileno = tileno / dec->numhtiles;\n\t\ttile->realmode = 0;\n\t\ttile->state = JPC_TILE_INIT;\n\t\ttile->xstart = JAS_MAX(dec->tilexoff + htileno * dec->tilewidth,\n\t\t dec->xstart);\n\t\ttile->ystart = JAS_MAX(dec->tileyoff + vtileno * dec->tileheight,\n\t\t dec->ystart);\n\t\ttile->xend = JAS_MIN(dec->tilexoff + (htileno + 1) *\n\t\t dec->tilewidth, dec->xend);\n\t\ttile->yend = JAS_MIN(dec->tileyoff + (vtileno + 1) *\n\t\t dec->tileheight, dec->yend);\n\t\ttile->numparts = 0;\n\t\ttile->partno = 0;\n\t\ttile->pkthdrstream = 0;\n\t\ttile->pkthdrstreampos = 0;\n\t\ttile->pptstab = 0;\n\t\ttile->cp = 0;\n\t\ttile->pi = 0;\n\t\tif (!(tile->tcomps = jas_alloc2(dec->numcomps,\n\t\t sizeof(jpc_dec_tcomp_t)))) {\n\t\t\treturn -1;\n\t\t}\n\t\tfor (compno = 0, cmpt = dec->cmpts, tcomp = tile->tcomps;\n\t\t compno < dec->numcomps; ++compno, ++cmpt, ++tcomp) {\n\t\t\ttcomp->rlvls = 0;\n\t\t\ttcomp->numrlvls = 0;\n\t\t\ttcomp->data = 0;\n\t\t\ttcomp->xstart = JPC_CEILDIV(tile->xstart, cmpt->hstep);\n\t\t\ttcomp->ystart = JPC_CEILDIV(tile->ystart, cmpt->vstep);\n\t\t\ttcomp->xend = JPC_CEILDIV(tile->xend, cmpt->hstep);\n\t\t\ttcomp->yend = JPC_CEILDIV(tile->yend, cmpt->vstep);\n\t\t\ttcomp->tsfb = 0;\n\t\t}\n\t}\n\n\tdec->pkthdrstreams = 0;\n\n\t/* We should expect to encounter other main header marker segments\n\t or an SOT marker segment next. */\n\tdec->state = JPC_MH;\n\n\treturn 0;\n}","target":"static int jpc_dec_process_siz(jpc_dec_t *dec, jpc_ms_t *ms)\n{\n\tjpc_siz_t *siz = &ms->parms.siz;\n\tint compno;\n\tint tileno;\n\tjpc_dec_tile_t *tile;\n\tjpc_dec_tcomp_t *tcomp;\n\tint htileno;\n\tint vtileno;\n\tjpc_dec_cmpt_t *cmpt;\n\tsize_t size;\n\n\tdec->xstart = siz->xoff;\n\tdec->ystart = siz->yoff;\n\tdec->xend = siz->width;\n\tdec->yend = siz->height;\n\tdec->tilewidth = siz->tilewidth;\n\tdec->tileheight = siz->tileheight;\n\tdec->tilexoff = siz->tilexoff;\n\tdec->tileyoff = siz->tileyoff;\n\tdec->numcomps = siz->numcomps;\n\tif (!(dec->cp = jpc_dec_cp_create(dec->numcomps))) {\n\t\treturn -1;\n\t}\n\n\tif (!(dec->cmpts = jas_alloc2(dec->numcomps, sizeof(jpc_dec_cmpt_t)))) {\n\t\treturn -1;\n\t}\n\n\tfor (compno = 0, cmpt = dec->cmpts; compno < dec->numcomps; ++compno,\n\t ++cmpt) {\n\t\tcmpt->prec = siz->comps[compno].prec;\n\t\tcmpt->sgnd = siz->comps[compno].sgnd;\n\t\tcmpt->hstep = siz->comps[compno].hsamp;\n\t\tcmpt->vstep = siz->comps[compno].vsamp;\n\t\tcmpt->width = JPC_CEILDIV(dec->xend, cmpt->hstep) -\n\t\t JPC_CEILDIV(dec->xstart, cmpt->hstep);\n\t\tcmpt->height = JPC_CEILDIV(dec->yend, cmpt->vstep) -\n\t\t JPC_CEILDIV(dec->ystart, cmpt->vstep);\n\t\tcmpt->hsubstep = 0;\n\t\tcmpt->vsubstep = 0;\n\t}\n\n\tdec->image = 0;\n\n\tdec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth);\n\tdec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight);\n\tif (!jas_safe_size_mul(dec->numhtiles, dec->numvtiles, &size)) {\n\t\treturn -1;\n\t}\n\tdec->numtiles = size;\n\tJAS_DBGLOG(10, (\"numtiles = %d; numhtiles = %d; numvtiles = %d;\\n\",\n\t dec->numtiles, dec->numhtiles, dec->numvtiles));\n\tif (!(dec->tiles = jas_alloc2(dec->numtiles, sizeof(jpc_dec_tile_t)))) {\n\t\treturn -1;\n\t}\n\n\tfor (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno,\n\t ++tile) {\n\t\thtileno = tileno % dec->numhtiles;\n\t\tvtileno = tileno / dec->numhtiles;\n\t\ttile->realmode = 0;\n\t\ttile->state = JPC_TILE_INIT;\n\t\ttile->xstart = JAS_MAX(dec->tilexoff + htileno * dec->tilewidth,\n\t\t dec->xstart);\n\t\ttile->ystart = JAS_MAX(dec->tileyoff + vtileno * dec->tileheight,\n\t\t dec->ystart);\n\t\ttile->xend = JAS_MIN(dec->tilexoff + (htileno + 1) *\n\t\t dec->tilewidth, dec->xend);\n\t\ttile->yend = JAS_MIN(dec->tileyoff + (vtileno + 1) *\n\t\t dec->tileheight, dec->yend);\n\t\ttile->numparts = 0;\n\t\ttile->partno = 0;\n\t\ttile->pkthdrstream = 0;\n\t\ttile->pkthdrstreampos = 0;\n\t\ttile->pptstab = 0;\n\t\ttile->cp = 0;\n\t\ttile->pi = 0;\n\t\tif (!(tile->tcomps = jas_alloc2(dec->numcomps,\n\t\t sizeof(jpc_dec_tcomp_t)))) {\n\t\t\treturn -1;\n\t\t}\n\t\tfor (compno = 0, cmpt = dec->cmpts, tcomp = tile->tcomps;\n\t\t compno < dec->numcomps; ++compno, ++cmpt, ++tcomp) {\n\t\t\ttcomp->rlvls = 0;\n\t\t\ttcomp->numrlvls = 0;\n\t\t\ttcomp->data = 0;\n\t\t\ttcomp->xstart = JPC_CEILDIV(tile->xstart, cmpt->hstep);\n\t\t\ttcomp->ystart = JPC_CEILDIV(tile->ystart, cmpt->vstep);\n\t\t\ttcomp->xend = JPC_CEILDIV(tile->xend, cmpt->hstep);\n\t\t\ttcomp->yend = JPC_CEILDIV(tile->yend, cmpt->vstep);\n\t\t\ttcomp->tsfb = 0;\n\t\t}\n\t}\n\n\tdec->pkthdrstreams = 0;\n\n\t/* We should expect to encounter other main header marker segments\n\t or an SOT marker segment next. */\n\tdec->state = JPC_MH;\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-190","target_token_count":1189,"sven_meta":{"func_name":"jpc_dec_process_siz","file_name":"src/libjasper/jpc/jpc_dec.c","commit_link":"github.com/mdadams/jasper/commit/d91198abd00fc435a397fe6bad906a4c1748e9cf","source_cwe_file":"cwe-190.jsonl"}} diff --git a/sven_rl_buckets/val/128_256.jsonl b/sven_rl_buckets/val/128_256.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..4c689e2c9a1d930095b477f7a4670f0e0ab0e450 --- /dev/null +++ b/sven_rl_buckets/val/128_256.jsonl @@ -0,0 +1,14 @@ +{"problem_id":"cwe-089#1-6f4a009d2b32","input":" def add_inverters(self):\n interfaces = self.config.get_connection_interfaces()\n for source in interfaces:\n if source[\"type\"] == \"inverter\":\n\n query = '''\n INSERT OR IGNORE INTO Inverters (\n Serial,\n EToday,\n ETotal\n ) VALUES (\n %s,\n %s,\n %s\n );\n ''' % (source[\"serial_id\"], 0, source[\"prev_etotal\"])\n self.c.execute(query)\n\n query = '''\n UPDATE Inverters\n SET \n Name='%s', \n Type='%s', \n SW_Version='%s', \n Status='%s',\n TimeStamp='%s'\n WHERE Serial='%s';\n ''' % (source[\"name\"], source[\"inverter_type\"], \"s0-bridge v0\", \"OK\", int(datetime.now().timestamp()), source[\"serial_id\"] )\n self.c.execute(query)\n\n self.db.commit()","target":" def add_inverters(self):\n interfaces = self.config.get_connection_interfaces()\n for source in interfaces:\n if source[\"type\"] == \"inverter\":\n\n query = '''\n INSERT OR IGNORE INTO Inverters (\n Serial,\n EToday,\n ETotal\n ) VALUES (\n ?,\n ?,\n ?\n );\n '''\n self.c.execute(query, (source[\"serial_id\"], 0, source[\"prev_etotal\"]))\n\n query = '''\n UPDATE Inverters\n SET \n Name=?, \n Type=?, \n SW_Version=?, \n Status=?,\n TimeStamp=?\n WHERE Serial=?;\n '''\n self.c.execute(query, (source[\"name\"], source[\"inverter_type\"], \"s0-bridge v0\", \"OK\", int(datetime.now().timestamp()), source[\"serial_id\"] ))\n\n self.db.commit()","lang":"python","vul_type":"cwe-089","target_token_count":183,"sven_meta":{"func_name":"add_inverters","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#4-a5385cd0f2c9","input":"def get_last_month(db, scene):\n sql = \"select date from matches where scene='{}' order by date desc limit 1;\".format(scene)\n res = db.exec(sql)\n date = res[0][0]\n\n # If it has been more than 1 month since this last tournament,\n # go ahead and round this date up by a 1 month\n # eg, if the last tournament was 2015-01-15 (a long time ago)\n # we can assume the scene won't have more tournaments\n # So just round to 2015-02-01\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n y, m, d = today.split('-')\n cy, cm, cd = date.split('-')\n if y > cy or m > cm:\n # Add 1 to the month before we return\n # eg 2018-03-01 -> 2018-04-01\n date = get_next_month(date)\n\n return date","target":"def get_last_month(db, scene):\n sql = \"select date from matches where scene='{scene}' order by date desc limit 1;\"\n args = {'scene': scene}\n res = db.exec(sql, args)\n date = res[0][0]\n\n # If it has been more than 1 month since this last tournament,\n # go ahead and round this date up by a 1 month\n # eg, if the last tournament was 2015-01-15 (a long time ago)\n # we can assume the scene won't have more tournaments\n # So just round to 2015-02-01\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n y, m, d = today.split('-')\n cy, cm, cd = date.split('-')\n if y > cy or m > cm:\n # Add 1 to the month before we return\n # eg 2018-03-01 -> 2018-04-01\n date = get_next_month(date)\n\n return date","lang":"python","vul_type":"cwe-089","target_token_count":240,"sven_meta":{"func_name":"get_last_month","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#5-839c7649fee9","input":"@app.route('/players//achievements')\ndef achievements_list_player(player_id):\n \"\"\"Lists the progress of achievements for a player.\n\n :param player_id: ID of the player.\n\n :return:\n If successful, this method returns a response body with the following structure::\n\n {\n \"items\": [\n {\n \"achievement_id\": string,\n \"state\": string,\n \"current_steps\": integer,\n \"create_time\": long,\n \"update_time\": long\n }\n ]\n }\n \"\"\"\n with db.connection:\n cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n cursor.execute(\"\"\"SELECT\n achievement_id,\n current_steps,\n state,\n UNIX_TIMESTAMP(create_time) as create_time,\n UNIX_TIMESTAMP(update_time) as update_time\n FROM player_achievements\n WHERE player_id = '%s'\"\"\" % player_id)\n\n return flask.jsonify(items=cursor.fetchall())","target":"@app.route('/players//achievements')\ndef achievements_list_player(player_id):\n \"\"\"Lists the progress of achievements for a player.\n\n :param player_id: ID of the player.\n\n :return:\n If successful, this method returns a response body with the following structure::\n\n {\n \"items\": [\n {\n \"achievement_id\": string,\n \"state\": string,\n \"current_steps\": integer,\n \"create_time\": long,\n \"update_time\": long\n }\n ]\n }\n \"\"\"\n with db.connection:\n cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n cursor.execute(\"\"\"SELECT\n achievement_id,\n current_steps,\n state,\n UNIX_TIMESTAMP(create_time) as create_time,\n UNIX_TIMESTAMP(update_time) as update_time\n FROM player_achievements\n WHERE player_id = %s\"\"\", player_id)\n\n return flask.jsonify(items=cursor.fetchall())","lang":"python","vul_type":"cwe-089","target_token_count":198,"sven_meta":{"func_name":"achievements_list_player","file_name":"api/achievements.py","commit_link":"github.com/FAForever/api/commit/5fe7f23868cd191616b088bdd5b24010f004dd5a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#18-fea1cd1a8ae7","input":"def getResults(poll_name):\n conn, c = connectDB()\n req = \"SELECT options from {} where name = '{}'\".format(CFG(\"poll_table_name\"), poll_name)\n options_str = queryOne(c, req)\n\n if not options_str:\n raise LookupError(\"Poll '{}' not found in DB\".format(poll_name))\n\n total = 0\n options = options_str.split(\",\")\n results = dict()\n for opt in options:\n count = getOptionCount(c, poll_name, opt)\n total += int(count)\n results.update({opt:count})\n\n conn.close()\n return (results, total)","target":"def getResults(poll_name):\n conn, c = connectDB()\n req = \"SELECT options from {} where name=?\".format(CFG(\"poll_table_name\"))\n options_str = queryOne(c, req, (poll_name,))\n\n if not options_str:\n raise LookupError(\"Poll '{}' not found in DB\".format(poll_name))\n\n total = 0\n options = options_str.split(\",\")\n results = dict()\n for opt in options:\n count = getOptionCount(c, poll_name, opt)\n total += int(count)\n results.update({opt:count})\n\n conn.close()\n return (results, total)","lang":"python","vul_type":"cwe-089","target_token_count":135,"sven_meta":{"func_name":"getResults","file_name":"database.py","commit_link":"github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#19-6100d3d66534","input":"def update_sources(conn, sqlite, k10plus, ai):\n \"\"\"\n Update the source table.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n old_sources = get_all_old_sources(conn, sqlite)\n\n # Check if the source table is allready filled and this is not the first checkup\n source_table_is_filled = len(old_sources) > 100\n\n for old_source in old_sources:\n if source_table_is_filled and old_source not in current_sources:\n message = \"Die SID %s ist im aktuellen Import nicht mehr vorhanden.\\nWenn dies beabsichtigt ist, bitte die SID aus der Datenbank loeschen.\" % old_source\n send_message(message)\n\n for current_source in current_sources:\n if current_source not in old_sources:\n message = \"The source %s is new in Solr.\" % current_source\n if source_table_is_filled:\n send_message(message)\n else:\n logging.info(message)\n sql = \"INSERT INTO source (source) VALUES (%s)\" % current_source\n sqlite.execute(sql)\n conn.commit()","target":"def update_sources(conn, sqlite, k10plus, ai):\n \"\"\"\n Update the source table.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n old_sources = get_all_old_sources(conn, sqlite)\n\n # Check if the source table is allready filled and this is not the first checkup\n source_table_is_filled = len(old_sources) > 100\n\n for old_source in old_sources:\n if source_table_is_filled and old_source not in current_sources:\n message = \"Die SID %s ist im aktuellen Import nicht mehr vorhanden.\\nWenn dies beabsichtigt ist, bitte die SID aus der Datenbank loeschen.\" % old_source\n send_message(message)\n\n for current_source in current_sources:\n if current_source not in old_sources:\n message = \"The source %s is new in Solr.\" % current_source\n if source_table_is_filled:\n send_message(message)\n else:\n logging.info(message)\n sql = \"INSERT INTO source (source) VALUES (?)\"\n sqlite.execute(sql, (current_source,))\n conn.commit()","lang":"python","vul_type":"cwe-089","target_token_count":236,"sven_meta":{"func_name":"update_sources","file_name":"bin/solrcheckup.py","commit_link":"github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-125#5-695fa97f705c","input":"INST_HANDLER (lds) {\t// LDS Rd, k\n\tint d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4);\n\tint k = (buf[3] << 8) | buf[2];\n\top->ptr = k;\n\n\t// load value from RAMPD:k\n\t__generic_ld_st (op, \"ram\", 0, 1, 0, k, 0);\n\tESIL_A (\"r%d,=,\", d);\n}","target":"INST_HANDLER (lds) {\t// LDS Rd, k\n\tif (len < 4) {\n\t\treturn;\n\t}\n\tint d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4);\n\tint k = (buf[3] << 8) | buf[2];\n\top->ptr = k;\n\n\t// load value from RAMPD:k\n\t__generic_ld_st (op, \"ram\", 0, 1, 0, k, 0);\n\tESIL_A (\"r%d,=,\", d);\n}","lang":"c","vul_type":"cwe-125","target_token_count":130,"sven_meta":{"func_name":"INST_HANDLER","file_name":"libr/anal/p/anal_avr.c","commit_link":"github.com/radare/radare2/commit/041e53cab7ca33481ae45ecd65ad596976d78e68","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-476#5-b4e0ca7bcf7d","input":" void Compute(OpKernelContext* ctx) override {\n const Tensor& val = ctx->input(0);\n int64 id = ctx->session_state()->GetNewId();\n TensorStore::TensorAndKey tk{val, id, requested_device()};\n OP_REQUIRES_OK(ctx, ctx->tensor_store()->AddTensor(name(), tk));\n\n Tensor* handle = nullptr;\n OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &handle));\n if (ctx->expected_output_dtype(0) == DT_RESOURCE) {\n ResourceHandle resource_handle = MakeResourceHandle(\n ctx, SessionState::kTensorHandleResourceTypeName,\n tk.GetHandle(name()));\n resource_handle.set_maybe_type_name(\n SessionState::kTensorHandleResourceTypeName);\n handle->scalar()() = resource_handle;\n } else {\n // Legacy behavior in V1.\n handle->flat().setConstant(tk.GetHandle(name()));\n }\n }","target":" void Compute(OpKernelContext* ctx) override {\n const Tensor& val = ctx->input(0);\n auto session_state = ctx->session_state();\n OP_REQUIRES(ctx, session_state != nullptr,\n errors::FailedPrecondition(\n \"GetSessionHandle called on null session state\"));\n int64 id = session_state->GetNewId();\n TensorStore::TensorAndKey tk{val, id, requested_device()};\n OP_REQUIRES_OK(ctx, ctx->tensor_store()->AddTensor(name(), tk));\n\n Tensor* handle = nullptr;\n OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &handle));\n if (ctx->expected_output_dtype(0) == DT_RESOURCE) {\n ResourceHandle resource_handle = MakeResourceHandle(\n ctx, SessionState::kTensorHandleResourceTypeName,\n tk.GetHandle(name()));\n resource_handle.set_maybe_type_name(\n SessionState::kTensorHandleResourceTypeName);\n handle->scalar()() = resource_handle;\n } else {\n // Legacy behavior in V1.\n handle->flat().setConstant(tk.GetHandle(name()));\n }\n }","lang":"cpp","vul_type":"cwe-476","target_token_count":244,"sven_meta":{"func_name":"tensorflow::GetSessionHandleOp::Compute","file_name":"tensorflow/core/kernels/session_ops.cc","commit_link":"github.com/tensorflow/tensorflow/commit/9a133d73ae4b4664d22bd1aa6d654fec13c52ee1","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-416#5-f61743563a32","input":"int blk_init_allocated_queue(struct request_queue *q)\n{\n\tWARN_ON_ONCE(q->mq_ops);\n\n\tq->fq = blk_alloc_flush_queue(q, NUMA_NO_NODE, q->cmd_size);\n\tif (!q->fq)\n\t\treturn -ENOMEM;\n\n\tif (q->init_rq_fn && q->init_rq_fn(q, q->fq->flush_rq, GFP_KERNEL))\n\t\tgoto out_free_flush_queue;\n\n\tif (blk_init_rl(&q->root_rl, q, GFP_KERNEL))\n\t\tgoto out_exit_flush_rq;\n\n\tINIT_WORK(&q->timeout_work, blk_timeout_work);\n\tq->queue_flags\t\t|= QUEUE_FLAG_DEFAULT;\n\n\t/*\n\t * This also sets hw/phys segments, boundary and size\n\t */\n\tblk_queue_make_request(q, blk_queue_bio);\n\n\tq->sg_reserved_size = INT_MAX;\n\n\tif (elevator_init(q))\n\t\tgoto out_exit_flush_rq;\n\treturn 0;\n\nout_exit_flush_rq:\n\tif (q->exit_rq_fn)\n\t\tq->exit_rq_fn(q, q->fq->flush_rq);\nout_free_flush_queue:\n\tblk_free_flush_queue(q->fq);\n\treturn -ENOMEM;\n}","target":"int blk_init_allocated_queue(struct request_queue *q)\n{\n\tWARN_ON_ONCE(q->mq_ops);\n\n\tq->fq = blk_alloc_flush_queue(q, NUMA_NO_NODE, q->cmd_size);\n\tif (!q->fq)\n\t\treturn -ENOMEM;\n\n\tif (q->init_rq_fn && q->init_rq_fn(q, q->fq->flush_rq, GFP_KERNEL))\n\t\tgoto out_free_flush_queue;\n\n\tif (blk_init_rl(&q->root_rl, q, GFP_KERNEL))\n\t\tgoto out_exit_flush_rq;\n\n\tINIT_WORK(&q->timeout_work, blk_timeout_work);\n\tq->queue_flags\t\t|= QUEUE_FLAG_DEFAULT;\n\n\t/*\n\t * This also sets hw/phys segments, boundary and size\n\t */\n\tblk_queue_make_request(q, blk_queue_bio);\n\n\tq->sg_reserved_size = INT_MAX;\n\n\tif (elevator_init(q))\n\t\tgoto out_exit_flush_rq;\n\treturn 0;\n\nout_exit_flush_rq:\n\tif (q->exit_rq_fn)\n\t\tq->exit_rq_fn(q, q->fq->flush_rq);\nout_free_flush_queue:\n\tblk_free_flush_queue(q->fq);\n\tq->fq = NULL;\n\treturn -ENOMEM;\n}","lang":"c","vul_type":"cwe-416","target_token_count":240,"sven_meta":{"func_name":"blk_init_allocated_queue","file_name":"block/blk-core.c","commit_link":"github.com/torvalds/linux/commit/54648cf1ec2d7f4b6a71767799c45676a138ca24","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-022#0-68e32b5cd09e","input":"def getKey(client):\n\t\"\"\"Retrieves the specified key for the specified client\n\tReturns an error if the key doesn't exist, obviously.\n\t\"\"\"\n\tglobal SERVER_JWT_PRIVATE_KEY\n\tglobal BAD_REQUEST\n\n\tvalidateClient(client)\n\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\n\t# Keys may only have alpha-numeric names\n\ttry:\n\t\tif re.search('[^a-zA-Z0-9]', token_data['key']):\n\t\t\traise FoxlockError(BAD_REQUEST, 'Invalid key requested')\n\t\trequested_key = open('keys/%s/%s.key' % (client, token_data['key']), 'r').read()\n\texcept KeyError:\n\t\traise FoxlockError(BAD_REQUEST, \"JWT did not contain attribute 'key'\")\n\texcept IOError:\n\t\traise FoxlockError(BAD_REQUEST, \"Key '%s' not found\" % token_data['key'])\n\n\t# Key is returned in a JWT encrypted with the client's public key, so only they can decrypt it\n\tkeytoken = packJWT({'key': requested_key}, SERVER_JWT_PRIVATE_KEY, client_pub_key)\n\n\treturn keytoken","target":"def getKey(client):\n\t\"\"\"Retrieves the specified key for the specified client\n\tReturns an error if the key doesn't exist, obviously.\n\t\"\"\"\n\tglobal SERVER_JWT_PRIVATE_KEY\n\tglobal BAD_REQUEST\n\n\tvalidateClient(client)\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateKeyName(token_data['key'])\n\n\t# Keys may only have alpha-numeric names\n\ttry:\n\t\trequested_key = open('keys/%s/%s.key' % (client, token_data['key']), 'r').read()\n\texcept KeyError:\n\t\traise FoxlockError(BAD_REQUEST, \"JWT did not contain attribute 'key'\")\n\texcept IOError:\n\t\traise FoxlockError(BAD_REQUEST, \"Key '%s' not found\" % token_data['key'])\n\n\t# Key is returned in a JWT encrypted with the client's public key, so only they can decrypt it\n\tkeytoken = packJWT({'key': requested_key}, SERVER_JWT_PRIVATE_KEY, client_pub_key)\n\n\treturn keytoken","lang":"python","vul_type":"cwe-022","target_token_count":213,"sven_meta":{"func_name":"getKey","file_name":"impl.py","commit_link":"github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#3-57ed4bb1cc30","input":" @staticmethod\n def estimate_size(task_id, taken_dirs, taken_files):\n report = AnalysisController.get_report(task_id)\n report = report[\"analysis\"]\n path = report[\"info\"][\"analysis_path\"]\n\n size_total = 0\n\n for directory in taken_dirs:\n destination = \"%s/%s\" % (path, directory)\n if os.path.isdir(destination):\n size_total += get_directory_size(destination)\n\n for filename in taken_files:\n destination = \"%s/%s\" % (path, filename)\n if os.path.isfile(destination):\n size_total += os.path.getsize(destination)\n\n # estimate file size after zipping; 60% compression rate typically\n size_estimated = size_total / 6.5\n\n return {\n \"size\": int(size_estimated),\n \"size_human\": filesizeformat(size_estimated)\n }","target":" @staticmethod\n def estimate_size(task_id, taken_dirs, taken_files):\n report = AnalysisController.get_report(task_id)\n report = report[\"analysis\"]\n path = report[\"info\"][\"analysis_path\"]\n\n size_total = 0\n\n for directory in taken_dirs:\n destination = \"%s/%s\" % (path, os.path.basename(directory))\n if os.path.isdir(destination):\n size_total += get_directory_size(destination)\n\n for filename in taken_files:\n destination = \"%s/%s\" % (path, os.path.basename(filename))\n if os.path.isfile(destination):\n size_total += os.path.getsize(destination)\n\n # estimate file size after zipping; 60% compression rate typically\n size_estimated = size_total / 6.5\n\n return {\n \"size\": int(size_estimated),\n \"size_human\": filesizeformat(size_estimated)\n }","lang":"python","vul_type":"cwe-022","target_token_count":187,"sven_meta":{"func_name":"estimate_size","file_name":"cuckoo/web/controllers/analysis/export/export.py","commit_link":"github.com/cuckoosandbox/cuckoo/commit/b90267fe4e5ee266ec3d4310a7b5c92c805b7ea3","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#5-cd467764fc9b","input":"def _get_settings(view):\n return {\n 'linters': get_settings(view, 'anaconda_go_linters', []),\n 'lint_test': get_settings(\n view, 'anaconda_go_lint_test', False),\n 'exclude_regexps': get_settings(\n view, 'anaconda_go_exclude_regexps', []),\n 'max_line_length': get_settings(\n view, 'anaconda_go_max_line_length', 120),\n 'gocyclo_threshold': get_settings(\n view, 'anaconda_go_gocyclo_threshold', 10),\n 'golint_min_confidence': get_settings(\n view, 'anaconda_go_golint_min_confidence', 0.80),\n 'goconst_min_occurrences': get_settings(\n view, 'anaconda_go_goconst_min_occurrences', 3),\n 'min_const_length': get_settings(\n view, 'anaconda_go_min_const_length', 3),\n 'dupl_threshold': get_settings(\n view, 'anaconda_go_dupl_threshold', 50),\n 'path': get_working_directory(view)\n }","target":"def _get_settings(view):\n return {\n 'linters': get_settings(view, 'anaconda_go_linters', []),\n 'lint_test': get_settings(\n view, 'anaconda_go_lint_test', False),\n 'exclude_regexps': get_settings(\n view, 'anaconda_go_exclude_regexps', []),\n 'max_line_length': get_settings(\n view, 'anaconda_go_max_line_length', 120),\n 'gocyclo_threshold': get_settings(\n view, 'anaconda_go_gocyclo_threshold', 10),\n 'golint_min_confidence': get_settings(\n view, 'anaconda_go_golint_min_confidence', 0.80),\n 'goconst_min_occurrences': get_settings(\n view, 'anaconda_go_goconst_min_occurrences', 3),\n 'min_const_length': get_settings(\n view, 'anaconda_go_min_const_length', 3),\n 'dupl_threshold': get_settings(\n view, 'anaconda_go_dupl_threshold', 50),\n 'path': os.path.dirname(view.file_name())\n }","lang":"python","vul_type":"cwe-022","target_token_count":240,"sven_meta":{"func_name":"_get_settings","file_name":"lib/_sublime.py","commit_link":"github.com/DamnWidget/anaconda_go/commit/d3db90bb8853d832927818699591b91f56f6413c","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-079#2-e3262a46f2fc","input":" def get_value(self):\n if self.column.render_function:\n # We don't want to escape our html\n return self.column.render_function(self.object)\n\n field = getattr(self.object, self.column.field_name) if self.column.field_name else None\n if type(self.object) == dict:\n value = self.object.get(self.column.field_name)\n elif callable(field):\n value = field() if getattr(field, 'do_not_call_in_templates', False) else field\n else:\n display_function = getattr(self.object, 'get_%s_display' % self.column.field_name, False)\n value = display_function() if display_function else field\n\n return escape(value)","target":" def get_value(self):\n field = getattr(self.object, self.column.field_name) if self.column.field_name else None\n if self.column.render_function:\n template = self.column.render_function(self.object)\n if not self.is_template_instance(template):\n raise SmartListException(\n 'Your render_function {} should return django.template.Template or django.template.backends.django.Template object instead of {}'.format(\n self.column.render_function.__name__,\n type(template),\n )\n )\n value = template.render()\n elif type(self.object) == dict:\n value = self.object.get(self.column.field_name)\n elif callable(field):\n value = field() if getattr(field, 'do_not_call_in_templates', False) else field\n else:\n display_function = getattr(self.object, 'get_%s_display' % self.column.field_name, False)\n value = display_function() if display_function else field\n\n return value","lang":"python","vul_type":"cwe-079","target_token_count":190,"sven_meta":{"func_name":"get_value","file_name":"smart_lists/helpers.py","commit_link":"github.com/plecto/django-smart-lists/commit/44314e51b371e01cd9bceb2e0ed6c8d75d7f87c3","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#3-35e4c0aaf5b1","input":"http_error_t::make_body (int n, const str &si, const str &aux)\n{\n strbuf b;\n str ldesc;\n const str sdesc = http_status.get_desc (n, &ldesc);\n b << \"\\n\"\n << \" \\n\"\n << \" \" << n << \" \" << sdesc << \"\\n\"\n << \" \\n\"\n << \" \\n\"\n << \"

Error \" << n << \" \" << sdesc << \"



\\n\"\n ;\n if (n == HTTP_NOT_FOUND && aux) {\n b << \"The file \" << aux \n << \" was not found on this server.

\\n\\n\";\n }\n b << \"
\\n\"\n << \" \" << si << \"\\n\"\n << \"
\\n\"\n << \" \\n\"\n << \"\\n\"\n ;\n return b;\n}","target":"http_error_t::make_body (int n, const str &si, const str &aux)\n{\n strbuf b;\n str ldesc;\n const str sdesc = xss_escape (http_status.get_desc (n, &ldesc));\n b << \"\\n\"\n << \" \\n\"\n << \" \" << n << \" \" << sdesc << \"\\n\"\n << \" \\n\"\n << \" \\n\"\n << \"

Error \" << n << \" \" << sdesc << \"



\\n\"\n ;\n if (n == HTTP_NOT_FOUND && aux) {\n b << \"The file \" << xss_escape (aux)\n << \" was not found on this server.

\\n\\n\";\n }\n b << \"
\\n\"\n << \" \" << xss_escape (si) << \"\\n\"\n << \"
\\n\"\n << \" \\n\"\n << \"\\n\"\n ;\n return b;\n}","lang":"c","vul_type":"cwe-079","target_token_count":243,"sven_meta":{"func_name":"http_error_t::make_body","file_name":"libahttp/err.C","commit_link":"github.com/okws/okws/commit/e9bedb644d106a043e33e1058bedd1c2c0b2e2e0","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-190#2-5886f3471a74","input":"size_t jsuGetFreeStack() {\n#ifdef ARM\n void *frame = __builtin_frame_address(0);\n size_t stackPos = (size_t)((char*)frame);\n size_t stackEnd = (size_t)((char*)&LINKER_END_VAR);\n if (stackPos < stackEnd) return 0; // should never happen, but just in case of overflow!\n return stackPos - stackEnd;\n#elif defined(LINUX)\n // On linux, we set STACK_BASE from `main`.\n char ptr; // this is on the stack\n extern void *STACK_BASE;\n uint32_t count = (uint32_t)((size_t)STACK_BASE - (size_t)&ptr);\n return 1000000 - count; // give it 1 megabyte of stack\n#else\n // stack depth seems pretty platform-specific :( Default to a value that disables it\n return 1000000; // no stack depth check on this platform\n#endif\n}","target":"size_t jsuGetFreeStack() {\n#ifdef ARM\n void *frame = __builtin_frame_address(0);\n size_t stackPos = (size_t)((char*)frame);\n size_t stackEnd = (size_t)((char*)&LINKER_END_VAR);\n if (stackPos < stackEnd) return 0; // should never happen, but just in case of overflow!\n return stackPos - stackEnd;\n#elif defined(LINUX)\n // On linux, we set STACK_BASE from `main`.\n char ptr; // this is on the stack\n extern void *STACK_BASE;\n uint32_t count = (uint32_t)((size_t)STACK_BASE - (size_t)&ptr);\n const uint32_t max_stack = 1000000; // give it 1 megabyte of stack\n if (count>max_stack) return 0;\n return max_stack - count;\n#else\n // stack depth seems pretty platform-specific :( Default to a value that disables it\n return 1000000; // no stack depth check on this platform\n#endif\n}","lang":"c","vul_type":"cwe-190","target_token_count":240,"sven_meta":{"func_name":"jsuGetFreeStack","file_name":"src/jsutils.c","commit_link":"github.com/espruino/Espruino/commit/a0d7f432abee692402c00e8b615ff5982dde9780","source_cwe_file":"cwe-190.jsonl"}} diff --git a/sven_rl_buckets/val/1_128.jsonl b/sven_rl_buckets/val/1_128.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..b68dbb74aa4fc72fc78033739880c97c063ec105 --- /dev/null +++ b/sven_rl_buckets/val/1_128.jsonl @@ -0,0 +1,22 @@ +{"problem_id":"cwe-089#0-dfc76ecee75b","input":" def likeComments(self,commentid,userid):\n sqlText=\"insert into comment_like values(%d,%d);\"%(userid,commentid)\n result=sql.insertDB(self.conn,sqlText)\n return result;","target":" def likeComments(self,commentid,userid):\n sqlText=\"insert into comment_like values(%s,%s);\"\n params=[userid,commentid]\n result=sql.insertDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","target_token_count":51,"sven_meta":{"func_name":"likeComments","file_name":"modules/comment.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#2-0ffbec2a3792","input":"@mod.route('/delete/', methods=['GET', 'POST'])\ndef delete(msg_id):\n if request.method == 'GET':\n sql = \"DELETE FROM message where msg_id = '%d';\" % (msg_id)\n cursor.execute(sql)\n conn.commit()\n flash('Delete Success!')\n return redirect(url_for('show_entries'))","target":"@mod.route('/delete/', methods=['GET', 'POST'])\ndef delete(msg_id):\n if request.method == 'GET':\n cursor.execute(\"DELETE FROM message where msg_id = %s;\", (msg_id,))\n conn.commit()\n flash('Delete Success!')\n return redirect(url_for('show_entries'))","lang":"python","vul_type":"cwe-089","target_token_count":68,"sven_meta":{"func_name":"delete","file_name":"flaskr/flaskr/views/message.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#3-675023f3129b","input":"def karma_rank(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n SELECT (SELECT COUNT(*) FROM people AS t2 WHERE t2.karma > t1.karma)\n AS row_Num FROM people AS t1 WHERE name='{}'\n '''.format(name))\n rank = cursor.fetchone()[0] + 1\n logger.debug('Rank of {} found for name {}'.format(rank, name))\n db.close()\n return rank\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def karma_rank(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n SELECT (SELECT COUNT(*) FROM people AS t2 WHERE t2.karma > t1.karma)\n AS row_Num FROM people AS t1 WHERE name=%(name)s\n ''', (name, ))\n rank = cursor.fetchone()[0] + 1\n logger.debug('Rank of {} found for name {}'.format(rank, name))\n db.close()\n return rank\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","target_token_count":127,"sven_meta":{"func_name":"karma_rank","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#6-3eb4912201d0","input":" def check_if_this_project_is_in_database(self, project_id):\n self.cursor.execute(\"SELECT count(id) FROM projects where id = %s\" % project_id)\n return self.cursor.fetchall()[0][0] == 1","target":" def check_if_this_project_is_in_database(self, project_id):\n self.cursor.execute(\"SELECT count(id) FROM projects where id = %s\", (project_id,))\n return self.cursor.fetchall()[0][0] == 1","lang":"python","vul_type":"cwe-089","target_token_count":48,"sven_meta":{"func_name":"check_if_this_project_is_in_database","file_name":"backend/transactions/TransactionConnector.py","commit_link":"github.com/JLucka/kickstarter-dev/commit/e2ffa062697e060fdfbd2eccbb89a8c53a569e0b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#7-d6ed886028d6","input":"@app.route(\"//edit\")\ndef edit_page(page_name):\n query = db.query(\"select * from page where title = '%s'\" % page_name).namedresult()\n if len(query) == 0:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query\n )\n else:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query[0]\n )","target":"@app.route(\"//edit\")\ndef edit_page(page_name):\n query = db.query(\"select * from page where title = $1\", page_name).namedresult()\n if len(query) == 0:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query\n )\n else:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query[0]\n )","lang":"python","vul_type":"cwe-089","target_token_count":97,"sven_meta":{"func_name":"edit_page","file_name":"server.py","commit_link":"github.com/jcortes0309/wiki_flask/commit/a6bf5316abe2eb528adf36c8241a013fd02c5ffa","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#8-f66442e7331e","input":"def reportMatch(winner, loser):\n \"\"\"Records the outcome of a single match between two players.\n\n Args:\n winner: the id number of the player who won\n loser: the id number of the player who lost\n \"\"\"\n conn = connect()\n cursor = conn.cursor()\n cursor.execute(\"INSERT INTO playsRecord (winner, loser) VALUES ('%s', '%s')\" % (winner, loser));\n conn.commit()\n conn.close()","target":"def reportMatch(winner, loser):\n \"\"\"Records the outcome of a single match between two players.\n\n Args:\n winner: the id number of the player who won\n loser: the id number of the player who lost\n \"\"\"\n conn = connect()\n cursor = conn.cursor()\n query = \"INSERT INTO playsRecord (winner, loser) VALUES (%s, %s);\"\n cursor.execute(query, (winner, loser));\n conn.commit()\n conn.close()","lang":"python","vul_type":"cwe-089","target_token_count":102,"sven_meta":{"func_name":"reportMatch","file_name":"tournament.py","commit_link":"github.com/sarahkcaplan/tournament/commit/40aba5686059f5f398f6323b1483412c56140cc0","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#9-5283547f22c3","input":"def get_game_info(conn, game):\n # get the basic game properties\n cursor = conn.cursor()\n cursor.execute(\"SELECT player1,player2,size,state FROM games WHERE id = %d;\" % game)\n if cursor.rowcount != 1:\n raise FormError(\"Invalid game ID\")\n\n row = cursor.fetchall()[0]\n players = [row[0],row[1]]\n size = row[2]\n state = row[3]\n\n if state is None:\n state = \"Active\"\n\n cursor.close()\n\n return (players,size,state)","target":"def get_game_info(conn, game):\n # get the basic game properties\n cursor = conn.cursor()\n cursor.execute(\"SELECT player1,player2,size,state FROM games WHERE id = %d;\", (game,))\n if cursor.rowcount != 1:\n raise FormError(\"Invalid game ID\")\n\n row = cursor.fetchall()[0]\n players = [row[0],row[1]]\n size = row[2]\n state = row[3]\n\n if state is None:\n state = \"Active\"\n\n cursor.close()\n\n return (players,size,state)","lang":"python","vul_type":"cwe-089","target_token_count":124,"sven_meta":{"func_name":"get_game_info","file_name":"cgi/common.py","commit_link":"github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#11-14341513f37c","input":"def update_playlist(id, name, db):\n db.execute(\n \"UPDATE playlist SET name='{name}' WHERE id={id};\".format(name=name, id=id))","target":"def update_playlist(id, name, db):\n db.execute(\"UPDATE playlist SET name=%s WHERE id=%s;\", (name, id,))","lang":"python","vul_type":"cwe-089","target_token_count":30,"sven_meta":{"func_name":"update_playlist","file_name":"playlist/playlist_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#13-4e8c70c2602d","input":"def retrieve_videos_from_playlist(playlist_id, db):\n db.execute(\"SELECT id, title, thumbnail, position from video WHERE playlist_id={playlist_id} ORDER BY position ASC;\".format(\n playlist_id=playlist_id))\n rows = db.fetchall()\n return rows","target":"def retrieve_videos_from_playlist(playlist_id, db):\n db.execute(\"SELECT id, title, thumbnail, position from video WHERE playlist_id=%s ORDER BY position ASC;\", (playlist_id,))\n rows = db.fetchall()\n return rows","lang":"python","vul_type":"cwe-089","target_token_count":48,"sven_meta":{"func_name":"retrieve_videos_from_playlist","file_name":"video/video_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#14-15e31f919ed2","input":"def create_playlist(name):\n db = connect_to_database()\n cursor = db.cursor()\n cursor.execute(\n \"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);\".format(name=name))\n db.commit()\n db.close()","target":"def create_playlist(name):\n db = connect_to_database()\n cursor = db.cursor()\n cursor.execute(\n \"INSERT INTO playlist (name, video_position) VALUES(%s, 0);\", (name,))\n db.commit()\n db.close()","lang":"python","vul_type":"cwe-089","target_token_count":52,"sven_meta":{"func_name":"create_playlist","file_name":"main_test.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#15-08854d838c25","input":"def update_video_positions(removed_position, db):\n db.execute(\"UPDATE video SET position = position - 1 WHERE position > {removed_position}\".format(\n removed_position=removed_position))","target":"def update_video_positions(removed_position, db):\n db.execute(\"UPDATE video SET position = position - 1 WHERE position > %s\", (removed_position,))","lang":"python","vul_type":"cwe-089","target_token_count":34,"sven_meta":{"func_name":"update_video_positions","file_name":"video/video_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#17-69233f4e2a93","input":"\tdef add_input(self, data):\n\t\tconnection = self.connect()\n\t\ttry:\n\t\t\t# The following introduces a deliberate security flaw.See section on SQL injection below\n\t\t\tquery = \"INSERT INTO crimes (description) VALUES('{}');\".format(data)\n\t\t\twith connection.cursor() as cursor:\n\t\t\t\tcursor.execute(query)\n\t\t\t\tconnection.commit()\n\t\tfinally:\n\t\t\tconnection.close()","target":"\tdef add_input(self, data):\n\t\tconnection = self.connect()\n\t\ttry:\n\t\t\t# The following introduces a deliberate security flaw.See section on SQL injection below\n\t\t\tquery = \"INSERT INTO crimes (description) VALUES (%s);\"\n\t\t\twith connection.cursor() as cursor:\n\t\t\t\tcursor.execute(query, data)\n\t\t\t\tconnection.commit()\n\t\tfinally:\n\t\t\tconnection.close()","lang":"python","vul_type":"cwe-089","target_token_count":75,"sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/fangyansun/crimemap/commit/a3ab652c214f801c2910e2f96e4de18848de58ae","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-125#1-d92b392e6f63","input":"int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj)\n{\n char obj_txt[128];\n\n int len = OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);\n BIO_write(bio, obj_txt, len);\n BIO_write(bio, \"\\n\", 1);\n\n return 1;\n}","target":"int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj)\n{\n char obj_txt[128];\n\n OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);\n BIO_printf(bio, \"%s\\n\", obj_txt);\n\n return 1;\n}","lang":"c","vul_type":"cwe-125","target_token_count":63,"sven_meta":{"func_name":"TS_OBJ_print_bio","file_name":"crypto/ts/ts_lib.c","commit_link":"github.com/openssl/openssl/commit/0ed26acce328ec16a3aa635f1ca37365e8c7403a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-078#1-c0b43df0fd3d","input":" def _get_vdisk_attributes(self, vdisk_name):\n \"\"\"Return vdisk attributes, or None if vdisk does not exist\n\n Exception is raised if the information from system can not be\n parsed/matched to a single vdisk.\n \"\"\"\n\n ssh_cmd = 'svcinfo lsvdisk -bytes -delim ! %s ' % vdisk_name\n return self._execute_command_and_parse_attributes(ssh_cmd)","target":" def _get_vdisk_attributes(self, vdisk_name):\n \"\"\"Return vdisk attributes, or None if vdisk does not exist\n\n Exception is raised if the information from system can not be\n parsed/matched to a single vdisk.\n \"\"\"\n\n ssh_cmd = ['svcinfo', 'lsvdisk', '-bytes', '-delim', '!', vdisk_name]\n return self._execute_command_and_parse_attributes(ssh_cmd)","lang":"python","vul_type":"cwe-078","target_token_count":93,"sven_meta":{"func_name":"_get_vdisk_attributes","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#5-181dbf70779d","input":"@app.route('/view/')\ndef view(sid):\n if '/' not in sid:\n path = os.path.join(app.config['UPLOAD_FOLDER'], sid)\n if os.path.isdir(path):\n using_firebase = 'true' if app.config['FIREBASE'] else 'false'\n return render_template('view.html',\n sid=sid, title=\"Progress for %s\" % sid, using_firebase=using_firebase)\n else:\n abort(404)\n else:\n abort(403)","target":"@app.route('/view/')\ndef view(sid):\n if utils.sid_is_valid(sid):\n path = join(app.config['UPLOAD_FOLDER'], sid)\n if os.path.isdir(path):\n using_firebase = 'true' if app.config['FIREBASE'] else 'false'\n return render_template('view.html', sid=sid,\n title=\"Progress for %s\" % sid,\n using_firebase=using_firebase)\n else:\n abort(404)\n else:\n abort(403)","lang":"python","vul_type":"cwe-078","target_token_count":110,"sven_meta":{"func_name":"view","file_name":"app/views.py","commit_link":"github.com/cheukyin699/genset-demo-site/commit/abb55b1a6786b0a995c2cdf77a7977a1d51cfc0d","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#6-0e192cb6110d","input":"def get_title_from_youtube_url(url):\n try:\n output = str(subprocess.check_output('youtube-dl --get-title %s --no-warnings' % url, stderr=subprocess.STDOUT,\n shell=True)).strip()\n except subprocess.CalledProcessError as ex:\n output = str(ex.output).strip()\n except OSError as ex:\n output = 'youtube-dl not found: %s' % ex\n except Exception as ex:\n output = 'Something bad happened: %s' % ex\n return remove_commas_from_string(output)","target":"def get_title_from_youtube_url(url):\n try:\n output = str(subprocess.check_output(['youtube-dl', '--get-title', url, '--no-warnings'],\n stderr=subprocess.STDOUT)).strip()\n except subprocess.CalledProcessError as ex:\n output = str(ex.output).strip()\n except OSError as ex:\n output = 'youtube-dl not found: %s' % ex\n except Exception as ex:\n output = 'Something bad happened: %s' % ex\n return remove_commas_from_string(output)","lang":"python","vul_type":"cwe-078","target_token_count":115,"sven_meta":{"func_name":"get_title_from_youtube_url","file_name":"src/util.py","commit_link":"github.com/w-martin/mindfulness/commit/62e1d5ce9deb57468cf917ce0ce838120ec84c46","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#8-f2cfe9c45da3","input":" def _create_3par_vlun(self, volume, hostname):\n out = self._cli_run('createvlun %s auto %s' % (volume, hostname), None)\n if out and len(out) > 1:\n if \"must be in the same domain\" in out[0]:\n err = out[0].strip()\n err = err + \" \" + out[1].strip()\n raise exception.Invalid3PARDomain(err=err)","target":" def _create_3par_vlun(self, volume, hostname):\n out = self._cli_run(['createvlun', volume, 'auto', hostname])\n if out and len(out) > 1:\n if \"must be in the same domain\" in out[0]:\n err = out[0].strip()\n err = err + \" \" + out[1].strip()\n raise exception.Invalid3PARDomain(err=err)","lang":"python","vul_type":"cwe-078","target_token_count":96,"sven_meta":{"func_name":"_create_3par_vlun","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#9-ec3e10f7a444","input":" def _set_connections(self):\n \"\"\"Set the number of concurrent connections.\n\n The 3PAR WS API server has a limit of concurrent connections.\n This is setting the number to the highest allowed, 15 connections.\n \"\"\"\n self._cli_run(\"setwsapi -sru high\", None)","target":" def _set_connections(self):\n \"\"\"Set the number of concurrent connections.\n\n The 3PAR WS API server has a limit of concurrent connections.\n This is setting the number to the highest allowed, 15 connections.\n \"\"\"\n self._cli_run(['setwsapi', '-sru', 'high'])","lang":"python","vul_type":"cwe-078","target_token_count":66,"sven_meta":{"func_name":"_set_connections","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-416#4-c2981f6cf866","input":"void usb_serial_console_disconnect(struct usb_serial *serial)\n{\n\tif (serial->port[0] == usbcons_info.port) {\n\t\tusb_serial_console_exit();\n\t\tusb_serial_put(serial);\n\t}\n}","target":"void usb_serial_console_disconnect(struct usb_serial *serial)\n{\n\tif (serial->port[0] && serial->port[0] == usbcons_info.port) {\n\t\tusb_serial_console_exit();\n\t\tusb_serial_put(serial);\n\t}\n}","lang":"c","vul_type":"cwe-416","target_token_count":51,"sven_meta":{"func_name":"usb_serial_console_disconnect","file_name":"drivers/usb/serial/console.c","commit_link":"github.com/torvalds/linux/commit/bd998c2e0df0469707503023d50d46cf0b10c787","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-022#4-0b32e23f8f22","input":" def span(self, key):\n path = os.path.join(self.namespace, key)\n try:\n self.etcd.write(path, None, dir=True, prevExist=False)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error storing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to store key')","target":" def span(self, key):\n path = self._absolute_key(key)\n try:\n self.etcd.write(path, None, dir=True, prevExist=False)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error storing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to store key')","lang":"python","vul_type":"cwe-022","target_token_count":100,"sven_meta":{"func_name":"span","file_name":"custodia/store/etcdstore.py","commit_link":"github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-079#1-f5b73f1c28f1","input":" def redirect(self, url, **kwargs):\n \"\"\"Explicitly converts url to 'str', because webapp2.RequestHandler.redirect\n strongly requires 'str' but url might be an unicode string.\"\"\"\n super(Handler, self).redirect(str(url), **kwargs)","target":" def redirect(self, url, **kwargs):\n \"\"\"Explicitly converts url to 'str', because webapp2.RequestHandler.redirect\n strongly requires 'str' but url might be an unicode string.\"\"\"\n url = str(url)\n check_redirect_url(url)\n super(Handler, self).redirect(url, **kwargs)","lang":"python","vul_type":"cwe-079","target_token_count":67,"sven_meta":{"func_name":"redirect","file_name":"src/appengine/handlers/base_handler.py","commit_link":"github.com/google/clusterfuzz/commit/3d66c1146550eecd4e34d47332a8616b435a21fe","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#4-62957905f62d","input":"def list_editor_workflows(request): \n workflows = [d.content_object.to_dict() for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]\n\n return render('editor/list_editor_workflows.mako', request, {\n 'workflows_json': json.dumps(workflows)\n })","target":"def list_editor_workflows(request): \n workflows = [d.content_object.to_dict() for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]\n\n return render('editor/list_editor_workflows.mako', request, {\n 'workflows_json': json.dumps(workflows, cls=JSONEncoderForHTML)\n })","lang":"python","vul_type":"cwe-079","target_token_count":72,"sven_meta":{"func_name":"list_editor_workflows","file_name":"apps/oozie/src/oozie/views/editor2.py","commit_link":"github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735","source_cwe_file":"cwe-079.jsonl"}} diff --git a/sven_rl_buckets/val/256_512.jsonl b/sven_rl_buckets/val/256_512.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..2e4a81ecdfa0d8581f731a17008b906536f96532 --- /dev/null +++ b/sven_rl_buckets/val/256_512.jsonl @@ -0,0 +1,15 @@ +{"problem_id":"cwe-089#12-0955f5d98dec","input":" def get_requested_month(self, date):\n data = dict()\n\n month_start, month_end = self.get_epoch_month(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}\n month_total = 0\n\n query = '''\n SELECT TimeStamp, SUM(DayYield) AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN %s AND %s\n GROUP BY TimeStamp\n '''\n\n data['data'] = list()\n for row in self.c.execute(query % (month_start, month_end)):\n data['data'].append({'time': self.convert_local_ts_to_utc(row[0], self.local_timezone), 'power': row[1]})\n month_total += row[1]\n\n data['total'] = month_total\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM ( SELECT TimeStamp FROM MonthData GROUP BY TimeStamp );\n '''\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if first_data: data['hasPrevious'] = (first_data < month_start)\n else: data['hasPrevious'] = False\n if last_data: data['hasNext'] = (last_data > month_end)\n else: data['hasNext'] = False\n\n return data","target":" def get_requested_month(self, date):\n data = dict()\n\n month_start, month_end = self.get_epoch_month(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}\n month_total = 0\n\n query = '''\n SELECT TimeStamp, SUM(DayYield) AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN ? AND ?\n GROUP BY TimeStamp;\n '''\n\n data['data'] = list()\n for row in self.c.execute(query, (month_start, month_end)):\n data['data'].append({'time': self.convert_local_ts_to_utc(row[0], self.local_timezone), 'power': row[1]})\n month_total += row[1]\n\n data['total'] = month_total\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM ( SELECT TimeStamp FROM MonthData GROUP BY TimeStamp );\n '''\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if first_data: data['hasPrevious'] = (first_data < month_start)\n else: data['hasPrevious'] = False\n if last_data: data['hasNext'] = (last_data > month_end)\n else: data['hasNext'] = False\n\n return data","lang":"python","vul_type":"cwe-089","target_token_count":296,"sven_meta":{"func_name":"get_requested_month","file_name":"util/database.py","commit_link":"github.com/philipptrenz/sunportal/commit/7eef493a168ed4e6731ff800713bfb8aee99a506","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#16-887d1e8b6c0a","input":" @staticmethod\n def _check_camera_tags(tags):\n \"\"\"\n Function that convert stupid code name of a smartphone or camera\n from EXIF to meaningful one by looking a collation in a special MySQL\n table For example instead of just Nikon there can be\n NIKON CORPORATION in EXIF\n\n :param tags: name of a camera and lens from EXIF\n :return: list with one or two strings which are name of\n camera and/or lens. If there is not better name for the gadget\n in database, function just returns name how it is\n \"\"\"\n checked_tags = []\n\n for tag in tags:\n if tag: # If there was this information inside EXIF of the photo\n tag = str(tag).strip()\n log.info('Looking up collation for %s', tag)\n query = ('SELECT right_tag '\n 'FROM tag_table '\n 'WHERE wrong_tag=\"{}\"'.format(tag))\n cursor = db.execute_query(query)\n if not cursor:\n log.error(\"Can't check the tag because of the db error\")\n log.warning(\"Tag will stay as is.\")\n continue\n if cursor.rowcount:\n # Get appropriate tag from the table\n tag = cursor.fetchone()[0]\n log.info('Tag after looking up in tag_tables - %s.', tag)\n\n checked_tags.append(tag)\n return checked_tags","target":" @staticmethod\n def _check_camera_tags(tags):\n \"\"\"\n Function that convert stupid code name of a smartphone or camera\n from EXIF to meaningful one by looking a collation in a special MySQL\n table For example instead of just Nikon there can be\n NIKON CORPORATION in EXIF\n\n :param tags: name of a camera and lens from EXIF\n :return: list with one or two strings which are name of\n camera and/or lens. If there is not better name for the gadget\n in database, function just returns name how it is\n \"\"\"\n checked_tags = []\n\n for tag in tags:\n if tag: # If there was this information inside EXIF of the photo\n tag = str(tag).strip()\n log.info('Looking up collation for %s', tag)\n query = ('SELECT right_tag '\n 'FROM tag_table '\n 'WHERE wrong_tag=%s')\n parameters = tag,\n cursor = db.execute_query(query, parameters)\n if not cursor:\n log.error(\"Can't check the tag because of the db error\")\n log.warning(\"Tag will stay as is.\")\n continue\n if cursor.rowcount:\n # Get appropriate tag from the table\n tag = cursor.fetchone()[0]\n log.info('Tag after looking up in tag_tables - %s.', tag)\n\n checked_tags.append(tag)\n return checked_tags","lang":"python","vul_type":"cwe-089","target_token_count":296,"sven_meta":{"func_name":"_check_camera_tags","file_name":"photogpsbot/process_image.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-125#0-fc6540dac2d4","input":"search_make_new(const struct search_state *const state, int n, const char *const base_name) {\n\tconst size_t base_len = strlen(base_name);\n\tconst char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;\n\tstruct search_domain *dom;\n\n\tfor (dom = state->head; dom; dom = dom->next) {\n\t\tif (!n--) {\n\t\t\t/* this is the postfix we want */\n\t\t\t/* the actual postfix string is kept at the end of the structure */\n\t\t\tconst u8 *const postfix = ((u8 *) dom) + sizeof(struct search_domain);\n\t\t\tconst int postfix_len = dom->len;\n\t\t\tchar *const newname = (char *) mm_malloc(base_len + need_to_append_dot + postfix_len + 1);\n\t\t\tif (!newname) return NULL;\n\t\t\tmemcpy(newname, base_name, base_len);\n\t\t\tif (need_to_append_dot) newname[base_len] = '.';\n\t\t\tmemcpy(newname + base_len + need_to_append_dot, postfix, postfix_len);\n\t\t\tnewname[base_len + need_to_append_dot + postfix_len] = 0;\n\t\t\treturn newname;\n\t\t}\n\t}\n\n\t/* we ran off the end of the list and still didn't find the requested string */\n\tEVUTIL_ASSERT(0);\n\treturn NULL; /* unreachable; stops warnings in some compilers. */\n}","target":"search_make_new(const struct search_state *const state, int n, const char *const base_name) {\n\tconst size_t base_len = strlen(base_name);\n\tchar need_to_append_dot;\n\tstruct search_domain *dom;\n\n\tif (!base_len) return NULL;\n\tneed_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;\n\n\tfor (dom = state->head; dom; dom = dom->next) {\n\t\tif (!n--) {\n\t\t\t/* this is the postfix we want */\n\t\t\t/* the actual postfix string is kept at the end of the structure */\n\t\t\tconst u8 *const postfix = ((u8 *) dom) + sizeof(struct search_domain);\n\t\t\tconst int postfix_len = dom->len;\n\t\t\tchar *const newname = (char *) mm_malloc(base_len + need_to_append_dot + postfix_len + 1);\n\t\t\tif (!newname) return NULL;\n\t\t\tmemcpy(newname, base_name, base_len);\n\t\t\tif (need_to_append_dot) newname[base_len] = '.';\n\t\t\tmemcpy(newname + base_len + need_to_append_dot, postfix, postfix_len);\n\t\t\tnewname[base_len + need_to_append_dot + postfix_len] = 0;\n\t\t\treturn newname;\n\t\t}\n\t}\n\n\t/* we ran off the end of the list and still didn't find the requested string */\n\tEVUTIL_ASSERT(0);\n\treturn NULL; /* unreachable; stops warnings in some compilers. */\n}","lang":"c","vul_type":"cwe-125","target_token_count":304,"sven_meta":{"func_name":"search_make_new","file_name":"evdns.c","commit_link":"github.com/libevent/libevent/commit/ec65c42052d95d2c23d1d837136d1cf1d9ecef9e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#2-0976a5319794","input":"int main(int argc, char *argv[])\n{\n FILE *iplist = NULL;\n plist_t root_node = NULL;\n char *plist_out = NULL;\n uint32_t size = 0;\n int read_size = 0;\n char *plist_entire = NULL;\n struct stat filestats;\n options_t *options = parse_arguments(argc, argv);\n\n if (!options)\n {\n print_usage(argc, argv);\n return 0;\n }\n\n // read input file\n iplist = fopen(options->in_file, \"rb\");\n if (!iplist) {\n free(options);\n return 1;\n }\n\n stat(options->in_file, &filestats);\n plist_entire = (char *) malloc(sizeof(char) * (filestats.st_size + 1));\n read_size = fread(plist_entire, sizeof(char), filestats.st_size, iplist);\n fclose(iplist);\n\n // convert from binary to xml or vice-versa\n if (memcmp(plist_entire, \"bplist00\", 8) == 0)\n {\n plist_from_bin(plist_entire, read_size, &root_node);\n plist_to_xml(root_node, &plist_out, &size);\n }\n else\n {\n plist_from_xml(plist_entire, read_size, &root_node);\n plist_to_bin(root_node, &plist_out, &size);\n }\n plist_free(root_node);\n free(plist_entire);\n\n if (plist_out)\n {\n if (options->out_file != NULL)\n {\n FILE *oplist = fopen(options->out_file, \"wb\");\n if (!oplist) {\n free(options);\n return 1;\n }\n fwrite(plist_out, size, sizeof(char), oplist);\n fclose(oplist);\n }\n // if no output file specified, write to stdout\n else\n fwrite(plist_out, size, sizeof(char), stdout);\n\n free(plist_out);\n }\n else\n printf(\"ERROR: Failed to convert input file.\\n\");\n\n free(options);\n return 0;\n}","target":"int main(int argc, char *argv[])\n{\n FILE *iplist = NULL;\n plist_t root_node = NULL;\n char *plist_out = NULL;\n uint32_t size = 0;\n int read_size = 0;\n char *plist_entire = NULL;\n struct stat filestats;\n options_t *options = parse_arguments(argc, argv);\n\n if (!options)\n {\n print_usage(argc, argv);\n return 0;\n }\n\n // read input file\n iplist = fopen(options->in_file, \"rb\");\n if (!iplist) {\n free(options);\n return 1;\n }\n\n stat(options->in_file, &filestats);\n\n if (filestats.st_size < 8) {\n printf(\"ERROR: Input file is too small to contain valid plist data.\\n\");\n return -1;\n }\n\n plist_entire = (char *) malloc(sizeof(char) * (filestats.st_size + 1));\n read_size = fread(plist_entire, sizeof(char), filestats.st_size, iplist);\n fclose(iplist);\n\n // convert from binary to xml or vice-versa\n if (memcmp(plist_entire, \"bplist00\", 8) == 0)\n {\n plist_from_bin(plist_entire, read_size, &root_node);\n plist_to_xml(root_node, &plist_out, &size);\n }\n else\n {\n plist_from_xml(plist_entire, read_size, &root_node);\n plist_to_bin(root_node, &plist_out, &size);\n }\n plist_free(root_node);\n free(plist_entire);\n\n if (plist_out)\n {\n if (options->out_file != NULL)\n {\n FILE *oplist = fopen(options->out_file, \"wb\");\n if (!oplist) {\n free(options);\n return 1;\n }\n fwrite(plist_out, size, sizeof(char), oplist);\n fclose(oplist);\n }\n // if no output file specified, write to stdout\n else\n fwrite(plist_out, size, sizeof(char), stdout);\n\n free(plist_out);\n }\n else\n printf(\"ERROR: Failed to convert input file.\\n\");\n\n free(options);\n return 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":487,"sven_meta":{"func_name":"main","file_name":"tools/plistutil.c","commit_link":"github.com/libimobiledevice/libplist/commit/7391a506352c009fe044dead7baad9e22dd279ee","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#6-82db917d9f97","input":"static int jpeg_size(unsigned char* data, unsigned int data_size,\n int *width, int *height)\n{\n int i = 0;\n if (i + 3 < data_size && data[i] == 0xFF && data[i+1] == 0xD8 &&\n data[i+2] == 0xFF && data[i+3] == 0xE0) {\n i += 4;\n if(i + 6 < data_size &&\n data[i+2] == 'J' && data[i+3] == 'F' && data[i+4] == 'I' &&\n data[i+5] == 'F' && data[i+6] == 0x00) {\n unsigned short block_length = data[i] * 256 + data[i+1];\n while(i= data_size)\n return -1;\n if(data[i] != 0xFF)\n return -1;\n if(data[i+1] == 0xC0) {\n *height = data[i+5]*256 + data[i+6];\n *width = data[i+7]*256 + data[i+8];\n return 0;\n }\n i+=2;\n block_length = data[i] * 256 + data[i+1];\n }\n }\n }\n\n return -1;\n}","target":"static int jpeg_size(unsigned char* data, unsigned int data_size,\n int *width, int *height)\n{\n int i = 0;\n if (i + 3 < data_size && data[i] == 0xFF && data[i+1] == 0xD8 &&\n data[i+2] == 0xFF && data[i+3] == 0xE0) {\n i += 4;\n if(i + 6 < data_size &&\n data[i+2] == 'J' && data[i+3] == 'F' && data[i+4] == 'I' &&\n data[i+5] == 'F' && data[i+6] == 0x00) {\n unsigned short block_length = data[i] * 256 + data[i+1];\n while(i= data_size)\n return -1;\n if(data[i] != 0xFF)\n return -1;\n if(data[i+1] == 0xC0) {\n *height = data[i+5]*256 + data[i+6];\n *width = data[i+7]*256 + data[i+8];\n return 0;\n }\n i+=2;\n if (i + 1 < data_size)\n block_length = data[i] * 256 + data[i+1];\n }\n }\n }\n\n return -1;\n}","lang":"c","vul_type":"cwe-125","target_token_count":323,"sven_meta":{"func_name":"jpeg_size","file_name":"pdfgen.c","commit_link":"github.com/AndreRenaud/PDFGen/commit/ee58aff6918b8bbc3be29b9e3089485ea46ff956","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#14-a4d3f21d2cf3","input":"static Array HHVM_METHOD(Memcache, getextendedstats,\n const String& /*type*/ /* = null_string */,\n int /*slabid*/ /* = 0 */, int /*limit*/ /* = 100 */) {\n auto data = Native::data(this_);\n memcached_return_t ret;\n memcached_stat_st *stats;\n\n stats = memcached_stat(&data->m_memcache, nullptr, &ret);\n if (ret != MEMCACHED_SUCCESS) {\n return Array();\n }\n\n int server_count = memcached_server_count(&data->m_memcache);\n\n Array return_val;\n\n for (int server_id = 0; server_id < server_count; server_id++) {\n memcached_stat_st *stat;\n char stats_key[30] = {0};\n size_t key_len;\n\n LMCD_SERVER_POSITION_INSTANCE_TYPE instance =\n memcached_server_instance_by_position(&data->m_memcache, server_id);\n const char *hostname = LMCD_SERVER_HOSTNAME(instance);\n in_port_t port = LMCD_SERVER_PORT(instance);\n\n stat = stats + server_id;\n\n Array server_stats = memcache_build_stats(&data->m_memcache, stat, &ret);\n if (ret != MEMCACHED_SUCCESS) {\n continue;\n }\n\n key_len = snprintf(stats_key, sizeof(stats_key), \"%s:%d\", hostname, port);\n\n return_val.set(String(stats_key, key_len, CopyString), server_stats);\n }\n\n free(stats);\n return return_val;\n}","target":"static Array HHVM_METHOD(Memcache, getextendedstats,\n const String& /*type*/ /* = null_string */,\n int /*slabid*/ /* = 0 */, int /*limit*/ /* = 100 */) {\n auto data = Native::data(this_);\n memcached_return_t ret;\n memcached_stat_st *stats;\n\n stats = memcached_stat(&data->m_memcache, nullptr, &ret);\n if (ret != MEMCACHED_SUCCESS) {\n return Array();\n }\n\n int server_count = memcached_server_count(&data->m_memcache);\n\n Array return_val;\n\n for (int server_id = 0; server_id < server_count; server_id++) {\n memcached_stat_st *stat;\n LMCD_SERVER_POSITION_INSTANCE_TYPE instance =\n memcached_server_instance_by_position(&data->m_memcache, server_id);\n const char *hostname = LMCD_SERVER_HOSTNAME(instance);\n in_port_t port = LMCD_SERVER_PORT(instance);\n\n stat = stats + server_id;\n\n Array server_stats = memcache_build_stats(&data->m_memcache, stat, &ret);\n if (ret != MEMCACHED_SUCCESS) {\n continue;\n }\n\n auto const port_str = folly::to(port);\n auto const key_len = strlen(hostname) + 1 + port_str.length();\n auto key = String(key_len, ReserveString);\n key += hostname;\n key += \":\";\n key += port_str;\n return_val.set(key, server_stats);\n }\n\n free(stats);\n return return_val;\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":338,"sven_meta":{"func_name":"HPHP::HHVM_METHOD","file_name":"hphp/runtime/ext/memcache/ext_memcache.cpp","commit_link":"github.com/facebook/hhvm/commit/4bff3bfbe90d10451e4638c2118d1ad1117bb3e3","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-078#2-88e5cf802a30","input":"def git_hook(strict=False, modify=False):\n \"\"\"\n Git pre-commit hook to check staged files for isort errors\n\n :param bool strict - if True, return number of errors on exit,\n causing the hook to fail. If False, return zero so it will\n just act as a warning.\n :param bool modify - if True, fix the sources if they are not\n sorted properly. If False, only report result without\n modifying anything.\n\n :return number of errors if in strict mode, 0 otherwise.\n \"\"\"\n\n # Get list of files modified and staged\n diff_cmd = \"git diff-index --cached --name-only --diff-filter=ACMRTUXB HEAD\"\n files_modified = get_lines(diff_cmd)\n\n errors = 0\n for filename in files_modified:\n if filename.endswith('.py'):\n # Get the staged contents of the file\n staged_cmd = \"git show :%s\" % filename\n staged_contents = get_output(staged_cmd)\n\n sort = SortImports(\n file_path=filename,\n file_contents=staged_contents.decode(),\n check=True\n )\n\n if sort.incorrectly_sorted:\n errors += 1\n if modify:\n SortImports(\n file_path=filename,\n file_contents=staged_contents.decode(),\n check=False,\n )\n\n return errors if strict else 0","target":"def git_hook(strict=False, modify=False):\n \"\"\"\n Git pre-commit hook to check staged files for isort errors\n\n :param bool strict - if True, return number of errors on exit,\n causing the hook to fail. If False, return zero so it will\n just act as a warning.\n :param bool modify - if True, fix the sources if they are not\n sorted properly. If False, only report result without\n modifying anything.\n\n :return number of errors if in strict mode, 0 otherwise.\n \"\"\"\n\n # Get list of files modified and staged\n diff_cmd = [\"git\", \"diff-index\", \"--cached\", \"--name-only\", \"--diff-filter=ACMRTUXB HEAD\"]\n files_modified = get_lines(diff_cmd)\n\n errors = 0\n for filename in files_modified:\n if filename.endswith('.py'):\n # Get the staged contents of the file\n staged_cmd = [\"git\", \"show\", \":%s\" % filename]\n staged_contents = get_output(staged_cmd)\n\n sort = SortImports(\n file_path=filename,\n file_contents=staged_contents,\n check=True\n )\n\n if sort.incorrectly_sorted:\n errors += 1\n if modify:\n SortImports(\n file_path=filename,\n file_contents=staged_contents,\n check=False,\n )\n\n return errors if strict else 0","lang":"python","vul_type":"cwe-078","target_token_count":295,"sven_meta":{"func_name":"git_hook","file_name":"isort/hooks.py","commit_link":"github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#3-8035e4e0e399","input":" def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_NO_HOST_RET), ''])\n\n create_host_cmd = ('createhost -iscsi -add fakehost '\n 'iqn.1993-08.org.debian:01:222')\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","target":" def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_NO_HOST_RET), ''])\n\n create_host_cmd = ['createhost', '-iscsi', '-add', 'fakehost',\n 'iqn.1993-08.org.debian:01:222']\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","lang":"python","vul_type":"cwe-078","target_token_count":282,"sven_meta":{"func_name":"test_create_modify_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#4-d492b51213ce","input":" def _run_ssh(self, command, check_exit_code=True, attempts=1):\n if not self.sshpool:\n password = self.configuration.san_password\n privatekey = self.configuration.san_private_key\n min_size = self.configuration.ssh_min_pool_conn\n max_size = self.configuration.ssh_max_pool_conn\n self.sshpool = utils.SSHPool(self.configuration.san_ip,\n self.configuration.san_ssh_port,\n self.configuration.ssh_conn_timeout,\n self.configuration.san_login,\n password=password,\n privatekey=privatekey,\n min_size=min_size,\n max_size=max_size)\n last_exception = None\n try:\n total_attempts = attempts\n with self.sshpool.item() as ssh:\n while attempts > 0:\n attempts -= 1\n try:\n return utils.ssh_execute(\n ssh,\n command,\n check_exit_code=check_exit_code)\n except Exception as e:\n LOG.error(e)\n last_exception = e\n greenthread.sleep(random.randint(20, 500) / 100.0)\n try:\n raise exception.ProcessExecutionError(\n exit_code=last_exception.exit_code,\n stdout=last_exception.stdout,\n stderr=last_exception.stderr,\n cmd=last_exception.cmd)\n except AttributeError:\n raise exception.ProcessExecutionError(\n exit_code=-1,\n stdout=\"\",\n stderr=\"Error running SSH command\",\n cmd=command)\n\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error running SSH command: %s\") % command)","target":" def _run_ssh(self, cmd_list, check_exit_code=True, attempts=1):\n utils.check_ssh_injection(cmd_list)\n command = ' '. join(cmd_list)\n\n if not self.sshpool:\n password = self.configuration.san_password\n privatekey = self.configuration.san_private_key\n min_size = self.configuration.ssh_min_pool_conn\n max_size = self.configuration.ssh_max_pool_conn\n self.sshpool = utils.SSHPool(self.configuration.san_ip,\n self.configuration.san_ssh_port,\n self.configuration.ssh_conn_timeout,\n self.configuration.san_login,\n password=password,\n privatekey=privatekey,\n min_size=min_size,\n max_size=max_size)\n last_exception = None\n try:\n total_attempts = attempts\n with self.sshpool.item() as ssh:\n while attempts > 0:\n attempts -= 1\n try:\n return utils.ssh_execute(\n ssh,\n command,\n check_exit_code=check_exit_code)\n except Exception as e:\n LOG.error(e)\n last_exception = e\n greenthread.sleep(random.randint(20, 500) / 100.0)\n try:\n raise exception.ProcessExecutionError(\n exit_code=last_exception.exit_code,\n stdout=last_exception.stdout,\n stderr=last_exception.stderr,\n cmd=last_exception.cmd)\n except AttributeError:\n raise exception.ProcessExecutionError(\n exit_code=-1,\n stdout=\"\",\n stderr=\"Error running SSH command\",\n cmd=command)\n\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error running SSH command: %s\") % command)","lang":"python","vul_type":"cwe-078","target_token_count":361,"sven_meta":{"func_name":"_run_ssh","file_name":"cinder/volume/drivers/san/san.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#7-35e4733721a9","input":" def test_get_ports(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = 'showport'\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = 'showport -iscsi'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = 'showport -iscsiname'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI),\n ''])\n self.mox.ReplayAll()\n\n ports = self.driver.common.get_ports()\n self.assertEqual(ports['FC'][0], '20210002AC00383D')\n self.assertEqual(ports['iSCSI']['10.10.120.252']['nsp'], '0:8:2')","target":" def test_get_ports(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = ['showport']\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = ['showport', '-iscsi']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = ['showport', '-iscsiname']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI),\n ''])\n self.mox.ReplayAll()\n\n ports = self.driver.common.get_ports()\n self.assertEqual(ports['FC'][0], '20210002AC00383D')\n self.assertEqual(ports['iSCSI']['10.10.120.252']['nsp'], '0:8:2')","lang":"python","vul_type":"cwe-078","target_token_count":258,"sven_meta":{"func_name":"test_get_ports","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#10-511f80696d9d","input":" def _get_chap_secret_for_host(self, host_name):\n \"\"\"Return the CHAP secret for the given host.\"\"\"\n\n LOG.debug(_('enter: _get_chap_secret_for_host: host name %s')\n % host_name)\n\n ssh_cmd = 'svcinfo lsiscsiauth -delim !'\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return None\n\n host_lines = out.strip().split('\\n')\n self._assert_ssh_return(len(host_lines), '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('name' in header, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_auth_method' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_chap_secret' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n name_index = header.index('name')\n method_index = header.index('iscsi_auth_method')\n secret_index = header.index('iscsi_chap_secret')\n\n chap_secret = None\n host_found = False\n for line in host_lines:\n info = line.split('!')\n if info[name_index] == host_name:\n host_found = True\n if info[method_index] == 'chap':\n chap_secret = info[secret_index]\n\n self._assert_ssh_return(host_found, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n LOG.debug(_('leave: _get_chap_secret_for_host: host name '\n '%(host_name)s with secret %(chap_secret)s')\n % {'host_name': host_name, 'chap_secret': chap_secret})\n\n return chap_secret","target":" def _get_chap_secret_for_host(self, host_name):\n \"\"\"Return the CHAP secret for the given host.\"\"\"\n\n LOG.debug(_('enter: _get_chap_secret_for_host: host name %s')\n % host_name)\n\n ssh_cmd = ['svcinfo', 'lsiscsiauth', '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return None\n\n host_lines = out.strip().split('\\n')\n self._assert_ssh_return(len(host_lines), '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('name' in header, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_auth_method' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_chap_secret' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n name_index = header.index('name')\n method_index = header.index('iscsi_auth_method')\n secret_index = header.index('iscsi_chap_secret')\n\n chap_secret = None\n host_found = False\n for line in host_lines:\n info = line.split('!')\n if info[name_index] == host_name:\n host_found = True\n if info[method_index] == 'chap':\n chap_secret = info[secret_index]\n\n self._assert_ssh_return(host_found, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n LOG.debug(_('leave: _get_chap_secret_for_host: host name '\n '%(host_name)s with secret %(chap_secret)s')\n % {'host_name': host_name, 'chap_secret': chap_secret})\n\n return chap_secret","lang":"python","vul_type":"cwe-078","target_token_count":405,"sven_meta":{"func_name":"_get_chap_secret_for_host","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-476#1-a95c0f6c9f72","input":"static bool check_client_passwd(PgSocket *client, const char *passwd)\n{\n\tchar md5[MD5_PASSWD_LEN + 1];\n\tconst char *correct;\n\tPgUser *user = client->auth_user;\n\n\t/* disallow empty passwords */\n\tif (!*passwd || !*user->passwd)\n\t\treturn false;\n\n\tswitch (cf_auth_type) {\n\tcase AUTH_PLAIN:\n\t\treturn strcmp(user->passwd, passwd) == 0;\n\tcase AUTH_CRYPT:\n\t\tcorrect = crypt(user->passwd, (char *)client->tmp_login_salt);\n\t\treturn correct && strcmp(correct, passwd) == 0;\n\tcase AUTH_MD5:\n\t\tif (strlen(passwd) != MD5_PASSWD_LEN)\n\t\t\treturn false;\n\t\tif (!isMD5(user->passwd))\n\t\t\tpg_md5_encrypt(user->passwd, user->name, strlen(user->name), user->passwd);\n\t\tpg_md5_encrypt(user->passwd + 3, (char *)client->tmp_login_salt, 4, md5);\n\t\treturn strcmp(md5, passwd) == 0;\n\t}\n\treturn false;\n}","target":"static bool check_client_passwd(PgSocket *client, const char *passwd)\n{\n\tchar md5[MD5_PASSWD_LEN + 1];\n\tconst char *correct;\n\tPgUser *user = client->auth_user;\n\n\t/* auth_user may be missing */\n\tif (!user) {\n\t\tslog_error(client, \"Password packet before auth packet?\");\n\t\treturn false;\n\t}\n\n\t/* disallow empty passwords */\n\tif (!*passwd || !*user->passwd)\n\t\treturn false;\n\n\tswitch (cf_auth_type) {\n\tcase AUTH_PLAIN:\n\t\treturn strcmp(user->passwd, passwd) == 0;\n\tcase AUTH_CRYPT:\n\t\tcorrect = crypt(user->passwd, (char *)client->tmp_login_salt);\n\t\treturn correct && strcmp(correct, passwd) == 0;\n\tcase AUTH_MD5:\n\t\tif (strlen(passwd) != MD5_PASSWD_LEN)\n\t\t\treturn false;\n\t\tif (!isMD5(user->passwd))\n\t\t\tpg_md5_encrypt(user->passwd, user->name, strlen(user->name), user->passwd);\n\t\tpg_md5_encrypt(user->passwd + 3, (char *)client->tmp_login_salt, 4, md5);\n\t\treturn strcmp(md5, passwd) == 0;\n\t}\n\treturn false;\n}","lang":"c","vul_type":"cwe-476","target_token_count":263,"sven_meta":{"func_name":"check_client_passwd","file_name":"src/client.c","commit_link":"github.com/pgbouncer/pgbouncer/commit/edab5be6665b9e8de66c25ba527509b229468573","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#2-25352d3438ce","input":"static void rds_tcp_kill_sock(struct net *net)\n{\n\tstruct rds_tcp_connection *tc, *_tc;\n\tstruct sock *sk;\n\tLIST_HEAD(tmp_list);\n\tstruct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid);\n\n\trds_tcp_listen_stop(rtn->rds_tcp_listen_sock);\n\trtn->rds_tcp_listen_sock = NULL;\n\tflush_work(&rtn->rds_tcp_accept_w);\n\tspin_lock_irq(&rds_tcp_conn_lock);\n\tlist_for_each_entry_safe(tc, _tc, &rds_tcp_conn_list, t_tcp_node) {\n\t\tstruct net *c_net = read_pnet(&tc->conn->c_net);\n\n\t\tif (net != c_net)\n\t\t\tcontinue;\n\t\tlist_move_tail(&tc->t_tcp_node, &tmp_list);\n\t}\n\tspin_unlock_irq(&rds_tcp_conn_lock);\n\tlist_for_each_entry_safe(tc, _tc, &tmp_list, t_tcp_node) {\n\t\tsk = tc->t_sock->sk;\n\t\tsk->sk_prot->disconnect(sk, 0);\n\t\ttcp_done(sk);\n\t\tif (tc->conn->c_passive)\n\t\t\trds_conn_destroy(tc->conn->c_passive);\n\t\trds_conn_destroy(tc->conn);\n\t}\n}","target":"static void rds_tcp_kill_sock(struct net *net)\n{\n\tstruct rds_tcp_connection *tc, *_tc;\n\tstruct sock *sk;\n\tLIST_HEAD(tmp_list);\n\tstruct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid);\n\n\trds_tcp_listen_stop(rtn->rds_tcp_listen_sock);\n\trtn->rds_tcp_listen_sock = NULL;\n\tflush_work(&rtn->rds_tcp_accept_w);\n\tspin_lock_irq(&rds_tcp_conn_lock);\n\tlist_for_each_entry_safe(tc, _tc, &rds_tcp_conn_list, t_tcp_node) {\n\t\tstruct net *c_net = read_pnet(&tc->conn->c_net);\n\n\t\tif (net != c_net)\n\t\t\tcontinue;\n\t\tlist_move_tail(&tc->t_tcp_node, &tmp_list);\n\t}\n\tspin_unlock_irq(&rds_tcp_conn_lock);\n\tlist_for_each_entry_safe(tc, _tc, &tmp_list, t_tcp_node) {\n\t\tif (tc->t_sock) {\n\t\t\tsk = tc->t_sock->sk;\n\t\t\tsk->sk_prot->disconnect(sk, 0);\n\t\t\ttcp_done(sk);\n\t\t}\n\t\tif (tc->conn->c_passive)\n\t\t\trds_conn_destroy(tc->conn->c_passive);\n\t\trds_conn_destroy(tc->conn);\n\t}\n}","lang":"c","vul_type":"cwe-476","target_token_count":277,"sven_meta":{"func_name":"rds_tcp_kill_sock","file_name":"net/rds/tcp.c","commit_link":"github.com/torvalds/linux/commit/91573ae4aed0a49660abdad4d42f2a0db995ee5e","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#4-74fcbc5b2afa","input":"CopyKeyAliasesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info)\n{\n AliasInfo *alias;\n unsigned i, num_key_aliases;\n struct xkb_key_alias *key_aliases;\n\n /*\n * Do some sanity checking on the aliases. We can't do it before\n * because keys and their aliases may be added out-of-order.\n */\n num_key_aliases = 0;\n darray_foreach(alias, info->aliases) {\n /* Check that ->real is a key. */\n if (!XkbKeyByName(keymap, alias->real, false)) {\n log_vrb(info->ctx, 5,\n \"Attempt to alias %s to non-existent key %s; Ignored\\n\",\n KeyNameText(info->ctx, alias->alias),\n KeyNameText(info->ctx, alias->real));\n alias->real = XKB_ATOM_NONE;\n continue;\n }\n\n /* Check that ->alias is not a key. */\n if (XkbKeyByName(keymap, alias->alias, false)) {\n log_vrb(info->ctx, 5,\n \"Attempt to create alias with the name of a real key; \"\n \"Alias \\\"%s = %s\\\" ignored\\n\",\n KeyNameText(info->ctx, alias->alias),\n KeyNameText(info->ctx, alias->real));\n alias->real = XKB_ATOM_NONE;\n continue;\n }\n\n num_key_aliases++;\n }\n\n /* Copy key aliases. */\n key_aliases = NULL;\n if (num_key_aliases > 0) {\n key_aliases = calloc(num_key_aliases, sizeof(*key_aliases));\n if (!key_aliases)\n return false;\n }\n\n i = 0;\n darray_foreach(alias, info->aliases) {\n if (alias->real != XKB_ATOM_NONE) {\n key_aliases[i].alias = alias->alias;\n key_aliases[i].real = alias->real;\n i++;\n }\n }\n\n keymap->num_key_aliases = num_key_aliases;\n keymap->key_aliases = key_aliases;\n return true;\n}","target":"CopyKeyAliasesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info)\n{\n AliasInfo *alias;\n unsigned i, num_key_aliases;\n struct xkb_key_alias *key_aliases;\n\n /*\n * Do some sanity checking on the aliases. We can't do it before\n * because keys and their aliases may be added out-of-order.\n */\n num_key_aliases = 0;\n darray_foreach(alias, info->aliases) {\n /* Check that ->real is a key. */\n if (!XkbKeyByName(keymap, alias->real, false)) {\n log_vrb(info->ctx, 5,\n \"Attempt to alias %s to non-existent key %s; Ignored\\n\",\n KeyNameText(info->ctx, alias->alias),\n KeyNameText(info->ctx, alias->real));\n alias->real = XKB_ATOM_NONE;\n continue;\n }\n\n /* Check that ->alias is not a key. */\n if (XkbKeyByName(keymap, alias->alias, false)) {\n log_vrb(info->ctx, 5,\n \"Attempt to create alias with the name of a real key; \"\n \"Alias \\\"%s = %s\\\" ignored\\n\",\n KeyNameText(info->ctx, alias->alias),\n KeyNameText(info->ctx, alias->real));\n alias->real = XKB_ATOM_NONE;\n continue;\n }\n\n num_key_aliases++;\n }\n\n /* Copy key aliases. */\n key_aliases = NULL;\n if (num_key_aliases > 0) {\n key_aliases = calloc(num_key_aliases, sizeof(*key_aliases));\n if (!key_aliases)\n return false;\n\n i = 0;\n darray_foreach(alias, info->aliases) {\n if (alias->real != XKB_ATOM_NONE) {\n key_aliases[i].alias = alias->alias;\n key_aliases[i].real = alias->real;\n i++;\n }\n }\n }\n\n keymap->num_key_aliases = num_key_aliases;\n keymap->key_aliases = key_aliases;\n return true;\n}","lang":"c","vul_type":"cwe-476","target_token_count":447,"sven_meta":{"func_name":"CopyKeyAliasesToKeymap","file_name":"src/xkbcomp/keycodes.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/badb428e63387140720f22486b3acbd3d738859f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-787#5-76f9ec416b60","input":"static void RemoveICCProfileFromResourceBlock(StringInfo *bim_profile)\n{\n register const unsigned char\n *p;\n\n size_t\n length;\n\n unsigned char\n *datum;\n\n unsigned int\n count,\n long_sans;\n\n unsigned short\n id,\n short_sans;\n\n length=GetStringInfoLength(bim_profile);\n if (length < 16)\n return;\n datum=GetStringInfoDatum(bim_profile);\n for (p=datum; (p >= datum) && (p < (datum+length-16)); )\n {\n register unsigned char\n *q;\n\n q=(unsigned char *) p;\n if (LocaleNCompare((const char *) p,\"8BIM\",4) != 0)\n break;\n p=PushLongPixel(MSBEndian,p,&long_sans);\n p=PushShortPixel(MSBEndian,p,&id);\n p=PushShortPixel(MSBEndian,p,&short_sans);\n p=PushLongPixel(MSBEndian,p,&count);\n if (id == 0x0000040f)\n {\n (void) CopyMagickMemory(q,q+PSDQuantum(count)+12,length-\n (PSDQuantum(count)+12)-(q-datum));\n SetStringInfoLength(bim_profile,length-(PSDQuantum(count)+12));\n break;\n }\n p+=count;\n if ((count & 0x01) != 0)\n p++;\n }\n}","target":"static void RemoveICCProfileFromResourceBlock(StringInfo *bim_profile)\n{\n register const unsigned char\n *p;\n\n size_t\n length;\n\n unsigned char\n *datum;\n\n unsigned int\n count,\n long_sans;\n\n unsigned short\n id,\n short_sans;\n\n length=GetStringInfoLength(bim_profile);\n if (length < 16)\n return;\n datum=GetStringInfoDatum(bim_profile);\n for (p=datum; (p >= datum) && (p < (datum+length-16)); )\n {\n register unsigned char\n *q;\n\n q=(unsigned char *) p;\n if (LocaleNCompare((const char *) p,\"8BIM\",4) != 0)\n break;\n p=PushLongPixel(MSBEndian,p,&long_sans);\n p=PushShortPixel(MSBEndian,p,&id);\n p=PushShortPixel(MSBEndian,p,&short_sans);\n p=PushLongPixel(MSBEndian,p,&count);\n if (id == 0x0000040f)\n {\n if ((q+PSDQuantum(count)+12) < (datum+length-16))\n {\n (void) CopyMagickMemory(q,q+PSDQuantum(count)+12,length-\n (PSDQuantum(count)+12)-(q-datum));\n SetStringInfoLength(bim_profile,length-(PSDQuantum(count)+12));\n }\n break;\n }\n p+=count;\n if ((count & 0x01) != 0)\n p++;\n }\n}","lang":"c","vul_type":"cwe-787","target_token_count":354,"sven_meta":{"func_name":"RemoveICCProfileFromResourceBlock","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/53c1dcd34bed85181b901bfce1a2322f85a59472","source_cwe_file":"cwe-787.jsonl"}} diff --git a/sven_rl_buckets/val/512_inf.jsonl b/sven_rl_buckets/val/512_inf.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..5ef835737450a8042be5770addc581344bd1ee96 --- /dev/null +++ b/sven_rl_buckets/val/512_inf.jsonl @@ -0,0 +1,32 @@ +{"problem_id":"cwe-089#10-d79fe6f8970c","input":"def process_as_reply(email_obj):\n job_number = email_obj['subject'].split(': #')[1]\n feedback = re.findall(\"^[\\W]*([Oo\\d]){1}(?=[\\W]*)\", email_obj['content'].replace('#','').replace('link', ''))[0]\n feedback = int(0 if feedback == ('O' or 'o') else feedback)\n dcn_key = re.findall('\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}', email_obj['content'])[0]\n logger.info(f\"got feedback `{feedback}` for job #`{job_number}`\")\n with create_connection() as conn:\n was_prev_closed = pd.read_sql(f\"SELECT * FROM df_dilfo WHERE job_number={job_number}\", conn).iloc[0].closed\n if was_prev_closed:\n logger.info(f\"job was already matched successfully and logged as `closed`... skipping.\")\n return\n if feedback == 1:\n logger.info(f\"got feeback that DCN key {dcn_key} was correct\")\n update_status_query = \"UPDATE df_dilfo SET closed = 1 WHERE job_number = {}\"\n with create_connection() as conn:\n conn.cursor().execute(update_status_query.format(job_number))\n logger.info(f\"updated df_dilfo to show `closed` status for job #{job_number}\")\n with create_connection() as conn:\n df = pd.read_sql(\"SELECT * FROM df_matched\", conn)\n match_dict_input = {\n 'job_number': job_number,\n 'dcn_key': dcn_key,\n 'ground_truth': 1 if feedback == 1 else 0,\n 'multi_phase': 1 if feedback == 2 else 0,\n 'verifier': email_obj[\"sender\"],\n 'source': 'feedback',\n 'log_date': str(datetime.datetime.now().date()),\n 'validate': 0,\n }\n df = df.append(match_dict_input, ignore_index=True)\n df = df.drop_duplicates(subset=[\"job_number\", \"dcn_key\"], keep='last')\n df.to_sql('df_matched', conn, if_exists='replace', index=False)\n logger.info(\n f\"DCN key `{dcn_key}` was a \"\n f\"{'successful match' if feedback == 1 else 'mis-match'} for job \"\n f\"#{job_number}\"\n )","target":"def process_as_reply(email_obj):\n job_number = email_obj['subject'].split(': #')[1]\n feedback = re.findall(\"^[\\W]*([Oo\\d]){1}(?=[\\W]*)\", email_obj['content'].replace('#','').replace('link', ''))[0]\n feedback = int(0 if feedback == ('O' or 'o') else feedback)\n dcn_key = re.findall('\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}', email_obj['content'])[0]\n logger.info(f\"got feedback `{feedback}` for job #`{job_number}`\")\n with create_connection() as conn:\n was_prev_closed = pd.read_sql(\"SELECT * FROM df_dilfo WHERE job_number=?\", conn, params=[job_number]).iloc[0].closed\n if was_prev_closed:\n logger.info(f\"job was already matched successfully and logged as `closed`... skipping.\")\n return\n if feedback == 1:\n logger.info(f\"got feeback that DCN key {dcn_key} was correct\")\n update_status_query = \"UPDATE df_dilfo SET closed = 1 WHERE job_number = ?\"\n with create_connection() as conn:\n conn.cursor().execute(update_status_query, [job_number])\n logger.info(f\"updated df_dilfo to show `closed` status for job #{job_number}\")\n with create_connection() as conn:\n df = pd.read_sql(\"SELECT * FROM df_matched\", conn)\n match_dict_input = {\n 'job_number': job_number,\n 'dcn_key': dcn_key,\n 'ground_truth': 1 if feedback == 1 else 0,\n 'multi_phase': 1 if feedback == 2 else 0,\n 'verifier': email_obj[\"sender\"],\n 'source': 'feedback',\n 'log_date': str(datetime.datetime.now().date()),\n 'validate': 0,\n }\n df = df.append(match_dict_input, ignore_index=True)\n df = df.drop_duplicates(subset=[\"job_number\", \"dcn_key\"], keep='last')\n df.to_sql('df_matched', conn, if_exists='replace', index=False)\n logger.info(\n f\"DCN key `{dcn_key}` was a \"\n f\"{'successful match' if feedback == 1 else 'mis-match'} for job \"\n f\"#{job_number}\"\n )","lang":"python","vul_type":"cwe-089","target_token_count":516,"sven_meta":{"func_name":"process_as_reply","file_name":"inbox_scanner.py","commit_link":"github.com/confirmationbias616/certificate_checker/commit/9e890b9613b627e3a5995d0e4a594c8e0831e2ce","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-125#3-53f9a370667f","input":"AirPDcapDecryptWPABroadcastKey(const EAPOL_RSN_KEY *pEAPKey, guint8 *decryption_key, PAIRPDCAP_SEC_ASSOCIATION sa, guint eapol_len)\n{\n guint8 key_version;\n guint8 *key_data;\n guint8 *szEncryptedKey;\n guint16 key_bytes_len = 0; /* Length of the total key data field */\n guint16 key_len; /* Actual group key length */\n static AIRPDCAP_KEY_ITEM dummy_key; /* needed in case AirPDcapRsnaMng() wants the key structure */\n AIRPDCAP_SEC_ASSOCIATION *tmp_sa;\n\n /* We skip verifying the MIC of the key. If we were implementing a WPA supplicant we'd want to verify, but for a sniffer it's not needed. */\n\n /* Preparation for decrypting the group key - determine group key data length */\n /* depending on whether the pairwise key is TKIP or AES encryption key */\n key_version = AIRPDCAP_EAP_KEY_DESCR_VER(pEAPKey->key_information[1]);\n if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){\n /* TKIP */\n key_bytes_len = pntoh16(pEAPKey->key_length);\n }else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){\n /* AES */\n key_bytes_len = pntoh16(pEAPKey->key_data_len);\n\n /* AES keys must be at least 128 bits = 16 bytes. */\n if (key_bytes_len < 16) {\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n }\n\n if (key_bytes_len < GROUP_KEY_MIN_LEN || key_bytes_len > eapol_len - sizeof(EAPOL_RSN_KEY)) {\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Encrypted key is in the information element field of the EAPOL key packet */\n key_data = (guint8 *)pEAPKey + sizeof(EAPOL_RSN_KEY);\n szEncryptedKey = (guint8 *)g_memdup(key_data, key_bytes_len);\n\n DEBUG_DUMP(\"Encrypted Broadcast key:\", szEncryptedKey, key_bytes_len);\n DEBUG_DUMP(\"KeyIV:\", pEAPKey->key_iv, 16);\n DEBUG_DUMP(\"decryption_key:\", decryption_key, 16);\n\n /* We are rekeying, save old sa */\n tmp_sa=(AIRPDCAP_SEC_ASSOCIATION *)g_malloc(sizeof(AIRPDCAP_SEC_ASSOCIATION));\n memcpy(tmp_sa, sa, sizeof(AIRPDCAP_SEC_ASSOCIATION));\n sa->next=tmp_sa;\n\n /* As we have no concept of the prior association request at this point, we need to deduce the */\n /* group key cipher from the length of the key bytes. In WPA this is straightforward as the */\n /* keybytes just contain the GTK, and the GTK is only in the group handshake, NOT the M3. */\n /* In WPA2 its a little more tricky as the M3 keybytes contain an RSN_IE, but the group handshake */\n /* does not. Also there are other (variable length) items in the keybytes which we need to account */\n /* for to determine the true key length, and thus the group cipher. */\n\n if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){\n guint8 new_key[32];\n guint8 dummy[256];\n /* TKIP key */\n /* Per 802.11i, Draft 3.0 spec, section 8.5.2, p. 97, line 4-8, */\n /* group key is decrypted using RC4. Concatenate the IV with the 16 byte EK (PTK+16) to get the decryption key */\n\n rc4_state_struct rc4_state;\n\n /* The WPA group key just contains the GTK bytes so deducing the type is straightforward */\n /* Note - WPA M3 doesn't contain a group key so we'll only be here for the group handshake */\n sa->wpa.key_ver = (key_bytes_len >=TKIP_GROUP_KEY_LEN)?AIRPDCAP_WPA_KEY_VER_NOT_CCMP:AIRPDCAP_WPA_KEY_VER_AES_CCMP;\n\n /* Build the full decryption key based on the IV and part of the pairwise key */\n memcpy(new_key, pEAPKey->key_iv, 16);\n memcpy(new_key+16, decryption_key, 16);\n DEBUG_DUMP(\"FullDecrKey:\", new_key, 32);\n\n crypt_rc4_init(&rc4_state, new_key, sizeof(new_key));\n\n /* Do dummy 256 iterations of the RC4 algorithm (per 802.11i, Draft 3.0, p. 97 line 6) */\n crypt_rc4(&rc4_state, dummy, 256);\n crypt_rc4(&rc4_state, szEncryptedKey, key_bytes_len);\n\n } else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){\n /* AES CCMP key */\n\n guint8 key_found;\n guint8 key_length;\n guint16 key_index;\n guint8 *decrypted_data;\n\n /* Unwrap the key; the result is key_bytes_len in length */\n decrypted_data = AES_unwrap(decryption_key, 16, szEncryptedKey, key_bytes_len);\n\n /* With WPA2 what we get after Broadcast Key decryption is an actual RSN structure.\n The key itself is stored as a GTK KDE\n WPA2 IE (1 byte) id = 0xdd, length (1 byte), GTK OUI (4 bytes), key index (1 byte) and 1 reserved byte. Thus we have to\n pass pointer to the actual key with 8 bytes offset */\n\n key_found = FALSE;\n key_index = 0;\n\n /* Parse Key data until we found GTK KDE */\n /* GTK KDE = 00-0F-AC 01 */\n while(key_index < (key_bytes_len - 6) && !key_found){\n guint8 rsn_id;\n guint32 type;\n\n /* Get RSN ID */\n rsn_id = decrypted_data[key_index];\n type = ((decrypted_data[key_index + 2] << 24) +\n (decrypted_data[key_index + 3] << 16) +\n (decrypted_data[key_index + 4] << 8) +\n (decrypted_data[key_index + 5]));\n\n if (rsn_id == 0xdd && type == 0x000fac01) {\n key_found = TRUE;\n } else {\n key_index += decrypted_data[key_index+1]+2;\n }\n }\n\n if (key_found){\n key_length = decrypted_data[key_index+1] - 6;\n\n if (key_index+8 >= key_bytes_len ||\n key_length > key_bytes_len - key_index - 8) {\n g_free(decrypted_data);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Skip over the GTK header info, and don't copy past the end of the encrypted data */\n memcpy(szEncryptedKey, decrypted_data+key_index+8, key_length);\n } else {\n g_free(decrypted_data);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n if (key_length == TKIP_GROUP_KEY_LEN)\n sa->wpa.key_ver = AIRPDCAP_WPA_KEY_VER_NOT_CCMP;\n else\n sa->wpa.key_ver = AIRPDCAP_WPA_KEY_VER_AES_CCMP;\n\n g_free(decrypted_data);\n }\n\n key_len = (sa->wpa.key_ver==AIRPDCAP_WPA_KEY_VER_NOT_CCMP)?TKIP_GROUP_KEY_LEN:CCMP_GROUP_KEY_LEN;\n if (key_len > key_bytes_len) {\n /* the key required for this protocol is longer than the key that we just calculated */\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Decrypted key is now in szEncryptedKey with len of key_len */\n DEBUG_DUMP(\"Broadcast key:\", szEncryptedKey, key_len);\n\n /* Load the proper key material info into the SA */\n sa->key = &dummy_key; /* we just need key to be not null because it is checked in AirPDcapRsnaMng(). The WPA key materials are actually in the .wpa structure */\n sa->validKey = TRUE;\n\n /* Since this is a GTK and its size is only 32 bytes (vs. the 64 byte size of a PTK), we fake it and put it in at a 32-byte offset so the */\n /* AirPDcapRsnaMng() function will extract the right piece of the GTK for decryption. (The first 16 bytes of the GTK are used for decryption.) */\n memset(sa->wpa.ptk, 0, sizeof(sa->wpa.ptk));\n memcpy(sa->wpa.ptk+32, szEncryptedKey, key_len);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_SUCCESS_HANDSHAKE;\n}","target":"AirPDcapDecryptWPABroadcastKey(const EAPOL_RSN_KEY *pEAPKey, guint8 *decryption_key, PAIRPDCAP_SEC_ASSOCIATION sa, guint eapol_len)\n{\n guint8 key_version;\n guint8 *key_data;\n guint8 *szEncryptedKey;\n guint16 key_bytes_len = 0; /* Length of the total key data field */\n guint16 key_len; /* Actual group key length */\n static AIRPDCAP_KEY_ITEM dummy_key; /* needed in case AirPDcapRsnaMng() wants the key structure */\n AIRPDCAP_SEC_ASSOCIATION *tmp_sa;\n\n /* We skip verifying the MIC of the key. If we were implementing a WPA supplicant we'd want to verify, but for a sniffer it's not needed. */\n\n /* Preparation for decrypting the group key - determine group key data length */\n /* depending on whether the pairwise key is TKIP or AES encryption key */\n key_version = AIRPDCAP_EAP_KEY_DESCR_VER(pEAPKey->key_information[1]);\n if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){\n /* TKIP */\n key_bytes_len = pntoh16(pEAPKey->key_length);\n }else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){\n /* AES */\n key_bytes_len = pntoh16(pEAPKey->key_data_len);\n\n /* AES keys must be at least 128 bits = 16 bytes. */\n if (key_bytes_len < 16) {\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n }\n\n if ((key_bytes_len < GROUP_KEY_MIN_LEN) ||\n (eapol_len < sizeof(EAPOL_RSN_KEY)) ||\n (key_bytes_len > eapol_len - sizeof(EAPOL_RSN_KEY))) {\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Encrypted key is in the information element field of the EAPOL key packet */\n key_data = (guint8 *)pEAPKey + sizeof(EAPOL_RSN_KEY);\n szEncryptedKey = (guint8 *)g_memdup(key_data, key_bytes_len);\n\n DEBUG_DUMP(\"Encrypted Broadcast key:\", szEncryptedKey, key_bytes_len);\n DEBUG_DUMP(\"KeyIV:\", pEAPKey->key_iv, 16);\n DEBUG_DUMP(\"decryption_key:\", decryption_key, 16);\n\n /* We are rekeying, save old sa */\n tmp_sa=(AIRPDCAP_SEC_ASSOCIATION *)g_malloc(sizeof(AIRPDCAP_SEC_ASSOCIATION));\n memcpy(tmp_sa, sa, sizeof(AIRPDCAP_SEC_ASSOCIATION));\n sa->next=tmp_sa;\n\n /* As we have no concept of the prior association request at this point, we need to deduce the */\n /* group key cipher from the length of the key bytes. In WPA this is straightforward as the */\n /* keybytes just contain the GTK, and the GTK is only in the group handshake, NOT the M3. */\n /* In WPA2 its a little more tricky as the M3 keybytes contain an RSN_IE, but the group handshake */\n /* does not. Also there are other (variable length) items in the keybytes which we need to account */\n /* for to determine the true key length, and thus the group cipher. */\n\n if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){\n guint8 new_key[32];\n guint8 dummy[256];\n /* TKIP key */\n /* Per 802.11i, Draft 3.0 spec, section 8.5.2, p. 97, line 4-8, */\n /* group key is decrypted using RC4. Concatenate the IV with the 16 byte EK (PTK+16) to get the decryption key */\n\n rc4_state_struct rc4_state;\n\n /* The WPA group key just contains the GTK bytes so deducing the type is straightforward */\n /* Note - WPA M3 doesn't contain a group key so we'll only be here for the group handshake */\n sa->wpa.key_ver = (key_bytes_len >=TKIP_GROUP_KEY_LEN)?AIRPDCAP_WPA_KEY_VER_NOT_CCMP:AIRPDCAP_WPA_KEY_VER_AES_CCMP;\n\n /* Build the full decryption key based on the IV and part of the pairwise key */\n memcpy(new_key, pEAPKey->key_iv, 16);\n memcpy(new_key+16, decryption_key, 16);\n DEBUG_DUMP(\"FullDecrKey:\", new_key, 32);\n\n crypt_rc4_init(&rc4_state, new_key, sizeof(new_key));\n\n /* Do dummy 256 iterations of the RC4 algorithm (per 802.11i, Draft 3.0, p. 97 line 6) */\n crypt_rc4(&rc4_state, dummy, 256);\n crypt_rc4(&rc4_state, szEncryptedKey, key_bytes_len);\n\n } else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){\n /* AES CCMP key */\n\n guint8 key_found;\n guint8 key_length;\n guint16 key_index;\n guint8 *decrypted_data;\n\n /* Unwrap the key; the result is key_bytes_len in length */\n decrypted_data = AES_unwrap(decryption_key, 16, szEncryptedKey, key_bytes_len);\n\n /* With WPA2 what we get after Broadcast Key decryption is an actual RSN structure.\n The key itself is stored as a GTK KDE\n WPA2 IE (1 byte) id = 0xdd, length (1 byte), GTK OUI (4 bytes), key index (1 byte) and 1 reserved byte. Thus we have to\n pass pointer to the actual key with 8 bytes offset */\n\n key_found = FALSE;\n key_index = 0;\n\n /* Parse Key data until we found GTK KDE */\n /* GTK KDE = 00-0F-AC 01 */\n while(key_index < (key_bytes_len - 6) && !key_found){\n guint8 rsn_id;\n guint32 type;\n\n /* Get RSN ID */\n rsn_id = decrypted_data[key_index];\n type = ((decrypted_data[key_index + 2] << 24) +\n (decrypted_data[key_index + 3] << 16) +\n (decrypted_data[key_index + 4] << 8) +\n (decrypted_data[key_index + 5]));\n\n if (rsn_id == 0xdd && type == 0x000fac01) {\n key_found = TRUE;\n } else {\n key_index += decrypted_data[key_index+1]+2;\n }\n }\n\n if (key_found){\n key_length = decrypted_data[key_index+1] - 6;\n\n if (key_index+8 >= key_bytes_len ||\n key_length > key_bytes_len - key_index - 8) {\n g_free(decrypted_data);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Skip over the GTK header info, and don't copy past the end of the encrypted data */\n memcpy(szEncryptedKey, decrypted_data+key_index+8, key_length);\n } else {\n g_free(decrypted_data);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n if (key_length == TKIP_GROUP_KEY_LEN)\n sa->wpa.key_ver = AIRPDCAP_WPA_KEY_VER_NOT_CCMP;\n else\n sa->wpa.key_ver = AIRPDCAP_WPA_KEY_VER_AES_CCMP;\n\n g_free(decrypted_data);\n }\n\n key_len = (sa->wpa.key_ver==AIRPDCAP_WPA_KEY_VER_NOT_CCMP)?TKIP_GROUP_KEY_LEN:CCMP_GROUP_KEY_LEN;\n if (key_len > key_bytes_len) {\n /* the key required for this protocol is longer than the key that we just calculated */\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Decrypted key is now in szEncryptedKey with len of key_len */\n DEBUG_DUMP(\"Broadcast key:\", szEncryptedKey, key_len);\n\n /* Load the proper key material info into the SA */\n sa->key = &dummy_key; /* we just need key to be not null because it is checked in AirPDcapRsnaMng(). The WPA key materials are actually in the .wpa structure */\n sa->validKey = TRUE;\n\n /* Since this is a GTK and its size is only 32 bytes (vs. the 64 byte size of a PTK), we fake it and put it in at a 32-byte offset so the */\n /* AirPDcapRsnaMng() function will extract the right piece of the GTK for decryption. (The first 16 bytes of the GTK are used for decryption.) */\n memset(sa->wpa.ptk, 0, sizeof(sa->wpa.ptk));\n memcpy(sa->wpa.ptk+32, szEncryptedKey, key_len);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_SUCCESS_HANDSHAKE;\n}","lang":"c","vul_type":"cwe-125","target_token_count":2063,"sven_meta":{"func_name":"AirPDcapDecryptWPABroadcastKey","file_name":"epan/crypt/airpdcap.c","commit_link":"github.com/wireshark/wireshark/commit/b6d838eebf4456192360654092e5587c5207f185","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#4-f92394cda624","input":"MagickExport Image *AdaptiveThresholdImage(const Image *image,\n const size_t width,const size_t height,const double bias,\n ExceptionInfo *exception)\n{\n#define AdaptiveThresholdImageTag \"AdaptiveThreshold/Image\"\n\n CacheView\n *image_view,\n *threshold_view;\n\n Image\n *threshold_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n MagickSizeType\n number_pixels;\n\n ssize_t\n y;\n\n /*\n Initialize threshold image attributes.\n */\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n threshold_image=CloneImage(image,0,0,MagickTrue,exception);\n if (threshold_image == (Image *) NULL)\n return((Image *) NULL);\n status=SetImageStorageClass(threshold_image,DirectClass,exception);\n if (status == MagickFalse)\n {\n threshold_image=DestroyImage(threshold_image);\n return((Image *) NULL);\n }\n /*\n Threshold image.\n */\n status=MagickTrue;\n progress=0;\n number_pixels=(MagickSizeType) width*height;\n image_view=AcquireVirtualCacheView(image,exception);\n threshold_view=AcquireAuthenticCacheView(threshold_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(image,threshold_image,image->rows,1)\n#endif\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n double\n channel_bias[MaxPixelChannels],\n channel_sum[MaxPixelChannels];\n\n register const Quantum\n *magick_restrict p,\n *magick_restrict pixels;\n\n register Quantum\n *magick_restrict q;\n\n register ssize_t\n i,\n x;\n\n ssize_t\n center,\n u,\n v;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)\n (height/2L),image->columns+width,height,exception);\n q=QueueCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns,\n 1,exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n center=(ssize_t) GetPixelChannels(image)*(image->columns+width)*(height/2L)+\n GetPixelChannels(image)*(width/2);\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel = GetPixelChannelChannel(image,i);\n PixelTrait traits = GetPixelChannelTraits(image,channel);\n PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image,\n channel);\n if ((traits == UndefinedPixelTrait) ||\n (threshold_traits == UndefinedPixelTrait))\n continue;\n if ((threshold_traits & CopyPixelTrait) != 0)\n {\n SetPixelChannel(threshold_image,channel,p[center+i],q);\n continue;\n }\n pixels=p;\n channel_bias[channel]=0.0;\n channel_sum[channel]=0.0;\n for (v=0; v < (ssize_t) height; v++)\n {\n for (u=0; u < (ssize_t) width; u++)\n {\n if (u == (ssize_t) (width-1))\n channel_bias[channel]+=pixels[i];\n channel_sum[channel]+=pixels[i];\n pixels+=GetPixelChannels(image);\n }\n pixels+=GetPixelChannels(image)*image->columns;\n }\n }\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n double\n mean;\n\n PixelChannel channel = GetPixelChannelChannel(image,i);\n PixelTrait traits = GetPixelChannelTraits(image,channel);\n PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image,\n channel);\n if ((traits == UndefinedPixelTrait) ||\n (threshold_traits == UndefinedPixelTrait))\n continue;\n if ((threshold_traits & CopyPixelTrait) != 0)\n {\n SetPixelChannel(threshold_image,channel,p[center+i],q);\n continue;\n }\n channel_sum[channel]-=channel_bias[channel];\n channel_bias[channel]=0.0;\n pixels=p;\n for (v=0; v < (ssize_t) height; v++)\n {\n channel_bias[channel]+=pixels[i];\n pixels+=(width-1)*GetPixelChannels(image);\n channel_sum[channel]+=pixels[i];\n pixels+=GetPixelChannels(image)*(image->columns+1);\n }\n mean=(double) (channel_sum[channel]/number_pixels+bias);\n SetPixelChannel(threshold_image,channel,(Quantum) ((double)\n p[center+i] <= mean ? 0 : QuantumRange),q);\n }\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(threshold_image);\n }\n if (SyncCacheViewAuthenticPixels(threshold_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(image,AdaptiveThresholdImageTag,progress,\n image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n threshold_image->type=image->type;\n threshold_view=DestroyCacheView(threshold_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n threshold_image=DestroyImage(threshold_image);\n return(threshold_image);\n}","target":"MagickExport Image *AdaptiveThresholdImage(const Image *image,\n const size_t width,const size_t height,const double bias,\n ExceptionInfo *exception)\n{\n#define AdaptiveThresholdImageTag \"AdaptiveThreshold/Image\"\n\n CacheView\n *image_view,\n *threshold_view;\n\n Image\n *threshold_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n MagickSizeType\n number_pixels;\n\n ssize_t\n y;\n\n /*\n Initialize threshold image attributes.\n */\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n threshold_image=CloneImage(image,0,0,MagickTrue,exception);\n if (threshold_image == (Image *) NULL)\n return((Image *) NULL);\n if (width == 0)\n return(threshold_image);\n status=SetImageStorageClass(threshold_image,DirectClass,exception);\n if (status == MagickFalse)\n {\n threshold_image=DestroyImage(threshold_image);\n return((Image *) NULL);\n }\n /*\n Threshold image.\n */\n status=MagickTrue;\n progress=0;\n number_pixels=(MagickSizeType) width*height;\n image_view=AcquireVirtualCacheView(image,exception);\n threshold_view=AcquireAuthenticCacheView(threshold_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(image,threshold_image,image->rows,1)\n#endif\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n double\n channel_bias[MaxPixelChannels],\n channel_sum[MaxPixelChannels];\n\n register const Quantum\n *magick_restrict p,\n *magick_restrict pixels;\n\n register Quantum\n *magick_restrict q;\n\n register ssize_t\n i,\n x;\n\n ssize_t\n center,\n u,\n v;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)\n (height/2L),image->columns+width,height,exception);\n q=QueueCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns,\n 1,exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n center=(ssize_t) GetPixelChannels(image)*(image->columns+width)*(height/2L)+\n GetPixelChannels(image)*(width/2);\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel = GetPixelChannelChannel(image,i);\n PixelTrait traits = GetPixelChannelTraits(image,channel);\n PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image,\n channel);\n if ((traits == UndefinedPixelTrait) ||\n (threshold_traits == UndefinedPixelTrait))\n continue;\n if ((threshold_traits & CopyPixelTrait) != 0)\n {\n SetPixelChannel(threshold_image,channel,p[center+i],q);\n continue;\n }\n pixels=p;\n channel_bias[channel]=0.0;\n channel_sum[channel]=0.0;\n for (v=0; v < (ssize_t) height; v++)\n {\n for (u=0; u < (ssize_t) width; u++)\n {\n if (u == (ssize_t) (width-1))\n channel_bias[channel]+=pixels[i];\n channel_sum[channel]+=pixels[i];\n pixels+=GetPixelChannels(image);\n }\n pixels+=GetPixelChannels(image)*image->columns;\n }\n }\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n double\n mean;\n\n PixelChannel channel = GetPixelChannelChannel(image,i);\n PixelTrait traits = GetPixelChannelTraits(image,channel);\n PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image,\n channel);\n if ((traits == UndefinedPixelTrait) ||\n (threshold_traits == UndefinedPixelTrait))\n continue;\n if ((threshold_traits & CopyPixelTrait) != 0)\n {\n SetPixelChannel(threshold_image,channel,p[center+i],q);\n continue;\n }\n channel_sum[channel]-=channel_bias[channel];\n channel_bias[channel]=0.0;\n pixels=p;\n for (v=0; v < (ssize_t) height; v++)\n {\n channel_bias[channel]+=pixels[i];\n pixels+=(width-1)*GetPixelChannels(image);\n channel_sum[channel]+=pixels[i];\n pixels+=GetPixelChannels(image)*(image->columns+1);\n }\n mean=(double) (channel_sum[channel]/number_pixels+bias);\n SetPixelChannel(threshold_image,channel,(Quantum) ((double)\n p[center+i] <= mean ? 0 : QuantumRange),q);\n }\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(threshold_image);\n }\n if (SyncCacheViewAuthenticPixels(threshold_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(image,AdaptiveThresholdImageTag,progress,\n image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n threshold_image->type=image->type;\n threshold_view=DestroyCacheView(threshold_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n threshold_image=DestroyImage(threshold_image);\n return(threshold_image);\n}","lang":"c","vul_type":"cwe-125","target_token_count":1335,"sven_meta":{"func_name":"AdaptiveThresholdImage","file_name":"MagickCore/threshold.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/a7759f410b773a1dd57b0e1fb28112e1cd8b97bc","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#7-2b127153357a","input":"static INLINE BOOL RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer, BYTE* pbDestBuffer,\n UINT32 rowDelta, UINT32 width, UINT32 height)\n{\n\tconst BYTE* pbSrc = pbSrcBuffer;\n\tconst BYTE* pbEnd;\n\tconst BYTE* pbDestEnd;\n\tBYTE* pbDest = pbDestBuffer;\n\tPIXEL temp;\n\tPIXEL fgPel = WHITE_PIXEL;\n\tBOOL fInsertFgPel = FALSE;\n\tBOOL fFirstLine = TRUE;\n\tBYTE bitmask;\n\tPIXEL pixelA, pixelB;\n\tUINT32 runLength;\n\tUINT32 code;\n\tUINT32 advance;\n\tRLEEXTRA\n\n\tif ((rowDelta == 0) || (rowDelta < width))\n\t\treturn FALSE;\n\n\tif (!pbSrcBuffer || !pbDestBuffer)\n\t\treturn FALSE;\n\n\tpbEnd = pbSrcBuffer + cbSrcBuffer;\n\tpbDestEnd = pbDestBuffer + rowDelta * height;\n\n\twhile (pbSrc < pbEnd)\n\t{\n\t\t/* Watch out for the end of the first scanline. */\n\t\tif (fFirstLine)\n\t\t{\n\t\t\tif ((UINT32)(pbDest - pbDestBuffer) >= rowDelta)\n\t\t\t{\n\t\t\t\tfFirstLine = FALSE;\n\t\t\t\tfInsertFgPel = FALSE;\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t Extract the compression order code ID from the compression\n\t\t order header.\n\t\t*/\n\t\tcode = ExtractCodeId(*pbSrc);\n\n\t\t/* Handle Background Run Orders. */\n\t\tif (code == REGULAR_BG_RUN || code == MEGA_MEGA_BG_RUN)\n\t\t{\n\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\tif (fFirstLine)\n\t\t\t{\n\t\t\t\tif (fInsertFgPel)\n\t\t\t\t{\n\t\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, fgPel);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\trunLength = runLength - 1;\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, BLACK_PIXEL);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (fInsertFgPel)\n\t\t\t\t{\n\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\n\t\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp ^ fgPel);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\trunLength--;\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/* A follow-on background run order will need a foreground pel inserted. */\n\t\t\tfInsertFgPel = TRUE;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* For any of the other run-types a follow-on background run\n\t\t order does not need a foreground pel inserted. */\n\t\tfInsertFgPel = FALSE;\n\n\t\tswitch (code)\n\t\t{\n\t\t\t/* Handle Foreground Run Orders. */\n\t\t\tcase REGULAR_FG_RUN:\n\t\t\tcase MEGA_MEGA_FG_RUN:\n\t\t\tcase LITE_SET_FG_FG_RUN:\n\t\t\tcase MEGA_MEGA_SET_FG_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\t\tif (code == LITE_SET_FG_FG_RUN || code == MEGA_MEGA_SET_FG_RUN)\n\t\t\t\t{\n\t\t\t\t\tSRCREADPIXEL(fgPel, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\t\tDESTWRITEPIXEL(pbDest, fgPel);\n\t\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\t\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp ^ fgPel);\n\t\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Dithered Run Orders. */\n\t\t\tcase LITE_DITHERED_RUN:\n\t\t\tcase MEGA_MEGA_DITHERED_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tSRCREADPIXEL(pixelA, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\tSRCREADPIXEL(pixelB, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength * 2))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelA);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelB);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Color Run Orders. */\n\t\t\tcase REGULAR_COLOR_RUN:\n\t\t\tcase MEGA_MEGA_COLOR_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tSRCREADPIXEL(pixelA, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelA);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Foreground/Background Image Orders. */\n\t\t\tcase REGULAR_FGBG_IMAGE:\n\t\t\tcase MEGA_MEGA_FGBG_IMAGE:\n\t\t\tcase LITE_SET_FG_FGBG_IMAGE:\n\t\t\tcase MEGA_MEGA_SET_FGBG_IMAGE:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\t\tif (code == LITE_SET_FG_FGBG_IMAGE || code == MEGA_MEGA_SET_FGBG_IMAGE)\n\t\t\t\t{\n\t\t\t\t\tSRCREADPIXEL(fgPel, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t}\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\twhile (runLength > 8)\n\t\t\t\t\t{\n\t\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\t\tpbSrc = pbSrc + 1;\n\t\t\t\t\t\tpbDest = WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, bitmask, fgPel, 8);\n\n\t\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\trunLength = runLength - 8;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twhile (runLength > 8)\n\t\t\t\t\t{\n\t\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\t\tpbSrc = pbSrc + 1;\n\t\t\t\t\t\tpbDest = WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, bitmask, fgPel, 8);\n\n\t\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\trunLength = runLength - 8;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (runLength > 0)\n\t\t\t\t{\n\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\t\tif (fFirstLine)\n\t\t\t\t\t{\n\t\t\t\t\t\tpbDest =\n\t\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, bitmask, fgPel, runLength);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tpbDest =\n\t\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, bitmask, fgPel, runLength);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Color Image Orders. */\n\t\t\tcase REGULAR_COLOR_IMAGE:\n\t\t\tcase MEGA_MEGA_COLOR_IMAGE:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tSRCREADPIXEL(temp, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Special Order 1. */\n\t\t\tcase SPECIAL_FGBG_1:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, g_MaskSpecialFgBg1, fgPel, 8);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, g_MaskSpecialFgBg1, fgPel, 8);\n\t\t\t\t}\n\n\t\t\t\tif (!pbDest)\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Special Order 2. */\n\t\t\tcase SPECIAL_FGBG_2:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, g_MaskSpecialFgBg2, fgPel, 8);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, g_MaskSpecialFgBg2, fgPel, 8);\n\t\t\t\t}\n\n\t\t\t\tif (!pbDest)\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle White Order. */\n\t\t\tcase SPECIAL_WHITE:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tDESTWRITEPIXEL(pbDest, WHITE_PIXEL);\n\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Black Order. */\n\t\t\tcase SPECIAL_BLACK:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tDESTWRITEPIXEL(pbDest, BLACK_PIXEL);\n\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\n\treturn TRUE;\n}","target":"static INLINE BOOL RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer, BYTE* pbDestBuffer,\n UINT32 rowDelta, UINT32 width, UINT32 height)\n{\n\tconst BYTE* pbSrc = pbSrcBuffer;\n\tconst BYTE* pbEnd;\n\tconst BYTE* pbDestEnd;\n\tBYTE* pbDest = pbDestBuffer;\n\tPIXEL temp;\n\tPIXEL fgPel = WHITE_PIXEL;\n\tBOOL fInsertFgPel = FALSE;\n\tBOOL fFirstLine = TRUE;\n\tBYTE bitmask;\n\tPIXEL pixelA, pixelB;\n\tUINT32 runLength;\n\tUINT32 code;\n\tUINT32 advance;\n\tRLEEXTRA\n\n\tif ((rowDelta == 0) || (rowDelta < width))\n\t\treturn FALSE;\n\n\tif (!pbSrcBuffer || !pbDestBuffer)\n\t\treturn FALSE;\n\n\tpbEnd = pbSrcBuffer + cbSrcBuffer;\n\tpbDestEnd = pbDestBuffer + rowDelta * height;\n\n\twhile (pbSrc < pbEnd)\n\t{\n\t\t/* Watch out for the end of the first scanline. */\n\t\tif (fFirstLine)\n\t\t{\n\t\t\tif ((UINT32)(pbDest - pbDestBuffer) >= rowDelta)\n\t\t\t{\n\t\t\t\tfFirstLine = FALSE;\n\t\t\t\tfInsertFgPel = FALSE;\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t Extract the compression order code ID from the compression\n\t\t order header.\n\t\t*/\n\t\tcode = ExtractCodeId(*pbSrc);\n\n\t\t/* Handle Background Run Orders. */\n\t\tif (code == REGULAR_BG_RUN || code == MEGA_MEGA_BG_RUN)\n\t\t{\n\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\tif (fFirstLine)\n\t\t\t{\n\t\t\t\tif (fInsertFgPel)\n\t\t\t\t{\n\t\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, fgPel);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\trunLength = runLength - 1;\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, BLACK_PIXEL);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (fInsertFgPel)\n\t\t\t\t{\n\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\n\t\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp ^ fgPel);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\trunLength--;\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/* A follow-on background run order will need a foreground pel inserted. */\n\t\t\tfInsertFgPel = TRUE;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* For any of the other run-types a follow-on background run\n\t\t order does not need a foreground pel inserted. */\n\t\tfInsertFgPel = FALSE;\n\n\t\tswitch (code)\n\t\t{\n\t\t\t/* Handle Foreground Run Orders. */\n\t\t\tcase REGULAR_FG_RUN:\n\t\t\tcase MEGA_MEGA_FG_RUN:\n\t\t\tcase LITE_SET_FG_FG_RUN:\n\t\t\tcase MEGA_MEGA_SET_FG_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\t\tif (code == LITE_SET_FG_FG_RUN || code == MEGA_MEGA_SET_FG_RUN)\n\t\t\t\t{\n\t\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\tSRCREADPIXEL(fgPel, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\t\tDESTWRITEPIXEL(pbDest, fgPel);\n\t\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\t\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp ^ fgPel);\n\t\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Dithered Run Orders. */\n\t\t\tcase LITE_DITHERED_RUN:\n\t\t\tcase MEGA_MEGA_DITHERED_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\treturn FALSE;\n\t\t\t\tSRCREADPIXEL(pixelA, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\treturn FALSE;\n\t\t\t\tSRCREADPIXEL(pixelB, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength * 2))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelA);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelB);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Color Run Orders. */\n\t\t\tcase REGULAR_COLOR_RUN:\n\t\t\tcase MEGA_MEGA_COLOR_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\treturn FALSE;\n\t\t\t\tSRCREADPIXEL(pixelA, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelA);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Foreground/Background Image Orders. */\n\t\t\tcase REGULAR_FGBG_IMAGE:\n\t\t\tcase MEGA_MEGA_FGBG_IMAGE:\n\t\t\tcase LITE_SET_FG_FGBG_IMAGE:\n\t\t\tcase MEGA_MEGA_SET_FGBG_IMAGE:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\treturn FALSE;\n\t\t\t\tif (code == LITE_SET_FG_FGBG_IMAGE || code == MEGA_MEGA_SET_FGBG_IMAGE)\n\t\t\t\t{\n\t\t\t\t\tSRCREADPIXEL(fgPel, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t}\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\twhile (runLength > 8)\n\t\t\t\t\t{\n\t\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\t\tpbSrc = pbSrc + 1;\n\t\t\t\t\t\tpbDest = WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, bitmask, fgPel, 8);\n\n\t\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\trunLength = runLength - 8;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twhile (runLength > 8)\n\t\t\t\t\t{\n\t\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\t\tpbSrc = pbSrc + 1;\n\t\t\t\t\t\tpbDest = WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, bitmask, fgPel, 8);\n\n\t\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\trunLength = runLength - 8;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (runLength > 0)\n\t\t\t\t{\n\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\t\tif (fFirstLine)\n\t\t\t\t\t{\n\t\t\t\t\t\tpbDest =\n\t\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, bitmask, fgPel, runLength);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tpbDest =\n\t\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, bitmask, fgPel, runLength);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Color Image Orders. */\n\t\t\tcase REGULAR_COLOR_IMAGE:\n\t\t\tcase MEGA_MEGA_COLOR_IMAGE:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\tSRCREADPIXEL(temp, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Special Order 1. */\n\t\t\tcase SPECIAL_FGBG_1:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, g_MaskSpecialFgBg1, fgPel, 8);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, g_MaskSpecialFgBg1, fgPel, 8);\n\t\t\t\t}\n\n\t\t\t\tif (!pbDest)\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Special Order 2. */\n\t\t\tcase SPECIAL_FGBG_2:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, g_MaskSpecialFgBg2, fgPel, 8);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, g_MaskSpecialFgBg2, fgPel, 8);\n\t\t\t\t}\n\n\t\t\t\tif (!pbDest)\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle White Order. */\n\t\t\tcase SPECIAL_WHITE:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tDESTWRITEPIXEL(pbDest, WHITE_PIXEL);\n\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Black Order. */\n\t\t\tcase SPECIAL_BLACK:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tDESTWRITEPIXEL(pbDest, BLACK_PIXEL);\n\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-125","target_token_count":2345,"sven_meta":{"func_name":"RLEDECOMPRESS","file_name":"libfreerdp/codec/include/bitmap.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/0a98c450c58ec150e44781c89aa6f8e7e0f571f5","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#8-4584c231274e","input":"jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr)\n{\n\tjp2_box_t *box;\n\tint found;\n\tjas_image_t *image;\n\tjp2_dec_t *dec;\n\tbool samedtype;\n\tint dtype;\n\tunsigned int i;\n\tjp2_cmap_t *cmapd;\n\tjp2_pclr_t *pclrd;\n\tjp2_cdef_t *cdefd;\n\tunsigned int channo;\n\tint newcmptno;\n\tint_fast32_t *lutents;\n#if 0\n\tjp2_cdefchan_t *cdefent;\n\tint cmptno;\n#endif\n\tjp2_cmapent_t *cmapent;\n\tjas_icchdr_t icchdr;\n\tjas_iccprof_t *iccprof;\n\n\tdec = 0;\n\tbox = 0;\n\timage = 0;\n\n\tJAS_DBGLOG(100, (\"jp2_decode(%p, \\\"%s\\\")\\n\", in, optstr));\n\n\tif (!(dec = jp2_dec_create())) {\n\t\tgoto error;\n\t}\n\n\t/* Get the first box. This should be a JP box. */\n\tif (!(box = jp2_box_get(in))) {\n\t\tjas_eprintf(\"error: cannot get box\\n\");\n\t\tgoto error;\n\t}\n\tif (box->type != JP2_BOX_JP) {\n\t\tjas_eprintf(\"error: expecting signature box\\n\");\n\t\tgoto error;\n\t}\n\tif (box->data.jp.magic != JP2_JP_MAGIC) {\n\t\tjas_eprintf(\"incorrect magic number\\n\");\n\t\tgoto error;\n\t}\n\tjp2_box_destroy(box);\n\tbox = 0;\n\n\t/* Get the second box. This should be a FTYP box. */\n\tif (!(box = jp2_box_get(in))) {\n\t\tgoto error;\n\t}\n\tif (box->type != JP2_BOX_FTYP) {\n\t\tjas_eprintf(\"expecting file type box\\n\");\n\t\tgoto error;\n\t}\n\tjp2_box_destroy(box);\n\tbox = 0;\n\n\t/* Get more boxes... */\n\tfound = 0;\n\twhile ((box = jp2_box_get(in))) {\n\t\tif (jas_getdbglevel() >= 1) {\n\t\t\tjas_eprintf(\"got box type %s\\n\", box->info->name);\n\t\t}\n\t\tswitch (box->type) {\n\t\tcase JP2_BOX_JP2C:\n\t\t\tfound = 1;\n\t\t\tbreak;\n\t\tcase JP2_BOX_IHDR:\n\t\t\tif (!dec->ihdr) {\n\t\t\t\tdec->ihdr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_BPCC:\n\t\t\tif (!dec->bpcc) {\n\t\t\t\tdec->bpcc = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_CDEF:\n\t\t\tif (!dec->cdef) {\n\t\t\t\tdec->cdef = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_PCLR:\n\t\t\tif (!dec->pclr) {\n\t\t\t\tdec->pclr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_CMAP:\n\t\t\tif (!dec->cmap) {\n\t\t\t\tdec->cmap = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_COLR:\n\t\t\tif (!dec->colr) {\n\t\t\t\tdec->colr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif (box) {\n\t\t\tjp2_box_destroy(box);\n\t\t\tbox = 0;\n\t\t}\n\t\tif (found) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!found) {\n\t\tjas_eprintf(\"error: no code stream found\\n\");\n\t\tgoto error;\n\t}\n\n\tif (!(dec->image = jpc_decode(in, optstr))) {\n\t\tjas_eprintf(\"error: cannot decode code stream\\n\");\n\t\tgoto error;\n\t}\n\n\t/* An IHDR box must be present. */\n\tif (!dec->ihdr) {\n\t\tjas_eprintf(\"error: missing IHDR box\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Does the number of components indicated in the IHDR box match\n\t the value specified in the code stream? */\n\tif (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(jas_uint,\n\t jas_image_numcmpts(dec->image))) {\n\t\tjas_eprintf(\"warning: number of components mismatch\\n\");\n\t}\n\n\t/* At least one component must be present. */\n\tif (!jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: no components\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Determine if all components have the same data type. */\n\tsamedtype = true;\n\tdtype = jas_image_cmptdtype(dec->image, 0);\n\tfor (i = 1; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {\n\t\tif (jas_image_cmptdtype(dec->image, i) != dtype) {\n\t\t\tsamedtype = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* Is the component data type indicated in the IHDR box consistent\n\t with the data in the code stream? */\n\tif ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||\n\t (!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {\n\t\tjas_eprintf(\"warning: component data type mismatch (IHDR)\\n\");\n\t}\n\n\t/* Is the compression type supported? */\n\tif (dec->ihdr->data.ihdr.comptype != JP2_IHDR_COMPTYPE) {\n\t\tjas_eprintf(\"error: unsupported compression type\\n\");\n\t\tgoto error;\n\t}\n\n\tif (dec->bpcc) {\n\t\t/* Is the number of components indicated in the BPCC box\n\t\t consistent with the code stream data? */\n\t\tif (dec->bpcc->data.bpcc.numcmpts != JAS_CAST(jas_uint, jas_image_numcmpts(\n\t\t dec->image))) {\n\t\t\tjas_eprintf(\"warning: number of components mismatch\\n\");\n\t\t}\n\t\t/* Is the component data type information indicated in the BPCC\n\t\t box consistent with the code stream data? */\n\t\tif (!samedtype) {\n\t\t\tfor (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));\n\t\t\t ++i) {\n\t\t\t\tif (jas_image_cmptdtype(dec->image, i) !=\n\t\t\t\t JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {\n\t\t\t\t\tjas_eprintf(\"warning: component data type mismatch (BPCC)\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tjas_eprintf(\"warning: superfluous BPCC box\\n\");\n\t\t}\n\t}\n\n\t/* A COLR box must be present. */\n\tif (!dec->colr) {\n\t\tjas_eprintf(\"error: no COLR box\\n\");\n\t\tgoto error;\n\t}\n\n\tswitch (dec->colr->data.colr.method) {\n\tcase JP2_COLR_ENUM:\n\t\tjas_image_setclrspc(dec->image, jp2_getcs(&dec->colr->data.colr));\n\t\tbreak;\n\tcase JP2_COLR_ICC:\n\t\ticcprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp,\n\t\t dec->colr->data.colr.iccplen);\n\t\tif (!iccprof) {\n\t\t\tjas_eprintf(\"error: failed to parse ICC profile\\n\");\n\t\t\tgoto error;\n\t\t}\n\t\tjas_iccprof_gethdr(iccprof, &icchdr);\n\t\tjas_eprintf(\"ICC Profile CS %08x\\n\", icchdr.colorspc);\n\t\tjas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc));\n\t\tdec->image->cmprof_ = jas_cmprof_createfromiccprof(iccprof);\n\t\tif (!dec->image->cmprof_) {\n\t\t\tjas_iccprof_destroy(iccprof);\n\t\t\tgoto error;\n\t\t}\n\t\tjas_iccprof_destroy(iccprof);\n\t\tbreak;\n\t}\n\n\t/* If a CMAP box is present, a PCLR box must also be present. */\n\tif (dec->cmap && !dec->pclr) {\n\t\tjas_eprintf(\"warning: missing PCLR box or superfluous CMAP box\\n\");\n\t\tjp2_box_destroy(dec->cmap);\n\t\tdec->cmap = 0;\n\t}\n\n\t/* If a CMAP box is not present, a PCLR box must not be present. */\n\tif (!dec->cmap && dec->pclr) {\n\t\tjas_eprintf(\"warning: missing CMAP box or superfluous PCLR box\\n\");\n\t\tjp2_box_destroy(dec->pclr);\n\t\tdec->pclr = 0;\n\t}\n\n\t/* Determine the number of channels (which is essentially the number\n\t of components after any palette mappings have been applied). */\n\tdec->numchans = dec->cmap ? dec->cmap->data.cmap.numchans :\n\t JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));\n\n\t/* Perform a basic sanity check on the CMAP box if present. */\n\tif (dec->cmap) {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\t/* Is the component number reasonable? */\n\t\t\tif (dec->cmap->data.cmap.ents[i].cmptno >= JAS_CAST(jas_uint,\n\t\t\t jas_image_numcmpts(dec->image))) {\n\t\t\t\tjas_eprintf(\"error: invalid component number in CMAP box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\t/* Is the LUT index reasonable? */\n\t\t\tif (dec->cmap->data.cmap.ents[i].pcol >=\n\t\t\t dec->pclr->data.pclr.numchans) {\n\t\t\t\tjas_eprintf(\"error: invalid CMAP LUT index\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Allocate space for the channel-number to component-number LUT. */\n\tif (!(dec->chantocmptlut = jas_alloc2(dec->numchans,\n\t sizeof(uint_fast16_t)))) {\n\t\tjas_eprintf(\"error: no memory\\n\");\n\t\tgoto error;\n\t}\n\n\tif (!dec->cmap) {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\tdec->chantocmptlut[i] = i;\n\t\t}\n\t} else {\n\t\tcmapd = &dec->cmap->data.cmap;\n\t\tpclrd = &dec->pclr->data.pclr;\n\t\tcdefd = &dec->cdef->data.cdef;\n\t\tfor (channo = 0; channo < cmapd->numchans; ++channo) {\n\t\t\tcmapent = &cmapd->ents[channo];\n\t\t\tif (cmapent->map == JP2_CMAP_DIRECT) {\n\t\t\t\tdec->chantocmptlut[channo] = channo;\n\t\t\t} else if (cmapent->map == JP2_CMAP_PALETTE) {\n\t\t\t\tif (!pclrd->numlutents) {\n\t\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t\tlutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t));\n\t\t\t\tif (!lutents) {\n\t\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t\tfor (i = 0; i < pclrd->numlutents; ++i) {\n\t\t\t\t\tlutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];\n\t\t\t\t}\n\t\t\t\tnewcmptno = jas_image_numcmpts(dec->image);\n\t\t\t\tjas_image_depalettize(dec->image, cmapent->cmptno,\n\t\t\t\t pclrd->numlutents, lutents,\n\t\t\t\t JP2_BPCTODTYPE(pclrd->bpc[cmapent->pcol]), newcmptno);\n\t\t\t\tdec->chantocmptlut[channo] = newcmptno;\n\t\t\t\tjas_free(lutents);\n#if 0\n\t\t\t\tif (dec->cdef) {\n\t\t\t\t\tcdefent = jp2_cdef_lookup(cdefd, channo);\n\t\t\t\t\tif (!cdefent) {\n\t\t\t\t\t\tabort();\n\t\t\t\t\t}\n\t\t\t\tjas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), cdefent->type, cdefent->assoc));\n\t\t\t\t} else {\n\t\t\t\tjas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), 0, channo + 1));\n\t\t\t\t}\n#else\n\t\t\t\t/* suppress -Wunused-but-set-variable */\n\t\t\t\t(void)cdefd;\n#endif\n\t\t\t} else {\n\t\t\t\tjas_eprintf(\"error: invalid MTYP in CMAP box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Ensure that the number of channels being used by the decoder\n\t matches the number of image components. */\n\tif (dec->numchans != jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: mismatch in number of components (%d != %d)\\n\",\n\t\t dec->numchans, jas_image_numcmpts(dec->image));\n\t\tgoto error;\n\t}\n\n\t/* Mark all components as being of unknown type. */\n\n\tfor (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {\n\t\tjas_image_setcmpttype(dec->image, i, JAS_IMAGE_CT_UNKNOWN);\n\t}\n\n\t/* Determine the type of each component. */\n\tif (dec->cdef) {\n\t\tfor (i = 0; i < dec->cdef->data.cdef.numchans; ++i) {\n\t\t\t/* Is the channel number reasonable? */\n\t\t\tif (dec->cdef->data.cdef.ents[i].channo >= dec->numchans) {\n\t\t\t\tjas_eprintf(\"error: invalid channel number in CDEF box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\tjas_image_setcmpttype(dec->image,\n\t\t\t dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo],\n\t\t\t jp2_getct(jas_image_clrspc(dec->image),\n\t\t\t dec->cdef->data.cdef.ents[i].type,\n\t\t\t dec->cdef->data.cdef.ents[i].assoc));\n\t\t}\n\t} else {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\tjas_image_setcmpttype(dec->image, dec->chantocmptlut[i],\n\t\t\t jp2_getct(jas_image_clrspc(dec->image), 0, i + 1));\n\t\t}\n\t}\n\n\t/* Delete any components that are not of interest. */\n\tfor (i = jas_image_numcmpts(dec->image); i > 0; --i) {\n\t\tif (jas_image_cmpttype(dec->image, i - 1) == JAS_IMAGE_CT_UNKNOWN) {\n\t\t\tjas_image_delcmpt(dec->image, i - 1);\n\t\t}\n\t}\n\n\t/* Ensure that some components survived. */\n\tif (!jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: no components\\n\");\n\t\tgoto error;\n\t}\n#if 0\njas_eprintf(\"no of components is %d\\n\", jas_image_numcmpts(dec->image));\n#endif\n\n\t/* Prevent the image from being destroyed later. */\n\timage = dec->image;\n\tdec->image = 0;\n\n\tjp2_dec_destroy(dec);\n\n\treturn image;\n\nerror:\n\tif (box) {\n\t\tjp2_box_destroy(box);\n\t}\n\tif (dec) {\n\t\tjp2_dec_destroy(dec);\n\t}\n\treturn 0;\n}","target":"jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr)\n{\n\tjp2_box_t *box;\n\tint found;\n\tjas_image_t *image;\n\tjp2_dec_t *dec;\n\tbool samedtype;\n\tint dtype;\n\tunsigned int i;\n\tjp2_cmap_t *cmapd;\n\tjp2_pclr_t *pclrd;\n\tjp2_cdef_t *cdefd;\n\tunsigned int channo;\n\tint newcmptno;\n\tint_fast32_t *lutents;\n#if 0\n\tjp2_cdefchan_t *cdefent;\n\tint cmptno;\n#endif\n\tjp2_cmapent_t *cmapent;\n\tjas_icchdr_t icchdr;\n\tjas_iccprof_t *iccprof;\n\n\tdec = 0;\n\tbox = 0;\n\timage = 0;\n\n\tJAS_DBGLOG(100, (\"jp2_decode(%p, \\\"%s\\\")\\n\", in, optstr));\n\n\tif (!(dec = jp2_dec_create())) {\n\t\tgoto error;\n\t}\n\n\t/* Get the first box. This should be a JP box. */\n\tif (!(box = jp2_box_get(in))) {\n\t\tjas_eprintf(\"error: cannot get box\\n\");\n\t\tgoto error;\n\t}\n\tif (box->type != JP2_BOX_JP) {\n\t\tjas_eprintf(\"error: expecting signature box\\n\");\n\t\tgoto error;\n\t}\n\tif (box->data.jp.magic != JP2_JP_MAGIC) {\n\t\tjas_eprintf(\"incorrect magic number\\n\");\n\t\tgoto error;\n\t}\n\tjp2_box_destroy(box);\n\tbox = 0;\n\n\t/* Get the second box. This should be a FTYP box. */\n\tif (!(box = jp2_box_get(in))) {\n\t\tgoto error;\n\t}\n\tif (box->type != JP2_BOX_FTYP) {\n\t\tjas_eprintf(\"expecting file type box\\n\");\n\t\tgoto error;\n\t}\n\tjp2_box_destroy(box);\n\tbox = 0;\n\n\t/* Get more boxes... */\n\tfound = 0;\n\twhile ((box = jp2_box_get(in))) {\n\t\tif (jas_getdbglevel() >= 1) {\n\t\t\tjas_eprintf(\"got box type %s\\n\", box->info->name);\n\t\t}\n\t\tswitch (box->type) {\n\t\tcase JP2_BOX_JP2C:\n\t\t\tfound = 1;\n\t\t\tbreak;\n\t\tcase JP2_BOX_IHDR:\n\t\t\tif (!dec->ihdr) {\n\t\t\t\tdec->ihdr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_BPCC:\n\t\t\tif (!dec->bpcc) {\n\t\t\t\tdec->bpcc = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_CDEF:\n\t\t\tif (!dec->cdef) {\n\t\t\t\tdec->cdef = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_PCLR:\n\t\t\tif (!dec->pclr) {\n\t\t\t\tdec->pclr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_CMAP:\n\t\t\tif (!dec->cmap) {\n\t\t\t\tdec->cmap = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_COLR:\n\t\t\tif (!dec->colr) {\n\t\t\t\tdec->colr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif (box) {\n\t\t\tjp2_box_destroy(box);\n\t\t\tbox = 0;\n\t\t}\n\t\tif (found) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!found) {\n\t\tjas_eprintf(\"error: no code stream found\\n\");\n\t\tgoto error;\n\t}\n\n\tif (!(dec->image = jpc_decode(in, optstr))) {\n\t\tjas_eprintf(\"error: cannot decode code stream\\n\");\n\t\tgoto error;\n\t}\n\n\t/* An IHDR box must be present. */\n\tif (!dec->ihdr) {\n\t\tjas_eprintf(\"error: missing IHDR box\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Does the number of components indicated in the IHDR box match\n\t the value specified in the code stream? */\n\tif (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(jas_uint,\n\t jas_image_numcmpts(dec->image))) {\n\t\tjas_eprintf(\"error: number of components mismatch (IHDR)\\n\");\n\t\tgoto error;\n\t}\n\n\t/* At least one component must be present. */\n\tif (!jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: no components\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Determine if all components have the same data type. */\n\tsamedtype = true;\n\tdtype = jas_image_cmptdtype(dec->image, 0);\n\tfor (i = 1; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {\n\t\tif (jas_image_cmptdtype(dec->image, i) != dtype) {\n\t\t\tsamedtype = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* Is the component data type indicated in the IHDR box consistent\n\t with the data in the code stream? */\n\tif ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||\n\t (!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {\n\t\tjas_eprintf(\"error: component data type mismatch (IHDR)\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Is the compression type supported? */\n\tif (dec->ihdr->data.ihdr.comptype != JP2_IHDR_COMPTYPE) {\n\t\tjas_eprintf(\"error: unsupported compression type\\n\");\n\t\tgoto error;\n\t}\n\n\tif (dec->bpcc) {\n\t\t/* Is the number of components indicated in the BPCC box\n\t\t consistent with the code stream data? */\n\t\tif (dec->bpcc->data.bpcc.numcmpts !=\n\t\t JAS_CAST(jas_uint, jas_image_numcmpts(dec->image))) {\n\t\t\tjas_eprintf(\"error: number of components mismatch (BPCC)\\n\");\n\t\t\tgoto error;\n\t\t}\n\t\t/* Is the component data type information indicated in the BPCC\n\t\t box consistent with the code stream data? */\n\t\tif (!samedtype) {\n\t\t\tfor (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));\n\t\t\t ++i) {\n\t\t\t\tif (jas_image_cmptdtype(dec->image, i) !=\n\t\t\t\t JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {\n\t\t\t\t\tjas_eprintf(\"error: component data type mismatch (BPCC)\\n\");\n\t\t\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tjas_eprintf(\"warning: superfluous BPCC box\\n\");\n\t\t}\n\t}\n\n\t/* A COLR box must be present. */\n\tif (!dec->colr) {\n\t\tjas_eprintf(\"error: no COLR box\\n\");\n\t\tgoto error;\n\t}\n\n\tswitch (dec->colr->data.colr.method) {\n\tcase JP2_COLR_ENUM:\n\t\tjas_image_setclrspc(dec->image, jp2_getcs(&dec->colr->data.colr));\n\t\tbreak;\n\tcase JP2_COLR_ICC:\n\t\ticcprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp,\n\t\t dec->colr->data.colr.iccplen);\n\t\tif (!iccprof) {\n\t\t\tjas_eprintf(\"error: failed to parse ICC profile\\n\");\n\t\t\tgoto error;\n\t\t}\n\t\tjas_iccprof_gethdr(iccprof, &icchdr);\n\t\tjas_eprintf(\"ICC Profile CS %08x\\n\", icchdr.colorspc);\n\t\tjas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc));\n\t\tdec->image->cmprof_ = jas_cmprof_createfromiccprof(iccprof);\n\t\tif (!dec->image->cmprof_) {\n\t\t\tjas_iccprof_destroy(iccprof);\n\t\t\tgoto error;\n\t\t}\n\t\tjas_iccprof_destroy(iccprof);\n\t\tbreak;\n\t}\n\n\t/* If a CMAP box is present, a PCLR box must also be present. */\n\tif (dec->cmap && !dec->pclr) {\n\t\tjas_eprintf(\"warning: missing PCLR box or superfluous CMAP box\\n\");\n\t\tjp2_box_destroy(dec->cmap);\n\t\tdec->cmap = 0;\n\t}\n\n\t/* If a CMAP box is not present, a PCLR box must not be present. */\n\tif (!dec->cmap && dec->pclr) {\n\t\tjas_eprintf(\"warning: missing CMAP box or superfluous PCLR box\\n\");\n\t\tjp2_box_destroy(dec->pclr);\n\t\tdec->pclr = 0;\n\t}\n\n\t/* Determine the number of channels (which is essentially the number\n\t of components after any palette mappings have been applied). */\n\tdec->numchans = dec->cmap ? dec->cmap->data.cmap.numchans :\n\t JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));\n\n\t/* Perform a basic sanity check on the CMAP box if present. */\n\tif (dec->cmap) {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\t/* Is the component number reasonable? */\n\t\t\tif (dec->cmap->data.cmap.ents[i].cmptno >= JAS_CAST(jas_uint,\n\t\t\t jas_image_numcmpts(dec->image))) {\n\t\t\t\tjas_eprintf(\"error: invalid component number in CMAP box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\t/* Is the LUT index reasonable? */\n\t\t\tif (dec->cmap->data.cmap.ents[i].pcol >=\n\t\t\t dec->pclr->data.pclr.numchans) {\n\t\t\t\tjas_eprintf(\"error: invalid CMAP LUT index\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Allocate space for the channel-number to component-number LUT. */\n\tif (!(dec->chantocmptlut = jas_alloc2(dec->numchans,\n\t sizeof(uint_fast16_t)))) {\n\t\tjas_eprintf(\"error: no memory\\n\");\n\t\tgoto error;\n\t}\n\n\tif (!dec->cmap) {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\tdec->chantocmptlut[i] = i;\n\t\t}\n\t} else {\n\t\tcmapd = &dec->cmap->data.cmap;\n\t\tpclrd = &dec->pclr->data.pclr;\n\t\tcdefd = &dec->cdef->data.cdef;\n\t\tfor (channo = 0; channo < cmapd->numchans; ++channo) {\n\t\t\tcmapent = &cmapd->ents[channo];\n\t\t\tif (cmapent->map == JP2_CMAP_DIRECT) {\n\t\t\t\tdec->chantocmptlut[channo] = channo;\n\t\t\t} else if (cmapent->map == JP2_CMAP_PALETTE) {\n\t\t\t\tif (!pclrd->numlutents) {\n\t\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t\tlutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t));\n\t\t\t\tif (!lutents) {\n\t\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t\tfor (i = 0; i < pclrd->numlutents; ++i) {\n\t\t\t\t\tlutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];\n\t\t\t\t}\n\t\t\t\tnewcmptno = jas_image_numcmpts(dec->image);\n\t\t\t\tjas_image_depalettize(dec->image, cmapent->cmptno,\n\t\t\t\t pclrd->numlutents, lutents,\n\t\t\t\t JP2_BPCTODTYPE(pclrd->bpc[cmapent->pcol]), newcmptno);\n\t\t\t\tdec->chantocmptlut[channo] = newcmptno;\n\t\t\t\tjas_free(lutents);\n#if 0\n\t\t\t\tif (dec->cdef) {\n\t\t\t\t\tcdefent = jp2_cdef_lookup(cdefd, channo);\n\t\t\t\t\tif (!cdefent) {\n\t\t\t\t\t\tabort();\n\t\t\t\t\t}\n\t\t\t\tjas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), cdefent->type, cdefent->assoc));\n\t\t\t\t} else {\n\t\t\t\tjas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), 0, channo + 1));\n\t\t\t\t}\n#else\n\t\t\t\t/* suppress -Wunused-but-set-variable */\n\t\t\t\t(void)cdefd;\n#endif\n\t\t\t} else {\n\t\t\t\tjas_eprintf(\"error: invalid MTYP in CMAP box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Ensure that the number of channels being used by the decoder\n\t matches the number of image components. */\n\tif (dec->numchans != jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: mismatch in number of components (%d != %d)\\n\",\n\t\t dec->numchans, jas_image_numcmpts(dec->image));\n\t\tgoto error;\n\t}\n\n\t/* Mark all components as being of unknown type. */\n\n\tfor (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {\n\t\tjas_image_setcmpttype(dec->image, i, JAS_IMAGE_CT_UNKNOWN);\n\t}\n\n\t/* Determine the type of each component. */\n\tif (dec->cdef) {\n\t\tfor (i = 0; i < dec->cdef->data.cdef.numchans; ++i) {\n\t\t\t/* Is the channel number reasonable? */\n\t\t\tif (dec->cdef->data.cdef.ents[i].channo >= dec->numchans) {\n\t\t\t\tjas_eprintf(\"error: invalid channel number in CDEF box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\tjas_image_setcmpttype(dec->image,\n\t\t\t dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo],\n\t\t\t jp2_getct(jas_image_clrspc(dec->image),\n\t\t\t dec->cdef->data.cdef.ents[i].type,\n\t\t\t dec->cdef->data.cdef.ents[i].assoc));\n\t\t}\n\t} else {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\tjas_image_setcmpttype(dec->image, dec->chantocmptlut[i],\n\t\t\t jp2_getct(jas_image_clrspc(dec->image), 0, i + 1));\n\t\t}\n\t}\n\n\t/* Delete any components that are not of interest. */\n\tfor (i = jas_image_numcmpts(dec->image); i > 0; --i) {\n\t\tif (jas_image_cmpttype(dec->image, i - 1) == JAS_IMAGE_CT_UNKNOWN) {\n\t\t\tjas_image_delcmpt(dec->image, i - 1);\n\t\t}\n\t}\n\n\t/* Ensure that some components survived. */\n\tif (!jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: no components\\n\");\n\t\tgoto error;\n\t}\n#if 0\njas_eprintf(\"no of components is %d\\n\", jas_image_numcmpts(dec->image));\n#endif\n\n\t/* Prevent the image from being destroyed later. */\n\timage = dec->image;\n\tdec->image = 0;\n\n\tjp2_dec_destroy(dec);\n\n\treturn image;\n\nerror:\n\tif (box) {\n\t\tjp2_box_destroy(box);\n\t}\n\tif (dec) {\n\t\tjp2_dec_destroy(dec);\n\t}\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":3473,"sven_meta":{"func_name":"jp2_decode","file_name":"src/libjasper/jp2/jp2_dec.c","commit_link":"github.com/jasper-software/jasper/commit/41f214b121b837fa30d9ca5f2430212110f5cd9b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#9-de2fd9dfb4b7","input":"static inline void get_conn_text(const conn *c, const int af,\n char* addr, struct sockaddr *sock_addr) {\n char addr_text[MAXPATHLEN];\n addr_text[0] = '\\0';\n const char *protoname = \"?\";\n unsigned short port = 0;\n\n switch (af) {\n case AF_INET:\n (void) inet_ntop(af,\n &((struct sockaddr_in *)sock_addr)->sin_addr,\n addr_text,\n sizeof(addr_text) - 1);\n port = ntohs(((struct sockaddr_in *)sock_addr)->sin_port);\n protoname = IS_UDP(c->transport) ? \"udp\" : \"tcp\";\n break;\n\n case AF_INET6:\n addr_text[0] = '[';\n addr_text[1] = '\\0';\n if (inet_ntop(af,\n &((struct sockaddr_in6 *)sock_addr)->sin6_addr,\n addr_text + 1,\n sizeof(addr_text) - 2)) {\n strcat(addr_text, \"]\");\n }\n port = ntohs(((struct sockaddr_in6 *)sock_addr)->sin6_port);\n protoname = IS_UDP(c->transport) ? \"udp6\" : \"tcp6\";\n break;\n\n case AF_UNIX:\n strncpy(addr_text,\n ((struct sockaddr_un *)sock_addr)->sun_path,\n sizeof(addr_text) - 1);\n addr_text[sizeof(addr_text)-1] = '\\0';\n protoname = \"unix\";\n break;\n }\n\n if (strlen(addr_text) < 2) {\n /* Most likely this is a connected UNIX-domain client which\n * has no peer socket address, but there's no portable way\n * to tell for sure.\n */\n sprintf(addr_text, \"\", af);\n }\n\n if (port) {\n sprintf(addr, \"%s:%s:%u\", protoname, addr_text, port);\n } else {\n sprintf(addr, \"%s:%s\", protoname, addr_text);\n }\n}","target":"static inline void get_conn_text(const conn *c, const int af,\n char* addr, struct sockaddr *sock_addr) {\n char addr_text[MAXPATHLEN];\n addr_text[0] = '\\0';\n const char *protoname = \"?\";\n unsigned short port = 0;\n size_t pathlen = 0;\n\n switch (af) {\n case AF_INET:\n (void) inet_ntop(af,\n &((struct sockaddr_in *)sock_addr)->sin_addr,\n addr_text,\n sizeof(addr_text) - 1);\n port = ntohs(((struct sockaddr_in *)sock_addr)->sin_port);\n protoname = IS_UDP(c->transport) ? \"udp\" : \"tcp\";\n break;\n\n case AF_INET6:\n addr_text[0] = '[';\n addr_text[1] = '\\0';\n if (inet_ntop(af,\n &((struct sockaddr_in6 *)sock_addr)->sin6_addr,\n addr_text + 1,\n sizeof(addr_text) - 2)) {\n strcat(addr_text, \"]\");\n }\n port = ntohs(((struct sockaddr_in6 *)sock_addr)->sin6_port);\n protoname = IS_UDP(c->transport) ? \"udp6\" : \"tcp6\";\n break;\n\n case AF_UNIX:\n // this strncpy call originally could piss off an address\n // sanitizer; we supplied the size of the dest buf as a limiter,\n // but optimized versions of strncpy could read past the end of\n // *src while looking for a null terminator. Since buf and\n // sun_path here are both on the stack they could even overlap,\n // which is \"undefined\". In all OSS versions of strncpy I could\n // find this has no effect; it'll still only copy until the first null\n // terminator is found. Thus it's possible to get the OS to\n // examine past the end of sun_path but it's unclear to me if this\n // can cause any actual problem.\n //\n // We need a safe_strncpy util function but I'll punt on figuring\n // that out for now.\n pathlen = sizeof(((struct sockaddr_un *)sock_addr)->sun_path);\n if (MAXPATHLEN <= pathlen) {\n pathlen = MAXPATHLEN - 1;\n }\n strncpy(addr_text,\n ((struct sockaddr_un *)sock_addr)->sun_path,\n pathlen);\n addr_text[pathlen] = '\\0';\n protoname = \"unix\";\n break;\n }\n\n if (strlen(addr_text) < 2) {\n /* Most likely this is a connected UNIX-domain client which\n * has no peer socket address, but there's no portable way\n * to tell for sure.\n */\n sprintf(addr_text, \"\", af);\n }\n\n if (port) {\n sprintf(addr, \"%s:%s:%u\", protoname, addr_text, port);\n } else {\n sprintf(addr, \"%s:%s\", protoname, addr_text);\n }\n}","lang":"c","vul_type":"cwe-125","target_token_count":642,"sven_meta":{"func_name":"get_conn_text","file_name":"memcached.c","commit_link":"github.com/memcached/memcached/commit/554b56687a19300a75ec24184746b5512580c819","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#10-0f8c86ffd07f","input":"static void parse_sec_attr_44(sc_file_t *file, const u8 *buf, size_t len)\n{\n\t/* OpenSc Operation values for each command operation-type */\n\tconst int df_idx[8] = {\t /* byte 1 = OpenSC type of AC Bit0, byte 2 = OpenSC type of AC Bit1 ...*/\n\t\tSC_AC_OP_DELETE, SC_AC_OP_CREATE, SC_AC_OP_CREATE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\tSC_AC_OP_LOCK, SC_AC_OP_DELETE, -1};\n\tconst int ef_idx[8] = {\n\t\tSC_AC_OP_READ, SC_AC_OP_UPDATE, SC_AC_OP_WRITE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\t-1, SC_AC_OP_ERASE, -1};\n\tconst int efi_idx[8] = { /* internal EF used for RSA keys */\n\t\tSC_AC_OP_READ, SC_AC_OP_ERASE, SC_AC_OP_UPDATE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\t-1, SC_AC_OP_ERASE, -1};\n\n\tu8\t\tbValue;\n\tint\t\ti;\n\tint\t\tiKeyRef = 0;\n\tint\t\tiMethod;\n\tint\t\tiPinCount;\n\tint\t\tiOffset = 0;\n\tint\t\tiOperation;\n\tconst int*\tp_idx;\n\n\t/* Check all sub-AC definitions within the total AC */\n\twhile (len > 1) {\t\t\t\t/* minimum length = 2 */\n\t\tsize_t iACLen = buf[iOffset] & 0x0F;\n\t\tif (iACLen > len)\n\t\t\tbreak;\n\n\t\tiMethod = SC_AC_NONE;\t\t/* default no authentication required */\n\n\t\tif (buf[iOffset] & 0X80) { /* AC in adaptive coding */\n\t\t\t/* Evaluates only the command-byte, not the optional P1/P2/Option bytes */\n\t\t\tsize_t\tiParmLen = 1;\t\t\t/* command-byte is always present */\n\t\t\tsize_t\tiKeyLen = 0;\t\t\t/* Encryption key is optional */\n\n\t\t\tif (buf[iOffset] & 0x20) iKeyLen++;\n\t\t\tif (buf[iOffset+1] & 0x40) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x20) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x10) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x08) iParmLen++;\n\n\t\t\t/* Get KeyNumber if available */\n\t\t\tif(iKeyLen) {\n\t\t\t\tint iSC;\n\t\t\t\tif (len < 1+(size_t)iACLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiSC = buf[iOffset+iACLen];\n\n\t\t\t\tswitch( (iSC>>5) & 0x03 ){\n\t\t\t\tcase 0:\n\t\t\t\t\tiMethod = SC_AC_TERM;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tiMethod = SC_AC_AUT;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\tcase 3:\n\t\t\t\t\tiMethod = SC_AC_PRO;\t\t/* secure messaging */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tiKeyRef = iSC & 0x1F;\t\t\t/* get key number */\n\t\t\t}\n\n\t\t\t/* Get PinNumber if available */\n\t\t\tif (iACLen > (1+iParmLen+iKeyLen)) { /* check via total length if pin is present */\n\t\t\t\tif (len < 1+1+1+(size_t)iParmLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiKeyRef = buf[iOffset+1+1+iParmLen]; /* PTL + AM-header + parameter-bytes */\n\t\t\t\tiMethod = SC_AC_CHV;\n\t\t\t}\n\n\t\t\t/* Convert SETCOS command to OpenSC command group */\n\t\t\tif (len < 1+2)\n\t\t\t\tbreak;\n\t\t\tswitch(buf[iOffset+2]){\n\t\t\tcase 0x2A:\t\t\t/* crypto operation */\n\t\t\t\tiOperation = SC_AC_OP_CRYPTO;\n\t\t\t\tbreak;\n\t\t\tcase 0x46:\t\t\t/* key-generation operation */\n\t\t\t\tiOperation = SC_AC_OP_UPDATE;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tiOperation = SC_AC_OP_SELECT;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsc_file_add_acl_entry(file, iOperation, iMethod, iKeyRef);\n\t\t}\n\t\telse { /* AC in simple coding */\n\t\t\t /* Initial AC is treated as an operational AC */\n\n\t\t\t/* Get specific Cmd groups for specified file-type */\n\t\t\tswitch (file->type) {\n\t\t\tcase SC_FILE_TYPE_DF: /* DF */\n\t\t\t\tp_idx = df_idx;\n\t\t\t\tbreak;\n\t\t\tcase SC_FILE_TYPE_INTERNAL_EF: /* EF for RSA keys */\n\t\t\t\tp_idx = efi_idx;\n\t\t\t\tbreak;\n\t\t\tdefault: /* EF */\n\t\t\t\tp_idx = ef_idx;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t/* Encryption key present ? */\n\t\t\tiPinCount = iACLen - 1;\t\t\n\n\t\t\tif (buf[iOffset] & 0x20) {\n\t\t\t\tint iSC;\n\t\t\t\tif (len < 1 + (size_t)iACLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiSC = buf[iOffset + iACLen];\n\n\t\t\t\tswitch( (iSC>>5) & 0x03 ) {\n\t\t\t\tcase 0:\n\t\t\t\t\tiMethod = SC_AC_TERM;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tiMethod = SC_AC_AUT;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\tcase 3:\n\t\t\t\t\tiMethod = SC_AC_PRO;\t\t/* secure messaging */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tiKeyRef = iSC & 0x1F;\t\t\t/* get key number */\n\n\t\t\t\tiPinCount--;\t\t\t\t/* one byte used for keyReference */\n\t\t\t}\n\n\t\t\t/* Pin present ? */\n\t\t\tif ( iPinCount > 0 ) {\n\t\t\t\tif (len < 1 + 2)\n\t\t\t\t\tbreak;\n\t\t\t\tiKeyRef = buf[iOffset + 2];\t/* pin ref */\n\t\t\t\tiMethod = SC_AC_CHV;\n\t\t\t}\n\n\t\t\t/* Add AC for each command-operationType into OpenSc structure */\n\t\t\tbValue = buf[iOffset + 1];\n\t\t\tfor (i = 0; i < 8; i++) {\n\t\t\t\tif((bValue & 1) && (p_idx[i] >= 0))\n\t\t\t\t\tsc_file_add_acl_entry(file, p_idx[i], iMethod, iKeyRef);\n\t\t\t\tbValue >>= 1;\n\t\t\t}\n\t\t}\n\t\t/* Current field treated, get next AC sub-field */\n\t\tiOffset += iACLen +1;\t\t/* AC + PTL-byte */\n\t\tlen -= iACLen +1;\n\t}\n}","target":"static void parse_sec_attr_44(sc_file_t *file, const u8 *buf, size_t len)\n{\n\t/* OpenSc Operation values for each command operation-type */\n\tconst int df_idx[8] = {\t /* byte 1 = OpenSC type of AC Bit0, byte 2 = OpenSC type of AC Bit1 ...*/\n\t\tSC_AC_OP_DELETE, SC_AC_OP_CREATE, SC_AC_OP_CREATE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\tSC_AC_OP_LOCK, SC_AC_OP_DELETE, -1};\n\tconst int ef_idx[8] = {\n\t\tSC_AC_OP_READ, SC_AC_OP_UPDATE, SC_AC_OP_WRITE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\t-1, SC_AC_OP_ERASE, -1};\n\tconst int efi_idx[8] = { /* internal EF used for RSA keys */\n\t\tSC_AC_OP_READ, SC_AC_OP_ERASE, SC_AC_OP_UPDATE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\t-1, SC_AC_OP_ERASE, -1};\n\n\tu8\t\tbValue;\n\tint\t\ti;\n\tint\t\tiKeyRef = 0;\n\tint\t\tiMethod;\n\tint\t\tiPinCount;\n\tint\t\tiOffset = 0;\n\tint\t\tiOperation;\n\tconst int*\tp_idx;\n\n\t/* Check all sub-AC definitions within the total AC */\n\twhile (len > 1) {\t\t\t\t/* minimum length = 2 */\n\t\tsize_t iACLen = buf[iOffset] & 0x0F;\n\t\tif (iACLen > len)\n\t\t\tbreak;\n\n\t\tiMethod = SC_AC_NONE;\t\t/* default no authentication required */\n\n\t\tif (buf[iOffset] & 0X80) { /* AC in adaptive coding */\n\t\t\t/* Evaluates only the command-byte, not the optional P1/P2/Option bytes */\n\t\t\tsize_t\tiParmLen = 1;\t\t\t/* command-byte is always present */\n\t\t\tsize_t\tiKeyLen = 0;\t\t\t/* Encryption key is optional */\n\n\t\t\tif (buf[iOffset] & 0x20) iKeyLen++;\n\t\t\tif (buf[iOffset+1] & 0x40) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x20) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x10) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x08) iParmLen++;\n\n\t\t\t/* Get KeyNumber if available */\n\t\t\tif(iKeyLen) {\n\t\t\t\tint iSC;\n\t\t\t\tif (len < 1+(size_t)iACLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiSC = buf[iOffset+iACLen];\n\n\t\t\t\tswitch( (iSC>>5) & 0x03 ){\n\t\t\t\tcase 0:\n\t\t\t\t\tiMethod = SC_AC_TERM;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tiMethod = SC_AC_AUT;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\tcase 3:\n\t\t\t\t\tiMethod = SC_AC_PRO;\t\t/* secure messaging */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tiKeyRef = iSC & 0x1F;\t\t\t/* get key number */\n\t\t\t}\n\n\t\t\t/* Get PinNumber if available */\n\t\t\tif (iACLen > (1+iParmLen+iKeyLen)) { /* check via total length if pin is present */\n\t\t\t\tif (len < 1+1+1+(size_t)iParmLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiKeyRef = buf[iOffset+1+1+iParmLen]; /* PTL + AM-header + parameter-bytes */\n\t\t\t\tiMethod = SC_AC_CHV;\n\t\t\t}\n\n\t\t\t/* Convert SETCOS command to OpenSC command group */\n\t\t\tif (len < 1+2)\n\t\t\t\tbreak;\n\t\t\tswitch(buf[iOffset+2]){\n\t\t\tcase 0x2A:\t\t\t/* crypto operation */\n\t\t\t\tiOperation = SC_AC_OP_CRYPTO;\n\t\t\t\tbreak;\n\t\t\tcase 0x46:\t\t\t/* key-generation operation */\n\t\t\t\tiOperation = SC_AC_OP_UPDATE;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tiOperation = SC_AC_OP_SELECT;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsc_file_add_acl_entry(file, iOperation, iMethod, iKeyRef);\n\t\t}\n\t\telse { /* AC in simple coding */\n\t\t\t /* Initial AC is treated as an operational AC */\n\n\t\t\t/* Get specific Cmd groups for specified file-type */\n\t\t\tswitch (file->type) {\n\t\t\tcase SC_FILE_TYPE_DF: /* DF */\n\t\t\t\tp_idx = df_idx;\n\t\t\t\tbreak;\n\t\t\tcase SC_FILE_TYPE_INTERNAL_EF: /* EF for RSA keys */\n\t\t\t\tp_idx = efi_idx;\n\t\t\t\tbreak;\n\t\t\tdefault: /* EF */\n\t\t\t\tp_idx = ef_idx;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t/* Encryption key present ? */\n\t\t\tiPinCount = iACLen > 0 ? iACLen - 1 : 0;\n\n\t\t\tif (buf[iOffset] & 0x20) {\n\t\t\t\tint iSC;\n\t\t\t\tif (len < 1 + (size_t)iACLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiSC = buf[iOffset + iACLen];\n\n\t\t\t\tswitch( (iSC>>5) & 0x03 ) {\n\t\t\t\tcase 0:\n\t\t\t\t\tiMethod = SC_AC_TERM;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tiMethod = SC_AC_AUT;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\tcase 3:\n\t\t\t\t\tiMethod = SC_AC_PRO;\t\t/* secure messaging */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tiKeyRef = iSC & 0x1F;\t\t\t/* get key number */\n\n\t\t\t\tiPinCount--;\t\t\t\t/* one byte used for keyReference */\n\t\t\t}\n\n\t\t\t/* Pin present ? */\n\t\t\tif ( iPinCount > 0 ) {\n\t\t\t\tif (len < 1 + 2)\n\t\t\t\t\tbreak;\n\t\t\t\tiKeyRef = buf[iOffset + 2];\t/* pin ref */\n\t\t\t\tiMethod = SC_AC_CHV;\n\t\t\t}\n\n\t\t\t/* Add AC for each command-operationType into OpenSc structure */\n\t\t\tbValue = buf[iOffset + 1];\n\t\t\tfor (i = 0; i < 8; i++) {\n\t\t\t\tif((bValue & 1) && (p_idx[i] >= 0))\n\t\t\t\t\tsc_file_add_acl_entry(file, p_idx[i], iMethod, iKeyRef);\n\t\t\t\tbValue >>= 1;\n\t\t\t}\n\t\t}\n\t\t/* Current field treated, get next AC sub-field */\n\t\tiOffset += iACLen +1;\t\t/* AC + PTL-byte */\n\t\tlen -= iACLen +1;\n\t}\n}","lang":"c","vul_type":"cwe-125","target_token_count":1456,"sven_meta":{"func_name":"parse_sec_attr_44","file_name":"src/libopensc/card-setcos.c","commit_link":"github.com/OpenSC/OpenSC/commit/c3f23b836e5a1766c36617fe1da30d22f7b63de2","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#11-01598c77f374","input":"do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,\n int swap, uint32_t namesz, uint32_t descsz,\n size_t noff, size_t doff, int *flags, size_t size, int clazz)\n{\n#ifdef ELFCORE\n\tint os_style = -1;\n\t/*\n\t * Sigh. The 2.0.36 kernel in Debian 2.1, at\n\t * least, doesn't correctly implement name\n\t * sections, in core dumps, as specified by\n\t * the \"Program Linking\" section of \"UNIX(R) System\n\t * V Release 4 Programmer's Guide: ANSI C and\n\t * Programming Support Tools\", because my copy\n\t * clearly says \"The first 'namesz' bytes in 'name'\n\t * contain a *null-terminated* [emphasis mine]\n\t * character representation of the entry's owner\n\t * or originator\", but the 2.0.36 kernel code\n\t * doesn't include the terminating null in the\n\t * name....\n\t */\n\tif ((namesz == 4 && strncmp((char *)&nbuf[noff], \"CORE\", 4) == 0) ||\n\t (namesz == 5 && strcmp((char *)&nbuf[noff], \"CORE\") == 0)) {\n\t\tos_style = OS_STYLE_SVR4;\n\t} \n\n\tif ((namesz == 8 && strcmp((char *)&nbuf[noff], \"FreeBSD\") == 0)) {\n\t\tos_style = OS_STYLE_FREEBSD;\n\t}\n\n\tif ((namesz >= 11 && strncmp((char *)&nbuf[noff], \"NetBSD-CORE\", 11)\n\t == 0)) {\n\t\tos_style = OS_STYLE_NETBSD;\n\t}\n\n\tif (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {\n\t\tif (file_printf(ms, \", %s-style\", os_style_names[os_style])\n\t\t == -1)\n\t\t\treturn 1;\n\t\t*flags |= FLAGS_DID_CORE_STYLE;\n\t\t*flags |= os_style;\n\t}\n\n\tswitch (os_style) {\n\tcase OS_STYLE_NETBSD:\n\t\tif (type == NT_NETBSD_CORE_PROCINFO) {\n\t\t\tchar sbuf[512];\n\t\t\tstruct NetBSD_elfcore_procinfo pi;\n\t\t\tmemset(&pi, 0, sizeof(pi));\n\t\t\tmemcpy(&pi, nbuf + doff, descsz);\n\n\t\t\tif (file_printf(ms, \", from '%.31s', pid=%u, uid=%u, \"\n\t\t\t \"gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)\",\n\t\t\t file_printable(sbuf, sizeof(sbuf),\n\t\t\t CAST(char *, pi.cpi_name)),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_pid),\n\t\t\t elf_getu32(swap, pi.cpi_euid),\n\t\t\t elf_getu32(swap, pi.cpi_egid),\n\t\t\t elf_getu32(swap, pi.cpi_nlwps),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_siglwp),\n\t\t\t elf_getu32(swap, pi.cpi_signo),\n\t\t\t elf_getu32(swap, pi.cpi_sigcode)) == -1)\n\t\t\t\treturn 1;\n\n\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\treturn 1;\n\t\t}\n\t\tbreak;\n\n\tdefault:\n\t\tif (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {\n\t\t\tsize_t i, j;\n\t\t\tunsigned char c;\n\t\t\t/*\n\t\t\t * Extract the program name. We assume\n\t\t\t * it to be 16 characters (that's what it\n\t\t\t * is in SunOS 5.x and Linux).\n\t\t\t *\n\t\t\t * Unfortunately, it's at a different offset\n\t\t\t * in various OSes, so try multiple offsets.\n\t\t\t * If the characters aren't all printable,\n\t\t\t * reject it.\n\t\t\t */\n\t\t\tfor (i = 0; i < NOFFSETS; i++) {\n\t\t\t\tunsigned char *cname, *cp;\n\t\t\t\tsize_t reloffset = prpsoffsets(i);\n\t\t\t\tsize_t noffset = doff + reloffset;\n\t\t\t\tsize_t k;\n\t\t\t\tfor (j = 0; j < 16; j++, noffset++,\n\t\t\t\t reloffset++) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the buffer; if\n\t\t\t\t\t * we are, just give up.\n\t\t\t\t\t */\n\t\t\t\t\tif (noffset >= size)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the contents;\n\t\t\t\t\t * if we are, this obviously\n\t\t\t\t\t * isn't the right offset.\n\t\t\t\t\t */\n\t\t\t\t\tif (reloffset >= descsz)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\tc = nbuf[noffset];\n\t\t\t\t\tif (c == '\\0') {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A '\\0' at the\n\t\t\t\t\t\t * beginning is\n\t\t\t\t\t\t * obviously wrong.\n\t\t\t\t\t\t * Any other '\\0'\n\t\t\t\t\t\t * means we're done.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (j == 0)\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A nonprintable\n\t\t\t\t\t\t * character is also\n\t\t\t\t\t\t * wrong.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (!isprint(c) || isquote(c))\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Well, that worked.\n\t\t\t\t */\n\n\t\t\t\t/*\n\t\t\t\t * Try next offsets, in case this match is\n\t\t\t\t * in the middle of a string.\n\t\t\t\t */\n\t\t\t\tfor (k = i + 1 ; k < NOFFSETS; k++) {\n\t\t\t\t\tsize_t no;\n\t\t\t\t\tint adjust = 1;\n\t\t\t\t\tif (prpsoffsets(k) >= prpsoffsets(i))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tfor (no = doff + prpsoffsets(k);\n\t\t\t\t\t no < doff + prpsoffsets(i); no++)\n\t\t\t\t\t\tadjust = adjust\n\t\t\t\t\t\t && isprint(nbuf[no]);\n\t\t\t\t\tif (adjust)\n\t\t\t\t\t\ti = k;\n\t\t\t\t}\n\n\t\t\t\tcname = (unsigned char *)\n\t\t\t\t &nbuf[doff + prpsoffsets(i)];\n\t\t\t\tfor (cp = cname; *cp && isprint(*cp); cp++)\n\t\t\t\t\tcontinue;\n\t\t\t\t/*\n\t\t\t\t * Linux apparently appends a space at the end\n\t\t\t\t * of the command line: remove it.\n\t\t\t\t */\n\t\t\t\twhile (cp > cname && isspace(cp[-1]))\n\t\t\t\t\tcp--;\n\t\t\t\tif (file_printf(ms, \", from '%.*s'\",\n\t\t\t\t (int)(cp - cname), cname) == -1)\n\t\t\t\t\treturn 1;\n\t\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\t\treturn 1;\n\n\t\t\ttryanother:\n\t\t\t\t;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n#endif\n\treturn 0;\n}","target":"do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,\n int swap, uint32_t namesz, uint32_t descsz,\n size_t noff, size_t doff, int *flags, size_t size, int clazz)\n{\n#ifdef ELFCORE\n\tint os_style = -1;\n\t/*\n\t * Sigh. The 2.0.36 kernel in Debian 2.1, at\n\t * least, doesn't correctly implement name\n\t * sections, in core dumps, as specified by\n\t * the \"Program Linking\" section of \"UNIX(R) System\n\t * V Release 4 Programmer's Guide: ANSI C and\n\t * Programming Support Tools\", because my copy\n\t * clearly says \"The first 'namesz' bytes in 'name'\n\t * contain a *null-terminated* [emphasis mine]\n\t * character representation of the entry's owner\n\t * or originator\", but the 2.0.36 kernel code\n\t * doesn't include the terminating null in the\n\t * name....\n\t */\n\tif ((namesz == 4 && strncmp((char *)&nbuf[noff], \"CORE\", 4) == 0) ||\n\t (namesz == 5 && strcmp((char *)&nbuf[noff], \"CORE\") == 0)) {\n\t\tos_style = OS_STYLE_SVR4;\n\t} \n\n\tif ((namesz == 8 && strcmp((char *)&nbuf[noff], \"FreeBSD\") == 0)) {\n\t\tos_style = OS_STYLE_FREEBSD;\n\t}\n\n\tif ((namesz >= 11 && strncmp((char *)&nbuf[noff], \"NetBSD-CORE\", 11)\n\t == 0)) {\n\t\tos_style = OS_STYLE_NETBSD;\n\t}\n\n\tif (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {\n\t\tif (file_printf(ms, \", %s-style\", os_style_names[os_style])\n\t\t == -1)\n\t\t\treturn 1;\n\t\t*flags |= FLAGS_DID_CORE_STYLE;\n\t\t*flags |= os_style;\n\t}\n\n\tswitch (os_style) {\n\tcase OS_STYLE_NETBSD:\n\t\tif (type == NT_NETBSD_CORE_PROCINFO) {\n\t\t\tchar sbuf[512];\n\t\t\tstruct NetBSD_elfcore_procinfo pi;\n\t\t\tmemset(&pi, 0, sizeof(pi));\n\t\t\tmemcpy(&pi, nbuf + doff, descsz);\n\n\t\t\tif (file_printf(ms, \", from '%.31s', pid=%u, uid=%u, \"\n\t\t\t \"gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)\",\n\t\t\t file_printable(sbuf, sizeof(sbuf),\n\t\t\t CAST(char *, pi.cpi_name)),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_pid),\n\t\t\t elf_getu32(swap, pi.cpi_euid),\n\t\t\t elf_getu32(swap, pi.cpi_egid),\n\t\t\t elf_getu32(swap, pi.cpi_nlwps),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_siglwp),\n\t\t\t elf_getu32(swap, pi.cpi_signo),\n\t\t\t elf_getu32(swap, pi.cpi_sigcode)) == -1)\n\t\t\t\treturn 1;\n\n\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\treturn 1;\n\t\t}\n\t\tbreak;\n\n\tdefault:\n\t\tif (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {\n\t\t\tsize_t i, j;\n\t\t\tunsigned char c;\n\t\t\t/*\n\t\t\t * Extract the program name. We assume\n\t\t\t * it to be 16 characters (that's what it\n\t\t\t * is in SunOS 5.x and Linux).\n\t\t\t *\n\t\t\t * Unfortunately, it's at a different offset\n\t\t\t * in various OSes, so try multiple offsets.\n\t\t\t * If the characters aren't all printable,\n\t\t\t * reject it.\n\t\t\t */\n\t\t\tfor (i = 0; i < NOFFSETS; i++) {\n\t\t\t\tunsigned char *cname, *cp;\n\t\t\t\tsize_t reloffset = prpsoffsets(i);\n\t\t\t\tsize_t noffset = doff + reloffset;\n\t\t\t\tsize_t k;\n\t\t\t\tfor (j = 0; j < 16; j++, noffset++,\n\t\t\t\t reloffset++) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the buffer; if\n\t\t\t\t\t * we are, just give up.\n\t\t\t\t\t */\n\t\t\t\t\tif (noffset >= size)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the contents;\n\t\t\t\t\t * if we are, this obviously\n\t\t\t\t\t * isn't the right offset.\n\t\t\t\t\t */\n\t\t\t\t\tif (reloffset >= descsz)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\tc = nbuf[noffset];\n\t\t\t\t\tif (c == '\\0') {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A '\\0' at the\n\t\t\t\t\t\t * beginning is\n\t\t\t\t\t\t * obviously wrong.\n\t\t\t\t\t\t * Any other '\\0'\n\t\t\t\t\t\t * means we're done.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (j == 0)\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A nonprintable\n\t\t\t\t\t\t * character is also\n\t\t\t\t\t\t * wrong.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (!isprint(c) || isquote(c))\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Well, that worked.\n\t\t\t\t */\n\n\t\t\t\t/*\n\t\t\t\t * Try next offsets, in case this match is\n\t\t\t\t * in the middle of a string.\n\t\t\t\t */\n\t\t\t\tfor (k = i + 1 ; k < NOFFSETS; k++) {\n\t\t\t\t\tsize_t no;\n\t\t\t\t\tint adjust = 1;\n\t\t\t\t\tif (prpsoffsets(k) >= prpsoffsets(i))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tfor (no = doff + prpsoffsets(k);\n\t\t\t\t\t no < doff + prpsoffsets(i); no++)\n\t\t\t\t\t\tadjust = adjust\n\t\t\t\t\t\t && isprint(nbuf[no]);\n\t\t\t\t\tif (adjust)\n\t\t\t\t\t\ti = k;\n\t\t\t\t}\n\n\t\t\t\tcname = (unsigned char *)\n\t\t\t\t &nbuf[doff + prpsoffsets(i)];\n\t\t\t\tfor (cp = cname; cp < nbuf + size && *cp\n\t\t\t\t && isprint(*cp); cp++)\n\t\t\t\t\tcontinue;\n\t\t\t\t/*\n\t\t\t\t * Linux apparently appends a space at the end\n\t\t\t\t * of the command line: remove it.\n\t\t\t\t */\n\t\t\t\twhile (cp > cname && isspace(cp[-1]))\n\t\t\t\t\tcp--;\n\t\t\t\tif (file_printf(ms, \", from '%.*s'\",\n\t\t\t\t (int)(cp - cname), cname) == -1)\n\t\t\t\t\treturn 1;\n\t\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\t\treturn 1;\n\n\t\t\ttryanother:\n\t\t\t\t;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n#endif\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","target_token_count":1483,"sven_meta":{"func_name":"do_core_note","file_name":"src/readelf.c","commit_link":"github.com/file/file/commit/a642587a9c9e2dd7feacdf513c3643ce26ad3c22","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#12-28ae63503698","input":"gst_asf_demux_process_ext_content_desc (GstASFDemux * demux, guint8 * data,\n guint64 size)\n{\n /* Other known (and unused) 'text/unicode' metadata available :\n *\n * WM/Lyrics =\n * WM/MediaPrimaryClassID = {D1607DBC-E323-4BE2-86A1-48A42A28441E}\n * WMFSDKVersion = 9.00.00.2980\n * WMFSDKNeeded = 0.0.0.0000\n * WM/UniqueFileIdentifier = AMGa_id=R 15334;AMGp_id=P 5149;AMGt_id=T 2324984\n * WM/Publisher = 4AD\n * WM/Provider = AMG\n * WM/ProviderRating = 8\n * WM/ProviderStyle = Rock (similar to WM/Genre)\n * WM/GenreID (similar to WM/Genre)\n * WM/TrackNumber (same as WM/Track but as a string)\n *\n * Other known (and unused) 'non-text' metadata available :\n *\n * WM/EncodingTime\n * WM/MCDI\n * IsVBR\n *\n * We might want to read WM/TrackNumber and use atoi() if we don't have\n * WM/Track\n */\n\n GstTagList *taglist;\n guint16 blockcount, i;\n gboolean content3D = FALSE;\n\n struct\n {\n const gchar *interleave_name;\n GstASF3DMode interleaving_type;\n } stereoscopic_layout_map[] = {\n {\n \"SideBySideRF\", GST_ASF_3D_SIDE_BY_SIDE_HALF_RL}, {\n \"SideBySideLF\", GST_ASF_3D_SIDE_BY_SIDE_HALF_LR}, {\n \"OverUnderRT\", GST_ASF_3D_TOP_AND_BOTTOM_HALF_RL}, {\n \"OverUnderLT\", GST_ASF_3D_TOP_AND_BOTTOM_HALF_LR}, {\n \"DualStream\", GST_ASF_3D_DUAL_STREAM}\n };\n GST_INFO_OBJECT (demux, \"object is an extended content description\");\n\n taglist = gst_tag_list_new_empty ();\n\n /* Content Descriptor Count */\n if (size < 2)\n goto not_enough_data;\n\n blockcount = gst_asf_demux_get_uint16 (&data, &size);\n\n for (i = 1; i <= blockcount; ++i) {\n const gchar *gst_tag_name;\n guint16 datatype;\n guint16 value_len;\n guint16 name_len;\n GValue tag_value = { 0, };\n gsize in, out;\n gchar *name;\n gchar *name_utf8 = NULL;\n gchar *value;\n\n /* Descriptor */\n if (!gst_asf_demux_get_string (&name, &name_len, &data, &size))\n goto not_enough_data;\n\n if (size < 2) {\n g_free (name);\n goto not_enough_data;\n }\n /* Descriptor Value Data Type */\n datatype = gst_asf_demux_get_uint16 (&data, &size);\n\n /* Descriptor Value (not really a string, but same thing reading-wise) */\n if (!gst_asf_demux_get_string (&value, &value_len, &data, &size)) {\n g_free (name);\n goto not_enough_data;\n }\n\n name_utf8 =\n g_convert (name, name_len, \"UTF-8\", \"UTF-16LE\", &in, &out, NULL);\n\n if (name_utf8 != NULL) {\n GST_DEBUG (\"Found tag/metadata %s\", name_utf8);\n\n gst_tag_name = gst_asf_demux_get_gst_tag_from_tag_name (name_utf8);\n GST_DEBUG (\"gst_tag_name %s\", GST_STR_NULL (gst_tag_name));\n\n switch (datatype) {\n case ASF_DEMUX_DATA_TYPE_UTF16LE_STRING:{\n gchar *value_utf8;\n\n value_utf8 = g_convert (value, value_len, \"UTF-8\", \"UTF-16LE\",\n &in, &out, NULL);\n\n /* get rid of tags with empty value */\n if (value_utf8 != NULL && *value_utf8 != '\\0') {\n GST_DEBUG (\"string value %s\", value_utf8);\n\n value_utf8[out] = '\\0';\n\n if (gst_tag_name != NULL) {\n if (strcmp (gst_tag_name, GST_TAG_DATE_TIME) == 0) {\n guint year = atoi (value_utf8);\n\n if (year > 0) {\n g_value_init (&tag_value, GST_TYPE_DATE_TIME);\n g_value_take_boxed (&tag_value, gst_date_time_new_y (year));\n }\n } else if (strcmp (gst_tag_name, GST_TAG_GENRE) == 0) {\n guint id3v1_genre_id;\n const gchar *genre_str;\n\n if (sscanf (value_utf8, \"(%u)\", &id3v1_genre_id) == 1 &&\n ((genre_str = gst_tag_id3_genre_get (id3v1_genre_id)))) {\n GST_DEBUG (\"Genre: %s -> %s\", value_utf8, genre_str);\n g_free (value_utf8);\n value_utf8 = g_strdup (genre_str);\n }\n } else {\n GType tag_type;\n\n /* convert tag from string to other type if required */\n tag_type = gst_tag_get_type (gst_tag_name);\n g_value_init (&tag_value, tag_type);\n if (!gst_value_deserialize (&tag_value, value_utf8)) {\n GValue from_val = { 0, };\n\n g_value_init (&from_val, G_TYPE_STRING);\n g_value_set_string (&from_val, value_utf8);\n if (!g_value_transform (&from_val, &tag_value)) {\n GST_WARNING_OBJECT (demux,\n \"Could not transform string tag to \" \"%s tag type %s\",\n gst_tag_name, g_type_name (tag_type));\n g_value_unset (&tag_value);\n }\n g_value_unset (&from_val);\n }\n }\n } else {\n /* metadata ! */\n GST_DEBUG (\"Setting metadata\");\n g_value_init (&tag_value, G_TYPE_STRING);\n g_value_set_string (&tag_value, value_utf8);\n /* If we found a stereoscopic marker, look for StereoscopicLayout\n * metadata */\n if (content3D) {\n guint i;\n if (strncmp (\"StereoscopicLayout\", name_utf8,\n strlen (name_utf8)) == 0) {\n for (i = 0; i < G_N_ELEMENTS (stereoscopic_layout_map); i++) {\n if (g_str_equal (stereoscopic_layout_map[i].interleave_name,\n value_utf8)) {\n demux->asf_3D_mode =\n stereoscopic_layout_map[i].interleaving_type;\n GST_INFO (\"find interleave type %u\", demux->asf_3D_mode);\n }\n }\n }\n GST_INFO_OBJECT (demux, \"3d type is %u\", demux->asf_3D_mode);\n } else {\n demux->asf_3D_mode = GST_ASF_3D_NONE;\n GST_INFO_OBJECT (demux, \"None 3d type\");\n }\n }\n } else if (value_utf8 == NULL) {\n GST_WARNING (\"Failed to convert string value to UTF8, skipping\");\n } else {\n GST_DEBUG (\"Skipping empty string value for %s\",\n GST_STR_NULL (gst_tag_name));\n }\n g_free (value_utf8);\n break;\n }\n case ASF_DEMUX_DATA_TYPE_BYTE_ARRAY:{\n if (gst_tag_name) {\n if (!g_str_equal (gst_tag_name, GST_TAG_IMAGE)) {\n GST_FIXME (\"Unhandled byte array tag %s\",\n GST_STR_NULL (gst_tag_name));\n break;\n } else {\n asf_demux_parse_picture_tag (taglist, (guint8 *) value,\n value_len);\n }\n }\n break;\n }\n case ASF_DEMUX_DATA_TYPE_DWORD:{\n guint uint_val = GST_READ_UINT32_LE (value);\n\n /* this is the track number */\n g_value_init (&tag_value, G_TYPE_UINT);\n\n /* WM/Track counts from 0 */\n if (!strcmp (name_utf8, \"WM/Track\"))\n ++uint_val;\n\n g_value_set_uint (&tag_value, uint_val);\n break;\n }\n /* Detect 3D */\n case ASF_DEMUX_DATA_TYPE_BOOL:{\n gboolean bool_val = GST_READ_UINT32_LE (value);\n\n if (strncmp (\"Stereoscopic\", name_utf8, strlen (name_utf8)) == 0) {\n if (bool_val) {\n GST_INFO_OBJECT (demux, \"This is 3D contents\");\n content3D = TRUE;\n } else {\n GST_INFO_OBJECT (demux, \"This is not 3D contenst\");\n content3D = FALSE;\n }\n }\n\n break;\n }\n default:{\n GST_DEBUG (\"Skipping tag %s of type %d\", gst_tag_name, datatype);\n break;\n }\n }\n\n if (G_IS_VALUE (&tag_value)) {\n if (gst_tag_name) {\n GstTagMergeMode merge_mode = GST_TAG_MERGE_APPEND;\n\n /* WM/TrackNumber is more reliable than WM/Track, since the latter\n * is supposed to have a 0 base but is often wrongly written to start\n * from 1 as well, so prefer WM/TrackNumber when we have it: either\n * replace the value added earlier from WM/Track or put it first in\n * the list, so that it will get picked up by _get_uint() */\n if (strcmp (name_utf8, \"WM/TrackNumber\") == 0)\n merge_mode = GST_TAG_MERGE_REPLACE;\n\n gst_tag_list_add_values (taglist, merge_mode, gst_tag_name,\n &tag_value, NULL);\n } else {\n GST_DEBUG (\"Setting global metadata %s\", name_utf8);\n gst_structure_set_value (demux->global_metadata, name_utf8,\n &tag_value);\n }\n\n g_value_unset (&tag_value);\n }\n }\n\n g_free (name);\n g_free (value);\n g_free (name_utf8);\n }\n\n gst_asf_demux_add_global_tags (demux, taglist);\n\n return GST_FLOW_OK;\n\n /* Errors */\nnot_enough_data:\n {\n GST_WARNING (\"Unexpected end of data parsing ext content desc object\");\n gst_tag_list_unref (taglist);\n return GST_FLOW_OK; /* not really fatal */\n }\n}","target":"gst_asf_demux_process_ext_content_desc (GstASFDemux * demux, guint8 * data,\n guint64 size)\n{\n /* Other known (and unused) 'text/unicode' metadata available :\n *\n * WM/Lyrics =\n * WM/MediaPrimaryClassID = {D1607DBC-E323-4BE2-86A1-48A42A28441E}\n * WMFSDKVersion = 9.00.00.2980\n * WMFSDKNeeded = 0.0.0.0000\n * WM/UniqueFileIdentifier = AMGa_id=R 15334;AMGp_id=P 5149;AMGt_id=T 2324984\n * WM/Publisher = 4AD\n * WM/Provider = AMG\n * WM/ProviderRating = 8\n * WM/ProviderStyle = Rock (similar to WM/Genre)\n * WM/GenreID (similar to WM/Genre)\n * WM/TrackNumber (same as WM/Track but as a string)\n *\n * Other known (and unused) 'non-text' metadata available :\n *\n * WM/EncodingTime\n * WM/MCDI\n * IsVBR\n *\n * We might want to read WM/TrackNumber and use atoi() if we don't have\n * WM/Track\n */\n\n GstTagList *taglist;\n guint16 blockcount, i;\n gboolean content3D = FALSE;\n\n struct\n {\n const gchar *interleave_name;\n GstASF3DMode interleaving_type;\n } stereoscopic_layout_map[] = {\n {\n \"SideBySideRF\", GST_ASF_3D_SIDE_BY_SIDE_HALF_RL}, {\n \"SideBySideLF\", GST_ASF_3D_SIDE_BY_SIDE_HALF_LR}, {\n \"OverUnderRT\", GST_ASF_3D_TOP_AND_BOTTOM_HALF_RL}, {\n \"OverUnderLT\", GST_ASF_3D_TOP_AND_BOTTOM_HALF_LR}, {\n \"DualStream\", GST_ASF_3D_DUAL_STREAM}\n };\n GST_INFO_OBJECT (demux, \"object is an extended content description\");\n\n taglist = gst_tag_list_new_empty ();\n\n /* Content Descriptor Count */\n if (size < 2)\n goto not_enough_data;\n\n blockcount = gst_asf_demux_get_uint16 (&data, &size);\n\n for (i = 1; i <= blockcount; ++i) {\n const gchar *gst_tag_name;\n guint16 datatype;\n guint16 value_len;\n guint16 name_len;\n GValue tag_value = { 0, };\n gsize in, out;\n gchar *name;\n gchar *name_utf8 = NULL;\n gchar *value;\n\n /* Descriptor */\n if (!gst_asf_demux_get_string (&name, &name_len, &data, &size))\n goto not_enough_data;\n\n if (size < 2) {\n g_free (name);\n goto not_enough_data;\n }\n /* Descriptor Value Data Type */\n datatype = gst_asf_demux_get_uint16 (&data, &size);\n\n /* Descriptor Value (not really a string, but same thing reading-wise) */\n if (!gst_asf_demux_get_string (&value, &value_len, &data, &size)) {\n g_free (name);\n goto not_enough_data;\n }\n\n name_utf8 =\n g_convert (name, name_len, \"UTF-8\", \"UTF-16LE\", &in, &out, NULL);\n\n if (name_utf8 != NULL) {\n GST_DEBUG (\"Found tag/metadata %s\", name_utf8);\n\n gst_tag_name = gst_asf_demux_get_gst_tag_from_tag_name (name_utf8);\n GST_DEBUG (\"gst_tag_name %s\", GST_STR_NULL (gst_tag_name));\n\n switch (datatype) {\n case ASF_DEMUX_DATA_TYPE_UTF16LE_STRING:{\n gchar *value_utf8;\n\n value_utf8 = g_convert (value, value_len, \"UTF-8\", \"UTF-16LE\",\n &in, &out, NULL);\n\n /* get rid of tags with empty value */\n if (value_utf8 != NULL && *value_utf8 != '\\0') {\n GST_DEBUG (\"string value %s\", value_utf8);\n\n value_utf8[out] = '\\0';\n\n if (gst_tag_name != NULL) {\n if (strcmp (gst_tag_name, GST_TAG_DATE_TIME) == 0) {\n guint year = atoi (value_utf8);\n\n if (year > 0) {\n g_value_init (&tag_value, GST_TYPE_DATE_TIME);\n g_value_take_boxed (&tag_value, gst_date_time_new_y (year));\n }\n } else if (strcmp (gst_tag_name, GST_TAG_GENRE) == 0) {\n guint id3v1_genre_id;\n const gchar *genre_str;\n\n if (sscanf (value_utf8, \"(%u)\", &id3v1_genre_id) == 1 &&\n ((genre_str = gst_tag_id3_genre_get (id3v1_genre_id)))) {\n GST_DEBUG (\"Genre: %s -> %s\", value_utf8, genre_str);\n g_free (value_utf8);\n value_utf8 = g_strdup (genre_str);\n }\n } else {\n GType tag_type;\n\n /* convert tag from string to other type if required */\n tag_type = gst_tag_get_type (gst_tag_name);\n g_value_init (&tag_value, tag_type);\n if (!gst_value_deserialize (&tag_value, value_utf8)) {\n GValue from_val = { 0, };\n\n g_value_init (&from_val, G_TYPE_STRING);\n g_value_set_string (&from_val, value_utf8);\n if (!g_value_transform (&from_val, &tag_value)) {\n GST_WARNING_OBJECT (demux,\n \"Could not transform string tag to \" \"%s tag type %s\",\n gst_tag_name, g_type_name (tag_type));\n g_value_unset (&tag_value);\n }\n g_value_unset (&from_val);\n }\n }\n } else {\n /* metadata ! */\n GST_DEBUG (\"Setting metadata\");\n g_value_init (&tag_value, G_TYPE_STRING);\n g_value_set_string (&tag_value, value_utf8);\n /* If we found a stereoscopic marker, look for StereoscopicLayout\n * metadata */\n if (content3D) {\n guint i;\n if (strncmp (\"StereoscopicLayout\", name_utf8,\n strlen (name_utf8)) == 0) {\n for (i = 0; i < G_N_ELEMENTS (stereoscopic_layout_map); i++) {\n if (g_str_equal (stereoscopic_layout_map[i].interleave_name,\n value_utf8)) {\n demux->asf_3D_mode =\n stereoscopic_layout_map[i].interleaving_type;\n GST_INFO (\"find interleave type %u\", demux->asf_3D_mode);\n }\n }\n }\n GST_INFO_OBJECT (demux, \"3d type is %u\", demux->asf_3D_mode);\n } else {\n demux->asf_3D_mode = GST_ASF_3D_NONE;\n GST_INFO_OBJECT (demux, \"None 3d type\");\n }\n }\n } else if (value_utf8 == NULL) {\n GST_WARNING (\"Failed to convert string value to UTF8, skipping\");\n } else {\n GST_DEBUG (\"Skipping empty string value for %s\",\n GST_STR_NULL (gst_tag_name));\n }\n g_free (value_utf8);\n break;\n }\n case ASF_DEMUX_DATA_TYPE_BYTE_ARRAY:{\n if (gst_tag_name) {\n if (!g_str_equal (gst_tag_name, GST_TAG_IMAGE)) {\n GST_FIXME (\"Unhandled byte array tag %s\",\n GST_STR_NULL (gst_tag_name));\n break;\n } else {\n asf_demux_parse_picture_tag (taglist, (guint8 *) value,\n value_len);\n }\n }\n break;\n }\n case ASF_DEMUX_DATA_TYPE_DWORD:{\n guint uint_val;\n\n if (value_len < 4)\n break;\n\n uint_val = GST_READ_UINT32_LE (value);\n\n /* this is the track number */\n g_value_init (&tag_value, G_TYPE_UINT);\n\n /* WM/Track counts from 0 */\n if (!strcmp (name_utf8, \"WM/Track\"))\n ++uint_val;\n\n g_value_set_uint (&tag_value, uint_val);\n break;\n }\n /* Detect 3D */\n case ASF_DEMUX_DATA_TYPE_BOOL:{\n gboolean bool_val;\n\n if (value_len < 4)\n break;\n\n bool_val = GST_READ_UINT32_LE (value);\n\n if (strncmp (\"Stereoscopic\", name_utf8, strlen (name_utf8)) == 0) {\n if (bool_val) {\n GST_INFO_OBJECT (demux, \"This is 3D contents\");\n content3D = TRUE;\n } else {\n GST_INFO_OBJECT (demux, \"This is not 3D contenst\");\n content3D = FALSE;\n }\n }\n\n break;\n }\n default:{\n GST_DEBUG (\"Skipping tag %s of type %d\", gst_tag_name, datatype);\n break;\n }\n }\n\n if (G_IS_VALUE (&tag_value)) {\n if (gst_tag_name) {\n GstTagMergeMode merge_mode = GST_TAG_MERGE_APPEND;\n\n /* WM/TrackNumber is more reliable than WM/Track, since the latter\n * is supposed to have a 0 base but is often wrongly written to start\n * from 1 as well, so prefer WM/TrackNumber when we have it: either\n * replace the value added earlier from WM/Track or put it first in\n * the list, so that it will get picked up by _get_uint() */\n if (strcmp (name_utf8, \"WM/TrackNumber\") == 0)\n merge_mode = GST_TAG_MERGE_REPLACE;\n\n gst_tag_list_add_values (taglist, merge_mode, gst_tag_name,\n &tag_value, NULL);\n } else {\n GST_DEBUG (\"Setting global metadata %s\", name_utf8);\n gst_structure_set_value (demux->global_metadata, name_utf8,\n &tag_value);\n }\n\n g_value_unset (&tag_value);\n }\n }\n\n g_free (name);\n g_free (value);\n g_free (name_utf8);\n }\n\n gst_asf_demux_add_global_tags (demux, taglist);\n\n return GST_FLOW_OK;\n\n /* Errors */\nnot_enough_data:\n {\n GST_WARNING (\"Unexpected end of data parsing ext content desc object\");\n gst_tag_list_unref (taglist);\n return GST_FLOW_OK; /* not really fatal */\n }\n}","lang":"c","vul_type":"cwe-125","target_token_count":2396,"sven_meta":{"func_name":"gst_asf_demux_process_ext_content_desc","file_name":"gst/asfdemux/gstasfdemux.c","commit_link":"github.com/GStreamer/gst-plugins-ugly/commit/d21017b52a585f145e8d62781bcc1c5fefc7ee37","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#13-069d7844999c","input":"ssize_t enc_untrusted_recvmsg(int sockfd, struct msghdr *msg, int flags) {\n size_t total_buffer_size = CalculateTotalMessageSize(msg);\n\n MessageWriter input;\n input.Push(sockfd);\n input.Push(msg->msg_namelen);\n input.Push(total_buffer_size);\n input.Push(msg->msg_controllen);\n input.Push(msg->msg_flags);\n input.Push(flags);\n\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kRecvMsgHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_recvmsg\", 2,\n /*match_exact_params=*/false);\n\n ssize_t result = output.next();\n int klinux_errno = output.next();\n\n // recvmsg() returns the number of characters received. On error, -1 is\n // returned, with errno set to indicate the cause of the error.\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return result;\n }\n\n auto msg_name_extent = output.next();\n // The returned |msg_namelen| should not exceed the buffer size.\n if (msg_name_extent.size() <= msg->msg_namelen) {\n msg->msg_namelen = msg_name_extent.size();\n }\n memcpy(msg->msg_name, msg_name_extent.As(), msg->msg_namelen);\n\n // A single buffer is passed from the untrusted side, copy it into the\n // scattered buffers inside the enclave.\n auto msg_iov_extent = output.next();\n size_t total_bytes = msg_iov_extent.size();\n size_t bytes_copied = 0;\n for (int i = 0; i < msg->msg_iovlen && bytes_copied < total_bytes; ++i) {\n size_t bytes_to_copy =\n std::min(msg->msg_iov[i].iov_len, total_bytes - bytes_copied);\n memcpy(msg->msg_iov[i].iov_base, msg_iov_extent.As() + bytes_copied,\n bytes_to_copy);\n bytes_copied += bytes_to_copy;\n }\n\n auto msg_control_extent = output.next();\n // The returned |msg_controllen| should not exceed the buffer size.\n if (msg_control_extent.size() <= msg->msg_controllen) {\n msg->msg_controllen = msg_control_extent.size();\n }\n memcpy(msg->msg_control, msg_control_extent.As(), msg->msg_controllen);\n\n return result;\n}","target":"ssize_t enc_untrusted_recvmsg(int sockfd, struct msghdr *msg, int flags) {\n size_t total_buffer_size = CalculateTotalMessageSize(msg);\n\n MessageWriter input;\n input.Push(sockfd);\n input.Push(msg->msg_namelen);\n input.Push(total_buffer_size);\n input.Push(msg->msg_controllen);\n input.Push(msg->msg_flags);\n input.Push(flags);\n\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kRecvMsgHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_recvmsg\", 2,\n /*match_exact_params=*/false);\n\n ssize_t result = output.next();\n int klinux_errno = output.next();\n\n // recvmsg() returns the number of characters received. On error, -1 is\n // returned, with errno set to indicate the cause of the error.\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return result;\n }\n\n if (result > total_buffer_size) {\n ::asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_recvmsg: result exceeds requested\");\n }\n\n auto msg_name_extent = output.next();\n // The returned |msg_namelen| should not exceed the buffer size.\n if (msg_name_extent.size() <= msg->msg_namelen) {\n msg->msg_namelen = msg_name_extent.size();\n }\n memcpy(msg->msg_name, msg_name_extent.As(), msg->msg_namelen);\n\n // A single buffer is passed from the untrusted side, copy it into the\n // scattered buffers inside the enclave.\n auto msg_iov_extent = output.next();\n size_t total_bytes = msg_iov_extent.size();\n size_t bytes_copied = 0;\n for (int i = 0; i < msg->msg_iovlen && bytes_copied < total_bytes; ++i) {\n size_t bytes_to_copy =\n std::min(msg->msg_iov[i].iov_len, total_bytes - bytes_copied);\n memcpy(msg->msg_iov[i].iov_base, msg_iov_extent.As() + bytes_copied,\n bytes_to_copy);\n bytes_copied += bytes_to_copy;\n }\n\n auto msg_control_extent = output.next();\n // The returned |msg_controllen| should not exceed the buffer size.\n if (msg_control_extent.size() <= msg->msg_controllen) {\n msg->msg_controllen = msg_control_extent.size();\n }\n memcpy(msg->msg_control, msg_control_extent.As(), msg->msg_controllen);\n\n return result;\n}","lang":"cpp","vul_type":"cwe-125","target_token_count":606,"sven_meta":{"func_name":"enc_untrusted_recvmsg","file_name":"asylo/platform/host_call/trusted/host_calls.cc","commit_link":"github.com/google/asylo/commit/fa6485c5d16a7355eab047d4a44345a73bc9131e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-078#0-0f5ffa5776ca","input":" def _get_3par_host(self, hostname):\n out = self._cli_run('showhost -verbose %s' % (hostname), None)\n LOG.debug(\"OUTPUT = \\n%s\" % (pprint.pformat(out)))\n host = {'id': None, 'name': None,\n 'domain': None,\n 'descriptors': {},\n 'iSCSIPaths': [],\n 'FCPaths': []}\n\n if out:\n err = out[0]\n if err == 'no hosts listed':\n msg = {'code': 'NON_EXISTENT_HOST',\n 'desc': \"HOST '%s' was not found\" % hostname}\n raise hpexceptions.HTTPNotFound(msg)\n\n # start parsing the lines after the header line\n for line in out[1:]:\n if line == '':\n break\n tmp = line.split(',')\n paths = {}\n\n LOG.debug(\"line = %s\" % (pprint.pformat(tmp)))\n host['id'] = tmp[0]\n host['name'] = tmp[1]\n\n portPos = tmp[4]\n LOG.debug(\"portPos = %s\" % (pprint.pformat(portPos)))\n if portPos == '---':\n portPos = None\n else:\n port = portPos.split(':')\n portPos = {'node': int(port[0]), 'slot': int(port[1]),\n 'cardPort': int(port[2])}\n\n paths['portPos'] = portPos\n\n # If FC entry\n if tmp[5] == 'n/a':\n paths['wwn'] = tmp[3]\n host['FCPaths'].append(paths)\n # else iSCSI entry\n else:\n paths['name'] = tmp[3]\n paths['ipAddr'] = tmp[5]\n host['iSCSIPaths'].append(paths)\n\n # find the offset to the description stuff\n offset = 0\n for line in out:\n if line[:15] == '---------- Host':\n break\n else:\n offset += 1\n\n info = out[offset + 2]\n tmp = info.split(':')\n host['domain'] = tmp[1]\n\n info = out[offset + 4]\n tmp = info.split(':')\n host['descriptors']['location'] = tmp[1]\n\n info = out[offset + 5]\n tmp = info.split(':')\n host['descriptors']['ipAddr'] = tmp[1]\n\n info = out[offset + 6]\n tmp = info.split(':')\n host['descriptors']['os'] = tmp[1]\n\n info = out[offset + 7]\n tmp = info.split(':')\n host['descriptors']['model'] = tmp[1]\n\n info = out[offset + 8]\n tmp = info.split(':')\n host['descriptors']['contact'] = tmp[1]\n\n info = out[offset + 9]\n tmp = info.split(':')\n host['descriptors']['comment'] = tmp[1]\n\n return host","target":" def _get_3par_host(self, hostname):\n out = self._cli_run(['showhost', '-verbose', hostname])\n LOG.debug(\"OUTPUT = \\n%s\" % (pprint.pformat(out)))\n host = {'id': None, 'name': None,\n 'domain': None,\n 'descriptors': {},\n 'iSCSIPaths': [],\n 'FCPaths': []}\n\n if out:\n err = out[0]\n if err == 'no hosts listed':\n msg = {'code': 'NON_EXISTENT_HOST',\n 'desc': \"HOST '%s' was not found\" % hostname}\n raise hpexceptions.HTTPNotFound(msg)\n\n # start parsing the lines after the header line\n for line in out[1:]:\n if line == '':\n break\n tmp = line.split(',')\n paths = {}\n\n LOG.debug(\"line = %s\" % (pprint.pformat(tmp)))\n host['id'] = tmp[0]\n host['name'] = tmp[1]\n\n portPos = tmp[4]\n LOG.debug(\"portPos = %s\" % (pprint.pformat(portPos)))\n if portPos == '---':\n portPos = None\n else:\n port = portPos.split(':')\n portPos = {'node': int(port[0]), 'slot': int(port[1]),\n 'cardPort': int(port[2])}\n\n paths['portPos'] = portPos\n\n # If FC entry\n if tmp[5] == 'n/a':\n paths['wwn'] = tmp[3]\n host['FCPaths'].append(paths)\n # else iSCSI entry\n else:\n paths['name'] = tmp[3]\n paths['ipAddr'] = tmp[5]\n host['iSCSIPaths'].append(paths)\n\n # find the offset to the description stuff\n offset = 0\n for line in out:\n if line[:15] == '---------- Host':\n break\n else:\n offset += 1\n\n info = out[offset + 2]\n tmp = info.split(':')\n host['domain'] = tmp[1]\n\n info = out[offset + 4]\n tmp = info.split(':')\n host['descriptors']['location'] = tmp[1]\n\n info = out[offset + 5]\n tmp = info.split(':')\n host['descriptors']['ipAddr'] = tmp[1]\n\n info = out[offset + 6]\n tmp = info.split(':')\n host['descriptors']['os'] = tmp[1]\n\n info = out[offset + 7]\n tmp = info.split(':')\n host['descriptors']['model'] = tmp[1]\n\n info = out[offset + 8]\n tmp = info.split(':')\n host['descriptors']['contact'] = tmp[1]\n\n info = out[offset + 9]\n tmp = info.split(':')\n host['descriptors']['comment'] = tmp[1]\n\n return host","lang":"python","vul_type":"cwe-078","target_token_count":639,"sven_meta":{"func_name":"_get_3par_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-476#0-e53ee06b7cc8","input":"Status KernelAndDeviceOp::Run(\n ScopedStepContainer* step_container, const EagerKernelArgs& inputs,\n std::vector* outputs,\n CancellationManager* cancellation_manager,\n const absl::optional& remote_func_params) {\n OpKernelContext::Params params;\n params.device = device_;\n params.frame_iter = FrameAndIter(0, 0);\n params.inputs = inputs.GetTensorValues();\n params.op_kernel = kernel_.get();\n params.resource_manager = device_->resource_manager();\n params.input_alloc_attrs = &input_alloc_attrs_;\n params.output_attr_array = output_alloc_attrs_.data();\n params.function_library = flr_;\n params.slice_reader_cache = &slice_reader_cache_;\n params.rendezvous = rendezvous_;\n OpExecutionState* op_execution_state = nullptr;\n\n CancellationManager default_cancellation_manager;\n if (cancellation_manager) {\n params.cancellation_manager = cancellation_manager;\n } else if (kernel_->is_deferred()) {\n op_execution_state = new OpExecutionState;\n params.cancellation_manager = &op_execution_state->cancellation_manager;\n params.inc_num_deferred_ops_function = [op_execution_state]() {\n op_execution_state->Ref();\n };\n params.dec_num_deferred_ops_function = [op_execution_state]() {\n op_execution_state->Unref();\n };\n } else {\n params.cancellation_manager = &default_cancellation_manager;\n }\n\n params.log_memory = log_memory_;\n\n params.runner = get_runner();\n\n params.step_container =\n step_container == nullptr ? &step_container_ : step_container;\n auto step_container_cleanup = gtl::MakeCleanup([step_container, this] {\n if (step_container == nullptr) {\n this->step_container_.CleanUp();\n }\n });\n\n params.collective_executor =\n collective_executor_ ? collective_executor_->get() : nullptr;\n\n OpKernelContext context(¶ms);\n\n {\n port::ScopedFlushDenormal flush;\n port::ScopedSetRound round(FE_TONEAREST);\n // 'AnnotatedTraceMe' will trace both scheduling time on host and execution\n // time on device of the OpKernel.\n profiler::AnnotatedTraceMe activity(\n [&] { return kernel_->TraceString(context, /*verbose=*/false); },\n profiler::TraceMeLevel::kInfo);\n device_->Compute(kernel_.get(), &context);\n }\n\n // Clean up execution op_execution_state if deferred ops aren't running.\n if (op_execution_state != nullptr) {\n op_execution_state->Unref();\n }\n\n if (!context.status().ok()) return context.status();\n\n if (outputs != nullptr) {\n outputs->clear();\n for (int i = 0; i < context.num_outputs(); ++i) {\n outputs->push_back(Tensor(*context.mutable_output(i)));\n }\n }\n return Status::OK();\n}","target":"Status KernelAndDeviceOp::Run(\n ScopedStepContainer* step_container, const EagerKernelArgs& inputs,\n std::vector* outputs,\n CancellationManager* cancellation_manager,\n const absl::optional& remote_func_params) {\n OpKernelContext::Params params;\n params.device = device_;\n params.frame_iter = FrameAndIter(0, 0);\n params.inputs = inputs.GetTensorValues();\n params.op_kernel = kernel_.get();\n params.resource_manager = device_->resource_manager();\n params.input_alloc_attrs = &input_alloc_attrs_;\n params.output_attr_array = output_alloc_attrs_.data();\n params.function_library = flr_;\n params.slice_reader_cache = &slice_reader_cache_;\n params.rendezvous = rendezvous_;\n OpExecutionState* op_execution_state = nullptr;\n\n CancellationManager default_cancellation_manager;\n if (cancellation_manager) {\n params.cancellation_manager = cancellation_manager;\n } else if (kernel_->is_deferred()) {\n op_execution_state = new OpExecutionState;\n params.cancellation_manager = &op_execution_state->cancellation_manager;\n params.inc_num_deferred_ops_function = [op_execution_state]() {\n op_execution_state->Ref();\n };\n params.dec_num_deferred_ops_function = [op_execution_state]() {\n op_execution_state->Unref();\n };\n } else {\n params.cancellation_manager = &default_cancellation_manager;\n }\n\n params.log_memory = log_memory_;\n\n params.runner = get_runner();\n\n params.step_container =\n step_container == nullptr ? &step_container_ : step_container;\n auto step_container_cleanup = gtl::MakeCleanup([step_container, this] {\n if (step_container == nullptr) {\n this->step_container_.CleanUp();\n }\n });\n\n params.collective_executor =\n collective_executor_ ? collective_executor_->get() : nullptr;\n\n OpKernelContext context(¶ms);\n\n {\n port::ScopedFlushDenormal flush;\n port::ScopedSetRound round(FE_TONEAREST);\n // 'AnnotatedTraceMe' will trace both scheduling time on host and execution\n // time on device of the OpKernel.\n profiler::AnnotatedTraceMe activity(\n [&] { return kernel_->TraceString(context, /*verbose=*/false); },\n profiler::TraceMeLevel::kInfo);\n device_->Compute(kernel_.get(), &context);\n }\n\n // Clean up execution op_execution_state if deferred ops aren't running.\n if (op_execution_state != nullptr) {\n op_execution_state->Unref();\n }\n\n if (!context.status().ok()) return context.status();\n\n if (outputs != nullptr) {\n outputs->clear();\n for (int i = 0; i < context.num_outputs(); ++i) {\n const auto* output_tensor = context.mutable_output(i);\n if (output_tensor != nullptr) {\n outputs->push_back(Tensor(*output_tensor));\n } else {\n outputs->push_back(Tensor());\n }\n }\n }\n return Status::OK();\n}","lang":"cpp","vul_type":"cwe-476","target_token_count":649,"sven_meta":{"func_name":"tensorflow::KernelAndDeviceOp::Run","file_name":"tensorflow/core/common_runtime/eager/kernel_and_device.cc","commit_link":"github.com/tensorflow/tensorflow/commit/da8558533d925694483d2c136a9220d6d49d843c","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#3-31eb3926843c","input":"static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n magick[14];\n\n Image\n *image;\n\n int\n foundPropEnd = 0;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n offset;\n\n register ssize_t\n i;\n\n size_t\n image_type,\n length;\n\n ssize_t\n count;\n\n XCFDocInfo\n doc_info;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n count=ReadBlob(image,14,(unsigned char *) magick);\n if ((count != 14) ||\n (LocaleNCompare((char *) magick,\"gimp xcf\",8) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n (void) ResetMagickMemory(&doc_info,0,sizeof(XCFDocInfo));\n doc_info.exception=exception;\n doc_info.width=ReadBlobMSBLong(image);\n doc_info.height=ReadBlobMSBLong(image);\n if ((doc_info.width > 262144) || (doc_info.height > 262144))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n doc_info.image_type=ReadBlobMSBLong(image);\n /*\n Initialize image attributes.\n */\n image->columns=doc_info.width;\n image->rows=doc_info.height;\n image_type=doc_info.image_type;\n doc_info.file_size=GetBlobSize(image);\n image->compression=NoCompression;\n image->depth=8;\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n if (image_type == GIMP_RGB)\n ;\n else\n if (image_type == GIMP_GRAY)\n image->colorspace=GRAYColorspace;\n else\n if (image_type == GIMP_INDEXED)\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n (void) SetImageOpacity(image,OpaqueOpacity); \n (void) SetImageBackgroundColor(image);\n /*\n Read properties.\n */\n while ((foundPropEnd == MagickFalse) && (EOFBlob(image) == MagickFalse))\n {\n PropType prop_type = (PropType) ReadBlobMSBLong(image);\n size_t prop_size = ReadBlobMSBLong(image);\n\n switch (prop_type)\n {\n case PROP_END:\n foundPropEnd=1;\n break;\n case PROP_COLORMAP:\n {\n /* Cannot rely on prop_size here--the value is set incorrectly\n by some Gimp versions.\n */\n size_t num_colours = ReadBlobMSBLong(image);\n if (DiscardBlobBytes(image,3*num_colours) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n /*\n if (info->file_version == 0)\n {\n gint i;\n\n g_message (_(\"XCF warning: version 0 of XCF file format\\n\"\n \"did not save indexed colormaps correctly.\\n\"\n \"Substituting grayscale map.\"));\n info->cp +=\n xcf_read_int32 (info->fp, (guint32*) &gimage->num_cols, 1);\n gimage->cmap = g_new (guchar, gimage->num_cols*3);\n xcf_seek_pos (info, info->cp + gimage->num_cols);\n for (i = 0; inum_cols; i++)\n {\n gimage->cmap[i*3+0] = i;\n gimage->cmap[i*3+1] = i;\n gimage->cmap[i*3+2] = i;\n }\n }\n else\n {\n info->cp +=\n xcf_read_int32 (info->fp, (guint32*) &gimage->num_cols, 1);\n gimage->cmap = g_new (guchar, gimage->num_cols*3);\n info->cp +=\n xcf_read_int8 (info->fp,\n (guint8*) gimage->cmap, gimage->num_cols*3);\n }\n */\n break;\n }\n case PROP_COMPRESSION:\n {\n doc_info.compression = ReadBlobByte(image);\n if ((doc_info.compression != COMPRESS_NONE) &&\n (doc_info.compression != COMPRESS_RLE) &&\n (doc_info.compression != COMPRESS_ZLIB) &&\n (doc_info.compression != COMPRESS_FRACTAL))\n ThrowReaderException(CorruptImageError,\"UnrecognizedImageCompression\");\n }\n break;\n\n case PROP_GUIDES:\n {\n /* just skip it - we don't care about guides */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n }\n break;\n\n case PROP_RESOLUTION:\n {\n /* float xres = (float) */ (void) ReadBlobMSBLong(image);\n /* float yres = (float) */ (void) ReadBlobMSBLong(image);\n\n /*\n if (xres < GIMP_MIN_RESOLUTION || xres > GIMP_MAX_RESOLUTION ||\n yres < GIMP_MIN_RESOLUTION || yres > GIMP_MAX_RESOLUTION)\n {\n g_message (\"Warning, resolution out of range in XCF file\");\n xres = gimage->gimp->config->default_xresolution;\n yres = gimage->gimp->config->default_yresolution;\n }\n */\n\n\n /* BOGUS: we don't write these yet because we aren't\n reading them properly yet :(\n image->x_resolution = xres;\n image->y_resolution = yres;\n */\n }\n break;\n\n case PROP_TATTOO:\n {\n /* we need to read it, even if we ignore it */\n /*size_t tattoo_state = */ (void) ReadBlobMSBLong(image);\n }\n break;\n\n case PROP_PARASITES:\n {\n /* BOGUS: we may need these for IPTC stuff */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n /*\n gssize_t base = info->cp;\n GimpParasite *p;\n\n while (info->cp - base < prop_size)\n {\n p = xcf_load_parasite (info);\n gimp_image_parasite_attach (gimage, p);\n gimp_parasite_free (p);\n }\n if (info->cp - base != prop_size)\n g_message (\"Error detected while loading an image's parasites\");\n */\n }\n break;\n\n case PROP_UNIT:\n {\n /* BOGUS: ignore for now... */\n /*size_t unit = */ (void) ReadBlobMSBLong(image);\n }\n break;\n\n case PROP_PATHS:\n {\n /* BOGUS: just skip it for now */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n\n /*\n PathList *paths = xcf_load_bzpaths (gimage, info);\n gimp_image_set_paths (gimage, paths);\n */\n }\n break;\n\n case PROP_USER_UNIT:\n {\n char unit_string[1000];\n /*BOGUS: ignored for now */\n /*float factor = (float) */ (void) ReadBlobMSBLong(image);\n /* size_t digits = */ (void) ReadBlobMSBLong(image);\n for (i=0; i<5; i++)\n (void) ReadBlobStringWithLongSize(image, unit_string,\n sizeof(unit_string));\n }\n break;\n\n default:\n {\n int buf[16];\n ssize_t amount;\n\n /* read over it... */\n while ((prop_size > 0) && (EOFBlob(image) == MagickFalse))\n {\n amount=(ssize_t) MagickMin(16, prop_size);\n amount=(ssize_t) ReadBlob(image,(size_t) amount,(unsigned char *) &buf);\n if (!amount)\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n prop_size -= (size_t) MagickMin(16,(size_t) amount);\n }\n }\n break;\n }\n }\n if (foundPropEnd == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n {\n ; /* do nothing, were just pinging! */\n }\n else\n {\n int\n current_layer = 0,\n foundAllLayers = MagickFalse,\n number_layers = 0;\n\n MagickOffsetType\n oldPos=TellBlob(image);\n\n XCFLayerInfo\n *layer_info;\n\n /*\n The read pointer.\n */\n do\n {\n ssize_t offset = ReadBlobMSBSignedLong(image);\n if (offset == 0)\n foundAllLayers=MagickTrue;\n else\n number_layers++;\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n break;\n }\n } while (foundAllLayers == MagickFalse);\n doc_info.number_layers=number_layers;\n offset=SeekBlob(image,oldPos,SEEK_SET); /* restore the position! */\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n /* allocate our array of layer info blocks */\n length=(size_t) number_layers;\n layer_info=(XCFLayerInfo *) AcquireQuantumMemory(length,\n sizeof(*layer_info));\n if (layer_info == (XCFLayerInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(layer_info,0,number_layers*sizeof(XCFLayerInfo));\n for ( ; ; )\n {\n MagickBooleanType\n layer_ok;\n\n MagickOffsetType\n offset,\n saved_pos;\n\n /* read in the offset of the next layer */\n offset=(MagickOffsetType) ReadBlobMSBLong(image);\n /* if the offset is 0 then we are at the end\n * of the layer list.\n */\n if (offset == 0)\n break;\n /* save the current position as it is where the\n * next layer offset is stored.\n */\n saved_pos=TellBlob(image);\n /* seek to the layer offset */\n if (SeekBlob(image,offset,SEEK_SET) != offset)\n ThrowReaderException(ResourceLimitError,\"NotEnoughPixelData\");\n /* read in the layer */\n layer_ok=ReadOneLayer(image_info,image,&doc_info,\n &layer_info[current_layer],current_layer);\n if (layer_ok == MagickFalse)\n {\n int j;\n\n for (j=0; j < current_layer; j++)\n layer_info[j].image=DestroyImage(layer_info[j].image);\n layer_info=(XCFLayerInfo *) RelinquishMagickMemory(layer_info);\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n /* restore the saved position so we'll be ready to\n * read the next offset.\n */\n offset=SeekBlob(image, saved_pos, SEEK_SET);\n current_layer++;\n }\n#if 0\n {\n /* NOTE: XCF layers are REVERSED from composite order! */\n signed int j;\n for (j=number_layers-1; j>=0; j--) {\n /* BOGUS: need to consider layer blending modes!! */\n\n if ( layer_info[j].visible ) { /* only visible ones, please! */\n CompositeImage(image, OverCompositeOp, layer_info[j].image,\n layer_info[j].offset_x, layer_info[j].offset_y );\n layer_info[j].image =DestroyImage( layer_info[j].image );\n\n /* If we do this, we'll get REAL gray images! */\n if ( image_type == GIMP_GRAY ) {\n QuantizeInfo qi;\n GetQuantizeInfo(&qi);\n qi.colorspace = GRAYColorspace;\n QuantizeImage( &qi, layer_info[j].image );\n }\n }\n }\n }\n#else\n {\n /* NOTE: XCF layers are REVERSED from composite order! */\n ssize_t j;\n\n /* now reverse the order of the layers as they are put\n into subimages\n */\n for (j=(long) number_layers-1; j >= 0; j--)\n AppendImageToList(&image,layer_info[j].image);\n }\n#endif\n\n layer_info=(XCFLayerInfo *) RelinquishMagickMemory(layer_info);\n\n#if 0 /* BOGUS: do we need the channels?? */\n while (MagickTrue)\n {\n /* read in the offset of the next channel */\n info->cp += xcf_read_int32 (info->fp, &offset, 1);\n\n /* if the offset is 0 then we are at the end\n * of the channel list.\n */\n if (offset == 0)\n break;\n\n /* save the current position as it is where the\n * next channel offset is stored.\n */\n saved_pos = info->cp;\n\n /* seek to the channel offset */\n xcf_seek_pos (info, offset);\n\n /* read in the layer */\n channel = xcf_load_channel (info, gimage);\n if (channel == 0)\n goto error;\n\n num_successful_elements++;\n\n /* add the channel to the image if its not the selection */\n if (channel != gimage->selection_mask)\n gimp_image_add_channel (gimage, channel, -1);\n\n /* restore the saved position so we'll be ready to\n * read the next offset.\n */\n xcf_seek_pos (info, saved_pos);\n }\n#endif\n }\n\n (void) CloseBlob(image);\n DestroyImage(RemoveFirstImageFromList(&image));\n if (image_type == GIMP_GRAY)\n image->type=GrayscaleType;\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n magick[14];\n\n Image\n *image;\n\n int\n foundPropEnd = 0;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n offset;\n\n register ssize_t\n i;\n\n size_t\n image_type,\n length;\n\n ssize_t\n count;\n\n XCFDocInfo\n doc_info;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n count=ReadBlob(image,14,(unsigned char *) magick);\n if ((count != 14) ||\n (LocaleNCompare((char *) magick,\"gimp xcf\",8) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n (void) ResetMagickMemory(&doc_info,0,sizeof(XCFDocInfo));\n doc_info.exception=exception;\n doc_info.width=ReadBlobMSBLong(image);\n doc_info.height=ReadBlobMSBLong(image);\n if ((doc_info.width > 262144) || (doc_info.height > 262144))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n doc_info.image_type=ReadBlobMSBLong(image);\n /*\n Initialize image attributes.\n */\n image->columns=doc_info.width;\n image->rows=doc_info.height;\n image_type=doc_info.image_type;\n doc_info.file_size=GetBlobSize(image);\n image->compression=NoCompression;\n image->depth=8;\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n if (image_type == GIMP_RGB)\n ;\n else\n if (image_type == GIMP_GRAY)\n image->colorspace=GRAYColorspace;\n else\n if (image_type == GIMP_INDEXED)\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n (void) SetImageOpacity(image,OpaqueOpacity); \n (void) SetImageBackgroundColor(image);\n /*\n Read properties.\n */\n while ((foundPropEnd == MagickFalse) && (EOFBlob(image) == MagickFalse))\n {\n PropType prop_type = (PropType) ReadBlobMSBLong(image);\n size_t prop_size = ReadBlobMSBLong(image);\n\n switch (prop_type)\n {\n case PROP_END:\n foundPropEnd=1;\n break;\n case PROP_COLORMAP:\n {\n /* Cannot rely on prop_size here--the value is set incorrectly\n by some Gimp versions.\n */\n size_t num_colours = ReadBlobMSBLong(image);\n if (DiscardBlobBytes(image,3*num_colours) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n /*\n if (info->file_version == 0)\n {\n gint i;\n\n g_message (_(\"XCF warning: version 0 of XCF file format\\n\"\n \"did not save indexed colormaps correctly.\\n\"\n \"Substituting grayscale map.\"));\n info->cp +=\n xcf_read_int32 (info->fp, (guint32*) &gimage->num_cols, 1);\n gimage->cmap = g_new (guchar, gimage->num_cols*3);\n xcf_seek_pos (info, info->cp + gimage->num_cols);\n for (i = 0; inum_cols; i++)\n {\n gimage->cmap[i*3+0] = i;\n gimage->cmap[i*3+1] = i;\n gimage->cmap[i*3+2] = i;\n }\n }\n else\n {\n info->cp +=\n xcf_read_int32 (info->fp, (guint32*) &gimage->num_cols, 1);\n gimage->cmap = g_new (guchar, gimage->num_cols*3);\n info->cp +=\n xcf_read_int8 (info->fp,\n (guint8*) gimage->cmap, gimage->num_cols*3);\n }\n */\n break;\n }\n case PROP_COMPRESSION:\n {\n doc_info.compression = ReadBlobByte(image);\n if ((doc_info.compression != COMPRESS_NONE) &&\n (doc_info.compression != COMPRESS_RLE) &&\n (doc_info.compression != COMPRESS_ZLIB) &&\n (doc_info.compression != COMPRESS_FRACTAL))\n ThrowReaderException(CorruptImageError,\"UnrecognizedImageCompression\");\n }\n break;\n\n case PROP_GUIDES:\n {\n /* just skip it - we don't care about guides */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n }\n break;\n\n case PROP_RESOLUTION:\n {\n /* float xres = (float) */ (void) ReadBlobMSBLong(image);\n /* float yres = (float) */ (void) ReadBlobMSBLong(image);\n\n /*\n if (xres < GIMP_MIN_RESOLUTION || xres > GIMP_MAX_RESOLUTION ||\n yres < GIMP_MIN_RESOLUTION || yres > GIMP_MAX_RESOLUTION)\n {\n g_message (\"Warning, resolution out of range in XCF file\");\n xres = gimage->gimp->config->default_xresolution;\n yres = gimage->gimp->config->default_yresolution;\n }\n */\n\n\n /* BOGUS: we don't write these yet because we aren't\n reading them properly yet :(\n image->x_resolution = xres;\n image->y_resolution = yres;\n */\n }\n break;\n\n case PROP_TATTOO:\n {\n /* we need to read it, even if we ignore it */\n /*size_t tattoo_state = */ (void) ReadBlobMSBLong(image);\n }\n break;\n\n case PROP_PARASITES:\n {\n /* BOGUS: we may need these for IPTC stuff */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n /*\n gssize_t base = info->cp;\n GimpParasite *p;\n\n while (info->cp - base < prop_size)\n {\n p = xcf_load_parasite (info);\n gimp_image_parasite_attach (gimage, p);\n gimp_parasite_free (p);\n }\n if (info->cp - base != prop_size)\n g_message (\"Error detected while loading an image's parasites\");\n */\n }\n break;\n\n case PROP_UNIT:\n {\n /* BOGUS: ignore for now... */\n /*size_t unit = */ (void) ReadBlobMSBLong(image);\n }\n break;\n\n case PROP_PATHS:\n {\n /* BOGUS: just skip it for now */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n\n /*\n PathList *paths = xcf_load_bzpaths (gimage, info);\n gimp_image_set_paths (gimage, paths);\n */\n }\n break;\n\n case PROP_USER_UNIT:\n {\n char unit_string[1000];\n /*BOGUS: ignored for now */\n /*float factor = (float) */ (void) ReadBlobMSBLong(image);\n /* size_t digits = */ (void) ReadBlobMSBLong(image);\n for (i=0; i<5; i++)\n (void) ReadBlobStringWithLongSize(image, unit_string,\n sizeof(unit_string));\n }\n break;\n\n default:\n {\n int buf[16];\n ssize_t amount;\n\n /* read over it... */\n while ((prop_size > 0) && (EOFBlob(image) == MagickFalse))\n {\n amount=(ssize_t) MagickMin(16, prop_size);\n amount=(ssize_t) ReadBlob(image,(size_t) amount,(unsigned char *) &buf);\n if (!amount)\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n prop_size -= (size_t) MagickMin(16,(size_t) amount);\n }\n }\n break;\n }\n }\n if (foundPropEnd == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n {\n ; /* do nothing, were just pinging! */\n }\n else\n {\n int\n current_layer = 0,\n foundAllLayers = MagickFalse,\n number_layers = 0;\n\n MagickOffsetType\n oldPos=TellBlob(image);\n\n XCFLayerInfo\n *layer_info;\n\n /*\n The read pointer.\n */\n do\n {\n ssize_t offset = ReadBlobMSBSignedLong(image);\n if (offset == 0)\n foundAllLayers=MagickTrue;\n else\n number_layers++;\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n break;\n }\n } while (foundAllLayers == MagickFalse);\n doc_info.number_layers=number_layers;\n offset=SeekBlob(image,oldPos,SEEK_SET); /* restore the position! */\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n /* allocate our array of layer info blocks */\n length=(size_t) number_layers;\n layer_info=(XCFLayerInfo *) AcquireQuantumMemory(length,\n sizeof(*layer_info));\n if (layer_info == (XCFLayerInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(layer_info,0,number_layers*sizeof(XCFLayerInfo));\n for ( ; ; )\n {\n MagickBooleanType\n layer_ok;\n\n MagickOffsetType\n offset,\n saved_pos;\n\n /* read in the offset of the next layer */\n offset=(MagickOffsetType) ReadBlobMSBLong(image);\n /* if the offset is 0 then we are at the end\n * of the layer list.\n */\n if (offset == 0)\n break;\n /* save the current position as it is where the\n * next layer offset is stored.\n */\n saved_pos=TellBlob(image);\n /* seek to the layer offset */\n if (SeekBlob(image,offset,SEEK_SET) != offset)\n ThrowReaderException(ResourceLimitError,\"NotEnoughPixelData\");\n /* read in the layer */\n layer_ok=ReadOneLayer(image_info,image,&doc_info,\n &layer_info[current_layer],current_layer);\n if (layer_ok == MagickFalse)\n {\n int j;\n\n for (j=0; j < current_layer; j++)\n layer_info[j].image=DestroyImage(layer_info[j].image);\n layer_info=(XCFLayerInfo *) RelinquishMagickMemory(layer_info);\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n /* restore the saved position so we'll be ready to\n * read the next offset.\n */\n offset=SeekBlob(image, saved_pos, SEEK_SET);\n current_layer++;\n }\n#if 0\n {\n /* NOTE: XCF layers are REVERSED from composite order! */\n signed int j;\n for (j=number_layers-1; j>=0; j--) {\n /* BOGUS: need to consider layer blending modes!! */\n\n if ( layer_info[j].visible ) { /* only visible ones, please! */\n CompositeImage(image, OverCompositeOp, layer_info[j].image,\n layer_info[j].offset_x, layer_info[j].offset_y );\n layer_info[j].image =DestroyImage( layer_info[j].image );\n\n /* If we do this, we'll get REAL gray images! */\n if ( image_type == GIMP_GRAY ) {\n QuantizeInfo qi;\n GetQuantizeInfo(&qi);\n qi.colorspace = GRAYColorspace;\n QuantizeImage( &qi, layer_info[j].image );\n }\n }\n }\n }\n#else\n {\n /* NOTE: XCF layers are REVERSED from composite order! */\n ssize_t j;\n\n /* now reverse the order of the layers as they are put\n into subimages\n */\n for (j=(long) number_layers-1; j >= 0; j--)\n AppendImageToList(&image,layer_info[j].image);\n }\n#endif\n\n layer_info=(XCFLayerInfo *) RelinquishMagickMemory(layer_info);\n\n#if 0 /* BOGUS: do we need the channels?? */\n while (MagickTrue)\n {\n /* read in the offset of the next channel */\n info->cp += xcf_read_int32 (info->fp, &offset, 1);\n\n /* if the offset is 0 then we are at the end\n * of the channel list.\n */\n if (offset == 0)\n break;\n\n /* save the current position as it is where the\n * next channel offset is stored.\n */\n saved_pos = info->cp;\n\n /* seek to the channel offset */\n xcf_seek_pos (info, offset);\n\n /* read in the layer */\n channel = xcf_load_channel (info, gimage);\n if (channel == 0)\n goto error;\n\n num_successful_elements++;\n\n /* add the channel to the image if its not the selection */\n if (channel != gimage->selection_mask)\n gimp_image_add_channel (gimage, channel, -1);\n\n /* restore the saved position so we'll be ready to\n * read the next offset.\n */\n xcf_seek_pos (info, saved_pos);\n }\n#endif\n }\n\n (void) CloseBlob(image);\n if (GetNextImageInList(image) != (Image *) NULL)\n DestroyImage(RemoveFirstImageFromList(&image));\n if (image_type == GIMP_GRAY)\n image->type=GrayscaleType;\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-476","target_token_count":3305,"sven_meta":{"func_name":"ReadXCFImage","file_name":"coders/xcf.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/d31fec57e9dfb0516deead2053a856e3c71e9751","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#6-c074193b792b","input":"static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)\n{\n\tstruct tun_struct *tun;\n\tstruct tun_file *tfile = file->private_data;\n\tstruct net_device *dev;\n\tint err;\n\n\tif (tfile->detached)\n\t\treturn -EINVAL;\n\n\tdev = __dev_get_by_name(net, ifr->ifr_name);\n\tif (dev) {\n\t\tif (ifr->ifr_flags & IFF_TUN_EXCL)\n\t\t\treturn -EBUSY;\n\t\tif ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops)\n\t\t\ttun = netdev_priv(dev);\n\t\telse if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops)\n\t\t\ttun = netdev_priv(dev);\n\t\telse\n\t\t\treturn -EINVAL;\n\n\t\tif (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) !=\n\t\t !!(tun->flags & IFF_MULTI_QUEUE))\n\t\t\treturn -EINVAL;\n\n\t\tif (tun_not_capable(tun))\n\t\t\treturn -EPERM;\n\t\terr = security_tun_dev_open(tun->security);\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\terr = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER);\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\tif (tun->flags & IFF_MULTI_QUEUE &&\n\t\t (tun->numqueues + tun->numdisabled > 1)) {\n\t\t\t/* One or more queue has already been attached, no need\n\t\t\t * to initialize the device again.\n\t\t\t */\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse {\n\t\tchar *name;\n\t\tunsigned long flags = 0;\n\t\tint queues = ifr->ifr_flags & IFF_MULTI_QUEUE ?\n\t\t\t MAX_TAP_QUEUES : 1;\n\n\t\tif (!ns_capable(net->user_ns, CAP_NET_ADMIN))\n\t\t\treturn -EPERM;\n\t\terr = security_tun_dev_create();\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\t/* Set dev type */\n\t\tif (ifr->ifr_flags & IFF_TUN) {\n\t\t\t/* TUN device */\n\t\t\tflags |= IFF_TUN;\n\t\t\tname = \"tun%d\";\n\t\t} else if (ifr->ifr_flags & IFF_TAP) {\n\t\t\t/* TAP device */\n\t\t\tflags |= IFF_TAP;\n\t\t\tname = \"tap%d\";\n\t\t} else\n\t\t\treturn -EINVAL;\n\n\t\tif (*ifr->ifr_name)\n\t\t\tname = ifr->ifr_name;\n\n\t\tdev = alloc_netdev_mqs(sizeof(struct tun_struct), name,\n\t\t\t\t NET_NAME_UNKNOWN, tun_setup, queues,\n\t\t\t\t queues);\n\n\t\tif (!dev)\n\t\t\treturn -ENOMEM;\n\t\terr = dev_get_valid_name(net, dev, name);\n\t\tif (err)\n\t\t\tgoto err_free_dev;\n\n\t\tdev_net_set(dev, net);\n\t\tdev->rtnl_link_ops = &tun_link_ops;\n\t\tdev->ifindex = tfile->ifindex;\n\t\tdev->sysfs_groups[0] = &tun_attr_group;\n\n\t\ttun = netdev_priv(dev);\n\t\ttun->dev = dev;\n\t\ttun->flags = flags;\n\t\ttun->txflt.count = 0;\n\t\ttun->vnet_hdr_sz = sizeof(struct virtio_net_hdr);\n\n\t\ttun->align = NET_SKB_PAD;\n\t\ttun->filter_attached = false;\n\t\ttun->sndbuf = tfile->socket.sk->sk_sndbuf;\n\t\ttun->rx_batched = 0;\n\n\t\ttun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats);\n\t\tif (!tun->pcpu_stats) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto err_free_dev;\n\t\t}\n\n\t\tspin_lock_init(&tun->lock);\n\n\t\terr = security_tun_dev_alloc_security(&tun->security);\n\t\tif (err < 0)\n\t\t\tgoto err_free_stat;\n\n\t\ttun_net_init(dev);\n\t\ttun_flow_init(tun);\n\n\t\tdev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |\n\t\t\t\t TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |\n\t\t\t\t NETIF_F_HW_VLAN_STAG_TX;\n\t\tdev->features = dev->hw_features | NETIF_F_LLTX;\n\t\tdev->vlan_features = dev->features &\n\t\t\t\t ~(NETIF_F_HW_VLAN_CTAG_TX |\n\t\t\t\t NETIF_F_HW_VLAN_STAG_TX);\n\n\t\tINIT_LIST_HEAD(&tun->disabled);\n\t\terr = tun_attach(tun, file, false);\n\t\tif (err < 0)\n\t\t\tgoto err_free_flow;\n\n\t\terr = register_netdevice(tun->dev);\n\t\tif (err < 0)\n\t\t\tgoto err_detach;\n\t}\n\n\tnetif_carrier_on(tun->dev);\n\n\ttun_debug(KERN_INFO, tun, \"tun_set_iff\\n\");\n\n\ttun->flags = (tun->flags & ~TUN_FEATURES) |\n\t\t(ifr->ifr_flags & TUN_FEATURES);\n\n\t/* Make sure persistent devices do not get stuck in\n\t * xoff state.\n\t */\n\tif (netif_running(tun->dev))\n\t\tnetif_tx_wake_all_queues(tun->dev);\n\n\tstrcpy(ifr->ifr_name, tun->dev->name);\n\treturn 0;\n\nerr_detach:\n\ttun_detach_all(dev);\n\t/* register_netdevice() already called tun_free_netdev() */\n\tgoto err_free_dev;\n\nerr_free_flow:\n\ttun_flow_uninit(tun);\n\tsecurity_tun_dev_free_security(tun->security);\nerr_free_stat:\n\tfree_percpu(tun->pcpu_stats);\nerr_free_dev:\n\tfree_netdev(dev);\n\treturn err;\n}","target":"static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)\n{\n\tstruct tun_struct *tun;\n\tstruct tun_file *tfile = file->private_data;\n\tstruct net_device *dev;\n\tint err;\n\n\tif (tfile->detached)\n\t\treturn -EINVAL;\n\n\tdev = __dev_get_by_name(net, ifr->ifr_name);\n\tif (dev) {\n\t\tif (ifr->ifr_flags & IFF_TUN_EXCL)\n\t\t\treturn -EBUSY;\n\t\tif ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops)\n\t\t\ttun = netdev_priv(dev);\n\t\telse if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops)\n\t\t\ttun = netdev_priv(dev);\n\t\telse\n\t\t\treturn -EINVAL;\n\n\t\tif (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) !=\n\t\t !!(tun->flags & IFF_MULTI_QUEUE))\n\t\t\treturn -EINVAL;\n\n\t\tif (tun_not_capable(tun))\n\t\t\treturn -EPERM;\n\t\terr = security_tun_dev_open(tun->security);\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\terr = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER);\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\tif (tun->flags & IFF_MULTI_QUEUE &&\n\t\t (tun->numqueues + tun->numdisabled > 1)) {\n\t\t\t/* One or more queue has already been attached, no need\n\t\t\t * to initialize the device again.\n\t\t\t */\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse {\n\t\tchar *name;\n\t\tunsigned long flags = 0;\n\t\tint queues = ifr->ifr_flags & IFF_MULTI_QUEUE ?\n\t\t\t MAX_TAP_QUEUES : 1;\n\n\t\tif (!ns_capable(net->user_ns, CAP_NET_ADMIN))\n\t\t\treturn -EPERM;\n\t\terr = security_tun_dev_create();\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\t/* Set dev type */\n\t\tif (ifr->ifr_flags & IFF_TUN) {\n\t\t\t/* TUN device */\n\t\t\tflags |= IFF_TUN;\n\t\t\tname = \"tun%d\";\n\t\t} else if (ifr->ifr_flags & IFF_TAP) {\n\t\t\t/* TAP device */\n\t\t\tflags |= IFF_TAP;\n\t\t\tname = \"tap%d\";\n\t\t} else\n\t\t\treturn -EINVAL;\n\n\t\tif (*ifr->ifr_name)\n\t\t\tname = ifr->ifr_name;\n\n\t\tdev = alloc_netdev_mqs(sizeof(struct tun_struct), name,\n\t\t\t\t NET_NAME_UNKNOWN, tun_setup, queues,\n\t\t\t\t queues);\n\n\t\tif (!dev)\n\t\t\treturn -ENOMEM;\n\t\terr = dev_get_valid_name(net, dev, name);\n\t\tif (err < 0)\n\t\t\tgoto err_free_dev;\n\n\t\tdev_net_set(dev, net);\n\t\tdev->rtnl_link_ops = &tun_link_ops;\n\t\tdev->ifindex = tfile->ifindex;\n\t\tdev->sysfs_groups[0] = &tun_attr_group;\n\n\t\ttun = netdev_priv(dev);\n\t\ttun->dev = dev;\n\t\ttun->flags = flags;\n\t\ttun->txflt.count = 0;\n\t\ttun->vnet_hdr_sz = sizeof(struct virtio_net_hdr);\n\n\t\ttun->align = NET_SKB_PAD;\n\t\ttun->filter_attached = false;\n\t\ttun->sndbuf = tfile->socket.sk->sk_sndbuf;\n\t\ttun->rx_batched = 0;\n\n\t\ttun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats);\n\t\tif (!tun->pcpu_stats) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto err_free_dev;\n\t\t}\n\n\t\tspin_lock_init(&tun->lock);\n\n\t\terr = security_tun_dev_alloc_security(&tun->security);\n\t\tif (err < 0)\n\t\t\tgoto err_free_stat;\n\n\t\ttun_net_init(dev);\n\t\ttun_flow_init(tun);\n\n\t\tdev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |\n\t\t\t\t TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |\n\t\t\t\t NETIF_F_HW_VLAN_STAG_TX;\n\t\tdev->features = dev->hw_features | NETIF_F_LLTX;\n\t\tdev->vlan_features = dev->features &\n\t\t\t\t ~(NETIF_F_HW_VLAN_CTAG_TX |\n\t\t\t\t NETIF_F_HW_VLAN_STAG_TX);\n\n\t\tINIT_LIST_HEAD(&tun->disabled);\n\t\terr = tun_attach(tun, file, false);\n\t\tif (err < 0)\n\t\t\tgoto err_free_flow;\n\n\t\terr = register_netdevice(tun->dev);\n\t\tif (err < 0)\n\t\t\tgoto err_detach;\n\t}\n\n\tnetif_carrier_on(tun->dev);\n\n\ttun_debug(KERN_INFO, tun, \"tun_set_iff\\n\");\n\n\ttun->flags = (tun->flags & ~TUN_FEATURES) |\n\t\t(ifr->ifr_flags & TUN_FEATURES);\n\n\t/* Make sure persistent devices do not get stuck in\n\t * xoff state.\n\t */\n\tif (netif_running(tun->dev))\n\t\tnetif_tx_wake_all_queues(tun->dev);\n\n\tstrcpy(ifr->ifr_name, tun->dev->name);\n\treturn 0;\n\nerr_detach:\n\ttun_detach_all(dev);\n\t/* register_netdevice() already called tun_free_netdev() */\n\tgoto err_free_dev;\n\nerr_free_flow:\n\ttun_flow_uninit(tun);\n\tsecurity_tun_dev_free_security(tun->security);\nerr_free_stat:\n\tfree_percpu(tun->pcpu_stats);\nerr_free_dev:\n\tfree_netdev(dev);\n\treturn err;\n}","lang":"c","vul_type":"cwe-476","target_token_count":1213,"sven_meta":{"func_name":"tun_set_iff","file_name":"drivers/net/tun.c","commit_link":"github.com/torvalds/linux/commit/5c25f65fd1e42685f7ccd80e0621829c105785d9","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#7-1feb5aa9b804","input":"MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info,\n Image *images,const char *filename,ExceptionInfo *exception)\n{\n#define WriteImageTag \"Write/Image\"\n\n ExceptionInfo\n *sans_exception;\n\n ImageInfo\n *write_info;\n\n MagickBooleanType\n proceed;\n\n MagickOffsetType\n progress;\n\n MagickProgressMonitor\n progress_monitor;\n\n MagickSizeType\n number_images;\n\n MagickStatusType\n status;\n\n register Image\n *p;\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n write_info=CloneImageInfo(image_info);\n *write_info->magick='\\0';\n images=GetFirstImageInList(images);\n if (filename != (const char *) NULL)\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n (void) CopyMagickString(p->filename,filename,MagickPathExtent);\n (void) CopyMagickString(write_info->filename,images->filename,MagickPathExtent);\n sans_exception=AcquireExceptionInfo();\n (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),\n sans_exception);\n sans_exception=DestroyExceptionInfo(sans_exception);\n if (*write_info->magick == '\\0')\n (void) CopyMagickString(write_info->magick,images->magick,MagickPathExtent);\n p=images;\n for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))\n if (p->scene >= GetNextImageInList(p)->scene)\n {\n register ssize_t\n i;\n\n /*\n Generate consistent scene numbers.\n */\n i=(ssize_t) images->scene;\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n p->scene=(size_t) i++;\n break;\n }\n /*\n Write images.\n */\n status=MagickTrue;\n progress_monitor=(MagickProgressMonitor) NULL;\n progress=0;\n number_images=GetImageListLength(images);\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n {\n if (number_images != 1)\n progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,\n p->client_data);\n status&=WriteImage(write_info,p,exception);\n if (number_images != 1)\n (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);\n if (write_info->adjoin != MagickFalse)\n break;\n if (number_images != 1)\n {\n proceed=SetImageProgress(p,WriteImageTag,progress++,number_images);\n if (proceed == MagickFalse)\n break;\n }\n }\n write_info=DestroyImageInfo(write_info);\n return(status != 0 ? MagickTrue : MagickFalse);\n}","target":"MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info,\n Image *images,const char *filename,ExceptionInfo *exception)\n{\n#define WriteImageTag \"Write/Image\"\n\n ExceptionInfo\n *sans_exception;\n\n ImageInfo\n *write_info;\n\n MagickBooleanType\n proceed;\n\n MagickOffsetType\n progress;\n\n MagickProgressMonitor\n progress_monitor;\n\n MagickSizeType\n number_images;\n\n MagickStatusType\n status;\n\n register Image\n *p;\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n write_info=CloneImageInfo(image_info);\n *write_info->magick='\\0';\n images=GetFirstImageInList(images);\n if (filename != (const char *) NULL)\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n (void) CopyMagickString(p->filename,filename,MagickPathExtent);\n (void) CopyMagickString(write_info->filename,images->filename,MagickPathExtent);\n sans_exception=AcquireExceptionInfo();\n (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),\n sans_exception);\n sans_exception=DestroyExceptionInfo(sans_exception);\n if (*write_info->magick == '\\0')\n (void) CopyMagickString(write_info->magick,images->magick,MagickPathExtent);\n p=images;\n for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))\n {\n register Image\n *next;\n \n next=GetNextImageInList(p);\n if (next == (Image *) NULL)\n break;\n if (p->scene >= next->scene)\n {\n register ssize_t\n i;\n\n /*\n Generate consistent scene numbers.\n */\n i=(ssize_t) images->scene;\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n p->scene=(size_t) i++;\n break;\n }\n }\n /*\n Write images.\n */\n status=MagickTrue;\n progress_monitor=(MagickProgressMonitor) NULL;\n progress=0;\n number_images=GetImageListLength(images);\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n {\n if (number_images != 1)\n progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,\n p->client_data);\n status&=WriteImage(write_info,p,exception);\n if (number_images != 1)\n (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);\n if (write_info->adjoin != MagickFalse)\n break;\n if (number_images != 1)\n {\n proceed=SetImageProgress(p,WriteImageTag,progress++,number_images);\n if (proceed == MagickFalse)\n break;\n }\n }\n write_info=DestroyImageInfo(write_info);\n return(status != 0 ? MagickTrue : MagickFalse);\n}","lang":"c","vul_type":"cwe-476","target_token_count":741,"sven_meta":{"func_name":"WriteImages","file_name":"MagickCore/constitute.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/5b4bebaa91849c592a8448bc353ab25a54ff8c44","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-416#0-ca230407bed8","input":"static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)\n{\n\tstruct mmu_gather tlb;\n\tstruct vm_area_struct *vma;\n\tbool ret = true;\n\n\t/*\n\t * We have to make sure to not race with the victim exit path\n\t * and cause premature new oom victim selection:\n\t * __oom_reap_task_mm\t\texit_mm\n\t * mmget_not_zero\n\t *\t\t\t\t mmput\n\t *\t\t\t\t atomic_dec_and_test\n\t *\t\t\t\t exit_oom_victim\n\t *\t\t\t\t[...]\n\t *\t\t\t\tout_of_memory\n\t *\t\t\t\t select_bad_process\n\t *\t\t\t\t # no TIF_MEMDIE task selects new victim\n\t * unmap_page_range # frees some memory\n\t */\n\tmutex_lock(&oom_lock);\n\n\tif (!down_read_trylock(&mm->mmap_sem)) {\n\t\tret = false;\n\t\ttrace_skip_task_reaping(tsk->pid);\n\t\tgoto unlock_oom;\n\t}\n\n\t/*\n\t * If the mm has notifiers then we would need to invalidate them around\n\t * unmap_page_range and that is risky because notifiers can sleep and\n\t * what they do is basically undeterministic. So let's have a short\n\t * sleep to give the oom victim some more time.\n\t * TODO: we really want to get rid of this ugly hack and make sure that\n\t * notifiers cannot block for unbounded amount of time and add\n\t * mmu_notifier_invalidate_range_{start,end} around unmap_page_range\n\t */\n\tif (mm_has_notifiers(mm)) {\n\t\tup_read(&mm->mmap_sem);\n\t\tschedule_timeout_idle(HZ);\n\t\tgoto unlock_oom;\n\t}\n\n\t/*\n\t * MMF_OOM_SKIP is set by exit_mmap when the OOM reaper can't\n\t * work on the mm anymore. The check for MMF_OOM_SKIP must run\n\t * under mmap_sem for reading because it serializes against the\n\t * down_write();up_write() cycle in exit_mmap().\n\t */\n\tif (test_bit(MMF_OOM_SKIP, &mm->flags)) {\n\t\tup_read(&mm->mmap_sem);\n\t\ttrace_skip_task_reaping(tsk->pid);\n\t\tgoto unlock_oom;\n\t}\n\n\ttrace_start_task_reaping(tsk->pid);\n\n\t/*\n\t * Tell all users of get_user/copy_from_user etc... that the content\n\t * is no longer stable. No barriers really needed because unmapping\n\t * should imply barriers already and the reader would hit a page fault\n\t * if it stumbled over a reaped memory.\n\t */\n\tset_bit(MMF_UNSTABLE, &mm->flags);\n\n\ttlb_gather_mmu(&tlb, mm, 0, -1);\n\tfor (vma = mm->mmap ; vma; vma = vma->vm_next) {\n\t\tif (!can_madv_dontneed_vma(vma))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * Only anonymous pages have a good chance to be dropped\n\t\t * without additional steps which we cannot afford as we\n\t\t * are OOM already.\n\t\t *\n\t\t * We do not even care about fs backed pages because all\n\t\t * which are reclaimable have already been reclaimed and\n\t\t * we do not want to block exit_mmap by keeping mm ref\n\t\t * count elevated without a good reason.\n\t\t */\n\t\tif (vma_is_anonymous(vma) || !(vma->vm_flags & VM_SHARED))\n\t\t\tunmap_page_range(&tlb, vma, vma->vm_start, vma->vm_end,\n\t\t\t\t\t NULL);\n\t}\n\ttlb_finish_mmu(&tlb, 0, -1);\n\tpr_info(\"oom_reaper: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\\n\",\n\t\t\ttask_pid_nr(tsk), tsk->comm,\n\t\t\tK(get_mm_counter(mm, MM_ANONPAGES)),\n\t\t\tK(get_mm_counter(mm, MM_FILEPAGES)),\n\t\t\tK(get_mm_counter(mm, MM_SHMEMPAGES)));\n\tup_read(&mm->mmap_sem);\n\n\ttrace_finish_task_reaping(tsk->pid);\nunlock_oom:\n\tmutex_unlock(&oom_lock);\n\treturn ret;\n}","target":"static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)\n{\n\tstruct mmu_gather tlb;\n\tstruct vm_area_struct *vma;\n\tbool ret = true;\n\n\t/*\n\t * We have to make sure to not race with the victim exit path\n\t * and cause premature new oom victim selection:\n\t * __oom_reap_task_mm\t\texit_mm\n\t * mmget_not_zero\n\t *\t\t\t\t mmput\n\t *\t\t\t\t atomic_dec_and_test\n\t *\t\t\t\t exit_oom_victim\n\t *\t\t\t\t[...]\n\t *\t\t\t\tout_of_memory\n\t *\t\t\t\t select_bad_process\n\t *\t\t\t\t # no TIF_MEMDIE task selects new victim\n\t * unmap_page_range # frees some memory\n\t */\n\tmutex_lock(&oom_lock);\n\n\tif (!down_read_trylock(&mm->mmap_sem)) {\n\t\tret = false;\n\t\ttrace_skip_task_reaping(tsk->pid);\n\t\tgoto unlock_oom;\n\t}\n\n\t/*\n\t * If the mm has notifiers then we would need to invalidate them around\n\t * unmap_page_range and that is risky because notifiers can sleep and\n\t * what they do is basically undeterministic. So let's have a short\n\t * sleep to give the oom victim some more time.\n\t * TODO: we really want to get rid of this ugly hack and make sure that\n\t * notifiers cannot block for unbounded amount of time and add\n\t * mmu_notifier_invalidate_range_{start,end} around unmap_page_range\n\t */\n\tif (mm_has_notifiers(mm)) {\n\t\tup_read(&mm->mmap_sem);\n\t\tschedule_timeout_idle(HZ);\n\t\tgoto unlock_oom;\n\t}\n\n\t/*\n\t * MMF_OOM_SKIP is set by exit_mmap when the OOM reaper can't\n\t * work on the mm anymore. The check for MMF_OOM_SKIP must run\n\t * under mmap_sem for reading because it serializes against the\n\t * down_write();up_write() cycle in exit_mmap().\n\t */\n\tif (test_bit(MMF_OOM_SKIP, &mm->flags)) {\n\t\tup_read(&mm->mmap_sem);\n\t\ttrace_skip_task_reaping(tsk->pid);\n\t\tgoto unlock_oom;\n\t}\n\n\ttrace_start_task_reaping(tsk->pid);\n\n\t/*\n\t * Tell all users of get_user/copy_from_user etc... that the content\n\t * is no longer stable. No barriers really needed because unmapping\n\t * should imply barriers already and the reader would hit a page fault\n\t * if it stumbled over a reaped memory.\n\t */\n\tset_bit(MMF_UNSTABLE, &mm->flags);\n\n\tfor (vma = mm->mmap ; vma; vma = vma->vm_next) {\n\t\tif (!can_madv_dontneed_vma(vma))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * Only anonymous pages have a good chance to be dropped\n\t\t * without additional steps which we cannot afford as we\n\t\t * are OOM already.\n\t\t *\n\t\t * We do not even care about fs backed pages because all\n\t\t * which are reclaimable have already been reclaimed and\n\t\t * we do not want to block exit_mmap by keeping mm ref\n\t\t * count elevated without a good reason.\n\t\t */\n\t\tif (vma_is_anonymous(vma) || !(vma->vm_flags & VM_SHARED)) {\n\t\t\ttlb_gather_mmu(&tlb, mm, vma->vm_start, vma->vm_end);\n\t\t\tunmap_page_range(&tlb, vma, vma->vm_start, vma->vm_end,\n\t\t\t\t\t NULL);\n\t\t\ttlb_finish_mmu(&tlb, vma->vm_start, vma->vm_end);\n\t\t}\n\t}\n\tpr_info(\"oom_reaper: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\\n\",\n\t\t\ttask_pid_nr(tsk), tsk->comm,\n\t\t\tK(get_mm_counter(mm, MM_ANONPAGES)),\n\t\t\tK(get_mm_counter(mm, MM_FILEPAGES)),\n\t\t\tK(get_mm_counter(mm, MM_SHMEMPAGES)));\n\tup_read(&mm->mmap_sem);\n\n\ttrace_finish_task_reaping(tsk->pid);\nunlock_oom:\n\tmutex_unlock(&oom_lock);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-416","target_token_count":927,"sven_meta":{"func_name":"__oom_reap_task_mm","file_name":"mm/oom_kill.c","commit_link":"github.com/torvalds/linux/commit/687cb0884a714ff484d038e9190edc874edcf146","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#1-d8729780a16f","input":"static void gf_m2ts_process_pat(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *ses, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)\n{\n\tGF_M2TS_Program *prog;\n\tGF_M2TS_SECTION_ES *pmt;\n\tu32 i, nb_progs, evt_type;\n\tu32 nb_sections;\n\tu32 data_size;\n\tunsigned char *data;\n\tGF_M2TS_Section *section;\n\n\t/*wait for the last section */\n\tif (!(status&GF_M2TS_TABLE_END)) return;\n\n\t/*skip if already received*/\n\tif (status&GF_M2TS_TABLE_REPEAT) {\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PAT_REPEAT, NULL);\n\t\treturn;\n\t}\n\n\tnb_sections = gf_list_count(sections);\n\tif (nb_sections > 1) {\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"PAT on multiple sections not supported\\n\"));\n\t}\n\n\tsection = (GF_M2TS_Section *)gf_list_get(sections, 0);\n\tdata = section->data;\n\tdata_size = section->data_size;\n\n\tif (!(status&GF_M2TS_TABLE_UPDATE) && gf_list_count(ts->programs)) {\n\t\tif (ts->pat->demux_restarted) {\n\t\t\tts->pat->demux_restarted = 0;\n\t\t} else {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Multiple different PAT on single TS found, ignoring new PAT declaration (table id %d - extended table id %d)\\n\", table_id, ex_table_id));\n\t\t}\n\t\treturn;\n\t}\n\tnb_progs = data_size / 4;\n\n\tfor (i=0; init) {\n\t\t\t\tts->nit = gf_m2ts_section_filter_new(gf_m2ts_process_nit, 0);\n\t\t\t}\n\t\t} else {\n\t\t\tGF_SAFEALLOC(prog, GF_M2TS_Program);\n\t\t\tif (!prog) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Fail to allocate program for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tprog->streams = gf_list_new();\n\t\t\tprog->pmt_pid = pid;\n\t\t\tprog->number = number;\n\t\t\tprog->ts = ts;\n\t\t\tgf_list_add(ts->programs, prog);\n\t\t\tGF_SAFEALLOC(pmt, GF_M2TS_SECTION_ES);\n\t\t\tif (!pmt) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Fail to allocate pmt filter for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpmt->flags = GF_M2TS_ES_IS_SECTION;\n\t\t\tgf_list_add(prog->streams, pmt);\n\t\t\tpmt->pid = prog->pmt_pid;\n\t\t\tpmt->program = prog;\n\t\t\tts->ess[pmt->pid] = (GF_M2TS_ES *)pmt;\n\t\t\tpmt->sec = gf_m2ts_section_filter_new(gf_m2ts_process_pmt, 0);\n\t\t}\n\t}\n\n\tevt_type = (status&GF_M2TS_TABLE_UPDATE) ? GF_M2TS_EVT_PAT_UPDATE : GF_M2TS_EVT_PAT_FOUND;\n\tif (ts->on_event) ts->on_event(ts, evt_type, NULL);\n}","target":"static void gf_m2ts_process_pat(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *ses, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)\n{\n\tGF_M2TS_Program *prog;\n\tGF_M2TS_SECTION_ES *pmt;\n\tu32 i, nb_progs, evt_type;\n\tu32 nb_sections;\n\tu32 data_size;\n\tunsigned char *data;\n\tGF_M2TS_Section *section;\n\n\t/*wait for the last section */\n\tif (!(status&GF_M2TS_TABLE_END)) return;\n\n\t/*skip if already received*/\n\tif (status&GF_M2TS_TABLE_REPEAT) {\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PAT_REPEAT, NULL);\n\t\treturn;\n\t}\n\n\tnb_sections = gf_list_count(sections);\n\tif (nb_sections > 1) {\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"PAT on multiple sections not supported\\n\"));\n\t}\n\n\tsection = (GF_M2TS_Section *)gf_list_get(sections, 0);\n\tdata = section->data;\n\tdata_size = section->data_size;\n\n\tif (!(status&GF_M2TS_TABLE_UPDATE) && gf_list_count(ts->programs)) {\n\t\tif (ts->pat->demux_restarted) {\n\t\t\tts->pat->demux_restarted = 0;\n\t\t} else {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Multiple different PAT on single TS found, ignoring new PAT declaration (table id %d - extended table id %d)\\n\", table_id, ex_table_id));\n\t\t}\n\t\treturn;\n\t}\n\tnb_progs = data_size / 4;\n\n\tfor (i=0; init) {\n\t\t\t\tts->nit = gf_m2ts_section_filter_new(gf_m2ts_process_nit, 0);\n\t\t\t}\n\t\t} else if (!pid) {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Broken PAT found reserved PID 0, ignoring\\n\", pid));\n\t\t} else if (! ts->ess[pid]) {\n\t\t\tGF_SAFEALLOC(prog, GF_M2TS_Program);\n\t\t\tif (!prog) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Fail to allocate program for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tprog->streams = gf_list_new();\n\t\t\tprog->pmt_pid = pid;\n\t\t\tprog->number = number;\n\t\t\tprog->ts = ts;\n\t\t\tgf_list_add(ts->programs, prog);\n\t\t\tGF_SAFEALLOC(pmt, GF_M2TS_SECTION_ES);\n\t\t\tif (!pmt) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Fail to allocate pmt filter for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpmt->flags = GF_M2TS_ES_IS_SECTION;\n\t\t\tgf_list_add(prog->streams, pmt);\n\t\t\tpmt->pid = prog->pmt_pid;\n\t\t\tpmt->program = prog;\n\t\t\tts->ess[pmt->pid] = (GF_M2TS_ES *)pmt;\n\t\t\tpmt->sec = gf_m2ts_section_filter_new(gf_m2ts_process_pmt, 0);\n\t\t}\n\t}\n\n\tevt_type = (status&GF_M2TS_TABLE_UPDATE) ? GF_M2TS_EVT_PAT_UPDATE : GF_M2TS_EVT_PAT_FOUND;\n\tif (ts->on_event) ts->on_event(ts, evt_type, NULL);\n}","lang":"c","vul_type":"cwe-416","target_token_count":845,"sven_meta":{"func_name":"gf_m2ts_process_pat","file_name":"src/media_tools/mpegts.c","commit_link":"github.com/gpac/gpac/commit/98b727637e32d1d4824101d8947e2dbd573d4fc8","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#2-7743c66f226e","input":"static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n FILE\n *file;\n\n Image\n *image,\n *next_image,\n *pwp_image;\n\n ImageInfo\n *read_info;\n\n int\n c,\n unique_file;\n\n MagickBooleanType\n status;\n\n register Image\n *p;\n\n register ssize_t\n i;\n\n size_t\n filesize,\n length;\n\n ssize_t\n count;\n\n unsigned char\n magick[MaxTextExtent];\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n pwp_image=AcquireImage(image_info);\n image=pwp_image;\n status=OpenBlob(image_info,pwp_image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n return((Image *) NULL);\n count=ReadBlob(pwp_image,5,magick);\n if ((count != 5) || (LocaleNCompare((char *) magick,\"SFW95\",5) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n read_info=CloneImageInfo(image_info);\n (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,\n (void *) NULL);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n unique_file=AcquireUniqueFileResource(read_info->filename);\n for ( ; ; )\n {\n for (c=ReadBlobByte(pwp_image); c != EOF; c=ReadBlobByte(pwp_image))\n {\n for (i=0; i < 17; i++)\n magick[i]=magick[i+1];\n magick[17]=(unsigned char) c;\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) == 0)\n break;\n }\n if (c == EOF)\n break;\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) != 0)\n {\n (void) RelinquishUniqueFileResource(read_info->filename);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Dump SFW image to a temporary file.\n */\n file=(FILE *) NULL;\n if (unique_file != -1)\n file=fdopen(unique_file,\"wb\");\n if ((unique_file == -1) || (file == (FILE *) NULL))\n {\n (void) RelinquishUniqueFileResource(read_info->filename);\n ThrowFileException(exception,FileOpenError,\"UnableToWriteFile\",\n image->filename);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n length=fwrite(\"SFW94A\",1,6,file);\n (void) length;\n filesize=65535UL*magick[2]+256L*magick[1]+magick[0];\n for (i=0; i < (ssize_t) filesize; i++)\n {\n c=ReadBlobByte(pwp_image);\n (void) fputc(c,file);\n }\n (void) fclose(file);\n next_image=ReadImage(read_info,exception);\n if (next_image == (Image *) NULL)\n break;\n (void) FormatLocaleString(next_image->filename,MaxTextExtent,\n \"slide_%02ld.sfw\",(long) next_image->scene);\n if (image == (Image *) NULL)\n image=next_image;\n else\n {\n /*\n Link image into image list.\n */\n for (p=image; p->next != (Image *) NULL; p=GetNextImageInList(p)) ;\n next_image->previous=p;\n next_image->scene=p->scene+1;\n p->next=next_image;\n }\n if (image_info->number_scenes != 0)\n if (next_image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageProgress(image,LoadImagesTag,TellBlob(pwp_image),\n GetBlobSize(pwp_image));\n if (status == MagickFalse)\n break;\n }\n if (unique_file != -1)\n (void) close(unique_file);\n (void) RelinquishUniqueFileResource(read_info->filename);\n read_info=DestroyImageInfo(read_info);\n (void) CloseBlob(pwp_image);\n pwp_image=DestroyImage(pwp_image);\n if (EOFBlob(image) != MagickFalse)\n {\n char\n *message;\n\n message=GetExceptionMessage(errno);\n (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,\n \"UnexpectedEndOfFile\",\"`%s': %s\",image->filename,message);\n message=DestroyString(message);\n }\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n FILE\n *file;\n\n Image\n *image,\n *next_image,\n *pwp_image;\n\n ImageInfo\n *read_info;\n\n int\n c,\n unique_file;\n\n MagickBooleanType\n status;\n\n register Image\n *p;\n\n register ssize_t\n i;\n\n size_t\n filesize,\n length;\n\n ssize_t\n count;\n\n unsigned char\n magick[MaxTextExtent];\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n pwp_image=AcquireImage(image_info);\n image=pwp_image;\n status=OpenBlob(image_info,pwp_image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n return((Image *) NULL);\n count=ReadBlob(pwp_image,5,magick);\n if ((count != 5) || (LocaleNCompare((char *) magick,\"SFW95\",5) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n read_info=CloneImageInfo(image_info);\n (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,\n (void *) NULL);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n unique_file=AcquireUniqueFileResource(read_info->filename);\n for ( ; ; )\n {\n for (c=ReadBlobByte(pwp_image); c != EOF; c=ReadBlobByte(pwp_image))\n {\n for (i=0; i < 17; i++)\n magick[i]=magick[i+1];\n magick[17]=(unsigned char) c;\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) == 0)\n break;\n }\n if (c == EOF)\n break;\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) != 0)\n {\n (void) RelinquishUniqueFileResource(read_info->filename);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Dump SFW image to a temporary file.\n */\n file=(FILE *) NULL;\n if (unique_file != -1)\n file=fdopen(unique_file,\"wb\");\n if ((unique_file == -1) || (file == (FILE *) NULL))\n {\n (void) RelinquishUniqueFileResource(read_info->filename);\n ThrowFileException(exception,FileOpenError,\"UnableToWriteFile\",\n image->filename);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n length=fwrite(\"SFW94A\",1,6,file);\n (void) length;\n filesize=65535UL*magick[2]+256L*magick[1]+magick[0];\n for (i=0; i < (ssize_t) filesize; i++)\n {\n c=ReadBlobByte(pwp_image);\n (void) fputc(c,file);\n }\n (void) fclose(file);\n next_image=ReadImage(read_info,exception);\n if (next_image == (Image *) NULL)\n break;\n (void) FormatLocaleString(next_image->filename,MaxTextExtent,\n \"slide_%02ld.sfw\",(long) next_image->scene);\n if (image == (Image *) NULL)\n image=next_image;\n else\n {\n /*\n Link image into image list.\n */\n for (p=image; p->next != (Image *) NULL; p=GetNextImageInList(p)) ;\n next_image->previous=p;\n next_image->scene=p->scene+1;\n p->next=next_image;\n }\n if (image_info->number_scenes != 0)\n if (next_image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageProgress(image,LoadImagesTag,TellBlob(pwp_image),\n GetBlobSize(pwp_image));\n if (status == MagickFalse)\n break;\n }\n if (unique_file != -1)\n (void) close(unique_file);\n (void) RelinquishUniqueFileResource(read_info->filename);\n read_info=DestroyImageInfo(read_info);\n if (EOFBlob(image) != MagickFalse)\n {\n char\n *message;\n\n message=GetExceptionMessage(errno);\n (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,\n \"UnexpectedEndOfFile\",\"`%s': %s\",image->filename,message);\n message=DestroyString(message);\n }\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-416","target_token_count":1122,"sven_meta":{"func_name":"ReadPWPImage","file_name":"coders/pwp.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/ecc03a2518c2b7dd375fde3a040fdae0bdf6a521","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#3-70fd7adb727e","input":"struct sk_buff *skb_segment(struct sk_buff *head_skb,\n\t\t\t netdev_features_t features)\n{\n\tstruct sk_buff *segs = NULL;\n\tstruct sk_buff *tail = NULL;\n\tstruct sk_buff *list_skb = skb_shinfo(head_skb)->frag_list;\n\tskb_frag_t *frag = skb_shinfo(head_skb)->frags;\n\tunsigned int mss = skb_shinfo(head_skb)->gso_size;\n\tunsigned int doffset = head_skb->data - skb_mac_header(head_skb);\n\tunsigned int offset = doffset;\n\tunsigned int tnl_hlen = skb_tnl_header_len(head_skb);\n\tunsigned int headroom;\n\tunsigned int len;\n\t__be16 proto;\n\tbool csum;\n\tint sg = !!(features & NETIF_F_SG);\n\tint nfrags = skb_shinfo(head_skb)->nr_frags;\n\tint err = -ENOMEM;\n\tint i = 0;\n\tint pos;\n\n\tproto = skb_network_protocol(head_skb);\n\tif (unlikely(!proto))\n\t\treturn ERR_PTR(-EINVAL);\n\n\tcsum = !!can_checksum_protocol(features, proto);\n\t__skb_push(head_skb, doffset);\n\theadroom = skb_headroom(head_skb);\n\tpos = skb_headlen(head_skb);\n\n\tdo {\n\t\tstruct sk_buff *nskb;\n\t\tskb_frag_t *nskb_frag;\n\t\tint hsize;\n\t\tint size;\n\n\t\tlen = head_skb->len - offset;\n\t\tif (len > mss)\n\t\t\tlen = mss;\n\n\t\thsize = skb_headlen(head_skb) - offset;\n\t\tif (hsize < 0)\n\t\t\thsize = 0;\n\t\tif (hsize > len || !sg)\n\t\t\thsize = len;\n\n\t\tif (!hsize && i >= nfrags && skb_headlen(list_skb) &&\n\t\t (skb_headlen(list_skb) == len || sg)) {\n\t\t\tBUG_ON(skb_headlen(list_skb) > len);\n\n\t\t\ti = 0;\n\t\t\tnfrags = skb_shinfo(list_skb)->nr_frags;\n\t\t\tfrag = skb_shinfo(list_skb)->frags;\n\t\t\tpos += skb_headlen(list_skb);\n\n\t\t\twhile (pos < offset + len) {\n\t\t\t\tBUG_ON(i >= nfrags);\n\n\t\t\t\tsize = skb_frag_size(frag);\n\t\t\t\tif (pos + size > offset + len)\n\t\t\t\t\tbreak;\n\n\t\t\t\ti++;\n\t\t\t\tpos += size;\n\t\t\t\tfrag++;\n\t\t\t}\n\n\t\t\tnskb = skb_clone(list_skb, GFP_ATOMIC);\n\t\t\tlist_skb = list_skb->next;\n\n\t\t\tif (unlikely(!nskb))\n\t\t\t\tgoto err;\n\n\t\t\tif (unlikely(pskb_trim(nskb, len))) {\n\t\t\t\tkfree_skb(nskb);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\thsize = skb_end_offset(nskb);\n\t\t\tif (skb_cow_head(nskb, doffset + headroom)) {\n\t\t\t\tkfree_skb(nskb);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\tnskb->truesize += skb_end_offset(nskb) - hsize;\n\t\t\tskb_release_head_state(nskb);\n\t\t\t__skb_push(nskb, doffset);\n\t\t} else {\n\t\t\tnskb = __alloc_skb(hsize + doffset + headroom,\n\t\t\t\t\t GFP_ATOMIC, skb_alloc_rx_flag(head_skb),\n\t\t\t\t\t NUMA_NO_NODE);\n\n\t\t\tif (unlikely(!nskb))\n\t\t\t\tgoto err;\n\n\t\t\tskb_reserve(nskb, headroom);\n\t\t\t__skb_put(nskb, doffset);\n\t\t}\n\n\t\tif (segs)\n\t\t\ttail->next = nskb;\n\t\telse\n\t\t\tsegs = nskb;\n\t\ttail = nskb;\n\n\t\t__copy_skb_header(nskb, head_skb);\n\t\tnskb->mac_len = head_skb->mac_len;\n\n\t\tskb_headers_offset_update(nskb, skb_headroom(nskb) - headroom);\n\n\t\tskb_copy_from_linear_data_offset(head_skb, -tnl_hlen,\n\t\t\t\t\t\t nskb->data - tnl_hlen,\n\t\t\t\t\t\t doffset + tnl_hlen);\n\n\t\tif (nskb->len == len + doffset)\n\t\t\tgoto perform_csum_check;\n\n\t\tif (!sg) {\n\t\t\tnskb->ip_summed = CHECKSUM_NONE;\n\t\t\tnskb->csum = skb_copy_and_csum_bits(head_skb, offset,\n\t\t\t\t\t\t\t skb_put(nskb, len),\n\t\t\t\t\t\t\t len, 0);\n\t\t\tcontinue;\n\t\t}\n\n\t\tnskb_frag = skb_shinfo(nskb)->frags;\n\n\t\tskb_copy_from_linear_data_offset(head_skb, offset,\n\t\t\t\t\t\t skb_put(nskb, hsize), hsize);\n\n\t\tskb_shinfo(nskb)->tx_flags = skb_shinfo(head_skb)->tx_flags &\n\t\t\tSKBTX_SHARED_FRAG;\n\n\t\twhile (pos < offset + len) {\n\t\t\tif (i >= nfrags) {\n\t\t\t\tBUG_ON(skb_headlen(list_skb));\n\n\t\t\t\ti = 0;\n\t\t\t\tnfrags = skb_shinfo(list_skb)->nr_frags;\n\t\t\t\tfrag = skb_shinfo(list_skb)->frags;\n\n\t\t\t\tBUG_ON(!nfrags);\n\n\t\t\t\tlist_skb = list_skb->next;\n\t\t\t}\n\n\t\t\tif (unlikely(skb_shinfo(nskb)->nr_frags >=\n\t\t\t\t MAX_SKB_FRAGS)) {\n\t\t\t\tnet_warn_ratelimited(\n\t\t\t\t\t\"skb_segment: too many frags: %u %u\\n\",\n\t\t\t\t\tpos, mss);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\t*nskb_frag = *frag;\n\t\t\t__skb_frag_ref(nskb_frag);\n\t\t\tsize = skb_frag_size(nskb_frag);\n\n\t\t\tif (pos < offset) {\n\t\t\t\tnskb_frag->page_offset += offset - pos;\n\t\t\t\tskb_frag_size_sub(nskb_frag, offset - pos);\n\t\t\t}\n\n\t\t\tskb_shinfo(nskb)->nr_frags++;\n\n\t\t\tif (pos + size <= offset + len) {\n\t\t\t\ti++;\n\t\t\t\tfrag++;\n\t\t\t\tpos += size;\n\t\t\t} else {\n\t\t\t\tskb_frag_size_sub(nskb_frag, pos + size - (offset + len));\n\t\t\t\tgoto skip_fraglist;\n\t\t\t}\n\n\t\t\tnskb_frag++;\n\t\t}\n\nskip_fraglist:\n\t\tnskb->data_len = len - hsize;\n\t\tnskb->len += nskb->data_len;\n\t\tnskb->truesize += nskb->data_len;\n\nperform_csum_check:\n\t\tif (!csum) {\n\t\t\tnskb->csum = skb_checksum(nskb, doffset,\n\t\t\t\t\t\t nskb->len - doffset, 0);\n\t\t\tnskb->ip_summed = CHECKSUM_NONE;\n\t\t}\n\t} while ((offset += len) < head_skb->len);\n\n\treturn segs;\n\nerr:\n\tkfree_skb_list(segs);\n\treturn ERR_PTR(err);\n}","target":"struct sk_buff *skb_segment(struct sk_buff *head_skb,\n\t\t\t netdev_features_t features)\n{\n\tstruct sk_buff *segs = NULL;\n\tstruct sk_buff *tail = NULL;\n\tstruct sk_buff *list_skb = skb_shinfo(head_skb)->frag_list;\n\tskb_frag_t *frag = skb_shinfo(head_skb)->frags;\n\tunsigned int mss = skb_shinfo(head_skb)->gso_size;\n\tunsigned int doffset = head_skb->data - skb_mac_header(head_skb);\n\tstruct sk_buff *frag_skb = head_skb;\n\tunsigned int offset = doffset;\n\tunsigned int tnl_hlen = skb_tnl_header_len(head_skb);\n\tunsigned int headroom;\n\tunsigned int len;\n\t__be16 proto;\n\tbool csum;\n\tint sg = !!(features & NETIF_F_SG);\n\tint nfrags = skb_shinfo(head_skb)->nr_frags;\n\tint err = -ENOMEM;\n\tint i = 0;\n\tint pos;\n\n\tproto = skb_network_protocol(head_skb);\n\tif (unlikely(!proto))\n\t\treturn ERR_PTR(-EINVAL);\n\n\tcsum = !!can_checksum_protocol(features, proto);\n\t__skb_push(head_skb, doffset);\n\theadroom = skb_headroom(head_skb);\n\tpos = skb_headlen(head_skb);\n\n\tdo {\n\t\tstruct sk_buff *nskb;\n\t\tskb_frag_t *nskb_frag;\n\t\tint hsize;\n\t\tint size;\n\n\t\tlen = head_skb->len - offset;\n\t\tif (len > mss)\n\t\t\tlen = mss;\n\n\t\thsize = skb_headlen(head_skb) - offset;\n\t\tif (hsize < 0)\n\t\t\thsize = 0;\n\t\tif (hsize > len || !sg)\n\t\t\thsize = len;\n\n\t\tif (!hsize && i >= nfrags && skb_headlen(list_skb) &&\n\t\t (skb_headlen(list_skb) == len || sg)) {\n\t\t\tBUG_ON(skb_headlen(list_skb) > len);\n\n\t\t\ti = 0;\n\t\t\tnfrags = skb_shinfo(list_skb)->nr_frags;\n\t\t\tfrag = skb_shinfo(list_skb)->frags;\n\t\t\tfrag_skb = list_skb;\n\t\t\tpos += skb_headlen(list_skb);\n\n\t\t\twhile (pos < offset + len) {\n\t\t\t\tBUG_ON(i >= nfrags);\n\n\t\t\t\tsize = skb_frag_size(frag);\n\t\t\t\tif (pos + size > offset + len)\n\t\t\t\t\tbreak;\n\n\t\t\t\ti++;\n\t\t\t\tpos += size;\n\t\t\t\tfrag++;\n\t\t\t}\n\n\t\t\tnskb = skb_clone(list_skb, GFP_ATOMIC);\n\t\t\tlist_skb = list_skb->next;\n\n\t\t\tif (unlikely(!nskb))\n\t\t\t\tgoto err;\n\n\t\t\tif (unlikely(pskb_trim(nskb, len))) {\n\t\t\t\tkfree_skb(nskb);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\thsize = skb_end_offset(nskb);\n\t\t\tif (skb_cow_head(nskb, doffset + headroom)) {\n\t\t\t\tkfree_skb(nskb);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\tnskb->truesize += skb_end_offset(nskb) - hsize;\n\t\t\tskb_release_head_state(nskb);\n\t\t\t__skb_push(nskb, doffset);\n\t\t} else {\n\t\t\tnskb = __alloc_skb(hsize + doffset + headroom,\n\t\t\t\t\t GFP_ATOMIC, skb_alloc_rx_flag(head_skb),\n\t\t\t\t\t NUMA_NO_NODE);\n\n\t\t\tif (unlikely(!nskb))\n\t\t\t\tgoto err;\n\n\t\t\tskb_reserve(nskb, headroom);\n\t\t\t__skb_put(nskb, doffset);\n\t\t}\n\n\t\tif (segs)\n\t\t\ttail->next = nskb;\n\t\telse\n\t\t\tsegs = nskb;\n\t\ttail = nskb;\n\n\t\t__copy_skb_header(nskb, head_skb);\n\t\tnskb->mac_len = head_skb->mac_len;\n\n\t\tskb_headers_offset_update(nskb, skb_headroom(nskb) - headroom);\n\n\t\tskb_copy_from_linear_data_offset(head_skb, -tnl_hlen,\n\t\t\t\t\t\t nskb->data - tnl_hlen,\n\t\t\t\t\t\t doffset + tnl_hlen);\n\n\t\tif (nskb->len == len + doffset)\n\t\t\tgoto perform_csum_check;\n\n\t\tif (!sg) {\n\t\t\tnskb->ip_summed = CHECKSUM_NONE;\n\t\t\tnskb->csum = skb_copy_and_csum_bits(head_skb, offset,\n\t\t\t\t\t\t\t skb_put(nskb, len),\n\t\t\t\t\t\t\t len, 0);\n\t\t\tcontinue;\n\t\t}\n\n\t\tnskb_frag = skb_shinfo(nskb)->frags;\n\n\t\tskb_copy_from_linear_data_offset(head_skb, offset,\n\t\t\t\t\t\t skb_put(nskb, hsize), hsize);\n\n\t\tskb_shinfo(nskb)->tx_flags = skb_shinfo(head_skb)->tx_flags &\n\t\t\tSKBTX_SHARED_FRAG;\n\n\t\twhile (pos < offset + len) {\n\t\t\tif (i >= nfrags) {\n\t\t\t\tBUG_ON(skb_headlen(list_skb));\n\n\t\t\t\ti = 0;\n\t\t\t\tnfrags = skb_shinfo(list_skb)->nr_frags;\n\t\t\t\tfrag = skb_shinfo(list_skb)->frags;\n\t\t\t\tfrag_skb = list_skb;\n\n\t\t\t\tBUG_ON(!nfrags);\n\n\t\t\t\tlist_skb = list_skb->next;\n\t\t\t}\n\n\t\t\tif (unlikely(skb_shinfo(nskb)->nr_frags >=\n\t\t\t\t MAX_SKB_FRAGS)) {\n\t\t\t\tnet_warn_ratelimited(\n\t\t\t\t\t\"skb_segment: too many frags: %u %u\\n\",\n\t\t\t\t\tpos, mss);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\tif (unlikely(skb_orphan_frags(frag_skb, GFP_ATOMIC)))\n\t\t\t\tgoto err;\n\n\t\t\t*nskb_frag = *frag;\n\t\t\t__skb_frag_ref(nskb_frag);\n\t\t\tsize = skb_frag_size(nskb_frag);\n\n\t\t\tif (pos < offset) {\n\t\t\t\tnskb_frag->page_offset += offset - pos;\n\t\t\t\tskb_frag_size_sub(nskb_frag, offset - pos);\n\t\t\t}\n\n\t\t\tskb_shinfo(nskb)->nr_frags++;\n\n\t\t\tif (pos + size <= offset + len) {\n\t\t\t\ti++;\n\t\t\t\tfrag++;\n\t\t\t\tpos += size;\n\t\t\t} else {\n\t\t\t\tskb_frag_size_sub(nskb_frag, pos + size - (offset + len));\n\t\t\t\tgoto skip_fraglist;\n\t\t\t}\n\n\t\t\tnskb_frag++;\n\t\t}\n\nskip_fraglist:\n\t\tnskb->data_len = len - hsize;\n\t\tnskb->len += nskb->data_len;\n\t\tnskb->truesize += nskb->data_len;\n\nperform_csum_check:\n\t\tif (!csum) {\n\t\t\tnskb->csum = skb_checksum(nskb, doffset,\n\t\t\t\t\t\t nskb->len - doffset, 0);\n\t\t\tnskb->ip_summed = CHECKSUM_NONE;\n\t\t}\n\t} while ((offset += len) < head_skb->len);\n\n\treturn segs;\n\nerr:\n\tkfree_skb_list(segs);\n\treturn ERR_PTR(err);\n}","lang":"c","vul_type":"cwe-416","target_token_count":1423,"sven_meta":{"func_name":"skb_segment","file_name":"net/core/skbuff.c","commit_link":"github.com/torvalds/linux/commit/1fd819ecb90cc9b822cd84d3056ddba315d3340f","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#6-9581a4247980","input":"int snd_timer_open(struct snd_timer_instance **ti,\n\t\t char *owner, struct snd_timer_id *tid,\n\t\t unsigned int slave_id)\n{\n\tstruct snd_timer *timer;\n\tstruct snd_timer_instance *timeri = NULL;\n\tstruct device *card_dev_to_put = NULL;\n\tint err;\n\n\tmutex_lock(®ister_mutex);\n\tif (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {\n\t\t/* open a slave instance */\n\t\tif (tid->dev_sclass <= SNDRV_TIMER_SCLASS_NONE ||\n\t\t tid->dev_sclass > SNDRV_TIMER_SCLASS_OSS_SEQUENCER) {\n\t\t\tpr_debug(\"ALSA: timer: invalid slave class %i\\n\",\n\t\t\t\t tid->dev_sclass);\n\t\t\terr = -EINVAL;\n\t\t\tgoto unlock;\n\t\t}\n\t\ttimeri = snd_timer_instance_new(owner, NULL);\n\t\tif (!timeri) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto unlock;\n\t\t}\n\t\ttimeri->slave_class = tid->dev_sclass;\n\t\ttimeri->slave_id = tid->device;\n\t\ttimeri->flags |= SNDRV_TIMER_IFLG_SLAVE;\n\t\tlist_add_tail(&timeri->open_list, &snd_timer_slave_list);\n\t\terr = snd_timer_check_slave(timeri);\n\t\tif (err < 0) {\n\t\t\tsnd_timer_close_locked(timeri, &card_dev_to_put);\n\t\t\ttimeri = NULL;\n\t\t}\n\t\tgoto unlock;\n\t}\n\n\t/* open a master instance */\n\ttimer = snd_timer_find(tid);\n#ifdef CONFIG_MODULES\n\tif (!timer) {\n\t\tmutex_unlock(®ister_mutex);\n\t\tsnd_timer_request(tid);\n\t\tmutex_lock(®ister_mutex);\n\t\ttimer = snd_timer_find(tid);\n\t}\n#endif\n\tif (!timer) {\n\t\terr = -ENODEV;\n\t\tgoto unlock;\n\t}\n\tif (!list_empty(&timer->open_list_head)) {\n\t\ttimeri = list_entry(timer->open_list_head.next,\n\t\t\t\t struct snd_timer_instance, open_list);\n\t\tif (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) {\n\t\t\terr = -EBUSY;\n\t\t\ttimeri = NULL;\n\t\t\tgoto unlock;\n\t\t}\n\t}\n\tif (timer->num_instances >= timer->max_instances) {\n\t\terr = -EBUSY;\n\t\tgoto unlock;\n\t}\n\ttimeri = snd_timer_instance_new(owner, timer);\n\tif (!timeri) {\n\t\terr = -ENOMEM;\n\t\tgoto unlock;\n\t}\n\t/* take a card refcount for safe disconnection */\n\tif (timer->card)\n\t\tget_device(&timer->card->card_dev);\n\ttimeri->slave_class = tid->dev_sclass;\n\ttimeri->slave_id = slave_id;\n\n\tif (list_empty(&timer->open_list_head) && timer->hw.open) {\n\t\terr = timer->hw.open(timer);\n\t\tif (err) {\n\t\t\tkfree(timeri->owner);\n\t\t\tkfree(timeri);\n\t\t\ttimeri = NULL;\n\n\t\t\tif (timer->card)\n\t\t\t\tcard_dev_to_put = &timer->card->card_dev;\n\t\t\tmodule_put(timer->module);\n\t\t\tgoto unlock;\n\t\t}\n\t}\n\n\tlist_add_tail(&timeri->open_list, &timer->open_list_head);\n\ttimer->num_instances++;\n\terr = snd_timer_check_master(timeri);\n\tif (err < 0) {\n\t\tsnd_timer_close_locked(timeri, &card_dev_to_put);\n\t\ttimeri = NULL;\n\t}\n\n unlock:\n\tmutex_unlock(®ister_mutex);\n\t/* put_device() is called after unlock for avoiding deadlock */\n\tif (card_dev_to_put)\n\t\tput_device(card_dev_to_put);\n\t*ti = timeri;\n\treturn err;\n}","target":"int snd_timer_open(struct snd_timer_instance **ti,\n\t\t char *owner, struct snd_timer_id *tid,\n\t\t unsigned int slave_id)\n{\n\tstruct snd_timer *timer;\n\tstruct snd_timer_instance *timeri = NULL;\n\tstruct device *card_dev_to_put = NULL;\n\tint err;\n\n\tmutex_lock(®ister_mutex);\n\tif (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {\n\t\t/* open a slave instance */\n\t\tif (tid->dev_sclass <= SNDRV_TIMER_SCLASS_NONE ||\n\t\t tid->dev_sclass > SNDRV_TIMER_SCLASS_OSS_SEQUENCER) {\n\t\t\tpr_debug(\"ALSA: timer: invalid slave class %i\\n\",\n\t\t\t\t tid->dev_sclass);\n\t\t\terr = -EINVAL;\n\t\t\tgoto unlock;\n\t\t}\n\t\ttimeri = snd_timer_instance_new(owner, NULL);\n\t\tif (!timeri) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto unlock;\n\t\t}\n\t\ttimeri->slave_class = tid->dev_sclass;\n\t\ttimeri->slave_id = tid->device;\n\t\ttimeri->flags |= SNDRV_TIMER_IFLG_SLAVE;\n\t\tlist_add_tail(&timeri->open_list, &snd_timer_slave_list);\n\t\terr = snd_timer_check_slave(timeri);\n\t\tif (err < 0) {\n\t\t\tsnd_timer_close_locked(timeri, &card_dev_to_put);\n\t\t\ttimeri = NULL;\n\t\t}\n\t\tgoto unlock;\n\t}\n\n\t/* open a master instance */\n\ttimer = snd_timer_find(tid);\n#ifdef CONFIG_MODULES\n\tif (!timer) {\n\t\tmutex_unlock(®ister_mutex);\n\t\tsnd_timer_request(tid);\n\t\tmutex_lock(®ister_mutex);\n\t\ttimer = snd_timer_find(tid);\n\t}\n#endif\n\tif (!timer) {\n\t\terr = -ENODEV;\n\t\tgoto unlock;\n\t}\n\tif (!list_empty(&timer->open_list_head)) {\n\t\tstruct snd_timer_instance *t =\n\t\t\tlist_entry(timer->open_list_head.next,\n\t\t\t\t struct snd_timer_instance, open_list);\n\t\tif (t->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) {\n\t\t\terr = -EBUSY;\n\t\t\tgoto unlock;\n\t\t}\n\t}\n\tif (timer->num_instances >= timer->max_instances) {\n\t\terr = -EBUSY;\n\t\tgoto unlock;\n\t}\n\ttimeri = snd_timer_instance_new(owner, timer);\n\tif (!timeri) {\n\t\terr = -ENOMEM;\n\t\tgoto unlock;\n\t}\n\t/* take a card refcount for safe disconnection */\n\tif (timer->card)\n\t\tget_device(&timer->card->card_dev);\n\ttimeri->slave_class = tid->dev_sclass;\n\ttimeri->slave_id = slave_id;\n\n\tif (list_empty(&timer->open_list_head) && timer->hw.open) {\n\t\terr = timer->hw.open(timer);\n\t\tif (err) {\n\t\t\tkfree(timeri->owner);\n\t\t\tkfree(timeri);\n\t\t\ttimeri = NULL;\n\n\t\t\tif (timer->card)\n\t\t\t\tcard_dev_to_put = &timer->card->card_dev;\n\t\t\tmodule_put(timer->module);\n\t\t\tgoto unlock;\n\t\t}\n\t}\n\n\tlist_add_tail(&timeri->open_list, &timer->open_list_head);\n\ttimer->num_instances++;\n\terr = snd_timer_check_master(timeri);\n\tif (err < 0) {\n\t\tsnd_timer_close_locked(timeri, &card_dev_to_put);\n\t\ttimeri = NULL;\n\t}\n\n unlock:\n\tmutex_unlock(®ister_mutex);\n\t/* put_device() is called after unlock for avoiding deadlock */\n\tif (card_dev_to_put)\n\t\tput_device(card_dev_to_put);\n\t*ti = timeri;\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","target_token_count":743,"sven_meta":{"func_name":"snd_timer_open","file_name":"sound/core/timer.c","commit_link":"github.com/torvalds/linux/commit/e7af6307a8a54f0b873960b32b6a644f2d0fbd97","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-022#1-36cdce9d7a8f","input":"void ImportEPUB::ExtractContainer()\n{\n int res = 0;\n if (!cp437) {\n cp437 = new QCodePage437Codec();\n }\n#ifdef Q_OS_WIN32\n zlib_filefunc64_def ffunc;\n fill_win32_filefunc64W(&ffunc);\n unzFile zfile = unzOpen2_64(Utility::QStringToStdWString(QDir::toNativeSeparators(m_FullFilePath)).c_str(), &ffunc);\n#else\n unzFile zfile = unzOpen64(QDir::toNativeSeparators(m_FullFilePath).toUtf8().constData());\n#endif\n\n if (zfile == NULL) {\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot unzip EPUB: %1\")).arg(QDir::toNativeSeparators(m_FullFilePath)).toStdString()));\n }\n\n res = unzGoToFirstFile(zfile);\n\n if (res == UNZ_OK) {\n do {\n // Get the name of the file in the archive.\n char file_name[MAX_PATH] = {0};\n unz_file_info64 file_info;\n unzGetCurrentFileInfo64(zfile, &file_info, file_name, MAX_PATH, NULL, 0, NULL, 0);\n QString qfile_name;\n QString cp437_file_name;\n qfile_name = QString::fromUtf8(file_name);\n if (!(file_info.flag & (1<<11))) {\n // General purpose bit 11 says the filename is utf-8 encoded. If not set then\n // IBM 437 encoding might be used.\n cp437_file_name = cp437->toUnicode(file_name);\n }\n\n // If there is no file name then we can't do anything with it.\n if (!qfile_name.isEmpty()) {\n // We use the dir object to create the path in the temporary directory.\n // Unfortunately, we need a dir ojbect to do this as it's not a static function.\n QDir dir(m_ExtractedFolderPath);\n // Full file path in the temporary directory.\n QString file_path = m_ExtractedFolderPath + \"/\" + qfile_name;\n QFileInfo qfile_info(file_path);\n\n // Is this entry a directory?\n if (file_info.uncompressed_size == 0 && qfile_name.endsWith('/')) {\n dir.mkpath(qfile_name);\n continue;\n } else {\n dir.mkpath(qfile_info.path());\n\t\t // add it to the list of files found inside the zip\n\t\t if (cp437_file_name.isEmpty()) {\n\t\t m_ZipFilePaths << qfile_name;\n\t\t } else {\n m_ZipFilePaths << cp437_file_name;\n\t\t }\n }\n\n // Open the file entry in the archive for reading.\n if (unzOpenCurrentFile(zfile) != UNZ_OK) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // Open the file on disk to write the entry in the archive to.\n QFile entry(file_path);\n\n if (!entry.open(QIODevice::WriteOnly | QIODevice::Truncate)) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // Buffered reading and writing.\n char buff[BUFF_SIZE] = {0};\n int read = 0;\n\n while ((read = unzReadCurrentFile(zfile, buff, BUFF_SIZE)) > 0) {\n entry.write(buff, read);\n }\n\n entry.close();\n\n // Read errors are marked by a negative read amount.\n if (read < 0) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // The file was read but the CRC did not match.\n // We don't check the read file size vs the uncompressed file size\n // because if they're different there should be a CRC error.\n if (unzCloseCurrentFile(zfile) == UNZ_CRCERROR) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n if (!cp437_file_name.isEmpty() && cp437_file_name != qfile_name) {\n QString cp437_file_path = m_ExtractedFolderPath + \"/\" + cp437_file_name;\n QFile::copy(file_path, cp437_file_path);\n }\n }\n } while ((res = unzGoToNextFile(zfile)) == UNZ_OK);\n }\n\n if (res != UNZ_END_OF_LIST_OF_FILE) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot open EPUB: %1\")).arg(QDir::toNativeSeparators(m_FullFilePath)).toStdString()));\n }\n\n unzClose(zfile);\n}","target":"void ImportEPUB::ExtractContainer()\n{\n int res = 0;\n if (!cp437) {\n cp437 = new QCodePage437Codec();\n }\n#ifdef Q_OS_WIN32\n zlib_filefunc64_def ffunc;\n fill_win32_filefunc64W(&ffunc);\n unzFile zfile = unzOpen2_64(Utility::QStringToStdWString(QDir::toNativeSeparators(m_FullFilePath)).c_str(), &ffunc);\n#else\n unzFile zfile = unzOpen64(QDir::toNativeSeparators(m_FullFilePath).toUtf8().constData());\n#endif\n\n if (zfile == NULL) {\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot unzip EPUB: %1\")).arg(QDir::toNativeSeparators(m_FullFilePath)).toStdString()));\n }\n\n res = unzGoToFirstFile(zfile);\n\n if (res == UNZ_OK) {\n do {\n // Get the name of the file in the archive.\n char file_name[MAX_PATH] = {0};\n unz_file_info64 file_info;\n unzGetCurrentFileInfo64(zfile, &file_info, file_name, MAX_PATH, NULL, 0, NULL, 0);\n QString qfile_name;\n QString cp437_file_name;\n qfile_name = QString::fromUtf8(file_name);\n if (!(file_info.flag & (1<<11))) {\n // General purpose bit 11 says the filename is utf-8 encoded. If not set then\n // IBM 437 encoding might be used.\n cp437_file_name = cp437->toUnicode(file_name);\n }\n\n // If there is no file name then we can't do anything with it.\n if (!qfile_name.isEmpty()) {\n\n\t // for security reasons we need the file path to always be inside the \n // target folder and not outside, so we will remove all relative upward \n // paths segments \"..\" from the file path before prepending the target \n // folder to create the final target path\n\t qfile_name = qfile_name.replace(\"../\",\"\");\n cp437_file_name = cp437_file_name.replace(\"../\",\"\");\n\n // We use the dir object to create the path in the temporary directory.\n // Unfortunately, we need a dir ojbect to do this as it's not a static function.\n QDir dir(m_ExtractedFolderPath);\n // Full file path in the temporary directory.\n QString file_path = m_ExtractedFolderPath + \"/\" + qfile_name;\n QFileInfo qfile_info(file_path);\n\n // Is this entry a directory?\n if (file_info.uncompressed_size == 0 && qfile_name.endsWith('/')) {\n dir.mkpath(qfile_name);\n continue;\n } else {\n dir.mkpath(qfile_info.path());\n\t\t // add it to the list of files found inside the zip\n\t\t if (cp437_file_name.isEmpty()) {\n\t\t m_ZipFilePaths << qfile_name;\n\t\t } else {\n m_ZipFilePaths << cp437_file_name;\n\t\t }\n }\n\n // Open the file entry in the archive for reading.\n if (unzOpenCurrentFile(zfile) != UNZ_OK) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // Open the file on disk to write the entry in the archive to.\n QFile entry(file_path);\n\n if (!entry.open(QIODevice::WriteOnly | QIODevice::Truncate)) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // Buffered reading and writing.\n char buff[BUFF_SIZE] = {0};\n int read = 0;\n\n while ((read = unzReadCurrentFile(zfile, buff, BUFF_SIZE)) > 0) {\n entry.write(buff, read);\n }\n\n entry.close();\n\n // Read errors are marked by a negative read amount.\n if (read < 0) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // The file was read but the CRC did not match.\n // We don't check the read file size vs the uncompressed file size\n // because if they're different there should be a CRC error.\n if (unzCloseCurrentFile(zfile) == UNZ_CRCERROR) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n if (!cp437_file_name.isEmpty() && cp437_file_name != qfile_name) {\n QString cp437_file_path = m_ExtractedFolderPath + \"/\" + cp437_file_name;\n QFile::copy(file_path, cp437_file_path);\n }\n }\n } while ((res = unzGoToNextFile(zfile)) == UNZ_OK);\n }\n\n if (res != UNZ_END_OF_LIST_OF_FILE) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot open EPUB: %1\")).arg(QDir::toNativeSeparators(m_FullFilePath)).toStdString()));\n }\n\n unzClose(zfile);\n}","lang":"cpp","vul_type":"cwe-022","target_token_count":1221,"sven_meta":{"func_name":"ImportEPUB::ExtractContainer","file_name":"src/Importers/ImportEPUB.cpp","commit_link":"github.com/Sigil-Ebook/Sigil/commit/369eebe936e4a8c83cc54662a3412ce8bef189e4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#2-2fb22e67d2c4","input":"static MagickBooleanType GetMagickModulePath(const char *filename,\n MagickModuleType module_type,char *path,ExceptionInfo *exception)\n{\n char\n *module_path;\n\n assert(filename != (const char *) NULL);\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n assert(path != (char *) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n (void) CopyMagickString(path,filename,MaxTextExtent);\n module_path=(char *) NULL;\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n (void) LogMagickEvent(ModuleEvent,GetMagickModule(),\n \"Searching for coder module file \\\"%s\\\" ...\",filename);\n module_path=GetEnvironmentValue(\"MAGICK_CODER_MODULE_PATH\");\n#if defined(MAGICKCORE_CODER_PATH)\n if (module_path == (char *) NULL)\n module_path=AcquireString(MAGICKCORE_CODER_PATH);\n#endif\n break;\n }\n case MagickImageFilterModule:\n {\n (void) LogMagickEvent(ModuleEvent,GetMagickModule(),\n \"Searching for filter module file \\\"%s\\\" ...\",filename);\n module_path=GetEnvironmentValue(\"MAGICK_CODER_FILTER_PATH\");\n#if defined(MAGICKCORE_FILTER_PATH)\n if (module_path == (char *) NULL)\n module_path=AcquireString(MAGICKCORE_FILTER_PATH);\n#endif\n break;\n }\n }\n if (module_path != (char *) NULL)\n {\n register char\n *p,\n *q;\n\n for (p=module_path-1; p != (char *) NULL; )\n {\n (void) CopyMagickString(path,p+1,MaxTextExtent);\n q=strchr(path,DirectoryListSeparator);\n if (q != (char *) NULL)\n *q='\\0';\n q=path+strlen(path)-1;\n if ((q >= path) && (*q != *DirectorySeparator))\n (void) ConcatenateMagickString(path,DirectorySeparator,MaxTextExtent);\n (void) ConcatenateMagickString(path,filename,MaxTextExtent);\n if (IsPathAccessible(path) != MagickFalse)\n {\n module_path=DestroyString(module_path);\n return(MagickTrue);\n }\n p=strchr(p+1,DirectoryListSeparator);\n }\n module_path=DestroyString(module_path);\n }\n#if defined(MAGICKCORE_INSTALLED_SUPPORT)\n else\n#if defined(MAGICKCORE_CODER_PATH)\n {\n const char\n *directory;\n\n /*\n Search hard coded paths.\n */\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=MAGICKCORE_CODER_PATH;\n break;\n }\n case MagickImageFilterModule:\n {\n directory=MAGICKCORE_FILTER_PATH;\n break;\n }\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s\",directory,filename);\n if (IsPathAccessible(path) == MagickFalse)\n {\n ThrowFileException(exception,ConfigureWarning,\n \"UnableToOpenModuleFile\",path);\n return(MagickFalse);\n }\n return(MagickTrue);\n }\n#else\n#if defined(MAGICKCORE_WINDOWS_SUPPORT)\n {\n const char\n *registery_key;\n\n unsigned char\n *key_value;\n\n /*\n Locate path via registry key.\n */\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n registery_key=\"CoderModulesPath\";\n break;\n }\n case MagickImageFilterModule:\n {\n registery_key=\"FilterModulesPath\";\n break;\n }\n }\n key_value=NTRegistryKeyLookup(registery_key);\n if (key_value == (unsigned char *) NULL)\n {\n ThrowMagickException(exception,GetMagickModule(),ConfigureError,\n \"RegistryKeyLookupFailed\",\"`%s'\",registery_key);\n return(MagickFalse);\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",(char *) key_value,\n DirectorySeparator,filename);\n key_value=(unsigned char *) RelinquishMagickMemory(key_value);\n if (IsPathAccessible(path) == MagickFalse)\n {\n ThrowFileException(exception,ConfigureWarning,\n \"UnableToOpenModuleFile\",path);\n return(MagickFalse);\n }\n return(MagickTrue);\n }\n#endif\n#endif\n#if !defined(MAGICKCORE_CODER_PATH) && !defined(MAGICKCORE_WINDOWS_SUPPORT)\n# error MAGICKCORE_CODER_PATH or MAGICKCORE_WINDOWS_SUPPORT must be defined when MAGICKCORE_INSTALLED_SUPPORT is defined\n#endif\n#else\n {\n char\n *home;\n\n home=GetEnvironmentValue(\"MAGICK_HOME\");\n if (home != (char *) NULL)\n {\n /*\n Search MAGICK_HOME.\n */\n#if !defined(MAGICKCORE_POSIX_SUPPORT)\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",home,\n DirectorySeparator,filename);\n#else\n const char\n *directory;\n\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=MAGICKCORE_CODER_RELATIVE_PATH;\n break;\n }\n case MagickImageFilterModule:\n {\n directory=MAGICKCORE_FILTER_RELATIVE_PATH;\n break;\n }\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s/lib/%s/%s\",home,\n directory,filename);\n#endif\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n if (*GetClientPath() != '\\0')\n {\n /*\n Search based on executable directory.\n */\n#if !defined(MAGICKCORE_POSIX_SUPPORT)\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",GetClientPath(),\n DirectorySeparator,filename);\n#else\n char\n prefix[MaxTextExtent];\n\n const char\n *directory;\n\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=\"coders\";\n break;\n }\n case MagickImageFilterModule:\n {\n directory=\"filters\";\n break;\n }\n }\n (void) CopyMagickString(prefix,GetClientPath(),MaxTextExtent);\n ChopPathComponents(prefix,1);\n (void) FormatLocaleString(path,MaxTextExtent,\"%s/lib/%s/%s/%s\",prefix,\n MAGICKCORE_MODULES_RELATIVE_PATH,directory,filename);\n#endif\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n#if defined(MAGICKCORE_WINDOWS_SUPPORT)\n {\n /*\n Search module path.\n */\n if ((NTGetModulePath(\"CORE_RL_magick_.dll\",path) != MagickFalse) ||\n (NTGetModulePath(\"CORE_DB_magick_.dll\",path) != MagickFalse) ||\n (NTGetModulePath(\"Magick.dll\",path) != MagickFalse))\n {\n (void) ConcatenateMagickString(path,DirectorySeparator,MaxTextExtent);\n (void) ConcatenateMagickString(path,filename,MaxTextExtent);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n#endif\n {\n char\n *home;\n\n home=GetEnvironmentValue(\"XDG_CONFIG_HOME\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"LOCALAPPDATA\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"APPDATA\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"USERPROFILE\");\n if (home != (char *) NULL)\n {\n /*\n Search $XDG_CONFIG_HOME/ImageMagick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%sImageMagick%s%s\",\n home,DirectorySeparator,DirectorySeparator,filename);\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n home=GetEnvironmentValue(\"HOME\");\n if (home != (char *) NULL)\n {\n /*\n Search $HOME/.config/ImageMagick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\n \"%s%s.config%sImageMagick%s%s\",home,DirectorySeparator,\n DirectorySeparator,DirectorySeparator,filename);\n if (IsPathAccessible(path) != MagickFalse)\n {\n home=DestroyString(home);\n return(MagickTrue);\n }\n /*\n Search $HOME/.magick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s.magick%s%s\",home,\n DirectorySeparator,DirectorySeparator,filename);\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n /*\n Search current directory.\n */\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n if (exception->severity < ConfigureError)\n ThrowFileException(exception,ConfigureWarning,\"UnableToOpenModuleFile\",\n path);\n#endif\n return(MagickFalse);\n}","target":"static MagickBooleanType GetMagickModulePath(const char *filename,\n MagickModuleType module_type,char *path,ExceptionInfo *exception)\n{\n char\n *module_path;\n\n assert(filename != (const char *) NULL);\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n assert(path != (char *) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n (void) CopyMagickString(path,filename,MaxTextExtent);\n#if defined(MAGICKCORE_INSTALLED_SUPPORT)\n if (strstr(path,\"../\") != (char *) NULL)\n {\n errno=EPERM;\n (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,\n \"NotAuthorized\",\"`%s'\",path);\n return(MagickFalse);\n }\n#endif\n module_path=(char *) NULL;\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n (void) LogMagickEvent(ModuleEvent,GetMagickModule(),\n \"Searching for coder module file \\\"%s\\\" ...\",filename);\n module_path=GetEnvironmentValue(\"MAGICK_CODER_MODULE_PATH\");\n#if defined(MAGICKCORE_CODER_PATH)\n if (module_path == (char *) NULL)\n module_path=AcquireString(MAGICKCORE_CODER_PATH);\n#endif\n break;\n }\n case MagickImageFilterModule:\n {\n (void) LogMagickEvent(ModuleEvent,GetMagickModule(),\n \"Searching for filter module file \\\"%s\\\" ...\",filename);\n module_path=GetEnvironmentValue(\"MAGICK_CODER_FILTER_PATH\");\n#if defined(MAGICKCORE_FILTER_PATH)\n if (module_path == (char *) NULL)\n module_path=AcquireString(MAGICKCORE_FILTER_PATH);\n#endif\n break;\n }\n }\n if (module_path != (char *) NULL)\n {\n register char\n *p,\n *q;\n\n for (p=module_path-1; p != (char *) NULL; )\n {\n (void) CopyMagickString(path,p+1,MaxTextExtent);\n q=strchr(path,DirectoryListSeparator);\n if (q != (char *) NULL)\n *q='\\0';\n q=path+strlen(path)-1;\n if ((q >= path) && (*q != *DirectorySeparator))\n (void) ConcatenateMagickString(path,DirectorySeparator,MaxTextExtent);\n (void) ConcatenateMagickString(path,filename,MaxTextExtent);\n if (IsPathAccessible(path) != MagickFalse)\n {\n module_path=DestroyString(module_path);\n return(MagickTrue);\n }\n p=strchr(p+1,DirectoryListSeparator);\n }\n module_path=DestroyString(module_path);\n }\n#if defined(MAGICKCORE_INSTALLED_SUPPORT)\n else\n#if defined(MAGICKCORE_CODER_PATH)\n {\n const char\n *directory;\n\n /*\n Search hard coded paths.\n */\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=MAGICKCORE_CODER_PATH;\n break;\n }\n case MagickImageFilterModule:\n {\n directory=MAGICKCORE_FILTER_PATH;\n break;\n }\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s\",directory,filename);\n if (IsPathAccessible(path) == MagickFalse)\n {\n ThrowFileException(exception,ConfigureWarning,\n \"UnableToOpenModuleFile\",path);\n return(MagickFalse);\n }\n return(MagickTrue);\n }\n#else\n#if defined(MAGICKCORE_WINDOWS_SUPPORT)\n {\n const char\n *registery_key;\n\n unsigned char\n *key_value;\n\n /*\n Locate path via registry key.\n */\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n registery_key=\"CoderModulesPath\";\n break;\n }\n case MagickImageFilterModule:\n {\n registery_key=\"FilterModulesPath\";\n break;\n }\n }\n key_value=NTRegistryKeyLookup(registery_key);\n if (key_value == (unsigned char *) NULL)\n {\n ThrowMagickException(exception,GetMagickModule(),ConfigureError,\n \"RegistryKeyLookupFailed\",\"`%s'\",registery_key);\n return(MagickFalse);\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",(char *) key_value,\n DirectorySeparator,filename);\n key_value=(unsigned char *) RelinquishMagickMemory(key_value);\n if (IsPathAccessible(path) == MagickFalse)\n {\n ThrowFileException(exception,ConfigureWarning,\n \"UnableToOpenModuleFile\",path);\n return(MagickFalse);\n }\n return(MagickTrue);\n }\n#endif\n#endif\n#if !defined(MAGICKCORE_CODER_PATH) && !defined(MAGICKCORE_WINDOWS_SUPPORT)\n# error MAGICKCORE_CODER_PATH or MAGICKCORE_WINDOWS_SUPPORT must be defined when MAGICKCORE_INSTALLED_SUPPORT is defined\n#endif\n#else\n {\n char\n *home;\n\n home=GetEnvironmentValue(\"MAGICK_HOME\");\n if (home != (char *) NULL)\n {\n /*\n Search MAGICK_HOME.\n */\n#if !defined(MAGICKCORE_POSIX_SUPPORT)\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",home,\n DirectorySeparator,filename);\n#else\n const char\n *directory;\n\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=MAGICKCORE_CODER_RELATIVE_PATH;\n break;\n }\n case MagickImageFilterModule:\n {\n directory=MAGICKCORE_FILTER_RELATIVE_PATH;\n break;\n }\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s/lib/%s/%s\",home,\n directory,filename);\n#endif\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n if (*GetClientPath() != '\\0')\n {\n /*\n Search based on executable directory.\n */\n#if !defined(MAGICKCORE_POSIX_SUPPORT)\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",GetClientPath(),\n DirectorySeparator,filename);\n#else\n char\n prefix[MaxTextExtent];\n\n const char\n *directory;\n\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=\"coders\";\n break;\n }\n case MagickImageFilterModule:\n {\n directory=\"filters\";\n break;\n }\n }\n (void) CopyMagickString(prefix,GetClientPath(),MaxTextExtent);\n ChopPathComponents(prefix,1);\n (void) FormatLocaleString(path,MaxTextExtent,\"%s/lib/%s/%s/%s\",prefix,\n MAGICKCORE_MODULES_RELATIVE_PATH,directory,filename);\n#endif\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n#if defined(MAGICKCORE_WINDOWS_SUPPORT)\n {\n /*\n Search module path.\n */\n if ((NTGetModulePath(\"CORE_RL_magick_.dll\",path) != MagickFalse) ||\n (NTGetModulePath(\"CORE_DB_magick_.dll\",path) != MagickFalse) ||\n (NTGetModulePath(\"Magick.dll\",path) != MagickFalse))\n {\n (void) ConcatenateMagickString(path,DirectorySeparator,MaxTextExtent);\n (void) ConcatenateMagickString(path,filename,MaxTextExtent);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n#endif\n {\n char\n *home;\n\n home=GetEnvironmentValue(\"XDG_CONFIG_HOME\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"LOCALAPPDATA\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"APPDATA\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"USERPROFILE\");\n if (home != (char *) NULL)\n {\n /*\n Search $XDG_CONFIG_HOME/ImageMagick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%sImageMagick%s%s\",\n home,DirectorySeparator,DirectorySeparator,filename);\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n home=GetEnvironmentValue(\"HOME\");\n if (home != (char *) NULL)\n {\n /*\n Search $HOME/.config/ImageMagick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\n \"%s%s.config%sImageMagick%s%s\",home,DirectorySeparator,\n DirectorySeparator,DirectorySeparator,filename);\n if (IsPathAccessible(path) != MagickFalse)\n {\n home=DestroyString(home);\n return(MagickTrue);\n }\n /*\n Search $HOME/.magick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s.magick%s%s\",home,\n DirectorySeparator,DirectorySeparator,filename);\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n /*\n Search current directory.\n */\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n if (exception->severity < ConfigureError)\n ThrowFileException(exception,ConfigureWarning,\"UnableToOpenModuleFile\",\n path);\n#endif\n return(MagickFalse);\n}","lang":"c","vul_type":"cwe-022","target_token_count":2064,"sven_meta":{"func_name":"GetMagickModulePath","file_name":"magick/module.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/fc6080f1321fd21e86ef916195cc110b05d9effb","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-787#0-fb2c7770ea63","input":"static ssize_t WritePSDChannels(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n MagickOffsetType size_offset,const MagickBooleanType separate)\n{\n Image\n *mask;\n\n MagickOffsetType\n rows_offset;\n\n size_t\n channels,\n count,\n length,\n offset_length;\n\n unsigned char\n *compact_pixels;\n\n count=0;\n offset_length=0;\n rows_offset=0;\n compact_pixels=(unsigned char *) NULL;\n if (next_image->compression == RLECompression)\n {\n compact_pixels=AcquireCompactPixels(image);\n if (compact_pixels == (unsigned char *) NULL)\n return(0);\n }\n channels=1;\n if (separate == MagickFalse)\n {\n if (next_image->storage_class != PseudoClass)\n {\n if (IsGrayImage(next_image,&next_image->exception) == MagickFalse)\n channels=next_image->colorspace == CMYKColorspace ? 4 : 3;\n if (next_image->matte != MagickFalse)\n channels++;\n }\n rows_offset=TellBlob(image)+2;\n count+=WriteCompressionStart(psd_info,image,next_image,channels);\n offset_length=(next_image->rows*(psd_info->version == 1 ? 2 : 4));\n }\n size_offset+=2;\n if (next_image->storage_class == PseudoClass)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n IndexQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n else\n {\n if (IsGrayImage(next_image,&next_image->exception) != MagickFalse)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n GrayQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n else\n {\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateImage(next_image,MagickFalse);\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n RedQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n GreenQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n BlueQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n if (next_image->colorspace == CMYKColorspace)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n BlackQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n }\n if (next_image->matte != MagickFalse)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n AlphaQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n }\n compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateImage(next_image,MagickFalse);\n if (separate != MagickFalse)\n {\n const char\n *property;\n\n property=GetImageArtifact(next_image,\"psd:opacity-mask\");\n if (property != (const char *) NULL)\n {\n mask=(Image *) GetImageRegistry(ImageRegistryType,property,\n &image->exception);\n if (mask != (Image *) NULL)\n {\n if (mask->compression == RLECompression)\n {\n compact_pixels=AcquireCompactPixels(mask);\n if (compact_pixels == (unsigned char *) NULL)\n return(0);\n }\n length=WritePSDChannel(psd_info,image_info,image,mask,\n RedQuantum,compact_pixels,rows_offset,MagickTrue);\n (void) WritePSDSize(psd_info,image,length,size_offset);\n count+=length;\n compact_pixels=(unsigned char *) RelinquishMagickMemory(\n compact_pixels);\n }\n }\n }\n return(count);\n}","target":"static ssize_t WritePSDChannels(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n MagickOffsetType size_offset,const MagickBooleanType separate)\n{\n Image\n *mask;\n\n MagickOffsetType\n rows_offset;\n\n size_t\n channels,\n count,\n length,\n offset_length;\n\n unsigned char\n *compact_pixels;\n\n count=0;\n offset_length=0;\n rows_offset=0;\n compact_pixels=(unsigned char *) NULL;\n if (next_image->compression == RLECompression)\n {\n compact_pixels=AcquireCompactPixels(next_image);\n if (compact_pixels == (unsigned char *) NULL)\n return(0);\n }\n channels=1;\n if (separate == MagickFalse)\n {\n if (next_image->storage_class != PseudoClass)\n {\n if (IsGrayImage(next_image,&next_image->exception) == MagickFalse)\n channels=next_image->colorspace == CMYKColorspace ? 4 : 3;\n if (next_image->matte != MagickFalse)\n channels++;\n }\n rows_offset=TellBlob(image)+2;\n count+=WriteCompressionStart(psd_info,image,next_image,channels);\n offset_length=(next_image->rows*(psd_info->version == 1 ? 2 : 4));\n }\n size_offset+=2;\n if (next_image->storage_class == PseudoClass)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n IndexQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n else\n {\n if (IsGrayImage(next_image,&next_image->exception) != MagickFalse)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n GrayQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n else\n {\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateImage(next_image,MagickFalse);\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n RedQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n GreenQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n BlueQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n if (next_image->colorspace == CMYKColorspace)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n BlackQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n }\n if (next_image->matte != MagickFalse)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n AlphaQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n }\n compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateImage(next_image,MagickFalse);\n if (separate != MagickFalse)\n {\n const char\n *property;\n\n property=GetImageArtifact(next_image,\"psd:opacity-mask\");\n if (property != (const char *) NULL)\n {\n mask=(Image *) GetImageRegistry(ImageRegistryType,property,\n &image->exception);\n if (mask != (Image *) NULL)\n {\n if (mask->compression == RLECompression)\n {\n compact_pixels=AcquireCompactPixels(mask);\n if (compact_pixels == (unsigned char *) NULL)\n return(0);\n }\n length=WritePSDChannel(psd_info,image_info,image,mask,\n RedQuantum,compact_pixels,rows_offset,MagickTrue);\n (void) WritePSDSize(psd_info,image,length,size_offset);\n count+=length;\n compact_pixels=(unsigned char *) RelinquishMagickMemory(\n compact_pixels);\n }\n }\n }\n return(count);\n}","lang":"c","vul_type":"cwe-787","target_token_count":1169,"sven_meta":{"func_name":"WritePSDChannels","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/37a1710e2dab6ed91128ea648d654a22fbe2a6af","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#1-26c099fc3c8e","input":"InitialiseRFBConnection(rfbClient* client)\n{\n rfbProtocolVersionMsg pv;\n int major,minor;\n uint32_t authScheme;\n uint32_t subAuthScheme;\n rfbClientInitMsg ci;\n\n /* if the connection is immediately closed, don't report anything, so\n that pmw's monitor can make test connections */\n\n if (client->listenSpecified)\n errorMessageOnReadFailure = FALSE;\n\n if (!ReadFromRFBServer(client, pv, sz_rfbProtocolVersionMsg)) return FALSE;\n pv[sz_rfbProtocolVersionMsg]=0;\n\n errorMessageOnReadFailure = TRUE;\n\n pv[sz_rfbProtocolVersionMsg] = 0;\n\n if (sscanf(pv,rfbProtocolVersionFormat,&major,&minor) != 2) {\n rfbClientLog(\"Not a valid VNC server (%s)\\n\",pv);\n return FALSE;\n }\n\n\n DefaultSupportedMessages(client);\n client->major = major;\n client->minor = minor;\n\n /* fall back to viewer supported version */\n if ((major==rfbProtocolMajorVersion) && (minor>rfbProtocolMinorVersion))\n client->minor = rfbProtocolMinorVersion;\n\n /* UltraVNC uses minor codes 4 and 6 for the server */\n if (major==3 && (minor==4 || minor==6)) {\n rfbClientLog(\"UltraVNC server detected, enabling UltraVNC specific messages\\n\",pv);\n DefaultSupportedMessagesUltraVNC(client);\n }\n\n /* UltraVNC Single Click uses minor codes 14 and 16 for the server */\n if (major==3 && (minor==14 || minor==16)) {\n minor = minor - 10;\n client->minor = minor;\n rfbClientLog(\"UltraVNC Single Click server detected, enabling UltraVNC specific messages\\n\",pv);\n DefaultSupportedMessagesUltraVNC(client);\n }\n\n /* TightVNC uses minor codes 5 for the server */\n if (major==3 && minor==5) {\n rfbClientLog(\"TightVNC server detected, enabling TightVNC specific messages\\n\",pv);\n DefaultSupportedMessagesTightVNC(client);\n }\n\n /* we do not support > RFB3.8 */\n if ((major==3 && minor>8) || major>3)\n {\n client->major=3;\n client->minor=8;\n }\n\n rfbClientLog(\"VNC server supports protocol version %d.%d (viewer %d.%d)\\n\",\n\t major, minor, rfbProtocolMajorVersion, rfbProtocolMinorVersion);\n\n sprintf(pv,rfbProtocolVersionFormat,client->major,client->minor);\n\n if (!WriteToRFBServer(client, pv, sz_rfbProtocolVersionMsg)) return FALSE;\n\n\n /* 3.7 and onwards sends a # of security types first */\n if (client->major==3 && client->minor > 6)\n {\n if (!ReadSupportedSecurityType(client, &authScheme, FALSE)) return FALSE;\n }\n else\n {\n if (!ReadFromRFBServer(client, (char *)&authScheme, 4)) return FALSE;\n authScheme = rfbClientSwap32IfLE(authScheme);\n }\n \n rfbClientLog(\"Selected Security Scheme %d\\n\", authScheme);\n client->authScheme = authScheme;\n \n switch (authScheme) {\n\n case rfbConnFailed:\n ReadReason(client);\n return FALSE;\n\n case rfbNoAuth:\n rfbClientLog(\"No authentication needed\\n\");\n\n /* 3.8 and upwards sends a Security Result for rfbNoAuth */\n if ((client->major==3 && client->minor > 7) || client->major>3)\n if (!rfbHandleAuthResult(client)) return FALSE; \n\n break;\n\n case rfbVncAuth:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n case rfbMSLogon:\n if (!HandleMSLogonAuth(client)) return FALSE;\n break;\n\n case rfbARD:\n#ifndef LIBVNCSERVER_WITH_CLIENT_GCRYPT\n rfbClientLog(\"GCrypt support was not compiled in\\n\");\n return FALSE;\n#else\n if (!HandleARDAuth(client)) return FALSE;\n#endif\n break;\n\n case rfbTLS:\n if (!HandleAnonTLSAuth(client)) return FALSE;\n /* After the TLS session is established, sub auth types are expected.\n * Note that all following reading/writing are through the TLS session from here.\n */\n if (!ReadSupportedSecurityType(client, &subAuthScheme, TRUE)) return FALSE;\n client->subAuthScheme = subAuthScheme;\n\n switch (subAuthScheme) {\n\n case rfbConnFailed:\n ReadReason(client);\n return FALSE;\n\n case rfbNoAuth:\n rfbClientLog(\"No sub authentication needed\\n\");\n /* 3.8 and upwards sends a Security Result for rfbNoAuth */\n if ((client->major==3 && client->minor > 7) || client->major>3)\n if (!rfbHandleAuthResult(client)) return FALSE;\n break;\n\n case rfbVncAuth:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n default:\n rfbClientLog(\"Unknown sub authentication scheme from VNC server: %d\\n\",\n (int)subAuthScheme);\n return FALSE;\n }\n\n break;\n\n case rfbVeNCrypt:\n if (!HandleVeNCryptAuth(client)) return FALSE;\n\n switch (client->subAuthScheme) {\n\n case rfbVeNCryptTLSNone:\n case rfbVeNCryptX509None:\n rfbClientLog(\"No sub authentication needed\\n\");\n if (!rfbHandleAuthResult(client)) return FALSE;\n break;\n\n case rfbVeNCryptTLSVNC:\n case rfbVeNCryptX509VNC:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n case rfbVeNCryptTLSPlain:\n case rfbVeNCryptX509Plain:\n if (!HandlePlainAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbVeNCryptX509SASL:\n case rfbVeNCryptTLSSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n default:\n rfbClientLog(\"Unknown sub authentication scheme from VNC server: %d\\n\",\n client->subAuthScheme);\n return FALSE;\n }\n\n break;\n\n default:\n {\n rfbBool authHandled=FALSE;\n rfbClientProtocolExtension* e;\n for (e = rfbClientExtensions; e; e = e->next) {\n uint32_t const* secType;\n if (!e->handleAuthentication) continue;\n for (secType = e->securityTypes; secType && *secType; secType++) {\n if (authScheme==*secType) {\n if (!e->handleAuthentication(client, authScheme)) return FALSE;\n if (!rfbHandleAuthResult(client)) return FALSE;\n authHandled=TRUE;\n }\n }\n }\n if (authHandled) break;\n }\n rfbClientLog(\"Unknown authentication scheme from VNC server: %d\\n\",\n\t (int)authScheme);\n return FALSE;\n }\n\n ci.shared = (client->appData.shareDesktop ? 1 : 0);\n\n if (!WriteToRFBServer(client, (char *)&ci, sz_rfbClientInitMsg)) return FALSE;\n\n if (!ReadFromRFBServer(client, (char *)&client->si, sz_rfbServerInitMsg)) return FALSE;\n\n client->si.framebufferWidth = rfbClientSwap16IfLE(client->si.framebufferWidth);\n client->si.framebufferHeight = rfbClientSwap16IfLE(client->si.framebufferHeight);\n client->si.format.redMax = rfbClientSwap16IfLE(client->si.format.redMax);\n client->si.format.greenMax = rfbClientSwap16IfLE(client->si.format.greenMax);\n client->si.format.blueMax = rfbClientSwap16IfLE(client->si.format.blueMax);\n client->si.nameLength = rfbClientSwap32IfLE(client->si.nameLength);\n\n /* To guard against integer wrap-around, si.nameLength is cast to 64 bit */\n client->desktopName = malloc((uint64_t)client->si.nameLength + 1);\n if (!client->desktopName) {\n rfbClientLog(\"Error allocating memory for desktop name, %lu bytes\\n\",\n (unsigned long)client->si.nameLength);\n return FALSE;\n }\n\n if (!ReadFromRFBServer(client, client->desktopName, client->si.nameLength)) return FALSE;\n\n client->desktopName[client->si.nameLength] = 0;\n\n rfbClientLog(\"Desktop name \\\"%s\\\"\\n\",client->desktopName);\n\n rfbClientLog(\"Connected to VNC server, using protocol version %d.%d\\n\",\n\t client->major, client->minor);\n\n rfbClientLog(\"VNC server default format:\\n\");\n PrintPixelFormat(&client->si.format);\n\n return TRUE;\n}","target":"InitialiseRFBConnection(rfbClient* client)\n{\n rfbProtocolVersionMsg pv;\n int major,minor;\n uint32_t authScheme;\n uint32_t subAuthScheme;\n rfbClientInitMsg ci;\n\n /* if the connection is immediately closed, don't report anything, so\n that pmw's monitor can make test connections */\n\n if (client->listenSpecified)\n errorMessageOnReadFailure = FALSE;\n\n if (!ReadFromRFBServer(client, pv, sz_rfbProtocolVersionMsg)) return FALSE;\n pv[sz_rfbProtocolVersionMsg]=0;\n\n errorMessageOnReadFailure = TRUE;\n\n pv[sz_rfbProtocolVersionMsg] = 0;\n\n if (sscanf(pv,rfbProtocolVersionFormat,&major,&minor) != 2) {\n rfbClientLog(\"Not a valid VNC server (%s)\\n\",pv);\n return FALSE;\n }\n\n\n DefaultSupportedMessages(client);\n client->major = major;\n client->minor = minor;\n\n /* fall back to viewer supported version */\n if ((major==rfbProtocolMajorVersion) && (minor>rfbProtocolMinorVersion))\n client->minor = rfbProtocolMinorVersion;\n\n /* UltraVNC uses minor codes 4 and 6 for the server */\n if (major==3 && (minor==4 || minor==6)) {\n rfbClientLog(\"UltraVNC server detected, enabling UltraVNC specific messages\\n\",pv);\n DefaultSupportedMessagesUltraVNC(client);\n }\n\n /* UltraVNC Single Click uses minor codes 14 and 16 for the server */\n if (major==3 && (minor==14 || minor==16)) {\n minor = minor - 10;\n client->minor = minor;\n rfbClientLog(\"UltraVNC Single Click server detected, enabling UltraVNC specific messages\\n\",pv);\n DefaultSupportedMessagesUltraVNC(client);\n }\n\n /* TightVNC uses minor codes 5 for the server */\n if (major==3 && minor==5) {\n rfbClientLog(\"TightVNC server detected, enabling TightVNC specific messages\\n\",pv);\n DefaultSupportedMessagesTightVNC(client);\n }\n\n /* we do not support > RFB3.8 */\n if ((major==3 && minor>8) || major>3)\n {\n client->major=3;\n client->minor=8;\n }\n\n rfbClientLog(\"VNC server supports protocol version %d.%d (viewer %d.%d)\\n\",\n\t major, minor, rfbProtocolMajorVersion, rfbProtocolMinorVersion);\n\n sprintf(pv,rfbProtocolVersionFormat,client->major,client->minor);\n\n if (!WriteToRFBServer(client, pv, sz_rfbProtocolVersionMsg)) return FALSE;\n\n\n /* 3.7 and onwards sends a # of security types first */\n if (client->major==3 && client->minor > 6)\n {\n if (!ReadSupportedSecurityType(client, &authScheme, FALSE)) return FALSE;\n }\n else\n {\n if (!ReadFromRFBServer(client, (char *)&authScheme, 4)) return FALSE;\n authScheme = rfbClientSwap32IfLE(authScheme);\n }\n \n rfbClientLog(\"Selected Security Scheme %d\\n\", authScheme);\n client->authScheme = authScheme;\n \n switch (authScheme) {\n\n case rfbConnFailed:\n ReadReason(client);\n return FALSE;\n\n case rfbNoAuth:\n rfbClientLog(\"No authentication needed\\n\");\n\n /* 3.8 and upwards sends a Security Result for rfbNoAuth */\n if ((client->major==3 && client->minor > 7) || client->major>3)\n if (!rfbHandleAuthResult(client)) return FALSE; \n\n break;\n\n case rfbVncAuth:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n case rfbMSLogon:\n if (!HandleMSLogonAuth(client)) return FALSE;\n break;\n\n case rfbARD:\n#ifndef LIBVNCSERVER_WITH_CLIENT_GCRYPT\n rfbClientLog(\"GCrypt support was not compiled in\\n\");\n return FALSE;\n#else\n if (!HandleARDAuth(client)) return FALSE;\n#endif\n break;\n\n case rfbTLS:\n if (!HandleAnonTLSAuth(client)) return FALSE;\n /* After the TLS session is established, sub auth types are expected.\n * Note that all following reading/writing are through the TLS session from here.\n */\n if (!ReadSupportedSecurityType(client, &subAuthScheme, TRUE)) return FALSE;\n client->subAuthScheme = subAuthScheme;\n\n switch (subAuthScheme) {\n\n case rfbConnFailed:\n ReadReason(client);\n return FALSE;\n\n case rfbNoAuth:\n rfbClientLog(\"No sub authentication needed\\n\");\n /* 3.8 and upwards sends a Security Result for rfbNoAuth */\n if ((client->major==3 && client->minor > 7) || client->major>3)\n if (!rfbHandleAuthResult(client)) return FALSE;\n break;\n\n case rfbVncAuth:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n default:\n rfbClientLog(\"Unknown sub authentication scheme from VNC server: %d\\n\",\n (int)subAuthScheme);\n return FALSE;\n }\n\n break;\n\n case rfbVeNCrypt:\n if (!HandleVeNCryptAuth(client)) return FALSE;\n\n switch (client->subAuthScheme) {\n\n case rfbVeNCryptTLSNone:\n case rfbVeNCryptX509None:\n rfbClientLog(\"No sub authentication needed\\n\");\n if (!rfbHandleAuthResult(client)) return FALSE;\n break;\n\n case rfbVeNCryptTLSVNC:\n case rfbVeNCryptX509VNC:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n case rfbVeNCryptTLSPlain:\n case rfbVeNCryptX509Plain:\n if (!HandlePlainAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbVeNCryptX509SASL:\n case rfbVeNCryptTLSSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n default:\n rfbClientLog(\"Unknown sub authentication scheme from VNC server: %d\\n\",\n client->subAuthScheme);\n return FALSE;\n }\n\n break;\n\n default:\n {\n rfbBool authHandled=FALSE;\n rfbClientProtocolExtension* e;\n for (e = rfbClientExtensions; e; e = e->next) {\n uint32_t const* secType;\n if (!e->handleAuthentication) continue;\n for (secType = e->securityTypes; secType && *secType; secType++) {\n if (authScheme==*secType) {\n if (!e->handleAuthentication(client, authScheme)) return FALSE;\n if (!rfbHandleAuthResult(client)) return FALSE;\n authHandled=TRUE;\n }\n }\n }\n if (authHandled) break;\n }\n rfbClientLog(\"Unknown authentication scheme from VNC server: %d\\n\",\n\t (int)authScheme);\n return FALSE;\n }\n\n ci.shared = (client->appData.shareDesktop ? 1 : 0);\n\n if (!WriteToRFBServer(client, (char *)&ci, sz_rfbClientInitMsg)) return FALSE;\n\n if (!ReadFromRFBServer(client, (char *)&client->si, sz_rfbServerInitMsg)) return FALSE;\n\n client->si.framebufferWidth = rfbClientSwap16IfLE(client->si.framebufferWidth);\n client->si.framebufferHeight = rfbClientSwap16IfLE(client->si.framebufferHeight);\n client->si.format.redMax = rfbClientSwap16IfLE(client->si.format.redMax);\n client->si.format.greenMax = rfbClientSwap16IfLE(client->si.format.greenMax);\n client->si.format.blueMax = rfbClientSwap16IfLE(client->si.format.blueMax);\n client->si.nameLength = rfbClientSwap32IfLE(client->si.nameLength);\n\n if (client->si.nameLength > 1<<20) {\n rfbClientErr(\"Too big desktop name length sent by server: %u B > 1 MB\\n\", (unsigned int)client->si.nameLength);\n return FALSE;\n }\n\n client->desktopName = malloc(client->si.nameLength + 1);\n if (!client->desktopName) {\n rfbClientLog(\"Error allocating memory for desktop name, %lu bytes\\n\",\n (unsigned long)client->si.nameLength);\n return FALSE;\n }\n\n if (!ReadFromRFBServer(client, client->desktopName, client->si.nameLength)) return FALSE;\n\n client->desktopName[client->si.nameLength] = 0;\n\n rfbClientLog(\"Desktop name \\\"%s\\\"\\n\",client->desktopName);\n\n rfbClientLog(\"Connected to VNC server, using protocol version %d.%d\\n\",\n\t client->major, client->minor);\n\n rfbClientLog(\"VNC server default format:\\n\");\n PrintPixelFormat(&client->si.format);\n\n return TRUE;\n}","lang":"c","vul_type":"cwe-787","target_token_count":2144,"sven_meta":{"func_name":"InitialiseRFBConnection","file_name":"libvncclient/rfbproto.c","commit_link":"github.com/LibVNC/libvncserver/commit/c2c4b81e6cb3b485fb1ec7ba9e7defeb889f6ba7","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#2-28a8f50cd3cb","input":"cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,\n uint32_t offs, cdf_property_info_t **info, size_t *count, size_t *maxcount)\n{\n\tconst cdf_section_header_t *shp;\n\tcdf_section_header_t sh;\n\tconst uint8_t *p, *q, *e;\n\tsize_t i, o4, nelements, j, slen, left;\n\tcdf_property_info_t *inp;\n\n\tif (offs > UINT32_MAX / 4) {\n\t\terrno = EFTYPE;\n\t\tgoto out;\n\t}\n\tshp = CAST(const cdf_section_header_t *,\n\t cdf_offset(sst->sst_tab, offs));\n\tif (cdf_check_stream_offset(sst, h, shp, sizeof(*shp), __LINE__) == -1)\n\t\tgoto out;\n\tsh.sh_len = CDF_TOLE4(shp->sh_len);\n\tif (sh.sh_len > CDF_SHLEN_LIMIT) {\n\t\terrno = EFTYPE;\n\t\tgoto out;\n\t}\n\n\tif (cdf_check_stream_offset(sst, h, shp, sh.sh_len, __LINE__) == -1)\n\t\tgoto out;\n\n\tsh.sh_properties = CDF_TOLE4(shp->sh_properties);\n\tDPRINTF((\"section len: %u properties %u\\n\", sh.sh_len,\n\t sh.sh_properties));\n\tif (sh.sh_properties > CDF_PROP_LIMIT)\n\t\tgoto out;\n\tinp = cdf_grow_info(info, maxcount, sh.sh_properties);\n\tif (inp == NULL)\n\t\tgoto out;\n\tinp += *count;\n\t*count += sh.sh_properties;\n\tp = CAST(const uint8_t *, cdf_offset(sst->sst_tab, offs + sizeof(sh)));\n\te = CAST(const uint8_t *, cdf_offset(shp, sh.sh_len));\n\tif (p >= e || cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)\n\t\tgoto out;\n\n\tfor (i = 0; i < sh.sh_properties; i++) {\n\t\tif ((q = cdf_get_property_info_pos(sst, h, p, e, i)) == NULL)\n\t\t\tgoto out;\n\t\tinp[i].pi_id = CDF_GETUINT32(p, i << 1);\n\t\tleft = CAST(size_t, e - q);\n\t\tif (left < sizeof(uint32_t)) {\n\t\t\tDPRINTF((\"short info (no type)_\\n\"));\n\t\t\tgoto out;\n\t\t}\n\t\tinp[i].pi_type = CDF_GETUINT32(q, 0);\n\t\tDPRINTF((\"%\" SIZE_T_FORMAT \"u) id=%#x type=%#x offs=%#tx,%#x\\n\",\n\t\t i, inp[i].pi_id, inp[i].pi_type, q - p, offs));\n\t\tif (inp[i].pi_type & CDF_VECTOR) {\n\t\t\tif (left < sizeof(uint32_t) * 2) {\n\t\t\t\tDPRINTF((\"missing CDF_VECTOR length\\n\"));\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tnelements = CDF_GETUINT32(q, 1);\n\t\t\tif (nelements == 0) {\n\t\t\t\tDPRINTF((\"CDF_VECTOR with nelements == 0\\n\"));\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tslen = 2;\n\t\t} else {\n\t\t\tnelements = 1;\n\t\t\tslen = 1;\n\t\t}\n\t\to4 = slen * sizeof(uint32_t);\n\t\tif (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))\n\t\t\tgoto unknown;\n\t\tswitch (inp[i].pi_type & CDF_TYPEMASK) {\n\t\tcase CDF_NULL:\n\t\tcase CDF_EMPTY:\n\t\t\tbreak;\n\t\tcase CDF_SIGNED16:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int16_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_SIGNED32:\n\t\tcase CDF_BOOL:\n\t\tcase CDF_UNSIGNED32:\n\t\tcase CDF_FLOAT:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int32_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_SIGNED64:\n\t\tcase CDF_UNSIGNED64:\n\t\tcase CDF_DOUBLE:\n\t\tcase CDF_FILETIME:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int64_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_LENGTH32_STRING:\n\t\tcase CDF_LENGTH32_WSTRING:\n\t\t\tif (nelements > 1) {\n\t\t\t\tsize_t nelem = inp - *info;\n\t\t\t\tinp = cdf_grow_info(info, maxcount, nelements);\n\t\t\t\tif (inp == NULL)\n\t\t\t\t\tgoto out;\n\t\t\t\tinp += nelem;\n\t\t\t}\n\t\t\tDPRINTF((\"nelements = %\" SIZE_T_FORMAT \"u\\n\",\n\t\t\t nelements));\n\t\t\tfor (j = 0; j < nelements && i < sh.sh_properties;\n\t\t\t j++, i++)\n\t\t\t{\n\t\t\t\tuint32_t l;\n\n\t\t\t\tif (o4 + sizeof(uint32_t) > left)\n\t\t\t\t\tgoto out;\n\n\t\t\t\tl = CDF_GETUINT32(q, slen);\n\t\t\t\to4 += sizeof(uint32_t);\n\t\t\t\tif (o4 + l > left)\n\t\t\t\t\tgoto out;\n\n\t\t\t\tinp[i].pi_str.s_len = l;\n\t\t\t\tinp[i].pi_str.s_buf = CAST(const char *,\n\t\t\t\t CAST(const void *, &q[o4]));\n\n\t\t\t\tDPRINTF((\"o=%\" SIZE_T_FORMAT \"u l=%d(%\"\n\t\t\t\t SIZE_T_FORMAT \"u), t=%\" SIZE_T_FORMAT\n\t\t\t\t \"u s=%s\\n\", o4, l, CDF_ROUND(l, sizeof(l)),\n\t\t\t\t left, inp[i].pi_str.s_buf));\n\n\t\t\t\tif (l & 1)\n\t\t\t\t\tl++;\n\n\t\t\t\tslen += l >> 1;\n\t\t\t\to4 = slen * sizeof(uint32_t);\n\t\t\t}\n\t\t\ti--;\n\t\t\tbreak;\n\t\tcase CDF_CLIPBOARD:\n\t\t\tif (inp[i].pi_type & CDF_VECTOR)\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tdefault:\n\t\tunknown:\n\t\t\tmemset(&inp[i].pi_val, 0, sizeof(inp[i].pi_val));\n\t\t\tDPRINTF((\"Don't know how to deal with %#x\\n\",\n\t\t\t inp[i].pi_type));\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\nout:\n\tfree(*info);\n\t*info = NULL;\n\t*count = 0;\n\t*maxcount = 0;\n\terrno = EFTYPE;\n\treturn -1;\n}","target":"cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,\n uint32_t offs, cdf_property_info_t **info, size_t *count, size_t *maxcount)\n{\n\tconst cdf_section_header_t *shp;\n\tcdf_section_header_t sh;\n\tconst uint8_t *p, *q, *e;\n\tsize_t i, o4, nelements, j, slen, left;\n\tcdf_property_info_t *inp;\n\n\tif (offs > UINT32_MAX / 4) {\n\t\terrno = EFTYPE;\n\t\tgoto out;\n\t}\n\tshp = CAST(const cdf_section_header_t *,\n\t cdf_offset(sst->sst_tab, offs));\n\tif (cdf_check_stream_offset(sst, h, shp, sizeof(*shp), __LINE__) == -1)\n\t\tgoto out;\n\tsh.sh_len = CDF_TOLE4(shp->sh_len);\n\tif (sh.sh_len > CDF_SHLEN_LIMIT) {\n\t\terrno = EFTYPE;\n\t\tgoto out;\n\t}\n\n\tif (cdf_check_stream_offset(sst, h, shp, sh.sh_len, __LINE__) == -1)\n\t\tgoto out;\n\n\tsh.sh_properties = CDF_TOLE4(shp->sh_properties);\n\tDPRINTF((\"section len: %u properties %u\\n\", sh.sh_len,\n\t sh.sh_properties));\n\tif (sh.sh_properties > CDF_PROP_LIMIT)\n\t\tgoto out;\n\tinp = cdf_grow_info(info, maxcount, sh.sh_properties);\n\tif (inp == NULL)\n\t\tgoto out;\n\tinp += *count;\n\t*count += sh.sh_properties;\n\tp = CAST(const uint8_t *, cdf_offset(sst->sst_tab, offs + sizeof(sh)));\n\te = CAST(const uint8_t *, cdf_offset(shp, sh.sh_len));\n\tif (p >= e || cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)\n\t\tgoto out;\n\n\tfor (i = 0; i < sh.sh_properties; i++) {\n\t\tif ((q = cdf_get_property_info_pos(sst, h, p, e, i)) == NULL)\n\t\t\tgoto out;\n\t\tinp[i].pi_id = CDF_GETUINT32(p, i << 1);\n\t\tleft = CAST(size_t, e - q);\n\t\tif (left < sizeof(uint32_t)) {\n\t\t\tDPRINTF((\"short info (no type)_\\n\"));\n\t\t\tgoto out;\n\t\t}\n\t\tinp[i].pi_type = CDF_GETUINT32(q, 0);\n\t\tDPRINTF((\"%\" SIZE_T_FORMAT \"u) id=%#x type=%#x offs=%#tx,%#x\\n\",\n\t\t i, inp[i].pi_id, inp[i].pi_type, q - p, offs));\n\t\tif (inp[i].pi_type & CDF_VECTOR) {\n\t\t\tif (left < sizeof(uint32_t) * 2) {\n\t\t\t\tDPRINTF((\"missing CDF_VECTOR length\\n\"));\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tnelements = CDF_GETUINT32(q, 1);\n\t\t\tif (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {\n\t\t\t\tDPRINTF((\"CDF_VECTOR with nelements == %\"\n\t\t\t\t SIZE_T_FORMAT \"u\\n\", nelements));\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tslen = 2;\n\t\t} else {\n\t\t\tnelements = 1;\n\t\t\tslen = 1;\n\t\t}\n\t\to4 = slen * sizeof(uint32_t);\n\t\tif (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))\n\t\t\tgoto unknown;\n\t\tswitch (inp[i].pi_type & CDF_TYPEMASK) {\n\t\tcase CDF_NULL:\n\t\tcase CDF_EMPTY:\n\t\t\tbreak;\n\t\tcase CDF_SIGNED16:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int16_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_SIGNED32:\n\t\tcase CDF_BOOL:\n\t\tcase CDF_UNSIGNED32:\n\t\tcase CDF_FLOAT:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int32_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_SIGNED64:\n\t\tcase CDF_UNSIGNED64:\n\t\tcase CDF_DOUBLE:\n\t\tcase CDF_FILETIME:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int64_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_LENGTH32_STRING:\n\t\tcase CDF_LENGTH32_WSTRING:\n\t\t\tif (nelements > 1) {\n\t\t\t\tsize_t nelem = inp - *info;\n\t\t\t\tinp = cdf_grow_info(info, maxcount, nelements);\n\t\t\t\tif (inp == NULL)\n\t\t\t\t\tgoto out;\n\t\t\t\tinp += nelem;\n\t\t\t}\n\t\t\tfor (j = 0; j < nelements && i < sh.sh_properties;\n\t\t\t j++, i++)\n\t\t\t{\n\t\t\t\tuint32_t l;\n\n\t\t\t\tif (o4 + sizeof(uint32_t) > left)\n\t\t\t\t\tgoto out;\n\n\t\t\t\tl = CDF_GETUINT32(q, slen);\n\t\t\t\to4 += sizeof(uint32_t);\n\t\t\t\tif (o4 + l > left)\n\t\t\t\t\tgoto out;\n\n\t\t\t\tinp[i].pi_str.s_len = l;\n\t\t\t\tinp[i].pi_str.s_buf = CAST(const char *,\n\t\t\t\t CAST(const void *, &q[o4]));\n\n\t\t\t\tDPRINTF((\"o=%\" SIZE_T_FORMAT \"u l=%d(%\"\n\t\t\t\t SIZE_T_FORMAT \"u), t=%\" SIZE_T_FORMAT\n\t\t\t\t \"u s=%s\\n\", o4, l, CDF_ROUND(l, sizeof(l)),\n\t\t\t\t left, inp[i].pi_str.s_buf));\n\n\t\t\t\tif (l & 1)\n\t\t\t\t\tl++;\n\n\t\t\t\tslen += l >> 1;\n\t\t\t\to4 = slen * sizeof(uint32_t);\n\t\t\t}\n\t\t\ti--;\n\t\t\tbreak;\n\t\tcase CDF_CLIPBOARD:\n\t\t\tif (inp[i].pi_type & CDF_VECTOR)\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tdefault:\n\t\tunknown:\n\t\t\tmemset(&inp[i].pi_val, 0, sizeof(inp[i].pi_val));\n\t\t\tDPRINTF((\"Don't know how to deal with %#x\\n\",\n\t\t\t inp[i].pi_type));\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\nout:\n\tfree(*info);\n\t*info = NULL;\n\t*count = 0;\n\t*maxcount = 0;\n\terrno = EFTYPE;\n\treturn -1;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1399,"sven_meta":{"func_name":"cdf_read_property_info","file_name":"src/cdf.c","commit_link":"github.com/file/file/commit/46a8443f76cec4b41ec736eca396984c74664f84","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#3-17d8aa9f8685","input":"opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)\n{\n FILE *f = NULL;\n int w, h, prec;\n int i, numcomps, max;\n OPJ_COLOR_SPACE color_space;\n opj_image_cmptparm_t cmptparm; /* maximum of 1 component */\n opj_image_t * image = NULL;\n int adjustS, ushift, dshift, force8;\n\n char endian1, endian2, sign;\n char signtmp[32];\n\n char temp[32];\n int bigendian;\n opj_image_comp_t *comp = NULL;\n\n numcomps = 1;\n color_space = OPJ_CLRSPC_GRAY;\n\n memset(&cmptparm, 0, sizeof(opj_image_cmptparm_t));\n\n max = 0;\n\n f = fopen(filename, \"rb\");\n if (!f) {\n fprintf(stderr, \"Failed to open %s for reading !\\n\", filename);\n return NULL;\n }\n\n fseek(f, 0, SEEK_SET);\n if (fscanf(f, \"PG%[ \\t]%c%c%[ \\t+-]%d%[ \\t]%d%[ \\t]%d\", temp, &endian1,\n &endian2, signtmp, &prec, temp, &w, temp, &h) != 9) {\n fclose(f);\n fprintf(stderr,\n \"ERROR: Failed to read the right number of element from the fscanf() function!\\n\");\n return NULL;\n }\n\n i = 0;\n sign = '+';\n while (signtmp[i] != '\\0') {\n if (signtmp[i] == '-') {\n sign = '-';\n }\n i++;\n }\n\n fgetc(f);\n if (endian1 == 'M' && endian2 == 'L') {\n bigendian = 1;\n } else if (endian2 == 'M' && endian1 == 'L') {\n bigendian = 0;\n } else {\n fclose(f);\n fprintf(stderr, \"Bad pgx header, please check input file\\n\");\n return NULL;\n }\n\n /* initialize image component */\n\n cmptparm.x0 = (OPJ_UINT32)parameters->image_offset_x0;\n cmptparm.y0 = (OPJ_UINT32)parameters->image_offset_y0;\n cmptparm.w = !cmptparm.x0 ? (OPJ_UINT32)((w - 1) * parameters->subsampling_dx +\n 1) : cmptparm.x0 + (OPJ_UINT32)(w - 1) * (OPJ_UINT32)parameters->subsampling_dx\n + 1;\n cmptparm.h = !cmptparm.y0 ? (OPJ_UINT32)((h - 1) * parameters->subsampling_dy +\n 1) : cmptparm.y0 + (OPJ_UINT32)(h - 1) * (OPJ_UINT32)parameters->subsampling_dy\n + 1;\n\n if (sign == '-') {\n cmptparm.sgnd = 1;\n } else {\n cmptparm.sgnd = 0;\n }\n if (prec < 8) {\n force8 = 1;\n ushift = 8 - prec;\n dshift = prec - ushift;\n if (cmptparm.sgnd) {\n adjustS = (1 << (prec - 1));\n } else {\n adjustS = 0;\n }\n cmptparm.sgnd = 0;\n prec = 8;\n } else {\n ushift = dshift = force8 = adjustS = 0;\n }\n\n cmptparm.prec = (OPJ_UINT32)prec;\n cmptparm.bpp = (OPJ_UINT32)prec;\n cmptparm.dx = (OPJ_UINT32)parameters->subsampling_dx;\n cmptparm.dy = (OPJ_UINT32)parameters->subsampling_dy;\n\n /* create the image */\n image = opj_image_create((OPJ_UINT32)numcomps, &cmptparm, color_space);\n if (!image) {\n fclose(f);\n return NULL;\n }\n /* set image offset and reference grid */\n image->x0 = cmptparm.x0;\n image->y0 = cmptparm.x0;\n image->x1 = cmptparm.w;\n image->y1 = cmptparm.h;\n\n /* set image data */\n\n comp = &image->comps[0];\n\n for (i = 0; i < w * h; i++) {\n int v;\n if (force8) {\n v = readuchar(f) + adjustS;\n v = (v << ushift) + (v >> dshift);\n comp->data[i] = (unsigned char)v;\n\n if (v > max) {\n max = v;\n }\n\n continue;\n }\n if (comp->prec == 8) {\n if (!comp->sgnd) {\n v = readuchar(f);\n } else {\n v = (char) readuchar(f);\n }\n } else if (comp->prec <= 16) {\n if (!comp->sgnd) {\n v = readushort(f, bigendian);\n } else {\n v = (short) readushort(f, bigendian);\n }\n } else {\n if (!comp->sgnd) {\n v = (int)readuint(f, bigendian);\n } else {\n v = (int) readuint(f, bigendian);\n }\n }\n if (v > max) {\n max = v;\n }\n comp->data[i] = v;\n }\n fclose(f);\n comp->bpp = (OPJ_UINT32)int_floorlog2(max) + 1;\n\n return image;\n}","target":"opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)\n{\n FILE *f = NULL;\n int w, h, prec;\n int i, numcomps, max;\n OPJ_COLOR_SPACE color_space;\n opj_image_cmptparm_t cmptparm; /* maximum of 1 component */\n opj_image_t * image = NULL;\n int adjustS, ushift, dshift, force8;\n\n char endian1, endian2, sign;\n char signtmp[32];\n\n char temp[32];\n int bigendian;\n opj_image_comp_t *comp = NULL;\n\n numcomps = 1;\n color_space = OPJ_CLRSPC_GRAY;\n\n memset(&cmptparm, 0, sizeof(opj_image_cmptparm_t));\n\n max = 0;\n\n f = fopen(filename, \"rb\");\n if (!f) {\n fprintf(stderr, \"Failed to open %s for reading !\\n\", filename);\n return NULL;\n }\n\n fseek(f, 0, SEEK_SET);\n if (fscanf(f, \"PG%31[ \\t]%c%c%31[ \\t+-]%d%31[ \\t]%d%31[ \\t]%d\", temp, &endian1,\n &endian2, signtmp, &prec, temp, &w, temp, &h) != 9) {\n fclose(f);\n fprintf(stderr,\n \"ERROR: Failed to read the right number of element from the fscanf() function!\\n\");\n return NULL;\n }\n\n i = 0;\n sign = '+';\n while (signtmp[i] != '\\0') {\n if (signtmp[i] == '-') {\n sign = '-';\n }\n i++;\n }\n\n fgetc(f);\n if (endian1 == 'M' && endian2 == 'L') {\n bigendian = 1;\n } else if (endian2 == 'M' && endian1 == 'L') {\n bigendian = 0;\n } else {\n fclose(f);\n fprintf(stderr, \"Bad pgx header, please check input file\\n\");\n return NULL;\n }\n\n /* initialize image component */\n\n cmptparm.x0 = (OPJ_UINT32)parameters->image_offset_x0;\n cmptparm.y0 = (OPJ_UINT32)parameters->image_offset_y0;\n cmptparm.w = !cmptparm.x0 ? (OPJ_UINT32)((w - 1) * parameters->subsampling_dx +\n 1) : cmptparm.x0 + (OPJ_UINT32)(w - 1) * (OPJ_UINT32)parameters->subsampling_dx\n + 1;\n cmptparm.h = !cmptparm.y0 ? (OPJ_UINT32)((h - 1) * parameters->subsampling_dy +\n 1) : cmptparm.y0 + (OPJ_UINT32)(h - 1) * (OPJ_UINT32)parameters->subsampling_dy\n + 1;\n\n if (sign == '-') {\n cmptparm.sgnd = 1;\n } else {\n cmptparm.sgnd = 0;\n }\n if (prec < 8) {\n force8 = 1;\n ushift = 8 - prec;\n dshift = prec - ushift;\n if (cmptparm.sgnd) {\n adjustS = (1 << (prec - 1));\n } else {\n adjustS = 0;\n }\n cmptparm.sgnd = 0;\n prec = 8;\n } else {\n ushift = dshift = force8 = adjustS = 0;\n }\n\n cmptparm.prec = (OPJ_UINT32)prec;\n cmptparm.bpp = (OPJ_UINT32)prec;\n cmptparm.dx = (OPJ_UINT32)parameters->subsampling_dx;\n cmptparm.dy = (OPJ_UINT32)parameters->subsampling_dy;\n\n /* create the image */\n image = opj_image_create((OPJ_UINT32)numcomps, &cmptparm, color_space);\n if (!image) {\n fclose(f);\n return NULL;\n }\n /* set image offset and reference grid */\n image->x0 = cmptparm.x0;\n image->y0 = cmptparm.x0;\n image->x1 = cmptparm.w;\n image->y1 = cmptparm.h;\n\n /* set image data */\n\n comp = &image->comps[0];\n\n for (i = 0; i < w * h; i++) {\n int v;\n if (force8) {\n v = readuchar(f) + adjustS;\n v = (v << ushift) + (v >> dshift);\n comp->data[i] = (unsigned char)v;\n\n if (v > max) {\n max = v;\n }\n\n continue;\n }\n if (comp->prec == 8) {\n if (!comp->sgnd) {\n v = readuchar(f);\n } else {\n v = (char) readuchar(f);\n }\n } else if (comp->prec <= 16) {\n if (!comp->sgnd) {\n v = readushort(f, bigendian);\n } else {\n v = (short) readushort(f, bigendian);\n }\n } else {\n if (!comp->sgnd) {\n v = (int)readuint(f, bigendian);\n } else {\n v = (int) readuint(f, bigendian);\n }\n }\n if (v > max) {\n max = v;\n }\n comp->data[i] = v;\n }\n fclose(f);\n comp->bpp = (OPJ_UINT32)int_floorlog2(max) + 1;\n\n return image;\n}","lang":"c","vul_type":"cwe-787","target_token_count":1302,"sven_meta":{"func_name":"pgxtoimage","file_name":"src/bin/jp2/convert.c","commit_link":"github.com/uclouvain/openjpeg/commit/e5285319229a5d77bf316bb0d3a6cbd3cb8666d9","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#4-6c549ab1f669","input":"STATIC SSize_t\nS_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,\n SSize_t *minlenp, SSize_t *deltap,\n\t\t\tregnode *last,\n\t\t\tscan_data_t *data,\n\t\t\tI32 stopparen,\n U32 recursed_depth,\n\t\t\tregnode_ssc *and_withp,\n\t\t\tU32 flags, U32 depth)\n\t\t\t/* scanp: Start here (read-write). */\n\t\t\t/* deltap: Write maxlen-minlen here. */\n\t\t\t/* last: Stop before this one. */\n\t\t\t/* data: string data about the pattern */\n\t\t\t/* stopparen: treat close N as END */\n\t\t\t/* recursed: which subroutines have we recursed into */\n\t\t\t/* and_withp: Valid if flags & SCF_DO_STCLASS_OR */\n{\n dVAR;\n /* There must be at least this number of characters to match */\n SSize_t min = 0;\n I32 pars = 0, code;\n regnode *scan = *scanp, *next;\n SSize_t delta = 0;\n int is_inf = (flags & SCF_DO_SUBSTR) && (data->flags & SF_IS_INF);\n int is_inf_internal = 0;\t\t/* The studied chunk is infinite */\n I32 is_par = OP(scan) == OPEN ? ARG(scan) : 0;\n scan_data_t data_fake;\n SV *re_trie_maxbuff = NULL;\n regnode *first_non_open = scan;\n SSize_t stopmin = SSize_t_MAX;\n scan_frame *frame = NULL;\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_STUDY_CHUNK;\n RExC_study_started= 1;\n\n Zero(&data_fake, 1, scan_data_t);\n\n if ( depth == 0 ) {\n while (first_non_open && OP(first_non_open) == OPEN)\n first_non_open=regnext(first_non_open);\n }\n\n\n fake_study_recurse:\n DEBUG_r(\n RExC_study_chunk_recursed_count++;\n );\n DEBUG_OPTIMISE_MORE_r(\n {\n Perl_re_indentf( aTHX_ \"study_chunk stopparen=%ld recursed_count=%lu depth=%lu recursed_depth=%lu scan=%p last=%p\",\n depth, (long)stopparen,\n (unsigned long)RExC_study_chunk_recursed_count,\n (unsigned long)depth, (unsigned long)recursed_depth,\n scan,\n last);\n if (recursed_depth) {\n U32 i;\n U32 j;\n for ( j = 0 ; j < recursed_depth ; j++ ) {\n for ( i = 0 ; i < (U32)RExC_total_parens ; i++ ) {\n if (\n PAREN_TEST(RExC_study_chunk_recursed +\n ( j * RExC_study_chunk_recursed_bytes), i )\n && (\n !j ||\n !PAREN_TEST(RExC_study_chunk_recursed +\n (( j - 1 ) * RExC_study_chunk_recursed_bytes), i)\n )\n ) {\n Perl_re_printf( aTHX_ \" %d\",(int)i);\n break;\n }\n }\n if ( j + 1 < recursed_depth ) {\n Perl_re_printf( aTHX_ \",\");\n }\n }\n }\n Perl_re_printf( aTHX_ \"\\n\");\n }\n );\n while ( scan && OP(scan) != END && scan < last ){\n UV min_subtract = 0; /* How mmany chars to subtract from the minimum\n node length to get a real minimum (because\n the folded version may be shorter) */\n\tbool unfolded_multi_char = FALSE;\n\t/* Peephole optimizer: */\n DEBUG_STUDYDATA(\"Peep\", data, depth, is_inf);\n DEBUG_PEEP(\"Peep\", scan, depth, flags);\n\n\n /* The reason we do this here is that we need to deal with things like\n * /(?:f)(?:o)(?:o)/ which cant be dealt with by the normal EXACT\n * parsing code, as each (?:..) is handled by a different invocation of\n * reg() -- Yves\n */\n JOIN_EXACT(scan,&min_subtract, &unfolded_multi_char, 0);\n\n\t/* Follow the next-chain of the current node and optimize\n\t away all the NOTHINGs from it. */\n\tif (OP(scan) != CURLYX) {\n\t const int max = (reg_off_by_arg[OP(scan)]\n\t\t ? I32_MAX\n\t\t /* I32 may be smaller than U16 on CRAYs! */\n\t\t : (I32_MAX < U16_MAX ? I32_MAX : U16_MAX));\n\t int off = (reg_off_by_arg[OP(scan)] ? ARG(scan) : NEXT_OFF(scan));\n\t int noff;\n\t regnode *n = scan;\n\n\t /* Skip NOTHING and LONGJMP. */\n\t while ((n = regnext(n))\n\t\t && ((PL_regkind[OP(n)] == NOTHING && (noff = NEXT_OFF(n)))\n\t\t || ((OP(n) == LONGJMP) && (noff = ARG(n))))\n\t\t && off + noff < max)\n\t\toff += noff;\n\t if (reg_off_by_arg[OP(scan)])\n\t\tARG(scan) = off;\n\t else\n\t\tNEXT_OFF(scan) = off;\n\t}\n\n\t/* The principal pseudo-switch. Cannot be a switch, since we\n\t look into several different things. */\n if ( OP(scan) == DEFINEP ) {\n SSize_t minlen = 0;\n SSize_t deltanext = 0;\n SSize_t fake_last_close = 0;\n I32 f = SCF_IN_DEFINE;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n scan = regnext(scan);\n assert( OP(scan) == IFTHEN );\n DEBUG_PEEP(\"expect IFTHEN\", scan, depth, flags);\n\n data_fake.last_closep= &fake_last_close;\n minlen = *minlenp;\n next = regnext(scan);\n scan = NEXTOPER(NEXTOPER(scan));\n DEBUG_PEEP(\"scan\", scan, depth, flags);\n DEBUG_PEEP(\"next\", next, depth, flags);\n\n /* we suppose the run is continuous, last=next...\n * NOTE we dont use the return here! */\n /* DEFINEP study_chunk() recursion */\n (void)study_chunk(pRExC_state, &scan, &minlen,\n &deltanext, next, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n\n scan = next;\n } else\n if (\n OP(scan) == BRANCH ||\n OP(scan) == BRANCHJ ||\n OP(scan) == IFTHEN\n ) {\n\t next = regnext(scan);\n\t code = OP(scan);\n\n /* The op(next)==code check below is to see if we\n * have \"BRANCH-BRANCH\", \"BRANCHJ-BRANCHJ\", \"IFTHEN-IFTHEN\"\n * IFTHEN is special as it might not appear in pairs.\n * Not sure whether BRANCH-BRANCHJ is possible, regardless\n * we dont handle it cleanly. */\n\t if (OP(next) == code || code == IFTHEN) {\n /* NOTE - There is similar code to this block below for\n * handling TRIE nodes on a re-study. If you change stuff here\n * check there too. */\n\t\tSSize_t max1 = 0, min1 = SSize_t_MAX, num = 0;\n\t\tregnode_ssc accum;\n\t\tregnode * const startbranch=scan;\n\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot merge strings after this. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n }\n\n if (flags & SCF_DO_STCLASS)\n\t\t ssc_init_zero(pRExC_state, &accum);\n\n\t\twhile (OP(scan) == code) {\n\t\t SSize_t deltanext, minnext, fake;\n\t\t I32 f = 0;\n\t\t regnode_ssc this_class;\n\n DEBUG_PEEP(\"Branch\", scan, depth, flags);\n\n\t\t num++;\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n\t\t if (data) {\n\t\t\tdata_fake.whilem_c = data->whilem_c;\n\t\t\tdata_fake.last_closep = data->last_closep;\n\t\t }\n\t\t else\n\t\t\tdata_fake.last_closep = &fake;\n\n\t\t data_fake.pos_delta = delta;\n\t\t next = regnext(scan);\n\n scan = NEXTOPER(scan); /* everything */\n if (code != BRANCH) /* everything but BRANCH */\n\t\t\tscan = NEXTOPER(scan);\n\n\t\t if (flags & SCF_DO_STCLASS) {\n\t\t\tssc_init(pRExC_state, &this_class);\n\t\t\tdata_fake.start_class = &this_class;\n\t\t\tf = SCF_DO_STCLASS_AND;\n\t\t }\n\t\t if (flags & SCF_WHILEM_VISITED_POS)\n\t\t\tf |= SCF_WHILEM_VISITED_POS;\n\n\t\t /* we suppose the run is continuous, last=next...*/\n /* recurse study_chunk() for each BRANCH in an alternation */\n\t\t minnext = study_chunk(pRExC_state, &scan, minlenp,\n &deltanext, next, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n\n\t\t if (min1 > minnext)\n\t\t\tmin1 = minnext;\n\t\t if (deltanext == SSize_t_MAX) {\n\t\t\tis_inf = is_inf_internal = 1;\n\t\t\tmax1 = SSize_t_MAX;\n\t\t } else if (max1 < minnext + deltanext)\n\t\t\tmax1 = minnext + deltanext;\n\t\t scan = next;\n\t\t if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n\t\t\tpars++;\n\t if (data_fake.flags & SCF_SEEN_ACCEPT) {\n\t if ( stopmin > minnext)\n\t stopmin = min + min1;\n\t flags &= ~SCF_DO_SUBSTR;\n\t if (data)\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t }\n\t\t if (data) {\n\t\t\tif (data_fake.flags & SF_HAS_EVAL)\n\t\t\t data->flags |= SF_HAS_EVAL;\n\t\t\tdata->whilem_c = data_fake.whilem_c;\n\t\t }\n\t\t if (flags & SCF_DO_STCLASS)\n\t\t\tssc_or(pRExC_state, &accum, (regnode_charclass*)&this_class);\n\t\t}\n\t\tif (code == IFTHEN && num < 2) /* Empty ELSE branch */\n\t\t min1 = 0;\n\t\tif (flags & SCF_DO_SUBSTR) {\n\t\t data->pos_min += min1;\n\t\t if (data->pos_delta >= SSize_t_MAX - (max1 - min1))\n\t\t data->pos_delta = SSize_t_MAX;\n\t\t else\n\t\t data->pos_delta += max1 - min1;\n\t\t if (max1 != min1 || is_inf)\n\t\t\tdata->cur_is_floating = 1;\n\t\t}\n\t\tmin += min1;\n\t\tif (delta == SSize_t_MAX\n\t\t || SSize_t_MAX - delta - (max1 - min1) < 0)\n\t\t delta = SSize_t_MAX;\n\t\telse\n\t\t delta += max1 - min1;\n\t\tif (flags & SCF_DO_STCLASS_OR) {\n\t\t ssc_or(pRExC_state, data->start_class, (regnode_charclass*) &accum);\n\t\t if (min1) {\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\t\tflags &= ~SCF_DO_STCLASS;\n\t\t }\n\t\t}\n\t\telse if (flags & SCF_DO_STCLASS_AND) {\n\t\t if (min1) {\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n\t\t\tflags &= ~SCF_DO_STCLASS;\n\t\t }\n\t\t else {\n\t\t\t/* Switch to OR mode: cache the old value of\n\t\t\t * data->start_class */\n\t\t\tINIT_AND_WITHP;\n\t\t\tStructCopy(data->start_class, and_withp, regnode_ssc);\n\t\t\tflags &= ~SCF_DO_STCLASS_AND;\n\t\t\tStructCopy(&accum, data->start_class, regnode_ssc);\n\t\t\tflags |= SCF_DO_STCLASS_OR;\n\t\t }\n\t\t}\n\n if (PERL_ENABLE_TRIE_OPTIMISATION &&\n OP( startbranch ) == BRANCH )\n {\n\t\t/* demq.\n\n Assuming this was/is a branch we are dealing with: 'scan'\n now points at the item that follows the branch sequence,\n whatever it is. We now start at the beginning of the\n sequence and look for subsequences of\n\n\t\t BRANCH->EXACT=>x1\n\t\t BRANCH->EXACT=>x2\n\t\t tail\n\n which would be constructed from a pattern like\n /A|LIST|OF|WORDS/\n\n\t\t If we can find such a subsequence we need to turn the first\n\t\t element into a trie and then add the subsequent branch exact\n\t\t strings to the trie.\n\n\t\t We have two cases\n\n 1. patterns where the whole set of branches can be\n converted.\n\n\t\t 2. patterns where only a subset can be converted.\n\n\t\t In case 1 we can replace the whole set with a single regop\n\t\t for the trie. In case 2 we need to keep the start and end\n\t\t branches so\n\n\t\t 'BRANCH EXACT; BRANCH EXACT; BRANCH X'\n\t\t becomes BRANCH TRIE; BRANCH X;\n\n\t\t There is an additional case, that being where there is a\n\t\t common prefix, which gets split out into an EXACT like node\n\t\t preceding the TRIE node.\n\n\t\t If x(1..n)==tail then we can do a simple trie, if not we make\n\t\t a \"jump\" trie, such that when we match the appropriate word\n\t\t we \"jump\" to the appropriate tail node. Essentially we turn\n\t\t a nested if into a case structure of sorts.\n\n\t\t*/\n\n\t\t int made=0;\n\t\t if (!re_trie_maxbuff) {\n\t\t\tre_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1);\n\t\t\tif (!SvIOK(re_trie_maxbuff))\n\t\t\t sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT);\n\t\t }\n if ( SvIV(re_trie_maxbuff)>=0 ) {\n regnode *cur;\n regnode *first = (regnode *)NULL;\n regnode *last = (regnode *)NULL;\n regnode *tail = scan;\n U8 trietype = 0;\n U32 count=0;\n\n /* var tail is used because there may be a TAIL\n regop in the way. Ie, the exacts will point to the\n thing following the TAIL, but the last branch will\n point at the TAIL. So we advance tail. If we\n have nested (?:) we may have to move through several\n tails.\n */\n\n while ( OP( tail ) == TAIL ) {\n /* this is the TAIL generated by (?:) */\n tail = regnext( tail );\n }\n\n\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, tail, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"%s %\" UVuf \":%s\\n\",\n depth+1,\n \"Looking for TRIE'able sequences. Tail node is \",\n (UV) REGNODE_OFFSET(tail),\n SvPV_nolen_const( RExC_mysv )\n );\n });\n\n /*\n\n Step through the branches\n cur represents each branch,\n noper is the first thing to be matched as part\n of that branch\n noper_next is the regnext() of that node.\n\n We normally handle a case like this\n /FOO[xyz]|BAR[pqr]/ via a \"jump trie\" but we also\n support building with NOJUMPTRIE, which restricts\n the trie logic to structures like /FOO|BAR/.\n\n If noper is a trieable nodetype then the branch is\n a possible optimization target. If we are building\n under NOJUMPTRIE then we require that noper_next is\n the same as scan (our current position in the regex\n program).\n\n Once we have two or more consecutive such branches\n we can create a trie of the EXACT's contents and\n stitch it in place into the program.\n\n If the sequence represents all of the branches in\n the alternation we replace the entire thing with a\n single TRIE node.\n\n Otherwise when it is a subsequence we need to\n stitch it in place and replace only the relevant\n branches. This means the first branch has to remain\n as it is used by the alternation logic, and its\n next pointer, and needs to be repointed at the item\n on the branch chain following the last branch we\n have optimized away.\n\n This could be either a BRANCH, in which case the\n subsequence is internal, or it could be the item\n following the branch sequence in which case the\n subsequence is at the end (which does not\n necessarily mean the first node is the start of the\n alternation).\n\n TRIE_TYPE(X) is a define which maps the optype to a\n trietype.\n\n optype | trietype\n ----------------+-----------\n NOTHING | NOTHING\n EXACT | EXACT\n EXACT_ONLY8 | EXACT\n EXACTFU | EXACTFU\n EXACTFU_ONLY8 | EXACTFU\n EXACTFUP | EXACTFU\n EXACTFAA | EXACTFAA\n EXACTL | EXACTL\n EXACTFLU8 | EXACTFLU8\n\n\n */\n#define TRIE_TYPE(X) ( ( NOTHING == (X) ) \\\n ? NOTHING \\\n : ( EXACT == (X) || EXACT_ONLY8 == (X) ) \\\n ? EXACT \\\n : ( EXACTFU == (X) \\\n || EXACTFU_ONLY8 == (X) \\\n || EXACTFUP == (X) ) \\\n ? EXACTFU \\\n : ( EXACTFAA == (X) ) \\\n ? EXACTFAA \\\n : ( EXACTL == (X) ) \\\n ? EXACTL \\\n : ( EXACTFLU8 == (X) ) \\\n ? EXACTFLU8 \\\n : 0 )\n\n /* dont use tail as the end marker for this traverse */\n for ( cur = startbranch ; cur != scan ; cur = regnext( cur ) ) {\n regnode * const noper = NEXTOPER( cur );\n U8 noper_type = OP( noper );\n U8 noper_trietype = TRIE_TYPE( noper_type );\n#if defined(DEBUGGING) || defined(NOJUMPTRIE)\n regnode * const noper_next = regnext( noper );\n U8 noper_next_type = (noper_next && noper_next < tail) ? OP(noper_next) : 0;\n U8 noper_next_trietype = (noper_next && noper_next < tail) ? TRIE_TYPE( noper_next_type ) :0;\n#endif\n\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %d:%s (%d)\",\n depth+1,\n REG_NODE_NUM(cur), SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur) );\n\n regprop(RExC_rx, RExC_mysv, noper, NULL, pRExC_state);\n Perl_re_printf( aTHX_ \" -> %d:%s\",\n REG_NODE_NUM(noper), SvPV_nolen_const(RExC_mysv));\n\n if ( noper_next ) {\n regprop(RExC_rx, RExC_mysv, noper_next, NULL, pRExC_state);\n Perl_re_printf( aTHX_ \"\\t=> %d:%s\\t\",\n REG_NODE_NUM(noper_next), SvPV_nolen_const(RExC_mysv));\n }\n Perl_re_printf( aTHX_ \"(First==%d,Last==%d,Cur==%d,tt==%s,ntt==%s,nntt==%s)\\n\",\n REG_NODE_NUM(first), REG_NODE_NUM(last), REG_NODE_NUM(cur),\n\t\t\t\t PL_reg_name[trietype], PL_reg_name[noper_trietype], PL_reg_name[noper_next_trietype]\n\t\t\t\t);\n });\n\n /* Is noper a trieable nodetype that can be merged\n * with the current trie (if there is one)? */\n if ( noper_trietype\n &&\n (\n ( noper_trietype == NOTHING )\n || ( trietype == NOTHING )\n || ( trietype == noper_trietype )\n )\n#ifdef NOJUMPTRIE\n && noper_next >= tail\n#endif\n && count < U16_MAX)\n {\n /* Handle mergable triable node Either we are\n * the first node in a new trieable sequence,\n * in which case we do some bookkeeping,\n * otherwise we update the end pointer. */\n if ( !first ) {\n first = cur;\n\t\t\t\t if ( noper_trietype == NOTHING ) {\n#if !defined(DEBUGGING) && !defined(NOJUMPTRIE)\n\t\t\t\t\tregnode * const noper_next = regnext( noper );\n U8 noper_next_type = (noper_next && noper_next < tail) ? OP(noper_next) : 0;\n\t\t\t\t\tU8 noper_next_trietype = noper_next_type ? TRIE_TYPE( noper_next_type ) :0;\n#endif\n\n if ( noper_next_trietype ) {\n\t\t\t\t\t trietype = noper_next_trietype;\n } else if (noper_next_type) {\n /* a NOTHING regop is 1 regop wide.\n * We need at least two for a trie\n * so we can't merge this in */\n first = NULL;\n }\n } else {\n trietype = noper_trietype;\n }\n } else {\n if ( trietype == NOTHING )\n trietype = noper_trietype;\n last = cur;\n }\n\t\t\t\tif (first)\n\t\t\t\t count++;\n } /* end handle mergable triable node */\n else {\n /* handle unmergable node -\n * noper may either be a triable node which can\n * not be tried together with the current trie,\n * or a non triable node */\n if ( last ) {\n /* If last is set and trietype is not\n * NOTHING then we have found at least two\n * triable branch sequences in a row of a\n * similar trietype so we can turn them\n * into a trie. If/when we allow NOTHING to\n * start a trie sequence this condition\n * will be required, and it isn't expensive\n * so we leave it in for now. */\n if ( trietype && trietype != NOTHING )\n make_trie( pRExC_state,\n startbranch, first, cur, tail,\n count, trietype, depth+1 );\n last = NULL; /* note: we clear/update\n first, trietype etc below,\n so we dont do it here */\n }\n if ( noper_trietype\n#ifdef NOJUMPTRIE\n && noper_next >= tail\n#endif\n ){\n /* noper is triable, so we can start a new\n * trie sequence */\n count = 1;\n first = cur;\n trietype = noper_trietype;\n } else if (first) {\n /* if we already saw a first but the\n * current node is not triable then we have\n * to reset the first information. */\n count = 0;\n first = NULL;\n trietype = 0;\n }\n } /* end handle unmergable node */\n } /* loop over branches */\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %s (%d) \",\n depth+1, SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur));\n Perl_re_printf( aTHX_ \"(First==%d, Last==%d, Cur==%d, tt==%s)\\n\",\n REG_NODE_NUM(first), REG_NODE_NUM(last), REG_NODE_NUM(cur),\n PL_reg_name[trietype]\n );\n\n });\n if ( last && trietype ) {\n if ( trietype != NOTHING ) {\n /* the last branch of the sequence was part of\n * a trie, so we have to construct it here\n * outside of the loop */\n made= make_trie( pRExC_state, startbranch,\n first, scan, tail, count,\n trietype, depth+1 );\n#ifdef TRIE_STUDY_OPT\n if ( ((made == MADE_EXACT_TRIE &&\n startbranch == first)\n || ( first_non_open == first )) &&\n depth==0 ) {\n flags |= SCF_TRIE_RESTUDY;\n if ( startbranch == first\n && scan >= tail )\n {\n RExC_seen &=~REG_TOP_LEVEL_BRANCHES_SEEN;\n }\n }\n#endif\n } else {\n /* at this point we know whatever we have is a\n * NOTHING sequence/branch AND if 'startbranch'\n * is 'first' then we can turn the whole thing\n * into a NOTHING\n */\n if ( startbranch == first ) {\n regnode *opt;\n /* the entire thing is a NOTHING sequence,\n * something like this: (?:|) So we can\n * turn it into a plain NOTHING op. */\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %s (%d) \\n\",\n depth+1,\n SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur));\n\n });\n OP(startbranch)= NOTHING;\n NEXT_OFF(startbranch)= tail - startbranch;\n for ( opt= startbranch + 1; opt < tail ; opt++ )\n OP(opt)= OPTIMIZED;\n }\n }\n } /* end if ( last) */\n } /* TRIE_MAXBUF is non zero */\n\n } /* do trie */\n\n\t }\n\t else if ( code == BRANCHJ ) { /* single branch is optimized. */\n\t\tscan = NEXTOPER(NEXTOPER(scan));\n\t } else\t\t\t/* single branch is optimized. */\n\t\tscan = NEXTOPER(scan);\n\t continue;\n } else if (OP(scan) == SUSPEND || OP(scan) == GOSUB) {\n I32 paren = 0;\n regnode *start = NULL;\n regnode *end = NULL;\n U32 my_recursed_depth= recursed_depth;\n\n if (OP(scan) != SUSPEND) { /* GOSUB */\n /* Do setup, note this code has side effects beyond\n * the rest of this block. Specifically setting\n * RExC_recurse[] must happen at least once during\n * study_chunk(). */\n paren = ARG(scan);\n RExC_recurse[ARG2L(scan)] = scan;\n start = REGNODE_p(RExC_open_parens[paren]);\n end = REGNODE_p(RExC_close_parens[paren]);\n\n /* NOTE we MUST always execute the above code, even\n * if we do nothing with a GOSUB */\n if (\n ( flags & SCF_IN_DEFINE )\n ||\n (\n (is_inf_internal || is_inf || (data && data->flags & SF_IS_INF))\n &&\n ( (flags & (SCF_DO_STCLASS | SCF_DO_SUBSTR)) == 0 )\n )\n ) {\n /* no need to do anything here if we are in a define. */\n /* or we are after some kind of infinite construct\n * so we can skip recursing into this item.\n * Since it is infinite we will not change the maxlen\n * or delta, and if we miss something that might raise\n * the minlen it will merely pessimise a little.\n *\n * Iow /(?(DEFINE)(?foo|food))a+(?&foo)/\n * might result in a minlen of 1 and not of 4,\n * but this doesn't make us mismatch, just try a bit\n * harder than we should.\n * */\n scan= regnext(scan);\n continue;\n }\n\n if (\n !recursed_depth\n ||\n !PAREN_TEST(RExC_study_chunk_recursed + ((recursed_depth-1) * RExC_study_chunk_recursed_bytes), paren)\n ) {\n /* it is quite possible that there are more efficient ways\n * to do this. We maintain a bitmap per level of recursion\n * of which patterns we have entered so we can detect if a\n * pattern creates a possible infinite loop. When we\n * recurse down a level we copy the previous levels bitmap\n * down. When we are at recursion level 0 we zero the top\n * level bitmap. It would be nice to implement a different\n * more efficient way of doing this. In particular the top\n * level bitmap may be unnecessary.\n */\n if (!recursed_depth) {\n Zero(RExC_study_chunk_recursed, RExC_study_chunk_recursed_bytes, U8);\n } else {\n Copy(RExC_study_chunk_recursed + ((recursed_depth-1) * RExC_study_chunk_recursed_bytes),\n RExC_study_chunk_recursed + (recursed_depth * RExC_study_chunk_recursed_bytes),\n RExC_study_chunk_recursed_bytes, U8);\n }\n /* we havent recursed into this paren yet, so recurse into it */\n DEBUG_STUDYDATA(\"gosub-set\", data, depth, is_inf);\n PAREN_SET(RExC_study_chunk_recursed + (recursed_depth * RExC_study_chunk_recursed_bytes), paren);\n my_recursed_depth= recursed_depth + 1;\n } else {\n DEBUG_STUDYDATA(\"gosub-inf\", data, depth, is_inf);\n /* some form of infinite recursion, assume infinite length\n * */\n if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n data->cur_is_floating = 1;\n }\n is_inf = is_inf_internal = 1;\n if (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n ssc_anything(data->start_class);\n flags &= ~SCF_DO_STCLASS;\n\n start= NULL; /* reset start so we dont recurse later on. */\n\t }\n } else {\n\t paren = stopparen;\n start = scan + 2;\n\t end = regnext(scan);\n\t }\n if (start) {\n scan_frame *newframe;\n assert(end);\n if (!RExC_frame_last) {\n Newxz(newframe, 1, scan_frame);\n SAVEDESTRUCTOR_X(S_unwind_scan_frames, newframe);\n RExC_frame_head= newframe;\n RExC_frame_count++;\n } else if (!RExC_frame_last->next_frame) {\n Newxz(newframe, 1, scan_frame);\n RExC_frame_last->next_frame= newframe;\n newframe->prev_frame= RExC_frame_last;\n RExC_frame_count++;\n } else {\n newframe= RExC_frame_last->next_frame;\n }\n RExC_frame_last= newframe;\n\n newframe->next_regnode = regnext(scan);\n newframe->last_regnode = last;\n newframe->stopparen = stopparen;\n newframe->prev_recursed_depth = recursed_depth;\n newframe->this_prev_frame= frame;\n\n DEBUG_STUDYDATA(\"frame-new\", data, depth, is_inf);\n DEBUG_PEEP(\"fnew\", scan, depth, flags);\n\n\t frame = newframe;\n\t scan = start;\n\t stopparen = paren;\n\t last = end;\n depth = depth + 1;\n recursed_depth= my_recursed_depth;\n\n\t continue;\n\t }\n\t}\n\telse if ( OP(scan) == EXACT\n || OP(scan) == EXACT_ONLY8\n || OP(scan) == EXACTL)\n {\n\t SSize_t l = STR_LEN(scan);\n\t UV uc;\n assert(l);\n\t if (UTF) {\n\t\tconst U8 * const s = (U8*)STRING(scan);\n\t\tuc = utf8_to_uvchr_buf(s, s + l, NULL);\n\t\tl = utf8_length(s, s + l);\n\t } else {\n\t\tuc = *((U8*)STRING(scan));\n\t }\n\t min += l;\n\t if (flags & SCF_DO_SUBSTR) { /* Update longest substr. */\n\t\t/* The code below prefers earlier match for fixed\n\t\t offset, later match for variable offset. */\n\t\tif (data->last_end == -1) { /* Update the start info. */\n\t\t data->last_start_min = data->pos_min;\n \t\t data->last_start_max = is_inf\n \t\t\t? SSize_t_MAX : data->pos_min + data->pos_delta;\n\t\t}\n\t\tsv_catpvn(data->last_found, STRING(scan), STR_LEN(scan));\n\t\tif (UTF)\n\t\t SvUTF8_on(data->last_found);\n\t\t{\n\t\t SV * const sv = data->last_found;\n\t\t MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\t\t if (mg && mg->mg_len >= 0)\n\t\t\tmg->mg_len += utf8_length((U8*)STRING(scan),\n (U8*)STRING(scan)+STR_LEN(scan));\n\t\t}\n\t\tdata->last_end = data->pos_min + l;\n\t\tdata->pos_min += l; /* As in the first entry. */\n\t\tdata->flags &= ~SF_BEFORE_EOL;\n\t }\n\n /* ANDing the code point leaves at most it, and not in locale, and\n * can't match null string */\n\t if (flags & SCF_DO_STCLASS_AND) {\n ssc_cp_and(data->start_class, uc);\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n ssc_clear_locale(data->start_class);\n\t }\n\t else if (flags & SCF_DO_STCLASS_OR) {\n ssc_add_cp(data->start_class, uc);\n\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n\t }\n\t flags &= ~SCF_DO_STCLASS;\n\t}\n else if (PL_regkind[OP(scan)] == EXACT) {\n /* But OP != EXACT!, so is EXACTFish */\n\t SSize_t l = STR_LEN(scan);\n const U8 * s = (U8*)STRING(scan);\n\n\t /* Search for fixed substrings supports EXACT only. */\n\t if (flags & SCF_DO_SUBSTR) {\n\t\tassert(data);\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t }\n\t if (UTF) {\n\t\tl = utf8_length(s, s + l);\n\t }\n\t if (unfolded_multi_char) {\n RExC_seen |= REG_UNFOLDED_MULTI_SEEN;\n\t }\n\t min += l - min_subtract;\n assert (min >= 0);\n delta += min_subtract;\n\t if (flags & SCF_DO_SUBSTR) {\n\t\tdata->pos_min += l - min_subtract;\n\t\tif (data->pos_min < 0) {\n data->pos_min = 0;\n }\n data->pos_delta += min_subtract;\n\t\tif (min_subtract) {\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t }\n\n if (flags & SCF_DO_STCLASS) {\n SV* EXACTF_invlist = _make_exactf_invlist(pRExC_state, scan);\n\n assert(EXACTF_invlist);\n if (flags & SCF_DO_STCLASS_AND) {\n if (OP(scan) != EXACTFL)\n ssc_clear_locale(data->start_class);\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n ANYOF_POSIXL_ZERO(data->start_class);\n ssc_intersection(data->start_class, EXACTF_invlist, FALSE);\n }\n else { /* SCF_DO_STCLASS_OR */\n ssc_union(data->start_class, EXACTF_invlist, FALSE);\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n }\n flags &= ~SCF_DO_STCLASS;\n SvREFCNT_dec(EXACTF_invlist);\n }\n\t}\n\telse if (REGNODE_VARIES(OP(scan))) {\n\t SSize_t mincount, maxcount, minnext, deltanext, pos_before = 0;\n\t I32 fl = 0, f = flags;\n\t regnode * const oscan = scan;\n\t regnode_ssc this_class;\n\t regnode_ssc *oclass = NULL;\n\t I32 next_is_eval = 0;\n\n\t switch (PL_regkind[OP(scan)]) {\n\t case WHILEM:\t\t/* End of (?:...)* . */\n\t\tscan = NEXTOPER(scan);\n\t\tgoto finish;\n\t case PLUS:\n\t\tif (flags & (SCF_DO_SUBSTR | SCF_DO_STCLASS)) {\n\t\t next = NEXTOPER(scan);\n\t\t if ( OP(next) == EXACT\n || OP(next) == EXACT_ONLY8\n || OP(next) == EXACTL\n || (flags & SCF_DO_STCLASS))\n {\n\t\t\tmincount = 1;\n\t\t\tmaxcount = REG_INFTY;\n\t\t\tnext = regnext(scan);\n\t\t\tscan = NEXTOPER(scan);\n\t\t\tgoto do_curly;\n\t\t }\n\t\t}\n\t\tif (flags & SCF_DO_SUBSTR)\n\t\t data->pos_min++;\n\t\tmin++;\n\t\t/* FALLTHROUGH */\n\t case STAR:\n next = NEXTOPER(scan);\n\n /* This temporary node can now be turned into EXACTFU, and\n * must, as regexec.c doesn't handle it */\n if (OP(next) == EXACTFU_S_EDGE) {\n OP(next) = EXACTFU;\n }\n\n if ( STR_LEN(next) == 1\n && isALPHA_A(* STRING(next))\n && ( OP(next) == EXACTFAA\n || ( OP(next) == EXACTFU\n && ! HAS_NONLATIN1_SIMPLE_FOLD_CLOSURE(* STRING(next)))))\n {\n /* These differ in just one bit */\n U8 mask = ~ ('A' ^ 'a');\n\n assert(isALPHA_A(* STRING(next)));\n\n /* Then replace it by an ANYOFM node, with\n * the mask set to the complement of the\n * bit that differs between upper and lower\n * case, and the lowest code point of the\n * pair (which the '&' forces) */\n OP(next) = ANYOFM;\n ARG_SET(next, *STRING(next) & mask);\n FLAGS(next) = mask;\n }\n\n\t\tif (flags & SCF_DO_STCLASS) {\n\t\t mincount = 0;\n\t\t maxcount = REG_INFTY;\n\t\t next = regnext(scan);\n\t\t scan = NEXTOPER(scan);\n\t\t goto do_curly;\n\t\t}\n\t\tif (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n /* Cannot extend fixed substrings */\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n is_inf = is_inf_internal = 1;\n scan = regnext(scan);\n\t\tgoto optimize_curly_tail;\n\t case CURLY:\n\t if (stopparen>0 && (OP(scan)==CURLYN || OP(scan)==CURLYM)\n\t && (scan->flags == stopparen))\n\t\t{\n\t\t mincount = 1;\n\t\t maxcount = 1;\n\t\t} else {\n\t\t mincount = ARG1(scan);\n\t\t maxcount = ARG2(scan);\n\t\t}\n\t\tnext = regnext(scan);\n\t\tif (OP(scan) == CURLYX) {\n\t\t I32 lp = (data ? *(data->last_closep) : 0);\n\t\t scan->flags = ((lp <= (I32)U8_MAX) ? (U8)lp : U8_MAX);\n\t\t}\n\t\tscan = NEXTOPER(scan) + EXTRA_STEP_2ARGS;\n\t\tnext_is_eval = (OP(scan) == EVAL);\n\t do_curly:\n\t\tif (flags & SCF_DO_SUBSTR) {\n if (mincount == 0)\n scan_commit(pRExC_state, data, minlenp, is_inf);\n /* Cannot extend fixed substrings */\n\t\t pos_before = data->pos_min;\n\t\t}\n\t\tif (data) {\n\t\t fl = data->flags;\n\t\t data->flags &= ~(SF_HAS_PAR|SF_IN_PAR|SF_HAS_EVAL);\n\t\t if (is_inf)\n\t\t\tdata->flags |= SF_IS_INF;\n\t\t}\n\t\tif (flags & SCF_DO_STCLASS) {\n\t\t ssc_init(pRExC_state, &this_class);\n\t\t oclass = data->start_class;\n\t\t data->start_class = &this_class;\n\t\t f |= SCF_DO_STCLASS_AND;\n\t\t f &= ~SCF_DO_STCLASS_OR;\n\t\t}\n\t /* Exclude from super-linear cache processing any {n,m}\n\t\t regops for which the combination of input pos and regex\n\t\t pos is not enough information to determine if a match\n\t\t will be possible.\n\n\t\t For example, in the regex /foo(bar\\s*){4,8}baz/ with the\n\t\t regex pos at the \\s*, the prospects for a match depend not\n\t\t only on the input position but also on how many (bar\\s*)\n\t\t repeats into the {4,8} we are. */\n if ((mincount > 1) || (maxcount > 1 && maxcount != REG_INFTY))\n\t\t f &= ~SCF_WHILEM_VISITED_POS;\n\n\t\t/* This will finish on WHILEM, setting scan, or on NULL: */\n /* recurse study_chunk() on loop bodies */\n\t\tminnext = study_chunk(pRExC_state, &scan, minlenp, &deltanext,\n last, data, stopparen, recursed_depth, NULL,\n (mincount == 0\n ? (f & ~SCF_DO_SUBSTR)\n : f)\n ,depth+1);\n\n\t\tif (flags & SCF_DO_STCLASS)\n\t\t data->start_class = oclass;\n\t\tif (mincount == 0 || minnext == 0) {\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\tssc_or(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t }\n\t\t else if (flags & SCF_DO_STCLASS_AND) {\n\t\t\t/* Switch to OR mode: cache the old value of\n\t\t\t * data->start_class */\n\t\t\tINIT_AND_WITHP;\n\t\t\tStructCopy(data->start_class, and_withp, regnode_ssc);\n\t\t\tflags &= ~SCF_DO_STCLASS_AND;\n\t\t\tStructCopy(&this_class, data->start_class, regnode_ssc);\n\t\t\tflags |= SCF_DO_STCLASS_OR;\n ANYOF_FLAGS(data->start_class)\n |= SSC_MATCHES_EMPTY_STRING;\n\t\t }\n\t\t} else {\t\t/* Non-zero len */\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\tssc_or(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\t }\n\t\t else if (flags & SCF_DO_STCLASS_AND)\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t flags &= ~SCF_DO_STCLASS;\n\t\t}\n\t\tif (!scan) \t\t/* It was not CURLYX, but CURLY. */\n\t\t scan = next;\n\t\tif (((flags & (SCF_TRIE_DOING_RESTUDY|SCF_DO_SUBSTR))==SCF_DO_SUBSTR)\n\t\t /* ? quantifier ok, except for (?{ ... }) */\n\t\t && (next_is_eval || !(mincount == 0 && maxcount == 1))\n\t\t && (minnext == 0) && (deltanext == 0)\n\t\t && data && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))\n && maxcount <= REG_INFTY/3) /* Complement check for big\n count */\n\t\t{\n\t\t _WARN_HELPER(RExC_precomp_end, packWARN(WARN_REGEXP),\n Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP),\n \"Quantifier unexpected on zero-length expression \"\n \"in regex m/%\" UTF8f \"/\",\n\t\t\t UTF8fARG(UTF, RExC_precomp_end - RExC_precomp,\n\t\t\t\t RExC_precomp)));\n }\n\n\t\tmin += minnext * mincount;\n\t\tis_inf_internal |= deltanext == SSize_t_MAX\n || (maxcount == REG_INFTY && minnext + deltanext > 0);\n\t\tis_inf |= is_inf_internal;\n if (is_inf) {\n\t\t delta = SSize_t_MAX;\n } else {\n\t\t delta += (minnext + deltanext) * maxcount\n - minnext * mincount;\n }\n\t\t/* Try powerful optimization CURLYX => CURLYN. */\n\t\tif ( OP(oscan) == CURLYX && data\n\t\t && data->flags & SF_IN_PAR\n\t\t && !(data->flags & SF_HAS_EVAL)\n\t\t && !deltanext && minnext == 1 ) {\n\t\t /* Try to optimize to CURLYN. */\n\t\t regnode *nxt = NEXTOPER(oscan) + EXTRA_STEP_2ARGS;\n\t\t regnode * const nxt1 = nxt;\n#ifdef DEBUGGING\n\t\t regnode *nxt2;\n#endif\n\n\t\t /* Skip open. */\n\t\t nxt = regnext(nxt);\n\t\t if (!REGNODE_SIMPLE(OP(nxt))\n\t\t\t&& !(PL_regkind[OP(nxt)] == EXACT\n\t\t\t && STR_LEN(nxt) == 1))\n\t\t\tgoto nogo;\n#ifdef DEBUGGING\n\t\t nxt2 = nxt;\n#endif\n\t\t nxt = regnext(nxt);\n\t\t if (OP(nxt) != CLOSE)\n\t\t\tgoto nogo;\n\t\t if (RExC_open_parens) {\n\n /*open->CURLYM*/\n RExC_open_parens[ARG(nxt1)] = REGNODE_OFFSET(oscan);\n\n /*close->while*/\n RExC_close_parens[ARG(nxt1)] = REGNODE_OFFSET(nxt) + 2;\n\t\t }\n\t\t /* Now we know that nxt2 is the only contents: */\n\t\t oscan->flags = (U8)ARG(nxt);\n\t\t OP(oscan) = CURLYN;\n\t\t OP(nxt1) = NOTHING;\t/* was OPEN. */\n\n#ifdef DEBUGGING\n\t\t OP(nxt1 + 1) = OPTIMIZED; /* was count. */\n\t\t NEXT_OFF(nxt1+ 1) = 0; /* just for consistency. */\n\t\t NEXT_OFF(nxt2) = 0;\t/* just for consistency with CURLY. */\n\t\t OP(nxt) = OPTIMIZED;\t/* was CLOSE. */\n\t\t OP(nxt + 1) = OPTIMIZED; /* was count. */\n\t\t NEXT_OFF(nxt+ 1) = 0; /* just for consistency. */\n#endif\n\t\t}\n\t nogo:\n\n\t\t/* Try optimization CURLYX => CURLYM. */\n\t\tif ( OP(oscan) == CURLYX && data\n\t\t && !(data->flags & SF_HAS_PAR)\n\t\t && !(data->flags & SF_HAS_EVAL)\n\t\t && !deltanext\t/* atom is fixed width */\n\t\t && minnext != 0\t/* CURLYM can't handle zero width */\n\n /* Nor characters whose fold at run-time may be\n * multi-character */\n && ! (RExC_seen & REG_UNFOLDED_MULTI_SEEN)\n\t\t) {\n\t\t /* XXXX How to optimize if data == 0? */\n\t\t /* Optimize to a simpler form. */\n\t\t regnode *nxt = NEXTOPER(oscan) + EXTRA_STEP_2ARGS; /* OPEN */\n\t\t regnode *nxt2;\n\n\t\t OP(oscan) = CURLYM;\n\t\t while ( (nxt2 = regnext(nxt)) /* skip over embedded stuff*/\n\t\t\t && (OP(nxt2) != WHILEM))\n\t\t\tnxt = nxt2;\n\t\t OP(nxt2) = SUCCEED; /* Whas WHILEM */\n\t\t /* Need to optimize away parenths. */\n\t\t if ((data->flags & SF_IN_PAR) && OP(nxt) == CLOSE) {\n\t\t\t/* Set the parenth number. */\n\t\t\tregnode *nxt1 = NEXTOPER(oscan) + EXTRA_STEP_2ARGS; /* OPEN*/\n\n\t\t\toscan->flags = (U8)ARG(nxt);\n\t\t\tif (RExC_open_parens) {\n /*open->CURLYM*/\n RExC_open_parens[ARG(nxt1)] = REGNODE_OFFSET(oscan);\n\n /*close->NOTHING*/\n RExC_close_parens[ARG(nxt1)] = REGNODE_OFFSET(nxt2)\n + 1;\n\t\t\t}\n\t\t\tOP(nxt1) = OPTIMIZED;\t/* was OPEN. */\n\t\t\tOP(nxt) = OPTIMIZED;\t/* was CLOSE. */\n\n#ifdef DEBUGGING\n\t\t\tOP(nxt1 + 1) = OPTIMIZED; /* was count. */\n\t\t\tOP(nxt + 1) = OPTIMIZED; /* was count. */\n\t\t\tNEXT_OFF(nxt1 + 1) = 0; /* just for consistency. */\n\t\t\tNEXT_OFF(nxt + 1) = 0; /* just for consistency. */\n#endif\n#if 0\n\t\t\twhile ( nxt1 && (OP(nxt1) != WHILEM)) {\n\t\t\t regnode *nnxt = regnext(nxt1);\n\t\t\t if (nnxt == nxt) {\n\t\t\t\tif (reg_off_by_arg[OP(nxt1)])\n\t\t\t\t ARG_SET(nxt1, nxt2 - nxt1);\n\t\t\t\telse if (nxt2 - nxt1 < U16_MAX)\n\t\t\t\t NEXT_OFF(nxt1) = nxt2 - nxt1;\n\t\t\t\telse\n\t\t\t\t OP(nxt) = NOTHING;\t/* Cannot beautify */\n\t\t\t }\n\t\t\t nxt1 = nnxt;\n\t\t\t}\n#endif\n\t\t\t/* Optimize again: */\n /* recurse study_chunk() on optimised CURLYX => CURLYM */\n\t\t\tstudy_chunk(pRExC_state, &nxt1, minlenp, &deltanext, nxt,\n NULL, stopparen, recursed_depth, NULL, 0,\n depth+1);\n\t\t }\n\t\t else\n\t\t\toscan->flags = 0;\n\t\t}\n\t\telse if ((OP(oscan) == CURLYX)\n\t\t\t && (flags & SCF_WHILEM_VISITED_POS)\n\t\t\t /* See the comment on a similar expression above.\n\t\t\t However, this time it's not a subexpression\n\t\t\t we care about, but the expression itself. */\n\t\t\t && (maxcount == REG_INFTY)\n\t\t\t && data) {\n\t\t /* This stays as CURLYX, we can put the count/of pair. */\n\t\t /* Find WHILEM (as in regexec.c) */\n\t\t regnode *nxt = oscan + NEXT_OFF(oscan);\n\n\t\t if (OP(PREVOPER(nxt)) == NOTHING) /* LONGJMP */\n\t\t\tnxt += ARG(nxt);\n nxt = PREVOPER(nxt);\n if (nxt->flags & 0xf) {\n /* we've already set whilem count on this node */\n } else if (++data->whilem_c < 16) {\n assert(data->whilem_c <= RExC_whilem_seen);\n nxt->flags = (U8)(data->whilem_c\n | (RExC_whilem_seen << 4)); /* On WHILEM */\n }\n\t\t}\n\t\tif (data && fl & (SF_HAS_PAR|SF_IN_PAR))\n\t\t pars++;\n\t\tif (flags & SCF_DO_SUBSTR) {\n\t\t SV *last_str = NULL;\n STRLEN last_chrs = 0;\n\t\t int counted = mincount != 0;\n\n if (data->last_end > 0 && mincount != 0) { /* Ends with a\n string. */\n\t\t\tSSize_t b = pos_before >= data->last_start_min\n\t\t\t ? pos_before : data->last_start_min;\n\t\t\tSTRLEN l;\n\t\t\tconst char * const s = SvPV_const(data->last_found, l);\n\t\t\tSSize_t old = b - data->last_start_min;\n assert(old >= 0);\n\n\t\t\tif (UTF)\n\t\t\t old = utf8_hop_forward((U8*)s, old,\n (U8 *) SvEND(data->last_found))\n - (U8*)s;\n\t\t\tl -= old;\n\t\t\t/* Get the added string: */\n\t\t\tlast_str = newSVpvn_utf8(s + old, l, UTF);\n last_chrs = UTF ? utf8_length((U8*)(s + old),\n (U8*)(s + old + l)) : l;\n\t\t\tif (deltanext == 0 && pos_before == b) {\n\t\t\t /* What was added is a constant string */\n\t\t\t if (mincount > 1) {\n\n\t\t\t\tSvGROW(last_str, (mincount * l) + 1);\n\t\t\t\trepeatcpy(SvPVX(last_str) + l,\n\t\t\t\t\t SvPVX_const(last_str), l,\n mincount - 1);\n\t\t\t\tSvCUR_set(last_str, SvCUR(last_str) * mincount);\n\t\t\t\t/* Add additional parts. */\n\t\t\t\tSvCUR_set(data->last_found,\n\t\t\t\t\t SvCUR(data->last_found) - l);\n\t\t\t\tsv_catsv(data->last_found, last_str);\n\t\t\t\t{\n\t\t\t\t SV * sv = data->last_found;\n\t\t\t\t MAGIC *mg =\n\t\t\t\t\tSvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\t\t\t\t if (mg && mg->mg_len >= 0)\n\t\t\t\t\tmg->mg_len += last_chrs * (mincount-1);\n\t\t\t\t}\n last_chrs *= mincount;\n\t\t\t\tdata->last_end += l * (mincount - 1);\n\t\t\t }\n\t\t\t} else {\n\t\t\t /* start offset must point into the last copy */\n\t\t\t data->last_start_min += minnext * (mincount - 1);\n\t\t\t data->last_start_max =\n is_inf\n ? SSize_t_MAX\n\t\t\t : data->last_start_max +\n (maxcount - 1) * (minnext + data->pos_delta);\n\t\t\t}\n\t\t }\n\t\t /* It is counted once already... */\n\t\t data->pos_min += minnext * (mincount - counted);\n#if 0\nPerl_re_printf( aTHX_ \"counted=%\" UVuf \" deltanext=%\" UVuf\n \" SSize_t_MAX=%\" UVuf \" minnext=%\" UVuf\n \" maxcount=%\" UVuf \" mincount=%\" UVuf \"\\n\",\n (UV)counted, (UV)deltanext, (UV)SSize_t_MAX, (UV)minnext, (UV)maxcount,\n (UV)mincount);\nif (deltanext != SSize_t_MAX)\nPerl_re_printf( aTHX_ \"LHS=%\" UVuf \" RHS=%\" UVuf \"\\n\",\n (UV)(-counted * deltanext + (minnext + deltanext) * maxcount\n - minnext * mincount), (UV)(SSize_t_MAX - data->pos_delta));\n#endif\n\t\t if (deltanext == SSize_t_MAX\n || -counted * deltanext + (minnext + deltanext) * maxcount - minnext * mincount >= SSize_t_MAX - data->pos_delta)\n\t\t data->pos_delta = SSize_t_MAX;\n\t\t else\n\t\t data->pos_delta += - counted * deltanext +\n\t\t\t(minnext + deltanext) * maxcount - minnext * mincount;\n\t\t if (mincount != maxcount) {\n\t\t\t /* Cannot extend fixed substrings found inside\n\t\t\t the group. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t\tif (mincount && last_str) {\n\t\t\t SV * const sv = data->last_found;\n\t\t\t MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\n\t\t\t if (mg)\n\t\t\t\tmg->mg_len = -1;\n\t\t\t sv_setsv(sv, last_str);\n\t\t\t data->last_end = data->pos_min;\n\t\t\t data->last_start_min = data->pos_min - last_chrs;\n\t\t\t data->last_start_max = is_inf\n\t\t\t\t? SSize_t_MAX\n\t\t\t\t: data->pos_min + data->pos_delta - last_chrs;\n\t\t\t}\n\t\t\tdata->cur_is_floating = 1; /* float */\n\t\t }\n\t\t SvREFCNT_dec(last_str);\n\t\t}\n\t\tif (data && (fl & SF_HAS_EVAL))\n\t\t data->flags |= SF_HAS_EVAL;\n\t optimize_curly_tail:\n\t\tif (OP(oscan) != CURLYX) {\n\t\t while (PL_regkind[OP(next = regnext(oscan))] == NOTHING\n\t\t\t && NEXT_OFF(next))\n\t\t\tNEXT_OFF(oscan) += NEXT_OFF(next);\n\t\t}\n\t\tcontinue;\n\n\t default:\n#ifdef DEBUGGING\n Perl_croak(aTHX_ \"panic: unexpected varying REx opcode %d\",\n OP(scan));\n#endif\n case REF:\n case CLUMP:\n\t\tif (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t\tis_inf = is_inf_internal = 1;\n\t\tif (flags & SCF_DO_STCLASS_OR) {\n if (OP(scan) == CLUMP) {\n /* Actually is any start char, but very few code points\n * aren't start characters */\n ssc_match_all_cp(data->start_class);\n }\n else {\n ssc_anything(data->start_class);\n }\n }\n\t\tflags &= ~SCF_DO_STCLASS;\n\t\tbreak;\n\t }\n\t}\n\telse if (OP(scan) == LNBREAK) {\n\t if (flags & SCF_DO_STCLASS) {\n \t if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class,\n PL_XPosix_ptrs[_CC_VERTSPACE], FALSE);\n ssc_clear_locale(data->start_class);\n ANYOF_FLAGS(data->start_class)\n &= ~SSC_MATCHES_EMPTY_STRING;\n }\n else if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class,\n PL_XPosix_ptrs[_CC_VERTSPACE],\n FALSE);\n\t\t ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg for\n * 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class)\n &= ~SSC_MATCHES_EMPTY_STRING;\n }\n\t\tflags &= ~SCF_DO_STCLASS;\n }\n\t min++;\n if (delta != SSize_t_MAX)\n delta++; /* Because of the 2 char string cr-lf */\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n \t data->pos_min += 1;\n if (data->pos_delta != SSize_t_MAX) {\n data->pos_delta += 1;\n }\n\t\tdata->cur_is_floating = 1; /* float */\n \t }\n\t}\n\telse if (REGNODE_SIMPLE(OP(scan))) {\n\n\t if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\tdata->pos_min++;\n\t }\n\t min++;\n\t if (flags & SCF_DO_STCLASS) {\n bool invert = 0;\n SV* my_invlist = NULL;\n U8 namedclass;\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n\n\t\t/* Some of the logic below assumes that switching\n\t\t locale on will only add false positives. */\n\t\tswitch (OP(scan)) {\n\n\t\tdefault:\n#ifdef DEBUGGING\n Perl_croak(aTHX_ \"panic: unexpected simple REx opcode %d\",\n OP(scan));\n#endif\n\t\tcase SANY:\n\t\t if (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n\t\t\tssc_match_all_cp(data->start_class);\n\t\t break;\n\n\t\tcase REG_ANY:\n {\n SV* REG_ANY_invlist = _new_invlist(2);\n REG_ANY_invlist = add_cp_to_invlist(REG_ANY_invlist,\n '\\n');\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class,\n REG_ANY_invlist,\n TRUE /* TRUE => invert, hence all but \\n\n */\n );\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class,\n REG_ANY_invlist,\n TRUE /* TRUE => invert */\n );\n ssc_clear_locale(data->start_class);\n }\n SvREFCNT_dec_NN(REG_ANY_invlist);\n\t\t }\n\t\t break;\n\n case ANYOFD:\n case ANYOFL:\n case ANYOFPOSIXL:\n case ANYOFH:\n case ANYOF:\n\t\t if (flags & SCF_DO_STCLASS_AND)\n\t\t\tssc_and(pRExC_state, data->start_class,\n (regnode_charclass *) scan);\n\t\t else\n\t\t\tssc_or(pRExC_state, data->start_class,\n (regnode_charclass *) scan);\n\t\t break;\n\n case NANYOFM:\n case ANYOFM:\n {\n SV* cp_list = get_ANYOFM_contents(scan);\n\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class, cp_list, invert);\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class, cp_list, invert);\n }\n\n SvREFCNT_dec_NN(cp_list);\n break;\n }\n\n\t\tcase NPOSIXL:\n invert = 1;\n /* FALLTHROUGH */\n\n\t\tcase POSIXL:\n namedclass = classnum_to_namedclass(FLAGS(scan)) + invert;\n if (flags & SCF_DO_STCLASS_AND) {\n bool was_there = cBOOL(\n ANYOF_POSIXL_TEST(data->start_class,\n namedclass));\n ANYOF_POSIXL_ZERO(data->start_class);\n if (was_there) { /* Do an AND */\n ANYOF_POSIXL_SET(data->start_class, namedclass);\n }\n /* No individual code points can now match */\n data->start_class->invlist\n = sv_2mortal(_new_invlist(0));\n }\n else {\n int complement = namedclass + ((invert) ? -1 : 1);\n\n assert(flags & SCF_DO_STCLASS_OR);\n\n /* If the complement of this class was already there,\n * the result is that they match all code points,\n * (\\d + \\D == everything). Remove the classes from\n * future consideration. Locale is not relevant in\n * this case */\n if (ANYOF_POSIXL_TEST(data->start_class, complement)) {\n ssc_match_all_cp(data->start_class);\n ANYOF_POSIXL_CLEAR(data->start_class, namedclass);\n ANYOF_POSIXL_CLEAR(data->start_class, complement);\n }\n else { /* The usual case; just add this class to the\n existing set */\n ANYOF_POSIXL_SET(data->start_class, namedclass);\n }\n }\n break;\n\n case NPOSIXA: /* For these, we always know the exact set of\n what's matched */\n invert = 1;\n /* FALLTHROUGH */\n\t\tcase POSIXA:\n my_invlist = invlist_clone(PL_Posix_ptrs[FLAGS(scan)], NULL);\n goto join_posix_and_ascii;\n\n\t\tcase NPOSIXD:\n\t\tcase NPOSIXU:\n invert = 1;\n /* FALLTHROUGH */\n\t\tcase POSIXD:\n\t\tcase POSIXU:\n my_invlist = invlist_clone(PL_XPosix_ptrs[FLAGS(scan)], NULL);\n\n /* NPOSIXD matches all upper Latin1 code points unless the\n * target string being matched is UTF-8, which is\n * unknowable until match time. Since we are going to\n * invert, we want to get rid of all of them so that the\n * inversion will match all */\n if (OP(scan) == NPOSIXD) {\n _invlist_subtract(my_invlist, PL_UpperLatin1,\n &my_invlist);\n }\n\n join_posix_and_ascii:\n\n if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class, my_invlist, invert);\n ssc_clear_locale(data->start_class);\n }\n else {\n assert(flags & SCF_DO_STCLASS_OR);\n ssc_union(data->start_class, my_invlist, invert);\n }\n SvREFCNT_dec(my_invlist);\n\t\t}\n\t\tif (flags & SCF_DO_STCLASS_OR)\n\t\t ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\tflags &= ~SCF_DO_STCLASS;\n\t }\n\t}\n\telse if (PL_regkind[OP(scan)] == EOL && flags & SCF_DO_SUBSTR) {\n\t data->flags |= (OP(scan) == MEOL\n\t\t\t ? SF_BEFORE_MEOL\n\t\t\t : SF_BEFORE_SEOL);\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\n\t}\n\telse if ( PL_regkind[OP(scan)] == BRANCHJ\n\t\t /* Lookbehind, or need to calculate parens/evals/stclass: */\n\t\t && (scan->flags || data || (flags & SCF_DO_STCLASS))\n\t\t && (OP(scan) == IFMATCH || OP(scan) == UNLESSM))\n {\n if ( !PERL_ENABLE_POSITIVE_ASSERTION_STUDY\n || OP(scan) == UNLESSM )\n {\n /* Negative Lookahead/lookbehind\n In this case we can't do fixed string optimisation.\n */\n\n SSize_t deltanext, minnext, fake = 0;\n regnode *nscan;\n regnode_ssc intrnl;\n int f = 0;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n if (data) {\n data_fake.whilem_c = data->whilem_c;\n data_fake.last_closep = data->last_closep;\n\t\t}\n else\n data_fake.last_closep = &fake;\n\t\tdata_fake.pos_delta = delta;\n if ( flags & SCF_DO_STCLASS && !scan->flags\n && OP(scan) == IFMATCH ) { /* Lookahead */\n ssc_init(pRExC_state, &intrnl);\n data_fake.start_class = &intrnl;\n f |= SCF_DO_STCLASS_AND;\n\t\t}\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n next = regnext(scan);\n nscan = NEXTOPER(NEXTOPER(scan));\n\n /* recurse study_chunk() for lookahead body */\n minnext = study_chunk(pRExC_state, &nscan, minlenp, &deltanext,\n last, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n if (scan->flags) {\n if ( deltanext < 0\n || deltanext > (I32) U8_MAX\n || minnext > (I32)U8_MAX\n || minnext + deltanext > (I32)U8_MAX)\n {\n\t\t\tFAIL2(\"Lookbehind longer than %\" UVuf \" not implemented\",\n (UV)U8_MAX);\n }\n\n /* The 'next_off' field has been repurposed to count the\n * additional starting positions to try beyond the initial\n * one. (This leaves it at 0 for non-variable length\n * matches to avoid breakage for those not using this\n * extension) */\n if (deltanext) {\n scan->next_off = deltanext;\n ckWARNexperimental(RExC_parse,\n WARN_EXPERIMENTAL__VLB,\n \"Variable length lookbehind is experimental\");\n }\n scan->flags = (U8)minnext + deltanext;\n }\n if (data) {\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n }\n if (f & SCF_DO_STCLASS_AND) {\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\t/* OR before, AND after: ideally we would recurse with\n\t\t\t * data_fake to get the AND applied by study of the\n\t\t\t * remainder of the pattern, and then derecurse;\n\t\t\t * *** HACK *** for now just treat as \"no information\".\n\t\t\t * See [perl #56690].\n\t\t\t */\n\t\t\tssc_init(pRExC_state, data->start_class);\n\t\t } else {\n /* AND before and after: combine and continue. These\n * assertions are zero-length, so can match an EMPTY\n * string */\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &intrnl);\n ANYOF_FLAGS(data->start_class)\n |= SSC_MATCHES_EMPTY_STRING;\n\t\t }\n }\n\t }\n#if PERL_ENABLE_POSITIVE_ASSERTION_STUDY\n else {\n /* Positive Lookahead/lookbehind\n In this case we can do fixed string optimisation,\n but we must be careful about it. Note in the case of\n lookbehind the positions will be offset by the minimum\n length of the pattern, something we won't know about\n until after the recurse.\n */\n SSize_t deltanext, fake = 0;\n regnode *nscan;\n regnode_ssc intrnl;\n int f = 0;\n /* We use SAVEFREEPV so that when the full compile\n is finished perl will clean up the allocated\n minlens when it's all done. This way we don't\n have to worry about freeing them when we know\n they wont be used, which would be a pain.\n */\n SSize_t *minnextp;\n Newx( minnextp, 1, SSize_t );\n SAVEFREEPV(minnextp);\n\n if (data) {\n StructCopy(data, &data_fake, scan_data_t);\n if ((flags & SCF_DO_SUBSTR) && data->last_found) {\n f |= SCF_DO_SUBSTR;\n if (scan->flags)\n scan_commit(pRExC_state, &data_fake, minlenp, is_inf);\n data_fake.last_found=newSVsv(data->last_found);\n }\n }\n else\n data_fake.last_closep = &fake;\n data_fake.flags = 0;\n data_fake.substrs[0].flags = 0;\n data_fake.substrs[1].flags = 0;\n\t\tdata_fake.pos_delta = delta;\n if (is_inf)\n\t data_fake.flags |= SF_IS_INF;\n if ( flags & SCF_DO_STCLASS && !scan->flags\n && OP(scan) == IFMATCH ) { /* Lookahead */\n ssc_init(pRExC_state, &intrnl);\n data_fake.start_class = &intrnl;\n f |= SCF_DO_STCLASS_AND;\n }\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n next = regnext(scan);\n nscan = NEXTOPER(NEXTOPER(scan));\n\n /* positive lookahead study_chunk() recursion */\n *minnextp = study_chunk(pRExC_state, &nscan, minnextp,\n &deltanext, last, &data_fake,\n stopparen, recursed_depth, NULL,\n f, depth+1);\n if (scan->flags) {\n assert(0); /* This code has never been tested since this\n is normally not compiled */\n if ( deltanext < 0\n || deltanext > (I32) U8_MAX\n || *minnextp > (I32)U8_MAX\n || *minnextp + deltanext > (I32)U8_MAX)\n {\n\t\t\tFAIL2(\"Lookbehind longer than %\" UVuf \" not implemented\",\n (UV)U8_MAX);\n }\n\n if (deltanext) {\n scan->next_off = deltanext;\n }\n scan->flags = (U8)*minnextp + deltanext;\n }\n\n *minnextp += min;\n\n if (f & SCF_DO_STCLASS_AND) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &intrnl);\n ANYOF_FLAGS(data->start_class) |= SSC_MATCHES_EMPTY_STRING;\n }\n if (data) {\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n if ((flags & SCF_DO_SUBSTR) && data_fake.last_found) {\n int i;\n if (RExC_rx->minlen<*minnextp)\n RExC_rx->minlen=*minnextp;\n scan_commit(pRExC_state, &data_fake, minnextp, is_inf);\n SvREFCNT_dec_NN(data_fake.last_found);\n\n for (i = 0; i < 2; i++) {\n if (data_fake.substrs[i].minlenp != minlenp) {\n data->substrs[i].min_offset =\n data_fake.substrs[i].min_offset;\n data->substrs[i].max_offset =\n data_fake.substrs[i].max_offset;\n data->substrs[i].minlenp =\n data_fake.substrs[i].minlenp;\n data->substrs[i].lookbehind += scan->flags;\n }\n }\n }\n }\n\t }\n#endif\n\t}\n\n\telse if (OP(scan) == OPEN) {\n\t if (stopparen != (I32)ARG(scan))\n\t pars++;\n\t}\n\telse if (OP(scan) == CLOSE) {\n\t if (stopparen == (I32)ARG(scan)) {\n\t break;\n\t }\n\t if ((I32)ARG(scan) == is_par) {\n\t\tnext = regnext(scan);\n\n\t\tif ( next && (OP(next) != WHILEM) && next < last)\n\t\t is_par = 0;\t\t/* Disable optimization */\n\t }\n\t if (data)\n\t\t*(data->last_closep) = ARG(scan);\n\t}\n\telse if (OP(scan) == EVAL) {\n\t\tif (data)\n\t\t data->flags |= SF_HAS_EVAL;\n\t}\n\telse if ( PL_regkind[OP(scan)] == ENDLIKE ) {\n\t if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\tflags &= ~SCF_DO_SUBSTR;\n\t }\n\t if (data && OP(scan)==ACCEPT) {\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t if (stopmin > min)\n\t stopmin = min;\n\t }\n\t}\n\telse if (OP(scan) == LOGICAL && scan->flags == 2) /* Embedded follows */\n\t{\n\t\tif (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t\tis_inf = is_inf_internal = 1;\n\t\tif (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n\t\t ssc_anything(data->start_class);\n\t\tflags &= ~SCF_DO_STCLASS;\n\t}\n\telse if (OP(scan) == GPOS) {\n if (!(RExC_rx->intflags & PREGf_GPOS_FLOAT) &&\n\t !(delta || is_inf || (data && data->pos_delta)))\n\t {\n if (!(RExC_rx->intflags & PREGf_ANCH) && (flags & SCF_DO_SUBSTR))\n RExC_rx->intflags |= PREGf_ANCH_GPOS;\n\t if (RExC_rx->gofs < (STRLEN)min)\n\t\t RExC_rx->gofs = min;\n } else {\n RExC_rx->intflags |= PREGf_GPOS_FLOAT;\n RExC_rx->gofs = 0;\n }\n\t}\n#ifdef TRIE_STUDY_OPT\n#ifdef FULL_TRIE_STUDY\n else if (PL_regkind[OP(scan)] == TRIE) {\n /* NOTE - There is similar code to this block above for handling\n BRANCH nodes on the initial study. If you change stuff here\n check there too. */\n regnode *trie_node= scan;\n regnode *tail= regnext(scan);\n reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ];\n SSize_t max1 = 0, min1 = SSize_t_MAX;\n regnode_ssc accum;\n\n if (flags & SCF_DO_SUBSTR) { /* XXXX Add !SUSPEND? */\n /* Cannot merge strings after this. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n }\n if (flags & SCF_DO_STCLASS)\n ssc_init_zero(pRExC_state, &accum);\n\n if (!trie->jump) {\n min1= trie->minlen;\n max1= trie->maxlen;\n } else {\n const regnode *nextbranch= NULL;\n U32 word;\n\n for ( word=1 ; word <= trie->wordcount ; word++)\n {\n SSize_t deltanext=0, minnext=0, f = 0, fake;\n regnode_ssc this_class;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n if (data) {\n data_fake.whilem_c = data->whilem_c;\n data_fake.last_closep = data->last_closep;\n }\n else\n data_fake.last_closep = &fake;\n\t\t data_fake.pos_delta = delta;\n if (flags & SCF_DO_STCLASS) {\n ssc_init(pRExC_state, &this_class);\n data_fake.start_class = &this_class;\n f = SCF_DO_STCLASS_AND;\n }\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n\n if (trie->jump[word]) {\n if (!nextbranch)\n nextbranch = trie_node + trie->jump[0];\n scan= trie_node + trie->jump[word];\n /* We go from the jump point to the branch that follows\n it. Note this means we need the vestigal unused\n branches even though they arent otherwise used. */\n /* optimise study_chunk() for TRIE */\n minnext = study_chunk(pRExC_state, &scan, minlenp,\n &deltanext, (regnode *)nextbranch, &data_fake,\n stopparen, recursed_depth, NULL, f, depth+1);\n }\n if (nextbranch && PL_regkind[OP(nextbranch)]==BRANCH)\n nextbranch= regnext((regnode*)nextbranch);\n\n if (min1 > (SSize_t)(minnext + trie->minlen))\n min1 = minnext + trie->minlen;\n if (deltanext == SSize_t_MAX) {\n is_inf = is_inf_internal = 1;\n max1 = SSize_t_MAX;\n } else if (max1 < (SSize_t)(minnext + deltanext + trie->maxlen))\n max1 = minnext + deltanext + trie->maxlen;\n\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SCF_SEEN_ACCEPT) {\n if ( stopmin > min + min1)\n\t stopmin = min + min1;\n\t flags &= ~SCF_DO_SUBSTR;\n\t if (data)\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t }\n if (data) {\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n }\n if (flags & SCF_DO_STCLASS)\n ssc_or(pRExC_state, &accum, (regnode_charclass *) &this_class);\n }\n }\n if (flags & SCF_DO_SUBSTR) {\n data->pos_min += min1;\n data->pos_delta += max1 - min1;\n if (max1 != min1 || is_inf)\n data->cur_is_floating = 1; /* float */\n }\n min += min1;\n if (delta != SSize_t_MAX) {\n if (SSize_t_MAX - (max1 - min1) >= delta)\n delta += max1 - min1;\n else\n delta = SSize_t_MAX;\n }\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_or(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n if (min1) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n flags &= ~SCF_DO_STCLASS;\n }\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n if (min1) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n flags &= ~SCF_DO_STCLASS;\n }\n else {\n /* Switch to OR mode: cache the old value of\n * data->start_class */\n\t\t INIT_AND_WITHP;\n StructCopy(data->start_class, and_withp, regnode_ssc);\n flags &= ~SCF_DO_STCLASS_AND;\n StructCopy(&accum, data->start_class, regnode_ssc);\n flags |= SCF_DO_STCLASS_OR;\n }\n }\n scan= tail;\n continue;\n }\n#else\n\telse if (PL_regkind[OP(scan)] == TRIE) {\n\t reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ];\n\t U8*bang=NULL;\n\n\t min += trie->minlen;\n\t delta += (trie->maxlen - trie->minlen);\n\t flags &= ~SCF_DO_STCLASS; /* xxx */\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n \t data->pos_min += trie->minlen;\n \t data->pos_delta += (trie->maxlen - trie->minlen);\n\t\tif (trie->maxlen != trie->minlen)\n\t\t data->cur_is_floating = 1; /* float */\n \t }\n \t if (trie->jump) /* no more substrings -- for now /grr*/\n flags &= ~SCF_DO_SUBSTR;\n\t}\n#endif /* old or new */\n#endif /* TRIE_STUDY_OPT */\n\n\t/* Else: zero-length, ignore. */\n\tscan = regnext(scan);\n }\n\n finish:\n if (frame) {\n /* we need to unwind recursion. */\n depth = depth - 1;\n\n DEBUG_STUDYDATA(\"frame-end\", data, depth, is_inf);\n DEBUG_PEEP(\"fend\", scan, depth, flags);\n\n /* restore previous context */\n last = frame->last_regnode;\n scan = frame->next_regnode;\n stopparen = frame->stopparen;\n recursed_depth = frame->prev_recursed_depth;\n\n RExC_frame_last = frame->prev_frame;\n frame = frame->this_prev_frame;\n goto fake_study_recurse;\n }\n\n assert(!frame);\n DEBUG_STUDYDATA(\"pre-fin\", data, depth, is_inf);\n\n *scanp = scan;\n *deltap = is_inf_internal ? SSize_t_MAX : delta;\n\n if (flags & SCF_DO_SUBSTR && is_inf)\n\tdata->pos_delta = SSize_t_MAX - data->pos_min;\n if (is_par > (I32)U8_MAX)\n\tis_par = 0;\n if (is_par && pars==1 && data) {\n\tdata->flags |= SF_IN_PAR;\n\tdata->flags &= ~SF_HAS_PAR;\n }\n else if (pars && data) {\n\tdata->flags |= SF_HAS_PAR;\n\tdata->flags &= ~SF_IN_PAR;\n }\n if (flags & SCF_DO_STCLASS_OR)\n\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n if (flags & SCF_TRIE_RESTUDY)\n data->flags |= \tSCF_TRIE_RESTUDY;\n\n DEBUG_STUDYDATA(\"post-fin\", data, depth, is_inf);\n\n {\n SSize_t final_minlen= min < stopmin ? min : stopmin;\n\n if (!(RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN)) {\n if (final_minlen > SSize_t_MAX - delta)\n RExC_maxlen = SSize_t_MAX;\n else if (RExC_maxlen < final_minlen + delta)\n RExC_maxlen = final_minlen + delta;\n }\n return final_minlen;\n }\n NOT_REACHED; /* NOTREACHED */","target":"STATIC SSize_t\nS_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,\n SSize_t *minlenp, SSize_t *deltap,\n\t\t\tregnode *last,\n\t\t\tscan_data_t *data,\n\t\t\tI32 stopparen,\n U32 recursed_depth,\n\t\t\tregnode_ssc *and_withp,\n\t\t\tU32 flags, U32 depth)\n\t\t\t/* scanp: Start here (read-write). */\n\t\t\t/* deltap: Write maxlen-minlen here. */\n\t\t\t/* last: Stop before this one. */\n\t\t\t/* data: string data about the pattern */\n\t\t\t/* stopparen: treat close N as END */\n\t\t\t/* recursed: which subroutines have we recursed into */\n\t\t\t/* and_withp: Valid if flags & SCF_DO_STCLASS_OR */\n{\n dVAR;\n /* There must be at least this number of characters to match */\n SSize_t min = 0;\n I32 pars = 0, code;\n regnode *scan = *scanp, *next;\n SSize_t delta = 0;\n int is_inf = (flags & SCF_DO_SUBSTR) && (data->flags & SF_IS_INF);\n int is_inf_internal = 0;\t\t/* The studied chunk is infinite */\n I32 is_par = OP(scan) == OPEN ? ARG(scan) : 0;\n scan_data_t data_fake;\n SV *re_trie_maxbuff = NULL;\n regnode *first_non_open = scan;\n SSize_t stopmin = SSize_t_MAX;\n scan_frame *frame = NULL;\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_STUDY_CHUNK;\n RExC_study_started= 1;\n\n Zero(&data_fake, 1, scan_data_t);\n\n if ( depth == 0 ) {\n while (first_non_open && OP(first_non_open) == OPEN)\n first_non_open=regnext(first_non_open);\n }\n\n\n fake_study_recurse:\n DEBUG_r(\n RExC_study_chunk_recursed_count++;\n );\n DEBUG_OPTIMISE_MORE_r(\n {\n Perl_re_indentf( aTHX_ \"study_chunk stopparen=%ld recursed_count=%lu depth=%lu recursed_depth=%lu scan=%p last=%p\",\n depth, (long)stopparen,\n (unsigned long)RExC_study_chunk_recursed_count,\n (unsigned long)depth, (unsigned long)recursed_depth,\n scan,\n last);\n if (recursed_depth) {\n U32 i;\n U32 j;\n for ( j = 0 ; j < recursed_depth ; j++ ) {\n for ( i = 0 ; i < (U32)RExC_total_parens ; i++ ) {\n if (\n PAREN_TEST(RExC_study_chunk_recursed +\n ( j * RExC_study_chunk_recursed_bytes), i )\n && (\n !j ||\n !PAREN_TEST(RExC_study_chunk_recursed +\n (( j - 1 ) * RExC_study_chunk_recursed_bytes), i)\n )\n ) {\n Perl_re_printf( aTHX_ \" %d\",(int)i);\n break;\n }\n }\n if ( j + 1 < recursed_depth ) {\n Perl_re_printf( aTHX_ \",\");\n }\n }\n }\n Perl_re_printf( aTHX_ \"\\n\");\n }\n );\n while ( scan && OP(scan) != END && scan < last ){\n UV min_subtract = 0; /* How mmany chars to subtract from the minimum\n node length to get a real minimum (because\n the folded version may be shorter) */\n\tbool unfolded_multi_char = FALSE;\n\t/* Peephole optimizer: */\n DEBUG_STUDYDATA(\"Peep\", data, depth, is_inf);\n DEBUG_PEEP(\"Peep\", scan, depth, flags);\n\n\n /* The reason we do this here is that we need to deal with things like\n * /(?:f)(?:o)(?:o)/ which cant be dealt with by the normal EXACT\n * parsing code, as each (?:..) is handled by a different invocation of\n * reg() -- Yves\n */\n JOIN_EXACT(scan,&min_subtract, &unfolded_multi_char, 0);\n\n\t/* Follow the next-chain of the current node and optimize\n\t away all the NOTHINGs from it. */\n\tif (OP(scan) != CURLYX) {\n\t const int max = (reg_off_by_arg[OP(scan)]\n\t\t ? I32_MAX\n\t\t /* I32 may be smaller than U16 on CRAYs! */\n\t\t : (I32_MAX < U16_MAX ? I32_MAX : U16_MAX));\n\t int off = (reg_off_by_arg[OP(scan)] ? ARG(scan) : NEXT_OFF(scan));\n\t int noff;\n\t regnode *n = scan;\n\n\t /* Skip NOTHING and LONGJMP. */\n\t while ((n = regnext(n))\n\t\t && ((PL_regkind[OP(n)] == NOTHING && (noff = NEXT_OFF(n)))\n\t\t || ((OP(n) == LONGJMP) && (noff = ARG(n))))\n\t\t && off + noff < max)\n\t\toff += noff;\n\t if (reg_off_by_arg[OP(scan)])\n\t\tARG(scan) = off;\n\t else\n\t\tNEXT_OFF(scan) = off;\n\t}\n\n\t/* The principal pseudo-switch. Cannot be a switch, since we\n\t look into several different things. */\n if ( OP(scan) == DEFINEP ) {\n SSize_t minlen = 0;\n SSize_t deltanext = 0;\n SSize_t fake_last_close = 0;\n I32 f = SCF_IN_DEFINE;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n scan = regnext(scan);\n assert( OP(scan) == IFTHEN );\n DEBUG_PEEP(\"expect IFTHEN\", scan, depth, flags);\n\n data_fake.last_closep= &fake_last_close;\n minlen = *minlenp;\n next = regnext(scan);\n scan = NEXTOPER(NEXTOPER(scan));\n DEBUG_PEEP(\"scan\", scan, depth, flags);\n DEBUG_PEEP(\"next\", next, depth, flags);\n\n /* we suppose the run is continuous, last=next...\n * NOTE we dont use the return here! */\n /* DEFINEP study_chunk() recursion */\n (void)study_chunk(pRExC_state, &scan, &minlen,\n &deltanext, next, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n\n scan = next;\n } else\n if (\n OP(scan) == BRANCH ||\n OP(scan) == BRANCHJ ||\n OP(scan) == IFTHEN\n ) {\n\t next = regnext(scan);\n\t code = OP(scan);\n\n /* The op(next)==code check below is to see if we\n * have \"BRANCH-BRANCH\", \"BRANCHJ-BRANCHJ\", \"IFTHEN-IFTHEN\"\n * IFTHEN is special as it might not appear in pairs.\n * Not sure whether BRANCH-BRANCHJ is possible, regardless\n * we dont handle it cleanly. */\n\t if (OP(next) == code || code == IFTHEN) {\n /* NOTE - There is similar code to this block below for\n * handling TRIE nodes on a re-study. If you change stuff here\n * check there too. */\n\t\tSSize_t max1 = 0, min1 = SSize_t_MAX, num = 0;\n\t\tregnode_ssc accum;\n\t\tregnode * const startbranch=scan;\n\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot merge strings after this. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n }\n\n if (flags & SCF_DO_STCLASS)\n\t\t ssc_init_zero(pRExC_state, &accum);\n\n\t\twhile (OP(scan) == code) {\n\t\t SSize_t deltanext, minnext, fake;\n\t\t I32 f = 0;\n\t\t regnode_ssc this_class;\n\n DEBUG_PEEP(\"Branch\", scan, depth, flags);\n\n\t\t num++;\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n\t\t if (data) {\n\t\t\tdata_fake.whilem_c = data->whilem_c;\n\t\t\tdata_fake.last_closep = data->last_closep;\n\t\t }\n\t\t else\n\t\t\tdata_fake.last_closep = &fake;\n\n\t\t data_fake.pos_delta = delta;\n\t\t next = regnext(scan);\n\n scan = NEXTOPER(scan); /* everything */\n if (code != BRANCH) /* everything but BRANCH */\n\t\t\tscan = NEXTOPER(scan);\n\n\t\t if (flags & SCF_DO_STCLASS) {\n\t\t\tssc_init(pRExC_state, &this_class);\n\t\t\tdata_fake.start_class = &this_class;\n\t\t\tf = SCF_DO_STCLASS_AND;\n\t\t }\n\t\t if (flags & SCF_WHILEM_VISITED_POS)\n\t\t\tf |= SCF_WHILEM_VISITED_POS;\n\n\t\t /* we suppose the run is continuous, last=next...*/\n /* recurse study_chunk() for each BRANCH in an alternation */\n\t\t minnext = study_chunk(pRExC_state, &scan, minlenp,\n &deltanext, next, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n\n\t\t if (min1 > minnext)\n\t\t\tmin1 = minnext;\n\t\t if (deltanext == SSize_t_MAX) {\n\t\t\tis_inf = is_inf_internal = 1;\n\t\t\tmax1 = SSize_t_MAX;\n\t\t } else if (max1 < minnext + deltanext)\n\t\t\tmax1 = minnext + deltanext;\n\t\t scan = next;\n\t\t if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n\t\t\tpars++;\n\t if (data_fake.flags & SCF_SEEN_ACCEPT) {\n\t if ( stopmin > minnext)\n\t stopmin = min + min1;\n\t flags &= ~SCF_DO_SUBSTR;\n\t if (data)\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t }\n\t\t if (data) {\n\t\t\tif (data_fake.flags & SF_HAS_EVAL)\n\t\t\t data->flags |= SF_HAS_EVAL;\n\t\t\tdata->whilem_c = data_fake.whilem_c;\n\t\t }\n\t\t if (flags & SCF_DO_STCLASS)\n\t\t\tssc_or(pRExC_state, &accum, (regnode_charclass*)&this_class);\n\t\t}\n\t\tif (code == IFTHEN && num < 2) /* Empty ELSE branch */\n\t\t min1 = 0;\n\t\tif (flags & SCF_DO_SUBSTR) {\n\t\t data->pos_min += min1;\n\t\t if (data->pos_delta >= SSize_t_MAX - (max1 - min1))\n\t\t data->pos_delta = SSize_t_MAX;\n\t\t else\n\t\t data->pos_delta += max1 - min1;\n\t\t if (max1 != min1 || is_inf)\n\t\t\tdata->cur_is_floating = 1;\n\t\t}\n\t\tmin += min1;\n\t\tif (delta == SSize_t_MAX\n\t\t || SSize_t_MAX - delta - (max1 - min1) < 0)\n\t\t delta = SSize_t_MAX;\n\t\telse\n\t\t delta += max1 - min1;\n\t\tif (flags & SCF_DO_STCLASS_OR) {\n\t\t ssc_or(pRExC_state, data->start_class, (regnode_charclass*) &accum);\n\t\t if (min1) {\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\t\tflags &= ~SCF_DO_STCLASS;\n\t\t }\n\t\t}\n\t\telse if (flags & SCF_DO_STCLASS_AND) {\n\t\t if (min1) {\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n\t\t\tflags &= ~SCF_DO_STCLASS;\n\t\t }\n\t\t else {\n\t\t\t/* Switch to OR mode: cache the old value of\n\t\t\t * data->start_class */\n\t\t\tINIT_AND_WITHP;\n\t\t\tStructCopy(data->start_class, and_withp, regnode_ssc);\n\t\t\tflags &= ~SCF_DO_STCLASS_AND;\n\t\t\tStructCopy(&accum, data->start_class, regnode_ssc);\n\t\t\tflags |= SCF_DO_STCLASS_OR;\n\t\t }\n\t\t}\n\n if (PERL_ENABLE_TRIE_OPTIMISATION &&\n OP( startbranch ) == BRANCH )\n {\n\t\t/* demq.\n\n Assuming this was/is a branch we are dealing with: 'scan'\n now points at the item that follows the branch sequence,\n whatever it is. We now start at the beginning of the\n sequence and look for subsequences of\n\n\t\t BRANCH->EXACT=>x1\n\t\t BRANCH->EXACT=>x2\n\t\t tail\n\n which would be constructed from a pattern like\n /A|LIST|OF|WORDS/\n\n\t\t If we can find such a subsequence we need to turn the first\n\t\t element into a trie and then add the subsequent branch exact\n\t\t strings to the trie.\n\n\t\t We have two cases\n\n 1. patterns where the whole set of branches can be\n converted.\n\n\t\t 2. patterns where only a subset can be converted.\n\n\t\t In case 1 we can replace the whole set with a single regop\n\t\t for the trie. In case 2 we need to keep the start and end\n\t\t branches so\n\n\t\t 'BRANCH EXACT; BRANCH EXACT; BRANCH X'\n\t\t becomes BRANCH TRIE; BRANCH X;\n\n\t\t There is an additional case, that being where there is a\n\t\t common prefix, which gets split out into an EXACT like node\n\t\t preceding the TRIE node.\n\n\t\t If x(1..n)==tail then we can do a simple trie, if not we make\n\t\t a \"jump\" trie, such that when we match the appropriate word\n\t\t we \"jump\" to the appropriate tail node. Essentially we turn\n\t\t a nested if into a case structure of sorts.\n\n\t\t*/\n\n\t\t int made=0;\n\t\t if (!re_trie_maxbuff) {\n\t\t\tre_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1);\n\t\t\tif (!SvIOK(re_trie_maxbuff))\n\t\t\t sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT);\n\t\t }\n if ( SvIV(re_trie_maxbuff)>=0 ) {\n regnode *cur;\n regnode *first = (regnode *)NULL;\n regnode *last = (regnode *)NULL;\n regnode *tail = scan;\n U8 trietype = 0;\n U32 count=0;\n\n /* var tail is used because there may be a TAIL\n regop in the way. Ie, the exacts will point to the\n thing following the TAIL, but the last branch will\n point at the TAIL. So we advance tail. If we\n have nested (?:) we may have to move through several\n tails.\n */\n\n while ( OP( tail ) == TAIL ) {\n /* this is the TAIL generated by (?:) */\n tail = regnext( tail );\n }\n\n\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, tail, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"%s %\" UVuf \":%s\\n\",\n depth+1,\n \"Looking for TRIE'able sequences. Tail node is \",\n (UV) REGNODE_OFFSET(tail),\n SvPV_nolen_const( RExC_mysv )\n );\n });\n\n /*\n\n Step through the branches\n cur represents each branch,\n noper is the first thing to be matched as part\n of that branch\n noper_next is the regnext() of that node.\n\n We normally handle a case like this\n /FOO[xyz]|BAR[pqr]/ via a \"jump trie\" but we also\n support building with NOJUMPTRIE, which restricts\n the trie logic to structures like /FOO|BAR/.\n\n If noper is a trieable nodetype then the branch is\n a possible optimization target. If we are building\n under NOJUMPTRIE then we require that noper_next is\n the same as scan (our current position in the regex\n program).\n\n Once we have two or more consecutive such branches\n we can create a trie of the EXACT's contents and\n stitch it in place into the program.\n\n If the sequence represents all of the branches in\n the alternation we replace the entire thing with a\n single TRIE node.\n\n Otherwise when it is a subsequence we need to\n stitch it in place and replace only the relevant\n branches. This means the first branch has to remain\n as it is used by the alternation logic, and its\n next pointer, and needs to be repointed at the item\n on the branch chain following the last branch we\n have optimized away.\n\n This could be either a BRANCH, in which case the\n subsequence is internal, or it could be the item\n following the branch sequence in which case the\n subsequence is at the end (which does not\n necessarily mean the first node is the start of the\n alternation).\n\n TRIE_TYPE(X) is a define which maps the optype to a\n trietype.\n\n optype | trietype\n ----------------+-----------\n NOTHING | NOTHING\n EXACT | EXACT\n EXACT_ONLY8 | EXACT\n EXACTFU | EXACTFU\n EXACTFU_ONLY8 | EXACTFU\n EXACTFUP | EXACTFU\n EXACTFAA | EXACTFAA\n EXACTL | EXACTL\n EXACTFLU8 | EXACTFLU8\n\n\n */\n#define TRIE_TYPE(X) ( ( NOTHING == (X) ) \\\n ? NOTHING \\\n : ( EXACT == (X) || EXACT_ONLY8 == (X) ) \\\n ? EXACT \\\n : ( EXACTFU == (X) \\\n || EXACTFU_ONLY8 == (X) \\\n || EXACTFUP == (X) ) \\\n ? EXACTFU \\\n : ( EXACTFAA == (X) ) \\\n ? EXACTFAA \\\n : ( EXACTL == (X) ) \\\n ? EXACTL \\\n : ( EXACTFLU8 == (X) ) \\\n ? EXACTFLU8 \\\n : 0 )\n\n /* dont use tail as the end marker for this traverse */\n for ( cur = startbranch ; cur != scan ; cur = regnext( cur ) ) {\n regnode * const noper = NEXTOPER( cur );\n U8 noper_type = OP( noper );\n U8 noper_trietype = TRIE_TYPE( noper_type );\n#if defined(DEBUGGING) || defined(NOJUMPTRIE)\n regnode * const noper_next = regnext( noper );\n U8 noper_next_type = (noper_next && noper_next < tail) ? OP(noper_next) : 0;\n U8 noper_next_trietype = (noper_next && noper_next < tail) ? TRIE_TYPE( noper_next_type ) :0;\n#endif\n\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %d:%s (%d)\",\n depth+1,\n REG_NODE_NUM(cur), SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur) );\n\n regprop(RExC_rx, RExC_mysv, noper, NULL, pRExC_state);\n Perl_re_printf( aTHX_ \" -> %d:%s\",\n REG_NODE_NUM(noper), SvPV_nolen_const(RExC_mysv));\n\n if ( noper_next ) {\n regprop(RExC_rx, RExC_mysv, noper_next, NULL, pRExC_state);\n Perl_re_printf( aTHX_ \"\\t=> %d:%s\\t\",\n REG_NODE_NUM(noper_next), SvPV_nolen_const(RExC_mysv));\n }\n Perl_re_printf( aTHX_ \"(First==%d,Last==%d,Cur==%d,tt==%s,ntt==%s,nntt==%s)\\n\",\n REG_NODE_NUM(first), REG_NODE_NUM(last), REG_NODE_NUM(cur),\n\t\t\t\t PL_reg_name[trietype], PL_reg_name[noper_trietype], PL_reg_name[noper_next_trietype]\n\t\t\t\t);\n });\n\n /* Is noper a trieable nodetype that can be merged\n * with the current trie (if there is one)? */\n if ( noper_trietype\n &&\n (\n ( noper_trietype == NOTHING )\n || ( trietype == NOTHING )\n || ( trietype == noper_trietype )\n )\n#ifdef NOJUMPTRIE\n && noper_next >= tail\n#endif\n && count < U16_MAX)\n {\n /* Handle mergable triable node Either we are\n * the first node in a new trieable sequence,\n * in which case we do some bookkeeping,\n * otherwise we update the end pointer. */\n if ( !first ) {\n first = cur;\n\t\t\t\t if ( noper_trietype == NOTHING ) {\n#if !defined(DEBUGGING) && !defined(NOJUMPTRIE)\n\t\t\t\t\tregnode * const noper_next = regnext( noper );\n U8 noper_next_type = (noper_next && noper_next < tail) ? OP(noper_next) : 0;\n\t\t\t\t\tU8 noper_next_trietype = noper_next_type ? TRIE_TYPE( noper_next_type ) :0;\n#endif\n\n if ( noper_next_trietype ) {\n\t\t\t\t\t trietype = noper_next_trietype;\n } else if (noper_next_type) {\n /* a NOTHING regop is 1 regop wide.\n * We need at least two for a trie\n * so we can't merge this in */\n first = NULL;\n }\n } else {\n trietype = noper_trietype;\n }\n } else {\n if ( trietype == NOTHING )\n trietype = noper_trietype;\n last = cur;\n }\n\t\t\t\tif (first)\n\t\t\t\t count++;\n } /* end handle mergable triable node */\n else {\n /* handle unmergable node -\n * noper may either be a triable node which can\n * not be tried together with the current trie,\n * or a non triable node */\n if ( last ) {\n /* If last is set and trietype is not\n * NOTHING then we have found at least two\n * triable branch sequences in a row of a\n * similar trietype so we can turn them\n * into a trie. If/when we allow NOTHING to\n * start a trie sequence this condition\n * will be required, and it isn't expensive\n * so we leave it in for now. */\n if ( trietype && trietype != NOTHING )\n make_trie( pRExC_state,\n startbranch, first, cur, tail,\n count, trietype, depth+1 );\n last = NULL; /* note: we clear/update\n first, trietype etc below,\n so we dont do it here */\n }\n if ( noper_trietype\n#ifdef NOJUMPTRIE\n && noper_next >= tail\n#endif\n ){\n /* noper is triable, so we can start a new\n * trie sequence */\n count = 1;\n first = cur;\n trietype = noper_trietype;\n } else if (first) {\n /* if we already saw a first but the\n * current node is not triable then we have\n * to reset the first information. */\n count = 0;\n first = NULL;\n trietype = 0;\n }\n } /* end handle unmergable node */\n } /* loop over branches */\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %s (%d) \",\n depth+1, SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur));\n Perl_re_printf( aTHX_ \"(First==%d, Last==%d, Cur==%d, tt==%s)\\n\",\n REG_NODE_NUM(first), REG_NODE_NUM(last), REG_NODE_NUM(cur),\n PL_reg_name[trietype]\n );\n\n });\n if ( last && trietype ) {\n if ( trietype != NOTHING ) {\n /* the last branch of the sequence was part of\n * a trie, so we have to construct it here\n * outside of the loop */\n made= make_trie( pRExC_state, startbranch,\n first, scan, tail, count,\n trietype, depth+1 );\n#ifdef TRIE_STUDY_OPT\n if ( ((made == MADE_EXACT_TRIE &&\n startbranch == first)\n || ( first_non_open == first )) &&\n depth==0 ) {\n flags |= SCF_TRIE_RESTUDY;\n if ( startbranch == first\n && scan >= tail )\n {\n RExC_seen &=~REG_TOP_LEVEL_BRANCHES_SEEN;\n }\n }\n#endif\n } else {\n /* at this point we know whatever we have is a\n * NOTHING sequence/branch AND if 'startbranch'\n * is 'first' then we can turn the whole thing\n * into a NOTHING\n */\n if ( startbranch == first ) {\n regnode *opt;\n /* the entire thing is a NOTHING sequence,\n * something like this: (?:|) So we can\n * turn it into a plain NOTHING op. */\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %s (%d) \\n\",\n depth+1,\n SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur));\n\n });\n OP(startbranch)= NOTHING;\n NEXT_OFF(startbranch)= tail - startbranch;\n for ( opt= startbranch + 1; opt < tail ; opt++ )\n OP(opt)= OPTIMIZED;\n }\n }\n } /* end if ( last) */\n } /* TRIE_MAXBUF is non zero */\n\n } /* do trie */\n\n\t }\n\t else if ( code == BRANCHJ ) { /* single branch is optimized. */\n\t\tscan = NEXTOPER(NEXTOPER(scan));\n\t } else\t\t\t/* single branch is optimized. */\n\t\tscan = NEXTOPER(scan);\n\t continue;\n } else if (OP(scan) == SUSPEND || OP(scan) == GOSUB) {\n I32 paren = 0;\n regnode *start = NULL;\n regnode *end = NULL;\n U32 my_recursed_depth= recursed_depth;\n\n if (OP(scan) != SUSPEND) { /* GOSUB */\n /* Do setup, note this code has side effects beyond\n * the rest of this block. Specifically setting\n * RExC_recurse[] must happen at least once during\n * study_chunk(). */\n paren = ARG(scan);\n RExC_recurse[ARG2L(scan)] = scan;\n start = REGNODE_p(RExC_open_parens[paren]);\n end = REGNODE_p(RExC_close_parens[paren]);\n\n /* NOTE we MUST always execute the above code, even\n * if we do nothing with a GOSUB */\n if (\n ( flags & SCF_IN_DEFINE )\n ||\n (\n (is_inf_internal || is_inf || (data && data->flags & SF_IS_INF))\n &&\n ( (flags & (SCF_DO_STCLASS | SCF_DO_SUBSTR)) == 0 )\n )\n ) {\n /* no need to do anything here if we are in a define. */\n /* or we are after some kind of infinite construct\n * so we can skip recursing into this item.\n * Since it is infinite we will not change the maxlen\n * or delta, and if we miss something that might raise\n * the minlen it will merely pessimise a little.\n *\n * Iow /(?(DEFINE)(?foo|food))a+(?&foo)/\n * might result in a minlen of 1 and not of 4,\n * but this doesn't make us mismatch, just try a bit\n * harder than we should.\n * */\n scan= regnext(scan);\n continue;\n }\n\n if (\n !recursed_depth\n ||\n !PAREN_TEST(RExC_study_chunk_recursed + ((recursed_depth-1) * RExC_study_chunk_recursed_bytes), paren)\n ) {\n /* it is quite possible that there are more efficient ways\n * to do this. We maintain a bitmap per level of recursion\n * of which patterns we have entered so we can detect if a\n * pattern creates a possible infinite loop. When we\n * recurse down a level we copy the previous levels bitmap\n * down. When we are at recursion level 0 we zero the top\n * level bitmap. It would be nice to implement a different\n * more efficient way of doing this. In particular the top\n * level bitmap may be unnecessary.\n */\n if (!recursed_depth) {\n Zero(RExC_study_chunk_recursed, RExC_study_chunk_recursed_bytes, U8);\n } else {\n Copy(RExC_study_chunk_recursed + ((recursed_depth-1) * RExC_study_chunk_recursed_bytes),\n RExC_study_chunk_recursed + (recursed_depth * RExC_study_chunk_recursed_bytes),\n RExC_study_chunk_recursed_bytes, U8);\n }\n /* we havent recursed into this paren yet, so recurse into it */\n DEBUG_STUDYDATA(\"gosub-set\", data, depth, is_inf);\n PAREN_SET(RExC_study_chunk_recursed + (recursed_depth * RExC_study_chunk_recursed_bytes), paren);\n my_recursed_depth= recursed_depth + 1;\n } else {\n DEBUG_STUDYDATA(\"gosub-inf\", data, depth, is_inf);\n /* some form of infinite recursion, assume infinite length\n * */\n if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n data->cur_is_floating = 1;\n }\n is_inf = is_inf_internal = 1;\n if (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n ssc_anything(data->start_class);\n flags &= ~SCF_DO_STCLASS;\n\n start= NULL; /* reset start so we dont recurse later on. */\n\t }\n } else {\n\t paren = stopparen;\n start = scan + 2;\n\t end = regnext(scan);\n\t }\n if (start) {\n scan_frame *newframe;\n assert(end);\n if (!RExC_frame_last) {\n Newxz(newframe, 1, scan_frame);\n SAVEDESTRUCTOR_X(S_unwind_scan_frames, newframe);\n RExC_frame_head= newframe;\n RExC_frame_count++;\n } else if (!RExC_frame_last->next_frame) {\n Newxz(newframe, 1, scan_frame);\n RExC_frame_last->next_frame= newframe;\n newframe->prev_frame= RExC_frame_last;\n RExC_frame_count++;\n } else {\n newframe= RExC_frame_last->next_frame;\n }\n RExC_frame_last= newframe;\n\n newframe->next_regnode = regnext(scan);\n newframe->last_regnode = last;\n newframe->stopparen = stopparen;\n newframe->prev_recursed_depth = recursed_depth;\n newframe->this_prev_frame= frame;\n\n DEBUG_STUDYDATA(\"frame-new\", data, depth, is_inf);\n DEBUG_PEEP(\"fnew\", scan, depth, flags);\n\n\t frame = newframe;\n\t scan = start;\n\t stopparen = paren;\n\t last = end;\n depth = depth + 1;\n recursed_depth= my_recursed_depth;\n\n\t continue;\n\t }\n\t}\n\telse if ( OP(scan) == EXACT\n || OP(scan) == EXACT_ONLY8\n || OP(scan) == EXACTL)\n {\n\t SSize_t l = STR_LEN(scan);\n\t UV uc;\n assert(l);\n\t if (UTF) {\n\t\tconst U8 * const s = (U8*)STRING(scan);\n\t\tuc = utf8_to_uvchr_buf(s, s + l, NULL);\n\t\tl = utf8_length(s, s + l);\n\t } else {\n\t\tuc = *((U8*)STRING(scan));\n\t }\n\t min += l;\n\t if (flags & SCF_DO_SUBSTR) { /* Update longest substr. */\n\t\t/* The code below prefers earlier match for fixed\n\t\t offset, later match for variable offset. */\n\t\tif (data->last_end == -1) { /* Update the start info. */\n\t\t data->last_start_min = data->pos_min;\n \t\t data->last_start_max = is_inf\n \t\t\t? SSize_t_MAX : data->pos_min + data->pos_delta;\n\t\t}\n\t\tsv_catpvn(data->last_found, STRING(scan), STR_LEN(scan));\n\t\tif (UTF)\n\t\t SvUTF8_on(data->last_found);\n\t\t{\n\t\t SV * const sv = data->last_found;\n\t\t MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\t\t if (mg && mg->mg_len >= 0)\n\t\t\tmg->mg_len += utf8_length((U8*)STRING(scan),\n (U8*)STRING(scan)+STR_LEN(scan));\n\t\t}\n\t\tdata->last_end = data->pos_min + l;\n\t\tdata->pos_min += l; /* As in the first entry. */\n\t\tdata->flags &= ~SF_BEFORE_EOL;\n\t }\n\n /* ANDing the code point leaves at most it, and not in locale, and\n * can't match null string */\n\t if (flags & SCF_DO_STCLASS_AND) {\n ssc_cp_and(data->start_class, uc);\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n ssc_clear_locale(data->start_class);\n\t }\n\t else if (flags & SCF_DO_STCLASS_OR) {\n ssc_add_cp(data->start_class, uc);\n\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n\t }\n\t flags &= ~SCF_DO_STCLASS;\n\t}\n else if (PL_regkind[OP(scan)] == EXACT) {\n /* But OP != EXACT!, so is EXACTFish */\n\t SSize_t l = STR_LEN(scan);\n const U8 * s = (U8*)STRING(scan);\n\n\t /* Search for fixed substrings supports EXACT only. */\n\t if (flags & SCF_DO_SUBSTR) {\n\t\tassert(data);\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t }\n\t if (UTF) {\n\t\tl = utf8_length(s, s + l);\n\t }\n\t if (unfolded_multi_char) {\n RExC_seen |= REG_UNFOLDED_MULTI_SEEN;\n\t }\n\t min += l - min_subtract;\n assert (min >= 0);\n delta += min_subtract;\n\t if (flags & SCF_DO_SUBSTR) {\n\t\tdata->pos_min += l - min_subtract;\n\t\tif (data->pos_min < 0) {\n data->pos_min = 0;\n }\n data->pos_delta += min_subtract;\n\t\tif (min_subtract) {\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t }\n\n if (flags & SCF_DO_STCLASS) {\n SV* EXACTF_invlist = _make_exactf_invlist(pRExC_state, scan);\n\n assert(EXACTF_invlist);\n if (flags & SCF_DO_STCLASS_AND) {\n if (OP(scan) != EXACTFL)\n ssc_clear_locale(data->start_class);\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n ANYOF_POSIXL_ZERO(data->start_class);\n ssc_intersection(data->start_class, EXACTF_invlist, FALSE);\n }\n else { /* SCF_DO_STCLASS_OR */\n ssc_union(data->start_class, EXACTF_invlist, FALSE);\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n }\n flags &= ~SCF_DO_STCLASS;\n SvREFCNT_dec(EXACTF_invlist);\n }\n\t}\n\telse if (REGNODE_VARIES(OP(scan))) {\n\t SSize_t mincount, maxcount, minnext, deltanext, pos_before = 0;\n\t I32 fl = 0, f = flags;\n\t regnode * const oscan = scan;\n\t regnode_ssc this_class;\n\t regnode_ssc *oclass = NULL;\n\t I32 next_is_eval = 0;\n\n\t switch (PL_regkind[OP(scan)]) {\n\t case WHILEM:\t\t/* End of (?:...)* . */\n\t\tscan = NEXTOPER(scan);\n\t\tgoto finish;\n\t case PLUS:\n\t\tif (flags & (SCF_DO_SUBSTR | SCF_DO_STCLASS)) {\n\t\t next = NEXTOPER(scan);\n\t\t if ( OP(next) == EXACT\n || OP(next) == EXACT_ONLY8\n || OP(next) == EXACTL\n || (flags & SCF_DO_STCLASS))\n {\n\t\t\tmincount = 1;\n\t\t\tmaxcount = REG_INFTY;\n\t\t\tnext = regnext(scan);\n\t\t\tscan = NEXTOPER(scan);\n\t\t\tgoto do_curly;\n\t\t }\n\t\t}\n\t\tif (flags & SCF_DO_SUBSTR)\n\t\t data->pos_min++;\n\t\tmin++;\n\t\t/* FALLTHROUGH */\n\t case STAR:\n next = NEXTOPER(scan);\n\n /* This temporary node can now be turned into EXACTFU, and\n * must, as regexec.c doesn't handle it */\n if (OP(next) == EXACTFU_S_EDGE) {\n OP(next) = EXACTFU;\n }\n\n if ( STR_LEN(next) == 1\n && isALPHA_A(* STRING(next))\n && ( OP(next) == EXACTFAA\n || ( OP(next) == EXACTFU\n && ! HAS_NONLATIN1_SIMPLE_FOLD_CLOSURE(* STRING(next)))))\n {\n /* These differ in just one bit */\n U8 mask = ~ ('A' ^ 'a');\n\n assert(isALPHA_A(* STRING(next)));\n\n /* Then replace it by an ANYOFM node, with\n * the mask set to the complement of the\n * bit that differs between upper and lower\n * case, and the lowest code point of the\n * pair (which the '&' forces) */\n OP(next) = ANYOFM;\n ARG_SET(next, *STRING(next) & mask);\n FLAGS(next) = mask;\n }\n\n\t\tif (flags & SCF_DO_STCLASS) {\n\t\t mincount = 0;\n\t\t maxcount = REG_INFTY;\n\t\t next = regnext(scan);\n\t\t scan = NEXTOPER(scan);\n\t\t goto do_curly;\n\t\t}\n\t\tif (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n /* Cannot extend fixed substrings */\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n is_inf = is_inf_internal = 1;\n scan = regnext(scan);\n\t\tgoto optimize_curly_tail;\n\t case CURLY:\n\t if (stopparen>0 && (OP(scan)==CURLYN || OP(scan)==CURLYM)\n\t && (scan->flags == stopparen))\n\t\t{\n\t\t mincount = 1;\n\t\t maxcount = 1;\n\t\t} else {\n\t\t mincount = ARG1(scan);\n\t\t maxcount = ARG2(scan);\n\t\t}\n\t\tnext = regnext(scan);\n\t\tif (OP(scan) == CURLYX) {\n\t\t I32 lp = (data ? *(data->last_closep) : 0);\n\t\t scan->flags = ((lp <= (I32)U8_MAX) ? (U8)lp : U8_MAX);\n\t\t}\n\t\tscan = NEXTOPER(scan) + EXTRA_STEP_2ARGS;\n\t\tnext_is_eval = (OP(scan) == EVAL);\n\t do_curly:\n\t\tif (flags & SCF_DO_SUBSTR) {\n if (mincount == 0)\n scan_commit(pRExC_state, data, minlenp, is_inf);\n /* Cannot extend fixed substrings */\n\t\t pos_before = data->pos_min;\n\t\t}\n\t\tif (data) {\n\t\t fl = data->flags;\n\t\t data->flags &= ~(SF_HAS_PAR|SF_IN_PAR|SF_HAS_EVAL);\n\t\t if (is_inf)\n\t\t\tdata->flags |= SF_IS_INF;\n\t\t}\n\t\tif (flags & SCF_DO_STCLASS) {\n\t\t ssc_init(pRExC_state, &this_class);\n\t\t oclass = data->start_class;\n\t\t data->start_class = &this_class;\n\t\t f |= SCF_DO_STCLASS_AND;\n\t\t f &= ~SCF_DO_STCLASS_OR;\n\t\t}\n\t /* Exclude from super-linear cache processing any {n,m}\n\t\t regops for which the combination of input pos and regex\n\t\t pos is not enough information to determine if a match\n\t\t will be possible.\n\n\t\t For example, in the regex /foo(bar\\s*){4,8}baz/ with the\n\t\t regex pos at the \\s*, the prospects for a match depend not\n\t\t only on the input position but also on how many (bar\\s*)\n\t\t repeats into the {4,8} we are. */\n if ((mincount > 1) || (maxcount > 1 && maxcount != REG_INFTY))\n\t\t f &= ~SCF_WHILEM_VISITED_POS;\n\n\t\t/* This will finish on WHILEM, setting scan, or on NULL: */\n /* recurse study_chunk() on loop bodies */\n\t\tminnext = study_chunk(pRExC_state, &scan, minlenp, &deltanext,\n last, data, stopparen, recursed_depth, NULL,\n (mincount == 0\n ? (f & ~SCF_DO_SUBSTR)\n : f)\n ,depth+1);\n\n\t\tif (flags & SCF_DO_STCLASS)\n\t\t data->start_class = oclass;\n\t\tif (mincount == 0 || minnext == 0) {\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\tssc_or(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t }\n\t\t else if (flags & SCF_DO_STCLASS_AND) {\n\t\t\t/* Switch to OR mode: cache the old value of\n\t\t\t * data->start_class */\n\t\t\tINIT_AND_WITHP;\n\t\t\tStructCopy(data->start_class, and_withp, regnode_ssc);\n\t\t\tflags &= ~SCF_DO_STCLASS_AND;\n\t\t\tStructCopy(&this_class, data->start_class, regnode_ssc);\n\t\t\tflags |= SCF_DO_STCLASS_OR;\n ANYOF_FLAGS(data->start_class)\n |= SSC_MATCHES_EMPTY_STRING;\n\t\t }\n\t\t} else {\t\t/* Non-zero len */\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\tssc_or(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\t }\n\t\t else if (flags & SCF_DO_STCLASS_AND)\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t flags &= ~SCF_DO_STCLASS;\n\t\t}\n\t\tif (!scan) \t\t/* It was not CURLYX, but CURLY. */\n\t\t scan = next;\n\t\tif (((flags & (SCF_TRIE_DOING_RESTUDY|SCF_DO_SUBSTR))==SCF_DO_SUBSTR)\n\t\t /* ? quantifier ok, except for (?{ ... }) */\n\t\t && (next_is_eval || !(mincount == 0 && maxcount == 1))\n\t\t && (minnext == 0) && (deltanext == 0)\n\t\t && data && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))\n && maxcount <= REG_INFTY/3) /* Complement check for big\n count */\n\t\t{\n\t\t _WARN_HELPER(RExC_precomp_end, packWARN(WARN_REGEXP),\n Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP),\n \"Quantifier unexpected on zero-length expression \"\n \"in regex m/%\" UTF8f \"/\",\n\t\t\t UTF8fARG(UTF, RExC_precomp_end - RExC_precomp,\n\t\t\t\t RExC_precomp)));\n }\n\n if ( ( minnext > 0 && mincount >= SSize_t_MAX / minnext )\n || min >= SSize_t_MAX - minnext * mincount )\n {\n FAIL(\"Regexp out of space\");\n }\n\n\t\tmin += minnext * mincount;\n\t\tis_inf_internal |= deltanext == SSize_t_MAX\n || (maxcount == REG_INFTY && minnext + deltanext > 0);\n\t\tis_inf |= is_inf_internal;\n if (is_inf) {\n\t\t delta = SSize_t_MAX;\n } else {\n\t\t delta += (minnext + deltanext) * maxcount\n - minnext * mincount;\n }\n\t\t/* Try powerful optimization CURLYX => CURLYN. */\n\t\tif ( OP(oscan) == CURLYX && data\n\t\t && data->flags & SF_IN_PAR\n\t\t && !(data->flags & SF_HAS_EVAL)\n\t\t && !deltanext && minnext == 1 ) {\n\t\t /* Try to optimize to CURLYN. */\n\t\t regnode *nxt = NEXTOPER(oscan) + EXTRA_STEP_2ARGS;\n\t\t regnode * const nxt1 = nxt;\n#ifdef DEBUGGING\n\t\t regnode *nxt2;\n#endif\n\n\t\t /* Skip open. */\n\t\t nxt = regnext(nxt);\n\t\t if (!REGNODE_SIMPLE(OP(nxt))\n\t\t\t&& !(PL_regkind[OP(nxt)] == EXACT\n\t\t\t && STR_LEN(nxt) == 1))\n\t\t\tgoto nogo;\n#ifdef DEBUGGING\n\t\t nxt2 = nxt;\n#endif\n\t\t nxt = regnext(nxt);\n\t\t if (OP(nxt) != CLOSE)\n\t\t\tgoto nogo;\n\t\t if (RExC_open_parens) {\n\n /*open->CURLYM*/\n RExC_open_parens[ARG(nxt1)] = REGNODE_OFFSET(oscan);\n\n /*close->while*/\n RExC_close_parens[ARG(nxt1)] = REGNODE_OFFSET(nxt) + 2;\n\t\t }\n\t\t /* Now we know that nxt2 is the only contents: */\n\t\t oscan->flags = (U8)ARG(nxt);\n\t\t OP(oscan) = CURLYN;\n\t\t OP(nxt1) = NOTHING;\t/* was OPEN. */\n\n#ifdef DEBUGGING\n\t\t OP(nxt1 + 1) = OPTIMIZED; /* was count. */\n\t\t NEXT_OFF(nxt1+ 1) = 0; /* just for consistency. */\n\t\t NEXT_OFF(nxt2) = 0;\t/* just for consistency with CURLY. */\n\t\t OP(nxt) = OPTIMIZED;\t/* was CLOSE. */\n\t\t OP(nxt + 1) = OPTIMIZED; /* was count. */\n\t\t NEXT_OFF(nxt+ 1) = 0; /* just for consistency. */\n#endif\n\t\t}\n\t nogo:\n\n\t\t/* Try optimization CURLYX => CURLYM. */\n\t\tif ( OP(oscan) == CURLYX && data\n\t\t && !(data->flags & SF_HAS_PAR)\n\t\t && !(data->flags & SF_HAS_EVAL)\n\t\t && !deltanext\t/* atom is fixed width */\n\t\t && minnext != 0\t/* CURLYM can't handle zero width */\n\n /* Nor characters whose fold at run-time may be\n * multi-character */\n && ! (RExC_seen & REG_UNFOLDED_MULTI_SEEN)\n\t\t) {\n\t\t /* XXXX How to optimize if data == 0? */\n\t\t /* Optimize to a simpler form. */\n\t\t regnode *nxt = NEXTOPER(oscan) + EXTRA_STEP_2ARGS; /* OPEN */\n\t\t regnode *nxt2;\n\n\t\t OP(oscan) = CURLYM;\n\t\t while ( (nxt2 = regnext(nxt)) /* skip over embedded stuff*/\n\t\t\t && (OP(nxt2) != WHILEM))\n\t\t\tnxt = nxt2;\n\t\t OP(nxt2) = SUCCEED; /* Whas WHILEM */\n\t\t /* Need to optimize away parenths. */\n\t\t if ((data->flags & SF_IN_PAR) && OP(nxt) == CLOSE) {\n\t\t\t/* Set the parenth number. */\n\t\t\tregnode *nxt1 = NEXTOPER(oscan) + EXTRA_STEP_2ARGS; /* OPEN*/\n\n\t\t\toscan->flags = (U8)ARG(nxt);\n\t\t\tif (RExC_open_parens) {\n /*open->CURLYM*/\n RExC_open_parens[ARG(nxt1)] = REGNODE_OFFSET(oscan);\n\n /*close->NOTHING*/\n RExC_close_parens[ARG(nxt1)] = REGNODE_OFFSET(nxt2)\n + 1;\n\t\t\t}\n\t\t\tOP(nxt1) = OPTIMIZED;\t/* was OPEN. */\n\t\t\tOP(nxt) = OPTIMIZED;\t/* was CLOSE. */\n\n#ifdef DEBUGGING\n\t\t\tOP(nxt1 + 1) = OPTIMIZED; /* was count. */\n\t\t\tOP(nxt + 1) = OPTIMIZED; /* was count. */\n\t\t\tNEXT_OFF(nxt1 + 1) = 0; /* just for consistency. */\n\t\t\tNEXT_OFF(nxt + 1) = 0; /* just for consistency. */\n#endif\n#if 0\n\t\t\twhile ( nxt1 && (OP(nxt1) != WHILEM)) {\n\t\t\t regnode *nnxt = regnext(nxt1);\n\t\t\t if (nnxt == nxt) {\n\t\t\t\tif (reg_off_by_arg[OP(nxt1)])\n\t\t\t\t ARG_SET(nxt1, nxt2 - nxt1);\n\t\t\t\telse if (nxt2 - nxt1 < U16_MAX)\n\t\t\t\t NEXT_OFF(nxt1) = nxt2 - nxt1;\n\t\t\t\telse\n\t\t\t\t OP(nxt) = NOTHING;\t/* Cannot beautify */\n\t\t\t }\n\t\t\t nxt1 = nnxt;\n\t\t\t}\n#endif\n\t\t\t/* Optimize again: */\n /* recurse study_chunk() on optimised CURLYX => CURLYM */\n\t\t\tstudy_chunk(pRExC_state, &nxt1, minlenp, &deltanext, nxt,\n NULL, stopparen, recursed_depth, NULL, 0,\n depth+1);\n\t\t }\n\t\t else\n\t\t\toscan->flags = 0;\n\t\t}\n\t\telse if ((OP(oscan) == CURLYX)\n\t\t\t && (flags & SCF_WHILEM_VISITED_POS)\n\t\t\t /* See the comment on a similar expression above.\n\t\t\t However, this time it's not a subexpression\n\t\t\t we care about, but the expression itself. */\n\t\t\t && (maxcount == REG_INFTY)\n\t\t\t && data) {\n\t\t /* This stays as CURLYX, we can put the count/of pair. */\n\t\t /* Find WHILEM (as in regexec.c) */\n\t\t regnode *nxt = oscan + NEXT_OFF(oscan);\n\n\t\t if (OP(PREVOPER(nxt)) == NOTHING) /* LONGJMP */\n\t\t\tnxt += ARG(nxt);\n nxt = PREVOPER(nxt);\n if (nxt->flags & 0xf) {\n /* we've already set whilem count on this node */\n } else if (++data->whilem_c < 16) {\n assert(data->whilem_c <= RExC_whilem_seen);\n nxt->flags = (U8)(data->whilem_c\n | (RExC_whilem_seen << 4)); /* On WHILEM */\n }\n\t\t}\n\t\tif (data && fl & (SF_HAS_PAR|SF_IN_PAR))\n\t\t pars++;\n\t\tif (flags & SCF_DO_SUBSTR) {\n\t\t SV *last_str = NULL;\n STRLEN last_chrs = 0;\n\t\t int counted = mincount != 0;\n\n if (data->last_end > 0 && mincount != 0) { /* Ends with a\n string. */\n\t\t\tSSize_t b = pos_before >= data->last_start_min\n\t\t\t ? pos_before : data->last_start_min;\n\t\t\tSTRLEN l;\n\t\t\tconst char * const s = SvPV_const(data->last_found, l);\n\t\t\tSSize_t old = b - data->last_start_min;\n assert(old >= 0);\n\n\t\t\tif (UTF)\n\t\t\t old = utf8_hop_forward((U8*)s, old,\n (U8 *) SvEND(data->last_found))\n - (U8*)s;\n\t\t\tl -= old;\n\t\t\t/* Get the added string: */\n\t\t\tlast_str = newSVpvn_utf8(s + old, l, UTF);\n last_chrs = UTF ? utf8_length((U8*)(s + old),\n (U8*)(s + old + l)) : l;\n\t\t\tif (deltanext == 0 && pos_before == b) {\n\t\t\t /* What was added is a constant string */\n\t\t\t if (mincount > 1) {\n\n\t\t\t\tSvGROW(last_str, (mincount * l) + 1);\n\t\t\t\trepeatcpy(SvPVX(last_str) + l,\n\t\t\t\t\t SvPVX_const(last_str), l,\n mincount - 1);\n\t\t\t\tSvCUR_set(last_str, SvCUR(last_str) * mincount);\n\t\t\t\t/* Add additional parts. */\n\t\t\t\tSvCUR_set(data->last_found,\n\t\t\t\t\t SvCUR(data->last_found) - l);\n\t\t\t\tsv_catsv(data->last_found, last_str);\n\t\t\t\t{\n\t\t\t\t SV * sv = data->last_found;\n\t\t\t\t MAGIC *mg =\n\t\t\t\t\tSvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\t\t\t\t if (mg && mg->mg_len >= 0)\n\t\t\t\t\tmg->mg_len += last_chrs * (mincount-1);\n\t\t\t\t}\n last_chrs *= mincount;\n\t\t\t\tdata->last_end += l * (mincount - 1);\n\t\t\t }\n\t\t\t} else {\n\t\t\t /* start offset must point into the last copy */\n\t\t\t data->last_start_min += minnext * (mincount - 1);\n\t\t\t data->last_start_max =\n is_inf\n ? SSize_t_MAX\n\t\t\t : data->last_start_max +\n (maxcount - 1) * (minnext + data->pos_delta);\n\t\t\t}\n\t\t }\n\t\t /* It is counted once already... */\n\t\t data->pos_min += minnext * (mincount - counted);\n#if 0\nPerl_re_printf( aTHX_ \"counted=%\" UVuf \" deltanext=%\" UVuf\n \" SSize_t_MAX=%\" UVuf \" minnext=%\" UVuf\n \" maxcount=%\" UVuf \" mincount=%\" UVuf \"\\n\",\n (UV)counted, (UV)deltanext, (UV)SSize_t_MAX, (UV)minnext, (UV)maxcount,\n (UV)mincount);\nif (deltanext != SSize_t_MAX)\nPerl_re_printf( aTHX_ \"LHS=%\" UVuf \" RHS=%\" UVuf \"\\n\",\n (UV)(-counted * deltanext + (minnext + deltanext) * maxcount\n - minnext * mincount), (UV)(SSize_t_MAX - data->pos_delta));\n#endif\n\t\t if (deltanext == SSize_t_MAX\n || -counted * deltanext + (minnext + deltanext) * maxcount - minnext * mincount >= SSize_t_MAX - data->pos_delta)\n\t\t data->pos_delta = SSize_t_MAX;\n\t\t else\n\t\t data->pos_delta += - counted * deltanext +\n\t\t\t(minnext + deltanext) * maxcount - minnext * mincount;\n\t\t if (mincount != maxcount) {\n\t\t\t /* Cannot extend fixed substrings found inside\n\t\t\t the group. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t\tif (mincount && last_str) {\n\t\t\t SV * const sv = data->last_found;\n\t\t\t MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\n\t\t\t if (mg)\n\t\t\t\tmg->mg_len = -1;\n\t\t\t sv_setsv(sv, last_str);\n\t\t\t data->last_end = data->pos_min;\n\t\t\t data->last_start_min = data->pos_min - last_chrs;\n\t\t\t data->last_start_max = is_inf\n\t\t\t\t? SSize_t_MAX\n\t\t\t\t: data->pos_min + data->pos_delta - last_chrs;\n\t\t\t}\n\t\t\tdata->cur_is_floating = 1; /* float */\n\t\t }\n\t\t SvREFCNT_dec(last_str);\n\t\t}\n\t\tif (data && (fl & SF_HAS_EVAL))\n\t\t data->flags |= SF_HAS_EVAL;\n\t optimize_curly_tail:\n\t\tif (OP(oscan) != CURLYX) {\n\t\t while (PL_regkind[OP(next = regnext(oscan))] == NOTHING\n\t\t\t && NEXT_OFF(next))\n\t\t\tNEXT_OFF(oscan) += NEXT_OFF(next);\n\t\t}\n\t\tcontinue;\n\n\t default:\n#ifdef DEBUGGING\n Perl_croak(aTHX_ \"panic: unexpected varying REx opcode %d\",\n OP(scan));\n#endif\n case REF:\n case CLUMP:\n\t\tif (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t\tis_inf = is_inf_internal = 1;\n\t\tif (flags & SCF_DO_STCLASS_OR) {\n if (OP(scan) == CLUMP) {\n /* Actually is any start char, but very few code points\n * aren't start characters */\n ssc_match_all_cp(data->start_class);\n }\n else {\n ssc_anything(data->start_class);\n }\n }\n\t\tflags &= ~SCF_DO_STCLASS;\n\t\tbreak;\n\t }\n\t}\n\telse if (OP(scan) == LNBREAK) {\n\t if (flags & SCF_DO_STCLASS) {\n \t if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class,\n PL_XPosix_ptrs[_CC_VERTSPACE], FALSE);\n ssc_clear_locale(data->start_class);\n ANYOF_FLAGS(data->start_class)\n &= ~SSC_MATCHES_EMPTY_STRING;\n }\n else if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class,\n PL_XPosix_ptrs[_CC_VERTSPACE],\n FALSE);\n\t\t ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg for\n * 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class)\n &= ~SSC_MATCHES_EMPTY_STRING;\n }\n\t\tflags &= ~SCF_DO_STCLASS;\n }\n\t min++;\n if (delta != SSize_t_MAX)\n delta++; /* Because of the 2 char string cr-lf */\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n \t data->pos_min += 1;\n if (data->pos_delta != SSize_t_MAX) {\n data->pos_delta += 1;\n }\n\t\tdata->cur_is_floating = 1; /* float */\n \t }\n\t}\n\telse if (REGNODE_SIMPLE(OP(scan))) {\n\n\t if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\tdata->pos_min++;\n\t }\n\t min++;\n\t if (flags & SCF_DO_STCLASS) {\n bool invert = 0;\n SV* my_invlist = NULL;\n U8 namedclass;\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n\n\t\t/* Some of the logic below assumes that switching\n\t\t locale on will only add false positives. */\n\t\tswitch (OP(scan)) {\n\n\t\tdefault:\n#ifdef DEBUGGING\n Perl_croak(aTHX_ \"panic: unexpected simple REx opcode %d\",\n OP(scan));\n#endif\n\t\tcase SANY:\n\t\t if (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n\t\t\tssc_match_all_cp(data->start_class);\n\t\t break;\n\n\t\tcase REG_ANY:\n {\n SV* REG_ANY_invlist = _new_invlist(2);\n REG_ANY_invlist = add_cp_to_invlist(REG_ANY_invlist,\n '\\n');\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class,\n REG_ANY_invlist,\n TRUE /* TRUE => invert, hence all but \\n\n */\n );\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class,\n REG_ANY_invlist,\n TRUE /* TRUE => invert */\n );\n ssc_clear_locale(data->start_class);\n }\n SvREFCNT_dec_NN(REG_ANY_invlist);\n\t\t }\n\t\t break;\n\n case ANYOFD:\n case ANYOFL:\n case ANYOFPOSIXL:\n case ANYOFH:\n case ANYOF:\n\t\t if (flags & SCF_DO_STCLASS_AND)\n\t\t\tssc_and(pRExC_state, data->start_class,\n (regnode_charclass *) scan);\n\t\t else\n\t\t\tssc_or(pRExC_state, data->start_class,\n (regnode_charclass *) scan);\n\t\t break;\n\n case NANYOFM:\n case ANYOFM:\n {\n SV* cp_list = get_ANYOFM_contents(scan);\n\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class, cp_list, invert);\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class, cp_list, invert);\n }\n\n SvREFCNT_dec_NN(cp_list);\n break;\n }\n\n\t\tcase NPOSIXL:\n invert = 1;\n /* FALLTHROUGH */\n\n\t\tcase POSIXL:\n namedclass = classnum_to_namedclass(FLAGS(scan)) + invert;\n if (flags & SCF_DO_STCLASS_AND) {\n bool was_there = cBOOL(\n ANYOF_POSIXL_TEST(data->start_class,\n namedclass));\n ANYOF_POSIXL_ZERO(data->start_class);\n if (was_there) { /* Do an AND */\n ANYOF_POSIXL_SET(data->start_class, namedclass);\n }\n /* No individual code points can now match */\n data->start_class->invlist\n = sv_2mortal(_new_invlist(0));\n }\n else {\n int complement = namedclass + ((invert) ? -1 : 1);\n\n assert(flags & SCF_DO_STCLASS_OR);\n\n /* If the complement of this class was already there,\n * the result is that they match all code points,\n * (\\d + \\D == everything). Remove the classes from\n * future consideration. Locale is not relevant in\n * this case */\n if (ANYOF_POSIXL_TEST(data->start_class, complement)) {\n ssc_match_all_cp(data->start_class);\n ANYOF_POSIXL_CLEAR(data->start_class, namedclass);\n ANYOF_POSIXL_CLEAR(data->start_class, complement);\n }\n else { /* The usual case; just add this class to the\n existing set */\n ANYOF_POSIXL_SET(data->start_class, namedclass);\n }\n }\n break;\n\n case NPOSIXA: /* For these, we always know the exact set of\n what's matched */\n invert = 1;\n /* FALLTHROUGH */\n\t\tcase POSIXA:\n my_invlist = invlist_clone(PL_Posix_ptrs[FLAGS(scan)], NULL);\n goto join_posix_and_ascii;\n\n\t\tcase NPOSIXD:\n\t\tcase NPOSIXU:\n invert = 1;\n /* FALLTHROUGH */\n\t\tcase POSIXD:\n\t\tcase POSIXU:\n my_invlist = invlist_clone(PL_XPosix_ptrs[FLAGS(scan)], NULL);\n\n /* NPOSIXD matches all upper Latin1 code points unless the\n * target string being matched is UTF-8, which is\n * unknowable until match time. Since we are going to\n * invert, we want to get rid of all of them so that the\n * inversion will match all */\n if (OP(scan) == NPOSIXD) {\n _invlist_subtract(my_invlist, PL_UpperLatin1,\n &my_invlist);\n }\n\n join_posix_and_ascii:\n\n if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class, my_invlist, invert);\n ssc_clear_locale(data->start_class);\n }\n else {\n assert(flags & SCF_DO_STCLASS_OR);\n ssc_union(data->start_class, my_invlist, invert);\n }\n SvREFCNT_dec(my_invlist);\n\t\t}\n\t\tif (flags & SCF_DO_STCLASS_OR)\n\t\t ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\tflags &= ~SCF_DO_STCLASS;\n\t }\n\t}\n\telse if (PL_regkind[OP(scan)] == EOL && flags & SCF_DO_SUBSTR) {\n\t data->flags |= (OP(scan) == MEOL\n\t\t\t ? SF_BEFORE_MEOL\n\t\t\t : SF_BEFORE_SEOL);\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\n\t}\n\telse if ( PL_regkind[OP(scan)] == BRANCHJ\n\t\t /* Lookbehind, or need to calculate parens/evals/stclass: */\n\t\t && (scan->flags || data || (flags & SCF_DO_STCLASS))\n\t\t && (OP(scan) == IFMATCH || OP(scan) == UNLESSM))\n {\n if ( !PERL_ENABLE_POSITIVE_ASSERTION_STUDY\n || OP(scan) == UNLESSM )\n {\n /* Negative Lookahead/lookbehind\n In this case we can't do fixed string optimisation.\n */\n\n SSize_t deltanext, minnext, fake = 0;\n regnode *nscan;\n regnode_ssc intrnl;\n int f = 0;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n if (data) {\n data_fake.whilem_c = data->whilem_c;\n data_fake.last_closep = data->last_closep;\n\t\t}\n else\n data_fake.last_closep = &fake;\n\t\tdata_fake.pos_delta = delta;\n if ( flags & SCF_DO_STCLASS && !scan->flags\n && OP(scan) == IFMATCH ) { /* Lookahead */\n ssc_init(pRExC_state, &intrnl);\n data_fake.start_class = &intrnl;\n f |= SCF_DO_STCLASS_AND;\n\t\t}\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n next = regnext(scan);\n nscan = NEXTOPER(NEXTOPER(scan));\n\n /* recurse study_chunk() for lookahead body */\n minnext = study_chunk(pRExC_state, &nscan, minlenp, &deltanext,\n last, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n if (scan->flags) {\n if ( deltanext < 0\n || deltanext > (I32) U8_MAX\n || minnext > (I32)U8_MAX\n || minnext + deltanext > (I32)U8_MAX)\n {\n\t\t\tFAIL2(\"Lookbehind longer than %\" UVuf \" not implemented\",\n (UV)U8_MAX);\n }\n\n /* The 'next_off' field has been repurposed to count the\n * additional starting positions to try beyond the initial\n * one. (This leaves it at 0 for non-variable length\n * matches to avoid breakage for those not using this\n * extension) */\n if (deltanext) {\n scan->next_off = deltanext;\n ckWARNexperimental(RExC_parse,\n WARN_EXPERIMENTAL__VLB,\n \"Variable length lookbehind is experimental\");\n }\n scan->flags = (U8)minnext + deltanext;\n }\n if (data) {\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n }\n if (f & SCF_DO_STCLASS_AND) {\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\t/* OR before, AND after: ideally we would recurse with\n\t\t\t * data_fake to get the AND applied by study of the\n\t\t\t * remainder of the pattern, and then derecurse;\n\t\t\t * *** HACK *** for now just treat as \"no information\".\n\t\t\t * See [perl #56690].\n\t\t\t */\n\t\t\tssc_init(pRExC_state, data->start_class);\n\t\t } else {\n /* AND before and after: combine and continue. These\n * assertions are zero-length, so can match an EMPTY\n * string */\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &intrnl);\n ANYOF_FLAGS(data->start_class)\n |= SSC_MATCHES_EMPTY_STRING;\n\t\t }\n }\n\t }\n#if PERL_ENABLE_POSITIVE_ASSERTION_STUDY\n else {\n /* Positive Lookahead/lookbehind\n In this case we can do fixed string optimisation,\n but we must be careful about it. Note in the case of\n lookbehind the positions will be offset by the minimum\n length of the pattern, something we won't know about\n until after the recurse.\n */\n SSize_t deltanext, fake = 0;\n regnode *nscan;\n regnode_ssc intrnl;\n int f = 0;\n /* We use SAVEFREEPV so that when the full compile\n is finished perl will clean up the allocated\n minlens when it's all done. This way we don't\n have to worry about freeing them when we know\n they wont be used, which would be a pain.\n */\n SSize_t *minnextp;\n Newx( minnextp, 1, SSize_t );\n SAVEFREEPV(minnextp);\n\n if (data) {\n StructCopy(data, &data_fake, scan_data_t);\n if ((flags & SCF_DO_SUBSTR) && data->last_found) {\n f |= SCF_DO_SUBSTR;\n if (scan->flags)\n scan_commit(pRExC_state, &data_fake, minlenp, is_inf);\n data_fake.last_found=newSVsv(data->last_found);\n }\n }\n else\n data_fake.last_closep = &fake;\n data_fake.flags = 0;\n data_fake.substrs[0].flags = 0;\n data_fake.substrs[1].flags = 0;\n\t\tdata_fake.pos_delta = delta;\n if (is_inf)\n\t data_fake.flags |= SF_IS_INF;\n if ( flags & SCF_DO_STCLASS && !scan->flags\n && OP(scan) == IFMATCH ) { /* Lookahead */\n ssc_init(pRExC_state, &intrnl);\n data_fake.start_class = &intrnl;\n f |= SCF_DO_STCLASS_AND;\n }\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n next = regnext(scan);\n nscan = NEXTOPER(NEXTOPER(scan));\n\n /* positive lookahead study_chunk() recursion */\n *minnextp = study_chunk(pRExC_state, &nscan, minnextp,\n &deltanext, last, &data_fake,\n stopparen, recursed_depth, NULL,\n f, depth+1);\n if (scan->flags) {\n assert(0); /* This code has never been tested since this\n is normally not compiled */\n if ( deltanext < 0\n || deltanext > (I32) U8_MAX\n || *minnextp > (I32)U8_MAX\n || *minnextp + deltanext > (I32)U8_MAX)\n {\n\t\t\tFAIL2(\"Lookbehind longer than %\" UVuf \" not implemented\",\n (UV)U8_MAX);\n }\n\n if (deltanext) {\n scan->next_off = deltanext;\n }\n scan->flags = (U8)*minnextp + deltanext;\n }\n\n *minnextp += min;\n\n if (f & SCF_DO_STCLASS_AND) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &intrnl);\n ANYOF_FLAGS(data->start_class) |= SSC_MATCHES_EMPTY_STRING;\n }\n if (data) {\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n if ((flags & SCF_DO_SUBSTR) && data_fake.last_found) {\n int i;\n if (RExC_rx->minlen<*minnextp)\n RExC_rx->minlen=*minnextp;\n scan_commit(pRExC_state, &data_fake, minnextp, is_inf);\n SvREFCNT_dec_NN(data_fake.last_found);\n\n for (i = 0; i < 2; i++) {\n if (data_fake.substrs[i].minlenp != minlenp) {\n data->substrs[i].min_offset =\n data_fake.substrs[i].min_offset;\n data->substrs[i].max_offset =\n data_fake.substrs[i].max_offset;\n data->substrs[i].minlenp =\n data_fake.substrs[i].minlenp;\n data->substrs[i].lookbehind += scan->flags;\n }\n }\n }\n }\n\t }\n#endif\n\t}\n\n\telse if (OP(scan) == OPEN) {\n\t if (stopparen != (I32)ARG(scan))\n\t pars++;\n\t}\n\telse if (OP(scan) == CLOSE) {\n\t if (stopparen == (I32)ARG(scan)) {\n\t break;\n\t }\n\t if ((I32)ARG(scan) == is_par) {\n\t\tnext = regnext(scan);\n\n\t\tif ( next && (OP(next) != WHILEM) && next < last)\n\t\t is_par = 0;\t\t/* Disable optimization */\n\t }\n\t if (data)\n\t\t*(data->last_closep) = ARG(scan);\n\t}\n\telse if (OP(scan) == EVAL) {\n\t\tif (data)\n\t\t data->flags |= SF_HAS_EVAL;\n\t}\n\telse if ( PL_regkind[OP(scan)] == ENDLIKE ) {\n\t if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\tflags &= ~SCF_DO_SUBSTR;\n\t }\n\t if (data && OP(scan)==ACCEPT) {\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t if (stopmin > min)\n\t stopmin = min;\n\t }\n\t}\n\telse if (OP(scan) == LOGICAL && scan->flags == 2) /* Embedded follows */\n\t{\n\t\tif (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t\tis_inf = is_inf_internal = 1;\n\t\tif (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n\t\t ssc_anything(data->start_class);\n\t\tflags &= ~SCF_DO_STCLASS;\n\t}\n\telse if (OP(scan) == GPOS) {\n if (!(RExC_rx->intflags & PREGf_GPOS_FLOAT) &&\n\t !(delta || is_inf || (data && data->pos_delta)))\n\t {\n if (!(RExC_rx->intflags & PREGf_ANCH) && (flags & SCF_DO_SUBSTR))\n RExC_rx->intflags |= PREGf_ANCH_GPOS;\n\t if (RExC_rx->gofs < (STRLEN)min)\n\t\t RExC_rx->gofs = min;\n } else {\n RExC_rx->intflags |= PREGf_GPOS_FLOAT;\n RExC_rx->gofs = 0;\n }\n\t}\n#ifdef TRIE_STUDY_OPT\n#ifdef FULL_TRIE_STUDY\n else if (PL_regkind[OP(scan)] == TRIE) {\n /* NOTE - There is similar code to this block above for handling\n BRANCH nodes on the initial study. If you change stuff here\n check there too. */\n regnode *trie_node= scan;\n regnode *tail= regnext(scan);\n reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ];\n SSize_t max1 = 0, min1 = SSize_t_MAX;\n regnode_ssc accum;\n\n if (flags & SCF_DO_SUBSTR) { /* XXXX Add !SUSPEND? */\n /* Cannot merge strings after this. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n }\n if (flags & SCF_DO_STCLASS)\n ssc_init_zero(pRExC_state, &accum);\n\n if (!trie->jump) {\n min1= trie->minlen;\n max1= trie->maxlen;\n } else {\n const regnode *nextbranch= NULL;\n U32 word;\n\n for ( word=1 ; word <= trie->wordcount ; word++)\n {\n SSize_t deltanext=0, minnext=0, f = 0, fake;\n regnode_ssc this_class;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n if (data) {\n data_fake.whilem_c = data->whilem_c;\n data_fake.last_closep = data->last_closep;\n }\n else\n data_fake.last_closep = &fake;\n\t\t data_fake.pos_delta = delta;\n if (flags & SCF_DO_STCLASS) {\n ssc_init(pRExC_state, &this_class);\n data_fake.start_class = &this_class;\n f = SCF_DO_STCLASS_AND;\n }\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n\n if (trie->jump[word]) {\n if (!nextbranch)\n nextbranch = trie_node + trie->jump[0];\n scan= trie_node + trie->jump[word];\n /* We go from the jump point to the branch that follows\n it. Note this means we need the vestigal unused\n branches even though they arent otherwise used. */\n /* optimise study_chunk() for TRIE */\n minnext = study_chunk(pRExC_state, &scan, minlenp,\n &deltanext, (regnode *)nextbranch, &data_fake,\n stopparen, recursed_depth, NULL, f, depth+1);\n }\n if (nextbranch && PL_regkind[OP(nextbranch)]==BRANCH)\n nextbranch= regnext((regnode*)nextbranch);\n\n if (min1 > (SSize_t)(minnext + trie->minlen))\n min1 = minnext + trie->minlen;\n if (deltanext == SSize_t_MAX) {\n is_inf = is_inf_internal = 1;\n max1 = SSize_t_MAX;\n } else if (max1 < (SSize_t)(minnext + deltanext + trie->maxlen))\n max1 = minnext + deltanext + trie->maxlen;\n\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SCF_SEEN_ACCEPT) {\n if ( stopmin > min + min1)\n\t stopmin = min + min1;\n\t flags &= ~SCF_DO_SUBSTR;\n\t if (data)\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t }\n if (data) {\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n }\n if (flags & SCF_DO_STCLASS)\n ssc_or(pRExC_state, &accum, (regnode_charclass *) &this_class);\n }\n }\n if (flags & SCF_DO_SUBSTR) {\n data->pos_min += min1;\n data->pos_delta += max1 - min1;\n if (max1 != min1 || is_inf)\n data->cur_is_floating = 1; /* float */\n }\n min += min1;\n if (delta != SSize_t_MAX) {\n if (SSize_t_MAX - (max1 - min1) >= delta)\n delta += max1 - min1;\n else\n delta = SSize_t_MAX;\n }\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_or(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n if (min1) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n flags &= ~SCF_DO_STCLASS;\n }\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n if (min1) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n flags &= ~SCF_DO_STCLASS;\n }\n else {\n /* Switch to OR mode: cache the old value of\n * data->start_class */\n\t\t INIT_AND_WITHP;\n StructCopy(data->start_class, and_withp, regnode_ssc);\n flags &= ~SCF_DO_STCLASS_AND;\n StructCopy(&accum, data->start_class, regnode_ssc);\n flags |= SCF_DO_STCLASS_OR;\n }\n }\n scan= tail;\n continue;\n }\n#else\n\telse if (PL_regkind[OP(scan)] == TRIE) {\n\t reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ];\n\t U8*bang=NULL;\n\n\t min += trie->minlen;\n\t delta += (trie->maxlen - trie->minlen);\n\t flags &= ~SCF_DO_STCLASS; /* xxx */\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n \t data->pos_min += trie->minlen;\n \t data->pos_delta += (trie->maxlen - trie->minlen);\n\t\tif (trie->maxlen != trie->minlen)\n\t\t data->cur_is_floating = 1; /* float */\n \t }\n \t if (trie->jump) /* no more substrings -- for now /grr*/\n flags &= ~SCF_DO_SUBSTR;\n\t}\n#endif /* old or new */\n#endif /* TRIE_STUDY_OPT */\n\n\t/* Else: zero-length, ignore. */\n\tscan = regnext(scan);\n }\n\n finish:\n if (frame) {\n /* we need to unwind recursion. */\n depth = depth - 1;\n\n DEBUG_STUDYDATA(\"frame-end\", data, depth, is_inf);\n DEBUG_PEEP(\"fend\", scan, depth, flags);\n\n /* restore previous context */\n last = frame->last_regnode;\n scan = frame->next_regnode;\n stopparen = frame->stopparen;\n recursed_depth = frame->prev_recursed_depth;\n\n RExC_frame_last = frame->prev_frame;\n frame = frame->this_prev_frame;\n goto fake_study_recurse;\n }\n\n assert(!frame);\n DEBUG_STUDYDATA(\"pre-fin\", data, depth, is_inf);\n\n *scanp = scan;\n *deltap = is_inf_internal ? SSize_t_MAX : delta;\n\n if (flags & SCF_DO_SUBSTR && is_inf)\n\tdata->pos_delta = SSize_t_MAX - data->pos_min;\n if (is_par > (I32)U8_MAX)\n\tis_par = 0;\n if (is_par && pars==1 && data) {\n\tdata->flags |= SF_IN_PAR;\n\tdata->flags &= ~SF_HAS_PAR;\n }\n else if (pars && data) {\n\tdata->flags |= SF_HAS_PAR;\n\tdata->flags &= ~SF_IN_PAR;\n }\n if (flags & SCF_DO_STCLASS_OR)\n\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n if (flags & SCF_TRIE_RESTUDY)\n data->flags |= \tSCF_TRIE_RESTUDY;\n\n DEBUG_STUDYDATA(\"post-fin\", data, depth, is_inf);\n\n {\n SSize_t final_minlen= min < stopmin ? min : stopmin;\n\n if (!(RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN)) {\n if (final_minlen > SSize_t_MAX - delta)\n RExC_maxlen = SSize_t_MAX;\n else if (RExC_maxlen < final_minlen + delta)\n RExC_maxlen = final_minlen + delta;\n }\n return final_minlen;\n }\n NOT_REACHED; /* NOTREACHED */","lang":"c","vul_type":"cwe-787","target_token_count":19230,"sven_meta":{"func_name":"S_study_chunk","file_name":"regcomp.c","commit_link":"github.com/perl/perl5/commit/897d1f7fd515b828e4b198d8b8bef76c6faf03ed","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-079#0-21e64a3cf7ce","input":"void PeerListWidget::updatePeer(const QString &ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)\n{\n QStandardItem *item = m_peerItems.value(ip);\n int row = item->row();\n if (m_resolveCountries) {\n const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());\n if (!ico.isNull()) {\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);\n const QString countryName = Net::GeoIPManager::CountryName(peer.country());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), countryName, Qt::ToolTipRole);\n m_missingFlags.remove(ip);\n }\n }\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), peer.connectionType());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flags());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flagsDescription(), Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), peer.client());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PROGRESS), peer.progress());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payloadDownSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::UP_SPEED), peer.payloadUpSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_DOWN), peer.totalDownload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());\n QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\";\")));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\"\\n\")), Qt::ToolTipRole);\n}","target":"void PeerListWidget::updatePeer(const QString &ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)\n{\n QStandardItem *item = m_peerItems.value(ip);\n int row = item->row();\n if (m_resolveCountries) {\n const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());\n if (!ico.isNull()) {\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);\n const QString countryName = Net::GeoIPManager::CountryName(peer.country());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), countryName, Qt::ToolTipRole);\n m_missingFlags.remove(ip);\n }\n }\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), peer.connectionType());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flags());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flagsDescription(), Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), Utils::String::toHtmlEscaped(peer.client()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PROGRESS), peer.progress());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payloadDownSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::UP_SPEED), peer.payloadUpSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_DOWN), peer.totalDownload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());\n QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\";\")));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\"\\n\")), Qt::ToolTipRole);\n}","lang":"cpp","vul_type":"cwe-079","target_token_count":531,"sven_meta":{"func_name":"PeerListWidget::updatePeer","file_name":"src/gui/properties/peerlistwidget.cpp","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-190#0-0afd7accaf6c","input":"static void opj_get_encoding_parameters(const opj_image_t *p_image,\n const opj_cp_t *p_cp,\n OPJ_UINT32 p_tileno,\n OPJ_INT32 * p_tx0,\n OPJ_INT32 * p_tx1,\n OPJ_INT32 * p_ty0,\n OPJ_INT32 * p_ty1,\n OPJ_UINT32 * p_dx_min,\n OPJ_UINT32 * p_dy_min,\n OPJ_UINT32 * p_max_prec,\n OPJ_UINT32 * p_max_res)\n{\n /* loop */\n OPJ_UINT32 compno, resno;\n /* pointers */\n const opj_tcp_t *l_tcp = 00;\n const opj_tccp_t * l_tccp = 00;\n const opj_image_comp_t * l_img_comp = 00;\n\n /* position in x and y of tile */\n OPJ_UINT32 p, q;\n\n /* preconditions */\n assert(p_cp != 00);\n assert(p_image != 00);\n assert(p_tileno < p_cp->tw * p_cp->th);\n\n /* initializations */\n l_tcp = &p_cp->tcps [p_tileno];\n l_img_comp = p_image->comps;\n l_tccp = l_tcp->tccps;\n\n /* here calculation of tx0, tx1, ty0, ty1, maxprec, dx and dy */\n p = p_tileno % p_cp->tw;\n q = p_tileno / p_cp->tw;\n\n /* find extent of tile */\n *p_tx0 = opj_int_max((OPJ_INT32)(p_cp->tx0 + p * p_cp->tdx),\n (OPJ_INT32)p_image->x0);\n *p_tx1 = opj_int_min((OPJ_INT32)(p_cp->tx0 + (p + 1) * p_cp->tdx),\n (OPJ_INT32)p_image->x1);\n *p_ty0 = opj_int_max((OPJ_INT32)(p_cp->ty0 + q * p_cp->tdy),\n (OPJ_INT32)p_image->y0);\n *p_ty1 = opj_int_min((OPJ_INT32)(p_cp->ty0 + (q + 1) * p_cp->tdy),\n (OPJ_INT32)p_image->y1);\n\n /* max precision is 0 (can only grow) */\n *p_max_prec = 0;\n *p_max_res = 0;\n\n /* take the largest value for dx_min and dy_min */\n *p_dx_min = 0x7fffffff;\n *p_dy_min = 0x7fffffff;\n\n for (compno = 0; compno < p_image->numcomps; ++compno) {\n /* arithmetic variables to calculate */\n OPJ_UINT32 l_level_no;\n OPJ_INT32 l_rx0, l_ry0, l_rx1, l_ry1;\n OPJ_INT32 l_px0, l_py0, l_px1, py1;\n OPJ_UINT32 l_pdx, l_pdy;\n OPJ_UINT32 l_pw, l_ph;\n OPJ_UINT32 l_product;\n OPJ_INT32 l_tcx0, l_tcy0, l_tcx1, l_tcy1;\n\n l_tcx0 = opj_int_ceildiv(*p_tx0, (OPJ_INT32)l_img_comp->dx);\n l_tcy0 = opj_int_ceildiv(*p_ty0, (OPJ_INT32)l_img_comp->dy);\n l_tcx1 = opj_int_ceildiv(*p_tx1, (OPJ_INT32)l_img_comp->dx);\n l_tcy1 = opj_int_ceildiv(*p_ty1, (OPJ_INT32)l_img_comp->dy);\n\n if (l_tccp->numresolutions > *p_max_res) {\n *p_max_res = l_tccp->numresolutions;\n }\n\n /* use custom size for precincts */\n for (resno = 0; resno < l_tccp->numresolutions; ++resno) {\n OPJ_UINT32 l_dx, l_dy;\n\n /* precinct width and height */\n l_pdx = l_tccp->prcw[resno];\n l_pdy = l_tccp->prch[resno];\n\n l_dx = l_img_comp->dx * (1u << (l_pdx + l_tccp->numresolutions - 1 - resno));\n l_dy = l_img_comp->dy * (1u << (l_pdy + l_tccp->numresolutions - 1 - resno));\n\n /* take the minimum size for dx for each comp and resolution */\n *p_dx_min = opj_uint_min(*p_dx_min, l_dx);\n *p_dy_min = opj_uint_min(*p_dy_min, l_dy);\n\n /* various calculations of extents */\n l_level_no = l_tccp->numresolutions - 1 - resno;\n\n l_rx0 = opj_int_ceildivpow2(l_tcx0, (OPJ_INT32)l_level_no);\n l_ry0 = opj_int_ceildivpow2(l_tcy0, (OPJ_INT32)l_level_no);\n l_rx1 = opj_int_ceildivpow2(l_tcx1, (OPJ_INT32)l_level_no);\n l_ry1 = opj_int_ceildivpow2(l_tcy1, (OPJ_INT32)l_level_no);\n\n l_px0 = opj_int_floordivpow2(l_rx0, (OPJ_INT32)l_pdx) << l_pdx;\n l_py0 = opj_int_floordivpow2(l_ry0, (OPJ_INT32)l_pdy) << l_pdy;\n l_px1 = opj_int_ceildivpow2(l_rx1, (OPJ_INT32)l_pdx) << l_pdx;\n\n py1 = opj_int_ceildivpow2(l_ry1, (OPJ_INT32)l_pdy) << l_pdy;\n\n l_pw = (l_rx0 == l_rx1) ? 0 : (OPJ_UINT32)((l_px1 - l_px0) >> l_pdx);\n l_ph = (l_ry0 == l_ry1) ? 0 : (OPJ_UINT32)((py1 - l_py0) >> l_pdy);\n\n l_product = l_pw * l_ph;\n\n /* update precision */\n if (l_product > *p_max_prec) {\n *p_max_prec = l_product;\n }\n }\n ++l_img_comp;\n ++l_tccp;\n }\n}","target":"static void opj_get_encoding_parameters(const opj_image_t *p_image,\n const opj_cp_t *p_cp,\n OPJ_UINT32 p_tileno,\n OPJ_INT32 * p_tx0,\n OPJ_INT32 * p_tx1,\n OPJ_INT32 * p_ty0,\n OPJ_INT32 * p_ty1,\n OPJ_UINT32 * p_dx_min,\n OPJ_UINT32 * p_dy_min,\n OPJ_UINT32 * p_max_prec,\n OPJ_UINT32 * p_max_res)\n{\n /* loop */\n OPJ_UINT32 compno, resno;\n /* pointers */\n const opj_tcp_t *l_tcp = 00;\n const opj_tccp_t * l_tccp = 00;\n const opj_image_comp_t * l_img_comp = 00;\n\n /* position in x and y of tile */\n OPJ_UINT32 p, q;\n\n /* non-corrected (in regard to image offset) tile offset */\n OPJ_UINT32 l_tx0, l_ty0;\n\n /* preconditions */\n assert(p_cp != 00);\n assert(p_image != 00);\n assert(p_tileno < p_cp->tw * p_cp->th);\n\n /* initializations */\n l_tcp = &p_cp->tcps [p_tileno];\n l_img_comp = p_image->comps;\n l_tccp = l_tcp->tccps;\n\n /* here calculation of tx0, tx1, ty0, ty1, maxprec, dx and dy */\n p = p_tileno % p_cp->tw;\n q = p_tileno / p_cp->tw;\n\n /* find extent of tile */\n l_tx0 = p_cp->tx0 + p *\n p_cp->tdx; /* can't be greater than p_image->x1 so won't overflow */\n *p_tx0 = (OPJ_INT32)opj_uint_max(l_tx0, p_image->x0);\n *p_tx1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_tx0, p_cp->tdx), p_image->x1);\n l_ty0 = p_cp->ty0 + q *\n p_cp->tdy; /* can't be greater than p_image->y1 so won't overflow */\n *p_ty0 = (OPJ_INT32)opj_uint_max(l_ty0, p_image->y0);\n *p_ty1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_ty0, p_cp->tdy), p_image->y1);\n\n /* max precision is 0 (can only grow) */\n *p_max_prec = 0;\n *p_max_res = 0;\n\n /* take the largest value for dx_min and dy_min */\n *p_dx_min = 0x7fffffff;\n *p_dy_min = 0x7fffffff;\n\n for (compno = 0; compno < p_image->numcomps; ++compno) {\n /* arithmetic variables to calculate */\n OPJ_UINT32 l_level_no;\n OPJ_INT32 l_rx0, l_ry0, l_rx1, l_ry1;\n OPJ_INT32 l_px0, l_py0, l_px1, py1;\n OPJ_UINT32 l_pdx, l_pdy;\n OPJ_UINT32 l_pw, l_ph;\n OPJ_UINT32 l_product;\n OPJ_INT32 l_tcx0, l_tcy0, l_tcx1, l_tcy1;\n\n l_tcx0 = opj_int_ceildiv(*p_tx0, (OPJ_INT32)l_img_comp->dx);\n l_tcy0 = opj_int_ceildiv(*p_ty0, (OPJ_INT32)l_img_comp->dy);\n l_tcx1 = opj_int_ceildiv(*p_tx1, (OPJ_INT32)l_img_comp->dx);\n l_tcy1 = opj_int_ceildiv(*p_ty1, (OPJ_INT32)l_img_comp->dy);\n\n if (l_tccp->numresolutions > *p_max_res) {\n *p_max_res = l_tccp->numresolutions;\n }\n\n /* use custom size for precincts */\n for (resno = 0; resno < l_tccp->numresolutions; ++resno) {\n OPJ_UINT32 l_dx, l_dy;\n\n /* precinct width and height */\n l_pdx = l_tccp->prcw[resno];\n l_pdy = l_tccp->prch[resno];\n\n l_dx = l_img_comp->dx * (1u << (l_pdx + l_tccp->numresolutions - 1 - resno));\n l_dy = l_img_comp->dy * (1u << (l_pdy + l_tccp->numresolutions - 1 - resno));\n\n /* take the minimum size for dx for each comp and resolution */\n *p_dx_min = opj_uint_min(*p_dx_min, l_dx);\n *p_dy_min = opj_uint_min(*p_dy_min, l_dy);\n\n /* various calculations of extents */\n l_level_no = l_tccp->numresolutions - 1 - resno;\n\n l_rx0 = opj_int_ceildivpow2(l_tcx0, (OPJ_INT32)l_level_no);\n l_ry0 = opj_int_ceildivpow2(l_tcy0, (OPJ_INT32)l_level_no);\n l_rx1 = opj_int_ceildivpow2(l_tcx1, (OPJ_INT32)l_level_no);\n l_ry1 = opj_int_ceildivpow2(l_tcy1, (OPJ_INT32)l_level_no);\n\n l_px0 = opj_int_floordivpow2(l_rx0, (OPJ_INT32)l_pdx) << l_pdx;\n l_py0 = opj_int_floordivpow2(l_ry0, (OPJ_INT32)l_pdy) << l_pdy;\n l_px1 = opj_int_ceildivpow2(l_rx1, (OPJ_INT32)l_pdx) << l_pdx;\n\n py1 = opj_int_ceildivpow2(l_ry1, (OPJ_INT32)l_pdy) << l_pdy;\n\n l_pw = (l_rx0 == l_rx1) ? 0 : (OPJ_UINT32)((l_px1 - l_px0) >> l_pdx);\n l_ph = (l_ry0 == l_ry1) ? 0 : (OPJ_UINT32)((py1 - l_py0) >> l_pdy);\n\n l_product = l_pw * l_ph;\n\n /* update precision */\n if (l_product > *p_max_prec) {\n *p_max_prec = l_product;\n }\n }\n ++l_img_comp;\n ++l_tccp;\n }\n}","lang":"c","vul_type":"cwe-190","target_token_count":1576,"sven_meta":{"func_name":"opj_get_encoding_parameters","file_name":"src/lib/openjp2/pi.c","commit_link":"github.com/uclouvain/openjpeg/commit/c58df149900df862806d0e892859b41115875845","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#1-6e0d3ab5ecf1","input":"void rfbScaledScreenUpdateRect(rfbScreenInfoPtr screen, rfbScreenInfoPtr ptr, int x0, int y0, int w0, int h0)\n{\n int x,y,w,v,z;\n int x1, y1, w1, h1;\n int bitsPerPixel, bytesPerPixel, bytesPerLine, areaX, areaY, area2;\n unsigned char *srcptr, *dstptr;\n\n /* Nothing to do!!! */\n if (screen==ptr) return;\n\n x1 = x0;\n y1 = y0;\n w1 = w0;\n h1 = h0;\n\n rfbScaledCorrection(screen, ptr, &x1, &y1, &w1, &h1, \"rfbScaledScreenUpdateRect\");\n x0 = ScaleX(ptr, screen, x1);\n y0 = ScaleY(ptr, screen, y1);\n w0 = ScaleX(ptr, screen, w1);\n h0 = ScaleY(ptr, screen, h1);\n\n bitsPerPixel = screen->bitsPerPixel;\n bytesPerPixel = bitsPerPixel / 8;\n bytesPerLine = w1 * bytesPerPixel;\n srcptr = (unsigned char *)(screen->frameBuffer +\n (y0 * screen->paddedWidthInBytes + x0 * bytesPerPixel));\n dstptr = (unsigned char *)(ptr->frameBuffer +\n ( y1 * ptr->paddedWidthInBytes + x1 * bytesPerPixel));\n /* The area of the source framebuffer for each destination pixel */\n areaX = ScaleX(ptr,screen,1);\n areaY = ScaleY(ptr,screen,1);\n area2 = areaX*areaY;\n\n\n /* Ensure that we do not go out of bounds */\n if ((x1+w1) > (ptr->width))\n {\n if (x1==0) w1=ptr->width; else x1 = ptr->width - w1;\n }\n if ((y1+h1) > (ptr->height))\n {\n if (y1==0) h1=ptr->height; else y1 = ptr->height - h1;\n }\n /*\n * rfbLog(\"rfbScaledScreenUpdateRect(%dXx%dY-%dWx%dH -> %dXx%dY-%dWx%dH <%dx%d>) {%dWx%dH -> %dWx%dH} 0x%p\\n\",\n * x0, y0, w0, h0, x1, y1, w1, h1, areaX, areaY,\n * screen->width, screen->height, ptr->width, ptr->height, ptr->frameBuffer);\n */\n\n if (screen->serverFormat.trueColour) { /* Blend neighbouring pixels together */\n unsigned char *srcptr2;\n unsigned long pixel_value, red, green, blue;\n unsigned int redShift = screen->serverFormat.redShift;\n unsigned int greenShift = screen->serverFormat.greenShift;\n unsigned int blueShift = screen->serverFormat.blueShift;\n unsigned long redMax = screen->serverFormat.redMax;\n unsigned long greenMax = screen->serverFormat.greenMax;\n unsigned long blueMax = screen->serverFormat.blueMax;\n\n /* for each *destination* pixel... */\n for (y = 0; y < h1; y++) {\n for (x = 0; x < w1; x++) {\n red = green = blue = 0;\n /* Get the totals for rgb from the source grid... */\n for (w = 0; w < areaX; w++) {\n for (v = 0; v < areaY; v++) {\n srcptr2 = &srcptr[(((x * areaX) + w) * bytesPerPixel) +\n (v * screen->paddedWidthInBytes)];\n pixel_value = 0;\n\n\n switch (bytesPerPixel) {\n case 4: pixel_value = *((unsigned int *)srcptr2); break;\n case 2: pixel_value = *((unsigned short *)srcptr2); break;\n case 1: pixel_value = *((unsigned char *)srcptr2); break;\n default:\n /* fixme: endianness problem? */\n for (z = 0; z < bytesPerPixel; z++)\n pixel_value += (srcptr2[z] << (8 * z));\n break;\n }\n /*\n srcptr2 += bytesPerPixel;\n */\n\n red += ((pixel_value >> redShift) & redMax);\n green += ((pixel_value >> greenShift) & greenMax);\n blue += ((pixel_value >> blueShift) & blueMax);\n\n }\n }\n /* We now have a total for all of the colors, find the average! */\n red /= area2;\n green /= area2;\n blue /= area2;\n /* Stuff the new value back into memory */\n pixel_value = ((red & redMax) << redShift) | ((green & greenMax) << greenShift) | ((blue & blueMax) << blueShift);\n\n switch (bytesPerPixel) {\n case 4: *((unsigned int *)dstptr) = (unsigned int) pixel_value; break;\n case 2: *((unsigned short *)dstptr) = (unsigned short) pixel_value; break;\n case 1: *((unsigned char *)dstptr) = (unsigned char) pixel_value; break;\n default:\n /* fixme: endianness problem? */\n for (z = 0; z < bytesPerPixel; z++)\n dstptr[z]=(pixel_value >> (8 * z)) & 0xff;\n break;\n }\n dstptr += bytesPerPixel;\n }\n srcptr += (screen->paddedWidthInBytes * areaY);\n dstptr += (ptr->paddedWidthInBytes - bytesPerLine);\n }\n } else\n { /* Not truecolour, so we can't blend. Just use the top-left pixel instead */\n for (y = y1; y < (y1+h1); y++) {\n for (x = x1; x < (x1+w1); x++)\n memcpy (&ptr->frameBuffer[(y *ptr->paddedWidthInBytes) + (x * bytesPerPixel)],\n &screen->frameBuffer[(y * areaY * screen->paddedWidthInBytes) + (x *areaX * bytesPerPixel)], bytesPerPixel);\n }\n }\n}","target":"void rfbScaledScreenUpdateRect(rfbScreenInfoPtr screen, rfbScreenInfoPtr ptr, int x0, int y0, int w0, int h0)\n{\n int x,y,w,v,z;\n int x1, y1, w1, h1;\n int bitsPerPixel, bytesPerPixel, bytesPerLine, areaX, areaY, area2;\n unsigned char *srcptr, *dstptr;\n\n /* Nothing to do!!! */\n if (screen==ptr) return;\n\n x1 = x0;\n y1 = y0;\n w1 = w0;\n h1 = h0;\n\n rfbScaledCorrection(screen, ptr, &x1, &y1, &w1, &h1, \"rfbScaledScreenUpdateRect\");\n x0 = ScaleX(ptr, screen, x1);\n y0 = ScaleY(ptr, screen, y1);\n w0 = ScaleX(ptr, screen, w1);\n h0 = ScaleY(ptr, screen, h1);\n\n bitsPerPixel = screen->bitsPerPixel;\n bytesPerPixel = bitsPerPixel / 8;\n bytesPerLine = w1 * bytesPerPixel;\n srcptr = (unsigned char *)(screen->frameBuffer +\n (y0 * screen->paddedWidthInBytes + x0 * bytesPerPixel));\n dstptr = (unsigned char *)(ptr->frameBuffer +\n ( y1 * ptr->paddedWidthInBytes + x1 * bytesPerPixel));\n /* The area of the source framebuffer for each destination pixel */\n areaX = ScaleX(ptr,screen,1);\n areaY = ScaleY(ptr,screen,1);\n area2 = areaX*areaY;\n\n\n /* Ensure that we do not go out of bounds */\n if ((x1+w1) > (ptr->width))\n {\n if (x1==0) w1=ptr->width; else x1 = ptr->width - w1;\n }\n if ((y1+h1) > (ptr->height))\n {\n if (y1==0) h1=ptr->height; else y1 = ptr->height - h1;\n }\n /*\n * rfbLog(\"rfbScaledScreenUpdateRect(%dXx%dY-%dWx%dH -> %dXx%dY-%dWx%dH <%dx%d>) {%dWx%dH -> %dWx%dH} 0x%p\\n\",\n * x0, y0, w0, h0, x1, y1, w1, h1, areaX, areaY,\n * screen->width, screen->height, ptr->width, ptr->height, ptr->frameBuffer);\n */\n\n if (screen->serverFormat.trueColour) { /* Blend neighbouring pixels together */\n unsigned char *srcptr2;\n unsigned long pixel_value, red, green, blue;\n unsigned int redShift = screen->serverFormat.redShift;\n unsigned int greenShift = screen->serverFormat.greenShift;\n unsigned int blueShift = screen->serverFormat.blueShift;\n unsigned long redMax = screen->serverFormat.redMax;\n unsigned long greenMax = screen->serverFormat.greenMax;\n unsigned long blueMax = screen->serverFormat.blueMax;\n\n /* for each *destination* pixel... */\n for (y = 0; y < h1; y++) {\n for (x = 0; x < w1; x++) {\n red = green = blue = 0;\n /* Get the totals for rgb from the source grid... */\n for (w = 0; w < areaX; w++) {\n for (v = 0; v < areaY; v++) {\n srcptr2 = &srcptr[(((x * areaX) + w) * bytesPerPixel) +\n (v * screen->paddedWidthInBytes)];\n pixel_value = 0;\n\n\n switch (bytesPerPixel) {\n case 4: pixel_value = *((unsigned int *)srcptr2); break;\n case 2: pixel_value = *((unsigned short *)srcptr2); break;\n case 1: pixel_value = *((unsigned char *)srcptr2); break;\n default:\n /* fixme: endianness problem? */\n for (z = 0; z < bytesPerPixel; z++)\n pixel_value += ((unsigned long)srcptr2[z] << (8 * z));\n break;\n }\n /*\n srcptr2 += bytesPerPixel;\n */\n\n red += ((pixel_value >> redShift) & redMax);\n green += ((pixel_value >> greenShift) & greenMax);\n blue += ((pixel_value >> blueShift) & blueMax);\n\n }\n }\n /* We now have a total for all of the colors, find the average! */\n red /= area2;\n green /= area2;\n blue /= area2;\n /* Stuff the new value back into memory */\n pixel_value = ((red & redMax) << redShift) | ((green & greenMax) << greenShift) | ((blue & blueMax) << blueShift);\n\n switch (bytesPerPixel) {\n case 4: *((unsigned int *)dstptr) = (unsigned int) pixel_value; break;\n case 2: *((unsigned short *)dstptr) = (unsigned short) pixel_value; break;\n case 1: *((unsigned char *)dstptr) = (unsigned char) pixel_value; break;\n default:\n /* fixme: endianness problem? */\n for (z = 0; z < bytesPerPixel; z++)\n dstptr[z]=(pixel_value >> (8 * z)) & 0xff;\n break;\n }\n dstptr += bytesPerPixel;\n }\n srcptr += (screen->paddedWidthInBytes * areaY);\n dstptr += (ptr->paddedWidthInBytes - bytesPerLine);\n }\n } else\n { /* Not truecolour, so we can't blend. Just use the top-left pixel instead */\n for (y = y1; y < (y1+h1); y++) {\n for (x = x1; x < (x1+w1); x++)\n memcpy (&ptr->frameBuffer[(y *ptr->paddedWidthInBytes) + (x * bytesPerPixel)],\n &screen->frameBuffer[(y * areaY * screen->paddedWidthInBytes) + (x *areaX * bytesPerPixel)], bytesPerPixel);\n }\n }\n}","lang":"c","vul_type":"cwe-190","target_token_count":1394,"sven_meta":{"func_name":"rfbScaledScreenUpdateRect","file_name":"libvncserver/scale.c","commit_link":"github.com/LibVNC/libvncserver/commit/a6788d1da719ae006605b78d22f5a9f170b423af","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#3-ce0501c0c5ff","input":"static int ssl_parse_client_psk_identity( mbedtls_ssl_context *ssl, unsigned char **p,\n const unsigned char *end )\n{\n int ret = 0;\n size_t n;\n\n if( ssl->conf->f_psk == NULL &&\n ( ssl->conf->psk == NULL || ssl->conf->psk_identity == NULL ||\n ssl->conf->psk_identity_len == 0 || ssl->conf->psk_len == 0 ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"got no pre-shared key\" ) );\n return( MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED );\n }\n\n /*\n * Receive client pre-shared key identity name\n */\n if( *p + 2 > end )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad client key exchange message\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );\n }\n\n n = ( (*p)[0] << 8 ) | (*p)[1];\n *p += 2;\n\n if( n < 1 || n > 65535 || *p + n > end )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad client key exchange message\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );\n }\n\n if( ssl->conf->f_psk != NULL )\n {\n if( ssl->conf->f_psk( ssl->conf->p_psk, ssl, *p, n ) != 0 )\n ret = MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY;\n }\n else\n {\n /* Identity is not a big secret since clients send it in the clear,\n * but treat it carefully anyway, just in case */\n if( n != ssl->conf->psk_identity_len ||\n mbedtls_ssl_safer_memcmp( ssl->conf->psk_identity, *p, n ) != 0 )\n {\n ret = MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY;\n }\n }\n\n if( ret == MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY )\n {\n MBEDTLS_SSL_DEBUG_BUF( 3, \"Unknown PSK identity\", *p, n );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY );\n return( MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY );\n }\n\n *p += n;\n\n return( 0 );\n}","target":"static int ssl_parse_client_psk_identity( mbedtls_ssl_context *ssl, unsigned char **p,\n const unsigned char *end )\n{\n int ret = 0;\n size_t n;\n\n if( ssl->conf->f_psk == NULL &&\n ( ssl->conf->psk == NULL || ssl->conf->psk_identity == NULL ||\n ssl->conf->psk_identity_len == 0 || ssl->conf->psk_len == 0 ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"got no pre-shared key\" ) );\n return( MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED );\n }\n\n /*\n * Receive client pre-shared key identity name\n */\n if( end - *p < 2 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad client key exchange message\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );\n }\n\n n = ( (*p)[0] << 8 ) | (*p)[1];\n *p += 2;\n\n if( n < 1 || n > 65535 || n > (size_t) ( end - *p ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad client key exchange message\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );\n }\n\n if( ssl->conf->f_psk != NULL )\n {\n if( ssl->conf->f_psk( ssl->conf->p_psk, ssl, *p, n ) != 0 )\n ret = MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY;\n }\n else\n {\n /* Identity is not a big secret since clients send it in the clear,\n * but treat it carefully anyway, just in case */\n if( n != ssl->conf->psk_identity_len ||\n mbedtls_ssl_safer_memcmp( ssl->conf->psk_identity, *p, n ) != 0 )\n {\n ret = MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY;\n }\n }\n\n if( ret == MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY )\n {\n MBEDTLS_SSL_DEBUG_BUF( 3, \"Unknown PSK identity\", *p, n );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY );\n return( MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY );\n }\n\n *p += n;\n\n return( 0 );\n}","lang":"c","vul_type":"cwe-190","target_token_count":541,"sven_meta":{"func_name":"ssl_parse_client_psk_identity","file_name":"library/ssl_srv.c","commit_link":"github.com/ARMmbed/mbedtls/commit/83c9f495ffe70c7dd280b41fdfd4881485a3bc28","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#4-1216e1d42e75","input":"bool read_ujpg( void )\n{\n using namespace IOUtil;\n using namespace Sirikata;\n// colldata.start_decoder_worker_thread(std::bind(&simple_decoder, &colldata, str_in));\n unsigned char ujpg_mrk[ 64 ];\n // this is where we will enable seccomp, before reading user data\n write_byte_bill(Billing::HEADER, true, 24); // for the fixed header\n\n str_out->call_size_callback(max_file_size);\n uint32_t compressed_header_size = 0;\n if (ReadFull(str_in, ujpg_mrk, 4) != 4) {\n custom_exit(ExitCode::SHORT_READ);\n }\n write_byte_bill(Billing::HEADER, true, 4);\n\n compressed_header_size = LEtoUint32(ujpg_mrk);\n if (compressed_header_size > 128 * 1024 * 1024 || max_file_size > 128 * 1024 * 1024) {\n always_assert(false && \"Only support images < 128 megs\");\n return false; // bool too big\n }\n bool pending_header_reads = false;\n if (header_reader == NULL) {\n std::vector > compressed_header_buffer(compressed_header_size);\n IOUtil::ReadFull(str_in, compressed_header_buffer.data(), compressed_header_buffer.size());\n header_reader = new MemReadWriter((JpegAllocator()));\n {\n if (ujgversion == 1) {\n JpegAllocator no_free_allocator;\n#if !defined(USE_STANDARD_MEMORY_ALLOCATORS) && !defined(_WIN32) && !defined(EMSCRIPTEN)\n no_free_allocator.setup_memory_subsystem(32 * 1024 * 1024,\n 16,\n &mem_init_nop,\n &MemMgrAllocatorMalloc,\n &mem_nop,\n &mem_realloc_nop,\n &MemMgrAllocatorMsize);\n#endif\n std::pair >,\n JpegError> uncompressed_header_buffer(\n ZlibDecoderDecompressionReader::Decompress(compressed_header_buffer.data(),\n compressed_header_buffer.size(),\n no_free_allocator,\n max_file_size + 2048));\n if (uncompressed_header_buffer.second) {\n always_assert(false && \"Data not properly zlib coded\");\n return false;\n }\n zlib_hdrs = compressed_header_buffer.size();\n header_reader->SwapIn(uncompressed_header_buffer.first, 0);\n } else {\n std::pair >,\n JpegError> uncompressed_header_buffer(\n Sirikata::BrotliCodec::Decompress(compressed_header_buffer.data(),\n compressed_header_buffer.size(),\n JpegAllocator(),\n max_file_size * 2 + 128 * 1024 * 1024));\n if (uncompressed_header_buffer.second) {\n always_assert(false && \"Data not properly zlib coded\");\n return false;\n }\n zlib_hdrs = compressed_header_buffer.size();\n header_reader->SwapIn(uncompressed_header_buffer.first, 0); \n }\n }\n write_byte_bill(Billing::HEADER,\n true,\n compressed_header_buffer.size());\n } else {\n always_assert(compressed_header_size == 0 && \"Special concatenation requires 0 size header\");\n }\n grbs = sizeof(EOI);\n grbgdata = EOI; // if we don't have any garbage, assume FFD9 EOI\n // read header from file\n ReadFull(header_reader, ujpg_mrk, 3 ) ;\n // check marker\n if ( memcmp( ujpg_mrk, \"HDR\", 3 ) == 0 ) {\n // read size of header, alloc memory\n ReadFull(header_reader, ujpg_mrk, 4 );\n hdrs = LEtoUint32(ujpg_mrk);\n hdrdata = (unsigned char*) aligned_alloc(hdrs);\n memset(hdrdata, 0, hdrs);\n if ( hdrdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read hdrdata\n ReadFull(header_reader, hdrdata, hdrs );\n }\n else {\n fprintf( stderr, \"HDR marker not found\" );\n errorlevel.store(2);\n return false;\n }\n bool memory_optimized_image = (filetype != UJG) && !g_allow_progressive;\n // parse header for image-info\n if ( !setup_imginfo_jpg(memory_optimized_image) )\n return false;\n\n // beginning here: recovery information (needed for exact JPEG recovery)\n\n // read padbit information from file\n ReadFull(header_reader, ujpg_mrk, 3 );\n // check marker\n if ( memcmp( ujpg_mrk, \"P0D\", 3 ) == 0 ) {\n // This is a more nuanced pad byte that can have different values per bit\n header_reader->Read( reinterpret_cast(&padbit), 1 );\n }\n else if ( memcmp( ujpg_mrk, \"PAD\", 3 ) == 0 ) {\n // this is a single pad bit that is implied to have all the same values\n header_reader->Read( reinterpret_cast(&padbit), 1 );\n if (!(padbit == 0 || padbit == 1 ||padbit == -1)) {\n while (write(2,\n \"Legacy Padbit must be 0, 1 or -1\\n\",\n strlen(\"Legacy Padbit must be 0, 1 or -1\\n\")) < 0\n && errno == EINTR) {\n }\n custom_exit(ExitCode::STREAM_INCONSISTENT);\n }\n if (padbit == 1) {\n padbit = 0x7f; // all 6 bits set\n }\n }\n else {\n fprintf( stderr, \"PAD marker not found\" );\n errorlevel.store(2);\n return false;\n }\n std::vector thread_handoff;\n // read further recovery information if any\n while ( ReadFull(header_reader, ujpg_mrk, 3 ) == 3 ) {\n // check marker\n if ( memcmp( ujpg_mrk, \"CRS\", 3 ) == 0 ) {\n rst_cnt_set = true;\n ReadFull(header_reader, ujpg_mrk, 4);\n rst_cnt.resize(LEtoUint32(ujpg_mrk));\n for (size_t i = 0; i < rst_cnt.size(); ++i) {\n ReadFull(header_reader, ujpg_mrk, 4);\n rst_cnt.at(i) = LEtoUint32(ujpg_mrk);\n }\n } else if ( memcmp( ujpg_mrk, \"HHX\", 2 ) == 0 ) { // only look at first two bytes\n size_t to_alloc = ThreadHandoff::get_remaining_data_size_from_two_bytes(ujpg_mrk + 1) + 2;\n if(to_alloc) {\n std::vector data(to_alloc);\n data[0] = ujpg_mrk[1];\n data[1] = ujpg_mrk[2];\n ReadFull(header_reader, &data[2], to_alloc - 2);\n thread_handoff = ThreadHandoff::deserialize(&data[0], to_alloc);\n }\n } else if ( memcmp( ujpg_mrk, \"FRS\", 3 ) == 0 ) {\n // read number of false set RST markers per scan from file\n ReadFull(header_reader, ujpg_mrk, 4);\n scnc = LEtoUint32(ujpg_mrk);\n \n rst_err.insert(rst_err.end(), scnc - rst_err.size(), 0);\n // read data\n ReadFull(header_reader, rst_err.data(), scnc );\n }\n else if ( memcmp( ujpg_mrk, \"GRB\", 3 ) == 0 ) {\n // read garbage (data after end of JPG) from file\n ReadFull(header_reader, ujpg_mrk, 4);\n grbs = LEtoUint32(ujpg_mrk);\n grbgdata = aligned_alloc(grbs);\n memset(grbgdata, 0, sizeof(grbs));\n if ( grbgdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read garbage data\n ReadFull(header_reader, grbgdata, grbs );\n }\n else if ( memcmp( ujpg_mrk, \"PGR\", 3 ) == 0 || memcmp( ujpg_mrk, \"PGE\", 3 ) == 0 ) {\n // read prefix garbage (data before beginning of JPG) from file\n if (ujpg_mrk[2] == 'E') {\n // embedded jpeg: full header required\n embedded_jpeg = true;\n }\n ReadFull(header_reader, ujpg_mrk, 4);\n prefix_grbs = LEtoUint32(ujpg_mrk);\n prefix_grbgdata = aligned_alloc(prefix_grbs);\n memset(prefix_grbgdata, 0, sizeof(prefix_grbs));\n if ( prefix_grbgdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read garbage data\n ReadFull(header_reader, prefix_grbgdata, prefix_grbs );\n }\n else if ( memcmp( ujpg_mrk, \"SIZ\", 3 ) == 0 ) {\n // full size of the original file\n ReadFull(header_reader, ujpg_mrk, 4);\n max_file_size = LEtoUint32(ujpg_mrk);\n }\n else if ( memcmp( ujpg_mrk, \"EEE\", 3) == 0) {\n ReadFull(header_reader, ujpg_mrk, 28);\n max_cmp = LEtoUint32(ujpg_mrk);\n max_bpos = LEtoUint32(ujpg_mrk + 4);\n max_sah = LEtoUint32(ujpg_mrk + 8);\n max_dpos[0] = LEtoUint32(ujpg_mrk + 12);\n max_dpos[1] = LEtoUint32(ujpg_mrk + 16);\n max_dpos[2] = LEtoUint32(ujpg_mrk + 20);\n max_dpos[3] = LEtoUint32(ujpg_mrk + 24);\n early_eof_encountered = true;\n colldata.set_truncation_bounds(max_cmp, max_bpos, max_dpos, max_sah);\n }\n else {\n if (memcmp(ujpg_mrk, \"CNT\", 3) == 0 ) {\n pending_header_reads = true;\n break;\n } else if (memcmp(ujpg_mrk, \"CMP\", 3) == 0 ) {\n break;\n } else {\n fprintf( stderr, \"unknown data found\" );\n errorlevel.store(2);\n }\n return false;\n }\n }\n if (!pending_header_reads) {\n delete header_reader;\n header_reader = NULL;\n }\n write_byte_bill(Billing::HEADER,\n false,\n 2 + hdrs + prefix_grbs + grbs);\n\n ReadFull(str_in, ujpg_mrk, 3 ) ;\n write_byte_bill(Billing::HEADER, true, 3);\n\n write_byte_bill(Billing::DELIMITERS, true, 4 * NUM_THREADS); // trailing vpx_encode bits\n write_byte_bill(Billing::HEADER, true, 4); //trailing size\n\n if (memcmp(ujpg_mrk, \"CMP\", 3) != 0) {\n always_assert(false && \"CMP must be present (uncompressed) in the file or CNT continue marker\");\n return false; // not a JPG\n }\n colldata.signal_worker_should_begin();\n g_decoder->initialize(str_in, thread_handoff);\n colldata.start_decoder(g_decoder);\n return true;\n}","target":"bool read_ujpg( void )\n{\n using namespace IOUtil;\n using namespace Sirikata;\n// colldata.start_decoder_worker_thread(std::bind(&simple_decoder, &colldata, str_in));\n unsigned char ujpg_mrk[ 64 ];\n // this is where we will enable seccomp, before reading user data\n write_byte_bill(Billing::HEADER, true, 24); // for the fixed header\n\n str_out->call_size_callback(max_file_size);\n uint32_t compressed_header_size = 0;\n if (ReadFull(str_in, ujpg_mrk, 4) != 4) {\n custom_exit(ExitCode::SHORT_READ);\n }\n write_byte_bill(Billing::HEADER, true, 4);\n\n compressed_header_size = LEtoUint32(ujpg_mrk);\n if (compressed_header_size > 128 * 1024 * 1024 || max_file_size > 128 * 1024 * 1024) {\n always_assert(false && \"Only support images < 128 megs\");\n return false; // bool too big\n }\n bool pending_header_reads = false;\n if (header_reader == NULL) {\n std::vector > compressed_header_buffer(compressed_header_size);\n IOUtil::ReadFull(str_in, compressed_header_buffer.data(), compressed_header_buffer.size());\n header_reader = new MemReadWriter((JpegAllocator()));\n {\n if (ujgversion == 1) {\n JpegAllocator no_free_allocator;\n#if !defined(USE_STANDARD_MEMORY_ALLOCATORS) && !defined(_WIN32) && !defined(EMSCRIPTEN)\n no_free_allocator.setup_memory_subsystem(32 * 1024 * 1024,\n 16,\n &mem_init_nop,\n &MemMgrAllocatorMalloc,\n &mem_nop,\n &mem_realloc_nop,\n &MemMgrAllocatorMsize);\n#endif\n std::pair >,\n JpegError> uncompressed_header_buffer(\n ZlibDecoderDecompressionReader::Decompress(compressed_header_buffer.data(),\n compressed_header_buffer.size(),\n no_free_allocator,\n max_file_size + 2048));\n if (uncompressed_header_buffer.second) {\n always_assert(false && \"Data not properly zlib coded\");\n return false;\n }\n zlib_hdrs = compressed_header_buffer.size();\n header_reader->SwapIn(uncompressed_header_buffer.first, 0);\n } else {\n std::pair >,\n JpegError> uncompressed_header_buffer(\n Sirikata::BrotliCodec::Decompress(compressed_header_buffer.data(),\n compressed_header_buffer.size(),\n JpegAllocator(),\n ((size_t)max_file_size) * 2 + 128 * 1024 * 1024));\n if (uncompressed_header_buffer.second) {\n always_assert(false && \"Data not properly zlib coded\");\n return false;\n }\n zlib_hdrs = compressed_header_buffer.size();\n header_reader->SwapIn(uncompressed_header_buffer.first, 0); \n }\n }\n write_byte_bill(Billing::HEADER,\n true,\n compressed_header_buffer.size());\n } else {\n always_assert(compressed_header_size == 0 && \"Special concatenation requires 0 size header\");\n }\n grbs = sizeof(EOI);\n grbgdata = EOI; // if we don't have any garbage, assume FFD9 EOI\n // read header from file\n ReadFull(header_reader, ujpg_mrk, 3 ) ;\n // check marker\n if ( memcmp( ujpg_mrk, \"HDR\", 3 ) == 0 ) {\n // read size of header, alloc memory\n ReadFull(header_reader, ujpg_mrk, 4 );\n hdrs = LEtoUint32(ujpg_mrk);\n hdrdata = (unsigned char*) aligned_alloc(hdrs);\n memset(hdrdata, 0, hdrs);\n if ( hdrdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read hdrdata\n ReadFull(header_reader, hdrdata, hdrs );\n }\n else {\n fprintf( stderr, \"HDR marker not found\" );\n errorlevel.store(2);\n return false;\n }\n bool memory_optimized_image = (filetype != UJG) && !g_allow_progressive;\n // parse header for image-info\n if ( !setup_imginfo_jpg(memory_optimized_image) )\n return false;\n\n // beginning here: recovery information (needed for exact JPEG recovery)\n\n // read padbit information from file\n ReadFull(header_reader, ujpg_mrk, 3 );\n // check marker\n if ( memcmp( ujpg_mrk, \"P0D\", 3 ) == 0 ) {\n // This is a more nuanced pad byte that can have different values per bit\n header_reader->Read( reinterpret_cast(&padbit), 1 );\n }\n else if ( memcmp( ujpg_mrk, \"PAD\", 3 ) == 0 ) {\n // this is a single pad bit that is implied to have all the same values\n header_reader->Read( reinterpret_cast(&padbit), 1 );\n if (!(padbit == 0 || padbit == 1 ||padbit == -1)) {\n while (write(2,\n \"Legacy Padbit must be 0, 1 or -1\\n\",\n strlen(\"Legacy Padbit must be 0, 1 or -1\\n\")) < 0\n && errno == EINTR) {\n }\n custom_exit(ExitCode::STREAM_INCONSISTENT);\n }\n if (padbit == 1) {\n padbit = 0x7f; // all 6 bits set\n }\n }\n else {\n fprintf( stderr, \"PAD marker not found\" );\n errorlevel.store(2);\n return false;\n }\n std::vector thread_handoff;\n // read further recovery information if any\n while ( ReadFull(header_reader, ujpg_mrk, 3 ) == 3 ) {\n // check marker\n if ( memcmp( ujpg_mrk, \"CRS\", 3 ) == 0 ) {\n rst_cnt_set = true;\n ReadFull(header_reader, ujpg_mrk, 4);\n rst_cnt.resize(LEtoUint32(ujpg_mrk));\n for (size_t i = 0; i < rst_cnt.size(); ++i) {\n ReadFull(header_reader, ujpg_mrk, 4);\n rst_cnt.at(i) = LEtoUint32(ujpg_mrk);\n }\n } else if ( memcmp( ujpg_mrk, \"HHX\", 2 ) == 0 ) { // only look at first two bytes\n size_t to_alloc = ThreadHandoff::get_remaining_data_size_from_two_bytes(ujpg_mrk + 1) + 2;\n if(to_alloc) {\n std::vector data(to_alloc);\n data[0] = ujpg_mrk[1];\n data[1] = ujpg_mrk[2];\n ReadFull(header_reader, &data[2], to_alloc - 2);\n thread_handoff = ThreadHandoff::deserialize(&data[0], to_alloc);\n }\n } else if ( memcmp( ujpg_mrk, \"FRS\", 3 ) == 0 ) {\n // read number of false set RST markers per scan from file\n ReadFull(header_reader, ujpg_mrk, 4);\n scnc = LEtoUint32(ujpg_mrk);\n \n rst_err.insert(rst_err.end(), scnc - rst_err.size(), 0);\n // read data\n ReadFull(header_reader, rst_err.data(), scnc );\n }\n else if ( memcmp( ujpg_mrk, \"GRB\", 3 ) == 0 ) {\n // read garbage (data after end of JPG) from file\n ReadFull(header_reader, ujpg_mrk, 4);\n grbs = LEtoUint32(ujpg_mrk);\n grbgdata = aligned_alloc(grbs);\n memset(grbgdata, 0, sizeof(grbs));\n if ( grbgdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read garbage data\n ReadFull(header_reader, grbgdata, grbs );\n }\n else if ( memcmp( ujpg_mrk, \"PGR\", 3 ) == 0 || memcmp( ujpg_mrk, \"PGE\", 3 ) == 0 ) {\n // read prefix garbage (data before beginning of JPG) from file\n if (ujpg_mrk[2] == 'E') {\n // embedded jpeg: full header required\n embedded_jpeg = true;\n }\n ReadFull(header_reader, ujpg_mrk, 4);\n prefix_grbs = LEtoUint32(ujpg_mrk);\n prefix_grbgdata = aligned_alloc(prefix_grbs);\n memset(prefix_grbgdata, 0, sizeof(prefix_grbs));\n if ( prefix_grbgdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read garbage data\n ReadFull(header_reader, prefix_grbgdata, prefix_grbs );\n }\n else if ( memcmp( ujpg_mrk, \"SIZ\", 3 ) == 0 ) {\n // full size of the original file\n ReadFull(header_reader, ujpg_mrk, 4);\n max_file_size = LEtoUint32(ujpg_mrk);\n }\n else if ( memcmp( ujpg_mrk, \"EEE\", 3) == 0) {\n ReadFull(header_reader, ujpg_mrk, 28);\n max_cmp = LEtoUint32(ujpg_mrk);\n max_bpos = LEtoUint32(ujpg_mrk + 4);\n max_sah = LEtoUint32(ujpg_mrk + 8);\n max_dpos[0] = LEtoUint32(ujpg_mrk + 12);\n max_dpos[1] = LEtoUint32(ujpg_mrk + 16);\n max_dpos[2] = LEtoUint32(ujpg_mrk + 20);\n max_dpos[3] = LEtoUint32(ujpg_mrk + 24);\n early_eof_encountered = true;\n colldata.set_truncation_bounds(max_cmp, max_bpos, max_dpos, max_sah);\n }\n else {\n if (memcmp(ujpg_mrk, \"CNT\", 3) == 0 ) {\n pending_header_reads = true;\n break;\n } else if (memcmp(ujpg_mrk, \"CMP\", 3) == 0 ) {\n break;\n } else {\n fprintf( stderr, \"unknown data found\" );\n errorlevel.store(2);\n }\n return false;\n }\n }\n if (!pending_header_reads) {\n delete header_reader;\n header_reader = NULL;\n }\n write_byte_bill(Billing::HEADER,\n false,\n 2 + hdrs + prefix_grbs + grbs);\n\n ReadFull(str_in, ujpg_mrk, 3 ) ;\n write_byte_bill(Billing::HEADER, true, 3);\n\n write_byte_bill(Billing::DELIMITERS, true, 4 * NUM_THREADS); // trailing vpx_encode bits\n write_byte_bill(Billing::HEADER, true, 4); //trailing size\n\n if (memcmp(ujpg_mrk, \"CMP\", 3) != 0) {\n always_assert(false && \"CMP must be present (uncompressed) in the file or CNT continue marker\");\n return false; // not a JPG\n }\n colldata.signal_worker_should_begin();\n g_decoder->initialize(str_in, thread_handoff);\n colldata.start_decoder(g_decoder);\n return true;\n}","lang":"cpp","vul_type":"cwe-190","target_token_count":2678,"sven_meta":{"func_name":"read_ujpg","file_name":"src/lepton/jpgcoder.cc","commit_link":"github.com/dropbox/lepton/commit/6a5ceefac1162783fffd9506a3de39c85c725761","source_cwe_file":"cwe-190.jsonl"}} diff --git a/sven_rl_train.jsonl b/sven_rl_train.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..acec0bdfd4ac27fd8d4b22b15a0648386e646290 --- /dev/null +++ b/sven_rl_train.jsonl @@ -0,0 +1,720 @@ +{"problem_id":"cwe-089#0-058d1db0e395","input":"def build_board(conn, game,size):\n # we'll build the empty board, and then fill in with the move list that\n # we get from the DB.\n board = []\n for i in range(size):\n board.append([\"\"]*size)\n\n\n # search for all moves that have happenend during this game.\n cursor = conn.cursor()\n cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\" % game)\n\n counts = {\"X\":0, \"O\":0}\n for move in cursor.fetchall():\n (x,y,letter) = move\n\n x = int(x)\n y = int(y)\n assert x >= 0 and x < size\n assert y >= 0 and y < size\n\n assert letter in \"XO\"\n\n assert board[x][y] == \"\"\n board[x][y] = letter\n\n counts[letter] += 1\n\n cursor.close()\n\n assert counts[\"X\"] >= counts[\"O\"]\n assert counts[\"X\"] <= counts[\"O\"]+1\n\n if counts[\"X\"] == counts[\"O\"]:\n nextPlayer = 0\n else:\n nextPlayer = 1\n letter = \"XO\"[nextPlayer]\n\n return (board,nextPlayer,letter)","target":"def build_board(conn, game,size):\n # we'll build the empty board, and then fill in with the move list that\n # we get from the DB.\n board = []\n for i in range(size):\n board.append([\"\"]*size)\n\n\n # search for all moves that have happenend during this game.\n cursor = conn.cursor()\n cursor.execute(\"SELECT x,y,letter FROM moves WHERE gameID = %d;\", (game,))\n\n counts = {\"X\":0, \"O\":0}\n for move in cursor.fetchall():\n (x,y,letter) = move\n\n x = int(x)\n y = int(y)\n assert x >= 0 and x < size\n assert y >= 0 and y < size\n\n assert letter in \"XO\"\n\n assert board[x][y] == \"\"\n board[x][y] = letter\n\n counts[letter] += 1\n\n cursor.close()\n\n assert counts[\"X\"] >= counts[\"O\"]\n assert counts[\"X\"] <= counts[\"O\"]+1\n\n if counts[\"X\"] == counts[\"O\"]:\n nextPlayer = 0\n else:\n nextPlayer = 1\n letter = \"XO\"[nextPlayer]\n\n return (board,nextPlayer,letter)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"build_board","file_name":"cgi/common.py","commit_link":"github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#1-84917ebb1e63","input":" def check_and_update_ranks(self, scene):\n # There are 2 cases here:\n # 1) Ranks have never been calculated for this scene before\n # - This means we need to calculate what the ranks were every month of this scenes history\n # - We should only do this if ranks don't already exist for this scene\n # 2) Ranks have been calculated for this scene before\n # - We already have bulk ranks. We should check if it has been more than 1 month since we last\n # calculated ranks. If so, calculate again with the brackets that have come out this month\n\n LOG.info('About to check if ranks need updating for {}'.format(scene))\n # First, do we have any ranks for this scene already?\n sql = 'select count(*) from ranks where scene=\"{}\";'.format(scene)\n res = self.db.exec(sql)\n count = res[0][0]\n\n n = 5 if (scene == 'pro' or scene == 'pro_wiiu') else constants.TOURNAMENTS_PER_RANK\n if count == 0:\n LOG.info('Detected that we need to bulk update ranks for {}'.format(scene))\n # Alright, we have nothing. Bulk update ranks\n first_month = bracket_utils.get_first_month(self.db, scene)\n last_month = bracket_utils.get_last_month(self.db, scene)\n \n # Iterate through all tournaments going month by month, and calculate ranks\n months = bracket_utils.iter_months(first_month, last_month, include_first=False, include_last=True)\n for month in months:\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)\n else:\n\n # Get the date of the last time we calculated ranks\n sql = \"select date from ranks where scene='{}' order by date desc limit 1;\".format(scene)\n res = self.db.exec(sql)\n last_rankings_date = res[0][0]\n\n # Check to see if it's been more than 1 month since we last calculated ranks\n more_than_one_month = bracket_utils.has_month_passed(last_rankings_date)\n if more_than_one_month:\n # Get only the last n tournaments, so it doesn't take too long to process\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n msg = 'Detected that we need up update monthly ranks for {}, on {}'.format(scene, today)\n LOG.info(msg)\n\n # We should only ever calculate ranks on the 1st. If today is not the first, log error\n if not today.split('-')[-1] == '1':\n LOG.exc('We are calculating ranks today, {}, but it isnt the first'.format(today))\n\n months = bracket_utils.iter_months(last_rankings_date, today, include_first=False, include_last=True)\n for month in months:\n # Make sure that we actually have matches during this month\n # Say we are trying to calculate ranks for 2018-05-01, the player would need to have matches during 2018-04-01, 2018-04-30\n prev_date = bracket_utils.get_previous_month(month)\n brackets_during_month = bracket_utils.get_tournaments_during_month(self.db, scene, prev_date)\n\n if len(brackets_during_month) > 0:\n tweet('Calculating {} ranks for {}'.format(month, scene))\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)\n\n else:\n LOG.info('It has not yet been 1 month since we calculated ranks for {}. Skipping'.format(scene))","target":" def check_and_update_ranks(self, scene):\n # There are 2 cases here:\n # 1) Ranks have never been calculated for this scene before\n # - This means we need to calculate what the ranks were every month of this scenes history\n # - We should only do this if ranks don't already exist for this scene\n # 2) Ranks have been calculated for this scene before\n # - We already have bulk ranks. We should check if it has been more than 1 month since we last\n # calculated ranks. If so, calculate again with the brackets that have come out this month\n\n LOG.info('About to check if ranks need updating for {}'.format(scene))\n # First, do we have any ranks for this scene already?\n sql = 'select count(*) from ranks where scene=\"{scene}\";'\n args = {'scene': scene}\n res = self.db.exec(sql, args)\n count = res[0][0]\n\n n = 5 if (scene == 'pro' or scene == 'pro_wiiu') else constants.TOURNAMENTS_PER_RANK\n if count == 0:\n LOG.info('Detected that we need to bulk update ranks for {}'.format(scene))\n # Alright, we have nothing. Bulk update ranks\n first_month = bracket_utils.get_first_month(self.db, scene)\n last_month = bracket_utils.get_last_month(self.db, scene)\n \n # Iterate through all tournaments going month by month, and calculate ranks\n months = bracket_utils.iter_months(first_month, last_month, include_first=False, include_last=True)\n for month in months:\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)\n else:\n\n # Get the date of the last time we calculated ranks\n sql = \"select date from ranks where scene='{scene}' order by date desc limit 1;\"\n args = {'scene': scene}\n res = self.db.exec(sql, args)\n last_rankings_date = res[0][0]\n\n # Check to see if it's been more than 1 month since we last calculated ranks\n more_than_one_month = bracket_utils.has_month_passed(last_rankings_date)\n if more_than_one_month:\n # Get only the last n tournaments, so it doesn't take too long to process\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n msg = 'Detected that we need up update monthly ranks for {}, on {}'.format(scene, today)\n LOG.info(msg)\n\n # We should only ever calculate ranks on the 1st. If today is not the first, log error\n if not today.split('-')[-1] == '1':\n LOG.exc('We are calculating ranks today, {}, but it isnt the first'.format(today))\n\n months = bracket_utils.iter_months(last_rankings_date, today, include_first=False, include_last=True)\n for month in months:\n # Make sure that we actually have matches during this month\n # Say we are trying to calculate ranks for 2018-05-01, the player would need to have matches during 2018-04-01, 2018-04-30\n prev_date = bracket_utils.get_previous_month(month)\n brackets_during_month = bracket_utils.get_tournaments_during_month(self.db, scene, prev_date)\n\n if len(brackets_during_month) > 0:\n tweet('Calculating {} ranks for {}'.format(month, scene))\n urls, _ = bracket_utils.get_n_tournaments_before_date(self.db, scene, month, n)\n self.process_ranks(scene, urls, month)\n\n else:\n LOG.info('It has not yet been 1 month since we calculated ranks for {}. Skipping'.format(scene))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"check_and_update_ranks","file_name":"process_data.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#2-bf3adb08a70e","input":" def tag_num_to_tag(self, tag_num):\n ''' Returns tag given tag_num. '''\n\n q = \"SELECT tag FROM tags WHERE rowid = '\" + str(tag_num) + \"'\"\n self.query(q)\n return self.c.fetchone()[0]","target":" def tag_num_to_tag(self, tag_num):\n ''' Returns tag given tag_num. '''\n\n q = \"SELECT tag FROM tags WHERE rowid = ?\"\n self.query(q, tag_num)\n return self.c.fetchone()[0]","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"tag_num_to_tag","file_name":"modules/query_lastfm.py","commit_link":"github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#3-ab2d273c7ea4","input":"@api.route('/items/', methods=['GET'])\ndef get_item(item_id):\n sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)\n cursor = mysql.connection.cursor()\n cursor.execute(sql)\n data = cursor.fetchone()\n\n if data:\n item = {}\n for tup in zip([column[0] for column in cursor.description], data):\n item[tup[0]] = tup[1]\n else:\n return jsonify({\"error\": \"item not found\"}), 404\n\n return jsonify(item)","target":"@api.route('/items/', methods=['GET'])\ndef get_item(item_id):\n sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = %s AND auctionable = true;'''\n cursor = mysql.connection.cursor()\n cursor.execute(sql, [item_id])\n data = cursor.fetchone()\n\n if data:\n item = {}\n for tup in zip([column[0] for column in cursor.description], data):\n item[tup[0]] = tup[1]\n else:\n return jsonify({\"error\": \"item not found\"}), 404\n\n return jsonify(item)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_item","file_name":"timf/api/views.py","commit_link":"github.com/cosileone/TimeIsMoneyFriend-API/commit/3d3b5defd26ef7d205915bf643b6b1df90a15e44","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#4-dd9b47234757","input":" def getPostsByPostid(self,postid):\n sqlText=\"select users.name,post.comment from users,post where \\\n users.userid=post.userid and post.postid=%d\"%(postid)\n result=sql.queryDB(self.conn,sqlText)\n return result;","target":" def getPostsByPostid(self,postid):\n sqlText=\"select users.name,post.comment from users,post where \\\n users.userid=post.userid and post.postid=%s\"\n params=[postid]\n result=sql.queryDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getPostsByPostid","file_name":"modules/post.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#5-8a3b06cb12b7","input":"\tdef getFileCacheID(self, pth):\n\t\t\"\"\"\n\t\tReturns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.\n\t\t:param pth:\n\t\t:return:\n\t\t\"\"\"\n\t\tcommand = \"SELECT file_id FROM {0} WHERE path='{1}'\".format(TABLE_NAME, pth)\n\t\tdata = self._run_command(command)\n\n\t\ttry:\n\t\t\tdata = data[0][0]\n\t\texcept IndexError:\n\t\t\tdata = None\n\n\t\treturn data","target":"\tdef getFileCacheID(self, pth):\n\t\t\"\"\"\n\t\tReturns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.\n\t\t:param pth:\n\t\t:return:\n\t\t\"\"\"\n\t\tcommand = \"SELECT file_id FROM {0} WHERE path=?;\".format(TABLE_NAME)\n\t\tparams = (pth,)\n\t\tdata = self._run_command(command, params)\n\n\t\ttry:\n\t\t\tdata = data[0][0]\n\t\texcept IndexError:\n\t\t\tdata = None\n\n\t\treturn data","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getFileCacheID","file_name":"file_db.py","commit_link":"github.com/Highstaker/Picture-sender-telegram-bot/commit/db4bc6adb41e086418761426ff4958a81c30adca","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#6-bd4ef60952d1","input":"def add_post(content):\n \"\"\"Add a post to the 'database' with the current timestamp.\"\"\"\n db = psycopg2.connect(database=DBNAME)\n c = db.cursor()\n c.execute(\"insert into posts values('%s')\" % content)\n db.commit()\n db.close()","target":"def add_post(content):\n \"\"\"Add a post to the 'database' with the current timestamp.\"\"\"\n db = psycopg2.connect(database=DBNAME)\n c = db.cursor()\n c.execute(\"insert into posts values(%s)\",(content,))\n db.commit()\n db.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_post","file_name":"vagrant/forum/forumdb.py","commit_link":"github.com/tfalbo/SuzyMakeup/commit/1a5d6ccf02bec303d454f87a6bb39baed30c205f","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#7-2d74566801df","input":"def getSubmissionDateFromDatabase(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = '\" + str(submission.id) + \"'\").fetchone()[0]\n database.close()","target":"def getSubmissionDateFromDatabase(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT Date FROM ChallengeRankings WHERE SubmissionID = ?\", [str(submission.id)]).fetchone()[0]\n database.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getSubmissionDateFromDatabase","file_name":"CheckAndPostForSeriesSubmissions.py","commit_link":"github.com/LiquidFun/Reddit-GeoGuessr-Tracking-Bot/commit/0cad2d52e24b05da32789fbc8face7a9999a71f9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#8-24ab82d56e89","input":"@endpoints.route(\"/ranks\")\ndef ranks():\n if db == None:\n init()\n\n scene = request.args.get('scene', default='austin')\n date = request.args.get('date')\n \n # If no date was provided, pick the date of the latest tournament\n if date == None:\n sql = \"SELECT distinct date FROM ranks WHERE scene='{}' ORDER BY date DESC LIMIT 1;\".format(scene)\n res = db.exec(sql)\n date = res[0][0]\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM ranks WHERE scene = '{}' and date='{}'\".format(scene, date)\n res = db.exec(sql)\n\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n cur_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]\n\n cur_ranks[tag] = rank\n\n # Now get the ranks from last month, so we know if these players went up or down\n y, m, d = date.split('-')\n prev_date = bracket_utils.get_previous_month(date)\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM ranks WHERE scene = '{}' and date='{}'\".format(scene, prev_date)\n res = db.exec(sql)\n\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n prev_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]\n\n prev_ranks[tag] = rank\n\n return render_template('libraries/html/ranks.html', cur_ranks=cur_ranks, prev_ranks=prev_ranks, scene=scene, date=date)","target":"@endpoints.route(\"/ranks\")\ndef ranks():\n if db == None:\n init()\n\n scene = request.args.get('scene', default='austin')\n date = request.args.get('date')\n \n # If no date was provided, pick the date of the latest tournament\n if date == None:\n sql = \"SELECT distinct date FROM ranks WHERE scene='{scene}' ORDER BY date DESC LIMIT 1;\"\n args = {'scene': scene}\n res = db.exec(sql, args)\n date = res[0][0]\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM ranks WHERE scene = '{scene}' and date='{date}'\"\n args = {'scene': scene, 'date': date}\n res = db.exec(sql, args)\n\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n cur_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]\n\n cur_ranks[tag] = rank\n\n # Now get the ranks from last month, so we know if these players went up or down\n y, m, d = date.split('-')\n prev_date = bracket_utils.get_previous_month(date)\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM ranks WHERE scene = '{scene}' and date='{date}'\"\n args = {'scene': scene, 'date': prev_date}\n res = db.exec(sql, args)\n\n # Make a dict out of this data\n # eg {'christmasmike': 50}\n prev_ranks = {}\n for r in res:\n tag = r[1]\n rank = r[2]\n\n prev_ranks[tag] = rank\n\n return render_template('libraries/html/ranks.html', cur_ranks=cur_ranks, prev_ranks=prev_ranks, scene=scene, date=date)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"ranks","file_name":"endpoints.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#9-5fce4f744efa","input":" def set_language(self, lang):\n \"\"\"\n Update language of user in the User object and in the database\n :param lang: string with language tag like \"en-US\"\n :return: None\n \"\"\"\n log.debug('Updating info about user %s language '\n 'in memory & database...', self)\n\n self.language = lang\n\n query = (\"UPDATE users \"\n f\"SET language='{self.language}' \"\n f\"WHERE chat_id='{self.chat_id}'\")\n\n try:\n db.add(query)\n except DatabaseError:\n log.error(\"Can't add new language of %s to the database\", self)\n else:\n log.debug('Language updated.')","target":" def set_language(self, lang):\n \"\"\"\n Update language of user in the User object and in the database\n :param lang: string with language tag like \"en-US\"\n :return: None\n \"\"\"\n log.debug('Updating info about user %s language '\n 'in memory & database...', self)\n\n self.language = lang\n\n query = (\"UPDATE users \"\n f\"SET language=%s \"\n f\"WHERE chat_id=%s\")\n\n parameters = self.language, self.chat_id\n try:\n db.add(query, parameters)\n except DatabaseError:\n log.error(\"Can't add new language of %s to the database\", self)\n else:\n log.debug('Language updated.')","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"set_language","file_name":"photogpsbot/users.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#10-382d839e2a90","input":" def tid_num_to_tag_nums(self, tid_num):\n ''' Returns list of the associated tag_nums to the given tid_num. '''\n\n q = \"SELECT tag FROM tid_tag WHERE tid = '\" + str(tid_num) + \"'\"\n self.query(q)\n return [i[0] for i in self.c.fetchall()]","target":" def tid_num_to_tag_nums(self, tid_num):\n ''' Returns list of the associated tag_nums to the given tid_num. '''\n\n q = \"SELECT tag FROM tid_tag WHERE tid = ?\"\n self.query(q, tid_num)\n return [i[0] for i in self.c.fetchall()]","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"tid_num_to_tag_nums","file_name":"modules/query_lastfm.py","commit_link":"github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#11-7d944f03d5a9","input":"@app.route('/summary', methods=['GET'])\ndef summary():\n\tif 'username' in session:\n\n\t\tconn = mysql.connect()\n\t\tcursor = conn.cursor()\n\n\t\t#select the maximum score from the results table\n\t\tcursor.execute(\"SELECT courseConcentration FROM results WHERE total = (SELECT MAX(total) FROM (SELECT * FROM results WHERE courseId > 4) Temp) and courseId > 4 and emailAccount='\" + session['username'] + \"'\");\n\t\tcourseConcentration = cursor.fetchone()\n\n\t\treturn render_template('summary.html', courseConcentration = courseConcentration[0])\n\treturn redirect(url_for('login'))","target":"@app.route('/summary', methods=['GET'])\ndef summary():\n\tif 'username' in session:\n\n\t\tconn = mysql.connect()\n\t\tcursor = conn.cursor()\n\n\t\t#select the maximum score from the results table\n\t\tcursor.execute(\"SELECT courseConcentration FROM results WHERE total = (SELECT MAX(total) FROM (SELECT * FROM results WHERE courseId > 4) Temp) and courseId > 4 and emailAccount=%s\", (session['username']));\n\t\tcourseConcentration = cursor.fetchone()\n\n\t\treturn render_template('summary.html', courseConcentration = courseConcentration[0])\n\treturn redirect(url_for('login'))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"summary","file_name":"src/tech_track.py","commit_link":"github.com/CaitlinKennedy/Tech-Track/commit/20ef2d4010f9497b8221524edd0c706e2c6a4147","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#12-20344b74d979","input":"def add_post(content):\n \"\"\"Add a post to the 'database' with the current timestamp.\"\"\"\n conn = psycopg2.connect(\"dbname=forum\")\n cursor = conn.cursor()\n cursor.execute(\"insert into posts values ('%s')\" % content)\n conn.commit()\n conn.close()","target":"def add_post(content):\n \"\"\"Add a post to the 'database' with the current timestamp.\"\"\"\n conn = psycopg2.connect(\"dbname=forum\")\n cursor = conn.cursor()\n one_post = content\n cursor.execute(\"insert into posts values (%s)\", (one_post,))\n conn.commit()\n conn.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_post","file_name":"forumdb.py","commit_link":"github.com/paulc1600/DB-API-Forum/commit/069700fb4beec79182fff3c556e9cccce3230d6f","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#13-43256aa0c7d5","input":"def delete_playlist(id, db):\n db.execute(\"DELETE FROM playlist where id={id};\".format(id=id))","target":"def delete_playlist(id, db):\n db.execute(\"DELETE FROM playlist where id=%s;\", (id,))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"delete_playlist","file_name":"playlist/playlist_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#14-a8b633af74d5","input":" def writeToDb(self, url):\n try:\n self.cursor.execute(\"INSERT INTO queue (url, visited) VALUES ('{}', '0');\".format(url))\n self.db.commit()\n except Exception as e:\n print(e)","target":" def writeToDb(self, url):\n try:\n self.cursor.execute(\"INSERT INTO queue (url, visited) VALUES (?, '0');\", url)\n self.db.commit()\n except Exception as e:\n print(e)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"writeToDb","file_name":"beta/database.py","commit_link":"github.com/jappe999/WebScraper/commit/46a4e0843aa44d903293637afad53dfcbc37b480","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#15-1eb68ef0e0d1","input":"@frappe.whitelist(allow_guest=True)\ndef send_message(subject=\"Website Query\", message=\"\", sender=\"\", status=\"Open\"):\n\tfrom frappe.www.contact import send_message as website_send_message\n\tlead = customer = None\n\n\twebsite_send_message(subject, message, sender)\n\n\tcustomer = frappe.db.sql(\"\"\"select distinct dl.link_name from `tabDynamic Link` dl\n\t\tleft join `tabContact` c on dl.parent=c.name where dl.link_doctype='Customer'\n\t\tand c.email_id='{email_id}'\"\"\".format(email_id=sender))\n\n\tif not customer:\n\t\tlead = frappe.db.get_value('Lead', dict(email_id=sender))\n\t\tif not lead:\n\t\t\tnew_lead = frappe.get_doc(dict(\n\t\t\t\tdoctype='Lead',\n\t\t\t\temail_id = sender,\n\t\t\t\tlead_name = sender.split('@')[0].title()\n\t\t\t)).insert(ignore_permissions=True)\n\n\topportunity = frappe.get_doc(dict(\n\t\tdoctype ='Opportunity',\n\t\tenquiry_from = 'Customer' if customer else 'Lead',\n\t\tstatus = 'Open',\n\t\ttitle = subject,\n\t\tcontact_email = sender,\n\t\tto_discuss = message\n\t))\n\n\tif customer:\n\t\topportunity.customer = customer[0][0]\n\telif lead:\n\t\topportunity.lead = lead\n\telse:\n\t\topportunity.lead = new_lead.name\n\n\topportunity.insert(ignore_permissions=True)\n\n\tcomm = frappe.get_doc({\n\t\t\"doctype\":\"Communication\",\n\t\t\"subject\": subject,\n\t\t\"content\": message,\n\t\t\"sender\": sender,\n\t\t\"sent_or_received\": \"Received\",\n\t\t'reference_doctype': 'Opportunity',\n\t\t'reference_name': opportunity.name\n\t})\n\tcomm.insert(ignore_permissions=True)\n\n\treturn \"okay\"","target":"@frappe.whitelist(allow_guest=True)\ndef send_message(subject=\"Website Query\", message=\"\", sender=\"\", status=\"Open\"):\n\tfrom frappe.www.contact import send_message as website_send_message\n\tlead = customer = None\n\n\twebsite_send_message(subject, message, sender)\n\n\tcustomer = frappe.db.sql(\"\"\"select distinct dl.link_name from `tabDynamic Link` dl\n\t\tleft join `tabContact` c on dl.parent=c.name where dl.link_doctype='Customer'\n\t\tand c.email_id = %s\"\"\", sender)\n\n\tif not customer:\n\t\tlead = frappe.db.get_value('Lead', dict(email_id=sender))\n\t\tif not lead:\n\t\t\tnew_lead = frappe.get_doc(dict(\n\t\t\t\tdoctype='Lead',\n\t\t\t\temail_id = sender,\n\t\t\t\tlead_name = sender.split('@')[0].title()\n\t\t\t)).insert(ignore_permissions=True)\n\n\topportunity = frappe.get_doc(dict(\n\t\tdoctype ='Opportunity',\n\t\tenquiry_from = 'Customer' if customer else 'Lead',\n\t\tstatus = 'Open',\n\t\ttitle = subject,\n\t\tcontact_email = sender,\n\t\tto_discuss = message\n\t))\n\n\tif customer:\n\t\topportunity.customer = customer[0][0]\n\telif lead:\n\t\topportunity.lead = lead\n\telse:\n\t\topportunity.lead = new_lead.name\n\n\topportunity.insert(ignore_permissions=True)\n\n\tcomm = frappe.get_doc({\n\t\t\"doctype\":\"Communication\",\n\t\t\"subject\": subject,\n\t\t\"content\": message,\n\t\t\"sender\": sender,\n\t\t\"sent_or_received\": \"Received\",\n\t\t'reference_doctype': 'Opportunity',\n\t\t'reference_name': opportunity.name\n\t})\n\tcomm.insert(ignore_permissions=True)\n\n\treturn \"okay\"","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"send_message","file_name":"erpnext/templates/utils.py","commit_link":"github.com/libracore/erpnext/commit/9acb885e60f77cd4e9ea8c98bdc39c18abcac731","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#16-352a199e5538","input":" @jwt_required\n def delete(self, email):\n \"\"\" Deletes admin with the corresponding email \"\"\"\n return database_utilities.execute_query(f\"\"\"delete from admins where email = '{email}'\"\"\")","target":" @jwt_required\n def delete(self, email):\n \"\"\" Deletes admin with the corresponding email \"\"\"\n return database_utilities.execute_query(f\"\"\"delete from admins where email = %s\"\"\", (email, ))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"delete","file_name":"apis/admins.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#17-8a229c971b24","input":"def delete_playlists_videos(playlist_id, db):\n db.execute(\"DELETE FROM video where playlist_id={playlist_id};\".format(\n playlist_id=playlist_id))","target":"def delete_playlists_videos(playlist_id, db):\n db.execute(\"DELETE FROM video where playlist_id=%s;\", (playlist_id,))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"delete_playlists_videos","file_name":"video/video_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#18-1fe54fefc578","input":" @staticmethod\n def upsert_mapped_projects(user_id: int, project_id: int):\n \"\"\" Adds projects to mapped_projects if it doesn't exist \"\"\"\n sql = \"select * from users where id = {0} and projects_mapped @> '{{{1}}}'\".format(user_id, project_id)\n result = db.engine.execute(sql)\n\n if result.rowcount > 0:\n return # User has previously mapped this project so return\n\n sql = '''update users\n set projects_mapped = array_append(projects_mapped, {0})\n where id = {1}'''.format(project_id, user_id)\n\n db.engine.execute(sql)","target":" @staticmethod\n def upsert_mapped_projects(user_id: int, project_id: int):\n \"\"\" Adds projects to mapped_projects if it doesn't exist \"\"\"\n sql = \"select * from users where id = :user_id and projects_mapped @> '{{:project_id}}'\"\n result = db.engine.execute(text(sql), user_id=user_id, project_id=project_id)\n\n if result.rowcount > 0:\n return # User has previously mapped this project so return\n\n sql = '''update users\n set projects_mapped = array_append(projects_mapped, :project_id)\n where id = :user_id'''\n\n db.engine.execute(text(sql), project_id=project_id, user_id=user_id)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"upsert_mapped_projects","file_name":"server/models/postgis/user.py","commit_link":"github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#19-bfbb381c2ad4","input":"def get_first_ranked_month(db, scene, player):\n sql = \"select date from ranks where scene='{}' and player='{}' order by date limit 1;\".format(scene, player)\n res = db.exec(sql)\n date = res[0][0]\n return date","target":"def get_first_ranked_month(db, scene, player):\n sql = \"select date from ranks where scene='{scene}' and player='{player}' order by date limit 1;\"\n args = {'scene': scene, 'player': player}\n res = db.exec(sql, args)\n date = res[0][0]\n return date","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_first_ranked_month","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#20-3f7708bf024c","input":"@hook.command(adminonly=True)\ndef openPoll(question, reply=None, db=None):\n \"\"\"Creates a new poll.\"\"\"\n if not db_ready: db_init(db)\n try:\n active = db.execute(\"SELECT pollID FROM polls WHERE active = 1\").fetchone()[0]\n if active: \n reply(\"There already is an open poll.\")\n return\n except:\n db.execute(\"INSERT INTO polls (question, active) VALUES ('{}', 1)\".format(question))\n reply(\"Opened new poll: {}\".format(question))\n #reply(\"Poll opened!\")\n return","target":"@hook.command(adminonly=True)\ndef openPoll(question, reply=None, db=None):\n \"\"\"Creates a new poll.\"\"\"\n if not db_ready: db_init(db)\n try:\n active = db.execute(\"SELECT pollID FROM polls WHERE active = 1\").fetchone()[0]\n if active: \n reply(\"There already is an open poll.\")\n return\n except:\n db.execute(\"INSERT INTO polls (question, active) VALUES (?, 1)\", (question,))\n reply(\"Opened new poll: {}\".format(question))\n #reply(\"Poll opened!\")\n return","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"openPoll","file_name":"plugins/poll.py","commit_link":"github.com/FrozenPigs/Taigabot/commit/ea9b83a66ae1f0f38a1895f3e8dfa2833d77e3a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#21-0039b2cd868c","input":" def view_grocery_list():\n print(\"grocery== list\")\n groceryListFrame = Frame(self)\n groceryListFrame.rowconfigure(0, weight=1)\n groceryListFrame.columnconfigure(0, weight=1)\n groceryListFrame.rowconfigure(1, weight=3)\n groceryListFrame.columnconfigure(1, weight=3)\n groceryListFrame.pack()\n\n menu.pack_forget()\n groceryButton.pack_forget()\n label.configure(text=\"Grocery List\")\n\n i = 0\n database_file = \"meal_planner.db\"\n item_array = []\n with sqlite3.connect(database_file) as conn:\n cursor = conn.cursor()\n tableName = \"ingredients_\" + str(weekNumber)\n selection = cursor.execute(\"\"\"SELECT * FROM \"\"\" + tableName)\n for result in [selection]:\n for row in result.fetchall():\n print(row)\n for ingredient in row:\n print(ingredient)\n item_array.append(str(ingredient).split())\n i = i +1\n Label(groceryListFrame, text=ingredient, font=MEDIUM_FONT, justify=LEFT).grid(row=i, column=0, sticky=\"w\")\n \n\n j = 0\n for item in item_array:\n print(item)\n\n\n returnButton = Button(menuFrame, text = \"Return to Menu\", highlightbackground=\"#e7e7e7\", command=lambda: [groceryListFrame.pack_forget(),\n menu.pack(), returnButton.pack_forget(), label.configure(text=\"Meal Planer\"),\n groceryButton.pack(side=RIGHT)])\n returnButton.pack(side=RIGHT)","target":" def view_grocery_list():\n print(\"grocery== list\")\n groceryListFrame = Frame(self)\n groceryListFrame.rowconfigure(0, weight=1)\n groceryListFrame.columnconfigure(0, weight=1)\n groceryListFrame.rowconfigure(1, weight=3)\n groceryListFrame.columnconfigure(1, weight=3)\n groceryListFrame.pack()\n\n menu.pack_forget()\n groceryButton.pack_forget()\n label.configure(text=\"Grocery List\")\n\n i = 0\n database_file = \"meal_planner.db\"\n item_array = []\n with sqlite3.connect(database_file) as conn:\n cursor = conn.cursor()\n tableName = \"ingredients_\" + str(weekNumber)\n selection = cursor.execute(\"\"\"SELECT * FROM ?;\"\"\", (tableName, ))\n for result in [selection]:\n for row in result.fetchall():\n print(row)\n for ingredient in row:\n print(ingredient)\n item_array.append(str(ingredient).split())\n i = i +1\n Label(groceryListFrame, text=ingredient, font=MEDIUM_FONT, justify=LEFT).grid(row=i, column=0, sticky=\"w\")\n \n\n j = 0\n for item in item_array:\n print(item)\n\n\n returnButton = Button(menuFrame, text = \"Return to Menu\", highlightbackground=\"#e7e7e7\", command=lambda: [groceryListFrame.pack_forget(),\n menu.pack(), returnButton.pack_forget(), label.configure(text=\"Meal Planer\"),\n groceryButton.pack(side=RIGHT)])\n returnButton.pack(side=RIGHT)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"__init__.view_grocery_list","file_name":"mealPlan.py","commit_link":"github.com/trishamoyer/RecipePlanner-Python/commit/44d2ce370715d9344fad34b3b749322ab095a925","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#22-30cbac8f5530","input":"@app.route('//history/record')\ndef view_page_record(page_name):\n content_id = request.args.get('id')\n query = db.query(\"select page_content.content, page_content.timestamp from page, page_content where page.id = page_content.page_id and page_content.id = '%s'\" % content_id)\n page_record = query.namedresult()[0]\n\n return render_template(\n 'page_record.html',\n page_name = page_name,\n page_record = page_record\n )","target":"@app.route('//history/record')\ndef view_page_record(page_name):\n content_id = request.args.get('id')\n query = db.query(\"select page_content.content, page_content.timestamp from page, page_content where page.id = page_content.page_id and page_content.id = $1\", content_id)\n page_record = query.namedresult()[0]\n\n return render_template(\n 'page_record.html',\n page_name = page_name,\n page_record = page_record\n )","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"view_page_record","file_name":"server.py","commit_link":"github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#23-9d36ff5295e1","input":" def update_inverter(self, inverter_serial, ts, status, etoday, etotal):\n query = '''\n UPDATE Inverters\n SET \n TimeStamp='%s', \n Status='%s', \n eToday='%s',\n eTotal='%s'\n WHERE Serial='%s';\n ''' % (ts, status, etoday, etotal, inverter_serial)\n self.c.execute(query)","target":" def update_inverter(self, inverter_serial, ts, status, etoday, etotal):\n query = '''\n UPDATE Inverters\n SET \n TimeStamp=?, \n Status=?, \n eToday=?,\n eTotal=?\n WHERE Serial=?;\n '''\n self.c.execute(query, (ts, status, etoday, etotal, inverter_serial))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"update_inverter","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#24-71acb5a8ca96","input":"def insert(key, value):\n connection = psycopg2.connect(host=config['HOST'], port=config['PORT'], database=config['NAME'], user=config['USER'], password=config['PASSWORD'])\n cur = connection.cursor()\n try:\n cur.execute(\"insert into reply_map values('{}', '{}')\".format(key, value))\n connection.commit()\n except:\n pass","target":"def insert(key, value):\n connection = psycopg2.connect(host=config['HOST'], port=config['PORT'], database=config['NAME'], user=config['USER'], password=config['PASSWORD'])\n cur = connection.cursor()\n try:\n cur.execute(\"insert into reply_map values(?, ?)\", (key, value))\n connection.commit()\n except:\n pass","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"insert","file_name":"db.py","commit_link":"github.com/tadaren/reply_bot/commit/5aeafa7e9597a766992af9ff8189e1f050b6579b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#25-918235b7b09f","input":" def save_failure_transaction(self, user_id, project_id, money):\n self.cursor.execute(\"insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, %s, now(), 'failed' )\" % (project_id, user_id, money))\n self.db.commit()","target":" def save_failure_transaction(self, user_id, project_id, money):\n self.cursor.execute(\"insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, \"\n \"%s, now(), 'failed' )\", (project_id, user_id, money))\n self.db.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"save_failure_transaction","file_name":"backend/transactions/TransactionConnector.py","commit_link":"github.com/JLucka/kickstarter-dev/commit/e2ffa062697e060fdfbd2eccbb89a8c53a569e0b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#26-bb8002dde220","input":" @unpack\n def test_process_as_form(self, job_number, dcn_key, was_prev_matched,\n was_prev_closed, was_prev_tracked):\n email_obj = {\n 'sender' : \"Alex Roy \",\n 'subject' : \"DO NOT MODIFY MESSAGE BELOW - JUST HIT `SEND`\",\n 'date' : \"Tue, 7 May 2019 17:34:17 +0000\",\n 'content' : (\n f\"job_number={job_number}&title=TEST_ENTRY&city=Ottawa&\"\n f\"address=2562+Del+Zotto+Ave.%2C+Ottawa%2C+Ontario&\"\n f\"contractor=GCN&engineer=Goodkey&owner=Douglas+Stalker&\"\n f\"quality=2&cc_email=&link_to_cert={dcn_key}\\r\\n\"\n )\n }\n # set-up new entries in db, if necessary\n fake_dilfo_insert = \"\"\"\n INSERT INTO df_dilfo (job_number, receiver_email, closed)\n VALUES ({}, 'alex.roy616@gmail.com', {})\n \"\"\"\n fake_match_insert = \"\"\"\n INSERT INTO df_matched (job_number, verifier, ground_truth)\n VALUES ({}, 'alex.roy616@gmail.com', {})\n \"\"\"\n with create_connection() as conn:\n if was_prev_closed or was_prev_tracked:\n conn.cursor().execute(fake_dilfo_insert.format(job_number, was_prev_closed))\n if was_prev_matched:\n if was_prev_closed:\n conn.cursor().execute(fake_match_insert.format(job_number, 1))\n else:\n conn.cursor().execute(fake_match_insert.format(job_number, 0))\n with create_connection() as conn:\n df_dilfo_pre = pd.read_sql(f\"SELECT * FROM df_dilfo WHERE job_number={job_number}\", conn)\n df_matched_pre = pd.read_sql(f\"SELECT * FROM df_matched WHERE job_number={job_number}\", conn)\n process_as_form(email_obj)\n # make assertions about db now that reply has been processed\n with create_connection() as conn:\n df_dilfo_post = pd.read_sql(f\"SELECT * FROM df_dilfo WHERE job_number={job_number}\", conn)\n df_matched_post = pd.read_sql(f\"SELECT * FROM df_matched WHERE job_number={job_number}\", conn)\n self.assertEqual(len(df_dilfo_post), 1)\n self.assertEqual(bool(df_dilfo_post.iloc[0].closed), bool(was_prev_closed or dcn_key))\n self.assertEqual(any(df_matched_post.ground_truth), bool(was_prev_closed or dcn_key))\n self.assertEqual(len(df_matched_pre) + bool(dcn_key and not(was_prev_closed)), len(df_matched_post))\n self.assertEqual(list(df_matched_pre.columns), list(df_matched_post.columns))\n self.assertEqual(list(df_dilfo_pre.columns), list(df_dilfo_post.columns))","target":" @unpack\n def test_process_as_form(self, job_number, dcn_key, was_prev_matched,\n was_prev_closed, was_prev_tracked):\n email_obj = {\n 'sender' : \"Alex Roy \",\n 'subject' : \"DO NOT MODIFY MESSAGE BELOW - JUST HIT `SEND`\",\n 'date' : \"Tue, 7 May 2019 17:34:17 +0000\",\n 'content' : (\n f\"job_number={job_number}&title=TEST_ENTRY&city=Ottawa&\"\n f\"address=2562+Del+Zotto+Ave.%2C+Ottawa%2C+Ontario&\"\n f\"contractor=GCN&engineer=Goodkey&owner=Douglas+Stalker&\"\n f\"quality=2&cc_email=&link_to_cert={dcn_key}\\r\\n\"\n )\n }\n # set-up new entries in db, if necessary\n fake_dilfo_insert = \"\"\"\n INSERT INTO df_dilfo (job_number, receiver_email, closed)\n VALUES (?, 'alex.roy616@gmail.com', ?)\n \"\"\"\n fake_match_insert = \"\"\"\n INSERT INTO df_matched (job_number, verifier, ground_truth)\n VALUES (?, 'alex.roy616@gmail.com', ?)\n \"\"\"\n with create_connection() as conn:\n if was_prev_closed or was_prev_tracked:\n conn.cursor().execute(fake_dilfo_insert, [job_number, was_prev_closed])\n if was_prev_matched:\n if was_prev_closed:\n conn.cursor().execute(fake_match_insert, [job_number, 1])\n else:\n conn.cursor().execute(fake_match_insert, [job_number, 0])\n with create_connection() as conn:\n df_dilfo_pre = pd.read_sql(\"SELECT * FROM df_dilfo WHERE job_number=?\", conn, params=[job_number])\n df_matched_pre = pd.read_sql(\"SELECT * FROM df_matched WHERE job_number=?\", conn, params=[job_number])\n process_as_form(email_obj)\n # make assertions about db now that reply has been processed\n with create_connection() as conn:\n df_dilfo_post = pd.read_sql(\"SELECT * FROM df_dilfo WHERE job_number=?\", conn, params=[job_number])\n df_matched_post = pd.read_sql(\"SELECT * FROM df_matched WHERE job_number=?\", conn, params=[job_number])\n self.assertEqual(len(df_dilfo_post), 1)\n self.assertEqual(bool(df_dilfo_post.iloc[0].closed), bool(was_prev_closed or dcn_key))\n self.assertEqual(any(df_matched_post.ground_truth), bool(was_prev_closed or dcn_key))\n self.assertEqual(len(df_matched_pre) + bool(dcn_key and not(was_prev_closed)), len(df_matched_post))\n self.assertEqual(list(df_matched_pre.columns), list(df_matched_post.columns))\n self.assertEqual(list(df_dilfo_pre.columns), list(df_dilfo_post.columns))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"test_process_as_form","file_name":"tests.py","commit_link":"github.com/confirmationbias616/certificate_checker/commit/9e890b9613b627e3a5995d0e4a594c8e0831e2ce","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#27-386d72f27f1b","input":"@app.route('/')\ndef render_page_name(page_name):\n query = db.query(\"select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = '%s' order by page_content.id desc limit 1\" % page_name)\n wiki_page = query.namedresult()\n has_content = False\n page_is_taken = False\n if len(wiki_page) < 1:\n content = \"\"\n else:\n page_is_taken = True\n content = wiki_page[0].content\n if len(content) > 0:\n has_content = True\n else:\n pass\n content = markdown.markdown(wiki_linkify(content))\n return render_template(\n 'pageholder.html',\n page_is_taken = page_is_taken,\n page_name = page_name,\n markdown = markdown,\n wiki_linkify = wiki_linkify,\n has_content = has_content,\n content = content\n )","target":"@app.route('/')\ndef render_page_name(page_name):\n query = db.query(\"select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = $1 order by page_content.id desc limit 1\", page_name)\n wiki_page = query.namedresult()\n has_content = False\n page_is_taken = False\n if len(wiki_page) < 1:\n content = \"\"\n else:\n page_is_taken = True\n content = wiki_page[0].content\n if len(content) > 0:\n has_content = True\n else:\n pass\n content = markdown.markdown(wiki_linkify(content))\n return render_template(\n 'pageholder.html',\n page_is_taken = page_is_taken,\n page_name = page_name,\n markdown = markdown,\n wiki_linkify = wiki_linkify,\n has_content = has_content,\n content = content\n )","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"render_page_name","file_name":"server.py","commit_link":"github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#28-8b7246efe51a","input":" def tid_to_tid_num(self, tid):\n ''' Returns tid_num, given tid. '''\n\n q = \"SELECT rowid FROM tids WHERE tid = '\" + tid + \"'\"\n self.query(q)\n return self.c.fetchone()[0]","target":" def tid_to_tid_num(self, tid):\n ''' Returns tid_num, given tid. '''\n\n q = \"SELECT rowid FROM tids WHERE tid = ?\"\n self.query(q, tid)\n return self.c.fetchone()[0]","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"tid_to_tid_num","file_name":"modules/query_lastfm.py","commit_link":"github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#29-c3bd562d4f46","input":"def get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution):\n \"\"\"\n Get all the old sourcebyinstitution number from the SQLite database.\n \"\"\"\n query = \"\"\"\n SELECT\n titles\n FROM\n history\n WHERE\n sourcebyinstitution = \"%s\"\n ORDER BY\n titles DESC\n LIMIT 1\n \"\"\" % sourcebyinstitution\n\n sqlite.execute(query)\n for record in sqlite:\n old_sourcebyinstitution_number = record[0]\n return old_sourcebyinstitution_number","target":"def get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution):\n \"\"\"\n Get all the old sourcebyinstitution number from the SQLite database.\n \"\"\"\n query = \"\"\"\n SELECT\n titles\n FROM\n history\n WHERE\n sourcebyinstitution = ?\n ORDER BY\n titles DESC\n LIMIT 1\n \"\"\"\n\n sqlite.execute(query, (sourcebyinstitution,))\n for record in sqlite:\n old_sourcebyinstitution_number = record[0]\n return old_sourcebyinstitution_number","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_old_sourcebyinstitution_number","file_name":"bin/solrcheckup.py","commit_link":"github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#30-c6c7452a048b","input":"def top_karma(bot, trigger):\n \"\"\"\n Show karma status for the top n number of IRC users.\n \"\"\"\n try:\n top_limit = int(trigger.group(2).strip())\n except ValueError:\n top_limit = 5\n\n query = \"SELECT slug, value FROM nick_values NATURAL JOIN nicknames \\\n WHERE key = 'karma' ORDER BY value DESC LIMIT %d\"\n karmalist = bot.db.execute(query % top_limit).fetchall()\n for user in karmalist:\n bot.say(\"%s == %s\" % (user[0], user[1]))","target":"def top_karma(bot, trigger):\n \"\"\"\n Show karma status for the top n number of IRC users.\n \"\"\"\n try:\n top_limit = int(trigger.group(2).strip())\n except ValueError:\n top_limit = 5\n\n query = \"SELECT slug, value FROM nick_values NATURAL JOIN nicknames \\\n WHERE key = 'karma' ORDER BY value DESC LIMIT ?\"\n karmalist = bot.db.execute(query, str(top_limit)).fetchall()\n for user in karmalist:\n bot.say(\"%s == %s\" % (user[0], user[1]))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"top_karma","file_name":"sopel_modules/karma/karma.py","commit_link":"github.com/OpCode1300/sopel-karma/commit/e4d49f7b3d88f8874c7862392f3f4c2065a25695","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#31-bc6bbc952e37","input":"def retrieve_playlist_by_id(id, db):\n db.execute(\n \"SELECT id, name, video_position from playlist WHERE id={id};\".format(id=id))\n row = db.fetchone()\n return row","target":"def retrieve_playlist_by_id(id, db):\n db.execute(\n \"SELECT id, name, video_position from playlist WHERE id=%s;\", (id,))\n row = db.fetchone()\n return row","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"retrieve_playlist_by_id","file_name":"playlist/playlist_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#32-30ee0daacdf1","input":"@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_GET_TASK.value)\ndef get_task(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n name = conn.fetchone()\n settings.close()\n if name == None:\n bot.send_message(message.chat.id, \"You should login before get tasks.\")\n else:\n bases.update.update_user(name[1], name[0], name[2])\n bot.send_message(message.chat.id, bases.problem.get_unsolved_problem(message.text, name[1]))\n set_state(message.chat.id, config.States.S_START.value)","target":"@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_GET_TASK.value)\ndef get_task(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))\n name = conn.fetchone()\n settings.close()\n if name == None:\n bot.send_message(message.chat.id, \"You should login before get tasks.\")\n else:\n bases.update.update_user(name[1], name[0], name[2])\n bot.send_message(message.chat.id, bases.problem.get_unsolved_problem(message.text, name[1]))\n set_state(message.chat.id, config.States.S_START.value)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_task","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#33-8f0ac3b77541","input":"@bot.message_handler(commands=['stats'])\ndef stats(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n name = conn.fetchone()\n settings.close()\n if name != None:\n bases.update.update_user(name[1], name[0], name[2])\n bases.problem.create_text_stats(name[1])\n img = open(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\users\\\\\" + name[1] + \".png\", \"rb\")\n bot.send_photo(message.chat.id, img)\n img.close()\n if bases.problem.create_stats_picture(name[1]):\n bot.send_message(message.chat.id, \"Sorry, you haven't solved tasks.\")\n return 0\n img = open(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\users\\\\\" + name[1] + \".png\", \"rb\")\n bot.send_photo(message.chat.id, img)\n img.close()\n else:\n bot.send_message(message.chat.id, \"You should login before getting statistic.\")","target":"@bot.message_handler(commands=['stats'])\ndef stats(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))\n name = conn.fetchone()\n settings.close()\n if name != None:\n bases.update.update_user(name[1], name[0], name[2])\n bases.problem.create_text_stats(name[1])\n img = open(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\users\\\\\" + name[1] + \".png\", \"rb\")\n bot.send_photo(message.chat.id, img)\n img.close()\n if bases.problem.create_stats_picture(name[1]):\n bot.send_message(message.chat.id, \"Sorry, you haven't solved tasks.\")\n return 0\n img = open(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\users\\\\\" + name[1] + \".png\", \"rb\")\n bot.send_photo(message.chat.id, img)\n img.close()\n else:\n bot.send_message(message.chat.id, \"You should login before getting statistic.\")","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"stats","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#34-e03b891fa46b","input":" @jwt_required\n def delete(self, user_id):\n \"\"\" Deletes user with the corresponding user_id \"\"\"\n return database_utilities.execute_query(f\"\"\"delete from users where user_id = '{user_id}'\"\"\")","target":" @jwt_required\n def delete(self, user_id):\n \"\"\" Deletes user with the corresponding user_id \"\"\"\n return database_utilities.execute_query(f\"\"\"delete from users where user_id = %s\"\"\", (user_id, ))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"delete","file_name":"apis/users.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#35-77207dc1cf69","input":" def verify_rno(self, rno):\n query = \"SELECT COUNT(rno) FROM rides WHERE rno = {rno}\".format(rno = rno)\n self.cursor.execute(query)\n result = self.cursor.fetchone()\n if (int(result[0]) > 0):\n return True \n else:\n return False","target":" def verify_rno(self, rno):\n self.cursor.execute(\"SELECT COUNT(rno) FROM rides WHERE rno = :rno\", {'rno': rno})\n result = self.cursor.fetchone()\n if (int(result[0]) > 0):\n return True \n else:\n return False","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"verify_rno","file_name":"book_rides/book_rides.py","commit_link":"github.com/kenboo98/291-Mini-Project-I/commit/3080ccb687c79c83954ce703faee8fcceec8c9eb","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#36-5da1a990c61b","input":" def get_requested_day(self, date):\n\n data = dict()\n\n day_start, day_end = self.get_epoch_day(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(day_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(day_end, self.local_timezone)}\n\n query = '''\n SELECT TimeStamp, SUM(Power) AS Power \n FROM DayData \n WHERE TimeStamp BETWEEN %s AND %s \n GROUP BY TimeStamp;\n '''\n\n data['data'] = list()\n for row in self.c.execute(query % (day_start, day_end)):\n data['data'].append({ 'time': row[0], 'power': row[1] })\n\n\n if self.get_datetime(date).date() == datetime.today().date():\n query = '''\n SELECT SUM(EToday) as EToday\n FROM Inverters;\n '''\n else:\n query = '''\n SELECT SUM(DayYield) AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN %s AND %s\n GROUP BY TimeStamp\n ''' % (day_start, day_end)\n self.c.execute(query)\n row = self.c.fetchone()\n if row and row[0]: data['total'] = row[0]\n else: data['total'] = 0\n\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM ( SELECT TimeStamp FROM DayData GROUP BY TimeStamp );\n '''\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if (first_data): data['hasPrevious'] = (first_data < day_start)\n else: data['hasPrevious'] = False\n\n if (last_data): data['hasNext'] = (last_data > day_end)\n else: data['hasNext'] = False\n\n #print(json.dumps(data, indent=4))\n return data","target":" def get_requested_day(self, date):\n\n data = dict()\n\n day_start, day_end = self.get_epoch_day(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(day_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(day_end, self.local_timezone)}\n\n query = '''\n SELECT TimeStamp, SUM(Power) AS Power \n FROM DayData \n WHERE TimeStamp BETWEEN ? AND ?\n GROUP BY TimeStamp;\n '''\n\n data['data'] = list()\n for row in self.c.execute(query, (day_start, day_end)):\n data['data'].append({ 'time': row[0], 'power': row[1] })\n\n\n if self.get_datetime(date).date() == datetime.today().date():\n query = '''\n SELECT SUM(EToday) as EToday\n FROM Inverters;\n '''\n self.c.execute(query)\n else:\n query = '''\n SELECT SUM(DayYield) AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN ? AND ?\n GROUP BY TimeStamp;\n '''\n self.c.execute(query, (day_start, day_end))\n\n row = self.c.fetchone()\n if row and row[0]: data['total'] = row[0]\n else: data['total'] = 0\n\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM ( SELECT TimeStamp FROM DayData GROUP BY TimeStamp );\n '''\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if (first_data): data['hasPrevious'] = (first_data < day_start)\n else: data['hasPrevious'] = False\n\n if (last_data): data['hasNext'] = (last_data > day_end)\n else: data['hasNext'] = False\n\n #print(json.dumps(data, indent=4))\n return data","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_requested_day","file_name":"util/database.py","commit_link":"github.com/philipptrenz/sunportal/commit/7eef493a168ed4e6731ff800713bfb8aee99a506","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#37-57f0cdccbac8","input":"def add_language(lang):\n try:\n cur.execute(f\"INSERT INTO language (name) VALUES ('{lang}')\")\n except Exception as e:\n pass\n cur.execute(f\"SELECT language_id FROM language where name='{lang}'\")\n lang_id = cur.fetchone()[0]\n if conn.commit():\n return lang_id\n return lang_id","target":"def add_language(lang):\n try:\n cur.execute(\"INSERT INTO language (name) VALUES (%s)\", (lang, ))\n except Exception as e:\n pass\n cur.execute(\"SELECT language_id FROM language where name=%s\", (lang, ))\n lang_id = cur.fetchone()[0]\n if conn.commit():\n return lang_id\n return lang_id","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_language","file_name":"app.py","commit_link":"github.com/Elbertbiggs360/dvdrental/commit/ad144ae2a08a332498d0831bc255170d57ba754b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#38-4e141ada1ca1","input":"def makeJudge(judge):\n\tdb.execute(\"UPDATE players SET Judge = 1 WHERE Name = '%s' COLLATE NOCASE\" % (judge)) \n\tdatabase.commit()","target":"def makeJudge(judge):\n\tdb.execute(\"UPDATE players SET Judge = 1 WHERE Name = ? COLLATE NOCASE\", judge) \n\tdatabase.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"makeJudge","file_name":"plugins/database.py","commit_link":"github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#39-50ee2962ef57","input":"def isValidAdmToken(adm_token):\n conn, c = connectDB()\n req = \"SELECT * from {} where adm_token='{}'\".format(CFG(\"admintoken_table_name\"), adm_token)\n answer = bool(queryOne(c, req))\n closeDB(conn)\n return answer","target":"def isValidAdmToken(adm_token):\n conn, c = connectDB()\n req = \"SELECT * from {} where adm_token=?\".format(CFG(\"admintoken_table_name\"))\n answer = bool(queryOne(c, req, (adm_token,)))\n closeDB(conn)\n return answer","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"isValidAdmToken","file_name":"database.py","commit_link":"github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#40-25a55ed284e5","input":" @staticmethod\n def get_mapped_projects(user_id: int, preferred_locale: str) -> UserMappedProjectsDTO:\n \"\"\" Get all projects a user has mapped on \"\"\"\n\n # This query looks scary, but we're really just creating an outer join between the query that gets the\n # counts of all mapped tasks and the query that gets counts of all validated tasks. This is necessary to\n # handle cases where users have only validated tasks on a project, or only mapped on a project.\n sql = '''SELECT p.id,\n p.status,\n p.default_locale,\n c.mapped,\n c.validated,\n st_asgeojson(p.centroid)\n FROM projects p,\n (SELECT coalesce(v.project_id, m.project_id) project_id,\n coalesce(v.validated, 0) validated,\n coalesce(m.mapped, 0) mapped\n FROM (SELECT t.project_id,\n count (t.validated_by) validated\n FROM tasks t\n WHERE t.project_id IN (SELECT unnest(projects_mapped) FROM users WHERE id = {0})\n AND t.validated_by = {0}\n GROUP BY t.project_id, t.validated_by) v\n FULL OUTER JOIN\n (SELECT t.project_id,\n count(t.mapped_by) mapped\n FROM tasks t\n WHERE t.project_id IN (SELECT unnest(projects_mapped) FROM users WHERE id = {0})\n AND t.mapped_by = {0}\n GROUP BY t.project_id, t.mapped_by) m\n ON v.project_id = m.project_id) c\n WHERE p.id = c.project_id ORDER BY p.id DESC'''.format(user_id)\n\n results = db.engine.execute(sql)\n\n if results.rowcount == 0:\n raise NotFound()\n\n mapped_projects_dto = UserMappedProjectsDTO()\n for row in results:\n mapped_project = MappedProject()\n mapped_project.project_id = row[0]\n mapped_project.status = ProjectStatus(row[1]).name\n mapped_project.tasks_mapped = row[3]\n mapped_project.tasks_validated = row[4]\n mapped_project.centroid = geojson.loads(row[5])\n\n project_info = ProjectInfo.get_dto_for_locale(row[0], preferred_locale, row[2])\n mapped_project.name = project_info.name\n\n mapped_projects_dto.mapped_projects.append(mapped_project)\n\n return mapped_projects_dto","target":" @staticmethod\n def get_mapped_projects(user_id: int, preferred_locale: str) -> UserMappedProjectsDTO:\n \"\"\" Get all projects a user has mapped on \"\"\"\n\n # This query looks scary, but we're really just creating an outer join between the query that gets the\n # counts of all mapped tasks and the query that gets counts of all validated tasks. This is necessary to\n # handle cases where users have only validated tasks on a project, or only mapped on a project.\n sql = '''SELECT p.id,\n p.status,\n p.default_locale,\n c.mapped,\n c.validated,\n st_asgeojson(p.centroid)\n FROM projects p,\n (SELECT coalesce(v.project_id, m.project_id) project_id,\n coalesce(v.validated, 0) validated,\n coalesce(m.mapped, 0) mapped\n FROM (SELECT t.project_id,\n count (t.validated_by) validated\n FROM tasks t\n WHERE t.project_id IN (SELECT unnest(projects_mapped) FROM users WHERE id = :user_id)\n AND t.validated_by = :user_id\n GROUP BY t.project_id, t.validated_by) v\n FULL OUTER JOIN\n (SELECT t.project_id,\n count(t.mapped_by) mapped\n FROM tasks t\n WHERE t.project_id IN (SELECT unnest(projects_mapped) FROM users WHERE id = :user_id)\n AND t.mapped_by = :user_id\n GROUP BY t.project_id, t.mapped_by) m\n ON v.project_id = m.project_id) c\n WHERE p.id = c.project_id ORDER BY p.id DESC'''\n\n results = db.engine.execute(text(sql), user_id=user_id)\n\n if results.rowcount == 0:\n raise NotFound()\n\n mapped_projects_dto = UserMappedProjectsDTO()\n for row in results:\n mapped_project = MappedProject()\n mapped_project.project_id = row[0]\n mapped_project.status = ProjectStatus(row[1]).name\n mapped_project.tasks_mapped = row[3]\n mapped_project.tasks_validated = row[4]\n mapped_project.centroid = geojson.loads(row[5])\n\n project_info = ProjectInfo.get_dto_for_locale(row[0], preferred_locale, row[2])\n mapped_project.name = project_info.name\n\n mapped_projects_dto.mapped_projects.append(mapped_project)\n\n return mapped_projects_dto","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_mapped_projects","file_name":"server/models/postgis/user.py","commit_link":"github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#41-e3f18712cf87","input":" def delete_data(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, str(id))\n query = \"DELETE FROM %s WHERE identifier = '%s';\" % (self.table, sid)\n self._query(query)\n return None","target":" def delete_data(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, str(id))\n query = \"DELETE FROM %s WHERE identifier = $1;\" % (self.table)\n self._query(query, sid)\n return None","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"delete_data","file_name":"cheshire3/sql/postgresStore.py","commit_link":"github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#42-8a74bbc6cd76","input":" def user_verify(self):\n eid = self.email\n code = self.password\n if eid.strip() == '':\n return\n if code.strip() == '':\n return\n query = '''select * from usr where email like\\''''+eid+'\\''\n cursor = g.conn.execute(query)\n for row in cursor:\n key = str(row.password)\n if key.strip() == code.strip():\n self.name = str(row.name)\n self.email = eid\n self.id = eid\n self.valid = True\n break","target":" def user_verify(self):\n eid = self.email\n code = self.password\n if eid.strip() == '':\n return\n if code.strip() == '':\n return\n query = 'select * from usr where email like %s'\n cursor = g.conn.execute(query, (eid, ))\n for row in cursor:\n key = str(row.password)\n if key.strip() == code.strip():\n self.name = str(row.name)\n self.email = eid\n self.id = eid\n self.valid = True\n break","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"user_verify","file_name":"Web-app/User.py","commit_link":"github.com/Daniel-Bu/w4111-project1/commit/fe04bedc72e62fd4c4ee046a9af29fd81e9b3340","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#43-5b68d6d2ded2","input":"@app.route('/movies/search', methods=['GET', 'POST'])\ndef search_films():\n form = SearchForm()\n if not form.validate_on_submit():\n return render_template('search.html', title='Search for films', form=form)\n search_terms = form.data['term'].split(' ')\n search_string = ' & '.join(search_terms)\n cur.execute(f\"SELECT * FROM film where fulltext @@ to_tsquery('{search_string}')\")\n res = cur.fetchall()\n return render_template('search_results.html', title='Home', res=len(res))","target":"@app.route('/movies/search', methods=['GET', 'POST'])\ndef search_films():\n form = SearchForm()\n if not form.validate_on_submit():\n return render_template('search.html', title='Search for films', form=form)\n search_terms = form.data['term'].split(' ')\n search_string = ' & '.join(search_terms)\n cur.execute(\"SELECT * FROM film where fulltext @@ to_tsquery(%s)\", (search_string, ))\n res = cur.fetchall()\n return render_template('search_results.html', title='Home', res=len(res))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"search_films","file_name":"app.py","commit_link":"github.com/Elbertbiggs360/dvdrental/commit/ad144ae2a08a332498d0831bc255170d57ba754b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#44-941cab34e61e","input":"def getGameCountInSeriesSoFar(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT COUNT(*) FROM ChallengeRankings WHERE SeriesTitle = '\" + getTitle(submission) + \"' AND Date <= '\" + getSubmissionDateFromDatabase(submission) + \"'\").fetchone()[0]\n database.close()","target":"def getGameCountInSeriesSoFar(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT COUNT(*) FROM ChallengeRankings WHERE SeriesTitle = ? AND Date <= ?\", [getTitle(submission), getSubmissionDateFromDatabase(submission)]).fetchone()[0]\n database.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getGameCountInSeriesSoFar","file_name":"CheckAndPostForSeriesSubmissions.py","commit_link":"github.com/LiquidFun/Reddit-GeoGuessr-Tracking-Bot/commit/0cad2d52e24b05da32789fbc8face7a9999a71f9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#45-ad219ea06fab","input":"@mod.route('/add', methods=['GET', 'POST'])\ndef add():\n if request.method == 'POST':\n msg_id = int(request.form['msg_id'])\n user_id = session['logged_id']\n content = request.form['content']\n c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n sql = \"INSERT INTO comment(msg_id,user_id,content,c_time) \" + \\\n \"VALUES(%d,%d,'%s','%s');\" % (msg_id, user_id, content, c_time)\n cursor.execute(sql)\n conn.commit()\n return redirect(url_for('comment.show', msg_id=msg_id))","target":"@mod.route('/add', methods=['GET', 'POST'])\ndef add():\n if request.method == 'POST':\n msg_id = int(request.form['msg_id'])\n user_id = session['logged_id']\n content = request.form['content']\n c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n cursor.execute(\"INSERT INTO comment(msg_id,user_id,content,c_time) VALUES(%s,%s,%s,%s);\", (msg_id, user_id, content, c_time))\n conn.commit()\n return redirect(url_for('comment.show', msg_id=msg_id))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add","file_name":"flaskr/flaskr/views/comment.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#46-8d6ffcb96c35","input":"def get_mod_taken_together_with(code):\n '''\n Retrieves the list of modules taken together with the specified\n module code in the same semester.\n\n Returns a table of lists (up to 10 top results). Each list contains\n (specified code, module code of mod taken together, aySem, number of students)\n\n e.g. [(CS1010, CS1231, AY 16/17 Sem 1, 5)] means there are 5 students\n taking CS1010 and CS1231 together in AY 16/17 Sem 1.\n '''\n NUM_TOP_RESULTS_TO_RETURN = 10\n\n sql_command = \"SELECT sp1.moduleCode, sp2.moduleCode, sp1.acadYearAndSem, COUNT(*) \" + \\\n \"FROM studentPlans sp1, studentPlans sp2 \" + \\\n \"WHERE sp1.moduleCode = '\" + code + \"' AND \" + \\\n \"sp2.moduleCode <> sp1.moduleCode AND \" + \\\n \"sp1.studentId = sp2.studentId AND \" + \\\n \"sp1.acadYearAndSem = sp2.acadYearAndSem \" + \\\n \"GROUP BY sp1.moduleCode, sp2.moduleCode, sp1.acadYearAndSem \" + \\\n \"ORDER BY COUNT(*) DESC\"\n\n DB_CURSOR.execute(sql_command)\n\n return DB_CURSOR.fetchmany(NUM_TOP_RESULTS_TO_RETURN)","target":"def get_mod_taken_together_with(code):\n '''\n Retrieves the list of modules taken together with the specified\n module code in the same semester.\n\n Returns a table of lists (up to 10 top results). Each list contains\n (specified code, module code of mod taken together, aySem, number of students)\n\n e.g. [(CS1010, CS1231, AY 16/17 Sem 1, 5)] means there are 5 students\n taking CS1010 and CS1231 together in AY 16/17 Sem 1.\n '''\n NUM_TOP_RESULTS_TO_RETURN = 10\n\n sql_command = \"SELECT sp1.moduleCode, sp2.moduleCode, sp1.acadYearAndSem, COUNT(*) \" + \\\n \"FROM studentPlans sp1, studentPlans sp2 \" + \\\n \"WHERE sp1.moduleCode = %s AND \" + \\\n \"sp2.moduleCode <> sp1.moduleCode AND \" + \\\n \"sp1.studentId = sp2.studentId AND \" + \\\n \"sp1.acadYearAndSem = sp2.acadYearAndSem \" + \\\n \"GROUP BY sp1.moduleCode, sp2.moduleCode, sp1.acadYearAndSem \" + \\\n \"ORDER BY COUNT(*) DESC\"\n\n DB_CURSOR.execute(sql_command, (code,))\n\n return DB_CURSOR.fetchmany(NUM_TOP_RESULTS_TO_RETURN)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_mod_taken_together_with","file_name":"components/model.py","commit_link":"github.com/nus-mtp/cs-modify/commit/79b4b1dd7eba5445751808e4c50b49d2dd08366b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#47-712aa7e20399","input":"@endpoints.route(\"/wins\")\ndef wins():\n if db == None:\n init()\n\n player = request.args.get('tag', default=\"christmasmike\")\n sql = \"SELECT * FROM matches WHERE winner = '\"+str(player)+\"' ORDER BY date DESC;\"\n result = db.exec(sql)\n\n result = [str(x) for x in result]\n result = '\\n'.join(result)\n return json.dumps(result)","target":"@endpoints.route(\"/wins\")\ndef wins():\n if db == None:\n init()\n\n player = request.args.get('tag', default=\"christmasmike\")\n sql = \"SELECT * FROM matches WHERE winner = '{player}' ORDER BY date DESC;\"\n args = {'player': player}\n result = db.exec(sql, args)\n\n result = [str(x) for x in result]\n result = '\\n'.join(result)\n return json.dumps(result)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"wins","file_name":"endpoints.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#48-f6eba8e75930","input":" def delete_event(self, event_id):\n sql = \"\"\"DELETE FROM events\n WHERE event_id = {0}\n \"\"\".format(event_id)\n affected_count = self.cur.execute(sql)\n self.conn.commit()\n return affected_count","target":" def delete_event(self, event_id):\n sql = \"\"\"\n DELETE FROM events\n WHERE event_id = %s\n \"\"\"\n affected_count = self.cur.execute(sql, (event_id,))\n self.conn.commit()\n return affected_count","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"delete_event","file_name":"db/dbase.py","commit_link":"github.com/jgayfer/spirit/commit/01c846c534c8d3cf6763f8b7444a0efe2caa3799","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#49-5d136fd1fa9b","input":" def add_item(self, item):\n \"\"\"\"Add new item.\"\"\"\n if self.connection:\n self.cursor.execute('insert into item (name, shoppinglistid) values (\"%s\", \"%s\")' % (item[0], item[1]))\n self.connection.commit()","target":" def add_item(self, item):\n \"\"\"\"Add new item.\"\"\"\n if self.connection:\n t = (item[0], item[1], )\n self.cursor.execute('insert into item (name, shoppinglistid) values (?, ?)', t)\n self.connection.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_item","file_name":"ecosldb/ecosldb.py","commit_link":"github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#50-b5e33d982a76","input":"def fetch_issue(cursor, id):\n \"\"\"\n Fetch an issue by id along with its tags. Returns None if no issue\n with the specified id exists in the database.\n \"\"\"\n cursor.execute(f\"\"\"\n SELECT\n issue.id,\n issue.title,\n issue.description,\n tag.namespace,\n tag.predicate,\n tag.value\n FROM\n issue LEFT JOIN tag\n ON issue.id = tag.issue_id\n WHERE\n issue.id = {id}\n \"\"\")\n\n issue = None\n for row in cursor:\n if issue is None:\n issue = {\n \"id\": row[\"id\"],\n \"title\": row[\"title\"],\n \"description\": row[\"description\"],\n \"tags\": [],\n }\n # If tag exists in row, add to issue.\n if row[\"value\"]:\n issue[\"tags\"].append({\n \"namespace\": row[\"namespace\"],\n \"predicate\": row[\"predicate\"],\n \"value\": row[\"value\"],\n })\n\n return issue","target":"def fetch_issue(cursor, id):\n \"\"\"\n Fetch an issue by id along with its tags. Returns None if no issue\n with the specified id exists in the database.\n \"\"\"\n cursor.execute(\"\"\"\n SELECT\n issue.id,\n issue.title,\n issue.description,\n tag.namespace,\n tag.predicate,\n tag.value\n FROM\n issue LEFT JOIN tag\n ON issue.id = tag.issue_id\n WHERE\n issue.id = ?\n \"\"\", (id,))\n\n issue = None\n for row in cursor:\n if issue is None:\n issue = {\n \"id\": row[\"id\"],\n \"title\": row[\"title\"],\n \"description\": row[\"description\"],\n \"tags\": [],\n }\n # If tag exists in row, add to issue.\n if row[\"value\"]:\n issue[\"tags\"].append({\n \"namespace\": row[\"namespace\"],\n \"predicate\": row[\"predicate\"],\n \"value\": row[\"value\"],\n })\n\n return issue","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"fetch_issue","file_name":"server/server.py","commit_link":"github.com/nutty7t/tissue/commit/306dd094749bb39cbd5c74a6ded3d3b191033061","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#51-8af1fe009045","input":"def also_add(name, also):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n INSERT INTO isalso(name,also) VALUES('{}','{}')\n '''.format(name, also))\n db.commit()\n logger.debug('added to isalso name {} with value {}'.format(\n name, also))\n db.close()\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def also_add(name, also):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n INSERT INTO isalso(name,also) VALUES(%(name)s,%(also)s)\n ''', (\n name,\n also,\n ))\n db.commit()\n logger.debug('added to isalso name {} with value {}'.format(\n name, also))\n db.close()\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"also_add","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#52-41de02f62abf","input":" def getCommentsLike(self,commentid):\n sqlText=\"select userid from comment_like where commentid=%d\"%(commentid)\n result=sql.queryDB(self.conn,sqlText)\n return result;","target":" def getCommentsLike(self,commentid):\n sqlText=\"select userid from comment_like where commentid=%s\"\n params=[commentid]\n result=sql.queryDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getCommentsLike","file_name":"modules/comment.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#53-31d5e84156ca","input":"def update_theory_base(tag, link):\n theory = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\theory.db\")\n conn = theory.cursor()\n conn.execute(\"insert into \" + str(tag) + \" values (?)\", (str(link), ))\n theory.commit()\n theory.close()","target":"def update_theory_base(tag, link):\n theory = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\theory.db\")\n conn = theory.cursor()\n conn.execute(\"insert into ? values (?)\", (tag, str(link)))\n theory.commit()\n theory.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"update_theory_base","file_name":"bases/update.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#54-a742f6eac109","input":"@app.route('/get_asset_and_volume')\ndef get_asset_and_volume():\n asset_id = request.args.get('asset_id')\n\n if not isObject(asset_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_asset_symbols\",[[\"' + asset_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n asset_id = j_l[\"result\"][0][\"id\"]\n\n #print asset_id\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"get_assets\",[[\"' + asset_id + '\"], 0]]}')\n result = ws.recv()\n j = json.loads(result)\n\n dynamic_asset_data_id = j[\"result\"][0][\"dynamic_asset_data_id\"]\n\n ws.send('{\"id\": 1, \"method\": \"call\", \"params\": [0, \"get_objects\", [[\"'+dynamic_asset_data_id+'\"]]]}')\n result2 = ws.recv()\n j2 = json.loads(result2)\n #print j2[\"result\"][0][\"current_supply\"]\n\n j[\"result\"][0][\"current_supply\"] = j2[\"result\"][0][\"current_supply\"]\n j[\"result\"][0][\"confidential_supply\"] = j2[\"result\"][0][\"confidential_supply\"]\n #print j[\"result\"]\n\n j[\"result\"][0][\"accumulated_fees\"] = j2[\"result\"][0][\"accumulated_fees\"]\n j[\"result\"][0][\"fee_pool\"] = j2[\"result\"][0][\"fee_pool\"]\n\n issuer = j[\"result\"][0][\"issuer\"]\n ws.send('{\"id\": 1, \"method\": \"call\", \"params\": [0, \"get_objects\", [[\"'+issuer+'\"]]]}')\n result3 = ws.recv()\n j3 = json.loads(result3)\n j[\"result\"][0][\"issuer_name\"] = j3[\"result\"][0][\"name\"]\n\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT volume, mcap FROM assets WHERE aid='\"+asset_id+\"'\"\n cur.execute(query)\n results = cur.fetchall()\n con.close()\n try:\n j[\"result\"][0][\"volume\"] = results[0][0]\n j[\"result\"][0][\"mcap\"] = results[0][1]\n except:\n j[\"result\"][0][\"volume\"] = 0\n j[\"result\"][0][\"mcap\"] = 0\n\n return jsonify(j[\"result\"])","target":"@app.route('/get_asset_and_volume')\ndef get_asset_and_volume():\n asset_id = request.args.get('asset_id')\n\n if not isObject(asset_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_asset_symbols\",[[\"' + asset_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n asset_id = j_l[\"result\"][0][\"id\"]\n\n #print asset_id\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"get_assets\",[[\"' + asset_id + '\"], 0]]}')\n result = ws.recv()\n j = json.loads(result)\n\n dynamic_asset_data_id = j[\"result\"][0][\"dynamic_asset_data_id\"]\n\n ws.send('{\"id\": 1, \"method\": \"call\", \"params\": [0, \"get_objects\", [[\"'+dynamic_asset_data_id+'\"]]]}')\n result2 = ws.recv()\n j2 = json.loads(result2)\n #print j2[\"result\"][0][\"current_supply\"]\n\n j[\"result\"][0][\"current_supply\"] = j2[\"result\"][0][\"current_supply\"]\n j[\"result\"][0][\"confidential_supply\"] = j2[\"result\"][0][\"confidential_supply\"]\n #print j[\"result\"]\n\n j[\"result\"][0][\"accumulated_fees\"] = j2[\"result\"][0][\"accumulated_fees\"]\n j[\"result\"][0][\"fee_pool\"] = j2[\"result\"][0][\"fee_pool\"]\n\n issuer = j[\"result\"][0][\"issuer\"]\n ws.send('{\"id\": 1, \"method\": \"call\", \"params\": [0, \"get_objects\", [[\"'+issuer+'\"]]]}')\n result3 = ws.recv()\n j3 = json.loads(result3)\n j[\"result\"][0][\"issuer_name\"] = j3[\"result\"][0][\"name\"]\n\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT volume, mcap FROM assets WHERE aid=%s\"\n cur.execute(query, (asset_id,))\n results = cur.fetchall()\n con.close()\n try:\n j[\"result\"][0][\"volume\"] = results[0][0]\n j[\"result\"][0][\"mcap\"] = results[0][1]\n except:\n j[\"result\"][0][\"volume\"] = 0\n j[\"result\"][0][\"mcap\"] = 0\n\n return jsonify(j[\"result\"])","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_asset_and_volume","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#55-f66442e7331e","input":"def reportMatch(winner, loser):\n \"\"\"Records the outcome of a single match between two players.\n\n Args:\n winner: the id number of the player who won\n loser: the id number of the player who lost\n \"\"\"\n try:\n int(winner)\n int(loser)\n except ValueError:\n raise ValueError(\n \"\\\"winner\\\" and/or \\\"loser\\\" input are not integers.\\n\"\n \"Please use the id number of each player to report match results.\"\n )\n w = str(winner)\n l = str(loser)\n db = connect()\n c = db.cursor()\n statement = \"INSERT INTO matches values ({w}, {l})\".format(w=w, l=l)\n c.execute(statement)\n db.commit()\n db.close()","target":"def reportMatch(winner, loser):\n \"\"\"Records the outcome of a single match between two players.\n\n Args:\n winner: the id number of the player who won\n loser: the id number of the player who lost\n \"\"\"\n try:\n int(winner)\n int(loser)\n except ValueError:\n raise ValueError(\n \"\\\"winner\\\" and/or \\\"loser\\\" input are not integers.\\n\"\n \"Please use the id number of each player to report match results.\"\n )\n w = str(winner)\n l = str(loser)\n db = connect()\n c = db.cursor()\n c.execute(\"INSERT INTO matches values (%s, %s)\", (w,l))\n db.commit()\n db.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"reportMatch","file_name":"tournament.py","commit_link":"github.com/tdnelson2/tournament-db/commit/00f3caeed0e12e806c2808d100908698777d9e98","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#56-35db3764183b","input":"def getPlayer(player):\n\tdb.execute(\"SELECT * FROM players WHERE Name = '%s' COLLATE NOCASE\" % player)\n\tplayerstats = dict(db.fetchone())\n\treturn playerstats","target":"def getPlayer(player):\n\tdb.execute(\"SELECT * FROM players WHERE Name = ? COLLATE NOCASE\", player)\n\tplayerstats = dict(db.fetchone())\n\treturn playerstats","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getPlayer","file_name":"plugins/database.py","commit_link":"github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#57-0f34e104147e","input":"def karma_sub(name):\n karma = karma_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if karma is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES('{}',-1,0)\n '''.format(name))\n db.commit()\n logger.debug('Inserted into karmadb -1 karma for {}'.format(name))\n db.close()\n return -1\n\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n else:\n karma = karma - 1\n try:\n cursor.execute('''\n UPDATE people SET karma = {0} WHERE name = '{1}'\n '''.format(karma, name))\n db.commit()\n logger.debug('Inserted into karmadb -1 karma for {}'.format(name))\n db.close()\n return karma\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def karma_sub(name):\n karma = karma_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if karma is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES(%(name)s,-1,0)\n ''', (name, ))\n db.commit()\n logger.debug('Inserted into karmadb -1 karma for {}'.format(name))\n db.close()\n return -1\n\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n else:\n karma = karma - 1\n try:\n cursor.execute('''\n UPDATE people SET karma = %(karma)s WHERE name = %(name)s\n ''', (\n karma,\n name,\n ))\n db.commit()\n logger.debug('Inserted into karmadb -1 karma for {}'.format(name))\n db.close()\n return karma\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"karma_sub","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#58-3c746f6afdb9","input":"@app.route('/', methods=['POST'])\ndef login():\n print('login')\n user = str(request.form['username'])\n password = str(request.form['password'])\n cur.execute('SELECT * FROM users WHERE name = \\'{}\\' AND password = \\'{}\\';'.format(user, password))\n response = cur.fetchone()\n if response != None:\n print(response, 'OK')\n return redirect(url_for('enter_test_point'))\n else:\n print(response, 'not OK')\n flash('Invalid login or password')\n return render_template('login.html')","target":"@app.route('/', methods=['POST'])\ndef login():\n print('login')\n user = str(request.form['username'])\n password = str(request.form['password'])\n cur.execute(\"SELECT * FROM users WHERE name = ? AND password = ?;\", [user, password])\n response = cur.fetchone()\n if response != None:\n print(response, 'OK')\n return redirect(url_for('enter_test_point'))\n else:\n print(response, 'not OK')\n flash('Invalid login or password')\n return render_template('login.html')","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"login","file_name":"app.py","commit_link":"github.com/ChemiKyle/Waterspots/commit/3f9d5099496336f3f34c48abf0cf55acaaa29011","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#59-e04e02754231","input":" def fetch_data(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = (\"SELECT data FROM %s WHERE identifier = '%s';\" %\n (self.table, sid)\n )\n res = self._query(query)\n try:\n data = res.dictresult()[0]['data']\n except IndexError:\n raise ObjectDoesNotExistException(id)\n try:\n ndata = pg.unescape_bytea(data)\n except:\n # insufficient PyGreSQL version\n ndata = data.replace(\"\\\\'\", \"'\")\n\n ndata = ndata.replace('\\\\000\\\\001', nonTextToken)\n ndata = ndata.replace('\\\\012', '\\n')\n return ndata","target":" def fetch_data(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = (\"SELECT data FROM %s WHERE identifier = $1;\" %\n (self.table)\n )\n res = self._query(query, sid)\n try:\n data = res.dictresult()[0]['data']\n except IndexError:\n raise ObjectDoesNotExistException(id)\n try:\n ndata = pg.unescape_bytea(data)\n except:\n # insufficient PyGreSQL version\n ndata = data.replace(\"\\\\'\", \"'\")\n\n ndata = ndata.replace('\\\\000\\\\001', nonTextToken)\n ndata = ndata.replace('\\\\012', '\\n')\n return ndata","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"fetch_data","file_name":"cheshire3/sql/postgresStore.py","commit_link":"github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#60-22fafc0b298f","input":"def registerPlayer(name):\n \"\"\"Adds a player to the tournament database.\n\n The database assigns a unique serial id number for the player. (This\n should be handled by your SQL database schema, not in your Python code.)\n\n Args:\n name: the player's full name (need not be unique).\n \"\"\"\n conn = connect()\n cursor = conn.cursor()\n cursor.execute(\"INSERT INTO players (name) VALUES ('%s')\" % (name,));\n conn.commit()\n conn.close()","target":"def registerPlayer(name):\n \"\"\"Adds a player to the tournament database.\n\n The database assigns a unique serial id number for the player. (This\n should be handled by your SQL database schema, not in your Python code.)\n\n Args:\n name: the player's full name (need not be unique).\n \"\"\"\n conn = connect()\n cursor = conn.cursor()\n query = \"INSERT INTO players (name) VALUES (%s);\"\n cursor.execute(query, (name,))\n conn.commit()\n conn.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"registerPlayer","file_name":"tournament.py","commit_link":"github.com/sarahkcaplan/tournament/commit/40aba5686059f5f398f6323b1483412c56140cc0","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#61-1df6e292d628","input":"@mod.route('/register', methods=['GET', 'POST'])\ndef register():\n if request.method == 'POST':\n error = None\n email = request.form['email'].strip()\n nickname = request.form['nickname'].strip()\n password = request.form['password'].strip()\n password2 = request.form['password2'].strip()\n\n email = email.lower()\n\n if email == \"\" or nickname == \"\" or password == \"\" or password2 == \"\":\n error = 'Please input all the information'\n elif password2 != password:\n error = 'The password is not repeated correctly'\n elif len(password) < 6:\n error = 'The password has at least 6 characters'\n elif not re.match(r'^[0-9a-zA-Z_]{0,19}@' +\n '[0-9a-zA-Z]{1,15}\\.[com,cn,net]', email):\n error = 'Please input the right email'\n\n sql = \"SELECT * FROM users where email = '%s';\" % (email)\n cursor.execute(sql)\n u = cursor.fetchone()\n\n if u is not None:\n error = 'The email has already exsit'\n\n if error is not None:\n return render_template('register.html', error=error)\n else:\n password = bcrypt.generate_password_hash(password)\n cursor.execute(\"INSERT INTO users(email,nickname,password) VALUES(%s,%s,%s);\", (email, nickname, password))\n conn.commit()\n flash('Register Success!')\n return redirect(url_for('users.login'))\n\n return render_template('register.html')","target":"@mod.route('/register', methods=['GET', 'POST'])\ndef register():\n if request.method == 'POST':\n error = None\n email = request.form['email'].strip()\n nickname = request.form['nickname'].strip()\n password = request.form['password'].strip()\n password2 = request.form['password2'].strip()\n\n email = email.lower()\n\n if email == \"\" or nickname == \"\" or password == \"\" or password2 == \"\":\n error = 'Please input all the information'\n elif password2 != password:\n error = 'The password is not repeated correctly'\n elif len(password) < 6:\n error = 'The password has at least 6 characters'\n elif not re.match(r'^[0-9a-zA-Z_]{0,19}@' +\n '[0-9a-zA-Z]{1,15}\\.[com,cn,net]', email):\n error = 'Please input the right email'\n\n cursor.execute(\"SELECT * FROM users where email = %s;\", (email,))\n u = cursor.fetchone()\n\n if u is not None:\n error = 'The email has already exsit'\n\n if error is not None:\n return render_template('register.html', error=error)\n else:\n password = bcrypt.generate_password_hash(password)\n cursor.execute(\"INSERT INTO users(email,nickname,password) VALUES(%s,%s,%s);\", (email, nickname, password))\n conn.commit()\n flash('Register Success!')\n return redirect(url_for('users.login'))\n\n return render_template('register.html')","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"register","file_name":"flaskr/flaskr/views/users.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#62-4bd30e8d44e6","input":"def process_form():\n # see https://docs.python.org/3.4/library/cgi.html for the basic usage\n # here.\n form = cgi.FieldStorage()\n\n\n # connect to the database\n conn = MySQLdb.connect(host = pnsdp.SQL_HOST,\n user = pnsdp.SQL_USER,\n passwd = pnsdp.SQL_PASSWD,\n db = pnsdp.SQL_DB)\n\n\n if \"user\" not in form or \"game\" not in form:\n raise FormError(\"Invalid parameters.\")\n if \"pos\" not in form and \"resign\" not in form:\n raise FormError(\"Invalid parameters.\")\n\n game = int(form[\"game\"].value)\n\n\n (players,size,state) = get_game_info(conn, game)\n\n user = form[\"user\"].value\n if user not in players:\n raise FormError(\"Invalid player ID - player is not part of this game\")\n\n\n if \"resign\" in form:\n resign = True\n else:\n resign = False\n pos = form[\"pos\"].value.split(\",\")\n assert len(pos) == 2\n x = int(pos[0])\n y = int(pos[1])\n\n\n (board,nextPlayer,letter) = build_board(conn, game,size)\n\n if user != players[nextPlayer]:\n raise FormError(\"Internal error, incorrect player is attempting to move.\")\n\n\n if resign:\n # this user is choosing to resign. Update the game state to reflect that.\n other_player_name = players[1-nextPlayer]\n\n cursor = conn.cursor()\n cursor.execute(\"\"\"UPDATE games SET state=\"%s:resignation\" WHERE id=%d;\"\"\" % (other_player_name,game))\n cursor.close()\n\n else:\n assert x >= 0 and x < size\n assert y >= 0 and y < size\n\n assert board[x][y] == \"\"\n board[x][y] = \"XO\"[nextPlayer]\n\n # we've done all of our sanity checks. We now know enough to say that\n # it's safe to add a new move.\n cursor = conn.cursor()\n cursor.execute(\"\"\"INSERT INTO moves(gameID,x,y,letter,time) VALUES(%d,%d,%d,\"%s\",NOW());\"\"\" % (game,x,y,letter))\n\n if cursor.rowcount != 1:\n raise FormError(\"Could not make move, reason unknown.\")\n\n cursor.close()\n\n result = analyze_board(board)\n if result != \"\":\n if result == \"win\":\n result = players[nextPlayer]+\":win\"\n\n cursor = conn.cursor()\n cursor.execute(\"\"\"UPDATE games SET state=\"%s\" WHERE id=%d;\"\"\" % (result,game))\n cursor.close()\n\n # we've made changes, make sure to commit them!\n conn.commit()\n conn.close()\n\n\n # return the parms to the caller, so that they can build a good redirect\n return (user,game)","target":"def process_form():\n # see https://docs.python.org/3.4/library/cgi.html for the basic usage\n # here.\n form = cgi.FieldStorage()\n\n\n # connect to the database\n conn = MySQLdb.connect(host = pnsdp.SQL_HOST,\n user = pnsdp.SQL_USER,\n passwd = pnsdp.SQL_PASSWD,\n db = pnsdp.SQL_DB)\n\n\n if \"user\" not in form or \"game\" not in form:\n raise FormError(\"Invalid parameters.\")\n if \"pos\" not in form and \"resign\" not in form:\n raise FormError(\"Invalid parameters.\")\n\n game = int(form[\"game\"].value)\n\n\n (players,size,state) = get_game_info(conn, game)\n\n user = form[\"user\"].value\n if user not in players:\n raise FormError(\"Invalid player ID - player is not part of this game\")\n\n\n if \"resign\" in form:\n resign = True\n else:\n resign = False\n pos = form[\"pos\"].value.split(\",\")\n assert len(pos) == 2\n x = int(pos[0])\n y = int(pos[1])\n\n\n (board,nextPlayer,letter) = build_board(conn, game,size)\n\n if user != players[nextPlayer]:\n raise FormError(\"Internal error, incorrect player is attempting to move.\")\n\n\n if resign:\n # this user is choosing to resign. Update the game state to reflect that.\n other_player_name = players[1-nextPlayer]\n\n cursor = conn.cursor()\n cursor.execute(\"\"\"UPDATE games SET state=\"%s:resignation\" WHERE id=%d;\"\"\", (other_player_name,game))\n cursor.close()\n\n else:\n assert x >= 0 and x < size\n assert y >= 0 and y < size\n\n assert board[x][y] == \"\"\n board[x][y] = \"XO\"[nextPlayer]\n\n # we've done all of our sanity checks. We now know enough to say that\n # it's safe to add a new move.\n cursor = conn.cursor()\n cursor.execute(\"\"\"INSERT INTO moves(gameID,x,y,letter,time) VALUES(%d,%d,%d,\"%s\",NOW());\"\"\", (game,x,y,letter))\n\n if cursor.rowcount != 1:\n raise FormError(\"Could not make move, reason unknown.\")\n\n cursor.close()\n\n result = analyze_board(board)\n if result != \"\":\n if result == \"win\":\n result = players[nextPlayer]+\":win\"\n\n cursor = conn.cursor()\n cursor.execute(\"\"\"UPDATE games SET state=\"%s\" WHERE id=%d;\"\"\", (result,game))\n cursor.close()\n\n # we've made changes, make sure to commit them!\n conn.commit()\n conn.close()\n\n\n # return the parms to the caller, so that they can build a good redirect\n return (user,game)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"process_form","file_name":"cgi/move.py","commit_link":"github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#63-66613e01583d","input":"@login_manager.user_loader\ndef load_user(s_id):\n email = str(s_id)\n query = '''select * from usr where email like\\'''' + email + '\\''\n cursor = g.conn.execute(query)\n user = User()\n for row in cursor:\n user.name = str(row.name)\n user.email = str(row.email)\n break\n return user","target":"@login_manager.user_loader\ndef load_user(s_id):\n email = str(s_id)\n query = 'select * from usr where email like %s'\n cursor = g.conn.execute(query, (email, ))\n user = User()\n for row in cursor:\n user.name = str(row.name)\n user.email = str(row.email)\n break\n return user","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"load_user","file_name":"Web-app/Server.py","commit_link":"github.com/Daniel-Bu/w4111-project1/commit/fe04bedc72e62fd4c4ee046a9af29fd81e9b3340","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#64-38b24c4ed282","input":"@mod.route('/delete/', methods=['GET', 'POST'])\ndef delete(cmt_id):\n if request.method == 'GET':\n sql = \"SELECT msg_id FROM comment where cmt_id = %d;\" % (cmt_id)\n cursor.execute(sql)\n m = cursor.fetchone()\n sql = \"DELETE FROM comment where cmt_id = '%d';\" % (cmt_id)\n cursor.execute(sql)\n conn.commit()\n flash('Delete Success!')\n return redirect(url_for('comment.show', msg_id=m[0]))","target":"@mod.route('/delete/', methods=['GET', 'POST'])\ndef delete(cmt_id):\n if request.method == 'GET':\n cursor.execute(\"SELECT msg_id FROM comment where cmt_id = %s;\", (cmt_id,))\n m = cursor.fetchone()\n cursor.execute(\"DELETE FROM comment where cmt_id = %s;\", (cmt_id,))\n conn.commit()\n flash('Delete Success!')\n return redirect(url_for('comment.show', msg_id=m[0]))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"delete","file_name":"flaskr/flaskr/views/comment.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#65-639305a91312","input":"@app.route('/get_markets')\ndef get_markets():\n asset_id = request.args.get('asset_id')\n\n if not isObject(asset_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_asset_symbols\",[[\"' + asset_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n asset_id = j_l[\"result\"][0][\"id\"]\n\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT * FROM markets WHERE aid='\"+asset_id+\"'\"\n cur.execute(query)\n results = cur.fetchall()\n con.close()\n return jsonify(results)","target":"@app.route('/get_markets')\ndef get_markets():\n asset_id = request.args.get('asset_id')\n\n if not isObject(asset_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_asset_symbols\",[[\"' + asset_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n asset_id = j_l[\"result\"][0][\"id\"]\n\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT * FROM markets WHERE aid=%s\"\n cur.execute(query, (asset_id,))\n results = cur.fetchall()\n con.close()\n return jsonify(results)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_markets","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#66-9ad9b65d6bca","input":"\tdef get_secrets(self, from_date_added=0):\n\t\tsecrets = []\n\t\tfor row in self.cursor.execute('SELECT encrypted, json_id, date_added FROM secret WHERE date_added > %s ORDER BY date_added DESC' % from_date_added):\n\t\t\taes_key, json_id, date_added = cryptlib.eciesDecrypt(row[0], self.privkey), row[1], row[2]\n\t\t\tif aes_key != None:\n\t\t\t\tsecrets.append([aes_key, json_id])\n\t\t\tfrom_date_added = max(from_date_added, date_added)\n\t\treturn (secrets, from_date_added)","target":"\tdef get_secrets(self, from_date_added=0):\n\t\tsecrets = []\n\t\tfor row in self.cursor.execute('SELECT encrypted, json_id, date_added FROM secret WHERE date_added > ? ORDER BY date_added DESC', (from_date_added,)):\n\t\t\taes_key, json_id, date_added = cryptlib.eciesDecrypt(row[0], self.privkey), row[1], row[2]\n\t\t\tif aes_key != None:\n\t\t\t\tsecrets.append([aes_key, json_id])\n\t\t\tfrom_date_added = max(from_date_added, date_added)\n\t\treturn (secrets, from_date_added)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_secrets","file_name":"zeromail.py","commit_link":"github.com/imachug/ZeroMailProxy/commit/8f62d024c6c4c957079d147e59f26d15c07dc888","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#67-66a9e37e968c","input":" def add_consumption_data_row(self, ts, energy_used, power_used):\n\n if power_used > 0:\n\n query = '''\n INSERT OR IGNORE INTO Consumption (\n TimeStamp,\n EnergyUsed,\n PowerUsed \n ) VALUES (\n %s,\n %s,\n %s\n );\n ''' % (ts, 0, 0)\n self.c.execute(query)\n\n query = '''\n UPDATE Consumption SET \n EnergyUsed = EnergyUsed + %s,\n PowerUsed = PowerUsed + %s\n WHERE TimeStamp = %s;\n ''' % (energy_used, power_used, ts)\n\n self.c.execute(query)\n\n self.db.commit()","target":" def add_consumption_data_row(self, ts, energy_used, power_used):\n\n if power_used > 0:\n\n query = '''\n INSERT OR IGNORE INTO Consumption (\n TimeStamp,\n EnergyUsed,\n PowerUsed \n ) VALUES (\n ?,\n ?,\n ?\n );\n '''\n self.c.execute(query, (ts, 0, 0))\n\n query = '''\n UPDATE Consumption SET \n EnergyUsed = EnergyUsed + ?,\n PowerUsed = PowerUsed + ?\n WHERE TimeStamp=?;\n '''\n\n self.c.execute(query, (energy_used, power_used, ts))\n\n self.db.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_consumption_data_row","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#68-f422e9c3c8da","input":"@app.route('/lookup_assets')\ndef lookup_assets():\n start = request.args.get('start')\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT aname FROM assets WHERE aname LIKE '\"+start+\"%'\"\n cur.execute(query)\n results = cur.fetchall()\n con.close()\n return jsonify(results)","target":"@app.route('/lookup_assets')\ndef lookup_assets():\n start = request.args.get('start')\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT aname FROM assets WHERE aname LIKE %s\"\n cur.execute(query, (start+'%',))\n results = cur.fetchall()\n con.close()\n return jsonify(results)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"lookup_assets","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#69-4c36459c11d6","input":"def set_state(chat_id, value):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"update users set state ='\" + str(value) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n settings.commit()\n settings.close()","target":"def set_state(chat_id, value):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"update users set state = ? where chat_id = ?\", (str(value), str(chat_id)))\n settings.commit()\n settings.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"set_state","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#70-eb5b60e88246","input":"def _get_degree_2(user_id, cnx):\n \"\"\"Get all users of degree 2 follow that are not currently followed.\n Example:\n this user (follows) user B (follows) user B\n AND user (does NOT follow) user B\n means that user B will be in the list\n Args:\n user_id (int): id of user\n cnx: DB connection\n Returns:\n list: list of user_ids\n \"\"\"\n sql = 'WITH tmp_suggest (followed_id) AS ' \\\n '(' \\\n 'SELECT b.followed_id AS followed_id ' \\\n 'FROM ' \\\n 'tbl_follow a INNER JOIN tbl_follow b ' \\\n 'ON a.followed_id = b.follower_id ' \\\n 'WHERE a.follower_id = %s ' \\\n 'AND b.followed_id NOT IN ' \\\n '(SELECT followed_id FROM tbl_follow WHERE follower_id = %s) ' \\\n 'AND b.followed_id != %s ' \\\n ') ' \\\n 'SELECT followed_id, COUNT(*) AS num_mutual FROM tmp_suggest ' \\\n 'GROUP BY followed_id ' \\\n 'ORDER BY num_mutual DESC' % (user_id, user_id, user_id)\n with cnx.cursor() as cursor:\n cursor.execute(sql)\n res = cursor.fetchall()\n return list(map(lambda x: x[0], res))","target":"def _get_degree_2(user_id, cnx):\n \"\"\"Get all users of degree 2 follow that are not currently followed.\n Example:\n this user (follows) user B (follows) user B\n AND user (does NOT follow) user B\n means that user B will be in the list\n Args:\n user_id (int): id of user\n cnx: DB connection\n Returns:\n list: list of user_ids\n \"\"\"\n sql = 'WITH tmp_suggest (followed_id) AS ' \\\n '(' \\\n 'SELECT b.followed_id AS followed_id ' \\\n 'FROM ' \\\n 'tbl_follow a INNER JOIN tbl_follow b ' \\\n 'ON a.followed_id = b.follower_id ' \\\n 'WHERE a.follower_id = %s ' \\\n 'AND b.followed_id NOT IN ' \\\n '(SELECT followed_id FROM tbl_follow WHERE follower_id = %s) ' \\\n 'AND b.followed_id != %s ' \\\n ') ' \\\n 'SELECT followed_id, COUNT(*) AS num_mutual FROM tmp_suggest ' \\\n 'GROUP BY followed_id ' \\\n 'ORDER BY num_mutual DESC'\n with cnx.cursor() as cursor:\n cursor.execute(sql, (user_id, user_id, user_id))\n res = cursor.fetchall()\n return list(map(lambda x: x[0], res))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"_get_degree_2","file_name":"server/ygoons/modules/user/follow_suggest.py","commit_link":"github.com/young-goons/rifflo-server/commit/fb311df76713b638c9486250f9badb288ffb2189","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#71-7a26034d4fa0","input":"def get_tournaments_during_month(db, scene, date):\n y, m, d = date.split('-')\n ym_date = '{}-{}'.format(y, m)\n sql = \"select url, date from matches where scene='{}' and date like '%{}%' group by url, date order by date\".format(scene, ym_date)\n res = db.exec(sql)\n urls = [r[0] for r in res]\n return urls","target":"def get_tournaments_during_month(db, scene, date):\n y, m, d = date.split('-')\n ym_date = '{}-{}'.format(y, m)\n sql = \"select url, date from matches where scene='{scene}' and date like '%{date}%' group by url, date order by date\"\n args = {'scene': scene, 'date': ym_date}\n res = db.exec(sql, args)\n urls = [r[0] for r in res]\n return urls","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_tournaments_during_month","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#72-aa8db41d95cf","input":" def add_input(self,data):\n connection = self.connect()\n try:\n # The following is a flaw\n query = \"INSERT INTO crimes(description) VALUES ('{}');\".format(data)\n with connection.cursor() as cursor:\n cursor.execute(query)\n connection.commit()\n finally:\n connection.close()","target":" def add_input(self,data):\n connection = self.connect()\n try:\n # The following is a flaw\n query = \"INSERT INTO crimes(description) VALUES (%s);\"\n with connection.cursor() as cursor:\n cursor.execute(query, data)\n connection.commit()\n finally:\n connection.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/amrishc/crimemap/commit/51b3d51aa031d7c285295de36f5464d43debf6de","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#73-59ee2e282e78","input":"def get_error_days(cur, error_percent):\n \"\"\"Fetches the days in which requests led to errors.\n\n Fetches the days in which the specified percentage\n of requests led to errors.\n\n Args:\n cur(obj): The cursor to execute the query.\n error_percent(int): The percentage of requests that led to errors.\n\n Return:\n True if success, False otherwise.\n \"\"\"\n query = '''SELECT to_char(log_errors.date, 'Mon DD YYYY'),\n round((log_errors.errors * 100\n / log_requests.total::numeric), 2) as percent\n FROM log_errors, log_requests\n WHERE log_errors.date = log_requests.date AND\n log_errors.errors * 100\n / log_requests.total::numeric > {}\n ORDER BY log_errors.date'''.format(error_percent)\n rows = get_data(cur, query)\n\n # Write data to txt file.\n if rows is not None:\n file = open(\"error_report.txt\", \"w\")\n for row in rows:\n file.write(\"{} - {}% errors \\n\".format(row[0], row[1]))\n file.close()\n\n return True\n else:\n return False","target":"def get_error_days(cur, error_percent):\n \"\"\"Fetches the days in which requests led to errors.\n\n Fetches the days in which the specified percentage\n of requests led to errors.\n\n Args:\n cur(obj): The cursor to execute the query.\n error_percent(int): The percentage of requests that led to errors.\n\n Return:\n True if success, False otherwise.\n \"\"\"\n data = (error_percent, )\n query = '''SELECT to_char(log_errors.date, 'Mon DD YYYY'),\n round((log_errors.errors * 100\n / log_requests.total::numeric), 2) as percent\n FROM log_errors, log_requests\n WHERE log_errors.date = log_requests.date AND\n log_errors.errors * 100\n / log_requests.total::numeric > %s\n ORDER BY log_errors.date'''\n rows = get_data(cur, query, data)\n\n # Write data to txt file.\n if rows is not None:\n file = open(\"error_report.txt\", \"w\")\n for row in rows:\n file.write(\"{} - {}% errors \\n\".format(row[0], row[1]))\n file.close()\n\n return True\n else:\n return False","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_error_days","file_name":"news_data_analysis.py","commit_link":"github.com/rrbiz662/log-analysis/commit/20fefbde3738088586a3c5679f743493d0a504f6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#74-eaac2f082613","input":" def all_deposits(self,coin):\n sql = \"SELECT * FROM deposits WHERE coin='%s'\" % coin\n self.cursor.execute(sql)\n return self.cursor.fetchall()","target":" def all_deposits(self,coin):\n sql = \"SELECT * FROM deposits WHERE coin='%s'\"\n self.cursor.execute(sql, (coin,))\n return self.cursor.fetchall()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"all_deposits","file_name":"deposit.py","commit_link":"github.com/ktechmidas/garlictipsbot/commit/7c262255f933cb721109ac4be752b5b7599275aa","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#75-4f88d68c214d","input":" def get_user(self):\n if not hasattr(self, '_user'):\n qs = \"select * from account_access where access_token = '%s'\" % self.access_token\n result = self.db.get(qs)\n if result:\n self._user = result\n else:\n self._user = None\n \n return self._user","target":" def get_user(self):\n if not hasattr(self, '_user'):\n qs = \"select * from account_access where access_token = %s\"\n result = self.db.get(qs, self.access_token)\n if result:\n self._user = result\n else:\n self._user = None\n \n return self._user","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_user","file_name":"src/auth.py","commit_link":"github.com/bonbondirac/tsunami/commit/396cc394bd6daaf0ee9c16b1b55a4082eeaac208","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#76-5aee3ebacea6","input":" @staticmethod\n def compare_and_update(user, message):\n \"\"\"\n This method compare a user object from the bot and his info from\n the Telegram message to check whether a user has changed his bio\n or not. If yes, the user object that represents him in the bot will\n be updated accordingly. Now this function is called only when a user\n asks the bot for showing the most popular cams\n\n :param user: user object that represents a Telegram user in this bot\n :param message: object from Telegram that contains info about user's\n message and about himself\n :return: None\n \"\"\"\n\n log.info('Checking whether user have changed his info or not...')\n msg = message.from_user\n usr_from_message = User(message.chat.id, msg.first_name, msg.username,\n msg.last_name)\n\n if user.chat_id != usr_from_message.chat_id:\n log.error(\"Wrong user to compare!\")\n return\n\n if user.first_name != usr_from_message.first_name:\n user.first_name = usr_from_message.first_name\n\n elif user.nickname != usr_from_message.nickname:\n user.nickname = usr_from_message.nickname\n\n elif user.last_name != usr_from_message.last_name:\n user.last_name = usr_from_message.last_name\n\n else:\n log.debug(\"User's info hasn't changed\")\n return\n\n log.info(\"User has changed his info\")\n log.debug(\"Updating user's info in the database...\")\n query = (f\"UPDATE users \"\n f\"SET first_name='{user.first_name}', \"\n f\"nickname='{user.nickname}', \"\n f\"last_name='{user.last_name}' \"\n f\"WHERE chat_id={user.chat_id}\")\n\n try:\n db.add(query)\n except DatabaseError:\n log.error(\"Could not update info about %s in the database\",\n user)\n else:\n log.debug(\"User's info has been updated\")","target":" @staticmethod\n def compare_and_update(user, message):\n \"\"\"\n This method compare a user object from the bot and his info from\n the Telegram message to check whether a user has changed his bio\n or not. If yes, the user object that represents him in the bot will\n be updated accordingly. Now this function is called only when a user\n asks the bot for showing the most popular cams\n\n :param user: user object that represents a Telegram user in this bot\n :param message: object from Telegram that contains info about user's\n message and about himself\n :return: None\n \"\"\"\n\n log.info('Checking whether user have changed his info or not...')\n msg = message.from_user\n usr_from_message = User(message.chat.id, msg.first_name, msg.username,\n msg.last_name)\n\n if user.chat_id != usr_from_message.chat_id:\n log.error(\"Wrong user to compare!\")\n return\n\n if user.first_name != usr_from_message.first_name:\n user.first_name = usr_from_message.first_name\n\n elif user.nickname != usr_from_message.nickname:\n user.nickname = usr_from_message.nickname\n\n elif user.last_name != usr_from_message.last_name:\n user.last_name = usr_from_message.last_name\n\n else:\n log.debug(\"User's info hasn't changed\")\n return\n\n log.info(\"User has changed his info\")\n log.debug(\"Updating user's info in the database...\")\n query = (f\"UPDATE users \"\n f\"SET first_name=%s, \"\n f\"nickname=%s, \"\n f\"last_name=%s \"\n f\"WHERE chat_id=%s\")\n\n parameters = (user.first_name, user.nickname, user.last_name,\n user.chat_id)\n\n try:\n db.add(query, parameters)\n except DatabaseError:\n log.error(\"Could not update info about %s in the database\",\n user)\n else:\n log.debug(\"User's info has been updated\")","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"compare_and_update","file_name":"photogpsbot/users.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#77-409860aa86cc","input":"def GameNewPlayed(Played, ID):\n\tdb.execute(\"UPDATE games set GamesPlayed = %i WHERE ID = %i\" % (Played, ID))\n\tdatabase.commit()","target":"def GameNewPlayed(Played, ID):\n\tdb.execute(\"UPDATE games set GamesPlayed = ? WHERE ID = ?\", Played, ID)\n\tdatabase.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"GameNewPlayed","file_name":"plugins/database.py","commit_link":"github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#78-db2fbd13cafe","input":"def insertNPC(name, race,classe,sex,level,image,legit):\n\tc, conn = getConnection()\n\tdate = now()\n\tc.execute(\"INSERT INTO npc VALUES ('\"+date+\"','\"+str(name)+\"','\"+race+\"','\"+classe+\"','\"+sex+\"','\"+str(level)+\"','\"+image+\"','\"+str(legit)+\"')\")\n\tconn.commit()\n\tconn.close()","target":"def insertNPC(name, race,classe,sex,level,image,legit):\n\tc, conn = getConnection()\n\tdate = now()\n\tc.execute(\"INSERT INTO npc VALUES (?,?,?,?,?,?,?,?)\",(date,str(name),race,classe,sex,str(level),image,str(legit)))\n\tconn.commit()\n\tconn.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"insertNPC","file_name":"database.py","commit_link":"github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#79-27845e1fbbae","input":" def get(self, user_id):\n \"\"\" Fetch data for user with corresponding user_id \"\"\"\n return database_utilities.execute_query(f\"\"\"select * from users where user_id = '{user_id}'\"\"\")","target":" def get(self, user_id):\n \"\"\" Fetch data for user with corresponding user_id \"\"\"\n return database_utilities.execute_query(f\"\"\"select * from users where user_id = %s\"\"\", (user_id, ))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get","file_name":"apis/users.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#80-7b9223752b15","input":"@endpoints.route(\"/h2h\")\ndef h2h():\n if db == None:\n init()\n\n player1 = request.args.get('tag1', default=\"christmasmike\")\n player2 = request.args.get('tag2', default=\"christmasmike\")\n sql = \"SELECT * FROM matches WHERE (player1 = '\"+str(player1)+\"' OR \"\\\n +\"player2 = '\"+str(player1)+\"') AND (player1 = '\"+str(player2)+\"' OR \"\\\n +\"player2 = '\"+str(player2)+\"') ORDER BY date DESC;\"\n result = db.exec(sql)\n return json.dumps(result)","target":"@endpoints.route(\"/h2h\")\ndef h2h():\n if db == None:\n init()\n\n player1 = request.args.get('tag1', default=\"christmasmike\")\n player2 = request.args.get('tag2', default=\"christmasmike\")\n sql = \"SELECT * FROM matches WHERE (player1 = '{player1}' OR \"\\\n +\"player2 = '{player1}') AND (player1 = '{player2}' OR \"\\\n +\"player2 = '{player2}') ORDER BY date DESC;\"\n args = {'player1': player1, 'player2': player2}\n result = db.exec(sql, args)\n return json.dumps(result)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"h2h","file_name":"endpoints.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#81-e21153be51c6","input":" def insertData(self,userid,post):\n sqlText=\"insert into post(userid,date,comment) \\\n values(%d,current_timestamp(0),'%s');\"%(userid,post);\n result=sql.insertDB(self.conn,sqlText)\n return result;","target":" def insertData(self,userid,post):\n sqlText=\"insert into post(userid,date,comment) \\\n values(%s,current_timestamp(0),%s);\"\n params=[userid,post];\n result=sql.insertDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"insertData","file_name":"modules/post.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#82-c90b0b529431","input":" def get_requested_month_for_inverter(self, inverter_serial, date):\n data = dict()\n\n month_start, month_end = self.get_epoch_month(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}\n month_total = 0\n\n query = '''\n SELECT TimeStamp, DayYield AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN %s AND %s AND Serial = %s\n '''\n\n data['data'] = list()\n for row in self.c.execute(query % (month_start, month_end, inverter_serial)):\n data['data'].append({'time': self.convert_local_ts_to_utc(row[0], self.local_timezone), 'power': row[1]})\n month_total += row[1]\n\n data['total'] = month_total\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM MonthData \n WHERE Serial = %s;\n ''' % inverter_serial\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if first_data: data['hasPrevious'] = (first_data < month_start)\n else: data['hasPrevious'] = False\n if last_data: data['hasNext'] = (last_data > month_end)\n else: data['hasNext'] = False\n\n return data","target":" def get_requested_month_for_inverter(self, inverter_serial, date):\n data = dict()\n\n month_start, month_end = self.get_epoch_month(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}\n month_total = 0\n\n query = '''\n SELECT TimeStamp, DayYield AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN ? AND ? AND Serial=?;\n '''\n\n data['data'] = list()\n for row in self.c.execute(query, (month_start, month_end, inverter_serial)):\n data['data'].append({'time': self.convert_local_ts_to_utc(row[0], self.local_timezone), 'power': row[1]})\n month_total += row[1]\n\n data['total'] = month_total\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM MonthData \n WHERE Serial=?;\n '''\n\n self.c.execute(query, (inverter_serial,))\n first_data, last_data = self.c.fetchone()\n\n if first_data: data['hasPrevious'] = (first_data < month_start)\n else: data['hasPrevious'] = False\n if last_data: data['hasNext'] = (last_data > month_end)\n else: data['hasNext'] = False\n\n return data","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_requested_month_for_inverter","file_name":"util/database.py","commit_link":"github.com/philipptrenz/sunportal/commit/7eef493a168ed4e6731ff800713bfb8aee99a506","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#83-d01a5be2d975","input":" def delete_resultSet(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = \"DELETE FROM %s WHERE identifier = '%s';\" % (self.table, sid)\n self._query(query)","target":" def delete_resultSet(self, session, id):\n self._openContainer(session)\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = \"DELETE FROM %s WHERE identifier = $1;\" % (self.table)\n self._query(query, sid)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"delete_resultSet","file_name":"cheshire3/sql/resultSetStore.py","commit_link":"github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#84-8f1fe0bb7e43","input":"def getSeriesDateFromDatabase(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT StartDate FROM SeriesTracking WHERE SeriesTitle = '\" + str(getTitle(submission)) + \"'\").fetchone()[0]\n database.close()","target":"def getSeriesDateFromDatabase(submission):\n database = sqlite3.connect('database.db')\n cursor = database.cursor()\n return cursor.execute(\"SELECT StartDate FROM SeriesTracking WHERE SeriesTitle = ?\", [getTitle(submission)]).fetchone()[0]\n database.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getSeriesDateFromDatabase","file_name":"CheckAndPostForSeriesSubmissions.py","commit_link":"github.com/LiquidFun/Reddit-GeoGuessr-Tracking-Bot/commit/0cad2d52e24b05da32789fbc8face7a9999a71f9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#85-c92d1375ff03","input":"def karma_add(name):\n karma = karma_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if karma is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES('{}',1,0)\n '''.format(name))\n db.commit()\n logger.debug('Inserted into karmadb 1 karma for {}'.format(name))\n return 1\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n else:\n karma = karma + 1\n try:\n cursor.execute('''\n UPDATE people SET karma = {0} WHERE name = '{1}'\n '''.format(karma, name))\n db.commit()\n logger.debug('Inserted into karmadb {} karma for {}'.format(\n karma, name))\n return karma\n\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n db.close()","target":"def karma_add(name):\n karma = karma_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if karma is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES(%(name)s,1,0)\n ''', name)\n db.commit()\n logger.debug('Inserted into karmadb 1 karma for {}'.format(name))\n return 1\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n else:\n karma = karma + 1\n try:\n cursor.execute('''\n UPDATE people SET karma = %(karma)s WHERE name = %(name)s\n ''', (karma, name))\n db.commit()\n logger.debug('Inserted into karmadb {} karma for {}'.format(\n karma,\n name,\n ))\n return karma\n\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n db.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"karma_add","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#86-1ee430ed7307","input":" def update_date_modified(self):\n sql = \"UPDATE jdk_entries \" + \\\n \"SET date_last_modified = \" + CURRENT_DATESTAMP + \" \" + \\\n \"WHERE jdk_entries.id = '\" + self.entry_id + \"';\"\n \n db_execute(sql)\n\n return None","target":" def update_date_modified(self):\n quote_tuple = CURRENT_DATESTAMP, self.entry_id\n\n sql = \"UPDATE jdk_entries \" + \\\n \"SET date_last_modified = ? \" + \\\n \"WHERE jdk_entries.id = ?;\"\n \n db_execute(sql, quote_tuple)\n\n return None","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"update_date_modified","file_name":"entry.py","commit_link":"github.com/peterlebrun/jdk/commit/000238566fbe55ba09676c3d57af04ae207235ae","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#87-16bdda62dc4a","input":" def system_search(self, search):\r\n search = search.lower()\r\n conn = sqlite3.connect('data/ed.db').cursor()\r\n table = conn.execute(f\"select * from populated where lower(name) = '{search}'\")\r\n results = table.fetchone()\r\n if not results:\r\n table = conn.execute(f\"select * from systems where lower(name) = '{search}'\")\r\n results = table.fetchone()\r\n if results:\r\n keys = tuple(i[0] for i in table.description) \r\n return '\\n'.join(f'{key.replace(\"_\", \" \").title()}: {field}'\r\n for key, field in zip(keys[1:], results[1:]) if field)\r\n else:\r\n return 'No systems found.'","target":" def system_search(self, search):\r\n search = search.lower()\r\n conn = sqlite3.connect('data/ed.db').cursor()\r\n table = conn.execute('select * from populated where lower(name) = ?', (search,))\r\n results = table.fetchone()\r\n if not results:\r\n table = conn.execute('select * from systems where lower(name) = ?', (search,))\r\n results = table.fetchone()\r\n if results:\r\n keys = tuple(i[0] for i in table.description) \r\n return '\\n'.join(f'{key.replace(\"_\", \" \").title()}: {field}'\r\n for key, field in zip(keys[1:], results[1:]) if field)\r\n else:\r\n return 'No systems found.'","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"system_search","file_name":"eddb.py","commit_link":"github.com/BeatButton/beattie/commit/ab36b2053ee09faf4cc9a279cf7a4c010864cb29","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#88-91be3fa5617d","input":" def add_input(self, data):\n connection = self.connect()\n try:\n # The following introduces a deliberate security flaw - SQL Injection\n query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)\n with connection.cursor() as cursor:\n cursor.execute(query)\n connection.commit()\n finally:\n connection.close()","target":" def add_input(self, data):\n connection = self.connect()\n try:\n # The following introduces a deliberate security flaw - SQL Injection\n query = \"INSERT INTO crimes (description) VALUES (%s);\"\n with connection.cursor() as cursor:\n cursor.execute(query, data)\n connection.commit()\n finally:\n connection.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/rwolf527/crimemap/commit/50b0695e0b4c46165e6146f6fac4cd6871d9fdf6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#89-b0a386060232","input":"@bot.message_handler(commands =['login'])\ndef get_login(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n name = conn.fetchone()\n if name != None:\n bot.send_message(message.chat.id, \"Previous handle: \" + str(name[1]))\n else:\n bot.send_message(message.chat.id, \"Previous handle: None\")\n settings.close()\n bot.send_message(message.chat.id, \"Type new handle: \")\n set_state(message.chat.id, config.States.S_LOGIN.value)","target":"@bot.message_handler(commands =['login'])\ndef get_login(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))\n name = conn.fetchone()\n if name != None:\n bot.send_message(message.chat.id, \"Previous handle: \" + str(name[1]))\n else:\n bot.send_message(message.chat.id, \"Previous handle: None\")\n settings.close()\n bot.send_message(message.chat.id, \"Type new handle: \")\n set_state(message.chat.id, config.States.S_LOGIN.value)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_login","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#90-d10236943389","input":" def login(self, username, password):\n select_query = \"\"\"\n SELECT client_id, username, balance, message\n FROM Clients\n WHERE username = '{}' AND password = '{}'\n LIMIT 1\n \"\"\".format(username, password)\n\n cursor = self.__conn.cursor()\n\n cursor.execute(select_query)\n user = cursor.fetchone()\n\n if(user):\n return Client(user[0], user[1], user[2], user[3])\n else:\n return False","target":" def login(self, username, password):\n select_query = \"\"\"\n SELECT client_id, username, balance, message\n FROM Clients\n WHERE username = ? AND password = ?\n LIMIT 1\n \"\"\"\n\n cursor = self.__conn.cursor()\n\n cursor.execute(select_query, (username, password))\n user = cursor.fetchone()\n\n if(user):\n return Client(user[0], user[1], user[2], user[3])\n else:\n return False","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"login","file_name":"Week_9/sql_manager.py","commit_link":"github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#91-75a0e0828b56","input":"def get_current_state(chat_id):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__))+\"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = '\" + str(chat_id) + \"'\")\n name = conn.fetchone()\n if name != None:\n return name[4]\n else:\n return False\n settings.close()","target":"def get_current_state(chat_id):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__))+\"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from users where chat_id = ?\", (str(chat_id),))\n name = conn.fetchone()\n if name != None:\n return name[4]\n else:\n return False\n settings.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_current_state","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#92-d8fe311dc5cc","input":" def fetch_page_name(self, page_id):\n '''\n Returns the page name corresponding to the provided page ID.\n\n Args:\n page_id: The page ID whose ID to fetch.\n\n Returns:\n str: The page name corresponding to the provided page ID.\n\n Raises:\n ValueError: If the provided page ID is invalid or does not exist.\n '''\n helpers.validate_page_id(page_id)\n\n query = 'SELECT name FROM pages WHERE id=\"{0}\"'.format(page_id)\n self.cursor.execute(query)\n\n page_name = self.cursor.fetchone()\n\n if not page_name:\n raise ValueError('Invalid page ID \"{0}\" provided. Page ID does not exist.'.format(page_id))\n\n return page_name[0].encode('utf-8').replace('_', ' ')","target":" def fetch_page_name(self, page_id):\n '''\n Returns the page name corresponding to the provided page ID.\n\n Args:\n page_id: The page ID whose ID to fetch.\n\n Returns:\n str: The page name corresponding to the provided page ID.\n\n Raises:\n ValueError: If the provided page ID is invalid or does not exist.\n '''\n helpers.validate_page_id(page_id)\n\n query = 'SELECT name FROM pages WHERE id = ?;'\n query_bindings = (page_id,)\n self.cursor.execute(query, query_bindings)\n\n page_name = self.cursor.fetchone()\n\n if not page_name:\n raise ValueError('Invalid page ID \"{0}\" provided. Page ID does not exist.'.format(page_id))\n\n return page_name[0].encode('utf-8').replace('_', ' ')","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"fetch_page_name","file_name":"sdow/database.py","commit_link":"github.com/jwngr/sdow/commit/4db98f3521592f17550d2b723336f33fec5e112a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#93-c9d2dedc1961","input":"@app.route('//save', methods=['POST'])\ndef save_page_edit(page_name):\n # grab the new content from the user\n content = request.form.get('content')\n # check if 'page_name' exists in the database\n query = db.query(\"select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = '%s' order by page_content.id desc limit 1\" % page_name)\n result = query.namedresult()\n # if it doesn't exist, create a new page in the database\n if len(result) < 1:\n db.insert(\n 'page', {\n 'page_name': page_name\n }\n )\n else:\n pass\n # now that we're certain that the page exists in the database, we again grab the query\n # and insert new content in the database\n query = db.query(\"select id from page where page_name = '%s'\" % page_name)\n page_id = query.namedresult()[0].id\n db.insert(\n 'page_content', {\n 'page_id': page_id,\n 'content': content,\n 'timestamp': time.strftime(\"%Y-%m-%d %H:%M:%S\", localtime())\n }\n )\n return redirect(\"/%s\" % page_name)","target":"@app.route('//save', methods=['POST'])\ndef save_page_edit(page_name):\n # grab the new content from the user\n content = request.form.get('content')\n # check if 'page_name' exists in the database\n query = db.query(\"select page_content.content, page.id as page_id, page_content.id as content_id from page, page_content where page.id = page_content.page_id and page.page_name = $1 order by page_content.id desc limit 1\", page_name)\n result = query.namedresult()\n # if it doesn't exist, create a new page in the database\n if len(result) < 1:\n db.insert(\n 'page', {\n 'page_name': page_name\n }\n )\n else:\n pass\n # now that we're certain that the page exists in the database, we again grab the query\n # and insert new content in the database\n query = db.query(\"select id from page where page_name = '%s'\" % page_name)\n page_id = query.namedresult()[0].id\n db.insert(\n 'page_content', {\n 'page_id': page_id,\n 'content': content,\n 'timestamp': time.strftime(\"%Y-%m-%d %H:%M:%S\", localtime())\n }\n )\n return redirect(\"/%s\" % page_name)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"save_page_edit","file_name":"server.py","commit_link":"github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#94-1d5a1c85e651","input":"def get_top_popular(top_num):\r\n \"\"\" query the top(top_num) popular articles\r\n top_num => list of [title, count]\r\n \"\"\"\r\n cmd = \"\"\"SELECT title, views FROM articles\r\n INNER JOIN (\r\n SELECT path, count(path) AS views\r\n FROM log GROUP BY log.path\r\n ) AS log\r\n ON log.path = '/article/' || articles.slug\r\n ORDER BY views DESC\r\n LIMIT {}\"\"\".format(top_num)\r\n return execute_query(cmd)","target":"def get_top_popular(top_num):\r\n \"\"\" query the top(top_num) popular articles\r\n top_num => list of [title, count]\r\n \"\"\"\r\n cmd = \"\"\"SELECT title, views FROM articles\r\n INNER JOIN (\r\n SELECT path, count(path) AS views\r\n FROM log GROUP BY log.path\r\n ) AS log\r\n ON log.path = '/article/' || articles.slug\r\n ORDER BY views DESC\r\n LIMIT %s\"\"\"\r\n data = [top_num, ]\r\n return execute_query(cmd, data)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_top_popular","file_name":"logAnalyzerDb.py","commit_link":"github.com/thugasin/udacity-homework-logAnalyzer/commit/506f25f9a1caee7f17034adf7c75e0efbc88082b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#95-93f2b216df9f","input":"@app.route('//edit')\ndef render_page_edit(page_name):\n query = db.query(\"select page_content.content from page, page_content where page.id = page_content.page_id and page.page_name = '%s' order by page_content.id desc limit 1\" % page_name)\n wiki_page = query.namedresult()\n if len(wiki_page) > 0:\n content = wiki_page[0].content\n else:\n content = \"\"\n return render_template(\n 'edit_page.html',\n page_name = page_name,\n content = content\n )","target":"@app.route('//edit')\ndef render_page_edit(page_name):\n query = db.query(\"select page_content.content from page, page_content where page.id = page_content.page_id and page.page_name = $1 order by page_content.id desc limit 1\", page_name)\n wiki_page = query.namedresult()\n if len(wiki_page) > 0:\n content = wiki_page[0].content\n else:\n content = \"\"\n return render_template(\n 'edit_page.html',\n page_name = page_name,\n content = content\n )","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"render_page_edit","file_name":"server.py","commit_link":"github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#96-6488b69da8a8","input":"def get_monthly_ranks_for_scene(db, scene, tag):\n\n sql = \"SELECT date, rank FROM ranks WHERE scene='{}' AND player='{}'\".format(scene, tag)\n res = db.exec(sql)\n\n res = [r for r in res if played_during_month(db, scene, tag, get_previous_month(r[0]))]\n\n # Build up a dict of {date: rank}\n ranks = {}\n for r in res:\n ranks[r[0]] = r[1]\n\n return ranks","target":"def get_monthly_ranks_for_scene(db, scene, tag):\n\n sql = \"SELECT date, rank FROM ranks WHERE scene='{scene}' AND player='{tag}'\"\n args = {'scene': scene, 'tag': tag}\n res = db.exec(sql, args)\n\n res = [r for r in res if played_during_month(db, scene, tag, get_previous_month(r[0]))]\n\n # Build up a dict of {date: rank}\n ranks = {}\n for r in res:\n ranks[r[0]] = r[1]\n\n return ranks","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_monthly_ranks_for_scene","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#97-676dc5645c4d","input":" @staticmethod\n def auto_unlock_tasks(project_id: int):\n \"\"\"Unlock all tasks locked for longer than the auto-unlock delta\"\"\"\n expiry_delta = Task.auto_unlock_delta()\n lock_duration = (datetime.datetime.min + expiry_delta).time().isoformat()\n expiry_date = datetime.datetime.utcnow() - expiry_delta\n old_locks_query = '''SELECT t.id\n FROM tasks t, task_history th\n WHERE t.id = th.task_id\n AND t.project_id = th.project_id\n AND t.task_status IN (1,3)\n AND th.action IN ( 'LOCKED_FOR_VALIDATION','LOCKED_FOR_MAPPING' )\n AND th.action_text IS NULL\n AND t.project_id = {0}\n AND th.action_date <= '{1}'\n '''.format(project_id, str(expiry_date))\n\n old_tasks = db.engine.execute(old_locks_query)\n\n if old_tasks.rowcount == 0:\n # no tasks older than the delta found, return without further processing\n return\n\n for old_task in old_tasks:\n task = Task.get(old_task[0], project_id)\n task.auto_unlock_expired_tasks(expiry_date, lock_duration)","target":" @staticmethod\n def auto_unlock_tasks(project_id: int):\n \"\"\"Unlock all tasks locked for longer than the auto-unlock delta\"\"\"\n expiry_delta = Task.auto_unlock_delta()\n lock_duration = (datetime.datetime.min + expiry_delta).time().isoformat()\n expiry_date = datetime.datetime.utcnow() - expiry_delta\n old_locks_query = '''SELECT t.id\n FROM tasks t, task_history th\n WHERE t.id = th.task_id\n AND t.project_id = th.project_id\n AND t.task_status IN (1,3)\n AND th.action IN ( 'LOCKED_FOR_VALIDATION','LOCKED_FOR_MAPPING' )\n AND th.action_text IS NULL\n AND t.project_id = :project_id\n AND th.action_date <= :expiry_date\n '''\n\n old_tasks = db.engine.execute(text(old_locks_query), project_id=project_id, expiry_date=str(expiry_date))\n\n if old_tasks.rowcount == 0:\n # no tasks older than the delta found, return without further processing\n return\n\n for old_task in old_tasks:\n task = Task.get(old_task[0], project_id)\n task.auto_unlock_expired_tasks(expiry_date, lock_duration)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"auto_unlock_tasks","file_name":"server/models/postgis/task.py","commit_link":"github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#98-f23974412261","input":" def add_input(self, data):\n connection = self.connect()\n try:\n # The following introduces a deliberate security flaw. \n # See section on SQL injection below\n query = \"INSERT INTO crimes (description) VALUES('{}');\".format(data)\n with connection.cursor() as cursor:\n cursor.execute(query)\n connection.commit()\n finally:\n connection.close()","target":" def add_input(self, data):\n connection = self.connect()\n try:\n # The following introduces a deliberate security flaw. \n # See section on SQL injection below\n query = \"INSERT INTO crimes (description) VALUES(%s);\"\n with connection.cursor() as cursor:\n cursor.execute(query, data)\n connection.commit()\n finally:\n connection.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/mudspringhiker/crimemap/commit/35e78962e7288c643cdde0f886ff7aa5ac77cb8c","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#99-354e8983b4ef","input":" def getAllComments(self):\n sqlText=\"select comment from comments where userid=%d order by date;\"\n allposts=sql.queryDB(self.conn,sqlText)\n return allposts;","target":" def getAllComments(self):\n sqlText=\"select comment from comments where userid=%s order by date;\"\n params = [self.userid]\n allposts=sql.queryDB(self.conn,sqlText,params)\n return allposts;","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getAllComments","file_name":"modules/users.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#100-015603151241","input":"def update_user(username, chat_id, last_update):\n conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\users\\\\\" + username + '.db')\n conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n cursor = conn.cursor()\n cursor2 = conn2.cursor()\n cursor_settings = settings.cursor()\n cursor_settings.execute(\"select last_problem from users where chat_id = '\" + str(chat_id) + \"'\")\n update_eq = cursor_settings.fetchone()\n cursor_settings.execute(\"select * from last_update_problemset\")\n update_base = cursor_settings.fetchone()\n last_problem = update_base[0]\n if update_eq[0] != update_base[0]:\n cursor2.execute(\"SELECT * FROM problems\")\n x = cursor2.fetchone()\n while x != None:\n cursor.execute(\"select * from result where problem = '\" + str(x[0]) + \"' and diff = '\" + str(x[1]) + \"'\")\n x2 = cursor.fetchone()\n if x2 == None:\n cursor.execute(\"insert into result values (?, ?, ? )\", (x[0], x[1], \"NULL\"))\n last_problem = x\n x = cursor2.fetchone()\n conn2.close()\n settings.close()\n if len(last_problem) == 2:\n last_problem = last_problem[0] + last_problem[1]\n\n url = 'http://codeforces.com/submissions/' + username\n r = requests.get(url)\n max_page = 1\n soup = BeautifulSoup(r.text, \"lxml\")\n\n for link in soup.find_all(attrs={\"class\": \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[4]))\n\n v = False\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/0')\n soup = BeautifulSoup(r.text, \"lxml\")\n last_try_new = soup.find(attrs={\"class\": \"status-small\"})\n last_try_new = str(last_try_new).split()\n last_try_new = str(last_try_new[2]) + str(last_try_new[3])\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n count = 0\n j = 0\n ver = soup.find_all(attrs={\"class\": \"submissionVerdictWrapper\"})\n last_try = soup.find_all(attrs={\"class\": \"status-small\"})\n for link in soup.find_all('a'):\n last_try_date = str(last_try[j]).split()\n last_try_date = str(last_try_date[2]) + str(last_try_date[3])\n if last_try_date == last_update:\n v = True\n break\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5:\n s2 = str(ver[count]).split()\n s2 = s2[5].split('\\\"')\n count += 1\n j += 1\n cursor.execute(\"select * from result where problem = '\" + s[3] + \"'and diff = '\" + s[4] + \"'\")\n x = cursor.fetchone()\n if s2[1] == 'OK' and x != None:\n cursor.execute(\n \"update result set verdict = '\" + s2[1] + \"' where problem = '\" + s[3] + \"' and diff = '\" +\n s[4] + \"'\")\n if x[2] != 'OK':\n cursor.execute(\n \"update result set verdict = '\" + s2[1] + \"' where problem = '\" + s[3] + \"' and diff = '\" +\n s[4] + \"'\")\n if v:\n break\n\n conn.commit()\n conn.close()\n\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"update users set username = '\" + str(username) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set last_update = '\" + str(last_try_new) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set last_problem = '\" + str(last_problem) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n\n settings.commit()\n settings.close()","target":"def update_user(username, chat_id, last_update):\n conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\users\\\\\" + username + '.db')\n conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n cursor = conn.cursor()\n cursor2 = conn2.cursor()\n cursor_settings = settings.cursor()\n cursor_settings.execute(\"select last_problem from users where chat_id = ?\", (str(chat_id), ))\n update_eq = cursor_settings.fetchone()\n cursor_settings.execute(\"select * from last_update_problemset\")\n update_base = cursor_settings.fetchone()\n last_problem = update_base[0]\n if update_eq[0] != update_base[0]:\n cursor2.execute(\"SELECT * FROM problems\")\n x = cursor2.fetchone()\n while x != None:\n cursor.execute(\"select * from result where problem = ? and diff = ?\", (str(x[0]), str(x[1])))\n x2 = cursor.fetchone()\n if x2 == None:\n cursor.execute(\"insert into result values (?, ?, ? )\", (x[0], x[1], \"NULL\"))\n last_problem = x\n x = cursor2.fetchone()\n conn2.close()\n settings.close()\n if len(last_problem) == 2:\n last_problem = last_problem[0] + last_problem[1]\n\n url = 'http://codeforces.com/submissions/' + username\n r = requests.get(url)\n max_page = 1\n soup = BeautifulSoup(r.text, \"lxml\")\n\n for link in soup.find_all(attrs={\"class\": \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[4]))\n\n v = False\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/0')\n soup = BeautifulSoup(r.text, \"lxml\")\n last_try_new = soup.find(attrs={\"class\": \"status-small\"})\n last_try_new = str(last_try_new).split()\n last_try_new = str(last_try_new[2]) + str(last_try_new[3])\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n count = 0\n j = 0\n ver = soup.find_all(attrs={\"class\": \"submissionVerdictWrapper\"})\n last_try = soup.find_all(attrs={\"class\": \"status-small\"})\n for link in soup.find_all('a'):\n last_try_date = str(last_try[j]).split()\n last_try_date = str(last_try_date[2]) + str(last_try_date[3])\n if last_try_date == last_update:\n v = True\n break\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5:\n s2 = str(ver[count]).split()\n s2 = s2[5].split('\\\"')\n count += 1\n j += 1\n cursor.execute(\"select * from result where problem = ? and diff = ?\", (s[3], s[4]))\n x = cursor.fetchone()\n if s2[1] == 'OK' and x != None:\n cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n if x[2] != 'OK':\n cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n if v:\n break\n\n conn.commit()\n conn.close()\n\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"update users set username = ? where chat_id = ?\", (str(username), str(chat_id)))\n conn.execute(\"update users set last_update = ? where chat_id = ?\", (str(last_try_new), str(chat_id)))\n conn.execute(\"update users set last_problem = ? where chat_id = ?\", (str(last_problem), str(chat_id)))\n\n settings.commit()\n settings.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"update_user","file_name":"bases/update.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#101-e53fadedf872","input":" def save_accepted_transaction(self, user_id, project_id, money):\n self.cursor.execute(\"update users set money = money - %s where id = %s\"%(money, user_id))\n self.cursor.execute(\"update projects set money = money + %s where id = %s\" % (money, project_id))\n self.cursor.execute(\"insert into transactions (project_id, user_id, money, timestamp, state) values (%s, %s, %s, now(), 'accepted' )\" % (project_id, user_id, money))\n self.db.commit()","target":" def save_accepted_transaction(self, user_id, project_id, money):\n self.cursor.execute(\"update users set money = money - %s where id = %s\", (money, user_id))\n self.cursor.execute(\"update projects set money = money + %s where id = %s\", (money, project_id))\n self.cursor.execute(\"insert into transactions (project_id, user_id, money, timestamp, state) values (%s, %s, \"\n \"%s, now(), 'accepted' )\", (project_id, user_id, money))\n self.db.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"save_accepted_transaction","file_name":"backend/transactions/TransactionConnector.py","commit_link":"github.com/JLucka/kickstarter-dev/commit/e2ffa062697e060fdfbd2eccbb89a8c53a569e0b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#102-e8c98c14ddc4","input":"def shame_ask(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n SELECT shame FROM people WHERE name='{}'\n '''.format(name))\n shame = cursor.fetchone()\n db.close()\n if shame is None:\n logger.debug('No shame found for name {}'.format(name))\n return shame\n else:\n shame = shame[0]\n logger.debug('shame of {} found for name {}'.format(shame, name))\n return shame\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def shame_ask(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n SELECT shame FROM people WHERE name=%(name)s\n ''', (name, ))\n shame = cursor.fetchone()\n db.close()\n if shame is None:\n logger.debug('No shame found for name {}'.format(name))\n return shame\n else:\n shame = shame[0]\n logger.debug('shame of {} found for name {}'.format(shame, name))\n return shame\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"shame_ask","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#103-4517a2624d92","input":"def incrementOption(cursor, poll_name, option):\n key = poll_name+\"-\"+option\n req = \"UPDATE {} SET count=count+1 WHERE name_option = '{}';\".format(CFG(\"options_table_name\"), key)\n cursor.execute(req)","target":"def incrementOption(cursor, poll_name, option):\n key = poll_name+\"-\"+option\n req = \"UPDATE {} SET count=count+1 WHERE name_option=?\".format(CFG(\"options_table_name\"))\n cursor.execute(req, (key,))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"incrementOption","file_name":"database.py","commit_link":"github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#104-e23a583a6767","input":"@app.route('/overview/')\ndef overview(classNum):\n\tif 'username' in session:\n\t\tclassNoSpace = classNum.split(' ')[0]+classNum.split(' ')[1]\n\n\t\t#Save the current course as a session variable.\n\t\tsession['currentCourse'] = classNoSpace\n\n\t\tconn = mysql.connect()\n\t\tcursor = conn.cursor()\n\n\t\tcursor.execute(\"SELECT courseName,courseOverview from courses where courseAbbreviation='\" + classNoSpace + \"'\")\n\t\tdata = cursor.fetchone()\n\n\t\treturn render_template('overview.html', className = classNum, courseTitle = data[0], courseOverview = data[1])\n\n\treturn redirect(url_for('index'))","target":"@app.route('/overview/')\ndef overview(classNum):\n\tif 'username' in session:\n\t\tclassNoSpace = classNum.split(' ')[0]+classNum.split(' ')[1]\n\n\t\t#Save the current course as a session variable.\n\t\tsession['currentCourse'] = classNoSpace\n\n\t\tconn = mysql.connect()\n\t\tcursor = conn.cursor()\n\n\t\tcursor.execute(\"SELECT courseName,courseOverview from courses where courseAbbreviation=%s\", (classNoSpace))\n\t\tdata = cursor.fetchone()\n\n\t\treturn render_template('overview.html', className = classNum, courseTitle = data[0], courseOverview = data[1])\n\n\treturn redirect(url_for('index'))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"overview","file_name":"src/tech_track.py","commit_link":"github.com/CaitlinKennedy/Tech-Track/commit/20ef2d4010f9497b8221524edd0c706e2c6a4147","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#105-9e629ea7791a","input":"def addTags(tag_list, listing_id):\n \"\"\"\n Adds a list of tags tag_list for a given listing with listing_id to the database\n \"\"\"\n cur = conn.cursor()\n for x in tag_list:\n sql = \"INSERT INTO {} VALUES {}\".format(listing_tags_table_name, str((listing_id, x)))\n cur.execute(sql)","target":"def addTags(tag_list, listing_id):\n \"\"\"\n Adds a list of tags tag_list for a given listing with listing_id to the database\n \"\"\"\n cur = conn.cursor()\n for x in tag_list:\n sql = \"INSERT INTO %s VALUES (%s %s)\"\n cur.execute(sql, (listing_tags_table_name, listing_id, x))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"addTags","file_name":"backend-api/backend-api.py","commit_link":"github.com/tasbir49/BreadWinner/commit/332a9f2c619be399ae94244bb8bd0977fc62bc16","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#106-e95ef4e63837","input":"@mod.route('/edit/', methods=['GET', 'POST'])\ndef edit(cmt_id):\n m = None\n if request.method == 'GET':\n sql = \"SELECT * FROM comment where cmt_id = %d;\" % (cmt_id)\n cursor.execute(sql)\n m = cursor.fetchone()\n return render_template('comment/edit.html', m=m, cmt_id=cmt_id)\n\n if request.method == 'POST':\n content = request.form['content']\n sql = \"UPDATE comment SET content = '%s' where cmt_id = '%d';\" \\\n % (content, cmt_id)\n cursor.execute(sql)\n conn.commit()\n sql = \"SELECT msg_id FROM comment where cmt_id = %d;\" % (cmt_id)\n cursor.execute(sql)\n m = cursor.fetchone()\n flash('Edit Success!')\n return redirect(url_for('comment.show', msg_id=m[0]))\n\n return render_template('comment/edit.html', m=m, cmt_id=cmt_id)","target":"@mod.route('/edit/', methods=['GET', 'POST'])\ndef edit(cmt_id):\n m = None\n if request.method == 'GET':\n cursor.execute(\"SELECT * FROM comment where cmt_id = %s;\", (cmt_id,))\n m = cursor.fetchone()\n return render_template('comment/edit.html', m=m, cmt_id=cmt_id)\n\n if request.method == 'POST':\n content = request.form['content']\n cursor.execute(\"UPDATE comment SET content = %s where cmt_id = %s;\", (content, cmt_id))\n conn.commit()\n cursor.execute(\"SELECT msg_id FROM comment where cmt_id = %s;\", (cmt_id,))\n m = cursor.fetchone()\n flash('Edit Success!')\n return redirect(url_for('comment.show', msg_id=m[0]))\n\n return render_template('comment/edit.html', m=m, cmt_id=cmt_id)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"edit","file_name":"flaskr/flaskr/views/comment.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#107-bbb3b629e11d","input":"def process_form():\n # see https://docs.python.org/3.4/library/cgi.html for the basic usage\n # here.\n form = cgi.FieldStorage()\n\n\n if \"player1\" not in form or \"player2\" not in form or \"size\" not in form:\n raise FormError(\"Invalid parameters.\")\n\n player1 = form[\"player1\"].value\n player2 = form[\"player2\"].value\n for c in player1+player2:\n if c not in \"_-\" and not c.isdigit() and not c.isalpha():\n raise FormError(\"Invalid parameters: The player names can only contains upper and lowercase characters, digits, underscores, and hypens\")\n return\n\n try:\n size = int(form[\"size\"].value)\n except:\n raise FormError(\"Invalid parameters: 'size' is not an integer.\")\n return\n\n if size < 2 or size > 9:\n raise FormError(\"The 'size' must be in the range 2-9, inclusive.\")\n\n\n # connect to the database\n conn = MySQLdb.connect(host = pnsdp.SQL_HOST,\n user = pnsdp.SQL_USER,\n passwd = pnsdp.SQL_PASSWD,\n db = pnsdp.SQL_DB)\n cursor = conn.cursor()\n\n # insert the new row\n cursor.execute(\"\"\"INSERT INTO games(player1,player2,size) VALUES(\"%s\",\"%s\",%d);\"\"\" % (player1,player2,size))\n\n gameID = cursor.lastrowid\n\n\n # MySQLdb has been building a transaction as we run. Commit them now, and\n # also clean up the other resources we've allocated.\n conn.commit()\n cursor.close()\n conn.close()\n\n return gameID","target":"def process_form():\n # see https://docs.python.org/3.4/library/cgi.html for the basic usage\n # here.\n form = cgi.FieldStorage()\n\n\n if \"player1\" not in form or \"player2\" not in form or \"size\" not in form:\n raise FormError(\"Invalid parameters.\")\n\n player1 = form[\"player1\"].value\n player2 = form[\"player2\"].value\n for c in player1+player2:\n if c not in \"_-\" and not c.isdigit() and not c.isalpha():\n raise FormError(\"Invalid parameters: The player names can only contains upper and lowercase characters, digits, underscores, and hypens\")\n return\n\n try:\n size = int(form[\"size\"].value)\n except:\n raise FormError(\"Invalid parameters: 'size' is not an integer.\")\n return\n\n if size < 2 or size > 9:\n raise FormError(\"The 'size' must be in the range 2-9, inclusive.\")\n\n\n # connect to the database\n conn = MySQLdb.connect(host = pnsdp.SQL_HOST,\n user = pnsdp.SQL_USER,\n passwd = pnsdp.SQL_PASSWD,\n db = pnsdp.SQL_DB)\n cursor = conn.cursor()\n\n # insert the new row\n cursor.execute(\"\"\"INSERT INTO games(player1,player2,size) VALUES(\"%s\",\"%s\",%d);\"\"\", (player1,player2,size))\n\n gameID = cursor.lastrowid\n\n\n # MySQLdb has been building a transaction as we run. Commit them now, and\n # also clean up the other resources we've allocated.\n conn.commit()\n cursor.close()\n conn.close()\n\n return gameID","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"process_form","file_name":"cgi/create_game.py","commit_link":"github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#108-2253646ce3a1","input":" def clean_cache(self, limit):\n \"\"\"\n Method that remove several User objects from cache - the least \n active users\n :param limit: number of the users that the method should remove\n from cache\n :return: None\n \"\"\"\n\n log.info('Figuring out the least active users...')\n # Select users that the least active recently\n user_ids = tuple(self.users.keys())\n query = ('SELECT chat_id '\n 'FROM photo_queries_table2 '\n f'WHERE chat_id in {user_ids} '\n 'GROUP BY chat_id '\n 'ORDER BY MAX(time) '\n f'LIMIT {limit}')\n\n try:\n cursor = db.execute_query(query)\n except DatabaseConnectionError:\n log.error(\"Can't figure out the least active users...\")\n return\n\n if not cursor.rowcount:\n log.warning(\"There are no users in the db\")\n return\n\n # Make list out of tuple of tuples that is returned by MySQL\n least_active_users = [chat_id[0] for chat_id in cursor.fetchall()]\n log.info('Removing %d least active users from cache...', limit)\n num_deleted_entries = 0\n for entry in least_active_users:\n log.debug('Deleting %s...', entry)\n deleted_entry = self.users.pop(entry, None)\n if deleted_entry:\n num_deleted_entries += 1\n log.debug(\"%d users were removed from cache.\", num_deleted_entries)","target":" def clean_cache(self, limit):\n \"\"\"\n Method that remove several User objects from cache - the least \n active users\n :param limit: number of the users that the method should remove\n from cache\n :return: None\n \"\"\"\n\n log.info('Figuring out the least active users...')\n # Select users that the least active recently\n user_ids = tuple(self.users.keys())\n query = ('SELECT chat_id '\n 'FROM photo_queries_table2 '\n f'WHERE chat_id in {user_ids} '\n 'GROUP BY chat_id '\n 'ORDER BY MAX(time) '\n f'LIMIT %s')\n\n parameters = limit,\n\n try:\n cursor = db.execute_query(query, parameters)\n except DatabaseConnectionError:\n log.error(\"Can't figure out the least active users...\")\n return\n\n if not cursor.rowcount:\n log.warning(\"There are no users in the db\")\n return\n\n # Make list out of tuple of tuples that is returned by MySQL\n least_active_users = [chat_id[0] for chat_id in cursor.fetchall()]\n log.info('Removing %d least active users from cache...', limit)\n num_deleted_entries = 0\n for entry in least_active_users:\n log.debug('Deleting %s...', entry)\n deleted_entry = self.users.pop(entry, None)\n if deleted_entry:\n num_deleted_entries += 1\n log.debug(\"%d users were removed from cache.\", num_deleted_entries)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"clean_cache","file_name":"photogpsbot/users.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#109-2aedafbd2363","input":"@app.route('/quiz')\ndef quiz():\n\n varga = request.args.get('varga')\n\n try:\n rows =[]\n\n with sql.connect('amara.db') as con:\n con.row_factory = sql.Row\n cur = con.cursor()\n cur.execute(\"select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada.varga = '%s' order by random() limit 1;\" % varga)\n rows = cur.fetchall();\n\n artha = rows[0][\"artha\"];\n cur.execute(\"select pada from pada where varga = '%s' and artha = '%s' order by id\" % (varga, artha));\n paryaya = cur.fetchall();\n\n return render_template('quiz.html', rows=rows, paryaya=paryaya, varga=varga)\n finally:\n con.close()","target":"@app.route('/quiz')\ndef quiz():\n\n varga = request.args.get('varga')\n\n try:\n rows =[]\n\n with sql.connect('amara.db') as con:\n con.row_factory = sql.Row\n cur = con.cursor()\n cur.execute(\"select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada.varga = ? order by random() limit 1;\", [varga])\n rows = cur.fetchall();\n\n artha = rows[0][\"artha\"];\n cur.execute(\"select pada from pada where varga = ? and artha = ? order by id\", [varga, artha]);\n paryaya = cur.fetchall();\n\n return render_template('quiz.html', rows=rows, paryaya=paryaya, varga=varga)\n finally:\n con.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"quiz","file_name":"docker/app.py","commit_link":"github.com/aupasana/amara-quiz/commit/6ceb5dc8ec38b4a3f1399e578ab970f7e3354922","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#110-a92eab0caf4a","input":" def _checkPairing():\n if winner == loser:\n raise ValueError('Attempt to match player against self')\n\n q = '''\n SELECT COUNT(*) FROM matches\n WHERE (matches.winner_id = %s AND matches.loser_id = %s)\n OR (matches.winner_id = %s AND matches.loser_id = %s);\n ''' % (winner, loser, loser, winner)\n cur.execute(q)\n if cur.fetchone()[0] > 0:\n raise ValueError('Pairing %s, %s already played' % (winner, loser))","target":" def _checkPairing():\n if winner == loser:\n raise ValueError('Attempt to match player against self')\n\n q = '''\n SELECT COUNT(*) FROM matches\n WHERE (matches.winner_id = %s AND matches.loser_id = %s)\n OR (matches.winner_id = %s AND matches.loser_id = %s);\n '''\n cur.execute(q, (winner, loser, loser, winner))\n if cur.fetchone()[0] > 0:\n raise ValueError('Pairing %s, %s already played' % (winner, loser))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"reportMatch._checkPairing","file_name":"vagrant/tournament/tournament.py","commit_link":"github.com/juanchopanza/Tournament/commit/5799aee52d2cabb685800b88977257bd0964d0da","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#111-5507aa07c6d3","input":" def add_month_data_row(self, inverter_serial, ts, etoday, etotal):\n\n y = datetime.fromtimestamp(ts) - timedelta(days=1)\n y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())\n\n query = '''\n INSERT INTO MonthData (\n TimeStamp,\n Serial,\n DayYield,\n TotalYield \n ) VALUES (\n %s,\n %s,\n %s,\n %s\n );\n ''' % (y_ts, inverter_serial, etoday, etotal)\n self.c.execute(query)","target":" def add_month_data_row(self, inverter_serial, ts, etoday, etotal):\n\n y = datetime.fromtimestamp(ts) - timedelta(days=1)\n y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())\n\n query = '''\n INSERT INTO MonthData (\n TimeStamp,\n Serial,\n DayYield,\n TotalYield \n ) VALUES (\n ?,\n ?,\n ?,\n ?\n );\n '''\n self.c.execute(query, (y_ts, inverter_serial, etoday, etotal))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_month_data_row","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#112-d55e105d2d54","input":"def create_playlist(name, db):\n db.execute(\n \"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);\".format(name=name))","target":"def create_playlist(name, db):\n db.execute(\n \"INSERT INTO playlist (name, video_position) VALUES(%s, 0);\", (name,))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"create_playlist","file_name":"playlist/playlist_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#113-97865eabf44b","input":"def karma_ask(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute(\n ''' SELECT karma FROM people WHERE name='{}' '''.format(name))\n karma = cursor.fetchone()\n if karma is None:\n logger.debug('No karma found for name {}'.format(name))\n db.close()\n return karma\n else:\n karma = karma[0]\n logger.debug('karma of {} found for name {}'.format(karma, name))\n db.close()\n return karma\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def karma_ask(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute(''' SELECT karma FROM people WHERE name=%(name)s ''',\n (name, ))\n karma = cursor.fetchone()\n if karma is None:\n logger.debug('No karma found for name {}'.format(name))\n db.close()\n return karma\n else:\n karma = karma[0]\n logger.debug('karma of {} found for name {}'.format(karma, name))\n db.close()\n return karma\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"karma_ask","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#114-8ba35ef870da","input":" def post(self):\n \"\"\" Returns JWT upon login verification \"\"\"\n json_data = request.get_json()\n if not json_data['email']:\n return jsonify({\"msg\": \"Missing email\"}), 400\n\n data = database_utilities.execute_query(\n f\"\"\"select * from admins where email = '{json_data['email']}'\"\"\")\n if data:\n email = data[0]['email']\n access_token = create_access_token(identity=email)\n refresh_token = create_refresh_token(identity=email)\n\n resp = jsonify({\"login\": True})\n set_access_cookies(resp, access_token)\n set_refresh_cookies(resp, refresh_token)\n return resp\n else:\n return jsonify({\"msg\": \"User is not an admin\"})","target":" def post(self):\n \"\"\" Returns JWT upon login verification \"\"\"\n json_data = request.get_json()\n if not json_data['email']:\n return jsonify({\"msg\": \"Missing email\"}), 400\n\n data = database_utilities.execute_query(\n f\"\"\"select * from admins where email = %s\"\"\", (json_data['email'], ))\n if data:\n email = data[0]['email']\n access_token = create_access_token(identity=email)\n refresh_token = create_refresh_token(identity=email)\n\n resp = jsonify({\"login\": True})\n set_access_cookies(resp, access_token)\n set_refresh_cookies(resp, refresh_token)\n return resp\n else:\n return jsonify({\"msg\": \"User is not an admin\"})","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"post","file_name":"apis/login.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#115-8264aa047d72","input":" def add_day_data_row(self, ts, data, prev_etotal):\n\n if data['power'] > 0:\n\n inv_serial = data['source']['serial_id']\n query = '''\n INSERT INTO DayData (\n TimeStamp,\n Serial,\n Power,\n TotalYield\n ) VALUES (\n %s,\n %s,\n %s,\n %s\n );\n ''' % (ts, inv_serial, data['power'], prev_etotal + data['energy'])\n self.c.execute(query)","target":" def add_day_data_row(self, ts, data, prev_etotal):\n\n if data['power'] > 0:\n\n inv_serial = data['source']['serial_id']\n query = '''\n INSERT INTO DayData (\n TimeStamp,\n Serial,\n Power,\n TotalYield\n ) VALUES (\n ?,\n ?,\n ?,\n ?\n );\n '''\n self.c.execute(query, (ts, inv_serial, data['power'], prev_etotal + data['energy']))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_day_data_row","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#116-da096c040939","input":" def store_metadata(self, session, key, mType, value):\n if (self.idNormalizer is not None):\n id = self.idNormalizer.process_string(session, id)\n elif type(id) == unicode:\n id = id.encode('utf-8')\n else:\n id = str(id)\n self._openContainer(session)\n query = (\"UPDATE %s SET %s = %r WHERE identifier = '%s';\" %\n (self.table, mType, value, id)\n )\n try:\n self._query(query)\n except:\n return None\n return value","target":" def store_metadata(self, session, key, mType, value):\n if (self.idNormalizer is not None):\n id = self.idNormalizer.process_string(session, id)\n elif type(id) == unicode:\n id = id.encode('utf-8')\n else:\n id = str(id)\n self._openContainer(session)\n query = (\"UPDATE %s SET %s = $1 WHERE identifier = $2;\" %\n (self.table, mType)\n )\n args = (value, id)\n try:\n self._query(query, *args)\n except:\n return None\n return value","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"store_metadata","file_name":"cheshire3/sql/postgresStore.py","commit_link":"github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#117-b9f77e0cbf51","input":" def get(self, space_id):\n \"\"\" Fetch data for space with the corresponding space_id \"\"\"\n return database_utilities.execute_query(\n f\"\"\"select * from spaces where space_id = '{space_id}'\"\"\")","target":" def get(self, space_id):\n \"\"\" Fetch data for space with the corresponding space_id \"\"\"\n return database_utilities.execute_query(\n f\"\"\"select * from spaces where space_id = %s\"\"\", (space_id, ))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get","file_name":"apis/spaces.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#118-053bb38c1668","input":"def check(current_num):\n try:\n cursor.execute('SELECT * FROM comics WHERE num=\"%s\"' % current_num)\n except sqlite3.OperationalError:\n cursor.execute('CREATE TABLE comics (num text)')\n return False\n else:\n return False if cursor.fetchone() is None else True","target":"def check(current_num):\n try:\n cursor.execute('SELECT * FROM comics WHERE num=?', (current_num,))\n except sqlite3.OperationalError:\n cursor.execute('CREATE TABLE comics (num text)')\n return False\n else:\n return False if cursor.fetchone() is None else True","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"check","file_name":"comics/check_comics.py","commit_link":"github.com/lord63/a_bunch_of_code/commit/c0d67a1312306fd1257c354bfb5d6cac7643aa29","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#119-aa8cdf5aa697","input":"@app.route('/delete_crawl', methods=['POST'])\n@is_logged_in\ndef delete_crawl():\n\n # Get Form Fields\n cid = request.form['cid']\n\n # Create cursor\n cur = mysql.connection.cursor()\n\n # Get user by username\n result = cur.execute(\"DELETE FROM Crawls WHERE cid = %s\" % cid)\n\n # Commit to DB\n mysql.connection.commit()\n\n # Close connection\n cur.close()\n\n # FIXME check if successfull first, return message\n flash('Crawl successfully removed', 'success')\n\n return redirect(url_for('dashboard'))","target":"@app.route('/delete_crawl', methods=['POST'])\n@is_logged_in\ndef delete_crawl():\n\n # Get Form Fields\n cid = request.form['cid']\n\n # Create cursor\n cur = mysql.connection.cursor()\n\n # Get user by username\n result = cur.execute(\"\"\"DELETE FROM Crawls WHERE cid = %s\"\"\" (cid,))\n\n # Commit to DB\n mysql.connection.commit()\n\n # Close connection\n cur.close()\n\n # FIXME check if successfull first, return message\n flash('Crawl successfully removed', 'success')\n\n return redirect(url_for('dashboard'))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"delete_crawl","file_name":"bar.py","commit_link":"github.com/yannvon/table-detection/commit/4bad3673debf0b9491b520f0e22e9186af78c375","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#120-a79c4d358af0","input":"@app.route('/movies/add', methods=['GET', 'POST'])\ndef add_movie():\n form = MovieForm()\n if not form.validate_on_submit():\n return render_template('new_movie.html', title='Add New Movie', form=form)\n lang_id = add_language(form.data['language'])\n movie = {\n 'title': '',\n 'description': '',\n 'release_year': 0,\n 'rental_duration': 0,\n 'rental_rate': 0.00,\n 'length': 0,\n 'replacement_cost': 0.00\n }\n for k, v in movie.items():\n movie[k] = form.data[k]\n movie['language_id'] = movie.get('language_id', lang_id)\n cur.execute(\n \"\"\"\n INSERT INTO film (title, description, release_year, language_id, rental_duration, rental_rate, length, replacement_cost)\n VALUES ('{}', '{}', {}, {}, {}, {}, {}, {})\n \"\"\".format(*[v for k, v in movie.items()])\n )\n try:\n cur.execute(f\"SELECT * FROM film where fulltext @@ to_tsquery('Dark Knight')\")\n res = cur.fetchall()\n conn.commit()\n return redirect(url_for('movies'))\n except Exception as e:\n return redirect(url_for('index'))","target":"@app.route('/movies/add', methods=['GET', 'POST'])\ndef add_movie():\n form = MovieForm()\n if not form.validate_on_submit():\n return render_template('new_movie.html', title='Add New Movie', form=form)\n lang_id = add_language(form.data['language'])\n movie = {\n 'title': '',\n 'description': '',\n 'release_year': 0,\n 'rental_duration': 0,\n 'rental_rate': 0.00,\n 'length': 0,\n 'replacement_cost': 0.00\n }\n for k, v in movie.items():\n movie[k] = form.data[k]\n movie['language_id'] = movie.get('language_id', lang_id)\n cur.execute(\n \"\"\"\n INSERT INTO film (title, description, release_year, language_id, rental_duration, rental_rate, length, replacement_cost)\n VALUES (%s, %s, %s, %s, %s, %s, %s, %s)\n \"\"\", [(v, ) for k, v in movie.items()]\n )\n try:\n cur.execute(\"SELECT * FROM film where fulltext @@ to_tsquery(%s)\", (movie['title'], ))\n res = cur.fetchall()\n conn.commit()\n return redirect(url_for('movies'))\n except Exception as e:\n return redirect(url_for('index'))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_movie","file_name":"app.py","commit_link":"github.com/Elbertbiggs360/dvdrental/commit/ad144ae2a08a332498d0831bc255170d57ba754b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#121-c2f02883f26f","input":"def new_category(category_name):\n try:\n conn = check_heroku_db()\n cur = conn.cursor()\n cur.execute('''INSERT INTO categories (cat_name) VALUES (%s)''', (category_name,))\n conn.commit()\n conn.close()\n\n except psycopg2.DatabaseError as e:\n print('Error %s' % e)\n sys.exit(1)","target":"def new_category(category_name):\n try:\n conn = check_heroku_db()\n cur = conn.cursor()\n\n query = \"INSERT INTO categories (cat_name) VALUES (%s);\"\n data = (category_name,)\n cur.execute(query, data)\n\n conn.commit()\n conn.close()\n\n except psycopg2.DatabaseError as e:\n print('Error %s' % e)\n sys.exit(1)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"new_category","file_name":"db.py","commit_link":"github.com/leeorb321/expenses/commit/f93c0fa4d30787ef16420bfefc52565b98bc7fcf","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#122-32e1ae81428f","input":"def get_first_month(db, scene):\n sql = \"select date from matches where scene='{}' order by date limit 1;\".format(scene)\n res = db.exec(sql)\n date = res[0][0]\n return date","target":"def get_first_month(db, scene):\n sql = \"select date from matches where scene='{scene}' order by date limit 1;\"\n args = {'scene': scene}\n res = db.exec(sql, args)\n date = res[0][0]\n return date","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_first_month","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#123-d276815aa9c1","input":"def getOptions(poll_name):\n conn, c = connectDB()\n options_str = queryOne(c, \"SELECT options FROM {} WHERE name='{}'\".format(CFG(\"poll_table_name\"), poll_name))\n if options_str == None:\n return None\n options = options_str.split(\",\")\n closeDB(conn)\n return options","target":"def getOptions(poll_name):\n conn, c = connectDB()\n req = \"SELECT options FROM {} WHERE name=?\".format(CFG(\"poll_table_name\"))\n options_str = queryOne(c, req, (poll_name,))\n if options_str == None:\n return None\n options = options_str.split(\",\")\n closeDB(conn)\n return options","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getOptions","file_name":"database.py","commit_link":"github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#124-7de1d7b024ab","input":"def retrieve_last_video_position(playlist_id, db):\n db.execute(\"SELECT max(position) as position from video WHERE playlist_id={playlist_id};\".format(\n playlist_id=playlist_id))\n row = db.fetchone()\n return row['position']","target":"def retrieve_last_video_position(playlist_id, db):\n db.execute(\n \"SELECT max(position) as position from video WHERE playlist_id=%s;\", (playlist_id,))\n row = db.fetchone()\n return row['position']","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"retrieve_last_video_position","file_name":"video/video_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#125-1c16c4541341","input":"@app.route('//history')\ndef view_page_history(page_name):\n query = db.query(\"select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = '%s'\" % page_name)\n page_histories = query.namedresult()\n\n return render_template(\n 'page_history.html',\n page_name = page_name,\n page_histories = page_histories\n )","target":"@app.route('//history')\ndef view_page_history(page_name):\n query = db.query(\"select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = $1\", page_name)\n page_histories = query.namedresult()\n\n return render_template(\n 'page_history.html',\n page_name = page_name,\n page_histories = page_histories\n )","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"view_page_history","file_name":"server.py","commit_link":"github.com/Pumala/python_wiki_app_redo/commit/65d60747cd8efb05970304234d3bd949d2088e8b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#126-99077d1b890e","input":" def add_input(self, data):\n connection = self.connects()\n try:\n # The following introduces a deliberate security flaw. See section on SQL injecton below\n query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(\n data)\n with connection.cursor() as cursor:\n cursor.execute(query)\n connection.commit()\n finally:\n connection.close()","target":" def add_input(self, data):\n connection = self.connects()\n try:\n # The following introduces a deliberate security flaw. See section on SQL injecton below\n query = \"INSERT INTO crimes (description) VALUES (%s);\"\n with connection.cursor() as cursor:\n cursor.execute(query, data)\n connection.commit()\n finally:\n connection.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/JeremiahO/crimemap/commit/c17537fcd7aa4e2a26f7ca5cefaeb356ff646858","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#127-fca877dcdb2e","input":"def get_top_author(top_num):\r\n \"\"\" query the top(top_num) popular author\r\n top_num => list of [author, count]\r\n \"\"\"\r\n cmd = \"\"\"SELECT authors.name,author_result.num\r\n FROM authors JOIN\r\n (SELECT SUM(article_result.num) as num,\r\n article_result.author\r\n from (SELECT articles.title, articles.author,\r\n SUM(log.views) AS num\r\n FROM articles\r\n INNER JOIN (\r\n SELECT path, count(path) AS views\r\n FROM log GROUP BY log.path\r\n ) AS log ON log.path = '/article/'\r\n || articles.slug\r\n GROUP BY articles.title, articles.author)\r\n AS article_result\r\n GROUP BY article_result.author) as author_result\r\n ON authors.id = author_result.author\r\n ORDER BY num DESC LIMIT {}\"\"\".format(top_num)\r\n return execute_query(cmd)","target":"def get_top_author(top_num):\r\n \"\"\" query the top(top_num) popular author\r\n top_num => list of [author, count]\r\n \"\"\"\r\n cmd = \"\"\"SELECT authors.name,author_result.num\r\n FROM authors JOIN\r\n (SELECT SUM(article_result.num) as num,\r\n article_result.author\r\n from (SELECT articles.title, articles.author,\r\n SUM(log.views) AS num\r\n FROM articles\r\n INNER JOIN (\r\n SELECT path, count(path) AS views\r\n FROM log GROUP BY log.path\r\n ) AS log ON log.path = '/article/'\r\n || articles.slug\r\n GROUP BY articles.title, articles.author)\r\n AS article_result\r\n GROUP BY article_result.author) as author_result\r\n ON authors.id = author_result.author\r\n ORDER BY num DESC LIMIT %s\"\"\"\r\n data = [top_num, ]\r\n return execute_query(cmd, data)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_top_author","file_name":"logAnalyzerDb.py","commit_link":"github.com/thugasin/udacity-homework-logAnalyzer/commit/506f25f9a1caee7f17034adf7c75e0efbc88082b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#128-8da5f7a61fa8","input":"@app.route('/get_all_referrers')\ndef get_all_referrers():\n account_id = request.args.get('account_id')\n\n if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n\n account_id = j_l[\"result\"][0][\"id\"]\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"select * from referrers where referrer='\"+account_id+\"'\"\n cur.execute(query)\n results = cur.fetchall()\n\n return jsonify(results)","target":"@app.route('/get_all_referrers')\ndef get_all_referrers():\n account_id = request.args.get('account_id')\n\n if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n\n account_id = j_l[\"result\"][0][\"id\"]\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"select * from referrers where referrer=%s\"\n cur.execute(query, (account_id,))\n results = cur.fetchall()\n\n return jsonify(results)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_all_referrers","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#129-978c8e802e19","input":" def add_translationname(self, trname):\n \"\"\"Add new translation by item name for an item.\"\"\"\n if self.connection:\n for item in self.find_item_name([trname[0], '0']):\n self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (\"%s\", \"%s\", \"%s\")' % (item[0], trname[1], trname[2]))\n self.connection.commit()","target":" def add_translationname(self, trname):\n \"\"\"Add new translation by item name for an item.\"\"\"\n if self.connection:\n for item in self.find_item_name([trname[0], '0']):\n t = (item[0], trname[1], trname[2], )\n self.cursor.execute('insert into itemtranslation (itemid, itemlanguageid, translation) values (?, ?, ?)', t)\n self.connection.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_translationname","file_name":"ecosldb/ecosldb.py","commit_link":"github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#130-5b17d184e032","input":" @staticmethod\n def get_max_task_id_for_project(project_id: int):\n \"\"\"Gets the nights task id currently in use on a project\"\"\"\n sql = \"\"\"select max(id) from tasks where project_id = {0} GROUP BY project_id\"\"\".format(project_id)\n result = db.engine.execute(sql)\n if result.rowcount == 0:\n raise NotFound()\n for row in result:\n return row[0]","target":" @staticmethod\n def get_max_task_id_for_project(project_id: int):\n \"\"\"Gets the nights task id currently in use on a project\"\"\"\n sql = \"\"\"select max(id) from tasks where project_id = :project_id GROUP BY project_id\"\"\"\n result = db.engine.execute(text(sql), project_id=project_id)\n if result.rowcount == 0:\n raise NotFound()\n for row in result:\n return row[0]","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_max_task_id_for_project","file_name":"server/models/postgis/task.py","commit_link":"github.com/hotosm/tasking-manager/commit/dee040a2d22b3c4d5e38e2dbf8c6b651ad4c241a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#131-01c22c89c62d","input":"def findNPC(race, classe, sex,level):\n\tc, conn = getConnection()\n\tdate = now()\n\t#select image, SUM(legit) as l FROM npc WHERE race='Elf' AND class='Bard' AND sex='Male' GROUP BY image HAVING l>5 ORDER BY SUM(legit) DESC;\n\tc.execute(\"select image, avg(legit) as l FROM npc WHERE race='\"+race+\"' AND class='\"+classe+\"' AND sex='\"+sex+\"' GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC;\")\n\tconn.commit()\n\tout = c.fetchmany(5)\n\tconn.close()\n\treturn out","target":"def findNPC(race, classe, sex,level):\n\tc, conn = getConnection()\n\tdate = now()\n\t#select image, SUM(legit) as l FROM npc WHERE race='Elf' AND class='Bard' AND sex='Male' GROUP BY image HAVING l>5 ORDER BY SUM(legit) DESC;\n\tc.execute(\"select image, avg(legit) as l FROM npc WHERE race=(?) AND class=(?) AND sex=(?) GROUP BY image HAVING l > 5 ORDER BY SUM(legit) DESC\",(race,classe,sex))\n\tconn.commit()\n\tout = c.fetchmany(5)\n\tconn.close()\n\treturn out","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"findNPC","file_name":"database.py","commit_link":"github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#132-3599b0965d3c","input":"@mod.route('/edit/', methods=['GET', 'POST'])\ndef edit(msg_id):\n m = None\n if request.method == 'GET':\n sql = \"SELECT * FROM message where msg_id = %d;\" % (msg_id)\n cursor.execute(sql)\n m = cursor.fetchone()\n return render_template('message/edit.html', m=m, msg_id=msg_id)\n\n if request.method == 'POST':\n content = request.form['content']\n sql = \"UPDATE message SET content = '%s' where msg_id = '%d';\" \\\n % (content, msg_id)\n cursor.execute(sql)\n conn.commit()\n flash('Edit Success!')\n return redirect(url_for('show_entries'))\n\n return render_template('message/edit.html', m=m, msg_id=msg_id)","target":"@mod.route('/edit/', methods=['GET', 'POST'])\ndef edit(msg_id):\n m = None\n if request.method == 'GET':\n cursor.execute(\"SELECT * FROM message where msg_id = %s;\", (msg_id,))\n m = cursor.fetchone()\n return render_template('message/edit.html', m=m, msg_id=msg_id)\n\n if request.method == 'POST':\n content = request.form['content']\n cursor.execute(\"UPDATE message SET content = %s where msg_id = %s;\", (content, msg_id))\n conn.commit()\n flash('Edit Success!')\n return redirect(url_for('show_entries'))\n\n return render_template('message/edit.html', m=m, msg_id=msg_id)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"edit","file_name":"flaskr/flaskr/views/message.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#133-f284645044bb","input":" def add_input(self,data):\n connection = self.connect()\n\n try:\n query = \"INSERT INTO crimes (description) VALUES ('{}');\".format(data)\n with connection.cursor() as cursor:\n cursor.execute(query)\n connection.commit()\n finally:\n connection.close()","target":" def add_input(self,data):\n connection = self.connect()\n\n try:\n query = \"INSERT INTO crimes (description) VALUES (%s);\"\n with connection.cursor() as cursor:\n cursor.execute(query,data)\n connection.commit()\n finally:\n connection.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/sgnab/crime-map-app/commit/209b23bad13594c9cdf18d8788fcba7c8f68d37b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#134-6815b513f87c","input":" def fetch_resultSet(self, session, id):\n self._openContainer(session)\n\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = (\"SELECT class, data FROM %s WHERE identifier = '%s';\" %\n (self.table, sid)\n )\n res = self._query(query)\n try:\n rdict = res.dictresult()[0]\n except IndexError:\n raise ObjectDoesNotExistException('%s/%s' % (self.id, sid))\n\n data = rdict['data']\n try:\n ndata = pg.unescape_bytea(data)\n except:\n # Insufficient PyGreSQL version\n ndata = data.replace(\"\\\\'\", \"'\")\n\n ndata = ndata.replace('\\\\000', '\\x00')\n ndata = ndata.replace('\\\\012', '\\n')\n # data is res.dictresult()\n cl = rdict['class']\n rset = dynamic.buildObject(session, cl, [[]])\n rset.deserialize(session, ndata)\n rset.id = id\n\n # Update expires\n now = time.time()\n nowStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(now))\n expires = now + self.get_default(session, 'expires', 600)\n rset.timeExpires = expires\n expiresStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(expires))\n\n query = (\"UPDATE %s SET timeAccessed = '%s', expires = '%s' \"\n \"WHERE identifier = '%s';\" %\n (self.table, nowStr, expiresStr, sid)\n )\n self._query(query)\n return rset","target":" def fetch_resultSet(self, session, id):\n self._openContainer(session)\n\n sid = str(id)\n if (self.idNormalizer is not None):\n sid = self.idNormalizer.process_string(session, sid)\n query = (\"SELECT class, data FROM %s WHERE identifier = $1;\" %\n (self.table)\n )\n res = self._query(query, sid)\n try:\n rdict = res.dictresult()[0]\n except IndexError:\n raise ObjectDoesNotExistException('%s/%s' % (self.id, sid))\n\n data = rdict['data']\n try:\n ndata = pg.unescape_bytea(data)\n except:\n # Insufficient PyGreSQL version\n ndata = data.replace(\"\\\\'\", \"'\")\n\n ndata = ndata.replace('\\\\000', '\\x00')\n ndata = ndata.replace('\\\\012', '\\n')\n # data is res.dictresult()\n cl = rdict['class']\n rset = dynamic.buildObject(session, cl, [[]])\n rset.deserialize(session, ndata)\n rset.id = id\n\n # Update expires\n now = time.time()\n nowStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(now))\n expires = now + self.get_default(session, 'expires', 600)\n rset.timeExpires = expires\n expiresStr = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(expires))\n\n query = (\"UPDATE %s SET timeAccessed = $1, expires = $2 \"\n \"WHERE identifier = $3;\" % (self.table)\n )\n self._query(query, nowStr, expiresStr, sid)\n return rset","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"fetch_resultSet","file_name":"cheshire3/sql/resultSetStore.py","commit_link":"github.com/cheshire3/cheshire3/commit/d350363b4ea10f102c24c8f26d7b76b006323e8e","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#135-779c261cbe66","input":"def init_user(username, chat_id):\n conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\users\\\\\" + username + '.db')\n conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n cursor = conn.cursor()\n cursor2 = conn2.cursor()\n cursor.execute(\"CREATE TABLE result (problem INTEGER, diff STRING, verdict STRING)\")\n cursor2.execute(\"SELECT * FROM problems\")\n x = cursor2.fetchone()\n while x != None:\n cursor.execute(\"insert into result values (?, ?, ? )\", (x[0], x[1], \"NULL\"))\n x = cursor2.fetchone()\n\n url = 'http://codeforces.com/submissions/' + username\n r = requests.get(url)\n max_page = 1\n soup = BeautifulSoup(r.text, \"lxml\")\n\n for link in soup.find_all(attrs={\"class\": \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[4]))\n\n old = \"\"\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/0')\n soup = BeautifulSoup(r.text, \"lxml\")\n last_try = soup.find(attrs={\"class\":\"status-small\"})\n if not last_try == None:\n last_try = str(last_try).split()\n last_try = str(last_try[2]) + str(last_try[3])\n\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n count = 0\n ver = soup.find_all(attrs={\"class\": \"submissionVerdictWrapper\"})\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5:\n s2 = str(ver[count]).split()\n s2 = s2[5].split('\\\"')\n count += 1\n cursor.execute(\"select * from result where problem = '\" + s[3] + \"'and diff = '\" + s[4] + \"'\")\n x = cursor.fetchone()\n if s2[1] == 'OK' and x != None:\n cursor.execute(\"update result set verdict = '\" + s2[1] + \"' where problem = '\" + s[3] + \"' and diff = '\" + s[4] + \"'\")\n if x != None and x[2] != 'OK':\n cursor.execute(\"update result set verdict = '\" + s2[1] +\"' where problem = '\" + s[3] + \"' and diff = '\" + s[4] + \"'\")\n\n conn.commit()\n conn.close()\n conn2.close()\n\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from last_update_problemset\")\n last_problem = conn.fetchone()\n conn.execute(\"select * from users where chat_id = '\" + str(chat_id) + \"'\")\n x = conn.fetchone()\n if x == None:\n conn.execute(\"insert into users values (?, ?, ?, ?, ?)\", (chat_id, username, str(last_try), str(last_problem[0]), 1))\n else:\n conn.execute(\"update users set username = '\" + str(username) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set last_update = '\" + str(last_try) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set last_problem = '\" + str(last_problem[0]) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n conn.execute(\"update users set state = '\" + str(1) + \"' where chat_id = '\" + str(chat_id) + \"'\")\n settings.commit()\n settings.close()","target":"def init_user(username, chat_id):\n conn = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\users\\\\\" + username + '.db')\n conn2 = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + '\\\\cf.db')\n cursor = conn.cursor()\n cursor2 = conn2.cursor()\n cursor.execute(\"CREATE TABLE result (problem INTEGER, diff STRING, verdict STRING)\")\n cursor2.execute(\"SELECT * FROM problems\")\n x = cursor2.fetchone()\n while x != None:\n cursor.execute(\"insert into result values (?, ?, ? )\", (x[0], x[1], \"NULL\"))\n x = cursor2.fetchone()\n\n url = 'http://codeforces.com/submissions/' + username\n r = requests.get(url)\n max_page = 1\n soup = BeautifulSoup(r.text, \"lxml\")\n\n for link in soup.find_all(attrs={\"class\": \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[4]))\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/0')\n soup = BeautifulSoup(r.text, \"lxml\")\n last_try = soup.find(attrs={\"class\":\"status-small\"})\n if not last_try == None:\n last_try = str(last_try).split()\n last_try = str(last_try[2]) + str(last_try[3])\n\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/submissions/' + username + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n count = 0\n ver = soup.find_all(attrs={\"class\": \"submissionVerdictWrapper\"})\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5:\n s2 = str(ver[count]).split()\n s2 = s2[5].split('\\\"')\n count += 1\n cursor.execute(\"select * from result where problem = ? and diff = ?\", (s[3], s[4]))\n x = cursor.fetchone()\n if s2[1] == 'OK' and x != None:\n cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n if x != None and x[2] != 'OK':\n cursor.execute(\"update result set verdict = ? where problem = ? and diff = ?\", (s2[1], s[3], s[4]))\n conn.commit()\n conn.close()\n conn2.close()\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"select * from last_update_problemset\")\n last_problem = conn.fetchone()\n conn.execute(\"select * from users where chat_id = ?\", (str(chat_id),))\n x = conn.fetchone()\n if x == None:\n conn.execute(\"insert into users values (?, ?, ?, ?, ?)\", (chat_id, username, str(last_try), str(last_problem[0]), 1))\n else:\n conn.execute(\"update users set username = ? where chat_id = ?\", (str(username), str(chat_id)))\n conn.execute(\"update users set last_update = ? where chat_id = ?\", (str(last_try), str(chat_id)))\n conn.execute(\"update users set last_problem = ? where chat_id = ?\", (str(last_problem[0]), str(chat_id)))\n conn.execute(\"update users set state = ? where chat_id = ?\", (str(1), str(chat_id)))\n settings.commit()\n settings.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"init_user","file_name":"bases/createuserbase.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#136-4ff3871df1be","input":"def process_vote(target,action,chan,mask,db,notice,conn):\n if ' ' in target: \n notice('Invalid nick')\n return\n\n try: votes2kick = database.get(db,'channels','votekick','chan',chan)\n except: votes2kick = 10\n try: votes2ban = database.get(db,'channels','voteban','chan',chan)\n except: votes2ban = 10\n\n if len(target) is 0:\n if action is 'kick': notice('Votes required to kick: {}'.format(votes2kick))\n elif action is 'ban': notice('Votes required to ban: {}'.format(votes2ban))\n return\n\n votefinished = False\n global db_ready\n if not db_ready: db_init(db)\n chan = chan.lower()\n target = target.lower()\n voter = user.format_hostmask(mask)\n voters = db.execute(\"SELECT voters FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target)).fetchone()\n\n if conn.nick.lower() in target: return \"I dont think so Tim.\"\n\n if voters: \n voters = voters[0]\n if voter in voters: \n notice(\"You have already voted.\")\n return\n else:\n voters = '{} {}'.format(voters,voter).strip()\n notice(\"Thank you for your vote!\")\n else: \n voters = voter\n\n votecount = len(voters.split(' '))\n\n if 'kick' in action: \n votemax = int(votes2kick)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"KICK {} {} :{}\".format(chan, target, \"You have been voted off the island.\"))\n if 'ban' in action:\n votemax = int(votes2ban)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"MODE {} +b {}\".format(chan, user.get_hostmask(target,db)))\n conn.send(\"KICK {} {} :\".format(chan, target, \"You have been voted off the island.\"))\n \n if votefinished: db.execute(\"DELETE FROM votes where chan='{}' and action='{}' and target like '{}'\".format(chan,action,target))\n else: db.execute(\"insert or replace into votes(chan, action, target, voters, time) values(?,?,?,?,?)\", (chan, action, target, voters, time.time()))\n \n db.commit()\n return (\"Votes to {} {}: {}/{}\".format(action, target, votecount,votemax))","target":"def process_vote(target,action,chan,mask,db,notice,conn):\n if ' ' in target: \n notice('Invalid nick')\n return\n\n try: votes2kick = database.get(db,'channels','votekick','chan',chan)\n except: votes2kick = 10\n try: votes2ban = database.get(db,'channels','voteban','chan',chan)\n except: votes2ban = 10\n\n if len(target) is 0:\n if action is 'kick': notice('Votes required to kick: {}'.format(votes2kick))\n elif action is 'ban': notice('Votes required to ban: {}'.format(votes2ban))\n return\n\n votefinished = False\n global db_ready\n if not db_ready: db_init(db)\n chan = chan.lower()\n target = target.lower()\n voter = user.format_hostmask(mask)\n voters = db.execute(\"SELECT voters FROM votes where chan=? and action=? and target like ?\", chan, action, target).fetchone()\n\n if conn.nick.lower() in target: return \"I dont think so Tim.\"\n\n if voters: \n voters = voters[0]\n if voter in voters: \n notice(\"You have already voted.\")\n return\n else:\n voters = '{} {}'.format(voters,voter).strip()\n notice(\"Thank you for your vote!\")\n else: \n voters = voter\n\n votecount = len(voters.split(' '))\n\n if 'kick' in action: \n votemax = int(votes2kick)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"KICK {} {} :{}\".format(chan, target, \"You have been voted off the island.\"))\n if 'ban' in action:\n votemax = int(votes2ban)\n if votecount >= votemax:\n votefinished = True\n conn.send(\"MODE {} +b {}\".format(chan, user.get_hostmask(target,db)))\n conn.send(\"KICK {} {} :\".format(chan, target, \"You have been voted off the island.\"))\n \n if votefinished: db.execute(\"DELETE FROM votes where chan=? and action=? and target like ?\", chan, action, target)\n else: db.execute(\"insert or replace into votes(chan, action, target, voters, time) values(?,?,?,?,?)\", (chan, action, target, voters, time.time()))\n \n db.commit()\n return (\"Votes to {} {}: {}/{}\".format(action, target, votecount,votemax))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"process_vote","file_name":"plugins/vote.py","commit_link":"github.com/gstack/uguubot/commit/700ff40be84be88964e61f8ae780564e5862460d","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#137-eb6d2b3ef725","input":"@mod.route('/like/', methods=['GET', 'POST'])\ndef like(msg_id):\n if request.method == 'GET':\n user_id = session['logged_id']\n c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n sql = \"INSERT INTO like_msg(msg_id, user_id,c_time) \" + \\\n \"VALUES(%d,'%s','%s');\" % (msg_id, user_id, c_time)\n cursor.execute(sql)\n conn.commit()\n return redirect(url_for('show_entries'))","target":"@mod.route('/like/', methods=['GET', 'POST'])\ndef like(msg_id):\n if request.method == 'GET':\n user_id = session['logged_id']\n c_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\n cursor.execute(\"INSERT INTO like_msg(msg_id, user_id,c_time) VALUES(%s,%s,%s);\", (msg_id, user_id, c_time))\n conn.commit()\n return redirect(url_for('show_entries'))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"like","file_name":"flaskr/flaskr/views/like_msg.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#138-8ef7ae917c04","input":" def tag_to_tag_num(self, tag):\n ''' Returns tag_num given tag. '''\n\n q = \"SELECT rowid FROM tags WHERE tag = '\" + tag + \"'\"\n self.query(q)\n return self.c.fetchone()[0]","target":" def tag_to_tag_num(self, tag):\n ''' Returns tag_num given tag. '''\n\n q = \"SELECT rowid FROM tags WHERE tag = ?\"\n self.query(q, tag)\n return self.c.fetchone()[0]","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"tag_to_tag_num","file_name":"modules/query_lastfm.py","commit_link":"github.com/pukkapies/urop2019/commit/3ca2e2c291d2d5fe262d20a8e0520bdfb622432b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#139-10b4c5e0bb61","input":"def update_history_and_sourcebyinstitution(conn, sqlite, k10plus, ai):\n \"\"\"\n Get all current sources and title numbers from Solr and log them into database.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n current_institutions = get_all_current_institutions(k10plus, ai)\n old_sourcebyinstitutions = get_all_old_sourcebyinstitutions(conn, sqlite)\n current_sourcebyinstitutions = []\n\n for source in current_sources:\n\n for institution in current_institutions:\n\n if not institution or institution == \" \" or '\"' in institution:\n continue\n\n sourcebyinstitution = \"SID \" + str(source) + \" (\" + institution + \")\"\n current_sourcebyinstitutions.append(sourcebyinstitution)\n\n params = {\n \"q\": 'source_id:%s AND institution:\"%s\"' % (source, institution),\n \"rows\": 0,\n \"wt\": \"json\"\n }\n\n # check k10plus\n result = get_solr_result(k10plus, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:\n sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n sqlite.execute(sql)\n conn.commit()\n else:\n # check ai\n result = get_solr_result(ai, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:\n # TODO: escape via sqlite\n sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (\"%s\", %s)' % (sourcebyinstitution, number)\n sqlite.execute(sql)\n conn.commit()\n\n if sourcebyinstitution not in old_sourcebyinstitutions:\n logging.info(\"The %s is now connected to SID %s.\", institution, source)\n sql = \"INSERT INTO sourcebyinstitution (sourcebyinstitution) VALUES ('%s')\" % sourcebyinstitution\n sqlite.execute(sql)\n conn.commit()\n\n if number != 0:\n old_sourcebyinstitution_number = get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution)\n if number < old_sourcebyinstitution_number:\n message = \"Die Anzahl der Titel hat sich bei %s gegenueber einem frueheren Import verringert.\" % (sourcebyinstitution)\n send_message(message)\n\n # requests.exceptions.ConnectionError: HTTPConnectionPool(XXXXXX): Max retries exceeded\n time.sleep(0.25)\n\n for old_sourcebyinstitution in old_sourcebyinstitutions:\n if old_sourcebyinstitution not in current_sourcebyinstitutions:\n message = \"Die %s ist nicht laenger für die SID %s angesigelt.\" % (institution, source)\n send_message(message)","target":"def update_history_and_sourcebyinstitution(conn, sqlite, k10plus, ai):\n \"\"\"\n Get all current sources and title numbers from Solr and log them into database.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n current_institutions = get_all_current_institutions(k10plus, ai)\n old_sourcebyinstitutions = get_all_old_sourcebyinstitutions(conn, sqlite)\n current_sourcebyinstitutions = []\n\n for source in current_sources:\n\n for institution in current_institutions:\n\n if not institution or institution == \" \" or '\"' in institution:\n continue\n\n sourcebyinstitution = \"SID \" + str(source) + \" (\" + institution + \")\"\n current_sourcebyinstitutions.append(sourcebyinstitution)\n\n params = {\n \"q\": 'source_id:%s AND institution:\"%s\"' % (source, institution),\n \"rows\": 0,\n \"wt\": \"json\"\n }\n\n # check k10plus\n result = get_solr_result(k10plus, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:\n sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (?, ?)'\n sqlite.execute(sql, (sourcebyinstitution, number))\n conn.commit()\n else:\n # check ai\n result = get_solr_result(ai, params)\n number = result[\"response\"][\"numFound\"]\n if number != 0:\n # TODO: escape via sqlite\n sql = 'INSERT INTO history (sourcebyinstitution, titles) VALUES (?, ?)'\n sqlite.execute(sql, (sourcebyinstitution, number))\n conn.commit()\n\n if sourcebyinstitution not in old_sourcebyinstitutions:\n logging.info(\"The %s is now connected to SID %s.\", institution, source)\n sql = \"INSERT INTO sourcebyinstitution (sourcebyinstitution) VALUES (?)\"\n sqlite.execute(sql, (sourcebyinstitution))\n conn.commit()\n\n if number != 0:\n old_sourcebyinstitution_number = get_old_sourcebyinstitution_number(conn, sqlite, sourcebyinstitution)\n if number < old_sourcebyinstitution_number:\n message = \"Die Anzahl der Titel hat sich bei %s gegenueber einem frueheren Import verringert.\" % (sourcebyinstitution)\n send_message(message)\n\n # requests.exceptions.ConnectionError: HTTPConnectionPool(XXXXXX): Max retries exceeded\n time.sleep(0.25)\n\n for old_sourcebyinstitution in old_sourcebyinstitutions:\n if old_sourcebyinstitution not in current_sourcebyinstitutions:\n message = \"Die %s ist nicht laenger für die SID %s angesigelt.\" % (institution, source)\n send_message(message)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"update_history_and_sourcebyinstitution","file_name":"bin/solrcheckup.py","commit_link":"github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#140-83d4de462eb9","input":" def change_message(self, new_message, logged_user):\n update_sql = \"\"\"\n UPDATE Clients\n SET message = '{}'\n WHERE client_id = '{}'\n \"\"\".format(new_message, logged_user.get_client_id())\n\n cursor = self.__conn.cursor()\n\n cursor.execute(update_sql)\n self.__conn.commit()\n logged_user.set_message(new_message)","target":" def change_message(self, new_message, logged_user):\n update_sql = \"\"\"\n UPDATE Clients\n SET message = ?\n WHERE client_id = ?\n \"\"\"\n\n cursor = self.__conn.cursor()\n\n cursor.execute(update_sql, (new_message, logged_user.get_client_id()))\n self.__conn.commit()\n logged_user.set_message(new_message)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"change_message","file_name":"Week_9/sql_manager.py","commit_link":"github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#141-ed1d1bb0d18f","input":" def create_event(self, title, start_time, time_zone, server_id, description):\n sql = \"\"\"INSERT INTO events (title, start_time, time_zone, server_id, description)\n VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')\n \"\"\".format(title, start_time, time_zone, server_id, description)\n self.cur.execute(sql)\n self.conn.commit()","target":" def create_event(self, title, start_time, time_zone, server_id, description):\n sql = \"\"\"\n INSERT INTO events (title, start_time, time_zone, server_id, description)\n VALUES (%s, %s, %s, %s, %s)\n \"\"\"\n self.cur.execute(sql, (title, start_time, time_zone, server_id, description))\n self.conn.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"create_event","file_name":"db/dbase.py","commit_link":"github.com/jgayfer/spirit/commit/01c846c534c8d3cf6763f8b7444a0efe2caa3799","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#142-769f57666923","input":"@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)\ndef get_login2(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n if bases.createuserbase.check_username(message.text):\n bot.send_message(message.chat.id, \"Invalid handle.\")\n set_state(message.chat.id, config.States.S_START.value)\n return 0\n\n conn.execute(\"select * from users where chat_id = '\" + str(message.chat.id) + \"'\")\n name = conn.fetchone()\n settings.close()\n bases.update.cf_update()\n bases.createuserbase.clean_base(name[1])\n bases.createuserbase.clean_base(message.text)\n bot.send_message(message.chat.id, \"Creating base...\")\n bases.createuserbase.init_user(message.text, message.chat.id)\n bot.send_message(message.chat.id, \"Done!\")\n set_state(message.chat.id, config.States.S_START.value)","target":"@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)\ndef get_login2(message):\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\bases\\\\settings.db\")\n conn = settings.cursor()\n if bases.createuserbase.check_username(message.text):\n bot.send_message(message.chat.id, \"Invalid handle.\")\n set_state(message.chat.id, config.States.S_START.value)\n return 0\n conn.execute(\"select * from users where chat_id = ?\", (str(message.chat.id),))\n name = conn.fetchone()\n settings.close()\n bases.update.cf_update()\n bases.createuserbase.clean_base(name[1])\n bases.createuserbase.clean_base(message.text)\n bot.send_message(message.chat.id, \"Creating base...\")\n bases.createuserbase.init_user(message.text, message.chat.id)\n bot.send_message(message.chat.id, \"Done!\")\n set_state(message.chat.id, config.States.S_START.value)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_login2","file_name":"bot.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#143-faa8f5365ec1","input":"def get_bracket_graph_data(db, tag):\n # First, we have to find out which scenes this player has brackets in\n sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{}'\".format(tag)\n scenes = db.exec(sql)\n scenes = [s[0] for s in scenes]\n\n bracket_placings_by_scene = {s: get_bracket_placings_in_scene(db, s, tag) for s in scenes}\n\n return bracket_placings_by_scene","target":"def get_bracket_graph_data(db, tag):\n # First, we have to find out which scenes this player has brackets in\n sql = \"SELECT DISTINCT scene FROM ranks WHERE player='{tag}'\"\n args = {'tag': tag}\n scenes = db.exec(sql, args)\n scenes = [s[0] for s in scenes]\n\n bracket_placings_by_scene = {s: get_bracket_placings_in_scene(db, s, tag) for s in scenes}\n\n return bracket_placings_by_scene","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_bracket_graph_data","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#144-aacd766e8705","input":" def get(self, email):\n \"\"\" Fetch data for admin with the corresponding email \"\"\"\n return database_utilities.execute_query(f\"\"\"select * from admins where email = '{email}'\"\"\")","target":" def get(self, email):\n \"\"\" Fetch data for admin with the corresponding email \"\"\"\n return database_utilities.execute_query(f\"\"\"select * from admins where email = %s\"\"\", (email, ))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get","file_name":"apis/admins.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#145-59731aa4b3d4","input":"def insertUsage(user, command):\n\tc, conn = getConnection()\n\tdate = now()\n\tc.execute(\"INSERT INTO usage (date,user,command) VALUES ('\"+date+\"','\"+str(user)+\"','\"+command+\"')\")\n\tconn.commit()\n\tconn.close()","target":"def insertUsage(user, command):\n\tc, conn = getConnection()\n\tdate = now()\n\tc.execute(\"INSERT INTO usage (date,user,command) VALUES (?,?,?)\",(date,str(user),command))\n\tconn.commit()\n\tconn.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"insertUsage","file_name":"database.py","commit_link":"github.com/DangerBlack/DungeonsAndDragonsMasterBot/commit/63f980c6dff746f5fcf3005d0646b6c24f81cdc0","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#146-cb6f56984dbe","input":" def verify_email(self, member):\n query = \"SELECT COUNT(email) FROM members WHERE email = '{email}'\".format(email = member)\n self.cursor.execute(query)\n result = self.cursor.fetchone()\n if (int(result[0]) > 0):\n return True \n else:\n return False","target":" def verify_email(self, member):\n self.cursor.execute(\"SELECT COUNT(email) FROM members WHERE email = ':email'\", {'email':member})\n result = self.cursor.fetchone()\n if (int(result[0]) > 0):\n return True \n else:\n return False","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"verify_email","file_name":"book_rides/book_rides.py","commit_link":"github.com/kenboo98/291-Mini-Project-I/commit/3080ccb687c79c83954ce703faee8fcceec8c9eb","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#147-f53b171ae350","input":" def get_previous_yields(self, inverter_serial):\n query = '''\n SELECT TimeStamp, EToday, ETotal\n FROM Inverters\n WHERE Serial = '%s'\n ''' % (inverter_serial)\n self.c.execute(query)\n data = self.c.fetchone()\n return data[0], data[1], data[2]","target":" def get_previous_yields(self, inverter_serial):\n query = '''\n SELECT TimeStamp, EToday, ETotal\n FROM Inverters\n WHERE Serial=?\n '''\n self.c.execute(query, (inverter_serial,))\n data = self.c.fetchone()\n return data[0], data[1], data[2]","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_previous_yields","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#148-5323a3c85084","input":"@app.route('/referrer_count')\ndef referrer_count():\n account_id = request.args.get('account_id')\n\n if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n\n account_id = j_l[\"result\"][0][\"id\"]\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"select count(*) from referrers where referrer='\"+account_id+\"'\"\n cur.execute(query)\n results = cur.fetchone()\n\n return jsonify(results)","target":"@app.route('/referrer_count')\ndef referrer_count():\n account_id = request.args.get('account_id')\n\n if not isObject(account_id):\n ws.send('{\"id\":1, \"method\":\"call\", \"params\":[0,\"lookup_account_names\",[[\"' + account_id + '\"], 0]]}')\n result_l = ws.recv()\n j_l = json.loads(result_l)\n\n account_id = j_l[\"result\"][0][\"id\"]\n\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"select count(*) from referrers where referrer=%s\"\n cur.execute(query, (account_id,))\n results = cur.fetchone()\n\n return jsonify(results)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"referrer_count","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#149-1317b1b9bc35","input":" def analyze_scene(self, scene):\n base_urls = scene.get_base_urls()\n users = scene.get_users()\n name = scene.get_name()\n LOG.info('found the following users for scene {}: {}'.format(name, users))\n\n # This scene might have one user who always posts the brackets on their challonge account\n for user in users:\n # Have we analyzed this user before?\n sql = \"SELECT * FROM user_analyzed WHERE user='{}';\".format(user)\n results = self.db.exec(sql)\n\n # Did we have any matches in the database?\n if len(results) > 0:\n # We have analyzed this user before. Just grab one page of brackets to see if there have been any new tournaments\n # eg, just look at /users/christmasmike?page=1 instead of all the pages that exist\n most_recent_page = bracket_utils.get_brackets_from_user(user, pages=1)\n for bracket in most_recent_page:\n LOG.info('here are the brackets from the most recent page of user {}: {}'.format(user, most_recent_page))\n # This user has already been analyzed, there's a good chance this bracket has been analyzed also\n sql = \"SELECT * FROM user_analyzed WHERE url='{}' AND user='{}';\".format(bracket, user)\n results = self.db.exec(sql)\n\n if len(results) == 0:\n # This is a new bracket that must have been published in the last hour or so\n LOG.info('found this url from a user: {} {}'.format(bracket, user))\n display_name = bracket_utils.get_display_base(bracket)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name)\n\n # mark this bracket as analyzed\n sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{}', '{}', '{}');\".format(bracket, user, name)\n self.db.exec(sql)\n\n # Tweet that we found a new bracket\n msg = \"Found new {} bracket: {}\".format(name, bracket)\n tweet(msg)\n else:\n LOG.info('url {} is not new for user {}'.format(bracket, user))\n else:\n # This is a new user, analyze all brackets\n user_urls = bracket_utils.get_brackets_from_user(user)\n for url in user_urls:\n LOG.info('found this url from a user: {} {}'.format(url, user))\n display_name = bracket_utils.get_display_base(url)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(url, name, display_name)\n\n # mark this bracket as analyzed\n sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{}', '{}', '{}');\".format(url, user, name)\n self.db.exec(sql)\n\n LOG.info('done with user {}'.format(user))\n\n\n # This scene might always call their brackets the same thing, eg weekly1, weekly2, weekly3 etc\n for base_url in base_urls:\n # attempt to load this data from the database\n LOG.info('About to start this analysis thread for scene {}'.format(scene.get_name()))\n sql = \"SELECT first,last FROM valids WHERE base_url = '\" + str(base_url) + \"';\"\n result = self.db.exec(sql)\n has_results = len(result) > 0 \n\n # Did we find a match in the database?\n if has_results:\n LOG.info(\"validURLs found values in the database\" + str(result))\n first = result[0][0]\n last = result[0][1]\n\n # Check for a new valid URL\n new_last = bracket_utils._get_last_valid_url(base_url, last-1)\n\n if not new_last == last:\n if new_last - last > 5:\n with open(\"DEBUGOUTPUT.txt\", 'a') as f:\n f.write(\"[validURLs.py:55]: found a SHIT TON of new tournaments for bracket: {}\".format(base_url))\n\n else:\n bracket = base_url.replace('###', str(new_last))\n LOG.info('Found new bracket: {}'.format(bracket))\n msg = \"Found new bracket: {}\".format(bracket)\n tweet(msg)\n\n # If there's been a new last, update the database\n sql = \"UPDATE valids SET last=\" + str(new_last) + \" where base_url = '\"+str(base_url)+\"';\"\n self.db.exec(sql)\n\n\n # Analyze each of these new brackets\n for i in range(last+1, new_last+1):\n # Since this URL is new, we have to process the data\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name, new_bracket=True)\n\n else:\n # We need to create first and last from scratch\n first = bracket_utils._get_first_valid_url(base_url)\n last = bracket_utils._get_last_valid_url(base_url, first)\n\n # This is new data, we need to put it into the db\n sql = \"INSERT INTO valids (base_url, first, last, scene) VALUES (\"\n sql += \"'\"+str(base_url)+\"', \"+str(first)+ \", \"+str(last)+\", '\"+str(name)+\"');\"\n self.db.exec(sql)\n\n for i in range(first, last+1):\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name)\n\n # Calculate ranks after each tournament so we can see how players are progressing\n if not analyzed_scenes and should_tweet:\n tweet('About to start ranking for scene {}'.format(name))\n self.data_processor.check_and_update_ranks(name)","target":" def analyze_scene(self, scene):\n base_urls = scene.get_base_urls()\n users = scene.get_users()\n name = scene.get_name()\n LOG.info('found the following users for scene {}: {}'.format(name, users))\n\n # This scene might have one user who always posts the brackets on their challonge account\n for user in users:\n # Have we analyzed this user before?\n sql = \"SELECT * FROM user_analyzed WHERE user='{user}';\"\n args = {'user': user}\n results = self.db.exec(sql, args)\n\n # Did we have any matches in the database?\n if len(results) > 0:\n # We have analyzed this user before. Just grab one page of brackets to see if there have been any new tournaments\n # eg, just look at /users/christmasmike?page=1 instead of all the pages that exist\n most_recent_page = bracket_utils.get_brackets_from_user(user, pages=1)\n for bracket in most_recent_page:\n LOG.info('here are the brackets from the most recent page of user {}: {}'.format(user, most_recent_page))\n # This user has already been analyzed, there's a good chance this bracket has been analyzed also\n sql = \"SELECT * FROM user_analyzed WHERE url='{bracket}' AND user='{user}';\"\n args = {'bracket': bracket, 'user': user}\n results = self.db.exec(sql, args)\n\n if len(results) == 0:\n # This is a new bracket that must have been published in the last hour or so\n LOG.info('found this url from a user: {} {}'.format(bracket, user))\n display_name = bracket_utils.get_display_base(bracket)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name)\n\n # mark this bracket as analyzed\n sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{bracket}', '{user}', '{name}');\"\n args = {'bracket': bracket, 'user':user, 'name':name}\n self.db.exec(sql, args)\n\n # Tweet that we found a new bracket\n msg = \"Found new {} bracket: {}\".format(name, bracket)\n tweet(msg)\n else:\n LOG.info('url {} is not new for user {}'.format(bracket, user))\n else:\n # This is a new user, analyze all brackets\n user_urls = bracket_utils.get_brackets_from_user(user)\n for url in user_urls:\n LOG.info('found this url from a user: {} {}'.format(url, user))\n display_name = bracket_utils.get_display_base(url)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(url, name, display_name)\n\n # mark this bracket as analyzed\n sql = \"INSERT INTO user_analyzed (url, user, scene) VALUES ('{url}', '{user}', '{name}');\"\n args = {'url': url, 'user':user, 'name':name}\n self.db.exec(sql, args)\n\n LOG.info('done with user {}'.format(user))\n\n\n # This scene might always call their brackets the same thing, eg weekly1, weekly2, weekly3 etc\n for base_url in base_urls:\n # attempt to load this data from the database\n LOG.info('About to start this analysis thread for scene {}'.format(scene.get_name()))\n sql = \"SELECT first,last FROM valids WHERE base_url = '{base_url}';\"\n args = {'base_url': base_url}\n result = self.db.exec(sql, args)\n has_results = len(result) > 0 \n\n # Did we find a match in the database?\n if has_results:\n LOG.info(\"validURLs found values in the database\" + str(result))\n first = result[0][0]\n last = result[0][1]\n\n # Check for a new valid URL\n new_last = bracket_utils._get_last_valid_url(base_url, last-1)\n\n if not new_last == last:\n if new_last - last > 5:\n with open(\"DEBUGOUTPUT.txt\", 'a') as f:\n f.write(\"[validURLs.py:55]: found a SHIT TON of new tournaments for bracket: {}\".format(base_url))\n\n else:\n bracket = base_url.replace('###', str(new_last))\n LOG.info('Found new bracket: {}'.format(bracket))\n msg = \"Found new bracket: {}\".format(bracket)\n tweet(msg)\n\n # If there's been a new last, update the database\n sql = \"UPDATE valids SET last={new_last} where base_url='{base_url}';\"\n args = {'new_last': new_last, 'base_url': base_url}\n self.db.exec(sql, args)\n\n\n # Analyze each of these new brackets\n for i in range(last+1, new_last+1):\n # Since this URL is new, we have to process the data\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name, new_bracket=True)\n\n else:\n # We need to create first and last from scratch\n first = bracket_utils._get_first_valid_url(base_url)\n last = bracket_utils._get_last_valid_url(base_url, first)\n\n # This is new data, we need to put it into the db\n sql = \"INSERT INTO valids (base_url, first, last, scene) VALUES ('{base_url}', '{first}', '{last}', '{name}');\"\n args = {'base_url': base_url, 'first': first, 'last': last, 'name': name}\n self.db.exec(sql, args)\n\n for i in range(first, last+1):\n bracket = base_url.replace('###', str(i))\n # Create the display name for this bracket\n # Eg challonge.com/NP9ATX54 -> NP9 54\n display_name = bracket_utils.get_display_base(bracket, counter=i)\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n self.data_processor.process(bracket, name, display_name)\n\n # Calculate ranks after each tournament so we can see how players are progressing\n if not analyzed_scenes and should_tweet:\n tweet('About to start ranking for scene {}'.format(name))\n self.data_processor.check_and_update_ranks(name)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"analyze_scene","file_name":"validURLs.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#150-d0ae70bbe631","input":"def get_article(index):\n with conn.cursor(cursor_factory=DictCursor) as cur:\n query = \"SELECT * FROM articles WHERE index=\"+str(index)\n cur.execute(query)\n article = cur.fetchone()\n return article","target":"def get_article(index):\n with conn.cursor(cursor_factory=DictCursor) as cur:\n query = \"SELECT * FROM articles WHERE index=%s\"\n cur.execute(query, (index, ))\n article = cur.fetchone()\n return article","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_article","file_name":"app.py","commit_link":"github.com/sepehr125/arxiv-doc2vec-recommender/commit/f23a4c32e6192b145017f64734b0a9a384c9123a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#151-8bfb8968ccf5","input":"def create_cf_base():\n url = 'http://codeforces.com/problemset/'\n r = requests.get(url)\n max_page = 0\n soup = BeautifulSoup(r.text, \"lxml\")\n base = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\cf.db\")\n conn = base.cursor()\n conn.execute(\"create table problems (problem INTEGER, diff CHAR)\")\n for i in available_tags:\n conn.execute(\"create table \" + i + \" (problems INTEGER, diff CHAR)\")\n\n for link in soup.find_all(attrs={\"class\" : \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[3]))\n\n a = 0\n b = 0\n f = False\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/problemset/' + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n old = ''\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5 and old != s[3] + s[4]:\n a = s[3]\n b = s[4]\n old = s[3] + s[4]\n if not f:\n f = True\n last_update = old\n conn.execute(\"insert into problems values (?, ?)\", (a, b))\n if len(s) == 4 and s[3] in available_tags:\n conn.execute(\"insert into \" + s[3] + \" values (?, ?)\", (a, b))\n\n base.commit()\n base.close()\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"create table users (chat_id INTEGER, username STRING, last_update STRING, last_problem STRING, state INTEGER)\")\n conn.execute(\"create table last_update_problemset (problem STRING)\")\n conn.execute(\"insert into last_update_problemset values (?)\", (last_update, ))\n settings.commit()\n settings.close()","target":"def create_cf_base():\n url = 'http://codeforces.com/problemset/'\n r = requests.get(url)\n max_page = 0\n soup = BeautifulSoup(r.text, \"lxml\")\n base = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\cf.db\")\n conn = base.cursor()\n conn.execute(\"create table problems (problem INTEGER, diff CHAR)\")\n for i in available_tags:\n conn.execute(\"create table ? (problems INTEGER, diff CHAR)\", (i,))\n\n for link in soup.find_all(attrs={\"class\" : \"page-index\"}):\n s = link.find('a')\n s2 = s.get(\"href\").split('/')\n max_page = max(max_page, int(s2[3]))\n\n a = 0\n b = 0\n f = False\n for i in range(1, max_page + 1):\n r = requests.get('http://codeforces.com/problemset/' + '/page/' + str(i))\n soup = BeautifulSoup(r.text, \"lxml\")\n old = ''\n for link in soup.find_all('a'):\n s = link.get('href')\n if s != None and s.find('/problemset') != -1:\n s = s.split('/')\n if len(s) == 5 and old != s[3] + s[4]:\n a = s[3]\n b = s[4]\n old = s[3] + s[4]\n if not f:\n f = True\n last_update = old\n conn.execute(\"insert into problems values (?, ?)\", (a, b))\n if len(s) == 4 and s[3] in available_tags:\n conn.execute(\"insert into ? values (?, ?)\", (s[3], a, b))\n\n base.commit()\n base.close()\n settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + \"\\\\settings.db\")\n conn = settings.cursor()\n conn.execute(\"create table users (chat_id INTEGER, username STRING, last_update STRING, last_problem STRING, state INTEGER)\")\n conn.execute(\"create table last_update_problemset (problem STRING)\")\n conn.execute(\"insert into last_update_problemset values (?)\", (last_update, ))\n settings.commit()\n settings.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"create_cf_base","file_name":"bases/createcfbase.py","commit_link":"github.com/lissrbay/codeforces_bot/commit/cc7f5143445a0030b1149ac60a65b1b1b9c92a90","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#152-121b5a564d34","input":"def closeGame(ID):\n\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = %i\" % ID)\n\tdatabase.commit()","target":"def closeGame(ID):\n\tdb.execute(\"UPDATE games set Running = 'No' WHERE ID = ?\", ID)\n\tdatabase.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"closeGame","file_name":"plugins/database.py","commit_link":"github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#153-ff692efe12c8","input":" def cancelFollow(self,userid,friendid):\n sqlText=\"delete from friends where userid=%d and friendid=%d;\"%(userid,friendid)\n result=sql.deleteDB(self.conn,sqlText)\n return result;","target":" def cancelFollow(self,userid,friendid):\n sqlText=\"delete from friends where userid=%d and friendid=%s;\"\n params=[userid,friendid]\n result=sql.deleteDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"cancelFollow","file_name":"modules/users.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#154-3f53476e4249","input":" def change_pass(self, new_pass, logged_user):\n update_sql = \"\"\"\n UPDATE Clients\n SET password = '{}'\n WHERE client_id = '{}'\n \"\"\".format(new_pass, logged_user.get_client_id())\n\n cursor = self.__conn.cursor()\n\n cursor.execute(update_sql)\n self.__conn.commit()","target":" def change_pass(self, new_pass, logged_user):\n update_sql = \"\"\"\n UPDATE Clients\n SET password = ?\n WHERE client_id = ?\n \"\"\"\n\n cursor = self.__conn.cursor()\n\n cursor.execute(update_sql, (new_pass, logged_user.get_client_id()))\n self.__conn.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"change_pass","file_name":"Week_9/sql_manager.py","commit_link":"github.com/AnetaStoycheva/Programming101_HackBulgaria/commit/c0d6f4b8fe83a375832845a45952b5153e4c34f3","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#155-a938efe96c71","input":" def getCommentsByPostid(self,postid,userid):\n sqlText=\"select (select Count(*) from comment_like where comments.commentid = comment_like.commentid) as like,(select Count(*) from comment_like where comments.commentid = comment_like.commentid and comment_like.userid=%d) as flag,commentid,name,comment from users,comments where users.userid=comments.userid and postid=%d order by date desc;\"%(userid,postid)\n result=sql.queryDB(self.conn,sqlText)\n return result;","target":" def getCommentsByPostid(self,postid,userid):\n sqlText=\"select (select Count(*) from comment_like where \\\n comments.commentid = comment_like.commentid) as like,(select Count(*) \\\n from comment_like where comments.commentid = \\\n comment_like.commentid and comment_like.userid=%s) as \\\n flag,commentid,name,comment from users,comments where \\\n users.userid=comments.userid and postid=%s order by date desc;\"\n params=[userid,postid]\n result=sql.queryDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getCommentsByPostid","file_name":"modules/comment.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#156-62894e526f8a","input":" def callback(recipeName):\n menu.pack_forget()\n viewRecipeFrame.pack(expand=True, fill='both')\n groceryButton.pack_forget()\n database_file = \"meal_planner.db\"\n print(recipeName)\n with sqlite3.connect(database_file) as conn:\n cursor = conn.cursor()\n selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = \"\"\" + \"\\\"\" + recipeName + \"\\\"\")\n for result in [selection]:\n for row in result.fetchall():\n name = row[0]\n time = row[1]\n servings = row[2]\n ingredients = row[4]\n directions = row[5]\n\n string = (\"Name: {} \\n Cook time: {} \\n Number of Servings: {} \\n \".format(name, time, servings))\n secondString = (\"Ingredients: {}\".format(ingredients))\n thirdString = (\"Directions: {}\".format(directions))\n Label(viewRecipeFrame, text=string, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=secondString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=thirdString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n returnButton = Button(menuFrame, text = \"Return to Menu\", highlightbackground=\"#e7e7e7\", command=lambda: [viewRecipeFrame.pack_forget(),\n menu.pack(), returnButton.pack_forget(), label.configure(text=\"Meal Planer\"),\n groceryButton.pack(side=RIGHT)])\n returnButton.pack(side=RIGHT)","target":" def callback(recipeName):\n menu.pack_forget()\n viewRecipeFrame.pack(expand=True, fill='both')\n groceryButton.pack_forget()\n database_file = \"meal_planner.db\"\n print(recipeName)\n with sqlite3.connect(database_file) as conn:\n cursor = conn.cursor()\n selection = cursor.execute(\"\"\"SELECT * FROM recipe WHERE name = ?;\"\"\", (recipeName, ))\n for result in [selection]:\n for row in result.fetchall():\n name = row[0]\n time = row[1]\n servings = row[2]\n ingredients = row[4]\n directions = row[5]\n\n string = (\"Name: {} \\n Cook time: {} \\n Number of Servings: {} \\n \".format(name, time, servings))\n secondString = (\"Ingredients: {}\".format(ingredients))\n thirdString = (\"Directions: {}\".format(directions))\n Label(viewRecipeFrame, text=string, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=secondString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n Label(viewRecipeFrame, text=thirdString, font=MEDIUM_FONT, bg=\"#f8f8f8\", fg=\"#000000\").pack(side=TOP)\n returnButton = Button(menuFrame, text = \"Return to Menu\", highlightbackground=\"#e7e7e7\", command=lambda: [viewRecipeFrame.pack_forget(),\n menu.pack(), returnButton.pack_forget(), label.configure(text=\"Meal Planer\"),\n groceryButton.pack(side=RIGHT)])\n returnButton.pack(side=RIGHT)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"__init__.callback","file_name":"mealPlan.py","commit_link":"github.com/trishamoyer/RecipePlanner-Python/commit/44d2ce370715d9344fad34b3b749322ab095a925","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#157-d60196f172a8","input":" @jwt_required\n def patch(self, user_id):\n \"\"\" Replaces information of corresponding user_id with request body \"\"\"\n query = f\"\"\"update users set user_id = %s \"\"\"\n query += f\"\"\"where user_id = '{user_id}'\"\"\"\n json_data = request.get_json()\n parameters = (json_data['user_id'], )\n database_utilities.execute_query(query, parameters)","target":" @jwt_required\n def patch(self, user_id):\n \"\"\" Replaces information of corresponding user_id with request body \"\"\"\n query = f\"\"\"update users set user_id = %s \"\"\"\n query += f\"\"\"where user_id = %s\"\"\"\n json_data = request.get_json()\n parameters = (json_data['user_id'], user_id)\n database_utilities.execute_query(query, parameters)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"patch","file_name":"apis/users.py","commit_link":"github.com/sgosal2/tiger-boards-backend/commit/4670109dd613df2f2fe7e8403ebd149df2b55485","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#158-c5b08f85f58e","input":"@mod.route('/edit', methods=['GET', 'POST'])\ndef edit():\n sql = \"SELECT * FROM users where email = '%s';\" % (session['logged_email'])\n cursor.execute(sql)\n u = cursor.fetchone()\n if request.method == 'POST':\n sql = \"UPDATE users SET nickname = '%s' where email = '%s'\" \\\n % (request.form['nickname'], session['logged_email'])\n cursor.execute(sql)\n sql = \"SELECT * FROM users where email = '%s';\" \\\n % (session['logged_email'])\n cursor.execute(sql)\n u = cursor.fetchone()\n conn.commit()\n flash('Edit Nickname Success!')\n return render_template('users/edit.html', u=u)","target":"@mod.route('/edit', methods=['GET', 'POST'])\ndef edit():\n cursor.execute(\"SELECT * FROM users where email = %s;\", (session['logged_email'],))\n u = cursor.fetchone()\n if request.method == 'POST':\n cursor.execute(\"UPDATE users SET nickname = %s where email = %s\", (request.form['nickname'], session['logged_email']))\n cursor.execute(\"SELECT * FROM users where email = %s;\", (session['logged_email'],))\n u = cursor.fetchone()\n conn.commit()\n flash('Edit Nickname Success!')\n return render_template('users/edit.html', u=u)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"edit","file_name":"flaskr/flaskr/views/users.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#159-d0699c4ebd53","input":"def shame_add(name):\n shame = shame_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if shame is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES('{}',0,1)\n '''.format(name))\n db.commit()\n logger.debug('Inserted into karmadb 1 shame for {}'.format(name))\n db.close()\n return 1\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n\n else:\n shame = shame + 1\n try:\n cursor.execute('''\n UPDATE people SET shame = {0} WHERE name = '{1}'\n '''.format(shame, name))\n db.commit()\n logger.debug('Inserted into karmadb {} shame for {}'.format(\n shame, name))\n db.close()\n return shame\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def shame_add(name):\n shame = shame_ask(name)\n db = db_connect()\n cursor = db.cursor()\n if shame is None:\n try:\n cursor.execute('''\n INSERT INTO people(name,karma,shame) VALUES(%(name)s,0,1)\n ''', (name, ))\n db.commit()\n logger.debug('Inserted into karmadb 1 shame for {}'.format(name))\n db.close()\n return 1\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise\n\n else:\n shame = shame + 1\n try:\n cursor.execute('''\n UPDATE people SET shame = %(karma)s WHERE name = %(name)s\n ''' (\n shame,\n name,\n ))\n db.commit()\n logger.debug('Inserted into karmadb {} shame for {}'.format(\n shame, name))\n db.close()\n return shame\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"shame_add","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#160-97ca5316fd5e","input":" def can_user_pass_that_amount_of_money(self, user_id, money):\n self.cursor.execute(\"SELECT count(id) FROM kickstarter.users where id = %s and money >= %s\" % (user_id, money))\n return self.cursor.fetchall()[0][0]","target":" def can_user_pass_that_amount_of_money(self, user_id, money):\n self.cursor.execute(\"SELECT count(id) FROM kickstarter.users where id = %s and money >= %s\", (user_id, money))\n return self.cursor.fetchall()[0][0]","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"can_user_pass_that_amount_of_money","file_name":"backend/transactions/TransactionConnector.py","commit_link":"github.com/JLucka/kickstarter-dev/commit/e2ffa062697e060fdfbd2eccbb89a8c53a569e0b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#161-c2c31e5ac593","input":"@endpoints.route(\"/placings\")\ndef placings():\n if db == None:\n init()\n\n tag = request.args.get('tag', default='christmas mike')\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM placings WHERE player = '{}'\".format(tag)\n results = list(db.exec(sql))\n results.sort(key=lambda x: int(x[2]))\n\n return json.dumps(results)","target":"@endpoints.route(\"/placings\")\ndef placings():\n if db == None:\n init()\n\n tag = request.args.get('tag', default='christmas mike')\n\n # Get all the urls that this player has participated in\n sql = \"SELECT * FROM placings WHERE player = '{tag}'\"\n args = {'tag': tag}\n results = list(db.exec(sql, args))\n results.sort(key=lambda x: int(x[2]))\n\n return json.dumps(results)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"placings","file_name":"endpoints.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#162-ba9a72bb9ac5","input":"def markTokenUsedExternal(token, optStr=\"\"):\n conn, c = connectDB()\n req = \"UPDATE {} SET \\\"options_selected\\\"='{}' WHERE token='{}'\".format(CFG(\"tokens_table_name\"), \\\n optStr, token)\n c.execute(req)\n closeDB(conn)","target":"def markTokenUsedExternal(token, optStr=\"\"):\n conn, c = connectDB()\n req = \"UPDATE {} SET \\\"options_selected\\\"=? WHERE token=?\".format(CFG(\"tokens_table_name\"))\n c.execute(req, (optStr, token,))\n closeDB(conn)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"markTokenUsedExternal","file_name":"database.py","commit_link":"github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#163-a2f6b9569969","input":" def get_roster(self, server_id):\n sql = \"\"\"SELECT username, role\n FROM roles\n WHERE roles.server_id = {0};\n \"\"\".format(server_id)\n self.cur.execute(sql)\n return self.cur.fetchall()","target":" def get_roster(self, server_id):\n sql = \"\"\"\n SELECT username, role\n FROM roles\n WHERE roles.server_id = %s;\n \"\"\"\n self.cur.execute(sql, (server_id,))\n return self.cur.fetchall()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_roster","file_name":"db/dbase.py","commit_link":"github.com/jgayfer/spirit/commit/01c846c534c8d3cf6763f8b7444a0efe2caa3799","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#164-704addd83613","input":"def retrieve_video(id, playlist_id, db):\n db.execute(\"SELECT id, position from video WHERE id={id} and playlist_id={playlist_id};\".format(\n id=id, playlist_id=playlist_id))\n row = db.fetchone()\n return row","target":"def retrieve_video(id, playlist_id, db):\n db.execute(\n \"SELECT id, position from video WHERE id=%s and playlist_id=%s;\", (id, playlist_id))\n row = db.fetchone()\n return row","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"retrieve_video","file_name":"video/video_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#165-a207f8dcff0d","input":" def followFriends(self,userid,friendid):\n sqlText=\"insert into friends values(%d,%d);\"%(friendid,userid)\n result=sql.insertDB(self.conn,sqlText)\n return result;","target":" def followFriends(self,userid,friendid):\n sqlText=\"insert into friends values(%s,%s);\"\n params=[friendid,userid]\n result=sql.insertDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"followFriends","file_name":"modules/users.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#166-70853c3b7e16","input":"def getGameID(ID):\n\tdb.execute(\"SELECT * FROM games WHERE ID = %i\" % ID)\n\tID = db.fetchone()\n\treturn ID","target":"def getGameID(ID):\n\tdb.execute(\"SELECT * FROM games WHERE ID = ?\", ID)\n\tID = db.fetchone()\n\treturn ID","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getGameID","file_name":"plugins/database.py","commit_link":"github.com/iScrE4m/XLeague/commit/59cab6e5fd8bd5e47f2418a7c71cb1d4e3cad0d2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#167-f3778c74e1dc","input":"@app.route('/top_proxies')\ndef top_proxies():\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT sum(amount) FROM holders\"\n cur.execute(query)\n total = cur.fetchone()\n total_votes = total[0]\n\n query = \"SELECT voting_as FROM holders WHERE voting_as<>'1.2.5' group by voting_as\"\n cur.execute(query)\n results = cur.fetchall()\n #con.close()\n\n proxies = []\n\n for p in range(0, len(results)):\n\n proxy_line = [0] * 5\n\n proxy_id = results[p][0]\n proxy_line[0] = proxy_id\n\n query = \"SELECT account_name, amount FROM holders WHERE account_id='\"+proxy_id+\"' LIMIT 1\"\n cur.execute(query)\n proxy = cur.fetchone()\n\n try:\n proxy_name = proxy[0]\n proxy_amount = proxy[1]\n except:\n proxy_name = \"unknown\"\n proxy_amount = 0\n\n\n proxy_line[1] = proxy_name\n\n query = \"SELECT amount, account_id FROM holders WHERE voting_as='\"+proxy_id+\"'\"\n cur.execute(query)\n results2 = cur.fetchall()\n\n proxy_line[2] = int(proxy_amount)\n\n for p2 in range(0, len(results2)):\n amount = results2[p2][0]\n account_id = results2[p2][1]\n proxy_line[2] = proxy_line[2] + int(amount) # total proxy votes\n proxy_line[3] = proxy_line[3] + 1 # followers\n\n if proxy_line[3] > 2:\n percentage = float(float(proxy_line[2]) * 100.0/ float(total_votes))\n proxy_line[4] = percentage\n proxies.append(proxy_line)\n\n con.close()\n\n proxies = sorted(proxies, key=lambda k: int(k[2]))\n r_proxies = proxies[::-1]\n\n return jsonify(filter(None, r_proxies))","target":"@app.route('/top_proxies')\ndef top_proxies():\n con = psycopg2.connect(**config.POSTGRES)\n cur = con.cursor()\n\n query = \"SELECT sum(amount) FROM holders\"\n cur.execute(query)\n total = cur.fetchone()\n total_votes = total[0]\n\n query = \"SELECT voting_as FROM holders WHERE voting_as<>'1.2.5' group by voting_as\"\n cur.execute(query)\n results = cur.fetchall()\n #con.close()\n\n proxies = []\n\n for p in range(0, len(results)):\n\n proxy_line = [0] * 5\n\n proxy_id = results[p][0]\n proxy_line[0] = proxy_id\n\n query = \"SELECT account_name, amount FROM holders WHERE account_id=%s LIMIT 1\"\n cur.execute(query, (proxy_id,))\n proxy = cur.fetchone()\n\n try:\n proxy_name = proxy[0]\n proxy_amount = proxy[1]\n except:\n proxy_name = \"unknown\"\n proxy_amount = 0\n\n\n proxy_line[1] = proxy_name\n\n query = \"SELECT amount, account_id FROM holders WHERE voting_as=%s\"\n cur.execute(query, (proxy_id,))\n results2 = cur.fetchall()\n\n proxy_line[2] = int(proxy_amount)\n\n for p2 in range(0, len(results2)):\n amount = results2[p2][0]\n account_id = results2[p2][1]\n proxy_line[2] = proxy_line[2] + int(amount) # total proxy votes\n proxy_line[3] = proxy_line[3] + 1 # followers\n\n if proxy_line[3] > 2:\n percentage = float(float(proxy_line[2]) * 100.0/ float(total_votes))\n proxy_line[4] = percentage\n proxies.append(proxy_line)\n\n con.close()\n\n proxies = sorted(proxies, key=lambda k: int(k[2]))\n r_proxies = proxies[::-1]\n\n return jsonify(filter(None, r_proxies))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"top_proxies","file_name":"api.py","commit_link":"github.com/VinChain/vinchain-python-api-backend/commit/b78088a551fbb712121269c6eb7f43ede120ff60","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#168-93edba788617","input":" def userLogin(self):\n\n sqlName=\"select count(*) from users where name='%s' and \\\n password='%s';\"%(self.name,self.password)\n checkName=sql.queryDB(self.conn,sqlName)\n\n result=checkName[0][0]\n if result == 0:\n self.clean()\n return False\n else:\n return True","target":" def userLogin(self):\n\n sqlName=\"select count(*) from users where name=%s and password=%s;\"\n params = [self.name,self.password]\n checkName=sql.queryDB(self.conn,sqlName,params)\n result=checkName[0][0]\n if result == 0:\n self.clean()\n return False\n else:\n return True","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"userLogin","file_name":"modules/users.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#169-e459b0e2f2e9","input":"@app.route(\"/search\", methods = [\"POST\"])\ndef search_pages():\n search = request.form.get(\"search\")\n page = db.query(\"select title from page where title = '%s'\" % search).namedresult()\n if len(page) == 0:\n return redirect(\"/%s\" % search)\n else:\n return place_holder(search)","target":"@app.route(\"/search\", methods = [\"POST\"])\ndef search_pages():\n search = request.form.get(\"search\")\n page = db.query(\"select title from page where title = $1\", search).namedresult()\n if len(page) == 0:\n return redirect(\"/%s\" % search)\n else:\n return place_holder(search)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"search_pages","file_name":"server.py","commit_link":"github.com/jcortes0309/wiki_flask/commit/a6bf5316abe2eb528adf36c8241a013fd02c5ffa","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#170-142e3022677a","input":"def get_articles_by_subject(subject):\n with conn.cursor(cursor_factory=DictCursor) as cur:\n query = \"SELECT * FROM articles WHERE subject='\" + subject + \"' ORDER BY last_submitted DESC\"\n cur.execute(query)\n articles = cur.fetchall()\n return articles","target":"def get_articles_by_subject(subject):\n with conn.cursor(cursor_factory=DictCursor) as cur:\n query = \"SELECT * FROM articles WHERE subject=%s ORDER BY last_submitted DESC\"\n cur.execute(query, (subject,))\n articles = cur.fetchall()\n return articles","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_articles_by_subject","file_name":"app.py","commit_link":"github.com/sepehr125/arxiv-doc2vec-recommender/commit/f23a4c32e6192b145017f64734b0a9a384c9123a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#171-fa88934a0d73","input":" def getQueue(self, numberOfLinks=10):\n self.cursor.execute(\"SELECT url FROM queue WHERE visited = '0' LIMIT {};\".format(numberOfLinks))\n result = self.cursor.fetchall()\n self.remove(result)\n return result","target":" def getQueue(self, numberOfLinks=10):\n self.cursor.execute(\"SELECT url FROM queue WHERE visited = '0' LIMIT ?;\", numberOfLinks)\n result = self.cursor.fetchall()\n self.remove(result)\n return result","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getQueue","file_name":"beta/database.py","commit_link":"github.com/jappe999/WebScraper/commit/46a4e0843aa44d903293637afad53dfcbc37b480","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#172-c15dc924ece8","input":"@hook.command(autohelp=False)\ndef showPoll(pollID, db=None):\n \"\"\"Shows the answers for a given poll.\"\"\"\n if not db_ready: db_init(db)\n if pollID == None:\n poll = db.execute(\"SELECT pollID, question FROM polls WHERE active = 1\")\n if len(poll) == 0:\n reply(\"There's no poll open.\")\n return\n else:\n poll = db.execute(\"SELECT pollID, question FROM polls WHERE pollID = '{}'\".format(pollID))\n if len(poll) == 0:\n reply(\"No such poll found.\")\n return\n pollID = poll[0][0]\n question = poll[0][1]\n reply(question)\n for (index, answer, votes) in db.execute(\"SELECT 'index', answer, count(voteID) FROM answers LEFT JOIN votes ON votes.answerID = answers.answerID WHERE pollID = {} GROUP BY answers.answerID, 'index', answer ORDER BY 'index' ASC\".format(pollID, )):\n reply(\"%s. %s (%s)\" % (index, answer, votes))","target":"@hook.command(autohelp=False)\ndef showPoll(pollID, db=None):\n \"\"\"Shows the answers for a given poll.\"\"\"\n if not db_ready: db_init(db)\n if pollID == None:\n poll = db.execute(\"SELECT pollID, question FROM polls WHERE active = 1\")\n if len(poll) == 0:\n reply(\"There's no poll open.\")\n return\n else:\n poll = db.execute(\"SELECT pollID, question FROM polls WHERE pollID = ?\", (pollID,))\n if len(poll) == 0:\n reply(\"No such poll found.\")\n return\n pollID = poll[0][0]\n question = poll[0][1]\n reply(question)\n for (index, answer, votes) in db.execute(\"SELECT 'index', answer, count(voteID) FROM answers LEFT JOIN votes ON votes.answerID = answers.answerID WHERE pollID = ? GROUP BY answers.answerID, 'index', answer ORDER BY 'index' ASC\", (pollID, )):\n reply(\"%s. %s (%s)\" % (index, answer, votes))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"showPoll","file_name":"plugins/poll.py","commit_link":"github.com/FrozenPigs/Taigabot/commit/ea9b83a66ae1f0f38a1895f3e8dfa2833d77e3a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#173-9d5d6846cb75","input":" def process_ranks(self, scene, urls, recent_date):\n PLAYER1 = 0\n PLAYER2 = 1\n WINNER = 2\n DATE = 3\n SCENE = 4\n\n # make sure if we already have calculated ranks for these players at this time, we do not do it again\n sql = \"SELECT * FROM ranks WHERE scene = '{}' AND date='{}';\".format(str(scene), recent_date)\n res = self.db.exec(sql)\n if len(res) > 0:\n LOG.info('We have already calculated ranks for {} on date {}. SKipping'.format(scene, recent_date))\n return\n\n matches = bracket_utils.get_matches_from_urls(self.db, urls)\n LOG.info('About to start processing ranks for scene {} on {}'.format(scene, recent_date))\n\n # Iterate through each match, and build up our dict\n win_loss_dict = {}\n for match in matches:\n p1 = match[PLAYER1]\n p2 = match[PLAYER2]\n winner = match[WINNER]\n date = match[DATE]\n\n #Add p1 to the dict\n if p1 not in win_loss_dict:\n win_loss_dict[p1] = {}\n\n if p2 not in win_loss_dict[p1]:\n win_loss_dict[p1][p2] = []\n\n # Add an entry to represent this match to p1\n win_loss_dict[p1][p2].append((date, winner == p1))\n\n # add p2 to the dict\n if p2 not in win_loss_dict:\n win_loss_dict[p2] = {}\n\n if p1 not in win_loss_dict[p2]:\n win_loss_dict[p2][p1] = []\n\n win_loss_dict[p2][p1].append((date, winner == p2))\n\n ranks = get_ranks(win_loss_dict)\n\n tag_rank_map = {}\n for i, x in enumerate(ranks):\n points, player = x\n rank = len(ranks) - i\n\n sql = \"INSERT INTO ranks (scene, player, rank, points, date) VALUES ('{}', '{}', '{}', '{}', '{}');\"\\\n .format(str(scene), str(player), int(rank), str(points), str(recent_date))\n self.db.exec(sql)\n\n # Only count this player if this is the scene he/she belongs to\n sql = \"SELECT scene FROM players WHERE tag='{}';\".format(player)\n res = self.db.exec(sql)\n\n if len(res) == 0 or res[0][0] == scene:\n # Also create a list to update the player web\n map = {'rank':rank, 'total_ranked':len(ranks)}\n tag_rank_map[player] = map\n\n player_web.update_ranks(tag_rank_map)","target":" def process_ranks(self, scene, urls, recent_date):\n PLAYER1 = 0\n PLAYER2 = 1\n WINNER = 2\n DATE = 3\n SCENE = 4\n\n # make sure if we already have calculated ranks for these players at this time, we do not do it again\n sql = \"SELECT * FROM ranks WHERE scene = '{scene}' AND date='{date}';\"\n args = {'scene': scene, 'date': recent_date}\n res = self.db.exec(sql, args)\n if len(res) > 0:\n LOG.info('We have already calculated ranks for {} on date {}. SKipping'.format(scene, recent_date))\n return\n\n matches = bracket_utils.get_matches_from_urls(self.db, urls)\n LOG.info('About to start processing ranks for scene {} on {}'.format(scene, recent_date))\n\n # Iterate through each match, and build up our dict\n win_loss_dict = {}\n for match in matches:\n p1 = match[PLAYER1]\n p2 = match[PLAYER2]\n winner = match[WINNER]\n date = match[DATE]\n\n #Add p1 to the dict\n if p1 not in win_loss_dict:\n win_loss_dict[p1] = {}\n\n if p2 not in win_loss_dict[p1]:\n win_loss_dict[p1][p2] = []\n\n # Add an entry to represent this match to p1\n win_loss_dict[p1][p2].append((date, winner == p1))\n\n # add p2 to the dict\n if p2 not in win_loss_dict:\n win_loss_dict[p2] = {}\n\n if p1 not in win_loss_dict[p2]:\n win_loss_dict[p2][p1] = []\n\n win_loss_dict[p2][p1].append((date, winner == p2))\n\n ranks = get_ranks(win_loss_dict)\n\n tag_rank_map = {}\n for i, x in enumerate(ranks):\n points, player = x\n rank = len(ranks) - i\n\n sql = \"INSERT INTO ranks (scene, player, rank, points, date) VALUES ('{scene}', '{player}', '{rank}', '{points}', '{recent_date}');\"\n args = {'scene': scene, 'player': player, 'rank': rank, 'points': points, 'recent_date': recent_date}\n self.db.exec(sql, args)\n\n # Only count this player if this is the scene he/she belongs to\n sql = \"SELECT scene FROM players WHERE tag='{player}';\"\n args = {'player': player}\n res = self.db.exec(sql, args)\n\n if len(res) == 0 or res[0][0] == scene:\n # Also create a list to update the player web\n map = {'rank':rank, 'total_ranked':len(ranks)}\n tag_rank_map[player] = map\n\n player_web.update_ranks(tag_rank_map)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"process_ranks","file_name":"process_data.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#174-6832ed65d258","input":" def analyze_smashgg(self, urls, name):\n LOG.info('we are about to analyze scene {} with {} brackets'.format(name, len(urls)))\n for url in urls:\n # Before we process this URL, check to see if we already have\n sql = \"SELECT * FROM analyzed where base_url='{}'\".format(url)\n res = self.db.exec(sql)\n if len(res) == 0:\n\n display_name = bracket_utils.get_display_base(url)\n\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n LOG.info('About to process pro bracket {}'.format(url))\n self.data_processor.process(url, name, display_name)\n else:\n LOG.info(\"Skpping pro bracket because it has already been analyzed: {}\".format(url))","target":" def analyze_smashgg(self, urls, name):\n LOG.info('we are about to analyze scene {} with {} brackets'.format(name, len(urls)))\n for url in urls:\n # Before we process this URL, check to see if we already have\n sql = \"SELECT * FROM analyzed where base_url='{url}'\"\n args = {'url':url}\n res = self.db.exec(sql, args)\n if len(res) == 0:\n\n display_name = bracket_utils.get_display_base(url)\n\n # We don't care about doubles tournaments\n if 'doubles' in display_name.lower() or 'dubs' in display_name.lower():\n LOG.info('We are skipping the tournament {} because it is a doubles tournament'.format(display_name))\n continue\n\n LOG.info('About to process pro bracket {}'.format(url))\n self.data_processor.process(url, name, display_name)\n else:\n LOG.info(\"Skpping pro bracket because it has already been analyzed: {}\".format(url))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"analyze_smashgg","file_name":"validURLs.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#175-daa6fec1e08c","input":"@mod.route('/test', methods=['GET', 'POST'])\ndef test():\n user_id = session['logged_id']\n sql = 'SELECT * FROM message where user_id = %d ORDER BY c_time DESC' \\\n % (user_id)\n cursor.execute(sql)\n m = cursor.fetchall()\n print(m)","target":"@mod.route('/test', methods=['GET', 'POST'])\ndef test():\n user_id = session['logged_id']\n cursor.execute('SELECT * FROM message where user_id = %s ORDER BY c_time DESC', (user_id,))\n m = cursor.fetchall()\n print(m)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"test","file_name":"flaskr/flaskr/views/message.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#176-66927d1ecd10","input":" @staticmethod\n def get_last_active_users(limit):\n \"\"\"\n Get from the database a tuple of users who have been recently using\n the bot\n :param limit: integer that specifies how much users to get\n :return: tuple of tuples with users info\n \"\"\"\n log.info('Evaluating last active users with date of '\n 'last time when they used bot...')\n\n # From photo_queries_table2 we take chat_id of the last\n # active users and from 'users' table we take info about these\n # users by chat_id which is a foreign key\n query = ('SELECT p.chat_id, u.first_name, u.nickname, u.last_name, '\n 'u.language '\n 'FROM photo_queries_table2 p '\n 'INNER JOIN users u '\n 'ON p.chat_id = u.chat_id '\n 'GROUP BY u.chat_id, u.first_name, u.nickname, u.last_name, '\n 'u.language '\n 'ORDER BY MAX(time)'\n f'DESC LIMIT {limit}')\n\n try:\n cursor = db.execute_query(query)\n except DatabaseConnectionError:\n log.error(\"Cannot get the last active users because of some \"\n \"problems with the database\")\n raise\n\n last_active_users = cursor.fetchall()\n return last_active_users","target":" @staticmethod\n def get_last_active_users(limit):\n \"\"\"\n Get from the database a tuple of users who have been recently using\n the bot\n :param limit: integer that specifies how much users to get\n :return: tuple of tuples with users info\n \"\"\"\n log.info('Evaluating last active users with date of '\n 'last time when they used bot...')\n\n # From photo_queries_table2 we take chat_id of the last\n # active users and from 'users' table we take info about these\n # users by chat_id which is a foreign key\n query = ('SELECT p.chat_id, u.first_name, u.nickname, u.last_name, '\n 'u.language '\n 'FROM photo_queries_table2 p '\n 'INNER JOIN users u '\n 'ON p.chat_id = u.chat_id '\n 'GROUP BY u.chat_id, u.first_name, u.nickname, u.last_name, '\n 'u.language '\n 'ORDER BY MAX(time)'\n f'DESC LIMIT %s')\n\n parameters = limit,\n\n try:\n cursor = db.execute_query(query, parameters)\n except DatabaseConnectionError:\n log.error(\"Cannot get the last active users because of some \"\n \"problems with the database\")\n raise\n\n last_active_users = cursor.fetchall()\n return last_active_users","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_last_active_users","file_name":"photogpsbot/users.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#177-079aaccfc020","input":" def on_save(self):\n connection = get_connection()\n cursor = connection.cursor()\n cursor.execute(\n f\"insert into visitors (ip_address, user_agent, referrer, full_path, visit_time) values ('{self.ip_address}', '{self.user_agent}', '{self.referrer}', '{self.full_path}', '{self.visit_time}');\")\n connection.commit()\n connection.close()\n return 0","target":" def on_save(self):\n connection = get_connection()\n cursor = connection.cursor()\n cursor.execute(\n \"insert into visitors (ip_address, user_agent, referrer, full_path, visit_time) values (%s, %s, %s, %s, %s);\",\n (str(self.ip_address), str(self.user_agent), str(self.referrer), str(self.full_path), self.visit_time))\n connection.commit()\n connection.close()\n return 0","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"on_save","file_name":"experimental/python/buford/model/visitor.py","commit_link":"github.com/onewyoming/onewyoming/commit/54fc7b076fda2de74eeb55e6b75b28e09ef231c2","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#178-1a1f148dbb25","input":"def update_institutions(conn, sqlite, k10plus, ai):\n \"\"\"\n Update the institution table.\n \"\"\"\n current_institutions = get_all_current_institutions(k10plus, ai)\n old_institutions = get_all_old_institutions(conn, sqlite)\n\n # Check if the institution table is allready filled and this is not the first checkup\n institution_table_is_filled = len(old_institutions) > 10\n\n for old_institution in old_institutions:\n if institution_table_is_filled and old_institution not in current_institutions:\n message = \"Die ISIL %s ist im aktuellen Import nicht mehr vorhanden.\\nWenn dies beabsichtigt ist, bitte die Institution aus der Datenbank loeschen.\" % old_institution\n send_message(message)\n\n for current_institution in current_institutions:\n if current_institution == \" \" or '\"' in current_institution:\n continue\n if current_institution not in old_institutions:\n message = \"The institution %s is new in Solr.\" % current_institution\n if institution_table_is_filled:\n send_message(message)\n else:\n logging.info(message)\n sql = \"INSERT INTO institution (institution) VALUES ('%s')\" % current_institution\n sqlite.execute(sql)\n conn.commit()","target":"def update_institutions(conn, sqlite, k10plus, ai):\n \"\"\"\n Update the institution table.\n \"\"\"\n current_institutions = get_all_current_institutions(k10plus, ai)\n old_institutions = get_all_old_institutions(conn, sqlite)\n\n # Check if the institution table is allready filled and this is not the first checkup\n institution_table_is_filled = len(old_institutions) > 10\n\n for old_institution in old_institutions:\n if institution_table_is_filled and old_institution not in current_institutions:\n message = \"Die ISIL %s ist im aktuellen Import nicht mehr vorhanden.\\nWenn dies beabsichtigt ist, bitte die Institution aus der Datenbank loeschen.\" % old_institution\n send_message(message)\n\n for current_institution in current_institutions:\n if current_institution == \" \" or '\"' in current_institution:\n continue\n if current_institution not in old_institutions:\n message = \"The institution %s is new in Solr.\" % current_institution\n if institution_table_is_filled:\n send_message(message)\n else:\n logging.info(message)\n sql = \"INSERT INTO institution (institution) VALUES (?)\"\n sqlite.execute(sql, (current_institution,))\n conn.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"update_institutions","file_name":"bin/solrcheckup.py","commit_link":"github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#179-067a050b27b8","input":" @staticmethod\n def _add_to_db(user):\n \"\"\"\n Adds User object to the database\n :param user: User object with info about user\n :return: None\n \"\"\"\n query = (\"INSERT INTO users (chat_id, first_name, nickname, \"\n \"last_name, language) \"\n f\"VALUES ({user.chat_id}, '{user.first_name}', \"\n f\"'{user.nickname}', '{user.last_name}', '{user.language}')\")\n try:\n db.add(query)\n except DatabaseError:\n log.error(\"Cannot add user to the database\")\n else:\n log.info(f\"User {user} was successfully added to the users db\")","target":" @staticmethod\n def _add_to_db(user):\n \"\"\"\n Adds User object to the database\n :param user: User object with info about user\n :return: None\n \"\"\"\n query = (\"INSERT INTO users (chat_id, first_name, nickname, \"\n \"last_name, language) \"\n f\"VALUES (%s, %s, %s, %s, %s)\")\n\n parameters = (user.chat_id, user.first_name, user.nickname,\n user.last_name, user.language)\n\n try:\n db.add(query, parameters)\n except DatabaseError:\n log.error(\"Cannot add user to the database\")\n else:\n log.info(f\"User {user} was successfully added to the users db\")","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"_add_to_db","file_name":"photogpsbot/users.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#180-153fe52c7749","input":" def deletePost(self,postid):\n sqlText=\"delete from post where post.postid=%d\"%(postid)\n result=sql.deleteDB(self.conn,sqlText)\n return result;","target":" def deletePost(self,postid):\n sqlText=\"delete from post where post.postid=%s\"\n params=[postid]\n result=sql.deleteDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"deletePost","file_name":"modules/post.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#181-05b7cb5ad097","input":"@app.route('/sloka')\ndef sloka():\n\n sloka_number = request.args.get('sloka_number')\n\n sloka_number_parts = sloka_number.split('.')\n\n sloka_number_previous = \"%s.%s.%d\" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])-1)\n sloka_number_next = \"%s.%s.%d\" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])+1)\n\n try:\n with sql.connect('amara.db') as con:\n con.row_factory = sql.Row\n cur = con.cursor()\n cur.execute(\"select * from mula where sloka_number = '%s' order by sloka_line;\" % sloka_number)\n mula = cur.fetchall();\n\n cur.execute(\"select * from pada where sloka_number = '%s' order by id;\" % sloka_number)\n pada = cur.fetchall();\n\n varga = \"\"\n if len(pada) > 0:\n varga = pada[0][\"varga\"]\n\n return render_template('sloka.html', mula=mula, pada=pada, varga=varga, sloka_number=sloka_number, sloka_number_previous=sloka_number_previous, sloka_number_next=sloka_number_next)\n finally:\n con.close()","target":"@app.route('/sloka')\ndef sloka():\n\n sloka_number = request.args.get('sloka_number')\n\n sloka_number_parts = sloka_number.split('.')\n\n sloka_number_previous = \"%s.%s.%d\" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])-1)\n sloka_number_next = \"%s.%s.%d\" % (sloka_number_parts[0], sloka_number_parts[1], int(sloka_number_parts[2])+1)\n\n try:\n with sql.connect('amara.db') as con:\n con.row_factory = sql.Row\n cur = con.cursor()\n cur.execute(\"select * from mula where sloka_number = ? order by sloka_line;\", [sloka_number])\n mula = cur.fetchall();\n\n cur.execute(\"select * from pada where sloka_number = ? order by id;\", [sloka_number])\n pada = cur.fetchall();\n\n varga = \"\"\n if len(pada) > 0:\n varga = pada[0][\"varga\"]\n\n return render_template('sloka.html', mula=mula, pada=pada, varga=varga, sloka_number=sloka_number, sloka_number_previous=sloka_number_previous, sloka_number_next=sloka_number_next)\n finally:\n con.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"sloka","file_name":"docker/app.py","commit_link":"github.com/aupasana/amara-quiz/commit/6ceb5dc8ec38b4a3f1399e578ab970f7e3354922","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#182-9840664644de","input":" def update_title(self, title = None):\n if (not self.title):\n self.title = title\n\n # This will fall to a sql injection \n sql = \"UPDATE jdk_entries SET title = '\" + self.title + \"'\" + \\\n \"WHERE jdk_entries.id = '\" + self.entry_id + \"';\" \n\n db_execute(sql)\n \n self.update_date_modified()\n\n return None","target":" def update_title(self, title = None):\n if (not self.title):\n self.title = title\n\n quote_tuple = self.title, self.entry_id\n\n # This will fall to a sql injection \n sql = \"UPDATE jdk_entries SET title = ?\" + \\\n \"WHERE jdk_entries.id = ?;\" \n\n db_execute(sql, quote_tuple)\n \n self.update_date_modified()\n\n return None","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"update_title","file_name":"entry.py","commit_link":"github.com/peterlebrun/jdk/commit/000238566fbe55ba09676c3d57af04ae207235ae","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#183-6943827e6f69","input":" def add_language(self, language):\n \"\"\"\"Add new language for item translations.\"\"\"\n if self.connection:\n self.cursor.execute('insert into itemlanguage (language) values (\"%s\")' % language[0])\n self.connection.commit()","target":" def add_language(self, language):\n \"\"\"\"Add new language for item translations.\"\"\"\n if self.connection:\n t = (language[0], )\n self.cursor.execute('insert into itemlanguage (language) values (?)', t)\n self.connection.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_language","file_name":"ecosldb/ecosldb.py","commit_link":"github.com/ecosl-developers/ecosl/commit/8af050a513338bf68ff2a243e4a2482d24e9aa3a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-125#0-e3398f4505a1","input":"MagickExport Image *AdaptiveThresholdImage(const Image *image,\n const size_t width,const size_t height,const ssize_t offset,\n ExceptionInfo *exception)\n{\n#define ThresholdImageTag \"Threshold/Image\"\n\n CacheView\n *image_view,\n *threshold_view;\n\n Image\n *threshold_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n MagickPixelPacket\n zero;\n\n MagickRealType\n number_pixels;\n\n ssize_t\n y;\n\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n threshold_image=CloneImage(image,0,0,MagickTrue,exception);\n if (threshold_image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(threshold_image,DirectClass) == MagickFalse)\n {\n InheritException(exception,&threshold_image->exception);\n threshold_image=DestroyImage(threshold_image);\n return((Image *) NULL);\n }\n /*\n Local adaptive threshold.\n */\n status=MagickTrue;\n progress=0;\n GetMagickPixelPacket(image,&zero);\n number_pixels=(MagickRealType) (width*height);\n image_view=AcquireVirtualCacheView(image,exception);\n threshold_view=AcquireAuthenticCacheView(threshold_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(image,threshold_image,image->rows,1)\n#endif\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n MagickBooleanType\n sync;\n\n MagickPixelPacket\n channel_bias,\n channel_sum;\n\n register const IndexPacket\n *magick_restrict indexes;\n\n register const PixelPacket\n *magick_restrict p,\n *magick_restrict r;\n\n register IndexPacket\n *magick_restrict threshold_indexes;\n\n register PixelPacket\n *magick_restrict q;\n\n register ssize_t\n x;\n\n ssize_t\n u,\n v;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)\n height/2L,image->columns+width,height,exception);\n q=GetCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns,1,\n exception);\n if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n indexes=GetCacheViewVirtualIndexQueue(image_view);\n threshold_indexes=GetCacheViewAuthenticIndexQueue(threshold_view);\n channel_bias=zero;\n channel_sum=zero;\n r=p;\n for (v=0; v < (ssize_t) height; v++)\n {\n for (u=0; u < (ssize_t) width; u++)\n {\n if (u == (ssize_t) (width-1))\n {\n channel_bias.red+=r[u].red;\n channel_bias.green+=r[u].green;\n channel_bias.blue+=r[u].blue;\n channel_bias.opacity+=r[u].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_bias.index=(MagickRealType)\n GetPixelIndex(indexes+(r-p)+u);\n }\n channel_sum.red+=r[u].red;\n channel_sum.green+=r[u].green;\n channel_sum.blue+=r[u].blue;\n channel_sum.opacity+=r[u].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_sum.index=(MagickRealType) GetPixelIndex(indexes+(r-p)+u);\n }\n r+=image->columns+width;\n }\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n MagickPixelPacket\n mean;\n\n mean=zero;\n r=p;\n channel_sum.red-=channel_bias.red;\n channel_sum.green-=channel_bias.green;\n channel_sum.blue-=channel_bias.blue;\n channel_sum.opacity-=channel_bias.opacity;\n channel_sum.index-=channel_bias.index;\n channel_bias=zero;\n for (v=0; v < (ssize_t) height; v++)\n {\n channel_bias.red+=r[0].red;\n channel_bias.green+=r[0].green;\n channel_bias.blue+=r[0].blue;\n channel_bias.opacity+=r[0].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_bias.index=(MagickRealType) GetPixelIndex(indexes+x+(r-p)+0);\n channel_sum.red+=r[width-1].red;\n channel_sum.green+=r[width-1].green;\n channel_sum.blue+=r[width-1].blue;\n channel_sum.opacity+=r[width-1].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_sum.index=(MagickRealType) GetPixelIndex(indexes+x+(r-p)+\n width-1);\n r+=image->columns+width;\n }\n mean.red=(MagickRealType) (channel_sum.red/number_pixels+offset);\n mean.green=(MagickRealType) (channel_sum.green/number_pixels+offset);\n mean.blue=(MagickRealType) (channel_sum.blue/number_pixels+offset);\n mean.opacity=(MagickRealType) (channel_sum.opacity/number_pixels+offset);\n if (image->colorspace == CMYKColorspace)\n mean.index=(MagickRealType) (channel_sum.index/number_pixels+offset);\n SetPixelRed(q,((MagickRealType) GetPixelRed(q) <= mean.red) ?\n 0 : QuantumRange);\n SetPixelGreen(q,((MagickRealType) GetPixelGreen(q) <= mean.green) ?\n 0 : QuantumRange);\n SetPixelBlue(q,((MagickRealType) GetPixelBlue(q) <= mean.blue) ?\n 0 : QuantumRange);\n SetPixelOpacity(q,((MagickRealType) GetPixelOpacity(q) <= mean.opacity) ?\n 0 : QuantumRange);\n if (image->colorspace == CMYKColorspace)\n SetPixelIndex(threshold_indexes+x,(((MagickRealType) GetPixelIndex(\n threshold_indexes+x) <= mean.index) ? 0 : QuantumRange));\n p++;\n q++;\n }\n sync=SyncCacheViewAuthenticPixels(threshold_view,exception);\n if (sync == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(image,ThresholdImageTag,progress,image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n threshold_view=DestroyCacheView(threshold_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n threshold_image=DestroyImage(threshold_image);\n return(threshold_image);\n}","target":"MagickExport Image *AdaptiveThresholdImage(const Image *image,\n const size_t width,const size_t height,const ssize_t offset,\n ExceptionInfo *exception)\n{\n#define ThresholdImageTag \"Threshold/Image\"\n\n CacheView\n *image_view,\n *threshold_view;\n\n Image\n *threshold_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n MagickPixelPacket\n zero;\n\n MagickRealType\n number_pixels;\n\n ssize_t\n y;\n\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n threshold_image=CloneImage(image,0,0,MagickTrue,exception);\n if (threshold_image == (Image *) NULL)\n return((Image *) NULL);\n if (width == 0)\n return(threshold_image);\n if (SetImageStorageClass(threshold_image,DirectClass) == MagickFalse)\n {\n InheritException(exception,&threshold_image->exception);\n threshold_image=DestroyImage(threshold_image);\n return((Image *) NULL);\n }\n /*\n Local adaptive threshold.\n */\n status=MagickTrue;\n progress=0;\n GetMagickPixelPacket(image,&zero);\n number_pixels=(MagickRealType) (width*height);\n image_view=AcquireVirtualCacheView(image,exception);\n threshold_view=AcquireAuthenticCacheView(threshold_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(image,threshold_image,image->rows,1)\n#endif\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n MagickBooleanType\n sync;\n\n MagickPixelPacket\n channel_bias,\n channel_sum;\n\n register const IndexPacket\n *magick_restrict indexes;\n\n register const PixelPacket\n *magick_restrict p,\n *magick_restrict r;\n\n register IndexPacket\n *magick_restrict threshold_indexes;\n\n register PixelPacket\n *magick_restrict q;\n\n register ssize_t\n x;\n\n ssize_t\n u,\n v;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)\n height/2L,image->columns+width,height,exception);\n q=GetCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns,1,\n exception);\n if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n indexes=GetCacheViewVirtualIndexQueue(image_view);\n threshold_indexes=GetCacheViewAuthenticIndexQueue(threshold_view);\n channel_bias=zero;\n channel_sum=zero;\n r=p;\n for (v=0; v < (ssize_t) height; v++)\n {\n for (u=0; u < (ssize_t) width; u++)\n {\n if (u == (ssize_t) (width-1))\n {\n channel_bias.red+=r[u].red;\n channel_bias.green+=r[u].green;\n channel_bias.blue+=r[u].blue;\n channel_bias.opacity+=r[u].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_bias.index=(MagickRealType)\n GetPixelIndex(indexes+(r-p)+u);\n }\n channel_sum.red+=r[u].red;\n channel_sum.green+=r[u].green;\n channel_sum.blue+=r[u].blue;\n channel_sum.opacity+=r[u].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_sum.index=(MagickRealType) GetPixelIndex(indexes+(r-p)+u);\n }\n r+=image->columns+width;\n }\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n MagickPixelPacket\n mean;\n\n mean=zero;\n r=p;\n channel_sum.red-=channel_bias.red;\n channel_sum.green-=channel_bias.green;\n channel_sum.blue-=channel_bias.blue;\n channel_sum.opacity-=channel_bias.opacity;\n channel_sum.index-=channel_bias.index;\n channel_bias=zero;\n for (v=0; v < (ssize_t) height; v++)\n {\n channel_bias.red+=r[0].red;\n channel_bias.green+=r[0].green;\n channel_bias.blue+=r[0].blue;\n channel_bias.opacity+=r[0].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_bias.index=(MagickRealType) GetPixelIndex(indexes+x+(r-p)+0);\n channel_sum.red+=r[width-1].red;\n channel_sum.green+=r[width-1].green;\n channel_sum.blue+=r[width-1].blue;\n channel_sum.opacity+=r[width-1].opacity;\n if (image->colorspace == CMYKColorspace)\n channel_sum.index=(MagickRealType) GetPixelIndex(indexes+x+(r-p)+\n width-1);\n r+=image->columns+width;\n }\n mean.red=(MagickRealType) (channel_sum.red/number_pixels+offset);\n mean.green=(MagickRealType) (channel_sum.green/number_pixels+offset);\n mean.blue=(MagickRealType) (channel_sum.blue/number_pixels+offset);\n mean.opacity=(MagickRealType) (channel_sum.opacity/number_pixels+offset);\n if (image->colorspace == CMYKColorspace)\n mean.index=(MagickRealType) (channel_sum.index/number_pixels+offset);\n SetPixelRed(q,((MagickRealType) GetPixelRed(q) <= mean.red) ?\n 0 : QuantumRange);\n SetPixelGreen(q,((MagickRealType) GetPixelGreen(q) <= mean.green) ?\n 0 : QuantumRange);\n SetPixelBlue(q,((MagickRealType) GetPixelBlue(q) <= mean.blue) ?\n 0 : QuantumRange);\n SetPixelOpacity(q,((MagickRealType) GetPixelOpacity(q) <= mean.opacity) ?\n 0 : QuantumRange);\n if (image->colorspace == CMYKColorspace)\n SetPixelIndex(threshold_indexes+x,(((MagickRealType) GetPixelIndex(\n threshold_indexes+x) <= mean.index) ? 0 : QuantumRange));\n p++;\n q++;\n }\n sync=SyncCacheViewAuthenticPixels(threshold_view,exception);\n if (sync == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(image,ThresholdImageTag,progress,image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n threshold_view=DestroyCacheView(threshold_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n threshold_image=DestroyImage(threshold_image);\n return(threshold_image);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"AdaptiveThresholdImage","file_name":"magick/threshold.c","commit_link":"github.com/ImageMagick/ImageMagick6/commit/55e6dc49f1a381d9d511ee2f888fdc3e3c3e3953","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#1-ad0f1eaa7363","input":"MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile)\n{\n#define MaxDirectoryStack 16\n#define EXIF_DELIMITER \"\\n\"\n#define EXIF_NUM_FORMATS 12\n#define TAG_EXIF_OFFSET 0x8769\n#define TAG_INTEROP_OFFSET 0xa005\n\n typedef struct _DirectoryInfo\n {\n unsigned char\n *directory;\n\n size_t\n entry;\n } DirectoryInfo;\n\n DirectoryInfo\n directory_stack[MaxDirectoryStack];\n\n EndianType\n endian;\n\n size_t\n entry,\n length,\n number_entries;\n\n ssize_t\n id,\n level,\n offset;\n\n static int\n format_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};\n\n unsigned char\n *directory,\n *exif;\n\n /*\n Set EXIF resolution tag.\n */\n length=GetStringInfoLength(profile);\n exif=GetStringInfoDatum(profile);\n if (length < 16)\n return(MagickFalse);\n id=(ssize_t) ReadProfileShort(LSBEndian,exif);\n if ((id != 0x4949) && (id != 0x4D4D))\n {\n while (length != 0)\n {\n if (ReadProfileByte(&exif,&length) != 0x45)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x78)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x69)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x66)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x00)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x00)\n continue;\n break;\n }\n if (length < 16)\n return(MagickFalse);\n id=(ssize_t) ReadProfileShort(LSBEndian,exif);\n }\n endian=LSBEndian;\n if (id == 0x4949)\n endian=LSBEndian;\n else\n if (id == 0x4D4D)\n endian=MSBEndian;\n else\n return(MagickFalse);\n if (ReadProfileShort(endian,exif+2) != 0x002a)\n return(MagickFalse);\n /*\n This the offset to the first IFD.\n */\n offset=(ssize_t) ReadProfileLong(endian,exif+4);\n if ((offset < 0) || (size_t) offset >= length)\n return(MagickFalse);\n directory=exif+offset;\n level=0;\n entry=0;\n do\n {\n if (level > 0)\n {\n level--;\n directory=directory_stack[level].directory;\n entry=directory_stack[level].entry;\n }\n if ((directory < exif) || (directory > (exif+length-2)))\n break;\n /*\n Determine how many entries there are in the current IFD.\n */\n number_entries=ReadProfileShort(endian,directory);\n for ( ; entry < number_entries; entry++)\n {\n int\n components;\n\n register unsigned char\n *p,\n *q;\n\n size_t\n number_bytes;\n\n ssize_t\n format,\n tag_value;\n\n q=(unsigned char *) (directory+2+(12*entry));\n if (q > (exif+length-12))\n break; /* corrupt EXIF */\n tag_value=(ssize_t) ReadProfileShort(endian,q);\n format=(ssize_t) ReadProfileShort(endian,q+2);\n if ((format-1) >= EXIF_NUM_FORMATS)\n break;\n components=(ssize_t) ReadProfileLong(endian,q+4);\n if (components < 0)\n break; /* corrupt EXIF */\n number_bytes=(size_t) components*format_bytes[format];\n if ((ssize_t) number_bytes < components)\n break; /* prevent overflow */\n if (number_bytes <= 4)\n p=q+8;\n else\n {\n /*\n The directory entry contains an offset.\n */\n offset=(ssize_t) ReadProfileLong(endian,q+8);\n if ((size_t) (offset+number_bytes) > length)\n continue;\n if (~length < number_bytes)\n continue; /* prevent overflow */\n p=(unsigned char *) (exif+offset);\n }\n switch (tag_value)\n {\n case 0x011a:\n {\n (void) WriteProfileLong(endian,(size_t) (image->resolution.x+0.5),p);\n (void) WriteProfileLong(endian,1UL,p+4);\n break;\n }\n case 0x011b:\n {\n (void) WriteProfileLong(endian,(size_t) (image->resolution.y+0.5),p);\n (void) WriteProfileLong(endian,1UL,p+4);\n break;\n }\n case 0x0112:\n {\n if (number_bytes == 4)\n {\n (void) WriteProfileLong(endian,(size_t) image->orientation,p);\n break;\n }\n (void) WriteProfileShort(endian,(unsigned short) image->orientation,\n p);\n break;\n }\n case 0x0128:\n {\n if (number_bytes == 4)\n {\n (void) WriteProfileLong(endian,(size_t) (image->units+1),p);\n break;\n }\n (void) WriteProfileShort(endian,(unsigned short) (image->units+1),p);\n break;\n }\n default:\n break;\n }\n if ((tag_value == TAG_EXIF_OFFSET) || (tag_value == TAG_INTEROP_OFFSET))\n {\n offset=(ssize_t) ReadProfileLong(endian,p);\n if (((size_t) offset < length) && (level < (MaxDirectoryStack-2)))\n {\n directory_stack[level].directory=directory;\n entry++;\n directory_stack[level].entry=entry;\n level++;\n directory_stack[level].directory=exif+offset;\n directory_stack[level].entry=0;\n level++;\n if ((directory+2+(12*number_entries)) > (exif+length))\n break;\n offset=(ssize_t) ReadProfileLong(endian,directory+2+(12*\n number_entries));\n if ((offset != 0) && ((size_t) offset < length) &&\n (level < (MaxDirectoryStack-2)))\n {\n directory_stack[level].directory=exif+offset;\n directory_stack[level].entry=0;\n level++;\n }\n }\n break;\n }\n }\n } while (level > 0);\n return(MagickTrue);\n}","target":"MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile)\n{\n#define MaxDirectoryStack 16\n#define EXIF_DELIMITER \"\\n\"\n#define EXIF_NUM_FORMATS 12\n#define TAG_EXIF_OFFSET 0x8769\n#define TAG_INTEROP_OFFSET 0xa005\n\n typedef struct _DirectoryInfo\n {\n unsigned char\n *directory;\n\n size_t\n entry;\n } DirectoryInfo;\n\n DirectoryInfo\n directory_stack[MaxDirectoryStack];\n\n EndianType\n endian;\n\n size_t\n entry,\n length,\n number_entries;\n\n ssize_t\n id,\n level,\n offset;\n\n static int\n format_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};\n\n unsigned char\n *directory,\n *exif;\n\n /*\n Set EXIF resolution tag.\n */\n length=GetStringInfoLength(profile);\n exif=GetStringInfoDatum(profile);\n if (length < 16)\n return(MagickFalse);\n id=(ssize_t) ReadProfileShort(LSBEndian,exif);\n if ((id != 0x4949) && (id != 0x4D4D))\n {\n while (length != 0)\n {\n if (ReadProfileByte(&exif,&length) != 0x45)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x78)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x69)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x66)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x00)\n continue;\n if (ReadProfileByte(&exif,&length) != 0x00)\n continue;\n break;\n }\n if (length < 16)\n return(MagickFalse);\n id=(ssize_t) ReadProfileShort(LSBEndian,exif);\n }\n endian=LSBEndian;\n if (id == 0x4949)\n endian=LSBEndian;\n else\n if (id == 0x4D4D)\n endian=MSBEndian;\n else\n return(MagickFalse);\n if (ReadProfileShort(endian,exif+2) != 0x002a)\n return(MagickFalse);\n /*\n This the offset to the first IFD.\n */\n offset=(ssize_t) ReadProfileLong(endian,exif+4);\n if ((offset < 0) || (size_t) offset >= length)\n return(MagickFalse);\n directory=exif+offset;\n level=0;\n entry=0;\n do\n {\n if (level > 0)\n {\n level--;\n directory=directory_stack[level].directory;\n entry=directory_stack[level].entry;\n }\n if ((directory < exif) || (directory > (exif+length-2)))\n break;\n /*\n Determine how many entries there are in the current IFD.\n */\n number_entries=ReadProfileShort(endian,directory);\n for ( ; entry < number_entries; entry++)\n {\n int\n components;\n\n register unsigned char\n *p,\n *q;\n\n size_t\n number_bytes;\n\n ssize_t\n format,\n tag_value;\n\n q=(unsigned char *) (directory+2+(12*entry));\n if (q > (exif+length-12))\n break; /* corrupt EXIF */\n tag_value=(ssize_t) ReadProfileShort(endian,q);\n format=(ssize_t) ReadProfileShort(endian,q+2);\n if ((format < 0) || ((format-1) >= EXIF_NUM_FORMATS))\n break;\n components=(ssize_t) ReadProfileLong(endian,q+4);\n if (components < 0)\n break; /* corrupt EXIF */\n number_bytes=(size_t) components*format_bytes[format];\n if ((ssize_t) number_bytes < components)\n break; /* prevent overflow */\n if (number_bytes <= 4)\n p=q+8;\n else\n {\n /*\n The directory entry contains an offset.\n */\n offset=(ssize_t) ReadProfileLong(endian,q+8);\n if ((size_t) (offset+number_bytes) > length)\n continue;\n if (~length < number_bytes)\n continue; /* prevent overflow */\n p=(unsigned char *) (exif+offset);\n }\n switch (tag_value)\n {\n case 0x011a:\n {\n (void) WriteProfileLong(endian,(size_t) (image->resolution.x+0.5),p);\n (void) WriteProfileLong(endian,1UL,p+4);\n break;\n }\n case 0x011b:\n {\n (void) WriteProfileLong(endian,(size_t) (image->resolution.y+0.5),p);\n (void) WriteProfileLong(endian,1UL,p+4);\n break;\n }\n case 0x0112:\n {\n if (number_bytes == 4)\n {\n (void) WriteProfileLong(endian,(size_t) image->orientation,p);\n break;\n }\n (void) WriteProfileShort(endian,(unsigned short) image->orientation,\n p);\n break;\n }\n case 0x0128:\n {\n if (number_bytes == 4)\n {\n (void) WriteProfileLong(endian,(size_t) (image->units+1),p);\n break;\n }\n (void) WriteProfileShort(endian,(unsigned short) (image->units+1),p);\n break;\n }\n default:\n break;\n }\n if ((tag_value == TAG_EXIF_OFFSET) || (tag_value == TAG_INTEROP_OFFSET))\n {\n offset=(ssize_t) ReadProfileLong(endian,p);\n if (((size_t) offset < length) && (level < (MaxDirectoryStack-2)))\n {\n directory_stack[level].directory=directory;\n entry++;\n directory_stack[level].entry=entry;\n level++;\n directory_stack[level].directory=exif+offset;\n directory_stack[level].entry=0;\n level++;\n if ((directory+2+(12*number_entries)) > (exif+length))\n break;\n offset=(ssize_t) ReadProfileLong(endian,directory+2+(12*\n number_entries));\n if ((offset != 0) && ((size_t) offset < length) &&\n (level < (MaxDirectoryStack-2)))\n {\n directory_stack[level].directory=exif+offset;\n directory_stack[level].entry=0;\n level++;\n }\n }\n break;\n }\n }\n } while (level > 0);\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"SyncExifProfile","file_name":"MagickCore/profile.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/a7bb158b7bedd1449a34432feb3a67c8f1873bfa","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#2-35e661c51311","input":"static int ng_pkt(git_pkt **out, const char *line, size_t len)\n{\n\tgit_pkt_ng *pkt;\n\tconst char *ptr;\n\tsize_t alloclen;\n\n\tpkt = git__malloc(sizeof(*pkt));\n\tGITERR_CHECK_ALLOC(pkt);\n\n\tpkt->ref = NULL;\n\tpkt->type = GIT_PKT_NG;\n\n\tline += 3; /* skip \"ng \" */\n\tif (!(ptr = strchr(line, ' ')))\n\t\tgoto out_err;\n\tlen = ptr - line;\n\n\tGITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);\n\tpkt->ref = git__malloc(alloclen);\n\tGITERR_CHECK_ALLOC(pkt->ref);\n\n\tmemcpy(pkt->ref, line, len);\n\tpkt->ref[len] = '\\0';\n\n\tline = ptr + 1;\n\tif (!(ptr = strchr(line, '\\n')))\n\t\tgoto out_err;\n\tlen = ptr - line;\n\n\tGITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);\n\tpkt->msg = git__malloc(alloclen);\n\tGITERR_CHECK_ALLOC(pkt->msg);\n\n\tmemcpy(pkt->msg, line, len);\n\tpkt->msg[len] = '\\0';\n\n\t*out = (git_pkt *)pkt;\n\treturn 0;\n\nout_err:\n\tgiterr_set(GITERR_NET, \"invalid packet line\");\n\tgit__free(pkt->ref);\n\tgit__free(pkt);\n\treturn -1;\n}","target":"static int ng_pkt(git_pkt **out, const char *line, size_t len)\n{\n\tgit_pkt_ng *pkt;\n\tconst char *ptr;\n\tsize_t alloclen;\n\n\tpkt = git__malloc(sizeof(*pkt));\n\tGITERR_CHECK_ALLOC(pkt);\n\n\tpkt->ref = NULL;\n\tpkt->type = GIT_PKT_NG;\n\n\tif (len < 3)\n\t\tgoto out_err;\n\tline += 3; /* skip \"ng \" */\n\tlen -= 3;\n\tif (!(ptr = memchr(line, ' ', len)))\n\t\tgoto out_err;\n\tlen = ptr - line;\n\n\tGITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);\n\tpkt->ref = git__malloc(alloclen);\n\tGITERR_CHECK_ALLOC(pkt->ref);\n\n\tmemcpy(pkt->ref, line, len);\n\tpkt->ref[len] = '\\0';\n\n\tif (len < 1)\n\t\tgoto out_err;\n\tline = ptr + 1;\n\tlen -= 1;\n\tif (!(ptr = memchr(line, '\\n', len)))\n\t\tgoto out_err;\n\tlen = ptr - line;\n\n\tGITERR_CHECK_ALLOC_ADD(&alloclen, len, 1);\n\tpkt->msg = git__malloc(alloclen);\n\tGITERR_CHECK_ALLOC(pkt->msg);\n\n\tmemcpy(pkt->msg, line, len);\n\tpkt->msg[len] = '\\0';\n\n\t*out = (git_pkt *)pkt;\n\treturn 0;\n\nout_err:\n\tgiterr_set(GITERR_NET, \"invalid packet line\");\n\tgit__free(pkt->ref);\n\tgit__free(pkt);\n\treturn -1;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ng_pkt","file_name":"src/transports/smart_pkt.c","commit_link":"github.com/libgit2/libgit2/commit/1f9a8510e1d2f20ed7334eeeddb92c4dd8e7c649","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#3-1bef7c475eab","input":"lha_read_file_header_1(struct archive_read *a, struct lha *lha)\n{\n\tconst unsigned char *p;\n\tsize_t extdsize;\n\tint i, err, err2;\n\tint namelen, padding;\n\tunsigned char headersum, sum_calculated;\n\n\terr = ARCHIVE_OK;\n\n\tif ((p = __archive_read_ahead(a, H1_FIXED_SIZE, NULL)) == NULL)\n\t\treturn (truncated_error(a));\n\n\tlha->header_size = p[H1_HEADER_SIZE_OFFSET] + 2;\n\theadersum = p[H1_HEADER_SUM_OFFSET];\n\t/* Note: An extended header size is included in a compsize. */\n\tlha->compsize = archive_le32dec(p + H1_COMP_SIZE_OFFSET);\n\tlha->origsize = archive_le32dec(p + H1_ORIG_SIZE_OFFSET);\n\tlha->mtime = lha_dos_time(p + H1_DOS_TIME_OFFSET);\n\tnamelen = p[H1_NAME_LEN_OFFSET];\n\t/* Calculate a padding size. The result will be normally 0 only(?) */\n\tpadding = ((int)lha->header_size) - H1_FIXED_SIZE - namelen;\n\n\tif (namelen > 230 || padding < 0)\n\t\tgoto invalid;\n\n\tif ((p = __archive_read_ahead(a, lha->header_size, NULL)) == NULL)\n\t\treturn (truncated_error(a));\n\n\tfor (i = 0; i < namelen; i++) {\n\t\tif (p[i + H1_FILE_NAME_OFFSET] == 0xff)\n\t\t\tgoto invalid;/* Invalid filename. */\n\t}\n\tarchive_strncpy(&lha->filename, p + H1_FILE_NAME_OFFSET, namelen);\n\tlha->crc = archive_le16dec(p + H1_FILE_NAME_OFFSET + namelen);\n\tlha->setflag |= CRC_IS_SET;\n\n\tsum_calculated = lha_calcsum(0, p, 2, lha->header_size - 2);\n\t/* Consume used bytes but not include `next header size' data\n\t * since it will be consumed in lha_read_file_extended_header(). */\n\t__archive_read_consume(a, lha->header_size - 2);\n\n\t/* Read extended headers */\n\terr2 = lha_read_file_extended_header(a, lha, NULL, 2,\n\t (size_t)(lha->compsize + 2), &extdsize);\n\tif (err2 < ARCHIVE_WARN)\n\t\treturn (err2);\n\tif (err2 < err)\n\t\terr = err2;\n\t/* Get a real compressed file size. */\n\tlha->compsize -= extdsize - 2;\n\n\tif (sum_calculated != headersum) {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"LHa header sum error\");\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\treturn (err);\ninvalid:\n\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,\n\t \"Invalid LHa header\");\n\treturn (ARCHIVE_FATAL);\n}","target":"lha_read_file_header_1(struct archive_read *a, struct lha *lha)\n{\n\tconst unsigned char *p;\n\tsize_t extdsize;\n\tint i, err, err2;\n\tint namelen, padding;\n\tunsigned char headersum, sum_calculated;\n\n\terr = ARCHIVE_OK;\n\n\tif ((p = __archive_read_ahead(a, H1_FIXED_SIZE, NULL)) == NULL)\n\t\treturn (truncated_error(a));\n\n\tlha->header_size = p[H1_HEADER_SIZE_OFFSET] + 2;\n\theadersum = p[H1_HEADER_SUM_OFFSET];\n\t/* Note: An extended header size is included in a compsize. */\n\tlha->compsize = archive_le32dec(p + H1_COMP_SIZE_OFFSET);\n\tlha->origsize = archive_le32dec(p + H1_ORIG_SIZE_OFFSET);\n\tlha->mtime = lha_dos_time(p + H1_DOS_TIME_OFFSET);\n\tnamelen = p[H1_NAME_LEN_OFFSET];\n\t/* Calculate a padding size. The result will be normally 0 only(?) */\n\tpadding = ((int)lha->header_size) - H1_FIXED_SIZE - namelen;\n\n\tif (namelen > 230 || padding < 0)\n\t\tgoto invalid;\n\n\tif ((p = __archive_read_ahead(a, lha->header_size, NULL)) == NULL)\n\t\treturn (truncated_error(a));\n\n\tfor (i = 0; i < namelen; i++) {\n\t\tif (p[i + H1_FILE_NAME_OFFSET] == 0xff)\n\t\t\tgoto invalid;/* Invalid filename. */\n\t}\n\tarchive_strncpy(&lha->filename, p + H1_FILE_NAME_OFFSET, namelen);\n\tlha->crc = archive_le16dec(p + H1_FILE_NAME_OFFSET + namelen);\n\tlha->setflag |= CRC_IS_SET;\n\n\tsum_calculated = lha_calcsum(0, p, 2, lha->header_size - 2);\n\t/* Consume used bytes but not include `next header size' data\n\t * since it will be consumed in lha_read_file_extended_header(). */\n\t__archive_read_consume(a, lha->header_size - 2);\n\n\t/* Read extended headers */\n\terr2 = lha_read_file_extended_header(a, lha, NULL, 2,\n\t (size_t)(lha->compsize + 2), &extdsize);\n\tif (err2 < ARCHIVE_WARN)\n\t\treturn (err2);\n\tif (err2 < err)\n\t\terr = err2;\n\t/* Get a real compressed file size. */\n\tlha->compsize -= extdsize - 2;\n\n\tif (lha->compsize < 0)\n\t\tgoto invalid;\t/* Invalid compressed file size */\n\n\tif (sum_calculated != headersum) {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"LHa header sum error\");\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\treturn (err);\ninvalid:\n\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,\n\t \"Invalid LHa header\");\n\treturn (ARCHIVE_FATAL);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"lha_read_file_header_1","file_name":"libarchive/archive_read_support_format_lha.c","commit_link":"github.com/libarchive/libarchive/commit/98dcbbf0bf4854bf987557e55e55fff7abbf3ea9","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#4-75df1ad03200","input":"static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track)\n{\n AC3HeaderInfo *hdr = NULL;\n struct eac3_info *info;\n int num_blocks, ret;\n\n if (!track->eac3_priv && !(track->eac3_priv = av_mallocz(sizeof(*info))))\n return AVERROR(ENOMEM);\n info = track->eac3_priv;\n\n if (avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0) {\n /* drop the packets until we see a good one */\n if (!track->entry) {\n av_log(mov, AV_LOG_WARNING, \"Dropping invalid packet from start of the stream\\n\");\n ret = 0;\n } else\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n\n info->data_rate = FFMAX(info->data_rate, hdr->bit_rate / 1000);\n num_blocks = hdr->num_blocks;\n\n if (!info->ec3_done) {\n /* AC-3 substream must be the first one */\n if (hdr->bitstream_id <= 10 && hdr->substreamid != 0) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n\n /* this should always be the case, given that our AC-3 parser\n * concatenates dependent frames to their independent parent */\n if (hdr->frame_type == EAC3_FRAME_TYPE_INDEPENDENT) {\n /* substream ids must be incremental */\n if (hdr->substreamid > info->num_ind_sub + 1) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n\n if (hdr->substreamid == info->num_ind_sub + 1) {\n //info->num_ind_sub++;\n avpriv_request_sample(track->par, \"Multiple independent substreams\");\n ret = AVERROR_PATCHWELCOME;\n goto end;\n } else if (hdr->substreamid < info->num_ind_sub ||\n hdr->substreamid == 0 && info->substream[0].bsid) {\n info->ec3_done = 1;\n goto concatenate;\n }\n } else {\n if (hdr->substreamid != 0) {\n avpriv_request_sample(mov->fc, \"Multiple non EAC3 independent substreams\");\n ret = AVERROR_PATCHWELCOME;\n goto end;\n }\n }\n\n /* fill the info needed for the \"dec3\" atom */\n info->substream[hdr->substreamid].fscod = hdr->sr_code;\n info->substream[hdr->substreamid].bsid = hdr->bitstream_id;\n info->substream[hdr->substreamid].bsmod = hdr->bitstream_mode;\n info->substream[hdr->substreamid].acmod = hdr->channel_mode;\n info->substream[hdr->substreamid].lfeon = hdr->lfe_on;\n\n /* Parse dependent substream(s), if any */\n if (pkt->size != hdr->frame_size) {\n int cumul_size = hdr->frame_size;\n int parent = hdr->substreamid;\n\n while (cumul_size != pkt->size) {\n GetBitContext gbc;\n int i;\n ret = avpriv_ac3_parse_header(&hdr, pkt->data + cumul_size, pkt->size - cumul_size);\n if (ret < 0)\n goto end;\n if (hdr->frame_type != EAC3_FRAME_TYPE_DEPENDENT) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n info->substream[parent].num_dep_sub++;\n ret /= 8;\n\n /* header is parsed up to lfeon, but custom channel map may be needed */\n init_get_bits8(&gbc, pkt->data + cumul_size + ret, pkt->size - cumul_size - ret);\n /* skip bsid */\n skip_bits(&gbc, 5);\n /* skip volume control params */\n for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {\n skip_bits(&gbc, 5); // skip dialog normalization\n if (get_bits1(&gbc)) {\n skip_bits(&gbc, 8); // skip compression gain word\n }\n }\n /* get the dependent stream channel map, if exists */\n if (get_bits1(&gbc))\n info->substream[parent].chan_loc |= (get_bits(&gbc, 16) >> 5) & 0x1f;\n else\n info->substream[parent].chan_loc |= hdr->channel_mode;\n cumul_size += hdr->frame_size;\n }\n }\n }\n\nconcatenate:\n if (!info->num_blocks && num_blocks == 6) {\n ret = pkt->size;\n goto end;\n }\n else if (info->num_blocks + num_blocks > 6) {\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n\n if (!info->num_blocks) {\n ret = av_packet_ref(&info->pkt, pkt);\n if (!ret)\n info->num_blocks = num_blocks;\n goto end;\n } else {\n if ((ret = av_grow_packet(&info->pkt, pkt->size)) < 0)\n goto end;\n memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size);\n info->num_blocks += num_blocks;\n info->pkt.duration += pkt->duration;\n if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0)\n goto end;\n if (info->num_blocks != 6)\n goto end;\n av_packet_unref(pkt);\n av_packet_move_ref(pkt, &info->pkt);\n info->num_blocks = 0;\n }\n ret = pkt->size;\n\nend:\n av_free(hdr);\n\n return ret;\n}","target":"static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track)\n{\n AC3HeaderInfo *hdr = NULL;\n struct eac3_info *info;\n int num_blocks, ret;\n\n if (!track->eac3_priv && !(track->eac3_priv = av_mallocz(sizeof(*info))))\n return AVERROR(ENOMEM);\n info = track->eac3_priv;\n\n if (avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size) < 0) {\n /* drop the packets until we see a good one */\n if (!track->entry) {\n av_log(mov, AV_LOG_WARNING, \"Dropping invalid packet from start of the stream\\n\");\n ret = 0;\n } else\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n\n info->data_rate = FFMAX(info->data_rate, hdr->bit_rate / 1000);\n num_blocks = hdr->num_blocks;\n\n if (!info->ec3_done) {\n /* AC-3 substream must be the first one */\n if (hdr->bitstream_id <= 10 && hdr->substreamid != 0) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n\n /* this should always be the case, given that our AC-3 parser\n * concatenates dependent frames to their independent parent */\n if (hdr->frame_type == EAC3_FRAME_TYPE_INDEPENDENT) {\n /* substream ids must be incremental */\n if (hdr->substreamid > info->num_ind_sub + 1) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n\n if (hdr->substreamid == info->num_ind_sub + 1) {\n //info->num_ind_sub++;\n avpriv_request_sample(mov->fc, \"Multiple independent substreams\");\n ret = AVERROR_PATCHWELCOME;\n goto end;\n } else if (hdr->substreamid < info->num_ind_sub ||\n hdr->substreamid == 0 && info->substream[0].bsid) {\n info->ec3_done = 1;\n goto concatenate;\n }\n } else {\n if (hdr->substreamid != 0) {\n avpriv_request_sample(mov->fc, \"Multiple non EAC3 independent substreams\");\n ret = AVERROR_PATCHWELCOME;\n goto end;\n }\n }\n\n /* fill the info needed for the \"dec3\" atom */\n info->substream[hdr->substreamid].fscod = hdr->sr_code;\n info->substream[hdr->substreamid].bsid = hdr->bitstream_id;\n info->substream[hdr->substreamid].bsmod = hdr->bitstream_mode;\n info->substream[hdr->substreamid].acmod = hdr->channel_mode;\n info->substream[hdr->substreamid].lfeon = hdr->lfe_on;\n\n /* Parse dependent substream(s), if any */\n if (pkt->size != hdr->frame_size) {\n int cumul_size = hdr->frame_size;\n int parent = hdr->substreamid;\n\n while (cumul_size != pkt->size) {\n GetBitContext gbc;\n int i;\n ret = avpriv_ac3_parse_header(&hdr, pkt->data + cumul_size, pkt->size - cumul_size);\n if (ret < 0)\n goto end;\n if (hdr->frame_type != EAC3_FRAME_TYPE_DEPENDENT) {\n ret = AVERROR(EINVAL);\n goto end;\n }\n info->substream[parent].num_dep_sub++;\n ret /= 8;\n\n /* header is parsed up to lfeon, but custom channel map may be needed */\n init_get_bits8(&gbc, pkt->data + cumul_size + ret, pkt->size - cumul_size - ret);\n /* skip bsid */\n skip_bits(&gbc, 5);\n /* skip volume control params */\n for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {\n skip_bits(&gbc, 5); // skip dialog normalization\n if (get_bits1(&gbc)) {\n skip_bits(&gbc, 8); // skip compression gain word\n }\n }\n /* get the dependent stream channel map, if exists */\n if (get_bits1(&gbc))\n info->substream[parent].chan_loc |= (get_bits(&gbc, 16) >> 5) & 0x1f;\n else\n info->substream[parent].chan_loc |= hdr->channel_mode;\n cumul_size += hdr->frame_size;\n }\n }\n }\n\nconcatenate:\n if (!info->num_blocks && num_blocks == 6) {\n ret = pkt->size;\n goto end;\n }\n else if (info->num_blocks + num_blocks > 6) {\n ret = AVERROR_INVALIDDATA;\n goto end;\n }\n\n if (!info->num_blocks) {\n ret = av_packet_ref(&info->pkt, pkt);\n if (!ret)\n info->num_blocks = num_blocks;\n goto end;\n } else {\n if ((ret = av_grow_packet(&info->pkt, pkt->size)) < 0)\n goto end;\n memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size);\n info->num_blocks += num_blocks;\n info->pkt.duration += pkt->duration;\n if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0)\n goto end;\n if (info->num_blocks != 6)\n goto end;\n av_packet_unref(pkt);\n av_packet_move_ref(pkt, &info->pkt);\n info->num_blocks = 0;\n }\n ret = pkt->size;\n\nend:\n av_free(hdr);\n\n return ret;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"handle_eac3","file_name":"libavformat/movenc.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/95556e27e2c1d56d9e18f5db34d6f756f3011148","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#5-5be13d78c64c","input":"static void set_fdc(int drive)\n{\n\tif (drive >= 0 && drive < N_DRIVE) {\n\t\tfdc = FDC(drive);\n\t\tcurrent_drive = drive;\n\t}\n\tif (fdc != 1 && fdc != 0) {\n\t\tpr_info(\"bad fdc value\\n\");\n\t\treturn;\n\t}\n\tset_dor(fdc, ~0, 8);\n#if N_FDC > 1\n\tset_dor(1 - fdc, ~8, 0);\n#endif\n\tif (FDCS->rawcmd == 2)\n\t\treset_fdc_info(1);\n\tif (fd_inb(FD_STATUS) != STATUS_READY)\n\t\tFDCS->reset = 1;\n}","target":"static void set_fdc(int drive)\n{\n\tunsigned int new_fdc = fdc;\n\n\tif (drive >= 0 && drive < N_DRIVE) {\n\t\tnew_fdc = FDC(drive);\n\t\tcurrent_drive = drive;\n\t}\n\tif (new_fdc >= N_FDC) {\n\t\tpr_info(\"bad fdc value\\n\");\n\t\treturn;\n\t}\n\tfdc = new_fdc;\n\tset_dor(fdc, ~0, 8);\n#if N_FDC > 1\n\tset_dor(1 - fdc, ~8, 0);\n#endif\n\tif (FDCS->rawcmd == 2)\n\t\treset_fdc_info(1);\n\tif (fd_inb(FD_STATUS) != STATUS_READY)\n\t\tFDCS->reset = 1;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"set_fdc","file_name":"drivers/block/floppy.c","commit_link":"github.com/torvalds/linux/commit/2e90ca68b0d2f5548804f22f0dd61145516171e3","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#6-46073c977f28","input":"static int opmov(RAsm *a, ut8 *data, const Opcode *op) {\n\tint l = 0;\n\tst64 offset = 0;\n\tint mod = 0;\n\tint base = 0;\n\tint rex = 0;\n\tut64 immediate = 0;\n\tif (op->operands[1].type & OT_CONSTANT) {\n\t\tif (!op->operands[1].is_good_flag) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (op->operands[1].immediate == -1) {\n\t\t\treturn -1;\n\t\t}\n\t\timmediate = op->operands[1].immediate * op->operands[1].sign;\n\t\tif (op->operands[0].type & OT_GPREG && !(op->operands[0].type & OT_MEMORY)) {\n\t\t\tif (a->bits == 64 && ((op->operands[0].type & OT_QWORD) | (op->operands[1].type & OT_QWORD))) {\n\t\t\t\tif (!(op->operands[1].type & OT_CONSTANT) && op->operands[1].extended) {\n\t\t\t\t\tdata[l++] = 0x49;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t} else if (op->operands[0].extended) {\n\t\t\t\tdata[l++] = 0x41;\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\t\tif (a->bits > 16) {\n\t\t\t\t\tdata[l++] = 0x66;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_BYTE) {\n\t\t\t\tdata[l++] = 0xb0 | op->operands[0].reg;\n\t\t\t\tdata[l++] = immediate;\n\t\t\t} else {\n\t\t\t\tif (a->bits == 64 &&\n\t\t\t\t\t((op->operands[0].type & OT_QWORD) |\n\t\t\t\t\t(op->operands[1].type & OT_QWORD)) &&\n\t\t\t\t\timmediate < UT32_MAX) {\n\t\t\t\t\t\tdata[l++] = 0xc7;\n\t\t\t\t \t\tdata[l++] = 0xc0 | op->operands[0].reg;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = 0xb8 | op->operands[0].reg;\n\t\t\t\t}\n\t\t\t\tdata[l++] = immediate;\n\t\t\t\tdata[l++] = immediate >> 8;\n\t\t\t\tif (!(op->operands[0].type & OT_WORD)) {\n\t\t\t\t\tdata[l++] = immediate >> 16;\n\t\t\t\t\tdata[l++] = immediate >> 24;\n\t\t\t\t}\n\t\t\t\tif (a->bits == 64 && immediate > UT32_MAX) {\n\t\t\t\t\tdata[l++] = immediate >> 32;\n\t\t\t\t\tdata[l++] = immediate >> 40;\n\t\t\t\t\tdata[l++] = immediate >> 48;\n\t\t\t\t\tdata[l++] = immediate >> 56;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (op->operands[0].type & OT_MEMORY) {\n\t\t\tif (!op->operands[0].explicit_size) {\n\t\t\t\tif (op->operands[0].type & OT_GPREG) {\n\t\t\t\t\t((Opcode *)op)->operands[0].dest_size = op->operands[0].reg_size;\n\t\t\t\t} else {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint dest_bits = 8 * ((op->operands[0].dest_size & ALL_SIZE) >> OPSIZE_SHIFT);\n\t\t\tint reg_bits = 8 * ((op->operands[0].reg_size & ALL_SIZE) >> OPSIZE_SHIFT);\n\t\t\tint offset = op->operands[0].offset * op->operands[0].offset_sign;\n\n\t\t\t//addr_size_override prefix\n\t\t\tbool use_aso = false;\n\t\t\tif (reg_bits < a->bits) {\n\t\t\t\tuse_aso = true;\n\t\t\t}\n\n\t\t\t//op_size_override prefix\n\t\t\tbool use_oso = false;\n\t\t\tif (dest_bits == 16) {\n\t\t\t\tuse_oso = true;\n\t\t\t}\n\n\t\t\tbool rip_rel = op->operands[0].regs[0] == X86R_RIP;\n\n\t\t\t//rex prefix\n\t\t\tint rex = 1 << 6;\n\t\t\tbool use_rex = false;\n\t\t\tif (dest_bits == 64) {\t\t\t//W field\n\t\t\t\tuse_rex = true;\n\t\t\t\trex |= 1 << 3;\n\t\t\t}\n\t\t\tif (op->operands[0].extended) {\t\t//B field\n\t\t\t\tuse_rex = true;\n\t\t\t\trex |= 1;\n\t\t\t}\n\n\t\t\t//opcode selection\n\t\t\tint opcode;\n\t\t\tif (dest_bits == 8) {\n\t\t\t\topcode = 0xc6;\n\t\t\t} else {\n\t\t\t\topcode = 0xc7;\n\t\t\t}\n\n\t\t\t//modrm and SIB selection\n\t\t\tint modrm = 0;\n\t\t\tint mod;\n\t\t\tint reg = 0;\n\t\t\tint rm;\n\t\t\tbool use_sib = false;\n\t\t\tint sib;\n\t\t\t//mod\n\t\t\tif (offset == 0) {\n\t\t\t\tmod = 0;\n\t\t\t} else if (offset < 128 && offset > -129) {\n\t\t\t\tmod = 1;\n\t\t\t} else {\n\t\t\t\tmod = 2;\n\t\t\t}\n\n\t\t\tif (reg_bits == 16) {\n\t\t\t\tif (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_SI) {\n\t\t\t\t\trm = B0000;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_DI) {\n\t\t\t\t\trm = B0001;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_SI) {\n\t\t\t\t\trm = B0010;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_DI) {\n\t\t\t\t\trm = B0011;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_SI && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0100;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_DI && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0101;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0111;\n\t\t\t\t} else {\n\t\t\t\t\t//TODO allow for displacement only when parser is reworked\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tmodrm = (mod << 6) | (reg << 3) | rm;\n\t\t\t} else {\n\t\t\t\t//rm\n\t\t\t\tif (op->operands[0].extended) {\n\t\t\t\t\trm = op->operands[0].reg;\n\t\t\t\t} else {\n\t\t\t\t\trm = op->operands[0].regs[0];\n\t\t\t\t}\n\t\t\t\t//[epb] alone is illegal, so we need to fake a [ebp+0]\n\t\t\t\tif (rm == 5 && mod == 0) {\n\t\t\t\t\tmod = 1;\n\t\t\t\t}\n\n\t\t\t\t//sib\n\t\t\t\tint index = op->operands[0].regs[1];\n\t\t\t\tint scale = getsib(op->operands[0].scale[1]);\n\t\t\t\tif (index != -1) {\n\t\t\t\t\tuse_sib = true;\n\t\t\t\t\tsib = (scale << 6) | (index << 3) | rm;\n\t\t\t\t} else if (rm == 4) {\n\t\t\t\t\tuse_sib = true;\n\t\t\t\t\tsib = 0x24;\n\t\t\t\t}\n\t\t\t\tif (use_sib) {\n\t\t\t\t\trm = B0100;\n\t\t\t\t}\n\t\t\t\tif (rip_rel) {\n\t\t\t\t\tmodrm = (B0000 << 6) | (reg << 3) | B0101;\n\t\t\t\t\tsib = (scale << 6) | (B0100 << 3) | B0101;\n\t\t\t\t} else {\n\t\t\t\t\tmodrm = (mod << 6) | (reg << 3) | rm;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//build the final result\n\t\t\tif (use_aso) {\n\t\t\t\tdata[l++] = 0x67;\n\t\t\t}\n\t\t\tif (use_oso) {\n\t\t\t\tdata[l++] = 0x66;\n\t\t\t}\n\t\t\tif (use_rex) {\n\t\t\t\tdata[l++] = rex;\n\t\t\t}\n\t\t\tdata[l++] = opcode;\n\t\t\tdata[l++] = modrm;\n\t\t\tif (use_sib) {\n\t\t\t\tdata[l++] = sib;\n\t\t\t}\n\t\t\t//offset\n\t\t\tif (mod == 1) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t} else if (reg_bits == 16 && mod == 2) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t} else if (mod == 2 || rip_rel) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t}\n\t\t\t//immediate\n\t\t\tint byte;\n\t\t\tfor (byte = 0; byte < dest_bits && byte < 32; byte += 8) {\n\t\t\t\tdata[l++] = (immediate >> byte);\n\t\t\t}\n\t\t}\n\t} else if (op->operands[1].type & OT_REGALL &&\n\t\t\t !(op->operands[1].type & OT_MEMORY)) {\n\t\tif (op->operands[0].type & OT_CONSTANT) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG &&\n\t\t op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\t\treturn -1;\n\t\t}\n\t\t// Check reg sizes match\n\t\tif (op->operands[0].type & OT_REGTYPE && op->operands[1].type & OT_REGTYPE) {\n\t\t\tif (!((op->operands[0].type & ALL_SIZE) &\n\t\t\t(op->operands[1].type & ALL_SIZE))) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\n\t\tif (a->bits == 64) {\n\t\t\tif (op->operands[0].extended) {\n\t\t\t\trex = 1;\n\t\t\t}\n\t\t\tif (op->operands[1].extended) {\n\t\t\t\trex += 4;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD) {\n\t\t\t\tif (!(op->operands[0].type & OT_QWORD)) {\n\t\t\t\t\tdata[l++] = 0x67;\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD &&\n\t\t\t\top->operands[0].type & OT_QWORD) {\n\t\t\t\tdata[l++] = 0x48 | rex;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_DWORD &&\n\t\t\t\top->operands[0].type & OT_DWORD) {\n\t\t\t\tdata[l++] = 0x40 | rex;\n\t\t\t}\n\t\t} else if (op->operands[0].extended && op->operands[1].extended) {\n\t\t\tdata[l++] = 0x45;\n\t\t}\n\t\toffset = op->operands[0].offset * op->operands[0].offset_sign;\n\t\tif (op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\tdata[l++] = 0x8c;\n\t\t} else {\n\t\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\t\tdata[l++] = 0x66;\n\t\t\t}\n\t\t\tdata[l++] = (op->operands[0].type & OT_BYTE) ? 0x88 : 0x89;\n\t\t}\n\n\t\tif (op->operands[0].scale[0] > 1) {\n\t\t\t\tdata[l++] = op->operands[1].reg << 3 | 4;\n\t\t\t\tdata[l++] = getsib (op->operands[0].scale[0]) << 6 |\n\t\t\t\t\t\t op->operands[0].regs[0] << 3 | 5;\n\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\tdata[l++] = offset >> 24;\n\n\t\t\t\treturn l;\n\t\t\t}\n\n\t\tif (!(op->operands[0].type & OT_MEMORY)) {\n\t\t\tif (op->operands[0].reg == X86R_UNDEFINED ||\n\t\t\t\top->operands[1].reg == X86R_UNDEFINED) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tmod = 0x3;\n\t\t\tdata[l++] = mod << 6 | op->operands[1].reg << 3 | op->operands[0].reg;\n\t\t} else if (op->operands[0].regs[0] == X86R_UNDEFINED) {\n\t\t\tdata[l++] = op->operands[1].reg << 3 | 0x5;\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t} else {\n\t\t\tif (op->operands[0].type & OT_MEMORY) {\n\t\t\t\tif (op->operands[0].regs[1] != X86R_UNDEFINED) {\n\t\t\t\t\tdata[l++] = op->operands[1].reg << 3 | 0x4;\n\t\t\t\t\tdata[l++] = op->operands[0].regs[1] << 3 | op->operands[0].regs[0];\n\t\t\t\t\treturn l;\n\t\t\t\t}\n\t\t\t\tif (offset) {\n\t\t\t\t\tmod = (offset > 128 || offset < -129) ? 0x2 : 0x1;\n\t\t\t\t}\n\t\t\t\tif (op->operands[0].regs[0] == X86R_EBP) {\n\t\t\t\t\tmod = 0x2;\n\t\t\t\t}\n\t\t\t\tdata[l++] = mod << 6 | op->operands[1].reg << 3 | op->operands[0].regs[0];\n\t\t\t\tif (op->operands[0].regs[0] == X86R_ESP) {\n\t\t\t\t\tdata[l++] = 0x24;\n\t\t\t\t}\n\t\t\t\tif (offset) {\n\t\t\t\t\tdata[l++] = offset;\n\t\t\t\t}\n\t\t\t\tif (mod == 2) {\n\t\t\t\t\t// warning C4293: '>>': shift count negative or too big, undefined behavior\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if (op->operands[1].type & OT_MEMORY) {\n\t\tif (op->operands[0].type & OT_MEMORY) {\n\t\t\treturn -1;\n\t\t}\n\t\toffset = op->operands[1].offset * op->operands[1].offset_sign;\n\t\tif (op->operands[0].reg == X86R_EAX && op->operands[1].regs[0] == X86R_UNDEFINED) {\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = 0x48;\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_BYTE) {\n\t\t\t\tdata[l++] = 0xa0;\n\t\t\t} else {\n\t\t\t\tdata[l++] = 0xa1;\n\t\t\t}\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = offset >> 32;\n\t\t\t\tdata[l++] = offset >> 40;\n\t\t\t\tdata[l++] = offset >> 48;\n\t\t\t\tdata[l++] = offset >> 54;\n\t\t\t}\n\t\t\treturn l;\n\t\t}\n\t\tif (op->operands[0].type & OT_BYTE && a->bits == 64 && op->operands[1].regs[0]) {\n\t\t\tif (op->operands[1].regs[0] >= X86R_R8 &&\n\t\t\t op->operands[0].reg < 4) {\n\t\t\t\tdata[l++] = 0x41;\n\t\t\t\tdata[l++] = 0x8a;\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | (op->operands[1].regs[0] - 8);\n\t\t\t\treturn l;\n\t\t\t}\n\t\t\treturn -1;\n\t\t}\n\n\t\tif (op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\tif (op->operands[1].scale[0] == 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tdata[l++] = SEG_REG_PREFIXES[op->operands[1].regs[0]];\n\t\t\tdata[l++] = 0x8b;\n\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x5;\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t\treturn l;\n\t\t}\n\n\t\tif (a->bits == 64) {\n\t\t\tif (op->operands[0].type & OT_QWORD) {\n\t\t\t\tif (!(op->operands[1].type & OT_QWORD)) {\n\t\t\t\t\tif (op->operands[1].regs[0] != -1) {\n\t\t\t\t\t\tdata[l++] = 0x67;\n\t\t\t\t\t}\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t} else if (op->operands[1].type & OT_DWORD) {\n\t\t\t\tdata[l++] = 0x44;\n\t\t\t} else if (!(op->operands[1].type & OT_QWORD)) {\n\t\t\t\tdata[l++] = 0x67;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD &&\n\t\t\t\top->operands[0].type & OT_QWORD) {\n\t\t\t\tdata[l++] = 0x48;\n\t\t\t}\n\t\t}\n\n\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\tdata[l++] = 0x66;\n\t\t\tdata[l++] = op->operands[1].type & OT_BYTE ? 0x8a : 0x8b;\n\t\t} else {\n\t\t\tdata[l++] = (op->operands[1].type & OT_BYTE ||\n\t\t\t\top->operands[0].type & OT_BYTE) ?\n\t\t\t\t0x8a : 0x8b;\n\t\t}\n\n\t\tif (op->operands[1].regs[0] == X86R_UNDEFINED) {\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x4;\n\t\t\t\tdata[l++] = 0x25;\n\t\t\t} else {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x5;\n\t\t\t}\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t} else {\n\t\t\tif (op->operands[1].scale[0] > 1) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 4;\n\n\t\t\t\tif (op->operands[1].scale[0] >= 2) {\n\t\t\t\t\tbase = 5;\n\t\t\t\t}\n\t\t\t\tif (base) {\n\t\t\t\t\tdata[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | base;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = getsib (op->operands[1].scale[0]) << 3 | op->operands[1].regs[0];\n\t\t\t\t}\n\t\t\t\tif (offset || base) {\n\t\t\t\t\tdata[l++] = offset;\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t\treturn l;\n\t\t\t}\n\t\t\tif (op->operands[1].regs[1] != X86R_UNDEFINED) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x4;\n\t\t\t\tdata[l++] = op->operands[1].regs[1] << 3 | op->operands[1].regs[0];\n\t\t\t\treturn l;\n\t\t\t}\n\n\t\t\tif (offset || op->operands[1].regs[0] == X86R_EBP) {\n\t\t\t\tmod = 0x2;\n\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\tmod = 0x4;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (a->bits == 64 && offset && op->operands[0].type & OT_QWORD) {\n\t\t\t\tif (op->operands[1].regs[0] == X86R_RIP) {\n\t\t\t\t\tdata[l++] = 0x5;\n\t\t\t\t} else {\n\t\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\t\tdata[l++] = 0x80 | op->operands[0].reg << 3 | op->operands[1].regs[0];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdata[l++] = 0x40 | op->operands[1].regs[0];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\tmod = 0x1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (op->operands[1].regs[0] == X86R_EIP && (op->operands[0].type & OT_DWORD)) {\n\t\t\t\t\tdata[l++] = 0x0d;\n\t\t\t\t} else if (op->operands[1].regs[0] == X86R_RIP && (op->operands[0].type & OT_QWORD)) {\n\t\t\t\t\tdata[l++] = 0x05;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = mod << 5 | op->operands[0].reg << 3 | op->operands[1].regs[0];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[1].regs[0] == X86R_ESP) {\n\t\t\t\tdata[l++] = 0x24;\n\t\t\t}\n\t\t\tif (mod >= 0x2) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tif (op->operands[1].offset > 128 || op->operands[1].regs[0] == X86R_EIP) {\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t} else if (a->bits == 64 && (offset || op->operands[1].regs[0] == X86R_RIP)) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tif (op->operands[1].offset > 127 || op->operands[1].regs[0] == X86R_RIP) {\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn l;\n}","target":"static int opmov(RAsm *a, ut8 *data, const Opcode *op) {\n\tint l = 0;\n\tst64 offset = 0;\n\tint mod = 0;\n\tint base = 0;\n\tint rex = 0;\n\tut64 immediate = 0;\n\tif (op->operands[1].type & OT_CONSTANT) {\n\t\tif (!op->operands[1].is_good_flag) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (op->operands[1].immediate == -1) {\n\t\t\treturn -1;\n\t\t}\n\t\timmediate = op->operands[1].immediate * op->operands[1].sign;\n\t\tif (op->operands[0].type & OT_GPREG && !(op->operands[0].type & OT_MEMORY)) {\n\t\t\tif (a->bits == 64 && ((op->operands[0].type & OT_QWORD) | (op->operands[1].type & OT_QWORD))) {\n\t\t\t\tif (!(op->operands[1].type & OT_CONSTANT) && op->operands[1].extended) {\n\t\t\t\t\tdata[l++] = 0x49;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t} else if (op->operands[0].extended) {\n\t\t\t\tdata[l++] = 0x41;\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\t\tif (a->bits > 16) {\n\t\t\t\t\tdata[l++] = 0x66;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_BYTE) {\n\t\t\t\tdata[l++] = 0xb0 | op->operands[0].reg;\n\t\t\t\tdata[l++] = immediate;\n\t\t\t} else {\n\t\t\t\tif (a->bits == 64 &&\n\t\t\t\t\t((op->operands[0].type & OT_QWORD) |\n\t\t\t\t\t(op->operands[1].type & OT_QWORD)) &&\n\t\t\t\t\timmediate < UT32_MAX) {\n\t\t\t\t\t\tdata[l++] = 0xc7;\n\t\t\t\t \t\tdata[l++] = 0xc0 | op->operands[0].reg;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = 0xb8 | op->operands[0].reg;\n\t\t\t\t}\n\t\t\t\tdata[l++] = immediate;\n\t\t\t\tdata[l++] = immediate >> 8;\n\t\t\t\tif (!(op->operands[0].type & OT_WORD)) {\n\t\t\t\t\tdata[l++] = immediate >> 16;\n\t\t\t\t\tdata[l++] = immediate >> 24;\n\t\t\t\t}\n\t\t\t\tif (a->bits == 64 && immediate > UT32_MAX) {\n\t\t\t\t\tdata[l++] = immediate >> 32;\n\t\t\t\t\tdata[l++] = immediate >> 40;\n\t\t\t\t\tdata[l++] = immediate >> 48;\n\t\t\t\t\tdata[l++] = immediate >> 56;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (op->operands[0].type & OT_MEMORY) {\n\t\t\tif (!op->operands[0].explicit_size) {\n\t\t\t\tif (op->operands[0].type & OT_GPREG) {\n\t\t\t\t\t((Opcode *)op)->operands[0].dest_size = op->operands[0].reg_size;\n\t\t\t\t} else {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tint dest_bits = 8 * ((op->operands[0].dest_size & ALL_SIZE) >> OPSIZE_SHIFT);\n\t\t\tint reg_bits = 8 * ((op->operands[0].reg_size & ALL_SIZE) >> OPSIZE_SHIFT);\n\t\t\tint offset = op->operands[0].offset * op->operands[0].offset_sign;\n\n\t\t\t//addr_size_override prefix\n\t\t\tbool use_aso = false;\n\t\t\tif (reg_bits < a->bits) {\n\t\t\t\tuse_aso = true;\n\t\t\t}\n\n\t\t\t//op_size_override prefix\n\t\t\tbool use_oso = false;\n\t\t\tif (dest_bits == 16) {\n\t\t\t\tuse_oso = true;\n\t\t\t}\n\n\t\t\tbool rip_rel = op->operands[0].regs[0] == X86R_RIP;\n\n\t\t\t//rex prefix\n\t\t\tint rex = 1 << 6;\n\t\t\tbool use_rex = false;\n\t\t\tif (dest_bits == 64) {\t\t\t//W field\n\t\t\t\tuse_rex = true;\n\t\t\t\trex |= 1 << 3;\n\t\t\t}\n\t\t\tif (op->operands[0].extended) {\t\t//B field\n\t\t\t\tuse_rex = true;\n\t\t\t\trex |= 1;\n\t\t\t}\n\n\t\t\t//opcode selection\n\t\t\tint opcode;\n\t\t\tif (dest_bits == 8) {\n\t\t\t\topcode = 0xc6;\n\t\t\t} else {\n\t\t\t\topcode = 0xc7;\n\t\t\t}\n\n\t\t\t//modrm and SIB selection\n\t\t\tint modrm = 0;\n\t\t\tint mod;\n\t\t\tint reg = 0;\n\t\t\tint rm;\n\t\t\tbool use_sib = false;\n\t\t\tint sib;\n\t\t\t//mod\n\t\t\tif (offset == 0) {\n\t\t\t\tmod = 0;\n\t\t\t} else if (offset < 128 && offset > -129) {\n\t\t\t\tmod = 1;\n\t\t\t} else {\n\t\t\t\tmod = 2;\n\t\t\t}\n\n\t\t\tif (reg_bits == 16) {\n\t\t\t\tif (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_SI) {\n\t\t\t\t\trm = B0000;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_DI) {\n\t\t\t\t\trm = B0001;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_SI) {\n\t\t\t\t\trm = B0010;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_DI) {\n\t\t\t\t\trm = B0011;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_SI && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0100;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_DI && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0101;\n\t\t\t\t} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == -1) {\n\t\t\t\t\trm = B0111;\n\t\t\t\t} else {\n\t\t\t\t\t//TODO allow for displacement only when parser is reworked\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tmodrm = (mod << 6) | (reg << 3) | rm;\n\t\t\t} else {\n\t\t\t\t//rm\n\t\t\t\tif (op->operands[0].extended) {\n\t\t\t\t\trm = op->operands[0].reg;\n\t\t\t\t} else {\n\t\t\t\t\trm = op->operands[0].regs[0];\n\t\t\t\t}\n\t\t\t\t//[epb] alone is illegal, so we need to fake a [ebp+0]\n\t\t\t\tif (rm == 5 && mod == 0) {\n\t\t\t\t\tmod = 1;\n\t\t\t\t}\n\n\t\t\t\t//sib\n\t\t\t\tint index = op->operands[0].regs[1];\n\t\t\t\tint scale = getsib(op->operands[0].scale[1]);\n\t\t\t\tif (index != -1) {\n\t\t\t\t\tuse_sib = true;\n\t\t\t\t\tsib = (scale << 6) | (index << 3) | rm;\n\t\t\t\t} else if (rm == 4) {\n\t\t\t\t\tuse_sib = true;\n\t\t\t\t\tsib = 0x24;\n\t\t\t\t}\n\t\t\t\tif (use_sib) {\n\t\t\t\t\trm = B0100;\n\t\t\t\t}\n\t\t\t\tif (rip_rel) {\n\t\t\t\t\tmodrm = (B0000 << 6) | (reg << 3) | B0101;\n\t\t\t\t\tsib = (scale << 6) | (B0100 << 3) | B0101;\n\t\t\t\t} else {\n\t\t\t\t\tmodrm = (mod << 6) | (reg << 3) | rm;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//build the final result\n\t\t\tif (use_aso) {\n\t\t\t\tdata[l++] = 0x67;\n\t\t\t}\n\t\t\tif (use_oso) {\n\t\t\t\tdata[l++] = 0x66;\n\t\t\t}\n\t\t\tif (use_rex) {\n\t\t\t\tdata[l++] = rex;\n\t\t\t}\n\t\t\tdata[l++] = opcode;\n\t\t\tdata[l++] = modrm;\n\t\t\tif (use_sib) {\n\t\t\t\tdata[l++] = sib;\n\t\t\t}\n\t\t\t//offset\n\t\t\tif (mod == 1) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t} else if (reg_bits == 16 && mod == 2) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t} else if (mod == 2 || rip_rel) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t}\n\t\t\t//immediate\n\t\t\tint byte;\n\t\t\tfor (byte = 0; byte < dest_bits && byte < 32; byte += 8) {\n\t\t\t\tdata[l++] = (immediate >> byte);\n\t\t\t}\n\t\t}\n\t} else if (op->operands[1].type & OT_REGALL &&\n\t\t\t !(op->operands[1].type & OT_MEMORY)) {\n\t\tif (op->operands[0].type & OT_CONSTANT) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG &&\n\t\t op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\t\treturn -1;\n\t\t}\n\t\t// Check reg sizes match\n\t\tif (op->operands[0].type & OT_REGTYPE && op->operands[1].type & OT_REGTYPE) {\n\t\t\tif (!((op->operands[0].type & ALL_SIZE) &\n\t\t\t(op->operands[1].type & ALL_SIZE))) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\n\t\tif (a->bits == 64) {\n\t\t\tif (op->operands[0].extended) {\n\t\t\t\trex = 1;\n\t\t\t}\n\t\t\tif (op->operands[1].extended) {\n\t\t\t\trex += 4;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD) {\n\t\t\t\tif (!(op->operands[0].type & OT_QWORD)) {\n\t\t\t\t\tdata[l++] = 0x67;\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD &&\n\t\t\t\top->operands[0].type & OT_QWORD) {\n\t\t\t\tdata[l++] = 0x48 | rex;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_DWORD &&\n\t\t\t\top->operands[0].type & OT_DWORD) {\n\t\t\t\tdata[l++] = 0x40 | rex;\n\t\t\t}\n\t\t} else if (op->operands[0].extended && op->operands[1].extended) {\n\t\t\tdata[l++] = 0x45;\n\t\t}\n\t\toffset = op->operands[0].offset * op->operands[0].offset_sign;\n\t\tif (op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\tdata[l++] = 0x8c;\n\t\t} else {\n\t\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\t\tdata[l++] = 0x66;\n\t\t\t}\n\t\t\tdata[l++] = (op->operands[0].type & OT_BYTE) ? 0x88 : 0x89;\n\t\t}\n\n\t\tif (op->operands[0].scale[0] > 1) {\n\t\t\t\tdata[l++] = op->operands[1].reg << 3 | 4;\n\t\t\t\tdata[l++] = getsib (op->operands[0].scale[0]) << 6 |\n\t\t\t\t\t\t op->operands[0].regs[0] << 3 | 5;\n\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\tdata[l++] = offset >> 24;\n\n\t\t\t\treturn l;\n\t\t\t}\n\n\t\tif (!(op->operands[0].type & OT_MEMORY)) {\n\t\t\tif (op->operands[0].reg == X86R_UNDEFINED ||\n\t\t\t\top->operands[1].reg == X86R_UNDEFINED) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tmod = 0x3;\n\t\t\tdata[l++] = mod << 6 | op->operands[1].reg << 3 | op->operands[0].reg;\n\t\t} else if (op->operands[0].regs[0] == X86R_UNDEFINED) {\n\t\t\tdata[l++] = op->operands[1].reg << 3 | 0x5;\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t} else {\n\t\t\tif (op->operands[0].type & OT_MEMORY) {\n\t\t\t\tif (op->operands[0].regs[1] != X86R_UNDEFINED) {\n\t\t\t\t\tdata[l++] = op->operands[1].reg << 3 | 0x4;\n\t\t\t\t\tdata[l++] = op->operands[0].regs[1] << 3 | op->operands[0].regs[0];\n\t\t\t\t\treturn l;\n\t\t\t\t}\n\t\t\t\tif (offset) {\n\t\t\t\t\tmod = (offset > 128 || offset < -129) ? 0x2 : 0x1;\n\t\t\t\t}\n\t\t\t\tif (op->operands[0].regs[0] == X86R_EBP) {\n\t\t\t\t\tmod = 0x2;\n\t\t\t\t}\n\t\t\t\tdata[l++] = mod << 6 | op->operands[1].reg << 3 | op->operands[0].regs[0];\n\t\t\t\tif (op->operands[0].regs[0] == X86R_ESP) {\n\t\t\t\t\tdata[l++] = 0x24;\n\t\t\t\t}\n\t\t\t\tif (offset) {\n\t\t\t\t\tdata[l++] = offset;\n\t\t\t\t}\n\t\t\t\tif (mod == 2) {\n\t\t\t\t\t// warning C4293: '>>': shift count negative or too big, undefined behavior\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if (op->operands[1].type & OT_MEMORY) {\n\t\tif (op->operands[0].type & OT_MEMORY) {\n\t\t\treturn -1;\n\t\t}\n\t\toffset = op->operands[1].offset * op->operands[1].offset_sign;\n\t\tif (op->operands[0].reg == X86R_EAX && op->operands[1].regs[0] == X86R_UNDEFINED) {\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = 0x48;\n\t\t\t}\n\t\t\tif (op->operands[0].type & OT_BYTE) {\n\t\t\t\tdata[l++] = 0xa0;\n\t\t\t} else {\n\t\t\t\tdata[l++] = 0xa1;\n\t\t\t}\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = offset >> 32;\n\t\t\t\tdata[l++] = offset >> 40;\n\t\t\t\tdata[l++] = offset >> 48;\n\t\t\t\tdata[l++] = offset >> 54;\n\t\t\t}\n\t\t\treturn l;\n\t\t}\n\t\tif (op->operands[0].type & OT_BYTE && a->bits == 64 && op->operands[1].regs[0]) {\n\t\t\tif (op->operands[1].regs[0] >= X86R_R8 &&\n\t\t\t op->operands[0].reg < 4) {\n\t\t\t\tdata[l++] = 0x41;\n\t\t\t\tdata[l++] = 0x8a;\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | (op->operands[1].regs[0] - 8);\n\t\t\t\treturn l;\n\t\t\t}\n\t\t\treturn -1;\n\t\t}\n\n\t\tif (op->operands[1].type & OT_REGTYPE & OT_SEGMENTREG) {\n\t\t\tif (op->operands[1].scale[0] == 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tdata[l++] = SEG_REG_PREFIXES[op->operands[1].regs[0] % 6];\n\t\t\tdata[l++] = 0x8b;\n\t\t\tdata[l++] = (((ut32)op->operands[0].reg) << 3) | 0x5;\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t\treturn l;\n\t\t}\n\n\t\tif (a->bits == 64) {\n\t\t\tif (op->operands[0].type & OT_QWORD) {\n\t\t\t\tif (!(op->operands[1].type & OT_QWORD)) {\n\t\t\t\t\tif (op->operands[1].regs[0] != -1) {\n\t\t\t\t\t\tdata[l++] = 0x67;\n\t\t\t\t\t}\n\t\t\t\t\tdata[l++] = 0x48;\n\t\t\t\t}\n\t\t\t} else if (op->operands[1].type & OT_DWORD) {\n\t\t\t\tdata[l++] = 0x44;\n\t\t\t} else if (!(op->operands[1].type & OT_QWORD)) {\n\t\t\t\tdata[l++] = 0x67;\n\t\t\t}\n\t\t\tif (op->operands[1].type & OT_QWORD &&\n\t\t\t\top->operands[0].type & OT_QWORD) {\n\t\t\t\tdata[l++] = 0x48;\n\t\t\t}\n\t\t}\n\n\t\tif (op->operands[0].type & OT_WORD) {\n\t\t\tdata[l++] = 0x66;\n\t\t\tdata[l++] = op->operands[1].type & OT_BYTE ? 0x8a : 0x8b;\n\t\t} else {\n\t\t\tdata[l++] = (op->operands[1].type & OT_BYTE ||\n\t\t\t\top->operands[0].type & OT_BYTE) ?\n\t\t\t\t0x8a : 0x8b;\n\t\t}\n\n\t\tif (op->operands[1].regs[0] == X86R_UNDEFINED) {\n\t\t\tif (a->bits == 64) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x4;\n\t\t\t\tdata[l++] = 0x25;\n\t\t\t} else {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x5;\n\t\t\t}\n\t\t\tdata[l++] = offset;\n\t\t\tdata[l++] = offset >> 8;\n\t\t\tdata[l++] = offset >> 16;\n\t\t\tdata[l++] = offset >> 24;\n\t\t} else {\n\t\t\tif (op->operands[1].scale[0] > 1) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 4;\n\n\t\t\t\tif (op->operands[1].scale[0] >= 2) {\n\t\t\t\t\tbase = 5;\n\t\t\t\t}\n\t\t\t\tif (base) {\n\t\t\t\t\tdata[l++] = getsib (op->operands[1].scale[0]) << 6 | op->operands[1].regs[0] << 3 | base;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = getsib (op->operands[1].scale[0]) << 3 | op->operands[1].regs[0];\n\t\t\t\t}\n\t\t\t\tif (offset || base) {\n\t\t\t\t\tdata[l++] = offset;\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t\treturn l;\n\t\t\t}\n\t\t\tif (op->operands[1].regs[1] != X86R_UNDEFINED) {\n\t\t\t\tdata[l++] = op->operands[0].reg << 3 | 0x4;\n\t\t\t\tdata[l++] = op->operands[1].regs[1] << 3 | op->operands[1].regs[0];\n\t\t\t\treturn l;\n\t\t\t}\n\n\t\t\tif (offset || op->operands[1].regs[0] == X86R_EBP) {\n\t\t\t\tmod = 0x2;\n\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\tmod = 0x4;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (a->bits == 64 && offset && op->operands[0].type & OT_QWORD) {\n\t\t\t\tif (op->operands[1].regs[0] == X86R_RIP) {\n\t\t\t\t\tdata[l++] = 0x5;\n\t\t\t\t} else {\n\t\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\t\tdata[l++] = 0x80 | op->operands[0].reg << 3 | op->operands[1].regs[0];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdata[l++] = 0x40 | op->operands[1].regs[0];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (op->operands[1].offset > 127) {\n\t\t\t\t\tmod = 0x1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (op->operands[1].regs[0] == X86R_EIP && (op->operands[0].type & OT_DWORD)) {\n\t\t\t\t\tdata[l++] = 0x0d;\n\t\t\t\t} else if (op->operands[1].regs[0] == X86R_RIP && (op->operands[0].type & OT_QWORD)) {\n\t\t\t\t\tdata[l++] = 0x05;\n\t\t\t\t} else {\n\t\t\t\t\tdata[l++] = mod << 5 | op->operands[0].reg << 3 | op->operands[1].regs[0];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op->operands[1].regs[0] == X86R_ESP) {\n\t\t\t\tdata[l++] = 0x24;\n\t\t\t}\n\t\t\tif (mod >= 0x2) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tif (op->operands[1].offset > 128 || op->operands[1].regs[0] == X86R_EIP) {\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t} else if (a->bits == 64 && (offset || op->operands[1].regs[0] == X86R_RIP)) {\n\t\t\t\tdata[l++] = offset;\n\t\t\t\tif (op->operands[1].offset > 127 || op->operands[1].regs[0] == X86R_RIP) {\n\t\t\t\t\tdata[l++] = offset >> 8;\n\t\t\t\t\tdata[l++] = offset >> 16;\n\t\t\t\t\tdata[l++] = offset >> 24;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn l;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"opmov","file_name":"libr/asm/p/asm_x86_nz.c","commit_link":"github.com/radare/radare2/commit/f17bfd9f1da05f30f23a4dd05e9d2363e1406948","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#7-ccfc7e06ae9d","input":"int ares_parse_a_reply(const unsigned char *abuf, int alen,\n\t\t struct hostent **host)\n{\n unsigned int qdcount, ancount;\n int status, i, rr_type, rr_class, rr_len, naddrs;\n long int len;\n int naliases;\n const unsigned char *aptr;\n char *hostname, *rr_name, *rr_data, **aliases;\n struct in_addr *addrs;\n struct hostent *hostent;\n\n /* Set *host to NULL for all failure cases. */\n *host = NULL;\n\n /* Give up if abuf doesn't have room for a header. */\n if (alen < HFIXEDSZ)\n return ARES_EBADRESP;\n\n /* Fetch the question and answer count from the header. */\n qdcount = DNS_HEADER_QDCOUNT(abuf);\n ancount = DNS_HEADER_ANCOUNT(abuf);\n if (qdcount != 1)\n return ARES_EBADRESP;\n\n /* Expand the name from the question, and skip past the question. */\n aptr = abuf + HFIXEDSZ;\n status = ares_expand_name(aptr, abuf, alen, &hostname, &len);\n if (status != ARES_SUCCESS)\n return status;\n if (aptr + len + QFIXEDSZ > abuf + alen)\n {\n free(hostname);\n return ARES_EBADRESP;\n }\n aptr += len + QFIXEDSZ;\n\n /* Allocate addresses and aliases; ancount gives an upper bound for both. */\n addrs = malloc(ancount * sizeof(struct in_addr));\n if (!addrs)\n {\n free(hostname);\n return ARES_ENOMEM;\n }\n aliases = malloc((ancount + 1) * sizeof(char *));\n if (!aliases)\n {\n free(hostname);\n free(addrs);\n return ARES_ENOMEM;\n }\n naddrs = 0;\n naliases = 0;\n\n /* Examine each answer resource record (RR) in turn. */\n for (i = 0; i < (int)ancount; i++)\n {\n /* Decode the RR up to the data field. */\n status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);\n if (status != ARES_SUCCESS)\n\tbreak;\n aptr += len;\n if (aptr + RRFIXEDSZ > abuf + alen)\n\t{\n\t free(rr_name);\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n rr_type = DNS_RR_TYPE(aptr);\n rr_class = DNS_RR_CLASS(aptr);\n rr_len = DNS_RR_LEN(aptr);\n aptr += RRFIXEDSZ;\n\n if (rr_class == C_IN && rr_type == T_A\n\t && rr_len == sizeof(struct in_addr)\n\t && strcasecmp(rr_name, hostname) == 0)\n\t{\n\t memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr));\n\t naddrs++;\n\t status = ARES_SUCCESS;\n\t}\n\n if (rr_class == C_IN && rr_type == T_CNAME)\n\t{\n\t /* Record the RR name as an alias. */\n\t aliases[naliases] = rr_name;\n\t naliases++;\n\n\t /* Decode the RR data and replace the hostname with it. */\n\t status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);\n\t if (status != ARES_SUCCESS)\n\t break;\n\t free(hostname);\n\t hostname = rr_data;\n\t}\n else\n\tfree(rr_name);\n\n aptr += rr_len;\n if (aptr > abuf + alen)\n\t{\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n }\n\n if (status == ARES_SUCCESS && naddrs == 0)\n status = ARES_ENODATA;\n if (status == ARES_SUCCESS)\n {\n /* We got our answer. Allocate memory to build the host entry. */\n aliases[naliases] = NULL;\n hostent = malloc(sizeof(struct hostent));\n if (hostent)\n\t{\n\t hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));\n\t if (hostent->h_addr_list)\n\t {\n\t /* Fill in the hostent and return successfully. */\n\t hostent->h_name = hostname;\n\t hostent->h_aliases = aliases;\n\t hostent->h_addrtype = AF_INET;\n\t hostent->h_length = sizeof(struct in_addr);\n\t for (i = 0; i < naddrs; i++)\n\t\thostent->h_addr_list[i] = (char *) &addrs[i];\n\t hostent->h_addr_list[naddrs] = NULL;\n\t *host = hostent;\n\t return ARES_SUCCESS;\n\t }\n\t free(hostent);\n\t}\n status = ARES_ENOMEM;\n }\n for (i = 0; i < naliases; i++)\n free(aliases[i]);\n free(aliases);\n free(addrs);\n free(hostname);\n return status;\n}","target":"int ares_parse_a_reply(const unsigned char *abuf, int alen,\n\t\t struct hostent **host)\n{\n unsigned int qdcount, ancount;\n int status, i, rr_type, rr_class, rr_len, naddrs;\n long int len;\n int naliases;\n const unsigned char *aptr;\n char *hostname, *rr_name, *rr_data, **aliases;\n struct in_addr *addrs;\n struct hostent *hostent;\n\n /* Set *host to NULL for all failure cases. */\n *host = NULL;\n\n /* Give up if abuf doesn't have room for a header. */\n if (alen < HFIXEDSZ)\n return ARES_EBADRESP;\n\n /* Fetch the question and answer count from the header. */\n qdcount = DNS_HEADER_QDCOUNT(abuf);\n ancount = DNS_HEADER_ANCOUNT(abuf);\n if (qdcount != 1)\n return ARES_EBADRESP;\n\n /* Expand the name from the question, and skip past the question. */\n aptr = abuf + HFIXEDSZ;\n status = ares_expand_name(aptr, abuf, alen, &hostname, &len);\n if (status != ARES_SUCCESS)\n return status;\n if (aptr + len + QFIXEDSZ > abuf + alen)\n {\n free(hostname);\n return ARES_EBADRESP;\n }\n aptr += len + QFIXEDSZ;\n\n /* Allocate addresses and aliases; ancount gives an upper bound for both. */\n addrs = malloc(ancount * sizeof(struct in_addr));\n if (!addrs)\n {\n free(hostname);\n return ARES_ENOMEM;\n }\n aliases = malloc((ancount + 1) * sizeof(char *));\n if (!aliases)\n {\n free(hostname);\n free(addrs);\n return ARES_ENOMEM;\n }\n naddrs = 0;\n naliases = 0;\n\n /* Examine each answer resource record (RR) in turn. */\n for (i = 0; i < (int)ancount; i++)\n {\n /* Decode the RR up to the data field. */\n status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);\n if (status != ARES_SUCCESS)\n\tbreak;\n aptr += len;\n if (aptr + RRFIXEDSZ > abuf + alen)\n\t{\n\t free(rr_name);\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n rr_type = DNS_RR_TYPE(aptr);\n rr_class = DNS_RR_CLASS(aptr);\n rr_len = DNS_RR_LEN(aptr);\n aptr += RRFIXEDSZ;\n if (aptr + rr_len > abuf + alen)\n\t{\n\t free(rr_name);\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n\n if (rr_class == C_IN && rr_type == T_A\n\t && rr_len == sizeof(struct in_addr)\n\t && strcasecmp(rr_name, hostname) == 0)\n\t{\n\t memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr));\n\t naddrs++;\n\t status = ARES_SUCCESS;\n\t}\n\n if (rr_class == C_IN && rr_type == T_CNAME)\n\t{\n\t /* Record the RR name as an alias. */\n\t aliases[naliases] = rr_name;\n\t naliases++;\n\n\t /* Decode the RR data and replace the hostname with it. */\n\t status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);\n\t if (status != ARES_SUCCESS)\n\t break;\n\t free(hostname);\n\t hostname = rr_data;\n\t}\n else\n\tfree(rr_name);\n\n aptr += rr_len;\n if (aptr > abuf + alen)\n\t{\n\t status = ARES_EBADRESP;\n\t break;\n\t}\n }\n\n if (status == ARES_SUCCESS && naddrs == 0)\n status = ARES_ENODATA;\n if (status == ARES_SUCCESS)\n {\n /* We got our answer. Allocate memory to build the host entry. */\n aliases[naliases] = NULL;\n hostent = malloc(sizeof(struct hostent));\n if (hostent)\n\t{\n\t hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));\n\t if (hostent->h_addr_list)\n\t {\n\t /* Fill in the hostent and return successfully. */\n\t hostent->h_name = hostname;\n\t hostent->h_aliases = aliases;\n\t hostent->h_addrtype = AF_INET;\n\t hostent->h_length = sizeof(struct in_addr);\n\t for (i = 0; i < naddrs; i++)\n\t\thostent->h_addr_list[i] = (char *) &addrs[i];\n\t hostent->h_addr_list[naddrs] = NULL;\n\t *host = hostent;\n\t return ARES_SUCCESS;\n\t }\n\t free(hostent);\n\t}\n status = ARES_ENOMEM;\n }\n for (i = 0; i < naliases; i++)\n free(aliases[i]);\n free(aliases);\n free(addrs);\n free(hostname);\n return status;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ares_parse_a_reply","file_name":"rutil/dns/ares/ares_parse_a_reply.c","commit_link":"github.com/resiprocate/resiprocate/commit/d67a9ca6fd06ca65d23e313bdbad1ef4dd3aa0df","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#8-42cbfbbb6725","input":"static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,\n MagickOffsetType PS_Offset,ssize_t PS_Size,ExceptionInfo *exception)\n{\n char\n postscript_file[MaxTextExtent];\n\n const MagicInfo\n *magic_info;\n\n FILE\n *ps_file;\n\n ImageInfo\n *clone_info;\n\n Image\n *image2;\n\n unsigned char\n magick[2*MaxTextExtent];\n\n\n if ((clone_info=CloneImageInfo(image_info)) == NULL)\n return(image);\n clone_info->blob=(void *) NULL;\n clone_info->length=0;\n\n /* Obtain temporary file */\n (void) AcquireUniqueFilename(postscript_file);\n ps_file=fopen_utf8(postscript_file,\"wb\");\n if (ps_file == (FILE *) NULL)\n goto FINISH;\n\n /* Copy postscript to temporary file */\n (void) SeekBlob(image,PS_Offset,SEEK_SET);\n (void) ReadBlob(image, 2*MaxTextExtent, magick);\n\n (void) SeekBlob(image,PS_Offset,SEEK_SET);\n while(PS_Size-- > 0)\n {\n (void) fputc(ReadBlobByte(image),ps_file);\n }\n (void) fclose(ps_file);\n\n /* Detect file format - Check magic.mgk configuration file. */\n magic_info=GetMagicInfo(magick,2*MaxTextExtent,exception);\n if(magic_info == (const MagicInfo *) NULL) goto FINISH_UNL;\n /* printf(\"Detected:%s \\n\",magic_info->name); */\n if(exception->severity != UndefinedException) goto FINISH_UNL;\n if(magic_info->name == (char *) NULL) goto FINISH_UNL;\n\n (void) CopyMagickMemory(clone_info->magick,magic_info->name,MaxTextExtent);\n\n /* Read nested image */\n /*FormatString(clone_info->filename,\"%s:%s\",magic_info->name,postscript_file);*/\n FormatLocaleString(clone_info->filename,MaxTextExtent,\"%s\",postscript_file);\n image2=ReadImage(clone_info,exception);\n\n if (!image2)\n goto FINISH_UNL;\n\n /*\n Replace current image with new image while copying base image\n attributes.\n */\n (void) CopyMagickMemory(image2->filename,image->filename,MaxTextExtent);\n (void) CopyMagickMemory(image2->magick_filename,image->magick_filename,MaxTextExtent);\n (void) CopyMagickMemory(image2->magick,image->magick,MaxTextExtent);\n image2->depth=image->depth;\n DestroyBlob(image2);\n image2->blob=ReferenceBlob(image->blob);\n\n if ((image->rows == 0) || (image->columns == 0))\n DeleteImageFromList(&image);\n\n AppendImageToList(&image,image2);\n\n FINISH_UNL:\n (void) RelinquishUniqueFileResource(postscript_file);\n FINISH:\n DestroyImageInfo(clone_info);\n return(image);\n}","target":"static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,\n MagickOffsetType PS_Offset,ssize_t PS_Size,ExceptionInfo *exception)\n{\n char\n postscript_file[MaxTextExtent];\n\n const MagicInfo\n *magic_info;\n\n FILE\n *ps_file;\n\n ImageInfo\n *clone_info;\n\n Image\n *image2;\n\n unsigned char\n magick[2*MaxTextExtent];\n\n\n if ((clone_info=CloneImageInfo(image_info)) == NULL)\n return(image);\n clone_info->blob=(void *) NULL;\n clone_info->length=0;\n\n /* Obtain temporary file */\n (void) AcquireUniqueFilename(postscript_file);\n ps_file=fopen_utf8(postscript_file,\"wb\");\n if (ps_file == (FILE *) NULL)\n goto FINISH;\n\n /* Copy postscript to temporary file */\n (void) SeekBlob(image,PS_Offset,SEEK_SET);\n (void) ReadBlob(image, 2*MaxTextExtent, magick);\n\n (void) SeekBlob(image,PS_Offset,SEEK_SET);\n while(PS_Size-- > 0)\n {\n (void) fputc(ReadBlobByte(image),ps_file);\n }\n (void) fclose(ps_file);\n\n /* Detect file format - Check magic.mgk configuration file. */\n magic_info=GetMagicInfo(magick,2*MaxTextExtent,exception);\n if(magic_info == (const MagicInfo *) NULL) goto FINISH_UNL;\n /* printf(\"Detected:%s \\n\",magic_info->name); */\n if(exception->severity != UndefinedException) goto FINISH_UNL;\n if(magic_info->name == (char *) NULL) goto FINISH_UNL;\n\n (void) strncpy(clone_info->magick,magic_info->name,MaxTextExtent);\n\n /* Read nested image */\n /*FormatString(clone_info->filename,\"%s:%s\",magic_info->name,postscript_file);*/\n FormatLocaleString(clone_info->filename,MaxTextExtent,\"%s\",postscript_file);\n image2=ReadImage(clone_info,exception);\n\n if (!image2)\n goto FINISH_UNL;\n\n /*\n Replace current image with new image while copying base image\n attributes.\n */\n (void) CopyMagickMemory(image2->filename,image->filename,MaxTextExtent);\n (void) CopyMagickMemory(image2->magick_filename,image->magick_filename,MaxTextExtent);\n (void) CopyMagickMemory(image2->magick,image->magick,MaxTextExtent);\n image2->depth=image->depth;\n DestroyBlob(image2);\n image2->blob=ReferenceBlob(image->blob);\n\n if ((image->rows == 0) || (image->columns == 0))\n DeleteImageFromList(&image);\n\n AppendImageToList(&image,image2);\n\n FINISH_UNL:\n (void) RelinquishUniqueFileResource(postscript_file);\n FINISH:\n DestroyImageInfo(clone_info);\n return(image);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ExtractPostscript","file_name":"coders/wpg.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/a251039393f423c7858e63cab6aa98d17b8b7a41","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#9-938fa4b051f1","input":"int usb_get_bos_descriptor(struct usb_device *dev)\n{\n\tstruct device *ddev = &dev->dev;\n\tstruct usb_bos_descriptor *bos;\n\tstruct usb_dev_cap_header *cap;\n\tunsigned char *buffer;\n\tint length, total_len, num, i;\n\tint ret;\n\n\tbos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);\n\tif (!bos)\n\t\treturn -ENOMEM;\n\n\t/* Get BOS descriptor */\n\tret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE);\n\tif (ret < USB_DT_BOS_SIZE) {\n\t\tdev_err(ddev, \"unable to get BOS descriptor\\n\");\n\t\tif (ret >= 0)\n\t\t\tret = -ENOMSG;\n\t\tkfree(bos);\n\t\treturn ret;\n\t}\n\n\tlength = bos->bLength;\n\ttotal_len = le16_to_cpu(bos->wTotalLength);\n\tnum = bos->bNumDeviceCaps;\n\tkfree(bos);\n\tif (total_len < length)\n\t\treturn -EINVAL;\n\n\tdev->bos = kzalloc(sizeof(struct usb_host_bos), GFP_KERNEL);\n\tif (!dev->bos)\n\t\treturn -ENOMEM;\n\n\t/* Now let's get the whole BOS descriptor set */\n\tbuffer = kzalloc(total_len, GFP_KERNEL);\n\tif (!buffer) {\n\t\tret = -ENOMEM;\n\t\tgoto err;\n\t}\n\tdev->bos->desc = (struct usb_bos_descriptor *)buffer;\n\n\tret = usb_get_descriptor(dev, USB_DT_BOS, 0, buffer, total_len);\n\tif (ret < total_len) {\n\t\tdev_err(ddev, \"unable to get BOS descriptor set\\n\");\n\t\tif (ret >= 0)\n\t\t\tret = -ENOMSG;\n\t\tgoto err;\n\t}\n\ttotal_len -= length;\n\n\tfor (i = 0; i < num; i++) {\n\t\tbuffer += length;\n\t\tcap = (struct usb_dev_cap_header *)buffer;\n\t\tlength = cap->bLength;\n\n\t\tif (total_len < length)\n\t\t\tbreak;\n\t\ttotal_len -= length;\n\n\t\tif (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) {\n\t\t\tdev_warn(ddev, \"descriptor type invalid, skip\\n\");\n\t\t\tcontinue;\n\t\t}\n\n\t\tswitch (cap->bDevCapabilityType) {\n\t\tcase USB_CAP_TYPE_WIRELESS_USB:\n\t\t\t/* Wireless USB cap descriptor is handled by wusb */\n\t\t\tbreak;\n\t\tcase USB_CAP_TYPE_EXT:\n\t\t\tdev->bos->ext_cap =\n\t\t\t\t(struct usb_ext_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_SS_CAP_TYPE:\n\t\t\tdev->bos->ss_cap =\n\t\t\t\t(struct usb_ss_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_SSP_CAP_TYPE:\n\t\t\tdev->bos->ssp_cap =\n\t\t\t\t(struct usb_ssp_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase CONTAINER_ID_TYPE:\n\t\t\tdev->bos->ss_id =\n\t\t\t\t(struct usb_ss_container_id_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_PTM_CAP_TYPE:\n\t\t\tdev->bos->ptm_cap =\n\t\t\t\t(struct usb_ptm_cap_descriptor *)buffer;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn 0;\n\nerr:\n\tusb_release_bos_descriptor(dev);\n\treturn ret;\n}","target":"int usb_get_bos_descriptor(struct usb_device *dev)\n{\n\tstruct device *ddev = &dev->dev;\n\tstruct usb_bos_descriptor *bos;\n\tstruct usb_dev_cap_header *cap;\n\tunsigned char *buffer;\n\tint length, total_len, num, i;\n\tint ret;\n\n\tbos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);\n\tif (!bos)\n\t\treturn -ENOMEM;\n\n\t/* Get BOS descriptor */\n\tret = usb_get_descriptor(dev, USB_DT_BOS, 0, bos, USB_DT_BOS_SIZE);\n\tif (ret < USB_DT_BOS_SIZE) {\n\t\tdev_err(ddev, \"unable to get BOS descriptor\\n\");\n\t\tif (ret >= 0)\n\t\t\tret = -ENOMSG;\n\t\tkfree(bos);\n\t\treturn ret;\n\t}\n\n\tlength = bos->bLength;\n\ttotal_len = le16_to_cpu(bos->wTotalLength);\n\tnum = bos->bNumDeviceCaps;\n\tkfree(bos);\n\tif (total_len < length)\n\t\treturn -EINVAL;\n\n\tdev->bos = kzalloc(sizeof(struct usb_host_bos), GFP_KERNEL);\n\tif (!dev->bos)\n\t\treturn -ENOMEM;\n\n\t/* Now let's get the whole BOS descriptor set */\n\tbuffer = kzalloc(total_len, GFP_KERNEL);\n\tif (!buffer) {\n\t\tret = -ENOMEM;\n\t\tgoto err;\n\t}\n\tdev->bos->desc = (struct usb_bos_descriptor *)buffer;\n\n\tret = usb_get_descriptor(dev, USB_DT_BOS, 0, buffer, total_len);\n\tif (ret < total_len) {\n\t\tdev_err(ddev, \"unable to get BOS descriptor set\\n\");\n\t\tif (ret >= 0)\n\t\t\tret = -ENOMSG;\n\t\tgoto err;\n\t}\n\ttotal_len -= length;\n\n\tfor (i = 0; i < num; i++) {\n\t\tbuffer += length;\n\t\tcap = (struct usb_dev_cap_header *)buffer;\n\n\t\tif (total_len < sizeof(*cap) || total_len < cap->bLength) {\n\t\t\tdev->bos->desc->bNumDeviceCaps = i;\n\t\t\tbreak;\n\t\t}\n\t\tlength = cap->bLength;\n\t\ttotal_len -= length;\n\n\t\tif (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) {\n\t\t\tdev_warn(ddev, \"descriptor type invalid, skip\\n\");\n\t\t\tcontinue;\n\t\t}\n\n\t\tswitch (cap->bDevCapabilityType) {\n\t\tcase USB_CAP_TYPE_WIRELESS_USB:\n\t\t\t/* Wireless USB cap descriptor is handled by wusb */\n\t\t\tbreak;\n\t\tcase USB_CAP_TYPE_EXT:\n\t\t\tdev->bos->ext_cap =\n\t\t\t\t(struct usb_ext_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_SS_CAP_TYPE:\n\t\t\tdev->bos->ss_cap =\n\t\t\t\t(struct usb_ss_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_SSP_CAP_TYPE:\n\t\t\tdev->bos->ssp_cap =\n\t\t\t\t(struct usb_ssp_cap_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase CONTAINER_ID_TYPE:\n\t\t\tdev->bos->ss_id =\n\t\t\t\t(struct usb_ss_container_id_descriptor *)buffer;\n\t\t\tbreak;\n\t\tcase USB_PTM_CAP_TYPE:\n\t\t\tdev->bos->ptm_cap =\n\t\t\t\t(struct usb_ptm_cap_descriptor *)buffer;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn 0;\n\nerr:\n\tusb_release_bos_descriptor(dev);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"usb_get_bos_descriptor","file_name":"drivers/usb/core/config.c","commit_link":"github.com/torvalds/linux/commit/1c0edc3633b56000e18d82fc241e3995ca18a69e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#10-3b3caf084945","input":"Mat_VarReadNextInfo4(mat_t *mat)\n{\n int M,O,data_type,class_type;\n mat_int32_t tmp;\n long nBytes;\n size_t readresult;\n matvar_t *matvar = NULL;\n union {\n mat_uint32_t u;\n mat_uint8_t c[4];\n } endian;\n\n if ( mat == NULL || mat->fp == NULL )\n return NULL;\n else if ( NULL == (matvar = Mat_VarCalloc()) )\n return NULL;\n\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n endian.u = 0x01020304;\n\n /* See if MOPT may need byteswapping */\n if ( tmp < 0 || tmp > 4052 ) {\n if ( Mat_int32Swap(&tmp) > 4052 ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n }\n\n M = (int)floor(tmp / 1000.0);\n switch ( M ) {\n case 0:\n /* IEEE little endian */\n mat->byteswap = endian.c[0] != 4;\n break;\n case 1:\n /* IEEE big endian */\n mat->byteswap = endian.c[0] != 1;\n break;\n default:\n /* VAX, Cray, or bogus */\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= M*1000;\n O = (int)floor(tmp / 100.0);\n /* O must be zero */\n if ( 0 != O ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= O*100;\n data_type = (int)floor(tmp / 10.0);\n /* Convert the V4 data type */\n switch ( data_type ) {\n case 0:\n matvar->data_type = MAT_T_DOUBLE;\n break;\n case 1:\n matvar->data_type = MAT_T_SINGLE;\n break;\n case 2:\n matvar->data_type = MAT_T_INT32;\n break;\n case 3:\n matvar->data_type = MAT_T_INT16;\n break;\n case 4:\n matvar->data_type = MAT_T_UINT16;\n break;\n case 5:\n matvar->data_type = MAT_T_UINT8;\n break;\n default:\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= data_type*10;\n class_type = (int)floor(tmp / 1.0);\n switch ( class_type ) {\n case 0:\n matvar->class_type = MAT_C_DOUBLE;\n break;\n case 1:\n matvar->class_type = MAT_C_CHAR;\n break;\n case 2:\n matvar->class_type = MAT_C_SPARSE;\n break;\n default:\n Mat_VarFree(matvar);\n return NULL;\n }\n\n matvar->rank = 2;\n matvar->dims = (size_t*)calloc(2, sizeof(*matvar->dims));\n if ( NULL == matvar->dims ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n matvar->dims[0] = tmp;\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n matvar->dims[1] = tmp;\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n readresult = fread(&(matvar->isComplex),sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n if ( matvar->isComplex && MAT_C_CHAR == matvar->class_type ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n /* Check that the length of the variable name is at least 1 */\n if ( tmp < 1 ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n matvar->name = (char*)malloc(tmp);\n if ( NULL == matvar->name ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(matvar->name,1,tmp,(FILE*)mat->fp);\n if ( tmp != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n matvar->internal->datapos = ftell((FILE*)mat->fp);\n if ( matvar->internal->datapos == -1L ) {\n Mat_VarFree(matvar);\n Mat_Critical(\"Couldn't determine file position\");\n return NULL;\n }\n {\n int err;\n size_t tmp2 = Mat_SizeOf(matvar->data_type);\n if ( matvar->isComplex )\n tmp2 *= 2;\n err = SafeMulDims(matvar, &tmp2);\n if ( err ) {\n Mat_VarFree(matvar);\n Mat_Critical(\"Integer multiplication overflow\");\n return NULL;\n }\n\n nBytes = (long)tmp2;\n }\n (void)fseek((FILE*)mat->fp,nBytes,SEEK_CUR);\n\n return matvar;\n}","target":"Mat_VarReadNextInfo4(mat_t *mat)\n{\n int M,O,data_type,class_type;\n mat_int32_t tmp;\n long nBytes;\n size_t readresult;\n matvar_t *matvar = NULL;\n union {\n mat_uint32_t u;\n mat_uint8_t c[4];\n } endian;\n\n if ( mat == NULL || mat->fp == NULL )\n return NULL;\n else if ( NULL == (matvar = Mat_VarCalloc()) )\n return NULL;\n\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n endian.u = 0x01020304;\n\n /* See if MOPT may need byteswapping */\n if ( tmp < 0 || tmp > 4052 ) {\n if ( Mat_int32Swap(&tmp) > 4052 ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n }\n\n M = (int)floor(tmp / 1000.0);\n switch ( M ) {\n case 0:\n /* IEEE little endian */\n mat->byteswap = endian.c[0] != 4;\n break;\n case 1:\n /* IEEE big endian */\n mat->byteswap = endian.c[0] != 1;\n break;\n default:\n /* VAX, Cray, or bogus */\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= M*1000;\n O = (int)floor(tmp / 100.0);\n /* O must be zero */\n if ( 0 != O ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= O*100;\n data_type = (int)floor(tmp / 10.0);\n /* Convert the V4 data type */\n switch ( data_type ) {\n case 0:\n matvar->data_type = MAT_T_DOUBLE;\n break;\n case 1:\n matvar->data_type = MAT_T_SINGLE;\n break;\n case 2:\n matvar->data_type = MAT_T_INT32;\n break;\n case 3:\n matvar->data_type = MAT_T_INT16;\n break;\n case 4:\n matvar->data_type = MAT_T_UINT16;\n break;\n case 5:\n matvar->data_type = MAT_T_UINT8;\n break;\n default:\n Mat_VarFree(matvar);\n return NULL;\n }\n\n tmp -= data_type*10;\n class_type = (int)floor(tmp / 1.0);\n switch ( class_type ) {\n case 0:\n matvar->class_type = MAT_C_DOUBLE;\n break;\n case 1:\n matvar->class_type = MAT_C_CHAR;\n break;\n case 2:\n matvar->class_type = MAT_C_SPARSE;\n break;\n default:\n Mat_VarFree(matvar);\n return NULL;\n }\n\n matvar->rank = 2;\n matvar->dims = (size_t*)calloc(2, sizeof(*matvar->dims));\n if ( NULL == matvar->dims ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n matvar->dims[0] = tmp;\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n matvar->dims[1] = tmp;\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n\n readresult = fread(&(matvar->isComplex),sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n if ( matvar->isComplex && MAT_C_CHAR == matvar->class_type ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(&tmp,sizeof(int),1,(FILE*)mat->fp);\n if ( 1 != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n if ( mat->byteswap )\n Mat_int32Swap(&tmp);\n /* Check that the length of the variable name is at least 1 */\n if ( tmp < 1 ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n matvar->name = (char*)malloc(tmp);\n if ( NULL == matvar->name ) {\n Mat_VarFree(matvar);\n return NULL;\n }\n readresult = fread(matvar->name,1,tmp,(FILE*)mat->fp);\n if ( tmp != readresult ) {\n Mat_VarFree(matvar);\n return NULL;\n } else {\n matvar->name[tmp - 1] = '\\0';\n }\n\n matvar->internal->datapos = ftell((FILE*)mat->fp);\n if ( matvar->internal->datapos == -1L ) {\n Mat_VarFree(matvar);\n Mat_Critical(\"Couldn't determine file position\");\n return NULL;\n }\n {\n int err;\n size_t tmp2 = Mat_SizeOf(matvar->data_type);\n if ( matvar->isComplex )\n tmp2 *= 2;\n err = SafeMulDims(matvar, &tmp2);\n if ( err ) {\n Mat_VarFree(matvar);\n Mat_Critical(\"Integer multiplication overflow\");\n return NULL;\n }\n\n nBytes = (long)tmp2;\n }\n (void)fseek((FILE*)mat->fp,nBytes,SEEK_CUR);\n\n return matvar;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"Mat_VarReadNextInfo4","file_name":"src/mat4.c","commit_link":"github.com/tbeu/matio/commit/651a8e28099edb5fbb9e4e1d4d3238848f446c9a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#11-52c63e4eb17a","input":"static x86newTokenType getToken(const char *str, size_t *begin, size_t *end) {\n\t// Skip whitespace\n\twhile (begin && isspace ((ut8)str[*begin])) {\n\t\t++(*begin);\n\t}\n\n\tif (!str[*begin]) { // null byte\n\t\t*end = *begin;\n\t\treturn TT_EOF;\n\t} else if (isalpha ((ut8)str[*begin])) { // word token\n\t\t*end = *begin;\n\t\twhile (end && isalnum ((ut8)str[*end])) {\n\t\t\t++(*end);\n\t\t}\n\t\treturn TT_WORD;\n\t} else if (isdigit ((ut8)str[*begin])) { // number token\n\t\t*end = *begin;\n\t\twhile (end && isalnum ((ut8)str[*end])) { // accept alphanumeric characters, because hex.\n\t\t\t++(*end);\n\t\t}\n\t\treturn TT_NUMBER;\n\t} else { // special character: [, ], +, *, ...\n\t\t*end = *begin + 1;\n\t\treturn TT_SPECIAL;\n\t}\n}","target":"static x86newTokenType getToken(const char *str, size_t *begin, size_t *end) {\n\tif (*begin > strlen (str)) {\n\t\treturn TT_EOF;\n\t}\n\t// Skip whitespace\n\twhile (begin && str[*begin] && isspace ((ut8)str[*begin])) {\n\t\t++(*begin);\n\t}\n\n\tif (!str[*begin]) { // null byte\n\t\t*end = *begin;\n\t\treturn TT_EOF;\n\t}\n\tif (isalpha ((ut8)str[*begin])) { // word token\n\t\t*end = *begin;\n\t\twhile (end && str[*end] && isalnum ((ut8)str[*end])) {\n\t\t\t++(*end);\n\t\t}\n\t\treturn TT_WORD;\n\t}\n\tif (isdigit ((ut8)str[*begin])) { // number token\n\t\t*end = *begin;\n\t\twhile (end && isalnum ((ut8)str[*end])) { // accept alphanumeric characters, because hex.\n\t\t\t++(*end);\n\t\t}\n\t\treturn TT_NUMBER;\n\t} else { // special character: [, ], +, *, ...\n\t\t*end = *begin + 1;\n\t\treturn TT_SPECIAL;\n\t}\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"getToken","file_name":"libr/asm/p/asm_x86_nz.c","commit_link":"github.com/radare/radare2/commit/66191f780863ea8c66ace4040d0d04a8842e8432","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#12-f4464d5af6a0","input":"fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mrb_bool resume, mrb_bool vmexec)\n{\n struct mrb_context *c = fiber_check(mrb, self);\n struct mrb_context *old_c = mrb->c;\n mrb_value value;\n\n fiber_check_cfunc(mrb, c);\n if (resume && c->status == MRB_FIBER_TRANSFERRED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"resuming transferred fiber\");\n }\n if (c->status == MRB_FIBER_RUNNING || c->status == MRB_FIBER_RESUMED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"double resume (fib)\");\n }\n if (c->status == MRB_FIBER_TERMINATED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"resuming dead fiber\");\n }\n mrb->c->status = resume ? MRB_FIBER_RESUMED : MRB_FIBER_TRANSFERRED;\n c->prev = resume ? mrb->c : (c->prev ? c->prev : mrb->root_c);\n if (c->status == MRB_FIBER_CREATED) {\n mrb_value *b, *e;\n\n if (len >= c->stend - c->stack) {\n mrb_raise(mrb, E_FIBER_ERROR, \"too many arguments to fiber\");\n }\n b = c->stack+1;\n e = b + len;\n while (bcibase->argc = (int)len;\n value = c->stack[0] = MRB_PROC_ENV(c->ci->proc)->stack[0];\n }\n else {\n value = fiber_result(mrb, a, len);\n }\n fiber_switch_context(mrb, c);\n\n if (vmexec) {\n c->vmexec = TRUE;\n value = mrb_vm_exec(mrb, c->ci[-1].proc, c->ci->pc);\n mrb->c = old_c;\n }\n else {\n MARK_CONTEXT_MODIFY(c);\n }\n return value;\n}","target":"fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mrb_bool resume, mrb_bool vmexec)\n{\n struct mrb_context *c = fiber_check(mrb, self);\n struct mrb_context *old_c = mrb->c;\n enum mrb_fiber_state status;\n mrb_value value;\n\n fiber_check_cfunc(mrb, c);\n status = c->status;\n if (resume && status == MRB_FIBER_TRANSFERRED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"resuming transferred fiber\");\n }\n if (status == MRB_FIBER_RUNNING || status == MRB_FIBER_RESUMED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"double resume (fib)\");\n }\n if (status == MRB_FIBER_TERMINATED) {\n mrb_raise(mrb, E_FIBER_ERROR, \"resuming dead fiber\");\n }\n old_c->status = resume ? MRB_FIBER_RESUMED : MRB_FIBER_TRANSFERRED;\n c->prev = resume ? mrb->c : (c->prev ? c->prev : mrb->root_c);\n fiber_switch_context(mrb, c);\n if (status == MRB_FIBER_CREATED) {\n mrb_value *b, *e;\n\n mrb_stack_extend(mrb, len+2); /* for receiver and (optional) block */\n b = c->stack+1;\n e = b + len;\n while (bcibase->argc = (int)len;\n value = c->stack[0] = MRB_PROC_ENV(c->ci->proc)->stack[0];\n }\n else {\n value = fiber_result(mrb, a, len);\n }\n\n if (vmexec) {\n c->vmexec = TRUE;\n value = mrb_vm_exec(mrb, c->ci[-1].proc, c->ci->pc);\n mrb->c = old_c;\n }\n else {\n MARK_CONTEXT_MODIFY(c);\n }\n return value;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"fiber_switch","file_name":"mrbgems/mruby-fiber/src/fiber.c","commit_link":"github.com/mruby/mruby/commit/778500563a9f7ceba996937dc886bd8cde29b42b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#13-aa76cf73cefb","input":"start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)\n{\n ppm_source_ptr source = (ppm_source_ptr)sinfo;\n int c;\n unsigned int w, h, maxval;\n boolean need_iobuffer, use_raw_buffer, need_rescale;\n\n if (getc(source->pub.input_file) != 'P')\n ERREXIT(cinfo, JERR_PPM_NOT);\n\n c = getc(source->pub.input_file); /* subformat discriminator character */\n\n /* detect unsupported variants (ie, PBM) before trying to read header */\n switch (c) {\n case '2': /* it's a text-format PGM file */\n case '3': /* it's a text-format PPM file */\n case '5': /* it's a raw-format PGM file */\n case '6': /* it's a raw-format PPM file */\n break;\n default:\n ERREXIT(cinfo, JERR_PPM_NOT);\n break;\n }\n\n /* fetch the remaining header info */\n w = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n h = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n maxval = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n\n if (w <= 0 || h <= 0 || maxval <= 0) /* error check */\n ERREXIT(cinfo, JERR_PPM_NOT);\n\n cinfo->data_precision = BITS_IN_JSAMPLE; /* we always rescale data to this */\n cinfo->image_width = (JDIMENSION)w;\n cinfo->image_height = (JDIMENSION)h;\n source->maxval = maxval;\n\n /* initialize flags to most common settings */\n need_iobuffer = TRUE; /* do we need an I/O buffer? */\n use_raw_buffer = FALSE; /* do we map input buffer onto I/O buffer? */\n need_rescale = TRUE; /* do we need a rescale array? */\n\n switch (c) {\n case '2': /* it's a text-format PGM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_GRAYSCALE;\n TRACEMS2(cinfo, 1, JTRC_PGM_TEXT, w, h);\n if (cinfo->in_color_space == JCS_GRAYSCALE)\n source->pub.get_pixel_rows = get_text_gray_row;\n else if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_text_gray_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_text_gray_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n need_iobuffer = FALSE;\n break;\n\n case '3': /* it's a text-format PPM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_EXT_RGB;\n TRACEMS2(cinfo, 1, JTRC_PPM_TEXT, w, h);\n if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_text_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_text_rgb_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n need_iobuffer = FALSE;\n break;\n\n case '5': /* it's a raw-format PGM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_GRAYSCALE;\n TRACEMS2(cinfo, 1, JTRC_PGM, w, h);\n if (maxval > 255) {\n source->pub.get_pixel_rows = get_word_gray_row;\n } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) &&\n cinfo->in_color_space == JCS_GRAYSCALE) {\n source->pub.get_pixel_rows = get_raw_row;\n use_raw_buffer = TRUE;\n need_rescale = FALSE;\n } else {\n if (cinfo->in_color_space == JCS_GRAYSCALE)\n source->pub.get_pixel_rows = get_scaled_gray_row;\n else if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_gray_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_gray_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n }\n break;\n\n case '6': /* it's a raw-format PPM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_EXT_RGB;\n TRACEMS2(cinfo, 1, JTRC_PPM, w, h);\n if (maxval > 255) {\n source->pub.get_pixel_rows = get_word_rgb_row;\n } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) &&\n (cinfo->in_color_space == JCS_EXT_RGB\n#if RGB_RED == 0 && RGB_GREEN == 1 && RGB_BLUE == 2 && RGB_PIXELSIZE == 3\n || cinfo->in_color_space == JCS_RGB\n#endif\n )) {\n source->pub.get_pixel_rows = get_raw_row;\n use_raw_buffer = TRUE;\n need_rescale = FALSE;\n } else {\n if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_rgb_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n }\n break;\n }\n\n if (IsExtRGB(cinfo->in_color_space))\n cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];\n else if (cinfo->in_color_space == JCS_GRAYSCALE)\n cinfo->input_components = 1;\n else if (cinfo->in_color_space == JCS_CMYK)\n cinfo->input_components = 4;\n\n /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */\n if (need_iobuffer) {\n if (c == '6')\n source->buffer_width = (size_t)w * 3 *\n ((maxval <= 255) ? sizeof(U_CHAR) : (2 * sizeof(U_CHAR)));\n else\n source->buffer_width = (size_t)w *\n ((maxval <= 255) ? sizeof(U_CHAR) : (2 * sizeof(U_CHAR)));\n source->iobuffer = (U_CHAR *)\n (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,\n source->buffer_width);\n }\n\n /* Create compressor input buffer. */\n if (use_raw_buffer) {\n /* For unscaled raw-input case, we can just map it onto the I/O buffer. */\n /* Synthesize a JSAMPARRAY pointer structure */\n source->pixrow = (JSAMPROW)source->iobuffer;\n source->pub.buffer = &source->pixrow;\n source->pub.buffer_height = 1;\n } else {\n /* Need to translate anyway, so make a separate sample buffer. */\n source->pub.buffer = (*cinfo->mem->alloc_sarray)\n ((j_common_ptr)cinfo, JPOOL_IMAGE,\n (JDIMENSION)w * cinfo->input_components, (JDIMENSION)1);\n source->pub.buffer_height = 1;\n }\n\n /* Compute the rescaling array if required. */\n if (need_rescale) {\n long val, half_maxval;\n\n /* On 16-bit-int machines we have to be careful of maxval = 65535 */\n source->rescale = (JSAMPLE *)\n (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,\n (size_t)(((long)maxval + 1L) *\n sizeof(JSAMPLE)));\n half_maxval = maxval / 2;\n for (val = 0; val <= (long)maxval; val++) {\n /* The multiplication here must be done in 32 bits to avoid overflow */\n source->rescale[val] = (JSAMPLE)((val * MAXJSAMPLE + half_maxval) /\n maxval);\n }\n }\n}","target":"start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)\n{\n ppm_source_ptr source = (ppm_source_ptr)sinfo;\n int c;\n unsigned int w, h, maxval;\n boolean need_iobuffer, use_raw_buffer, need_rescale;\n\n if (getc(source->pub.input_file) != 'P')\n ERREXIT(cinfo, JERR_PPM_NOT);\n\n c = getc(source->pub.input_file); /* subformat discriminator character */\n\n /* detect unsupported variants (ie, PBM) before trying to read header */\n switch (c) {\n case '2': /* it's a text-format PGM file */\n case '3': /* it's a text-format PPM file */\n case '5': /* it's a raw-format PGM file */\n case '6': /* it's a raw-format PPM file */\n break;\n default:\n ERREXIT(cinfo, JERR_PPM_NOT);\n break;\n }\n\n /* fetch the remaining header info */\n w = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n h = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n maxval = read_pbm_integer(cinfo, source->pub.input_file, 65535);\n\n if (w <= 0 || h <= 0 || maxval <= 0) /* error check */\n ERREXIT(cinfo, JERR_PPM_NOT);\n\n cinfo->data_precision = BITS_IN_JSAMPLE; /* we always rescale data to this */\n cinfo->image_width = (JDIMENSION)w;\n cinfo->image_height = (JDIMENSION)h;\n source->maxval = maxval;\n\n /* initialize flags to most common settings */\n need_iobuffer = TRUE; /* do we need an I/O buffer? */\n use_raw_buffer = FALSE; /* do we map input buffer onto I/O buffer? */\n need_rescale = TRUE; /* do we need a rescale array? */\n\n switch (c) {\n case '2': /* it's a text-format PGM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_GRAYSCALE;\n TRACEMS2(cinfo, 1, JTRC_PGM_TEXT, w, h);\n if (cinfo->in_color_space == JCS_GRAYSCALE)\n source->pub.get_pixel_rows = get_text_gray_row;\n else if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_text_gray_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_text_gray_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n need_iobuffer = FALSE;\n break;\n\n case '3': /* it's a text-format PPM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_EXT_RGB;\n TRACEMS2(cinfo, 1, JTRC_PPM_TEXT, w, h);\n if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_text_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_text_rgb_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n need_iobuffer = FALSE;\n break;\n\n case '5': /* it's a raw-format PGM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_GRAYSCALE;\n TRACEMS2(cinfo, 1, JTRC_PGM, w, h);\n if (maxval > 255) {\n source->pub.get_pixel_rows = get_word_gray_row;\n } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) &&\n cinfo->in_color_space == JCS_GRAYSCALE) {\n source->pub.get_pixel_rows = get_raw_row;\n use_raw_buffer = TRUE;\n need_rescale = FALSE;\n } else {\n if (cinfo->in_color_space == JCS_GRAYSCALE)\n source->pub.get_pixel_rows = get_scaled_gray_row;\n else if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_gray_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_gray_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n }\n break;\n\n case '6': /* it's a raw-format PPM file */\n if (cinfo->in_color_space == JCS_UNKNOWN)\n cinfo->in_color_space = JCS_EXT_RGB;\n TRACEMS2(cinfo, 1, JTRC_PPM, w, h);\n if (maxval > 255) {\n source->pub.get_pixel_rows = get_word_rgb_row;\n } else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) &&\n (cinfo->in_color_space == JCS_EXT_RGB\n#if RGB_RED == 0 && RGB_GREEN == 1 && RGB_BLUE == 2 && RGB_PIXELSIZE == 3\n || cinfo->in_color_space == JCS_RGB\n#endif\n )) {\n source->pub.get_pixel_rows = get_raw_row;\n use_raw_buffer = TRUE;\n need_rescale = FALSE;\n } else {\n if (IsExtRGB(cinfo->in_color_space))\n source->pub.get_pixel_rows = get_rgb_row;\n else if (cinfo->in_color_space == JCS_CMYK)\n source->pub.get_pixel_rows = get_rgb_cmyk_row;\n else\n ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);\n }\n break;\n }\n\n if (IsExtRGB(cinfo->in_color_space))\n cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];\n else if (cinfo->in_color_space == JCS_GRAYSCALE)\n cinfo->input_components = 1;\n else if (cinfo->in_color_space == JCS_CMYK)\n cinfo->input_components = 4;\n\n /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */\n if (need_iobuffer) {\n if (c == '6')\n source->buffer_width = (size_t)w * 3 *\n ((maxval <= 255) ? sizeof(U_CHAR) : (2 * sizeof(U_CHAR)));\n else\n source->buffer_width = (size_t)w *\n ((maxval <= 255) ? sizeof(U_CHAR) : (2 * sizeof(U_CHAR)));\n source->iobuffer = (U_CHAR *)\n (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,\n source->buffer_width);\n }\n\n /* Create compressor input buffer. */\n if (use_raw_buffer) {\n /* For unscaled raw-input case, we can just map it onto the I/O buffer. */\n /* Synthesize a JSAMPARRAY pointer structure */\n source->pixrow = (JSAMPROW)source->iobuffer;\n source->pub.buffer = &source->pixrow;\n source->pub.buffer_height = 1;\n } else {\n /* Need to translate anyway, so make a separate sample buffer. */\n source->pub.buffer = (*cinfo->mem->alloc_sarray)\n ((j_common_ptr)cinfo, JPOOL_IMAGE,\n (JDIMENSION)w * cinfo->input_components, (JDIMENSION)1);\n source->pub.buffer_height = 1;\n }\n\n /* Compute the rescaling array if required. */\n if (need_rescale) {\n long val, half_maxval;\n\n /* On 16-bit-int machines we have to be careful of maxval = 65535 */\n source->rescale = (JSAMPLE *)\n (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,\n (size_t)(((long)MAX(maxval, 255) + 1L) *\n sizeof(JSAMPLE)));\n half_maxval = maxval / 2;\n for (val = 0; val <= (long)maxval; val++) {\n /* The multiplication here must be done in 32 bits to avoid overflow */\n source->rescale[val] = (JSAMPLE)((val * MAXJSAMPLE + half_maxval) /\n maxval);\n }\n }\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"start_input_ppm","file_name":"rdppm.c","commit_link":"github.com/libjpeg-turbo/libjpeg-turbo/commit/3de15e0c344d11d4b90f4a47136467053eb2d09a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#14-c8cf11256c1b","input":"static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)\n{\n\tstruct usb_device *dev = chip->dev;\n\tstruct usb_host_interface *host_iface;\n\tstruct usb_interface_descriptor *altsd;\n\tvoid *control_header;\n\tint i, protocol;\n\n\t/* find audiocontrol interface */\n\thost_iface = &usb_ifnum_to_if(dev, ctrlif)->altsetting[0];\n\tcontrol_header = snd_usb_find_csint_desc(host_iface->extra,\n\t\t\t\t\t\t host_iface->extralen,\n\t\t\t\t\t\t NULL, UAC_HEADER);\n\taltsd = get_iface_desc(host_iface);\n\tprotocol = altsd->bInterfaceProtocol;\n\n\tif (!control_header) {\n\t\tdev_err(&dev->dev, \"cannot find UAC_HEADER\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\tswitch (protocol) {\n\tdefault:\n\t\tdev_warn(&dev->dev,\n\t\t\t \"unknown interface protocol %#02x, assuming v1\\n\",\n\t\t\t protocol);\n\t\t/* fall through */\n\n\tcase UAC_VERSION_1: {\n\t\tstruct uac1_ac_header_descriptor *h1 = control_header;\n\n\t\tif (!h1->bInCollection) {\n\t\t\tdev_info(&dev->dev, \"skipping empty audio interface (v1)\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tif (h1->bLength < sizeof(*h1) + h1->bInCollection) {\n\t\t\tdev_err(&dev->dev, \"invalid UAC_HEADER (v1)\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tfor (i = 0; i < h1->bInCollection; i++)\n\t\t\tsnd_usb_create_stream(chip, ctrlif, h1->baInterfaceNr[i]);\n\n\t\tbreak;\n\t}\n\n\tcase UAC_VERSION_2: {\n\t\tstruct usb_interface_assoc_descriptor *assoc =\n\t\t\tusb_ifnum_to_if(dev, ctrlif)->intf_assoc;\n\n\t\tif (!assoc) {\n\t\t\t/*\n\t\t\t * Firmware writers cannot count to three. So to find\n\t\t\t * the IAD on the NuForce UDH-100, also check the next\n\t\t\t * interface.\n\t\t\t */\n\t\t\tstruct usb_interface *iface =\n\t\t\t\tusb_ifnum_to_if(dev, ctrlif + 1);\n\t\t\tif (iface &&\n\t\t\t iface->intf_assoc &&\n\t\t\t iface->intf_assoc->bFunctionClass == USB_CLASS_AUDIO &&\n\t\t\t iface->intf_assoc->bFunctionProtocol == UAC_VERSION_2)\n\t\t\t\tassoc = iface->intf_assoc;\n\t\t}\n\n\t\tif (!assoc) {\n\t\t\tdev_err(&dev->dev, \"Audio class v2 interfaces need an interface association\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tfor (i = 0; i < assoc->bInterfaceCount; i++) {\n\t\t\tint intf = assoc->bFirstInterface + i;\n\n\t\t\tif (intf != ctrlif)\n\t\t\t\tsnd_usb_create_stream(chip, ctrlif, intf);\n\t\t}\n\n\t\tbreak;\n\t}\n\t}\n\n\treturn 0;\n}","target":"static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)\n{\n\tstruct usb_device *dev = chip->dev;\n\tstruct usb_host_interface *host_iface;\n\tstruct usb_interface_descriptor *altsd;\n\tvoid *control_header;\n\tint i, protocol;\n\tint rest_bytes;\n\n\t/* find audiocontrol interface */\n\thost_iface = &usb_ifnum_to_if(dev, ctrlif)->altsetting[0];\n\tcontrol_header = snd_usb_find_csint_desc(host_iface->extra,\n\t\t\t\t\t\t host_iface->extralen,\n\t\t\t\t\t\t NULL, UAC_HEADER);\n\taltsd = get_iface_desc(host_iface);\n\tprotocol = altsd->bInterfaceProtocol;\n\n\tif (!control_header) {\n\t\tdev_err(&dev->dev, \"cannot find UAC_HEADER\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\trest_bytes = (void *)(host_iface->extra + host_iface->extralen) -\n\t\tcontrol_header;\n\n\t/* just to be sure -- this shouldn't hit at all */\n\tif (rest_bytes <= 0) {\n\t\tdev_err(&dev->dev, \"invalid control header\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\tswitch (protocol) {\n\tdefault:\n\t\tdev_warn(&dev->dev,\n\t\t\t \"unknown interface protocol %#02x, assuming v1\\n\",\n\t\t\t protocol);\n\t\t/* fall through */\n\n\tcase UAC_VERSION_1: {\n\t\tstruct uac1_ac_header_descriptor *h1 = control_header;\n\n\t\tif (rest_bytes < sizeof(*h1)) {\n\t\t\tdev_err(&dev->dev, \"too short v1 buffer descriptor\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tif (!h1->bInCollection) {\n\t\t\tdev_info(&dev->dev, \"skipping empty audio interface (v1)\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tif (rest_bytes < h1->bLength) {\n\t\t\tdev_err(&dev->dev, \"invalid buffer length (v1)\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tif (h1->bLength < sizeof(*h1) + h1->bInCollection) {\n\t\t\tdev_err(&dev->dev, \"invalid UAC_HEADER (v1)\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tfor (i = 0; i < h1->bInCollection; i++)\n\t\t\tsnd_usb_create_stream(chip, ctrlif, h1->baInterfaceNr[i]);\n\n\t\tbreak;\n\t}\n\n\tcase UAC_VERSION_2: {\n\t\tstruct usb_interface_assoc_descriptor *assoc =\n\t\t\tusb_ifnum_to_if(dev, ctrlif)->intf_assoc;\n\n\t\tif (!assoc) {\n\t\t\t/*\n\t\t\t * Firmware writers cannot count to three. So to find\n\t\t\t * the IAD on the NuForce UDH-100, also check the next\n\t\t\t * interface.\n\t\t\t */\n\t\t\tstruct usb_interface *iface =\n\t\t\t\tusb_ifnum_to_if(dev, ctrlif + 1);\n\t\t\tif (iface &&\n\t\t\t iface->intf_assoc &&\n\t\t\t iface->intf_assoc->bFunctionClass == USB_CLASS_AUDIO &&\n\t\t\t iface->intf_assoc->bFunctionProtocol == UAC_VERSION_2)\n\t\t\t\tassoc = iface->intf_assoc;\n\t\t}\n\n\t\tif (!assoc) {\n\t\t\tdev_err(&dev->dev, \"Audio class v2 interfaces need an interface association\\n\");\n\t\t\treturn -EINVAL;\n\t\t}\n\n\t\tfor (i = 0; i < assoc->bInterfaceCount; i++) {\n\t\t\tint intf = assoc->bFirstInterface + i;\n\n\t\t\tif (intf != ctrlif)\n\t\t\t\tsnd_usb_create_stream(chip, ctrlif, intf);\n\t\t}\n\n\t\tbreak;\n\t}\n\t}\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"snd_usb_create_streams","file_name":"sound/usb/card.c","commit_link":"github.com/torvalds/linux/commit/bfc81a8bc18e3c4ba0cbaa7666ff76be2f998991","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#15-6aa903c5d2a7","input":"void process_packet_tail(struct msg_digest *md)\n{\n\tstruct state *st = md->st;\n\tenum state_kind from_state = md->v1_from_state;\n\tconst struct state_v1_microcode *smc = md->smc;\n\tbool new_iv_set = md->new_iv_set;\n\tbool self_delete = FALSE;\n\n\tif (md->hdr.isa_flags & ISAKMP_FLAGS_v1_ENCRYPTION) {\n\t\tendpoint_buf b;\n\t\tdbg(\"received encrypted packet from %s\", str_endpoint(&md->sender, &b));\n\n\t\tif (st == NULL) {\n\t\t\tlibreswan_log(\n\t\t\t\t\"discarding encrypted message for an unknown ISAKMP SA\");\n\t\t\treturn;\n\t\t}\n\t\tif (st->st_skeyid_e_nss == NULL) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\"discarding encrypted message because we haven't yet negotiated keying material\");\n\t\t\treturn;\n\t\t}\n\n\t\t/* Mark as encrypted */\n\t\tmd->encrypted = TRUE;\n\n\t\t/* do the specified decryption\n\t\t *\n\t\t * IV is from st->st_iv or (if new_iv_set) st->st_new_iv.\n\t\t * The new IV is placed in st->st_new_iv\n\t\t *\n\t\t * See RFC 2409 \"IKE\" Appendix B\n\t\t *\n\t\t * XXX The IV should only be updated really if the packet\n\t\t * is successfully processed.\n\t\t * We should keep this value, check for a success return\n\t\t * value from the parsing routines and then replace.\n\t\t *\n\t\t * Each post phase 1 exchange generates IVs from\n\t\t * the last phase 1 block, not the last block sent.\n\t\t */\n\t\tconst struct encrypt_desc *e = st->st_oakley.ta_encrypt;\n\n\t\tif (pbs_left(&md->message_pbs) % e->enc_blocksize != 0) {\n\t\t\tloglog(RC_LOG_SERIOUS, \"malformed message: not a multiple of encryption blocksize\");\n\t\t\treturn;\n\t\t}\n\n\t\t/* XXX Detect weak keys */\n\n\t\t/* grab a copy of raw packet (for duplicate packet detection) */\n\t\tmd->raw_packet = clone_bytes_as_chunk(md->packet_pbs.start,\n\t\t\t\t\t\t pbs_room(&md->packet_pbs),\n\t\t\t\t\t\t \"raw packet\");\n\n\t\t/* Decrypt everything after header */\n\t\tif (!new_iv_set) {\n\t\t\tif (st->st_v1_iv.len == 0) {\n\t\t\t\tinit_phase2_iv(st, &md->hdr.isa_msgid);\n\t\t\t} else {\n\t\t\t\t/* use old IV */\n\t\t\t\trestore_new_iv(st, st->st_v1_iv);\n\t\t\t}\n\t\t}\n\n\t\tpassert(st->st_v1_new_iv.len >= e->enc_blocksize);\n\t\tst->st_v1_new_iv.len = e->enc_blocksize; /* truncate */\n\n\t\tif (DBGP(DBG_CRYPT)) {\n\t\t\tDBG_log(\"decrypting %u bytes using algorithm %s\",\n\t\t\t\t(unsigned) pbs_left(&md->message_pbs),\n\t\t\t\tst->st_oakley.ta_encrypt->common.fqn);\n\t\t\tDBG_dump_hunk(\"IV before:\", st->st_v1_new_iv);\n\t\t}\n\t\te->encrypt_ops->do_crypt(e, md->message_pbs.cur,\n\t\t\t\t\t pbs_left(&md->message_pbs),\n\t\t\t\t\t st->st_enc_key_nss,\n\t\t\t\t\t st->st_v1_new_iv.ptr, FALSE);\n\t\tif (DBGP(DBG_CRYPT)) {\n\t\t\tDBG_dump_hunk(\"IV after:\", st->st_v1_new_iv);\n\t\t\tDBG_log(\"decrypted payload (starts at offset %td):\",\n\t\t\t\tmd->message_pbs.cur - md->message_pbs.roof);\n\t\t\tDBG_dump(NULL, md->message_pbs.start,\n\t\t\t\t md->message_pbs.roof - md->message_pbs.start);\n\t\t}\n\t} else {\n\t\t/* packet was not encryped -- should it have been? */\n\n\t\tif (smc->flags & SMF_INPUT_ENCRYPTED) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"packet rejected: should have been encrypted\");\n\t\t\tSEND_NOTIFICATION(INVALID_FLAGS);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/* Digest the message.\n\t * Padding must be removed to make hashing work.\n\t * Padding comes from encryption (so this code must be after decryption).\n\t * Padding rules are described before the definition of\n\t * struct isakmp_hdr in packet.h.\n\t */\n\t{\n\t\tenum next_payload_types_ikev1 np = md->hdr.isa_np;\n\t\tlset_t needed = smc->req_payloads;\n\t\tconst char *excuse =\n\t\t\tLIN(SMF_PSK_AUTH | SMF_FIRST_ENCRYPTED_INPUT,\n\t\t\t smc->flags) ?\n\t\t\t\"probable authentication failure (mismatch of preshared secrets?): \"\n\t\t\t:\n\t\t\t\"\";\n\n\t\twhile (np != ISAKMP_NEXT_NONE) {\n\t\t\tstruct_desc *sd = v1_payload_desc(np);\n\n\t\t\tif (md->digest_roof >= elemsof(md->digest)) {\n\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t \"more than %zu payloads in message; ignored\",\n\t\t\t\t elemsof(md->digest));\n\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstruct payload_digest *const pd = md->digest + md->digest_roof;\n\n\t\t\t/*\n\t\t\t * only do this in main mode. In aggressive mode, there\n\t\t\t * is no negotiation of NAT-T method. Get it right.\n\t\t\t */\n\t\t\tif (st != NULL && st->st_connection != NULL &&\n\t\t\t (st->st_connection->policy & POLICY_AGGRESSIVE) == LEMPTY)\n\t\t\t{\n\t\t\t\tswitch (np) {\n\t\t\t\tcase ISAKMP_NEXT_NATD_RFC:\n\t\t\t\tcase ISAKMP_NEXT_NATOA_RFC:\n\t\t\t\t\tif ((st->hidden_variables.st_nat_traversal & NAT_T_WITH_RFC_VALUES) == LEMPTY) {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * don't accept NAT-D/NAT-OA reloc directly in message,\n\t\t\t\t\t\t * unless we're using NAT-T RFC\n\t\t\t\t\t\t */\n\t\t\t\t\t\tDBG(DBG_NATT,\n\t\t\t\t\t\t DBG_log(\"st_nat_traversal was: %s\",\n\t\t\t\t\t\t\t bitnamesof(natt_bit_names,\n\t\t\t\t\t\t\t\t st->hidden_variables.st_nat_traversal)));\n\t\t\t\t\t\tsd = NULL;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (sd == NULL) {\n\t\t\t\t/* payload type is out of range or requires special handling */\n\t\t\t\tswitch (np) {\n\t\t\t\tcase ISAKMP_NEXT_ID:\n\t\t\t\t\t/* ??? two kinds of ID payloads */\n\t\t\t\t\tsd = (IS_PHASE1(from_state) ||\n\t\t\t\t\t IS_PHASE15(from_state)) ?\n\t\t\t\t\t\t&isakmp_identification_desc :\n\t\t\t\t\t\t&isakmp_ipsec_identification_desc;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_NATD_DRAFTS: /* out of range */\n\t\t\t\t\t/*\n\t\t\t\t\t * ISAKMP_NEXT_NATD_DRAFTS was a private use type before RFC-3947.\n\t\t\t\t\t * Since it has the same format as ISAKMP_NEXT_NATD_RFC,\n\t\t\t\t\t * just rewrite np and sd, and carry on.\n\t\t\t\t\t */\n\t\t\t\t\tnp = ISAKMP_NEXT_NATD_RFC;\n\t\t\t\t\tsd = &isakmp_nat_d_drafts;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_NATOA_DRAFTS: /* out of range */\n\t\t\t\t\t/* NAT-OA was a private use type before RFC-3947 -- same format */\n\t\t\t\t\tnp = ISAKMP_NEXT_NATOA_RFC;\n\t\t\t\t\tsd = &isakmp_nat_oa_drafts;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_SAK: /* or ISAKMP_NEXT_NATD_BADDRAFTS */\n\t\t\t\t\t/*\n\t\t\t\t\t * Official standards say that this is ISAKMP_NEXT_SAK,\n\t\t\t\t\t * a part of Group DOI, something we don't implement.\n\t\t\t\t\t * Old non-updated Cisco gear abused this number in ancient NAT drafts.\n\t\t\t\t\t * We ignore (rather than reject) this in support of people\n\t\t\t\t\t * with crufty Cisco machines.\n\t\t\t\t\t */\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage with unsupported payload ISAKMP_NEXT_SAK (or ISAKMP_NEXT_NATD_BADDRAFTS) ignored\",\n\t\t\t\t\t\texcuse);\n\t\t\t\t\t/*\n\t\t\t\t\t * Hack to discard payload, whatever it was.\n\t\t\t\t\t * Since we are skipping the rest of the loop\n\t\t\t\t\t * body we must do some things ourself:\n\t\t\t\t\t * - demarshall the payload\n\t\t\t\t\t * - grab the next payload number (np)\n\t\t\t\t\t * - don't keep payload (don't increment pd)\n\t\t\t\t\t * - skip rest of loop body\n\t\t\t\t\t */\n\t\t\t\t\tif (!in_struct(&pd->payload, &isakmp_ignore_desc, &md->message_pbs,\n\t\t\t\t\t\t &pd->pbs)) {\n\t\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t \"%smalformed payload in packet\",\n\t\t\t\t\t\t excuse);\n\t\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tnp = pd->payload.generic.isag_np;\n\t\t\t\t\t/* NOTE: we do not increment pd! */\n\t\t\t\t\tcontinue; /* skip rest of the loop */\n\n\t\t\t\tdefault:\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage ignored because it contains an unknown or unexpected payload type (%s) at the outermost level\",\n\t\t\t\t\t excuse,\n\t\t\t\t\t enum_show(&ikev1_payload_names, np));\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(INVALID_PAYLOAD_TYPE);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpassert(sd != NULL);\n\t\t\t}\n\n\t\t\tpassert(np < LELEM_ROOF);\n\n\t\t\t{\n\t\t\t\tlset_t s = LELEM(np);\n\n\t\t\t\tif (LDISJOINT(s,\n\t\t\t\t\t needed | smc->opt_payloads |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_VID) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_N) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_D) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_CR) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_CERT))) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage ignored because it contains a payload type (%s) unexpected by state %s\",\n\t\t\t\t\t\texcuse,\n\t\t\t\t\t\tenum_show(&ikev1_payload_names, np),\n\t\t\t\t\t\tst->st_state->name);\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(INVALID_PAYLOAD_TYPE);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tDBG(DBG_PARSING,\n\t\t\t\t DBG_log(\"got payload 0x%\" PRIxLSET\" (%s) needed: 0x%\" PRIxLSET \" opt: 0x%\" PRIxLSET,\n\t\t\t\t\t s, enum_show(&ikev1_payload_names, np),\n\t\t\t\t\t needed, smc->opt_payloads));\n\t\t\t\tneeded &= ~s;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Read in the payload recording what type it\n\t\t\t * should be\n\t\t\t */\n\t\t\tpd->payload_type = np;\n\t\t\tif (!in_struct(&pd->payload, sd, &md->message_pbs,\n\t\t\t\t &pd->pbs)) {\n\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t \"%smalformed payload in packet\",\n\t\t\t\t excuse);\n\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t/* do payload-type specific debugging */\n\t\t\tswitch (np) {\n\t\t\tcase ISAKMP_NEXT_ID:\n\t\t\tcase ISAKMP_NEXT_NATOA_RFC:\n\t\t\t\t/* dump ID section */\n\t\t\t\tDBG(DBG_PARSING,\n\t\t\t\t DBG_dump(\" obj: \", pd->pbs.cur,\n\t\t\t\t\t pbs_left(&pd->pbs)));\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\t/*\n\t\t\t * Place payload at the end of the chain for this type.\n\t\t\t * This code appears in ikev1.c and ikev2.c.\n\t\t\t */\n\t\t\t{\n\t\t\t\t/* np is a proper subscript for chain[] */\n\t\t\t\tpassert(np < elemsof(md->chain));\n\t\t\t\tstruct payload_digest **p = &md->chain[np];\n\n\t\t\t\twhile (*p != NULL)\n\t\t\t\t\tp = &(*p)->next;\n\t\t\t\t*p = pd;\n\t\t\t\tpd->next = NULL;\n\t\t\t}\n\n\t\t\tnp = pd->payload.generic.isag_np;\n\t\t\tmd->digest_roof++;\n\n\t\t\t/* since we've digested one payload happily, it is probably\n\t\t\t * the case that any decryption worked. So we will not suggest\n\t\t\t * encryption failure as an excuse for subsequent payload\n\t\t\t * problems.\n\t\t\t */\n\t\t\texcuse = \"\";\n\t\t}\n\n\t\tDBG(DBG_PARSING, {\n\t\t\t if (pbs_left(&md->message_pbs) != 0)\n\t\t\t\t DBG_log(\"removing %d bytes of padding\",\n\t\t\t\t\t (int) pbs_left(&md->message_pbs));\n\t\t });\n\n\t\tmd->message_pbs.roof = md->message_pbs.cur;\n\n\t\t/* check that all mandatory payloads appeared */\n\n\t\tif (needed != 0) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"message for %s is missing payloads %s\",\n\t\t\t finite_states[from_state]->name,\n\t\t\t bitnamesof(payload_name_ikev1, needed));\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (!check_v1_HASH(smc->hash_type, smc->message, st, md)) {\n\t\t/*SEND_NOTIFICATION(INVALID_HASH_INFORMATION);*/\n\t\treturn;\n\t}\n\n\t/* more sanity checking: enforce most ordering constraints */\n\n\tif (IS_PHASE1(from_state) || IS_PHASE15(from_state)) {\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5 Exchanges:\n\t\t * \"The SA payload MUST precede all other payloads in a phase 1 exchange.\"\n\t\t */\n\t\tif (md->chain[ISAKMP_NEXT_SA] != NULL &&\n\t\t md->hdr.isa_np != ISAKMP_NEXT_SA) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"malformed Phase 1 message: does not start with an SA payload\");\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t} else if (IS_QUICK(from_state)) {\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5.5 Phase 2 - Quick Mode\n\t\t *\n\t\t * \"In Quick Mode, a HASH payload MUST immediately follow the ISAKMP\n\t\t * header and a SA payload MUST immediately follow the HASH.\"\n\t\t * [NOTE: there may be more than one SA payload, so this is not\n\t\t * totally reasonable. Probably all SAs should be so constrained.]\n\t\t *\n\t\t * \"If ISAKMP is acting as a client negotiator on behalf of another\n\t\t * party, the identities of the parties MUST be passed as IDci and\n\t\t * then IDcr.\"\n\t\t *\n\t\t * \"With the exception of the HASH, SA, and the optional ID payloads,\n\t\t * there are no payload ordering restrictions on Quick Mode.\"\n\t\t */\n\n\t\tif (md->hdr.isa_np != ISAKMP_NEXT_HASH) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"malformed Quick Mode message: does not start with a HASH payload\");\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t{\n\t\t\tstruct payload_digest *p;\n\t\t\tint i;\n\n\t\t\tp = md->chain[ISAKMP_NEXT_SA];\n\t\t\ti = 1;\n\t\t\twhile (p != NULL) {\n\t\t\t\tif (p != &md->digest[i]) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t \"malformed Quick Mode message: SA payload is in wrong position\");\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tp = p->next;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5.5 Phase 2 - Quick Mode:\n\t\t * \"If ISAKMP is acting as a client negotiator on behalf of another\n\t\t * party, the identities of the parties MUST be passed as IDci and\n\t\t * then IDcr.\"\n\t\t */\n\t\t{\n\t\t\tstruct payload_digest *id = md->chain[ISAKMP_NEXT_ID];\n\n\t\t\tif (id != NULL) {\n\t\t\t\tif (id->next == NULL ||\n\t\t\t\t id->next->next != NULL) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"malformed Quick Mode message: if any ID payload is present, there must be exactly two\");\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (id + 1 != id->next) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"malformed Quick Mode message: the ID payloads are not adjacent\");\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Ignore payloads that we don't handle:\n\t */\n\t/* XXX Handle Notifications */\n\t{\n\t\tstruct payload_digest *p = md->chain[ISAKMP_NEXT_N];\n\n\t\twhile (p != NULL) {\n\t\t\tswitch (p->payload.notification.isan_type) {\n\t\t\tcase R_U_THERE:\n\t\t\tcase R_U_THERE_ACK:\n\t\t\tcase ISAKMP_N_CISCO_LOAD_BALANCE:\n\t\t\tcase PAYLOAD_MALFORMED:\n\t\t\tcase INVALID_MESSAGE_ID:\n\t\t\tcase IPSEC_RESPONDER_LIFETIME:\n\t\t\t\tif (md->hdr.isa_xchg == ISAKMP_XCHG_INFO) {\n\t\t\t\t\t/* these are handled later on in informational() */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t/* FALL THROUGH */\n\t\t\tdefault:\n\t\t\t\tif (st == NULL) {\n\t\t\t\t\tDBG(DBG_CONTROL, DBG_log(\n\t\t\t\t\t \"ignoring informational payload %s, no corresponding state\",\n\t\t\t\t\t enum_show(& ikev1_notify_names,\n\t\t\t\t\t\t\t p->payload.notification.isan_type)));\n\t\t\t\t} else {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t \"ignoring informational payload %s, msgid=%08\" PRIx32 \", length=%d\",\n\t\t\t\t\t enum_show(&ikev1_notify_names,\n\t\t\t\t\t\t\t p->payload.notification.isan_type),\n\t\t\t\t\t st->st_v1_msgid.id,\n\t\t\t\t\t p->payload.notification.isan_length);\n\t\t\t\t\tDBG_dump_pbs(&p->pbs);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (DBGP(DBG_BASE)) {\n\t\t\t\tDBG_dump(\"info:\", p->pbs.cur,\n\t\t\t\t\t pbs_left(&p->pbs));\n\t\t\t}\n\n\t\t\tp = p->next;\n\t\t}\n\n\t\tp = md->chain[ISAKMP_NEXT_D];\n\t\twhile (p != NULL) {\n\t\t\tself_delete |= accept_delete(md, p);\n\t\t\tif (DBGP(DBG_BASE)) {\n\t\t\t\tDBG_dump(\"del:\", p->pbs.cur,\n\t\t\t\t\t pbs_left(&p->pbs));\n\t\t\t}\n\t\t\tif (md->st != st) {\n\t\t\t\tpexpect(md->st == NULL);\n\t\t\t\tdbg(\"zapping ST as accept_delete() zapped MD.ST\");\n\t\t\t\tst = md->st;\n\t\t\t}\n\t\t\tp = p->next;\n\t\t}\n\n\t\tp = md->chain[ISAKMP_NEXT_VID];\n\t\twhile (p != NULL) {\n\t\t\thandle_vendorid(md, (char *)p->pbs.cur,\n\t\t\t\t\tpbs_left(&p->pbs), FALSE);\n\t\t\tp = p->next;\n\t\t}\n\t}\n\n\tif (self_delete) {\n\t\taccept_self_delete(md);\n\t\tst = md->st;\n\t\t/* note: st ought to be NULL from here on */\n\t}\n\n\tpexpect(st == md->st);\n\tstatetime_t start = statetime_start(md->st);\n\t/*\n\t * XXX: danger - the .informational() processor deletes ST;\n\t * and then tunnels this loss through MD.ST.\n\t */\n\tcomplete_v1_state_transition(md, smc->processor(st, md));\n\tstatetime_stop(&start, \"%s()\", __func__);\n\t/* our caller will release_any_md(mdp); */\n}","target":"void process_packet_tail(struct msg_digest *md)\n{\n\tstruct state *st = md->st;\n\tenum state_kind from_state = md->v1_from_state;\n\tconst struct state_v1_microcode *smc = md->smc;\n\tbool new_iv_set = md->new_iv_set;\n\tbool self_delete = FALSE;\n\n\tif (md->hdr.isa_flags & ISAKMP_FLAGS_v1_ENCRYPTION) {\n\t\tendpoint_buf b;\n\t\tdbg(\"received encrypted packet from %s\", str_endpoint(&md->sender, &b));\n\n\t\tif (st == NULL) {\n\t\t\tlibreswan_log(\n\t\t\t\t\"discarding encrypted message for an unknown ISAKMP SA\");\n\t\t\treturn;\n\t\t}\n\t\tif (st->st_skeyid_e_nss == NULL) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\"discarding encrypted message because we haven't yet negotiated keying material\");\n\t\t\treturn;\n\t\t}\n\n\t\t/* Mark as encrypted */\n\t\tmd->encrypted = TRUE;\n\n\t\t/* do the specified decryption\n\t\t *\n\t\t * IV is from st->st_iv or (if new_iv_set) st->st_new_iv.\n\t\t * The new IV is placed in st->st_new_iv\n\t\t *\n\t\t * See RFC 2409 \"IKE\" Appendix B\n\t\t *\n\t\t * XXX The IV should only be updated really if the packet\n\t\t * is successfully processed.\n\t\t * We should keep this value, check for a success return\n\t\t * value from the parsing routines and then replace.\n\t\t *\n\t\t * Each post phase 1 exchange generates IVs from\n\t\t * the last phase 1 block, not the last block sent.\n\t\t */\n\t\tconst struct encrypt_desc *e = st->st_oakley.ta_encrypt;\n\n\t\tif (pbs_left(&md->message_pbs) % e->enc_blocksize != 0) {\n\t\t\tloglog(RC_LOG_SERIOUS, \"malformed message: not a multiple of encryption blocksize\");\n\t\t\treturn;\n\t\t}\n\n\t\t/* XXX Detect weak keys */\n\n\t\t/* grab a copy of raw packet (for duplicate packet detection) */\n\t\tmd->raw_packet = clone_bytes_as_chunk(md->packet_pbs.start,\n\t\t\t\t\t\t pbs_room(&md->packet_pbs),\n\t\t\t\t\t\t \"raw packet\");\n\n\t\t/* Decrypt everything after header */\n\t\tif (!new_iv_set) {\n\t\t\tif (st->st_v1_iv.len == 0) {\n\t\t\t\tinit_phase2_iv(st, &md->hdr.isa_msgid);\n\t\t\t} else {\n\t\t\t\t/* use old IV */\n\t\t\t\trestore_new_iv(st, st->st_v1_iv);\n\t\t\t}\n\t\t}\n\n\t\tpassert(st->st_v1_new_iv.len >= e->enc_blocksize);\n\t\tst->st_v1_new_iv.len = e->enc_blocksize; /* truncate */\n\n\t\tif (DBGP(DBG_CRYPT)) {\n\t\t\tDBG_log(\"decrypting %u bytes using algorithm %s\",\n\t\t\t\t(unsigned) pbs_left(&md->message_pbs),\n\t\t\t\tst->st_oakley.ta_encrypt->common.fqn);\n\t\t\tDBG_dump_hunk(\"IV before:\", st->st_v1_new_iv);\n\t\t}\n\t\te->encrypt_ops->do_crypt(e, md->message_pbs.cur,\n\t\t\t\t\t pbs_left(&md->message_pbs),\n\t\t\t\t\t st->st_enc_key_nss,\n\t\t\t\t\t st->st_v1_new_iv.ptr, FALSE);\n\t\tif (DBGP(DBG_CRYPT)) {\n\t\t\tDBG_dump_hunk(\"IV after:\", st->st_v1_new_iv);\n\t\t\tDBG_log(\"decrypted payload (starts at offset %td):\",\n\t\t\t\tmd->message_pbs.cur - md->message_pbs.roof);\n\t\t\tDBG_dump(NULL, md->message_pbs.start,\n\t\t\t\t md->message_pbs.roof - md->message_pbs.start);\n\t\t}\n\t} else {\n\t\t/* packet was not encryped -- should it have been? */\n\n\t\tif (smc->flags & SMF_INPUT_ENCRYPTED) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"packet rejected: should have been encrypted\");\n\t\t\tSEND_NOTIFICATION(INVALID_FLAGS);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/* Digest the message.\n\t * Padding must be removed to make hashing work.\n\t * Padding comes from encryption (so this code must be after decryption).\n\t * Padding rules are described before the definition of\n\t * struct isakmp_hdr in packet.h.\n\t */\n\t{\n\t\tenum next_payload_types_ikev1 np = md->hdr.isa_np;\n\t\tlset_t needed = smc->req_payloads;\n\t\tconst char *excuse =\n\t\t\tLIN(SMF_PSK_AUTH | SMF_FIRST_ENCRYPTED_INPUT,\n\t\t\t smc->flags) ?\n\t\t\t\"probable authentication failure (mismatch of preshared secrets?): \"\n\t\t\t:\n\t\t\t\"\";\n\n\t\twhile (np != ISAKMP_NEXT_NONE) {\n\t\t\tstruct_desc *sd = v1_payload_desc(np);\n\n\t\t\tif (md->digest_roof >= elemsof(md->digest)) {\n\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t \"more than %zu payloads in message; ignored\",\n\t\t\t\t elemsof(md->digest));\n\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstruct payload_digest *const pd = md->digest + md->digest_roof;\n\n\t\t\t/*\n\t\t\t * only do this in main mode. In aggressive mode, there\n\t\t\t * is no negotiation of NAT-T method. Get it right.\n\t\t\t */\n\t\t\tif (st != NULL && st->st_connection != NULL &&\n\t\t\t (st->st_connection->policy & POLICY_AGGRESSIVE) == LEMPTY)\n\t\t\t{\n\t\t\t\tswitch (np) {\n\t\t\t\tcase ISAKMP_NEXT_NATD_RFC:\n\t\t\t\tcase ISAKMP_NEXT_NATOA_RFC:\n\t\t\t\t\tif ((st->hidden_variables.st_nat_traversal & NAT_T_WITH_RFC_VALUES) == LEMPTY) {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * don't accept NAT-D/NAT-OA reloc directly in message,\n\t\t\t\t\t\t * unless we're using NAT-T RFC\n\t\t\t\t\t\t */\n\t\t\t\t\t\tDBG(DBG_NATT,\n\t\t\t\t\t\t DBG_log(\"st_nat_traversal was: %s\",\n\t\t\t\t\t\t\t bitnamesof(natt_bit_names,\n\t\t\t\t\t\t\t\t st->hidden_variables.st_nat_traversal)));\n\t\t\t\t\t\tsd = NULL;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (sd == NULL) {\n\t\t\t\t/* payload type is out of range or requires special handling */\n\t\t\t\tswitch (np) {\n\t\t\t\tcase ISAKMP_NEXT_ID:\n\t\t\t\t\t/* ??? two kinds of ID payloads */\n\t\t\t\t\tsd = (IS_PHASE1(from_state) ||\n\t\t\t\t\t IS_PHASE15(from_state)) ?\n\t\t\t\t\t\t&isakmp_identification_desc :\n\t\t\t\t\t\t&isakmp_ipsec_identification_desc;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_NATD_DRAFTS: /* out of range */\n\t\t\t\t\t/*\n\t\t\t\t\t * ISAKMP_NEXT_NATD_DRAFTS was a private use type before RFC-3947.\n\t\t\t\t\t * Since it has the same format as ISAKMP_NEXT_NATD_RFC,\n\t\t\t\t\t * just rewrite np and sd, and carry on.\n\t\t\t\t\t */\n\t\t\t\t\tnp = ISAKMP_NEXT_NATD_RFC;\n\t\t\t\t\tsd = &isakmp_nat_d_drafts;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_NATOA_DRAFTS: /* out of range */\n\t\t\t\t\t/* NAT-OA was a private use type before RFC-3947 -- same format */\n\t\t\t\t\tnp = ISAKMP_NEXT_NATOA_RFC;\n\t\t\t\t\tsd = &isakmp_nat_oa_drafts;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ISAKMP_NEXT_SAK: /* or ISAKMP_NEXT_NATD_BADDRAFTS */\n\t\t\t\t\t/*\n\t\t\t\t\t * Official standards say that this is ISAKMP_NEXT_SAK,\n\t\t\t\t\t * a part of Group DOI, something we don't implement.\n\t\t\t\t\t * Old non-updated Cisco gear abused this number in ancient NAT drafts.\n\t\t\t\t\t * We ignore (rather than reject) this in support of people\n\t\t\t\t\t * with crufty Cisco machines.\n\t\t\t\t\t */\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage with unsupported payload ISAKMP_NEXT_SAK (or ISAKMP_NEXT_NATD_BADDRAFTS) ignored\",\n\t\t\t\t\t\texcuse);\n\t\t\t\t\t/*\n\t\t\t\t\t * Hack to discard payload, whatever it was.\n\t\t\t\t\t * Since we are skipping the rest of the loop\n\t\t\t\t\t * body we must do some things ourself:\n\t\t\t\t\t * - demarshall the payload\n\t\t\t\t\t * - grab the next payload number (np)\n\t\t\t\t\t * - don't keep payload (don't increment pd)\n\t\t\t\t\t * - skip rest of loop body\n\t\t\t\t\t */\n\t\t\t\t\tif (!in_struct(&pd->payload, &isakmp_ignore_desc, &md->message_pbs,\n\t\t\t\t\t\t &pd->pbs)) {\n\t\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t \"%smalformed payload in packet\",\n\t\t\t\t\t\t excuse);\n\t\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tnp = pd->payload.generic.isag_np;\n\t\t\t\t\t/* NOTE: we do not increment pd! */\n\t\t\t\t\tcontinue; /* skip rest of the loop */\n\n\t\t\t\tdefault:\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage ignored because it contains an unknown or unexpected payload type (%s) at the outermost level\",\n\t\t\t\t\t excuse,\n\t\t\t\t\t enum_show(&ikev1_payload_names, np));\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(INVALID_PAYLOAD_TYPE);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpassert(sd != NULL);\n\t\t\t}\n\n\t\t\tpassert(np < LELEM_ROOF);\n\n\t\t\t{\n\t\t\t\tlset_t s = LELEM(np);\n\n\t\t\t\tif (LDISJOINT(s,\n\t\t\t\t\t needed | smc->opt_payloads |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_VID) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_N) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_D) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_CR) |\n\t\t\t\t\t LELEM(ISAKMP_NEXT_CERT))) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"%smessage ignored because it contains a payload type (%s) unexpected by state %s\",\n\t\t\t\t\t\texcuse,\n\t\t\t\t\t\tenum_show(&ikev1_payload_names, np),\n\t\t\t\t\t\tfinite_states[smc->state]->name);\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(INVALID_PAYLOAD_TYPE);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tDBG(DBG_PARSING,\n\t\t\t\t DBG_log(\"got payload 0x%\" PRIxLSET\" (%s) needed: 0x%\" PRIxLSET \" opt: 0x%\" PRIxLSET,\n\t\t\t\t\t s, enum_show(&ikev1_payload_names, np),\n\t\t\t\t\t needed, smc->opt_payloads));\n\t\t\t\tneeded &= ~s;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Read in the payload recording what type it\n\t\t\t * should be\n\t\t\t */\n\t\t\tpd->payload_type = np;\n\t\t\tif (!in_struct(&pd->payload, sd, &md->message_pbs,\n\t\t\t\t &pd->pbs)) {\n\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t \"%smalformed payload in packet\",\n\t\t\t\t excuse);\n\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t/* do payload-type specific debugging */\n\t\t\tswitch (np) {\n\t\t\tcase ISAKMP_NEXT_ID:\n\t\t\tcase ISAKMP_NEXT_NATOA_RFC:\n\t\t\t\t/* dump ID section */\n\t\t\t\tDBG(DBG_PARSING,\n\t\t\t\t DBG_dump(\" obj: \", pd->pbs.cur,\n\t\t\t\t\t pbs_left(&pd->pbs)));\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\n\n\t\t\t/*\n\t\t\t * Place payload at the end of the chain for this type.\n\t\t\t * This code appears in ikev1.c and ikev2.c.\n\t\t\t */\n\t\t\t{\n\t\t\t\t/* np is a proper subscript for chain[] */\n\t\t\t\tpassert(np < elemsof(md->chain));\n\t\t\t\tstruct payload_digest **p = &md->chain[np];\n\n\t\t\t\twhile (*p != NULL)\n\t\t\t\t\tp = &(*p)->next;\n\t\t\t\t*p = pd;\n\t\t\t\tpd->next = NULL;\n\t\t\t}\n\n\t\t\tnp = pd->payload.generic.isag_np;\n\t\t\tmd->digest_roof++;\n\n\t\t\t/* since we've digested one payload happily, it is probably\n\t\t\t * the case that any decryption worked. So we will not suggest\n\t\t\t * encryption failure as an excuse for subsequent payload\n\t\t\t * problems.\n\t\t\t */\n\t\t\texcuse = \"\";\n\t\t}\n\n\t\tDBG(DBG_PARSING, {\n\t\t\t if (pbs_left(&md->message_pbs) != 0)\n\t\t\t\t DBG_log(\"removing %d bytes of padding\",\n\t\t\t\t\t (int) pbs_left(&md->message_pbs));\n\t\t });\n\n\t\tmd->message_pbs.roof = md->message_pbs.cur;\n\n\t\t/* check that all mandatory payloads appeared */\n\n\t\tif (needed != 0) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"message for %s is missing payloads %s\",\n\t\t\t finite_states[from_state]->name,\n\t\t\t bitnamesof(payload_name_ikev1, needed));\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (!check_v1_HASH(smc->hash_type, smc->message, st, md)) {\n\t\t/*SEND_NOTIFICATION(INVALID_HASH_INFORMATION);*/\n\t\treturn;\n\t}\n\n\t/* more sanity checking: enforce most ordering constraints */\n\n\tif (IS_PHASE1(from_state) || IS_PHASE15(from_state)) {\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5 Exchanges:\n\t\t * \"The SA payload MUST precede all other payloads in a phase 1 exchange.\"\n\t\t */\n\t\tif (md->chain[ISAKMP_NEXT_SA] != NULL &&\n\t\t md->hdr.isa_np != ISAKMP_NEXT_SA) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"malformed Phase 1 message: does not start with an SA payload\");\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t} else if (IS_QUICK(from_state)) {\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5.5 Phase 2 - Quick Mode\n\t\t *\n\t\t * \"In Quick Mode, a HASH payload MUST immediately follow the ISAKMP\n\t\t * header and a SA payload MUST immediately follow the HASH.\"\n\t\t * [NOTE: there may be more than one SA payload, so this is not\n\t\t * totally reasonable. Probably all SAs should be so constrained.]\n\t\t *\n\t\t * \"If ISAKMP is acting as a client negotiator on behalf of another\n\t\t * party, the identities of the parties MUST be passed as IDci and\n\t\t * then IDcr.\"\n\t\t *\n\t\t * \"With the exception of the HASH, SA, and the optional ID payloads,\n\t\t * there are no payload ordering restrictions on Quick Mode.\"\n\t\t */\n\n\t\tif (md->hdr.isa_np != ISAKMP_NEXT_HASH) {\n\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t \"malformed Quick Mode message: does not start with a HASH payload\");\n\t\t\tif (!md->encrypted) {\n\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t{\n\t\t\tstruct payload_digest *p;\n\t\t\tint i;\n\n\t\t\tp = md->chain[ISAKMP_NEXT_SA];\n\t\t\ti = 1;\n\t\t\twhile (p != NULL) {\n\t\t\t\tif (p != &md->digest[i]) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t \"malformed Quick Mode message: SA payload is in wrong position\");\n\t\t\t\t\tif (!md->encrypted) {\n\t\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tp = p->next;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\n\t\t/* rfc2409: The Internet Key Exchange (IKE), 5.5 Phase 2 - Quick Mode:\n\t\t * \"If ISAKMP is acting as a client negotiator on behalf of another\n\t\t * party, the identities of the parties MUST be passed as IDci and\n\t\t * then IDcr.\"\n\t\t */\n\t\t{\n\t\t\tstruct payload_digest *id = md->chain[ISAKMP_NEXT_ID];\n\n\t\t\tif (id != NULL) {\n\t\t\t\tif (id->next == NULL ||\n\t\t\t\t id->next->next != NULL) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"malformed Quick Mode message: if any ID payload is present, there must be exactly two\");\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (id + 1 != id->next) {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t\t\"malformed Quick Mode message: the ID payloads are not adjacent\");\n\t\t\t\t\tSEND_NOTIFICATION(PAYLOAD_MALFORMED);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Ignore payloads that we don't handle:\n\t */\n\t/* XXX Handle Notifications */\n\t{\n\t\tstruct payload_digest *p = md->chain[ISAKMP_NEXT_N];\n\n\t\twhile (p != NULL) {\n\t\t\tswitch (p->payload.notification.isan_type) {\n\t\t\tcase R_U_THERE:\n\t\t\tcase R_U_THERE_ACK:\n\t\t\tcase ISAKMP_N_CISCO_LOAD_BALANCE:\n\t\t\tcase PAYLOAD_MALFORMED:\n\t\t\tcase INVALID_MESSAGE_ID:\n\t\t\tcase IPSEC_RESPONDER_LIFETIME:\n\t\t\t\tif (md->hdr.isa_xchg == ISAKMP_XCHG_INFO) {\n\t\t\t\t\t/* these are handled later on in informational() */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t/* FALL THROUGH */\n\t\t\tdefault:\n\t\t\t\tif (st == NULL) {\n\t\t\t\t\tDBG(DBG_CONTROL, DBG_log(\n\t\t\t\t\t \"ignoring informational payload %s, no corresponding state\",\n\t\t\t\t\t enum_show(& ikev1_notify_names,\n\t\t\t\t\t\t\t p->payload.notification.isan_type)));\n\t\t\t\t} else {\n\t\t\t\t\tloglog(RC_LOG_SERIOUS,\n\t\t\t\t\t \"ignoring informational payload %s, msgid=%08\" PRIx32 \", length=%d\",\n\t\t\t\t\t enum_show(&ikev1_notify_names,\n\t\t\t\t\t\t\t p->payload.notification.isan_type),\n\t\t\t\t\t st->st_v1_msgid.id,\n\t\t\t\t\t p->payload.notification.isan_length);\n\t\t\t\t\tDBG_dump_pbs(&p->pbs);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (DBGP(DBG_BASE)) {\n\t\t\t\tDBG_dump(\"info:\", p->pbs.cur,\n\t\t\t\t\t pbs_left(&p->pbs));\n\t\t\t}\n\n\t\t\tp = p->next;\n\t\t}\n\n\t\tp = md->chain[ISAKMP_NEXT_D];\n\t\twhile (p != NULL) {\n\t\t\tself_delete |= accept_delete(md, p);\n\t\t\tif (DBGP(DBG_BASE)) {\n\t\t\t\tDBG_dump(\"del:\", p->pbs.cur,\n\t\t\t\t\t pbs_left(&p->pbs));\n\t\t\t}\n\t\t\tif (md->st != st) {\n\t\t\t\tpexpect(md->st == NULL);\n\t\t\t\tdbg(\"zapping ST as accept_delete() zapped MD.ST\");\n\t\t\t\tst = md->st;\n\t\t\t}\n\t\t\tp = p->next;\n\t\t}\n\n\t\tp = md->chain[ISAKMP_NEXT_VID];\n\t\twhile (p != NULL) {\n\t\t\thandle_vendorid(md, (char *)p->pbs.cur,\n\t\t\t\t\tpbs_left(&p->pbs), FALSE);\n\t\t\tp = p->next;\n\t\t}\n\t}\n\n\tif (self_delete) {\n\t\taccept_self_delete(md);\n\t\tst = md->st;\n\t\t/* note: st ought to be NULL from here on */\n\t}\n\n\tpexpect(st == md->st);\n\tstatetime_t start = statetime_start(md->st);\n\t/*\n\t * XXX: danger - the .informational() processor deletes ST;\n\t * and then tunnels this loss through MD.ST.\n\t */\n\tcomplete_v1_state_transition(md, smc->processor(st, md));\n\tstatetime_stop(&start, \"%s()\", __func__);\n\t/* our caller will release_any_md(mdp); */\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"process_packet_tail","file_name":"programs/pluto/ikev1.c","commit_link":"github.com/libreswan/libreswan/commit/471a3e41a449d7c753bc4edbba4239501bb62ba8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#16-8374bd40e0c6","input":"std::vector CSoundFile::GetLength(enmGetLengthResetMode adjustMode, GetLengthTarget target)\n{\n\tstd::vector results;\n\tGetLengthType retval;\n\tretval.startOrder = target.startOrder;\n\tretval.startRow = target.startRow;\n\n\t// Are we trying to reach a certain pattern position?\n\tconst bool hasSearchTarget = target.mode != GetLengthTarget::NoTarget;\n\tconst bool adjustSamplePos = (adjustMode & eAdjustSamplePositions) == eAdjustSamplePositions;\n\n\tSEQUENCEINDEX sequence = target.sequence;\n\tif(sequence >= Order.GetNumSequences()) sequence = Order.GetCurrentSequenceIndex();\n\tconst ModSequence &orderList = Order(sequence);\n\n\tGetLengthMemory memory(*this);\n\tCSoundFile::PlayState &playState = *memory.state;\n\t// Temporary visited rows vector (so that GetLength() won't interfere with the player code if the module is playing at the same time)\n\tRowVisitor visitedRows(*this, sequence);\n\n\tplayState.m_nNextRow = playState.m_nRow = target.startRow;\n\tplayState.m_nNextOrder = playState.m_nCurrentOrder = target.startOrder;\n\n\t// Fast LUTs for commands that are too weird / complicated / whatever to emulate in sample position adjust mode.\n\tstd::bitset forbiddenCommands;\n\tstd::bitset forbiddenVolCommands;\n\n\tif(adjustSamplePos)\n\t{\n\t\tforbiddenCommands.set(CMD_ARPEGGIO); forbiddenCommands.set(CMD_PORTAMENTOUP);\n\t\tforbiddenCommands.set(CMD_PORTAMENTODOWN); forbiddenCommands.set(CMD_XFINEPORTAUPDOWN);\n\t\tforbiddenCommands.set(CMD_NOTESLIDEUP); forbiddenCommands.set(CMD_NOTESLIDEUPRETRIG);\n\t\tforbiddenCommands.set(CMD_NOTESLIDEDOWN); forbiddenCommands.set(CMD_NOTESLIDEDOWNRETRIG);\n\t\tforbiddenVolCommands.set(VOLCMD_PORTAUP); forbiddenVolCommands.set(VOLCMD_PORTADOWN);\n\n\t\t// Optimize away channels for which it's pointless to adjust sample positions\n\t\tfor(CHANNELINDEX i = 0; i < GetNumChannels(); i++)\n\t\t{\n\t\t\tif(ChnSettings[i].dwFlags[CHN_MUTE]) memory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL;\n\t\t}\n\t\tif(target.mode == GetLengthTarget::SeekPosition && target.pos.order < orderList.size())\n\t\t{\n\t\t\t// If we know where to seek, we can directly rule out any channels on which a new note would be triggered right at the start.\n\t\t\tconst PATTERNINDEX seekPat = orderList[target.pos.order];\n\t\t\tif(Patterns.IsValidPat(seekPat) && Patterns[seekPat].IsValidRow(target.pos.row))\n\t\t\t{\n\t\t\t\tconst ModCommand *m = Patterns[seekPat].GetRow(target.pos.row);\n\t\t\t\tfor(CHANNELINDEX i = 0; i < GetNumChannels(); i++, m++)\n\t\t\t\t{\n\t\t\t\t\tif(m->note == NOTE_NOTECUT || m->note == NOTE_KEYOFF || (m->note == NOTE_FADE && GetNumInstruments())\n\t\t\t\t\t\t|| (m->IsNote() && !m->IsPortamento()))\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// If samples are being synced, force them to resync if tick duration changes\n\tuint32 oldTickDuration = 0;\n\n\tfor (;;)\n\t{\n\t\t// Time target reached.\n\t\tif(target.mode == GetLengthTarget::SeekSeconds && memory.elapsedTime >= target.time)\n\t\t{\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\tuint32 rowDelay = 0, tickDelay = 0;\n\t\tplayState.m_nRow = playState.m_nNextRow;\n\t\tplayState.m_nCurrentOrder = playState.m_nNextOrder;\n\n\t\tif(orderList.IsValidPat(playState.m_nCurrentOrder) && playState.m_nRow >= Patterns[orderList[playState.m_nCurrentOrder]].GetNumRows())\n\t\t{\n\t\t\tplayState.m_nRow = 0;\n\t\t\tif(m_playBehaviour[kFT2LoopE60Restart])\n\t\t\t{\n\t\t\t\tplayState.m_nRow = playState.m_nNextPatStartRow;\n\t\t\t\tplayState.m_nNextPatStartRow = 0;\n\t\t\t}\n\t\t\tplayState.m_nCurrentOrder = ++playState.m_nNextOrder;\n\t\t}\n\n\t\t// Check if pattern is valid\n\t\tplayState.m_nPattern = playState.m_nCurrentOrder < orderList.size() ? orderList[playState.m_nCurrentOrder] : orderList.GetInvalidPatIndex();\n\t\tbool positionJumpOnThisRow = false;\n\t\tbool patternBreakOnThisRow = false;\n\t\tbool patternLoopEndedOnThisRow = false, patternLoopStartedOnThisRow = false;\n\n\t\tif(!Patterns.IsValidPat(playState.m_nPattern) && playState.m_nPattern != orderList.GetInvalidPatIndex() && target.mode == GetLengthTarget::SeekPosition && playState.m_nCurrentOrder == target.pos.order)\n\t\t{\n\t\t\t// Early test: Target is inside +++ or non-existing pattern\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\twhile(playState.m_nPattern >= Patterns.Size())\n\t\t{\n\t\t\t// End of song?\n\t\t\tif((playState.m_nPattern == orderList.GetInvalidPatIndex()) || (playState.m_nCurrentOrder >= orderList.size()))\n\t\t\t{\n\t\t\t\tif(playState.m_nCurrentOrder == orderList.GetRestartPos())\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tplayState.m_nCurrentOrder = orderList.GetRestartPos();\n\t\t\t} else\n\t\t\t{\n\t\t\t\tplayState.m_nCurrentOrder++;\n\t\t\t}\n\t\t\tplayState.m_nPattern = (playState.m_nCurrentOrder < orderList.size()) ? orderList[playState.m_nCurrentOrder] : orderList.GetInvalidPatIndex();\n\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder;\n\t\t\tif((!Patterns.IsValidPat(playState.m_nPattern)) && visitedRows.IsVisited(playState.m_nCurrentOrder, 0, true))\n\t\t\t{\n\t\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t\t{\n\t\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\t\tbreak;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\t\tresults.push_back(retval);\n\t\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\t\tmemory.Reset();\n\n\t\t\t\t\tplayState.m_nCurrentOrder = playState.m_nNextOrder;\n\t\t\t\t\tplayState.m_nPattern = orderList[playState.m_nCurrentOrder];\n\t\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(playState.m_nNextOrder == ORDERINDEX_INVALID)\n\t\t{\n\t\t\t// GetFirstUnvisitedRow failed, so there is nothing more to play\n\t\t\tbreak;\n\t\t}\n\n\t\t// Skip non-existing patterns\n\t\tif(!Patterns.IsValidPat(playState.m_nPattern))\n\t\t{\n\t\t\t// If there isn't even a tune, we should probably stop here.\n\t\t\tif(playState.m_nCurrentOrder == orderList.GetRestartPos())\n\t\t\t{\n\t\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t\t{\n\t\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\t\tbreak;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\t\tresults.push_back(retval);\n\t\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\t\tmemory.Reset();\n\t\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder + 1;\n\t\t\tcontinue;\n\t\t}\n\t\t// Should never happen\n\t\tif(playState.m_nRow >= Patterns[playState.m_nPattern].GetNumRows())\n\t\t\tplayState.m_nRow = 0;\n\n\t\t// Check whether target was reached.\n\t\tif(target.mode == GetLengthTarget::SeekPosition && playState.m_nCurrentOrder == target.pos.order && playState.m_nRow == target.pos.row)\n\t\t{\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\tif(visitedRows.IsVisited(playState.m_nCurrentOrder, playState.m_nRow, true))\n\t\t{\n\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t{\n\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\tbreak;\n\t\t\t} else\n\t\t\t{\n\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\tresults.push_back(retval);\n\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\tmemory.Reset();\n\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tretval.endOrder = playState.m_nCurrentOrder;\n\t\tretval.endRow = playState.m_nRow;\n\n\t\t// Update next position\n\t\tplayState.m_nNextRow = playState.m_nRow + 1;\n\n\t\t// Jumped to invalid pattern row?\n\t\tif(playState.m_nRow >= Patterns[playState.m_nPattern].GetNumRows())\n\t\t{\n\t\t\tplayState.m_nRow = 0;\n\t\t}\n\t\t// New pattern?\n\t\tif(!playState.m_nRow)\n\t\t{\n\t\t\tfor(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++)\n\t\t\t{\n\t\t\t\tmemory.chnSettings[chn].patLoop = memory.elapsedTime;\n\t\t\t\tmemory.chnSettings[chn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t}\n\t\t}\n\n\t\tModChannel *pChn = playState.Chn;\n\t\t\n\t\t// For various effects, we need to know first how many ticks there are in this row.\n\t\tconst ModCommand *p = Patterns[playState.m_nPattern].GetpModCommand(playState.m_nRow, 0);\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, p++)\n\t\t{\n\t\t\tif(m_playBehaviour[kST3NoMutedChannels] && ChnSettings[nChn].dwFlags[CHN_MUTE])\t// not even effects are processed on muted S3M channels\n\t\t\t\tcontinue;\n\t\t\tif(p->IsPcNote())\n\t\t\t{\n#ifndef NO_PLUGINS\n\t\t\t\tif((adjustMode & eAdjust) && p->instr > 0 && p->instr <= MAX_MIXPLUGINS)\n\t\t\t\t{\n\t\t\t\t\tmemory.plugParams[std::make_pair(p->instr, p->GetValueVolCol())] = p->GetValueEffectCol();\n\t\t\t\t}\n#endif // NO_PLUGINS\n\t\t\t\tpChn[nChn].rowCommand.Clear();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tpChn[nChn].rowCommand = *p;\n\t\t\tswitch(p->command)\n\t\t\t{\n\t\t\tcase CMD_SPEED:\n\t\t\t\tSetSpeed(playState, p->param);\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_TEMPO:\n\t\t\t\tif(m_playBehaviour[kMODVBlankTiming])\n\t\t\t\t{\n\t\t\t\t\t// ProTracker MODs with VBlank timing: All Fxx parameters set the tick count.\n\t\t\t\t\tif(p->param != 0) SetSpeed(playState, p->param);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tif((p->param & 0xF0) == 0x60)\n\t\t\t\t{\n\t\t\t\t\t// Fine Pattern Delay\n\t\t\t\t\ttickDelay += (p->param & 0x0F);\n\t\t\t\t} else if((p->param & 0xF0) == 0xE0 && !rowDelay)\n\t\t\t\t{\n\t\t\t\t\t// Pattern Delay\n\t\t\t\t\tif(!(GetType() & MOD_TYPE_S3M) || (p->param & 0x0F) != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t// While Impulse Tracker *does* count S60 as a valid row delay (and thus ignores any other row delay commands on the right),\n\t\t\t\t\t\t// Scream Tracker 3 simply ignores such commands.\n\t\t\t\t\t\trowDelay = 1 + (p->param & 0x0F);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tif((p->param & 0xF0) == 0xE0)\n\t\t\t\t{\n\t\t\t\t\t// Pattern Delay\n\t\t\t\t\trowDelay = 1 + (p->param & 0x0F);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(rowDelay == 0) rowDelay = 1;\n\t\tconst uint32 numTicks = (playState.m_nMusicSpeed + tickDelay) * rowDelay;\n\t\tconst uint32 nonRowTicks = numTicks - rowDelay;\n\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++) if(!pChn->rowCommand.IsEmpty())\n\t\t{\n\t\t\tif(m_playBehaviour[kST3NoMutedChannels] && ChnSettings[nChn].dwFlags[CHN_MUTE])\t// not even effects are processed on muted S3M channels\n\t\t\t\tcontinue;\n\t\t\tModCommand::COMMAND command = pChn->rowCommand.command;\n\t\t\tModCommand::PARAM param = pChn->rowCommand.param;\n\t\t\tModCommand::NOTE note = pChn->rowCommand.note;\n\n\t\t\tif (pChn->rowCommand.instr)\n\t\t\t{\n\t\t\t\tpChn->nNewIns = pChn->rowCommand.instr;\n\t\t\t\tpChn->nLastNote = NOTE_NONE;\n\t\t\t\tmemory.chnSettings[nChn].vol = 0xFF;\n\t\t\t}\n\t\t\tif (pChn->rowCommand.IsNote()) pChn->nLastNote = note;\n\n\t\t\t// Update channel panning\n\t\t\tif(pChn->rowCommand.IsNote() || pChn->rowCommand.instr)\n\t\t\t{\n\t\t\t\tSAMPLEINDEX smp = 0;\n\t\t\t\tif(GetNumInstruments())\n\t\t\t\t{\n\t\t\t\t\tModInstrument *pIns;\n\t\t\t\t\tif(pChn->nNewIns <= GetNumInstruments() && (pIns = Instruments[pChn->nNewIns]) != nullptr)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(pIns->dwFlags[INS_SETPANNING])\n\t\t\t\t\t\t\tpChn->nPan = pIns->nPan;\n\t\t\t\t\t\tif(ModCommand::IsNote(note))\n\t\t\t\t\t\t\tsmp = pIns->Keyboard[note - NOTE_MIN];\n\t\t\t\t\t}\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tsmp = pChn->nNewIns;\n\t\t\t\t}\n\t\t\t\tif(smp > 0 && smp <= GetNumSamples() && Samples[smp].uFlags[CHN_PANNING])\n\t\t\t\t{\n\t\t\t\t\tpChn->nPan = Samples[smp].nPan;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch(pChn->rowCommand.volcmd)\n\t\t\t{\n\t\t\tcase VOLCMD_VOLUME:\n\t\t\t\tmemory.chnSettings[nChn].vol = pChn->rowCommand.vol;\n\t\t\t\tbreak;\n\t\t\tcase VOLCMD_VOLSLIDEUP:\n\t\t\tcase VOLCMD_VOLSLIDEDOWN:\n\t\t\t\tif(pChn->rowCommand.vol != 0)\n\t\t\t\t\tpChn->nOldVolParam = pChn->rowCommand.vol;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch(command)\n\t\t\t{\n\t\t\t// Position Jump\n\t\t\tcase CMD_POSITIONJUMP:\n\t\t\t\tpositionJumpOnThisRow = true;\n\t\t\t\tplayState.m_nNextOrder = static_cast(CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn));\n\t\t\t\tplayState.m_nNextPatStartRow = 0; // FT2 E60 bug\n\t\t\t\t// see https://forum.openmpt.org/index.php?topic=2769.0 - FastTracker resets Dxx if Bxx is called _after_ Dxx\n\t\t\t\t// Test case: PatternJump.mod\n\t\t\t\tif(!patternBreakOnThisRow || (GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)))\n\t\t\t\t\tplayState.m_nNextRow = 0;\n\n\t\t\t\tif (adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tpChn->nPatternLoopCount = 0;\n\t\t\t\t\tpChn->nPatternLoop = 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Pattern Break\n\t\t\tcase CMD_PATTERNBREAK:\n\t\t\t\t{\n\t\t\t\t\tROWINDEX row = PatternBreak(playState, nChn, param);\n\t\t\t\t\tif(row != ROWINDEX_INVALID)\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternBreakOnThisRow = true;\n\t\t\t\t\t\tplayState.m_nNextRow = row;\n\n\t\t\t\t\t\tif(!positionJumpOnThisRow)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpChn->nPatternLoopCount = 0;\n\t\t\t\t\t\t\tpChn->nPatternLoop = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Set Tempo\n\t\t\tcase CMD_TEMPO:\n\t\t\t\tif(!m_playBehaviour[kMODVBlankTiming])\n\t\t\t\t{\n\t\t\t\t\tTEMPO tempo(CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn), 0);\n\t\t\t\t\tif ((adjustMode & eAdjust) && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (tempo.GetInt()) pChn->nOldTempo = static_cast(tempo.GetInt()); else tempo.Set(pChn->nOldTempo);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (tempo.GetInt() >= 0x20) playState.m_nMusicTempo = tempo;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// Tempo Slide\n\t\t\t\t\t\tTEMPO tempoDiff((tempo.GetInt() & 0x0F) * nonRowTicks, 0);\n\t\t\t\t\t\tif ((tempo.GetInt() & 0xF0) == 0x10)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tplayState.m_nMusicTempo += tempoDiff;\n\t\t\t\t\t\t} else\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(tempoDiff < playState.m_nMusicTempo)\n\t\t\t\t\t\t\t\tplayState.m_nMusicTempo -= tempoDiff;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tplayState.m_nMusicTempo.Set(0);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tTEMPO tempoMin = GetModSpecifications().GetTempoMin(), tempoMax = GetModSpecifications().GetTempoMax();\n\t\t\t\t\tif(m_playBehaviour[kTempoClamp])\t// clamp tempo correctly in compatible mode\n\t\t\t\t\t{\n\t\t\t\t\t\ttempoMax.Set(255);\n\t\t\t\t\t}\n\t\t\t\t\tLimit(playState.m_nMusicTempo, tempoMin, tempoMax);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tswitch(param & 0xF0)\n\t\t\t\t{\n\t\t\t\tcase 0x90:\n\t\t\t\t\tif(param <= 0x91)\n\t\t\t\t\t{\n\t\t\t\t\t\tpChn->dwFlags.set(CHN_SURROUND, param == 0x91);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xA0:\n\t\t\t\t\t// High sample offset\n\t\t\t\t\tpChn->nOldHiOffset = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase 0xB0:\n\t\t\t\t\t// Pattern Loop\n\t\t\t\t\tif (param & 0x0F)\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternLoopEndedOnThisRow = true;\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tCHANNELINDEX firstChn = nChn, lastChn = nChn;\n\t\t\t\t\t\tif(GetType() == MOD_TYPE_S3M)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// ST3 has only one global loop memory.\n\t\t\t\t\t\t\tfirstChn = 0;\n\t\t\t\t\t\t\tlastChn = GetNumChannels() - 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(CHANNELINDEX c = firstChn; c <= lastChn; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoop = memory.elapsedTime;\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoopStart = playState.m_nRow;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpatternLoopStartedOnThisRow = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xF0:\n\t\t\t\t\t// Active macro\n\t\t\t\t\tpChn->nActiveMacro = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tswitch(param & 0xF0)\n\t\t\t\t{\n\t\t\t\tcase 0x60:\n\t\t\t\t\t// Pattern Loop\n\t\t\t\t\tif (param & 0x0F)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.m_nNextPatStartRow = memory.chnSettings[nChn].patLoopStart; // FT2 E60 bug\n\t\t\t\t\t\tpatternLoopEndedOnThisRow = true;\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternLoopStartedOnThisRow = true;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopStart = playState.m_nRow;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xF0:\n\t\t\t\t\t// Active macro\n\t\t\t\t\tpChn->nActiveMacro = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_XFINEPORTAUPDOWN:\n\t\t\t\t// ignore high offset in compatible mode\n\t\t\t\tif(((param & 0xF0) == 0xA0) && !m_playBehaviour[kFT2RestrictXCommand]) pChn->nOldHiOffset = param & 0x0F;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// The following calculations are not interesting if we just want to get the song length.\n\t\t\tif (!(adjustMode & eAdjust)) continue;\n\t\t\tswitch(command)\n\t\t\t{\n\t\t\t// Portamento Up/Down\n\t\t\tcase CMD_PORTAMENTOUP:\n\t\t\t\tif(param)\n\t\t\t\t{\n\t\t\t\t\t// FT2 compatibility: Separate effect memory for all portamento commands\n\t\t\t\t\t// Test case: Porta-LinkMem.xm\n\t\t\t\t\tif(!m_playBehaviour[kFT2PortaUpDownMemory])\n\t\t\t\t\t\tpChn->nOldPortaDown = param;\n\t\t\t\t\tpChn->nOldPortaUp = param;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CMD_PORTAMENTODOWN:\n\t\t\t\tif(param)\n\t\t\t\t{\n\t\t\t\t\t// FT2 compatibility: Separate effect memory for all portamento commands\n\t\t\t\t\t// Test case: Porta-LinkMem.xm\n\t\t\t\t\tif(!m_playBehaviour[kFT2PortaUpDownMemory])\n\t\t\t\t\t\tpChn->nOldPortaUp = param;\n\t\t\t\t\tpChn->nOldPortaDown = param;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Tone-Portamento\n\t\t\tcase CMD_TONEPORTAMENTO:\n\t\t\t\tif (param) pChn->nPortamentoSlide = param << 2;\n\t\t\t\tbreak;\n\t\t\t// Offset\n\t\t\tcase CMD_OFFSET:\n\t\t\t\tif (param) pChn->oldOffset = param << 8;\n\t\t\t\tbreak;\n\t\t\t// Volume Slide\n\t\t\tcase CMD_VOLUMESLIDE:\n\t\t\tcase CMD_TONEPORTAVOL:\n\t\t\t\tif (param) pChn->nOldVolumeSlide = param;\n\t\t\t\tbreak;\n\t\t\t// Set Volume\n\t\t\tcase CMD_VOLUME:\n\t\t\t\tmemory.chnSettings[nChn].vol = param;\n\t\t\t\tbreak;\n\t\t\t// Global Volume\n\t\t\tcase CMD_GLOBALVOLUME:\n\t\t\t\tif(!(GetType() & GLOBALVOL_7BIT_FORMATS) && param < 128) param *= 2;\n\t\t\t\t// IT compatibility 16. ST3 and IT ignore out-of-range values\n\t\t\t\tif(param <= 128)\n\t\t\t\t{\n\t\t\t\t\tplayState.m_nGlobalVolume = param * 2;\n\t\t\t\t} else if(!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)))\n\t\t\t\t{\n\t\t\t\t\tplayState.m_nGlobalVolume = 256;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Global Volume Slide\n\t\t\tcase CMD_GLOBALVOLSLIDE:\n\t\t\t\tif(m_playBehaviour[kPerChannelGlobalVolSlide])\n\t\t\t\t{\n\t\t\t\t\t// IT compatibility 16. Global volume slide params are stored per channel (FT2/IT)\n\t\t\t\t\tif (param) pChn->nOldGlobalVolSlide = param; else param = pChn->nOldGlobalVolSlide;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tif (param) playState.Chn[0].nOldGlobalVolSlide = param; else param = playState.Chn[0].nOldGlobalVolSlide;\n\t\t\t\t}\n\t\t\t\tif (((param & 0x0F) == 0x0F) && (param & 0xF0))\n\t\t\t\t{\n\t\t\t\t\tparam >>= 4;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume += param << 1;\n\t\t\t\t} else if (((param & 0xF0) == 0xF0) && (param & 0x0F))\n\t\t\t\t{\n\t\t\t\t\tparam = (param & 0x0F) << 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume -= param;\n\t\t\t\t} else if (param & 0xF0)\n\t\t\t\t{\n\t\t\t\t\tparam >>= 4;\n\t\t\t\t\tparam <<= 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume += param * nonRowTicks;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tparam = (param & 0x0F) << 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume -= param * nonRowTicks;\n\t\t\t\t}\n\t\t\t\tLimit(playState.m_nGlobalVolume, 0, 256);\n\t\t\t\tbreak;\n\t\t\tcase CMD_CHANNELVOLUME:\n\t\t\t\tif (param <= 64) pChn->nGlobalVol = param;\n\t\t\t\tbreak;\n\t\t\tcase CMD_CHANNELVOLSLIDE:\n\t\t\t\t{\n\t\t\t\t\tif (param) pChn->nOldChnVolSlide = param; else param = pChn->nOldChnVolSlide;\n\t\t\t\t\tint32 volume = pChn->nGlobalVol;\n\t\t\t\t\tif((param & 0x0F) == 0x0F && (param & 0xF0))\n\t\t\t\t\t\tvolume += (param >> 4);\t\t// Fine Up\n\t\t\t\t\telse if((param & 0xF0) == 0xF0 && (param & 0x0F))\n\t\t\t\t\t\tvolume -= (param & 0x0F);\t// Fine Down\n\t\t\t\t\telse if(param & 0x0F)\t\t\t// Down\n\t\t\t\t\t\tvolume -= (param & 0x0F) * nonRowTicks;\n\t\t\t\t\telse\t\t\t\t\t\t\t// Up\n\t\t\t\t\t\tvolume += ((param & 0xF0) >> 4) * nonRowTicks;\n\t\t\t\t\tLimit(volume, 0, 64);\n\t\t\t\t\tpChn->nGlobalVol = volume;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CMD_PANNING8:\n\t\t\t\tPanning(pChn, param, Pan8bit);\n\t\t\t\tbreak;\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tif(param < 0x10)\n\t\t\t\t{\n\t\t\t\t\t// LED filter\n\t\t\t\t\tfor(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.Chn[chn].dwFlags.set(CHN_AMIGAFILTER, !(param & 1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tMPT_FALLTHROUGH;\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tif((param & 0xF0) == 0x80)\n\t\t\t\t{\n\t\t\t\t\tPanning(pChn, (param & 0x0F), Pan4bit);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\tif (param) pChn->nOldVolumeSlide = param;\n\t\t\t\tparam = 0;\n\t\t\t\tMPT_FALLTHROUGH;\n\t\t\tcase CMD_VIBRATO:\n\t\t\t\tVibrato(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_FINEVIBRATO:\n\t\t\t\tFineVibrato(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_TREMOLO:\n\t\t\t\tTremolo(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_PANBRELLO:\n\t\t\t\tPanbrello(pChn, param);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch(pChn->rowCommand.volcmd)\n\t\t\t{\n\t\t\tcase VOLCMD_PANNING:\n\t\t\t\tPanning(pChn, pChn->rowCommand.vol, Pan6bit);\n\t\t\t\tbreak;\n\n\t\t\tcase VOLCMD_VIBRATOSPEED:\n\t\t\t\t// FT2 does not automatically enable vibrato with the \"set vibrato speed\" command\n\t\t\t\tif(m_playBehaviour[kFT2VolColVibrato])\n\t\t\t\t\tpChn->nVibratoSpeed = pChn->rowCommand.vol & 0x0F;\n\t\t\t\telse\n\t\t\t\t\tVibrato(pChn, pChn->rowCommand.vol << 4);\n\t\t\t\tbreak;\n\t\t\tcase VOLCMD_VIBRATODEPTH:\n\t\t\t\tVibrato(pChn, pChn->rowCommand.vol);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Process vibrato / tremolo / panbrello\n\t\t\tswitch(pChn->rowCommand.command)\n\t\t\t{\n\t\t\tcase CMD_VIBRATO:\n\t\t\tcase CMD_FINEVIBRATO:\n\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tuint32 vibTicks = ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && !m_SongFlags[SONG_ITOLDEFFECTS]) ? numTicks : nonRowTicks;\n\t\t\t\t\tuint32 inc = pChn->nVibratoSpeed * vibTicks;\n\t\t\t\t\tif(m_playBehaviour[kITVibratoTremoloPanbrello])\n\t\t\t\t\t\tinc *= 4;\n\t\t\t\t\tpChn->nVibratoPos += static_cast(inc);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_TREMOLO:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tuint32 tremTicks = ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && !m_SongFlags[SONG_ITOLDEFFECTS]) ? numTicks : nonRowTicks;\n\t\t\t\t\tuint32 inc = pChn->nTremoloSpeed * tremTicks;\n\t\t\t\t\tif(m_playBehaviour[kITVibratoTremoloPanbrello])\n\t\t\t\t\t\tinc *= 4;\n\t\t\t\t\tpChn->nTremoloPos += static_cast(inc);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_PANBRELLO:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\t// Panbrello effect is permanent in compatible mode, so actually apply panbrello for the last tick of this row\n\t\t\t\t\tpChn->nPanbrelloPos += static_cast(pChn->nPanbrelloSpeed * (numTicks - 1));\n\t\t\t\t\tProcessPanbrello(pChn);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Interpret F00 effect in XM files as \"stop song\"\n\t\tif(GetType() == MOD_TYPE_XM && playState.m_nMusicSpeed == uint16_max)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\n\t\tplayState.m_nCurrentRowsPerBeat = m_nDefaultRowsPerBeat;\n\t\tif(Patterns[playState.m_nPattern].GetOverrideSignature())\n\t\t{\n\t\t\tplayState.m_nCurrentRowsPerBeat = Patterns[playState.m_nPattern].GetRowsPerBeat();\n\t\t}\n\n\t\tconst uint32 tickDuration = GetTickDuration(playState);\n\t\tconst uint32 rowDuration = tickDuration * numTicks;\n\t\tmemory.elapsedTime += static_cast(rowDuration) / static_cast(m_MixerSettings.gdwMixingFreq);\n\t\tplayState.m_lTotalSampleCount += rowDuration;\n\n\t\tif(adjustSamplePos)\n\t\t{\n\t\t\t// Super experimental and dirty sample seeking\n\t\t\tpChn = playState.Chn;\n\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++)\n\t\t\t{\n\t\t\t\tif(memory.chnSettings[nChn].ticksToRender == GetLengthMemory::IGNORE_CHANNEL)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tuint32 startTick = 0;\n\t\t\t\tconst ModCommand &m = pChn->rowCommand;\n\t\t\t\tuint32 paramHi = m.param >> 4, paramLo = m.param & 0x0F;\n\t\t\t\tbool porta = m.command == CMD_TONEPORTAMENTO || m.command == CMD_TONEPORTAVOL || m.volcmd == VOLCMD_TONEPORTAMENTO;\n\t\t\t\tbool stopNote = patternLoopStartedOnThisRow;\t// It's too much trouble to keep those pattern loops in sync...\n\n\t\t\t\tif(m.instr) pChn->proTrackerOffset = 0;\n\t\t\t\tif(m.IsNote())\n\t\t\t\t{\n\t\t\t\t\tif(porta && memory.chnSettings[nChn].incChanged)\n\t\t\t\t\t{\n\t\t\t\t\t\t// If there's a portamento, the current channel increment mustn't be 0 in NoteChange()\n\t\t\t\t\t\tpChn->increment = GetChannelIncrement(pChn, pChn->nPeriod, 0);\n\t\t\t\t\t}\n\t\t\t\t\tint32 setPan = pChn->nPan;\n\t\t\t\t\tpChn->nNewNote = pChn->nLastNote;\n\t\t\t\t\tif(pChn->nNewIns != 0) InstrumentChange(pChn, pChn->nNewIns, porta);\n\t\t\t\t\tNoteChange(pChn, m.note, porta);\n\t\t\t\t\tmemory.chnSettings[nChn].incChanged = true;\n\n\t\t\t\t\tif((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xD0 && paramLo < numTicks)\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick = paramLo;\n\t\t\t\t\t} else if(m.command == CMD_DELAYCUT && paramHi < numTicks)\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick = paramHi;\n\t\t\t\t\t}\n\t\t\t\t\tif(rowDelay > 1 && startTick != 0 && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)))\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick += (playState.m_nMusicSpeed + tickDelay) * (rowDelay - 1);\n\t\t\t\t\t}\n\t\t\t\t\tif(!porta) memory.chnSettings[nChn].ticksToRender = 0;\n\n\t\t\t\t\t// Panning commands have to be re-applied after a note change with potential pan change.\n\t\t\t\t\tif(m.command == CMD_PANNING8\n\t\t\t\t\t\t|| ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && paramHi == 0x8)\n\t\t\t\t\t\t|| m.volcmd == VOLCMD_PANNING)\n\t\t\t\t\t{\n\t\t\t\t\t\tpChn->nPan = setPan;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(m.command == CMD_OFFSET)\n\t\t\t\t\t{\n\t\t\t\t\t\tbool isExtended = false;\n\t\t\t\t\t\tSmpLength offset = CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn, &isExtended);\n\t\t\t\t\t\tif(!isExtended)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toffset <<= 8;\n\t\t\t\t\t\t\tif(offset == 0) offset = pChn->oldOffset;\n\t\t\t\t\t\t\toffset += static_cast(pChn->nOldHiOffset) << 16;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tSampleOffset(*pChn, offset);\n\t\t\t\t\t} else if(m.command == CMD_OFFSETPERCENTAGE)\n\t\t\t\t\t{\n\t\t\t\t\t\tSampleOffset(*pChn, Util::muldiv_unsigned(pChn->nLength, m.param, 255));\n\t\t\t\t\t} else if(m.command == CMD_REVERSEOFFSET && pChn->pModSample != nullptr)\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\tReverseSampleOffset(*pChn, m.param);\n\t\t\t\t\t\tstartTick = playState.m_nMusicSpeed - 1;\n\t\t\t\t\t} else if(m.volcmd == VOLCMD_OFFSET)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(m.vol <= CountOf(pChn->pModSample->cues) && pChn->pModSample != nullptr)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSmpLength offset;\n\t\t\t\t\t\t\tif(m.vol == 0)\n\t\t\t\t\t\t\t\toffset = pChn->oldOffset;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toffset = pChn->oldOffset = pChn->pModSample->cues[m.vol - 1];\n\t\t\t\t\t\t\tSampleOffset(*pChn, offset);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(m.note == NOTE_KEYOFF || m.note == NOTE_NOTECUT || (m.note == NOTE_FADE && GetNumInstruments())\n\t\t\t\t\t|| ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xC0 && paramLo < numTicks)\n\t\t\t\t\t|| (m.command == CMD_DELAYCUT && paramLo != 0 && startTick + paramLo < numTicks))\n\t\t\t\t{\n\t\t\t\t\tstopNote = true;\n\t\t\t\t}\n\n\t\t\t\tif(m.command == CMD_VOLUME)\n\t\t\t\t{\n\t\t\t\t\tpChn->nVolume = m.param * 4;\n\t\t\t\t} else if(m.volcmd == VOLCMD_VOLUME)\n\t\t\t\t{\n\t\t\t\t\tpChn->nVolume = m.vol * 4;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(pChn->pModSample && !stopNote)\n\t\t\t\t{\n\t\t\t\t\t// Check if we don't want to emulate some effect and thus stop processing.\n\t\t\t\t\tif(m.command < MAX_EFFECTS)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(forbiddenCommands[m.command])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t\t} else if(m.command == CMD_MODCMDEX)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Special case: Slides using extended commands\n\t\t\t\t\t\t\tswitch(m.param & 0xF0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0x10:\n\t\t\t\t\t\t\tcase 0x20:\n\t\t\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(m.volcmd < forbiddenVolCommands.size() && forbiddenVolCommands[m.volcmd])\n\t\t\t\t\t{\n\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(stopNote)\n\t\t\t\t{\n\t\t\t\t\tpChn->Stop();\n\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender = 0;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tif(oldTickDuration != tickDuration && oldTickDuration != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch(m.command)\n\t\t\t\t\t{\n\t\t\t\t\tcase CMD_TONEPORTAVOL:\n\t\t\t\t\tcase CMD_VOLUMESLIDE:\n\t\t\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\t\t\tif(m.param || (GetType() != MOD_TYPE_MOD))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(uint32 i = 0; i < numTicks; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->isFirstTick = (i == 0);\n\t\t\t\t\t\t\t\tVolumeSlide(pChn, m.param);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CMD_MODCMDEX:\n\t\t\t\t\t\tif((m.param & 0x0F) || (GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpChn->isFirstTick = true;\n\t\t\t\t\t\t\tswitch(m.param & 0xF0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0xA0: FineVolumeUp(pChn, m.param & 0x0F, false); break;\n\t\t\t\t\t\t\tcase 0xB0: FineVolumeDown(pChn, m.param & 0x0F, false); break;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\t\t\tif(m.param == 0x9E)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Play forward\n\t\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\t\tpChn->dwFlags.reset(CHN_PINGPONGFLAG);\n\t\t\t\t\t\t} else if(m.param == 0x9F)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Reverse\n\t\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\t\tpChn->dwFlags.set(CHN_PINGPONGFLAG);\n\t\t\t\t\t\t\tif(!pChn->position.GetInt() && pChn->nLength && (m.IsNote() || !pChn->dwFlags[CHN_LOOP]))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->position.Set(pChn->nLength - 1, SamplePosition::fractMax);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if((m.param & 0xF0) == 0x70)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// TODO\n\t\t\t\t\t\t\t//ExtendedS3MCommands(nChn, param);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tpChn->isFirstTick = true;\n\t\t\t\t\tswitch(m.volcmd)\n\t\t\t\t\t{\n\t\t\t\t\tcase VOLCMD_FINEVOLUP:\t\tFineVolumeUp(pChn, m.vol, m_playBehaviour[kITVolColMemory]); break;\n\t\t\t\t\tcase VOLCMD_FINEVOLDOWN:\tFineVolumeDown(pChn, m.vol, m_playBehaviour[kITVolColMemory]); break;\n\t\t\t\t\tcase VOLCMD_VOLSLIDEUP:\n\t\t\t\t\tcase VOLCMD_VOLSLIDEDOWN:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// IT Compatibility: Volume column volume slides have their own memory\n\t\t\t\t\t\t\t// Test case: VolColMemory.it\n\t\t\t\t\t\t\tModCommand::VOL vol = m.vol;\n\t\t\t\t\t\t\tif(vol == 0 && m_playBehaviour[kITVolColMemory])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvol = pChn->nOldVolParam;\n\t\t\t\t\t\t\t\tif(vol == 0)\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(m.volcmd == VOLCMD_VOLSLIDEUP)\n\t\t\t\t\t\t\t\tvol <<= 4;\n\t\t\t\t\t\t\tfor(uint32 i = 0; i < numTicks; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->isFirstTick = (i == 0);\n\t\t\t\t\t\t\t\tVolumeSlide(pChn, vol);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(porta)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Portamento needs immediate syncing, as the pitch changes on each tick\n\t\t\t\t\t\tuint32 portaTick = memory.chnSettings[nChn].ticksToRender + startTick + 1;\n\t\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender += numTicks;\n\t\t\t\t\t\tmemory.RenderChannel(nChn, tickDuration, portaTick);\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender += (numTicks - startTick);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toldTickDuration = tickDuration;\n\n\t\t// Pattern loop is not executed in FT2 if there are any position jump or pattern break commands on the same row.\n\t\t// Pattern loop is not executed in IT if there are any position jump commands on the same row.\n\t\t// Test case for FT2 exception: PatLoop-Jumps.xm, PatLoop-Various.xm\n\t\t// Test case for IT: exception: LoopBreak.it\n\t\tif(patternLoopEndedOnThisRow\n\t\t\t&& (!m_playBehaviour[kFT2PatternLoopWithJumps] || !(positionJumpOnThisRow || patternBreakOnThisRow))\n\t\t\t&& (!m_playBehaviour[kITPatternLoopWithJumps] || !positionJumpOnThisRow))\n\t\t{\n\t\t\tstd::map startTimes;\n\t\t\t// This is really just a simple estimation for nested pattern loops. It should handle cases correctly where all parallel loops start and end on the same row.\n\t\t\t// If one of them starts or ends \"in between\", it will most likely calculate a wrong duration.\n\t\t\t// For S3M files, it's also way off.\n\t\t\tpChn = playState.Chn;\n\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++)\n\t\t\t{\n\t\t\t\tModCommand::COMMAND command = pChn->rowCommand.command;\n\t\t\t\tModCommand::PARAM param = pChn->rowCommand.param;\n\t\t\t\tif((command == CMD_S3MCMDEX && param >= 0xB1 && param <= 0xBF)\n\t\t\t\t\t|| (command == CMD_MODCMDEX && param >= 0x61 && param <= 0x6F))\n\t\t\t\t{\n\t\t\t\t\tconst double start = memory.chnSettings[nChn].patLoop;\n\t\t\t\t\tif(!startTimes[start]) startTimes[start] = 1;\n\t\t\t\t\tstartTimes[start] = mpt::lcm(startTimes[start], 1 + (param & 0x0F));\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(const auto &i : startTimes)\n\t\t\t{\n\t\t\t\tmemory.elapsedTime += (memory.elapsedTime - i.first) * (double)(i.second - 1);\n\t\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++)\n\t\t\t\t{\n\t\t\t\t\tif(memory.chnSettings[nChn].patLoop == i.first)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.m_lTotalSampleCount += (playState.m_lTotalSampleCount - memory.chnSettings[nChn].patLoopSmp) * (i.second - 1);\n\t\t\t\t\t\tif(m_playBehaviour[kITPatternLoopTargetReset] || (GetType() == MOD_TYPE_S3M))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopStart = playState.m_nRow + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(GetType() == MOD_TYPE_IT)\n\t\t\t{\n\t\t\t\t// IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0)\n\t\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++)\n\t\t\t\t{\n\t\t\t\t\tif((pChn->rowCommand.command == CMD_S3MCMDEX && pChn->rowCommand.param >= 0xB1 && pChn->rowCommand.param <= 0xBF))\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Now advance the sample positions for sample seeking on channels that are still playing\n\tif(adjustSamplePos)\n\t{\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++)\n\t\t{\n\t\t\tif(memory.chnSettings[nChn].ticksToRender != GetLengthMemory::IGNORE_CHANNEL)\n\t\t\t{\n\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\n\t\t\t}\n\t\t}\n\t}\n\n\tif(retval.targetReached || target.mode == GetLengthTarget::NoTarget)\n\t{\n\t\tretval.lastOrder = playState.m_nCurrentOrder;\n\t\tretval.lastRow = playState.m_nRow;\n\t}\n\tretval.duration = memory.elapsedTime;\n\tresults.push_back(retval);\n\n\t// Store final variables\n\tif(adjustMode & eAdjust)\n\t{\n\t\tif(retval.targetReached || target.mode == GetLengthTarget::NoTarget)\n\t\t{\n\t\t\t// Target found, or there is no target (i.e. play whole song)...\n\t\t\tm_PlayState = std::move(playState);\n\t\t\tm_PlayState.m_nNextRow = m_PlayState.m_nRow;\n\t\t\tm_PlayState.m_nFrameDelay = m_PlayState.m_nPatternDelay = 0;\n\t\t\tm_PlayState.m_nTickCount = Util::MaxValueOfType(m_PlayState.m_nTickCount) - 1;\n\t\t\tm_PlayState.m_bPositionChanged = true;\n\t\t\tfor(CHANNELINDEX n = 0; n < GetNumChannels(); n++)\n\t\t\t{\n\t\t\t\tif(m_PlayState.Chn[n].nLastNote != NOTE_NONE)\n\t\t\t\t{\n\t\t\t\t\tm_PlayState.Chn[n].nNewNote = m_PlayState.Chn[n].nLastNote;\n\t\t\t\t}\n\t\t\t\tif(memory.chnSettings[n].vol != 0xFF && !adjustSamplePos)\n\t\t\t\t{\n\t\t\t\t\tm_PlayState.Chn[n].nVolume = std::min(memory.chnSettings[n].vol, uint8(64)) * 4;\n\t\t\t\t}\n\t\t\t}\n\n#ifndef NO_PLUGINS\n\t\t\t// If there were any PC events, update plugin parameters to their latest value.\n\t\t\tstd::bitset plugSetProgram;\n\t\t\tfor(const auto ¶m : memory.plugParams)\n\t\t\t{\n\t\t\t\tPLUGINDEX plug = param.first.first - 1;\n\t\t\t\tIMixPlugin *plugin = m_MixPlugins[plug].pMixPlugin;\n\t\t\t\tif(plugin != nullptr)\n\t\t\t\t{\n\t\t\t\t\tif(!plugSetProgram[plug])\n\t\t\t\t\t{\n\t\t\t\t\t\t// Used for bridged plugins to avoid sending out individual messages for each parameter.\n\t\t\t\t\t\tplugSetProgram.set(plug);\n\t\t\t\t\t\tplugin->BeginSetProgram();\n\t\t\t\t\t}\n\t\t\t\t\tplugin->SetParameter(param.first.second, param.second / PlugParamValue(ModCommand::maxColumnValue));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(plugSetProgram.any())\n\t\t\t{\n\t\t\t\tfor(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; i++)\n\t\t\t\t{\n\t\t\t\t\tif(plugSetProgram[i])\n\t\t\t\t\t{\n\t\t\t\t\t\tm_MixPlugins[i].pMixPlugin->EndSetProgram();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n#endif // NO_PLUGINS\n\t\t} else if(adjustMode != eAdjustOnSuccess)\n\t\t{\n\t\t\t// Target not found (e.g. when jumping to a hidden sub song), reset global variables...\n\t\t\tm_PlayState.m_nMusicSpeed = m_nDefaultSpeed;\n\t\t\tm_PlayState.m_nMusicTempo = m_nDefaultTempo;\n\t\t\tm_PlayState.m_nGlobalVolume = m_nDefaultGlobalVolume;\n\t\t}\n\t\t// When adjusting the playback status, we will also want to update the visited rows vector according to the current position.\n\t\tif(sequence != Order.GetCurrentSequenceIndex())\n\t\t{\n\t\t\tOrder.SetSequence(sequence);\n\t\t}\n\t\tvisitedSongRows.Set(visitedRows);\n\t}\n\n\treturn results;\n\n}","target":"std::vector CSoundFile::GetLength(enmGetLengthResetMode adjustMode, GetLengthTarget target)\n{\n\tstd::vector results;\n\tGetLengthType retval;\n\tretval.startOrder = target.startOrder;\n\tretval.startRow = target.startRow;\n\n\t// Are we trying to reach a certain pattern position?\n\tconst bool hasSearchTarget = target.mode != GetLengthTarget::NoTarget;\n\tconst bool adjustSamplePos = (adjustMode & eAdjustSamplePositions) == eAdjustSamplePositions;\n\n\tSEQUENCEINDEX sequence = target.sequence;\n\tif(sequence >= Order.GetNumSequences()) sequence = Order.GetCurrentSequenceIndex();\n\tconst ModSequence &orderList = Order(sequence);\n\n\tGetLengthMemory memory(*this);\n\tCSoundFile::PlayState &playState = *memory.state;\n\t// Temporary visited rows vector (so that GetLength() won't interfere with the player code if the module is playing at the same time)\n\tRowVisitor visitedRows(*this, sequence);\n\n\tplayState.m_nNextRow = playState.m_nRow = target.startRow;\n\tplayState.m_nNextOrder = playState.m_nCurrentOrder = target.startOrder;\n\n\t// Fast LUTs for commands that are too weird / complicated / whatever to emulate in sample position adjust mode.\n\tstd::bitset forbiddenCommands;\n\tstd::bitset forbiddenVolCommands;\n\n\tif(adjustSamplePos)\n\t{\n\t\tforbiddenCommands.set(CMD_ARPEGGIO); forbiddenCommands.set(CMD_PORTAMENTOUP);\n\t\tforbiddenCommands.set(CMD_PORTAMENTODOWN); forbiddenCommands.set(CMD_XFINEPORTAUPDOWN);\n\t\tforbiddenCommands.set(CMD_NOTESLIDEUP); forbiddenCommands.set(CMD_NOTESLIDEUPRETRIG);\n\t\tforbiddenCommands.set(CMD_NOTESLIDEDOWN); forbiddenCommands.set(CMD_NOTESLIDEDOWNRETRIG);\n\t\tforbiddenVolCommands.set(VOLCMD_PORTAUP); forbiddenVolCommands.set(VOLCMD_PORTADOWN);\n\n\t\t// Optimize away channels for which it's pointless to adjust sample positions\n\t\tfor(CHANNELINDEX i = 0; i < GetNumChannels(); i++)\n\t\t{\n\t\t\tif(ChnSettings[i].dwFlags[CHN_MUTE]) memory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL;\n\t\t}\n\t\tif(target.mode == GetLengthTarget::SeekPosition && target.pos.order < orderList.size())\n\t\t{\n\t\t\t// If we know where to seek, we can directly rule out any channels on which a new note would be triggered right at the start.\n\t\t\tconst PATTERNINDEX seekPat = orderList[target.pos.order];\n\t\t\tif(Patterns.IsValidPat(seekPat) && Patterns[seekPat].IsValidRow(target.pos.row))\n\t\t\t{\n\t\t\t\tconst ModCommand *m = Patterns[seekPat].GetRow(target.pos.row);\n\t\t\t\tfor(CHANNELINDEX i = 0; i < GetNumChannels(); i++, m++)\n\t\t\t\t{\n\t\t\t\t\tif(m->note == NOTE_NOTECUT || m->note == NOTE_KEYOFF || (m->note == NOTE_FADE && GetNumInstruments())\n\t\t\t\t\t\t|| (m->IsNote() && !m->IsPortamento()))\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// If samples are being synced, force them to resync if tick duration changes\n\tuint32 oldTickDuration = 0;\n\n\tfor (;;)\n\t{\n\t\t// Time target reached.\n\t\tif(target.mode == GetLengthTarget::SeekSeconds && memory.elapsedTime >= target.time)\n\t\t{\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\tuint32 rowDelay = 0, tickDelay = 0;\n\t\tplayState.m_nRow = playState.m_nNextRow;\n\t\tplayState.m_nCurrentOrder = playState.m_nNextOrder;\n\n\t\tif(orderList.IsValidPat(playState.m_nCurrentOrder) && playState.m_nRow >= Patterns[orderList[playState.m_nCurrentOrder]].GetNumRows())\n\t\t{\n\t\t\tplayState.m_nRow = 0;\n\t\t\tif(m_playBehaviour[kFT2LoopE60Restart])\n\t\t\t{\n\t\t\t\tplayState.m_nRow = playState.m_nNextPatStartRow;\n\t\t\t\tplayState.m_nNextPatStartRow = 0;\n\t\t\t}\n\t\t\tplayState.m_nCurrentOrder = ++playState.m_nNextOrder;\n\t\t}\n\n\t\t// Check if pattern is valid\n\t\tplayState.m_nPattern = playState.m_nCurrentOrder < orderList.size() ? orderList[playState.m_nCurrentOrder] : orderList.GetInvalidPatIndex();\n\t\tbool positionJumpOnThisRow = false;\n\t\tbool patternBreakOnThisRow = false;\n\t\tbool patternLoopEndedOnThisRow = false, patternLoopStartedOnThisRow = false;\n\n\t\tif(!Patterns.IsValidPat(playState.m_nPattern) && playState.m_nPattern != orderList.GetInvalidPatIndex() && target.mode == GetLengthTarget::SeekPosition && playState.m_nCurrentOrder == target.pos.order)\n\t\t{\n\t\t\t// Early test: Target is inside +++ or non-existing pattern\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\twhile(playState.m_nPattern >= Patterns.Size())\n\t\t{\n\t\t\t// End of song?\n\t\t\tif((playState.m_nPattern == orderList.GetInvalidPatIndex()) || (playState.m_nCurrentOrder >= orderList.size()))\n\t\t\t{\n\t\t\t\tif(playState.m_nCurrentOrder == orderList.GetRestartPos())\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tplayState.m_nCurrentOrder = orderList.GetRestartPos();\n\t\t\t} else\n\t\t\t{\n\t\t\t\tplayState.m_nCurrentOrder++;\n\t\t\t}\n\t\t\tplayState.m_nPattern = (playState.m_nCurrentOrder < orderList.size()) ? orderList[playState.m_nCurrentOrder] : orderList.GetInvalidPatIndex();\n\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder;\n\t\t\tif((!Patterns.IsValidPat(playState.m_nPattern)) && visitedRows.IsVisited(playState.m_nCurrentOrder, 0, true))\n\t\t\t{\n\t\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t\t{\n\t\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\t\tbreak;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\t\tresults.push_back(retval);\n\t\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\t\tmemory.Reset();\n\n\t\t\t\t\tplayState.m_nCurrentOrder = playState.m_nNextOrder;\n\t\t\t\t\tplayState.m_nPattern = orderList[playState.m_nCurrentOrder];\n\t\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(playState.m_nNextOrder == ORDERINDEX_INVALID)\n\t\t{\n\t\t\t// GetFirstUnvisitedRow failed, so there is nothing more to play\n\t\t\tbreak;\n\t\t}\n\n\t\t// Skip non-existing patterns\n\t\tif(!Patterns.IsValidPat(playState.m_nPattern))\n\t\t{\n\t\t\t// If there isn't even a tune, we should probably stop here.\n\t\t\tif(playState.m_nCurrentOrder == orderList.GetRestartPos())\n\t\t\t{\n\t\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t\t{\n\t\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\t\tbreak;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\t\tresults.push_back(retval);\n\t\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\t\tmemory.Reset();\n\t\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder + 1;\n\t\t\tcontinue;\n\t\t}\n\t\t// Should never happen\n\t\tif(playState.m_nRow >= Patterns[playState.m_nPattern].GetNumRows())\n\t\t\tplayState.m_nRow = 0;\n\n\t\t// Check whether target was reached.\n\t\tif(target.mode == GetLengthTarget::SeekPosition && playState.m_nCurrentOrder == target.pos.order && playState.m_nRow == target.pos.row)\n\t\t{\n\t\t\tretval.targetReached = true;\n\t\t\tbreak;\n\t\t}\n\n\t\tif(visitedRows.IsVisited(playState.m_nCurrentOrder, playState.m_nRow, true))\n\t\t{\n\t\t\tif(!hasSearchTarget || !visitedRows.GetFirstUnvisitedRow(playState.m_nNextOrder, playState.m_nRow, true))\n\t\t\t{\n\t\t\t\t// We aren't searching for a specific row, or we couldn't find any more unvisited rows.\n\t\t\t\tbreak;\n\t\t\t} else\n\t\t\t{\n\t\t\t\t// We haven't found the target row yet, but we found some other unplayed row... continue searching from here.\n\t\t\t\tretval.duration = memory.elapsedTime;\n\t\t\t\tresults.push_back(retval);\n\t\t\t\tretval.startRow = playState.m_nRow;\n\t\t\t\tretval.startOrder = playState.m_nNextOrder;\n\t\t\t\tmemory.Reset();\n\t\t\t\tplayState.m_nNextRow = playState.m_nRow;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tretval.endOrder = playState.m_nCurrentOrder;\n\t\tretval.endRow = playState.m_nRow;\n\n\t\t// Update next position\n\t\tplayState.m_nNextRow = playState.m_nRow + 1;\n\n\t\t// Jumped to invalid pattern row?\n\t\tif(playState.m_nRow >= Patterns[playState.m_nPattern].GetNumRows())\n\t\t{\n\t\t\tplayState.m_nRow = 0;\n\t\t}\n\t\t// New pattern?\n\t\tif(!playState.m_nRow)\n\t\t{\n\t\t\tfor(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++)\n\t\t\t{\n\t\t\t\tmemory.chnSettings[chn].patLoop = memory.elapsedTime;\n\t\t\t\tmemory.chnSettings[chn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t}\n\t\t}\n\n\t\tModChannel *pChn = playState.Chn;\n\t\t\n\t\t// For various effects, we need to know first how many ticks there are in this row.\n\t\tconst ModCommand *p = Patterns[playState.m_nPattern].GetpModCommand(playState.m_nRow, 0);\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, p++)\n\t\t{\n\t\t\tif(m_playBehaviour[kST3NoMutedChannels] && ChnSettings[nChn].dwFlags[CHN_MUTE])\t// not even effects are processed on muted S3M channels\n\t\t\t\tcontinue;\n\t\t\tif(p->IsPcNote())\n\t\t\t{\n#ifndef NO_PLUGINS\n\t\t\t\tif((adjustMode & eAdjust) && p->instr > 0 && p->instr <= MAX_MIXPLUGINS)\n\t\t\t\t{\n\t\t\t\t\tmemory.plugParams[std::make_pair(p->instr, p->GetValueVolCol())] = p->GetValueEffectCol();\n\t\t\t\t}\n#endif // NO_PLUGINS\n\t\t\t\tpChn[nChn].rowCommand.Clear();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tpChn[nChn].rowCommand = *p;\n\t\t\tswitch(p->command)\n\t\t\t{\n\t\t\tcase CMD_SPEED:\n\t\t\t\tSetSpeed(playState, p->param);\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_TEMPO:\n\t\t\t\tif(m_playBehaviour[kMODVBlankTiming])\n\t\t\t\t{\n\t\t\t\t\t// ProTracker MODs with VBlank timing: All Fxx parameters set the tick count.\n\t\t\t\t\tif(p->param != 0) SetSpeed(playState, p->param);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tif((p->param & 0xF0) == 0x60)\n\t\t\t\t{\n\t\t\t\t\t// Fine Pattern Delay\n\t\t\t\t\ttickDelay += (p->param & 0x0F);\n\t\t\t\t} else if((p->param & 0xF0) == 0xE0 && !rowDelay)\n\t\t\t\t{\n\t\t\t\t\t// Pattern Delay\n\t\t\t\t\tif(!(GetType() & MOD_TYPE_S3M) || (p->param & 0x0F) != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t// While Impulse Tracker *does* count S60 as a valid row delay (and thus ignores any other row delay commands on the right),\n\t\t\t\t\t\t// Scream Tracker 3 simply ignores such commands.\n\t\t\t\t\t\trowDelay = 1 + (p->param & 0x0F);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tif((p->param & 0xF0) == 0xE0)\n\t\t\t\t{\n\t\t\t\t\t// Pattern Delay\n\t\t\t\t\trowDelay = 1 + (p->param & 0x0F);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(rowDelay == 0) rowDelay = 1;\n\t\tconst uint32 numTicks = (playState.m_nMusicSpeed + tickDelay) * rowDelay;\n\t\tconst uint32 nonRowTicks = numTicks - rowDelay;\n\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++) if(!pChn->rowCommand.IsEmpty())\n\t\t{\n\t\t\tif(m_playBehaviour[kST3NoMutedChannels] && ChnSettings[nChn].dwFlags[CHN_MUTE])\t// not even effects are processed on muted S3M channels\n\t\t\t\tcontinue;\n\t\t\tModCommand::COMMAND command = pChn->rowCommand.command;\n\t\t\tModCommand::PARAM param = pChn->rowCommand.param;\n\t\t\tModCommand::NOTE note = pChn->rowCommand.note;\n\n\t\t\tif (pChn->rowCommand.instr)\n\t\t\t{\n\t\t\t\tpChn->nNewIns = pChn->rowCommand.instr;\n\t\t\t\tpChn->nLastNote = NOTE_NONE;\n\t\t\t\tmemory.chnSettings[nChn].vol = 0xFF;\n\t\t\t}\n\t\t\tif (pChn->rowCommand.IsNote()) pChn->nLastNote = note;\n\n\t\t\t// Update channel panning\n\t\t\tif(pChn->rowCommand.IsNote() || pChn->rowCommand.instr)\n\t\t\t{\n\t\t\t\tSAMPLEINDEX smp = 0;\n\t\t\t\tif(GetNumInstruments())\n\t\t\t\t{\n\t\t\t\t\tModInstrument *pIns;\n\t\t\t\t\tif(pChn->nNewIns <= GetNumInstruments() && (pIns = Instruments[pChn->nNewIns]) != nullptr)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(pIns->dwFlags[INS_SETPANNING])\n\t\t\t\t\t\t\tpChn->nPan = pIns->nPan;\n\t\t\t\t\t\tif(ModCommand::IsNote(note))\n\t\t\t\t\t\t\tsmp = pIns->Keyboard[note - NOTE_MIN];\n\t\t\t\t\t}\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tsmp = pChn->nNewIns;\n\t\t\t\t}\n\t\t\t\tif(smp > 0 && smp <= GetNumSamples() && Samples[smp].uFlags[CHN_PANNING])\n\t\t\t\t{\n\t\t\t\t\tpChn->nPan = Samples[smp].nPan;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch(pChn->rowCommand.volcmd)\n\t\t\t{\n\t\t\tcase VOLCMD_VOLUME:\n\t\t\t\tmemory.chnSettings[nChn].vol = pChn->rowCommand.vol;\n\t\t\t\tbreak;\n\t\t\tcase VOLCMD_VOLSLIDEUP:\n\t\t\tcase VOLCMD_VOLSLIDEDOWN:\n\t\t\t\tif(pChn->rowCommand.vol != 0)\n\t\t\t\t\tpChn->nOldVolParam = pChn->rowCommand.vol;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch(command)\n\t\t\t{\n\t\t\t// Position Jump\n\t\t\tcase CMD_POSITIONJUMP:\n\t\t\t\tpositionJumpOnThisRow = true;\n\t\t\t\tplayState.m_nNextOrder = static_cast(CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn));\n\t\t\t\tplayState.m_nNextPatStartRow = 0; // FT2 E60 bug\n\t\t\t\t// see https://forum.openmpt.org/index.php?topic=2769.0 - FastTracker resets Dxx if Bxx is called _after_ Dxx\n\t\t\t\t// Test case: PatternJump.mod\n\t\t\t\tif(!patternBreakOnThisRow || (GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)))\n\t\t\t\t\tplayState.m_nNextRow = 0;\n\n\t\t\t\tif (adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tpChn->nPatternLoopCount = 0;\n\t\t\t\t\tpChn->nPatternLoop = 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Pattern Break\n\t\t\tcase CMD_PATTERNBREAK:\n\t\t\t\t{\n\t\t\t\t\tROWINDEX row = PatternBreak(playState, nChn, param);\n\t\t\t\t\tif(row != ROWINDEX_INVALID)\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternBreakOnThisRow = true;\n\t\t\t\t\t\tplayState.m_nNextRow = row;\n\n\t\t\t\t\t\tif(!positionJumpOnThisRow)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tplayState.m_nNextOrder = playState.m_nCurrentOrder + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpChn->nPatternLoopCount = 0;\n\t\t\t\t\t\t\tpChn->nPatternLoop = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Set Tempo\n\t\t\tcase CMD_TEMPO:\n\t\t\t\tif(!m_playBehaviour[kMODVBlankTiming])\n\t\t\t\t{\n\t\t\t\t\tTEMPO tempo(CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn), 0);\n\t\t\t\t\tif ((adjustMode & eAdjust) && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (tempo.GetInt()) pChn->nOldTempo = static_cast(tempo.GetInt()); else tempo.Set(pChn->nOldTempo);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (tempo.GetInt() >= 0x20) playState.m_nMusicTempo = tempo;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// Tempo Slide\n\t\t\t\t\t\tTEMPO tempoDiff((tempo.GetInt() & 0x0F) * nonRowTicks, 0);\n\t\t\t\t\t\tif ((tempo.GetInt() & 0xF0) == 0x10)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tplayState.m_nMusicTempo += tempoDiff;\n\t\t\t\t\t\t} else\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(tempoDiff < playState.m_nMusicTempo)\n\t\t\t\t\t\t\t\tplayState.m_nMusicTempo -= tempoDiff;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tplayState.m_nMusicTempo.Set(0);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tTEMPO tempoMin = GetModSpecifications().GetTempoMin(), tempoMax = GetModSpecifications().GetTempoMax();\n\t\t\t\t\tif(m_playBehaviour[kTempoClamp])\t// clamp tempo correctly in compatible mode\n\t\t\t\t\t{\n\t\t\t\t\t\ttempoMax.Set(255);\n\t\t\t\t\t}\n\t\t\t\t\tLimit(playState.m_nMusicTempo, tempoMin, tempoMax);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tswitch(param & 0xF0)\n\t\t\t\t{\n\t\t\t\tcase 0x90:\n\t\t\t\t\tif(param <= 0x91)\n\t\t\t\t\t{\n\t\t\t\t\t\tpChn->dwFlags.set(CHN_SURROUND, param == 0x91);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xA0:\n\t\t\t\t\t// High sample offset\n\t\t\t\t\tpChn->nOldHiOffset = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase 0xB0:\n\t\t\t\t\t// Pattern Loop\n\t\t\t\t\tif (param & 0x0F)\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternLoopEndedOnThisRow = true;\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tCHANNELINDEX firstChn = nChn, lastChn = nChn;\n\t\t\t\t\t\tif(GetType() == MOD_TYPE_S3M)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// ST3 has only one global loop memory.\n\t\t\t\t\t\t\tfirstChn = 0;\n\t\t\t\t\t\t\tlastChn = GetNumChannels() - 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(CHANNELINDEX c = firstChn; c <= lastChn; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoop = memory.elapsedTime;\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\t\tmemory.chnSettings[c].patLoopStart = playState.m_nRow;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpatternLoopStartedOnThisRow = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xF0:\n\t\t\t\t\t// Active macro\n\t\t\t\t\tpChn->nActiveMacro = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tswitch(param & 0xF0)\n\t\t\t\t{\n\t\t\t\tcase 0x60:\n\t\t\t\t\t// Pattern Loop\n\t\t\t\t\tif (param & 0x0F)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.m_nNextPatStartRow = memory.chnSettings[nChn].patLoopStart; // FT2 E60 bug\n\t\t\t\t\t\tpatternLoopEndedOnThisRow = true;\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tpatternLoopStartedOnThisRow = true;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopStart = playState.m_nRow;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 0xF0:\n\t\t\t\t\t// Active macro\n\t\t\t\t\tpChn->nActiveMacro = param & 0x0F;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_XFINEPORTAUPDOWN:\n\t\t\t\t// ignore high offset in compatible mode\n\t\t\t\tif(((param & 0xF0) == 0xA0) && !m_playBehaviour[kFT2RestrictXCommand]) pChn->nOldHiOffset = param & 0x0F;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// The following calculations are not interesting if we just want to get the song length.\n\t\t\tif (!(adjustMode & eAdjust)) continue;\n\t\t\tswitch(command)\n\t\t\t{\n\t\t\t// Portamento Up/Down\n\t\t\tcase CMD_PORTAMENTOUP:\n\t\t\t\tif(param)\n\t\t\t\t{\n\t\t\t\t\t// FT2 compatibility: Separate effect memory for all portamento commands\n\t\t\t\t\t// Test case: Porta-LinkMem.xm\n\t\t\t\t\tif(!m_playBehaviour[kFT2PortaUpDownMemory])\n\t\t\t\t\t\tpChn->nOldPortaDown = param;\n\t\t\t\t\tpChn->nOldPortaUp = param;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CMD_PORTAMENTODOWN:\n\t\t\t\tif(param)\n\t\t\t\t{\n\t\t\t\t\t// FT2 compatibility: Separate effect memory for all portamento commands\n\t\t\t\t\t// Test case: Porta-LinkMem.xm\n\t\t\t\t\tif(!m_playBehaviour[kFT2PortaUpDownMemory])\n\t\t\t\t\t\tpChn->nOldPortaUp = param;\n\t\t\t\t\tpChn->nOldPortaDown = param;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Tone-Portamento\n\t\t\tcase CMD_TONEPORTAMENTO:\n\t\t\t\tif (param) pChn->nPortamentoSlide = param << 2;\n\t\t\t\tbreak;\n\t\t\t// Offset\n\t\t\tcase CMD_OFFSET:\n\t\t\t\tif (param) pChn->oldOffset = param << 8;\n\t\t\t\tbreak;\n\t\t\t// Volume Slide\n\t\t\tcase CMD_VOLUMESLIDE:\n\t\t\tcase CMD_TONEPORTAVOL:\n\t\t\t\tif (param) pChn->nOldVolumeSlide = param;\n\t\t\t\tbreak;\n\t\t\t// Set Volume\n\t\t\tcase CMD_VOLUME:\n\t\t\t\tmemory.chnSettings[nChn].vol = param;\n\t\t\t\tbreak;\n\t\t\t// Global Volume\n\t\t\tcase CMD_GLOBALVOLUME:\n\t\t\t\tif(!(GetType() & GLOBALVOL_7BIT_FORMATS) && param < 128) param *= 2;\n\t\t\t\t// IT compatibility 16. ST3 and IT ignore out-of-range values\n\t\t\t\tif(param <= 128)\n\t\t\t\t{\n\t\t\t\t\tplayState.m_nGlobalVolume = param * 2;\n\t\t\t\t} else if(!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)))\n\t\t\t\t{\n\t\t\t\t\tplayState.m_nGlobalVolume = 256;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Global Volume Slide\n\t\t\tcase CMD_GLOBALVOLSLIDE:\n\t\t\t\tif(m_playBehaviour[kPerChannelGlobalVolSlide])\n\t\t\t\t{\n\t\t\t\t\t// IT compatibility 16. Global volume slide params are stored per channel (FT2/IT)\n\t\t\t\t\tif (param) pChn->nOldGlobalVolSlide = param; else param = pChn->nOldGlobalVolSlide;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tif (param) playState.Chn[0].nOldGlobalVolSlide = param; else param = playState.Chn[0].nOldGlobalVolSlide;\n\t\t\t\t}\n\t\t\t\tif (((param & 0x0F) == 0x0F) && (param & 0xF0))\n\t\t\t\t{\n\t\t\t\t\tparam >>= 4;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume += param << 1;\n\t\t\t\t} else if (((param & 0xF0) == 0xF0) && (param & 0x0F))\n\t\t\t\t{\n\t\t\t\t\tparam = (param & 0x0F) << 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume -= param;\n\t\t\t\t} else if (param & 0xF0)\n\t\t\t\t{\n\t\t\t\t\tparam >>= 4;\n\t\t\t\t\tparam <<= 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume += param * nonRowTicks;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tparam = (param & 0x0F) << 1;\n\t\t\t\t\tif (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1;\n\t\t\t\t\tplayState.m_nGlobalVolume -= param * nonRowTicks;\n\t\t\t\t}\n\t\t\t\tLimit(playState.m_nGlobalVolume, 0, 256);\n\t\t\t\tbreak;\n\t\t\tcase CMD_CHANNELVOLUME:\n\t\t\t\tif (param <= 64) pChn->nGlobalVol = param;\n\t\t\t\tbreak;\n\t\t\tcase CMD_CHANNELVOLSLIDE:\n\t\t\t\t{\n\t\t\t\t\tif (param) pChn->nOldChnVolSlide = param; else param = pChn->nOldChnVolSlide;\n\t\t\t\t\tint32 volume = pChn->nGlobalVol;\n\t\t\t\t\tif((param & 0x0F) == 0x0F && (param & 0xF0))\n\t\t\t\t\t\tvolume += (param >> 4);\t\t// Fine Up\n\t\t\t\t\telse if((param & 0xF0) == 0xF0 && (param & 0x0F))\n\t\t\t\t\t\tvolume -= (param & 0x0F);\t// Fine Down\n\t\t\t\t\telse if(param & 0x0F)\t\t\t// Down\n\t\t\t\t\t\tvolume -= (param & 0x0F) * nonRowTicks;\n\t\t\t\t\telse\t\t\t\t\t\t\t// Up\n\t\t\t\t\t\tvolume += ((param & 0xF0) >> 4) * nonRowTicks;\n\t\t\t\t\tLimit(volume, 0, 64);\n\t\t\t\t\tpChn->nGlobalVol = volume;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CMD_PANNING8:\n\t\t\t\tPanning(pChn, param, Pan8bit);\n\t\t\t\tbreak;\n\t\t\tcase CMD_MODCMDEX:\n\t\t\t\tif(param < 0x10)\n\t\t\t\t{\n\t\t\t\t\t// LED filter\n\t\t\t\t\tfor(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.Chn[chn].dwFlags.set(CHN_AMIGAFILTER, !(param & 1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tMPT_FALLTHROUGH;\n\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\tif((param & 0xF0) == 0x80)\n\t\t\t\t{\n\t\t\t\t\tPanning(pChn, (param & 0x0F), Pan4bit);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\tif (param) pChn->nOldVolumeSlide = param;\n\t\t\t\tparam = 0;\n\t\t\t\tMPT_FALLTHROUGH;\n\t\t\tcase CMD_VIBRATO:\n\t\t\t\tVibrato(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_FINEVIBRATO:\n\t\t\t\tFineVibrato(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_TREMOLO:\n\t\t\t\tTremolo(pChn, param);\n\t\t\t\tbreak;\n\t\t\tcase CMD_PANBRELLO:\n\t\t\t\tPanbrello(pChn, param);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch(pChn->rowCommand.volcmd)\n\t\t\t{\n\t\t\tcase VOLCMD_PANNING:\n\t\t\t\tPanning(pChn, pChn->rowCommand.vol, Pan6bit);\n\t\t\t\tbreak;\n\n\t\t\tcase VOLCMD_VIBRATOSPEED:\n\t\t\t\t// FT2 does not automatically enable vibrato with the \"set vibrato speed\" command\n\t\t\t\tif(m_playBehaviour[kFT2VolColVibrato])\n\t\t\t\t\tpChn->nVibratoSpeed = pChn->rowCommand.vol & 0x0F;\n\t\t\t\telse\n\t\t\t\t\tVibrato(pChn, pChn->rowCommand.vol << 4);\n\t\t\t\tbreak;\n\t\t\tcase VOLCMD_VIBRATODEPTH:\n\t\t\t\tVibrato(pChn, pChn->rowCommand.vol);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Process vibrato / tremolo / panbrello\n\t\t\tswitch(pChn->rowCommand.command)\n\t\t\t{\n\t\t\tcase CMD_VIBRATO:\n\t\t\tcase CMD_FINEVIBRATO:\n\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tuint32 vibTicks = ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && !m_SongFlags[SONG_ITOLDEFFECTS]) ? numTicks : nonRowTicks;\n\t\t\t\t\tuint32 inc = pChn->nVibratoSpeed * vibTicks;\n\t\t\t\t\tif(m_playBehaviour[kITVibratoTremoloPanbrello])\n\t\t\t\t\t\tinc *= 4;\n\t\t\t\t\tpChn->nVibratoPos += static_cast(inc);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_TREMOLO:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\tuint32 tremTicks = ((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && !m_SongFlags[SONG_ITOLDEFFECTS]) ? numTicks : nonRowTicks;\n\t\t\t\t\tuint32 inc = pChn->nTremoloSpeed * tremTicks;\n\t\t\t\t\tif(m_playBehaviour[kITVibratoTremoloPanbrello])\n\t\t\t\t\t\tinc *= 4;\n\t\t\t\t\tpChn->nTremoloPos += static_cast(inc);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CMD_PANBRELLO:\n\t\t\t\tif(adjustMode & eAdjust)\n\t\t\t\t{\n\t\t\t\t\t// Panbrello effect is permanent in compatible mode, so actually apply panbrello for the last tick of this row\n\t\t\t\t\tpChn->nPanbrelloPos += static_cast(pChn->nPanbrelloSpeed * (numTicks - 1));\n\t\t\t\t\tProcessPanbrello(pChn);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Interpret F00 effect in XM files as \"stop song\"\n\t\tif(GetType() == MOD_TYPE_XM && playState.m_nMusicSpeed == uint16_max)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\n\t\tplayState.m_nCurrentRowsPerBeat = m_nDefaultRowsPerBeat;\n\t\tif(Patterns[playState.m_nPattern].GetOverrideSignature())\n\t\t{\n\t\t\tplayState.m_nCurrentRowsPerBeat = Patterns[playState.m_nPattern].GetRowsPerBeat();\n\t\t}\n\n\t\tconst uint32 tickDuration = GetTickDuration(playState);\n\t\tconst uint32 rowDuration = tickDuration * numTicks;\n\t\tmemory.elapsedTime += static_cast(rowDuration) / static_cast(m_MixerSettings.gdwMixingFreq);\n\t\tplayState.m_lTotalSampleCount += rowDuration;\n\n\t\tif(adjustSamplePos)\n\t\t{\n\t\t\t// Super experimental and dirty sample seeking\n\t\t\tpChn = playState.Chn;\n\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++)\n\t\t\t{\n\t\t\t\tif(memory.chnSettings[nChn].ticksToRender == GetLengthMemory::IGNORE_CHANNEL)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tuint32 startTick = 0;\n\t\t\t\tconst ModCommand &m = pChn->rowCommand;\n\t\t\t\tuint32 paramHi = m.param >> 4, paramLo = m.param & 0x0F;\n\t\t\t\tbool porta = m.command == CMD_TONEPORTAMENTO || m.command == CMD_TONEPORTAVOL || m.volcmd == VOLCMD_TONEPORTAMENTO;\n\t\t\t\tbool stopNote = patternLoopStartedOnThisRow;\t// It's too much trouble to keep those pattern loops in sync...\n\n\t\t\t\tif(m.instr) pChn->proTrackerOffset = 0;\n\t\t\t\tif(m.IsNote())\n\t\t\t\t{\n\t\t\t\t\tif(porta && memory.chnSettings[nChn].incChanged)\n\t\t\t\t\t{\n\t\t\t\t\t\t// If there's a portamento, the current channel increment mustn't be 0 in NoteChange()\n\t\t\t\t\t\tpChn->increment = GetChannelIncrement(pChn, pChn->nPeriod, 0);\n\t\t\t\t\t}\n\t\t\t\t\tint32 setPan = pChn->nPan;\n\t\t\t\t\tpChn->nNewNote = pChn->nLastNote;\n\t\t\t\t\tif(pChn->nNewIns != 0) InstrumentChange(pChn, pChn->nNewIns, porta);\n\t\t\t\t\tNoteChange(pChn, m.note, porta);\n\t\t\t\t\tmemory.chnSettings[nChn].incChanged = true;\n\n\t\t\t\t\tif((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xD0 && paramLo < numTicks)\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick = paramLo;\n\t\t\t\t\t} else if(m.command == CMD_DELAYCUT && paramHi < numTicks)\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick = paramHi;\n\t\t\t\t\t}\n\t\t\t\t\tif(rowDelay > 1 && startTick != 0 && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)))\n\t\t\t\t\t{\n\t\t\t\t\t\tstartTick += (playState.m_nMusicSpeed + tickDelay) * (rowDelay - 1);\n\t\t\t\t\t}\n\t\t\t\t\tif(!porta) memory.chnSettings[nChn].ticksToRender = 0;\n\n\t\t\t\t\t// Panning commands have to be re-applied after a note change with potential pan change.\n\t\t\t\t\tif(m.command == CMD_PANNING8\n\t\t\t\t\t\t|| ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && paramHi == 0x8)\n\t\t\t\t\t\t|| m.volcmd == VOLCMD_PANNING)\n\t\t\t\t\t{\n\t\t\t\t\t\tpChn->nPan = setPan;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(m.command == CMD_OFFSET)\n\t\t\t\t\t{\n\t\t\t\t\t\tbool isExtended = false;\n\t\t\t\t\t\tSmpLength offset = CalculateXParam(playState.m_nPattern, playState.m_nRow, nChn, &isExtended);\n\t\t\t\t\t\tif(!isExtended)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toffset <<= 8;\n\t\t\t\t\t\t\tif(offset == 0) offset = pChn->oldOffset;\n\t\t\t\t\t\t\toffset += static_cast(pChn->nOldHiOffset) << 16;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tSampleOffset(*pChn, offset);\n\t\t\t\t\t} else if(m.command == CMD_OFFSETPERCENTAGE)\n\t\t\t\t\t{\n\t\t\t\t\t\tSampleOffset(*pChn, Util::muldiv_unsigned(pChn->nLength, m.param, 255));\n\t\t\t\t\t} else if(m.command == CMD_REVERSEOFFSET && pChn->pModSample != nullptr)\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\tReverseSampleOffset(*pChn, m.param);\n\t\t\t\t\t\tstartTick = playState.m_nMusicSpeed - 1;\n\t\t\t\t\t} else if(m.volcmd == VOLCMD_OFFSET)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(m.vol <= CountOf(pChn->pModSample->cues) && pChn->pModSample != nullptr)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSmpLength offset;\n\t\t\t\t\t\t\tif(m.vol == 0)\n\t\t\t\t\t\t\t\toffset = pChn->oldOffset;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toffset = pChn->oldOffset = pChn->pModSample->cues[m.vol - 1];\n\t\t\t\t\t\t\tSampleOffset(*pChn, offset);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(m.note == NOTE_KEYOFF || m.note == NOTE_NOTECUT || (m.note == NOTE_FADE && GetNumInstruments())\n\t\t\t\t\t|| ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xC0 && paramLo < numTicks)\n\t\t\t\t\t|| (m.command == CMD_DELAYCUT && paramLo != 0 && startTick + paramLo < numTicks))\n\t\t\t\t{\n\t\t\t\t\tstopNote = true;\n\t\t\t\t}\n\n\t\t\t\tif(m.command == CMD_VOLUME)\n\t\t\t\t{\n\t\t\t\t\tpChn->nVolume = m.param * 4;\n\t\t\t\t} else if(m.volcmd == VOLCMD_VOLUME)\n\t\t\t\t{\n\t\t\t\t\tpChn->nVolume = m.vol * 4;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(pChn->pModSample && !stopNote)\n\t\t\t\t{\n\t\t\t\t\t// Check if we don't want to emulate some effect and thus stop processing.\n\t\t\t\t\tif(m.command < MAX_EFFECTS)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(forbiddenCommands[m.command])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t\t} else if(m.command == CMD_MODCMDEX)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Special case: Slides using extended commands\n\t\t\t\t\t\t\tswitch(m.param & 0xF0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0x10:\n\t\t\t\t\t\t\tcase 0x20:\n\t\t\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(m.volcmd < forbiddenVolCommands.size() && forbiddenVolCommands[m.volcmd])\n\t\t\t\t\t{\n\t\t\t\t\t\tstopNote = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(stopNote)\n\t\t\t\t{\n\t\t\t\t\tpChn->Stop();\n\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender = 0;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tif(oldTickDuration != tickDuration && oldTickDuration != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch(m.command)\n\t\t\t\t\t{\n\t\t\t\t\tcase CMD_TONEPORTAVOL:\n\t\t\t\t\tcase CMD_VOLUMESLIDE:\n\t\t\t\t\tcase CMD_VIBRATOVOL:\n\t\t\t\t\t\tif(m.param || (GetType() != MOD_TYPE_MOD))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfor(uint32 i = 0; i < numTicks; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->isFirstTick = (i == 0);\n\t\t\t\t\t\t\t\tVolumeSlide(pChn, m.param);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CMD_MODCMDEX:\n\t\t\t\t\t\tif((m.param & 0x0F) || (GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpChn->isFirstTick = true;\n\t\t\t\t\t\t\tswitch(m.param & 0xF0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0xA0: FineVolumeUp(pChn, m.param & 0x0F, false); break;\n\t\t\t\t\t\t\tcase 0xB0: FineVolumeDown(pChn, m.param & 0x0F, false); break;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CMD_S3MCMDEX:\n\t\t\t\t\t\tif(m.param == 0x9E)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Play forward\n\t\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\t\tpChn->dwFlags.reset(CHN_PINGPONGFLAG);\n\t\t\t\t\t\t} else if(m.param == 0x9F)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Reverse\n\t\t\t\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\t// Re-sync what we've got so far\n\t\t\t\t\t\t\tpChn->dwFlags.set(CHN_PINGPONGFLAG);\n\t\t\t\t\t\t\tif(!pChn->position.GetInt() && pChn->nLength && (m.IsNote() || !pChn->dwFlags[CHN_LOOP]))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->position.Set(pChn->nLength - 1, SamplePosition::fractMax);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if((m.param & 0xF0) == 0x70)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// TODO\n\t\t\t\t\t\t\t//ExtendedS3MCommands(nChn, param);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tpChn->isFirstTick = true;\n\t\t\t\t\tswitch(m.volcmd)\n\t\t\t\t\t{\n\t\t\t\t\tcase VOLCMD_FINEVOLUP:\t\tFineVolumeUp(pChn, m.vol, m_playBehaviour[kITVolColMemory]); break;\n\t\t\t\t\tcase VOLCMD_FINEVOLDOWN:\tFineVolumeDown(pChn, m.vol, m_playBehaviour[kITVolColMemory]); break;\n\t\t\t\t\tcase VOLCMD_VOLSLIDEUP:\n\t\t\t\t\tcase VOLCMD_VOLSLIDEDOWN:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// IT Compatibility: Volume column volume slides have their own memory\n\t\t\t\t\t\t\t// Test case: VolColMemory.it\n\t\t\t\t\t\t\tModCommand::VOL vol = m.vol;\n\t\t\t\t\t\t\tif(vol == 0 && m_playBehaviour[kITVolColMemory])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvol = pChn->nOldVolParam;\n\t\t\t\t\t\t\t\tif(vol == 0)\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(m.volcmd == VOLCMD_VOLSLIDEUP)\n\t\t\t\t\t\t\t\tvol <<= 4;\n\t\t\t\t\t\t\tfor(uint32 i = 0; i < numTicks; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tpChn->isFirstTick = (i == 0);\n\t\t\t\t\t\t\t\tVolumeSlide(pChn, vol);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(porta)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Portamento needs immediate syncing, as the pitch changes on each tick\n\t\t\t\t\t\tuint32 portaTick = memory.chnSettings[nChn].ticksToRender + startTick + 1;\n\t\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender += numTicks;\n\t\t\t\t\t\tmemory.RenderChannel(nChn, tickDuration, portaTick);\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[nChn].ticksToRender += (numTicks - startTick);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\toldTickDuration = tickDuration;\n\n\t\t// Pattern loop is not executed in FT2 if there are any position jump or pattern break commands on the same row.\n\t\t// Pattern loop is not executed in IT if there are any position jump commands on the same row.\n\t\t// Test case for FT2 exception: PatLoop-Jumps.xm, PatLoop-Various.xm\n\t\t// Test case for IT: exception: LoopBreak.it\n\t\tif(patternLoopEndedOnThisRow\n\t\t\t&& (!m_playBehaviour[kFT2PatternLoopWithJumps] || !(positionJumpOnThisRow || patternBreakOnThisRow))\n\t\t\t&& (!m_playBehaviour[kITPatternLoopWithJumps] || !positionJumpOnThisRow))\n\t\t{\n\t\t\tstd::map startTimes;\n\t\t\t// This is really just a simple estimation for nested pattern loops. It should handle cases correctly where all parallel loops start and end on the same row.\n\t\t\t// If one of them starts or ends \"in between\", it will most likely calculate a wrong duration.\n\t\t\t// For S3M files, it's also way off.\n\t\t\tpChn = playState.Chn;\n\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++)\n\t\t\t{\n\t\t\t\tModCommand::COMMAND command = pChn->rowCommand.command;\n\t\t\t\tModCommand::PARAM param = pChn->rowCommand.param;\n\t\t\t\tif((command == CMD_S3MCMDEX && param >= 0xB1 && param <= 0xBF)\n\t\t\t\t\t|| (command == CMD_MODCMDEX && param >= 0x61 && param <= 0x6F))\n\t\t\t\t{\n\t\t\t\t\tconst double start = memory.chnSettings[nChn].patLoop;\n\t\t\t\t\tif(!startTimes[start]) startTimes[start] = 1;\n\t\t\t\t\tstartTimes[start] = mpt::lcm(startTimes[start], 1 + (param & 0x0F));\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(const auto &i : startTimes)\n\t\t\t{\n\t\t\t\tmemory.elapsedTime += (memory.elapsedTime - i.first) * (double)(i.second - 1);\n\t\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++)\n\t\t\t\t{\n\t\t\t\t\tif(memory.chnSettings[nChn].patLoop == i.first)\n\t\t\t\t\t{\n\t\t\t\t\t\tplayState.m_lTotalSampleCount += (playState.m_lTotalSampleCount - memory.chnSettings[nChn].patLoopSmp) * (i.second - 1);\n\t\t\t\t\t\tif(m_playBehaviour[kITPatternLoopTargetReset] || (GetType() == MOD_TYPE_S3M))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopStart = playState.m_nRow + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(GetType() == MOD_TYPE_IT)\n\t\t\t{\n\t\t\t\t// IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0)\n\t\t\t\tpChn = playState.Chn;\n\t\t\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++)\n\t\t\t\t{\n\t\t\t\t\tif((pChn->rowCommand.command == CMD_S3MCMDEX && pChn->rowCommand.param >= 0xB1 && pChn->rowCommand.param <= 0xBF))\n\t\t\t\t\t{\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoop = memory.elapsedTime;\n\t\t\t\t\t\tmemory.chnSettings[nChn].patLoopSmp = playState.m_lTotalSampleCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Now advance the sample positions for sample seeking on channels that are still playing\n\tif(adjustSamplePos)\n\t{\n\t\tfor(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++)\n\t\t{\n\t\t\tif(memory.chnSettings[nChn].ticksToRender != GetLengthMemory::IGNORE_CHANNEL)\n\t\t\t{\n\t\t\t\tmemory.RenderChannel(nChn, oldTickDuration);\n\t\t\t}\n\t\t}\n\t}\n\n\tif(retval.targetReached || target.mode == GetLengthTarget::NoTarget)\n\t{\n\t\tretval.lastOrder = playState.m_nCurrentOrder;\n\t\tretval.lastRow = playState.m_nRow;\n\t}\n\tretval.duration = memory.elapsedTime;\n\tresults.push_back(retval);\n\n\t// Store final variables\n\tif(adjustMode & eAdjust)\n\t{\n\t\tif(retval.targetReached || target.mode == GetLengthTarget::NoTarget)\n\t\t{\n\t\t\t// Target found, or there is no target (i.e. play whole song)...\n\t\t\tm_PlayState = std::move(playState);\n\t\t\tm_PlayState.m_nNextRow = m_PlayState.m_nRow;\n\t\t\tm_PlayState.m_nFrameDelay = m_PlayState.m_nPatternDelay = 0;\n\t\t\tm_PlayState.m_nTickCount = Util::MaxValueOfType(m_PlayState.m_nTickCount) - 1;\n\t\t\tm_PlayState.m_bPositionChanged = true;\n\t\t\tfor(CHANNELINDEX n = 0; n < GetNumChannels(); n++)\n\t\t\t{\n\t\t\t\tif(m_PlayState.Chn[n].nLastNote != NOTE_NONE)\n\t\t\t\t{\n\t\t\t\t\tm_PlayState.Chn[n].nNewNote = m_PlayState.Chn[n].nLastNote;\n\t\t\t\t}\n\t\t\t\tif(memory.chnSettings[n].vol != 0xFF && !adjustSamplePos)\n\t\t\t\t{\n\t\t\t\t\tm_PlayState.Chn[n].nVolume = std::min(memory.chnSettings[n].vol, uint8(64)) * 4;\n\t\t\t\t}\n\t\t\t}\n\n#ifndef NO_PLUGINS\n\t\t\t// If there were any PC events, update plugin parameters to their latest value.\n\t\t\tstd::bitset plugSetProgram;\n\t\t\tfor(const auto ¶m : memory.plugParams)\n\t\t\t{\n\t\t\t\tPLUGINDEX plug = param.first.first - 1;\n\t\t\t\tIMixPlugin *plugin = m_MixPlugins[plug].pMixPlugin;\n\t\t\t\tif(plugin != nullptr)\n\t\t\t\t{\n\t\t\t\t\tif(!plugSetProgram[plug])\n\t\t\t\t\t{\n\t\t\t\t\t\t// Used for bridged plugins to avoid sending out individual messages for each parameter.\n\t\t\t\t\t\tplugSetProgram.set(plug);\n\t\t\t\t\t\tplugin->BeginSetProgram();\n\t\t\t\t\t}\n\t\t\t\t\tplugin->SetParameter(param.first.second, param.second / PlugParamValue(ModCommand::maxColumnValue));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(plugSetProgram.any())\n\t\t\t{\n\t\t\t\tfor(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; i++)\n\t\t\t\t{\n\t\t\t\t\tif(plugSetProgram[i])\n\t\t\t\t\t{\n\t\t\t\t\t\tm_MixPlugins[i].pMixPlugin->EndSetProgram();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n#endif // NO_PLUGINS\n\t\t} else if(adjustMode != eAdjustOnSuccess)\n\t\t{\n\t\t\t// Target not found (e.g. when jumping to a hidden sub song), reset global variables...\n\t\t\tm_PlayState.m_nMusicSpeed = m_nDefaultSpeed;\n\t\t\tm_PlayState.m_nMusicTempo = m_nDefaultTempo;\n\t\t\tm_PlayState.m_nGlobalVolume = m_nDefaultGlobalVolume;\n\t\t}\n\t\t// When adjusting the playback status, we will also want to update the visited rows vector according to the current position.\n\t\tif(sequence != Order.GetCurrentSequenceIndex())\n\t\t{\n\t\t\tOrder.SetSequence(sequence);\n\t\t}\n\t\tvisitedSongRows.Set(visitedRows);\n\t}\n\n\treturn results;\n\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"CSoundFile::GetLength","file_name":"soundlib/Snd_fx.cpp","commit_link":"github.com/OpenMPT/openmpt/commit/492022c7297ede682161d9c0ec2de15526424e76","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#17-ba0354c92804","input":"static inline size_t GetPSDRowSize(Image *image)\n{\n if (image->depth == 1)\n return((image->columns+7)/8);\n else\n return(image->columns*GetPSDPacketSize(image));\n}","target":"static inline size_t GetPSDRowSize(Image *image)\n{\n if (image->depth == 1)\n return(((image->columns+7)/8)*GetPSDPacketSize(image));\n else\n return(image->columns*GetPSDPacketSize(image));\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"GetPSDRowSize","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/5f16640725b1225e6337c62526e6577f0f88edb8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#18-0af9171e26c6","input":"static int dex_loadcode(RBinFile *arch, RBinDexObj *bin) {\n\tstruct r_bin_t *rbin = arch->rbin;\n\tint i;\n\tint *methods = NULL;\n\tint sym_count = 0;\n\n\t// doublecheck??\n\tif (!bin || bin->methods_list) {\n\t\treturn false;\n\t}\n\tbin->code_from = UT64_MAX;\n\tbin->code_to = 0;\n\tbin->methods_list = r_list_newf ((RListFree)free);\n\tif (!bin->methods_list) {\n\t\treturn false;\n\t}\n\tbin->imports_list = r_list_newf ((RListFree)free);\n\tif (!bin->imports_list) {\n\t\tr_list_free (bin->methods_list);\n\t\treturn false;\n\t}\n\tbin->classes_list = r_list_newf ((RListFree)__r_bin_class_free);\n\tif (!bin->classes_list) {\n\t\tr_list_free (bin->methods_list);\n\t\tr_list_free (bin->imports_list);\n\t\treturn false;\n\t}\n\n\tif (bin->header.method_size>bin->size) {\n\t\tbin->header.method_size = 0;\n\t\treturn false;\n\t}\n\n\t/* WrapDown the header sizes to avoid huge allocations */\n\tbin->header.method_size = R_MIN (bin->header.method_size, bin->size);\n\tbin->header.class_size = R_MIN (bin->header.class_size, bin->size);\n\tbin->header.strings_size = R_MIN (bin->header.strings_size, bin->size);\n\n\t// TODO: is this posible after R_MIN ??\n\tif (bin->header.strings_size > bin->size) {\n\t\teprintf (\"Invalid strings size\\n\");\n\t\treturn false;\n\t}\n\n\tif (bin->classes) {\n\t\tut64 amount = sizeof (int) * bin->header.method_size;\n\t\tif (amount > UT32_MAX || amount < bin->header.method_size) {\n\t\t\treturn false;\n\t\t}\n\t\tmethods = calloc (1, amount + 1);\n\t\tfor (i = 0; i < bin->header.class_size; i++) {\n\t\t\tchar *super_name, *class_name;\n\t\t\tstruct dex_class_t *c = &bin->classes[i];\n\t\t\tclass_name = dex_class_name (bin, c);\n\t\t\tsuper_name = dex_class_super_name (bin, c);\n\t\t\tif (dexdump) { \n\t\t\t\trbin->cb_printf (\"Class #%d -\\n\", i);\n\t\t\t}\n\t\t\tparse_class (arch, bin, c, i, methods, &sym_count);\n\t\t\tfree (class_name);\n\t\t\tfree (super_name);\n\t\t}\n\t}\n\n\tif (methods) {\n\t\tint import_count = 0;\n\t\tint sym_count = bin->methods_list->length;\n\n\t\tfor (i = 0; i < bin->header.method_size; i++) {\n\t\t\tint len = 0;\n\t\t\tif (methods[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (bin->methods[i].class_id > bin->header.types_size - 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (is_class_idx_in_code_classes(bin, bin->methods[i].class_id)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tchar *class_name = getstr (\n\t\t\t\tbin, bin->types[bin->methods[i].class_id]\n\t\t\t\t\t\t.descriptor_id);\n\t\t\tif (!class_name) {\n\t\t\t\tfree (class_name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlen = strlen (class_name);\n\t\t\tif (len < 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tclass_name[len - 1] = 0; // remove last char \";\"\n\t\t\tchar *method_name = dex_method_name (bin, i);\n\t\t\tchar *signature = dex_method_signature (bin, i);\n\t\t\tif (method_name && *method_name) {\n\t\t\t\tRBinImport *imp = R_NEW0 (RBinImport);\n\t\t\t\timp->name = r_str_newf (\"%s.method.%s%s\", class_name, method_name, signature);\n\t\t\t\timp->type = r_str_const (\"FUNC\");\n\t\t\t\timp->bind = r_str_const (\"NONE\");\n\t\t\t\timp->ordinal = import_count++;\n\t\t\t\tr_list_append (bin->imports_list, imp);\n\n\t\t\t\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\t\t\t\tsym->name = r_str_newf (\"imp.%s\", imp->name);\n\t\t\t\tsym->type = r_str_const (\"FUNC\");\n\t\t\t\tsym->bind = r_str_const (\"NONE\");\n\t\t\t\t//XXX so damn unsafe check buffer boundaries!!!!\n\t\t\t\t//XXX use r_buf API!!\n\t\t\t\tsym->paddr = sym->vaddr = bin->b->base + bin->header.method_offset + (sizeof (struct dex_method_t) * i) ;\n\t\t\t\tsym->ordinal = sym_count++;\n\t\t\t\tr_list_append (bin->methods_list, sym);\n\t\t\t\tsdb_num_set (mdb, sdb_fmt (0, \"method.%d\", i), sym->paddr, 0);\n\t\t\t}\n\t\t\tfree (method_name);\n\t\t\tfree (signature);\n\t\t\tfree (class_name);\n\t\t}\n\t\tfree (methods);\n\t}\n\treturn true;\n}","target":"static int dex_loadcode(RBinFile *arch, RBinDexObj *bin) {\n\tstruct r_bin_t *rbin = arch->rbin;\n\tint i;\n\tint *methods = NULL;\n\tint sym_count = 0;\n\n\t// doublecheck??\n\tif (!bin || bin->methods_list) {\n\t\treturn false;\n\t}\n\tbin->code_from = UT64_MAX;\n\tbin->code_to = 0;\n\tbin->methods_list = r_list_newf ((RListFree)free);\n\tif (!bin->methods_list) {\n\t\treturn false;\n\t}\n\tbin->imports_list = r_list_newf ((RListFree)free);\n\tif (!bin->imports_list) {\n\t\tr_list_free (bin->methods_list);\n\t\treturn false;\n\t}\n\tbin->classes_list = r_list_newf ((RListFree)__r_bin_class_free);\n\tif (!bin->classes_list) {\n\t\tr_list_free (bin->methods_list);\n\t\tr_list_free (bin->imports_list);\n\t\treturn false;\n\t}\n\n\tif (bin->header.method_size>bin->size) {\n\t\tbin->header.method_size = 0;\n\t\treturn false;\n\t}\n\n\t/* WrapDown the header sizes to avoid huge allocations */\n\tbin->header.method_size = R_MIN (bin->header.method_size, bin->size);\n\tbin->header.class_size = R_MIN (bin->header.class_size, bin->size);\n\tbin->header.strings_size = R_MIN (bin->header.strings_size, bin->size);\n\n\t// TODO: is this posible after R_MIN ??\n\tif (bin->header.strings_size > bin->size) {\n\t\teprintf (\"Invalid strings size\\n\");\n\t\treturn false;\n\t}\n\n\tif (bin->classes) {\n\t\tut64 amount = sizeof (int) * bin->header.method_size;\n\t\tif (amount > UT32_MAX || amount < bin->header.method_size) {\n\t\t\treturn false;\n\t\t}\n\t\tmethods = calloc (1, amount + 1);\n\t\tfor (i = 0; i < bin->header.class_size; i++) {\n\t\t\tchar *super_name, *class_name;\n\t\t\tstruct dex_class_t *c = &bin->classes[i];\n\t\t\tclass_name = dex_class_name (bin, c);\n\t\t\tsuper_name = dex_class_super_name (bin, c);\n\t\t\tif (dexdump) { \n\t\t\t\trbin->cb_printf (\"Class #%d -\\n\", i);\n\t\t\t}\n\t\t\tparse_class (arch, bin, c, i, methods, &sym_count);\n\t\t\tfree (class_name);\n\t\t\tfree (super_name);\n\t\t}\n\t}\n\n\tif (methods) {\n\t\tint import_count = 0;\n\t\tint sym_count = bin->methods_list->length;\n\n\t\tfor (i = 0; i < bin->header.method_size; i++) {\n\t\t\tint len = 0;\n\t\t\tif (methods[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (bin->methods[i].class_id > bin->header.types_size) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (is_class_idx_in_code_classes(bin, bin->methods[i].class_id)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tchar *class_name = getstr (\n\t\t\t\tbin, bin->types[bin->methods[i].class_id]\n\t\t\t\t\t\t.descriptor_id);\n\t\t\tif (!class_name) {\n\t\t\t\tfree (class_name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlen = strlen (class_name);\n\t\t\tif (len < 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tclass_name[len - 1] = 0; // remove last char \";\"\n\t\t\tchar *method_name = dex_method_name (bin, i);\n\t\t\tchar *signature = dex_method_signature (bin, i);\n\t\t\tif (method_name && *method_name) {\n\t\t\t\tRBinImport *imp = R_NEW0 (RBinImport);\n\t\t\t\timp->name = r_str_newf (\"%s.method.%s%s\", class_name, method_name, signature);\n\t\t\t\timp->type = r_str_const (\"FUNC\");\n\t\t\t\timp->bind = r_str_const (\"NONE\");\n\t\t\t\timp->ordinal = import_count++;\n\t\t\t\tr_list_append (bin->imports_list, imp);\n\n\t\t\t\tRBinSymbol *sym = R_NEW0 (RBinSymbol);\n\t\t\t\tsym->name = r_str_newf (\"imp.%s\", imp->name);\n\t\t\t\tsym->type = r_str_const (\"FUNC\");\n\t\t\t\tsym->bind = r_str_const (\"NONE\");\n\t\t\t\t//XXX so damn unsafe check buffer boundaries!!!!\n\t\t\t\t//XXX use r_buf API!!\n\t\t\t\tsym->paddr = sym->vaddr = bin->b->base + bin->header.method_offset + (sizeof (struct dex_method_t) * i) ;\n\t\t\t\tsym->ordinal = sym_count++;\n\t\t\t\tr_list_append (bin->methods_list, sym);\n\t\t\t\tsdb_num_set (mdb, sdb_fmt (0, \"method.%d\", i), sym->paddr, 0);\n\t\t\t}\n\t\t\tfree (method_name);\n\t\t\tfree (signature);\n\t\t\tfree (class_name);\n\t\t}\n\t\tfree (methods);\n\t}\n\treturn true;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"dex_loadcode","file_name":"libr/bin/p/bin_dex.c","commit_link":"github.com/radare/radare2/commit/ead645853a63bf83d8386702cad0cf23b31d7eeb","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#19-52afbf8175d0","input":"static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n#define RMT_EQUAL_RGB 1\n#define RMT_NONE 0\n#define RMT_RAW 2\n#define RT_STANDARD 1\n#define RT_ENCODED 2\n#define RT_FORMAT_RGB 3\n\n typedef struct _SUNInfo\n {\n unsigned int\n magic,\n width,\n height,\n depth,\n length,\n type,\n maptype,\n maplength;\n } SUNInfo;\n\n Image\n *image;\n\n int\n bit;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n register Quantum\n *q;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *p;\n\n size_t\n bytes_per_line,\n extent,\n height,\n length;\n\n ssize_t\n count,\n y;\n\n SUNInfo\n sun_info;\n\n unsigned char\n *sun_data,\n *sun_pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read SUN raster header.\n */\n (void) ResetMagickMemory(&sun_info,0,sizeof(sun_info));\n sun_info.magic=ReadBlobMSBLong(image);\n do\n {\n /*\n Verify SUN identifier.\n */\n if (sun_info.magic != 0x59a66a95)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n sun_info.width=ReadBlobMSBLong(image);\n sun_info.height=ReadBlobMSBLong(image);\n sun_info.depth=ReadBlobMSBLong(image);\n sun_info.length=ReadBlobMSBLong(image);\n sun_info.type=ReadBlobMSBLong(image);\n sun_info.maptype=ReadBlobMSBLong(image);\n sun_info.maplength=ReadBlobMSBLong(image);\n extent=sun_info.height*sun_info.width;\n if ((sun_info.height != 0) && (sun_info.width != extent/sun_info.height))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.type != RT_STANDARD) && (sun_info.type != RT_ENCODED) &&\n (sun_info.type != RT_FORMAT_RGB))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.maptype == RMT_NONE) && (sun_info.maplength != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.depth == 0) || (sun_info.depth > 32))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.maptype != RMT_NONE) && (sun_info.maptype != RMT_EQUAL_RGB) &&\n (sun_info.maptype != RMT_RAW))\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n image->columns=sun_info.width;\n image->rows=sun_info.height;\n image->depth=sun_info.depth <= 8 ? sun_info.depth :\n MAGICKCORE_QUANTUM_DEPTH;\n if (sun_info.depth < 24)\n {\n size_t\n one;\n\n image->colors=sun_info.maplength;\n one=1;\n if (sun_info.maptype == RMT_NONE)\n image->colors=one << sun_info.depth;\n if (sun_info.maptype == RMT_EQUAL_RGB)\n image->colors=sun_info.maplength/3;\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n switch (sun_info.maptype)\n {\n case RMT_NONE:\n break;\n case RMT_EQUAL_RGB:\n {\n unsigned char\n *sun_colormap;\n\n /*\n Read SUN raster colormap.\n */\n sun_colormap=(unsigned char *) AcquireQuantumMemory(image->colors,\n sizeof(*sun_colormap));\n if (sun_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].red=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].green=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].blue=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap);\n break;\n }\n case RMT_RAW:\n {\n unsigned char\n *sun_colormap;\n\n /*\n Read SUN raster colormap.\n */\n sun_colormap=(unsigned char *) AcquireQuantumMemory(sun_info.maplength,\n sizeof(*sun_colormap));\n if (sun_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,sun_info.maplength,sun_colormap);\n if (count != (ssize_t) sun_info.maplength)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap);\n break;\n }\n default:\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n }\n image->alpha_trait=sun_info.depth == 32 ? BlendPixelTrait :\n UndefinedPixelTrait;\n image->columns=sun_info.width;\n image->rows=sun_info.height;\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n if ((sun_info.length*sizeof(*sun_data))/sizeof(*sun_data) !=\n sun_info.length || !sun_info.length)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n number_pixels=(MagickSizeType) image->columns*image->rows;\n if ((sun_info.type != RT_ENCODED) && \n ((number_pixels*sun_info.depth) > (8*sun_info.length)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n bytes_per_line=sun_info.width*sun_info.depth;\n sun_data=(unsigned char *) AcquireQuantumMemory((size_t) MagickMax(\n sun_info.length,bytes_per_line*sun_info.width),sizeof(*sun_data));\n if (sun_data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=(ssize_t) ReadBlob(image,sun_info.length,sun_data);\n if (count != (ssize_t) sun_info.length)\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n height=sun_info.height;\n if ((height == 0) || (sun_info.width == 0) || (sun_info.depth == 0) ||\n ((bytes_per_line/sun_info.depth) != sun_info.width))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n bytes_per_line+=15;\n bytes_per_line<<=1;\n if ((bytes_per_line >> 1) != (sun_info.width*sun_info.depth+15))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n bytes_per_line>>=4;\n sun_pixels=(unsigned char *) AcquireQuantumMemory(height,\n bytes_per_line*sizeof(*sun_pixels));\n if (sun_pixels == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (sun_info.type == RT_ENCODED)\n (void) DecodeImage(sun_data,sun_info.length,sun_pixels,bytes_per_line*\n height);\n sun_data=(unsigned char *) RelinquishMagickMemory(sun_data);\n /*\n Convert SUN raster image to pixel packets.\n */\n p=sun_pixels;\n if (sun_info.depth == 1)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < ((ssize_t) image->columns-7); x+=8)\n {\n for (bit=7; bit >= 0; bit--)\n {\n SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 : 0x01),\n q);\n q+=GetPixelChannels(image);\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=7; bit >= (int) (8-(image->columns % 8)); bit--)\n {\n SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 :\n 0x01),q);\n q+=GetPixelChannels(image);\n }\n p++;\n }\n if ((((image->columns/8)+(image->columns % 8 ? 1 : 0)) % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n else\n if (image->storage_class == PseudoClass)\n {\n if (bytes_per_line == 0)\n bytes_per_line=image->columns;\n length=image->rows*(image->columns+image->columns % 2);\n if (((sun_info.type == RT_ENCODED) &&\n (length > (bytes_per_line*image->rows))) ||\n ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p++,q);\n q+=GetPixelChannels(image);\n }\n if ((image->columns % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n size_t\n bytes_per_pixel;\n\n bytes_per_pixel=3;\n if (image->alpha_trait != UndefinedPixelTrait)\n bytes_per_pixel++;\n if (bytes_per_line == 0)\n bytes_per_line=bytes_per_pixel*image->columns;\n length=image->rows*(bytes_per_line+bytes_per_line % 2);\n if (((sun_info.type == RT_ENCODED) &&\n (length > (bytes_per_line*image->rows))) ||\n ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n if (sun_info.type == RT_STANDARD)\n {\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n }\n else\n {\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n }\n if (image->colors != 0)\n {\n SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelRed(image,q)].red),q);\n SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelGreen(image,q)].green),q);\n SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelBlue(image,q)].blue),q);\n }\n q+=GetPixelChannels(image);\n }\n if (((bytes_per_pixel*image->columns) % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n if (image->storage_class == PseudoClass)\n (void) SyncImage(image,exception);\n sun_pixels=(unsigned char *) RelinquishMagickMemory(sun_pixels);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n sun_info.magic=ReadBlobMSBLong(image);\n if (sun_info.magic == 0x59a66a95)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while (sun_info.magic == 0x59a66a95);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n#define RMT_EQUAL_RGB 1\n#define RMT_NONE 0\n#define RMT_RAW 2\n#define RT_STANDARD 1\n#define RT_ENCODED 2\n#define RT_FORMAT_RGB 3\n\n typedef struct _SUNInfo\n {\n unsigned int\n magic,\n width,\n height,\n depth,\n length,\n type,\n maptype,\n maplength;\n } SUNInfo;\n\n Image\n *image;\n\n int\n bit;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n register Quantum\n *q;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *p;\n\n size_t\n bytes_per_line,\n extent,\n height,\n length;\n\n ssize_t\n count,\n y;\n\n SUNInfo\n sun_info;\n\n unsigned char\n *sun_data,\n *sun_pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read SUN raster header.\n */\n (void) ResetMagickMemory(&sun_info,0,sizeof(sun_info));\n sun_info.magic=ReadBlobMSBLong(image);\n do\n {\n /*\n Verify SUN identifier.\n */\n if (sun_info.magic != 0x59a66a95)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n sun_info.width=ReadBlobMSBLong(image);\n sun_info.height=ReadBlobMSBLong(image);\n sun_info.depth=ReadBlobMSBLong(image);\n sun_info.length=ReadBlobMSBLong(image);\n sun_info.type=ReadBlobMSBLong(image);\n sun_info.maptype=ReadBlobMSBLong(image);\n sun_info.maplength=ReadBlobMSBLong(image);\n extent=sun_info.height*sun_info.width;\n if ((sun_info.height != 0) && (sun_info.width != extent/sun_info.height))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.type != RT_STANDARD) && (sun_info.type != RT_ENCODED) &&\n (sun_info.type != RT_FORMAT_RGB))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.maptype == RMT_NONE) && (sun_info.maplength != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.depth == 0) || (sun_info.depth > 32))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((sun_info.maptype != RMT_NONE) && (sun_info.maptype != RMT_EQUAL_RGB) &&\n (sun_info.maptype != RMT_RAW))\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n image->columns=sun_info.width;\n image->rows=sun_info.height;\n image->depth=sun_info.depth <= 8 ? sun_info.depth :\n MAGICKCORE_QUANTUM_DEPTH;\n if (sun_info.depth < 24)\n {\n size_t\n one;\n\n image->colors=sun_info.maplength;\n one=1;\n if (sun_info.maptype == RMT_NONE)\n image->colors=one << sun_info.depth;\n if (sun_info.maptype == RMT_EQUAL_RGB)\n image->colors=sun_info.maplength/3;\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n switch (sun_info.maptype)\n {\n case RMT_NONE:\n break;\n case RMT_EQUAL_RGB:\n {\n unsigned char\n *sun_colormap;\n\n /*\n Read SUN raster colormap.\n */\n sun_colormap=(unsigned char *) AcquireQuantumMemory(image->colors,\n sizeof(*sun_colormap));\n if (sun_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].red=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].green=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n count=ReadBlob(image,image->colors,sun_colormap);\n if (count != (ssize_t) image->colors)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].blue=(MagickRealType) ScaleCharToQuantum(\n sun_colormap[i]);\n sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap);\n break;\n }\n case RMT_RAW:\n {\n unsigned char\n *sun_colormap;\n\n /*\n Read SUN raster colormap.\n */\n sun_colormap=(unsigned char *) AcquireQuantumMemory(sun_info.maplength,\n sizeof(*sun_colormap));\n if (sun_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,sun_info.maplength,sun_colormap);\n if (count != (ssize_t) sun_info.maplength)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n sun_colormap=(unsigned char *) RelinquishMagickMemory(sun_colormap);\n break;\n }\n default:\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n }\n image->alpha_trait=sun_info.depth == 32 ? BlendPixelTrait :\n UndefinedPixelTrait;\n image->columns=sun_info.width;\n image->rows=sun_info.height;\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n if ((sun_info.length*sizeof(*sun_data))/sizeof(*sun_data) !=\n sun_info.length || !sun_info.length)\n ThrowReaderException(ResourceLimitError,\"ImproperImageHeader\");\n number_pixels=(MagickSizeType) image->columns*image->rows;\n if ((sun_info.type != RT_ENCODED) && \n ((number_pixels*sun_info.depth) > (8*sun_info.length)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n bytes_per_line=sun_info.width*sun_info.depth;\n sun_data=(unsigned char *) AcquireQuantumMemory((size_t) MagickMax(\n sun_info.length,bytes_per_line*sun_info.width),sizeof(*sun_data));\n if (sun_data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=(ssize_t) ReadBlob(image,sun_info.length,sun_data);\n if (count != (ssize_t) sun_info.length)\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n height=sun_info.height;\n if ((height == 0) || (sun_info.width == 0) || (sun_info.depth == 0) ||\n ((bytes_per_line/sun_info.depth) != sun_info.width))\n ThrowReaderException(ResourceLimitError,\"ImproperImageHeader\");\n bytes_per_line+=15;\n bytes_per_line<<=1;\n if ((bytes_per_line >> 1) != (sun_info.width*sun_info.depth+15))\n ThrowReaderException(ResourceLimitError,\"ImproperImageHeader\");\n bytes_per_line>>=4;\n sun_pixels=(unsigned char *) AcquireQuantumMemory(height,\n bytes_per_line*sizeof(*sun_pixels));\n if (sun_pixels == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (sun_info.type == RT_ENCODED)\n (void) DecodeImage(sun_data,sun_info.length,sun_pixels,bytes_per_line*\n height);\n else\n {\n if (sun_info.length > (height*bytes_per_line))\n ThrowReaderException(ResourceLimitError,\"ImproperImageHeader\");\n (void) CopyMagickMemory(sun_pixels,sun_data,sun_info.length);\n }\n sun_data=(unsigned char *) RelinquishMagickMemory(sun_data);\n /*\n Convert SUN raster image to pixel packets.\n */\n p=sun_pixels;\n if (sun_info.depth == 1)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < ((ssize_t) image->columns-7); x+=8)\n {\n for (bit=7; bit >= 0; bit--)\n {\n SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 : 0x01),\n q);\n q+=GetPixelChannels(image);\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=7; bit >= (int) (8-(image->columns % 8)); bit--)\n {\n SetPixelIndex(image,(Quantum) ((*p) & (0x01 << bit) ? 0x00 :\n 0x01),q);\n q+=GetPixelChannels(image);\n }\n p++;\n }\n if ((((image->columns/8)+(image->columns % 8 ? 1 : 0)) % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n else\n if (image->storage_class == PseudoClass)\n {\n if (bytes_per_line == 0)\n bytes_per_line=image->columns;\n length=image->rows*(image->columns+image->columns % 2);\n if (((sun_info.type == RT_ENCODED) &&\n (length > (bytes_per_line*image->rows))) ||\n ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p++,q);\n q+=GetPixelChannels(image);\n }\n if ((image->columns % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n size_t\n bytes_per_pixel;\n\n bytes_per_pixel=3;\n if (image->alpha_trait != UndefinedPixelTrait)\n bytes_per_pixel++;\n if (bytes_per_line == 0)\n bytes_per_line=bytes_per_pixel*image->columns;\n length=image->rows*(bytes_per_line+bytes_per_line % 2);\n if (((sun_info.type == RT_ENCODED) &&\n (length > (bytes_per_line*image->rows))) ||\n ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n if (sun_info.type == RT_STANDARD)\n {\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n }\n else\n {\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n }\n if (image->colors != 0)\n {\n SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelRed(image,q)].red),q);\n SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelGreen(image,q)].green),q);\n SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t)\n GetPixelBlue(image,q)].blue),q);\n }\n q+=GetPixelChannels(image);\n }\n if (((bytes_per_pixel*image->columns) % 2) != 0)\n p++;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n if (image->storage_class == PseudoClass)\n (void) SyncImage(image,exception);\n sun_pixels=(unsigned char *) RelinquishMagickMemory(sun_pixels);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n sun_info.magic=ReadBlobMSBLong(image);\n if (sun_info.magic == 0x59a66a95)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while (sun_info.magic == 0x59a66a95);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ReadSUNImage","file_name":"coders/sun.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/6b4aff0f117b978502ee5bcd6e753c17aec5a961","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#20-94262fe7e257","input":" */\nstatic void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)\n{\n\tst_entry ent;\n\twddx_stack *stack = (wddx_stack *)user_data;\n\n\tif (!strcmp(name, EL_PACKET)) {\n\t\tint i;\n\n\t\tif (atts) for (i=0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_VERSION)) {\n\t\t\t\t/* nothing for now */\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_STRING)) {\n\t\tent.type = ST_STRING;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_STRING;\n\t\tZ_STRVAL_P(ent.data) = STR_EMPTY_ALLOC();\n\t\tZ_STRLEN_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_BINARY)) {\n\t\tent.type = ST_BINARY;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_STRING;\n\t\tZ_STRVAL_P(ent.data) = STR_EMPTY_ALLOC();\n\t\tZ_STRLEN_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_CHAR)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_CHAR_CODE) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tchar tmp_buf[2];\n\n\t\t\t\tsnprintf(tmp_buf, sizeof(tmp_buf), \"%c\", (char)strtol(atts[i+1], NULL, 16));\n\t\t\t\tphp_wddx_process_data(user_data, tmp_buf, strlen(tmp_buf));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_NUMBER)) {\n\t\tent.type = ST_NUMBER;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_LONG;\n\t\tZ_LVAL_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_BOOLEAN)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_VALUE) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tent.type = ST_BOOLEAN;\n\t\t\t\tSET_STACK_VARNAME;\n\n\t\t\t\tALLOC_ZVAL(ent.data);\n\t\t\t\tINIT_PZVAL(ent.data);\n\t\t\t\tZ_TYPE_P(ent.data) = IS_BOOL;\n\t\t\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t\t\t\tphp_wddx_process_data(user_data, atts[i+1], strlen(atts[i+1]));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_NULL)) {\n\t\tent.type = ST_NULL;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZVAL_NULL(ent.data);\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_ARRAY)) {\n\t\tent.type = ST_ARRAY;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_STRUCT)) {\n\t\tent.type = ST_STRUCT;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_VAR)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_NAME) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tif (stack->varname) efree(stack->varname);\n\t\t\t\tstack->varname = estrdup(atts[i+1]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_RECORDSET)) {\n\t\tint i;\n\n\t\tent.type = ST_RECORDSET;\n\t\tSET_STACK_VARNAME;\n\t\tMAKE_STD_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], \"fieldNames\") && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tzval *tmp;\n\t\t\t\tchar *key;\n\t\t\t\tchar *p1, *p2, *endp;\n\n\t\t\t\ti++;\n\t\t\t\tendp = (char *)atts[i] + strlen(atts[i]);\n\t\t\t\tp1 = (char *)atts[i];\n\t\t\t\twhile ((p2 = php_memnstr(p1, \",\", sizeof(\",\")-1, endp)) != NULL) {\n\t\t\t\t\tkey = estrndup(p1, p2 - p1);\n\t\t\t\t\tMAKE_STD_ZVAL(tmp);\n\t\t\t\t\tarray_init(tmp);\n\t\t\t\t\tadd_assoc_zval_ex(ent.data, key, p2 - p1 + 1, tmp);\n\t\t\t\t\tp1 = p2 + sizeof(\",\")-1;\n\t\t\t\t\tefree(key);\n\t\t\t\t}\n\n\t\t\t\tif (p1 <= endp) {\n\t\t\t\t\tMAKE_STD_ZVAL(tmp);\n\t\t\t\t\tarray_init(tmp);\n\t\t\t\t\tadd_assoc_zval_ex(ent.data, p1, endp - p1 + 1, tmp);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_FIELD)) {\n\t\tint i;\n\t\tst_entry ent;\n\n\t\tent.type = ST_FIELD;\n\t\tent.varname = NULL;\n\t\tent.data = NULL;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_NAME) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tst_entry *recordset;\n\t\t\t\tzval **field;\n\n\t\t\t\tif (wddx_stack_top(stack, (void**)&recordset) == SUCCESS &&\n\t\t\t\t\trecordset->type == ST_RECORDSET &&\n\t\t\t\t\tzend_hash_find(Z_ARRVAL_P(recordset->data), (char*)atts[i+1], strlen(atts[i+1])+1, (void**)&field) == SUCCESS) {\n\t\t\t\t\tent.data = *field;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_DATETIME)) {\n\t\tent.type = ST_DATETIME;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_LONG;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t}","target":" */\nstatic void php_wddx_push_element(void *user_data, const XML_Char *name, const XML_Char **atts)\n{\n\tst_entry ent;\n\twddx_stack *stack = (wddx_stack *)user_data;\n\n\tif (!strcmp(name, EL_PACKET)) {\n\t\tint i;\n\n\t\tif (atts) for (i=0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_VERSION)) {\n\t\t\t\t/* nothing for now */\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_STRING)) {\n\t\tent.type = ST_STRING;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_STRING;\n\t\tZ_STRVAL_P(ent.data) = STR_EMPTY_ALLOC();\n\t\tZ_STRLEN_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_BINARY)) {\n\t\tent.type = ST_BINARY;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_STRING;\n\t\tZ_STRVAL_P(ent.data) = STR_EMPTY_ALLOC();\n\t\tZ_STRLEN_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_CHAR)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_CHAR_CODE) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tchar tmp_buf[2];\n\n\t\t\t\tsnprintf(tmp_buf, sizeof(tmp_buf), \"%c\", (char)strtol(atts[i+1], NULL, 16));\n\t\t\t\tphp_wddx_process_data(user_data, tmp_buf, strlen(tmp_buf));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_NUMBER)) {\n\t\tent.type = ST_NUMBER;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_LONG;\n\t\tZ_LVAL_P(ent.data) = 0;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_BOOLEAN)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_VALUE) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tent.type = ST_BOOLEAN;\n\t\t\t\tSET_STACK_VARNAME;\n\n\t\t\t\tALLOC_ZVAL(ent.data);\n\t\t\t\tINIT_PZVAL(ent.data);\n\t\t\t\tZ_TYPE_P(ent.data) = IS_BOOL;\n\t\t\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t\t\t\tphp_wddx_process_data(user_data, atts[i+1], strlen(atts[i+1]));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tent.type = ST_BOOLEAN;\n\t\t\tSET_STACK_VARNAME;\n\t\t\tZVAL_FALSE(&ent.data);\n\t\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t\t}\n\t} else if (!strcmp(name, EL_NULL)) {\n\t\tent.type = ST_NULL;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZVAL_NULL(ent.data);\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_ARRAY)) {\n\t\tent.type = ST_ARRAY;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_STRUCT)) {\n\t\tent.type = ST_STRUCT;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_VAR)) {\n\t\tint i;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_NAME) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tif (stack->varname) efree(stack->varname);\n\t\t\t\tstack->varname = estrdup(atts[i+1]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else if (!strcmp(name, EL_RECORDSET)) {\n\t\tint i;\n\n\t\tent.type = ST_RECORDSET;\n\t\tSET_STACK_VARNAME;\n\t\tMAKE_STD_ZVAL(ent.data);\n\t\tarray_init(ent.data);\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], \"fieldNames\") && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tzval *tmp;\n\t\t\t\tchar *key;\n\t\t\t\tchar *p1, *p2, *endp;\n\n\t\t\t\ti++;\n\t\t\t\tendp = (char *)atts[i] + strlen(atts[i]);\n\t\t\t\tp1 = (char *)atts[i];\n\t\t\t\twhile ((p2 = php_memnstr(p1, \",\", sizeof(\",\")-1, endp)) != NULL) {\n\t\t\t\t\tkey = estrndup(p1, p2 - p1);\n\t\t\t\t\tMAKE_STD_ZVAL(tmp);\n\t\t\t\t\tarray_init(tmp);\n\t\t\t\t\tadd_assoc_zval_ex(ent.data, key, p2 - p1 + 1, tmp);\n\t\t\t\t\tp1 = p2 + sizeof(\",\")-1;\n\t\t\t\t\tefree(key);\n\t\t\t\t}\n\n\t\t\t\tif (p1 <= endp) {\n\t\t\t\t\tMAKE_STD_ZVAL(tmp);\n\t\t\t\t\tarray_init(tmp);\n\t\t\t\t\tadd_assoc_zval_ex(ent.data, p1, endp - p1 + 1, tmp);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_FIELD)) {\n\t\tint i;\n\t\tst_entry ent;\n\n\t\tent.type = ST_FIELD;\n\t\tent.varname = NULL;\n\t\tent.data = NULL;\n\n\t\tif (atts) for (i = 0; atts[i]; i++) {\n\t\t\tif (!strcmp(atts[i], EL_NAME) && atts[i+1] && atts[i+1][0]) {\n\t\t\t\tst_entry *recordset;\n\t\t\t\tzval **field;\n\n\t\t\t\tif (wddx_stack_top(stack, (void**)&recordset) == SUCCESS &&\n\t\t\t\t\trecordset->type == ST_RECORDSET &&\n\t\t\t\t\tzend_hash_find(Z_ARRVAL_P(recordset->data), (char*)atts[i+1], strlen(atts[i+1])+1, (void**)&field) == SUCCESS) {\n\t\t\t\t\tent.data = *field;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t} else if (!strcmp(name, EL_DATETIME)) {\n\t\tent.type = ST_DATETIME;\n\t\tSET_STACK_VARNAME;\n\n\t\tALLOC_ZVAL(ent.data);\n\t\tINIT_PZVAL(ent.data);\n\t\tZ_TYPE_P(ent.data) = IS_LONG;\n\t\twddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));\n\t}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"php_wddx_push_element","file_name":"ext/wddx/wddx.c","commit_link":"github.com/php/php-src/commit/66fd44209d5ffcb9b3d1bc1b9fd8e35b485040c0","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#21-40a0bf56b0e3","input":"SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)\n{\n\tstruct smb_rqst rqst;\n\tstruct smb2_negotiate_req *req;\n\tstruct smb2_negotiate_rsp *rsp;\n\tstruct kvec iov[1];\n\tstruct kvec rsp_iov;\n\tint rc = 0;\n\tint resp_buftype;\n\tstruct TCP_Server_Info *server = ses->server;\n\tint blob_offset, blob_length;\n\tchar *security_blob;\n\tint flags = CIFS_NEG_OP;\n\tunsigned int total_len;\n\n\tcifs_dbg(FYI, \"Negotiate protocol\\n\");\n\n\tif (!server) {\n\t\tWARN(1, \"%s: server is NULL!\\n\", __func__);\n\t\treturn -EIO;\n\t}\n\n\trc = smb2_plain_req_init(SMB2_NEGOTIATE, NULL, (void **) &req, &total_len);\n\tif (rc)\n\t\treturn rc;\n\n\treq->sync_hdr.SessionId = 0;\n\n\tmemset(server->preauth_sha_hash, 0, SMB2_PREAUTH_HASH_SIZE);\n\tmemset(ses->preauth_sha_hash, 0, SMB2_PREAUTH_HASH_SIZE);\n\n\tif (strcmp(ses->server->vals->version_string,\n\t\t SMB3ANY_VERSION_STRING) == 0) {\n\t\treq->Dialects[0] = cpu_to_le16(SMB30_PROT_ID);\n\t\treq->Dialects[1] = cpu_to_le16(SMB302_PROT_ID);\n\t\treq->DialectCount = cpu_to_le16(2);\n\t\ttotal_len += 4;\n\t} else if (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0) {\n\t\treq->Dialects[0] = cpu_to_le16(SMB21_PROT_ID);\n\t\treq->Dialects[1] = cpu_to_le16(SMB30_PROT_ID);\n\t\treq->Dialects[2] = cpu_to_le16(SMB302_PROT_ID);\n\t\treq->Dialects[3] = cpu_to_le16(SMB311_PROT_ID);\n\t\treq->DialectCount = cpu_to_le16(4);\n\t\ttotal_len += 8;\n\t} else {\n\t\t/* otherwise send specific dialect */\n\t\treq->Dialects[0] = cpu_to_le16(ses->server->vals->protocol_id);\n\t\treq->DialectCount = cpu_to_le16(1);\n\t\ttotal_len += 2;\n\t}\n\n\t/* only one of SMB2 signing flags may be set in SMB2 request */\n\tif (ses->sign)\n\t\treq->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_REQUIRED);\n\telse if (global_secflags & CIFSSEC_MAY_SIGN)\n\t\treq->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_ENABLED);\n\telse\n\t\treq->SecurityMode = 0;\n\n\treq->Capabilities = cpu_to_le32(ses->server->vals->req_capabilities);\n\n\t/* ClientGUID must be zero for SMB2.02 dialect */\n\tif (ses->server->vals->protocol_id == SMB20_PROT_ID)\n\t\tmemset(req->ClientGUID, 0, SMB2_CLIENT_GUID_SIZE);\n\telse {\n\t\tmemcpy(req->ClientGUID, server->client_guid,\n\t\t\tSMB2_CLIENT_GUID_SIZE);\n\t\tif ((ses->server->vals->protocol_id == SMB311_PROT_ID) ||\n\t\t (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0))\n\t\t\tassemble_neg_contexts(req, &total_len);\n\t}\n\tiov[0].iov_base = (char *)req;\n\tiov[0].iov_len = total_len;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = 1;\n\n\trc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);\n\tcifs_small_buf_release(req);\n\trsp = (struct smb2_negotiate_rsp *)rsp_iov.iov_base;\n\t/*\n\t * No tcon so can't do\n\t * cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);\n\t */\n\tif (rc == -EOPNOTSUPP) {\n\t\tcifs_dbg(VFS, \"Dialect not supported by server. Consider \"\n\t\t\t\"specifying vers=1.0 or vers=2.0 on mount for accessing\"\n\t\t\t\" older servers\\n\");\n\t\tgoto neg_exit;\n\t} else if (rc != 0)\n\t\tgoto neg_exit;\n\n\tif (strcmp(ses->server->vals->version_string,\n\t\t SMB3ANY_VERSION_STRING) == 0) {\n\t\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2.1 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t}\n\t} else if (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0) {\n\t\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) {\n\t\t\t/* ops set to 3.0 by default for default so update */\n\t\t\tses->server->ops = &smb21_operations;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID))\n\t\t\tses->server->ops = &smb311_operations;\n\t} else if (le16_to_cpu(rsp->DialectRevision) !=\n\t\t\t\tses->server->vals->protocol_id) {\n\t\t/* if requested single dialect ensure returned dialect matched */\n\t\tcifs_dbg(VFS, \"Illegal 0x%x dialect returned: not requested\\n\",\n\t\t\tle16_to_cpu(rsp->DialectRevision));\n\t\treturn -EIO;\n\t}\n\n\tcifs_dbg(FYI, \"mode 0x%x\\n\", rsp->SecurityMode);\n\n\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb2.0 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb2.1 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB30_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.0 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB302_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.02 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.1.1 dialect\\n\");\n\telse {\n\t\tcifs_dbg(VFS, \"Illegal dialect returned by server 0x%x\\n\",\n\t\t\t le16_to_cpu(rsp->DialectRevision));\n\t\trc = -EIO;\n\t\tgoto neg_exit;\n\t}\n\tserver->dialect = le16_to_cpu(rsp->DialectRevision);\n\n\t/*\n\t * Keep a copy of the hash after negprot. This hash will be\n\t * the starting hash value for all sessions made from this\n\t * server.\n\t */\n\tmemcpy(server->preauth_sha_hash, ses->preauth_sha_hash,\n\t SMB2_PREAUTH_HASH_SIZE);\n\n\t/* SMB2 only has an extended negflavor */\n\tserver->negflavor = CIFS_NEGFLAVOR_EXTENDED;\n\t/* set it to the maximum buffer size value we can send with 1 credit */\n\tserver->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),\n\t\t\t SMB2_MAX_BUFFER_SIZE);\n\tserver->max_read = le32_to_cpu(rsp->MaxReadSize);\n\tserver->max_write = le32_to_cpu(rsp->MaxWriteSize);\n\tserver->sec_mode = le16_to_cpu(rsp->SecurityMode);\n\tif ((server->sec_mode & SMB2_SEC_MODE_FLAGS_ALL) != server->sec_mode)\n\t\tcifs_dbg(FYI, \"Server returned unexpected security mode 0x%x\\n\",\n\t\t\t\tserver->sec_mode);\n\tserver->capabilities = le32_to_cpu(rsp->Capabilities);\n\t/* Internal types */\n\tserver->capabilities |= SMB2_NT_FIND | SMB2_LARGE_FILES;\n\n\tsecurity_blob = smb2_get_data_area_len(&blob_offset, &blob_length,\n\t\t\t\t\t (struct smb2_sync_hdr *)rsp);\n\t/*\n\t * See MS-SMB2 section 2.2.4: if no blob, client picks default which\n\t * for us will be\n\t *\tses->sectype = RawNTLMSSP;\n\t * but for time being this is our only auth choice so doesn't matter.\n\t * We just found a server which sets blob length to zero expecting raw.\n\t */\n\tif (blob_length == 0) {\n\t\tcifs_dbg(FYI, \"missing security blob on negprot\\n\");\n\t\tserver->sec_ntlmssp = true;\n\t}\n\n\trc = cifs_enable_signing(server, ses->sign);\n\tif (rc)\n\t\tgoto neg_exit;\n\tif (blob_length) {\n\t\trc = decode_negTokenInit(security_blob, blob_length, server);\n\t\tif (rc == 1)\n\t\t\trc = 0;\n\t\telse if (rc == 0)\n\t\t\trc = -EIO;\n\t}\n\n\tif (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) {\n\t\tif (rsp->NegotiateContextCount)\n\t\t\trc = smb311_decode_neg_context(rsp, server,\n\t\t\t\t\t\t rsp_iov.iov_len);\n\t\telse\n\t\t\tcifs_dbg(VFS, \"Missing expected negotiate contexts\\n\");\n\t}\nneg_exit:\n\tfree_rsp_buf(resp_buftype, rsp);\n\treturn rc;\n}","target":"SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)\n{\n\tstruct smb_rqst rqst;\n\tstruct smb2_negotiate_req *req;\n\tstruct smb2_negotiate_rsp *rsp;\n\tstruct kvec iov[1];\n\tstruct kvec rsp_iov;\n\tint rc = 0;\n\tint resp_buftype;\n\tstruct TCP_Server_Info *server = ses->server;\n\tint blob_offset, blob_length;\n\tchar *security_blob;\n\tint flags = CIFS_NEG_OP;\n\tunsigned int total_len;\n\n\tcifs_dbg(FYI, \"Negotiate protocol\\n\");\n\n\tif (!server) {\n\t\tWARN(1, \"%s: server is NULL!\\n\", __func__);\n\t\treturn -EIO;\n\t}\n\n\trc = smb2_plain_req_init(SMB2_NEGOTIATE, NULL, (void **) &req, &total_len);\n\tif (rc)\n\t\treturn rc;\n\n\treq->sync_hdr.SessionId = 0;\n\n\tmemset(server->preauth_sha_hash, 0, SMB2_PREAUTH_HASH_SIZE);\n\tmemset(ses->preauth_sha_hash, 0, SMB2_PREAUTH_HASH_SIZE);\n\n\tif (strcmp(ses->server->vals->version_string,\n\t\t SMB3ANY_VERSION_STRING) == 0) {\n\t\treq->Dialects[0] = cpu_to_le16(SMB30_PROT_ID);\n\t\treq->Dialects[1] = cpu_to_le16(SMB302_PROT_ID);\n\t\treq->DialectCount = cpu_to_le16(2);\n\t\ttotal_len += 4;\n\t} else if (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0) {\n\t\treq->Dialects[0] = cpu_to_le16(SMB21_PROT_ID);\n\t\treq->Dialects[1] = cpu_to_le16(SMB30_PROT_ID);\n\t\treq->Dialects[2] = cpu_to_le16(SMB302_PROT_ID);\n\t\treq->Dialects[3] = cpu_to_le16(SMB311_PROT_ID);\n\t\treq->DialectCount = cpu_to_le16(4);\n\t\ttotal_len += 8;\n\t} else {\n\t\t/* otherwise send specific dialect */\n\t\treq->Dialects[0] = cpu_to_le16(ses->server->vals->protocol_id);\n\t\treq->DialectCount = cpu_to_le16(1);\n\t\ttotal_len += 2;\n\t}\n\n\t/* only one of SMB2 signing flags may be set in SMB2 request */\n\tif (ses->sign)\n\t\treq->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_REQUIRED);\n\telse if (global_secflags & CIFSSEC_MAY_SIGN)\n\t\treq->SecurityMode = cpu_to_le16(SMB2_NEGOTIATE_SIGNING_ENABLED);\n\telse\n\t\treq->SecurityMode = 0;\n\n\treq->Capabilities = cpu_to_le32(ses->server->vals->req_capabilities);\n\n\t/* ClientGUID must be zero for SMB2.02 dialect */\n\tif (ses->server->vals->protocol_id == SMB20_PROT_ID)\n\t\tmemset(req->ClientGUID, 0, SMB2_CLIENT_GUID_SIZE);\n\telse {\n\t\tmemcpy(req->ClientGUID, server->client_guid,\n\t\t\tSMB2_CLIENT_GUID_SIZE);\n\t\tif ((ses->server->vals->protocol_id == SMB311_PROT_ID) ||\n\t\t (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0))\n\t\t\tassemble_neg_contexts(req, &total_len);\n\t}\n\tiov[0].iov_base = (char *)req;\n\tiov[0].iov_len = total_len;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = 1;\n\n\trc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);\n\tcifs_small_buf_release(req);\n\trsp = (struct smb2_negotiate_rsp *)rsp_iov.iov_base;\n\t/*\n\t * No tcon so can't do\n\t * cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);\n\t */\n\tif (rc == -EOPNOTSUPP) {\n\t\tcifs_dbg(VFS, \"Dialect not supported by server. Consider \"\n\t\t\t\"specifying vers=1.0 or vers=2.0 on mount for accessing\"\n\t\t\t\" older servers\\n\");\n\t\tgoto neg_exit;\n\t} else if (rc != 0)\n\t\tgoto neg_exit;\n\n\tif (strcmp(ses->server->vals->version_string,\n\t\t SMB3ANY_VERSION_STRING) == 0) {\n\t\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2.1 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t}\n\t} else if (strcmp(ses->server->vals->version_string,\n\t\t SMBDEFAULT_VERSION_STRING) == 0) {\n\t\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID)) {\n\t\t\tcifs_dbg(VFS,\n\t\t\t\t\"SMB2 dialect returned but not requested\\n\");\n\t\t\treturn -EIO;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) {\n\t\t\t/* ops set to 3.0 by default for default so update */\n\t\t\tses->server->ops = &smb21_operations;\n\t\t\tses->server->vals = &smb21_values;\n\t\t} else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) {\n\t\t\tses->server->ops = &smb311_operations;\n\t\t\tses->server->vals = &smb311_values;\n\t\t}\n\t} else if (le16_to_cpu(rsp->DialectRevision) !=\n\t\t\t\tses->server->vals->protocol_id) {\n\t\t/* if requested single dialect ensure returned dialect matched */\n\t\tcifs_dbg(VFS, \"Illegal 0x%x dialect returned: not requested\\n\",\n\t\t\tle16_to_cpu(rsp->DialectRevision));\n\t\treturn -EIO;\n\t}\n\n\tcifs_dbg(FYI, \"mode 0x%x\\n\", rsp->SecurityMode);\n\n\tif (rsp->DialectRevision == cpu_to_le16(SMB20_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb2.0 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb2.1 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB30_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.0 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB302_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.02 dialect\\n\");\n\telse if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID))\n\t\tcifs_dbg(FYI, \"negotiated smb3.1.1 dialect\\n\");\n\telse {\n\t\tcifs_dbg(VFS, \"Illegal dialect returned by server 0x%x\\n\",\n\t\t\t le16_to_cpu(rsp->DialectRevision));\n\t\trc = -EIO;\n\t\tgoto neg_exit;\n\t}\n\tserver->dialect = le16_to_cpu(rsp->DialectRevision);\n\n\t/*\n\t * Keep a copy of the hash after negprot. This hash will be\n\t * the starting hash value for all sessions made from this\n\t * server.\n\t */\n\tmemcpy(server->preauth_sha_hash, ses->preauth_sha_hash,\n\t SMB2_PREAUTH_HASH_SIZE);\n\n\t/* SMB2 only has an extended negflavor */\n\tserver->negflavor = CIFS_NEGFLAVOR_EXTENDED;\n\t/* set it to the maximum buffer size value we can send with 1 credit */\n\tserver->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),\n\t\t\t SMB2_MAX_BUFFER_SIZE);\n\tserver->max_read = le32_to_cpu(rsp->MaxReadSize);\n\tserver->max_write = le32_to_cpu(rsp->MaxWriteSize);\n\tserver->sec_mode = le16_to_cpu(rsp->SecurityMode);\n\tif ((server->sec_mode & SMB2_SEC_MODE_FLAGS_ALL) != server->sec_mode)\n\t\tcifs_dbg(FYI, \"Server returned unexpected security mode 0x%x\\n\",\n\t\t\t\tserver->sec_mode);\n\tserver->capabilities = le32_to_cpu(rsp->Capabilities);\n\t/* Internal types */\n\tserver->capabilities |= SMB2_NT_FIND | SMB2_LARGE_FILES;\n\n\tsecurity_blob = smb2_get_data_area_len(&blob_offset, &blob_length,\n\t\t\t\t\t (struct smb2_sync_hdr *)rsp);\n\t/*\n\t * See MS-SMB2 section 2.2.4: if no blob, client picks default which\n\t * for us will be\n\t *\tses->sectype = RawNTLMSSP;\n\t * but for time being this is our only auth choice so doesn't matter.\n\t * We just found a server which sets blob length to zero expecting raw.\n\t */\n\tif (blob_length == 0) {\n\t\tcifs_dbg(FYI, \"missing security blob on negprot\\n\");\n\t\tserver->sec_ntlmssp = true;\n\t}\n\n\trc = cifs_enable_signing(server, ses->sign);\n\tif (rc)\n\t\tgoto neg_exit;\n\tif (blob_length) {\n\t\trc = decode_negTokenInit(security_blob, blob_length, server);\n\t\tif (rc == 1)\n\t\t\trc = 0;\n\t\telse if (rc == 0)\n\t\t\trc = -EIO;\n\t}\n\n\tif (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) {\n\t\tif (rsp->NegotiateContextCount)\n\t\t\trc = smb311_decode_neg_context(rsp, server,\n\t\t\t\t\t\t rsp_iov.iov_len);\n\t\telse\n\t\t\tcifs_dbg(VFS, \"Missing expected negotiate contexts\\n\");\n\t}\nneg_exit:\n\tfree_rsp_buf(resp_buftype, rsp);\n\treturn rc;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"SMB2_negotiate","file_name":"fs/cifs/smb2pdu.c","commit_link":"github.com/torvalds/linux/commit/b57a55e2200ede754e4dc9cce4ba9402544b9365","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#22-a2da886f1883","input":"static ssize_t parse8BIM(Image *ifile, Image *ofile)\n{\n char\n brkused,\n quoted,\n *line,\n *token,\n *newstr,\n *name;\n\n int\n state,\n next;\n\n unsigned char\n dataset;\n\n unsigned int\n recnum;\n\n int\n inputlen = MaxTextExtent;\n\n MagickOffsetType\n savedpos,\n currentpos;\n\n ssize_t\n savedolen = 0L,\n outputlen = 0L;\n\n TokenInfo\n *token_info;\n\n dataset = 0;\n recnum = 0;\n line = (char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*line));\n if (line == (char *) NULL)\n return(-1);\n newstr = name = token = (char *) NULL;\n savedpos = 0;\n token_info=AcquireTokenInfo();\n while (super_fgets(&line,&inputlen,ifile)!=NULL)\n {\n state=0;\n next=0;\n\n token=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*token));\n if (token == (char *) NULL)\n break;\n newstr=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*newstr));\n if (newstr == (char *) NULL)\n break;\n while (Tokenizer(token_info,0,token,(size_t) inputlen,line,\"\",\"=\",\"\\\"\",0,\n &brkused,&next,"ed)==0)\n {\n if (state == 0)\n {\n int\n state,\n next;\n\n char\n brkused,\n quoted;\n\n state=0;\n next=0;\n while (Tokenizer(token_info,0,newstr,(size_t) inputlen,token,\"\",\"#\",\n \"\", 0,&brkused,&next,"ed)==0)\n {\n switch (state)\n {\n case 0:\n if (strcmp(newstr,\"8BIM\")==0)\n dataset = 255;\n else\n dataset = (unsigned char) StringToLong(newstr);\n break;\n case 1:\n recnum = (unsigned int) StringToUnsignedLong(newstr);\n break;\n case 2:\n name=(char *) AcquireQuantumMemory(strlen(newstr)+MaxTextExtent,\n sizeof(*name));\n if (name)\n (void) strcpy(name,newstr);\n break;\n }\n state++;\n }\n }\n else\n if (state == 1)\n {\n int\n next;\n\n ssize_t\n len;\n\n char\n brkused,\n quoted;\n\n next=0;\n len = (ssize_t) strlen(token);\n while (Tokenizer(token_info,0,newstr,(size_t) inputlen,token,\"\",\"&\",\n \"\",0,&brkused,&next,"ed)==0)\n {\n if (brkused && next > 0)\n {\n char\n *s = &token[next-1];\n\n len -= (ssize_t) convertHTMLcodes(s,(int) strlen(s));\n }\n }\n\n if (dataset == 255)\n {\n unsigned char\n nlen = 0;\n\n int\n i;\n\n if (savedolen > 0)\n {\n MagickOffsetType\n offset;\n\n ssize_t diff = outputlen - savedolen;\n currentpos = TellBlob(ofile);\n if (currentpos < 0)\n return(-1);\n offset=SeekBlob(ofile,savedpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n (void) WriteBlobMSBLong(ofile,(unsigned int) diff);\n offset=SeekBlob(ofile,currentpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n savedolen = 0L;\n }\n if (outputlen & 1)\n {\n (void) WriteBlobByte(ofile,0x00);\n outputlen++;\n }\n (void) WriteBlobString(ofile,\"8BIM\");\n (void) WriteBlobMSBShort(ofile,(unsigned short) recnum);\n outputlen += 6;\n if (name)\n nlen = (unsigned char) strlen(name);\n (void) WriteBlobByte(ofile,nlen);\n outputlen++;\n for (i=0; i 0)\n {\n MagickOffsetType\n offset;\n\n ssize_t diff = outputlen - savedolen;\n\n currentpos = TellBlob(ofile);\n if (currentpos < 0)\n return(-1);\n offset=SeekBlob(ofile,savedpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n (void) WriteBlobMSBLong(ofile,(unsigned int) diff);\n offset=SeekBlob(ofile,currentpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n savedolen = 0L;\n }\n return(outputlen);\n}","target":"static ssize_t parse8BIM(Image *ifile, Image *ofile)\n{\n char\n brkused,\n quoted,\n *line,\n *token,\n *newstr,\n *name;\n\n int\n state,\n next;\n\n unsigned char\n dataset;\n\n unsigned int\n recnum;\n\n int\n inputlen = MaxTextExtent;\n\n MagickOffsetType\n savedpos,\n currentpos;\n\n ssize_t\n savedolen = 0L,\n outputlen = 0L;\n\n TokenInfo\n *token_info;\n\n dataset = 0;\n recnum = 0;\n line = (char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*line));\n if (line == (char *) NULL)\n return(-1);\n newstr = name = token = (char *) NULL;\n savedpos = 0;\n token_info=AcquireTokenInfo();\n while (super_fgets(&line,&inputlen,ifile)!=NULL)\n {\n state=0;\n next=0;\n\n token=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*token));\n if (token == (char *) NULL)\n break;\n newstr=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*newstr));\n if (newstr == (char *) NULL)\n break;\n while (Tokenizer(token_info,0,token,(size_t) inputlen,line,\"\",\"=\",\"\\\"\",0,\n &brkused,&next,"ed)==0)\n {\n if (state == 0)\n {\n int\n state,\n next;\n\n char\n brkused,\n quoted;\n\n state=0;\n next=0;\n while (Tokenizer(token_info,0,newstr,(size_t) inputlen,token,\"\",\"#\",\n \"\", 0,&brkused,&next,"ed)==0)\n {\n switch (state)\n {\n case 0:\n if (strcmp(newstr,\"8BIM\")==0)\n dataset = 255;\n else\n dataset = (unsigned char) StringToLong(newstr);\n break;\n case 1:\n recnum = (unsigned int) StringToUnsignedLong(newstr);\n break;\n case 2:\n name=(char *) AcquireQuantumMemory(strlen(newstr)+MaxTextExtent,\n sizeof(*name));\n if (name)\n (void) strcpy(name,newstr);\n break;\n }\n state++;\n }\n }\n else\n if (state == 1)\n {\n int\n next;\n\n ssize_t\n len;\n\n char\n brkused,\n quoted;\n\n next=0;\n len = (ssize_t) strlen(token);\n while (Tokenizer(token_info,0,newstr,(size_t) inputlen,token,\"\",\"&\",\n \"\",0,&brkused,&next,"ed)==0)\n {\n if (brkused && next > 0)\n {\n char\n *s = &token[next-1];\n\n len -= (ssize_t) convertHTMLcodes(s,(int) strlen(s));\n }\n }\n\n if (dataset == 255)\n {\n unsigned char\n nlen = 0;\n\n int\n i;\n\n if (savedolen > 0)\n {\n MagickOffsetType\n offset;\n\n ssize_t diff = outputlen - savedolen;\n currentpos = TellBlob(ofile);\n if (currentpos < 0)\n return(-1);\n offset=SeekBlob(ofile,savedpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n (void) WriteBlobMSBLong(ofile,(unsigned int) diff);\n offset=SeekBlob(ofile,currentpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n savedolen = 0L;\n }\n if (outputlen & 1)\n {\n (void) WriteBlobByte(ofile,0x00);\n outputlen++;\n }\n (void) WriteBlobString(ofile,\"8BIM\");\n (void) WriteBlobMSBShort(ofile,(unsigned short) recnum);\n outputlen += 6;\n if (name)\n nlen = (unsigned char) strlen(name);\n (void) WriteBlobByte(ofile,nlen);\n outputlen++;\n for (i=0; i 0)\n (void) WriteBlobByte(ofile,(unsigned char) token[next++]);\n\n if (outputlen & 1)\n {\n (void) WriteBlobByte(ofile,0x00);\n outputlen++;\n }\n }\n else\n {\n /* patch in a fake length for now and fix it later */\n savedpos = TellBlob(ofile);\n if (savedpos < 0)\n return(-1);\n (void) WriteBlobMSBLong(ofile,0xFFFFFFFFU);\n outputlen += 4;\n savedolen = outputlen;\n }\n }\n else\n {\n if (len <= 0x7FFF)\n {\n (void) WriteBlobByte(ofile,0x1c);\n (void) WriteBlobByte(ofile,(unsigned char) dataset);\n (void) WriteBlobByte(ofile,(unsigned char) (recnum & 0xff));\n (void) WriteBlobMSBShort(ofile,(unsigned short) len);\n outputlen += 5;\n next=0;\n outputlen += len;\n while (len-- > 0)\n (void) WriteBlobByte(ofile,(unsigned char) token[next++]);\n }\n }\n }\n state++;\n }\n if (token != (char *) NULL)\n token=DestroyString(token);\n if (newstr != (char *) NULL)\n newstr=DestroyString(newstr);\n if (name != (char *) NULL)\n name=DestroyString(name);\n }\n token_info=DestroyTokenInfo(token_info);\n if (token != (char *) NULL)\n token=DestroyString(token);\n if (newstr != (char *) NULL)\n newstr=DestroyString(newstr);\n if (name != (char *) NULL)\n name=DestroyString(name);\n line=DestroyString(line);\n if (savedolen > 0)\n {\n MagickOffsetType\n offset;\n\n ssize_t diff = outputlen - savedolen;\n\n currentpos = TellBlob(ofile);\n if (currentpos < 0)\n return(-1);\n offset=SeekBlob(ofile,savedpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n (void) WriteBlobMSBLong(ofile,(unsigned int) diff);\n offset=SeekBlob(ofile,currentpos,SEEK_SET);\n if (offset < 0)\n return(-1);\n savedolen = 0L;\n }\n return(outputlen);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"parse8BIM","file_name":"coders/meta.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/97c9f438a9b3454d085895f4d1f66389fd22a0fb","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#23-045700336180","input":"int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config)\n{\n int64_t infilesize, total_samples;\n DFFFileHeader dff_file_header;\n DFFChunkHeader dff_chunk_header;\n uint32_t bcount;\n\n infilesize = DoGetFileSize (infile);\n memcpy (&dff_file_header, fourcc, 4);\n\n if ((!DoReadFile (infile, ((char *) &dff_file_header) + 4, sizeof (DFFFileHeader) - 4, &bcount) ||\n bcount != sizeof (DFFFileHeader) - 4) || strncmp (dff_file_header.formType, \"DSD \", 4)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &dff_file_header, sizeof (DFFFileHeader))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n#if 1 // this might be a little too picky...\n WavpackBigEndianToNative (&dff_file_header, DFFFileHeaderFormat);\n\n if (infilesize && !(config->qmode & QMODE_IGNORE_LENGTH) &&\n dff_file_header.ckDataSize && dff_file_header.ckDataSize + 1 && dff_file_header.ckDataSize + 12 != infilesize) {\n error_line (\"%s is not a valid .DFF file (by total size)!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n\n if (debug_logging_mode)\n error_line (\"file header indicated length = %lld\", dff_file_header.ckDataSize);\n\n#endif\n\n // loop through all elements of the DSDIFF header\n // (until the data chuck) and copy them to the output file\n\n while (1) {\n if (!DoReadFile (infile, &dff_chunk_header, sizeof (DFFChunkHeader), &bcount) ||\n bcount != sizeof (DFFChunkHeader)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &dff_chunk_header, sizeof (DFFChunkHeader))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n WavpackBigEndianToNative (&dff_chunk_header, DFFChunkHeaderFormat);\n\n if (debug_logging_mode)\n error_line (\"chunk header indicated length = %lld\", dff_chunk_header.ckDataSize);\n\n if (!strncmp (dff_chunk_header.ckID, \"FVER\", 4)) {\n uint32_t version;\n\n if (dff_chunk_header.ckDataSize != sizeof (version) ||\n !DoReadFile (infile, &version, sizeof (version), &bcount) ||\n bcount != sizeof (version)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &version, sizeof (version))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n WavpackBigEndianToNative (&version, \"L\");\n\n if (debug_logging_mode)\n error_line (\"dsdiff file version = 0x%08x\", version);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"PROP\", 4)) {\n char *prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);\n\n if (!DoReadFile (infile, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize, &bcount) ||\n bcount != dff_chunk_header.ckDataSize) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize)) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n\n if (!strncmp (prop_chunk, \"SND \", 4)) {\n char *cptr = prop_chunk + 4, *eptr = prop_chunk + dff_chunk_header.ckDataSize;\n uint16_t numChannels, chansSpecified, chanMask = 0;\n uint32_t sampleRate;\n\n while (eptr - cptr >= sizeof (dff_chunk_header)) {\n memcpy (&dff_chunk_header, cptr, sizeof (dff_chunk_header));\n cptr += sizeof (dff_chunk_header);\n WavpackBigEndianToNative (&dff_chunk_header, DFFChunkHeaderFormat);\n\n if (eptr - cptr >= dff_chunk_header.ckDataSize) {\n if (!strncmp (dff_chunk_header.ckID, \"FS \", 4) && dff_chunk_header.ckDataSize == 4) {\n memcpy (&sampleRate, cptr, sizeof (sampleRate));\n WavpackBigEndianToNative (&sampleRate, \"L\");\n cptr += dff_chunk_header.ckDataSize;\n\n if (debug_logging_mode)\n error_line (\"got sample rate of %u Hz\", sampleRate);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"CHNL\", 4) && dff_chunk_header.ckDataSize >= 2) {\n memcpy (&numChannels, cptr, sizeof (numChannels));\n WavpackBigEndianToNative (&numChannels, \"S\");\n cptr += sizeof (numChannels);\n\n chansSpecified = (int)(dff_chunk_header.ckDataSize - sizeof (numChannels)) / 4;\n\n while (chansSpecified--) {\n if (!strncmp (cptr, \"SLFT\", 4) || !strncmp (cptr, \"MLFT\", 4))\n chanMask |= 0x1;\n else if (!strncmp (cptr, \"SRGT\", 4) || !strncmp (cptr, \"MRGT\", 4))\n chanMask |= 0x2;\n else if (!strncmp (cptr, \"LS \", 4))\n chanMask |= 0x10;\n else if (!strncmp (cptr, \"RS \", 4))\n chanMask |= 0x20;\n else if (!strncmp (cptr, \"C \", 4))\n chanMask |= 0x4;\n else if (!strncmp (cptr, \"LFE \", 4))\n chanMask |= 0x8;\n else\n if (debug_logging_mode)\n error_line (\"undefined channel ID %c%c%c%c\", cptr [0], cptr [1], cptr [2], cptr [3]);\n\n cptr += 4;\n }\n\n if (debug_logging_mode)\n error_line (\"%d channels, mask = 0x%08x\", numChannels, chanMask);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"CMPR\", 4) && dff_chunk_header.ckDataSize >= 4) {\n if (strncmp (cptr, \"DSD \", 4)) {\n error_line (\"DSDIFF files must be uncompressed, not \\\"%c%c%c%c\\\"!\",\n cptr [0], cptr [1], cptr [2], cptr [3]);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n\n cptr += dff_chunk_header.ckDataSize;\n }\n else {\n if (debug_logging_mode)\n error_line (\"got PROP/SND chunk type \\\"%c%c%c%c\\\" of %d bytes\", dff_chunk_header.ckID [0],\n dff_chunk_header.ckID [1], dff_chunk_header.ckID [2], dff_chunk_header.ckID [3], dff_chunk_header.ckDataSize);\n\n cptr += dff_chunk_header.ckDataSize;\n }\n }\n else {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n }\n\n if (chanMask && (config->channel_mask || (config->qmode & QMODE_CHANS_UNASSIGNED))) {\n error_line (\"this DSDIFF file already has channel order information!\");\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n else if (chanMask)\n config->channel_mask = chanMask;\n\n config->bits_per_sample = 8;\n config->bytes_per_sample = 1;\n config->num_channels = numChannels;\n config->sample_rate = sampleRate / 8;\n config->qmode |= QMODE_DSD_MSB_FIRST;\n }\n else if (debug_logging_mode)\n error_line (\"got unknown PROP chunk type \\\"%c%c%c%c\\\" of %d bytes\",\n prop_chunk [0], prop_chunk [1], prop_chunk [2], prop_chunk [3], dff_chunk_header.ckDataSize);\n\n free (prop_chunk);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"DSD \", 4)) {\n total_samples = dff_chunk_header.ckDataSize / config->num_channels;\n break;\n }\n else { // just copy unknown chunks to output file\n\n int bytes_to_copy = (int)(((dff_chunk_header.ckDataSize) + 1) & ~(int64_t)1);\n char *buff = malloc (bytes_to_copy);\n\n if (debug_logging_mode)\n error_line (\"extra unknown chunk \\\"%c%c%c%c\\\" of %d bytes\",\n dff_chunk_header.ckID [0], dff_chunk_header.ckID [1], dff_chunk_header.ckID [2],\n dff_chunk_header.ckID [3], dff_chunk_header.ckDataSize);\n\n if (!DoReadFile (infile, buff, bytes_to_copy, &bcount) ||\n bcount != bytes_to_copy ||\n (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, buff, bytes_to_copy))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n free (buff);\n return WAVPACK_SOFT_ERROR;\n }\n\n free (buff);\n }\n }\n\n if (debug_logging_mode)\n error_line (\"setting configuration with %lld samples\", total_samples);\n\n if (!WavpackSetConfiguration64 (wpc, config, total_samples, NULL)) {\n error_line (\"%s: %s\", infilename, WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n return WAVPACK_NO_ERROR;\n}","target":"int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config)\n{\n int64_t infilesize, total_samples;\n DFFFileHeader dff_file_header;\n DFFChunkHeader dff_chunk_header;\n uint32_t bcount;\n\n infilesize = DoGetFileSize (infile);\n memcpy (&dff_file_header, fourcc, 4);\n\n if ((!DoReadFile (infile, ((char *) &dff_file_header) + 4, sizeof (DFFFileHeader) - 4, &bcount) ||\n bcount != sizeof (DFFFileHeader) - 4) || strncmp (dff_file_header.formType, \"DSD \", 4)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &dff_file_header, sizeof (DFFFileHeader))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n#if 1 // this might be a little too picky...\n WavpackBigEndianToNative (&dff_file_header, DFFFileHeaderFormat);\n\n if (infilesize && !(config->qmode & QMODE_IGNORE_LENGTH) &&\n dff_file_header.ckDataSize && dff_file_header.ckDataSize + 1 && dff_file_header.ckDataSize + 12 != infilesize) {\n error_line (\"%s is not a valid .DFF file (by total size)!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n\n if (debug_logging_mode)\n error_line (\"file header indicated length = %lld\", dff_file_header.ckDataSize);\n\n#endif\n\n // loop through all elements of the DSDIFF header\n // (until the data chuck) and copy them to the output file\n\n while (1) {\n if (!DoReadFile (infile, &dff_chunk_header, sizeof (DFFChunkHeader), &bcount) ||\n bcount != sizeof (DFFChunkHeader)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &dff_chunk_header, sizeof (DFFChunkHeader))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n WavpackBigEndianToNative (&dff_chunk_header, DFFChunkHeaderFormat);\n\n if (debug_logging_mode)\n error_line (\"chunk header indicated length = %lld\", dff_chunk_header.ckDataSize);\n\n if (!strncmp (dff_chunk_header.ckID, \"FVER\", 4)) {\n uint32_t version;\n\n if (dff_chunk_header.ckDataSize != sizeof (version) ||\n !DoReadFile (infile, &version, sizeof (version), &bcount) ||\n bcount != sizeof (version)) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, &version, sizeof (version))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n WavpackBigEndianToNative (&version, \"L\");\n\n if (debug_logging_mode)\n error_line (\"dsdiff file version = 0x%08x\", version);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"PROP\", 4)) {\n char *prop_chunk;\n\n if (dff_chunk_header.ckDataSize < 4 || dff_chunk_header.ckDataSize > 1024) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n return WAVPACK_SOFT_ERROR;\n }\n\n if (debug_logging_mode)\n error_line (\"got PROP chunk of %d bytes total\", (int) dff_chunk_header.ckDataSize);\n\n prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);\n\n if (!DoReadFile (infile, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize, &bcount) ||\n bcount != dff_chunk_header.ckDataSize) {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize)) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n\n if (!strncmp (prop_chunk, \"SND \", 4)) {\n char *cptr = prop_chunk + 4, *eptr = prop_chunk + dff_chunk_header.ckDataSize;\n uint16_t numChannels, chansSpecified, chanMask = 0;\n uint32_t sampleRate;\n\n while (eptr - cptr >= sizeof (dff_chunk_header)) {\n memcpy (&dff_chunk_header, cptr, sizeof (dff_chunk_header));\n cptr += sizeof (dff_chunk_header);\n WavpackBigEndianToNative (&dff_chunk_header, DFFChunkHeaderFormat);\n\n if (eptr - cptr >= dff_chunk_header.ckDataSize) {\n if (!strncmp (dff_chunk_header.ckID, \"FS \", 4) && dff_chunk_header.ckDataSize == 4) {\n memcpy (&sampleRate, cptr, sizeof (sampleRate));\n WavpackBigEndianToNative (&sampleRate, \"L\");\n cptr += dff_chunk_header.ckDataSize;\n\n if (debug_logging_mode)\n error_line (\"got sample rate of %u Hz\", sampleRate);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"CHNL\", 4) && dff_chunk_header.ckDataSize >= 2) {\n memcpy (&numChannels, cptr, sizeof (numChannels));\n WavpackBigEndianToNative (&numChannels, \"S\");\n cptr += sizeof (numChannels);\n\n chansSpecified = (int)(dff_chunk_header.ckDataSize - sizeof (numChannels)) / 4;\n\n while (chansSpecified--) {\n if (!strncmp (cptr, \"SLFT\", 4) || !strncmp (cptr, \"MLFT\", 4))\n chanMask |= 0x1;\n else if (!strncmp (cptr, \"SRGT\", 4) || !strncmp (cptr, \"MRGT\", 4))\n chanMask |= 0x2;\n else if (!strncmp (cptr, \"LS \", 4))\n chanMask |= 0x10;\n else if (!strncmp (cptr, \"RS \", 4))\n chanMask |= 0x20;\n else if (!strncmp (cptr, \"C \", 4))\n chanMask |= 0x4;\n else if (!strncmp (cptr, \"LFE \", 4))\n chanMask |= 0x8;\n else\n if (debug_logging_mode)\n error_line (\"undefined channel ID %c%c%c%c\", cptr [0], cptr [1], cptr [2], cptr [3]);\n\n cptr += 4;\n }\n\n if (debug_logging_mode)\n error_line (\"%d channels, mask = 0x%08x\", numChannels, chanMask);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"CMPR\", 4) && dff_chunk_header.ckDataSize >= 4) {\n if (strncmp (cptr, \"DSD \", 4)) {\n error_line (\"DSDIFF files must be uncompressed, not \\\"%c%c%c%c\\\"!\",\n cptr [0], cptr [1], cptr [2], cptr [3]);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n\n cptr += dff_chunk_header.ckDataSize;\n }\n else {\n if (debug_logging_mode)\n error_line (\"got PROP/SND chunk type \\\"%c%c%c%c\\\" of %d bytes\", dff_chunk_header.ckID [0],\n dff_chunk_header.ckID [1], dff_chunk_header.ckID [2], dff_chunk_header.ckID [3], dff_chunk_header.ckDataSize);\n\n cptr += dff_chunk_header.ckDataSize;\n }\n }\n else {\n error_line (\"%s is not a valid .DFF file!\", infilename);\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n }\n\n if (chanMask && (config->channel_mask || (config->qmode & QMODE_CHANS_UNASSIGNED))) {\n error_line (\"this DSDIFF file already has channel order information!\");\n free (prop_chunk);\n return WAVPACK_SOFT_ERROR;\n }\n else if (chanMask)\n config->channel_mask = chanMask;\n\n config->bits_per_sample = 8;\n config->bytes_per_sample = 1;\n config->num_channels = numChannels;\n config->sample_rate = sampleRate / 8;\n config->qmode |= QMODE_DSD_MSB_FIRST;\n }\n else if (debug_logging_mode)\n error_line (\"got unknown PROP chunk type \\\"%c%c%c%c\\\" of %d bytes\",\n prop_chunk [0], prop_chunk [1], prop_chunk [2], prop_chunk [3], dff_chunk_header.ckDataSize);\n\n free (prop_chunk);\n }\n else if (!strncmp (dff_chunk_header.ckID, \"DSD \", 4)) {\n total_samples = dff_chunk_header.ckDataSize / config->num_channels;\n break;\n }\n else { // just copy unknown chunks to output file\n\n int bytes_to_copy = (int)(((dff_chunk_header.ckDataSize) + 1) & ~(int64_t)1);\n char *buff = malloc (bytes_to_copy);\n\n if (debug_logging_mode)\n error_line (\"extra unknown chunk \\\"%c%c%c%c\\\" of %d bytes\",\n dff_chunk_header.ckID [0], dff_chunk_header.ckID [1], dff_chunk_header.ckID [2],\n dff_chunk_header.ckID [3], dff_chunk_header.ckDataSize);\n\n if (!DoReadFile (infile, buff, bytes_to_copy, &bcount) ||\n bcount != bytes_to_copy ||\n (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&\n !WavpackAddWrapper (wpc, buff, bytes_to_copy))) {\n error_line (\"%s\", WavpackGetErrorMessage (wpc));\n free (buff);\n return WAVPACK_SOFT_ERROR;\n }\n\n free (buff);\n }\n }\n\n if (debug_logging_mode)\n error_line (\"setting configuration with %lld samples\", total_samples);\n\n if (!WavpackSetConfiguration64 (wpc, config, total_samples, NULL)) {\n error_line (\"%s: %s\", infilename, WavpackGetErrorMessage (wpc));\n return WAVPACK_SOFT_ERROR;\n }\n\n return WAVPACK_NO_ERROR;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ParseDsdiffHeaderConfig","file_name":"cli/dsdiff.c","commit_link":"github.com/dbry/WavPack/commit/36a24c7881427d2e1e4dc1cef58f19eee0d13aec","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#24-bf5a4c19e754","input":"name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {\n\tint name_end = -1;\n\tint j = *idx;\n\tint ptr_count = 0;\n#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)\n#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0)\n#define GET8(x) do { if (j >= length) goto err; x = packet[j++]; } while (0)\n\n\tchar *cp = name_out;\n\tconst char *const end = name_out + name_out_len;\n\n\t/* Normally, names are a series of length prefixed strings terminated */\n\t/* with a length of 0 (the lengths are u8's < 63). */\n\t/* However, the length can start with a pair of 1 bits and that */\n\t/* means that the next 14 bits are a pointer within the current */\n\t/* packet. */\n\n\tfor (;;) {\n\t\tu8 label_len;\n\t\tif (j >= length) return -1;\n\t\tGET8(label_len);\n\t\tif (!label_len) break;\n\t\tif (label_len & 0xc0) {\n\t\t\tu8 ptr_low;\n\t\t\tGET8(ptr_low);\n\t\t\tif (name_end < 0) name_end = j;\n\t\t\tj = (((int)label_len & 0x3f) << 8) + ptr_low;\n\t\t\t/* Make sure that the target offset is in-bounds. */\n\t\t\tif (j < 0 || j >= length) return -1;\n\t\t\t/* If we've jumped more times than there are characters in the\n\t\t\t * message, we must have a loop. */\n\t\t\tif (++ptr_count > length) return -1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (label_len > 63) return -1;\n\t\tif (cp != name_out) {\n\t\t\tif (cp + 1 >= end) return -1;\n\t\t\t*cp++ = '.';\n\t\t}\n\t\tif (cp + label_len >= end) return -1;\n\t\tmemcpy(cp, packet + j, label_len);\n\t\tcp += label_len;\n\t\tj += label_len;\n\t}\n\tif (cp >= end) return -1;\n\t*cp = '\\0';\n\tif (name_end < 0)\n\t\t*idx = j;\n\telse\n\t\t*idx = name_end;\n\treturn 0;\n err:\n\treturn -1;\n}","target":"name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {\n\tint name_end = -1;\n\tint j = *idx;\n\tint ptr_count = 0;\n#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)\n#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0)\n#define GET8(x) do { if (j >= length) goto err; x = packet[j++]; } while (0)\n\n\tchar *cp = name_out;\n\tconst char *const end = name_out + name_out_len;\n\n\t/* Normally, names are a series of length prefixed strings terminated */\n\t/* with a length of 0 (the lengths are u8's < 63). */\n\t/* However, the length can start with a pair of 1 bits and that */\n\t/* means that the next 14 bits are a pointer within the current */\n\t/* packet. */\n\n\tfor (;;) {\n\t\tu8 label_len;\n\t\tGET8(label_len);\n\t\tif (!label_len) break;\n\t\tif (label_len & 0xc0) {\n\t\t\tu8 ptr_low;\n\t\t\tGET8(ptr_low);\n\t\t\tif (name_end < 0) name_end = j;\n\t\t\tj = (((int)label_len & 0x3f) << 8) + ptr_low;\n\t\t\t/* Make sure that the target offset is in-bounds. */\n\t\t\tif (j < 0 || j >= length) return -1;\n\t\t\t/* If we've jumped more times than there are characters in the\n\t\t\t * message, we must have a loop. */\n\t\t\tif (++ptr_count > length) return -1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (label_len > 63) return -1;\n\t\tif (cp != name_out) {\n\t\t\tif (cp + 1 >= end) return -1;\n\t\t\t*cp++ = '.';\n\t\t}\n\t\tif (cp + label_len >= end) return -1;\n\t\tif (j + label_len > length) return -1;\n\t\tmemcpy(cp, packet + j, label_len);\n\t\tcp += label_len;\n\t\tj += label_len;\n\t}\n\tif (cp >= end) return -1;\n\t*cp = '\\0';\n\tif (name_end < 0)\n\t\t*idx = j;\n\telse\n\t\t*idx = name_end;\n\treturn 0;\n err:\n\treturn -1;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"name_parse","file_name":"evdns.c","commit_link":"github.com/libevent/libevent/commit/96f64a022014a208105ead6c8a7066018449d86d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#25-8bc2fe794799","input":"sctp_disposition_t sctp_sf_ootb(struct net *net,\n\t\t\t\tconst struct sctp_endpoint *ep,\n\t\t\t\tconst struct sctp_association *asoc,\n\t\t\t\tconst sctp_subtype_t type,\n\t\t\t\tvoid *arg,\n\t\t\t\tsctp_cmd_seq_t *commands)\n{\n\tstruct sctp_chunk *chunk = arg;\n\tstruct sk_buff *skb = chunk->skb;\n\tsctp_chunkhdr_t *ch;\n\tsctp_errhdr_t *err;\n\t__u8 *ch_end;\n\tint ootb_shut_ack = 0;\n\tint ootb_cookie_ack = 0;\n\n\tSCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES);\n\n\tch = (sctp_chunkhdr_t *) chunk->chunk_hdr;\n\tdo {\n\t\t/* Report violation if the chunk is less then minimal */\n\t\tif (ntohs(ch->length) < sizeof(sctp_chunkhdr_t))\n\t\t\treturn sctp_sf_violation_chunklen(net, ep, asoc, type, arg,\n\t\t\t\t\t\t commands);\n\n\t\t/* Now that we know we at least have a chunk header,\n\t\t * do things that are type appropriate.\n\t\t */\n\t\tif (SCTP_CID_SHUTDOWN_ACK == ch->type)\n\t\t\tootb_shut_ack = 1;\n\n\t\t/* RFC 2960, Section 3.3.7\n\t\t * Moreover, under any circumstances, an endpoint that\n\t\t * receives an ABORT MUST NOT respond to that ABORT by\n\t\t * sending an ABORT of its own.\n\t\t */\n\t\tif (SCTP_CID_ABORT == ch->type)\n\t\t\treturn sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);\n\n\t\t/* RFC 8.4, 7) If the packet contains a \"Stale cookie\" ERROR\n\t\t * or a COOKIE ACK the SCTP Packet should be silently\n\t\t * discarded.\n\t\t */\n\n\t\tif (SCTP_CID_COOKIE_ACK == ch->type)\n\t\t\tootb_cookie_ack = 1;\n\n\t\tif (SCTP_CID_ERROR == ch->type) {\n\t\t\tsctp_walk_errors(err, ch) {\n\t\t\t\tif (SCTP_ERROR_STALE_COOKIE == err->cause) {\n\t\t\t\t\tootb_cookie_ack = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/* Report violation if chunk len overflows */\n\t\tch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));\n\t\tif (ch_end > skb_tail_pointer(skb))\n\t\t\treturn sctp_sf_violation_chunklen(net, ep, asoc, type, arg,\n\t\t\t\t\t\t commands);\n\n\t\tch = (sctp_chunkhdr_t *) ch_end;\n\t} while (ch_end < skb_tail_pointer(skb));\n\n\tif (ootb_shut_ack)\n\t\treturn sctp_sf_shut_8_4_5(net, ep, asoc, type, arg, commands);\n\telse if (ootb_cookie_ack)\n\t\treturn sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);\n\telse\n\t\treturn sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands);\n}","target":"sctp_disposition_t sctp_sf_ootb(struct net *net,\n\t\t\t\tconst struct sctp_endpoint *ep,\n\t\t\t\tconst struct sctp_association *asoc,\n\t\t\t\tconst sctp_subtype_t type,\n\t\t\t\tvoid *arg,\n\t\t\t\tsctp_cmd_seq_t *commands)\n{\n\tstruct sctp_chunk *chunk = arg;\n\tstruct sk_buff *skb = chunk->skb;\n\tsctp_chunkhdr_t *ch;\n\tsctp_errhdr_t *err;\n\t__u8 *ch_end;\n\tint ootb_shut_ack = 0;\n\tint ootb_cookie_ack = 0;\n\n\tSCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES);\n\n\tch = (sctp_chunkhdr_t *) chunk->chunk_hdr;\n\tdo {\n\t\t/* Report violation if the chunk is less then minimal */\n\t\tif (ntohs(ch->length) < sizeof(sctp_chunkhdr_t))\n\t\t\treturn sctp_sf_violation_chunklen(net, ep, asoc, type, arg,\n\t\t\t\t\t\t commands);\n\n\t\t/* Report violation if chunk len overflows */\n\t\tch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));\n\t\tif (ch_end > skb_tail_pointer(skb))\n\t\t\treturn sctp_sf_violation_chunklen(net, ep, asoc, type, arg,\n\t\t\t\t\t\t commands);\n\n\t\t/* Now that we know we at least have a chunk header,\n\t\t * do things that are type appropriate.\n\t\t */\n\t\tif (SCTP_CID_SHUTDOWN_ACK == ch->type)\n\t\t\tootb_shut_ack = 1;\n\n\t\t/* RFC 2960, Section 3.3.7\n\t\t * Moreover, under any circumstances, an endpoint that\n\t\t * receives an ABORT MUST NOT respond to that ABORT by\n\t\t * sending an ABORT of its own.\n\t\t */\n\t\tif (SCTP_CID_ABORT == ch->type)\n\t\t\treturn sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);\n\n\t\t/* RFC 8.4, 7) If the packet contains a \"Stale cookie\" ERROR\n\t\t * or a COOKIE ACK the SCTP Packet should be silently\n\t\t * discarded.\n\t\t */\n\n\t\tif (SCTP_CID_COOKIE_ACK == ch->type)\n\t\t\tootb_cookie_ack = 1;\n\n\t\tif (SCTP_CID_ERROR == ch->type) {\n\t\t\tsctp_walk_errors(err, ch) {\n\t\t\t\tif (SCTP_ERROR_STALE_COOKIE == err->cause) {\n\t\t\t\t\tootb_cookie_ack = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tch = (sctp_chunkhdr_t *) ch_end;\n\t} while (ch_end < skb_tail_pointer(skb));\n\n\tif (ootb_shut_ack)\n\t\treturn sctp_sf_shut_8_4_5(net, ep, asoc, type, arg, commands);\n\telse if (ootb_cookie_ack)\n\t\treturn sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);\n\telse\n\t\treturn sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"sctp_sf_ootb","file_name":"net/sctp/sm_statefuns.c","commit_link":"github.com/torvalds/linux/commit/bf911e985d6bbaa328c20c3e05f4eb03de11fdd6","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#26-bb743c820ecd","input":"PrimitiveStatus TrustedPrimitives::UntrustedCall(uint64_t untrusted_selector,\n MessageWriter *input,\n MessageReader *output) {\n int ret;\n\n UntrustedCacheMalloc *untrusted_cache = UntrustedCacheMalloc::Instance();\n\n SgxParams *const sgx_params =\n reinterpret_cast(untrusted_cache->Malloc(sizeof(SgxParams)));\n Cleanup clean_up(\n [sgx_params, untrusted_cache] { untrusted_cache->Free(sgx_params); });\n sgx_params->input_size = 0;\n sgx_params->input = nullptr;\n if (input) {\n sgx_params->input_size = input->MessageSize();\n if (sgx_params->input_size > 0) {\n // Allocate and copy data to |input_buffer|.\n sgx_params->input = untrusted_cache->Malloc(sgx_params->input_size);\n input->Serialize(const_cast(sgx_params->input));\n }\n }\n sgx_params->output_size = 0;\n sgx_params->output = nullptr;\n CHECK_OCALL(\n ocall_dispatch_untrusted_call(&ret, untrusted_selector, sgx_params));\n if (sgx_params->input) {\n untrusted_cache->Free(const_cast(sgx_params->input));\n }\n if (sgx_params->output) {\n // For the results obtained in |output_buffer|, copy them to |output|\n // before freeing the buffer.\n output->Deserialize(sgx_params->output, sgx_params->output_size);\n TrustedPrimitives::UntrustedLocalFree(sgx_params->output);\n }\n return PrimitiveStatus::OkStatus();\n}","target":"PrimitiveStatus TrustedPrimitives::UntrustedCall(uint64_t untrusted_selector,\n MessageWriter *input,\n MessageReader *output) {\n int ret;\n\n UntrustedCacheMalloc *untrusted_cache = UntrustedCacheMalloc::Instance();\n\n SgxParams *const sgx_params =\n reinterpret_cast(untrusted_cache->Malloc(sizeof(SgxParams)));\n Cleanup clean_up(\n [sgx_params, untrusted_cache] { untrusted_cache->Free(sgx_params); });\n sgx_params->input_size = 0;\n sgx_params->input = nullptr;\n if (input) {\n sgx_params->input_size = input->MessageSize();\n if (sgx_params->input_size > 0) {\n // Allocate and copy data to |input_buffer|.\n sgx_params->input = untrusted_cache->Malloc(sgx_params->input_size);\n input->Serialize(const_cast(sgx_params->input));\n }\n }\n sgx_params->output_size = 0;\n sgx_params->output = nullptr;\n CHECK_OCALL(\n ocall_dispatch_untrusted_call(&ret, untrusted_selector, sgx_params));\n if (sgx_params->input) {\n untrusted_cache->Free(const_cast(sgx_params->input));\n }\n if (!TrustedPrimitives::IsOutsideEnclave(sgx_params->output,\n sgx_params->output_size)) {\n TrustedPrimitives::BestEffortAbort(\n \"UntrustedCall: sgx_param output should be in untrusted memory\");\n }\n if (sgx_params->output) {\n // For the results obtained in |output_buffer|, copy them to |output|\n // before freeing the buffer.\n output->Deserialize(sgx_params->output, sgx_params->output_size);\n TrustedPrimitives::UntrustedLocalFree(sgx_params->output);\n }\n return PrimitiveStatus::OkStatus();\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"asylo::primitives::TrustedPrimitives::UntrustedCall","file_name":"asylo/platform/primitives/sgx/trusted_sgx.cc","commit_link":"github.com/google/asylo/commit/83036fd841d33baa7e039f842d131aa7881fdcc2","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#27-56896183c72d","input":"static int string_scan_range(RList *list, const ut8 *buf, int min,\n\t\t\t const ut64 from, const ut64 to, int type) {\n\tut8 tmp[R_STRING_SCAN_BUFFER_SIZE];\n\tut64 str_start, needle = from;\n\tint count = 0, i, rc, runes;\n\tint str_type = R_STRING_TYPE_DETECT;\n\n\tif (type == -1) {\n\t\ttype = R_STRING_TYPE_DETECT;\n\t}\n\tif (!buf || !min) {\n\t\treturn -1;\n\t}\n\twhile (needle < to) {\n\t\trc = r_utf8_decode (buf + needle, to - needle, NULL);\n\t\tif (!rc) {\n\t\t\tneedle++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (type == R_STRING_TYPE_DETECT) {\n\t\t\tchar *w = (char *)buf + needle + rc;\n\t\t\tif ((to - needle) > 4) {\n\t\t\t\tbool is_wide32 = needle + rc + 2 < to && !w[0] && !w[1] && !w[2] && w[3] && !w[4];\n\t\t\t\tif (is_wide32) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_WIDE32;\n\t\t\t\t} else {\n\t\t\t\t\tbool is_wide = needle + rc + 2 < to && !w[0] && w[1] && !w[2];\n\t\t\t\t\tstr_type = is_wide? R_STRING_TYPE_WIDE: R_STRING_TYPE_ASCII;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr_type = R_STRING_TYPE_ASCII;\n\t\t\t}\n\t\t} else {\n\t\t\tstr_type = type;\n\t\t}\n\n\n\t\trunes = 0;\n\t\tstr_start = needle;\n\n\t\t/* Eat a whole C string */\n\t\tfor (rc = i = 0; i < sizeof (tmp) - 3 && needle < to; i += rc) {\n\t\t\tRRune r = {0};\n\n\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\trc = r_utf32le_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc) {\n\t\t\t\t\trc = 4;\n\t\t\t\t}\n\t\t\t} else if (str_type == R_STRING_TYPE_WIDE) {\n\t\t\t\trc = r_utf16le_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc == 1) {\n\t\t\t\t\trc = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trc = r_utf8_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc > 1) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_UTF8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Invalid sequence detected */\n\t\t\tif (!rc) {\n\t\t\t\tneedle++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tneedle += rc;\n\n\t\t\tif (r_isprint (r)) {\n\t\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\t\tif (r == 0xff) {\n\t\t\t\t\t\tr = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trc = r_utf8_encode (&tmp[i], r);\n\t\t\t\trunes++;\n\t\t\t\t/* Print the escape code */\n\t\t\t} else if (r && r < 0x100 && strchr (\"\\b\\v\\f\\n\\r\\t\\a\\e\", (char)r)) {\n\t\t\t\tif ((i + 32) < sizeof (tmp) && r < 28) {\n\t\t\t\t\ttmp[i + 0] = '\\\\';\n\t\t\t\t\ttmp[i + 1] = \" abtnvfr e\"[r];\n\t\t\t\t} else {\n\t\t\t\t\t// string too long\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\trc = 2;\n\t\t\t\trunes++;\n\t\t\t} else {\n\t\t\t\t/* \\0 marks the end of C-strings */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\ttmp[i++] = '\\0';\n\n\t\tif (runes >= min) {\n\t\t\tif (str_type == R_STRING_TYPE_ASCII) {\n\t\t\t\t// reduce false positives\n\t\t\t\tint j;\n\t\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t\t\tchar ch = tmp[j];\n\t\t\t\t\tif (ch != '\\n' && ch != '\\r' && ch != '\\t') {\n\t\t\t\t\t\tif (!IS_PRINTABLE (tmp[j])) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (list) {\n\t\t\t\tRBinString *new = R_NEW0 (RBinString);\n\t\t\t\tif (!new) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tnew->type = str_type;\n\t\t\t\tnew->length = runes;\n\t\t\t\tnew->size = needle - str_start;\n\t\t\t\tnew->ordinal = count++;\n\t\t\t\t// TODO: move into adjust_offset\n\t\t\t\tswitch (str_type) {\n\t\t\t\tcase R_STRING_TYPE_WIDE:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst ut8 *p = buf + str_start - 2;\n\t\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\t\tstr_start -= 2; // \\xff\\xfe\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase R_STRING_TYPE_WIDE32:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst ut8 *p = buf + str_start - 4;\n\t\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\t\tstr_start -= 4; // \\xff\\xfe\\x00\\x00\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tnew->paddr = new->vaddr = str_start;\n\t\t\t\tnew->string = r_str_ndup ((const char *)tmp, i);\n\t\t\t\tr_list_append (list, new);\n\t\t\t} else {\n\t\t\t\t// DUMP TO STDOUT. raw dumping for rabin2 -zzz\n\t\t\t\tprintf (\"0x%08\" PFMT64x \" %s\\n\", str_start, tmp);\n\t\t\t}\n\t\t}\n\t}\n\treturn count;\n}","target":"static int string_scan_range(RList *list, const ut8 *buf, int min,\n\t\t\t const ut64 from, const ut64 to, int type) {\n\tut8 tmp[R_STRING_SCAN_BUFFER_SIZE];\n\tut64 str_start, needle = from;\n\tint count = 0, i, rc, runes;\n\tint str_type = R_STRING_TYPE_DETECT;\n\n\tif (type == -1) {\n\t\ttype = R_STRING_TYPE_DETECT;\n\t}\n\tif (!buf || !min) {\n\t\treturn -1;\n\t}\n\twhile (needle < to) {\n\t\trc = r_utf8_decode (buf + needle, to - needle, NULL);\n\t\tif (!rc) {\n\t\t\tneedle++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (type == R_STRING_TYPE_DETECT) {\n\t\t\tchar *w = (char *)buf + needle + rc;\n\t\t\tif ((to - needle) > 4) {\n\t\t\t\tbool is_wide32 = needle + rc + 2 < to && !w[0] && !w[1] && !w[2] && w[3] && !w[4];\n\t\t\t\tif (is_wide32) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_WIDE32;\n\t\t\t\t} else {\n\t\t\t\t\tbool is_wide = needle + rc + 2 < to && !w[0] && w[1] && !w[2];\n\t\t\t\t\tstr_type = is_wide? R_STRING_TYPE_WIDE: R_STRING_TYPE_ASCII;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr_type = R_STRING_TYPE_ASCII;\n\t\t\t}\n\t\t} else {\n\t\t\tstr_type = type;\n\t\t}\n\n\n\t\trunes = 0;\n\t\tstr_start = needle;\n\n\t\t/* Eat a whole C string */\n\t\tfor (rc = i = 0; i < sizeof (tmp) - 3 && needle < to; i += rc) {\n\t\t\tRRune r = {0};\n\n\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\trc = r_utf32le_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc) {\n\t\t\t\t\trc = 4;\n\t\t\t\t}\n\t\t\t} else if (str_type == R_STRING_TYPE_WIDE) {\n\t\t\t\trc = r_utf16le_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc == 1) {\n\t\t\t\t\trc = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trc = r_utf8_decode (buf + needle, to - needle, &r);\n\t\t\t\tif (rc > 1) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_UTF8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Invalid sequence detected */\n\t\t\tif (!rc) {\n\t\t\t\tneedle++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tneedle += rc;\n\n\t\t\tif (r_isprint (r)) {\n\t\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\t\tif (r == 0xff) {\n\t\t\t\t\t\tr = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trc = r_utf8_encode (&tmp[i], r);\n\t\t\t\trunes++;\n\t\t\t\t/* Print the escape code */\n\t\t\t} else if (r && r < 0x100 && strchr (\"\\b\\v\\f\\n\\r\\t\\a\\e\", (char)r)) {\n\t\t\t\tif ((i + 32) < sizeof (tmp) && r < 28) {\n\t\t\t\t\ttmp[i + 0] = '\\\\';\n\t\t\t\t\ttmp[i + 1] = \" abtnvfr e\"[r];\n\t\t\t\t} else {\n\t\t\t\t\t// string too long\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\trc = 2;\n\t\t\t\trunes++;\n\t\t\t} else {\n\t\t\t\t/* \\0 marks the end of C-strings */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\ttmp[i++] = '\\0';\n\n\t\tif (runes >= min) {\n\t\t\tif (str_type == R_STRING_TYPE_ASCII) {\n\t\t\t\t// reduce false positives\n\t\t\t\tint j;\n\t\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t\t\tchar ch = tmp[j];\n\t\t\t\t\tif (ch != '\\n' && ch != '\\r' && ch != '\\t') {\n\t\t\t\t\t\tif (!IS_PRINTABLE (tmp[j])) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (list) {\n\t\t\t\tRBinString *new = R_NEW0 (RBinString);\n\t\t\t\tif (!new) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tnew->type = str_type;\n\t\t\t\tnew->length = runes;\n\t\t\t\tnew->size = needle - str_start;\n\t\t\t\tnew->ordinal = count++;\n\t\t\t\t// TODO: move into adjust_offset\n\t\t\t\tswitch (str_type) {\n\t\t\t\tcase R_STRING_TYPE_WIDE:\n\t\t\t\t\tif (str_start > 1) {\n\t\t\t\t\t\tconst ut8 *p = buf + str_start - 2;\n\t\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\t\tstr_start -= 2; // \\xff\\xfe\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase R_STRING_TYPE_WIDE32:\n\t\t\t\t\tif (str_start > 3) {\n\t\t\t\t\t\tconst ut8 *p = buf + str_start - 4;\n\t\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\t\tstr_start -= 4; // \\xff\\xfe\\x00\\x00\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tnew->paddr = new->vaddr = str_start;\n\t\t\t\tnew->string = r_str_ndup ((const char *)tmp, i);\n\t\t\t\tr_list_append (list, new);\n\t\t\t} else {\n\t\t\t\t// DUMP TO STDOUT. raw dumping for rabin2 -zzz\n\t\t\t\tprintf (\"0x%08\" PFMT64x \" %s\\n\", str_start, tmp);\n\t\t\t}\n\t\t}\n\t}\n\treturn count;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"string_scan_range","file_name":"libr/bin/bin.c","commit_link":"github.com/radare/radare2/commit/d31c4d3cbdbe01ea3ded16a584de94149ecd31d9","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#28-5666e5a8bb91","input":"static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image *image, *image2=NULL,\n *rotated_image;\n PixelPacket *q;\n\n unsigned int status;\n MATHeader MATLAB_HDR;\n size_t size;\n size_t CellType;\n QuantumInfo *quantum_info;\n ImageInfo *clone_info;\n int i;\n ssize_t ldblk;\n unsigned char *BImgBuff = NULL;\n double MinVal, MaxVal;\n size_t Unknown6;\n unsigned z, z2;\n unsigned Frames;\n int logging;\n int sample_size;\n MagickOffsetType filepos=0x80;\n BlobInfo *blob;\n size_t one;\n\n unsigned int (*ReadBlobXXXLong)(Image *image);\n unsigned short (*ReadBlobXXXShort)(Image *image);\n void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data);\n void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data);\n\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n logging = LogMagickEvent(CoderEvent,GetMagickModule(),\"enter\");\n\n /*\n Open image file.\n */\n image = AcquireImage(image_info);\n\n status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read MATLAB image.\n */\n clone_info=CloneImageInfo(image_info);\n if(ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n MATLAB_HDR.Version = ReadBlobLSBShort(image);\n if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\" Endian %c%c\",\n MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]);\n if (!strncmp(MATLAB_HDR.EndianIndicator, \"IM\", 2))\n {\n ReadBlobXXXLong = ReadBlobLSBLong;\n ReadBlobXXXShort = ReadBlobLSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesLSB;\n ReadBlobFloatsXXX = ReadBlobFloatsLSB;\n image->endian = LSBEndian;\n }\n else if (!strncmp(MATLAB_HDR.EndianIndicator, \"MI\", 2))\n {\n ReadBlobXXXLong = ReadBlobMSBLong;\n ReadBlobXXXShort = ReadBlobMSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesMSB;\n ReadBlobFloatsXXX = ReadBlobFloatsMSB;\n image->endian = MSBEndian;\n }\n else\n goto MATLAB_KO; /* unsupported endian */\n\n if (strncmp(MATLAB_HDR.identific, \"MATLAB\", 6))\nMATLAB_KO: ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n filepos = TellBlob(image);\n while(!EOFBlob(image)) /* object parser loop */\n {\n Frames = 1;\n (void) SeekBlob(image,filepos,SEEK_SET);\n /* printf(\"pos=%X\\n\",TellBlob(image)); */\n\n MATLAB_HDR.DataType = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n filepos += MATLAB_HDR.ObjectSize + 4 + 4;\n\n image2 = image;\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if(MATLAB_HDR.DataType == miCOMPRESSED)\n {\n image2 = DecompressBlock(image,MATLAB_HDR.ObjectSize,clone_info,exception);\n if(image2==NULL) continue;\n MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */\n }\n#endif\n\n if(MATLAB_HDR.DataType!=miMATRIX) continue; /* skip another objects. */\n\n MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2);\n MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2);\n\n MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2);\n MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF;\n MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF;\n\n MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2);\n if(image!=image2)\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2);\n MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeX = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeY = ReadBlobXXXLong(image2);\n\n\n switch(MATLAB_HDR.DimFlag)\n {\n case 8: z2=z=1; break; /* 2D matrix*/\n case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/\n Unknown6 = ReadBlobXXXLong(image2);\n (void) Unknown6;\n if(z!=3) ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n break;\n case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */\n if(z!=3 && z!=1)\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n Frames = ReadBlobXXXLong(image2);\n break;\n default: ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n }\n\n MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2);\n MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2);\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.StructureClass %d\",MATLAB_HDR.StructureClass);\n if (MATLAB_HDR.StructureClass != mxCHAR_CLASS &&\n MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */\n MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */\n MATLAB_HDR.StructureClass != mxINT8_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */\n MATLAB_HDR.StructureClass != mxINT16_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */\n MATLAB_HDR.StructureClass != mxINT32_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */\n MATLAB_HDR.StructureClass != mxINT64_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */\n ThrowReaderException(CoderError,\"UnsupportedCellTypeInTheMatrix\");\n\n switch (MATLAB_HDR.NameFlag)\n {\n case 0:\n size = ReadBlobXXXLong(image2); /* Object name string size */\n size = 4 * (ssize_t) ((size + 3 + 1) / 4);\n (void) SeekBlob(image2, size, SEEK_CUR);\n break;\n case 1:\n case 2:\n case 3:\n case 4:\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */\n break;\n default:\n goto MATLAB_KO;\n }\n\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.CellType: %.20g\",(double) CellType);\n\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */\n\nNEXT_FRAME:\n switch (CellType)\n {\n case miINT8:\n case miUINT8:\n sample_size = 8;\n if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL)\n image->depth = 1;\n else\n image->depth = 8; /* Byte type cell */\n ldblk = (ssize_t) MATLAB_HDR.SizeX;\n break;\n case miINT16:\n case miUINT16:\n sample_size = 16;\n image->depth = 16; /* Word type cell */\n ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX);\n break;\n case miINT32:\n case miUINT32:\n sample_size = 32;\n image->depth = 32; /* Dword type cell */\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miINT64:\n case miUINT64:\n sample_size = 64;\n image->depth = 64; /* Qword type cell */\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n case miSINGLE:\n sample_size = 32;\n image->depth = 32; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex float type cell */\n }\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miDOUBLE:\n sample_size = 64;\n image->depth = 64; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\nDisableMSCWarning(4127)\n if (sizeof(double) != 8)\nRestoreMSCWarning\n ThrowReaderException(CoderError, \"IncompatibleSizeOfDouble\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex double type cell */\n }\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n default:\n ThrowReaderException(CoderError, \"UnsupportedCellTypeInTheMatrix\");\n }\n (void) sample_size;\n image->columns = MATLAB_HDR.SizeX;\n image->rows = MATLAB_HDR.SizeY;\n quantum_info=AcquireQuantumInfo(clone_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n one=1;\n image->colors = one << image->depth;\n if (image->columns == 0 || image->rows == 0)\n goto MATLAB_KO;\n /* Image is gray when no complex flag is set and 2D Matrix */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n {\n SetImageColorspace(image,GRAYColorspace);\n image->type=GrayscaleType;\n }\n\n\n /*\n If ping is true, then only set image size and colors without\n reading any image data.\n */\n if (image_info->ping)\n {\n size_t temp = image->columns;\n image->columns = image->rows;\n image->rows = temp;\n goto done_reading; /* !!!!!! BAD !!!! */\n }\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n\n /* ----- Load raster data ----- */\n BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */\n if (BImgBuff == NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n MinVal = 0;\n MaxVal = 0;\n if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum);\n }\n\n /* Main loop for reading all scanlines */\n if(z==1) z=0; /* read grey scanlines */\n /* else read color scanlines */\n do\n {\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT set image pixels returns unexpected NULL on a row %u.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto done_reading; /* Skip image rotation, when cannot set image pixels */\n }\n if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT cannot read scanrow %u from a file.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL))\n {\n FixLogical((unsigned char *)BImgBuff,ldblk);\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n {\nImportQuantumPixelsFailed:\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to ImportQuantumPixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n break;\n }\n }\n else\n {\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n goto ImportQuantumPixelsFailed;\n\n\n if (z<=1 && /* fix only during a last pass z==0 || z==1 */\n (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64))\n FixSignedValues(q,MATLAB_HDR.SizeX);\n }\n\n if (!SyncAuthenticPixels(image,exception))\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to sync image pixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n }\n } while(z-- >= 2);\nExitLoop:\n\n\n /* Read complex part of numbers here */\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* Find Min and Max Values for complex parts of floats */\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/\n\n if (CellType==miDOUBLE || CellType==miSINGLE)\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal);\n }\n\n if (CellType==miDOUBLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff);\n InsertComplexDoubleRow((double *)BImgBuff, i, image, MinVal, MaxVal);\n }\n\n if (CellType==miSINGLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff);\n InsertComplexFloatRow((float *)BImgBuff, i, image, MinVal, MaxVal);\n }\n }\n\n /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n image->type=GrayscaleType;\n if (image->depth == 1)\n image->type=BilevelType;\n\n if(image2==image)\n image2 = NULL; /* Remove shadow copy to an image before rotation. */\n\n /* Rotate image. */\n rotated_image = RotateImage(image, 90.0, exception);\n if (rotated_image != (Image *) NULL)\n {\n /* Remove page offsets added by RotateImage */\n rotated_image->page.x=0;\n rotated_image->page.y=0;\n\n blob = rotated_image->blob;\n rotated_image->blob = image->blob;\n rotated_image->colors = image->colors;\n image->blob = blob;\n AppendImageToList(&image,rotated_image);\n DeleteImageFromList(&image);\n }\n\ndone_reading:\n\n if(image2!=NULL)\n if(image2!=image)\n {\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image);\n if (image->next == (Image *) NULL) break;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n\n /* row scan buffer is no longer needed */\n RelinquishMagickMemory(BImgBuff);\n BImgBuff = NULL;\n\n if(--Frames>0)\n {\n z = z2;\n if(image2==NULL) image2 = image;\n goto NEXT_FRAME;\n }\n\n if(image2!=NULL)\n if(image2!=image) /* Does shadow temporary decompressed image exist? */\n {\n/* CloseBlob(image2); */\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) unlink(clone_info->filename);\n }\n }\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n\n RelinquishMagickMemory(BImgBuff);\n CloseBlob(image);\n\n\n {\n Image *p;\n ssize_t scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n\n /*\n Fix scene numbers\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=scene++;\n }\n\n if(clone_info != NULL) /* cleanup garbage file from compression */\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n DestroyImageInfo(clone_info);\n clone_info = NULL;\n }\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\"return\");\n if(image==NULL)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n return (image);\n}","target":"static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image *image, *image2=NULL,\n *rotated_image;\n PixelPacket *q;\n\n unsigned int status;\n MATHeader MATLAB_HDR;\n size_t size;\n size_t CellType;\n QuantumInfo *quantum_info;\n ImageInfo *clone_info;\n int i;\n ssize_t ldblk;\n unsigned char *BImgBuff = NULL;\n double MinVal, MaxVal;\n size_t Unknown6;\n unsigned z, z2;\n unsigned Frames;\n int logging;\n int sample_size;\n MagickOffsetType filepos=0x80;\n BlobInfo *blob;\n size_t one;\n\n unsigned int (*ReadBlobXXXLong)(Image *image);\n unsigned short (*ReadBlobXXXShort)(Image *image);\n void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data);\n void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data);\n\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n logging = LogMagickEvent(CoderEvent,GetMagickModule(),\"enter\");\n\n /*\n Open image file.\n */\n image = AcquireImage(image_info);\n\n status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read MATLAB image.\n */\n clone_info=CloneImageInfo(image_info);\n if(ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n MATLAB_HDR.Version = ReadBlobLSBShort(image);\n if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\" Endian %c%c\",\n MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]);\n if (!strncmp(MATLAB_HDR.EndianIndicator, \"IM\", 2))\n {\n ReadBlobXXXLong = ReadBlobLSBLong;\n ReadBlobXXXShort = ReadBlobLSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesLSB;\n ReadBlobFloatsXXX = ReadBlobFloatsLSB;\n image->endian = LSBEndian;\n }\n else if (!strncmp(MATLAB_HDR.EndianIndicator, \"MI\", 2))\n {\n ReadBlobXXXLong = ReadBlobMSBLong;\n ReadBlobXXXShort = ReadBlobMSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesMSB;\n ReadBlobFloatsXXX = ReadBlobFloatsMSB;\n image->endian = MSBEndian;\n }\n else\n goto MATLAB_KO; /* unsupported endian */\n\n if (strncmp(MATLAB_HDR.identific, \"MATLAB\", 6))\nMATLAB_KO: ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n filepos = TellBlob(image);\n while(!EOFBlob(image)) /* object parser loop */\n {\n Frames = 1;\n (void) SeekBlob(image,filepos,SEEK_SET);\n /* printf(\"pos=%X\\n\",TellBlob(image)); */\n\n MATLAB_HDR.DataType = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n filepos += MATLAB_HDR.ObjectSize + 4 + 4;\n\n image2 = image;\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if(MATLAB_HDR.DataType == miCOMPRESSED)\n {\n image2 = DecompressBlock(image,MATLAB_HDR.ObjectSize,clone_info,exception);\n if(image2==NULL) continue;\n MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */\n }\n#endif\n\n if(MATLAB_HDR.DataType!=miMATRIX) continue; /* skip another objects. */\n\n MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2);\n MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2);\n\n MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2);\n MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF;\n MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF;\n\n MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2);\n if(image!=image2)\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2);\n MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeX = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeY = ReadBlobXXXLong(image2);\n\n\n switch(MATLAB_HDR.DimFlag)\n {\n case 8: z2=z=1; break; /* 2D matrix*/\n case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/\n Unknown6 = ReadBlobXXXLong(image2);\n (void) Unknown6;\n if(z!=3) ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n break;\n case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */\n if(z!=3 && z!=1)\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n Frames = ReadBlobXXXLong(image2);\n break;\n default: ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n }\n\n MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2);\n MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2);\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.StructureClass %d\",MATLAB_HDR.StructureClass);\n if (MATLAB_HDR.StructureClass != mxCHAR_CLASS &&\n MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */\n MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */\n MATLAB_HDR.StructureClass != mxINT8_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */\n MATLAB_HDR.StructureClass != mxINT16_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */\n MATLAB_HDR.StructureClass != mxINT32_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */\n MATLAB_HDR.StructureClass != mxINT64_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */\n ThrowReaderException(CoderError,\"UnsupportedCellTypeInTheMatrix\");\n\n switch (MATLAB_HDR.NameFlag)\n {\n case 0:\n size = ReadBlobXXXLong(image2); /* Object name string size */\n size = 4 * (ssize_t) ((size + 3 + 1) / 4);\n (void) SeekBlob(image2, size, SEEK_CUR);\n break;\n case 1:\n case 2:\n case 3:\n case 4:\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */\n break;\n default:\n goto MATLAB_KO;\n }\n\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.CellType: %.20g\",(double) CellType);\n\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */\n\nNEXT_FRAME:\n switch (CellType)\n {\n case miINT8:\n case miUINT8:\n sample_size = 8;\n if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL)\n image->depth = 1;\n else\n image->depth = 8; /* Byte type cell */\n ldblk = (ssize_t) MATLAB_HDR.SizeX;\n break;\n case miINT16:\n case miUINT16:\n sample_size = 16;\n image->depth = 16; /* Word type cell */\n ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX);\n break;\n case miINT32:\n case miUINT32:\n sample_size = 32;\n image->depth = 32; /* Dword type cell */\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miINT64:\n case miUINT64:\n sample_size = 64;\n image->depth = 64; /* Qword type cell */\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n case miSINGLE:\n sample_size = 32;\n image->depth = 32; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex float type cell */\n }\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miDOUBLE:\n sample_size = 64;\n image->depth = 64; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\nDisableMSCWarning(4127)\n if (sizeof(double) != 8)\nRestoreMSCWarning\n ThrowReaderException(CoderError, \"IncompatibleSizeOfDouble\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex double type cell */\n }\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n default:\n ThrowReaderException(CoderError, \"UnsupportedCellTypeInTheMatrix\");\n }\n (void) sample_size;\n image->columns = MATLAB_HDR.SizeX;\n image->rows = MATLAB_HDR.SizeY;\n quantum_info=AcquireQuantumInfo(clone_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n one=1;\n image->colors = one << image->depth;\n if (image->columns == 0 || image->rows == 0)\n goto MATLAB_KO;\n /* Image is gray when no complex flag is set and 2D Matrix */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n {\n SetImageColorspace(image,GRAYColorspace);\n image->type=GrayscaleType;\n }\n\n\n /*\n If ping is true, then only set image size and colors without\n reading any image data.\n */\n if (image_info->ping)\n {\n size_t temp = image->columns;\n image->columns = image->rows;\n image->rows = temp;\n goto done_reading; /* !!!!!! BAD !!!! */\n }\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n\n /* ----- Load raster data ----- */\n BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */\n if (BImgBuff == NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n MinVal = 0;\n MaxVal = 0;\n if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum);\n }\n\n /* Main loop for reading all scanlines */\n if(z==1) z=0; /* read grey scanlines */\n /* else read color scanlines */\n do\n {\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT set image pixels returns unexpected NULL on a row %u.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto done_reading; /* Skip image rotation, when cannot set image pixels */\n }\n if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT cannot read scanrow %u from a file.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL))\n {\n FixLogical((unsigned char *)BImgBuff,ldblk);\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n {\nImportQuantumPixelsFailed:\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to ImportQuantumPixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n break;\n }\n }\n else\n {\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n goto ImportQuantumPixelsFailed;\n\n\n if (z<=1 && /* fix only during a last pass z==0 || z==1 */\n (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64))\n FixSignedValues(q,MATLAB_HDR.SizeX);\n }\n\n if (!SyncAuthenticPixels(image,exception))\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to sync image pixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n }\n } while(z-- >= 2);\n quantum_info=DestroyQuantumInfo(quantum_info);\nExitLoop:\n\n\n /* Read complex part of numbers here */\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* Find Min and Max Values for complex parts of floats */\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/\n\n if (CellType==miDOUBLE || CellType==miSINGLE)\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal);\n }\n\n if (CellType==miDOUBLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff);\n InsertComplexDoubleRow((double *)BImgBuff, i, image, MinVal, MaxVal);\n }\n\n if (CellType==miSINGLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff);\n InsertComplexFloatRow((float *)BImgBuff, i, image, MinVal, MaxVal);\n }\n }\n\n /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n image->type=GrayscaleType;\n if (image->depth == 1)\n image->type=BilevelType;\n\n if(image2==image)\n image2 = NULL; /* Remove shadow copy to an image before rotation. */\n\n /* Rotate image. */\n rotated_image = RotateImage(image, 90.0, exception);\n if (rotated_image != (Image *) NULL)\n {\n /* Remove page offsets added by RotateImage */\n rotated_image->page.x=0;\n rotated_image->page.y=0;\n\n blob = rotated_image->blob;\n rotated_image->blob = image->blob;\n rotated_image->colors = image->colors;\n image->blob = blob;\n AppendImageToList(&image,rotated_image);\n DeleteImageFromList(&image);\n }\n\ndone_reading:\n\n if(image2!=NULL)\n if(image2!=image)\n {\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image);\n if (image->next == (Image *) NULL) break;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n\n /* row scan buffer is no longer needed */\n RelinquishMagickMemory(BImgBuff);\n BImgBuff = NULL;\n\n if(--Frames>0)\n {\n z = z2;\n if(image2==NULL) image2 = image;\n goto NEXT_FRAME;\n }\n\n if(image2!=NULL)\n if(image2!=image) /* Does shadow temporary decompressed image exist? */\n {\n/* CloseBlob(image2); */\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) unlink(clone_info->filename);\n }\n }\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n\n RelinquishMagickMemory(BImgBuff);\n CloseBlob(image);\n\n\n {\n Image *p;\n ssize_t scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n\n /*\n Fix scene numbers\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=scene++;\n }\n\n if(clone_info != NULL) /* cleanup garbage file from compression */\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n DestroyImageInfo(clone_info);\n clone_info = NULL;\n }\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\"return\");\n if(image==NULL)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n return (image);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ReadMATImage","file_name":"coders/mat.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/b173a352397877775c51c9a0e9d59eb6ce24c455","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#29-45f421d471b1","input":"rdpBitmapCache* bitmap_cache_new(rdpSettings* settings)\n{\n\tint i;\n\trdpBitmapCache* bitmapCache;\n\tbitmapCache = (rdpBitmapCache*)calloc(1, sizeof(rdpBitmapCache));\n\n\tif (!bitmapCache)\n\t\treturn NULL;\n\n\tbitmapCache->settings = settings;\n\tbitmapCache->update = ((freerdp*)settings->instance)->update;\n\tbitmapCache->context = bitmapCache->update->context;\n\tbitmapCache->maxCells = settings->BitmapCacheV2NumCells;\n\tbitmapCache->cells = (BITMAP_V2_CELL*)calloc(bitmapCache->maxCells, sizeof(BITMAP_V2_CELL));\n\n\tif (!bitmapCache->cells)\n\t\tgoto fail;\n\n\tfor (i = 0; i < (int)bitmapCache->maxCells; i++)\n\t{\n\t\tbitmapCache->cells[i].number = settings->BitmapCacheV2CellInfo[i].numEntries;\n\t\t/* allocate an extra entry for BITMAP_CACHE_WAITING_LIST_INDEX */\n\t\tbitmapCache->cells[i].entries =\n\t\t (rdpBitmap**)calloc((bitmapCache->cells[i].number + 1), sizeof(rdpBitmap*));\n\n\t\tif (!bitmapCache->cells[i].entries)\n\t\t\tgoto fail;\n\t}\n\n\treturn bitmapCache;\nfail:\n\n\tif (bitmapCache->cells)\n\t{\n\t\tfor (i = 0; i < (int)bitmapCache->maxCells; i++)\n\t\t\tfree(bitmapCache->cells[i].entries);\n\t}\n\n\tfree(bitmapCache);\n\treturn NULL;\n}","target":"rdpBitmapCache* bitmap_cache_new(rdpSettings* settings)\n{\n\tint i;\n\trdpBitmapCache* bitmapCache;\n\tbitmapCache = (rdpBitmapCache*)calloc(1, sizeof(rdpBitmapCache));\n\n\tif (!bitmapCache)\n\t\treturn NULL;\n\n\tbitmapCache->settings = settings;\n\tbitmapCache->update = ((freerdp*)settings->instance)->update;\n\tbitmapCache->context = bitmapCache->update->context;\n\tbitmapCache->cells =\n\t (BITMAP_V2_CELL*)calloc(settings->BitmapCacheV2NumCells, sizeof(BITMAP_V2_CELL));\n\n\tif (!bitmapCache->cells)\n\t\tgoto fail;\n\tbitmapCache->maxCells = settings->BitmapCacheV2NumCells;\n\n\tfor (i = 0; i < (int)bitmapCache->maxCells; i++)\n\t{\n\t\tbitmapCache->cells[i].number = settings->BitmapCacheV2CellInfo[i].numEntries;\n\t\t/* allocate an extra entry for BITMAP_CACHE_WAITING_LIST_INDEX */\n\t\tbitmapCache->cells[i].entries =\n\t\t (rdpBitmap**)calloc((bitmapCache->cells[i].number + 1), sizeof(rdpBitmap*));\n\n\t\tif (!bitmapCache->cells[i].entries)\n\t\t\tgoto fail;\n\t}\n\n\treturn bitmapCache;\nfail:\n\n\tif (bitmapCache->cells)\n\t{\n\t\tfor (i = 0; i < (int)bitmapCache->maxCells; i++)\n\t\t\tfree(bitmapCache->cells[i].entries);\n\t}\n\n\tfree(bitmapCache);\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"bitmap_cache_new","file_name":"libfreerdp/cache/bitmap.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/58dc36b3c883fd460199cedb6d30e58eba58298c","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#30-d8cc4cd71435","input":"ImagingPcxDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t bytes)\n{\n UINT8 n;\n UINT8* ptr;\n\n if ((state->xsize * state->bits + 7) / 8 > state->bytes) {\n state->errcode = IMAGING_CODEC_OVERRUN;\n return -1;\n }\n\n ptr = buf;\n\n for (;;) {\n\n\tif (bytes < 1)\n\t return ptr - buf;\n\n\tif ((*ptr & 0xC0) == 0xC0) {\n\n\t /* Run */\n\t if (bytes < 2)\n\t\treturn ptr - buf;\n\n\t n = ptr[0] & 0x3F;\n\n\t while (n > 0) {\n\t\tif (state->x >= state->bytes) {\n\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t break;\n\t\t}\n\t\tstate->buffer[state->x++] = ptr[1];\n\t\tn--;\n\t }\n\n\t ptr += 2; bytes -= 2;\n\n\t} else {\n\n\t /* Literal */\n\t state->buffer[state->x++] = ptr[0];\n\t ptr++; bytes--;\n\n\t}\n\n\tif (state->x >= state->bytes) {\n if (state->bytes % state->xsize && state->bytes > state->xsize) {\n int bands = state->bytes / state->xsize;\n int stride = state->bytes / bands;\n int i;\n for (i=1; i< bands; i++) { // note -- skipping first band\n memmove(&state->buffer[i*state->xsize],\n &state->buffer[i*stride],\n state->xsize);\n }\n }\n\t /* Got a full line, unpack it */\n\t state->shuffle((UINT8*) im->image[state->y + state->yoff] +\n\t\t\t state->xoff * im->pixelsize, state->buffer,\n\t\t\t state->xsize);\n\n\t state->x = 0;\n\n\t if (++state->y >= state->ysize) {\n\t\t/* End of file (errcode = 0) */\n\t\treturn -1;\n\t }\n\t}\n\n }\n}","target":"ImagingPcxDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t bytes)\n{\n UINT8 n;\n UINT8* ptr;\n\n if ((state->xsize * state->bits + 7) / 8 > state->bytes) {\n state->errcode = IMAGING_CODEC_OVERRUN;\n return -1;\n }\n\n ptr = buf;\n\n for (;;) {\n\n\tif (bytes < 1)\n\t return ptr - buf;\n\n\tif ((*ptr & 0xC0) == 0xC0) {\n\n\t /* Run */\n\t if (bytes < 2)\n\t\treturn ptr - buf;\n\n\t n = ptr[0] & 0x3F;\n\n\t while (n > 0) {\n\t\tif (state->x >= state->bytes) {\n\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t break;\n\t\t}\n\t\tstate->buffer[state->x++] = ptr[1];\n\t\tn--;\n\t }\n\n\t ptr += 2; bytes -= 2;\n\n\t} else {\n\n\t /* Literal */\n\t state->buffer[state->x++] = ptr[0];\n\t ptr++; bytes--;\n\n\t}\n\n\tif (state->x >= state->bytes) {\n if (state->bytes % state->xsize && state->bytes > state->xsize) {\n int bands = state->bytes / state->xsize;\n int stride = state->bytes / bands;\n int i;\n for (i=1; i< bands; i++) { // note -- skipping first band\n memmove(&state->buffer[i*state->xsize],\n &state->buffer[i*stride],\n state->xsize);\n }\n }\n\t /* Got a full line, unpack it */\n\t state->shuffle((UINT8*) im->image[state->y + state->yoff] +\n\t\t\t state->xoff * im->pixelsize, state->buffer,\n\t\t\t state->xsize);\n\n\t state->x = 0;\n\n\t if (++state->y >= state->ysize) {\n\t\t/* End of file (errcode = 0) */\n\t\treturn -1;\n\t }\n\t}\n\n }\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ImagingPcxDecode","file_name":"src/libImaging/PcxDecode.c","commit_link":"github.com/python-pillow/Pillow/commit/6a83e4324738bb0452fbe8074a995b1c73f08de7#diff-9478f2787e3ae9668a15123b165c23ac","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#31-a6c623fc3d6c","input":"BOOL glyph_cache_put(rdpGlyphCache* glyphCache, UINT32 id, UINT32 index, rdpGlyph* glyph)\n{\n\trdpGlyph* prevGlyph;\n\n\tif (id > 9)\n\t{\n\t\tWLog_ERR(TAG, \"invalid glyph cache id: %\" PRIu32 \"\", id);\n\t\treturn FALSE;\n\t}\n\n\tif (index > glyphCache->glyphCache[id].number)\n\t{\n\t\tWLog_ERR(TAG, \"invalid glyph cache index: %\" PRIu32 \" in cache id: %\" PRIu32 \"\", index, id);\n\t\treturn FALSE;\n\t}\n\n\tWLog_Print(glyphCache->log, WLOG_DEBUG, \"GlyphCachePut: id: %\" PRIu32 \" index: %\" PRIu32 \"\", id,\n\t index);\n\tprevGlyph = glyphCache->glyphCache[id].entries[index];\n\n\tif (prevGlyph)\n\t\tprevGlyph->Free(glyphCache->context, prevGlyph);\n\n\tglyphCache->glyphCache[id].entries[index] = glyph;\n\treturn TRUE;\n}","target":"BOOL glyph_cache_put(rdpGlyphCache* glyphCache, UINT32 id, UINT32 index, rdpGlyph* glyph)\n{\n\trdpGlyph* prevGlyph;\n\n\tif (id > 9)\n\t{\n\t\tWLog_ERR(TAG, \"invalid glyph cache id: %\" PRIu32 \"\", id);\n\t\treturn FALSE;\n\t}\n\n\tif (index >= glyphCache->glyphCache[id].number)\n\t{\n\t\tWLog_ERR(TAG, \"invalid glyph cache index: %\" PRIu32 \" in cache id: %\" PRIu32 \"\", index, id);\n\t\treturn FALSE;\n\t}\n\n\tWLog_Print(glyphCache->log, WLOG_DEBUG, \"GlyphCachePut: id: %\" PRIu32 \" index: %\" PRIu32 \"\", id,\n\t index);\n\tprevGlyph = glyphCache->glyphCache[id].entries[index];\n\n\tif (prevGlyph)\n\t\tprevGlyph->Free(glyphCache->context, prevGlyph);\n\n\tglyphCache->glyphCache[id].entries[index] = glyph;\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"glyph_cache_put","file_name":"libfreerdp/cache/glyph.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/c0fd449ec0870b050d350d6d844b1ea6dad4bc7d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#32-ae3a7812b292","input":"read_Header(struct archive_read *a, struct _7z_header_info *h,\n int check_header_id)\n{\n\tstruct _7zip *zip = (struct _7zip *)a->format->data;\n\tconst unsigned char *p;\n\tstruct _7z_folder *folders;\n\tstruct _7z_stream_info *si = &(zip->si);\n\tstruct _7zip_entry *entries;\n\tuint32_t folderIndex, indexInFolder;\n\tunsigned i;\n\tint eindex, empty_streams, sindex;\n\n\tif (check_header_id) {\n\t\t/*\n\t\t * Read Header.\n\t\t */\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\tif (*p != kHeader)\n\t\t\treturn (-1);\n\t}\n\n\t/*\n\t * Read ArchiveProperties.\n\t */\n\tif ((p = header_bytes(a, 1)) == NULL)\n\t\treturn (-1);\n\tif (*p == kArchiveProperties) {\n\t\tfor (;;) {\n\t\t\tuint64_t size;\n\t\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (*p == 0)\n\t\t\t\tbreak;\n\t\t\tif (parse_7zip_uint64(a, &size) < 0)\n\t\t\t\treturn (-1);\n\t\t}\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t}\n\n\t/*\n\t * Read MainStreamsInfo.\n\t */\n\tif (*p == kMainStreamsInfo) {\n\t\tif (read_StreamsInfo(a, &(zip->si)) < 0)\n\t\t\treturn (-1);\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t}\n\tif (*p == kEnd)\n\t\treturn (0);\n\n\t/*\n\t * Read FilesInfo.\n\t */\n\tif (*p != kFilesInfo)\n\t\treturn (-1);\n\n\tif (parse_7zip_uint64(a, &(zip->numFiles)) < 0)\n\t\treturn (-1);\n\tif (UMAX_ENTRY < zip->numFiles)\n\t\treturn (-1);\n\n\tzip->entries = calloc((size_t)zip->numFiles, sizeof(*zip->entries));\n\tif (zip->entries == NULL)\n\t\treturn (-1);\n\tentries = zip->entries;\n\n\tempty_streams = 0;\n\tfor (;;) {\n\t\tint type;\n\t\tuint64_t size;\n\t\tsize_t ll;\n\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t\tif (type == kEnd)\n\t\t\tbreak;\n\n\t\tif (parse_7zip_uint64(a, &size) < 0)\n\t\t\treturn (-1);\n\t\tif (zip->header_bytes_remaining < size)\n\t\t\treturn (-1);\n\t\tll = (size_t)size;\n\n\t\tswitch (type) {\n\t\tcase kEmptyStream:\n\t\t\th->emptyStreamBools = calloc((size_t)zip->numFiles,\n\t\t\t sizeof(*h->emptyStreamBools));\n\t\t\tif (h->emptyStreamBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(\n\t\t\t a, h->emptyStreamBools, (size_t)zip->numFiles) < 0)\n\t\t\t\treturn (-1);\n\t\t\tempty_streams = 0;\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tif (h->emptyStreamBools[i])\n\t\t\t\t\tempty_streams++;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase kEmptyFile:\n\t\t\tif (empty_streams <= 0) {\n\t\t\t\t/* Unexcepted sequence. Skip this. */\n\t\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\th->emptyFileBools = calloc(empty_streams,\n\t\t\t sizeof(*h->emptyFileBools));\n\t\t\tif (h->emptyFileBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(a, h->emptyFileBools, empty_streams) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kAnti:\n\t\t\tif (empty_streams <= 0) {\n\t\t\t\t/* Unexcepted sequence. Skip this. */\n\t\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\th->antiBools = calloc(empty_streams,\n\t\t\t sizeof(*h->antiBools));\n\t\t\tif (h->antiBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(a, h->antiBools, empty_streams) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kCTime:\n\t\tcase kATime:\n\t\tcase kMTime:\n\t\t\tif (read_Times(a, h, type) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kName:\n\t\t{\n\t\t\tunsigned char *np;\n\t\t\tsize_t nl, nb;\n\n\t\t\t/* Skip one byte. */\n\t\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tll--;\n\n\t\t\tif ((ll & 1) || ll < zip->numFiles * 4)\n\t\t\t\treturn (-1);\n\n\t\t\tzip->entry_names = malloc(ll);\n\t\t\tif (zip->entry_names == NULL)\n\t\t\t\treturn (-1);\n\t\t\tnp = zip->entry_names;\n\t\t\tnb = ll;\n\t\t\t/*\n\t\t\t * Copy whole file names.\n\t\t\t * NOTE: This loop prevents from expanding\n\t\t\t * the uncompressed buffer in order not to\n\t\t\t * use extra memory resource.\n\t\t\t */\n\t\t\twhile (nb) {\n\t\t\t\tsize_t b;\n\t\t\t\tif (nb > UBUFF_SIZE)\n\t\t\t\t\tb = UBUFF_SIZE;\n\t\t\t\telse\n\t\t\t\t\tb = nb;\n\t\t\t\tif ((p = header_bytes(a, b)) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tmemcpy(np, p, b);\n\t\t\t\tnp += b;\n\t\t\t\tnb -= b;\n\t\t\t}\n\t\t\tnp = zip->entry_names;\n\t\t\tnl = ll;\n\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tentries[i].utf16name = np;\n#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)\n\t\t\t\tentries[i].wname = (wchar_t *)np;\n#endif\n\n\t\t\t\t/* Find a terminator. */\n\t\t\t\twhile (nl >= 2 && (np[0] || np[1])) {\n\t\t\t\t\tnp += 2;\n\t\t\t\t\tnl -= 2;\n\t\t\t\t}\n\t\t\t\tif (nl < 2)\n\t\t\t\t\treturn (-1);/* Terminator not found */\n\t\t\t\tentries[i].name_len = np - entries[i].utf16name;\n\t\t\t\tnp += 2;\n\t\t\t\tnl -= 2;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase kAttributes:\n\t\t{\n\t\t\tint allAreDefined;\n\n\t\t\tif ((p = header_bytes(a, 2)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tallAreDefined = *p;\n\t\t\th->attrBools = calloc((size_t)zip->numFiles,\n\t\t\t sizeof(*h->attrBools));\n\t\t\tif (h->attrBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (allAreDefined)\n\t\t\t\tmemset(h->attrBools, 1, (size_t)zip->numFiles);\n\t\t\telse {\n\t\t\t\tif (read_Bools(a, h->attrBools,\n\t\t\t\t (size_t)zip->numFiles) < 0)\n\t\t\t\t\treturn (-1);\n\t\t\t}\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tif (h->attrBools[i]) {\n\t\t\t\t\tif ((p = header_bytes(a, 4)) == NULL)\n\t\t\t\t\t\treturn (-1);\n\t\t\t\t\tentries[i].attr = archive_le32dec(p);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase kDummy:\n\t\t\tif (ll == 0)\n\t\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/*\n\t * Set up entry's attributes.\n\t */\n\tfolders = si->ci.folders;\n\teindex = sindex = 0;\n\tfolderIndex = indexInFolder = 0;\n\tfor (i = 0; i < zip->numFiles; i++) {\n\t\tif (h->emptyStreamBools == NULL || h->emptyStreamBools[i] == 0)\n\t\t\tentries[i].flg |= HAS_STREAM;\n\t\t/* The high 16 bits of attributes is a posix file mode. */\n\t\tentries[i].mode = entries[i].attr >> 16;\n\t\tif (entries[i].flg & HAS_STREAM) {\n\t\t\tif ((size_t)sindex >= si->ss.unpack_streams)\n\t\t\t\treturn (-1);\n\t\t\tif (entries[i].mode == 0)\n\t\t\t\tentries[i].mode = AE_IFREG | 0666;\n\t\t\tif (si->ss.digestsDefined[sindex])\n\t\t\t\tentries[i].flg |= CRC32_IS_SET;\n\t\t\tentries[i].ssIndex = sindex;\n\t\t\tsindex++;\n\t\t} else {\n\t\t\tint dir;\n\t\t\tif (h->emptyFileBools == NULL)\n\t\t\t\tdir = 1;\n\t\t\telse {\n\t\t\t\tif (h->emptyFileBools[eindex])\n\t\t\t\t\tdir = 0;\n\t\t\t\telse\n\t\t\t\t\tdir = 1;\n\t\t\t\teindex++;\n\t\t\t}\n\t\t\tif (entries[i].mode == 0) {\n\t\t\t\tif (dir)\n\t\t\t\t\tentries[i].mode = AE_IFDIR | 0777;\n\t\t\t\telse\n\t\t\t\t\tentries[i].mode = AE_IFREG | 0666;\n\t\t\t} else if (dir &&\n\t\t\t (entries[i].mode & AE_IFMT) != AE_IFDIR) {\n\t\t\t\tentries[i].mode &= ~AE_IFMT;\n\t\t\t\tentries[i].mode |= AE_IFDIR;\n\t\t\t}\n\t\t\tif ((entries[i].mode & AE_IFMT) == AE_IFDIR &&\n\t\t\t entries[i].name_len >= 2 &&\n\t\t\t (entries[i].utf16name[entries[i].name_len-2] != '/' ||\n\t\t\t entries[i].utf16name[entries[i].name_len-1] != 0)) {\n\t\t\t\tentries[i].utf16name[entries[i].name_len] = '/';\n\t\t\t\tentries[i].utf16name[entries[i].name_len+1] = 0;\n\t\t\t\tentries[i].name_len += 2;\n\t\t\t}\n\t\t\tentries[i].ssIndex = -1;\n\t\t}\n\t\tif (entries[i].attr & 0x01)\n\t\t\tentries[i].mode &= ~0222;/* Read only. */\n\n\t\tif ((entries[i].flg & HAS_STREAM) == 0 && indexInFolder == 0) {\n\t\t\t/*\n\t\t\t * The entry is an empty file or a directory file,\n\t\t\t * those both have no contents.\n\t\t\t */\n\t\t\tentries[i].folderIndex = -1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (indexInFolder == 0) {\n\t\t\tfor (;;) {\n\t\t\t\tif (folderIndex >= si->ci.numFolders)\n\t\t\t\t\treturn (-1);\n\t\t\t\tif (folders[folderIndex].numUnpackStreams)\n\t\t\t\t\tbreak;\n\t\t\t\tfolderIndex++;\n\t\t\t}\n\t\t}\n\t\tentries[i].folderIndex = folderIndex;\n\t\tif ((entries[i].flg & HAS_STREAM) == 0)\n\t\t\tcontinue;\n\t\tindexInFolder++;\n\t\tif (indexInFolder >= folders[folderIndex].numUnpackStreams) {\n\t\t\tfolderIndex++;\n\t\t\tindexInFolder = 0;\n\t\t}\n\t}\n\n\treturn (0);\n}","target":"read_Header(struct archive_read *a, struct _7z_header_info *h,\n int check_header_id)\n{\n\tstruct _7zip *zip = (struct _7zip *)a->format->data;\n\tconst unsigned char *p;\n\tstruct _7z_folder *folders;\n\tstruct _7z_stream_info *si = &(zip->si);\n\tstruct _7zip_entry *entries;\n\tuint32_t folderIndex, indexInFolder;\n\tunsigned i;\n\tint eindex, empty_streams, sindex;\n\n\tif (check_header_id) {\n\t\t/*\n\t\t * Read Header.\n\t\t */\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\tif (*p != kHeader)\n\t\t\treturn (-1);\n\t}\n\n\t/*\n\t * Read ArchiveProperties.\n\t */\n\tif ((p = header_bytes(a, 1)) == NULL)\n\t\treturn (-1);\n\tif (*p == kArchiveProperties) {\n\t\tfor (;;) {\n\t\t\tuint64_t size;\n\t\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (*p == 0)\n\t\t\t\tbreak;\n\t\t\tif (parse_7zip_uint64(a, &size) < 0)\n\t\t\t\treturn (-1);\n\t\t}\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t}\n\n\t/*\n\t * Read MainStreamsInfo.\n\t */\n\tif (*p == kMainStreamsInfo) {\n\t\tif (read_StreamsInfo(a, &(zip->si)) < 0)\n\t\t\treturn (-1);\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t}\n\tif (*p == kEnd)\n\t\treturn (0);\n\n\t/*\n\t * Read FilesInfo.\n\t */\n\tif (*p != kFilesInfo)\n\t\treturn (-1);\n\n\tif (parse_7zip_uint64(a, &(zip->numFiles)) < 0)\n\t\treturn (-1);\n\tif (UMAX_ENTRY < zip->numFiles)\n\t\treturn (-1);\n\n\tzip->entries = calloc((size_t)zip->numFiles, sizeof(*zip->entries));\n\tif (zip->entries == NULL)\n\t\treturn (-1);\n\tentries = zip->entries;\n\n\tempty_streams = 0;\n\tfor (;;) {\n\t\tint type;\n\t\tuint64_t size;\n\t\tsize_t ll;\n\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t\tif (type == kEnd)\n\t\t\tbreak;\n\n\t\tif (parse_7zip_uint64(a, &size) < 0)\n\t\t\treturn (-1);\n\t\tif (zip->header_bytes_remaining < size)\n\t\t\treturn (-1);\n\t\tll = (size_t)size;\n\n\t\tswitch (type) {\n\t\tcase kEmptyStream:\n\t\t\tif (h->emptyStreamBools != NULL)\n\t\t\t\treturn (-1);\n\t\t\th->emptyStreamBools = calloc((size_t)zip->numFiles,\n\t\t\t sizeof(*h->emptyStreamBools));\n\t\t\tif (h->emptyStreamBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(\n\t\t\t a, h->emptyStreamBools, (size_t)zip->numFiles) < 0)\n\t\t\t\treturn (-1);\n\t\t\tempty_streams = 0;\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tif (h->emptyStreamBools[i])\n\t\t\t\t\tempty_streams++;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase kEmptyFile:\n\t\t\tif (empty_streams <= 0) {\n\t\t\t\t/* Unexcepted sequence. Skip this. */\n\t\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (h->emptyFileBools != NULL)\n\t\t\t\treturn (-1);\n\t\t\th->emptyFileBools = calloc(empty_streams,\n\t\t\t sizeof(*h->emptyFileBools));\n\t\t\tif (h->emptyFileBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(a, h->emptyFileBools, empty_streams) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kAnti:\n\t\t\tif (empty_streams <= 0) {\n\t\t\t\t/* Unexcepted sequence. Skip this. */\n\t\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (h->antiBools != NULL)\n\t\t\t\treturn (-1);\n\t\t\th->antiBools = calloc(empty_streams,\n\t\t\t sizeof(*h->antiBools));\n\t\t\tif (h->antiBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (read_Bools(a, h->antiBools, empty_streams) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kCTime:\n\t\tcase kATime:\n\t\tcase kMTime:\n\t\t\tif (read_Times(a, h, type) < 0)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\tcase kName:\n\t\t{\n\t\t\tunsigned char *np;\n\t\t\tsize_t nl, nb;\n\n\t\t\t/* Skip one byte. */\n\t\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tll--;\n\n\t\t\tif ((ll & 1) || ll < zip->numFiles * 4)\n\t\t\t\treturn (-1);\n\n\t\t\tif (zip->entry_names != NULL)\n\t\t\t\treturn (-1);\n\t\t\tzip->entry_names = malloc(ll);\n\t\t\tif (zip->entry_names == NULL)\n\t\t\t\treturn (-1);\n\t\t\tnp = zip->entry_names;\n\t\t\tnb = ll;\n\t\t\t/*\n\t\t\t * Copy whole file names.\n\t\t\t * NOTE: This loop prevents from expanding\n\t\t\t * the uncompressed buffer in order not to\n\t\t\t * use extra memory resource.\n\t\t\t */\n\t\t\twhile (nb) {\n\t\t\t\tsize_t b;\n\t\t\t\tif (nb > UBUFF_SIZE)\n\t\t\t\t\tb = UBUFF_SIZE;\n\t\t\t\telse\n\t\t\t\t\tb = nb;\n\t\t\t\tif ((p = header_bytes(a, b)) == NULL)\n\t\t\t\t\treturn (-1);\n\t\t\t\tmemcpy(np, p, b);\n\t\t\t\tnp += b;\n\t\t\t\tnb -= b;\n\t\t\t}\n\t\t\tnp = zip->entry_names;\n\t\t\tnl = ll;\n\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tentries[i].utf16name = np;\n#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)\n\t\t\t\tentries[i].wname = (wchar_t *)np;\n#endif\n\n\t\t\t\t/* Find a terminator. */\n\t\t\t\twhile (nl >= 2 && (np[0] || np[1])) {\n\t\t\t\t\tnp += 2;\n\t\t\t\t\tnl -= 2;\n\t\t\t\t}\n\t\t\t\tif (nl < 2)\n\t\t\t\t\treturn (-1);/* Terminator not found */\n\t\t\t\tentries[i].name_len = np - entries[i].utf16name;\n\t\t\t\tnp += 2;\n\t\t\t\tnl -= 2;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase kAttributes:\n\t\t{\n\t\t\tint allAreDefined;\n\n\t\t\tif ((p = header_bytes(a, 2)) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tallAreDefined = *p;\n\t\t\tif (h->attrBools != NULL)\n\t\t\t\treturn (-1);\n\t\t\th->attrBools = calloc((size_t)zip->numFiles,\n\t\t\t sizeof(*h->attrBools));\n\t\t\tif (h->attrBools == NULL)\n\t\t\t\treturn (-1);\n\t\t\tif (allAreDefined)\n\t\t\t\tmemset(h->attrBools, 1, (size_t)zip->numFiles);\n\t\t\telse {\n\t\t\t\tif (read_Bools(a, h->attrBools,\n\t\t\t\t (size_t)zip->numFiles) < 0)\n\t\t\t\t\treturn (-1);\n\t\t\t}\n\t\t\tfor (i = 0; i < zip->numFiles; i++) {\n\t\t\t\tif (h->attrBools[i]) {\n\t\t\t\t\tif ((p = header_bytes(a, 4)) == NULL)\n\t\t\t\t\t\treturn (-1);\n\t\t\t\t\tentries[i].attr = archive_le32dec(p);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase kDummy:\n\t\t\tif (ll == 0)\n\t\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (header_bytes(a, ll) == NULL)\n\t\t\t\treturn (-1);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/*\n\t * Set up entry's attributes.\n\t */\n\tfolders = si->ci.folders;\n\teindex = sindex = 0;\n\tfolderIndex = indexInFolder = 0;\n\tfor (i = 0; i < zip->numFiles; i++) {\n\t\tif (h->emptyStreamBools == NULL || h->emptyStreamBools[i] == 0)\n\t\t\tentries[i].flg |= HAS_STREAM;\n\t\t/* The high 16 bits of attributes is a posix file mode. */\n\t\tentries[i].mode = entries[i].attr >> 16;\n\t\tif (entries[i].flg & HAS_STREAM) {\n\t\t\tif ((size_t)sindex >= si->ss.unpack_streams)\n\t\t\t\treturn (-1);\n\t\t\tif (entries[i].mode == 0)\n\t\t\t\tentries[i].mode = AE_IFREG | 0666;\n\t\t\tif (si->ss.digestsDefined[sindex])\n\t\t\t\tentries[i].flg |= CRC32_IS_SET;\n\t\t\tentries[i].ssIndex = sindex;\n\t\t\tsindex++;\n\t\t} else {\n\t\t\tint dir;\n\t\t\tif (h->emptyFileBools == NULL)\n\t\t\t\tdir = 1;\n\t\t\telse {\n\t\t\t\tif (h->emptyFileBools[eindex])\n\t\t\t\t\tdir = 0;\n\t\t\t\telse\n\t\t\t\t\tdir = 1;\n\t\t\t\teindex++;\n\t\t\t}\n\t\t\tif (entries[i].mode == 0) {\n\t\t\t\tif (dir)\n\t\t\t\t\tentries[i].mode = AE_IFDIR | 0777;\n\t\t\t\telse\n\t\t\t\t\tentries[i].mode = AE_IFREG | 0666;\n\t\t\t} else if (dir &&\n\t\t\t (entries[i].mode & AE_IFMT) != AE_IFDIR) {\n\t\t\t\tentries[i].mode &= ~AE_IFMT;\n\t\t\t\tentries[i].mode |= AE_IFDIR;\n\t\t\t}\n\t\t\tif ((entries[i].mode & AE_IFMT) == AE_IFDIR &&\n\t\t\t entries[i].name_len >= 2 &&\n\t\t\t (entries[i].utf16name[entries[i].name_len-2] != '/' ||\n\t\t\t entries[i].utf16name[entries[i].name_len-1] != 0)) {\n\t\t\t\tentries[i].utf16name[entries[i].name_len] = '/';\n\t\t\t\tentries[i].utf16name[entries[i].name_len+1] = 0;\n\t\t\t\tentries[i].name_len += 2;\n\t\t\t}\n\t\t\tentries[i].ssIndex = -1;\n\t\t}\n\t\tif (entries[i].attr & 0x01)\n\t\t\tentries[i].mode &= ~0222;/* Read only. */\n\n\t\tif ((entries[i].flg & HAS_STREAM) == 0 && indexInFolder == 0) {\n\t\t\t/*\n\t\t\t * The entry is an empty file or a directory file,\n\t\t\t * those both have no contents.\n\t\t\t */\n\t\t\tentries[i].folderIndex = -1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (indexInFolder == 0) {\n\t\t\tfor (;;) {\n\t\t\t\tif (folderIndex >= si->ci.numFolders)\n\t\t\t\t\treturn (-1);\n\t\t\t\tif (folders[folderIndex].numUnpackStreams)\n\t\t\t\t\tbreak;\n\t\t\t\tfolderIndex++;\n\t\t\t}\n\t\t}\n\t\tentries[i].folderIndex = folderIndex;\n\t\tif ((entries[i].flg & HAS_STREAM) == 0)\n\t\t\tcontinue;\n\t\tindexInFolder++;\n\t\tif (indexInFolder >= folders[folderIndex].numUnpackStreams) {\n\t\t\tfolderIndex++;\n\t\t\tindexInFolder = 0;\n\t\t}\n\t}\n\n\treturn (0);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"read_Header","file_name":"libarchive/archive_read_support_format_7zip.c","commit_link":"github.com/libarchive/libarchive/commit/7f17c791dcfd8c0416e2cd2485b19410e47ef126","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#33-0f070717d8eb","input":"static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n#define SkipLinesOp 0x01\n#define SetColorOp 0x02\n#define SkipPixelsOp 0x03\n#define ByteDataOp 0x05\n#define RunDataOp 0x06\n#define EOFOp 0x07\n\n char\n magick[12];\n\n Image\n *image;\n\n int\n opcode,\n operand,\n status;\n\n MagickStatusType\n flags;\n\n MagickSizeType\n number_pixels;\n\n MemoryInfo\n *pixel_info;\n\n Quantum\n index;\n\n register ssize_t\n x;\n\n register Quantum\n *q;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n bits_per_pixel,\n map_length,\n number_colormaps,\n number_planes,\n one,\n offset,\n pixel_info_length;\n\n ssize_t\n count,\n y;\n\n unsigned char\n background_color[256],\n *colormap,\n pixel,\n plane,\n *pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Determine if this a RLE file.\n */\n count=ReadBlob(image,2,(unsigned char *) magick);\n if ((count != 2) || (memcmp(magick,\"\\122\\314\",2) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n do\n {\n /*\n Read image header.\n */\n image->page.x=ReadBlobLSBShort(image);\n image->page.y=ReadBlobLSBShort(image);\n image->columns=ReadBlobLSBShort(image);\n image->rows=ReadBlobLSBShort(image);\n flags=(MagickStatusType) ReadBlobByte(image);\n image->alpha_trait=flags & 0x04 ? BlendPixelTrait : UndefinedPixelTrait;\n number_planes=(size_t) ReadBlobByte(image);\n bits_per_pixel=(size_t) ReadBlobByte(image);\n number_colormaps=(size_t) ReadBlobByte(image);\n map_length=(unsigned char) ReadBlobByte(image);\n if (map_length >= 64)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n one=1;\n map_length=one << map_length;\n if ((number_planes == 0) || (number_planes == 2) || (bits_per_pixel != 8) ||\n (image->columns == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (flags & 0x02)\n {\n /*\n No background color-- initialize to black.\n */\n for (i=0; i < (ssize_t) number_planes; i++)\n background_color[i]=0;\n (void) ReadBlobByte(image);\n }\n else\n {\n /*\n Initialize background color.\n */\n p=background_color;\n for (i=0; i < (ssize_t) number_planes; i++)\n *p++=(unsigned char) ReadBlobByte(image);\n }\n if ((number_planes & 0x01) == 0)\n (void) ReadBlobByte(image);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n colormap=(unsigned char *) NULL;\n if (number_colormaps != 0)\n {\n /*\n Read image colormaps.\n */\n colormap=(unsigned char *) AcquireQuantumMemory(number_colormaps,\n 3*map_length*sizeof(*colormap));\n if (colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=colormap;\n for (i=0; i < (ssize_t) number_colormaps; i++)\n for (x=0; x < (ssize_t) map_length; x++)\n *p++=(unsigned char) ScaleShortToQuantum(ReadBlobLSBShort(image));\n }\n if ((flags & 0x08) != 0)\n {\n char\n *comment;\n\n size_t\n length;\n\n /*\n Read image comment.\n */\n length=ReadBlobLSBShort(image);\n if (length != 0)\n {\n comment=(char *) AcquireQuantumMemory(length,sizeof(*comment));\n if (comment == (char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,length-1,(unsigned char *) comment);\n comment[length-1]='\\0';\n (void) SetImageProperty(image,\"comment\",comment,exception);\n comment=DestroyString(comment);\n if ((length & 0x01) == 0)\n (void) ReadBlobByte(image);\n }\n }\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Allocate RLE pixels.\n */\n if (image->alpha_trait != UndefinedPixelTrait)\n number_planes++;\n number_pixels=(MagickSizeType) image->columns*image->rows;\n if ((number_pixels*number_planes) != (size_t) (number_pixels*number_planes))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixel_info_length=image->columns*image->rows*MagickMax(number_planes,4);\n pixel_info=AcquireVirtualMemory(pixel_info_length,sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n if ((flags & 0x01) && !(flags & 0x02))\n {\n ssize_t\n j;\n\n /*\n Set background color.\n */\n p=pixels;\n for (i=0; i < (ssize_t) number_pixels; i++)\n {\n if (image->alpha_trait == UndefinedPixelTrait)\n for (j=0; j < (ssize_t) number_planes; j++)\n *p++=background_color[j];\n else\n {\n for (j=0; j < (ssize_t) (number_planes-1); j++)\n *p++=background_color[j];\n *p++=0; /* initialize matte channel */\n }\n }\n }\n /*\n Read runlength-encoded image.\n */\n plane=0;\n x=0;\n y=0;\n opcode=ReadBlobByte(image);\n do\n {\n switch (opcode & 0x3f)\n {\n case SkipLinesOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n x=0;\n y+=operand;\n break;\n }\n case SetColorOp:\n {\n operand=ReadBlobByte(image);\n plane=(unsigned char) operand;\n if (plane == 255)\n plane=(unsigned char) (number_planes-1);\n x=0;\n break;\n }\n case SkipPixelsOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n x+=operand;\n break;\n }\n case ByteDataOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n offset=((image->rows-y-1)*image->columns*number_planes)+x*\n number_planes+plane;\n operand++;\n if (offset+((size_t) operand*number_planes) > pixel_info_length)\n {\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n p=pixels+offset;\n for (i=0; i < (ssize_t) operand; i++)\n {\n pixel=(unsigned char) ReadBlobByte(image);\n if ((y < (ssize_t) image->rows) &&\n ((x+i) < (ssize_t) image->columns))\n *p=pixel;\n p+=number_planes;\n }\n if (operand & 0x01)\n (void) ReadBlobByte(image);\n x+=operand;\n break;\n }\n case RunDataOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n pixel=(unsigned char) ReadBlobByte(image);\n (void) ReadBlobByte(image);\n offset=((image->rows-y-1)*image->columns*number_planes)+x*\n number_planes+plane;\n operand++;\n if (offset+((size_t) operand*number_planes) > pixel_info_length)\n {\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n p=pixels+offset;\n for (i=0; i < (ssize_t) operand; i++)\n {\n if ((y < (ssize_t) image->rows) &&\n ((x+i) < (ssize_t) image->columns))\n *p=pixel;\n p+=number_planes;\n }\n x+=operand;\n break;\n }\n default:\n break;\n }\n opcode=ReadBlobByte(image);\n } while (((opcode & 0x3f) != EOFOp) && (opcode != EOF));\n if (number_colormaps != 0)\n {\n MagickStatusType\n mask;\n\n /*\n Apply colormap affineation to image.\n */\n mask=(MagickStatusType) (map_length-1);\n p=pixels;\n x=(ssize_t) number_planes;\n if (number_colormaps == 1)\n for (i=0; i < (ssize_t) number_pixels; i++)\n {\n if (IsValidColormapIndex(image,*p & mask,&index,exception) ==\n MagickFalse)\n break;\n *p=colormap[(ssize_t) index];\n p++;\n }\n else\n if ((number_planes >= 3) && (number_colormaps >= 3))\n for (i=0; i < (ssize_t) number_pixels; i++)\n for (x=0; x < (ssize_t) number_planes; x++)\n {\n if (IsValidColormapIndex(image,(size_t) (x*map_length+\n (*p & mask)),&index,exception) == MagickFalse)\n break;\n *p=colormap[(ssize_t) index];\n p++;\n }\n if ((i < (ssize_t) number_pixels) || (x < (ssize_t) number_planes))\n {\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n }\n /*\n Initialize image structure.\n */\n if (number_planes >= 3)\n {\n /*\n Convert raster image to DirectClass pixel packets.\n */\n p=pixels;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n /*\n Create colormap.\n */\n if (number_colormaps == 0)\n map_length=256;\n if (AcquireImageColormap(image,map_length,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=colormap;\n if (number_colormaps == 1)\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n /*\n Pseudocolor.\n */\n image->colormap[i].red=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n image->colormap[i].green=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n image->colormap[i].blue=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n }\n else\n if (number_colormaps > 1)\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n image->colormap[i].red=(MagickRealType)\n ScaleCharToQuantum(*p);\n image->colormap[i].green=(MagickRealType)\n ScaleCharToQuantum(*(p+map_length));\n image->colormap[i].blue=(MagickRealType)\n ScaleCharToQuantum(*(p+map_length*2));\n p++;\n }\n p=pixels;\n if (image->alpha_trait == UndefinedPixelTrait)\n {\n /*\n Convert raster image to PseudoClass pixel packets.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p++,q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n (void) SyncImage(image,exception);\n }\n else\n {\n /*\n Image has a matte channel-- promote to DirectClass.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t)\n index].red),q);\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t)\n index].green),q);\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t)\n index].blue),q);\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n q+=GetPixelChannels(image);\n }\n if (x < (ssize_t) image->columns)\n break;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n image->colormap=(PixelInfo *) RelinquishMagickMemory(\n image->colormap);\n image->storage_class=DirectClass;\n image->colors=0;\n }\n }\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n (void) ReadBlobByte(image);\n count=ReadBlob(image,2,(unsigned char *) magick);\n if ((count != 0) && (memcmp(magick,\"\\122\\314\",2) == 0))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while ((count != 0) && (memcmp(magick,\"\\122\\314\",2) == 0));\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n#define SkipLinesOp 0x01\n#define SetColorOp 0x02\n#define SkipPixelsOp 0x03\n#define ByteDataOp 0x05\n#define RunDataOp 0x06\n#define EOFOp 0x07\n\n char\n magick[12];\n\n Image\n *image;\n\n int\n opcode,\n operand,\n status;\n\n MagickStatusType\n flags;\n\n MagickSizeType\n number_pixels;\n\n MemoryInfo\n *pixel_info;\n\n Quantum\n index;\n\n register ssize_t\n x;\n\n register Quantum\n *q;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n bits_per_pixel,\n map_length,\n number_colormaps,\n number_planes,\n number_planes_filled,\n one,\n offset,\n pixel_info_length;\n\n ssize_t\n count,\n y;\n\n unsigned char\n background_color[256],\n *colormap,\n pixel,\n plane,\n *pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Determine if this a RLE file.\n */\n count=ReadBlob(image,2,(unsigned char *) magick);\n if ((count != 2) || (memcmp(magick,\"\\122\\314\",2) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n do\n {\n /*\n Read image header.\n */\n image->page.x=ReadBlobLSBShort(image);\n image->page.y=ReadBlobLSBShort(image);\n image->columns=ReadBlobLSBShort(image);\n image->rows=ReadBlobLSBShort(image);\n flags=(MagickStatusType) ReadBlobByte(image);\n image->alpha_trait=flags & 0x04 ? BlendPixelTrait : UndefinedPixelTrait;\n number_planes=(size_t) ReadBlobByte(image);\n bits_per_pixel=(size_t) ReadBlobByte(image);\n number_colormaps=(size_t) ReadBlobByte(image);\n map_length=(unsigned char) ReadBlobByte(image);\n if (map_length >= 64)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n one=1;\n map_length=one << map_length;\n if ((number_planes == 0) || (number_planes == 2) || (bits_per_pixel != 8) ||\n (image->columns == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (flags & 0x02)\n {\n /*\n No background color-- initialize to black.\n */\n for (i=0; i < (ssize_t) number_planes; i++)\n background_color[i]=0;\n (void) ReadBlobByte(image);\n }\n else\n {\n /*\n Initialize background color.\n */\n p=background_color;\n for (i=0; i < (ssize_t) number_planes; i++)\n *p++=(unsigned char) ReadBlobByte(image);\n }\n if ((number_planes & 0x01) == 0)\n (void) ReadBlobByte(image);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n colormap=(unsigned char *) NULL;\n if (number_colormaps != 0)\n {\n /*\n Read image colormaps.\n */\n colormap=(unsigned char *) AcquireQuantumMemory(number_colormaps,\n 3*map_length*sizeof(*colormap));\n if (colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=colormap;\n for (i=0; i < (ssize_t) number_colormaps; i++)\n for (x=0; x < (ssize_t) map_length; x++)\n *p++=(unsigned char) ScaleShortToQuantum(ReadBlobLSBShort(image));\n }\n if ((flags & 0x08) != 0)\n {\n char\n *comment;\n\n size_t\n length;\n\n /*\n Read image comment.\n */\n length=ReadBlobLSBShort(image);\n if (length != 0)\n {\n comment=(char *) AcquireQuantumMemory(length,sizeof(*comment));\n if (comment == (char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,length-1,(unsigned char *) comment);\n comment[length-1]='\\0';\n (void) SetImageProperty(image,\"comment\",comment,exception);\n comment=DestroyString(comment);\n if ((length & 0x01) == 0)\n (void) ReadBlobByte(image);\n }\n }\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Allocate RLE pixels.\n */\n if (image->alpha_trait != UndefinedPixelTrait)\n number_planes++;\n number_pixels=(MagickSizeType) image->columns*image->rows;\n number_planes_filled=(number_planes % 2 == 0) ? number_planes :\n number_planes+1;\n if ((number_pixels*number_planes_filled) != (size_t) (number_pixels*\n number_planes_filled))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixel_info_length=image->columns*image->rows*number_planes_filled;\n pixel_info=AcquireVirtualMemory(pixel_info_length,sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n if ((flags & 0x01) && !(flags & 0x02))\n {\n ssize_t\n j;\n\n /*\n Set background color.\n */\n p=pixels;\n for (i=0; i < (ssize_t) number_pixels; i++)\n {\n if (image->alpha_trait == UndefinedPixelTrait)\n for (j=0; j < (ssize_t) number_planes; j++)\n *p++=background_color[j];\n else\n {\n for (j=0; j < (ssize_t) (number_planes-1); j++)\n *p++=background_color[j];\n *p++=0; /* initialize matte channel */\n }\n }\n }\n /*\n Read runlength-encoded image.\n */\n plane=0;\n x=0;\n y=0;\n opcode=ReadBlobByte(image);\n do\n {\n switch (opcode & 0x3f)\n {\n case SkipLinesOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n x=0;\n y+=operand;\n break;\n }\n case SetColorOp:\n {\n operand=ReadBlobByte(image);\n plane=(unsigned char) operand;\n if (plane == 255)\n plane=(unsigned char) (number_planes-1);\n x=0;\n break;\n }\n case SkipPixelsOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n x+=operand;\n break;\n }\n case ByteDataOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n offset=((image->rows-y-1)*image->columns*number_planes)+x*\n number_planes+plane;\n operand++;\n if (offset+((size_t) operand*number_planes) > pixel_info_length)\n {\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n p=pixels+offset;\n for (i=0; i < (ssize_t) operand; i++)\n {\n pixel=(unsigned char) ReadBlobByte(image);\n if ((y < (ssize_t) image->rows) &&\n ((x+i) < (ssize_t) image->columns))\n *p=pixel;\n p+=number_planes;\n }\n if (operand & 0x01)\n (void) ReadBlobByte(image);\n x+=operand;\n break;\n }\n case RunDataOp:\n {\n operand=ReadBlobByte(image);\n if (opcode & 0x40)\n operand=(int) ReadBlobLSBShort(image);\n pixel=(unsigned char) ReadBlobByte(image);\n (void) ReadBlobByte(image);\n offset=((image->rows-y-1)*image->columns*number_planes)+x*\n number_planes+plane;\n operand++;\n if (offset+((size_t) operand*number_planes) > pixel_info_length)\n {\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n p=pixels+offset;\n for (i=0; i < (ssize_t) operand; i++)\n {\n if ((y < (ssize_t) image->rows) &&\n ((x+i) < (ssize_t) image->columns))\n *p=pixel;\n p+=number_planes;\n }\n x+=operand;\n break;\n }\n default:\n break;\n }\n opcode=ReadBlobByte(image);\n } while (((opcode & 0x3f) != EOFOp) && (opcode != EOF));\n if (number_colormaps != 0)\n {\n MagickStatusType\n mask;\n\n /*\n Apply colormap affineation to image.\n */\n mask=(MagickStatusType) (map_length-1);\n p=pixels;\n x=(ssize_t) number_planes;\n if (number_colormaps == 1)\n for (i=0; i < (ssize_t) number_pixels; i++)\n {\n if (IsValidColormapIndex(image,*p & mask,&index,exception) ==\n MagickFalse)\n break;\n *p=colormap[(ssize_t) index];\n p++;\n }\n else\n if ((number_planes >= 3) && (number_colormaps >= 3))\n for (i=0; i < (ssize_t) number_pixels; i++)\n for (x=0; x < (ssize_t) number_planes; x++)\n {\n if (IsValidColormapIndex(image,(size_t) (x*map_length+\n (*p & mask)),&index,exception) == MagickFalse)\n break;\n *p=colormap[(ssize_t) index];\n p++;\n }\n if ((i < (ssize_t) number_pixels) || (x < (ssize_t) number_planes))\n {\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowReaderException(CorruptImageError,\"UnableToReadImageData\");\n }\n }\n /*\n Initialize image structure.\n */\n if (number_planes >= 3)\n {\n /*\n Convert raster image to DirectClass pixel packets.\n */\n p=pixels;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleCharToQuantum(*p++),q);\n SetPixelGreen(image,ScaleCharToQuantum(*p++),q);\n SetPixelBlue(image,ScaleCharToQuantum(*p++),q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n /*\n Create colormap.\n */\n if (number_colormaps == 0)\n map_length=256;\n if (AcquireImageColormap(image,map_length,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=colormap;\n if (number_colormaps == 1)\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n /*\n Pseudocolor.\n */\n image->colormap[i].red=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n image->colormap[i].green=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n image->colormap[i].blue=(MagickRealType)\n ScaleCharToQuantum((unsigned char) i);\n }\n else\n if (number_colormaps > 1)\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n image->colormap[i].red=(MagickRealType)\n ScaleCharToQuantum(*p);\n image->colormap[i].green=(MagickRealType)\n ScaleCharToQuantum(*(p+map_length));\n image->colormap[i].blue=(MagickRealType)\n ScaleCharToQuantum(*(p+map_length*2));\n p++;\n }\n p=pixels;\n if (image->alpha_trait == UndefinedPixelTrait)\n {\n /*\n Convert raster image to PseudoClass pixel packets.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p++,q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n (void) SyncImage(image,exception);\n }\n else\n {\n /*\n Image has a matte channel-- promote to DirectClass.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelRed(image,ClampToQuantum(image->colormap[(ssize_t)\n index].red),q);\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelGreen(image,ClampToQuantum(image->colormap[(ssize_t)\n index].green),q);\n if (IsValidColormapIndex(image,(ssize_t) *p++,&index,\n exception) == MagickFalse)\n break;\n SetPixelBlue(image,ClampToQuantum(image->colormap[(ssize_t)\n index].blue),q);\n SetPixelAlpha(image,ScaleCharToQuantum(*p++),q);\n q+=GetPixelChannels(image);\n }\n if (x < (ssize_t) image->columns)\n break;\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n image->colormap=(PixelInfo *) RelinquishMagickMemory(\n image->colormap);\n image->storage_class=DirectClass;\n image->colors=0;\n }\n }\n if (number_colormaps != 0)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n (void) ReadBlobByte(image);\n count=ReadBlob(image,2,(unsigned char *) magick);\n if ((count != 0) && (memcmp(magick,\"\\122\\314\",2) == 0))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while ((count != 0) && (memcmp(magick,\"\\122\\314\",2) == 0));\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ReadRLEImage","file_name":"coders/rle.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/2ad6d33493750a28a5a655d319a8e0b16c392de1","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#34-930f3cb5a4c3","input":"bool JSON_parser(Variant &z, const char *p, int length, bool const assoc,\n int depth, int64_t options) {\n // No GC safepoints during JSON parsing, please. Code is not re-entrant.\n NoHandleSurpriseScope no_surprise(SafepointFlags);\n\n json_parser *json = s_json_parser.get(); /* the parser state */\n // Clear and reuse the thread-local string buffers. They are only freed if\n // they exceed kMaxPersistentStringBufferCapacity at exit or if the thread\n // is explicitly flushed (e.g., due to being idle).\n json->initSb(length);\n SCOPE_EXIT {\n constexpr int kMaxPersistentStringBufferCapacity = 256 * 1024;\n if (json->sb_cap > kMaxPersistentStringBufferCapacity) json->flushSb();\n };\n // SimpleParser only handles the most common set of options. Also, only use it\n // if its array nesting depth check is *more* restrictive than what the user\n // asks for, to ensure that the precise semantics of the general case is\n // applied for all nesting overflows.\n if (assoc &&\n options == (options & (k_JSON_FB_LOOSE |\n k_JSON_FB_DARRAYS |\n k_JSON_FB_DARRAYS_AND_VARRAYS |\n k_JSON_FB_HACK_ARRAYS |\n k_JSON_FB_THRIFT_SIMPLE_JSON |\n k_JSON_FB_LEGACY_HACK_ARRAYS)) &&\n depth >= SimpleParser::kMaxArrayDepth &&\n length <= RuntimeOption::EvalSimpleJsonMaxLength &&\n SimpleParser::TryParse(p, length, json->tl_buffer.tv, z,\n get_container_type_from_options(options),\n options & k_JSON_FB_THRIFT_SIMPLE_JSON)) {\n return true;\n }\n\n int b; /* the next character */\n int c; /* the next character class */\n int s; /* the next state */\n int state = 0;\n\n /**/\n bool const loose = options & k_JSON_FB_LOOSE;\n JSONContainerType const container_type =\n get_container_type_from_options(options);\n int qchr = 0;\n int8_t const *byte_class;\n int8_t const (*next_state_table)[32];\n if (loose) {\n byte_class = loose_ascii_class;\n next_state_table = loose_state_transition_table;\n } else {\n byte_class = ascii_class;\n next_state_table = state_transition_table;\n }\n /**/\n\n UncheckedBuffer *buf = &json->sb_buf;\n UncheckedBuffer *key = &json->sb_key;\n\n DataType type = kInvalidDataType;\n unsigned short escaped_bytes = 0;\n\n auto reset_type = [&] { type = kInvalidDataType; };\n\n json->depth = depth;\n // Since the stack is maintainined on a per request basis, for performance\n // reasons, it only makes sense to expand if necessary and cycles are wasted\n // contracting. Calls with a depth other than default should be rare.\n if (depth > json->stack.size()) {\n json->stack.resize(depth);\n }\n SCOPE_EXIT {\n if (json->stack.empty()) return;\n for (int i = 0; i <= json->mark; i++) {\n json->stack[i].key.reset();\n json->stack[i].val.unset();\n }\n json->mark = -1;\n };\n\n json->mark = json->top = -1;\n push(json, Mode::DONE);\n\n UTF8To16Decoder decoder(p, length, loose);\n for (;;) {\n b = decoder.decode();\n // Fast-case most common transition: append a simple string character.\n if (state == 3 && type == KindOfString) {\n while (b != '\\\"' && b != '\\\\' && b != '\\'' && b <= 127 && b >= ' ') {\n buf->append((char)b);\n b = decoder.decode();\n }\n }\n if (b == UTF8_END) break; // UTF-8 decoding finishes successfully.\n if (b == UTF8_ERROR) {\n s_json_parser->error_code = JSON_ERROR_UTF8;\n return false;\n }\n assertx(b >= 0);\n\n if ((b & 127) == b) {\n /**/\n c = byte_class[b];\n /**/\n if (c <= S_ERR) {\n s_json_parser->error_code = JSON_ERROR_CTRL_CHAR;\n return false;\n }\n } else {\n c = S_ETC;\n }\n /*\n Get the next state from the transition table.\n */\n\n /**/\n s = next_state_table[state][c];\n\n if (s == -4) {\n if (b != qchr) {\n s = 3;\n } else {\n qchr = 0;\n }\n }\n /**/\n\n if (s < 0) {\n /*\n Perform one of the predefined actions.\n */\n switch (s) {\n /*\n empty }\n */\n case -9:\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key, assoc, container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::KEY)) {\n return false;\n }\n state = 9;\n break;\n /*\n {\n */\n case -8:\n if (!push(json, Mode::KEY)) {\n s_json_parser->error_code = JSON_ERROR_DEPTH;\n return false;\n }\n\n state = 1;\n if (json->top > 0) {\n Variant &top = json->stack[json->top].val;\n /**/\n if (container_type == JSONContainerType::COLLECTIONS) {\n // stable_maps is meaningless\n top = req::make();\n } else {\n /**/\n if (!assoc) {\n top = SystemLib::AllocStdClassObject();\n /* */\n } else if (container_type == JSONContainerType::HACK_ARRAYS) {\n top = Array::CreateDict();\n } else if (container_type == JSONContainerType::DARRAYS ||\n container_type == JSONContainerType::DARRAYS_AND_VARRAYS)\n {\n top = Array::CreateDArray();\n /* */\n } else if (\n container_type == JSONContainerType::LEGACY_HACK_ARRAYS) {\n auto arr = staticEmptyDictArray()->copy();\n arr->setLegacyArray(true);\n top = arr;\n } else {\n top = Array::CreateDArray();\n }\n /**/\n }\n /**/\n json->stack[json->top].key = copy_and_clear(*key);\n reset_type();\n }\n break;\n /*\n }\n */\n case -7:\n /*** BEGIN Facebook: json_utf8_loose ***/\n /*\n If this is a trailing comma in an object definition,\n we're in Mode::KEY. In that case, throw that off the\n stack and restore Mode::OBJECT so that we pretend the\n trailing comma just didn't happen.\n */\n if (loose) {\n if (pop(json, Mode::KEY)) {\n push(json, Mode::OBJECT);\n }\n }\n /*** END Facebook: json_utf8_loose ***/\n\n if (type != kInvalidDataType &&\n json->stack[json->top].mode == Mode::OBJECT) {\n Variant mval;\n json_create_zval(mval, *buf, type, options);\n Variant &top = json->stack[json->top].val;\n object_set(json, top, copy_and_clear(*key),\n mval, assoc, container_type);\n buf->clear();\n reset_type();\n }\n\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key,\n assoc, container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::OBJECT)) {\n s_json_parser->error_code = JSON_ERROR_STATE_MISMATCH;\n return false;\n }\n state = 9;\n break;\n /*\n [\n */\n case -6:\n if (!push(json, Mode::ARRAY)) {\n s_json_parser->error_code = JSON_ERROR_DEPTH;\n return false;\n }\n state = 2;\n\n if (json->top > 0) {\n Variant &top = json->stack[json->top].val;\n /**/\n if (container_type == JSONContainerType::COLLECTIONS) {\n top = req::make();\n } else if (container_type == JSONContainerType::HACK_ARRAYS) {\n top = Array::CreateVec();\n } else if (container_type == JSONContainerType::DARRAYS_AND_VARRAYS) {\n top = Array::CreateVArray();\n } else if (container_type == JSONContainerType::DARRAYS) {\n top = Array::CreateDArray();\n } else if (container_type == JSONContainerType::LEGACY_HACK_ARRAYS) {\n auto arr = staticEmptyVecArray()->copy();\n arr->setLegacyArray(true);\n top = arr;\n } else {\n top = Array::CreateDArray();\n }\n /**/\n json->stack[json->top].key = copy_and_clear(*key);\n reset_type();\n }\n break;\n /*\n ]\n */\n case -5:\n {\n if (type != kInvalidDataType &&\n json->stack[json->top].mode == Mode::ARRAY) {\n Variant mval;\n json_create_zval(mval, *buf, type, options);\n auto& top = json->stack[json->top].val;\n if (container_type == JSONContainerType::COLLECTIONS) {\n collections::append(top.getObjectData(), mval.asTypedValue());\n } else {\n top.asArrRef().append(mval);\n }\n buf->clear();\n reset_type();\n }\n\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key, assoc,\n container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::ARRAY)) {\n s_json_parser->error_code = JSON_ERROR_STATE_MISMATCH;\n return false;\n }\n state = 9;\n }\n break;\n /*\n \"\n */\n case -4:\n switch (json->stack[json->top].mode) {\n case Mode::KEY:\n state = 27;\n std::swap(buf, key);\n reset_type();\n break;\n case Mode::ARRAY:\n case Mode::OBJECT:\n state = 9;\n break;\n case Mode::DONE:\n if (type == KindOfString) {\n z = copy_and_clear(*buf);\n state = 9;\n break;\n }\n /* fall through if not KindOfString */\n default:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n break;\n /*\n ,\n */\n case -3:\n {\n Variant mval;\n if (type != kInvalidDataType &&\n (json->stack[json->top].mode == Mode::OBJECT ||\n json->stack[json->top].mode == Mode::ARRAY)) {\n json_create_zval(mval, *buf, type, options);\n }\n\n switch (json->stack[json->top].mode) {\n case Mode::OBJECT:\n if (pop(json, Mode::OBJECT) &&\n push(json, Mode::KEY)) {\n if (type != kInvalidDataType) {\n Variant &top = json->stack[json->top].val;\n object_set(\n json,\n top,\n copy_and_clear(*key),\n mval,\n assoc,\n container_type\n );\n }\n state = 29;\n }\n break;\n case Mode::ARRAY:\n if (type != kInvalidDataType) {\n auto& top = json->stack[json->top].val;\n if (container_type == JSONContainerType::COLLECTIONS) {\n collections::append(top.getObjectData(), mval.asTypedValue());\n } else {\n top.asArrRef().append(mval);\n }\n }\n state = 28;\n break;\n default:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n buf->clear();\n reset_type();\n check_non_safepoint_surprise();\n }\n break;\n\n /**/\n /*\n : (after unquoted string)\n */\n case -10:\n if (json->stack[json->top].mode == Mode::KEY) {\n state = 27;\n std::swap(buf, key);\n reset_type();\n s = -2;\n } else {\n s = 3;\n break;\n }\n /**/\n\n /*\n :\n */\n case -2:\n if (pop(json, Mode::KEY) && push(json, Mode::OBJECT)) {\n state = 28;\n break;\n }\n /*\n syntax error\n */\n case -1:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n } else {\n /*\n Change the state and iterate.\n */\n bool is_tsimplejson = options & k_JSON_FB_THRIFT_SIMPLE_JSON;\n if (type == KindOfString) {\n if (/**/(/**/s == 3/**/ || s == 30)/**/ &&\n state != 8) {\n if (state != 4) {\n utf16_to_utf8(*buf, b);\n } else {\n switch (b) {\n case 'b': buf->append('\\b'); break;\n case 't': buf->append('\\t'); break;\n case 'n': buf->append('\\n'); break;\n case 'f': buf->append('\\f'); break;\n case 'r': buf->append('\\r'); break;\n default:\n utf16_to_utf8(*buf, b);\n break;\n }\n }\n } else if (s == 6) {\n if (UNLIKELY(is_tsimplejson)) {\n if (UNLIKELY(b != '0')) {\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n escaped_bytes = 0;\n } else {\n escaped_bytes = dehexchar(b) << 12;\n }\n } else if (s == 7) {\n if (UNLIKELY(is_tsimplejson)) {\n if (UNLIKELY(b != '0')) {\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n } else {\n escaped_bytes += dehexchar(b) << 8;\n }\n } else if (s == 8) {\n escaped_bytes += dehexchar(b) << 4;\n } else if (s == 3 && state == 8) {\n escaped_bytes += dehexchar(b);\n if (UNLIKELY(is_tsimplejson)) {\n buf->append((char)escaped_bytes);\n } else {\n utf16_to_utf8(*buf, escaped_bytes);\n }\n }\n } else if ((type == kInvalidDataType || type == KindOfNull) &&\n (c == S_DIG || c == S_ZER)) {\n type = KindOfInt64;\n buf->append((char)b);\n } else if (type == KindOfInt64 && s == 24) {\n type = KindOfDouble;\n buf->append((char)b);\n } else if ((type == kInvalidDataType || type == KindOfNull ||\n type == KindOfInt64) &&\n c == S_DOT) {\n type = KindOfDouble;\n buf->append((char)b);\n } else if (type != KindOfString && c == S_QUO) {\n type = KindOfString;\n /**/qchr = b;/**/\n } else if ((type == kInvalidDataType || type == KindOfNull ||\n type == KindOfInt64 || type == KindOfDouble) &&\n ((state == 12 && s == 9) ||\n (state == 16 && s == 9))) {\n type = KindOfBoolean;\n } else if (type == kInvalidDataType && state == 19 && s == 9) {\n type = KindOfNull;\n } else if (type != KindOfString && c > S_WSP) {\n utf16_to_utf8(*buf, b);\n }\n\n state = s;\n }\n }\n\n if (state == 9 && pop(json, Mode::DONE)) {\n s_json_parser->error_code = JSON_ERROR_NONE;\n return true;\n }\n\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n}","target":"bool JSON_parser(Variant &z, const char *p, int length, bool const assoc,\n int depth, int64_t options) {\n // No GC safepoints during JSON parsing, please. Code is not re-entrant.\n NoHandleSurpriseScope no_surprise(SafepointFlags);\n\n json_parser *json = s_json_parser.get(); /* the parser state */\n // Clear and reuse the thread-local string buffers. They are only freed if\n // they exceed kMaxPersistentStringBufferCapacity at exit or if the thread\n // is explicitly flushed (e.g., due to being idle).\n json->initSb(length);\n if (depth <= 0) {\n json->error_code = json_error_codes::JSON_ERROR_DEPTH;\n return false;\n }\n SCOPE_EXIT {\n constexpr int kMaxPersistentStringBufferCapacity = 256 * 1024;\n if (json->sb_cap > kMaxPersistentStringBufferCapacity) json->flushSb();\n };\n // SimpleParser only handles the most common set of options. Also, only use it\n // if its array nesting depth check is *more* restrictive than what the user\n // asks for, to ensure that the precise semantics of the general case is\n // applied for all nesting overflows.\n if (assoc &&\n options == (options & (k_JSON_FB_LOOSE |\n k_JSON_FB_DARRAYS |\n k_JSON_FB_DARRAYS_AND_VARRAYS |\n k_JSON_FB_HACK_ARRAYS |\n k_JSON_FB_THRIFT_SIMPLE_JSON |\n k_JSON_FB_LEGACY_HACK_ARRAYS)) &&\n depth >= SimpleParser::kMaxArrayDepth &&\n length <= RuntimeOption::EvalSimpleJsonMaxLength &&\n SimpleParser::TryParse(p, length, json->tl_buffer.tv, z,\n get_container_type_from_options(options),\n options & k_JSON_FB_THRIFT_SIMPLE_JSON)) {\n return true;\n }\n\n int b; /* the next character */\n int c; /* the next character class */\n int s; /* the next state */\n int state = 0;\n\n /**/\n bool const loose = options & k_JSON_FB_LOOSE;\n JSONContainerType const container_type =\n get_container_type_from_options(options);\n int qchr = 0;\n int8_t const *byte_class;\n int8_t const (*next_state_table)[32];\n if (loose) {\n byte_class = loose_ascii_class;\n next_state_table = loose_state_transition_table;\n } else {\n byte_class = ascii_class;\n next_state_table = state_transition_table;\n }\n /**/\n\n UncheckedBuffer *buf = &json->sb_buf;\n UncheckedBuffer *key = &json->sb_key;\n\n DataType type = kInvalidDataType;\n unsigned short escaped_bytes = 0;\n\n auto reset_type = [&] { type = kInvalidDataType; };\n\n json->depth = depth;\n // Since the stack is maintainined on a per request basis, for performance\n // reasons, it only makes sense to expand if necessary and cycles are wasted\n // contracting. Calls with a depth other than default should be rare.\n if (depth > json->stack.size()) {\n json->stack.resize(depth);\n }\n SCOPE_EXIT {\n if (json->stack.empty()) return;\n for (int i = 0; i <= json->mark; i++) {\n json->stack[i].key.reset();\n json->stack[i].val.unset();\n }\n json->mark = -1;\n };\n\n json->mark = json->top = -1;\n push(json, Mode::DONE);\n\n UTF8To16Decoder decoder(p, length, loose);\n for (;;) {\n b = decoder.decode();\n // Fast-case most common transition: append a simple string character.\n if (state == 3 && type == KindOfString) {\n while (b != '\\\"' && b != '\\\\' && b != '\\'' && b <= 127 && b >= ' ') {\n buf->append((char)b);\n b = decoder.decode();\n }\n }\n if (b == UTF8_END) break; // UTF-8 decoding finishes successfully.\n if (b == UTF8_ERROR) {\n s_json_parser->error_code = JSON_ERROR_UTF8;\n return false;\n }\n assertx(b >= 0);\n\n if ((b & 127) == b) {\n /**/\n c = byte_class[b];\n /**/\n if (c <= S_ERR) {\n s_json_parser->error_code = JSON_ERROR_CTRL_CHAR;\n return false;\n }\n } else {\n c = S_ETC;\n }\n /*\n Get the next state from the transition table.\n */\n\n /**/\n s = next_state_table[state][c];\n\n if (s == -4) {\n if (b != qchr) {\n s = 3;\n } else {\n qchr = 0;\n }\n }\n /**/\n\n if (s < 0) {\n /*\n Perform one of the predefined actions.\n */\n switch (s) {\n /*\n empty }\n */\n case -9:\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key, assoc, container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::KEY)) {\n return false;\n }\n state = 9;\n break;\n /*\n {\n */\n case -8:\n if (!push(json, Mode::KEY)) {\n s_json_parser->error_code = JSON_ERROR_DEPTH;\n return false;\n }\n\n state = 1;\n if (json->top > 0) {\n Variant &top = json->stack[json->top].val;\n /**/\n if (container_type == JSONContainerType::COLLECTIONS) {\n // stable_maps is meaningless\n top = req::make();\n } else {\n /**/\n if (!assoc) {\n top = SystemLib::AllocStdClassObject();\n /* */\n } else if (container_type == JSONContainerType::HACK_ARRAYS) {\n top = Array::CreateDict();\n } else if (container_type == JSONContainerType::DARRAYS ||\n container_type == JSONContainerType::DARRAYS_AND_VARRAYS)\n {\n top = Array::CreateDArray();\n /* */\n } else if (\n container_type == JSONContainerType::LEGACY_HACK_ARRAYS) {\n auto arr = staticEmptyDictArray()->copy();\n arr->setLegacyArray(true);\n top = arr;\n } else {\n top = Array::CreateDArray();\n }\n /**/\n }\n /**/\n json->stack[json->top].key = copy_and_clear(*key);\n reset_type();\n }\n break;\n /*\n }\n */\n case -7:\n /*** BEGIN Facebook: json_utf8_loose ***/\n /*\n If this is a trailing comma in an object definition,\n we're in Mode::KEY. In that case, throw that off the\n stack and restore Mode::OBJECT so that we pretend the\n trailing comma just didn't happen.\n */\n if (loose) {\n if (pop(json, Mode::KEY)) {\n push(json, Mode::OBJECT);\n }\n }\n /*** END Facebook: json_utf8_loose ***/\n\n if (type != kInvalidDataType &&\n json->stack[json->top].mode == Mode::OBJECT) {\n Variant mval;\n json_create_zval(mval, *buf, type, options);\n Variant &top = json->stack[json->top].val;\n object_set(json, top, copy_and_clear(*key),\n mval, assoc, container_type);\n buf->clear();\n reset_type();\n }\n\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key,\n assoc, container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::OBJECT)) {\n s_json_parser->error_code = JSON_ERROR_STATE_MISMATCH;\n return false;\n }\n state = 9;\n break;\n /*\n [\n */\n case -6:\n if (!push(json, Mode::ARRAY)) {\n s_json_parser->error_code = JSON_ERROR_DEPTH;\n return false;\n }\n state = 2;\n\n if (json->top > 0) {\n Variant &top = json->stack[json->top].val;\n /**/\n if (container_type == JSONContainerType::COLLECTIONS) {\n top = req::make();\n } else if (container_type == JSONContainerType::HACK_ARRAYS) {\n top = Array::CreateVec();\n } else if (container_type == JSONContainerType::DARRAYS_AND_VARRAYS) {\n top = Array::CreateVArray();\n } else if (container_type == JSONContainerType::DARRAYS) {\n top = Array::CreateDArray();\n } else if (container_type == JSONContainerType::LEGACY_HACK_ARRAYS) {\n auto arr = staticEmptyVecArray()->copy();\n arr->setLegacyArray(true);\n top = arr;\n } else {\n top = Array::CreateDArray();\n }\n /**/\n json->stack[json->top].key = copy_and_clear(*key);\n reset_type();\n }\n break;\n /*\n ]\n */\n case -5:\n {\n if (type != kInvalidDataType &&\n json->stack[json->top].mode == Mode::ARRAY) {\n Variant mval;\n json_create_zval(mval, *buf, type, options);\n auto& top = json->stack[json->top].val;\n if (container_type == JSONContainerType::COLLECTIONS) {\n collections::append(top.getObjectData(), mval.asTypedValue());\n } else {\n top.asArrRef().append(mval);\n }\n buf->clear();\n reset_type();\n }\n\n /**/\n if (json->top == 1) z = json->stack[json->top].val;\n else {\n /**/\n attach_zval(json, json->stack[json->top].key, assoc,\n container_type);\n /**/\n }\n /**/\n if (!pop(json, Mode::ARRAY)) {\n s_json_parser->error_code = JSON_ERROR_STATE_MISMATCH;\n return false;\n }\n state = 9;\n }\n break;\n /*\n \"\n */\n case -4:\n switch (json->stack[json->top].mode) {\n case Mode::KEY:\n state = 27;\n std::swap(buf, key);\n reset_type();\n break;\n case Mode::ARRAY:\n case Mode::OBJECT:\n state = 9;\n break;\n case Mode::DONE:\n if (type == KindOfString) {\n z = copy_and_clear(*buf);\n state = 9;\n break;\n }\n /* fall through if not KindOfString */\n default:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n break;\n /*\n ,\n */\n case -3:\n {\n Variant mval;\n if (type != kInvalidDataType &&\n (json->stack[json->top].mode == Mode::OBJECT ||\n json->stack[json->top].mode == Mode::ARRAY)) {\n json_create_zval(mval, *buf, type, options);\n }\n\n switch (json->stack[json->top].mode) {\n case Mode::OBJECT:\n if (pop(json, Mode::OBJECT) &&\n push(json, Mode::KEY)) {\n if (type != kInvalidDataType) {\n Variant &top = json->stack[json->top].val;\n object_set(\n json,\n top,\n copy_and_clear(*key),\n mval,\n assoc,\n container_type\n );\n }\n state = 29;\n }\n break;\n case Mode::ARRAY:\n if (type != kInvalidDataType) {\n auto& top = json->stack[json->top].val;\n if (container_type == JSONContainerType::COLLECTIONS) {\n collections::append(top.getObjectData(), mval.asTypedValue());\n } else {\n top.asArrRef().append(mval);\n }\n }\n state = 28;\n break;\n default:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n buf->clear();\n reset_type();\n check_non_safepoint_surprise();\n }\n break;\n\n /**/\n /*\n : (after unquoted string)\n */\n case -10:\n if (json->stack[json->top].mode == Mode::KEY) {\n state = 27;\n std::swap(buf, key);\n reset_type();\n s = -2;\n } else {\n s = 3;\n break;\n }\n /**/\n\n /*\n :\n */\n case -2:\n if (pop(json, Mode::KEY) && push(json, Mode::OBJECT)) {\n state = 28;\n break;\n }\n /*\n syntax error\n */\n case -1:\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n } else {\n /*\n Change the state and iterate.\n */\n bool is_tsimplejson = options & k_JSON_FB_THRIFT_SIMPLE_JSON;\n if (type == KindOfString) {\n if (/**/(/**/s == 3/**/ || s == 30)/**/ &&\n state != 8) {\n if (state != 4) {\n utf16_to_utf8(*buf, b);\n } else {\n switch (b) {\n case 'b': buf->append('\\b'); break;\n case 't': buf->append('\\t'); break;\n case 'n': buf->append('\\n'); break;\n case 'f': buf->append('\\f'); break;\n case 'r': buf->append('\\r'); break;\n default:\n utf16_to_utf8(*buf, b);\n break;\n }\n }\n } else if (s == 6) {\n if (UNLIKELY(is_tsimplejson)) {\n if (UNLIKELY(b != '0')) {\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n escaped_bytes = 0;\n } else {\n escaped_bytes = dehexchar(b) << 12;\n }\n } else if (s == 7) {\n if (UNLIKELY(is_tsimplejson)) {\n if (UNLIKELY(b != '0')) {\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n }\n } else {\n escaped_bytes += dehexchar(b) << 8;\n }\n } else if (s == 8) {\n escaped_bytes += dehexchar(b) << 4;\n } else if (s == 3 && state == 8) {\n escaped_bytes += dehexchar(b);\n if (UNLIKELY(is_tsimplejson)) {\n buf->append((char)escaped_bytes);\n } else {\n utf16_to_utf8(*buf, escaped_bytes);\n }\n }\n } else if ((type == kInvalidDataType || type == KindOfNull) &&\n (c == S_DIG || c == S_ZER)) {\n type = KindOfInt64;\n buf->append((char)b);\n } else if (type == KindOfInt64 && s == 24) {\n type = KindOfDouble;\n buf->append((char)b);\n } else if ((type == kInvalidDataType || type == KindOfNull ||\n type == KindOfInt64) &&\n c == S_DOT) {\n type = KindOfDouble;\n buf->append((char)b);\n } else if (type != KindOfString && c == S_QUO) {\n type = KindOfString;\n /**/qchr = b;/**/\n } else if ((type == kInvalidDataType || type == KindOfNull ||\n type == KindOfInt64 || type == KindOfDouble) &&\n ((state == 12 && s == 9) ||\n (state == 16 && s == 9))) {\n type = KindOfBoolean;\n } else if (type == kInvalidDataType && state == 19 && s == 9) {\n type = KindOfNull;\n } else if (type != KindOfString && c > S_WSP) {\n utf16_to_utf8(*buf, b);\n }\n\n state = s;\n }\n }\n\n if (state == 9 && pop(json, Mode::DONE)) {\n s_json_parser->error_code = JSON_ERROR_NONE;\n return true;\n }\n\n s_json_parser->error_code = JSON_ERROR_SYNTAX;\n return false;\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"HPHP::JSON_parser","file_name":"hphp/runtime/ext/json/JSON_parser.cpp","commit_link":"github.com/facebook/hhvm/commit/dabd48caf74995e605f1700344f1ff4a5d83441d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#35-1080ff9434a8","input":"static int jpc_pi_nextrpcl(register jpc_pi_t *pi)\n{\n\tint rlvlno;\n\tjpc_pirlvl_t *pirlvl;\n\tjpc_pchg_t *pchg;\n\tint prchind;\n\tint prcvind;\n\tint *prclyrno;\n\tint compno;\n\tjpc_picomp_t *picomp;\n\tint xstep;\n\tint ystep;\n\tuint_fast32_t r;\n\tuint_fast32_t rpx;\n\tuint_fast32_t rpy;\n\tuint_fast32_t trx0;\n\tuint_fast32_t try0;\n\n\tpchg = pi->pchg;\n\tif (!pi->prgvolfirst) {\n\t\tgoto skip;\n\t} else {\n\t\tpi->xstep = 0;\n\t\tpi->ystep = 0;\n\t\tfor (compno = 0, picomp = pi->picomps; compno < pi->numcomps;\n\t\t ++compno, ++picomp) {\n\t\t\tfor (rlvlno = 0, pirlvl = picomp->pirlvls; rlvlno <\n\t\t\t picomp->numrlvls; ++rlvlno, ++pirlvl) {\n\t\t\t\t// Check for the potential for overflow problems.\n\t\t\t\tif (pirlvl->prcwidthexpn + pi->picomp->numrlvls >\n\t\t\t\t JAS_UINTFAST32_NUMBITS - 2 ||\n\t\t\t\t pirlvl->prcheightexpn + pi->picomp->numrlvls >\n\t\t\t\t JAS_UINTFAST32_NUMBITS - 2) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\txstep = picomp->hsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t\t\t (pirlvl->prcwidthexpn + picomp->numrlvls - rlvlno - 1));\n\t\t\t\tystep = picomp->vsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t\t\t (pirlvl->prcheightexpn + picomp->numrlvls - rlvlno - 1));\n\t\t\t\tpi->xstep = (!pi->xstep) ? xstep : JAS_MIN(pi->xstep, xstep);\n\t\t\t\tpi->ystep = (!pi->ystep) ? ystep : JAS_MIN(pi->ystep, ystep);\n\t\t\t}\n\t\t}\n\t\tpi->prgvolfirst = 0;\n\t}\n\n\tfor (pi->rlvlno = pchg->rlvlnostart; pi->rlvlno < pchg->rlvlnoend &&\n\t pi->rlvlno < pi->maxrlvls; ++pi->rlvlno) {\n\t\tfor (pi->y = pi->ystart; pi->y < pi->yend; pi->y +=\n\t\t pi->ystep - (pi->y % pi->ystep)) {\n\t\t\tfor (pi->x = pi->xstart; pi->x < pi->xend; pi->x +=\n\t\t\t pi->xstep - (pi->x % pi->xstep)) {\n\t\t\t\tfor (pi->compno = pchg->compnostart,\n\t\t\t\t pi->picomp = &pi->picomps[pi->compno];\n\t\t\t\t pi->compno < JAS_CAST(int, pchg->compnoend) && pi->compno <\n\t\t\t\t pi->numcomps; ++pi->compno, ++pi->picomp) {\n\t\t\t\t\tif (pi->rlvlno >= pi->picomp->numrlvls) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tpi->pirlvl = &pi->picomp->pirlvls[pi->rlvlno];\n\t\t\t\t\tif (pi->pirlvl->numprcs == 0) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tr = pi->picomp->numrlvls - 1 - pi->rlvlno;\n\t\t\t\t\trpx = r + pi->pirlvl->prcwidthexpn;\n\t\t\t\t\trpy = r + pi->pirlvl->prcheightexpn;\n\t\t\t\t\ttrx0 = JPC_CEILDIV(pi->xstart, pi->picomp->hsamp << r);\n\t\t\t\t\ttry0 = JPC_CEILDIV(pi->ystart, pi->picomp->vsamp << r);\n\t\t\t\t\tif (((pi->x == pi->xstart &&\n\t\t\t\t\t ((trx0 << r) % (JAS_CAST(uint_fast32_t, 1) << rpx)))\n\t\t\t\t\t || !(pi->x % (JAS_CAST(uint_fast32_t, 1) << rpx))) &&\n\t\t\t\t\t ((pi->y == pi->ystart &&\n\t\t\t\t\t ((try0 << r) % (JAS_CAST(uint_fast32_t, 1) << rpy)))\n\t\t\t\t\t || !(pi->y % (JAS_CAST(uint_fast32_t, 1) << rpy)))) {\n\t\t\t\t\t\tprchind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->x,\n\t\t\t\t\t\t pi->picomp->hsamp << r), pi->pirlvl->prcwidthexpn) -\n\t\t\t\t\t\t JPC_FLOORDIVPOW2(trx0, pi->pirlvl->prcwidthexpn);\n\t\t\t\t\t\tprcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y,\n\t\t\t\t\t\t pi->picomp->vsamp << r), pi->pirlvl->prcheightexpn) -\n\t\t\t\t\t\t JPC_FLOORDIVPOW2(try0, pi->pirlvl->prcheightexpn);\n\t\t\t\t\t\tpi->prcno = prcvind * pi->pirlvl->numhprcs + prchind;\n\n\t\t\t\t\t\tassert(pi->prcno < pi->pirlvl->numprcs);\n\t\t\t\t\t\tfor (pi->lyrno = 0; pi->lyrno <\n\t\t\t\t\t\t pi->numlyrs && pi->lyrno < JAS_CAST(int,\n\t\t\t\t\t\t pchg->lyrnoend); ++pi->lyrno) {\n\t\t\t\t\t\t\tprclyrno = &pi->pirlvl->prclyrnos[pi->prcno];\n\t\t\t\t\t\t\tif (pi->lyrno >= *prclyrno) {\n\t\t\t\t\t\t\t\t++(*prclyrno);\n\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t}\nskip:\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 1;\n}","target":"static int jpc_pi_nextrpcl(register jpc_pi_t *pi)\n{\n\tint rlvlno;\n\tjpc_pirlvl_t *pirlvl;\n\tjpc_pchg_t *pchg;\n\tint prchind;\n\tint prcvind;\n\tint *prclyrno;\n\tint compno;\n\tjpc_picomp_t *picomp;\n\tint xstep;\n\tint ystep;\n\tuint_fast32_t r;\n\tuint_fast32_t rpx;\n\tuint_fast32_t rpy;\n\tuint_fast32_t trx0;\n\tuint_fast32_t try0;\n\n\tpchg = pi->pchg;\n\tif (!pi->prgvolfirst) {\n\t\tgoto skip;\n\t} else {\n\t\tpi->xstep = 0;\n\t\tpi->ystep = 0;\n\t\tfor (compno = 0, picomp = pi->picomps; compno < pi->numcomps;\n\t\t ++compno, ++picomp) {\n\t\t\tfor (rlvlno = 0, pirlvl = picomp->pirlvls; rlvlno <\n\t\t\t picomp->numrlvls; ++rlvlno, ++pirlvl) {\n\t\t\t\t// Check for the potential for overflow problems.\n\t\t\t\tif (pirlvl->prcwidthexpn + picomp->numrlvls >\n\t\t\t\t JAS_UINTFAST32_NUMBITS - 2 ||\n\t\t\t\t pirlvl->prcheightexpn + picomp->numrlvls >\n\t\t\t\t JAS_UINTFAST32_NUMBITS - 2) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\txstep = picomp->hsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t\t\t (pirlvl->prcwidthexpn + picomp->numrlvls - rlvlno - 1));\n\t\t\t\tystep = picomp->vsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t\t\t (pirlvl->prcheightexpn + picomp->numrlvls - rlvlno - 1));\n\t\t\t\tpi->xstep = (!pi->xstep) ? xstep : JAS_MIN(pi->xstep, xstep);\n\t\t\t\tpi->ystep = (!pi->ystep) ? ystep : JAS_MIN(pi->ystep, ystep);\n\t\t\t}\n\t\t}\n\t\tpi->prgvolfirst = 0;\n\t}\n\n\tfor (pi->rlvlno = pchg->rlvlnostart; pi->rlvlno < pchg->rlvlnoend &&\n\t pi->rlvlno < pi->maxrlvls; ++pi->rlvlno) {\n\t\tfor (pi->y = pi->ystart; pi->y < pi->yend; pi->y +=\n\t\t pi->ystep - (pi->y % pi->ystep)) {\n\t\t\tfor (pi->x = pi->xstart; pi->x < pi->xend; pi->x +=\n\t\t\t pi->xstep - (pi->x % pi->xstep)) {\n\t\t\t\tfor (pi->compno = pchg->compnostart,\n\t\t\t\t pi->picomp = &pi->picomps[pi->compno];\n\t\t\t\t pi->compno < JAS_CAST(int, pchg->compnoend) && pi->compno <\n\t\t\t\t pi->numcomps; ++pi->compno, ++pi->picomp) {\n\t\t\t\t\tif (pi->rlvlno >= pi->picomp->numrlvls) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tpi->pirlvl = &pi->picomp->pirlvls[pi->rlvlno];\n\t\t\t\t\tif (pi->pirlvl->numprcs == 0) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tr = pi->picomp->numrlvls - 1 - pi->rlvlno;\n\t\t\t\t\trpx = r + pi->pirlvl->prcwidthexpn;\n\t\t\t\t\trpy = r + pi->pirlvl->prcheightexpn;\n\t\t\t\t\ttrx0 = JPC_CEILDIV(pi->xstart, pi->picomp->hsamp << r);\n\t\t\t\t\ttry0 = JPC_CEILDIV(pi->ystart, pi->picomp->vsamp << r);\n\t\t\t\t\tif (((pi->x == pi->xstart &&\n\t\t\t\t\t ((trx0 << r) % (JAS_CAST(uint_fast32_t, 1) << rpx)))\n\t\t\t\t\t || !(pi->x % (JAS_CAST(uint_fast32_t, 1) << rpx))) &&\n\t\t\t\t\t ((pi->y == pi->ystart &&\n\t\t\t\t\t ((try0 << r) % (JAS_CAST(uint_fast32_t, 1) << rpy)))\n\t\t\t\t\t || !(pi->y % (JAS_CAST(uint_fast32_t, 1) << rpy)))) {\n\t\t\t\t\t\tprchind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->x,\n\t\t\t\t\t\t pi->picomp->hsamp << r), pi->pirlvl->prcwidthexpn) -\n\t\t\t\t\t\t JPC_FLOORDIVPOW2(trx0, pi->pirlvl->prcwidthexpn);\n\t\t\t\t\t\tprcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y,\n\t\t\t\t\t\t pi->picomp->vsamp << r), pi->pirlvl->prcheightexpn) -\n\t\t\t\t\t\t JPC_FLOORDIVPOW2(try0, pi->pirlvl->prcheightexpn);\n\t\t\t\t\t\tpi->prcno = prcvind * pi->pirlvl->numhprcs + prchind;\n\n\t\t\t\t\t\tassert(pi->prcno < pi->pirlvl->numprcs);\n\t\t\t\t\t\tfor (pi->lyrno = 0; pi->lyrno <\n\t\t\t\t\t\t pi->numlyrs && pi->lyrno < JAS_CAST(int,\n\t\t\t\t\t\t pchg->lyrnoend); ++pi->lyrno) {\n\t\t\t\t\t\t\tprclyrno = &pi->pirlvl->prclyrnos[pi->prcno];\n\t\t\t\t\t\t\tif (pi->lyrno >= *prclyrno) {\n\t\t\t\t\t\t\t\t++(*prclyrno);\n\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t}\nskip:\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 1;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"jpc_pi_nextrpcl","file_name":"src/libjasper/jpc/jpc_t2cod.c","commit_link":"github.com/mdadams/jasper/commit/f25486c3d4aa472fec79150f2c41ed4333395d3d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#36-08b022a35746","input":"match_at(regex_t* reg, const UChar* str, const UChar* end,\n#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE\n\t const UChar* right_range,\n#endif\n\t const UChar* sstart, UChar* sprev, OnigMatchArg* msa)\n{\n static UChar FinishCode[] = { OP_FINISH };\n\n int i, n, num_mem, best_len, pop_level;\n LengthType tlen, tlen2;\n MemNumType mem;\n RelAddrType addr;\n UChar *s, *q, *sbegin;\n int is_alloca;\n char *alloc_base;\n OnigStackType *stk_base, *stk, *stk_end;\n OnigStackType *stkp; /* used as any purpose. */\n OnigStackIndex si;\n OnigStackIndex *repeat_stk;\n OnigStackIndex *mem_start_stk, *mem_end_stk;\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n int scv;\n unsigned char* state_check_buff = msa->state_check_buff;\n int num_comb_exp_check = reg->num_comb_exp_check;\n#endif\n UChar *p = reg->p;\n OnigOptionType option = reg->options;\n OnigEncoding encode = reg->enc;\n OnigCaseFoldType case_fold_flag = reg->case_fold_flag;\n\n //n = reg->num_repeat + reg->num_mem * 2;\n pop_level = reg->stack_pop_level;\n num_mem = reg->num_mem;\n STACK_INIT(INIT_MATCH_STACK_SIZE);\n UPDATE_FOR_STACK_REALLOC;\n for (i = 1; i <= num_mem; i++) {\n mem_start_stk[i] = mem_end_stk[i] = INVALID_STACK_INDEX;\n }\n\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"match_at: str: %d, end: %d, start: %d, sprev: %d\\n\",\n\t (int )str, (int )end, (int )sstart, (int )sprev);\n fprintf(stderr, \"size: %d, start offset: %d\\n\",\n\t (int )(end - str), (int )(sstart - str));\n#endif\n\n STACK_PUSH_ENSURED(STK_ALT, FinishCode); /* bottom stack */\n best_len = ONIG_MISMATCH;\n s = (UChar* )sstart;\n while (1) {\n#ifdef ONIG_DEBUG_MATCH\n {\n UChar *q, *bp, buf[50];\n int len;\n fprintf(stderr, \"%4d> \\\"\", (int )(s - str));\n bp = buf;\n for (i = 0, q = s; i < 7 && q < end; i++) {\n\tlen = enclen(encode, q);\n\twhile (len-- > 0) *bp++ = *q++;\n }\n if (q < end) { xmemcpy(bp, \"...\\\"\", 4); bp += 4; }\n else { xmemcpy(bp, \"\\\"\", 1); bp += 1; }\n *bp = 0;\n fputs((char* )buf, stderr);\n for (i = 0; i < 20 - (bp - buf); i++) fputc(' ', stderr);\n onig_print_compiled_byte_code(stderr, p, NULL, encode);\n fprintf(stderr, \"\\n\");\n }\n#endif\n\n sbegin = s;\n switch (*p++) {\n case OP_END: MOP_IN(OP_END);\n n = s - sstart;\n if (n > best_len) {\n OnigRegion* region;\n#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE\n if (IS_FIND_LONGEST(option)) {\n if (n > msa->best_len) {\n msa->best_len = n;\n msa->best_s = (UChar* )sstart;\n }\n else\n goto end_best_len;\n }\n#endif\n best_len = n;\n region = msa->region;\n if (region) {\n#ifdef USE_POSIX_API_REGION_OPTION\n if (IS_POSIX_REGION(msa->options)) {\n posix_regmatch_t* rmt = (posix_regmatch_t* )region;\n\n rmt[0].rm_so = sstart - str;\n rmt[0].rm_eo = s - str;\n for (i = 1; i <= num_mem; i++) {\n if (mem_end_stk[i] != INVALID_STACK_INDEX) {\n if (BIT_STATUS_AT(reg->bt_mem_start, i))\n rmt[i].rm_so = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;\n else\n rmt[i].rm_so = (UChar* )((void* )(mem_start_stk[i])) - str;\n\n rmt[i].rm_eo = (BIT_STATUS_AT(reg->bt_mem_end, i)\n ? STACK_AT(mem_end_stk[i])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[i])) - str;\n }\n else {\n rmt[i].rm_so = rmt[i].rm_eo = ONIG_REGION_NOTPOS;\n }\n }\n }\n else {\n#endif /* USE_POSIX_API_REGION_OPTION */\n region->beg[0] = sstart - str;\n region->end[0] = s - str;\n for (i = 1; i <= num_mem; i++) {\n if (mem_end_stk[i] != INVALID_STACK_INDEX) {\n if (BIT_STATUS_AT(reg->bt_mem_start, i))\n region->beg[i] = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;\n else\n region->beg[i] = (UChar* )((void* )mem_start_stk[i]) - str;\n\n region->end[i] = (BIT_STATUS_AT(reg->bt_mem_end, i)\n ? STACK_AT(mem_end_stk[i])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[i])) - str;\n }\n else {\n region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS;\n }\n }\n\n#ifdef USE_CAPTURE_HISTORY\n if (reg->capture_history != 0) {\n int r;\n OnigCaptureTreeNode* node;\n\n if (IS_NULL(region->history_root)) {\n region->history_root = node = history_node_new();\n CHECK_NULL_RETURN_MEMERR(node);\n }\n else {\n node = region->history_root;\n history_tree_clear(node);\n }\n\n node->group = 0;\n node->beg = sstart - str;\n node->end = s - str;\n\n stkp = stk_base;\n r = make_capture_history_tree(region->history_root, &stkp,\n stk, (UChar* )str, reg);\n if (r < 0) {\n best_len = r; /* error code */\n goto finish;\n }\n }\n#endif /* USE_CAPTURE_HISTORY */\n#ifdef USE_POSIX_API_REGION_OPTION\n } /* else IS_POSIX_REGION() */\n#endif\n } /* if (region) */\n } /* n > best_len */\n\n#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE\n end_best_len:\n#endif\n MOP_OUT;\n\n if (IS_FIND_CONDITION(option)) {\n if (IS_FIND_NOT_EMPTY(option) && s == sstart) {\n best_len = ONIG_MISMATCH;\n goto fail; /* for retry */\n }\n if (IS_FIND_LONGEST(option) && DATA_ENSURE_CHECK1) {\n goto fail; /* for retry */\n }\n }\n\n /* default behavior: return first-matching result. */\n goto finish;\n break;\n\n case OP_EXACT1: MOP_IN(OP_EXACT1);\n#if 0\n DATA_ENSURE(1);\n if (*p != *s) goto fail;\n p++; s++;\n#endif\n if (*p != *s++) goto fail;\n DATA_ENSURE(0);\n p++;\n MOP_OUT;\n break;\n\n case OP_EXACT1_IC: MOP_IN(OP_EXACT1_IC);\n {\n int len;\n UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n DATA_ENSURE(1);\n len = ONIGENC_MBC_CASE_FOLD(encode,\n /* DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag), */\n case_fold_flag,\n &s, end, lowbuf);\n DATA_ENSURE(0);\n q = lowbuf;\n while (len-- > 0) {\n if (*p != *q) {\n goto fail;\n }\n p++; q++;\n }\n }\n MOP_OUT;\n break;\n\n case OP_EXACT2: MOP_IN(OP_EXACT2);\n DATA_ENSURE(2);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT3: MOP_IN(OP_EXACT3);\n DATA_ENSURE(3);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT4: MOP_IN(OP_EXACT4);\n DATA_ENSURE(4);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT5: MOP_IN(OP_EXACT5);\n DATA_ENSURE(5);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTN: MOP_IN(OP_EXACTN);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen);\n while (tlen-- > 0) {\n if (*p++ != *s++) goto fail;\n }\n sprev = s - 1;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTN_IC: MOP_IN(OP_EXACTN_IC);\n {\n int len;\n UChar *q, *endp, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n GET_LENGTH_INC(tlen, p);\n endp = p + tlen;\n\n while (p < endp) {\n sprev = s;\n DATA_ENSURE(1);\n len = ONIGENC_MBC_CASE_FOLD(encode,\n /* DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag), */\n case_fold_flag,\n &s, end, lowbuf);\n DATA_ENSURE(0);\n q = lowbuf;\n while (len-- > 0) {\n if (*p != *q) goto fail;\n p++; q++;\n }\n }\n }\n\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N1: MOP_IN(OP_EXACTMB2N1);\n DATA_ENSURE(2);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n break;\n\n case OP_EXACTMB2N2: MOP_IN(OP_EXACTMB2N2);\n DATA_ENSURE(4);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n sprev = s;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N3: MOP_IN(OP_EXACTMB2N3);\n DATA_ENSURE(6);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n sprev = s;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N: MOP_IN(OP_EXACTMB2N);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen * 2);\n while (tlen-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - 2;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB3N: MOP_IN(OP_EXACTMB3N);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen * 3);\n while (tlen-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - 3;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMBN: MOP_IN(OP_EXACTMBN);\n GET_LENGTH_INC(tlen, p); /* mb-len */\n GET_LENGTH_INC(tlen2, p); /* string len */\n tlen2 *= tlen;\n DATA_ENSURE(tlen2);\n while (tlen2-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - tlen;\n MOP_OUT;\n continue;\n break;\n\n case OP_CCLASS: MOP_IN(OP_CCLASS);\n DATA_ENSURE(1);\n if (BITSET_AT(((BitSetRef )p), *s) == 0) goto fail;\n p += SIZE_BITSET;\n s += enclen(encode, s); /* OP_CCLASS can match mb-code. \\D, \\S */\n MOP_OUT;\n break;\n\n case OP_CCLASS_MB: MOP_IN(OP_CCLASS_MB);\n if (! ONIGENC_IS_MBC_HEAD(encode, s)) goto fail;\n\n cclass_mb:\n GET_LENGTH_INC(tlen, p);\n {\n OnigCodePoint code;\n UChar *ss;\n int mb_len;\n\n DATA_ENSURE(1);\n mb_len = enclen(encode, s);\n DATA_ENSURE(mb_len);\n ss = s;\n s += mb_len;\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n\n#ifdef PLATFORM_UNALIGNED_WORD_ACCESS\n if (! onig_is_in_code_range(p, code)) goto fail;\n#else\n q = p;\n ALIGNMENT_RIGHT(q);\n if (! onig_is_in_code_range(q, code)) goto fail;\n#endif\n }\n p += tlen;\n MOP_OUT;\n break;\n\n case OP_CCLASS_MIX: MOP_IN(OP_CCLASS_MIX);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_HEAD(encode, s)) {\n p += SIZE_BITSET;\n goto cclass_mb;\n }\n else {\n if (BITSET_AT(((BitSetRef )p), *s) == 0)\n goto fail;\n\n p += SIZE_BITSET;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n s++;\n }\n MOP_OUT;\n break;\n\n case OP_CCLASS_NOT: MOP_IN(OP_CCLASS_NOT);\n DATA_ENSURE(1);\n if (BITSET_AT(((BitSetRef )p), *s) != 0) goto fail;\n p += SIZE_BITSET;\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_CCLASS_MB_NOT: MOP_IN(OP_CCLASS_MB_NOT);\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_HEAD(encode, s)) {\n s++;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n goto cc_mb_not_success;\n }\n\n cclass_mb_not:\n GET_LENGTH_INC(tlen, p);\n {\n OnigCodePoint code;\n UChar *ss;\n int mb_len = enclen(encode, s);\n\n if (! DATA_ENSURE_CHECK(mb_len)) {\n DATA_ENSURE(1);\n s = (UChar* )end;\n p += tlen;\n goto cc_mb_not_success;\n }\n\n ss = s;\n s += mb_len;\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n\n#ifdef PLATFORM_UNALIGNED_WORD_ACCESS\n if (onig_is_in_code_range(p, code)) goto fail;\n#else\n q = p;\n ALIGNMENT_RIGHT(q);\n if (onig_is_in_code_range(q, code)) goto fail;\n#endif\n }\n p += tlen;\n\n cc_mb_not_success:\n MOP_OUT;\n break;\n\n case OP_CCLASS_MIX_NOT: MOP_IN(OP_CCLASS_MIX_NOT);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_HEAD(encode, s)) {\n p += SIZE_BITSET;\n goto cclass_mb_not;\n }\n else {\n if (BITSET_AT(((BitSetRef )p), *s) != 0)\n goto fail;\n\n p += SIZE_BITSET;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n s++;\n }\n MOP_OUT;\n break;\n\n case OP_CCLASS_NODE: MOP_IN(OP_CCLASS_NODE);\n {\n OnigCodePoint code;\n void *node;\n int mb_len;\n UChar *ss;\n\n DATA_ENSURE(1);\n GET_POINTER_INC(node, p);\n mb_len = enclen(encode, s);\n ss = s;\n s += mb_len;\n DATA_ENSURE(0);\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n if (onig_is_code_in_cc_len(mb_len, code, node) == 0) goto fail;\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR: MOP_IN(OP_ANYCHAR);\n DATA_ENSURE(1);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n s += n;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML: MOP_IN(OP_ANYCHAR_ML);\n DATA_ENSURE(1);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n s += n;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_STAR: MOP_IN(OP_ANYCHAR_STAR);\n while (DATA_ENSURE_CHECK1) {\n STACK_PUSH_ALT(p, s, sprev);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML_STAR: MOP_IN(OP_ANYCHAR_ML_STAR);\n while (DATA_ENSURE_CHECK1) {\n STACK_PUSH_ALT(p, s, sprev);\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_STAR_PEEK_NEXT: MOP_IN(OP_ANYCHAR_STAR_PEEK_NEXT);\n while (DATA_ENSURE_CHECK1) {\n if (*p == *s) {\n STACK_PUSH_ALT(p + 1, s, sprev);\n }\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n p++;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML_STAR_PEEK_NEXT:MOP_IN(OP_ANYCHAR_ML_STAR_PEEK_NEXT);\n while (DATA_ENSURE_CHECK1) {\n if (*p == *s) {\n STACK_PUSH_ALT(p + 1, s, sprev);\n }\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n p++;\n MOP_OUT;\n break;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n case OP_STATE_CHECK_ANYCHAR_STAR: MOP_IN(OP_STATE_CHECK_ANYCHAR_STAR);\n GET_STATE_CHECK_NUM_INC(mem, p);\n while (DATA_ENSURE_CHECK1) {\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n MOP_OUT;\n break;\n\n case OP_STATE_CHECK_ANYCHAR_ML_STAR:\n MOP_IN(OP_STATE_CHECK_ANYCHAR_ML_STAR);\n\n GET_STATE_CHECK_NUM_INC(mem, p);\n while (DATA_ENSURE_CHECK1) {\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem);\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n MOP_OUT;\n break;\n#endif /* USE_COMBINATION_EXPLOSION_CHECK */\n\n case OP_WORD: MOP_IN(OP_WORD);\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_NOT_WORD: MOP_IN(OP_NOT_WORD);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_WORD_BOUND: MOP_IN(OP_WORD_BOUND);\n if (ON_STR_BEGIN(s)) {\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n }\n else if (ON_STR_END(s)) {\n if (! ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n else {\n if (ONIGENC_IS_MBC_WORD(encode, s, end)\n == ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_NOT_WORD_BOUND: MOP_IN(OP_NOT_WORD_BOUND);\n if (ON_STR_BEGIN(s)) {\n if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n }\n else if (ON_STR_END(s)) {\n if (ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n else {\n if (ONIGENC_IS_MBC_WORD(encode, s, end)\n != ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_WORD_BEGIN_END\n case OP_WORD_BEGIN: MOP_IN(OP_WORD_BEGIN);\n if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end)) {\n if (ON_STR_BEGIN(s) || !ONIGENC_IS_MBC_WORD(encode, sprev, end)) {\n MOP_OUT;\n continue;\n }\n }\n goto fail;\n break;\n\n case OP_WORD_END: MOP_IN(OP_WORD_END);\n if (!ON_STR_BEGIN(s) && ONIGENC_IS_MBC_WORD(encode, sprev, end)) {\n if (ON_STR_END(s) || !ONIGENC_IS_MBC_WORD(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n }\n goto fail;\n break;\n#endif\n\n case OP_BEGIN_BUF: MOP_IN(OP_BEGIN_BUF);\n if (! ON_STR_BEGIN(s)) goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_END_BUF: MOP_IN(OP_END_BUF);\n if (! ON_STR_END(s)) goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_BEGIN_LINE: MOP_IN(OP_BEGIN_LINE);\n if (ON_STR_BEGIN(s)) {\n if (IS_NOTBOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, sprev, end) && !ON_STR_END(s)) {\n MOP_OUT;\n continue;\n }\n goto fail;\n break;\n\n case OP_END_LINE: MOP_IN(OP_END_LINE);\n if (ON_STR_END(s)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) {\n#endif\n if (IS_NOTEOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n }\n#endif\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n#endif\n goto fail;\n break;\n\n case OP_SEMI_END_BUF: MOP_IN(OP_SEMI_END_BUF);\n if (ON_STR_END(s)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) {\n#endif\n if (IS_NOTEOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n }\n#endif\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end) &&\n ON_STR_END(s + enclen(encode, s))) {\n MOP_OUT;\n continue;\n }\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) {\n UChar* ss = s + enclen(encode, s);\n ss += enclen(encode, ss);\n if (ON_STR_END(ss)) {\n MOP_OUT;\n continue;\n }\n }\n#endif\n goto fail;\n break;\n\n case OP_BEGIN_POSITION: MOP_IN(OP_BEGIN_POSITION);\n if (s != msa->start)\n goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_START_PUSH: MOP_IN(OP_MEMORY_START_PUSH);\n GET_MEMNUM_INC(mem, p);\n STACK_PUSH_MEM_START(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_START: MOP_IN(OP_MEMORY_START);\n GET_MEMNUM_INC(mem, p);\n mem_start_stk[mem] = (OnigStackIndex )((void* )s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END_PUSH: MOP_IN(OP_MEMORY_END_PUSH);\n GET_MEMNUM_INC(mem, p);\n STACK_PUSH_MEM_END(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END: MOP_IN(OP_MEMORY_END);\n GET_MEMNUM_INC(mem, p);\n mem_end_stk[mem] = (OnigStackIndex )((void* )s);\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_SUBEXP_CALL\n case OP_MEMORY_END_PUSH_REC: MOP_IN(OP_MEMORY_END_PUSH_REC);\n GET_MEMNUM_INC(mem, p);\n STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */\n STACK_PUSH_MEM_END(mem, s);\n mem_start_stk[mem] = GET_STACK_INDEX(stkp);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END_REC: MOP_IN(OP_MEMORY_END_REC);\n GET_MEMNUM_INC(mem, p);\n mem_end_stk[mem] = (OnigStackIndex )((void* )s);\n STACK_GET_MEM_START(mem, stkp);\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n mem_start_stk[mem] = GET_STACK_INDEX(stkp);\n else\n mem_start_stk[mem] = (OnigStackIndex )((void* )stkp->u.mem.pstr);\n\n STACK_PUSH_MEM_END_MARK(mem);\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_BACKREF1: MOP_IN(OP_BACKREF1);\n mem = 1;\n goto backref;\n break;\n\n case OP_BACKREF2: MOP_IN(OP_BACKREF2);\n mem = 2;\n goto backref;\n break;\n\n case OP_BACKREFN: MOP_IN(OP_BACKREFN);\n GET_MEMNUM_INC(mem, p);\n backref:\n {\n int len;\n UChar *pstart, *pend;\n\n /* if you want to remove following line, \n you should check in parse and compile time. */\n if (mem > num_mem) goto fail;\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n STRING_CMP(pstart, s, n);\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREFN_IC: MOP_IN(OP_BACKREFN_IC);\n GET_MEMNUM_INC(mem, p);\n {\n int len;\n UChar *pstart, *pend;\n\n /* if you want to remove following line, \n you should check in parse and compile time. */\n if (mem > num_mem) goto fail;\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n STRING_CMP_IC(case_fold_flag, pstart, &s, n);\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREF_MULTI: MOP_IN(OP_BACKREF_MULTI);\n {\n int len, is_fail;\n UChar *pstart, *pend, *swork;\n\n GET_LENGTH_INC(tlen, p);\n for (i = 0; i < tlen; i++) {\n GET_MEMNUM_INC(mem, p);\n\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n swork = s;\n STRING_CMP_VALUE(pstart, swork, n, is_fail);\n if (is_fail) continue;\n s = swork;\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * (tlen - i - 1));\n break; /* success */\n }\n if (i == tlen) goto fail;\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREF_MULTI_IC: MOP_IN(OP_BACKREF_MULTI_IC);\n {\n int len, is_fail;\n UChar *pstart, *pend, *swork;\n\n GET_LENGTH_INC(tlen, p);\n for (i = 0; i < tlen; i++) {\n GET_MEMNUM_INC(mem, p);\n\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n swork = s;\n STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, n, is_fail);\n if (is_fail) continue;\n s = swork;\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * (tlen - i - 1));\n break; /* success */\n }\n if (i == tlen) goto fail;\n MOP_OUT;\n continue;\n }\n break;\n\n#ifdef USE_BACKREF_WITH_LEVEL\n case OP_BACKREF_WITH_LEVEL:\n {\n int len;\n OnigOptionType ic;\n LengthType level;\n\n GET_OPTION_INC(ic, p);\n GET_LENGTH_INC(level, p);\n GET_LENGTH_INC(tlen, p);\n\n sprev = s;\n if (backref_match_at_nested_level(reg, stk, stk_base, ic\n , case_fold_flag, (int )level, (int )tlen, p, &s, end)) {\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * tlen);\n }\n else\n goto fail;\n\n MOP_OUT;\n continue;\n }\n break;\n#endif\n\n#if 0 /* no need: IS_DYNAMIC_OPTION() == 0 */\n case OP_SET_OPTION_PUSH: MOP_IN(OP_SET_OPTION_PUSH);\n GET_OPTION_INC(option, p);\n STACK_PUSH_ALT(p, s, sprev);\n p += SIZE_OP_SET_OPTION + SIZE_OP_FAIL;\n MOP_OUT;\n continue;\n break;\n\n case OP_SET_OPTION: MOP_IN(OP_SET_OPTION);\n GET_OPTION_INC(option, p);\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_NULL_CHECK_START: MOP_IN(OP_NULL_CHECK_START);\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_PUSH_NULL_CHECK_START(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_NULL_CHECK_END: MOP_IN(OP_NULL_CHECK_END);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_NULL_CHECK(isnull, mem, s);\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n null_check_found:\n /* empty loop founded, skip next instruction */\n switch (*p++) {\n case OP_JUMP:\n case OP_PUSH:\n p += SIZE_RELADDR;\n break;\n case OP_REPEAT_INC:\n case OP_REPEAT_INC_NG:\n case OP_REPEAT_INC_SG:\n case OP_REPEAT_INC_NG_SG:\n p += SIZE_MEMNUM;\n break;\n default:\n goto unexpected_bytecode_error;\n break;\n }\n }\n }\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT\n case OP_NULL_CHECK_END_MEMST: MOP_IN(OP_NULL_CHECK_END_MEMST);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_NULL_CHECK_MEMST(isnull, mem, s, reg);\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END_MEMST: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n if (isnull == -1) goto fail;\n goto \tnull_check_found;\n }\n }\n MOP_OUT;\n continue;\n break;\n#endif\n\n#ifdef USE_SUBEXP_CALL\n case OP_NULL_CHECK_END_MEMST_PUSH:\n MOP_IN(OP_NULL_CHECK_END_MEMST_PUSH);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT\n STACK_NULL_CHECK_MEMST_REC(isnull, mem, s, reg);\n#else\n STACK_NULL_CHECK_REC(isnull, mem, s);\n#endif\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END_MEMST_PUSH: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n if (isnull == -1) goto fail;\n goto \tnull_check_found;\n }\n else {\n STACK_PUSH_NULL_CHECK_END(mem);\n }\n }\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_JUMP: MOP_IN(OP_JUMP);\n GET_RELADDR_INC(addr, p);\n p += addr;\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_PUSH: MOP_IN(OP_PUSH);\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n case OP_STATE_CHECK_PUSH: MOP_IN(OP_STATE_CHECK_PUSH);\n GET_STATE_CHECK_NUM_INC(mem, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem);\n MOP_OUT;\n continue;\n break;\n\n case OP_STATE_CHECK_PUSH_OR_JUMP: MOP_IN(OP_STATE_CHECK_PUSH_OR_JUMP);\n GET_STATE_CHECK_NUM_INC(mem, p);\n GET_RELADDR_INC(addr, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) {\n p += addr;\n }\n else {\n STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem);\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_STATE_CHECK: MOP_IN(OP_STATE_CHECK);\n GET_STATE_CHECK_NUM_INC(mem, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_STATE_CHECK(s, mem);\n MOP_OUT;\n continue;\n break;\n#endif /* USE_COMBINATION_EXPLOSION_CHECK */\n\n case OP_POP: MOP_IN(OP_POP);\n STACK_POP_ONE;\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_OR_JUMP_EXACT1: MOP_IN(OP_PUSH_OR_JUMP_EXACT1);\n GET_RELADDR_INC(addr, p);\n if (*p == *s && DATA_ENSURE_CHECK1) {\n p++;\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n }\n p += (addr + 1);\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_IF_PEEK_NEXT: MOP_IN(OP_PUSH_IF_PEEK_NEXT);\n GET_RELADDR_INC(addr, p);\n if (*p == *s) {\n p++;\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n }\n p++;\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT: MOP_IN(OP_REPEAT);\n {\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n GET_RELADDR_INC(addr, p);\n\n STACK_ENSURE(1);\n repeat_stk[mem] = GET_STACK_INDEX(stk);\n STACK_PUSH_REPEAT(mem, p);\n\n if (reg->repeat_range[mem].lower == 0) {\n STACK_PUSH_ALT(p + addr, s, sprev);\n }\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT_NG: MOP_IN(OP_REPEAT_NG);\n {\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n GET_RELADDR_INC(addr, p);\n\n STACK_ENSURE(1);\n repeat_stk[mem] = GET_STACK_INDEX(stk);\n STACK_PUSH_REPEAT(mem, p);\n\n if (reg->repeat_range[mem].lower == 0) {\n STACK_PUSH_ALT(p, s, sprev);\n p += addr;\n }\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT_INC: MOP_IN(OP_REPEAT_INC);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n si = repeat_stk[mem];\n stkp = STACK_AT(si);\n\n repeat_inc:\n stkp->u.repeat.count++;\n if (stkp->u.repeat.count >= reg->repeat_range[mem].upper) {\n /* end of repeat. Nothing to do. */\n }\n else if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) {\n STACK_PUSH_ALT(p, s, sprev);\n p = STACK_AT(si)->u.repeat.pcode; /* Don't use stkp after PUSH. */\n }\n else {\n p = stkp->u.repeat.pcode;\n }\n STACK_PUSH_REPEAT_INC(si);\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_REPEAT_INC_SG: MOP_IN(OP_REPEAT_INC_SG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n STACK_GET_REPEAT(mem, stkp);\n si = GET_STACK_INDEX(stkp);\n goto repeat_inc;\n break;\n\n case OP_REPEAT_INC_NG: MOP_IN(OP_REPEAT_INC_NG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n si = repeat_stk[mem];\n stkp = STACK_AT(si);\n\n repeat_inc_ng:\n stkp->u.repeat.count++;\n if (stkp->u.repeat.count < reg->repeat_range[mem].upper) {\n if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) {\n UChar* pcode = stkp->u.repeat.pcode;\n\n STACK_PUSH_REPEAT_INC(si);\n STACK_PUSH_ALT(pcode, s, sprev);\n }\n else {\n p = stkp->u.repeat.pcode;\n STACK_PUSH_REPEAT_INC(si);\n }\n }\n else if (stkp->u.repeat.count == reg->repeat_range[mem].upper) {\n STACK_PUSH_REPEAT_INC(si);\n }\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_REPEAT_INC_NG_SG: MOP_IN(OP_REPEAT_INC_NG_SG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n STACK_GET_REPEAT(mem, stkp);\n si = GET_STACK_INDEX(stkp);\n goto repeat_inc_ng;\n break;\n\n case OP_PUSH_POS: MOP_IN(OP_PUSH_POS);\n STACK_PUSH_POS(s, sprev);\n MOP_OUT;\n continue;\n break;\n\n case OP_POP_POS: MOP_IN(OP_POP_POS);\n {\n STACK_POS_END(stkp);\n s = stkp->u.state.pstr;\n sprev = stkp->u.state.pstr_prev;\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_POS_NOT: MOP_IN(OP_PUSH_POS_NOT);\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_POS_NOT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n break;\n\n case OP_FAIL_POS: MOP_IN(OP_FAIL_POS);\n STACK_POP_TIL_POS_NOT;\n goto fail;\n break;\n\n case OP_PUSH_STOP_BT: MOP_IN(OP_PUSH_STOP_BT);\n STACK_PUSH_STOP_BT;\n MOP_OUT;\n continue;\n break;\n\n case OP_POP_STOP_BT: MOP_IN(OP_POP_STOP_BT);\n STACK_STOP_BT_END;\n MOP_OUT;\n continue;\n break;\n\n case OP_LOOK_BEHIND: MOP_IN(OP_LOOK_BEHIND);\n GET_LENGTH_INC(tlen, p);\n s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen);\n if (IS_NULL(s)) goto fail;\n sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_LOOK_BEHIND_NOT: MOP_IN(OP_PUSH_LOOK_BEHIND_NOT);\n GET_RELADDR_INC(addr, p);\n GET_LENGTH_INC(tlen, p);\n q = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen);\n if (IS_NULL(q)) {\n /* too short case -> success. ex. /(?p + addr;\n MOP_OUT;\n continue;\n break;\n\n case OP_RETURN: MOP_IN(OP_RETURN);\n STACK_RETURN(p);\n STACK_PUSH_RETURN;\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_FINISH:\n goto finish;\n break;\n\n fail:\n MOP_OUT;\n /* fall */\n case OP_FAIL: MOP_IN(OP_FAIL);\n STACK_POP;\n p = stk->u.state.pcode;\n s = stk->u.state.pstr;\n sprev = stk->u.state.pstr_prev;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n if (stk->u.state.state_check != 0) {\n stk->type = STK_STATE_CHECK_MARK;\n stk++;\n }\n#endif\n\n MOP_OUT;\n continue;\n break;\n\n default:\n goto bytecode_error;\n\n } /* end of switch */\n sprev = sbegin;\n } /* end of while(1) */\n\n finish:\n STACK_SAVE;\n return best_len;\n\n#ifdef ONIG_DEBUG\n stack_error:\n STACK_SAVE;\n return ONIGERR_STACK_BUG;\n#endif\n\n bytecode_error:\n STACK_SAVE;\n return ONIGERR_UNDEFINED_BYTECODE;\n\n unexpected_bytecode_error:\n STACK_SAVE;\n return ONIGERR_UNEXPECTED_BYTECODE;\n}","target":"match_at(regex_t* reg, const UChar* str, const UChar* end,\n#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE\n\t const UChar* right_range,\n#endif\n\t const UChar* sstart, UChar* sprev, OnigMatchArg* msa)\n{\n static UChar FinishCode[] = { OP_FINISH };\n\n int i, n, num_mem, best_len, pop_level;\n LengthType tlen, tlen2;\n MemNumType mem;\n RelAddrType addr;\n UChar *s, *q, *sbegin;\n int is_alloca;\n char *alloc_base;\n OnigStackType *stk_base, *stk, *stk_end;\n OnigStackType *stkp; /* used as any purpose. */\n OnigStackIndex si;\n OnigStackIndex *repeat_stk;\n OnigStackIndex *mem_start_stk, *mem_end_stk;\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n int scv;\n unsigned char* state_check_buff = msa->state_check_buff;\n int num_comb_exp_check = reg->num_comb_exp_check;\n#endif\n UChar *p = reg->p;\n OnigOptionType option = reg->options;\n OnigEncoding encode = reg->enc;\n OnigCaseFoldType case_fold_flag = reg->case_fold_flag;\n\n //n = reg->num_repeat + reg->num_mem * 2;\n pop_level = reg->stack_pop_level;\n num_mem = reg->num_mem;\n STACK_INIT(INIT_MATCH_STACK_SIZE);\n UPDATE_FOR_STACK_REALLOC;\n for (i = 1; i <= num_mem; i++) {\n mem_start_stk[i] = mem_end_stk[i] = INVALID_STACK_INDEX;\n }\n\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"match_at: str: %d, end: %d, start: %d, sprev: %d\\n\",\n\t (int )str, (int )end, (int )sstart, (int )sprev);\n fprintf(stderr, \"size: %d, start offset: %d\\n\",\n\t (int )(end - str), (int )(sstart - str));\n#endif\n\n STACK_PUSH_ENSURED(STK_ALT, FinishCode); /* bottom stack */\n best_len = ONIG_MISMATCH;\n s = (UChar* )sstart;\n while (1) {\n#ifdef ONIG_DEBUG_MATCH\n {\n UChar *q, *bp, buf[50];\n int len;\n fprintf(stderr, \"%4d> \\\"\", (int )(s - str));\n bp = buf;\n for (i = 0, q = s; i < 7 && q < end; i++) {\n\tlen = enclen(encode, q);\n\twhile (len-- > 0) *bp++ = *q++;\n }\n if (q < end) { xmemcpy(bp, \"...\\\"\", 4); bp += 4; }\n else { xmemcpy(bp, \"\\\"\", 1); bp += 1; }\n *bp = 0;\n fputs((char* )buf, stderr);\n for (i = 0; i < 20 - (bp - buf); i++) fputc(' ', stderr);\n onig_print_compiled_byte_code(stderr, p, NULL, encode);\n fprintf(stderr, \"\\n\");\n }\n#endif\n\n sbegin = s;\n switch (*p++) {\n case OP_END: MOP_IN(OP_END);\n n = s - sstart;\n if (n > best_len) {\n OnigRegion* region;\n#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE\n if (IS_FIND_LONGEST(option)) {\n if (n > msa->best_len) {\n msa->best_len = n;\n msa->best_s = (UChar* )sstart;\n }\n else\n goto end_best_len;\n }\n#endif\n best_len = n;\n region = msa->region;\n if (region) {\n#ifdef USE_POSIX_API_REGION_OPTION\n if (IS_POSIX_REGION(msa->options)) {\n posix_regmatch_t* rmt = (posix_regmatch_t* )region;\n\n rmt[0].rm_so = sstart - str;\n rmt[0].rm_eo = s - str;\n for (i = 1; i <= num_mem; i++) {\n if (mem_end_stk[i] != INVALID_STACK_INDEX) {\n if (BIT_STATUS_AT(reg->bt_mem_start, i))\n rmt[i].rm_so = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;\n else\n rmt[i].rm_so = (UChar* )((void* )(mem_start_stk[i])) - str;\n\n rmt[i].rm_eo = (BIT_STATUS_AT(reg->bt_mem_end, i)\n ? STACK_AT(mem_end_stk[i])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[i])) - str;\n }\n else {\n rmt[i].rm_so = rmt[i].rm_eo = ONIG_REGION_NOTPOS;\n }\n }\n }\n else {\n#endif /* USE_POSIX_API_REGION_OPTION */\n region->beg[0] = sstart - str;\n region->end[0] = s - str;\n for (i = 1; i <= num_mem; i++) {\n if (mem_end_stk[i] != INVALID_STACK_INDEX) {\n if (BIT_STATUS_AT(reg->bt_mem_start, i))\n region->beg[i] = STACK_AT(mem_start_stk[i])->u.mem.pstr - str;\n else\n region->beg[i] = (UChar* )((void* )mem_start_stk[i]) - str;\n\n region->end[i] = (BIT_STATUS_AT(reg->bt_mem_end, i)\n ? STACK_AT(mem_end_stk[i])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[i])) - str;\n }\n else {\n region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS;\n }\n }\n\n#ifdef USE_CAPTURE_HISTORY\n if (reg->capture_history != 0) {\n int r;\n OnigCaptureTreeNode* node;\n\n if (IS_NULL(region->history_root)) {\n region->history_root = node = history_node_new();\n CHECK_NULL_RETURN_MEMERR(node);\n }\n else {\n node = region->history_root;\n history_tree_clear(node);\n }\n\n node->group = 0;\n node->beg = sstart - str;\n node->end = s - str;\n\n stkp = stk_base;\n r = make_capture_history_tree(region->history_root, &stkp,\n stk, (UChar* )str, reg);\n if (r < 0) {\n best_len = r; /* error code */\n goto finish;\n }\n }\n#endif /* USE_CAPTURE_HISTORY */\n#ifdef USE_POSIX_API_REGION_OPTION\n } /* else IS_POSIX_REGION() */\n#endif\n } /* if (region) */\n } /* n > best_len */\n\n#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE\n end_best_len:\n#endif\n MOP_OUT;\n\n if (IS_FIND_CONDITION(option)) {\n if (IS_FIND_NOT_EMPTY(option) && s == sstart) {\n best_len = ONIG_MISMATCH;\n goto fail; /* for retry */\n }\n if (IS_FIND_LONGEST(option) && DATA_ENSURE_CHECK1) {\n goto fail; /* for retry */\n }\n }\n\n /* default behavior: return first-matching result. */\n goto finish;\n break;\n\n case OP_EXACT1: MOP_IN(OP_EXACT1);\n DATA_ENSURE(1);\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n break;\n\n case OP_EXACT1_IC: MOP_IN(OP_EXACT1_IC);\n {\n int len;\n UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n DATA_ENSURE(1);\n len = ONIGENC_MBC_CASE_FOLD(encode,\n /* DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag), */\n case_fold_flag,\n &s, end, lowbuf);\n DATA_ENSURE(0);\n q = lowbuf;\n while (len-- > 0) {\n if (*p != *q) {\n goto fail;\n }\n p++; q++;\n }\n }\n MOP_OUT;\n break;\n\n case OP_EXACT2: MOP_IN(OP_EXACT2);\n DATA_ENSURE(2);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT3: MOP_IN(OP_EXACT3);\n DATA_ENSURE(3);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT4: MOP_IN(OP_EXACT4);\n DATA_ENSURE(4);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACT5: MOP_IN(OP_EXACT5);\n DATA_ENSURE(5);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n sprev = s;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTN: MOP_IN(OP_EXACTN);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen);\n while (tlen-- > 0) {\n if (*p++ != *s++) goto fail;\n }\n sprev = s - 1;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTN_IC: MOP_IN(OP_EXACTN_IC);\n {\n int len;\n UChar *q, *endp, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n GET_LENGTH_INC(tlen, p);\n endp = p + tlen;\n\n while (p < endp) {\n sprev = s;\n DATA_ENSURE(1);\n len = ONIGENC_MBC_CASE_FOLD(encode,\n /* DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag), */\n case_fold_flag,\n &s, end, lowbuf);\n DATA_ENSURE(0);\n q = lowbuf;\n while (len-- > 0) {\n if (*p != *q) goto fail;\n p++; q++;\n }\n }\n }\n\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N1: MOP_IN(OP_EXACTMB2N1);\n DATA_ENSURE(2);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n break;\n\n case OP_EXACTMB2N2: MOP_IN(OP_EXACTMB2N2);\n DATA_ENSURE(4);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n sprev = s;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N3: MOP_IN(OP_EXACTMB2N3);\n DATA_ENSURE(6);\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n sprev = s;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB2N: MOP_IN(OP_EXACTMB2N);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen * 2);\n while (tlen-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - 2;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMB3N: MOP_IN(OP_EXACTMB3N);\n GET_LENGTH_INC(tlen, p);\n DATA_ENSURE(tlen * 3);\n while (tlen-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - 3;\n MOP_OUT;\n continue;\n break;\n\n case OP_EXACTMBN: MOP_IN(OP_EXACTMBN);\n GET_LENGTH_INC(tlen, p); /* mb-len */\n GET_LENGTH_INC(tlen2, p); /* string len */\n tlen2 *= tlen;\n DATA_ENSURE(tlen2);\n while (tlen2-- > 0) {\n if (*p != *s) goto fail;\n p++; s++;\n }\n sprev = s - tlen;\n MOP_OUT;\n continue;\n break;\n\n case OP_CCLASS: MOP_IN(OP_CCLASS);\n DATA_ENSURE(1);\n if (BITSET_AT(((BitSetRef )p), *s) == 0) goto fail;\n p += SIZE_BITSET;\n s += enclen(encode, s); /* OP_CCLASS can match mb-code. \\D, \\S */\n MOP_OUT;\n break;\n\n case OP_CCLASS_MB: MOP_IN(OP_CCLASS_MB);\n if (! ONIGENC_IS_MBC_HEAD(encode, s)) goto fail;\n\n cclass_mb:\n GET_LENGTH_INC(tlen, p);\n {\n OnigCodePoint code;\n UChar *ss;\n int mb_len;\n\n DATA_ENSURE(1);\n mb_len = enclen(encode, s);\n DATA_ENSURE(mb_len);\n ss = s;\n s += mb_len;\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n\n#ifdef PLATFORM_UNALIGNED_WORD_ACCESS\n if (! onig_is_in_code_range(p, code)) goto fail;\n#else\n q = p;\n ALIGNMENT_RIGHT(q);\n if (! onig_is_in_code_range(q, code)) goto fail;\n#endif\n }\n p += tlen;\n MOP_OUT;\n break;\n\n case OP_CCLASS_MIX: MOP_IN(OP_CCLASS_MIX);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_HEAD(encode, s)) {\n p += SIZE_BITSET;\n goto cclass_mb;\n }\n else {\n if (BITSET_AT(((BitSetRef )p), *s) == 0)\n goto fail;\n\n p += SIZE_BITSET;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n s++;\n }\n MOP_OUT;\n break;\n\n case OP_CCLASS_NOT: MOP_IN(OP_CCLASS_NOT);\n DATA_ENSURE(1);\n if (BITSET_AT(((BitSetRef )p), *s) != 0) goto fail;\n p += SIZE_BITSET;\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_CCLASS_MB_NOT: MOP_IN(OP_CCLASS_MB_NOT);\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_HEAD(encode, s)) {\n s++;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n goto cc_mb_not_success;\n }\n\n cclass_mb_not:\n GET_LENGTH_INC(tlen, p);\n {\n OnigCodePoint code;\n UChar *ss;\n int mb_len = enclen(encode, s);\n\n if (! DATA_ENSURE_CHECK(mb_len)) {\n DATA_ENSURE(1);\n s = (UChar* )end;\n p += tlen;\n goto cc_mb_not_success;\n }\n\n ss = s;\n s += mb_len;\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n\n#ifdef PLATFORM_UNALIGNED_WORD_ACCESS\n if (onig_is_in_code_range(p, code)) goto fail;\n#else\n q = p;\n ALIGNMENT_RIGHT(q);\n if (onig_is_in_code_range(q, code)) goto fail;\n#endif\n }\n p += tlen;\n\n cc_mb_not_success:\n MOP_OUT;\n break;\n\n case OP_CCLASS_MIX_NOT: MOP_IN(OP_CCLASS_MIX_NOT);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_HEAD(encode, s)) {\n p += SIZE_BITSET;\n goto cclass_mb_not;\n }\n else {\n if (BITSET_AT(((BitSetRef )p), *s) != 0)\n goto fail;\n\n p += SIZE_BITSET;\n GET_LENGTH_INC(tlen, p);\n p += tlen;\n s++;\n }\n MOP_OUT;\n break;\n\n case OP_CCLASS_NODE: MOP_IN(OP_CCLASS_NODE);\n {\n OnigCodePoint code;\n void *node;\n int mb_len;\n UChar *ss;\n\n DATA_ENSURE(1);\n GET_POINTER_INC(node, p);\n mb_len = enclen(encode, s);\n ss = s;\n s += mb_len;\n DATA_ENSURE(0);\n code = ONIGENC_MBC_TO_CODE(encode, ss, s);\n if (onig_is_code_in_cc_len(mb_len, code, node) == 0) goto fail;\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR: MOP_IN(OP_ANYCHAR);\n DATA_ENSURE(1);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n s += n;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML: MOP_IN(OP_ANYCHAR_ML);\n DATA_ENSURE(1);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n s += n;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_STAR: MOP_IN(OP_ANYCHAR_STAR);\n while (DATA_ENSURE_CHECK1) {\n STACK_PUSH_ALT(p, s, sprev);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML_STAR: MOP_IN(OP_ANYCHAR_ML_STAR);\n while (DATA_ENSURE_CHECK1) {\n STACK_PUSH_ALT(p, s, sprev);\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_STAR_PEEK_NEXT: MOP_IN(OP_ANYCHAR_STAR_PEEK_NEXT);\n while (DATA_ENSURE_CHECK1) {\n if (*p == *s) {\n STACK_PUSH_ALT(p + 1, s, sprev);\n }\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n p++;\n MOP_OUT;\n break;\n\n case OP_ANYCHAR_ML_STAR_PEEK_NEXT:MOP_IN(OP_ANYCHAR_ML_STAR_PEEK_NEXT);\n while (DATA_ENSURE_CHECK1) {\n if (*p == *s) {\n STACK_PUSH_ALT(p + 1, s, sprev);\n }\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n p++;\n MOP_OUT;\n break;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n case OP_STATE_CHECK_ANYCHAR_STAR: MOP_IN(OP_STATE_CHECK_ANYCHAR_STAR);\n GET_STATE_CHECK_NUM_INC(mem, p);\n while (DATA_ENSURE_CHECK1) {\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem);\n n = enclen(encode, s);\n DATA_ENSURE(n);\n if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail;\n sprev = s;\n s += n;\n }\n MOP_OUT;\n break;\n\n case OP_STATE_CHECK_ANYCHAR_ML_STAR:\n MOP_IN(OP_STATE_CHECK_ANYCHAR_ML_STAR);\n\n GET_STATE_CHECK_NUM_INC(mem, p);\n while (DATA_ENSURE_CHECK1) {\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem);\n n = enclen(encode, s);\n if (n > 1) {\n DATA_ENSURE(n);\n sprev = s;\n s += n;\n }\n else {\n sprev = s;\n s++;\n }\n }\n MOP_OUT;\n break;\n#endif /* USE_COMBINATION_EXPLOSION_CHECK */\n\n case OP_WORD: MOP_IN(OP_WORD);\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_NOT_WORD: MOP_IN(OP_NOT_WORD);\n DATA_ENSURE(1);\n if (ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n\n s += enclen(encode, s);\n MOP_OUT;\n break;\n\n case OP_WORD_BOUND: MOP_IN(OP_WORD_BOUND);\n if (ON_STR_BEGIN(s)) {\n DATA_ENSURE(1);\n if (! ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n }\n else if (ON_STR_END(s)) {\n if (! ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n else {\n if (ONIGENC_IS_MBC_WORD(encode, s, end)\n == ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_NOT_WORD_BOUND: MOP_IN(OP_NOT_WORD_BOUND);\n if (ON_STR_BEGIN(s)) {\n if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end))\n goto fail;\n }\n else if (ON_STR_END(s)) {\n if (ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n else {\n if (ONIGENC_IS_MBC_WORD(encode, s, end)\n != ONIGENC_IS_MBC_WORD(encode, sprev, end))\n goto fail;\n }\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_WORD_BEGIN_END\n case OP_WORD_BEGIN: MOP_IN(OP_WORD_BEGIN);\n if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end)) {\n if (ON_STR_BEGIN(s) || !ONIGENC_IS_MBC_WORD(encode, sprev, end)) {\n MOP_OUT;\n continue;\n }\n }\n goto fail;\n break;\n\n case OP_WORD_END: MOP_IN(OP_WORD_END);\n if (!ON_STR_BEGIN(s) && ONIGENC_IS_MBC_WORD(encode, sprev, end)) {\n if (ON_STR_END(s) || !ONIGENC_IS_MBC_WORD(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n }\n goto fail;\n break;\n#endif\n\n case OP_BEGIN_BUF: MOP_IN(OP_BEGIN_BUF);\n if (! ON_STR_BEGIN(s)) goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_END_BUF: MOP_IN(OP_END_BUF);\n if (! ON_STR_END(s)) goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_BEGIN_LINE: MOP_IN(OP_BEGIN_LINE);\n if (ON_STR_BEGIN(s)) {\n if (IS_NOTBOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, sprev, end) && !ON_STR_END(s)) {\n MOP_OUT;\n continue;\n }\n goto fail;\n break;\n\n case OP_END_LINE: MOP_IN(OP_END_LINE);\n if (ON_STR_END(s)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) {\n#endif\n if (IS_NOTEOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n }\n#endif\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) {\n MOP_OUT;\n continue;\n }\n#endif\n goto fail;\n break;\n\n case OP_SEMI_END_BUF: MOP_IN(OP_SEMI_END_BUF);\n if (ON_STR_END(s)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) {\n#endif\n if (IS_NOTEOL(msa->options)) goto fail;\n MOP_OUT;\n continue;\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n }\n#endif\n }\n else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end) &&\n ON_STR_END(s + enclen(encode, s))) {\n MOP_OUT;\n continue;\n }\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) {\n UChar* ss = s + enclen(encode, s);\n ss += enclen(encode, ss);\n if (ON_STR_END(ss)) {\n MOP_OUT;\n continue;\n }\n }\n#endif\n goto fail;\n break;\n\n case OP_BEGIN_POSITION: MOP_IN(OP_BEGIN_POSITION);\n if (s != msa->start)\n goto fail;\n\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_START_PUSH: MOP_IN(OP_MEMORY_START_PUSH);\n GET_MEMNUM_INC(mem, p);\n STACK_PUSH_MEM_START(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_START: MOP_IN(OP_MEMORY_START);\n GET_MEMNUM_INC(mem, p);\n mem_start_stk[mem] = (OnigStackIndex )((void* )s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END_PUSH: MOP_IN(OP_MEMORY_END_PUSH);\n GET_MEMNUM_INC(mem, p);\n STACK_PUSH_MEM_END(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END: MOP_IN(OP_MEMORY_END);\n GET_MEMNUM_INC(mem, p);\n mem_end_stk[mem] = (OnigStackIndex )((void* )s);\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_SUBEXP_CALL\n case OP_MEMORY_END_PUSH_REC: MOP_IN(OP_MEMORY_END_PUSH_REC);\n GET_MEMNUM_INC(mem, p);\n STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */\n STACK_PUSH_MEM_END(mem, s);\n mem_start_stk[mem] = GET_STACK_INDEX(stkp);\n MOP_OUT;\n continue;\n break;\n\n case OP_MEMORY_END_REC: MOP_IN(OP_MEMORY_END_REC);\n GET_MEMNUM_INC(mem, p);\n mem_end_stk[mem] = (OnigStackIndex )((void* )s);\n STACK_GET_MEM_START(mem, stkp);\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n mem_start_stk[mem] = GET_STACK_INDEX(stkp);\n else\n mem_start_stk[mem] = (OnigStackIndex )((void* )stkp->u.mem.pstr);\n\n STACK_PUSH_MEM_END_MARK(mem);\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_BACKREF1: MOP_IN(OP_BACKREF1);\n mem = 1;\n goto backref;\n break;\n\n case OP_BACKREF2: MOP_IN(OP_BACKREF2);\n mem = 2;\n goto backref;\n break;\n\n case OP_BACKREFN: MOP_IN(OP_BACKREFN);\n GET_MEMNUM_INC(mem, p);\n backref:\n {\n int len;\n UChar *pstart, *pend;\n\n /* if you want to remove following line, \n you should check in parse and compile time. */\n if (mem > num_mem) goto fail;\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n STRING_CMP(pstart, s, n);\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREFN_IC: MOP_IN(OP_BACKREFN_IC);\n GET_MEMNUM_INC(mem, p);\n {\n int len;\n UChar *pstart, *pend;\n\n /* if you want to remove following line, \n you should check in parse and compile time. */\n if (mem > num_mem) goto fail;\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n STRING_CMP_IC(case_fold_flag, pstart, &s, n);\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREF_MULTI: MOP_IN(OP_BACKREF_MULTI);\n {\n int len, is_fail;\n UChar *pstart, *pend, *swork;\n\n GET_LENGTH_INC(tlen, p);\n for (i = 0; i < tlen; i++) {\n GET_MEMNUM_INC(mem, p);\n\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n swork = s;\n STRING_CMP_VALUE(pstart, swork, n, is_fail);\n if (is_fail) continue;\n s = swork;\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * (tlen - i - 1));\n break; /* success */\n }\n if (i == tlen) goto fail;\n MOP_OUT;\n continue;\n }\n break;\n\n case OP_BACKREF_MULTI_IC: MOP_IN(OP_BACKREF_MULTI_IC);\n {\n int len, is_fail;\n UChar *pstart, *pend, *swork;\n\n GET_LENGTH_INC(tlen, p);\n for (i = 0; i < tlen; i++) {\n GET_MEMNUM_INC(mem, p);\n\n if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue;\n if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue;\n\n if (BIT_STATUS_AT(reg->bt_mem_start, mem))\n pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr;\n else\n pstart = (UChar* )((void* )mem_start_stk[mem]);\n\n pend = (BIT_STATUS_AT(reg->bt_mem_end, mem)\n ? STACK_AT(mem_end_stk[mem])->u.mem.pstr\n : (UChar* )((void* )mem_end_stk[mem]));\n n = pend - pstart;\n DATA_ENSURE(n);\n sprev = s;\n swork = s;\n STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, n, is_fail);\n if (is_fail) continue;\n s = swork;\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * (tlen - i - 1));\n break; /* success */\n }\n if (i == tlen) goto fail;\n MOP_OUT;\n continue;\n }\n break;\n\n#ifdef USE_BACKREF_WITH_LEVEL\n case OP_BACKREF_WITH_LEVEL:\n {\n int len;\n OnigOptionType ic;\n LengthType level;\n\n GET_OPTION_INC(ic, p);\n GET_LENGTH_INC(level, p);\n GET_LENGTH_INC(tlen, p);\n\n sprev = s;\n if (backref_match_at_nested_level(reg, stk, stk_base, ic\n , case_fold_flag, (int )level, (int )tlen, p, &s, end)) {\n while (sprev + (len = enclen(encode, sprev)) < s)\n sprev += len;\n\n p += (SIZE_MEMNUM * tlen);\n }\n else\n goto fail;\n\n MOP_OUT;\n continue;\n }\n break;\n#endif\n\n#if 0 /* no need: IS_DYNAMIC_OPTION() == 0 */\n case OP_SET_OPTION_PUSH: MOP_IN(OP_SET_OPTION_PUSH);\n GET_OPTION_INC(option, p);\n STACK_PUSH_ALT(p, s, sprev);\n p += SIZE_OP_SET_OPTION + SIZE_OP_FAIL;\n MOP_OUT;\n continue;\n break;\n\n case OP_SET_OPTION: MOP_IN(OP_SET_OPTION);\n GET_OPTION_INC(option, p);\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_NULL_CHECK_START: MOP_IN(OP_NULL_CHECK_START);\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_PUSH_NULL_CHECK_START(mem, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_NULL_CHECK_END: MOP_IN(OP_NULL_CHECK_END);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_NULL_CHECK(isnull, mem, s);\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n null_check_found:\n /* empty loop founded, skip next instruction */\n switch (*p++) {\n case OP_JUMP:\n case OP_PUSH:\n p += SIZE_RELADDR;\n break;\n case OP_REPEAT_INC:\n case OP_REPEAT_INC_NG:\n case OP_REPEAT_INC_SG:\n case OP_REPEAT_INC_NG_SG:\n p += SIZE_MEMNUM;\n break;\n default:\n goto unexpected_bytecode_error;\n break;\n }\n }\n }\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT\n case OP_NULL_CHECK_END_MEMST: MOP_IN(OP_NULL_CHECK_END_MEMST);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n STACK_NULL_CHECK_MEMST(isnull, mem, s, reg);\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END_MEMST: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n if (isnull == -1) goto fail;\n goto \tnull_check_found;\n }\n }\n MOP_OUT;\n continue;\n break;\n#endif\n\n#ifdef USE_SUBEXP_CALL\n case OP_NULL_CHECK_END_MEMST_PUSH:\n MOP_IN(OP_NULL_CHECK_END_MEMST_PUSH);\n {\n int isnull;\n\n GET_MEMNUM_INC(mem, p); /* mem: null check id */\n#ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT\n STACK_NULL_CHECK_MEMST_REC(isnull, mem, s, reg);\n#else\n STACK_NULL_CHECK_REC(isnull, mem, s);\n#endif\n if (isnull) {\n#ifdef ONIG_DEBUG_MATCH\n fprintf(stderr, \"NULL_CHECK_END_MEMST_PUSH: skip id:%d, s:%d\\n\",\n (int )mem, (int )s);\n#endif\n if (isnull == -1) goto fail;\n goto \tnull_check_found;\n }\n else {\n STACK_PUSH_NULL_CHECK_END(mem);\n }\n }\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_JUMP: MOP_IN(OP_JUMP);\n GET_RELADDR_INC(addr, p);\n p += addr;\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_PUSH: MOP_IN(OP_PUSH);\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n break;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n case OP_STATE_CHECK_PUSH: MOP_IN(OP_STATE_CHECK_PUSH);\n GET_STATE_CHECK_NUM_INC(mem, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem);\n MOP_OUT;\n continue;\n break;\n\n case OP_STATE_CHECK_PUSH_OR_JUMP: MOP_IN(OP_STATE_CHECK_PUSH_OR_JUMP);\n GET_STATE_CHECK_NUM_INC(mem, p);\n GET_RELADDR_INC(addr, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) {\n p += addr;\n }\n else {\n STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem);\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_STATE_CHECK: MOP_IN(OP_STATE_CHECK);\n GET_STATE_CHECK_NUM_INC(mem, p);\n STATE_CHECK_VAL(scv, mem);\n if (scv) goto fail;\n\n STACK_PUSH_STATE_CHECK(s, mem);\n MOP_OUT;\n continue;\n break;\n#endif /* USE_COMBINATION_EXPLOSION_CHECK */\n\n case OP_POP: MOP_IN(OP_POP);\n STACK_POP_ONE;\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_OR_JUMP_EXACT1: MOP_IN(OP_PUSH_OR_JUMP_EXACT1);\n GET_RELADDR_INC(addr, p);\n if (*p == *s && DATA_ENSURE_CHECK1) {\n p++;\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n }\n p += (addr + 1);\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_IF_PEEK_NEXT: MOP_IN(OP_PUSH_IF_PEEK_NEXT);\n GET_RELADDR_INC(addr, p);\n if (*p == *s) {\n p++;\n STACK_PUSH_ALT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n }\n p++;\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT: MOP_IN(OP_REPEAT);\n {\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n GET_RELADDR_INC(addr, p);\n\n STACK_ENSURE(1);\n repeat_stk[mem] = GET_STACK_INDEX(stk);\n STACK_PUSH_REPEAT(mem, p);\n\n if (reg->repeat_range[mem].lower == 0) {\n STACK_PUSH_ALT(p + addr, s, sprev);\n }\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT_NG: MOP_IN(OP_REPEAT_NG);\n {\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n GET_RELADDR_INC(addr, p);\n\n STACK_ENSURE(1);\n repeat_stk[mem] = GET_STACK_INDEX(stk);\n STACK_PUSH_REPEAT(mem, p);\n\n if (reg->repeat_range[mem].lower == 0) {\n STACK_PUSH_ALT(p, s, sprev);\n p += addr;\n }\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_REPEAT_INC: MOP_IN(OP_REPEAT_INC);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n si = repeat_stk[mem];\n stkp = STACK_AT(si);\n\n repeat_inc:\n stkp->u.repeat.count++;\n if (stkp->u.repeat.count >= reg->repeat_range[mem].upper) {\n /* end of repeat. Nothing to do. */\n }\n else if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) {\n STACK_PUSH_ALT(p, s, sprev);\n p = STACK_AT(si)->u.repeat.pcode; /* Don't use stkp after PUSH. */\n }\n else {\n p = stkp->u.repeat.pcode;\n }\n STACK_PUSH_REPEAT_INC(si);\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_REPEAT_INC_SG: MOP_IN(OP_REPEAT_INC_SG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n STACK_GET_REPEAT(mem, stkp);\n si = GET_STACK_INDEX(stkp);\n goto repeat_inc;\n break;\n\n case OP_REPEAT_INC_NG: MOP_IN(OP_REPEAT_INC_NG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n si = repeat_stk[mem];\n stkp = STACK_AT(si);\n\n repeat_inc_ng:\n stkp->u.repeat.count++;\n if (stkp->u.repeat.count < reg->repeat_range[mem].upper) {\n if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) {\n UChar* pcode = stkp->u.repeat.pcode;\n\n STACK_PUSH_REPEAT_INC(si);\n STACK_PUSH_ALT(pcode, s, sprev);\n }\n else {\n p = stkp->u.repeat.pcode;\n STACK_PUSH_REPEAT_INC(si);\n }\n }\n else if (stkp->u.repeat.count == reg->repeat_range[mem].upper) {\n STACK_PUSH_REPEAT_INC(si);\n }\n MOP_OUT;\n CHECK_INTERRUPT_IN_MATCH_AT;\n continue;\n break;\n\n case OP_REPEAT_INC_NG_SG: MOP_IN(OP_REPEAT_INC_NG_SG);\n GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */\n STACK_GET_REPEAT(mem, stkp);\n si = GET_STACK_INDEX(stkp);\n goto repeat_inc_ng;\n break;\n\n case OP_PUSH_POS: MOP_IN(OP_PUSH_POS);\n STACK_PUSH_POS(s, sprev);\n MOP_OUT;\n continue;\n break;\n\n case OP_POP_POS: MOP_IN(OP_POP_POS);\n {\n STACK_POS_END(stkp);\n s = stkp->u.state.pstr;\n sprev = stkp->u.state.pstr_prev;\n }\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_POS_NOT: MOP_IN(OP_PUSH_POS_NOT);\n GET_RELADDR_INC(addr, p);\n STACK_PUSH_POS_NOT(p + addr, s, sprev);\n MOP_OUT;\n continue;\n break;\n\n case OP_FAIL_POS: MOP_IN(OP_FAIL_POS);\n STACK_POP_TIL_POS_NOT;\n goto fail;\n break;\n\n case OP_PUSH_STOP_BT: MOP_IN(OP_PUSH_STOP_BT);\n STACK_PUSH_STOP_BT;\n MOP_OUT;\n continue;\n break;\n\n case OP_POP_STOP_BT: MOP_IN(OP_POP_STOP_BT);\n STACK_STOP_BT_END;\n MOP_OUT;\n continue;\n break;\n\n case OP_LOOK_BEHIND: MOP_IN(OP_LOOK_BEHIND);\n GET_LENGTH_INC(tlen, p);\n s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen);\n if (IS_NULL(s)) goto fail;\n sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s);\n MOP_OUT;\n continue;\n break;\n\n case OP_PUSH_LOOK_BEHIND_NOT: MOP_IN(OP_PUSH_LOOK_BEHIND_NOT);\n GET_RELADDR_INC(addr, p);\n GET_LENGTH_INC(tlen, p);\n q = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen);\n if (IS_NULL(q)) {\n /* too short case -> success. ex. /(?p + addr;\n MOP_OUT;\n continue;\n break;\n\n case OP_RETURN: MOP_IN(OP_RETURN);\n STACK_RETURN(p);\n STACK_PUSH_RETURN;\n MOP_OUT;\n continue;\n break;\n#endif\n\n case OP_FINISH:\n goto finish;\n break;\n\n fail:\n MOP_OUT;\n /* fall */\n case OP_FAIL: MOP_IN(OP_FAIL);\n STACK_POP;\n p = stk->u.state.pcode;\n s = stk->u.state.pstr;\n sprev = stk->u.state.pstr_prev;\n\n#ifdef USE_COMBINATION_EXPLOSION_CHECK\n if (stk->u.state.state_check != 0) {\n stk->type = STK_STATE_CHECK_MARK;\n stk++;\n }\n#endif\n\n MOP_OUT;\n continue;\n break;\n\n default:\n goto bytecode_error;\n\n } /* end of switch */\n sprev = sbegin;\n } /* end of while(1) */\n\n finish:\n STACK_SAVE;\n return best_len;\n\n#ifdef ONIG_DEBUG\n stack_error:\n STACK_SAVE;\n return ONIGERR_STACK_BUG;\n#endif\n\n bytecode_error:\n STACK_SAVE;\n return ONIGERR_UNDEFINED_BYTECODE;\n\n unexpected_bytecode_error:\n STACK_SAVE;\n return ONIGERR_UNEXPECTED_BYTECODE;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"match_at","file_name":"src/regexec.c","commit_link":"github.com/kkos/oniguruma/commit/690313a061f7a4fa614ec5cc8368b4f2284e059b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#37-5d5e81732393","input":"static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image\n *image;\n\n MagickBooleanType\n has_merged_image,\n skip_layers;\n\n MagickOffsetType\n offset;\n\n MagickSizeType\n length;\n\n MagickBooleanType\n status;\n\n PSDInfo\n psd_info;\n\n register ssize_t\n i;\n\n ssize_t\n count;\n\n unsigned char\n *data;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read image header.\n */\n image->endian=MSBEndian;\n count=ReadBlob(image,4,(unsigned char *) psd_info.signature);\n psd_info.version=ReadBlobMSBShort(image);\n if ((count == 0) || (LocaleNCompare(psd_info.signature,\"8BPS\",4) != 0) ||\n ((psd_info.version != 1) && (psd_info.version != 2)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n (void) ReadBlob(image,6,psd_info.reserved);\n psd_info.channels=ReadBlobMSBShort(image);\n if (psd_info.channels > MaxPSDChannels)\n ThrowReaderException(CorruptImageError,\"MaximumChannelsExceeded\");\n psd_info.rows=ReadBlobMSBLong(image);\n psd_info.columns=ReadBlobMSBLong(image);\n if ((psd_info.version == 1) && ((psd_info.rows > 30000) ||\n (psd_info.columns > 30000)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n psd_info.depth=ReadBlobMSBShort(image);\n if ((psd_info.depth != 1) && (psd_info.depth != 8) && (psd_info.depth != 16))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n psd_info.mode=ReadBlobMSBShort(image);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image is %.20g x %.20g with channels=%.20g, depth=%.20g, mode=%s\",\n (double) psd_info.columns,(double) psd_info.rows,(double)\n psd_info.channels,(double) psd_info.depth,ModeToString((PSDImageType)\n psd_info.mode));\n /*\n Initialize image.\n */\n image->depth=psd_info.depth;\n image->columns=psd_info.columns;\n image->rows=psd_info.rows;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n if (SetImageBackgroundColor(image,exception) == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n if (psd_info.mode == LabMode)\n SetImageColorspace(image,LabColorspace,exception);\n if (psd_info.mode == CMYKMode)\n {\n SetImageColorspace(image,CMYKColorspace,exception);\n image->alpha_trait=psd_info.channels > 4 ? BlendPixelTrait :\n UndefinedPixelTrait;\n }\n else if ((psd_info.mode == BitmapMode) || (psd_info.mode == GrayscaleMode) ||\n (psd_info.mode == DuotoneMode))\n {\n status=AcquireImageColormap(image,psd_info.depth != 16 ? 256 : 65536,\n exception);\n if (status == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image colormap allocated\");\n SetImageColorspace(image,GRAYColorspace,exception);\n image->alpha_trait=psd_info.channels > 1 ? BlendPixelTrait :\n UndefinedPixelTrait;\n }\n else\n image->alpha_trait=psd_info.channels > 3 ? BlendPixelTrait :\n UndefinedPixelTrait;\n /*\n Read PSD raster colormap only present for indexed and duotone images.\n */\n length=ReadBlobMSBLong(image);\n if (length != 0)\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading colormap\");\n if (psd_info.mode == DuotoneMode)\n {\n /*\n Duotone image data; the format of this data is undocumented.\n */\n data=(unsigned char *) AcquireQuantumMemory((size_t) length,\n sizeof(*data));\n if (data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ReadBlob(image,(size_t) length,data);\n data=(unsigned char *) RelinquishMagickMemory(data);\n }\n else\n {\n size_t\n number_colors;\n\n /*\n Read PSD raster colormap.\n */\n number_colors=length/3;\n if (number_colors > 65536)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (AcquireImageColormap(image,number_colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].red=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->alpha_trait=UndefinedPixelTrait;\n }\n }\n has_merged_image=MagickTrue;\n length=ReadBlobMSBLong(image);\n if (length != 0)\n {\n unsigned char\n *blocks;\n\n /*\n Image resources block.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading image resource blocks - %.20g bytes\",(double)\n ((MagickOffsetType) length));\n blocks=(unsigned char *) AcquireQuantumMemory((size_t) length,\n sizeof(*blocks));\n if (blocks == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,(size_t) length,blocks);\n if ((count != (ssize_t) length) ||\n (LocaleNCompare((char *) blocks,\"8BIM\",4) != 0))\n {\n blocks=(unsigned char *) RelinquishMagickMemory(blocks);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n ParseImageResourceBlocks(image,blocks,(size_t) length,&has_merged_image,\n exception);\n blocks=(unsigned char *) RelinquishMagickMemory(blocks);\n }\n /*\n Layer and mask block.\n */\n length=GetPSDSize(&psd_info,image);\n if (length == 8)\n {\n length=ReadBlobMSBLong(image);\n length=ReadBlobMSBLong(image);\n }\n offset=TellBlob(image);\n skip_layers=MagickFalse;\n if ((image_info->number_scenes == 1) && (image_info->scene == 0) &&\n (has_merged_image != MagickFalse))\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" read composite only\");\n skip_layers=MagickTrue;\n }\n if (length == 0)\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has no layers\");\n }\n else\n {\n if (ReadPSDLayers(image,image_info,&psd_info,skip_layers,exception) !=\n MagickTrue)\n {\n (void) CloseBlob(image);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n\n /*\n Skip the rest of the layer and mask information.\n */\n SeekBlob(image,offset+length,SEEK_SET);\n }\n /*\n If we are only \"pinging\" the image, then we're done - so return.\n */\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n /*\n Read the precombined layer, present for PSD < 4 compatibility.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading the precombined layer\");\n if ((has_merged_image != MagickFalse) || (GetImageListLength(image) == 1))\n has_merged_image=(MagickBooleanType) ReadPSDMergedImage(image_info,image,\n &psd_info,exception);\n if ((has_merged_image == MagickFalse) && (GetImageListLength(image) == 1) &&\n (length != 0))\n {\n SeekBlob(image,offset,SEEK_SET);\n status=ReadPSDLayers(image,image_info,&psd_info,MagickFalse,exception);\n if (status != MagickTrue)\n {\n (void) CloseBlob(image);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n }\n if ((has_merged_image == MagickFalse) && (GetImageListLength(image) > 1))\n {\n Image\n *merged;\n\n SetImageAlphaChannel(image,TransparentAlphaChannel,exception);\n image->background_color.alpha=TransparentAlpha;\n image->background_color.alpha_trait=BlendPixelTrait;\n merged=MergeImageLayers(image,FlattenLayer,exception);\n ReplaceImageInList(&image,merged);\n }\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image\n *image;\n\n MagickBooleanType\n has_merged_image,\n skip_layers;\n\n MagickOffsetType\n offset;\n\n MagickSizeType\n length;\n\n MagickBooleanType\n status;\n\n PSDInfo\n psd_info;\n\n register ssize_t\n i;\n\n ssize_t\n count;\n\n unsigned char\n *data;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read image header.\n */\n image->endian=MSBEndian;\n count=ReadBlob(image,4,(unsigned char *) psd_info.signature);\n psd_info.version=ReadBlobMSBShort(image);\n if ((count == 0) || (LocaleNCompare(psd_info.signature,\"8BPS\",4) != 0) ||\n ((psd_info.version != 1) && (psd_info.version != 2)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n (void) ReadBlob(image,6,psd_info.reserved);\n psd_info.channels=ReadBlobMSBShort(image);\n if (psd_info.channels > MaxPSDChannels)\n ThrowReaderException(CorruptImageError,\"MaximumChannelsExceeded\");\n psd_info.rows=ReadBlobMSBLong(image);\n psd_info.columns=ReadBlobMSBLong(image);\n if ((psd_info.version == 1) && ((psd_info.rows > 30000) ||\n (psd_info.columns > 30000)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n psd_info.depth=ReadBlobMSBShort(image);\n if ((psd_info.depth != 1) && (psd_info.depth != 8) && (psd_info.depth != 16))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n psd_info.mode=ReadBlobMSBShort(image);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image is %.20g x %.20g with channels=%.20g, depth=%.20g, mode=%s\",\n (double) psd_info.columns,(double) psd_info.rows,(double)\n psd_info.channels,(double) psd_info.depth,ModeToString((PSDImageType)\n psd_info.mode));\n /*\n Initialize image.\n */\n image->depth=psd_info.depth;\n image->columns=psd_info.columns;\n image->rows=psd_info.rows;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n if (SetImageBackgroundColor(image,exception) == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n if (psd_info.mode == LabMode)\n SetImageColorspace(image,LabColorspace,exception);\n if (psd_info.mode == CMYKMode)\n {\n SetImageColorspace(image,CMYKColorspace,exception);\n image->alpha_trait=psd_info.channels > 4 ? BlendPixelTrait :\n UndefinedPixelTrait;\n }\n else if ((psd_info.mode == BitmapMode) || (psd_info.mode == GrayscaleMode) ||\n (psd_info.mode == DuotoneMode))\n {\n status=AcquireImageColormap(image,psd_info.depth != 16 ? 256 : 65536,\n exception);\n if (status == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image colormap allocated\");\n SetImageColorspace(image,GRAYColorspace,exception);\n image->alpha_trait=psd_info.channels > 1 ? BlendPixelTrait :\n UndefinedPixelTrait;\n }\n else\n image->alpha_trait=psd_info.channels > 3 ? BlendPixelTrait :\n UndefinedPixelTrait;\n /*\n Read PSD raster colormap only present for indexed and duotone images.\n */\n length=ReadBlobMSBLong(image);\n if (length != 0)\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading colormap\");\n if (psd_info.mode == DuotoneMode)\n {\n /*\n Duotone image data; the format of this data is undocumented.\n */\n data=(unsigned char *) AcquireQuantumMemory((size_t) length,\n sizeof(*data));\n if (data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ReadBlob(image,(size_t) length,data);\n data=(unsigned char *) RelinquishMagickMemory(data);\n }\n else\n {\n size_t\n number_colors;\n\n /*\n Read PSD raster colormap.\n */\n number_colors=length/3;\n if (number_colors > 65536)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (AcquireImageColormap(image,number_colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].red=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n for (i=0; i < (ssize_t) image->colors; i++)\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->alpha_trait=UndefinedPixelTrait;\n }\n }\n if ((image->depth == 1) && (image->storage_class != PseudoClass))\n ThrowReaderException(CorruptImageError, \"ImproperImageHeader\");\n has_merged_image=MagickTrue;\n length=ReadBlobMSBLong(image);\n if (length != 0)\n {\n unsigned char\n *blocks;\n\n /*\n Image resources block.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading image resource blocks - %.20g bytes\",(double)\n ((MagickOffsetType) length));\n blocks=(unsigned char *) AcquireQuantumMemory((size_t) length,\n sizeof(*blocks));\n if (blocks == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n count=ReadBlob(image,(size_t) length,blocks);\n if ((count != (ssize_t) length) ||\n (LocaleNCompare((char *) blocks,\"8BIM\",4) != 0))\n {\n blocks=(unsigned char *) RelinquishMagickMemory(blocks);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n ParseImageResourceBlocks(image,blocks,(size_t) length,&has_merged_image,\n exception);\n blocks=(unsigned char *) RelinquishMagickMemory(blocks);\n }\n /*\n Layer and mask block.\n */\n length=GetPSDSize(&psd_info,image);\n if (length == 8)\n {\n length=ReadBlobMSBLong(image);\n length=ReadBlobMSBLong(image);\n }\n offset=TellBlob(image);\n skip_layers=MagickFalse;\n if ((image_info->number_scenes == 1) && (image_info->scene == 0) &&\n (has_merged_image != MagickFalse))\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" read composite only\");\n skip_layers=MagickTrue;\n }\n if (length == 0)\n {\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has no layers\");\n }\n else\n {\n if (ReadPSDLayers(image,image_info,&psd_info,skip_layers,exception) !=\n MagickTrue)\n {\n (void) CloseBlob(image);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n\n /*\n Skip the rest of the layer and mask information.\n */\n SeekBlob(image,offset+length,SEEK_SET);\n }\n /*\n If we are only \"pinging\" the image, then we're done - so return.\n */\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n /*\n Read the precombined layer, present for PSD < 4 compatibility.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" reading the precombined layer\");\n if ((has_merged_image != MagickFalse) || (GetImageListLength(image) == 1))\n has_merged_image=(MagickBooleanType) ReadPSDMergedImage(image_info,image,\n &psd_info,exception);\n if ((has_merged_image == MagickFalse) && (GetImageListLength(image) == 1) &&\n (length != 0))\n {\n SeekBlob(image,offset,SEEK_SET);\n status=ReadPSDLayers(image,image_info,&psd_info,MagickFalse,exception);\n if (status != MagickTrue)\n {\n (void) CloseBlob(image);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n }\n if ((has_merged_image == MagickFalse) && (GetImageListLength(image) > 1))\n {\n Image\n *merged;\n\n SetImageAlphaChannel(image,TransparentAlphaChannel,exception);\n image->background_color.alpha=TransparentAlpha;\n image->background_color.alpha_trait=BlendPixelTrait;\n merged=MergeImageLayers(image,FlattenLayer,exception);\n ReplaceImageInList(&image,merged);\n }\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ReadPSDImage","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/198fffab4daf8aea88badd9c629350e5b26ec32f","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#38-ccf27e3cd626","input":"decode_bundle(bool load, const struct nx_action_bundle *nab,\n const struct vl_mff_map *vl_mff_map, uint64_t *tlv_bitmap,\n struct ofpbuf *ofpacts)\n{\n static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);\n struct ofpact_bundle *bundle;\n uint32_t slave_type;\n size_t slaves_size, i;\n enum ofperr error;\n\n bundle = ofpact_put_BUNDLE(ofpacts);\n\n bundle->n_slaves = ntohs(nab->n_slaves);\n bundle->basis = ntohs(nab->basis);\n bundle->fields = ntohs(nab->fields);\n bundle->algorithm = ntohs(nab->algorithm);\n slave_type = ntohl(nab->slave_type);\n slaves_size = ntohs(nab->len) - sizeof *nab;\n\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n if (!flow_hash_fields_valid(bundle->fields)) {\n VLOG_WARN_RL(&rl, \"unsupported fields %d\", (int) bundle->fields);\n } else if (bundle->n_slaves > BUNDLE_MAX_SLAVES) {\n VLOG_WARN_RL(&rl, \"too many slaves\");\n } else if (bundle->algorithm != NX_BD_ALG_HRW\n && bundle->algorithm != NX_BD_ALG_ACTIVE_BACKUP) {\n VLOG_WARN_RL(&rl, \"unsupported algorithm %d\", (int) bundle->algorithm);\n } else if (slave_type != mf_nxm_header(MFF_IN_PORT)) {\n VLOG_WARN_RL(&rl, \"unsupported slave type %\"PRIu16, slave_type);\n } else {\n error = 0;\n }\n\n if (!is_all_zeros(nab->zero, sizeof nab->zero)) {\n VLOG_WARN_RL(&rl, \"reserved field is nonzero\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n\n if (load) {\n bundle->dst.ofs = nxm_decode_ofs(nab->ofs_nbits);\n bundle->dst.n_bits = nxm_decode_n_bits(nab->ofs_nbits);\n error = mf_vl_mff_mf_from_nxm_header(ntohl(nab->dst), vl_mff_map,\n &bundle->dst.field, tlv_bitmap);\n if (error) {\n return error;\n }\n\n if (bundle->dst.n_bits < 16) {\n VLOG_WARN_RL(&rl, \"bundle_load action requires at least 16 bit \"\n \"destination.\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n } else {\n if (nab->ofs_nbits || nab->dst) {\n VLOG_WARN_RL(&rl, \"bundle action has nonzero reserved fields\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n }\n\n if (slaves_size < bundle->n_slaves * sizeof(ovs_be16)) {\n VLOG_WARN_RL(&rl, \"Nicira action %s only has %\"PRIuSIZE\" bytes \"\n \"allocated for slaves. %\"PRIuSIZE\" bytes are required \"\n \"for %\"PRIu16\" slaves.\",\n load ? \"bundle_load\" : \"bundle\", slaves_size,\n bundle->n_slaves * sizeof(ovs_be16), bundle->n_slaves);\n error = OFPERR_OFPBAC_BAD_LEN;\n }\n\n for (i = 0; i < bundle->n_slaves; i++) {\n ofp_port_t ofp_port = u16_to_ofp(ntohs(((ovs_be16 *)(nab + 1))[i]));\n ofpbuf_put(ofpacts, &ofp_port, sizeof ofp_port);\n bundle = ofpacts->header;\n }\n\n ofpact_finish_BUNDLE(ofpacts, &bundle);\n if (!error) {\n error = bundle_check(bundle, OFPP_MAX, NULL);\n }\n return error;\n}","target":"decode_bundle(bool load, const struct nx_action_bundle *nab,\n const struct vl_mff_map *vl_mff_map, uint64_t *tlv_bitmap,\n struct ofpbuf *ofpacts)\n{\n static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);\n struct ofpact_bundle *bundle;\n uint32_t slave_type;\n size_t slaves_size, i;\n enum ofperr error;\n\n bundle = ofpact_put_BUNDLE(ofpacts);\n\n bundle->n_slaves = ntohs(nab->n_slaves);\n bundle->basis = ntohs(nab->basis);\n bundle->fields = ntohs(nab->fields);\n bundle->algorithm = ntohs(nab->algorithm);\n slave_type = ntohl(nab->slave_type);\n slaves_size = ntohs(nab->len) - sizeof *nab;\n\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n if (!flow_hash_fields_valid(bundle->fields)) {\n VLOG_WARN_RL(&rl, \"unsupported fields %d\", (int) bundle->fields);\n } else if (bundle->n_slaves > BUNDLE_MAX_SLAVES) {\n VLOG_WARN_RL(&rl, \"too many slaves\");\n } else if (bundle->algorithm != NX_BD_ALG_HRW\n && bundle->algorithm != NX_BD_ALG_ACTIVE_BACKUP) {\n VLOG_WARN_RL(&rl, \"unsupported algorithm %d\", (int) bundle->algorithm);\n } else if (slave_type != mf_nxm_header(MFF_IN_PORT)) {\n VLOG_WARN_RL(&rl, \"unsupported slave type %\"PRIu16, slave_type);\n } else {\n error = 0;\n }\n\n if (!is_all_zeros(nab->zero, sizeof nab->zero)) {\n VLOG_WARN_RL(&rl, \"reserved field is nonzero\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n\n if (load) {\n bundle->dst.ofs = nxm_decode_ofs(nab->ofs_nbits);\n bundle->dst.n_bits = nxm_decode_n_bits(nab->ofs_nbits);\n error = mf_vl_mff_mf_from_nxm_header(ntohl(nab->dst), vl_mff_map,\n &bundle->dst.field, tlv_bitmap);\n if (error) {\n return error;\n }\n\n if (bundle->dst.n_bits < 16) {\n VLOG_WARN_RL(&rl, \"bundle_load action requires at least 16 bit \"\n \"destination.\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n } else {\n if (nab->ofs_nbits || nab->dst) {\n VLOG_WARN_RL(&rl, \"bundle action has nonzero reserved fields\");\n error = OFPERR_OFPBAC_BAD_ARGUMENT;\n }\n }\n\n if (slaves_size < bundle->n_slaves * sizeof(ovs_be16)) {\n VLOG_WARN_RL(&rl, \"Nicira action %s only has %\"PRIuSIZE\" bytes \"\n \"allocated for slaves. %\"PRIuSIZE\" bytes are required \"\n \"for %\"PRIu16\" slaves.\",\n load ? \"bundle_load\" : \"bundle\", slaves_size,\n bundle->n_slaves * sizeof(ovs_be16), bundle->n_slaves);\n error = OFPERR_OFPBAC_BAD_LEN;\n } else {\n for (i = 0; i < bundle->n_slaves; i++) {\n ofp_port_t ofp_port\n = u16_to_ofp(ntohs(((ovs_be16 *)(nab + 1))[i]));\n ofpbuf_put(ofpacts, &ofp_port, sizeof ofp_port);\n bundle = ofpacts->header;\n }\n }\n\n ofpact_finish_BUNDLE(ofpacts, &bundle);\n if (!error) {\n error = bundle_check(bundle, OFPP_MAX, NULL);\n }\n return error;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"decode_bundle","file_name":"lib/ofp-actions.c","commit_link":"github.com/openvswitch/ovs/commit/9237a63c47bd314b807cda0bd2216264e82edbe8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#39-afe1ff6fc805","input":"MagickExport Image *SpliceImage(const Image *image,\n const RectangleInfo *geometry,ExceptionInfo *exception)\n{\n#define SpliceImageTag \"Splice/Image\"\n\n CacheView\n *image_view,\n *splice_view;\n\n Image\n *splice_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n RectangleInfo\n splice_geometry;\n\n ssize_t\n y;\n\n /*\n Allocate splice image.\n */\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(geometry != (const RectangleInfo *) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n splice_geometry=(*geometry);\n splice_image=CloneImage(image,image->columns+splice_geometry.width,\n image->rows+splice_geometry.height,MagickTrue,exception);\n if (splice_image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(splice_image,DirectClass,exception) == MagickFalse)\n {\n splice_image=DestroyImage(splice_image);\n return((Image *) NULL);\n }\n if ((IsPixelInfoGray(&splice_image->background_color) == MagickFalse) &&\n (IsGrayColorspace(splice_image->colorspace) != MagickFalse))\n (void) SetImageColorspace(splice_image,sRGBColorspace,exception);\n if ((splice_image->background_color.alpha_trait != UndefinedPixelTrait) &&\n (splice_image->alpha_trait == UndefinedPixelTrait))\n (void) SetImageAlpha(splice_image,OpaqueAlpha,exception);\n (void) SetImageBackgroundColor(splice_image,exception);\n /*\n Respect image geometry.\n */\n switch (image->gravity)\n {\n default:\n case UndefinedGravity:\n case NorthWestGravity:\n break;\n case NorthGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n break;\n }\n case NorthEastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n break;\n }\n case WestGravity:\n {\n splice_geometry.y+=(ssize_t) splice_geometry.width/2;\n break;\n }\n case CenterGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n splice_geometry.y+=(ssize_t) splice_geometry.height/2;\n break;\n }\n case EastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n splice_geometry.y+=(ssize_t) splice_geometry.height/2;\n break;\n }\n case SouthWestGravity:\n {\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n case SouthGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n case SouthEastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n }\n /*\n Splice image.\n */\n status=MagickTrue;\n progress=0;\n image_view=AcquireVirtualCacheView(image,exception);\n splice_view=AcquireAuthenticCacheView(splice_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static,4) shared(progress,status) \\\n magick_threads(image,splice_image,1,1)\n#endif\n for (y=0; y < (ssize_t) splice_geometry.y; y++)\n {\n register const Quantum\n *restrict p;\n\n register ssize_t\n x;\n\n register Quantum\n *restrict q;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);\n q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1,\n exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < splice_geometry.x; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,p) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n for ( ; x < (ssize_t) (splice_geometry.x+splice_geometry.width); x++)\n q+=GetPixelChannels(splice_image);\n for ( ; x < (ssize_t) splice_image->columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,p) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n if (SyncCacheViewAuthenticPixels(splice_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_TransposeImage)\n#endif\n proceed=SetImageProgress(image,SpliceImageTag,progress++,\n splice_image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static,4) shared(progress,status) \\\n magick_threads(image,splice_image,1,1)\n#endif\n for (y=(ssize_t) (splice_geometry.y+splice_geometry.height);\n y < (ssize_t) splice_image->rows; y++)\n {\n register const Quantum\n *restrict p;\n\n register ssize_t\n x;\n\n register Quantum\n *restrict q;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,0,y-(ssize_t) splice_geometry.height,\n image->columns,1,exception);\n if ((y < 0) || (y >= (ssize_t) splice_image->rows))\n continue;\n q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1,\n exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < splice_geometry.x; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,q) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n for ( ; x < (ssize_t) (splice_geometry.x+splice_geometry.width); x++)\n q+=GetPixelChannels(splice_image);\n for ( ; x < (ssize_t) splice_image->columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,q) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n if (SyncCacheViewAuthenticPixels(splice_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_TransposeImage)\n#endif\n proceed=SetImageProgress(image,SpliceImageTag,progress++,\n splice_image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n splice_view=DestroyCacheView(splice_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n splice_image=DestroyImage(splice_image);\n return(splice_image);\n}","target":"MagickExport Image *SpliceImage(const Image *image,\n const RectangleInfo *geometry,ExceptionInfo *exception)\n{\n#define SpliceImageTag \"Splice/Image\"\n\n CacheView\n *image_view,\n *splice_view;\n\n Image\n *splice_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n RectangleInfo\n splice_geometry;\n\n ssize_t\n columns,\n y;\n\n /*\n Allocate splice image.\n */\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(geometry != (const RectangleInfo *) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n splice_geometry=(*geometry);\n splice_image=CloneImage(image,image->columns+splice_geometry.width,\n image->rows+splice_geometry.height,MagickTrue,exception);\n if (splice_image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(splice_image,DirectClass,exception) == MagickFalse)\n {\n splice_image=DestroyImage(splice_image);\n return((Image *) NULL);\n }\n if ((IsPixelInfoGray(&splice_image->background_color) == MagickFalse) &&\n (IsGrayColorspace(splice_image->colorspace) != MagickFalse))\n (void) SetImageColorspace(splice_image,sRGBColorspace,exception);\n if ((splice_image->background_color.alpha_trait != UndefinedPixelTrait) &&\n (splice_image->alpha_trait == UndefinedPixelTrait))\n (void) SetImageAlpha(splice_image,OpaqueAlpha,exception);\n (void) SetImageBackgroundColor(splice_image,exception);\n /*\n Respect image geometry.\n */\n switch (image->gravity)\n {\n default:\n case UndefinedGravity:\n case NorthWestGravity:\n break;\n case NorthGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n break;\n }\n case NorthEastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n break;\n }\n case WestGravity:\n {\n splice_geometry.y+=(ssize_t) splice_geometry.width/2;\n break;\n }\n case CenterGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n splice_geometry.y+=(ssize_t) splice_geometry.height/2;\n break;\n }\n case EastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n splice_geometry.y+=(ssize_t) splice_geometry.height/2;\n break;\n }\n case SouthWestGravity:\n {\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n case SouthGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width/2;\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n case SouthEastGravity:\n {\n splice_geometry.x+=(ssize_t) splice_geometry.width;\n splice_geometry.y+=(ssize_t) splice_geometry.height;\n break;\n }\n }\n /*\n Splice image.\n */\n status=MagickTrue;\n progress=0;\n columns=MagickMin(splice_geometry.x,(ssize_t) splice_image->columns);\n image_view=AcquireVirtualCacheView(image,exception);\n splice_view=AcquireAuthenticCacheView(splice_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static,4) shared(progress,status) \\\n magick_threads(image,splice_image,1,1)\n#endif\n for (y=0; y < (ssize_t) splice_geometry.y; y++)\n {\n register const Quantum\n *restrict p;\n\n register ssize_t\n x;\n\n register Quantum\n *restrict q;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,0,y,splice_image->columns,1,\n exception);\n q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1,\n exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,p) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n for ( ; x < (ssize_t) (splice_geometry.x+splice_geometry.width); x++)\n q+=GetPixelChannels(splice_image);\n for ( ; x < (ssize_t) splice_image->columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,p) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n if (SyncCacheViewAuthenticPixels(splice_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_TransposeImage)\n#endif\n proceed=SetImageProgress(image,SpliceImageTag,progress++,\n splice_image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static,4) shared(progress,status) \\\n magick_threads(image,splice_image,1,1)\n#endif\n for (y=(ssize_t) (splice_geometry.y+splice_geometry.height);\n y < (ssize_t) splice_image->rows; y++)\n {\n register const Quantum\n *restrict p;\n\n register ssize_t\n x;\n\n register Quantum\n *restrict q;\n\n if (status == MagickFalse)\n continue;\n if ((y < 0) || (y >= (ssize_t)splice_image->rows))\n continue;\n p=GetCacheViewVirtualPixels(image_view,0,y-(ssize_t) splice_geometry.height,\n splice_image->columns,1,exception);\n q=QueueCacheViewAuthenticPixels(splice_view,0,y,splice_image->columns,1,\n exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,q) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n for ( ; x < (ssize_t) (splice_geometry.x+splice_geometry.width); x++)\n q+=GetPixelChannels(splice_image);\n for ( ; x < (ssize_t) splice_image->columns; x++)\n {\n register ssize_t\n i;\n\n if (GetPixelReadMask(image,q) == 0)\n {\n SetPixelBackgoundColor(splice_image,q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n continue;\n }\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel=GetPixelChannelChannel(image,i);\n PixelTrait traits=GetPixelChannelTraits(image,channel);\n PixelTrait splice_traits=GetPixelChannelTraits(splice_image,channel);\n if ((traits == UndefinedPixelTrait) ||\n (splice_traits == UndefinedPixelTrait))\n continue;\n SetPixelChannel(splice_image,channel,p[i],q);\n }\n SetPixelRed(splice_image,GetPixelRed(image,p),q);\n SetPixelGreen(splice_image,GetPixelGreen(image,p),q);\n SetPixelBlue(splice_image,GetPixelBlue(image,p),q);\n SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(splice_image);\n }\n if (SyncCacheViewAuthenticPixels(splice_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_TransposeImage)\n#endif\n proceed=SetImageProgress(image,SpliceImageTag,progress++,\n splice_image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n splice_view=DestroyCacheView(splice_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n splice_image=DestroyImage(splice_image);\n return(splice_image);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"SpliceImage","file_name":"MagickCore/transform.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/7b1cf5784b5bcd85aa9293ecf56769f68c037231","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#40-8cbe1ab126a5","input":"wrap_lines_smart(ASS_Renderer *render_priv, double max_text_width)\n{\n int i;\n GlyphInfo *cur, *s1, *e1, *s2, *s3;\n int last_space;\n int break_type;\n int exit;\n double pen_shift_x;\n double pen_shift_y;\n int cur_line;\n int run_offset;\n TextInfo *text_info = &render_priv->text_info;\n\n last_space = -1;\n text_info->n_lines = 1;\n break_type = 0;\n s1 = text_info->glyphs; // current line start\n for (i = 0; i < text_info->length; ++i) {\n int break_at = -1;\n double s_offset, len;\n cur = text_info->glyphs + i;\n s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x);\n len = d6_to_double(cur->bbox.xMax + cur->pos.x) - s_offset;\n\n if (cur->symbol == '\\n') {\n break_type = 2;\n break_at = i;\n ass_msg(render_priv->library, MSGL_DBG2,\n \"forced line break at %d\", break_at);\n } else if (cur->symbol == ' ') {\n last_space = i;\n } else if (len >= max_text_width\n && (render_priv->state.wrap_style != 2)) {\n break_type = 1;\n break_at = last_space;\n if (break_at >= 0)\n ass_msg(render_priv->library, MSGL_DBG2, \"line break at %d\",\n break_at);\n }\n\n if (break_at != -1) {\n // need to use one more line\n // marking break_at+1 as start of a new line\n int lead = break_at + 1; // the first symbol of the new line\n if (text_info->n_lines >= text_info->max_lines) {\n // Raise maximum number of lines\n text_info->max_lines *= 2;\n text_info->lines = realloc(text_info->lines,\n sizeof(LineInfo) *\n text_info->max_lines);\n }\n if (lead < text_info->length) {\n text_info->glyphs[lead].linebreak = break_type;\n last_space = -1;\n s1 = text_info->glyphs + lead;\n text_info->n_lines++;\n }\n }\n }\n#define DIFF(x,y) (((x) < (y)) ? (y - x) : (x - y))\n exit = 0;\n while (!exit && render_priv->state.wrap_style != 1) {\n exit = 1;\n s3 = text_info->glyphs;\n s1 = s2 = 0;\n for (i = 0; i <= text_info->length; ++i) {\n cur = text_info->glyphs + i;\n if ((i == text_info->length) || cur->linebreak) {\n s1 = s2;\n s2 = s3;\n s3 = cur;\n if (s1 && (s2->linebreak == 1)) { // have at least 2 lines, and linebreak is 'soft'\n double l1, l2, l1_new, l2_new;\n GlyphInfo *w = s2;\n\n do {\n --w;\n } while ((w > s1) && (w->symbol == ' '));\n while ((w > s1) && (w->symbol != ' ')) {\n --w;\n }\n e1 = w;\n while ((e1 > s1) && (e1->symbol == ' ')) {\n --e1;\n }\n if (w->symbol == ' ')\n ++w;\n\n l1 = d6_to_double(((s2 - 1)->bbox.xMax + (s2 - 1)->pos.x) -\n (s1->bbox.xMin + s1->pos.x));\n l2 = d6_to_double(((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) -\n (s2->bbox.xMin + s2->pos.x));\n l1_new = d6_to_double(\n (e1->bbox.xMax + e1->pos.x) -\n (s1->bbox.xMin + s1->pos.x));\n l2_new = d6_to_double(\n ((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) -\n (w->bbox.xMin + w->pos.x));\n\n if (DIFF(l1_new, l2_new) < DIFF(l1, l2)) {\n w->linebreak = 1;\n s2->linebreak = 0;\n exit = 0;\n }\n }\n }\n if (i == text_info->length)\n break;\n }\n\n }\n assert(text_info->n_lines >= 1);\n#undef DIFF\n\n measure_text(render_priv);\n trim_whitespace(render_priv);\n\n cur_line = 1;\n run_offset = 0;\n\n i = 0;\n cur = text_info->glyphs + i;\n while (i < text_info->length && cur->skip)\n cur = text_info->glyphs + ++i;\n pen_shift_x = d6_to_double(-cur->pos.x);\n pen_shift_y = 0.;\n\n for (i = 0; i < text_info->length; ++i) {\n cur = text_info->glyphs + i;\n if (cur->linebreak) {\n while (i < text_info->length && cur->skip && cur->symbol != '\\n')\n cur = text_info->glyphs + ++i;\n double height =\n text_info->lines[cur_line - 1].desc +\n text_info->lines[cur_line].asc;\n text_info->lines[cur_line - 1].len = i -\n text_info->lines[cur_line - 1].offset;\n text_info->lines[cur_line].offset = i;\n cur_line++;\n run_offset++;\n pen_shift_x = d6_to_double(-cur->pos.x);\n pen_shift_y += height + render_priv->settings.line_spacing;\n }\n cur->pos.x += double_to_d6(pen_shift_x);\n cur->pos.y += double_to_d6(pen_shift_y);\n }\n text_info->lines[cur_line - 1].len =\n text_info->length - text_info->lines[cur_line - 1].offset;\n\n#if 0\n // print line info\n for (i = 0; i < text_info->n_lines; i++) {\n printf(\"line %d offset %d length %d\\n\", i, text_info->lines[i].offset,\n text_info->lines[i].len);\n }\n#endif\n}","target":"wrap_lines_smart(ASS_Renderer *render_priv, double max_text_width)\n{\n int i;\n GlyphInfo *cur, *s1, *e1, *s2, *s3;\n int last_space;\n int break_type;\n int exit;\n double pen_shift_x;\n double pen_shift_y;\n int cur_line;\n int run_offset;\n TextInfo *text_info = &render_priv->text_info;\n\n last_space = -1;\n text_info->n_lines = 1;\n break_type = 0;\n s1 = text_info->glyphs; // current line start\n for (i = 0; i < text_info->length; ++i) {\n int break_at = -1;\n double s_offset, len;\n cur = text_info->glyphs + i;\n s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x);\n len = d6_to_double(cur->bbox.xMax + cur->pos.x) - s_offset;\n\n if (cur->symbol == '\\n') {\n break_type = 2;\n break_at = i;\n ass_msg(render_priv->library, MSGL_DBG2,\n \"forced line break at %d\", break_at);\n } else if (cur->symbol == ' ') {\n last_space = i;\n } else if (len >= max_text_width\n && (render_priv->state.wrap_style != 2)) {\n break_type = 1;\n break_at = last_space;\n if (break_at >= 0)\n ass_msg(render_priv->library, MSGL_DBG2, \"line break at %d\",\n break_at);\n }\n\n if (break_at != -1) {\n // need to use one more line\n // marking break_at+1 as start of a new line\n int lead = break_at + 1; // the first symbol of the new line\n if (text_info->n_lines >= text_info->max_lines) {\n // Raise maximum number of lines\n text_info->max_lines *= 2;\n text_info->lines = realloc(text_info->lines,\n sizeof(LineInfo) *\n text_info->max_lines);\n }\n if (lead < text_info->length) {\n text_info->glyphs[lead].linebreak = break_type;\n last_space = -1;\n s1 = text_info->glyphs + lead;\n text_info->n_lines++;\n }\n }\n }\n#define DIFF(x,y) (((x) < (y)) ? (y - x) : (x - y))\n exit = 0;\n while (!exit && render_priv->state.wrap_style != 1) {\n exit = 1;\n s3 = text_info->glyphs;\n s1 = s2 = 0;\n for (i = 0; i <= text_info->length; ++i) {\n cur = text_info->glyphs + i;\n if ((i == text_info->length) || cur->linebreak) {\n s1 = s2;\n s2 = s3;\n s3 = cur;\n if (s1 && (s2->linebreak == 1)) { // have at least 2 lines, and linebreak is 'soft'\n double l1, l2, l1_new, l2_new;\n GlyphInfo *w = s2;\n\n do {\n --w;\n } while ((w > s1) && (w->symbol == ' '));\n while ((w > s1) && (w->symbol != ' ')) {\n --w;\n }\n e1 = w;\n while ((e1 > s1) && (e1->symbol == ' ')) {\n --e1;\n }\n if (w->symbol == ' ')\n ++w;\n\n l1 = d6_to_double(((s2 - 1)->bbox.xMax + (s2 - 1)->pos.x) -\n (s1->bbox.xMin + s1->pos.x));\n l2 = d6_to_double(((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) -\n (s2->bbox.xMin + s2->pos.x));\n l1_new = d6_to_double(\n (e1->bbox.xMax + e1->pos.x) -\n (s1->bbox.xMin + s1->pos.x));\n l2_new = d6_to_double(\n ((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) -\n (w->bbox.xMin + w->pos.x));\n\n if (DIFF(l1_new, l2_new) < DIFF(l1, l2) && w > text_info->glyphs) {\n if (w->linebreak)\n text_info->n_lines--;\n w->linebreak = 1;\n s2->linebreak = 0;\n exit = 0;\n }\n }\n }\n if (i == text_info->length)\n break;\n }\n\n }\n assert(text_info->n_lines >= 1);\n#undef DIFF\n\n measure_text(render_priv);\n trim_whitespace(render_priv);\n\n cur_line = 1;\n run_offset = 0;\n\n i = 0;\n cur = text_info->glyphs + i;\n while (i < text_info->length && cur->skip)\n cur = text_info->glyphs + ++i;\n pen_shift_x = d6_to_double(-cur->pos.x);\n pen_shift_y = 0.;\n\n for (i = 0; i < text_info->length; ++i) {\n cur = text_info->glyphs + i;\n if (cur->linebreak) {\n while (i < text_info->length && cur->skip && cur->symbol != '\\n')\n cur = text_info->glyphs + ++i;\n double height =\n text_info->lines[cur_line - 1].desc +\n text_info->lines[cur_line].asc;\n text_info->lines[cur_line - 1].len = i -\n text_info->lines[cur_line - 1].offset;\n text_info->lines[cur_line].offset = i;\n cur_line++;\n run_offset++;\n pen_shift_x = d6_to_double(-cur->pos.x);\n pen_shift_y += height + render_priv->settings.line_spacing;\n }\n cur->pos.x += double_to_d6(pen_shift_x);\n cur->pos.y += double_to_d6(pen_shift_y);\n }\n text_info->lines[cur_line - 1].len =\n text_info->length - text_info->lines[cur_line - 1].offset;\n\n#if 0\n // print line info\n for (i = 0; i < text_info->n_lines; i++) {\n printf(\"line %d offset %d length %d\\n\", i, text_info->lines[i].offset,\n text_info->lines[i].len);\n }\n#endif\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"wrap_lines_smart","file_name":"libass/ass_render.c","commit_link":"github.com/libass/libass/commit/b72b283b936a600c730e00875d7d067bded3fc26","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#41-3d91dc2ab192","input":"repodata_schema2id(Repodata *data, Id *schema, int create)\n{\n int h, len, i;\n Id *sp, cid;\n Id *schematahash;\n\n if (!*schema)\n return 0;\t/* XXX: allow empty schema? */\n if ((schematahash = data->schematahash) == 0)\n {\n data->schematahash = schematahash = solv_calloc(256, sizeof(Id));\n for (i = 1; i < data->nschemata; i++)\n\t{\n\t for (sp = data->schemadata + data->schemata[i], h = 0; *sp;)\n\t h = h * 7 + *sp++;\n\t h &= 255;\n\t schematahash[h] = i;\n\t}\n data->schemadata = solv_extend_resize(data->schemadata, data->schemadatalen, sizeof(Id), SCHEMATADATA_BLOCK);\n data->schemata = solv_extend_resize(data->schemata, data->nschemata, sizeof(Id), SCHEMATA_BLOCK);\n }\n\n for (sp = schema, len = 0, h = 0; *sp; len++)\n h = h * 7 + *sp++;\n h &= 255;\n len++;\n\n cid = schematahash[h];\n if (cid)\n {\n if (!memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))\n return cid;\n /* cache conflict, do a slow search */\n for (cid = 1; cid < data->nschemata; cid++)\n if (!memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))\n return cid;\n }\n /* a new one */\n if (!create)\n return 0;\n data->schemadata = solv_extend(data->schemadata, data->schemadatalen, len, sizeof(Id), SCHEMATADATA_BLOCK);\n data->schemata = solv_extend(data->schemata, data->nschemata, 1, sizeof(Id), SCHEMATA_BLOCK);\n /* add schema */\n memcpy(data->schemadata + data->schemadatalen, schema, len * sizeof(Id));\n data->schemata[data->nschemata] = data->schemadatalen;\n data->schemadatalen += len;\n schematahash[h] = data->nschemata;\n#if 0\nfprintf(stderr, \"schema2id: new schema\\n\");\n#endif\n return data->nschemata++;\n}","target":"repodata_schema2id(Repodata *data, Id *schema, int create)\n{\n int h, len, i;\n Id *sp, cid;\n Id *schematahash;\n\n if (!*schema)\n return 0;\t/* XXX: allow empty schema? */\n if ((schematahash = data->schematahash) == 0)\n {\n data->schematahash = schematahash = solv_calloc(256, sizeof(Id));\n for (i = 1; i < data->nschemata; i++)\n\t{\n\t for (sp = data->schemadata + data->schemata[i], h = 0; *sp;)\n\t h = h * 7 + *sp++;\n\t h &= 255;\n\t schematahash[h] = i;\n\t}\n data->schemadata = solv_extend_resize(data->schemadata, data->schemadatalen, sizeof(Id), SCHEMATADATA_BLOCK);\n data->schemata = solv_extend_resize(data->schemata, data->nschemata, sizeof(Id), SCHEMATA_BLOCK);\n }\n\n for (sp = schema, len = 0, h = 0; *sp; len++)\n h = h * 7 + *sp++;\n h &= 255;\n len++;\n\n cid = schematahash[h];\n if (cid)\n {\n if ((data->schemata[cid] + len <= data->schemadatalen) &&\n\t\t\t !memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))\n return cid;\n /* cache conflict, do a slow search */\n for (cid = 1; cid < data->nschemata; cid++)\n if ((data->schemata[cid] + len <= data->schemadatalen) &&\n\t\t\t\t!memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))\n return cid;\n }\n /* a new one */\n if (!create)\n return 0;\n data->schemadata = solv_extend(data->schemadata, data->schemadatalen, len, sizeof(Id), SCHEMATADATA_BLOCK);\n data->schemata = solv_extend(data->schemata, data->nschemata, 1, sizeof(Id), SCHEMATA_BLOCK);\n /* add schema */\n memcpy(data->schemadata + data->schemadatalen, schema, len * sizeof(Id));\n data->schemata[data->nschemata] = data->schemadatalen;\n data->schemadatalen += len;\n schematahash[h] = data->nschemata;\n#if 0\nfprintf(stderr, \"schema2id: new schema\\n\");\n#endif\n return data->nschemata++;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"repodata_schema2id","file_name":"src/repodata.c","commit_link":"github.com/openSUSE/libsolv/commit/fdb9c9c03508990e4583046b590c30d958f272da","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#42-d4b0a41b099a","input":"MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,\n ExceptionInfo *exception)\n{\n#define ComplexImageTag \"Complex/Image\"\n\n CacheView\n *Ai_view,\n *Ar_view,\n *Bi_view,\n *Br_view,\n *Ci_view,\n *Cr_view;\n\n const char\n *artifact;\n\n const Image\n *Ai_image,\n *Ar_image,\n *Bi_image,\n *Br_image;\n\n double\n snr;\n\n Image\n *Ci_image,\n *complex_images,\n *Cr_image,\n *image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n ssize_t\n y;\n\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n if (images->next == (Image *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),ImageError,\n \"ImageSequenceRequired\",\"`%s'\",images->filename);\n return((Image *) NULL);\n }\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)\n {\n image=DestroyImageList(image);\n return(image);\n }\n image->depth=32UL;\n complex_images=NewImageList();\n AppendImageToList(&complex_images,image);\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n {\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n }\n AppendImageToList(&complex_images,image);\n /*\n Apply complex mathematics to image pixels.\n */\n artifact=GetImageArtifact(image,\"complex:snr\");\n snr=0.0;\n if (artifact != (const char *) NULL)\n snr=StringToDouble(artifact,(char **) NULL);\n Ar_image=images;\n Ai_image=images->next;\n Br_image=images;\n Bi_image=images->next;\n if ((images->next->next != (Image *) NULL) &&\n (images->next->next->next != (Image *) NULL))\n {\n Br_image=images->next->next;\n Bi_image=images->next->next->next;\n }\n Cr_image=complex_images;\n Ci_image=complex_images->next;\n Ar_view=AcquireVirtualCacheView(Ar_image,exception);\n Ai_view=AcquireVirtualCacheView(Ai_image,exception);\n Br_view=AcquireVirtualCacheView(Br_image,exception);\n Bi_view=AcquireVirtualCacheView(Bi_image,exception);\n Cr_view=AcquireAuthenticCacheView(Cr_image,exception);\n Ci_view=AcquireAuthenticCacheView(Ci_image,exception);\n status=MagickTrue;\n progress=0;\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(Cr_image,complex_images,Cr_image->rows,1L)\n#endif\n for (y=0; y < (ssize_t) Cr_image->rows; y++)\n {\n register const Quantum\n *magick_restrict Ai,\n *magick_restrict Ar,\n *magick_restrict Bi,\n *magick_restrict Br;\n\n register Quantum\n *magick_restrict Ci,\n *magick_restrict Cr;\n\n register ssize_t\n x;\n\n if (status == MagickFalse)\n continue;\n Ar=GetCacheViewVirtualPixels(Ar_view,0,y,Cr_image->columns,1,exception);\n Ai=GetCacheViewVirtualPixels(Ai_view,0,y,Cr_image->columns,1,exception);\n Br=GetCacheViewVirtualPixels(Br_view,0,y,Cr_image->columns,1,exception);\n Bi=GetCacheViewVirtualPixels(Bi_view,0,y,Cr_image->columns,1,exception);\n Cr=QueueCacheViewAuthenticPixels(Cr_view,0,y,Cr_image->columns,1,exception);\n Ci=QueueCacheViewAuthenticPixels(Ci_view,0,y,Ci_image->columns,1,exception);\n if ((Ar == (const Quantum *) NULL) || (Ai == (const Quantum *) NULL) || \n (Br == (const Quantum *) NULL) || (Bi == (const Quantum *) NULL) ||\n (Cr == (Quantum *) NULL) || (Ci == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < (ssize_t) Cr_image->columns; x++)\n {\n register ssize_t\n i;\n\n for (i=0; i < (ssize_t) GetPixelChannels(Cr_image); i++)\n {\n switch (op)\n {\n case AddComplexOperator:\n {\n Cr[i]=Ar[i]+Br[i];\n Ci[i]=Ai[i]+Bi[i];\n break;\n }\n case ConjugateComplexOperator:\n default:\n {\n Cr[i]=Ar[i];\n Ci[i]=(-Bi[i]);\n break;\n }\n case DivideComplexOperator:\n {\n double\n gamma;\n\n gamma=PerceptibleReciprocal((double) Br[i]*Br[i]+Bi[i]*Bi[i]+snr);\n Cr[i]=gamma*((double) Ar[i]*Br[i]+(double) Ai[i]*Bi[i]);\n Ci[i]=gamma*((double) Ai[i]*Br[i]-(double) Ar[i]*Bi[i]);\n break;\n }\n case MagnitudePhaseComplexOperator:\n {\n Cr[i]=sqrt((double) Ar[i]*Ar[i]+(double) Ai[i]*Ai[i]);\n Ci[i]=atan2((double) Ai[i],(double) Ar[i])/(2.0*MagickPI)+0.5;\n break;\n }\n case MultiplyComplexOperator:\n {\n Cr[i]=QuantumScale*((double) Ar[i]*Br[i]-(double) Ai[i]*Bi[i]);\n Ci[i]=QuantumScale*((double) Ai[i]*Br[i]+(double) Ar[i]*Bi[i]);\n break;\n }\n case RealImaginaryComplexOperator:\n {\n Cr[i]=Ar[i]*cos(2.0*MagickPI*(Ai[i]-0.5));\n Ci[i]=Ar[i]*sin(2.0*MagickPI*(Ai[i]-0.5));\n break;\n }\n case SubtractComplexOperator:\n {\n Cr[i]=Ar[i]-Br[i];\n Ci[i]=Ai[i]-Bi[i];\n break;\n }\n }\n }\n Ar+=GetPixelChannels(Ar_image);\n Ai+=GetPixelChannels(Ai_image);\n Br+=GetPixelChannels(Br_image);\n Bi+=GetPixelChannels(Bi_image);\n Cr+=GetPixelChannels(Cr_image);\n Ci+=GetPixelChannels(Ci_image);\n }\n if (SyncCacheViewAuthenticPixels(Ci_view,exception) == MagickFalse)\n status=MagickFalse;\n if (SyncCacheViewAuthenticPixels(Cr_view,exception) == MagickFalse)\n status=MagickFalse;\n if (images->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(images,ComplexImageTag,progress,images->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n Cr_view=DestroyCacheView(Cr_view);\n Ci_view=DestroyCacheView(Ci_view);\n Br_view=DestroyCacheView(Br_view);\n Bi_view=DestroyCacheView(Bi_view);\n Ar_view=DestroyCacheView(Ar_view);\n Ai_view=DestroyCacheView(Ai_view);\n if (status == MagickFalse)\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n}","target":"MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,\n ExceptionInfo *exception)\n{\n#define ComplexImageTag \"Complex/Image\"\n\n CacheView\n *Ai_view,\n *Ar_view,\n *Bi_view,\n *Br_view,\n *Ci_view,\n *Cr_view;\n\n const char\n *artifact;\n\n const Image\n *Ai_image,\n *Ar_image,\n *Bi_image,\n *Br_image;\n\n double\n snr;\n\n Image\n *Ci_image,\n *complex_images,\n *Cr_image,\n *image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n size_t\n number_channels;\n\n ssize_t\n y;\n\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n if (images->next == (Image *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),ImageError,\n \"ImageSequenceRequired\",\"`%s'\",images->filename);\n return((Image *) NULL);\n }\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)\n {\n image=DestroyImageList(image);\n return(image);\n }\n image->depth=32UL;\n complex_images=NewImageList();\n AppendImageToList(&complex_images,image);\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n {\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n }\n AppendImageToList(&complex_images,image);\n /*\n Apply complex mathematics to image pixels.\n */\n artifact=GetImageArtifact(image,\"complex:snr\");\n snr=0.0;\n if (artifact != (const char *) NULL)\n snr=StringToDouble(artifact,(char **) NULL);\n Ar_image=images;\n Ai_image=images->next;\n Br_image=images;\n Bi_image=images->next;\n if ((images->next->next != (Image *) NULL) &&\n (images->next->next->next != (Image *) NULL))\n {\n Br_image=images->next->next;\n Bi_image=images->next->next->next;\n }\n Cr_image=complex_images;\n Ci_image=complex_images->next;\n number_channels=MagickMin(MagickMin(MagickMin(\n Ar_image->number_channels,Ai_image->number_channels),MagickMin(\n Br_image->number_channels,Bi_image->number_channels)),MagickMin(\n Cr_image->number_channels,Ci_image->number_channels));\n Ar_view=AcquireVirtualCacheView(Ar_image,exception);\n Ai_view=AcquireVirtualCacheView(Ai_image,exception);\n Br_view=AcquireVirtualCacheView(Br_image,exception);\n Bi_view=AcquireVirtualCacheView(Bi_image,exception);\n Cr_view=AcquireAuthenticCacheView(Cr_image,exception);\n Ci_view=AcquireAuthenticCacheView(Ci_image,exception);\n status=MagickTrue;\n progress=0;\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(Cr_image,complex_images,Cr_image->rows,1L)\n#endif\n for (y=0; y < (ssize_t) Cr_image->rows; y++)\n {\n register const Quantum\n *magick_restrict Ai,\n *magick_restrict Ar,\n *magick_restrict Bi,\n *magick_restrict Br;\n\n register Quantum\n *magick_restrict Ci,\n *magick_restrict Cr;\n\n register ssize_t\n x;\n\n if (status == MagickFalse)\n continue;\n Ar=GetCacheViewVirtualPixels(Ar_view,0,y,Cr_image->columns,1,exception);\n Ai=GetCacheViewVirtualPixels(Ai_view,0,y,Cr_image->columns,1,exception);\n Br=GetCacheViewVirtualPixels(Br_view,0,y,Cr_image->columns,1,exception);\n Bi=GetCacheViewVirtualPixels(Bi_view,0,y,Cr_image->columns,1,exception);\n Cr=QueueCacheViewAuthenticPixels(Cr_view,0,y,Cr_image->columns,1,exception);\n Ci=QueueCacheViewAuthenticPixels(Ci_view,0,y,Ci_image->columns,1,exception);\n if ((Ar == (const Quantum *) NULL) || (Ai == (const Quantum *) NULL) || \n (Br == (const Quantum *) NULL) || (Bi == (const Quantum *) NULL) ||\n (Cr == (Quantum *) NULL) || (Ci == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n for (x=0; x < (ssize_t) Cr_image->columns; x++)\n {\n register ssize_t\n i;\n\n for (i=0; i < (ssize_t) number_channels; i++)\n {\n switch (op)\n {\n case AddComplexOperator:\n {\n Cr[i]=Ar[i]+Br[i];\n Ci[i]=Ai[i]+Bi[i];\n break;\n }\n case ConjugateComplexOperator:\n default:\n {\n Cr[i]=Ar[i];\n Ci[i]=(-Bi[i]);\n break;\n }\n case DivideComplexOperator:\n {\n double\n gamma;\n\n gamma=PerceptibleReciprocal((double) Br[i]*Br[i]+Bi[i]*Bi[i]+snr);\n Cr[i]=gamma*((double) Ar[i]*Br[i]+(double) Ai[i]*Bi[i]);\n Ci[i]=gamma*((double) Ai[i]*Br[i]-(double) Ar[i]*Bi[i]);\n break;\n }\n case MagnitudePhaseComplexOperator:\n {\n Cr[i]=sqrt((double) Ar[i]*Ar[i]+(double) Ai[i]*Ai[i]);\n Ci[i]=atan2((double) Ai[i],(double) Ar[i])/(2.0*MagickPI)+0.5;\n break;\n }\n case MultiplyComplexOperator:\n {\n Cr[i]=QuantumScale*((double) Ar[i]*Br[i]-(double) Ai[i]*Bi[i]);\n Ci[i]=QuantumScale*((double) Ai[i]*Br[i]+(double) Ar[i]*Bi[i]);\n break;\n }\n case RealImaginaryComplexOperator:\n {\n Cr[i]=Ar[i]*cos(2.0*MagickPI*(Ai[i]-0.5));\n Ci[i]=Ar[i]*sin(2.0*MagickPI*(Ai[i]-0.5));\n break;\n }\n case SubtractComplexOperator:\n {\n Cr[i]=Ar[i]-Br[i];\n Ci[i]=Ai[i]-Bi[i];\n break;\n }\n }\n }\n Ar+=GetPixelChannels(Ar_image);\n Ai+=GetPixelChannels(Ai_image);\n Br+=GetPixelChannels(Br_image);\n Bi+=GetPixelChannels(Bi_image);\n Cr+=GetPixelChannels(Cr_image);\n Ci+=GetPixelChannels(Ci_image);\n }\n if (SyncCacheViewAuthenticPixels(Ci_view,exception) == MagickFalse)\n status=MagickFalse;\n if (SyncCacheViewAuthenticPixels(Cr_view,exception) == MagickFalse)\n status=MagickFalse;\n if (images->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(images,ComplexImageTag,progress,images->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n Cr_view=DestroyCacheView(Cr_view);\n Ci_view=DestroyCacheView(Ci_view);\n Br_view=DestroyCacheView(Br_view);\n Bi_view=DestroyCacheView(Bi_view);\n Ar_view=DestroyCacheView(Ar_view);\n Ai_view=DestroyCacheView(Ai_view);\n if (status == MagickFalse)\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ComplexImages","file_name":"MagickCore/fourier.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/d5089971bd792311aaab5cb73460326d7ef7f32d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#43-305e4645fb0b","input":"static void ttm_put_pages(struct page **pages, unsigned npages, int flags,\n\t\t\t enum ttm_caching_state cstate)\n{\n\tstruct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate);\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\tstruct ttm_page_pool *huge = ttm_get_pool(flags, true, cstate);\n#endif\n\tunsigned long irq_flags;\n\tunsigned i;\n\n\tif (pool == NULL) {\n\t\t/* No pool for this memory type so free the pages */\n\t\ti = 0;\n\t\twhile (i < npages) {\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\t\t\tstruct page *p = pages[i];\n#endif\n\t\t\tunsigned order = 0, j;\n\n\t\t\tif (!pages[i]) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\t\t\tif (!(flags & TTM_PAGE_FLAG_DMA32) &&\n\t\t\t (npages - i) >= HPAGE_PMD_NR) {\n\t\t\t\tfor (j = 1; j < HPAGE_PMD_NR; ++j)\n\t\t\t\t\tif (p++ != pages[i + j])\n\t\t\t\t\t break;\n\n\t\t\t\tif (j == HPAGE_PMD_NR)\n\t\t\t\t\torder = HPAGE_PMD_ORDER;\n\t\t\t}\n#endif\n\n\t\t\tif (page_count(pages[i]) != 1)\n\t\t\t\tpr_err(\"Erroneous page count. Leaking pages.\\n\");\n\t\t\t__free_pages(pages[i], order);\n\n\t\t\tj = 1 << order;\n\t\t\twhile (j) {\n\t\t\t\tpages[i++] = NULL;\n\t\t\t\t--j;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\ti = 0;\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\tif (huge) {\n\t\tunsigned max_size, n2free;\n\n\t\tspin_lock_irqsave(&huge->lock, irq_flags);\n\t\twhile ((npages - i) >= HPAGE_PMD_NR) {\n\t\t\tstruct page *p = pages[i];\n\t\t\tunsigned j;\n\n\t\t\tif (!p)\n\t\t\t\tbreak;\n\n\t\t\tfor (j = 1; j < HPAGE_PMD_NR; ++j)\n\t\t\t\tif (p++ != pages[i + j])\n\t\t\t\t break;\n\n\t\t\tif (j != HPAGE_PMD_NR)\n\t\t\t\tbreak;\n\n\t\t\tlist_add_tail(&pages[i]->lru, &huge->list);\n\n\t\t\tfor (j = 0; j < HPAGE_PMD_NR; ++j)\n\t\t\t\tpages[i++] = NULL;\n\t\t\thuge->npages++;\n\t\t}\n\n\t\t/* Check that we don't go over the pool limit */\n\t\tmax_size = _manager->options.max_size;\n\t\tmax_size /= HPAGE_PMD_NR;\n\t\tif (huge->npages > max_size)\n\t\t\tn2free = huge->npages - max_size;\n\t\telse\n\t\t\tn2free = 0;\n\t\tspin_unlock_irqrestore(&huge->lock, irq_flags);\n\t\tif (n2free)\n\t\t\tttm_page_pool_free(huge, n2free, false);\n\t}\n#endif\n\n\tspin_lock_irqsave(&pool->lock, irq_flags);\n\twhile (i < npages) {\n\t\tif (pages[i]) {\n\t\t\tif (page_count(pages[i]) != 1)\n\t\t\t\tpr_err(\"Erroneous page count. Leaking pages.\\n\");\n\t\t\tlist_add_tail(&pages[i]->lru, &pool->list);\n\t\t\tpages[i] = NULL;\n\t\t\tpool->npages++;\n\t\t}\n\t\t++i;\n\t}\n\t/* Check that we don't go over the pool limit */\n\tnpages = 0;\n\tif (pool->npages > _manager->options.max_size) {\n\t\tnpages = pool->npages - _manager->options.max_size;\n\t\t/* free at least NUM_PAGES_TO_ALLOC number of pages\n\t\t * to reduce calls to set_memory_wb */\n\t\tif (npages < NUM_PAGES_TO_ALLOC)\n\t\t\tnpages = NUM_PAGES_TO_ALLOC;\n\t}\n\tspin_unlock_irqrestore(&pool->lock, irq_flags);\n\tif (npages)\n\t\tttm_page_pool_free(pool, npages, false);\n}","target":"static void ttm_put_pages(struct page **pages, unsigned npages, int flags,\n\t\t\t enum ttm_caching_state cstate)\n{\n\tstruct ttm_page_pool *pool = ttm_get_pool(flags, false, cstate);\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\tstruct ttm_page_pool *huge = ttm_get_pool(flags, true, cstate);\n#endif\n\tunsigned long irq_flags;\n\tunsigned i;\n\n\tif (pool == NULL) {\n\t\t/* No pool for this memory type so free the pages */\n\t\ti = 0;\n\t\twhile (i < npages) {\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\t\t\tstruct page *p = pages[i];\n#endif\n\t\t\tunsigned order = 0, j;\n\n\t\t\tif (!pages[i]) {\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\t\t\tif (!(flags & TTM_PAGE_FLAG_DMA32) &&\n\t\t\t (npages - i) >= HPAGE_PMD_NR) {\n\t\t\t\tfor (j = 1; j < HPAGE_PMD_NR; ++j)\n\t\t\t\t\tif (++p != pages[i + j])\n\t\t\t\t\t break;\n\n\t\t\t\tif (j == HPAGE_PMD_NR)\n\t\t\t\t\torder = HPAGE_PMD_ORDER;\n\t\t\t}\n#endif\n\n\t\t\tif (page_count(pages[i]) != 1)\n\t\t\t\tpr_err(\"Erroneous page count. Leaking pages.\\n\");\n\t\t\t__free_pages(pages[i], order);\n\n\t\t\tj = 1 << order;\n\t\t\twhile (j) {\n\t\t\t\tpages[i++] = NULL;\n\t\t\t\t--j;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\ti = 0;\n#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n\tif (huge) {\n\t\tunsigned max_size, n2free;\n\n\t\tspin_lock_irqsave(&huge->lock, irq_flags);\n\t\twhile ((npages - i) >= HPAGE_PMD_NR) {\n\t\t\tstruct page *p = pages[i];\n\t\t\tunsigned j;\n\n\t\t\tif (!p)\n\t\t\t\tbreak;\n\n\t\t\tfor (j = 1; j < HPAGE_PMD_NR; ++j)\n\t\t\t\tif (++p != pages[i + j])\n\t\t\t\t break;\n\n\t\t\tif (j != HPAGE_PMD_NR)\n\t\t\t\tbreak;\n\n\t\t\tlist_add_tail(&pages[i]->lru, &huge->list);\n\n\t\t\tfor (j = 0; j < HPAGE_PMD_NR; ++j)\n\t\t\t\tpages[i++] = NULL;\n\t\t\thuge->npages++;\n\t\t}\n\n\t\t/* Check that we don't go over the pool limit */\n\t\tmax_size = _manager->options.max_size;\n\t\tmax_size /= HPAGE_PMD_NR;\n\t\tif (huge->npages > max_size)\n\t\t\tn2free = huge->npages - max_size;\n\t\telse\n\t\t\tn2free = 0;\n\t\tspin_unlock_irqrestore(&huge->lock, irq_flags);\n\t\tif (n2free)\n\t\t\tttm_page_pool_free(huge, n2free, false);\n\t}\n#endif\n\n\tspin_lock_irqsave(&pool->lock, irq_flags);\n\twhile (i < npages) {\n\t\tif (pages[i]) {\n\t\t\tif (page_count(pages[i]) != 1)\n\t\t\t\tpr_err(\"Erroneous page count. Leaking pages.\\n\");\n\t\t\tlist_add_tail(&pages[i]->lru, &pool->list);\n\t\t\tpages[i] = NULL;\n\t\t\tpool->npages++;\n\t\t}\n\t\t++i;\n\t}\n\t/* Check that we don't go over the pool limit */\n\tnpages = 0;\n\tif (pool->npages > _manager->options.max_size) {\n\t\tnpages = pool->npages - _manager->options.max_size;\n\t\t/* free at least NUM_PAGES_TO_ALLOC number of pages\n\t\t * to reduce calls to set_memory_wb */\n\t\tif (npages < NUM_PAGES_TO_ALLOC)\n\t\t\tnpages = NUM_PAGES_TO_ALLOC;\n\t}\n\tspin_unlock_irqrestore(&pool->lock, irq_flags);\n\tif (npages)\n\t\tttm_page_pool_free(pool, npages, false);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ttm_put_pages","file_name":"drivers/gpu/drm/ttm/ttm_page_alloc.c","commit_link":"github.com/torvalds/linux/commit/453393369dc9806d2455151e329c599684762428","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#44-66e9d87c6a51","input":"matchCurrentInput(\n\t\tconst InString *input, int pos, const widechar *passInstructions, int passIC) {\n\tint k;\n\tint kk = pos;\n\tfor (k = passIC + 2; k < passIC + 2 + passInstructions[passIC + 1]; k++)\n\t\tif (input->chars[kk] == ENDSEGMENT || passInstructions[k] != input->chars[kk++])\n\t\t\treturn 0;\n\treturn 1;\n}","target":"matchCurrentInput(\n\t\tconst InString *input, int pos, const widechar *passInstructions, int passIC) {\n\tint k;\n\tint kk = pos;\n\tfor (k = passIC + 2;\n\t\t\t((k < passIC + 2 + passInstructions[passIC + 1]) && (kk < input->length));\n\t\t\tk++)\n\t\tif (input->chars[kk] == ENDSEGMENT || passInstructions[k] != input->chars[kk++])\n\t\t\treturn 0;\n\treturn 1;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"matchCurrentInput","file_name":"liblouis/lou_translateString.c","commit_link":"github.com/liblouis/liblouis/commit/5e4089659bb49b3095fa541fa6387b4c40d7396e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#45-1caa0ec74d5c","input":"static const struct usb_cdc_union_desc *\nims_pcu_get_cdc_union_desc(struct usb_interface *intf)\n{\n\tconst void *buf = intf->altsetting->extra;\n\tsize_t buflen = intf->altsetting->extralen;\n\tstruct usb_cdc_union_desc *union_desc;\n\n\tif (!buf) {\n\t\tdev_err(&intf->dev, \"Missing descriptor data\\n\");\n\t\treturn NULL;\n\t}\n\n\tif (!buflen) {\n\t\tdev_err(&intf->dev, \"Zero length descriptor\\n\");\n\t\treturn NULL;\n\t}\n\n\twhile (buflen > 0) {\n\t\tunion_desc = (struct usb_cdc_union_desc *)buf;\n\n\t\tif (union_desc->bDescriptorType == USB_DT_CS_INTERFACE &&\n\t\t union_desc->bDescriptorSubType == USB_CDC_UNION_TYPE) {\n\t\t\tdev_dbg(&intf->dev, \"Found union header\\n\");\n\t\t\treturn union_desc;\n\t\t}\n\n\t\tbuflen -= union_desc->bLength;\n\t\tbuf += union_desc->bLength;\n\t}\n\n\tdev_err(&intf->dev, \"Missing CDC union descriptor\\n\");\n\treturn NULL;","target":"static const struct usb_cdc_union_desc *\nims_pcu_get_cdc_union_desc(struct usb_interface *intf)\n{\n\tconst void *buf = intf->altsetting->extra;\n\tsize_t buflen = intf->altsetting->extralen;\n\tstruct usb_cdc_union_desc *union_desc;\n\n\tif (!buf) {\n\t\tdev_err(&intf->dev, \"Missing descriptor data\\n\");\n\t\treturn NULL;\n\t}\n\n\tif (!buflen) {\n\t\tdev_err(&intf->dev, \"Zero length descriptor\\n\");\n\t\treturn NULL;\n\t}\n\n\twhile (buflen >= sizeof(*union_desc)) {\n\t\tunion_desc = (struct usb_cdc_union_desc *)buf;\n\n\t\tif (union_desc->bLength > buflen) {\n\t\t\tdev_err(&intf->dev, \"Too large descriptor\\n\");\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (union_desc->bDescriptorType == USB_DT_CS_INTERFACE &&\n\t\t union_desc->bDescriptorSubType == USB_CDC_UNION_TYPE) {\n\t\t\tdev_dbg(&intf->dev, \"Found union header\\n\");\n\n\t\t\tif (union_desc->bLength >= sizeof(*union_desc))\n\t\t\t\treturn union_desc;\n\n\t\t\tdev_err(&intf->dev,\n\t\t\t\t\"Union descriptor to short (%d vs %zd\\n)\",\n\t\t\t\tunion_desc->bLength, sizeof(*union_desc));\n\t\t\treturn NULL;\n\t\t}\n\n\t\tbuflen -= union_desc->bLength;\n\t\tbuf += union_desc->bLength;\n\t}\n\n\tdev_err(&intf->dev, \"Missing CDC union descriptor\\n\");\n\treturn NULL;","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ims_pcu_get_cdc_union_desc","file_name":"drivers/input/misc/ims-pcu.c","commit_link":"github.com/torvalds/linux/commit/ea04efee7635c9120d015dcdeeeb6988130cb67a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#46-44a508229156","input":" void Compute(OpKernelContext* ctx) override {\n const Tensor& input = ctx->input(0);\n const int depth = (axis_ == -1) ? 1 : input.dim_size(axis_);\n Tensor input_min_tensor;\n Tensor input_max_tensor;\n Tensor* output = nullptr;\n OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &output));\n if (range_given_) {\n input_min_tensor = ctx->input(1);\n input_max_tensor = ctx->input(2);\n if (axis_ == -1) {\n auto min_val = input_min_tensor.scalar()();\n auto max_val = input_max_tensor.scalar()();\n OP_REQUIRES(ctx, min_val <= max_val,\n errors::InvalidArgument(\"Invalid range: input_min \",\n min_val, \" > input_max \", max_val));\n } else {\n OP_REQUIRES(ctx, input_min_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\n \"input_min_tensor has incorrect size, was \",\n input_min_tensor.dim_size(0), \" expected \", depth,\n \" to match dim \", axis_, \" of the input \",\n input_min_tensor.shape()));\n OP_REQUIRES(ctx, input_max_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\n \"input_max_tensor has incorrect size, was \",\n input_max_tensor.dim_size(0), \" expected \", depth,\n \" to match dim \", axis_, \" of the input \",\n input_max_tensor.shape()));\n }\n } else {\n auto range_shape = (axis_ == -1) ? TensorShape({}) : TensorShape({depth});\n OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::value,\n range_shape, &input_min_tensor));\n OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::value,\n range_shape, &input_max_tensor));\n }\n\n if (axis_ == -1) {\n functor::QuantizeAndDequantizeOneScaleFunctor f;\n f(ctx->eigen_device(), input.flat(), signed_input_, num_bits_,\n range_given_, &input_min_tensor, &input_max_tensor, round_mode_,\n narrow_range_, output->flat());\n } else {\n functor::QuantizeAndDequantizePerChannelFunctor f;\n f(ctx->eigen_device(),\n input.template flat_inner_outer_dims(axis_ - 1), signed_input_,\n num_bits_, range_given_, &input_min_tensor, &input_max_tensor,\n round_mode_, narrow_range_,\n output->template flat_inner_outer_dims(axis_ - 1));\n }\n }","target":" void Compute(OpKernelContext* ctx) override {\n const Tensor& input = ctx->input(0);\n OP_REQUIRES(\n ctx, (axis_ == -1 || axis_ < input.shape().dims()),\n errors::InvalidArgument(\"Shape must be at least rank \", axis_ + 1,\n \" but is rank \", input.shape().dims()));\n const int depth = (axis_ == -1) ? 1 : input.dim_size(axis_);\n Tensor input_min_tensor;\n Tensor input_max_tensor;\n Tensor* output = nullptr;\n OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &output));\n if (range_given_) {\n input_min_tensor = ctx->input(1);\n input_max_tensor = ctx->input(2);\n if (axis_ == -1) {\n auto min_val = input_min_tensor.scalar()();\n auto max_val = input_max_tensor.scalar()();\n OP_REQUIRES(ctx, min_val <= max_val,\n errors::InvalidArgument(\"Invalid range: input_min \",\n min_val, \" > input_max \", max_val));\n } else {\n OP_REQUIRES(ctx, input_min_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\n \"input_min_tensor has incorrect size, was \",\n input_min_tensor.dim_size(0), \" expected \", depth,\n \" to match dim \", axis_, \" of the input \",\n input_min_tensor.shape()));\n OP_REQUIRES(ctx, input_max_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\n \"input_max_tensor has incorrect size, was \",\n input_max_tensor.dim_size(0), \" expected \", depth,\n \" to match dim \", axis_, \" of the input \",\n input_max_tensor.shape()));\n }\n } else {\n auto range_shape = (axis_ == -1) ? TensorShape({}) : TensorShape({depth});\n OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::value,\n range_shape, &input_min_tensor));\n OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::value,\n range_shape, &input_max_tensor));\n }\n\n if (axis_ == -1) {\n functor::QuantizeAndDequantizeOneScaleFunctor f;\n f(ctx->eigen_device(), input.flat(), signed_input_, num_bits_,\n range_given_, &input_min_tensor, &input_max_tensor, round_mode_,\n narrow_range_, output->flat());\n } else {\n functor::QuantizeAndDequantizePerChannelFunctor f;\n f(ctx->eigen_device(),\n input.template flat_inner_outer_dims(axis_ - 1), signed_input_,\n num_bits_, range_given_, &input_min_tensor, &input_max_tensor,\n round_mode_, narrow_range_,\n output->template flat_inner_outer_dims(axis_ - 1));\n }\n }","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"tensorflow::QuantizeAndDequantizeV2Op::Compute","file_name":"tensorflow/core/kernels/quantize_and_dequantize_op.cc","commit_link":"github.com/tensorflow/tensorflow/commit/eccb7ec454e6617738554a255d77f08e60ee0808","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#47-5cc0b58d4934","input":"_bson_iter_next_internal (bson_iter_t *iter, /* INOUT */\n uint32_t next_keylen, /* IN */\n const char **key, /* OUT */\n uint32_t *bson_type, /* OUT */\n bool *unsupported) /* OUT */\n{\n const uint8_t *data;\n uint32_t o;\n unsigned int len;\n\n BSON_ASSERT (iter);\n\n *unsupported = false;\n\n if (!iter->raw) {\n *key = NULL;\n *bson_type = BSON_TYPE_EOD;\n return false;\n }\n\n data = iter->raw;\n len = iter->len;\n\n iter->off = iter->next_off;\n iter->type = iter->off;\n iter->key = iter->off + 1;\n iter->d1 = 0;\n iter->d2 = 0;\n iter->d3 = 0;\n iter->d4 = 0;\n\n if (next_keylen == 0) {\n /* iterate from start to end of NULL-terminated key string */\n for (o = iter->key; o < len; o++) {\n if (!data[o]) {\n iter->d1 = ++o;\n goto fill_data_fields;\n }\n }\n } else {\n o = iter->key + next_keylen + 1;\n iter->d1 = o;\n goto fill_data_fields;\n }\n\n goto mark_invalid;\n\nfill_data_fields:\n\n *key = bson_iter_key_unsafe (iter);\n *bson_type = ITER_TYPE (iter);\n\n switch (*bson_type) {\n case BSON_TYPE_DATE_TIME:\n case BSON_TYPE_DOUBLE:\n case BSON_TYPE_INT64:\n case BSON_TYPE_TIMESTAMP:\n iter->next_off = o + 8;\n break;\n case BSON_TYPE_CODE:\n case BSON_TYPE_SYMBOL:\n case BSON_TYPE_UTF8: {\n uint32_t l;\n\n if ((o + 4) >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l > (len - (o + 4))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + 4 + l;\n\n /*\n * Make sure the string length includes the NUL byte.\n */\n if (BSON_UNLIKELY ((l == 0) || (iter->next_off >= len))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /*\n * Make sure the last byte is a NUL byte.\n */\n if (BSON_UNLIKELY ((iter->raw + iter->d2)[l - 1] != '\\0')) {\n iter->err_off = o + 4 + l - 1;\n goto mark_invalid;\n }\n } break;\n case BSON_TYPE_BINARY: {\n bson_subtype_t subtype;\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n iter->d3 = o + 5;\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l >= (len - o)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n subtype = *(iter->raw + iter->d2);\n\n if (subtype == BSON_SUBTYPE_BINARY_DEPRECATED) {\n int32_t binary_len;\n\n if (l < 4) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /* subtype 2 has a redundant length header in the data */\n memcpy (&binary_len, (iter->raw + iter->d3), sizeof (binary_len));\n binary_len = BSON_UINT32_FROM_LE (binary_len);\n if (binary_len + 4 != l) {\n iter->err_off = iter->d3;\n goto mark_invalid;\n }\n }\n\n iter->next_off = o + 5 + l;\n } break;\n case BSON_TYPE_ARRAY:\n case BSON_TYPE_DOCUMENT: {\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if ((l > len) || (l > (len - o))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + l;\n } break;\n case BSON_TYPE_OID:\n iter->next_off = o + 12;\n break;\n case BSON_TYPE_BOOL: {\n char val;\n\n if (iter->d1 >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&val, iter->raw + iter->d1, 1);\n if (val != 0x00 && val != 0x01) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + 1;\n } break;\n case BSON_TYPE_REGEX: {\n bool eor = false;\n bool eoo = false;\n\n for (; o < len; o++) {\n if (!data[o]) {\n iter->d2 = ++o;\n eor = true;\n break;\n }\n }\n\n if (!eor) {\n iter->err_off = iter->next_off;\n goto mark_invalid;\n }\n\n for (; o < len; o++) {\n if (!data[o]) {\n eoo = true;\n break;\n }\n }\n\n if (!eoo) {\n iter->err_off = iter->next_off;\n goto mark_invalid;\n }\n\n iter->next_off = o + 1;\n } break;\n case BSON_TYPE_DBPOINTER: {\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n /* Check valid string length. l counts '\\0' but not 4 bytes for itself. */\n if (l == 0 || l > (len - o - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n if (*(iter->raw + o + l + 3)) {\n /* not null terminated */\n iter->err_off = o + l + 3;\n goto mark_invalid;\n }\n\n iter->d3 = o + 4 + l;\n iter->next_off = o + 4 + l + 12;\n } break;\n case BSON_TYPE_CODEWSCOPE: {\n uint32_t l;\n uint32_t doclen;\n\n if ((len < 19) || (o >= (len - 14))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n iter->d3 = o + 8;\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if ((l < 14) || (l >= (len - o))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + l;\n\n if (iter->next_off >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&l, iter->raw + iter->d2, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l == 0 || l >= (len - o - 4 - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n if ((o + 4 + 4 + l + 4) >= iter->next_off) {\n iter->err_off = o + 4;\n goto mark_invalid;\n }\n\n iter->d4 = o + 4 + 4 + l;\n memcpy (&doclen, iter->raw + iter->d4, sizeof (doclen));\n doclen = BSON_UINT32_FROM_LE (doclen);\n\n if ((o + 4 + 4 + l + doclen) != iter->next_off) {\n iter->err_off = o + 4 + 4 + l;\n goto mark_invalid;\n }\n } break;\n case BSON_TYPE_INT32:\n iter->next_off = o + 4;\n break;\n case BSON_TYPE_DECIMAL128:\n iter->next_off = o + 16;\n break;\n case BSON_TYPE_MAXKEY:\n case BSON_TYPE_MINKEY:\n case BSON_TYPE_NULL:\n case BSON_TYPE_UNDEFINED:\n iter->next_off = o;\n break;\n default:\n *unsupported = true;\n /* FALL THROUGH */\n case BSON_TYPE_EOD:\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /*\n * Check to see if any of the field locations would overflow the\n * current BSON buffer. If so, set the error location to the offset\n * of where the field starts.\n */\n if (iter->next_off >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->err_off = 0;\n\n return true;\n\nmark_invalid:\n iter->raw = NULL;\n iter->len = 0;\n iter->next_off = 0;\n\n return false;\n}","target":"_bson_iter_next_internal (bson_iter_t *iter, /* INOUT */\n uint32_t next_keylen, /* IN */\n const char **key, /* OUT */\n uint32_t *bson_type, /* OUT */\n bool *unsupported) /* OUT */\n{\n const uint8_t *data;\n uint32_t o;\n unsigned int len;\n\n BSON_ASSERT (iter);\n\n *unsupported = false;\n\n if (!iter->raw) {\n *key = NULL;\n *bson_type = BSON_TYPE_EOD;\n return false;\n }\n\n data = iter->raw;\n len = iter->len;\n\n iter->off = iter->next_off;\n iter->type = iter->off;\n iter->key = iter->off + 1;\n iter->d1 = 0;\n iter->d2 = 0;\n iter->d3 = 0;\n iter->d4 = 0;\n\n if (next_keylen == 0) {\n /* iterate from start to end of NULL-terminated key string */\n for (o = iter->key; o < len; o++) {\n if (!data[o]) {\n iter->d1 = ++o;\n goto fill_data_fields;\n }\n }\n } else {\n o = iter->key + next_keylen + 1;\n iter->d1 = o;\n goto fill_data_fields;\n }\n\n goto mark_invalid;\n\nfill_data_fields:\n\n *key = bson_iter_key_unsafe (iter);\n *bson_type = ITER_TYPE (iter);\n\n switch (*bson_type) {\n case BSON_TYPE_DATE_TIME:\n case BSON_TYPE_DOUBLE:\n case BSON_TYPE_INT64:\n case BSON_TYPE_TIMESTAMP:\n iter->next_off = o + 8;\n break;\n case BSON_TYPE_CODE:\n case BSON_TYPE_SYMBOL:\n case BSON_TYPE_UTF8: {\n uint32_t l;\n\n if ((o + 4) >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l > (len - (o + 4))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + 4 + l;\n\n /*\n * Make sure the string length includes the NUL byte.\n */\n if (BSON_UNLIKELY ((l == 0) || (iter->next_off >= len))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /*\n * Make sure the last byte is a NUL byte.\n */\n if (BSON_UNLIKELY ((iter->raw + iter->d2)[l - 1] != '\\0')) {\n iter->err_off = o + 4 + l - 1;\n goto mark_invalid;\n }\n } break;\n case BSON_TYPE_BINARY: {\n bson_subtype_t subtype;\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n iter->d3 = o + 5;\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l >= (len - o - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n subtype = *(iter->raw + iter->d2);\n\n if (subtype == BSON_SUBTYPE_BINARY_DEPRECATED) {\n int32_t binary_len;\n\n if (l < 4) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /* subtype 2 has a redundant length header in the data */\n memcpy (&binary_len, (iter->raw + iter->d3), sizeof (binary_len));\n binary_len = BSON_UINT32_FROM_LE (binary_len);\n if (binary_len + 4 != l) {\n iter->err_off = iter->d3;\n goto mark_invalid;\n }\n }\n\n iter->next_off = o + 5 + l;\n } break;\n case BSON_TYPE_ARRAY:\n case BSON_TYPE_DOCUMENT: {\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if ((l > len) || (l > (len - o))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + l;\n } break;\n case BSON_TYPE_OID:\n iter->next_off = o + 12;\n break;\n case BSON_TYPE_BOOL: {\n char val;\n\n if (iter->d1 >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&val, iter->raw + iter->d1, 1);\n if (val != 0x00 && val != 0x01) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + 1;\n } break;\n case BSON_TYPE_REGEX: {\n bool eor = false;\n bool eoo = false;\n\n for (; o < len; o++) {\n if (!data[o]) {\n iter->d2 = ++o;\n eor = true;\n break;\n }\n }\n\n if (!eor) {\n iter->err_off = iter->next_off;\n goto mark_invalid;\n }\n\n for (; o < len; o++) {\n if (!data[o]) {\n eoo = true;\n break;\n }\n }\n\n if (!eoo) {\n iter->err_off = iter->next_off;\n goto mark_invalid;\n }\n\n iter->next_off = o + 1;\n } break;\n case BSON_TYPE_DBPOINTER: {\n uint32_t l;\n\n if (o >= (len - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n /* Check valid string length. l counts '\\0' but not 4 bytes for itself. */\n if (l == 0 || l > (len - o - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n if (*(iter->raw + o + l + 3)) {\n /* not null terminated */\n iter->err_off = o + l + 3;\n goto mark_invalid;\n }\n\n iter->d3 = o + 4 + l;\n iter->next_off = o + 4 + l + 12;\n } break;\n case BSON_TYPE_CODEWSCOPE: {\n uint32_t l;\n uint32_t doclen;\n\n if ((len < 19) || (o >= (len - 14))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->d2 = o + 4;\n iter->d3 = o + 8;\n\n memcpy (&l, iter->raw + iter->d1, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if ((l < 14) || (l >= (len - o))) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->next_off = o + l;\n\n if (iter->next_off >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n memcpy (&l, iter->raw + iter->d2, sizeof (l));\n l = BSON_UINT32_FROM_LE (l);\n\n if (l == 0 || l >= (len - o - 4 - 4)) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n if ((o + 4 + 4 + l + 4) >= iter->next_off) {\n iter->err_off = o + 4;\n goto mark_invalid;\n }\n\n iter->d4 = o + 4 + 4 + l;\n memcpy (&doclen, iter->raw + iter->d4, sizeof (doclen));\n doclen = BSON_UINT32_FROM_LE (doclen);\n\n if ((o + 4 + 4 + l + doclen) != iter->next_off) {\n iter->err_off = o + 4 + 4 + l;\n goto mark_invalid;\n }\n } break;\n case BSON_TYPE_INT32:\n iter->next_off = o + 4;\n break;\n case BSON_TYPE_DECIMAL128:\n iter->next_off = o + 16;\n break;\n case BSON_TYPE_MAXKEY:\n case BSON_TYPE_MINKEY:\n case BSON_TYPE_NULL:\n case BSON_TYPE_UNDEFINED:\n iter->next_off = o;\n break;\n default:\n *unsupported = true;\n /* FALL THROUGH */\n case BSON_TYPE_EOD:\n iter->err_off = o;\n goto mark_invalid;\n }\n\n /*\n * Check to see if any of the field locations would overflow the\n * current BSON buffer. If so, set the error location to the offset\n * of where the field starts.\n */\n if (iter->next_off >= len) {\n iter->err_off = o;\n goto mark_invalid;\n }\n\n iter->err_off = 0;\n\n return true;\n\nmark_invalid:\n iter->raw = NULL;\n iter->len = 0;\n iter->next_off = 0;\n\n return false;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"_bson_iter_next_internal","file_name":"src/libbson/src/bson/bson-iter.c","commit_link":"github.com/mongodb/mongo-c-driver/commit/0d9a4d98bfdf4acd2c0138d4aaeb4e2e0934bd84","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#48-c874577075bf","input":"int enc_untrusted_inet_pton(int af, const char *src, void *dst) {\n if (!src || !dst) {\n return 0;\n }\n\n MessageWriter input;\n input.Push(TokLinuxAfFamily(af));\n input.PushByReference(Extent{\n src, std::min(strlen(src) + 1, static_cast(INET6_ADDRSTRLEN))});\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kInetPtonHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_pton\", 3);\n\n int result = output.next();\n int klinux_errno = output.next();\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return -1;\n }\n\n auto klinux_addr_buffer = output.next();\n size_t max_size = 0;\n if (af == AF_INET) {\n max_size = sizeof(struct in_addr);\n } else if (af == AF_INET6) {\n max_size = sizeof(struct in6_addr);\n }\n memcpy(dst, klinux_addr_buffer.data(),\n std::min(klinux_addr_buffer.size(), max_size));\n return result;\n}","target":"int enc_untrusted_inet_pton(int af, const char *src, void *dst) {\n if (!src || !dst) {\n return 0;\n }\n\n MessageWriter input;\n input.Push(TokLinuxAfFamily(af));\n input.PushByReference(Extent{\n src, std::min(strlen(src) + 1, static_cast(INET6_ADDRSTRLEN))});\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kInetPtonHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_pton\", 3);\n\n int result = output.next();\n int klinux_errno = output.next();\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return -1;\n }\n\n auto klinux_addr_buffer = output.next();\n size_t max_size = 0;\n if (af == AF_INET) {\n if (klinux_addr_buffer.size() != sizeof(klinux_in_addr)) {\n ::asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_inet_pton: unexpected output size\");\n }\n max_size = sizeof(struct in_addr);\n } else if (af == AF_INET6) {\n if (klinux_addr_buffer.size() != sizeof(klinux_in6_addr)) {\n ::asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_inet_pton: unexpected output size\");\n }\n max_size = sizeof(struct in6_addr);\n }\n memcpy(dst, klinux_addr_buffer.data(),\n std::min(klinux_addr_buffer.size(), max_size));\n return result;\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"enc_untrusted_inet_pton","file_name":"asylo/platform/host_call/trusted/host_calls.cc","commit_link":"github.com/google/asylo/commit/8fed5e334131abaf9c5e17307642fbf6ce4a57ec","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#49-834f16d59a73","input":"Status GraphConstructor::MakeEdge(Node* src, int output_index, Node* dst,\n int input_index) {\n DataType src_out = src->output_type(output_index);\n DataType dst_in = dst->input_type(input_index);\n if (!TypesCompatible(dst_in, src_out)) {\n return errors::InvalidArgument(\n \"Input \", input_index, \" of node \", dst->name(), \" was passed \",\n DataTypeString(src_out), \" from \", src->name(), \":\", output_index,\n \" incompatible with expected \", DataTypeString(dst_in), \".\");\n }\n g_->AddEdge(src, output_index, dst, input_index);\n return Status::OK();\n}","target":"Status GraphConstructor::MakeEdge(Node* src, int output_index, Node* dst,\n int input_index) {\n if (output_index >= src->num_outputs()) {\n return errors::InvalidArgument(\n \"Output \", output_index, \" of node \", src->name(),\n \" does not exist. Node only has \", src->num_outputs(), \" outputs.\");\n }\n if (input_index >= dst->num_inputs()) {\n return errors::InvalidArgument(\n \"Input \", input_index, \" of node \", dst->name(),\n \" does not exist. Node only has \", dst->num_inputs(), \" inputs.\");\n }\n\n DataType src_out = src->output_type(output_index);\n DataType dst_in = dst->input_type(input_index);\n if (!TypesCompatible(dst_in, src_out)) {\n return errors::InvalidArgument(\n \"Input \", input_index, \" of node \", dst->name(), \" was passed \",\n DataTypeString(src_out), \" from \", src->name(), \":\", output_index,\n \" incompatible with expected \", DataTypeString(dst_in), \".\");\n }\n g_->AddEdge(src, output_index, dst, input_index);\n return Status::OK();\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"tensorflow::GraphConstructor::MakeEdge","file_name":"tensorflow/core/common_runtime/graph_constructor.cc","commit_link":"github.com/tensorflow/tensorflow/commit/0cc38aaa4064fd9e79101994ce9872c6d91f816b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#50-2ff077fe431d","input":"BYTE *DecompressRTF(variableLength *p, int *size) {\n BYTE *dst; // destination for uncompressed bytes\n BYTE *src;\n unsigned int in;\n unsigned int out;\n variableLength comp_Prebuf;\n ULONG compressedSize, uncompressedSize, magic;\n\n comp_Prebuf.size = strlen(RTF_PREBUF);\n comp_Prebuf.data = calloc(comp_Prebuf.size+1, 1);\n ALLOCCHECK_CHAR(comp_Prebuf.data);\n memcpy(comp_Prebuf.data, RTF_PREBUF, comp_Prebuf.size);\n\n src = p->data;\n in = 0;\n\n if (p->size < 20) {\n printf(\"File too small\\n\");\n return(NULL);\n }\n compressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n uncompressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n magic = SwapDWord((BYTE*)src + in, 4);\n in += 4;\n in += 4;\n\n // check size excluding the size field itself\n if (compressedSize != p->size - 4) {\n printf(\" Size Mismatch: %u != %i\\n\", compressedSize, p->size - 4);\n free(comp_Prebuf.data);\n return NULL;\n }\n\n // process the data\n if (magic == 0x414c454d) {\n // magic number that identifies the stream as a uncompressed stream\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + 4, uncompressedSize);\n } else if (magic == 0x75465a4c) {\n // magic number that identifies the stream as a compressed stream\n int flagCount = 0;\n int flags = 0;\n // Prevent overflow on 32 Bit Systems\n if (comp_Prebuf.size >= INT_MAX - uncompressedSize) {\n printf(\"Corrupted file\\n\");\n exit(-1);\n }\n dst = calloc(comp_Prebuf.size + uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);\n out = comp_Prebuf.size;\n while (out < (comp_Prebuf.size + uncompressedSize)) {\n // each flag byte flags 8 literals/references, 1 per bit\n flags = (flagCount++ % 8 == 0) ? src[in++] : flags >> 1;\n if ((flags & 1) == 1) { // each flag bit is 1 for reference, 0 for literal\n unsigned int offset = src[in++];\n unsigned int length = src[in++];\n unsigned int end;\n offset = (offset << 4) | (length >> 4); // the offset relative to block start\n length = (length & 0xF) + 2; // the number of bytes to copy\n // the decompression buffer is supposed to wrap around back\n // to the beginning when the end is reached. we save the\n // need for such a buffer by pointing straight into the data\n // buffer, and simulating this behaviour by modifying the\n // pointers appropriately.\n offset = (out / 4096) * 4096 + offset;\n if (offset >= out) // take from previous block\n offset -= 4096;\n // note: can't use System.arraycopy, because the referenced\n // bytes can cross through the current out position.\n end = offset + length;\n while ((offset < end) && (out < (comp_Prebuf.size + uncompressedSize))\n && (offset < (comp_Prebuf.size + uncompressedSize)))\n dst[out++] = dst[offset++];\n } else { // literal\n if ((out >= (comp_Prebuf.size + uncompressedSize)) ||\n (in >= p->size)) {\n printf(\"Corrupted stream\\n\");\n exit(-1);\n }\n dst[out++] = src[in++];\n }\n }\n // copy it back without the prebuffered data\n src = dst;\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + comp_Prebuf.size, uncompressedSize);\n free(src);\n *size = uncompressedSize;\n free(comp_Prebuf.data);\n return dst;\n } else { // unknown magic number\n printf(\"Unknown compression type (magic number %x)\\n\", magic);\n }\n free(comp_Prebuf.data);\n return NULL;\n}","target":"BYTE *DecompressRTF(variableLength *p, int *size) {\n BYTE *dst; // destination for uncompressed bytes\n BYTE *src;\n unsigned int in;\n unsigned int out;\n variableLength comp_Prebuf;\n ULONG compressedSize, uncompressedSize, magic;\n\n comp_Prebuf.size = strlen(RTF_PREBUF);\n comp_Prebuf.data = calloc(comp_Prebuf.size+1, 1);\n ALLOCCHECK_CHAR(comp_Prebuf.data);\n memcpy(comp_Prebuf.data, RTF_PREBUF, comp_Prebuf.size);\n\n src = p->data;\n in = 0;\n\n if (p->size < 20) {\n printf(\"File too small\\n\");\n return(NULL);\n }\n compressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n uncompressedSize = (ULONG)SwapDWord((BYTE*)src + in, 4);\n in += 4;\n magic = SwapDWord((BYTE*)src + in, 4);\n in += 4;\n in += 4;\n\n // check size excluding the size field itself\n if (compressedSize != p->size - 4) {\n printf(\" Size Mismatch: %u != %i\\n\", compressedSize, p->size - 4);\n free(comp_Prebuf.data);\n return NULL;\n }\n\n // process the data\n if (magic == 0x414c454d) {\n // magic number that identifies the stream as a uncompressed stream\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + 4, uncompressedSize);\n } else if (magic == 0x75465a4c) {\n // magic number that identifies the stream as a compressed stream\n int flagCount = 0;\n int flags = 0;\n // Prevent overflow on 32 Bit Systems\n if (comp_Prebuf.size >= INT_MAX - uncompressedSize) {\n printf(\"Corrupted file\\n\");\n exit(-1);\n }\n dst = calloc(comp_Prebuf.size + uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);\n out = comp_Prebuf.size;\n while ((out < (comp_Prebuf.size + uncompressedSize)) && (in < p->size)) {\n // each flag byte flags 8 literals/references, 1 per bit\n flags = (flagCount++ % 8 == 0) ? src[in++] : flags >> 1;\n if ((flags & 1) == 1) { // each flag bit is 1 for reference, 0 for literal\n unsigned int offset = src[in++];\n unsigned int length = src[in++];\n unsigned int end;\n offset = (offset << 4) | (length >> 4); // the offset relative to block start\n length = (length & 0xF) + 2; // the number of bytes to copy\n // the decompression buffer is supposed to wrap around back\n // to the beginning when the end is reached. we save the\n // need for such a buffer by pointing straight into the data\n // buffer, and simulating this behaviour by modifying the\n // pointers appropriately.\n offset = (out / 4096) * 4096 + offset;\n if (offset >= out) // take from previous block\n offset -= 4096;\n // note: can't use System.arraycopy, because the referenced\n // bytes can cross through the current out position.\n end = offset + length;\n while ((offset < end) && (out < (comp_Prebuf.size + uncompressedSize))\n && (offset < (comp_Prebuf.size + uncompressedSize)))\n dst[out++] = dst[offset++];\n } else { // literal\n if ((out >= (comp_Prebuf.size + uncompressedSize)) ||\n (in >= p->size)) {\n printf(\"Corrupted stream\\n\");\n exit(-1);\n }\n dst[out++] = src[in++];\n }\n }\n // copy it back without the prebuffered data\n src = dst;\n dst = calloc(uncompressedSize, 1);\n ALLOCCHECK_CHAR(dst);\n memcpy(dst, src + comp_Prebuf.size, uncompressedSize);\n free(src);\n *size = uncompressedSize;\n free(comp_Prebuf.data);\n return dst;\n } else { // unknown magic number\n printf(\"Unknown compression type (magic number %x)\\n\", magic);\n }\n free(comp_Prebuf.data);\n return NULL;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"DecompressRTF","file_name":"lib/ytnef.c","commit_link":"github.com/Yeraze/ytnef/commit/22f8346c8d4f0020a40d9f258fdb3bfc097359cc","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#51-57b3002d9123","input":"static Image *ReadSGIImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image\n *image;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n MemoryInfo\n *pixel_info;\n\n register Quantum\n *q;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *p;\n\n SGIInfo\n iris_info;\n\n size_t\n bytes_per_pixel,\n quantum;\n\n ssize_t\n count,\n y,\n z;\n\n unsigned char\n *pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read SGI raster header.\n */\n iris_info.magic=ReadBlobMSBShort(image);\n do\n {\n /*\n Verify SGI identifier.\n */\n if (iris_info.magic != 0x01DA)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.storage=(unsigned char) ReadBlobByte(image);\n switch (iris_info.storage)\n {\n case 0x00: image->compression=NoCompression; break;\n case 0x01: image->compression=RLECompression; break;\n default:\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n iris_info.bytes_per_pixel=(unsigned char) ReadBlobByte(image);\n if ((iris_info.bytes_per_pixel == 0) || (iris_info.bytes_per_pixel > 2))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.dimension=ReadBlobMSBShort(image);\n iris_info.columns=ReadBlobMSBShort(image);\n iris_info.rows=ReadBlobMSBShort(image);\n iris_info.depth=ReadBlobMSBShort(image);\n if ((iris_info.depth == 0) || (iris_info.depth > 4))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.minimum_value=ReadBlobMSBLong(image);\n iris_info.maximum_value=ReadBlobMSBLong(image);\n iris_info.sans=ReadBlobMSBLong(image);\n (void) ReadBlob(image,sizeof(iris_info.name),(unsigned char *)\n iris_info.name);\n iris_info.name[sizeof(iris_info.name)-1]='\\0';\n if (*iris_info.name != '\\0')\n (void) SetImageProperty(image,\"label\",iris_info.name,exception);\n iris_info.pixel_format=ReadBlobMSBLong(image);\n if (iris_info.pixel_format != 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n count=ReadBlob(image,sizeof(iris_info.filler),iris_info.filler);\n (void) count;\n image->columns=iris_info.columns;\n image->rows=iris_info.rows;\n image->depth=(size_t) MagickMin(iris_info.depth,MAGICKCORE_QUANTUM_DEPTH);\n if (iris_info.pixel_format == 0)\n image->depth=(size_t) MagickMin((size_t) 8*\n iris_info.bytes_per_pixel,MAGICKCORE_QUANTUM_DEPTH);\n if (iris_info.depth < 3)\n {\n image->storage_class=PseudoClass;\n image->colors=iris_info.bytes_per_pixel > 1 ? 65535 : 256;\n }\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Allocate SGI pixels.\n */\n bytes_per_pixel=(size_t) iris_info.bytes_per_pixel;\n number_pixels=(MagickSizeType) iris_info.columns*iris_info.rows;\n if ((4*bytes_per_pixel*number_pixels) != ((MagickSizeType) (size_t)\n (4*bytes_per_pixel*number_pixels)))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixel_info=AcquireVirtualMemory(iris_info.columns,iris_info.rows*4*\n bytes_per_pixel*sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n if ((int) iris_info.storage != 0x01)\n {\n unsigned char\n *scanline;\n\n /*\n Read standard image format.\n */\n scanline=(unsigned char *) AcquireQuantumMemory(iris_info.columns,\n bytes_per_pixel*sizeof(*scanline));\n if (scanline == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n p=pixels+bytes_per_pixel*z;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n count=ReadBlob(image,bytes_per_pixel*iris_info.columns,scanline);\n if (EOFBlob(image) != MagickFalse)\n break;\n if (bytes_per_pixel == 2)\n for (x=0; x < (ssize_t) iris_info.columns; x++)\n {\n *p=scanline[2*x];\n *(p+1)=scanline[2*x+1];\n p+=8;\n }\n else\n for (x=0; x < (ssize_t) iris_info.columns; x++)\n {\n *p=scanline[x];\n p+=4;\n }\n }\n }\n scanline=(unsigned char *) RelinquishMagickMemory(scanline);\n }\n else\n {\n MemoryInfo\n *packet_info;\n\n size_t\n *runlength;\n\n ssize_t\n offset,\n *offsets;\n\n unsigned char\n *packets;\n\n unsigned int\n data_order;\n\n /*\n Read runlength-encoded image format.\n */\n offsets=(ssize_t *) AcquireQuantumMemory((size_t) iris_info.rows,\n iris_info.depth*sizeof(*offsets));\n runlength=(size_t *) AcquireQuantumMemory(iris_info.rows,\n iris_info.depth*sizeof(*runlength));\n packet_info=AcquireVirtualMemory((size_t) iris_info.columns+10UL,4UL*\n sizeof(*packets));\n if ((offsets == (ssize_t *) NULL) ||\n (runlength == (size_t *) NULL) ||\n (packet_info == (MemoryInfo *) NULL))\n {\n if (offsets == (ssize_t *) NULL)\n offsets=(ssize_t *) RelinquishMagickMemory(offsets);\n if (runlength == (size_t *) NULL)\n runlength=(size_t *) RelinquishMagickMemory(runlength);\n if (packet_info == (MemoryInfo *) NULL)\n packet_info=RelinquishVirtualMemory(packet_info);\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n packets=(unsigned char *) GetVirtualMemoryBlob(packet_info);\n for (i=0; i < (ssize_t) (iris_info.rows*iris_info.depth); i++)\n offsets[i]=ReadBlobMSBSignedLong(image);\n for (i=0; i < (ssize_t) (iris_info.rows*iris_info.depth); i++)\n {\n runlength[i]=ReadBlobMSBLong(image);\n if (runlength[i] > (4*(size_t) iris_info.columns+10))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Check data order.\n */\n offset=0;\n data_order=0;\n for (y=0; ((y < (ssize_t) iris_info.rows) && (data_order == 0)); y++)\n for (z=0; ((z < (ssize_t) iris_info.depth) && (data_order == 0)); z++)\n {\n if (offsets[y+z*iris_info.rows] < offset)\n data_order=1;\n offset=offsets[y+z*iris_info.rows];\n }\n offset=(ssize_t) TellBlob(image);\n if (data_order == 1)\n {\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n p=pixels;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n if (offset != offsets[y+z*iris_info.rows])\n {\n offset=offsets[y+z*iris_info.rows];\n offset=(ssize_t) SeekBlob(image,(ssize_t) offset,SEEK_SET);\n }\n count=ReadBlob(image,(size_t) runlength[y+z*iris_info.rows],\n packets);\n if (EOFBlob(image) != MagickFalse)\n break;\n offset+=(ssize_t) runlength[y+z*iris_info.rows];\n status=SGIDecode(bytes_per_pixel,(ssize_t)\n (runlength[y+z*iris_info.rows]/bytes_per_pixel),packets,\n 1L*iris_info.columns,p+bytes_per_pixel*z);\n if (status == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n p+=(iris_info.columns*4*bytes_per_pixel);\n }\n }\n }\n else\n {\n MagickOffsetType\n position;\n \n position=TellBlob(image);\n p=pixels;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n if (offset != offsets[y+z*iris_info.rows])\n {\n offset=offsets[y+z*iris_info.rows];\n offset=(ssize_t) SeekBlob(image,(ssize_t) offset,SEEK_SET);\n }\n count=ReadBlob(image,(size_t) runlength[y+z*iris_info.rows],\n packets);\n if (EOFBlob(image) != MagickFalse)\n break;\n offset+=(ssize_t) runlength[y+z*iris_info.rows];\n status=SGIDecode(bytes_per_pixel,(ssize_t)\n (runlength[y+z*iris_info.rows]/bytes_per_pixel),packets,\n 1L*iris_info.columns,p+bytes_per_pixel*z);\n if (status == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n p+=(iris_info.columns*4*bytes_per_pixel);\n }\n offset=(ssize_t) SeekBlob(image,position,SEEK_SET);\n }\n packet_info=RelinquishVirtualMemory(packet_info);\n runlength=(size_t *) RelinquishMagickMemory(runlength);\n offsets=(ssize_t *) RelinquishMagickMemory(offsets);\n }\n /*\n Initialize image structure.\n */\n image->alpha_trait=iris_info.depth == 4 ? BlendPixelTrait : \n UndefinedPixelTrait;\n image->columns=iris_info.columns;\n image->rows=iris_info.rows;\n /*\n Convert SGI raster image to pixel packets.\n */\n if (image->storage_class == DirectClass)\n {\n /*\n Convert SGI image to DirectClass pixel packets.\n */\n if (bytes_per_pixel == 2)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*8*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleShortToQuantum((unsigned short)\n ((*(p+0) << 8) | (*(p+1)))),q);\n SetPixelGreen(image,ScaleShortToQuantum((unsigned short)\n ((*(p+2) << 8) | (*(p+3)))),q);\n SetPixelBlue(image,ScaleShortToQuantum((unsigned short)\n ((*(p+4) << 8) | (*(p+5)))),q);\n SetPixelAlpha(image,OpaqueAlpha,q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleShortToQuantum((unsigned short)\n ((*(p+6) << 8) | (*(p+7)))),q);\n p+=8;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*4*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleCharToQuantum(*p),q);\n SetPixelGreen(image,ScaleCharToQuantum(*(p+1)),q);\n SetPixelBlue(image,ScaleCharToQuantum(*(p+2)),q);\n SetPixelAlpha(image,OpaqueAlpha,q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*(p+3)),q);\n p+=4;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n /*\n Create grayscale map.\n */\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n /*\n Convert SGI image to PseudoClass pixel packets.\n */\n if (bytes_per_pixel == 2)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*8*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n quantum=(*p << 8);\n quantum|=(*(p+1));\n SetPixelIndex(image,(Quantum) quantum,q);\n p+=8;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*4*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p,q);\n p+=4;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n (void) SyncImage(image,exception);\n }\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n iris_info.magic=ReadBlobMSBShort(image);\n if (iris_info.magic == 0x01DA)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while (iris_info.magic == 0x01DA);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadSGIImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image\n *image;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n MemoryInfo\n *pixel_info;\n\n register Quantum\n *q;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *p;\n\n SGIInfo\n iris_info;\n\n size_t\n bytes_per_pixel,\n quantum;\n\n ssize_t\n count,\n y,\n z;\n\n unsigned char\n *pixels;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read SGI raster header.\n */\n iris_info.magic=ReadBlobMSBShort(image);\n do\n {\n /*\n Verify SGI identifier.\n */\n if (iris_info.magic != 0x01DA)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.storage=(unsigned char) ReadBlobByte(image);\n switch (iris_info.storage)\n {\n case 0x00: image->compression=NoCompression; break;\n case 0x01: image->compression=RLECompression; break;\n default:\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n iris_info.bytes_per_pixel=(unsigned char) ReadBlobByte(image);\n if ((iris_info.bytes_per_pixel == 0) || (iris_info.bytes_per_pixel > 2))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.dimension=ReadBlobMSBShort(image);\n iris_info.columns=ReadBlobMSBShort(image);\n iris_info.rows=ReadBlobMSBShort(image);\n iris_info.depth=ReadBlobMSBShort(image);\n if ((iris_info.depth == 0) || (iris_info.depth > 4))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n iris_info.minimum_value=ReadBlobMSBLong(image);\n iris_info.maximum_value=ReadBlobMSBLong(image);\n iris_info.sans=ReadBlobMSBLong(image);\n (void) ReadBlob(image,sizeof(iris_info.name),(unsigned char *)\n iris_info.name);\n iris_info.name[sizeof(iris_info.name)-1]='\\0';\n if (*iris_info.name != '\\0')\n (void) SetImageProperty(image,\"label\",iris_info.name,exception);\n iris_info.pixel_format=ReadBlobMSBLong(image);\n if (iris_info.pixel_format != 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n count=ReadBlob(image,sizeof(iris_info.filler),iris_info.filler);\n (void) count;\n image->columns=iris_info.columns;\n image->rows=iris_info.rows;\n image->depth=(size_t) MagickMin(iris_info.depth,MAGICKCORE_QUANTUM_DEPTH);\n if (iris_info.pixel_format == 0)\n image->depth=(size_t) MagickMin((size_t) 8*iris_info.bytes_per_pixel,\n MAGICKCORE_QUANTUM_DEPTH);\n if (iris_info.depth < 3)\n {\n image->storage_class=PseudoClass;\n image->colors=iris_info.bytes_per_pixel > 1 ? 65535 : 256;\n }\n if (EOFBlob(image) != MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Allocate SGI pixels.\n */\n bytes_per_pixel=(size_t) iris_info.bytes_per_pixel;\n number_pixels=(MagickSizeType) iris_info.columns*iris_info.rows;\n if ((4*bytes_per_pixel*number_pixels) != ((MagickSizeType) (size_t)\n (4*bytes_per_pixel*number_pixels)))\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixel_info=AcquireVirtualMemory(iris_info.columns,iris_info.rows*4*\n bytes_per_pixel*sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n if ((int) iris_info.storage != 0x01)\n {\n unsigned char\n *scanline;\n\n /*\n Read standard image format.\n */\n scanline=(unsigned char *) AcquireQuantumMemory(iris_info.columns,\n bytes_per_pixel*sizeof(*scanline));\n if (scanline == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n p=pixels+bytes_per_pixel*z;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n count=ReadBlob(image,bytes_per_pixel*iris_info.columns,scanline);\n if (EOFBlob(image) != MagickFalse)\n break;\n if (bytes_per_pixel == 2)\n for (x=0; x < (ssize_t) iris_info.columns; x++)\n {\n *p=scanline[2*x];\n *(p+1)=scanline[2*x+1];\n p+=8;\n }\n else\n for (x=0; x < (ssize_t) iris_info.columns; x++)\n {\n *p=scanline[x];\n p+=4;\n }\n }\n }\n scanline=(unsigned char *) RelinquishMagickMemory(scanline);\n }\n else\n {\n MemoryInfo\n *packet_info;\n\n size_t\n *runlength;\n\n ssize_t\n offset,\n *offsets;\n\n unsigned char\n *packets;\n\n unsigned int\n data_order;\n\n /*\n Read runlength-encoded image format.\n */\n offsets=(ssize_t *) AcquireQuantumMemory((size_t) iris_info.rows,\n iris_info.depth*sizeof(*offsets));\n runlength=(size_t *) AcquireQuantumMemory(iris_info.rows,\n iris_info.depth*sizeof(*runlength));\n packet_info=AcquireVirtualMemory((size_t) iris_info.columns+10UL,4UL*\n sizeof(*packets));\n if ((offsets == (ssize_t *) NULL) ||\n (runlength == (size_t *) NULL) ||\n (packet_info == (MemoryInfo *) NULL))\n {\n if (offsets == (ssize_t *) NULL)\n offsets=(ssize_t *) RelinquishMagickMemory(offsets);\n if (runlength == (size_t *) NULL)\n runlength=(size_t *) RelinquishMagickMemory(runlength);\n if (packet_info == (MemoryInfo *) NULL)\n packet_info=RelinquishVirtualMemory(packet_info);\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n packets=(unsigned char *) GetVirtualMemoryBlob(packet_info);\n for (i=0; i < (ssize_t) (iris_info.rows*iris_info.depth); i++)\n offsets[i]=ReadBlobMSBSignedLong(image);\n for (i=0; i < (ssize_t) (iris_info.rows*iris_info.depth); i++)\n {\n runlength[i]=ReadBlobMSBLong(image);\n if (runlength[i] > (4*(size_t) iris_info.columns+10))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Check data order.\n */\n offset=0;\n data_order=0;\n for (y=0; ((y < (ssize_t) iris_info.rows) && (data_order == 0)); y++)\n for (z=0; ((z < (ssize_t) iris_info.depth) && (data_order == 0)); z++)\n {\n if (offsets[y+z*iris_info.rows] < offset)\n data_order=1;\n offset=offsets[y+z*iris_info.rows];\n }\n offset=(ssize_t) TellBlob(image);\n if (data_order == 1)\n {\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n p=pixels;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n if (offset != offsets[y+z*iris_info.rows])\n {\n offset=offsets[y+z*iris_info.rows];\n offset=(ssize_t) SeekBlob(image,(ssize_t) offset,SEEK_SET);\n }\n count=ReadBlob(image,(size_t) runlength[y+z*iris_info.rows],\n packets);\n if (EOFBlob(image) != MagickFalse)\n break;\n offset+=(ssize_t) runlength[y+z*iris_info.rows];\n status=SGIDecode(bytes_per_pixel,(ssize_t)\n (runlength[y+z*iris_info.rows]/bytes_per_pixel),packets,\n 1L*iris_info.columns,p+bytes_per_pixel*z);\n if (status == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n p+=(iris_info.columns*4*bytes_per_pixel);\n }\n }\n }\n else\n {\n MagickOffsetType\n position;\n \n position=TellBlob(image);\n p=pixels;\n for (y=0; y < (ssize_t) iris_info.rows; y++)\n {\n for (z=0; z < (ssize_t) iris_info.depth; z++)\n {\n if (offset != offsets[y+z*iris_info.rows])\n {\n offset=offsets[y+z*iris_info.rows];\n offset=(ssize_t) SeekBlob(image,(ssize_t) offset,SEEK_SET);\n }\n count=ReadBlob(image,(size_t) runlength[y+z*iris_info.rows],\n packets);\n if (EOFBlob(image) != MagickFalse)\n break;\n offset+=(ssize_t) runlength[y+z*iris_info.rows];\n status=SGIDecode(bytes_per_pixel,(ssize_t)\n (runlength[y+z*iris_info.rows]/bytes_per_pixel),packets,\n 1L*iris_info.columns,p+bytes_per_pixel*z);\n if (status == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n p+=(iris_info.columns*4*bytes_per_pixel);\n }\n offset=(ssize_t) SeekBlob(image,position,SEEK_SET);\n }\n packet_info=RelinquishVirtualMemory(packet_info);\n runlength=(size_t *) RelinquishMagickMemory(runlength);\n offsets=(ssize_t *) RelinquishMagickMemory(offsets);\n }\n /*\n Initialize image structure.\n */\n image->alpha_trait=iris_info.depth == 4 ? BlendPixelTrait : \n UndefinedPixelTrait;\n image->columns=iris_info.columns;\n image->rows=iris_info.rows;\n /*\n Convert SGI raster image to pixel packets.\n */\n if (image->storage_class == DirectClass)\n {\n /*\n Convert SGI image to DirectClass pixel packets.\n */\n if (bytes_per_pixel == 2)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*8*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleShortToQuantum((unsigned short)\n ((*(p+0) << 8) | (*(p+1)))),q);\n SetPixelGreen(image,ScaleShortToQuantum((unsigned short)\n ((*(p+2) << 8) | (*(p+3)))),q);\n SetPixelBlue(image,ScaleShortToQuantum((unsigned short)\n ((*(p+4) << 8) | (*(p+5)))),q);\n SetPixelAlpha(image,OpaqueAlpha,q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleShortToQuantum((unsigned short)\n ((*(p+6) << 8) | (*(p+7)))),q);\n p+=8;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*4*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(image,ScaleCharToQuantum(*p),q);\n SetPixelGreen(image,ScaleCharToQuantum(*(p+1)),q);\n SetPixelBlue(image,ScaleCharToQuantum(*(p+2)),q);\n SetPixelAlpha(image,OpaqueAlpha,q);\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,ScaleCharToQuantum(*(p+3)),q);\n p+=4;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n {\n /*\n Create grayscale map.\n */\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n /*\n Convert SGI image to PseudoClass pixel packets.\n */\n if (bytes_per_pixel == 2)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*8*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n quantum=(*p << 8);\n quantum|=(*(p+1));\n SetPixelIndex(image,(Quantum) quantum,q);\n p+=8;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=pixels+(image->rows-y-1)*4*image->columns;\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelIndex(image,*p,q);\n p+=4;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n (void) SyncImage(image,exception);\n }\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n iris_info.magic=ReadBlobMSBShort(image);\n if (iris_info.magic == 0x01DA)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while (iris_info.magic == 0x01DA);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ReadSGIImage","file_name":"coders/sgi.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/7afcf9f71043df15508e46f079387bd4689a738d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#52-65ecc4d3daee","input":"static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,\n const uint8_t *buf, int buf_size,\n int first_field)\n{\n int i, cid, ret;\n int old_bit_depth = ctx->bit_depth, bitdepth;\n uint64_t header_prefix;\n if (buf_size < 0x280) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"buffer too small (%d < 640).\\n\", buf_size);\n return AVERROR_INVALIDDATA;\n }\n\n header_prefix = ff_dnxhd_parse_header_prefix(buf);\n if (header_prefix == 0) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\\n\",\n buf[0], buf[1], buf[2], buf[3], buf[4]);\n return AVERROR_INVALIDDATA;\n }\n if (buf[5] & 2) { /* interlaced */\n ctx->cur_field = buf[5] & 1;\n frame->interlaced_frame = 1;\n frame->top_field_first = first_field ^ ctx->cur_field;\n av_log(ctx->avctx, AV_LOG_DEBUG,\n \"interlaced %d, cur field %d\\n\", buf[5] & 3, ctx->cur_field);\n } else {\n ctx->cur_field = 0;\n }\n ctx->mbaff = (buf[0x6] >> 5) & 1;\n\n ctx->height = AV_RB16(buf + 0x18);\n ctx->width = AV_RB16(buf + 0x1a);\n\n switch(buf[0x21] >> 5) {\n case 1: bitdepth = 8; break;\n case 2: bitdepth = 10; break;\n case 3: bitdepth = 12; break;\n default:\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"Unknown bitdepth indicator (%d)\\n\", buf[0x21] >> 5);\n return AVERROR_INVALIDDATA;\n }\n\n cid = AV_RB32(buf + 0x28);\n\n ctx->avctx->profile = dnxhd_get_profile(cid);\n\n if ((ret = dnxhd_init_vlc(ctx, cid, bitdepth)) < 0)\n return ret;\n if (ctx->mbaff && ctx->cid_table->cid != 1260)\n av_log(ctx->avctx, AV_LOG_WARNING,\n \"Adaptive MB interlace flag in an unsupported profile.\\n\");\n\n ctx->act = buf[0x2C] & 7;\n if (ctx->act && ctx->cid_table->cid != 1256 && ctx->cid_table->cid != 1270)\n av_log(ctx->avctx, AV_LOG_WARNING,\n \"Adaptive color transform in an unsupported profile.\\n\");\n\n ctx->is_444 = (buf[0x2C] >> 6) & 1;\n if (ctx->is_444) {\n if (bitdepth == 8) {\n avpriv_request_sample(ctx->avctx, \"4:4:4 8 bits\");\n return AVERROR_INVALIDDATA;\n } else if (bitdepth == 10) {\n ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;\n ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P10\n : AV_PIX_FMT_GBRP10;\n } else {\n ctx->decode_dct_block = dnxhd_decode_dct_block_12_444;\n ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P12\n : AV_PIX_FMT_GBRP12;\n }\n } else if (bitdepth == 12) {\n ctx->decode_dct_block = dnxhd_decode_dct_block_12;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P12;\n } else if (bitdepth == 10) {\n if (ctx->avctx->profile == FF_PROFILE_DNXHR_HQX)\n ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;\n else\n ctx->decode_dct_block = dnxhd_decode_dct_block_10;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P10;\n } else {\n ctx->decode_dct_block = dnxhd_decode_dct_block_8;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P;\n }\n\n ctx->avctx->bits_per_raw_sample = ctx->bit_depth = bitdepth;\n if (ctx->bit_depth != old_bit_depth) {\n ff_blockdsp_init(&ctx->bdsp, ctx->avctx);\n ff_idctdsp_init(&ctx->idsp, ctx->avctx);\n ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable,\n ff_zigzag_direct);\n }\n\n // make sure profile size constraints are respected\n // DNx100 allows 1920->1440 and 1280->960 subsampling\n if (ctx->width != ctx->cid_table->width &&\n ctx->cid_table->width != DNXHD_VARIABLE) {\n av_reduce(&ctx->avctx->sample_aspect_ratio.num,\n &ctx->avctx->sample_aspect_ratio.den,\n ctx->width, ctx->cid_table->width, 255);\n ctx->width = ctx->cid_table->width;\n }\n\n if (buf_size < ctx->cid_table->coding_unit_size) {\n av_log(ctx->avctx, AV_LOG_ERROR, \"incorrect frame size (%d < %u).\\n\",\n buf_size, ctx->cid_table->coding_unit_size);\n return AVERROR_INVALIDDATA;\n }\n\n ctx->mb_width = (ctx->width + 15)>> 4;\n ctx->mb_height = AV_RB16(buf + 0x16c);\n\n if ((ctx->height + 15) >> 4 == ctx->mb_height && frame->interlaced_frame)\n ctx->height <<= 1;\n\n av_log(ctx->avctx, AV_LOG_VERBOSE, \"%dx%d, 4:%s %d bits, MBAFF=%d ACT=%d\\n\",\n ctx->width, ctx->height, ctx->is_444 ? \"4:4\" : \"2:2\",\n ctx->bit_depth, ctx->mbaff, ctx->act);\n\n // Newer format supports variable mb_scan_index sizes\n if (ctx->mb_height > 68 && ff_dnxhd_check_header_prefix_hr(header_prefix)) {\n ctx->data_offset = 0x170 + (ctx->mb_height << 2);\n } else {\n if (ctx->mb_height > 68 ||\n (ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"mb height too big: %d\\n\", ctx->mb_height);\n return AVERROR_INVALIDDATA;\n }\n ctx->data_offset = 0x280;\n }\n\n if (buf_size < ctx->data_offset) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"buffer too small (%d < %d).\\n\", buf_size, ctx->data_offset);\n return AVERROR_INVALIDDATA;\n }\n\n if (ctx->mb_height > FF_ARRAY_ELEMS(ctx->mb_scan_index)) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"mb_height too big (%d > %\"SIZE_SPECIFIER\").\\n\", ctx->mb_height, FF_ARRAY_ELEMS(ctx->mb_scan_index));\n return AVERROR_INVALIDDATA;\n }\n\n for (i = 0; i < ctx->mb_height; i++) {\n ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));\n ff_dlog(ctx->avctx, \"mb scan index %d, pos %d: %\"PRIu32\"\\n\",\n i, 0x170 + (i << 2), ctx->mb_scan_index[i]);\n if (buf_size - ctx->data_offset < ctx->mb_scan_index[i]) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"invalid mb scan index (%\"PRIu32\" vs %u).\\n\",\n ctx->mb_scan_index[i], buf_size - ctx->data_offset);\n return AVERROR_INVALIDDATA;\n }\n }\n\n return 0;\n}","target":"static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,\n const uint8_t *buf, int buf_size,\n int first_field)\n{\n int i, cid, ret;\n int old_bit_depth = ctx->bit_depth, bitdepth;\n uint64_t header_prefix;\n if (buf_size < 0x280) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"buffer too small (%d < 640).\\n\", buf_size);\n return AVERROR_INVALIDDATA;\n }\n\n header_prefix = ff_dnxhd_parse_header_prefix(buf);\n if (header_prefix == 0) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\\n\",\n buf[0], buf[1], buf[2], buf[3], buf[4]);\n return AVERROR_INVALIDDATA;\n }\n if (buf[5] & 2) { /* interlaced */\n ctx->cur_field = buf[5] & 1;\n frame->interlaced_frame = 1;\n frame->top_field_first = first_field ^ ctx->cur_field;\n av_log(ctx->avctx, AV_LOG_DEBUG,\n \"interlaced %d, cur field %d\\n\", buf[5] & 3, ctx->cur_field);\n } else {\n ctx->cur_field = 0;\n }\n ctx->mbaff = (buf[0x6] >> 5) & 1;\n\n ctx->height = AV_RB16(buf + 0x18);\n ctx->width = AV_RB16(buf + 0x1a);\n\n switch(buf[0x21] >> 5) {\n case 1: bitdepth = 8; break;\n case 2: bitdepth = 10; break;\n case 3: bitdepth = 12; break;\n default:\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"Unknown bitdepth indicator (%d)\\n\", buf[0x21] >> 5);\n return AVERROR_INVALIDDATA;\n }\n\n cid = AV_RB32(buf + 0x28);\n\n ctx->avctx->profile = dnxhd_get_profile(cid);\n\n if ((ret = dnxhd_init_vlc(ctx, cid, bitdepth)) < 0)\n return ret;\n if (ctx->mbaff && ctx->cid_table->cid != 1260)\n av_log(ctx->avctx, AV_LOG_WARNING,\n \"Adaptive MB interlace flag in an unsupported profile.\\n\");\n\n ctx->act = buf[0x2C] & 7;\n if (ctx->act && ctx->cid_table->cid != 1256 && ctx->cid_table->cid != 1270)\n av_log(ctx->avctx, AV_LOG_WARNING,\n \"Adaptive color transform in an unsupported profile.\\n\");\n\n ctx->is_444 = (buf[0x2C] >> 6) & 1;\n if (ctx->is_444) {\n if (bitdepth == 8) {\n avpriv_request_sample(ctx->avctx, \"4:4:4 8 bits\");\n return AVERROR_INVALIDDATA;\n } else if (bitdepth == 10) {\n ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;\n ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P10\n : AV_PIX_FMT_GBRP10;\n } else {\n ctx->decode_dct_block = dnxhd_decode_dct_block_12_444;\n ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P12\n : AV_PIX_FMT_GBRP12;\n }\n } else if (bitdepth == 12) {\n ctx->decode_dct_block = dnxhd_decode_dct_block_12;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P12;\n } else if (bitdepth == 10) {\n if (ctx->avctx->profile == FF_PROFILE_DNXHR_HQX)\n ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;\n else\n ctx->decode_dct_block = dnxhd_decode_dct_block_10;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P10;\n } else {\n ctx->decode_dct_block = dnxhd_decode_dct_block_8;\n ctx->pix_fmt = AV_PIX_FMT_YUV422P;\n }\n\n ctx->avctx->bits_per_raw_sample = ctx->bit_depth = bitdepth;\n if (ctx->bit_depth != old_bit_depth) {\n ff_blockdsp_init(&ctx->bdsp, ctx->avctx);\n ff_idctdsp_init(&ctx->idsp, ctx->avctx);\n ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable,\n ff_zigzag_direct);\n }\n\n // make sure profile size constraints are respected\n // DNx100 allows 1920->1440 and 1280->960 subsampling\n if (ctx->width != ctx->cid_table->width &&\n ctx->cid_table->width != DNXHD_VARIABLE) {\n av_reduce(&ctx->avctx->sample_aspect_ratio.num,\n &ctx->avctx->sample_aspect_ratio.den,\n ctx->width, ctx->cid_table->width, 255);\n ctx->width = ctx->cid_table->width;\n }\n\n if (buf_size < ctx->cid_table->coding_unit_size) {\n av_log(ctx->avctx, AV_LOG_ERROR, \"incorrect frame size (%d < %u).\\n\",\n buf_size, ctx->cid_table->coding_unit_size);\n return AVERROR_INVALIDDATA;\n }\n\n ctx->mb_width = (ctx->width + 15)>> 4;\n ctx->mb_height = AV_RB16(buf + 0x16c);\n\n if ((ctx->height + 15) >> 4 == ctx->mb_height && frame->interlaced_frame)\n ctx->height <<= 1;\n\n av_log(ctx->avctx, AV_LOG_VERBOSE, \"%dx%d, 4:%s %d bits, MBAFF=%d ACT=%d\\n\",\n ctx->width, ctx->height, ctx->is_444 ? \"4:4\" : \"2:2\",\n ctx->bit_depth, ctx->mbaff, ctx->act);\n\n // Newer format supports variable mb_scan_index sizes\n if (ctx->mb_height > 68 && ff_dnxhd_check_header_prefix_hr(header_prefix)) {\n ctx->data_offset = 0x170 + (ctx->mb_height << 2);\n } else {\n if (ctx->mb_height > 68) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"mb height too big: %d\\n\", ctx->mb_height);\n return AVERROR_INVALIDDATA;\n }\n ctx->data_offset = 0x280;\n }\n if ((ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"mb height too big: %d\\n\", ctx->mb_height);\n return AVERROR_INVALIDDATA;\n }\n\n if (buf_size < ctx->data_offset) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"buffer too small (%d < %d).\\n\", buf_size, ctx->data_offset);\n return AVERROR_INVALIDDATA;\n }\n\n if (ctx->mb_height > FF_ARRAY_ELEMS(ctx->mb_scan_index)) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"mb_height too big (%d > %\"SIZE_SPECIFIER\").\\n\", ctx->mb_height, FF_ARRAY_ELEMS(ctx->mb_scan_index));\n return AVERROR_INVALIDDATA;\n }\n\n for (i = 0; i < ctx->mb_height; i++) {\n ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));\n ff_dlog(ctx->avctx, \"mb scan index %d, pos %d: %\"PRIu32\"\\n\",\n i, 0x170 + (i << 2), ctx->mb_scan_index[i]);\n if (buf_size - ctx->data_offset < ctx->mb_scan_index[i]) {\n av_log(ctx->avctx, AV_LOG_ERROR,\n \"invalid mb scan index (%\"PRIu32\" vs %u).\\n\",\n ctx->mb_scan_index[i], buf_size - ctx->data_offset);\n return AVERROR_INVALIDDATA;\n }\n }\n\n return 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"dnxhd_decode_header","file_name":"libavcodec/dnxhddec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/296debd213bd6dce7647cedd34eb64e5b94cdc92","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#53-b0bf09dad50d","input":"static MagickBooleanType WriteHDRImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n char\n header[MagickPathExtent];\n\n const char\n *property;\n\n MagickBooleanType\n status;\n\n register const Quantum\n *p;\n\n register ssize_t\n i,\n x;\n\n size_t\n length;\n\n ssize_t\n count,\n y;\n\n unsigned char\n pixel[4],\n *pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n if (IsRGBColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,RGBColorspace,exception);\n /*\n Write header.\n */\n (void) ResetMagickMemory(header,' ',MagickPathExtent);\n length=CopyMagickString(header,\"#?RGBE\\n\",MagickPathExtent);\n (void) WriteBlob(image,length,(unsigned char *) header);\n property=GetImageProperty(image,\"comment\",exception);\n if ((property != (const char *) NULL) &&\n (strchr(property,'\\n') == (char *) NULL))\n {\n count=FormatLocaleString(header,MagickPathExtent,\"#%s\\n\",property);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n property=GetImageProperty(image,\"hdr:exposure\",exception);\n if (property != (const char *) NULL)\n {\n count=FormatLocaleString(header,MagickPathExtent,\"EXPOSURE=%g\\n\",\n strtod(property,(char **) NULL));\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n if (image->gamma != 0.0)\n {\n count=FormatLocaleString(header,MagickPathExtent,\"GAMMA=%g\\n\",image->gamma);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n count=FormatLocaleString(header,MagickPathExtent,\n \"PRIMARIES=%g %g %g %g %g %g %g %g\\n\",\n image->chromaticity.red_primary.x,image->chromaticity.red_primary.y,\n image->chromaticity.green_primary.x,image->chromaticity.green_primary.y,\n image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y,\n image->chromaticity.white_point.x,image->chromaticity.white_point.y);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n length=CopyMagickString(header,\"FORMAT=32-bit_rle_rgbe\\n\\n\",MagickPathExtent);\n (void) WriteBlob(image,length,(unsigned char *) header);\n count=FormatLocaleString(header,MagickPathExtent,\"-Y %.20g +X %.20g\\n\",\n (double) image->rows,(double) image->columns);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n /*\n Write HDR pixels.\n */\n pixels=(unsigned char *) AcquireQuantumMemory(image->columns,4*\n sizeof(*pixels));\n if (pixels == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n pixel[0]=2;\n pixel[1]=2;\n pixel[2]=(unsigned char) (image->columns >> 8);\n pixel[3]=(unsigned char) (image->columns & 0xff);\n count=WriteBlob(image,4*sizeof(*pixel),pixel);\n if (count != (ssize_t) (4*sizeof(*pixel)))\n break;\n }\n i=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n double\n gamma;\n\n pixel[0]=0;\n pixel[1]=0;\n pixel[2]=0;\n pixel[3]=0;\n gamma=QuantumScale*GetPixelRed(image,p);\n if ((QuantumScale*GetPixelGreen(image,p)) > gamma)\n gamma=QuantumScale*GetPixelGreen(image,p);\n if ((QuantumScale*GetPixelBlue(image,p)) > gamma)\n gamma=QuantumScale*GetPixelBlue(image,p);\n if (gamma > MagickEpsilon)\n {\n int\n exponent;\n\n gamma=frexp(gamma,&exponent)*256.0/gamma;\n pixel[0]=(unsigned char) (gamma*QuantumScale*GetPixelRed(image,p));\n pixel[1]=(unsigned char) (gamma*QuantumScale*GetPixelGreen(image,p));\n pixel[2]=(unsigned char) (gamma*QuantumScale*GetPixelBlue(image,p));\n pixel[3]=(unsigned char) (exponent+128);\n }\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n pixels[x]=pixel[0];\n pixels[x+image->columns]=pixel[1];\n pixels[x+2*image->columns]=pixel[2];\n pixels[x+3*image->columns]=pixel[3];\n }\n else\n {\n pixels[i++]=pixel[0];\n pixels[i++]=pixel[1];\n pixels[i++]=pixel[2];\n pixels[i++]=pixel[3];\n }\n p+=GetPixelChannels(image);\n }\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n for (i=0; i < 4; i++)\n length=HDRWriteRunlengthPixels(image,&pixels[i*image->columns]);\n }\n else\n {\n count=WriteBlob(image,4*image->columns*sizeof(*pixels),pixels);\n if (count != (ssize_t) (4*image->columns*sizeof(*pixels)))\n break;\n }\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n pixels=(unsigned char *) RelinquishMagickMemory(pixels);\n (void) CloseBlob(image);\n return(MagickTrue);\n}","target":"static MagickBooleanType WriteHDRImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n char\n header[MagickPathExtent];\n\n const char\n *property;\n\n MagickBooleanType\n status;\n\n register const Quantum\n *p;\n\n register ssize_t\n i,\n x;\n\n size_t\n length;\n\n ssize_t\n count,\n y;\n\n unsigned char\n pixel[4],\n *pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n if (IsRGBColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,RGBColorspace,exception);\n /*\n Write header.\n */\n (void) ResetMagickMemory(header,' ',MagickPathExtent);\n length=CopyMagickString(header,\"#?RGBE\\n\",MagickPathExtent);\n (void) WriteBlob(image,length,(unsigned char *) header);\n property=GetImageProperty(image,\"comment\",exception);\n if ((property != (const char *) NULL) &&\n (strchr(property,'\\n') == (char *) NULL))\n {\n count=FormatLocaleString(header,MagickPathExtent,\"#%s\\n\",property);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n property=GetImageProperty(image,\"hdr:exposure\",exception);\n if (property != (const char *) NULL)\n {\n count=FormatLocaleString(header,MagickPathExtent,\"EXPOSURE=%g\\n\",\n strtod(property,(char **) NULL));\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n if (image->gamma != 0.0)\n {\n count=FormatLocaleString(header,MagickPathExtent,\"GAMMA=%g\\n\",\n image->gamma);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n }\n count=FormatLocaleString(header,MagickPathExtent,\n \"PRIMARIES=%g %g %g %g %g %g %g %g\\n\",\n image->chromaticity.red_primary.x,image->chromaticity.red_primary.y,\n image->chromaticity.green_primary.x,image->chromaticity.green_primary.y,\n image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y,\n image->chromaticity.white_point.x,image->chromaticity.white_point.y);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n length=CopyMagickString(header,\"FORMAT=32-bit_rle_rgbe\\n\\n\",MagickPathExtent);\n (void) WriteBlob(image,length,(unsigned char *) header);\n count=FormatLocaleString(header,MagickPathExtent,\"-Y %.20g +X %.20g\\n\",\n (double) image->rows,(double) image->columns);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) header);\n /*\n Write HDR pixels.\n */\n pixels=(unsigned char *) AcquireQuantumMemory(image->columns+128,4*\n sizeof(*pixels));\n if (pixels == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(pixels,0,4*(image->columns+128)*sizeof(*pixels));\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n pixel[0]=2;\n pixel[1]=2;\n pixel[2]=(unsigned char) (image->columns >> 8);\n pixel[3]=(unsigned char) (image->columns & 0xff);\n count=WriteBlob(image,4*sizeof(*pixel),pixel);\n if (count != (ssize_t) (4*sizeof(*pixel)))\n break;\n }\n i=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n double\n gamma;\n\n pixel[0]=0;\n pixel[1]=0;\n pixel[2]=0;\n pixel[3]=0;\n gamma=QuantumScale*GetPixelRed(image,p);\n if ((QuantumScale*GetPixelGreen(image,p)) > gamma)\n gamma=QuantumScale*GetPixelGreen(image,p);\n if ((QuantumScale*GetPixelBlue(image,p)) > gamma)\n gamma=QuantumScale*GetPixelBlue(image,p);\n if (gamma > MagickEpsilon)\n {\n int\n exponent;\n\n gamma=frexp(gamma,&exponent)*256.0/gamma;\n pixel[0]=(unsigned char) (gamma*QuantumScale*GetPixelRed(image,p));\n pixel[1]=(unsigned char) (gamma*QuantumScale*GetPixelGreen(image,p));\n pixel[2]=(unsigned char) (gamma*QuantumScale*GetPixelBlue(image,p));\n pixel[3]=(unsigned char) (exponent+128);\n }\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n pixels[x]=pixel[0];\n pixels[x+image->columns]=pixel[1];\n pixels[x+2*image->columns]=pixel[2];\n pixels[x+3*image->columns]=pixel[3];\n }\n else\n {\n pixels[i++]=pixel[0];\n pixels[i++]=pixel[1];\n pixels[i++]=pixel[2];\n pixels[i++]=pixel[3];\n }\n p+=GetPixelChannels(image);\n }\n if ((image->columns >= 8) && (image->columns <= 0x7ffff))\n {\n for (i=0; i < 4; i++)\n length=HDRWriteRunlengthPixels(image,&pixels[i*image->columns]);\n }\n else\n {\n count=WriteBlob(image,4*image->columns*sizeof(*pixels),pixels);\n if (count != (ssize_t) (4*image->columns*sizeof(*pixels)))\n break;\n }\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n pixels=(unsigned char *) RelinquishMagickMemory(pixels);\n (void) CloseBlob(image);\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"WriteHDRImage","file_name":"coders/hdr.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/14e606db148d6ebcaae20f1e1d6d71903ca4a556","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#54-fe942f41e450","input":"static void voutf(struct GlobalConfig *config,\n const char *prefix,\n const char *fmt,\n va_list ap)\n{\n size_t width = (79 - strlen(prefix));\n if(!config->mute) {\n size_t len;\n char *ptr;\n char *print_buffer;\n\n print_buffer = curlx_mvaprintf(fmt, ap);\n if(!print_buffer)\n return;\n len = strlen(print_buffer);\n\n ptr = print_buffer;\n while(len > 0) {\n fputs(prefix, config->errors);\n\n if(len > width) {\n size_t cut = width-1;\n\n while(!ISSPACE(ptr[cut]) && cut) {\n cut--;\n }\n if(0 == cut)\n /* not a single cutting position was found, just cut it at the\n max text width then! */\n cut = width-1;\n\n (void)fwrite(ptr, cut + 1, 1, config->errors);\n fputs(\"\\n\", config->errors);\n ptr += cut + 1; /* skip the space too */\n len -= cut;\n }\n else {\n fputs(ptr, config->errors);\n len = 0;\n }\n }\n curl_free(print_buffer);\n }\n}","target":"static void voutf(struct GlobalConfig *config,\n const char *prefix,\n const char *fmt,\n va_list ap)\n{\n size_t width = (79 - strlen(prefix));\n if(!config->mute) {\n size_t len;\n char *ptr;\n char *print_buffer;\n\n print_buffer = curlx_mvaprintf(fmt, ap);\n if(!print_buffer)\n return;\n len = strlen(print_buffer);\n\n ptr = print_buffer;\n while(len > 0) {\n fputs(prefix, config->errors);\n\n if(len > width) {\n size_t cut = width-1;\n\n while(!ISSPACE(ptr[cut]) && cut) {\n cut--;\n }\n if(0 == cut)\n /* not a single cutting position was found, just cut it at the\n max text width then! */\n cut = width-1;\n\n (void)fwrite(ptr, cut + 1, 1, config->errors);\n fputs(\"\\n\", config->errors);\n ptr += cut + 1; /* skip the space too */\n len -= cut + 1;\n }\n else {\n fputs(ptr, config->errors);\n len = 0;\n }\n }\n curl_free(print_buffer);\n }\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"voutf","file_name":"src/tool_msgs.c","commit_link":"github.com/curl/curl/commit/d530e92f59ae9bb2d47066c3c460b25d2ffeb211","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#55-f5c736a5c6b9","input":"int pure_strcmp(const char * const s1, const char * const s2)\n{\n return pure_memcmp(s1, s2, strlen(s1) + 1U);\n}","target":"int pure_strcmp(const char * const s1, const char * const s2)\n{\n const size_t s1_len = strlen(s1);\n const size_t s2_len = strlen(s2);\n\n if (s1_len != s2_len) {\n return -1;\n }\n return pure_memcmp(s1, s2, s1_len);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"pure_strcmp","file_name":"src/utils.c","commit_link":"github.com/jedisct1/pure-ftpd/commit/36c6d268cb190282a2c17106acfd31863121b58e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#56-39bb903aabe7","input":"static void read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)\n{\n int i, j, v;\n\n if (get_bits1(gb)) {\n /* intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n v = get_bits(gb, 8);\n j = s->idsp.idct_permutation[ff_zigzag_direct[i]];\n s->intra_matrix[j] = v;\n s->chroma_intra_matrix[j] = v;\n }\n }\n\n if (get_bits1(gb)) {\n /* non_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n get_bits(gb, 8);\n }\n }\n\n if (get_bits1(gb)) {\n /* chroma_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n v = get_bits(gb, 8);\n j = s->idsp.idct_permutation[ff_zigzag_direct[i]];\n s->chroma_intra_matrix[j] = v;\n }\n }\n\n if (get_bits1(gb)) {\n /* chroma_non_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n get_bits(gb, 8);\n }\n }\n\n next_start_code_studio(gb);\n}","target":"static int read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)\n{\n int i, j, v;\n\n if (get_bits1(gb)) {\n if (get_bits_left(gb) < 64*8)\n return AVERROR_INVALIDDATA;\n /* intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n v = get_bits(gb, 8);\n j = s->idsp.idct_permutation[ff_zigzag_direct[i]];\n s->intra_matrix[j] = v;\n s->chroma_intra_matrix[j] = v;\n }\n }\n\n if (get_bits1(gb)) {\n if (get_bits_left(gb) < 64*8)\n return AVERROR_INVALIDDATA;\n /* non_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n get_bits(gb, 8);\n }\n }\n\n if (get_bits1(gb)) {\n if (get_bits_left(gb) < 64*8)\n return AVERROR_INVALIDDATA;\n /* chroma_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n v = get_bits(gb, 8);\n j = s->idsp.idct_permutation[ff_zigzag_direct[i]];\n s->chroma_intra_matrix[j] = v;\n }\n }\n\n if (get_bits1(gb)) {\n if (get_bits_left(gb) < 64*8)\n return AVERROR_INVALIDDATA;\n /* chroma_non_intra_quantiser_matrix */\n for (i = 0; i < 64; i++) {\n get_bits(gb, 8);\n }\n }\n\n next_start_code_studio(gb);\n return 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"read_quant_matrix_ext","file_name":"libavcodec/mpeg4videodec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/5aba5b89d0b1d73164d3b81764828bb8b20ff32a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#57-cd960df54aa0","input":"QByteArray Cipher::blowfishECB(QByteArray cipherText, bool direction)\n{\n QCA::Initializer init;\n QByteArray temp = cipherText;\n\n //do padding ourselves\n if (direction)\n {\n while ((temp.length() % 8) != 0) temp.append('\\0');\n }\n else\n {\n temp = b64ToByte(temp);\n while ((temp.length() % 8) != 0) temp.append('\\0');\n }\n\n QCA::Direction dir = (direction) ? QCA::Encode : QCA::Decode;\n QCA::Cipher cipher(m_type, QCA::Cipher::ECB, QCA::Cipher::NoPadding, dir, m_key);\n QByteArray temp2 = cipher.update(QCA::MemoryRegion(temp)).toByteArray();\n temp2 += cipher.final().toByteArray();\n\n if (!cipher.ok())\n return cipherText;\n\n if (direction)\n temp2 = byteToB64(temp2);\n\n return temp2;\n}","target":"QByteArray Cipher::blowfishECB(QByteArray cipherText, bool direction)\n{\n QCA::Initializer init;\n QByteArray temp = cipherText;\n\n //do padding ourselves\n if (direction)\n {\n while ((temp.length() % 8) != 0) temp.append('\\0');\n }\n else\n {\n // ECB Blowfish encodes in blocks of 12 chars, so anything else is malformed input\n if ((temp.length() % 12) != 0)\n return cipherText;\n\n temp = b64ToByte(temp);\n while ((temp.length() % 8) != 0) temp.append('\\0');\n }\n\n QCA::Direction dir = (direction) ? QCA::Encode : QCA::Decode;\n QCA::Cipher cipher(m_type, QCA::Cipher::ECB, QCA::Cipher::NoPadding, dir, m_key);\n QByteArray temp2 = cipher.update(QCA::MemoryRegion(temp)).toByteArray();\n temp2 += cipher.final().toByteArray();\n\n if (!cipher.ok())\n return cipherText;\n\n if (direction) {\n // Sanity check\n if ((temp2.length() % 8) != 0)\n return cipherText;\n\n temp2 = byteToB64(temp2);\n }\n\n return temp2;\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"Cipher::blowfishECB","file_name":"src/core/cipher.cpp","commit_link":"github.com/quassel/quassel/commit/8b5ecd226f9208af3074b33d3b7cf5e14f55b138","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#58-591b27adce5e","input":"static int java_switch_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tut8 op_byte = data[0];\n\tut64 offset = addr - java_get_method_start ();\n\tut8 pos = (offset+1)%4 ? 1 + 4 - (offset+1)%4 : 1;\n\n\tif (op_byte == 0xaa) {\n\t\t// handle a table switch condition\n\t\tif (pos + 8 > len) {\n\t\t\treturn op->size;\n\t\t}\n\t\tint min_val = (ut32)(UINT (data, pos + 4)),\n\t\t\tmax_val = (ut32)(UINT (data, pos + 8));\n\n\t\tut32 default_loc = (ut32) (UINT (data, pos)), cur_case = 0;\n\t\top->switch_op = r_anal_switch_op_new (addr, min_val, default_loc);\n\t\tRAnalCaseOp *caseop = NULL;\n\t\tpos += 12;\n\t\tif (max_val > min_val && ((max_val - min_val)<(UT16_MAX/4))) {\n\t\t\t//caseop = r_anal_switch_op_add_case(op->switch_op, addr+default_loc, -1, addr+offset);\n\t\t\tfor (cur_case = 0; cur_case <= max_val - min_val; pos += 4, cur_case++) {\n\t\t\t\t//ut32 value = (ut32)(UINT (data, pos));\n\t\t\t\tif (pos + 4 >= len) {\n\t\t\t\t\t// switch is too big cant read further\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tint offset = (int)(ut32)(R_BIN_JAVA_UINT (data, pos));\n\t\t\t\tcaseop = r_anal_switch_op_add_case (op->switch_op,\n\t\t\t\t\taddr + pos, cur_case + min_val, addr + offset);\n\t\t\t\tif (caseop) {\n\t\t\t\t\tcaseop->bb_ref_to = addr+offset;\n\t\t\t\t\tcaseop->bb_ref_from = addr; // TODO figure this one out\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\teprintf (\"Invalid switch boundaries at 0x%\"PFMT64x\"\\n\", addr);\n\t\t}\n\t}\n\top->size = pos;\n\treturn op->size;\n}","target":"static int java_switch_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tut8 op_byte = data[0];\n\tut64 offset = addr - java_get_method_start ();\n\tut8 pos = (offset+1)%4 ? 1 + 4 - (offset+1)%4 : 1;\n\n\tif (op_byte == 0xaa) {\n\t\t// handle a table switch condition\n\t\tif (pos + 8 + 8 > len) {\n\t\t\treturn op->size;\n\t\t}\n\t\tconst int min_val = (ut32)(UINT (data, pos + 4));\n\t\tconst int max_val = (ut32)(UINT (data, pos + 8));\n\n\t\tut32 default_loc = (ut32) (UINT (data, pos)), cur_case = 0;\n\t\top->switch_op = r_anal_switch_op_new (addr, min_val, default_loc);\n\t\tRAnalCaseOp *caseop = NULL;\n\t\tpos += 12;\n\t\tif (max_val > min_val && ((max_val - min_val)<(UT16_MAX/4))) {\n\t\t\t//caseop = r_anal_switch_op_add_case(op->switch_op, addr+default_loc, -1, addr+offset);\n\t\t\tfor (cur_case = 0; cur_case <= max_val - min_val; pos += 4, cur_case++) {\n\t\t\t\t//ut32 value = (ut32)(UINT (data, pos));\n\t\t\t\tif (pos + 4 >= len) {\n\t\t\t\t\t// switch is too big cant read further\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tint offset = (int)(ut32)(R_BIN_JAVA_UINT (data, pos));\n\t\t\t\tcaseop = r_anal_switch_op_add_case (op->switch_op,\n\t\t\t\t\taddr + pos, cur_case + min_val, addr + offset);\n\t\t\t\tif (caseop) {\n\t\t\t\t\tcaseop->bb_ref_to = addr+offset;\n\t\t\t\t\tcaseop->bb_ref_from = addr; // TODO figure this one out\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\teprintf (\"Invalid switch boundaries at 0x%\"PFMT64x\"\\n\", addr);\n\t\t}\n\t}\n\top->size = pos;\n\treturn op->size;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"java_switch_op","file_name":"libr/anal/p/anal_java.c","commit_link":"github.com/radare/radare2/commit/224e6bc13fa353dd3b7f7a2334588f1c4229e58d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#59-6b775e0c7ac6","input":"SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)\n{\n\twStream* s;\n\tsize_t length;\n\tNTLM_NEGOTIATE_MESSAGE* message;\n\tmessage = &context->NEGOTIATE_MESSAGE;\n\tZeroMemory(message, sizeof(NTLM_NEGOTIATE_MESSAGE));\n\ts = Stream_New((BYTE*)buffer->pvBuffer, buffer->cbBuffer);\n\n\tif (!s)\n\t\treturn SEC_E_INTERNAL_ERROR;\n\n\tif (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER*)message) < 0)\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tif (message->MessageType != MESSAGE_TYPE_NEGOTIATE)\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tStream_Read_UINT32(s, message->NegotiateFlags); /* NegotiateFlags (4 bytes) */\n\n\tif (!((message->NegotiateFlags & NTLMSSP_REQUEST_TARGET) &&\n\t (message->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLM) &&\n\t (message->NegotiateFlags & NTLMSSP_NEGOTIATE_UNICODE)))\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tcontext->NegotiateFlags = message->NegotiateFlags;\n\n\t/* only set if NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED is set */\n\n\tif (ntlm_read_message_fields(s, &(message->DomainName)) < 0) /* DomainNameFields (8 bytes) */\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\t/* only set if NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED is set */\n\n\tif (ntlm_read_message_fields(s, &(message->Workstation)) < 0) /* WorkstationFields (8 bytes) */\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tif (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)\n\t{\n\t\tif (ntlm_read_version_info(s, &(message->Version)) < 0) /* Version (8 bytes) */\n\t\t{\n\t\t\tStream_Free(s, FALSE);\n\t\t\treturn SEC_E_INVALID_TOKEN;\n\t\t}\n\t}\n\n\tlength = Stream_GetPosition(s);\n\tbuffer->cbBuffer = length;\n\n\tif (!sspi_SecBufferAlloc(&context->NegotiateMessage, length))\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INTERNAL_ERROR;\n\t}\n\n\tCopyMemory(context->NegotiateMessage.pvBuffer, buffer->pvBuffer, buffer->cbBuffer);\n\tcontext->NegotiateMessage.BufferType = buffer->BufferType;\n#ifdef WITH_DEBUG_NTLM\n\tWLog_DBG(TAG, \"NEGOTIATE_MESSAGE (length = %\" PRIu32 \")\", context->NegotiateMessage.cbBuffer);\n\twinpr_HexDump(TAG, WLOG_DEBUG, context->NegotiateMessage.pvBuffer,\n\t context->NegotiateMessage.cbBuffer);\n\tntlm_print_negotiate_flags(message->NegotiateFlags);\n\n\tif (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)\n\t\tntlm_print_version_info(&(message->Version));\n\n#endif\n\tcontext->state = NTLM_STATE_CHALLENGE;\n\tStream_Free(s, FALSE);\n\treturn SEC_I_CONTINUE_NEEDED;\n}","target":"SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)\n{\n\twStream* s;\n\tsize_t length;\n\tNTLM_NEGOTIATE_MESSAGE* message;\n\tmessage = &context->NEGOTIATE_MESSAGE;\n\tZeroMemory(message, sizeof(NTLM_NEGOTIATE_MESSAGE));\n\ts = Stream_New((BYTE*)buffer->pvBuffer, buffer->cbBuffer);\n\n\tif (!s)\n\t\treturn SEC_E_INTERNAL_ERROR;\n\n\tif (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER*)message) < 0)\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tif (message->MessageType != MESSAGE_TYPE_NEGOTIATE)\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tif (Stream_GetRemainingLength(s) < 4)\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\tStream_Read_UINT32(s, message->NegotiateFlags); /* NegotiateFlags (4 bytes) */\n\n\tif (!((message->NegotiateFlags & NTLMSSP_REQUEST_TARGET) &&\n\t (message->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLM) &&\n\t (message->NegotiateFlags & NTLMSSP_NEGOTIATE_UNICODE)))\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tcontext->NegotiateFlags = message->NegotiateFlags;\n\n\t/* only set if NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED is set */\n\n\tif (ntlm_read_message_fields(s, &(message->DomainName)) < 0) /* DomainNameFields (8 bytes) */\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\t/* only set if NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED is set */\n\n\tif (ntlm_read_message_fields(s, &(message->Workstation)) < 0) /* WorkstationFields (8 bytes) */\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INVALID_TOKEN;\n\t}\n\n\tif (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)\n\t{\n\t\tif (ntlm_read_version_info(s, &(message->Version)) < 0) /* Version (8 bytes) */\n\t\t{\n\t\t\tStream_Free(s, FALSE);\n\t\t\treturn SEC_E_INVALID_TOKEN;\n\t\t}\n\t}\n\n\tlength = Stream_GetPosition(s);\n\tbuffer->cbBuffer = length;\n\n\tif (!sspi_SecBufferAlloc(&context->NegotiateMessage, length))\n\t{\n\t\tStream_Free(s, FALSE);\n\t\treturn SEC_E_INTERNAL_ERROR;\n\t}\n\n\tCopyMemory(context->NegotiateMessage.pvBuffer, buffer->pvBuffer, buffer->cbBuffer);\n\tcontext->NegotiateMessage.BufferType = buffer->BufferType;\n#ifdef WITH_DEBUG_NTLM\n\tWLog_DBG(TAG, \"NEGOTIATE_MESSAGE (length = %\" PRIu32 \")\", context->NegotiateMessage.cbBuffer);\n\twinpr_HexDump(TAG, WLOG_DEBUG, context->NegotiateMessage.pvBuffer,\n\t context->NegotiateMessage.cbBuffer);\n\tntlm_print_negotiate_flags(message->NegotiateFlags);\n\n\tif (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION)\n\t\tntlm_print_version_info(&(message->Version));\n\n#endif\n\tcontext->state = NTLM_STATE_CHALLENGE;\n\tStream_Free(s, FALSE);\n\treturn SEC_I_CONTINUE_NEEDED;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ntlm_read_NegotiateMessage","file_name":"winpr/libwinpr/sspi/NTLM/ntlm_message.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/8fa38359634a9910b91719818ab02f23c320dbae","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#60-42414a109884","input":"const char *enc_untrusted_inet_ntop(int af, const void *src, char *dst,\n socklen_t size) {\n if (!src || !dst) {\n errno = EFAULT;\n return nullptr;\n }\n size_t src_size = 0;\n if (af == AF_INET) {\n src_size = sizeof(struct in_addr);\n } else if (af == AF_INET6) {\n src_size = sizeof(struct in6_addr);\n } else {\n errno = EAFNOSUPPORT;\n return nullptr;\n }\n\n MessageWriter input;\n input.Push(TokLinuxAfFamily(af));\n input.PushByReference(Extent{reinterpret_cast(src), src_size});\n input.Push(size);\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kInetNtopHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_ntop\", 2);\n\n auto result = output.next();\n int klinux_errno = output.next();\n if (result.empty()) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return nullptr;\n }\n\n memcpy(dst, result.data(),\n std::min(static_cast(size),\n static_cast(INET6_ADDRSTRLEN)));\n return dst;\n}","target":"const char *enc_untrusted_inet_ntop(int af, const void *src, char *dst,\n socklen_t size) {\n if (!src || !dst) {\n errno = EFAULT;\n return nullptr;\n }\n size_t src_size = 0;\n if (af == AF_INET) {\n src_size = sizeof(struct in_addr);\n } else if (af == AF_INET6) {\n src_size = sizeof(struct in6_addr);\n } else {\n errno = EAFNOSUPPORT;\n return nullptr;\n }\n\n MessageWriter input;\n input.Push(TokLinuxAfFamily(af));\n input.PushByReference(Extent{reinterpret_cast(src), src_size});\n input.Push(size);\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kInetNtopHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_ntop\", 2);\n\n auto result = output.next();\n int klinux_errno = output.next();\n if (result.empty()) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return nullptr;\n }\n\n memcpy(\n dst, result.data(),\n std::min({static_cast(size), static_cast(result.size()),\n static_cast(INET6_ADDRSTRLEN)}));\n return dst;\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"enc_untrusted_inet_ntop","file_name":"asylo/platform/host_call/trusted/host_calls.cc","commit_link":"github.com/google/asylo/commit/6ff3b77ffe110a33a2f93848a6333f33616f02c4","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#61-a01cb3f981b3","input":"void ndpi_search_oracle(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)\n{\n struct ndpi_packet_struct *packet = &flow->packet;\n u_int16_t dport = 0, sport = 0;\n\n NDPI_LOG_DBG(ndpi_struct, \"search ORACLE\\n\");\n\n if(packet->tcp != NULL) {\n sport = ntohs(packet->tcp->source), dport = ntohs(packet->tcp->dest);\n NDPI_LOG_DBG2(ndpi_struct, \"calculating ORACLE over tcp\\n\");\n /* Oracle Database 9g,10g,11g */\n if ((dport == 1521 || sport == 1521)\n\t&& (((packet->payload[0] == 0x07) && (packet->payload[1] == 0xff) && (packet->payload[2] == 0x00))\n\t || ((packet->payload_packet_len >= 232) && ((packet->payload[0] == 0x00) || (packet->payload[0] == 0x01)) \n\t && (packet->payload[1] != 0x00)\n\t && (packet->payload[2] == 0x00)\n\t\t && (packet->payload[3] == 0x00)))) {\n NDPI_LOG_INFO(ndpi_struct, \"found oracle\\n\");\n ndpi_int_oracle_add_connection(ndpi_struct, flow);\n } else if (packet->payload_packet_len == 213 && packet->payload[0] == 0x00 &&\n packet->payload[1] == 0xd5 && packet->payload[2] == 0x00 &&\n packet->payload[3] == 0x00 ) {\n NDPI_LOG_INFO(ndpi_struct, \"found oracle\\n\");\n ndpi_int_oracle_add_connection(ndpi_struct, flow);\n }\n } else {\n NDPI_EXCLUDE_PROTO(ndpi_struct, flow);\n }\n}","target":"void ndpi_search_oracle(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)\n{\n struct ndpi_packet_struct *packet = &flow->packet;\n u_int16_t dport = 0, sport = 0;\n\n NDPI_LOG_DBG(ndpi_struct, \"search ORACLE\\n\");\n\n if(packet->tcp != NULL) {\n sport = ntohs(packet->tcp->source), dport = ntohs(packet->tcp->dest);\n NDPI_LOG_DBG2(ndpi_struct, \"calculating ORACLE over tcp\\n\");\n /* Oracle Database 9g,10g,11g */\n if ((dport == 1521 || sport == 1521)\n\t&& (((packet->payload_packet_len >= 3 && packet->payload[0] == 0x07) && (packet->payload[1] == 0xff) && (packet->payload[2] == 0x00))\n\t || ((packet->payload_packet_len >= 232) && ((packet->payload[0] == 0x00) || (packet->payload[0] == 0x01)) \n\t && (packet->payload[1] != 0x00)\n\t && (packet->payload[2] == 0x00)\n\t\t && (packet->payload[3] == 0x00)))) {\n NDPI_LOG_INFO(ndpi_struct, \"found oracle\\n\");\n ndpi_int_oracle_add_connection(ndpi_struct, flow);\n } else if (packet->payload_packet_len == 213 && packet->payload[0] == 0x00 &&\n packet->payload[1] == 0xd5 && packet->payload[2] == 0x00 &&\n packet->payload[3] == 0x00 ) {\n NDPI_LOG_INFO(ndpi_struct, \"found oracle\\n\");\n ndpi_int_oracle_add_connection(ndpi_struct, flow);\n }\n } else {\n NDPI_EXCLUDE_PROTO(ndpi_struct, flow);\n }\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ndpi_search_oracle","file_name":"src/lib/protocols/oracle.c","commit_link":"github.com/ntop/nDPI/commit/b69177be2fbe01c2442239a61832c44e40136c05","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#62-daf50b8865a3","input":"static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic)\n{\n\tioapic->rtc_status.pending_eoi = 0;\n\tbitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPUS);\n}","target":"static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic)\n{\n\tioapic->rtc_status.pending_eoi = 0;\n\tbitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"rtc_irq_eoi_tracking_reset","file_name":"arch/x86/kvm/ioapic.c","commit_link":"github.com/torvalds/linux/commit/81cdb259fb6d8c1c4ecfeea389ff5a73c07f5755","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#63-04dded5901b6","input":"static u_int16_t concat_hash_string(struct ndpi_packet_struct *packet,\n\t\t\t\t char *buf, u_int8_t client_hash) {\n u_int16_t offset = 22, buf_out_len = 0;\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n u_int32_t len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n offset += 4;\n\n /* -1 for ';' */\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n /* ssh.kex_algorithms [C/S] */\n strncpy(buf, (const char *)&packet->payload[offset], buf_out_len = len);\n buf[buf_out_len++] = ';';\n offset += len;\n\n /* ssh.server_host_key_algorithms [None] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n offset += 4 + len;\n\n /* ssh.encryption_algorithms_client_to_server [C] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.encryption_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.mac_algorithms_client_to_server [C] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.mac_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.compression_algorithms_client_to_server [C] */\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.compression_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.languages_client_to_server [None] */\n\n /* ssh.languages_server_to_client [None] */\n\n#ifdef SSH_DEBUG\n printf(\"[SSH] %s\\n\", buf);\n#endif\n\n return(buf_out_len);\n\ninvalid_payload:\n\n#ifdef SSH_DEBUG\n printf(\"[SSH] Invalid packet payload\\n\");\n#endif\n\n return(0);\n}","target":"static u_int16_t concat_hash_string(struct ndpi_packet_struct *packet,\n\t\t\t\t char *buf, u_int8_t client_hash) {\n u_int16_t offset = 22, buf_out_len = 0;\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n u_int32_t len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n offset += 4;\n\n /* -1 for ';' */\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n /* ssh.kex_algorithms [C/S] */\n strncpy(buf, (const char *)&packet->payload[offset], buf_out_len = len);\n buf[buf_out_len++] = ';';\n offset += len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.server_host_key_algorithms [None] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n offset += 4 + len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.encryption_algorithms_client_to_server [C] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.encryption_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.mac_algorithms_client_to_server [C] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.mac_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n buf[buf_out_len++] = ';';\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.compression_algorithms_client_to_server [C] */\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n offset += len;\n } else\n offset += 4 + len;\n\n if(offset+sizeof(u_int32_t) >= packet->payload_packet_len)\n goto invalid_payload;\n /* ssh.compression_algorithms_server_to_client [S] */\n len = ntohl(*(u_int32_t*)&packet->payload[offset]);\n\n if(!client_hash) {\n offset += 4;\n\n if((offset >= packet->payload_packet_len) || (len >= packet->payload_packet_len-offset-1))\n goto invalid_payload;\n\n strncpy(&buf[buf_out_len], (const char *)&packet->payload[offset], len);\n buf_out_len += len;\n offset += len;\n } else\n offset += 4 + len;\n\n /* ssh.languages_client_to_server [None] */\n\n /* ssh.languages_server_to_client [None] */\n\n#ifdef SSH_DEBUG\n printf(\"[SSH] %s\\n\", buf);\n#endif\n\n return(buf_out_len);\n\ninvalid_payload:\n\n#ifdef SSH_DEBUG\n printf(\"[SSH] Invalid packet payload\\n\");\n#endif\n\n return(0);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"concat_hash_string","file_name":"src/lib/protocols/ssh.c","commit_link":"github.com/ntop/nDPI/commit/3bbb0cd3296023f6f922c71d21a1c374d2b0a435","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#64-09df6d4bbb8b","input":"static ssize_t DecodePSDPixels(const size_t number_compact_pixels,\n const unsigned char *compact_pixels,const ssize_t depth,\n const size_t number_pixels,unsigned char *pixels)\n{\n#define CheckNumberCompactPixels \\\n if (packets == 0) \\\n return(i); \\\n packets--\n\n#define CheckNumberPixels(count) \\\n if (((ssize_t) i + count) > (ssize_t) number_pixels) \\\n return(i); \\\n i+=count\n\n int\n pixel;\n\n register ssize_t\n i,\n j;\n\n size_t\n length;\n\n ssize_t\n packets;\n\n packets=(ssize_t) number_compact_pixels;\n for (i=0; (packets > 1) && (i < (ssize_t) number_pixels); )\n {\n packets--;\n length=(size_t) (*compact_pixels++);\n if (length == 128)\n continue;\n if (length > 128)\n {\n length=256-length+1;\n CheckNumberCompactPixels;\n pixel=(*compact_pixels++);\n for (j=0; j < (ssize_t) length; j++)\n {\n switch (depth)\n {\n case 1:\n {\n CheckNumberPixels(8);\n *pixels++=(pixel >> 7) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 6) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 5) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 4) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 3) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 2) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 1) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 0) & 0x01 ? 0U : 255U;\n break;\n }\n case 2:\n {\n CheckNumberPixels(4);\n *pixels++=(unsigned char) ((pixel >> 6) & 0x03);\n *pixels++=(unsigned char) ((pixel >> 4) & 0x03);\n *pixels++=(unsigned char) ((pixel >> 2) & 0x03);\n *pixels++=(unsigned char) ((pixel & 0x03) & 0x03);\n break;\n }\n case 4:\n {\n CheckNumberPixels(2);\n *pixels++=(unsigned char) ((pixel >> 4) & 0xff);\n *pixels++=(unsigned char) ((pixel & 0x0f) & 0xff);\n break;\n }\n default:\n {\n CheckNumberPixels(1);\n *pixels++=(unsigned char) pixel;\n break;\n }\n }\n }\n continue;\n }\n length++;\n for (j=0; j < (ssize_t) length; j++)\n {\n switch (depth)\n {\n case 1:\n {\n CheckNumberPixels(8);\n *pixels++=(*compact_pixels >> 7) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 6) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 5) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 4) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 3) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 2) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 1) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 0) & 0x01 ? 0U : 255U;\n break;\n }\n case 2:\n {\n CheckNumberPixels(4);\n *pixels++=(*compact_pixels >> 6) & 0x03;\n *pixels++=(*compact_pixels >> 4) & 0x03;\n *pixels++=(*compact_pixels >> 2) & 0x03;\n *pixels++=(*compact_pixels & 0x03) & 0x03;\n break;\n }\n case 4:\n {\n CheckNumberPixels(2);\n *pixels++=(*compact_pixels >> 4) & 0xff;\n *pixels++=(*compact_pixels & 0x0f) & 0xff;\n break;\n }\n default:\n {\n CheckNumberPixels(1);\n *pixels++=(*compact_pixels);\n break;\n }\n }\n CheckNumberCompactPixels;\n compact_pixels++;\n }\n }\n return(i);\n}","target":"static ssize_t DecodePSDPixels(const size_t number_compact_pixels,\n const unsigned char *compact_pixels,const ssize_t depth,\n const size_t number_pixels,unsigned char *pixels)\n{\n#define CheckNumberCompactPixels \\\n if (packets == 0) \\\n return(i); \\\n packets--\n\n#define CheckNumberPixels(count) \\\n if (((ssize_t) i + count) > (ssize_t) number_pixels) \\\n return(i); \\\n i+=count\n\n int\n pixel;\n\n register ssize_t\n i,\n j;\n\n size_t\n length;\n\n ssize_t\n packets;\n\n packets=(ssize_t) number_compact_pixels;\n for (i=0; (packets > 1) && (i < (ssize_t) number_pixels); )\n {\n packets--;\n length=(size_t) (*compact_pixels++);\n if (length == 128)\n continue;\n if (length > 128)\n {\n length=256-length+1;\n CheckNumberCompactPixels;\n pixel=(*compact_pixels++);\n for (j=0; j < (ssize_t) length; j++)\n {\n switch (depth)\n {\n case 1:\n {\n CheckNumberPixels(8);\n *pixels++=(pixel >> 7) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 6) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 5) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 4) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 3) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 2) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 1) & 0x01 ? 0U : 255U;\n *pixels++=(pixel >> 0) & 0x01 ? 0U : 255U;\n break;\n }\n case 2:\n {\n CheckNumberPixels(4);\n *pixels++=(unsigned char) ((pixel >> 6) & 0x03);\n *pixels++=(unsigned char) ((pixel >> 4) & 0x03);\n *pixels++=(unsigned char) ((pixel >> 2) & 0x03);\n *pixels++=(unsigned char) ((pixel & 0x03) & 0x03);\n break;\n }\n case 4:\n {\n CheckNumberPixels(2);\n *pixels++=(unsigned char) ((pixel >> 4) & 0xff);\n *pixels++=(unsigned char) ((pixel & 0x0f) & 0xff);\n break;\n }\n default:\n {\n CheckNumberPixels(1);\n *pixels++=(unsigned char) pixel;\n break;\n }\n }\n }\n continue;\n }\n length++;\n for (j=0; j < (ssize_t) length; j++)\n {\n CheckNumberCompactPixels;\n switch (depth)\n {\n case 1:\n {\n CheckNumberPixels(8);\n *pixels++=(*compact_pixels >> 7) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 6) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 5) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 4) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 3) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 2) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 1) & 0x01 ? 0U : 255U;\n *pixels++=(*compact_pixels >> 0) & 0x01 ? 0U : 255U;\n break;\n }\n case 2:\n {\n CheckNumberPixels(4);\n *pixels++=(*compact_pixels >> 6) & 0x03;\n *pixels++=(*compact_pixels >> 4) & 0x03;\n *pixels++=(*compact_pixels >> 2) & 0x03;\n *pixels++=(*compact_pixels & 0x03) & 0x03;\n break;\n }\n case 4:\n {\n CheckNumberPixels(2);\n *pixels++=(*compact_pixels >> 4) & 0xff;\n *pixels++=(*compact_pixels & 0x0f) & 0xff;\n break;\n }\n default:\n {\n CheckNumberPixels(1);\n *pixels++=(*compact_pixels);\n break;\n }\n }\n compact_pixels++;\n }\n }\n return(i);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"DecodePSDPixels","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/30eec879c8b446b0ea9a3bb0da1a441cc8482bc4","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#65-01c350d47b80","input":"static int _6502_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tchar addrbuf[64];\n\tconst int buffsize = sizeof (addrbuf) - 1;\n\n\tmemset (op, '\\0', sizeof (RAnalOp));\n\top->size = snes_op_get_size (1, 1, &snes_op[data[0]]);\t//snes-arch is similiar to nes/6502\n\top->addr = addr;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->id = data[0];\n\tr_strbuf_init (&op->esil);\n\tswitch (data[0]) {\n\tcase 0x02:\n\tcase 0x03:\n\tcase 0x04:\n\tcase 0x07:\n\tcase 0x0b:\n\tcase 0x0c:\n\tcase 0x0f:\n\tcase 0x12:\n\tcase 0x13:\n\tcase 0x14:\n\tcase 0x17:\n\tcase 0x1a:\n\tcase 0x1b:\n\tcase 0x1c:\n\tcase 0x1f:\n\tcase 0x22:\n\tcase 0x23:\n\tcase 0x27:\n\tcase 0x2b:\n\tcase 0x2f:\n\tcase 0x32:\n\tcase 0x33:\n\tcase 0x34:\n\tcase 0x37:\n\tcase 0x3a:\n\tcase 0x3b:\n\tcase 0x3c:\n\tcase 0x3f:\n\tcase 0x42:\n\tcase 0x43:\n\tcase 0x44:\n\tcase 0x47:\n\tcase 0x4b:\n\tcase 0x4f:\n\tcase 0x52:\n\tcase 0x53:\n\tcase 0x54:\n\tcase 0x57:\n\tcase 0x5a:\n\tcase 0x5b:\n\tcase 0x5c:\n\tcase 0x5f:\n\tcase 0x62:\n\tcase 0x63:\n\tcase 0x64:\n\tcase 0x67:\n\tcase 0x6b:\n\tcase 0x6f:\n\tcase 0x72:\n\tcase 0x73:\n\tcase 0x74:\n\tcase 0x77:\n\tcase 0x7a:\n\tcase 0x7b:\n\tcase 0x7c:\n\tcase 0x7f:\n\tcase 0x80:\n\tcase 0x82:\n\tcase 0x83:\n\tcase 0x87:\n\tcase 0x89:\n\tcase 0x8b:\n\tcase 0x8f:\n\tcase 0x92:\n\tcase 0x93:\n\tcase 0x97:\n\tcase 0x9b:\n\tcase 0x9c:\n\tcase 0x9e:\n\tcase 0x9f:\n\tcase 0xa3:\n\tcase 0xa7:\n\tcase 0xab:\n\tcase 0xaf:\n\tcase 0xb2:\n\tcase 0xb3:\n\tcase 0xb7:\n\tcase 0xbb:\n\tcase 0xbf:\n\tcase 0xc2:\n\tcase 0xc3:\n\tcase 0xc7:\n\tcase 0xcb:\n\tcase 0xcf:\n\tcase 0xd2:\n\tcase 0xd3:\n\tcase 0xd4:\n\tcase 0xd7:\n\tcase 0xda:\n\tcase 0xdb:\n\tcase 0xdc:\n\tcase 0xdf:\n\tcase 0xe2:\n\tcase 0xe3:\n\tcase 0xe7:\n\tcase 0xeb:\n\tcase 0xef:\n\tcase 0xf2:\n\tcase 0xf3:\n\tcase 0xf4:\n\tcase 0xf7:\n\tcase 0xfa:\n\tcase 0xfb:\n\tcase 0xfc:\n\tcase 0xff:\n\t\t// undocumented or not-implemented opcodes for 6502.\n\t\t// some of them might be implemented in 65816\n\t\top->size = 1;\n\t\top->type = R_ANAL_OP_TYPE_ILL;\n\t\tbreak;\n\n\t// BRK\n\tcase 0x00: // brk\n\t\top->cycles = 7;\n\t\top->type = R_ANAL_OP_TYPE_SWI;\n\t\t// override 65816 code which seems to be wrong: size is 1, but pc = pc + 2\n\t\top->size = 1;\n\t\t// PC + 2 to Stack, P to Stack B=1 D=0 I=1. \"B\" is not a flag. Only its bit is pushed on the stack\n\t\t// PC was already incremented by one at this point. Needs to incremented once more\n\t\t// New PC is Interrupt Vector: $fffe. (FIXME: Confirm this is valid for all 6502)\n\t\tr_strbuf_set (&op->esil, \",1,I,=,0,D,=,flags,0x10,|,0x100,sp,+,=[1],pc,1,+,0xfe,sp,+,=[2],3,sp,-=,0xfffe,[2],pc,=\");\n\t\tbreak;\n\n\t// FLAGS\n\tcase 0x78: // sei\n\tcase 0x58: // cli\n\tcase 0x38: // sec\n\tcase 0x18: // clc\n\tcase 0xf8: // sed\n\tcase 0xd8: // cld\n\tcase 0xb8: // clv\n\t\top->cycles = 2;\n\t\t// FIXME: what opcode for this?\n\t\top->type = R_ANAL_OP_TYPE_NOP;\n\t\t_6502_anal_esil_flags (op, data[0]);\n\t\tbreak;\n\t// BIT\n\tcase 0x24: // bit $ff\n\tcase 0x2c: // bit $ffff\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tr_strbuf_setf (&op->esil, \"a,%s,[1],&,0x80,&,!,!,N,=,a,%s,[1],&,0x40,&,!,!,V,=,a,%s,[1],&,0xff,&,!,Z,=\",addrbuf, addrbuf, addrbuf);\n\t\tbreak;\n\t// ADC\n\tcase 0x69: // adc #$ff\n\tcase 0x65: // adc $ff\n\tcase 0x75: // adc $ff,x\n\tcase 0x6d: // adc $ffff\n\tcase 0x7d: // adc $ffff,x\n\tcase 0x79: // adc $ffff,y\n\tcase 0x61: // adc ($ff,x)\n\tcase 0x71: // adc ($ff,y)\n\t\t// FIXME: update V\n\t\t// FIXME: support BCD mode\n\t\top->type = R_ANAL_OP_TYPE_ADD;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x69) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,+=,C,NUM,$c7,C,=,a,+=,$c7,C,|=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,+=,C,NUM,$c7,C,=,a,+=,$c7,C,|=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\t// fix Z\n\t\tr_strbuf_append (&op->esil, \",a,a,=,$z,Z,=\");\n\t\tbreak;\n\t// SBC\n\tcase 0xe9: // sbc #$ff\n\tcase 0xe5: // sbc $ff\n\tcase 0xf5: // sbc $ff,x\n\tcase 0xed: // sbc $ffff\n\tcase 0xfd: // sbc $ffff,x\n\tcase 0xf9: // sbc $ffff,y\n\tcase 0xe1: // sbc ($ff,x)\n\tcase 0xf1: // sbc ($ff,y)\n\t\t// FIXME: update V\n\t\t// FIXME: support BCD mode\n\t\top->type = R_ANAL_OP_TYPE_SUB;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xe9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"C,!,%s,+,a,-=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"C,!,%s,[1],+,a,-=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// fix Z and revert C\n\t\tr_strbuf_append (&op->esil, \",a,a,=,$z,Z,=,C,!=\");\n\t\tbreak;\n\t// ORA\n\tcase 0x09: // ora #$ff\n\tcase 0x05: // ora $ff\n\tcase 0x15: // ora $ff,x\n\tcase 0x0d: // ora $ffff\n\tcase 0x1d: // ora $ffff,x\n\tcase 0x19: // ora $ffff,y\n\tcase 0x01: // ora ($ff,x)\n\tcase 0x11: // ora ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_OR;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x09) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,|=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,|=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// AND\n\tcase 0x29: // and #$ff\n\tcase 0x25: // and $ff\n\tcase 0x35: // and $ff,x\n\tcase 0x2d: // and $ffff\n\tcase 0x3d: // and $ffff,x\n\tcase 0x39: // and $ffff,y\n\tcase 0x21: // and ($ff,x)\n\tcase 0x31: // and ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_AND;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x29) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,&=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,&=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// EOR\n\tcase 0x49: // eor #$ff\n\tcase 0x45: // eor $ff\n\tcase 0x55: // eor $ff,x\n\tcase 0x4d: // eor $ffff\n\tcase 0x5d: // eor $ffff,x\n\tcase 0x59: // eor $ffff,y\n\tcase 0x41: // eor ($ff,x)\n\tcase 0x51: // eor ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_XOR;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x49) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,^=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,^=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ASL\n\tcase 0x0a: // asl a\n\tcase 0x06: // asl $ff\n\tcase 0x16: // asl $ff,x\n\tcase 0x0e: // asl $ffff\n\tcase 0x1e: // asl $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_SHL;\n\t\tif (data[0] == 0x0a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,<<=,$c7,C,=,a,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],<<,%s,=[1],$c7,C,=\", addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LSR\n\tcase 0x4a: // lsr a\n\tcase 0x46: // lsr $ff\n\tcase 0x56: // lsr $ff,x\n\tcase 0x4e: // lsr $ffff\n\tcase 0x5e: // lsr $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_SHR;\n\t\tif (data[0] == 0x4a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,&,C,=,1,a,>>=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],&,C,=,1,%s,[1],>>,%s,=[1]\", addrbuf, addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ROL\n\tcase 0x2a: // rol a\n\tcase 0x26: // rol $ff\n\tcase 0x36: // rol $ff,x\n\tcase 0x2e: // rol $ffff\n\tcase 0x3e: // rol $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_ROL;\n\t\tif (data[0] == 0x2a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,<<,C,|,a,=,$c7,C,=,a,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],<<,C,|,%s,=[1],$c7,C,=\", addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ROR\n\tcase 0x6a: // ror a\n\tcase 0x66: // ror $ff\n\tcase 0x76: // ror $ff,x\n\tcase 0x6e: // ror $ffff\n\tcase 0x7e: // ror $ffff,x\n\t\t// uses N as temporary to hold C value. but in fact,\n\t\t// it is not temporary since in all ROR ops, N will have the value of C\n\t\top->type = R_ANAL_OP_TYPE_ROR;\n\t\tif (data[0] == 0x6a) {\n\t\t\tr_strbuf_set (&op->esil, \"C,N,=,1,a,&,C,=,1,a,>>,7,N,<<,|,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"C,N,=,1,%s,[1],&,C,=,1,%s,[1],>>,7,N,<<,|,%s,=[1]\", addrbuf, addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// INC\n\tcase 0xe6: // inc $ff\n\tcase 0xf6: // inc $ff,x\n\tcase 0xee: // inc $ffff\n\tcase 0xfe: // inc $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"%s,++=[1]\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// DEC\n\tcase 0xc6: // dec $ff\n\tcase 0xd6: // dec $ff,x\n\tcase 0xce: // dec $ffff\n\tcase 0xde: // dec $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"%s,--=[1]\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// INX, INY\n\tcase 0xe8: // inx\n\tcase 0xc8: // iny\n\t\top->cycles = 2;\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_inc_reg (op, data[0], \"+\");\n\t\tbreak;\n\t// DEX, DEY\n\tcase 0xca: // dex\n\tcase 0x88: // dey\n\t\top->cycles = 2;\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_inc_reg (op, data[0], \"-\");\n\t\tbreak;\n\t// CMP\n\tcase 0xc9: // cmp #$ff\n\tcase 0xc5: // cmp $ff\n\tcase 0xd5: // cmp $ff,x\n\tcase 0xcd: // cmp $ffff\n\tcase 0xdd: // cmp $ffff,x\n\tcase 0xd9: // cmp $ffff,y\n\tcase 0xc1: // cmp ($ff,x)\n\tcase 0xd1: // cmp ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xc9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// CPX\n\tcase 0xe0: // cpx #$ff\n\tcase 0xe4: // cpx $ff\n\tcase 0xec: // cpx $ffff\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tif (data[0] == 0xe0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,x,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],x,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// CPY\n\tcase 0xc0: // cpy #$ff\n\tcase 0xc4: // cpy $ff\n\tcase 0xcc: // cpy $ffff\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tif (data[0] == 0xc0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,y,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],y,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// BRANCHES\n\tcase 0x10: // bpl $ffff\n\tcase 0x30: // bmi $ffff\n\tcase 0x50: // bvc $ffff\n\tcase 0x70: // bvs $ffff\n\tcase 0x90: // bcc $ffff\n\tcase 0xb0: // bcs $ffff\n\tcase 0xd0: // bne $ffff\n\tcase 0xf0: // beq $ffff\n\t\t// FIXME: Add 1 if branch occurs to same page.\n\t\t// FIXME: Add 2 if branch occurs to different page\n\t\top->cycles = 2;\n\t\top->failcycles = 3;\n\t\top->type = R_ANAL_OP_TYPE_CJMP;\n\t\tif (data[1] <= 127)\n\t\t\top->jump = addr + data[1] + op->size;\n\t\telse\top->jump = addr - (256 - data[1]) + op->size;\n\t\top->fail = addr + op->size;\n\t\t// FIXME: add a type of conditional\n\t\t// op->cond = R_ANAL_COND_LE;\n\t\t_6502_anal_esil_ccall (op, data[0]);\n\t\tbreak;\n\t// JSR\n\tcase 0x20: // jsr $ffff\n\t\top->cycles = 6;\n\t\top->type = R_ANAL_OP_TYPE_CALL;\n\t\top->jump = data[1] | data[2] << 8;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = 2;\n\t\t// JSR pushes the address-1 of the next operation on to the stack before transferring program\n\t\t// control to the following address\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_setf (&op->esil, \"1,pc,-,0xff,sp,+,=[2],0x%04x,pc,=,2,sp,-=\", op->jump);\n\t\tbreak;\n\t// JMP\n\tcase 0x4c: // jmp $ffff\n\t\top->cycles = 3;\n\t\top->type = R_ANAL_OP_TYPE_JMP;\n\t\top->jump = data[1] | data[2] << 8;\n\t\tr_strbuf_setf (&op->esil, \"0x%04x,pc,=\", op->jump);\n\t\tbreak;\n\tcase 0x6c: // jmp ($ffff)\n\t\top->cycles = 5;\n\t\top->type = R_ANAL_OP_TYPE_UJMP;\n\t\t// FIXME: how to read memory?\n\t\t// op->jump = data[1] | data[2] << 8;\n\t\tr_strbuf_setf (&op->esil, \"0x%04x,[2],pc,=\", data[1] | data[2] << 8);\n\t\tbreak;\n\t// RTS\n\tcase 0x60: // rts\n\t\top->eob = true;\n\t\top->type = R_ANAL_OP_TYPE_RET;\n\t\top->cycles = 6;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -2;\n\t\t// Operation: PC from Stack, PC + 1 -> PC\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_set (&op->esil, \"0x101,sp,+,[2],pc,=,pc,++=,2,sp,+=\");\n\t\tbreak;\n\t// RTI\n\tcase 0x40: // rti\n\t\top->eob = true;\n\t\top->type = R_ANAL_OP_TYPE_RET;\n\t\top->cycles = 6;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -3;\n\t\t// Operation: P from Stack, PC from Stack\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_set (&op->esil, \"0x101,sp,+,[1],flags,=,0x102,sp,+,[2],pc,=,3,sp,+=\");\n\t\tbreak;\n\t// NOP\n\tcase 0xea: // nop\n\t\top->type = R_ANAL_OP_TYPE_NOP;\n\t\top->cycles = 2;\n\t\tbreak;\n\t// LDA\n\tcase 0xa9: // lda #$ff\n\tcase 0xa5: // lda $ff\n\tcase 0xb5: // lda $ff,x\n\tcase 0xad: // lda $ffff\n\tcase 0xbd: // lda $ffff,x\n\tcase 0xb9: // lda $ffff,y\n\tcase 0xa1: // lda ($ff,x)\n\tcase 0xb1: // lda ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xa9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LDX\n\tcase 0xa2: // ldx #$ff\n\tcase 0xa6: // ldx $ff\n\tcase 0xb6: // ldx $ff,y\n\tcase 0xae: // ldx $ffff\n\tcase 0xbe: // ldx $ffff,y\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'y');\n\t\tif (data[0] == 0xa2) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,x,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],x,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LDY\n\tcase 0xa0: // ldy #$ff\n\tcase 0xa4: // ldy $ff\n\tcase 0xb4: // ldy $ff,x\n\tcase 0xac: // ldy $ffff\n\tcase 0xbc: // ldy $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 'x');\n\t\tif (data[0] == 0xa0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,y,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],y,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// STA\n\tcase 0x85: // sta $ff\n\tcase 0x95: // sta $ff,x\n\tcase 0x8d: // sta $ffff\n\tcase 0x9d: // sta $ffff,x\n\tcase 0x99: // sta $ffff,y\n\tcase 0x81: // sta ($ff,x)\n\tcase 0x91: // sta ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tr_strbuf_setf (&op->esil, \"a,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// STX\n\tcase 0x86: // stx $ff\n\tcase 0x96: // stx $ff,y\n\tcase 0x8e: // stx $ffff\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'y');\n\t\tr_strbuf_setf (&op->esil, \"x,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// STY\n\tcase 0x84: // sty $ff\n\tcase 0x94: // sty $ff,x\n\tcase 0x8c: // sty $ffff\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"y,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// PHP/PHA\n\tcase 0x08: // php\n\tcase 0x48: // pha\n\t\top->type = R_ANAL_OP_TYPE_PUSH;\n\t\top->cycles = 3;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = 1;\n\t\t_6502_anal_esil_push (op, data[0]);\n\t\tbreak;\n\t// PLP,PLA\n\tcase 0x28: // plp\n\tcase 0x68: // plp\n\t\top->type = R_ANAL_OP_TYPE_POP;\n\t\top->cycles = 4;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -1;\n\t\t_6502_anal_esil_pop (op, data[0]);\n\t\tbreak;\n\t// TAX,TYA,...\n\tcase 0xaa: // tax\n\tcase 0x8a: // txa\n\tcase 0xa8: // tay\n\tcase 0x98: // tya\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\tcase 0x9a: // txs\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\top->stackop = R_ANAL_STACK_SET;\n\t\t// FIXME: should I get register X a place it here?\n\t\t// op->stackptr = get_register_x();\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\tcase 0xba: // tsx\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\top->stackop = R_ANAL_STACK_GET;\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\t}\n\treturn op->size;\n}","target":"static int _6502_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tchar addrbuf[64];\n\tconst int buffsize = sizeof (addrbuf) - 1;\n\n\tmemset (op, '\\0', sizeof (RAnalOp));\n\top->size = snes_op_get_size (1, 1, &snes_op[data[0]]);\t//snes-arch is similiar to nes/6502\n\top->addr = addr;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->id = data[0];\n\tr_strbuf_init (&op->esil);\n\tswitch (data[0]) {\n\tcase 0x02:\n\tcase 0x03:\n\tcase 0x04:\n\tcase 0x07:\n\tcase 0x0b:\n\tcase 0x0c:\n\tcase 0x0f:\n\tcase 0x12:\n\tcase 0x13:\n\tcase 0x14:\n\tcase 0x17:\n\tcase 0x1a:\n\tcase 0x1b:\n\tcase 0x1c:\n\tcase 0x1f:\n\tcase 0x22:\n\tcase 0x23:\n\tcase 0x27:\n\tcase 0x2b:\n\tcase 0x2f:\n\tcase 0x32:\n\tcase 0x33:\n\tcase 0x34:\n\tcase 0x37:\n\tcase 0x3a:\n\tcase 0x3b:\n\tcase 0x3c:\n\tcase 0x3f:\n\tcase 0x42:\n\tcase 0x43:\n\tcase 0x44:\n\tcase 0x47:\n\tcase 0x4b:\n\tcase 0x4f:\n\tcase 0x52:\n\tcase 0x53:\n\tcase 0x54:\n\tcase 0x57:\n\tcase 0x5a:\n\tcase 0x5b:\n\tcase 0x5c:\n\tcase 0x5f:\n\tcase 0x62:\n\tcase 0x63:\n\tcase 0x64:\n\tcase 0x67:\n\tcase 0x6b:\n\tcase 0x6f:\n\tcase 0x72:\n\tcase 0x73:\n\tcase 0x74:\n\tcase 0x77:\n\tcase 0x7a:\n\tcase 0x7b:\n\tcase 0x7c:\n\tcase 0x7f:\n\tcase 0x80:\n\tcase 0x82:\n\tcase 0x83:\n\tcase 0x87:\n\tcase 0x89:\n\tcase 0x8b:\n\tcase 0x8f:\n\tcase 0x92:\n\tcase 0x93:\n\tcase 0x97:\n\tcase 0x9b:\n\tcase 0x9c:\n\tcase 0x9e:\n\tcase 0x9f:\n\tcase 0xa3:\n\tcase 0xa7:\n\tcase 0xab:\n\tcase 0xaf:\n\tcase 0xb2:\n\tcase 0xb3:\n\tcase 0xb7:\n\tcase 0xbb:\n\tcase 0xbf:\n\tcase 0xc2:\n\tcase 0xc3:\n\tcase 0xc7:\n\tcase 0xcb:\n\tcase 0xcf:\n\tcase 0xd2:\n\tcase 0xd3:\n\tcase 0xd4:\n\tcase 0xd7:\n\tcase 0xda:\n\tcase 0xdb:\n\tcase 0xdc:\n\tcase 0xdf:\n\tcase 0xe2:\n\tcase 0xe3:\n\tcase 0xe7:\n\tcase 0xeb:\n\tcase 0xef:\n\tcase 0xf2:\n\tcase 0xf3:\n\tcase 0xf4:\n\tcase 0xf7:\n\tcase 0xfa:\n\tcase 0xfb:\n\tcase 0xfc:\n\tcase 0xff:\n\t\t// undocumented or not-implemented opcodes for 6502.\n\t\t// some of them might be implemented in 65816\n\t\top->size = 1;\n\t\top->type = R_ANAL_OP_TYPE_ILL;\n\t\tbreak;\n\n\t// BRK\n\tcase 0x00: // brk\n\t\top->cycles = 7;\n\t\top->type = R_ANAL_OP_TYPE_SWI;\n\t\t// override 65816 code which seems to be wrong: size is 1, but pc = pc + 2\n\t\top->size = 1;\n\t\t// PC + 2 to Stack, P to Stack B=1 D=0 I=1. \"B\" is not a flag. Only its bit is pushed on the stack\n\t\t// PC was already incremented by one at this point. Needs to incremented once more\n\t\t// New PC is Interrupt Vector: $fffe. (FIXME: Confirm this is valid for all 6502)\n\t\tr_strbuf_set (&op->esil, \",1,I,=,0,D,=,flags,0x10,|,0x100,sp,+,=[1],pc,1,+,0xfe,sp,+,=[2],3,sp,-=,0xfffe,[2],pc,=\");\n\t\tbreak;\n\n\t// FLAGS\n\tcase 0x78: // sei\n\tcase 0x58: // cli\n\tcase 0x38: // sec\n\tcase 0x18: // clc\n\tcase 0xf8: // sed\n\tcase 0xd8: // cld\n\tcase 0xb8: // clv\n\t\top->cycles = 2;\n\t\t// FIXME: what opcode for this?\n\t\top->type = R_ANAL_OP_TYPE_NOP;\n\t\t_6502_anal_esil_flags (op, data[0]);\n\t\tbreak;\n\t// BIT\n\tcase 0x24: // bit $ff\n\tcase 0x2c: // bit $ffff\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tr_strbuf_setf (&op->esil, \"a,%s,[1],&,0x80,&,!,!,N,=,a,%s,[1],&,0x40,&,!,!,V,=,a,%s,[1],&,0xff,&,!,Z,=\",addrbuf, addrbuf, addrbuf);\n\t\tbreak;\n\t// ADC\n\tcase 0x69: // adc #$ff\n\tcase 0x65: // adc $ff\n\tcase 0x75: // adc $ff,x\n\tcase 0x6d: // adc $ffff\n\tcase 0x7d: // adc $ffff,x\n\tcase 0x79: // adc $ffff,y\n\tcase 0x61: // adc ($ff,x)\n\tcase 0x71: // adc ($ff,y)\n\t\t// FIXME: update V\n\t\t// FIXME: support BCD mode\n\t\top->type = R_ANAL_OP_TYPE_ADD;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x69) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,+=,C,NUM,$c7,C,=,a,+=,$c7,C,|=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,+=,C,NUM,$c7,C,=,a,+=,$c7,C,|=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\t// fix Z\n\t\tr_strbuf_append (&op->esil, \",a,a,=,$z,Z,=\");\n\t\tbreak;\n\t// SBC\n\tcase 0xe9: // sbc #$ff\n\tcase 0xe5: // sbc $ff\n\tcase 0xf5: // sbc $ff,x\n\tcase 0xed: // sbc $ffff\n\tcase 0xfd: // sbc $ffff,x\n\tcase 0xf9: // sbc $ffff,y\n\tcase 0xe1: // sbc ($ff,x)\n\tcase 0xf1: // sbc ($ff,y)\n\t\t// FIXME: update V\n\t\t// FIXME: support BCD mode\n\t\top->type = R_ANAL_OP_TYPE_SUB;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xe9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"C,!,%s,+,a,-=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"C,!,%s,[1],+,a,-=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// fix Z and revert C\n\t\tr_strbuf_append (&op->esil, \",a,a,=,$z,Z,=,C,!=\");\n\t\tbreak;\n\t// ORA\n\tcase 0x09: // ora #$ff\n\tcase 0x05: // ora $ff\n\tcase 0x15: // ora $ff,x\n\tcase 0x0d: // ora $ffff\n\tcase 0x1d: // ora $ffff,x\n\tcase 0x19: // ora $ffff,y\n\tcase 0x01: // ora ($ff,x)\n\tcase 0x11: // ora ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_OR;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x09) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,|=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,|=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// AND\n\tcase 0x29: // and #$ff\n\tcase 0x25: // and $ff\n\tcase 0x35: // and $ff,x\n\tcase 0x2d: // and $ffff\n\tcase 0x3d: // and $ffff,x\n\tcase 0x39: // and $ffff,y\n\tcase 0x21: // and ($ff,x)\n\tcase 0x31: // and ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_AND;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x29) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,&=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,&=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// EOR\n\tcase 0x49: // eor #$ff\n\tcase 0x45: // eor $ff\n\tcase 0x55: // eor $ff,x\n\tcase 0x4d: // eor $ffff\n\tcase 0x5d: // eor $ffff,x\n\tcase 0x59: // eor $ffff,y\n\tcase 0x41: // eor ($ff,x)\n\tcase 0x51: // eor ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_XOR;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0x49) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,^=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,^=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ASL\n\tcase 0x0a: // asl a\n\tcase 0x06: // asl $ff\n\tcase 0x16: // asl $ff,x\n\tcase 0x0e: // asl $ffff\n\tcase 0x1e: // asl $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_SHL;\n\t\tif (data[0] == 0x0a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,<<=,$c7,C,=,a,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],<<,%s,=[1],$c7,C,=\", addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LSR\n\tcase 0x4a: // lsr a\n\tcase 0x46: // lsr $ff\n\tcase 0x56: // lsr $ff,x\n\tcase 0x4e: // lsr $ffff\n\tcase 0x5e: // lsr $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_SHR;\n\t\tif (data[0] == 0x4a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,&,C,=,1,a,>>=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],&,C,=,1,%s,[1],>>,%s,=[1]\", addrbuf, addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ROL\n\tcase 0x2a: // rol a\n\tcase 0x26: // rol $ff\n\tcase 0x36: // rol $ff,x\n\tcase 0x2e: // rol $ffff\n\tcase 0x3e: // rol $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_ROL;\n\t\tif (data[0] == 0x2a) {\n\t\t\tr_strbuf_set (&op->esil, \"1,a,<<,C,|,a,=,$c7,C,=,a,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"1,%s,[1],<<,C,|,%s,=[1],$c7,C,=\", addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// ROR\n\tcase 0x6a: // ror a\n\tcase 0x66: // ror $ff\n\tcase 0x76: // ror $ff,x\n\tcase 0x6e: // ror $ffff\n\tcase 0x7e: // ror $ffff,x\n\t\t// uses N as temporary to hold C value. but in fact,\n\t\t// it is not temporary since in all ROR ops, N will have the value of C\n\t\top->type = R_ANAL_OP_TYPE_ROR;\n\t\tif (data[0] == 0x6a) {\n\t\t\tr_strbuf_set (&op->esil, \"C,N,=,1,a,&,C,=,1,a,>>,7,N,<<,|,a,=\");\n\t\t} else {\n\t\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\t\tr_strbuf_setf (&op->esil, \"C,N,=,1,%s,[1],&,C,=,1,%s,[1],>>,7,N,<<,|,%s,=[1]\", addrbuf, addrbuf, addrbuf);\n\t\t}\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// INC\n\tcase 0xe6: // inc $ff\n\tcase 0xf6: // inc $ff,x\n\tcase 0xee: // inc $ffff\n\tcase 0xfe: // inc $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"%s,++=[1]\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// DEC\n\tcase 0xc6: // dec $ff\n\tcase 0xd6: // dec $ff,x\n\tcase 0xce: // dec $ffff\n\tcase 0xde: // dec $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"%s,--=[1]\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// INX, INY\n\tcase 0xe8: // inx\n\tcase 0xc8: // iny\n\t\top->cycles = 2;\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_inc_reg (op, data[0], \"+\");\n\t\tbreak;\n\t// DEX, DEY\n\tcase 0xca: // dex\n\tcase 0x88: // dey\n\t\top->cycles = 2;\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_inc_reg (op, data[0], \"-\");\n\t\tbreak;\n\t// CMP\n\tcase 0xc9: // cmp #$ff\n\tcase 0xc5: // cmp $ff\n\tcase 0xd5: // cmp $ff,x\n\tcase 0xcd: // cmp $ffff\n\tcase 0xdd: // cmp $ffff,x\n\tcase 0xd9: // cmp $ffff,y\n\tcase 0xc1: // cmp ($ff,x)\n\tcase 0xd1: // cmp ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xc9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// CPX\n\tcase 0xe0: // cpx #$ff\n\tcase 0xe4: // cpx $ff\n\tcase 0xec: // cpx $ffff\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tif (data[0] == 0xe0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,x,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],x,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// CPY\n\tcase 0xc0: // cpy #$ff\n\tcase 0xc4: // cpy $ff\n\tcase 0xcc: // cpy $ffff\n\t\top->type = R_ANAL_OP_TYPE_CMP;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 0);\n\t\tif (data[0] == 0xc0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,y,==\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],y,==\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_BNZ);\n\t\t// invert C, since C=1 when A-M >= 0\n\t\tr_strbuf_append (&op->esil, \",C,!,C,=\");\n\t\tbreak;\n\t// BRANCHES\n\tcase 0x10: // bpl $ffff\n\tcase 0x30: // bmi $ffff\n\tcase 0x50: // bvc $ffff\n\tcase 0x70: // bvs $ffff\n\tcase 0x90: // bcc $ffff\n\tcase 0xb0: // bcs $ffff\n\tcase 0xd0: // bne $ffff\n\tcase 0xf0: // beq $ffff\n\t\t// FIXME: Add 1 if branch occurs to same page.\n\t\t// FIXME: Add 2 if branch occurs to different page\n\t\top->cycles = 2;\n\t\top->failcycles = 3;\n\t\top->type = R_ANAL_OP_TYPE_CJMP;\n\t\tif (len > 1) {\n\t\t\tif (data[1] <= 127) {\n\t\t\t\top->jump = addr + data[1] + op->size;\n\t\t\t} else {\n\t\t\t\top->jump = addr - (256 - data[1]) + op->size;\n\t\t\t}\n\t\t} else {\n\t\t\top->jump = addr;\n\t\t}\n\t\top->fail = addr + op->size;\n\t\t// FIXME: add a type of conditional\n\t\t// op->cond = R_ANAL_COND_LE;\n\t\t_6502_anal_esil_ccall (op, data[0]);\n\t\tbreak;\n\t// JSR\n\tcase 0x20: // jsr $ffff\n\t\top->cycles = 6;\n\t\top->type = R_ANAL_OP_TYPE_CALL;\n\t\top->jump = data[1] | data[2] << 8;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = 2;\n\t\t// JSR pushes the address-1 of the next operation on to the stack before transferring program\n\t\t// control to the following address\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_setf (&op->esil, \"1,pc,-,0xff,sp,+,=[2],0x%04x,pc,=,2,sp,-=\", op->jump);\n\t\tbreak;\n\t// JMP\n\tcase 0x4c: // jmp $ffff\n\t\top->cycles = 3;\n\t\top->type = R_ANAL_OP_TYPE_JMP;\n\t\top->jump = data[1] | data[2] << 8;\n\t\tr_strbuf_setf (&op->esil, \"0x%04x,pc,=\", op->jump);\n\t\tbreak;\n\tcase 0x6c: // jmp ($ffff)\n\t\top->cycles = 5;\n\t\top->type = R_ANAL_OP_TYPE_UJMP;\n\t\t// FIXME: how to read memory?\n\t\t// op->jump = data[1] | data[2] << 8;\n\t\tr_strbuf_setf (&op->esil, \"0x%04x,[2],pc,=\", data[1] | data[2] << 8);\n\t\tbreak;\n\t// RTS\n\tcase 0x60: // rts\n\t\top->eob = true;\n\t\top->type = R_ANAL_OP_TYPE_RET;\n\t\top->cycles = 6;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -2;\n\t\t// Operation: PC from Stack, PC + 1 -> PC\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_set (&op->esil, \"0x101,sp,+,[2],pc,=,pc,++=,2,sp,+=\");\n\t\tbreak;\n\t// RTI\n\tcase 0x40: // rti\n\t\top->eob = true;\n\t\top->type = R_ANAL_OP_TYPE_RET;\n\t\top->cycles = 6;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -3;\n\t\t// Operation: P from Stack, PC from Stack\n\t\t// stack is on page one and sp is an 8-bit reg: operations must be done like: sp + 0x100\n\t\tr_strbuf_set (&op->esil, \"0x101,sp,+,[1],flags,=,0x102,sp,+,[2],pc,=,3,sp,+=\");\n\t\tbreak;\n\t// NOP\n\tcase 0xea: // nop\n\t\top->type = R_ANAL_OP_TYPE_NOP;\n\t\top->cycles = 2;\n\t\tbreak;\n\t// LDA\n\tcase 0xa9: // lda #$ff\n\tcase 0xa5: // lda $ff\n\tcase 0xb5: // lda $ff,x\n\tcase 0xad: // lda $ffff\n\tcase 0xbd: // lda $ffff,x\n\tcase 0xb9: // lda $ffff,y\n\tcase 0xa1: // lda ($ff,x)\n\tcase 0xb1: // lda ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tif (data[0] == 0xa9) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,a,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],a,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LDX\n\tcase 0xa2: // ldx #$ff\n\tcase 0xa6: // ldx $ff\n\tcase 0xb6: // ldx $ff,y\n\tcase 0xae: // ldx $ffff\n\tcase 0xbe: // ldx $ffff,y\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'y');\n\t\tif (data[0] == 0xa2) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,x,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],x,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// LDY\n\tcase 0xa0: // ldy #$ff\n\tcase 0xa4: // ldy $ff\n\tcase 0xb4: // ldy $ff,x\n\tcase 0xac: // ldy $ffff\n\tcase 0xbc: // ldy $ffff,x\n\t\top->type = R_ANAL_OP_TYPE_LOAD;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 'x');\n\t\tif (data[0] == 0xa0) // immediate mode\n\t\t\tr_strbuf_setf (&op->esil, \"%s,y,=\", addrbuf);\n\t\telse\tr_strbuf_setf (&op->esil, \"%s,[1],y,=\", addrbuf);\n\t\t_6502_anal_update_flags (op, _6502_FLAGS_NZ);\n\t\tbreak;\n\t// STA\n\tcase 0x85: // sta $ff\n\tcase 0x95: // sta $ff,x\n\tcase 0x8d: // sta $ffff\n\tcase 0x9d: // sta $ffff,x\n\tcase 0x99: // sta $ffff,y\n\tcase 0x81: // sta ($ff,x)\n\tcase 0x91: // sta ($ff),y\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern1 (op, data, addrbuf, buffsize);\n\t\tr_strbuf_setf (&op->esil, \"a,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// STX\n\tcase 0x86: // stx $ff\n\tcase 0x96: // stx $ff,y\n\tcase 0x8e: // stx $ffff\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern2 (op, data, addrbuf, buffsize, 'y');\n\t\tr_strbuf_setf (&op->esil, \"x,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// STY\n\tcase 0x84: // sty $ff\n\tcase 0x94: // sty $ff,x\n\tcase 0x8c: // sty $ffff\n\t\top->type = R_ANAL_OP_TYPE_STORE;\n\t\t_6502_anal_esil_get_addr_pattern3 (op, data, addrbuf, buffsize, 'x');\n\t\tr_strbuf_setf (&op->esil, \"y,%s,=[1]\", addrbuf);\n\t\tbreak;\n\t// PHP/PHA\n\tcase 0x08: // php\n\tcase 0x48: // pha\n\t\top->type = R_ANAL_OP_TYPE_PUSH;\n\t\top->cycles = 3;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = 1;\n\t\t_6502_anal_esil_push (op, data[0]);\n\t\tbreak;\n\t// PLP,PLA\n\tcase 0x28: // plp\n\tcase 0x68: // plp\n\t\top->type = R_ANAL_OP_TYPE_POP;\n\t\top->cycles = 4;\n\t\top->stackop = R_ANAL_STACK_INC;\n\t\top->stackptr = -1;\n\t\t_6502_anal_esil_pop (op, data[0]);\n\t\tbreak;\n\t// TAX,TYA,...\n\tcase 0xaa: // tax\n\tcase 0x8a: // txa\n\tcase 0xa8: // tay\n\tcase 0x98: // tya\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\tcase 0x9a: // txs\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\top->stackop = R_ANAL_STACK_SET;\n\t\t// FIXME: should I get register X a place it here?\n\t\t// op->stackptr = get_register_x();\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\tcase 0xba: // tsx\n\t\top->type = R_ANAL_OP_TYPE_MOV;\n\t\top->cycles = 2;\n\t\top->stackop = R_ANAL_STACK_GET;\n\t\t_6502_anal_esil_mov (op, data[0]);\n\t\tbreak;\n\t}\n\treturn op->size;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"_6502_op","file_name":"libr/anal/p/anal_6502.c","commit_link":"github.com/radare/radare2/commit/bbb4af56003c1afdad67af0c4339267ca38b1017","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#66-22f1603b5254","input":"static int string_scan_range(RList *list, RBinFile *bf, int min,\n\t\t\t const ut64 from, const ut64 to, int type) {\n\tut8 tmp[R_STRING_SCAN_BUFFER_SIZE];\n\tut64 str_start, needle = from;\n\tint count = 0, i, rc, runes;\n\tint str_type = R_STRING_TYPE_DETECT;\n\n\tif (type == -1) {\n\t\ttype = R_STRING_TYPE_DETECT;\n\t}\n\tif (from >= to) {\n\t\teprintf (\"Invalid range to find strings 0x%llx .. 0x%llx\\n\", from, to);\n\t\treturn -1;\n\t}\n\tut8 *buf = calloc (to - from, 1);\n\tif (!buf || !min) {\n\t\treturn -1;\n\t}\n\tr_buf_read_at (bf->buf, from, buf, to - from);\n\t// may oobread\n\twhile (needle < to) {\n\t\trc = r_utf8_decode (buf + needle - from, to - needle, NULL);\n\t\tif (!rc) {\n\t\t\tneedle++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (type == R_STRING_TYPE_DETECT) {\n\t\t\tchar *w = (char *)buf + needle + rc - from;\n\t\t\tif ((to - needle) > 5) {\n\t\t\t\tbool is_wide32 = needle + rc + 2 < to && !w[0] && !w[1] && !w[2] && w[3] && !w[4];\n\t\t\t\tif (is_wide32) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_WIDE32;\n\t\t\t\t} else {\n\t\t\t\t\tbool is_wide = needle + rc + 2 < to && !w[0] && w[1] && !w[2];\n\t\t\t\t\tstr_type = is_wide? R_STRING_TYPE_WIDE: R_STRING_TYPE_ASCII;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr_type = R_STRING_TYPE_ASCII;\n\t\t\t}\n\t\t} else {\n\t\t\tstr_type = type;\n\t\t}\n\t\trunes = 0;\n\t\tstr_start = needle;\n\n\t\t/* Eat a whole C string */\n\t\tfor (rc = i = 0; i < sizeof (tmp) - 3 && needle < to; i += rc) {\n\t\t\tRRune r = {0};\n\n\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\trc = r_utf32le_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc) {\n\t\t\t\t\trc = 4;\n\t\t\t\t}\n\t\t\t} else if (str_type == R_STRING_TYPE_WIDE) {\n\t\t\t\trc = r_utf16le_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc == 1) {\n\t\t\t\t\trc = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trc = r_utf8_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc > 1) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_UTF8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Invalid sequence detected */\n\t\t\tif (!rc) {\n\t\t\t\tneedle++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tneedle += rc;\n\n\t\t\tif (r_isprint (r) && r != '\\\\') {\n\t\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\t\tif (r == 0xff) {\n\t\t\t\t\t\tr = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trc = r_utf8_encode (&tmp[i], r);\n\t\t\t\trunes++;\n\t\t\t\t/* Print the escape code */\n\t\t\t} else if (r && r < 0x100 && strchr (\"\\b\\v\\f\\n\\r\\t\\a\\033\\\\\", (char)r)) {\n\t\t\t\tif ((i + 32) < sizeof (tmp) && r < 93) {\n\t\t\t\t\ttmp[i + 0] = '\\\\';\n\t\t\t\t\ttmp[i + 1] = \" abtnvfr e \"\n\t\t\t\t\t \" \"\n\t\t\t\t\t \" \"\n\t\t\t\t\t \" \\\\\"[r];\n\t\t\t\t} else {\n\t\t\t\t\t// string too long\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\trc = 2;\n\t\t\t\trunes++;\n\t\t\t} else {\n\t\t\t\t/* \\0 marks the end of C-strings */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\ttmp[i++] = '\\0';\n\n\t\tif (runes >= min) {\n\t\t\tif (str_type == R_STRING_TYPE_ASCII) {\n\t\t\t\t// reduce false positives\n\t\t\t\tint j;\n\t\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t\t\tchar ch = tmp[j];\n\t\t\t\t\tif (ch != '\\n' && ch != '\\r' && ch != '\\t') {\n\t\t\t\t\t\tif (!IS_PRINTABLE (tmp[j])) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tRBinString *bs = R_NEW0 (RBinString);\n\t\t\tif (!bs) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbs->type = str_type;\n\t\t\tbs->length = runes;\n\t\t\tbs->size = needle - str_start;\n\t\t\tbs->ordinal = count++;\n\t\t\t// TODO: move into adjust_offset\n\t\t\tswitch (str_type) {\n\t\t\tcase R_STRING_TYPE_WIDE:\n\t\t\t\tif (str_start -from> 1) {\n\t\t\t\t\tconst ut8 *p = buf + str_start - 2 - from;\n\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\tstr_start -= 2; // \\xff\\xfe\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase R_STRING_TYPE_WIDE32:\n\t\t\t\tif (str_start -from> 3) {\n\t\t\t\t\tconst ut8 *p = buf + str_start - 4 - from;\n\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\tstr_start -= 4; // \\xff\\xfe\\x00\\x00\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbs->paddr = bs->vaddr = str_start;\n\t\t\tbs->string = r_str_ndup ((const char *)tmp, i);\n\t\t\tif (list) {\n\t\t\t\tr_list_append (list, bs);\n\t\t\t} else {\n\t\t\t\tprint_string (bs, bf);\n\t\t\t\tr_bin_string_free (bs);\n\t\t\t}\n\t\t}\n\t}\n\tfree (buf);\n\treturn count;\n}","target":"static int string_scan_range(RList *list, RBinFile *bf, int min,\n\t\t\t const ut64 from, const ut64 to, int type) {\n\tut8 tmp[R_STRING_SCAN_BUFFER_SIZE];\n\tut64 str_start, needle = from;\n\tint count = 0, i, rc, runes;\n\tint str_type = R_STRING_TYPE_DETECT;\n\n\tif (type == -1) {\n\t\ttype = R_STRING_TYPE_DETECT;\n\t}\n\tif (from >= to) {\n\t\teprintf (\"Invalid range to find strings 0x%llx .. 0x%llx\\n\", from, to);\n\t\treturn -1;\n\t}\n\tint len = to - from;\n\tut8 *buf = calloc (len, 1);\n\tif (!buf || !min) {\n\t\treturn -1;\n\t}\n\tr_buf_read_at (bf->buf, from, buf, len);\n\t// may oobread\n\twhile (needle < to) {\n\t\trc = r_utf8_decode (buf + needle - from, to - needle, NULL);\n\t\tif (!rc) {\n\t\t\tneedle++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (type == R_STRING_TYPE_DETECT) {\n\t\t\tchar *w = (char *)buf + needle + rc - from;\n\t\t\tif ((to - needle) > 5 + rc) {\n\t\t\t\tbool is_wide32 = (needle + rc + 2 < to) && (!w[0] && !w[1] && !w[2] && w[3] && !w[4]);\n\t\t\t\tif (is_wide32) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_WIDE32;\n\t\t\t\t} else {\n\t\t\t\t\tbool is_wide = needle + rc + 2 < to && !w[0] && w[1] && !w[2];\n\t\t\t\t\tstr_type = is_wide? R_STRING_TYPE_WIDE: R_STRING_TYPE_ASCII;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr_type = R_STRING_TYPE_ASCII;\n\t\t\t}\n\t\t} else {\n\t\t\tstr_type = type;\n\t\t}\n\t\trunes = 0;\n\t\tstr_start = needle;\n\n\t\t/* Eat a whole C string */\n\t\tfor (rc = i = 0; i < sizeof (tmp) - 3 && needle < to; i += rc) {\n\t\t\tRRune r = {0};\n\n\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\trc = r_utf32le_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc) {\n\t\t\t\t\trc = 4;\n\t\t\t\t}\n\t\t\t} else if (str_type == R_STRING_TYPE_WIDE) {\n\t\t\t\trc = r_utf16le_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc == 1) {\n\t\t\t\t\trc = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trc = r_utf8_decode (buf + needle - from, to - needle, &r);\n\t\t\t\tif (rc > 1) {\n\t\t\t\t\tstr_type = R_STRING_TYPE_UTF8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Invalid sequence detected */\n\t\t\tif (!rc) {\n\t\t\t\tneedle++;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tneedle += rc;\n\n\t\t\tif (r_isprint (r) && r != '\\\\') {\n\t\t\t\tif (str_type == R_STRING_TYPE_WIDE32) {\n\t\t\t\t\tif (r == 0xff) {\n\t\t\t\t\t\tr = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trc = r_utf8_encode (&tmp[i], r);\n\t\t\t\trunes++;\n\t\t\t\t/* Print the escape code */\n\t\t\t} else if (r && r < 0x100 && strchr (\"\\b\\v\\f\\n\\r\\t\\a\\033\\\\\", (char)r)) {\n\t\t\t\tif ((i + 32) < sizeof (tmp) && r < 93) {\n\t\t\t\t\ttmp[i + 0] = '\\\\';\n\t\t\t\t\ttmp[i + 1] = \" abtnvfr e \"\n\t\t\t\t\t \" \"\n\t\t\t\t\t \" \"\n\t\t\t\t\t \" \\\\\"[r];\n\t\t\t\t} else {\n\t\t\t\t\t// string too long\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\trc = 2;\n\t\t\t\trunes++;\n\t\t\t} else {\n\t\t\t\t/* \\0 marks the end of C-strings */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\ttmp[i++] = '\\0';\n\n\t\tif (runes >= min) {\n\t\t\tif (str_type == R_STRING_TYPE_ASCII) {\n\t\t\t\t// reduce false positives\n\t\t\t\tint j;\n\t\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t\t\tchar ch = tmp[j];\n\t\t\t\t\tif (ch != '\\n' && ch != '\\r' && ch != '\\t') {\n\t\t\t\t\t\tif (!IS_PRINTABLE (tmp[j])) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tRBinString *bs = R_NEW0 (RBinString);\n\t\t\tif (!bs) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbs->type = str_type;\n\t\t\tbs->length = runes;\n\t\t\tbs->size = needle - str_start;\n\t\t\tbs->ordinal = count++;\n\t\t\t// TODO: move into adjust_offset\n\t\t\tswitch (str_type) {\n\t\t\tcase R_STRING_TYPE_WIDE:\n\t\t\t\tif (str_start -from> 1) {\n\t\t\t\t\tconst ut8 *p = buf + str_start - 2 - from;\n\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\tstr_start -= 2; // \\xff\\xfe\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase R_STRING_TYPE_WIDE32:\n\t\t\t\tif (str_start -from> 3) {\n\t\t\t\t\tconst ut8 *p = buf + str_start - 4 - from;\n\t\t\t\t\tif (p[0] == 0xff && p[1] == 0xfe) {\n\t\t\t\t\t\tstr_start -= 4; // \\xff\\xfe\\x00\\x00\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbs->paddr = bs->vaddr = str_start;\n\t\t\tbs->string = r_str_ndup ((const char *)tmp, i);\n\t\t\tif (list) {\n\t\t\t\tr_list_append (list, bs);\n\t\t\t} else {\n\t\t\t\tprint_string (bs, bf);\n\t\t\t\tr_bin_string_free (bs);\n\t\t\t}\n\t\t}\n\t}\n\tfree (buf);\n\treturn count;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"string_scan_range","file_name":"libr/bin/file.c","commit_link":"github.com/radare/radare2/commit/3fcf41ed96ffa25b38029449520c8d0a198745f3","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#67-b7bc4ae65f4b","input":"static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,\n\tstruct dvb_diseqc_master_cmd *d)\n{\n\tstruct cx24116_state *state = fe->demodulator_priv;\n\tint i, ret;\n\n\t/* Dump DiSEqC message */\n\tif (debug) {\n\t\tprintk(KERN_INFO \"cx24116: %s(\", __func__);\n\t\tfor (i = 0 ; i < d->msg_len ;) {\n\t\t\tprintk(KERN_INFO \"0x%02x\", d->msg[i]);\n\t\t\tif (++i < d->msg_len)\n\t\t\t\tprintk(KERN_INFO \", \");\n\t\t}\n\t\tprintk(\") toneburst=%d\\n\", toneburst);\n\t}\n\n\t/* Validate length */\n\tif (d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS))\n\t\treturn -EINVAL;\n\n\t/* DiSEqC message */\n\tfor (i = 0; i < d->msg_len; i++)\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i];\n\n\t/* DiSEqC message length */\n\tstate->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = d->msg_len;\n\n\t/* Command length */\n\tstate->dsec_cmd.len = CX24116_DISEQC_MSGOFS +\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_MSGLEN];\n\n\t/* DiSEqC toneburst */\n\tif (toneburst == CX24116_DISEQC_MESGCACHE)\n\t\t/* Message is cached */\n\t\treturn 0;\n\n\telse if (toneburst == CX24116_DISEQC_TONEOFF)\n\t\t/* Message is sent without burst */\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST] = 0;\n\n\telse if (toneburst == CX24116_DISEQC_TONECACHE) {\n\t\t/*\n\t\t * Message is sent with derived else cached burst\n\t\t *\n\t\t * WRITE PORT GROUP COMMAND 38\n\t\t *\n\t\t * 0/A/A: E0 10 38 F0..F3\n\t\t * 1/B/B: E0 10 38 F4..F7\n\t\t * 2/C/A: E0 10 38 F8..FB\n\t\t * 3/D/B: E0 10 38 FC..FF\n\t\t *\n\t\t * databyte[3]= 8421:8421\n\t\t * ABCD:WXYZ\n\t\t * CLR :SET\n\t\t *\n\t\t * WX= PORT SELECT 0..3 (X=TONEBURST)\n\t\t * Y = VOLTAGE (0=13V, 1=18V)\n\t\t * Z = BAND (0=LOW, 1=HIGH(22K))\n\t\t */\n\t\tif (d->msg_len >= 4 && d->msg[2] == 0x38)\n\t\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST] =\n\t\t\t\t((d->msg[3] & 4) >> 2);\n\t\tif (debug)\n\t\t\tdprintk(\"%s burst=%d\\n\", __func__,\n\t\t\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST]);\n\t}\n\n\t/* Wait for LNB ready */\n\tret = cx24116_wait_for_lnb(fe);\n\tif (ret != 0)\n\t\treturn ret;\n\n\t/* Wait for voltage/min repeat delay */\n\tmsleep(100);\n\n\t/* Command */\n\tret = cx24116_cmd_execute(fe, &state->dsec_cmd);\n\tif (ret != 0)\n\t\treturn ret;\n\t/*\n\t * Wait for send\n\t *\n\t * Eutelsat spec:\n\t * >15ms delay + (XXX determine if FW does this, see set_tone)\n\t * 13.5ms per byte +\n\t * >15ms delay +\n\t * 12.5ms burst +\n\t * >15ms delay (XXX determine if FW does this, see set_tone)\n\t */\n\tmsleep((state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) +\n\t\t((toneburst == CX24116_DISEQC_TONEOFF) ? 30 : 60));\n\n\treturn 0;\n}","target":"static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,\n\tstruct dvb_diseqc_master_cmd *d)\n{\n\tstruct cx24116_state *state = fe->demodulator_priv;\n\tint i, ret;\n\n\t/* Validate length */\n\tif (d->msg_len > sizeof(d->msg))\n return -EINVAL;\n\n\t/* Dump DiSEqC message */\n\tif (debug) {\n\t\tprintk(KERN_INFO \"cx24116: %s(\", __func__);\n\t\tfor (i = 0 ; i < d->msg_len ;) {\n\t\t\tprintk(KERN_INFO \"0x%02x\", d->msg[i]);\n\t\t\tif (++i < d->msg_len)\n\t\t\t\tprintk(KERN_INFO \", \");\n\t\t}\n\t\tprintk(\") toneburst=%d\\n\", toneburst);\n\t}\n\n\t/* DiSEqC message */\n\tfor (i = 0; i < d->msg_len; i++)\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i];\n\n\t/* DiSEqC message length */\n\tstate->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = d->msg_len;\n\n\t/* Command length */\n\tstate->dsec_cmd.len = CX24116_DISEQC_MSGOFS +\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_MSGLEN];\n\n\t/* DiSEqC toneburst */\n\tif (toneburst == CX24116_DISEQC_MESGCACHE)\n\t\t/* Message is cached */\n\t\treturn 0;\n\n\telse if (toneburst == CX24116_DISEQC_TONEOFF)\n\t\t/* Message is sent without burst */\n\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST] = 0;\n\n\telse if (toneburst == CX24116_DISEQC_TONECACHE) {\n\t\t/*\n\t\t * Message is sent with derived else cached burst\n\t\t *\n\t\t * WRITE PORT GROUP COMMAND 38\n\t\t *\n\t\t * 0/A/A: E0 10 38 F0..F3\n\t\t * 1/B/B: E0 10 38 F4..F7\n\t\t * 2/C/A: E0 10 38 F8..FB\n\t\t * 3/D/B: E0 10 38 FC..FF\n\t\t *\n\t\t * databyte[3]= 8421:8421\n\t\t * ABCD:WXYZ\n\t\t * CLR :SET\n\t\t *\n\t\t * WX= PORT SELECT 0..3 (X=TONEBURST)\n\t\t * Y = VOLTAGE (0=13V, 1=18V)\n\t\t * Z = BAND (0=LOW, 1=HIGH(22K))\n\t\t */\n\t\tif (d->msg_len >= 4 && d->msg[2] == 0x38)\n\t\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST] =\n\t\t\t\t((d->msg[3] & 4) >> 2);\n\t\tif (debug)\n\t\t\tdprintk(\"%s burst=%d\\n\", __func__,\n\t\t\t\tstate->dsec_cmd.args[CX24116_DISEQC_BURST]);\n\t}\n\n\t/* Wait for LNB ready */\n\tret = cx24116_wait_for_lnb(fe);\n\tif (ret != 0)\n\t\treturn ret;\n\n\t/* Wait for voltage/min repeat delay */\n\tmsleep(100);\n\n\t/* Command */\n\tret = cx24116_cmd_execute(fe, &state->dsec_cmd);\n\tif (ret != 0)\n\t\treturn ret;\n\t/*\n\t * Wait for send\n\t *\n\t * Eutelsat spec:\n\t * >15ms delay + (XXX determine if FW does this, see set_tone)\n\t * 13.5ms per byte +\n\t * >15ms delay +\n\t * 12.5ms burst +\n\t * >15ms delay (XXX determine if FW does this, see set_tone)\n\t */\n\tmsleep((state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) +\n\t\t((toneburst == CX24116_DISEQC_TONEOFF) ? 30 : 60));\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"cx24116_send_diseqc_msg","file_name":"drivers/media/dvb-frontends/cx24116.c","commit_link":"github.com/torvalds/linux/commit/1fa2337a315a2448c5434f41e00d56b01a22283c","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#68-580aee745a26","input":"void MAPIPrint(MAPIProps *p) {\n int j, i, index, h, x;\n DDWORD *ddword_ptr;\n DDWORD ddword_tmp;\n dtr thedate;\n MAPIProperty *mapi;\n variableLength *mapidata;\n variableLength vlTemp;\n int found;\n\n for (j = 0; j < p->count; j++) {\n mapi = &(p->properties[j]);\n printf(\" #%i: Type: [\", j);\n switch (PROP_TYPE(mapi->id)) {\n case PT_UNSPECIFIED:\n printf(\" NONE \"); break;\n case PT_NULL:\n printf(\" NULL \"); break;\n case PT_I2:\n printf(\" I2 \"); break;\n case PT_LONG:\n printf(\" LONG \"); break;\n case PT_R4:\n printf(\" R4 \"); break;\n case PT_DOUBLE:\n printf(\" DOUBLE \"); break;\n case PT_CURRENCY:\n printf(\"CURRENCY \"); break;\n case PT_APPTIME:\n printf(\"APP TIME \"); break;\n case PT_ERROR:\n printf(\" ERROR \"); break;\n case PT_BOOLEAN:\n printf(\" BOOLEAN \"); break;\n case PT_OBJECT:\n printf(\" OBJECT \"); break;\n case PT_I8:\n printf(\" I8 \"); break;\n case PT_STRING8:\n printf(\" STRING8 \"); break;\n case PT_UNICODE:\n printf(\" UNICODE \"); break;\n case PT_SYSTIME:\n printf(\"SYS TIME \"); break;\n case PT_CLSID:\n printf(\"OLE GUID \"); break;\n case PT_BINARY:\n printf(\" BINARY \"); break;\n default:\n printf(\"<%x>\", PROP_TYPE(mapi->id)); break;\n }\n\n printf(\"] Code: [\");\n if (mapi->custom == 1) {\n printf(\"UD:x%04x\", PROP_ID(mapi->id));\n } else {\n found = 0;\n for (index = 0; index < sizeof(MPList) / sizeof(MAPIPropertyTagList); index++) {\n if ((MPList[index].id == PROP_ID(mapi->id)) && (found == 0)) {\n printf(\"%s\", MPList[index].name);\n found = 1;\n }\n }\n if (found == 0) {\n printf(\"0x%04x\", PROP_ID(mapi->id));\n }\n }\n printf(\"]\\n\");\n if (mapi->namedproperty > 0) {\n for (i = 0; i < mapi->namedproperty; i++) {\n printf(\" Name: %s\\n\", mapi->propnames[i].data);\n }\n }\n for (i = 0; i < mapi->count; i++) {\n mapidata = &(mapi->data[i]);\n if (mapi->count > 1) {\n printf(\" [%i/%u] \", i, mapi->count);\n } else {\n printf(\" \");\n }\n printf(\"Size: %i\", mapidata->size);\n switch (PROP_TYPE(mapi->id)) {\n case PT_SYSTIME:\n MAPISysTimetoDTR(mapidata->data, &thedate);\n printf(\" Value: \");\n ddword_tmp = *((DDWORD *)mapidata->data);\n TNEFPrintDate(thedate);\n printf(\" [HEX: \");\n for (x = 0; x < sizeof(ddword_tmp); x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"] (%llu)\\n\", ddword_tmp);\n break;\n case PT_LONG:\n printf(\" Value: %li\\n\", *((long*)mapidata->data));\n break;\n case PT_I2:\n printf(\" Value: %hi\\n\", *((short int*)mapidata->data));\n break;\n case PT_BOOLEAN:\n if (mapi->data->data[0] != 0) {\n printf(\" Value: True\\n\");\n } else {\n printf(\" Value: False\\n\");\n }\n break;\n case PT_OBJECT:\n printf(\"\\n\");\n break;\n case PT_BINARY:\n if (IsCompressedRTF(mapidata) == 1) {\n printf(\" Detected Compressed RTF. \");\n printf(\"Decompressed text follows\\n\");\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n if ((vlTemp.data = (BYTE*)DecompressRTF(mapidata, &(vlTemp.size))) != NULL) {\n printf(\"%s\\n\", vlTemp.data);\n free(vlTemp.data);\n }\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n } else {\n printf(\" Value: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }\n\n }\n printf(\"]\\n\");\n }\n break;\n case PT_STRING8:\n printf(\" Value: [%s]\\n\", mapidata->data);\n if (strlen((char*)mapidata->data) != mapidata->size - 1) {\n printf(\"Detected Hidden data: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }\n\n }\n printf(\"]\\n\");\n }\n break;\n case PT_CLSID:\n printf(\" Value: \");\n printf(\"[HEX: \");\n for(x=0; x< 16; x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"]\\n\");\n break;\n default:\n printf(\" Value: [%s]\\n\", mapidata->data);\n }\n }\n }\n}","target":"void MAPIPrint(MAPIProps *p) {\n int j, i, index, h, x;\n DDWORD *ddword_ptr;\n DDWORD ddword_tmp;\n dtr thedate;\n MAPIProperty *mapi;\n variableLength *mapidata;\n variableLength vlTemp;\n int found;\n\n for (j = 0; j < p->count; j++) {\n mapi = &(p->properties[j]);\n printf(\" #%i: Type: [\", j);\n switch (PROP_TYPE(mapi->id)) {\n case PT_UNSPECIFIED:\n printf(\" NONE \"); break;\n case PT_NULL:\n printf(\" NULL \"); break;\n case PT_I2:\n printf(\" I2 \"); break;\n case PT_LONG:\n printf(\" LONG \"); break;\n case PT_R4:\n printf(\" R4 \"); break;\n case PT_DOUBLE:\n printf(\" DOUBLE \"); break;\n case PT_CURRENCY:\n printf(\"CURRENCY \"); break;\n case PT_APPTIME:\n printf(\"APP TIME \"); break;\n case PT_ERROR:\n printf(\" ERROR \"); break;\n case PT_BOOLEAN:\n printf(\" BOOLEAN \"); break;\n case PT_OBJECT:\n printf(\" OBJECT \"); break;\n case PT_I8:\n printf(\" I8 \"); break;\n case PT_STRING8:\n printf(\" STRING8 \"); break;\n case PT_UNICODE:\n printf(\" UNICODE \"); break;\n case PT_SYSTIME:\n printf(\"SYS TIME \"); break;\n case PT_CLSID:\n printf(\"OLE GUID \"); break;\n case PT_BINARY:\n printf(\" BINARY \"); break;\n default:\n printf(\"<%x>\", PROP_TYPE(mapi->id)); break;\n }\n\n printf(\"] Code: [\");\n if (mapi->custom == 1) {\n printf(\"UD:x%04x\", PROP_ID(mapi->id));\n } else {\n found = 0;\n for (index = 0; index < sizeof(MPList) / sizeof(MAPIPropertyTagList); index++) {\n if ((MPList[index].id == PROP_ID(mapi->id)) && (found == 0)) {\n printf(\"%s\", MPList[index].name);\n found = 1;\n }\n }\n if (found == 0) {\n printf(\"0x%04x\", PROP_ID(mapi->id));\n }\n }\n printf(\"]\\n\");\n if (mapi->namedproperty > 0) {\n for (i = 0; i < mapi->namedproperty; i++) {\n printf(\" Name: %s\\n\", mapi->propnames[i].data);\n }\n }\n for (i = 0; i < mapi->count; i++) {\n mapidata = &(mapi->data[i]);\n if (mapi->count > 1) {\n printf(\" [%i/%u] \", i, mapi->count);\n } else {\n printf(\" \");\n }\n printf(\"Size: %i\", mapidata->size);\n switch (PROP_TYPE(mapi->id)) {\n case PT_SYSTIME:\n MAPISysTimetoDTR(mapidata->data, &thedate);\n printf(\" Value: \");\n ddword_tmp = *((DDWORD *)mapidata->data);\n TNEFPrintDate(thedate);\n printf(\" [HEX: \");\n for (x = 0; x < sizeof(ddword_tmp); x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"] (%llu)\\n\", ddword_tmp);\n break;\n case PT_LONG:\n printf(\" Value: %i\\n\", *((int*)mapidata->data));\n break;\n case PT_I2:\n printf(\" Value: %hi\\n\", *((short int*)mapidata->data));\n break;\n case PT_BOOLEAN:\n if (mapi->data->data[0] != 0) {\n printf(\" Value: True\\n\");\n } else {\n printf(\" Value: False\\n\");\n }\n break;\n case PT_OBJECT:\n printf(\"\\n\");\n break;\n case PT_BINARY:\n if (IsCompressedRTF(mapidata) == 1) {\n printf(\" Detected Compressed RTF. \");\n printf(\"Decompressed text follows\\n\");\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n if ((vlTemp.data = (BYTE*)DecompressRTF(mapidata, &(vlTemp.size))) != NULL) {\n printf(\"%s\\n\", vlTemp.data);\n free(vlTemp.data);\n }\n printf(\"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\\n\");\n } else {\n printf(\" Value: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }\n\n }\n printf(\"]\\n\");\n }\n break;\n case PT_STRING8:\n printf(\" Value: [%s]\\n\", mapidata->data);\n if (strlen((char*)mapidata->data) != mapidata->size - 1) {\n printf(\"Detected Hidden data: [\");\n for (h = 0; h < mapidata->size; h++) {\n if (isprint(mapidata->data[h])) {\n printf(\"%c\", mapidata->data[h]);\n } else {\n printf(\".\");\n }\n\n }\n printf(\"]\\n\");\n }\n break;\n case PT_CLSID:\n printf(\" Value: \");\n printf(\"[HEX: \");\n for(x=0; x< 16; x++) {\n printf(\" %02x\", (BYTE)mapidata->data[x]);\n }\n printf(\"]\\n\");\n break;\n default:\n printf(\" Value: [%s]\\n\", mapidata->data);\n }\n }\n }\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"MAPIPrint","file_name":"lib/ytnef.c","commit_link":"github.com/Yeraze/ytnef/commit/f98f5d4adc1c4bd4033638f6167c1bb95d642f89","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#69-a16ac7ebbc25","input":"static int readContigTilesIntoBuffer (TIFF* in, uint8* buf, \n uint32 imagelength, \n uint32 imagewidth, \n uint32 tw, uint32 tl,\n tsample_t spp, uint16 bps)\n {\n int status = 1;\n tsample_t sample = 0;\n tsample_t count = spp; \n uint32 row, col, trow;\n uint32 nrow, ncol;\n uint32 dst_rowsize, shift_width;\n uint32 bytes_per_sample, bytes_per_pixel;\n uint32 trailing_bits, prev_trailing_bits;\n uint32 tile_rowsize = TIFFTileRowSize(in);\n uint32 src_offset, dst_offset;\n uint32 row_offset, col_offset;\n uint8 *bufp = (uint8*) buf;\n unsigned char *src = NULL;\n unsigned char *dst = NULL;\n tsize_t tbytes = 0, tile_buffsize = 0;\n tsize_t tilesize = TIFFTileSize(in);\n unsigned char *tilebuf = NULL;\n\n bytes_per_sample = (bps + 7) / 8; \n bytes_per_pixel = ((bps * spp) + 7) / 8;\n\n if ((bps % 8) == 0)\n shift_width = 0;\n else\n {\n if (bytes_per_pixel < (bytes_per_sample + 1))\n shift_width = bytes_per_pixel;\n else\n shift_width = bytes_per_sample + 1;\n }\n\n tile_buffsize = tilesize;\n if (tilesize == 0 || tile_rowsize == 0)\n {\n TIFFError(\"readContigTilesIntoBuffer\", \"Tile size or tile rowsize is zero\");\n exit(-1);\n }\n\n if (tilesize < (tsize_t)(tl * tile_rowsize))\n {\n#ifdef DEBUG2\n TIFFError(\"readContigTilesIntoBuffer\",\n\t \"Tilesize %lu is too small, using alternate calculation %u\",\n tilesize, tl * tile_rowsize);\n#endif\n tile_buffsize = tl * tile_rowsize;\n if (tl != (tile_buffsize / tile_rowsize))\n {\n \tTIFFError(\"readContigTilesIntoBuffer\", \"Integer overflow when calculating buffer size.\");\n exit(-1);\n }\n }\n\n tilebuf = _TIFFmalloc(tile_buffsize);\n if (tilebuf == 0)\n return 0;\n\n dst_rowsize = ((imagewidth * bps * spp) + 7) / 8; \n for (row = 0; row < imagelength; row += tl)\n {\n nrow = (row + tl > imagelength) ? imagelength - row : tl;\n for (col = 0; col < imagewidth; col += tw)\n {\n tbytes = TIFFReadTile(in, tilebuf, col, row, 0, 0);\n if (tbytes < tilesize && !ignore)\n {\n\tTIFFError(TIFFFileName(in),\n\t\t \"Error, can't read tile at row %lu col %lu, Read %lu bytes of %lu\",\n\t\t (unsigned long) col, (unsigned long) row, (unsigned long)tbytes,\n (unsigned long)tilesize);\n\t\t status = 0;\n _TIFFfree(tilebuf);\n\t\t return status;\n\t}\n \n row_offset = row * dst_rowsize;\n col_offset = ((col * bps * spp) + 7)/ 8;\n bufp = buf + row_offset + col_offset;\n\n if (col + tw > imagewidth)\n\tncol = imagewidth - col;\n else\n ncol = tw;\n\n /* Each tile scanline will start on a byte boundary but it\n * has to be merged into the scanline for the entire\n * image buffer and the previous segment may not have\n * ended on a byte boundary\n */\n /* Optimization for common bit depths, all samples */\n if (((bps % 8) == 0) && (count == spp))\n {\n\tfor (trow = 0; trow < nrow; trow++)\n {\n\t src_offset = trow * tile_rowsize;\n\t _TIFFmemcpy (bufp, tilebuf + src_offset, (ncol * spp * bps) / 8);\n bufp += (imagewidth * bps * spp) / 8;\n\t }\n }\n else\n {\n\t/* Bit depths not a multiple of 8 and/or extract fewer than spp samples */\n prev_trailing_bits = trailing_bits = 0;\n trailing_bits = (ncol * bps * spp) % 8;\n\n\t/*\tfor (trow = 0; tl < nrow; trow++) */\n\tfor (trow = 0; trow < nrow; trow++)\n {\n\t src_offset = trow * tile_rowsize;\n src = tilebuf + src_offset;\n\t dst_offset = (row + trow) * dst_rowsize;\n dst = buf + dst_offset + col_offset;\n switch (shift_width)\n {\n case 0: if (extractContigSamplesBytes (src, dst, ncol, sample,\n spp, bps, count, 0, ncol))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t\trow, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n case 1: if (bps == 1)\n { \n if (extractContigSamplesShifted8bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t\t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n\t\t }\n else\n if (extractContigSamplesShifted16bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t \t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t break;\n case 2: if (extractContigSamplesShifted24bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t \t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n case 3:\n case 4:\n case 5: if (extractContigSamplesShifted32bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n default: TIFFError(\"readContigTilesIntoBuffer\", \"Unsupported bit depth %d\", bps);\n\t\t return 1;\n\t }\n }\n prev_trailing_bits += trailing_bits;\n /* if (prev_trailing_bits > 7) */\n\t/* prev_trailing_bits-= 8; */\n\t}\n }\n }\n\n _TIFFfree(tilebuf);\n return status;\n }","target":"static int readContigTilesIntoBuffer (TIFF* in, uint8* buf, \n uint32 imagelength, \n uint32 imagewidth, \n uint32 tw, uint32 tl,\n tsample_t spp, uint16 bps)\n {\n int status = 1;\n tsample_t sample = 0;\n tsample_t count = spp; \n uint32 row, col, trow;\n uint32 nrow, ncol;\n uint32 dst_rowsize, shift_width;\n uint32 bytes_per_sample, bytes_per_pixel;\n uint32 trailing_bits, prev_trailing_bits;\n uint32 tile_rowsize = TIFFTileRowSize(in);\n uint32 src_offset, dst_offset;\n uint32 row_offset, col_offset;\n uint8 *bufp = (uint8*) buf;\n unsigned char *src = NULL;\n unsigned char *dst = NULL;\n tsize_t tbytes = 0, tile_buffsize = 0;\n tsize_t tilesize = TIFFTileSize(in);\n unsigned char *tilebuf = NULL;\n\n bytes_per_sample = (bps + 7) / 8; \n bytes_per_pixel = ((bps * spp) + 7) / 8;\n\n if ((bps % 8) == 0)\n shift_width = 0;\n else\n {\n if (bytes_per_pixel < (bytes_per_sample + 1))\n shift_width = bytes_per_pixel;\n else\n shift_width = bytes_per_sample + 1;\n }\n\n tile_buffsize = tilesize;\n if (tilesize == 0 || tile_rowsize == 0)\n {\n TIFFError(\"readContigTilesIntoBuffer\", \"Tile size or tile rowsize is zero\");\n exit(-1);\n }\n\n if (tilesize < (tsize_t)(tl * tile_rowsize))\n {\n#ifdef DEBUG2\n TIFFError(\"readContigTilesIntoBuffer\",\n\t \"Tilesize %lu is too small, using alternate calculation %u\",\n tilesize, tl * tile_rowsize);\n#endif\n tile_buffsize = tl * tile_rowsize;\n if (tl != (tile_buffsize / tile_rowsize))\n {\n \tTIFFError(\"readContigTilesIntoBuffer\", \"Integer overflow when calculating buffer size.\");\n exit(-1);\n }\n }\n\n /* Add 3 padding bytes for extractContigSamplesShifted32bits */\n if( tile_buffsize > 0xFFFFFFFFU - 3 )\n {\n TIFFError(\"readContigTilesIntoBuffer\", \"Integer overflow when calculating buffer size.\");\n exit(-1);\n }\n tilebuf = _TIFFmalloc(tile_buffsize + 3);\n if (tilebuf == 0)\n return 0;\n tilebuf[tile_buffsize] = 0;\n tilebuf[tile_buffsize+1] = 0;\n tilebuf[tile_buffsize+2] = 0;\n\n dst_rowsize = ((imagewidth * bps * spp) + 7) / 8; \n for (row = 0; row < imagelength; row += tl)\n {\n nrow = (row + tl > imagelength) ? imagelength - row : tl;\n for (col = 0; col < imagewidth; col += tw)\n {\n tbytes = TIFFReadTile(in, tilebuf, col, row, 0, 0);\n if (tbytes < tilesize && !ignore)\n {\n\tTIFFError(TIFFFileName(in),\n\t\t \"Error, can't read tile at row %lu col %lu, Read %lu bytes of %lu\",\n\t\t (unsigned long) col, (unsigned long) row, (unsigned long)tbytes,\n (unsigned long)tilesize);\n\t\t status = 0;\n _TIFFfree(tilebuf);\n\t\t return status;\n\t}\n \n row_offset = row * dst_rowsize;\n col_offset = ((col * bps * spp) + 7)/ 8;\n bufp = buf + row_offset + col_offset;\n\n if (col + tw > imagewidth)\n\tncol = imagewidth - col;\n else\n ncol = tw;\n\n /* Each tile scanline will start on a byte boundary but it\n * has to be merged into the scanline for the entire\n * image buffer and the previous segment may not have\n * ended on a byte boundary\n */\n /* Optimization for common bit depths, all samples */\n if (((bps % 8) == 0) && (count == spp))\n {\n\tfor (trow = 0; trow < nrow; trow++)\n {\n\t src_offset = trow * tile_rowsize;\n\t _TIFFmemcpy (bufp, tilebuf + src_offset, (ncol * spp * bps) / 8);\n bufp += (imagewidth * bps * spp) / 8;\n\t }\n }\n else\n {\n\t/* Bit depths not a multiple of 8 and/or extract fewer than spp samples */\n prev_trailing_bits = trailing_bits = 0;\n trailing_bits = (ncol * bps * spp) % 8;\n\n\t/*\tfor (trow = 0; tl < nrow; trow++) */\n\tfor (trow = 0; trow < nrow; trow++)\n {\n\t src_offset = trow * tile_rowsize;\n src = tilebuf + src_offset;\n\t dst_offset = (row + trow) * dst_rowsize;\n dst = buf + dst_offset + col_offset;\n switch (shift_width)\n {\n case 0: if (extractContigSamplesBytes (src, dst, ncol, sample,\n spp, bps, count, 0, ncol))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t\trow, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n case 1: if (bps == 1)\n { \n if (extractContigSamplesShifted8bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t\t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n\t\t }\n else\n if (extractContigSamplesShifted16bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t \t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t break;\n case 2: if (extractContigSamplesShifted24bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t \t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n case 3:\n case 4:\n case 5: if (extractContigSamplesShifted32bits (src, dst, ncol,\n sample, spp,\n bps, count,\n 0, ncol,\n prev_trailing_bits))\n {\n\t\t TIFFError(\"readContigTilesIntoBuffer\",\n \"Unable to extract row %d from tile %lu\", \n\t\t\t row, (unsigned long)TIFFCurrentTile(in));\n\t\t return 1;\n\t\t }\n\t\t break;\n default: TIFFError(\"readContigTilesIntoBuffer\", \"Unsupported bit depth %d\", bps);\n\t\t return 1;\n\t }\n }\n prev_trailing_bits += trailing_bits;\n /* if (prev_trailing_bits > 7) */\n\t/* prev_trailing_bits-= 8; */\n\t}\n }\n }\n\n _TIFFfree(tilebuf);\n return status;\n }","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"readContigTilesIntoBuffer","file_name":"tools/tiffcrop.c","commit_link":"github.com/vadz/libtiff/commit/ae9365db1b271b62b35ce018eac8799b1d5e8a53","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#70-364945f4cea1","input":"int TNEFParse(TNEFStruct *TNEF) {\n WORD key;\n DWORD type;\n DWORD size;\n DWORD signature;\n BYTE *data;\n WORD checksum, header_checksum;\n int i;\n\n if (TNEF->IO.ReadProc == NULL) {\n printf(\"ERROR: Setup incorrectly: No ReadProc\\n\");\n return YTNEF_INCORRECT_SETUP;\n }\n\n if (TNEF->IO.InitProc != NULL) {\n DEBUG(TNEF->Debug, 2, \"About to initialize\");\n if (TNEF->IO.InitProc(&TNEF->IO) != 0) {\n return YTNEF_CANNOT_INIT_DATA;\n }\n DEBUG(TNEF->Debug, 2, \"Initialization finished\");\n }\n\n DEBUG(TNEF->Debug, 2, \"Reading Signature\");\n if (TNEF->IO.ReadProc(&TNEF->IO, sizeof(DWORD), 1, &signature) < 1) {\n printf(\"ERROR: Error reading signature\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_READING_DATA;\n }\n\n DEBUG(TNEF->Debug, 2, \"Checking Signature\");\n if (TNEFCheckForSignature(signature) < 0) {\n printf(\"ERROR: Signature does not match. Not TNEF.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NOT_TNEF_STREAM;\n }\n\n DEBUG(TNEF->Debug, 2, \"Reading Key.\");\n\n if (TNEFGetKey(TNEF, &key) < 0) {\n printf(\"ERROR: Unable to retrieve key.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NO_KEY;\n }\n\n DEBUG(TNEF->Debug, 2, \"Starting Full Processing.\");\n\n while (TNEFGetHeader(TNEF, &type, &size) == 0) {\n DEBUG2(TNEF->Debug, 2, \"Header says type=0x%X, size=%u\", type, size);\n DEBUG2(TNEF->Debug, 2, \"Header says type=%u, size=%u\", type, size);\n data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(data);\n if (TNEFRawRead(TNEF, data, size, &header_checksum) < 0) {\n printf(\"ERROR: Unable to read data.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n if (TNEFRawRead(TNEF, (BYTE *)&checksum, 2, NULL) < 0) {\n printf(\"ERROR: Unable to read checksum.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n checksum = SwapWord((BYTE *)&checksum, sizeof(WORD));\n if (checksum != header_checksum) {\n printf(\"ERROR: Checksum mismatch. Data corruption?:\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_BAD_CHECKSUM;\n }\n for (i = 0; i < (sizeof(TNEFList) / sizeof(TNEFHandler)); i++) {\n if (TNEFList[i].id == type) {\n if (TNEFList[i].handler != NULL) {\n if (TNEFList[i].handler(TNEF, i, (char*)data, size) < 0) {\n free(data);\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_IN_HANDLER;\n } else {\n // Found our handler and processed it. now time to get out\n break;\n }\n } else {\n DEBUG2(TNEF->Debug, 1, \"No handler for %s: %u bytes\",\n TNEFList[i].name, size);\n }\n }\n }\n\n free(data);\n }\n\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return 0;\n\n}","target":"int TNEFParse(TNEFStruct *TNEF) {\n WORD key;\n DWORD type;\n DWORD size;\n DWORD signature;\n BYTE *data;\n WORD checksum, header_checksum;\n int i;\n\n if (TNEF->IO.ReadProc == NULL) {\n printf(\"ERROR: Setup incorrectly: No ReadProc\\n\");\n return YTNEF_INCORRECT_SETUP;\n }\n\n if (TNEF->IO.InitProc != NULL) {\n DEBUG(TNEF->Debug, 2, \"About to initialize\");\n if (TNEF->IO.InitProc(&TNEF->IO) != 0) {\n return YTNEF_CANNOT_INIT_DATA;\n }\n DEBUG(TNEF->Debug, 2, \"Initialization finished\");\n }\n\n DEBUG(TNEF->Debug, 2, \"Reading Signature\");\n if (TNEF->IO.ReadProc(&TNEF->IO, sizeof(DWORD), 1, &signature) < 1) {\n printf(\"ERROR: Error reading signature\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_READING_DATA;\n }\n\n DEBUG(TNEF->Debug, 2, \"Checking Signature\");\n if (TNEFCheckForSignature(signature) < 0) {\n printf(\"ERROR: Signature does not match. Not TNEF.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NOT_TNEF_STREAM;\n }\n\n DEBUG(TNEF->Debug, 2, \"Reading Key.\");\n\n if (TNEFGetKey(TNEF, &key) < 0) {\n printf(\"ERROR: Unable to retrieve key.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_NO_KEY;\n }\n\n DEBUG(TNEF->Debug, 2, \"Starting Full Processing.\");\n\n while (TNEFGetHeader(TNEF, &type, &size) == 0) {\n DEBUG2(TNEF->Debug, 2, \"Header says type=0x%X, size=%u\", type, size);\n DEBUG2(TNEF->Debug, 2, \"Header says type=%u, size=%u\", type, size);\n if(size == 0) {\n printf(\"ERROR: Field with size of 0\\n\");\n return YTNEF_ERROR_READING_DATA;\n }\n data = calloc(size, sizeof(BYTE));\n ALLOCCHECK(data);\n if (TNEFRawRead(TNEF, data, size, &header_checksum) < 0) {\n printf(\"ERROR: Unable to read data.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n if (TNEFRawRead(TNEF, (BYTE *)&checksum, 2, NULL) < 0) {\n printf(\"ERROR: Unable to read checksum.\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_ERROR_READING_DATA;\n }\n checksum = SwapWord((BYTE *)&checksum, sizeof(WORD));\n if (checksum != header_checksum) {\n printf(\"ERROR: Checksum mismatch. Data corruption?:\\n\");\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n free(data);\n return YTNEF_BAD_CHECKSUM;\n }\n for (i = 0; i < (sizeof(TNEFList) / sizeof(TNEFHandler)); i++) {\n if (TNEFList[i].id == type) {\n if (TNEFList[i].handler != NULL) {\n if (TNEFList[i].handler(TNEF, i, (char*)data, size) < 0) {\n free(data);\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return YTNEF_ERROR_IN_HANDLER;\n } else {\n // Found our handler and processed it. now time to get out\n break;\n }\n } else {\n DEBUG2(TNEF->Debug, 1, \"No handler for %s: %u bytes\",\n TNEFList[i].name, size);\n }\n }\n }\n\n free(data);\n }\n\n if (TNEF->IO.CloseProc != NULL) {\n TNEF->IO.CloseProc(&TNEF->IO);\n }\n return 0;\n\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"TNEFParse","file_name":"lib/ytnef.c","commit_link":"github.com/Yeraze/ytnef/commit/3cb0f914d6427073f262e1b2b5fd973e3043cdf7","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#71-770dea509548","input":"static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )\n{\n int ret;\n const mbedtls_ssl_ciphersuite_t *ciphersuite_info =\n ssl->transform_negotiate->ciphersuite_info;\n unsigned char *p = NULL, *end = NULL;\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"=> parse server key exchange\" ) );\n\n#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA )\n {\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= skip parse server key exchange\" ) );\n ssl->state++;\n return( 0 );\n }\n ((void) p);\n ((void) end);\n#endif\n\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA )\n {\n if( ( ret = ssl_get_ecdh_params_from_cert( ssl ) ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"ssl_get_ecdh_params_from_cert\", ret );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( ret );\n }\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= skip parse server key exchange\" ) );\n ssl->state++;\n return( 0 );\n }\n ((void) p);\n ((void) end);\n#endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */\n\n if( ( ret = mbedtls_ssl_read_record( ssl ) ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_ssl_read_record\", ret );\n return( ret );\n }\n\n if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n /*\n * ServerKeyExchange may be skipped with PSK and RSA-PSK when the server\n * doesn't use a psk_identity_hint\n */\n if( ssl->in_msg[0] != MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE )\n {\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )\n {\n /* Current message is probably either\n * CertificateRequest or ServerHelloDone */\n ssl->keep_current_message = 1;\n goto exit;\n }\n\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"server key exchange message must \"\n \"not be skipped\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );\n\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n p = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );\n end = ssl->in_msg + ssl->in_hslen;\n MBEDTLS_SSL_DEBUG_BUF( 3, \"server key exchange\", p, end - p );\n\n#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK )\n {\n if( ssl_parse_server_psk_hint( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n } /* FALLTROUGH */\n#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */\n\n#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )\n ; /* nothing more to do */\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_PSK_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK )\n {\n if( ssl_parse_server_dh_params( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA )\n {\n if( ssl_parse_server_ecdh_params( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE )\n {\n ret = mbedtls_ecjpake_read_round_two( &ssl->handshake->ecjpake_ctx,\n p, end - p );\n if( ret != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_ecjpake_read_round_two\", ret );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n#if defined(MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED)\n if( mbedtls_ssl_ciphersuite_uses_server_signature( ciphersuite_info ) )\n {\n size_t sig_len, hashlen;\n unsigned char hash[64];\n mbedtls_md_type_t md_alg = MBEDTLS_MD_NONE;\n mbedtls_pk_type_t pk_alg = MBEDTLS_PK_NONE;\n unsigned char *params = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );\n size_t params_len = p - params;\n\n /*\n * Handle the digitally-signed structure\n */\n#if defined(MBEDTLS_SSL_PROTO_TLS1_2)\n if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 )\n {\n if( ssl_parse_signature_algorithm( ssl, &p, end,\n &md_alg, &pk_alg ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n if( pk_alg != mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */\n#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_1)\n if( ssl->minor_ver < MBEDTLS_SSL_MINOR_VERSION_3 )\n {\n pk_alg = mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info );\n\n /* Default hash for ECDSA is SHA-1 */\n if( pk_alg == MBEDTLS_PK_ECDSA && md_alg == MBEDTLS_MD_NONE )\n md_alg = MBEDTLS_MD_SHA1;\n }\n else\n#endif\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n /*\n * Read signature\n */\n\n if( p > end - 2 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n sig_len = ( p[0] << 8 ) | p[1];\n p += 2;\n\n if( end != p + sig_len )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n MBEDTLS_SSL_DEBUG_BUF( 3, \"signature\", p, sig_len );\n\n /*\n * Compute the hash that has been signed\n */\n#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_1)\n if( md_alg == MBEDTLS_MD_NONE )\n {\n hashlen = 36;\n ret = mbedtls_ssl_get_key_exchange_md_ssl_tls( ssl, hash, params,\n params_len );\n if( ret != 0 )\n return( ret );\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_SSL3 || MBEDTLS_SSL_PROTO_TLS1 || \\\n MBEDTLS_SSL_PROTO_TLS1_1 */\n#if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_2)\n if( md_alg != MBEDTLS_MD_NONE )\n {\n /* Info from md_alg will be used instead */\n hashlen = 0;\n ret = mbedtls_ssl_get_key_exchange_md_tls1_2( ssl, hash, params,\n params_len, md_alg );\n if( ret != 0 )\n return( ret );\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_TLS1 || MBEDTLS_SSL_PROTO_TLS1_1 || \\\n MBEDTLS_SSL_PROTO_TLS1_2 */\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n MBEDTLS_SSL_DEBUG_BUF( 3, \"parameters hash\", hash, hashlen != 0 ? hashlen :\n (unsigned int) ( mbedtls_md_get_size( mbedtls_md_info_from_type( md_alg ) ) ) );\n\n if( ssl->session_negotiate->peer_cert == NULL )\n {\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"certificate required\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n /*\n * Verify signature\n */\n if( ! mbedtls_pk_can_do( &ssl->session_negotiate->peer_cert->pk, pk_alg ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH );\n }\n\n if( ( ret = mbedtls_pk_verify( &ssl->session_negotiate->peer_cert->pk,\n md_alg, hash, hashlen, p, sig_len ) ) != 0 )\n {\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR );\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_pk_verify\", ret );\n return( ret );\n }\n }\n#endif /* MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED */\n\nexit:\n ssl->state++;\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= parse server key exchange\" ) );\n\n return( 0 );\n}","target":"static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )\n{\n int ret;\n const mbedtls_ssl_ciphersuite_t *ciphersuite_info =\n ssl->transform_negotiate->ciphersuite_info;\n unsigned char *p = NULL, *end = NULL;\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"=> parse server key exchange\" ) );\n\n#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA )\n {\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= skip parse server key exchange\" ) );\n ssl->state++;\n return( 0 );\n }\n ((void) p);\n ((void) end);\n#endif\n\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA )\n {\n if( ( ret = ssl_get_ecdh_params_from_cert( ssl ) ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"ssl_get_ecdh_params_from_cert\", ret );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( ret );\n }\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= skip parse server key exchange\" ) );\n ssl->state++;\n return( 0 );\n }\n ((void) p);\n ((void) end);\n#endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */\n\n if( ( ret = mbedtls_ssl_read_record( ssl ) ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_ssl_read_record\", ret );\n return( ret );\n }\n\n if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n /*\n * ServerKeyExchange may be skipped with PSK and RSA-PSK when the server\n * doesn't use a psk_identity_hint\n */\n if( ssl->in_msg[0] != MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE )\n {\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )\n {\n /* Current message is probably either\n * CertificateRequest or ServerHelloDone */\n ssl->keep_current_message = 1;\n goto exit;\n }\n\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"server key exchange message must \"\n \"not be skipped\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );\n\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n p = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );\n end = ssl->in_msg + ssl->in_hslen;\n MBEDTLS_SSL_DEBUG_BUF( 3, \"server key exchange\", p, end - p );\n\n#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK )\n {\n if( ssl_parse_server_psk_hint( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n } /* FALLTROUGH */\n#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */\n\n#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )\n ; /* nothing more to do */\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_PSK_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK )\n {\n if( ssl_parse_server_dh_params( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \\\n defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_RSA ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK ||\n ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA )\n {\n if( ssl_parse_server_ecdh_params( ssl, &p, end ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED ||\n MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */\n#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)\n if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE )\n {\n ret = mbedtls_ecjpake_read_round_two( &ssl->handshake->ecjpake_ctx,\n p, end - p );\n if( ret != 0 )\n {\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_ecjpake_read_round_two\", ret );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n#if defined(MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED)\n if( mbedtls_ssl_ciphersuite_uses_server_signature( ciphersuite_info ) )\n {\n size_t sig_len, hashlen;\n unsigned char hash[64];\n mbedtls_md_type_t md_alg = MBEDTLS_MD_NONE;\n mbedtls_pk_type_t pk_alg = MBEDTLS_PK_NONE;\n unsigned char *params = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );\n size_t params_len = p - params;\n\n /*\n * Handle the digitally-signed structure\n */\n#if defined(MBEDTLS_SSL_PROTO_TLS1_2)\n if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 )\n {\n if( ssl_parse_signature_algorithm( ssl, &p, end,\n &md_alg, &pk_alg ) != 0 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n if( pk_alg != mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */\n#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_1)\n if( ssl->minor_ver < MBEDTLS_SSL_MINOR_VERSION_3 )\n {\n pk_alg = mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info );\n\n /* Default hash for ECDSA is SHA-1 */\n if( pk_alg == MBEDTLS_PK_ECDSA && md_alg == MBEDTLS_MD_NONE )\n md_alg = MBEDTLS_MD_SHA1;\n }\n else\n#endif\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n /*\n * Read signature\n */\n\n if( p > end - 2 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n sig_len = ( p[0] << 8 ) | p[1];\n p += 2;\n\n if( p != end - sig_len )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n MBEDTLS_SSL_DEBUG_BUF( 3, \"signature\", p, sig_len );\n\n /*\n * Compute the hash that has been signed\n */\n#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_1)\n if( md_alg == MBEDTLS_MD_NONE )\n {\n hashlen = 36;\n ret = mbedtls_ssl_get_key_exchange_md_ssl_tls( ssl, hash, params,\n params_len );\n if( ret != 0 )\n return( ret );\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_SSL3 || MBEDTLS_SSL_PROTO_TLS1 || \\\n MBEDTLS_SSL_PROTO_TLS1_1 */\n#if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1) || \\\n defined(MBEDTLS_SSL_PROTO_TLS1_2)\n if( md_alg != MBEDTLS_MD_NONE )\n {\n /* Info from md_alg will be used instead */\n hashlen = 0;\n ret = mbedtls_ssl_get_key_exchange_md_tls1_2( ssl, hash, params,\n params_len, md_alg );\n if( ret != 0 )\n return( ret );\n }\n else\n#endif /* MBEDTLS_SSL_PROTO_TLS1 || MBEDTLS_SSL_PROTO_TLS1_1 || \\\n MBEDTLS_SSL_PROTO_TLS1_2 */\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"should never happen\" ) );\n return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\n }\n\n MBEDTLS_SSL_DEBUG_BUF( 3, \"parameters hash\", hash, hashlen != 0 ? hashlen :\n (unsigned int) ( mbedtls_md_get_size( mbedtls_md_info_from_type( md_alg ) ) ) );\n\n if( ssl->session_negotiate->peer_cert == NULL )\n {\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"certificate required\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );\n }\n\n /*\n * Verify signature\n */\n if( ! mbedtls_pk_can_do( &ssl->session_negotiate->peer_cert->pk, pk_alg ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message\" ) );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );\n return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH );\n }\n\n if( ( ret = mbedtls_pk_verify( &ssl->session_negotiate->peer_cert->pk,\n md_alg, hash, hashlen, p, sig_len ) ) != 0 )\n {\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR );\n MBEDTLS_SSL_DEBUG_RET( 1, \"mbedtls_pk_verify\", ret );\n return( ret );\n }\n }\n#endif /* MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED */\n\nexit:\n ssl->state++;\n\n MBEDTLS_SSL_DEBUG_MSG( 2, ( \"<= parse server key exchange\" ) );\n\n return( 0 );\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ssl_parse_server_key_exchange","file_name":"library/ssl_cli.c","commit_link":"github.com/ARMmbed/mbedtls/commit/027f84c69f4ef30c0693832a6c396ef19e563ca1","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#72-0f7d2b290d97","input":"static int exif_scan_JPEG_header(image_info_type *ImageInfo) {\n int section, sn;\n int marker = 0, last_marker = M_PSEUDO, comment_correction=1;\n int ll, lh;\n unsigned char *Data;\n size_t fpos, size, got, itemlen;\n jpeg_sof_info sof_info;\n\n for(section=0;;section++) {\n // get marker byte, swallowing possible padding\n // some software does not count the length bytes of COM section\n // one company doing so is very much envolved in JPEG...\n // so we accept too\n if (last_marker==M_COM && comment_correction) {\n comment_correction = 2;\n }\n do {\n if ((marker = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n if (last_marker==M_COM && comment_correction>0) {\n if (marker!=0xFF) {\n marker = 0xff;\n comment_correction--;\n } else {\n last_marker = M_PSEUDO; /* stop skipping 0 for M_COM */\n }\n }\n } while (marker == 0xff);\n if (last_marker==M_COM && !comment_correction) {\n raise_notice(\"Image has corrupt COM section: some software set \"\n \"wrong length information\");\n }\n if (last_marker==M_COM && comment_correction)\n return M_EOI; /* ah illegal: char after COM section not 0xFF */\n\n fpos = ImageInfo->infile->tell();\n\n if (marker == 0xff) {\n // 0xff is legal padding, but if we get that many, something's wrong.\n raise_warning(\"To many padding bytes\");\n return 0;\n }\n\n /* Read the length of the section. */\n\n if ((lh = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n if ((ll = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n itemlen = (lh << 8) | ll;\n\n if (itemlen < 2) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, nullptr);\n if (sn == -1) return 0;\n Data = ImageInfo->file.list[sn].data;\n\n /* Store first two pre-read bytes. */\n Data[0] = (unsigned char)lh;\n Data[1] = (unsigned char)ll;\n\n String str = ImageInfo->infile->read(itemlen-2);\n got = str.length();\n if (got != itemlen-2) {\n raise_warning(\"Error reading from file: \"\n \"got=x%04lX(=%lu) != itemlen-2=x%04lX(=%lu)\",\n got, got, itemlen-2, itemlen-2);\n return 0;\n }\n memcpy(Data+2, str.c_str(), got);\n switch(marker) {\n case M_SOS: /* stop before hitting compressed data */\n // If reading entire image is requested, read the rest of the data.\n if (ImageInfo->read_all) {\n /* Determine how much file is left. */\n fpos = ImageInfo->infile->tell();\n size = ImageInfo->FileSize - fpos;\n sn = exif_file_sections_add(ImageInfo, M_PSEUDO, size, nullptr);\n if (sn == -1) return 0;\n Data = ImageInfo->file.list[sn].data;\n str = ImageInfo->infile->read(size);\n got = str.length();\n if (got != size) {\n raise_warning(\"Unexpected end of file reached\");\n return 0;\n }\n memcpy(Data, str.c_str(), got);\n }\n return 1;\n\n case M_EOI: /* in case it's a tables-only JPEG stream */\n raise_warning(\"No image in jpeg!\");\n return (ImageInfo->sections_found&(~FOUND_COMPUTED)) ? 1 : 0;\n\n case M_COM: /* Comment section */\n exif_process_COM(ImageInfo, (char *)Data, itemlen);\n break;\n\n case M_EXIF:\n if (!(ImageInfo->sections_found&FOUND_IFD0)) {\n /*ImageInfo->sections_found |= FOUND_EXIF;*/\n /* Seen files from some 'U-lead' software with Vivitar scanner\n that uses marker 31 later in the file (no clue what for!) */\n exif_process_APP1(ImageInfo, (char *)Data, itemlen, fpos);\n }\n break;\n\n case M_APP12:\n exif_process_APP12(ImageInfo, (char *)Data, itemlen);\n break;\n\n\n case M_SOF0:\n case M_SOF1:\n case M_SOF2:\n case M_SOF3:\n case M_SOF5:\n case M_SOF6:\n case M_SOF7:\n case M_SOF9:\n case M_SOF10:\n case M_SOF11:\n case M_SOF13:\n case M_SOF14:\n case M_SOF15:\n exif_process_SOFn(Data, marker, &sof_info);\n ImageInfo->Width = sof_info.width;\n ImageInfo->Height = sof_info.height;\n if (sof_info.num_components == 3) {\n ImageInfo->IsColor = 1;\n } else {\n ImageInfo->IsColor = 0;\n }\n break;\n default:\n /* skip any other marker silently. */\n break;\n }\n\n /* keep track of last marker */\n last_marker = marker;\n }\n return 1;\n}","target":"static int exif_scan_JPEG_header(image_info_type *ImageInfo) {\n int section, sn;\n int marker = 0, last_marker = M_PSEUDO, comment_correction=1;\n int ll, lh;\n unsigned char *Data;\n size_t fpos, size, got, itemlen;\n jpeg_sof_info sof_info;\n\n for(section=0;;section++) {\n // get marker byte, swallowing possible padding\n // some software does not count the length bytes of COM section\n // one company doing so is very much envolved in JPEG...\n // so we accept too\n if (last_marker==M_COM && comment_correction) {\n comment_correction = 2;\n }\n do {\n if ((marker = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n if (last_marker==M_COM && comment_correction>0) {\n if (marker!=0xFF) {\n marker = 0xff;\n comment_correction--;\n } else {\n last_marker = M_PSEUDO; /* stop skipping 0 for M_COM */\n }\n }\n } while (marker == 0xff);\n if (last_marker==M_COM && !comment_correction) {\n raise_notice(\"Image has corrupt COM section: some software set \"\n \"wrong length information\");\n }\n if (last_marker==M_COM && comment_correction)\n return M_EOI; /* ah illegal: char after COM section not 0xFF */\n\n fpos = ImageInfo->infile->tell();\n\n if (marker == 0xff) {\n // 0xff is legal padding, but if we get that many, something's wrong.\n raise_warning(\"To many padding bytes\");\n return 0;\n }\n\n /* Read the length of the section. */\n\n if ((lh = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n if ((ll = ImageInfo->infile->getc()) == EOF) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n itemlen = (lh << 8) | ll;\n\n if (itemlen < 2) {\n raise_warning(\"File structure corrupted\");\n return 0;\n }\n\n sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, nullptr);\n if (sn == -1) return 0;\n Data = ImageInfo->file.list[sn].data;\n\n /* Store first two pre-read bytes. */\n Data[0] = (unsigned char)lh;\n Data[1] = (unsigned char)ll;\n\n String str = ImageInfo->infile->read(itemlen-2);\n got = str.length();\n if (got != itemlen-2) {\n raise_warning(\"Error reading from file: \"\n \"got=x%04lX(=%lu) != itemlen-2=x%04lX(=%lu)\",\n got, got, itemlen-2, itemlen-2);\n return 0;\n }\n memcpy(Data+2, str.c_str(), got);\n switch(marker) {\n case M_SOS: /* stop before hitting compressed data */\n // If reading entire image is requested, read the rest of the data.\n if (ImageInfo->read_all) {\n /* Determine how much file is left. */\n fpos = ImageInfo->infile->tell();\n size = ImageInfo->FileSize - fpos;\n sn = exif_file_sections_add(ImageInfo, M_PSEUDO, size, nullptr);\n if (sn == -1) return 0;\n Data = ImageInfo->file.list[sn].data;\n str = ImageInfo->infile->read(size);\n got = str.length();\n if (got != size) {\n raise_warning(\"Unexpected end of file reached\");\n return 0;\n }\n memcpy(Data, str.c_str(), got);\n }\n return 1;\n\n case M_EOI: /* in case it's a tables-only JPEG stream */\n raise_warning(\"No image in jpeg!\");\n return (ImageInfo->sections_found&(~FOUND_COMPUTED)) ? 1 : 0;\n\n case M_COM: /* Comment section */\n exif_process_COM(ImageInfo, (char *)Data, itemlen);\n break;\n\n case M_EXIF:\n if (!(ImageInfo->sections_found&FOUND_IFD0)) {\n /*ImageInfo->sections_found |= FOUND_EXIF;*/\n /* Seen files from some 'U-lead' software with Vivitar scanner\n that uses marker 31 later in the file (no clue what for!) */\n exif_process_APP1(ImageInfo, (char *)Data, itemlen, fpos);\n }\n break;\n\n case M_APP12:\n exif_process_APP12(ImageInfo, (char *)Data, itemlen);\n break;\n\n\n case M_SOF0:\n case M_SOF1:\n case M_SOF2:\n case M_SOF3:\n case M_SOF5:\n case M_SOF6:\n case M_SOF7:\n case M_SOF9:\n case M_SOF10:\n case M_SOF11:\n case M_SOF13:\n case M_SOF14:\n case M_SOF15:\n if ((itemlen - 2) < 6) {\n return 0;\n }\n\n exif_process_SOFn(Data, marker, &sof_info);\n ImageInfo->Width = sof_info.width;\n ImageInfo->Height = sof_info.height;\n if (sof_info.num_components == 3) {\n ImageInfo->IsColor = 1;\n } else {\n ImageInfo->IsColor = 0;\n }\n break;\n default:\n /* skip any other marker silently. */\n break;\n }\n\n /* keep track of last marker */\n last_marker = marker;\n }\n return 1;\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"HPHP::exif_scan_JPEG_header","file_name":"hphp/runtime/ext/gd/ext_gd.cpp","commit_link":"github.com/facebook/hhvm/commit/f9680d21beaa9eb39d166e8810e29fbafa51ad15","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#73-8d1c73eb747a","input":"forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,\n\t\t UChar* range, UChar** low, UChar** high, UChar** low_prev)\n{\n UChar *p, *pprev = (UChar* )NULL;\n\n#ifdef ONIG_DEBUG_SEARCH\n fprintf(stderr, \"forward_search_range: str: %d, end: %d, s: %d, range: %d\\n\",\n\t (int )str, (int )end, (int )s, (int )range);\n#endif\n\n p = s;\n if (reg->dmin > 0) {\n if (ONIGENC_IS_SINGLEBYTE(reg->enc)) {\n p += reg->dmin;\n }\n else {\n UChar *q = p + reg->dmin;\n while (p < q) p += enclen(reg->enc, p);\n }\n }\n\n retry:\n switch (reg->optimize) {\n case ONIG_OPTIMIZE_EXACT:\n p = slow_search(reg->enc, reg->exact, reg->exact_end, p, end, range);\n break;\n case ONIG_OPTIMIZE_EXACT_IC:\n p = slow_search_ic(reg->enc, reg->case_fold_flag,\n reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_EXACT_BM:\n p = bm_search(reg, reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_EXACT_BM_NOT_REV:\n p = bm_search_notrev(reg, reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_MAP:\n p = map_search(reg->enc, reg->map, p, range);\n break;\n }\n\n if (p && p < range) {\n if (p - reg->dmin < s) {\n retry_gate:\n pprev = p;\n p += enclen(reg->enc, p);\n goto retry;\n }\n\n if (reg->sub_anchor) {\n UChar* prev;\n\n switch (reg->sub_anchor) {\n case ANCHOR_BEGIN_LINE:\n if (!ON_STR_BEGIN(p)) {\n prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n if (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end))\n goto retry_gate;\n }\n break;\n\n case ANCHOR_END_LINE:\n if (ON_STR_END(p)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n prev = (UChar* )onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n if (prev && ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end))\n goto retry_gate;\n#endif\n }\n else if (! ONIGENC_IS_MBC_NEWLINE(reg->enc, p, end)\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n && ! ONIGENC_IS_MBC_CRNL(reg->enc, p, end)\n#endif\n )\n goto retry_gate;\n break;\n }\n }\n\n if (reg->dmax == 0) {\n *low = p;\n if (low_prev) {\n if (*low > s)\n *low_prev = onigenc_get_prev_char_head(reg->enc, s, p);\n else\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n }\n }\n else {\n if (reg->dmax != ONIG_INFINITE_DISTANCE) {\n *low = p - reg->dmax;\n if (*low > s) {\n *low = onigenc_get_right_adjust_char_head_with_prev(reg->enc, s,\n *low, (const UChar** )low_prev);\n if (low_prev && IS_NULL(*low_prev))\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : s), *low);\n }\n else {\n if (low_prev)\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), *low);\n }\n }\n }\n /* no needs to adjust *high, *high is used as range check only */\n *high = p - reg->dmin;\n\n#ifdef ONIG_DEBUG_SEARCH\n fprintf(stderr,\n \"forward_search_range success: low: %d, high: %d, dmin: %d, dmax: %d\\n\",\n\t (int )(*low - str), (int )(*high - str), reg->dmin, reg->dmax);\n#endif\n return 1; /* success */\n }\n\n return 0; /* fail */\n}","target":"forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,\n\t\t UChar* range, UChar** low, UChar** high, UChar** low_prev)\n{\n UChar *p, *pprev = (UChar* )NULL;\n\n#ifdef ONIG_DEBUG_SEARCH\n fprintf(stderr, \"forward_search_range: str: %d, end: %d, s: %d, range: %d\\n\",\n\t (int )str, (int )end, (int )s, (int )range);\n#endif\n\n p = s;\n if (reg->dmin > 0) {\n if (ONIGENC_IS_SINGLEBYTE(reg->enc)) {\n p += reg->dmin;\n }\n else {\n UChar *q = p + reg->dmin;\n\n if (q >= end) return 0; /* fail */\n while (p < q) p += enclen(reg->enc, p);\n }\n }\n\n retry:\n switch (reg->optimize) {\n case ONIG_OPTIMIZE_EXACT:\n p = slow_search(reg->enc, reg->exact, reg->exact_end, p, end, range);\n break;\n case ONIG_OPTIMIZE_EXACT_IC:\n p = slow_search_ic(reg->enc, reg->case_fold_flag,\n reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_EXACT_BM:\n p = bm_search(reg, reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_EXACT_BM_NOT_REV:\n p = bm_search_notrev(reg, reg->exact, reg->exact_end, p, end, range);\n break;\n\n case ONIG_OPTIMIZE_MAP:\n p = map_search(reg->enc, reg->map, p, range);\n break;\n }\n\n if (p && p < range) {\n if (p - reg->dmin < s) {\n retry_gate:\n pprev = p;\n p += enclen(reg->enc, p);\n goto retry;\n }\n\n if (reg->sub_anchor) {\n UChar* prev;\n\n switch (reg->sub_anchor) {\n case ANCHOR_BEGIN_LINE:\n if (!ON_STR_BEGIN(p)) {\n prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n if (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end))\n goto retry_gate;\n }\n break;\n\n case ANCHOR_END_LINE:\n if (ON_STR_END(p)) {\n#ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE\n prev = (UChar* )onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n if (prev && ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end))\n goto retry_gate;\n#endif\n }\n else if (! ONIGENC_IS_MBC_NEWLINE(reg->enc, p, end)\n#ifdef USE_CRNL_AS_LINE_TERMINATOR\n && ! ONIGENC_IS_MBC_CRNL(reg->enc, p, end)\n#endif\n )\n goto retry_gate;\n break;\n }\n }\n\n if (reg->dmax == 0) {\n *low = p;\n if (low_prev) {\n if (*low > s)\n *low_prev = onigenc_get_prev_char_head(reg->enc, s, p);\n else\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), p);\n }\n }\n else {\n if (reg->dmax != ONIG_INFINITE_DISTANCE) {\n *low = p - reg->dmax;\n if (*low > s) {\n *low = onigenc_get_right_adjust_char_head_with_prev(reg->enc, s,\n *low, (const UChar** )low_prev);\n if (low_prev && IS_NULL(*low_prev))\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : s), *low);\n }\n else {\n if (low_prev)\n *low_prev = onigenc_get_prev_char_head(reg->enc,\n (pprev ? pprev : str), *low);\n }\n }\n }\n /* no needs to adjust *high, *high is used as range check only */\n *high = p - reg->dmin;\n\n#ifdef ONIG_DEBUG_SEARCH\n fprintf(stderr,\n \"forward_search_range success: low: %d, high: %d, dmin: %d, dmax: %d\\n\",\n\t (int )(*low - str), (int )(*high - str), reg->dmin, reg->dmax);\n#endif\n return 1; /* success */\n }\n\n return 0; /* fail */\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"forward_search_range","file_name":"src/regexec.c","commit_link":"github.com/kkos/oniguruma/commit/9690d3ab1f9bcd2db8cbe1fe3ee4a5da606b8814","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#74-485098d25fb0","input":"static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n)\n{\n Mpeg4DecContext *ctx = s->avctx->priv_data;\n\n int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0,\n additional_code_len, sign, mismatch;\n VLC *cur_vlc = &ctx->studio_intra_tab[0];\n uint8_t *const scantable = s->intra_scantable.permutated;\n const uint16_t *quant_matrix;\n uint32_t flc;\n const int min = -1 * (1 << (s->avctx->bits_per_raw_sample + 6));\n const int max = ((1 << (s->avctx->bits_per_raw_sample + 6)) - 1);\n\n mismatch = 1;\n\n memset(block, 0, 64 * sizeof(int32_t));\n\n if (n < 4) {\n cc = 0;\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);\n quant_matrix = s->intra_matrix;\n } else {\n cc = (n & 1) + 1;\n if (ctx->rgb)\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);\n else\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_chroma_dc.table, STUDIO_INTRA_BITS, 2);\n quant_matrix = s->chroma_intra_matrix;\n }\n\n if (dct_dc_size < 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"illegal dct_dc_size vlc\\n\");\n return AVERROR_INVALIDDATA;\n } else if (dct_dc_size == 0) {\n dct_diff = 0;\n } else {\n dct_diff = get_xbits(&s->gb, dct_dc_size);\n\n if (dct_dc_size > 8) {\n if(!check_marker(s->avctx, &s->gb, \"dct_dc_size > 8\"))\n return AVERROR_INVALIDDATA;\n }\n\n }\n\n s->last_dc[cc] += dct_diff;\n\n if (s->mpeg_quant)\n block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision);\n else\n block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision) * (8 >> s->dct_precision);\n /* TODO: support mpeg_quant for AC coefficients */\n\n block[0] = av_clip(block[0], min, max);\n mismatch ^= block[0];\n\n /* AC Coefficients */\n while (1) {\n group = get_vlc2(&s->gb, cur_vlc->table, STUDIO_INTRA_BITS, 2);\n\n if (group < 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"illegal ac coefficient group vlc\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n additional_code_len = ac_state_tab[group][0];\n cur_vlc = &ctx->studio_intra_tab[ac_state_tab[group][1]];\n\n if (group == 0) {\n /* End of Block */\n break;\n } else if (group >= 1 && group <= 6) {\n /* Zero run length (Table B.47) */\n run = 1 << additional_code_len;\n if (additional_code_len)\n run += get_bits(&s->gb, additional_code_len);\n idx += run;\n continue;\n } else if (group >= 7 && group <= 12) {\n /* Zero run length and +/-1 level (Table B.48) */\n code = get_bits(&s->gb, additional_code_len);\n sign = code & 1;\n code >>= 1;\n run = (1 << (additional_code_len - 1)) + code;\n idx += run;\n j = scantable[idx++];\n block[j] = sign ? 1 : -1;\n } else if (group >= 13 && group <= 20) {\n /* Level value (Table B.49) */\n j = scantable[idx++];\n block[j] = get_xbits(&s->gb, additional_code_len);\n } else if (group == 21) {\n /* Escape */\n j = scantable[idx++];\n additional_code_len = s->avctx->bits_per_raw_sample + s->dct_precision + 4;\n flc = get_bits(&s->gb, additional_code_len);\n if (flc >> (additional_code_len-1))\n block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1);\n else\n block[j] = flc;\n }\n block[j] = ((8 * 2 * block[j] * quant_matrix[j] * s->qscale) >> s->dct_precision) / 32;\n block[j] = av_clip(block[j], min, max);\n mismatch ^= block[j];\n }\n\n block[63] ^= mismatch & 1;\n\n return 0;\n}","target":"static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n)\n{\n Mpeg4DecContext *ctx = s->avctx->priv_data;\n\n int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0,\n additional_code_len, sign, mismatch;\n VLC *cur_vlc = &ctx->studio_intra_tab[0];\n uint8_t *const scantable = s->intra_scantable.permutated;\n const uint16_t *quant_matrix;\n uint32_t flc;\n const int min = -1 * (1 << (s->avctx->bits_per_raw_sample + 6));\n const int max = ((1 << (s->avctx->bits_per_raw_sample + 6)) - 1);\n\n mismatch = 1;\n\n memset(block, 0, 64 * sizeof(int32_t));\n\n if (n < 4) {\n cc = 0;\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);\n quant_matrix = s->intra_matrix;\n } else {\n cc = (n & 1) + 1;\n if (ctx->rgb)\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);\n else\n dct_dc_size = get_vlc2(&s->gb, ctx->studio_chroma_dc.table, STUDIO_INTRA_BITS, 2);\n quant_matrix = s->chroma_intra_matrix;\n }\n\n if (dct_dc_size < 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"illegal dct_dc_size vlc\\n\");\n return AVERROR_INVALIDDATA;\n } else if (dct_dc_size == 0) {\n dct_diff = 0;\n } else {\n dct_diff = get_xbits(&s->gb, dct_dc_size);\n\n if (dct_dc_size > 8) {\n if(!check_marker(s->avctx, &s->gb, \"dct_dc_size > 8\"))\n return AVERROR_INVALIDDATA;\n }\n\n }\n\n s->last_dc[cc] += dct_diff;\n\n if (s->mpeg_quant)\n block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision);\n else\n block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision) * (8 >> s->dct_precision);\n /* TODO: support mpeg_quant for AC coefficients */\n\n block[0] = av_clip(block[0], min, max);\n mismatch ^= block[0];\n\n /* AC Coefficients */\n while (1) {\n group = get_vlc2(&s->gb, cur_vlc->table, STUDIO_INTRA_BITS, 2);\n\n if (group < 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"illegal ac coefficient group vlc\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n additional_code_len = ac_state_tab[group][0];\n cur_vlc = &ctx->studio_intra_tab[ac_state_tab[group][1]];\n\n if (group == 0) {\n /* End of Block */\n break;\n } else if (group >= 1 && group <= 6) {\n /* Zero run length (Table B.47) */\n run = 1 << additional_code_len;\n if (additional_code_len)\n run += get_bits(&s->gb, additional_code_len);\n idx += run;\n continue;\n } else if (group >= 7 && group <= 12) {\n /* Zero run length and +/-1 level (Table B.48) */\n code = get_bits(&s->gb, additional_code_len);\n sign = code & 1;\n code >>= 1;\n run = (1 << (additional_code_len - 1)) + code;\n idx += run;\n if (idx > 63)\n return AVERROR_INVALIDDATA;\n j = scantable[idx++];\n block[j] = sign ? 1 : -1;\n } else if (group >= 13 && group <= 20) {\n /* Level value (Table B.49) */\n if (idx > 63)\n return AVERROR_INVALIDDATA;\n j = scantable[idx++];\n block[j] = get_xbits(&s->gb, additional_code_len);\n } else if (group == 21) {\n /* Escape */\n if (idx > 63)\n return AVERROR_INVALIDDATA;\n j = scantable[idx++];\n additional_code_len = s->avctx->bits_per_raw_sample + s->dct_precision + 4;\n flc = get_bits(&s->gb, additional_code_len);\n if (flc >> (additional_code_len-1))\n block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1);\n else\n block[j] = flc;\n }\n block[j] = ((8 * 2 * block[j] * quant_matrix[j] * s->qscale) >> s->dct_precision) / 32;\n block[j] = av_clip(block[j], min, max);\n mismatch ^= block[j];\n }\n\n block[63] ^= mismatch & 1;\n\n return 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"mpeg4_decode_studio_block","file_name":"libavcodec/mpeg4videodec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/d227ed5d598340e719eff7156b1aa0a4469e9a6a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#75-07d94099ba17","input":"S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,\n regnode ** node_p,\n UV * code_point_p,\n int * cp_count,\n I32 * flagp,\n const bool strict,\n const U32 depth\n )\n{\n /* This routine teases apart the various meanings of \\N and returns\n * accordingly. The input parameters constrain which meaning(s) is/are valid\n * in the current context.\n *\n * Exactly one of and must be non-NULL.\n *\n * If is not NULL, the context is expecting the result to be a\n * single code point. If this \\N instance turns out to a single code point,\n * the function returns TRUE and sets *code_point_p to that code point.\n *\n * If is not NULL, the context is expecting the result to be one of\n * the things representable by a regnode. If this \\N instance turns out to be\n * one such, the function generates the regnode, returns TRUE and sets *node_p\n * to point to that regnode.\n *\n * If this instance of \\N isn't legal in any context, this function will\n * generate a fatal error and not return.\n *\n * On input, RExC_parse should point to the first char following the \\N at the\n * time of the call. On successful return, RExC_parse will have been updated\n * to point to just after the sequence identified by this routine. Also\n * *flagp has been updated as needed.\n *\n * When there is some problem with the current context and this \\N instance,\n * the function returns FALSE, without advancing RExC_parse, nor setting\n * *node_p, nor *code_point_p, nor *flagp.\n *\n * If is not NULL, the caller wants to know the length (in code\n * points) that this \\N sequence matches. This is set even if the function\n * returns FALSE, as detailed below.\n *\n * There are 5 possibilities here, as detailed in the next 5 paragraphs.\n *\n * Probably the most common case is for the \\N to specify a single code point.\n * *cp_count will be set to 1, and *code_point_p will be set to that code\n * point.\n *\n * Another possibility is for the input to be an empty \\N{}, which for\n * backwards compatibility we accept. *cp_count will be set to 0. *node_p\n * will be set to a generated NOTHING node.\n *\n * Still another possibility is for the \\N to mean [^\\n]. *cp_count will be\n * set to 0. *node_p will be set to a generated REG_ANY node.\n *\n * The fourth possibility is that \\N resolves to a sequence of more than one\n * code points. *cp_count will be set to the number of code points in the\n * sequence. *node_p * will be set to a generated node returned by this\n * function calling S_reg().\n *\n * The final possibility is that it is premature to be calling this function;\n * that pass1 needs to be restarted. This can happen when this changes from\n * /d to /u rules, or when the pattern needs to be upgraded to UTF-8. The\n * latter occurs only when the fourth possibility would otherwise be in\n * effect, and is because one of those code points requires the pattern to be\n * recompiled as UTF-8. The function returns FALSE, and sets the\n * RESTART_PASS1 and NEED_UTF8 flags in *flagp, as appropriate. When this\n * happens, the caller needs to desist from continuing parsing, and return\n * this information to its caller. This is not set for when there is only one\n * code point, as this can be called as part of an ANYOF node, and they can\n * store above-Latin1 code points without the pattern having to be in UTF-8.\n *\n * For non-single-quoted regexes, the tokenizer has resolved character and\n * sequence names inside \\N{...} into their Unicode values, normalizing the\n * result into what we should see here: '\\N{U+c1.c2...}', where c1... are the\n * hex-represented code points in the sequence. This is done there because\n * the names can vary based on what charnames pragma is in scope at the time,\n * so we need a way to take a snapshot of what they resolve to at the time of\n * the original parse. [perl #56444].\n *\n * That parsing is skipped for single-quoted regexes, so we may here get\n * '\\N{NAME}'. This is a fatal error. These names have to be resolved by the\n * parser. But if the single-quoted regex is something like '\\N{U+41}', that\n * is legal and handled here. The code point is Unicode, and has to be\n * translated into the native character set for non-ASCII platforms.\n */\n\n char * endbrace; /* points to '}' following the name */\n char *endchar;\t/* Points to '.' or '}' ending cur char in the input\n stream */\n char* p = RExC_parse; /* Temporary */\n\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_GROK_BSLASH_N;\n\n GET_RE_DEBUG_FLAGS;\n\n assert(cBOOL(node_p) ^ cBOOL(code_point_p)); /* Exactly one should be set */\n assert(! (node_p && cp_count)); /* At most 1 should be set */\n\n if (cp_count) { /* Initialize return for the most common case */\n *cp_count = 1;\n }\n\n /* The [^\\n] meaning of \\N ignores spaces and comments under the /x\n * modifier. The other meanings do not, so use a temporary until we find\n * out which we are being called with */\n skip_to_be_ignored_text(pRExC_state, &p,\n FALSE /* Don't force to /x */ );\n\n /* Disambiguate between \\N meaning a named character versus \\N meaning\n * [^\\n]. The latter is assumed when the {...} following the \\N is a legal\n * quantifier, or there is no '{' at all */\n if (*p != '{' || regcurly(p)) {\n\tRExC_parse = p;\n if (cp_count) {\n *cp_count = -1;\n }\n\n\tif (! node_p) {\n return FALSE;\n }\n\n\t*node_p = reg_node(pRExC_state, REG_ANY);\n\t*flagp |= HASWIDTH|SIMPLE;\n\tMARK_NAUGHTY(1);\n Set_Node_Length(*node_p, 1); /* MJD */\n\treturn TRUE;\n }\n\n /* Here, we have decided it should be a named character or sequence */\n\n /* The test above made sure that the next real character is a '{', but\n * under the /x modifier, it could be separated by space (or a comment and\n * \\n) and this is not allowed (for consistency with \\x{...} and the\n * tokenizer handling of \\N{NAME}). */\n if (*RExC_parse != '{') {\n\tvFAIL(\"Missing braces on \\\\N{}\");\n }\n\n RExC_parse++;\t/* Skip past the '{' */\n\n endbrace = strchr(RExC_parse, '}');\n if (! endbrace) { /* no trailing brace */\n vFAIL2(\"Missing right brace on \\\\%c{}\", 'N');\n }\n else if (!( endbrace == RExC_parse\t/* nothing between the {} */\n || memBEGINs(RExC_parse, /* U+ (bad hex is checked below\n for a better error msg) */\n (STRLEN) (RExC_end - RExC_parse),\n \"U+\")))\n {\n\tRExC_parse = endbrace;\t/* position msg's '<--HERE' */\n\tvFAIL(\"\\\\N{NAME} must be resolved by the lexer\");\n }\n\n REQUIRE_UNI_RULES(flagp, FALSE); /* Unicode named chars imply Unicode\n semantics */\n\n if (endbrace == RExC_parse) { /* empty: \\N{} */\n if (strict) {\n RExC_parse++; /* Position after the \"}\" */\n vFAIL(\"Zero length \\\\N{}\");\n }\n if (cp_count) {\n *cp_count = 0;\n }\n nextchar(pRExC_state);\n\tif (! node_p) {\n return FALSE;\n }\n\n *node_p = reg_node(pRExC_state,NOTHING);\n return TRUE;\n }\n\n RExC_parse += 2;\t/* Skip past the 'U+' */\n\n /* Because toke.c has generated a special construct for us guaranteed not\n * to have NULs, we can use a str function */\n endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n\n /* Code points are separated by dots. If none, there is only one code\n * point, and is terminated by the brace */\n\n if (endchar >= endbrace) {\n\tSTRLEN length_of_hex;\n\tI32 grok_hex_flags;\n\n /* Here, exactly one code point. If that isn't what is wanted, fail */\n if (! code_point_p) {\n RExC_parse = p;\n return FALSE;\n }\n\n /* Convert code point from hex */\n\tlength_of_hex = (STRLEN)(endchar - RExC_parse);\n\tgrok_hex_flags = PERL_SCAN_ALLOW_UNDERSCORES\n | PERL_SCAN_DISALLOW_PREFIX\n\n /* No errors in the first pass (See [perl\n * #122671].) We let the code below find the\n * errors when there are multiple chars. */\n | ((SIZE_ONLY)\n ? PERL_SCAN_SILENT_ILLDIGIT\n : 0);\n\n /* This routine is the one place where both single- and double-quotish\n * \\N{U+xxxx} are evaluated. The value is a Unicode code point which\n * must be converted to native. */\n\t*code_point_p = UNI_TO_NATIVE(grok_hex(RExC_parse,\n &length_of_hex,\n &grok_hex_flags,\n NULL));\n\n\t/* The tokenizer should have guaranteed validity, but it's possible to\n * bypass it by using single quoting, so check. Don't do the check\n * here when there are multiple chars; we do it below anyway. */\n if (length_of_hex == 0\n || length_of_hex != (STRLEN)(endchar - RExC_parse) )\n {\n RExC_parse += length_of_hex;\t/* Includes all the valid */\n RExC_parse += (RExC_orig_utf8)\t/* point to after 1st invalid */\n ? UTF8SKIP(RExC_parse)\n : 1;\n /* Guard against malformed utf8 */\n if (RExC_parse >= endchar) {\n RExC_parse = endchar;\n }\n vFAIL(\"Invalid hexadecimal number in \\\\N{U+...}\");\n }\n\n RExC_parse = endbrace + 1;\n return TRUE;\n }\n else { /* Is a multiple character sequence */\n\tSV * substitute_parse;\n\tSTRLEN len;\n\tchar *orig_end = RExC_end;\n\tchar *save_start = RExC_start;\n I32 flags;\n\n /* Count the code points, if desired, in the sequence */\n if (cp_count) {\n *cp_count = 0;\n while (RExC_parse < endbrace) {\n /* Point to the beginning of the next character in the sequence. */\n RExC_parse = endchar + 1;\n endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n (*cp_count)++;\n }\n }\n\n /* Fail if caller doesn't want to handle a multi-code-point sequence.\n * But don't backup up the pointer if the caller wants to know how many\n * code points there are (they can then handle things) */\n if (! node_p) {\n if (! cp_count) {\n RExC_parse = p;\n }\n return FALSE;\n }\n\n\t/* What is done here is to convert this to a sub-pattern of the form\n * \\x{char1}\\x{char2}... and then call reg recursively to parse it\n * (enclosing in \"(?: ... )\" ). That way, it retains its atomicness,\n * while not having to worry about special handling that some code\n * points may have. */\n\n\tsubstitute_parse = newSVpvs(\"?:\");\n\n\twhile (RExC_parse < endbrace) {\n\n\t /* Convert to notation the rest of the code understands */\n\t sv_catpv(substitute_parse, \"\\\\x{\");\n\t sv_catpvn(substitute_parse, RExC_parse, endchar - RExC_parse);\n\t sv_catpv(substitute_parse, \"}\");\n\n\t /* Point to the beginning of the next character in the sequence. */\n\t RExC_parse = endchar + 1;\n\t endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n\n\t}\n sv_catpv(substitute_parse, \")\");\n\n len = SvCUR(substitute_parse);\n\n\t/* Don't allow empty number */\n\tif (len < (STRLEN) 8) {\n RExC_parse = endbrace;\n\t vFAIL(\"Invalid hexadecimal number in \\\\N{U+...}\");\n\t}\n\n RExC_parse = RExC_start = RExC_adjusted_start\n = SvPV_nolen(substitute_parse);\n\tRExC_end = RExC_parse + len;\n\n /* The values are Unicode, and therefore not subject to recoding, but\n * have to be converted to native on a non-Unicode (meaning non-ASCII)\n * platform. */\n#ifdef EBCDIC\n RExC_recode_x_to_native = 1;\n#endif\n\n *node_p = reg(pRExC_state, 1, &flags, depth+1);\n\n /* Restore the saved values */\n\tRExC_start = RExC_adjusted_start = save_start;\n\tRExC_parse = endbrace;\n\tRExC_end = orig_end;\n#ifdef EBCDIC\n RExC_recode_x_to_native = 0;\n#endif\n SvREFCNT_dec_NN(substitute_parse);\n\n if (! *node_p) {\n if (flags & (RESTART_PASS1|NEED_UTF8)) {\n *flagp = flags & (RESTART_PASS1|NEED_UTF8);\n return FALSE;\n }\n FAIL2(\"panic: reg returned NULL to grok_bslash_N, flags=%#\" UVxf,\n (UV) flags);\n }\n *flagp |= flags&(HASWIDTH|SPSTART|SIMPLE|POSTPONED);\n\n nextchar(pRExC_state);\n\n return TRUE;\n }\n}","target":"S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,\n regnode ** node_p,\n UV * code_point_p,\n int * cp_count,\n I32 * flagp,\n const bool strict,\n const U32 depth\n )\n{\n /* This routine teases apart the various meanings of \\N and returns\n * accordingly. The input parameters constrain which meaning(s) is/are valid\n * in the current context.\n *\n * Exactly one of and must be non-NULL.\n *\n * If is not NULL, the context is expecting the result to be a\n * single code point. If this \\N instance turns out to a single code point,\n * the function returns TRUE and sets *code_point_p to that code point.\n *\n * If is not NULL, the context is expecting the result to be one of\n * the things representable by a regnode. If this \\N instance turns out to be\n * one such, the function generates the regnode, returns TRUE and sets *node_p\n * to point to that regnode.\n *\n * If this instance of \\N isn't legal in any context, this function will\n * generate a fatal error and not return.\n *\n * On input, RExC_parse should point to the first char following the \\N at the\n * time of the call. On successful return, RExC_parse will have been updated\n * to point to just after the sequence identified by this routine. Also\n * *flagp has been updated as needed.\n *\n * When there is some problem with the current context and this \\N instance,\n * the function returns FALSE, without advancing RExC_parse, nor setting\n * *node_p, nor *code_point_p, nor *flagp.\n *\n * If is not NULL, the caller wants to know the length (in code\n * points) that this \\N sequence matches. This is set even if the function\n * returns FALSE, as detailed below.\n *\n * There are 5 possibilities here, as detailed in the next 5 paragraphs.\n *\n * Probably the most common case is for the \\N to specify a single code point.\n * *cp_count will be set to 1, and *code_point_p will be set to that code\n * point.\n *\n * Another possibility is for the input to be an empty \\N{}, which for\n * backwards compatibility we accept. *cp_count will be set to 0. *node_p\n * will be set to a generated NOTHING node.\n *\n * Still another possibility is for the \\N to mean [^\\n]. *cp_count will be\n * set to 0. *node_p will be set to a generated REG_ANY node.\n *\n * The fourth possibility is that \\N resolves to a sequence of more than one\n * code points. *cp_count will be set to the number of code points in the\n * sequence. *node_p * will be set to a generated node returned by this\n * function calling S_reg().\n *\n * The final possibility is that it is premature to be calling this function;\n * that pass1 needs to be restarted. This can happen when this changes from\n * /d to /u rules, or when the pattern needs to be upgraded to UTF-8. The\n * latter occurs only when the fourth possibility would otherwise be in\n * effect, and is because one of those code points requires the pattern to be\n * recompiled as UTF-8. The function returns FALSE, and sets the\n * RESTART_PASS1 and NEED_UTF8 flags in *flagp, as appropriate. When this\n * happens, the caller needs to desist from continuing parsing, and return\n * this information to its caller. This is not set for when there is only one\n * code point, as this can be called as part of an ANYOF node, and they can\n * store above-Latin1 code points without the pattern having to be in UTF-8.\n *\n * For non-single-quoted regexes, the tokenizer has resolved character and\n * sequence names inside \\N{...} into their Unicode values, normalizing the\n * result into what we should see here: '\\N{U+c1.c2...}', where c1... are the\n * hex-represented code points in the sequence. This is done there because\n * the names can vary based on what charnames pragma is in scope at the time,\n * so we need a way to take a snapshot of what they resolve to at the time of\n * the original parse. [perl #56444].\n *\n * That parsing is skipped for single-quoted regexes, so we may here get\n * '\\N{NAME}'. This is a fatal error. These names have to be resolved by the\n * parser. But if the single-quoted regex is something like '\\N{U+41}', that\n * is legal and handled here. The code point is Unicode, and has to be\n * translated into the native character set for non-ASCII platforms.\n */\n\n char * endbrace; /* points to '}' following the name */\n char *endchar;\t/* Points to '.' or '}' ending cur char in the input\n stream */\n char* p = RExC_parse; /* Temporary */\n\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_GROK_BSLASH_N;\n\n GET_RE_DEBUG_FLAGS;\n\n assert(cBOOL(node_p) ^ cBOOL(code_point_p)); /* Exactly one should be set */\n assert(! (node_p && cp_count)); /* At most 1 should be set */\n\n if (cp_count) { /* Initialize return for the most common case */\n *cp_count = 1;\n }\n\n /* The [^\\n] meaning of \\N ignores spaces and comments under the /x\n * modifier. The other meanings do not, so use a temporary until we find\n * out which we are being called with */\n skip_to_be_ignored_text(pRExC_state, &p,\n FALSE /* Don't force to /x */ );\n\n /* Disambiguate between \\N meaning a named character versus \\N meaning\n * [^\\n]. The latter is assumed when the {...} following the \\N is a legal\n * quantifier, or there is no '{' at all */\n if (*p != '{' || regcurly(p)) {\n\tRExC_parse = p;\n if (cp_count) {\n *cp_count = -1;\n }\n\n\tif (! node_p) {\n return FALSE;\n }\n\n\t*node_p = reg_node(pRExC_state, REG_ANY);\n\t*flagp |= HASWIDTH|SIMPLE;\n\tMARK_NAUGHTY(1);\n Set_Node_Length(*node_p, 1); /* MJD */\n\treturn TRUE;\n }\n\n /* Here, we have decided it should be a named character or sequence */\n\n /* The test above made sure that the next real character is a '{', but\n * under the /x modifier, it could be separated by space (or a comment and\n * \\n) and this is not allowed (for consistency with \\x{...} and the\n * tokenizer handling of \\N{NAME}). */\n if (*RExC_parse != '{') {\n\tvFAIL(\"Missing braces on \\\\N{}\");\n }\n\n RExC_parse++;\t/* Skip past the '{' */\n\n endbrace = (char *) memchr(RExC_parse, '}', RExC_end - RExC_parse);\n if (! endbrace) { /* no trailing brace */\n vFAIL2(\"Missing right brace on \\\\%c{}\", 'N');\n }\n else if (!( endbrace == RExC_parse\t/* nothing between the {} */\n || memBEGINs(RExC_parse, /* U+ (bad hex is checked below\n for a better error msg) */\n (STRLEN) (RExC_end - RExC_parse),\n \"U+\")))\n {\n\tRExC_parse = endbrace;\t/* position msg's '<--HERE' */\n\tvFAIL(\"\\\\N{NAME} must be resolved by the lexer\");\n }\n\n REQUIRE_UNI_RULES(flagp, FALSE); /* Unicode named chars imply Unicode\n semantics */\n\n if (endbrace == RExC_parse) { /* empty: \\N{} */\n if (strict) {\n RExC_parse++; /* Position after the \"}\" */\n vFAIL(\"Zero length \\\\N{}\");\n }\n if (cp_count) {\n *cp_count = 0;\n }\n nextchar(pRExC_state);\n\tif (! node_p) {\n return FALSE;\n }\n\n *node_p = reg_node(pRExC_state,NOTHING);\n return TRUE;\n }\n\n RExC_parse += 2;\t/* Skip past the 'U+' */\n\n /* Because toke.c has generated a special construct for us guaranteed not\n * to have NULs, we can use a str function */\n endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n\n /* Code points are separated by dots. If none, there is only one code\n * point, and is terminated by the brace */\n\n if (endchar >= endbrace) {\n\tSTRLEN length_of_hex;\n\tI32 grok_hex_flags;\n\n /* Here, exactly one code point. If that isn't what is wanted, fail */\n if (! code_point_p) {\n RExC_parse = p;\n return FALSE;\n }\n\n /* Convert code point from hex */\n\tlength_of_hex = (STRLEN)(endchar - RExC_parse);\n\tgrok_hex_flags = PERL_SCAN_ALLOW_UNDERSCORES\n | PERL_SCAN_DISALLOW_PREFIX\n\n /* No errors in the first pass (See [perl\n * #122671].) We let the code below find the\n * errors when there are multiple chars. */\n | ((SIZE_ONLY)\n ? PERL_SCAN_SILENT_ILLDIGIT\n : 0);\n\n /* This routine is the one place where both single- and double-quotish\n * \\N{U+xxxx} are evaluated. The value is a Unicode code point which\n * must be converted to native. */\n\t*code_point_p = UNI_TO_NATIVE(grok_hex(RExC_parse,\n &length_of_hex,\n &grok_hex_flags,\n NULL));\n\n\t/* The tokenizer should have guaranteed validity, but it's possible to\n * bypass it by using single quoting, so check. Don't do the check\n * here when there are multiple chars; we do it below anyway. */\n if (length_of_hex == 0\n || length_of_hex != (STRLEN)(endchar - RExC_parse) )\n {\n RExC_parse += length_of_hex;\t/* Includes all the valid */\n RExC_parse += (RExC_orig_utf8)\t/* point to after 1st invalid */\n ? UTF8SKIP(RExC_parse)\n : 1;\n /* Guard against malformed utf8 */\n if (RExC_parse >= endchar) {\n RExC_parse = endchar;\n }\n vFAIL(\"Invalid hexadecimal number in \\\\N{U+...}\");\n }\n\n RExC_parse = endbrace + 1;\n return TRUE;\n }\n else { /* Is a multiple character sequence */\n\tSV * substitute_parse;\n\tSTRLEN len;\n\tchar *orig_end = RExC_end;\n\tchar *save_start = RExC_start;\n I32 flags;\n\n /* Count the code points, if desired, in the sequence */\n if (cp_count) {\n *cp_count = 0;\n while (RExC_parse < endbrace) {\n /* Point to the beginning of the next character in the sequence. */\n RExC_parse = endchar + 1;\n endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n (*cp_count)++;\n }\n }\n\n /* Fail if caller doesn't want to handle a multi-code-point sequence.\n * But don't backup up the pointer if the caller wants to know how many\n * code points there are (they can then handle things) */\n if (! node_p) {\n if (! cp_count) {\n RExC_parse = p;\n }\n return FALSE;\n }\n\n\t/* What is done here is to convert this to a sub-pattern of the form\n * \\x{char1}\\x{char2}... and then call reg recursively to parse it\n * (enclosing in \"(?: ... )\" ). That way, it retains its atomicness,\n * while not having to worry about special handling that some code\n * points may have. */\n\n\tsubstitute_parse = newSVpvs(\"?:\");\n\n\twhile (RExC_parse < endbrace) {\n\n\t /* Convert to notation the rest of the code understands */\n\t sv_catpv(substitute_parse, \"\\\\x{\");\n\t sv_catpvn(substitute_parse, RExC_parse, endchar - RExC_parse);\n\t sv_catpv(substitute_parse, \"}\");\n\n\t /* Point to the beginning of the next character in the sequence. */\n\t RExC_parse = endchar + 1;\n\t endchar = RExC_parse + strcspn(RExC_parse, \".}\");\n\n\t}\n sv_catpv(substitute_parse, \")\");\n\n len = SvCUR(substitute_parse);\n\n\t/* Don't allow empty number */\n\tif (len < (STRLEN) 8) {\n RExC_parse = endbrace;\n\t vFAIL(\"Invalid hexadecimal number in \\\\N{U+...}\");\n\t}\n\n RExC_parse = RExC_start = RExC_adjusted_start\n = SvPV_nolen(substitute_parse);\n\tRExC_end = RExC_parse + len;\n\n /* The values are Unicode, and therefore not subject to recoding, but\n * have to be converted to native on a non-Unicode (meaning non-ASCII)\n * platform. */\n#ifdef EBCDIC\n RExC_recode_x_to_native = 1;\n#endif\n\n *node_p = reg(pRExC_state, 1, &flags, depth+1);\n\n /* Restore the saved values */\n\tRExC_start = RExC_adjusted_start = save_start;\n\tRExC_parse = endbrace;\n\tRExC_end = orig_end;\n#ifdef EBCDIC\n RExC_recode_x_to_native = 0;\n#endif\n SvREFCNT_dec_NN(substitute_parse);\n\n if (! *node_p) {\n if (flags & (RESTART_PASS1|NEED_UTF8)) {\n *flagp = flags & (RESTART_PASS1|NEED_UTF8);\n return FALSE;\n }\n FAIL2(\"panic: reg returned NULL to grok_bslash_N, flags=%#\" UVxf,\n (UV) flags);\n }\n *flagp |= flags&(HASWIDTH|SPSTART|SIMPLE|POSTPONED);\n\n nextchar(pRExC_state);\n\n return TRUE;\n }\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"S_grok_bslash_N","file_name":"regcomp.c","commit_link":"github.com/Perl/perl5/commit/43b2f4ef399e2fd7240b4eeb0658686ad95f8e62","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#76-d3549ed8811e","input":"ssize_t enc_untrusted_read(int fd, void *buf, size_t count) {\n return static_cast(EnsureInitializedAndDispatchSyscall(\n asylo::system_call::kSYS_read, fd, buf, count));\n}","target":"ssize_t enc_untrusted_read(int fd, void *buf, size_t count) {\n ssize_t ret = static_cast(EnsureInitializedAndDispatchSyscall(\n asylo::system_call::kSYS_read, fd, buf, count));\n if (ret != -1 && ret > count) {\n ::asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_read: read result exceeds requested\");\n }\n return ret;\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"enc_untrusted_read","file_name":"asylo/platform/host_call/trusted/host_calls.cc","commit_link":"github.com/google/asylo/commit/b1d120a2c7d7446d2cc58d517e20a1b184b82200","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#77-18555a38a752","input":"int WavpackVerifySingleBlock (unsigned char *buffer, int verify_checksum)\n{\n WavpackHeader *wphdr = (WavpackHeader *) buffer;\n uint32_t checksum_passed = 0, bcount, meta_bc;\n unsigned char *dp, meta_id, c1, c2;\n\n if (strncmp (wphdr->ckID, \"wvpk\", 4) || wphdr->ckSize + 8 < sizeof (WavpackHeader))\n return FALSE;\n\n bcount = wphdr->ckSize - sizeof (WavpackHeader) + 8;\n dp = (unsigned char *)(wphdr + 1);\n\n while (bcount >= 2) {\n meta_id = *dp++;\n c1 = *dp++;\n\n meta_bc = c1 << 1;\n bcount -= 2;\n\n if (meta_id & ID_LARGE) {\n if (bcount < 2)\n return FALSE;\n\n c1 = *dp++;\n c2 = *dp++;\n meta_bc += ((uint32_t) c1 << 9) + ((uint32_t) c2 << 17);\n bcount -= 2;\n }\n\n if (bcount < meta_bc)\n return FALSE;\n\n if (verify_checksum && (meta_id & ID_UNIQUE) == ID_BLOCK_CHECKSUM) {\n#ifdef BITSTREAM_SHORTS\n uint16_t *csptr = (uint16_t*) buffer;\n#else\n unsigned char *csptr = buffer;\n#endif\n int wcount = (int)(dp - 2 - buffer) >> 1;\n uint32_t csum = (uint32_t) -1;\n\n if ((meta_id & ID_ODD_SIZE) || meta_bc < 2 || meta_bc > 4)\n return FALSE;\n\n#ifdef BITSTREAM_SHORTS\n while (wcount--)\n csum = (csum * 3) + *csptr++;\n#else\n WavpackNativeToLittleEndian ((WavpackHeader *) buffer, WavpackHeaderFormat);\n\n while (wcount--) {\n csum = (csum * 3) + csptr [0] + (csptr [1] << 8);\n csptr += 2;\n }\n\n WavpackLittleEndianToNative ((WavpackHeader *) buffer, WavpackHeaderFormat);\n#endif\n\n if (meta_bc == 4) {\n if (*dp++ != (csum & 0xff) || *dp++ != ((csum >> 8) & 0xff) || *dp++ != ((csum >> 16) & 0xff) || *dp++ != ((csum >> 24) & 0xff))\n return FALSE;\n }\n else {\n csum ^= csum >> 16;\n\n if (*dp++ != (csum & 0xff) || *dp++ != ((csum >> 8) & 0xff))\n return FALSE;\n }\n\n checksum_passed++;\n }\n\n bcount -= meta_bc;\n dp += meta_bc;\n }\n\n return (bcount == 0) && (!verify_checksum || !(wphdr->flags & HAS_CHECKSUM) || checksum_passed);\n}","target":"int WavpackVerifySingleBlock (unsigned char *buffer, int verify_checksum)\n{\n WavpackHeader *wphdr = (WavpackHeader *) buffer;\n uint32_t checksum_passed = 0, bcount, meta_bc;\n unsigned char *dp, meta_id, c1, c2;\n\n if (strncmp (wphdr->ckID, \"wvpk\", 4) || wphdr->ckSize + 8 < sizeof (WavpackHeader))\n return FALSE;\n\n bcount = wphdr->ckSize - sizeof (WavpackHeader) + 8;\n dp = (unsigned char *)(wphdr + 1);\n\n while (bcount >= 2) {\n meta_id = *dp++;\n c1 = *dp++;\n\n meta_bc = c1 << 1;\n bcount -= 2;\n\n if (meta_id & ID_LARGE) {\n if (bcount < 2)\n return FALSE;\n\n c1 = *dp++;\n c2 = *dp++;\n meta_bc += ((uint32_t) c1 << 9) + ((uint32_t) c2 << 17);\n bcount -= 2;\n }\n\n if (bcount < meta_bc)\n return FALSE;\n\n if (verify_checksum && (meta_id & ID_UNIQUE) == ID_BLOCK_CHECKSUM) {\n#ifdef BITSTREAM_SHORTS\n uint16_t *csptr = (uint16_t*) buffer;\n#else\n unsigned char *csptr = buffer;\n#endif\n int wcount = (int)(dp - 2 - buffer) >> 1;\n uint32_t csum = (uint32_t) -1;\n\n if ((meta_id & ID_ODD_SIZE) || meta_bc < 2 || meta_bc > 4)\n return FALSE;\n\n#ifdef BITSTREAM_SHORTS\n while (wcount--)\n csum = (csum * 3) + *csptr++;\n#else\n WavpackNativeToLittleEndian ((WavpackHeader *) buffer, WavpackHeaderFormat);\n\n while (wcount--) {\n csum = (csum * 3) + csptr [0] + (csptr [1] << 8);\n csptr += 2;\n }\n\n WavpackLittleEndianToNative ((WavpackHeader *) buffer, WavpackHeaderFormat);\n#endif\n\n if (meta_bc == 4) {\n if (*dp != (csum & 0xff) || dp[1] != ((csum >> 8) & 0xff) || dp[2] != ((csum >> 16) & 0xff) || dp[3] != ((csum >> 24) & 0xff))\n return FALSE;\n }\n else {\n csum ^= csum >> 16;\n\n if (*dp != (csum & 0xff) || dp[1] != ((csum >> 8) & 0xff))\n return FALSE;\n }\n\n checksum_passed++;\n }\n\n bcount -= meta_bc;\n dp += meta_bc;\n }\n\n return (bcount == 0) && (!verify_checksum || !(wphdr->flags & HAS_CHECKSUM) || checksum_passed);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"WavpackVerifySingleBlock","file_name":"src/open_utils.c","commit_link":"github.com/dbry/WavPack/commit/bba5389dc598a92bdf2b297c3ea34620b6679b5b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#78-39c4e0c6097d","input":"static Image *ReadVIFFImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n#define VFF_CM_genericRGB 15\n#define VFF_CM_ntscRGB 1\n#define VFF_CM_NONE 0\n#define VFF_DEP_DECORDER 0x4\n#define VFF_DEP_NSORDER 0x8\n#define VFF_DES_RAW 0\n#define VFF_LOC_IMPLICIT 1\n#define VFF_MAPTYP_NONE 0\n#define VFF_MAPTYP_1_BYTE 1\n#define VFF_MAPTYP_2_BYTE 2\n#define VFF_MAPTYP_4_BYTE 4\n#define VFF_MAPTYP_FLOAT 5\n#define VFF_MAPTYP_DOUBLE 7\n#define VFF_MS_NONE 0\n#define VFF_MS_ONEPERBAND 1\n#define VFF_MS_SHARED 3\n#define VFF_TYP_BIT 0\n#define VFF_TYP_1_BYTE 1\n#define VFF_TYP_2_BYTE 2\n#define VFF_TYP_4_BYTE 4\n#define VFF_TYP_FLOAT 5\n#define VFF_TYP_DOUBLE 9\n\n typedef struct _ViffInfo\n {\n unsigned char\n identifier,\n file_type,\n release,\n version,\n machine_dependency,\n reserve[3];\n\n char\n comment[512];\n\n unsigned int\n rows,\n columns,\n subrows;\n\n int\n x_offset,\n y_offset;\n\n float\n x_bits_per_pixel,\n y_bits_per_pixel;\n\n unsigned int\n location_type,\n location_dimension,\n number_of_images,\n number_data_bands,\n data_storage_type,\n data_encode_scheme,\n map_scheme,\n map_storage_type,\n map_rows,\n map_columns,\n map_subrows,\n map_enable,\n maps_per_cycle,\n color_space_model;\n } ViffInfo;\n\n double\n min_value,\n scale_factor,\n value;\n\n Image\n *image;\n\n int\n bit;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n register IndexPacket\n *indexes;\n\n register ssize_t\n x;\n\n register PixelPacket\n *q;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n bytes_per_pixel,\n max_packets,\n quantum;\n\n ssize_t\n count,\n y;\n\n unsigned char\n *pixels;\n\n unsigned long\n lsb_first;\n\n ViffInfo\n viff_info;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read VIFF header (1024 bytes).\n */\n count=ReadBlob(image,1,&viff_info.identifier);\n do\n {\n /*\n Verify VIFF identifier.\n */\n if ((count != 1) || ((unsigned char) viff_info.identifier != 0xab))\n ThrowReaderException(CorruptImageError,\"NotAVIFFImage\");\n /*\n Initialize VIFF image.\n */\n (void) ReadBlob(image,sizeof(viff_info.file_type),&viff_info.file_type);\n (void) ReadBlob(image,sizeof(viff_info.release),&viff_info.release);\n (void) ReadBlob(image,sizeof(viff_info.version),&viff_info.version);\n (void) ReadBlob(image,sizeof(viff_info.machine_dependency),\n &viff_info.machine_dependency);\n (void) ReadBlob(image,sizeof(viff_info.reserve),viff_info.reserve);\n (void) ReadBlob(image,512,(unsigned char *) viff_info.comment);\n viff_info.comment[511]='\\0';\n if (strlen(viff_info.comment) > 4)\n (void) SetImageProperty(image,\"comment\",viff_info.comment);\n if ((viff_info.machine_dependency == VFF_DEP_DECORDER) ||\n (viff_info.machine_dependency == VFF_DEP_NSORDER))\n image->endian=LSBEndian;\n else\n image->endian=MSBEndian;\n viff_info.rows=ReadBlobLong(image);\n viff_info.columns=ReadBlobLong(image);\n viff_info.subrows=ReadBlobLong(image);\n viff_info.x_offset=(int) ReadBlobLong(image);\n viff_info.y_offset=(int) ReadBlobLong(image);\n viff_info.x_bits_per_pixel=(float) ReadBlobLong(image);\n viff_info.y_bits_per_pixel=(float) ReadBlobLong(image);\n viff_info.location_type=ReadBlobLong(image);\n viff_info.location_dimension=ReadBlobLong(image);\n viff_info.number_of_images=ReadBlobLong(image);\n viff_info.number_data_bands=ReadBlobLong(image);\n viff_info.data_storage_type=ReadBlobLong(image);\n viff_info.data_encode_scheme=ReadBlobLong(image);\n viff_info.map_scheme=ReadBlobLong(image);\n viff_info.map_storage_type=ReadBlobLong(image);\n viff_info.map_rows=ReadBlobLong(image);\n viff_info.map_columns=ReadBlobLong(image);\n viff_info.map_subrows=ReadBlobLong(image);\n viff_info.map_enable=ReadBlobLong(image);\n viff_info.maps_per_cycle=ReadBlobLong(image);\n viff_info.color_space_model=ReadBlobLong(image);\n for (i=0; i < 420; i++)\n (void) ReadBlobByte(image);\n if (EOFBlob(image) != MagickFalse)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n image->columns=viff_info.rows;\n image->rows=viff_info.columns;\n image->depth=viff_info.x_bits_per_pixel <= 8 ? 8UL :\n MAGICKCORE_QUANTUM_DEPTH;\n /*\n Verify that we can read this VIFF image.\n */\n number_pixels=(MagickSizeType) viff_info.columns*viff_info.rows;\n if (number_pixels != (size_t) number_pixels)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (number_pixels == 0)\n ThrowReaderException(CoderError,\"ImageColumnOrRowSizeIsNotSupported\");\n if ((viff_info.number_data_bands < 1) || (viff_info.number_data_bands > 4))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((viff_info.data_storage_type != VFF_TYP_BIT) &&\n (viff_info.data_storage_type != VFF_TYP_1_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_2_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_4_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_FLOAT) &&\n (viff_info.data_storage_type != VFF_TYP_DOUBLE))\n ThrowReaderException(CoderError,\"DataStorageTypeIsNotSupported\");\n if (viff_info.data_encode_scheme != VFF_DES_RAW)\n ThrowReaderException(CoderError,\"DataEncodingSchemeIsNotSupported\");\n if ((viff_info.map_storage_type != VFF_MAPTYP_NONE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_1_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_2_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_4_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_FLOAT) &&\n (viff_info.map_storage_type != VFF_MAPTYP_DOUBLE))\n ThrowReaderException(CoderError,\"MapStorageTypeIsNotSupported\");\n if ((viff_info.color_space_model != VFF_CM_NONE) &&\n (viff_info.color_space_model != VFF_CM_ntscRGB) &&\n (viff_info.color_space_model != VFF_CM_genericRGB))\n ThrowReaderException(CoderError,\"ColorspaceModelIsNotSupported\");\n if (viff_info.location_type != VFF_LOC_IMPLICIT)\n ThrowReaderException(CoderError,\"LocationTypeIsNotSupported\");\n if (viff_info.number_of_images != 1)\n ThrowReaderException(CoderError,\"NumberOfImagesIsNotSupported\");\n if (viff_info.map_rows == 0)\n viff_info.map_scheme=VFF_MS_NONE;\n switch ((int) viff_info.map_scheme)\n {\n case VFF_MS_NONE:\n {\n if (viff_info.number_data_bands < 3)\n {\n /*\n Create linear color ramp.\n */\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n image->colors=2;\n else\n if (viff_info.data_storage_type == VFF_MAPTYP_1_BYTE)\n image->colors=256UL;\n else\n image->colors=image->depth <= 8 ? 256UL : 65536UL;\n if (AcquireImageColormap(image,image->colors) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n break;\n }\n case VFF_MS_ONEPERBAND:\n case VFF_MS_SHARED:\n {\n unsigned char\n *viff_colormap;\n\n /*\n Allocate VIFF colormap.\n */\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_1_BYTE: bytes_per_pixel=1; break;\n case VFF_MAPTYP_2_BYTE: bytes_per_pixel=2; break;\n case VFF_MAPTYP_4_BYTE: bytes_per_pixel=4; break;\n case VFF_MAPTYP_FLOAT: bytes_per_pixel=4; break;\n case VFF_MAPTYP_DOUBLE: bytes_per_pixel=8; break;\n default: bytes_per_pixel=1; break;\n }\n image->colors=viff_info.map_columns;\n if (AcquireImageColormap(image,image->colors) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (viff_info.map_rows >\n (viff_info.map_rows*bytes_per_pixel*sizeof(*viff_colormap)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n viff_colormap=(unsigned char *) AcquireQuantumMemory(image->colors,\n viff_info.map_rows*bytes_per_pixel*sizeof(*viff_colormap));\n if (viff_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n /*\n Read VIFF raster colormap.\n */\n (void) ReadBlob(image,bytes_per_pixel*image->colors*viff_info.map_rows,\n viff_colormap);\n lsb_first=1;\n if (*(char *) &lsb_first &&\n ((viff_info.machine_dependency != VFF_DEP_DECORDER) &&\n (viff_info.machine_dependency != VFF_DEP_NSORDER)))\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_2_BYTE:\n {\n MSBOrderShort(viff_colormap,(bytes_per_pixel*image->colors*\n viff_info.map_rows));\n break;\n }\n case VFF_MAPTYP_4_BYTE:\n case VFF_MAPTYP_FLOAT:\n {\n MSBOrderLong(viff_colormap,(bytes_per_pixel*image->colors*\n viff_info.map_rows));\n break;\n }\n default: break;\n }\n for (i=0; i < (ssize_t) (viff_info.map_rows*image->colors); i++)\n {\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_2_BYTE: value=1.0*((short *) viff_colormap)[i]; break;\n case VFF_MAPTYP_4_BYTE: value=1.0*((int *) viff_colormap)[i]; break;\n case VFF_MAPTYP_FLOAT: value=((float *) viff_colormap)[i]; break;\n case VFF_MAPTYP_DOUBLE: value=((double *) viff_colormap)[i]; break;\n default: value=1.0*viff_colormap[i]; break;\n }\n if (i < (ssize_t) image->colors)\n {\n image->colormap[i].red=ScaleCharToQuantum((unsigned char) value);\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n value);\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char) value);\n }\n else\n if (i < (ssize_t) (2*image->colors))\n image->colormap[i % image->colors].green=ScaleCharToQuantum(\n (unsigned char) value);\n else\n if (i < (ssize_t) (3*image->colors))\n image->colormap[i % image->colors].blue=ScaleCharToQuantum(\n (unsigned char) value);\n }\n viff_colormap=(unsigned char *) RelinquishMagickMemory(viff_colormap);\n break;\n }\n default:\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n }\n /*\n Initialize image structure.\n */\n image->matte=viff_info.number_data_bands == 4 ? MagickTrue : MagickFalse;\n image->storage_class=\n (viff_info.number_data_bands < 3 ? PseudoClass : DirectClass);\n image->columns=viff_info.rows;\n image->rows=viff_info.columns;\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n /*\n Allocate VIFF pixels.\n */\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: bytes_per_pixel=2; break;\n case VFF_TYP_4_BYTE: bytes_per_pixel=4; break;\n case VFF_TYP_FLOAT: bytes_per_pixel=4; break;\n case VFF_TYP_DOUBLE: bytes_per_pixel=8; break;\n default: bytes_per_pixel=1; break;\n }\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n max_packets=((image->columns+7UL) >> 3UL)*image->rows;\n else\n max_packets=(size_t) (number_pixels*viff_info.number_data_bands);\n pixels=(unsigned char *) AcquireQuantumMemory(max_packets,\n bytes_per_pixel*sizeof(*pixels));\n if (pixels == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ReadBlob(image,bytes_per_pixel*max_packets,pixels);\n lsb_first=1;\n if (*(char *) &lsb_first &&\n ((viff_info.machine_dependency != VFF_DEP_DECORDER) &&\n (viff_info.machine_dependency != VFF_DEP_NSORDER)))\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE:\n {\n MSBOrderShort(pixels,bytes_per_pixel*max_packets);\n break;\n }\n case VFF_TYP_4_BYTE:\n case VFF_TYP_FLOAT:\n {\n MSBOrderLong(pixels,bytes_per_pixel*max_packets);\n break;\n }\n default: break;\n }\n min_value=0.0;\n scale_factor=1.0;\n if ((viff_info.data_storage_type != VFF_TYP_1_BYTE) &&\n (viff_info.map_scheme == VFF_MS_NONE))\n {\n double\n max_value;\n\n /*\n Determine scale factor.\n */\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[0]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[0]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[0]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[0]; break;\n default: value=1.0*pixels[0]; break;\n }\n max_value=value;\n min_value=value;\n for (i=0; i < (ssize_t) max_packets; i++)\n {\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[i]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[i]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[i]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[i]; break;\n default: value=1.0*pixels[i]; break;\n }\n if (value > max_value)\n max_value=value;\n else\n if (value < min_value)\n min_value=value;\n }\n if ((min_value == 0) && (max_value == 0))\n scale_factor=0;\n else\n if (min_value == max_value)\n {\n scale_factor=(MagickRealType) QuantumRange/min_value;\n min_value=0;\n }\n else\n scale_factor=(MagickRealType) QuantumRange/(max_value-min_value);\n }\n /*\n Convert pixels to Quantum size.\n */\n p=(unsigned char *) pixels;\n for (i=0; i < (ssize_t) max_packets; i++)\n {\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[i]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[i]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[i]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[i]; break;\n default: value=1.0*pixels[i]; break;\n }\n if (viff_info.map_scheme == VFF_MS_NONE)\n {\n value=(value-min_value)*scale_factor;\n if (value > QuantumRange)\n value=QuantumRange;\n else\n if (value < 0)\n value=0;\n }\n *p=(unsigned char) ((Quantum) value);\n p++;\n }\n /*\n Convert VIFF raster image to pixel packets.\n */\n p=(unsigned char *) pixels;\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n {\n /*\n Convert bitmap scanline.\n */\n if (image->storage_class != PseudoClass)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < (ssize_t) (image->columns-7); x+=8)\n {\n for (bit=0; bit < 8; bit++)\n {\n quantum=(size_t) ((*p) & (0x01 << bit) ? 0 : 1);\n SetPixelRed(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelGreen(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelBlue(q,quantum == 0 ? 0 : QuantumRange);\n if (image->storage_class == PseudoClass)\n SetPixelIndex(indexes+x+bit,quantum);\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=0; bit < (int) (image->columns % 8); bit++)\n {\n quantum=(size_t) ((*p) & (0x01 << bit) ? 0 : 1);\n SetPixelRed(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelGreen(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelBlue(q,quantum == 0 ? 0 : QuantumRange);\n if (image->storage_class == PseudoClass)\n SetPixelIndex(indexes+x+bit,quantum);\n }\n p++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n if (image->storage_class == PseudoClass)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n SetPixelIndex(indexes+x,*p++);\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n else\n {\n /*\n Convert DirectColor scanline.\n */\n number_pixels=(MagickSizeType) image->columns*image->rows;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(q,ScaleCharToQuantum(*p));\n SetPixelGreen(q,ScaleCharToQuantum(*(p+number_pixels)));\n SetPixelBlue(q,ScaleCharToQuantum(*(p+2*number_pixels)));\n if (image->colors != 0)\n {\n ssize_t\n index;\n\n index=(ssize_t) GetPixelRed(q);\n SetPixelRed(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].red);\n index=(ssize_t) GetPixelGreen(q);\n SetPixelGreen(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].green);\n index=(ssize_t) GetPixelRed(q);\n SetPixelBlue(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].blue);\n }\n SetPixelOpacity(q,image->matte != MagickFalse ? QuantumRange-\n ScaleCharToQuantum(*(p+number_pixels*3)) : OpaqueOpacity);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n pixels=(unsigned char *) RelinquishMagickMemory(pixels);\n if (image->storage_class == PseudoClass)\n (void) SyncImage(image);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n count=ReadBlob(image,1,&viff_info.identifier);\n if ((count != 0) && (viff_info.identifier == 0xab))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while ((count != 0) && (viff_info.identifier == 0xab));\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadVIFFImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n#define VFF_CM_genericRGB 15\n#define VFF_CM_ntscRGB 1\n#define VFF_CM_NONE 0\n#define VFF_DEP_DECORDER 0x4\n#define VFF_DEP_NSORDER 0x8\n#define VFF_DES_RAW 0\n#define VFF_LOC_IMPLICIT 1\n#define VFF_MAPTYP_NONE 0\n#define VFF_MAPTYP_1_BYTE 1\n#define VFF_MAPTYP_2_BYTE 2\n#define VFF_MAPTYP_4_BYTE 4\n#define VFF_MAPTYP_FLOAT 5\n#define VFF_MAPTYP_DOUBLE 7\n#define VFF_MS_NONE 0\n#define VFF_MS_ONEPERBAND 1\n#define VFF_MS_SHARED 3\n#define VFF_TYP_BIT 0\n#define VFF_TYP_1_BYTE 1\n#define VFF_TYP_2_BYTE 2\n#define VFF_TYP_4_BYTE 4\n#define VFF_TYP_FLOAT 5\n#define VFF_TYP_DOUBLE 9\n\n typedef struct _ViffInfo\n {\n unsigned char\n identifier,\n file_type,\n release,\n version,\n machine_dependency,\n reserve[3];\n\n char\n comment[512];\n\n unsigned int\n rows,\n columns,\n subrows;\n\n int\n x_offset,\n y_offset;\n\n float\n x_bits_per_pixel,\n y_bits_per_pixel;\n\n unsigned int\n location_type,\n location_dimension,\n number_of_images,\n number_data_bands,\n data_storage_type,\n data_encode_scheme,\n map_scheme,\n map_storage_type,\n map_rows,\n map_columns,\n map_subrows,\n map_enable,\n maps_per_cycle,\n color_space_model;\n } ViffInfo;\n\n double\n min_value,\n scale_factor,\n value;\n\n Image\n *image;\n\n int\n bit;\n\n MagickBooleanType\n status;\n\n MagickSizeType\n number_pixels;\n\n register IndexPacket\n *indexes;\n\n register ssize_t\n x;\n\n register PixelPacket\n *q;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n bytes_per_pixel,\n max_packets,\n quantum;\n\n ssize_t\n count,\n y;\n\n unsigned char\n *pixels;\n\n unsigned long\n lsb_first;\n\n ViffInfo\n viff_info;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read VIFF header (1024 bytes).\n */\n count=ReadBlob(image,1,&viff_info.identifier);\n do\n {\n /*\n Verify VIFF identifier.\n */\n if ((count != 1) || ((unsigned char) viff_info.identifier != 0xab))\n ThrowReaderException(CorruptImageError,\"NotAVIFFImage\");\n /*\n Initialize VIFF image.\n */\n (void) ReadBlob(image,sizeof(viff_info.file_type),&viff_info.file_type);\n (void) ReadBlob(image,sizeof(viff_info.release),&viff_info.release);\n (void) ReadBlob(image,sizeof(viff_info.version),&viff_info.version);\n (void) ReadBlob(image,sizeof(viff_info.machine_dependency),\n &viff_info.machine_dependency);\n (void) ReadBlob(image,sizeof(viff_info.reserve),viff_info.reserve);\n (void) ReadBlob(image,512,(unsigned char *) viff_info.comment);\n viff_info.comment[511]='\\0';\n if (strlen(viff_info.comment) > 4)\n (void) SetImageProperty(image,\"comment\",viff_info.comment);\n if ((viff_info.machine_dependency == VFF_DEP_DECORDER) ||\n (viff_info.machine_dependency == VFF_DEP_NSORDER))\n image->endian=LSBEndian;\n else\n image->endian=MSBEndian;\n viff_info.rows=ReadBlobLong(image);\n viff_info.columns=ReadBlobLong(image);\n viff_info.subrows=ReadBlobLong(image);\n viff_info.x_offset=(int) ReadBlobLong(image);\n viff_info.y_offset=(int) ReadBlobLong(image);\n viff_info.x_bits_per_pixel=(float) ReadBlobLong(image);\n viff_info.y_bits_per_pixel=(float) ReadBlobLong(image);\n viff_info.location_type=ReadBlobLong(image);\n viff_info.location_dimension=ReadBlobLong(image);\n viff_info.number_of_images=ReadBlobLong(image);\n viff_info.number_data_bands=ReadBlobLong(image);\n viff_info.data_storage_type=ReadBlobLong(image);\n viff_info.data_encode_scheme=ReadBlobLong(image);\n viff_info.map_scheme=ReadBlobLong(image);\n viff_info.map_storage_type=ReadBlobLong(image);\n viff_info.map_rows=ReadBlobLong(image);\n viff_info.map_columns=ReadBlobLong(image);\n viff_info.map_subrows=ReadBlobLong(image);\n viff_info.map_enable=ReadBlobLong(image);\n viff_info.maps_per_cycle=ReadBlobLong(image);\n viff_info.color_space_model=ReadBlobLong(image);\n for (i=0; i < 420; i++)\n (void) ReadBlobByte(image);\n if (EOFBlob(image) != MagickFalse)\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n image->columns=viff_info.rows;\n image->rows=viff_info.columns;\n image->depth=viff_info.x_bits_per_pixel <= 8 ? 8UL :\n MAGICKCORE_QUANTUM_DEPTH;\n /*\n Verify that we can read this VIFF image.\n */\n number_pixels=(MagickSizeType) viff_info.columns*viff_info.rows;\n if (number_pixels != (size_t) number_pixels)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (number_pixels == 0)\n ThrowReaderException(CoderError,\"ImageColumnOrRowSizeIsNotSupported\");\n if ((viff_info.number_data_bands < 1) || (viff_info.number_data_bands > 4))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if ((viff_info.data_storage_type != VFF_TYP_BIT) &&\n (viff_info.data_storage_type != VFF_TYP_1_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_2_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_4_BYTE) &&\n (viff_info.data_storage_type != VFF_TYP_FLOAT) &&\n (viff_info.data_storage_type != VFF_TYP_DOUBLE))\n ThrowReaderException(CoderError,\"DataStorageTypeIsNotSupported\");\n if (viff_info.data_encode_scheme != VFF_DES_RAW)\n ThrowReaderException(CoderError,\"DataEncodingSchemeIsNotSupported\");\n if ((viff_info.map_storage_type != VFF_MAPTYP_NONE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_1_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_2_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_4_BYTE) &&\n (viff_info.map_storage_type != VFF_MAPTYP_FLOAT) &&\n (viff_info.map_storage_type != VFF_MAPTYP_DOUBLE))\n ThrowReaderException(CoderError,\"MapStorageTypeIsNotSupported\");\n if ((viff_info.color_space_model != VFF_CM_NONE) &&\n (viff_info.color_space_model != VFF_CM_ntscRGB) &&\n (viff_info.color_space_model != VFF_CM_genericRGB))\n ThrowReaderException(CoderError,\"ColorspaceModelIsNotSupported\");\n if (viff_info.location_type != VFF_LOC_IMPLICIT)\n ThrowReaderException(CoderError,\"LocationTypeIsNotSupported\");\n if (viff_info.number_of_images != 1)\n ThrowReaderException(CoderError,\"NumberOfImagesIsNotSupported\");\n if (viff_info.map_rows == 0)\n viff_info.map_scheme=VFF_MS_NONE;\n switch ((int) viff_info.map_scheme)\n {\n case VFF_MS_NONE:\n {\n if (viff_info.number_data_bands < 3)\n {\n /*\n Create linear color ramp.\n */\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n image->colors=2;\n else\n if (viff_info.data_storage_type == VFF_MAPTYP_1_BYTE)\n image->colors=256UL;\n else\n image->colors=image->depth <= 8 ? 256UL : 65536UL;\n if (AcquireImageColormap(image,image->colors) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n break;\n }\n case VFF_MS_ONEPERBAND:\n case VFF_MS_SHARED:\n {\n unsigned char\n *viff_colormap;\n\n /*\n Allocate VIFF colormap.\n */\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_1_BYTE: bytes_per_pixel=1; break;\n case VFF_MAPTYP_2_BYTE: bytes_per_pixel=2; break;\n case VFF_MAPTYP_4_BYTE: bytes_per_pixel=4; break;\n case VFF_MAPTYP_FLOAT: bytes_per_pixel=4; break;\n case VFF_MAPTYP_DOUBLE: bytes_per_pixel=8; break;\n default: bytes_per_pixel=1; break;\n }\n image->colors=viff_info.map_columns;\n if (AcquireImageColormap(image,image->colors) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (viff_info.map_rows >\n (viff_info.map_rows*bytes_per_pixel*sizeof(*viff_colormap)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n viff_colormap=(unsigned char *) AcquireQuantumMemory(image->colors,\n viff_info.map_rows*bytes_per_pixel*sizeof(*viff_colormap));\n if (viff_colormap == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n /*\n Read VIFF raster colormap.\n */\n (void) ReadBlob(image,bytes_per_pixel*image->colors*viff_info.map_rows,\n viff_colormap);\n lsb_first=1;\n if (*(char *) &lsb_first &&\n ((viff_info.machine_dependency != VFF_DEP_DECORDER) &&\n (viff_info.machine_dependency != VFF_DEP_NSORDER)))\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_2_BYTE:\n {\n MSBOrderShort(viff_colormap,(bytes_per_pixel*image->colors*\n viff_info.map_rows));\n break;\n }\n case VFF_MAPTYP_4_BYTE:\n case VFF_MAPTYP_FLOAT:\n {\n MSBOrderLong(viff_colormap,(bytes_per_pixel*image->colors*\n viff_info.map_rows));\n break;\n }\n default: break;\n }\n for (i=0; i < (ssize_t) (viff_info.map_rows*image->colors); i++)\n {\n switch ((int) viff_info.map_storage_type)\n {\n case VFF_MAPTYP_2_BYTE: value=1.0*((short *) viff_colormap)[i]; break;\n case VFF_MAPTYP_4_BYTE: value=1.0*((int *) viff_colormap)[i]; break;\n case VFF_MAPTYP_FLOAT: value=((float *) viff_colormap)[i]; break;\n case VFF_MAPTYP_DOUBLE: value=((double *) viff_colormap)[i]; break;\n default: value=1.0*viff_colormap[i]; break;\n }\n if (i < (ssize_t) image->colors)\n {\n image->colormap[i].red=ScaleCharToQuantum((unsigned char) value);\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n value);\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char) value);\n }\n else\n if (i < (ssize_t) (2*image->colors))\n image->colormap[i % image->colors].green=ScaleCharToQuantum(\n (unsigned char) value);\n else\n if (i < (ssize_t) (3*image->colors))\n image->colormap[i % image->colors].blue=ScaleCharToQuantum(\n (unsigned char) value);\n }\n viff_colormap=(unsigned char *) RelinquishMagickMemory(viff_colormap);\n break;\n }\n default:\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n }\n /*\n Initialize image structure.\n */\n image->matte=viff_info.number_data_bands == 4 ? MagickTrue : MagickFalse;\n image->storage_class=\n (viff_info.number_data_bands < 3 ? PseudoClass : DirectClass);\n image->columns=viff_info.rows;\n image->rows=viff_info.columns;\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n /*\n Allocate VIFF pixels.\n */\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: bytes_per_pixel=2; break;\n case VFF_TYP_4_BYTE: bytes_per_pixel=4; break;\n case VFF_TYP_FLOAT: bytes_per_pixel=4; break;\n case VFF_TYP_DOUBLE: bytes_per_pixel=8; break;\n default: bytes_per_pixel=1; break;\n }\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n max_packets=((image->columns+7UL) >> 3UL)*image->rows;\n else\n max_packets=(size_t) (number_pixels*viff_info.number_data_bands);\n pixels=(unsigned char *) AcquireQuantumMemory(MagickMax(number_pixels,\n max_packets),bytes_per_pixel*sizeof(*pixels));\n if (pixels == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ReadBlob(image,bytes_per_pixel*max_packets,pixels);\n lsb_first=1;\n if (*(char *) &lsb_first &&\n ((viff_info.machine_dependency != VFF_DEP_DECORDER) &&\n (viff_info.machine_dependency != VFF_DEP_NSORDER)))\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE:\n {\n MSBOrderShort(pixels,bytes_per_pixel*max_packets);\n break;\n }\n case VFF_TYP_4_BYTE:\n case VFF_TYP_FLOAT:\n {\n MSBOrderLong(pixels,bytes_per_pixel*max_packets);\n break;\n }\n default: break;\n }\n min_value=0.0;\n scale_factor=1.0;\n if ((viff_info.data_storage_type != VFF_TYP_1_BYTE) &&\n (viff_info.map_scheme == VFF_MS_NONE))\n {\n double\n max_value;\n\n /*\n Determine scale factor.\n */\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[0]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[0]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[0]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[0]; break;\n default: value=1.0*pixels[0]; break;\n }\n max_value=value;\n min_value=value;\n for (i=0; i < (ssize_t) max_packets; i++)\n {\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[i]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[i]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[i]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[i]; break;\n default: value=1.0*pixels[i]; break;\n }\n if (value > max_value)\n max_value=value;\n else\n if (value < min_value)\n min_value=value;\n }\n if ((min_value == 0) && (max_value == 0))\n scale_factor=0;\n else\n if (min_value == max_value)\n {\n scale_factor=(MagickRealType) QuantumRange/min_value;\n min_value=0;\n }\n else\n scale_factor=(MagickRealType) QuantumRange/(max_value-min_value);\n }\n /*\n Convert pixels to Quantum size.\n */\n p=(unsigned char *) pixels;\n for (i=0; i < (ssize_t) max_packets; i++)\n {\n switch ((int) viff_info.data_storage_type)\n {\n case VFF_TYP_2_BYTE: value=1.0*((short *) pixels)[i]; break;\n case VFF_TYP_4_BYTE: value=1.0*((int *) pixels)[i]; break;\n case VFF_TYP_FLOAT: value=((float *) pixels)[i]; break;\n case VFF_TYP_DOUBLE: value=((double *) pixels)[i]; break;\n default: value=1.0*pixels[i]; break;\n }\n if (viff_info.map_scheme == VFF_MS_NONE)\n {\n value=(value-min_value)*scale_factor;\n if (value > QuantumRange)\n value=QuantumRange;\n else\n if (value < 0)\n value=0;\n }\n *p=(unsigned char) ((Quantum) value);\n p++;\n }\n /*\n Convert VIFF raster image to pixel packets.\n */\n p=(unsigned char *) pixels;\n if (viff_info.data_storage_type == VFF_TYP_BIT)\n {\n /*\n Convert bitmap scanline.\n */\n if (image->storage_class != PseudoClass)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < (ssize_t) (image->columns-7); x+=8)\n {\n for (bit=0; bit < 8; bit++)\n {\n quantum=(size_t) ((*p) & (0x01 << bit) ? 0 : 1);\n SetPixelRed(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelGreen(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelBlue(q,quantum == 0 ? 0 : QuantumRange);\n if (image->storage_class == PseudoClass)\n SetPixelIndex(indexes+x+bit,quantum);\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=0; bit < (int) (image->columns % 8); bit++)\n {\n quantum=(size_t) ((*p) & (0x01 << bit) ? 0 : 1);\n SetPixelRed(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelGreen(q,quantum == 0 ? 0 : QuantumRange);\n SetPixelBlue(q,quantum == 0 ? 0 : QuantumRange);\n if (image->storage_class == PseudoClass)\n SetPixelIndex(indexes+x+bit,quantum);\n }\n p++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n else\n if (image->storage_class == PseudoClass)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n SetPixelIndex(indexes+x,*p++);\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n else\n {\n /*\n Convert DirectColor scanline.\n */\n number_pixels=(MagickSizeType) image->columns*image->rows;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(q,ScaleCharToQuantum(*p));\n SetPixelGreen(q,ScaleCharToQuantum(*(p+number_pixels)));\n SetPixelBlue(q,ScaleCharToQuantum(*(p+2*number_pixels)));\n if (image->colors != 0)\n {\n ssize_t\n index;\n\n index=(ssize_t) GetPixelRed(q);\n SetPixelRed(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].red);\n index=(ssize_t) GetPixelGreen(q);\n SetPixelGreen(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].green);\n index=(ssize_t) GetPixelRed(q);\n SetPixelBlue(q,image->colormap[(ssize_t)\n ConstrainColormapIndex(image,index)].blue);\n }\n SetPixelOpacity(q,image->matte != MagickFalse ? QuantumRange-\n ScaleCharToQuantum(*(p+number_pixels*3)) : OpaqueOpacity);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n pixels=(unsigned char *) RelinquishMagickMemory(pixels);\n if (image->storage_class == PseudoClass)\n (void) SyncImage(image);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n count=ReadBlob(image,1,&viff_info.identifier);\n if ((count != 0) && (viff_info.identifier == 0xab))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n } while ((count != 0) && (viff_info.identifier == 0xab));\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ReadVIFFImage","file_name":"coders/viff.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/ca0c886abd6d3ef335eb74150cd23b89ebd17135","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#79-304310595010","input":"static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int fmt) {\n\tint stacksize = r_config_get_i (core->config, \"esil.stack.depth\");\n\tbool iotrap = r_config_get_i (core->config, \"esil.iotrap\");\n\tbool romem = r_config_get_i (core->config, \"esil.romem\");\n\tbool stats = r_config_get_i (core->config, \"esil.stats\");\n\tbool be = core->print->big_endian;\n\tbool use_color = core->print->flags & R_PRINT_FLAGS_COLOR;\n\tcore->parser->relsub = r_config_get_i (core->config, \"asm.relsub\");\n\tint ret, i, j, idx, size;\n\tconst char *color = \"\";\n\tconst char *esilstr;\n\tconst char *opexstr;\n\tRAnalHint *hint;\n\tRAnalEsil *esil = NULL;\n\tRAsmOp asmop;\n\tRAnalOp op = {0};\n\tut64 addr;\n\tbool isFirst = true;\n\tunsigned int addrsize = r_config_get_i (core->config, \"esil.addr.size\");\n\tint totalsize = 0;\n\n\t// Variables required for setting up ESIL to REIL conversion\n\tif (use_color) {\n\t\tcolor = core->cons->pal.label;\n\t}\n\tswitch (fmt) {\n\tcase 'j':\n\t\tr_cons_printf (\"[\");\n\t\tbreak;\n\tcase 'r':\n\t\t// Setup for ESIL to REIL conversion\n\t\tesil = r_anal_esil_new (stacksize, iotrap, addrsize);\n\t\tif (!esil) {\n\t\t\treturn;\n\t\t}\n\t\tr_anal_esil_to_reil_setup (esil, core->anal, romem, stats);\n\t\tr_anal_esil_set_pc (esil, core->offset);\n\t\tbreak;\n\t}\n\tfor (i = idx = ret = 0; idx < len && (!nops || (nops && i < nops)); i++, idx += ret) {\n\t\taddr = core->offset + idx;\n\t\t// TODO: use more anal hints\n\t\thint = r_anal_hint_get (core->anal, addr);\n\t\tr_asm_set_pc (core->assembler, addr);\n\t\t(void)r_asm_disassemble (core->assembler, &asmop, buf + idx, len - idx);\n\t\tret = r_anal_op (core->anal, &op, core->offset + idx, buf + idx, len - idx, R_ANAL_OP_MASK_ESIL);\n\t\tesilstr = R_STRBUF_SAFEGET (&op.esil);\n\t\topexstr = R_STRBUF_SAFEGET (&op.opex);\n\t\tchar *mnem = strdup (r_asm_op_get_asm (&asmop));\n\t\tchar *sp = strchr (mnem, ' ');\n\t\tif (sp) {\n\t\t\t*sp = 0;\n\t\t\tif (op.prefix) {\n\t\t\t\tchar *arg = strdup (sp + 1);\n\t\t\t\tchar *sp = strchr (arg, ' ');\n\t\t\t\tif (sp) {\n\t\t\t\t\t*sp = 0;\n\t\t\t\t}\n\t\t\t\tfree (mnem);\n\t\t\t\tmnem = arg;\n\t\t\t}\n\t\t}\n\t\tif (ret < 1 && fmt != 'd') {\n\t\t\teprintf (\"Oops at 0x%08\" PFMT64x \" (\", core->offset + idx);\n\t\t\tfor (i = idx, j = 0; i < core->blocksize && j < 3; ++i, ++j) {\n\t\t\t\teprintf (\"%02x \", buf[i]);\n\t\t\t}\n\t\t\teprintf (\"...)\\n\");\n\t\t\tfree (mnem);\n\t\t\tbreak;\n\t\t}\n\t\tsize = (hint && hint->size)? hint->size: op.size;\n\t\tif (fmt == 'd') {\n\t\t\tchar *opname = strdup (r_asm_op_get_asm (&asmop));\n\t\t\tif (opname) {\n\t\t\t\tr_str_split (opname, ' ');\n\t\t\t\tchar *d = r_asm_describe (core->assembler, opname);\n\t\t\t\tif (d && *d) {\n\t\t\t\t\tr_cons_printf (\"%s: %s\\n\", opname, d);\n\t\t\t\t\tfree (d);\n\t\t\t\t} else {\n\t\t\t\t\teprintf (\"Unknown opcode\\n\");\n\t\t\t\t}\n\t\t\t\tfree (opname);\n\t\t\t}\n\t\t} else if (fmt == 'e') {\n\t\t\tif (*esilstr) {\n\t\t\t\tif (use_color) {\n\t\t\t\t\tr_cons_printf (\"%s0x%\" PFMT64x Color_RESET \" %s\\n\", color, core->offset + idx, esilstr);\n\t\t\t\t} else {\n\t\t\t\t\tr_cons_printf (\"0x%\" PFMT64x \" %s\\n\", core->offset + idx, esilstr);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (fmt == 's') {\n\t\t\ttotalsize += op.size;\n\t\t} else if (fmt == 'r') {\n\t\t\tif (*esilstr) {\n\t\t\t\tif (use_color) {\n\t\t\t\t\tr_cons_printf (\"%s0x%\" PFMT64x Color_RESET \"\\n\", color, core->offset + idx);\n\t\t\t\t} else {\n\t\t\t\t\tr_cons_printf (\"0x%\" PFMT64x \"\\n\", core->offset + idx);\n\t\t\t\t}\n\t\t\t\tr_anal_esil_parse (esil, esilstr);\n\t\t\t\tr_anal_esil_dumpstack (esil);\n\t\t\t\tr_anal_esil_stack_free (esil);\n\t\t\t}\n\t\t} else if (fmt == 'j') {\n\t\t\tif (isFirst) {\n\t\t\t\tisFirst = false;\n\t\t\t} else {\n\t\t\t\tr_cons_print (\",\");\n\t\t\t}\n\t\t\tr_cons_printf (\"{\\\"opcode\\\":\\\"%s\\\",\", r_asm_op_get_asm (&asmop));\n\t\t\t{\n\t\t\t\tchar strsub[128] = { 0 };\n\t\t\t\t// pc+33\n\t\t\t\tr_parse_varsub (core->parser, NULL,\n\t\t\t\t\tcore->offset + idx,\n\t\t\t\t\tasmop.size, r_asm_op_get_asm (&asmop),\n\t\t\t\t\tstrsub, sizeof (strsub));\n\t\t\t\t{\n\t\t\t\t\tut64 killme = UT64_MAX;\n\t\t\t\t\tif (r_io_read_i (core->io, op.ptr, &killme, op.refptr, be)) {\n\t\t\t\t\t\tcore->parser->relsub_addr = killme;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 0x33->sym.xx\n\t\t\t\tchar *p = strdup (strsub);\n\t\t\t\tif (p) {\n\t\t\t\t\tr_parse_filter (core->parser, addr, core->flags, p,\n\t\t\t\t\t\t\tstrsub, sizeof (strsub), be);\n\t\t\t\t\tfree (p);\n\t\t\t\t}\n\t\t\t\tr_cons_printf (\"\\\"disasm\\\":\\\"%s\\\",\", strsub);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"mnemonic\\\":\\\"%s\\\",\", mnem);\n\t\t\tif (hint && hint->opcode) {\n\t\t\t\tr_cons_printf (\"\\\"ophint\\\":\\\"%s\\\",\", hint->opcode);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"sign\\\":%s,\", r_str_bool (op.sign));\n\t\t\tr_cons_printf (\"\\\"prefix\\\":%\" PFMT64u \",\", op.prefix);\n\t\t\tr_cons_printf (\"\\\"id\\\":%d,\", op.id);\n\t\t\tif (opexstr && *opexstr) {\n\t\t\t\tr_cons_printf (\"\\\"opex\\\":%s,\", opexstr);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"addr\\\":%\" PFMT64u \",\", core->offset + idx);\n\t\t\tr_cons_printf (\"\\\"bytes\\\":\\\"\");\n\t\t\tfor (j = 0; j < size; j++) {\n\t\t\t\tr_cons_printf (\"%02x\", buf[j + idx]);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\",\");\n\t\t\tif (op.val != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"val\\\": %\" PFMT64u \",\", op.val);\n\t\t\t}\n\t\t\tif (op.ptr != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"ptr\\\": %\" PFMT64u \",\", op.ptr);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"size\\\": %d,\", size);\n\t\t\tr_cons_printf (\"\\\"type\\\": \\\"%s\\\",\",\n\t\t\t\tr_anal_optype_to_string (op.type));\n\t\t\tif (op.reg) {\n\t\t\t\tr_cons_printf (\"\\\"reg\\\": \\\"%s\\\",\", op.reg);\n\t\t\t}\n\t\t\tif (op.ireg) {\n\t\t\t\tr_cons_printf (\"\\\"ireg\\\": \\\"%s\\\",\", op.ireg);\n\t\t\t}\n\t\t\tif (op.scale) {\n\t\t\t\tr_cons_printf (\"\\\"scale\\\":%d,\", op.scale);\n\t\t\t}\n\t\t\tif (hint && hint->esil) {\n\t\t\t\tr_cons_printf (\"\\\"esil\\\": \\\"%s\\\",\", hint->esil);\n\t\t\t} else if (*esilstr) {\n\t\t\t\tr_cons_printf (\"\\\"esil\\\": \\\"%s\\\",\", esilstr);\n\t\t\t}\n\t\t\tif (hint && hint->jump != UT64_MAX) {\n\t\t\t\top.jump = hint->jump;\n\t\t\t}\n\t\t\tif (op.jump != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"jump\\\":%\" PFMT64u \",\", op.jump);\n\t\t\t}\n\t\t\tif (hint && hint->fail != UT64_MAX) {\n\t\t\t\top.fail = hint->fail;\n\t\t\t}\n\t\t\tif (op.refptr != -1) {\n\t\t\t\tr_cons_printf (\"\\\"refptr\\\":%d,\", op.refptr);\n\t\t\t}\n\t\t\tif (op.fail != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"fail\\\":%\" PFMT64u \",\", op.fail);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"cycles\\\":%d,\", op.cycles);\n\t\t\tif (op.failcycles) {\n\t\t\t\tr_cons_printf (\"\\\"failcycles\\\":%d,\", op.failcycles);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"delay\\\":%d,\", op.delay);\n\t\t\t{\n\t\t\t\tconst char *p = r_anal_stackop_tostring (op.stackop);\n\t\t\t\tif (p && *p && strcmp (p, \"null\"))\n\t\t\t\t\tr_cons_printf (\"\\\"stack\\\":\\\"%s\\\",\", p);\n\t\t\t}\n\t\t\tif (op.stackptr) {\n\t\t\t\tr_cons_printf (\"\\\"stackptr\\\":%d,\", op.stackptr);\n\t\t\t}\n\t\t\t{\n\t\t\t\tconst char *arg = (op.type & R_ANAL_OP_TYPE_COND)\n\t\t\t\t\t? r_anal_cond_tostring (op.cond): NULL;\n\t\t\t\tif (arg) {\n\t\t\t\t\tr_cons_printf (\"\\\"cond\\\":\\\"%s\\\",\", arg);\n\t\t\t\t}\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"family\\\":\\\"%s\\\"}\", r_anal_op_family_to_string (op.family));\n\t\t} else {\n#define printline(k, fmt, arg)\\\n\t{ \\\n\t\tif (use_color)\\\n\t\t\tr_cons_printf (\"%s%s: \" Color_RESET, color, k);\\\n\t\telse\\\n\t\t\tr_cons_printf (\"%s: \", k);\\\n\t\tif (fmt) r_cons_printf (fmt, arg);\\\n\t}\n\t\t\tprintline (\"address\", \"0x%\" PFMT64x \"\\n\", core->offset + idx);\n\t\t\tprintline (\"opcode\", \"%s\\n\", r_asm_op_get_asm (&asmop));\n\t\t\tprintline (\"mnemonic\", \"%s\\n\", mnem);\n\t\t\tif (hint) {\n\t\t\t\tif (hint->opcode) {\n\t\t\t\t\tprintline (\"ophint\", \"%s\\n\", hint->opcode);\n\t\t\t\t}\n#if 0\n\t\t\t\t// addr should not override core->offset + idx.. its silly\n\t\t\t\tif (hint->addr != UT64_MAX) {\n\t\t\t\t\tprintline (\"addr\", \"0x%08\" PFMT64x \"\\n\", (hint->addr + idx));\n\t\t\t\t}\n#endif\n\t\t\t}\n\t\t\tprintline (\"prefix\", \"%\" PFMT64u \"\\n\", op.prefix);\n\t\t\tprintline (\"id\", \"%d\\n\", op.id);\n#if 0\n// no opex here to avoid lot of tests broken..and having json in here is not much useful imho\n\t\t\tif (opexstr && *opexstr) {\n\t\t\t\tprintline (\"opex\", \"%s\\n\", opexstr);\n\t\t\t}\n#endif\n\t\t\tprintline (\"bytes\", NULL, 0);\n\t\t\tfor (j = 0; j < size; j++) {\n\t\t\t\tr_cons_printf (\"%02x\", buf[j + idx]);\n\t\t\t}\n\t\t\tr_cons_newline ();\n\t\t\tif (op.val != UT64_MAX)\n\t\t\t\tprintline (\"val\", \"0x%08\" PFMT64x \"\\n\", op.val);\n\t\t\tif (op.ptr != UT64_MAX)\n\t\t\t\tprintline (\"ptr\", \"0x%08\" PFMT64x \"\\n\", op.ptr);\n\t\t\tif (op.refptr != -1)\n\t\t\t\tprintline (\"refptr\", \"%d\\n\", op.refptr);\n\t\t\tprintline (\"size\", \"%d\\n\", size);\n\t\t\tprintline (\"sign\", \"%s\\n\", r_str_bool (op.sign));\n\t\t\tprintline (\"type\", \"%s\\n\", r_anal_optype_to_string (op.type));\n\t\t\tprintline (\"cycles\", \"%d\\n\", op.cycles);\n\t\t\tif (op.failcycles) {\n\t\t\t\tprintline (\"failcycles\", \"%d\\n\", op.failcycles);\n\t\t\t}\n\t\t\t{\n\t\t\t\tconst char *t2 = r_anal_optype_to_string (op.type2);\n\t\t\t\tif (t2 && strcmp (t2, \"null\")) {\n\t\t\t\t\tprintline (\"type2\", \"%s\\n\", t2);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op.reg) {\n\t\t\t\tprintline (\"reg\", \"%s\\n\", op.reg);\n\t\t\t}\n\t\t\tif (op.ireg) {\n\t\t\t\tprintline (\"ireg\", \"%s\\n\", op.ireg);\n\t\t\t}\n\t\t\tif (op.scale) {\n\t\t\t\tprintline (\"scale\", \"%d\\n\", op.scale);\n\t\t\t}\n\t\t\tif (hint && hint->esil) {\n\t\t\t\tprintline (\"esil\", \"%s\\n\", hint->esil);\n\t\t\t} else if (*esilstr) {\n\t\t\t\tprintline (\"esil\", \"%s\\n\", esilstr);\n\t\t\t}\n\t\t\tif (hint && hint->jump != UT64_MAX) {\n\t\t\t\top.jump = hint->jump;\n\t\t\t}\n\t\t\tif (op.jump != UT64_MAX) {\n\t\t\t\tprintline (\"jump\", \"0x%08\" PFMT64x \"\\n\", op.jump);\n\t\t\t}\n\t\t\tif (op.direction != 0) {\n\t\t\t\tconst char * dir = op.direction == 1 ? \"read\"\n\t\t\t\t\t: op.direction == 2 ? \"write\"\n\t\t\t\t\t: op.direction == 4 ? \"exec\"\n\t\t\t\t\t: op.direction == 8 ? \"ref\": \"none\";\n\t\t\t\tprintline (\"direction\", \"%s\\n\", dir);\n\t\t\t}\n\t\t\tif (hint && hint->fail != UT64_MAX) {\n\t\t\t\top.fail = hint->fail;\n\t\t\t}\n\t\t\tif (op.fail != UT64_MAX) {\n\t\t\t\tprintline (\"fail\", \"0x%08\" PFMT64x \"\\n\", op.fail);\n\t\t\t}\n\t\t\tif (op.delay) {\n\t\t\t\tprintline (\"delay\", \"%d\\n\", op.delay);\n\t\t\t}\n\t\t\tprintline (\"stack\", \"%s\\n\", r_anal_stackop_tostring (op.stackop));\n\t\t\t{\n\t\t\t\tconst char *arg = (op.type & R_ANAL_OP_TYPE_COND)? r_anal_cond_tostring (op.cond): NULL;\n\t\t\t\tif (arg) {\n\t\t\t\t\tprintline (\"cond\", \"%s\\n\", arg);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintline (\"family\", \"%s\\n\", r_anal_op_family_to_string (op.family));\n\t\t\tprintline (\"stackop\", \"%s\\n\", r_anal_stackop_tostring (op.stackop));\n\t\t\tif (op.stackptr) {\n\t\t\t\tprintline (\"stackptr\", \"%\"PFMT64u\"\\n\", op.stackptr);\n\t\t\t}\n\t\t}\n\t\t//r_cons_printf (\"false: 0x%08\"PFMT64x\"\\n\", core->offset+idx);\n\t\t//free (hint);\n\t\tfree (mnem);\n\t\tr_anal_hint_free (hint);\n\t\tr_anal_op_fini (&op);\n\t}\n\tr_anal_op_fini (&op);\n\tif (fmt == 'j') {\n\t\tr_cons_printf (\"]\");\n\t\tr_cons_newline ();\n\t} else if (fmt == 's') {\n\t\tr_cons_printf (\"%d\\n\", totalsize);\n\t}\n\tr_anal_esil_free (esil);\n}","target":"static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int fmt) {\n\tint stacksize = r_config_get_i (core->config, \"esil.stack.depth\");\n\tbool iotrap = r_config_get_i (core->config, \"esil.iotrap\");\n\tbool romem = r_config_get_i (core->config, \"esil.romem\");\n\tbool stats = r_config_get_i (core->config, \"esil.stats\");\n\tbool be = core->print->big_endian;\n\tbool use_color = core->print->flags & R_PRINT_FLAGS_COLOR;\n\tcore->parser->relsub = r_config_get_i (core->config, \"asm.relsub\");\n\tint ret, i, j, idx, size;\n\tconst char *color = \"\";\n\tconst char *esilstr;\n\tconst char *opexstr;\n\tRAnalHint *hint;\n\tRAnalEsil *esil = NULL;\n\tRAsmOp asmop;\n\tRAnalOp op = {0};\n\tut64 addr;\n\tbool isFirst = true;\n\tunsigned int addrsize = r_config_get_i (core->config, \"esil.addr.size\");\n\tint totalsize = 0;\n\n\t// Variables required for setting up ESIL to REIL conversion\n\tif (use_color) {\n\t\tcolor = core->cons->pal.label;\n\t}\n\tswitch (fmt) {\n\tcase 'j':\n\t\tr_cons_printf (\"[\");\n\t\tbreak;\n\tcase 'r':\n\t\t// Setup for ESIL to REIL conversion\n\t\tesil = r_anal_esil_new (stacksize, iotrap, addrsize);\n\t\tif (!esil) {\n\t\t\treturn;\n\t\t}\n\t\tr_anal_esil_to_reil_setup (esil, core->anal, romem, stats);\n\t\tr_anal_esil_set_pc (esil, core->offset);\n\t\tbreak;\n\t}\n\tfor (i = idx = ret = 0; idx < len && (!nops || (nops && i < nops)); i++, idx += ret) {\n\t\taddr = core->offset + idx;\n\t\t// TODO: use more anal hints\n\t\thint = r_anal_hint_get (core->anal, addr);\n\t\tr_asm_set_pc (core->assembler, addr);\n\t\t(void)r_asm_disassemble (core->assembler, &asmop, buf + idx, len - idx);\n\t\tret = r_anal_op (core->anal, &op, core->offset + idx, buf + idx, len - idx, R_ANAL_OP_MASK_ESIL);\n\t\tesilstr = R_STRBUF_SAFEGET (&op.esil);\n\t\topexstr = R_STRBUF_SAFEGET (&op.opex);\n\t\tchar *mnem = strdup (r_asm_op_get_asm (&asmop));\n\t\tchar *sp = strchr (mnem, ' ');\n\t\tif (sp) {\n\t\t\t*sp = 0;\n\t\t\tif (op.prefix) {\n\t\t\t\tchar *arg = strdup (sp + 1);\n\t\t\t\tchar *sp = strchr (arg, ' ');\n\t\t\t\tif (sp) {\n\t\t\t\t\t*sp = 0;\n\t\t\t\t}\n\t\t\t\tfree (mnem);\n\t\t\t\tmnem = arg;\n\t\t\t}\n\t\t}\n\t\tif (ret < 1 && fmt != 'd') {\n\t\t\teprintf (\"Oops at 0x%08\" PFMT64x \" (\", core->offset + idx);\n\t\t\tfor (i = idx, j = 0; i < core->blocksize && j < 3; ++i, ++j) {\n\t\t\t\teprintf (\"%02x \", buf[i]);\n\t\t\t}\n\t\t\teprintf (\"...)\\n\");\n\t\t\tfree (mnem);\n\t\t\tbreak;\n\t\t}\n\t\tsize = (hint && hint->size)? hint->size: op.size;\n\t\tif (fmt == 'd') {\n\t\t\tchar *opname = strdup (r_asm_op_get_asm (&asmop));\n\t\t\tif (opname) {\n\t\t\t\tr_str_split (opname, ' ');\n\t\t\t\tchar *d = r_asm_describe (core->assembler, opname);\n\t\t\t\tif (d && *d) {\n\t\t\t\t\tr_cons_printf (\"%s: %s\\n\", opname, d);\n\t\t\t\t\tfree (d);\n\t\t\t\t} else {\n\t\t\t\t\teprintf (\"Unknown opcode\\n\");\n\t\t\t\t}\n\t\t\t\tfree (opname);\n\t\t\t}\n\t\t} else if (fmt == 'e') {\n\t\t\tif (*esilstr) {\n\t\t\t\tif (use_color) {\n\t\t\t\t\tr_cons_printf (\"%s0x%\" PFMT64x Color_RESET \" %s\\n\", color, core->offset + idx, esilstr);\n\t\t\t\t} else {\n\t\t\t\t\tr_cons_printf (\"0x%\" PFMT64x \" %s\\n\", core->offset + idx, esilstr);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (fmt == 's') {\n\t\t\ttotalsize += op.size;\n\t\t} else if (fmt == 'r') {\n\t\t\tif (*esilstr) {\n\t\t\t\tif (use_color) {\n\t\t\t\t\tr_cons_printf (\"%s0x%\" PFMT64x Color_RESET \"\\n\", color, core->offset + idx);\n\t\t\t\t} else {\n\t\t\t\t\tr_cons_printf (\"0x%\" PFMT64x \"\\n\", core->offset + idx);\n\t\t\t\t}\n\t\t\t\tr_anal_esil_parse (esil, esilstr);\n\t\t\t\tr_anal_esil_dumpstack (esil);\n\t\t\t\tr_anal_esil_stack_free (esil);\n\t\t\t}\n\t\t} else if (fmt == 'j') {\n\t\t\tif (isFirst) {\n\t\t\t\tisFirst = false;\n\t\t\t} else {\n\t\t\t\tr_cons_print (\",\");\n\t\t\t}\n\t\t\tr_cons_printf (\"{\\\"opcode\\\":\\\"%s\\\",\", r_asm_op_get_asm (&asmop));\n\t\t\t{\n\t\t\t\tchar strsub[128] = { 0 };\n\t\t\t\t// pc+33\n\t\t\t\tr_parse_varsub (core->parser, NULL,\n\t\t\t\t\tcore->offset + idx,\n\t\t\t\t\tasmop.size, r_asm_op_get_asm (&asmop),\n\t\t\t\t\tstrsub, sizeof (strsub));\n\t\t\t\t{\n\t\t\t\t\tut64 killme = UT64_MAX;\n\t\t\t\t\tif (r_io_read_i (core->io, op.ptr, &killme, op.refptr, be)) {\n\t\t\t\t\t\tcore->parser->relsub_addr = killme;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 0x33->sym.xx\n\t\t\t\tchar *p = strdup (strsub);\n\t\t\t\tif (p) {\n\t\t\t\t\tr_parse_filter (core->parser, addr, core->flags, p,\n\t\t\t\t\t\t\tstrsub, sizeof (strsub), be);\n\t\t\t\t\tfree (p);\n\t\t\t\t}\n\t\t\t\tr_cons_printf (\"\\\"disasm\\\":\\\"%s\\\",\", strsub);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"mnemonic\\\":\\\"%s\\\",\", mnem);\n\t\t\tif (hint && hint->opcode) {\n\t\t\t\tr_cons_printf (\"\\\"ophint\\\":\\\"%s\\\",\", hint->opcode);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"sign\\\":%s,\", r_str_bool (op.sign));\n\t\t\tr_cons_printf (\"\\\"prefix\\\":%\" PFMT64u \",\", op.prefix);\n\t\t\tr_cons_printf (\"\\\"id\\\":%d,\", op.id);\n\t\t\tif (opexstr && *opexstr) {\n\t\t\t\tr_cons_printf (\"\\\"opex\\\":%s,\", opexstr);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"addr\\\":%\" PFMT64u \",\", core->offset + idx);\n\t\t\tr_cons_printf (\"\\\"bytes\\\":\\\"\");\n\t\t\tfor (j = 0; j < size; j++) {\n\t\t\t\tr_cons_printf (\"%02x\", buf[j + idx]);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\",\");\n\t\t\tif (op.val != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"val\\\": %\" PFMT64u \",\", op.val);\n\t\t\t}\n\t\t\tif (op.ptr != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"ptr\\\": %\" PFMT64u \",\", op.ptr);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"size\\\": %d,\", size);\n\t\t\tr_cons_printf (\"\\\"type\\\": \\\"%s\\\",\",\n\t\t\t\tr_anal_optype_to_string (op.type));\n\t\t\tif (op.reg) {\n\t\t\t\tr_cons_printf (\"\\\"reg\\\": \\\"%s\\\",\", op.reg);\n\t\t\t}\n\t\t\tif (op.ireg) {\n\t\t\t\tr_cons_printf (\"\\\"ireg\\\": \\\"%s\\\",\", op.ireg);\n\t\t\t}\n\t\t\tif (op.scale) {\n\t\t\t\tr_cons_printf (\"\\\"scale\\\":%d,\", op.scale);\n\t\t\t}\n\t\t\tif (hint && hint->esil) {\n\t\t\t\tr_cons_printf (\"\\\"esil\\\": \\\"%s\\\",\", hint->esil);\n\t\t\t} else if (*esilstr) {\n\t\t\t\tr_cons_printf (\"\\\"esil\\\": \\\"%s\\\",\", esilstr);\n\t\t\t}\n\t\t\tif (hint && hint->jump != UT64_MAX) {\n\t\t\t\top.jump = hint->jump;\n\t\t\t}\n\t\t\tif (op.jump != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"jump\\\":%\" PFMT64u \",\", op.jump);\n\t\t\t}\n\t\t\tif (hint && hint->fail != UT64_MAX) {\n\t\t\t\top.fail = hint->fail;\n\t\t\t}\n\t\t\tif (op.refptr != -1) {\n\t\t\t\tr_cons_printf (\"\\\"refptr\\\":%d,\", op.refptr);\n\t\t\t}\n\t\t\tif (op.fail != UT64_MAX) {\n\t\t\t\tr_cons_printf (\"\\\"fail\\\":%\" PFMT64u \",\", op.fail);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"cycles\\\":%d,\", op.cycles);\n\t\t\tif (op.failcycles) {\n\t\t\t\tr_cons_printf (\"\\\"failcycles\\\":%d,\", op.failcycles);\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"delay\\\":%d,\", op.delay);\n\t\t\t{\n\t\t\t\tconst char *p = r_anal_stackop_tostring (op.stackop);\n\t\t\t\tif (p && *p && strcmp (p, \"null\"))\n\t\t\t\t\tr_cons_printf (\"\\\"stack\\\":\\\"%s\\\",\", p);\n\t\t\t}\n\t\t\tif (op.stackptr) {\n\t\t\t\tr_cons_printf (\"\\\"stackptr\\\":%d,\", op.stackptr);\n\t\t\t}\n\t\t\t{\n\t\t\t\tconst char *arg = (op.type & R_ANAL_OP_TYPE_COND)\n\t\t\t\t\t? r_anal_cond_tostring (op.cond): NULL;\n\t\t\t\tif (arg) {\n\t\t\t\t\tr_cons_printf (\"\\\"cond\\\":\\\"%s\\\",\", arg);\n\t\t\t\t}\n\t\t\t}\n\t\t\tr_cons_printf (\"\\\"family\\\":\\\"%s\\\"}\", r_anal_op_family_to_string (op.family));\n\t\t} else {\n#define printline(k, fmt, arg)\\\n\t{ \\\n\t\tif (use_color)\\\n\t\t\tr_cons_printf (\"%s%s: \" Color_RESET, color, k);\\\n\t\telse\\\n\t\t\tr_cons_printf (\"%s: \", k);\\\n\t\tif (fmt) r_cons_printf (fmt, arg);\\\n\t}\n\t\t\tprintline (\"address\", \"0x%\" PFMT64x \"\\n\", core->offset + idx);\n\t\t\tprintline (\"opcode\", \"%s\\n\", r_asm_op_get_asm (&asmop));\n\t\t\tprintline (\"mnemonic\", \"%s\\n\", mnem);\n\t\t\tif (hint) {\n\t\t\t\tif (hint->opcode) {\n\t\t\t\t\tprintline (\"ophint\", \"%s\\n\", hint->opcode);\n\t\t\t\t}\n#if 0\n\t\t\t\t// addr should not override core->offset + idx.. its silly\n\t\t\t\tif (hint->addr != UT64_MAX) {\n\t\t\t\t\tprintline (\"addr\", \"0x%08\" PFMT64x \"\\n\", (hint->addr + idx));\n\t\t\t\t}\n#endif\n\t\t\t}\n\t\t\tprintline (\"prefix\", \"%\" PFMT64u \"\\n\", op.prefix);\n\t\t\tprintline (\"id\", \"%d\\n\", op.id);\n#if 0\n// no opex here to avoid lot of tests broken..and having json in here is not much useful imho\n\t\t\tif (opexstr && *opexstr) {\n\t\t\t\tprintline (\"opex\", \"%s\\n\", opexstr);\n\t\t\t}\n#endif\n\t\t\tprintline (\"bytes\", NULL, 0);\n\t\t\tint minsz = R_MIN (len, size);\n\t\t\tminsz = R_MAX (minsz, 0);\n\t\t\tfor (j = 0; j < minsz; j++) {\n\t\t\t\tut8 ch = ((j + idx - 1) > minsz)? 0xff: buf[j + idx];\n\t\t\t\tr_cons_printf (\"%02x\", ch);\n\t\t\t}\n\t\t\tr_cons_newline ();\n\t\t\tif (op.val != UT64_MAX) {\n\t\t\t\tprintline (\"val\", \"0x%08\" PFMT64x \"\\n\", op.val);\n\t\t\t}\n\t\t\tif (op.ptr != UT64_MAX) {\n\t\t\t\tprintline (\"ptr\", \"0x%08\" PFMT64x \"\\n\", op.ptr);\n\t\t\t}\n\t\t\tif (op.refptr != -1) {\n\t\t\t\tprintline (\"refptr\", \"%d\\n\", op.refptr);\n\t\t\t}\n\t\t\tprintline (\"size\", \"%d\\n\", size);\n\t\t\tprintline (\"sign\", \"%s\\n\", r_str_bool (op.sign));\n\t\t\tprintline (\"type\", \"%s\\n\", r_anal_optype_to_string (op.type));\n\t\t\tprintline (\"cycles\", \"%d\\n\", op.cycles);\n\t\t\tif (op.failcycles) {\n\t\t\t\tprintline (\"failcycles\", \"%d\\n\", op.failcycles);\n\t\t\t}\n\t\t\t{\n\t\t\t\tconst char *t2 = r_anal_optype_to_string (op.type2);\n\t\t\t\tif (t2 && strcmp (t2, \"null\")) {\n\t\t\t\t\tprintline (\"type2\", \"%s\\n\", t2);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op.reg) {\n\t\t\t\tprintline (\"reg\", \"%s\\n\", op.reg);\n\t\t\t}\n\t\t\tif (op.ireg) {\n\t\t\t\tprintline (\"ireg\", \"%s\\n\", op.ireg);\n\t\t\t}\n\t\t\tif (op.scale) {\n\t\t\t\tprintline (\"scale\", \"%d\\n\", op.scale);\n\t\t\t}\n\t\t\tif (hint && hint->esil) {\n\t\t\t\tprintline (\"esil\", \"%s\\n\", hint->esil);\n\t\t\t} else if (*esilstr) {\n\t\t\t\tprintline (\"esil\", \"%s\\n\", esilstr);\n\t\t\t}\n\t\t\tif (hint && hint->jump != UT64_MAX) {\n\t\t\t\top.jump = hint->jump;\n\t\t\t}\n\t\t\tif (op.jump != UT64_MAX) {\n\t\t\t\tprintline (\"jump\", \"0x%08\" PFMT64x \"\\n\", op.jump);\n\t\t\t}\n\t\t\tif (op.direction != 0) {\n\t\t\t\tconst char * dir = op.direction == 1 ? \"read\"\n\t\t\t\t\t: op.direction == 2 ? \"write\"\n\t\t\t\t\t: op.direction == 4 ? \"exec\"\n\t\t\t\t\t: op.direction == 8 ? \"ref\": \"none\";\n\t\t\t\tprintline (\"direction\", \"%s\\n\", dir);\n\t\t\t}\n\t\t\tif (hint && hint->fail != UT64_MAX) {\n\t\t\t\top.fail = hint->fail;\n\t\t\t}\n\t\t\tif (op.fail != UT64_MAX) {\n\t\t\t\tprintline (\"fail\", \"0x%08\" PFMT64x \"\\n\", op.fail);\n\t\t\t}\n\t\t\tif (op.delay) {\n\t\t\t\tprintline (\"delay\", \"%d\\n\", op.delay);\n\t\t\t}\n\t\t\tprintline (\"stack\", \"%s\\n\", r_anal_stackop_tostring (op.stackop));\n\t\t\t{\n\t\t\t\tconst char *arg = (op.type & R_ANAL_OP_TYPE_COND)? r_anal_cond_tostring (op.cond): NULL;\n\t\t\t\tif (arg) {\n\t\t\t\t\tprintline (\"cond\", \"%s\\n\", arg);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintline (\"family\", \"%s\\n\", r_anal_op_family_to_string (op.family));\n\t\t\tprintline (\"stackop\", \"%s\\n\", r_anal_stackop_tostring (op.stackop));\n\t\t\tif (op.stackptr) {\n\t\t\t\tprintline (\"stackptr\", \"%\"PFMT64u\"\\n\", op.stackptr);\n\t\t\t}\n\t\t}\n\t\t//r_cons_printf (\"false: 0x%08\"PFMT64x\"\\n\", core->offset+idx);\n\t\t//free (hint);\n\t\tfree (mnem);\n\t\tr_anal_hint_free (hint);\n\t\tr_anal_op_fini (&op);\n\t}\n\tr_anal_op_fini (&op);\n\tif (fmt == 'j') {\n\t\tr_cons_printf (\"]\");\n\t\tr_cons_newline ();\n\t} else if (fmt == 's') {\n\t\tr_cons_printf (\"%d\\n\", totalsize);\n\t}\n\tr_anal_esil_free (esil);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"core_anal_bytes","file_name":"libr/core/cmd_anal.c","commit_link":"github.com/radare/radare2/commit/a1bc65c3db593530775823d6d7506a457ed95267","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#80-4a53ea1bee34","input":"static BOOL update_read_bitmap_data(rdpUpdate* update, wStream* s, BITMAP_DATA* bitmapData)\n{\n\tWINPR_UNUSED(update);\n\tif (Stream_GetRemainingLength(s) < 18)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, bitmapData->destLeft);\n\tStream_Read_UINT16(s, bitmapData->destTop);\n\tStream_Read_UINT16(s, bitmapData->destRight);\n\tStream_Read_UINT16(s, bitmapData->destBottom);\n\tStream_Read_UINT16(s, bitmapData->width);\n\tStream_Read_UINT16(s, bitmapData->height);\n\tStream_Read_UINT16(s, bitmapData->bitsPerPixel);\n\tStream_Read_UINT16(s, bitmapData->flags);\n\tStream_Read_UINT16(s, bitmapData->bitmapLength);\n\n\tif (bitmapData->flags & BITMAP_COMPRESSION)\n\t{\n\t\tif (!(bitmapData->flags & NO_BITMAP_COMPRESSION_HDR))\n\t\t{\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */\n\t\t\tStream_Read_UINT16(s, bitmapData->cbScanWidth); /* cbScanWidth (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */\n\t\t\tbitmapData->bitmapLength = bitmapData->cbCompMainBodySize;\n\t\t}\n\n\t\tbitmapData->compressed = TRUE;\n\t}\n\telse\n\t\tbitmapData->compressed = FALSE;\n\n\tif (Stream_GetRemainingLength(s) < bitmapData->bitmapLength)\n\t\treturn FALSE;\n\n\tif (bitmapData->bitmapLength > 0)\n\t{\n\t\tbitmapData->bitmapDataStream = malloc(bitmapData->bitmapLength);\n\n\t\tif (!bitmapData->bitmapDataStream)\n\t\t\treturn FALSE;\n\n\t\tmemcpy(bitmapData->bitmapDataStream, Stream_Pointer(s), bitmapData->bitmapLength);\n\t\tStream_Seek(s, bitmapData->bitmapLength);\n\t}\n\n\treturn TRUE;\n}","target":"static BOOL update_read_bitmap_data(rdpUpdate* update, wStream* s, BITMAP_DATA* bitmapData)\n{\n\tWINPR_UNUSED(update);\n\tif (Stream_GetRemainingLength(s) < 18)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, bitmapData->destLeft);\n\tStream_Read_UINT16(s, bitmapData->destTop);\n\tStream_Read_UINT16(s, bitmapData->destRight);\n\tStream_Read_UINT16(s, bitmapData->destBottom);\n\tStream_Read_UINT16(s, bitmapData->width);\n\tStream_Read_UINT16(s, bitmapData->height);\n\tStream_Read_UINT16(s, bitmapData->bitsPerPixel);\n\tStream_Read_UINT16(s, bitmapData->flags);\n\tStream_Read_UINT16(s, bitmapData->bitmapLength);\n\n\tif (bitmapData->flags & BITMAP_COMPRESSION)\n\t{\n\t\tif (!(bitmapData->flags & NO_BITMAP_COMPRESSION_HDR))\n\t\t{\n\t\t\tif (Stream_GetRemainingLength(s) < 8)\n\t\t\t\treturn FALSE;\n\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */\n\t\t\tStream_Read_UINT16(s, bitmapData->cbScanWidth); /* cbScanWidth (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */\n\t\t\tbitmapData->bitmapLength = bitmapData->cbCompMainBodySize;\n\t\t}\n\n\t\tbitmapData->compressed = TRUE;\n\t}\n\telse\n\t\tbitmapData->compressed = FALSE;\n\n\tif (Stream_GetRemainingLength(s) < bitmapData->bitmapLength)\n\t\treturn FALSE;\n\n\tif (bitmapData->bitmapLength > 0)\n\t{\n\t\tbitmapData->bitmapDataStream = malloc(bitmapData->bitmapLength);\n\n\t\tif (!bitmapData->bitmapDataStream)\n\t\t\treturn FALSE;\n\n\t\tmemcpy(bitmapData->bitmapDataStream, Stream_Pointer(s), bitmapData->bitmapLength);\n\t\tStream_Seek(s, bitmapData->bitmapLength);\n\t}\n\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"update_read_bitmap_data","file_name":"libfreerdp/core/update.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/f8890a645c221823ac133dbf991f8a65ae50d637","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#81-29bb54d2ec12","input":"static BOOL autodetect_recv_bandwidth_measure_results(rdpRdp* rdp, wStream* s,\n AUTODETECT_RSP_PDU* autodetectRspPdu)\n{\n\tBOOL success = TRUE;\n\n\tif (autodetectRspPdu->headerLength != 0x0E)\n\t\treturn FALSE;\n\n\tWLog_VRB(AUTODETECT_TAG, \"received Bandwidth Measure Results PDU\");\n\tStream_Read_UINT32(s, rdp->autodetect->bandwidthMeasureTimeDelta); /* timeDelta (4 bytes) */\n\tStream_Read_UINT32(s, rdp->autodetect->bandwidthMeasureByteCount); /* byteCount (4 bytes) */\n\n\tif (rdp->autodetect->bandwidthMeasureTimeDelta > 0)\n\t\trdp->autodetect->netCharBandwidth = rdp->autodetect->bandwidthMeasureByteCount * 8 /\n\t\t rdp->autodetect->bandwidthMeasureTimeDelta;\n\telse\n\t\trdp->autodetect->netCharBandwidth = 0;\n\n\tIFCALLRET(rdp->autodetect->BandwidthMeasureResults, success, rdp->context,\n\t autodetectRspPdu->sequenceNumber);\n\treturn success;\n}","target":"static BOOL autodetect_recv_bandwidth_measure_results(rdpRdp* rdp, wStream* s,\n AUTODETECT_RSP_PDU* autodetectRspPdu)\n{\n\tBOOL success = TRUE;\n\n\tif (autodetectRspPdu->headerLength != 0x0E)\n\t\treturn FALSE;\n\n\tWLog_VRB(AUTODETECT_TAG, \"received Bandwidth Measure Results PDU\");\n\tif (Stream_GetRemainingLength(s) < 8)\n\t\treturn -1;\n\tStream_Read_UINT32(s, rdp->autodetect->bandwidthMeasureTimeDelta); /* timeDelta (4 bytes) */\n\tStream_Read_UINT32(s, rdp->autodetect->bandwidthMeasureByteCount); /* byteCount (4 bytes) */\n\n\tif (rdp->autodetect->bandwidthMeasureTimeDelta > 0)\n\t\trdp->autodetect->netCharBandwidth = rdp->autodetect->bandwidthMeasureByteCount * 8 /\n\t\t rdp->autodetect->bandwidthMeasureTimeDelta;\n\telse\n\t\trdp->autodetect->netCharBandwidth = 0;\n\n\tIFCALLRET(rdp->autodetect->BandwidthMeasureResults, success, rdp->context,\n\t autodetectRspPdu->sequenceNumber);\n\treturn success;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"autodetect_recv_bandwidth_measure_results","file_name":"libfreerdp/core/autodetect.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/f5e73cc7c9cd973b516a618da877c87b80950b65","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#82-74f4e8de4f9e","input":"static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl,\n unsigned char **p,\n unsigned char *end )\n{\n int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;\n size_t len;\n ((void) ssl);\n\n /*\n * PSK parameters:\n *\n * opaque psk_identity_hint<0..2^16-1>;\n */\n if( (*p) > end - 2 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message \"\n \"(psk_identity_hint length)\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n len = (*p)[0] << 8 | (*p)[1];\n *p += 2;\n\n if( (*p) + len > end )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message \"\n \"(psk_identity_hint length)\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n /*\n * Note: we currently ignore the PKS identity hint, as we only allow one\n * PSK to be provisionned on the client. This could be changed later if\n * someone needs that feature.\n */\n *p += len;\n ret = 0;\n\n return( ret );\n}","target":"static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl,\n unsigned char **p,\n unsigned char *end )\n{\n int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;\n size_t len;\n ((void) ssl);\n\n /*\n * PSK parameters:\n *\n * opaque psk_identity_hint<0..2^16-1>;\n */\n if( (*p) > end - 2 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message \"\n \"(psk_identity_hint length)\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n len = (*p)[0] << 8 | (*p)[1];\n *p += 2;\n\n if( (*p) > end - len )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad server key exchange message \"\n \"(psk_identity_hint length)\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );\n }\n\n /*\n * Note: we currently ignore the PKS identity hint, as we only allow one\n * PSK to be provisionned on the client. This could be changed later if\n * someone needs that feature.\n */\n *p += len;\n ret = 0;\n\n return( ret );\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ssl_parse_server_psk_hint","file_name":"library/ssl_cli.c","commit_link":"github.com/ARMmbed/mbedtls/commit/5224a7544c95552553e2e6be0b4a789956a6464e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#83-262f6cccc156","input":"static void youngcollection (lua_State *L, global_State *g) {\n GCObject **psurvival; /* to point to first non-dead survival object */\n lua_assert(g->gcstate == GCSpropagate);\n markold(g, g->survival, g->reallyold);\n markold(g, g->finobj, g->finobjrold);\n atomic(L);\n\n /* sweep nursery and get a pointer to its last live element */\n psurvival = sweepgen(L, g, &g->allgc, g->survival);\n /* sweep 'survival' and 'old' */\n sweepgen(L, g, psurvival, g->reallyold);\n g->reallyold = g->old;\n g->old = *psurvival; /* 'survival' survivals are old now */\n g->survival = g->allgc; /* all news are survivals */\n\n /* repeat for 'finobj' lists */\n psurvival = sweepgen(L, g, &g->finobj, g->finobjsur);\n /* sweep 'survival' and 'old' */\n sweepgen(L, g, psurvival, g->finobjrold);\n g->finobjrold = g->finobjold;\n g->finobjold = *psurvival; /* 'survival' survivals are old now */\n g->finobjsur = g->finobj; /* all news are survivals */\n\n sweepgen(L, g, &g->tobefnz, NULL);\n\n finishgencycle(L, g);\n}","target":"static void youngcollection (lua_State *L, global_State *g) {\n GCObject **psurvival; /* to point to first non-dead survival object */\n lua_assert(g->gcstate == GCSpropagate);\n markold(g, g->allgc, g->reallyold);\n markold(g, g->finobj, g->finobjrold);\n atomic(L);\n\n /* sweep nursery and get a pointer to its last live element */\n psurvival = sweepgen(L, g, &g->allgc, g->survival);\n /* sweep 'survival' and 'old' */\n sweepgen(L, g, psurvival, g->reallyold);\n g->reallyold = g->old;\n g->old = *psurvival; /* 'survival' survivals are old now */\n g->survival = g->allgc; /* all news are survivals */\n\n /* repeat for 'finobj' lists */\n psurvival = sweepgen(L, g, &g->finobj, g->finobjsur);\n /* sweep 'survival' and 'old' */\n sweepgen(L, g, psurvival, g->finobjrold);\n g->finobjrold = g->finobjold;\n g->finobjold = *psurvival; /* 'survival' survivals are old now */\n g->finobjsur = g->finobj; /* all news are survivals */\n\n sweepgen(L, g, &g->tobefnz, NULL);\n\n finishgencycle(L, g);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"youngcollection","file_name":"lgc.c","commit_link":"github.com/lua/lua/commit/127e7a6c8942b362aa3c6627f44d660a4fb75312","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#84-6834109949cf","input":"static int ext4_fill_super(struct super_block *sb, void *data, int silent)\n{\n\tchar *orig_data = kstrdup(data, GFP_KERNEL);\n\tstruct buffer_head *bh;\n\tstruct ext4_super_block *es = NULL;\n\tstruct ext4_sb_info *sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);\n\text4_fsblk_t block;\n\text4_fsblk_t sb_block = get_sb_block(&data);\n\text4_fsblk_t logical_sb_block;\n\tunsigned long offset = 0;\n\tunsigned long journal_devnum = 0;\n\tunsigned long def_mount_opts;\n\tstruct inode *root;\n\tconst char *descr;\n\tint ret = -ENOMEM;\n\tint blocksize, clustersize;\n\tunsigned int db_count;\n\tunsigned int i;\n\tint needs_recovery, has_huge_files, has_bigalloc;\n\t__u64 blocks_count;\n\tint err = 0;\n\tunsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;\n\text4_group_t first_not_zeroed;\n\n\tif ((data && !orig_data) || !sbi)\n\t\tgoto out_free_base;\n\n\tsbi->s_blockgroup_lock =\n\t\tkzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);\n\tif (!sbi->s_blockgroup_lock)\n\t\tgoto out_free_base;\n\n\tsb->s_fs_info = sbi;\n\tsbi->s_sb = sb;\n\tsbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS;\n\tsbi->s_sb_block = sb_block;\n\tif (sb->s_bdev->bd_part)\n\t\tsbi->s_sectors_written_start =\n\t\t\tpart_stat_read(sb->s_bdev->bd_part, sectors[1]);\n\n\t/* Cleanup superblock name */\n\tstrreplace(sb->s_id, '/', '!');\n\n\t/* -EINVAL is default */\n\tret = -EINVAL;\n\tblocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE);\n\tif (!blocksize) {\n\t\text4_msg(sb, KERN_ERR, \"unable to set blocksize\");\n\t\tgoto out_fail;\n\t}\n\n\t/*\n\t * The ext4 superblock will not be buffer aligned for other than 1kB\n\t * block sizes. We need to calculate the offset from buffer start.\n\t */\n\tif (blocksize != EXT4_MIN_BLOCK_SIZE) {\n\t\tlogical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;\n\t\toffset = do_div(logical_sb_block, blocksize);\n\t} else {\n\t\tlogical_sb_block = sb_block;\n\t}\n\n\tif (!(bh = sb_bread_unmovable(sb, logical_sb_block))) {\n\t\text4_msg(sb, KERN_ERR, \"unable to read superblock\");\n\t\tgoto out_fail;\n\t}\n\t/*\n\t * Note: s_es must be initialized as soon as possible because\n\t * some ext4 macro-instructions depend on its value\n\t */\n\tes = (struct ext4_super_block *) (bh->b_data + offset);\n\tsbi->s_es = es;\n\tsb->s_magic = le16_to_cpu(es->s_magic);\n\tif (sb->s_magic != EXT4_SUPER_MAGIC)\n\t\tgoto cantfind_ext4;\n\tsbi->s_kbytes_written = le64_to_cpu(es->s_kbytes_written);\n\n\t/* Warn if metadata_csum and gdt_csum are both set. */\n\tif (ext4_has_feature_metadata_csum(sb) &&\n\t ext4_has_feature_gdt_csum(sb))\n\t\text4_warning(sb, \"metadata_csum and uninit_bg are \"\n\t\t\t \"redundant flags; please run fsck.\");\n\n\t/* Check for a known checksum algorithm */\n\tif (!ext4_verify_csum_type(sb, es)) {\n\t\text4_msg(sb, KERN_ERR, \"VFS: Found ext4 filesystem with \"\n\t\t\t \"unknown checksum algorithm.\");\n\t\tsilent = 1;\n\t\tgoto cantfind_ext4;\n\t}\n\n\t/* Load the checksum driver */\n\tif (ext4_has_feature_metadata_csum(sb)) {\n\t\tsbi->s_chksum_driver = crypto_alloc_shash(\"crc32c\", 0, 0);\n\t\tif (IS_ERR(sbi->s_chksum_driver)) {\n\t\t\text4_msg(sb, KERN_ERR, \"Cannot load crc32c driver.\");\n\t\t\tret = PTR_ERR(sbi->s_chksum_driver);\n\t\t\tsbi->s_chksum_driver = NULL;\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\t/* Check superblock checksum */\n\tif (!ext4_superblock_csum_verify(sb, es)) {\n\t\text4_msg(sb, KERN_ERR, \"VFS: Found ext4 filesystem with \"\n\t\t\t \"invalid superblock checksum. Run e2fsck?\");\n\t\tsilent = 1;\n\t\tret = -EFSBADCRC;\n\t\tgoto cantfind_ext4;\n\t}\n\n\t/* Precompute checksum seed for all metadata */\n\tif (ext4_has_feature_csum_seed(sb))\n\t\tsbi->s_csum_seed = le32_to_cpu(es->s_checksum_seed);\n\telse if (ext4_has_metadata_csum(sb))\n\t\tsbi->s_csum_seed = ext4_chksum(sbi, ~0, es->s_uuid,\n\t\t\t\t\t sizeof(es->s_uuid));\n\n\t/* Set defaults before we parse the mount options */\n\tdef_mount_opts = le32_to_cpu(es->s_default_mount_opts);\n\tset_opt(sb, INIT_INODE_TABLE);\n\tif (def_mount_opts & EXT4_DEFM_DEBUG)\n\t\tset_opt(sb, DEBUG);\n\tif (def_mount_opts & EXT4_DEFM_BSDGROUPS)\n\t\tset_opt(sb, GRPID);\n\tif (def_mount_opts & EXT4_DEFM_UID16)\n\t\tset_opt(sb, NO_UID32);\n\t/* xattr user namespace & acls are now defaulted on */\n\tset_opt(sb, XATTR_USER);\n#ifdef CONFIG_EXT4_FS_POSIX_ACL\n\tset_opt(sb, POSIX_ACL);\n#endif\n\t/* don't forget to enable journal_csum when metadata_csum is enabled. */\n\tif (ext4_has_metadata_csum(sb))\n\t\tset_opt(sb, JOURNAL_CHECKSUM);\n\n\tif ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)\n\t\tset_opt(sb, JOURNAL_DATA);\n\telse if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)\n\t\tset_opt(sb, ORDERED_DATA);\n\telse if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_WBACK)\n\t\tset_opt(sb, WRITEBACK_DATA);\n\n\tif (le16_to_cpu(sbi->s_es->s_errors) == EXT4_ERRORS_PANIC)\n\t\tset_opt(sb, ERRORS_PANIC);\n\telse if (le16_to_cpu(sbi->s_es->s_errors) == EXT4_ERRORS_CONTINUE)\n\t\tset_opt(sb, ERRORS_CONT);\n\telse\n\t\tset_opt(sb, ERRORS_RO);\n\t/* block_validity enabled by default; disable with noblock_validity */\n\tset_opt(sb, BLOCK_VALIDITY);\n\tif (def_mount_opts & EXT4_DEFM_DISCARD)\n\t\tset_opt(sb, DISCARD);\n\n\tsbi->s_resuid = make_kuid(&init_user_ns, le16_to_cpu(es->s_def_resuid));\n\tsbi->s_resgid = make_kgid(&init_user_ns, le16_to_cpu(es->s_def_resgid));\n\tsbi->s_commit_interval = JBD2_DEFAULT_MAX_COMMIT_AGE * HZ;\n\tsbi->s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME;\n\tsbi->s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME;\n\n\tif ((def_mount_opts & EXT4_DEFM_NOBARRIER) == 0)\n\t\tset_opt(sb, BARRIER);\n\n\t/*\n\t * enable delayed allocation by default\n\t * Use -o nodelalloc to turn it off\n\t */\n\tif (!IS_EXT3_SB(sb) && !IS_EXT2_SB(sb) &&\n\t ((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0))\n\t\tset_opt(sb, DELALLOC);\n\n\t/*\n\t * set default s_li_wait_mult for lazyinit, for the case there is\n\t * no mount option specified.\n\t */\n\tsbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT;\n\n\tif (sbi->s_es->s_mount_opts[0]) {\n\t\tchar *s_mount_opts = kstrndup(sbi->s_es->s_mount_opts,\n\t\t\t\t\t sizeof(sbi->s_es->s_mount_opts),\n\t\t\t\t\t GFP_KERNEL);\n\t\tif (!s_mount_opts)\n\t\t\tgoto failed_mount;\n\t\tif (!parse_options(s_mount_opts, sb, &journal_devnum,\n\t\t\t\t &journal_ioprio, 0)) {\n\t\t\text4_msg(sb, KERN_WARNING,\n\t\t\t\t \"failed to parse options in superblock: %s\",\n\t\t\t\t s_mount_opts);\n\t\t}\n\t\tkfree(s_mount_opts);\n\t}\n\tsbi->s_def_mount_opt = sbi->s_mount_opt;\n\tif (!parse_options((char *) data, sb, &journal_devnum,\n\t\t\t &journal_ioprio, 0))\n\t\tgoto failed_mount;\n\n\tif (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {\n\t\tprintk_once(KERN_WARNING \"EXT4-fs: Warning: mounting \"\n\t\t\t \"with data=journal disables delayed \"\n\t\t\t \"allocation and O_DIRECT support!\\n\");\n\t\tif (test_opt2(sb, EXPLICIT_DELALLOC)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and delalloc\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DIOREAD_NOLOCK)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and dioread_nolock\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DAX)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and dax\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DELALLOC))\n\t\t\tclear_opt(sb, DELALLOC);\n\t} else {\n\t\tsb->s_iflags |= SB_I_CGROUPWB;\n\t}\n\n\tsb->s_flags = (sb->s_flags & ~MS_POSIXACL) |\n\t\t(test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);\n\n\tif (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV &&\n\t (ext4_has_compat_features(sb) ||\n\t ext4_has_ro_compat_features(sb) ||\n\t ext4_has_incompat_features(sb)))\n\t\text4_msg(sb, KERN_WARNING,\n\t\t \"feature flags set on rev 0 fs, \"\n\t\t \"running e2fsck is recommended\");\n\n\tif (es->s_creator_os == cpu_to_le32(EXT4_OS_HURD)) {\n\t\tset_opt2(sb, HURD_COMPAT);\n\t\tif (ext4_has_feature_64bit(sb)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"The Hurd can't support 64-bit file systems\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\tif (IS_EXT2_SB(sb)) {\n\t\tif (ext2_feature_set_ok(sb))\n\t\t\text4_msg(sb, KERN_INFO, \"mounting ext2 file system \"\n\t\t\t\t \"using the ext4 subsystem\");\n\t\telse {\n\t\t\text4_msg(sb, KERN_ERR, \"couldn't mount as ext2 due \"\n\t\t\t\t \"to feature incompatibilities\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\tif (IS_EXT3_SB(sb)) {\n\t\tif (ext3_feature_set_ok(sb))\n\t\t\text4_msg(sb, KERN_INFO, \"mounting ext3 file system \"\n\t\t\t\t \"using the ext4 subsystem\");\n\t\telse {\n\t\t\text4_msg(sb, KERN_ERR, \"couldn't mount as ext3 due \"\n\t\t\t\t \"to feature incompatibilities\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\t/*\n\t * Check feature flags regardless of the revision level, since we\n\t * previously didn't change the revision level when setting the flags,\n\t * so there is a chance incompat flags are set on a rev 0 filesystem.\n\t */\n\tif (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY)))\n\t\tgoto failed_mount;\n\n\tblocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);\n\tif (blocksize < EXT4_MIN_BLOCK_SIZE ||\n\t blocksize > EXT4_MAX_BLOCK_SIZE) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t \"Unsupported filesystem blocksize %d (%d log_block_size)\",\n\t\t\t blocksize, le32_to_cpu(es->s_log_block_size));\n\t\tgoto failed_mount;\n\t}\n\tif (le32_to_cpu(es->s_log_block_size) >\n\t (EXT4_MAX_BLOCK_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Invalid log block size: %u\",\n\t\t\t le32_to_cpu(es->s_log_block_size));\n\t\tgoto failed_mount;\n\t}\n\n\tif (le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) > (blocksize / 4)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Number of reserved GDT blocks insanely large: %d\",\n\t\t\t le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks));\n\t\tgoto failed_mount;\n\t}\n\n\tif (sbi->s_mount_opt & EXT4_MOUNT_DAX) {\n\t\terr = bdev_dax_supported(sb, blocksize);\n\t\tif (err)\n\t\t\tgoto failed_mount;\n\t}\n\n\tif (ext4_has_feature_encrypt(sb) && es->s_encryption_level) {\n\t\text4_msg(sb, KERN_ERR, \"Unsupported encryption level %d\",\n\t\t\t es->s_encryption_level);\n\t\tgoto failed_mount;\n\t}\n\n\tif (sb->s_blocksize != blocksize) {\n\t\t/* Validate the filesystem blocksize */\n\t\tif (!sb_set_blocksize(sb, blocksize)) {\n\t\t\text4_msg(sb, KERN_ERR, \"bad block size %d\",\n\t\t\t\t\tblocksize);\n\t\t\tgoto failed_mount;\n\t\t}\n\n\t\tbrelse(bh);\n\t\tlogical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;\n\t\toffset = do_div(logical_sb_block, blocksize);\n\t\tbh = sb_bread_unmovable(sb, logical_sb_block);\n\t\tif (!bh) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Can't read superblock on 2nd try\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tes = (struct ext4_super_block *)(bh->b_data + offset);\n\t\tsbi->s_es = es;\n\t\tif (es->s_magic != cpu_to_le16(EXT4_SUPER_MAGIC)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Magic mismatch, very weird!\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\thas_huge_files = ext4_has_feature_huge_file(sb);\n\tsbi->s_bitmap_maxbytes = ext4_max_bitmap_size(sb->s_blocksize_bits,\n\t\t\t\t\t\t has_huge_files);\n\tsb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits, has_huge_files);\n\n\tif (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV) {\n\t\tsbi->s_inode_size = EXT4_GOOD_OLD_INODE_SIZE;\n\t\tsbi->s_first_ino = EXT4_GOOD_OLD_FIRST_INO;\n\t} else {\n\t\tsbi->s_inode_size = le16_to_cpu(es->s_inode_size);\n\t\tsbi->s_first_ino = le32_to_cpu(es->s_first_ino);\n\t\tif ((sbi->s_inode_size < EXT4_GOOD_OLD_INODE_SIZE) ||\n\t\t (!is_power_of_2(sbi->s_inode_size)) ||\n\t\t (sbi->s_inode_size > blocksize)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unsupported inode size: %d\",\n\t\t\t sbi->s_inode_size);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE)\n\t\t\tsb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2);\n\t}\n\n\tsbi->s_desc_size = le16_to_cpu(es->s_desc_size);\n\tif (ext4_has_feature_64bit(sb)) {\n\t\tif (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||\n\t\t sbi->s_desc_size > EXT4_MAX_DESC_SIZE ||\n\t\t !is_power_of_2(sbi->s_desc_size)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unsupported descriptor size %lu\",\n\t\t\t sbi->s_desc_size);\n\t\t\tgoto failed_mount;\n\t\t}\n\t} else\n\t\tsbi->s_desc_size = EXT4_MIN_DESC_SIZE;\n\n\tsbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);\n\tsbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);\n\n\tsbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb);\n\tif (sbi->s_inodes_per_block == 0)\n\t\tgoto cantfind_ext4;\n\tif (sbi->s_inodes_per_group < sbi->s_inodes_per_block ||\n\t sbi->s_inodes_per_group > blocksize * 8) {\n\t\text4_msg(sb, KERN_ERR, \"invalid inodes per group: %lu\\n\",\n\t\t\t sbi->s_blocks_per_group);\n\t\tgoto failed_mount;\n\t}\n\tsbi->s_itb_per_group = sbi->s_inodes_per_group /\n\t\t\t\t\tsbi->s_inodes_per_block;\n\tsbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);\n\tsbi->s_sbh = bh;\n\tsbi->s_mount_state = le16_to_cpu(es->s_state);\n\tsbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb));\n\tsbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb));\n\n\tfor (i = 0; i < 4; i++)\n\t\tsbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);\n\tsbi->s_def_hash_version = es->s_def_hash_version;\n\tif (ext4_has_feature_dir_index(sb)) {\n\t\ti = le32_to_cpu(es->s_flags);\n\t\tif (i & EXT2_FLAGS_UNSIGNED_HASH)\n\t\t\tsbi->s_hash_unsigned = 3;\n\t\telse if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) {\n#ifdef __CHAR_UNSIGNED__\n\t\t\tif (!(sb->s_flags & MS_RDONLY))\n\t\t\t\tes->s_flags |=\n\t\t\t\t\tcpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH);\n\t\t\tsbi->s_hash_unsigned = 3;\n#else\n\t\t\tif (!(sb->s_flags & MS_RDONLY))\n\t\t\t\tes->s_flags |=\n\t\t\t\t\tcpu_to_le32(EXT2_FLAGS_SIGNED_HASH);\n#endif\n\t\t}\n\t}\n\n\t/* Handle clustersize */\n\tclustersize = BLOCK_SIZE << le32_to_cpu(es->s_log_cluster_size);\n\thas_bigalloc = ext4_has_feature_bigalloc(sb);\n\tif (has_bigalloc) {\n\t\tif (clustersize < blocksize) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"cluster size (%d) smaller than \"\n\t\t\t\t \"block size (%d)\", clustersize, blocksize);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (le32_to_cpu(es->s_log_cluster_size) >\n\t\t (EXT4_MAX_CLUSTER_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"Invalid log cluster size: %u\",\n\t\t\t\t le32_to_cpu(es->s_log_cluster_size));\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tsbi->s_cluster_bits = le32_to_cpu(es->s_log_cluster_size) -\n\t\t\tle32_to_cpu(es->s_log_block_size);\n\t\tsbi->s_clusters_per_group =\n\t\t\tle32_to_cpu(es->s_clusters_per_group);\n\t\tif (sbi->s_clusters_per_group > blocksize * 8) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"#clusters per group too big: %lu\",\n\t\t\t\t sbi->s_clusters_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (sbi->s_blocks_per_group !=\n\t\t (sbi->s_clusters_per_group * (clustersize / blocksize))) {\n\t\t\text4_msg(sb, KERN_ERR, \"blocks per group (%lu) and \"\n\t\t\t\t \"clusters per group (%lu) inconsistent\",\n\t\t\t\t sbi->s_blocks_per_group,\n\t\t\t\t sbi->s_clusters_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t} else {\n\t\tif (clustersize != blocksize) {\n\t\t\text4_warning(sb, \"fragment/cluster size (%d) != \"\n\t\t\t\t \"block size (%d)\", clustersize,\n\t\t\t\t blocksize);\n\t\t\tclustersize = blocksize;\n\t\t}\n\t\tif (sbi->s_blocks_per_group > blocksize * 8) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"#blocks per group too big: %lu\",\n\t\t\t\t sbi->s_blocks_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tsbi->s_clusters_per_group = sbi->s_blocks_per_group;\n\t\tsbi->s_cluster_bits = 0;\n\t}\n\tsbi->s_cluster_ratio = clustersize / blocksize;\n\n\t/* Do we have standard group size of clustersize * 8 blocks ? */\n\tif (sbi->s_blocks_per_group == clustersize << 3)\n\t\tset_opt2(sb, STD_GROUP_SIZE);\n\n\t/*\n\t * Test whether we have more sectors than will fit in sector_t,\n\t * and whether the max offset is addressable by the page cache.\n\t */\n\terr = generic_check_addressable(sb->s_blocksize_bits,\n\t\t\t\t\text4_blocks_count(es));\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"filesystem\"\n\t\t\t \" too large to mount safely on this system\");\n\t\tif (sizeof(sector_t) < 8)\n\t\t\text4_msg(sb, KERN_WARNING, \"CONFIG_LBDAF not enabled\");\n\t\tgoto failed_mount;\n\t}\n\n\tif (EXT4_BLOCKS_PER_GROUP(sb) == 0)\n\t\tgoto cantfind_ext4;\n\n\t/* check blocks count against device size */\n\tblocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;\n\tif (blocks_count && ext4_blocks_count(es) > blocks_count) {\n\t\text4_msg(sb, KERN_WARNING, \"bad geometry: block count %llu \"\n\t\t \"exceeds size of device (%llu blocks)\",\n\t\t ext4_blocks_count(es), blocks_count);\n\t\tgoto failed_mount;\n\t}\n\n\t/*\n\t * It makes no sense for the first data block to be beyond the end\n\t * of the filesystem.\n\t */\n\tif (le32_to_cpu(es->s_first_data_block) >= ext4_blocks_count(es)) {\n\t\text4_msg(sb, KERN_WARNING, \"bad geometry: first data \"\n\t\t\t \"block %u is beyond end of filesystem (%llu)\",\n\t\t\t le32_to_cpu(es->s_first_data_block),\n\t\t\t ext4_blocks_count(es));\n\t\tgoto failed_mount;\n\t}\n\tblocks_count = (ext4_blocks_count(es) -\n\t\t\tle32_to_cpu(es->s_first_data_block) +\n\t\t\tEXT4_BLOCKS_PER_GROUP(sb) - 1);\n\tdo_div(blocks_count, EXT4_BLOCKS_PER_GROUP(sb));\n\tif (blocks_count > ((uint64_t)1<<32) - EXT4_DESC_PER_BLOCK(sb)) {\n\t\text4_msg(sb, KERN_WARNING, \"groups count too large: %u \"\n\t\t \"(block count %llu, first data block %u, \"\n\t\t \"blocks per group %lu)\", sbi->s_groups_count,\n\t\t ext4_blocks_count(es),\n\t\t le32_to_cpu(es->s_first_data_block),\n\t\t EXT4_BLOCKS_PER_GROUP(sb));\n\t\tgoto failed_mount;\n\t}\n\tsbi->s_groups_count = blocks_count;\n\tsbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count,\n\t\t\t(EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb)));\n\tdb_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /\n\t\t EXT4_DESC_PER_BLOCK(sb);\n\tsbi->s_group_desc = ext4_kvmalloc(db_count *\n\t\t\t\t\t sizeof(struct buffer_head *),\n\t\t\t\t\t GFP_KERNEL);\n\tif (sbi->s_group_desc == NULL) {\n\t\text4_msg(sb, KERN_ERR, \"not enough memory\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount;\n\t}\n\n\tbgl_lock_init(sbi->s_blockgroup_lock);\n\n\tfor (i = 0; i < db_count; i++) {\n\t\tblock = descriptor_loc(sb, logical_sb_block, i);\n\t\tsbi->s_group_desc[i] = sb_bread_unmovable(sb, block);\n\t\tif (!sbi->s_group_desc[i]) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"can't read group descriptor %d\", i);\n\t\t\tdb_count = i;\n\t\t\tgoto failed_mount2;\n\t\t}\n\t}\n\tif (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) {\n\t\text4_msg(sb, KERN_ERR, \"group descriptors corrupted!\");\n\t\tret = -EFSCORRUPTED;\n\t\tgoto failed_mount2;\n\t}\n\n\tsbi->s_gdb_count = db_count;\n\tget_random_bytes(&sbi->s_next_generation, sizeof(u32));\n\tspin_lock_init(&sbi->s_next_gen_lock);\n\n\tsetup_timer(&sbi->s_err_report, print_daily_error_info,\n\t\t(unsigned long) sb);\n\n\t/* Register extent status tree shrinker */\n\tif (ext4_es_register_shrinker(sbi))\n\t\tgoto failed_mount3;\n\n\tsbi->s_stripe = ext4_get_stripe_size(sbi);\n\tsbi->s_extent_max_zeroout_kb = 32;\n\n\t/*\n\t * set up enough so that it can read an inode\n\t */\n\tsb->s_op = &ext4_sops;\n\tsb->s_export_op = &ext4_export_ops;\n\tsb->s_xattr = ext4_xattr_handlers;\n\tsb->s_cop = &ext4_cryptops;\n#ifdef CONFIG_QUOTA\n\tsb->dq_op = &ext4_quota_operations;\n\tif (ext4_has_feature_quota(sb))\n\t\tsb->s_qcop = &dquot_quotactl_sysfile_ops;\n\telse\n\t\tsb->s_qcop = &ext4_qctl_operations;\n\tsb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;\n#endif\n\tmemcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));\n\n\tINIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */\n\tmutex_init(&sbi->s_orphan_lock);\n\n\tsb->s_root = NULL;\n\n\tneeds_recovery = (es->s_last_orphan != 0 ||\n\t\t\t ext4_has_feature_journal_needs_recovery(sb));\n\n\tif (ext4_has_feature_mmp(sb) && !(sb->s_flags & MS_RDONLY))\n\t\tif (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)))\n\t\t\tgoto failed_mount3a;\n\n\t/*\n\t * The first inode we look at is the journal inode. Don't try\n\t * root first: it may be modified in the journal!\n\t */\n\tif (!test_opt(sb, NOLOAD) && ext4_has_feature_journal(sb)) {\n\t\tif (ext4_load_journal(sb, es, journal_devnum))\n\t\t\tgoto failed_mount3a;\n\t} else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) &&\n\t\t ext4_has_feature_journal_needs_recovery(sb)) {\n\t\text4_msg(sb, KERN_ERR, \"required journal recovery \"\n\t\t \"suppressed and not mounted read-only\");\n\t\tgoto failed_mount_wq;\n\t} else {\n\t\t/* Nojournal mode, all journal mount options are illegal */\n\t\tif (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"journal_checksum, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"journal_async_commit, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"commit=%lu, fs mounted w/o journal\",\n\t\t\t\t sbi->s_commit_interval / HZ);\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (EXT4_MOUNT_DATA_FLAGS &\n\t\t (sbi->s_mount_opt ^ sbi->s_def_mount_opt)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"data=, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tsbi->s_def_mount_opt &= EXT4_MOUNT_JOURNAL_CHECKSUM;\n\t\tclear_opt(sb, JOURNAL_CHECKSUM);\n\t\tclear_opt(sb, DATA_FLAGS);\n\t\tsbi->s_journal = NULL;\n\t\tneeds_recovery = 0;\n\t\tgoto no_journal;\n\t}\n\n\tif (ext4_has_feature_64bit(sb) &&\n\t !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0,\n\t\t\t\t JBD2_FEATURE_INCOMPAT_64BIT)) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to set 64-bit journal feature\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif (!set_journal_csum_feature_set(sb)) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to set journal checksum \"\n\t\t\t \"feature set\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\t/* We have now updated the journal if required, so we can\n\t * validate the data journaling mode. */\n\tswitch (test_opt(sb, DATA_FLAGS)) {\n\tcase 0:\n\t\t/* No mode set, assume a default based on the journal\n\t\t * capabilities: ORDERED_DATA if the journal can\n\t\t * cope, else JOURNAL_DATA\n\t\t */\n\t\tif (jbd2_journal_check_available_features\n\t\t (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE))\n\t\t\tset_opt(sb, ORDERED_DATA);\n\t\telse\n\t\t\tset_opt(sb, JOURNAL_DATA);\n\t\tbreak;\n\n\tcase EXT4_MOUNT_ORDERED_DATA:\n\tcase EXT4_MOUNT_WRITEBACK_DATA:\n\t\tif (!jbd2_journal_check_available_features\n\t\t (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)) {\n\t\t\text4_msg(sb, KERN_ERR, \"Journal does not support \"\n\t\t\t \"requested data journaling mode\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\tdefault:\n\t\tbreak;\n\t}\n\tset_task_ioprio(sbi->s_journal->j_task, journal_ioprio);\n\n\tsbi->s_journal->j_commit_callback = ext4_journal_commit_callback;\n\nno_journal:\n\tsbi->s_mb_cache = ext4_xattr_create_cache();\n\tif (!sbi->s_mb_cache) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to create an mb_cache\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif ((DUMMY_ENCRYPTION_ENABLED(sbi) || ext4_has_feature_encrypt(sb)) &&\n\t (blocksize != PAGE_SIZE)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Unsupported blocksize for fs encryption\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) &&\n\t !ext4_has_feature_encrypt(sb)) {\n\t\text4_set_feature_encrypt(sb);\n\t\text4_commit_super(sb, 1);\n\t}\n\n\t/*\n\t * Get the # of file system overhead blocks from the\n\t * superblock if present.\n\t */\n\tif (es->s_overhead_clusters)\n\t\tsbi->s_overhead = le32_to_cpu(es->s_overhead_clusters);\n\telse {\n\t\terr = ext4_calculate_overhead(sb);\n\t\tif (err)\n\t\t\tgoto failed_mount_wq;\n\t}\n\n\t/*\n\t * The maximum number of concurrent works can be high and\n\t * concurrency isn't really necessary. Limit it to 1.\n\t */\n\tEXT4_SB(sb)->rsv_conversion_wq =\n\t\talloc_workqueue(\"ext4-rsv-conversion\", WQ_MEM_RECLAIM | WQ_UNBOUND, 1);\n\tif (!EXT4_SB(sb)->rsv_conversion_wq) {\n\t\tprintk(KERN_ERR \"EXT4-fs: failed to create workqueue\\n\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount4;\n\t}\n\n\t/*\n\t * The jbd2_journal_load will have done any necessary log recovery,\n\t * so we can safely mount the rest of the filesystem now.\n\t */\n\n\troot = ext4_iget(sb, EXT4_ROOT_INO);\n\tif (IS_ERR(root)) {\n\t\text4_msg(sb, KERN_ERR, \"get root inode failed\");\n\t\tret = PTR_ERR(root);\n\t\troot = NULL;\n\t\tgoto failed_mount4;\n\t}\n\tif (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {\n\t\text4_msg(sb, KERN_ERR, \"corrupt root inode, run e2fsck\");\n\t\tiput(root);\n\t\tgoto failed_mount4;\n\t}\n\tsb->s_root = d_make_root(root);\n\tif (!sb->s_root) {\n\t\text4_msg(sb, KERN_ERR, \"get root dentry failed\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount4;\n\t}\n\n\tif (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY))\n\t\tsb->s_flags |= MS_RDONLY;\n\n\t/* determine the minimum size of new large inodes, if present */\n\tif (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {\n\t\tsbi->s_want_extra_isize = sizeof(struct ext4_inode) -\n\t\t\t\t\t\t EXT4_GOOD_OLD_INODE_SIZE;\n\t\tif (ext4_has_feature_extra_isize(sb)) {\n\t\t\tif (sbi->s_want_extra_isize <\n\t\t\t le16_to_cpu(es->s_want_extra_isize))\n\t\t\t\tsbi->s_want_extra_isize =\n\t\t\t\t\tle16_to_cpu(es->s_want_extra_isize);\n\t\t\tif (sbi->s_want_extra_isize <\n\t\t\t le16_to_cpu(es->s_min_extra_isize))\n\t\t\t\tsbi->s_want_extra_isize =\n\t\t\t\t\tle16_to_cpu(es->s_min_extra_isize);\n\t\t}\n\t}\n\t/* Check if enough inode space is available */\n\tif (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >\n\t\t\t\t\t\t\tsbi->s_inode_size) {\n\t\tsbi->s_want_extra_isize = sizeof(struct ext4_inode) -\n\t\t\t\t\t\t EXT4_GOOD_OLD_INODE_SIZE;\n\t\text4_msg(sb, KERN_INFO, \"required extra inode space not\"\n\t\t\t \"available\");\n\t}\n\n\text4_set_resv_clusters(sb);\n\n\terr = ext4_setup_system_zone(sb);\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"failed to initialize system \"\n\t\t\t \"zone (%d)\", err);\n\t\tgoto failed_mount4a;\n\t}\n\n\text4_ext_init(sb);\n\terr = ext4_mb_init(sb);\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"failed to initialize mballoc (%d)\",\n\t\t\t err);\n\t\tgoto failed_mount5;\n\t}\n\n\tblock = ext4_count_free_clusters(sb);\n\text4_free_blocks_count_set(sbi->s_es, \n\t\t\t\t EXT4_C2B(sbi, block));\n\terr = percpu_counter_init(&sbi->s_freeclusters_counter, block,\n\t\t\t\t GFP_KERNEL);\n\tif (!err) {\n\t\tunsigned long freei = ext4_count_free_inodes(sb);\n\t\tsbi->s_es->s_free_inodes_count = cpu_to_le32(freei);\n\t\terr = percpu_counter_init(&sbi->s_freeinodes_counter, freei,\n\t\t\t\t\t GFP_KERNEL);\n\t}\n\tif (!err)\n\t\terr = percpu_counter_init(&sbi->s_dirs_counter,\n\t\t\t\t\t ext4_count_dirs(sb), GFP_KERNEL);\n\tif (!err)\n\t\terr = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0,\n\t\t\t\t\t GFP_KERNEL);\n\tif (!err)\n\t\terr = percpu_init_rwsem(&sbi->s_journal_flag_rwsem);\n\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"insufficient memory\");\n\t\tgoto failed_mount6;\n\t}\n\n\tif (ext4_has_feature_flex_bg(sb))\n\t\tif (!ext4_fill_flex_info(sb)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unable to initialize \"\n\t\t\t \"flex_bg meta info!\");\n\t\t\tgoto failed_mount6;\n\t\t}\n\n\terr = ext4_register_li_request(sb, first_not_zeroed);\n\tif (err)\n\t\tgoto failed_mount6;\n\n\terr = ext4_register_sysfs(sb);\n\tif (err)\n\t\tgoto failed_mount7;\n\n#ifdef CONFIG_QUOTA\n\t/* Enable quota usage during mount. */\n\tif (ext4_has_feature_quota(sb) && !(sb->s_flags & MS_RDONLY)) {\n\t\terr = ext4_enable_quotas(sb);\n\t\tif (err)\n\t\t\tgoto failed_mount8;\n\t}\n#endif /* CONFIG_QUOTA */\n\n\tEXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS;\n\text4_orphan_cleanup(sb, es);\n\tEXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;\n\tif (needs_recovery) {\n\t\text4_msg(sb, KERN_INFO, \"recovery complete\");\n\t\text4_mark_recovery_complete(sb, es);\n\t}\n\tif (EXT4_SB(sb)->s_journal) {\n\t\tif (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)\n\t\t\tdescr = \" journalled data mode\";\n\t\telse if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)\n\t\t\tdescr = \" ordered data mode\";\n\t\telse\n\t\t\tdescr = \" writeback data mode\";\n\t} else\n\t\tdescr = \"out journal\";\n\n\tif (test_opt(sb, DISCARD)) {\n\t\tstruct request_queue *q = bdev_get_queue(sb->s_bdev);\n\t\tif (!blk_queue_discard(q))\n\t\t\text4_msg(sb, KERN_WARNING,\n\t\t\t\t \"mounting with \\\"discard\\\" option, but \"\n\t\t\t\t \"the device does not support discard\");\n\t}\n\n\tif (___ratelimit(&ext4_mount_msg_ratelimit, \"EXT4-fs mount\"))\n\t\text4_msg(sb, KERN_INFO, \"mounted filesystem with%s. \"\n\t\t\t \"Opts: %.*s%s%s\", descr,\n\t\t\t (int) sizeof(sbi->s_es->s_mount_opts),\n\t\t\t sbi->s_es->s_mount_opts,\n\t\t\t *sbi->s_es->s_mount_opts ? \"; \" : \"\", orig_data);\n\n\tif (es->s_error_count)\n\t\tmod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */\n\n\t/* Enable message ratelimiting. Default is 10 messages per 5 secs. */\n\tratelimit_state_init(&sbi->s_err_ratelimit_state, 5 * HZ, 10);\n\tratelimit_state_init(&sbi->s_warning_ratelimit_state, 5 * HZ, 10);\n\tratelimit_state_init(&sbi->s_msg_ratelimit_state, 5 * HZ, 10);\n\n\tkfree(orig_data);\n#ifdef CONFIG_EXT4_FS_ENCRYPTION\n\tmemcpy(sbi->key_prefix, EXT4_KEY_DESC_PREFIX,\n\t\t\t\tEXT4_KEY_DESC_PREFIX_SIZE);\n\tsbi->key_prefix_size = EXT4_KEY_DESC_PREFIX_SIZE;\n#endif\n\treturn 0;\n\ncantfind_ext4:\n\tif (!silent)\n\t\text4_msg(sb, KERN_ERR, \"VFS: Can't find ext4 filesystem\");\n\tgoto failed_mount;\n\n#ifdef CONFIG_QUOTA\nfailed_mount8:\n\text4_unregister_sysfs(sb);\n#endif\nfailed_mount7:\n\text4_unregister_li_request(sb);\nfailed_mount6:\n\text4_mb_release(sb);\n\tif (sbi->s_flex_groups)\n\t\tkvfree(sbi->s_flex_groups);\n\tpercpu_counter_destroy(&sbi->s_freeclusters_counter);\n\tpercpu_counter_destroy(&sbi->s_freeinodes_counter);\n\tpercpu_counter_destroy(&sbi->s_dirs_counter);\n\tpercpu_counter_destroy(&sbi->s_dirtyclusters_counter);\nfailed_mount5:\n\text4_ext_release(sb);\n\text4_release_system_zone(sb);\nfailed_mount4a:\n\tdput(sb->s_root);\n\tsb->s_root = NULL;\nfailed_mount4:\n\text4_msg(sb, KERN_ERR, \"mount failed\");\n\tif (EXT4_SB(sb)->rsv_conversion_wq)\n\t\tdestroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq);\nfailed_mount_wq:\n\tif (sbi->s_mb_cache) {\n\t\text4_xattr_destroy_cache(sbi->s_mb_cache);\n\t\tsbi->s_mb_cache = NULL;\n\t}\n\tif (sbi->s_journal) {\n\t\tjbd2_journal_destroy(sbi->s_journal);\n\t\tsbi->s_journal = NULL;\n\t}\nfailed_mount3a:\n\text4_es_unregister_shrinker(sbi);\nfailed_mount3:\n\tdel_timer_sync(&sbi->s_err_report);\n\tif (sbi->s_mmp_tsk)\n\t\tkthread_stop(sbi->s_mmp_tsk);\nfailed_mount2:\n\tfor (i = 0; i < db_count; i++)\n\t\tbrelse(sbi->s_group_desc[i]);\n\tkvfree(sbi->s_group_desc);\nfailed_mount:\n\tif (sbi->s_chksum_driver)\n\t\tcrypto_free_shash(sbi->s_chksum_driver);\n#ifdef CONFIG_QUOTA\n\tfor (i = 0; i < EXT4_MAXQUOTAS; i++)\n\t\tkfree(sbi->s_qf_names[i]);\n#endif\n\text4_blkdev_remove(sbi);\n\tbrelse(bh);\nout_fail:\n\tsb->s_fs_info = NULL;\n\tkfree(sbi->s_blockgroup_lock);\nout_free_base:\n\tkfree(sbi);\n\tkfree(orig_data);\n\treturn err ? err : ret;\n}","target":"static int ext4_fill_super(struct super_block *sb, void *data, int silent)\n{\n\tchar *orig_data = kstrdup(data, GFP_KERNEL);\n\tstruct buffer_head *bh;\n\tstruct ext4_super_block *es = NULL;\n\tstruct ext4_sb_info *sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);\n\text4_fsblk_t block;\n\text4_fsblk_t sb_block = get_sb_block(&data);\n\text4_fsblk_t logical_sb_block;\n\tunsigned long offset = 0;\n\tunsigned long journal_devnum = 0;\n\tunsigned long def_mount_opts;\n\tstruct inode *root;\n\tconst char *descr;\n\tint ret = -ENOMEM;\n\tint blocksize, clustersize;\n\tunsigned int db_count;\n\tunsigned int i;\n\tint needs_recovery, has_huge_files, has_bigalloc;\n\t__u64 blocks_count;\n\tint err = 0;\n\tunsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;\n\text4_group_t first_not_zeroed;\n\n\tif ((data && !orig_data) || !sbi)\n\t\tgoto out_free_base;\n\n\tsbi->s_blockgroup_lock =\n\t\tkzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);\n\tif (!sbi->s_blockgroup_lock)\n\t\tgoto out_free_base;\n\n\tsb->s_fs_info = sbi;\n\tsbi->s_sb = sb;\n\tsbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS;\n\tsbi->s_sb_block = sb_block;\n\tif (sb->s_bdev->bd_part)\n\t\tsbi->s_sectors_written_start =\n\t\t\tpart_stat_read(sb->s_bdev->bd_part, sectors[1]);\n\n\t/* Cleanup superblock name */\n\tstrreplace(sb->s_id, '/', '!');\n\n\t/* -EINVAL is default */\n\tret = -EINVAL;\n\tblocksize = sb_min_blocksize(sb, EXT4_MIN_BLOCK_SIZE);\n\tif (!blocksize) {\n\t\text4_msg(sb, KERN_ERR, \"unable to set blocksize\");\n\t\tgoto out_fail;\n\t}\n\n\t/*\n\t * The ext4 superblock will not be buffer aligned for other than 1kB\n\t * block sizes. We need to calculate the offset from buffer start.\n\t */\n\tif (blocksize != EXT4_MIN_BLOCK_SIZE) {\n\t\tlogical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;\n\t\toffset = do_div(logical_sb_block, blocksize);\n\t} else {\n\t\tlogical_sb_block = sb_block;\n\t}\n\n\tif (!(bh = sb_bread_unmovable(sb, logical_sb_block))) {\n\t\text4_msg(sb, KERN_ERR, \"unable to read superblock\");\n\t\tgoto out_fail;\n\t}\n\t/*\n\t * Note: s_es must be initialized as soon as possible because\n\t * some ext4 macro-instructions depend on its value\n\t */\n\tes = (struct ext4_super_block *) (bh->b_data + offset);\n\tsbi->s_es = es;\n\tsb->s_magic = le16_to_cpu(es->s_magic);\n\tif (sb->s_magic != EXT4_SUPER_MAGIC)\n\t\tgoto cantfind_ext4;\n\tsbi->s_kbytes_written = le64_to_cpu(es->s_kbytes_written);\n\n\t/* Warn if metadata_csum and gdt_csum are both set. */\n\tif (ext4_has_feature_metadata_csum(sb) &&\n\t ext4_has_feature_gdt_csum(sb))\n\t\text4_warning(sb, \"metadata_csum and uninit_bg are \"\n\t\t\t \"redundant flags; please run fsck.\");\n\n\t/* Check for a known checksum algorithm */\n\tif (!ext4_verify_csum_type(sb, es)) {\n\t\text4_msg(sb, KERN_ERR, \"VFS: Found ext4 filesystem with \"\n\t\t\t \"unknown checksum algorithm.\");\n\t\tsilent = 1;\n\t\tgoto cantfind_ext4;\n\t}\n\n\t/* Load the checksum driver */\n\tif (ext4_has_feature_metadata_csum(sb)) {\n\t\tsbi->s_chksum_driver = crypto_alloc_shash(\"crc32c\", 0, 0);\n\t\tif (IS_ERR(sbi->s_chksum_driver)) {\n\t\t\text4_msg(sb, KERN_ERR, \"Cannot load crc32c driver.\");\n\t\t\tret = PTR_ERR(sbi->s_chksum_driver);\n\t\t\tsbi->s_chksum_driver = NULL;\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\t/* Check superblock checksum */\n\tif (!ext4_superblock_csum_verify(sb, es)) {\n\t\text4_msg(sb, KERN_ERR, \"VFS: Found ext4 filesystem with \"\n\t\t\t \"invalid superblock checksum. Run e2fsck?\");\n\t\tsilent = 1;\n\t\tret = -EFSBADCRC;\n\t\tgoto cantfind_ext4;\n\t}\n\n\t/* Precompute checksum seed for all metadata */\n\tif (ext4_has_feature_csum_seed(sb))\n\t\tsbi->s_csum_seed = le32_to_cpu(es->s_checksum_seed);\n\telse if (ext4_has_metadata_csum(sb))\n\t\tsbi->s_csum_seed = ext4_chksum(sbi, ~0, es->s_uuid,\n\t\t\t\t\t sizeof(es->s_uuid));\n\n\t/* Set defaults before we parse the mount options */\n\tdef_mount_opts = le32_to_cpu(es->s_default_mount_opts);\n\tset_opt(sb, INIT_INODE_TABLE);\n\tif (def_mount_opts & EXT4_DEFM_DEBUG)\n\t\tset_opt(sb, DEBUG);\n\tif (def_mount_opts & EXT4_DEFM_BSDGROUPS)\n\t\tset_opt(sb, GRPID);\n\tif (def_mount_opts & EXT4_DEFM_UID16)\n\t\tset_opt(sb, NO_UID32);\n\t/* xattr user namespace & acls are now defaulted on */\n\tset_opt(sb, XATTR_USER);\n#ifdef CONFIG_EXT4_FS_POSIX_ACL\n\tset_opt(sb, POSIX_ACL);\n#endif\n\t/* don't forget to enable journal_csum when metadata_csum is enabled. */\n\tif (ext4_has_metadata_csum(sb))\n\t\tset_opt(sb, JOURNAL_CHECKSUM);\n\n\tif ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)\n\t\tset_opt(sb, JOURNAL_DATA);\n\telse if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)\n\t\tset_opt(sb, ORDERED_DATA);\n\telse if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_WBACK)\n\t\tset_opt(sb, WRITEBACK_DATA);\n\n\tif (le16_to_cpu(sbi->s_es->s_errors) == EXT4_ERRORS_PANIC)\n\t\tset_opt(sb, ERRORS_PANIC);\n\telse if (le16_to_cpu(sbi->s_es->s_errors) == EXT4_ERRORS_CONTINUE)\n\t\tset_opt(sb, ERRORS_CONT);\n\telse\n\t\tset_opt(sb, ERRORS_RO);\n\t/* block_validity enabled by default; disable with noblock_validity */\n\tset_opt(sb, BLOCK_VALIDITY);\n\tif (def_mount_opts & EXT4_DEFM_DISCARD)\n\t\tset_opt(sb, DISCARD);\n\n\tsbi->s_resuid = make_kuid(&init_user_ns, le16_to_cpu(es->s_def_resuid));\n\tsbi->s_resgid = make_kgid(&init_user_ns, le16_to_cpu(es->s_def_resgid));\n\tsbi->s_commit_interval = JBD2_DEFAULT_MAX_COMMIT_AGE * HZ;\n\tsbi->s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME;\n\tsbi->s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME;\n\n\tif ((def_mount_opts & EXT4_DEFM_NOBARRIER) == 0)\n\t\tset_opt(sb, BARRIER);\n\n\t/*\n\t * enable delayed allocation by default\n\t * Use -o nodelalloc to turn it off\n\t */\n\tif (!IS_EXT3_SB(sb) && !IS_EXT2_SB(sb) &&\n\t ((def_mount_opts & EXT4_DEFM_NODELALLOC) == 0))\n\t\tset_opt(sb, DELALLOC);\n\n\t/*\n\t * set default s_li_wait_mult for lazyinit, for the case there is\n\t * no mount option specified.\n\t */\n\tsbi->s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT;\n\n\tif (sbi->s_es->s_mount_opts[0]) {\n\t\tchar *s_mount_opts = kstrndup(sbi->s_es->s_mount_opts,\n\t\t\t\t\t sizeof(sbi->s_es->s_mount_opts),\n\t\t\t\t\t GFP_KERNEL);\n\t\tif (!s_mount_opts)\n\t\t\tgoto failed_mount;\n\t\tif (!parse_options(s_mount_opts, sb, &journal_devnum,\n\t\t\t\t &journal_ioprio, 0)) {\n\t\t\text4_msg(sb, KERN_WARNING,\n\t\t\t\t \"failed to parse options in superblock: %s\",\n\t\t\t\t s_mount_opts);\n\t\t}\n\t\tkfree(s_mount_opts);\n\t}\n\tsbi->s_def_mount_opt = sbi->s_mount_opt;\n\tif (!parse_options((char *) data, sb, &journal_devnum,\n\t\t\t &journal_ioprio, 0))\n\t\tgoto failed_mount;\n\n\tif (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {\n\t\tprintk_once(KERN_WARNING \"EXT4-fs: Warning: mounting \"\n\t\t\t \"with data=journal disables delayed \"\n\t\t\t \"allocation and O_DIRECT support!\\n\");\n\t\tif (test_opt2(sb, EXPLICIT_DELALLOC)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and delalloc\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DIOREAD_NOLOCK)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and dioread_nolock\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DAX)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"both data=journal and dax\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (test_opt(sb, DELALLOC))\n\t\t\tclear_opt(sb, DELALLOC);\n\t} else {\n\t\tsb->s_iflags |= SB_I_CGROUPWB;\n\t}\n\n\tsb->s_flags = (sb->s_flags & ~MS_POSIXACL) |\n\t\t(test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);\n\n\tif (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV &&\n\t (ext4_has_compat_features(sb) ||\n\t ext4_has_ro_compat_features(sb) ||\n\t ext4_has_incompat_features(sb)))\n\t\text4_msg(sb, KERN_WARNING,\n\t\t \"feature flags set on rev 0 fs, \"\n\t\t \"running e2fsck is recommended\");\n\n\tif (es->s_creator_os == cpu_to_le32(EXT4_OS_HURD)) {\n\t\tset_opt2(sb, HURD_COMPAT);\n\t\tif (ext4_has_feature_64bit(sb)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"The Hurd can't support 64-bit file systems\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\tif (IS_EXT2_SB(sb)) {\n\t\tif (ext2_feature_set_ok(sb))\n\t\t\text4_msg(sb, KERN_INFO, \"mounting ext2 file system \"\n\t\t\t\t \"using the ext4 subsystem\");\n\t\telse {\n\t\t\text4_msg(sb, KERN_ERR, \"couldn't mount as ext2 due \"\n\t\t\t\t \"to feature incompatibilities\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\tif (IS_EXT3_SB(sb)) {\n\t\tif (ext3_feature_set_ok(sb))\n\t\t\text4_msg(sb, KERN_INFO, \"mounting ext3 file system \"\n\t\t\t\t \"using the ext4 subsystem\");\n\t\telse {\n\t\t\text4_msg(sb, KERN_ERR, \"couldn't mount as ext3 due \"\n\t\t\t\t \"to feature incompatibilities\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\t/*\n\t * Check feature flags regardless of the revision level, since we\n\t * previously didn't change the revision level when setting the flags,\n\t * so there is a chance incompat flags are set on a rev 0 filesystem.\n\t */\n\tif (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY)))\n\t\tgoto failed_mount;\n\n\tblocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);\n\tif (blocksize < EXT4_MIN_BLOCK_SIZE ||\n\t blocksize > EXT4_MAX_BLOCK_SIZE) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t \"Unsupported filesystem blocksize %d (%d log_block_size)\",\n\t\t\t blocksize, le32_to_cpu(es->s_log_block_size));\n\t\tgoto failed_mount;\n\t}\n\tif (le32_to_cpu(es->s_log_block_size) >\n\t (EXT4_MAX_BLOCK_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Invalid log block size: %u\",\n\t\t\t le32_to_cpu(es->s_log_block_size));\n\t\tgoto failed_mount;\n\t}\n\n\tif (le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) > (blocksize / 4)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Number of reserved GDT blocks insanely large: %d\",\n\t\t\t le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks));\n\t\tgoto failed_mount;\n\t}\n\n\tif (sbi->s_mount_opt & EXT4_MOUNT_DAX) {\n\t\terr = bdev_dax_supported(sb, blocksize);\n\t\tif (err)\n\t\t\tgoto failed_mount;\n\t}\n\n\tif (ext4_has_feature_encrypt(sb) && es->s_encryption_level) {\n\t\text4_msg(sb, KERN_ERR, \"Unsupported encryption level %d\",\n\t\t\t es->s_encryption_level);\n\t\tgoto failed_mount;\n\t}\n\n\tif (sb->s_blocksize != blocksize) {\n\t\t/* Validate the filesystem blocksize */\n\t\tif (!sb_set_blocksize(sb, blocksize)) {\n\t\t\text4_msg(sb, KERN_ERR, \"bad block size %d\",\n\t\t\t\t\tblocksize);\n\t\t\tgoto failed_mount;\n\t\t}\n\n\t\tbrelse(bh);\n\t\tlogical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;\n\t\toffset = do_div(logical_sb_block, blocksize);\n\t\tbh = sb_bread_unmovable(sb, logical_sb_block);\n\t\tif (!bh) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Can't read superblock on 2nd try\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tes = (struct ext4_super_block *)(bh->b_data + offset);\n\t\tsbi->s_es = es;\n\t\tif (es->s_magic != cpu_to_le16(EXT4_SUPER_MAGIC)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Magic mismatch, very weird!\");\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\n\thas_huge_files = ext4_has_feature_huge_file(sb);\n\tsbi->s_bitmap_maxbytes = ext4_max_bitmap_size(sb->s_blocksize_bits,\n\t\t\t\t\t\t has_huge_files);\n\tsb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits, has_huge_files);\n\n\tif (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV) {\n\t\tsbi->s_inode_size = EXT4_GOOD_OLD_INODE_SIZE;\n\t\tsbi->s_first_ino = EXT4_GOOD_OLD_FIRST_INO;\n\t} else {\n\t\tsbi->s_inode_size = le16_to_cpu(es->s_inode_size);\n\t\tsbi->s_first_ino = le32_to_cpu(es->s_first_ino);\n\t\tif ((sbi->s_inode_size < EXT4_GOOD_OLD_INODE_SIZE) ||\n\t\t (!is_power_of_2(sbi->s_inode_size)) ||\n\t\t (sbi->s_inode_size > blocksize)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unsupported inode size: %d\",\n\t\t\t sbi->s_inode_size);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE)\n\t\t\tsb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2);\n\t}\n\n\tsbi->s_desc_size = le16_to_cpu(es->s_desc_size);\n\tif (ext4_has_feature_64bit(sb)) {\n\t\tif (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||\n\t\t sbi->s_desc_size > EXT4_MAX_DESC_SIZE ||\n\t\t !is_power_of_2(sbi->s_desc_size)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unsupported descriptor size %lu\",\n\t\t\t sbi->s_desc_size);\n\t\t\tgoto failed_mount;\n\t\t}\n\t} else\n\t\tsbi->s_desc_size = EXT4_MIN_DESC_SIZE;\n\n\tsbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);\n\tsbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);\n\n\tsbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb);\n\tif (sbi->s_inodes_per_block == 0)\n\t\tgoto cantfind_ext4;\n\tif (sbi->s_inodes_per_group < sbi->s_inodes_per_block ||\n\t sbi->s_inodes_per_group > blocksize * 8) {\n\t\text4_msg(sb, KERN_ERR, \"invalid inodes per group: %lu\\n\",\n\t\t\t sbi->s_blocks_per_group);\n\t\tgoto failed_mount;\n\t}\n\tsbi->s_itb_per_group = sbi->s_inodes_per_group /\n\t\t\t\t\tsbi->s_inodes_per_block;\n\tsbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);\n\tsbi->s_sbh = bh;\n\tsbi->s_mount_state = le16_to_cpu(es->s_state);\n\tsbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb));\n\tsbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb));\n\n\tfor (i = 0; i < 4; i++)\n\t\tsbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);\n\tsbi->s_def_hash_version = es->s_def_hash_version;\n\tif (ext4_has_feature_dir_index(sb)) {\n\t\ti = le32_to_cpu(es->s_flags);\n\t\tif (i & EXT2_FLAGS_UNSIGNED_HASH)\n\t\t\tsbi->s_hash_unsigned = 3;\n\t\telse if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) {\n#ifdef __CHAR_UNSIGNED__\n\t\t\tif (!(sb->s_flags & MS_RDONLY))\n\t\t\t\tes->s_flags |=\n\t\t\t\t\tcpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH);\n\t\t\tsbi->s_hash_unsigned = 3;\n#else\n\t\t\tif (!(sb->s_flags & MS_RDONLY))\n\t\t\t\tes->s_flags |=\n\t\t\t\t\tcpu_to_le32(EXT2_FLAGS_SIGNED_HASH);\n#endif\n\t\t}\n\t}\n\n\t/* Handle clustersize */\n\tclustersize = BLOCK_SIZE << le32_to_cpu(es->s_log_cluster_size);\n\thas_bigalloc = ext4_has_feature_bigalloc(sb);\n\tif (has_bigalloc) {\n\t\tif (clustersize < blocksize) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"cluster size (%d) smaller than \"\n\t\t\t\t \"block size (%d)\", clustersize, blocksize);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (le32_to_cpu(es->s_log_cluster_size) >\n\t\t (EXT4_MAX_CLUSTER_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"Invalid log cluster size: %u\",\n\t\t\t\t le32_to_cpu(es->s_log_cluster_size));\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tsbi->s_cluster_bits = le32_to_cpu(es->s_log_cluster_size) -\n\t\t\tle32_to_cpu(es->s_log_block_size);\n\t\tsbi->s_clusters_per_group =\n\t\t\tle32_to_cpu(es->s_clusters_per_group);\n\t\tif (sbi->s_clusters_per_group > blocksize * 8) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"#clusters per group too big: %lu\",\n\t\t\t\t sbi->s_clusters_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tif (sbi->s_blocks_per_group !=\n\t\t (sbi->s_clusters_per_group * (clustersize / blocksize))) {\n\t\t\text4_msg(sb, KERN_ERR, \"blocks per group (%lu) and \"\n\t\t\t\t \"clusters per group (%lu) inconsistent\",\n\t\t\t\t sbi->s_blocks_per_group,\n\t\t\t\t sbi->s_clusters_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t} else {\n\t\tif (clustersize != blocksize) {\n\t\t\text4_warning(sb, \"fragment/cluster size (%d) != \"\n\t\t\t\t \"block size (%d)\", clustersize,\n\t\t\t\t blocksize);\n\t\t\tclustersize = blocksize;\n\t\t}\n\t\tif (sbi->s_blocks_per_group > blocksize * 8) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t\t \"#blocks per group too big: %lu\",\n\t\t\t\t sbi->s_blocks_per_group);\n\t\t\tgoto failed_mount;\n\t\t}\n\t\tsbi->s_clusters_per_group = sbi->s_blocks_per_group;\n\t\tsbi->s_cluster_bits = 0;\n\t}\n\tsbi->s_cluster_ratio = clustersize / blocksize;\n\n\t/* Do we have standard group size of clustersize * 8 blocks ? */\n\tif (sbi->s_blocks_per_group == clustersize << 3)\n\t\tset_opt2(sb, STD_GROUP_SIZE);\n\n\t/*\n\t * Test whether we have more sectors than will fit in sector_t,\n\t * and whether the max offset is addressable by the page cache.\n\t */\n\terr = generic_check_addressable(sb->s_blocksize_bits,\n\t\t\t\t\text4_blocks_count(es));\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"filesystem\"\n\t\t\t \" too large to mount safely on this system\");\n\t\tif (sizeof(sector_t) < 8)\n\t\t\text4_msg(sb, KERN_WARNING, \"CONFIG_LBDAF not enabled\");\n\t\tgoto failed_mount;\n\t}\n\n\tif (EXT4_BLOCKS_PER_GROUP(sb) == 0)\n\t\tgoto cantfind_ext4;\n\n\t/* check blocks count against device size */\n\tblocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;\n\tif (blocks_count && ext4_blocks_count(es) > blocks_count) {\n\t\text4_msg(sb, KERN_WARNING, \"bad geometry: block count %llu \"\n\t\t \"exceeds size of device (%llu blocks)\",\n\t\t ext4_blocks_count(es), blocks_count);\n\t\tgoto failed_mount;\n\t}\n\n\t/*\n\t * It makes no sense for the first data block to be beyond the end\n\t * of the filesystem.\n\t */\n\tif (le32_to_cpu(es->s_first_data_block) >= ext4_blocks_count(es)) {\n\t\text4_msg(sb, KERN_WARNING, \"bad geometry: first data \"\n\t\t\t \"block %u is beyond end of filesystem (%llu)\",\n\t\t\t le32_to_cpu(es->s_first_data_block),\n\t\t\t ext4_blocks_count(es));\n\t\tgoto failed_mount;\n\t}\n\tblocks_count = (ext4_blocks_count(es) -\n\t\t\tle32_to_cpu(es->s_first_data_block) +\n\t\t\tEXT4_BLOCKS_PER_GROUP(sb) - 1);\n\tdo_div(blocks_count, EXT4_BLOCKS_PER_GROUP(sb));\n\tif (blocks_count > ((uint64_t)1<<32) - EXT4_DESC_PER_BLOCK(sb)) {\n\t\text4_msg(sb, KERN_WARNING, \"groups count too large: %u \"\n\t\t \"(block count %llu, first data block %u, \"\n\t\t \"blocks per group %lu)\", sbi->s_groups_count,\n\t\t ext4_blocks_count(es),\n\t\t le32_to_cpu(es->s_first_data_block),\n\t\t EXT4_BLOCKS_PER_GROUP(sb));\n\t\tgoto failed_mount;\n\t}\n\tsbi->s_groups_count = blocks_count;\n\tsbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count,\n\t\t\t(EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb)));\n\tdb_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /\n\t\t EXT4_DESC_PER_BLOCK(sb);\n\tif (ext4_has_feature_meta_bg(sb)) {\n\t\tif (le32_to_cpu(es->s_first_meta_bg) >= db_count) {\n\t\t\text4_msg(sb, KERN_WARNING,\n\t\t\t\t \"first meta block group too large: %u \"\n\t\t\t\t \"(group descriptor block count %u)\",\n\t\t\t\t le32_to_cpu(es->s_first_meta_bg), db_count);\n\t\t\tgoto failed_mount;\n\t\t}\n\t}\n\tsbi->s_group_desc = ext4_kvmalloc(db_count *\n\t\t\t\t\t sizeof(struct buffer_head *),\n\t\t\t\t\t GFP_KERNEL);\n\tif (sbi->s_group_desc == NULL) {\n\t\text4_msg(sb, KERN_ERR, \"not enough memory\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount;\n\t}\n\n\tbgl_lock_init(sbi->s_blockgroup_lock);\n\n\tfor (i = 0; i < db_count; i++) {\n\t\tblock = descriptor_loc(sb, logical_sb_block, i);\n\t\tsbi->s_group_desc[i] = sb_bread_unmovable(sb, block);\n\t\tif (!sbi->s_group_desc[i]) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"can't read group descriptor %d\", i);\n\t\t\tdb_count = i;\n\t\t\tgoto failed_mount2;\n\t\t}\n\t}\n\tif (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) {\n\t\text4_msg(sb, KERN_ERR, \"group descriptors corrupted!\");\n\t\tret = -EFSCORRUPTED;\n\t\tgoto failed_mount2;\n\t}\n\n\tsbi->s_gdb_count = db_count;\n\tget_random_bytes(&sbi->s_next_generation, sizeof(u32));\n\tspin_lock_init(&sbi->s_next_gen_lock);\n\n\tsetup_timer(&sbi->s_err_report, print_daily_error_info,\n\t\t(unsigned long) sb);\n\n\t/* Register extent status tree shrinker */\n\tif (ext4_es_register_shrinker(sbi))\n\t\tgoto failed_mount3;\n\n\tsbi->s_stripe = ext4_get_stripe_size(sbi);\n\tsbi->s_extent_max_zeroout_kb = 32;\n\n\t/*\n\t * set up enough so that it can read an inode\n\t */\n\tsb->s_op = &ext4_sops;\n\tsb->s_export_op = &ext4_export_ops;\n\tsb->s_xattr = ext4_xattr_handlers;\n\tsb->s_cop = &ext4_cryptops;\n#ifdef CONFIG_QUOTA\n\tsb->dq_op = &ext4_quota_operations;\n\tif (ext4_has_feature_quota(sb))\n\t\tsb->s_qcop = &dquot_quotactl_sysfile_ops;\n\telse\n\t\tsb->s_qcop = &ext4_qctl_operations;\n\tsb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;\n#endif\n\tmemcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));\n\n\tINIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */\n\tmutex_init(&sbi->s_orphan_lock);\n\n\tsb->s_root = NULL;\n\n\tneeds_recovery = (es->s_last_orphan != 0 ||\n\t\t\t ext4_has_feature_journal_needs_recovery(sb));\n\n\tif (ext4_has_feature_mmp(sb) && !(sb->s_flags & MS_RDONLY))\n\t\tif (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)))\n\t\t\tgoto failed_mount3a;\n\n\t/*\n\t * The first inode we look at is the journal inode. Don't try\n\t * root first: it may be modified in the journal!\n\t */\n\tif (!test_opt(sb, NOLOAD) && ext4_has_feature_journal(sb)) {\n\t\tif (ext4_load_journal(sb, es, journal_devnum))\n\t\t\tgoto failed_mount3a;\n\t} else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) &&\n\t\t ext4_has_feature_journal_needs_recovery(sb)) {\n\t\text4_msg(sb, KERN_ERR, \"required journal recovery \"\n\t\t \"suppressed and not mounted read-only\");\n\t\tgoto failed_mount_wq;\n\t} else {\n\t\t/* Nojournal mode, all journal mount options are illegal */\n\t\tif (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"journal_checksum, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"journal_async_commit, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"commit=%lu, fs mounted w/o journal\",\n\t\t\t\t sbi->s_commit_interval / HZ);\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tif (EXT4_MOUNT_DATA_FLAGS &\n\t\t (sbi->s_mount_opt ^ sbi->s_def_mount_opt)) {\n\t\t\text4_msg(sb, KERN_ERR, \"can't mount with \"\n\t\t\t\t \"data=, fs mounted w/o journal\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\t\tsbi->s_def_mount_opt &= EXT4_MOUNT_JOURNAL_CHECKSUM;\n\t\tclear_opt(sb, JOURNAL_CHECKSUM);\n\t\tclear_opt(sb, DATA_FLAGS);\n\t\tsbi->s_journal = NULL;\n\t\tneeds_recovery = 0;\n\t\tgoto no_journal;\n\t}\n\n\tif (ext4_has_feature_64bit(sb) &&\n\t !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0,\n\t\t\t\t JBD2_FEATURE_INCOMPAT_64BIT)) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to set 64-bit journal feature\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif (!set_journal_csum_feature_set(sb)) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to set journal checksum \"\n\t\t\t \"feature set\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\t/* We have now updated the journal if required, so we can\n\t * validate the data journaling mode. */\n\tswitch (test_opt(sb, DATA_FLAGS)) {\n\tcase 0:\n\t\t/* No mode set, assume a default based on the journal\n\t\t * capabilities: ORDERED_DATA if the journal can\n\t\t * cope, else JOURNAL_DATA\n\t\t */\n\t\tif (jbd2_journal_check_available_features\n\t\t (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE))\n\t\t\tset_opt(sb, ORDERED_DATA);\n\t\telse\n\t\t\tset_opt(sb, JOURNAL_DATA);\n\t\tbreak;\n\n\tcase EXT4_MOUNT_ORDERED_DATA:\n\tcase EXT4_MOUNT_WRITEBACK_DATA:\n\t\tif (!jbd2_journal_check_available_features\n\t\t (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)) {\n\t\t\text4_msg(sb, KERN_ERR, \"Journal does not support \"\n\t\t\t \"requested data journaling mode\");\n\t\t\tgoto failed_mount_wq;\n\t\t}\n\tdefault:\n\t\tbreak;\n\t}\n\tset_task_ioprio(sbi->s_journal->j_task, journal_ioprio);\n\n\tsbi->s_journal->j_commit_callback = ext4_journal_commit_callback;\n\nno_journal:\n\tsbi->s_mb_cache = ext4_xattr_create_cache();\n\tif (!sbi->s_mb_cache) {\n\t\text4_msg(sb, KERN_ERR, \"Failed to create an mb_cache\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif ((DUMMY_ENCRYPTION_ENABLED(sbi) || ext4_has_feature_encrypt(sb)) &&\n\t (blocksize != PAGE_SIZE)) {\n\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"Unsupported blocksize for fs encryption\");\n\t\tgoto failed_mount_wq;\n\t}\n\n\tif (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) &&\n\t !ext4_has_feature_encrypt(sb)) {\n\t\text4_set_feature_encrypt(sb);\n\t\text4_commit_super(sb, 1);\n\t}\n\n\t/*\n\t * Get the # of file system overhead blocks from the\n\t * superblock if present.\n\t */\n\tif (es->s_overhead_clusters)\n\t\tsbi->s_overhead = le32_to_cpu(es->s_overhead_clusters);\n\telse {\n\t\terr = ext4_calculate_overhead(sb);\n\t\tif (err)\n\t\t\tgoto failed_mount_wq;\n\t}\n\n\t/*\n\t * The maximum number of concurrent works can be high and\n\t * concurrency isn't really necessary. Limit it to 1.\n\t */\n\tEXT4_SB(sb)->rsv_conversion_wq =\n\t\talloc_workqueue(\"ext4-rsv-conversion\", WQ_MEM_RECLAIM | WQ_UNBOUND, 1);\n\tif (!EXT4_SB(sb)->rsv_conversion_wq) {\n\t\tprintk(KERN_ERR \"EXT4-fs: failed to create workqueue\\n\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount4;\n\t}\n\n\t/*\n\t * The jbd2_journal_load will have done any necessary log recovery,\n\t * so we can safely mount the rest of the filesystem now.\n\t */\n\n\troot = ext4_iget(sb, EXT4_ROOT_INO);\n\tif (IS_ERR(root)) {\n\t\text4_msg(sb, KERN_ERR, \"get root inode failed\");\n\t\tret = PTR_ERR(root);\n\t\troot = NULL;\n\t\tgoto failed_mount4;\n\t}\n\tif (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {\n\t\text4_msg(sb, KERN_ERR, \"corrupt root inode, run e2fsck\");\n\t\tiput(root);\n\t\tgoto failed_mount4;\n\t}\n\tsb->s_root = d_make_root(root);\n\tif (!sb->s_root) {\n\t\text4_msg(sb, KERN_ERR, \"get root dentry failed\");\n\t\tret = -ENOMEM;\n\t\tgoto failed_mount4;\n\t}\n\n\tif (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY))\n\t\tsb->s_flags |= MS_RDONLY;\n\n\t/* determine the minimum size of new large inodes, if present */\n\tif (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {\n\t\tsbi->s_want_extra_isize = sizeof(struct ext4_inode) -\n\t\t\t\t\t\t EXT4_GOOD_OLD_INODE_SIZE;\n\t\tif (ext4_has_feature_extra_isize(sb)) {\n\t\t\tif (sbi->s_want_extra_isize <\n\t\t\t le16_to_cpu(es->s_want_extra_isize))\n\t\t\t\tsbi->s_want_extra_isize =\n\t\t\t\t\tle16_to_cpu(es->s_want_extra_isize);\n\t\t\tif (sbi->s_want_extra_isize <\n\t\t\t le16_to_cpu(es->s_min_extra_isize))\n\t\t\t\tsbi->s_want_extra_isize =\n\t\t\t\t\tle16_to_cpu(es->s_min_extra_isize);\n\t\t}\n\t}\n\t/* Check if enough inode space is available */\n\tif (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >\n\t\t\t\t\t\t\tsbi->s_inode_size) {\n\t\tsbi->s_want_extra_isize = sizeof(struct ext4_inode) -\n\t\t\t\t\t\t EXT4_GOOD_OLD_INODE_SIZE;\n\t\text4_msg(sb, KERN_INFO, \"required extra inode space not\"\n\t\t\t \"available\");\n\t}\n\n\text4_set_resv_clusters(sb);\n\n\terr = ext4_setup_system_zone(sb);\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"failed to initialize system \"\n\t\t\t \"zone (%d)\", err);\n\t\tgoto failed_mount4a;\n\t}\n\n\text4_ext_init(sb);\n\terr = ext4_mb_init(sb);\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"failed to initialize mballoc (%d)\",\n\t\t\t err);\n\t\tgoto failed_mount5;\n\t}\n\n\tblock = ext4_count_free_clusters(sb);\n\text4_free_blocks_count_set(sbi->s_es, \n\t\t\t\t EXT4_C2B(sbi, block));\n\terr = percpu_counter_init(&sbi->s_freeclusters_counter, block,\n\t\t\t\t GFP_KERNEL);\n\tif (!err) {\n\t\tunsigned long freei = ext4_count_free_inodes(sb);\n\t\tsbi->s_es->s_free_inodes_count = cpu_to_le32(freei);\n\t\terr = percpu_counter_init(&sbi->s_freeinodes_counter, freei,\n\t\t\t\t\t GFP_KERNEL);\n\t}\n\tif (!err)\n\t\terr = percpu_counter_init(&sbi->s_dirs_counter,\n\t\t\t\t\t ext4_count_dirs(sb), GFP_KERNEL);\n\tif (!err)\n\t\terr = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0,\n\t\t\t\t\t GFP_KERNEL);\n\tif (!err)\n\t\terr = percpu_init_rwsem(&sbi->s_journal_flag_rwsem);\n\n\tif (err) {\n\t\text4_msg(sb, KERN_ERR, \"insufficient memory\");\n\t\tgoto failed_mount6;\n\t}\n\n\tif (ext4_has_feature_flex_bg(sb))\n\t\tif (!ext4_fill_flex_info(sb)) {\n\t\t\text4_msg(sb, KERN_ERR,\n\t\t\t \"unable to initialize \"\n\t\t\t \"flex_bg meta info!\");\n\t\t\tgoto failed_mount6;\n\t\t}\n\n\terr = ext4_register_li_request(sb, first_not_zeroed);\n\tif (err)\n\t\tgoto failed_mount6;\n\n\terr = ext4_register_sysfs(sb);\n\tif (err)\n\t\tgoto failed_mount7;\n\n#ifdef CONFIG_QUOTA\n\t/* Enable quota usage during mount. */\n\tif (ext4_has_feature_quota(sb) && !(sb->s_flags & MS_RDONLY)) {\n\t\terr = ext4_enable_quotas(sb);\n\t\tif (err)\n\t\t\tgoto failed_mount8;\n\t}\n#endif /* CONFIG_QUOTA */\n\n\tEXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS;\n\text4_orphan_cleanup(sb, es);\n\tEXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;\n\tif (needs_recovery) {\n\t\text4_msg(sb, KERN_INFO, \"recovery complete\");\n\t\text4_mark_recovery_complete(sb, es);\n\t}\n\tif (EXT4_SB(sb)->s_journal) {\n\t\tif (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)\n\t\t\tdescr = \" journalled data mode\";\n\t\telse if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)\n\t\t\tdescr = \" ordered data mode\";\n\t\telse\n\t\t\tdescr = \" writeback data mode\";\n\t} else\n\t\tdescr = \"out journal\";\n\n\tif (test_opt(sb, DISCARD)) {\n\t\tstruct request_queue *q = bdev_get_queue(sb->s_bdev);\n\t\tif (!blk_queue_discard(q))\n\t\t\text4_msg(sb, KERN_WARNING,\n\t\t\t\t \"mounting with \\\"discard\\\" option, but \"\n\t\t\t\t \"the device does not support discard\");\n\t}\n\n\tif (___ratelimit(&ext4_mount_msg_ratelimit, \"EXT4-fs mount\"))\n\t\text4_msg(sb, KERN_INFO, \"mounted filesystem with%s. \"\n\t\t\t \"Opts: %.*s%s%s\", descr,\n\t\t\t (int) sizeof(sbi->s_es->s_mount_opts),\n\t\t\t sbi->s_es->s_mount_opts,\n\t\t\t *sbi->s_es->s_mount_opts ? \"; \" : \"\", orig_data);\n\n\tif (es->s_error_count)\n\t\tmod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */\n\n\t/* Enable message ratelimiting. Default is 10 messages per 5 secs. */\n\tratelimit_state_init(&sbi->s_err_ratelimit_state, 5 * HZ, 10);\n\tratelimit_state_init(&sbi->s_warning_ratelimit_state, 5 * HZ, 10);\n\tratelimit_state_init(&sbi->s_msg_ratelimit_state, 5 * HZ, 10);\n\n\tkfree(orig_data);\n#ifdef CONFIG_EXT4_FS_ENCRYPTION\n\tmemcpy(sbi->key_prefix, EXT4_KEY_DESC_PREFIX,\n\t\t\t\tEXT4_KEY_DESC_PREFIX_SIZE);\n\tsbi->key_prefix_size = EXT4_KEY_DESC_PREFIX_SIZE;\n#endif\n\treturn 0;\n\ncantfind_ext4:\n\tif (!silent)\n\t\text4_msg(sb, KERN_ERR, \"VFS: Can't find ext4 filesystem\");\n\tgoto failed_mount;\n\n#ifdef CONFIG_QUOTA\nfailed_mount8:\n\text4_unregister_sysfs(sb);\n#endif\nfailed_mount7:\n\text4_unregister_li_request(sb);\nfailed_mount6:\n\text4_mb_release(sb);\n\tif (sbi->s_flex_groups)\n\t\tkvfree(sbi->s_flex_groups);\n\tpercpu_counter_destroy(&sbi->s_freeclusters_counter);\n\tpercpu_counter_destroy(&sbi->s_freeinodes_counter);\n\tpercpu_counter_destroy(&sbi->s_dirs_counter);\n\tpercpu_counter_destroy(&sbi->s_dirtyclusters_counter);\nfailed_mount5:\n\text4_ext_release(sb);\n\text4_release_system_zone(sb);\nfailed_mount4a:\n\tdput(sb->s_root);\n\tsb->s_root = NULL;\nfailed_mount4:\n\text4_msg(sb, KERN_ERR, \"mount failed\");\n\tif (EXT4_SB(sb)->rsv_conversion_wq)\n\t\tdestroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq);\nfailed_mount_wq:\n\tif (sbi->s_mb_cache) {\n\t\text4_xattr_destroy_cache(sbi->s_mb_cache);\n\t\tsbi->s_mb_cache = NULL;\n\t}\n\tif (sbi->s_journal) {\n\t\tjbd2_journal_destroy(sbi->s_journal);\n\t\tsbi->s_journal = NULL;\n\t}\nfailed_mount3a:\n\text4_es_unregister_shrinker(sbi);\nfailed_mount3:\n\tdel_timer_sync(&sbi->s_err_report);\n\tif (sbi->s_mmp_tsk)\n\t\tkthread_stop(sbi->s_mmp_tsk);\nfailed_mount2:\n\tfor (i = 0; i < db_count; i++)\n\t\tbrelse(sbi->s_group_desc[i]);\n\tkvfree(sbi->s_group_desc);\nfailed_mount:\n\tif (sbi->s_chksum_driver)\n\t\tcrypto_free_shash(sbi->s_chksum_driver);\n#ifdef CONFIG_QUOTA\n\tfor (i = 0; i < EXT4_MAXQUOTAS; i++)\n\t\tkfree(sbi->s_qf_names[i]);\n#endif\n\text4_blkdev_remove(sbi);\n\tbrelse(bh);\nout_fail:\n\tsb->s_fs_info = NULL;\n\tkfree(sbi->s_blockgroup_lock);\nout_free_base:\n\tkfree(sbi);\n\tkfree(orig_data);\n\treturn err ? err : ret;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ext4_fill_super","file_name":"fs/ext4/super.c","commit_link":"github.com/torvalds/linux/commit/3a4b77cd47bb837b8557595ec7425f281f2ca1fe","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#85-1d1708ec7c27","input":"static int mxf_parse_structural_metadata(MXFContext *mxf)\n{\n MXFPackage *material_package = NULL;\n int i, j, k, ret;\n\n av_log(mxf->fc, AV_LOG_TRACE, \"metadata sets count %d\\n\", mxf->metadata_sets_count);\n /* TODO: handle multiple material packages (OP3x) */\n for (i = 0; i < mxf->packages_count; i++) {\n material_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[i], MaterialPackage);\n if (material_package) break;\n }\n if (!material_package) {\n av_log(mxf->fc, AV_LOG_ERROR, \"no material package found\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n mxf_add_umid_metadata(&mxf->fc->metadata, \"material_package_umid\", material_package);\n if (material_package->name && material_package->name[0])\n av_dict_set(&mxf->fc->metadata, \"material_package_name\", material_package->name, 0);\n mxf_parse_package_comments(mxf, &mxf->fc->metadata, material_package);\n\n for (i = 0; i < material_package->tracks_count; i++) {\n MXFPackage *source_package = NULL;\n MXFTrack *material_track = NULL;\n MXFTrack *source_track = NULL;\n MXFTrack *temp_track = NULL;\n MXFDescriptor *descriptor = NULL;\n MXFStructuralComponent *component = NULL;\n MXFTimecodeComponent *mxf_tc = NULL;\n UID *essence_container_ul = NULL;\n const MXFCodecUL *codec_ul = NULL;\n const MXFCodecUL *container_ul = NULL;\n const MXFCodecUL *pix_fmt_ul = NULL;\n AVStream *st;\n AVTimecode tc;\n int flags;\n\n if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i], Track))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve material track strong ref\\n\");\n continue;\n }\n\n if ((component = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, TimecodeComponent))) {\n mxf_tc = (MXFTimecodeComponent*)component;\n flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;\n if (av_timecode_init(&tc, mxf_tc->rate, flags, mxf_tc->start_frame, mxf->fc) == 0) {\n mxf_add_timecode_metadata(&mxf->fc->metadata, \"timecode\", &tc);\n }\n }\n\n if (!(material_track->sequence = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, Sequence))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve material track sequence strong ref\\n\");\n continue;\n }\n\n for (j = 0; j < material_track->sequence->structural_components_count; j++) {\n component = mxf_resolve_strong_ref(mxf, &material_track->sequence->structural_components_refs[j], TimecodeComponent);\n if (!component)\n continue;\n\n mxf_tc = (MXFTimecodeComponent*)component;\n flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;\n if (av_timecode_init(&tc, mxf_tc->rate, flags, mxf_tc->start_frame, mxf->fc) == 0) {\n mxf_add_timecode_metadata(&mxf->fc->metadata, \"timecode\", &tc);\n break;\n }\n }\n\n /* TODO: handle multiple source clips, only finds first valid source clip */\n if(material_track->sequence->structural_components_count > 1)\n av_log(mxf->fc, AV_LOG_WARNING, \"material track %d: has %d components\\n\",\n material_track->track_id, material_track->sequence->structural_components_count);\n\n for (j = 0; j < material_track->sequence->structural_components_count; j++) {\n component = mxf_resolve_sourceclip(mxf, &material_track->sequence->structural_components_refs[j]);\n if (!component)\n continue;\n\n source_package = mxf_resolve_source_package(mxf, component->source_package_ul, component->source_package_uid);\n if (!source_package) {\n av_log(mxf->fc, AV_LOG_TRACE, \"material track %d: no corresponding source package found\\n\", material_track->track_id);\n continue;\n }\n for (k = 0; k < source_package->tracks_count; k++) {\n if (!(temp_track = mxf_resolve_strong_ref(mxf, &source_package->tracks_refs[k], Track))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve source track strong ref\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail_and_free;\n }\n if (temp_track->track_id == component->source_track_id) {\n source_track = temp_track;\n break;\n }\n }\n if (!source_track) {\n av_log(mxf->fc, AV_LOG_ERROR, \"material track %d: no corresponding source track found\\n\", material_track->track_id);\n break;\n }\n\n for (k = 0; k < mxf->essence_container_data_count; k++) {\n MXFEssenceContainerData *essence_data;\n\n if (!(essence_data = mxf_resolve_strong_ref(mxf, &mxf->essence_container_data_refs[k], EssenceContainerData))) {\n av_log(mxf, AV_LOG_TRACE, \"could not resolve essence container data strong ref\\n\");\n continue;\n }\n if (!memcmp(component->source_package_ul, essence_data->package_ul, sizeof(UID)) && !memcmp(component->source_package_uid, essence_data->package_uid, sizeof(UID))) {\n source_track->body_sid = essence_data->body_sid;\n source_track->index_sid = essence_data->index_sid;\n break;\n }\n }\n\n if(source_track && component)\n break;\n }\n if (!source_track || !component || !source_package) {\n if((ret = mxf_add_metadata_stream(mxf, material_track)))\n goto fail_and_free;\n continue;\n }\n\n if (!(source_track->sequence = mxf_resolve_strong_ref(mxf, &source_track->sequence_ref, Sequence))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve source track sequence strong ref\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail_and_free;\n }\n\n /* 0001GL00.MXF.A1.mxf_opatom.mxf has the same SourcePackageID as 0001GL.MXF.V1.mxf_opatom.mxf\n * This would result in both files appearing to have two streams. Work around this by sanity checking DataDefinition */\n if (memcmp(material_track->sequence->data_definition_ul, source_track->sequence->data_definition_ul, 16)) {\n av_log(mxf->fc, AV_LOG_ERROR, \"material track %d: DataDefinition mismatch\\n\", material_track->track_id);\n continue;\n }\n\n st = avformat_new_stream(mxf->fc, NULL);\n if (!st) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not allocate stream\\n\");\n ret = AVERROR(ENOMEM);\n goto fail_and_free;\n }\n st->id = material_track->track_id;\n st->priv_data = source_track;\n\n source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType);\n descriptor = mxf_resolve_multidescriptor(mxf, source_package->descriptor, source_track->track_id);\n\n /* A SourceClip from a EssenceGroup may only be a single frame of essence data. The clips duration is then how many\n * frames its suppose to repeat for. Descriptor->duration, if present, contains the real duration of the essence data */\n if (descriptor && descriptor->duration != AV_NOPTS_VALUE)\n source_track->original_duration = st->duration = FFMIN(descriptor->duration, component->duration);\n else\n source_track->original_duration = st->duration = component->duration;\n\n if (st->duration == -1)\n st->duration = AV_NOPTS_VALUE;\n st->start_time = component->start_position;\n if (material_track->edit_rate.num <= 0 ||\n material_track->edit_rate.den <= 0) {\n av_log(mxf->fc, AV_LOG_WARNING,\n \"Invalid edit rate (%d/%d) found on stream #%d, \"\n \"defaulting to 25/1\\n\",\n material_track->edit_rate.num,\n material_track->edit_rate.den, st->index);\n material_track->edit_rate = (AVRational){25, 1};\n }\n avpriv_set_pts_info(st, 64, material_track->edit_rate.den, material_track->edit_rate.num);\n\n /* ensure SourceTrack EditRate == MaterialTrack EditRate since only\n * the former is accessible via st->priv_data */\n source_track->edit_rate = material_track->edit_rate;\n\n PRINT_KEY(mxf->fc, \"data definition ul\", source_track->sequence->data_definition_ul);\n codec_ul = mxf_get_codec_ul(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul);\n st->codecpar->codec_type = codec_ul->id;\n\n if (!descriptor) {\n av_log(mxf->fc, AV_LOG_INFO, \"source track %d: stream %d, no descriptor found\\n\", source_track->track_id, st->index);\n continue;\n }\n PRINT_KEY(mxf->fc, \"essence codec ul\", descriptor->essence_codec_ul);\n PRINT_KEY(mxf->fc, \"essence container ul\", descriptor->essence_container_ul);\n essence_container_ul = &descriptor->essence_container_ul;\n source_track->wrapping = (mxf->op == OPAtom) ? ClipWrapped : mxf_get_wrapping_kind(essence_container_ul);\n if (source_track->wrapping == UnknownWrapped)\n av_log(mxf->fc, AV_LOG_INFO, \"wrapping of stream %d is unknown\\n\", st->index);\n /* HACK: replacing the original key with mxf_encrypted_essence_container\n * is not allowed according to s429-6, try to find correct information anyway */\n if (IS_KLV_KEY(essence_container_ul, mxf_encrypted_essence_container)) {\n av_log(mxf->fc, AV_LOG_INFO, \"broken encrypted mxf file\\n\");\n for (k = 0; k < mxf->metadata_sets_count; k++) {\n MXFMetadataSet *metadata = mxf->metadata_sets[k];\n if (metadata->type == CryptoContext) {\n essence_container_ul = &((MXFCryptoContext *)metadata)->source_container_ul;\n break;\n }\n }\n }\n\n /* TODO: drop PictureEssenceCoding and SoundEssenceCompression, only check EssenceContainer */\n codec_ul = mxf_get_codec_ul(ff_mxf_codec_uls, &descriptor->essence_codec_ul);\n st->codecpar->codec_id = (enum AVCodecID)codec_ul->id;\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE) {\n codec_ul = mxf_get_codec_ul(ff_mxf_codec_uls, &descriptor->codec_ul);\n st->codecpar->codec_id = (enum AVCodecID)codec_ul->id;\n }\n\n av_log(mxf->fc, AV_LOG_VERBOSE, \"%s: Universal Label: \",\n avcodec_get_name(st->codecpar->codec_id));\n for (k = 0; k < 16; k++) {\n av_log(mxf->fc, AV_LOG_VERBOSE, \"%.2x\",\n descriptor->essence_codec_ul[k]);\n if (!(k+1 & 19) || k == 5)\n av_log(mxf->fc, AV_LOG_VERBOSE, \".\");\n }\n av_log(mxf->fc, AV_LOG_VERBOSE, \"\\n\");\n\n mxf_add_umid_metadata(&st->metadata, \"file_package_umid\", source_package);\n if (source_package->name && source_package->name[0])\n av_dict_set(&st->metadata, \"file_package_name\", source_package->name, 0);\n if (material_track->name && material_track->name[0])\n av_dict_set(&st->metadata, \"track_name\", material_track->name, 0);\n\n mxf_parse_physical_source_package(mxf, source_track, st);\n\n if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {\n source_track->intra_only = mxf_is_intra_only(descriptor);\n container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, essence_container_ul);\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE)\n st->codecpar->codec_id = container_ul->id;\n st->codecpar->width = descriptor->width;\n st->codecpar->height = descriptor->height; /* Field height, not frame height */\n switch (descriptor->frame_layout) {\n case FullFrame:\n st->codecpar->field_order = AV_FIELD_PROGRESSIVE;\n break;\n case OneField:\n /* Every other line is stored and needs to be duplicated. */\n av_log(mxf->fc, AV_LOG_INFO, \"OneField frame layout isn't currently supported\\n\");\n break; /* The correct thing to do here is fall through, but by breaking we might be\n able to decode some streams at half the vertical resolution, rather than not al all.\n It's also for compatibility with the old behavior. */\n case MixedFields:\n break;\n case SegmentedFrame:\n st->codecpar->field_order = AV_FIELD_PROGRESSIVE;\n case SeparateFields:\n av_log(mxf->fc, AV_LOG_DEBUG, \"video_line_map: (%d, %d), field_dominance: %d\\n\",\n descriptor->video_line_map[0], descriptor->video_line_map[1],\n descriptor->field_dominance);\n if ((descriptor->video_line_map[0] > 0) && (descriptor->video_line_map[1] > 0)) {\n /* Detect coded field order from VideoLineMap:\n * (even, even) => bottom field coded first\n * (even, odd) => top field coded first\n * (odd, even) => top field coded first\n * (odd, odd) => bottom field coded first\n */\n if ((descriptor->video_line_map[0] + descriptor->video_line_map[1]) % 2) {\n switch (descriptor->field_dominance) {\n case MXF_FIELD_DOMINANCE_DEFAULT:\n case MXF_FIELD_DOMINANCE_FF:\n st->codecpar->field_order = AV_FIELD_TT;\n break;\n case MXF_FIELD_DOMINANCE_FL:\n st->codecpar->field_order = AV_FIELD_TB;\n break;\n default:\n avpriv_request_sample(mxf->fc,\n \"Field dominance %d support\",\n descriptor->field_dominance);\n }\n } else {\n switch (descriptor->field_dominance) {\n case MXF_FIELD_DOMINANCE_DEFAULT:\n case MXF_FIELD_DOMINANCE_FF:\n st->codecpar->field_order = AV_FIELD_BB;\n break;\n case MXF_FIELD_DOMINANCE_FL:\n st->codecpar->field_order = AV_FIELD_BT;\n break;\n default:\n avpriv_request_sample(mxf->fc,\n \"Field dominance %d support\",\n descriptor->field_dominance);\n }\n }\n }\n /* Turn field height into frame height. */\n st->codecpar->height *= 2;\n break;\n default:\n av_log(mxf->fc, AV_LOG_INFO, \"Unknown frame layout type: %d\\n\", descriptor->frame_layout);\n }\n if (st->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {\n st->codecpar->format = descriptor->pix_fmt;\n if (st->codecpar->format == AV_PIX_FMT_NONE) {\n pix_fmt_ul = mxf_get_codec_ul(ff_mxf_pixel_format_uls,\n &descriptor->essence_codec_ul);\n st->codecpar->format = (enum AVPixelFormat)pix_fmt_ul->id;\n if (st->codecpar->format== AV_PIX_FMT_NONE) {\n st->codecpar->codec_tag = mxf_get_codec_ul(ff_mxf_codec_tag_uls,\n &descriptor->essence_codec_ul)->id;\n if (!st->codecpar->codec_tag) {\n /* support files created before RP224v10 by defaulting to UYVY422\n if subsampling is 4:2:2 and component depth is 8-bit */\n if (descriptor->horiz_subsampling == 2 &&\n descriptor->vert_subsampling == 1 &&\n descriptor->component_depth == 8) {\n st->codecpar->format = AV_PIX_FMT_UYVY422;\n }\n }\n }\n }\n }\n st->need_parsing = AVSTREAM_PARSE_HEADERS;\n if (material_track->sequence->origin) {\n av_dict_set_int(&st->metadata, \"material_track_origin\", material_track->sequence->origin, 0);\n }\n if (source_track->sequence->origin) {\n av_dict_set_int(&st->metadata, \"source_track_origin\", source_track->sequence->origin, 0);\n }\n if (descriptor->aspect_ratio.num && descriptor->aspect_ratio.den)\n st->display_aspect_ratio = descriptor->aspect_ratio;\n } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {\n container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);\n /* Only overwrite existing codec ID if it is unset or A-law, which is the default according to SMPTE RP 224. */\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE || (st->codecpar->codec_id == AV_CODEC_ID_PCM_ALAW && (enum AVCodecID)container_ul->id != AV_CODEC_ID_NONE))\n st->codecpar->codec_id = (enum AVCodecID)container_ul->id;\n st->codecpar->channels = descriptor->channels;\n st->codecpar->bits_per_coded_sample = descriptor->bits_per_sample;\n\n if (descriptor->sample_rate.den > 0) {\n st->codecpar->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;\n avpriv_set_pts_info(st, 64, descriptor->sample_rate.den, descriptor->sample_rate.num);\n } else {\n av_log(mxf->fc, AV_LOG_WARNING, \"invalid sample rate (%d/%d) \"\n \"found for stream #%d, time base forced to 1/48000\\n\",\n descriptor->sample_rate.num, descriptor->sample_rate.den,\n st->index);\n avpriv_set_pts_info(st, 64, 1, 48000);\n }\n\n /* if duration is set, rescale it from EditRate to SampleRate */\n if (st->duration != AV_NOPTS_VALUE)\n st->duration = av_rescale_q(st->duration,\n av_inv_q(material_track->edit_rate),\n st->time_base);\n\n /* TODO: implement AV_CODEC_ID_RAWAUDIO */\n if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE) {\n if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;\n else if (descriptor->bits_per_sample == 32)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE;\n } else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) {\n if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S24BE;\n else if (descriptor->bits_per_sample == 32)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S32BE;\n } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) {\n st->need_parsing = AVSTREAM_PARSE_FULL;\n }\n } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {\n enum AVMediaType type;\n container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, essence_container_ul);\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE)\n st->codecpar->codec_id = container_ul->id;\n type = avcodec_get_type(st->codecpar->codec_id);\n if (type == AVMEDIA_TYPE_SUBTITLE)\n st->codecpar->codec_type = type;\n if (container_ul->desc)\n av_dict_set(&st->metadata, \"data_type\", container_ul->desc, 0);\n }\n if (descriptor->extradata) {\n if (!ff_alloc_extradata(st->codecpar, descriptor->extradata_size)) {\n memcpy(st->codecpar->extradata, descriptor->extradata, descriptor->extradata_size);\n }\n } else if (st->codecpar->codec_id == AV_CODEC_ID_H264) {\n int coded_width = mxf_get_codec_ul(mxf_intra_only_picture_coded_width,\n &descriptor->essence_codec_ul)->id;\n if (coded_width)\n st->codecpar->width = coded_width;\n ret = ff_generate_avci_extradata(st);\n if (ret < 0)\n return ret;\n }\n if (st->codecpar->codec_type != AVMEDIA_TYPE_DATA && source_track->wrapping != FrameWrapped) {\n /* TODO: decode timestamps */\n st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;\n }\n }\n\n ret = 0;\nfail_and_free:\n return ret;\n}","target":"static int mxf_parse_structural_metadata(MXFContext *mxf)\n{\n MXFPackage *material_package = NULL;\n int i, j, k, ret;\n\n av_log(mxf->fc, AV_LOG_TRACE, \"metadata sets count %d\\n\", mxf->metadata_sets_count);\n /* TODO: handle multiple material packages (OP3x) */\n for (i = 0; i < mxf->packages_count; i++) {\n material_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[i], MaterialPackage);\n if (material_package) break;\n }\n if (!material_package) {\n av_log(mxf->fc, AV_LOG_ERROR, \"no material package found\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n mxf_add_umid_metadata(&mxf->fc->metadata, \"material_package_umid\", material_package);\n if (material_package->name && material_package->name[0])\n av_dict_set(&mxf->fc->metadata, \"material_package_name\", material_package->name, 0);\n mxf_parse_package_comments(mxf, &mxf->fc->metadata, material_package);\n\n for (i = 0; i < material_package->tracks_count; i++) {\n MXFPackage *source_package = NULL;\n MXFTrack *material_track = NULL;\n MXFTrack *source_track = NULL;\n MXFTrack *temp_track = NULL;\n MXFDescriptor *descriptor = NULL;\n MXFStructuralComponent *component = NULL;\n MXFTimecodeComponent *mxf_tc = NULL;\n UID *essence_container_ul = NULL;\n const MXFCodecUL *codec_ul = NULL;\n const MXFCodecUL *container_ul = NULL;\n const MXFCodecUL *pix_fmt_ul = NULL;\n AVStream *st;\n AVTimecode tc;\n int flags;\n\n if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i], Track))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve material track strong ref\\n\");\n continue;\n }\n\n if ((component = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, TimecodeComponent))) {\n mxf_tc = (MXFTimecodeComponent*)component;\n flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;\n if (av_timecode_init(&tc, mxf_tc->rate, flags, mxf_tc->start_frame, mxf->fc) == 0) {\n mxf_add_timecode_metadata(&mxf->fc->metadata, \"timecode\", &tc);\n }\n }\n\n if (!(material_track->sequence = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, Sequence))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve material track sequence strong ref\\n\");\n continue;\n }\n\n for (j = 0; j < material_track->sequence->structural_components_count; j++) {\n component = mxf_resolve_strong_ref(mxf, &material_track->sequence->structural_components_refs[j], TimecodeComponent);\n if (!component)\n continue;\n\n mxf_tc = (MXFTimecodeComponent*)component;\n flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0;\n if (av_timecode_init(&tc, mxf_tc->rate, flags, mxf_tc->start_frame, mxf->fc) == 0) {\n mxf_add_timecode_metadata(&mxf->fc->metadata, \"timecode\", &tc);\n break;\n }\n }\n\n /* TODO: handle multiple source clips, only finds first valid source clip */\n if(material_track->sequence->structural_components_count > 1)\n av_log(mxf->fc, AV_LOG_WARNING, \"material track %d: has %d components\\n\",\n material_track->track_id, material_track->sequence->structural_components_count);\n\n for (j = 0; j < material_track->sequence->structural_components_count; j++) {\n component = mxf_resolve_sourceclip(mxf, &material_track->sequence->structural_components_refs[j]);\n if (!component)\n continue;\n\n source_package = mxf_resolve_source_package(mxf, component->source_package_ul, component->source_package_uid);\n if (!source_package) {\n av_log(mxf->fc, AV_LOG_TRACE, \"material track %d: no corresponding source package found\\n\", material_track->track_id);\n continue;\n }\n for (k = 0; k < source_package->tracks_count; k++) {\n if (!(temp_track = mxf_resolve_strong_ref(mxf, &source_package->tracks_refs[k], Track))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve source track strong ref\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail_and_free;\n }\n if (temp_track->track_id == component->source_track_id) {\n source_track = temp_track;\n break;\n }\n }\n if (!source_track) {\n av_log(mxf->fc, AV_LOG_ERROR, \"material track %d: no corresponding source track found\\n\", material_track->track_id);\n break;\n }\n\n for (k = 0; k < mxf->essence_container_data_count; k++) {\n MXFEssenceContainerData *essence_data;\n\n if (!(essence_data = mxf_resolve_strong_ref(mxf, &mxf->essence_container_data_refs[k], EssenceContainerData))) {\n av_log(mxf->fc, AV_LOG_TRACE, \"could not resolve essence container data strong ref\\n\");\n continue;\n }\n if (!memcmp(component->source_package_ul, essence_data->package_ul, sizeof(UID)) && !memcmp(component->source_package_uid, essence_data->package_uid, sizeof(UID))) {\n source_track->body_sid = essence_data->body_sid;\n source_track->index_sid = essence_data->index_sid;\n break;\n }\n }\n\n if(source_track && component)\n break;\n }\n if (!source_track || !component || !source_package) {\n if((ret = mxf_add_metadata_stream(mxf, material_track)))\n goto fail_and_free;\n continue;\n }\n\n if (!(source_track->sequence = mxf_resolve_strong_ref(mxf, &source_track->sequence_ref, Sequence))) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not resolve source track sequence strong ref\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail_and_free;\n }\n\n /* 0001GL00.MXF.A1.mxf_opatom.mxf has the same SourcePackageID as 0001GL.MXF.V1.mxf_opatom.mxf\n * This would result in both files appearing to have two streams. Work around this by sanity checking DataDefinition */\n if (memcmp(material_track->sequence->data_definition_ul, source_track->sequence->data_definition_ul, 16)) {\n av_log(mxf->fc, AV_LOG_ERROR, \"material track %d: DataDefinition mismatch\\n\", material_track->track_id);\n continue;\n }\n\n st = avformat_new_stream(mxf->fc, NULL);\n if (!st) {\n av_log(mxf->fc, AV_LOG_ERROR, \"could not allocate stream\\n\");\n ret = AVERROR(ENOMEM);\n goto fail_and_free;\n }\n st->id = material_track->track_id;\n st->priv_data = source_track;\n\n source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType);\n descriptor = mxf_resolve_multidescriptor(mxf, source_package->descriptor, source_track->track_id);\n\n /* A SourceClip from a EssenceGroup may only be a single frame of essence data. The clips duration is then how many\n * frames its suppose to repeat for. Descriptor->duration, if present, contains the real duration of the essence data */\n if (descriptor && descriptor->duration != AV_NOPTS_VALUE)\n source_track->original_duration = st->duration = FFMIN(descriptor->duration, component->duration);\n else\n source_track->original_duration = st->duration = component->duration;\n\n if (st->duration == -1)\n st->duration = AV_NOPTS_VALUE;\n st->start_time = component->start_position;\n if (material_track->edit_rate.num <= 0 ||\n material_track->edit_rate.den <= 0) {\n av_log(mxf->fc, AV_LOG_WARNING,\n \"Invalid edit rate (%d/%d) found on stream #%d, \"\n \"defaulting to 25/1\\n\",\n material_track->edit_rate.num,\n material_track->edit_rate.den, st->index);\n material_track->edit_rate = (AVRational){25, 1};\n }\n avpriv_set_pts_info(st, 64, material_track->edit_rate.den, material_track->edit_rate.num);\n\n /* ensure SourceTrack EditRate == MaterialTrack EditRate since only\n * the former is accessible via st->priv_data */\n source_track->edit_rate = material_track->edit_rate;\n\n PRINT_KEY(mxf->fc, \"data definition ul\", source_track->sequence->data_definition_ul);\n codec_ul = mxf_get_codec_ul(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul);\n st->codecpar->codec_type = codec_ul->id;\n\n if (!descriptor) {\n av_log(mxf->fc, AV_LOG_INFO, \"source track %d: stream %d, no descriptor found\\n\", source_track->track_id, st->index);\n continue;\n }\n PRINT_KEY(mxf->fc, \"essence codec ul\", descriptor->essence_codec_ul);\n PRINT_KEY(mxf->fc, \"essence container ul\", descriptor->essence_container_ul);\n essence_container_ul = &descriptor->essence_container_ul;\n source_track->wrapping = (mxf->op == OPAtom) ? ClipWrapped : mxf_get_wrapping_kind(essence_container_ul);\n if (source_track->wrapping == UnknownWrapped)\n av_log(mxf->fc, AV_LOG_INFO, \"wrapping of stream %d is unknown\\n\", st->index);\n /* HACK: replacing the original key with mxf_encrypted_essence_container\n * is not allowed according to s429-6, try to find correct information anyway */\n if (IS_KLV_KEY(essence_container_ul, mxf_encrypted_essence_container)) {\n av_log(mxf->fc, AV_LOG_INFO, \"broken encrypted mxf file\\n\");\n for (k = 0; k < mxf->metadata_sets_count; k++) {\n MXFMetadataSet *metadata = mxf->metadata_sets[k];\n if (metadata->type == CryptoContext) {\n essence_container_ul = &((MXFCryptoContext *)metadata)->source_container_ul;\n break;\n }\n }\n }\n\n /* TODO: drop PictureEssenceCoding and SoundEssenceCompression, only check EssenceContainer */\n codec_ul = mxf_get_codec_ul(ff_mxf_codec_uls, &descriptor->essence_codec_ul);\n st->codecpar->codec_id = (enum AVCodecID)codec_ul->id;\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE) {\n codec_ul = mxf_get_codec_ul(ff_mxf_codec_uls, &descriptor->codec_ul);\n st->codecpar->codec_id = (enum AVCodecID)codec_ul->id;\n }\n\n av_log(mxf->fc, AV_LOG_VERBOSE, \"%s: Universal Label: \",\n avcodec_get_name(st->codecpar->codec_id));\n for (k = 0; k < 16; k++) {\n av_log(mxf->fc, AV_LOG_VERBOSE, \"%.2x\",\n descriptor->essence_codec_ul[k]);\n if (!(k+1 & 19) || k == 5)\n av_log(mxf->fc, AV_LOG_VERBOSE, \".\");\n }\n av_log(mxf->fc, AV_LOG_VERBOSE, \"\\n\");\n\n mxf_add_umid_metadata(&st->metadata, \"file_package_umid\", source_package);\n if (source_package->name && source_package->name[0])\n av_dict_set(&st->metadata, \"file_package_name\", source_package->name, 0);\n if (material_track->name && material_track->name[0])\n av_dict_set(&st->metadata, \"track_name\", material_track->name, 0);\n\n mxf_parse_physical_source_package(mxf, source_track, st);\n\n if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {\n source_track->intra_only = mxf_is_intra_only(descriptor);\n container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, essence_container_ul);\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE)\n st->codecpar->codec_id = container_ul->id;\n st->codecpar->width = descriptor->width;\n st->codecpar->height = descriptor->height; /* Field height, not frame height */\n switch (descriptor->frame_layout) {\n case FullFrame:\n st->codecpar->field_order = AV_FIELD_PROGRESSIVE;\n break;\n case OneField:\n /* Every other line is stored and needs to be duplicated. */\n av_log(mxf->fc, AV_LOG_INFO, \"OneField frame layout isn't currently supported\\n\");\n break; /* The correct thing to do here is fall through, but by breaking we might be\n able to decode some streams at half the vertical resolution, rather than not al all.\n It's also for compatibility with the old behavior. */\n case MixedFields:\n break;\n case SegmentedFrame:\n st->codecpar->field_order = AV_FIELD_PROGRESSIVE;\n case SeparateFields:\n av_log(mxf->fc, AV_LOG_DEBUG, \"video_line_map: (%d, %d), field_dominance: %d\\n\",\n descriptor->video_line_map[0], descriptor->video_line_map[1],\n descriptor->field_dominance);\n if ((descriptor->video_line_map[0] > 0) && (descriptor->video_line_map[1] > 0)) {\n /* Detect coded field order from VideoLineMap:\n * (even, even) => bottom field coded first\n * (even, odd) => top field coded first\n * (odd, even) => top field coded first\n * (odd, odd) => bottom field coded first\n */\n if ((descriptor->video_line_map[0] + descriptor->video_line_map[1]) % 2) {\n switch (descriptor->field_dominance) {\n case MXF_FIELD_DOMINANCE_DEFAULT:\n case MXF_FIELD_DOMINANCE_FF:\n st->codecpar->field_order = AV_FIELD_TT;\n break;\n case MXF_FIELD_DOMINANCE_FL:\n st->codecpar->field_order = AV_FIELD_TB;\n break;\n default:\n avpriv_request_sample(mxf->fc,\n \"Field dominance %d support\",\n descriptor->field_dominance);\n }\n } else {\n switch (descriptor->field_dominance) {\n case MXF_FIELD_DOMINANCE_DEFAULT:\n case MXF_FIELD_DOMINANCE_FF:\n st->codecpar->field_order = AV_FIELD_BB;\n break;\n case MXF_FIELD_DOMINANCE_FL:\n st->codecpar->field_order = AV_FIELD_BT;\n break;\n default:\n avpriv_request_sample(mxf->fc,\n \"Field dominance %d support\",\n descriptor->field_dominance);\n }\n }\n }\n /* Turn field height into frame height. */\n st->codecpar->height *= 2;\n break;\n default:\n av_log(mxf->fc, AV_LOG_INFO, \"Unknown frame layout type: %d\\n\", descriptor->frame_layout);\n }\n if (st->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {\n st->codecpar->format = descriptor->pix_fmt;\n if (st->codecpar->format == AV_PIX_FMT_NONE) {\n pix_fmt_ul = mxf_get_codec_ul(ff_mxf_pixel_format_uls,\n &descriptor->essence_codec_ul);\n st->codecpar->format = (enum AVPixelFormat)pix_fmt_ul->id;\n if (st->codecpar->format== AV_PIX_FMT_NONE) {\n st->codecpar->codec_tag = mxf_get_codec_ul(ff_mxf_codec_tag_uls,\n &descriptor->essence_codec_ul)->id;\n if (!st->codecpar->codec_tag) {\n /* support files created before RP224v10 by defaulting to UYVY422\n if subsampling is 4:2:2 and component depth is 8-bit */\n if (descriptor->horiz_subsampling == 2 &&\n descriptor->vert_subsampling == 1 &&\n descriptor->component_depth == 8) {\n st->codecpar->format = AV_PIX_FMT_UYVY422;\n }\n }\n }\n }\n }\n st->need_parsing = AVSTREAM_PARSE_HEADERS;\n if (material_track->sequence->origin) {\n av_dict_set_int(&st->metadata, \"material_track_origin\", material_track->sequence->origin, 0);\n }\n if (source_track->sequence->origin) {\n av_dict_set_int(&st->metadata, \"source_track_origin\", source_track->sequence->origin, 0);\n }\n if (descriptor->aspect_ratio.num && descriptor->aspect_ratio.den)\n st->display_aspect_ratio = descriptor->aspect_ratio;\n } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {\n container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);\n /* Only overwrite existing codec ID if it is unset or A-law, which is the default according to SMPTE RP 224. */\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE || (st->codecpar->codec_id == AV_CODEC_ID_PCM_ALAW && (enum AVCodecID)container_ul->id != AV_CODEC_ID_NONE))\n st->codecpar->codec_id = (enum AVCodecID)container_ul->id;\n st->codecpar->channels = descriptor->channels;\n st->codecpar->bits_per_coded_sample = descriptor->bits_per_sample;\n\n if (descriptor->sample_rate.den > 0) {\n st->codecpar->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;\n avpriv_set_pts_info(st, 64, descriptor->sample_rate.den, descriptor->sample_rate.num);\n } else {\n av_log(mxf->fc, AV_LOG_WARNING, \"invalid sample rate (%d/%d) \"\n \"found for stream #%d, time base forced to 1/48000\\n\",\n descriptor->sample_rate.num, descriptor->sample_rate.den,\n st->index);\n avpriv_set_pts_info(st, 64, 1, 48000);\n }\n\n /* if duration is set, rescale it from EditRate to SampleRate */\n if (st->duration != AV_NOPTS_VALUE)\n st->duration = av_rescale_q(st->duration,\n av_inv_q(material_track->edit_rate),\n st->time_base);\n\n /* TODO: implement AV_CODEC_ID_RAWAUDIO */\n if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE) {\n if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;\n else if (descriptor->bits_per_sample == 32)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE;\n } else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) {\n if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S24BE;\n else if (descriptor->bits_per_sample == 32)\n st->codecpar->codec_id = AV_CODEC_ID_PCM_S32BE;\n } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) {\n st->need_parsing = AVSTREAM_PARSE_FULL;\n }\n } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {\n enum AVMediaType type;\n container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, essence_container_ul);\n if (st->codecpar->codec_id == AV_CODEC_ID_NONE)\n st->codecpar->codec_id = container_ul->id;\n type = avcodec_get_type(st->codecpar->codec_id);\n if (type == AVMEDIA_TYPE_SUBTITLE)\n st->codecpar->codec_type = type;\n if (container_ul->desc)\n av_dict_set(&st->metadata, \"data_type\", container_ul->desc, 0);\n }\n if (descriptor->extradata) {\n if (!ff_alloc_extradata(st->codecpar, descriptor->extradata_size)) {\n memcpy(st->codecpar->extradata, descriptor->extradata, descriptor->extradata_size);\n }\n } else if (st->codecpar->codec_id == AV_CODEC_ID_H264) {\n int coded_width = mxf_get_codec_ul(mxf_intra_only_picture_coded_width,\n &descriptor->essence_codec_ul)->id;\n if (coded_width)\n st->codecpar->width = coded_width;\n ret = ff_generate_avci_extradata(st);\n if (ret < 0)\n return ret;\n }\n if (st->codecpar->codec_type != AVMEDIA_TYPE_DATA && source_track->wrapping != FrameWrapped) {\n /* TODO: decode timestamps */\n st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;\n }\n }\n\n ret = 0;\nfail_and_free:\n return ret;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"mxf_parse_structural_metadata","file_name":"libavformat/mxfdec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/bab0716c7f4793ec42e05a5aa7e80d82a0dd4e75","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#86-eee50e7d1b77","input":"static void parse_hid_report_descriptor(struct gtco *device, char * report,\n\t\t\t\t\tint length)\n{\n\tstruct device *ddev = &device->intf->dev;\n\tint x, i = 0;\n\n\t/* Tag primitive vars */\n\t__u8 prefix;\n\t__u8 size;\n\t__u8 tag;\n\t__u8 type;\n\t__u8 data = 0;\n\t__u16 data16 = 0;\n\t__u32 data32 = 0;\n\n\t/* For parsing logic */\n\tint inputnum = 0;\n\t__u32 usage = 0;\n\n\t/* Global Values, indexed by TAG */\n\t__u32 globalval[TAG_GLOB_MAX];\n\t__u32 oldval[TAG_GLOB_MAX];\n\n\t/* Debug stuff */\n\tchar maintype = 'x';\n\tchar globtype[12];\n\tint indent = 0;\n\tchar indentstr[10] = \"\";\n\n\n\tdev_dbg(ddev, \"======>>>>>>PARSE<<<<<<======\\n\");\n\n\t/* Walk this report and pull out the info we need */\n\twhile (i < length) {\n\t\tprefix = report[i];\n\n\t\t/* Skip over prefix */\n\t\ti++;\n\n\t\t/* Determine data size and save the data in the proper variable */\n\t\tsize = PREF_SIZE(prefix);\n\t\tswitch (size) {\n\t\tcase 1:\n\t\t\tdata = report[i];\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tdata16 = get_unaligned_le16(&report[i]);\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tsize = 4;\n\t\t\tdata32 = get_unaligned_le32(&report[i]);\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Skip size of data */\n\t\ti += size;\n\n\t\t/* What we do depends on the tag type */\n\t\ttag = PREF_TAG(prefix);\n\t\ttype = PREF_TYPE(prefix);\n\t\tswitch (type) {\n\t\tcase TYPE_MAIN:\n\t\t\tstrcpy(globtype, \"\");\n\t\t\tswitch (tag) {\n\n\t\t\tcase TAG_MAIN_INPUT:\n\t\t\t\t/*\n\t\t\t\t * The INPUT MAIN tag signifies this is\n\t\t\t\t * information from a report. We need to\n\t\t\t\t * figure out what it is and store the\n\t\t\t\t * min/max values\n\t\t\t\t */\n\n\t\t\t\tmaintype = 'I';\n\t\t\t\tif (data == 2)\n\t\t\t\t\tstrcpy(globtype, \"Variable\");\n\t\t\t\telse if (data == 3)\n\t\t\t\t\tstrcpy(globtype, \"Var|Const\");\n\n\t\t\t\tdev_dbg(ddev, \"::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits\\n\",\n\t\t\t\t\tglobalval[TAG_GLOB_REPORT_ID], inputnum,\n\t\t\t\t\tglobalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX],\n\t\t\t\t\tglobalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN],\n\t\t\t\t\tglobalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]);\n\n\n\t\t\t\t/*\n\t\t\t\t We can assume that the first two input items\n\t\t\t\t are always the X and Y coordinates. After\n\t\t\t\t that, we look for everything else by\n\t\t\t\t local usage value\n\t\t\t\t */\n\t\t\t\tswitch (inputnum) {\n\t\t\t\tcase 0: /* X coord */\n\t\t\t\t\tdev_dbg(ddev, \"GER: X Usage: 0x%x\\n\", usage);\n\t\t\t\t\tif (device->max_X == 0) {\n\t\t\t\t\t\tdevice->max_X = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\tdevice->min_X = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 1: /* Y coord */\n\t\t\t\t\tdev_dbg(ddev, \"GER: Y Usage: 0x%x\\n\", usage);\n\t\t\t\t\tif (device->max_Y == 0) {\n\t\t\t\t\t\tdevice->max_Y = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\tdevice->min_Y = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\t/* Tilt X */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TILT_X) {\n\t\t\t\t\t\tif (device->maxtilt_X == 0) {\n\t\t\t\t\t\t\tdevice->maxtilt_X = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->mintilt_X = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Tilt Y */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TILT_Y) {\n\t\t\t\t\t\tif (device->maxtilt_Y == 0) {\n\t\t\t\t\t\t\tdevice->maxtilt_Y = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->mintilt_Y = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Pressure */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TIP_PRESSURE) {\n\t\t\t\t\t\tif (device->maxpressure == 0) {\n\t\t\t\t\t\t\tdevice->maxpressure = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->minpressure = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tinputnum++;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_OUTPUT:\n\t\t\t\tmaintype = 'O';\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_FEATURE:\n\t\t\t\tmaintype = 'F';\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_COL_START:\n\t\t\t\tmaintype = 'S';\n\n\t\t\t\tif (data == 0) {\n\t\t\t\t\tdev_dbg(ddev, \"======>>>>>> Physical\\n\");\n\t\t\t\t\tstrcpy(globtype, \"Physical\");\n\t\t\t\t} else\n\t\t\t\t\tdev_dbg(ddev, \"======>>>>>>\\n\");\n\n\t\t\t\t/* Indent the debug output */\n\t\t\t\tindent++;\n\t\t\t\tfor (x = 0; x < indent; x++)\n\t\t\t\t\tindentstr[x] = '-';\n\t\t\t\tindentstr[x] = 0;\n\n\t\t\t\t/* Save global tags */\n\t\t\t\tfor (x = 0; x < TAG_GLOB_MAX; x++)\n\t\t\t\t\toldval[x] = globalval[x];\n\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_COL_END:\n\t\t\t\tdev_dbg(ddev, \"<<<<<<======\\n\");\n\t\t\t\tmaintype = 'E';\n\t\t\t\tindent--;\n\t\t\t\tfor (x = 0; x < indent; x++)\n\t\t\t\t\tindentstr[x] = '-';\n\t\t\t\tindentstr[x] = 0;\n\n\t\t\t\t/* Copy global tags back */\n\t\t\t\tfor (x = 0; x < TAG_GLOB_MAX; x++)\n\t\t\t\t\tglobalval[x] = oldval[x];\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data);\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data16);\n\t\t\t\tbreak;\n\n\t\t\tcase 4:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data32);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase TYPE_GLOBAL:\n\t\t\tswitch (tag) {\n\t\t\tcase TAG_GLOB_USAGE:\n\t\t\t\t/*\n\t\t\t\t * First time we hit the global usage tag,\n\t\t\t\t * it should tell us the type of device\n\t\t\t\t */\n\t\t\t\tif (device->usage == 0)\n\t\t\t\t\tdevice->usage = data;\n\n\t\t\t\tstrcpy(globtype, \"USAGE\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MIN:\n\t\t\t\tstrcpy(globtype, \"LOG_MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MAX:\n\t\t\t\tstrcpy(globtype, \"LOG_MAX\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PHYS_MIN:\n\t\t\t\tstrcpy(globtype, \"PHYS_MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PHYS_MAX:\n\t\t\t\tstrcpy(globtype, \"PHYS_MAX\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_UNIT_EXP:\n\t\t\t\tstrcpy(globtype, \"EXP\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_UNIT:\n\t\t\t\tstrcpy(globtype, \"UNIT\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_SZ:\n\t\t\t\tstrcpy(globtype, \"REPORT_SZ\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_ID:\n\t\t\t\tstrcpy(globtype, \"REPORT_ID\");\n\t\t\t\t/* New report, restart numbering */\n\t\t\t\tinputnum = 0;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_CNT:\n\t\t\t\tstrcpy(globtype, \"REPORT_CNT\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PUSH:\n\t\t\t\tstrcpy(globtype, \"PUSH\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_POP:\n\t\t\t\tstrcpy(globtype, \"POP\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t/* Check to make sure we have a good tag number\n\t\t\t so we don't overflow array */\n\t\t\tif (tag < TAG_GLOB_MAX) {\n\t\t\t\tswitch (size) {\n\t\t\t\tcase 1:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data);\n\t\t\t\t\tglobalval[tag] = data;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data16);\n\t\t\t\t\tglobalval[tag] = data16;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 4:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data32);\n\t\t\t\t\tglobalval[tag] = data32;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d\\n\",\n\t\t\t\t\tindentstr, tag, size);\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase TYPE_LOCAL:\n\t\t\tswitch (tag) {\n\t\t\tcase TAG_GLOB_USAGE:\n\t\t\t\tstrcpy(globtype, \"USAGE\");\n\t\t\t\t/* Always 1 byte */\n\t\t\t\tusage = data;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MIN:\n\t\t\t\tstrcpy(globtype, \"MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MAX:\n\t\t\t\tstrcpy(globtype, \"MAX\");\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tstrcpy(globtype, \"UNKNOWN\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data);\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data16);\n\t\t\t\tbreak;\n\n\t\t\tcase 4:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data32);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\t}\n}","target":"static void parse_hid_report_descriptor(struct gtco *device, char * report,\n\t\t\t\t\tint length)\n{\n\tstruct device *ddev = &device->intf->dev;\n\tint x, i = 0;\n\n\t/* Tag primitive vars */\n\t__u8 prefix;\n\t__u8 size;\n\t__u8 tag;\n\t__u8 type;\n\t__u8 data = 0;\n\t__u16 data16 = 0;\n\t__u32 data32 = 0;\n\n\t/* For parsing logic */\n\tint inputnum = 0;\n\t__u32 usage = 0;\n\n\t/* Global Values, indexed by TAG */\n\t__u32 globalval[TAG_GLOB_MAX];\n\t__u32 oldval[TAG_GLOB_MAX];\n\n\t/* Debug stuff */\n\tchar maintype = 'x';\n\tchar globtype[12];\n\tint indent = 0;\n\tchar indentstr[10] = \"\";\n\n\n\tdev_dbg(ddev, \"======>>>>>>PARSE<<<<<<======\\n\");\n\n\t/* Walk this report and pull out the info we need */\n\twhile (i < length) {\n\t\tprefix = report[i++];\n\n\t\t/* Determine data size and save the data in the proper variable */\n\t\tsize = (1U << PREF_SIZE(prefix)) >> 1;\n\t\tif (i + size > length) {\n\t\t\tdev_err(ddev,\n\t\t\t\t\"Not enough data (need %d, have %d)\\n\",\n\t\t\t\ti + size, length);\n\t\t\tbreak;\n\t\t}\n\n\t\tswitch (size) {\n\t\tcase 1:\n\t\t\tdata = report[i];\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tdata16 = get_unaligned_le16(&report[i]);\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tdata32 = get_unaligned_le32(&report[i]);\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Skip size of data */\n\t\ti += size;\n\n\t\t/* What we do depends on the tag type */\n\t\ttag = PREF_TAG(prefix);\n\t\ttype = PREF_TYPE(prefix);\n\t\tswitch (type) {\n\t\tcase TYPE_MAIN:\n\t\t\tstrcpy(globtype, \"\");\n\t\t\tswitch (tag) {\n\n\t\t\tcase TAG_MAIN_INPUT:\n\t\t\t\t/*\n\t\t\t\t * The INPUT MAIN tag signifies this is\n\t\t\t\t * information from a report. We need to\n\t\t\t\t * figure out what it is and store the\n\t\t\t\t * min/max values\n\t\t\t\t */\n\n\t\t\t\tmaintype = 'I';\n\t\t\t\tif (data == 2)\n\t\t\t\t\tstrcpy(globtype, \"Variable\");\n\t\t\t\telse if (data == 3)\n\t\t\t\t\tstrcpy(globtype, \"Var|Const\");\n\n\t\t\t\tdev_dbg(ddev, \"::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits\\n\",\n\t\t\t\t\tglobalval[TAG_GLOB_REPORT_ID], inputnum,\n\t\t\t\t\tglobalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX],\n\t\t\t\t\tglobalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN],\n\t\t\t\t\tglobalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]);\n\n\n\t\t\t\t/*\n\t\t\t\t We can assume that the first two input items\n\t\t\t\t are always the X and Y coordinates. After\n\t\t\t\t that, we look for everything else by\n\t\t\t\t local usage value\n\t\t\t\t */\n\t\t\t\tswitch (inputnum) {\n\t\t\t\tcase 0: /* X coord */\n\t\t\t\t\tdev_dbg(ddev, \"GER: X Usage: 0x%x\\n\", usage);\n\t\t\t\t\tif (device->max_X == 0) {\n\t\t\t\t\t\tdevice->max_X = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\tdevice->min_X = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 1: /* Y coord */\n\t\t\t\t\tdev_dbg(ddev, \"GER: Y Usage: 0x%x\\n\", usage);\n\t\t\t\t\tif (device->max_Y == 0) {\n\t\t\t\t\t\tdevice->max_Y = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\tdevice->min_Y = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\t/* Tilt X */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TILT_X) {\n\t\t\t\t\t\tif (device->maxtilt_X == 0) {\n\t\t\t\t\t\t\tdevice->maxtilt_X = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->mintilt_X = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Tilt Y */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TILT_Y) {\n\t\t\t\t\t\tif (device->maxtilt_Y == 0) {\n\t\t\t\t\t\t\tdevice->maxtilt_Y = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->mintilt_Y = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Pressure */\n\t\t\t\t\tif (usage == DIGITIZER_USAGE_TIP_PRESSURE) {\n\t\t\t\t\t\tif (device->maxpressure == 0) {\n\t\t\t\t\t\t\tdevice->maxpressure = globalval[TAG_GLOB_LOG_MAX];\n\t\t\t\t\t\t\tdevice->minpressure = globalval[TAG_GLOB_LOG_MIN];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tinputnum++;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_OUTPUT:\n\t\t\t\tmaintype = 'O';\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_FEATURE:\n\t\t\t\tmaintype = 'F';\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_COL_START:\n\t\t\t\tmaintype = 'S';\n\n\t\t\t\tif (data == 0) {\n\t\t\t\t\tdev_dbg(ddev, \"======>>>>>> Physical\\n\");\n\t\t\t\t\tstrcpy(globtype, \"Physical\");\n\t\t\t\t} else\n\t\t\t\t\tdev_dbg(ddev, \"======>>>>>>\\n\");\n\n\t\t\t\t/* Indent the debug output */\n\t\t\t\tindent++;\n\t\t\t\tfor (x = 0; x < indent; x++)\n\t\t\t\t\tindentstr[x] = '-';\n\t\t\t\tindentstr[x] = 0;\n\n\t\t\t\t/* Save global tags */\n\t\t\t\tfor (x = 0; x < TAG_GLOB_MAX; x++)\n\t\t\t\t\toldval[x] = globalval[x];\n\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_MAIN_COL_END:\n\t\t\t\tdev_dbg(ddev, \"<<<<<<======\\n\");\n\t\t\t\tmaintype = 'E';\n\t\t\t\tindent--;\n\t\t\t\tfor (x = 0; x < indent; x++)\n\t\t\t\t\tindentstr[x] = '-';\n\t\t\t\tindentstr[x] = 0;\n\n\t\t\t\t/* Copy global tags back */\n\t\t\t\tfor (x = 0; x < TAG_GLOB_MAX; x++)\n\t\t\t\t\tglobalval[x] = oldval[x];\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data);\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data16);\n\t\t\t\tbreak;\n\n\t\t\tcase 4:\n\t\t\t\tdev_dbg(ddev, \"%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, maintype, size, globtype, data32);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase TYPE_GLOBAL:\n\t\t\tswitch (tag) {\n\t\t\tcase TAG_GLOB_USAGE:\n\t\t\t\t/*\n\t\t\t\t * First time we hit the global usage tag,\n\t\t\t\t * it should tell us the type of device\n\t\t\t\t */\n\t\t\t\tif (device->usage == 0)\n\t\t\t\t\tdevice->usage = data;\n\n\t\t\t\tstrcpy(globtype, \"USAGE\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MIN:\n\t\t\t\tstrcpy(globtype, \"LOG_MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MAX:\n\t\t\t\tstrcpy(globtype, \"LOG_MAX\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PHYS_MIN:\n\t\t\t\tstrcpy(globtype, \"PHYS_MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PHYS_MAX:\n\t\t\t\tstrcpy(globtype, \"PHYS_MAX\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_UNIT_EXP:\n\t\t\t\tstrcpy(globtype, \"EXP\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_UNIT:\n\t\t\t\tstrcpy(globtype, \"UNIT\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_SZ:\n\t\t\t\tstrcpy(globtype, \"REPORT_SZ\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_ID:\n\t\t\t\tstrcpy(globtype, \"REPORT_ID\");\n\t\t\t\t/* New report, restart numbering */\n\t\t\t\tinputnum = 0;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_REPORT_CNT:\n\t\t\t\tstrcpy(globtype, \"REPORT_CNT\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_PUSH:\n\t\t\t\tstrcpy(globtype, \"PUSH\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_POP:\n\t\t\t\tstrcpy(globtype, \"POP\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t/* Check to make sure we have a good tag number\n\t\t\t so we don't overflow array */\n\t\t\tif (tag < TAG_GLOB_MAX) {\n\t\t\t\tswitch (size) {\n\t\t\t\tcase 1:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data);\n\t\t\t\t\tglobalval[tag] = data;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 2:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data16);\n\t\t\t\t\tglobalval[tag] = data16;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 4:\n\t\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\t\tindentstr, globtype, tag, size, data32);\n\t\t\t\t\tglobalval[tag] = data32;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdev_dbg(ddev, \"%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d\\n\",\n\t\t\t\t\tindentstr, tag, size);\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase TYPE_LOCAL:\n\t\t\tswitch (tag) {\n\t\t\tcase TAG_GLOB_USAGE:\n\t\t\t\tstrcpy(globtype, \"USAGE\");\n\t\t\t\t/* Always 1 byte */\n\t\t\t\tusage = data;\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MIN:\n\t\t\t\tstrcpy(globtype, \"MIN\");\n\t\t\t\tbreak;\n\n\t\t\tcase TAG_GLOB_LOG_MAX:\n\t\t\t\tstrcpy(globtype, \"MAX\");\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tstrcpy(globtype, \"UNKNOWN\");\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (size) {\n\t\t\tcase 1:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data);\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data16);\n\t\t\t\tbreak;\n\n\t\t\tcase 4:\n\t\t\t\tdev_dbg(ddev, \"%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\\n\",\n\t\t\t\t\tindentstr, tag, globtype, size, data32);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\t}\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"parse_hid_report_descriptor","file_name":"drivers/input/tablet/gtco.c","commit_link":"github.com/torvalds/linux/commit/a50829479f58416a013a4ccca791336af3c584c7","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#87-a7241e3007d3","input":"int fpm_log_write(char *log_format) /* {{{ */\n{\n\tchar *s, *b;\n\tchar buffer[FPM_LOG_BUFFER+1];\n\tint token, test;\n\tsize_t len, len2;\n\tstruct fpm_scoreboard_proc_s proc, *proc_p;\n\tstruct fpm_scoreboard_s *scoreboard;\n\tchar tmp[129];\n\tchar format[129];\n\ttime_t now_epoch;\n#ifdef HAVE_TIMES\n\tclock_t tms_total;\n#endif\n\n\tif (!log_format && (!fpm_log_format || fpm_log_fd == -1)) {\n\t\treturn -1;\n\t}\n\n\tif (!log_format) {\n\t\tlog_format = fpm_log_format;\n\t\ttest = 0;\n\t} else {\n\t\ttest = 1;\n\t}\n\n\tnow_epoch = time(NULL);\n\n\tif (!test) {\n\t\tscoreboard = fpm_scoreboard_get();\n\t\tif (!scoreboard) {\n\t\t\tzlog(ZLOG_WARNING, \"unable to get scoreboard while preparing the access log\");\n\t\t\treturn -1;\n\t\t}\n\t\tproc_p = fpm_scoreboard_proc_acquire(NULL, -1, 0);\n\t\tif (!proc_p) {\n\t\t\tzlog(ZLOG_WARNING, \"[pool %s] Unable to acquire shm slot while preparing the access log\", scoreboard->pool);\n\t\t\treturn -1;\n\t\t}\n\t\tproc = *proc_p;\n\t\tfpm_scoreboard_proc_release(proc_p);\n\t}\n\n\ttoken = 0;\n\n\tmemset(buffer, '\\0', sizeof(buffer));\n\tb = buffer;\n\tlen = 0;\n\n\n\ts = log_format;\n\n\twhile (*s != '\\0') {\n\t\t/* Test is we have place for 1 more char. */\n\t\tif (len >= FPM_LOG_BUFFER) {\n\t\t\tzlog(ZLOG_NOTICE, \"the log buffer is full (%d). The access log request has been truncated.\", FPM_LOG_BUFFER);\n\t\t\tlen = FPM_LOG_BUFFER;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (!token && *s == '%') {\n\t\t\ttoken = 1;\n\t\t\tmemset(format, '\\0', sizeof(format)); /* reset format */\n\t\t\ts++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (token) {\n\t\t\ttoken = 0;\n\t\t\tlen2 = 0;\n\t\t\tswitch (*s) {\n\n\t\t\t\tcase '%': /* '%' */\n\t\t\t\t\t*b = '%';\n\t\t\t\t\tlen2 = 1;\n\t\t\t\t\tbreak;\n\n#ifdef HAVE_TIMES\n\t\t\t\tcase 'C': /* %CPU */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"total\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_utime + proc.last_request_cpu.tms_stime + proc.last_request_cpu.tms_cutime + proc.last_request_cpu.tms_cstime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!strcasecmp(format, \"user\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_utime + proc.last_request_cpu.tms_cutime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!strcasecmp(format, \"system\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_stime + proc.last_request_cpu.tms_cstime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'total', 'user' or 'system' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.2f\", tms_total / fpm_scoreboard_get_tick() / (proc.cpu_duration.tv_sec + proc.cpu_duration.tv_usec / 1000000.) * 100.);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n#endif\n\n\t\t\t\tcase 'd': /* duration µs */\n\t\t\t\t\t/* seconds */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"seconds\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.3f\", proc.duration.tv_sec + proc.duration.tv_usec / 1000000.);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* miliseconds */\n\t\t\t\t\t} else if (!strcasecmp(format, \"miliseconds\") || !strcasecmp(format, \"mili\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.3f\", proc.duration.tv_sec * 1000. + proc.duration.tv_usec / 1000.);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* microseconds */\n\t\t\t\t\t} else if (!strcasecmp(format, \"microseconds\") || !strcasecmp(format, \"micro\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.duration.tv_sec * 1000000UL + proc.duration.tv_usec);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'seconds', 'mili', 'miliseconds', 'micro' or 'microseconds' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'e': /* fastcgi env */\n\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"the name of the environment variable must be set between embraces for %%%c\", *s);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tchar *env = fcgi_getenv((fcgi_request*) SG(server_context), format, strlen(format));\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", env ? env : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'f': /* script */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.script_filename ? proc.script_filename : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'l': /* content length */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%zu\", proc.content_length);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'm': /* method */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.request_method ? proc.request_method : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'M': /* memory */\n\t\t\t\t\t/* seconds */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"bytes\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%zu\", proc.memory);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* kilobytes */\n\t\t\t\t\t} else if (!strcasecmp(format, \"kilobytes\") || !strcasecmp(format, \"kilo\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.memory / 1024);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* megabytes */\n\t\t\t\t\t} else if (!strcasecmp(format, \"megabytes\") || !strcasecmp(format, \"mega\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.memory / 1024 / 1024);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'bytes', 'kilo', 'kilobytes', 'mega' or 'megabytes' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'n': /* pool name */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", scoreboard->pool[0] ? scoreboard->pool : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'o': /* header output */\n\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"the name of the header must be set between embraces for %%%c\", *s);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tsapi_header_struct *h;\n\t\t\t\t\t\tzend_llist_position pos;\n\t\t\t\t\t\tsapi_headers_struct *sapi_headers = &SG(sapi_headers);\n\t\t\t\t\t\tsize_t format_len = strlen(format);\n\n\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_first_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\twhile (h) {\n\t\t\t\t\t\t\tchar *header;\n\t\t\t\t\t\t\tif (!h->header_len) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!strstr(h->header, format)) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* test if enought char after the header name + ': ' */\n\t\t\t\t\t\t\tif (h->header_len <= format_len + 2) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (h->header[format_len] != ':' || h->header[format_len + 1] != ' ') {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\theader = h->header + format_len + 2;\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", header && *header ? header : \"-\");\n\n\t\t\t\t\t\t\t/* found, done */\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!len2) {\n\t\t\t\t\t\t\tlen2 = 1;\n\t\t\t\t\t\t\t*b = '-';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'p': /* PID */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%ld\", (long)getpid());\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'P': /* PID */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%ld\", (long)getppid());\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'q': /* query_string */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.query_string);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Q': /* '?' */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.query_string ? \"?\" : \"\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'r': /* request URI */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.request_uri);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'R': /* remote IP address */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tconst char *tmp = fcgi_get_last_client_ip();\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", tmp ? tmp : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 's': /* status */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%d\", SG(sapi_headers).http_response_code);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'T':\n\t\t\t\tcase 't': /* time */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\ttime_t *t;\n\t\t\t\t\t\tif (*s == 't') {\n\t\t\t\t\t\t\tt = &proc.accepted_epoch;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tt = &now_epoch;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\t\tstrftime(tmp, sizeof(tmp) - 1, \"%d/%b/%Y:%H:%M:%S %z\", localtime(t));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstrftime(tmp, sizeof(tmp) - 1, format, localtime(t));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", tmp);\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'u': /* remote user */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.auth_user);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase '{': /* complex var */\n\t\t\t\t\ttoken = 1;\n\t\t\t\t\t{\n\t\t\t\t\t\tchar *start;\n\t\t\t\t\t\tsize_t l;\n\n\t\t\t\t\t\tstart = ++s;\n\n\t\t\t\t\t\twhile (*s != '\\0') {\n\t\t\t\t\t\t\tif (*s == '}') {\n\t\t\t\t\t\t\t\tl = s - start;\n\n\t\t\t\t\t\t\t\tif (l >= sizeof(format) - 1) {\n\t\t\t\t\t\t\t\t\tl = sizeof(format) - 1;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tmemcpy(format, start, l);\n\t\t\t\t\t\t\t\tformat[l] = '\\0';\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ts++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (s[1] == '\\0') {\n\t\t\t\t\t\t\tzlog(ZLOG_WARNING, \"missing closing embrace in the access.format\");\n\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tzlog(ZLOG_WARNING, \"Invalid token in the access.format (%%%c)\", *s);\n\t\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\tif (*s != '}' && format[0] != '\\0') {\n\t\t\t\tzlog(ZLOG_WARNING, \"embrace is not allowed for modifier %%%c\", *s);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ts++;\n\t\t\tif (!test) {\n\t\t\t\tb += len2;\n\t\t\t\tlen += len2;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!test) {\n\t\t\t// push the normal char to the output buffer\n\t\t\t*b = *s;\n\t\t\tb++;\n\t\t\tlen++;\n\t\t}\n\t\ts++;\n\t}\n\n\tif (!test && strlen(buffer) > 0) {\n\t\tbuffer[len] = '\\n';\n\t\twrite(fpm_log_fd, buffer, len + 1);\n\t}\n\n\treturn 0;\n}","target":"int fpm_log_write(char *log_format) /* {{{ */\n{\n\tchar *s, *b;\n\tchar buffer[FPM_LOG_BUFFER+1];\n\tint token, test;\n\tsize_t len, len2;\n\tstruct fpm_scoreboard_proc_s proc, *proc_p;\n\tstruct fpm_scoreboard_s *scoreboard;\n\tchar tmp[129];\n\tchar format[129];\n\ttime_t now_epoch;\n#ifdef HAVE_TIMES\n\tclock_t tms_total;\n#endif\n\n\tif (!log_format && (!fpm_log_format || fpm_log_fd == -1)) {\n\t\treturn -1;\n\t}\n\n\tif (!log_format) {\n\t\tlog_format = fpm_log_format;\n\t\ttest = 0;\n\t} else {\n\t\ttest = 1;\n\t}\n\n\tnow_epoch = time(NULL);\n\n\tif (!test) {\n\t\tscoreboard = fpm_scoreboard_get();\n\t\tif (!scoreboard) {\n\t\t\tzlog(ZLOG_WARNING, \"unable to get scoreboard while preparing the access log\");\n\t\t\treturn -1;\n\t\t}\n\t\tproc_p = fpm_scoreboard_proc_acquire(NULL, -1, 0);\n\t\tif (!proc_p) {\n\t\t\tzlog(ZLOG_WARNING, \"[pool %s] Unable to acquire shm slot while preparing the access log\", scoreboard->pool);\n\t\t\treturn -1;\n\t\t}\n\t\tproc = *proc_p;\n\t\tfpm_scoreboard_proc_release(proc_p);\n\t}\n\n\ttoken = 0;\n\n\tmemset(buffer, '\\0', sizeof(buffer));\n\tb = buffer;\n\tlen = 0;\n\n\n\ts = log_format;\n\n\twhile (*s != '\\0') {\n\t\t/* Test is we have place for 1 more char. */\n\t\tif (len >= FPM_LOG_BUFFER) {\n\t\t\tzlog(ZLOG_NOTICE, \"the log buffer is full (%d). The access log request has been truncated.\", FPM_LOG_BUFFER);\n\t\t\tlen = FPM_LOG_BUFFER;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (!token && *s == '%') {\n\t\t\ttoken = 1;\n\t\t\tmemset(format, '\\0', sizeof(format)); /* reset format */\n\t\t\ts++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (token) {\n\t\t\ttoken = 0;\n\t\t\tlen2 = 0;\n\t\t\tswitch (*s) {\n\n\t\t\t\tcase '%': /* '%' */\n\t\t\t\t\t*b = '%';\n\t\t\t\t\tlen2 = 1;\n\t\t\t\t\tbreak;\n\n#ifdef HAVE_TIMES\n\t\t\t\tcase 'C': /* %CPU */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"total\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_utime + proc.last_request_cpu.tms_stime + proc.last_request_cpu.tms_cutime + proc.last_request_cpu.tms_cstime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!strcasecmp(format, \"user\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_utime + proc.last_request_cpu.tms_cutime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!strcasecmp(format, \"system\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\ttms_total = proc.last_request_cpu.tms_stime + proc.last_request_cpu.tms_cstime;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'total', 'user' or 'system' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.2f\", tms_total / fpm_scoreboard_get_tick() / (proc.cpu_duration.tv_sec + proc.cpu_duration.tv_usec / 1000000.) * 100.);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n#endif\n\n\t\t\t\tcase 'd': /* duration µs */\n\t\t\t\t\t/* seconds */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"seconds\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.3f\", proc.duration.tv_sec + proc.duration.tv_usec / 1000000.);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* miliseconds */\n\t\t\t\t\t} else if (!strcasecmp(format, \"miliseconds\") || !strcasecmp(format, \"mili\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%.3f\", proc.duration.tv_sec * 1000. + proc.duration.tv_usec / 1000.);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* microseconds */\n\t\t\t\t\t} else if (!strcasecmp(format, \"microseconds\") || !strcasecmp(format, \"micro\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.duration.tv_sec * 1000000UL + proc.duration.tv_usec);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'seconds', 'mili', 'miliseconds', 'micro' or 'microseconds' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'e': /* fastcgi env */\n\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"the name of the environment variable must be set between embraces for %%%c\", *s);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tchar *env = fcgi_getenv((fcgi_request*) SG(server_context), format, strlen(format));\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", env ? env : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'f': /* script */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.script_filename ? proc.script_filename : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'l': /* content length */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%zu\", proc.content_length);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'm': /* method */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.request_method ? proc.request_method : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'M': /* memory */\n\t\t\t\t\t/* seconds */\n\t\t\t\t\tif (format[0] == '\\0' || !strcasecmp(format, \"bytes\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%zu\", proc.memory);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* kilobytes */\n\t\t\t\t\t} else if (!strcasecmp(format, \"kilobytes\") || !strcasecmp(format, \"kilo\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.memory / 1024);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t/* megabytes */\n\t\t\t\t\t} else if (!strcasecmp(format, \"megabytes\") || !strcasecmp(format, \"mega\")) {\n\t\t\t\t\t\tif (!test) {\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%lu\", proc.memory / 1024 / 1024);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"only 'bytes', 'kilo', 'kilobytes', 'mega' or 'megabytes' are allowed as a modifier for %%%c ('%s')\", *s, format);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'n': /* pool name */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", scoreboard->pool[0] ? scoreboard->pool : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'o': /* header output */\n\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\tzlog(ZLOG_WARNING, \"the name of the header must be set between embraces for %%%c\", *s);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tsapi_header_struct *h;\n\t\t\t\t\t\tzend_llist_position pos;\n\t\t\t\t\t\tsapi_headers_struct *sapi_headers = &SG(sapi_headers);\n\t\t\t\t\t\tsize_t format_len = strlen(format);\n\n\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_first_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\twhile (h) {\n\t\t\t\t\t\t\tchar *header;\n\t\t\t\t\t\t\tif (!h->header_len) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!strstr(h->header, format)) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* test if enought char after the header name + ': ' */\n\t\t\t\t\t\t\tif (h->header_len <= format_len + 2) {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (h->header[format_len] != ':' || h->header[format_len + 1] != ' ') {\n\t\t\t\t\t\t\t\th = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\theader = h->header + format_len + 2;\n\t\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", header && *header ? header : \"-\");\n\n\t\t\t\t\t\t\t/* found, done */\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!len2) {\n\t\t\t\t\t\t\tlen2 = 1;\n\t\t\t\t\t\t\t*b = '-';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'p': /* PID */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%ld\", (long)getpid());\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'P': /* PID */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%ld\", (long)getppid());\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'q': /* query_string */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.query_string);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Q': /* '?' */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", *proc.query_string ? \"?\" : \"\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'r': /* request URI */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.request_uri);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'R': /* remote IP address */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tconst char *tmp = fcgi_get_last_client_ip();\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", tmp ? tmp : \"-\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 's': /* status */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%d\", SG(sapi_headers).http_response_code);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'T':\n\t\t\t\tcase 't': /* time */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\ttime_t *t;\n\t\t\t\t\t\tif (*s == 't') {\n\t\t\t\t\t\t\tt = &proc.accepted_epoch;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tt = &now_epoch;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (format[0] == '\\0') {\n\t\t\t\t\t\t\tstrftime(tmp, sizeof(tmp) - 1, \"%d/%b/%Y:%H:%M:%S %z\", localtime(t));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstrftime(tmp, sizeof(tmp) - 1, format, localtime(t));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", tmp);\n\t\t\t\t\t}\n\t\t\t\t\tformat[0] = '\\0';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'u': /* remote user */\n\t\t\t\t\tif (!test) {\n\t\t\t\t\t\tlen2 = snprintf(b, FPM_LOG_BUFFER - len, \"%s\", proc.auth_user);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase '{': /* complex var */\n\t\t\t\t\ttoken = 1;\n\t\t\t\t\t{\n\t\t\t\t\t\tchar *start;\n\t\t\t\t\t\tsize_t l;\n\n\t\t\t\t\t\tstart = ++s;\n\n\t\t\t\t\t\twhile (*s != '\\0') {\n\t\t\t\t\t\t\tif (*s == '}') {\n\t\t\t\t\t\t\t\tl = s - start;\n\n\t\t\t\t\t\t\t\tif (l >= sizeof(format) - 1) {\n\t\t\t\t\t\t\t\t\tl = sizeof(format) - 1;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tmemcpy(format, start, l);\n\t\t\t\t\t\t\t\tformat[l] = '\\0';\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ts++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (s[1] == '\\0') {\n\t\t\t\t\t\t\tzlog(ZLOG_WARNING, \"missing closing embrace in the access.format\");\n\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tzlog(ZLOG_WARNING, \"Invalid token in the access.format (%%%c)\", *s);\n\t\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\tif (*s != '}' && format[0] != '\\0') {\n\t\t\t\tzlog(ZLOG_WARNING, \"embrace is not allowed for modifier %%%c\", *s);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ts++;\n\t\t\tif (!test) {\n\t\t\t\tb += len2;\n\t\t\t\tlen += len2;\n\t\t\t}\n\t\t\tif (len >= FPM_LOG_BUFFER) {\n\t\t\t\tzlog(ZLOG_NOTICE, \"the log buffer is full (%d). The access log request has been truncated.\", FPM_LOG_BUFFER);\n\t\t\t\tlen = FPM_LOG_BUFFER;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!test) {\n\t\t\t// push the normal char to the output buffer\n\t\t\t*b = *s;\n\t\t\tb++;\n\t\t\tlen++;\n\t\t}\n\t\ts++;\n\t}\n\n\tif (!test && strlen(buffer) > 0) {\n\t\tbuffer[len] = '\\n';\n\t\twrite(fpm_log_fd, buffer, len + 1);\n\t}\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"fpm_log_write","file_name":"sapi/fpm/fpm/fpm_log.c","commit_link":"github.com/php/php-src/commit/2721a0148649e07ed74468f097a28899741eb58f","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#88-fa55fc6ea7ab","input":"static MagickBooleanType load_tile(Image *image,Image *tile_image,\n XCFDocInfo *inDocInfo,XCFLayerInfo *inLayerInfo,size_t data_length,\n ExceptionInfo *exception)\n{\n ssize_t\n y;\n\n register ssize_t\n x;\n\n register Quantum\n *q;\n\n ssize_t\n count;\n\n unsigned char\n *graydata;\n\n XCFPixelInfo\n *xcfdata,\n *xcfodata;\n\n xcfdata=(XCFPixelInfo *) AcquireQuantumMemory(data_length,sizeof(*xcfdata));\n if (xcfdata == (XCFPixelInfo *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n xcfodata=xcfdata;\n graydata=(unsigned char *) xcfdata; /* used by gray and indexed */\n count=ReadBlob(image,data_length,(unsigned char *) xcfdata);\n if (count != (ssize_t) data_length)\n ThrowBinaryException(CorruptImageError,\"NotEnoughPixelData\",\n image->filename);\n for (y=0; y < (ssize_t) tile_image->rows; y++)\n {\n q=GetAuthenticPixels(tile_image,0,y,tile_image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n if (inDocInfo->image_type == GIMP_GRAY)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelGray(tile_image,ScaleCharToQuantum(*graydata),q);\n SetPixelAlpha(tile_image,ScaleCharToQuantum((unsigned char)\n inLayerInfo->alpha),q);\n graydata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n else\n if (inDocInfo->image_type == GIMP_RGB)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelRed(tile_image,ScaleCharToQuantum(xcfdata->red),q);\n SetPixelGreen(tile_image,ScaleCharToQuantum(xcfdata->green),q);\n SetPixelBlue(tile_image,ScaleCharToQuantum(xcfdata->blue),q);\n SetPixelAlpha(tile_image,xcfdata->alpha == 255U ? TransparentAlpha :\n ScaleCharToQuantum((unsigned char) inLayerInfo->alpha),q);\n xcfdata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n if (SyncAuthenticPixels(tile_image,exception) == MagickFalse)\n break;\n }\n xcfodata=(XCFPixelInfo *) RelinquishMagickMemory(xcfodata);\n return MagickTrue;\n}","target":"static MagickBooleanType load_tile(Image *image,Image *tile_image,\n XCFDocInfo *inDocInfo,XCFLayerInfo *inLayerInfo,size_t data_length,\n ExceptionInfo *exception)\n{\n ssize_t\n y;\n\n register ssize_t\n x;\n\n register Quantum\n *q;\n\n ssize_t\n count;\n\n unsigned char\n *graydata;\n\n XCFPixelInfo\n *xcfdata,\n *xcfodata;\n\n xcfdata=(XCFPixelInfo *) AcquireQuantumMemory(MagickMax(data_length,\n tile_image->columns*tile_image->rows),sizeof(*xcfdata));\n if (xcfdata == (XCFPixelInfo *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n xcfodata=xcfdata;\n graydata=(unsigned char *) xcfdata; /* used by gray and indexed */\n count=ReadBlob(image,data_length,(unsigned char *) xcfdata);\n if (count != (ssize_t) data_length)\n ThrowBinaryException(CorruptImageError,\"NotEnoughPixelData\",\n image->filename);\n for (y=0; y < (ssize_t) tile_image->rows; y++)\n {\n q=GetAuthenticPixels(tile_image,0,y,tile_image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n if (inDocInfo->image_type == GIMP_GRAY)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelGray(tile_image,ScaleCharToQuantum(*graydata),q);\n SetPixelAlpha(tile_image,ScaleCharToQuantum((unsigned char)\n inLayerInfo->alpha),q);\n graydata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n else\n if (inDocInfo->image_type == GIMP_RGB)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelRed(tile_image,ScaleCharToQuantum(xcfdata->red),q);\n SetPixelGreen(tile_image,ScaleCharToQuantum(xcfdata->green),q);\n SetPixelBlue(tile_image,ScaleCharToQuantum(xcfdata->blue),q);\n SetPixelAlpha(tile_image,xcfdata->alpha == 255U ? TransparentAlpha :\n ScaleCharToQuantum((unsigned char) inLayerInfo->alpha),q);\n xcfdata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n if (SyncAuthenticPixels(tile_image,exception) == MagickFalse)\n break;\n }\n xcfodata=(XCFPixelInfo *) RelinquishMagickMemory(xcfodata);\n return MagickTrue;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"load_tile","file_name":"coders/xcf.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/a2e1064f288a353bc5fef7f79ccb7683759e775c","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#89-1c8704e60590","input":"static void hid_input_field(struct hid_device *hid, struct hid_field *field,\n\t\t\t __u8 *data, int interrupt)\n{\n\tunsigned n;\n\tunsigned count = field->report_count;\n\tunsigned offset = field->report_offset;\n\tunsigned size = field->report_size;\n\t__s32 min = field->logical_minimum;\n\t__s32 max = field->logical_maximum;\n\t__s32 *value;\n\n\tvalue = kmalloc(sizeof(__s32) * count, GFP_ATOMIC);\n\tif (!value)\n\t\treturn;\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tvalue[n] = min < 0 ?\n\t\t\tsnto32(hid_field_extract(hid, data, offset + n * size,\n\t\t\t size), size) :\n\t\t\thid_field_extract(hid, data, offset + n * size, size);\n\n\t\t/* Ignore report if ErrorRollOver */\n\t\tif (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&\n\t\t value[n] >= min && value[n] <= max &&\n\t\t field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)\n\t\t\tgoto exit;\n\t}\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tif (HID_MAIN_ITEM_VARIABLE & field->flags) {\n\t\t\thid_process_event(hid, field, &field->usage[n], value[n], interrupt);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (field->value[n] >= min && field->value[n] <= max\n\t\t\t&& field->usage[field->value[n] - min].hid\n\t\t\t&& search(value, field->value[n], count))\n\t\t\t\thid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);\n\n\t\tif (value[n] >= min && value[n] <= max\n\t\t\t&& field->usage[value[n] - min].hid\n\t\t\t&& search(field->value, value[n], count))\n\t\t\t\thid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);\n\t}\n\n\tmemcpy(field->value, value, count * sizeof(__s32));\nexit:\n\tkfree(value);\n}","target":"static void hid_input_field(struct hid_device *hid, struct hid_field *field,\n\t\t\t __u8 *data, int interrupt)\n{\n\tunsigned n;\n\tunsigned count = field->report_count;\n\tunsigned offset = field->report_offset;\n\tunsigned size = field->report_size;\n\t__s32 min = field->logical_minimum;\n\t__s32 max = field->logical_maximum;\n\t__s32 *value;\n\n\tvalue = kmalloc(sizeof(__s32) * count, GFP_ATOMIC);\n\tif (!value)\n\t\treturn;\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tvalue[n] = min < 0 ?\n\t\t\tsnto32(hid_field_extract(hid, data, offset + n * size,\n\t\t\t size), size) :\n\t\t\thid_field_extract(hid, data, offset + n * size, size);\n\n\t\t/* Ignore report if ErrorRollOver */\n\t\tif (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&\n\t\t value[n] >= min && value[n] <= max &&\n\t\t value[n] - min < field->maxusage &&\n\t\t field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)\n\t\t\tgoto exit;\n\t}\n\n\tfor (n = 0; n < count; n++) {\n\n\t\tif (HID_MAIN_ITEM_VARIABLE & field->flags) {\n\t\t\thid_process_event(hid, field, &field->usage[n], value[n], interrupt);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (field->value[n] >= min && field->value[n] <= max\n\t\t\t&& field->value[n] - min < field->maxusage\n\t\t\t&& field->usage[field->value[n] - min].hid\n\t\t\t&& search(value, field->value[n], count))\n\t\t\t\thid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt);\n\n\t\tif (value[n] >= min && value[n] <= max\n\t\t\t&& value[n] - min < field->maxusage\n\t\t\t&& field->usage[value[n] - min].hid\n\t\t\t&& search(field->value, value[n], count))\n\t\t\t\thid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt);\n\t}\n\n\tmemcpy(field->value, value, count * sizeof(__s32));\nexit:\n\tkfree(value);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"hid_input_field","file_name":"drivers/hid/hid-core.c","commit_link":"github.com/torvalds/linux/commit/50220dead1650609206efe91f0cc116132d59b3f","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#90-413ecd8e4ae5","input":"static void gmc_mmx(uint8_t *dst, uint8_t *src,\n int stride, int h, int ox, int oy,\n int dxx, int dxy, int dyx, int dyy,\n int shift, int r, int width, int height)\n{\n const int w = 8;\n const int ix = ox >> (16 + shift);\n const int iy = oy >> (16 + shift);\n const int oxs = ox >> 4;\n const int oys = oy >> 4;\n const int dxxs = dxx >> 4;\n const int dxys = dxy >> 4;\n const int dyxs = dyx >> 4;\n const int dyys = dyy >> 4;\n const uint16_t r4[4] = { r, r, r, r };\n const uint16_t dxy4[4] = { dxys, dxys, dxys, dxys };\n const uint16_t dyy4[4] = { dyys, dyys, dyys, dyys };\n const uint64_t shift2 = 2 * shift;\n#define MAX_STRIDE 4096U\n#define MAX_H 8U\n uint8_t edge_buf[(MAX_H + 1) * MAX_STRIDE];\n int x, y;\n\n const int dxw = (dxx - (1 << (16 + shift))) * (w - 1);\n const int dyh = (dyy - (1 << (16 + shift))) * (h - 1);\n const int dxh = dxy * (h - 1);\n const int dyw = dyx * (w - 1);\n int need_emu = (unsigned) ix >= width - w ||\n (unsigned) iy >= height - h;\n\n if ( // non-constant fullpel offset (3% of blocks)\n ((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) |\n (oy ^ (oy + dyw)) | (oy ^ (oy + dyh)) | (oy ^ (oy + dyw + dyh))) >> (16 + shift) ||\n // uses more than 16 bits of subpel mv (only at huge resolution)\n (dxx | dxy | dyx | dyy) & 15 ||\n (need_emu && (h > MAX_H || stride > MAX_STRIDE))) {\n // FIXME could still use mmx for some of the rows\n ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy,\n shift, r, width, height);\n return;\n }\n\n src += ix + iy * stride;\n if (need_emu) {\n ff_emulated_edge_mc_8(edge_buf, src, stride, stride, w + 1, h + 1, ix, iy, width, height);\n src = edge_buf;\n }\n\n __asm__ volatile (\n \"movd %0, %%mm6 \\n\\t\"\n \"pxor %%mm7, %%mm7 \\n\\t\"\n \"punpcklwd %%mm6, %%mm6 \\n\\t\"\n \"punpcklwd %%mm6, %%mm6 \\n\\t\"\n :: \"r\" (1 << shift));\n\n for (x = 0; x < w; x += 4) {\n uint16_t dx4[4] = { oxs - dxys + dxxs * (x + 0),\n oxs - dxys + dxxs * (x + 1),\n oxs - dxys + dxxs * (x + 2),\n oxs - dxys + dxxs * (x + 3) };\n uint16_t dy4[4] = { oys - dyys + dyxs * (x + 0),\n oys - dyys + dyxs * (x + 1),\n oys - dyys + dyxs * (x + 2),\n oys - dyys + dyxs * (x + 3) };\n\n for (y = 0; y < h; y++) {\n __asm__ volatile (\n \"movq %0, %%mm4 \\n\\t\"\n \"movq %1, %%mm5 \\n\\t\"\n \"paddw %2, %%mm4 \\n\\t\"\n \"paddw %3, %%mm5 \\n\\t\"\n \"movq %%mm4, %0 \\n\\t\"\n \"movq %%mm5, %1 \\n\\t\"\n \"psrlw $12, %%mm4 \\n\\t\"\n \"psrlw $12, %%mm5 \\n\\t\"\n : \"+m\" (*dx4), \"+m\" (*dy4)\n : \"m\" (*dxy4), \"m\" (*dyy4));\n\n __asm__ volatile (\n \"movq %%mm6, %%mm2 \\n\\t\"\n \"movq %%mm6, %%mm1 \\n\\t\"\n \"psubw %%mm4, %%mm2 \\n\\t\"\n \"psubw %%mm5, %%mm1 \\n\\t\"\n \"movq %%mm2, %%mm0 \\n\\t\"\n \"movq %%mm4, %%mm3 \\n\\t\"\n \"pmullw %%mm1, %%mm0 \\n\\t\" // (s - dx) * (s - dy)\n \"pmullw %%mm5, %%mm3 \\n\\t\" // dx * dy\n \"pmullw %%mm5, %%mm2 \\n\\t\" // (s - dx) * dy\n \"pmullw %%mm4, %%mm1 \\n\\t\" // dx * (s - dy)\n\n \"movd %4, %%mm5 \\n\\t\"\n \"movd %3, %%mm4 \\n\\t\"\n \"punpcklbw %%mm7, %%mm5 \\n\\t\"\n \"punpcklbw %%mm7, %%mm4 \\n\\t\"\n \"pmullw %%mm5, %%mm3 \\n\\t\" // src[1, 1] * dx * dy\n \"pmullw %%mm4, %%mm2 \\n\\t\" // src[0, 1] * (s - dx) * dy\n\n \"movd %2, %%mm5 \\n\\t\"\n \"movd %1, %%mm4 \\n\\t\"\n \"punpcklbw %%mm7, %%mm5 \\n\\t\"\n \"punpcklbw %%mm7, %%mm4 \\n\\t\"\n \"pmullw %%mm5, %%mm1 \\n\\t\" // src[1, 0] * dx * (s - dy)\n \"pmullw %%mm4, %%mm0 \\n\\t\" // src[0, 0] * (s - dx) * (s - dy)\n \"paddw %5, %%mm1 \\n\\t\"\n \"paddw %%mm3, %%mm2 \\n\\t\"\n \"paddw %%mm1, %%mm0 \\n\\t\"\n \"paddw %%mm2, %%mm0 \\n\\t\"\n\n \"psrlw %6, %%mm0 \\n\\t\"\n \"packuswb %%mm0, %%mm0 \\n\\t\"\n \"movd %%mm0, %0 \\n\\t\"\n\n : \"=m\" (dst[x + y * stride])\n : \"m\" (src[0]), \"m\" (src[1]),\n \"m\" (src[stride]), \"m\" (src[stride + 1]),\n \"m\" (*r4), \"m\" (shift2));\n src += stride;\n }\n src += 4 - h * stride;\n }\n}","target":"static void gmc_mmx(uint8_t *dst, uint8_t *src,\n int stride, int h, int ox, int oy,\n int dxx, int dxy, int dyx, int dyy,\n int shift, int r, int width, int height)\n{\n const int w = 8;\n const int ix = ox >> (16 + shift);\n const int iy = oy >> (16 + shift);\n const int oxs = ox >> 4;\n const int oys = oy >> 4;\n const int dxxs = dxx >> 4;\n const int dxys = dxy >> 4;\n const int dyxs = dyx >> 4;\n const int dyys = dyy >> 4;\n const uint16_t r4[4] = { r, r, r, r };\n const uint16_t dxy4[4] = { dxys, dxys, dxys, dxys };\n const uint16_t dyy4[4] = { dyys, dyys, dyys, dyys };\n const uint64_t shift2 = 2 * shift;\n#define MAX_STRIDE 4096U\n#define MAX_H 8U\n uint8_t edge_buf[(MAX_H + 1) * MAX_STRIDE];\n int x, y;\n\n const int dxw = (dxx - (1 << (16 + shift))) * (w - 1);\n const int dyh = (dyy - (1 << (16 + shift))) * (h - 1);\n const int dxh = dxy * (h - 1);\n const int dyw = dyx * (w - 1);\n int need_emu = (unsigned) ix >= width - w || width < w ||\n (unsigned) iy >= height - h || height< h\n ;\n\n if ( // non-constant fullpel offset (3% of blocks)\n ((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) |\n (oy ^ (oy + dyw)) | (oy ^ (oy + dyh)) | (oy ^ (oy + dyw + dyh))) >> (16 + shift) ||\n // uses more than 16 bits of subpel mv (only at huge resolution)\n (dxx | dxy | dyx | dyy) & 15 ||\n (need_emu && (h > MAX_H || stride > MAX_STRIDE))) {\n // FIXME could still use mmx for some of the rows\n ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy,\n shift, r, width, height);\n return;\n }\n\n src += ix + iy * stride;\n if (need_emu) {\n ff_emulated_edge_mc_8(edge_buf, src, stride, stride, w + 1, h + 1, ix, iy, width, height);\n src = edge_buf;\n }\n\n __asm__ volatile (\n \"movd %0, %%mm6 \\n\\t\"\n \"pxor %%mm7, %%mm7 \\n\\t\"\n \"punpcklwd %%mm6, %%mm6 \\n\\t\"\n \"punpcklwd %%mm6, %%mm6 \\n\\t\"\n :: \"r\" (1 << shift));\n\n for (x = 0; x < w; x += 4) {\n uint16_t dx4[4] = { oxs - dxys + dxxs * (x + 0),\n oxs - dxys + dxxs * (x + 1),\n oxs - dxys + dxxs * (x + 2),\n oxs - dxys + dxxs * (x + 3) };\n uint16_t dy4[4] = { oys - dyys + dyxs * (x + 0),\n oys - dyys + dyxs * (x + 1),\n oys - dyys + dyxs * (x + 2),\n oys - dyys + dyxs * (x + 3) };\n\n for (y = 0; y < h; y++) {\n __asm__ volatile (\n \"movq %0, %%mm4 \\n\\t\"\n \"movq %1, %%mm5 \\n\\t\"\n \"paddw %2, %%mm4 \\n\\t\"\n \"paddw %3, %%mm5 \\n\\t\"\n \"movq %%mm4, %0 \\n\\t\"\n \"movq %%mm5, %1 \\n\\t\"\n \"psrlw $12, %%mm4 \\n\\t\"\n \"psrlw $12, %%mm5 \\n\\t\"\n : \"+m\" (*dx4), \"+m\" (*dy4)\n : \"m\" (*dxy4), \"m\" (*dyy4));\n\n __asm__ volatile (\n \"movq %%mm6, %%mm2 \\n\\t\"\n \"movq %%mm6, %%mm1 \\n\\t\"\n \"psubw %%mm4, %%mm2 \\n\\t\"\n \"psubw %%mm5, %%mm1 \\n\\t\"\n \"movq %%mm2, %%mm0 \\n\\t\"\n \"movq %%mm4, %%mm3 \\n\\t\"\n \"pmullw %%mm1, %%mm0 \\n\\t\" // (s - dx) * (s - dy)\n \"pmullw %%mm5, %%mm3 \\n\\t\" // dx * dy\n \"pmullw %%mm5, %%mm2 \\n\\t\" // (s - dx) * dy\n \"pmullw %%mm4, %%mm1 \\n\\t\" // dx * (s - dy)\n\n \"movd %4, %%mm5 \\n\\t\"\n \"movd %3, %%mm4 \\n\\t\"\n \"punpcklbw %%mm7, %%mm5 \\n\\t\"\n \"punpcklbw %%mm7, %%mm4 \\n\\t\"\n \"pmullw %%mm5, %%mm3 \\n\\t\" // src[1, 1] * dx * dy\n \"pmullw %%mm4, %%mm2 \\n\\t\" // src[0, 1] * (s - dx) * dy\n\n \"movd %2, %%mm5 \\n\\t\"\n \"movd %1, %%mm4 \\n\\t\"\n \"punpcklbw %%mm7, %%mm5 \\n\\t\"\n \"punpcklbw %%mm7, %%mm4 \\n\\t\"\n \"pmullw %%mm5, %%mm1 \\n\\t\" // src[1, 0] * dx * (s - dy)\n \"pmullw %%mm4, %%mm0 \\n\\t\" // src[0, 0] * (s - dx) * (s - dy)\n \"paddw %5, %%mm1 \\n\\t\"\n \"paddw %%mm3, %%mm2 \\n\\t\"\n \"paddw %%mm1, %%mm0 \\n\\t\"\n \"paddw %%mm2, %%mm0 \\n\\t\"\n\n \"psrlw %6, %%mm0 \\n\\t\"\n \"packuswb %%mm0, %%mm0 \\n\\t\"\n \"movd %%mm0, %0 \\n\\t\"\n\n : \"=m\" (dst[x + y * stride])\n : \"m\" (src[0]), \"m\" (src[1]),\n \"m\" (src[stride]), \"m\" (src[stride + 1]),\n \"m\" (*r4), \"m\" (shift2));\n src += stride;\n }\n src += 4 - h * stride;\n }\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"gmc_mmx","file_name":"libavcodec/x86/mpegvideodsp.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/58cf31cee7a456057f337b3102a03206d833d5e8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#91-4163ff37aeef","input":"static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field)\n{\n#ifndef PB_ENABLE_MALLOC\n PB_UNUSED(wire_type);\n PB_UNUSED(field);\n PB_RETURN_ERROR(stream, \"no malloc support\");\n#else\n switch (PB_HTYPE(field->type))\n {\n case PB_HTYPE_REQUIRED:\n case PB_HTYPE_OPTIONAL:\n case PB_HTYPE_ONEOF:\n if (!check_wire_type(wire_type, field))\n PB_RETURN_ERROR(stream, \"wrong wire type\");\n\n if (PB_LTYPE_IS_SUBMSG(field->type) && *(void**)field->pField != NULL)\n {\n /* Duplicate field, have to release the old allocation first. */\n /* FIXME: Does this work correctly for oneofs? */\n pb_release_single_field(field);\n }\n \n if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)\n {\n *(pb_size_t*)field->pSize = field->tag;\n }\n\n if (PB_LTYPE(field->type) == PB_LTYPE_STRING ||\n PB_LTYPE(field->type) == PB_LTYPE_BYTES)\n {\n /* pb_dec_string and pb_dec_bytes handle allocation themselves */\n field->pData = field->pField;\n return decode_basic_field(stream, field);\n }\n else\n {\n if (!allocate_field(stream, field->pField, field->data_size, 1))\n return false;\n \n field->pData = *(void**)field->pField;\n initialize_pointer_field(field->pData, field);\n return decode_basic_field(stream, field);\n }\n \n case PB_HTYPE_REPEATED:\n if (wire_type == PB_WT_STRING\n && PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)\n {\n /* Packed array, multiple items come in at once. */\n bool status = true;\n pb_size_t *size = (pb_size_t*)field->pSize;\n size_t allocated_size = *size;\n pb_istream_t substream;\n \n if (!pb_make_string_substream(stream, &substream))\n return false;\n \n while (substream.bytes_left)\n {\n if ((size_t)*size + 1 > allocated_size)\n {\n /* Allocate more storage. This tries to guess the\n * number of remaining entries. Round the division\n * upwards. */\n allocated_size += (substream.bytes_left - 1) / field->data_size + 1;\n \n if (!allocate_field(&substream, field->pField, field->data_size, allocated_size))\n {\n status = false;\n break;\n }\n }\n\n /* Decode the array entry */\n field->pData = *(char**)field->pField + field->data_size * (*size);\n initialize_pointer_field(field->pData, field);\n if (!decode_basic_field(&substream, field))\n {\n status = false;\n break;\n }\n \n if (*size == PB_SIZE_MAX)\n {\n#ifndef PB_NO_ERRMSG\n stream->errmsg = \"too many array entries\";\n#endif\n status = false;\n break;\n }\n \n (*size)++;\n }\n if (!pb_close_string_substream(stream, &substream))\n return false;\n \n return status;\n }\n else\n {\n /* Normal repeated field, i.e. only one item at a time. */\n pb_size_t *size = (pb_size_t*)field->pSize;\n\n if (*size == PB_SIZE_MAX)\n PB_RETURN_ERROR(stream, \"too many array entries\");\n \n if (!check_wire_type(wire_type, field))\n PB_RETURN_ERROR(stream, \"wrong wire type\");\n\n (*size)++;\n if (!allocate_field(stream, field->pField, field->data_size, *size))\n return false;\n \n field->pData = *(char**)field->pField + field->data_size * (*size - 1);\n initialize_pointer_field(field->pData, field);\n return decode_basic_field(stream, field);\n }\n\n default:\n PB_RETURN_ERROR(stream, \"invalid field type\");\n }\n#endif\n}","target":"static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field)\n{\n#ifndef PB_ENABLE_MALLOC\n PB_UNUSED(wire_type);\n PB_UNUSED(field);\n PB_RETURN_ERROR(stream, \"no malloc support\");\n#else\n switch (PB_HTYPE(field->type))\n {\n case PB_HTYPE_REQUIRED:\n case PB_HTYPE_OPTIONAL:\n case PB_HTYPE_ONEOF:\n if (!check_wire_type(wire_type, field))\n PB_RETURN_ERROR(stream, \"wrong wire type\");\n\n if (PB_LTYPE_IS_SUBMSG(field->type) && *(void**)field->pField != NULL)\n {\n /* Duplicate field, have to release the old allocation first. */\n /* FIXME: Does this work correctly for oneofs? */\n pb_release_single_field(field);\n }\n \n if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)\n {\n *(pb_size_t*)field->pSize = field->tag;\n }\n\n if (PB_LTYPE(field->type) == PB_LTYPE_STRING ||\n PB_LTYPE(field->type) == PB_LTYPE_BYTES)\n {\n /* pb_dec_string and pb_dec_bytes handle allocation themselves */\n field->pData = field->pField;\n return decode_basic_field(stream, field);\n }\n else\n {\n if (!allocate_field(stream, field->pField, field->data_size, 1))\n return false;\n \n field->pData = *(void**)field->pField;\n initialize_pointer_field(field->pData, field);\n return decode_basic_field(stream, field);\n }\n \n case PB_HTYPE_REPEATED:\n if (wire_type == PB_WT_STRING\n && PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)\n {\n /* Packed array, multiple items come in at once. */\n bool status = true;\n pb_size_t *size = (pb_size_t*)field->pSize;\n size_t allocated_size = *size;\n pb_istream_t substream;\n \n if (!pb_make_string_substream(stream, &substream))\n return false;\n \n while (substream.bytes_left)\n {\n if ((size_t)*size + 1 > allocated_size)\n {\n /* Allocate more storage. This tries to guess the\n * number of remaining entries. Round the division\n * upwards. */\n allocated_size += (substream.bytes_left - 1) / field->data_size + 1;\n \n if (!allocate_field(&substream, field->pField, field->data_size, allocated_size))\n {\n status = false;\n break;\n }\n }\n\n /* Decode the array entry */\n field->pData = *(char**)field->pField + field->data_size * (*size);\n initialize_pointer_field(field->pData, field);\n if (!decode_basic_field(&substream, field))\n {\n status = false;\n break;\n }\n \n if (*size == PB_SIZE_MAX)\n {\n#ifndef PB_NO_ERRMSG\n stream->errmsg = \"too many array entries\";\n#endif\n status = false;\n break;\n }\n \n (*size)++;\n }\n if (!pb_close_string_substream(stream, &substream))\n return false;\n \n return status;\n }\n else\n {\n /* Normal repeated field, i.e. only one item at a time. */\n pb_size_t *size = (pb_size_t*)field->pSize;\n\n if (*size == PB_SIZE_MAX)\n PB_RETURN_ERROR(stream, \"too many array entries\");\n \n if (!check_wire_type(wire_type, field))\n PB_RETURN_ERROR(stream, \"wrong wire type\");\n\n if (!allocate_field(stream, field->pField, field->data_size, (size_t)(*size + 1)))\n return false;\n \n field->pData = *(char**)field->pField + field->data_size * (*size);\n (*size)++;\n initialize_pointer_field(field->pData, field);\n return decode_basic_field(stream, field);\n }\n\n default:\n PB_RETURN_ERROR(stream, \"invalid field type\");\n }\n#endif\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"decode_pointer_field","file_name":"pb_decode.c","commit_link":"github.com/nanopb/nanopb/commit/45582f1f97f49e2abfdba1463d1e1027682d9856","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#92-e593eca4b9a7","input":"ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t bytes)\n{\n UINT8* ptr;\n int framesize;\n int c, chunks, advance;\n int l, lines;\n int i, j, x = 0, y, ymax;\n\n /* If not even the chunk size is present, we'd better leave */\n\n if (bytes < 4)\n\treturn 0;\n\n /* We don't decode anything unless we have a full chunk in the\n input buffer (on the other hand, the Python part of the driver\n makes sure this is always the case) */\n\n ptr = buf;\n\n framesize = I32(ptr);\n if (framesize < I32(ptr))\n\treturn 0;\n\n /* Make sure this is a frame chunk. The Python driver takes\n case of other chunk types. */\n\n if (I16(ptr+4) != 0xF1FA) {\n\tstate->errcode = IMAGING_CODEC_UNKNOWN;\n\treturn -1;\n }\n\n chunks = I16(ptr+6);\n ptr += 16;\n bytes -= 16;\n\n /* Process subchunks */\n for (c = 0; c < chunks; c++) {\n\tUINT8* data;\n\tif (bytes < 10) {\n\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t return -1;\n\t}\n\tdata = ptr + 6;\n\tswitch (I16(ptr+4)) {\n\tcase 4: case 11:\n\t /* FLI COLOR chunk */\n\t break; /* ignored; handled by Python code */\n\tcase 7:\n\t /* FLI SS2 chunk (word delta) */\n\t lines = I16(data); data += 2;\n\t for (l = y = 0; l < lines && y < state->ysize; l++, y++) {\n\t\tUINT8* buf = (UINT8*) im->image[y];\n\t\tint p, packets;\n\t\tpackets = I16(data); data += 2;\n\t\twhile (packets & 0x8000) {\n\t\t /* flag word */\n\t\t if (packets & 0x4000) {\n\t\t\ty += 65536 - packets; /* skip lines */\n\t\t\tif (y >= state->ysize) {\n\t\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t\t return -1;\n\t\t\t}\n\t\t\tbuf = (UINT8*) im->image[y];\n\t\t } else {\n\t\t\t/* store last byte (used if line width is odd) */\n\t\t\tbuf[state->xsize-1] = (UINT8) packets;\n\t\t }\n\t\t packets = I16(data); data += 2;\n\t\t}\n\t\tfor (p = x = 0; p < packets; p++) {\n\t\t x += data[0]; /* pixel skip */\n\t\t if (data[1] >= 128) {\n\t\t\ti = 256-data[1]; /* run */\n\t\t\tif (x + i + i > state->xsize)\n\t\t\t break;\n\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t buf[x++] = data[2];\n\t\t\t buf[x++] = data[3];\n\t\t\t}\n\t\t\tdata += 2 + 2;\n\t\t } else {\n\t\t\ti = 2 * (int) data[1]; /* chunk */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemcpy(buf + x, data + 2, i);\n\t\t\tdata += 2 + i;\n\t\t\tx += i;\n\t\t }\n\t\t}\n\t\tif (p < packets)\n\t\t break; /* didn't process all packets */\n\t }\n\t if (l < lines) {\n\t\t/* didn't process all lines */\n\t\tstate->errcode = IMAGING_CODEC_OVERRUN;\n\t\treturn -1;\n\t }\n\t break;\n\tcase 12:\n\t /* FLI LC chunk (byte delta) */\n\t y = I16(data); ymax = y + I16(data+2); data += 4;\n\t for (; y < ymax && y < state->ysize; y++) {\n\t\tUINT8* out = (UINT8*) im->image[y];\n\t\tint p, packets = *data++;\n\t\tfor (p = x = 0; p < packets; p++, x += i) {\n\t\t x += data[0]; /* skip pixels */\n\t\t if (data[1] & 0x80) {\n\t\t\ti = 256-data[1]; /* run */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemset(out + x, data[2], i);\n\t\t\tdata += 3;\n\t\t } else {\n\t\t\ti = data[1]; /* chunk */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemcpy(out + x, data + 2, i);\n\t\t\tdata += i + 2;\n\t\t }\n\t\t}\n\t\tif (p < packets)\n\t\t break; /* didn't process all packets */\n\t }\n\t if (y < ymax) {\n\t\t/* didn't process all lines */\n\t\tstate->errcode = IMAGING_CODEC_OVERRUN;\n\t\treturn -1;\n\t }\n\t break;\n\tcase 13:\n\t /* FLI BLACK chunk */\n\t for (y = 0; y < state->ysize; y++)\n\t\tmemset(im->image[y], 0, state->xsize);\n\t break;\n\tcase 15:\n\t /* FLI BRUN chunk */\n\t for (y = 0; y < state->ysize; y++) {\n\t\tUINT8* out = (UINT8*) im->image[y];\n\t\tdata += 1; /* ignore packetcount byte */\n\t\tfor (x = 0; x < state->xsize; x += i) {\n\t\t if (data[0] & 0x80) {\n\t\t\ti = 256 - data[0];\n\t\t\tif (x + i > state->xsize)\n\t\t\t break; /* safety first */\n\t\t\tmemcpy(out + x, data + 1, i);\n\t\t\tdata += i + 1;\n\t\t } else {\n\t\t\ti = data[0];\n\t\t\tif (x + i > state->xsize)\n\t\t\t break; /* safety first */\n\t\t\tmemset(out + x, data[1], i);\n\t\t\tdata += 2;\n\t\t }\n\t\t}\n\t\tif (x != state->xsize) {\n\t\t /* didn't unpack whole line */\n\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t return -1;\n\t\t}\n\t }\n\t break;\n\tcase 16:\n\t /* COPY chunk */\n\t for (y = 0; y < state->ysize; y++) {\n\t\tUINT8* buf = (UINT8*) im->image[y];\n\t\tmemcpy(buf, data, state->xsize);\n\t\tdata += state->xsize;\n\t }\n\t break;\n\tcase 18:\n\t /* PSTAMP chunk */\n\t break; /* ignored */\n\tdefault:\n\t /* unknown chunk */\n\t /* printf(\"unknown FLI/FLC chunk: %d\\n\", I16(ptr+4)); */\n\t state->errcode = IMAGING_CODEC_UNKNOWN;\n\t return -1;\n\t}\n\tadvance = I32(ptr);\n\tptr += advance;\n\tbytes -= advance;\n }\n\n return -1; /* end of frame */\n}","target":"ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8* buf, Py_ssize_t bytes)\n{\n UINT8* ptr;\n int framesize;\n int c, chunks, advance;\n int l, lines;\n int i, j, x = 0, y, ymax;\n\n /* If not even the chunk size is present, we'd better leave */\n\n if (bytes < 4)\n\treturn 0;\n\n /* We don't decode anything unless we have a full chunk in the\n input buffer */\n\n ptr = buf;\n\n framesize = I32(ptr);\n if (framesize < I32(ptr))\n\treturn 0;\n\n /* Make sure this is a frame chunk. The Python driver takes\n case of other chunk types. */\n\n if (bytes < 8) {\n state->errcode = IMAGING_CODEC_OVERRUN;\n return -1;\n }\n if (I16(ptr+4) != 0xF1FA) {\n\tstate->errcode = IMAGING_CODEC_UNKNOWN;\n\treturn -1;\n }\n\n chunks = I16(ptr+6);\n ptr += 16;\n bytes -= 16;\n\n /* Process subchunks */\n for (c = 0; c < chunks; c++) {\n\tUINT8* data;\n\tif (bytes < 10) {\n\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t return -1;\n\t}\n\tdata = ptr + 6;\n\tswitch (I16(ptr+4)) {\n\tcase 4: case 11:\n\t /* FLI COLOR chunk */\n\t break; /* ignored; handled by Python code */\n\tcase 7:\n\t /* FLI SS2 chunk (word delta) */\n\t lines = I16(data); data += 2;\n\t for (l = y = 0; l < lines && y < state->ysize; l++, y++) {\n\t\tUINT8* buf = (UINT8*) im->image[y];\n\t\tint p, packets;\n\t\tpackets = I16(data); data += 2;\n\t\twhile (packets & 0x8000) {\n\t\t /* flag word */\n\t\t if (packets & 0x4000) {\n\t\t\ty += 65536 - packets; /* skip lines */\n\t\t\tif (y >= state->ysize) {\n\t\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t\t return -1;\n\t\t\t}\n\t\t\tbuf = (UINT8*) im->image[y];\n\t\t } else {\n\t\t\t/* store last byte (used if line width is odd) */\n\t\t\tbuf[state->xsize-1] = (UINT8) packets;\n\t\t }\n\t\t packets = I16(data); data += 2;\n\t\t}\n\t\tfor (p = x = 0; p < packets; p++) {\n\t\t x += data[0]; /* pixel skip */\n\t\t if (data[1] >= 128) {\n\t\t\ti = 256-data[1]; /* run */\n\t\t\tif (x + i + i > state->xsize)\n\t\t\t break;\n\t\t\tfor (j = 0; j < i; j++) {\n\t\t\t buf[x++] = data[2];\n\t\t\t buf[x++] = data[3];\n\t\t\t}\n\t\t\tdata += 2 + 2;\n\t\t } else {\n\t\t\ti = 2 * (int) data[1]; /* chunk */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemcpy(buf + x, data + 2, i);\n\t\t\tdata += 2 + i;\n\t\t\tx += i;\n\t\t }\n\t\t}\n\t\tif (p < packets)\n\t\t break; /* didn't process all packets */\n\t }\n\t if (l < lines) {\n\t\t/* didn't process all lines */\n\t\tstate->errcode = IMAGING_CODEC_OVERRUN;\n\t\treturn -1;\n\t }\n\t break;\n\tcase 12:\n\t /* FLI LC chunk (byte delta) */\n\t y = I16(data); ymax = y + I16(data+2); data += 4;\n\t for (; y < ymax && y < state->ysize; y++) {\n\t\tUINT8* out = (UINT8*) im->image[y];\n\t\tint p, packets = *data++;\n\t\tfor (p = x = 0; p < packets; p++, x += i) {\n\t\t x += data[0]; /* skip pixels */\n\t\t if (data[1] & 0x80) {\n\t\t\ti = 256-data[1]; /* run */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemset(out + x, data[2], i);\n\t\t\tdata += 3;\n\t\t } else {\n\t\t\ti = data[1]; /* chunk */\n\t\t\tif (x + i > state->xsize)\n\t\t\t break;\n\t\t\tmemcpy(out + x, data + 2, i);\n\t\t\tdata += i + 2;\n\t\t }\n\t\t}\n\t\tif (p < packets)\n\t\t break; /* didn't process all packets */\n\t }\n\t if (y < ymax) {\n\t\t/* didn't process all lines */\n\t\tstate->errcode = IMAGING_CODEC_OVERRUN;\n\t\treturn -1;\n\t }\n\t break;\n\tcase 13:\n\t /* FLI BLACK chunk */\n\t for (y = 0; y < state->ysize; y++)\n\t\tmemset(im->image[y], 0, state->xsize);\n\t break;\n\tcase 15:\n\t /* FLI BRUN chunk */\n\t for (y = 0; y < state->ysize; y++) {\n\t\tUINT8* out = (UINT8*) im->image[y];\n\t\tdata += 1; /* ignore packetcount byte */\n\t\tfor (x = 0; x < state->xsize; x += i) {\n\t\t if (data[0] & 0x80) {\n\t\t\ti = 256 - data[0];\n\t\t\tif (x + i > state->xsize)\n\t\t\t break; /* safety first */\n\t\t\tmemcpy(out + x, data + 1, i);\n\t\t\tdata += i + 1;\n\t\t } else {\n\t\t\ti = data[0];\n\t\t\tif (x + i > state->xsize)\n\t\t\t break; /* safety first */\n\t\t\tmemset(out + x, data[1], i);\n\t\t\tdata += 2;\n\t\t }\n\t\t}\n\t\tif (x != state->xsize) {\n\t\t /* didn't unpack whole line */\n\t\t state->errcode = IMAGING_CODEC_OVERRUN;\n\t\t return -1;\n\t\t}\n\t }\n\t break;\n\tcase 16:\n\t /* COPY chunk */\n\t for (y = 0; y < state->ysize; y++) {\n\t\tUINT8* buf = (UINT8*) im->image[y];\n\t\tmemcpy(buf, data, state->xsize);\n\t\tdata += state->xsize;\n\t }\n\t break;\n\tcase 18:\n\t /* PSTAMP chunk */\n\t break; /* ignored */\n\tdefault:\n\t /* unknown chunk */\n\t /* printf(\"unknown FLI/FLC chunk: %d\\n\", I16(ptr+4)); */\n\t state->errcode = IMAGING_CODEC_UNKNOWN;\n\t return -1;\n\t}\n\tadvance = I32(ptr);\n\tptr += advance;\n\tbytes -= advance;\n }\n\n return -1; /* end of frame */\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ImagingFliDecode","file_name":"src/libImaging/FliDecode.c","commit_link":"github.com/python-pillow/Pillow/commit/a09acd0decd8a87ccce939d5ff65dab59e7d365b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#93-c15a1f4b82ba","input":"int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,\n\tvoid *buf, int peekonly)\n{\n\tstruct tmComResBusInfo *bus = &dev->bus;\n\tu32 bytes_to_read, write_distance, curr_grp, curr_gwp,\n\t\tnew_grp, buf_size, space_rem;\n\tstruct tmComResInfo msg_tmp;\n\tint ret = SAA_ERR_BAD_PARAMETER;\n\n\tsaa7164_bus_verify(dev);\n\n\tif (msg == NULL)\n\t\treturn ret;\n\n\tif (msg->size > dev->bus.m_wMaxReqSize) {\n\t\tprintk(KERN_ERR \"%s() Exceeded dev->bus.m_wMaxReqSize\\n\",\n\t\t\t__func__);\n\t\treturn ret;\n\t}\n\n\tif ((peekonly == 0) && (msg->size > 0) && (buf == NULL)) {\n\t\tprintk(KERN_ERR\n\t\t\t\"%s() Missing msg buf, size should be %d bytes\\n\",\n\t\t\t__func__, msg->size);\n\t\treturn ret;\n\t}\n\n\tmutex_lock(&bus->lock);\n\n\t/* Peek the bus to see if a msg exists, if it's not what we're expecting\n\t * then return cleanly else read the message from the bus.\n\t */\n\tcurr_gwp = saa7164_readl(bus->m_dwGetWritePos);\n\tcurr_grp = saa7164_readl(bus->m_dwGetReadPos);\n\n\tif (curr_gwp == curr_grp) {\n\t\tret = SAA_ERR_EMPTY;\n\t\tgoto out;\n\t}\n\n\tbytes_to_read = sizeof(*msg);\n\n\t/* Calculate write distance to current read position */\n\twrite_distance = 0;\n\tif (curr_gwp >= curr_grp)\n\t\t/* Write doesn't wrap around the ring */\n\t\twrite_distance = curr_gwp - curr_grp;\n\telse\n\t\t/* Write wraps around the ring */\n\t\twrite_distance = curr_gwp + bus->m_dwSizeGetRing - curr_grp;\n\n\tif (bytes_to_read > write_distance) {\n\t\tprintk(KERN_ERR \"%s() No message/response found\\n\", __func__);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Calculate the new read position */\n\tnew_grp = curr_grp + bytes_to_read;\n\tif (new_grp > bus->m_dwSizeGetRing) {\n\n\t\t/* Ring wraps */\n\t\tnew_grp -= bus->m_dwSizeGetRing;\n\t\tspace_rem = bus->m_dwSizeGetRing - curr_grp;\n\n\t\tmemcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, space_rem);\n\t\tmemcpy_fromio((u8 *)&msg_tmp + space_rem, bus->m_pdwGetRing,\n\t\t\tbytes_to_read - space_rem);\n\n\t} else {\n\t\t/* No wrapping */\n\t\tmemcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, bytes_to_read);\n\t}\n\t/* Convert from little endian to CPU */\n\tmsg_tmp.size = le16_to_cpu((__force __le16)msg_tmp.size);\n\tmsg_tmp.command = le32_to_cpu((__force __le32)msg_tmp.command);\n\tmsg_tmp.controlselector = le16_to_cpu((__force __le16)msg_tmp.controlselector);\n\n\t/* No need to update the read positions, because this was a peek */\n\t/* If the caller specifically want to peek, return */\n\tif (peekonly) {\n\t\tmemcpy(msg, &msg_tmp, sizeof(*msg));\n\t\tgoto peekout;\n\t}\n\n\t/* Check if the command/response matches what is expected */\n\tif ((msg_tmp.id != msg->id) || (msg_tmp.command != msg->command) ||\n\t\t(msg_tmp.controlselector != msg->controlselector) ||\n\t\t(msg_tmp.seqno != msg->seqno) || (msg_tmp.size != msg->size)) {\n\n\t\tprintk(KERN_ERR \"%s() Unexpected msg miss-match\\n\", __func__);\n\t\tsaa7164_bus_dumpmsg(dev, msg, buf);\n\t\tsaa7164_bus_dumpmsg(dev, &msg_tmp, NULL);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Get the actual command and response from the bus */\n\tbuf_size = msg->size;\n\n\tbytes_to_read = sizeof(*msg) + msg->size;\n\t/* Calculate write distance to current read position */\n\twrite_distance = 0;\n\tif (curr_gwp >= curr_grp)\n\t\t/* Write doesn't wrap around the ring */\n\t\twrite_distance = curr_gwp - curr_grp;\n\telse\n\t\t/* Write wraps around the ring */\n\t\twrite_distance = curr_gwp + bus->m_dwSizeGetRing - curr_grp;\n\n\tif (bytes_to_read > write_distance) {\n\t\tprintk(KERN_ERR \"%s() Invalid bus state, missing msg or mangled ring, faulty H/W / bad code?\\n\",\n\t\t __func__);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Calculate the new read position */\n\tnew_grp = curr_grp + bytes_to_read;\n\tif (new_grp > bus->m_dwSizeGetRing) {\n\n\t\t/* Ring wraps */\n\t\tnew_grp -= bus->m_dwSizeGetRing;\n\t\tspace_rem = bus->m_dwSizeGetRing - curr_grp;\n\n\t\tif (space_rem < sizeof(*msg)) {\n\t\t\t/* msg wraps around the ring */\n\t\t\tmemcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, space_rem);\n\t\t\tmemcpy_fromio((u8 *)msg + space_rem, bus->m_pdwGetRing,\n\t\t\t\tsizeof(*msg) - space_rem);\n\t\t\tif (buf)\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + sizeof(*msg) -\n\t\t\t\t\tspace_rem, buf_size);\n\n\t\t} else if (space_rem == sizeof(*msg)) {\n\t\t\tmemcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));\n\t\t\tif (buf)\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing, buf_size);\n\t\t} else {\n\t\t\t/* Additional data wraps around the ring */\n\t\t\tmemcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));\n\t\t\tif (buf) {\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + curr_grp +\n\t\t\t\t\tsizeof(*msg), space_rem - sizeof(*msg));\n\t\t\t\tmemcpy_fromio(buf + space_rem - sizeof(*msg),\n\t\t\t\t\tbus->m_pdwGetRing, bytes_to_read -\n\t\t\t\t\tspace_rem);\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\t\t/* No wrapping */\n\t\tmemcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));\n\t\tif (buf)\n\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + curr_grp + sizeof(*msg),\n\t\t\t\tbuf_size);\n\t}\n\t/* Convert from little endian to CPU */\n\tmsg->size = le16_to_cpu((__force __le16)msg->size);\n\tmsg->command = le32_to_cpu((__force __le32)msg->command);\n\tmsg->controlselector = le16_to_cpu((__force __le16)msg->controlselector);\n\n\t/* Update the read positions, adjusting the ring */\n\tsaa7164_writel(bus->m_dwGetReadPos, new_grp);\n\npeekout:\n\tret = SAA_OK;\nout:\n\tmutex_unlock(&bus->lock);\n\tsaa7164_bus_verify(dev);\n\treturn ret;\n}","target":"int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,\n\tvoid *buf, int peekonly)\n{\n\tstruct tmComResBusInfo *bus = &dev->bus;\n\tu32 bytes_to_read, write_distance, curr_grp, curr_gwp,\n\t\tnew_grp, buf_size, space_rem;\n\tstruct tmComResInfo msg_tmp;\n\tint ret = SAA_ERR_BAD_PARAMETER;\n\n\tsaa7164_bus_verify(dev);\n\n\tif (msg == NULL)\n\t\treturn ret;\n\n\tif (msg->size > dev->bus.m_wMaxReqSize) {\n\t\tprintk(KERN_ERR \"%s() Exceeded dev->bus.m_wMaxReqSize\\n\",\n\t\t\t__func__);\n\t\treturn ret;\n\t}\n\n\tif ((peekonly == 0) && (msg->size > 0) && (buf == NULL)) {\n\t\tprintk(KERN_ERR\n\t\t\t\"%s() Missing msg buf, size should be %d bytes\\n\",\n\t\t\t__func__, msg->size);\n\t\treturn ret;\n\t}\n\n\tmutex_lock(&bus->lock);\n\n\t/* Peek the bus to see if a msg exists, if it's not what we're expecting\n\t * then return cleanly else read the message from the bus.\n\t */\n\tcurr_gwp = saa7164_readl(bus->m_dwGetWritePos);\n\tcurr_grp = saa7164_readl(bus->m_dwGetReadPos);\n\n\tif (curr_gwp == curr_grp) {\n\t\tret = SAA_ERR_EMPTY;\n\t\tgoto out;\n\t}\n\n\tbytes_to_read = sizeof(*msg);\n\n\t/* Calculate write distance to current read position */\n\twrite_distance = 0;\n\tif (curr_gwp >= curr_grp)\n\t\t/* Write doesn't wrap around the ring */\n\t\twrite_distance = curr_gwp - curr_grp;\n\telse\n\t\t/* Write wraps around the ring */\n\t\twrite_distance = curr_gwp + bus->m_dwSizeGetRing - curr_grp;\n\n\tif (bytes_to_read > write_distance) {\n\t\tprintk(KERN_ERR \"%s() No message/response found\\n\", __func__);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Calculate the new read position */\n\tnew_grp = curr_grp + bytes_to_read;\n\tif (new_grp > bus->m_dwSizeGetRing) {\n\n\t\t/* Ring wraps */\n\t\tnew_grp -= bus->m_dwSizeGetRing;\n\t\tspace_rem = bus->m_dwSizeGetRing - curr_grp;\n\n\t\tmemcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, space_rem);\n\t\tmemcpy_fromio((u8 *)&msg_tmp + space_rem, bus->m_pdwGetRing,\n\t\t\tbytes_to_read - space_rem);\n\n\t} else {\n\t\t/* No wrapping */\n\t\tmemcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, bytes_to_read);\n\t}\n\t/* Convert from little endian to CPU */\n\tmsg_tmp.size = le16_to_cpu((__force __le16)msg_tmp.size);\n\tmsg_tmp.command = le32_to_cpu((__force __le32)msg_tmp.command);\n\tmsg_tmp.controlselector = le16_to_cpu((__force __le16)msg_tmp.controlselector);\n\tmemcpy(msg, &msg_tmp, sizeof(*msg));\n\n\t/* No need to update the read positions, because this was a peek */\n\t/* If the caller specifically want to peek, return */\n\tif (peekonly) {\n\t\tgoto peekout;\n\t}\n\n\t/* Check if the command/response matches what is expected */\n\tif ((msg_tmp.id != msg->id) || (msg_tmp.command != msg->command) ||\n\t\t(msg_tmp.controlselector != msg->controlselector) ||\n\t\t(msg_tmp.seqno != msg->seqno) || (msg_tmp.size != msg->size)) {\n\n\t\tprintk(KERN_ERR \"%s() Unexpected msg miss-match\\n\", __func__);\n\t\tsaa7164_bus_dumpmsg(dev, msg, buf);\n\t\tsaa7164_bus_dumpmsg(dev, &msg_tmp, NULL);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Get the actual command and response from the bus */\n\tbuf_size = msg->size;\n\n\tbytes_to_read = sizeof(*msg) + msg->size;\n\t/* Calculate write distance to current read position */\n\twrite_distance = 0;\n\tif (curr_gwp >= curr_grp)\n\t\t/* Write doesn't wrap around the ring */\n\t\twrite_distance = curr_gwp - curr_grp;\n\telse\n\t\t/* Write wraps around the ring */\n\t\twrite_distance = curr_gwp + bus->m_dwSizeGetRing - curr_grp;\n\n\tif (bytes_to_read > write_distance) {\n\t\tprintk(KERN_ERR \"%s() Invalid bus state, missing msg or mangled ring, faulty H/W / bad code?\\n\",\n\t\t __func__);\n\t\tret = SAA_ERR_INVALID_COMMAND;\n\t\tgoto out;\n\t}\n\n\t/* Calculate the new read position */\n\tnew_grp = curr_grp + bytes_to_read;\n\tif (new_grp > bus->m_dwSizeGetRing) {\n\n\t\t/* Ring wraps */\n\t\tnew_grp -= bus->m_dwSizeGetRing;\n\t\tspace_rem = bus->m_dwSizeGetRing - curr_grp;\n\n\t\tif (space_rem < sizeof(*msg)) {\n\t\t\tif (buf)\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + sizeof(*msg) -\n\t\t\t\t\tspace_rem, buf_size);\n\n\t\t} else if (space_rem == sizeof(*msg)) {\n\t\t\tif (buf)\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing, buf_size);\n\t\t} else {\n\t\t\t/* Additional data wraps around the ring */\n\t\t\tif (buf) {\n\t\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + curr_grp +\n\t\t\t\t\tsizeof(*msg), space_rem - sizeof(*msg));\n\t\t\t\tmemcpy_fromio(buf + space_rem - sizeof(*msg),\n\t\t\t\t\tbus->m_pdwGetRing, bytes_to_read -\n\t\t\t\t\tspace_rem);\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\t\t/* No wrapping */\n\t\tif (buf)\n\t\t\tmemcpy_fromio(buf, bus->m_pdwGetRing + curr_grp + sizeof(*msg),\n\t\t\t\tbuf_size);\n\t}\n\n\t/* Update the read positions, adjusting the ring */\n\tsaa7164_writel(bus->m_dwGetReadPos, new_grp);\n\npeekout:\n\tret = SAA_OK;\nout:\n\tmutex_unlock(&bus->lock);\n\tsaa7164_bus_verify(dev);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"saa7164_bus_get","file_name":"drivers/media/pci/saa7164/saa7164-bus.c","commit_link":"github.com/stoth68000/media-tree/commit/354dd3924a2e43806774953de536257548b5002c","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#94-9cd693faa994","input":"static UINT parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tchar* path = NULL;\n\tint status;\n\tUINT32 PathLength;\n\tStream_Seek(irp->input, 28);\n\t/* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */\n\t/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */\n\tStream_Read_UINT32(irp->input, PathLength);\n\tstatus = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*)Stream_Pointer(irp->input), PathLength / 2,\n\t &path, 0, NULL, NULL);\n\n\tif (status < 1)\n\t\tif (!(path = (char*)calloc(1, 1)))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"calloc failed!\");\n\t\t\treturn CHANNEL_RC_NO_MEMORY;\n\t\t}\n\n\tparallel->id = irp->devman->id_sequence++;\n\tparallel->file = open(parallel->path, O_RDWR);\n\n\tif (parallel->file < 0)\n\t{\n\t\tirp->IoStatus = STATUS_ACCESS_DENIED;\n\t\tparallel->id = 0;\n\t}\n\telse\n\t{\n\t\t/* all read and write operations should be non-blocking */\n\t\tif (fcntl(parallel->file, F_SETFL, O_NONBLOCK) == -1)\n\t\t{\n\t\t}\n\t}\n\n\tStream_Write_UINT32(irp->output, parallel->id);\n\tStream_Write_UINT8(irp->output, 0);\n\tfree(path);\n\treturn irp->Complete(irp);\n}","target":"static UINT parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tchar* path = NULL;\n\tint status;\n\tWCHAR* ptr;\n\tUINT32 PathLength;\n\tif (!Stream_SafeSeek(irp->input, 28))\n\t\treturn ERROR_INVALID_DATA;\n\t/* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */\n\t/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */\n\tif (Stream_GetRemainingLength(irp->input) < 4)\n\t\treturn ERROR_INVALID_DATA;\n\tStream_Read_UINT32(irp->input, PathLength);\n\tptr = (WCHAR*)Stream_Pointer(irp->input);\n\tif (!Stream_SafeSeek(irp->input, PathLength))\n\t\treturn ERROR_INVALID_DATA;\n\tstatus = ConvertFromUnicode(CP_UTF8, 0, ptr, PathLength / 2, &path, 0, NULL, NULL);\n\n\tif (status < 1)\n\t\tif (!(path = (char*)calloc(1, 1)))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"calloc failed!\");\n\t\t\treturn CHANNEL_RC_NO_MEMORY;\n\t\t}\n\n\tparallel->id = irp->devman->id_sequence++;\n\tparallel->file = open(parallel->path, O_RDWR);\n\n\tif (parallel->file < 0)\n\t{\n\t\tirp->IoStatus = STATUS_ACCESS_DENIED;\n\t\tparallel->id = 0;\n\t}\n\telse\n\t{\n\t\t/* all read and write operations should be non-blocking */\n\t\tif (fcntl(parallel->file, F_SETFL, O_NONBLOCK) == -1)\n\t\t{\n\t\t}\n\t}\n\n\tStream_Write_UINT32(irp->output, parallel->id);\n\tStream_Write_UINT8(irp->output, 0);\n\tfree(path);\n\treturn irp->Complete(irp);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"parallel_process_irp_create","file_name":"channels/parallel/client/parallel_main.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/795842f4096501fcefc1a7f535ccc8132feb31d7","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#95-aa73fa6e51f7","input":"const TfLiteTensor* GetOptionalInputTensor(const TfLiteContext* context,\n const TfLiteNode* node, int index) {\n const bool use_tensor = index < node->inputs->size &&\n node->inputs->data[index] != kTfLiteOptionalTensor;\n if (use_tensor) {\n return GetMutableInput(context, node, index);\n }\n return nullptr;\n}","target":"const TfLiteTensor* GetOptionalInputTensor(const TfLiteContext* context,\n const TfLiteNode* node, int index) {\n return GetInput(context, node, index);\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"tflite::GetOptionalInputTensor","file_name":"tensorflow/lite/kernels/kernel_util.cc","commit_link":"github.com/tensorflow/tensorflow/commit/00302787b788c5ff04cb6f62aed5a74d936e86c0","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#96-9e62ffd3a7bc","input":"static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n char\n page_geometry[MaxTextExtent];\n\n Image\n *image;\n\n MagickBooleanType\n logging;\n\n volatile int\n first_mng_object,\n object_id,\n term_chunk_found,\n skip_to_iend;\n\n volatile ssize_t\n image_count=0;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n offset;\n\n MngBox\n default_fb,\n fb,\n previous_fb;\n\n#if defined(MNG_INSERT_LAYERS)\n PixelPacket\n mng_background_color;\n#endif\n\n register unsigned char\n *p;\n\n register ssize_t\n i;\n\n size_t\n count;\n\n ssize_t\n loop_level;\n\n volatile short\n skipping_loop;\n\n#if defined(MNG_INSERT_LAYERS)\n unsigned int\n mandatory_back=0;\n#endif\n\n volatile unsigned int\n#ifdef MNG_OBJECT_BUFFERS\n mng_background_object=0,\n#endif\n mng_type=0; /* 0: PNG or JNG; 1: MNG; 2: MNG-LC; 3: MNG-VLC */\n\n size_t\n default_frame_timeout,\n frame_timeout,\n#if defined(MNG_INSERT_LAYERS)\n image_height,\n image_width,\n#endif\n length;\n\n /* These delays are all measured in image ticks_per_second,\n * not in MNG ticks_per_second\n */\n volatile size_t\n default_frame_delay,\n final_delay,\n final_image_delay,\n frame_delay,\n#if defined(MNG_INSERT_LAYERS)\n insert_layers,\n#endif\n mng_iterations=1,\n simplicity=0,\n subframe_height=0,\n subframe_width=0;\n\n previous_fb.top=0;\n previous_fb.bottom=0;\n previous_fb.left=0;\n previous_fb.right=0;\n default_fb.top=0;\n default_fb.bottom=0;\n default_fb.left=0;\n default_fb.right=0;\n\n logging=LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter ReadOneMNGImage()\");\n\n image=mng_info->image;\n\n if (LocaleCompare(image_info->magick,\"MNG\") == 0)\n {\n char\n magic_number[MaxTextExtent];\n\n /* Verify MNG signature. */\n count=(size_t) ReadBlob(image,8,(unsigned char *) magic_number);\n if (memcmp(magic_number,\"\\212MNG\\r\\n\\032\\n\",8) != 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n /* Initialize some nonzero members of the MngInfo structure. */\n for (i=0; i < MNG_MAX_OBJECTS; i++)\n {\n mng_info->object_clip[i].right=(ssize_t) PNG_UINT_31_MAX;\n mng_info->object_clip[i].bottom=(ssize_t) PNG_UINT_31_MAX;\n }\n mng_info->exists[0]=MagickTrue;\n }\n\n skipping_loop=(-1);\n first_mng_object=MagickTrue;\n mng_type=0;\n#if defined(MNG_INSERT_LAYERS)\n insert_layers=MagickFalse; /* should be False when converting or mogrifying */\n#endif\n default_frame_delay=0;\n default_frame_timeout=0;\n frame_delay=0;\n final_delay=1;\n mng_info->ticks_per_second=1UL*image->ticks_per_second;\n object_id=0;\n skip_to_iend=MagickFalse;\n term_chunk_found=MagickFalse;\n mng_info->framing_mode=1;\n#if defined(MNG_INSERT_LAYERS)\n mandatory_back=MagickFalse;\n#endif\n#if defined(MNG_INSERT_LAYERS)\n mng_background_color=image->background_color;\n#endif\n default_fb=mng_info->frame;\n previous_fb=mng_info->frame;\n do\n {\n char\n type[MaxTextExtent];\n\n if (LocaleCompare(image_info->magick,\"MNG\") == 0)\n {\n unsigned char\n *chunk;\n\n /*\n Read a new chunk.\n */\n type[0]='\\0';\n (void) ConcatenateMagickString(type,\"errr\",MaxTextExtent);\n length=ReadBlobMSBLong(image);\n count=(size_t) ReadBlob(image,4,(unsigned char *) type);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reading MNG chunk type %c%c%c%c, length: %.20g\",\n type[0],type[1],type[2],type[3],(double) length);\n\n if (length > PNG_UINT_31_MAX)\n {\n status=MagickFalse;\n break;\n }\n\n if (count == 0)\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n\n p=NULL;\n chunk=(unsigned char *) NULL;\n\n if (length != 0)\n {\n chunk=(unsigned char *) AcquireQuantumMemory(length+\n MagickPathExtent,sizeof(*chunk));\n\n if (chunk == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n for (i=0; i < (ssize_t) length; i++)\n {\n int\n c;\n\n c=ReadBlobByte(image);\n if (c == EOF)\n break;\n chunk[i]=(unsigned char) c;\n }\n\n p=chunk;\n }\n\n (void) ReadBlobMSBLong(image); /* read crc word */\n\n#if !defined(JNG_SUPPORTED)\n if (memcmp(type,mng_JHDR,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->jhdr_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"JNGCompressNotSupported\",\"`%s'\",image->filename);\n\n mng_info->jhdr_warning++;\n }\n#endif\n if (memcmp(type,mng_DHDR,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->dhdr_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"DeltaPNGNotSupported\",\"`%s'\",image->filename);\n\n mng_info->dhdr_warning++;\n }\n if (memcmp(type,mng_MEND,4) == 0)\n break;\n\n if (skip_to_iend)\n {\n if (memcmp(type,mng_IEND,4) == 0)\n skip_to_iend=MagickFalse;\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Skip to IEND.\");\n\n continue;\n }\n\n if (memcmp(type,mng_MHDR,4) == 0)\n {\n if (length != 28)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n }\n\n mng_info->mng_width=(size_t) ((p[0] << 24) | (p[1] << 16) |\n (p[2] << 8) | p[3]);\n\n mng_info->mng_height=(size_t) ((p[4] << 24) | (p[5] << 16) |\n (p[6] << 8) | p[7]);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MNG width: %.20g\",(double) mng_info->mng_width);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MNG height: %.20g\",(double) mng_info->mng_height);\n }\n\n p+=8;\n mng_info->ticks_per_second=(size_t) mng_get_long(p);\n\n if (mng_info->ticks_per_second == 0)\n default_frame_delay=0;\n\n else\n default_frame_delay=1UL*image->ticks_per_second/\n mng_info->ticks_per_second;\n\n frame_delay=default_frame_delay;\n simplicity=0;\n\n /* Skip nominal layer count, frame count, and play time */\n p+=16;\n simplicity=(size_t) mng_get_long(p);\n\n mng_type=1; /* Full MNG */\n\n if ((simplicity != 0) && ((simplicity | 11) == 11))\n mng_type=2; /* LC */\n\n if ((simplicity != 0) && ((simplicity | 9) == 9))\n mng_type=3; /* VLC */\n\n#if defined(MNG_INSERT_LAYERS)\n if (mng_type != 3)\n insert_layers=MagickTrue;\n#endif\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n mng_info->image=image;\n }\n\n if ((mng_info->mng_width > 65535L) ||\n (mng_info->mng_height > 65535L))\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(ImageError,\"WidthOrHeightExceedsLimit\");\n }\n\n (void) FormatLocaleString(page_geometry,MaxTextExtent,\n \"%.20gx%.20g+0+0\",(double) mng_info->mng_width,(double)\n mng_info->mng_height);\n\n mng_info->frame.left=0;\n mng_info->frame.right=(ssize_t) mng_info->mng_width;\n mng_info->frame.top=0;\n mng_info->frame.bottom=(ssize_t) mng_info->mng_height;\n mng_info->clip=default_fb=previous_fb=mng_info->frame;\n\n for (i=0; i < MNG_MAX_OBJECTS; i++)\n mng_info->object_clip[i]=mng_info->frame;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_TERM,4) == 0)\n {\n int\n repeat=0;\n\n if (length != 0)\n repeat=p[0];\n\n if (repeat == 3 && length > 8)\n {\n final_delay=(png_uint_32) mng_get_long(&p[2]);\n mng_iterations=(png_uint_32) mng_get_long(&p[6]);\n\n if (mng_iterations == PNG_UINT_31_MAX)\n mng_iterations=0;\n\n image->iterations=mng_iterations;\n term_chunk_found=MagickTrue;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" repeat=%d, final_delay=%.20g, iterations=%.20g\",\n repeat,(double) final_delay, (double) image->iterations);\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_DEFI,4) == 0)\n {\n if (mng_type == 3)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"DEFI chunk found in MNG-VLC datastream\",\"`%s'\",\n image->filename);\n\n if (length > 1)\n {\n object_id=(p[0] << 8) | p[1];\n\n if (mng_type == 2 && object_id != 0)\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),\n CoderError,\"Nonzero object_id in MNG-LC datastream\",\n \"`%s'\", image->filename);\n\n if (object_id > MNG_MAX_OBJECTS)\n {\n /*\n Instead of using a warning we should allocate a larger\n MngInfo structure and continue.\n */\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(), CoderError,\n \"object id too large\",\"`%s'\",image->filename);\n object_id=MNG_MAX_OBJECTS;\n }\n\n if (mng_info->exists[object_id])\n if (mng_info->frozen[object_id])\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"DEFI cannot redefine a frozen MNG object\",\"`%s'\",\n image->filename);\n continue;\n }\n\n mng_info->exists[object_id]=MagickTrue;\n\n if (length > 2)\n mng_info->invisible[object_id]=p[2];\n\n /*\n Extract object offset info.\n */\n if (length > 11)\n {\n mng_info->x_off[object_id]=(ssize_t) ((p[4] << 24) |\n (p[5] << 16) | (p[6] << 8) | p[7]);\n\n mng_info->y_off[object_id]=(ssize_t) ((p[8] << 24) |\n (p[9] << 16) | (p[10] << 8) | p[11]);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" x_off[%d]: %.20g, y_off[%d]: %.20g\",\n object_id,(double) mng_info->x_off[object_id],\n object_id,(double) mng_info->y_off[object_id]);\n }\n }\n\n /*\n Extract object clipping info.\n */\n \n if (length > 27)\n mng_info->object_clip[object_id]=\n mng_read_box(mng_info->frame,0, &p[12]);\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_bKGD,4) == 0)\n {\n mng_info->have_global_bkgd=MagickFalse;\n\n if (length > 5)\n {\n mng_info->mng_global_bkgd.red=\n ScaleShortToQuantum((unsigned short) ((p[0] << 8) | p[1]));\n\n mng_info->mng_global_bkgd.green=\n ScaleShortToQuantum((unsigned short) ((p[2] << 8) | p[3]));\n\n mng_info->mng_global_bkgd.blue=\n ScaleShortToQuantum((unsigned short) ((p[4] << 8) | p[5]));\n\n mng_info->have_global_bkgd=MagickTrue;\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_BACK,4) == 0)\n {\n#if defined(MNG_INSERT_LAYERS)\n if (length > 6)\n mandatory_back=p[6];\n\n else\n mandatory_back=0;\n\n if (mandatory_back && length > 5)\n {\n mng_background_color.red=\n ScaleShortToQuantum((unsigned short) ((p[0] << 8) | p[1]));\n\n mng_background_color.green=\n ScaleShortToQuantum((unsigned short) ((p[2] << 8) | p[3]));\n\n mng_background_color.blue=\n ScaleShortToQuantum((unsigned short) ((p[4] << 8) | p[5]));\n\n mng_background_color.opacity=OpaqueOpacity;\n }\n\n#ifdef MNG_OBJECT_BUFFERS\n if (length > 8)\n mng_background_object=(p[7] << 8) | p[8];\n#endif\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_PLTE,4) == 0)\n {\n /* Read global PLTE. */\n\n if (length && (length < 769))\n {\n if (mng_info->global_plte == (png_colorp) NULL)\n mng_info->global_plte=(png_colorp) AcquireQuantumMemory(256,\n sizeof(*mng_info->global_plte));\n\n for (i=0; i < (ssize_t) (length/3); i++)\n {\n mng_info->global_plte[i].red=p[3*i];\n mng_info->global_plte[i].green=p[3*i+1];\n mng_info->global_plte[i].blue=p[3*i+2];\n }\n\n mng_info->global_plte_length=(unsigned int) (length/3);\n }\n#ifdef MNG_LOOSE\n for ( ; i < 256; i++)\n {\n mng_info->global_plte[i].red=i;\n mng_info->global_plte[i].green=i;\n mng_info->global_plte[i].blue=i;\n }\n\n if (length != 0)\n mng_info->global_plte_length=256;\n#endif\n else\n mng_info->global_plte_length=0;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_tRNS,4) == 0)\n {\n /* read global tRNS */\n\n if (length > 0 && length < 257)\n for (i=0; i < (ssize_t) length; i++)\n mng_info->global_trns[i]=p[i];\n\n#ifdef MNG_LOOSE\n for ( ; i < 256; i++)\n mng_info->global_trns[i]=255;\n#endif\n mng_info->global_trns_length=(unsigned int) length;\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_gAMA,4) == 0)\n {\n if (length == 4)\n {\n ssize_t\n igamma;\n\n igamma=mng_get_long(p);\n mng_info->global_gamma=((float) igamma)*0.00001;\n mng_info->have_global_gama=MagickTrue;\n }\n\n else\n mng_info->have_global_gama=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_cHRM,4) == 0)\n {\n /* Read global cHRM */\n\n if (length == 32)\n {\n mng_info->global_chrm.white_point.x=0.00001*mng_get_long(p);\n mng_info->global_chrm.white_point.y=0.00001*mng_get_long(&p[4]);\n mng_info->global_chrm.red_primary.x=0.00001*mng_get_long(&p[8]);\n mng_info->global_chrm.red_primary.y=0.00001*\n mng_get_long(&p[12]);\n mng_info->global_chrm.green_primary.x=0.00001*\n mng_get_long(&p[16]);\n mng_info->global_chrm.green_primary.y=0.00001*\n mng_get_long(&p[20]);\n mng_info->global_chrm.blue_primary.x=0.00001*\n mng_get_long(&p[24]);\n mng_info->global_chrm.blue_primary.y=0.00001*\n mng_get_long(&p[28]);\n mng_info->have_global_chrm=MagickTrue;\n }\n else\n mng_info->have_global_chrm=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_sRGB,4) == 0)\n {\n /*\n Read global sRGB.\n */\n if (length != 0)\n {\n mng_info->global_srgb_intent=\n Magick_RenderingIntent_from_PNG_RenderingIntent(p[0]);\n mng_info->have_global_srgb=MagickTrue;\n }\n else\n mng_info->have_global_srgb=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_iCCP,4) == 0)\n {\n /* To do: */\n\n /*\n Read global iCCP.\n */\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if (memcmp(type,mng_FRAM,4) == 0)\n {\n if (mng_type == 3)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"FRAM chunk found in MNG-VLC datastream\",\"`%s'\",\n image->filename);\n\n if ((mng_info->framing_mode == 2) || (mng_info->framing_mode == 4))\n image->delay=frame_delay;\n\n frame_delay=default_frame_delay;\n frame_timeout=default_frame_timeout;\n fb=default_fb;\n\n if (length > 0)\n if (p[0])\n mng_info->framing_mode=p[0];\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_mode=%d\",mng_info->framing_mode);\n\n if (length > 6)\n {\n /* Note the delay and frame clipping boundaries. */\n\n p++; /* framing mode */\n\n while (*p && ((p-chunk) < (ssize_t) length))\n p++; /* frame name */\n\n p++; /* frame name terminator */\n\n if ((p-chunk) < (ssize_t) (length-4))\n {\n int\n change_delay,\n change_timeout,\n change_clipping;\n\n change_delay=(*p++);\n change_timeout=(*p++);\n change_clipping=(*p++);\n p++; /* change_sync */\n\n if (change_delay && (p-chunk) < (ssize_t) (length-4))\n {\n frame_delay=1UL*image->ticks_per_second*\n mng_get_long(p);\n\n if (mng_info->ticks_per_second != 0)\n frame_delay/=mng_info->ticks_per_second;\n\n else\n frame_delay=PNG_UINT_31_MAX;\n\n if (change_delay == 2)\n default_frame_delay=frame_delay;\n\n p+=4;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_delay=%.20g\",(double) frame_delay);\n }\n\n if (change_timeout && (p-chunk) < (ssize_t) (length-4))\n {\n frame_timeout=1UL*image->ticks_per_second*\n mng_get_long(p);\n\n if (mng_info->ticks_per_second != 0)\n frame_timeout/=mng_info->ticks_per_second;\n\n else\n frame_timeout=PNG_UINT_31_MAX;\n\n if (change_timeout == 2)\n default_frame_timeout=frame_timeout;\n\n p+=4;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_timeout=%.20g\",(double) frame_timeout);\n }\n\n if (change_clipping && (p-chunk) < (ssize_t) (length-17))\n {\n fb=mng_read_box(previous_fb,(char) p[0],&p[1]);\n p+=17;\n previous_fb=fb;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Frame_clip: L=%.20g R=%.20g T=%.20g B=%.20g\",\n (double) fb.left,(double) fb.right,(double) fb.top,\n (double) fb.bottom);\n\n if (change_clipping == 2)\n default_fb=fb;\n }\n }\n }\n mng_info->clip=fb;\n mng_info->clip=mng_minimum_box(fb,mng_info->frame);\n\n subframe_width=(size_t) (mng_info->clip.right\n -mng_info->clip.left);\n\n subframe_height=(size_t) (mng_info->clip.bottom\n -mng_info->clip.top);\n /*\n Insert a background layer behind the frame if framing_mode is 4.\n */\n#if defined(MNG_INSERT_LAYERS)\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" subframe_width=%.20g, subframe_height=%.20g\",(double)\n subframe_width,(double) subframe_height);\n\n if (insert_layers && (mng_info->framing_mode == 4) &&\n (subframe_width) && (subframe_height))\n {\n /* Allocate next image structure. */\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n image->columns=subframe_width;\n image->rows=subframe_height;\n image->page.width=subframe_width;\n image->page.height=subframe_height;\n image->page.x=mng_info->clip.left;\n image->page.y=mng_info->clip.top;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n image->delay=0;\n (void) SetImageBackgroundColor(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Insert backgd layer, L=%.20g, R=%.20g T=%.20g, B=%.20g\",\n (double) mng_info->clip.left,(double) mng_info->clip.right,\n (double) mng_info->clip.top,(double) mng_info->clip.bottom);\n }\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_CLIP,4) == 0)\n {\n unsigned int\n first_object,\n last_object;\n\n /*\n Read CLIP.\n */\n if (length > 3)\n {\n first_object=(p[0] << 8) | p[1];\n last_object=(p[2] << 8) | p[3];\n p+=4;\n\n for (i=(int) first_object; i <= (int) last_object; i++)\n {\n if (mng_info->exists[i] && !mng_info->frozen[i])\n {\n MngBox\n box;\n\n box=mng_info->object_clip[i];\n if ((p-chunk) < (ssize_t) (length-17))\n mng_info->object_clip[i]=\n mng_read_box(box,(char) p[0],&p[1]);\n }\n }\n\n }\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_SAVE,4) == 0)\n {\n for (i=1; i < MNG_MAX_OBJECTS; i++)\n if (mng_info->exists[i])\n {\n mng_info->frozen[i]=MagickTrue;\n#ifdef MNG_OBJECT_BUFFERS\n if (mng_info->ob[i] != (MngBuffer *) NULL)\n mng_info->ob[i]->frozen=MagickTrue;\n#endif\n }\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if ((memcmp(type,mng_DISC,4) == 0) || (memcmp(type,mng_SEEK,4) == 0))\n {\n /* Read DISC or SEEK. */\n\n if ((length == 0) || !memcmp(type,mng_SEEK,4))\n {\n for (i=1; i < MNG_MAX_OBJECTS; i++)\n MngInfoDiscardObject(mng_info,i);\n }\n\n else\n {\n register ssize_t\n j;\n\n for (j=1; j < (ssize_t) length; j+=2)\n {\n i=p[j-1] << 8 | p[j];\n MngInfoDiscardObject(mng_info,i);\n }\n }\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if (memcmp(type,mng_MOVE,4) == 0)\n {\n size_t\n first_object,\n last_object;\n\n /* read MOVE */\n\n if (length > 3)\n {\n first_object=(p[0] << 8) | p[1];\n last_object=(p[2] << 8) | p[3];\n p+=4;\n\n for (i=(ssize_t) first_object; i <= (ssize_t) last_object; i++)\n {\n if (mng_info->exists[i] && !mng_info->frozen[i] &&\n (p-chunk) < (ssize_t) (length-8))\n {\n MngPair\n new_pair;\n\n MngPair\n old_pair;\n\n old_pair.a=mng_info->x_off[i];\n old_pair.b=mng_info->y_off[i];\n new_pair=mng_read_pair(old_pair,(int) p[0],&p[1]);\n mng_info->x_off[i]=new_pair.a;\n mng_info->y_off[i]=new_pair.b;\n }\n }\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_LOOP,4) == 0)\n {\n ssize_t loop_iters=1;\n if (length > 4)\n {\n loop_level=chunk[0];\n mng_info->loop_active[loop_level]=1; /* mark loop active */\n\n /* Record starting point. */\n loop_iters=mng_get_long(&chunk[1]);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" LOOP level %.20g has %.20g iterations \",\n (double) loop_level, (double) loop_iters);\n\n if (loop_iters == 0)\n skipping_loop=loop_level;\n\n else\n {\n mng_info->loop_jump[loop_level]=TellBlob(image);\n mng_info->loop_count[loop_level]=loop_iters;\n }\n\n mng_info->loop_iteration[loop_level]=0;\n }\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_ENDL,4) == 0)\n {\n if (length > 0)\n {\n loop_level=chunk[0];\n\n if (skipping_loop > 0)\n {\n if (skipping_loop == loop_level)\n {\n /*\n Found end of zero-iteration loop.\n */\n skipping_loop=(-1);\n mng_info->loop_active[loop_level]=0;\n }\n }\n\n else\n {\n if (mng_info->loop_active[loop_level] == 1)\n {\n mng_info->loop_count[loop_level]--;\n mng_info->loop_iteration[loop_level]++;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ENDL: LOOP level %.20g has %.20g remaining iters \",\n (double) loop_level,(double)\n mng_info->loop_count[loop_level]);\n\n if (mng_info->loop_count[loop_level] != 0)\n {\n offset=SeekBlob(image,\n mng_info->loop_jump[loop_level], SEEK_SET);\n\n if (offset < 0)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(\n chunk);\n ThrowReaderException(CorruptImageError,\n \"ImproperImageHeader\");\n }\n }\n\n else\n {\n short\n last_level;\n\n /*\n Finished loop.\n */\n mng_info->loop_active[loop_level]=0;\n last_level=(-1);\n for (i=0; i < loop_level; i++)\n if (mng_info->loop_active[i] == 1)\n last_level=(short) i;\n loop_level=last_level;\n }\n }\n }\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_CLON,4) == 0)\n {\n if (mng_info->clon_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CLON is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->clon_warning++;\n }\n\n if (memcmp(type,mng_MAGN,4) == 0)\n {\n png_uint_16\n magn_first,\n magn_last,\n magn_mb,\n magn_ml,\n magn_mr,\n magn_mt,\n magn_mx,\n magn_my,\n magn_methx,\n magn_methy;\n\n if (length > 1)\n magn_first=(p[0] << 8) | p[1];\n\n else\n magn_first=0;\n\n if (length > 3)\n magn_last=(p[2] << 8) | p[3];\n\n else\n magn_last=magn_first;\n#ifndef MNG_OBJECT_BUFFERS\n if (magn_first || magn_last)\n if (mng_info->magn_warning == 0)\n {\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"MAGN is not implemented yet for nonzero objects\",\n \"`%s'\",image->filename);\n\n mng_info->magn_warning++;\n }\n#endif\n if (length > 4)\n magn_methx=p[4];\n\n else\n magn_methx=0;\n\n if (length > 6)\n magn_mx=(p[5] << 8) | p[6];\n\n else\n magn_mx=1;\n\n if (magn_mx == 0)\n magn_mx=1;\n\n if (length > 8)\n magn_my=(p[7] << 8) | p[8];\n\n else\n magn_my=magn_mx;\n\n if (magn_my == 0)\n magn_my=1;\n\n if (length > 10)\n magn_ml=(p[9] << 8) | p[10];\n\n else\n magn_ml=magn_mx;\n\n if (magn_ml == 0)\n magn_ml=1;\n\n if (length > 12)\n magn_mr=(p[11] << 8) | p[12];\n\n else\n magn_mr=magn_mx;\n\n if (magn_mr == 0)\n magn_mr=1;\n\n if (length > 14)\n magn_mt=(p[13] << 8) | p[14];\n\n else\n magn_mt=magn_my;\n\n if (magn_mt == 0)\n magn_mt=1;\n\n if (length > 16)\n magn_mb=(p[15] << 8) | p[16];\n\n else\n magn_mb=magn_my;\n\n if (magn_mb == 0)\n magn_mb=1;\n\n if (length > 17)\n magn_methy=p[17];\n\n else\n magn_methy=magn_methx;\n\n\n if (magn_methx > 5 || magn_methy > 5)\n if (mng_info->magn_warning == 0)\n {\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"Unknown MAGN method in MNG datastream\",\"`%s'\",\n image->filename);\n\n mng_info->magn_warning++;\n }\n#ifdef MNG_OBJECT_BUFFERS\n /* Magnify existing objects in the range magn_first to magn_last */\n#endif\n if (magn_first == 0 || magn_last == 0)\n {\n /* Save the magnification factors for object 0 */\n mng_info->magn_mb=magn_mb;\n mng_info->magn_ml=magn_ml;\n mng_info->magn_mr=magn_mr;\n mng_info->magn_mt=magn_mt;\n mng_info->magn_mx=magn_mx;\n mng_info->magn_my=magn_my;\n mng_info->magn_methx=magn_methx;\n mng_info->magn_methy=magn_methy;\n }\n }\n\n if (memcmp(type,mng_PAST,4) == 0)\n {\n if (mng_info->past_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"PAST is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->past_warning++;\n }\n\n if (memcmp(type,mng_SHOW,4) == 0)\n {\n if (mng_info->show_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"SHOW is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->show_warning++;\n }\n\n if (memcmp(type,mng_sBIT,4) == 0)\n {\n if (length < 4)\n mng_info->have_global_sbit=MagickFalse;\n\n else\n {\n mng_info->global_sbit.gray=p[0];\n mng_info->global_sbit.red=p[0];\n mng_info->global_sbit.green=p[1];\n mng_info->global_sbit.blue=p[2];\n mng_info->global_sbit.alpha=p[3];\n mng_info->have_global_sbit=MagickTrue;\n }\n }\n if (memcmp(type,mng_pHYs,4) == 0)\n {\n if (length > 8)\n {\n mng_info->global_x_pixels_per_unit=\n (size_t) mng_get_long(p);\n mng_info->global_y_pixels_per_unit=\n (size_t) mng_get_long(&p[4]);\n mng_info->global_phys_unit_type=p[8];\n mng_info->have_global_phys=MagickTrue;\n }\n\n else\n mng_info->have_global_phys=MagickFalse;\n }\n if (memcmp(type,mng_pHYg,4) == 0)\n {\n if (mng_info->phyg_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"pHYg is not implemented.\",\"`%s'\",image->filename);\n\n mng_info->phyg_warning++;\n }\n if (memcmp(type,mng_BASI,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->basi_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"BASI is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->basi_warning++;\n#ifdef MNG_BASI_SUPPORTED\n if (length > 11)\n {\n basi_width=(size_t) ((p[0] << 24) | (p[1] << 16) |\n (p[2] << 8) | p[3]);\n basi_height=(size_t) ((p[4] << 24) | (p[5] << 16) |\n (p[6] << 8) | p[7]);\n basi_color_type=p[8];\n basi_compression_method=p[9];\n basi_filter_type=p[10];\n basi_interlace_method=p[11];\n }\n if (length > 13)\n basi_red=(p[12] << 8) & p[13];\n\n else\n basi_red=0;\n\n if (length > 15)\n basi_green=(p[14] << 8) & p[15];\n\n else\n basi_green=0;\n\n if (length > 17)\n basi_blue=(p[16] << 8) & p[17];\n\n else\n basi_blue=0;\n\n if (length > 19)\n basi_alpha=(p[18] << 8) & p[19];\n\n else\n {\n if (basi_sample_depth == 16)\n basi_alpha=65535L;\n else\n basi_alpha=255;\n }\n\n if (length > 20)\n basi_viewable=p[20];\n\n else\n basi_viewable=0;\n\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_IHDR,4)\n#if defined(JNG_SUPPORTED)\n && memcmp(type,mng_JHDR,4)\n#endif\n )\n {\n /* Not an IHDR or JHDR chunk */\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n/* Process IHDR */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Processing %c%c%c%c chunk\",type[0],type[1],type[2],type[3]);\n\n mng_info->exists[object_id]=MagickTrue;\n mng_info->viewable[object_id]=MagickTrue;\n\n if (mng_info->invisible[object_id])\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Skipping invisible object\");\n\n skip_to_iend=MagickTrue;\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n#if defined(MNG_INSERT_LAYERS)\n if (length < 8)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n image_width=(size_t) mng_get_long(p);\n image_height=(size_t) mng_get_long(&p[4]);\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n /*\n Insert a transparent background layer behind the entire animation\n if it is not full screen.\n */\n#if defined(MNG_INSERT_LAYERS)\n if (insert_layers && mng_type && first_mng_object)\n {\n if ((mng_info->clip.left > 0) || (mng_info->clip.top > 0) ||\n (image_width < mng_info->mng_width) ||\n (mng_info->clip.right < (ssize_t) mng_info->mng_width) ||\n (image_height < mng_info->mng_height) ||\n (mng_info->clip.bottom < (ssize_t) mng_info->mng_height))\n {\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n /* Make a background rectangle. */\n\n image->delay=0;\n image->columns=mng_info->mng_width;\n image->rows=mng_info->mng_height;\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=0;\n image->page.y=0;\n image->background_color=mng_background_color;\n (void) SetImageBackgroundColor(image);\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Inserted transparent background layer, W=%.20g, H=%.20g\",\n (double) mng_info->mng_width,(double) mng_info->mng_height);\n }\n }\n /*\n Insert a background layer behind the upcoming image if\n framing_mode is 3, and we haven't already inserted one.\n */\n if (insert_layers && (mng_info->framing_mode == 3) &&\n (subframe_width) && (subframe_height) && (simplicity == 0 ||\n (simplicity & 0x08)))\n {\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n image->delay=0;\n image->columns=subframe_width;\n image->rows=subframe_height;\n image->page.width=subframe_width;\n image->page.height=subframe_height;\n image->page.x=mng_info->clip.left;\n image->page.y=mng_info->clip.top;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n (void) SetImageBackgroundColor(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Insert background layer, L=%.20g, R=%.20g T=%.20g, B=%.20g\",\n (double) mng_info->clip.left,(double) mng_info->clip.right,\n (double) mng_info->clip.top,(double) mng_info->clip.bottom);\n }\n#endif /* MNG_INSERT_LAYERS */\n first_mng_object=MagickFalse;\n\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n mng_info->image=image;\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n\n if (status == MagickFalse)\n break;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n if (mng_info->framing_mode == 1 || mng_info->framing_mode == 3)\n {\n image->delay=frame_delay;\n frame_delay=default_frame_delay;\n }\n\n else\n image->delay=0;\n\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=mng_info->x_off[object_id];\n image->page.y=mng_info->y_off[object_id];\n image->iterations=mng_iterations;\n\n /*\n Seek back to the beginning of the IHDR or JHDR chunk's length field.\n */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Seeking back to beginning of %c%c%c%c chunk\",type[0],type[1],\n type[2],type[3]);\n\n offset=SeekBlob(image,-((ssize_t) length+12),SEEK_CUR);\n\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n mng_info->image=image;\n mng_info->mng_type=mng_type;\n mng_info->object_id=object_id;\n\n if (memcmp(type,mng_IHDR,4) == 0)\n image=ReadOnePNGImage(mng_info,image_info,exception);\n\n#if defined(JNG_SUPPORTED)\n else\n image=ReadOneJNGImage(mng_info,image_info,exception);\n#endif\n\n if (image == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"exit ReadJNGImage() with error\");\n\n return((Image *) NULL);\n }\n\n if (image->columns == 0 || image->rows == 0)\n {\n (void) CloseBlob(image);\n return(DestroyImageList(image));\n }\n\n mng_info->image=image;\n\n if (mng_type)\n {\n MngBox\n crop_box;\n\n if (mng_info->magn_methx || mng_info->magn_methy)\n {\n png_uint_32\n magnified_height,\n magnified_width;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Processing MNG MAGN chunk\");\n\n if (mng_info->magn_methx == 1)\n {\n magnified_width=mng_info->magn_ml;\n\n if (image->columns > 1)\n magnified_width += mng_info->magn_mr;\n\n if (image->columns > 2)\n magnified_width += (png_uint_32)\n ((image->columns-2)*(mng_info->magn_mx));\n }\n\n else\n {\n magnified_width=(png_uint_32) image->columns;\n\n if (image->columns > 1)\n magnified_width += mng_info->magn_ml-1;\n\n if (image->columns > 2)\n magnified_width += mng_info->magn_mr-1;\n\n if (image->columns > 3)\n magnified_width += (png_uint_32)\n ((image->columns-3)*(mng_info->magn_mx-1));\n }\n\n if (mng_info->magn_methy == 1)\n {\n magnified_height=mng_info->magn_mt;\n\n if (image->rows > 1)\n magnified_height += mng_info->magn_mb;\n\n if (image->rows > 2)\n magnified_height += (png_uint_32)\n ((image->rows-2)*(mng_info->magn_my));\n }\n\n else\n {\n magnified_height=(png_uint_32) image->rows;\n\n if (image->rows > 1)\n magnified_height += mng_info->magn_mt-1;\n\n if (image->rows > 2)\n magnified_height += mng_info->magn_mb-1;\n\n if (image->rows > 3)\n magnified_height += (png_uint_32)\n ((image->rows-3)*(mng_info->magn_my-1));\n }\n\n if (magnified_height > image->rows ||\n magnified_width > image->columns)\n {\n Image\n *large_image;\n\n int\n yy;\n\n ssize_t\n m,\n y;\n\n register ssize_t\n x;\n\n register PixelPacket\n *n,\n *q;\n\n PixelPacket\n *next,\n *prev;\n\n png_uint_16\n magn_methx,\n magn_methy;\n\n /* Allocate next image structure. */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocate magnified image\");\n\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n large_image=SyncNextImageInList(image);\n\n large_image->columns=magnified_width;\n large_image->rows=magnified_height;\n\n magn_methx=mng_info->magn_methx;\n magn_methy=mng_info->magn_methy;\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n#define QM unsigned short\n if (magn_methx != 1 || magn_methy != 1)\n {\n /*\n Scale pixels to unsigned shorts to prevent\n overflow of intermediate values of interpolations\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n SetPixelRed(q,ScaleQuantumToShort(\n GetPixelRed(q)));\n SetPixelGreen(q,ScaleQuantumToShort(\n GetPixelGreen(q)));\n SetPixelBlue(q,ScaleQuantumToShort(\n GetPixelBlue(q)));\n SetPixelOpacity(q,ScaleQuantumToShort(\n GetPixelOpacity(q)));\n q++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n#else\n#define QM Quantum\n#endif\n\n if (image->matte != MagickFalse)\n (void) SetImageBackgroundColor(large_image);\n\n else\n {\n large_image->background_color.opacity=OpaqueOpacity;\n (void) SetImageBackgroundColor(large_image);\n\n if (magn_methx == 4)\n magn_methx=2;\n\n if (magn_methx == 5)\n magn_methx=3;\n\n if (magn_methy == 4)\n magn_methy=2;\n\n if (magn_methy == 5)\n magn_methy=3;\n }\n\n /* magnify the rows into the right side of the large image */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Magnify the rows to %.20g\",(double) large_image->rows);\n m=(ssize_t) mng_info->magn_mt;\n yy=0;\n length=(size_t) image->columns;\n next=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*next));\n prev=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*prev));\n\n if ((prev == (PixelPacket *) NULL) ||\n (next == (PixelPacket *) NULL))\n {\n image=DestroyImageList(image);\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n\n n=GetAuthenticPixels(image,0,0,image->columns,1,exception);\n (void) CopyMagickMemory(next,n,length);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (y == 0)\n m=(ssize_t) mng_info->magn_mt;\n\n else if (magn_methy > 1 && y == (ssize_t) image->rows-2)\n m=(ssize_t) mng_info->magn_mb;\n\n else if (magn_methy <= 1 && y == (ssize_t) image->rows-1)\n m=(ssize_t) mng_info->magn_mb;\n\n else if (magn_methy > 1 && y == (ssize_t) image->rows-1)\n m=1;\n\n else\n m=(ssize_t) mng_info->magn_my;\n\n n=prev;\n prev=next;\n next=n;\n\n if (y < (ssize_t) image->rows-1)\n {\n n=GetAuthenticPixels(image,0,y+1,image->columns,1,\n exception);\n (void) CopyMagickMemory(next,n,length);\n }\n\n for (i=0; i < m; i++, yy++)\n {\n register PixelPacket\n *pixels;\n\n assert(yy < (ssize_t) large_image->rows);\n pixels=prev;\n n=next;\n q=GetAuthenticPixels(large_image,0,yy,large_image->columns,\n 1,exception);\n q+=(large_image->columns-image->columns);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n /* To do: get color as function of indexes[x] */\n /*\n if (image->storage_class == PseudoClass)\n {\n }\n */\n\n if (magn_methy <= 1)\n {\n /* replicate previous */\n SetPixelRGBO(q,(pixels));\n }\n\n else if (magn_methy == 2 || magn_methy == 4)\n {\n if (i == 0)\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n /* Interpolate */\n SetPixelRed(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelRed(n)\n -GetPixelRed(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelRed(pixels)))));\n SetPixelGreen(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelGreen(n)\n -GetPixelGreen(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelGreen(pixels)))));\n SetPixelBlue(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelBlue(n)\n -GetPixelBlue(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelBlue(pixels)))));\n\n if (image->matte != MagickFalse)\n SetPixelOpacity(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelOpacity(n)\n -GetPixelOpacity(pixels)+m))\n /((ssize_t) (m*2))+\n GetPixelOpacity(pixels)))));\n }\n\n if (magn_methy == 4)\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n SetPixelOpacity(q,\n (*pixels).opacity+0);\n else\n SetPixelOpacity(q,\n (*n).opacity+0);\n }\n }\n\n else /* if (magn_methy == 3 || magn_methy == 5) */\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n SetPixelRGBO(q,(n));\n }\n\n if (magn_methy == 5)\n {\n SetPixelOpacity(q,\n (QM) (((ssize_t) (2*i*\n (GetPixelOpacity(n)\n -GetPixelOpacity(pixels))\n +m))/((ssize_t) (m*2))\n +GetPixelOpacity(pixels)));\n }\n }\n n++;\n q++;\n pixels++;\n } /* x */\n\n if (SyncAuthenticPixels(large_image,exception) == 0)\n break;\n\n } /* i */\n } /* y */\n\n prev=(PixelPacket *) RelinquishMagickMemory(prev);\n next=(PixelPacket *) RelinquishMagickMemory(next);\n\n length=image->columns;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Delete original image\");\n\n DeleteImageFromList(&image);\n\n image=large_image;\n\n mng_info->image=image;\n\n /* magnify the columns */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Magnify the columns to %.20g\",(double) image->columns);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register PixelPacket\n *pixels;\n\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n pixels=q+(image->columns-length);\n n=pixels+1;\n\n for (x=(ssize_t) (image->columns-length);\n x < (ssize_t) image->columns; x++)\n {\n /* To do: Rewrite using Get/Set***PixelComponent() */\n\n if (x == (ssize_t) (image->columns-length))\n m=(ssize_t) mng_info->magn_ml;\n\n else if (magn_methx > 1 && x == (ssize_t) image->columns-2)\n m=(ssize_t) mng_info->magn_mr;\n\n else if (magn_methx <= 1 && x == (ssize_t) image->columns-1)\n m=(ssize_t) mng_info->magn_mr;\n\n else if (magn_methx > 1 && x == (ssize_t) image->columns-1)\n m=1;\n\n else\n m=(ssize_t) mng_info->magn_mx;\n\n for (i=0; i < m; i++)\n {\n if (magn_methx <= 1)\n {\n /* replicate previous */\n SetPixelRGBO(q,(pixels));\n }\n\n else if (magn_methx == 2 || magn_methx == 4)\n {\n if (i == 0)\n {\n SetPixelRGBO(q,(pixels));\n }\n\n /* To do: Rewrite using Get/Set***PixelComponent() */\n else\n {\n /* Interpolate */\n SetPixelRed(q,\n (QM) ((2*i*(\n GetPixelRed(n)\n -GetPixelRed(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelRed(pixels)));\n\n SetPixelGreen(q,\n (QM) ((2*i*(\n GetPixelGreen(n)\n -GetPixelGreen(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelGreen(pixels)));\n\n SetPixelBlue(q,\n (QM) ((2*i*(\n GetPixelBlue(n)\n -GetPixelBlue(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelBlue(pixels)));\n if (image->matte != MagickFalse)\n SetPixelOpacity(q,\n (QM) ((2*i*(\n GetPixelOpacity(n)\n -GetPixelOpacity(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelOpacity(pixels)));\n }\n\n if (magn_methx == 4)\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelOpacity(q,\n GetPixelOpacity(pixels)+0);\n }\n else\n {\n SetPixelOpacity(q,\n GetPixelOpacity(n)+0);\n }\n }\n }\n\n else /* if (magn_methx == 3 || magn_methx == 5) */\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n SetPixelRGBO(q,(n));\n }\n\n if (magn_methx == 5)\n {\n /* Interpolate */\n SetPixelOpacity(q,\n (QM) ((2*i*( GetPixelOpacity(n)\n -GetPixelOpacity(pixels))+m)/\n ((ssize_t) (m*2))\n +GetPixelOpacity(pixels)));\n }\n }\n q++;\n }\n n++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n if (magn_methx != 1 || magn_methy != 1)\n {\n /*\n Rescale pixels to Quantum\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n SetPixelRed(q,ScaleShortToQuantum(\n GetPixelRed(q)));\n SetPixelGreen(q,ScaleShortToQuantum(\n GetPixelGreen(q)));\n SetPixelBlue(q,ScaleShortToQuantum(\n GetPixelBlue(q)));\n SetPixelOpacity(q,ScaleShortToQuantum(\n GetPixelOpacity(q)));\n q++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n#endif\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished MAGN processing\");\n }\n }\n\n /*\n Crop_box is with respect to the upper left corner of the MNG.\n */\n crop_box.left=mng_info->image_box.left+mng_info->x_off[object_id];\n crop_box.right=mng_info->image_box.right+mng_info->x_off[object_id];\n crop_box.top=mng_info->image_box.top+mng_info->y_off[object_id];\n crop_box.bottom=mng_info->image_box.bottom+mng_info->y_off[object_id];\n crop_box=mng_minimum_box(crop_box,mng_info->clip);\n crop_box=mng_minimum_box(crop_box,mng_info->frame);\n crop_box=mng_minimum_box(crop_box,mng_info->object_clip[object_id]);\n if ((crop_box.left != (mng_info->image_box.left\n +mng_info->x_off[object_id])) ||\n (crop_box.right != (mng_info->image_box.right\n +mng_info->x_off[object_id])) ||\n (crop_box.top != (mng_info->image_box.top\n +mng_info->y_off[object_id])) ||\n (crop_box.bottom != (mng_info->image_box.bottom\n +mng_info->y_off[object_id])))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Crop the PNG image\");\n\n if ((crop_box.left < crop_box.right) &&\n (crop_box.top < crop_box.bottom))\n {\n Image\n *im;\n\n RectangleInfo\n crop_info;\n\n /*\n Crop_info is with respect to the upper left corner of\n the image.\n */\n crop_info.x=(crop_box.left-mng_info->x_off[object_id]);\n crop_info.y=(crop_box.top-mng_info->y_off[object_id]);\n crop_info.width=(size_t) (crop_box.right-crop_box.left);\n crop_info.height=(size_t) (crop_box.bottom-crop_box.top);\n image->page.width=image->columns;\n image->page.height=image->rows;\n image->page.x=0;\n image->page.y=0;\n im=CropImage(image,&crop_info,exception);\n\n if (im != (Image *) NULL)\n {\n image->columns=im->columns;\n image->rows=im->rows;\n im=DestroyImage(im);\n image->page.width=image->columns;\n image->page.height=image->rows;\n image->page.x=crop_box.left;\n image->page.y=crop_box.top;\n }\n }\n\n else\n {\n /*\n No pixels in crop area. The MNG spec still requires\n a layer, though, so make a single transparent pixel in\n the top left corner.\n */\n image->columns=1;\n image->rows=1;\n image->colors=2;\n (void) SetImageBackgroundColor(image);\n image->page.width=1;\n image->page.height=1;\n image->page.x=0;\n image->page.y=0;\n }\n }\n#ifndef PNG_READ_EMPTY_PLTE_SUPPORTED\n image=mng_info->image;\n#endif\n }\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n /* PNG does not handle depths greater than 16 so reduce it even\n * if lossy, and promote any depths > 8 to 16.\n */\n if (image->depth > 16)\n image->depth=16;\n#endif\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 8)\n if (image->depth > 8)\n {\n /* To do: fill low byte properly */\n image->depth=16;\n }\n\n if (LosslessReduceDepthOK(image) != MagickFalse)\n image->depth = 8;\n#endif\n\n GetImageException(image,exception);\n\n if (image_info->number_scenes != 0)\n {\n if (mng_info->scenes_found >\n (ssize_t) (image_info->first_scene+image_info->number_scenes))\n break;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished reading image datastream.\");\n\n } while (LocaleCompare(image_info->magick,\"MNG\") == 0);\n\n (void) CloseBlob(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished reading all image datastreams.\");\n\n#if defined(MNG_INSERT_LAYERS)\n if (insert_layers && !mng_info->image_found && (mng_info->mng_width) &&\n (mng_info->mng_height))\n {\n /*\n Insert a background layer if nothing else was found.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No images found. Inserting a background layer.\");\n\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocation failed, returning NULL.\");\n\n return(DestroyImageList(image));\n }\n image=SyncNextImageInList(image);\n }\n image->columns=mng_info->mng_width;\n image->rows=mng_info->mng_height;\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=0;\n image->page.y=0;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n\n if (image_info->ping == MagickFalse)\n (void) SetImageBackgroundColor(image);\n\n mng_info->image_found++;\n }\n#endif\n image->iterations=mng_iterations;\n\n if (mng_iterations == 1)\n image->start_loop=MagickTrue;\n\n while (GetPreviousImageInList(image) != (Image *) NULL)\n {\n image_count++;\n if (image_count > 10*mng_info->image_found)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" No beginning\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"Linked list is corrupted, beginning of list not found\",\n \"`%s'\",image_info->filename);\n\n return(DestroyImageList(image));\n }\n\n image=GetPreviousImageInList(image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Corrupt list\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"Linked list is corrupted; next_image is NULL\",\"`%s'\",\n image_info->filename);\n }\n }\n\n if (mng_info->ticks_per_second && mng_info->image_found > 1 &&\n GetNextImageInList(image) ==\n (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" First image null\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"image->next for first image is NULL but shouldn't be.\",\n \"`%s'\",image_info->filename);\n }\n\n if (mng_info->image_found == 0)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No visible images found.\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"No visible images in file\",\"`%s'\",image_info->filename);\n\n return(DestroyImageList(image));\n }\n\n if (mng_info->ticks_per_second)\n final_delay=1UL*MagickMax(image->ticks_per_second,1L)*\n final_delay/mng_info->ticks_per_second;\n\n else\n image->start_loop=MagickTrue;\n\n /* Find final nonzero image delay */\n final_image_delay=0;\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n if (image->delay)\n final_image_delay=image->delay;\n\n image=GetNextImageInList(image);\n }\n\n if (final_delay < final_image_delay)\n final_delay=final_image_delay;\n\n image->delay=final_delay;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->delay=%.20g, final_delay=%.20g\",(double) image->delay,\n (double) final_delay);\n\n if (logging != MagickFalse)\n {\n int\n scene;\n\n scene=0;\n image=GetFirstImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Before coalesce:\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene 0 delay=%.20g\",(double) image->delay);\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n image=GetNextImageInList(image);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene %.20g delay=%.20g\",(double) scene++,(double) image->delay);\n }\n }\n\n image=GetFirstImageInList(image);\n#ifdef MNG_COALESCE_LAYERS\n if (insert_layers)\n {\n Image\n *next_image,\n *next;\n\n size_t\n scene;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Coalesce Images\");\n\n scene=image->scene;\n next_image=CoalesceImages(image,&image->exception);\n\n if (next_image == (Image *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n image=DestroyImageList(image);\n image=next_image;\n\n for (next=image; next != (Image *) NULL; next=next_image)\n {\n next->page.width=mng_info->mng_width;\n next->page.height=mng_info->mng_height;\n next->page.x=0;\n next->page.y=0;\n next->scene=scene++;\n next_image=GetNextImageInList(next);\n\n if (next_image == (Image *) NULL)\n break;\n\n if (next->delay == 0)\n {\n scene--;\n next_image->previous=GetPreviousImageInList(next);\n if (GetPreviousImageInList(next) == (Image *) NULL)\n image=next_image;\n else\n next->previous->next=next_image;\n next=DestroyImage(next);\n }\n }\n }\n#endif\n\n while (GetNextImageInList(image) != (Image *) NULL)\n image=GetNextImageInList(image);\n\n image->dispose=BackgroundDispose;\n\n if (logging != MagickFalse)\n {\n int\n scene;\n\n scene=0;\n image=GetFirstImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" After coalesce:\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene 0 delay=%.20g dispose=%.20g\",(double) image->delay,\n (double) image->dispose);\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n image=GetNextImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene %.20g delay=%.20g dispose=%.20g\",(double) scene++,\n (double) image->delay,(double) image->dispose);\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" exit ReadOneJNGImage();\");\n\n return(image);\n}","target":"static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n char\n page_geometry[MaxTextExtent];\n\n Image\n *image;\n\n MagickBooleanType\n logging;\n\n volatile int\n first_mng_object,\n object_id,\n term_chunk_found,\n skip_to_iend;\n\n volatile ssize_t\n image_count=0;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n offset;\n\n MngBox\n default_fb,\n fb,\n previous_fb;\n\n#if defined(MNG_INSERT_LAYERS)\n PixelPacket\n mng_background_color;\n#endif\n\n register unsigned char\n *p;\n\n register ssize_t\n i;\n\n size_t\n count;\n\n ssize_t\n loop_level;\n\n volatile short\n skipping_loop;\n\n#if defined(MNG_INSERT_LAYERS)\n unsigned int\n mandatory_back=0;\n#endif\n\n volatile unsigned int\n#ifdef MNG_OBJECT_BUFFERS\n mng_background_object=0,\n#endif\n mng_type=0; /* 0: PNG or JNG; 1: MNG; 2: MNG-LC; 3: MNG-VLC */\n\n size_t\n default_frame_timeout,\n frame_timeout,\n#if defined(MNG_INSERT_LAYERS)\n image_height,\n image_width,\n#endif\n length;\n\n /* These delays are all measured in image ticks_per_second,\n * not in MNG ticks_per_second\n */\n volatile size_t\n default_frame_delay,\n final_delay,\n final_image_delay,\n frame_delay,\n#if defined(MNG_INSERT_LAYERS)\n insert_layers,\n#endif\n mng_iterations=1,\n simplicity=0,\n subframe_height=0,\n subframe_width=0;\n\n previous_fb.top=0;\n previous_fb.bottom=0;\n previous_fb.left=0;\n previous_fb.right=0;\n default_fb.top=0;\n default_fb.bottom=0;\n default_fb.left=0;\n default_fb.right=0;\n\n logging=LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter ReadOneMNGImage()\");\n\n image=mng_info->image;\n\n if (LocaleCompare(image_info->magick,\"MNG\") == 0)\n {\n char\n magic_number[MaxTextExtent];\n\n /* Verify MNG signature. */\n count=(size_t) ReadBlob(image,8,(unsigned char *) magic_number);\n if (memcmp(magic_number,\"\\212MNG\\r\\n\\032\\n\",8) != 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n /* Initialize some nonzero members of the MngInfo structure. */\n for (i=0; i < MNG_MAX_OBJECTS; i++)\n {\n mng_info->object_clip[i].right=(ssize_t) PNG_UINT_31_MAX;\n mng_info->object_clip[i].bottom=(ssize_t) PNG_UINT_31_MAX;\n }\n mng_info->exists[0]=MagickTrue;\n }\n\n skipping_loop=(-1);\n first_mng_object=MagickTrue;\n mng_type=0;\n#if defined(MNG_INSERT_LAYERS)\n insert_layers=MagickFalse; /* should be False when converting or mogrifying */\n#endif\n default_frame_delay=0;\n default_frame_timeout=0;\n frame_delay=0;\n final_delay=1;\n mng_info->ticks_per_second=1UL*image->ticks_per_second;\n object_id=0;\n skip_to_iend=MagickFalse;\n term_chunk_found=MagickFalse;\n mng_info->framing_mode=1;\n#if defined(MNG_INSERT_LAYERS)\n mandatory_back=MagickFalse;\n#endif\n#if defined(MNG_INSERT_LAYERS)\n mng_background_color=image->background_color;\n#endif\n default_fb=mng_info->frame;\n previous_fb=mng_info->frame;\n do\n {\n char\n type[MaxTextExtent];\n\n if (LocaleCompare(image_info->magick,\"MNG\") == 0)\n {\n unsigned char\n *chunk;\n\n /*\n Read a new chunk.\n */\n type[0]='\\0';\n (void) ConcatenateMagickString(type,\"errr\",MaxTextExtent);\n length=ReadBlobMSBLong(image);\n count=(size_t) ReadBlob(image,4,(unsigned char *) type);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reading MNG chunk type %c%c%c%c, length: %.20g\",\n type[0],type[1],type[2],type[3],(double) length);\n\n if (length > PNG_UINT_31_MAX)\n {\n status=MagickFalse;\n break;\n }\n\n if (count == 0)\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n\n p=NULL;\n chunk=(unsigned char *) NULL;\n\n if (length != 0)\n {\n chunk=(unsigned char *) AcquireQuantumMemory(length+\n MagickPathExtent,sizeof(*chunk));\n\n if (chunk == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n for (i=0; i < (ssize_t) length; i++)\n {\n int\n c;\n\n c=ReadBlobByte(image);\n if (c == EOF)\n break;\n chunk[i]=(unsigned char) c;\n }\n\n p=chunk;\n }\n\n (void) ReadBlobMSBLong(image); /* read crc word */\n\n#if !defined(JNG_SUPPORTED)\n if (memcmp(type,mng_JHDR,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->jhdr_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"JNGCompressNotSupported\",\"`%s'\",image->filename);\n\n mng_info->jhdr_warning++;\n }\n#endif\n if (memcmp(type,mng_DHDR,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->dhdr_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"DeltaPNGNotSupported\",\"`%s'\",image->filename);\n\n mng_info->dhdr_warning++;\n }\n if (memcmp(type,mng_MEND,4) == 0)\n break;\n\n if (skip_to_iend)\n {\n if (memcmp(type,mng_IEND,4) == 0)\n skip_to_iend=MagickFalse;\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Skip to IEND.\");\n\n continue;\n }\n\n if (memcmp(type,mng_MHDR,4) == 0)\n {\n if (length != 28)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n }\n\n mng_info->mng_width=(size_t) ((p[0] << 24) | (p[1] << 16) |\n (p[2] << 8) | p[3]);\n\n mng_info->mng_height=(size_t) ((p[4] << 24) | (p[5] << 16) |\n (p[6] << 8) | p[7]);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MNG width: %.20g\",(double) mng_info->mng_width);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MNG height: %.20g\",(double) mng_info->mng_height);\n }\n\n p+=8;\n mng_info->ticks_per_second=(size_t) mng_get_long(p);\n\n if (mng_info->ticks_per_second == 0)\n default_frame_delay=0;\n\n else\n default_frame_delay=1UL*image->ticks_per_second/\n mng_info->ticks_per_second;\n\n frame_delay=default_frame_delay;\n simplicity=0;\n\n /* Skip nominal layer count, frame count, and play time */\n p+=16;\n simplicity=(size_t) mng_get_long(p);\n\n mng_type=1; /* Full MNG */\n\n if ((simplicity != 0) && ((simplicity | 11) == 11))\n mng_type=2; /* LC */\n\n if ((simplicity != 0) && ((simplicity | 9) == 9))\n mng_type=3; /* VLC */\n\n#if defined(MNG_INSERT_LAYERS)\n if (mng_type != 3)\n insert_layers=MagickTrue;\n#endif\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n mng_info->image=image;\n }\n\n if ((mng_info->mng_width > 65535L) ||\n (mng_info->mng_height > 65535L))\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(ImageError,\"WidthOrHeightExceedsLimit\");\n }\n\n (void) FormatLocaleString(page_geometry,MaxTextExtent,\n \"%.20gx%.20g+0+0\",(double) mng_info->mng_width,(double)\n mng_info->mng_height);\n\n mng_info->frame.left=0;\n mng_info->frame.right=(ssize_t) mng_info->mng_width;\n mng_info->frame.top=0;\n mng_info->frame.bottom=(ssize_t) mng_info->mng_height;\n mng_info->clip=default_fb=previous_fb=mng_info->frame;\n\n for (i=0; i < MNG_MAX_OBJECTS; i++)\n mng_info->object_clip[i]=mng_info->frame;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_TERM,4) == 0)\n {\n int\n repeat=0;\n\n if (length != 0)\n repeat=p[0];\n\n if (repeat == 3 && length > 8)\n {\n final_delay=(png_uint_32) mng_get_long(&p[2]);\n mng_iterations=(png_uint_32) mng_get_long(&p[6]);\n\n if (mng_iterations == PNG_UINT_31_MAX)\n mng_iterations=0;\n\n image->iterations=mng_iterations;\n term_chunk_found=MagickTrue;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" repeat=%d, final_delay=%.20g, iterations=%.20g\",\n repeat,(double) final_delay, (double) image->iterations);\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_DEFI,4) == 0)\n {\n if (mng_type == 3)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"DEFI chunk found in MNG-VLC datastream\",\"`%s'\",\n image->filename);\n\n if (length > 1)\n {\n object_id=(p[0] << 8) | p[1];\n\n if (mng_type == 2 && object_id != 0)\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),\n CoderError,\"Nonzero object_id in MNG-LC datastream\",\n \"`%s'\", image->filename);\n\n if (object_id > MNG_MAX_OBJECTS)\n {\n /*\n Instead of using a warning we should allocate a larger\n MngInfo structure and continue.\n */\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(), CoderError,\n \"object id too large\",\"`%s'\",image->filename);\n object_id=MNG_MAX_OBJECTS;\n }\n\n if (mng_info->exists[object_id])\n if (mng_info->frozen[object_id])\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"DEFI cannot redefine a frozen MNG object\",\"`%s'\",\n image->filename);\n continue;\n }\n\n mng_info->exists[object_id]=MagickTrue;\n\n if (length > 2)\n mng_info->invisible[object_id]=p[2];\n\n /*\n Extract object offset info.\n */\n if (length > 11)\n {\n mng_info->x_off[object_id]=(ssize_t) ((p[4] << 24) |\n (p[5] << 16) | (p[6] << 8) | p[7]);\n\n mng_info->y_off[object_id]=(ssize_t) ((p[8] << 24) |\n (p[9] << 16) | (p[10] << 8) | p[11]);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" x_off[%d]: %.20g, y_off[%d]: %.20g\",\n object_id,(double) mng_info->x_off[object_id],\n object_id,(double) mng_info->y_off[object_id]);\n }\n }\n\n /*\n Extract object clipping info.\n */\n \n if (length > 27)\n mng_info->object_clip[object_id]=\n mng_read_box(mng_info->frame,0, &p[12]);\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_bKGD,4) == 0)\n {\n mng_info->have_global_bkgd=MagickFalse;\n\n if (length > 5)\n {\n mng_info->mng_global_bkgd.red=\n ScaleShortToQuantum((unsigned short) ((p[0] << 8) | p[1]));\n\n mng_info->mng_global_bkgd.green=\n ScaleShortToQuantum((unsigned short) ((p[2] << 8) | p[3]));\n\n mng_info->mng_global_bkgd.blue=\n ScaleShortToQuantum((unsigned short) ((p[4] << 8) | p[5]));\n\n mng_info->have_global_bkgd=MagickTrue;\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_BACK,4) == 0)\n {\n#if defined(MNG_INSERT_LAYERS)\n if (length > 6)\n mandatory_back=p[6];\n\n else\n mandatory_back=0;\n\n if (mandatory_back && length > 5)\n {\n mng_background_color.red=\n ScaleShortToQuantum((unsigned short) ((p[0] << 8) | p[1]));\n\n mng_background_color.green=\n ScaleShortToQuantum((unsigned short) ((p[2] << 8) | p[3]));\n\n mng_background_color.blue=\n ScaleShortToQuantum((unsigned short) ((p[4] << 8) | p[5]));\n\n mng_background_color.opacity=OpaqueOpacity;\n }\n\n#ifdef MNG_OBJECT_BUFFERS\n if (length > 8)\n mng_background_object=(p[7] << 8) | p[8];\n#endif\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_PLTE,4) == 0)\n {\n /* Read global PLTE. */\n\n if (length && (length < 769))\n {\n if (mng_info->global_plte == (png_colorp) NULL)\n mng_info->global_plte=(png_colorp) AcquireQuantumMemory(256,\n sizeof(*mng_info->global_plte));\n\n for (i=0; i < (ssize_t) (length/3); i++)\n {\n mng_info->global_plte[i].red=p[3*i];\n mng_info->global_plte[i].green=p[3*i+1];\n mng_info->global_plte[i].blue=p[3*i+2];\n }\n\n mng_info->global_plte_length=(unsigned int) (length/3);\n }\n#ifdef MNG_LOOSE\n for ( ; i < 256; i++)\n {\n mng_info->global_plte[i].red=i;\n mng_info->global_plte[i].green=i;\n mng_info->global_plte[i].blue=i;\n }\n\n if (length != 0)\n mng_info->global_plte_length=256;\n#endif\n else\n mng_info->global_plte_length=0;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_tRNS,4) == 0)\n {\n /* read global tRNS */\n\n if (length > 0 && length < 257)\n for (i=0; i < (ssize_t) length; i++)\n mng_info->global_trns[i]=p[i];\n\n#ifdef MNG_LOOSE\n for ( ; i < 256; i++)\n mng_info->global_trns[i]=255;\n#endif\n mng_info->global_trns_length=(unsigned int) length;\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_gAMA,4) == 0)\n {\n if (length == 4)\n {\n ssize_t\n igamma;\n\n igamma=mng_get_long(p);\n mng_info->global_gamma=((float) igamma)*0.00001;\n mng_info->have_global_gama=MagickTrue;\n }\n\n else\n mng_info->have_global_gama=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_cHRM,4) == 0)\n {\n /* Read global cHRM */\n\n if (length == 32)\n {\n mng_info->global_chrm.white_point.x=0.00001*mng_get_long(p);\n mng_info->global_chrm.white_point.y=0.00001*mng_get_long(&p[4]);\n mng_info->global_chrm.red_primary.x=0.00001*mng_get_long(&p[8]);\n mng_info->global_chrm.red_primary.y=0.00001*\n mng_get_long(&p[12]);\n mng_info->global_chrm.green_primary.x=0.00001*\n mng_get_long(&p[16]);\n mng_info->global_chrm.green_primary.y=0.00001*\n mng_get_long(&p[20]);\n mng_info->global_chrm.blue_primary.x=0.00001*\n mng_get_long(&p[24]);\n mng_info->global_chrm.blue_primary.y=0.00001*\n mng_get_long(&p[28]);\n mng_info->have_global_chrm=MagickTrue;\n }\n else\n mng_info->have_global_chrm=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_sRGB,4) == 0)\n {\n /*\n Read global sRGB.\n */\n if (length != 0)\n {\n mng_info->global_srgb_intent=\n Magick_RenderingIntent_from_PNG_RenderingIntent(p[0]);\n mng_info->have_global_srgb=MagickTrue;\n }\n else\n mng_info->have_global_srgb=MagickFalse;\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_iCCP,4) == 0)\n {\n /* To do: */\n\n /*\n Read global iCCP.\n */\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if (memcmp(type,mng_FRAM,4) == 0)\n {\n if (mng_type == 3)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"FRAM chunk found in MNG-VLC datastream\",\"`%s'\",\n image->filename);\n\n if ((mng_info->framing_mode == 2) || (mng_info->framing_mode == 4))\n image->delay=frame_delay;\n\n frame_delay=default_frame_delay;\n frame_timeout=default_frame_timeout;\n fb=default_fb;\n\n if (length > 0)\n if (p[0])\n mng_info->framing_mode=p[0];\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_mode=%d\",mng_info->framing_mode);\n\n if (length > 6)\n {\n /* Note the delay and frame clipping boundaries. */\n\n p++; /* framing mode */\n\n while (*p && ((p-chunk) < (ssize_t) length))\n p++; /* frame name */\n\n p++; /* frame name terminator */\n\n if ((p-chunk) < (ssize_t) (length-4))\n {\n int\n change_delay,\n change_timeout,\n change_clipping;\n\n change_delay=(*p++);\n change_timeout=(*p++);\n change_clipping=(*p++);\n p++; /* change_sync */\n\n if (change_delay && (p-chunk) < (ssize_t) (length-4))\n {\n frame_delay=1UL*image->ticks_per_second*\n mng_get_long(p);\n\n if (mng_info->ticks_per_second != 0)\n frame_delay/=mng_info->ticks_per_second;\n\n else\n frame_delay=PNG_UINT_31_MAX;\n\n if (change_delay == 2)\n default_frame_delay=frame_delay;\n\n p+=4;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_delay=%.20g\",(double) frame_delay);\n }\n\n if (change_timeout && (p-chunk) < (ssize_t) (length-4))\n {\n frame_timeout=1UL*image->ticks_per_second*\n mng_get_long(p);\n\n if (mng_info->ticks_per_second != 0)\n frame_timeout/=mng_info->ticks_per_second;\n\n else\n frame_timeout=PNG_UINT_31_MAX;\n\n if (change_timeout == 2)\n default_frame_timeout=frame_timeout;\n\n p+=4;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Framing_timeout=%.20g\",(double) frame_timeout);\n }\n\n if (change_clipping && (p-chunk) < (ssize_t) (length-17))\n {\n fb=mng_read_box(previous_fb,(char) p[0],&p[1]);\n p+=17;\n previous_fb=fb;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Frame_clip: L=%.20g R=%.20g T=%.20g B=%.20g\",\n (double) fb.left,(double) fb.right,(double) fb.top,\n (double) fb.bottom);\n\n if (change_clipping == 2)\n default_fb=fb;\n }\n }\n }\n mng_info->clip=fb;\n mng_info->clip=mng_minimum_box(fb,mng_info->frame);\n\n subframe_width=(size_t) (mng_info->clip.right\n -mng_info->clip.left);\n\n subframe_height=(size_t) (mng_info->clip.bottom\n -mng_info->clip.top);\n /*\n Insert a background layer behind the frame if framing_mode is 4.\n */\n#if defined(MNG_INSERT_LAYERS)\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" subframe_width=%.20g, subframe_height=%.20g\",(double)\n subframe_width,(double) subframe_height);\n\n if (insert_layers && (mng_info->framing_mode == 4) &&\n (subframe_width) && (subframe_height))\n {\n /* Allocate next image structure. */\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n image->columns=subframe_width;\n image->rows=subframe_height;\n image->page.width=subframe_width;\n image->page.height=subframe_height;\n image->page.x=mng_info->clip.left;\n image->page.y=mng_info->clip.top;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n image->delay=0;\n (void) SetImageBackgroundColor(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Insert backgd layer, L=%.20g, R=%.20g T=%.20g, B=%.20g\",\n (double) mng_info->clip.left,(double) mng_info->clip.right,\n (double) mng_info->clip.top,(double) mng_info->clip.bottom);\n }\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_CLIP,4) == 0)\n {\n unsigned int\n first_object,\n last_object;\n\n /*\n Read CLIP.\n */\n if (length > 3)\n {\n first_object=(p[0] << 8) | p[1];\n last_object=(p[2] << 8) | p[3];\n p+=4;\n\n for (i=(int) first_object; i <= (int) last_object; i++)\n {\n if (mng_info->exists[i] && !mng_info->frozen[i])\n {\n MngBox\n box;\n\n box=mng_info->object_clip[i];\n if ((p-chunk) < (ssize_t) (length-17))\n mng_info->object_clip[i]=\n mng_read_box(box,(char) p[0],&p[1]);\n }\n }\n\n }\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n if (memcmp(type,mng_SAVE,4) == 0)\n {\n for (i=1; i < MNG_MAX_OBJECTS; i++)\n if (mng_info->exists[i])\n {\n mng_info->frozen[i]=MagickTrue;\n#ifdef MNG_OBJECT_BUFFERS\n if (mng_info->ob[i] != (MngBuffer *) NULL)\n mng_info->ob[i]->frozen=MagickTrue;\n#endif\n }\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if ((memcmp(type,mng_DISC,4) == 0) || (memcmp(type,mng_SEEK,4) == 0))\n {\n /* Read DISC or SEEK. */\n\n if ((length == 0) || !memcmp(type,mng_SEEK,4))\n {\n for (i=1; i < MNG_MAX_OBJECTS; i++)\n MngInfoDiscardObject(mng_info,i);\n }\n\n else\n {\n register ssize_t\n j;\n\n for (j=1; j < (ssize_t) length; j+=2)\n {\n i=p[j-1] << 8 | p[j];\n MngInfoDiscardObject(mng_info,i);\n }\n }\n\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n\n if (memcmp(type,mng_MOVE,4) == 0)\n {\n size_t\n first_object,\n last_object;\n\n /* read MOVE */\n\n if (length > 3)\n {\n first_object=(p[0] << 8) | p[1];\n last_object=(p[2] << 8) | p[3];\n p+=4;\n\n for (i=(ssize_t) first_object; i <= (ssize_t) last_object; i++)\n {\n if ((i < 0) || (i >= MNG_MAX_OBJECTS))\n continue;\n if (mng_info->exists[i] && !mng_info->frozen[i] &&\n (p-chunk) < (ssize_t) (length-8))\n {\n MngPair\n new_pair;\n\n MngPair\n old_pair;\n\n old_pair.a=mng_info->x_off[i];\n old_pair.b=mng_info->y_off[i];\n new_pair=mng_read_pair(old_pair,(int) p[0],&p[1]);\n mng_info->x_off[i]=new_pair.a;\n mng_info->y_off[i]=new_pair.b;\n }\n }\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_LOOP,4) == 0)\n {\n ssize_t loop_iters=1;\n if (length > 4)\n {\n loop_level=chunk[0];\n mng_info->loop_active[loop_level]=1; /* mark loop active */\n\n /* Record starting point. */\n loop_iters=mng_get_long(&chunk[1]);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" LOOP level %.20g has %.20g iterations \",\n (double) loop_level, (double) loop_iters);\n\n if (loop_iters == 0)\n skipping_loop=loop_level;\n\n else\n {\n mng_info->loop_jump[loop_level]=TellBlob(image);\n mng_info->loop_count[loop_level]=loop_iters;\n }\n\n mng_info->loop_iteration[loop_level]=0;\n }\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_ENDL,4) == 0)\n {\n if (length > 0)\n {\n loop_level=chunk[0];\n\n if (skipping_loop > 0)\n {\n if (skipping_loop == loop_level)\n {\n /*\n Found end of zero-iteration loop.\n */\n skipping_loop=(-1);\n mng_info->loop_active[loop_level]=0;\n }\n }\n\n else\n {\n if (mng_info->loop_active[loop_level] == 1)\n {\n mng_info->loop_count[loop_level]--;\n mng_info->loop_iteration[loop_level]++;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ENDL: LOOP level %.20g has %.20g remaining iters \",\n (double) loop_level,(double)\n mng_info->loop_count[loop_level]);\n\n if (mng_info->loop_count[loop_level] != 0)\n {\n offset=SeekBlob(image,\n mng_info->loop_jump[loop_level], SEEK_SET);\n\n if (offset < 0)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(\n chunk);\n ThrowReaderException(CorruptImageError,\n \"ImproperImageHeader\");\n }\n }\n\n else\n {\n short\n last_level;\n\n /*\n Finished loop.\n */\n mng_info->loop_active[loop_level]=0;\n last_level=(-1);\n for (i=0; i < loop_level; i++)\n if (mng_info->loop_active[i] == 1)\n last_level=(short) i;\n loop_level=last_level;\n }\n }\n }\n }\n\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_CLON,4) == 0)\n {\n if (mng_info->clon_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CLON is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->clon_warning++;\n }\n\n if (memcmp(type,mng_MAGN,4) == 0)\n {\n png_uint_16\n magn_first,\n magn_last,\n magn_mb,\n magn_ml,\n magn_mr,\n magn_mt,\n magn_mx,\n magn_my,\n magn_methx,\n magn_methy;\n\n if (length > 1)\n magn_first=(p[0] << 8) | p[1];\n\n else\n magn_first=0;\n\n if (length > 3)\n magn_last=(p[2] << 8) | p[3];\n\n else\n magn_last=magn_first;\n#ifndef MNG_OBJECT_BUFFERS\n if (magn_first || magn_last)\n if (mng_info->magn_warning == 0)\n {\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"MAGN is not implemented yet for nonzero objects\",\n \"`%s'\",image->filename);\n\n mng_info->magn_warning++;\n }\n#endif\n if (length > 4)\n magn_methx=p[4];\n\n else\n magn_methx=0;\n\n if (length > 6)\n magn_mx=(p[5] << 8) | p[6];\n\n else\n magn_mx=1;\n\n if (magn_mx == 0)\n magn_mx=1;\n\n if (length > 8)\n magn_my=(p[7] << 8) | p[8];\n\n else\n magn_my=magn_mx;\n\n if (magn_my == 0)\n magn_my=1;\n\n if (length > 10)\n magn_ml=(p[9] << 8) | p[10];\n\n else\n magn_ml=magn_mx;\n\n if (magn_ml == 0)\n magn_ml=1;\n\n if (length > 12)\n magn_mr=(p[11] << 8) | p[12];\n\n else\n magn_mr=magn_mx;\n\n if (magn_mr == 0)\n magn_mr=1;\n\n if (length > 14)\n magn_mt=(p[13] << 8) | p[14];\n\n else\n magn_mt=magn_my;\n\n if (magn_mt == 0)\n magn_mt=1;\n\n if (length > 16)\n magn_mb=(p[15] << 8) | p[16];\n\n else\n magn_mb=magn_my;\n\n if (magn_mb == 0)\n magn_mb=1;\n\n if (length > 17)\n magn_methy=p[17];\n\n else\n magn_methy=magn_methx;\n\n\n if (magn_methx > 5 || magn_methy > 5)\n if (mng_info->magn_warning == 0)\n {\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"Unknown MAGN method in MNG datastream\",\"`%s'\",\n image->filename);\n\n mng_info->magn_warning++;\n }\n#ifdef MNG_OBJECT_BUFFERS\n /* Magnify existing objects in the range magn_first to magn_last */\n#endif\n if (magn_first == 0 || magn_last == 0)\n {\n /* Save the magnification factors for object 0 */\n mng_info->magn_mb=magn_mb;\n mng_info->magn_ml=magn_ml;\n mng_info->magn_mr=magn_mr;\n mng_info->magn_mt=magn_mt;\n mng_info->magn_mx=magn_mx;\n mng_info->magn_my=magn_my;\n mng_info->magn_methx=magn_methx;\n mng_info->magn_methy=magn_methy;\n }\n }\n\n if (memcmp(type,mng_PAST,4) == 0)\n {\n if (mng_info->past_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"PAST is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->past_warning++;\n }\n\n if (memcmp(type,mng_SHOW,4) == 0)\n {\n if (mng_info->show_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"SHOW is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->show_warning++;\n }\n\n if (memcmp(type,mng_sBIT,4) == 0)\n {\n if (length < 4)\n mng_info->have_global_sbit=MagickFalse;\n\n else\n {\n mng_info->global_sbit.gray=p[0];\n mng_info->global_sbit.red=p[0];\n mng_info->global_sbit.green=p[1];\n mng_info->global_sbit.blue=p[2];\n mng_info->global_sbit.alpha=p[3];\n mng_info->have_global_sbit=MagickTrue;\n }\n }\n if (memcmp(type,mng_pHYs,4) == 0)\n {\n if (length > 8)\n {\n mng_info->global_x_pixels_per_unit=\n (size_t) mng_get_long(p);\n mng_info->global_y_pixels_per_unit=\n (size_t) mng_get_long(&p[4]);\n mng_info->global_phys_unit_type=p[8];\n mng_info->have_global_phys=MagickTrue;\n }\n\n else\n mng_info->have_global_phys=MagickFalse;\n }\n if (memcmp(type,mng_pHYg,4) == 0)\n {\n if (mng_info->phyg_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"pHYg is not implemented.\",\"`%s'\",image->filename);\n\n mng_info->phyg_warning++;\n }\n if (memcmp(type,mng_BASI,4) == 0)\n {\n skip_to_iend=MagickTrue;\n\n if (mng_info->basi_warning == 0)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"BASI is not implemented yet\",\"`%s'\",\n image->filename);\n\n mng_info->basi_warning++;\n#ifdef MNG_BASI_SUPPORTED\n if (length > 11)\n {\n basi_width=(size_t) ((p[0] << 24) | (p[1] << 16) |\n (p[2] << 8) | p[3]);\n basi_height=(size_t) ((p[4] << 24) | (p[5] << 16) |\n (p[6] << 8) | p[7]);\n basi_color_type=p[8];\n basi_compression_method=p[9];\n basi_filter_type=p[10];\n basi_interlace_method=p[11];\n }\n if (length > 13)\n basi_red=(p[12] << 8) & p[13];\n\n else\n basi_red=0;\n\n if (length > 15)\n basi_green=(p[14] << 8) & p[15];\n\n else\n basi_green=0;\n\n if (length > 17)\n basi_blue=(p[16] << 8) & p[17];\n\n else\n basi_blue=0;\n\n if (length > 19)\n basi_alpha=(p[18] << 8) & p[19];\n\n else\n {\n if (basi_sample_depth == 16)\n basi_alpha=65535L;\n else\n basi_alpha=255;\n }\n\n if (length > 20)\n basi_viewable=p[20];\n\n else\n basi_viewable=0;\n\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n\n if (memcmp(type,mng_IHDR,4)\n#if defined(JNG_SUPPORTED)\n && memcmp(type,mng_JHDR,4)\n#endif\n )\n {\n /* Not an IHDR or JHDR chunk */\n if (length != 0)\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n continue;\n }\n/* Process IHDR */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Processing %c%c%c%c chunk\",type[0],type[1],type[2],type[3]);\n\n mng_info->exists[object_id]=MagickTrue;\n mng_info->viewable[object_id]=MagickTrue;\n\n if (mng_info->invisible[object_id])\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Skipping invisible object\");\n\n skip_to_iend=MagickTrue;\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n continue;\n }\n#if defined(MNG_INSERT_LAYERS)\n if (length < 8)\n {\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n image_width=(size_t) mng_get_long(p);\n image_height=(size_t) mng_get_long(&p[4]);\n#endif\n chunk=(unsigned char *) RelinquishMagickMemory(chunk);\n\n /*\n Insert a transparent background layer behind the entire animation\n if it is not full screen.\n */\n#if defined(MNG_INSERT_LAYERS)\n if (insert_layers && mng_type && first_mng_object)\n {\n if ((mng_info->clip.left > 0) || (mng_info->clip.top > 0) ||\n (image_width < mng_info->mng_width) ||\n (mng_info->clip.right < (ssize_t) mng_info->mng_width) ||\n (image_height < mng_info->mng_height) ||\n (mng_info->clip.bottom < (ssize_t) mng_info->mng_height))\n {\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n /* Make a background rectangle. */\n\n image->delay=0;\n image->columns=mng_info->mng_width;\n image->rows=mng_info->mng_height;\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=0;\n image->page.y=0;\n image->background_color=mng_background_color;\n (void) SetImageBackgroundColor(image);\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Inserted transparent background layer, W=%.20g, H=%.20g\",\n (double) mng_info->mng_width,(double) mng_info->mng_height);\n }\n }\n /*\n Insert a background layer behind the upcoming image if\n framing_mode is 3, and we haven't already inserted one.\n */\n if (insert_layers && (mng_info->framing_mode == 3) &&\n (subframe_width) && (subframe_height) && (simplicity == 0 ||\n (simplicity & 0x08)))\n {\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n\n mng_info->image=image;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n image->iterations=mng_iterations;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n image->delay=0;\n image->columns=subframe_width;\n image->rows=subframe_height;\n image->page.width=subframe_width;\n image->page.height=subframe_height;\n image->page.x=mng_info->clip.left;\n image->page.y=mng_info->clip.top;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n (void) SetImageBackgroundColor(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Insert background layer, L=%.20g, R=%.20g T=%.20g, B=%.20g\",\n (double) mng_info->clip.left,(double) mng_info->clip.right,\n (double) mng_info->clip.top,(double) mng_info->clip.bottom);\n }\n#endif /* MNG_INSERT_LAYERS */\n first_mng_object=MagickFalse;\n\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n image=SyncNextImageInList(image);\n }\n mng_info->image=image;\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n\n if (status == MagickFalse)\n break;\n\n if (term_chunk_found)\n {\n image->start_loop=MagickTrue;\n term_chunk_found=MagickFalse;\n }\n\n else\n image->start_loop=MagickFalse;\n\n if (mng_info->framing_mode == 1 || mng_info->framing_mode == 3)\n {\n image->delay=frame_delay;\n frame_delay=default_frame_delay;\n }\n\n else\n image->delay=0;\n\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=mng_info->x_off[object_id];\n image->page.y=mng_info->y_off[object_id];\n image->iterations=mng_iterations;\n\n /*\n Seek back to the beginning of the IHDR or JHDR chunk's length field.\n */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Seeking back to beginning of %c%c%c%c chunk\",type[0],type[1],\n type[2],type[3]);\n\n offset=SeekBlob(image,-((ssize_t) length+12),SEEK_CUR);\n\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n mng_info->image=image;\n mng_info->mng_type=mng_type;\n mng_info->object_id=object_id;\n\n if (memcmp(type,mng_IHDR,4) == 0)\n image=ReadOnePNGImage(mng_info,image_info,exception);\n\n#if defined(JNG_SUPPORTED)\n else\n image=ReadOneJNGImage(mng_info,image_info,exception);\n#endif\n\n if (image == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"exit ReadJNGImage() with error\");\n\n return((Image *) NULL);\n }\n\n if (image->columns == 0 || image->rows == 0)\n {\n (void) CloseBlob(image);\n return(DestroyImageList(image));\n }\n\n mng_info->image=image;\n\n if (mng_type)\n {\n MngBox\n crop_box;\n\n if (mng_info->magn_methx || mng_info->magn_methy)\n {\n png_uint_32\n magnified_height,\n magnified_width;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Processing MNG MAGN chunk\");\n\n if (mng_info->magn_methx == 1)\n {\n magnified_width=mng_info->magn_ml;\n\n if (image->columns > 1)\n magnified_width += mng_info->magn_mr;\n\n if (image->columns > 2)\n magnified_width += (png_uint_32)\n ((image->columns-2)*(mng_info->magn_mx));\n }\n\n else\n {\n magnified_width=(png_uint_32) image->columns;\n\n if (image->columns > 1)\n magnified_width += mng_info->magn_ml-1;\n\n if (image->columns > 2)\n magnified_width += mng_info->magn_mr-1;\n\n if (image->columns > 3)\n magnified_width += (png_uint_32)\n ((image->columns-3)*(mng_info->magn_mx-1));\n }\n\n if (mng_info->magn_methy == 1)\n {\n magnified_height=mng_info->magn_mt;\n\n if (image->rows > 1)\n magnified_height += mng_info->magn_mb;\n\n if (image->rows > 2)\n magnified_height += (png_uint_32)\n ((image->rows-2)*(mng_info->magn_my));\n }\n\n else\n {\n magnified_height=(png_uint_32) image->rows;\n\n if (image->rows > 1)\n magnified_height += mng_info->magn_mt-1;\n\n if (image->rows > 2)\n magnified_height += mng_info->magn_mb-1;\n\n if (image->rows > 3)\n magnified_height += (png_uint_32)\n ((image->rows-3)*(mng_info->magn_my-1));\n }\n\n if (magnified_height > image->rows ||\n magnified_width > image->columns)\n {\n Image\n *large_image;\n\n int\n yy;\n\n ssize_t\n m,\n y;\n\n register ssize_t\n x;\n\n register PixelPacket\n *n,\n *q;\n\n PixelPacket\n *next,\n *prev;\n\n png_uint_16\n magn_methx,\n magn_methy;\n\n /* Allocate next image structure. */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocate magnified image\");\n\n AcquireNextImage(image_info,image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n return(DestroyImageList(image));\n\n large_image=SyncNextImageInList(image);\n\n large_image->columns=magnified_width;\n large_image->rows=magnified_height;\n\n magn_methx=mng_info->magn_methx;\n magn_methy=mng_info->magn_methy;\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n#define QM unsigned short\n if (magn_methx != 1 || magn_methy != 1)\n {\n /*\n Scale pixels to unsigned shorts to prevent\n overflow of intermediate values of interpolations\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n SetPixelRed(q,ScaleQuantumToShort(\n GetPixelRed(q)));\n SetPixelGreen(q,ScaleQuantumToShort(\n GetPixelGreen(q)));\n SetPixelBlue(q,ScaleQuantumToShort(\n GetPixelBlue(q)));\n SetPixelOpacity(q,ScaleQuantumToShort(\n GetPixelOpacity(q)));\n q++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n#else\n#define QM Quantum\n#endif\n\n if (image->matte != MagickFalse)\n (void) SetImageBackgroundColor(large_image);\n\n else\n {\n large_image->background_color.opacity=OpaqueOpacity;\n (void) SetImageBackgroundColor(large_image);\n\n if (magn_methx == 4)\n magn_methx=2;\n\n if (magn_methx == 5)\n magn_methx=3;\n\n if (magn_methy == 4)\n magn_methy=2;\n\n if (magn_methy == 5)\n magn_methy=3;\n }\n\n /* magnify the rows into the right side of the large image */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Magnify the rows to %.20g\",(double) large_image->rows);\n m=(ssize_t) mng_info->magn_mt;\n yy=0;\n length=(size_t) image->columns;\n next=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*next));\n prev=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*prev));\n\n if ((prev == (PixelPacket *) NULL) ||\n (next == (PixelPacket *) NULL))\n {\n image=DestroyImageList(image);\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n\n n=GetAuthenticPixels(image,0,0,image->columns,1,exception);\n (void) CopyMagickMemory(next,n,length);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (y == 0)\n m=(ssize_t) mng_info->magn_mt;\n\n else if (magn_methy > 1 && y == (ssize_t) image->rows-2)\n m=(ssize_t) mng_info->magn_mb;\n\n else if (magn_methy <= 1 && y == (ssize_t) image->rows-1)\n m=(ssize_t) mng_info->magn_mb;\n\n else if (magn_methy > 1 && y == (ssize_t) image->rows-1)\n m=1;\n\n else\n m=(ssize_t) mng_info->magn_my;\n\n n=prev;\n prev=next;\n next=n;\n\n if (y < (ssize_t) image->rows-1)\n {\n n=GetAuthenticPixels(image,0,y+1,image->columns,1,\n exception);\n (void) CopyMagickMemory(next,n,length);\n }\n\n for (i=0; i < m; i++, yy++)\n {\n register PixelPacket\n *pixels;\n\n assert(yy < (ssize_t) large_image->rows);\n pixels=prev;\n n=next;\n q=GetAuthenticPixels(large_image,0,yy,large_image->columns,\n 1,exception);\n q+=(large_image->columns-image->columns);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n /* To do: get color as function of indexes[x] */\n /*\n if (image->storage_class == PseudoClass)\n {\n }\n */\n\n if (magn_methy <= 1)\n {\n /* replicate previous */\n SetPixelRGBO(q,(pixels));\n }\n\n else if (magn_methy == 2 || magn_methy == 4)\n {\n if (i == 0)\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n /* Interpolate */\n SetPixelRed(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelRed(n)\n -GetPixelRed(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelRed(pixels)))));\n SetPixelGreen(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelGreen(n)\n -GetPixelGreen(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelGreen(pixels)))));\n SetPixelBlue(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelBlue(n)\n -GetPixelBlue(pixels)+m))/\n ((ssize_t) (m*2))\n +GetPixelBlue(pixels)))));\n\n if (image->matte != MagickFalse)\n SetPixelOpacity(q,\n ((QM) (((ssize_t)\n (2*i*(GetPixelOpacity(n)\n -GetPixelOpacity(pixels)+m))\n /((ssize_t) (m*2))+\n GetPixelOpacity(pixels)))));\n }\n\n if (magn_methy == 4)\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n SetPixelOpacity(q,\n (*pixels).opacity+0);\n else\n SetPixelOpacity(q,\n (*n).opacity+0);\n }\n }\n\n else /* if (magn_methy == 3 || magn_methy == 5) */\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n SetPixelRGBO(q,(n));\n }\n\n if (magn_methy == 5)\n {\n SetPixelOpacity(q,\n (QM) (((ssize_t) (2*i*\n (GetPixelOpacity(n)\n -GetPixelOpacity(pixels))\n +m))/((ssize_t) (m*2))\n +GetPixelOpacity(pixels)));\n }\n }\n n++;\n q++;\n pixels++;\n } /* x */\n\n if (SyncAuthenticPixels(large_image,exception) == 0)\n break;\n\n } /* i */\n } /* y */\n\n prev=(PixelPacket *) RelinquishMagickMemory(prev);\n next=(PixelPacket *) RelinquishMagickMemory(next);\n\n length=image->columns;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Delete original image\");\n\n DeleteImageFromList(&image);\n\n image=large_image;\n\n mng_info->image=image;\n\n /* magnify the columns */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Magnify the columns to %.20g\",(double) image->columns);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register PixelPacket\n *pixels;\n\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n pixels=q+(image->columns-length);\n n=pixels+1;\n\n for (x=(ssize_t) (image->columns-length);\n x < (ssize_t) image->columns; x++)\n {\n /* To do: Rewrite using Get/Set***PixelComponent() */\n\n if (x == (ssize_t) (image->columns-length))\n m=(ssize_t) mng_info->magn_ml;\n\n else if (magn_methx > 1 && x == (ssize_t) image->columns-2)\n m=(ssize_t) mng_info->magn_mr;\n\n else if (magn_methx <= 1 && x == (ssize_t) image->columns-1)\n m=(ssize_t) mng_info->magn_mr;\n\n else if (magn_methx > 1 && x == (ssize_t) image->columns-1)\n m=1;\n\n else\n m=(ssize_t) mng_info->magn_mx;\n\n for (i=0; i < m; i++)\n {\n if (magn_methx <= 1)\n {\n /* replicate previous */\n SetPixelRGBO(q,(pixels));\n }\n\n else if (magn_methx == 2 || magn_methx == 4)\n {\n if (i == 0)\n {\n SetPixelRGBO(q,(pixels));\n }\n\n /* To do: Rewrite using Get/Set***PixelComponent() */\n else\n {\n /* Interpolate */\n SetPixelRed(q,\n (QM) ((2*i*(\n GetPixelRed(n)\n -GetPixelRed(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelRed(pixels)));\n\n SetPixelGreen(q,\n (QM) ((2*i*(\n GetPixelGreen(n)\n -GetPixelGreen(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelGreen(pixels)));\n\n SetPixelBlue(q,\n (QM) ((2*i*(\n GetPixelBlue(n)\n -GetPixelBlue(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelBlue(pixels)));\n if (image->matte != MagickFalse)\n SetPixelOpacity(q,\n (QM) ((2*i*(\n GetPixelOpacity(n)\n -GetPixelOpacity(pixels))+m)\n /((ssize_t) (m*2))+\n GetPixelOpacity(pixels)));\n }\n\n if (magn_methx == 4)\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelOpacity(q,\n GetPixelOpacity(pixels)+0);\n }\n else\n {\n SetPixelOpacity(q,\n GetPixelOpacity(n)+0);\n }\n }\n }\n\n else /* if (magn_methx == 3 || magn_methx == 5) */\n {\n /* Replicate nearest */\n if (i <= ((m+1) << 1))\n {\n SetPixelRGBO(q,(pixels));\n }\n\n else\n {\n SetPixelRGBO(q,(n));\n }\n\n if (magn_methx == 5)\n {\n /* Interpolate */\n SetPixelOpacity(q,\n (QM) ((2*i*( GetPixelOpacity(n)\n -GetPixelOpacity(pixels))+m)/\n ((ssize_t) (m*2))\n +GetPixelOpacity(pixels)));\n }\n }\n q++;\n }\n n++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n if (magn_methx != 1 || magn_methy != 1)\n {\n /*\n Rescale pixels to Quantum\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n for (x=(ssize_t) image->columns-1; x >= 0; x--)\n {\n SetPixelRed(q,ScaleShortToQuantum(\n GetPixelRed(q)));\n SetPixelGreen(q,ScaleShortToQuantum(\n GetPixelGreen(q)));\n SetPixelBlue(q,ScaleShortToQuantum(\n GetPixelBlue(q)));\n SetPixelOpacity(q,ScaleShortToQuantum(\n GetPixelOpacity(q)));\n q++;\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n#endif\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished MAGN processing\");\n }\n }\n\n /*\n Crop_box is with respect to the upper left corner of the MNG.\n */\n crop_box.left=mng_info->image_box.left+mng_info->x_off[object_id];\n crop_box.right=mng_info->image_box.right+mng_info->x_off[object_id];\n crop_box.top=mng_info->image_box.top+mng_info->y_off[object_id];\n crop_box.bottom=mng_info->image_box.bottom+mng_info->y_off[object_id];\n crop_box=mng_minimum_box(crop_box,mng_info->clip);\n crop_box=mng_minimum_box(crop_box,mng_info->frame);\n crop_box=mng_minimum_box(crop_box,mng_info->object_clip[object_id]);\n if ((crop_box.left != (mng_info->image_box.left\n +mng_info->x_off[object_id])) ||\n (crop_box.right != (mng_info->image_box.right\n +mng_info->x_off[object_id])) ||\n (crop_box.top != (mng_info->image_box.top\n +mng_info->y_off[object_id])) ||\n (crop_box.bottom != (mng_info->image_box.bottom\n +mng_info->y_off[object_id])))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Crop the PNG image\");\n\n if ((crop_box.left < crop_box.right) &&\n (crop_box.top < crop_box.bottom))\n {\n Image\n *im;\n\n RectangleInfo\n crop_info;\n\n /*\n Crop_info is with respect to the upper left corner of\n the image.\n */\n crop_info.x=(crop_box.left-mng_info->x_off[object_id]);\n crop_info.y=(crop_box.top-mng_info->y_off[object_id]);\n crop_info.width=(size_t) (crop_box.right-crop_box.left);\n crop_info.height=(size_t) (crop_box.bottom-crop_box.top);\n image->page.width=image->columns;\n image->page.height=image->rows;\n image->page.x=0;\n image->page.y=0;\n im=CropImage(image,&crop_info,exception);\n\n if (im != (Image *) NULL)\n {\n image->columns=im->columns;\n image->rows=im->rows;\n im=DestroyImage(im);\n image->page.width=image->columns;\n image->page.height=image->rows;\n image->page.x=crop_box.left;\n image->page.y=crop_box.top;\n }\n }\n\n else\n {\n /*\n No pixels in crop area. The MNG spec still requires\n a layer, though, so make a single transparent pixel in\n the top left corner.\n */\n image->columns=1;\n image->rows=1;\n image->colors=2;\n (void) SetImageBackgroundColor(image);\n image->page.width=1;\n image->page.height=1;\n image->page.x=0;\n image->page.y=0;\n }\n }\n#ifndef PNG_READ_EMPTY_PLTE_SUPPORTED\n image=mng_info->image;\n#endif\n }\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n /* PNG does not handle depths greater than 16 so reduce it even\n * if lossy, and promote any depths > 8 to 16.\n */\n if (image->depth > 16)\n image->depth=16;\n#endif\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 8)\n if (image->depth > 8)\n {\n /* To do: fill low byte properly */\n image->depth=16;\n }\n\n if (LosslessReduceDepthOK(image) != MagickFalse)\n image->depth = 8;\n#endif\n\n GetImageException(image,exception);\n\n if (image_info->number_scenes != 0)\n {\n if (mng_info->scenes_found >\n (ssize_t) (image_info->first_scene+image_info->number_scenes))\n break;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished reading image datastream.\");\n\n } while (LocaleCompare(image_info->magick,\"MNG\") == 0);\n\n (void) CloseBlob(image);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Finished reading all image datastreams.\");\n\n#if defined(MNG_INSERT_LAYERS)\n if (insert_layers && !mng_info->image_found && (mng_info->mng_width) &&\n (mng_info->mng_height))\n {\n /*\n Insert a background layer if nothing else was found.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No images found. Inserting a background layer.\");\n\n if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocation failed, returning NULL.\");\n\n return(DestroyImageList(image));\n }\n image=SyncNextImageInList(image);\n }\n image->columns=mng_info->mng_width;\n image->rows=mng_info->mng_height;\n image->page.width=mng_info->mng_width;\n image->page.height=mng_info->mng_height;\n image->page.x=0;\n image->page.y=0;\n image->background_color=mng_background_color;\n image->matte=MagickFalse;\n\n if (image_info->ping == MagickFalse)\n (void) SetImageBackgroundColor(image);\n\n mng_info->image_found++;\n }\n#endif\n image->iterations=mng_iterations;\n\n if (mng_iterations == 1)\n image->start_loop=MagickTrue;\n\n while (GetPreviousImageInList(image) != (Image *) NULL)\n {\n image_count++;\n if (image_count > 10*mng_info->image_found)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" No beginning\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"Linked list is corrupted, beginning of list not found\",\n \"`%s'\",image_info->filename);\n\n return(DestroyImageList(image));\n }\n\n image=GetPreviousImageInList(image);\n\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Corrupt list\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"Linked list is corrupted; next_image is NULL\",\"`%s'\",\n image_info->filename);\n }\n }\n\n if (mng_info->ticks_per_second && mng_info->image_found > 1 &&\n GetNextImageInList(image) ==\n (Image *) NULL)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" First image null\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"image->next for first image is NULL but shouldn't be.\",\n \"`%s'\",image_info->filename);\n }\n\n if (mng_info->image_found == 0)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No visible images found.\");\n\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"No visible images in file\",\"`%s'\",image_info->filename);\n\n return(DestroyImageList(image));\n }\n\n if (mng_info->ticks_per_second)\n final_delay=1UL*MagickMax(image->ticks_per_second,1L)*\n final_delay/mng_info->ticks_per_second;\n\n else\n image->start_loop=MagickTrue;\n\n /* Find final nonzero image delay */\n final_image_delay=0;\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n if (image->delay)\n final_image_delay=image->delay;\n\n image=GetNextImageInList(image);\n }\n\n if (final_delay < final_image_delay)\n final_delay=final_image_delay;\n\n image->delay=final_delay;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->delay=%.20g, final_delay=%.20g\",(double) image->delay,\n (double) final_delay);\n\n if (logging != MagickFalse)\n {\n int\n scene;\n\n scene=0;\n image=GetFirstImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Before coalesce:\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene 0 delay=%.20g\",(double) image->delay);\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n image=GetNextImageInList(image);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene %.20g delay=%.20g\",(double) scene++,(double) image->delay);\n }\n }\n\n image=GetFirstImageInList(image);\n#ifdef MNG_COALESCE_LAYERS\n if (insert_layers)\n {\n Image\n *next_image,\n *next;\n\n size_t\n scene;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Coalesce Images\");\n\n scene=image->scene;\n next_image=CoalesceImages(image,&image->exception);\n\n if (next_image == (Image *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n image=DestroyImageList(image);\n image=next_image;\n\n for (next=image; next != (Image *) NULL; next=next_image)\n {\n next->page.width=mng_info->mng_width;\n next->page.height=mng_info->mng_height;\n next->page.x=0;\n next->page.y=0;\n next->scene=scene++;\n next_image=GetNextImageInList(next);\n\n if (next_image == (Image *) NULL)\n break;\n\n if (next->delay == 0)\n {\n scene--;\n next_image->previous=GetPreviousImageInList(next);\n if (GetPreviousImageInList(next) == (Image *) NULL)\n image=next_image;\n else\n next->previous->next=next_image;\n next=DestroyImage(next);\n }\n }\n }\n#endif\n\n while (GetNextImageInList(image) != (Image *) NULL)\n image=GetNextImageInList(image);\n\n image->dispose=BackgroundDispose;\n\n if (logging != MagickFalse)\n {\n int\n scene;\n\n scene=0;\n image=GetFirstImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" After coalesce:\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene 0 delay=%.20g dispose=%.20g\",(double) image->delay,\n (double) image->dispose);\n\n while (GetNextImageInList(image) != (Image *) NULL)\n {\n image=GetNextImageInList(image);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" scene %.20g delay=%.20g dispose=%.20g\",(double) scene++,\n (double) image->delay,(double) image->dispose);\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" exit ReadOneJNGImage();\");\n\n return(image);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ReadOneMNGImage","file_name":"coders/png.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/78d4c5db50fbab0b4beb69c46c6167f2c6513dec","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#97-54c7d66ff6d9","input":"static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,\n Image *image)\n{\n const char\n *mode,\n *option;\n\n CompressionType\n compression;\n\n EndianType\n endian_type;\n\n MagickBooleanType\n debug,\n status;\n\n MagickOffsetType\n scene;\n\n QuantumInfo\n *quantum_info;\n\n QuantumType\n quantum_type;\n\n register ssize_t\n i;\n\n size_t\n imageListLength;\n\n ssize_t\n y;\n\n TIFF\n *tiff;\n\n TIFFInfo\n tiff_info;\n\n uint16\n bits_per_sample,\n compress_tag,\n endian,\n photometric,\n predictor;\n\n unsigned char\n *pixels;\n\n /*\n Open TIFF file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);\n if (status == MagickFalse)\n return(status);\n (void) SetMagickThreadValue(tiff_exception,&image->exception);\n endian_type=UndefinedEndian;\n option=GetImageOption(image_info,\"tiff:endian\");\n if (option != (const char *) NULL)\n {\n if (LocaleNCompare(option,\"msb\",3) == 0)\n endian_type=MSBEndian;\n if (LocaleNCompare(option,\"lsb\",3) == 0)\n endian_type=LSBEndian;;\n }\n switch (endian_type)\n {\n case LSBEndian: mode=\"wl\"; break;\n case MSBEndian: mode=\"wb\"; break;\n default: mode=\"w\"; break;\n }\n#if defined(TIFF_VERSION_BIG)\n if (LocaleCompare(image_info->magick,\"TIFF64\") == 0)\n switch (endian_type)\n {\n case LSBEndian: mode=\"wl8\"; break;\n case MSBEndian: mode=\"wb8\"; break;\n default: mode=\"w8\"; break;\n }\n#endif\n tiff=TIFFClientOpen(image->filename,mode,(thandle_t) image,TIFFReadBlob,\n TIFFWriteBlob,TIFFSeekBlob,TIFFCloseBlob,TIFFGetBlobSize,TIFFMapBlob,\n TIFFUnmapBlob);\n if (tiff == (TIFF *) NULL)\n return(MagickFalse);\n if (image->exception.severity > ErrorException)\n {\n TIFFClose(tiff);\n return(MagickFalse);\n }\n (void) DeleteImageProfile(image,\"tiff:37724\");\n scene=0;\n debug=IsEventLogging();\n (void) debug;\n imageListLength=GetImageListLength(image);\n do\n {\n /*\n Initialize TIFF fields.\n */\n if ((image_info->type != UndefinedType) &&\n (image_info->type != OptimizeType))\n (void) SetImageType(image,image_info->type);\n compression=UndefinedCompression;\n if (image->compression != JPEGCompression)\n compression=image->compression;\n if (image_info->compression != UndefinedCompression)\n compression=image_info->compression;\n switch (compression)\n {\n case FaxCompression:\n case Group4Compression:\n {\n (void) SetImageType(image,BilevelType);\n (void) SetImageDepth(image,1);\n break;\n }\n case JPEGCompression:\n {\n (void) SetImageStorageClass(image,DirectClass);\n (void) SetImageDepth(image,8);\n break;\n }\n default:\n break;\n }\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n if ((image->storage_class != PseudoClass) && (image->depth >= 32) &&\n (quantum_info->format == UndefinedQuantumFormat) &&\n (IsHighDynamicRangeImage(image,&image->exception) != MagickFalse))\n {\n status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat);\n if (status == MagickFalse)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n }\n if ((LocaleCompare(image_info->magick,\"PTIF\") == 0) &&\n (GetPreviousImageInList(image) != (Image *) NULL))\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_REDUCEDIMAGE);\n if ((image->columns != (uint32) image->columns) ||\n (image->rows != (uint32) image->rows))\n ThrowWriterException(ImageError,\"WidthOrHeightExceedsLimit\");\n (void) TIFFSetField(tiff,TIFFTAG_IMAGELENGTH,(uint32) image->rows);\n (void) TIFFSetField(tiff,TIFFTAG_IMAGEWIDTH,(uint32) image->columns);\n switch (compression)\n {\n case FaxCompression:\n {\n compress_tag=COMPRESSION_CCITTFAX3;\n option=GetImageOption(image_info,\"quantum:polarity\");\n if (option == (const char *) NULL)\n SetQuantumMinIsWhite(quantum_info,MagickTrue);\n break;\n }\n case Group4Compression:\n {\n compress_tag=COMPRESSION_CCITTFAX4;\n option=GetImageOption(image_info,\"quantum:polarity\");\n if (option == (const char *) NULL)\n SetQuantumMinIsWhite(quantum_info,MagickTrue);\n break;\n }\n#if defined(COMPRESSION_JBIG)\n case JBIG1Compression:\n {\n compress_tag=COMPRESSION_JBIG;\n break;\n }\n#endif\n case JPEGCompression:\n {\n compress_tag=COMPRESSION_JPEG;\n break;\n }\n#if defined(COMPRESSION_LZMA)\n case LZMACompression:\n {\n compress_tag=COMPRESSION_LZMA;\n break;\n }\n#endif\n case LZWCompression:\n {\n compress_tag=COMPRESSION_LZW;\n break;\n }\n case RLECompression:\n {\n compress_tag=COMPRESSION_PACKBITS;\n break;\n }\n#if defined(COMPRESSION_WEBP)\n case WebPCompression:\n {\n compress_tag=COMPRESSION_WEBP;\n break;\n }\n#endif\n case ZipCompression:\n {\n compress_tag=COMPRESSION_ADOBE_DEFLATE;\n break;\n }\n#if defined(COMPRESSION_ZSTD)\n case ZstdCompression:\n {\n compress_tag=COMPRESSION_ZSTD;\n break;\n }\n#endif\n case NoCompression:\n default:\n {\n compress_tag=COMPRESSION_NONE;\n break;\n }\n }\n#if defined(MAGICKCORE_HAVE_TIFFISCODECCONFIGURED) || (TIFFLIB_VERSION > 20040919)\n if ((compress_tag != COMPRESSION_NONE) &&\n (TIFFIsCODECConfigured(compress_tag) == 0))\n {\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CompressionNotSupported\",\"`%s'\",CommandOptionToMnemonic(\n MagickCompressOptions,(ssize_t) compression));\n compress_tag=COMPRESSION_NONE;\n }\n#else\n switch (compress_tag)\n {\n#if defined(CCITT_SUPPORT)\n case COMPRESSION_CCITTFAX3:\n case COMPRESSION_CCITTFAX4:\n#endif\n#if defined(YCBCR_SUPPORT) && defined(JPEG_SUPPORT)\n case COMPRESSION_JPEG:\n#endif\n#if defined(LZMA_SUPPORT) && defined(COMPRESSION_LZMA)\n case COMPRESSION_LZMA:\n#endif\n#if defined(LZW_SUPPORT)\n case COMPRESSION_LZW:\n#endif\n#if defined(PACKBITS_SUPPORT)\n case COMPRESSION_PACKBITS:\n#endif\n#if defined(ZIP_SUPPORT)\n case COMPRESSION_ADOBE_DEFLATE:\n#endif\n case COMPRESSION_NONE:\n break;\n default:\n {\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CompressionNotSupported\",\"`%s'\",CommandOptionToMnemonic(\n MagickCompressOptions,(ssize_t) compression));\n compress_tag=COMPRESSION_NONE;\n break;\n }\n }\n#endif\n if (image->colorspace == CMYKColorspace)\n {\n photometric=PHOTOMETRIC_SEPARATED;\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,4);\n (void) TIFFSetField(tiff,TIFFTAG_INKSET,INKSET_CMYK);\n }\n else\n {\n /*\n Full color TIFF raster.\n */\n if (image->colorspace == LabColorspace)\n {\n photometric=PHOTOMETRIC_CIELAB;\n EncodeLabImage(image,&image->exception);\n }\n else\n if (image->colorspace == YCbCrColorspace)\n {\n photometric=PHOTOMETRIC_YCBCR;\n (void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,1,1);\n (void) SetImageStorageClass(image,DirectClass);\n (void) SetImageDepth(image,8);\n }\n else\n photometric=PHOTOMETRIC_RGB;\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,3);\n if ((image_info->type != TrueColorType) &&\n (image_info->type != TrueColorMatteType))\n {\n if ((image_info->type != PaletteType) &&\n (SetImageGray(image,&image->exception) != MagickFalse))\n {\n photometric=(uint16) (quantum_info->min_is_white !=\n MagickFalse ? PHOTOMETRIC_MINISWHITE :\n PHOTOMETRIC_MINISBLACK);\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);\n if ((image->depth == 1) && (image->matte == MagickFalse))\n SetImageMonochrome(image,&image->exception);\n }\n else\n if (image->storage_class == PseudoClass)\n {\n size_t\n depth;\n\n /*\n Colormapped TIFF raster.\n */\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);\n photometric=PHOTOMETRIC_PALETTE;\n depth=1;\n while ((GetQuantumRange(depth)+1) < image->colors)\n depth<<=1;\n status=SetQuantumDepth(image,quantum_info,depth);\n if (status == MagickFalse)\n ThrowWriterException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n }\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&endian);\n if ((compress_tag == COMPRESSION_CCITTFAX3) ||\n (compress_tag == COMPRESSION_CCITTFAX4))\n {\n if ((photometric != PHOTOMETRIC_MINISWHITE) &&\n (photometric != PHOTOMETRIC_MINISBLACK))\n {\n compress_tag=COMPRESSION_NONE;\n endian=FILLORDER_MSB2LSB;\n }\n }\n option=GetImageOption(image_info,\"tiff:fill-order\");\n if (option != (const char *) NULL)\n {\n if (LocaleNCompare(option,\"msb\",3) == 0)\n endian=FILLORDER_MSB2LSB;\n if (LocaleNCompare(option,\"lsb\",3) == 0)\n endian=FILLORDER_LSB2MSB;\n }\n (void) TIFFSetField(tiff,TIFFTAG_COMPRESSION,compress_tag);\n (void) TIFFSetField(tiff,TIFFTAG_FILLORDER,endian);\n (void) TIFFSetField(tiff,TIFFTAG_BITSPERSAMPLE,quantum_info->depth);\n if (image->matte != MagickFalse)\n {\n uint16\n extra_samples,\n sample_info[1],\n samples_per_pixel;\n\n /*\n TIFF has a matte channel.\n */\n extra_samples=1;\n sample_info[0]=EXTRASAMPLE_UNASSALPHA;\n option=GetImageOption(image_info,\"tiff:alpha\");\n if (option != (const char *) NULL)\n {\n if (LocaleCompare(option,\"associated\") == 0)\n sample_info[0]=EXTRASAMPLE_ASSOCALPHA;\n else\n if (LocaleCompare(option,\"unspecified\") == 0)\n sample_info[0]=EXTRASAMPLE_UNSPECIFIED;\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,\n &samples_per_pixel);\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,samples_per_pixel+1);\n (void) TIFFSetField(tiff,TIFFTAG_EXTRASAMPLES,extra_samples,\n &sample_info);\n if (sample_info[0] == EXTRASAMPLE_ASSOCALPHA)\n SetQuantumAlphaType(quantum_info,AssociatedQuantumAlpha);\n }\n (void) TIFFSetField(tiff,TIFFTAG_PHOTOMETRIC,photometric);\n switch (quantum_info->format)\n {\n case FloatingPointQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_IEEEFP);\n (void) TIFFSetField(tiff,TIFFTAG_SMINSAMPLEVALUE,quantum_info->minimum);\n (void) TIFFSetField(tiff,TIFFTAG_SMAXSAMPLEVALUE,quantum_info->maximum);\n break;\n }\n case SignedQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_INT);\n break;\n }\n case UnsignedQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_UINT);\n break;\n }\n default:\n break;\n }\n (void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);\n if (photometric == PHOTOMETRIC_RGB)\n if ((image_info->interlace == PlaneInterlace) ||\n (image_info->interlace == PartitionInterlace))\n (void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_SEPARATE);\n predictor=0;\n switch (compress_tag)\n {\n case COMPRESSION_JPEG:\n {\n#if defined(JPEG_SUPPORT)\n if (image_info->quality != UndefinedCompressionQuality)\n (void) TIFFSetField(tiff,TIFFTAG_JPEGQUALITY,image_info->quality);\n (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RAW);\n if (IssRGBCompatibleColorspace(image->colorspace) != MagickFalse)\n {\n const char\n *value;\n\n (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RGB);\n if (image->colorspace == YCbCrColorspace)\n {\n const char\n *sampling_factor;\n\n GeometryInfo\n geometry_info;\n\n MagickStatusType\n flags;\n\n sampling_factor=(const char *) NULL;\n value=GetImageProperty(image,\"jpeg:sampling-factor\");\n if (value != (char *) NULL)\n {\n sampling_factor=value;\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Input sampling-factors=%s\",sampling_factor);\n }\n if (image_info->sampling_factor != (char *) NULL)\n sampling_factor=image_info->sampling_factor;\n if (sampling_factor != (const char *) NULL)\n {\n flags=ParseGeometry(sampling_factor,&geometry_info);\n if ((flags & SigmaValue) == 0)\n geometry_info.sigma=geometry_info.rho;\n (void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,(uint16)\n geometry_info.rho,(uint16) geometry_info.sigma);\n }\n }\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (bits_per_sample == 12)\n (void) TIFFSetField(tiff,TIFFTAG_JPEGTABLESMODE,JPEGTABLESMODE_QUANT);\n#endif\n break;\n }\n case COMPRESSION_ADOBE_DEFLATE:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_ZIPQUALITY,(long) (\n image_info->quality == UndefinedCompressionQuality ? 7 :\n MagickMin((ssize_t) image_info->quality/10,9)));\n break;\n }\n case COMPRESSION_CCITTFAX3:\n {\n /*\n Byte-aligned EOL.\n */\n (void) TIFFSetField(tiff,TIFFTAG_GROUP3OPTIONS,4);\n break;\n }\n case COMPRESSION_CCITTFAX4:\n break;\n#if defined(LZMA_SUPPORT) && defined(COMPRESSION_LZMA)\n case COMPRESSION_LZMA:\n {\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_LZMAPRESET,(long) (\n image_info->quality == UndefinedCompressionQuality ? 7 :\n MagickMin((ssize_t) image_info->quality/10,9)));\n break;\n }\n#endif\n case COMPRESSION_LZW:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n break;\n }\n#if defined(WEBP_SUPPORT) && defined(COMPRESSION_WEBP)\n case COMPRESSION_WEBP:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_WEBP_LEVEL,mage_info->quality);\n if (image_info->quality >= 100)\n (void) TIFFSetField(tiff,TIFFTAG_WEBP_LOSSLESS,1);\n break;\n }\n#endif\n#if defined(ZSTD_SUPPORT) && defined(COMPRESSION_ZSTD)\n case COMPRESSION_ZSTD:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_ZSTD_LEVEL,22*image_info->quality/\n 100.0);\n break;\n }\n#endif\n default:\n break;\n }\n option=GetImageOption(image_info,\"tiff:predictor\");\n if (option != (const char * ) NULL)\n predictor=(size_t) strtol(option,(char **) NULL,10);\n if (predictor != 0)\n (void) TIFFSetField(tiff,TIFFTAG_PREDICTOR,predictor);\n if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))\n {\n unsigned short\n units;\n\n /*\n Set image resolution.\n */\n units=RESUNIT_NONE;\n if (image->units == PixelsPerInchResolution)\n units=RESUNIT_INCH;\n if (image->units == PixelsPerCentimeterResolution)\n units=RESUNIT_CENTIMETER;\n (void) TIFFSetField(tiff,TIFFTAG_RESOLUTIONUNIT,(uint16) units);\n (void) TIFFSetField(tiff,TIFFTAG_XRESOLUTION,image->x_resolution);\n (void) TIFFSetField(tiff,TIFFTAG_YRESOLUTION,image->y_resolution);\n if ((image->page.x < 0) || (image->page.y < 0))\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"TIFF: negative image positions unsupported\",\"%s\",\n image->filename);\n if ((image->page.x > 0) && (image->x_resolution > 0.0))\n {\n /*\n Set horizontal image position.\n */\n (void) TIFFSetField(tiff,TIFFTAG_XPOSITION,(float) image->page.x/\n image->x_resolution);\n }\n if ((image->page.y > 0) && (image->y_resolution > 0.0))\n {\n /*\n Set vertical image position.\n */\n (void) TIFFSetField(tiff,TIFFTAG_YPOSITION,(float) image->page.y/\n image->y_resolution);\n }\n }\n if (image->chromaticity.white_point.x != 0.0)\n {\n float\n chromaticity[6];\n\n /*\n Set image chromaticity.\n */\n chromaticity[0]=(float) image->chromaticity.red_primary.x;\n chromaticity[1]=(float) image->chromaticity.red_primary.y;\n chromaticity[2]=(float) image->chromaticity.green_primary.x;\n chromaticity[3]=(float) image->chromaticity.green_primary.y;\n chromaticity[4]=(float) image->chromaticity.blue_primary.x;\n chromaticity[5]=(float) image->chromaticity.blue_primary.y;\n (void) TIFFSetField(tiff,TIFFTAG_PRIMARYCHROMATICITIES,chromaticity);\n chromaticity[0]=(float) image->chromaticity.white_point.x;\n chromaticity[1]=(float) image->chromaticity.white_point.y;\n (void) TIFFSetField(tiff,TIFFTAG_WHITEPOINT,chromaticity);\n }\n if ((LocaleCompare(image_info->magick,\"PTIF\") != 0) &&\n (image_info->adjoin != MagickFalse) && (imageListLength > 1))\n {\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE);\n if (image->scene != 0)\n (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,(uint16) image->scene,\n imageListLength);\n }\n if (image->orientation != UndefinedOrientation)\n (void) TIFFSetField(tiff,TIFFTAG_ORIENTATION,(uint16) image->orientation);\n else\n (void) TIFFSetField(tiff,TIFFTAG_ORIENTATION,ORIENTATION_TOPLEFT);\n (void) TIFFSetProfiles(tiff,image);\n {\n uint16\n page,\n pages;\n\n page=(uint16) scene;\n pages=(uint16) imageListLength;\n if ((LocaleCompare(image_info->magick,\"PTIF\") != 0) &&\n (image_info->adjoin != MagickFalse) && (pages > 1))\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE);\n (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,page,pages);\n }\n (void) TIFFSetProperties(tiff,image_info,image);\nDisableMSCWarning(4127)\n if (0)\nRestoreMSCWarning\n (void) TIFFSetEXIFProperties(tiff,image);\n /*\n Write image scanlines.\n */\n if (GetTIFFInfo(image_info,tiff,&tiff_info) == MagickFalse)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n quantum_info->endian=LSBEndian;\n pixels=GetQuantumPixels(quantum_info);\n tiff_info.scanline=GetQuantumPixels(quantum_info);\n switch (photometric)\n {\n case PHOTOMETRIC_CIELAB:\n case PHOTOMETRIC_YCBCR:\n case PHOTOMETRIC_RGB:\n {\n /*\n RGB TIFF image.\n */\n switch (image_info->interlace)\n {\n case NoInterlace:\n default:\n {\n quantum_type=RGBQuantum;\n if (image->matte != MagickFalse)\n quantum_type=RGBAQuantum;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case PlaneInterlace:\n case PartitionInterlace:\n {\n /*\n Plane interlacing: RRRRRR...GGGGGG...BBBBBB...\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,RedQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,100,400);\n if (status == MagickFalse)\n break;\n }\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GreenQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,1,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,200,400);\n if (status == MagickFalse)\n break;\n }\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,BlueQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,2,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,300,400);\n if (status == MagickFalse)\n break;\n }\n if (image->matte != MagickFalse)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,\n &image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,AlphaQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,3,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,400,400);\n if (status == MagickFalse)\n break;\n }\n break;\n }\n }\n break;\n }\n case PHOTOMETRIC_SEPARATED:\n {\n /*\n CMYK TIFF image.\n */\n quantum_type=CMYKQuantum;\n if (image->matte != MagickFalse)\n quantum_type=CMYKAQuantum;\n if (image->colorspace != CMYKColorspace)\n (void) TransformImageColorspace(image,CMYKColorspace);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case PHOTOMETRIC_PALETTE:\n {\n uint16\n *blue,\n *green,\n *red;\n\n /*\n Colormapped TIFF image.\n */\n red=(uint16 *) AcquireQuantumMemory(65536,sizeof(*red));\n green=(uint16 *) AcquireQuantumMemory(65536,sizeof(*green));\n blue=(uint16 *) AcquireQuantumMemory(65536,sizeof(*blue));\n if ((red == (uint16 *) NULL) || (green == (uint16 *) NULL) ||\n (blue == (uint16 *) NULL))\n {\n if (red != (uint16 *) NULL)\n red=(uint16 *) RelinquishMagickMemory(red);\n if (green != (uint16 *) NULL)\n green=(uint16 *) RelinquishMagickMemory(green);\n if (blue != (uint16 *) NULL)\n blue=(uint16 *) RelinquishMagickMemory(blue);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n /*\n Initialize TIFF colormap.\n */\n (void) memset(red,0,65536*sizeof(*red));\n (void) memset(green,0,65536*sizeof(*green));\n (void) memset(blue,0,65536*sizeof(*blue));\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n red[i]=ScaleQuantumToShort(image->colormap[i].red);\n green[i]=ScaleQuantumToShort(image->colormap[i].green);\n blue[i]=ScaleQuantumToShort(image->colormap[i].blue);\n }\n (void) TIFFSetField(tiff,TIFFTAG_COLORMAP,red,green,blue);\n red=(uint16 *) RelinquishMagickMemory(red);\n green=(uint16 *) RelinquishMagickMemory(green);\n blue=(uint16 *) RelinquishMagickMemory(blue);\n }\n default:\n {\n /*\n Convert PseudoClass packets to contiguous grayscale scanlines.\n */\n quantum_type=IndexQuantum;\n if (image->matte != MagickFalse)\n {\n if (photometric != PHOTOMETRIC_PALETTE)\n quantum_type=GrayAlphaQuantum;\n else\n quantum_type=IndexAlphaQuantum;\n }\n else\n if (photometric != PHOTOMETRIC_PALETTE)\n quantum_type=GrayQuantum;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n }\n quantum_info=DestroyQuantumInfo(quantum_info);\n if (image->colorspace == LabColorspace)\n DecodeLabImage(image,&image->exception);\n DestroyTIFFInfo(&tiff_info);\n if (image->exception.severity > ErrorException)\n break;\nDisableMSCWarning(4127)\n if (0 && (image_info->verbose != MagickFalse))\nRestoreMSCWarning\n TIFFPrintDirectory(tiff,stdout,MagickFalse);\n (void) TIFFWriteDirectory(tiff);\n image=SyncNextImageInList(image);\n if (image == (Image *) NULL)\n break;\n status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength);\n if (status == MagickFalse)\n break;\n } while (image_info->adjoin != MagickFalse);\n TIFFClose(tiff);\n return(image->exception.severity > ErrorException ? MagickFalse : MagickTrue);\n}","target":"static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,\n Image *image)\n{\n const char\n *mode,\n *option;\n\n CompressionType\n compression;\n\n EndianType\n endian_type;\n\n MagickBooleanType\n debug,\n status;\n\n MagickOffsetType\n scene;\n\n QuantumInfo\n *quantum_info;\n\n QuantumType\n quantum_type;\n\n register ssize_t\n i;\n\n size_t\n imageListLength;\n\n ssize_t\n y;\n\n TIFF\n *tiff;\n\n TIFFInfo\n tiff_info;\n\n uint16\n bits_per_sample,\n compress_tag,\n endian,\n photometric,\n predictor;\n\n unsigned char\n *pixels;\n\n /*\n Open TIFF file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);\n if (status == MagickFalse)\n return(status);\n (void) SetMagickThreadValue(tiff_exception,&image->exception);\n endian_type=UndefinedEndian;\n option=GetImageOption(image_info,\"tiff:endian\");\n if (option != (const char *) NULL)\n {\n if (LocaleNCompare(option,\"msb\",3) == 0)\n endian_type=MSBEndian;\n if (LocaleNCompare(option,\"lsb\",3) == 0)\n endian_type=LSBEndian;;\n }\n switch (endian_type)\n {\n case LSBEndian: mode=\"wl\"; break;\n case MSBEndian: mode=\"wb\"; break;\n default: mode=\"w\"; break;\n }\n#if defined(TIFF_VERSION_BIG)\n if (LocaleCompare(image_info->magick,\"TIFF64\") == 0)\n switch (endian_type)\n {\n case LSBEndian: mode=\"wl8\"; break;\n case MSBEndian: mode=\"wb8\"; break;\n default: mode=\"w8\"; break;\n }\n#endif\n tiff=TIFFClientOpen(image->filename,mode,(thandle_t) image,TIFFReadBlob,\n TIFFWriteBlob,TIFFSeekBlob,TIFFCloseBlob,TIFFGetBlobSize,TIFFMapBlob,\n TIFFUnmapBlob);\n if (tiff == (TIFF *) NULL)\n return(MagickFalse);\n if (image->exception.severity > ErrorException)\n {\n TIFFClose(tiff);\n return(MagickFalse);\n }\n (void) DeleteImageProfile(image,\"tiff:37724\");\n scene=0;\n debug=IsEventLogging();\n (void) debug;\n imageListLength=GetImageListLength(image);\n do\n {\n /*\n Initialize TIFF fields.\n */\n if ((image_info->type != UndefinedType) &&\n (image_info->type != OptimizeType))\n (void) SetImageType(image,image_info->type);\n compression=UndefinedCompression;\n if (image->compression != JPEGCompression)\n compression=image->compression;\n if (image_info->compression != UndefinedCompression)\n compression=image_info->compression;\n switch (compression)\n {\n case FaxCompression:\n case Group4Compression:\n {\n (void) SetImageType(image,BilevelType);\n (void) SetImageDepth(image,1);\n break;\n }\n case JPEGCompression:\n {\n (void) SetImageStorageClass(image,DirectClass);\n (void) SetImageDepth(image,8);\n break;\n }\n default:\n break;\n }\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n if ((image->storage_class != PseudoClass) && (image->depth >= 32) &&\n (quantum_info->format == UndefinedQuantumFormat) &&\n (IsHighDynamicRangeImage(image,&image->exception) != MagickFalse))\n {\n status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat);\n if (status == MagickFalse)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n }\n if ((LocaleCompare(image_info->magick,\"PTIF\") == 0) &&\n (GetPreviousImageInList(image) != (Image *) NULL))\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_REDUCEDIMAGE);\n if ((image->columns != (uint32) image->columns) ||\n (image->rows != (uint32) image->rows))\n ThrowWriterException(ImageError,\"WidthOrHeightExceedsLimit\");\n (void) TIFFSetField(tiff,TIFFTAG_IMAGELENGTH,(uint32) image->rows);\n (void) TIFFSetField(tiff,TIFFTAG_IMAGEWIDTH,(uint32) image->columns);\n switch (compression)\n {\n case FaxCompression:\n {\n compress_tag=COMPRESSION_CCITTFAX3;\n option=GetImageOption(image_info,\"quantum:polarity\");\n if (option == (const char *) NULL)\n SetQuantumMinIsWhite(quantum_info,MagickTrue);\n break;\n }\n case Group4Compression:\n {\n compress_tag=COMPRESSION_CCITTFAX4;\n option=GetImageOption(image_info,\"quantum:polarity\");\n if (option == (const char *) NULL)\n SetQuantumMinIsWhite(quantum_info,MagickTrue);\n break;\n }\n#if defined(COMPRESSION_JBIG)\n case JBIG1Compression:\n {\n compress_tag=COMPRESSION_JBIG;\n break;\n }\n#endif\n case JPEGCompression:\n {\n compress_tag=COMPRESSION_JPEG;\n break;\n }\n#if defined(COMPRESSION_LZMA)\n case LZMACompression:\n {\n compress_tag=COMPRESSION_LZMA;\n break;\n }\n#endif\n case LZWCompression:\n {\n compress_tag=COMPRESSION_LZW;\n break;\n }\n case RLECompression:\n {\n compress_tag=COMPRESSION_PACKBITS;\n break;\n }\n#if defined(COMPRESSION_WEBP)\n case WebPCompression:\n {\n compress_tag=COMPRESSION_WEBP;\n break;\n }\n#endif\n case ZipCompression:\n {\n compress_tag=COMPRESSION_ADOBE_DEFLATE;\n break;\n }\n#if defined(COMPRESSION_ZSTD)\n case ZstdCompression:\n {\n compress_tag=COMPRESSION_ZSTD;\n break;\n }\n#endif\n case NoCompression:\n default:\n {\n compress_tag=COMPRESSION_NONE;\n break;\n }\n }\n#if defined(MAGICKCORE_HAVE_TIFFISCODECCONFIGURED) || (TIFFLIB_VERSION > 20040919)\n if ((compress_tag != COMPRESSION_NONE) &&\n (TIFFIsCODECConfigured(compress_tag) == 0))\n {\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CompressionNotSupported\",\"`%s'\",CommandOptionToMnemonic(\n MagickCompressOptions,(ssize_t) compression));\n compress_tag=COMPRESSION_NONE;\n }\n#else\n switch (compress_tag)\n {\n#if defined(CCITT_SUPPORT)\n case COMPRESSION_CCITTFAX3:\n case COMPRESSION_CCITTFAX4:\n#endif\n#if defined(YCBCR_SUPPORT) && defined(JPEG_SUPPORT)\n case COMPRESSION_JPEG:\n#endif\n#if defined(LZMA_SUPPORT) && defined(COMPRESSION_LZMA)\n case COMPRESSION_LZMA:\n#endif\n#if defined(LZW_SUPPORT)\n case COMPRESSION_LZW:\n#endif\n#if defined(PACKBITS_SUPPORT)\n case COMPRESSION_PACKBITS:\n#endif\n#if defined(ZIP_SUPPORT)\n case COMPRESSION_ADOBE_DEFLATE:\n#endif\n case COMPRESSION_NONE:\n break;\n default:\n {\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"CompressionNotSupported\",\"`%s'\",CommandOptionToMnemonic(\n MagickCompressOptions,(ssize_t) compression));\n compress_tag=COMPRESSION_NONE;\n break;\n }\n }\n#endif\n if (image->colorspace == CMYKColorspace)\n {\n photometric=PHOTOMETRIC_SEPARATED;\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,4);\n (void) TIFFSetField(tiff,TIFFTAG_INKSET,INKSET_CMYK);\n }\n else\n {\n /*\n Full color TIFF raster.\n */\n if (image->colorspace == LabColorspace)\n {\n photometric=PHOTOMETRIC_CIELAB;\n EncodeLabImage(image,&image->exception);\n }\n else\n if (image->colorspace == YCbCrColorspace)\n {\n photometric=PHOTOMETRIC_YCBCR;\n (void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,1,1);\n (void) SetImageStorageClass(image,DirectClass);\n (void) SetImageDepth(image,8);\n }\n else\n photometric=PHOTOMETRIC_RGB;\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,3);\n if ((image_info->type != TrueColorType) &&\n (image_info->type != TrueColorMatteType))\n {\n if ((image_info->type != PaletteType) &&\n (SetImageGray(image,&image->exception) != MagickFalse))\n {\n photometric=(uint16) (quantum_info->min_is_white !=\n MagickFalse ? PHOTOMETRIC_MINISWHITE :\n PHOTOMETRIC_MINISBLACK);\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);\n if ((image->depth == 1) && (image->matte == MagickFalse))\n SetImageMonochrome(image,&image->exception);\n }\n else\n if (image->storage_class == PseudoClass)\n {\n size_t\n depth;\n\n /*\n Colormapped TIFF raster.\n */\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1);\n photometric=PHOTOMETRIC_PALETTE;\n depth=1;\n while ((GetQuantumRange(depth)+1) < image->colors)\n depth<<=1;\n status=SetQuantumDepth(image,quantum_info,depth);\n if (status == MagickFalse)\n ThrowWriterException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n }\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&endian);\n if ((compress_tag == COMPRESSION_CCITTFAX3) ||\n (compress_tag == COMPRESSION_CCITTFAX4))\n {\n if ((photometric != PHOTOMETRIC_MINISWHITE) &&\n (photometric != PHOTOMETRIC_MINISBLACK))\n {\n compress_tag=COMPRESSION_NONE;\n endian=FILLORDER_MSB2LSB;\n }\n }\n option=GetImageOption(image_info,\"tiff:fill-order\");\n if (option != (const char *) NULL)\n {\n if (LocaleNCompare(option,\"msb\",3) == 0)\n endian=FILLORDER_MSB2LSB;\n if (LocaleNCompare(option,\"lsb\",3) == 0)\n endian=FILLORDER_LSB2MSB;\n }\n (void) TIFFSetField(tiff,TIFFTAG_COMPRESSION,compress_tag);\n (void) TIFFSetField(tiff,TIFFTAG_FILLORDER,endian);\n (void) TIFFSetField(tiff,TIFFTAG_BITSPERSAMPLE,quantum_info->depth);\n if (image->matte != MagickFalse)\n {\n uint16\n extra_samples,\n sample_info[1],\n samples_per_pixel;\n\n /*\n TIFF has a matte channel.\n */\n extra_samples=1;\n sample_info[0]=EXTRASAMPLE_UNASSALPHA;\n option=GetImageOption(image_info,\"tiff:alpha\");\n if (option != (const char *) NULL)\n {\n if (LocaleCompare(option,\"associated\") == 0)\n sample_info[0]=EXTRASAMPLE_ASSOCALPHA;\n else\n if (LocaleCompare(option,\"unspecified\") == 0)\n sample_info[0]=EXTRASAMPLE_UNSPECIFIED;\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,\n &samples_per_pixel);\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,samples_per_pixel+1);\n (void) TIFFSetField(tiff,TIFFTAG_EXTRASAMPLES,extra_samples,\n &sample_info);\n if (sample_info[0] == EXTRASAMPLE_ASSOCALPHA)\n SetQuantumAlphaType(quantum_info,AssociatedQuantumAlpha);\n }\n (void) TIFFSetField(tiff,TIFFTAG_PHOTOMETRIC,photometric);\n switch (quantum_info->format)\n {\n case FloatingPointQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_IEEEFP);\n (void) TIFFSetField(tiff,TIFFTAG_SMINSAMPLEVALUE,quantum_info->minimum);\n (void) TIFFSetField(tiff,TIFFTAG_SMAXSAMPLEVALUE,quantum_info->maximum);\n break;\n }\n case SignedQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_INT);\n break;\n }\n case UnsignedQuantumFormat:\n {\n (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_UINT);\n break;\n }\n default:\n break;\n }\n (void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);\n if (photometric == PHOTOMETRIC_RGB)\n if ((image_info->interlace == PlaneInterlace) ||\n (image_info->interlace == PartitionInterlace))\n (void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_SEPARATE);\n predictor=0;\n switch (compress_tag)\n {\n case COMPRESSION_JPEG:\n {\n#if defined(JPEG_SUPPORT)\n if (image_info->quality != UndefinedCompressionQuality)\n (void) TIFFSetField(tiff,TIFFTAG_JPEGQUALITY,image_info->quality);\n (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RAW);\n if (IssRGBCompatibleColorspace(image->colorspace) != MagickFalse)\n {\n const char\n *value;\n\n (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RGB);\n if (image->colorspace == YCbCrColorspace)\n {\n const char\n *sampling_factor;\n\n GeometryInfo\n geometry_info;\n\n MagickStatusType\n flags;\n\n sampling_factor=(const char *) NULL;\n value=GetImageProperty(image,\"jpeg:sampling-factor\");\n if (value != (char *) NULL)\n {\n sampling_factor=value;\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Input sampling-factors=%s\",sampling_factor);\n }\n if (image_info->sampling_factor != (char *) NULL)\n sampling_factor=image_info->sampling_factor;\n if (sampling_factor != (const char *) NULL)\n {\n flags=ParseGeometry(sampling_factor,&geometry_info);\n if ((flags & SigmaValue) == 0)\n geometry_info.sigma=geometry_info.rho;\n (void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,(uint16)\n geometry_info.rho,(uint16) geometry_info.sigma);\n }\n }\n }\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (bits_per_sample == 12)\n (void) TIFFSetField(tiff,TIFFTAG_JPEGTABLESMODE,JPEGTABLESMODE_QUANT);\n#endif\n break;\n }\n case COMPRESSION_ADOBE_DEFLATE:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_ZIPQUALITY,(long) (\n image_info->quality == UndefinedCompressionQuality ? 7 :\n MagickMin((ssize_t) image_info->quality/10,9)));\n break;\n }\n case COMPRESSION_CCITTFAX3:\n {\n /*\n Byte-aligned EOL.\n */\n (void) TIFFSetField(tiff,TIFFTAG_GROUP3OPTIONS,4);\n break;\n }\n case COMPRESSION_CCITTFAX4:\n break;\n#if defined(LZMA_SUPPORT) && defined(COMPRESSION_LZMA)\n case COMPRESSION_LZMA:\n {\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_LZMAPRESET,(long) (\n image_info->quality == UndefinedCompressionQuality ? 7 :\n MagickMin((ssize_t) image_info->quality/10,9)));\n break;\n }\n#endif\n case COMPRESSION_LZW:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n break;\n }\n#if defined(WEBP_SUPPORT) && defined(COMPRESSION_WEBP)\n case COMPRESSION_WEBP:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_WEBP_LEVEL,mage_info->quality);\n if (image_info->quality >= 100)\n (void) TIFFSetField(tiff,TIFFTAG_WEBP_LOSSLESS,1);\n break;\n }\n#endif\n#if defined(ZSTD_SUPPORT) && defined(COMPRESSION_ZSTD)\n case COMPRESSION_ZSTD:\n {\n (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,\n &bits_per_sample);\n if (((photometric == PHOTOMETRIC_RGB) ||\n (photometric == PHOTOMETRIC_SEPARATED) ||\n (photometric == PHOTOMETRIC_MINISBLACK)) &&\n ((bits_per_sample == 8) || (bits_per_sample == 16)))\n predictor=PREDICTOR_HORIZONTAL;\n (void) TIFFSetField(tiff,TIFFTAG_ZSTD_LEVEL,22*image_info->quality/\n 100.0);\n break;\n }\n#endif\n default:\n break;\n }\n option=GetImageOption(image_info,\"tiff:predictor\");\n if (option != (const char * ) NULL)\n predictor=(size_t) strtol(option,(char **) NULL,10);\n if (predictor != 0)\n (void) TIFFSetField(tiff,TIFFTAG_PREDICTOR,predictor);\n if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))\n {\n unsigned short\n units;\n\n /*\n Set image resolution.\n */\n units=RESUNIT_NONE;\n if (image->units == PixelsPerInchResolution)\n units=RESUNIT_INCH;\n if (image->units == PixelsPerCentimeterResolution)\n units=RESUNIT_CENTIMETER;\n (void) TIFFSetField(tiff,TIFFTAG_RESOLUTIONUNIT,(uint16) units);\n (void) TIFFSetField(tiff,TIFFTAG_XRESOLUTION,image->x_resolution);\n (void) TIFFSetField(tiff,TIFFTAG_YRESOLUTION,image->y_resolution);\n if ((image->page.x < 0) || (image->page.y < 0))\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n CoderError,\"TIFF: negative image positions unsupported\",\"%s\",\n image->filename);\n if ((image->page.x > 0) && (image->x_resolution > 0.0))\n {\n /*\n Set horizontal image position.\n */\n (void) TIFFSetField(tiff,TIFFTAG_XPOSITION,(float) image->page.x/\n image->x_resolution);\n }\n if ((image->page.y > 0) && (image->y_resolution > 0.0))\n {\n /*\n Set vertical image position.\n */\n (void) TIFFSetField(tiff,TIFFTAG_YPOSITION,(float) image->page.y/\n image->y_resolution);\n }\n }\n if (image->chromaticity.white_point.x != 0.0)\n {\n float\n chromaticity[6];\n\n /*\n Set image chromaticity.\n */\n chromaticity[0]=(float) image->chromaticity.red_primary.x;\n chromaticity[1]=(float) image->chromaticity.red_primary.y;\n chromaticity[2]=(float) image->chromaticity.green_primary.x;\n chromaticity[3]=(float) image->chromaticity.green_primary.y;\n chromaticity[4]=(float) image->chromaticity.blue_primary.x;\n chromaticity[5]=(float) image->chromaticity.blue_primary.y;\n (void) TIFFSetField(tiff,TIFFTAG_PRIMARYCHROMATICITIES,chromaticity);\n chromaticity[0]=(float) image->chromaticity.white_point.x;\n chromaticity[1]=(float) image->chromaticity.white_point.y;\n (void) TIFFSetField(tiff,TIFFTAG_WHITEPOINT,chromaticity);\n }\n if ((LocaleCompare(image_info->magick,\"PTIF\") != 0) &&\n (image_info->adjoin != MagickFalse) && (imageListLength > 1))\n {\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE);\n if (image->scene != 0)\n (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,(uint16) image->scene,\n imageListLength);\n }\n if (image->orientation != UndefinedOrientation)\n (void) TIFFSetField(tiff,TIFFTAG_ORIENTATION,(uint16) image->orientation);\n else\n (void) TIFFSetField(tiff,TIFFTAG_ORIENTATION,ORIENTATION_TOPLEFT);\n (void) TIFFSetProfiles(tiff,image);\n {\n uint16\n page,\n pages;\n\n page=(uint16) scene;\n pages=(uint16) imageListLength;\n if ((LocaleCompare(image_info->magick,\"PTIF\") != 0) &&\n (image_info->adjoin != MagickFalse) && (pages > 1))\n (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE);\n (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,page,pages);\n }\n (void) TIFFSetProperties(tiff,image_info,image);\nDisableMSCWarning(4127)\n if (0)\nRestoreMSCWarning\n (void) TIFFSetEXIFProperties(tiff,image);\n /*\n Write image scanlines.\n */\n if (GetTIFFInfo(image_info,tiff,&tiff_info) == MagickFalse)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n quantum_info->endian=LSBEndian;\n pixels=GetQuantumPixels(quantum_info);\n tiff_info.scanline=GetQuantumPixels(quantum_info);\n switch (photometric)\n {\n case PHOTOMETRIC_CIELAB:\n case PHOTOMETRIC_YCBCR:\n case PHOTOMETRIC_RGB:\n {\n /*\n RGB TIFF image.\n */\n switch (image_info->interlace)\n {\n case NoInterlace:\n default:\n {\n quantum_type=RGBQuantum;\n if (image->matte != MagickFalse)\n quantum_type=RGBAQuantum;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType)\n y,image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case PlaneInterlace:\n case PartitionInterlace:\n {\n /*\n Plane interlacing: RRRRRR...GGGGGG...BBBBBB...\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,RedQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,100,400);\n if (status == MagickFalse)\n break;\n }\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GreenQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,1,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,200,400);\n if (status == MagickFalse)\n break;\n }\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,BlueQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,2,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,300,400);\n if (status == MagickFalse)\n break;\n }\n if (image->matte != MagickFalse)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,\n &image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,AlphaQuantum,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,3,image) == -1)\n break;\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,400,400);\n if (status == MagickFalse)\n break;\n }\n break;\n }\n }\n break;\n }\n case PHOTOMETRIC_SEPARATED:\n {\n /*\n CMYK TIFF image.\n */\n quantum_type=CMYKQuantum;\n if (image->matte != MagickFalse)\n quantum_type=CMYKAQuantum;\n if (image->colorspace != CMYKColorspace)\n (void) TransformImageColorspace(image,CMYKColorspace);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case PHOTOMETRIC_PALETTE:\n {\n uint16\n *blue,\n *green,\n *red;\n\n /*\n Colormapped TIFF image.\n */\n red=(uint16 *) AcquireQuantumMemory(65536,sizeof(*red));\n green=(uint16 *) AcquireQuantumMemory(65536,sizeof(*green));\n blue=(uint16 *) AcquireQuantumMemory(65536,sizeof(*blue));\n if ((red == (uint16 *) NULL) || (green == (uint16 *) NULL) ||\n (blue == (uint16 *) NULL))\n {\n if (red != (uint16 *) NULL)\n red=(uint16 *) RelinquishMagickMemory(red);\n if (green != (uint16 *) NULL)\n green=(uint16 *) RelinquishMagickMemory(green);\n if (blue != (uint16 *) NULL)\n blue=(uint16 *) RelinquishMagickMemory(blue);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n /*\n Initialize TIFF colormap.\n */\n (void) memset(red,0,65536*sizeof(*red));\n (void) memset(green,0,65536*sizeof(*green));\n (void) memset(blue,0,65536*sizeof(*blue));\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n red[i]=ScaleQuantumToShort(image->colormap[i].red);\n green[i]=ScaleQuantumToShort(image->colormap[i].green);\n blue[i]=ScaleQuantumToShort(image->colormap[i].blue);\n }\n (void) TIFFSetField(tiff,TIFFTAG_COLORMAP,red,green,blue);\n red=(uint16 *) RelinquishMagickMemory(red);\n green=(uint16 *) RelinquishMagickMemory(green);\n blue=(uint16 *) RelinquishMagickMemory(blue);\n }\n default:\n {\n /*\n Convert PseudoClass packets to contiguous grayscale scanlines.\n */\n quantum_type=IndexQuantum;\n if (image->matte != MagickFalse)\n {\n if (photometric != PHOTOMETRIC_PALETTE)\n quantum_type=GrayAlphaQuantum;\n else\n quantum_type=IndexAlphaQuantum;\n }\n else\n if (photometric != PHOTOMETRIC_PALETTE)\n quantum_type=GrayQuantum;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const PixelPacket\n *magick_restrict p;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);\n if (p == (const PixelPacket *) NULL)\n break;\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,quantum_type,pixels,&image->exception);\n if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n }\n quantum_info=DestroyQuantumInfo(quantum_info);\n if (image->colorspace == LabColorspace)\n DecodeLabImage(image,&image->exception);\n DestroyTIFFInfo(&tiff_info);\nDisableMSCWarning(4127)\n if (0 && (image_info->verbose != MagickFalse))\nRestoreMSCWarning\n TIFFPrintDirectory(tiff,stdout,MagickFalse);\n if (TIFFWriteDirectory(tiff) == 0)\n {\n status=MagickFalse;\n break;\n }\n image=SyncNextImageInList(image);\n if (image == (Image *) NULL)\n break;\n status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength);\n if (status == MagickFalse)\n break;\n } while (image_info->adjoin != MagickFalse);\n TIFFClose(tiff);\n return(status);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"WriteTIFFImage","file_name":"coders/tiff.c","commit_link":"github.com/ImageMagick/ImageMagick6/commit/3c53413eb544cc567309b4c86485eae43e956112","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#98-421c9a43df34","input":"static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env,\n\t\t\t\t struct bpf_insn *insn,\n\t\t\t\t struct bpf_reg_state *dst_reg,\n\t\t\t\t struct bpf_reg_state src_reg)\n{\n\tstruct bpf_reg_state *regs = cur_regs(env);\n\tu8 opcode = BPF_OP(insn->code);\n\tbool src_known, dst_known;\n\ts64 smin_val, smax_val;\n\tu64 umin_val, umax_val;\n\tu64 insn_bitness = (BPF_CLASS(insn->code) == BPF_ALU64) ? 64 : 32;\n\n\tsmin_val = src_reg.smin_value;\n\tsmax_val = src_reg.smax_value;\n\tumin_val = src_reg.umin_value;\n\tumax_val = src_reg.umax_value;\n\tsrc_known = tnum_is_const(src_reg.var_off);\n\tdst_known = tnum_is_const(dst_reg->var_off);\n\n\tif ((src_known && (smin_val != smax_val || umin_val != umax_val)) ||\n\t smin_val > smax_val || umin_val > umax_val) {\n\t\t/* Taint dst register if offset had invalid bounds derived from\n\t\t * e.g. dead branches.\n\t\t */\n\t\t__mark_reg_unknown(dst_reg);\n\t\treturn 0;\n\t}\n\n\tif (!src_known &&\n\t opcode != BPF_ADD && opcode != BPF_SUB && opcode != BPF_AND) {\n\t\t__mark_reg_unknown(dst_reg);\n\t\treturn 0;\n\t}\n\n\tswitch (opcode) {\n\tcase BPF_ADD:\n\t\tif (signed_add_overflows(dst_reg->smin_value, smin_val) ||\n\t\t signed_add_overflows(dst_reg->smax_value, smax_val)) {\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value += smin_val;\n\t\t\tdst_reg->smax_value += smax_val;\n\t\t}\n\t\tif (dst_reg->umin_value + umin_val < umin_val ||\n\t\t dst_reg->umax_value + umax_val < umax_val) {\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\tdst_reg->umin_value += umin_val;\n\t\t\tdst_reg->umax_value += umax_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_add(dst_reg->var_off, src_reg.var_off);\n\t\tbreak;\n\tcase BPF_SUB:\n\t\tif (signed_sub_overflows(dst_reg->smin_value, smax_val) ||\n\t\t signed_sub_overflows(dst_reg->smax_value, smin_val)) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value -= smax_val;\n\t\t\tdst_reg->smax_value -= smin_val;\n\t\t}\n\t\tif (dst_reg->umin_value < umax_val) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\t/* Cannot overflow (as long as bounds are consistent) */\n\t\t\tdst_reg->umin_value -= umax_val;\n\t\t\tdst_reg->umax_value -= umin_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_sub(dst_reg->var_off, src_reg.var_off);\n\t\tbreak;\n\tcase BPF_MUL:\n\t\tdst_reg->var_off = tnum_mul(dst_reg->var_off, src_reg.var_off);\n\t\tif (smin_val < 0 || dst_reg->smin_value < 0) {\n\t\t\t/* Ain't nobody got time to multiply that sign */\n\t\t\t__mark_reg_unbounded(dst_reg);\n\t\t\t__update_reg_bounds(dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* Both values are positive, so we can work with unsigned and\n\t\t * copy the result to signed (unless it exceeds S64_MAX).\n\t\t */\n\t\tif (umax_val > U32_MAX || dst_reg->umax_value > U32_MAX) {\n\t\t\t/* Potential overflow, we know nothing */\n\t\t\t__mark_reg_unbounded(dst_reg);\n\t\t\t/* (except what we can learn from the var_off) */\n\t\t\t__update_reg_bounds(dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\tdst_reg->umin_value *= umin_val;\n\t\tdst_reg->umax_value *= umax_val;\n\t\tif (dst_reg->umax_value > S64_MAX) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\tbreak;\n\tcase BPF_AND:\n\t\tif (src_known && dst_known) {\n\t\t\t__mark_reg_known(dst_reg, dst_reg->var_off.value &\n\t\t\t\t\t\t src_reg.var_off.value);\n\t\t\tbreak;\n\t\t}\n\t\t/* We get our minimum from the var_off, since that's inherently\n\t\t * bitwise. Our maximum is the minimum of the operands' maxima.\n\t\t */\n\t\tdst_reg->var_off = tnum_and(dst_reg->var_off, src_reg.var_off);\n\t\tdst_reg->umin_value = dst_reg->var_off.value;\n\t\tdst_reg->umax_value = min(dst_reg->umax_value, umax_val);\n\t\tif (dst_reg->smin_value < 0 || smin_val < 0) {\n\t\t\t/* Lose signed bounds when ANDing negative numbers,\n\t\t\t * ain't nobody got time for that.\n\t\t\t */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\t/* ANDing two positives gives a positive, so safe to\n\t\t\t * cast result into s64.\n\t\t\t */\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_OR:\n\t\tif (src_known && dst_known) {\n\t\t\t__mark_reg_known(dst_reg, dst_reg->var_off.value |\n\t\t\t\t\t\t src_reg.var_off.value);\n\t\t\tbreak;\n\t\t}\n\t\t/* We get our maximum from the var_off, and our minimum is the\n\t\t * maximum of the operands' minima\n\t\t */\n\t\tdst_reg->var_off = tnum_or(dst_reg->var_off, src_reg.var_off);\n\t\tdst_reg->umin_value = max(dst_reg->umin_value, umin_val);\n\t\tdst_reg->umax_value = dst_reg->var_off.value |\n\t\t\t\t dst_reg->var_off.mask;\n\t\tif (dst_reg->smin_value < 0 || smin_val < 0) {\n\t\t\t/* Lose signed bounds when ORing negative numbers,\n\t\t\t * ain't nobody got time for that.\n\t\t\t */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\t/* ORing two positives gives a positive, so safe to\n\t\t\t * cast result into s64.\n\t\t\t */\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_LSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* We lose all sign bit information (except what we can pick\n\t\t * up from var_off)\n\t\t */\n\t\tdst_reg->smin_value = S64_MIN;\n\t\tdst_reg->smax_value = S64_MAX;\n\t\t/* If we might shift our top bit out, then we know nothing */\n\t\tif (dst_reg->umax_value > 1ULL << (63 - umax_val)) {\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\tdst_reg->umin_value <<= umin_val;\n\t\t\tdst_reg->umax_value <<= umax_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_lshift(dst_reg->var_off, umin_val);\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_RSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* BPF_RSH is an unsigned shift. If the value in dst_reg might\n\t\t * be negative, then either:\n\t\t * 1) src_reg might be zero, so the sign bit of the result is\n\t\t * unknown, so we lose our signed bounds\n\t\t * 2) it's known negative, thus the unsigned bounds capture the\n\t\t * signed bounds\n\t\t * 3) the signed bounds cross zero, so they tell us nothing\n\t\t * about the result\n\t\t * If the value in dst_reg is known nonnegative, then again the\n\t\t * unsigned bounts capture the signed bounds.\n\t\t * Thus, in all cases it suffices to blow away our signed bounds\n\t\t * and rely on inferring new ones from the unsigned bounds and\n\t\t * var_off of the result.\n\t\t */\n\t\tdst_reg->smin_value = S64_MIN;\n\t\tdst_reg->smax_value = S64_MAX;\n\t\tdst_reg->var_off = tnum_rshift(dst_reg->var_off, umin_val);\n\t\tdst_reg->umin_value >>= umax_val;\n\t\tdst_reg->umax_value >>= umin_val;\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_ARSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Upon reaching here, src_known is true and\n\t\t * umax_val is equal to umin_val.\n\t\t */\n\t\tdst_reg->smin_value >>= umin_val;\n\t\tdst_reg->smax_value >>= umin_val;\n\t\tdst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val);\n\n\t\t/* blow away the dst_reg umin_value/umax_value and rely on\n\t\t * dst_reg var_off to refine the result.\n\t\t */\n\t\tdst_reg->umin_value = 0;\n\t\tdst_reg->umax_value = U64_MAX;\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tdefault:\n\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\tbreak;\n\t}\n\n\tif (BPF_CLASS(insn->code) != BPF_ALU64) {\n\t\t/* 32-bit ALU ops are (32,32)->32 */\n\t\tcoerce_reg_to_size(dst_reg, 4);\n\t\tcoerce_reg_to_size(&src_reg, 4);\n\t}\n\n\t__reg_deduce_bounds(dst_reg);\n\t__reg_bound_offset(dst_reg);\n\treturn 0;\n}","target":"static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env,\n\t\t\t\t struct bpf_insn *insn,\n\t\t\t\t struct bpf_reg_state *dst_reg,\n\t\t\t\t struct bpf_reg_state src_reg)\n{\n\tstruct bpf_reg_state *regs = cur_regs(env);\n\tu8 opcode = BPF_OP(insn->code);\n\tbool src_known, dst_known;\n\ts64 smin_val, smax_val;\n\tu64 umin_val, umax_val;\n\tu64 insn_bitness = (BPF_CLASS(insn->code) == BPF_ALU64) ? 64 : 32;\n\n\tif (insn_bitness == 32) {\n\t\t/* Relevant for 32-bit RSH: Information can propagate towards\n\t\t * LSB, so it isn't sufficient to only truncate the output to\n\t\t * 32 bits.\n\t\t */\n\t\tcoerce_reg_to_size(dst_reg, 4);\n\t\tcoerce_reg_to_size(&src_reg, 4);\n\t}\n\n\tsmin_val = src_reg.smin_value;\n\tsmax_val = src_reg.smax_value;\n\tumin_val = src_reg.umin_value;\n\tumax_val = src_reg.umax_value;\n\tsrc_known = tnum_is_const(src_reg.var_off);\n\tdst_known = tnum_is_const(dst_reg->var_off);\n\n\tif ((src_known && (smin_val != smax_val || umin_val != umax_val)) ||\n\t smin_val > smax_val || umin_val > umax_val) {\n\t\t/* Taint dst register if offset had invalid bounds derived from\n\t\t * e.g. dead branches.\n\t\t */\n\t\t__mark_reg_unknown(dst_reg);\n\t\treturn 0;\n\t}\n\n\tif (!src_known &&\n\t opcode != BPF_ADD && opcode != BPF_SUB && opcode != BPF_AND) {\n\t\t__mark_reg_unknown(dst_reg);\n\t\treturn 0;\n\t}\n\n\tswitch (opcode) {\n\tcase BPF_ADD:\n\t\tif (signed_add_overflows(dst_reg->smin_value, smin_val) ||\n\t\t signed_add_overflows(dst_reg->smax_value, smax_val)) {\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value += smin_val;\n\t\t\tdst_reg->smax_value += smax_val;\n\t\t}\n\t\tif (dst_reg->umin_value + umin_val < umin_val ||\n\t\t dst_reg->umax_value + umax_val < umax_val) {\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\tdst_reg->umin_value += umin_val;\n\t\t\tdst_reg->umax_value += umax_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_add(dst_reg->var_off, src_reg.var_off);\n\t\tbreak;\n\tcase BPF_SUB:\n\t\tif (signed_sub_overflows(dst_reg->smin_value, smax_val) ||\n\t\t signed_sub_overflows(dst_reg->smax_value, smin_val)) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value -= smax_val;\n\t\t\tdst_reg->smax_value -= smin_val;\n\t\t}\n\t\tif (dst_reg->umin_value < umax_val) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\t/* Cannot overflow (as long as bounds are consistent) */\n\t\t\tdst_reg->umin_value -= umax_val;\n\t\t\tdst_reg->umax_value -= umin_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_sub(dst_reg->var_off, src_reg.var_off);\n\t\tbreak;\n\tcase BPF_MUL:\n\t\tdst_reg->var_off = tnum_mul(dst_reg->var_off, src_reg.var_off);\n\t\tif (smin_val < 0 || dst_reg->smin_value < 0) {\n\t\t\t/* Ain't nobody got time to multiply that sign */\n\t\t\t__mark_reg_unbounded(dst_reg);\n\t\t\t__update_reg_bounds(dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* Both values are positive, so we can work with unsigned and\n\t\t * copy the result to signed (unless it exceeds S64_MAX).\n\t\t */\n\t\tif (umax_val > U32_MAX || dst_reg->umax_value > U32_MAX) {\n\t\t\t/* Potential overflow, we know nothing */\n\t\t\t__mark_reg_unbounded(dst_reg);\n\t\t\t/* (except what we can learn from the var_off) */\n\t\t\t__update_reg_bounds(dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\tdst_reg->umin_value *= umin_val;\n\t\tdst_reg->umax_value *= umax_val;\n\t\tif (dst_reg->umax_value > S64_MAX) {\n\t\t\t/* Overflow possible, we know nothing */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\tbreak;\n\tcase BPF_AND:\n\t\tif (src_known && dst_known) {\n\t\t\t__mark_reg_known(dst_reg, dst_reg->var_off.value &\n\t\t\t\t\t\t src_reg.var_off.value);\n\t\t\tbreak;\n\t\t}\n\t\t/* We get our minimum from the var_off, since that's inherently\n\t\t * bitwise. Our maximum is the minimum of the operands' maxima.\n\t\t */\n\t\tdst_reg->var_off = tnum_and(dst_reg->var_off, src_reg.var_off);\n\t\tdst_reg->umin_value = dst_reg->var_off.value;\n\t\tdst_reg->umax_value = min(dst_reg->umax_value, umax_val);\n\t\tif (dst_reg->smin_value < 0 || smin_val < 0) {\n\t\t\t/* Lose signed bounds when ANDing negative numbers,\n\t\t\t * ain't nobody got time for that.\n\t\t\t */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\t/* ANDing two positives gives a positive, so safe to\n\t\t\t * cast result into s64.\n\t\t\t */\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_OR:\n\t\tif (src_known && dst_known) {\n\t\t\t__mark_reg_known(dst_reg, dst_reg->var_off.value |\n\t\t\t\t\t\t src_reg.var_off.value);\n\t\t\tbreak;\n\t\t}\n\t\t/* We get our maximum from the var_off, and our minimum is the\n\t\t * maximum of the operands' minima\n\t\t */\n\t\tdst_reg->var_off = tnum_or(dst_reg->var_off, src_reg.var_off);\n\t\tdst_reg->umin_value = max(dst_reg->umin_value, umin_val);\n\t\tdst_reg->umax_value = dst_reg->var_off.value |\n\t\t\t\t dst_reg->var_off.mask;\n\t\tif (dst_reg->smin_value < 0 || smin_val < 0) {\n\t\t\t/* Lose signed bounds when ORing negative numbers,\n\t\t\t * ain't nobody got time for that.\n\t\t\t */\n\t\t\tdst_reg->smin_value = S64_MIN;\n\t\t\tdst_reg->smax_value = S64_MAX;\n\t\t} else {\n\t\t\t/* ORing two positives gives a positive, so safe to\n\t\t\t * cast result into s64.\n\t\t\t */\n\t\t\tdst_reg->smin_value = dst_reg->umin_value;\n\t\t\tdst_reg->smax_value = dst_reg->umax_value;\n\t\t}\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_LSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* We lose all sign bit information (except what we can pick\n\t\t * up from var_off)\n\t\t */\n\t\tdst_reg->smin_value = S64_MIN;\n\t\tdst_reg->smax_value = S64_MAX;\n\t\t/* If we might shift our top bit out, then we know nothing */\n\t\tif (dst_reg->umax_value > 1ULL << (63 - umax_val)) {\n\t\t\tdst_reg->umin_value = 0;\n\t\t\tdst_reg->umax_value = U64_MAX;\n\t\t} else {\n\t\t\tdst_reg->umin_value <<= umin_val;\n\t\t\tdst_reg->umax_value <<= umax_val;\n\t\t}\n\t\tdst_reg->var_off = tnum_lshift(dst_reg->var_off, umin_val);\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_RSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\t\t/* BPF_RSH is an unsigned shift. If the value in dst_reg might\n\t\t * be negative, then either:\n\t\t * 1) src_reg might be zero, so the sign bit of the result is\n\t\t * unknown, so we lose our signed bounds\n\t\t * 2) it's known negative, thus the unsigned bounds capture the\n\t\t * signed bounds\n\t\t * 3) the signed bounds cross zero, so they tell us nothing\n\t\t * about the result\n\t\t * If the value in dst_reg is known nonnegative, then again the\n\t\t * unsigned bounts capture the signed bounds.\n\t\t * Thus, in all cases it suffices to blow away our signed bounds\n\t\t * and rely on inferring new ones from the unsigned bounds and\n\t\t * var_off of the result.\n\t\t */\n\t\tdst_reg->smin_value = S64_MIN;\n\t\tdst_reg->smax_value = S64_MAX;\n\t\tdst_reg->var_off = tnum_rshift(dst_reg->var_off, umin_val);\n\t\tdst_reg->umin_value >>= umax_val;\n\t\tdst_reg->umax_value >>= umin_val;\n\t\t/* We may learn something more from the var_off */\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tcase BPF_ARSH:\n\t\tif (umax_val >= insn_bitness) {\n\t\t\t/* Shifts greater than 31 or 63 are undefined.\n\t\t\t * This includes shifts by a negative number.\n\t\t\t */\n\t\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Upon reaching here, src_known is true and\n\t\t * umax_val is equal to umin_val.\n\t\t */\n\t\tdst_reg->smin_value >>= umin_val;\n\t\tdst_reg->smax_value >>= umin_val;\n\t\tdst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val);\n\n\t\t/* blow away the dst_reg umin_value/umax_value and rely on\n\t\t * dst_reg var_off to refine the result.\n\t\t */\n\t\tdst_reg->umin_value = 0;\n\t\tdst_reg->umax_value = U64_MAX;\n\t\t__update_reg_bounds(dst_reg);\n\t\tbreak;\n\tdefault:\n\t\tmark_reg_unknown(env, regs, insn->dst_reg);\n\t\tbreak;\n\t}\n\n\tif (BPF_CLASS(insn->code) != BPF_ALU64) {\n\t\t/* 32-bit ALU ops are (32,32)->32 */\n\t\tcoerce_reg_to_size(dst_reg, 4);\n\t}\n\n\t__reg_deduce_bounds(dst_reg);\n\t__reg_bound_offset(dst_reg);\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"adjust_scalar_min_max_vals","file_name":"kernel/bpf/verifier.c","commit_link":"github.com/torvalds/linux/commit/b799207e1e1816b09e7a5920fbb2d5fcf6edd681","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#99-5f94022d85cc","input":"static void ip_cmsg_recv_checksum(struct msghdr *msg, struct sk_buff *skb,\n\t\t\t\t int tlen, int offset)\n{\n\t__wsum csum = skb->csum;\n\n\tif (skb->ip_summed != CHECKSUM_COMPLETE)\n\t\treturn;\n\n\tif (offset != 0)\n\t\tcsum = csum_sub(csum,\n\t\t\t\tcsum_partial(skb_transport_header(skb) + tlen,\n\t\t\t\t\t offset, 0));\n\n\tput_cmsg(msg, SOL_IP, IP_CHECKSUM, sizeof(__wsum), &csum);\n}","target":"static void ip_cmsg_recv_checksum(struct msghdr *msg, struct sk_buff *skb,\n\t\t\t\t int tlen, int offset)\n{\n\t__wsum csum = skb->csum;\n\n\tif (skb->ip_summed != CHECKSUM_COMPLETE)\n\t\treturn;\n\n\tif (offset != 0) {\n\t\tint tend_off = skb_transport_offset(skb) + tlen;\n\t\tcsum = csum_sub(csum, skb_checksum(skb, tend_off, offset, 0));\n\t}\n\n\tput_cmsg(msg, SOL_IP, IP_CHECKSUM, sizeof(__wsum), &csum);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ip_cmsg_recv_checksum","file_name":"net/ipv4/ip_sockglue.c","commit_link":"github.com/torvalds/linux/commit/ca4ef4574f1ee5252e2cd365f8f5d5bafd048f32","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#100-b2130ff83dbb","input":" static bool TryParse(const char* inp, int length,\n TypedValue* buf, Variant& out,\n JSONContainerType container_type, bool is_tsimplejson) {\n SimpleParser parser(inp, length, buf, container_type, is_tsimplejson);\n bool ok = parser.parseValue();\n parser.skipSpace();\n if (!ok || parser.p != inp + length) {\n // Unsupported, malformed, or trailing garbage. Release entire stack.\n tvDecRefRange(buf, parser.top);\n return false;\n }\n out = Variant::attach(*--parser.top);\n return true;\n }","target":" static bool TryParse(const char* inp, int length,\n TypedValue* buf, Variant& out,\n JSONContainerType container_type, bool is_tsimplejson) {\n SimpleParser parser(inp, length, buf, container_type, is_tsimplejson);\n bool ok = parser.parseValue();\n if (!ok ||\n (parser.skipSpace(), parser.p != inp + length)) {\n // Unsupported, malformed, or trailing garbage. Release entire stack.\n tvDecRefRange(buf, parser.top);\n return false;\n }\n out = Variant::attach(*--parser.top);\n return true;\n }","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"HPHP::SimpleParser::TryParse","file_name":"hphp/runtime/ext/json/JSON_parser.cpp","commit_link":"github.com/facebook/hhvm/commit/bd586671a3c22eb2f07e55f11b3ce64e1f7961e7","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#101-9d01383de1a6","input":"static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter)\n{\n\tdouble width_d;\n\tdouble scale_f_d = 1.0;\n\tconst double filter_width_d = DEFAULT_BOX_RADIUS;\n\tint windows_size;\n\tunsigned int u;\n\tLineContribType *res;\n\n\tif (scale_d < 1.0) {\n\t\twidth_d = filter_width_d / scale_d;\n\t\tscale_f_d = scale_d;\n\t} else {\n\t\twidth_d= filter_width_d;\n\t}\n\n\twindows_size = 2 * (int)ceil(width_d) + 1;\n\tres = _gdContributionsAlloc(line_size, windows_size);\n\n\tfor (u = 0; u < line_size; u++) {\n\t\tconst double dCenter = (double)u / scale_d;\n\t\t/* get the significant edge points affecting the pixel */\n\t\tregister int iLeft = MAX(0, (int)floor (dCenter - width_d));\n\t\tint iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1);\n\t\tdouble dTotalWeight = 0.0;\n\t\tint iSrc;\n\n\t\tres->ContribRow[u].Left = iLeft;\n\t\tres->ContribRow[u].Right = iRight;\n\n\t\t/* Cut edge points to fit in filter window in case of spill-off */\n\t\tif (iRight - iLeft + 1 > windows_size) {\n\t\t\tif (iLeft < ((int)src_size - 1 / 2)) {\n\t\t\t\tiLeft++;\n\t\t\t} else {\n\t\t\t\tiRight--;\n\t\t\t}\n\t\t}\n\n\t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n\t\t\tdTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc)));\n\t\t}\n\n\t\tif (dTotalWeight < 0.0) {\n\t\t\t_gdContributionsFree(res);\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (dTotalWeight > 0.0) {\n\t\t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n\t\t\t\tres->ContribRow[u].Weights[iSrc-iLeft] /= dTotalWeight;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}","target":"static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter)\n{\n\tdouble width_d;\n\tdouble scale_f_d = 1.0;\n\tconst double filter_width_d = DEFAULT_BOX_RADIUS;\n\tint windows_size;\n\tunsigned int u;\n\tLineContribType *res;\n\n\tif (scale_d < 1.0) {\n\t\twidth_d = filter_width_d / scale_d;\n\t\tscale_f_d = scale_d;\n\t} else {\n\t\twidth_d= filter_width_d;\n\t}\n\n\twindows_size = 2 * (int)ceil(width_d) + 1;\n\tres = _gdContributionsAlloc(line_size, windows_size);\n\n\tfor (u = 0; u < line_size; u++) {\n\t\tconst double dCenter = (double)u / scale_d;\n\t\t/* get the significant edge points affecting the pixel */\n\t\tregister int iLeft = MAX(0, (int)floor (dCenter - width_d));\n\t\tint iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1);\n\t\tdouble dTotalWeight = 0.0;\n\t\tint iSrc;\n\n\t\t/* Cut edge points to fit in filter window in case of spill-off */\n\t\tif (iRight - iLeft + 1 > windows_size) {\n\t\t\tif (iLeft < ((int)src_size - 1 / 2)) {\n\t\t\t\tiLeft++;\n\t\t\t} else {\n\t\t\t\tiRight--;\n\t\t\t}\n\t\t}\n\n\t\tres->ContribRow[u].Left = iLeft;\n\t\tres->ContribRow[u].Right = iRight;\n\n\t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n\t\t\tdTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc)));\n\t\t}\n\n\t\tif (dTotalWeight < 0.0) {\n\t\t\t_gdContributionsFree(res);\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (dTotalWeight > 0.0) {\n\t\t\tfor (iSrc = iLeft; iSrc <= iRight; iSrc++) {\n\t\t\t\tres->ContribRow[u].Weights[iSrc-iLeft] /= dTotalWeight;\n\t\t\t}\n\t\t}\n\t}\n\treturn res;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"_gdContributionsCalc","file_name":"src/gd_interpolation.c","commit_link":"github.com/libgd/libgd/commit/4f65a3e4eedaffa1efcf9ee1eb08f0b504fbc31a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#102-03b25be49e8f","input":"static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,\n ExceptionInfo *exception)\n{\n char\n *attribute,\n format[MagickPathExtent],\n name[MagickPathExtent],\n *resource;\n\n const StringInfo\n *profile;\n\n const unsigned char\n *info;\n\n long\n start,\n stop;\n\n MagickBooleanType\n status;\n\n register ssize_t\n i;\n\n size_t\n length;\n\n ssize_t\n count,\n id,\n sub_number;\n\n /*\n There are no newlines in path names, so it's safe as terminator.\n */\n profile=GetImageProfile(image,\"8bim\");\n if (profile == (StringInfo *) NULL)\n return(MagickFalse);\n count=(ssize_t) sscanf(key,\"8BIM:%ld,%ld:%1024[^\\n]\\n%1024[^\\n]\",&start,&stop,\n name,format);\n if ((count != 2) && (count != 3) && (count != 4))\n return(MagickFalse);\n if (count < 4)\n (void) CopyMagickString(format,\"SVG\",MagickPathExtent);\n if (count < 3)\n *name='\\0';\n sub_number=1;\n if (*name == '#')\n sub_number=(ssize_t) StringToLong(&name[1]);\n sub_number=MagickMax(sub_number,1L);\n resource=(char *) NULL;\n status=MagickFalse;\n length=GetStringInfoLength(profile);\n info=GetStringInfoDatum(profile);\n while ((length > 0) && (status == MagickFalse))\n {\n if (ReadPropertyByte(&info,&length) != (unsigned char) '8')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'B')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'I')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'M')\n continue;\n id=(ssize_t) ReadPropertyMSBShort(&info,&length);\n if (id < (ssize_t) start)\n continue;\n if (id > (ssize_t) stop)\n continue;\n if (resource != (char *) NULL)\n resource=DestroyString(resource);\n count=(ssize_t) ReadPropertyByte(&info,&length);\n if ((count != 0) && ((size_t) count <= length))\n {\n resource=(char *) NULL;\n if (~((size_t) count) >= (MagickPathExtent-1))\n resource=(char *) AcquireQuantumMemory((size_t) count+\n MagickPathExtent,sizeof(*resource));\n if (resource != (char *) NULL)\n {\n for (i=0; i < (ssize_t) count; i++)\n resource[i]=(char) ReadPropertyByte(&info,&length);\n resource[count]='\\0';\n }\n }\n if ((count & 0x01) == 0)\n (void) ReadPropertyByte(&info,&length);\n count=(ssize_t) ReadPropertyMSBLong(&info,&length);\n if ((*name != '\\0') && (*name != '#'))\n if ((resource == (char *) NULL) || (LocaleCompare(name,resource) != 0))\n {\n /*\n No name match, scroll forward and try next.\n */\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n continue;\n }\n if ((*name == '#') && (sub_number != 1))\n {\n /*\n No numbered match, scroll forward and try next.\n */\n sub_number--;\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n continue;\n }\n /*\n We have the resource of interest.\n */\n attribute=(char *) NULL;\n if (~((size_t) count) >= (MagickPathExtent-1))\n attribute=(char *) AcquireQuantumMemory((size_t) count+MagickPathExtent,\n sizeof(*attribute));\n if (attribute != (char *) NULL)\n {\n (void) CopyMagickMemory(attribute,(char *) info,(size_t) count);\n attribute[count]='\\0';\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n if ((id <= 1999) || (id >= 2999))\n (void) SetImageProperty((Image *) image,key,(const char *)\n attribute,exception);\n else\n {\n char\n *path;\n\n if (LocaleCompare(format,\"svg\") == 0)\n path=TraceSVGClippath((unsigned char *) attribute,(size_t) count,\n image->columns,image->rows);\n else\n path=TracePSClippath((unsigned char *) attribute,(size_t) count);\n (void) SetImageProperty((Image *) image,key,(const char *) path,\n exception);\n path=DestroyString(path);\n }\n attribute=DestroyString(attribute);\n status=MagickTrue;\n }\n }\n if (resource != (char *) NULL)\n resource=DestroyString(resource);\n return(status);\n}","target":"static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,\n ExceptionInfo *exception)\n{\n char\n *attribute,\n format[MagickPathExtent],\n name[MagickPathExtent],\n *resource;\n\n const StringInfo\n *profile;\n\n const unsigned char\n *info;\n\n long\n start,\n stop;\n\n MagickBooleanType\n status;\n\n register ssize_t\n i;\n\n size_t\n length;\n\n ssize_t\n count,\n id,\n sub_number;\n\n /*\n There are no newlines in path names, so it's safe as terminator.\n */\n profile=GetImageProfile(image,\"8bim\");\n if (profile == (StringInfo *) NULL)\n return(MagickFalse);\n count=(ssize_t) sscanf(key,\"8BIM:%ld,%ld:%1024[^\\n]\\n%1024[^\\n]\",&start,&stop,\n name,format);\n if ((count != 2) && (count != 3) && (count != 4))\n return(MagickFalse);\n if (count < 4)\n (void) CopyMagickString(format,\"SVG\",MagickPathExtent);\n if (count < 3)\n *name='\\0';\n sub_number=1;\n if (*name == '#')\n sub_number=(ssize_t) StringToLong(&name[1]);\n sub_number=MagickMax(sub_number,1L);\n resource=(char *) NULL;\n status=MagickFalse;\n length=GetStringInfoLength(profile);\n info=GetStringInfoDatum(profile);\n while ((length > 0) && (status == MagickFalse))\n {\n if (ReadPropertyByte(&info,&length) != (unsigned char) '8')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'B')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'I')\n continue;\n if (ReadPropertyByte(&info,&length) != (unsigned char) 'M')\n continue;\n id=(ssize_t) ReadPropertyMSBShort(&info,&length);\n if (id < (ssize_t) start)\n continue;\n if (id > (ssize_t) stop)\n continue;\n if (resource != (char *) NULL)\n resource=DestroyString(resource);\n count=(ssize_t) ReadPropertyByte(&info,&length);\n if ((count != 0) && ((size_t) count <= length))\n {\n resource=(char *) NULL;\n if (~((size_t) count) >= (MagickPathExtent-1))\n resource=(char *) AcquireQuantumMemory((size_t) count+\n MagickPathExtent,sizeof(*resource));\n if (resource != (char *) NULL)\n {\n for (i=0; i < (ssize_t) count; i++)\n resource[i]=(char) ReadPropertyByte(&info,&length);\n resource[count]='\\0';\n }\n }\n if ((count & 0x01) == 0)\n (void) ReadPropertyByte(&info,&length);\n count=(ssize_t) ReadPropertyMSBLong(&info,&length);\n if ((count < 0) || ((size_t) count > length))\n {\n length=0; \n continue;\n }\n if ((*name != '\\0') && (*name != '#'))\n if ((resource == (char *) NULL) || (LocaleCompare(name,resource) != 0))\n {\n /*\n No name match, scroll forward and try next.\n */\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n continue;\n }\n if ((*name == '#') && (sub_number != 1))\n {\n /*\n No numbered match, scroll forward and try next.\n */\n sub_number--;\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n continue;\n }\n /*\n We have the resource of interest.\n */\n attribute=(char *) NULL;\n if (~((size_t) count) >= (MagickPathExtent-1))\n attribute=(char *) AcquireQuantumMemory((size_t) count+MagickPathExtent,\n sizeof(*attribute));\n if (attribute != (char *) NULL)\n {\n (void) CopyMagickMemory(attribute,(char *) info,(size_t) count);\n attribute[count]='\\0';\n info+=count;\n length-=MagickMin(count,(ssize_t) length);\n if ((id <= 1999) || (id >= 2999))\n (void) SetImageProperty((Image *) image,key,(const char *)\n attribute,exception);\n else\n {\n char\n *path;\n\n if (LocaleCompare(format,\"svg\") == 0)\n path=TraceSVGClippath((unsigned char *) attribute,(size_t) count,\n image->columns,image->rows);\n else\n path=TracePSClippath((unsigned char *) attribute,(size_t) count);\n (void) SetImageProperty((Image *) image,key,(const char *) path,\n exception);\n path=DestroyString(path);\n }\n attribute=DestroyString(attribute);\n status=MagickTrue;\n }\n }\n if (resource != (char *) NULL)\n resource=DestroyString(resource);\n return(status);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"Get8BIMProperty","file_name":"MagickCore/property.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/dd84447b63a71fa8c3f47071b09454efc667767b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#103-afe312d9814f","input":"static const char *parse_string(cJSON *item,const char *str,const char **ep)\n{\n\tconst char *ptr=str+1,*end_ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2;\n\tif (*str!='\\\"') {*ep=str;return 0;}\t/* not a string! */\n\t\n\twhile (*end_ptr!='\\\"' && *end_ptr && ++len) if (*end_ptr++ == '\\\\') end_ptr++;\t/* Skip escaped quotes. */\n\t\n\tout=(char*)cJSON_malloc(len+1);\t/* This is how long we need for the string, roughly. */\n\tif (!out) return 0;\n\titem->valuestring=out; /* assign here so out will be deleted during cJSON_Delete() later */\n\titem->type=cJSON_String;\n\t\n\tptr=str+1;ptr2=out;\n\twhile (ptr < end_ptr)\n\t{\n\t\tif (*ptr!='\\\\') *ptr2++=*ptr++;\n\t\telse\n\t\t{\n\t\t\tptr++;\n\t\t\tswitch (*ptr)\n\t\t\t{\n\t\t\t\tcase 'b': *ptr2++='\\b';\tbreak;\n\t\t\t\tcase 'f': *ptr2++='\\f';\tbreak;\n\t\t\t\tcase 'n': *ptr2++='\\n';\tbreak;\n\t\t\t\tcase 'r': *ptr2++='\\r';\tbreak;\n\t\t\t\tcase 't': *ptr2++='\\t';\tbreak;\n\t\t\t\tcase 'u':\t /* transcode utf16 to utf8. */\n\t\t\t\t\tuc=parse_hex4(ptr+1);ptr+=4;\t/* get the unicode char. */\n\t\t\t\t\tif (ptr >= end_ptr) {*ep=str;return 0;}\t/* invalid */\n\t\t\t\t\t\n\t\t\t\t\tif ((uc>=0xDC00 && uc<=0xDFFF) || uc==0) {*ep=str;return 0;}\t/* check for invalid. */\n\t\t\t\t\t\n\t\t\t\t\tif (uc>=0xD800 && uc<=0xDBFF)\t/* UTF16 surrogate pairs.\t*/\n\t\t\t\t\t{\n\t\t\t\t\t\tif (ptr+6 > end_ptr) {*ep=str;return 0;}\t/* invalid */\n\t\t\t\t\t\tif (ptr[1]!='\\\\' || ptr[2]!='u') {*ep=str;return 0;}\t/* missing second-half of surrogate. */\n\t\t\t\t\t\tuc2=parse_hex4(ptr+3);ptr+=6;\n\t\t\t\t\t\tif (uc2<0xDC00 || uc2>0xDFFF) {*ep=str;return 0;}\t/* invalid second-half of surrogate. */\n\t\t\t\t\t\tuc=0x10000 + (((uc&0x3FF)<<10) | (uc2&0x3FF));\n\t\t\t\t\t}\n\n\t\t\t\t\tlen=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len;\n\t\t\t\t\t\n\t\t\t\t\tswitch (len) {\n\t\t\t\t\t\tcase 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 1: *--ptr2 =(uc | firstByteMark[len]);\n\t\t\t\t\t}\n\t\t\t\t\tptr2+=len;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: *ptr2++=*ptr; break;\n\t\t\t}\n\t\t\tptr++;\n\t\t}\n\t}\n\t*ptr2=0;\n\tif (*ptr=='\\\"') ptr++;\n\treturn ptr;\n}","target":"static const char *parse_string(cJSON *item,const char *str,const char **ep)\n{\n\tconst char *ptr=str+1,*end_ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2;\n\tif (*str!='\\\"') {*ep=str;return 0;}\t/* not a string! */\n\n\twhile (*end_ptr!='\\\"' && *end_ptr && ++len)\n\t{\n\t if (*end_ptr++ == '\\\\')\n\t {\n\t\tif (*end_ptr == '\\0')\n\t\t{\n\t\t /* prevent buffer overflow when last input character is a backslash */\n\t\t return 0;\n\t\t}\n\t\tend_ptr++;\t/* Skip escaped quotes. */\n\t }\n\t}\n\n\tout=(char*)cJSON_malloc(len+1);\t/* This is how long we need for the string, roughly. */\n\tif (!out) return 0;\n\titem->valuestring=out; /* assign here so out will be deleted during cJSON_Delete() later */\n\titem->type=cJSON_String;\n\t\n\tptr=str+1;ptr2=out;\n\twhile (ptr < end_ptr)\n\t{\n\t\tif (*ptr!='\\\\') *ptr2++=*ptr++;\n\t\telse\n\t\t{\n\t\t\tptr++;\n\t\t\tswitch (*ptr)\n\t\t\t{\n\t\t\t\tcase 'b': *ptr2++='\\b';\tbreak;\n\t\t\t\tcase 'f': *ptr2++='\\f';\tbreak;\n\t\t\t\tcase 'n': *ptr2++='\\n';\tbreak;\n\t\t\t\tcase 'r': *ptr2++='\\r';\tbreak;\n\t\t\t\tcase 't': *ptr2++='\\t';\tbreak;\n\t\t\t\tcase 'u':\t /* transcode utf16 to utf8. */\n\t\t\t\t\tuc=parse_hex4(ptr+1);ptr+=4;\t/* get the unicode char. */\n\t\t\t\t\tif (ptr >= end_ptr) {*ep=str;return 0;}\t/* invalid */\n\t\t\t\t\t\n\t\t\t\t\tif ((uc>=0xDC00 && uc<=0xDFFF) || uc==0) {*ep=str;return 0;}\t/* check for invalid. */\n\t\t\t\t\t\n\t\t\t\t\tif (uc>=0xD800 && uc<=0xDBFF)\t/* UTF16 surrogate pairs.\t*/\n\t\t\t\t\t{\n\t\t\t\t\t\tif (ptr+6 > end_ptr) {*ep=str;return 0;}\t/* invalid */\n\t\t\t\t\t\tif (ptr[1]!='\\\\' || ptr[2]!='u') {*ep=str;return 0;}\t/* missing second-half of surrogate. */\n\t\t\t\t\t\tuc2=parse_hex4(ptr+3);ptr+=6;\n\t\t\t\t\t\tif (uc2<0xDC00 || uc2>0xDFFF) {*ep=str;return 0;}\t/* invalid second-half of surrogate. */\n\t\t\t\t\t\tuc=0x10000 + (((uc&0x3FF)<<10) | (uc2&0x3FF));\n\t\t\t\t\t}\n\n\t\t\t\t\tlen=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len;\n\t\t\t\t\t\n\t\t\t\t\tswitch (len) {\n\t\t\t\t\t\tcase 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;\n\t\t\t\t\t\tcase 1: *--ptr2 =(uc | firstByteMark[len]);\n\t\t\t\t\t}\n\t\t\t\t\tptr2+=len;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: *ptr2++=*ptr; break;\n\t\t\t}\n\t\t\tptr++;\n\t\t}\n\t}\n\t*ptr2=0;\n\tif (*ptr=='\\\"') ptr++;\n\treturn ptr;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"parse_string","file_name":"cJSON.c","commit_link":"github.com/DaveGamble/cJSON/commit/94df772485c92866ca417d92137747b2e3b0a917","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#104-e0bbfbc00b74","input":"dbd_st_prepare(\n SV *sth,\n imp_sth_t *imp_sth,\n char *statement,\n SV *attribs)\n{\n int i;\n SV **svp;\n dTHX;\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n#if MYSQL_VERSION_ID < CALL_PLACEHOLDER_VERSION\n char *str_ptr, *str_last_ptr;\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n int limit_flag=0;\n#endif\n#endif\n int col_type, prepare_retval;\n MYSQL_BIND *bind, *bind_end;\n imp_sth_phb_t *fbind;\n#endif\n D_imp_xxh(sth);\n D_imp_dbh_from_sth;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t-> dbd_st_prepare MYSQL_VERSION_ID %d, SQL statement: %s\\n\",\n MYSQL_VERSION_ID, statement);\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n /* Set default value of 'mysql_server_prepare' attribute for sth from dbh */\n imp_sth->use_server_side_prepare= imp_dbh->use_server_side_prepare;\n if (attribs)\n {\n svp= DBD_ATTRIB_GET_SVP(attribs, \"mysql_server_prepare\", 20);\n imp_sth->use_server_side_prepare = (svp) ?\n SvTRUE(*svp) : imp_dbh->use_server_side_prepare;\n\n svp = DBD_ATTRIB_GET_SVP(attribs, \"async\", 5);\n\n if(svp && SvTRUE(*svp)) {\n#if MYSQL_ASYNC\n imp_sth->is_async = TRUE;\n imp_sth->use_server_side_prepare = FALSE;\n#else\n do_error(sth, 2000,\n \"Async support was not built into this version of DBD::mysql\", \"HY000\");\n return 0;\n#endif\n }\n }\n\n imp_sth->fetch_done= 0;\n#endif\n\n imp_sth->done_desc= 0;\n imp_sth->result= NULL;\n imp_sth->currow= 0;\n\n /* Set default value of 'mysql_use_result' attribute for sth from dbh */\n svp= DBD_ATTRIB_GET_SVP(attribs, \"mysql_use_result\", 16);\n imp_sth->use_mysql_use_result= svp ?\n SvTRUE(*svp) : imp_dbh->use_mysql_use_result;\n\n for (i= 0; i < AV_ATTRIB_LAST; i++)\n imp_sth->av_attr[i]= Nullav;\n\n /*\n Clean-up previous result set(s) for sth to prevent\n 'Commands out of sync' error \n */\n mysql_st_free_result_sets(sth, imp_sth);\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION && MYSQL_VERSION_ID < CALL_PLACEHOLDER_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tuse_server_side_prepare set, check restrictions\\n\");\n /*\n This code is here because placeholder support is not implemented for\n statements with :-\n 1. LIMIT < 5.0.7\n 2. CALL < 5.5.3 (Added support for out & inout parameters)\n In these cases we have to disable server side prepared statements\n NOTE: These checks could cause a false positive on statements which\n include columns / table names that match \"call \" or \" limit \"\n */ \n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n \"\\t\\tneed to test for LIMIT & CALL\\n\");\n#else\n \"\\t\\tneed to test for restrictions\\n\");\n#endif\n str_last_ptr = statement + strlen(statement);\n for (str_ptr= statement; str_ptr < str_last_ptr; str_ptr++)\n {\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n /*\n Place holders not supported in LIMIT's\n */\n if (limit_flag)\n {\n if (*str_ptr == '?')\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tLIMIT and ? found, set to use_server_side_prepare=0\\n\");\n /* ... then we do not want to try server side prepare (use emulation) */\n imp_sth->use_server_side_prepare= 0;\n break;\n }\n }\n else if (str_ptr < str_last_ptr - 6 &&\n isspace(*(str_ptr + 0)) &&\n tolower(*(str_ptr + 1)) == 'l' &&\n tolower(*(str_ptr + 2)) == 'i' &&\n tolower(*(str_ptr + 3)) == 'm' &&\n tolower(*(str_ptr + 4)) == 'i' &&\n tolower(*(str_ptr + 5)) == 't' &&\n isspace(*(str_ptr + 6)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"LIMIT set limit flag to 1\\n\");\n limit_flag= 1;\n }\n#endif\n /*\n Place holders not supported in CALL's\n */\n if (str_ptr < str_last_ptr - 4 &&\n tolower(*(str_ptr + 0)) == 'c' &&\n tolower(*(str_ptr + 1)) == 'a' &&\n tolower(*(str_ptr + 2)) == 'l' &&\n tolower(*(str_ptr + 3)) == 'l' &&\n isspace(*(str_ptr + 4)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"Disable PS mode for CALL()\\n\");\n imp_sth->use_server_side_prepare= 0;\n break;\n }\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tuse_server_side_prepare set\\n\");\n /* do we really need this? If we do, we should return, not just continue */\n if (imp_sth->stmt)\n fprintf(stderr,\n \"ERROR: Trying to prepare new stmt while we have \\\n already not closed one \\n\");\n\n imp_sth->stmt= mysql_stmt_init(imp_dbh->pmysql);\n\n if (! imp_sth->stmt)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tERROR: Unable to return MYSQL_STMT structure \\\n from mysql_stmt_init(): ERROR NO: %d ERROR MSG:%s\\n\",\n mysql_errno(imp_dbh->pmysql),\n mysql_error(imp_dbh->pmysql));\n }\n\n prepare_retval= mysql_stmt_prepare(imp_sth->stmt,\n statement,\n strlen(statement));\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tmysql_stmt_prepare returned %d\\n\",\n prepare_retval);\n\n if (prepare_retval)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tmysql_stmt_prepare %d %s\\n\",\n mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt));\n\n /* For commands that are not supported by server side prepared statement\n mechanism lets try to pass them through regular API */\n if (mysql_stmt_errno(imp_sth->stmt) == ER_UNSUPPORTED_PS)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tSETTING imp_sth->use_server_side_prepare to 0\\n\");\n imp_sth->use_server_side_prepare= 0;\n }\n else\n {\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_sqlstate(imp_dbh->pmysql));\n mysql_stmt_close(imp_sth->stmt);\n imp_sth->stmt= NULL;\n return FALSE;\n }\n }\n else\n {\n DBIc_NUM_PARAMS(imp_sth)= mysql_stmt_param_count(imp_sth->stmt);\n /* mysql_stmt_param_count */\n\n if (DBIc_NUM_PARAMS(imp_sth) > 0)\n {\n int has_statement_fields= imp_sth->stmt->fields != 0;\n /* Allocate memory for bind variables */\n imp_sth->bind= alloc_bind(DBIc_NUM_PARAMS(imp_sth));\n imp_sth->fbind= alloc_fbind(DBIc_NUM_PARAMS(imp_sth));\n imp_sth->has_been_bound= 0;\n\n /* Initialize ph variables with NULL values */\n for (i= 0,\n bind= imp_sth->bind,\n fbind= imp_sth->fbind,\n bind_end= bind+DBIc_NUM_PARAMS(imp_sth);\n bind < bind_end ;\n bind++, fbind++, i++ )\n {\n /*\n if this statement has a result set, field types will be\n correctly identified. If there is no result set, such as\n with an INSERT, fields will not be defined, and all buffer_type\n will default to MYSQL_TYPE_VAR_STRING\n */\n col_type= (has_statement_fields ?\n imp_sth->stmt->fields[i].type : MYSQL_TYPE_STRING);\n\n bind->buffer_type= mysql_to_perl_type(col_type);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tmysql_to_perl_type returned %d\\n\", col_type);\n\n bind->buffer= NULL;\n bind->length= &(fbind->length);\n bind->is_null= (char*) &(fbind->is_null);\n fbind->is_null= 1;\n fbind->length= 0;\n }\n }\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n /* Count the number of parameters (driver, vs server-side) */\n if (imp_sth->use_server_side_prepare == 0)\n DBIc_NUM_PARAMS(imp_sth) = count_params((imp_xxh_t *)imp_dbh, aTHX_ statement,\n imp_dbh->bind_comment_placeholders);\n#else\n DBIc_NUM_PARAMS(imp_sth) = count_params((imp_xxh_t *)imp_dbh, aTHX_ statement,\n imp_dbh->bind_comment_placeholders);\n#endif\n\n /* Allocate memory for parameters */\n imp_sth->params= alloc_param(DBIc_NUM_PARAMS(imp_sth));\n DBIc_IMPSET_on(imp_sth);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_prepare\\n\");\n return 1;\n}","target":"dbd_st_prepare(\n SV *sth,\n imp_sth_t *imp_sth,\n char *statement,\n SV *attribs)\n{\n int i;\n SV **svp;\n dTHX;\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n#if MYSQL_VERSION_ID < CALL_PLACEHOLDER_VERSION\n char *str_ptr, *str_last_ptr;\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n int limit_flag=0;\n#endif\n#endif\n int prepare_retval;\n MYSQL_BIND *bind, *bind_end;\n imp_sth_phb_t *fbind;\n#endif\n D_imp_xxh(sth);\n D_imp_dbh_from_sth;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t-> dbd_st_prepare MYSQL_VERSION_ID %d, SQL statement: %s\\n\",\n MYSQL_VERSION_ID, statement);\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n /* Set default value of 'mysql_server_prepare' attribute for sth from dbh */\n imp_sth->use_server_side_prepare= imp_dbh->use_server_side_prepare;\n if (attribs)\n {\n svp= DBD_ATTRIB_GET_SVP(attribs, \"mysql_server_prepare\", 20);\n imp_sth->use_server_side_prepare = (svp) ?\n SvTRUE(*svp) : imp_dbh->use_server_side_prepare;\n\n svp = DBD_ATTRIB_GET_SVP(attribs, \"async\", 5);\n\n if(svp && SvTRUE(*svp)) {\n#if MYSQL_ASYNC\n imp_sth->is_async = TRUE;\n imp_sth->use_server_side_prepare = FALSE;\n#else\n do_error(sth, 2000,\n \"Async support was not built into this version of DBD::mysql\", \"HY000\");\n return 0;\n#endif\n }\n }\n\n imp_sth->fetch_done= 0;\n#endif\n\n imp_sth->done_desc= 0;\n imp_sth->result= NULL;\n imp_sth->currow= 0;\n\n /* Set default value of 'mysql_use_result' attribute for sth from dbh */\n svp= DBD_ATTRIB_GET_SVP(attribs, \"mysql_use_result\", 16);\n imp_sth->use_mysql_use_result= svp ?\n SvTRUE(*svp) : imp_dbh->use_mysql_use_result;\n\n for (i= 0; i < AV_ATTRIB_LAST; i++)\n imp_sth->av_attr[i]= Nullav;\n\n /*\n Clean-up previous result set(s) for sth to prevent\n 'Commands out of sync' error \n */\n mysql_st_free_result_sets(sth, imp_sth);\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION && MYSQL_VERSION_ID < CALL_PLACEHOLDER_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tuse_server_side_prepare set, check restrictions\\n\");\n /*\n This code is here because placeholder support is not implemented for\n statements with :-\n 1. LIMIT < 5.0.7\n 2. CALL < 5.5.3 (Added support for out & inout parameters)\n In these cases we have to disable server side prepared statements\n NOTE: These checks could cause a false positive on statements which\n include columns / table names that match \"call \" or \" limit \"\n */ \n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n \"\\t\\tneed to test for LIMIT & CALL\\n\");\n#else\n \"\\t\\tneed to test for restrictions\\n\");\n#endif\n str_last_ptr = statement + strlen(statement);\n for (str_ptr= statement; str_ptr < str_last_ptr; str_ptr++)\n {\n#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION\n /*\n Place holders not supported in LIMIT's\n */\n if (limit_flag)\n {\n if (*str_ptr == '?')\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tLIMIT and ? found, set to use_server_side_prepare=0\\n\");\n /* ... then we do not want to try server side prepare (use emulation) */\n imp_sth->use_server_side_prepare= 0;\n break;\n }\n }\n else if (str_ptr < str_last_ptr - 6 &&\n isspace(*(str_ptr + 0)) &&\n tolower(*(str_ptr + 1)) == 'l' &&\n tolower(*(str_ptr + 2)) == 'i' &&\n tolower(*(str_ptr + 3)) == 'm' &&\n tolower(*(str_ptr + 4)) == 'i' &&\n tolower(*(str_ptr + 5)) == 't' &&\n isspace(*(str_ptr + 6)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"LIMIT set limit flag to 1\\n\");\n limit_flag= 1;\n }\n#endif\n /*\n Place holders not supported in CALL's\n */\n if (str_ptr < str_last_ptr - 4 &&\n tolower(*(str_ptr + 0)) == 'c' &&\n tolower(*(str_ptr + 1)) == 'a' &&\n tolower(*(str_ptr + 2)) == 'l' &&\n tolower(*(str_ptr + 3)) == 'l' &&\n isspace(*(str_ptr + 4)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"Disable PS mode for CALL()\\n\");\n imp_sth->use_server_side_prepare= 0;\n break;\n }\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tuse_server_side_prepare set\\n\");\n /* do we really need this? If we do, we should return, not just continue */\n if (imp_sth->stmt)\n fprintf(stderr,\n \"ERROR: Trying to prepare new stmt while we have \\\n already not closed one \\n\");\n\n imp_sth->stmt= mysql_stmt_init(imp_dbh->pmysql);\n\n if (! imp_sth->stmt)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tERROR: Unable to return MYSQL_STMT structure \\\n from mysql_stmt_init(): ERROR NO: %d ERROR MSG:%s\\n\",\n mysql_errno(imp_dbh->pmysql),\n mysql_error(imp_dbh->pmysql));\n }\n\n prepare_retval= mysql_stmt_prepare(imp_sth->stmt,\n statement,\n strlen(statement));\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tmysql_stmt_prepare returned %d\\n\",\n prepare_retval);\n\n if (prepare_retval)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tmysql_stmt_prepare %d %s\\n\",\n mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt));\n\n /* For commands that are not supported by server side prepared statement\n mechanism lets try to pass them through regular API */\n if (mysql_stmt_errno(imp_sth->stmt) == ER_UNSUPPORTED_PS)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tSETTING imp_sth->use_server_side_prepare to 0\\n\");\n imp_sth->use_server_side_prepare= 0;\n }\n else\n {\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_sqlstate(imp_dbh->pmysql));\n mysql_stmt_close(imp_sth->stmt);\n imp_sth->stmt= NULL;\n return FALSE;\n }\n }\n else\n {\n DBIc_NUM_PARAMS(imp_sth)= mysql_stmt_param_count(imp_sth->stmt);\n /* mysql_stmt_param_count */\n\n if (DBIc_NUM_PARAMS(imp_sth) > 0)\n {\n /* Allocate memory for bind variables */\n imp_sth->bind= alloc_bind(DBIc_NUM_PARAMS(imp_sth));\n imp_sth->fbind= alloc_fbind(DBIc_NUM_PARAMS(imp_sth));\n imp_sth->has_been_bound= 0;\n\n /* Initialize ph variables with NULL values */\n for (i= 0,\n bind= imp_sth->bind,\n fbind= imp_sth->fbind,\n bind_end= bind+DBIc_NUM_PARAMS(imp_sth);\n bind < bind_end ;\n bind++, fbind++, i++ )\n {\n bind->buffer_type= MYSQL_TYPE_STRING;\n bind->buffer= NULL;\n bind->length= &(fbind->length);\n bind->is_null= (char*) &(fbind->is_null);\n fbind->is_null= 1;\n fbind->length= 0;\n }\n }\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n /* Count the number of parameters (driver, vs server-side) */\n if (imp_sth->use_server_side_prepare == 0)\n DBIc_NUM_PARAMS(imp_sth) = count_params((imp_xxh_t *)imp_dbh, aTHX_ statement,\n imp_dbh->bind_comment_placeholders);\n#else\n DBIc_NUM_PARAMS(imp_sth) = count_params((imp_xxh_t *)imp_dbh, aTHX_ statement,\n imp_dbh->bind_comment_placeholders);\n#endif\n\n /* Allocate memory for parameters */\n imp_sth->params= alloc_param(DBIc_NUM_PARAMS(imp_sth));\n DBIc_IMPSET_on(imp_sth);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_prepare\\n\");\n return 1;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"dbd_st_prepare","file_name":"dbdimp.c","commit_link":"github.com/perl5-dbi/DBD-mysql/commit/793b72b1a0baa5070adacaac0e12fd995a6fbabe","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#105-5c68af241977","input":"get_uncompressed_data(struct archive_read *a, const void **buff, size_t size,\n size_t minimum)\n{\n\tstruct _7zip *zip = (struct _7zip *)a->format->data;\n\tssize_t bytes_avail;\n\n\tif (zip->codec == _7Z_COPY && zip->codec2 == (unsigned long)-1) {\n\t\t/* Copy mode. */\n\n\t\t/*\n\t\t * Note: '1' here is a performance optimization.\n\t\t * Recall that the decompression layer returns a count of\n\t\t * available bytes; asking for more than that forces the\n\t\t * decompressor to combine reads by copying data.\n\t\t */\n\t\t*buff = __archive_read_ahead(a, 1, &bytes_avail);\n\t\tif (bytes_avail <= 0) {\n\t\t\tarchive_set_error(&a->archive,\n\t\t\t ARCHIVE_ERRNO_FILE_FORMAT,\n\t\t\t \"Truncated 7-Zip file data\");\n\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tif ((size_t)bytes_avail >\n\t\t zip->uncompressed_buffer_bytes_remaining)\n\t\t\tbytes_avail = (ssize_t)\n\t\t\t zip->uncompressed_buffer_bytes_remaining;\n\t\tif ((size_t)bytes_avail > size)\n\t\t\tbytes_avail = (ssize_t)size;\n\n\t\tzip->pack_stream_bytes_unconsumed = bytes_avail;\n\t} else if (zip->uncompressed_buffer_pointer == NULL) {\n\t\t/* Decompression has failed. */\n\t\tarchive_set_error(&(a->archive),\n\t\t ARCHIVE_ERRNO_MISC, \"Damaged 7-Zip archive\");\n\t\treturn (ARCHIVE_FATAL);\n\t} else {\n\t\t/* Packed mode. */\n\t\tif (minimum > zip->uncompressed_buffer_bytes_remaining) {\n\t\t\t/*\n\t\t\t * If remaining uncompressed data size is less than\n\t\t\t * the minimum size, fill the buffer up to the\n\t\t\t * minimum size.\n\t\t\t */\n\t\t\tif (extract_pack_stream(a, minimum) < 0)\n\t\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tif (size > zip->uncompressed_buffer_bytes_remaining)\n\t\t\tbytes_avail = (ssize_t)\n\t\t\t zip->uncompressed_buffer_bytes_remaining;\n\t\telse\n\t\t\tbytes_avail = (ssize_t)size;\n\t\t*buff = zip->uncompressed_buffer_pointer;\n\t\tzip->uncompressed_buffer_pointer += bytes_avail;\n\t}\n\tzip->uncompressed_buffer_bytes_remaining -= bytes_avail;\n\treturn (bytes_avail);\n}","target":"get_uncompressed_data(struct archive_read *a, const void **buff, size_t size,\n size_t minimum)\n{\n\tstruct _7zip *zip = (struct _7zip *)a->format->data;\n\tssize_t bytes_avail;\n\n\tif (zip->codec == _7Z_COPY && zip->codec2 == (unsigned long)-1) {\n\t\t/* Copy mode. */\n\n\t\t*buff = __archive_read_ahead(a, minimum, &bytes_avail);\n\t\tif (bytes_avail <= 0) {\n\t\t\tarchive_set_error(&a->archive,\n\t\t\t ARCHIVE_ERRNO_FILE_FORMAT,\n\t\t\t \"Truncated 7-Zip file data\");\n\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tif ((size_t)bytes_avail >\n\t\t zip->uncompressed_buffer_bytes_remaining)\n\t\t\tbytes_avail = (ssize_t)\n\t\t\t zip->uncompressed_buffer_bytes_remaining;\n\t\tif ((size_t)bytes_avail > size)\n\t\t\tbytes_avail = (ssize_t)size;\n\n\t\tzip->pack_stream_bytes_unconsumed = bytes_avail;\n\t} else if (zip->uncompressed_buffer_pointer == NULL) {\n\t\t/* Decompression has failed. */\n\t\tarchive_set_error(&(a->archive),\n\t\t ARCHIVE_ERRNO_MISC, \"Damaged 7-Zip archive\");\n\t\treturn (ARCHIVE_FATAL);\n\t} else {\n\t\t/* Packed mode. */\n\t\tif (minimum > zip->uncompressed_buffer_bytes_remaining) {\n\t\t\t/*\n\t\t\t * If remaining uncompressed data size is less than\n\t\t\t * the minimum size, fill the buffer up to the\n\t\t\t * minimum size.\n\t\t\t */\n\t\t\tif (extract_pack_stream(a, minimum) < 0)\n\t\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tif (size > zip->uncompressed_buffer_bytes_remaining)\n\t\t\tbytes_avail = (ssize_t)\n\t\t\t zip->uncompressed_buffer_bytes_remaining;\n\t\telse\n\t\t\tbytes_avail = (ssize_t)size;\n\t\t*buff = zip->uncompressed_buffer_pointer;\n\t\tzip->uncompressed_buffer_pointer += bytes_avail;\n\t}\n\tzip->uncompressed_buffer_bytes_remaining -= bytes_avail;\n\treturn (bytes_avail);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"get_uncompressed_data","file_name":"libarchive/archive_read_support_format_7zip.c","commit_link":"github.com/libarchive/libarchive/commit/65a23f5dbee4497064e9bb467f81138a62b0dae1","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#106-6cf45e7c2ef9","input":"BOOL security_fips_decrypt(BYTE* data, size_t length, rdpRdp* rdp)\n{\n\tsize_t olen;\n\n\tif (!winpr_Cipher_Update(rdp->fips_decrypt, data, length, data, &olen))\n\t\treturn FALSE;\n\n\treturn TRUE;\n}","target":"BOOL security_fips_decrypt(BYTE* data, size_t length, rdpRdp* rdp)\n{\n\tsize_t olen;\n\n\tif (!rdp || !rdp->fips_decrypt)\n\t\treturn FALSE;\n\n\tif (!winpr_Cipher_Update(rdp->fips_decrypt, data, length, data, &olen))\n\t\treturn FALSE;\n\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"security_fips_decrypt","file_name":"libfreerdp/core/security.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/d6cd14059b257318f176c0ba3ee0a348826a9ef8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#107-c2b8edb294d5","input":"static BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)\n{\n\tBYTE* newBitMask;\n\n\tif (Stream_GetRemainingLength(s) < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, iconInfo->cacheEntry); /* cacheEntry (2 bytes) */\n\tStream_Read_UINT8(s, iconInfo->cacheId); /* cacheId (1 byte) */\n\tStream_Read_UINT8(s, iconInfo->bpp); /* bpp (1 byte) */\n\n\tif ((iconInfo->bpp < 1) || (iconInfo->bpp > 32))\n\t{\n\t\tWLog_ERR(TAG, \"invalid bpp value %\" PRIu32 \"\", iconInfo->bpp);\n\t\treturn FALSE;\n\t}\n\n\tStream_Read_UINT16(s, iconInfo->width); /* width (2 bytes) */\n\tStream_Read_UINT16(s, iconInfo->height); /* height (2 bytes) */\n\n\t/* cbColorTable is only present when bpp is 1, 4 or 8 */\n\tswitch (iconInfo->bpp)\n\t{\n\t\tcase 1:\n\t\tcase 4:\n\t\tcase 8:\n\t\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t\t\treturn FALSE;\n\n\t\t\tStream_Read_UINT16(s, iconInfo->cbColorTable); /* cbColorTable (2 bytes) */\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\ticonInfo->cbColorTable = 0;\n\t\t\tbreak;\n\t}\n\n\tif (Stream_GetRemainingLength(s) < 4)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, iconInfo->cbBitsMask); /* cbBitsMask (2 bytes) */\n\tStream_Read_UINT16(s, iconInfo->cbBitsColor); /* cbBitsColor (2 bytes) */\n\n\tif (Stream_GetRemainingLength(s) < iconInfo->cbBitsMask + iconInfo->cbBitsColor)\n\t\treturn FALSE;\n\n\t/* bitsMask */\n\tnewBitMask = (BYTE*)realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);\n\n\tif (!newBitMask)\n\t{\n\t\tfree(iconInfo->bitsMask);\n\t\ticonInfo->bitsMask = NULL;\n\t\treturn FALSE;\n\t}\n\n\ticonInfo->bitsMask = newBitMask;\n\tStream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);\n\n\t/* colorTable */\n\tif (iconInfo->colorTable == NULL)\n\t{\n\t\tif (iconInfo->cbColorTable)\n\t\t{\n\t\t\ticonInfo->colorTable = (BYTE*)malloc(iconInfo->cbColorTable);\n\n\t\t\tif (!iconInfo->colorTable)\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\telse if (iconInfo->cbColorTable)\n\t{\n\t\tBYTE* new_tab;\n\t\tnew_tab = (BYTE*)realloc(iconInfo->colorTable, iconInfo->cbColorTable);\n\n\t\tif (!new_tab)\n\t\t{\n\t\t\tfree(iconInfo->colorTable);\n\t\t\ticonInfo->colorTable = NULL;\n\t\t\treturn FALSE;\n\t\t}\n\n\t\ticonInfo->colorTable = new_tab;\n\t}\n\telse\n\t{\n\t\tfree(iconInfo->colorTable);\n\t\ticonInfo->colorTable = NULL;\n\t}\n\n\tif (iconInfo->colorTable)\n\t\tStream_Read(s, iconInfo->colorTable, iconInfo->cbColorTable);\n\n\t/* bitsColor */\n\tnewBitMask = (BYTE*)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);\n\n\tif (!newBitMask)\n\t{\n\t\tfree(iconInfo->bitsColor);\n\t\ticonInfo->bitsColor = NULL;\n\t\treturn FALSE;\n\t}\n\n\ticonInfo->bitsColor = newBitMask;\n\tStream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);\n\treturn TRUE;\n}","target":"static BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)\n{\n\tBYTE* newBitMask;\n\n\tif (Stream_GetRemainingLength(s) < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, iconInfo->cacheEntry); /* cacheEntry (2 bytes) */\n\tStream_Read_UINT8(s, iconInfo->cacheId); /* cacheId (1 byte) */\n\tStream_Read_UINT8(s, iconInfo->bpp); /* bpp (1 byte) */\n\n\tif ((iconInfo->bpp < 1) || (iconInfo->bpp > 32))\n\t{\n\t\tWLog_ERR(TAG, \"invalid bpp value %\" PRIu32 \"\", iconInfo->bpp);\n\t\treturn FALSE;\n\t}\n\n\tStream_Read_UINT16(s, iconInfo->width); /* width (2 bytes) */\n\tStream_Read_UINT16(s, iconInfo->height); /* height (2 bytes) */\n\n\t/* cbColorTable is only present when bpp is 1, 4 or 8 */\n\tswitch (iconInfo->bpp)\n\t{\n\t\tcase 1:\n\t\tcase 4:\n\t\tcase 8:\n\t\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t\t\treturn FALSE;\n\n\t\t\tStream_Read_UINT16(s, iconInfo->cbColorTable); /* cbColorTable (2 bytes) */\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\ticonInfo->cbColorTable = 0;\n\t\t\tbreak;\n\t}\n\n\tif (Stream_GetRemainingLength(s) < 4)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, iconInfo->cbBitsMask); /* cbBitsMask (2 bytes) */\n\tStream_Read_UINT16(s, iconInfo->cbBitsColor); /* cbBitsColor (2 bytes) */\n\n\t/* bitsMask */\n\tnewBitMask = (BYTE*)realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);\n\n\tif (!newBitMask)\n\t{\n\t\tfree(iconInfo->bitsMask);\n\t\ticonInfo->bitsMask = NULL;\n\t\treturn FALSE;\n\t}\n\n\ticonInfo->bitsMask = newBitMask;\n\tif (Stream_GetRemainingLength(s) < iconInfo->cbBitsMask)\n\t\treturn FALSE;\n\tStream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);\n\n\t/* colorTable */\n\tif (iconInfo->colorTable == NULL)\n\t{\n\t\tif (iconInfo->cbColorTable)\n\t\t{\n\t\t\ticonInfo->colorTable = (BYTE*)malloc(iconInfo->cbColorTable);\n\n\t\t\tif (!iconInfo->colorTable)\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\telse if (iconInfo->cbColorTable)\n\t{\n\t\tBYTE* new_tab;\n\t\tnew_tab = (BYTE*)realloc(iconInfo->colorTable, iconInfo->cbColorTable);\n\n\t\tif (!new_tab)\n\t\t{\n\t\t\tfree(iconInfo->colorTable);\n\t\t\ticonInfo->colorTable = NULL;\n\t\t\treturn FALSE;\n\t\t}\n\n\t\ticonInfo->colorTable = new_tab;\n\t}\n\telse\n\t{\n\t\tfree(iconInfo->colorTable);\n\t\ticonInfo->colorTable = NULL;\n\t}\n\n\tif (iconInfo->colorTable)\n\t{\n\t\tif (Stream_GetRemainingLength(s) < iconInfo->cbColorTable)\n\t\t\treturn FALSE;\n\t\tStream_Read(s, iconInfo->colorTable, iconInfo->cbColorTable);\n\t}\n\n\t/* bitsColor */\n\tnewBitMask = (BYTE*)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);\n\n\tif (!newBitMask)\n\t{\n\t\tfree(iconInfo->bitsColor);\n\t\ticonInfo->bitsColor = NULL;\n\t\treturn FALSE;\n\t}\n\n\ticonInfo->bitsColor = newBitMask;\n\tif (Stream_GetRemainingLength(s) < iconInfo->cbBitsColor)\n\t\treturn FALSE;\n\tStream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"update_read_icon_info","file_name":"libfreerdp/core/window.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/6b2bc41935e53b0034fe5948aeeab4f32e80f30f","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#108-d2aa221289c8","input":"static int usbhid_parse(struct hid_device *hid)\n{\n\tstruct usb_interface *intf = to_usb_interface(hid->dev.parent);\n\tstruct usb_host_interface *interface = intf->cur_altsetting;\n\tstruct usb_device *dev = interface_to_usbdev (intf);\n\tstruct hid_descriptor *hdesc;\n\tu32 quirks = 0;\n\tunsigned int rsize = 0;\n\tchar *rdesc;\n\tint ret, n;\n\n\tquirks = usbhid_lookup_quirk(le16_to_cpu(dev->descriptor.idVendor),\n\t\t\tle16_to_cpu(dev->descriptor.idProduct));\n\n\tif (quirks & HID_QUIRK_IGNORE)\n\t\treturn -ENODEV;\n\n\t/* Many keyboards and mice don't like to be polled for reports,\n\t * so we will always set the HID_QUIRK_NOGET flag for them. */\n\tif (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT) {\n\t\tif (interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_KEYBOARD ||\n\t\t\tinterface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE)\n\t\t\t\tquirks |= HID_QUIRK_NOGET;\n\t}\n\n\tif (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) &&\n\t (!interface->desc.bNumEndpoints ||\n\t usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) {\n\t\tdbg_hid(\"class descriptor not present\\n\");\n\t\treturn -ENODEV;\n\t}\n\n\thid->version = le16_to_cpu(hdesc->bcdHID);\n\thid->country = hdesc->bCountryCode;\n\n\tfor (n = 0; n < hdesc->bNumDescriptors; n++)\n\t\tif (hdesc->desc[n].bDescriptorType == HID_DT_REPORT)\n\t\t\trsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength);\n\n\tif (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {\n\t\tdbg_hid(\"weird size of report descriptor (%u)\\n\", rsize);\n\t\treturn -EINVAL;\n\t}\n\n\trdesc = kmalloc(rsize, GFP_KERNEL);\n\tif (!rdesc)\n\t\treturn -ENOMEM;\n\n\thid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0);\n\n\tret = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber,\n\t\t\tHID_DT_REPORT, rdesc, rsize);\n\tif (ret < 0) {\n\t\tdbg_hid(\"reading report descriptor failed\\n\");\n\t\tkfree(rdesc);\n\t\tgoto err;\n\t}\n\n\tret = hid_parse_report(hid, rdesc, rsize);\n\tkfree(rdesc);\n\tif (ret) {\n\t\tdbg_hid(\"parsing report descriptor failed\\n\");\n\t\tgoto err;\n\t}\n\n\thid->quirks |= quirks;\n\n\treturn 0;\nerr:\n\treturn ret;\n}","target":"static int usbhid_parse(struct hid_device *hid)\n{\n\tstruct usb_interface *intf = to_usb_interface(hid->dev.parent);\n\tstruct usb_host_interface *interface = intf->cur_altsetting;\n\tstruct usb_device *dev = interface_to_usbdev (intf);\n\tstruct hid_descriptor *hdesc;\n\tu32 quirks = 0;\n\tunsigned int rsize = 0;\n\tchar *rdesc;\n\tint ret, n;\n\tint num_descriptors;\n\tsize_t offset = offsetof(struct hid_descriptor, desc);\n\n\tquirks = usbhid_lookup_quirk(le16_to_cpu(dev->descriptor.idVendor),\n\t\t\tle16_to_cpu(dev->descriptor.idProduct));\n\n\tif (quirks & HID_QUIRK_IGNORE)\n\t\treturn -ENODEV;\n\n\t/* Many keyboards and mice don't like to be polled for reports,\n\t * so we will always set the HID_QUIRK_NOGET flag for them. */\n\tif (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT) {\n\t\tif (interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_KEYBOARD ||\n\t\t\tinterface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE)\n\t\t\t\tquirks |= HID_QUIRK_NOGET;\n\t}\n\n\tif (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) &&\n\t (!interface->desc.bNumEndpoints ||\n\t usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) {\n\t\tdbg_hid(\"class descriptor not present\\n\");\n\t\treturn -ENODEV;\n\t}\n\n\tif (hdesc->bLength < sizeof(struct hid_descriptor)) {\n\t\tdbg_hid(\"hid descriptor is too short\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\thid->version = le16_to_cpu(hdesc->bcdHID);\n\thid->country = hdesc->bCountryCode;\n\n\tnum_descriptors = min_t(int, hdesc->bNumDescriptors,\n\t (hdesc->bLength - offset) / sizeof(struct hid_class_descriptor));\n\n\tfor (n = 0; n < num_descriptors; n++)\n\t\tif (hdesc->desc[n].bDescriptorType == HID_DT_REPORT)\n\t\t\trsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength);\n\n\tif (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {\n\t\tdbg_hid(\"weird size of report descriptor (%u)\\n\", rsize);\n\t\treturn -EINVAL;\n\t}\n\n\trdesc = kmalloc(rsize, GFP_KERNEL);\n\tif (!rdesc)\n\t\treturn -ENOMEM;\n\n\thid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0);\n\n\tret = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber,\n\t\t\tHID_DT_REPORT, rdesc, rsize);\n\tif (ret < 0) {\n\t\tdbg_hid(\"reading report descriptor failed\\n\");\n\t\tkfree(rdesc);\n\t\tgoto err;\n\t}\n\n\tret = hid_parse_report(hid, rdesc, rsize);\n\tkfree(rdesc);\n\tif (ret) {\n\t\tdbg_hid(\"parsing report descriptor failed\\n\");\n\t\tgoto err;\n\t}\n\n\thid->quirks |= quirks;\n\n\treturn 0;\nerr:\n\treturn ret;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"usbhid_parse","file_name":"drivers/hid/usbhid/hid-core.c","commit_link":"github.com/torvalds/linux/commit/f043bfc98c193c284e2cd768fefabe18ac2fed9b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#109-107867ddb036","input":"static void exif_process_APP12(image_info_type *ImageInfo,\n char *buffer, size_t length) {\n size_t l1, l2=0;\n if ((l1 = php_strnlen(buffer+2, length-2)) > 0) {\n exif_iif_add_tag(ImageInfo, SECTION_APP12, \"Company\",\n TAG_NONE, TAG_FMT_STRING, l1, buffer+2);\n if (length > 2+l1+1) {\n l2 = php_strnlen(buffer+2+l1+1, length-2-l1+1);\n exif_iif_add_tag(ImageInfo, SECTION_APP12, \"Info\",\n TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1);\n }\n }\n}","target":"static void exif_process_APP12(image_info_type *ImageInfo,\n char *buffer, size_t length) {\n size_t l1, l2=0;\n if ((l1 = php_strnlen(buffer+2, length-2)) > 0) {\n exif_iif_add_tag(ImageInfo, SECTION_APP12, \"Company\",\n TAG_NONE, TAG_FMT_STRING, l1, buffer+2);\n if (length > 2+l1+1) {\n l2 = php_strnlen(buffer+2+l1+1, length-2-l1-1);\n exif_iif_add_tag(ImageInfo, SECTION_APP12, \"Info\",\n TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1);\n }\n }\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"HPHP::exif_process_APP12","file_name":"hphp/runtime/ext/gd/ext_gd.cpp","commit_link":"github.com/facebook/hhvm/commit/f1cd34e63c2a0d9702be3d41462db7bfd0ae7da3","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#110-b46339d00413","input":"int modbus_reply(modbus_t *ctx, const uint8_t *req,\n int req_length, modbus_mapping_t *mb_mapping)\n{\n int offset;\n int slave;\n int function;\n uint16_t address;\n uint8_t rsp[MAX_MESSAGE_LENGTH];\n int rsp_length = 0;\n sft_t sft;\n\n if (ctx == NULL) {\n errno = EINVAL;\n return -1;\n }\n\n offset = ctx->backend->header_length;\n slave = req[offset - 1];\n function = req[offset];\n address = (req[offset + 1] << 8) + req[offset + 2];\n\n sft.slave = slave;\n sft.function = function;\n sft.t_id = ctx->backend->prepare_response_tid(req, &req_length);\n\n /* Data are flushed on illegal number of values errors. */\n switch (function) {\n case MODBUS_FC_READ_COILS:\n case MODBUS_FC_READ_DISCRETE_INPUTS: {\n unsigned int is_input = (function == MODBUS_FC_READ_DISCRETE_INPUTS);\n int start_bits = is_input ? mb_mapping->start_input_bits : mb_mapping->start_bits;\n int nb_bits = is_input ? mb_mapping->nb_input_bits : mb_mapping->nb_bits;\n uint8_t *tab_bits = is_input ? mb_mapping->tab_input_bits : mb_mapping->tab_bits;\n const char * const name = is_input ? \"read_input_bits\" : \"read_bits\";\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n /* The mapping can be shifted to reduce memory consumption and it\n doesn't always start at address zero. */\n int mapping_address = address - start_bits;\n\n if (nb < 1 || MODBUS_MAX_READ_BITS < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values %d in %s (max %d)\\n\",\n nb, name, MODBUS_MAX_READ_BITS);\n } else if (mapping_address < 0 || (mapping_address + nb) > nb_bits) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in %s\\n\",\n mapping_address < 0 ? address : address + nb, name);\n } else {\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = (nb / 8) + ((nb % 8) ? 1 : 0);\n rsp_length = response_io_status(tab_bits, mapping_address, nb,\n rsp, rsp_length);\n }\n }\n break;\n case MODBUS_FC_READ_HOLDING_REGISTERS:\n case MODBUS_FC_READ_INPUT_REGISTERS: {\n unsigned int is_input = (function == MODBUS_FC_READ_INPUT_REGISTERS);\n int start_registers = is_input ? mb_mapping->start_input_registers : mb_mapping->start_registers;\n int nb_registers = is_input ? mb_mapping->nb_input_registers : mb_mapping->nb_registers;\n uint16_t *tab_registers = is_input ? mb_mapping->tab_input_registers : mb_mapping->tab_registers;\n const char * const name = is_input ? \"read_input_registers\" : \"read_registers\";\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n /* The mapping can be shifted to reduce memory consumption and it\n doesn't always start at address zero. */\n int mapping_address = address - start_registers;\n\n if (nb < 1 || MODBUS_MAX_READ_REGISTERS < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values %d in %s (max %d)\\n\",\n nb, name, MODBUS_MAX_READ_REGISTERS);\n } else if (mapping_address < 0 || (mapping_address + nb) > nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in %s\\n\",\n mapping_address < 0 ? address : address + nb, name);\n } else {\n int i;\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = nb << 1;\n for (i = mapping_address; i < mapping_address + nb; i++) {\n rsp[rsp_length++] = tab_registers[i] >> 8;\n rsp[rsp_length++] = tab_registers[i] & 0xFF;\n }\n }\n }\n break;\n case MODBUS_FC_WRITE_SINGLE_COIL: {\n int mapping_address = address - mb_mapping->start_bits;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_bits) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_bit\\n\",\n address);\n } else {\n int data = (req[offset + 3] << 8) + req[offset + 4];\n\n if (data == 0xFF00 || data == 0x0) {\n mb_mapping->tab_bits[mapping_address] = data ? ON : OFF;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n } else {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, FALSE,\n \"Illegal data value 0x%0X in write_bit request at address %0X\\n\",\n data, address);\n }\n }\n }\n break;\n case MODBUS_FC_WRITE_SINGLE_REGISTER: {\n int mapping_address = address - mb_mapping->start_registers;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_register\\n\",\n address);\n } else {\n int data = (req[offset + 3] << 8) + req[offset + 4];\n\n mb_mapping->tab_registers[mapping_address] = data;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n }\n }\n break;\n case MODBUS_FC_WRITE_MULTIPLE_COILS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n int mapping_address = address - mb_mapping->start_bits;\n\n if (nb < 1 || MODBUS_MAX_WRITE_BITS < nb) {\n /* May be the indication has been truncated on reading because of\n * invalid address (eg. nb is 0 but the request contains values to\n * write) so it's necessary to flush. */\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal number of values %d in write_bits (max %d)\\n\",\n nb, MODBUS_MAX_WRITE_BITS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_bits) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_bits\\n\",\n mapping_address < 0 ? address : address + nb);\n } else {\n /* 6 = byte count */\n modbus_set_bits_from_bytes(mb_mapping->tab_bits, mapping_address, nb,\n &req[offset + 6]);\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* 4 to copy the bit address (2) and the quantity of bits */\n memcpy(rsp + rsp_length, req + rsp_length, 4);\n rsp_length += 4;\n }\n }\n break;\n case MODBUS_FC_WRITE_MULTIPLE_REGISTERS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n int mapping_address = address - mb_mapping->start_registers;\n\n if (nb < 1 || MODBUS_MAX_WRITE_REGISTERS < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal number of values %d in write_registers (max %d)\\n\",\n nb, MODBUS_MAX_WRITE_REGISTERS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_registers\\n\",\n mapping_address < 0 ? address : address + nb);\n } else {\n int i, j;\n for (i = mapping_address, j = 6; i < mapping_address + nb; i++, j += 2) {\n /* 6 and 7 = first value */\n mb_mapping->tab_registers[i] =\n (req[offset + j] << 8) + req[offset + j + 1];\n }\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* 4 to copy the address (2) and the no. of registers */\n memcpy(rsp + rsp_length, req + rsp_length, 4);\n rsp_length += 4;\n }\n }\n break;\n case MODBUS_FC_REPORT_SLAVE_ID: {\n int str_len;\n int byte_count_pos;\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* Skip byte count for now */\n byte_count_pos = rsp_length++;\n rsp[rsp_length++] = _REPORT_SLAVE_ID;\n /* Run indicator status to ON */\n rsp[rsp_length++] = 0xFF;\n /* LMB + length of LIBMODBUS_VERSION_STRING */\n str_len = 3 + strlen(LIBMODBUS_VERSION_STRING);\n memcpy(rsp + rsp_length, \"LMB\" LIBMODBUS_VERSION_STRING, str_len);\n rsp_length += str_len;\n rsp[byte_count_pos] = rsp_length - byte_count_pos - 1;\n }\n break;\n case MODBUS_FC_READ_EXCEPTION_STATUS:\n if (ctx->debug) {\n fprintf(stderr, \"FIXME Not implemented\\n\");\n }\n errno = ENOPROTOOPT;\n return -1;\n break;\n case MODBUS_FC_MASK_WRITE_REGISTER: {\n int mapping_address = address - mb_mapping->start_registers;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_register\\n\",\n address);\n } else {\n uint16_t data = mb_mapping->tab_registers[mapping_address];\n uint16_t and = (req[offset + 3] << 8) + req[offset + 4];\n uint16_t or = (req[offset + 5] << 8) + req[offset + 6];\n\n data = (data & and) | (or & (~and));\n mb_mapping->tab_registers[mapping_address] = data;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n }\n }\n break;\n case MODBUS_FC_WRITE_AND_READ_REGISTERS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n uint16_t address_write = (req[offset + 5] << 8) + req[offset + 6];\n int nb_write = (req[offset + 7] << 8) + req[offset + 8];\n int nb_write_bytes = req[offset + 9];\n int mapping_address = address - mb_mapping->start_registers;\n int mapping_address_write = address_write - mb_mapping->start_registers;\n\n if (nb_write < 1 || MODBUS_MAX_WR_WRITE_REGISTERS < nb_write ||\n nb < 1 || MODBUS_MAX_WR_READ_REGISTERS < nb ||\n nb_write_bytes != nb_write * 2) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values (W%d, R%d) in write_and_read_registers (max W%d, R%d)\\n\",\n nb_write, nb, MODBUS_MAX_WR_WRITE_REGISTERS, MODBUS_MAX_WR_READ_REGISTERS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_registers ||\n mapping_address < 0 ||\n (mapping_address_write + nb_write) > mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data read address 0x%0X or write address 0x%0X write_and_read_registers\\n\",\n mapping_address < 0 ? address : address + nb,\n mapping_address_write < 0 ? address_write : address_write + nb_write);\n } else {\n int i, j;\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = nb << 1;\n\n /* Write first.\n 10 and 11 are the offset of the first values to write */\n for (i = mapping_address_write, j = 10;\n i < mapping_address_write + nb_write; i++, j += 2) {\n mb_mapping->tab_registers[i] =\n (req[offset + j] << 8) + req[offset + j + 1];\n }\n\n /* and read the data for the response */\n for (i = mapping_address; i < mapping_address + nb; i++) {\n rsp[rsp_length++] = mb_mapping->tab_registers[i] >> 8;\n rsp[rsp_length++] = mb_mapping->tab_registers[i] & 0xFF;\n }\n }\n }\n break;\n\n default:\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_FUNCTION, rsp, TRUE,\n \"Unknown Modbus function code: 0x%0X\\n\", function);\n break;\n }\n\n /* Suppress any responses when the request was a broadcast */\n return (ctx->backend->backend_type == _MODBUS_BACKEND_TYPE_RTU &&\n slave == MODBUS_BROADCAST_ADDRESS) ? 0 : send_msg(ctx, rsp, rsp_length);\n}","target":"int modbus_reply(modbus_t *ctx, const uint8_t *req,\n int req_length, modbus_mapping_t *mb_mapping)\n{\n int offset;\n int slave;\n int function;\n uint16_t address;\n uint8_t rsp[MAX_MESSAGE_LENGTH];\n int rsp_length = 0;\n sft_t sft;\n\n if (ctx == NULL) {\n errno = EINVAL;\n return -1;\n }\n\n offset = ctx->backend->header_length;\n slave = req[offset - 1];\n function = req[offset];\n address = (req[offset + 1] << 8) + req[offset + 2];\n\n sft.slave = slave;\n sft.function = function;\n sft.t_id = ctx->backend->prepare_response_tid(req, &req_length);\n\n /* Data are flushed on illegal number of values errors. */\n switch (function) {\n case MODBUS_FC_READ_COILS:\n case MODBUS_FC_READ_DISCRETE_INPUTS: {\n unsigned int is_input = (function == MODBUS_FC_READ_DISCRETE_INPUTS);\n int start_bits = is_input ? mb_mapping->start_input_bits : mb_mapping->start_bits;\n int nb_bits = is_input ? mb_mapping->nb_input_bits : mb_mapping->nb_bits;\n uint8_t *tab_bits = is_input ? mb_mapping->tab_input_bits : mb_mapping->tab_bits;\n const char * const name = is_input ? \"read_input_bits\" : \"read_bits\";\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n /* The mapping can be shifted to reduce memory consumption and it\n doesn't always start at address zero. */\n int mapping_address = address - start_bits;\n\n if (nb < 1 || MODBUS_MAX_READ_BITS < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values %d in %s (max %d)\\n\",\n nb, name, MODBUS_MAX_READ_BITS);\n } else if (mapping_address < 0 || (mapping_address + nb) > nb_bits) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in %s\\n\",\n mapping_address < 0 ? address : address + nb, name);\n } else {\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = (nb / 8) + ((nb % 8) ? 1 : 0);\n rsp_length = response_io_status(tab_bits, mapping_address, nb,\n rsp, rsp_length);\n }\n }\n break;\n case MODBUS_FC_READ_HOLDING_REGISTERS:\n case MODBUS_FC_READ_INPUT_REGISTERS: {\n unsigned int is_input = (function == MODBUS_FC_READ_INPUT_REGISTERS);\n int start_registers = is_input ? mb_mapping->start_input_registers : mb_mapping->start_registers;\n int nb_registers = is_input ? mb_mapping->nb_input_registers : mb_mapping->nb_registers;\n uint16_t *tab_registers = is_input ? mb_mapping->tab_input_registers : mb_mapping->tab_registers;\n const char * const name = is_input ? \"read_input_registers\" : \"read_registers\";\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n /* The mapping can be shifted to reduce memory consumption and it\n doesn't always start at address zero. */\n int mapping_address = address - start_registers;\n\n if (nb < 1 || MODBUS_MAX_READ_REGISTERS < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values %d in %s (max %d)\\n\",\n nb, name, MODBUS_MAX_READ_REGISTERS);\n } else if (mapping_address < 0 || (mapping_address + nb) > nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in %s\\n\",\n mapping_address < 0 ? address : address + nb, name);\n } else {\n int i;\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = nb << 1;\n for (i = mapping_address; i < mapping_address + nb; i++) {\n rsp[rsp_length++] = tab_registers[i] >> 8;\n rsp[rsp_length++] = tab_registers[i] & 0xFF;\n }\n }\n }\n break;\n case MODBUS_FC_WRITE_SINGLE_COIL: {\n int mapping_address = address - mb_mapping->start_bits;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_bits) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_bit\\n\",\n address);\n } else {\n int data = (req[offset + 3] << 8) + req[offset + 4];\n\n if (data == 0xFF00 || data == 0x0) {\n mb_mapping->tab_bits[mapping_address] = data ? ON : OFF;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n } else {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, FALSE,\n \"Illegal data value 0x%0X in write_bit request at address %0X\\n\",\n data, address);\n }\n }\n }\n break;\n case MODBUS_FC_WRITE_SINGLE_REGISTER: {\n int mapping_address = address - mb_mapping->start_registers;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_register\\n\",\n address);\n } else {\n int data = (req[offset + 3] << 8) + req[offset + 4];\n\n mb_mapping->tab_registers[mapping_address] = data;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n }\n }\n break;\n case MODBUS_FC_WRITE_MULTIPLE_COILS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n int nb_bits = req[offset + 5];\n int mapping_address = address - mb_mapping->start_bits;\n\n if (nb < 1 || MODBUS_MAX_WRITE_BITS < nb || nb_bits * 8 < nb) {\n /* May be the indication has been truncated on reading because of\n * invalid address (eg. nb is 0 but the request contains values to\n * write) so it's necessary to flush. */\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal number of values %d in write_bits (max %d)\\n\",\n nb, MODBUS_MAX_WRITE_BITS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_bits) {\n rsp_length = response_exception(\n ctx, &sft,\n MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_bits\\n\",\n mapping_address < 0 ? address : address + nb);\n } else {\n /* 6 = byte count */\n modbus_set_bits_from_bytes(mb_mapping->tab_bits, mapping_address, nb,\n &req[offset + 6]);\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* 4 to copy the bit address (2) and the quantity of bits */\n memcpy(rsp + rsp_length, req + rsp_length, 4);\n rsp_length += 4;\n }\n }\n break;\n case MODBUS_FC_WRITE_MULTIPLE_REGISTERS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n int nb_bytes = req[offset + 5];\n int mapping_address = address - mb_mapping->start_registers;\n\n if (nb < 1 || MODBUS_MAX_WRITE_REGISTERS < nb || nb_bytes * 8 < nb) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal number of values %d in write_registers (max %d)\\n\",\n nb, MODBUS_MAX_WRITE_REGISTERS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_registers\\n\",\n mapping_address < 0 ? address : address + nb);\n } else {\n int i, j;\n for (i = mapping_address, j = 6; i < mapping_address + nb; i++, j += 2) {\n /* 6 and 7 = first value */\n mb_mapping->tab_registers[i] =\n (req[offset + j] << 8) + req[offset + j + 1];\n }\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* 4 to copy the address (2) and the no. of registers */\n memcpy(rsp + rsp_length, req + rsp_length, 4);\n rsp_length += 4;\n }\n }\n break;\n case MODBUS_FC_REPORT_SLAVE_ID: {\n int str_len;\n int byte_count_pos;\n\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n /* Skip byte count for now */\n byte_count_pos = rsp_length++;\n rsp[rsp_length++] = _REPORT_SLAVE_ID;\n /* Run indicator status to ON */\n rsp[rsp_length++] = 0xFF;\n /* LMB + length of LIBMODBUS_VERSION_STRING */\n str_len = 3 + strlen(LIBMODBUS_VERSION_STRING);\n memcpy(rsp + rsp_length, \"LMB\" LIBMODBUS_VERSION_STRING, str_len);\n rsp_length += str_len;\n rsp[byte_count_pos] = rsp_length - byte_count_pos - 1;\n }\n break;\n case MODBUS_FC_READ_EXCEPTION_STATUS:\n if (ctx->debug) {\n fprintf(stderr, \"FIXME Not implemented\\n\");\n }\n errno = ENOPROTOOPT;\n return -1;\n break;\n case MODBUS_FC_MASK_WRITE_REGISTER: {\n int mapping_address = address - mb_mapping->start_registers;\n\n if (mapping_address < 0 || mapping_address >= mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data address 0x%0X in write_register\\n\",\n address);\n } else {\n uint16_t data = mb_mapping->tab_registers[mapping_address];\n uint16_t and = (req[offset + 3] << 8) + req[offset + 4];\n uint16_t or = (req[offset + 5] << 8) + req[offset + 6];\n\n data = (data & and) | (or & (~and));\n mb_mapping->tab_registers[mapping_address] = data;\n memcpy(rsp, req, req_length);\n rsp_length = req_length;\n }\n }\n break;\n case MODBUS_FC_WRITE_AND_READ_REGISTERS: {\n int nb = (req[offset + 3] << 8) + req[offset + 4];\n uint16_t address_write = (req[offset + 5] << 8) + req[offset + 6];\n int nb_write = (req[offset + 7] << 8) + req[offset + 8];\n int nb_write_bytes = req[offset + 9];\n int mapping_address = address - mb_mapping->start_registers;\n int mapping_address_write = address_write - mb_mapping->start_registers;\n\n if (nb_write < 1 || MODBUS_MAX_WR_WRITE_REGISTERS < nb_write ||\n nb < 1 || MODBUS_MAX_WR_READ_REGISTERS < nb ||\n nb_write_bytes != nb_write * 2) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE, rsp, TRUE,\n \"Illegal nb of values (W%d, R%d) in write_and_read_registers (max W%d, R%d)\\n\",\n nb_write, nb, MODBUS_MAX_WR_WRITE_REGISTERS, MODBUS_MAX_WR_READ_REGISTERS);\n } else if (mapping_address < 0 ||\n (mapping_address + nb) > mb_mapping->nb_registers ||\n mapping_address < 0 ||\n (mapping_address_write + nb_write) > mb_mapping->nb_registers) {\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS, rsp, FALSE,\n \"Illegal data read address 0x%0X or write address 0x%0X write_and_read_registers\\n\",\n mapping_address < 0 ? address : address + nb,\n mapping_address_write < 0 ? address_write : address_write + nb_write);\n } else {\n int i, j;\n rsp_length = ctx->backend->build_response_basis(&sft, rsp);\n rsp[rsp_length++] = nb << 1;\n\n /* Write first.\n 10 and 11 are the offset of the first values to write */\n for (i = mapping_address_write, j = 10;\n i < mapping_address_write + nb_write; i++, j += 2) {\n mb_mapping->tab_registers[i] =\n (req[offset + j] << 8) + req[offset + j + 1];\n }\n\n /* and read the data for the response */\n for (i = mapping_address; i < mapping_address + nb; i++) {\n rsp[rsp_length++] = mb_mapping->tab_registers[i] >> 8;\n rsp[rsp_length++] = mb_mapping->tab_registers[i] & 0xFF;\n }\n }\n }\n break;\n\n default:\n rsp_length = response_exception(\n ctx, &sft, MODBUS_EXCEPTION_ILLEGAL_FUNCTION, rsp, TRUE,\n \"Unknown Modbus function code: 0x%0X\\n\", function);\n break;\n }\n\n /* Suppress any responses when the request was a broadcast */\n return (ctx->backend->backend_type == _MODBUS_BACKEND_TYPE_RTU &&\n slave == MODBUS_BROADCAST_ADDRESS) ? 0 : send_msg(ctx, rsp, rsp_length);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"modbus_reply","file_name":"src/modbus.c","commit_link":"github.com/stephane/libmodbus/commit/5ccdf5ef79d742640355d1132fa9e2abc7fbaefc","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#111-da1ccb181290","input":"static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tut8 *end, *need = NULL;\n\tconst char *section_name = \"\";\n\tElf_(Shdr) *link_shdr = NULL;\n\tconst char *link_section_name = \"\";\n\tSdb *sdb_vernaux = NULL;\n\tSdb *sdb_version = NULL;\n\tSdb *sdb = NULL;\n\tint i, cnt;\n\n\tif (!bin || !bin->dynstr) {\n\t\treturn NULL;\n\t}\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn NULL;\n\t}\n\tif (shdr->sh_size < 1) {\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tif (!sdb) {\n\t\treturn NULL;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!(need = (ut8*) calloc (R_MAX (1, shdr->sh_size), sizeof (ut8)))) {\n\t\tbprintf (\"Warning: Cannot allocate memory for Elf_(Verneed)\\n\");\n\t\tgoto beach;\n\t}\n\tend = need + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"num_entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tif (shdr->sh_offset > bin->size || shdr->sh_offset + shdr->sh_size > bin->size) {\n\t\tgoto beach;\n\t}\n\tif (shdr->sh_offset + shdr->sh_size < shdr->sh_size) {\n\t\tgoto beach;\n\t}\n\ti = r_buf_read_at (bin->b, shdr->sh_offset, need, shdr->sh_size);\n\tif (i < 0)\n\t\tgoto beach;\n\t//XXX we should use DT_VERNEEDNUM instead of sh_info\n\t//TODO https://sourceware.org/ml/binutils/2014-11/msg00353.html\n\tfor (i = 0, cnt = 0; cnt < shdr->sh_info; ++cnt) {\n\t\tint j, isum;\n\t\tut8 *vstart = need + i;\n\t\tElf_(Verneed) vvn = {0};\n\t\tif (vstart + sizeof (Elf_(Verneed)) > end) {\n\t\t\tgoto beach;\n\t\t}\n\t\tElf_(Verneed) *entry = &vvn;\n\t\tchar key[32] = {0};\n\t\tsdb_version = sdb_new0 ();\n\t\tif (!sdb_version) {\n\t\t\tgoto beach;\n\t\t}\n\t\tj = 0;\n\t\tvvn.vn_version = READ16 (vstart, j)\n\t\tvvn.vn_cnt = READ16 (vstart, j)\n\t\tvvn.vn_file = READ32 (vstart, j)\n\t\tvvn.vn_aux = READ32 (vstart, j)\n\t\tvvn.vn_next = READ32 (vstart, j)\n\n\t\tsdb_num_set (sdb_version, \"vn_version\", entry->vn_version, 0);\n\t\tsdb_num_set (sdb_version, \"idx\", i, 0);\n\t\tif (entry->vn_file > bin->dynstr_size) {\n\t\t\tgoto beach;\n\t\t}\n\t\t{\n\t\t\tchar *s = r_str_ndup (&bin->dynstr[entry->vn_file], 16);\n\t\t\tsdb_set (sdb_version, \"file_name\", s, 0);\n\t\t\tfree (s);\n\t\t}\n\t\tsdb_num_set (sdb_version, \"cnt\", entry->vn_cnt, 0);\n\t\tvstart += entry->vn_aux;\n\t\tfor (j = 0, isum = i + entry->vn_aux; j < entry->vn_cnt && vstart + sizeof (Elf_(Vernaux)) <= end; ++j) {\n\t\t\tint k;\n\t\t\tElf_(Vernaux) * aux = NULL;\n\t\t\tElf_(Vernaux) vaux = {0};\n\t\t\tsdb_vernaux = sdb_new0 ();\n\t\t\tif (!sdb_vernaux) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\taux = (Elf_(Vernaux)*)&vaux;\n\t\t\tk = 0;\n\t\t\tvaux.vna_hash = READ32 (vstart, k)\n\t\t\tvaux.vna_flags = READ16 (vstart, k)\n\t\t\tvaux.vna_other = READ16 (vstart, k)\n\t\t\tvaux.vna_name = READ32 (vstart, k)\n\t\t\tvaux.vna_next = READ32 (vstart, k)\n\t\t\tif (aux->vna_name > bin->dynstr_size) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_vernaux, \"idx\", isum, 0);\n\t\t\tif (aux->vna_name > 0 && aux->vna_name + 8 < bin->dynstr_size) {\n\t\t\t\tchar name [16];\n\t\t\t\tstrncpy (name, &bin->dynstr[aux->vna_name], sizeof (name)-1);\n\t\t\t\tname[sizeof(name)-1] = 0;\n\t\t\t\tsdb_set (sdb_vernaux, \"name\", name, 0);\n\t\t\t}\n\t\t\tsdb_set (sdb_vernaux, \"flags\", get_ver_flags (aux->vna_flags), 0);\n\t\t\tsdb_num_set (sdb_vernaux, \"version\", aux->vna_other, 0);\n\t\t\tisum += aux->vna_next;\n\t\t\tvstart += aux->vna_next;\n\t\t\tsnprintf (key, sizeof (key), \"vernaux%d\", j);\n\t\t\tsdb_ns_set (sdb_version, key, sdb_vernaux);\n\t\t}\n\t\tif ((int)entry->vn_next < 0) {\n\t\t\tbprintf (\"Invalid vn_next\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += entry->vn_next;\n\t\tsnprintf (key, sizeof (key), \"version%d\", cnt );\n\t\tsdb_ns_set (sdb, key, sdb_version);\n\t\t//if entry->vn_next is 0 it iterate infinitely\n\t\tif (!entry->vn_next) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tfree (need);\n\treturn sdb;\nbeach:\n\tfree (need);\n\tsdb_free (sdb_vernaux);\n\tsdb_free (sdb_version);\n\tsdb_free (sdb);\n\treturn NULL;\n}","target":"static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tut8 *end, *need = NULL;\n\tconst char *section_name = \"\";\n\tElf_(Shdr) *link_shdr = NULL;\n\tconst char *link_section_name = \"\";\n\tSdb *sdb_vernaux = NULL;\n\tSdb *sdb_version = NULL;\n\tSdb *sdb = NULL;\n\tint i, cnt;\n\n\tif (!bin || !bin->dynstr) {\n\t\treturn NULL;\n\t}\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn NULL;\n\t}\n\tif (shdr->sh_size < 1) {\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tif (!sdb) {\n\t\treturn NULL;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!(need = (ut8*) calloc (R_MAX (1, shdr->sh_size), sizeof (ut8)))) {\n\t\tbprintf (\"Warning: Cannot allocate memory for Elf_(Verneed)\\n\");\n\t\tgoto beach;\n\t}\n\tend = need + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"num_entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tif (shdr->sh_offset > bin->size || shdr->sh_offset + shdr->sh_size > bin->size) {\n\t\tgoto beach;\n\t}\n\tif (shdr->sh_offset + shdr->sh_size < shdr->sh_size) {\n\t\tgoto beach;\n\t}\n\ti = r_buf_read_at (bin->b, shdr->sh_offset, need, shdr->sh_size);\n\tif (i < 0)\n\t\tgoto beach;\n\t//XXX we should use DT_VERNEEDNUM instead of sh_info\n\t//TODO https://sourceware.org/ml/binutils/2014-11/msg00353.html\n\tfor (i = 0, cnt = 0; cnt < shdr->sh_info; ++cnt) {\n\t\tint j, isum;\n\t\tut8 *vstart = need + i;\n\t\tElf_(Verneed) vvn = {0};\n\t\tif (vstart + sizeof (Elf_(Verneed)) > end) {\n\t\t\tgoto beach;\n\t\t}\n\t\tElf_(Verneed) *entry = &vvn;\n\t\tchar key[32] = {0};\n\t\tsdb_version = sdb_new0 ();\n\t\tif (!sdb_version) {\n\t\t\tgoto beach;\n\t\t}\n\t\tj = 0;\n\t\tvvn.vn_version = READ16 (vstart, j)\n\t\tvvn.vn_cnt = READ16 (vstart, j)\n\t\tvvn.vn_file = READ32 (vstart, j)\n\t\tvvn.vn_aux = READ32 (vstart, j)\n\t\tvvn.vn_next = READ32 (vstart, j)\n\n\t\tsdb_num_set (sdb_version, \"vn_version\", entry->vn_version, 0);\n\t\tsdb_num_set (sdb_version, \"idx\", i, 0);\n\t\tif (entry->vn_file > bin->dynstr_size) {\n\t\t\tgoto beach;\n\t\t}\n\t\t{\n\t\t\tchar *s = r_str_ndup (&bin->dynstr[entry->vn_file], 16);\n\t\t\tsdb_set (sdb_version, \"file_name\", s, 0);\n\t\t\tfree (s);\n\t\t}\n\t\tsdb_num_set (sdb_version, \"cnt\", entry->vn_cnt, 0);\n\t\tst32 vnaux = entry->vn_aux;\n\t\tif (vnaux < 1) {\n\t\t\tgoto beach;\n\t\t}\n\t\tvstart += vnaux;\n\t\tfor (j = 0, isum = i + entry->vn_aux; j < entry->vn_cnt && vstart + sizeof (Elf_(Vernaux)) <= end; ++j) {\n\t\t\tint k;\n\t\t\tElf_(Vernaux) * aux = NULL;\n\t\t\tElf_(Vernaux) vaux = {0};\n\t\t\tsdb_vernaux = sdb_new0 ();\n\t\t\tif (!sdb_vernaux) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\taux = (Elf_(Vernaux)*)&vaux;\n\t\t\tk = 0;\n\t\t\tvaux.vna_hash = READ32 (vstart, k)\n\t\t\tvaux.vna_flags = READ16 (vstart, k)\n\t\t\tvaux.vna_other = READ16 (vstart, k)\n\t\t\tvaux.vna_name = READ32 (vstart, k)\n\t\t\tvaux.vna_next = READ32 (vstart, k)\n\t\t\tif (aux->vna_name > bin->dynstr_size) {\n\t\t\t\tgoto beach;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_vernaux, \"idx\", isum, 0);\n\t\t\tif (aux->vna_name > 0 && aux->vna_name + 8 < bin->dynstr_size) {\n\t\t\t\tchar name [16];\n\t\t\t\tstrncpy (name, &bin->dynstr[aux->vna_name], sizeof (name)-1);\n\t\t\t\tname[sizeof(name)-1] = 0;\n\t\t\t\tsdb_set (sdb_vernaux, \"name\", name, 0);\n\t\t\t}\n\t\t\tsdb_set (sdb_vernaux, \"flags\", get_ver_flags (aux->vna_flags), 0);\n\t\t\tsdb_num_set (sdb_vernaux, \"version\", aux->vna_other, 0);\n\t\t\tisum += aux->vna_next;\n\t\t\tvstart += aux->vna_next;\n\t\t\tsnprintf (key, sizeof (key), \"vernaux%d\", j);\n\t\t\tsdb_ns_set (sdb_version, key, sdb_vernaux);\n\t\t}\n\t\tif ((int)entry->vn_next < 0) {\n\t\t\tbprintf (\"Invalid vn_next\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += entry->vn_next;\n\t\tsnprintf (key, sizeof (key), \"version%d\", cnt );\n\t\tsdb_ns_set (sdb, key, sdb_version);\n\t\t//if entry->vn_next is 0 it iterate infinitely\n\t\tif (!entry->vn_next) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tfree (need);\n\treturn sdb;\nbeach:\n\tfree (need);\n\tsdb_free (sdb_vernaux);\n\tsdb_free (sdb_version);\n\tsdb_free (sdb);\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"store_versioninfo_gnu_verneed","file_name":"libr/bin/format/elf/elf.c","commit_link":"github.com/radare/radare2/commit/c6d0076c924891ad9948a62d89d0bcdaf965f0cd","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#112-3dc2a51b76e9","input":"static Image *ReadWPGImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n typedef struct\n {\n size_t FileId;\n MagickOffsetType DataOffset;\n unsigned int ProductType;\n unsigned int FileType;\n unsigned char MajorVersion;\n unsigned char MinorVersion;\n unsigned int EncryptKey;\n unsigned int Reserved;\n } WPGHeader;\n\n typedef struct\n {\n unsigned char RecType;\n size_t RecordLength;\n } WPGRecord;\n\n typedef struct\n {\n unsigned char Class;\n unsigned char RecType;\n size_t Extension;\n size_t RecordLength;\n } WPG2Record;\n\n typedef struct\n {\n unsigned HorizontalUnits;\n unsigned VerticalUnits;\n unsigned char PosSizePrecision;\n } WPG2Start;\n\n typedef struct\n {\n unsigned int Width;\n unsigned int Height;\n unsigned int Depth;\n unsigned int HorzRes;\n unsigned int VertRes;\n } WPGBitmapType1;\n\n typedef struct\n {\n unsigned int Width;\n unsigned int Height;\n unsigned char Depth;\n unsigned char Compression;\n } WPG2BitmapType1;\n\n typedef struct\n {\n unsigned int RotAngle;\n unsigned int LowLeftX;\n unsigned int LowLeftY;\n unsigned int UpRightX;\n unsigned int UpRightY;\n unsigned int Width;\n unsigned int Height;\n unsigned int Depth;\n unsigned int HorzRes;\n unsigned int VertRes;\n } WPGBitmapType2;\n\n typedef struct\n {\n unsigned int StartIndex;\n unsigned int NumOfEntries;\n } WPGColorMapRec;\n\n /*\n typedef struct {\n size_t PS_unknown1;\n unsigned int PS_unknown2;\n unsigned int PS_unknown3;\n } WPGPSl1Record; \n */\n\n Image\n *image;\n\n unsigned int\n status;\n\n WPGHeader\n Header;\n\n WPGRecord\n Rec;\n\n WPG2Record\n Rec2;\n\n WPG2Start StartWPG;\n\n WPGBitmapType1\n BitmapHeader1;\n\n WPG2BitmapType1\n Bitmap2Header1;\n\n WPGBitmapType2\n BitmapHeader2;\n\n WPGColorMapRec\n WPG_Palette;\n\n int\n i,\n bpp,\n WPG2Flags;\n\n ssize_t\n ldblk;\n\n size_t\n one;\n\n unsigned char\n *BImgBuff;\n\n tCTM CTM; /*current transform matrix*/\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n one=1;\n image=AcquireImage(image_info,exception);\n image->depth=8;\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read WPG image.\n */\n Header.FileId=ReadBlobLSBLong(image);\n Header.DataOffset=(MagickOffsetType) ReadBlobLSBLong(image);\n Header.ProductType=ReadBlobLSBShort(image);\n Header.FileType=ReadBlobLSBShort(image);\n Header.MajorVersion=ReadBlobByte(image);\n Header.MinorVersion=ReadBlobByte(image);\n Header.EncryptKey=ReadBlobLSBShort(image);\n Header.Reserved=ReadBlobLSBShort(image);\n\n if (Header.FileId!=0x435057FF || (Header.ProductType>>8)!=0x16)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (Header.EncryptKey!=0)\n ThrowReaderException(CoderError,\"EncryptedWPGImageFileNotSupported\");\n\n image->columns = 1;\n image->rows = 1;\n image->colors = 0;\n bpp=0;\n BitmapHeader2.RotAngle=0;\n\n switch(Header.FileType)\n {\n case 1: /* WPG level 1 */\n while(!EOFBlob(image)) /* object parser loop */\n {\n (void) SeekBlob(image,Header.DataOffset,SEEK_SET);\n if(EOFBlob(image))\n break;\n\n Rec.RecType=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rd_WP_DWORD(image,&Rec.RecordLength);\n if(EOFBlob(image))\n break;\n\n Header.DataOffset=TellBlob(image)+Rec.RecordLength;\n\n switch(Rec.RecType)\n {\n case 0x0B: /* bitmap type 1 */\n BitmapHeader1.Width=ReadBlobLSBShort(image);\n BitmapHeader1.Height=ReadBlobLSBShort(image);\n if ((BitmapHeader1.Width == 0) || (BitmapHeader1.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n BitmapHeader1.Depth=ReadBlobLSBShort(image);\n BitmapHeader1.HorzRes=ReadBlobLSBShort(image);\n BitmapHeader1.VertRes=ReadBlobLSBShort(image);\n\n if(BitmapHeader1.HorzRes && BitmapHeader1.VertRes)\n {\n image->units=PixelsPerCentimeterResolution;\n image->resolution.x=BitmapHeader1.HorzRes/470.0;\n image->resolution.y=BitmapHeader1.VertRes/470.0;\n }\n image->columns=BitmapHeader1.Width;\n image->rows=BitmapHeader1.Height;\n bpp=BitmapHeader1.Depth;\n\n goto UnpackRaster;\n\n case 0x0E: /*Color palette */\n WPG_Palette.StartIndex=ReadBlobLSBShort(image);\n WPG_Palette.NumOfEntries=ReadBlobLSBShort(image);\n\n image->colors=WPG_Palette.NumOfEntries;\n if (!AcquireImageColormap(image,image->colors,exception))\n goto NoMemory;\n for (i=WPG_Palette.StartIndex;\n i < (int)WPG_Palette.NumOfEntries; i++)\n {\n image->colormap[i].red=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n }\n break;\n \n case 0x11: /* Start PS l1 */\n if(Rec.RecordLength > 8)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+8, /* skip PS header in the wpg */\n (ssize_t) Rec.RecordLength-8,exception);\n break; \n\n case 0x14: /* bitmap type 2 */\n BitmapHeader2.RotAngle=ReadBlobLSBShort(image);\n BitmapHeader2.LowLeftX=ReadBlobLSBShort(image);\n BitmapHeader2.LowLeftY=ReadBlobLSBShort(image);\n BitmapHeader2.UpRightX=ReadBlobLSBShort(image);\n BitmapHeader2.UpRightY=ReadBlobLSBShort(image);\n BitmapHeader2.Width=ReadBlobLSBShort(image);\n BitmapHeader2.Height=ReadBlobLSBShort(image);\n if ((BitmapHeader2.Width == 0) || (BitmapHeader2.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n BitmapHeader2.Depth=ReadBlobLSBShort(image);\n BitmapHeader2.HorzRes=ReadBlobLSBShort(image);\n BitmapHeader2.VertRes=ReadBlobLSBShort(image);\n\n image->units=PixelsPerCentimeterResolution;\n image->page.width=(unsigned int)\n ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightX)/470.0);\n image->page.height=(unsigned int)\n ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightY)/470.0);\n image->page.x=(int) (BitmapHeader2.LowLeftX/470.0);\n image->page.y=(int) (BitmapHeader2.LowLeftX/470.0);\n if(BitmapHeader2.HorzRes && BitmapHeader2.VertRes)\n {\n image->resolution.x=BitmapHeader2.HorzRes/470.0;\n image->resolution.y=BitmapHeader2.VertRes/470.0;\n }\n image->columns=BitmapHeader2.Width;\n image->rows=BitmapHeader2.Height;\n bpp=BitmapHeader2.Depth;\n\n UnpackRaster: \n if ((image->colors == 0) && (bpp != 24))\n {\n image->colors=one << bpp;\n if (!AcquireImageColormap(image,image->colors,exception))\n {\n NoMemory:\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n /* printf(\"Load default colormap \\n\"); */\n for (i=0; (i < (int) image->colors) && (i < 256); i++)\n { \n image->colormap[i].red=ScaleCharToQuantum(WPG1_Palette[i].Red);\n image->colormap[i].green=ScaleCharToQuantum(WPG1_Palette[i].Green);\n image->colormap[i].blue=ScaleCharToQuantum(WPG1_Palette[i].Blue);\n }\n }\n else\n {\n if (bpp < 24)\n if ( (image->colors < (one << bpp)) && (bpp != 24) )\n image->colormap=(PixelInfo *) ResizeQuantumMemory(\n image->colormap,(size_t) (one << bpp),\n sizeof(*image->colormap));\n }\n \n if (bpp == 1)\n {\n if(image->colormap[0].red==0 &&\n image->colormap[0].green==0 &&\n image->colormap[0].blue==0 &&\n image->colormap[1].red==0 &&\n image->colormap[1].green==0 &&\n image->colormap[1].blue==0)\n { /* fix crippled monochrome palette */\n image->colormap[1].red =\n image->colormap[1].green =\n image->colormap[1].blue = QuantumRange;\n }\n } \n\n if(UnpackWPGRaster(image,bpp,exception) < 0)\n /* The raster cannot be unpacked */\n {\n DecompressionFailed:\n ThrowReaderException(CoderError,\"UnableToDecompressImage\");\n }\n\n if(Rec.RecType==0x14 && BitmapHeader2.RotAngle!=0 && !image_info->ping)\n { \n /* flop command */\n if(BitmapHeader2.RotAngle & 0x8000)\n {\n Image\n *flop_image;\n\n flop_image = FlopImage(image, exception);\n if (flop_image != (Image *) NULL) {\n DuplicateBlob(flop_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flop_image);\n }\n }\n /* flip command */\n if(BitmapHeader2.RotAngle & 0x2000)\n {\n Image\n *flip_image;\n\n flip_image = FlipImage(image, exception);\n if (flip_image != (Image *) NULL) {\n DuplicateBlob(flip_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flip_image); \n }\n }\n \n /* rotate command */\n if(BitmapHeader2.RotAngle & 0x0FFF)\n {\n Image\n *rotate_image;\n\n rotate_image=RotateImage(image,(BitmapHeader2.RotAngle &\n 0x0FFF), exception);\n if (rotate_image != (Image *) NULL) {\n DuplicateBlob(rotate_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,rotate_image); \n }\n } \n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n image->depth=8;\n if (image->next == (Image *) NULL)\n goto Finish;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n break;\n\n case 0x1B: /* Postscript l2 */\n if(Rec.RecordLength>0x3C)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+0x3C, /* skip PS l2 header in the wpg */\n (ssize_t) Rec.RecordLength-0x3C,exception);\n break;\n }\n }\n break;\n\n case 2: /* WPG level 2 */\n (void) memset(CTM,0,sizeof(CTM));\n StartWPG.PosSizePrecision = 0;\n while(!EOFBlob(image)) /* object parser loop */\n {\n (void) SeekBlob(image,Header.DataOffset,SEEK_SET);\n if(EOFBlob(image))\n break;\n\n Rec2.Class=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rec2.RecType=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rd_WP_DWORD(image,&Rec2.Extension);\n Rd_WP_DWORD(image,&Rec2.RecordLength);\n if(EOFBlob(image))\n break;\n\n Header.DataOffset=TellBlob(image)+Rec2.RecordLength;\n\n switch(Rec2.RecType)\n {\n case 1:\n StartWPG.HorizontalUnits=ReadBlobLSBShort(image);\n StartWPG.VerticalUnits=ReadBlobLSBShort(image);\n StartWPG.PosSizePrecision=ReadBlobByte(image);\n break;\n case 0x0C: /* Color palette */\n WPG_Palette.StartIndex=ReadBlobLSBShort(image);\n WPG_Palette.NumOfEntries=ReadBlobLSBShort(image);\n\n image->colors=WPG_Palette.NumOfEntries;\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n for (i=WPG_Palette.StartIndex;\n i < (int)WPG_Palette.NumOfEntries; i++)\n {\n image->colormap[i].red=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n image->colormap[i].green=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n image->colormap[i].blue=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n (void) ReadBlobByte(image); /*Opacity??*/\n }\n break;\n case 0x0E:\n Bitmap2Header1.Width=ReadBlobLSBShort(image);\n Bitmap2Header1.Height=ReadBlobLSBShort(image);\n if ((Bitmap2Header1.Width == 0) || (Bitmap2Header1.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n Bitmap2Header1.Depth=ReadBlobByte(image);\n Bitmap2Header1.Compression=ReadBlobByte(image);\n\n if(Bitmap2Header1.Compression > 1)\n continue; /*Unknown compression method */\n switch(Bitmap2Header1.Depth)\n {\n case 1:\n bpp=1;\n break;\n case 2:\n bpp=2;\n break;\n case 3:\n bpp=4;\n break;\n case 4:\n bpp=8;\n break;\n case 8:\n bpp=24;\n break;\n default:\n continue; /*Ignore raster with unknown depth*/\n }\n image->columns=Bitmap2Header1.Width;\n image->rows=Bitmap2Header1.Height; \n\n if ((image->colors == 0) && (bpp != 24))\n {\n size_t\n one;\n\n one=1;\n image->colors=one << bpp;\n if (!AcquireImageColormap(image,image->colors,exception))\n goto NoMemory;\n }\n else\n {\n if(bpp < 24)\n if( image->colors<(one << bpp) && bpp!=24 )\n image->colormap=(PixelInfo *) ResizeQuantumMemory(\n image->colormap,(size_t) (one << bpp),\n sizeof(*image->colormap));\n }\n\n\n switch(Bitmap2Header1.Compression)\n {\n case 0: /*Uncompressed raster*/\n {\n ldblk=(ssize_t) ((bpp*image->columns+7)/8);\n BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t)\n ldblk,sizeof(*BImgBuff));\n if (BImgBuff == (unsigned char *) NULL)\n goto NoMemory;\n\n for(i=0; i< (ssize_t) image->rows; i++)\n {\n (void) ReadBlob(image,ldblk,BImgBuff);\n InsertRow(image,BImgBuff,i,bpp,exception);\n }\n\n if(BImgBuff)\n BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff);;\n break;\n }\n case 1: /*RLE for WPG2 */\n {\n if( UnpackWPG2Raster(image,bpp,exception) < 0)\n goto DecompressionFailed;\n break;\n } \n }\n\n if(CTM[0][0]<0 && !image_info->ping)\n { /*?? RotAngle=360-RotAngle;*/\n Image\n *flop_image;\n\n flop_image = FlopImage(image, exception);\n if (flop_image != (Image *) NULL) {\n DuplicateBlob(flop_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flop_image);\n }\n /* Try to change CTM according to Flip - I am not sure, must be checked. \n Tx(0,0)=-1; Tx(1,0)=0; Tx(2,0)=0;\n Tx(0,1)= 0; Tx(1,1)=1; Tx(2,1)=0;\n Tx(0,2)=(WPG._2Rect.X_ur+WPG._2Rect.X_ll);\n Tx(1,2)=0; Tx(2,2)=1; */ \n }\n if(CTM[1][1]<0 && !image_info->ping)\n { /*?? RotAngle=360-RotAngle;*/\n Image\n *flip_image;\n\n flip_image = FlipImage(image, exception);\n if (flip_image != (Image *) NULL) {\n DuplicateBlob(flip_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flip_image);\n }\n /* Try to change CTM according to Flip - I am not sure, must be checked.\n float_matrix Tx(3,3);\n Tx(0,0)= 1; Tx(1,0)= 0; Tx(2,0)=0;\n Tx(0,1)= 0; Tx(1,1)=-1; Tx(2,1)=0;\n Tx(0,2)= 0; Tx(1,2)=(WPG._2Rect.Y_ur+WPG._2Rect.Y_ll);\n Tx(2,2)=1; */ \n } \n \n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n image->depth=8;\n if (image->next == (Image *) NULL)\n goto Finish;\n image=SyncNextImageInList(image);\n image->columns=image->rows=1;\n image->colors=0;\n break;\n\n case 0x12: /* Postscript WPG2*/\n i=ReadBlobLSBShort(image);\n if(Rec2.RecordLength > (unsigned int) i)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+i, /*skip PS header in the wpg2*/\n (ssize_t) (Rec2.RecordLength-i-2),exception);\n break;\n\n case 0x1B: /*bitmap rectangle*/\n WPG2Flags = LoadWPG2Flags(image,StartWPG.PosSizePrecision,NULL,&CTM);\n (void) WPG2Flags;\n break;\n }\n }\n\n break;\n\n default:\n {\n ThrowReaderException(CoderError,\"DataEncodingSchemeIsNotSupported\");\n }\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n\n Finish:\n (void) CloseBlob(image);\n\n {\n Image\n *p;\n\n ssize_t\n scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n /*\n Fix scene numbers.\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=(size_t) scene++;\n }\n if (image == (Image *) NULL)\n ThrowReaderException(CorruptImageError,\n \"ImageFileDoesNotContainAnyImageData\");\n return(image);\n}","target":"static Image *ReadWPGImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n typedef struct\n {\n size_t FileId;\n MagickOffsetType DataOffset;\n unsigned int ProductType;\n unsigned int FileType;\n unsigned char MajorVersion;\n unsigned char MinorVersion;\n unsigned int EncryptKey;\n unsigned int Reserved;\n } WPGHeader;\n\n typedef struct\n {\n unsigned char RecType;\n size_t RecordLength;\n } WPGRecord;\n\n typedef struct\n {\n unsigned char Class;\n unsigned char RecType;\n size_t Extension;\n size_t RecordLength;\n } WPG2Record;\n\n typedef struct\n {\n unsigned HorizontalUnits;\n unsigned VerticalUnits;\n unsigned char PosSizePrecision;\n } WPG2Start;\n\n typedef struct\n {\n unsigned int Width;\n unsigned int Height;\n unsigned int Depth;\n unsigned int HorzRes;\n unsigned int VertRes;\n } WPGBitmapType1;\n\n typedef struct\n {\n unsigned int Width;\n unsigned int Height;\n unsigned char Depth;\n unsigned char Compression;\n } WPG2BitmapType1;\n\n typedef struct\n {\n unsigned int RotAngle;\n unsigned int LowLeftX;\n unsigned int LowLeftY;\n unsigned int UpRightX;\n unsigned int UpRightY;\n unsigned int Width;\n unsigned int Height;\n unsigned int Depth;\n unsigned int HorzRes;\n unsigned int VertRes;\n } WPGBitmapType2;\n\n typedef struct\n {\n unsigned int StartIndex;\n unsigned int NumOfEntries;\n } WPGColorMapRec;\n\n /*\n typedef struct {\n size_t PS_unknown1;\n unsigned int PS_unknown2;\n unsigned int PS_unknown3;\n } WPGPSl1Record; \n */\n\n Image\n *image;\n\n unsigned int\n status;\n\n WPGHeader\n Header;\n\n WPGRecord\n Rec;\n\n WPG2Record\n Rec2;\n\n WPG2Start StartWPG;\n\n WPGBitmapType1\n BitmapHeader1;\n\n WPG2BitmapType1\n Bitmap2Header1;\n\n WPGBitmapType2\n BitmapHeader2;\n\n WPGColorMapRec\n WPG_Palette;\n\n int\n i,\n bpp,\n WPG2Flags;\n\n ssize_t\n ldblk;\n\n size_t\n one;\n\n unsigned char\n *BImgBuff;\n\n tCTM CTM; /*current transform matrix*/\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n one=1;\n image=AcquireImage(image_info,exception);\n image->depth=8;\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read WPG image.\n */\n Header.FileId=ReadBlobLSBLong(image);\n Header.DataOffset=(MagickOffsetType) ReadBlobLSBLong(image);\n Header.ProductType=ReadBlobLSBShort(image);\n Header.FileType=ReadBlobLSBShort(image);\n Header.MajorVersion=ReadBlobByte(image);\n Header.MinorVersion=ReadBlobByte(image);\n Header.EncryptKey=ReadBlobLSBShort(image);\n Header.Reserved=ReadBlobLSBShort(image);\n\n if (Header.FileId!=0x435057FF || (Header.ProductType>>8)!=0x16)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (Header.EncryptKey!=0)\n ThrowReaderException(CoderError,\"EncryptedWPGImageFileNotSupported\");\n\n image->columns = 1;\n image->rows = 1;\n image->colors = 0;\n bpp=0;\n BitmapHeader2.RotAngle=0;\n\n switch(Header.FileType)\n {\n case 1: /* WPG level 1 */\n while(!EOFBlob(image)) /* object parser loop */\n {\n (void) SeekBlob(image,Header.DataOffset,SEEK_SET);\n if(EOFBlob(image))\n break;\n\n Rec.RecType=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rd_WP_DWORD(image,&Rec.RecordLength);\n if(EOFBlob(image))\n break;\n\n Header.DataOffset=TellBlob(image)+Rec.RecordLength;\n\n switch(Rec.RecType)\n {\n case 0x0B: /* bitmap type 1 */\n BitmapHeader1.Width=ReadBlobLSBShort(image);\n BitmapHeader1.Height=ReadBlobLSBShort(image);\n if ((BitmapHeader1.Width == 0) || (BitmapHeader1.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n BitmapHeader1.Depth=ReadBlobLSBShort(image);\n BitmapHeader1.HorzRes=ReadBlobLSBShort(image);\n BitmapHeader1.VertRes=ReadBlobLSBShort(image);\n\n if(BitmapHeader1.HorzRes && BitmapHeader1.VertRes)\n {\n image->units=PixelsPerCentimeterResolution;\n image->resolution.x=BitmapHeader1.HorzRes/470.0;\n image->resolution.y=BitmapHeader1.VertRes/470.0;\n }\n image->columns=BitmapHeader1.Width;\n image->rows=BitmapHeader1.Height;\n bpp=BitmapHeader1.Depth;\n\n goto UnpackRaster;\n\n case 0x0E: /*Color palette */\n WPG_Palette.StartIndex=ReadBlobLSBShort(image);\n WPG_Palette.NumOfEntries=ReadBlobLSBShort(image);\n\n image->colors=WPG_Palette.NumOfEntries;\n if (!AcquireImageColormap(image,image->colors,exception))\n goto NoMemory;\n for (i=WPG_Palette.StartIndex;\n i < (int)WPG_Palette.NumOfEntries; i++)\n {\n image->colormap[i].red=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->colormap[i].green=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n image->colormap[i].blue=ScaleCharToQuantum((unsigned char)\n ReadBlobByte(image));\n }\n break;\n \n case 0x11: /* Start PS l1 */\n if(Rec.RecordLength > 8)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+8, /* skip PS header in the wpg */\n (ssize_t) Rec.RecordLength-8,exception);\n break; \n\n case 0x14: /* bitmap type 2 */\n BitmapHeader2.RotAngle=ReadBlobLSBShort(image);\n BitmapHeader2.LowLeftX=ReadBlobLSBShort(image);\n BitmapHeader2.LowLeftY=ReadBlobLSBShort(image);\n BitmapHeader2.UpRightX=ReadBlobLSBShort(image);\n BitmapHeader2.UpRightY=ReadBlobLSBShort(image);\n BitmapHeader2.Width=ReadBlobLSBShort(image);\n BitmapHeader2.Height=ReadBlobLSBShort(image);\n if ((BitmapHeader2.Width == 0) || (BitmapHeader2.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n BitmapHeader2.Depth=ReadBlobLSBShort(image);\n BitmapHeader2.HorzRes=ReadBlobLSBShort(image);\n BitmapHeader2.VertRes=ReadBlobLSBShort(image);\n\n image->units=PixelsPerCentimeterResolution;\n image->page.width=(unsigned int)\n ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightX)/470.0);\n image->page.height=(unsigned int)\n ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightY)/470.0);\n image->page.x=(int) (BitmapHeader2.LowLeftX/470.0);\n image->page.y=(int) (BitmapHeader2.LowLeftX/470.0);\n if(BitmapHeader2.HorzRes && BitmapHeader2.VertRes)\n {\n image->resolution.x=BitmapHeader2.HorzRes/470.0;\n image->resolution.y=BitmapHeader2.VertRes/470.0;\n }\n image->columns=BitmapHeader2.Width;\n image->rows=BitmapHeader2.Height;\n bpp=BitmapHeader2.Depth;\n\n UnpackRaster: \n if ((image->colors == 0) && (bpp != 24))\n {\n image->colors=one << bpp;\n if (!AcquireImageColormap(image,image->colors,exception))\n {\n NoMemory:\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n /* printf(\"Load default colormap \\n\"); */\n for (i=0; (i < (int) image->colors) && (i < 256); i++)\n { \n image->colormap[i].red=ScaleCharToQuantum(WPG1_Palette[i].Red);\n image->colormap[i].green=ScaleCharToQuantum(WPG1_Palette[i].Green);\n image->colormap[i].blue=ScaleCharToQuantum(WPG1_Palette[i].Blue);\n }\n }\n else\n {\n if (bpp < 24)\n if ( (image->colors < (one << bpp)) && (bpp != 24) )\n image->colormap=(PixelInfo *) ResizeQuantumMemory(\n image->colormap,(size_t) (one << bpp),\n sizeof(*image->colormap));\n }\n \n if (bpp == 1)\n {\n if(image->colormap[0].red==0 &&\n image->colormap[0].green==0 &&\n image->colormap[0].blue==0 &&\n image->colormap[1].red==0 &&\n image->colormap[1].green==0 &&\n image->colormap[1].blue==0)\n { /* fix crippled monochrome palette */\n image->colormap[1].red =\n image->colormap[1].green =\n image->colormap[1].blue = QuantumRange;\n }\n } \n\n if(UnpackWPGRaster(image,bpp,exception) < 0)\n /* The raster cannot be unpacked */\n {\n DecompressionFailed:\n ThrowReaderException(CoderError,\"UnableToDecompressImage\");\n }\n\n if(Rec.RecType==0x14 && BitmapHeader2.RotAngle!=0 && !image_info->ping)\n { \n /* flop command */\n if(BitmapHeader2.RotAngle & 0x8000)\n {\n Image\n *flop_image;\n\n flop_image = FlopImage(image, exception);\n if (flop_image != (Image *) NULL) {\n DuplicateBlob(flop_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flop_image);\n }\n }\n /* flip command */\n if(BitmapHeader2.RotAngle & 0x2000)\n {\n Image\n *flip_image;\n\n flip_image = FlipImage(image, exception);\n if (flip_image != (Image *) NULL) {\n DuplicateBlob(flip_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flip_image); \n }\n }\n \n /* rotate command */\n if(BitmapHeader2.RotAngle & 0x0FFF)\n {\n Image\n *rotate_image;\n\n rotate_image=RotateImage(image,(BitmapHeader2.RotAngle &\n 0x0FFF), exception);\n if (rotate_image != (Image *) NULL) {\n DuplicateBlob(rotate_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,rotate_image); \n }\n } \n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n image->depth=8;\n if (image->next == (Image *) NULL)\n goto Finish;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n break;\n\n case 0x1B: /* Postscript l2 */\n if(Rec.RecordLength>0x3C)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+0x3C, /* skip PS l2 header in the wpg */\n (ssize_t) Rec.RecordLength-0x3C,exception);\n break;\n }\n }\n break;\n\n case 2: /* WPG level 2 */\n (void) memset(CTM,0,sizeof(CTM));\n StartWPG.PosSizePrecision = 0;\n while(!EOFBlob(image)) /* object parser loop */\n {\n (void) SeekBlob(image,Header.DataOffset,SEEK_SET);\n if(EOFBlob(image))\n break;\n\n Rec2.Class=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rec2.RecType=(i=ReadBlobByte(image));\n if(i==EOF)\n break;\n Rd_WP_DWORD(image,&Rec2.Extension);\n Rd_WP_DWORD(image,&Rec2.RecordLength);\n if(EOFBlob(image))\n break;\n\n Header.DataOffset=TellBlob(image)+Rec2.RecordLength;\n\n switch(Rec2.RecType)\n {\n case 1:\n StartWPG.HorizontalUnits=ReadBlobLSBShort(image);\n StartWPG.VerticalUnits=ReadBlobLSBShort(image);\n StartWPG.PosSizePrecision=ReadBlobByte(image);\n break;\n case 0x0C: /* Color palette */\n WPG_Palette.StartIndex=ReadBlobLSBShort(image);\n WPG_Palette.NumOfEntries=ReadBlobLSBShort(image);\n\n image->colors=WPG_Palette.NumOfEntries;\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n for (i=WPG_Palette.StartIndex;\n i < (int)WPG_Palette.NumOfEntries; i++)\n {\n image->colormap[i].red=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n image->colormap[i].green=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n image->colormap[i].blue=ScaleCharToQuantum((char)\n ReadBlobByte(image));\n (void) ReadBlobByte(image); /*Opacity??*/\n }\n break;\n case 0x0E:\n Bitmap2Header1.Width=ReadBlobLSBShort(image);\n Bitmap2Header1.Height=ReadBlobLSBShort(image);\n if ((Bitmap2Header1.Width == 0) || (Bitmap2Header1.Height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n Bitmap2Header1.Depth=ReadBlobByte(image);\n Bitmap2Header1.Compression=ReadBlobByte(image);\n\n if(Bitmap2Header1.Compression > 1)\n continue; /*Unknown compression method */\n switch(Bitmap2Header1.Depth)\n {\n case 1:\n bpp=1;\n break;\n case 2:\n bpp=2;\n break;\n case 3:\n bpp=4;\n break;\n case 4:\n bpp=8;\n break;\n case 8:\n bpp=24;\n break;\n default:\n continue; /*Ignore raster with unknown depth*/\n }\n image->columns=Bitmap2Header1.Width;\n image->rows=Bitmap2Header1.Height; \n\n if ((image->colors == 0) && (bpp != 24))\n {\n size_t\n one;\n\n one=1;\n image->colors=one << bpp;\n if (!AcquireImageColormap(image,image->colors,exception))\n goto NoMemory;\n }\n else\n {\n if(bpp < 24)\n if( image->colors<(one << bpp) && bpp!=24 )\n image->colormap=(PixelInfo *) ResizeQuantumMemory(\n image->colormap,(size_t) (one << bpp),\n sizeof(*image->colormap));\n }\n\n\n switch(Bitmap2Header1.Compression)\n {\n case 0: /*Uncompressed raster*/\n {\n ldblk=(ssize_t) ((bpp*image->columns+7)/8);\n BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t)\n ldblk+1,sizeof(*BImgBuff));\n if (BImgBuff == (unsigned char *) NULL)\n goto NoMemory;\n\n for(i=0; i< (ssize_t) image->rows; i++)\n {\n (void) ReadBlob(image,ldblk,BImgBuff);\n InsertRow(image,BImgBuff,i,bpp,exception);\n }\n\n if(BImgBuff)\n BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff);;\n break;\n }\n case 1: /*RLE for WPG2 */\n {\n if( UnpackWPG2Raster(image,bpp,exception) < 0)\n goto DecompressionFailed;\n break;\n } \n }\n\n if(CTM[0][0]<0 && !image_info->ping)\n { /*?? RotAngle=360-RotAngle;*/\n Image\n *flop_image;\n\n flop_image = FlopImage(image, exception);\n if (flop_image != (Image *) NULL) {\n DuplicateBlob(flop_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flop_image);\n }\n /* Try to change CTM according to Flip - I am not sure, must be checked. \n Tx(0,0)=-1; Tx(1,0)=0; Tx(2,0)=0;\n Tx(0,1)= 0; Tx(1,1)=1; Tx(2,1)=0;\n Tx(0,2)=(WPG._2Rect.X_ur+WPG._2Rect.X_ll);\n Tx(1,2)=0; Tx(2,2)=1; */ \n }\n if(CTM[1][1]<0 && !image_info->ping)\n { /*?? RotAngle=360-RotAngle;*/\n Image\n *flip_image;\n\n flip_image = FlipImage(image, exception);\n if (flip_image != (Image *) NULL) {\n DuplicateBlob(flip_image,image);\n (void) RemoveLastImageFromList(&image);\n AppendImageToList(&image,flip_image);\n }\n /* Try to change CTM according to Flip - I am not sure, must be checked.\n float_matrix Tx(3,3);\n Tx(0,0)= 1; Tx(1,0)= 0; Tx(2,0)=0;\n Tx(0,1)= 0; Tx(1,1)=-1; Tx(2,1)=0;\n Tx(0,2)= 0; Tx(1,2)=(WPG._2Rect.Y_ur+WPG._2Rect.Y_ll);\n Tx(2,2)=1; */ \n } \n \n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n image->depth=8;\n if (image->next == (Image *) NULL)\n goto Finish;\n image=SyncNextImageInList(image);\n image->columns=image->rows=1;\n image->colors=0;\n break;\n\n case 0x12: /* Postscript WPG2*/\n i=ReadBlobLSBShort(image);\n if(Rec2.RecordLength > (unsigned int) i)\n image=ExtractPostscript(image,image_info,\n TellBlob(image)+i, /*skip PS header in the wpg2*/\n (ssize_t) (Rec2.RecordLength-i-2),exception);\n break;\n\n case 0x1B: /*bitmap rectangle*/\n WPG2Flags = LoadWPG2Flags(image,StartWPG.PosSizePrecision,NULL,&CTM);\n (void) WPG2Flags;\n break;\n }\n }\n\n break;\n\n default:\n {\n ThrowReaderException(CoderError,\"DataEncodingSchemeIsNotSupported\");\n }\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n\n Finish:\n (void) CloseBlob(image);\n\n {\n Image\n *p;\n\n ssize_t\n scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n /*\n Fix scene numbers.\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=(size_t) scene++;\n }\n if (image == (Image *) NULL)\n ThrowReaderException(CorruptImageError,\n \"ImageFileDoesNotContainAnyImageData\");\n return(image);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ReadWPGImage","file_name":"coders/wpg.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/bef1e4f637d8f665bc133a9c6d30df08d983bc3a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#113-261091b252d8","input":"static void gf_m2ts_process_pmt(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *pmt, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)\n{\n\tu32 info_length, pos, desc_len, evt_type, nb_es,i;\n\tu32 nb_sections;\n\tu32 data_size;\n\tu32 nb_hevc, nb_hevc_temp, nb_shvc, nb_shvc_temp, nb_mhvc, nb_mhvc_temp;\n\tunsigned char *data;\n\tGF_M2TS_Section *section;\n\tGF_Err e = GF_OK;\n\n\t/*wait for the last section */\n\tif (!(status&GF_M2TS_TABLE_END)) return;\n\n\tnb_es = 0;\n\n\t/*skip if already received but no update detected (eg same data) */\n\tif ((status&GF_M2TS_TABLE_REPEAT) && !(status&GF_M2TS_TABLE_UPDATE)) {\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PMT_REPEAT, pmt->program);\n\t\treturn;\n\t}\n\n\tif (pmt->sec->demux_restarted) {\n\t\tpmt->sec->demux_restarted = 0;\n\t\treturn;\n\t}\n\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] PMT Found or updated\\n\"));\n\n\tnb_sections = gf_list_count(sections);\n\tif (nb_sections > 1) {\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"PMT on multiple sections not supported\\n\"));\n\t}\n\n\tsection = (GF_M2TS_Section *)gf_list_get(sections, 0);\n\tdata = section->data;\n\tdata_size = section->data_size;\n\n\tpmt->program->pcr_pid = ((data[0] & 0x1f) << 8) | data[1];\n\n\tinfo_length = ((data[2]&0xf)<<8) | data[3];\n\tif (info_length != 0) {\n\t\t/* ...Read Descriptors ... */\n\t\tu8 tag, len;\n\t\tu32 first_loop_len = 0;\n\t\ttag = data[4];\n\t\tlen = data[5];\n\t\twhile (info_length > first_loop_len) {\n\t\t\tif (tag == GF_M2TS_MPEG4_IOD_DESCRIPTOR) {\n\t\t\t\tu32 size;\n\t\t\t\tGF_BitStream *iod_bs;\n\t\t\t\tiod_bs = gf_bs_new((char *)data+8, len-2, GF_BITSTREAM_READ);\n\t\t\t\tif (pmt->program->pmt_iod) gf_odf_desc_del((GF_Descriptor *)pmt->program->pmt_iod);\n\t\t\t\te = gf_odf_parse_descriptor(iod_bs , (GF_Descriptor **) &pmt->program->pmt_iod, &size);\n\t\t\t\tgf_bs_del(iod_bs );\n\t\t\t\tif (e==GF_OK) {\n\t\t\t\t\t/*remember program number for service/program selection*/\n\t\t\t\t\tif (pmt->program->pmt_iod) pmt->program->pmt_iod->ServiceID = pmt->program->number;\n\t\t\t\t\t/*if empty IOD (freebox case), discard it and use dynamic declaration of object*/\n\t\t\t\t\tif (!gf_list_count(pmt->program->pmt_iod->ESDescriptors)) {\n\t\t\t\t\t\tgf_odf_desc_del((GF_Descriptor *)pmt->program->pmt_iod);\n\t\t\t\t\t\tpmt->program->pmt_iod = NULL;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (tag == GF_M2TS_METADATA_POINTER_DESCRIPTOR) {\n\t\t\t\tGF_BitStream *metadatapd_bs;\n\t\t\t\tGF_M2TS_MetadataPointerDescriptor *metapd;\n\t\t\t\tmetadatapd_bs = gf_bs_new((char *)data+6, len, GF_BITSTREAM_READ);\n\t\t\t\tmetapd = gf_m2ts_read_metadata_pointer_descriptor(metadatapd_bs, len);\n\t\t\t\tgf_bs_del(metadatapd_bs);\n\t\t\t\tif (metapd->application_format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t metapd->format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t metapd->carriage_flag == METADATA_CARRIAGE_SAME_TS) {\n\t\t\t\t\t/*HLS ID3 Metadata */\n\t\t\t\t\tpmt->program->metadata_pointer_descriptor = metapd;\n\t\t\t\t} else {\n\t\t\t\t\t/* don't know what to do with it for now, delete */\n\t\t\t\t\tgf_m2ts_metadata_pointer_descriptor_del(metapd);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Skipping descriptor (0x%x) and others not supported\\n\", tag));\n\t\t\t}\n\t\t\tfirst_loop_len += 2 + len;\n\t\t}\n\t}\n\tif (data_size <= 4 + info_length) return;\n\tdata += 4 + info_length;\n\tdata_size -= 4 + info_length;\n\tpos = 0;\n\n\t/* count de number of program related PMT received */\n\tfor(i=0; iprograms); i++) {\n\t\tGF_M2TS_Program *prog = (GF_M2TS_Program *)gf_list_get(ts->programs,i);\n\t\tif(prog->pmt_pid == pmt->pid) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tnb_hevc = nb_hevc_temp = nb_shvc = nb_shvc_temp = nb_mhvc = nb_mhvc_temp = 0;\n\twhile (poscc = -1;\n\t\t\tpes->flags = GF_M2TS_ES_IS_PES;\n\t\t\tif (inherit_pcr)\n\t\t\t\tpes->flags |= GF_M2TS_INHERIT_PCR;\n\t\t\tes = (GF_M2TS_ES *)pes;\n\t\t\tbreak;\n\t\tcase GF_M2TS_PRIVATE_DATA:\n\t\t\tGF_SAFEALLOC(pes, GF_M2TS_PES);\n\t\t\tif (!pes) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpes->cc = -1;\n\t\t\tpes->flags = GF_M2TS_ES_IS_PES;\n\t\t\tes = (GF_M2TS_ES *)pes;\n\t\t\tbreak;\n\t\t/* Sections */\n\t\tcase GF_M2TS_SYSTEMS_MPEG4_SECTIONS:\n\t\t\tGF_SAFEALLOC(ses, GF_M2TS_SECTION_ES);\n\t\t\tif (!ses) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tes = (GF_M2TS_ES *)ses;\n\t\t\tes->flags |= GF_M2TS_ES_IS_SECTION;\n\t\t\t/* carriage of ISO_IEC_14496 data in sections */\n\t\t\tif (stream_type == GF_M2TS_SYSTEMS_MPEG4_SECTIONS) {\n\t\t\t\t/*MPEG-4 sections need to be fully checked: if one section is lost, this means we lost\n\t\t\t\tone SL packet in the AU so we must wait for the complete section again*/\n\t\t\t\tses->sec = gf_m2ts_section_filter_new(gf_m2ts_process_mpeg4section, 0);\n\t\t\t\t/*create OD container*/\n\t\t\t\tif (!pmt->program->additional_ods) {\n\t\t\t\t\tpmt->program->additional_ods = gf_list_new();\n\t\t\t\t\tts->has_4on2 = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase GF_M2TS_13818_6_ANNEX_A:\n\t\tcase GF_M2TS_13818_6_ANNEX_B:\n\t\tcase GF_M2TS_13818_6_ANNEX_C:\n\t\tcase GF_M2TS_13818_6_ANNEX_D:\n\t\tcase GF_M2TS_PRIVATE_SECTION:\n\t\tcase GF_M2TS_QUALITY_SEC:\n\t\tcase GF_M2TS_MORE_SEC:\n\t\t\tGF_SAFEALLOC(ses, GF_M2TS_SECTION_ES);\n\t\t\tif (!ses) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tes = (GF_M2TS_ES *)ses;\n\t\t\tes->flags |= GF_M2TS_ES_IS_SECTION;\n\t\t\tes->pid = pid;\n\t\t\tes->service_id = pmt->program->number;\n\t\t\tif (stream_type == GF_M2TS_PRIVATE_SECTION) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"AIT sections on pid %d\\n\", pid));\n\t\t\t} else if (stream_type == GF_M2TS_QUALITY_SEC) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"Quality metadata sections on pid %d\\n\", pid));\n\t\t\t} else if (stream_type == GF_M2TS_MORE_SEC) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"MORE sections on pid %d\\n\", pid));\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"stream type DSM CC user private sections on pid %d \\n\", pid));\n\t\t\t}\n\t\t\t/* NULL means: trigger the call to on_event with DVB_GENERAL type and the raw section as payload */\n\t\t\tses->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t//ses->sec->service_id = pmt->program->number;\n\t\t\tbreak;\n\n\t\tcase GF_M2TS_MPE_SECTIONS:\n\t\t\tif (! ts->prefix_present) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"stream type MPE found : pid = %d \\n\", pid));\n#ifdef GPAC_ENABLE_MPE\n\t\t\t\tes = gf_dvb_mpe_section_new();\n\t\t\t\tif (es->flags & GF_M2TS_ES_IS_SECTION) {\n\t\t\t\t\t/* NULL means: trigger the call to on_event with DVB_GENERAL type and the raw section as payload */\n\t\t\t\t\t((GF_M2TS_SECTION_ES*)es)->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t\t}\n#endif\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tdefault:\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t\t//GF_LOG(/*GF_LOG_WARNING*/GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t\tbreak;\n\t\t}\n\n\t\tif (es) {\n\t\t\tes->stream_type = (stream_type==GF_M2TS_PRIVATE_DATA) ? 0 : stream_type;\n\t\t\tes->program = pmt->program;\n\t\t\tes->pid = pid;\n\t\t\tes->component_tag = -1;\n\t\t}\n\n\t\tpos += 5;\n\t\tdata += 5;\n\n\t\twhile (desc_len) {\n\t\t\tu8 tag = data[0];\n\t\t\tu32 len = data[1];\n\t\t\tif (es) {\n\t\t\t\tswitch (tag) {\n\t\t\t\tcase GF_M2TS_ISO_639_LANGUAGE_DESCRIPTOR:\n\t\t\t\t\tif (pes)\n\t\t\t\t\t\tpes->lang = GF_4CC(' ', data[2], data[3], data[4]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_MPEG4_SL_DESCRIPTOR:\n\t\t\t\t\tes->mpeg4_es_id = ( (u32) data[2] & 0x1f) << 8 | data[3];\n\t\t\t\t\tes->flags |= GF_M2TS_ES_IS_SL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_REGISTRATION_DESCRIPTOR:\n\t\t\t\t\treg_desc_format = GF_4CC(data[2], data[3], data[4], data[5]);\n\t\t\t\t\t/*cf http://www.smpte-ra.org/mpegreg/mpegreg.html*/\n\t\t\t\t\tswitch (reg_desc_format) {\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_AC3:\n\t\t\t\t\t\tes->stream_type = GF_M2TS_AUDIO_AC3;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_VC1:\n\t\t\t\t\t\tes->stream_type = GF_M2TS_VIDEO_VC1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_GPAC:\n\t\t\t\t\t\tif (len==8) {\n\t\t\t\t\t\t\tes->stream_type = GF_4CC(data[6], data[7], data[8], data[9]);\n\t\t\t\t\t\t\tes->flags |= GF_M2TS_GPAC_CODEC_ID;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"Unknown registration descriptor %s\\n\", gf_4cc_to_str(reg_desc_format) ));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_EAC3_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_AUDIO_EC3;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_DATA_BROADCAST_ID_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tu32 id = data[2]<<8 | data[3];\n\t\t\t\t\tif ((id == 0xB) && ses && !ses->sec) {\n\t\t\t\t\t\tses->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_SUBTITLING_DESCRIPTOR:\n\t\t\t\t\tif (pes) {\n\t\t\t\t\t\tpes->sub.language[0] = data[2];\n\t\t\t\t\t\tpes->sub.language[1] = data[3];\n\t\t\t\t\t\tpes->sub.language[2] = data[4];\n\t\t\t\t\t\tpes->sub.type = data[5];\n\t\t\t\t\t\tpes->sub.composition_page_id = (data[6]<<8) | data[7];\n\t\t\t\t\t\tpes->sub.ancillary_page_id = (data[8]<<8) | data[9];\n\t\t\t\t\t}\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_SUBTITLE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_STREAM_IDENTIFIER_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tes->component_tag = data[2];\n\t\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"Component Tag: %d on Program %d\\n\", es->component_tag, es->program->number));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_TELETEXT_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_TELETEXT;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_VBI_DATA_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_VBI;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_HIERARCHY_DESCRIPTOR:\n\t\t\t\t\tif (pes) {\n\t\t\t\t\t\tu8 hierarchy_embedded_layer_index;\n\t\t\t\t\t\tGF_BitStream *hbs = gf_bs_new((const char *)data, data_size, GF_BITSTREAM_READ);\n\t\t\t\t\t\t/*u32 skip = */gf_bs_read_int(hbs, 16);\n\t\t\t\t\t\t/*u8 res1 = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 temp_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 spatial_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 quality_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 hierarchy_type = */gf_bs_read_int(hbs, 4);\n\t\t\t\t\t\t/*u8 res2 = */gf_bs_read_int(hbs, 2);\n\t\t\t\t\t\t/*u8 hierarchy_layer_index = */gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\t/*u8 tref_not_present = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 res3 = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\thierarchy_embedded_layer_index = gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\t/*u8 res4 = */gf_bs_read_int(hbs, 2);\n\t\t\t\t\t\t/*u8 hierarchy_channel = */gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\tgf_bs_del(hbs);\n\n\t\t\t\t\t\tpes->depends_on_pid = 1+hierarchy_embedded_layer_index;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_METADATA_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tGF_BitStream *metadatad_bs;\n\t\t\t\t\tGF_M2TS_MetadataDescriptor *metad;\n\t\t\t\t\tmetadatad_bs = gf_bs_new((char *)data+2, len, GF_BITSTREAM_READ);\n\t\t\t\t\tmetad = gf_m2ts_read_metadata_descriptor(metadatad_bs, len);\n\t\t\t\t\tgf_bs_del(metadatad_bs);\n\t\t\t\t\tif (metad->application_format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t\t metad->format_identifier == GF_M2TS_META_ID3) {\n\t\t\t\t\t\t/*HLS ID3 Metadata */\n\t\t\t\t\t\tif (pes) {\n\t\t\t\t\t\t\tpes->metadata_descriptor = metad;\n\t\t\t\t\t\t\tpes->stream_type = GF_M2TS_METADATA_ID3_HLS;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* don't know what to do with it for now, delete */\n\t\t\t\t\t\tgf_m2ts_metadata_descriptor_del(metad);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] skipping descriptor (0x%x) not supported\\n\", tag));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdata += len+2;\n\t\t\tpos += len+2;\n\t\t\tif (desc_len < len+2) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Invalid PMT es descriptor size for PID %d\\n\", pid ) );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdesc_len-=len+2;\n\t\t}\n\n\t\tif (es && !es->stream_type) {\n\t\t\tgf_free(es);\n\t\t\tes = NULL;\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Private Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t}\n\n\t\tif (!es) continue;\n\n\t\tif (ts->ess[pid]) {\n\t\t\t//this is component reuse across programs, overwrite the previously declared stream ...\n\t\t\tif (status & GF_M2TS_TABLE_FOUND) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"[MPEG-2 TS] PID %d reused across programs %d and %d, not completely supported\\n\", pid, ts->ess[pid]->program->number, es->program->number ) );\n\n\t\t\t\t//add stream to program but don't reassign the pid table until the stream is playing (>GF_M2TS_PES_FRAMING_SKIP)\n\t\t\t\tgf_list_add(pmt->program->streams, es);\n\t\t\t\tif (!(es->flags & GF_M2TS_ES_IS_SECTION) ) gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_SKIP);\n\n\t\t\t\tnb_es++;\n\t\t\t\t//skip assignment below\n\t\t\t\tes = NULL;\n\t\t\t}\n\t\t\t/*watchout for pmt update - FIXME this likely won't work in most cases*/\n\t\t\telse {\n\n\t\t\t\tGF_M2TS_ES *o_es = ts->ess[es->pid];\n\n\t\t\t\tif ((o_es->stream_type == es->stream_type)\n\t\t\t\t && ((o_es->flags & GF_M2TS_ES_STATIC_FLAGS_MASK) == (es->flags & GF_M2TS_ES_STATIC_FLAGS_MASK))\n\t\t\t\t && (o_es->mpeg4_es_id == es->mpeg4_es_id)\n\t\t\t\t && ((o_es->flags & GF_M2TS_ES_IS_SECTION) || ((GF_M2TS_PES *)o_es)->lang == ((GF_M2TS_PES *)es)->lang)\n\t\t\t\t ) {\n\t\t\t\t\tgf_free(es);\n\t\t\t\t\tes = NULL;\n\t\t\t\t} else {\n\t\t\t\t\tgf_m2ts_es_del(o_es, ts);\n\t\t\t\t\tts->ess[es->pid] = NULL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (es) {\n\t\t\tts->ess[es->pid] = es;\n\t\t\tgf_list_add(pmt->program->streams, es);\n\t\t\tif (!(es->flags & GF_M2TS_ES_IS_SECTION) ) gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_SKIP);\n\n\t\t\tnb_es++;\n\t\t}\n\n\t\tif (es->stream_type == GF_M2TS_VIDEO_HEVC) nb_hevc++;\n\t\telse if (es->stream_type == GF_M2TS_VIDEO_HEVC_TEMPORAL) nb_hevc_temp++;\n\t\telse if (es->stream_type == GF_M2TS_VIDEO_SHVC) nb_shvc++;\n\t\telse if (es->stream_type == GF_M2TS_VIDEO_SHVC_TEMPORAL) nb_shvc_temp++;\n\t\telse if (es->stream_type == GF_M2TS_VIDEO_MHVC) nb_mhvc++;\n\t\telse if (es->stream_type == GF_M2TS_VIDEO_MHVC_TEMPORAL) nb_mhvc_temp++;\n\t}\n\n\t//Table 2-139, implied hierarchy indexes\n\tif (nb_hevc_temp + nb_shvc + nb_shvc_temp + nb_mhvc+ nb_mhvc_temp) {\n\t\tfor (i=0; iprogram->streams); i++) {\n\t\t\tGF_M2TS_PES *es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, i);\n\t\t\tif ( !(es->flags & GF_M2TS_ES_IS_PES)) continue;\n\t\t\tif (es->depends_on_pid) continue;\n\n\t\t\tswitch (es->stream_type) {\n\t\t\tcase GF_M2TS_VIDEO_HEVC_TEMPORAL:\n\t\t\t\tes->depends_on_pid = 1;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_SHVC:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 1;\n\t\t\t\telse es->depends_on_pid = 2;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_SHVC_TEMPORAL:\n\t\t\t\tes->depends_on_pid = 3;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_MHVC:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 1;\n\t\t\t\telse es->depends_on_pid = 2;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_MHVC_TEMPORAL:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 2;\n\t\t\t\telse es->depends_on_pid = 3;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (nb_es) {\n\t\tu32 i;\n\n\t\t//translate hierarchy descriptors indexes into PIDs - check whether the PMT-index rules are the same for HEVC\n\t\tfor (i=0; iprogram->streams); i++) {\n\t\t\tGF_M2TS_PES *an_es = NULL;\n\t\t\tGF_M2TS_PES *es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, i);\n\t\t\tif ( !(es->flags & GF_M2TS_ES_IS_PES)) continue;\n\t\t\tif (!es->depends_on_pid) continue;\n\n\t\t\t//fixeme we are not always assured that hierarchy_layer_index matches the stream index...\n\t\t\t//+1 is because our first stream is the PMT\n\t\t\tan_es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, es->depends_on_pid);\n\t\t\tif (an_es) {\n\t\t\t\tes->depends_on_pid = an_es->pid;\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[M2TS] Wrong dependency index in hierarchy descriptor, assuming non-scalable stream\\n\"));\n\t\t\t\tes->depends_on_pid = 0;\n\t\t\t}\n\t\t}\n\n\t\tevt_type = (status&GF_M2TS_TABLE_FOUND) ? GF_M2TS_EVT_PMT_FOUND : GF_M2TS_EVT_PMT_UPDATE;\n\t\tif (ts->on_event) ts->on_event(ts, evt_type, pmt->program);\n\t} else {\n\t\t/* if we found no new ES it's simply a repeat of the PMT */\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PMT_REPEAT, pmt->program);\n\t}\n}","target":"static void gf_m2ts_process_pmt(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *pmt, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)\n{\n\tu32 info_length, pos, desc_len, evt_type, nb_es,i;\n\tu32 nb_sections;\n\tu32 data_size;\n\tu32 nb_hevc, nb_hevc_temp, nb_shvc, nb_shvc_temp, nb_mhvc, nb_mhvc_temp;\n\tunsigned char *data;\n\tGF_M2TS_Section *section;\n\tGF_Err e = GF_OK;\n\n\t/*wait for the last section */\n\tif (!(status&GF_M2TS_TABLE_END)) return;\n\n\tnb_es = 0;\n\n\t/*skip if already received but no update detected (eg same data) */\n\tif ((status&GF_M2TS_TABLE_REPEAT) && !(status&GF_M2TS_TABLE_UPDATE)) {\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PMT_REPEAT, pmt->program);\n\t\treturn;\n\t}\n\n\tif (pmt->sec->demux_restarted) {\n\t\tpmt->sec->demux_restarted = 0;\n\t\treturn;\n\t}\n\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] PMT Found or updated\\n\"));\n\n\tnb_sections = gf_list_count(sections);\n\tif (nb_sections > 1) {\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"PMT on multiple sections not supported\\n\"));\n\t}\n\n\tsection = (GF_M2TS_Section *)gf_list_get(sections, 0);\n\tdata = section->data;\n\tdata_size = section->data_size;\n\n\tpmt->program->pcr_pid = ((data[0] & 0x1f) << 8) | data[1];\n\n\tinfo_length = ((data[2]&0xf)<<8) | data[3];\n\tif (info_length != 0) {\n\t\t/* ...Read Descriptors ... */\n\t\tu8 tag, len;\n\t\tu32 first_loop_len = 0;\n\t\ttag = data[4];\n\t\tlen = data[5];\n\t\twhile (info_length > first_loop_len) {\n\t\t\tif (tag == GF_M2TS_MPEG4_IOD_DESCRIPTOR) {\n\t\t\t\tu32 size;\n\t\t\t\tGF_BitStream *iod_bs;\n\t\t\t\tiod_bs = gf_bs_new((char *)data+8, len-2, GF_BITSTREAM_READ);\n\t\t\t\tif (pmt->program->pmt_iod) gf_odf_desc_del((GF_Descriptor *)pmt->program->pmt_iod);\n\t\t\t\te = gf_odf_parse_descriptor(iod_bs , (GF_Descriptor **) &pmt->program->pmt_iod, &size);\n\t\t\t\tgf_bs_del(iod_bs );\n\t\t\t\tif (e==GF_OK) {\n\t\t\t\t\t/*remember program number for service/program selection*/\n\t\t\t\t\tif (pmt->program->pmt_iod) pmt->program->pmt_iod->ServiceID = pmt->program->number;\n\t\t\t\t\t/*if empty IOD (freebox case), discard it and use dynamic declaration of object*/\n\t\t\t\t\tif (!gf_list_count(pmt->program->pmt_iod->ESDescriptors)) {\n\t\t\t\t\t\tgf_odf_desc_del((GF_Descriptor *)pmt->program->pmt_iod);\n\t\t\t\t\t\tpmt->program->pmt_iod = NULL;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (tag == GF_M2TS_METADATA_POINTER_DESCRIPTOR) {\n\t\t\t\tGF_BitStream *metadatapd_bs;\n\t\t\t\tGF_M2TS_MetadataPointerDescriptor *metapd;\n\t\t\t\tmetadatapd_bs = gf_bs_new((char *)data+6, len, GF_BITSTREAM_READ);\n\t\t\t\tmetapd = gf_m2ts_read_metadata_pointer_descriptor(metadatapd_bs, len);\n\t\t\t\tgf_bs_del(metadatapd_bs);\n\t\t\t\tif (metapd->application_format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t metapd->format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t metapd->carriage_flag == METADATA_CARRIAGE_SAME_TS) {\n\t\t\t\t\t/*HLS ID3 Metadata */\n\t\t\t\t\tpmt->program->metadata_pointer_descriptor = metapd;\n\t\t\t\t} else {\n\t\t\t\t\t/* don't know what to do with it for now, delete */\n\t\t\t\t\tgf_m2ts_metadata_pointer_descriptor_del(metapd);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Skipping descriptor (0x%x) and others not supported\\n\", tag));\n\t\t\t}\n\t\t\tfirst_loop_len += 2 + len;\n\t\t}\n\t}\n\tif (data_size <= 4 + info_length) return;\n\tdata += 4 + info_length;\n\tdata_size -= 4 + info_length;\n\tpos = 0;\n\n\t/* count de number of program related PMT received */\n\tfor(i=0; iprograms); i++) {\n\t\tGF_M2TS_Program *prog = (GF_M2TS_Program *)gf_list_get(ts->programs,i);\n\t\tif(prog->pmt_pid == pmt->pid) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tnb_hevc = nb_hevc_temp = nb_shvc = nb_shvc_temp = nb_mhvc = nb_mhvc_temp = 0;\n\twhile (poscc = -1;\n\t\t\tpes->flags = GF_M2TS_ES_IS_PES;\n\t\t\tif (inherit_pcr)\n\t\t\t\tpes->flags |= GF_M2TS_INHERIT_PCR;\n\t\t\tes = (GF_M2TS_ES *)pes;\n\t\t\tbreak;\n\t\tcase GF_M2TS_PRIVATE_DATA:\n\t\t\tGF_SAFEALLOC(pes, GF_M2TS_PES);\n\t\t\tif (!pes) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpes->cc = -1;\n\t\t\tpes->flags = GF_M2TS_ES_IS_PES;\n\t\t\tes = (GF_M2TS_ES *)pes;\n\t\t\tbreak;\n\t\t/* Sections */\n\t\tcase GF_M2TS_SYSTEMS_MPEG4_SECTIONS:\n\t\t\tGF_SAFEALLOC(ses, GF_M2TS_SECTION_ES);\n\t\t\tif (!ses) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tes = (GF_M2TS_ES *)ses;\n\t\t\tes->flags |= GF_M2TS_ES_IS_SECTION;\n\t\t\t/* carriage of ISO_IEC_14496 data in sections */\n\t\t\tif (stream_type == GF_M2TS_SYSTEMS_MPEG4_SECTIONS) {\n\t\t\t\t/*MPEG-4 sections need to be fully checked: if one section is lost, this means we lost\n\t\t\t\tone SL packet in the AU so we must wait for the complete section again*/\n\t\t\t\tses->sec = gf_m2ts_section_filter_new(gf_m2ts_process_mpeg4section, 0);\n\t\t\t\t/*create OD container*/\n\t\t\t\tif (!pmt->program->additional_ods) {\n\t\t\t\t\tpmt->program->additional_ods = gf_list_new();\n\t\t\t\t\tts->has_4on2 = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase GF_M2TS_13818_6_ANNEX_A:\n\t\tcase GF_M2TS_13818_6_ANNEX_B:\n\t\tcase GF_M2TS_13818_6_ANNEX_C:\n\t\tcase GF_M2TS_13818_6_ANNEX_D:\n\t\tcase GF_M2TS_PRIVATE_SECTION:\n\t\tcase GF_M2TS_QUALITY_SEC:\n\t\tcase GF_M2TS_MORE_SEC:\n\t\t\tGF_SAFEALLOC(ses, GF_M2TS_SECTION_ES);\n\t\t\tif (!ses) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG2TS] Failed to allocate ES for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tes = (GF_M2TS_ES *)ses;\n\t\t\tes->flags |= GF_M2TS_ES_IS_SECTION;\n\t\t\tes->pid = pid;\n\t\t\tes->service_id = pmt->program->number;\n\t\t\tif (stream_type == GF_M2TS_PRIVATE_SECTION) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"AIT sections on pid %d\\n\", pid));\n\t\t\t} else if (stream_type == GF_M2TS_QUALITY_SEC) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"Quality metadata sections on pid %d\\n\", pid));\n\t\t\t} else if (stream_type == GF_M2TS_MORE_SEC) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"MORE sections on pid %d\\n\", pid));\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"stream type DSM CC user private sections on pid %d \\n\", pid));\n\t\t\t}\n\t\t\t/* NULL means: trigger the call to on_event with DVB_GENERAL type and the raw section as payload */\n\t\t\tses->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t//ses->sec->service_id = pmt->program->number;\n\t\t\tbreak;\n\n\t\tcase GF_M2TS_MPE_SECTIONS:\n\t\t\tif (! ts->prefix_present) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"stream type MPE found : pid = %d \\n\", pid));\n#ifdef GPAC_ENABLE_MPE\n\t\t\t\tes = gf_dvb_mpe_section_new();\n\t\t\t\tif (es->flags & GF_M2TS_ES_IS_SECTION) {\n\t\t\t\t\t/* NULL means: trigger the call to on_event with DVB_GENERAL type and the raw section as payload */\n\t\t\t\t\t((GF_M2TS_SECTION_ES*)es)->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t\t}\n#endif\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tdefault:\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t\t//GF_LOG(/*GF_LOG_WARNING*/GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t\tbreak;\n\t\t}\n\n\t\tif (es) {\n\t\t\tes->stream_type = (stream_type==GF_M2TS_PRIVATE_DATA) ? 0 : stream_type;\n\t\t\tes->program = pmt->program;\n\t\t\tes->pid = pid;\n\t\t\tes->component_tag = -1;\n\t\t}\n\n\t\tpos += 5;\n\t\tdata += 5;\n\n\t\twhile (desc_len) {\n\t\t\tu8 tag = data[0];\n\t\t\tu32 len = data[1];\n\t\t\tif (es) {\n\t\t\t\tswitch (tag) {\n\t\t\t\tcase GF_M2TS_ISO_639_LANGUAGE_DESCRIPTOR:\n\t\t\t\t\tif (pes)\n\t\t\t\t\t\tpes->lang = GF_4CC(' ', data[2], data[3], data[4]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_MPEG4_SL_DESCRIPTOR:\n\t\t\t\t\tes->mpeg4_es_id = ( (u32) data[2] & 0x1f) << 8 | data[3];\n\t\t\t\t\tes->flags |= GF_M2TS_ES_IS_SL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_REGISTRATION_DESCRIPTOR:\n\t\t\t\t\treg_desc_format = GF_4CC(data[2], data[3], data[4], data[5]);\n\t\t\t\t\t/*cf http://www.smpte-ra.org/mpegreg/mpegreg.html*/\n\t\t\t\t\tswitch (reg_desc_format) {\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_AC3:\n\t\t\t\t\t\tes->stream_type = GF_M2TS_AUDIO_AC3;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_VC1:\n\t\t\t\t\t\tes->stream_type = GF_M2TS_VIDEO_VC1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase GF_M2TS_RA_STREAM_GPAC:\n\t\t\t\t\t\tif (len==8) {\n\t\t\t\t\t\t\tes->stream_type = GF_4CC(data[6], data[7], data[8], data[9]);\n\t\t\t\t\t\t\tes->flags |= GF_M2TS_GPAC_CODEC_ID;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"Unknown registration descriptor %s\\n\", gf_4cc_to_str(reg_desc_format) ));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_EAC3_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_AUDIO_EC3;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_DATA_BROADCAST_ID_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tu32 id = data[2]<<8 | data[3];\n\t\t\t\t\tif ((id == 0xB) && ses && !ses->sec) {\n\t\t\t\t\t\tses->sec = gf_m2ts_section_filter_new(NULL, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_SUBTITLING_DESCRIPTOR:\n\t\t\t\t\tif (pes) {\n\t\t\t\t\t\tpes->sub.language[0] = data[2];\n\t\t\t\t\t\tpes->sub.language[1] = data[3];\n\t\t\t\t\t\tpes->sub.language[2] = data[4];\n\t\t\t\t\t\tpes->sub.type = data[5];\n\t\t\t\t\t\tpes->sub.composition_page_id = (data[6]<<8) | data[7];\n\t\t\t\t\t\tpes->sub.ancillary_page_id = (data[8]<<8) | data[9];\n\t\t\t\t\t}\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_SUBTITLE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_STREAM_IDENTIFIER_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tes->component_tag = data[2];\n\t\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"Component Tag: %d on Program %d\\n\", es->component_tag, es->program->number));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_TELETEXT_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_TELETEXT;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_DVB_VBI_DATA_DESCRIPTOR:\n\t\t\t\t\tes->stream_type = GF_M2TS_DVB_VBI;\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_HIERARCHY_DESCRIPTOR:\n\t\t\t\t\tif (pes) {\n\t\t\t\t\t\tu8 hierarchy_embedded_layer_index;\n\t\t\t\t\t\tGF_BitStream *hbs = gf_bs_new((const char *)data, data_size, GF_BITSTREAM_READ);\n\t\t\t\t\t\t/*u32 skip = */gf_bs_read_int(hbs, 16);\n\t\t\t\t\t\t/*u8 res1 = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 temp_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 spatial_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 quality_scal = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 hierarchy_type = */gf_bs_read_int(hbs, 4);\n\t\t\t\t\t\t/*u8 res2 = */gf_bs_read_int(hbs, 2);\n\t\t\t\t\t\t/*u8 hierarchy_layer_index = */gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\t/*u8 tref_not_present = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\t/*u8 res3 = */gf_bs_read_int(hbs, 1);\n\t\t\t\t\t\thierarchy_embedded_layer_index = gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\t/*u8 res4 = */gf_bs_read_int(hbs, 2);\n\t\t\t\t\t\t/*u8 hierarchy_channel = */gf_bs_read_int(hbs, 6);\n\t\t\t\t\t\tgf_bs_del(hbs);\n\n\t\t\t\t\t\tpes->depends_on_pid = 1+hierarchy_embedded_layer_index;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase GF_M2TS_METADATA_DESCRIPTOR:\n\t\t\t\t{\n\t\t\t\t\tGF_BitStream *metadatad_bs;\n\t\t\t\t\tGF_M2TS_MetadataDescriptor *metad;\n\t\t\t\t\tmetadatad_bs = gf_bs_new((char *)data+2, len, GF_BITSTREAM_READ);\n\t\t\t\t\tmetad = gf_m2ts_read_metadata_descriptor(metadatad_bs, len);\n\t\t\t\t\tgf_bs_del(metadatad_bs);\n\t\t\t\t\tif (metad->application_format_identifier == GF_M2TS_META_ID3 &&\n\t\t\t\t\t metad->format_identifier == GF_M2TS_META_ID3) {\n\t\t\t\t\t\t/*HLS ID3 Metadata */\n\t\t\t\t\t\tif (pes) {\n\t\t\t\t\t\t\tpes->metadata_descriptor = metad;\n\t\t\t\t\t\t\tpes->stream_type = GF_M2TS_METADATA_ID3_HLS;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* don't know what to do with it for now, delete */\n\t\t\t\t\t\tgf_m2ts_metadata_descriptor_del(metad);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[MPEG-2 TS] skipping descriptor (0x%x) not supported\\n\", tag));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdata += len+2;\n\t\t\tpos += len+2;\n\t\t\tif (desc_len < len+2) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Invalid PMT es descriptor size for PID %d\\n\", pid ) );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdesc_len-=len+2;\n\t\t}\n\n\t\tif (es && !es->stream_type) {\n\t\t\tgf_free(es);\n\t\t\tes = NULL;\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[MPEG-2 TS] Private Stream type (0x%x) for PID %d not supported\\n\", stream_type, pid ) );\n\t\t}\n\n\t\tif (!es) continue;\n\n\t\tif (ts->ess[pid]) {\n\t\t\t//this is component reuse across programs, overwrite the previously declared stream ...\n\t\t\tif (status & GF_M2TS_TABLE_FOUND) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"[MPEG-2 TS] PID %d reused across programs %d and %d, not completely supported\\n\", pid, ts->ess[pid]->program->number, es->program->number ) );\n\n\t\t\t\t//add stream to program but don't reassign the pid table until the stream is playing (>GF_M2TS_PES_FRAMING_SKIP)\n\t\t\t\tgf_list_add(pmt->program->streams, es);\n\t\t\t\tif (!(es->flags & GF_M2TS_ES_IS_SECTION) ) gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_SKIP);\n\n\t\t\t\tnb_es++;\n\t\t\t\t//skip assignment below\n\t\t\t\tes = NULL;\n\t\t\t}\n\t\t\t/*watchout for pmt update - FIXME this likely won't work in most cases*/\n\t\t\telse {\n\n\t\t\t\tGF_M2TS_ES *o_es = ts->ess[es->pid];\n\n\t\t\t\tif ((o_es->stream_type == es->stream_type)\n\t\t\t\t && ((o_es->flags & GF_M2TS_ES_STATIC_FLAGS_MASK) == (es->flags & GF_M2TS_ES_STATIC_FLAGS_MASK))\n\t\t\t\t && (o_es->mpeg4_es_id == es->mpeg4_es_id)\n\t\t\t\t && ((o_es->flags & GF_M2TS_ES_IS_SECTION) || ((GF_M2TS_PES *)o_es)->lang == ((GF_M2TS_PES *)es)->lang)\n\t\t\t\t ) {\n\t\t\t\t\tgf_free(es);\n\t\t\t\t\tes = NULL;\n\t\t\t\t} else {\n\t\t\t\t\tgf_m2ts_es_del(o_es, ts);\n\t\t\t\t\tts->ess[es->pid] = NULL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (es) {\n\t\t\tts->ess[es->pid] = es;\n\t\t\tgf_list_add(pmt->program->streams, es);\n\t\t\tif (!(es->flags & GF_M2TS_ES_IS_SECTION) ) gf_m2ts_set_pes_framing(pes, GF_M2TS_PES_FRAMING_SKIP);\n\n\t\t\tnb_es++;\n\n\t\t\tif (es->stream_type == GF_M2TS_VIDEO_HEVC) nb_hevc++;\n\t\t\telse if (es->stream_type == GF_M2TS_VIDEO_HEVC_TEMPORAL) nb_hevc_temp++;\n\t\t\telse if (es->stream_type == GF_M2TS_VIDEO_SHVC) nb_shvc++;\n\t\t\telse if (es->stream_type == GF_M2TS_VIDEO_SHVC_TEMPORAL) nb_shvc_temp++;\n\t\t\telse if (es->stream_type == GF_M2TS_VIDEO_MHVC) nb_mhvc++;\n\t\t\telse if (es->stream_type == GF_M2TS_VIDEO_MHVC_TEMPORAL) nb_mhvc_temp++;\n\t\t}\n\t}\n\n\t//Table 2-139, implied hierarchy indexes\n\tif (nb_hevc_temp + nb_shvc + nb_shvc_temp + nb_mhvc+ nb_mhvc_temp) {\n\t\tfor (i=0; iprogram->streams); i++) {\n\t\t\tGF_M2TS_PES *es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, i);\n\t\t\tif ( !(es->flags & GF_M2TS_ES_IS_PES)) continue;\n\t\t\tif (es->depends_on_pid) continue;\n\n\t\t\tswitch (es->stream_type) {\n\t\t\tcase GF_M2TS_VIDEO_HEVC_TEMPORAL:\n\t\t\t\tes->depends_on_pid = 1;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_SHVC:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 1;\n\t\t\t\telse es->depends_on_pid = 2;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_SHVC_TEMPORAL:\n\t\t\t\tes->depends_on_pid = 3;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_MHVC:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 1;\n\t\t\t\telse es->depends_on_pid = 2;\n\t\t\t\tbreak;\n\t\t\tcase GF_M2TS_VIDEO_MHVC_TEMPORAL:\n\t\t\t\tif (!nb_hevc_temp) es->depends_on_pid = 2;\n\t\t\t\telse es->depends_on_pid = 3;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (nb_es) {\n\t\tu32 i;\n\n\t\t//translate hierarchy descriptors indexes into PIDs - check whether the PMT-index rules are the same for HEVC\n\t\tfor (i=0; iprogram->streams); i++) {\n\t\t\tGF_M2TS_PES *an_es = NULL;\n\t\t\tGF_M2TS_PES *es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, i);\n\t\t\tif ( !(es->flags & GF_M2TS_ES_IS_PES)) continue;\n\t\t\tif (!es->depends_on_pid) continue;\n\n\t\t\t//fixeme we are not always assured that hierarchy_layer_index matches the stream index...\n\t\t\t//+1 is because our first stream is the PMT\n\t\t\tan_es = (GF_M2TS_PES *)gf_list_get(pmt->program->streams, es->depends_on_pid);\n\t\t\tif (an_es) {\n\t\t\t\tes->depends_on_pid = an_es->pid;\n\t\t\t} else {\n\t\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[M2TS] Wrong dependency index in hierarchy descriptor, assuming non-scalable stream\\n\"));\n\t\t\t\tes->depends_on_pid = 0;\n\t\t\t}\n\t\t}\n\n\t\tevt_type = (status&GF_M2TS_TABLE_FOUND) ? GF_M2TS_EVT_PMT_FOUND : GF_M2TS_EVT_PMT_UPDATE;\n\t\tif (ts->on_event) ts->on_event(ts, evt_type, pmt->program);\n\t} else {\n\t\t/* if we found no new ES it's simply a repeat of the PMT */\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PMT_REPEAT, pmt->program);\n\t}\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"gf_m2ts_process_pmt","file_name":"src/media_tools/mpegts.c","commit_link":"github.com/gpac/gpac/commit/2320eb73afba753b39b7147be91f7be7afc0eeb7","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#114-b8fcefc1e15c","input":"next_line(struct archive_read *a,\n const char **b, ssize_t *avail, ssize_t *ravail, ssize_t *nl)\n{\n\tssize_t len;\n\tint quit;\n\t\n\tquit = 0;\n\tif (*avail == 0) {\n\t\t*nl = 0;\n\t\tlen = 0;\n\t} else\n\t\tlen = get_line_size(*b, *avail, nl);\n\t/*\n\t * Read bytes more while it does not reach the end of line.\n\t */\n\twhile (*nl == 0 && len == *avail && !quit) {\n\t\tssize_t diff = *ravail - *avail;\n\t\tsize_t nbytes_req = (*ravail+1023) & ~1023U;\n\t\tssize_t tested;\n\n\t\t/* Increase reading bytes if it is not enough to at least\n\t\t * new two lines. */\n\t\tif (nbytes_req < (size_t)*ravail + 160)\n\t\t\tnbytes_req <<= 1;\n\n\t\t*b = __archive_read_ahead(a, nbytes_req, avail);\n\t\tif (*b == NULL) {\n\t\t\tif (*ravail >= *avail)\n\t\t\t\treturn (0);\n\t\t\t/* Reading bytes reaches the end of file. */\n\t\t\t*b = __archive_read_ahead(a, *avail, avail);\n\t\t\tquit = 1;\n\t\t}\n\t\t*ravail = *avail;\n\t\t*b += diff;\n\t\t*avail -= diff;\n\t\ttested = len;/* Skip some bytes we already determinated. */\n\t\tlen = get_line_size(*b, *avail, nl);\n\t\tif (len >= 0)\n\t\t\tlen += tested;\n\t}\n\treturn (len);\n}","target":"next_line(struct archive_read *a,\n const char **b, ssize_t *avail, ssize_t *ravail, ssize_t *nl)\n{\n\tssize_t len;\n\tint quit;\n\t\n\tquit = 0;\n\tif (*avail == 0) {\n\t\t*nl = 0;\n\t\tlen = 0;\n\t} else\n\t\tlen = get_line_size(*b, *avail, nl);\n\t/*\n\t * Read bytes more while it does not reach the end of line.\n\t */\n\twhile (*nl == 0 && len == *avail && !quit) {\n\t\tssize_t diff = *ravail - *avail;\n\t\tsize_t nbytes_req = (*ravail+1023) & ~1023U;\n\t\tssize_t tested;\n\n\t\t/* Increase reading bytes if it is not enough to at least\n\t\t * new two lines. */\n\t\tif (nbytes_req < (size_t)*ravail + 160)\n\t\t\tnbytes_req <<= 1;\n\n\t\t*b = __archive_read_ahead(a, nbytes_req, avail);\n\t\tif (*b == NULL) {\n\t\t\tif (*ravail >= *avail)\n\t\t\t\treturn (0);\n\t\t\t/* Reading bytes reaches the end of file. */\n\t\t\t*b = __archive_read_ahead(a, *avail, avail);\n\t\t\tquit = 1;\n\t\t}\n\t\t*ravail = *avail;\n\t\t*b += diff;\n\t\t*avail -= diff;\n\t\ttested = len;/* Skip some bytes we already determinated. */\n\t\tlen = get_line_size(*b + len, *avail - len, nl);\n\t\tif (len >= 0)\n\t\t\tlen += tested;\n\t}\n\treturn (len);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"next_line","file_name":"libarchive/archive_read_support_format_mtree.c","commit_link":"github.com/libarchive/libarchive/commit/eec077f52bfa2d3f7103b4b74d52572ba8a15aca","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#115-fbdc1c9cafc4","input":"x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)\n{\n\tunsigned int first = 0;\n\tunsigned int last = ARR_SIZE(insn_regs_intel) - 1;\n\tunsigned int mid = ARR_SIZE(insn_regs_intel) / 2;\n\n\tif (!intel_regs_sorted) {\n\t\tmemcpy(insn_regs_intel_sorted, insn_regs_intel,\n\t\t\t\tsizeof(insn_regs_intel_sorted));\n\t\tqsort(insn_regs_intel_sorted,\n\t\t\t\tARR_SIZE(insn_regs_intel_sorted),\n\t\t\t\tsizeof(struct insn_reg), regs_cmp);\n\t\tintel_regs_sorted = true;\n\t}\n\n\twhile (first <= last) {\n\t\tif (insn_regs_intel_sorted[mid].insn < id) {\n\t\t\tfirst = mid + 1;\n\t\t} else if (insn_regs_intel_sorted[mid].insn == id) {\n\t\t\tif (access) {\n\t\t\t\t*access = insn_regs_intel_sorted[mid].access;\n\t\t\t}\n\t\t\treturn insn_regs_intel_sorted[mid].reg;\n\t\t} else {\n\t\t\tif (mid == 0)\n\t\t\t\tbreak;\n\t\t\tlast = mid - 1;\n\t\t}\n\t\tmid = (first + last) / 2;\n\t}\n\n\t// not found\n\treturn 0;\n}","target":"x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)\n{\n\tstatic bool intel_regs_sorted = false;\n\tunsigned int first = 0;\n\tunsigned int last = ARR_SIZE(insn_regs_intel) - 1;\n\tunsigned int mid;\n\n\tif (!intel_regs_sorted) {\n\t\tmemcpy(insn_regs_intel_sorted, insn_regs_intel,\n\t\t\t\tsizeof(insn_regs_intel_sorted));\n\t\tqsort(insn_regs_intel_sorted,\n\t\t\t\tARR_SIZE(insn_regs_intel_sorted),\n\t\t\t\tsizeof(struct insn_reg), regs_cmp);\n\t\tintel_regs_sorted = true;\n\t}\n\n\tif (insn_regs_intel_sorted[0].insn > id ||\n\t\t\tinsn_regs_intel_sorted[last].insn < id) {\n\t\treturn 0;\n\t}\n\n\twhile (first <= last) {\n\t\tmid = (first + last) / 2;\n\t\tif (insn_regs_intel_sorted[mid].insn < id) {\n\t\t\tfirst = mid + 1;\n\t\t} else if (insn_regs_intel_sorted[mid].insn == id) {\n\t\t\tif (access) {\n\t\t\t\t*access = insn_regs_intel_sorted[mid].access;\n\t\t\t}\n\t\t\treturn insn_regs_intel_sorted[mid].reg;\n\t\t} else {\n\t\t\tif (mid == 0)\n\t\t\t\tbreak;\n\t\t\tlast = mid - 1;\n\t\t}\n\t}\n\n\t// not found\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"X86_insn_reg_intel","file_name":"arch/X86/X86Mapping.c","commit_link":"github.com/aquynh/capstone/commit/87a25bb543c8e4c09b48d4b4a6c7db31ce58df06","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#116-19a129d340d3","input":"R_API RBinJavaAttrInfo *r_bin_java_line_number_table_attr_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 curpos, offset = 0;\n\tRBinJavaLineNumberAttribute *lnattr;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\toffset += 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR;\n\tattr->info.line_number_table_attr.line_number_table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.line_number_table_attr.line_number_table = r_list_newf (free);\n\n\tut32 linenum_len = attr->info.line_number_table_attr.line_number_table_length;\n\tRList *linenum_list = attr->info.line_number_table_attr.line_number_table;\n\tif (linenum_len > sz) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tfor (i = 0; i < linenum_len; i++) {\n\t\tcurpos = buf_offset + offset;\n\t\t// printf (\"%llx %llx \\n\", curpos, sz);\n\t\t// XXX if (curpos + 8 >= sz) break;\n\t\tlnattr = R_NEW0 (RBinJavaLineNumberAttribute);\n\t\tif (!lnattr) {\n\t\t\tbreak;\n\t\t}\n\t\tlnattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->line_number = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->file_offset = curpos;\n\t\tlnattr->size = 4;\n\t\tr_list_append (linenum_list, lnattr);\n\t}\n\tattr->size = offset;\n\treturn attr;\n}","target":"R_API RBinJavaAttrInfo *r_bin_java_line_number_table_attr_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut32 i = 0;\n\tut64 curpos, offset = 0;\n\tRBinJavaLineNumberAttribute *lnattr;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\toffset += 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_LINE_NUMBER_TABLE_ATTR;\n\tattr->info.line_number_table_attr.line_number_table_length = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.line_number_table_attr.line_number_table = r_list_newf (free);\n\n\tut32 linenum_len = attr->info.line_number_table_attr.line_number_table_length;\n\tRList *linenum_list = attr->info.line_number_table_attr.line_number_table;\n\tif (linenum_len > sz) {\n\t\tfree (attr);\n\t\treturn NULL;\n\t}\n\tfor (i = 0; i < linenum_len; i++) {\n\t\tcurpos = buf_offset + offset;\n\t\t// printf (\"%llx %llx \\n\", curpos, sz);\n\t\t// XXX if (curpos + 8 >= sz) break;\n\t\tlnattr = R_NEW0 (RBinJavaLineNumberAttribute);\n\t\tif (!lnattr) {\n\t\t\tbreak;\n\t\t}\n\t\tif (offset + 8 >= sz) {\n\t\t\tbreak;\n\t\t}\n\t\tlnattr->start_pc = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->line_number = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tlnattr->file_offset = curpos;\n\t\tlnattr->size = 4;\n\t\tr_list_append (linenum_list, lnattr);\n\t}\n\tattr->size = offset;\n\treturn attr;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"r_bin_java_line_number_table_attr_new","file_name":"shlr/java/class.c","commit_link":"github.com/radare/radare2/commit/eb0fb72b3c5307ec8e33effb6bf947e38cfdffe8","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#117-67dbf19f3053","input":"static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)\n{\n MpegEncContext *s = &ctx->m;\n\n if (get_bits_left(gb) <= 32)\n return 0;\n\n s->partitioned_frame = 0;\n s->decode_mb = mpeg4_decode_studio_mb;\n\n decode_smpte_tc(ctx, gb);\n\n skip_bits(gb, 10); /* temporal_reference */\n skip_bits(gb, 2); /* vop_structure */\n s->pict_type = get_bits(gb, 2) + AV_PICTURE_TYPE_I; /* vop_coding_type */\n if (get_bits1(gb)) { /* vop_coded */\n skip_bits1(gb); /* top_field_first */\n skip_bits1(gb); /* repeat_first_field */\n s->progressive_frame = get_bits1(gb) ^ 1; /* progressive_frame */\n }\n\n if (s->pict_type == AV_PICTURE_TYPE_I) {\n if (get_bits1(gb))\n reset_studio_dc_predictors(s);\n }\n\n if (ctx->shape != BIN_ONLY_SHAPE) {\n s->alternate_scan = get_bits1(gb);\n s->frame_pred_frame_dct = get_bits1(gb);\n s->dct_precision = get_bits(gb, 2);\n s->intra_dc_precision = get_bits(gb, 2);\n s->q_scale_type = get_bits1(gb);\n }\n\n if (s->alternate_scan) {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n } else {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n }\n\n mpeg4_load_default_matrices(s);\n\n next_start_code_studio(gb);\n extension_and_user_data(s, gb, 4);\n\n return 0;\n}","target":"static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)\n{\n MpegEncContext *s = &ctx->m;\n\n if (get_bits_left(gb) <= 32)\n return 0;\n\n s->partitioned_frame = 0;\n s->interlaced_dct = 0;\n s->decode_mb = mpeg4_decode_studio_mb;\n\n decode_smpte_tc(ctx, gb);\n\n skip_bits(gb, 10); /* temporal_reference */\n skip_bits(gb, 2); /* vop_structure */\n s->pict_type = get_bits(gb, 2) + AV_PICTURE_TYPE_I; /* vop_coding_type */\n if (get_bits1(gb)) { /* vop_coded */\n skip_bits1(gb); /* top_field_first */\n skip_bits1(gb); /* repeat_first_field */\n s->progressive_frame = get_bits1(gb) ^ 1; /* progressive_frame */\n }\n\n if (s->pict_type == AV_PICTURE_TYPE_I) {\n if (get_bits1(gb))\n reset_studio_dc_predictors(s);\n }\n\n if (ctx->shape != BIN_ONLY_SHAPE) {\n s->alternate_scan = get_bits1(gb);\n s->frame_pred_frame_dct = get_bits1(gb);\n s->dct_precision = get_bits(gb, 2);\n s->intra_dc_precision = get_bits(gb, 2);\n s->q_scale_type = get_bits1(gb);\n }\n\n if (s->alternate_scan) {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n } else {\n ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);\n ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);\n }\n\n mpeg4_load_default_matrices(s);\n\n next_start_code_studio(gb);\n extension_and_user_data(s, gb, 4);\n\n return 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"decode_studio_vop_header","file_name":"libavcodec/mpeg4videodec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/1f686d023b95219db933394a7704ad9aa5f01cbb","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#118-1da1e3da1a95","input":"str_lower_case_match(OnigEncoding enc, int case_fold_flag,\n const UChar* t, const UChar* tend,\n const UChar* p, const UChar* end)\n{\n int lowlen;\n UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n while (t < tend) {\n lowlen = ONIGENC_MBC_CASE_FOLD(enc, case_fold_flag, &p, end, lowbuf);\n q = lowbuf;\n while (lowlen > 0) {\n if (*t++ != *q++) return 0;\n lowlen--;\n }\n }\n\n return 1;\n}","target":"str_lower_case_match(OnigEncoding enc, int case_fold_flag,\n const UChar* t, const UChar* tend,\n const UChar* p, const UChar* end)\n{\n int lowlen;\n UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN];\n\n while (t < tend) {\n lowlen = ONIGENC_MBC_CASE_FOLD(enc, case_fold_flag, &p, end, lowbuf);\n q = lowbuf;\n while (lowlen > 0) {\n if (t >= tend) return 0;\n if (*t++ != *q++) return 0;\n lowlen--;\n }\n }\n\n return 1;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"str_lower_case_match","file_name":"src/regexec.c","commit_link":"github.com/kkos/oniguruma/commit/d3e402928b6eb3327f8f7d59a9edfa622fec557b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#119-be4fdb641998","input":" bool handleBackslash(signed char& out) {\n char ch = *p++;\n switch (ch) {\n case 0: return false;\n case '\"': out = ch; return true;\n case '\\\\': out = ch; return true;\n case '/': out = ch; return true;\n case 'b': out = '\\b'; return true;\n case 'f': out = '\\f'; return true;\n case 'n': out = '\\n'; return true;\n case 'r': out = '\\r'; return true;\n case 't': out = '\\t'; return true;\n case 'u': {\n if (UNLIKELY(is_tsimplejson)) {\n auto const ch1 = *p++;\n auto const ch2 = *p++;\n auto const dch3 = dehexchar(*p++);\n auto const dch4 = dehexchar(*p++);\n if (UNLIKELY(ch1 != '0' || ch2 != '0' || dch3 < 0 || dch4 < 0)) {\n return false;\n }\n out = (dch3 << 4) | dch4;\n return true;\n } else {\n uint16_t u16cp = 0;\n for (int i = 0; i < 4; i++) {\n auto const hexv = dehexchar(*p++);\n if (hexv < 0) return false; // includes check for end of string\n u16cp <<= 4;\n u16cp |= hexv;\n }\n if (u16cp > 0x7f) {\n return false;\n } else {\n out = u16cp;\n return true;\n }\n }\n }\n default: return false;\n }\n }","target":" bool handleBackslash(signed char& out) {\n char ch = *p++;\n switch (ch) {\n case 0: return false;\n case '\"': out = ch; return true;\n case '\\\\': out = ch; return true;\n case '/': out = ch; return true;\n case 'b': out = '\\b'; return true;\n case 'f': out = '\\f'; return true;\n case 'n': out = '\\n'; return true;\n case 'r': out = '\\r'; return true;\n case 't': out = '\\t'; return true;\n case 'u': {\n if (UNLIKELY(is_tsimplejson)) {\n auto const ch1 = *p++;\n if (UNLIKELY(ch1 != '0')) return false;\n auto const ch2 = *p++;\n if (UNLIKELY(ch2 != '0')) return false;\n auto const dch3 = dehexchar(*p++);\n if (UNLIKELY(dch3 < 0)) return false;\n auto const dch4 = dehexchar(*p++);\n if (UNLIKELY(dch4 < 0)) return false;\n out = (dch3 << 4) | dch4;\n return true;\n } else {\n uint16_t u16cp = 0;\n for (int i = 0; i < 4; i++) {\n auto const hexv = dehexchar(*p++);\n if (hexv < 0) return false; // includes check for end of string\n u16cp <<= 4;\n u16cp |= hexv;\n }\n if (u16cp > 0x7f) {\n return false;\n } else {\n out = u16cp;\n return true;\n }\n }\n }\n default: return false;\n }\n }","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"HPHP::SimpleParser::handleBackslash","file_name":"hphp/runtime/ext/json/JSON_parser.cpp","commit_link":"github.com/facebook/hhvm/commit/b3679121bb3c7017ff04b4c08402ffff5cf59b13","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#120-c9b958b6c6de","input":"static OPCODE_DESC* avr_op_analyze(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, CPU_MODEL *cpu) {\n\tOPCODE_DESC *opcode_desc;\n\tut16 ins = (buf[1] << 8) | buf[0];\n\tint fail;\n\tchar *t;\n\n\t// initialize op struct\n\tmemset (op, 0, sizeof (RAnalOp));\n\top->ptr = UT64_MAX;\n\top->val = UT64_MAX;\n\top->jump = UT64_MAX;\n\tr_strbuf_init (&op->esil);\n\n\t// process opcode\n\tfor (opcode_desc = opcodes; opcode_desc->handler; opcode_desc++) {\n\t\tif ((ins & opcode_desc->mask) == opcode_desc->selector) {\n\t\t\tfail = 0;\n\n\t\t\t// copy default cycles/size values\n\t\t\top->cycles = opcode_desc->cycles;\n\t\t\top->size = opcode_desc->size;\n\t\t\top->type = opcode_desc->type;\n\t\t\top->jump = UT64_MAX;\n\t\t\top->fail = UT64_MAX;\n\t\t\t// op->fail = addr + op->size;\n\t\t\top->addr = addr;\n\n\t\t\t// start void esil expression\n\t\t\tr_strbuf_setf (&op->esil, \"\");\n\n\t\t\t// handle opcode\n\t\t\topcode_desc->handler (anal, op, buf, len, &fail, cpu);\n\t\t\tif (fail) {\n\t\t\t\tgoto INVALID_OP;\n\t\t\t}\n\t\t\tif (op->cycles <= 0) {\n\t\t\t\t// eprintf (\"opcode %s @%\"PFMT64x\" returned 0 cycles.\\n\", opcode_desc->name, op->addr);\n\t\t\t\topcode_desc->cycles = 2;\n\t\t\t}\n\t\t\top->nopcode = (op->type == R_ANAL_OP_TYPE_UNK);\n\n\t\t\t// remove trailing coma (COMETE LA COMA)\n\t\t\tt = r_strbuf_get (&op->esil);\n\t\t\tif (t && strlen (t) > 1) {\n\t\t\t\tt += strlen (t) - 1;\n\t\t\t\tif (*t == ',') {\n\t\t\t\t\t*t = '\\0';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn opcode_desc;\n\t\t}\n\t}\n\n\t// ignore reserved opcodes (if they have not been caught by the previous loop)\n\tif ((ins & 0xff00) == 0xff00 && (ins & 0xf) > 7) {\n\t\tgoto INVALID_OP;\n\t}\n\nINVALID_OP:\n\t// An unknown or invalid option has appeared.\n\t// -- Throw pokeball!\n\top->family = R_ANAL_OP_FAMILY_UNKNOWN;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->addr = addr;\n\top->fail = UT64_MAX;\n\top->jump = UT64_MAX;\n\top->ptr = UT64_MAX;\n\top->val = UT64_MAX;\n\top->nopcode = 1;\n\top->cycles = 1;\n\top->size = 2;\n\t// launch esil trap (for communicating upper layers about this weird\n\t// and stinky situation\n\tr_strbuf_set (&op->esil, \"1,$\");\n\n\treturn NULL;\n}","target":"static OPCODE_DESC* avr_op_analyze(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len, CPU_MODEL *cpu) {\n\tOPCODE_DESC *opcode_desc;\n\tif (len < 2) {\n\t\treturn NULL;\n\t}\n\tut16 ins = (buf[1] << 8) | buf[0];\n\tint fail;\n\tchar *t;\n\n\t// initialize op struct\n\tmemset (op, 0, sizeof (RAnalOp));\n\top->ptr = UT64_MAX;\n\top->val = UT64_MAX;\n\top->jump = UT64_MAX;\n\tr_strbuf_init (&op->esil);\n\n\t// process opcode\n\tfor (opcode_desc = opcodes; opcode_desc->handler; opcode_desc++) {\n\t\tif ((ins & opcode_desc->mask) == opcode_desc->selector) {\n\t\t\tfail = 0;\n\n\t\t\t// copy default cycles/size values\n\t\t\top->cycles = opcode_desc->cycles;\n\t\t\top->size = opcode_desc->size;\n\t\t\top->type = opcode_desc->type;\n\t\t\top->jump = UT64_MAX;\n\t\t\top->fail = UT64_MAX;\n\t\t\t// op->fail = addr + op->size;\n\t\t\top->addr = addr;\n\n\t\t\t// start void esil expression\n\t\t\tr_strbuf_setf (&op->esil, \"\");\n\n\t\t\t// handle opcode\n\t\t\topcode_desc->handler (anal, op, buf, len, &fail, cpu);\n\t\t\tif (fail) {\n\t\t\t\tgoto INVALID_OP;\n\t\t\t}\n\t\t\tif (op->cycles <= 0) {\n\t\t\t\t// eprintf (\"opcode %s @%\"PFMT64x\" returned 0 cycles.\\n\", opcode_desc->name, op->addr);\n\t\t\t\topcode_desc->cycles = 2;\n\t\t\t}\n\t\t\top->nopcode = (op->type == R_ANAL_OP_TYPE_UNK);\n\n\t\t\t// remove trailing coma (COMETE LA COMA)\n\t\t\tt = r_strbuf_get (&op->esil);\n\t\t\tif (t && strlen (t) > 1) {\n\t\t\t\tt += strlen (t) - 1;\n\t\t\t\tif (*t == ',') {\n\t\t\t\t\t*t = '\\0';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn opcode_desc;\n\t\t}\n\t}\n\n\t// ignore reserved opcodes (if they have not been caught by the previous loop)\n\tif ((ins & 0xff00) == 0xff00 && (ins & 0xf) > 7) {\n\t\tgoto INVALID_OP;\n\t}\n\nINVALID_OP:\n\t// An unknown or invalid option has appeared.\n\t// -- Throw pokeball!\n\top->family = R_ANAL_OP_FAMILY_UNKNOWN;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->addr = addr;\n\top->fail = UT64_MAX;\n\top->jump = UT64_MAX;\n\top->ptr = UT64_MAX;\n\top->val = UT64_MAX;\n\top->nopcode = 1;\n\top->cycles = 1;\n\top->size = 2;\n\t// launch esil trap (for communicating upper layers about this weird\n\t// and stinky situation\n\tr_strbuf_set (&op->esil, \"1,$\");\n\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"avr_op_analyze","file_name":"libr/anal/p/anal_avr.c","commit_link":"github.com/radare/radare2/commit/b35530fa0681b27eba084de5527037ebfb397422","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#121-30f32dd44c31","input":"static int uas_switch_interface(struct usb_device *udev,\n\t\t\t\tstruct usb_interface *intf)\n{\n\tint alt;\n\n\talt = uas_find_uas_alt_setting(intf);\n\tif (alt < 0)\n\t\treturn alt;\n\n\treturn usb_set_interface(udev,\n\t\t\tintf->altsetting[0].desc.bInterfaceNumber, alt);\n}","target":"static int uas_switch_interface(struct usb_device *udev,\n\t\t\t\tstruct usb_interface *intf)\n{\n\tstruct usb_host_interface *alt;\n\n\talt = uas_find_uas_alt_setting(intf);\n\tif (!alt)\n\t\treturn -ENODEV;\n\n\treturn usb_set_interface(udev, alt->desc.bInterfaceNumber,\n\t\t\talt->desc.bAlternateSetting);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"uas_switch_interface","file_name":"drivers/usb/storage/uas.c","commit_link":"github.com/torvalds/linux/commit/786de92b3cb26012d3d0f00ee37adf14527f35c4","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#122-16ac52020ab4","input":"static int sh_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tut8 op_MSB,op_LSB;\n\tint ret;\n\tif (!data)\n\t\treturn 0;\n\tmemset (op, '\\0', sizeof (RAnalOp));\n\top->addr = addr;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->jump = op->fail = -1;\n\top->ptr = op->val = -1;\n\n\top->size = 2;\n\n\top_MSB = anal->big_endian? data[0]: data[1];\n\top_LSB = anal->big_endian? data[1]: data[0];\n\tret = first_nibble_decode[(op_MSB>>4) & 0x0F](anal, op, (ut16)(op_MSB<<8 | op_LSB));\n\treturn ret;\n}","target":"static int sh_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {\n\tut8 op_MSB,op_LSB;\n\tint ret;\n\tif (!data || len < 2) {\n\t\treturn 0;\n\t}\n\tmemset (op, '\\0', sizeof (RAnalOp));\n\top->addr = addr;\n\top->type = R_ANAL_OP_TYPE_UNK;\n\top->jump = op->fail = -1;\n\top->ptr = op->val = -1;\n\n\top->size = 2;\n\n\top_MSB = anal->big_endian? data[0]: data[1];\n\top_LSB = anal->big_endian? data[1]: data[0];\n\tret = first_nibble_decode[(op_MSB>>4) & 0x0F](anal, op, (ut16)(op_MSB<<8 | op_LSB));\n\treturn ret;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"sh_op","file_name":"libr/anal/p/anal_sh.c","commit_link":"github.com/radare/radare2/commit/77c47cf873dd55b396da60baa2ca83bbd39e4add","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#123-8dcf59aad1d0","input":"static MagickBooleanType ReadPSDChannelPixels(Image *image,\n const size_t channels,const size_t row,const ssize_t type,\n const unsigned char *pixels,ExceptionInfo *exception)\n{\n Quantum\n pixel;\n\n register const unsigned char\n *p;\n\n register Quantum\n *q;\n\n register ssize_t\n x;\n\n size_t\n packet_size;\n\n unsigned short\n nibble;\n\n p=pixels;\n q=GetAuthenticPixels(image,0,row,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n return MagickFalse;\n packet_size=GetPSDPacketSize(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (packet_size == 1)\n pixel=ScaleCharToQuantum(*p++);\n else\n {\n p=PushShortPixel(MSBEndian,p,&nibble);\n pixel=ScaleShortToQuantum(nibble);\n }\n switch (type)\n {\n case -1:\n {\n SetPixelAlpha(image,pixel,q);\n break;\n }\n case -2:\n case 0:\n {\n SetPixelRed(image,pixel,q);\n if (channels == 1 || type == -2)\n SetPixelGray(image,pixel,q);\n if (image->storage_class == PseudoClass)\n {\n if (packet_size == 1)\n SetPixelIndex(image,ScaleQuantumToChar(pixel),q);\n else\n SetPixelIndex(image,ScaleQuantumToShort(pixel),q);\n SetPixelViaPixelInfo(image,image->colormap+(ssize_t)\n ConstrainColormapIndex(image,GetPixelIndex(image,q),exception),q);\n if (image->depth == 1)\n {\n ssize_t\n bit,\n number_bits;\n \n number_bits=image->columns-x;\n if (number_bits > 8)\n number_bits=8;\n for (bit=0; bit < number_bits; bit++)\n {\n SetPixelIndex(image,(((unsigned char) pixel) &\n (0x01 << (7-bit))) != 0 ? 0 : 255,q);\n SetPixelViaPixelInfo(image,image->colormap+(ssize_t)\n GetPixelIndex(image,q),q);\n q+=GetPixelChannels(image);\n x++;\n }\n x--;\n continue;\n }\n }\n break;\n }\n case 1:\n {\n if (image->storage_class == PseudoClass)\n SetPixelAlpha(image,pixel,q);\n else\n SetPixelGreen(image,pixel,q);\n break;\n }\n case 2:\n {\n if (image->storage_class == PseudoClass)\n SetPixelAlpha(image,pixel,q);\n else\n SetPixelBlue(image,pixel,q);\n break;\n }\n case 3:\n {\n if (image->colorspace == CMYKColorspace)\n SetPixelBlack(image,pixel,q);\n else\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,pixel,q);\n break;\n }\n case 4:\n {\n if ((IssRGBCompatibleColorspace(image->colorspace) != MagickFalse) &&\n (channels > 3))\n break;\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,pixel,q);\n break;\n }\n default:\n break;\n }\n q+=GetPixelChannels(image);\n }\n return(SyncAuthenticPixels(image,exception));\n}","target":"static MagickBooleanType ReadPSDChannelPixels(Image *image,\n const size_t channels,const size_t row,const ssize_t type,\n const unsigned char *pixels,ExceptionInfo *exception)\n{\n Quantum\n pixel;\n\n register const unsigned char\n *p;\n\n register Quantum\n *q;\n\n register ssize_t\n x;\n\n size_t\n packet_size;\n\n unsigned short\n nibble;\n\n p=pixels;\n q=GetAuthenticPixels(image,0,row,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n return MagickFalse;\n packet_size=GetPSDPacketSize(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (packet_size == 1)\n pixel=ScaleCharToQuantum(*p++);\n else\n {\n p=PushShortPixel(MSBEndian,p,&nibble);\n pixel=ScaleShortToQuantum(nibble);\n }\n switch (type)\n {\n case -1:\n {\n SetPixelAlpha(image,pixel,q);\n break;\n }\n case -2:\n case 0:\n {\n SetPixelRed(image,pixel,q);\n if (channels == 1 || type == -2)\n SetPixelGray(image,pixel,q);\n if (image->storage_class == PseudoClass)\n {\n if (packet_size == 1)\n SetPixelIndex(image,ScaleQuantumToChar(pixel),q);\n else\n SetPixelIndex(image,ScaleQuantumToShort(pixel),q);\n SetPixelViaPixelInfo(image,image->colormap+(ssize_t)\n ConstrainColormapIndex(image,GetPixelIndex(image,q),exception),q);\n if (image->depth == 1)\n {\n ssize_t\n bit,\n number_bits;\n \n number_bits=image->columns-x;\n if (number_bits > 8)\n number_bits=8;\n for (bit=0; bit < number_bits; bit++)\n {\n SetPixelIndex(image,(((unsigned char) pixel) &\n (0x01 << (7-bit))) != 0 ? 0 : 255,q);\n SetPixelViaPixelInfo(image,image->colormap+(ssize_t)\n ConstrainColormapIndex(image,GetPixelIndex(image,q),\n exception),q);\n q+=GetPixelChannels(image);\n x++;\n }\n x--;\n continue;\n }\n }\n break;\n }\n case 1:\n {\n if (image->storage_class == PseudoClass)\n SetPixelAlpha(image,pixel,q);\n else\n SetPixelGreen(image,pixel,q);\n break;\n }\n case 2:\n {\n if (image->storage_class == PseudoClass)\n SetPixelAlpha(image,pixel,q);\n else\n SetPixelBlue(image,pixel,q);\n break;\n }\n case 3:\n {\n if (image->colorspace == CMYKColorspace)\n SetPixelBlack(image,pixel,q);\n else\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,pixel,q);\n break;\n }\n case 4:\n {\n if ((IssRGBCompatibleColorspace(image->colorspace) != MagickFalse) &&\n (channels > 3))\n break;\n if (image->alpha_trait != UndefinedPixelTrait)\n SetPixelAlpha(image,pixel,q);\n break;\n }\n default:\n break;\n }\n q+=GetPixelChannels(image);\n }\n return(SyncAuthenticPixels(image,exception));\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ReadPSDChannelPixels","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/e14fd0a2801f73bdc123baf4fbab97dec55919eb","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#124-e4786a824bbc","input":"static int ape_decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame_ptr, AVPacket *avpkt)\n{\n AVFrame *frame = data;\n const uint8_t *buf = avpkt->data;\n APEContext *s = avctx->priv_data;\n uint8_t *sample8;\n int16_t *sample16;\n int32_t *sample24;\n int i, ch, ret;\n int blockstodecode;\n\n /* this should never be negative, but bad things will happen if it is, so\n check it just to make sure. */\n av_assert0(s->samples >= 0);\n\n if(!s->samples){\n uint32_t nblocks, offset;\n int buf_size;\n\n if (!avpkt->size) {\n *got_frame_ptr = 0;\n return 0;\n }\n if (avpkt->size < 8) {\n av_log(avctx, AV_LOG_ERROR, \"Packet is too small\\n\");\n return AVERROR_INVALIDDATA;\n }\n buf_size = avpkt->size & ~3;\n if (buf_size != avpkt->size) {\n av_log(avctx, AV_LOG_WARNING, \"packet size is not a multiple of 4. \"\n \"extra bytes at the end will be skipped.\\n\");\n }\n if (s->fileversion < 3950) // previous versions overread two bytes\n buf_size += 2;\n av_fast_padded_malloc(&s->data, &s->data_size, buf_size);\n if (!s->data)\n return AVERROR(ENOMEM);\n s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf,\n buf_size >> 2);\n memset(s->data + (buf_size & ~3), 0, buf_size & 3);\n s->ptr = s->data;\n s->data_end = s->data + buf_size;\n\n nblocks = bytestream_get_be32(&s->ptr);\n offset = bytestream_get_be32(&s->ptr);\n if (s->fileversion >= 3900) {\n if (offset > 3) {\n av_log(avctx, AV_LOG_ERROR, \"Incorrect offset passed\\n\");\n s->data = NULL;\n return AVERROR_INVALIDDATA;\n }\n if (s->data_end - s->ptr < offset) {\n av_log(avctx, AV_LOG_ERROR, \"Packet is too small\\n\");\n return AVERROR_INVALIDDATA;\n }\n s->ptr += offset;\n } else {\n if ((ret = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0)\n return ret;\n if (s->fileversion > 3800)\n skip_bits_long(&s->gb, offset * 8);\n else\n skip_bits_long(&s->gb, offset);\n }\n\n if (!nblocks || nblocks > INT_MAX) {\n av_log(avctx, AV_LOG_ERROR, \"Invalid sample count: %\"PRIu32\".\\n\",\n nblocks);\n return AVERROR_INVALIDDATA;\n }\n\n /* Initialize the frame decoder */\n if (init_frame_decoder(s) < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Error reading frame header\\n\");\n return AVERROR_INVALIDDATA;\n }\n s->samples = nblocks;\n }\n\n if (!s->data) {\n *got_frame_ptr = 0;\n return avpkt->size;\n }\n\n blockstodecode = FFMIN(s->blocks_per_loop, s->samples);\n // for old files coefficients were not interleaved,\n // so we need to decode all of them at once\n if (s->fileversion < 3930)\n blockstodecode = s->samples;\n\n /* reallocate decoded sample buffer if needed */\n av_fast_malloc(&s->decoded_buffer, &s->decoded_size,\n 2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer));\n if (!s->decoded_buffer)\n return AVERROR(ENOMEM);\n memset(s->decoded_buffer, 0, s->decoded_size);\n s->decoded[0] = s->decoded_buffer;\n s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8);\n\n /* get output buffer */\n frame->nb_samples = blockstodecode;\n if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)\n return ret;\n\n s->error=0;\n\n if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO))\n ape_unpack_mono(s, blockstodecode);\n else\n ape_unpack_stereo(s, blockstodecode);\n emms_c();\n\n if (s->error) {\n s->samples=0;\n av_log(avctx, AV_LOG_ERROR, \"Error decoding frame\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n switch (s->bps) {\n case 8:\n for (ch = 0; ch < s->channels; ch++) {\n sample8 = (uint8_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff;\n }\n break;\n case 16:\n for (ch = 0; ch < s->channels; ch++) {\n sample16 = (int16_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample16++ = s->decoded[ch][i];\n }\n break;\n case 24:\n for (ch = 0; ch < s->channels; ch++) {\n sample24 = (int32_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample24++ = s->decoded[ch][i] << 8;\n }\n break;\n }\n\n s->samples -= blockstodecode;\n\n *got_frame_ptr = 1;\n\n return !s->samples ? avpkt->size : 0;\n}","target":"static int ape_decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame_ptr, AVPacket *avpkt)\n{\n AVFrame *frame = data;\n const uint8_t *buf = avpkt->data;\n APEContext *s = avctx->priv_data;\n uint8_t *sample8;\n int16_t *sample16;\n int32_t *sample24;\n int i, ch, ret;\n int blockstodecode;\n uint64_t decoded_buffer_size;\n\n /* this should never be negative, but bad things will happen if it is, so\n check it just to make sure. */\n av_assert0(s->samples >= 0);\n\n if(!s->samples){\n uint32_t nblocks, offset;\n int buf_size;\n\n if (!avpkt->size) {\n *got_frame_ptr = 0;\n return 0;\n }\n if (avpkt->size < 8) {\n av_log(avctx, AV_LOG_ERROR, \"Packet is too small\\n\");\n return AVERROR_INVALIDDATA;\n }\n buf_size = avpkt->size & ~3;\n if (buf_size != avpkt->size) {\n av_log(avctx, AV_LOG_WARNING, \"packet size is not a multiple of 4. \"\n \"extra bytes at the end will be skipped.\\n\");\n }\n if (s->fileversion < 3950) // previous versions overread two bytes\n buf_size += 2;\n av_fast_padded_malloc(&s->data, &s->data_size, buf_size);\n if (!s->data)\n return AVERROR(ENOMEM);\n s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf,\n buf_size >> 2);\n memset(s->data + (buf_size & ~3), 0, buf_size & 3);\n s->ptr = s->data;\n s->data_end = s->data + buf_size;\n\n nblocks = bytestream_get_be32(&s->ptr);\n offset = bytestream_get_be32(&s->ptr);\n if (s->fileversion >= 3900) {\n if (offset > 3) {\n av_log(avctx, AV_LOG_ERROR, \"Incorrect offset passed\\n\");\n s->data = NULL;\n return AVERROR_INVALIDDATA;\n }\n if (s->data_end - s->ptr < offset) {\n av_log(avctx, AV_LOG_ERROR, \"Packet is too small\\n\");\n return AVERROR_INVALIDDATA;\n }\n s->ptr += offset;\n } else {\n if ((ret = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0)\n return ret;\n if (s->fileversion > 3800)\n skip_bits_long(&s->gb, offset * 8);\n else\n skip_bits_long(&s->gb, offset);\n }\n\n if (!nblocks || nblocks > INT_MAX / 2 / sizeof(*s->decoded_buffer) - 8) {\n av_log(avctx, AV_LOG_ERROR, \"Invalid sample count: %\"PRIu32\".\\n\",\n nblocks);\n return AVERROR_INVALIDDATA;\n }\n\n /* Initialize the frame decoder */\n if (init_frame_decoder(s) < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Error reading frame header\\n\");\n return AVERROR_INVALIDDATA;\n }\n s->samples = nblocks;\n }\n\n if (!s->data) {\n *got_frame_ptr = 0;\n return avpkt->size;\n }\n\n blockstodecode = FFMIN(s->blocks_per_loop, s->samples);\n // for old files coefficients were not interleaved,\n // so we need to decode all of them at once\n if (s->fileversion < 3930)\n blockstodecode = s->samples;\n\n /* reallocate decoded sample buffer if needed */\n decoded_buffer_size = 2LL * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer);\n av_assert0(decoded_buffer_size <= INT_MAX);\n av_fast_malloc(&s->decoded_buffer, &s->decoded_size, decoded_buffer_size);\n if (!s->decoded_buffer)\n return AVERROR(ENOMEM);\n memset(s->decoded_buffer, 0, s->decoded_size);\n s->decoded[0] = s->decoded_buffer;\n s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8);\n\n /* get output buffer */\n frame->nb_samples = blockstodecode;\n if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)\n return ret;\n\n s->error=0;\n\n if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO))\n ape_unpack_mono(s, blockstodecode);\n else\n ape_unpack_stereo(s, blockstodecode);\n emms_c();\n\n if (s->error) {\n s->samples=0;\n av_log(avctx, AV_LOG_ERROR, \"Error decoding frame\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n switch (s->bps) {\n case 8:\n for (ch = 0; ch < s->channels; ch++) {\n sample8 = (uint8_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff;\n }\n break;\n case 16:\n for (ch = 0; ch < s->channels; ch++) {\n sample16 = (int16_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample16++ = s->decoded[ch][i];\n }\n break;\n case 24:\n for (ch = 0; ch < s->channels; ch++) {\n sample24 = (int32_t *)frame->data[ch];\n for (i = 0; i < blockstodecode; i++)\n *sample24++ = s->decoded[ch][i] << 8;\n }\n break;\n }\n\n s->samples -= blockstodecode;\n\n *got_frame_ptr = 1;\n\n return !s->samples ? avpkt->size : 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"ape_decode_frame","file_name":"libavcodec/apedec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/ba4beaf6149f7241c8bd85fe853318c2f6837ad0","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#125-c598b0848e91","input":"static MagickBooleanType WriteImageChannels(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n const MagickBooleanType separate,ExceptionInfo *exception)\n{\n size_t\n channels,\n packet_size;\n\n unsigned char\n *compact_pixels;\n\n /*\n Write uncompressed pixels as separate planes.\n */\n channels=1;\n packet_size=next_image->depth > 8UL ? 2UL : 1UL;\n compact_pixels=(unsigned char *) NULL;\n if (next_image->compression == RLECompression)\n {\n compact_pixels=(unsigned char *) AcquireQuantumMemory(2*channels*\n next_image->columns,packet_size*sizeof(*compact_pixels));\n if (compact_pixels == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n if (IsImageGray(next_image) != MagickFalse)\n {\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,GrayQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n GrayQuantum,MagickTrue,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,0,1);\n }\n else\n if (next_image->storage_class == PseudoClass)\n {\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,IndexQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n IndexQuantum,MagickTrue,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,0,1);\n }\n else\n {\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateCMYK(next_image,exception);\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,RedQuantum,exception);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,GreenQuantum,exception);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,BlueQuantum,exception);\n if (next_image->colorspace == CMYKColorspace)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,BlackQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n (void) SetImageProgress(image,SaveImagesTag,0,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n RedQuantum,MagickTrue,exception);\n (void) SetImageProgress(image,SaveImagesTag,1,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n GreenQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,2,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n BlueQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,3,6);\n if (next_image->colorspace == CMYKColorspace)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n BlackQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,4,6);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,5,6);\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateCMYK(next_image,exception);\n }\n if (next_image->compression == RLECompression)\n compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);\n return(MagickTrue);\n}","target":"static MagickBooleanType WriteImageChannels(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n const MagickBooleanType separate,ExceptionInfo *exception)\n{\n size_t\n channels,\n packet_size;\n\n unsigned char\n *compact_pixels;\n\n /*\n Write uncompressed pixels as separate planes.\n */\n channels=1;\n packet_size=next_image->depth > 8UL ? 2UL : 1UL;\n compact_pixels=(unsigned char *) NULL;\n if (next_image->compression == RLECompression)\n {\n compact_pixels=(unsigned char *) AcquireQuantumMemory((2*channels*\n next_image->columns)+1,packet_size*sizeof(*compact_pixels));\n if (compact_pixels == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n if (IsImageGray(next_image) != MagickFalse)\n {\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,GrayQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n GrayQuantum,MagickTrue,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,0,1);\n }\n else\n if (next_image->storage_class == PseudoClass)\n {\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,IndexQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n IndexQuantum,MagickTrue,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,0,1);\n }\n else\n {\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateCMYK(next_image,exception);\n if (next_image->compression == RLECompression)\n {\n /*\n Packbits compression.\n */\n (void) WriteBlobMSBShort(image,1);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,RedQuantum,exception);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,GreenQuantum,exception);\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,BlueQuantum,exception);\n if (next_image->colorspace == CMYKColorspace)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,BlackQuantum,exception);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WritePackbitsLength(psd_info,image_info,image,next_image,\n compact_pixels,AlphaQuantum,exception);\n }\n (void) SetImageProgress(image,SaveImagesTag,0,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n RedQuantum,MagickTrue,exception);\n (void) SetImageProgress(image,SaveImagesTag,1,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n GreenQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,2,6);\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n BlueQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,3,6);\n if (next_image->colorspace == CMYKColorspace)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n BlackQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,4,6);\n if (next_image->alpha_trait != UndefinedPixelTrait)\n WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels,\n AlphaQuantum,separate,exception);\n (void) SetImageProgress(image,SaveImagesTag,5,6);\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateCMYK(next_image,exception);\n }\n if (next_image->compression == RLECompression)\n compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"WriteImageChannels","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/6f1879d498bcc5cce12fe0c5decb8dbc0f608e5d","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#126-8f5d075e069e","input":"int string_rfind(const char *input, int len, const char *s, int s_len,\n int pos, bool case_sensitive) {\n assertx(input);\n assertx(s);\n if (!s_len || pos < -len || pos > len) {\n return -1;\n }\n void *ptr;\n if (case_sensitive) {\n if (pos >= 0) {\n ptr = bstrrstr(input + pos, len - pos, s, s_len);\n } else {\n ptr = bstrrstr(input, len + pos + s_len, s, s_len);\n }\n } else {\n if (pos >= 0) {\n ptr = bstrrcasestr(input + pos, len - pos, s, s_len);\n } else {\n ptr = bstrrcasestr(input, len + pos + s_len, s, s_len);\n }\n }\n if (ptr != nullptr) {\n return (int)((const char *)ptr - input);\n }\n return -1;\n}","target":"int string_rfind(const char *input, int len, const char *s, int s_len,\n int pos, bool case_sensitive) {\n assertx(input);\n assertx(s);\n if (!s_len || pos < -len || pos > len) {\n return -1;\n }\n void *ptr;\n if (case_sensitive) {\n if (pos >= 0) {\n ptr = bstrrstr(input + pos, len - pos, s, s_len);\n } else {\n ptr = bstrrstr(input, len + std::min(pos + s_len, 0), s, s_len);\n }\n } else {\n if (pos >= 0) {\n ptr = bstrrcasestr(input + pos, len - pos, s, s_len);\n } else {\n ptr = bstrrcasestr(input, len + std::min(pos + s_len, 0), s, s_len);\n }\n }\n if (ptr != nullptr) {\n return (int)((const char *)ptr - input);\n }\n return -1;\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"HPHP::string_rfind","file_name":"hphp/runtime/base/zend-string.cpp","commit_link":"github.com/facebook/hhvm/commit/46003b4ab564b2abcd8470035fc324fe36aa8c75","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#127-0d6eab7eb5af","input":"static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tconst char *section_name = \"\";\n\tconst char *link_section_name = \"\";\n\tchar *end = NULL;\n\tElf_(Shdr) *link_shdr = NULL;\n\tut8 dfs[sizeof (Elf_(Verdef))] = {0};\n\tSdb *sdb;\n\tint cnt, i;\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn false;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (shdr->sh_size < 1) {\n\t\treturn false;\n\t}\n\tElf_(Verdef) *defs = calloc (shdr->sh_size, sizeof (char));\n\tif (!defs) {\n\t\treturn false;\n\t}\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (link_shdr && bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!defs) {\n\t\tbprintf (\"Warning: Cannot allocate memory (Check Elf_(Verdef))\\n\");\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tend = (char *)defs + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tfor (cnt = 0, i = 0; i >= 0 && cnt < shdr->sh_info && ((char *)defs + i < end); ++cnt) {\n\t\tSdb *sdb_verdef = sdb_new0 ();\n\t\tchar *vstart = ((char*)defs) + i;\n\t\tchar key[32] = {0};\n\t\tElf_(Verdef) *verdef = (Elf_(Verdef)*)vstart;\n\t\tElf_(Verdaux) aux = {0};\n\t\tint j = 0;\n\t\tint isum = 0;\n\n\t\tr_buf_read_at (bin->b, shdr->sh_offset + i, dfs, sizeof (Elf_(Verdef)));\n\t\tverdef->vd_version = READ16 (dfs, j)\n\t\tverdef->vd_flags = READ16 (dfs, j)\n\t\tverdef->vd_ndx = READ16 (dfs, j)\n\t\tverdef->vd_cnt = READ16 (dfs, j)\n\t\tverdef->vd_hash = READ32 (dfs, j)\n\t\tverdef->vd_aux = READ32 (dfs, j)\n\t\tverdef->vd_next = READ32 (dfs, j)\n\t\tvstart += verdef->vd_aux;\n\t\tif (vstart > end || vstart + sizeof (Elf_(Verdaux)) > end) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tj = 0;\n\t\taux.vda_name = READ32 (vstart, j)\n\t\taux.vda_next = READ32 (vstart, j)\n\n\t\tisum = i + verdef->vd_aux;\n\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tsdb_num_set (sdb_verdef, \"idx\", i, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_version\", verdef->vd_version, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_ndx\", verdef->vd_ndx, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_cnt\", verdef->vd_cnt, 0);\n\t\tsdb_set (sdb_verdef, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\tsdb_set (sdb_verdef, \"flags\", get_ver_flags (verdef->vd_flags), 0);\n\n\t\tfor (j = 1; j < verdef->vd_cnt; ++j) {\n\t\t\tint k;\n\t\t\tSdb *sdb_parent = sdb_new0 ();\n\t\t\tisum += aux.vda_next;\n\t\t\tvstart += aux.vda_next;\n\t\t\tif (vstart > end || vstart + sizeof(Elf_(Verdaux)) > end) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tk = 0;\n\t\t\taux.vda_name = READ32 (vstart, k)\n\t\t\taux.vda_next = READ32 (vstart, k)\n\t\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_parent, \"idx\", isum, 0);\n\t\t\tsdb_num_set (sdb_parent, \"parent\", j, 0);\n\t\t\tsdb_set (sdb_parent, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\t\tsnprintf (key, sizeof (key), \"parent%d\", j - 1);\n\t\t\tsdb_ns_set (sdb_verdef, key, sdb_parent);\n\t\t}\n\n\t\tsnprintf (key, sizeof (key), \"verdef%d\", cnt);\n\t\tsdb_ns_set (sdb, key, sdb_verdef);\n\t\tif (!verdef->vd_next) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tif ((st32)verdef->vd_next < 1) {\n\t\t\teprintf (\"Warning: Invalid vd_next in the ELF version\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += verdef->vd_next;\n\t}\n\tfree (defs);\n\treturn sdb;\nout_error:\n\tfree (defs);\n\tsdb_free (sdb);\n\treturn NULL;\n}","target":"static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tconst char *section_name = \"\";\n\tconst char *link_section_name = \"\";\n\tchar *end = NULL;\n\tElf_(Shdr) *link_shdr = NULL;\n\tut8 dfs[sizeof (Elf_(Verdef))] = {0};\n\tSdb *sdb;\n\tint cnt, i;\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn false;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (shdr->sh_size < 1) {\n\t\treturn false;\n\t}\n\tElf_(Verdef) *defs = calloc (shdr->sh_size, sizeof (char));\n\tif (!defs) {\n\t\treturn false;\n\t}\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (link_shdr && bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!defs) {\n\t\tbprintf (\"Warning: Cannot allocate memory (Check Elf_(Verdef))\\n\");\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tend = (char *)defs + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tfor (cnt = 0, i = 0; i >= 0 && cnt < shdr->sh_info && ((char *)defs + i < end); ++cnt) {\n\t\tSdb *sdb_verdef = sdb_new0 ();\n\t\tchar *vstart = ((char*)defs) + i;\n\t\tchar key[32] = {0};\n\t\tElf_(Verdef) *verdef = (Elf_(Verdef)*)vstart;\n\t\tElf_(Verdaux) aux = {0};\n\t\tint j = 0;\n\t\tint isum = 0;\n\n\t\tr_buf_read_at (bin->b, shdr->sh_offset + i, dfs, sizeof (Elf_(Verdef)));\n\t\tverdef->vd_version = READ16 (dfs, j)\n\t\tverdef->vd_flags = READ16 (dfs, j)\n\t\tverdef->vd_ndx = READ16 (dfs, j)\n\t\tverdef->vd_cnt = READ16 (dfs, j)\n\t\tverdef->vd_hash = READ32 (dfs, j)\n\t\tverdef->vd_aux = READ32 (dfs, j)\n\t\tverdef->vd_next = READ32 (dfs, j)\n\t\tint vdaux = verdef->vd_aux;\n\t\tif (vdaux < 1) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tvstart += vdaux;\n\t\tif (vstart > end || vstart + sizeof (Elf_(Verdaux)) > end) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tj = 0;\n\t\taux.vda_name = READ32 (vstart, j)\n\t\taux.vda_next = READ32 (vstart, j)\n\n\t\tisum = i + verdef->vd_aux;\n\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tsdb_num_set (sdb_verdef, \"idx\", i, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_version\", verdef->vd_version, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_ndx\", verdef->vd_ndx, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_cnt\", verdef->vd_cnt, 0);\n\t\tsdb_set (sdb_verdef, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\tsdb_set (sdb_verdef, \"flags\", get_ver_flags (verdef->vd_flags), 0);\n\n\t\tfor (j = 1; j < verdef->vd_cnt; ++j) {\n\t\t\tint k;\n\t\t\tSdb *sdb_parent = sdb_new0 ();\n\t\t\tisum += aux.vda_next;\n\t\t\tvstart += aux.vda_next;\n\t\t\tif (vstart > end || vstart + sizeof(Elf_(Verdaux)) > end) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tk = 0;\n\t\t\taux.vda_name = READ32 (vstart, k)\n\t\t\taux.vda_next = READ32 (vstart, k)\n\t\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_parent, \"idx\", isum, 0);\n\t\t\tsdb_num_set (sdb_parent, \"parent\", j, 0);\n\t\t\tsdb_set (sdb_parent, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\t\tsnprintf (key, sizeof (key), \"parent%d\", j - 1);\n\t\t\tsdb_ns_set (sdb_verdef, key, sdb_parent);\n\t\t}\n\n\t\tsnprintf (key, sizeof (key), \"verdef%d\", cnt);\n\t\tsdb_ns_set (sdb, key, sdb_verdef);\n\t\tif (!verdef->vd_next) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tif ((st32)verdef->vd_next < 1) {\n\t\t\teprintf (\"Warning: Invalid vd_next in the ELF version\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += verdef->vd_next;\n\t}\n\tfree (defs);\n\treturn sdb;\nout_error:\n\tfree (defs);\n\tsdb_free (sdb);\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"store_versioninfo_gnu_verdef","file_name":"libr/bin/format/elf/elf.c","commit_link":"github.com/radare/radare2/commit/44ded3ff35b8264f54b5a900cab32ec489d9e5b9","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#128-212b82bfb12a","input":"ssize_t enc_untrusted_recvfrom(int sockfd, void *buf, size_t len, int flags,\n struct sockaddr *src_addr, socklen_t *addrlen) {\n int klinux_flags = TokLinuxRecvSendFlag(flags);\n if (klinux_flags == 0 && flags != 0) {\n errno = EINVAL;\n return -1;\n }\n\n MessageWriter input;\n input.Push(sockfd);\n input.Push(len);\n input.Push(klinux_flags);\n MessageReader output;\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kRecvFromHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_recvfrom\", 4);\n\n int result = output.next();\n int klinux_errno = output.next();\n // recvfrom() returns -1 on failure, with errno set to indicate the cause\n // of the error.\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return result;\n }\n\n auto buffer_received = output.next();\n memcpy(buf, buffer_received.data(), std::min(len, buffer_received.size()));\n\n // If |src_addr| is not NULL, and the underlying protocol provides the source\n // address, this source address is filled in. When |src_addr| is NULL, nothing\n // is filled in; in this case, |addrlen| is not used, and should also be NULL.\n if (src_addr != nullptr && addrlen != nullptr) {\n auto klinux_sockaddr_buf = output.next();\n const struct klinux_sockaddr *klinux_addr =\n klinux_sockaddr_buf.As();\n FromkLinuxSockAddr(klinux_addr, klinux_sockaddr_buf.size(), src_addr,\n addrlen, TrustedPrimitives::BestEffortAbort);\n }\n\n return result;\n}","target":"ssize_t enc_untrusted_recvfrom(int sockfd, void *buf, size_t len, int flags,\n struct sockaddr *src_addr, socklen_t *addrlen) {\n int klinux_flags = TokLinuxRecvSendFlag(flags);\n if (klinux_flags == 0 && flags != 0) {\n errno = EINVAL;\n return -1;\n }\n\n MessageWriter input;\n input.Push(sockfd);\n input.Push(len);\n input.Push(klinux_flags);\n MessageReader output;\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kRecvFromHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_recvfrom\", 4);\n\n int result = output.next();\n int klinux_errno = output.next();\n // recvfrom() returns -1 on failure, with errno set to indicate the cause\n // of the error.\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return result;\n }\n\n if (result > len) {\n ::asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_recvfrom: result exceeds requested\");\n }\n\n auto buffer_received = output.next();\n memcpy(buf, buffer_received.data(), std::min(len, buffer_received.size()));\n\n // If |src_addr| is not NULL, and the underlying protocol provides the source\n // address, this source address is filled in. When |src_addr| is NULL, nothing\n // is filled in; in this case, |addrlen| is not used, and should also be NULL.\n if (src_addr != nullptr && addrlen != nullptr) {\n auto klinux_sockaddr_buf = output.next();\n const struct klinux_sockaddr *klinux_addr =\n klinux_sockaddr_buf.As();\n FromkLinuxSockAddr(klinux_addr, klinux_sockaddr_buf.size(), src_addr,\n addrlen, TrustedPrimitives::BestEffortAbort);\n }\n\n return result;\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"enc_untrusted_recvfrom","file_name":"asylo/platform/host_call/trusted/host_calls.cc","commit_link":"github.com/google/asylo/commit/6e158d558abd3c29a0208e30c97c9a8c5bd4230f","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#129-82c7809a5755","input":"BOOL license_read_new_or_upgrade_license_packet(rdpLicense* license, wStream* s)\n{\n\tUINT32 os_major;\n\tUINT32 os_minor;\n\tUINT32 cbScope, cbCompanyName, cbProductId, cbLicenseInfo;\n\twStream* licenseStream = NULL;\n\tBOOL ret = FALSE;\n\tBYTE computedMac[16];\n\tLICENSE_BLOB* calBlob;\n\n\tDEBUG_LICENSE(\"Receiving Server New/Upgrade License Packet\");\n\n\tcalBlob = license_new_binary_blob(BB_DATA_BLOB);\n\tif (!calBlob)\n\t\treturn FALSE;\n\n\t/* EncryptedLicenseInfo */\n\tif (!license_read_encrypted_blob(license, s, calBlob))\n\t\tgoto out_free_blob;\n\n\t/* compute MAC and check it */\n\tif (Stream_GetRemainingLength(s) < 16)\n\t\tgoto out_free_blob;\n\n\tif (!security_mac_data(license->MacSaltKey, calBlob->data, calBlob->length, computedMac))\n\t\tgoto out_free_blob;\n\n\tif (memcmp(computedMac, Stream_Pointer(s), sizeof(computedMac)) != 0)\n\t{\n\t\tWLog_ERR(TAG, \"new or upgrade license MAC mismatch\");\n\t\tgoto out_free_blob;\n\t}\n\n\tif (!Stream_SafeSeek(s, 16))\n\t\tgoto out_free_blob;\n\n\tlicenseStream = Stream_New(calBlob->data, calBlob->length);\n\tif (!licenseStream)\n\t\tgoto out_free_blob;\n\n\tStream_Read_UINT16(licenseStream, os_minor);\n\tStream_Read_UINT16(licenseStream, os_major);\n\n\t/* Scope */\n\tStream_Read_UINT32(licenseStream, cbScope);\n\tif (Stream_GetRemainingLength(licenseStream) < cbScope)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Scope:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbScope);\n#endif\n\tStream_Seek(licenseStream, cbScope);\n\n\t/* CompanyName */\n\tStream_Read_UINT32(licenseStream, cbCompanyName);\n\tif (Stream_GetRemainingLength(licenseStream) < cbCompanyName)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Company name:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbCompanyName);\n#endif\n\tStream_Seek(licenseStream, cbCompanyName);\n\n\t/* productId */\n\tStream_Read_UINT32(licenseStream, cbProductId);\n\tif (Stream_GetRemainingLength(licenseStream) < cbProductId)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Product id:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbProductId);\n#endif\n\tStream_Seek(licenseStream, cbProductId);\n\n\t/* licenseInfo */\n\tStream_Read_UINT32(licenseStream, cbLicenseInfo);\n\tif (Stream_GetRemainingLength(licenseStream) < cbLicenseInfo)\n\t\tgoto out_free_stream;\n\n\tlicense->state = LICENSE_STATE_COMPLETED;\n\n\tret = TRUE;\n\tif (!license->rdp->settings->OldLicenseBehaviour)\n\t\tret = saveCal(license->rdp->settings, Stream_Pointer(licenseStream), cbLicenseInfo,\n\t\t license->rdp->settings->ClientHostname);\n\nout_free_stream:\n\tStream_Free(licenseStream, FALSE);\nout_free_blob:\n\tlicense_free_binary_blob(calBlob);\n\treturn ret;\n}","target":"BOOL license_read_new_or_upgrade_license_packet(rdpLicense* license, wStream* s)\n{\n\tUINT32 os_major;\n\tUINT32 os_minor;\n\tUINT32 cbScope, cbCompanyName, cbProductId, cbLicenseInfo;\n\twStream* licenseStream = NULL;\n\tBOOL ret = FALSE;\n\tBYTE computedMac[16];\n\tLICENSE_BLOB* calBlob;\n\n\tDEBUG_LICENSE(\"Receiving Server New/Upgrade License Packet\");\n\n\tcalBlob = license_new_binary_blob(BB_DATA_BLOB);\n\tif (!calBlob)\n\t\treturn FALSE;\n\n\t/* EncryptedLicenseInfo */\n\tif (!license_read_encrypted_blob(license, s, calBlob))\n\t\tgoto out_free_blob;\n\n\t/* compute MAC and check it */\n\tif (Stream_GetRemainingLength(s) < 16)\n\t\tgoto out_free_blob;\n\n\tif (!security_mac_data(license->MacSaltKey, calBlob->data, calBlob->length, computedMac))\n\t\tgoto out_free_blob;\n\n\tif (memcmp(computedMac, Stream_Pointer(s), sizeof(computedMac)) != 0)\n\t{\n\t\tWLog_ERR(TAG, \"new or upgrade license MAC mismatch\");\n\t\tgoto out_free_blob;\n\t}\n\n\tif (!Stream_SafeSeek(s, 16))\n\t\tgoto out_free_blob;\n\n\tlicenseStream = Stream_New(calBlob->data, calBlob->length);\n\tif (!licenseStream)\n\t\tgoto out_free_blob;\n\n\tif (Stream_GetRemainingLength(licenseStream) < 8)\n\t\tgoto out_free_stream;\n\n\tStream_Read_UINT16(licenseStream, os_minor);\n\tStream_Read_UINT16(licenseStream, os_major);\n\n\t/* Scope */\n\tStream_Read_UINT32(licenseStream, cbScope);\n\tif (Stream_GetRemainingLength(licenseStream) < cbScope)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Scope:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbScope);\n#endif\n\tStream_Seek(licenseStream, cbScope);\n\n\t/* CompanyName */\n\tif (Stream_GetRemainingLength(licenseStream) < 4)\n\t\tgoto out_free_stream;\n\tStream_Read_UINT32(licenseStream, cbCompanyName);\n\tif (Stream_GetRemainingLength(licenseStream) < cbCompanyName)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Company name:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbCompanyName);\n#endif\n\tStream_Seek(licenseStream, cbCompanyName);\n\n\t/* productId */\n\tif (Stream_GetRemainingLength(licenseStream) < 4)\n\t\tgoto out_free_stream;\n\tStream_Read_UINT32(licenseStream, cbProductId);\n\tif (Stream_GetRemainingLength(licenseStream) < cbProductId)\n\t\tgoto out_free_stream;\n#ifdef WITH_DEBUG_LICENSE\n\tWLog_DBG(TAG, \"Product id:\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbProductId);\n#endif\n\tStream_Seek(licenseStream, cbProductId);\n\n\t/* licenseInfo */\n\tif (Stream_GetRemainingLength(licenseStream) < 4)\n\t\tgoto out_free_stream;\n\tStream_Read_UINT32(licenseStream, cbLicenseInfo);\n\tif (Stream_GetRemainingLength(licenseStream) < cbLicenseInfo)\n\t\tgoto out_free_stream;\n\n\tlicense->state = LICENSE_STATE_COMPLETED;\n\n\tret = TRUE;\n\tif (!license->rdp->settings->OldLicenseBehaviour)\n\t\tret = saveCal(license->rdp->settings, Stream_Pointer(licenseStream), cbLicenseInfo,\n\t\t license->rdp->settings->ClientHostname);\n\nout_free_stream:\n\tStream_Free(licenseStream, FALSE);\nout_free_blob:\n\tlicense_free_binary_blob(calBlob);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"license_read_new_or_upgrade_license_packet","file_name":"libfreerdp/core/license.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/6ade7b4cbfd71c54b3d724e8f2d6ac76a58e879a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-078#0-a9aaae203e4b","input":"def start():\n print(\"[*] Starting backdoor process\")\n print(\"[*] Decompressing target to tmp directory...\")\n #subprocess.call(\"jar -x %s\" % target, shell=True)\n with zipfile.ZipFile(target, 'r') as zip:\n zip.extractall(\"tmp\")\n print(\"[*] Target dumped to tmp directory\")\n\n print(\"[*] Modifying manifest file...\")\n oldmain=\"\"\n man = open(\"tmp/META-INF/MANIFEST.MF\",\"r\").read()\n with open(\"tmp/META-INF/MANIFEST.MF\",\"w\") as f:\n for l in man.split(\"\\n\"):\n if \"Main-Class\" in l:\n oldmain=l[12:]\n f.write(\"Main-Class: %s\\n\" % \"Backdoor\")\n else:\n f.write(\"%s\\n\" % l)\n print(\"[*] Manifest file modified\")\n \n print(\"[*] Modifying provided backdoor...\")\n inmain=False\n level=0\n bd=open(backdoor, \"r\").read()\n with open(\"tmp/%s\" % backdoor,'w') as f:\n for l in bd.split(\"\\n\"):\n if \"main(\" in l:\n inmain=True\n f.write(l)\n elif \"}\" in l and level<2 and inmain:\n f.write(\"%s.main(args);}\" % oldmain)\n inmain=False\n elif \"}\" in l and level>1 and inmain:\n level-=1\n f.write(l)\n elif \"{\" in l and inmain:\n level+=1\n f.write(l)\n else:\n f.write(l)\n print(\"[*] Provided backdoor successfully modified\")\n\n print(\"[*] Compiling modified backdoor...\")\n if subprocess.call(\"javac -cp tmp/ tmp/%s\" % backdoor, shell=True) != 0:\n print(\"[!] Error compiling %s\" % backdoor)\n print(\"[*] Compiled modified backdoor\")\n \n if(len(oldmain)<1):\n print(\"[!] Main-Class manifest attribute not found\")\n else:\n print(\"[*] Repackaging target jar file...\")\n createZip(\"tmp\",outfile)\n print(\"[*] Target jar successfully repackaged\")\n shutil.rmtree('tmp/')","target":"def start():\n print(\"[*] Starting backdoor process\")\n print(\"[*] Decompressing target to tmp directory...\")\n #subprocess.call(\"jar -x %s\" % target, shell=True)\n with zipfile.ZipFile(target, 'r') as zip:\n zip.extractall(\"tmp\")\n print(\"[*] Target dumped to tmp directory\")\n\n print(\"[*] Modifying manifest file...\")\n oldmain=\"\"\n man = open(\"tmp/META-INF/MANIFEST.MF\",\"r\").read()\n with open(\"tmp/META-INF/MANIFEST.MF\",\"w\") as f:\n for l in man.split(\"\\n\"):\n if \"Main-Class\" in l:\n oldmain=l[12:]\n f.write(\"Main-Class: %s\\n\" % \"Backdoor\")\n else:\n f.write(\"%s\\n\" % l)\n print(\"[*] Manifest file modified\")\n \n print(\"[*] Modifying provided backdoor...\")\n inmain=False\n level=0\n bd=open(backdoor, \"r\").read()\n with open(\"tmp/%s\" % backdoor,'w') as f:\n for l in bd.split(\"\\n\"):\n if \"main(\" in l:\n inmain=True\n f.write(l)\n elif \"}\" in l and level<2 and inmain:\n f.write(\"%s.main(args);}\" % oldmain)\n inmain=False\n elif \"}\" in l and level>1 and inmain:\n level-=1\n f.write(l)\n elif \"{\" in l and inmain:\n level+=1\n f.write(l)\n else:\n f.write(l)\n print(\"[*] Provided backdoor successfully modified\")\n\n print(\"[*] Compiling modified backdoor...\")\n #if subprocess.call(\"javac -cp tmp/ tmp/%s\" % backdoor, shell=True) != 0:\n if subprocess.call(['javac','-cp','tmp/','tmp/%s'%backdoor],shell=False) != 0:\n print(\"[!] Error compiling %s\" % backdoor)\n print(\"[*] Compiled modified backdoor\")\n \n if(len(oldmain)<1):\n print(\"[!] Main-Class manifest attribute not found\")\n else:\n print(\"[*] Repackaging target jar file...\")\n createZip(\"tmp\",outfile)\n print(\"[*] Target jar successfully repackaged\")\n shutil.rmtree('tmp/')","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"start","file_name":"ajar.py","commit_link":"github.com/Atticuss/ajar/commit/5ed8aba271ad20e6168f2e3bd6c25ba89b84484f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#1-2189502f1920","input":" def _map_vol_to_host(self, volume_name, host_name):\n \"\"\"Create a mapping between a volume to a host.\"\"\"\n\n LOG.debug(_('enter: _map_vol_to_host: volume %(volume_name)s to '\n 'host %(host_name)s')\n % {'volume_name': volume_name, 'host_name': host_name})\n\n # Check if this volume is already mapped to this host\n mapping_data = self._get_hostvdisk_mappings(host_name)\n\n mapped_flag = False\n result_lun = '-1'\n if volume_name in mapping_data:\n mapped_flag = True\n result_lun = mapping_data[volume_name]['SCSI_id']\n else:\n lun_used = [int(v['SCSI_id']) for v in mapping_data.values()]\n lun_used.sort()\n # Assume all luns are taken to this point, and then try to find\n # an unused one\n result_lun = str(len(lun_used))\n for index, n in enumerate(lun_used):\n if n > index:\n result_lun = str(index)\n break\n\n # Volume is not mapped to host, create a new LUN\n if not mapped_flag:\n ssh_cmd = ('svctask mkvdiskhostmap -host %(host_name)s -scsi '\n '%(result_lun)s %(volume_name)s' %\n {'host_name': host_name,\n 'result_lun': result_lun,\n 'volume_name': volume_name})\n out, err = self._run_ssh(ssh_cmd, check_exit_code=False)\n if err and err.startswith('CMMVC6071E'):\n if not self.configuration.storwize_svc_multihostmap_enabled:\n LOG.error(_('storwize_svc_multihostmap_enabled is set '\n 'to False, Not allow multi host mapping'))\n exception_msg = 'CMMVC6071E The VDisk-to-host mapping '\\\n 'was not created because the VDisk is '\\\n 'already mapped to a host.\\n\"'\n raise exception.CinderException(data=exception_msg)\n ssh_cmd = ssh_cmd.replace('mkvdiskhostmap',\n 'mkvdiskhostmap -force')\n # try to map one volume to multiple hosts\n out, err = self._run_ssh(ssh_cmd)\n LOG.warn(_('volume %s mapping to multi host') % volume_name)\n self._assert_ssh_return('successfully created' in out,\n '_map_vol_to_host', ssh_cmd, out, err)\n else:\n self._assert_ssh_return('successfully created' in out,\n '_map_vol_to_host', ssh_cmd, out, err)\n LOG.debug(_('leave: _map_vol_to_host: LUN %(result_lun)s, volume '\n '%(volume_name)s, host %(host_name)s') %\n {'result_lun': result_lun,\n 'volume_name': volume_name,\n 'host_name': host_name})\n return result_lun","target":" def _map_vol_to_host(self, volume_name, host_name):\n \"\"\"Create a mapping between a volume to a host.\"\"\"\n\n LOG.debug(_('enter: _map_vol_to_host: volume %(volume_name)s to '\n 'host %(host_name)s')\n % {'volume_name': volume_name, 'host_name': host_name})\n\n # Check if this volume is already mapped to this host\n mapping_data = self._get_hostvdisk_mappings(host_name)\n\n mapped_flag = False\n result_lun = '-1'\n if volume_name in mapping_data:\n mapped_flag = True\n result_lun = mapping_data[volume_name]['SCSI_id']\n else:\n lun_used = [int(v['SCSI_id']) for v in mapping_data.values()]\n lun_used.sort()\n # Assume all luns are taken to this point, and then try to find\n # an unused one\n result_lun = str(len(lun_used))\n for index, n in enumerate(lun_used):\n if n > index:\n result_lun = str(index)\n break\n\n # Volume is not mapped to host, create a new LUN\n if not mapped_flag:\n ssh_cmd = ['svctask', 'mkvdiskhostmap', '-host', host_name,\n '-scsi', result_lun, volume_name]\n out, err = self._run_ssh(ssh_cmd, check_exit_code=False)\n if err and err.startswith('CMMVC6071E'):\n if not self.configuration.storwize_svc_multihostmap_enabled:\n LOG.error(_('storwize_svc_multihostmap_enabled is set '\n 'to False, Not allow multi host mapping'))\n exception_msg = 'CMMVC6071E The VDisk-to-host mapping '\\\n 'was not created because the VDisk is '\\\n 'already mapped to a host.\\n\"'\n raise exception.CinderException(data=exception_msg)\n\n for i in range(len(ssh_cmd)):\n if ssh_cmd[i] == 'mkvdiskhostmap':\n ssh_cmd.insert(i + 1, '-force')\n\n # try to map one volume to multiple hosts\n out, err = self._run_ssh(ssh_cmd)\n LOG.warn(_('volume %s mapping to multi host') % volume_name)\n self._assert_ssh_return('successfully created' in out,\n '_map_vol_to_host', ssh_cmd, out, err)\n else:\n self._assert_ssh_return('successfully created' in out,\n '_map_vol_to_host', ssh_cmd, out, err)\n LOG.debug(_('leave: _map_vol_to_host: LUN %(result_lun)s, volume '\n '%(volume_name)s, host %(host_name)s') %\n {'result_lun': result_lun,\n 'volume_name': volume_name,\n 'host_name': host_name})\n return result_lun","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_map_vol_to_host","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#2-c82af2e5b379","input":" def _delete_vdisk(self, name, force):\n \"\"\"Deletes existing vdisks.\n\n It is very important to properly take care of mappings before deleting\n the disk:\n 1. If no mappings, then it was a vdisk, and can be deleted\n 2. If it is the source of a flashcopy mapping and copy_rate is 0, then\n it is a vdisk that has a snapshot. If the force flag is set,\n delete the mapping and the vdisk, otherwise set the mapping to\n copy and wait (this will allow users to delete vdisks that have\n snapshots if/when the upper layers allow it).\n 3. If it is the target of a mapping and copy_rate is 0, it is a\n snapshot, and we should properly stop the mapping and delete.\n 4. If it is the source/target of a mapping and copy_rate is not 0, it\n is a clone or vdisk created from a snapshot. We wait for the copy\n to complete (the mapping will be autodeleted) and then delete the\n vdisk.\n\n \"\"\"\n\n LOG.debug(_('enter: _delete_vdisk: vdisk %s') % name)\n\n # Try to delete volume only if found on the storage\n vdisk_defined = self._is_vdisk_defined(name)\n if not vdisk_defined:\n LOG.info(_('warning: Tried to delete vdisk %s but it does not '\n 'exist.') % name)\n return\n\n self._ensure_vdisk_no_fc_mappings(name)\n\n forceflag = '-force' if force else ''\n cmd_params = {'frc': forceflag, 'name': name}\n ssh_cmd = 'svctask rmvdisk %(frc)s %(name)s' % cmd_params\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from rmvdisk\n self._assert_ssh_return(len(out.strip()) == 0,\n ('_delete_vdisk %(name)s')\n % {'name': name},\n ssh_cmd, out, err)\n LOG.debug(_('leave: _delete_vdisk: vdisk %s') % name)","target":" def _delete_vdisk(self, name, force):\n \"\"\"Deletes existing vdisks.\n\n It is very important to properly take care of mappings before deleting\n the disk:\n 1. If no mappings, then it was a vdisk, and can be deleted\n 2. If it is the source of a flashcopy mapping and copy_rate is 0, then\n it is a vdisk that has a snapshot. If the force flag is set,\n delete the mapping and the vdisk, otherwise set the mapping to\n copy and wait (this will allow users to delete vdisks that have\n snapshots if/when the upper layers allow it).\n 3. If it is the target of a mapping and copy_rate is 0, it is a\n snapshot, and we should properly stop the mapping and delete.\n 4. If it is the source/target of a mapping and copy_rate is not 0, it\n is a clone or vdisk created from a snapshot. We wait for the copy\n to complete (the mapping will be autodeleted) and then delete the\n vdisk.\n\n \"\"\"\n\n LOG.debug(_('enter: _delete_vdisk: vdisk %s') % name)\n\n # Try to delete volume only if found on the storage\n vdisk_defined = self._is_vdisk_defined(name)\n if not vdisk_defined:\n LOG.info(_('warning: Tried to delete vdisk %s but it does not '\n 'exist.') % name)\n return\n\n self._ensure_vdisk_no_fc_mappings(name)\n\n ssh_cmd = ['svctask', 'rmvdisk', '-force', name]\n if not force:\n ssh_cmd.remove('-force')\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from rmvdisk\n self._assert_ssh_return(len(out.strip()) == 0,\n ('_delete_vdisk %(name)s')\n % {'name': name},\n ssh_cmd, out, err)\n LOG.debug(_('leave: _delete_vdisk: vdisk %s') % name)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_delete_vdisk","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#3-2749cd99d586","input":" def _cliq_run(self, verb, cliq_args, check_exit_code=True):\n \"\"\"Runs a CLIQ command over SSH, without doing any result parsing\"\"\"\n cliq_arg_strings = []\n for k, v in cliq_args.items():\n cliq_arg_strings.append(\" %s=%s\" % (k, v))\n cmd = verb + ''.join(cliq_arg_strings)\n\n return self._run_ssh(cmd, check_exit_code)","target":" def _cliq_run(self, verb, cliq_args, check_exit_code=True):\n \"\"\"Runs a CLIQ command over SSH, without doing any result parsing\"\"\"\n cmd_list = [verb]\n for k, v in cliq_args.items():\n cmd_list.append(\"%s=%s\" % (k, v))\n\n return self._run_ssh(cmd_list, check_exit_code)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_cliq_run","file_name":"cinder/volume/drivers/san/hp_lefthand.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#4-3d9210fc8110","input":" def _set_qos_rule(self, qos, vvs_name):\n max_io = self._get_qos_value(qos, 'maxIOPS')\n max_bw = self._get_qos_value(qos, 'maxBWS')\n cli_qos_string = \"\"\n if max_io is not None:\n cli_qos_string += ('-io %s ' % max_io)\n if max_bw is not None:\n cli_qos_string += ('-bw %sM ' % max_bw)\n self._cli_run('setqos %svvset:%s' %\n (cli_qos_string, vvs_name), None)","target":" def _set_qos_rule(self, qos, vvs_name):\n max_io = self._get_qos_value(qos, 'maxIOPS')\n max_bw = self._get_qos_value(qos, 'maxBWS')\n cli_qos_string = \"\"\n if max_io is not None:\n cli_qos_string += ('-io %s ' % max_io)\n if max_bw is not None:\n cli_qos_string += ('-bw %sM ' % max_bw)\n self._cli_run(['setqos', '%svvset:%s' % (cli_qos_string, vvs_name)])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_set_qos_rule","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#5-28ceb7882167","input":"def get_lines(command: str) -> List[str]:\n \"\"\"\n Run a command and return lines of output\n\n :param str command: the command to run\n :returns: list of whitespace-stripped lines output by command\n \"\"\"\n stdout = get_output(command)\n return [line.strip().decode() for line in stdout.splitlines()]","target":"def get_lines(command: List[str]) -> List[str]:\n \"\"\"\n Run a command and return lines of output\n\n :param str command: the command to run\n :returns: list of whitespace-stripped lines output by command\n \"\"\"\n stdout = get_output(command)\n return [line.strip() for line in stdout.splitlines()]","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"get_lines","file_name":"isort/hooks.py","commit_link":"github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#6-fe9caa64b7b7","input":" def _modify_3par_iscsi_host(self, hostname, iscsi_iqn):\n # when using -add, you can not send the persona or domain options\n self.common._cli_run('createhost -iscsi -add %s %s'\n % (hostname, iscsi_iqn), None)","target":" def _modify_3par_iscsi_host(self, hostname, iscsi_iqn):\n # when using -add, you can not send the persona or domain options\n command = ['createhost', '-iscsi', '-add', hostname, iscsi_iqn]\n self.common._cli_run(command)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_modify_3par_iscsi_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_iscsi.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#7-d026c91f8556","input":"@contextmanager\ndef run_interactive_shell_command(command, **kwargs):\n \"\"\"\n Runs a command in shell and provides stdout, stderr and stdin streams.\n\n This function creates a context manager that sets up the process, returns\n to caller, closes streams and waits for process to exit on leaving.\n\n The process is opened in `universal_newlines` mode.\n\n :param command: The command to run on shell.\n :param kwargs: Additional keyword arguments to pass to `subprocess.Popen`\n that is used to spawn the process (except `shell`,\n `stdout`, `stderr`, `stdin` and `universal_newlines`, a\n `TypeError` is raised then).\n :return: A context manager yielding the process started from the\n command.\n \"\"\"\n process = Popen(command,\n shell=True,\n stdout=PIPE,\n stderr=PIPE,\n stdin=PIPE,\n universal_newlines=True,\n **kwargs)\n try:\n yield process\n finally:\n process.stdout.close()\n process.stderr.close()\n process.stdin.close()\n process.wait()","target":"@contextmanager\ndef run_interactive_shell_command(command, **kwargs):\n \"\"\"\n Runs a single command in shell and provides stdout, stderr and stdin\n streams.\n\n This function creates a context manager that sets up the process (using\n `subprocess.Popen()`), returns to caller, closes streams and waits for\n process to exit on leaving.\n\n Shell execution is disabled by default (so no shell expansion takes place).\n If you want to turn shell execution on, you can pass `shell=True` like you\n would do for `subprocess.Popen()`.\n\n The process is opened in `universal_newlines` mode by default.\n\n :param command: The command to run on shell. This parameter can either\n be a sequence of arguments that are directly passed to\n the process or a string. A string gets splitted beforehand\n using `shlex.split()`.\n :param kwargs: Additional keyword arguments to pass to `subprocess.Popen`\n that is used to spawn the process (except `stdout`,\n `stderr`, `stdin` and `universal_newlines`, a `TypeError`\n is raised then).\n :return: A context manager yielding the process started from the\n command.\n \"\"\"\n if isinstance(command, str):\n command = shlex.split(command)\n\n process = Popen(command,\n stdout=PIPE,\n stderr=PIPE,\n stdin=PIPE,\n universal_newlines=True,\n **kwargs)\n try:\n yield process\n finally:\n process.stdout.close()\n process.stderr.close()\n process.stdin.close()\n process.wait()","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"run_interactive_shell_command","file_name":"coalib/misc/Shell.py","commit_link":"github.com/coala/coala/commit/adc94c745e4d9f792fd9c9791c7b4cd8790d0d2f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#8-051085388770","input":"@app.route('/delete_video/')\ndef delete_video(filename):\n\tif 'username' in session:\n\t\t#os.remove(\"static/videos/{}\".format(filename))\n\t\tprint(session['username'], file=sys.stdout)\n\t\tdata=users.query.filter_by(Username=session['username']).first()\n\t\tvideo=Video.query.filter_by(UserID=data.UserID,Name=filename).first()\n\t\tif video != None:\n\t\t\tos.remove(\"static/videos/{}\".format(filename))\n\t\t\tdb.session.delete(video)\n\t\t\tdb.session.commit()\n\t\telse:\n\t\t\treturn \"Don't delete other people's videos!\"\n\t\treturn redirect(url_for('upload'))\n\treturn \"test\"","target":"@app.route('/delete_video/')\ndef delete_video(filename):\n\tif 'username' in session:\n\t\t#os.remove(\"static/videos/{}\".format(filename))\n\t\tprint(session['username'], file=sys.stdout)\n\t\tdata=users.query.filter_by(Username=session['username']).first()\n\t\tvideo=Video.query.filter_by(UserID=data.UserID,Name=filename).first()\n\t\tif video != None:\n\t\t\t#os.remove(\"static/videos/{}\".format(filename))\n\t\t\tos.system(\"rm static/videos/{}\".format(filename))\n\t\t\tdb.session.delete(video)\n\t\t\tdb.session.commit()\n\t\telse:\n\t\t\treturn \"Don't delete other people's videos!\"\n\t\treturn redirect(url_for('upload'))\n\treturn \"test\"","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"delete_video","file_name":"Trialwebsite/app/app.py","commit_link":"github.com/jmarcello97/CSEC-380-Project/commit/05dcd628aa5879b6e4979c43e7c635075975de09","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#9-d568442eb4a9","input":"def whitelist(users: str):\n for user in users.split():\n call(WHITELIST_COMMAND_TEMPLATE.format(user))","target":"def whitelist(channel: discord.TextChannel, users: str):\n for user in users.split():\n if not re.match(r'^[A-Za-z0-9_]{3,16}$', user): # as per https://help.mojang.com/customer/en/portal/articles/928638-minecraft-usernames?b_id=5408\n await channel.send('\\'{}\\' is not a valid Minecraft username'.format(user))\n else:\n call(WHITELIST_COMMAND_TEMPLATE.format(user))","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"whitelist","file_name":"bot.py","commit_link":"github.com/thomotron/Gatekeep/commit/955660f9b3dc336ab0d5dfb4392b3ab6deac6b25","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#10-44c736f7de43","input":" def test_create_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = ('createhost -persona 1 -domain (\\'OpenStack\\',) '\n 'fakehost 123456789012345 123456789054321')\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n _run_ssh(show_host_cmd, False).AndReturn([pack(FC_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","target":" def test_create_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = (['createhost', '-persona', '1', '-domain',\n ('OpenStack',), 'fakehost', '123456789012345',\n '123456789054321'])\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n _run_ssh(show_host_cmd, False).AndReturn([pack(FC_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_create_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#11-2a41940b604f","input":" def do_setup(self, ctxt):\n \"\"\"Check that we have all configuration details from the storage.\"\"\"\n\n LOG.debug(_('enter: do_setup'))\n self._context = ctxt\n\n # Validate that the pool exists\n ssh_cmd = 'svcinfo lsmdiskgrp -delim ! -nohdr'\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), 'do_setup',\n ssh_cmd, out, err)\n search_text = '!%s!' % self.configuration.storwize_svc_volpool_name\n if search_text not in out:\n raise exception.InvalidInput(\n reason=(_('pool %s doesn\\'t exist')\n % self.configuration.storwize_svc_volpool_name))\n\n # Check if compression is supported\n self._compression_enabled = False\n try:\n ssh_cmd = 'svcinfo lslicense -delim !'\n out, err = self._run_ssh(ssh_cmd)\n license_lines = out.strip().split('\\n')\n for license_line in license_lines:\n name, foo, value = license_line.partition('!')\n if name in ('license_compression_enclosures',\n 'license_compression_capacity') and value != '0':\n self._compression_enabled = True\n break\n except exception.ProcessExecutionError:\n LOG.exception(_('Failed to get license information.'))\n\n # Get the iSCSI and FC names of the Storwize/SVC nodes\n ssh_cmd = 'svcinfo lsnode -delim !'\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), 'do_setup',\n ssh_cmd, out, err)\n\n nodes = out.strip().split('\\n')\n self._assert_ssh_return(len(nodes),\n 'do_setup', ssh_cmd, out, err)\n header = nodes.pop(0)\n for node_line in nodes:\n try:\n node_data = self._get_hdr_dic(header, node_line, '!')\n except exception.VolumeBackendAPIException:\n with excutils.save_and_reraise_exception():\n self._log_cli_output_error('do_setup',\n ssh_cmd, out, err)\n node = {}\n try:\n node['id'] = node_data['id']\n node['name'] = node_data['name']\n node['IO_group'] = node_data['IO_group_id']\n node['iscsi_name'] = node_data['iscsi_name']\n node['WWNN'] = node_data['WWNN']\n node['status'] = node_data['status']\n node['WWPN'] = []\n node['ipv4'] = []\n node['ipv6'] = []\n node['enabled_protocols'] = []\n if node['status'] == 'online':\n self._storage_nodes[node['id']] = node\n except KeyError:\n self._handle_keyerror('lsnode', header)\n\n # Get the iSCSI IP addresses and WWPNs of the Storwize/SVC nodes\n self._get_iscsi_ip_addrs()\n self._get_fc_wwpns()\n\n # For each node, check what connection modes it supports. Delete any\n # nodes that do not support any types (may be partially configured).\n to_delete = []\n for k, node in self._storage_nodes.iteritems():\n if ((len(node['ipv4']) or len(node['ipv6']))\n and len(node['iscsi_name'])):\n node['enabled_protocols'].append('iSCSI')\n self._enabled_protocols.add('iSCSI')\n if len(node['WWPN']):\n node['enabled_protocols'].append('FC')\n self._enabled_protocols.add('FC')\n if not len(node['enabled_protocols']):\n to_delete.append(k)\n\n for delkey in to_delete:\n del self._storage_nodes[delkey]\n\n # Make sure we have at least one node configured\n self._driver_assert(len(self._storage_nodes),\n _('do_setup: No configured nodes'))\n\n LOG.debug(_('leave: do_setup'))","target":" def do_setup(self, ctxt):\n \"\"\"Check that we have all configuration details from the storage.\"\"\"\n\n LOG.debug(_('enter: do_setup'))\n self._context = ctxt\n\n # Validate that the pool exists\n ssh_cmd = ['svcinfo', 'lsmdiskgrp', '-delim', '!', '-nohdr']\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), 'do_setup',\n ssh_cmd, out, err)\n search_text = '!%s!' % self.configuration.storwize_svc_volpool_name\n if search_text not in out:\n raise exception.InvalidInput(\n reason=(_('pool %s doesn\\'t exist')\n % self.configuration.storwize_svc_volpool_name))\n\n # Check if compression is supported\n self._compression_enabled = False\n try:\n ssh_cmd = ['svcinfo', 'lslicense', '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n license_lines = out.strip().split('\\n')\n for license_line in license_lines:\n name, foo, value = license_line.partition('!')\n if name in ('license_compression_enclosures',\n 'license_compression_capacity') and value != '0':\n self._compression_enabled = True\n break\n except exception.ProcessExecutionError:\n LOG.exception(_('Failed to get license information.'))\n\n # Get the iSCSI and FC names of the Storwize/SVC nodes\n ssh_cmd = ['svcinfo', 'lsnode', '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), 'do_setup',\n ssh_cmd, out, err)\n\n nodes = out.strip().split('\\n')\n self._assert_ssh_return(len(nodes),\n 'do_setup', ssh_cmd, out, err)\n header = nodes.pop(0)\n for node_line in nodes:\n try:\n node_data = self._get_hdr_dic(header, node_line, '!')\n except exception.VolumeBackendAPIException:\n with excutils.save_and_reraise_exception():\n self._log_cli_output_error('do_setup',\n ssh_cmd, out, err)\n node = {}\n try:\n node['id'] = node_data['id']\n node['name'] = node_data['name']\n node['IO_group'] = node_data['IO_group_id']\n node['iscsi_name'] = node_data['iscsi_name']\n node['WWNN'] = node_data['WWNN']\n node['status'] = node_data['status']\n node['WWPN'] = []\n node['ipv4'] = []\n node['ipv6'] = []\n node['enabled_protocols'] = []\n if node['status'] == 'online':\n self._storage_nodes[node['id']] = node\n except KeyError:\n self._handle_keyerror('lsnode', header)\n\n # Get the iSCSI IP addresses and WWPNs of the Storwize/SVC nodes\n self._get_iscsi_ip_addrs()\n self._get_fc_wwpns()\n\n # For each node, check what connection modes it supports. Delete any\n # nodes that do not support any types (may be partially configured).\n to_delete = []\n for k, node in self._storage_nodes.iteritems():\n if ((len(node['ipv4']) or len(node['ipv6']))\n and len(node['iscsi_name'])):\n node['enabled_protocols'].append('iSCSI')\n self._enabled_protocols.add('iSCSI')\n if len(node['WWPN']):\n node['enabled_protocols'].append('FC')\n self._enabled_protocols.add('FC')\n if not len(node['enabled_protocols']):\n to_delete.append(k)\n\n for delkey in to_delete:\n del self._storage_nodes[delkey]\n\n # Make sure we have at least one node configured\n self._driver_assert(len(self._storage_nodes),\n _('do_setup: No configured nodes'))\n\n LOG.debug(_('leave: do_setup'))","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"do_setup","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#12-67776a32016e","input":" def _execute_command_and_parse_attributes(self, ssh_cmd):\n \"\"\"Execute command on the Storwize/SVC and parse attributes.\n\n Exception is raised if the information from the system\n can not be obtained.\n\n \"\"\"\n\n LOG.debug(_('enter: _execute_command_and_parse_attributes: '\n ' command %s') % ssh_cmd)\n\n try:\n out, err = self._run_ssh(ssh_cmd)\n except exception.ProcessExecutionError as e:\n # Didn't get details from the storage, return None\n LOG.error(_('CLI Exception output:\\n command: %(cmd)s\\n '\n 'stdout: %(out)s\\n stderr: %(err)s') %\n {'cmd': ssh_cmd,\n 'out': e.stdout,\n 'err': e.stderr})\n return None\n\n self._assert_ssh_return(len(out),\n '_execute_command_and_parse_attributes',\n ssh_cmd, out, err)\n attributes = {}\n for attrib_line in out.split('\\n'):\n # If '!' not found, return the string and two empty strings\n attrib_name, foo, attrib_value = attrib_line.partition('!')\n if attrib_name is not None and len(attrib_name.strip()):\n attributes[attrib_name] = attrib_value\n\n LOG.debug(_('leave: _execute_command_and_parse_attributes:\\n'\n 'command: %(cmd)s\\n'\n 'attributes: %(attr)s')\n % {'cmd': ssh_cmd,\n 'attr': str(attributes)})\n\n return attributes","target":" def _execute_command_and_parse_attributes(self, ssh_cmd):\n \"\"\"Execute command on the Storwize/SVC and parse attributes.\n\n Exception is raised if the information from the system\n can not be obtained.\n\n \"\"\"\n\n LOG.debug(_('enter: _execute_command_and_parse_attributes: '\n ' command %s') % str(ssh_cmd))\n\n try:\n out, err = self._run_ssh(ssh_cmd)\n except exception.ProcessExecutionError as e:\n # Didn't get details from the storage, return None\n LOG.error(_('CLI Exception output:\\n command: %(cmd)s\\n '\n 'stdout: %(out)s\\n stderr: %(err)s') %\n {'cmd': ssh_cmd,\n 'out': e.stdout,\n 'err': e.stderr})\n return None\n\n self._assert_ssh_return(len(out),\n '_execute_command_and_parse_attributes',\n ssh_cmd, out, err)\n attributes = {}\n for attrib_line in out.split('\\n'):\n # If '!' not found, return the string and two empty strings\n attrib_name, foo, attrib_value = attrib_line.partition('!')\n if attrib_name is not None and len(attrib_name.strip()):\n attributes[attrib_name] = attrib_value\n\n LOG.debug(_('leave: _execute_command_and_parse_attributes:\\n'\n 'command: %(cmd)s\\n'\n 'attributes: %(attr)s')\n % {'cmd': str(ssh_cmd),\n 'attr': str(attributes)})\n\n return attributes","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_execute_command_and_parse_attributes","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#13-c9d59ea8af43","input":" def test_get_iscsi_ip_active(self):\n self.flags(lock_path=self.tempdir)\n\n #record set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = 'showport'\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = 'showport -iscsi'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = 'showport -iscsiname'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n self.mox.ReplayAll()\n\n config = self.setup_configuration()\n config.hp3par_iscsi_ips = ['10.10.220.253', '10.10.220.252']\n self.setup_driver(config, set_up_fakes=False)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_vlun_cmd = 'showvlun -a -host fakehost'\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN), ''])\n\n self.mox.ReplayAll()\n\n ip = self.driver._get_iscsi_ip('fakehost')\n self.assertEqual(ip, '10.10.220.253')","target":" def test_get_iscsi_ip_active(self):\n self.flags(lock_path=self.tempdir)\n\n #record set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = ['showport']\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = ['showport', '-iscsi']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = ['showport', '-iscsiname']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n self.mox.ReplayAll()\n\n config = self.setup_configuration()\n config.hp3par_iscsi_ips = ['10.10.220.253', '10.10.220.252']\n self.setup_driver(config, set_up_fakes=False)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_vlun_cmd = ['showvlun', '-a', '-host', 'fakehost']\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN), ''])\n\n self.mox.ReplayAll()\n\n ip = self.driver._get_iscsi_ip('fakehost')\n self.assertEqual(ip, '10.10.220.253')","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_get_iscsi_ip_active","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#14-6ede8efac84b","input":" def _find_host_from_wwpn(self, connector):\n for wwpn in connector['wwpns']:\n ssh_cmd = 'svcinfo lsfabric -wwpn %s -delim !' % wwpn\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n # This WWPN is not in use\n continue\n\n host_lines = out.strip().split('\\n')\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('remote_wwpn' in header and\n 'name' in header,\n '_find_host_from_wwpn',\n ssh_cmd, out, err)\n rmt_wwpn_idx = header.index('remote_wwpn')\n name_idx = header.index('name')\n\n wwpns = map(lambda x: x.split('!')[rmt_wwpn_idx], host_lines)\n\n if wwpn in wwpns:\n # All the wwpns will be the mapping for the same\n # host from this WWPN-based query. Just pick\n # the name from first line.\n hostname = host_lines[0].split('!')[name_idx]\n return hostname\n\n # Didn't find a host\n return None","target":" def _find_host_from_wwpn(self, connector):\n for wwpn in connector['wwpns']:\n ssh_cmd = ['svcinfo', 'lsfabric', '-wwpn', wwpn, '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n # This WWPN is not in use\n continue\n\n host_lines = out.strip().split('\\n')\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('remote_wwpn' in header and\n 'name' in header,\n '_find_host_from_wwpn',\n ssh_cmd, out, err)\n rmt_wwpn_idx = header.index('remote_wwpn')\n name_idx = header.index('name')\n\n wwpns = map(lambda x: x.split('!')[rmt_wwpn_idx], host_lines)\n\n if wwpn in wwpns:\n # All the wwpns will be the mapping for the same\n # host from this WWPN-based query. Just pick\n # the name from first line.\n hostname = host_lines[0].split('!')[name_idx]\n return hostname\n\n # Didn't find a host\n return None","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_find_host_from_wwpn","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#15-a7e17c1eb154","input":" def extend_volume(self, volume, new_size):\n LOG.debug(_('enter: extend_volume: volume %s') % volume['id'])\n ret = self._ensure_vdisk_no_fc_mappings(volume['name'],\n allow_snaps=False)\n if not ret:\n exception_message = (_('extend_volume: Extending a volume with '\n 'snapshots is not supported.'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n extend_amt = int(new_size) - volume['size']\n ssh_cmd = ('svctask expandvdisksize -size %(amt)d -unit gb %(name)s'\n % {'amt': extend_amt, 'name': volume['name']})\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from expandvdisksize\n self._assert_ssh_return(len(out.strip()) == 0, 'extend_volume',\n ssh_cmd, out, err)\n LOG.debug(_('leave: extend_volume: volume %s') % volume['id'])","target":" def extend_volume(self, volume, new_size):\n LOG.debug(_('enter: extend_volume: volume %s') % volume['id'])\n ret = self._ensure_vdisk_no_fc_mappings(volume['name'],\n allow_snaps=False)\n if not ret:\n exception_message = (_('extend_volume: Extending a volume with '\n 'snapshots is not supported.'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n extend_amt = int(new_size) - volume['size']\n ssh_cmd = (['svctask', 'expandvdisksize', '-size', str(extend_amt),\n '-unit', 'gb', volume['name']])\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from expandvdisksize\n self._assert_ssh_return(len(out.strip()) == 0, 'extend_volume',\n ssh_cmd, out, err)\n LOG.debug(_('leave: extend_volume: volume %s') % volume['id'])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"extend_volume","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#16-3601019c9a9b","input":" def _get_host_from_connector(self, connector):\n \"\"\"List the hosts defined in the storage.\n\n Return the host name with the given connection info, or None if there\n is no host fitting that information.\n\n \"\"\"\n\n prefix = self._connector_to_hostname_prefix(connector)\n LOG.debug(_('enter: _get_host_from_connector: prefix %s') % prefix)\n\n # Get list of host in the storage\n ssh_cmd = 'svcinfo lshost -delim !'\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return None\n\n # If we have FC information, we have a faster lookup option\n hostname = None\n if 'wwpns' in connector:\n hostname = self._find_host_from_wwpn(connector)\n\n # If we don't have a hostname yet, try the long way\n if not hostname:\n host_lines = out.strip().split('\\n')\n self._assert_ssh_return(len(host_lines),\n '_get_host_from_connector',\n ssh_cmd, out, err)\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('name' in header,\n '_get_host_from_connector',\n ssh_cmd, out, err)\n name_index = header.index('name')\n hosts = map(lambda x: x.split('!')[name_index], host_lines)\n hostname = self._find_host_exhaustive(connector, hosts)\n\n LOG.debug(_('leave: _get_host_from_connector: host %s') % hostname)\n\n return hostname","target":" def _get_host_from_connector(self, connector):\n \"\"\"List the hosts defined in the storage.\n\n Return the host name with the given connection info, or None if there\n is no host fitting that information.\n\n \"\"\"\n\n prefix = self._connector_to_hostname_prefix(connector)\n LOG.debug(_('enter: _get_host_from_connector: prefix %s') % prefix)\n\n # Get list of host in the storage\n ssh_cmd = ['svcinfo', 'lshost', '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return None\n\n # If we have FC information, we have a faster lookup option\n hostname = None\n if 'wwpns' in connector:\n hostname = self._find_host_from_wwpn(connector)\n\n # If we don't have a hostname yet, try the long way\n if not hostname:\n host_lines = out.strip().split('\\n')\n self._assert_ssh_return(len(host_lines),\n '_get_host_from_connector',\n ssh_cmd, out, err)\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('name' in header,\n '_get_host_from_connector',\n ssh_cmd, out, err)\n name_index = header.index('name')\n hosts = map(lambda x: x.split('!')[name_index], host_lines)\n hostname = self._find_host_exhaustive(connector, hosts)\n\n LOG.debug(_('leave: _get_host_from_connector: host %s') % hostname)\n\n return hostname","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_host_from_connector","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#17-a67233c6bcce","input":" def _get_hostvdisk_mappings(self, host_name):\n \"\"\"Return the defined storage mappings for a host.\"\"\"\n\n return_data = {}\n ssh_cmd = 'svcinfo lshostvdiskmap -delim ! %s' % host_name\n out, err = self._run_ssh(ssh_cmd)\n\n mappings = out.strip().split('\\n')\n if len(mappings):\n header = mappings.pop(0)\n for mapping_line in mappings:\n mapping_data = self._get_hdr_dic(header, mapping_line, '!')\n return_data[mapping_data['vdisk_name']] = mapping_data\n\n return return_data","target":" def _get_hostvdisk_mappings(self, host_name):\n \"\"\"Return the defined storage mappings for a host.\"\"\"\n\n return_data = {}\n ssh_cmd = ['svcinfo', 'lshostvdiskmap', '-delim', '!', host_name]\n out, err = self._run_ssh(ssh_cmd)\n\n mappings = out.strip().split('\\n')\n if len(mappings):\n header = mappings.pop(0)\n for mapping_line in mappings:\n mapping_data = self._get_hdr_dic(header, mapping_line, '!')\n return_data[mapping_data['vdisk_name']] = mapping_data\n\n return return_data","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_hostvdisk_mappings","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#18-4a612d4393e8","input":"def main():\n global word\n print(\"Starting script... press 'ctrl+c' in terminal to turn off\")\n while True:\n if pyperclip.paste() != word and len(pyperclip.paste().split())<5:\n word = pyperclip.paste()\n wordChc=False\n req = requests.get(\"https://api-portal.dictionary.com/dcom/pageData/%s\" % word)\n wordChcURB = False\n reqURB=requests.get('https://api.urbandictionary.com/v0/define?term=%s' % word)\n try: \n data = json.loads(req.text)['data']['content'][0]['entries'][0]['posBlocks'][0]['definitions']\n except TypeError:\n os.system('notify-send \"Cant find |%s| on dictionary.com!\"' % word)\n wordChc = True\n except KeyError:\n os.system('notify-send \"Cant find |%s| on dictionary.com!\"' % word)\n wordChc = True\n\n if not wordChc:\n definitions = []\n try:\n for definition in data[:3]:\n definitions.append(cleanhtml(definition['definition']))\n definitions.append(\"------------\")\n os.system('notify-send \"definitions from dictionary.com:[{}\\n{}\"'\\\n .format(word+\"]\\n------------\",'\\n'.join(definitions)))\n except KeyError:\n os.system('notify-send \"no results in dictionary.com\"')\n try: \n dataURB = json.loads(reqURB.text)['list']\n except TypeError:\n os.system('notify-send \"Cant find |%s| on urbandictionary.com!\"' % word)\n wordChcURB = True\n except KeyError:\n os.system('notify-send \"Cant find |%s| on urbandictionary.com!\"' % word)\n wordChcURB = True\n\n if not wordChcURB: \n definitionsURB = []\n for definition in dataURB[:3]:\n definitionsURB.append(definition['definition'])\n definitionsURB.append(\"------------\")\n os.system('notify-send \"definitions from urbandictionary.com:[{}\\n{}\"'\\\n .format(word+\"]\\n------------\",'\\n'.join(definitionsURB)))\n os.system('notify-send \"Thank you for using define.py made by kelj0\"')","target":"def main():\n global word\n print(\"Starting script... press 'ctrl+c' in terminal to turn off\")\n while True:\n if pyperclip.paste() != word and len(pyperclip.paste().split())<5:\n word = pyperclip.paste()\n wordChc=False\n req = requests.get(\"https://api-portal.dictionary.com/dcom/pageData/%s\" % word)\n wordChcURB = False\n reqURB=requests.get('https://api.urbandictionary.com/v0/define?term=%s' % word)\n try: \n data = json.loads(req.text)['data']['content'][0]['entries'][0]['posBlocks'][0]['definitions']\n except TypeError:\n os.system('notify-send \"Cant find that word on dictionary.com!\"')\n wordChc = True\n except KeyError:\n os.system('notify-send \"Cant find that word on dictionary.com!\"')\n wordChc = True\n\n if not wordChc:\n definitions = []\n try:\n for definition in data[:3]:\n definitions.append(cleanhtml(definition['definition']))\n definitions.append(\"------------\")\n os.system('notify-send \"definitions from dictionary.com:\\n{}\"'.format('\\n'.join(definitions)))\n except KeyError:\n os.system('notify-send \"no results in dictionary.com\"')\n try: \n dataURB = json.loads(reqURB.text)['list']\n except TypeError:\n os.system('notify-send \"Cant find that word on urbandictionary.com!\"' % word)\n wordChcURB = True\n except KeyError:\n os.system('notify-send \"Cant find that word on urbandictionary.com!\"' % word)\n wordChcURB = True\n\n if not wordChcURB: \n definitionsURB = []\n for definition in dataURB[:3]:\n definitionsURB.append(definition['definition'])\n definitionsURB.append(\"------------\")\n os.system('notify-send \"definitions from urbandictionary.com:\\n{}\"'.format('\\n'.join(definitionsURB)))\n os.system('notify-send \"Thank you for using define.py made by kelj0\"')","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"main","file_name":"SmallProjects/Define/define.py","commit_link":"github.com/kelj0/LearningPython/commit/2563088bf44f4d5e7f7d65f3c41f12fdaef4a1e4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#19-2c4f06be1765","input":" def _get_vvset_from_3par(self, volume_name):\n \"\"\"Get Virtual Volume Set from 3PAR.\n\n The only way to do this currently is to try and delete the volume\n to get the error message.\n\n NOTE(walter-boring): don't call this unless you know the volume is\n already in a vvset!\n \"\"\"\n cmd = \"removevv -f %s\" % volume_name\n LOG.debug(\"Issuing remove command to find vvset name %s\" % cmd)\n out = self._cli_run(cmd, None)\n vvset_name = None\n if out and len(out) > 1:\n if out[1].startswith(\"Attempt to delete \"):\n words = out[1].split(\" \")\n vvset_name = words[len(words) - 1]\n\n return vvset_name","target":" def _get_vvset_from_3par(self, volume_name):\n \"\"\"Get Virtual Volume Set from 3PAR.\n\n The only way to do this currently is to try and delete the volume\n to get the error message.\n\n NOTE(walter-boring): don't call this unless you know the volume is\n already in a vvset!\n \"\"\"\n cmd = ['removevv', '-f', volume_name]\n LOG.debug(\"Issuing remove command to find vvset name %s\" % cmd)\n out = self._cli_run(cmd)\n vvset_name = None\n if out and len(out) > 1:\n if out[1].startswith(\"Attempt to delete \"):\n words = out[1].split(\" \")\n vvset_name = words[len(words) - 1]\n\n return vvset_name","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_vvset_from_3par","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#20-3a0c17bdb6c5","input":" def _get_flashcopy_mapping_attributes(self, fc_map_id):\n LOG.debug(_('enter: _get_flashcopy_mapping_attributes: mapping %s')\n % fc_map_id)\n\n fc_ls_map_cmd = 'svcinfo lsfcmap -filtervalue id=%s -delim !' % \\\n fc_map_id\n out, err = self._run_ssh(fc_ls_map_cmd)\n if not len(out.strip()):\n return None\n\n # Get list of FlashCopy mappings\n # We expect zero or one line if mapping does not exist,\n # two lines if it does exist, otherwise error\n lines = out.strip().split('\\n')\n self._assert_ssh_return(len(lines) <= 2,\n '_get_flashcopy_mapping_attributes',\n fc_ls_map_cmd, out, err)\n\n if len(lines) == 2:\n attributes = self._get_hdr_dic(lines[0], lines[1], '!')\n else: # 0 or 1 lines\n attributes = None\n\n LOG.debug(_('leave: _get_flashcopy_mapping_attributes: mapping '\n '%(fc_map_id)s, attributes %(attributes)s') %\n {'fc_map_id': fc_map_id, 'attributes': attributes})\n\n return attributes","target":" def _get_flashcopy_mapping_attributes(self, fc_map_id):\n LOG.debug(_('enter: _get_flashcopy_mapping_attributes: mapping %s')\n % fc_map_id)\n\n fc_ls_map_cmd = ['svcinfo', 'lsfcmap', '-filtervalue',\n 'id=%s' % fc_map_id, '-delim', '!']\n out, err = self._run_ssh(fc_ls_map_cmd)\n if not len(out.strip()):\n return None\n\n # Get list of FlashCopy mappings\n # We expect zero or one line if mapping does not exist,\n # two lines if it does exist, otherwise error\n lines = out.strip().split('\\n')\n self._assert_ssh_return(len(lines) <= 2,\n '_get_flashcopy_mapping_attributes',\n fc_ls_map_cmd, out, err)\n\n if len(lines) == 2:\n attributes = self._get_hdr_dic(lines[0], lines[1], '!')\n else: # 0 or 1 lines\n attributes = None\n\n LOG.debug(_('leave: _get_flashcopy_mapping_attributes: mapping '\n '%(fc_map_id)s, attributes %(attributes)s') %\n {'fc_map_id': fc_map_id, 'attributes': attributes})\n\n return attributes","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_flashcopy_mapping_attributes","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#21-4ed7bfadae56","input":" def _add_volume_to_volume_set(self, volume, volume_name,\n cpg, vvs_name, qos):\n if vvs_name is not None:\n # Admin has set a volume set name to add the volume to\n self._cli_run('createvvset -add %s %s' % (vvs_name,\n volume_name), None)\n else:\n vvs_name = self._get_3par_vvs_name(volume['id'])\n domain = self.get_domain(cpg)\n self._cli_run('createvvset -domain %s %s' % (domain,\n vvs_name), None)\n self._set_qos_rule(qos, vvs_name)\n self._cli_run('createvvset -add %s %s' % (vvs_name,\n volume_name), None)","target":" def _add_volume_to_volume_set(self, volume, volume_name,\n cpg, vvs_name, qos):\n if vvs_name is not None:\n # Admin has set a volume set name to add the volume to\n self._cli_run(['createvvset', '-add', vvs_name, volume_name])\n else:\n vvs_name = self._get_3par_vvs_name(volume['id'])\n domain = self.get_domain(cpg)\n self._cli_run(['createvvset', '-domain', domain, vvs_name])\n self._set_qos_rule(qos, vvs_name)\n self._cli_run(['createvvset', '-add', vvs_name, volume_name])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_add_volume_to_volume_set","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#22-9173534e3de7","input":" def test_initialize_connection(self):\n self.driver._eql_execute = self.mox.\\\n CreateMock(self.driver._eql_execute)\n volume = {'name': self.volume_name}\n self.stubs.Set(self.driver, \"_get_iscsi_properties\",\n self._fake_get_iscsi_properties)\n self.driver._eql_execute('volume', 'select', volume['name'], 'access',\n 'create', 'initiator',\n self.connector['initiator'],\n 'authmethod chap',\n 'username',\n self.configuration.eqlx_chap_login)\n self.mox.ReplayAll()\n iscsi_properties = self.driver.initialize_connection(volume,\n self.connector)\n self.assertEqual(iscsi_properties['data'],\n self._fake_get_iscsi_properties(volume))","target":" def test_initialize_connection(self):\n self.driver._eql_execute = self.mox.\\\n CreateMock(self.driver._eql_execute)\n volume = {'name': self.volume_name}\n self.stubs.Set(self.driver, \"_get_iscsi_properties\",\n self._fake_get_iscsi_properties)\n self.driver._eql_execute('volume', 'select', volume['name'], 'access',\n 'create', 'initiator',\n self.connector['initiator'],\n 'authmethod', 'chap',\n 'username',\n self.configuration.eqlx_chap_login)\n self.mox.ReplayAll()\n iscsi_properties = self.driver.initialize_connection(volume,\n self.connector)\n self.assertEqual(iscsi_properties['data'],\n self._fake_get_iscsi_properties(volume))","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_initialize_connection","file_name":"cinder/tests/test_eqlx.py","commit_link":"github.com/thatsdone/cinder/commit/9e858bebb89de05b1c9ecc27f5bd9fbff95a728e","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#23-a63bbfd97879","input":" def test_create_invalid_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = ('createhost -persona 1 -domain (\\'OpenStack\\',) '\n 'fakehost 123456789012345 123456789054321')\n create_host_ret = pack(CLI_CR +\n 'already used by host fakehost.foo (19)')\n _run_ssh(create_host_cmd, False).AndReturn([create_host_ret, ''])\n\n show_3par_cmd = 'showhost -verbose fakehost.foo'\n _run_ssh(show_3par_cmd, False).AndReturn([pack(FC_SHOWHOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n\n self.assertEquals(host['name'], 'fakehost.foo')","target":" def test_create_invalid_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = (['createhost', '-persona', '1', '-domain',\n ('OpenStack',), 'fakehost', '123456789012345',\n '123456789054321'])\n create_host_ret = pack(CLI_CR +\n 'already used by host fakehost.foo (19)')\n _run_ssh(create_host_cmd, False).AndReturn([create_host_ret, ''])\n\n show_3par_cmd = ['showhost', '-verbose', 'fakehost.foo']\n _run_ssh(show_3par_cmd, False).AndReturn([pack(FC_SHOWHOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n\n self.assertEquals(host['name'], 'fakehost.foo')","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_create_invalid_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#24-3887008d41bf","input":"@app.route('/api/uploads//logs')\ndef get_logs(sid):\n if '/' not in sid:\n path = os.path.join(app.config['UPLOAD_FOLDER'], sid)\n if os.path.isfile(os.path.join(path, app.config['LOG_FILE'])):\n return send_from_directory(directory=path,\n filename=app.config['LOG_FILE'])\n else:\n abort(404)\n else:\n abort(403)","target":"@app.route('/api/uploads//logs')\ndef get_logs(sid):\n if utils.sid_is_valid(sid):\n path = join(app.config['UPLOAD_FOLDER'], sid)\n\n if os.path.isfile(join(path, app.config['LOG_FILE'])):\n return send_from_directory(directory=path,\n filename=app.config['LOG_FILE'])\n else:\n abort(404)\n else:\n abort(404)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"get_logs","file_name":"app/views.py","commit_link":"github.com/cheukyin699/genset-demo-site/commit/abb55b1a6786b0a995c2cdf77a7977a1d51cfc0d","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#25-4244e117e96d","input":" def _make_fc_map(self, source, target, full_copy):\n copyflag = '' if full_copy else '-copyrate 0'\n fc_map_cli_cmd = ('svctask mkfcmap -source %(src)s -target %(tgt)s '\n '-autodelete %(copyflag)s' %\n {'src': source,\n 'tgt': target,\n 'copyflag': copyflag})\n out, err = self._run_ssh(fc_map_cli_cmd)\n self._driver_assert(\n len(out.strip()),\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find success message in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n\n # Ensure that the output is as expected\n match_obj = re.search('FlashCopy Mapping, id \\[([0-9]+)\\], '\n 'successfully created', out)\n # Make sure we got a \"successfully created\" message with vdisk id\n self._driver_assert(\n match_obj is not None,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find success message in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n\n try:\n fc_map_id = match_obj.group(1)\n self._driver_assert(\n fc_map_id is not None,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find mapping id in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n except IndexError:\n self._driver_assert(\n False,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find mapping id in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n return fc_map_id","target":" def _make_fc_map(self, source, target, full_copy):\n fc_map_cli_cmd = ['svctask', 'mkfcmap', '-source', source, '-target',\n target, '-autodelete']\n if not full_copy:\n fc_map_cli_cmd.extend(['-copyrate', '0'])\n out, err = self._run_ssh(fc_map_cli_cmd)\n self._driver_assert(\n len(out.strip()),\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find success message in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n\n # Ensure that the output is as expected\n match_obj = re.search('FlashCopy Mapping, id \\[([0-9]+)\\], '\n 'successfully created', out)\n # Make sure we got a \"successfully created\" message with vdisk id\n self._driver_assert(\n match_obj is not None,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find success message in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n\n try:\n fc_map_id = match_obj.group(1)\n self._driver_assert(\n fc_map_id is not None,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find mapping id in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n except IndexError:\n self._driver_assert(\n False,\n _('create FC mapping from %(source)s to %(target)s - '\n 'did not find mapping id in CLI output.\\n'\n ' stdout: %(out)s\\n stderr: %(err)s\\n')\n % {'source': source,\n 'target': target,\n 'out': str(out),\n 'err': str(err)})\n return fc_map_id","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_make_fc_map","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#26-460c5df17593","input":" def test_get_iscsi_ip(self):\n self.flags(lock_path=self.tempdir)\n\n #record driver set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = 'showport'\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = 'showport -iscsi'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = 'showport -iscsiname'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n #record\n show_vlun_cmd = 'showvlun -a -host fakehost'\n show_vlun_ret = 'no vluns listed\\r\\n'\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(show_vlun_ret), ''])\n show_vlun_cmd = 'showvlun -a -showcols Port'\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n\n self.mox.ReplayAll()\n\n config = self.setup_configuration()\n config.iscsi_ip_address = '10.10.10.10'\n config.hp3par_iscsi_ips = ['10.10.220.253', '10.10.220.252']\n self.setup_driver(config, set_up_fakes=False)\n\n ip = self.driver._get_iscsi_ip('fakehost')\n self.assertEqual(ip, '10.10.220.252')","target":" def test_get_iscsi_ip(self):\n self.flags(lock_path=self.tempdir)\n\n #record driver set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = ['showport']\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = ['showport', '-iscsi']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = ['showport', '-iscsiname']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n #record\n show_vlun_cmd = ['showvlun', '-a', '-host', 'fakehost']\n show_vlun_ret = 'no vluns listed\\r\\n'\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(show_vlun_ret), ''])\n show_vlun_cmd = ['showvlun', '-a', '-showcols', 'Port']\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n\n self.mox.ReplayAll()\n\n config = self.setup_configuration()\n config.iscsi_ip_address = '10.10.10.10'\n config.hp3par_iscsi_ips = ['10.10.220.253', '10.10.220.252']\n self.setup_driver(config, set_up_fakes=False)\n\n ip = self.driver._get_iscsi_ip('fakehost')\n self.assertEqual(ip, '10.10.220.252')","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_get_iscsi_ip","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#27-07746633810f","input":"def usage(args=None):\n '''\n Return usage information for volumes mounted on this minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' disk.usage\n '''\n if __grains__['kernel'] == 'Linux':\n cmd = 'df -P'\n elif __grains__['kernel'] == 'OpenBSD':\n cmd = 'df -kP'\n else:\n cmd = 'df'\n if args:\n cmd = cmd + ' -' + args\n ret = {}\n out = __salt__['cmd.run'](cmd).splitlines()\n for line in out:\n if not line:\n continue\n if line.startswith('Filesystem'):\n continue\n comps = line.split()\n while not comps[1].isdigit():\n comps[0] = '{0} {1}'.format(comps[0], comps[1])\n comps.pop(1)\n try:\n if __grains__['kernel'] == 'Darwin':\n ret[comps[8]] = {\n 'filesystem': comps[0],\n '512-blocks': comps[1],\n 'used': comps[2],\n 'available': comps[3],\n 'capacity': comps[4],\n 'iused': comps[5],\n 'ifree': comps[6],\n '%iused': comps[7],\n }\n else:\n ret[comps[5]] = {\n 'filesystem': comps[0],\n '1K-blocks': comps[1],\n 'used': comps[2],\n 'available': comps[3],\n 'capacity': comps[4],\n }\n except IndexError:\n log.warn(\"Problem parsing disk usage information\")\n ret = {}\n return ret","target":"def usage(args=None):\n '''\n Return usage information for volumes mounted on this minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' disk.usage\n '''\n flags = ''\n allowed = ('a', 'B', 'h', 'H', 'i', 'k', 'l', 'P', 't', 'T', 'x', 'v')\n for flag in args:\n if flag in allowed:\n flags += flag\n else:\n break\n if __grains__['kernel'] == 'Linux':\n cmd = 'df -P'\n elif __grains__['kernel'] == 'OpenBSD':\n cmd = 'df -kP'\n else:\n cmd = 'df'\n if args:\n cmd += ' -{0}'.format(flags)\n ret = {}\n out = __salt__['cmd.run'](cmd).splitlines()\n for line in out:\n if not line:\n continue\n if line.startswith('Filesystem'):\n continue\n comps = line.split()\n while not comps[1].isdigit():\n comps[0] = '{0} {1}'.format(comps[0], comps[1])\n comps.pop(1)\n try:\n if __grains__['kernel'] == 'Darwin':\n ret[comps[8]] = {\n 'filesystem': comps[0],\n '512-blocks': comps[1],\n 'used': comps[2],\n 'available': comps[3],\n 'capacity': comps[4],\n 'iused': comps[5],\n 'ifree': comps[6],\n '%iused': comps[7],\n }\n else:\n ret[comps[5]] = {\n 'filesystem': comps[0],\n '1K-blocks': comps[1],\n 'used': comps[2],\n 'available': comps[3],\n 'capacity': comps[4],\n }\n except IndexError:\n log.warn(\"Problem parsing disk usage information\")\n ret = {}\n return ret","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"usage","file_name":"salt/modules/disk.py","commit_link":"github.com/saltstack/salt/commit/ebdef37b7e5d2b95a01d34b211c61c61da67e46a","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#28-a8345f6f520b","input":" def _get_fc_wwpns(self):\n for key in self._storage_nodes:\n node = self._storage_nodes[key]\n ssh_cmd = 'svcinfo lsnode -delim ! %s' % node['id']\n raw = self._run_ssh(ssh_cmd)\n resp = CLIResponse(raw, delim='!', with_header=False)\n wwpns = set(node['WWPN'])\n for i, s in resp.select('port_id', 'port_status'):\n if 'unconfigured' != s:\n wwpns.add(i)\n node['WWPN'] = list(wwpns)\n LOG.info(_('WWPN on node %(node)s: %(wwpn)s')\n % {'node': node['id'], 'wwpn': node['WWPN']})","target":" def _get_fc_wwpns(self):\n for key in self._storage_nodes:\n node = self._storage_nodes[key]\n ssh_cmd = ['svcinfo', 'lsnode', '-delim', '!', node['id']]\n raw = self._run_ssh(ssh_cmd)\n resp = CLIResponse(raw, delim='!', with_header=False)\n wwpns = set(node['WWPN'])\n for i, s in resp.select('port_id', 'port_status'):\n if 'unconfigured' != s:\n wwpns.add(i)\n node['WWPN'] = list(wwpns)\n LOG.info(_('WWPN on node %(node)s: %(wwpn)s')\n % {'node': node['id'], 'wwpn': node['WWPN']})","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_fc_wwpns","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#29-780234f49746","input":" def ls(self, data, path):\n credentials = self._formatCredentials(data, name='current')\n\n command = (\n '{credentials} '\n 'rclone lsjson current:{path}'\n ).format(\n credentials=credentials,\n path=path,\n )\n\n try:\n result = self._execute(command)\n result = json.loads(result)\n return result\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))","target":" def ls(self, data, path):\n credentials = self._formatCredentials(data, name='current')\n command = [\n 'rclone',\n 'lsjson',\n 'current:{}'.format(path),\n ]\n\n try:\n result = self._execute(command, credentials)\n result = json.loads(result)\n return result\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"ls","file_name":"src/backend/api/utils/rclone_connection.py","commit_link":"github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#30-7c7940c704c2","input":" def _run_ssh(self, command, check_exit=True, attempts=1):\n if not self.sshpool:\n self.sshpool = utils.SSHPool(self.config.san_ip,\n self.config.san_ssh_port,\n self.config.ssh_conn_timeout,\n self.config.san_login,\n password=self.config.san_password,\n privatekey=\n self.config.san_private_key,\n min_size=\n self.config.ssh_min_pool_conn,\n max_size=\n self.config.ssh_max_pool_conn)\n try:\n total_attempts = attempts\n with self.sshpool.item() as ssh:\n while attempts > 0:\n attempts -= 1\n try:\n return self._ssh_execute(ssh, command,\n check_exit_code=check_exit)\n except Exception as e:\n LOG.error(e)\n greenthread.sleep(randint(20, 500) / 100.0)\n msg = (_(\"SSH Command failed after '%(total_attempts)r' \"\n \"attempts : '%(command)s'\") %\n {'total_attempts': total_attempts, 'command': command})\n raise paramiko.SSHException(msg)\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error running ssh command: %s\") % command)","target":" def _run_ssh(self, cmd_list, check_exit=True, attempts=1):\n utils.check_ssh_injection(cmd_list)\n command = ' '. join(cmd_list)\n\n if not self.sshpool:\n self.sshpool = utils.SSHPool(self.config.san_ip,\n self.config.san_ssh_port,\n self.config.ssh_conn_timeout,\n self.config.san_login,\n password=self.config.san_password,\n privatekey=\n self.config.san_private_key,\n min_size=\n self.config.ssh_min_pool_conn,\n max_size=\n self.config.ssh_max_pool_conn)\n try:\n total_attempts = attempts\n with self.sshpool.item() as ssh:\n while attempts > 0:\n attempts -= 1\n try:\n return self._ssh_execute(ssh, command,\n check_exit_code=check_exit)\n except Exception as e:\n LOG.error(e)\n greenthread.sleep(randint(20, 500) / 100.0)\n msg = (_(\"SSH Command failed after '%(total_attempts)r' \"\n \"attempts : '%(command)s'\") %\n {'total_attempts': total_attempts, 'command': command})\n raise paramiko.SSHException(msg)\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error running ssh command: %s\") % command)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_run_ssh","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#31-0667a378a149","input":" def verify(self, data):\n credentials = self._formatCredentials(data, name='current')\n command = '{} rclone lsjson current:'.format(credentials)\n\n try:\n result = self._execute(command)\n return {\n 'result': True,\n 'message': 'Success',\n }\n except subprocess.CalledProcessError as e:\n returncode = e.returncode\n return {\n 'result': False,\n 'message': 'Exit status {}'.format(returncode),\n }","target":" def verify(self, data):\n credentials = self._formatCredentials(data, name='current')\n command = [\n 'rclone',\n 'lsjson',\n 'current:',\n ]\n\n try:\n result = self._execute(command, credentials)\n return {\n 'result': True,\n 'message': 'Success',\n }\n except subprocess.CalledProcessError as e:\n returncode = e.returncode\n return {\n 'result': False,\n 'message': 'Exit status {}'.format(returncode),\n }","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"verify","file_name":"src/backend/api/utils/rclone_connection.py","commit_link":"github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#32-af664687ce1a","input":" def add_extra_args(self, args=None):\n \"\"\"Add more args depending on how known args are set.\"\"\"\n parsed = vars(self.parse_known_args(nohelp=True)[0])\n\n # find which image mode specified if any, and add additional arguments\n image_mode = parsed.get('image_mode', None)\n if image_mode is not None and image_mode != 'none':\n self.add_image_args(image_mode)\n\n # find which task specified if any, and add its specific arguments\n task = parsed.get('task', None)\n if task is not None:\n self.add_task_args(task)\n evaltask = parsed.get('evaltask', None)\n if evaltask is not None:\n self.add_task_args(evaltask)\n\n # find which model specified if any, and add its specific arguments\n model = parsed.get('model', None)\n if model is not None:\n self.add_model_subargs(model)\n\n # reset parser-level defaults over any model-level defaults\n try:\n self.set_defaults(**self._defaults)\n except AttributeError:\n raise RuntimeError('Please file an issue on github that argparse '\n 'got an attribute error when parsing.')","target":" def add_extra_args(self, args=None):\n \"\"\"Add more args depending on how known args are set.\"\"\"\n parsed = vars(self.parse_known_args(args, nohelp=True)[0])\n\n # find which image mode specified if any, and add additional arguments\n image_mode = parsed.get('image_mode', None)\n if image_mode is not None and image_mode != 'none':\n self.add_image_args(image_mode)\n\n # find which task specified if any, and add its specific arguments\n task = parsed.get('task', None)\n if task is not None:\n self.add_task_args(task)\n evaltask = parsed.get('evaltask', None)\n if evaltask is not None:\n self.add_task_args(evaltask)\n\n # find which model specified if any, and add its specific arguments\n model = parsed.get('model', None)\n if model is not None:\n self.add_model_subargs(model)\n\n # reset parser-level defaults over any model-level defaults\n try:\n self.set_defaults(**self._defaults)\n except AttributeError:\n raise RuntimeError('Please file an issue on github that argparse '\n 'got an attribute error when parsing.')","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"add_extra_args","file_name":"parlai/core/params.py","commit_link":"github.com/freedombenLiu/ParlAI/commit/601668d569e1276e0b8bf2bf8fb43e391e10d170","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#33-aba413e8fa92","input":" def _get_vdisk_fc_mappings(self, vdisk_name):\n \"\"\"Return FlashCopy mappings that this vdisk is associated with.\"\"\"\n\n ssh_cmd = 'svcinfo lsvdiskfcmappings -nohdr %s' % vdisk_name\n out, err = self._run_ssh(ssh_cmd)\n\n mapping_ids = []\n if (len(out.strip())):\n lines = out.strip().split('\\n')\n mapping_ids = [line.split()[0] for line in lines]\n return mapping_ids","target":" def _get_vdisk_fc_mappings(self, vdisk_name):\n \"\"\"Return FlashCopy mappings that this vdisk is associated with.\"\"\"\n\n ssh_cmd = ['svcinfo', 'lsvdiskfcmappings', '-nohdr', vdisk_name]\n out, err = self._run_ssh(ssh_cmd)\n\n mapping_ids = []\n if (len(out.strip())):\n lines = out.strip().split('\\n')\n mapping_ids = [line.split()[0] for line in lines]\n return mapping_ids","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_vdisk_fc_mappings","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#34-c6fd76b935a4","input":" def test_create_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = ('createhost -iscsi -persona 1 -domain '\n '(\\'OpenStack\\',) '\n 'fakehost iqn.1993-08.org.debian:01:222')\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","target":" def test_create_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = (['createhost', '-iscsi', '-persona', '1', '-domain',\n ('OpenStack',), 'fakehost',\n 'iqn.1993-08.org.debian:01:222'])\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_create_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#35-58155d98d841","input":" def _copy_volume(self, src_name, dest_name, cpg=None, snap_cpg=None,\n tpvv=True):\n # Virtual volume sets are not supported with the -online option\n cmd = 'createvvcopy -p %s -online ' % src_name\n if snap_cpg:\n cmd += '-snp_cpg %s ' % snap_cpg\n if tpvv:\n cmd += '-tpvv '\n if cpg:\n cmd += cpg + ' '\n cmd += dest_name\n LOG.debug('Creating clone of a volume with %s' % cmd)\n self._cli_run(cmd, None)","target":" def _copy_volume(self, src_name, dest_name, cpg=None, snap_cpg=None,\n tpvv=True):\n # Virtual volume sets are not supported with the -online option\n cmd = ['createvvcopy', '-p', src_name, '-online']\n if snap_cpg:\n cmd.extend(['-snp_cpg', snap_cpg])\n if tpvv:\n cmd.append('-tpvv')\n if cpg:\n cmd.append(cpg)\n cmd.append(dest_name)\n LOG.debug('Creating clone of a volume with %s' % cmd)\n self._cli_run(cmd)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_copy_volume","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#36-b80859948956","input":" def _get_active_nsp(self, hostname):\n \"\"\"Return the active nsp, if one exists, for the given host.\"\"\"\n result = self.common._cli_run('showvlun -a -host %s' % hostname, None)\n if result:\n # first line is header\n result = result[1:]\n for line in result:\n info = line.split(\",\")\n if info and len(info) > 4:\n return info[4]","target":" def _get_active_nsp(self, hostname):\n \"\"\"Return the active nsp, if one exists, for the given host.\"\"\"\n result = self.common._cli_run(['showvlun', '-a', '-host', hostname])\n if result:\n # first line is header\n result = result[1:]\n for line in result:\n info = line.split(\",\")\n if info and len(info) > 4:\n return info[4]","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_active_nsp","file_name":"cinder/volume/drivers/san/hp/hp_3par_iscsi.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#37-ae5288192ffe","input":" def initialize_connection(self, volume, connector):\n \"\"\"Restrict access to a volume.\"\"\"\n try:\n cmd = ['volume', 'select', volume['name'], 'access', 'create',\n 'initiator', connector['initiator']]\n if self.configuration.eqlx_use_chap:\n cmd.extend(['authmethod chap', 'username',\n self.configuration.eqlx_chap_login])\n self._eql_execute(*cmd)\n iscsi_properties = self._get_iscsi_properties(volume)\n return {\n 'driver_volume_type': 'iscsi',\n 'data': iscsi_properties\n }\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_('Failed to initialize connection to volume %s'),\n volume['name'])","target":" def initialize_connection(self, volume, connector):\n \"\"\"Restrict access to a volume.\"\"\"\n try:\n cmd = ['volume', 'select', volume['name'], 'access', 'create',\n 'initiator', connector['initiator']]\n if self.configuration.eqlx_use_chap:\n cmd.extend(['authmethod', 'chap', 'username',\n self.configuration.eqlx_chap_login])\n self._eql_execute(*cmd)\n iscsi_properties = self._get_iscsi_properties(volume)\n return {\n 'driver_volume_type': 'iscsi',\n 'data': iscsi_properties\n }\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_('Failed to initialize connection to volume %s'),\n volume['name'])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"initialize_connection","file_name":"cinder/volume/drivers/eqlx.py","commit_link":"github.com/thatsdone/cinder/commit/9e858bebb89de05b1c9ecc27f5bd9fbff95a728e","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#38-1738ca2b645f","input":" def mkdir(self, data, path):\n credentials = self._formatCredentials(data, name='current')\n\n command = (\n '{credentials} '\n 'rclone touch current:{path}/.keep'\n ).format(\n credentials=credentials,\n path=path,\n )\n\n try:\n result = self._execute(command)\n return {\n 'message': 'Success',\n }\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))","target":" def mkdir(self, data, path):\n credentials = self._formatCredentials(data, name='current')\n command = [\n 'rclone',\n 'touch',\n 'current:{}/.keep'.format(path),\n ]\n\n try:\n result = self._execute(command, credentials)\n return {\n 'message': 'Success',\n }\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"mkdir","file_name":"src/backend/api/utils/rclone_connection.py","commit_link":"github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#39-bb9352c88007","input":"def populate_custom_grains_and_pillar():\n '''\n Populate local salt-minion grains and pillar fields values as specified in\n config file.\n\n For example:\n\n custom_grains_pillar:\n grains:\n - selinux: selinux:enabled\n - release: osrelease\n pillar:\n - ntpserver: network_services:ntpserver\n\n Note that the core grains are already included in hubble grains -- this\n is only necessary for custom grains and pillar data.\n '''\n log.debug('Fetching custom grains and pillar details')\n grains = {}\n salt.modules.config.__opts__ = __opts__\n custom_grains = __salt__['config.get']('custom_grains_pillar:grains', [])\n for grain in custom_grains:\n for key in grain:\n if _valid_command(grain[key]):\n value = __salt__['cmd.run']('salt-call grains.get {0}'.format(grain[key])).split('\\n')[1].strip()\n grains[key] = value\n custom_pillar = __salt__['config.get']('custom_grains_pillar:pillar', [])\n for pillar in custom_pillar:\n for key in pillar:\n if _valid_command(pillar[key]):\n value = __salt__['cmd.run']('salt-call pillar.get {0}'.format(pillar[key])).split('\\n')[1].strip()\n grains[key] = value\n log.debug('Done with fetching custom grains and pillar details')\n return grains","target":"def populate_custom_grains_and_pillar():\n '''\n Populate local salt-minion grains and pillar fields values as specified in\n config file.\n\n For example:\n\n custom_grains_pillar:\n grains:\n - selinux: selinux:enabled\n - release: osrelease\n pillar:\n - ntpserver: network_services:ntpserver\n\n Note that the core grains are already included in hubble grains -- this\n is only necessary for custom grains and pillar data.\n '''\n log.debug('Fetching custom grains and pillar details')\n grains = {}\n salt.modules.config.__opts__ = __opts__\n custom_grains = __salt__['config.get']('custom_grains_pillar:grains', [])\n for grain in custom_grains:\n for key in grain:\n value = __salt__['cmd.run'](['salt-call', 'grains.get', grain[key]]).split('\\n')[1].strip()\n grains[key] = value\n custom_pillar = __salt__['config.get']('custom_grains_pillar:pillar', [])\n for pillar in custom_pillar:\n for key in pillar:\n value = __salt__['cmd.run'](['salt-call', 'pillar.get', pillar[key]]).split('\\n')[1].strip()\n grains[key] = value\n log.debug('Done with fetching custom grains and pillar details')\n return grains","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"populate_custom_grains_and_pillar","file_name":"hubblestack/extmods/grains/custom_grains_pillar.py","commit_link":"github.com/hubblestack/hubble/commit/d9ca4a93ea5aabb1298c5b3dbfb23e94203428b9","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#40-86bcfc95a9d4","input":" def copy(self, src_data, src_path, dst_data, dst_path, job_id=None):\n credentials = ''\n\n if src_data is None: # Local\n src = src_path\n else:\n credentials += self._formatCredentials(src_data, name='src')\n src = 'src:{}'.format(src_path)\n\n if dst_data is None: # Local\n dst = dst_path\n else:\n credentials += self._formatCredentials(dst_data, name='dst')\n dst = 'dst:{}'.format(dst_path)\n\n\n command = (\n '{credentials} '\n 'rclone copy {src} {dst} '\n '--progress '\n '--stats 2s '\n ).format(\n credentials=credentials,\n src=src,\n dst=dst,\n )\n\n logging.info(sanitize(command))\n\n if job_id is None:\n job_id = self._get_next_job_id()\n else:\n if self._job_id_exists(job_id):\n raise ValueError('rclone copy job with ID {} already exists'.fromat(job_id))\n\n self._stop_events[job_id] = threading.Event()\n\n try:\n self._execute_interactive(command, job_id)\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))\n\n return job_id","target":" def copy(self, src_data, src_path, dst_data, dst_path, job_id=None):\n credentials = {}\n\n if src_data is None: # Local\n src = src_path\n else:\n credentials.update(self._formatCredentials(src_data, name='src'))\n src = 'src:{}'.format(src_path)\n\n if dst_data is None: # Local\n dst = dst_path\n else:\n credentials.update(self._formatCredentials(dst_data, name='dst'))\n dst = 'dst:{}'.format(dst_path)\n\n command = [\n 'rclone',\n 'copy',\n src,\n dst,\n '--progress',\n '--stats', '2s',\n ]\n\n bash_command = \"{} {}\".format(\n ' '.join(\"{}='{}'\".format(key, value) for key, value in credentials.items()),\n ' '.join(command),\n )\n\n logging.info(sanitize(bash_command))\n\n if job_id is None:\n job_id = self._get_next_job_id()\n else:\n if self._job_id_exists(job_id):\n raise ValueError('rclone copy job with ID {} already exists'.fromat(job_id))\n\n self._stop_events[job_id] = threading.Event()\n\n try:\n self._execute_interactive(command, credentials, job_id)\n except subprocess.CalledProcessError as e:\n raise RcloneException(sanitize(str(e)))\n\n return job_id","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"copy","file_name":"src/backend/api/utils/rclone_connection.py","commit_link":"github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#41-0485d4663ad0","input":"bool IsBlacklistedArg(const base::CommandLine::CharType* arg) {\n#if defined(OS_WIN)\n const auto converted = base::WideToUTF8(arg);\n const char* a = converted.c_str();\n#else\n const char* a = arg;\n#endif\n\n static const char* prefixes[] = {\"--\", \"-\", \"/\"};\n\n int prefix_length = 0;\n for (auto& prefix : prefixes) {\n if (base::StartsWith(a, prefix, base::CompareCase::SENSITIVE)) {\n prefix_length = strlen(prefix);\n break;\n }\n }\n\n if (prefix_length > 0) {\n a += prefix_length;\n std::string switch_name(a, strcspn(a, \"=\"));\n auto* iter = std::lower_bound(std::begin(kBlacklist), std::end(kBlacklist),\n switch_name);\n if (iter != std::end(kBlacklist) && switch_name == *iter) {\n return true;\n }\n }\n\n return false;\n}","target":"bool IsBlacklistedArg(const base::CommandLine::CharType* arg) {\n#if defined(OS_WIN)\n const auto converted = base::WideToUTF8(arg);\n const char* a = converted.c_str();\n#else\n const char* a = arg;\n#endif\n\n static const char* prefixes[] = {\"--\", \"-\", \"/\"};\n\n int prefix_length = 0;\n for (auto& prefix : prefixes) {\n if (base::StartsWith(a, prefix, base::CompareCase::SENSITIVE)) {\n prefix_length = strlen(prefix);\n break;\n }\n }\n\n if (prefix_length > 0) {\n a += prefix_length;\n std::string switch_name =\n base::ToLowerASCII(base::StringPiece(a, strcspn(a, \"=\")));\n auto* iter = std::lower_bound(std::begin(kBlacklist), std::end(kBlacklist),\n switch_name);\n if (iter != std::end(kBlacklist) && switch_name == *iter) {\n return true;\n }\n }\n\n return false;\n}","lang":"cpp","vul_type":"cwe-078","sven_meta":{"func_name":"IsBlacklistedArg","file_name":"atom/app/command_line_args.cc","commit_link":"github.com/electron/electron/commit/ce361a12e355f9e1e99c989f1ea056c9e502dbe7","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#42-407563b7e25f","input":" def _remove_volume_from_volume_set(self, volume_name, vvs_name):\n self._cli_run('removevvset -f %s %s' % (vvs_name, volume_name), None)","target":" def _remove_volume_from_volume_set(self, volume_name, vvs_name):\n self._cli_run(['removevvset', '-f', vvs_name, volume_name])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_remove_volume_from_volume_set","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#43-97660977fd9d","input":" def handle_message(self, ch, method, properties, body):\n \"\"\"\n this is a pika.basic_consumer callback\n handles client inputs, runs appropriate workflows and views\n\n Args:\n ch: amqp channel\n method: amqp method\n properties:\n body: message body\n \"\"\"\n input = {}\n try:\n self.sessid = method.routing_key\n\n input = json_decode(body)\n data = input['data']\n\n # since this comes as \"path\" we dont know if it's view or workflow yet\n #TODO: just a workaround till we modify ui to\n if 'path' in data:\n if data['path'] in settings.VIEW_URLS:\n data['view'] = data['path']\n else:\n data['wf'] = data['path']\n session = Session(self.sessid)\n\n headers = {'remote_ip': input['_zops_remote_ip']}\n\n if 'wf' in data:\n output = self._handle_workflow(session, data, headers)\n elif 'job' in data:\n\n self._handle_job(session, data, headers)\n return\n else:\n output = self._handle_view(session, data, headers)\n\n except HTTPError as e:\n import sys\n if hasattr(sys, '_called_from_test'):\n raise\n output = {'cmd': 'error', 'error': self._prepare_error_msg(e.message), \"code\": e.code}\n log.exception(\"Http error occurred\")\n except:\n self.current = Current(session=session, input=data)\n self.current.headers = headers\n import sys\n if hasattr(sys, '_called_from_test'):\n raise\n err = traceback.format_exc()\n output = {'error': self._prepare_error_msg(err), \"code\": 500}\n log.exception(\"Worker error occurred with messsage body:\\n%s\" % body)\n if 'callbackID' in input:\n output['callbackID'] = input['callbackID']\n log.info(\"OUTPUT for %s: %s\" % (self.sessid, output))\n output['reply_timestamp'] = time()\n self.send_output(output)","target":" def handle_message(self, ch, method, properties, body):\n \"\"\"\n this is a pika.basic_consumer callback\n handles client inputs, runs appropriate workflows and views\n\n Args:\n ch: amqp channel\n method: amqp method\n properties:\n body: message body\n \"\"\"\n input = {}\n headers = {}\n try:\n self.sessid = method.routing_key\n\n input = json_decode(body)\n data = input['data']\n\n # since this comes as \"path\" we dont know if it's view or workflow yet\n # TODO: just a workaround till we modify ui to\n if 'path' in data:\n if data['path'] in settings.VIEW_URLS:\n data['view'] = data['path']\n else:\n data['wf'] = data['path']\n session = Session(self.sessid)\n\n headers = {'remote_ip': input['_zops_remote_ip'],\n 'source': input['_zops_source']}\n\n if 'wf' in data:\n output = self._handle_workflow(session, data, headers)\n elif 'job' in data:\n\n self._handle_job(session, data, headers)\n return\n else:\n output = self._handle_view(session, data, headers)\n\n except HTTPError as e:\n import sys\n if hasattr(sys, '_called_from_test'):\n raise\n output = {'cmd': 'error', 'error': self._prepare_error_msg(e.message), \"code\": e.code}\n log.exception(\"Http error occurred\")\n except:\n self.current = Current(session=session, input=data)\n self.current.headers = headers\n import sys\n if hasattr(sys, '_called_from_test'):\n raise\n err = traceback.format_exc()\n output = {'error': self._prepare_error_msg(err), \"code\": 500}\n log.exception(\"Worker error occurred with messsage body:\\n%s\" % body)\n if 'callbackID' in input:\n output['callbackID'] = input['callbackID']\n log.info(\"OUTPUT for %s: %s\" % (self.sessid, output))\n output['reply_timestamp'] = time()\n self.send_output(output)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"handle_message","file_name":"zengine/wf_daemon.py","commit_link":"github.com/zetaops/zengine/commit/52eafbee90f8ddf78be0c7452828d49423246851","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#44-2097a321f7c9","input":" def _add_chapsecret_to_host(self, host_name):\n \"\"\"Generate and store a randomly-generated CHAP secret for the host.\"\"\"\n\n chap_secret = utils.generate_password()\n ssh_cmd = ('svctask chhost -chapsecret \"%(chap_secret)s\" %(host_name)s'\n % {'chap_secret': chap_secret, 'host_name': host_name})\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from chhost\n self._assert_ssh_return(len(out.strip()) == 0,\n '_add_chapsecret_to_host', ssh_cmd, out, err)\n return chap_secret","target":" def _add_chapsecret_to_host(self, host_name):\n \"\"\"Generate and store a randomly-generated CHAP secret for the host.\"\"\"\n\n chap_secret = utils.generate_password()\n ssh_cmd = ['svctask', 'chhost', '-chapsecret', chap_secret, host_name]\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from chhost\n self._assert_ssh_return(len(out.strip()) == 0,\n '_add_chapsecret_to_host', ssh_cmd, out, err)\n return chap_secret","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_add_chapsecret_to_host","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#45-504b6b13d1ff","input":" def _call_prepare_fc_map(self, fc_map_id, source, target):\n try:\n out, err = self._run_ssh('svctask prestartfcmap %s' % fc_map_id)\n except exception.ProcessExecutionError as e:\n with excutils.save_and_reraise_exception():\n LOG.error(_('_prepare_fc_map: Failed to prepare FlashCopy '\n 'from %(source)s to %(target)s.\\n'\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'source': source,\n 'target': target,\n 'out': e.stdout,\n 'err': e.stderr})","target":" def _call_prepare_fc_map(self, fc_map_id, source, target):\n try:\n out, err = self._run_ssh(['svctask', 'prestartfcmap', fc_map_id])\n except exception.ProcessExecutionError as e:\n with excutils.save_and_reraise_exception():\n LOG.error(_('_prepare_fc_map: Failed to prepare FlashCopy '\n 'from %(source)s to %(target)s.\\n'\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'source': source,\n 'target': target,\n 'out': e.stdout,\n 'err': e.stderr})","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_call_prepare_fc_map","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#46-190357285546","input":"static int bin_symbols(RCore *r, int mode, ut64 laddr, int va, ut64 at, const char *name, bool exponly, const char *args) {\n\tRBinInfo *info = r_bin_get_info (r->bin);\n\tRList *entries = r_bin_get_entries (r->bin);\n\tRBinSymbol *symbol;\n\tRBinAddr *entry;\n\tRListIter *iter;\n\tbool firstexp = true;\n\tbool printHere = false;\n\tint i = 0, lastfs = 's';\n\tbool bin_demangle = r_config_get_i (r->config, \"bin.demangle\");\n\tif (!info) {\n\t\treturn 0;\n\t}\n\n\tif (args && *args == '.') {\n\t\tprintHere = true;\n\t}\n\n\tbool is_arm = info && info->arch && !strncmp (info->arch, \"arm\", 3);\n\tconst char *lang = bin_demangle ? r_config_get (r->config, \"bin.lang\") : NULL;\n\n\tRList *symbols = r_bin_get_symbols (r->bin);\n\tr_spaces_push (&r->anal->meta_spaces, \"bin\");\n\n\tif (IS_MODE_JSON (mode) && !printHere) {\n\t\tr_cons_printf (\"[\");\n\t} else if (IS_MODE_SET (mode)) {\n\t\tr_flag_space_set (r->flags, R_FLAGS_FS_SYMBOLS);\n\t} else if (!at && exponly) {\n\t\tif (IS_MODE_RAD (mode)) {\n\t\t\tr_cons_printf (\"fs exports\\n\");\n\t\t} else if (IS_MODE_NORMAL (mode)) {\n\t\t\tr_cons_printf (printHere ? \"\" : \"[Exports]\\n\");\n\t\t}\n\t} else if (!at && !exponly) {\n\t\tif (IS_MODE_RAD (mode)) {\n\t\t\tr_cons_printf (\"fs symbols\\n\");\n\t\t} else if (IS_MODE_NORMAL (mode)) {\n\t\t\tr_cons_printf (printHere ? \"\" : \"[Symbols]\\n\");\n\t\t}\n\t}\n\tif (IS_MODE_NORMAL (mode)) {\n\t\tr_cons_printf (\"Num Paddr Vaddr Bind Type Size Name\\n\");\n\t}\n\n\n\tsize_t count = 0;\n\tr_list_foreach (symbols, iter, symbol) {\n\t\tif (!symbol->name) {\n\t\t\tcontinue;\n\t\t}\n\t\tchar *r_symbol_name = r_str_escape_utf8 (symbol->name, false, true);\n\t\tut64 addr = compute_addr (r->bin, symbol->paddr, symbol->vaddr, va);\n\t\tint len = symbol->size ? symbol->size : 32;\n\t\tSymName sn = {0};\n\n\t\tif (exponly && !isAnExport (symbol)) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif (name && strcmp (r_symbol_name, name)) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif (at && (!symbol->size || !is_in_range (at, addr, symbol->size))) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif ((printHere && !is_in_range (r->offset, symbol->paddr, len))\n\t\t\t\t&& (printHere && !is_in_range (r->offset, addr, len))) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tcount ++;\n\t\tsnInit (r, &sn, symbol, lang);\n\n\t\tif (IS_MODE_SET (mode) && (is_section_symbol (symbol) || is_file_symbol (symbol))) {\n\t\t\t/*\n\t\t\t * Skip section symbols because they will have their own flag.\n\t\t\t * Skip also file symbols because not useful for now.\n\t\t\t */\n\t\t} else if (IS_MODE_SET (mode) && is_special_symbol (symbol)) {\n\t\t\tif (is_arm) {\n\t\t\t\thandle_arm_special_symbol (r, symbol, va);\n\t\t\t}\n\t\t} else if (IS_MODE_SET (mode)) {\n\t\t\t// TODO: provide separate API in RBinPlugin to let plugins handle anal hints/metadata\n\t\t\tif (is_arm) {\n\t\t\t\thandle_arm_symbol (r, symbol, info, va);\n\t\t\t}\n\t\t\tselect_flag_space (r, symbol);\n\t\t\t/* If that's a Classed symbol (method or so) */\n\t\t\tif (sn.classname) {\n\t\t\t\tRFlagItem *fi = r_flag_get (r->flags, sn.methflag);\n\t\t\t\tif (r->bin->prefix) {\n\t\t\t\t\tchar *prname = r_str_newf (\"%s.%s\", r->bin->prefix, sn.methflag);\n\t\t\t\t\tr_name_filter (sn.methflag, -1);\n\t\t\t\t\tfree (sn.methflag);\n\t\t\t\t\tsn.methflag = prname;\n\t\t\t\t}\n\t\t\t\tif (fi) {\n\t\t\t\t\tr_flag_item_set_realname (fi, sn.methname);\n\t\t\t\t\tif ((fi->offset - r->flags->base) == addr) {\n\t\t\t\t//\t\tchar *comment = fi->comment ? strdup (fi->comment) : NULL;\n\t\t\t\t\t\tr_flag_unset (r->flags, fi);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfi = r_flag_set (r->flags, sn.methflag, addr, symbol->size);\n\t\t\t\t\tchar *comment = fi->comment ? strdup (fi->comment) : NULL;\n\t\t\t\t\tif (comment) {\n\t\t\t\t\t\tr_flag_item_set_comment (fi, comment);\n\t\t\t\t\t\tR_FREE (comment);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst char *n = sn.demname ? sn.demname : sn.name;\n\t\t\t\tconst char *fn = sn.demflag ? sn.demflag : sn.nameflag;\n\t\t\t\tchar *fnp = (r->bin->prefix) ?\n\t\t\t\t\tr_str_newf (\"%s.%s\", r->bin->prefix, fn):\n\t\t\t\t\tstrdup (fn);\n\t\t\t\tRFlagItem *fi = r_flag_set (r->flags, fnp, addr, symbol->size);\n\t\t\t\tif (fi) {\n\t\t\t\t\tr_flag_item_set_realname (fi, n);\n\t\t\t\t\tfi->demangled = (bool)(size_t)sn.demname;\n\t\t\t\t} else {\n\t\t\t\t\tif (fn) {\n\t\t\t\t\t\teprintf (\"[Warning] Can't find flag (%s)\\n\", fn);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfree (fnp);\n\t\t\t}\n\t\t\tif (sn.demname) {\n\t\t\t\tr_meta_add (r->anal, R_META_TYPE_COMMENT,\n\t\t\t\t\taddr, symbol->size, sn.demname);\n\t\t\t}\n\t\t\tr_flag_space_pop (r->flags);\n\t\t} else if (IS_MODE_JSON (mode)) {\n\t\t\tchar *str = r_str_escape_utf8_for_json (r_symbol_name, -1);\n\t\t\t// str = r_str_replace (str, \"\\\"\", \"\\\\\\\"\", 1);\n\t\t\tr_cons_printf (\"%s{\\\"name\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"demname\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"flagname\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"ordinal\\\":%d,\"\n\t\t\t\t\"\\\"bind\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"size\\\":%d,\"\n\t\t\t\t\"\\\"type\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"vaddr\\\":%\"PFMT64d\",\"\n\t\t\t\t\"\\\"paddr\\\":%\"PFMT64d\"}\",\n\t\t\t\t((exponly && firstexp) || printHere) ? \"\" : (iter->p ? \",\" : \"\"),\n\t\t\t\tstr,\n\t\t\t\tsn.demname? sn.demname: \"\",\n\t\t\t\tsn.nameflag,\n\t\t\t\tsymbol->ordinal,\n\t\t\t\tsymbol->bind,\n\t\t\t\t(int)symbol->size,\n\t\t\t\tsymbol->type,\n\t\t\t\t(ut64)addr, (ut64)symbol->paddr);\n\t\t\tfree (str);\n\t\t} else if (IS_MODE_SIMPLE (mode)) {\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tr_cons_printf (\"0x%08\"PFMT64x\" %d %s\\n\",\n\t\t\t\taddr, (int)symbol->size, name);\n\t\t} else if (IS_MODE_SIMPLEST (mode)) {\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tr_cons_printf (\"%s\\n\", name);\n\t\t} else if (IS_MODE_RAD (mode)) {\n\t\t\t/* Skip special symbols because we do not flag them and\n\t\t\t * they shouldn't be printed in the rad format either */\n\t\t\tif (is_special_symbol (symbol)) {\n\t\t\t\tgoto next;\n\t\t\t}\n\t\t\tRBinFile *binfile;\n\t\t\tRBinPlugin *plugin;\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tif (!name) {\n\t\t\t\tgoto next;\n\t\t\t}\n\t\t\tif (!strncmp (name, \"imp.\", 4)) {\n\t\t\t\tif (lastfs != 'i') {\n\t\t\t\t\tr_cons_printf (\"fs imports\\n\");\n\t\t\t\t}\n\t\t\t\tlastfs = 'i';\n\t\t\t} else {\n\t\t\t\tif (lastfs != 's') {\n\t\t\t\t\tconst char *fs = exponly? \"exports\": \"symbols\";\n\t\t\t\t\tr_cons_printf (\"fs %s\\n\", fs);\n\t\t\t\t}\n\t\t\t\tlastfs = 's';\n\t\t\t}\n\t\t\tif (r->bin->prefix || *name) { // we don't want unnamed symbol flags\n\t\t\t\tchar *flagname = construct_symbol_flagname (\"sym\", name, MAXFLAG_LEN_DEFAULT);\n\t\t\t\tif (!flagname) {\n\t\t\t\t\tgoto next;\n\t\t\t\t}\n\t\t\t\tr_cons_printf (\"\\\"f %s%s%s %u 0x%08\" PFMT64x \"\\\"\\n\",\n\t\t\t\t\tr->bin->prefix ? r->bin->prefix : \"\", r->bin->prefix ? \".\" : \"\",\n\t\t\t\t\tflagname, symbol->size, addr);\n\t\t\t\tfree (flagname);\n\t\t\t}\n\t\t\tbinfile = r_bin_cur (r->bin);\n\t\t\tplugin = r_bin_file_cur_plugin (binfile);\n\t\t\tif (plugin && plugin->name) {\n\t\t\t\tif (r_str_startswith (plugin->name, \"pe\")) {\n\t\t\t\t\tchar *module = strdup (r_symbol_name);\n\t\t\t\t\tchar *p = strstr (module, \".dll_\");\n\t\t\t\t\tif (p && strstr (module, \"imp.\")) {\n\t\t\t\t\t\tchar *symname = __filterShell (p + 5);\n\t\t\t\t\t\tchar *m = __filterShell (module);\n\t\t\t\t\t\t*p = 0;\n\t\t\t\t\t\tif (r->bin->prefix) {\n\t\t\t\t\t\t\tr_cons_printf (\"k bin/pe/%s/%d=%s.%s\\n\",\n\t\t\t\t\t\t\t\tmodule, symbol->ordinal, r->bin->prefix, symname);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tr_cons_printf (\"k bin/pe/%s/%d=%s\\n\",\n\t\t\t\t\t\t\t\tmodule, symbol->ordinal, symname);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfree (symname);\n\t\t\t\t\t\tfree (m);\n\t\t\t\t\t}\n\t\t\t\t\tfree (module);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst char *bind = symbol->bind? symbol->bind: \"NONE\";\n\t\t\tconst char *type = symbol->type? symbol->type: \"NONE\";\n\t\t\tconst char *name = r_str_get (sn.demname? sn.demname: r_symbol_name);\n\t\t\t// const char *fwd = r_str_get (symbol->forwarder);\n\t\t\tr_cons_printf (\"%03u\", symbol->ordinal);\n\t\t\tif (symbol->paddr == UT64_MAX) {\n\t\t\t\tr_cons_printf (\" ----------\");\n\t\t\t} else {\n\t\t\t\tr_cons_printf (\" 0x%08\"PFMT64x, symbol->paddr);\n\t\t\t}\n\t\t\tr_cons_printf (\" 0x%08\"PFMT64x\" %6s %6s %4d%s%s\\n\",\n\t\t\t addr, bind, type, symbol->size, *name? \" \": \"\", name);\n\t\t}\nnext:\n\t\tsnFini (&sn);\n\t\ti++;\n\t\tfree (r_symbol_name);\n\t\tif (exponly && firstexp) {\n\t\t\tfirstexp = false;\n\t\t}\n\t\tif (printHere) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (count == 0 && IS_MODE_JSON (mode)) {\n\t\tr_cons_printf (\"{}\");\n\t}\n\n\n\t//handle thumb and arm for entry point since they are not present in symbols\n\tif (is_arm) {\n\t\tr_list_foreach (entries, iter, entry) {\n\t\t\tif (IS_MODE_SET (mode)) {\n\t\t\t\thandle_arm_entry (r, entry, info, va);\n\t\t\t}\n\t\t}\n\t}\n\tif (IS_MODE_JSON (mode) && !printHere) {\n\t\tr_cons_printf (\"]\");\n\t}\n\n\tr_spaces_pop (&r->anal->meta_spaces);\n\treturn true;\n}","target":"static int bin_symbols(RCore *r, int mode, ut64 laddr, int va, ut64 at, const char *name, bool exponly, const char *args) {\n\tRBinInfo *info = r_bin_get_info (r->bin);\n\tRList *entries = r_bin_get_entries (r->bin);\n\tRBinSymbol *symbol;\n\tRBinAddr *entry;\n\tRListIter *iter;\n\tbool firstexp = true;\n\tbool printHere = false;\n\tint i = 0, lastfs = 's';\n\tbool bin_demangle = r_config_get_i (r->config, \"bin.demangle\");\n\tif (!info) {\n\t\treturn 0;\n\t}\n\n\tif (args && *args == '.') {\n\t\tprintHere = true;\n\t}\n\n\tbool is_arm = info && info->arch && !strncmp (info->arch, \"arm\", 3);\n\tconst char *lang = bin_demangle ? r_config_get (r->config, \"bin.lang\") : NULL;\n\n\tRList *symbols = r_bin_get_symbols (r->bin);\n\tr_spaces_push (&r->anal->meta_spaces, \"bin\");\n\n\tif (IS_MODE_JSON (mode) && !printHere) {\n\t\tr_cons_printf (\"[\");\n\t} else if (IS_MODE_SET (mode)) {\n\t\tr_flag_space_set (r->flags, R_FLAGS_FS_SYMBOLS);\n\t} else if (!at && exponly) {\n\t\tif (IS_MODE_RAD (mode)) {\n\t\t\tr_cons_printf (\"fs exports\\n\");\n\t\t} else if (IS_MODE_NORMAL (mode)) {\n\t\t\tr_cons_printf (printHere ? \"\" : \"[Exports]\\n\");\n\t\t}\n\t} else if (!at && !exponly) {\n\t\tif (IS_MODE_RAD (mode)) {\n\t\t\tr_cons_printf (\"fs symbols\\n\");\n\t\t} else if (IS_MODE_NORMAL (mode)) {\n\t\t\tr_cons_printf (printHere ? \"\" : \"[Symbols]\\n\");\n\t\t}\n\t}\n\tif (IS_MODE_NORMAL (mode)) {\n\t\tr_cons_printf (\"Num Paddr Vaddr Bind Type Size Name\\n\");\n\t}\n\n\n\tsize_t count = 0;\n\tr_list_foreach (symbols, iter, symbol) {\n\t\tif (!symbol->name) {\n\t\t\tcontinue;\n\t\t}\n\t\tchar *r_symbol_name = r_str_escape_utf8 (symbol->name, false, true);\n\t\tut64 addr = compute_addr (r->bin, symbol->paddr, symbol->vaddr, va);\n\t\tint len = symbol->size ? symbol->size : 32;\n\t\tSymName sn = {0};\n\n\t\tif (exponly && !isAnExport (symbol)) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif (name && strcmp (r_symbol_name, name)) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif (at && (!symbol->size || !is_in_range (at, addr, symbol->size))) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tif ((printHere && !is_in_range (r->offset, symbol->paddr, len))\n\t\t\t\t&& (printHere && !is_in_range (r->offset, addr, len))) {\n\t\t\tfree (r_symbol_name);\n\t\t\tcontinue;\n\t\t}\n\t\tcount ++;\n\t\tsnInit (r, &sn, symbol, lang);\n\n\t\tif (IS_MODE_SET (mode) && (is_section_symbol (symbol) || is_file_symbol (symbol))) {\n\t\t\t/*\n\t\t\t * Skip section symbols because they will have their own flag.\n\t\t\t * Skip also file symbols because not useful for now.\n\t\t\t */\n\t\t} else if (IS_MODE_SET (mode) && is_special_symbol (symbol)) {\n\t\t\tif (is_arm) {\n\t\t\t\thandle_arm_special_symbol (r, symbol, va);\n\t\t\t}\n\t\t} else if (IS_MODE_SET (mode)) {\n\t\t\t// TODO: provide separate API in RBinPlugin to let plugins handle anal hints/metadata\n\t\t\tif (is_arm) {\n\t\t\t\thandle_arm_symbol (r, symbol, info, va);\n\t\t\t}\n\t\t\tselect_flag_space (r, symbol);\n\t\t\t/* If that's a Classed symbol (method or so) */\n\t\t\tif (sn.classname) {\n\t\t\t\tRFlagItem *fi = r_flag_get (r->flags, sn.methflag);\n\t\t\t\tif (r->bin->prefix) {\n\t\t\t\t\tchar *prname = r_str_newf (\"%s.%s\", r->bin->prefix, sn.methflag);\n\t\t\t\t\tr_name_filter (sn.methflag, -1);\n\t\t\t\t\tfree (sn.methflag);\n\t\t\t\t\tsn.methflag = prname;\n\t\t\t\t}\n\t\t\t\tif (fi) {\n\t\t\t\t\tr_flag_item_set_realname (fi, sn.methname);\n\t\t\t\t\tif ((fi->offset - r->flags->base) == addr) {\n\t\t\t\t//\t\tchar *comment = fi->comment ? strdup (fi->comment) : NULL;\n\t\t\t\t\t\tr_flag_unset (r->flags, fi);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfi = r_flag_set (r->flags, sn.methflag, addr, symbol->size);\n\t\t\t\t\tchar *comment = fi->comment ? strdup (fi->comment) : NULL;\n\t\t\t\t\tif (comment) {\n\t\t\t\t\t\tr_flag_item_set_comment (fi, comment);\n\t\t\t\t\t\tR_FREE (comment);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst char *n = sn.demname ? sn.demname : sn.name;\n\t\t\t\tconst char *fn = sn.demflag ? sn.demflag : sn.nameflag;\n\t\t\t\tchar *fnp = (r->bin->prefix) ?\n\t\t\t\t\tr_str_newf (\"%s.%s\", r->bin->prefix, fn):\n\t\t\t\t\tstrdup (fn);\n\t\t\t\tRFlagItem *fi = r_flag_set (r->flags, fnp, addr, symbol->size);\n\t\t\t\tif (fi) {\n\t\t\t\t\tr_flag_item_set_realname (fi, n);\n\t\t\t\t\tfi->demangled = (bool)(size_t)sn.demname;\n\t\t\t\t} else {\n\t\t\t\t\tif (fn) {\n\t\t\t\t\t\teprintf (\"[Warning] Can't find flag (%s)\\n\", fn);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfree (fnp);\n\t\t\t}\n\t\t\tif (sn.demname) {\n\t\t\t\tr_meta_add (r->anal, R_META_TYPE_COMMENT,\n\t\t\t\t\taddr, symbol->size, sn.demname);\n\t\t\t}\n\t\t\tr_flag_space_pop (r->flags);\n\t\t} else if (IS_MODE_JSON (mode)) {\n\t\t\tchar *str = r_str_escape_utf8_for_json (r_symbol_name, -1);\n\t\t\t// str = r_str_replace (str, \"\\\"\", \"\\\\\\\"\", 1);\n\t\t\tr_cons_printf (\"%s{\\\"name\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"demname\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"flagname\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"ordinal\\\":%d,\"\n\t\t\t\t\"\\\"bind\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"size\\\":%d,\"\n\t\t\t\t\"\\\"type\\\":\\\"%s\\\",\"\n\t\t\t\t\"\\\"vaddr\\\":%\"PFMT64d\",\"\n\t\t\t\t\"\\\"paddr\\\":%\"PFMT64d\"}\",\n\t\t\t\t((exponly && firstexp) || printHere) ? \"\" : (iter->p ? \",\" : \"\"),\n\t\t\t\tstr,\n\t\t\t\tsn.demname? sn.demname: \"\",\n\t\t\t\tsn.nameflag,\n\t\t\t\tsymbol->ordinal,\n\t\t\t\tsymbol->bind,\n\t\t\t\t(int)symbol->size,\n\t\t\t\tsymbol->type,\n\t\t\t\t(ut64)addr, (ut64)symbol->paddr);\n\t\t\tfree (str);\n\t\t} else if (IS_MODE_SIMPLE (mode)) {\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tr_cons_printf (\"0x%08\"PFMT64x\" %d %s\\n\",\n\t\t\t\taddr, (int)symbol->size, name);\n\t\t} else if (IS_MODE_SIMPLEST (mode)) {\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tr_cons_printf (\"%s\\n\", name);\n\t\t} else if (IS_MODE_RAD (mode)) {\n\t\t\t/* Skip special symbols because we do not flag them and\n\t\t\t * they shouldn't be printed in the rad format either */\n\t\t\tif (is_special_symbol (symbol)) {\n\t\t\t\tgoto next;\n\t\t\t}\n\t\t\tRBinFile *binfile;\n\t\t\tRBinPlugin *plugin;\n\t\t\tconst char *name = sn.demname? sn.demname: r_symbol_name;\n\t\t\tif (!name) {\n\t\t\t\tgoto next;\n\t\t\t}\n\t\t\tif (!strncmp (name, \"imp.\", 4)) {\n\t\t\t\tif (lastfs != 'i') {\n\t\t\t\t\tr_cons_printf (\"fs imports\\n\");\n\t\t\t\t}\n\t\t\t\tlastfs = 'i';\n\t\t\t} else {\n\t\t\t\tif (lastfs != 's') {\n\t\t\t\t\tconst char *fs = exponly? \"exports\": \"symbols\";\n\t\t\t\t\tr_cons_printf (\"fs %s\\n\", fs);\n\t\t\t\t}\n\t\t\t\tlastfs = 's';\n\t\t\t}\n\t\t\tif (r->bin->prefix || *name) { // we don't want unnamed symbol flags\n\t\t\t\tchar *flagname = construct_symbol_flagname (\"sym\", name, MAXFLAG_LEN_DEFAULT);\n\t\t\t\tif (!flagname) {\n\t\t\t\t\tgoto next;\n\t\t\t\t}\n\t\t\t\tr_cons_printf (\"\\\"f %s%s%s %u 0x%08\" PFMT64x \"\\\"\\n\",\n\t\t\t\t\tr->bin->prefix ? r->bin->prefix : \"\", r->bin->prefix ? \".\" : \"\",\n\t\t\t\t\tflagname, symbol->size, addr);\n\t\t\t\tfree (flagname);\n\t\t\t}\n\t\t\tbinfile = r_bin_cur (r->bin);\n\t\t\tplugin = r_bin_file_cur_plugin (binfile);\n\t\t\tif (plugin && plugin->name) {\n\t\t\t\tif (r_str_startswith (plugin->name, \"pe\")) {\n\t\t\t\t\tchar *module = strdup (r_symbol_name);\n\t\t\t\t\tchar *p = strstr (module, \".dll_\");\n\t\t\t\t\tif (p && strstr (module, \"imp.\")) {\n\t\t\t\t\t\tchar *symname = __filterShell (p + 5);\n\t\t\t\t\t\tchar *m = __filterShell (module);\n\t\t\t\t\t\t*p = 0;\n\t\t\t\t\t\tif (r->bin->prefix) {\n\t\t\t\t\t\t\tr_cons_printf (\"\\\"k bin/pe/%s/%d=%s.%s\\\"\\n\",\n\t\t\t\t\t\t\t\tmodule, symbol->ordinal, r->bin->prefix, symname);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tr_cons_printf (\"\\\"k bin/pe/%s/%d=%s\\\"\\n\",\n\t\t\t\t\t\t\t\tmodule, symbol->ordinal, symname);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfree (symname);\n\t\t\t\t\t\tfree (m);\n\t\t\t\t\t}\n\t\t\t\t\tfree (module);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst char *bind = symbol->bind? symbol->bind: \"NONE\";\n\t\t\tconst char *type = symbol->type? symbol->type: \"NONE\";\n\t\t\tconst char *name = r_str_get (sn.demname? sn.demname: r_symbol_name);\n\t\t\t// const char *fwd = r_str_get (symbol->forwarder);\n\t\t\tr_cons_printf (\"%03u\", symbol->ordinal);\n\t\t\tif (symbol->paddr == UT64_MAX) {\n\t\t\t\tr_cons_printf (\" ----------\");\n\t\t\t} else {\n\t\t\t\tr_cons_printf (\" 0x%08\"PFMT64x, symbol->paddr);\n\t\t\t}\n\t\t\tr_cons_printf (\" 0x%08\"PFMT64x\" %6s %6s %4d%s%s\\n\",\n\t\t\t addr, bind, type, symbol->size, *name? \" \": \"\", name);\n\t\t}\nnext:\n\t\tsnFini (&sn);\n\t\ti++;\n\t\tfree (r_symbol_name);\n\t\tif (exponly && firstexp) {\n\t\t\tfirstexp = false;\n\t\t}\n\t\tif (printHere) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (count == 0 && IS_MODE_JSON (mode)) {\n\t\tr_cons_printf (\"{}\");\n\t}\n\n\n\t//handle thumb and arm for entry point since they are not present in symbols\n\tif (is_arm) {\n\t\tr_list_foreach (entries, iter, entry) {\n\t\t\tif (IS_MODE_SET (mode)) {\n\t\t\t\thandle_arm_entry (r, entry, info, va);\n\t\t\t}\n\t\t}\n\t}\n\tif (IS_MODE_JSON (mode) && !printHere) {\n\t\tr_cons_printf (\"]\");\n\t}\n\n\tr_spaces_pop (&r->anal->meta_spaces);\n\treturn true;\n}","lang":"c","vul_type":"cwe-078","sven_meta":{"func_name":"bin_symbols","file_name":"libr/core/cbin.c","commit_link":"github.com/radareorg/radare2/commit/5411543a310a470b1257fb93273cdd6e8dfcb3af","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#47-0f61a83ed3f1","input":" def on_message( self, profile_id, profile_name, level, message, timeout ):\n if 1 == level:\n cmd = \"notify-send \"\n if timeout > 0:\n cmd = cmd + \" -t %s\" % (1000 * timeout)\n\n title = \"Back In Time (%s) : %s\" % (self.user, profile_name)\n message = message.replace(\"\\n\", ' ')\n message = message.replace(\"\\r\", '')\n\n cmd = cmd + \" \\\"%s\\\" \\\"%s\\\"\" % (title, message)\n print(cmd)\n os.system(cmd)\n return","target":" def on_message( self, profile_id, profile_name, level, message, timeout ):\n if 1 == level:\n cmd = ['notify-send']\n if timeout > 0:\n cmd.extend(['-t', str(1000 * timeout)])\n\n title = \"Back In Time (%s) : %s\" % (self.user, profile_name)\n message = message.replace(\"\\n\", ' ')\n message = message.replace(\"\\r\", '')\n\n cmd.append(title)\n cmd.append(message)\n subprocess.Popen(cmd).communicate()\n return","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"on_message","file_name":"qt4/plugins/notifyplugin.py","commit_link":"github.com/bit-team/backintime/commit/cef81d0da93ff601252607df3db1a48f7f6f01b3","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#48-d9e4237d3d32","input":"void pb_controller::play_file(const std::string& file) {\n\tstd::string cmdline;\n\tstd::string player = cfg->get_configvalue(\"player\");\n\tif (player == \"\")\n\t\treturn;\n\tcmdline.append(player);\n\tcmdline.append(\" \\\"\");\n\tcmdline.append(utils::replace_all(file,\"\\\"\", \"\\\\\\\"\"));\n\tcmdline.append(\"\\\"\");\n\tstfl::reset();\n\tutils::run_interactively(cmdline, \"pb_controller::play_file\");\n}","target":"void pb_controller::play_file(const std::string& file) {\n\tstd::string cmdline;\n\tstd::string player = cfg->get_configvalue(\"player\");\n\tif (player == \"\")\n\t\treturn;\n\tcmdline.append(player);\n\tcmdline.append(\" '\");\n\tcmdline.append(utils::replace_all(file,\"'\", \"%27\"));\n\tcmdline.append(\"'\");\n\tstfl::reset();\n\tutils::run_interactively(cmdline, \"pb_controller::play_file\");\n}","lang":"cpp","vul_type":"cwe-078","sven_meta":{"func_name":"podbeuter::pb_controller::play_file","file_name":"src/pb_controller.cpp","commit_link":"github.com/akrennmair/newsbeuter/commit/c8fea2f60c18ed30bdd1bb6f798e994e51a58260","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#49-e2be0cd0c86e","input":" def _find_host_exhaustive(self, connector, hosts):\n for host in hosts:\n ssh_cmd = 'svcinfo lshost -delim ! %s' % host\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()),\n '_find_host_exhaustive',\n ssh_cmd, out, err)\n for attr_line in out.split('\\n'):\n # If '!' not found, return the string and two empty strings\n attr_name, foo, attr_val = attr_line.partition('!')\n if (attr_name == 'iscsi_name' and\n 'initiator' in connector and\n attr_val == connector['initiator']):\n return host\n elif (attr_name == 'WWPN' and\n 'wwpns' in connector and\n attr_val.lower() in\n map(str.lower, map(str, connector['wwpns']))):\n return host\n return None","target":" def _find_host_exhaustive(self, connector, hosts):\n for host in hosts:\n ssh_cmd = ['svcinfo', 'lshost', '-delim', '!', host]\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()),\n '_find_host_exhaustive',\n ssh_cmd, out, err)\n for attr_line in out.split('\\n'):\n # If '!' not found, return the string and two empty strings\n attr_name, foo, attr_val = attr_line.partition('!')\n if (attr_name == 'iscsi_name' and\n 'initiator' in connector and\n attr_val == connector['initiator']):\n return host\n elif (attr_name == 'WWPN' and\n 'wwpns' in connector and\n attr_val.lower() in\n map(str.lower, map(str, connector['wwpns']))):\n return host\n return None","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_find_host_exhaustive","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#50-0b3e8f1918f8","input":" def _create_vdisk(self, name, size, units, opts):\n \"\"\"Create a new vdisk.\"\"\"\n\n LOG.debug(_('enter: _create_vdisk: vdisk %s ') % name)\n\n model_update = None\n autoex = '-autoexpand' if opts['autoexpand'] else ''\n easytier = '-easytier on' if opts['easytier'] else '-easytier off'\n\n # Set space-efficient options\n if opts['rsize'] == -1:\n ssh_cmd_se_opt = ''\n else:\n ssh_cmd_se_opt = (\n '-rsize %(rsize)d%% %(autoex)s -warning %(warn)d%%' %\n {'rsize': opts['rsize'],\n 'autoex': autoex,\n 'warn': opts['warning']})\n if opts['compression']:\n ssh_cmd_se_opt = ssh_cmd_se_opt + ' -compressed'\n else:\n ssh_cmd_se_opt = ssh_cmd_se_opt + (\n ' -grainsize %d' % opts['grainsize'])\n\n ssh_cmd = ('svctask mkvdisk -name %(name)s -mdiskgrp %(mdiskgrp)s '\n '-iogrp 0 -size %(size)s -unit '\n '%(unit)s %(easytier)s %(ssh_cmd_se_opt)s'\n % {'name': name,\n 'mdiskgrp': self.configuration.storwize_svc_volpool_name,\n 'size': size, 'unit': units, 'easytier': easytier,\n 'ssh_cmd_se_opt': ssh_cmd_se_opt})\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), '_create_vdisk',\n ssh_cmd, out, err)\n\n # Ensure that the output is as expected\n match_obj = re.search('Virtual Disk, id \\[([0-9]+)\\], '\n 'successfully created', out)\n # Make sure we got a \"successfully created\" message with vdisk id\n self._driver_assert(\n match_obj is not None,\n _('_create_vdisk %(name)s - did not find '\n 'success message in CLI output.\\n '\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'name': name, 'out': str(out), 'err': str(err)})\n\n LOG.debug(_('leave: _create_vdisk: volume %s ') % name)","target":" def _create_vdisk(self, name, size, units, opts):\n \"\"\"Create a new vdisk.\"\"\"\n\n LOG.debug(_('enter: _create_vdisk: vdisk %s ') % name)\n\n model_update = None\n easytier = 'on' if opts['easytier'] else 'off'\n\n # Set space-efficient options\n if opts['rsize'] == -1:\n ssh_cmd_se_opt = []\n else:\n ssh_cmd_se_opt = ['-rsize', '%s%%' % str(opts['rsize']),\n '-autoexpand', '-warning',\n '%s%%' % str(opts['warning'])]\n if not opts['autoexpand']:\n ssh_cmd_se_opt.remove('-autoexpand')\n\n if opts['compression']:\n ssh_cmd_se_opt.append('-compressed')\n else:\n ssh_cmd_se_opt.extend(['-grainsize', str(opts['grainsize'])])\n\n ssh_cmd = ['svctask', 'mkvdisk', '-name', name, '-mdiskgrp',\n self.configuration.storwize_svc_volpool_name,\n '-iogrp', '0', '-size', size, '-unit',\n units, '-easytier', easytier] + ssh_cmd_se_opt\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return(len(out.strip()), '_create_vdisk',\n ssh_cmd, out, err)\n\n # Ensure that the output is as expected\n match_obj = re.search('Virtual Disk, id \\[([0-9]+)\\], '\n 'successfully created', out)\n # Make sure we got a \"successfully created\" message with vdisk id\n self._driver_assert(\n match_obj is not None,\n _('_create_vdisk %(name)s - did not find '\n 'success message in CLI output.\\n '\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'name': name, 'out': str(out), 'err': str(err)})\n\n LOG.debug(_('leave: _create_vdisk: volume %s ') % name)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_create_vdisk","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#51-ff53f932fe8f","input":" def test_invalid_iscsi_ip(self):\n self.flags(lock_path=self.tempdir)\n\n #record driver set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = 'showport'\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = 'showport -iscsi'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = 'showport -iscsiname'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n config = self.setup_configuration()\n config.hp3par_iscsi_ips = ['10.10.220.250', '10.10.220.251']\n config.iscsi_ip_address = '10.10.10.10'\n self.mox.ReplayAll()\n\n # no valid ip addr should be configured.\n self.assertRaises(exception.InvalidInput,\n self.setup_driver,\n config,\n set_up_fakes=False)","target":" def test_invalid_iscsi_ip(self):\n self.flags(lock_path=self.tempdir)\n\n #record driver set up\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = ['showport']\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = ['showport', '-iscsi']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = ['showport', '-iscsiname']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI), ''])\n\n config = self.setup_configuration()\n config.hp3par_iscsi_ips = ['10.10.220.250', '10.10.220.251']\n config.iscsi_ip_address = '10.10.10.10'\n self.mox.ReplayAll()\n\n # no valid ip addr should be configured.\n self.assertRaises(exception.InvalidInput,\n self.setup_driver,\n config,\n set_up_fakes=False)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_invalid_iscsi_ip","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#52-7eebfc1fd84c","input":"def get_output(command: str) -> bytes:\n \"\"\"\n Run a command and return raw output\n\n :param str command: the command to run\n :returns: the stdout output of the command\n \"\"\"\n return subprocess.check_output(command.split())","target":"def get_output(command: List[str]) -> str:\n \"\"\"\n Run a command and return raw output\n\n :param str command: the command to run\n :returns: the stdout output of the command\n \"\"\"\n result = subprocess.run(command, stdout=subprocess.PIPE, check=True)\n return result.stdout.decode()","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"get_output","file_name":"isort/hooks.py","commit_link":"github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#53-d45aca8d5adb","input":"openscript(\n char_u\t*name,\n int\t\tdirectly)\t/* when TRUE execute directly */\n{\n if (curscript + 1 == NSCRIPT)\n {\n\temsg(_(e_nesting));\n\treturn;\n }\n#ifdef FEAT_EVAL\n if (ignore_script)\n\t/* Not reading from script, also don't open one. Warning message? */\n\treturn;\n#endif\n\n if (scriptin[curscript] != NULL)\t/* already reading script */\n\t++curscript;\n\t\t\t\t/* use NameBuff for expanded name */\n expand_env(name, NameBuff, MAXPATHL);\n if ((scriptin[curscript] = mch_fopen((char *)NameBuff, READBIN)) == NULL)\n {\n\tsemsg(_(e_notopen), name);\n\tif (curscript)\n\t --curscript;\n\treturn;\n }\n if (save_typebuf() == FAIL)\n\treturn;\n\n /*\n * Execute the commands from the file right now when using \":source!\"\n * after \":global\" or \":argdo\" or in a loop. Also when another command\n * follows. This means the display won't be updated. Don't do this\n * always, \"make test\" would fail.\n */\n if (directly)\n {\n\toparg_T\toa;\n\tint\toldcurscript;\n\tint\tsave_State = State;\n\tint\tsave_restart_edit = restart_edit;\n\tint\tsave_insertmode = p_im;\n\tint\tsave_finish_op = finish_op;\n\tint\tsave_msg_scroll = msg_scroll;\n\n\tState = NORMAL;\n\tmsg_scroll = FALSE;\t/* no msg scrolling in Normal mode */\n\trestart_edit = 0;\t/* don't go to Insert mode */\n\tp_im = FALSE;\t\t/* don't use 'insertmode' */\n\tclear_oparg(&oa);\n\tfinish_op = FALSE;\n\n\toldcurscript = curscript;\n\tdo\n\t{\n\t update_topline_cursor();\t// update cursor position and topline\n\t normal_cmd(&oa, FALSE);\t// execute one command\n\t vpeekc();\t\t\t// check for end of file\n\t}\n\twhile (scriptin[oldcurscript] != NULL);\n\n\tState = save_State;\n\tmsg_scroll = save_msg_scroll;\n\trestart_edit = save_restart_edit;\n\tp_im = save_insertmode;\n\tfinish_op = save_finish_op;\n }\n}","target":"openscript(\n char_u\t*name,\n int\t\tdirectly)\t/* when TRUE execute directly */\n{\n if (curscript + 1 == NSCRIPT)\n {\n\temsg(_(e_nesting));\n\treturn;\n }\n\n // Disallow sourcing a file in the sandbox, the commands would be executed\n // later, possibly outside of the sandbox.\n if (check_secure())\n\treturn;\n\n#ifdef FEAT_EVAL\n if (ignore_script)\n\t/* Not reading from script, also don't open one. Warning message? */\n\treturn;\n#endif\n\n if (scriptin[curscript] != NULL)\t/* already reading script */\n\t++curscript;\n\t\t\t\t/* use NameBuff for expanded name */\n expand_env(name, NameBuff, MAXPATHL);\n if ((scriptin[curscript] = mch_fopen((char *)NameBuff, READBIN)) == NULL)\n {\n\tsemsg(_(e_notopen), name);\n\tif (curscript)\n\t --curscript;\n\treturn;\n }\n if (save_typebuf() == FAIL)\n\treturn;\n\n /*\n * Execute the commands from the file right now when using \":source!\"\n * after \":global\" or \":argdo\" or in a loop. Also when another command\n * follows. This means the display won't be updated. Don't do this\n * always, \"make test\" would fail.\n */\n if (directly)\n {\n\toparg_T\toa;\n\tint\toldcurscript;\n\tint\tsave_State = State;\n\tint\tsave_restart_edit = restart_edit;\n\tint\tsave_insertmode = p_im;\n\tint\tsave_finish_op = finish_op;\n\tint\tsave_msg_scroll = msg_scroll;\n\n\tState = NORMAL;\n\tmsg_scroll = FALSE;\t/* no msg scrolling in Normal mode */\n\trestart_edit = 0;\t/* don't go to Insert mode */\n\tp_im = FALSE;\t\t/* don't use 'insertmode' */\n\tclear_oparg(&oa);\n\tfinish_op = FALSE;\n\n\toldcurscript = curscript;\n\tdo\n\t{\n\t update_topline_cursor();\t// update cursor position and topline\n\t normal_cmd(&oa, FALSE);\t// execute one command\n\t vpeekc();\t\t\t// check for end of file\n\t}\n\twhile (scriptin[oldcurscript] != NULL);\n\n\tState = save_State;\n\tmsg_scroll = save_msg_scroll;\n\trestart_edit = save_restart_edit;\n\tp_im = save_insertmode;\n\tfinish_op = save_finish_op;\n }\n}","lang":"c","vul_type":"cwe-078","sven_meta":{"func_name":"openscript","file_name":"src/getchar.c","commit_link":"github.com/vim/vim/commit/53575521406739cf20bbe4e384d88e7dca11f040","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#54-3e841e7e2ab2","input":"def add_user(username, password):\n encPass = crypt.crypt(password,\"22\")\n os.system(\"useradd -G docker,wheel -p \"+encPass+\" \"+username)","target":"def add_user(username, password):\n encPass = crypt.crypt(password,\"22\")\n #subprocess escapes the username stopping code injection\n subprocess.call(['useradd','-G','docker,wheel','-p',encPass,username])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"add_user","file_name":"vuedj/configtitania/views.py","commit_link":"github.com/Internet-of-People/titania-os/commit/9b7805119938343fcac9dc929d8882f1d97cf14a","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#55-ffc3a976b27f","input":" def write_section(self, section_name, section_data):\n self.write_line(\"\")\n self.write_line(\"define %s {\" % section_name)\n sorted_keys = section_data.keys()\n sorted_keys.sort()\n for key in sorted_keys:\n value = section_data[key]\n self.icinga_lines.append((\"%s%-45s%s\" % (self.indent, key, self.value_to_icinga(value))))\n self.write_line(\"}\")","target":" def write_section(self, section_name, section_data):\n self.write_line(\"\")\n self.write_line(\"define %s {\" % section_name)\n sorted_keys = section_data.keys()\n sorted_keys.sort()\n for key in sorted_keys:\n value = self.value_to_icinga(section_data[key])\n icinga_line = \"%s%-45s%s\" % (self.indent, key, value)\n\n if \"\\n\" in icinga_line or \"}\" in icinga_line:\n msg = \"Found forbidden newline or '}' character in section %r.\"\n raise Exception(msg % section_name)\n\n self.icinga_lines.append(icinga_line)\n self.write_line(\"}\")","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"write_section","file_name":"src/main/python/monitoring_config_generator/MonitoringConfigGenerator.py","commit_link":"github.com/Scout24/monitoring-config-generator/commit/a4b01b72d2e3d6ec2600c384a77f675fa9bbf6b7","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#56-0f9c9f940fdd","input":" def _update_volume_stats(self):\n \"\"\"Retrieve stats info from volume group.\"\"\"\n\n LOG.debug(_(\"Updating volume stats\"))\n data = {}\n\n data['vendor_name'] = 'IBM'\n data['driver_version'] = '1.1'\n data['storage_protocol'] = list(self._enabled_protocols)\n\n data['total_capacity_gb'] = 0 # To be overwritten\n data['free_capacity_gb'] = 0 # To be overwritten\n data['reserved_percentage'] = 0\n data['QoS_support'] = False\n\n pool = self.configuration.storwize_svc_volpool_name\n #Get storage system name\n ssh_cmd = 'svcinfo lssystem -delim !'\n attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes or not attributes['name']:\n exception_message = (_('_update_volume_stats: '\n 'Could not get system name'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n backend_name = self.configuration.safe_get('volume_backend_name')\n if not backend_name:\n backend_name = '%s_%s' % (attributes['name'], pool)\n data['volume_backend_name'] = backend_name\n\n ssh_cmd = 'svcinfo lsmdiskgrp -bytes -delim ! %s' % pool\n attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes:\n LOG.error(_('Could not get pool data from the storage'))\n exception_message = (_('_update_volume_stats: '\n 'Could not get storage pool data'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n data['total_capacity_gb'] = (float(attributes['capacity']) /\n (1024 ** 3))\n data['free_capacity_gb'] = (float(attributes['free_capacity']) /\n (1024 ** 3))\n data['easytier_support'] = attributes['easy_tier'] in ['on', 'auto']\n data['compression_support'] = self._compression_enabled\n\n self._stats = data","target":" def _update_volume_stats(self):\n \"\"\"Retrieve stats info from volume group.\"\"\"\n\n LOG.debug(_(\"Updating volume stats\"))\n data = {}\n\n data['vendor_name'] = 'IBM'\n data['driver_version'] = '1.1'\n data['storage_protocol'] = list(self._enabled_protocols)\n\n data['total_capacity_gb'] = 0 # To be overwritten\n data['free_capacity_gb'] = 0 # To be overwritten\n data['reserved_percentage'] = 0\n data['QoS_support'] = False\n\n pool = self.configuration.storwize_svc_volpool_name\n #Get storage system name\n ssh_cmd = ['svcinfo', 'lssystem', '-delim', '!']\n attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes or not attributes['name']:\n exception_message = (_('_update_volume_stats: '\n 'Could not get system name'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n backend_name = self.configuration.safe_get('volume_backend_name')\n if not backend_name:\n backend_name = '%s_%s' % (attributes['name'], pool)\n data['volume_backend_name'] = backend_name\n\n ssh_cmd = ['svcinfo', 'lsmdiskgrp', '-bytes', '-delim', '!', pool]\n attributes = self._execute_command_and_parse_attributes(ssh_cmd)\n if not attributes:\n LOG.error(_('Could not get pool data from the storage'))\n exception_message = (_('_update_volume_stats: '\n 'Could not get storage pool data'))\n raise exception.VolumeBackendAPIException(data=exception_message)\n\n data['total_capacity_gb'] = (float(attributes['capacity']) /\n (1024 ** 3))\n data['free_capacity_gb'] = (float(attributes['free_capacity']) /\n (1024 ** 3))\n data['easytier_support'] = attributes['easy_tier'] in ['on', 'auto']\n data['compression_support'] = self._compression_enabled\n\n self._stats = data","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_update_volume_stats","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#57-8035e4e0e399","input":" def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack(NO_FC_HOST_RET), ''])\n\n create_host_cmd = ('createhost -add fakehost '\n '123456789012345 123456789054321')\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack(FC_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","target":" def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack(NO_FC_HOST_RET), ''])\n\n create_host_cmd = ['createhost', '-add', 'fakehost', '123456789012345',\n '123456789054321']\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack(FC_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_create_modify_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#58-7d028af803b1","input":"def install(filename, target):\n '''Run a package's installer script against the given target directory.'''\n print(' Unpacking %s...' % filename)\n os.system('tar xf ' + filename)\n basename = filename.split('.tar')[0]\n print(' Installing %s...' % basename)\n install_opts = '--prefix=${PWD}/%s --disable-ldconfig' % target\n os.system('%s/install.sh %s' % (basename, install_opts))\n print(' Cleaning %s...' % basename)\n os.system('rm -rf %s' % basename)","target":"def install(filename, target):\n '''Run a package's installer script against the given target directory.'''\n print(' Unpacking %s...' % filename)\n subprocess.check_call(['tar', 'xf', filename])\n basename = filename.split('.tar')[0]\n print(' Installing %s...' % basename)\n install_cmd = [os.path.join(basename, 'install.sh')]\n install_cmd += ['--prefix=' + os.path.abspath(target)]\n install_cmd += ['--disable-ldconfig']\n subprocess.check_call(install_cmd)\n print(' Cleaning %s...' % basename)\n subprocess.check_call(['rm', '-rf', basename])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"install","file_name":"repack_rust.py","commit_link":"github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#59-a64989f2b4c7","input":" def _get_least_used_nsp(self, nspss):\n \"\"\"\"Return the nsp that has the fewest active vluns.\"\"\"\n # return only the nsp (node:server:port)\n result = self.common._cli_run('showvlun -a -showcols Port', None)\n\n # count the number of nsps (there is 1 for each active vlun)\n nsp_counts = {}\n for nsp in nspss:\n # initialize counts to zero\n nsp_counts[nsp] = 0\n\n current_least_used_nsp = None\n if result:\n # first line is header\n result = result[1:]\n for line in result:\n nsp = line.strip()\n if nsp in nsp_counts:\n nsp_counts[nsp] = nsp_counts[nsp] + 1\n\n # identify key (nsp) of least used nsp\n current_smallest_count = sys.maxint\n for (nsp, count) in nsp_counts.iteritems():\n if count < current_smallest_count:\n current_least_used_nsp = nsp\n current_smallest_count = count\n\n return current_least_used_nsp","target":" def _get_least_used_nsp(self, nspss):\n \"\"\"\"Return the nsp that has the fewest active vluns.\"\"\"\n # return only the nsp (node:server:port)\n result = self.common._cli_run(['showvlun', '-a', '-showcols', 'Port'])\n\n # count the number of nsps (there is 1 for each active vlun)\n nsp_counts = {}\n for nsp in nspss:\n # initialize counts to zero\n nsp_counts[nsp] = 0\n\n current_least_used_nsp = None\n if result:\n # first line is header\n result = result[1:]\n for line in result:\n nsp = line.strip()\n if nsp in nsp_counts:\n nsp_counts[nsp] = nsp_counts[nsp] + 1\n\n # identify key (nsp) of least used nsp\n current_smallest_count = sys.maxint\n for (nsp, count) in nsp_counts.iteritems():\n if count < current_smallest_count:\n current_least_used_nsp = nsp\n current_smallest_count = count\n\n return current_least_used_nsp","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_least_used_nsp","file_name":"cinder/volume/drivers/san/hp/hp_3par_iscsi.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#60-c75fbfbaf6b5","input":" def _start_fc_map(self, fc_map_id, source, target):\n try:\n out, err = self._run_ssh('svctask startfcmap %s' % fc_map_id)\n except exception.ProcessExecutionError as e:\n with excutils.save_and_reraise_exception():\n LOG.error(_('_start_fc_map: Failed to start FlashCopy '\n 'from %(source)s to %(target)s.\\n'\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'source': source,\n 'target': target,\n 'out': e.stdout,\n 'err': e.stderr})","target":" def _start_fc_map(self, fc_map_id, source, target):\n try:\n out, err = self._run_ssh(['svctask', 'startfcmap', fc_map_id])\n except exception.ProcessExecutionError as e:\n with excutils.save_and_reraise_exception():\n LOG.error(_('_start_fc_map: Failed to start FlashCopy '\n 'from %(source)s to %(target)s.\\n'\n 'stdout: %(out)s\\n stderr: %(err)s')\n % {'source': source,\n 'target': target,\n 'out': e.stdout,\n 'err': e.stderr})","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_start_fc_map","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#61-dc3536a3c0b9","input":"@then(parsers.parse(\"the hostname '{hostname}' should be resolved\"))\ndef resolve_hostname(busybox_pod, host, hostname):\n with host.sudo():\n # test dns resolve\n cmd_nslookup = (\"kubectl --kubeconfig=/etc/kubernetes/admin.conf\"\n \" exec -ti {0} nslookup {1}\".format(\n pod_name,\n hostname))\n res = host.run(cmd_nslookup)\n assert res.rc == 0, \"Cannot resolve {}\".format(hostname)","target":"@then(parsers.parse(\"the hostname '{hostname}' should be resolved\"))\ndef resolve_hostname(busybox_pod, host, hostname):\n with host.sudo():\n # test dns resolve\n result = host.run(\n \"kubectl --kubeconfig=/etc/kubernetes/admin.conf \"\n \"exec -ti %s nslookup %s\",\n busybox_pod,\n hostname,\n )\n\n assert result.rc == 0, \"Cannot resolve {}\".format(hostname)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"resolve_hostname","file_name":"tests/post/steps/test_dns.py","commit_link":"github.com/scality/metalk8s/commit/82d92836d4ff78c623a0e06302c94cfa5ff79908","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#62-a97be4ff9b58","input":" def _modify_3par_fibrechan_host(self, hostname, wwn):\n # when using -add, you can not send the persona or domain options\n out = self.common._cli_run('createhost -add %s %s'\n % (hostname, \" \".join(wwn)), None)","target":" def _modify_3par_fibrechan_host(self, hostname, wwns):\n # when using -add, you can not send the persona or domain options\n command = ['createhost', '-add', hostname]\n for wwn in wwns:\n command.append(wwn)\n\n out = self.common._cli_run(command)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_modify_3par_fibrechan_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_fc.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#63-30c0e48002c5","input":"def test_settings_path_skip_issue_909(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'skip =\\n'\n ' file_to_be_skipped.py\\n'\n 'skip_glob =\\n'\n ' *glob_skip*\\n')\n\n base_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')\n base_dir.join('file_to_be_skipped.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')\n\n test_run_directory = os.getcwd()\n os.chdir(str(base_dir))\n with pytest.raises(Exception): # without the settings path provided: the command should not skip & identify errors\n check_output(['isort', '--check-only'])\n results = check_output(['isort', '--check-only', '--settings-path=conf/.isort.cfg'])\n os.chdir(str(test_run_directory))\n\n assert b'skipped 2' in results.lower()","target":"def test_settings_path_skip_issue_909(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'skip =\\n'\n ' file_to_be_skipped.py\\n'\n 'skip_glob =\\n'\n ' *glob_skip*\\n')\n\n base_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')\n base_dir.join('file_to_be_skipped.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')\n\n test_run_directory = os.getcwd()\n os.chdir(str(base_dir))\n with pytest.raises(Exception): # without the settings path provided: the command should not skip & identify errors\n subprocess.run(['isort', '--check-only'], check=True)\n result = subprocess.run(\n ['isort', '--check-only', '--settings-path=conf/.isort.cfg'],\n stdout=subprocess.PIPE,\n check=True\n )\n os.chdir(str(test_run_directory))\n\n assert b'skipped 2' in result.stdout.lower()","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_settings_path_skip_issue_909","file_name":"test_isort.py","commit_link":"github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#64-212385c8f6d5","input":" def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id):\n \"\"\"Create a 3PAR host.\n\n Create a 3PAR host, if there is already a host on the 3par using\n the same wwn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"\n out = self.common._cli_run('createhost -persona %s -domain %s %s %s'\n % (persona_id, domain,\n hostname, \" \".join(wwn)), None)\n if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)\n\n return hostname","target":" def _create_3par_fibrechan_host(self, hostname, wwns, domain, persona_id):\n \"\"\"Create a 3PAR host.\n\n Create a 3PAR host, if there is already a host on the 3par using\n the same wwn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"\n command = ['createhost', '-persona', persona_id, '-domain', domain,\n hostname]\n for wwn in wwns:\n command.append(wwn)\n\n out = self.common._cli_run(command)\n if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)\n\n return hostname","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_create_3par_fibrechan_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_fc.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#65-c6c5f37df5b7","input":" def take_bug_report(self, test_name, begin_time):\n \"\"\"Takes a bug report on the device and stores it in a file.\n\n Args:\n test_name: Name of the test case that triggered this bug report.\n begin_time: Logline format timestamp taken when the test started.\n \"\"\"\n new_br = True\n try:\n stdout = self.adb.shell('bugreportz -v').decode('utf-8')\n # This check is necessary for builds before N, where adb shell's ret\n # code and stderr are not propagated properly.\n if 'not found' in stdout:\n new_br = False\n except adb.AdbError:\n new_br = False\n br_path = os.path.join(self.log_path, 'BugReports')\n utils.create_dir(br_path)\n base_name = ',%s,%s.txt' % (begin_time, self.serial)\n if new_br:\n base_name = base_name.replace('.txt', '.zip')\n test_name_len = utils.MAX_FILENAME_LEN - len(base_name)\n out_name = test_name[:test_name_len] + base_name\n full_out_path = os.path.join(br_path, out_name.replace(' ', r'\\ '))\n # in case device restarted, wait for adb interface to return\n self.wait_for_boot_completion()\n self.log.info('Taking bugreport for %s.', test_name)\n if new_br:\n out = self.adb.shell('bugreportz').decode('utf-8')\n if not out.startswith('OK'):\n raise DeviceError(self, 'Failed to take bugreport: %s' % out)\n br_out_path = out.split(':')[1].strip()\n self.adb.pull('%s %s' % (br_out_path, full_out_path))\n else:\n self.adb.bugreport(' > %s' % full_out_path)\n self.log.info('Bugreport for %s taken at %s.', test_name,\n full_out_path)","target":" def take_bug_report(self, test_name, begin_time):\n \"\"\"Takes a bug report on the device and stores it in a file.\n\n Args:\n test_name: Name of the test case that triggered this bug report.\n begin_time: Logline format timestamp taken when the test started.\n \"\"\"\n new_br = True\n try:\n stdout = self.adb.shell('bugreportz -v').decode('utf-8')\n # This check is necessary for builds before N, where adb shell's ret\n # code and stderr are not propagated properly.\n if 'not found' in stdout:\n new_br = False\n except adb.AdbError:\n new_br = False\n br_path = os.path.join(self.log_path, 'BugReports')\n utils.create_dir(br_path)\n base_name = ',%s,%s.txt' % (begin_time, self.serial)\n if new_br:\n base_name = base_name.replace('.txt', '.zip')\n test_name_len = utils.MAX_FILENAME_LEN - len(base_name)\n out_name = test_name[:test_name_len] + base_name\n full_out_path = os.path.join(br_path, out_name.replace(' ', r'\\ '))\n # in case device restarted, wait for adb interface to return\n self.wait_for_boot_completion()\n self.log.info('Taking bugreport for %s.', test_name)\n if new_br:\n out = self.adb.shell('bugreportz').decode('utf-8')\n if not out.startswith('OK'):\n raise DeviceError(self, 'Failed to take bugreport: %s' % out)\n br_out_path = out.split(':')[1].strip()\n self.adb.pull([br_out_path, full_out_path])\n else:\n # shell=True as this command redirects the stdout to a local file\n # using shell redirection.\n self.adb.bugreport(' > %s' % full_out_path, shell=True)\n self.log.info('Bugreport for %s taken at %s.', test_name,\n full_out_path)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"take_bug_report","file_name":"mobly/controllers/android_device.py","commit_link":"github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#66-a63bbfd97879","input":" def test_create_invalid_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = ('createhost -iscsi -persona 1 -domain '\n '(\\'OpenStack\\',) '\n 'fakehost iqn.1993-08.org.debian:01:222')\n in_use_ret = pack('\\r\\nalready used by host fakehost.foo ')\n _run_ssh(create_host_cmd, False).AndReturn([in_use_ret, ''])\n\n show_3par_cmd = 'showhost -verbose fakehost.foo'\n _run_ssh(show_3par_cmd, False).AndReturn([pack(ISCSI_3PAR_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n\n self.assertEquals(host['name'], 'fakehost.foo')","target":" def test_create_invalid_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack('no hosts listed'), ''])\n\n create_host_cmd = (['createhost', '-iscsi', '-persona', '1', '-domain',\n ('OpenStack',), 'fakehost',\n 'iqn.1993-08.org.debian:01:222'])\n in_use_ret = pack('\\r\\nalready used by host fakehost.foo ')\n _run_ssh(create_host_cmd, False).AndReturn([in_use_ret, ''])\n\n show_3par_cmd = ['showhost', '-verbose', 'fakehost.foo']\n _run_ssh(show_3par_cmd, False).AndReturn([pack(ISCSI_3PAR_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n\n self.assertEquals(host['name'], 'fakehost.foo')","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_create_invalid_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#67-710824cc00da","input":" def adb_call(*args):\n clean_name = name.replace('_', '-')\n arg_str = ' '.join(str(elem) for elem in args)\n return self._exec_adb_cmd(clean_name, arg_str)","target":" def adb_call(args=None, shell=False):\n \"\"\"Wrapper for an ADB command.\n\n Args:\n args: string or list of strings, arguments to the adb command.\n See subprocess.Proc() documentation.\n shell: bool, True to run this command through the system shell,\n False to invoke it directly. See subprocess.Proc() docs.\n\n Returns:\n The output of the adb command run if exit code is 0.\n \"\"\"\n args = args or ''\n clean_name = name.replace('_', '-')\n return self._exec_adb_cmd(clean_name, args, shell=shell)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"__getattr__.adb_call","file_name":"mobly/controllers/android_device_lib/adb.py","commit_link":"github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#68-cfef6e3f1ddb","input":"def test_skip_paths_issue_938(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'line_length = 88\\n'\n 'multi_line_output = 4\\n'\n 'lines_after_imports = 2\\n'\n 'skip_glob =\\n'\n ' migrations/**.py\\n')\n base_dir.join('dont_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')\n\n migrations_dir = base_dir.mkdir('migrations')\n migrations_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')\n\n test_run_directory = os.getcwd()\n os.chdir(str(base_dir))\n results = check_output(['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'])\n os.chdir(str(test_run_directory))\n\n assert b'skipped' not in results.lower()\n\n os.chdir(str(base_dir))\n results = check_output(['isort', '--filter-files', '--settings-path=conf/.isort.cfg', 'dont_skip.py', 'migrations/file_glob_skip.py'])\n os.chdir(str(test_run_directory))\n\n assert b'skipped 1' in results.lower()","target":"def test_skip_paths_issue_938(tmpdir):\n base_dir = tmpdir.mkdir('project')\n config_dir = base_dir.mkdir('conf')\n config_dir.join('.isort.cfg').write('[isort]\\n'\n 'line_length = 88\\n'\n 'multi_line_output = 4\\n'\n 'lines_after_imports = 2\\n'\n 'skip_glob =\\n'\n ' migrations/**.py\\n')\n base_dir.join('dont_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")'\n '\\n'\n 'import sys\\n')\n\n migrations_dir = base_dir.mkdir('migrations')\n migrations_dir.join('file_glob_skip.py').write('import os\\n'\n '\\n'\n 'print(\"Hello World\")\\n'\n '\\n'\n 'import sys\\n')\n\n test_run_directory = os.getcwd()\n os.chdir(str(base_dir))\n result = subprocess.run(\n ['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'],\n stdout=subprocess.PIPE,\n check=True,\n )\n os.chdir(str(test_run_directory))\n\n assert b'skipped' not in result.stdout.lower()\n\n os.chdir(str(base_dir))\n result = subprocess.run(\n ['isort', '--filter-files', '--settings-path=conf/.isort.cfg', 'dont_skip.py', 'migrations/file_glob_skip.py'],\n stdout=subprocess.PIPE,\n check=True,\n )\n os.chdir(str(test_run_directory))\n\n assert b'skipped 1' in result.stdout.lower()","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_skip_paths_issue_938","file_name":"test_isort.py","commit_link":"github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#69-4fda1d07f940","input":" def _ensure_vdisk_no_fc_mappings(self, name, allow_snaps=True):\n # Ensure vdisk has no FlashCopy mappings\n mapping_ids = self._get_vdisk_fc_mappings(name)\n while len(mapping_ids):\n wait_for_copy = False\n for map_id in mapping_ids:\n attrs = self._get_flashcopy_mapping_attributes(map_id)\n if not attrs:\n continue\n source = attrs['source_vdisk_name']\n target = attrs['target_vdisk_name']\n copy_rate = attrs['copy_rate']\n status = attrs['status']\n\n if copy_rate == '0':\n # Case #2: A vdisk that has snapshots\n if source == name:\n if not allow_snaps:\n return False\n ssh_cmd = ('svctask chfcmap -copyrate 50 '\n '-autodelete on %s' % map_id)\n out, err = self._run_ssh(ssh_cmd)\n wait_for_copy = True\n # Case #3: A snapshot\n else:\n msg = (_('Vdisk %(name)s not involved in '\n 'mapping %(src)s -> %(tgt)s') %\n {'name': name, 'src': source, 'tgt': target})\n self._driver_assert(target == name, msg)\n if status in ['copying', 'prepared']:\n self._run_ssh('svctask stopfcmap %s' % map_id)\n elif status in ['stopping', 'preparing']:\n wait_for_copy = True\n else:\n self._run_ssh('svctask rmfcmap -force %s' % map_id)\n # Case 4: Copy in progress - wait and will autodelete\n else:\n if status == 'prepared':\n self._run_ssh('svctask stopfcmap %s' % map_id)\n self._run_ssh('svctask rmfcmap -force %s' % map_id)\n elif status == 'idle_or_copied':\n # Prepare failed\n self._run_ssh('svctask rmfcmap -force %s' % map_id)\n else:\n wait_for_copy = True\n if wait_for_copy:\n time.sleep(5)\n mapping_ids = self._get_vdisk_fc_mappings(name)\n return True","target":" def _ensure_vdisk_no_fc_mappings(self, name, allow_snaps=True):\n # Ensure vdisk has no FlashCopy mappings\n mapping_ids = self._get_vdisk_fc_mappings(name)\n while len(mapping_ids):\n wait_for_copy = False\n for map_id in mapping_ids:\n attrs = self._get_flashcopy_mapping_attributes(map_id)\n if not attrs:\n continue\n source = attrs['source_vdisk_name']\n target = attrs['target_vdisk_name']\n copy_rate = attrs['copy_rate']\n status = attrs['status']\n\n if copy_rate == '0':\n # Case #2: A vdisk that has snapshots\n if source == name:\n if not allow_snaps:\n return False\n ssh_cmd = ['svctask', 'chfcmap', '-copyrate', '50',\n '-autodelete', 'on', map_id]\n out, err = self._run_ssh(ssh_cmd)\n wait_for_copy = True\n # Case #3: A snapshot\n else:\n msg = (_('Vdisk %(name)s not involved in '\n 'mapping %(src)s -> %(tgt)s') %\n {'name': name, 'src': source, 'tgt': target})\n self._driver_assert(target == name, msg)\n if status in ['copying', 'prepared']:\n self._run_ssh(['svctask', 'stopfcmap', map_id])\n elif status in ['stopping', 'preparing']:\n wait_for_copy = True\n else:\n self._run_ssh(['svctask', 'rmfcmap', '-force',\n map_id])\n # Case 4: Copy in progress - wait and will autodelete\n else:\n if status == 'prepared':\n self._run_ssh(['svctask', 'stopfcmap', map_id])\n self._run_ssh(['svctask', 'rmfcmap', '-force', map_id])\n elif status == 'idle_or_copied':\n # Prepare failed\n self._run_ssh(['svctask', 'rmfcmap', '-force', map_id])\n else:\n wait_for_copy = True\n if wait_for_copy:\n time.sleep(5)\n mapping_ids = self._get_vdisk_fc_mappings(name)\n return True","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_ensure_vdisk_no_fc_mappings","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#70-1eb822794898","input":" def tcp_forward(self, host_port, device_port):\n \"\"\"Starts tcp forwarding.\n\n Args:\n host_port: Port number to use on the computer.\n device_port: Port number to use on the android device.\n \"\"\"\n self.forward('tcp:%d tcp:%d' % (host_port, device_port))","target":" def tcp_forward(self, host_port, device_port):\n \"\"\"Starts tcp forwarding.\n\n Args:\n host_port: Port number to use on the computer.\n device_port: Port number to use on the android device.\n \"\"\"\n self.forward(['tcp:%d' % host_port, 'tcp:%d' % device_port])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"tcp_forward","file_name":"mobly/controllers/android_device_lib/adb.py","commit_link":"github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#71-40fbd4edf7d3","input":"def repack(host, targets, channel='stable'):\n url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'\n req = requests.get(url)\n req.raise_for_status()\n manifest = toml.loads(req.content)\n if manifest['manifest-version'] != '2':\n print('ERROR: unrecognized manifest version %s.' % manifest['manifest-version'])\n return\n print('Using manifest for rust %s as of %s.' % (channel, manifest['date']))\n rustc_version, rustc = package(manifest, 'rustc', host)\n if rustc['available']:\n print('rustc %s\\n %s\\n %s' % (rustc_version, rustc['url'], rustc['hash']))\n fetch(rustc['url'])\n cargo_version, cargo = package(manifest, 'cargo', host)\n if cargo['available']:\n print('cargo %s\\n %s\\n %s' % (cargo_version, cargo['url'], cargo['hash']))\n fetch(cargo['url'])\n stds = []\n for target in targets:\n version, info = package(manifest, 'rust-std', target)\n if info['available']:\n print('rust-std %s\\n %s\\n %s' % (version, info['url'], info['hash']))\n fetch(info['url'])\n stds.append(info)\n print('Installing packages...')\n tar_basename = 'rustc-%s-repack' % host\n install_dir = 'rustc'\n os.system('rm -rf %s' % install_dir)\n install(os.path.basename(rustc['url']), install_dir)\n install(os.path.basename(cargo['url']), install_dir)\n for std in stds:\n install(os.path.basename(std['url']), install_dir)\n print('Tarring %s...' % tar_basename)\n os.system('tar cjf %s.tar.bz2 %s/*' % (tar_basename, install_dir))\n os.system('rm -rf %s' % install_dir)","target":"def repack(host, targets, channel='stable'):\n print(\"Repacking rust for %s...\" % host)\n url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'\n req = requests.get(url)\n req.raise_for_status()\n manifest = toml.loads(req.content)\n if manifest['manifest-version'] != '2':\n print('ERROR: unrecognized manifest version %s.' % manifest['manifest-version'])\n return\n print('Using manifest for rust %s as of %s.' % (channel, manifest['date']))\n rustc_version, rustc = package(manifest, 'rustc', host)\n if rustc['available']:\n print('rustc %s\\n %s\\n %s' % (rustc_version, rustc['url'], rustc['hash']))\n fetch(rustc['url'])\n cargo_version, cargo = package(manifest, 'cargo', host)\n if cargo['available']:\n print('cargo %s\\n %s\\n %s' % (cargo_version, cargo['url'], cargo['hash']))\n fetch(cargo['url'])\n stds = []\n for target in targets:\n version, info = package(manifest, 'rust-std', target)\n if info['available']:\n print('rust-std %s\\n %s\\n %s' % (version, info['url'], info['hash']))\n fetch(info['url'])\n stds.append(info)\n print('Installing packages...')\n tar_basename = 'rustc-%s-repack' % host\n install_dir = 'rustc'\n subprocess.check_call(['rm', '-rf', install_dir])\n install(os.path.basename(rustc['url']), install_dir)\n install(os.path.basename(cargo['url']), install_dir)\n for std in stds:\n install(os.path.basename(std['url']), install_dir)\n print('Tarring %s...' % tar_basename)\n subprocess.check_call(['tar', 'cjf', tar_basename + '.tar.bz2', install_dir])\n subprocess.check_call(['rm', '-rf', install_dir])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"repack","file_name":"repack_rust.py","commit_link":"github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#72-24eb7a11baf8","input":" def extend_volume(self, volume, new_size):\n volume_name = self._get_3par_vol_name(volume['id'])\n old_size = volume.size\n growth_size = int(new_size) - old_size\n LOG.debug(\"Extending Volume %s from %s to %s, by %s GB.\" %\n (volume_name, old_size, new_size, growth_size))\n try:\n self._cli_run(\"growvv -f %s %sg\" % (volume_name, growth_size),\n None)\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error extending volume %s\") % volume)","target":" def extend_volume(self, volume, new_size):\n volume_name = self._get_3par_vol_name(volume['id'])\n old_size = volume.size\n growth_size = int(new_size) - old_size\n LOG.debug(\"Extending Volume %s from %s to %s, by %s GB.\" %\n (volume_name, old_size, new_size, growth_size))\n try:\n self._cli_run(['growvv', '-f', volume_name, '%dg' % growth_size])\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error extending volume %s\") % volume)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"extend_volume","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#73-f2f42b9cbbe4","input":" def _remove_volume_set(self, vvs_name):\n # Must first clear the QoS rules before removing the volume set\n self._cli_run('setqos -clear vvset:%s' % (vvs_name), None)\n self._cli_run('removevvset -f %s' % (vvs_name), None)","target":" def _remove_volume_set(self, vvs_name):\n # Must first clear the QoS rules before removing the volume set\n self._cli_run(['setqos', '-clear', 'vvset:%s' % (vvs_name)])\n self._cli_run(['removevvset', '-f', vvs_name])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_remove_volume_set","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#74-5d2134373ea7","input":" def _get_3par_hostname_from_wwn_iqn(self, wwns_iqn):\n out = self._cli_run('showhost -d', None)\n # wwns_iqn may be a list of strings or a single\n # string. So, if necessary, create a list to loop.\n if not isinstance(wwns_iqn, list):\n wwn_iqn_list = [wwns_iqn]\n else:\n wwn_iqn_list = wwns_iqn\n\n for wwn_iqn in wwn_iqn_list:\n for showhost in out:\n if (wwn_iqn.upper() in showhost.upper()):\n return showhost.split(',')[1]","target":" def _get_3par_hostname_from_wwn_iqn(self, wwns_iqn):\n out = self._cli_run(['showhost', '-d'])\n # wwns_iqn may be a list of strings or a single\n # string. So, if necessary, create a list to loop.\n if not isinstance(wwns_iqn, list):\n wwn_iqn_list = [wwns_iqn]\n else:\n wwn_iqn_list = wwns_iqn\n\n for wwn_iqn in wwn_iqn_list:\n for showhost in out:\n if (wwn_iqn.upper() in showhost.upper()):\n return showhost.split(',')[1]","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_3par_hostname_from_wwn_iqn","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#75-ee319f181670","input":" def get_ports(self):\n # First get the active FC ports\n out = self._cli_run('showport', None)\n\n # strip out header\n # N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type,\n # Protocol,Label,Partner,FailoverState\n out = out[1:len(out) - 2]\n\n ports = {'FC': [], 'iSCSI': {}}\n for line in out:\n tmp = line.split(',')\n\n if tmp:\n if tmp[1] == 'target' and tmp[2] == 'ready':\n if tmp[6] == 'FC':\n ports['FC'].append(tmp[4])\n\n # now get the active iSCSI ports\n out = self._cli_run('showport -iscsi', None)\n\n # strip out header\n # N:S:P,State,IPAddr,Netmask,Gateway,\n # TPGT,MTU,Rate,DHCP,iSNS_Addr,iSNS_Port\n out = out[1:len(out) - 2]\n for line in out:\n tmp = line.split(',')\n\n if tmp and len(tmp) > 2:\n if tmp[1] == 'ready':\n ports['iSCSI'][tmp[2]] = {}\n\n # now get the nsp and iqn\n result = self._cli_run('showport -iscsiname', None)\n if result:\n # first line is header\n # nsp, ip,iqn\n result = result[1:]\n for line in result:\n info = line.split(\",\")\n if info and len(info) > 2:\n if info[1] in ports['iSCSI']:\n nsp = info[0]\n ip_addr = info[1]\n iqn = info[2]\n ports['iSCSI'][ip_addr] = {'nsp': nsp,\n 'iqn': iqn\n }\n\n LOG.debug(\"PORTS = %s\" % pprint.pformat(ports))\n return ports","target":" def get_ports(self):\n # First get the active FC ports\n out = self._cli_run(['showport'])\n\n # strip out header\n # N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type,\n # Protocol,Label,Partner,FailoverState\n out = out[1:len(out) - 2]\n\n ports = {'FC': [], 'iSCSI': {}}\n for line in out:\n tmp = line.split(',')\n\n if tmp:\n if tmp[1] == 'target' and tmp[2] == 'ready':\n if tmp[6] == 'FC':\n ports['FC'].append(tmp[4])\n\n # now get the active iSCSI ports\n out = self._cli_run(['showport', '-iscsi'])\n\n # strip out header\n # N:S:P,State,IPAddr,Netmask,Gateway,\n # TPGT,MTU,Rate,DHCP,iSNS_Addr,iSNS_Port\n out = out[1:len(out) - 2]\n for line in out:\n tmp = line.split(',')\n\n if tmp and len(tmp) > 2:\n if tmp[1] == 'ready':\n ports['iSCSI'][tmp[2]] = {}\n\n # now get the nsp and iqn\n result = self._cli_run(['showport', '-iscsiname'])\n if result:\n # first line is header\n # nsp, ip,iqn\n result = result[1:]\n for line in result:\n info = line.split(\",\")\n if info and len(info) > 2:\n if info[1] in ports['iSCSI']:\n nsp = info[0]\n ip_addr = info[1]\n iqn = info[2]\n ports['iSCSI'][ip_addr] = {'nsp': nsp,\n 'iqn': iqn\n }\n\n LOG.debug(\"PORTS = %s\" % pprint.pformat(ports))\n return ports","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"get_ports","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#76-bd3889ea8301","input":" def test_get_least_used_nsp(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_vlun_cmd = 'showvlun -a -showcols Port'\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n\n self.mox.ReplayAll()\n # in use count 11 12\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:8:1'])\n self.assertEqual(nsp, '0:2:1')\n\n # in use count 11 10\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:2:1'])\n self.assertEqual(nsp, '1:2:1')\n\n # in use count 0 10\n nsp = self.driver._get_least_used_nsp(['1:1:1', '1:2:1'])\n self.assertEqual(nsp, '1:1:1')","target":" def test_get_least_used_nsp(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_vlun_cmd = ['showvlun', '-a', '-showcols', 'Port']\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n _run_ssh(show_vlun_cmd, False).AndReturn([pack(SHOW_VLUN_NONE), ''])\n\n self.mox.ReplayAll()\n # in use count 11 12\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:8:1'])\n self.assertEqual(nsp, '0:2:1')\n\n # in use count 11 10\n nsp = self.driver._get_least_used_nsp(['0:2:1', '1:2:1'])\n self.assertEqual(nsp, '1:2:1')\n\n # in use count 0 10\n nsp = self.driver._get_least_used_nsp(['1:1:1', '1:2:1'])\n self.assertEqual(nsp, '1:1:1')","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_get_least_used_nsp","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#77-2ae9f2223708","input":" def _cmd_to_dict(self, cmd):\n arg_list = cmd.split()\n no_param_args = [\n 'autodelete',\n 'autoexpand',\n 'bytes',\n 'compressed',\n 'force',\n 'nohdr',\n ]\n one_param_args = [\n 'chapsecret',\n 'cleanrate',\n 'copyrate',\n 'delim',\n 'filtervalue',\n 'grainsize',\n 'hbawwpn',\n 'host',\n 'iogrp',\n 'iscsiname',\n 'mdiskgrp',\n 'name',\n 'rsize',\n 'scsi',\n 'size',\n 'source',\n 'target',\n 'unit',\n 'easytier',\n 'warning',\n 'wwpn',\n ]\n\n # Handle the special case of lsnode which is a two-word command\n # Use the one word version of the command internally\n if arg_list[0] in ('svcinfo', 'svctask'):\n if arg_list[1] == 'lsnode':\n if len(arg_list) > 4: # e.g. svcinfo lsnode -delim ! \n ret = {'cmd': 'lsnode', 'node_id': arg_list[-1]}\n else:\n ret = {'cmd': 'lsnodecanister'}\n else:\n ret = {'cmd': arg_list[1]}\n arg_list.pop(0)\n else:\n ret = {'cmd': arg_list[0]}\n\n skip = False\n for i in range(1, len(arg_list)):\n if skip:\n skip = False\n continue\n if arg_list[i][0] == '-':\n if arg_list[i][1:] in no_param_args:\n ret[arg_list[i][1:]] = True\n elif arg_list[i][1:] in one_param_args:\n ret[arg_list[i][1:]] = arg_list[i + 1]\n skip = True\n else:\n raise exception.InvalidInput(\n reason=_('unrecognized argument %s') % arg_list[i])\n else:\n ret['obj'] = arg_list[i]\n return ret","target":" def _cmd_to_dict(self, arg_list):\n no_param_args = [\n 'autodelete',\n 'autoexpand',\n 'bytes',\n 'compressed',\n 'force',\n 'nohdr',\n ]\n one_param_args = [\n 'chapsecret',\n 'cleanrate',\n 'copyrate',\n 'delim',\n 'filtervalue',\n 'grainsize',\n 'hbawwpn',\n 'host',\n 'iogrp',\n 'iscsiname',\n 'mdiskgrp',\n 'name',\n 'rsize',\n 'scsi',\n 'size',\n 'source',\n 'target',\n 'unit',\n 'easytier',\n 'warning',\n 'wwpn',\n ]\n\n # Handle the special case of lsnode which is a two-word command\n # Use the one word version of the command internally\n if arg_list[0] in ('svcinfo', 'svctask'):\n if arg_list[1] == 'lsnode':\n if len(arg_list) > 4: # e.g. svcinfo lsnode -delim ! \n ret = {'cmd': 'lsnode', 'node_id': arg_list[-1]}\n else:\n ret = {'cmd': 'lsnodecanister'}\n else:\n ret = {'cmd': arg_list[1]}\n arg_list.pop(0)\n else:\n ret = {'cmd': arg_list[0]}\n\n skip = False\n for i in range(1, len(arg_list)):\n if skip:\n skip = False\n continue\n if arg_list[i][0] == '-':\n if arg_list[i][1:] in no_param_args:\n ret[arg_list[i][1:]] = True\n elif arg_list[i][1:] in one_param_args:\n ret[arg_list[i][1:]] = arg_list[i + 1]\n skip = True\n else:\n raise exception.InvalidInput(\n reason=_('unrecognized argument %s') % arg_list[i])\n else:\n ret['obj'] = arg_list[i]\n return ret","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_cmd_to_dict","file_name":"cinder/tests/test_storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#78-692aef5d8428","input":" def _cli_run(self, verb, cli_args):\n \"\"\"Runs a CLI command over SSH, without doing any result parsing.\"\"\"\n cli_arg_strings = []\n if cli_args:\n for k, v in cli_args.items():\n if k == '':\n cli_arg_strings.append(\" %s\" % k)\n else:\n cli_arg_strings.append(\" %s=%s\" % (k, v))\n\n cmd = verb + ''.join(cli_arg_strings)\n LOG.debug(\"SSH CMD = %s \" % cmd)\n\n (stdout, stderr) = self._run_ssh(cmd, False)\n\n # we have to strip out the input and exit lines\n tmp = stdout.split(\"\\r\\n\")\n out = tmp[5:len(tmp) - 2]\n return out","target":" def _cli_run(self, cmd):\n \"\"\"Runs a CLI command over SSH, without doing any result parsing.\"\"\"\n LOG.debug(\"SSH CMD = %s \" % cmd)\n\n (stdout, stderr) = self._run_ssh(cmd, False)\n\n # we have to strip out the input and exit lines\n tmp = stdout.split(\"\\r\\n\")\n out = tmp[5:len(tmp) - 2]\n return out","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_cli_run","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#79-e9b1b1bb52d1","input":"def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):\n # XXX see if we want to keep an external call here\n if verbose:\n zipoptions = \"-r\"\n else:\n zipoptions = \"-rq\"\n from distutils.errors import DistutilsExecError\n from distutils.spawn import spawn\n try:\n spawn([\"zip\", zipoptions, zip_filename, base_dir], dry_run=dry_run)\n except DistutilsExecError:\n # XXX really should distinguish between \"couldn't find\n # external 'zip' command\" and \"zip failed\".\n raise ExecError, \\\n (\"unable to create zip file '%s': \"\n \"could neither import the 'zipfile' module nor \"\n \"find a standalone zip utility\") % zip_filename","target":"def _call_external_zip(base_dir, zip_filename, verbose, dry_run, logger):\n # XXX see if we want to keep an external call here\n if verbose:\n zipoptions = \"-r\"\n else:\n zipoptions = \"-rq\"\n cmd = [\"zip\", zipoptions, zip_filename, base_dir]\n if logger is not None:\n logger.info(' '.join(cmd))\n if dry_run:\n return\n import subprocess\n try:\n subprocess.check_call(cmd)\n except subprocess.CalledProcessError:\n # XXX really should distinguish between \"couldn't find\n # external 'zip' command\" and \"zip failed\".\n raise ExecError, \\\n (\"unable to create zip file '%s': \"\n \"could neither import the 'zipfile' module nor \"\n \"find a standalone zip utility\") % zip_filename","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_call_external_zip","file_name":"Lib/shutil.py","commit_link":"github.com/python/cpython/commit/add531a1e55b0a739b0f42582f1c9747e5649ace","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#80-1a5e15258113","input":" def _create_host(self, connector):\n \"\"\"Create a new host on the storage system.\n\n We create a host name and associate it with the given connection\n information.\n\n \"\"\"\n\n LOG.debug(_('enter: _create_host: host %s') % connector['host'])\n\n rand_id = str(random.randint(0, 99999999)).zfill(8)\n host_name = '%s-%s' % (self._connector_to_hostname_prefix(connector),\n rand_id)\n\n # Get all port information from the connector\n ports = []\n if 'initiator' in connector:\n ports.append('-iscsiname %s' % connector['initiator'])\n if 'wwpns' in connector:\n for wwpn in connector['wwpns']:\n ports.append('-hbawwpn %s' % wwpn)\n\n # When creating a host, we need one port\n self._driver_assert(len(ports), _('_create_host: No connector ports'))\n port1 = ports.pop(0)\n ssh_cmd = ('svctask mkhost -force %(port1)s -name \"%(host_name)s\"' %\n {'port1': port1, 'host_name': host_name})\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return('successfully created' in out,\n '_create_host', ssh_cmd, out, err)\n\n # Add any additional ports to the host\n for port in ports:\n ssh_cmd = ('svctask addhostport -force %s %s' % (port, host_name))\n out, err = self._run_ssh(ssh_cmd)\n\n LOG.debug(_('leave: _create_host: host %(host)s - %(host_name)s') %\n {'host': connector['host'], 'host_name': host_name})\n return host_name","target":" def _create_host(self, connector):\n \"\"\"Create a new host on the storage system.\n\n We create a host name and associate it with the given connection\n information.\n\n \"\"\"\n\n LOG.debug(_('enter: _create_host: host %s') % connector['host'])\n\n rand_id = str(random.randint(0, 99999999)).zfill(8)\n host_name = '%s-%s' % (self._connector_to_hostname_prefix(connector),\n rand_id)\n\n # Get all port information from the connector\n ports = []\n if 'initiator' in connector:\n ports.append('-iscsiname %s' % connector['initiator'])\n if 'wwpns' in connector:\n for wwpn in connector['wwpns']:\n ports.append('-hbawwpn %s' % wwpn)\n\n # When creating a host, we need one port\n self._driver_assert(len(ports), _('_create_host: No connector ports'))\n port1 = ports.pop(0)\n arg_name, arg_val = port1.split()\n ssh_cmd = ['svctask', 'mkhost', '-force', arg_name, arg_val, '-name',\n '\"%s\"' % host_name]\n out, err = self._run_ssh(ssh_cmd)\n self._assert_ssh_return('successfully created' in out,\n '_create_host', ssh_cmd, out, err)\n\n # Add any additional ports to the host\n for port in ports:\n arg_name, arg_val = port.split()\n ssh_cmd = ['svctask', 'addhostport', '-force', arg_name, arg_val,\n host_name]\n out, err = self._run_ssh(ssh_cmd)\n\n LOG.debug(_('leave: _create_host: host %(host)s - %(host_name)s') %\n {'host': connector['host'], 'host_name': host_name})\n return host_name","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_create_host","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#81-495393981bea","input":" def _get_iscsi_ip_addrs(self):\n generator = self._port_conf_generator('svcinfo lsportip')\n header = next(generator, None)\n if not header:\n return\n\n for port_data in generator:\n try:\n port_node_id = port_data['node_id']\n port_ipv4 = port_data['IP_address']\n port_ipv6 = port_data['IP_address_6']\n state = port_data['state']\n except KeyError:\n self._handle_keyerror('lsportip', header)\n\n if port_node_id in self._storage_nodes and (\n state == 'configured' or state == 'online'):\n node = self._storage_nodes[port_node_id]\n if len(port_ipv4):\n node['ipv4'].append(port_ipv4)\n if len(port_ipv6):\n node['ipv6'].append(port_ipv6)","target":" def _get_iscsi_ip_addrs(self):\n generator = self._port_conf_generator(['svcinfo', 'lsportip'])\n header = next(generator, None)\n if not header:\n return\n\n for port_data in generator:\n try:\n port_node_id = port_data['node_id']\n port_ipv4 = port_data['IP_address']\n port_ipv6 = port_data['IP_address_6']\n state = port_data['state']\n except KeyError:\n self._handle_keyerror('lsportip', header)\n\n if port_node_id in self._storage_nodes and (\n state == 'configured' or state == 'online'):\n node = self._storage_nodes[port_node_id]\n if len(port_ipv4):\n node['ipv4'].append(port_ipv4)\n if len(port_ipv6):\n node['ipv6'].append(port_ipv6)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_iscsi_ip_addrs","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#82-08acd27637b6","input":"def talk(myText):\r\n if( myText.find( \"twitter\" ) >= 0 ):\r\n myText += \"0\"\r\n myText = myText[7:-1]\r\n try:\r\n\t myText = twitter.getTweet( myText )\r\n\texcept:\r\n\t print( \"!!!ERROR: INVALID TWITTER CREDENTIALS. Please read README.md for instructions.\")\r\n return\r\n \r\n os.system( \"espeak \\\",...\\\" 2>/dev/null\" ) # Sometimes the beginning of audio can get cut off. Insert silence.\r\n time.sleep( 0.5 )\r\n os.system( \"espeak -w speech.wav \\\"\" + myText + \"\\\" -s 130\" )\r\n audio.play(\"speech.wav\")\r\n return myText","target":"def talk(myText):\r\n if( myText.find( \"twitter\" ) >= 0 ):\r\n myText += \"0\"\r\n myText = myText[7:-1]\r\n try:\r\n\t myText = twitter.getTweet( myText )\r\n\texcept:\r\n\t print( \"!!!ERROR: INVALID TWITTER CREDENTIALS. Please read README.md for instructions.\")\r\n return\r\n \r\n os.system( \"espeak \\\",...\\\" 2>/dev/null\" ) # Sometimes the beginning of audio can get cut off. Insert silence.\r\n time.sleep( 0.5 )\r\n subprocess.call([\"espeak\", \"-w\", \"speech.wav\", myText, \"-s\", \"130\"])\r\n audio.play(\"speech.wav\")\r\n return myText","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"talk","file_name":"chippyRuxpin.py","commit_link":"github.com/ntc-chip-revived/ChippyRuxpin/commit/0cd7d78e4d806852fd75fee03c24cce322f76014","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#83-fc4b59b6c359","input":" def _exec_cmd(self, cmd):\n \"\"\"Executes adb commands in a new shell.\n\n This is specific to executing adb binary because stderr is not a good\n indicator of cmd execution status.\n\n Args:\n cmds: A string that is the adb command to execute.\n\n Returns:\n The output of the adb command run if exit code is 0.\n\n Raises:\n AdbError is raised if the adb command exit code is not 0.\n \"\"\"\n proc = subprocess.Popen(\n cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\n (out, err) = proc.communicate()\n ret = proc.returncode\n logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', cmd, out,\n err, ret)\n if ret == 0:\n return out\n else:\n raise AdbError(cmd=cmd, stdout=out, stderr=err, ret_code=ret)","target":" def _exec_cmd(self, args, shell):\n \"\"\"Executes adb commands.\n\n Args:\n args: string or list of strings, program arguments.\n See subprocess.Popen() documentation.\n shell: bool, True to run this command through the system shell,\n False to invoke it directly. See subprocess.Popen() docs.\n\n Returns:\n The output of the adb command run if exit code is 0.\n\n Raises:\n AdbError is raised if the adb command exit code is not 0.\n \"\"\"\n proc = subprocess.Popen(\n args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell)\n (out, err) = proc.communicate()\n ret = proc.returncode\n logging.debug('cmd: %s, stdout: %s, stderr: %s, ret: %s', args, out,\n err, ret)\n if ret == 0:\n return out\n else:\n raise AdbError(cmd=args, stdout=out, stderr=err, ret_code=ret)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_exec_cmd","file_name":"mobly/controllers/android_device_lib/adb.py","commit_link":"github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#84-50aaf885963a","input":" def _get_conn_fc_wwpns(self, host_name):\n wwpns = []\n cmd = 'svcinfo lsfabric -host %s' % host_name\n generator = self._port_conf_generator(cmd)\n header = next(generator, None)\n if not header:\n return wwpns\n\n for port_data in generator:\n try:\n wwpns.append(port_data['local_wwpn'])\n except KeyError as e:\n self._handle_keyerror('lsfabric', header)\n\n return wwpns","target":" def _get_conn_fc_wwpns(self, host_name):\n wwpns = []\n cmd = ['svcinfo', 'lsfabric', '-host', host_name]\n generator = self._port_conf_generator(cmd)\n header = next(generator, None)\n if not header:\n return wwpns\n\n for port_data in generator:\n try:\n wwpns.append(port_data['local_wwpn'])\n except KeyError as e:\n self._handle_keyerror('lsfabric', header)\n\n return wwpns","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_conn_fc_wwpns","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#85-3e6f0bd37054","input":" def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):\n \"\"\"Create a 3PAR host.\n\n Create a 3PAR host, if there is already a host on the 3par using\n the same iqn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"\n cmd = 'createhost -iscsi -persona %s -domain %s %s %s' % \\\n (persona_id, domain, hostname, iscsi_iqn)\n out = self.common._cli_run(cmd, None)\n if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)\n return hostname","target":" def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):\n \"\"\"Create a 3PAR host.\n\n Create a 3PAR host, if there is already a host on the 3par using\n the same iqn but with a different hostname, return the hostname\n used by 3PAR.\n \"\"\"\n cmd = ['createhost', '-iscsi', '-persona', persona_id, '-domain',\n domain, hostname, iscsi_iqn]\n out = self.common._cli_run(cmd)\n if out and len(out) > 1:\n return self.common.parse_create_host_error(hostname, out)\n return hostname","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_create_3par_iscsi_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_iscsi.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#86-b6b329d00d9b","input":" def _delete_3par_host(self, hostname):\n self._cli_run('removehost %s' % hostname, None)","target":" def _delete_3par_host(self, hostname):\n self._cli_run(['removehost', hostname])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_delete_3par_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#87-5967b6ab37b1","input":" def process_statistics(self, metadata, _):\n args = [metadata.hostname, '-p', metadata.profile, '-g',\n ':'.join([g for g in metadata.groups])]\n for notifier in os.listdir(self.data):\n if ((notifier[-1] == '~') or\n (notifier[:2] == '.#') or\n (notifier[-4:] == '.swp') or\n (notifier in ['SCCS', '.svn', '4913'])):\n continue\n npath = self.data + '/' + notifier\n self.logger.debug(\"Running %s %s\" % (npath, \" \".join(args)))\n async_run(npath, args)","target":" def process_statistics(self, metadata, _):\n args = [metadata.hostname, '-p', metadata.profile, '-g',\n ':'.join([g for g in metadata.groups])]\n self.debug_log(\"running triggers\")\n for notifier in os.listdir(self.data):\n self.debug_log(\"running %s\" % notifier)\n if ((notifier[-1] == '~') or\n (notifier[:2] == '.#') or\n (notifier[-4:] == '.swp') or\n (notifier in ['SCCS', '.svn', '4913'])):\n continue\n npath = os.path.join(self.data, notifier)\n self.async_run([npath] + args)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"process_statistics","file_name":"src/lib/Server/Plugins/Trigger.py","commit_link":"github.com/Bcfg2/bcfg2/commit/a524967e8d5c4c22e49cd619aed20c87a316c0be","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#88-e006b7badd21","input":" def _delete_host(self, host_name):\n \"\"\"Delete a host on the storage system.\"\"\"\n\n LOG.debug(_('enter: _delete_host: host %s ') % host_name)\n\n ssh_cmd = 'svctask rmhost %s ' % host_name\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from rmhost\n self._assert_ssh_return(len(out.strip()) == 0,\n '_delete_host', ssh_cmd, out, err)\n\n LOG.debug(_('leave: _delete_host: host %s ') % host_name)","target":" def _delete_host(self, host_name):\n \"\"\"Delete a host on the storage system.\"\"\"\n\n LOG.debug(_('enter: _delete_host: host %s ') % host_name)\n\n ssh_cmd = ['svctask', 'rmhost', host_name]\n out, err = self._run_ssh(ssh_cmd)\n # No output should be returned from rmhost\n self._assert_ssh_return(len(out.strip()) == 0,\n '_delete_host', ssh_cmd, out, err)\n\n LOG.debug(_('leave: _delete_host: host %s ') % host_name)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_delete_host","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#89-9a862dd8ac73","input":"def fetch(url):\n '''Download and verify a package url.'''\n base = os.path.basename(url)\n print('Fetching %s...' % base)\n fetch_file(url + '.asc')\n fetch_file(url)\n fetch_file(url + '.sha256')\n fetch_file(url + '.asc.sha256')\n print('Verifying %s...' % base)\n # TODO: check for verification failure.\n os.system('shasum -c %s.sha256' % base)\n os.system('shasum -c %s.asc.sha256' % base)\n os.system('gpg --verify %s.asc %s' % (base, base))\n os.system('keybase verify %s.asc' % base)","target":"def fetch(url):\n '''Download and verify a package url.'''\n base = os.path.basename(url)\n print('Fetching %s...' % base)\n fetch_file(url + '.asc')\n fetch_file(url)\n fetch_file(url + '.sha256')\n fetch_file(url + '.asc.sha256')\n print('Verifying %s...' % base)\n # TODO: check for verification failure.\n subprocess.check_call(['shasum', '-c', base + '.sha256'])\n subprocess.check_call(['shasum', '-c', base + '.asc.sha256'])\n subprocess.check_call(['gpg', '--verify', base + '.asc', base])\n subprocess.check_call(['keybase', 'verify', base + '.asc'])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"fetch","file_name":"repack_rust.py","commit_link":"github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#90-c981d0654168","input":" def _formatCredentials(self, data, name):\n \"\"\"\n Credentials are of the form\n RCLONE_CONFIG_CURRENT_TYPE=s3\n ^ ^ ^ ^\n [mandatory ][name ][key][value]\n \"\"\"\n\n prefix = \"RCLONE_CONFIG_{}\".format(name.upper())\n\n credentials = ''\n credentials += \"{}_TYPE='{}' \".format(prefix, data.type)\n\n def _addCredential(credentials, env_key, data_key):\n value = getattr(data, data_key, None)\n if value is not None:\n credentials += \"{}='{}' \".format(env_key, value)\n return credentials\n\n\n if data.type == 's3':\n credentials = _addCredential(credentials,\n '{}_REGION'.format(prefix),\n 's3_region'\n )\n credentials = _addCredential(credentials,\n '{}_ACCESS_KEY_ID'.format(prefix),\n 's3_access_key_id'\n )\n credentials = _addCredential(credentials,\n '{}_SECRET_ACCESS_KEY'.format(prefix),\n 's3_secret_access_key'\n )\n\n credentials = _addCredential(credentials,\n '{}_ENDPOINT'.format(prefix),\n 's3_endpoint'\n )\n credentials = _addCredential(credentials,\n '{}_V2_AUTH'.format(prefix),\n 's3_v2_auth'\n )\n\n elif data.type == 'azureblob':\n credentials = _addCredential(credentials,\n '{}_ACCOUNT'.format(prefix),\n 'azure_account'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'azure_key'\n )\n\n elif data.type == 'swift':\n credentials = _addCredential(credentials,\n '{}_USER'.format(prefix),\n 'swift_user'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'swift_key'\n )\n credentials = _addCredential(credentials,\n '{}_AUTH'.format(prefix),\n 'swift_auth'\n )\n credentials = _addCredential(credentials,\n '{}_TENANT'.format(prefix),\n 'swift_tenant'\n )\n\n elif data.type == 'google cloud storage':\n credentials = _addCredential(credentials,\n '{}_CLIENT_ID'.format(prefix),\n 'gcp_client_id'\n )\n credentials = _addCredential(credentials,\n '{}_SERVICE_ACCOUNT_CREDENTIALS'.format(prefix),\n 'gcp_service_account_credentials'\n )\n credentials = _addCredential(credentials,\n '{}_PROJECT_NUMBER'.format(prefix),\n 'gcp_project_number'\n )\n credentials = _addCredential(credentials,\n '{}_OBJECT_ACL'.format(prefix),\n 'gcp_object_acl'\n )\n credentials = _addCredential(credentials,\n '{}_BUCKET_ACL'.format(prefix),\n 'gcp_bucket_acl'\n )\n\n else:\n logging.error(\"Connection type unknown: {}\".format(data.type))\n\n return credentials","target":" def _formatCredentials(self, data, name):\n \"\"\"\n Credentials are of the form\n RCLONE_CONFIG_CURRENT_TYPE=s3\n ^ ^ ^ ^\n [mandatory ][name ][key][value]\n \"\"\"\n\n prefix = \"RCLONE_CONFIG_{}\".format(name.upper())\n\n credentials = {}\n credentials['{}_TYPE'.format(prefix)] = data.type\n\n def _addCredential(credentials, env_key, data_key):\n value = getattr(data, data_key, None)\n if value is not None:\n credentials[env_key] = value\n return credentials\n\n\n if data.type == 's3':\n credentials = _addCredential(credentials,\n '{}_REGION'.format(prefix),\n 's3_region'\n )\n credentials = _addCredential(credentials,\n '{}_ACCESS_KEY_ID'.format(prefix),\n 's3_access_key_id'\n )\n credentials = _addCredential(credentials,\n '{}_SECRET_ACCESS_KEY'.format(prefix),\n 's3_secret_access_key'\n )\n\n credentials = _addCredential(credentials,\n '{}_ENDPOINT'.format(prefix),\n 's3_endpoint'\n )\n credentials = _addCredential(credentials,\n '{}_V2_AUTH'.format(prefix),\n 's3_v2_auth'\n )\n\n elif data.type == 'azureblob':\n credentials = _addCredential(credentials,\n '{}_ACCOUNT'.format(prefix),\n 'azure_account'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'azure_key'\n )\n\n elif data.type == 'swift':\n credentials = _addCredential(credentials,\n '{}_USER'.format(prefix),\n 'swift_user'\n )\n credentials = _addCredential(credentials,\n '{}_KEY'.format(prefix),\n 'swift_key'\n )\n credentials = _addCredential(credentials,\n '{}_AUTH'.format(prefix),\n 'swift_auth'\n )\n credentials = _addCredential(credentials,\n '{}_TENANT'.format(prefix),\n 'swift_tenant'\n )\n\n elif data.type == 'google cloud storage':\n credentials = _addCredential(credentials,\n '{}_CLIENT_ID'.format(prefix),\n 'gcp_client_id'\n )\n credentials = _addCredential(credentials,\n '{}_SERVICE_ACCOUNT_CREDENTIALS'.format(prefix),\n 'gcp_service_account_credentials'\n )\n credentials = _addCredential(credentials,\n '{}_PROJECT_NUMBER'.format(prefix),\n 'gcp_project_number'\n )\n credentials = _addCredential(credentials,\n '{}_OBJECT_ACL'.format(prefix),\n 'gcp_object_acl'\n )\n credentials = _addCredential(credentials,\n '{}_BUCKET_ACL'.format(prefix),\n 'gcp_bucket_acl'\n )\n\n else:\n logging.error(\"Connection type unknown: {}\".format(data.type))\n\n return credentials","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_formatCredentials","file_name":"src/backend/api/utils/rclone_connection.py","commit_link":"github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#91-9c994d16240d","input":" def initHeader(self):\n \"\"\"Initialize the IP header according to the IP format definition.\n\n \"\"\"\n\n # Ethernet header\n\n # Retrieve remote MAC address\n dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n # Force ARP resolution\n p = subprocess.Popen(\"ping -c1 {}\".format(self.remoteIP), shell=True)\n p.wait()\n time.sleep(0.1)\n\n dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n raise Exception(\"Cannot resolve IP address to a MAC address for IP: '{}'\".format(self.remoteIP))\n\n # Retrieve local MAC address\n srcMacAddr = self.get_interface_addr(bytes(self.interface, 'utf-8'))[1]\n\n eth_dst = Field(name='eth.dst', domain=Raw(dstMacAddr))\n eth_src = Field(name='eth.src', domain=Raw(srcMacAddr))\n eth_type = Field(name='eth.type', domain=Raw(b\"\\x08\\x00\"))\n\n\n # IP header\n\n ip_ver = Field(\n name='ip.version', domain=BitArray(\n value=bitarray('0100'))) # IP Version 4\n ip_ihl = Field(name='ip.hdr_len', domain=BitArray(bitarray('0000')))\n ip_tos = Field(\n name='ip.tos',\n domain=Data(\n dataType=BitArray(nbBits=8),\n originalValue=bitarray('00000000'),\n svas=SVAS.PERSISTENT))\n ip_tot_len = Field(\n name='ip.len', domain=BitArray(bitarray('0000000000000000')))\n ip_id = Field(name='ip.id', domain=BitArray(nbBits=16))\n ip_flags = Field(name='ip.flags', domain=Data(dataType=BitArray(nbBits=3), originalValue=bitarray('000'), svas=SVAS.PERSISTENT))\n ip_frag_off = Field(name='ip.fragment', domain=Data(dataType=BitArray(nbBits=13), originalValue=bitarray('0000000000000'), svas=SVAS.PERSISTENT))\n ip_ttl = Field(name='ip.ttl', domain=Data(dataType=BitArray(nbBits=8), originalValue=bitarray('01000000'), svas=SVAS.PERSISTENT))\n ip_proto = Field(name='ip.proto', domain=Integer(value=self.upperProtocol, unitSize=AbstractType.UNITSIZE_8, endianness=AbstractType.ENDIAN_BIG, sign=AbstractType.SIGN_UNSIGNED))\n ip_checksum = Field(name='ip.checksum', domain=BitArray(bitarray('0000000000000000')))\n ip_saddr = Field(name='ip.src', domain=IPv4(self.localIP))\n ip_daddr = Field(\n name='ip.dst', domain=IPv4(self.remoteIP))\n ip_payload = Field(name='ip.payload', domain=Raw())\n\n ip_ihl.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id, ip_flags,\n ip_frag_off,\n ip_ttl, ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=BitArray(nbBits=4), factor=1/float(32))\n ip_tot_len.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload], dataType=Integer(unitSize=AbstractType.UNITSIZE_16, sign=AbstractType.SIGN_UNSIGNED), factor=1/float(8))\n ip_checksum.domain = InternetChecksum(fields=[ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=Raw(nbBytes=2, unitSize=AbstractType.UNITSIZE_16))\n \n self.header = Symbol(name='Ethernet layer', fields=[eth_dst,\n eth_src,\n eth_type,\n ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload])","target":" def initHeader(self):\n \"\"\"Initialize the IP header according to the IP format definition.\n\n \"\"\"\n\n # Ethernet header\n\n # Retrieve remote MAC address\n dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n # Force ARP resolution\n p = subprocess.Popen([\"/bin/ping\", \"-c1\", self.remoteIP])\n p.wait()\n time.sleep(0.1)\n\n dstMacAddr = arpreq.arpreq(self.remoteIP)\n if dstMacAddr is not None:\n dstMacAddr = dstMacAddr.replace(':', '')\n dstMacAddr = binascii.unhexlify(dstMacAddr)\n else:\n raise Exception(\"Cannot resolve IP address to a MAC address for IP: '{}'\".format(self.remoteIP))\n\n # Retrieve local MAC address\n srcMacAddr = self.get_interface_addr(bytes(self.interface, 'utf-8'))[1]\n\n eth_dst = Field(name='eth.dst', domain=Raw(dstMacAddr))\n eth_src = Field(name='eth.src', domain=Raw(srcMacAddr))\n eth_type = Field(name='eth.type', domain=Raw(b\"\\x08\\x00\"))\n\n\n # IP header\n\n ip_ver = Field(\n name='ip.version', domain=BitArray(\n value=bitarray('0100'))) # IP Version 4\n ip_ihl = Field(name='ip.hdr_len', domain=BitArray(bitarray('0000')))\n ip_tos = Field(\n name='ip.tos',\n domain=Data(\n dataType=BitArray(nbBits=8),\n originalValue=bitarray('00000000'),\n svas=SVAS.PERSISTENT))\n ip_tot_len = Field(\n name='ip.len', domain=BitArray(bitarray('0000000000000000')))\n ip_id = Field(name='ip.id', domain=BitArray(nbBits=16))\n ip_flags = Field(name='ip.flags', domain=Data(dataType=BitArray(nbBits=3), originalValue=bitarray('000'), svas=SVAS.PERSISTENT))\n ip_frag_off = Field(name='ip.fragment', domain=Data(dataType=BitArray(nbBits=13), originalValue=bitarray('0000000000000'), svas=SVAS.PERSISTENT))\n ip_ttl = Field(name='ip.ttl', domain=Data(dataType=BitArray(nbBits=8), originalValue=bitarray('01000000'), svas=SVAS.PERSISTENT))\n ip_proto = Field(name='ip.proto', domain=Integer(value=self.upperProtocol, unitSize=AbstractType.UNITSIZE_8, endianness=AbstractType.ENDIAN_BIG, sign=AbstractType.SIGN_UNSIGNED))\n ip_checksum = Field(name='ip.checksum', domain=BitArray(bitarray('0000000000000000')))\n ip_saddr = Field(name='ip.src', domain=IPv4(self.localIP))\n ip_daddr = Field(\n name='ip.dst', domain=IPv4(self.remoteIP))\n ip_payload = Field(name='ip.payload', domain=Raw())\n\n ip_ihl.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id, ip_flags,\n ip_frag_off,\n ip_ttl, ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=BitArray(nbBits=4), factor=1/float(32))\n ip_tot_len.domain = Size([ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload], dataType=Integer(unitSize=AbstractType.UNITSIZE_16, sign=AbstractType.SIGN_UNSIGNED), factor=1/float(8))\n ip_checksum.domain = InternetChecksum(fields=[ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr], dataType=Raw(nbBytes=2, unitSize=AbstractType.UNITSIZE_16))\n \n self.header = Symbol(name='Ethernet layer', fields=[eth_dst,\n eth_src,\n eth_type,\n ip_ver,\n ip_ihl,\n ip_tos,\n ip_tot_len,\n ip_id,\n ip_flags,\n ip_frag_off,\n ip_ttl,\n ip_proto,\n ip_checksum,\n ip_saddr,\n ip_daddr,\n ip_payload])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"initHeader","file_name":"src/netzob/Simulator/Channels/RawEthernetClient.py","commit_link":"github.com/netzob/netzob/commit/557abf64867d715497979b029efedbd2777b912e","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#92-813e30256cf6","input":" def poll(self, poll_input):\n username = poll_input.credentials.username\n password = poll_input.credentials.password\n domain = poll_input.credentials.domain\n \n if domain is None:\n opt_str = '--ignore-certificate --authonly -u {} -p {} {}:{}'\n options = opt_str.format(\n username, password,\n poll_input.server, poll_input.port)\n else:\n opt_str = '--ignore-certificate --authonly -d {} -u {} -p {} {}:{}'\n options = opt_str.format(\n domain.domain, username, password,\n poll_input.server, poll_input.port)\n\n try:\n output = subprocess.check_output('timeout {} xfreerdp {}'.format(poll_input.timeout, options), shell=True, stderr=subprocess.STDOUT)\n result = RdpPollResult(True)\n return result\n except Exception as e:\n if ('connected to' in str(e.output) and 'Authentication failure' not in str(e.output)) or (e.returncode == 131 and 'negotiation' in str(e.output)):\n result = RdpPollResult(True)\n return result\n print(\"{{{{%s}}}}\" % e.output)\n result = RdpPollResult(False, e)\n return result","target":" def poll(self, poll_input):\n username = poll_input.credentials.username\n password = poll_input.credentials.password\n domain = poll_input.credentials.domain\n \n if domain is None:\n opt_str = '--ignore-certificate --authonly -u \\'{}\\' -p \\'{}\\' {}:{}'\n options = opt_str.format(\n username, password,\n poll_input.server, poll_input.port)\n else:\n opt_str = '--ignore-certificate --authonly -d {} -u \\'{}\\' -p \\'{}\\' {}:{}'\n options = opt_str.format(\n domain.domain, username, password,\n poll_input.server, poll_input.port)\n\n try:\n output = subprocess.check_output('timeout {} xfreerdp {}'.format(poll_input.timeout, options), shell=True, stderr=subprocess.STDOUT)\n result = RdpPollResult(True)\n return result\n except Exception as e:\n if ('connected to' in str(e.output) and 'Authentication failure' not in str(e.output)) or (e.returncode == 131 and 'negotiation' in str(e.output)):\n result = RdpPollResult(True)\n return result\n print(\"{{{{%s}}}}\" % e.output)\n result = RdpPollResult(False, e)\n return result","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"poll","file_name":"polling/poll_rdp.py","commit_link":"github.com/DSU-DefSecClub/ScoringEngine/commit/010eefe1ad416c0bdaa16fd59eca0dc8e3086a13","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#93-79813f98fa39","input":" def terminate_connection(self, volume, connector, **kwargs):\n \"\"\"Cleanup after an iSCSI connection has been terminated.\n\n When we clean up a terminated connection between a given connector\n and volume, we:\n 1. Translate the given connector to a host name\n 2. Remove the volume-to-host mapping if it exists\n 3. Delete the host if it has no more mappings (hosts are created\n automatically by this driver when mappings are created)\n \"\"\"\n LOG.debug(_('enter: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})\n\n vol_name = volume['name']\n host_name = self._get_host_from_connector(connector)\n # Verify that _get_host_from_connector returned the host.\n # This should always succeed as we terminate an existing connection.\n self._driver_assert(\n host_name is not None,\n _('_get_host_from_connector failed to return the host name '\n 'for connector'))\n\n # Check if vdisk-host mapping exists, remove if it does\n mapping_data = self._get_hostvdisk_mappings(host_name)\n if vol_name in mapping_data:\n ssh_cmd = 'svctask rmvdiskhostmap -host %s %s' % \\\n (host_name, vol_name)\n out, err = self._run_ssh(ssh_cmd)\n # Verify CLI behaviour - no output is returned from\n # rmvdiskhostmap\n self._assert_ssh_return(len(out.strip()) == 0,\n 'terminate_connection', ssh_cmd, out, err)\n del mapping_data[vol_name]\n else:\n LOG.error(_('terminate_connection: No mapping of volume '\n '%(vol_name)s to host %(host_name)s found') %\n {'vol_name': vol_name, 'host_name': host_name})\n\n # If this host has no more mappings, delete it\n if not mapping_data:\n self._delete_host(host_name)\n\n LOG.debug(_('leave: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})","target":" def terminate_connection(self, volume, connector, **kwargs):\n \"\"\"Cleanup after an iSCSI connection has been terminated.\n\n When we clean up a terminated connection between a given connector\n and volume, we:\n 1. Translate the given connector to a host name\n 2. Remove the volume-to-host mapping if it exists\n 3. Delete the host if it has no more mappings (hosts are created\n automatically by this driver when mappings are created)\n \"\"\"\n LOG.debug(_('enter: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})\n\n vol_name = volume['name']\n host_name = self._get_host_from_connector(connector)\n # Verify that _get_host_from_connector returned the host.\n # This should always succeed as we terminate an existing connection.\n self._driver_assert(\n host_name is not None,\n _('_get_host_from_connector failed to return the host name '\n 'for connector'))\n\n # Check if vdisk-host mapping exists, remove if it does\n mapping_data = self._get_hostvdisk_mappings(host_name)\n if vol_name in mapping_data:\n ssh_cmd = ['svctask', 'rmvdiskhostmap', '-host', host_name,\n vol_name]\n out, err = self._run_ssh(ssh_cmd)\n # Verify CLI behaviour - no output is returned from\n # rmvdiskhostmap\n self._assert_ssh_return(len(out.strip()) == 0,\n 'terminate_connection', ssh_cmd, out, err)\n del mapping_data[vol_name]\n else:\n LOG.error(_('terminate_connection: No mapping of volume '\n '%(vol_name)s to host %(host_name)s found') %\n {'vol_name': vol_name, 'host_name': host_name})\n\n # If this host has no more mappings, delete it\n if not mapping_data:\n self._delete_host(host_name)\n\n LOG.debug(_('leave: terminate_connection: volume %(vol)s with '\n 'connector %(conn)s') % {'vol': str(volume),\n 'conn': str(connector)})","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"terminate_connection","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#94-404301c07791","input":" def _port_conf_generator(self, cmd):\n ssh_cmd = '%s -delim !' % cmd\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return\n port_lines = out.strip().split('\\n')\n if not len(port_lines):\n return\n\n header = port_lines.pop(0)\n yield header\n for portip_line in port_lines:\n try:\n port_data = self._get_hdr_dic(header, portip_line, '!')\n except exception.VolumeBackendAPIException:\n with excutils.save_and_reraise_exception():\n self._log_cli_output_error('_port_conf_generator',\n ssh_cmd, out, err)\n yield port_data","target":" def _port_conf_generator(self, cmd):\n ssh_cmd = cmd + ['-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return\n port_lines = out.strip().split('\\n')\n if not len(port_lines):\n return\n\n header = port_lines.pop(0)\n yield header\n for portip_line in port_lines:\n try:\n port_data = self._get_hdr_dic(header, portip_line, '!')\n except exception.VolumeBackendAPIException:\n with excutils.save_and_reraise_exception():\n self._log_cli_output_error('_port_conf_generator',\n ssh_cmd, out, err)\n yield port_data","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_port_conf_generator","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-476#0-3ff4fa396f41","input":"static int multiSelect(\n Parse *pParse, /* Parsing context */\n Select *p, /* The right-most of SELECTs to be coded */\n SelectDest *pDest /* What to do with query results */\n){\n int rc = SQLITE_OK; /* Success code from a subroutine */\n Select *pPrior; /* Another SELECT immediately to our left */\n Vdbe *v; /* Generate code to this VDBE */\n SelectDest dest; /* Alternative data destination */\n Select *pDelete = 0; /* Chain of simple selects to delete */\n sqlite3 *db; /* Database connection */\n\n /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only\n ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.\n */\n assert( p && p->pPrior ); /* Calling function guarantees this much */\n assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION );\n assert( p->selFlags & SF_Compound );\n db = pParse->db;\n pPrior = p->pPrior;\n dest = *pDest;\n if( pPrior->pOrderBy || pPrior->pLimit ){\n sqlite3ErrorMsg(pParse,\"%s clause should come after %s not before\",\n pPrior->pOrderBy!=0 ? \"ORDER BY\" : \"LIMIT\", selectOpName(p->op));\n rc = 1;\n goto multi_select_end;\n }\n\n v = sqlite3GetVdbe(pParse);\n assert( v!=0 ); /* The VDBE already created by calling function */\n\n /* Create the destination temporary table if necessary\n */\n if( dest.eDest==SRT_EphemTab ){\n assert( p->pEList );\n sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iSDParm, p->pEList->nExpr);\n dest.eDest = SRT_Table;\n }\n\n /* Special handling for a compound-select that originates as a VALUES clause.\n */\n if( p->selFlags & SF_MultiValue ){\n rc = multiSelectValues(pParse, p, &dest);\n if( rc>=0 ) goto multi_select_end;\n rc = SQLITE_OK;\n }\n\n /* Make sure all SELECTs in the statement have the same number of elements\n ** in their result sets.\n */\n assert( p->pEList && pPrior->pEList );\n assert( p->pEList->nExpr==pPrior->pEList->nExpr );\n\n#ifndef SQLITE_OMIT_CTE\n if( p->selFlags & SF_Recursive ){\n generateWithRecursiveQuery(pParse, p, &dest);\n }else\n#endif\n\n /* Compound SELECTs that have an ORDER BY clause are handled separately.\n */\n if( p->pOrderBy ){\n return multiSelectOrderBy(pParse, p, pDest);\n }else{\n\n#ifndef SQLITE_OMIT_EXPLAIN\n if( pPrior->pPrior==0 ){\n ExplainQueryPlan((pParse, 1, \"COMPOUND QUERY\"));\n ExplainQueryPlan((pParse, 1, \"LEFT-MOST SUBQUERY\"));\n }\n#endif\n\n /* Generate code for the left and right SELECT statements.\n */\n switch( p->op ){\n case TK_ALL: {\n int addr = 0;\n int nLimit;\n assert( !pPrior->pLimit );\n pPrior->iLimit = p->iLimit;\n pPrior->iOffset = p->iOffset;\n pPrior->pLimit = p->pLimit;\n rc = sqlite3Select(pParse, pPrior, &dest);\n p->pLimit = 0;\n if( rc ){\n goto multi_select_end;\n }\n p->pPrior = 0;\n p->iLimit = pPrior->iLimit;\n p->iOffset = pPrior->iOffset;\n if( p->iLimit ){\n addr = sqlite3VdbeAddOp1(v, OP_IfNot, p->iLimit); VdbeCoverage(v);\n VdbeComment((v, \"Jump ahead if LIMIT reached\"));\n if( p->iOffset ){\n sqlite3VdbeAddOp3(v, OP_OffsetLimit,\n p->iLimit, p->iOffset+1, p->iOffset);\n }\n }\n ExplainQueryPlan((pParse, 1, \"UNION ALL\"));\n rc = sqlite3Select(pParse, p, &dest);\n testcase( rc!=SQLITE_OK );\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n if( pPrior->pLimit\n && sqlite3ExprIsInteger(pPrior->pLimit->pLeft, &nLimit)\n && nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit) \n ){\n p->nSelectRow = sqlite3LogEst((u64)nLimit);\n }\n if( addr ){\n sqlite3VdbeJumpHere(v, addr);\n }\n break;\n }\n case TK_EXCEPT:\n case TK_UNION: {\n int unionTab; /* Cursor number of the temp table holding result */\n u8 op = 0; /* One of the SRT_ operations to apply to self */\n int priorOp; /* The SRT_ operation to apply to prior selects */\n Expr *pLimit; /* Saved values of p->nLimit */\n int addr;\n SelectDest uniondest;\n \n testcase( p->op==TK_EXCEPT );\n testcase( p->op==TK_UNION );\n priorOp = SRT_Union;\n if( dest.eDest==priorOp ){\n /* We can reuse a temporary table generated by a SELECT to our\n ** right.\n */\n assert( p->pLimit==0 ); /* Not allowed on leftward elements */\n unionTab = dest.iSDParm;\n }else{\n /* We will need to create our own temporary table to hold the\n ** intermediate results.\n */\n unionTab = pParse->nTab++;\n assert( p->pOrderBy==0 );\n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0);\n assert( p->addrOpenEphm[0] == -1 );\n p->addrOpenEphm[0] = addr;\n findRightmost(p)->selFlags |= SF_UsesEphemeral;\n assert( p->pEList );\n }\n \n /* Code the SELECT statements to our left\n */\n assert( !pPrior->pOrderBy );\n sqlite3SelectDestInit(&uniondest, priorOp, unionTab);\n rc = sqlite3Select(pParse, pPrior, &uniondest);\n if( rc ){\n goto multi_select_end;\n }\n \n /* Code the current SELECT statement\n */\n if( p->op==TK_EXCEPT ){\n op = SRT_Except;\n }else{\n assert( p->op==TK_UNION );\n op = SRT_Union;\n }\n p->pPrior = 0;\n pLimit = p->pLimit;\n p->pLimit = 0;\n uniondest.eDest = op;\n ExplainQueryPlan((pParse, 1, \"%s USING TEMP B-TREE\",\n selectOpName(p->op)));\n rc = sqlite3Select(pParse, p, &uniondest);\n testcase( rc!=SQLITE_OK );\n /* Query flattening in sqlite3Select() might refill p->pOrderBy.\n ** Be sure to delete p->pOrderBy, therefore, to avoid a memory leak. */\n sqlite3ExprListDelete(db, p->pOrderBy);\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n p->pOrderBy = 0;\n if( p->op==TK_UNION ){\n p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n }\n sqlite3ExprDelete(db, p->pLimit);\n p->pLimit = pLimit;\n p->iLimit = 0;\n p->iOffset = 0;\n \n /* Convert the data in the temporary table into whatever form\n ** it is that we currently need.\n */\n assert( unionTab==dest.iSDParm || dest.eDest!=priorOp );\n if( dest.eDest!=priorOp ){\n int iCont, iBreak, iStart;\n assert( p->pEList );\n iBreak = sqlite3VdbeMakeLabel(pParse);\n iCont = sqlite3VdbeMakeLabel(pParse);\n computeLimitRegisters(pParse, p, iBreak);\n sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v);\n iStart = sqlite3VdbeCurrentAddr(v);\n selectInnerLoop(pParse, p, unionTab,\n 0, 0, &dest, iCont, iBreak);\n sqlite3VdbeResolveLabel(v, iCont);\n sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); VdbeCoverage(v);\n sqlite3VdbeResolveLabel(v, iBreak);\n sqlite3VdbeAddOp2(v, OP_Close, unionTab, 0);\n }\n break;\n }\n default: assert( p->op==TK_INTERSECT ); {\n int tab1, tab2;\n int iCont, iBreak, iStart;\n Expr *pLimit;\n int addr;\n SelectDest intersectdest;\n int r1;\n \n /* INTERSECT is different from the others since it requires\n ** two temporary tables. Hence it has its own case. Begin\n ** by allocating the tables we will need.\n */\n tab1 = pParse->nTab++;\n tab2 = pParse->nTab++;\n assert( p->pOrderBy==0 );\n \n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0);\n assert( p->addrOpenEphm[0] == -1 );\n p->addrOpenEphm[0] = addr;\n findRightmost(p)->selFlags |= SF_UsesEphemeral;\n assert( p->pEList );\n \n /* Code the SELECTs to our left into temporary table \"tab1\".\n */\n sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1);\n rc = sqlite3Select(pParse, pPrior, &intersectdest);\n if( rc ){\n goto multi_select_end;\n }\n \n /* Code the current SELECT into temporary table \"tab2\"\n */\n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0);\n assert( p->addrOpenEphm[1] == -1 );\n p->addrOpenEphm[1] = addr;\n p->pPrior = 0;\n pLimit = p->pLimit;\n p->pLimit = 0;\n intersectdest.iSDParm = tab2;\n ExplainQueryPlan((pParse, 1, \"%s USING TEMP B-TREE\",\n selectOpName(p->op)));\n rc = sqlite3Select(pParse, p, &intersectdest);\n testcase( rc!=SQLITE_OK );\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n if( p->nSelectRow>pPrior->nSelectRow ){\n p->nSelectRow = pPrior->nSelectRow;\n }\n sqlite3ExprDelete(db, p->pLimit);\n p->pLimit = pLimit;\n \n /* Generate code to take the intersection of the two temporary\n ** tables.\n */\n assert( p->pEList );\n iBreak = sqlite3VdbeMakeLabel(pParse);\n iCont = sqlite3VdbeMakeLabel(pParse);\n computeLimitRegisters(pParse, p, iBreak);\n sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v);\n r1 = sqlite3GetTempReg(pParse);\n iStart = sqlite3VdbeAddOp2(v, OP_RowData, tab1, r1);\n sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0);\n VdbeCoverage(v);\n sqlite3ReleaseTempReg(pParse, r1);\n selectInnerLoop(pParse, p, tab1,\n 0, 0, &dest, iCont, iBreak);\n sqlite3VdbeResolveLabel(v, iCont);\n sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); VdbeCoverage(v);\n sqlite3VdbeResolveLabel(v, iBreak);\n sqlite3VdbeAddOp2(v, OP_Close, tab2, 0);\n sqlite3VdbeAddOp2(v, OP_Close, tab1, 0);\n break;\n }\n }\n \n #ifndef SQLITE_OMIT_EXPLAIN\n if( p->pNext==0 ){\n ExplainQueryPlanPop(pParse);\n }\n #endif\n }\n \n /* Compute collating sequences used by \n ** temporary tables needed to implement the compound select.\n ** Attach the KeyInfo structure to all temporary tables.\n **\n ** This section is run by the right-most SELECT statement only.\n ** SELECT statements to the left always skip this part. The right-most\n ** SELECT might also skip this part if it has no ORDER BY clause and\n ** no temp tables are required.\n */\n if( p->selFlags & SF_UsesEphemeral ){\n int i; /* Loop counter */\n KeyInfo *pKeyInfo; /* Collating sequence for the result set */\n Select *pLoop; /* For looping through SELECT statements */\n CollSeq **apColl; /* For looping through pKeyInfo->aColl[] */\n int nCol; /* Number of columns in result set */\n\n assert( p->pNext==0 );\n nCol = p->pEList->nExpr;\n pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1);\n if( !pKeyInfo ){\n rc = SQLITE_NOMEM_BKPT;\n goto multi_select_end;\n }\n for(i=0, apColl=pKeyInfo->aColl; ipDfltColl;\n }\n }\n\n for(pLoop=p; pLoop; pLoop=pLoop->pPrior){\n for(i=0; i<2; i++){\n int addr = pLoop->addrOpenEphm[i];\n if( addr<0 ){\n /* If [0] is unused then [1] is also unused. So we can\n ** always safely abort as soon as the first unused slot is found */\n assert( pLoop->addrOpenEphm[1]<0 );\n break;\n }\n sqlite3VdbeChangeP2(v, addr, nCol);\n sqlite3VdbeChangeP4(v, addr, (char*)sqlite3KeyInfoRef(pKeyInfo),\n P4_KEYINFO);\n pLoop->addrOpenEphm[i] = -1;\n }\n }\n sqlite3KeyInfoUnref(pKeyInfo);\n }\n\nmulti_select_end:\n pDest->iSdst = dest.iSdst;\n pDest->nSdst = dest.nSdst;\n sqlite3SelectDelete(db, pDelete);\n return rc;\n}","target":"static int multiSelect(\n Parse *pParse, /* Parsing context */\n Select *p, /* The right-most of SELECTs to be coded */\n SelectDest *pDest /* What to do with query results */\n){\n int rc = SQLITE_OK; /* Success code from a subroutine */\n Select *pPrior; /* Another SELECT immediately to our left */\n Vdbe *v; /* Generate code to this VDBE */\n SelectDest dest; /* Alternative data destination */\n Select *pDelete = 0; /* Chain of simple selects to delete */\n sqlite3 *db; /* Database connection */\n\n /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only\n ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.\n */\n assert( p && p->pPrior ); /* Calling function guarantees this much */\n assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION );\n assert( p->selFlags & SF_Compound );\n db = pParse->db;\n pPrior = p->pPrior;\n dest = *pDest;\n if( pPrior->pOrderBy || pPrior->pLimit ){\n sqlite3ErrorMsg(pParse,\"%s clause should come after %s not before\",\n pPrior->pOrderBy!=0 ? \"ORDER BY\" : \"LIMIT\", selectOpName(p->op));\n rc = 1;\n goto multi_select_end;\n }\n\n v = sqlite3GetVdbe(pParse);\n assert( v!=0 ); /* The VDBE already created by calling function */\n\n /* Create the destination temporary table if necessary\n */\n if( dest.eDest==SRT_EphemTab ){\n assert( p->pEList );\n sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iSDParm, p->pEList->nExpr);\n dest.eDest = SRT_Table;\n }\n\n /* Special handling for a compound-select that originates as a VALUES clause.\n */\n if( p->selFlags & SF_MultiValue ){\n rc = multiSelectValues(pParse, p, &dest);\n if( rc>=0 ) goto multi_select_end;\n rc = SQLITE_OK;\n }\n\n /* Make sure all SELECTs in the statement have the same number of elements\n ** in their result sets.\n */\n assert( p->pEList && pPrior->pEList );\n assert( p->pEList->nExpr==pPrior->pEList->nExpr );\n\n#ifndef SQLITE_OMIT_CTE\n if( p->selFlags & SF_Recursive ){\n generateWithRecursiveQuery(pParse, p, &dest);\n }else\n#endif\n\n /* Compound SELECTs that have an ORDER BY clause are handled separately.\n */\n if( p->pOrderBy ){\n return multiSelectOrderBy(pParse, p, pDest);\n }else{\n\n#ifndef SQLITE_OMIT_EXPLAIN\n if( pPrior->pPrior==0 ){\n ExplainQueryPlan((pParse, 1, \"COMPOUND QUERY\"));\n ExplainQueryPlan((pParse, 1, \"LEFT-MOST SUBQUERY\"));\n }\n#endif\n\n /* Generate code for the left and right SELECT statements.\n */\n switch( p->op ){\n case TK_ALL: {\n int addr = 0;\n int nLimit;\n assert( !pPrior->pLimit );\n pPrior->iLimit = p->iLimit;\n pPrior->iOffset = p->iOffset;\n pPrior->pLimit = p->pLimit;\n rc = sqlite3Select(pParse, pPrior, &dest);\n p->pLimit = 0;\n if( rc ){\n goto multi_select_end;\n }\n p->pPrior = 0;\n p->iLimit = pPrior->iLimit;\n p->iOffset = pPrior->iOffset;\n if( p->iLimit ){\n addr = sqlite3VdbeAddOp1(v, OP_IfNot, p->iLimit); VdbeCoverage(v);\n VdbeComment((v, \"Jump ahead if LIMIT reached\"));\n if( p->iOffset ){\n sqlite3VdbeAddOp3(v, OP_OffsetLimit,\n p->iLimit, p->iOffset+1, p->iOffset);\n }\n }\n ExplainQueryPlan((pParse, 1, \"UNION ALL\"));\n rc = sqlite3Select(pParse, p, &dest);\n testcase( rc!=SQLITE_OK );\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n if( pPrior->pLimit\n && sqlite3ExprIsInteger(pPrior->pLimit->pLeft, &nLimit)\n && nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit) \n ){\n p->nSelectRow = sqlite3LogEst((u64)nLimit);\n }\n if( addr ){\n sqlite3VdbeJumpHere(v, addr);\n }\n break;\n }\n case TK_EXCEPT:\n case TK_UNION: {\n int unionTab; /* Cursor number of the temp table holding result */\n u8 op = 0; /* One of the SRT_ operations to apply to self */\n int priorOp; /* The SRT_ operation to apply to prior selects */\n Expr *pLimit; /* Saved values of p->nLimit */\n int addr;\n SelectDest uniondest;\n \n testcase( p->op==TK_EXCEPT );\n testcase( p->op==TK_UNION );\n priorOp = SRT_Union;\n if( dest.eDest==priorOp ){\n /* We can reuse a temporary table generated by a SELECT to our\n ** right.\n */\n assert( p->pLimit==0 ); /* Not allowed on leftward elements */\n unionTab = dest.iSDParm;\n }else{\n /* We will need to create our own temporary table to hold the\n ** intermediate results.\n */\n unionTab = pParse->nTab++;\n assert( p->pOrderBy==0 );\n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0);\n assert( p->addrOpenEphm[0] == -1 );\n p->addrOpenEphm[0] = addr;\n findRightmost(p)->selFlags |= SF_UsesEphemeral;\n assert( p->pEList );\n }\n \n /* Code the SELECT statements to our left\n */\n assert( !pPrior->pOrderBy );\n sqlite3SelectDestInit(&uniondest, priorOp, unionTab);\n rc = sqlite3Select(pParse, pPrior, &uniondest);\n if( rc ){\n goto multi_select_end;\n }\n \n /* Code the current SELECT statement\n */\n if( p->op==TK_EXCEPT ){\n op = SRT_Except;\n }else{\n assert( p->op==TK_UNION );\n op = SRT_Union;\n }\n p->pPrior = 0;\n pLimit = p->pLimit;\n p->pLimit = 0;\n uniondest.eDest = op;\n ExplainQueryPlan((pParse, 1, \"%s USING TEMP B-TREE\",\n selectOpName(p->op)));\n rc = sqlite3Select(pParse, p, &uniondest);\n testcase( rc!=SQLITE_OK );\n /* Query flattening in sqlite3Select() might refill p->pOrderBy.\n ** Be sure to delete p->pOrderBy, therefore, to avoid a memory leak. */\n sqlite3ExprListDelete(db, p->pOrderBy);\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n p->pOrderBy = 0;\n if( p->op==TK_UNION ){\n p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n }\n sqlite3ExprDelete(db, p->pLimit);\n p->pLimit = pLimit;\n p->iLimit = 0;\n p->iOffset = 0;\n \n /* Convert the data in the temporary table into whatever form\n ** it is that we currently need.\n */\n assert( unionTab==dest.iSDParm || dest.eDest!=priorOp );\n if( dest.eDest!=priorOp ){\n int iCont, iBreak, iStart;\n assert( p->pEList );\n iBreak = sqlite3VdbeMakeLabel(pParse);\n iCont = sqlite3VdbeMakeLabel(pParse);\n computeLimitRegisters(pParse, p, iBreak);\n sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v);\n iStart = sqlite3VdbeCurrentAddr(v);\n selectInnerLoop(pParse, p, unionTab,\n 0, 0, &dest, iCont, iBreak);\n sqlite3VdbeResolveLabel(v, iCont);\n sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); VdbeCoverage(v);\n sqlite3VdbeResolveLabel(v, iBreak);\n sqlite3VdbeAddOp2(v, OP_Close, unionTab, 0);\n }\n break;\n }\n default: assert( p->op==TK_INTERSECT ); {\n int tab1, tab2;\n int iCont, iBreak, iStart;\n Expr *pLimit;\n int addr;\n SelectDest intersectdest;\n int r1;\n \n /* INTERSECT is different from the others since it requires\n ** two temporary tables. Hence it has its own case. Begin\n ** by allocating the tables we will need.\n */\n tab1 = pParse->nTab++;\n tab2 = pParse->nTab++;\n assert( p->pOrderBy==0 );\n \n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0);\n assert( p->addrOpenEphm[0] == -1 );\n p->addrOpenEphm[0] = addr;\n findRightmost(p)->selFlags |= SF_UsesEphemeral;\n assert( p->pEList );\n \n /* Code the SELECTs to our left into temporary table \"tab1\".\n */\n sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1);\n rc = sqlite3Select(pParse, pPrior, &intersectdest);\n if( rc ){\n goto multi_select_end;\n }\n \n /* Code the current SELECT into temporary table \"tab2\"\n */\n addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0);\n assert( p->addrOpenEphm[1] == -1 );\n p->addrOpenEphm[1] = addr;\n p->pPrior = 0;\n pLimit = p->pLimit;\n p->pLimit = 0;\n intersectdest.iSDParm = tab2;\n ExplainQueryPlan((pParse, 1, \"%s USING TEMP B-TREE\",\n selectOpName(p->op)));\n rc = sqlite3Select(pParse, p, &intersectdest);\n testcase( rc!=SQLITE_OK );\n pDelete = p->pPrior;\n p->pPrior = pPrior;\n if( p->nSelectRow>pPrior->nSelectRow ){\n p->nSelectRow = pPrior->nSelectRow;\n }\n sqlite3ExprDelete(db, p->pLimit);\n p->pLimit = pLimit;\n \n /* Generate code to take the intersection of the two temporary\n ** tables.\n */\n assert( p->pEList );\n iBreak = sqlite3VdbeMakeLabel(pParse);\n iCont = sqlite3VdbeMakeLabel(pParse);\n computeLimitRegisters(pParse, p, iBreak);\n sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v);\n r1 = sqlite3GetTempReg(pParse);\n iStart = sqlite3VdbeAddOp2(v, OP_RowData, tab1, r1);\n sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0);\n VdbeCoverage(v);\n sqlite3ReleaseTempReg(pParse, r1);\n selectInnerLoop(pParse, p, tab1,\n 0, 0, &dest, iCont, iBreak);\n sqlite3VdbeResolveLabel(v, iCont);\n sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); VdbeCoverage(v);\n sqlite3VdbeResolveLabel(v, iBreak);\n sqlite3VdbeAddOp2(v, OP_Close, tab2, 0);\n sqlite3VdbeAddOp2(v, OP_Close, tab1, 0);\n break;\n }\n }\n \n #ifndef SQLITE_OMIT_EXPLAIN\n if( p->pNext==0 ){\n ExplainQueryPlanPop(pParse);\n }\n #endif\n }\n if( pParse->nErr ) goto multi_select_end;\n \n /* Compute collating sequences used by \n ** temporary tables needed to implement the compound select.\n ** Attach the KeyInfo structure to all temporary tables.\n **\n ** This section is run by the right-most SELECT statement only.\n ** SELECT statements to the left always skip this part. The right-most\n ** SELECT might also skip this part if it has no ORDER BY clause and\n ** no temp tables are required.\n */\n if( p->selFlags & SF_UsesEphemeral ){\n int i; /* Loop counter */\n KeyInfo *pKeyInfo; /* Collating sequence for the result set */\n Select *pLoop; /* For looping through SELECT statements */\n CollSeq **apColl; /* For looping through pKeyInfo->aColl[] */\n int nCol; /* Number of columns in result set */\n\n assert( p->pNext==0 );\n nCol = p->pEList->nExpr;\n pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1);\n if( !pKeyInfo ){\n rc = SQLITE_NOMEM_BKPT;\n goto multi_select_end;\n }\n for(i=0, apColl=pKeyInfo->aColl; ipDfltColl;\n }\n }\n\n for(pLoop=p; pLoop; pLoop=pLoop->pPrior){\n for(i=0; i<2; i++){\n int addr = pLoop->addrOpenEphm[i];\n if( addr<0 ){\n /* If [0] is unused then [1] is also unused. So we can\n ** always safely abort as soon as the first unused slot is found */\n assert( pLoop->addrOpenEphm[1]<0 );\n break;\n }\n sqlite3VdbeChangeP2(v, addr, nCol);\n sqlite3VdbeChangeP4(v, addr, (char*)sqlite3KeyInfoRef(pKeyInfo),\n P4_KEYINFO);\n pLoop->addrOpenEphm[i] = -1;\n }\n }\n sqlite3KeyInfoUnref(pKeyInfo);\n }\n\nmulti_select_end:\n pDest->iSdst = dest.iSdst;\n pDest->nSdst = dest.nSdst;\n sqlite3SelectDelete(db, pDelete);\n return rc;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"multiSelect","file_name":"src/select.c","commit_link":"github.com/sqlite/sqlite/commit/8428b3b437569338a9d1e10c4cd8154acbe33089","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#1-f7e81e17e8e3","input":"RCMS *r_pkcs7_parse_cms (const ut8 *buffer, ut32 length) {\n\tRASN1Object *object;\n\tRCMS *container;\n\tif (!buffer || !length) {\n\t\treturn NULL;\n\t}\n\tcontainer = R_NEW0 (RCMS);\n\tif (!container) {\n\t\treturn NULL;\n\t}\n\tobject = r_asn1_create_object (buffer, length);\n\tif (!object || object->list.length != 2 || !object->list.objects[0] || object->list.objects[1]->list.length != 1) {\n\t\tr_asn1_free_object (object);\n\t\tfree (container);\n\t\treturn NULL;\n\t}\n\tcontainer->contentType = r_asn1_stringify_oid (object->list.objects[0]->sector, object->list.objects[0]->length);\n\tr_pkcs7_parse_signeddata (&container->signedData, object->list.objects[1]->list.objects[0]);\n\tr_asn1_free_object (object);\n\treturn container;\n}","target":"RCMS *r_pkcs7_parse_cms (const ut8 *buffer, ut32 length) {\n\tRASN1Object *object;\n\tRCMS *container;\n\tif (!buffer || !length) {\n\t\treturn NULL;\n\t}\n\tcontainer = R_NEW0 (RCMS);\n\tif (!container) {\n\t\treturn NULL;\n\t}\n\tobject = r_asn1_create_object (buffer, length);\n\tif (!object || object->list.length != 2 || !object->list.objects ||\n\t\t!object->list.objects[0] || !object->list.objects[1] ||\n\t\tobject->list.objects[1]->list.length != 1) {\n\t\tr_asn1_free_object (object);\n\t\tfree (container);\n\t\treturn NULL;\n\t}\n\tcontainer->contentType = r_asn1_stringify_oid (object->list.objects[0]->sector, object->list.objects[0]->length);\n\tr_pkcs7_parse_signeddata (&container->signedData, object->list.objects[1]->list.objects[0]);\n\tr_asn1_free_object (object);\n\treturn container;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"r_pkcs7_parse_cms","file_name":"libr/util/r_pkcs7.c","commit_link":"github.com/radare/radare2/commit/7ab66cca5bbdf6cb2d69339ef4f513d95e532dbf","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#2-8fd70ccfcc3d","input":"static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n explicit_vr[MagickPathExtent],\n implicit_vr[MagickPathExtent],\n magick[MagickPathExtent],\n photometric[MagickPathExtent];\n\n DCMStreamInfo\n *stream_info;\n\n Image\n *image;\n\n int\n *bluemap,\n datum,\n *greenmap,\n *graymap,\n index,\n *redmap;\n\n MagickBooleanType\n explicit_file,\n explicit_retry,\n polarity,\n sequence,\n use_explicit;\n\n MagickOffsetType\n offset;\n\n Quantum\n *scale;\n\n register ssize_t\n i,\n x;\n\n register Quantum\n *q;\n\n register unsigned char\n *p;\n\n size_t\n bits_allocated,\n bytes_per_pixel,\n colors,\n depth,\n height,\n length,\n mask,\n max_value,\n number_scenes,\n quantum,\n samples_per_pixel,\n signed_data,\n significant_bits,\n status,\n width,\n window_width;\n\n ssize_t\n count,\n rescale_intercept,\n rescale_slope,\n scene,\n window_center,\n y;\n\n unsigned char\n *data;\n\n unsigned short\n group,\n element;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image->depth=8UL;\n image->endian=LSBEndian;\n /*\n Read DCM preamble.\n */\n stream_info=(DCMStreamInfo *) AcquireMagickMemory(sizeof(*stream_info));\n if (stream_info == (DCMStreamInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(stream_info,0,sizeof(*stream_info));\n count=ReadBlob(image,128,(unsigned char *) magick);\n if (count != 128)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n count=ReadBlob(image,4,(unsigned char *) magick);\n if ((count != 4) || (LocaleNCompare(magick,\"DICM\",4) != 0))\n {\n offset=SeekBlob(image,0L,SEEK_SET);\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Read DCM Medical image.\n */\n (void) CopyMagickString(photometric,\"MONOCHROME1 \",MagickPathExtent);\n bits_allocated=8;\n bytes_per_pixel=1;\n polarity=MagickFalse;\n data=(unsigned char *) NULL;\n depth=8;\n element=0;\n explicit_vr[2]='\\0';\n explicit_file=MagickFalse;\n colors=0;\n redmap=(int *) NULL;\n greenmap=(int *) NULL;\n bluemap=(int *) NULL;\n graymap=(int *) NULL;\n height=0;\n max_value=255UL;\n mask=0xffff;\n number_scenes=1;\n rescale_intercept=0;\n rescale_slope=1;\n samples_per_pixel=1;\n scale=(Quantum *) NULL;\n sequence=MagickFalse;\n signed_data=(~0UL);\n significant_bits=0;\n use_explicit=MagickFalse;\n explicit_retry = MagickFalse;\n width=0;\n window_center=0;\n window_width=0;\n for (group=0; (group != 0x7FE0) || (element != 0x0010) ||\n (sequence != MagickFalse); )\n {\n /*\n Read a group.\n */\n image->offset=(ssize_t) TellBlob(image);\n group=ReadBlobLSBShort(image);\n element=ReadBlobLSBShort(image);\n if ((group != 0x0002) && (image->endian == MSBEndian))\n {\n group=(unsigned short) ((group << 8) | ((group >> 8) & 0xFF));\n element=(unsigned short) ((element << 8) | ((element >> 8) & 0xFF));\n }\n quantum=0;\n /*\n Find corresponding VR for this group and element.\n */\n for (i=0; dicom_info[i].group < 0xffff; i++)\n if ((group == dicom_info[i].group) && (element == dicom_info[i].element))\n break;\n (void) CopyMagickString(implicit_vr,dicom_info[i].vr,MagickPathExtent);\n count=ReadBlob(image,2,(unsigned char *) explicit_vr);\n if (count != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n /*\n Check for \"explicitness\", but meta-file headers always explicit.\n */\n if ((explicit_file == MagickFalse) && (group != 0x0002))\n explicit_file=(isupper((unsigned char) *explicit_vr) != MagickFalse) &&\n (isupper((unsigned char) *(explicit_vr+1)) != MagickFalse) ?\n MagickTrue : MagickFalse;\n use_explicit=((group == 0x0002) && (explicit_retry == MagickFalse)) ||\n (explicit_file != MagickFalse) ? MagickTrue : MagickFalse;\n if ((use_explicit != MagickFalse) && (strncmp(implicit_vr,\"xs\",2) == 0))\n (void) CopyMagickString(implicit_vr,explicit_vr,MagickPathExtent);\n if ((use_explicit == MagickFalse) || (strncmp(implicit_vr,\"!!\",2) == 0))\n {\n offset=SeekBlob(image,(MagickOffsetType) -2,SEEK_CUR);\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n quantum=4;\n }\n else\n {\n /*\n Assume explicit type.\n */\n quantum=2;\n if ((strncmp(explicit_vr,\"OB\",2) == 0) ||\n (strncmp(explicit_vr,\"UN\",2) == 0) ||\n (strncmp(explicit_vr,\"OW\",2) == 0) ||\n (strncmp(explicit_vr,\"SQ\",2) == 0))\n {\n (void) ReadBlobLSBShort(image);\n quantum=4;\n }\n }\n datum=0;\n if (quantum == 4)\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedLong(image);\n else\n datum=ReadBlobSignedLong(image);\n }\n else\n if (quantum == 2)\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedShort(image);\n else\n datum=ReadBlobSignedShort(image);\n }\n quantum=0;\n length=1;\n if (datum != 0)\n {\n if ((strncmp(implicit_vr,\"SS\",2) == 0) ||\n (strncmp(implicit_vr,\"US\",2) == 0))\n quantum=2;\n else\n if ((strncmp(implicit_vr,\"UL\",2) == 0) ||\n (strncmp(implicit_vr,\"SL\",2) == 0) ||\n (strncmp(implicit_vr,\"FL\",2) == 0))\n quantum=4;\n else\n if (strncmp(implicit_vr,\"FD\",2) != 0)\n quantum=1;\n else\n quantum=8;\n if (datum != ~0)\n length=(size_t) datum/quantum;\n else\n {\n /*\n Sequence and item of undefined length.\n */\n quantum=0;\n length=0;\n }\n }\n if (image_info->verbose != MagickFalse)\n {\n /*\n Display Dicom info.\n */\n if (use_explicit == MagickFalse)\n explicit_vr[0]='\\0';\n for (i=0; dicom_info[i].description != (char *) NULL; i++)\n if ((group == dicom_info[i].group) &&\n (element == dicom_info[i].element))\n break;\n (void) FormatLocaleFile(stdout,\"0x%04lX %4ld %s-%s (0x%04lx,0x%04lx)\",\n (unsigned long) image->offset,(long) length,implicit_vr,explicit_vr,\n (unsigned long) group,(unsigned long) element);\n if (dicom_info[i].description != (char *) NULL)\n (void) FormatLocaleFile(stdout,\" %s\",dicom_info[i].description);\n (void) FormatLocaleFile(stdout,\": \");\n }\n if ((sequence == MagickFalse) && (group == 0x7FE0) && (element == 0x0010))\n {\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"\\n\");\n break;\n }\n /*\n Allocate space and read an array.\n */\n data=(unsigned char *) NULL;\n if ((length == 1) && (quantum == 1))\n datum=ReadBlobByte(image);\n else\n if ((length == 1) && (quantum == 2))\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedShort(image);\n else\n datum=ReadBlobSignedShort(image);\n }\n else\n if ((length == 1) && (quantum == 4))\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedLong(image);\n else\n datum=ReadBlobSignedLong(image);\n }\n else\n if ((quantum != 0) && (length != 0))\n {\n if (~length >= 1)\n data=(unsigned char *) AcquireQuantumMemory(length+1,quantum*\n sizeof(*data));\n if (data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n count=ReadBlob(image,(size_t) quantum*length,data);\n if (count != (ssize_t) (quantum*length))\n {\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"count=%d quantum=%d \"\n \"length=%d group=%d\\n\",(int) count,(int) quantum,(int)\n length,(int) group);\n ThrowReaderException(CorruptImageError,\n \"InsufficientImageDataInFile\");\n }\n data[length*quantum]='\\0';\n }\n else\n if ((unsigned int) datum == 0xFFFFFFFFU)\n {\n sequence=MagickTrue;\n continue;\n }\n\n if ((unsigned int) ((group << 16) | element) == 0xFFFEE0DD)\n {\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n sequence=MagickFalse;\n continue;\n }\n\n if (sequence != MagickFalse)\n {\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n continue;\n }\n\n switch (group)\n {\n case 0x0002:\n {\n switch (element)\n {\n case 0x0010:\n {\n char\n transfer_syntax[MagickPathExtent];\n\n /*\n Transfer Syntax.\n */\n if ((datum == 0) && (explicit_retry == MagickFalse))\n {\n explicit_retry=MagickTrue;\n (void) SeekBlob(image,(MagickOffsetType) 0,SEEK_SET);\n group=0;\n element=0;\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\n \"Corrupted image - trying explicit format\\n\");\n break;\n }\n *transfer_syntax='\\0';\n if (data != (unsigned char *) NULL)\n (void) CopyMagickString(transfer_syntax,(char *) data,\n MagickPathExtent);\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"transfer_syntax=%s\\n\",\n (const char *) transfer_syntax);\n if (strncmp(transfer_syntax,\"1.2.840.10008.1.2\",17) == 0)\n {\n int\n count,\n subtype,\n type;\n\n type=1;\n subtype=0;\n if (strlen(transfer_syntax) > 17)\n {\n count=sscanf(transfer_syntax+17,\".%d.%d\",&type,&subtype);\n if (count < 1)\n ThrowReaderException(CorruptImageError,\n \"ImproperImageHeader\");\n }\n switch (type)\n {\n case 1:\n {\n image->endian=LSBEndian;\n break;\n }\n case 2:\n {\n image->endian=MSBEndian;\n break;\n }\n case 4:\n {\n if ((subtype >= 80) && (subtype <= 81))\n image->compression=JPEGCompression;\n else\n if ((subtype >= 90) && (subtype <= 93))\n image->compression=JPEG2000Compression;\n else\n image->compression=JPEGCompression;\n break;\n }\n case 5:\n {\n image->compression=RLECompression;\n break;\n }\n }\n }\n break;\n }\n default:\n break;\n }\n break;\n }\n case 0x0028:\n {\n switch (element)\n {\n case 0x0002:\n {\n /*\n Samples per pixel.\n */\n samples_per_pixel=(size_t) datum;\n break;\n }\n case 0x0004:\n {\n /*\n Photometric interpretation.\n */\n for (i=0; i < (ssize_t) MagickMin(length,MagickPathExtent-1); i++)\n photometric[i]=(char) data[i];\n photometric[i]='\\0';\n polarity=LocaleCompare(photometric,\"MONOCHROME1 \") == 0 ?\n MagickTrue : MagickFalse;\n break;\n }\n case 0x0006:\n {\n /*\n Planar configuration.\n */\n if (datum == 1)\n image->interlace=PlaneInterlace;\n break;\n }\n case 0x0008:\n {\n /*\n Number of frames.\n */\n number_scenes=StringToUnsignedLong((char *) data);\n break;\n }\n case 0x0010:\n {\n /*\n Image rows.\n */\n height=(size_t) datum;\n break;\n }\n case 0x0011:\n {\n /*\n Image columns.\n */\n width=(size_t) datum;\n break;\n }\n case 0x0100:\n {\n /*\n Bits allocated.\n */\n bits_allocated=(size_t) datum;\n bytes_per_pixel=1;\n if (datum > 8)\n bytes_per_pixel=2;\n depth=bits_allocated;\n if (depth > 32)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n max_value=(1UL << bits_allocated)-1;\n break;\n }\n case 0x0101:\n {\n /*\n Bits stored.\n */\n significant_bits=(size_t) datum;\n bytes_per_pixel=1;\n if (significant_bits > 8)\n bytes_per_pixel=2;\n depth=significant_bits;\n if (depth > 32)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n max_value=(1UL << significant_bits)-1;\n mask=(size_t) GetQuantumRange(significant_bits);\n break;\n }\n case 0x0102:\n {\n /*\n High bit.\n */\n break;\n }\n case 0x0103:\n {\n /*\n Pixel representation.\n */\n signed_data=(size_t) datum;\n break;\n }\n case 0x1050:\n {\n /*\n Visible pixel range: center.\n */\n if (data != (unsigned char *) NULL)\n window_center=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1051:\n {\n /*\n Visible pixel range: width.\n */\n if (data != (unsigned char *) NULL)\n window_width=StringToUnsignedLong((char *) data);\n break;\n }\n case 0x1052:\n {\n /*\n Rescale intercept\n */\n if (data != (unsigned char *) NULL)\n rescale_intercept=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1053:\n {\n /*\n Rescale slope\n */\n if (data != (unsigned char *) NULL)\n rescale_slope=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1200:\n case 0x3006:\n {\n /*\n Populate graymap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/bytes_per_pixel);\n datum=(int) colors;\n graymap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*graymap));\n if (graymap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) colors; i++)\n if (bytes_per_pixel == 1)\n graymap[i]=(int) data[i];\n else\n graymap[i]=(int) ((short *) data)[i];\n break;\n }\n case 0x1201:\n {\n unsigned short\n index;\n\n /*\n Populate redmap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n redmap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*redmap));\n if (redmap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n redmap[i]=(int) index;\n p+=2;\n }\n break;\n }\n case 0x1202:\n {\n unsigned short\n index;\n\n /*\n Populate greenmap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n greenmap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*greenmap));\n if (greenmap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n greenmap[i]=(int) index;\n p+=2;\n }\n break;\n }\n case 0x1203:\n {\n unsigned short\n index;\n\n /*\n Populate bluemap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n bluemap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*bluemap));\n if (bluemap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n bluemap[i]=(int) index;\n p+=2;\n }\n break;\n }\n default:\n break;\n }\n break;\n }\n case 0x2050:\n {\n switch (element)\n {\n case 0x0020:\n {\n if ((data != (unsigned char *) NULL) &&\n (strncmp((char *) data,\"INVERSE\",7) == 0))\n polarity=MagickTrue;\n break;\n }\n default:\n break;\n }\n break;\n }\n default:\n break;\n }\n if (data != (unsigned char *) NULL)\n {\n char\n *attribute;\n\n for (i=0; dicom_info[i].description != (char *) NULL; i++)\n if ((group == dicom_info[i].group) &&\n (element == dicom_info[i].element))\n break;\n if (dicom_info[i].description != (char *) NULL)\n {\n attribute=AcquireString(\"dcm:\");\n (void) ConcatenateString(&attribute,dicom_info[i].description);\n for (i=0; i < (ssize_t) MagickMax(length,4); i++)\n if (isprint((int) data[i]) == MagickFalse)\n break;\n if ((i == (ssize_t) length) || (length > 4))\n {\n (void) SubstituteString(&attribute,\" \",\"\");\n (void) SetImageProperty(image,attribute,(char *) data,exception);\n }\n attribute=DestroyString(attribute);\n }\n }\n if (image_info->verbose != MagickFalse)\n {\n if (data == (unsigned char *) NULL)\n (void) FormatLocaleFile(stdout,\"%d\\n\",datum);\n else\n {\n /*\n Display group data.\n */\n for (i=0; i < (ssize_t) MagickMax(length,4); i++)\n if (isprint((int) data[i]) == MagickFalse)\n break;\n if ((i != (ssize_t) length) && (length <= 4))\n {\n ssize_t\n j;\n\n datum=0;\n for (j=(ssize_t) length-1; j >= 0; j--)\n datum=(256*datum+data[j]);\n (void) FormatLocaleFile(stdout,\"%d\",datum);\n }\n else\n for (i=0; i < (ssize_t) length; i++)\n if (isprint((int) data[i]) != MagickFalse)\n (void) FormatLocaleFile(stdout,\"%c\",data[i]);\n else\n (void) FormatLocaleFile(stdout,\"%c\",'.');\n (void) FormatLocaleFile(stdout,\"\\n\");\n }\n }\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n }\n if ((width == 0) || (height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n image->columns=(size_t) width;\n image->rows=(size_t) height;\n if (signed_data == 0xffff)\n signed_data=(size_t) (significant_bits == 16 ? 1 : 0);\n if ((image->compression == JPEGCompression) ||\n (image->compression == JPEG2000Compression))\n {\n Image\n *images;\n\n ImageInfo\n *read_info;\n\n int\n c;\n\n size_t\n length;\n\n unsigned int\n tag;\n\n /*\n Read offset table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n (void) tag;\n length=(size_t) ReadBlobLSBLong(image);\n stream_info->offset_count=length >> 2;\n if (stream_info->offset_count != 0)\n {\n MagickOffsetType\n offset;\n\n stream_info->offsets=(ssize_t *) AcquireQuantumMemory(\n stream_info->offset_count,sizeof(*stream_info->offsets));\n if (stream_info->offsets == (ssize_t *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n offset=TellBlob(image);\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]+=offset;\n }\n /*\n Handle non-native image formats.\n */\n read_info=CloneImageInfo(image_info);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n images=NewImageList();\n for (scene=0; scene < (ssize_t) number_scenes; scene++)\n {\n char\n filename[MagickPathExtent];\n\n const char\n *property;\n\n FILE\n *file;\n\n Image\n *jpeg_image;\n\n int\n unique_file;\n\n unsigned int\n tag;\n\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n length=(size_t) ReadBlobLSBLong(image);\n if (tag == 0xFFFEE0DD)\n break; /* sequence delimiter tag */\n if (tag != 0xFFFEE000)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n file=(FILE *) NULL;\n unique_file=AcquireUniqueFileResource(filename);\n if (unique_file != -1)\n file=fdopen(unique_file,\"wb\");\n if (file == (FILE *) NULL)\n {\n (void) RelinquishUniqueFileResource(filename);\n ThrowFileException(exception,FileOpenError,\n \"UnableToCreateTemporaryFile\",filename);\n break;\n }\n for ( ; length != 0; length--)\n {\n c=ReadBlobByte(image);\n if (c == EOF)\n {\n ThrowFileException(exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n break;\n }\n (void) fputc(c,file);\n }\n (void) fclose(file);\n (void) FormatLocaleString(read_info->filename,MagickPathExtent,\n \"jpeg:%s\",filename);\n if (image->compression == JPEG2000Compression)\n (void) FormatLocaleString(read_info->filename,MagickPathExtent,\n \"j2k:%s\",filename);\n jpeg_image=ReadImage(read_info,exception);\n if (jpeg_image != (Image *) NULL)\n {\n ResetImagePropertyIterator(image);\n property=GetNextImageProperty(image);\n while (property != (const char *) NULL)\n {\n (void) SetImageProperty(jpeg_image,property,\n GetImageProperty(image,property,exception),exception);\n property=GetNextImageProperty(image);\n }\n AppendImageToList(&images,jpeg_image);\n }\n (void) RelinquishUniqueFileResource(filename);\n }\n read_info=DestroyImageInfo(read_info);\n image=DestroyImage(image);\n return(GetFirstImageInList(images));\n }\n if (depth != (1UL*MAGICKCORE_QUANTUM_DEPTH))\n {\n QuantumAny\n range;\n\n size_t\n length;\n\n /*\n Compute pixel scaling table.\n */\n length=(size_t) (GetQuantumRange(depth)+1);\n scale=(Quantum *) AcquireQuantumMemory(length,sizeof(*scale));\n if (scale == (Quantum *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n range=GetQuantumRange(depth);\n for (i=0; i < (ssize_t) (GetQuantumRange(depth)+1); i++)\n scale[i]=ScaleAnyToQuantum((size_t) i,range);\n }\n if (image->compression == RLECompression)\n {\n size_t\n length;\n\n unsigned int\n tag;\n\n /*\n Read RLE offset table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n (void) tag;\n length=(size_t) ReadBlobLSBLong(image);\n stream_info->offset_count=length >> 2;\n if (stream_info->offset_count != 0)\n {\n MagickOffsetType\n offset;\n\n stream_info->offsets=(ssize_t *) AcquireQuantumMemory(\n stream_info->offset_count,sizeof(*stream_info->offsets));\n if (stream_info->offsets == (ssize_t *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n offset=TellBlob(image);\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]+=offset;\n }\n }\n for (scene=0; scene < (ssize_t) number_scenes; scene++)\n {\n if (image_info->ping != MagickFalse)\n break;\n image->columns=(size_t) width;\n image->rows=(size_t) height;\n image->depth=depth;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n break;\n image->colorspace=RGBColorspace;\n if ((image->colormap == (PixelInfo *) NULL) && (samples_per_pixel == 1))\n {\n size_t\n one;\n\n one=1;\n if (colors == 0)\n colors=one << depth;\n if (AcquireImageColormap(image,one << depth,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (redmap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=redmap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].red=(MagickRealType) index;\n }\n if (greenmap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=greenmap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].green=(MagickRealType) index;\n }\n if (bluemap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=bluemap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].blue=(MagickRealType) index;\n }\n if (graymap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=graymap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].red=(MagickRealType) index;\n image->colormap[i].green=(MagickRealType) index;\n image->colormap[i].blue=(MagickRealType) index;\n }\n }\n if (image->compression == RLECompression)\n {\n unsigned int\n tag;\n\n /*\n Read RLE segment table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n stream_info->remaining=(size_t) ReadBlobLSBLong(image);\n if ((tag != 0xFFFEE000) || (stream_info->remaining <= 64) ||\n (EOFBlob(image) != MagickFalse))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n stream_info->count=0;\n stream_info->segment_count=ReadBlobLSBLong(image);\n if (stream_info->segment_count > 1)\n {\n bytes_per_pixel=1;\n depth=8;\n }\n for (i=0; i < 15; i++)\n stream_info->segments[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n stream_info->remaining-=64;\n }\n if ((samples_per_pixel > 1) && (image->interlace == PlaneInterlace))\n {\n /*\n Convert Planar RGB DCM Medical image to pixel packets.\n */\n for (i=0; i < (ssize_t) samples_per_pixel; i++)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n switch ((int) i)\n {\n case 0:\n {\n SetPixelRed(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 1:\n {\n SetPixelGreen(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 2:\n {\n SetPixelBlue(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 3:\n {\n SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n default:\n break;\n }\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n }\n else\n {\n const char\n *option;\n\n int\n byte;\n\n PixelPacket\n pixel;\n\n /*\n Convert DCM Medical image to pixel packets.\n */\n byte=0;\n i=0;\n if ((window_center != 0) && (window_width == 0))\n window_width=(size_t) window_center;\n option=GetImageOption(image_info,\"dcm:display-range\");\n if (option != (const char *) NULL)\n {\n if (LocaleCompare(option,\"reset\") == 0)\n window_width=0;\n }\n (void) ResetMagickMemory(&pixel,0,sizeof(pixel));\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (samples_per_pixel == 1)\n {\n int\n pixel_value;\n\n if (bytes_per_pixel == 1)\n pixel_value=polarity != MagickFalse ?\n ((int) max_value-ReadDCMByte(stream_info,image)) :\n ReadDCMByte(stream_info,image);\n else\n if ((bits_allocated != 12) || (significant_bits != 12))\n {\n if (signed_data)\n pixel_value=ReadDCMSignedShort(stream_info,image);\n else\n pixel_value=ReadDCMShort(stream_info,image);\n if (polarity != MagickFalse)\n pixel_value=(int)max_value-pixel_value;\n }\n else\n {\n if ((i & 0x01) != 0)\n pixel_value=(ReadDCMByte(stream_info,image) << 8) |\n byte;\n else\n {\n pixel_value=ReadDCMSignedShort(stream_info,image);\n byte=(int) (pixel_value & 0x0f);\n pixel_value>>=4;\n }\n i++;\n }\n index=(pixel_value*rescale_slope)+rescale_intercept;\n if (window_width == 0)\n {\n if (signed_data == 1)\n index-=32767;\n }\n else\n {\n ssize_t\n window_max,\n window_min;\n\n window_min=(ssize_t) ceil((double) window_center-\n (window_width-1.0)/2.0-0.5);\n window_max=(ssize_t) floor((double) window_center+\n (window_width-1.0)/2.0+0.5);\n if ((ssize_t)index <= window_min)\n index=0;\n else\n if ((ssize_t)index > window_max)\n index=(int) max_value;\n else\n index=(int) (max_value*(((index-window_center-\n 0.5)/(window_width-1))+0.5));\n }\n index&=mask;\n index=(int) ConstrainColormapIndex(image,(size_t) index,\n exception);\n SetPixelIndex(image,(Quantum) index,q);\n pixel.red=(unsigned int) image->colormap[index].red;\n pixel.green=(unsigned int) image->colormap[index].green;\n pixel.blue=(unsigned int) image->colormap[index].blue;\n }\n else\n {\n if (bytes_per_pixel == 1)\n {\n pixel.red=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.green=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.blue=(unsigned int) ReadDCMByte(stream_info,image);\n }\n else\n {\n pixel.red=ReadDCMShort(stream_info,image);\n pixel.green=ReadDCMShort(stream_info,image);\n pixel.blue=ReadDCMShort(stream_info,image);\n }\n pixel.red&=mask;\n pixel.green&=mask;\n pixel.blue&=mask;\n if (scale != (Quantum *) NULL)\n {\n pixel.red=scale[pixel.red];\n pixel.green=scale[pixel.green];\n pixel.blue=scale[pixel.blue];\n }\n }\n SetPixelRed(image,(Quantum) pixel.red,q);\n SetPixelGreen(image,(Quantum) pixel.green,q);\n SetPixelBlue(image,(Quantum) pixel.blue,q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n if (stream_info->segment_count > 1)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (samples_per_pixel == 1)\n {\n int\n pixel_value;\n\n if (bytes_per_pixel == 1)\n pixel_value=polarity != MagickFalse ?\n ((int) max_value-ReadDCMByte(stream_info,image)) :\n ReadDCMByte(stream_info,image);\n else\n if ((bits_allocated != 12) || (significant_bits != 12))\n {\n pixel_value=(int) (polarity != MagickFalse ?\n (max_value-ReadDCMShort(stream_info,image)) :\n ReadDCMShort(stream_info,image));\n if (signed_data == 1)\n pixel_value=((signed short) pixel_value);\n }\n else\n {\n if ((i & 0x01) != 0)\n pixel_value=(ReadDCMByte(stream_info,image) << 8) |\n byte;\n else\n {\n pixel_value=ReadDCMShort(stream_info,image);\n byte=(int) (pixel_value & 0x0f);\n pixel_value>>=4;\n }\n i++;\n }\n index=(pixel_value*rescale_slope)+rescale_intercept;\n if (window_width == 0)\n {\n if (signed_data == 1)\n index-=32767;\n }\n else\n {\n ssize_t\n window_max,\n window_min;\n\n window_min=(ssize_t) ceil((double) window_center-\n (window_width-1.0)/2.0-0.5);\n window_max=(ssize_t) floor((double) window_center+\n (window_width-1.0)/2.0+0.5);\n if ((ssize_t)index <= window_min)\n index=0;\n else\n if ((ssize_t)index > window_max)\n index=(int) max_value;\n else\n index=(int) (max_value*(((index-window_center-\n 0.5)/(window_width-1))+0.5));\n }\n index&=mask;\n index=(int) ConstrainColormapIndex(image,(size_t) index,\n exception);\n SetPixelIndex(image,(Quantum) (((size_t)\n GetPixelIndex(image,q)) | (((size_t) index) << 8)),q);\n pixel.red=(unsigned int) image->colormap[index].red;\n pixel.green=(unsigned int) image->colormap[index].green;\n pixel.blue=(unsigned int) image->colormap[index].blue;\n }\n else\n {\n if (bytes_per_pixel == 1)\n {\n pixel.red=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.green=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.blue=(unsigned int) ReadDCMByte(stream_info,image);\n }\n else\n {\n pixel.red=ReadDCMShort(stream_info,image);\n pixel.green=ReadDCMShort(stream_info,image);\n pixel.blue=ReadDCMShort(stream_info,image);\n }\n pixel.red&=mask;\n pixel.green&=mask;\n pixel.blue&=mask;\n if (scale != (Quantum *) NULL)\n {\n pixel.red=scale[pixel.red];\n pixel.green=scale[pixel.green];\n pixel.blue=scale[pixel.blue];\n }\n }\n SetPixelRed(image,(Quantum) (((size_t) GetPixelRed(image,q)) |\n (((size_t) pixel.red) << 8)),q);\n SetPixelGreen(image,(Quantum) (((size_t) GetPixelGreen(image,q)) |\n (((size_t) pixel.green) << 8)),q);\n SetPixelBlue(image,(Quantum) (((size_t) GetPixelBlue(image,q)) |\n (((size_t) pixel.blue) << 8)),q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n if (SetImageGray(image,exception) != MagickFalse)\n (void) SetImageColorspace(image,GRAYColorspace,exception);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n if (scene < (ssize_t) (number_scenes-1))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n }\n /*\n Free resources.\n */\n if (stream_info->offsets != (ssize_t *) NULL)\n stream_info->offsets=(ssize_t *)\n RelinquishMagickMemory(stream_info->offsets);\n stream_info=(DCMStreamInfo *) RelinquishMagickMemory(stream_info);\n if (scale != (Quantum *) NULL)\n scale=(Quantum *) RelinquishMagickMemory(scale);\n if (graymap != (int *) NULL)\n graymap=(int *) RelinquishMagickMemory(graymap);\n if (bluemap != (int *) NULL)\n bluemap=(int *) RelinquishMagickMemory(bluemap);\n if (greenmap != (int *) NULL)\n greenmap=(int *) RelinquishMagickMemory(greenmap);\n if (redmap != (int *) NULL)\n redmap=(int *) RelinquishMagickMemory(redmap);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n explicit_vr[MagickPathExtent],\n implicit_vr[MagickPathExtent],\n magick[MagickPathExtent],\n photometric[MagickPathExtent];\n\n DCMStreamInfo\n *stream_info;\n\n Image\n *image;\n\n int\n *bluemap,\n datum,\n *greenmap,\n *graymap,\n index,\n *redmap;\n\n MagickBooleanType\n explicit_file,\n explicit_retry,\n polarity,\n sequence,\n use_explicit;\n\n MagickOffsetType\n offset;\n\n Quantum\n *scale;\n\n register ssize_t\n i,\n x;\n\n register Quantum\n *q;\n\n register unsigned char\n *p;\n\n size_t\n bits_allocated,\n bytes_per_pixel,\n colors,\n depth,\n height,\n length,\n mask,\n max_value,\n number_scenes,\n quantum,\n samples_per_pixel,\n signed_data,\n significant_bits,\n status,\n width,\n window_width;\n\n ssize_t\n count,\n rescale_intercept,\n rescale_slope,\n scene,\n window_center,\n y;\n\n unsigned char\n *data;\n\n unsigned short\n group,\n element;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image->depth=8UL;\n image->endian=LSBEndian;\n /*\n Read DCM preamble.\n */\n stream_info=(DCMStreamInfo *) AcquireMagickMemory(sizeof(*stream_info));\n if (stream_info == (DCMStreamInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(stream_info,0,sizeof(*stream_info));\n count=ReadBlob(image,128,(unsigned char *) magick);\n if (count != 128)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n count=ReadBlob(image,4,(unsigned char *) magick);\n if ((count != 4) || (LocaleNCompare(magick,\"DICM\",4) != 0))\n {\n offset=SeekBlob(image,0L,SEEK_SET);\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Read DCM Medical image.\n */\n (void) CopyMagickString(photometric,\"MONOCHROME1 \",MagickPathExtent);\n bits_allocated=8;\n bytes_per_pixel=1;\n polarity=MagickFalse;\n data=(unsigned char *) NULL;\n depth=8;\n element=0;\n explicit_vr[2]='\\0';\n explicit_file=MagickFalse;\n colors=0;\n redmap=(int *) NULL;\n greenmap=(int *) NULL;\n bluemap=(int *) NULL;\n graymap=(int *) NULL;\n height=0;\n max_value=255UL;\n mask=0xffff;\n number_scenes=1;\n rescale_intercept=0;\n rescale_slope=1;\n samples_per_pixel=1;\n scale=(Quantum *) NULL;\n sequence=MagickFalse;\n signed_data=(~0UL);\n significant_bits=0;\n use_explicit=MagickFalse;\n explicit_retry = MagickFalse;\n width=0;\n window_center=0;\n window_width=0;\n for (group=0; (group != 0x7FE0) || (element != 0x0010) ||\n (sequence != MagickFalse); )\n {\n /*\n Read a group.\n */\n image->offset=(ssize_t) TellBlob(image);\n group=ReadBlobLSBShort(image);\n element=ReadBlobLSBShort(image);\n if ((group != 0x0002) && (image->endian == MSBEndian))\n {\n group=(unsigned short) ((group << 8) | ((group >> 8) & 0xFF));\n element=(unsigned short) ((element << 8) | ((element >> 8) & 0xFF));\n }\n quantum=0;\n /*\n Find corresponding VR for this group and element.\n */\n for (i=0; dicom_info[i].group < 0xffff; i++)\n if ((group == dicom_info[i].group) && (element == dicom_info[i].element))\n break;\n (void) CopyMagickString(implicit_vr,dicom_info[i].vr,MagickPathExtent);\n count=ReadBlob(image,2,(unsigned char *) explicit_vr);\n if (count != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n /*\n Check for \"explicitness\", but meta-file headers always explicit.\n */\n if ((explicit_file == MagickFalse) && (group != 0x0002))\n explicit_file=(isupper((unsigned char) *explicit_vr) != MagickFalse) &&\n (isupper((unsigned char) *(explicit_vr+1)) != MagickFalse) ?\n MagickTrue : MagickFalse;\n use_explicit=((group == 0x0002) && (explicit_retry == MagickFalse)) ||\n (explicit_file != MagickFalse) ? MagickTrue : MagickFalse;\n if ((use_explicit != MagickFalse) && (strncmp(implicit_vr,\"xs\",2) == 0))\n (void) CopyMagickString(implicit_vr,explicit_vr,MagickPathExtent);\n if ((use_explicit == MagickFalse) || (strncmp(implicit_vr,\"!!\",2) == 0))\n {\n offset=SeekBlob(image,(MagickOffsetType) -2,SEEK_CUR);\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n quantum=4;\n }\n else\n {\n /*\n Assume explicit type.\n */\n quantum=2;\n if ((strncmp(explicit_vr,\"OB\",2) == 0) ||\n (strncmp(explicit_vr,\"UN\",2) == 0) ||\n (strncmp(explicit_vr,\"OW\",2) == 0) ||\n (strncmp(explicit_vr,\"SQ\",2) == 0))\n {\n (void) ReadBlobLSBShort(image);\n quantum=4;\n }\n }\n datum=0;\n if (quantum == 4)\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedLong(image);\n else\n datum=ReadBlobSignedLong(image);\n }\n else\n if (quantum == 2)\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedShort(image);\n else\n datum=ReadBlobSignedShort(image);\n }\n quantum=0;\n length=1;\n if (datum != 0)\n {\n if ((strncmp(implicit_vr,\"SS\",2) == 0) ||\n (strncmp(implicit_vr,\"US\",2) == 0))\n quantum=2;\n else\n if ((strncmp(implicit_vr,\"UL\",2) == 0) ||\n (strncmp(implicit_vr,\"SL\",2) == 0) ||\n (strncmp(implicit_vr,\"FL\",2) == 0))\n quantum=4;\n else\n if (strncmp(implicit_vr,\"FD\",2) != 0)\n quantum=1;\n else\n quantum=8;\n if (datum != ~0)\n length=(size_t) datum/quantum;\n else\n {\n /*\n Sequence and item of undefined length.\n */\n quantum=0;\n length=0;\n }\n }\n if (image_info->verbose != MagickFalse)\n {\n /*\n Display Dicom info.\n */\n if (use_explicit == MagickFalse)\n explicit_vr[0]='\\0';\n for (i=0; dicom_info[i].description != (char *) NULL; i++)\n if ((group == dicom_info[i].group) &&\n (element == dicom_info[i].element))\n break;\n (void) FormatLocaleFile(stdout,\"0x%04lX %4ld %s-%s (0x%04lx,0x%04lx)\",\n (unsigned long) image->offset,(long) length,implicit_vr,explicit_vr,\n (unsigned long) group,(unsigned long) element);\n if (dicom_info[i].description != (char *) NULL)\n (void) FormatLocaleFile(stdout,\" %s\",dicom_info[i].description);\n (void) FormatLocaleFile(stdout,\": \");\n }\n if ((sequence == MagickFalse) && (group == 0x7FE0) && (element == 0x0010))\n {\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"\\n\");\n break;\n }\n /*\n Allocate space and read an array.\n */\n data=(unsigned char *) NULL;\n if ((length == 1) && (quantum == 1))\n datum=ReadBlobByte(image);\n else\n if ((length == 1) && (quantum == 2))\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedShort(image);\n else\n datum=ReadBlobSignedShort(image);\n }\n else\n if ((length == 1) && (quantum == 4))\n {\n if (group == 0x0002)\n datum=ReadBlobLSBSignedLong(image);\n else\n datum=ReadBlobSignedLong(image);\n }\n else\n if ((quantum != 0) && (length != 0))\n {\n if (~length >= 1)\n data=(unsigned char *) AcquireQuantumMemory(length+1,quantum*\n sizeof(*data));\n if (data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n count=ReadBlob(image,(size_t) quantum*length,data);\n if (count != (ssize_t) (quantum*length))\n {\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"count=%d quantum=%d \"\n \"length=%d group=%d\\n\",(int) count,(int) quantum,(int)\n length,(int) group);\n ThrowReaderException(CorruptImageError,\n \"InsufficientImageDataInFile\");\n }\n data[length*quantum]='\\0';\n }\n else\n if ((unsigned int) datum == 0xFFFFFFFFU)\n {\n sequence=MagickTrue;\n continue;\n }\n\n if ((unsigned int) ((group << 16) | element) == 0xFFFEE0DD)\n {\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n sequence=MagickFalse;\n continue;\n }\n\n if (sequence != MagickFalse)\n {\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n continue;\n }\n\n switch (group)\n {\n case 0x0002:\n {\n switch (element)\n {\n case 0x0010:\n {\n char\n transfer_syntax[MagickPathExtent];\n\n /*\n Transfer Syntax.\n */\n if ((datum == 0) && (explicit_retry == MagickFalse))\n {\n explicit_retry=MagickTrue;\n (void) SeekBlob(image,(MagickOffsetType) 0,SEEK_SET);\n group=0;\n element=0;\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\n \"Corrupted image - trying explicit format\\n\");\n break;\n }\n *transfer_syntax='\\0';\n if (data != (unsigned char *) NULL)\n (void) CopyMagickString(transfer_syntax,(char *) data,\n MagickPathExtent);\n if (image_info->verbose != MagickFalse)\n (void) FormatLocaleFile(stdout,\"transfer_syntax=%s\\n\",\n (const char *) transfer_syntax);\n if (strncmp(transfer_syntax,\"1.2.840.10008.1.2\",17) == 0)\n {\n int\n count,\n subtype,\n type;\n\n type=1;\n subtype=0;\n if (strlen(transfer_syntax) > 17)\n {\n count=sscanf(transfer_syntax+17,\".%d.%d\",&type,&subtype);\n if (count < 1)\n ThrowReaderException(CorruptImageError,\n \"ImproperImageHeader\");\n }\n switch (type)\n {\n case 1:\n {\n image->endian=LSBEndian;\n break;\n }\n case 2:\n {\n image->endian=MSBEndian;\n break;\n }\n case 4:\n {\n if ((subtype >= 80) && (subtype <= 81))\n image->compression=JPEGCompression;\n else\n if ((subtype >= 90) && (subtype <= 93))\n image->compression=JPEG2000Compression;\n else\n image->compression=JPEGCompression;\n break;\n }\n case 5:\n {\n image->compression=RLECompression;\n break;\n }\n }\n }\n break;\n }\n default:\n break;\n }\n break;\n }\n case 0x0028:\n {\n switch (element)\n {\n case 0x0002:\n {\n /*\n Samples per pixel.\n */\n samples_per_pixel=(size_t) datum;\n break;\n }\n case 0x0004:\n {\n /*\n Photometric interpretation.\n */\n if (data == (unsigned char *) NULL)\n break;\n for (i=0; i < (ssize_t) MagickMin(length,MagickPathExtent-1); i++)\n photometric[i]=(char) data[i];\n photometric[i]='\\0';\n polarity=LocaleCompare(photometric,\"MONOCHROME1 \") == 0 ?\n MagickTrue : MagickFalse;\n break;\n }\n case 0x0006:\n {\n /*\n Planar configuration.\n */\n if (datum == 1)\n image->interlace=PlaneInterlace;\n break;\n }\n case 0x0008:\n {\n /*\n Number of frames.\n */\n if (data == (unsigned char *) NULL)\n break;\n number_scenes=StringToUnsignedLong((char *) data);\n break;\n }\n case 0x0010:\n {\n /*\n Image rows.\n */\n height=(size_t) datum;\n break;\n }\n case 0x0011:\n {\n /*\n Image columns.\n */\n width=(size_t) datum;\n break;\n }\n case 0x0100:\n {\n /*\n Bits allocated.\n */\n bits_allocated=(size_t) datum;\n bytes_per_pixel=1;\n if (datum > 8)\n bytes_per_pixel=2;\n depth=bits_allocated;\n if (depth > 32)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n max_value=(1UL << bits_allocated)-1;\n break;\n }\n case 0x0101:\n {\n /*\n Bits stored.\n */\n significant_bits=(size_t) datum;\n bytes_per_pixel=1;\n if (significant_bits > 8)\n bytes_per_pixel=2;\n depth=significant_bits;\n if (depth > 32)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n max_value=(1UL << significant_bits)-1;\n mask=(size_t) GetQuantumRange(significant_bits);\n break;\n }\n case 0x0102:\n {\n /*\n High bit.\n */\n break;\n }\n case 0x0103:\n {\n /*\n Pixel representation.\n */\n signed_data=(size_t) datum;\n break;\n }\n case 0x1050:\n {\n /*\n Visible pixel range: center.\n */\n if (data != (unsigned char *) NULL)\n window_center=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1051:\n {\n /*\n Visible pixel range: width.\n */\n if (data != (unsigned char *) NULL)\n window_width=StringToUnsignedLong((char *) data);\n break;\n }\n case 0x1052:\n {\n /*\n Rescale intercept\n */\n if (data != (unsigned char *) NULL)\n rescale_intercept=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1053:\n {\n /*\n Rescale slope\n */\n if (data != (unsigned char *) NULL)\n rescale_slope=(ssize_t) StringToLong((char *) data);\n break;\n }\n case 0x1200:\n case 0x3006:\n {\n /*\n Populate graymap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/bytes_per_pixel);\n datum=(int) colors;\n graymap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*graymap));\n if (graymap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) colors; i++)\n if (bytes_per_pixel == 1)\n graymap[i]=(int) data[i];\n else\n graymap[i]=(int) ((short *) data)[i];\n break;\n }\n case 0x1201:\n {\n unsigned short\n index;\n\n /*\n Populate redmap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n redmap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*redmap));\n if (redmap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n redmap[i]=(int) index;\n p+=2;\n }\n break;\n }\n case 0x1202:\n {\n unsigned short\n index;\n\n /*\n Populate greenmap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n greenmap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*greenmap));\n if (greenmap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n greenmap[i]=(int) index;\n p+=2;\n }\n break;\n }\n case 0x1203:\n {\n unsigned short\n index;\n\n /*\n Populate bluemap.\n */\n if (data == (unsigned char *) NULL)\n break;\n colors=(size_t) (length/2);\n datum=(int) colors;\n bluemap=(int *) AcquireQuantumMemory((size_t) colors,\n sizeof(*bluemap));\n if (bluemap == (int *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n for (i=0; i < (ssize_t) colors; i++)\n {\n if (image->endian == MSBEndian)\n index=(unsigned short) ((*p << 8) | *(p+1));\n else\n index=(unsigned short) (*p | (*(p+1) << 8));\n bluemap[i]=(int) index;\n p+=2;\n }\n break;\n }\n default:\n break;\n }\n break;\n }\n case 0x2050:\n {\n switch (element)\n {\n case 0x0020:\n {\n if ((data != (unsigned char *) NULL) &&\n (strncmp((char *) data,\"INVERSE\",7) == 0))\n polarity=MagickTrue;\n break;\n }\n default:\n break;\n }\n break;\n }\n default:\n break;\n }\n if (data != (unsigned char *) NULL)\n {\n char\n *attribute;\n\n for (i=0; dicom_info[i].description != (char *) NULL; i++)\n if ((group == dicom_info[i].group) &&\n (element == dicom_info[i].element))\n break;\n if (dicom_info[i].description != (char *) NULL)\n {\n attribute=AcquireString(\"dcm:\");\n (void) ConcatenateString(&attribute,dicom_info[i].description);\n for (i=0; i < (ssize_t) MagickMax(length,4); i++)\n if (isprint((int) data[i]) == MagickFalse)\n break;\n if ((i == (ssize_t) length) || (length > 4))\n {\n (void) SubstituteString(&attribute,\" \",\"\");\n (void) SetImageProperty(image,attribute,(char *) data,exception);\n }\n attribute=DestroyString(attribute);\n }\n }\n if (image_info->verbose != MagickFalse)\n {\n if (data == (unsigned char *) NULL)\n (void) FormatLocaleFile(stdout,\"%d\\n\",datum);\n else\n {\n /*\n Display group data.\n */\n for (i=0; i < (ssize_t) MagickMax(length,4); i++)\n if (isprint((int) data[i]) == MagickFalse)\n break;\n if ((i != (ssize_t) length) && (length <= 4))\n {\n ssize_t\n j;\n\n datum=0;\n for (j=(ssize_t) length-1; j >= 0; j--)\n datum=(256*datum+data[j]);\n (void) FormatLocaleFile(stdout,\"%d\",datum);\n }\n else\n for (i=0; i < (ssize_t) length; i++)\n if (isprint((int) data[i]) != MagickFalse)\n (void) FormatLocaleFile(stdout,\"%c\",data[i]);\n else\n (void) FormatLocaleFile(stdout,\"%c\",'.');\n (void) FormatLocaleFile(stdout,\"\\n\");\n }\n }\n if (data != (unsigned char *) NULL)\n data=(unsigned char *) RelinquishMagickMemory(data);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n }\n if ((width == 0) || (height == 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n image->columns=(size_t) width;\n image->rows=(size_t) height;\n if (signed_data == 0xffff)\n signed_data=(size_t) (significant_bits == 16 ? 1 : 0);\n if ((image->compression == JPEGCompression) ||\n (image->compression == JPEG2000Compression))\n {\n Image\n *images;\n\n ImageInfo\n *read_info;\n\n int\n c;\n\n size_t\n length;\n\n unsigned int\n tag;\n\n /*\n Read offset table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n (void) tag;\n length=(size_t) ReadBlobLSBLong(image);\n stream_info->offset_count=length >> 2;\n if (stream_info->offset_count != 0)\n {\n MagickOffsetType\n offset;\n\n stream_info->offsets=(ssize_t *) AcquireQuantumMemory(\n stream_info->offset_count,sizeof(*stream_info->offsets));\n if (stream_info->offsets == (ssize_t *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n offset=TellBlob(image);\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]+=offset;\n }\n /*\n Handle non-native image formats.\n */\n read_info=CloneImageInfo(image_info);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n images=NewImageList();\n for (scene=0; scene < (ssize_t) number_scenes; scene++)\n {\n char\n filename[MagickPathExtent];\n\n const char\n *property;\n\n FILE\n *file;\n\n Image\n *jpeg_image;\n\n int\n unique_file;\n\n unsigned int\n tag;\n\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n length=(size_t) ReadBlobLSBLong(image);\n if (tag == 0xFFFEE0DD)\n break; /* sequence delimiter tag */\n if (tag != 0xFFFEE000)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n file=(FILE *) NULL;\n unique_file=AcquireUniqueFileResource(filename);\n if (unique_file != -1)\n file=fdopen(unique_file,\"wb\");\n if (file == (FILE *) NULL)\n {\n (void) RelinquishUniqueFileResource(filename);\n ThrowFileException(exception,FileOpenError,\n \"UnableToCreateTemporaryFile\",filename);\n break;\n }\n for ( ; length != 0; length--)\n {\n c=ReadBlobByte(image);\n if (c == EOF)\n {\n ThrowFileException(exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n break;\n }\n (void) fputc(c,file);\n }\n (void) fclose(file);\n (void) FormatLocaleString(read_info->filename,MagickPathExtent,\n \"jpeg:%s\",filename);\n if (image->compression == JPEG2000Compression)\n (void) FormatLocaleString(read_info->filename,MagickPathExtent,\n \"j2k:%s\",filename);\n jpeg_image=ReadImage(read_info,exception);\n if (jpeg_image != (Image *) NULL)\n {\n ResetImagePropertyIterator(image);\n property=GetNextImageProperty(image);\n while (property != (const char *) NULL)\n {\n (void) SetImageProperty(jpeg_image,property,\n GetImageProperty(image,property,exception),exception);\n property=GetNextImageProperty(image);\n }\n AppendImageToList(&images,jpeg_image);\n }\n (void) RelinquishUniqueFileResource(filename);\n }\n read_info=DestroyImageInfo(read_info);\n image=DestroyImage(image);\n return(GetFirstImageInList(images));\n }\n if (depth != (1UL*MAGICKCORE_QUANTUM_DEPTH))\n {\n QuantumAny\n range;\n\n size_t\n length;\n\n /*\n Compute pixel scaling table.\n */\n length=(size_t) (GetQuantumRange(depth)+1);\n scale=(Quantum *) AcquireQuantumMemory(length,sizeof(*scale));\n if (scale == (Quantum *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n range=GetQuantumRange(depth);\n for (i=0; i <= (ssize_t) GetQuantumRange(depth); i++)\n scale[i]=ScaleAnyToQuantum((size_t) i,range);\n }\n if (image->compression == RLECompression)\n {\n size_t\n length;\n\n unsigned int\n tag;\n\n /*\n Read RLE offset table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n (void) tag;\n length=(size_t) ReadBlobLSBLong(image);\n stream_info->offset_count=length >> 2;\n if (stream_info->offset_count != 0)\n {\n MagickOffsetType\n offset;\n\n stream_info->offsets=(ssize_t *) AcquireQuantumMemory(\n stream_info->offset_count,sizeof(*stream_info->offsets));\n if (stream_info->offsets == (ssize_t *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n offset=TellBlob(image);\n for (i=0; i < (ssize_t) stream_info->offset_count; i++)\n stream_info->offsets[i]+=offset;\n }\n }\n for (scene=0; scene < (ssize_t) number_scenes; scene++)\n {\n if (image_info->ping != MagickFalse)\n break;\n image->columns=(size_t) width;\n image->rows=(size_t) height;\n image->depth=depth;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n break;\n image->colorspace=RGBColorspace;\n if ((image->colormap == (PixelInfo *) NULL) && (samples_per_pixel == 1))\n {\n size_t\n one;\n\n one=1;\n if (colors == 0)\n colors=one << depth;\n if (AcquireImageColormap(image,one << depth,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (redmap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=redmap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].red=(MagickRealType) index;\n }\n if (greenmap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=greenmap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].green=(MagickRealType) index;\n }\n if (bluemap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=bluemap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].blue=(MagickRealType) index;\n }\n if (graymap != (int *) NULL)\n for (i=0; i < (ssize_t) colors; i++)\n {\n index=graymap[i];\n if ((scale != (Quantum *) NULL) && (index <= (int) max_value))\n index=(int) scale[index];\n image->colormap[i].red=(MagickRealType) index;\n image->colormap[i].green=(MagickRealType) index;\n image->colormap[i].blue=(MagickRealType) index;\n }\n }\n if (image->compression == RLECompression)\n {\n unsigned int\n tag;\n\n /*\n Read RLE segment table.\n */\n for (i=0; i < (ssize_t) stream_info->remaining; i++)\n (void) ReadBlobByte(image);\n tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);\n stream_info->remaining=(size_t) ReadBlobLSBLong(image);\n if ((tag != 0xFFFEE000) || (stream_info->remaining <= 64) ||\n (EOFBlob(image) != MagickFalse))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n stream_info->count=0;\n stream_info->segment_count=ReadBlobLSBLong(image);\n if (stream_info->segment_count > 1)\n {\n bytes_per_pixel=1;\n depth=8;\n }\n for (i=0; i < 15; i++)\n stream_info->segments[i]=(ssize_t) ReadBlobLSBSignedLong(image);\n stream_info->remaining-=64;\n }\n if ((samples_per_pixel > 1) && (image->interlace == PlaneInterlace))\n {\n /*\n Convert Planar RGB DCM Medical image to pixel packets.\n */\n for (i=0; i < (ssize_t) samples_per_pixel; i++)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n switch ((int) i)\n {\n case 0:\n {\n SetPixelRed(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 1:\n {\n SetPixelGreen(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 2:\n {\n SetPixelBlue(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n case 3:\n {\n SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)\n ReadDCMByte(stream_info,image)),q);\n break;\n }\n default:\n break;\n }\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n }\n else\n {\n const char\n *option;\n\n int\n byte;\n\n PixelPacket\n pixel;\n\n /*\n Convert DCM Medical image to pixel packets.\n */\n byte=0;\n i=0;\n if ((window_center != 0) && (window_width == 0))\n window_width=(size_t) window_center;\n option=GetImageOption(image_info,\"dcm:display-range\");\n if (option != (const char *) NULL)\n {\n if (LocaleCompare(option,\"reset\") == 0)\n window_width=0;\n }\n (void) ResetMagickMemory(&pixel,0,sizeof(pixel));\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (samples_per_pixel == 1)\n {\n int\n pixel_value;\n\n if (bytes_per_pixel == 1)\n pixel_value=polarity != MagickFalse ?\n ((int) max_value-ReadDCMByte(stream_info,image)) :\n ReadDCMByte(stream_info,image);\n else\n if ((bits_allocated != 12) || (significant_bits != 12))\n {\n if (signed_data)\n pixel_value=ReadDCMSignedShort(stream_info,image);\n else\n pixel_value=ReadDCMShort(stream_info,image);\n if (polarity != MagickFalse)\n pixel_value=(int)max_value-pixel_value;\n }\n else\n {\n if ((i & 0x01) != 0)\n pixel_value=(ReadDCMByte(stream_info,image) << 8) |\n byte;\n else\n {\n pixel_value=ReadDCMSignedShort(stream_info,image);\n byte=(int) (pixel_value & 0x0f);\n pixel_value>>=4;\n }\n i++;\n }\n index=(pixel_value*rescale_slope)+rescale_intercept;\n if (window_width == 0)\n {\n if (signed_data == 1)\n index-=32767;\n }\n else\n {\n ssize_t\n window_max,\n window_min;\n\n window_min=(ssize_t) ceil((double) window_center-\n (window_width-1.0)/2.0-0.5);\n window_max=(ssize_t) floor((double) window_center+\n (window_width-1.0)/2.0+0.5);\n if ((ssize_t)index <= window_min)\n index=0;\n else\n if ((ssize_t)index > window_max)\n index=(int) max_value;\n else\n index=(int) (max_value*(((index-window_center-\n 0.5)/(window_width-1))+0.5));\n }\n index&=mask;\n index=(int) ConstrainColormapIndex(image,(size_t) index,\n exception);\n SetPixelIndex(image,(Quantum) index,q);\n pixel.red=(unsigned int) image->colormap[index].red;\n pixel.green=(unsigned int) image->colormap[index].green;\n pixel.blue=(unsigned int) image->colormap[index].blue;\n }\n else\n {\n if (bytes_per_pixel == 1)\n {\n pixel.red=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.green=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.blue=(unsigned int) ReadDCMByte(stream_info,image);\n }\n else\n {\n pixel.red=ReadDCMShort(stream_info,image);\n pixel.green=ReadDCMShort(stream_info,image);\n pixel.blue=ReadDCMShort(stream_info,image);\n }\n pixel.red&=mask;\n pixel.green&=mask;\n pixel.blue&=mask;\n if (scale != (Quantum *) NULL)\n {\n if (pixel.red <= GetQuantumRange(depth))\n pixel.red=scale[pixel.red];\n if (pixel.green <= GetQuantumRange(depth))\n pixel.green=scale[pixel.green];\n if (pixel.blue <= GetQuantumRange(depth))\n pixel.blue=scale[pixel.blue];\n }\n }\n SetPixelRed(image,(Quantum) pixel.red,q);\n SetPixelGreen(image,(Quantum) pixel.green,q);\n SetPixelBlue(image,(Quantum) pixel.blue,q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n if (stream_info->segment_count > 1)\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (samples_per_pixel == 1)\n {\n int\n pixel_value;\n\n if (bytes_per_pixel == 1)\n pixel_value=polarity != MagickFalse ?\n ((int) max_value-ReadDCMByte(stream_info,image)) :\n ReadDCMByte(stream_info,image);\n else\n if ((bits_allocated != 12) || (significant_bits != 12))\n {\n pixel_value=(int) (polarity != MagickFalse ?\n (max_value-ReadDCMShort(stream_info,image)) :\n ReadDCMShort(stream_info,image));\n if (signed_data == 1)\n pixel_value=((signed short) pixel_value);\n }\n else\n {\n if ((i & 0x01) != 0)\n pixel_value=(ReadDCMByte(stream_info,image) << 8) |\n byte;\n else\n {\n pixel_value=ReadDCMShort(stream_info,image);\n byte=(int) (pixel_value & 0x0f);\n pixel_value>>=4;\n }\n i++;\n }\n index=(pixel_value*rescale_slope)+rescale_intercept;\n if (window_width == 0)\n {\n if (signed_data == 1)\n index-=32767;\n }\n else\n {\n ssize_t\n window_max,\n window_min;\n\n window_min=(ssize_t) ceil((double) window_center-\n (window_width-1.0)/2.0-0.5);\n window_max=(ssize_t) floor((double) window_center+\n (window_width-1.0)/2.0+0.5);\n if ((ssize_t)index <= window_min)\n index=0;\n else\n if ((ssize_t)index > window_max)\n index=(int) max_value;\n else\n index=(int) (max_value*(((index-window_center-\n 0.5)/(window_width-1))+0.5));\n }\n index&=mask;\n index=(int) ConstrainColormapIndex(image,(size_t) index,\n exception);\n SetPixelIndex(image,(Quantum) (((size_t)\n GetPixelIndex(image,q)) | (((size_t) index) << 8)),q);\n pixel.red=(unsigned int) image->colormap[index].red;\n pixel.green=(unsigned int) image->colormap[index].green;\n pixel.blue=(unsigned int) image->colormap[index].blue;\n }\n else\n {\n if (bytes_per_pixel == 1)\n {\n pixel.red=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.green=(unsigned int) ReadDCMByte(stream_info,image);\n pixel.blue=(unsigned int) ReadDCMByte(stream_info,image);\n }\n else\n {\n pixel.red=ReadDCMShort(stream_info,image);\n pixel.green=ReadDCMShort(stream_info,image);\n pixel.blue=ReadDCMShort(stream_info,image);\n }\n pixel.red&=mask;\n pixel.green&=mask;\n pixel.blue&=mask;\n if (scale != (Quantum *) NULL)\n {\n pixel.red=scale[pixel.red];\n pixel.green=scale[pixel.green];\n pixel.blue=scale[pixel.blue];\n }\n }\n SetPixelRed(image,(Quantum) (((size_t) GetPixelRed(image,q)) |\n (((size_t) pixel.red) << 8)),q);\n SetPixelGreen(image,(Quantum) (((size_t) GetPixelGreen(image,q)) |\n (((size_t) pixel.green) << 8)),q);\n SetPixelBlue(image,(Quantum) (((size_t) GetPixelBlue(image,q)) |\n (((size_t) pixel.blue) << 8)),q);\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n if (SetImageGray(image,exception) != MagickFalse)\n (void) SetImageColorspace(image,GRAYColorspace,exception);\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\"UnexpectedEndOfFile\",\n image->filename);\n break;\n }\n /*\n Proceed to next image.\n */\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n if (scene < (ssize_t) (number_scenes-1))\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,LoadImagesTag,TellBlob(image),\n GetBlobSize(image));\n if (status == MagickFalse)\n break;\n }\n }\n /*\n Free resources.\n */\n if (stream_info->offsets != (ssize_t *) NULL)\n stream_info->offsets=(ssize_t *)\n RelinquishMagickMemory(stream_info->offsets);\n stream_info=(DCMStreamInfo *) RelinquishMagickMemory(stream_info);\n if (scale != (Quantum *) NULL)\n scale=(Quantum *) RelinquishMagickMemory(scale);\n if (graymap != (int *) NULL)\n graymap=(int *) RelinquishMagickMemory(graymap);\n if (bluemap != (int *) NULL)\n bluemap=(int *) RelinquishMagickMemory(bluemap);\n if (greenmap != (int *) NULL)\n greenmap=(int *) RelinquishMagickMemory(greenmap);\n if (redmap != (int *) NULL)\n redmap=(int *) RelinquishMagickMemory(redmap);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"ReadDCMImage","file_name":"coders/dcm.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/5511ef530576ed18fd636baa3bb4eda3d667665d","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#3-06608e3e6f86","input":"static int hash_accept(struct socket *sock, struct socket *newsock, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct alg_sock *ask = alg_sk(sk);\n\tstruct hash_ctx *ctx = ask->private;\n\tstruct ahash_request *req = &ctx->req;\n\tchar state[crypto_ahash_statesize(crypto_ahash_reqtfm(req))];\n\tstruct sock *sk2;\n\tstruct alg_sock *ask2;\n\tstruct hash_ctx *ctx2;\n\tint err;\n\n\terr = crypto_ahash_export(req, state);\n\tif (err)\n\t\treturn err;\n\n\terr = af_alg_accept(ask->parent, newsock);\n\tif (err)\n\t\treturn err;\n\n\tsk2 = newsock->sk;\n\task2 = alg_sk(sk2);\n\tctx2 = ask2->private;\n\tctx2->more = 1;\n\n\terr = crypto_ahash_import(&ctx2->req, state);\n\tif (err) {\n\t\tsock_orphan(sk2);\n\t\tsock_put(sk2);\n\t}\n\n\treturn err;\n}","target":"static int hash_accept(struct socket *sock, struct socket *newsock, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct alg_sock *ask = alg_sk(sk);\n\tstruct hash_ctx *ctx = ask->private;\n\tstruct ahash_request *req = &ctx->req;\n\tchar state[crypto_ahash_statesize(crypto_ahash_reqtfm(req))];\n\tstruct sock *sk2;\n\tstruct alg_sock *ask2;\n\tstruct hash_ctx *ctx2;\n\tbool more;\n\tint err;\n\n\tlock_sock(sk);\n\tmore = ctx->more;\n\terr = more ? crypto_ahash_export(req, state) : 0;\n\trelease_sock(sk);\n\n\tif (err)\n\t\treturn err;\n\n\terr = af_alg_accept(ask->parent, newsock);\n\tif (err)\n\t\treturn err;\n\n\tsk2 = newsock->sk;\n\task2 = alg_sk(sk2);\n\tctx2 = ask2->private;\n\tctx2->more = more;\n\n\tif (!more)\n\t\treturn err;\n\n\terr = crypto_ahash_import(&ctx2->req, state);\n\tif (err) {\n\t\tsock_orphan(sk2);\n\t\tsock_put(sk2);\n\t}\n\n\treturn err;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"hash_accept","file_name":"crypto/algif_hash.c","commit_link":"github.com/torvalds/linux/commit/4afa5f9617927453ac04b24b584f6c718dfb4f45","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#4-b85f43f95e14","input":" */\nstatic void php_wddx_pop_element(void *user_data, const XML_Char *name)\n{\n\tst_entry \t\t\t*ent1, *ent2;\n\twddx_stack \t\t\t*stack = (wddx_stack *)user_data;\n\tHashTable \t\t\t*target_hash;\n\tzend_class_entry \t**pce;\n\tzval\t\t\t\t*obj;\n\tzval\t\t\t\t*tmp;\n\tTSRMLS_FETCH();\n\n/* OBJECTS_FIXME */\n\tif (stack->top == 0) {\n\t\treturn;\n\t}\n\n\tif (!strcmp(name, EL_STRING) || !strcmp(name, EL_NUMBER) ||\n\t\t!strcmp(name, EL_BOOLEAN) || !strcmp(name, EL_NULL) ||\n\t \t!strcmp(name, EL_ARRAY) || !strcmp(name, EL_STRUCT) ||\n\t\t!strcmp(name, EL_RECORDSET) || !strcmp(name, EL_BINARY) ||\n\t\t!strcmp(name, EL_DATETIME)) {\n\t\twddx_stack_top(stack, (void**)&ent1);\n\n\t\tif (!ent1->data) {\n\t\t\tif (stack->top > 1) {\n\t\t\t\tstack->top--;\n\t\t\t} else {\n\t\t\t\tstack->done = 1;\n\t\t\t}\n\t\t\tefree(ent1);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!strcmp(name, EL_BINARY)) {\n\t\t\tint new_len=0;\n\t\t\tunsigned char *new_str;\n\n\t\t\tnew_str = php_base64_decode(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data), &new_len);\n\t\t\tSTR_FREE(Z_STRVAL_P(ent1->data));\n\t\t\tZ_STRVAL_P(ent1->data) = new_str;\n\t\t\tZ_STRLEN_P(ent1->data) = new_len;\n\t\t}\n\n\t\t/* Call __wakeup() method on the object. */\n\t\tif (Z_TYPE_P(ent1->data) == IS_OBJECT) {\n\t\t\tzval *fname, *retval = NULL;\n\n\t\t\tMAKE_STD_ZVAL(fname);\n\t\t\tZVAL_STRING(fname, \"__wakeup\", 1);\n\n\t\t\tcall_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL TSRMLS_CC);\n\n\t\t\tzval_dtor(fname);\n\t\t\tFREE_ZVAL(fname);\n\t\t\tif (retval) {\n\t\t\t\tzval_ptr_dtor(&retval);\n\t\t\t}\n\t\t}\n\n\t\tif (stack->top > 1) {\n\t\t\tstack->top--;\n\t\t\twddx_stack_top(stack, (void**)&ent2);\n\n\t\t\t/* if non-existent field */\n\t\t\tif (ent2->type == ST_FIELD && ent2->data == NULL) {\n\t\t\t\tzval_ptr_dtor(&ent1->data);\n\t\t\t\tefree(ent1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (Z_TYPE_P(ent2->data) == IS_ARRAY || Z_TYPE_P(ent2->data) == IS_OBJECT) {\n\t\t\t\ttarget_hash = HASH_OF(ent2->data);\n\n\t\t\t\tif (ent1->varname) {\n\t\t\t\t\tif (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) &&\n\t\t\t\t\t\tZ_TYPE_P(ent1->data) == IS_STRING && Z_STRLEN_P(ent1->data) &&\n\t\t\t\t\t\tent2->type == ST_STRUCT && Z_TYPE_P(ent2->data) == IS_ARRAY) {\n\t\t\t\t\t\tzend_bool incomplete_class = 0;\n\n\t\t\t\t\t\tzend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));\n\t\t\t\t\t\tif (zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data),\n\t\t\t\t\t\t\t\t\t\t Z_STRLEN_P(ent1->data)+1, (void **) &pce)==FAILURE) {\n\t\t\t\t\t\t\tincomplete_class = 1;\n\t\t\t\t\t\t\tpce = &PHP_IC_ENTRY;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Initialize target object */\n\t\t\t\t\t\tMAKE_STD_ZVAL(obj);\n\t\t\t\t\t\tobject_init_ex(obj, *pce);\n\n\t\t\t\t\t\t/* Merge current hashtable with object's default properties */\n\t\t\t\t\t\tzend_hash_merge(Z_OBJPROP_P(obj),\n\t\t\t\t\t\t\t\t\t\tZ_ARRVAL_P(ent2->data),\n\t\t\t\t\t\t\t\t\t\t(void (*)(void *)) zval_add_ref,\n\t\t\t\t\t\t\t\t\t\t(void *) &tmp, sizeof(zval *), 0);\n\n\t\t\t\t\t\tif (incomplete_class) {\n\t\t\t\t\t\t\tphp_store_class_name(obj, Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Clean up old array entry */\n\t\t\t\t\t\tzval_ptr_dtor(&ent2->data);\n\n\t\t\t\t\t\t/* Set stack entry to point to the newly created object */\n\t\t\t\t\t\tent2->data = obj;\n\n\t\t\t\t\t\t/* Clean up class name var entry */\n\t\t\t\t\t\tzval_ptr_dtor(&ent1->data);\n\t\t\t\t\t} else if (Z_TYPE_P(ent2->data) == IS_OBJECT) {\n\t\t\t\t\t\tzend_class_entry *old_scope = EG(scope);\n\n\t\t\t\t\t\tEG(scope) = Z_OBJCE_P(ent2->data);\n\t\t\t\t\t\tZ_DELREF_P(ent1->data);\n\t\t\t\t\t\tadd_property_zval(ent2->data, ent1->varname, ent1->data);\n\t\t\t\t\t\tEG(scope) = old_scope;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzend_symtable_update(target_hash, ent1->varname, strlen(ent1->varname)+1, &ent1->data, sizeof(zval *), NULL);\n\t\t\t\t\t}\n\t\t\t\t\tefree(ent1->varname);\n\t\t\t\t} else\t{\n\t\t\t\t\tzend_hash_next_index_insert(target_hash, &ent1->data, sizeof(zval *), NULL);\n\t\t\t\t}\n\t\t\t}\n\t\t\tefree(ent1);\n\t\t} else {\n\t\t\tstack->done = 1;\n\t\t}\n\t} else if (!strcmp(name, EL_VAR) && stack->varname) {\n\t\tefree(stack->varname);\n\t\tstack->varname = NULL;\n\t} else if (!strcmp(name, EL_FIELD)) {\n\t\tst_entry *ent;\n\t\twddx_stack_top(stack, (void **)&ent);\n\t\tefree(ent);\n\t\tstack->top--;\n\t}","target":" */\nstatic void php_wddx_pop_element(void *user_data, const XML_Char *name)\n{\n\tst_entry \t\t\t*ent1, *ent2;\n\twddx_stack \t\t\t*stack = (wddx_stack *)user_data;\n\tHashTable \t\t\t*target_hash;\n\tzend_class_entry \t**pce;\n\tzval\t\t\t\t*obj;\n\tzval\t\t\t\t*tmp;\n\tTSRMLS_FETCH();\n\n/* OBJECTS_FIXME */\n\tif (stack->top == 0) {\n\t\treturn;\n\t}\n\n\tif (!strcmp(name, EL_STRING) || !strcmp(name, EL_NUMBER) ||\n\t\t!strcmp(name, EL_BOOLEAN) || !strcmp(name, EL_NULL) ||\n\t \t!strcmp(name, EL_ARRAY) || !strcmp(name, EL_STRUCT) ||\n\t\t!strcmp(name, EL_RECORDSET) || !strcmp(name, EL_BINARY) ||\n\t\t!strcmp(name, EL_DATETIME)) {\n\t\twddx_stack_top(stack, (void**)&ent1);\n\n\t\tif (!ent1->data) {\n\t\t\tif (stack->top > 1) {\n\t\t\t\tstack->top--;\n\t\t\t} else {\n\t\t\t\tstack->done = 1;\n\t\t\t}\n\t\t\tefree(ent1);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!strcmp(name, EL_BINARY)) {\n\t\t\tint new_len=0;\n\t\t\tunsigned char *new_str;\n\n\t\t\tnew_str = php_base64_decode(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data), &new_len);\n\t\t\tSTR_FREE(Z_STRVAL_P(ent1->data));\n\t\t\tif (new_str) {\n\t\t\t\tZ_STRVAL_P(ent1->data) = new_str;\n\t\t\t\tZ_STRLEN_P(ent1->data) = new_len;\n\t\t\t} else {\n\t\t\t\tZVAL_EMPTY_STRING(ent1->data);\n\t\t\t}\n\t\t}\n\n\t\t/* Call __wakeup() method on the object. */\n\t\tif (Z_TYPE_P(ent1->data) == IS_OBJECT) {\n\t\t\tzval *fname, *retval = NULL;\n\n\t\t\tMAKE_STD_ZVAL(fname);\n\t\t\tZVAL_STRING(fname, \"__wakeup\", 1);\n\n\t\t\tcall_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL TSRMLS_CC);\n\n\t\t\tzval_dtor(fname);\n\t\t\tFREE_ZVAL(fname);\n\t\t\tif (retval) {\n\t\t\t\tzval_ptr_dtor(&retval);\n\t\t\t}\n\t\t}\n\n\t\tif (stack->top > 1) {\n\t\t\tstack->top--;\n\t\t\twddx_stack_top(stack, (void**)&ent2);\n\n\t\t\t/* if non-existent field */\n\t\t\tif (ent2->type == ST_FIELD && ent2->data == NULL) {\n\t\t\t\tzval_ptr_dtor(&ent1->data);\n\t\t\t\tefree(ent1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (Z_TYPE_P(ent2->data) == IS_ARRAY || Z_TYPE_P(ent2->data) == IS_OBJECT) {\n\t\t\t\ttarget_hash = HASH_OF(ent2->data);\n\n\t\t\t\tif (ent1->varname) {\n\t\t\t\t\tif (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) &&\n\t\t\t\t\t\tZ_TYPE_P(ent1->data) == IS_STRING && Z_STRLEN_P(ent1->data) &&\n\t\t\t\t\t\tent2->type == ST_STRUCT && Z_TYPE_P(ent2->data) == IS_ARRAY) {\n\t\t\t\t\t\tzend_bool incomplete_class = 0;\n\n\t\t\t\t\t\tzend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));\n\t\t\t\t\t\tif (zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data),\n\t\t\t\t\t\t\t\t\t\t Z_STRLEN_P(ent1->data)+1, (void **) &pce)==FAILURE) {\n\t\t\t\t\t\t\tincomplete_class = 1;\n\t\t\t\t\t\t\tpce = &PHP_IC_ENTRY;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Initialize target object */\n\t\t\t\t\t\tMAKE_STD_ZVAL(obj);\n\t\t\t\t\t\tobject_init_ex(obj, *pce);\n\n\t\t\t\t\t\t/* Merge current hashtable with object's default properties */\n\t\t\t\t\t\tzend_hash_merge(Z_OBJPROP_P(obj),\n\t\t\t\t\t\t\t\t\t\tZ_ARRVAL_P(ent2->data),\n\t\t\t\t\t\t\t\t\t\t(void (*)(void *)) zval_add_ref,\n\t\t\t\t\t\t\t\t\t\t(void *) &tmp, sizeof(zval *), 0);\n\n\t\t\t\t\t\tif (incomplete_class) {\n\t\t\t\t\t\t\tphp_store_class_name(obj, Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/* Clean up old array entry */\n\t\t\t\t\t\tzval_ptr_dtor(&ent2->data);\n\n\t\t\t\t\t\t/* Set stack entry to point to the newly created object */\n\t\t\t\t\t\tent2->data = obj;\n\n\t\t\t\t\t\t/* Clean up class name var entry */\n\t\t\t\t\t\tzval_ptr_dtor(&ent1->data);\n\t\t\t\t\t} else if (Z_TYPE_P(ent2->data) == IS_OBJECT) {\n\t\t\t\t\t\tzend_class_entry *old_scope = EG(scope);\n\n\t\t\t\t\t\tEG(scope) = Z_OBJCE_P(ent2->data);\n\t\t\t\t\t\tZ_DELREF_P(ent1->data);\n\t\t\t\t\t\tadd_property_zval(ent2->data, ent1->varname, ent1->data);\n\t\t\t\t\t\tEG(scope) = old_scope;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tzend_symtable_update(target_hash, ent1->varname, strlen(ent1->varname)+1, &ent1->data, sizeof(zval *), NULL);\n\t\t\t\t\t}\n\t\t\t\t\tefree(ent1->varname);\n\t\t\t\t} else\t{\n\t\t\t\t\tzend_hash_next_index_insert(target_hash, &ent1->data, sizeof(zval *), NULL);\n\t\t\t\t}\n\t\t\t}\n\t\t\tefree(ent1);\n\t\t} else {\n\t\t\tstack->done = 1;\n\t\t}\n\t} else if (!strcmp(name, EL_VAR) && stack->varname) {\n\t\tefree(stack->varname);\n\t\tstack->varname = NULL;\n\t} else if (!strcmp(name, EL_FIELD)) {\n\t\tst_entry *ent;\n\t\twddx_stack_top(stack, (void **)&ent);\n\t\tefree(ent);\n\t\tstack->top--;\n\t}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"php_wddx_pop_element","file_name":"ext/wddx/wddx.c","commit_link":"github.com/php/php-src/commit/698a691724c0a949295991e5df091ce16f899e02","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#5-5aece19c2ac4","input":"static gboolean prplcb_xfer_new_send_cb(gpointer data, gint fd, b_input_condition cond)\n{\n\tPurpleXfer *xfer = data;\n\tstruct im_connection *ic = purple_ic_by_pa(xfer->account);\n\tstruct prpl_xfer_data *px = xfer->ui_data;\n\tPurpleBuddy *buddy;\n\tconst char *who;\n\n\tbuddy = purple_find_buddy(xfer->account, xfer->who);\n\twho = buddy ? purple_buddy_get_name(buddy) : xfer->who;\n\n\t/* TODO(wilmer): After spreading some more const goodness in BitlBee,\n\t remove the evil cast below. */\n\tpx->ft = imcb_file_send_start(ic, (char *) who, xfer->filename, xfer->size);\n\tpx->ft->data = px;\n\n\tpx->ft->accept = prpl_xfer_accept;\n\tpx->ft->canceled = prpl_xfer_canceled;\n\tpx->ft->free = prpl_xfer_free;\n\tpx->ft->write_request = prpl_xfer_write_request;\n\n\treturn FALSE;\n}","target":"static gboolean prplcb_xfer_new_send_cb(gpointer data, gint fd, b_input_condition cond)\n{\n\tPurpleXfer *xfer = data;\n\tstruct im_connection *ic = purple_ic_by_pa(xfer->account);\n\tstruct prpl_xfer_data *px = xfer->ui_data;\n\tPurpleBuddy *buddy;\n\tconst char *who;\n\n\tbuddy = purple_find_buddy(xfer->account, xfer->who);\n\twho = buddy ? purple_buddy_get_name(buddy) : xfer->who;\n\n\t/* TODO(wilmer): After spreading some more const goodness in BitlBee,\n\t remove the evil cast below. */\n\tpx->ft = imcb_file_send_start(ic, (char *) who, xfer->filename, xfer->size);\n\n\tif (!px->ft) {\n\t\treturn FALSE;\n\t}\n\tpx->ft->data = px;\n\n\tpx->ft->accept = prpl_xfer_accept;\n\tpx->ft->canceled = prpl_xfer_canceled;\n\tpx->ft->free = prpl_xfer_free;\n\tpx->ft->write_request = prpl_xfer_write_request;\n\n\treturn FALSE;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"prplcb_xfer_new_send_cb","file_name":"protocols/purple/ft.c","commit_link":"github.com/bitlbee/bitlbee/commit/30d598ce7cd3f136ee9d7097f39fa9818a272441","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#6-5544abd56a8e","input":"static int changedline (const Proto *p, int oldpc, int newpc) {\n while (oldpc++ < newpc) {\n if (p->lineinfo[oldpc] != 0)\n return (luaG_getfuncline(p, oldpc - 1) != luaG_getfuncline(p, newpc));\n }\n return 0; /* no line changes in the way */\n}","target":"static int changedline (const Proto *p, int oldpc, int newpc) {\n if (p->lineinfo == NULL) /* no debug information? */\n return 0;\n while (oldpc++ < newpc) {\n if (p->lineinfo[oldpc] != 0)\n return (luaG_getfuncline(p, oldpc - 1) != luaG_getfuncline(p, newpc));\n }\n return 0; /* no line changes between positions */\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"changedline","file_name":"ldebug.c","commit_link":"github.com/lua/lua/commit/ae5b5ba529753c7a653901ffc29b5ea24c3fdf3a","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#7-fdfc30cad0a1","input":"static ExprList *exprListAppendList(\n Parse *pParse, /* Parsing context */\n ExprList *pList, /* List to which to append. Might be NULL */\n ExprList *pAppend, /* List of values to append. Might be NULL */\n int bIntToNull\n){\n if( pAppend ){\n int i;\n int nInit = pList ? pList->nExpr : 0;\n for(i=0; inExpr; i++){\n Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0);\n if( bIntToNull && pDup && pDup->op==TK_INTEGER ){\n pDup->op = TK_NULL;\n pDup->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse);\n }\n pList = sqlite3ExprListAppend(pParse, pList, pDup);\n if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;\n }\n }\n return pList;\n}","target":"static ExprList *exprListAppendList(\n Parse *pParse, /* Parsing context */\n ExprList *pList, /* List to which to append. Might be NULL */\n ExprList *pAppend, /* List of values to append. Might be NULL */\n int bIntToNull\n){\n if( pAppend ){\n int i;\n int nInit = pList ? pList->nExpr : 0;\n for(i=0; inExpr; i++){\n Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0);\n assert( pDup==0 || !ExprHasProperty(pDup, EP_MemToken) );\n if( bIntToNull && pDup && pDup->op==TK_INTEGER ){\n pDup->op = TK_NULL;\n pDup->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse);\n pDup->u.zToken = 0;\n }\n pList = sqlite3ExprListAppend(pParse, pList, pDup);\n if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;\n }\n }\n return pList;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"exprListAppendList","file_name":"src/window.c","commit_link":"github.com/sqlite/sqlite/commit/75e95e1fcd52d3ec8282edb75ac8cd0814095d54","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#8-f8d03e594b21","input":"static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,\n\t\t\t struct netlink_ext_ack *extack)\n{\n\tstruct net *net = sock_net(in_skb->sk);\n\tstruct rtmsg *rtm;\n\tstruct nlattr *tb[RTA_MAX+1];\n\tstruct fib_result res = {};\n\tstruct rtable *rt = NULL;\n\tstruct flowi4 fl4;\n\t__be32 dst = 0;\n\t__be32 src = 0;\n\tu32 iif;\n\tint err;\n\tint mark;\n\tstruct sk_buff *skb;\n\tu32 table_id = RT_TABLE_MAIN;\n\tkuid_t uid;\n\n\terr = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv4_policy,\n\t\t\t extack);\n\tif (err < 0)\n\t\tgoto errout;\n\n\trtm = nlmsg_data(nlh);\n\n\tskb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);\n\tif (!skb) {\n\t\terr = -ENOBUFS;\n\t\tgoto errout;\n\t}\n\n\t/* Reserve room for dummy headers, this skb can pass\n\t through good chunk of routing engine.\n\t */\n\tskb_reset_mac_header(skb);\n\tskb_reset_network_header(skb);\n\n\tsrc = tb[RTA_SRC] ? nla_get_in_addr(tb[RTA_SRC]) : 0;\n\tdst = tb[RTA_DST] ? nla_get_in_addr(tb[RTA_DST]) : 0;\n\tiif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0;\n\tmark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0;\n\tif (tb[RTA_UID])\n\t\tuid = make_kuid(current_user_ns(), nla_get_u32(tb[RTA_UID]));\n\telse\n\t\tuid = (iif ? INVALID_UID : current_uid());\n\n\t/* Bugfix: need to give ip_route_input enough of an IP header to\n\t * not gag.\n\t */\n\tip_hdr(skb)->protocol = IPPROTO_UDP;\n\tip_hdr(skb)->saddr = src;\n\tip_hdr(skb)->daddr = dst;\n\n\tskb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));\n\n\tmemset(&fl4, 0, sizeof(fl4));\n\tfl4.daddr = dst;\n\tfl4.saddr = src;\n\tfl4.flowi4_tos = rtm->rtm_tos;\n\tfl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0;\n\tfl4.flowi4_mark = mark;\n\tfl4.flowi4_uid = uid;\n\n\trcu_read_lock();\n\n\tif (iif) {\n\t\tstruct net_device *dev;\n\n\t\tdev = dev_get_by_index_rcu(net, iif);\n\t\tif (!dev) {\n\t\t\terr = -ENODEV;\n\t\t\tgoto errout_free;\n\t\t}\n\n\t\tskb->protocol\t= htons(ETH_P_IP);\n\t\tskb->dev\t= dev;\n\t\tskb->mark\t= mark;\n\t\terr = ip_route_input_rcu(skb, dst, src, rtm->rtm_tos,\n\t\t\t\t\t dev, &res);\n\n\t\trt = skb_rtable(skb);\n\t\tif (err == 0 && rt->dst.error)\n\t\t\terr = -rt->dst.error;\n\t} else {\n\t\trt = ip_route_output_key_hash_rcu(net, &fl4, &res, skb);\n\t\terr = 0;\n\t\tif (IS_ERR(rt))\n\t\t\terr = PTR_ERR(rt);\n\t\telse\n\t\t\tskb_dst_set(skb, &rt->dst);\n\t}\n\n\tif (err)\n\t\tgoto errout_free;\n\n\tif (rtm->rtm_flags & RTM_F_NOTIFY)\n\t\trt->rt_flags |= RTCF_NOTIFY;\n\n\tif (rtm->rtm_flags & RTM_F_LOOKUP_TABLE)\n\t\ttable_id = rt->rt_table_id;\n\n\tif (rtm->rtm_flags & RTM_F_FIB_MATCH)\n\t\terr = fib_dump_info(skb, NETLINK_CB(in_skb).portid,\n\t\t\t\t nlh->nlmsg_seq, RTM_NEWROUTE, table_id,\n\t\t\t\t rt->rt_type, res.prefix, res.prefixlen,\n\t\t\t\t fl4.flowi4_tos, res.fi, 0);\n\telse\n\t\terr = rt_fill_info(net, dst, src, table_id, &fl4, skb,\n\t\t\t\t NETLINK_CB(in_skb).portid, nlh->nlmsg_seq);\n\tif (err < 0)\n\t\tgoto errout_free;\n\n\trcu_read_unlock();\n\n\terr = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);\nerrout:\n\treturn err;\n\nerrout_free:\n\trcu_read_unlock();\n\tkfree_skb(skb);\n\tgoto errout;\n}","target":"static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,\n\t\t\t struct netlink_ext_ack *extack)\n{\n\tstruct net *net = sock_net(in_skb->sk);\n\tstruct rtmsg *rtm;\n\tstruct nlattr *tb[RTA_MAX+1];\n\tstruct fib_result res = {};\n\tstruct rtable *rt = NULL;\n\tstruct flowi4 fl4;\n\t__be32 dst = 0;\n\t__be32 src = 0;\n\tu32 iif;\n\tint err;\n\tint mark;\n\tstruct sk_buff *skb;\n\tu32 table_id = RT_TABLE_MAIN;\n\tkuid_t uid;\n\n\terr = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv4_policy,\n\t\t\t extack);\n\tif (err < 0)\n\t\tgoto errout;\n\n\trtm = nlmsg_data(nlh);\n\n\tskb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);\n\tif (!skb) {\n\t\terr = -ENOBUFS;\n\t\tgoto errout;\n\t}\n\n\t/* Reserve room for dummy headers, this skb can pass\n\t through good chunk of routing engine.\n\t */\n\tskb_reset_mac_header(skb);\n\tskb_reset_network_header(skb);\n\n\tsrc = tb[RTA_SRC] ? nla_get_in_addr(tb[RTA_SRC]) : 0;\n\tdst = tb[RTA_DST] ? nla_get_in_addr(tb[RTA_DST]) : 0;\n\tiif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0;\n\tmark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0;\n\tif (tb[RTA_UID])\n\t\tuid = make_kuid(current_user_ns(), nla_get_u32(tb[RTA_UID]));\n\telse\n\t\tuid = (iif ? INVALID_UID : current_uid());\n\n\t/* Bugfix: need to give ip_route_input enough of an IP header to\n\t * not gag.\n\t */\n\tip_hdr(skb)->protocol = IPPROTO_UDP;\n\tip_hdr(skb)->saddr = src;\n\tip_hdr(skb)->daddr = dst;\n\n\tskb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));\n\n\tmemset(&fl4, 0, sizeof(fl4));\n\tfl4.daddr = dst;\n\tfl4.saddr = src;\n\tfl4.flowi4_tos = rtm->rtm_tos;\n\tfl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0;\n\tfl4.flowi4_mark = mark;\n\tfl4.flowi4_uid = uid;\n\n\trcu_read_lock();\n\n\tif (iif) {\n\t\tstruct net_device *dev;\n\n\t\tdev = dev_get_by_index_rcu(net, iif);\n\t\tif (!dev) {\n\t\t\terr = -ENODEV;\n\t\t\tgoto errout_free;\n\t\t}\n\n\t\tskb->protocol\t= htons(ETH_P_IP);\n\t\tskb->dev\t= dev;\n\t\tskb->mark\t= mark;\n\t\terr = ip_route_input_rcu(skb, dst, src, rtm->rtm_tos,\n\t\t\t\t\t dev, &res);\n\n\t\trt = skb_rtable(skb);\n\t\tif (err == 0 && rt->dst.error)\n\t\t\terr = -rt->dst.error;\n\t} else {\n\t\trt = ip_route_output_key_hash_rcu(net, &fl4, &res, skb);\n\t\terr = 0;\n\t\tif (IS_ERR(rt))\n\t\t\terr = PTR_ERR(rt);\n\t\telse\n\t\t\tskb_dst_set(skb, &rt->dst);\n\t}\n\n\tif (err)\n\t\tgoto errout_free;\n\n\tif (rtm->rtm_flags & RTM_F_NOTIFY)\n\t\trt->rt_flags |= RTCF_NOTIFY;\n\n\tif (rtm->rtm_flags & RTM_F_LOOKUP_TABLE)\n\t\ttable_id = rt->rt_table_id;\n\n\tif (rtm->rtm_flags & RTM_F_FIB_MATCH) {\n\t\tif (!res.fi) {\n\t\t\terr = fib_props[res.type].error;\n\t\t\tif (!err)\n\t\t\t\terr = -EHOSTUNREACH;\n\t\t\tgoto errout_free;\n\t\t}\n\t\terr = fib_dump_info(skb, NETLINK_CB(in_skb).portid,\n\t\t\t\t nlh->nlmsg_seq, RTM_NEWROUTE, table_id,\n\t\t\t\t rt->rt_type, res.prefix, res.prefixlen,\n\t\t\t\t fl4.flowi4_tos, res.fi, 0);\n\t} else {\n\t\terr = rt_fill_info(net, dst, src, table_id, &fl4, skb,\n\t\t\t\t NETLINK_CB(in_skb).portid, nlh->nlmsg_seq);\n\t}\n\tif (err < 0)\n\t\tgoto errout_free;\n\n\trcu_read_unlock();\n\n\terr = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);\nerrout:\n\treturn err;\n\nerrout_free:\n\trcu_read_unlock();\n\tkfree_skb(skb);\n\tgoto errout;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"inet_rtm_getroute","file_name":"net/ipv4/route.c","commit_link":"github.com/torvalds/linux/commit/bc3aae2bbac46dd894c89db5d5e98f7f0ef9e205","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#9-5dbbc30dd12e","input":"LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,\n enum expr_value_type type, xkb_mod_mask_t *val_rtrn)\n{\n const char *str;\n xkb_mod_index_t ndx;\n const LookupModMaskPriv *arg = priv;\n const struct xkb_mod_set *mods = arg->mods;\n enum mod_type mod_type = arg->mod_type;\n\n if (type != EXPR_TYPE_INT)\n return false;\n\n str = xkb_atom_text(ctx, field);\n\n if (istreq(str, \"all\")) {\n *val_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n\n if (istreq(str, \"none\")) {\n *val_rtrn = 0;\n return true;\n }\n\n ndx = XkbModNameToIndex(mods, field, mod_type);\n if (ndx == XKB_MOD_INVALID)\n return false;\n\n *val_rtrn = (1u << ndx);\n return true;\n}","target":"LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,\n enum expr_value_type type, xkb_mod_mask_t *val_rtrn)\n{\n const char *str;\n xkb_mod_index_t ndx;\n const LookupModMaskPriv *arg = priv;\n const struct xkb_mod_set *mods = arg->mods;\n enum mod_type mod_type = arg->mod_type;\n\n if (type != EXPR_TYPE_INT)\n return false;\n\n str = xkb_atom_text(ctx, field);\n if (!str)\n return false;\n\n if (istreq(str, \"all\")) {\n *val_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n\n if (istreq(str, \"none\")) {\n *val_rtrn = 0;\n return true;\n }\n\n ndx = XkbModNameToIndex(mods, field, mod_type);\n if (ndx == XKB_MOD_INVALID)\n return false;\n\n *val_rtrn = (1u << ndx);\n return true;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"LookupModMask","file_name":"src/xkbcomp/expr.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/4e2ee9c3f6050d773f8bbe05bc0edb17f1ff8371","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#10-0e354a573e83","input":"validate_as_request(kdc_realm_t *kdc_active_realm,\n register krb5_kdc_req *request, krb5_db_entry client,\n krb5_db_entry server, krb5_timestamp kdc_time,\n const char **status, krb5_pa_data ***e_data)\n{\n int errcode;\n krb5_error_code ret;\n\n /*\n * If an option is set that is only allowed in TGS requests, complain.\n */\n if (request->kdc_options & AS_INVALID_OPTIONS) {\n *status = \"INVALID AS OPTIONS\";\n return KDC_ERR_BADOPTION;\n }\n\n /* The client must not be expired */\n if (client.expiration && client.expiration < kdc_time) {\n *status = \"CLIENT EXPIRED\";\n if (vague_errors)\n return(KRB_ERR_GENERIC);\n else\n return(KDC_ERR_NAME_EXP);\n }\n\n /* The client's password must not be expired, unless the server is\n a KRB5_KDC_PWCHANGE_SERVICE. */\n if (client.pw_expiration && client.pw_expiration < kdc_time &&\n !isflagset(server.attributes, KRB5_KDB_PWCHANGE_SERVICE)) {\n *status = \"CLIENT KEY EXPIRED\";\n if (vague_errors)\n return(KRB_ERR_GENERIC);\n else\n return(KDC_ERR_KEY_EXP);\n }\n\n /* The server must not be expired */\n if (server.expiration && server.expiration < kdc_time) {\n *status = \"SERVICE EXPIRED\";\n return(KDC_ERR_SERVICE_EXP);\n }\n\n /*\n * If the client requires password changing, then only allow the\n * pwchange service.\n */\n if (isflagset(client.attributes, KRB5_KDB_REQUIRES_PWCHANGE) &&\n !isflagset(server.attributes, KRB5_KDB_PWCHANGE_SERVICE)) {\n *status = \"REQUIRED PWCHANGE\";\n return(KDC_ERR_KEY_EXP);\n }\n\n /* Client and server must allow postdating tickets */\n if ((isflagset(request->kdc_options, KDC_OPT_ALLOW_POSTDATE) ||\n isflagset(request->kdc_options, KDC_OPT_POSTDATED)) &&\n (isflagset(client.attributes, KRB5_KDB_DISALLOW_POSTDATED) ||\n isflagset(server.attributes, KRB5_KDB_DISALLOW_POSTDATED))) {\n *status = \"POSTDATE NOT ALLOWED\";\n return(KDC_ERR_CANNOT_POSTDATE);\n }\n\n /*\n * A Windows KDC will return KDC_ERR_PREAUTH_REQUIRED instead of\n * KDC_ERR_POLICY in the following case:\n *\n * - KDC_OPT_FORWARDABLE is set in KDCOptions but local\n * policy has KRB5_KDB_DISALLOW_FORWARDABLE set for the\n * client, and;\n * - KRB5_KDB_REQUIRES_PRE_AUTH is set for the client but\n * preauthentication data is absent in the request.\n *\n * Hence, this check most be done after the check for preauth\n * data, and is now performed by validate_forwardable() (the\n * contents of which were previously below).\n */\n\n /* Client and server must allow proxiable tickets */\n if (isflagset(request->kdc_options, KDC_OPT_PROXIABLE) &&\n (isflagset(client.attributes, KRB5_KDB_DISALLOW_PROXIABLE) ||\n isflagset(server.attributes, KRB5_KDB_DISALLOW_PROXIABLE))) {\n *status = \"PROXIABLE NOT ALLOWED\";\n return(KDC_ERR_POLICY);\n }\n\n /* Check to see if client is locked out */\n if (isflagset(client.attributes, KRB5_KDB_DISALLOW_ALL_TIX)) {\n *status = \"CLIENT LOCKED OUT\";\n return(KDC_ERR_CLIENT_REVOKED);\n }\n\n /* Check to see if server is locked out */\n if (isflagset(server.attributes, KRB5_KDB_DISALLOW_ALL_TIX)) {\n *status = \"SERVICE LOCKED OUT\";\n return(KDC_ERR_S_PRINCIPAL_UNKNOWN);\n }\n\n /* Check to see if server is allowed to be a service */\n if (isflagset(server.attributes, KRB5_KDB_DISALLOW_SVR)) {\n *status = \"SERVICE NOT ALLOWED\";\n return(KDC_ERR_MUST_USE_USER2USER);\n }\n\n if (check_anon(kdc_active_realm, request->client, request->server) != 0) {\n *status = \"ANONYMOUS NOT ALLOWED\";\n return(KDC_ERR_POLICY);\n }\n\n /* Perform KDB module policy checks. */\n ret = krb5_db_check_policy_as(kdc_context, request, &client, &server,\n kdc_time, status, e_data);\n if (ret && ret != KRB5_PLUGIN_OP_NOTSUPP)\n return errcode_to_protocol(ret);\n\n /* Check against local policy. */\n errcode = against_local_policy_as(request, client, server,\n kdc_time, status, e_data);\n if (errcode)\n return errcode;\n\n return 0;\n}","target":"validate_as_request(kdc_realm_t *kdc_active_realm,\n register krb5_kdc_req *request, krb5_db_entry client,\n krb5_db_entry server, krb5_timestamp kdc_time,\n const char **status, krb5_pa_data ***e_data)\n{\n int errcode;\n krb5_error_code ret;\n\n /*\n * If an option is set that is only allowed in TGS requests, complain.\n */\n if (request->kdc_options & AS_INVALID_OPTIONS) {\n *status = \"INVALID AS OPTIONS\";\n return KDC_ERR_BADOPTION;\n }\n\n /* The client must not be expired */\n if (client.expiration && client.expiration < kdc_time) {\n *status = \"CLIENT EXPIRED\";\n if (vague_errors)\n return(KRB_ERR_GENERIC);\n else\n return(KDC_ERR_NAME_EXP);\n }\n\n /* The client's password must not be expired, unless the server is\n a KRB5_KDC_PWCHANGE_SERVICE. */\n if (client.pw_expiration && client.pw_expiration < kdc_time &&\n !isflagset(server.attributes, KRB5_KDB_PWCHANGE_SERVICE)) {\n *status = \"CLIENT KEY EXPIRED\";\n if (vague_errors)\n return(KRB_ERR_GENERIC);\n else\n return(KDC_ERR_KEY_EXP);\n }\n\n /* The server must not be expired */\n if (server.expiration && server.expiration < kdc_time) {\n *status = \"SERVICE EXPIRED\";\n return(KDC_ERR_SERVICE_EXP);\n }\n\n /*\n * If the client requires password changing, then only allow the\n * pwchange service.\n */\n if (isflagset(client.attributes, KRB5_KDB_REQUIRES_PWCHANGE) &&\n !isflagset(server.attributes, KRB5_KDB_PWCHANGE_SERVICE)) {\n *status = \"REQUIRED PWCHANGE\";\n return(KDC_ERR_KEY_EXP);\n }\n\n /* Client and server must allow postdating tickets */\n if ((isflagset(request->kdc_options, KDC_OPT_ALLOW_POSTDATE) ||\n isflagset(request->kdc_options, KDC_OPT_POSTDATED)) &&\n (isflagset(client.attributes, KRB5_KDB_DISALLOW_POSTDATED) ||\n isflagset(server.attributes, KRB5_KDB_DISALLOW_POSTDATED))) {\n *status = \"POSTDATE NOT ALLOWED\";\n return(KDC_ERR_CANNOT_POSTDATE);\n }\n\n /*\n * A Windows KDC will return KDC_ERR_PREAUTH_REQUIRED instead of\n * KDC_ERR_POLICY in the following case:\n *\n * - KDC_OPT_FORWARDABLE is set in KDCOptions but local\n * policy has KRB5_KDB_DISALLOW_FORWARDABLE set for the\n * client, and;\n * - KRB5_KDB_REQUIRES_PRE_AUTH is set for the client but\n * preauthentication data is absent in the request.\n *\n * Hence, this check most be done after the check for preauth\n * data, and is now performed by validate_forwardable() (the\n * contents of which were previously below).\n */\n\n /* Client and server must allow proxiable tickets */\n if (isflagset(request->kdc_options, KDC_OPT_PROXIABLE) &&\n (isflagset(client.attributes, KRB5_KDB_DISALLOW_PROXIABLE) ||\n isflagset(server.attributes, KRB5_KDB_DISALLOW_PROXIABLE))) {\n *status = \"PROXIABLE NOT ALLOWED\";\n return(KDC_ERR_POLICY);\n }\n\n /* Check to see if client is locked out */\n if (isflagset(client.attributes, KRB5_KDB_DISALLOW_ALL_TIX)) {\n *status = \"CLIENT LOCKED OUT\";\n return(KDC_ERR_CLIENT_REVOKED);\n }\n\n /* Check to see if server is locked out */\n if (isflagset(server.attributes, KRB5_KDB_DISALLOW_ALL_TIX)) {\n *status = \"SERVICE LOCKED OUT\";\n return(KDC_ERR_S_PRINCIPAL_UNKNOWN);\n }\n\n /* Check to see if server is allowed to be a service */\n if (isflagset(server.attributes, KRB5_KDB_DISALLOW_SVR)) {\n *status = \"SERVICE NOT ALLOWED\";\n return(KDC_ERR_MUST_USE_USER2USER);\n }\n\n if (check_anon(kdc_active_realm, client.princ, request->server) != 0) {\n *status = \"ANONYMOUS NOT ALLOWED\";\n return(KDC_ERR_POLICY);\n }\n\n /* Perform KDB module policy checks. */\n ret = krb5_db_check_policy_as(kdc_context, request, &client, &server,\n kdc_time, status, e_data);\n if (ret && ret != KRB5_PLUGIN_OP_NOTSUPP)\n return errcode_to_protocol(ret);\n\n /* Check against local policy. */\n errcode = against_local_policy_as(request, client, server,\n kdc_time, status, e_data);\n if (errcode)\n return errcode;\n\n return 0;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"validate_as_request","file_name":"src/kdc/kdc_util.c","commit_link":"github.com/krb5/krb5/commit/93b4a6306a0026cf1cc31ac4bd8a49ba5d034ba7","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#11-547124a10526","input":"static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len)\n{\n\tstruct sockaddr_rc *sa = (struct sockaddr_rc *) addr;\n\tstruct sock *sk = sock->sk;\n\tint chan = sa->rc_channel;\n\tint err = 0;\n\n\tBT_DBG(\"sk %p %pMR\", sk, &sa->rc_bdaddr);\n\n\tif (!addr || addr->sa_family != AF_BLUETOOTH)\n\t\treturn -EINVAL;\n\n\tlock_sock(sk);\n\n\tif (sk->sk_state != BT_OPEN) {\n\t\terr = -EBADFD;\n\t\tgoto done;\n\t}\n\n\tif (sk->sk_type != SOCK_STREAM) {\n\t\terr = -EINVAL;\n\t\tgoto done;\n\t}\n\n\twrite_lock(&rfcomm_sk_list.lock);\n\n\tif (chan && __rfcomm_get_listen_sock_by_addr(chan, &sa->rc_bdaddr)) {\n\t\terr = -EADDRINUSE;\n\t} else {\n\t\t/* Save source address */\n\t\tbacpy(&rfcomm_pi(sk)->src, &sa->rc_bdaddr);\n\t\trfcomm_pi(sk)->channel = chan;\n\t\tsk->sk_state = BT_BOUND;\n\t}\n\n\twrite_unlock(&rfcomm_sk_list.lock);\n\ndone:\n\trelease_sock(sk);\n\treturn err;\n}","target":"static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len)\n{\n\tstruct sockaddr_rc sa;\n\tstruct sock *sk = sock->sk;\n\tint len, err = 0;\n\n\tif (!addr || addr->sa_family != AF_BLUETOOTH)\n\t\treturn -EINVAL;\n\n\tmemset(&sa, 0, sizeof(sa));\n\tlen = min_t(unsigned int, sizeof(sa), addr_len);\n\tmemcpy(&sa, addr, len);\n\n\tBT_DBG(\"sk %p %pMR\", sk, &sa.rc_bdaddr);\n\n\tlock_sock(sk);\n\n\tif (sk->sk_state != BT_OPEN) {\n\t\terr = -EBADFD;\n\t\tgoto done;\n\t}\n\n\tif (sk->sk_type != SOCK_STREAM) {\n\t\terr = -EINVAL;\n\t\tgoto done;\n\t}\n\n\twrite_lock(&rfcomm_sk_list.lock);\n\n\tif (sa.rc_channel &&\n\t __rfcomm_get_listen_sock_by_addr(sa.rc_channel, &sa.rc_bdaddr)) {\n\t\terr = -EADDRINUSE;\n\t} else {\n\t\t/* Save source address */\n\t\tbacpy(&rfcomm_pi(sk)->src, &sa.rc_bdaddr);\n\t\trfcomm_pi(sk)->channel = sa.rc_channel;\n\t\tsk->sk_state = BT_BOUND;\n\t}\n\n\twrite_unlock(&rfcomm_sk_list.lock);\n\ndone:\n\trelease_sock(sk);\n\treturn err;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"rfcomm_sock_bind","file_name":"net/bluetooth/rfcomm/sock.c","commit_link":"github.com/torvalds/linux/commit/951b6a0717db97ce420547222647bcc40bf1eacd","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#12-61e61d4c1262","input":"AP4_HdlrAtom::AP4_HdlrAtom(AP4_UI32 size, \n AP4_UI08 version,\n AP4_UI32 flags,\n AP4_ByteStream& stream) :\n AP4_Atom(AP4_ATOM_TYPE_HDLR, size, version, flags)\n{\n AP4_UI32 predefined;\n stream.ReadUI32(predefined);\n stream.ReadUI32(m_HandlerType);\n stream.ReadUI32(m_Reserved[0]);\n stream.ReadUI32(m_Reserved[1]);\n stream.ReadUI32(m_Reserved[2]);\n \n // read the name unless it is empty\n int name_size = size-(AP4_FULL_ATOM_HEADER_SIZE+20);\n if (name_size == 0) return;\n char* name = new char[name_size+1];\n stream.Read(name, name_size);\n name[name_size] = '\\0'; // force a null termination\n // handle a special case: the Quicktime files have a pascal\n // string here, but ISO MP4 files have a C string.\n // we try to detect a pascal encoding and correct it.\n if (name[0] == name_size-1) {\n m_HandlerName = name+1;\n } else {\n m_HandlerName = name;\n }\n delete[] name;\n}","target":"AP4_HdlrAtom::AP4_HdlrAtom(AP4_UI32 size, \n AP4_UI08 version,\n AP4_UI32 flags,\n AP4_ByteStream& stream) :\n AP4_Atom(AP4_ATOM_TYPE_HDLR, size, version, flags)\n{\n AP4_UI32 predefined;\n stream.ReadUI32(predefined);\n stream.ReadUI32(m_HandlerType);\n stream.ReadUI32(m_Reserved[0]);\n stream.ReadUI32(m_Reserved[1]);\n stream.ReadUI32(m_Reserved[2]);\n \n // read the name unless it is empty\n if (size < AP4_FULL_ATOM_HEADER_SIZE+20) return;\n AP4_UI32 name_size = size-(AP4_FULL_ATOM_HEADER_SIZE+20);\n char* name = new char[name_size+1];\n if (name == NULL) return;\n stream.Read(name, name_size);\n name[name_size] = '\\0'; // force a null termination\n // handle a special case: the Quicktime files have a pascal\n // string here, but ISO MP4 files have a C string.\n // we try to detect a pascal encoding and correct it.\n if (name[0] == name_size-1) {\n m_HandlerName = name+1;\n } else {\n m_HandlerName = name;\n }\n delete[] name;\n}","lang":"cpp","vul_type":"cwe-476","sven_meta":{"func_name":"AP4_HdlrAtom::AP4_HdlrAtom","file_name":"Source/C++/Core/Ap4HdlrAtom.cpp","commit_link":"github.com/axiomatic-systems/Bento4/commit/22192de5367fa0cee985917f092be4060b7c00b0","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#13-22d39ffa165c","input":"generatePreview (const char inFileName[],\n\t\t float exposure,\n\t\t int previewWidth,\n\t\t int &previewHeight,\n\t\t Array2D &previewPixels)\n{\n //\n // Read the input file\n //\n\n RgbaInputFile in (inFileName);\n\n Box2i dw = in.dataWindow();\n float a = in.pixelAspectRatio();\n int w = dw.max.x - dw.min.x + 1;\n int h = dw.max.y - dw.min.y + 1;\n\n Array2D pixels (h, w);\n in.setFrameBuffer (ComputeBasePointer (&pixels[0][0], dw), 1, w);\n in.readPixels (dw.min.y, dw.max.y);\n\n //\n // Make a preview image\n //\n\n previewHeight = max (int (h / (w * a) * previewWidth + .5f), 1);\n previewPixels.resizeErase (previewHeight, previewWidth);\n\n float fx = (previewWidth > 0)? (float (w - 1) / (previewWidth - 1)): 1;\n float fy = (previewHeight > 0)? (float (h - 1) / (previewHeight - 1)): 1;\n float m = Math::pow (2.f, IMATH_NAMESPACE::clamp (exposure + 2.47393f, -20.f, 20.f));\n\n for (int y = 0; y < previewHeight; ++y)\n {\n\tfor (int x = 0; x < previewWidth; ++x)\n\t{\n\t PreviewRgba &preview = previewPixels[y][x];\n\t const Rgba &pixel = pixels[int (y * fy + .5f)][int (x * fx + .5f)];\n\n\t preview.r = gamma (pixel.r, m);\n\t preview.g = gamma (pixel.g, m);\n\t preview.b = gamma (pixel.b, m);\n\t preview.a = int (IMATH_NAMESPACE::clamp (pixel.a * 255.f, 0.f, 255.f) + .5f);\n\t}\n }\n}","target":"generatePreview (const char inFileName[],\n\t\t float exposure,\n\t\t int previewWidth,\n\t\t int &previewHeight,\n\t\t Array2D &previewPixels)\n{\n //\n // Read the input file\n //\n\n RgbaInputFile in (inFileName);\n\n Box2i dw = in.dataWindow();\n float a = in.pixelAspectRatio();\n int w = dw.max.x - dw.min.x + 1;\n int h = dw.max.y - dw.min.y + 1;\n\n Array2D pixels (h, w);\n in.setFrameBuffer (ComputeBasePointer (&pixels[0][0], dw), 1, w);\n in.readPixels (dw.min.y, dw.max.y);\n\n //\n // Make a preview image\n //\n\n previewHeight = max (int (h / (w * a) * previewWidth + .5f), 1);\n previewPixels.resizeErase (previewHeight, previewWidth);\n\n float fx = (previewWidth > 1)? (float (w - 1) / (previewWidth - 1)): 1;\n float fy = (previewHeight > 1)? (float (h - 1) / (previewHeight - 1)): 1;\n float m = Math::pow (2.f, IMATH_NAMESPACE::clamp (exposure + 2.47393f, -20.f, 20.f));\n\n for (int y = 0; y < previewHeight; ++y)\n {\n\tfor (int x = 0; x < previewWidth; ++x)\n\t{\n\t PreviewRgba &preview = previewPixels[y][x];\n\t const Rgba &pixel = pixels[int (y * fy + .5f)][int (x * fx + .5f)];\n\n\t preview.r = gamma (pixel.r, m);\n\t preview.g = gamma (pixel.g, m);\n\t preview.b = gamma (pixel.b, m);\n\t preview.a = int (IMATH_NAMESPACE::clamp (pixel.a * 255.f, 0.f, 255.f) + .5f);\n\t}\n }\n}","lang":"cpp","vul_type":"cwe-476","sven_meta":{"func_name":"generatePreview","file_name":"OpenEXR/exrmakepreview/makePreview.cpp","commit_link":"github.com/AcademySoftwareFoundation/openexr/commit/74504503cff86e986bac441213c403b0ba28d58f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#14-8a701e8b74da","input":"int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)\n{\n\tint r;\n\t/* Assume we're using HV mode when the HV module is loaded */\n\tint hv_enabled = kvmppc_hv_ops ? 1 : 0;\n\n\tif (kvm) {\n\t\t/*\n\t\t * Hooray - we know which VM type we're running on. Depend on\n\t\t * that rather than the guess above.\n\t\t */\n\t\thv_enabled = is_kvmppc_hv_enabled(kvm);\n\t}\n\n\tswitch (ext) {\n#ifdef CONFIG_BOOKE\n\tcase KVM_CAP_PPC_BOOKE_SREGS:\n\tcase KVM_CAP_PPC_BOOKE_WATCHDOG:\n\tcase KVM_CAP_PPC_EPR:\n#else\n\tcase KVM_CAP_PPC_SEGSTATE:\n\tcase KVM_CAP_PPC_HIOR:\n\tcase KVM_CAP_PPC_PAPR:\n#endif\n\tcase KVM_CAP_PPC_UNSET_IRQ:\n\tcase KVM_CAP_PPC_IRQ_LEVEL:\n\tcase KVM_CAP_ENABLE_CAP:\n\tcase KVM_CAP_ENABLE_CAP_VM:\n\tcase KVM_CAP_ONE_REG:\n\tcase KVM_CAP_IOEVENTFD:\n\tcase KVM_CAP_DEVICE_CTRL:\n\tcase KVM_CAP_IMMEDIATE_EXIT:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_PPC_PAIRED_SINGLES:\n\tcase KVM_CAP_PPC_OSI:\n\tcase KVM_CAP_PPC_GET_PVINFO:\n#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)\n\tcase KVM_CAP_SW_TLB:\n#endif\n\t\t/* We support this only for PR */\n\t\tr = !hv_enabled;\n\t\tbreak;\n#ifdef CONFIG_KVM_MPIC\n\tcase KVM_CAP_IRQ_MPIC:\n\t\tr = 1;\n\t\tbreak;\n#endif\n\n#ifdef CONFIG_PPC_BOOK3S_64\n\tcase KVM_CAP_SPAPR_TCE:\n\tcase KVM_CAP_SPAPR_TCE_64:\n\t\t/* fallthrough */\n\tcase KVM_CAP_SPAPR_TCE_VFIO:\n\tcase KVM_CAP_PPC_RTAS:\n\tcase KVM_CAP_PPC_FIXUP_HCALL:\n\tcase KVM_CAP_PPC_ENABLE_HCALL:\n#ifdef CONFIG_KVM_XICS\n\tcase KVM_CAP_IRQ_XICS:\n#endif\n\t\tr = 1;\n\t\tbreak;\n\n\tcase KVM_CAP_PPC_ALLOC_HTAB:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif /* CONFIG_PPC_BOOK3S_64 */\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_SMT:\n\t\tr = 0;\n\t\tif (kvm) {\n\t\t\tif (kvm->arch.emul_smt_mode > 1)\n\t\t\t\tr = kvm->arch.emul_smt_mode;\n\t\t\telse\n\t\t\t\tr = kvm->arch.smt_mode;\n\t\t} else if (hv_enabled) {\n\t\t\tif (cpu_has_feature(CPU_FTR_ARCH_300))\n\t\t\t\tr = 1;\n\t\t\telse\n\t\t\t\tr = threads_per_subcore;\n\t\t}\n\t\tbreak;\n\tcase KVM_CAP_PPC_SMT_POSSIBLE:\n\t\tr = 1;\n\t\tif (hv_enabled) {\n\t\t\tif (!cpu_has_feature(CPU_FTR_ARCH_300))\n\t\t\t\tr = ((threads_per_subcore << 1) - 1);\n\t\t\telse\n\t\t\t\t/* P9 can emulate dbells, so allow any mode */\n\t\t\t\tr = 8 | 4 | 2 | 1;\n\t\t}\n\t\tbreak;\n\tcase KVM_CAP_PPC_RMA:\n\t\tr = 0;\n\t\tbreak;\n\tcase KVM_CAP_PPC_HWRNG:\n\t\tr = kvmppc_hwrng_present();\n\t\tbreak;\n\tcase KVM_CAP_PPC_MMU_RADIX:\n\t\tr = !!(hv_enabled && radix_enabled());\n\t\tbreak;\n\tcase KVM_CAP_PPC_MMU_HASH_V3:\n\t\tr = !!(hv_enabled && !radix_enabled() &&\n\t\t cpu_has_feature(CPU_FTR_ARCH_300));\n\t\tbreak;\n#endif\n\tcase KVM_CAP_SYNC_MMU:\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\t\tr = hv_enabled;\n#elif defined(KVM_ARCH_WANT_MMU_NOTIFIER)\n\t\tr = 1;\n#else\n\t\tr = 0;\n#endif\n\t\tbreak;\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_HTAB_FD:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif\n\tcase KVM_CAP_NR_VCPUS:\n\t\t/*\n\t\t * Recommending a number of CPUs is somewhat arbitrary; we\n\t\t * return the number of present CPUs for -HV (since a host\n\t\t * will have secondary threads \"offline\"), and for other KVM\n\t\t * implementations just count online CPUs.\n\t\t */\n\t\tif (hv_enabled)\n\t\t\tr = num_present_cpus();\n\t\telse\n\t\t\tr = num_online_cpus();\n\t\tbreak;\n\tcase KVM_CAP_NR_MEMSLOTS:\n\t\tr = KVM_USER_MEM_SLOTS;\n\t\tbreak;\n\tcase KVM_CAP_MAX_VCPUS:\n\t\tr = KVM_MAX_VCPUS;\n\t\tbreak;\n#ifdef CONFIG_PPC_BOOK3S_64\n\tcase KVM_CAP_PPC_GET_SMMU_INFO:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_SPAPR_MULTITCE:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_SPAPR_RESIZE_HPT:\n\t\t/* Disable this on POWER9 until code handles new HPTE format */\n\t\tr = !!hv_enabled && !cpu_has_feature(CPU_FTR_ARCH_300);\n\t\tbreak;\n#endif\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_FWNMI:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif\n\tcase KVM_CAP_PPC_HTM:\n\t\tr = cpu_has_feature(CPU_FTR_TM_COMP) &&\n\t\t is_kvmppc_hv_enabled(kvm);\n\t\tbreak;\n\tdefault:\n\t\tr = 0;\n\t\tbreak;\n\t}\n\treturn r;\n\n}","target":"int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)\n{\n\tint r;\n\t/* Assume we're using HV mode when the HV module is loaded */\n\tint hv_enabled = kvmppc_hv_ops ? 1 : 0;\n\n\tif (kvm) {\n\t\t/*\n\t\t * Hooray - we know which VM type we're running on. Depend on\n\t\t * that rather than the guess above.\n\t\t */\n\t\thv_enabled = is_kvmppc_hv_enabled(kvm);\n\t}\n\n\tswitch (ext) {\n#ifdef CONFIG_BOOKE\n\tcase KVM_CAP_PPC_BOOKE_SREGS:\n\tcase KVM_CAP_PPC_BOOKE_WATCHDOG:\n\tcase KVM_CAP_PPC_EPR:\n#else\n\tcase KVM_CAP_PPC_SEGSTATE:\n\tcase KVM_CAP_PPC_HIOR:\n\tcase KVM_CAP_PPC_PAPR:\n#endif\n\tcase KVM_CAP_PPC_UNSET_IRQ:\n\tcase KVM_CAP_PPC_IRQ_LEVEL:\n\tcase KVM_CAP_ENABLE_CAP:\n\tcase KVM_CAP_ENABLE_CAP_VM:\n\tcase KVM_CAP_ONE_REG:\n\tcase KVM_CAP_IOEVENTFD:\n\tcase KVM_CAP_DEVICE_CTRL:\n\tcase KVM_CAP_IMMEDIATE_EXIT:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_PPC_PAIRED_SINGLES:\n\tcase KVM_CAP_PPC_OSI:\n\tcase KVM_CAP_PPC_GET_PVINFO:\n#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)\n\tcase KVM_CAP_SW_TLB:\n#endif\n\t\t/* We support this only for PR */\n\t\tr = !hv_enabled;\n\t\tbreak;\n#ifdef CONFIG_KVM_MPIC\n\tcase KVM_CAP_IRQ_MPIC:\n\t\tr = 1;\n\t\tbreak;\n#endif\n\n#ifdef CONFIG_PPC_BOOK3S_64\n\tcase KVM_CAP_SPAPR_TCE:\n\tcase KVM_CAP_SPAPR_TCE_64:\n\t\t/* fallthrough */\n\tcase KVM_CAP_SPAPR_TCE_VFIO:\n\tcase KVM_CAP_PPC_RTAS:\n\tcase KVM_CAP_PPC_FIXUP_HCALL:\n\tcase KVM_CAP_PPC_ENABLE_HCALL:\n#ifdef CONFIG_KVM_XICS\n\tcase KVM_CAP_IRQ_XICS:\n#endif\n\t\tr = 1;\n\t\tbreak;\n\n\tcase KVM_CAP_PPC_ALLOC_HTAB:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif /* CONFIG_PPC_BOOK3S_64 */\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_SMT:\n\t\tr = 0;\n\t\tif (kvm) {\n\t\t\tif (kvm->arch.emul_smt_mode > 1)\n\t\t\t\tr = kvm->arch.emul_smt_mode;\n\t\t\telse\n\t\t\t\tr = kvm->arch.smt_mode;\n\t\t} else if (hv_enabled) {\n\t\t\tif (cpu_has_feature(CPU_FTR_ARCH_300))\n\t\t\t\tr = 1;\n\t\t\telse\n\t\t\t\tr = threads_per_subcore;\n\t\t}\n\t\tbreak;\n\tcase KVM_CAP_PPC_SMT_POSSIBLE:\n\t\tr = 1;\n\t\tif (hv_enabled) {\n\t\t\tif (!cpu_has_feature(CPU_FTR_ARCH_300))\n\t\t\t\tr = ((threads_per_subcore << 1) - 1);\n\t\t\telse\n\t\t\t\t/* P9 can emulate dbells, so allow any mode */\n\t\t\t\tr = 8 | 4 | 2 | 1;\n\t\t}\n\t\tbreak;\n\tcase KVM_CAP_PPC_RMA:\n\t\tr = 0;\n\t\tbreak;\n\tcase KVM_CAP_PPC_HWRNG:\n\t\tr = kvmppc_hwrng_present();\n\t\tbreak;\n\tcase KVM_CAP_PPC_MMU_RADIX:\n\t\tr = !!(hv_enabled && radix_enabled());\n\t\tbreak;\n\tcase KVM_CAP_PPC_MMU_HASH_V3:\n\t\tr = !!(hv_enabled && !radix_enabled() &&\n\t\t cpu_has_feature(CPU_FTR_ARCH_300));\n\t\tbreak;\n#endif\n\tcase KVM_CAP_SYNC_MMU:\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\t\tr = hv_enabled;\n#elif defined(KVM_ARCH_WANT_MMU_NOTIFIER)\n\t\tr = 1;\n#else\n\t\tr = 0;\n#endif\n\t\tbreak;\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_HTAB_FD:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif\n\tcase KVM_CAP_NR_VCPUS:\n\t\t/*\n\t\t * Recommending a number of CPUs is somewhat arbitrary; we\n\t\t * return the number of present CPUs for -HV (since a host\n\t\t * will have secondary threads \"offline\"), and for other KVM\n\t\t * implementations just count online CPUs.\n\t\t */\n\t\tif (hv_enabled)\n\t\t\tr = num_present_cpus();\n\t\telse\n\t\t\tr = num_online_cpus();\n\t\tbreak;\n\tcase KVM_CAP_NR_MEMSLOTS:\n\t\tr = KVM_USER_MEM_SLOTS;\n\t\tbreak;\n\tcase KVM_CAP_MAX_VCPUS:\n\t\tr = KVM_MAX_VCPUS;\n\t\tbreak;\n#ifdef CONFIG_PPC_BOOK3S_64\n\tcase KVM_CAP_PPC_GET_SMMU_INFO:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_SPAPR_MULTITCE:\n\t\tr = 1;\n\t\tbreak;\n\tcase KVM_CAP_SPAPR_RESIZE_HPT:\n\t\t/* Disable this on POWER9 until code handles new HPTE format */\n\t\tr = !!hv_enabled && !cpu_has_feature(CPU_FTR_ARCH_300);\n\t\tbreak;\n#endif\n#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n\tcase KVM_CAP_PPC_FWNMI:\n\t\tr = hv_enabled;\n\t\tbreak;\n#endif\n\tcase KVM_CAP_PPC_HTM:\n\t\tr = cpu_has_feature(CPU_FTR_TM_COMP) && hv_enabled;\n\t\tbreak;\n\tdefault:\n\t\tr = 0;\n\t\tbreak;\n\t}\n\treturn r;\n\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"kvm_vm_ioctl_check_extension","file_name":"arch/powerpc/kvm/powerpc.c","commit_link":"github.com/torvalds/linux/commit/ac64115a66c18c01745bbd3c47a36b124e5fd8c0","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#15-8a8c6fe3d38e","input":"static bool handle_client_startup(PgSocket *client, PktHdr *pkt)\n{\n\tconst char *passwd;\n\tconst uint8_t *key;\n\tbool ok;\n\n\tSBuf *sbuf = &client->sbuf;\n\n\t/* don't tolerate partial packets */\n\tif (incomplete_pkt(pkt)) {\n\t\tdisconnect_client(client, true, \"client sent partial pkt in startup phase\");\n\t\treturn false;\n\t}\n\n\tif (client->wait_for_welcome) {\n\t\tif (finish_client_login(client)) {\n\t\t\t/* the packet was already parsed */\n\t\t\tsbuf_prepare_skip(sbuf, pkt->len);\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}\n\n\tswitch (pkt->type) {\n\tcase PKT_SSLREQ:\n\t\tslog_noise(client, \"C: req SSL\");\n\t\tslog_noise(client, \"P: nak\");\n\n\t\t/* reject SSL attempt */\n\t\tif (!sbuf_answer(&client->sbuf, \"N\", 1)) {\n\t\t\tdisconnect_client(client, false, \"failed to nak SSL\");\n\t\t\treturn false;\n\t\t}\n\t\tbreak;\n\tcase PKT_STARTUP_V2:\n\t\tdisconnect_client(client, true, \"Old V2 protocol not supported\");\n\t\treturn false;\n\tcase PKT_STARTUP:\n\t\tif (client->pool) {\n\t\t\tdisconnect_client(client, true, \"client re-sent startup pkt\");\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!decide_startup_pool(client, pkt))\n\t\t\treturn false;\n\n\t\tif (client->pool->db->admin) {\n\t\t\tif (!admin_pre_login(client))\n\t\t\t\treturn false;\n\t\t}\n\n\t\tif (cf_auth_type <= AUTH_TRUST || client->own_user) {\n\t\t\tif (!finish_client_login(client))\n\t\t\t\treturn false;\n\t\t} else {\n\t\t\tif (!send_client_authreq(client)) {\n\t\t\t\tdisconnect_client(client, false, \"failed to send auth req\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase 'p':\t\t/* PasswordMessage */\n\t\t/* haven't requested it */\n\t\tif (cf_auth_type <= AUTH_TRUST) {\n\t\t\tdisconnect_client(client, true, \"unrequested passwd pkt\");\n\t\t\treturn false;\n\t\t}\n\n\t\tok = mbuf_get_string(&pkt->data, &passwd);\n\t\tif (ok && check_client_passwd(client, passwd)) {\n\t\t\tif (!finish_client_login(client))\n\t\t\t\treturn false;\n\t\t} else {\n\t\t\tdisconnect_client(client, true, \"Auth failed\");\n\t\t\treturn false;\n\t\t}\n\t\tbreak;\n\tcase PKT_CANCEL:\n\t\tif (mbuf_avail_for_read(&pkt->data) == BACKENDKEY_LEN\n\t\t && mbuf_get_bytes(&pkt->data, BACKENDKEY_LEN, &key))\n\t\t{\n\t\t\tmemcpy(client->cancel_key, key, BACKENDKEY_LEN);\n\t\t\taccept_cancel_request(client);\n\t\t} else\n\t\t\tdisconnect_client(client, false, \"bad cancel request\");\n\t\treturn false;\n\tdefault:\n\t\tdisconnect_client(client, false, \"bad packet\");\n\t\treturn false;\n\t}\n\tsbuf_prepare_skip(sbuf, pkt->len);\n\tclient->request_time = get_cached_time();\n\treturn true;\n}","target":"static bool handle_client_startup(PgSocket *client, PktHdr *pkt)\n{\n\tconst char *passwd;\n\tconst uint8_t *key;\n\tbool ok;\n\n\tSBuf *sbuf = &client->sbuf;\n\n\t/* don't tolerate partial packets */\n\tif (incomplete_pkt(pkt)) {\n\t\tdisconnect_client(client, true, \"client sent partial pkt in startup phase\");\n\t\treturn false;\n\t}\n\n\tif (client->wait_for_welcome) {\n\t\tif (finish_client_login(client)) {\n\t\t\t/* the packet was already parsed */\n\t\t\tsbuf_prepare_skip(sbuf, pkt->len);\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}\n\n\tswitch (pkt->type) {\n\tcase PKT_SSLREQ:\n\t\tslog_noise(client, \"C: req SSL\");\n\t\tslog_noise(client, \"P: nak\");\n\n\t\t/* reject SSL attempt */\n\t\tif (!sbuf_answer(&client->sbuf, \"N\", 1)) {\n\t\t\tdisconnect_client(client, false, \"failed to nak SSL\");\n\t\t\treturn false;\n\t\t}\n\t\tbreak;\n\tcase PKT_STARTUP_V2:\n\t\tdisconnect_client(client, true, \"Old V2 protocol not supported\");\n\t\treturn false;\n\tcase PKT_STARTUP:\n\t\tif (client->pool) {\n\t\t\tdisconnect_client(client, true, \"client re-sent startup pkt\");\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!decide_startup_pool(client, pkt))\n\t\t\treturn false;\n\n\t\tif (client->pool->db->admin) {\n\t\t\tif (!admin_pre_login(client))\n\t\t\t\treturn false;\n\t\t}\n\n\t\tif (cf_auth_type <= AUTH_TRUST || client->own_user) {\n\t\t\tif (!finish_client_login(client))\n\t\t\t\treturn false;\n\t\t} else {\n\t\t\tif (!send_client_authreq(client)) {\n\t\t\t\tdisconnect_client(client, false, \"failed to send auth req\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase 'p':\t\t/* PasswordMessage */\n\t\t/* too early */\n\t\tif (!client->auth_user) {\n\t\t\tdisconnect_client(client, true, \"client password pkt before startup packet\");\n\t\t\treturn false;\n\t\t}\n\n\t\t/* haven't requested it */\n\t\tif (cf_auth_type <= AUTH_TRUST) {\n\t\t\tdisconnect_client(client, true, \"unrequested passwd pkt\");\n\t\t\treturn false;\n\t\t}\n\n\t\tok = mbuf_get_string(&pkt->data, &passwd);\n\t\tif (ok && check_client_passwd(client, passwd)) {\n\t\t\tif (!finish_client_login(client))\n\t\t\t\treturn false;\n\t\t} else {\n\t\t\tdisconnect_client(client, true, \"Auth failed\");\n\t\t\treturn false;\n\t\t}\n\t\tbreak;\n\tcase PKT_CANCEL:\n\t\tif (mbuf_avail_for_read(&pkt->data) == BACKENDKEY_LEN\n\t\t && mbuf_get_bytes(&pkt->data, BACKENDKEY_LEN, &key))\n\t\t{\n\t\t\tmemcpy(client->cancel_key, key, BACKENDKEY_LEN);\n\t\t\taccept_cancel_request(client);\n\t\t} else\n\t\t\tdisconnect_client(client, false, \"bad cancel request\");\n\t\treturn false;\n\tdefault:\n\t\tdisconnect_client(client, false, \"bad packet\");\n\t\treturn false;\n\t}\n\tsbuf_prepare_skip(sbuf, pkt->len);\n\tclient->request_time = get_cached_time();\n\treturn true;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"handle_client_startup","file_name":"src/client.c","commit_link":"github.com/pgbouncer/pgbouncer/commit/74d6e5f7de5ec736f71204b7b422af7380c19ac5","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#16-e7b8e1971aa9","input":"mrb_class_real(struct RClass* cl)\n{\n if (cl == 0)\n return NULL;\n while ((cl->tt == MRB_TT_SCLASS) || (cl->tt == MRB_TT_ICLASS)) {\n cl = cl->super;\n }\n return cl;\n}","target":"mrb_class_real(struct RClass* cl)\n{\n if (cl == 0) return NULL;\n while ((cl->tt == MRB_TT_SCLASS) || (cl->tt == MRB_TT_ICLASS)) {\n cl = cl->super;\n if (cl == 0) return NULL;\n }\n return cl;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"mrb_class_real","file_name":"src/class.c","commit_link":"github.com/mruby/mruby/commit/faa4eaf6803bd11669bc324b4c34e7162286bfa3","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#17-fb4fbd804bed","input":"static int nsv_read_chunk(AVFormatContext *s, int fill_header)\n{\n NSVContext *nsv = s->priv_data;\n AVIOContext *pb = s->pb;\n AVStream *st[2] = {NULL, NULL};\n NSVStream *nst;\n AVPacket *pkt;\n int i, err = 0;\n uint8_t auxcount; /* number of aux metadata, also 4 bits of vsize */\n uint32_t vsize;\n uint16_t asize;\n uint16_t auxsize;\n\n if (nsv->ahead[0].data || nsv->ahead[1].data)\n return 0; //-1; /* hey! eat what you've in your plate first! */\n\nnull_chunk_retry:\n if (pb->eof_reached)\n return -1;\n\n for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++)\n err = nsv_resync(s);\n if (err < 0)\n return err;\n if (nsv->state == NSV_FOUND_NSVS)\n err = nsv_parse_NSVs_header(s);\n if (err < 0)\n return err;\n if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF)\n return -1;\n\n auxcount = avio_r8(pb);\n vsize = avio_rl16(pb);\n asize = avio_rl16(pb);\n vsize = (vsize << 4) | (auxcount >> 4);\n auxcount &= 0x0f;\n av_log(s, AV_LOG_TRACE, \"NSV CHUNK %\"PRIu8\" aux, %\"PRIu32\" bytes video, %\"PRIu16\" bytes audio\\n\",\n auxcount, vsize, asize);\n /* skip aux stuff */\n for (i = 0; i < auxcount; i++) {\n uint32_t av_unused auxtag;\n auxsize = avio_rl16(pb);\n auxtag = avio_rl32(pb);\n avio_skip(pb, auxsize);\n vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming brain-dead */\n }\n\n if (pb->eof_reached)\n return -1;\n if (!vsize && !asize) {\n nsv->state = NSV_UNSYNC;\n goto null_chunk_retry;\n }\n\n /* map back streams to v,a */\n if (s->nb_streams > 0)\n st[s->streams[0]->id] = s->streams[0];\n if (s->nb_streams > 1)\n st[s->streams[1]->id] = s->streams[1];\n\n if (vsize && st[NSV_ST_VIDEO]) {\n nst = st[NSV_ST_VIDEO]->priv_data;\n pkt = &nsv->ahead[NSV_ST_VIDEO];\n av_get_packet(pb, pkt, vsize);\n pkt->stream_index = st[NSV_ST_VIDEO]->index;//NSV_ST_VIDEO;\n pkt->dts = nst->frame_offset;\n pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */\n for (i = 0; i < FFMIN(8, vsize); i++)\n av_log(s, AV_LOG_TRACE, \"NSV video: [%d] = %02\"PRIx8\"\\n\",\n i, pkt->data[i]);\n }\n if(st[NSV_ST_VIDEO])\n ((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset++;\n\n if (asize && st[NSV_ST_AUDIO]) {\n nst = st[NSV_ST_AUDIO]->priv_data;\n pkt = &nsv->ahead[NSV_ST_AUDIO];\n /* read raw audio specific header on the first audio chunk... */\n /* on ALL audio chunks ?? seems so! */\n if (asize && st[NSV_ST_AUDIO]->codecpar->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {\n uint8_t bps;\n uint8_t channels;\n uint16_t samplerate;\n bps = avio_r8(pb);\n channels = avio_r8(pb);\n samplerate = avio_rl16(pb);\n if (!channels || !samplerate)\n return AVERROR_INVALIDDATA;\n asize-=4;\n av_log(s, AV_LOG_TRACE, \"NSV RAWAUDIO: bps %\"PRIu8\", nchan %\"PRIu8\", srate %\"PRIu16\"\\n\",\n bps, channels, samplerate);\n if (fill_header) {\n st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */\n if (bps != 16) {\n av_log(s, AV_LOG_TRACE, \"NSV AUDIO bit/sample != 16 (%\"PRIu8\")!!!\\n\", bps);\n }\n bps /= channels; // ???\n if (bps == 8)\n st[NSV_ST_AUDIO]->codecpar->codec_id = AV_CODEC_ID_PCM_U8;\n samplerate /= 4;/* UGH ??? XXX */\n channels = 1;\n st[NSV_ST_AUDIO]->codecpar->channels = channels;\n st[NSV_ST_AUDIO]->codecpar->sample_rate = samplerate;\n av_log(s, AV_LOG_TRACE, \"NSV RAWAUDIO: bps %\"PRIu8\", nchan %\"PRIu8\", srate %\"PRIu16\"\\n\",\n bps, channels, samplerate);\n }\n }\n av_get_packet(pb, pkt, asize);\n pkt->stream_index = st[NSV_ST_AUDIO]->index;//NSV_ST_AUDIO;\n pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */\n if( nsv->state == NSV_HAS_READ_NSVS && st[NSV_ST_VIDEO] ) {\n /* on a nsvs frame we have new information on a/v sync */\n pkt->dts = (((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset-1);\n pkt->dts *= (int64_t)1000 * nsv->framerate.den;\n pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num;\n av_log(s, AV_LOG_TRACE, \"NSV AUDIO: sync:%\"PRId16\", dts:%\"PRId64,\n nsv->avsync, pkt->dts);\n }\n nst->frame_offset++;\n }\n\n nsv->state = NSV_UNSYNC;\n return 0;\n}","target":"static int nsv_read_chunk(AVFormatContext *s, int fill_header)\n{\n NSVContext *nsv = s->priv_data;\n AVIOContext *pb = s->pb;\n AVStream *st[2] = {NULL, NULL};\n NSVStream *nst;\n AVPacket *pkt;\n int i, err = 0;\n uint8_t auxcount; /* number of aux metadata, also 4 bits of vsize */\n uint32_t vsize;\n uint16_t asize;\n uint16_t auxsize;\n int ret;\n\n if (nsv->ahead[0].data || nsv->ahead[1].data)\n return 0; //-1; /* hey! eat what you've in your plate first! */\n\nnull_chunk_retry:\n if (pb->eof_reached)\n return -1;\n\n for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++)\n err = nsv_resync(s);\n if (err < 0)\n return err;\n if (nsv->state == NSV_FOUND_NSVS)\n err = nsv_parse_NSVs_header(s);\n if (err < 0)\n return err;\n if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF)\n return -1;\n\n auxcount = avio_r8(pb);\n vsize = avio_rl16(pb);\n asize = avio_rl16(pb);\n vsize = (vsize << 4) | (auxcount >> 4);\n auxcount &= 0x0f;\n av_log(s, AV_LOG_TRACE, \"NSV CHUNK %\"PRIu8\" aux, %\"PRIu32\" bytes video, %\"PRIu16\" bytes audio\\n\",\n auxcount, vsize, asize);\n /* skip aux stuff */\n for (i = 0; i < auxcount; i++) {\n uint32_t av_unused auxtag;\n auxsize = avio_rl16(pb);\n auxtag = avio_rl32(pb);\n avio_skip(pb, auxsize);\n vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming brain-dead */\n }\n\n if (pb->eof_reached)\n return -1;\n if (!vsize && !asize) {\n nsv->state = NSV_UNSYNC;\n goto null_chunk_retry;\n }\n\n /* map back streams to v,a */\n if (s->nb_streams > 0)\n st[s->streams[0]->id] = s->streams[0];\n if (s->nb_streams > 1)\n st[s->streams[1]->id] = s->streams[1];\n\n if (vsize && st[NSV_ST_VIDEO]) {\n nst = st[NSV_ST_VIDEO]->priv_data;\n pkt = &nsv->ahead[NSV_ST_VIDEO];\n if ((ret = av_get_packet(pb, pkt, vsize)) < 0)\n return ret;\n pkt->stream_index = st[NSV_ST_VIDEO]->index;//NSV_ST_VIDEO;\n pkt->dts = nst->frame_offset;\n pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */\n for (i = 0; i < FFMIN(8, vsize); i++)\n av_log(s, AV_LOG_TRACE, \"NSV video: [%d] = %02\"PRIx8\"\\n\",\n i, pkt->data[i]);\n }\n if(st[NSV_ST_VIDEO])\n ((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset++;\n\n if (asize && st[NSV_ST_AUDIO]) {\n nst = st[NSV_ST_AUDIO]->priv_data;\n pkt = &nsv->ahead[NSV_ST_AUDIO];\n /* read raw audio specific header on the first audio chunk... */\n /* on ALL audio chunks ?? seems so! */\n if (asize && st[NSV_ST_AUDIO]->codecpar->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {\n uint8_t bps;\n uint8_t channels;\n uint16_t samplerate;\n bps = avio_r8(pb);\n channels = avio_r8(pb);\n samplerate = avio_rl16(pb);\n if (!channels || !samplerate)\n return AVERROR_INVALIDDATA;\n asize-=4;\n av_log(s, AV_LOG_TRACE, \"NSV RAWAUDIO: bps %\"PRIu8\", nchan %\"PRIu8\", srate %\"PRIu16\"\\n\",\n bps, channels, samplerate);\n if (fill_header) {\n st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */\n if (bps != 16) {\n av_log(s, AV_LOG_TRACE, \"NSV AUDIO bit/sample != 16 (%\"PRIu8\")!!!\\n\", bps);\n }\n bps /= channels; // ???\n if (bps == 8)\n st[NSV_ST_AUDIO]->codecpar->codec_id = AV_CODEC_ID_PCM_U8;\n samplerate /= 4;/* UGH ??? XXX */\n channels = 1;\n st[NSV_ST_AUDIO]->codecpar->channels = channels;\n st[NSV_ST_AUDIO]->codecpar->sample_rate = samplerate;\n av_log(s, AV_LOG_TRACE, \"NSV RAWAUDIO: bps %\"PRIu8\", nchan %\"PRIu8\", srate %\"PRIu16\"\\n\",\n bps, channels, samplerate);\n }\n }\n if ((ret = av_get_packet(pb, pkt, asize)) < 0)\n return ret;\n pkt->stream_index = st[NSV_ST_AUDIO]->index;//NSV_ST_AUDIO;\n pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */\n if( nsv->state == NSV_HAS_READ_NSVS && st[NSV_ST_VIDEO] ) {\n /* on a nsvs frame we have new information on a/v sync */\n pkt->dts = (((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset-1);\n pkt->dts *= (int64_t)1000 * nsv->framerate.den;\n pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num;\n av_log(s, AV_LOG_TRACE, \"NSV AUDIO: sync:%\"PRId16\", dts:%\"PRId64,\n nsv->avsync, pkt->dts);\n }\n nst->frame_offset++;\n }\n\n nsv->state = NSV_UNSYNC;\n return 0;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"nsv_read_chunk","file_name":"libavformat/nsvdec.c","commit_link":"github.com/libav/libav/commit/fe6eea99efac66839052af547426518efd970b24","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#18-1a0c52215025","input":"_kdc_as_rep(kdc_request_t r,\n\t krb5_data *reply,\n\t const char *from,\n\t struct sockaddr *from_addr,\n\t int datagram_reply)\n{\n krb5_context context = r->context;\n krb5_kdc_configuration *config = r->config;\n KDC_REQ *req = &r->req;\n KDC_REQ_BODY *b = NULL;\n AS_REP rep;\n KDCOptions f;\n krb5_enctype setype;\n krb5_error_code ret = 0;\n Key *skey;\n int found_pa = 0;\n int i, flags = HDB_F_FOR_AS_REQ;\n METHOD_DATA error_method;\n const PA_DATA *pa;\n\n memset(&rep, 0, sizeof(rep));\n error_method.len = 0;\n error_method.val = NULL;\n\n /*\n * Look for FAST armor and unwrap\n */\n ret = _kdc_fast_unwrap_request(r);\n if (ret) {\n\t_kdc_r_log(r, 0, \"FAST unwrap request from %s failed: %d\", from, ret);\n\tgoto out;\n }\n\n b = &req->req_body;\n f = b->kdc_options;\n\n if (f.canonicalize)\n\tflags |= HDB_F_CANON;\n\n if(b->sname == NULL){\n\tret = KRB5KRB_ERR_GENERIC;\n\t_kdc_set_e_text(r, \"No server in request\");\n } else{\n\tret = _krb5_principalname2krb5_principal (context,\n\t\t\t\t\t\t &r->server_princ,\n\t\t\t\t\t\t *(b->sname),\n\t\t\t\t\t\t b->realm);\n\tif (ret == 0)\n\t ret = krb5_unparse_name(context, r->server_princ, &r->server_name);\n }\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"AS-REQ malformed server name from %s\", from);\n\tgoto out;\n }\n if(b->cname == NULL){\n\tret = KRB5KRB_ERR_GENERIC;\n\t_kdc_set_e_text(r, \"No client in request\");\n } else {\n\tret = _krb5_principalname2krb5_principal (context,\n\t\t\t\t\t\t &r->client_princ,\n\t\t\t\t\t\t *(b->cname),\n\t\t\t\t\t\t b->realm);\n\tif (ret)\n\t goto out;\n\n\tret = krb5_unparse_name(context, r->client_princ, &r->client_name);\n }\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"AS-REQ malformed client name from %s\", from);\n\tgoto out;\n }\n\n kdc_log(context, config, 0, \"AS-REQ %s from %s for %s\",\n\t r->client_name, from, r->server_name);\n\n /*\n *\n */\n\n if (_kdc_is_anonymous(context, r->client_princ)) {\n\tif (!_kdc_is_anon_request(b)) {\n\t kdc_log(context, config, 0, \"Anonymous ticket w/o anonymous flag\");\n\t ret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\t goto out;\n\t}\n } else if (_kdc_is_anon_request(b)) {\n\tkdc_log(context, config, 0,\n\t\t\"Request for a anonymous ticket with non \"\n\t\t\"anonymous client name: %s\", r->client_name);\n\tret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n\n /*\n *\n */\n\n ret = _kdc_db_fetch(context, config, r->client_princ,\n\t\t\tHDB_F_GET_CLIENT | flags, NULL,\n\t\t\t&r->clientdb, &r->client);\n if(ret == HDB_ERR_NOT_FOUND_HERE) {\n\tkdc_log(context, config, 5, \"client %s does not have secrets at this KDC, need to proxy\",\n\t\tr->client_name);\n\tgoto out;\n } else if (ret == HDB_ERR_WRONG_REALM) {\n\tchar *fixed_client_name = NULL;\n\n\tret = krb5_unparse_name(context, r->client->entry.principal,\n\t\t\t\t&fixed_client_name);\n\tif (ret) {\n\t goto out;\n\t}\n\n\tkdc_log(context, config, 0, \"WRONG_REALM - %s -> %s\",\n\t\tr->client_name, fixed_client_name);\n\tfree(fixed_client_name);\n\n\tret = _kdc_fast_mk_error(context, r,\n\t\t\t\t &error_method,\n\t\t\t\t r->armor_crypto,\n\t\t\t\t &req->req_body,\n\t\t\t\t KRB5_KDC_ERR_WRONG_REALM,\n\t\t\t\t NULL,\n\t\t\t\t r->server_princ,\n\t\t\t\t NULL,\n\t\t\t\t &r->client->entry.principal->realm,\n\t\t\t\t NULL, NULL,\n\t\t\t\t reply);\n\tgoto out;\n } else if(ret){\n\tconst char *msg = krb5_get_error_message(context, ret);\n\tkdc_log(context, config, 0, \"UNKNOWN -- %s: %s\", r->client_name, msg);\n\tkrb5_free_error_message(context, msg);\n\tret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n ret = _kdc_db_fetch(context, config, r->server_princ,\n\t\t\tHDB_F_GET_SERVER|HDB_F_GET_KRBTGT | flags,\n\t\t\tNULL, NULL, &r->server);\n if(ret == HDB_ERR_NOT_FOUND_HERE) {\n\tkdc_log(context, config, 5, \"target %s does not have secrets at this KDC, need to proxy\",\n\t\tr->server_name);\n\tgoto out;\n } else if(ret){\n\tconst char *msg = krb5_get_error_message(context, ret);\n\tkdc_log(context, config, 0, \"UNKNOWN -- %s: %s\", r->server_name, msg);\n\tkrb5_free_error_message(context, msg);\n\tret = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n\n /*\n * Select a session enctype from the list of the crypto system\n * supported enctypes that is supported by the client and is one of\n * the enctype of the enctype of the service (likely krbtgt).\n *\n * The latter is used as a hint of what enctypes all KDC support,\n * to make sure a newer version of KDC won't generate a session\n * enctype that an older version of a KDC in the same realm can't\n * decrypt.\n */\n\n ret = _kdc_find_etype(context,\n\t\t\t krb5_principal_is_krbtgt(context, r->server_princ) ?\n\t\t\t config->tgt_use_strongest_session_key :\n\t\t\t config->svc_use_strongest_session_key, FALSE,\n\t\t\t r->client, b->etype.val, b->etype.len, &r->sessionetype,\n\t\t\t NULL);\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"Client (%s) from %s has no common enctypes with KDC \"\n\t\t\"to use for the session key\",\n\t\tr->client_name, from);\n\tgoto out;\n }\n\n /*\n * Pre-auth processing\n */\n\n if(req->padata){\n\tunsigned int n;\n\n\tlog_patypes(context, config, req->padata);\n\n\t/* Check if preauth matching */\n\n\tfor (n = 0; !found_pa && n < sizeof(pat) / sizeof(pat[0]); n++) {\n\t if (pat[n].validate == NULL)\n\t\tcontinue;\n\t if (r->armor_crypto == NULL && (pat[n].flags & PA_REQ_FAST))\n\t\tcontinue;\n\n\t kdc_log(context, config, 5,\n\t\t \"Looking for %s pa-data -- %s\", pat[n].name, r->client_name);\n\t i = 0;\n\t pa = _kdc_find_padata(req, &i, pat[n].type);\n\t if (pa) {\n\t\tret = pat[n].validate(r, pa);\n\t\tif (ret != 0) {\n\t\t goto out;\n\t\t}\n\t\tkdc_log(context, config, 0,\n\t\t\t\"%s pre-authentication succeeded -- %s\",\n\t\t\tpat[n].name, r->client_name);\n\t\tfound_pa = 1;\n\t\tr->et.flags.pre_authent = 1;\n\t }\n\t}\n }\n\n if (found_pa == 0) {\n\tKey *ckey = NULL;\n\tsize_t n;\n\n\tfor (n = 0; n < sizeof(pat) / sizeof(pat[0]); n++) {\n\t if ((pat[n].flags & PA_ANNOUNCE) == 0)\n\t\tcontinue;\n\t ret = krb5_padata_add(context, &error_method,\n\t\t\t\t pat[n].type, NULL, 0);\n\t if (ret)\n\t\tgoto out;\n\t}\n\n\t/*\n\t * If there is a client key, send ETYPE_INFO{,2}\n\t */\n\tret = _kdc_find_etype(context,\n\t\t\t config->preauth_use_strongest_session_key, TRUE,\n\t\t\t r->client, b->etype.val, b->etype.len, NULL, &ckey);\n\tif (ret == 0) {\n\n\t /*\n\t * RFC4120 requires:\n\t * - If the client only knows about old enctypes, then send\n\t * both info replies (we send 'info' first in the list).\n\t * - If the client is 'modern', because it knows about 'new'\n\t * enctype types, then only send the 'info2' reply.\n\t *\n\t * Before we send the full list of etype-info data, we pick\n\t * the client key we would have used anyway below, just pick\n\t * that instead.\n\t */\n\n\t if (older_enctype(ckey->key.keytype)) {\n\t\tret = get_pa_etype_info(context, config,\n\t\t\t\t\t&error_method, ckey);\n\t\tif (ret)\n\t\t goto out;\n\t }\n\t ret = get_pa_etype_info2(context, config,\n\t\t\t\t &error_method, ckey);\n\t if (ret)\n\t\tgoto out;\n\t}\n\n\t/* \n\t * send requre preauth is its required or anon is requested,\n\t * anon is today only allowed via preauth mechanisms.\n\t */\n\tif (require_preauth_p(r) || _kdc_is_anon_request(b)) {\n\t ret = KRB5KDC_ERR_PREAUTH_REQUIRED;\n\t _kdc_set_e_text(r, \"Need to use PA-ENC-TIMESTAMP/PA-PK-AS-REQ\");\n\t goto out;\n\t}\n\n\tif (ckey == NULL) {\n\t ret = KRB5KDC_ERR_CLIENT_NOTYET;\n\t _kdc_set_e_text(r, \"Doesn't have a client key available\");\n\t goto out;\n\t}\n\tkrb5_free_keyblock_contents(r->context, &r->reply_key);\n\tret = krb5_copy_keyblock_contents(r->context, &ckey->key, &r->reply_key);\n\tif (ret)\n\t goto out;\n }\n\n if (r->clientdb->hdb_auth_status) {\n\tr->clientdb->hdb_auth_status(context, r->clientdb, r->client, \n\t\t\t\t HDB_AUTH_SUCCESS);\n }\n\n /*\n * Verify flags after the user been required to prove its identity\n * with in a preauth mech.\n */\n\n ret = _kdc_check_access(context, config, r->client, r->client_name,\n\t\t\t r->server, r->server_name,\n\t\t\t req, &error_method);\n if(ret)\n\tgoto out;\n\n /*\n * Select the best encryption type for the KDC with out regard to\n * the client since the client never needs to read that data.\n */\n\n ret = _kdc_get_preferred_key(context, config,\n\t\t\t\t r->server, r->server_name,\n\t\t\t\t &setype, &skey);\n if(ret)\n\tgoto out;\n\n if(f.renew || f.validate || f.proxy || f.forwarded || f.enc_tkt_in_skey\n || (_kdc_is_anon_request(b) && !config->allow_anonymous)) {\n\tret = KRB5KDC_ERR_BADOPTION;\n\t_kdc_set_e_text(r, \"Bad KDC options\");\n\tgoto out;\n }\n\n /*\n * Build reply\n */\n\n rep.pvno = 5;\n rep.msg_type = krb_as_rep;\n\n if (_kdc_is_anonymous(context, r->client_princ)) {\n\tRealm anon_realm=KRB5_ANON_REALM;\n\tret = copy_Realm(&anon_realm, &rep.crealm);\n } else\n\tret = copy_Realm(&r->client->entry.principal->realm, &rep.crealm);\n if (ret)\n\tgoto out;\n ret = _krb5_principal2principalname(&rep.cname, r->client->entry.principal);\n if (ret)\n\tgoto out;\n\n rep.ticket.tkt_vno = 5;\n ret = copy_Realm(&r->server->entry.principal->realm, &rep.ticket.realm);\n if (ret)\n\tgoto out;\n _krb5_principal2principalname(&rep.ticket.sname,\n\t\t\t\t r->server->entry.principal);\n /* java 1.6 expects the name to be the same type, lets allow that\n * uncomplicated name-types. */\n#define CNT(sp,t) (((sp)->sname->name_type) == KRB5_NT_##t)\n if (CNT(b, UNKNOWN) || CNT(b, PRINCIPAL) || CNT(b, SRV_INST) || CNT(b, SRV_HST) || CNT(b, SRV_XHST))\n\trep.ticket.sname.name_type = b->sname->name_type;\n#undef CNT\n\n r->et.flags.initial = 1;\n if(r->client->entry.flags.forwardable && r->server->entry.flags.forwardable)\n\tr->et.flags.forwardable = f.forwardable;\n else if (f.forwardable) {\n\t_kdc_set_e_text(r, \"Ticket may not be forwardable\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n if(r->client->entry.flags.proxiable && r->server->entry.flags.proxiable)\n\tr->et.flags.proxiable = f.proxiable;\n else if (f.proxiable) {\n\t_kdc_set_e_text(r, \"Ticket may not be proxiable\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n if(r->client->entry.flags.postdate && r->server->entry.flags.postdate)\n\tr->et.flags.may_postdate = f.allow_postdate;\n else if (f.allow_postdate){\n\t_kdc_set_e_text(r, \"Ticket may not be postdate\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n\n /* check for valid set of addresses */\n if(!_kdc_check_addresses(context, config, b->addresses, from_addr)) {\n\t_kdc_set_e_text(r, \"Bad address list in requested\");\n\tret = KRB5KRB_AP_ERR_BADADDR;\n\tgoto out;\n }\n\n ret = copy_PrincipalName(&rep.cname, &r->et.cname);\n if (ret)\n\tgoto out;\n ret = copy_Realm(&rep.crealm, &r->et.crealm);\n if (ret)\n\tgoto out;\n\n {\n\ttime_t start;\n\ttime_t t;\n\t\n\tstart = r->et.authtime = kdc_time;\n\n\tif(f.postdated && req->req_body.from){\n\t ALLOC(r->et.starttime);\n\t start = *r->et.starttime = *req->req_body.from;\n\t r->et.flags.invalid = 1;\n\t r->et.flags.postdated = 1; /* XXX ??? */\n\t}\n\t_kdc_fix_time(&b->till);\n\tt = *b->till;\n\n\t/* be careful not overflowing */\n\n\tif(r->client->entry.max_life)\n\t t = start + min(t - start, *r->client->entry.max_life);\n\tif(r->server->entry.max_life)\n\t t = start + min(t - start, *r->server->entry.max_life);\n#if 0\n\tt = min(t, start + realm->max_life);\n#endif\n\tr->et.endtime = t;\n\tif(f.renewable_ok && r->et.endtime < *b->till){\n\t f.renewable = 1;\n\t if(b->rtime == NULL){\n\t\tALLOC(b->rtime);\n\t\t*b->rtime = 0;\n\t }\n\t if(*b->rtime < *b->till)\n\t\t*b->rtime = *b->till;\n\t}\n\tif(f.renewable && b->rtime){\n\t t = *b->rtime;\n\t if(t == 0)\n\t\tt = MAX_TIME;\n\t if(r->client->entry.max_renew)\n\t\tt = start + min(t - start, *r->client->entry.max_renew);\n\t if(r->server->entry.max_renew)\n\t\tt = start + min(t - start, *r->server->entry.max_renew);\n#if 0\n\t t = min(t, start + realm->max_renew);\n#endif\n\t ALLOC(r->et.renew_till);\n\t *r->et.renew_till = t;\n\t r->et.flags.renewable = 1;\n\t}\n }\n\n if (_kdc_is_anon_request(b))\n\tr->et.flags.anonymous = 1;\n\n if(b->addresses){\n\tALLOC(r->et.caddr);\n\tcopy_HostAddresses(b->addresses, r->et.caddr);\n }\n\n r->et.transited.tr_type = DOMAIN_X500_COMPRESS;\n krb5_data_zero(&r->et.transited.contents);\n\n /* The MIT ASN.1 library (obviously) doesn't tell lengths encoded\n * as 0 and as 0x80 (meaning indefinite length) apart, and is thus\n * incapable of correctly decoding SEQUENCE OF's of zero length.\n *\n * To fix this, always send at least one no-op last_req\n *\n * If there's a pw_end or valid_end we will use that,\n * otherwise just a dummy lr.\n */\n r->ek.last_req.val = malloc(2 * sizeof(*r->ek.last_req.val));\n if (r->ek.last_req.val == NULL) {\n\tret = ENOMEM;\n\tgoto out;\n }\n r->ek.last_req.len = 0;\n if (r->client->entry.pw_end\n\t&& (config->kdc_warn_pwexpire == 0\n\t || kdc_time + config->kdc_warn_pwexpire >= *r->client->entry.pw_end)) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_PW_EXPTIME;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = *r->client->entry.pw_end;\n\t++r->ek.last_req.len;\n }\n if (r->client->entry.valid_end) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_ACCT_EXPTIME;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = *r->client->entry.valid_end;\n\t++r->ek.last_req.len;\n }\n if (r->ek.last_req.len == 0) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_NONE;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = 0;\n\t++r->ek.last_req.len;\n }\n r->ek.nonce = b->nonce;\n if (r->client->entry.valid_end || r->client->entry.pw_end) {\n\tALLOC(r->ek.key_expiration);\n\tif (r->client->entry.valid_end) {\n\t if (r->client->entry.pw_end)\n\t\t*r->ek.key_expiration = min(*r->client->entry.valid_end,\n\t\t\t\t\t *r->client->entry.pw_end);\n\t else\n\t\t*r->ek.key_expiration = *r->client->entry.valid_end;\n\t} else\n\t *r->ek.key_expiration = *r->client->entry.pw_end;\n } else\n\tr->ek.key_expiration = NULL;\n r->ek.flags = r->et.flags;\n r->ek.authtime = r->et.authtime;\n if (r->et.starttime) {\n\tALLOC(r->ek.starttime);\n\t*r->ek.starttime = *r->et.starttime;\n }\n r->ek.endtime = r->et.endtime;\n if (r->et.renew_till) {\n\tALLOC(r->ek.renew_till);\n\t*r->ek.renew_till = *r->et.renew_till;\n }\n ret = copy_Realm(&rep.ticket.realm, &r->ek.srealm);\n if (ret)\n\tgoto out;\n ret = copy_PrincipalName(&rep.ticket.sname, &r->ek.sname);\n if (ret)\n\tgoto out;\n if(r->et.caddr){\n\tALLOC(r->ek.caddr);\n\tcopy_HostAddresses(r->et.caddr, r->ek.caddr);\n }\n\n /*\n * Check and session and reply keys\n */\n\n if (r->session_key.keytype == ETYPE_NULL) {\n\tret = krb5_generate_random_keyblock(context, r->sessionetype, &r->session_key);\n\tif (ret)\n\t goto out;\n }\n\n if (r->reply_key.keytype == ETYPE_NULL) {\n\t_kdc_set_e_text(r, \"Client have no reply key\");\n\tret = KRB5KDC_ERR_CLIENT_NOTYET;\n\tgoto out;\n }\n\n ret = copy_EncryptionKey(&r->session_key, &r->et.key);\n if (ret)\n\tgoto out;\n\n ret = copy_EncryptionKey(&r->session_key, &r->ek.key);\n if (ret)\n\tgoto out;\n\n if (r->outpadata.len) {\n\n\tALLOC(rep.padata);\n\tif (rep.padata == NULL) {\n\t ret = ENOMEM;\n\t goto out;\n\t}\n\tret = copy_METHOD_DATA(&r->outpadata, rep.padata);\n\tif (ret)\n\t goto out;\n }\n\n /* Add the PAC */\n if (send_pac_p(context, req)) {\n\tgenerate_pac(r, skey);\n }\n\n _kdc_log_timestamp(context, config, \"AS-REQ\", r->et.authtime, r->et.starttime,\n\t\t r->et.endtime, r->et.renew_till);\n\n /* do this as the last thing since this signs the EncTicketPart */\n ret = _kdc_add_KRB5SignedPath(context,\n\t\t\t\t config,\n\t\t\t\t r->server,\n\t\t\t\t setype,\n\t\t\t\t r->client->entry.principal,\n\t\t\t\t NULL,\n\t\t\t\t NULL,\n\t\t\t\t &r->et);\n if (ret)\n\tgoto out;\n\n log_as_req(context, config, r->reply_key.keytype, setype, b);\n\n /*\n * We always say we support FAST/enc-pa-rep\n */\n\n r->et.flags.enc_pa_rep = r->ek.flags.enc_pa_rep = 1;\n\n /*\n * Add REQ_ENC_PA_REP if client supports it\n */\n\n i = 0;\n pa = _kdc_find_padata(req, &i, KRB5_PADATA_REQ_ENC_PA_REP);\n if (pa) {\n\n\tret = add_enc_pa_rep(r);\n\tif (ret) {\n\t const char *msg = krb5_get_error_message(r->context, ret);\n\t _kdc_r_log(r, 0, \"add_enc_pa_rep failed: %s: %d\", msg, ret);\n\t krb5_free_error_message(r->context, msg);\n\t goto out;\n\t}\n }\n\n /*\n *\n */\n\n ret = _kdc_encode_reply(context, config,\n\t\t\t r->armor_crypto, req->req_body.nonce,\n\t\t\t &rep, &r->et, &r->ek, setype, r->server->entry.kvno,\n\t\t\t &skey->key, r->client->entry.kvno,\n\t\t\t &r->reply_key, 0, &r->e_text, reply);\n if (ret)\n\tgoto out;\n\n /*\n * Check if message too large\n */\n if (datagram_reply && reply->length > config->max_datagram_reply_length) {\n\tkrb5_data_free(reply);\n\tret = KRB5KRB_ERR_RESPONSE_TOO_BIG;\n\t_kdc_set_e_text(r, \"Reply packet too large\");\n }\n\nout:\n free_AS_REP(&rep);\n\n /*\n * In case of a non proxy error, build an error message.\n */\n if(ret != 0 && ret != HDB_ERR_NOT_FOUND_HERE && reply->length == 0) {\n\tret = _kdc_fast_mk_error(context, r,\n\t\t\t\t &error_method,\n\t\t\t\t r->armor_crypto,\n\t\t\t\t &req->req_body,\n\t\t\t\t ret, r->e_text,\n\t\t\t\t r->server_princ,\n\t\t\t\t &r->client_princ->name,\n\t\t\t\t &r->client_princ->realm,\n\t\t\t\t NULL, NULL,\n\t\t\t\t reply);\n\tif (ret)\n\t goto out2;\n }\nout2:\n free_EncTicketPart(&r->et);\n free_EncKDCRepPart(&r->ek);\n free_KDCFastState(&r->fast);\n\n if (error_method.len)\n\tfree_METHOD_DATA(&error_method);\n if (r->outpadata.len)\n\tfree_METHOD_DATA(&r->outpadata);\n if (r->client_princ) {\n\tkrb5_free_principal(context, r->client_princ);\n\tr->client_princ = NULL;\n }\n if (r->client_name) {\n\tfree(r->client_name);\n\tr->client_name = NULL;\n }\n if (r->server_princ){\n\tkrb5_free_principal(context, r->server_princ);\n\tr->server_princ = NULL;\n }\n if (r->server_name) {\n\tfree(r->server_name);\n\tr->server_name = NULL;\n }\n if (r->client)\n\t_kdc_free_ent(context, r->client);\n if (r->server)\n\t_kdc_free_ent(context, r->server);\n if (r->armor_crypto) {\n\tkrb5_crypto_destroy(r->context, r->armor_crypto);\n\tr->armor_crypto = NULL;\n }\n krb5_free_keyblock_contents(r->context, &r->reply_key);\n krb5_free_keyblock_contents(r->context, &r->session_key);\n return ret;\n}","target":"_kdc_as_rep(kdc_request_t r,\n\t krb5_data *reply,\n\t const char *from,\n\t struct sockaddr *from_addr,\n\t int datagram_reply)\n{\n krb5_context context = r->context;\n krb5_kdc_configuration *config = r->config;\n KDC_REQ *req = &r->req;\n KDC_REQ_BODY *b = NULL;\n AS_REP rep;\n KDCOptions f;\n krb5_enctype setype;\n krb5_error_code ret = 0;\n Key *skey;\n int found_pa = 0;\n int i, flags = HDB_F_FOR_AS_REQ;\n METHOD_DATA error_method;\n const PA_DATA *pa;\n\n memset(&rep, 0, sizeof(rep));\n error_method.len = 0;\n error_method.val = NULL;\n\n /*\n * Look for FAST armor and unwrap\n */\n ret = _kdc_fast_unwrap_request(r);\n if (ret) {\n\t_kdc_r_log(r, 0, \"FAST unwrap request from %s failed: %d\", from, ret);\n\tgoto out;\n }\n\n b = &req->req_body;\n f = b->kdc_options;\n\n if (f.canonicalize)\n\tflags |= HDB_F_CANON;\n\n if(b->sname == NULL){\n\tret = KRB5KRB_ERR_GENERIC;\n\t_kdc_set_e_text(r, \"No server in request\");\n } else{\n\tret = _krb5_principalname2krb5_principal (context,\n\t\t\t\t\t\t &r->server_princ,\n\t\t\t\t\t\t *(b->sname),\n\t\t\t\t\t\t b->realm);\n\tif (ret == 0)\n\t ret = krb5_unparse_name(context, r->server_princ, &r->server_name);\n }\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"AS-REQ malformed server name from %s\", from);\n\tgoto out;\n }\n if(b->cname == NULL){\n\tret = KRB5KRB_ERR_GENERIC;\n\t_kdc_set_e_text(r, \"No client in request\");\n } else {\n\tret = _krb5_principalname2krb5_principal (context,\n\t\t\t\t\t\t &r->client_princ,\n\t\t\t\t\t\t *(b->cname),\n\t\t\t\t\t\t b->realm);\n\tif (ret)\n\t goto out;\n\n\tret = krb5_unparse_name(context, r->client_princ, &r->client_name);\n }\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"AS-REQ malformed client name from %s\", from);\n\tgoto out;\n }\n\n kdc_log(context, config, 0, \"AS-REQ %s from %s for %s\",\n\t r->client_name, from, r->server_name);\n\n /*\n *\n */\n\n if (_kdc_is_anonymous(context, r->client_princ)) {\n\tif (!_kdc_is_anon_request(b)) {\n\t kdc_log(context, config, 0, \"Anonymous ticket w/o anonymous flag\");\n\t ret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\t goto out;\n\t}\n } else if (_kdc_is_anon_request(b)) {\n\tkdc_log(context, config, 0,\n\t\t\"Request for a anonymous ticket with non \"\n\t\t\"anonymous client name: %s\", r->client_name);\n\tret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n\n /*\n *\n */\n\n ret = _kdc_db_fetch(context, config, r->client_princ,\n\t\t\tHDB_F_GET_CLIENT | flags, NULL,\n\t\t\t&r->clientdb, &r->client);\n if(ret == HDB_ERR_NOT_FOUND_HERE) {\n\tkdc_log(context, config, 5, \"client %s does not have secrets at this KDC, need to proxy\",\n\t\tr->client_name);\n\tgoto out;\n } else if (ret == HDB_ERR_WRONG_REALM) {\n\tchar *fixed_client_name = NULL;\n\n\tret = krb5_unparse_name(context, r->client->entry.principal,\n\t\t\t\t&fixed_client_name);\n\tif (ret) {\n\t goto out;\n\t}\n\n\tkdc_log(context, config, 0, \"WRONG_REALM - %s -> %s\",\n\t\tr->client_name, fixed_client_name);\n\tfree(fixed_client_name);\n\n\tret = _kdc_fast_mk_error(context, r,\n\t\t\t\t &error_method,\n\t\t\t\t r->armor_crypto,\n\t\t\t\t &req->req_body,\n\t\t\t\t KRB5_KDC_ERR_WRONG_REALM,\n\t\t\t\t NULL,\n\t\t\t\t r->server_princ,\n\t\t\t\t NULL,\n\t\t\t\t &r->client->entry.principal->realm,\n\t\t\t\t NULL, NULL,\n\t\t\t\t reply);\n\tgoto out;\n } else if(ret){\n\tconst char *msg = krb5_get_error_message(context, ret);\n\tkdc_log(context, config, 0, \"UNKNOWN -- %s: %s\", r->client_name, msg);\n\tkrb5_free_error_message(context, msg);\n\tret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n ret = _kdc_db_fetch(context, config, r->server_princ,\n\t\t\tHDB_F_GET_SERVER|HDB_F_GET_KRBTGT | flags,\n\t\t\tNULL, NULL, &r->server);\n if(ret == HDB_ERR_NOT_FOUND_HERE) {\n\tkdc_log(context, config, 5, \"target %s does not have secrets at this KDC, need to proxy\",\n\t\tr->server_name);\n\tgoto out;\n } else if(ret){\n\tconst char *msg = krb5_get_error_message(context, ret);\n\tkdc_log(context, config, 0, \"UNKNOWN -- %s: %s\", r->server_name, msg);\n\tkrb5_free_error_message(context, msg);\n\tret = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN;\n\tgoto out;\n }\n\n /*\n * Select a session enctype from the list of the crypto system\n * supported enctypes that is supported by the client and is one of\n * the enctype of the enctype of the service (likely krbtgt).\n *\n * The latter is used as a hint of what enctypes all KDC support,\n * to make sure a newer version of KDC won't generate a session\n * enctype that an older version of a KDC in the same realm can't\n * decrypt.\n */\n\n ret = _kdc_find_etype(context,\n\t\t\t krb5_principal_is_krbtgt(context, r->server_princ) ?\n\t\t\t config->tgt_use_strongest_session_key :\n\t\t\t config->svc_use_strongest_session_key, FALSE,\n\t\t\t r->client, b->etype.val, b->etype.len, &r->sessionetype,\n\t\t\t NULL);\n if (ret) {\n\tkdc_log(context, config, 0,\n\t\t\"Client (%s) from %s has no common enctypes with KDC \"\n\t\t\"to use for the session key\",\n\t\tr->client_name, from);\n\tgoto out;\n }\n\n /*\n * Pre-auth processing\n */\n\n if(req->padata){\n\tunsigned int n;\n\n\tlog_patypes(context, config, req->padata);\n\n\t/* Check if preauth matching */\n\n\tfor (n = 0; !found_pa && n < sizeof(pat) / sizeof(pat[0]); n++) {\n\t if (pat[n].validate == NULL)\n\t\tcontinue;\n\t if (r->armor_crypto == NULL && (pat[n].flags & PA_REQ_FAST))\n\t\tcontinue;\n\n\t kdc_log(context, config, 5,\n\t\t \"Looking for %s pa-data -- %s\", pat[n].name, r->client_name);\n\t i = 0;\n\t pa = _kdc_find_padata(req, &i, pat[n].type);\n\t if (pa) {\n\t\tret = pat[n].validate(r, pa);\n\t\tif (ret != 0) {\n\t\t goto out;\n\t\t}\n\t\tkdc_log(context, config, 0,\n\t\t\t\"%s pre-authentication succeeded -- %s\",\n\t\t\tpat[n].name, r->client_name);\n\t\tfound_pa = 1;\n\t\tr->et.flags.pre_authent = 1;\n\t }\n\t}\n }\n\n if (found_pa == 0) {\n\tKey *ckey = NULL;\n\tsize_t n;\n\n\tfor (n = 0; n < sizeof(pat) / sizeof(pat[0]); n++) {\n\t if ((pat[n].flags & PA_ANNOUNCE) == 0)\n\t\tcontinue;\n\t ret = krb5_padata_add(context, &error_method,\n\t\t\t\t pat[n].type, NULL, 0);\n\t if (ret)\n\t\tgoto out;\n\t}\n\n\t/*\n\t * If there is a client key, send ETYPE_INFO{,2}\n\t */\n\tret = _kdc_find_etype(context,\n\t\t\t config->preauth_use_strongest_session_key, TRUE,\n\t\t\t r->client, b->etype.val, b->etype.len, NULL, &ckey);\n\tif (ret == 0) {\n\n\t /*\n\t * RFC4120 requires:\n\t * - If the client only knows about old enctypes, then send\n\t * both info replies (we send 'info' first in the list).\n\t * - If the client is 'modern', because it knows about 'new'\n\t * enctype types, then only send the 'info2' reply.\n\t *\n\t * Before we send the full list of etype-info data, we pick\n\t * the client key we would have used anyway below, just pick\n\t * that instead.\n\t */\n\n\t if (older_enctype(ckey->key.keytype)) {\n\t\tret = get_pa_etype_info(context, config,\n\t\t\t\t\t&error_method, ckey);\n\t\tif (ret)\n\t\t goto out;\n\t }\n\t ret = get_pa_etype_info2(context, config,\n\t\t\t\t &error_method, ckey);\n\t if (ret)\n\t\tgoto out;\n\t}\n\n\t/* \n\t * send requre preauth is its required or anon is requested,\n\t * anon is today only allowed via preauth mechanisms.\n\t */\n\tif (require_preauth_p(r) || _kdc_is_anon_request(b)) {\n\t ret = KRB5KDC_ERR_PREAUTH_REQUIRED;\n\t _kdc_set_e_text(r, \"Need to use PA-ENC-TIMESTAMP/PA-PK-AS-REQ\");\n\t goto out;\n\t}\n\n\tif (ckey == NULL) {\n\t ret = KRB5KDC_ERR_CLIENT_NOTYET;\n\t _kdc_set_e_text(r, \"Doesn't have a client key available\");\n\t goto out;\n\t}\n\tkrb5_free_keyblock_contents(r->context, &r->reply_key);\n\tret = krb5_copy_keyblock_contents(r->context, &ckey->key, &r->reply_key);\n\tif (ret)\n\t goto out;\n }\n\n if (r->clientdb->hdb_auth_status) {\n\tr->clientdb->hdb_auth_status(context, r->clientdb, r->client, \n\t\t\t\t HDB_AUTH_SUCCESS);\n }\n\n /*\n * Verify flags after the user been required to prove its identity\n * with in a preauth mech.\n */\n\n ret = _kdc_check_access(context, config, r->client, r->client_name,\n\t\t\t r->server, r->server_name,\n\t\t\t req, &error_method);\n if(ret)\n\tgoto out;\n\n /*\n * Select the best encryption type for the KDC with out regard to\n * the client since the client never needs to read that data.\n */\n\n ret = _kdc_get_preferred_key(context, config,\n\t\t\t\t r->server, r->server_name,\n\t\t\t\t &setype, &skey);\n if(ret)\n\tgoto out;\n\n if(f.renew || f.validate || f.proxy || f.forwarded || f.enc_tkt_in_skey\n || (_kdc_is_anon_request(b) && !config->allow_anonymous)) {\n\tret = KRB5KDC_ERR_BADOPTION;\n\t_kdc_set_e_text(r, \"Bad KDC options\");\n\tgoto out;\n }\n\n /*\n * Build reply\n */\n\n rep.pvno = 5;\n rep.msg_type = krb_as_rep;\n\n if (_kdc_is_anonymous(context, r->client_princ)) {\n\tRealm anon_realm=KRB5_ANON_REALM;\n\tret = copy_Realm(&anon_realm, &rep.crealm);\n } else\n\tret = copy_Realm(&r->client->entry.principal->realm, &rep.crealm);\n if (ret)\n\tgoto out;\n ret = _krb5_principal2principalname(&rep.cname, r->client->entry.principal);\n if (ret)\n\tgoto out;\n\n rep.ticket.tkt_vno = 5;\n ret = copy_Realm(&r->server->entry.principal->realm, &rep.ticket.realm);\n if (ret)\n\tgoto out;\n _krb5_principal2principalname(&rep.ticket.sname,\n\t\t\t\t r->server->entry.principal);\n /* java 1.6 expects the name to be the same type, lets allow that\n * uncomplicated name-types. */\n#define CNT(sp,t) (((sp)->sname->name_type) == KRB5_NT_##t)\n if (CNT(b, UNKNOWN) || CNT(b, PRINCIPAL) || CNT(b, SRV_INST) || CNT(b, SRV_HST) || CNT(b, SRV_XHST))\n\trep.ticket.sname.name_type = b->sname->name_type;\n#undef CNT\n\n r->et.flags.initial = 1;\n if(r->client->entry.flags.forwardable && r->server->entry.flags.forwardable)\n\tr->et.flags.forwardable = f.forwardable;\n else if (f.forwardable) {\n\t_kdc_set_e_text(r, \"Ticket may not be forwardable\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n if(r->client->entry.flags.proxiable && r->server->entry.flags.proxiable)\n\tr->et.flags.proxiable = f.proxiable;\n else if (f.proxiable) {\n\t_kdc_set_e_text(r, \"Ticket may not be proxiable\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n if(r->client->entry.flags.postdate && r->server->entry.flags.postdate)\n\tr->et.flags.may_postdate = f.allow_postdate;\n else if (f.allow_postdate){\n\t_kdc_set_e_text(r, \"Ticket may not be postdate\");\n\tret = KRB5KDC_ERR_POLICY;\n\tgoto out;\n }\n\n /* check for valid set of addresses */\n if(!_kdc_check_addresses(context, config, b->addresses, from_addr)) {\n\t_kdc_set_e_text(r, \"Bad address list in requested\");\n\tret = KRB5KRB_AP_ERR_BADADDR;\n\tgoto out;\n }\n\n ret = copy_PrincipalName(&rep.cname, &r->et.cname);\n if (ret)\n\tgoto out;\n ret = copy_Realm(&rep.crealm, &r->et.crealm);\n if (ret)\n\tgoto out;\n\n {\n\ttime_t start;\n\ttime_t t;\n\t\n\tstart = r->et.authtime = kdc_time;\n\n\tif(f.postdated && req->req_body.from){\n\t ALLOC(r->et.starttime);\n\t start = *r->et.starttime = *req->req_body.from;\n\t r->et.flags.invalid = 1;\n\t r->et.flags.postdated = 1; /* XXX ??? */\n\t}\n\t_kdc_fix_time(&b->till);\n\tt = *b->till;\n\n\t/* be careful not overflowing */\n\n\tif(r->client->entry.max_life)\n\t t = start + min(t - start, *r->client->entry.max_life);\n\tif(r->server->entry.max_life)\n\t t = start + min(t - start, *r->server->entry.max_life);\n#if 0\n\tt = min(t, start + realm->max_life);\n#endif\n\tr->et.endtime = t;\n\tif(f.renewable_ok && r->et.endtime < *b->till){\n\t f.renewable = 1;\n\t if(b->rtime == NULL){\n\t\tALLOC(b->rtime);\n\t\t*b->rtime = 0;\n\t }\n\t if(*b->rtime < *b->till)\n\t\t*b->rtime = *b->till;\n\t}\n\tif(f.renewable && b->rtime){\n\t t = *b->rtime;\n\t if(t == 0)\n\t\tt = MAX_TIME;\n\t if(r->client->entry.max_renew)\n\t\tt = start + min(t - start, *r->client->entry.max_renew);\n\t if(r->server->entry.max_renew)\n\t\tt = start + min(t - start, *r->server->entry.max_renew);\n#if 0\n\t t = min(t, start + realm->max_renew);\n#endif\n\t ALLOC(r->et.renew_till);\n\t *r->et.renew_till = t;\n\t r->et.flags.renewable = 1;\n\t}\n }\n\n if (_kdc_is_anon_request(b))\n\tr->et.flags.anonymous = 1;\n\n if(b->addresses){\n\tALLOC(r->et.caddr);\n\tcopy_HostAddresses(b->addresses, r->et.caddr);\n }\n\n r->et.transited.tr_type = DOMAIN_X500_COMPRESS;\n krb5_data_zero(&r->et.transited.contents);\n\n /* The MIT ASN.1 library (obviously) doesn't tell lengths encoded\n * as 0 and as 0x80 (meaning indefinite length) apart, and is thus\n * incapable of correctly decoding SEQUENCE OF's of zero length.\n *\n * To fix this, always send at least one no-op last_req\n *\n * If there's a pw_end or valid_end we will use that,\n * otherwise just a dummy lr.\n */\n r->ek.last_req.val = malloc(2 * sizeof(*r->ek.last_req.val));\n if (r->ek.last_req.val == NULL) {\n\tret = ENOMEM;\n\tgoto out;\n }\n r->ek.last_req.len = 0;\n if (r->client->entry.pw_end\n\t&& (config->kdc_warn_pwexpire == 0\n\t || kdc_time + config->kdc_warn_pwexpire >= *r->client->entry.pw_end)) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_PW_EXPTIME;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = *r->client->entry.pw_end;\n\t++r->ek.last_req.len;\n }\n if (r->client->entry.valid_end) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_ACCT_EXPTIME;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = *r->client->entry.valid_end;\n\t++r->ek.last_req.len;\n }\n if (r->ek.last_req.len == 0) {\n\tr->ek.last_req.val[r->ek.last_req.len].lr_type = LR_NONE;\n\tr->ek.last_req.val[r->ek.last_req.len].lr_value = 0;\n\t++r->ek.last_req.len;\n }\n r->ek.nonce = b->nonce;\n if (r->client->entry.valid_end || r->client->entry.pw_end) {\n\tALLOC(r->ek.key_expiration);\n\tif (r->client->entry.valid_end) {\n\t if (r->client->entry.pw_end)\n\t\t*r->ek.key_expiration = min(*r->client->entry.valid_end,\n\t\t\t\t\t *r->client->entry.pw_end);\n\t else\n\t\t*r->ek.key_expiration = *r->client->entry.valid_end;\n\t} else\n\t *r->ek.key_expiration = *r->client->entry.pw_end;\n } else\n\tr->ek.key_expiration = NULL;\n r->ek.flags = r->et.flags;\n r->ek.authtime = r->et.authtime;\n if (r->et.starttime) {\n\tALLOC(r->ek.starttime);\n\t*r->ek.starttime = *r->et.starttime;\n }\n r->ek.endtime = r->et.endtime;\n if (r->et.renew_till) {\n\tALLOC(r->ek.renew_till);\n\t*r->ek.renew_till = *r->et.renew_till;\n }\n ret = copy_Realm(&rep.ticket.realm, &r->ek.srealm);\n if (ret)\n\tgoto out;\n ret = copy_PrincipalName(&rep.ticket.sname, &r->ek.sname);\n if (ret)\n\tgoto out;\n if(r->et.caddr){\n\tALLOC(r->ek.caddr);\n\tcopy_HostAddresses(r->et.caddr, r->ek.caddr);\n }\n\n /*\n * Check and session and reply keys\n */\n\n if (r->session_key.keytype == ETYPE_NULL) {\n\tret = krb5_generate_random_keyblock(context, r->sessionetype, &r->session_key);\n\tif (ret)\n\t goto out;\n }\n\n if (r->reply_key.keytype == ETYPE_NULL) {\n\t_kdc_set_e_text(r, \"Client have no reply key\");\n\tret = KRB5KDC_ERR_CLIENT_NOTYET;\n\tgoto out;\n }\n\n ret = copy_EncryptionKey(&r->session_key, &r->et.key);\n if (ret)\n\tgoto out;\n\n ret = copy_EncryptionKey(&r->session_key, &r->ek.key);\n if (ret)\n\tgoto out;\n\n if (r->outpadata.len) {\n\n\tALLOC(rep.padata);\n\tif (rep.padata == NULL) {\n\t ret = ENOMEM;\n\t goto out;\n\t}\n\tret = copy_METHOD_DATA(&r->outpadata, rep.padata);\n\tif (ret)\n\t goto out;\n }\n\n /* Add the PAC */\n if (send_pac_p(context, req)) {\n\tgenerate_pac(r, skey);\n }\n\n _kdc_log_timestamp(context, config, \"AS-REQ\", r->et.authtime, r->et.starttime,\n\t\t r->et.endtime, r->et.renew_till);\n\n /* do this as the last thing since this signs the EncTicketPart */\n ret = _kdc_add_KRB5SignedPath(context,\n\t\t\t\t config,\n\t\t\t\t r->server,\n\t\t\t\t setype,\n\t\t\t\t r->client->entry.principal,\n\t\t\t\t NULL,\n\t\t\t\t NULL,\n\t\t\t\t &r->et);\n if (ret)\n\tgoto out;\n\n log_as_req(context, config, r->reply_key.keytype, setype, b);\n\n /*\n * We always say we support FAST/enc-pa-rep\n */\n\n r->et.flags.enc_pa_rep = r->ek.flags.enc_pa_rep = 1;\n\n /*\n * Add REQ_ENC_PA_REP if client supports it\n */\n\n i = 0;\n pa = _kdc_find_padata(req, &i, KRB5_PADATA_REQ_ENC_PA_REP);\n if (pa) {\n\n\tret = add_enc_pa_rep(r);\n\tif (ret) {\n\t const char *msg = krb5_get_error_message(r->context, ret);\n\t _kdc_r_log(r, 0, \"add_enc_pa_rep failed: %s: %d\", msg, ret);\n\t krb5_free_error_message(r->context, msg);\n\t goto out;\n\t}\n }\n\n /*\n *\n */\n\n ret = _kdc_encode_reply(context, config,\n\t\t\t r->armor_crypto, req->req_body.nonce,\n\t\t\t &rep, &r->et, &r->ek, setype, r->server->entry.kvno,\n\t\t\t &skey->key, r->client->entry.kvno,\n\t\t\t &r->reply_key, 0, &r->e_text, reply);\n if (ret)\n\tgoto out;\n\n /*\n * Check if message too large\n */\n if (datagram_reply && reply->length > config->max_datagram_reply_length) {\n\tkrb5_data_free(reply);\n\tret = KRB5KRB_ERR_RESPONSE_TOO_BIG;\n\t_kdc_set_e_text(r, \"Reply packet too large\");\n }\n\nout:\n free_AS_REP(&rep);\n\n /*\n * In case of a non proxy error, build an error message.\n */\n if (ret != 0 && ret != HDB_ERR_NOT_FOUND_HERE && reply->length == 0) {\n\tret = _kdc_fast_mk_error(context, r,\n\t\t\t\t &error_method,\n\t\t\t\t r->armor_crypto,\n\t\t\t\t &req->req_body,\n\t\t\t\t ret, r->e_text,\n\t\t\t\t r->server_princ,\n\t\t\t\t r->client_princ ?\n &r->client_princ->name : NULL,\n\t\t\t\t r->client_princ ?\n &r->client_princ->realm : NULL,\n\t\t\t\t NULL, NULL,\n\t\t\t\t reply);\n\tif (ret)\n\t goto out2;\n }\nout2:\n free_EncTicketPart(&r->et);\n free_EncKDCRepPart(&r->ek);\n free_KDCFastState(&r->fast);\n\n if (error_method.len)\n\tfree_METHOD_DATA(&error_method);\n if (r->outpadata.len)\n\tfree_METHOD_DATA(&r->outpadata);\n if (r->client_princ) {\n\tkrb5_free_principal(context, r->client_princ);\n\tr->client_princ = NULL;\n }\n if (r->client_name) {\n\tfree(r->client_name);\n\tr->client_name = NULL;\n }\n if (r->server_princ){\n\tkrb5_free_principal(context, r->server_princ);\n\tr->server_princ = NULL;\n }\n if (r->server_name) {\n\tfree(r->server_name);\n\tr->server_name = NULL;\n }\n if (r->client)\n\t_kdc_free_ent(context, r->client);\n if (r->server)\n\t_kdc_free_ent(context, r->server);\n if (r->armor_crypto) {\n\tkrb5_crypto_destroy(r->context, r->armor_crypto);\n\tr->armor_crypto = NULL;\n }\n krb5_free_keyblock_contents(r->context, &r->reply_key);\n krb5_free_keyblock_contents(r->context, &r->session_key);\n return ret;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"_kdc_as_rep","file_name":"kdc/kerberos5.c","commit_link":"github.com/heimdal/heimdal/commit/1a6a6e462dc2ac6111f9e02c6852ddec4849b887","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#19-71943dd4ea37","input":"formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form)\n{\n Buffer save;\n char *p;\n int spos, epos, rows, c_rows, pos, col = 0;\n Line *l;\n\n copyBuffer(&save, buf);\n gotoLine(buf, a->start.line);\n switch (form->type) {\n case FORM_TEXTAREA:\n case FORM_INPUT_TEXT:\n case FORM_INPUT_FILE:\n case FORM_INPUT_PASSWORD:\n case FORM_INPUT_CHECKBOX:\n case FORM_INPUT_RADIO:\n#ifdef MENU_SELECT\n case FORM_SELECT:\n#endif\t\t\t\t/* MENU_SELECT */\n\tspos = a->start.pos;\n\tepos = a->end.pos;\n\tbreak;\n default:\n\tspos = a->start.pos + 1;\n\tepos = a->end.pos - 1;\n }\n switch (form->type) {\n case FORM_INPUT_CHECKBOX:\n case FORM_INPUT_RADIO:\n\tif (buf->currentLine == NULL ||\n\t spos >= buf->currentLine->len || spos < 0)\n\t break;\n\tif (form->checked)\n\t buf->currentLine->lineBuf[spos] = '*';\n\telse\n\t buf->currentLine->lineBuf[spos] = ' ';\n\tbreak;\n case FORM_INPUT_TEXT:\n case FORM_INPUT_FILE:\n case FORM_INPUT_PASSWORD:\n case FORM_TEXTAREA:\n#ifdef MENU_SELECT\n case FORM_SELECT:\n\tif (form->type == FORM_SELECT) {\n\t p = form->label->ptr;\n\t updateSelectOption(form, form->select_option);\n\t}\n\telse\n#endif\t\t\t\t/* MENU_SELECT */\n\t{\n\t if (!form->value)\n\t\tbreak;\n\t p = form->value->ptr;\n\t}\n\tl = buf->currentLine;\n\tif (!l)\n\t break;\n\tif (form->type == FORM_TEXTAREA) {\n\t int n = a->y - buf->currentLine->linenumber;\n\t if (n > 0)\n\t\tfor (; l && n; l = l->prev, n--) ;\n\t else if (n < 0)\n\t\tfor (; l && n; l = l->prev, n++) ;\n\t if (!l)\n\t\tbreak;\n\t}\n\trows = form->rows ? form->rows : 1;\n\tcol = COLPOS(l, a->start.pos);\n\tfor (c_rows = 0; c_rows < rows; c_rows++, l = l->next) {\n\t if (rows > 1) {\n\t\tpos = columnPos(l, col);\n\t\ta = retrieveAnchor(buf->formitem, l->linenumber, pos);\n\t\tif (a == NULL)\n\t\t break;\n\t\tspos = a->start.pos;\n\t\tepos = a->end.pos;\n\t }\n\t if (a->start.line != a->end.line || spos > epos || epos >= l->len ||\n\t\tspos < 0 || epos < 0 || COLPOS(l, epos) < col)\n\t\tbreak;\n\t pos = form_update_line(l, &p, spos, epos, COLPOS(l, epos) - col,\n\t\t\t\t rows > 1,\n\t\t\t\t form->type == FORM_INPUT_PASSWORD);\n\t if (pos != epos) {\n\t\tshiftAnchorPosition(buf->href, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->name, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->img, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->formitem, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t }\n\t}\n\tbreak;\n }\n copyBuffer(buf, &save);\n arrangeLine(buf);\n}","target":"formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form)\n{\n Buffer save;\n char *p;\n int spos, epos, rows, c_rows, pos, col = 0;\n Line *l;\n\n copyBuffer(&save, buf);\n gotoLine(buf, a->start.line);\n switch (form->type) {\n case FORM_TEXTAREA:\n case FORM_INPUT_TEXT:\n case FORM_INPUT_FILE:\n case FORM_INPUT_PASSWORD:\n case FORM_INPUT_CHECKBOX:\n case FORM_INPUT_RADIO:\n#ifdef MENU_SELECT\n case FORM_SELECT:\n#endif\t\t\t\t/* MENU_SELECT */\n\tspos = a->start.pos;\n\tepos = a->end.pos;\n\tbreak;\n default:\n\tspos = a->start.pos + 1;\n\tepos = a->end.pos - 1;\n }\n switch (form->type) {\n case FORM_INPUT_CHECKBOX:\n case FORM_INPUT_RADIO:\n\tif (buf->currentLine == NULL ||\n\t spos >= buf->currentLine->len || spos < 0)\n\t break;\n\tif (form->checked)\n\t buf->currentLine->lineBuf[spos] = '*';\n\telse\n\t buf->currentLine->lineBuf[spos] = ' ';\n\tbreak;\n case FORM_INPUT_TEXT:\n case FORM_INPUT_FILE:\n case FORM_INPUT_PASSWORD:\n case FORM_TEXTAREA:\n#ifdef MENU_SELECT\n case FORM_SELECT:\n\tif (form->type == FORM_SELECT) {\n\t p = form->label->ptr;\n\t updateSelectOption(form, form->select_option);\n\t}\n\telse\n#endif\t\t\t\t/* MENU_SELECT */\n\t{\n\t if (!form->value)\n\t\tbreak;\n\t p = form->value->ptr;\n\t}\n\tl = buf->currentLine;\n\tif (!l)\n\t break;\n\tif (form->type == FORM_TEXTAREA) {\n\t int n = a->y - buf->currentLine->linenumber;\n\t if (n > 0)\n\t\tfor (; l && n; l = l->prev, n--) ;\n\t else if (n < 0)\n\t\tfor (; l && n; l = l->prev, n++) ;\n\t if (!l)\n\t\tbreak;\n\t}\n\trows = form->rows ? form->rows : 1;\n\tcol = COLPOS(l, a->start.pos);\n\tfor (c_rows = 0; c_rows < rows; c_rows++, l = l->next) {\n\t if (l == NULL)\n\t\tbreak;\n\t if (rows > 1) {\n\t\tpos = columnPos(l, col);\n\t\ta = retrieveAnchor(buf->formitem, l->linenumber, pos);\n\t\tif (a == NULL)\n\t\t break;\n\t\tspos = a->start.pos;\n\t\tepos = a->end.pos;\n\t }\n\t if (a->start.line != a->end.line || spos > epos || epos >= l->len ||\n\t\tspos < 0 || epos < 0 || COLPOS(l, epos) < col)\n\t\tbreak;\n\t pos = form_update_line(l, &p, spos, epos, COLPOS(l, epos) - col,\n\t\t\t\t rows > 1,\n\t\t\t\t form->type == FORM_INPUT_PASSWORD);\n\t if (pos != epos) {\n\t\tshiftAnchorPosition(buf->href, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->name, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->img, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t\tshiftAnchorPosition(buf->formitem, buf->hmarklist,\n\t\t\t\t a->start.line, spos, pos - epos);\n\t }\n\t}\n\tbreak;\n }\n copyBuffer(buf, &save);\n arrangeLine(buf);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"formUpdateBuffer","file_name":"form.c","commit_link":"github.com/tats/w3m/commit/7fdc83b0364005a0b5ed869230dd81752ba022e8","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#20-5706f1417726","input":"lexer_process_char_literal (parser_context_t *context_p, /**< context */\n const uint8_t *char_p, /**< characters */\n size_t length, /**< length of string */\n uint8_t literal_type, /**< final literal type */\n bool has_escape) /**< has escape sequences */\n{\n parser_list_iterator_t literal_iterator;\n lexer_literal_t *literal_p;\n uint32_t literal_index = 0;\n\n JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL\n || literal_type == LEXER_STRING_LITERAL);\n\n JERRY_ASSERT (literal_type != LEXER_IDENT_LITERAL || length <= PARSER_MAXIMUM_IDENT_LENGTH);\n JERRY_ASSERT (literal_type != LEXER_STRING_LITERAL || length <= PARSER_MAXIMUM_STRING_LENGTH);\n\n parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n {\n if (literal_p->type == literal_type\n && literal_p->prop.length == length\n && memcmp (literal_p->u.char_p, char_p, length) == 0)\n {\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n literal_p->status_flags = (uint8_t) (literal_p->status_flags & ~LEXER_FLAG_UNUSED_IDENT);\n return;\n }\n\n literal_index++;\n }\n\n JERRY_ASSERT (literal_index == context_p->literal_count);\n\n if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n {\n parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n }\n\n literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n literal_p->prop.length = (uint16_t) length;\n literal_p->type = literal_type;\n literal_p->status_flags = has_escape ? 0 : LEXER_FLAG_SOURCE_PTR;\n\n if (has_escape)\n {\n literal_p->u.char_p = (uint8_t *) jmem_heap_alloc_block (length);\n memcpy ((uint8_t *) literal_p->u.char_p, char_p, length);\n }\n else\n {\n literal_p->u.char_p = char_p;\n }\n\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n context_p->literal_count++;\n} /* lexer_process_char_literal */","target":"lexer_process_char_literal (parser_context_t *context_p, /**< context */\n const uint8_t *char_p, /**< characters */\n size_t length, /**< length of string */\n uint8_t literal_type, /**< final literal type */\n bool has_escape) /**< has escape sequences */\n{\n parser_list_iterator_t literal_iterator;\n lexer_literal_t *literal_p;\n uint32_t literal_index = 0;\n\n JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL\n || literal_type == LEXER_STRING_LITERAL);\n\n JERRY_ASSERT (literal_type != LEXER_IDENT_LITERAL || length <= PARSER_MAXIMUM_IDENT_LENGTH);\n JERRY_ASSERT (literal_type != LEXER_STRING_LITERAL || length <= PARSER_MAXIMUM_STRING_LENGTH);\n\n parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n {\n if (literal_p->type == literal_type\n && literal_p->prop.length == length\n && memcmp (literal_p->u.char_p, char_p, length) == 0)\n {\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n literal_p->status_flags = (uint8_t) (literal_p->status_flags & ~LEXER_FLAG_UNUSED_IDENT);\n return;\n }\n\n literal_index++;\n }\n\n JERRY_ASSERT (literal_index == context_p->literal_count);\n\n if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n {\n parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n }\n\n if (length == 0)\n {\n has_escape = false;\n }\n\n literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n literal_p->prop.length = (uint16_t) length;\n literal_p->type = literal_type;\n literal_p->status_flags = has_escape ? 0 : LEXER_FLAG_SOURCE_PTR;\n\n if (has_escape)\n {\n literal_p->u.char_p = (uint8_t *) jmem_heap_alloc_block (length);\n memcpy ((uint8_t *) literal_p->u.char_p, char_p, length);\n }\n else\n {\n literal_p->u.char_p = char_p;\n }\n\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n context_p->literal_count++;\n} /* lexer_process_char_literal */","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"lexer_process_char_literal","file_name":"jerry-core/parser/js/js-lexer.c","commit_link":"github.com/zherczeg/jerryscript/commit/03a8c630f015f63268639d3ed3bf82cff6fa77d8","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#21-acf22b5978a8","input":"static int unimac_mdio_probe(struct platform_device *pdev)\n{\n\tstruct unimac_mdio_pdata *pdata = pdev->dev.platform_data;\n\tstruct unimac_mdio_priv *priv;\n\tstruct device_node *np;\n\tstruct mii_bus *bus;\n\tstruct resource *r;\n\tint ret;\n\n\tnp = pdev->dev.of_node;\n\n\tpriv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);\n\tif (!priv)\n\t\treturn -ENOMEM;\n\n\tr = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n\n\t/* Just ioremap, as this MDIO block is usually integrated into an\n\t * Ethernet MAC controller register range\n\t */\n\tpriv->base = devm_ioremap(&pdev->dev, r->start, resource_size(r));\n\tif (!priv->base) {\n\t\tdev_err(&pdev->dev, \"failed to remap register\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tpriv->mii_bus = mdiobus_alloc();\n\tif (!priv->mii_bus)\n\t\treturn -ENOMEM;\n\n\tbus = priv->mii_bus;\n\tbus->priv = priv;\n\tif (pdata) {\n\t\tbus->name = pdata->bus_name;\n\t\tpriv->wait_func = pdata->wait_func;\n\t\tpriv->wait_func_data = pdata->wait_func_data;\n\t\tbus->phy_mask = ~pdata->phy_mask;\n\t} else {\n\t\tbus->name = \"unimac MII bus\";\n\t\tpriv->wait_func_data = priv;\n\t\tpriv->wait_func = unimac_mdio_poll;\n\t}\n\tbus->parent = &pdev->dev;\n\tbus->read = unimac_mdio_read;\n\tbus->write = unimac_mdio_write;\n\tbus->reset = unimac_mdio_reset;\n\tsnprintf(bus->id, MII_BUS_ID_SIZE, \"%s-%d\", pdev->name, pdev->id);\n\n\tret = of_mdiobus_register(bus, np);\n\tif (ret) {\n\t\tdev_err(&pdev->dev, \"MDIO bus registration failed\\n\");\n\t\tgoto out_mdio_free;\n\t}\n\n\tplatform_set_drvdata(pdev, priv);\n\n\tdev_info(&pdev->dev, \"Broadcom UniMAC MDIO bus at 0x%p\\n\", priv->base);\n\n\treturn 0;\n\nout_mdio_free:\n\tmdiobus_free(bus);\n\treturn ret;\n}","target":"static int unimac_mdio_probe(struct platform_device *pdev)\n{\n\tstruct unimac_mdio_pdata *pdata = pdev->dev.platform_data;\n\tstruct unimac_mdio_priv *priv;\n\tstruct device_node *np;\n\tstruct mii_bus *bus;\n\tstruct resource *r;\n\tint ret;\n\n\tnp = pdev->dev.of_node;\n\n\tpriv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);\n\tif (!priv)\n\t\treturn -ENOMEM;\n\n\tr = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n\tif (!r)\n\t\treturn -EINVAL;\n\n\t/* Just ioremap, as this MDIO block is usually integrated into an\n\t * Ethernet MAC controller register range\n\t */\n\tpriv->base = devm_ioremap(&pdev->dev, r->start, resource_size(r));\n\tif (!priv->base) {\n\t\tdev_err(&pdev->dev, \"failed to remap register\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tpriv->mii_bus = mdiobus_alloc();\n\tif (!priv->mii_bus)\n\t\treturn -ENOMEM;\n\n\tbus = priv->mii_bus;\n\tbus->priv = priv;\n\tif (pdata) {\n\t\tbus->name = pdata->bus_name;\n\t\tpriv->wait_func = pdata->wait_func;\n\t\tpriv->wait_func_data = pdata->wait_func_data;\n\t\tbus->phy_mask = ~pdata->phy_mask;\n\t} else {\n\t\tbus->name = \"unimac MII bus\";\n\t\tpriv->wait_func_data = priv;\n\t\tpriv->wait_func = unimac_mdio_poll;\n\t}\n\tbus->parent = &pdev->dev;\n\tbus->read = unimac_mdio_read;\n\tbus->write = unimac_mdio_write;\n\tbus->reset = unimac_mdio_reset;\n\tsnprintf(bus->id, MII_BUS_ID_SIZE, \"%s-%d\", pdev->name, pdev->id);\n\n\tret = of_mdiobus_register(bus, np);\n\tif (ret) {\n\t\tdev_err(&pdev->dev, \"MDIO bus registration failed\\n\");\n\t\tgoto out_mdio_free;\n\t}\n\n\tplatform_set_drvdata(pdev, priv);\n\n\tdev_info(&pdev->dev, \"Broadcom UniMAC MDIO bus at 0x%p\\n\", priv->base);\n\n\treturn 0;\n\nout_mdio_free:\n\tmdiobus_free(bus);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"unimac_mdio_probe","file_name":"drivers/net/phy/mdio-bcm-unimac.c","commit_link":"github.com/torvalds/linux/commit/297a6961ffb8ff4dc66c9fbf53b924bd1dda05d5","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#22-65f43e486823","input":"static int hi3660_stub_clk_probe(struct platform_device *pdev)\n{\n\tstruct device *dev = &pdev->dev;\n\tstruct resource *res;\n\tunsigned int i;\n\tint ret;\n\n\t/* Use mailbox client without blocking */\n\tstub_clk_chan.cl.dev = dev;\n\tstub_clk_chan.cl.tx_done = NULL;\n\tstub_clk_chan.cl.tx_block = false;\n\tstub_clk_chan.cl.knows_txdone = false;\n\n\t/* Allocate mailbox channel */\n\tstub_clk_chan.mbox = mbox_request_channel(&stub_clk_chan.cl, 0);\n\tif (IS_ERR(stub_clk_chan.mbox))\n\t\treturn PTR_ERR(stub_clk_chan.mbox);\n\n\tres = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n\tfreq_reg = devm_ioremap(dev, res->start, resource_size(res));\n\tif (!freq_reg)\n\t\treturn -ENOMEM;\n\n\tfreq_reg += HI3660_STUB_CLOCK_DATA;\n\n\tfor (i = 0; i < HI3660_CLK_STUB_NUM; i++) {\n\t\tret = devm_clk_hw_register(&pdev->dev, &hi3660_stub_clks[i].hw);\n\t\tif (ret)\n\t\t\treturn ret;\n\t}\n\n\treturn devm_of_clk_add_hw_provider(&pdev->dev, hi3660_stub_clk_hw_get,\n\t\t\t\t\t hi3660_stub_clks);\n}","target":"static int hi3660_stub_clk_probe(struct platform_device *pdev)\n{\n\tstruct device *dev = &pdev->dev;\n\tstruct resource *res;\n\tunsigned int i;\n\tint ret;\n\n\t/* Use mailbox client without blocking */\n\tstub_clk_chan.cl.dev = dev;\n\tstub_clk_chan.cl.tx_done = NULL;\n\tstub_clk_chan.cl.tx_block = false;\n\tstub_clk_chan.cl.knows_txdone = false;\n\n\t/* Allocate mailbox channel */\n\tstub_clk_chan.mbox = mbox_request_channel(&stub_clk_chan.cl, 0);\n\tif (IS_ERR(stub_clk_chan.mbox))\n\t\treturn PTR_ERR(stub_clk_chan.mbox);\n\n\tres = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n\tif (!res)\n\t\treturn -EINVAL;\n\tfreq_reg = devm_ioremap(dev, res->start, resource_size(res));\n\tif (!freq_reg)\n\t\treturn -ENOMEM;\n\n\tfreq_reg += HI3660_STUB_CLOCK_DATA;\n\n\tfor (i = 0; i < HI3660_CLK_STUB_NUM; i++) {\n\t\tret = devm_clk_hw_register(&pdev->dev, &hi3660_stub_clks[i].hw);\n\t\tif (ret)\n\t\t\treturn ret;\n\t}\n\n\treturn devm_of_clk_add_hw_provider(&pdev->dev, hi3660_stub_clk_hw_get,\n\t\t\t\t\t hi3660_stub_clks);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"hi3660_stub_clk_probe","file_name":"drivers/clk/hisilicon/clk-hi3660-stub.c","commit_link":"github.com/torvalds/linux/commit/9903e41ae1f5d50c93f268ca3304d4d7c64b9311","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#23-e3c7f746ba2b","input":"static bool assoc_array_insert_into_terminal_node(struct assoc_array_edit *edit,\n\t\t\t\t\t\t const struct assoc_array_ops *ops,\n\t\t\t\t\t\t const void *index_key,\n\t\t\t\t\t\t struct assoc_array_walk_result *result)\n{\n\tstruct assoc_array_shortcut *shortcut, *new_s0;\n\tstruct assoc_array_node *node, *new_n0, *new_n1, *side;\n\tstruct assoc_array_ptr *ptr;\n\tunsigned long dissimilarity, base_seg, blank;\n\tsize_t keylen;\n\tbool have_meta;\n\tint level, diff;\n\tint slot, next_slot, free_slot, i, j;\n\n\tnode\t= result->terminal_node.node;\n\tlevel\t= result->terminal_node.level;\n\tedit->segment_cache[ASSOC_ARRAY_FAN_OUT] = result->terminal_node.slot;\n\n\tpr_devel(\"-->%s()\\n\", __func__);\n\n\t/* We arrived at a node which doesn't have an onward node or shortcut\n\t * pointer that we have to follow. This means that (a) the leaf we\n\t * want must go here (either by insertion or replacement) or (b) we\n\t * need to split this node and insert in one of the fragments.\n\t */\n\tfree_slot = -1;\n\n\t/* Firstly, we have to check the leaves in this node to see if there's\n\t * a matching one we should replace in place.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tif (!ptr) {\n\t\t\tfree_slot = i;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ops->compare_object(assoc_array_ptr_to_leaf(ptr), index_key)) {\n\t\t\tpr_devel(\"replace in slot %d\\n\", i);\n\t\t\tedit->leaf_p = &node->slots[i];\n\t\t\tedit->dead_leaf = node->slots[i];\n\t\t\tpr_devel(\"<--%s() = ok [replace]\\n\", __func__);\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t/* If there is a free slot in this node then we can just insert the\n\t * leaf here.\n\t */\n\tif (free_slot >= 0) {\n\t\tpr_devel(\"insert in free slot %d\\n\", free_slot);\n\t\tedit->leaf_p = &node->slots[free_slot];\n\t\tedit->adjust_count_on = node;\n\t\tpr_devel(\"<--%s() = ok [insert]\\n\", __func__);\n\t\treturn true;\n\t}\n\n\t/* The node has no spare slots - so we're either going to have to split\n\t * it or insert another node before it.\n\t *\n\t * Whatever, we're going to need at least two new nodes - so allocate\n\t * those now. We may also need a new shortcut, but we deal with that\n\t * when we need it.\n\t */\n\tnew_n0 = kzalloc(sizeof(struct assoc_array_node), GFP_KERNEL);\n\tif (!new_n0)\n\t\treturn false;\n\tedit->new_meta[0] = assoc_array_node_to_ptr(new_n0);\n\tnew_n1 = kzalloc(sizeof(struct assoc_array_node), GFP_KERNEL);\n\tif (!new_n1)\n\t\treturn false;\n\tedit->new_meta[1] = assoc_array_node_to_ptr(new_n1);\n\n\t/* We need to find out how similar the leaves are. */\n\tpr_devel(\"no spare slots\\n\");\n\thave_meta = false;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tif (assoc_array_ptr_is_meta(ptr)) {\n\t\t\tedit->segment_cache[i] = 0xff;\n\t\t\thave_meta = true;\n\t\t\tcontinue;\n\t\t}\n\t\tbase_seg = ops->get_object_key_chunk(\n\t\t\tassoc_array_ptr_to_leaf(ptr), level);\n\t\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\t\tedit->segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\t}\n\n\tif (have_meta) {\n\t\tpr_devel(\"have meta\\n\");\n\t\tgoto split_node;\n\t}\n\n\t/* The node contains only leaves */\n\tdissimilarity = 0;\n\tbase_seg = edit->segment_cache[0];\n\tfor (i = 1; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tdissimilarity |= edit->segment_cache[i] ^ base_seg;\n\n\tpr_devel(\"only leaves; dissimilarity=%lx\\n\", dissimilarity);\n\n\tif ((dissimilarity & ASSOC_ARRAY_FAN_MASK) == 0) {\n\t\t/* The old leaves all cluster in the same slot. We will need\n\t\t * to insert a shortcut if the new node wants to cluster with them.\n\t\t */\n\t\tif ((edit->segment_cache[ASSOC_ARRAY_FAN_OUT] ^ base_seg) == 0)\n\t\t\tgoto all_leaves_cluster_together;\n\n\t\t/* Otherwise we can just insert a new node ahead of the old\n\t\t * one.\n\t\t */\n\t\tgoto present_leaves_cluster_but_not_new_leaf;\n\t}\n\nsplit_node:\n\tpr_devel(\"split node\\n\");\n\n\t/* We need to split the current node; we know that the node doesn't\n\t * simply contain a full set of leaves that cluster together (it\n\t * contains meta pointers and/or non-clustering leaves).\n\t *\n\t * We need to expel at least two leaves out of a set consisting of the\n\t * leaves in the node and the new leaf.\n\t *\n\t * We need a new node (n0) to replace the current one and a new node to\n\t * take the expelled nodes (n1).\n\t */\n\tedit->set[0].to = assoc_array_node_to_ptr(new_n0);\n\tnew_n0->back_pointer = node->back_pointer;\n\tnew_n0->parent_slot = node->parent_slot;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = -1; /* Need to calculate this */\n\ndo_split_node:\n\tpr_devel(\"do_split_node\\n\");\n\n\tnew_n0->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tnew_n1->nr_leaves_on_branch = 0;\n\n\t/* Begin by finding two matching leaves. There have to be at least two\n\t * that match - even if there are meta pointers - because any leaf that\n\t * would match a slot with a meta pointer in it must be somewhere\n\t * behind that meta pointer and cannot be here. Further, given N\n\t * remaining leaf slots, we now have N+1 leaves to go in them.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tslot = edit->segment_cache[i];\n\t\tif (slot != 0xff)\n\t\t\tfor (j = i + 1; j < ASSOC_ARRAY_FAN_OUT + 1; j++)\n\t\t\t\tif (edit->segment_cache[j] == slot)\n\t\t\t\t\tgoto found_slot_for_multiple_occupancy;\n\t}\nfound_slot_for_multiple_occupancy:\n\tpr_devel(\"same slot: %x %x [%02x]\\n\", i, j, slot);\n\tBUG_ON(i >= ASSOC_ARRAY_FAN_OUT);\n\tBUG_ON(j >= ASSOC_ARRAY_FAN_OUT + 1);\n\tBUG_ON(slot >= ASSOC_ARRAY_FAN_OUT);\n\n\tnew_n1->parent_slot = slot;\n\n\t/* Metadata pointers cannot change slot */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tif (assoc_array_ptr_is_meta(node->slots[i]))\n\t\t\tnew_n0->slots[i] = node->slots[i];\n\t\telse\n\t\t\tnew_n0->slots[i] = NULL;\n\tBUG_ON(new_n0->slots[slot] != NULL);\n\tnew_n0->slots[slot] = assoc_array_node_to_ptr(new_n1);\n\n\t/* Filter the leaf pointers between the new nodes */\n\tfree_slot = -1;\n\tnext_slot = 0;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tif (assoc_array_ptr_is_meta(node->slots[i]))\n\t\t\tcontinue;\n\t\tif (edit->segment_cache[i] == slot) {\n\t\t\tnew_n1->slots[next_slot++] = node->slots[i];\n\t\t\tnew_n1->nr_leaves_on_branch++;\n\t\t} else {\n\t\t\tdo {\n\t\t\t\tfree_slot++;\n\t\t\t} while (new_n0->slots[free_slot] != NULL);\n\t\t\tnew_n0->slots[free_slot] = node->slots[i];\n\t\t}\n\t}\n\n\tpr_devel(\"filtered: f=%x n=%x\\n\", free_slot, next_slot);\n\n\tif (edit->segment_cache[ASSOC_ARRAY_FAN_OUT] != slot) {\n\t\tdo {\n\t\t\tfree_slot++;\n\t\t} while (new_n0->slots[free_slot] != NULL);\n\t\tedit->leaf_p = &new_n0->slots[free_slot];\n\t\tedit->adjust_count_on = new_n0;\n\t} else {\n\t\tedit->leaf_p = &new_n1->slots[next_slot++];\n\t\tedit->adjust_count_on = new_n1;\n\t}\n\n\tBUG_ON(next_slot <= 1);\n\n\tedit->set_backpointers_to = assoc_array_node_to_ptr(new_n0);\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tif (edit->segment_cache[i] == 0xff) {\n\t\t\tptr = node->slots[i];\n\t\t\tBUG_ON(assoc_array_ptr_is_leaf(ptr));\n\t\t\tif (assoc_array_ptr_is_node(ptr)) {\n\t\t\t\tside = assoc_array_ptr_to_node(ptr);\n\t\t\t\tedit->set_backpointers[i] = &side->back_pointer;\n\t\t\t} else {\n\t\t\t\tshortcut = assoc_array_ptr_to_shortcut(ptr);\n\t\t\t\tedit->set_backpointers[i] = &shortcut->back_pointer;\n\t\t\t}\n\t\t}\n\t}\n\n\tptr = node->back_pointer;\n\tif (!ptr)\n\t\tedit->set[0].ptr = &edit->array->root;\n\telse if (assoc_array_ptr_is_node(ptr))\n\t\tedit->set[0].ptr = &assoc_array_ptr_to_node(ptr)->slots[node->parent_slot];\n\telse\n\t\tedit->set[0].ptr = &assoc_array_ptr_to_shortcut(ptr)->next_node;\n\tedit->excised_meta[0] = assoc_array_node_to_ptr(node);\n\tpr_devel(\"<--%s() = ok [split node]\\n\", __func__);\n\treturn true;\n\npresent_leaves_cluster_but_not_new_leaf:\n\t/* All the old leaves cluster in the same slot, but the new leaf wants\n\t * to go into a different slot, so we create a new node to hold the new\n\t * leaf and a pointer to a new node holding all the old leaves.\n\t */\n\tpr_devel(\"present leaves cluster but not new leaf\\n\");\n\n\tnew_n0->back_pointer = node->back_pointer;\n\tnew_n0->parent_slot = node->parent_slot;\n\tnew_n0->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = edit->segment_cache[0];\n\tnew_n1->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tedit->adjust_count_on = new_n0;\n\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tnew_n1->slots[i] = node->slots[i];\n\n\tnew_n0->slots[edit->segment_cache[0]] = assoc_array_node_to_ptr(new_n0);\n\tedit->leaf_p = &new_n0->slots[edit->segment_cache[ASSOC_ARRAY_FAN_OUT]];\n\n\tedit->set[0].ptr = &assoc_array_ptr_to_node(node->back_pointer)->slots[node->parent_slot];\n\tedit->set[0].to = assoc_array_node_to_ptr(new_n0);\n\tedit->excised_meta[0] = assoc_array_node_to_ptr(node);\n\tpr_devel(\"<--%s() = ok [insert node before]\\n\", __func__);\n\treturn true;\n\nall_leaves_cluster_together:\n\t/* All the leaves, new and old, want to cluster together in this node\n\t * in the same slot, so we have to replace this node with a shortcut to\n\t * skip over the identical parts of the key and then place a pair of\n\t * nodes, one inside the other, at the end of the shortcut and\n\t * distribute the keys between them.\n\t *\n\t * Firstly we need to work out where the leaves start diverging as a\n\t * bit position into their keys so that we know how big the shortcut\n\t * needs to be.\n\t *\n\t * We only need to make a single pass of N of the N+1 leaves because if\n\t * any keys differ between themselves at bit X then at least one of\n\t * them must also differ with the base key at bit X or before.\n\t */\n\tpr_devel(\"all leaves cluster together\\n\");\n\tdiff = INT_MAX;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tint x = ops->diff_objects(assoc_array_ptr_to_leaf(node->slots[i]),\n\t\t\t\t\t index_key);\n\t\tif (x < diff) {\n\t\t\tBUG_ON(x < 0);\n\t\t\tdiff = x;\n\t\t}\n\t}\n\tBUG_ON(diff == INT_MAX);\n\tBUG_ON(diff < level + ASSOC_ARRAY_LEVEL_STEP);\n\n\tkeylen = round_up(diff, ASSOC_ARRAY_KEY_CHUNK_SIZE);\n\tkeylen >>= ASSOC_ARRAY_KEY_CHUNK_SHIFT;\n\n\tnew_s0 = kzalloc(sizeof(struct assoc_array_shortcut) +\n\t\t\t keylen * sizeof(unsigned long), GFP_KERNEL);\n\tif (!new_s0)\n\t\treturn false;\n\tedit->new_meta[2] = assoc_array_shortcut_to_ptr(new_s0);\n\n\tedit->set[0].to = assoc_array_shortcut_to_ptr(new_s0);\n\tnew_s0->back_pointer = node->back_pointer;\n\tnew_s0->parent_slot = node->parent_slot;\n\tnew_s0->next_node = assoc_array_node_to_ptr(new_n0);\n\tnew_n0->back_pointer = assoc_array_shortcut_to_ptr(new_s0);\n\tnew_n0->parent_slot = 0;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = -1; /* Need to calculate this */\n\n\tnew_s0->skip_to_level = level = diff & ~ASSOC_ARRAY_LEVEL_STEP_MASK;\n\tpr_devel(\"skip_to_level = %d [diff %d]\\n\", level, diff);\n\tBUG_ON(level <= 0);\n\n\tfor (i = 0; i < keylen; i++)\n\t\tnew_s0->index_key[i] =\n\t\t\tops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE);\n\n\tblank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK);\n\tpr_devel(\"blank off [%zu] %d: %lx\\n\", keylen - 1, level, blank);\n\tnew_s0->index_key[keylen - 1] &= ~blank;\n\n\t/* This now reduces to a node splitting exercise for which we'll need\n\t * to regenerate the disparity table.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tbase_seg = ops->get_object_key_chunk(assoc_array_ptr_to_leaf(ptr),\n\t\t\t\t\t\t level);\n\t\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\t\tedit->segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\t}\n\n\tbase_seg = ops->get_key_chunk(index_key, level);\n\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\tedit->segment_cache[ASSOC_ARRAY_FAN_OUT] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\tgoto do_split_node;\n}","target":"static bool assoc_array_insert_into_terminal_node(struct assoc_array_edit *edit,\n\t\t\t\t\t\t const struct assoc_array_ops *ops,\n\t\t\t\t\t\t const void *index_key,\n\t\t\t\t\t\t struct assoc_array_walk_result *result)\n{\n\tstruct assoc_array_shortcut *shortcut, *new_s0;\n\tstruct assoc_array_node *node, *new_n0, *new_n1, *side;\n\tstruct assoc_array_ptr *ptr;\n\tunsigned long dissimilarity, base_seg, blank;\n\tsize_t keylen;\n\tbool have_meta;\n\tint level, diff;\n\tint slot, next_slot, free_slot, i, j;\n\n\tnode\t= result->terminal_node.node;\n\tlevel\t= result->terminal_node.level;\n\tedit->segment_cache[ASSOC_ARRAY_FAN_OUT] = result->terminal_node.slot;\n\n\tpr_devel(\"-->%s()\\n\", __func__);\n\n\t/* We arrived at a node which doesn't have an onward node or shortcut\n\t * pointer that we have to follow. This means that (a) the leaf we\n\t * want must go here (either by insertion or replacement) or (b) we\n\t * need to split this node and insert in one of the fragments.\n\t */\n\tfree_slot = -1;\n\n\t/* Firstly, we have to check the leaves in this node to see if there's\n\t * a matching one we should replace in place.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tif (!ptr) {\n\t\t\tfree_slot = i;\n\t\t\tcontinue;\n\t\t}\n\t\tif (assoc_array_ptr_is_leaf(ptr) &&\n\t\t ops->compare_object(assoc_array_ptr_to_leaf(ptr),\n\t\t\t\t\tindex_key)) {\n\t\t\tpr_devel(\"replace in slot %d\\n\", i);\n\t\t\tedit->leaf_p = &node->slots[i];\n\t\t\tedit->dead_leaf = node->slots[i];\n\t\t\tpr_devel(\"<--%s() = ok [replace]\\n\", __func__);\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t/* If there is a free slot in this node then we can just insert the\n\t * leaf here.\n\t */\n\tif (free_slot >= 0) {\n\t\tpr_devel(\"insert in free slot %d\\n\", free_slot);\n\t\tedit->leaf_p = &node->slots[free_slot];\n\t\tedit->adjust_count_on = node;\n\t\tpr_devel(\"<--%s() = ok [insert]\\n\", __func__);\n\t\treturn true;\n\t}\n\n\t/* The node has no spare slots - so we're either going to have to split\n\t * it or insert another node before it.\n\t *\n\t * Whatever, we're going to need at least two new nodes - so allocate\n\t * those now. We may also need a new shortcut, but we deal with that\n\t * when we need it.\n\t */\n\tnew_n0 = kzalloc(sizeof(struct assoc_array_node), GFP_KERNEL);\n\tif (!new_n0)\n\t\treturn false;\n\tedit->new_meta[0] = assoc_array_node_to_ptr(new_n0);\n\tnew_n1 = kzalloc(sizeof(struct assoc_array_node), GFP_KERNEL);\n\tif (!new_n1)\n\t\treturn false;\n\tedit->new_meta[1] = assoc_array_node_to_ptr(new_n1);\n\n\t/* We need to find out how similar the leaves are. */\n\tpr_devel(\"no spare slots\\n\");\n\thave_meta = false;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tif (assoc_array_ptr_is_meta(ptr)) {\n\t\t\tedit->segment_cache[i] = 0xff;\n\t\t\thave_meta = true;\n\t\t\tcontinue;\n\t\t}\n\t\tbase_seg = ops->get_object_key_chunk(\n\t\t\tassoc_array_ptr_to_leaf(ptr), level);\n\t\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\t\tedit->segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\t}\n\n\tif (have_meta) {\n\t\tpr_devel(\"have meta\\n\");\n\t\tgoto split_node;\n\t}\n\n\t/* The node contains only leaves */\n\tdissimilarity = 0;\n\tbase_seg = edit->segment_cache[0];\n\tfor (i = 1; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tdissimilarity |= edit->segment_cache[i] ^ base_seg;\n\n\tpr_devel(\"only leaves; dissimilarity=%lx\\n\", dissimilarity);\n\n\tif ((dissimilarity & ASSOC_ARRAY_FAN_MASK) == 0) {\n\t\t/* The old leaves all cluster in the same slot. We will need\n\t\t * to insert a shortcut if the new node wants to cluster with them.\n\t\t */\n\t\tif ((edit->segment_cache[ASSOC_ARRAY_FAN_OUT] ^ base_seg) == 0)\n\t\t\tgoto all_leaves_cluster_together;\n\n\t\t/* Otherwise we can just insert a new node ahead of the old\n\t\t * one.\n\t\t */\n\t\tgoto present_leaves_cluster_but_not_new_leaf;\n\t}\n\nsplit_node:\n\tpr_devel(\"split node\\n\");\n\n\t/* We need to split the current node; we know that the node doesn't\n\t * simply contain a full set of leaves that cluster together (it\n\t * contains meta pointers and/or non-clustering leaves).\n\t *\n\t * We need to expel at least two leaves out of a set consisting of the\n\t * leaves in the node and the new leaf.\n\t *\n\t * We need a new node (n0) to replace the current one and a new node to\n\t * take the expelled nodes (n1).\n\t */\n\tedit->set[0].to = assoc_array_node_to_ptr(new_n0);\n\tnew_n0->back_pointer = node->back_pointer;\n\tnew_n0->parent_slot = node->parent_slot;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = -1; /* Need to calculate this */\n\ndo_split_node:\n\tpr_devel(\"do_split_node\\n\");\n\n\tnew_n0->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tnew_n1->nr_leaves_on_branch = 0;\n\n\t/* Begin by finding two matching leaves. There have to be at least two\n\t * that match - even if there are meta pointers - because any leaf that\n\t * would match a slot with a meta pointer in it must be somewhere\n\t * behind that meta pointer and cannot be here. Further, given N\n\t * remaining leaf slots, we now have N+1 leaves to go in them.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tslot = edit->segment_cache[i];\n\t\tif (slot != 0xff)\n\t\t\tfor (j = i + 1; j < ASSOC_ARRAY_FAN_OUT + 1; j++)\n\t\t\t\tif (edit->segment_cache[j] == slot)\n\t\t\t\t\tgoto found_slot_for_multiple_occupancy;\n\t}\nfound_slot_for_multiple_occupancy:\n\tpr_devel(\"same slot: %x %x [%02x]\\n\", i, j, slot);\n\tBUG_ON(i >= ASSOC_ARRAY_FAN_OUT);\n\tBUG_ON(j >= ASSOC_ARRAY_FAN_OUT + 1);\n\tBUG_ON(slot >= ASSOC_ARRAY_FAN_OUT);\n\n\tnew_n1->parent_slot = slot;\n\n\t/* Metadata pointers cannot change slot */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tif (assoc_array_ptr_is_meta(node->slots[i]))\n\t\t\tnew_n0->slots[i] = node->slots[i];\n\t\telse\n\t\t\tnew_n0->slots[i] = NULL;\n\tBUG_ON(new_n0->slots[slot] != NULL);\n\tnew_n0->slots[slot] = assoc_array_node_to_ptr(new_n1);\n\n\t/* Filter the leaf pointers between the new nodes */\n\tfree_slot = -1;\n\tnext_slot = 0;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tif (assoc_array_ptr_is_meta(node->slots[i]))\n\t\t\tcontinue;\n\t\tif (edit->segment_cache[i] == slot) {\n\t\t\tnew_n1->slots[next_slot++] = node->slots[i];\n\t\t\tnew_n1->nr_leaves_on_branch++;\n\t\t} else {\n\t\t\tdo {\n\t\t\t\tfree_slot++;\n\t\t\t} while (new_n0->slots[free_slot] != NULL);\n\t\t\tnew_n0->slots[free_slot] = node->slots[i];\n\t\t}\n\t}\n\n\tpr_devel(\"filtered: f=%x n=%x\\n\", free_slot, next_slot);\n\n\tif (edit->segment_cache[ASSOC_ARRAY_FAN_OUT] != slot) {\n\t\tdo {\n\t\t\tfree_slot++;\n\t\t} while (new_n0->slots[free_slot] != NULL);\n\t\tedit->leaf_p = &new_n0->slots[free_slot];\n\t\tedit->adjust_count_on = new_n0;\n\t} else {\n\t\tedit->leaf_p = &new_n1->slots[next_slot++];\n\t\tedit->adjust_count_on = new_n1;\n\t}\n\n\tBUG_ON(next_slot <= 1);\n\n\tedit->set_backpointers_to = assoc_array_node_to_ptr(new_n0);\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tif (edit->segment_cache[i] == 0xff) {\n\t\t\tptr = node->slots[i];\n\t\t\tBUG_ON(assoc_array_ptr_is_leaf(ptr));\n\t\t\tif (assoc_array_ptr_is_node(ptr)) {\n\t\t\t\tside = assoc_array_ptr_to_node(ptr);\n\t\t\t\tedit->set_backpointers[i] = &side->back_pointer;\n\t\t\t} else {\n\t\t\t\tshortcut = assoc_array_ptr_to_shortcut(ptr);\n\t\t\t\tedit->set_backpointers[i] = &shortcut->back_pointer;\n\t\t\t}\n\t\t}\n\t}\n\n\tptr = node->back_pointer;\n\tif (!ptr)\n\t\tedit->set[0].ptr = &edit->array->root;\n\telse if (assoc_array_ptr_is_node(ptr))\n\t\tedit->set[0].ptr = &assoc_array_ptr_to_node(ptr)->slots[node->parent_slot];\n\telse\n\t\tedit->set[0].ptr = &assoc_array_ptr_to_shortcut(ptr)->next_node;\n\tedit->excised_meta[0] = assoc_array_node_to_ptr(node);\n\tpr_devel(\"<--%s() = ok [split node]\\n\", __func__);\n\treturn true;\n\npresent_leaves_cluster_but_not_new_leaf:\n\t/* All the old leaves cluster in the same slot, but the new leaf wants\n\t * to go into a different slot, so we create a new node to hold the new\n\t * leaf and a pointer to a new node holding all the old leaves.\n\t */\n\tpr_devel(\"present leaves cluster but not new leaf\\n\");\n\n\tnew_n0->back_pointer = node->back_pointer;\n\tnew_n0->parent_slot = node->parent_slot;\n\tnew_n0->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = edit->segment_cache[0];\n\tnew_n1->nr_leaves_on_branch = node->nr_leaves_on_branch;\n\tedit->adjust_count_on = new_n0;\n\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++)\n\t\tnew_n1->slots[i] = node->slots[i];\n\n\tnew_n0->slots[edit->segment_cache[0]] = assoc_array_node_to_ptr(new_n0);\n\tedit->leaf_p = &new_n0->slots[edit->segment_cache[ASSOC_ARRAY_FAN_OUT]];\n\n\tedit->set[0].ptr = &assoc_array_ptr_to_node(node->back_pointer)->slots[node->parent_slot];\n\tedit->set[0].to = assoc_array_node_to_ptr(new_n0);\n\tedit->excised_meta[0] = assoc_array_node_to_ptr(node);\n\tpr_devel(\"<--%s() = ok [insert node before]\\n\", __func__);\n\treturn true;\n\nall_leaves_cluster_together:\n\t/* All the leaves, new and old, want to cluster together in this node\n\t * in the same slot, so we have to replace this node with a shortcut to\n\t * skip over the identical parts of the key and then place a pair of\n\t * nodes, one inside the other, at the end of the shortcut and\n\t * distribute the keys between them.\n\t *\n\t * Firstly we need to work out where the leaves start diverging as a\n\t * bit position into their keys so that we know how big the shortcut\n\t * needs to be.\n\t *\n\t * We only need to make a single pass of N of the N+1 leaves because if\n\t * any keys differ between themselves at bit X then at least one of\n\t * them must also differ with the base key at bit X or before.\n\t */\n\tpr_devel(\"all leaves cluster together\\n\");\n\tdiff = INT_MAX;\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tint x = ops->diff_objects(assoc_array_ptr_to_leaf(node->slots[i]),\n\t\t\t\t\t index_key);\n\t\tif (x < diff) {\n\t\t\tBUG_ON(x < 0);\n\t\t\tdiff = x;\n\t\t}\n\t}\n\tBUG_ON(diff == INT_MAX);\n\tBUG_ON(diff < level + ASSOC_ARRAY_LEVEL_STEP);\n\n\tkeylen = round_up(diff, ASSOC_ARRAY_KEY_CHUNK_SIZE);\n\tkeylen >>= ASSOC_ARRAY_KEY_CHUNK_SHIFT;\n\n\tnew_s0 = kzalloc(sizeof(struct assoc_array_shortcut) +\n\t\t\t keylen * sizeof(unsigned long), GFP_KERNEL);\n\tif (!new_s0)\n\t\treturn false;\n\tedit->new_meta[2] = assoc_array_shortcut_to_ptr(new_s0);\n\n\tedit->set[0].to = assoc_array_shortcut_to_ptr(new_s0);\n\tnew_s0->back_pointer = node->back_pointer;\n\tnew_s0->parent_slot = node->parent_slot;\n\tnew_s0->next_node = assoc_array_node_to_ptr(new_n0);\n\tnew_n0->back_pointer = assoc_array_shortcut_to_ptr(new_s0);\n\tnew_n0->parent_slot = 0;\n\tnew_n1->back_pointer = assoc_array_node_to_ptr(new_n0);\n\tnew_n1->parent_slot = -1; /* Need to calculate this */\n\n\tnew_s0->skip_to_level = level = diff & ~ASSOC_ARRAY_LEVEL_STEP_MASK;\n\tpr_devel(\"skip_to_level = %d [diff %d]\\n\", level, diff);\n\tBUG_ON(level <= 0);\n\n\tfor (i = 0; i < keylen; i++)\n\t\tnew_s0->index_key[i] =\n\t\t\tops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE);\n\n\tblank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK);\n\tpr_devel(\"blank off [%zu] %d: %lx\\n\", keylen - 1, level, blank);\n\tnew_s0->index_key[keylen - 1] &= ~blank;\n\n\t/* This now reduces to a node splitting exercise for which we'll need\n\t * to regenerate the disparity table.\n\t */\n\tfor (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {\n\t\tptr = node->slots[i];\n\t\tbase_seg = ops->get_object_key_chunk(assoc_array_ptr_to_leaf(ptr),\n\t\t\t\t\t\t level);\n\t\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\t\tedit->segment_cache[i] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\t}\n\n\tbase_seg = ops->get_key_chunk(index_key, level);\n\tbase_seg >>= level & ASSOC_ARRAY_KEY_CHUNK_MASK;\n\tedit->segment_cache[ASSOC_ARRAY_FAN_OUT] = base_seg & ASSOC_ARRAY_FAN_MASK;\n\tgoto do_split_node;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"assoc_array_insert_into_terminal_node","file_name":"lib/assoc_array.c","commit_link":"github.com/torvalds/linux/commit/8d4a2ec1e0b41b0cf9a0c5cd4511da7f8e4f3de2","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#24-3089607ddcee","input":"void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)\n{\n\tstruct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);\n\tbool prepare = (inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) ||\n\t\t ipv6_sk_rxinfo(sk);\n\n\tif (prepare && skb_rtable(skb)) {\n\t\t/* skb->cb is overloaded: prior to this point it is IP{6}CB\n\t\t * which has interface index (iif) as the first member of the\n\t\t * underlying inet{6}_skb_parm struct. This code then overlays\n\t\t * PKTINFO_SKB_CB and in_pktinfo also has iif as the first\n\t\t * element so the iif is picked up from the prior IPCB. If iif\n\t\t * is the loopback interface, then return the sending interface\n\t\t * (e.g., process binds socket to eth0 for Tx which is\n\t\t * redirected to loopback in the rtable/dst).\n\t\t */\n\t\tif (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)\n\t\t\tpktinfo->ipi_ifindex = inet_iif(skb);\n\n\t\tpktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);\n\t} else {\n\t\tpktinfo->ipi_ifindex = 0;\n\t\tpktinfo->ipi_spec_dst.s_addr = 0;\n\t}\n\tskb_dst_drop(skb);\n}","target":"void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)\n{\n\tstruct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);\n\tbool prepare = (inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) ||\n\t\t ipv6_sk_rxinfo(sk);\n\n\tif (prepare && skb_rtable(skb)) {\n\t\t/* skb->cb is overloaded: prior to this point it is IP{6}CB\n\t\t * which has interface index (iif) as the first member of the\n\t\t * underlying inet{6}_skb_parm struct. This code then overlays\n\t\t * PKTINFO_SKB_CB and in_pktinfo also has iif as the first\n\t\t * element so the iif is picked up from the prior IPCB. If iif\n\t\t * is the loopback interface, then return the sending interface\n\t\t * (e.g., process binds socket to eth0 for Tx which is\n\t\t * redirected to loopback in the rtable/dst).\n\t\t */\n\t\tif (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)\n\t\t\tpktinfo->ipi_ifindex = inet_iif(skb);\n\n\t\tpktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);\n\t} else {\n\t\tpktinfo->ipi_ifindex = 0;\n\t\tpktinfo->ipi_spec_dst.s_addr = 0;\n\t}\n\t/* We need to keep the dst for __ip_options_echo()\n\t * We could restrict the test to opt.ts_needtime || opt.srr,\n\t * but the following is good enough as IP options are not often used.\n\t */\n\tif (unlikely(IPCB(skb)->opt.optlen))\n\t\tskb_dst_force(skb);\n\telse\n\t\tskb_dst_drop(skb);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"ipv4_pktinfo_prepare","file_name":"net/ipv4/ip_sockglue.c","commit_link":"github.com/torvalds/linux/commit/34b2cef20f19c87999fff3da4071e66937db9644","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#25-9051da92bef6","input":"static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin,\n\t\t\t\t RBinDexClass *c, int MI, int MA, int paddr, int ins_size,\n\t\t\t\t int insns_size, char *class_name, int regsz,\n\t\t\t\t int debug_info_off) {\n\tstruct r_bin_t *rbin = binfile->rbin;\n\tconst ut8 *p4 = r_buf_get_at (binfile->buf, debug_info_off, NULL);\n\tconst ut8 *p4_end = p4 + binfile->buf->length - debug_info_off;\n\tut64 line_start;\n\tut64 parameters_size;\n\tut64 param_type_idx;\n\tut16 argReg = regsz - ins_size;\n\tut64 source_file_idx = c->source_file;\n\tRList *params, *debug_positions, *emitted_debug_locals = NULL; \n\tbool keep = true;\n\tif (argReg > regsz) {\n\t\treturn; // this return breaks tests\n\t}\n\tp4 = r_uleb128 (p4, p4_end - p4, &line_start);\n\tp4 = r_uleb128 (p4, p4_end - p4, ¶meters_size);\n\t// TODO: check when we should use source_file\n\t// The state machine consists of five registers\n\tut32 address = 0;\n\tut32 line = line_start;\n\tif (!(debug_positions = r_list_newf ((RListFree)free))) {\n\t\treturn;\t\n\t}\n\tif (!(emitted_debug_locals = r_list_newf ((RListFree)free))) {\n\t\tr_list_free (debug_positions);\n\t\treturn;\n\t}\n\n\tstruct dex_debug_local_t debug_locals[regsz];\n\tmemset (debug_locals, 0, sizeof (struct dex_debug_local_t) * regsz);\n\tif (!(MA & 0x0008)) {\n\t\tdebug_locals[argReg].name = \"this\";\n\t\tdebug_locals[argReg].descriptor = r_str_newf(\"%s;\", class_name);\n\t\tdebug_locals[argReg].startAddress = 0;\n\t\tdebug_locals[argReg].signature = NULL;\n\t\tdebug_locals[argReg].live = true;\n\t\targReg++;\n\t}\n\tif (!(params = dex_method_signature2 (bin, MI))) {\n\t\tr_list_free (debug_positions);\n\t\tr_list_free (emitted_debug_locals);\n\t\treturn;\n\t}\n\n\tRListIter *iter = r_list_iterator (params);\n\tchar *name;\n\tchar *type;\n\tint reg;\n\n\tr_list_foreach (params, iter, type) {\n\t\tif ((argReg >= regsz) || !type || parameters_size <= 0) {\n\t\t\tr_list_free (debug_positions);\n\t\t\tr_list_free (params);\n\t\t\tr_list_free (emitted_debug_locals);\n\t\t\treturn;\n\t\t}\n\t\tp4 = r_uleb128 (p4, p4_end - p4, ¶m_type_idx); // read uleb128p1\n\t\tparam_type_idx -= 1;\n\t\tname = getstr (bin, param_type_idx);\n\t\treg = argReg;\n\t\tswitch (type[0]) {\n\t\tcase 'D':\n\t\tcase 'J':\n\t\t\targReg += 2;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\targReg += 1;\n\t\t\tbreak;\n\t\t}\n\t\tif (name) {\n\t\t\tdebug_locals[reg].name = name;\n\t\t\tdebug_locals[reg].descriptor = type;\n\t\t\tdebug_locals[reg].signature = NULL;\n\t\t\tdebug_locals[reg].startAddress = address;\n\t\t\tdebug_locals[reg].live = true;\n\t\t}\n\t\t--parameters_size;\n\t}\n\n\tut8 opcode = *(p4++) & 0xff;\n\twhile (keep) {\n\t\tswitch (opcode) {\n\t\tcase 0x0: // DBG_END_SEQUENCE\n\t\t\tkeep = false;\n\t\t\tbreak;\n\t\tcase 0x1: // DBG_ADVANCE_PC\n\t\t\t{\n\t\t\tut64 addr_diff;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &addr_diff);\n\t\t\taddress += addr_diff;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x2: // DBG_ADVANCE_LINE\n\t\t\t{\n\t\t\tst64 line_diff = r_sleb128 (&p4, p4_end);\n\t\t\tline += line_diff;\n\t\t\t}\n\t\t\tbreak;\t\n\t\tcase 0x3: // DBG_START_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tut64 name_idx;\n\t\t\tut64 type_idx;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &name_idx); \n\t\t\tname_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &type_idx); \n\t\t\ttype_idx -= 1;\n\t\t\tif (register_num >= regsz) {\n\t\t\t\tr_list_free (debug_positions);\n\t\t\t\tr_list_free (params);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Emit what was previously there, if anything\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\t\t\tdebug_locals[register_num].name = getstr (bin, name_idx);\n\t\t\tdebug_locals[register_num].descriptor = dex_type_descriptor (bin, type_idx);\n\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\tdebug_locals[register_num].signature = NULL;\n\t\t\tdebug_locals[register_num].live = true;\n\t\t\t//eprintf(\"DBG_START_LOCAL %x %x %x\\n\", register_num, name_idx, type_idx);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x4: //DBG_START_LOCAL_EXTENDED\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tut64 name_idx;\n\t\t\tut64 type_idx;\n\t\t\tut64 sig_idx;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &name_idx);\n\t\t\tname_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &type_idx);\n\t\t\ttype_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &sig_idx);\n\t\t\tsig_idx -= 1;\n\t\t\tif (register_num >= regsz) {\n\t\t\t\tr_list_free (debug_positions);\n\t\t\t\tr_list_free (params);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Emit what was previously there, if anything\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\n\t\t\tdebug_locals[register_num].name = getstr (bin, name_idx);\n\t\t\tdebug_locals[register_num].descriptor = dex_type_descriptor (bin, type_idx);\n\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\tdebug_locals[register_num].signature = getstr (bin, sig_idx);\n\t\t\tdebug_locals[register_num].live = true;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x5: // DBG_END_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\t\t\tdebug_locals[register_num].live = false;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x6: // DBG_RESTART_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tif (!debug_locals[register_num].live) {\n\t\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\t\tdebug_locals[register_num].live = true;\n\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x7: //DBG_SET_PROLOGUE_END\n\t\t\tbreak;\n\t\tcase 0x8: //DBG_SET_PROLOGUE_BEGIN\n\t\t\tbreak;\n\t\tcase 0x9:\n\t\t\t{\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &source_file_idx);\n\t\t\tsource_file_idx--;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t{\n\t\t\tint adjusted_opcode = opcode - 0x0a;\n\t\t\taddress += (adjusted_opcode / 15);\n\t\t\tline += -4 + (adjusted_opcode % 15);\n\t\t\tstruct dex_debug_position_t *position =\n\t\t\t\tmalloc (sizeof (struct dex_debug_position_t));\n\t\t\tif (!position) {\n\t\t\t\tkeep = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tposition->source_file_idx = source_file_idx;\n\t\t\tposition->address = address;\n\t\t\tposition->line = line;\n\t\t\tr_list_append (debug_positions, position);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\topcode = *(p4++) & 0xff;\n\t}\n\n\tif (!binfile->sdb_addrinfo) {\n\t\tbinfile->sdb_addrinfo = sdb_new0 ();\n\t}\n\n\tchar *fileline;\n\tchar offset[64];\n\tchar *offset_ptr;\n\n\tRListIter *iter1;\n\tstruct dex_debug_position_t *pos;\n\tr_list_foreach (debug_positions, iter1, pos) {\n\t\tfileline = r_str_newf (\"%s|%\"PFMT64d, getstr (bin, pos->source_file_idx), pos->line);\n\t\toffset_ptr = sdb_itoa (pos->address + paddr, offset, 16);\n\t\tsdb_set (binfile->sdb_addrinfo, offset_ptr, fileline, 0);\n\t\tsdb_set (binfile->sdb_addrinfo, fileline, offset_ptr, 0);\n\t}\n\n\tif (!dexdump) {\n\t\tr_list_free (debug_positions);\n\t\tr_list_free (emitted_debug_locals);\n\t\tr_list_free (params);\n\t\treturn;\n\t}\n\n\tRListIter *iter2;\n\tstruct dex_debug_position_t *position;\n\n\trbin->cb_printf (\" positions :\\n\");\n\tr_list_foreach (debug_positions, iter2, position) {\n\t\trbin->cb_printf (\" 0x%04llx line=%llu\\n\",\n\t\t\t\t position->address, position->line);\n\t}\n\n\trbin->cb_printf (\" locals :\\n\");\n\n\tRListIter *iter3;\n\tstruct dex_debug_local_t *local;\n\tr_list_foreach (emitted_debug_locals, iter3, local) {\n\t\tif (local->signature) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s %s\\n\",\n\t\t\t\tlocal->startAddress, local->endAddress,\n\t\t\t\tlocal->reg, local->name, local->descriptor,\n\t\t\t\tlocal->signature);\n\t\t} else {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s\\n\",\n\t\t\t\tlocal->startAddress, local->endAddress,\n\t\t\t\tlocal->reg, local->name, local->descriptor);\n\t\t}\n\t}\n\n\tfor (reg = 0; reg < regsz; reg++) {\n\t\tif (debug_locals[reg].live) {\n\t\t\tif (debug_locals[reg].signature) {\n\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s \"\n\t\t\t\t\t\"%s\\n\",\n\t\t\t\t\tdebug_locals[reg].startAddress,\n\t\t\t\t\tinsns_size, reg, debug_locals[reg].name,\n\t\t\t\t\tdebug_locals[reg].descriptor,\n\t\t\t\t\tdebug_locals[reg].signature);\n\t\t\t} else {\n\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s\"\n\t\t\t\t\t\"\\n\",\n\t\t\t\t\tdebug_locals[reg].startAddress,\n\t\t\t\t\tinsns_size, reg, debug_locals[reg].name,\n\t\t\t\t\tdebug_locals[reg].descriptor);\n\t\t\t}\n\t\t}\n\t}\n\tr_list_free (debug_positions);\n\tr_list_free (emitted_debug_locals);\n\tr_list_free (params);\n}","target":"static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin,\n\t\t\t\t RBinDexClass *c, int MI, int MA, int paddr, int ins_size,\n\t\t\t\t int insns_size, char *class_name, int regsz,\n\t\t\t\t int debug_info_off) {\n\tstruct r_bin_t *rbin = binfile->rbin;\n\tconst ut8 *p4 = r_buf_get_at (binfile->buf, debug_info_off, NULL);\n\tconst ut8 *p4_end = p4 + binfile->buf->length - debug_info_off;\n\tut64 line_start;\n\tut64 parameters_size;\n\tut64 param_type_idx;\n\tut16 argReg = regsz - ins_size;\n\tut64 source_file_idx = c->source_file;\n\tRList *params, *debug_positions, *emitted_debug_locals = NULL; \n\tbool keep = true;\n\tif (argReg > regsz) {\n\t\treturn; // this return breaks tests\n\t}\n\tp4 = r_uleb128 (p4, p4_end - p4, &line_start);\n\tp4 = r_uleb128 (p4, p4_end - p4, ¶meters_size);\n\t// TODO: check when we should use source_file\n\t// The state machine consists of five registers\n\tut32 address = 0;\n\tut32 line = line_start;\n\tif (!(debug_positions = r_list_newf ((RListFree)free))) {\n\t\treturn;\t\n\t}\n\tif (!(emitted_debug_locals = r_list_newf ((RListFree)free))) {\n\t\tr_list_free (debug_positions);\n\t\treturn;\n\t}\n\n\tstruct dex_debug_local_t debug_locals[regsz];\n\tmemset (debug_locals, 0, sizeof (struct dex_debug_local_t) * regsz);\n\tif (!(MA & 0x0008)) {\n\t\tdebug_locals[argReg].name = \"this\";\n\t\tdebug_locals[argReg].descriptor = r_str_newf(\"%s;\", class_name);\n\t\tdebug_locals[argReg].startAddress = 0;\n\t\tdebug_locals[argReg].signature = NULL;\n\t\tdebug_locals[argReg].live = true;\n\t\targReg++;\n\t}\n\tif (!(params = dex_method_signature2 (bin, MI))) {\n\t\tr_list_free (debug_positions);\n\t\tr_list_free (emitted_debug_locals);\n\t\treturn;\n\t}\n\n\tRListIter *iter = r_list_iterator (params);\n\tchar *name;\n\tchar *type;\n\tint reg;\n\n\tr_list_foreach (params, iter, type) {\n\t\tif ((argReg >= regsz) || !type || parameters_size <= 0) {\n\t\t\tr_list_free (debug_positions);\n\t\t\tr_list_free (params);\n\t\t\tr_list_free (emitted_debug_locals);\n\t\t\treturn;\n\t\t}\n\t\tp4 = r_uleb128 (p4, p4_end - p4, ¶m_type_idx); // read uleb128p1\n\t\tparam_type_idx -= 1;\n\t\tname = getstr (bin, param_type_idx);\n\t\treg = argReg;\n\t\tswitch (type[0]) {\n\t\tcase 'D':\n\t\tcase 'J':\n\t\t\targReg += 2;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\targReg += 1;\n\t\t\tbreak;\n\t\t}\n\t\tif (name) {\n\t\t\tdebug_locals[reg].name = name;\n\t\t\tdebug_locals[reg].descriptor = type;\n\t\t\tdebug_locals[reg].signature = NULL;\n\t\t\tdebug_locals[reg].startAddress = address;\n\t\t\tdebug_locals[reg].live = true;\n\t\t}\n\t\t--parameters_size;\n\t}\n\n\tif (p4 <= 0) {\n\t\treturn;\n\t}\n\tut8 opcode = *(p4++) & 0xff;\n\twhile (keep) {\n\t\tswitch (opcode) {\n\t\tcase 0x0: // DBG_END_SEQUENCE\n\t\t\tkeep = false;\n\t\t\tbreak;\n\t\tcase 0x1: // DBG_ADVANCE_PC\n\t\t\t{\n\t\t\tut64 addr_diff;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &addr_diff);\n\t\t\taddress += addr_diff;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x2: // DBG_ADVANCE_LINE\n\t\t\t{\n\t\t\tst64 line_diff = r_sleb128 (&p4, p4_end);\n\t\t\tline += line_diff;\n\t\t\t}\n\t\t\tbreak;\t\n\t\tcase 0x3: // DBG_START_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tut64 name_idx;\n\t\t\tut64 type_idx;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &name_idx); \n\t\t\tname_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &type_idx); \n\t\t\ttype_idx -= 1;\n\t\t\tif (register_num >= regsz) {\n\t\t\t\tr_list_free (debug_positions);\n\t\t\t\tr_list_free (params);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Emit what was previously there, if anything\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\t\t\tdebug_locals[register_num].name = getstr (bin, name_idx);\n\t\t\tdebug_locals[register_num].descriptor = dex_type_descriptor (bin, type_idx);\n\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\tdebug_locals[register_num].signature = NULL;\n\t\t\tdebug_locals[register_num].live = true;\n\t\t\t//eprintf(\"DBG_START_LOCAL %x %x %x\\n\", register_num, name_idx, type_idx);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x4: //DBG_START_LOCAL_EXTENDED\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tut64 name_idx;\n\t\t\tut64 type_idx;\n\t\t\tut64 sig_idx;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &name_idx);\n\t\t\tname_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &type_idx);\n\t\t\ttype_idx -= 1;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &sig_idx);\n\t\t\tsig_idx -= 1;\n\t\t\tif (register_num >= regsz) {\n\t\t\t\tr_list_free (debug_positions);\n\t\t\t\tr_list_free (params);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Emit what was previously there, if anything\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\n\t\t\tdebug_locals[register_num].name = getstr (bin, name_idx);\n\t\t\tdebug_locals[register_num].descriptor = dex_type_descriptor (bin, type_idx);\n\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\tdebug_locals[register_num].signature = getstr (bin, sig_idx);\n\t\t\tdebug_locals[register_num].live = true;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x5: // DBG_END_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\t// emitLocalCbIfLive\n\t\t\tif (debug_locals[register_num].live) {\n\t\t\t\tstruct dex_debug_local_t *local = malloc (\n\t\t\t\t\tsizeof (struct dex_debug_local_t));\n\t\t\t\tif (!local) {\n\t\t\t\t\tkeep = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlocal->name = debug_locals[register_num].name;\n\t\t\t\tlocal->descriptor = debug_locals[register_num].descriptor;\n\t\t\t\tlocal->startAddress = debug_locals[register_num].startAddress;\n\t\t\t\tlocal->signature = debug_locals[register_num].signature;\n\t\t\t\tlocal->live = true;\n\t\t\t\tlocal->reg = register_num;\n\t\t\t\tlocal->endAddress = address;\n\t\t\t\tr_list_append (emitted_debug_locals, local);\n\t\t\t}\n\t\t\tdebug_locals[register_num].live = false;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x6: // DBG_RESTART_LOCAL\n\t\t\t{\n\t\t\tut64 register_num;\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, ®ister_num);\n\t\t\tif (!debug_locals[register_num].live) {\n\t\t\t\tdebug_locals[register_num].startAddress = address;\n\t\t\t\tdebug_locals[register_num].live = true;\n\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 0x7: //DBG_SET_PROLOGUE_END\n\t\t\tbreak;\n\t\tcase 0x8: //DBG_SET_PROLOGUE_BEGIN\n\t\t\tbreak;\n\t\tcase 0x9:\n\t\t\t{\n\t\t\tp4 = r_uleb128 (p4, p4_end - p4, &source_file_idx);\n\t\t\tsource_file_idx--;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t{\n\t\t\tint adjusted_opcode = opcode - 0x0a;\n\t\t\taddress += (adjusted_opcode / 15);\n\t\t\tline += -4 + (adjusted_opcode % 15);\n\t\t\tstruct dex_debug_position_t *position =\n\t\t\t\tmalloc (sizeof (struct dex_debug_position_t));\n\t\t\tif (!position) {\n\t\t\t\tkeep = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tposition->source_file_idx = source_file_idx;\n\t\t\tposition->address = address;\n\t\t\tposition->line = line;\n\t\t\tr_list_append (debug_positions, position);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\topcode = *(p4++) & 0xff;\n\t}\n\n\tif (!binfile->sdb_addrinfo) {\n\t\tbinfile->sdb_addrinfo = sdb_new0 ();\n\t}\n\n\tchar *fileline;\n\tchar offset[64];\n\tchar *offset_ptr;\n\n\tRListIter *iter1;\n\tstruct dex_debug_position_t *pos;\n\tr_list_foreach (debug_positions, iter1, pos) {\n\t\tfileline = r_str_newf (\"%s|%\"PFMT64d, getstr (bin, pos->source_file_idx), pos->line);\n\t\toffset_ptr = sdb_itoa (pos->address + paddr, offset, 16);\n\t\tsdb_set (binfile->sdb_addrinfo, offset_ptr, fileline, 0);\n\t\tsdb_set (binfile->sdb_addrinfo, fileline, offset_ptr, 0);\n\t}\n\n\tif (!dexdump) {\n\t\tr_list_free (debug_positions);\n\t\tr_list_free (emitted_debug_locals);\n\t\tr_list_free (params);\n\t\treturn;\n\t}\n\n\tRListIter *iter2;\n\tstruct dex_debug_position_t *position;\n\n\trbin->cb_printf (\" positions :\\n\");\n\tr_list_foreach (debug_positions, iter2, position) {\n\t\trbin->cb_printf (\" 0x%04llx line=%llu\\n\",\n\t\t\t\t position->address, position->line);\n\t}\n\n\trbin->cb_printf (\" locals :\\n\");\n\n\tRListIter *iter3;\n\tstruct dex_debug_local_t *local;\n\tr_list_foreach (emitted_debug_locals, iter3, local) {\n\t\tif (local->signature) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s %s\\n\",\n\t\t\t\tlocal->startAddress, local->endAddress,\n\t\t\t\tlocal->reg, local->name, local->descriptor,\n\t\t\t\tlocal->signature);\n\t\t} else {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s\\n\",\n\t\t\t\tlocal->startAddress, local->endAddress,\n\t\t\t\tlocal->reg, local->name, local->descriptor);\n\t\t}\n\t}\n\n\tfor (reg = 0; reg < regsz; reg++) {\n\t\tif (debug_locals[reg].live) {\n\t\t\tif (debug_locals[reg].signature) {\n\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s \"\n\t\t\t\t\t\"%s\\n\",\n\t\t\t\t\tdebug_locals[reg].startAddress,\n\t\t\t\t\tinsns_size, reg, debug_locals[reg].name,\n\t\t\t\t\tdebug_locals[reg].descriptor,\n\t\t\t\t\tdebug_locals[reg].signature);\n\t\t\t} else {\n\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\" 0x%04x - 0x%04x reg=%d %s %s\"\n\t\t\t\t\t\"\\n\",\n\t\t\t\t\tdebug_locals[reg].startAddress,\n\t\t\t\t\tinsns_size, reg, debug_locals[reg].name,\n\t\t\t\t\tdebug_locals[reg].descriptor);\n\t\t\t}\n\t\t}\n\t}\n\tr_list_free (debug_positions);\n\tr_list_free (emitted_debug_locals);\n\tr_list_free (params);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"dex_parse_debug_item","file_name":"libr/bin/p/bin_dex.c","commit_link":"github.com/radare/radare2/commit/252afb1cff9676f3ae1f341a28448bf2c8b6e308","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#26-4b27c389056e","input":"int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm,\n\t\t struct cmsghdr *cmsg)\n{\n\tstruct page *page = NULL;\n\tstruct rds_atomic_args *args;\n\tint ret = 0;\n\n\tif (cmsg->cmsg_len < CMSG_LEN(sizeof(struct rds_atomic_args))\n\t || rm->atomic.op_active)\n\t\treturn -EINVAL;\n\n\targs = CMSG_DATA(cmsg);\n\n\t/* Nonmasked & masked cmsg ops converted to masked hw ops */\n\tswitch (cmsg->cmsg_type) {\n\tcase RDS_CMSG_ATOMIC_FADD:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_FADD;\n\t\trm->atomic.op_m_fadd.add = args->fadd.add;\n\t\trm->atomic.op_m_fadd.nocarry_mask = 0;\n\t\tbreak;\n\tcase RDS_CMSG_MASKED_ATOMIC_FADD:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_FADD;\n\t\trm->atomic.op_m_fadd.add = args->m_fadd.add;\n\t\trm->atomic.op_m_fadd.nocarry_mask = args->m_fadd.nocarry_mask;\n\t\tbreak;\n\tcase RDS_CMSG_ATOMIC_CSWP:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_CSWP;\n\t\trm->atomic.op_m_cswp.compare = args->cswp.compare;\n\t\trm->atomic.op_m_cswp.swap = args->cswp.swap;\n\t\trm->atomic.op_m_cswp.compare_mask = ~0;\n\t\trm->atomic.op_m_cswp.swap_mask = ~0;\n\t\tbreak;\n\tcase RDS_CMSG_MASKED_ATOMIC_CSWP:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_CSWP;\n\t\trm->atomic.op_m_cswp.compare = args->m_cswp.compare;\n\t\trm->atomic.op_m_cswp.swap = args->m_cswp.swap;\n\t\trm->atomic.op_m_cswp.compare_mask = args->m_cswp.compare_mask;\n\t\trm->atomic.op_m_cswp.swap_mask = args->m_cswp.swap_mask;\n\t\tbreak;\n\tdefault:\n\t\tBUG(); /* should never happen */\n\t}\n\n\trm->atomic.op_notify = !!(args->flags & RDS_RDMA_NOTIFY_ME);\n\trm->atomic.op_silent = !!(args->flags & RDS_RDMA_SILENT);\n\trm->atomic.op_active = 1;\n\trm->atomic.op_recverr = rs->rs_recverr;\n\trm->atomic.op_sg = rds_message_alloc_sgs(rm, 1);\n\tif (!rm->atomic.op_sg) {\n\t\tret = -ENOMEM;\n\t\tgoto err;\n\t}\n\n\t/* verify 8 byte-aligned */\n\tif (args->local_addr & 0x7) {\n\t\tret = -EFAULT;\n\t\tgoto err;\n\t}\n\n\tret = rds_pin_pages(args->local_addr, 1, &page, 1);\n\tif (ret != 1)\n\t\tgoto err;\n\tret = 0;\n\n\tsg_set_page(rm->atomic.op_sg, page, 8, offset_in_page(args->local_addr));\n\n\tif (rm->atomic.op_notify || rm->atomic.op_recverr) {\n\t\t/* We allocate an uninitialized notifier here, because\n\t\t * we don't want to do that in the completion handler. We\n\t\t * would have to use GFP_ATOMIC there, and don't want to deal\n\t\t * with failed allocations.\n\t\t */\n\t\trm->atomic.op_notifier = kmalloc(sizeof(*rm->atomic.op_notifier), GFP_KERNEL);\n\t\tif (!rm->atomic.op_notifier) {\n\t\t\tret = -ENOMEM;\n\t\t\tgoto err;\n\t\t}\n\n\t\trm->atomic.op_notifier->n_user_token = args->user_token;\n\t\trm->atomic.op_notifier->n_status = RDS_RDMA_SUCCESS;\n\t}\n\n\trm->atomic.op_rkey = rds_rdma_cookie_key(args->cookie);\n\trm->atomic.op_remote_addr = args->remote_addr + rds_rdma_cookie_offset(args->cookie);\n\n\treturn ret;\nerr:\n\tif (page)\n\t\tput_page(page);\n\tkfree(rm->atomic.op_notifier);\n\n\treturn ret;\n}","target":"int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm,\n\t\t struct cmsghdr *cmsg)\n{\n\tstruct page *page = NULL;\n\tstruct rds_atomic_args *args;\n\tint ret = 0;\n\n\tif (cmsg->cmsg_len < CMSG_LEN(sizeof(struct rds_atomic_args))\n\t || rm->atomic.op_active)\n\t\treturn -EINVAL;\n\n\targs = CMSG_DATA(cmsg);\n\n\t/* Nonmasked & masked cmsg ops converted to masked hw ops */\n\tswitch (cmsg->cmsg_type) {\n\tcase RDS_CMSG_ATOMIC_FADD:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_FADD;\n\t\trm->atomic.op_m_fadd.add = args->fadd.add;\n\t\trm->atomic.op_m_fadd.nocarry_mask = 0;\n\t\tbreak;\n\tcase RDS_CMSG_MASKED_ATOMIC_FADD:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_FADD;\n\t\trm->atomic.op_m_fadd.add = args->m_fadd.add;\n\t\trm->atomic.op_m_fadd.nocarry_mask = args->m_fadd.nocarry_mask;\n\t\tbreak;\n\tcase RDS_CMSG_ATOMIC_CSWP:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_CSWP;\n\t\trm->atomic.op_m_cswp.compare = args->cswp.compare;\n\t\trm->atomic.op_m_cswp.swap = args->cswp.swap;\n\t\trm->atomic.op_m_cswp.compare_mask = ~0;\n\t\trm->atomic.op_m_cswp.swap_mask = ~0;\n\t\tbreak;\n\tcase RDS_CMSG_MASKED_ATOMIC_CSWP:\n\t\trm->atomic.op_type = RDS_ATOMIC_TYPE_CSWP;\n\t\trm->atomic.op_m_cswp.compare = args->m_cswp.compare;\n\t\trm->atomic.op_m_cswp.swap = args->m_cswp.swap;\n\t\trm->atomic.op_m_cswp.compare_mask = args->m_cswp.compare_mask;\n\t\trm->atomic.op_m_cswp.swap_mask = args->m_cswp.swap_mask;\n\t\tbreak;\n\tdefault:\n\t\tBUG(); /* should never happen */\n\t}\n\n\trm->atomic.op_notify = !!(args->flags & RDS_RDMA_NOTIFY_ME);\n\trm->atomic.op_silent = !!(args->flags & RDS_RDMA_SILENT);\n\trm->atomic.op_active = 1;\n\trm->atomic.op_recverr = rs->rs_recverr;\n\trm->atomic.op_sg = rds_message_alloc_sgs(rm, 1);\n\tif (!rm->atomic.op_sg) {\n\t\tret = -ENOMEM;\n\t\tgoto err;\n\t}\n\n\t/* verify 8 byte-aligned */\n\tif (args->local_addr & 0x7) {\n\t\tret = -EFAULT;\n\t\tgoto err;\n\t}\n\n\tret = rds_pin_pages(args->local_addr, 1, &page, 1);\n\tif (ret != 1)\n\t\tgoto err;\n\tret = 0;\n\n\tsg_set_page(rm->atomic.op_sg, page, 8, offset_in_page(args->local_addr));\n\n\tif (rm->atomic.op_notify || rm->atomic.op_recverr) {\n\t\t/* We allocate an uninitialized notifier here, because\n\t\t * we don't want to do that in the completion handler. We\n\t\t * would have to use GFP_ATOMIC there, and don't want to deal\n\t\t * with failed allocations.\n\t\t */\n\t\trm->atomic.op_notifier = kmalloc(sizeof(*rm->atomic.op_notifier), GFP_KERNEL);\n\t\tif (!rm->atomic.op_notifier) {\n\t\t\tret = -ENOMEM;\n\t\t\tgoto err;\n\t\t}\n\n\t\trm->atomic.op_notifier->n_user_token = args->user_token;\n\t\trm->atomic.op_notifier->n_status = RDS_RDMA_SUCCESS;\n\t}\n\n\trm->atomic.op_rkey = rds_rdma_cookie_key(args->cookie);\n\trm->atomic.op_remote_addr = args->remote_addr + rds_rdma_cookie_offset(args->cookie);\n\n\treturn ret;\nerr:\n\tif (page)\n\t\tput_page(page);\n\trm->atomic.op_active = 0;\n\tkfree(rm->atomic.op_notifier);\n\n\treturn ret;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"rds_cmsg_atomic","file_name":"net/rds/rdma.c","commit_link":"github.com/torvalds/linux/commit/7d11f77f84b27cef452cee332f4e469503084737","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#27-c7014a67838a","input":"AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream, \n AP4_UI32 type,\n AP4_UI32 size_32,\n AP4_UI64 size_64,\n AP4_Atom*& atom)\n{\n bool atom_is_large = (size_32 == 1);\n bool force_64 = (size_32==1 && ((size_64>>32) == 0));\n \n // create the atom\n if (GetContext() == AP4_ATOM_TYPE_STSD) {\n // sample entry\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n switch (type) {\n case AP4_ATOM_TYPE_MP4A:\n atom = new AP4_Mp4aSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MP4V:\n atom = new AP4_Mp4vSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MP4S:\n atom = new AP4_Mp4sSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ENCA:\n atom = new AP4_EncaSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ENCV:\n atom = new AP4_EncvSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_DRMS:\n atom = new AP4_DrmsSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_DRMI:\n atom = new AP4_DrmiSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_AVC1:\n case AP4_ATOM_TYPE_AVC2:\n case AP4_ATOM_TYPE_AVC3:\n case AP4_ATOM_TYPE_AVC4:\n case AP4_ATOM_TYPE_DVAV:\n case AP4_ATOM_TYPE_DVA1:\n atom = new AP4_AvcSampleEntry(type, size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_HEV1:\n case AP4_ATOM_TYPE_HVC1:\n case AP4_ATOM_TYPE_DVHE:\n case AP4_ATOM_TYPE_DVH1:\n atom = new AP4_HevcSampleEntry(type, size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ALAC:\n case AP4_ATOM_TYPE_AC_3:\n case AP4_ATOM_TYPE_EC_3:\n case AP4_ATOM_TYPE_DTSC:\n case AP4_ATOM_TYPE_DTSH:\n case AP4_ATOM_TYPE_DTSL:\n case AP4_ATOM_TYPE_DTSE:\n atom = new AP4_AudioSampleEntry(type, size_32, stream, *this);\n break;\n \n case AP4_ATOM_TYPE_RTP_:\n atom = new AP4_RtpHintSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_STPP:\n atom = new AP4_SubtitleSampleEntry(type, size_32, stream, *this);\n break;\n\n default: {\n // try all the external type handlers\n AP4_List::Item* handler_item = m_TypeHandlers.FirstItem();\n while (handler_item) {\n TypeHandler* handler = handler_item->GetData();\n if (AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom))) {\n break;\n }\n handler_item = handler_item->GetNext();\n }\n\n // no custom handler, create a generic entry\n if (atom == NULL) {\n atom = new AP4_UnknownSampleEntry(type, (AP4_UI32)size_64, stream);\n }\n\n break;\n }\n }\n } else {\n // regular atom\n switch (type) {\n case AP4_ATOM_TYPE_MOOV:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MoovAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MVHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MvhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MEHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MehdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MFHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MfhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TRAK:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrakAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_TREX:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrexAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HDLR:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HdlrAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TKHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TkhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TRUN:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrunAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFRA:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfraAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MFRO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MfroAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MDHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MdhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StsdAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_STSC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StscAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STCO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StcoAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_CO64:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_Co64Atom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSZ:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StszAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STZ2:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_Stz2Atom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STTS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SttsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_CTTS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_CttsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StssAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IODS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IodsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ESDS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_EsdsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_AVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AvccAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_HVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HvccAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_DVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_DvccAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HVCE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HvccAtom::Create(size_32, stream);\n atom->SetType(AP4_ATOM_TYPE_HVCE);\n break;\n\n case AP4_ATOM_TYPE_AVCE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AvccAtom::Create(size_32, stream);\n atom->SetType(AP4_ATOM_TYPE_AVCE);\n break;\n\n #if !defined(AP4_CONFIG_MINI_BUILD)\n case AP4_ATOM_TYPE_UUID: {\n AP4_UI08 uuid[16];\n AP4_Result result = stream.Read(uuid, 16);\n if (AP4_FAILED(result)) return result;\n \n if (AP4_CompareMemory(uuid, AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM, 16) == 0) {\n atom = AP4_PiffTrackEncryptionAtom::Create((AP4_UI32)size_64, stream);\n } else if (AP4_CompareMemory(uuid, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, 16) == 0) {\n atom = AP4_PiffSampleEncryptionAtom::Create((AP4_UI32)size_64, stream);\n } else {\n atom = new AP4_UnknownUuidAtom(size_64, uuid, stream);\n }\n break;\n }\n \n case AP4_ATOM_TYPE_8ID_:\n atom = new AP4_NullTerminatedStringAtom(type, size_64, stream);\n break;\n\n case AP4_ATOM_TYPE_8BDL:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_8bdlAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_DREF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_DrefAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_URL:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_UrlAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ELST:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_ElstAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_VMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_VmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_NMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_NmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SthdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_FRMA:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_FrmaAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SCHM:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SchmAtom::Create(size_32, &m_ContextStack, stream);\n break;\n\n case AP4_ATOM_TYPE_FTYP:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_FtypAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_TIMS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TimsAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_SDP_:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SdpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IKMS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IkmsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ISFM:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IsfmAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ISLT:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IsltAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ODHE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OdheAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_OHDR:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OhdrAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ODDA:\n atom = AP4_OddaAtom::Create(size_64, stream);\n break;\n\n case AP4_ATOM_TYPE_ODAF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OdafAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_GRPI:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_GrpiAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IPRO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IproAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_RTP_:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_RtpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFDT:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfdtAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TENC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TencAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SENC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SencAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SAIZ:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SaizAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SAIO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SaioAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_PDIN:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_PdinAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_BLOC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_BlocAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_AINF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AinfAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_PSSH:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_PsshAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SIDX:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SidxAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SBGP:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SbgpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SGPD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SgpdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MKID:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n if (GetContext() == AP4_ATOM_TYPE_MARL) {\n atom = AP4_MkidAtom::Create(size_32, stream);\n }\n break;\n\n case AP4_ATOM_TYPE_DEC3:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n if (GetContext() == AP4_ATOM_TYPE_EC_3 || GetContext() == AP4_ATOM_TYPE_ENCA) {\n atom = AP4_Dec3Atom::Create(size_32, stream);\n }\n break;\n\n // track ref types\n case AP4_ATOM_TYPE_HINT:\n case AP4_ATOM_TYPE_CDSC:\n case AP4_ATOM_TYPE_SYNC:\n case AP4_ATOM_TYPE_MPOD:\n case AP4_ATOM_TYPE_DPND:\n case AP4_ATOM_TYPE_IPIR:\n case AP4_ATOM_TYPE_ALIS:\n case AP4_ATOM_TYPE_CHAP:\n if (GetContext() == AP4_ATOM_TYPE_TREF) {\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrefTypeAtom::Create(type, size_32, stream);\n }\n break;\n\n #endif // AP4_CONFIG_MINI_BUILD\n\n // container atoms\n case AP4_ATOM_TYPE_MOOF:\n case AP4_ATOM_TYPE_MVEX:\n case AP4_ATOM_TYPE_TRAF:\n case AP4_ATOM_TYPE_TREF:\n case AP4_ATOM_TYPE_MFRA:\n case AP4_ATOM_TYPE_HNTI:\n case AP4_ATOM_TYPE_STBL:\n case AP4_ATOM_TYPE_MDIA:\n case AP4_ATOM_TYPE_DINF:\n case AP4_ATOM_TYPE_MINF:\n case AP4_ATOM_TYPE_SCHI:\n case AP4_ATOM_TYPE_SINF:\n case AP4_ATOM_TYPE_UDTA:\n case AP4_ATOM_TYPE_ILST:\n case AP4_ATOM_TYPE_EDTS: \n case AP4_ATOM_TYPE_MDRI:\n case AP4_ATOM_TYPE_WAVE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_ContainerAtom::Create(type, size_64, false, force_64, stream, *this);\n break;\n\n // containers, only at the top\n case AP4_ATOM_TYPE_MARL:\n if (GetContext() == 0) {\n atom = AP4_ContainerAtom::Create(type, size_64, false, force_64, stream, *this);\n }\n break;\n \n // full container atoms\n case AP4_ATOM_TYPE_META:\n case AP4_ATOM_TYPE_ODRM:\n case AP4_ATOM_TYPE_ODKM:\n atom = AP4_ContainerAtom::Create(type, size_64, true, force_64, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_FREE:\n case AP4_ATOM_TYPE_WIDE:\n case AP4_ATOM_TYPE_MDAT:\n // generic atoms\n break;\n \n default: {\n // try all the external type handlers\n AP4_List::Item* handler_item = m_TypeHandlers.FirstItem();\n while (handler_item) {\n TypeHandler* handler = handler_item->GetData();\n if (AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom))) {\n break;\n }\n handler_item = handler_item->GetNext();\n }\n\n break;\n }\n }\n }\n \n return AP4_SUCCESS;\n}","target":"AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream, \n AP4_UI32 type,\n AP4_UI32 size_32,\n AP4_UI64 size_64,\n AP4_Atom*& atom)\n{\n bool atom_is_large = (size_32 == 1);\n bool force_64 = (size_32==1 && ((size_64>>32) == 0));\n \n // create the atom\n if (GetContext() == AP4_ATOM_TYPE_STSD) {\n // sample entry\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n switch (type) {\n case AP4_ATOM_TYPE_MP4A:\n atom = new AP4_Mp4aSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MP4V:\n atom = new AP4_Mp4vSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MP4S:\n atom = new AP4_Mp4sSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ENCA:\n atom = new AP4_EncaSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ENCV:\n atom = new AP4_EncvSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_DRMS:\n atom = new AP4_DrmsSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_DRMI:\n atom = new AP4_DrmiSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_AVC1:\n case AP4_ATOM_TYPE_AVC2:\n case AP4_ATOM_TYPE_AVC3:\n case AP4_ATOM_TYPE_AVC4:\n case AP4_ATOM_TYPE_DVAV:\n case AP4_ATOM_TYPE_DVA1:\n atom = new AP4_AvcSampleEntry(type, size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_HEV1:\n case AP4_ATOM_TYPE_HVC1:\n case AP4_ATOM_TYPE_DVHE:\n case AP4_ATOM_TYPE_DVH1:\n atom = new AP4_HevcSampleEntry(type, size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ALAC:\n case AP4_ATOM_TYPE_AC_3:\n case AP4_ATOM_TYPE_EC_3:\n case AP4_ATOM_TYPE_DTSC:\n case AP4_ATOM_TYPE_DTSH:\n case AP4_ATOM_TYPE_DTSL:\n case AP4_ATOM_TYPE_DTSE:\n atom = new AP4_AudioSampleEntry(type, size_32, stream, *this);\n break;\n \n case AP4_ATOM_TYPE_RTP_:\n atom = new AP4_RtpHintSampleEntry(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_STPP:\n atom = new AP4_SubtitleSampleEntry(type, size_32, stream, *this);\n break;\n\n default: {\n // try all the external type handlers\n AP4_List::Item* handler_item = m_TypeHandlers.FirstItem();\n while (handler_item) {\n TypeHandler* handler = handler_item->GetData();\n if (AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom))) {\n break;\n }\n handler_item = handler_item->GetNext();\n }\n\n // no custom handler, create a generic entry\n if (atom == NULL) {\n atom = new AP4_UnknownSampleEntry(type, (AP4_UI32)size_64, stream);\n }\n\n break;\n }\n }\n } else {\n // regular atom\n switch (type) {\n case AP4_ATOM_TYPE_MOOV:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MoovAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_MVHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MvhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MEHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MehdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MFHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MfhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TRAK:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrakAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_TREX:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrexAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HDLR:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HdlrAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TKHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TkhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TRUN:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrunAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFRA:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfraAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MFRO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MfroAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MDHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_MdhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StsdAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_STSC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StscAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STCO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StcoAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_CO64:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_Co64Atom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSZ:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StszAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STZ2:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_Stz2Atom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STTS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SttsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_CTTS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_CttsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STSS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_StssAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IODS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IodsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ESDS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_EsdsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_AVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AvccAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_HVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HvccAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_DVCC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_DvccAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HVCE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HvccAtom::Create(size_32, stream);\n if (atom) {\n atom->SetType(AP4_ATOM_TYPE_HVCE);\n }\n break;\n\n case AP4_ATOM_TYPE_AVCE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AvccAtom::Create(size_32, stream);\n if (atom) {\n atom->SetType(AP4_ATOM_TYPE_AVCE);\n }\n break;\n\n #if !defined(AP4_CONFIG_MINI_BUILD)\n case AP4_ATOM_TYPE_UUID: {\n AP4_UI08 uuid[16];\n AP4_Result result = stream.Read(uuid, 16);\n if (AP4_FAILED(result)) return result;\n \n if (AP4_CompareMemory(uuid, AP4_UUID_PIFF_TRACK_ENCRYPTION_ATOM, 16) == 0) {\n atom = AP4_PiffTrackEncryptionAtom::Create((AP4_UI32)size_64, stream);\n } else if (AP4_CompareMemory(uuid, AP4_UUID_PIFF_SAMPLE_ENCRYPTION_ATOM, 16) == 0) {\n atom = AP4_PiffSampleEncryptionAtom::Create((AP4_UI32)size_64, stream);\n } else {\n atom = new AP4_UnknownUuidAtom(size_64, uuid, stream);\n }\n break;\n }\n \n case AP4_ATOM_TYPE_8ID_:\n atom = new AP4_NullTerminatedStringAtom(type, size_64, stream);\n break;\n\n case AP4_ATOM_TYPE_8BDL:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_8bdlAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_DREF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_DrefAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_URL:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_UrlAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ELST:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_ElstAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_VMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_VmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_NMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_NmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_STHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SthdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_HMHD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_HmhdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_FRMA:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_FrmaAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SCHM:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SchmAtom::Create(size_32, &m_ContextStack, stream);\n break;\n\n case AP4_ATOM_TYPE_FTYP:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_FtypAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_TIMS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TimsAtom::Create(size_32, stream);\n break;\n \n case AP4_ATOM_TYPE_SDP_:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SdpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IKMS:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IkmsAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ISFM:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IsfmAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ISLT:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IsltAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_ODHE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OdheAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_OHDR:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OhdrAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_ODDA:\n atom = AP4_OddaAtom::Create(size_64, stream);\n break;\n\n case AP4_ATOM_TYPE_ODAF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_OdafAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_GRPI:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_GrpiAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_IPRO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_IproAtom::Create(size_32, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_RTP_:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_RtpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TFDT:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TfdtAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_TENC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TencAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SENC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SencAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SAIZ:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SaizAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SAIO:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SaioAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_PDIN:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_PdinAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_BLOC:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_BlocAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_AINF:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_AinfAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_PSSH:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_PsshAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SIDX:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SidxAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SBGP:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SbgpAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_SGPD:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_SgpdAtom::Create(size_32, stream);\n break;\n\n case AP4_ATOM_TYPE_MKID:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n if (GetContext() == AP4_ATOM_TYPE_MARL) {\n atom = AP4_MkidAtom::Create(size_32, stream);\n }\n break;\n\n case AP4_ATOM_TYPE_DEC3:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n if (GetContext() == AP4_ATOM_TYPE_EC_3 || GetContext() == AP4_ATOM_TYPE_ENCA) {\n atom = AP4_Dec3Atom::Create(size_32, stream);\n }\n break;\n\n // track ref types\n case AP4_ATOM_TYPE_HINT:\n case AP4_ATOM_TYPE_CDSC:\n case AP4_ATOM_TYPE_SYNC:\n case AP4_ATOM_TYPE_MPOD:\n case AP4_ATOM_TYPE_DPND:\n case AP4_ATOM_TYPE_IPIR:\n case AP4_ATOM_TYPE_ALIS:\n case AP4_ATOM_TYPE_CHAP:\n if (GetContext() == AP4_ATOM_TYPE_TREF) {\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_TrefTypeAtom::Create(type, size_32, stream);\n }\n break;\n\n #endif // AP4_CONFIG_MINI_BUILD\n\n // container atoms\n case AP4_ATOM_TYPE_MOOF:\n case AP4_ATOM_TYPE_MVEX:\n case AP4_ATOM_TYPE_TRAF:\n case AP4_ATOM_TYPE_TREF:\n case AP4_ATOM_TYPE_MFRA:\n case AP4_ATOM_TYPE_HNTI:\n case AP4_ATOM_TYPE_STBL:\n case AP4_ATOM_TYPE_MDIA:\n case AP4_ATOM_TYPE_DINF:\n case AP4_ATOM_TYPE_MINF:\n case AP4_ATOM_TYPE_SCHI:\n case AP4_ATOM_TYPE_SINF:\n case AP4_ATOM_TYPE_UDTA:\n case AP4_ATOM_TYPE_ILST:\n case AP4_ATOM_TYPE_EDTS: \n case AP4_ATOM_TYPE_MDRI:\n case AP4_ATOM_TYPE_WAVE:\n if (atom_is_large) return AP4_ERROR_INVALID_FORMAT;\n atom = AP4_ContainerAtom::Create(type, size_64, false, force_64, stream, *this);\n break;\n\n // containers, only at the top\n case AP4_ATOM_TYPE_MARL:\n if (GetContext() == 0) {\n atom = AP4_ContainerAtom::Create(type, size_64, false, force_64, stream, *this);\n }\n break;\n \n // full container atoms\n case AP4_ATOM_TYPE_META:\n case AP4_ATOM_TYPE_ODRM:\n case AP4_ATOM_TYPE_ODKM:\n atom = AP4_ContainerAtom::Create(type, size_64, true, force_64, stream, *this);\n break;\n\n case AP4_ATOM_TYPE_FREE:\n case AP4_ATOM_TYPE_WIDE:\n case AP4_ATOM_TYPE_MDAT:\n // generic atoms\n break;\n \n default: {\n // try all the external type handlers\n AP4_List::Item* handler_item = m_TypeHandlers.FirstItem();\n while (handler_item) {\n TypeHandler* handler = handler_item->GetData();\n if (AP4_SUCCEEDED(handler->CreateAtom(type, size_32, stream, GetContext(), atom))) {\n break;\n }\n handler_item = handler_item->GetNext();\n }\n\n break;\n }\n }\n }\n \n return AP4_SUCCESS;\n}","lang":"cpp","vul_type":"cwe-476","sven_meta":{"func_name":"AP4_AtomFactory::CreateAtomFromStream","file_name":"Source/C++/Core/Ap4AtomFactory.cpp","commit_link":"github.com/axiomatic-systems/Bento4/commit/be7185faf7f52674028977dcf501c6039ff03aa5","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#28-da074368d1c7","input":"file_transfer_t *imcb_file_send_start(struct im_connection *ic, char *handle, char *file_name, size_t file_size)\n{\n\tbee_t *bee = ic->bee;\n\tbee_user_t *bu = bee_user_by_handle(bee, ic, handle);\n\n\tif (bee->ui->ft_in_start) {\n\t\treturn bee->ui->ft_in_start(bee, bu, file_name, file_size);\n\t} else {\n\t\treturn NULL;\n\t}\n}","target":"file_transfer_t *imcb_file_send_start(struct im_connection *ic, char *handle, char *file_name, size_t file_size)\n{\n\tbee_t *bee = ic->bee;\n\tbee_user_t *bu = bee_user_by_handle(bee, ic, handle);\n\n\tif (bee->ui->ft_in_start && bu) {\n\t\treturn bee->ui->ft_in_start(bee, bu, file_name, file_size);\n\t} else {\n\t\treturn NULL;\n\t}\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"imcb_file_send_start","file_name":"protocols/bee_ft.c","commit_link":"github.com/bitlbee/bitlbee/commit/701ab8129ba9ea64f569daedca9a8603abad740f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#29-fdedee012c88","input":"static int mpeg4video_probe(AVProbeData *probe_packet)\n{\n uint32_t temp_buffer = -1;\n int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0;\n int i;\n\n for (i = 0; i < probe_packet->buf_size; i++) {\n temp_buffer = (temp_buffer << 8) + probe_packet->buf[i];\n if ((temp_buffer & 0xffffff00) != 0x100)\n continue;\n\n if (temp_buffer == VOP_START_CODE)\n VOP++;\n else if (temp_buffer == VISUAL_OBJECT_START_CODE)\n VISO++;\n else if (temp_buffer < 0x120)\n VO++;\n else if (temp_buffer < 0x130)\n VOL++;\n else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) &&\n !(0x1B9 < temp_buffer && temp_buffer < 0x1C4))\n res++;\n }\n\n if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res == 0)\n return AVPROBE_SCORE_EXTENSION;\n return 0;\n}","target":"static int mpeg4video_probe(AVProbeData *probe_packet)\n{\n uint32_t temp_buffer = -1;\n int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0;\n int i;\n\n for (i = 0; i < probe_packet->buf_size; i++) {\n temp_buffer = (temp_buffer << 8) + probe_packet->buf[i];\n if (temp_buffer & 0xfffffe00)\n continue;\n if (temp_buffer < 2)\n continue;\n\n if (temp_buffer == VOP_START_CODE)\n VOP++;\n else if (temp_buffer == VISUAL_OBJECT_START_CODE)\n VISO++;\n else if (temp_buffer >= 0x100 && temp_buffer < 0x120)\n VO++;\n else if (temp_buffer >= 0x120 && temp_buffer < 0x130)\n VOL++;\n else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) &&\n !(0x1B9 < temp_buffer && temp_buffer < 0x1C4))\n res++;\n }\n\n if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res == 0)\n return AVPROBE_SCORE_EXTENSION;\n return 0;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"mpeg4video_probe","file_name":"libavformat/m4vdec.c","commit_link":"github.com/libav/libav/commit/e5b019725f53b79159931d3a7317107cbbfd0860","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#30-0faa609ba58a","input":"int megasas_alloc_cmds(struct megasas_instance *instance)\n{\n\tint i;\n\tint j;\n\tu16 max_cmd;\n\tstruct megasas_cmd *cmd;\n\n\tmax_cmd = instance->max_mfi_cmds;\n\n\t/*\n\t * instance->cmd_list is an array of struct megasas_cmd pointers.\n\t * Allocate the dynamic array first and then allocate individual\n\t * commands.\n\t */\n\tinstance->cmd_list = kcalloc(max_cmd, sizeof(struct megasas_cmd*), GFP_KERNEL);\n\n\tif (!instance->cmd_list) {\n\t\tdev_printk(KERN_DEBUG, &instance->pdev->dev, \"out of memory\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tmemset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) *max_cmd);\n\n\tfor (i = 0; i < max_cmd; i++) {\n\t\tinstance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd),\n\t\t\t\t\t\tGFP_KERNEL);\n\n\t\tif (!instance->cmd_list[i]) {\n\n\t\t\tfor (j = 0; j < i; j++)\n\t\t\t\tkfree(instance->cmd_list[j]);\n\n\t\t\tkfree(instance->cmd_list);\n\t\t\tinstance->cmd_list = NULL;\n\n\t\t\treturn -ENOMEM;\n\t\t}\n\t}\n\n\tfor (i = 0; i < max_cmd; i++) {\n\t\tcmd = instance->cmd_list[i];\n\t\tmemset(cmd, 0, sizeof(struct megasas_cmd));\n\t\tcmd->index = i;\n\t\tcmd->scmd = NULL;\n\t\tcmd->instance = instance;\n\n\t\tlist_add_tail(&cmd->list, &instance->cmd_pool);\n\t}\n\n\t/*\n\t * Create a frame pool and assign one frame to each cmd\n\t */\n\tif (megasas_create_frame_pool(instance)) {\n\t\tdev_printk(KERN_DEBUG, &instance->pdev->dev, \"Error creating frame DMA pool\\n\");\n\t\tmegasas_free_cmds(instance);\n\t}\n\n\treturn 0;\n}","target":"int megasas_alloc_cmds(struct megasas_instance *instance)\n{\n\tint i;\n\tint j;\n\tu16 max_cmd;\n\tstruct megasas_cmd *cmd;\n\n\tmax_cmd = instance->max_mfi_cmds;\n\n\t/*\n\t * instance->cmd_list is an array of struct megasas_cmd pointers.\n\t * Allocate the dynamic array first and then allocate individual\n\t * commands.\n\t */\n\tinstance->cmd_list = kcalloc(max_cmd, sizeof(struct megasas_cmd*), GFP_KERNEL);\n\n\tif (!instance->cmd_list) {\n\t\tdev_printk(KERN_DEBUG, &instance->pdev->dev, \"out of memory\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tmemset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) *max_cmd);\n\n\tfor (i = 0; i < max_cmd; i++) {\n\t\tinstance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd),\n\t\t\t\t\t\tGFP_KERNEL);\n\n\t\tif (!instance->cmd_list[i]) {\n\n\t\t\tfor (j = 0; j < i; j++)\n\t\t\t\tkfree(instance->cmd_list[j]);\n\n\t\t\tkfree(instance->cmd_list);\n\t\t\tinstance->cmd_list = NULL;\n\n\t\t\treturn -ENOMEM;\n\t\t}\n\t}\n\n\tfor (i = 0; i < max_cmd; i++) {\n\t\tcmd = instance->cmd_list[i];\n\t\tmemset(cmd, 0, sizeof(struct megasas_cmd));\n\t\tcmd->index = i;\n\t\tcmd->scmd = NULL;\n\t\tcmd->instance = instance;\n\n\t\tlist_add_tail(&cmd->list, &instance->cmd_pool);\n\t}\n\n\t/*\n\t * Create a frame pool and assign one frame to each cmd\n\t */\n\tif (megasas_create_frame_pool(instance)) {\n\t\tdev_printk(KERN_DEBUG, &instance->pdev->dev, \"Error creating frame DMA pool\\n\");\n\t\tmegasas_free_cmds(instance);\n\t\treturn -ENOMEM;\n\t}\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"megasas_alloc_cmds","file_name":"drivers/scsi/megaraid/megaraid_sas_base.c","commit_link":"github.com/torvalds/linux/commit/bcf3b67d16a4c8ffae0aa79de5853435e683945c","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#31-c1bc78913b6e","input":"IRC_PROTOCOL_CALLBACK(352)\n{\n char *pos_attr, *pos_hopcount, *pos_realname, *str_host;\n int arg_start, length;\n struct t_irc_channel *ptr_channel;\n struct t_irc_nick *ptr_nick;\n\n IRC_PROTOCOL_MIN_ARGS(5);\n\n /* silently ignore malformed 352 message (missing infos) */\n if (argc < 8)\n return WEECHAT_RC_OK;\n\n pos_attr = NULL;\n pos_hopcount = NULL;\n pos_realname = NULL;\n\n if (argc > 8)\n {\n arg_start = (strcmp (argv[8], \"*\") == 0) ? 9 : 8;\n if (argv[arg_start][0] == ':')\n {\n pos_attr = NULL;\n pos_hopcount = (argc > arg_start) ? argv[arg_start] + 1 : NULL;\n pos_realname = (argc > arg_start + 1) ? argv_eol[arg_start + 1] : NULL;\n }\n else\n {\n pos_attr = argv[arg_start];\n pos_hopcount = (argc > arg_start + 1) ? argv[arg_start + 1] + 1 : NULL;\n pos_realname = (argc > arg_start + 2) ? argv_eol[arg_start + 2] : NULL;\n }\n }\n\n ptr_channel = irc_channel_search (server, argv[3]);\n ptr_nick = (ptr_channel) ?\n irc_nick_search (server, ptr_channel, argv[7]) : NULL;\n\n /* update host in nick */\n if (ptr_nick)\n {\n length = strlen (argv[4]) + 1 + strlen (argv[5]) + 1;\n str_host = malloc (length);\n if (str_host)\n {\n snprintf (str_host, length, \"%s@%s\", argv[4], argv[5]);\n irc_nick_set_host (ptr_nick, str_host);\n free (str_host);\n }\n }\n\n /* update away flag in nick */\n if (ptr_channel && ptr_nick && pos_attr)\n {\n irc_nick_set_away (server, ptr_channel, ptr_nick,\n (pos_attr[0] == 'G') ? 1 : 0);\n }\n\n /* update realname in nick */\n if (ptr_channel && ptr_nick && pos_realname)\n {\n if (ptr_nick->realname)\n free (ptr_nick->realname);\n if (pos_realname &&\n weechat_hashtable_has_key (server->cap_list, \"extended-join\"))\n {\n ptr_nick->realname = strdup (pos_realname);\n }\n else\n {\n ptr_nick->realname = NULL;\n }\n }\n\n /* display output of who (manual who from user) */\n if (!ptr_channel || (ptr_channel->checking_whox <= 0))\n {\n weechat_printf_date_tags (\n irc_msgbuffer_get_target_buffer (\n server, NULL, command, \"who\", NULL),\n date,\n irc_protocol_tags (command, \"irc_numeric\", NULL, NULL),\n \"%s%s[%s%s%s] %s%s %s(%s%s@%s%s)%s %s%s%s%s(%s)\",\n weechat_prefix (\"network\"),\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_CHAT_CHANNEL,\n argv[3],\n IRC_COLOR_CHAT_DELIMITERS,\n irc_nick_color_for_msg (server, 1, NULL, argv[7]),\n argv[7],\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_CHAT_HOST,\n argv[4],\n argv[5],\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_RESET,\n (pos_attr) ? pos_attr : \"\",\n (pos_attr) ? \" \" : \"\",\n (pos_hopcount) ? pos_hopcount : \"\",\n (pos_hopcount) ? \" \" : \"\",\n (pos_realname) ? pos_realname : \"\");\n }\n\n return WEECHAT_RC_OK;\n}","target":"IRC_PROTOCOL_CALLBACK(352)\n{\n char *pos_attr, *pos_hopcount, *pos_realname, *str_host;\n int arg_start, length;\n struct t_irc_channel *ptr_channel;\n struct t_irc_nick *ptr_nick;\n\n IRC_PROTOCOL_MIN_ARGS(5);\n\n /* silently ignore malformed 352 message (missing infos) */\n if (argc < 8)\n return WEECHAT_RC_OK;\n\n pos_attr = NULL;\n pos_hopcount = NULL;\n pos_realname = NULL;\n\n if (argc > 8)\n {\n arg_start = ((argc > 9) && (strcmp (argv[8], \"*\") == 0)) ? 9 : 8;\n if (argv[arg_start][0] == ':')\n {\n pos_attr = NULL;\n pos_hopcount = (argc > arg_start) ? argv[arg_start] + 1 : NULL;\n pos_realname = (argc > arg_start + 1) ? argv_eol[arg_start + 1] : NULL;\n }\n else\n {\n pos_attr = argv[arg_start];\n pos_hopcount = (argc > arg_start + 1) ? argv[arg_start + 1] + 1 : NULL;\n pos_realname = (argc > arg_start + 2) ? argv_eol[arg_start + 2] : NULL;\n }\n }\n\n ptr_channel = irc_channel_search (server, argv[3]);\n ptr_nick = (ptr_channel) ?\n irc_nick_search (server, ptr_channel, argv[7]) : NULL;\n\n /* update host in nick */\n if (ptr_nick)\n {\n length = strlen (argv[4]) + 1 + strlen (argv[5]) + 1;\n str_host = malloc (length);\n if (str_host)\n {\n snprintf (str_host, length, \"%s@%s\", argv[4], argv[5]);\n irc_nick_set_host (ptr_nick, str_host);\n free (str_host);\n }\n }\n\n /* update away flag in nick */\n if (ptr_channel && ptr_nick && pos_attr)\n {\n irc_nick_set_away (server, ptr_channel, ptr_nick,\n (pos_attr[0] == 'G') ? 1 : 0);\n }\n\n /* update realname in nick */\n if (ptr_channel && ptr_nick && pos_realname)\n {\n if (ptr_nick->realname)\n free (ptr_nick->realname);\n if (pos_realname &&\n weechat_hashtable_has_key (server->cap_list, \"extended-join\"))\n {\n ptr_nick->realname = strdup (pos_realname);\n }\n else\n {\n ptr_nick->realname = NULL;\n }\n }\n\n /* display output of who (manual who from user) */\n if (!ptr_channel || (ptr_channel->checking_whox <= 0))\n {\n weechat_printf_date_tags (\n irc_msgbuffer_get_target_buffer (\n server, NULL, command, \"who\", NULL),\n date,\n irc_protocol_tags (command, \"irc_numeric\", NULL, NULL),\n \"%s%s[%s%s%s] %s%s %s(%s%s@%s%s)%s %s%s%s%s(%s)\",\n weechat_prefix (\"network\"),\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_CHAT_CHANNEL,\n argv[3],\n IRC_COLOR_CHAT_DELIMITERS,\n irc_nick_color_for_msg (server, 1, NULL, argv[7]),\n argv[7],\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_CHAT_HOST,\n argv[4],\n argv[5],\n IRC_COLOR_CHAT_DELIMITERS,\n IRC_COLOR_RESET,\n (pos_attr) ? pos_attr : \"\",\n (pos_attr) ? \" \" : \"\",\n (pos_hopcount) ? pos_hopcount : \"\",\n (pos_hopcount) ? \" \" : \"\",\n (pos_realname) ? pos_realname : \"\");\n }\n\n return WEECHAT_RC_OK;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"IRC_PROTOCOL_CALLBACK","file_name":"src/plugins/irc/irc-protocol.c","commit_link":"github.com/weechat/weechat/commit/9904cb6d2eb40f679d8ff6557c22d53a3e3dc75a","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#32-34050c5ba3ac","input":"xfs_attr_shortform_to_leaf(\n\tstruct xfs_da_args\t*args,\n\tstruct xfs_buf\t\t**leaf_bp)\n{\n\txfs_inode_t *dp;\n\txfs_attr_shortform_t *sf;\n\txfs_attr_sf_entry_t *sfe;\n\txfs_da_args_t nargs;\n\tchar *tmpbuffer;\n\tint error, i, size;\n\txfs_dablk_t blkno;\n\tstruct xfs_buf *bp;\n\txfs_ifork_t *ifp;\n\n\ttrace_xfs_attr_sf_to_leaf(args);\n\n\tdp = args->dp;\n\tifp = dp->i_afp;\n\tsf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;\n\tsize = be16_to_cpu(sf->hdr.totsize);\n\ttmpbuffer = kmem_alloc(size, KM_SLEEP);\n\tASSERT(tmpbuffer != NULL);\n\tmemcpy(tmpbuffer, ifp->if_u1.if_data, size);\n\tsf = (xfs_attr_shortform_t *)tmpbuffer;\n\n\txfs_idata_realloc(dp, -size, XFS_ATTR_FORK);\n\txfs_bmap_local_to_extents_empty(dp, XFS_ATTR_FORK);\n\n\tbp = NULL;\n\terror = xfs_da_grow_inode(args, &blkno);\n\tif (error) {\n\t\t/*\n\t\t * If we hit an IO error middle of the transaction inside\n\t\t * grow_inode(), we may have inconsistent data. Bail out.\n\t\t */\n\t\tif (error == -EIO)\n\t\t\tgoto out;\n\t\txfs_idata_realloc(dp, size, XFS_ATTR_FORK);\t/* try to put */\n\t\tmemcpy(ifp->if_u1.if_data, tmpbuffer, size);\t/* it back */\n\t\tgoto out;\n\t}\n\n\tASSERT(blkno == 0);\n\terror = xfs_attr3_leaf_create(args, blkno, &bp);\n\tif (error) {\n\t\terror = xfs_da_shrink_inode(args, 0, bp);\n\t\tbp = NULL;\n\t\tif (error)\n\t\t\tgoto out;\n\t\txfs_idata_realloc(dp, size, XFS_ATTR_FORK);\t/* try to put */\n\t\tmemcpy(ifp->if_u1.if_data, tmpbuffer, size);\t/* it back */\n\t\tgoto out;\n\t}\n\n\tmemset((char *)&nargs, 0, sizeof(nargs));\n\tnargs.dp = dp;\n\tnargs.geo = args->geo;\n\tnargs.firstblock = args->firstblock;\n\tnargs.dfops = args->dfops;\n\tnargs.total = args->total;\n\tnargs.whichfork = XFS_ATTR_FORK;\n\tnargs.trans = args->trans;\n\tnargs.op_flags = XFS_DA_OP_OKNOENT;\n\n\tsfe = &sf->list[0];\n\tfor (i = 0; i < sf->hdr.count; i++) {\n\t\tnargs.name = sfe->nameval;\n\t\tnargs.namelen = sfe->namelen;\n\t\tnargs.value = &sfe->nameval[nargs.namelen];\n\t\tnargs.valuelen = sfe->valuelen;\n\t\tnargs.hashval = xfs_da_hashname(sfe->nameval,\n\t\t\t\t\t\tsfe->namelen);\n\t\tnargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);\n\t\terror = xfs_attr3_leaf_lookup_int(bp, &nargs); /* set a->index */\n\t\tASSERT(error == -ENOATTR);\n\t\terror = xfs_attr3_leaf_add(bp, &nargs);\n\t\tASSERT(error != -ENOSPC);\n\t\tif (error)\n\t\t\tgoto out;\n\t\tsfe = XFS_ATTR_SF_NEXTENTRY(sfe);\n\t}\n\terror = 0;\n\t*leaf_bp = bp;\nout:\n\tkmem_free(tmpbuffer);\n\treturn error;\n}","target":"xfs_attr_shortform_to_leaf(\n\tstruct xfs_da_args\t*args,\n\tstruct xfs_buf\t\t**leaf_bp)\n{\n\txfs_inode_t *dp;\n\txfs_attr_shortform_t *sf;\n\txfs_attr_sf_entry_t *sfe;\n\txfs_da_args_t nargs;\n\tchar *tmpbuffer;\n\tint error, i, size;\n\txfs_dablk_t blkno;\n\tstruct xfs_buf *bp;\n\txfs_ifork_t *ifp;\n\n\ttrace_xfs_attr_sf_to_leaf(args);\n\n\tdp = args->dp;\n\tifp = dp->i_afp;\n\tsf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;\n\tsize = be16_to_cpu(sf->hdr.totsize);\n\ttmpbuffer = kmem_alloc(size, KM_SLEEP);\n\tASSERT(tmpbuffer != NULL);\n\tmemcpy(tmpbuffer, ifp->if_u1.if_data, size);\n\tsf = (xfs_attr_shortform_t *)tmpbuffer;\n\n\txfs_idata_realloc(dp, -size, XFS_ATTR_FORK);\n\txfs_bmap_local_to_extents_empty(dp, XFS_ATTR_FORK);\n\n\tbp = NULL;\n\terror = xfs_da_grow_inode(args, &blkno);\n\tif (error) {\n\t\t/*\n\t\t * If we hit an IO error middle of the transaction inside\n\t\t * grow_inode(), we may have inconsistent data. Bail out.\n\t\t */\n\t\tif (error == -EIO)\n\t\t\tgoto out;\n\t\txfs_idata_realloc(dp, size, XFS_ATTR_FORK);\t/* try to put */\n\t\tmemcpy(ifp->if_u1.if_data, tmpbuffer, size);\t/* it back */\n\t\tgoto out;\n\t}\n\n\tASSERT(blkno == 0);\n\terror = xfs_attr3_leaf_create(args, blkno, &bp);\n\tif (error) {\n\t\t/* xfs_attr3_leaf_create may not have instantiated a block */\n\t\tif (bp && (xfs_da_shrink_inode(args, 0, bp) != 0))\n\t\t\tgoto out;\n\t\txfs_idata_realloc(dp, size, XFS_ATTR_FORK);\t/* try to put */\n\t\tmemcpy(ifp->if_u1.if_data, tmpbuffer, size);\t/* it back */\n\t\tgoto out;\n\t}\n\n\tmemset((char *)&nargs, 0, sizeof(nargs));\n\tnargs.dp = dp;\n\tnargs.geo = args->geo;\n\tnargs.firstblock = args->firstblock;\n\tnargs.dfops = args->dfops;\n\tnargs.total = args->total;\n\tnargs.whichfork = XFS_ATTR_FORK;\n\tnargs.trans = args->trans;\n\tnargs.op_flags = XFS_DA_OP_OKNOENT;\n\n\tsfe = &sf->list[0];\n\tfor (i = 0; i < sf->hdr.count; i++) {\n\t\tnargs.name = sfe->nameval;\n\t\tnargs.namelen = sfe->namelen;\n\t\tnargs.value = &sfe->nameval[nargs.namelen];\n\t\tnargs.valuelen = sfe->valuelen;\n\t\tnargs.hashval = xfs_da_hashname(sfe->nameval,\n\t\t\t\t\t\tsfe->namelen);\n\t\tnargs.flags = XFS_ATTR_NSP_ONDISK_TO_ARGS(sfe->flags);\n\t\terror = xfs_attr3_leaf_lookup_int(bp, &nargs); /* set a->index */\n\t\tASSERT(error == -ENOATTR);\n\t\terror = xfs_attr3_leaf_add(bp, &nargs);\n\t\tASSERT(error != -ENOSPC);\n\t\tif (error)\n\t\t\tgoto out;\n\t\tsfe = XFS_ATTR_SF_NEXTENTRY(sfe);\n\t}\n\terror = 0;\n\t*leaf_bp = bp;\nout:\n\tkmem_free(tmpbuffer);\n\treturn error;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"xfs_attr_shortform_to_leaf","file_name":"fs/xfs/libxfs/xfs_attr_leaf.c","commit_link":"github.com/torvalds/linux/commit/bb3d48dcf86a97dc25fe9fc2c11938e19cb4399a","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#33-ca73e800b7fb","input":"lys_restr_dup(struct lys_module *mod, struct lys_restr *old, int size, int shallow, struct unres_schema *unres)\n{\n struct lys_restr *result;\n int i;\n\n if (!size) {\n return NULL;\n }\n\n result = calloc(size, sizeof *result);\n LY_CHECK_ERR_RETURN(!result, LOGMEM(mod->ctx), NULL);\n\n for (i = 0; i < size; i++) {\n result[i].ext_size = old[i].ext_size;\n lys_ext_dup(mod->ctx, mod, old[i].ext, old[i].ext_size, &result[i], LYEXT_PAR_RESTR, &result[i].ext, shallow, unres);\n result[i].expr = lydict_insert(mod->ctx, old[i].expr, 0);\n result[i].dsc = lydict_insert(mod->ctx, old[i].dsc, 0);\n result[i].ref = lydict_insert(mod->ctx, old[i].ref, 0);\n result[i].eapptag = lydict_insert(mod->ctx, old[i].eapptag, 0);\n result[i].emsg = lydict_insert(mod->ctx, old[i].emsg, 0);\n }\n\n return result;\n}","target":"lys_restr_dup(struct lys_module *mod, struct lys_restr *old, int size, int shallow, struct unres_schema *unres)\n{\n struct lys_restr *result;\n int i;\n\n if (!size) {\n return NULL;\n }\n\n result = calloc(size, sizeof *result);\n LY_CHECK_ERR_RETURN(!result, LOGMEM(mod->ctx), NULL);\n\n for (i = 0; i < size; i++) {\n /* copying unresolved extensions is not supported */\n if (unres_schema_find(unres, -1, (void *)&old[i].ext, UNRES_EXT) == -1) {\n result[i].ext_size = old[i].ext_size;\n lys_ext_dup(mod->ctx, mod, old[i].ext, old[i].ext_size, &result[i], LYEXT_PAR_RESTR, &result[i].ext, shallow, unres);\n }\n result[i].expr = lydict_insert(mod->ctx, old[i].expr, 0);\n result[i].dsc = lydict_insert(mod->ctx, old[i].dsc, 0);\n result[i].ref = lydict_insert(mod->ctx, old[i].ref, 0);\n result[i].eapptag = lydict_insert(mod->ctx, old[i].eapptag, 0);\n result[i].emsg = lydict_insert(mod->ctx, old[i].emsg, 0);\n }\n\n return result;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"lys_restr_dup","file_name":"src/tree_schema.c","commit_link":"github.com/CESNET/libyang/commit/7852b272ef77f8098c35deea6c6f09cb78176f08","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#34-60e05cc6ab12","input":"static int nfc_genl_deactivate_target(struct sk_buff *skb,\n\t\t\t\t struct genl_info *info)\n{\n\tstruct nfc_dev *dev;\n\tu32 device_idx, target_idx;\n\tint rc;\n\n\tif (!info->attrs[NFC_ATTR_DEVICE_INDEX])\n\t\treturn -EINVAL;\n\n\tdevice_idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);\n\n\tdev = nfc_get_device(device_idx);\n\tif (!dev)\n\t\treturn -ENODEV;\n\n\ttarget_idx = nla_get_u32(info->attrs[NFC_ATTR_TARGET_INDEX]);\n\n\trc = nfc_deactivate_target(dev, target_idx, NFC_TARGET_MODE_SLEEP);\n\n\tnfc_put_device(dev);\n\treturn rc;\n}","target":"static int nfc_genl_deactivate_target(struct sk_buff *skb,\n\t\t\t\t struct genl_info *info)\n{\n\tstruct nfc_dev *dev;\n\tu32 device_idx, target_idx;\n\tint rc;\n\n\tif (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||\n\t !info->attrs[NFC_ATTR_TARGET_INDEX])\n\t\treturn -EINVAL;\n\n\tdevice_idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);\n\n\tdev = nfc_get_device(device_idx);\n\tif (!dev)\n\t\treturn -ENODEV;\n\n\ttarget_idx = nla_get_u32(info->attrs[NFC_ATTR_TARGET_INDEX]);\n\n\trc = nfc_deactivate_target(dev, target_idx, NFC_TARGET_MODE_SLEEP);\n\n\tnfc_put_device(dev);\n\treturn rc;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"nfc_genl_deactivate_target","file_name":"net/nfc/netlink.c","commit_link":"github.com/torvalds/linux/commit/385097a3675749cbc9e97c085c0e5dfe4269ca51","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#35-592789b9161c","input":"static int dnxhd_find_frame_end(DNXHDParserContext *dctx,\n const uint8_t *buf, int buf_size)\n{\n ParseContext *pc = &dctx->pc;\n uint64_t state = pc->state64;\n int pic_found = pc->frame_start_found;\n int i = 0;\n\n if (!pic_found) {\n for (i = 0; i < buf_size; i++) {\n state = (state << 8) | buf[i];\n if (ff_dnxhd_check_header_prefix(state & 0xffffffffff00LL) != 0) {\n i++;\n pic_found = 1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n break;\n }\n }\n }\n\n if (pic_found && !dctx->remaining) {\n if (!buf_size) /* EOF considered as end of frame */\n return 0;\n for (; i < buf_size; i++) {\n dctx->cur_byte++;\n state = (state << 8) | buf[i];\n\n if (dctx->cur_byte == 24) {\n dctx->h = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 26) {\n dctx->w = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 42) {\n int cid = (state >> 32) & 0xFFFFFFFF;\n\n if (cid <= 0)\n continue;\n\n dctx->remaining = avpriv_dnxhd_get_frame_size(cid);\n if (dctx->remaining <= 0) {\n dctx->remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);\n if (dctx->remaining <= 0)\n return dctx->remaining;\n }\n if (buf_size - i + 47 >= dctx->remaining) {\n int remaining = dctx->remaining;\n\n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n } else {\n dctx->remaining -= buf_size;\n }\n }\n }\n } else if (pic_found) {\n if (dctx->remaining > buf_size) {\n dctx->remaining -= buf_size;\n } else {\n int remaining = dctx->remaining;\n\n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n }\n }\n pc->frame_start_found = pic_found;\n pc->state64 = state;\n return END_NOT_FOUND;\n}","target":"static int dnxhd_find_frame_end(DNXHDParserContext *dctx,\n const uint8_t *buf, int buf_size)\n{\n ParseContext *pc = &dctx->pc;\n uint64_t state = pc->state64;\n int pic_found = pc->frame_start_found;\n int i = 0;\n\n if (!pic_found) {\n for (i = 0; i < buf_size; i++) {\n state = (state << 8) | buf[i];\n if (ff_dnxhd_check_header_prefix(state & 0xffffffffff00LL) != 0) {\n i++;\n pic_found = 1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n break;\n }\n }\n }\n\n if (pic_found && !dctx->remaining) {\n if (!buf_size) /* EOF considered as end of frame */\n return 0;\n for (; i < buf_size; i++) {\n dctx->cur_byte++;\n state = (state << 8) | buf[i];\n\n if (dctx->cur_byte == 24) {\n dctx->h = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 26) {\n dctx->w = (state >> 32) & 0xFFFF;\n } else if (dctx->cur_byte == 42) {\n int cid = (state >> 32) & 0xFFFFFFFF;\n int remaining;\n\n if (cid <= 0)\n continue;\n\n remaining = avpriv_dnxhd_get_frame_size(cid);\n if (remaining <= 0) {\n remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);\n if (remaining <= 0)\n continue;\n }\n dctx->remaining = remaining;\n if (buf_size - i + 47 >= dctx->remaining) {\n int remaining = dctx->remaining;\n\n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n } else {\n dctx->remaining -= buf_size;\n }\n }\n }\n } else if (pic_found) {\n if (dctx->remaining > buf_size) {\n dctx->remaining -= buf_size;\n } else {\n int remaining = dctx->remaining;\n\n pc->frame_start_found = 0;\n pc->state64 = -1;\n dctx->cur_byte = 0;\n dctx->remaining = 0;\n return remaining;\n }\n }\n pc->frame_start_found = pic_found;\n pc->state64 = state;\n return END_NOT_FOUND;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"dnxhd_find_frame_end","file_name":"libavcodec/dnxhd_parser.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/0a709e2a10b8288a0cc383547924ecfe285cef89","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#36-a1968fc7633e","input":"static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,\n\t\t\t\tu64 *cookie_ret, struct rds_mr **mr_ret)\n{\n\tstruct rds_mr *mr = NULL, *found;\n\tunsigned int nr_pages;\n\tstruct page **pages = NULL;\n\tstruct scatterlist *sg;\n\tvoid *trans_private;\n\tunsigned long flags;\n\trds_rdma_cookie_t cookie;\n\tunsigned int nents;\n\tlong i;\n\tint ret;\n\n\tif (rs->rs_bound_addr == 0) {\n\t\tret = -ENOTCONN; /* XXX not a great errno */\n\t\tgoto out;\n\t}\n\n\tif (!rs->rs_transport->get_mr) {\n\t\tret = -EOPNOTSUPP;\n\t\tgoto out;\n\t}\n\n\tnr_pages = rds_pages_in_vec(&args->vec);\n\tif (nr_pages == 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\t/* Restrict the size of mr irrespective of underlying transport\n\t * To account for unaligned mr regions, subtract one from nr_pages\n\t */\n\tif ((nr_pages - 1) > (RDS_MAX_MSG_SIZE >> PAGE_SHIFT)) {\n\t\tret = -EMSGSIZE;\n\t\tgoto out;\n\t}\n\n\trdsdebug(\"RDS: get_mr addr %llx len %llu nr_pages %u\\n\",\n\t\targs->vec.addr, args->vec.bytes, nr_pages);\n\n\t/* XXX clamp nr_pages to limit the size of this alloc? */\n\tpages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);\n\tif (!pages) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\n\tmr = kzalloc(sizeof(struct rds_mr), GFP_KERNEL);\n\tif (!mr) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\n\trefcount_set(&mr->r_refcount, 1);\n\tRB_CLEAR_NODE(&mr->r_rb_node);\n\tmr->r_trans = rs->rs_transport;\n\tmr->r_sock = rs;\n\n\tif (args->flags & RDS_RDMA_USE_ONCE)\n\t\tmr->r_use_once = 1;\n\tif (args->flags & RDS_RDMA_INVALIDATE)\n\t\tmr->r_invalidate = 1;\n\tif (args->flags & RDS_RDMA_READWRITE)\n\t\tmr->r_write = 1;\n\n\t/*\n\t * Pin the pages that make up the user buffer and transfer the page\n\t * pointers to the mr's sg array. We check to see if we've mapped\n\t * the whole region after transferring the partial page references\n\t * to the sg array so that we can have one page ref cleanup path.\n\t *\n\t * For now we have no flag that tells us whether the mapping is\n\t * r/o or r/w. We need to assume r/w, or we'll do a lot of RDMA to\n\t * the zero page.\n\t */\n\tret = rds_pin_pages(args->vec.addr, nr_pages, pages, 1);\n\tif (ret < 0)\n\t\tgoto out;\n\n\tnents = ret;\n\tsg = kcalloc(nents, sizeof(*sg), GFP_KERNEL);\n\tif (!sg) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\tWARN_ON(!nents);\n\tsg_init_table(sg, nents);\n\n\t/* Stick all pages into the scatterlist */\n\tfor (i = 0 ; i < nents; i++)\n\t\tsg_set_page(&sg[i], pages[i], PAGE_SIZE, 0);\n\n\trdsdebug(\"RDS: trans_private nents is %u\\n\", nents);\n\n\t/* Obtain a transport specific MR. If this succeeds, the\n\t * s/g list is now owned by the MR.\n\t * Note that dma_map() implies that pending writes are\n\t * flushed to RAM, so no dma_sync is needed here. */\n\ttrans_private = rs->rs_transport->get_mr(sg, nents, rs,\n\t\t\t\t\t\t &mr->r_key);\n\n\tif (IS_ERR(trans_private)) {\n\t\tfor (i = 0 ; i < nents; i++)\n\t\t\tput_page(sg_page(&sg[i]));\n\t\tkfree(sg);\n\t\tret = PTR_ERR(trans_private);\n\t\tgoto out;\n\t}\n\n\tmr->r_trans_private = trans_private;\n\n\trdsdebug(\"RDS: get_mr put_user key is %x cookie_addr %p\\n\",\n\t mr->r_key, (void *)(unsigned long) args->cookie_addr);\n\n\t/* The user may pass us an unaligned address, but we can only\n\t * map page aligned regions. So we keep the offset, and build\n\t * a 64bit cookie containing and pass that\n\t * around. */\n\tcookie = rds_rdma_make_cookie(mr->r_key, args->vec.addr & ~PAGE_MASK);\n\tif (cookie_ret)\n\t\t*cookie_ret = cookie;\n\n\tif (args->cookie_addr && put_user(cookie, (u64 __user *)(unsigned long) args->cookie_addr)) {\n\t\tret = -EFAULT;\n\t\tgoto out;\n\t}\n\n\t/* Inserting the new MR into the rbtree bumps its\n\t * reference count. */\n\tspin_lock_irqsave(&rs->rs_rdma_lock, flags);\n\tfound = rds_mr_tree_walk(&rs->rs_rdma_keys, mr->r_key, mr);\n\tspin_unlock_irqrestore(&rs->rs_rdma_lock, flags);\n\n\tBUG_ON(found && found != mr);\n\n\trdsdebug(\"RDS: get_mr key is %x\\n\", mr->r_key);\n\tif (mr_ret) {\n\t\trefcount_inc(&mr->r_refcount);\n\t\t*mr_ret = mr;\n\t}\n\n\tret = 0;\nout:\n\tkfree(pages);\n\tif (mr)\n\t\trds_mr_put(mr);\n\treturn ret;\n}","target":"static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,\n\t\t\t\tu64 *cookie_ret, struct rds_mr **mr_ret)\n{\n\tstruct rds_mr *mr = NULL, *found;\n\tunsigned int nr_pages;\n\tstruct page **pages = NULL;\n\tstruct scatterlist *sg;\n\tvoid *trans_private;\n\tunsigned long flags;\n\trds_rdma_cookie_t cookie;\n\tunsigned int nents;\n\tlong i;\n\tint ret;\n\n\tif (rs->rs_bound_addr == 0 || !rs->rs_transport) {\n\t\tret = -ENOTCONN; /* XXX not a great errno */\n\t\tgoto out;\n\t}\n\n\tif (!rs->rs_transport->get_mr) {\n\t\tret = -EOPNOTSUPP;\n\t\tgoto out;\n\t}\n\n\tnr_pages = rds_pages_in_vec(&args->vec);\n\tif (nr_pages == 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\t/* Restrict the size of mr irrespective of underlying transport\n\t * To account for unaligned mr regions, subtract one from nr_pages\n\t */\n\tif ((nr_pages - 1) > (RDS_MAX_MSG_SIZE >> PAGE_SHIFT)) {\n\t\tret = -EMSGSIZE;\n\t\tgoto out;\n\t}\n\n\trdsdebug(\"RDS: get_mr addr %llx len %llu nr_pages %u\\n\",\n\t\targs->vec.addr, args->vec.bytes, nr_pages);\n\n\t/* XXX clamp nr_pages to limit the size of this alloc? */\n\tpages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);\n\tif (!pages) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\n\tmr = kzalloc(sizeof(struct rds_mr), GFP_KERNEL);\n\tif (!mr) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\n\trefcount_set(&mr->r_refcount, 1);\n\tRB_CLEAR_NODE(&mr->r_rb_node);\n\tmr->r_trans = rs->rs_transport;\n\tmr->r_sock = rs;\n\n\tif (args->flags & RDS_RDMA_USE_ONCE)\n\t\tmr->r_use_once = 1;\n\tif (args->flags & RDS_RDMA_INVALIDATE)\n\t\tmr->r_invalidate = 1;\n\tif (args->flags & RDS_RDMA_READWRITE)\n\t\tmr->r_write = 1;\n\n\t/*\n\t * Pin the pages that make up the user buffer and transfer the page\n\t * pointers to the mr's sg array. We check to see if we've mapped\n\t * the whole region after transferring the partial page references\n\t * to the sg array so that we can have one page ref cleanup path.\n\t *\n\t * For now we have no flag that tells us whether the mapping is\n\t * r/o or r/w. We need to assume r/w, or we'll do a lot of RDMA to\n\t * the zero page.\n\t */\n\tret = rds_pin_pages(args->vec.addr, nr_pages, pages, 1);\n\tif (ret < 0)\n\t\tgoto out;\n\n\tnents = ret;\n\tsg = kcalloc(nents, sizeof(*sg), GFP_KERNEL);\n\tif (!sg) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\tWARN_ON(!nents);\n\tsg_init_table(sg, nents);\n\n\t/* Stick all pages into the scatterlist */\n\tfor (i = 0 ; i < nents; i++)\n\t\tsg_set_page(&sg[i], pages[i], PAGE_SIZE, 0);\n\n\trdsdebug(\"RDS: trans_private nents is %u\\n\", nents);\n\n\t/* Obtain a transport specific MR. If this succeeds, the\n\t * s/g list is now owned by the MR.\n\t * Note that dma_map() implies that pending writes are\n\t * flushed to RAM, so no dma_sync is needed here. */\n\ttrans_private = rs->rs_transport->get_mr(sg, nents, rs,\n\t\t\t\t\t\t &mr->r_key);\n\n\tif (IS_ERR(trans_private)) {\n\t\tfor (i = 0 ; i < nents; i++)\n\t\t\tput_page(sg_page(&sg[i]));\n\t\tkfree(sg);\n\t\tret = PTR_ERR(trans_private);\n\t\tgoto out;\n\t}\n\n\tmr->r_trans_private = trans_private;\n\n\trdsdebug(\"RDS: get_mr put_user key is %x cookie_addr %p\\n\",\n\t mr->r_key, (void *)(unsigned long) args->cookie_addr);\n\n\t/* The user may pass us an unaligned address, but we can only\n\t * map page aligned regions. So we keep the offset, and build\n\t * a 64bit cookie containing and pass that\n\t * around. */\n\tcookie = rds_rdma_make_cookie(mr->r_key, args->vec.addr & ~PAGE_MASK);\n\tif (cookie_ret)\n\t\t*cookie_ret = cookie;\n\n\tif (args->cookie_addr && put_user(cookie, (u64 __user *)(unsigned long) args->cookie_addr)) {\n\t\tret = -EFAULT;\n\t\tgoto out;\n\t}\n\n\t/* Inserting the new MR into the rbtree bumps its\n\t * reference count. */\n\tspin_lock_irqsave(&rs->rs_rdma_lock, flags);\n\tfound = rds_mr_tree_walk(&rs->rs_rdma_keys, mr->r_key, mr);\n\tspin_unlock_irqrestore(&rs->rs_rdma_lock, flags);\n\n\tBUG_ON(found && found != mr);\n\n\trdsdebug(\"RDS: get_mr key is %x\\n\", mr->r_key);\n\tif (mr_ret) {\n\t\trefcount_inc(&mr->r_refcount);\n\t\t*mr_ret = mr;\n\t}\n\n\tret = 0;\nout:\n\tkfree(pages);\n\tif (mr)\n\t\trds_mr_put(mr);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"__rds_rdma_map","file_name":"net/rds/rdma.c","commit_link":"github.com/torvalds/linux/commit/f3069c6d33f6ae63a1668737bc78aaaa51bff7ca","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#37-7763538b1dae","input":"daemon_AuthUserPwd(char *username, char *password, char *errbuf)\n{\n#ifdef _WIN32\n\t/*\n\t * Warning: the user which launches the process must have the\n\t * SE_TCB_NAME right.\n\t * This corresponds to have the \"Act as part of the Operating System\"\n\t * turned on (administrative tools, local security settings, local\n\t * policies, user right assignment)\n\t * However, it seems to me that if you run it as a service, this\n\t * right should be provided by default.\n\t *\n\t * XXX - hopefully, this returns errors such as ERROR_LOGON_FAILURE,\n\t * which merely indicates that the user name or password is\n\t * incorrect, not whether it's the user name or the password\n\t * that's incorrect, so a client that's trying to brute-force\n\t * accounts doesn't know whether it's the user name or the\n\t * password that's incorrect, so it doesn't know whether to\n\t * stop trying to log in with a given user name and move on\n\t * to another user name.\n\t */\n\tHANDLE Token;\n\tif (LogonUser(username, \".\", password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &Token) == 0)\n\t{\n\t\tpcap_fmt_errmsg_for_win32_err(errbuf, PCAP_ERRBUF_SIZE,\n\t\t GetLastError(), \"LogonUser() failed\");\n\t\treturn -1;\n\t}\n\n\t// This call should change the current thread to the selected user.\n\t// I didn't test it.\n\tif (ImpersonateLoggedOnUser(Token) == 0)\n\t{\n\t\tpcap_fmt_errmsg_for_win32_err(errbuf, PCAP_ERRBUF_SIZE,\n\t\t GetLastError(), \"ImpersonateLoggedOnUser() failed\");\n\t\tCloseHandle(Token);\n\t\treturn -1;\n\t}\n\n\tCloseHandle(Token);\n\treturn 0;\n\n#else\n\t/*\n\t * See\n\t *\n\t *\thttp://www.unixpapa.com/incnote/passwd.html\n\t *\n\t * We use the Solaris/Linux shadow password authentication if\n\t * we have getspnam(), otherwise we just do traditional\n\t * authentication, which, on some platforms, might work, even\n\t * with shadow passwords, if we're running as root. Traditional\n\t * authenticaion won't work if we're not running as root, as\n\t * I think these days all UN*Xes either won't return the password\n\t * at all with getpwnam() or will only do so if you're root.\n\t *\n\t * XXX - perhaps what we *should* be using is PAM, if we have\n\t * it. That might hide all the details of username/password\n\t * authentication, whether it's done with a visible-to-root-\n\t * only password database or some other authentication mechanism,\n\t * behind its API.\n\t */\n\tstruct passwd *user;\n\tchar *user_password;\n#ifdef HAVE_GETSPNAM\n\tstruct spwd *usersp;\n#endif\n\n\t// This call is needed to get the uid\n\tif ((user = getpwnam(username)) == NULL)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\n#ifdef HAVE_GETSPNAM\n\t// This call is needed to get the password; otherwise 'x' is returned\n\tif ((usersp = getspnam(username)) == NULL)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\tuser_password = usersp->sp_pwdp;\n#else\n\t/*\n\t * XXX - what about other platforms?\n\t * The unixpapa.com page claims this Just Works on *BSD if you're\n\t * running as root - it's from 2000, so it doesn't indicate whether\n\t * macOS (which didn't come out until 2001, under the name Mac OS\n\t * X) behaves like the *BSDs or not, and might also work on AIX.\n\t * HP-UX does something else.\n\t *\n\t * Again, hopefully PAM hides all that.\n\t */\n\tuser_password = user->pw_passwd;\n#endif\n\n\tif (strcmp(user_password, (char *) crypt(password, user_password)) != 0)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\n\tif (setuid(user->pw_uid))\n\t{\n\t\tpcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,\n\t\t errno, \"setuid\");\n\t\treturn -1;\n\t}\n\n/*\tif (setgid(user->pw_gid))\n\t{\n\t\tpcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,\n\t\t errno, \"setgid\");\n\t\treturn -1;\n\t}\n*/\n\treturn 0;\n\n#endif\n\n}","target":"daemon_AuthUserPwd(char *username, char *password, char *errbuf)\n{\n#ifdef _WIN32\n\t/*\n\t * Warning: the user which launches the process must have the\n\t * SE_TCB_NAME right.\n\t * This corresponds to have the \"Act as part of the Operating System\"\n\t * turned on (administrative tools, local security settings, local\n\t * policies, user right assignment)\n\t * However, it seems to me that if you run it as a service, this\n\t * right should be provided by default.\n\t *\n\t * XXX - hopefully, this returns errors such as ERROR_LOGON_FAILURE,\n\t * which merely indicates that the user name or password is\n\t * incorrect, not whether it's the user name or the password\n\t * that's incorrect, so a client that's trying to brute-force\n\t * accounts doesn't know whether it's the user name or the\n\t * password that's incorrect, so it doesn't know whether to\n\t * stop trying to log in with a given user name and move on\n\t * to another user name.\n\t */\n\tHANDLE Token;\n\tif (LogonUser(username, \".\", password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &Token) == 0)\n\t{\n\t\tpcap_fmt_errmsg_for_win32_err(errbuf, PCAP_ERRBUF_SIZE,\n\t\t GetLastError(), \"LogonUser() failed\");\n\t\treturn -1;\n\t}\n\n\t// This call should change the current thread to the selected user.\n\t// I didn't test it.\n\tif (ImpersonateLoggedOnUser(Token) == 0)\n\t{\n\t\tpcap_fmt_errmsg_for_win32_err(errbuf, PCAP_ERRBUF_SIZE,\n\t\t GetLastError(), \"ImpersonateLoggedOnUser() failed\");\n\t\tCloseHandle(Token);\n\t\treturn -1;\n\t}\n\n\tCloseHandle(Token);\n\treturn 0;\n\n#else\n\t/*\n\t * See\n\t *\n\t *\thttp://www.unixpapa.com/incnote/passwd.html\n\t *\n\t * We use the Solaris/Linux shadow password authentication if\n\t * we have getspnam(), otherwise we just do traditional\n\t * authentication, which, on some platforms, might work, even\n\t * with shadow passwords, if we're running as root. Traditional\n\t * authenticaion won't work if we're not running as root, as\n\t * I think these days all UN*Xes either won't return the password\n\t * at all with getpwnam() or will only do so if you're root.\n\t *\n\t * XXX - perhaps what we *should* be using is PAM, if we have\n\t * it. That might hide all the details of username/password\n\t * authentication, whether it's done with a visible-to-root-\n\t * only password database or some other authentication mechanism,\n\t * behind its API.\n\t */\n\tstruct passwd *user;\n\tchar *user_password;\n#ifdef HAVE_GETSPNAM\n\tstruct spwd *usersp;\n#endif\n\tchar *crypt_password;\n\n\t// This call is needed to get the uid\n\tif ((user = getpwnam(username)) == NULL)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\n#ifdef HAVE_GETSPNAM\n\t// This call is needed to get the password; otherwise 'x' is returned\n\tif ((usersp = getspnam(username)) == NULL)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\tuser_password = usersp->sp_pwdp;\n#else\n\t/*\n\t * XXX - what about other platforms?\n\t * The unixpapa.com page claims this Just Works on *BSD if you're\n\t * running as root - it's from 2000, so it doesn't indicate whether\n\t * macOS (which didn't come out until 2001, under the name Mac OS\n\t * X) behaves like the *BSDs or not, and might also work on AIX.\n\t * HP-UX does something else.\n\t *\n\t * Again, hopefully PAM hides all that.\n\t */\n\tuser_password = user->pw_passwd;\n#endif\n\n\tcrypt_password = crypt(password, user_password);\n\tif (crypt_password == NULL)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed\");\n\t\treturn -1;\n\t}\n\tif (strcmp(user_password, crypt_password) != 0)\n\t{\n\t\tpcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, \"Authentication failed: user name or password incorrect\");\n\t\treturn -1;\n\t}\n\n\tif (setuid(user->pw_uid))\n\t{\n\t\tpcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,\n\t\t errno, \"setuid\");\n\t\treturn -1;\n\t}\n\n/*\tif (setgid(user->pw_gid))\n\t{\n\t\tpcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,\n\t\t errno, \"setgid\");\n\t\treturn -1;\n\t}\n*/\n\treturn 0;\n\n#endif\n\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"daemon_AuthUserPwd","file_name":"rpcapd/daemon.c","commit_link":"github.com/the-tcpdump-group/libpcap/commit/437b273761adedcbd880f714bfa44afeec186a31","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#38-b39525545d30","input":"static int run(const CommandLineOptions& options)\n{\n\tIR::Module irModule;\n\n\t// Load the module.\n\tif(!loadModule(options.filename, irModule)) { return EXIT_FAILURE; }\n\tif(options.onlyCheck) { return EXIT_SUCCESS; }\n\n\t// Compile the module.\n\tRuntime::Module* module = nullptr;\n\tif(!options.precompiled) { module = Runtime::compileModule(irModule); }\n\telse\n\t{\n\t\tconst UserSection* precompiledObjectSection = nullptr;\n\t\tfor(const UserSection& userSection : irModule.userSections)\n\t\t{\n\t\t\tif(userSection.name == \"wavm.precompiled_object\")\n\t\t\t{\n\t\t\t\tprecompiledObjectSection = &userSection;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(!precompiledObjectSection)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Input file did not contain 'wavm.precompiled_object' section\");\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmodule = Runtime::loadPrecompiledModule(irModule, precompiledObjectSection->data);\n\t\t}\n\t}\n\n\t// Link the module with the intrinsic modules.\n\tCompartment* compartment = Runtime::createCompartment();\n\tContext* context = Runtime::createContext(compartment);\n\tRootResolver rootResolver(compartment);\n\n\tEmscripten::Instance* emscriptenInstance = nullptr;\n\tif(options.enableEmscripten)\n\t{\n\t\temscriptenInstance = Emscripten::instantiate(compartment, irModule);\n\t\tif(emscriptenInstance)\n\t\t{\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"env\", emscriptenInstance->env);\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"asm2wasm\", emscriptenInstance->asm2wasm);\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"global\", emscriptenInstance->global);\n\t\t}\n\t}\n\n\tif(options.enableThreadTest)\n\t{\n\t\tModuleInstance* threadTestInstance = ThreadTest::instantiate(compartment);\n\t\trootResolver.moduleNameToInstanceMap.set(\"threadTest\", threadTestInstance);\n\t}\n\n\tLinkResult linkResult = linkModule(irModule, rootResolver);\n\tif(!linkResult.success)\n\t{\n\t\tLog::printf(Log::error, \"Failed to link module:\\n\");\n\t\tfor(auto& missingImport : linkResult.missingImports)\n\t\t{\n\t\t\tLog::printf(Log::error,\n\t\t\t\t\t\t\"Missing import: module=\\\"%s\\\" export=\\\"%s\\\" type=\\\"%s\\\"\\n\",\n\t\t\t\t\t\tmissingImport.moduleName.c_str(),\n\t\t\t\t\t\tmissingImport.exportName.c_str(),\n\t\t\t\t\t\tasString(missingImport.type).c_str());\n\t\t}\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t// Instantiate the module.\n\tModuleInstance* moduleInstance = instantiateModule(\n\t\tcompartment, module, std::move(linkResult.resolvedImports), options.filename);\n\tif(!moduleInstance) { return EXIT_FAILURE; }\n\n\t// Call the module start function, if it has one.\n\tFunctionInstance* startFunction = getStartFunction(moduleInstance);\n\tif(startFunction) { invokeFunctionChecked(context, startFunction, {}); }\n\n\tif(options.enableEmscripten)\n\t{\n\t\t// Call the Emscripten global initalizers.\n\t\tEmscripten::initializeGlobals(context, irModule, moduleInstance);\n\t}\n\n\t// Look up the function export to call.\n\tFunctionInstance* functionInstance;\n\tif(!options.functionName)\n\t{\n\t\tfunctionInstance = asFunctionNullable(getInstanceExport(moduleInstance, \"main\"));\n\t\tif(!functionInstance)\n\t\t{ functionInstance = asFunctionNullable(getInstanceExport(moduleInstance, \"_main\")); }\n\t\tif(!functionInstance)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Module does not export main function\\n\");\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfunctionInstance\n\t\t\t= asFunctionNullable(getInstanceExport(moduleInstance, options.functionName));\n\t\tif(!functionInstance)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Module does not export '%s'\\n\", options.functionName);\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\tFunctionType functionType = getFunctionType(functionInstance);\n\n\t// Set up the arguments for the invoke.\n\tstd::vector invokeArgs;\n\tif(!options.functionName)\n\t{\n\t\tif(functionType.params().size() == 2)\n\t\t{\n\t\t\tMemoryInstance* defaultMemory = Runtime::getDefaultMemory(moduleInstance);\n\t\t\tif(!defaultMemory)\n\t\t\t{\n\t\t\t\tLog::printf(\n\t\t\t\t\tLog::error,\n\t\t\t\t\t\"Module does not declare a default memory object to put arguments in.\\n\");\n\t\t\t\treturn EXIT_FAILURE;\n\t\t\t}\n\n\t\t\tstd::vector argStrings;\n\t\t\targStrings.push_back(options.filename);\n\t\t\tchar** args = options.args;\n\t\t\twhile(*args) { argStrings.push_back(*args++); };\n\n\t\t\tEmscripten::injectCommandArgs(emscriptenInstance, argStrings, invokeArgs);\n\t\t}\n\t\telse if(functionType.params().size() > 0)\n\t\t{\n\t\t\tLog::printf(Log::error,\n\t\t\t\t\t\t\"WebAssembly function requires %\" PRIu64\n\t\t\t\t\t\t\" argument(s), but only 0 or 2 can be passed!\",\n\t\t\t\t\t\tfunctionType.params().size());\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(U32 i = 0; options.args[i]; ++i)\n\t\t{\n\t\t\tValue value;\n\t\t\tswitch(functionType.params()[i])\n\t\t\t{\n\t\t\tcase ValueType::i32: value = (U32)atoi(options.args[i]); break;\n\t\t\tcase ValueType::i64: value = (U64)atol(options.args[i]); break;\n\t\t\tcase ValueType::f32: value = (F32)atof(options.args[i]); break;\n\t\t\tcase ValueType::f64: value = atof(options.args[i]); break;\n\t\t\tcase ValueType::v128:\n\t\t\tcase ValueType::anyref:\n\t\t\tcase ValueType::anyfunc:\n\t\t\t\tErrors::fatalf(\"Cannot parse command-line argument for %s function parameter\",\n\t\t\t\t\t\t\t asString(functionType.params()[i]));\n\t\t\tdefault: Errors::unreachable();\n\t\t\t}\n\t\t\tinvokeArgs.push_back(value);\n\t\t}\n\t}\n\n\t// Invoke the function.\n\tTiming::Timer executionTimer;\n\tIR::ValueTuple functionResults = invokeFunctionChecked(context, functionInstance, invokeArgs);\n\tTiming::logTimer(\"Invoked function\", executionTimer);\n\n\tif(options.functionName)\n\t{\n\t\tLog::printf(Log::debug,\n\t\t\t\t\t\"%s returned: %s\\n\",\n\t\t\t\t\toptions.functionName,\n\t\t\t\t\tasString(functionResults).c_str());\n\t\treturn EXIT_SUCCESS;\n\t}\n\telse if(functionResults.size() == 1 && functionResults[0].type == ValueType::i32)\n\t{\n\t\treturn functionResults[0].i32;\n\t}\n\telse\n\t{\n\t\treturn EXIT_SUCCESS;\n\t}\n}","target":"static int run(const CommandLineOptions& options)\n{\n\tIR::Module irModule;\n\n\t// Load the module.\n\tif(!loadModule(options.filename, irModule)) { return EXIT_FAILURE; }\n\tif(options.onlyCheck) { return EXIT_SUCCESS; }\n\n\t// Compile the module.\n\tRuntime::Module* module = nullptr;\n\tif(!options.precompiled) { module = Runtime::compileModule(irModule); }\n\telse\n\t{\n\t\tconst UserSection* precompiledObjectSection = nullptr;\n\t\tfor(const UserSection& userSection : irModule.userSections)\n\t\t{\n\t\t\tif(userSection.name == \"wavm.precompiled_object\")\n\t\t\t{\n\t\t\t\tprecompiledObjectSection = &userSection;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(!precompiledObjectSection)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Input file did not contain 'wavm.precompiled_object' section\");\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmodule = Runtime::loadPrecompiledModule(irModule, precompiledObjectSection->data);\n\t\t}\n\t}\n\n\t// Link the module with the intrinsic modules.\n\tCompartment* compartment = Runtime::createCompartment();\n\tContext* context = Runtime::createContext(compartment);\n\tRootResolver rootResolver(compartment);\n\n\tEmscripten::Instance* emscriptenInstance = nullptr;\n\tif(options.enableEmscripten)\n\t{\n\t\temscriptenInstance = Emscripten::instantiate(compartment, irModule);\n\t\tif(emscriptenInstance)\n\t\t{\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"env\", emscriptenInstance->env);\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"asm2wasm\", emscriptenInstance->asm2wasm);\n\t\t\trootResolver.moduleNameToInstanceMap.set(\"global\", emscriptenInstance->global);\n\t\t}\n\t}\n\n\tif(options.enableThreadTest)\n\t{\n\t\tModuleInstance* threadTestInstance = ThreadTest::instantiate(compartment);\n\t\trootResolver.moduleNameToInstanceMap.set(\"threadTest\", threadTestInstance);\n\t}\n\n\tLinkResult linkResult = linkModule(irModule, rootResolver);\n\tif(!linkResult.success)\n\t{\n\t\tLog::printf(Log::error, \"Failed to link module:\\n\");\n\t\tfor(auto& missingImport : linkResult.missingImports)\n\t\t{\n\t\t\tLog::printf(Log::error,\n\t\t\t\t\t\t\"Missing import: module=\\\"%s\\\" export=\\\"%s\\\" type=\\\"%s\\\"\\n\",\n\t\t\t\t\t\tmissingImport.moduleName.c_str(),\n\t\t\t\t\t\tmissingImport.exportName.c_str(),\n\t\t\t\t\t\tasString(missingImport.type).c_str());\n\t\t}\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t// Instantiate the module.\n\tModuleInstance* moduleInstance = instantiateModule(\n\t\tcompartment, module, std::move(linkResult.resolvedImports), options.filename);\n\tif(!moduleInstance) { return EXIT_FAILURE; }\n\n\t// Call the module start function, if it has one.\n\tFunctionInstance* startFunction = getStartFunction(moduleInstance);\n\tif(startFunction) { invokeFunctionChecked(context, startFunction, {}); }\n\n\tif(options.enableEmscripten)\n\t{\n\t\t// Call the Emscripten global initalizers.\n\t\tEmscripten::initializeGlobals(context, irModule, moduleInstance);\n\t}\n\n\t// Look up the function export to call.\n\tFunctionInstance* functionInstance;\n\tif(!options.functionName)\n\t{\n\t\tfunctionInstance = asFunctionNullable(getInstanceExport(moduleInstance, \"main\"));\n\t\tif(!functionInstance)\n\t\t{ functionInstance = asFunctionNullable(getInstanceExport(moduleInstance, \"_main\")); }\n\t\tif(!functionInstance)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Module does not export main function\\n\");\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfunctionInstance\n\t\t\t= asFunctionNullable(getInstanceExport(moduleInstance, options.functionName));\n\t\tif(!functionInstance)\n\t\t{\n\t\t\tLog::printf(Log::error, \"Module does not export '%s'\\n\", options.functionName);\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\tFunctionType functionType = getFunctionType(functionInstance);\n\n\t// Set up the arguments for the invoke.\n\tstd::vector invokeArgs;\n\tif(!options.functionName)\n\t{\n\t\tif(functionType.params().size() == 2)\n\t\t{\n\t\t\tif(!emscriptenInstance)\n\t\t\t{\n\t\t\t\tLog::printf(\n\t\t\t\t\tLog::error,\n\t\t\t\t\t\"Module does not declare a default memory object to put arguments in.\\n\");\n\t\t\t\treturn EXIT_FAILURE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tstd::vector argStrings;\n\t\t\t\targStrings.push_back(options.filename);\n\t\t\t\tchar** args = options.args;\n\t\t\t\twhile(*args) { argStrings.push_back(*args++); };\n\n\t\t\t\twavmAssert(emscriptenInstance);\n\t\t\t\tEmscripten::injectCommandArgs(emscriptenInstance, argStrings, invokeArgs);\n\t\t\t}\n\t\t}\n\t\telse if(functionType.params().size() > 0)\n\t\t{\n\t\t\tLog::printf(Log::error,\n\t\t\t\t\t\t\"WebAssembly function requires %\" PRIu64\n\t\t\t\t\t\t\" argument(s), but only 0 or 2 can be passed!\",\n\t\t\t\t\t\tfunctionType.params().size());\n\t\t\treturn EXIT_FAILURE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(U32 i = 0; options.args[i]; ++i)\n\t\t{\n\t\t\tValue value;\n\t\t\tswitch(functionType.params()[i])\n\t\t\t{\n\t\t\tcase ValueType::i32: value = (U32)atoi(options.args[i]); break;\n\t\t\tcase ValueType::i64: value = (U64)atol(options.args[i]); break;\n\t\t\tcase ValueType::f32: value = (F32)atof(options.args[i]); break;\n\t\t\tcase ValueType::f64: value = atof(options.args[i]); break;\n\t\t\tcase ValueType::v128:\n\t\t\tcase ValueType::anyref:\n\t\t\tcase ValueType::anyfunc:\n\t\t\t\tErrors::fatalf(\"Cannot parse command-line argument for %s function parameter\",\n\t\t\t\t\t\t\t asString(functionType.params()[i]));\n\t\t\tdefault: Errors::unreachable();\n\t\t\t}\n\t\t\tinvokeArgs.push_back(value);\n\t\t}\n\t}\n\n\t// Invoke the function.\n\tTiming::Timer executionTimer;\n\tIR::ValueTuple functionResults = invokeFunctionChecked(context, functionInstance, invokeArgs);\n\tTiming::logTimer(\"Invoked function\", executionTimer);\n\n\tif(options.functionName)\n\t{\n\t\tLog::printf(Log::debug,\n\t\t\t\t\t\"%s returned: %s\\n\",\n\t\t\t\t\toptions.functionName,\n\t\t\t\t\tasString(functionResults).c_str());\n\t\treturn EXIT_SUCCESS;\n\t}\n\telse if(functionResults.size() == 1 && functionResults[0].type == ValueType::i32)\n\t{\n\t\treturn functionResults[0].i32;\n\t}\n\telse\n\t{\n\t\treturn EXIT_SUCCESS;\n\t}\n}","lang":"cpp","vul_type":"cwe-476","sven_meta":{"func_name":"run","file_name":"Programs/wavm/wavm.cpp","commit_link":"github.com/WAVM/WAVM/commit/31d670b6489e6d708c3b04b911cdf14ac43d846d","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#39-6c6490dda5c9","input":"open_ssl_connection (rfbClient *client, int sockfd, rfbBool anonTLS, rfbCredential *cred)\n{\n SSL_CTX *ssl_ctx = NULL;\n SSL *ssl = NULL;\n int n, finished = 0;\n X509_VERIFY_PARAM *param;\n uint8_t verify_crls = cred->x509Credential.x509CrlVerifyMode;\n\n if (!(ssl_ctx = SSL_CTX_new(SSLv23_client_method())))\n {\n rfbClientLog(\"Could not create new SSL context.\\n\");\n return NULL;\n }\n\n param = X509_VERIFY_PARAM_new();\n\n /* Setup verification if not anonymous */\n if (!anonTLS)\n {\n if (cred->x509Credential.x509CACertFile)\n {\n if (!SSL_CTX_load_verify_locations(ssl_ctx, cred->x509Credential.x509CACertFile, NULL))\n {\n rfbClientLog(\"Failed to load CA certificate from %s.\\n\",\n cred->x509Credential.x509CACertFile);\n goto error_free_ctx;\n }\n } else {\n rfbClientLog(\"Using default paths for certificate verification.\\n\");\n SSL_CTX_set_default_verify_paths (ssl_ctx);\n }\n\n if (cred->x509Credential.x509CACrlFile)\n {\n if (!load_crls_from_file(cred->x509Credential.x509CACrlFile, ssl_ctx))\n {\n rfbClientLog(\"CRLs could not be loaded.\\n\");\n goto error_free_ctx;\n }\n if (verify_crls == rfbX509CrlVerifyNone) verify_crls = rfbX509CrlVerifyAll;\n }\n\n if (cred->x509Credential.x509ClientCertFile && cred->x509Credential.x509ClientKeyFile)\n {\n if (SSL_CTX_use_certificate_chain_file(ssl_ctx, cred->x509Credential.x509ClientCertFile) != 1)\n {\n rfbClientLog(\"Client certificate could not be loaded.\\n\");\n goto error_free_ctx;\n }\n\n if (SSL_CTX_use_PrivateKey_file(ssl_ctx, cred->x509Credential.x509ClientKeyFile,\n SSL_FILETYPE_PEM) != 1)\n {\n rfbClientLog(\"Client private key could not be loaded.\\n\");\n goto error_free_ctx;\n }\n\n if (SSL_CTX_check_private_key(ssl_ctx) == 0) {\n rfbClientLog(\"Client certificate and private key do not match.\\n\");\n goto error_free_ctx;\n }\n }\n\n SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL);\n\n if (verify_crls == rfbX509CrlVerifyClient) \n X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);\n else if (verify_crls == rfbX509CrlVerifyAll)\n X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);\n\n if(!X509_VERIFY_PARAM_set1_host(param, client->serverHost, strlen(client->serverHost)))\n {\n rfbClientLog(\"Could not set server name for verification.\\n\");\n goto error_free_ctx;\n }\n SSL_CTX_set1_param(ssl_ctx, param);\n }\n\n if (!(ssl = SSL_new (ssl_ctx)))\n {\n rfbClientLog(\"Could not create a new SSL session.\\n\");\n goto error_free_ctx;\n }\n\n /* TODO: finetune this list, take into account anonTLS bool */\n SSL_set_cipher_list(ssl, \"ALL\");\n\n SSL_set_fd (ssl, sockfd);\n SSL_CTX_set_app_data (ssl_ctx, client);\n\n do\n {\n n = SSL_connect(ssl);\n\t\t\n if (n != 1) \n {\n if (wait_for_data(ssl, n, 1) != 1) \n {\n finished = 1;\n SSL_shutdown(ssl);\n\n goto error_free_ssl;\n }\n }\n } while( n != 1 && finished != 1 );\n\n X509_VERIFY_PARAM_free(param);\n return ssl;\n\nerror_free_ssl:\n SSL_free(ssl);\n\nerror_free_ctx:\n X509_VERIFY_PARAM_free(param);\n SSL_CTX_free(ssl_ctx);\n\n return NULL;\n}","target":"open_ssl_connection (rfbClient *client, int sockfd, rfbBool anonTLS, rfbCredential *cred)\n{\n SSL_CTX *ssl_ctx = NULL;\n SSL *ssl = NULL;\n int n, finished = 0;\n X509_VERIFY_PARAM *param;\n uint8_t verify_crls;\n\n if (!(ssl_ctx = SSL_CTX_new(SSLv23_client_method())))\n {\n rfbClientLog(\"Could not create new SSL context.\\n\");\n return NULL;\n }\n\n param = X509_VERIFY_PARAM_new();\n\n /* Setup verification if not anonymous */\n if (!anonTLS)\n {\n verify_crls = cred->x509Credential.x509CrlVerifyMode;\n if (cred->x509Credential.x509CACertFile)\n {\n if (!SSL_CTX_load_verify_locations(ssl_ctx, cred->x509Credential.x509CACertFile, NULL))\n {\n rfbClientLog(\"Failed to load CA certificate from %s.\\n\",\n cred->x509Credential.x509CACertFile);\n goto error_free_ctx;\n }\n } else {\n rfbClientLog(\"Using default paths for certificate verification.\\n\");\n SSL_CTX_set_default_verify_paths (ssl_ctx);\n }\n\n if (cred->x509Credential.x509CACrlFile)\n {\n if (!load_crls_from_file(cred->x509Credential.x509CACrlFile, ssl_ctx))\n {\n rfbClientLog(\"CRLs could not be loaded.\\n\");\n goto error_free_ctx;\n }\n if (verify_crls == rfbX509CrlVerifyNone) verify_crls = rfbX509CrlVerifyAll;\n }\n\n if (cred->x509Credential.x509ClientCertFile && cred->x509Credential.x509ClientKeyFile)\n {\n if (SSL_CTX_use_certificate_chain_file(ssl_ctx, cred->x509Credential.x509ClientCertFile) != 1)\n {\n rfbClientLog(\"Client certificate could not be loaded.\\n\");\n goto error_free_ctx;\n }\n\n if (SSL_CTX_use_PrivateKey_file(ssl_ctx, cred->x509Credential.x509ClientKeyFile,\n SSL_FILETYPE_PEM) != 1)\n {\n rfbClientLog(\"Client private key could not be loaded.\\n\");\n goto error_free_ctx;\n }\n\n if (SSL_CTX_check_private_key(ssl_ctx) == 0) {\n rfbClientLog(\"Client certificate and private key do not match.\\n\");\n goto error_free_ctx;\n }\n }\n\n SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL);\n\n if (verify_crls == rfbX509CrlVerifyClient) \n X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);\n else if (verify_crls == rfbX509CrlVerifyAll)\n X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);\n\n if(!X509_VERIFY_PARAM_set1_host(param, client->serverHost, strlen(client->serverHost)))\n {\n rfbClientLog(\"Could not set server name for verification.\\n\");\n goto error_free_ctx;\n }\n SSL_CTX_set1_param(ssl_ctx, param);\n }\n\n if (!(ssl = SSL_new (ssl_ctx)))\n {\n rfbClientLog(\"Could not create a new SSL session.\\n\");\n goto error_free_ctx;\n }\n\n /* TODO: finetune this list, take into account anonTLS bool */\n SSL_set_cipher_list(ssl, \"ALL\");\n\n SSL_set_fd (ssl, sockfd);\n SSL_CTX_set_app_data (ssl_ctx, client);\n\n do\n {\n n = SSL_connect(ssl);\n\t\t\n if (n != 1) \n {\n if (wait_for_data(ssl, n, 1) != 1) \n {\n finished = 1;\n SSL_shutdown(ssl);\n\n goto error_free_ssl;\n }\n }\n } while( n != 1 && finished != 1 );\n\n X509_VERIFY_PARAM_free(param);\n return ssl;\n\nerror_free_ssl:\n SSL_free(ssl);\n\nerror_free_ctx:\n X509_VERIFY_PARAM_free(param);\n SSL_CTX_free(ssl_ctx);\n\n return NULL;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"open_ssl_connection","file_name":"libvncclient/tls_openssl.c","commit_link":"github.com/LibVNC/libvncserver/commit/33441d90a506d5f3ae9388f2752901227e430553","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#40-803fea2fbe49","input":"static void copyIPv6IfDifferent(void * dest, const void * src)\n{\n\tif(dest != src) {\n\t\tmemcpy(dest, src, sizeof(struct in6_addr));\n\t}\n}","target":"static void copyIPv6IfDifferent(void * dest, const void * src)\n{\n\tif(dest != src && src != NULL) {\n\t\tmemcpy(dest, src, sizeof(struct in6_addr));\n\t}\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"copyIPv6IfDifferent","file_name":"miniupnpd/pcpserver.c","commit_link":"github.com/miniupnp/miniupnp/commit/cb8a02af7a5677cf608e86d57ab04241cf34e24f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#41-7bd7128f30d2","input":"archive_acl_from_text_l(struct archive_acl *acl, const char *text,\n int want_type, struct archive_string_conv *sc)\n{\n\tstruct {\n\t\tconst char *start;\n\t\tconst char *end;\n\t} field[6], name;\n\n\tconst char *s, *st;\n\tint numfields, fields, n, r, sol, ret;\n\tint type, types, tag, permset, id;\n\tsize_t len;\n\tchar sep;\n\n\tswitch (want_type) {\n\tcase ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:\n\t\twant_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;\n\t\t__LA_FALLTHROUGH;\n\tcase ARCHIVE_ENTRY_ACL_TYPE_ACCESS:\n\tcase ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:\n\t\tnumfields = 5;\n\t\tbreak;\n\tcase ARCHIVE_ENTRY_ACL_TYPE_NFS4:\n\t\tnumfields = 6;\n\t\tbreak;\n\tdefault:\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\n\tret = ARCHIVE_OK;\n\ttypes = 0;\n\n\twhile (text != NULL && *text != '\\0') {\n\t\t/*\n\t\t * Parse the fields out of the next entry,\n\t\t * advance 'text' to start of next entry.\n\t\t */\n\t\tfields = 0;\n\t\tdo {\n\t\t\tconst char *start, *end;\n\t\t\tnext_field(&text, &start, &end, &sep);\n\t\t\tif (fields < numfields) {\n\t\t\t\tfield[fields].start = start;\n\t\t\t\tfield[fields].end = end;\n\t\t\t}\n\t\t\t++fields;\n\t\t} while (sep == ':');\n\n\t\t/* Set remaining fields to blank. */\n\t\tfor (n = fields; n < numfields; ++n)\n\t\t\tfield[n].start = field[n].end = NULL;\n\n\t\tif (field[0].start != NULL && *(field[0].start) == '#') {\n\t\t\t/* Comment, skip entry */\n\t\t\tcontinue;\n\t\t}\n\n\t\tn = 0;\n\t\tsol = 0;\n\t\tid = -1;\n\t\tpermset = 0;\n\t\tname.start = name.end = NULL;\n\n\t\tif (want_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) {\n\t\t\t/* POSIX.1e ACLs */\n\t\t\t/*\n\t\t\t * Default keyword \"default:user::rwx\"\n\t\t\t * if found, we have one more field\n\t\t\t *\n\t\t\t * We also support old Solaris extension:\n\t\t\t * \"defaultuser::rwx\" is the default ACL corresponding\n\t\t\t * to \"user::rwx\", etc. valid only for first field\n\t\t\t */\n\t\t\ts = field[0].start;\n\t\t\tlen = field[0].end - field[0].start;\n\t\t\tif (*s == 'd' && (len == 1 || (len >= 7\n\t\t\t && memcmp((s + 1), \"efault\", 6) == 0))) {\n\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;\n\t\t\t\tif (len > 7)\n\t\t\t\t\tfield[0].start += 7;\n\t\t\t\telse\n\t\t\t\t\tn = 1;\n\t\t\t} else\n\t\t\t\ttype = want_type;\n\n\t\t\t/* Check for a numeric ID in field n+1 or n+3. */\n\t\t\tisint(field[n + 1].start, field[n + 1].end, &id);\n\t\t\t/* Field n+3 is optional. */\n\t\t\tif (id == -1 && fields > (n + 3))\n\t\t\t\tisint(field[n + 3].start, field[n + 3].end,\n\t\t\t\t &id);\n\n\t\t\ttag = 0;\n\t\t\ts = field[n].start;\n\t\t\tst = field[n].start + 1;\n\t\t\tlen = field[n].end - field[n].start;\n\n\t\t\tswitch (*s) {\n\t\t\tcase 'u':\n\t\t\t\tif (len == 1 || (len == 4\n\t\t\t\t && memcmp(st, \"ser\", 3) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 'g':\n\t\t\t\tif (len == 1 || (len == 5\n\t\t\t\t && memcmp(st, \"roup\", 4) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 'o':\n\t\t\t\tif (len == 1 || (len == 5\n\t\t\t\t && memcmp(st, \"ther\", 4) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_OTHER;\n\t\t\t\tbreak;\n\t\t\tcase 'm':\n\t\t\t\tif (len == 1 || (len == 4\n\t\t\t\t && memcmp(st, \"ask\", 3) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_MASK;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (tag) {\n\t\t\tcase ARCHIVE_ENTRY_ACL_OTHER:\n\t\t\tcase ARCHIVE_ENTRY_ACL_MASK:\n\t\t\t\tif (fields == (n + 2)\n\t\t\t\t && field[n + 1].start < field[n + 1].end\n\t\t\t\t && ismode(field[n + 1].start,\n\t\t\t\t field[n + 1].end, &permset)) {\n\t\t\t\t\t/* This is Solaris-style \"other:rwx\" */\n\t\t\t\t\tsol = 1;\n\t\t\t\t} else if (fields == (n + 3) &&\n\t\t\t\t field[n + 1].start < field[n + 1].end) {\n\t\t\t\t\t/* Invalid mask or other field */\n\t\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ARCHIVE_ENTRY_ACL_USER_OBJ:\n\t\t\tcase ARCHIVE_ENTRY_ACL_GROUP_OBJ:\n\t\t\t\tif (id != -1 ||\n\t\t\t\t field[n + 1].start < field[n + 1].end) {\n\t\t\t\t\tname = field[n + 1];\n\t\t\t\t\tif (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)\n\t\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER;\n\t\t\t\t\telse\n\t\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t/* Invalid tag, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Without \"default:\" we expect mode in field 3\n\t\t\t * Exception: Solaris other and mask fields\n\t\t\t */\n\t\t\tif (permset == 0 && !ismode(field[n + 2 - sol].start,\n\t\t\t field[n + 2 - sol].end, &permset)) {\n\t\t\t\t/* Invalid mode, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t} else {\n\t\t\t/* NFS4 ACLs */\n\t\t\ts = field[0].start;\n\t\t\tlen = field[0].end - field[0].start;\n\t\t\ttag = 0;\n\n\t\t\tswitch (len) {\n\t\t\tcase 4:\n\t\t\t\tif (memcmp(s, \"user\", 4) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER;\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tif (memcmp(s, \"group\", 5) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP;\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tif (memcmp(s, \"owner@\", 6) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER_OBJ;\n\t\t\t\telse if (memcmp(s, \"group@\", 6) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 9:\n\t\t\t\tif (memcmp(s, \"everyone@\", 9) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_EVERYONE;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (tag == 0) {\n\t\t\t\t/* Invalid tag, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t} else if (tag == ARCHIVE_ENTRY_ACL_USER ||\n\t\t\t tag == ARCHIVE_ENTRY_ACL_GROUP) {\n\t\t\t\tn = 1;\n\t\t\t\tname = field[1];\n\t\t\t\tisint(name.start, name.end, &id);\n\t\t\t} else\n\t\t\t\tn = 0;\n\n\t\t\tif (!is_nfs4_perms(field[1 + n].start,\n\t\t\t field[1 + n].end, &permset)) {\n\t\t\t\t/* Invalid NFSv4 perms, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!is_nfs4_flags(field[2 + n].start,\n\t\t\t field[2 + n].end, &permset)) {\n\t\t\t\t/* Invalid NFSv4 flags, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ts = field[3 + n].start;\n\t\t\tlen = field[3 + n].end - field[3 + n].start;\n\t\t\ttype = 0;\n\t\t\tif (len == 4) {\n\t\t\t\tif (memcmp(s, \"deny\", 4) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_DENY;\n\t\t\t} else if (len == 5) {\n\t\t\t\tif (memcmp(s, \"allow\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;\n\t\t\t\telse if (memcmp(s, \"audit\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_AUDIT;\n\t\t\t\telse if (memcmp(s, \"alarm\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_ALARM;\n\t\t\t}\n\t\t\tif (type == 0) {\n\t\t\t\t/* Invalid entry type, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tisint(field[4 + n].start, field[4 + n].end,\n\t\t\t &id);\n\t\t}\n\n\t\t/* Add entry to the internal list. */\n\t\tr = archive_acl_add_entry_len_l(acl, type, permset,\n\t\t tag, id, name.start, name.end - name.start, sc);\n\t\tif (r < ARCHIVE_WARN)\n\t\t\treturn (r);\n\t\tif (r != ARCHIVE_OK)\n\t\t\tret = ARCHIVE_WARN;\n\t\ttypes |= type;\n\t}\n\n\t/* Reset ACL */\n\tarchive_acl_reset(acl, types);\n\n\treturn (ret);\n}","target":"archive_acl_from_text_l(struct archive_acl *acl, const char *text,\n int want_type, struct archive_string_conv *sc)\n{\n\tstruct {\n\t\tconst char *start;\n\t\tconst char *end;\n\t} field[6], name;\n\n\tconst char *s, *st;\n\tint numfields, fields, n, r, sol, ret;\n\tint type, types, tag, permset, id;\n\tsize_t len;\n\tchar sep;\n\n\tswitch (want_type) {\n\tcase ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:\n\t\twant_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;\n\t\t__LA_FALLTHROUGH;\n\tcase ARCHIVE_ENTRY_ACL_TYPE_ACCESS:\n\tcase ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:\n\t\tnumfields = 5;\n\t\tbreak;\n\tcase ARCHIVE_ENTRY_ACL_TYPE_NFS4:\n\t\tnumfields = 6;\n\t\tbreak;\n\tdefault:\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\n\tret = ARCHIVE_OK;\n\ttypes = 0;\n\n\twhile (text != NULL && *text != '\\0') {\n\t\t/*\n\t\t * Parse the fields out of the next entry,\n\t\t * advance 'text' to start of next entry.\n\t\t */\n\t\tfields = 0;\n\t\tdo {\n\t\t\tconst char *start, *end;\n\t\t\tnext_field(&text, &start, &end, &sep);\n\t\t\tif (fields < numfields) {\n\t\t\t\tfield[fields].start = start;\n\t\t\t\tfield[fields].end = end;\n\t\t\t}\n\t\t\t++fields;\n\t\t} while (sep == ':');\n\n\t\t/* Set remaining fields to blank. */\n\t\tfor (n = fields; n < numfields; ++n)\n\t\t\tfield[n].start = field[n].end = NULL;\n\n\t\tif (field[0].start != NULL && *(field[0].start) == '#') {\n\t\t\t/* Comment, skip entry */\n\t\t\tcontinue;\n\t\t}\n\n\t\tn = 0;\n\t\tsol = 0;\n\t\tid = -1;\n\t\tpermset = 0;\n\t\tname.start = name.end = NULL;\n\n\t\tif (want_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) {\n\t\t\t/* POSIX.1e ACLs */\n\t\t\t/*\n\t\t\t * Default keyword \"default:user::rwx\"\n\t\t\t * if found, we have one more field\n\t\t\t *\n\t\t\t * We also support old Solaris extension:\n\t\t\t * \"defaultuser::rwx\" is the default ACL corresponding\n\t\t\t * to \"user::rwx\", etc. valid only for first field\n\t\t\t */\n\t\t\ts = field[0].start;\n\t\t\tlen = field[0].end - field[0].start;\n\t\t\tif (*s == 'd' && (len == 1 || (len >= 7\n\t\t\t && memcmp((s + 1), \"efault\", 6) == 0))) {\n\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;\n\t\t\t\tif (len > 7)\n\t\t\t\t\tfield[0].start += 7;\n\t\t\t\telse\n\t\t\t\t\tn = 1;\n\t\t\t} else\n\t\t\t\ttype = want_type;\n\n\t\t\t/* Check for a numeric ID in field n+1 or n+3. */\n\t\t\tisint(field[n + 1].start, field[n + 1].end, &id);\n\t\t\t/* Field n+3 is optional. */\n\t\t\tif (id == -1 && fields > (n + 3))\n\t\t\t\tisint(field[n + 3].start, field[n + 3].end,\n\t\t\t\t &id);\n\n\t\t\ttag = 0;\n\t\t\ts = field[n].start;\n\t\t\tst = field[n].start + 1;\n\t\t\tlen = field[n].end - field[n].start;\n\n\t\t\tif (len == 0) {\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tswitch (*s) {\n\t\t\tcase 'u':\n\t\t\t\tif (len == 1 || (len == 4\n\t\t\t\t && memcmp(st, \"ser\", 3) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 'g':\n\t\t\t\tif (len == 1 || (len == 5\n\t\t\t\t && memcmp(st, \"roup\", 4) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 'o':\n\t\t\t\tif (len == 1 || (len == 5\n\t\t\t\t && memcmp(st, \"ther\", 4) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_OTHER;\n\t\t\t\tbreak;\n\t\t\tcase 'm':\n\t\t\t\tif (len == 1 || (len == 4\n\t\t\t\t && memcmp(st, \"ask\", 3) == 0))\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_MASK;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (tag) {\n\t\t\tcase ARCHIVE_ENTRY_ACL_OTHER:\n\t\t\tcase ARCHIVE_ENTRY_ACL_MASK:\n\t\t\t\tif (fields == (n + 2)\n\t\t\t\t && field[n + 1].start < field[n + 1].end\n\t\t\t\t && ismode(field[n + 1].start,\n\t\t\t\t field[n + 1].end, &permset)) {\n\t\t\t\t\t/* This is Solaris-style \"other:rwx\" */\n\t\t\t\t\tsol = 1;\n\t\t\t\t} else if (fields == (n + 3) &&\n\t\t\t\t field[n + 1].start < field[n + 1].end) {\n\t\t\t\t\t/* Invalid mask or other field */\n\t\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ARCHIVE_ENTRY_ACL_USER_OBJ:\n\t\t\tcase ARCHIVE_ENTRY_ACL_GROUP_OBJ:\n\t\t\t\tif (id != -1 ||\n\t\t\t\t field[n + 1].start < field[n + 1].end) {\n\t\t\t\t\tname = field[n + 1];\n\t\t\t\t\tif (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)\n\t\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER;\n\t\t\t\t\telse\n\t\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t/* Invalid tag, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Without \"default:\" we expect mode in field 3\n\t\t\t * Exception: Solaris other and mask fields\n\t\t\t */\n\t\t\tif (permset == 0 && !ismode(field[n + 2 - sol].start,\n\t\t\t field[n + 2 - sol].end, &permset)) {\n\t\t\t\t/* Invalid mode, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t} else {\n\t\t\t/* NFS4 ACLs */\n\t\t\ts = field[0].start;\n\t\t\tlen = field[0].end - field[0].start;\n\t\t\ttag = 0;\n\n\t\t\tswitch (len) {\n\t\t\tcase 4:\n\t\t\t\tif (memcmp(s, \"user\", 4) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER;\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tif (memcmp(s, \"group\", 5) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP;\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tif (memcmp(s, \"owner@\", 6) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_USER_OBJ;\n\t\t\t\telse if (memcmp(s, \"group@\", 6) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;\n\t\t\t\tbreak;\n\t\t\tcase 9:\n\t\t\t\tif (memcmp(s, \"everyone@\", 9) == 0)\n\t\t\t\t\ttag = ARCHIVE_ENTRY_ACL_EVERYONE;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (tag == 0) {\n\t\t\t\t/* Invalid tag, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t} else if (tag == ARCHIVE_ENTRY_ACL_USER ||\n\t\t\t tag == ARCHIVE_ENTRY_ACL_GROUP) {\n\t\t\t\tn = 1;\n\t\t\t\tname = field[1];\n\t\t\t\tisint(name.start, name.end, &id);\n\t\t\t} else\n\t\t\t\tn = 0;\n\n\t\t\tif (!is_nfs4_perms(field[1 + n].start,\n\t\t\t field[1 + n].end, &permset)) {\n\t\t\t\t/* Invalid NFSv4 perms, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!is_nfs4_flags(field[2 + n].start,\n\t\t\t field[2 + n].end, &permset)) {\n\t\t\t\t/* Invalid NFSv4 flags, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ts = field[3 + n].start;\n\t\t\tlen = field[3 + n].end - field[3 + n].start;\n\t\t\ttype = 0;\n\t\t\tif (len == 4) {\n\t\t\t\tif (memcmp(s, \"deny\", 4) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_DENY;\n\t\t\t} else if (len == 5) {\n\t\t\t\tif (memcmp(s, \"allow\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;\n\t\t\t\telse if (memcmp(s, \"audit\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_AUDIT;\n\t\t\t\telse if (memcmp(s, \"alarm\", 5) == 0)\n\t\t\t\t\ttype = ARCHIVE_ENTRY_ACL_TYPE_ALARM;\n\t\t\t}\n\t\t\tif (type == 0) {\n\t\t\t\t/* Invalid entry type, skip entry */\n\t\t\t\tret = ARCHIVE_WARN;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tisint(field[4 + n].start, field[4 + n].end,\n\t\t\t &id);\n\t\t}\n\n\t\t/* Add entry to the internal list. */\n\t\tr = archive_acl_add_entry_len_l(acl, type, permset,\n\t\t tag, id, name.start, name.end - name.start, sc);\n\t\tif (r < ARCHIVE_WARN)\n\t\t\treturn (r);\n\t\tif (r != ARCHIVE_OK)\n\t\t\tret = ARCHIVE_WARN;\n\t\ttypes |= type;\n\t}\n\n\t/* Reset ACL */\n\tarchive_acl_reset(acl, types);\n\n\treturn (ret);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"archive_acl_from_text_l","file_name":"libarchive/archive_acl.c","commit_link":"github.com/libarchive/libarchive/commit/15bf44fd2c1ad0e3fd87048b3fcc90c4dcff1175","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#42-f3efd5653b21","input":"int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)\n{\n int ret = 0;\n int codec_init_ok = 0;\n AVDictionary *tmp = NULL;\n const AVPixFmtDescriptor *pixdesc;\n\n if (avcodec_is_open(avctx))\n return 0;\n\n if ((!codec && !avctx->codec)) {\n av_log(avctx, AV_LOG_ERROR, \"No codec provided to avcodec_open2()\\n\");\n return AVERROR(EINVAL);\n }\n if ((codec && avctx->codec && codec != avctx->codec)) {\n av_log(avctx, AV_LOG_ERROR, \"This AVCodecContext was allocated for %s, \"\n \"but %s passed to avcodec_open2()\\n\", avctx->codec->name, codec->name);\n return AVERROR(EINVAL);\n }\n if (!codec)\n codec = avctx->codec;\n\n if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)\n return AVERROR(EINVAL);\n\n if (options)\n av_dict_copy(&tmp, *options, 0);\n\n ff_lock_avcodec(avctx, codec);\n\n avctx->internal = av_mallocz(sizeof(*avctx->internal));\n if (!avctx->internal) {\n ret = AVERROR(ENOMEM);\n goto end;\n }\n\n avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool));\n if (!avctx->internal->pool) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->to_free = av_frame_alloc();\n if (!avctx->internal->to_free) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->compat_decode_frame = av_frame_alloc();\n if (!avctx->internal->compat_decode_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->buffer_frame = av_frame_alloc();\n if (!avctx->internal->buffer_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->buffer_pkt = av_packet_alloc();\n if (!avctx->internal->buffer_pkt) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->ds.in_pkt = av_packet_alloc();\n if (!avctx->internal->ds.in_pkt) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->last_pkt_props = av_packet_alloc();\n if (!avctx->internal->last_pkt_props) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->skip_samples_multiplier = 1;\n\n if (codec->priv_data_size > 0) {\n if (!avctx->priv_data) {\n avctx->priv_data = av_mallocz(codec->priv_data_size);\n if (!avctx->priv_data) {\n ret = AVERROR(ENOMEM);\n goto end;\n }\n if (codec->priv_class) {\n *(const AVClass **)avctx->priv_data = codec->priv_class;\n av_opt_set_defaults(avctx->priv_data);\n }\n }\n if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)\n goto free_and_end;\n } else {\n avctx->priv_data = NULL;\n }\n if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)\n goto free_and_end;\n\n if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"Codec (%s) not on whitelist \\'%s\\'\\n\", codec->name, avctx->codec_whitelist);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n // only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions\n if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height &&\n (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F || avctx->codec_id == AV_CODEC_ID_DXV))) {\n if (avctx->coded_width && avctx->coded_height)\n ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);\n else if (avctx->width && avctx->height)\n ret = ff_set_dimensions(avctx, avctx->width, avctx->height);\n if (ret < 0)\n goto free_and_end;\n }\n\n if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)\n && ( av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0\n || av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)) {\n av_log(avctx, AV_LOG_WARNING, \"Ignoring invalid width/height values\\n\");\n ff_set_dimensions(avctx, 0, 0);\n }\n\n if (avctx->width > 0 && avctx->height > 0) {\n if (av_image_check_sar(avctx->width, avctx->height,\n avctx->sample_aspect_ratio) < 0) {\n av_log(avctx, AV_LOG_WARNING, \"ignoring invalid SAR: %u/%u\\n\",\n avctx->sample_aspect_ratio.num,\n avctx->sample_aspect_ratio.den);\n avctx->sample_aspect_ratio = (AVRational){ 0, 1 };\n }\n }\n\n /* if the decoder init function was already called previously,\n * free the already allocated subtitle_header before overwriting it */\n if (av_codec_is_decoder(codec))\n av_freep(&avctx->subtitle_header);\n\n if (avctx->channels > FF_SANE_NB_CHANNELS) {\n av_log(avctx, AV_LOG_ERROR, \"Too many channels: %d\\n\", avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n avctx->codec = codec;\n if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&\n avctx->codec_id == AV_CODEC_ID_NONE) {\n avctx->codec_type = codec->type;\n avctx->codec_id = codec->id;\n }\n if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type\n && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) {\n av_log(avctx, AV_LOG_ERROR, \"Codec type or id mismatches\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n avctx->frame_number = 0;\n avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);\n\n if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&\n avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {\n const char *codec_string = av_codec_is_encoder(codec) ? \"encoder\" : \"decoder\";\n AVCodec *codec2;\n av_log(avctx, AV_LOG_ERROR,\n \"The %s '%s' is experimental but experimental codecs are not enabled, \"\n \"add '-strict %d' if you want to use it.\\n\",\n codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL);\n codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id);\n if (!(codec2->capabilities & AV_CODEC_CAP_EXPERIMENTAL))\n av_log(avctx, AV_LOG_ERROR, \"Alternatively use the non experimental %s '%s'.\\n\",\n codec_string, codec2->name);\n ret = AVERROR_EXPERIMENTAL;\n goto free_and_end;\n }\n\n if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&\n (!avctx->time_base.num || !avctx->time_base.den)) {\n avctx->time_base.num = 1;\n avctx->time_base.den = avctx->sample_rate;\n }\n\n if (!HAVE_THREADS)\n av_log(avctx, AV_LOG_WARNING, \"Warning: not compiled with thread support, using thread emulation\\n\");\n\n if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {\n ff_unlock_avcodec(codec); //we will instantiate a few encoders thus kick the counter to prevent false detection of a problem\n ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);\n ff_lock_avcodec(avctx, codec);\n if (ret < 0)\n goto free_and_end;\n }\n\n if (av_codec_is_decoder(avctx->codec)) {\n ret = ff_decode_bsfs_init(avctx);\n if (ret < 0)\n goto free_and_end;\n }\n\n if (HAVE_THREADS\n && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) {\n ret = ff_thread_init(avctx);\n if (ret < 0) {\n goto free_and_end;\n }\n }\n if (!HAVE_THREADS && !(codec->capabilities & AV_CODEC_CAP_AUTO_THREADS))\n avctx->thread_count = 1;\n\n if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {\n av_log(avctx, AV_LOG_WARNING, \"The maximum value for lowres supported by the decoder is %d\\n\",\n avctx->codec->max_lowres);\n avctx->lowres = avctx->codec->max_lowres;\n }\n\n if (av_codec_is_encoder(avctx->codec)) {\n int i;\n#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\n avctx->coded_frame = av_frame_alloc();\n if (!avctx->coded_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n\n if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"The encoder timebase is not set.\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n if (avctx->codec->sample_fmts) {\n for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {\n if (avctx->sample_fmt == avctx->codec->sample_fmts[i])\n break;\n if (avctx->channels == 1 &&\n av_get_planar_sample_fmt(avctx->sample_fmt) ==\n av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {\n avctx->sample_fmt = avctx->codec->sample_fmts[i];\n break;\n }\n }\n if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {\n char buf[128];\n snprintf(buf, sizeof(buf), \"%d\", avctx->sample_fmt);\n av_log(avctx, AV_LOG_ERROR, \"Specified sample format %s is invalid or not supported\\n\",\n (char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if (avctx->codec->pix_fmts) {\n for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)\n if (avctx->pix_fmt == avctx->codec->pix_fmts[i])\n break;\n if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE\n && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG)\n && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) {\n char buf[128];\n snprintf(buf, sizeof(buf), \"%d\", avctx->pix_fmt);\n av_log(avctx, AV_LOG_ERROR, \"Specified pixel format %s is invalid or not supported\\n\",\n (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)\n avctx->color_range = AVCOL_RANGE_JPEG;\n }\n if (avctx->codec->supported_samplerates) {\n for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)\n if (avctx->sample_rate == avctx->codec->supported_samplerates[i])\n break;\n if (avctx->codec->supported_samplerates[i] == 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified sample rate %d is not supported\\n\",\n avctx->sample_rate);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if (avctx->sample_rate < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified sample rate %d is not supported\\n\",\n avctx->sample_rate);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->codec->channel_layouts) {\n if (!avctx->channel_layout) {\n av_log(avctx, AV_LOG_WARNING, \"Channel layout not specified\\n\");\n } else {\n for (i = 0; avctx->codec->channel_layouts[i] != 0; i++)\n if (avctx->channel_layout == avctx->codec->channel_layouts[i])\n break;\n if (avctx->codec->channel_layouts[i] == 0) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_ERROR, \"Specified channel layout '%s' is not supported\\n\", buf);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n }\n if (avctx->channel_layout && avctx->channels) {\n int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n if (channels != avctx->channels) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_ERROR,\n \"Channel layout '%s' with %d channels does not match number of specified channels %d\\n\",\n buf, channels, avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n } else if (avctx->channel_layout) {\n avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n }\n if (avctx->channels < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified number of channels %d is not supported\\n\",\n avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if(avctx->codec_type == AVMEDIA_TYPE_VIDEO) {\n pixdesc = av_pix_fmt_desc_get(avctx->pix_fmt);\n if ( avctx->bits_per_raw_sample < 0\n || (avctx->bits_per_raw_sample > 8 && pixdesc->comp[0].depth <= 8)) {\n av_log(avctx, AV_LOG_WARNING, \"Specified bit depth %d not possible with the specified pixel formats depth %d\\n\",\n avctx->bits_per_raw_sample, pixdesc->comp[0].depth);\n avctx->bits_per_raw_sample = pixdesc->comp[0].depth;\n }\n if (avctx->width <= 0 || avctx->height <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"dimensions not set\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)\n && avctx->bit_rate>0 && avctx->bit_rate<1000) {\n av_log(avctx, AV_LOG_WARNING, \"Bitrate %\"PRId64\" is extremely low, maybe you mean %\"PRId64\"k\\n\", avctx->bit_rate, avctx->bit_rate);\n }\n\n if (!avctx->rc_initial_buffer_occupancy)\n avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;\n\n if (avctx->ticks_per_frame && avctx->time_base.num &&\n avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {\n av_log(avctx, AV_LOG_ERROR,\n \"ticks_per_frame %d too large for the timebase %d/%d.\",\n avctx->ticks_per_frame,\n avctx->time_base.num,\n avctx->time_base.den);\n goto free_and_end;\n }\n\n if (avctx->hw_frames_ctx) {\n AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;\n if (frames_ctx->format != avctx->pix_fmt) {\n av_log(avctx, AV_LOG_ERROR,\n \"Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&\n avctx->sw_pix_fmt != frames_ctx->sw_format) {\n av_log(avctx, AV_LOG_ERROR,\n \"Mismatching AVCodecContext.sw_pix_fmt (%s) \"\n \"and AVHWFramesContext.sw_format (%s)\\n\",\n av_get_pix_fmt_name(avctx->sw_pix_fmt),\n av_get_pix_fmt_name(frames_ctx->sw_format));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n avctx->sw_pix_fmt = frames_ctx->sw_format;\n }\n }\n\n avctx->pts_correction_num_faulty_pts =\n avctx->pts_correction_num_faulty_dts = 0;\n avctx->pts_correction_last_pts =\n avctx->pts_correction_last_dts = INT64_MIN;\n\n if ( !CONFIG_GRAY && avctx->flags & AV_CODEC_FLAG_GRAY\n && avctx->codec_descriptor->type == AVMEDIA_TYPE_VIDEO)\n av_log(avctx, AV_LOG_WARNING,\n \"gray decoding requested but not enabled at configuration time\\n\");\n\n if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME)\n || avctx->internal->frame_thread_encoder)) {\n ret = avctx->codec->init(avctx);\n if (ret < 0) {\n goto free_and_end;\n }\n codec_init_ok = 1;\n }\n\n ret=0;\n\n if (av_codec_is_decoder(avctx->codec)) {\n if (!avctx->bit_rate)\n avctx->bit_rate = get_bit_rate(avctx);\n /* validate channel layout from the decoder */\n if (avctx->channel_layout) {\n int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n if (!avctx->channels)\n avctx->channels = channels;\n else if (channels != avctx->channels) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_WARNING,\n \"Channel layout '%s' with %d channels does not match specified number of channels %d: \"\n \"ignoring specified channel layout\\n\",\n buf, channels, avctx->channels);\n avctx->channel_layout = 0;\n }\n }\n if (avctx->channels && avctx->channels < 0 ||\n avctx->channels > FF_SANE_NB_CHANNELS) {\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->bits_per_coded_sample < 0) {\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->sub_charenc) {\n if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {\n av_log(avctx, AV_LOG_ERROR, \"Character encoding is only \"\n \"supported with subtitles codecs\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) {\n av_log(avctx, AV_LOG_WARNING, \"Codec '%s' is bitmap-based, \"\n \"subtitles character encoding will be ignored\\n\",\n avctx->codec_descriptor->name);\n avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_DO_NOTHING;\n } else {\n /* input character encoding is set for a text based subtitle\n * codec at this point */\n if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_AUTOMATIC)\n avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_PRE_DECODER;\n\n if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_PRE_DECODER) {\n#if CONFIG_ICONV\n iconv_t cd = iconv_open(\"UTF-8\", avctx->sub_charenc);\n if (cd == (iconv_t)-1) {\n ret = AVERROR(errno);\n av_log(avctx, AV_LOG_ERROR, \"Unable to open iconv context \"\n \"with input character encoding \\\"%s\\\"\\n\", avctx->sub_charenc);\n goto free_and_end;\n }\n iconv_close(cd);\n#else\n av_log(avctx, AV_LOG_ERROR, \"Character encoding subtitles \"\n \"conversion needs a libavcodec built with iconv support \"\n \"for this codec\\n\");\n ret = AVERROR(ENOSYS);\n goto free_and_end;\n#endif\n }\n }\n }\n\n#if FF_API_AVCTX_TIMEBASE\n if (avctx->framerate.num > 0 && avctx->framerate.den > 0)\n avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));\n#endif\n }\n if (codec->priv_data_size > 0 && avctx->priv_data && codec->priv_class) {\n av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);\n }\n\nend:\n ff_unlock_avcodec(codec);\n if (options) {\n av_dict_free(options);\n *options = tmp;\n }\n\n return ret;\nfree_and_end:\n if (avctx->codec &&\n (codec_init_ok ||\n (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP)))\n avctx->codec->close(avctx);\n\n if (codec->priv_class && codec->priv_data_size)\n av_opt_free(avctx->priv_data);\n av_opt_free(avctx);\n\n#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\n av_frame_free(&avctx->coded_frame);\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n\n av_dict_free(&tmp);\n av_freep(&avctx->priv_data);\n if (avctx->internal) {\n av_frame_free(&avctx->internal->to_free);\n av_frame_free(&avctx->internal->compat_decode_frame);\n av_frame_free(&avctx->internal->buffer_frame);\n av_packet_free(&avctx->internal->buffer_pkt);\n av_packet_free(&avctx->internal->last_pkt_props);\n\n av_packet_free(&avctx->internal->ds.in_pkt);\n ff_decode_bsfs_uninit(avctx);\n\n av_freep(&avctx->internal->pool);\n }\n av_freep(&avctx->internal);\n avctx->codec = NULL;\n goto end;\n}","target":"int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)\n{\n int ret = 0;\n int codec_init_ok = 0;\n AVDictionary *tmp = NULL;\n const AVPixFmtDescriptor *pixdesc;\n\n if (avcodec_is_open(avctx))\n return 0;\n\n if ((!codec && !avctx->codec)) {\n av_log(avctx, AV_LOG_ERROR, \"No codec provided to avcodec_open2()\\n\");\n return AVERROR(EINVAL);\n }\n if ((codec && avctx->codec && codec != avctx->codec)) {\n av_log(avctx, AV_LOG_ERROR, \"This AVCodecContext was allocated for %s, \"\n \"but %s passed to avcodec_open2()\\n\", avctx->codec->name, codec->name);\n return AVERROR(EINVAL);\n }\n if (!codec)\n codec = avctx->codec;\n\n if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)\n return AVERROR(EINVAL);\n\n if (options)\n av_dict_copy(&tmp, *options, 0);\n\n ff_lock_avcodec(avctx, codec);\n\n avctx->internal = av_mallocz(sizeof(*avctx->internal));\n if (!avctx->internal) {\n ret = AVERROR(ENOMEM);\n goto end;\n }\n\n avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool));\n if (!avctx->internal->pool) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->to_free = av_frame_alloc();\n if (!avctx->internal->to_free) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->compat_decode_frame = av_frame_alloc();\n if (!avctx->internal->compat_decode_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->buffer_frame = av_frame_alloc();\n if (!avctx->internal->buffer_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->buffer_pkt = av_packet_alloc();\n if (!avctx->internal->buffer_pkt) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->ds.in_pkt = av_packet_alloc();\n if (!avctx->internal->ds.in_pkt) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->last_pkt_props = av_packet_alloc();\n if (!avctx->internal->last_pkt_props) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\n\n avctx->internal->skip_samples_multiplier = 1;\n\n if (codec->priv_data_size > 0) {\n if (!avctx->priv_data) {\n avctx->priv_data = av_mallocz(codec->priv_data_size);\n if (!avctx->priv_data) {\n ret = AVERROR(ENOMEM);\n goto end;\n }\n if (codec->priv_class) {\n *(const AVClass **)avctx->priv_data = codec->priv_class;\n av_opt_set_defaults(avctx->priv_data);\n }\n }\n if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)\n goto free_and_end;\n } else {\n avctx->priv_data = NULL;\n }\n if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)\n goto free_and_end;\n\n if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"Codec (%s) not on whitelist \\'%s\\'\\n\", codec->name, avctx->codec_whitelist);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n // only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions\n if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height &&\n (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F || avctx->codec_id == AV_CODEC_ID_DXV))) {\n if (avctx->coded_width && avctx->coded_height)\n ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);\n else if (avctx->width && avctx->height)\n ret = ff_set_dimensions(avctx, avctx->width, avctx->height);\n if (ret < 0)\n goto free_and_end;\n }\n\n if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)\n && ( av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0\n || av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)) {\n av_log(avctx, AV_LOG_WARNING, \"Ignoring invalid width/height values\\n\");\n ff_set_dimensions(avctx, 0, 0);\n }\n\n if (avctx->width > 0 && avctx->height > 0) {\n if (av_image_check_sar(avctx->width, avctx->height,\n avctx->sample_aspect_ratio) < 0) {\n av_log(avctx, AV_LOG_WARNING, \"ignoring invalid SAR: %u/%u\\n\",\n avctx->sample_aspect_ratio.num,\n avctx->sample_aspect_ratio.den);\n avctx->sample_aspect_ratio = (AVRational){ 0, 1 };\n }\n }\n\n /* if the decoder init function was already called previously,\n * free the already allocated subtitle_header before overwriting it */\n if (av_codec_is_decoder(codec))\n av_freep(&avctx->subtitle_header);\n\n if (avctx->channels > FF_SANE_NB_CHANNELS) {\n av_log(avctx, AV_LOG_ERROR, \"Too many channels: %d\\n\", avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n avctx->codec = codec;\n if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&\n avctx->codec_id == AV_CODEC_ID_NONE) {\n avctx->codec_type = codec->type;\n avctx->codec_id = codec->id;\n }\n if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type\n && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) {\n av_log(avctx, AV_LOG_ERROR, \"Codec type or id mismatches\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n avctx->frame_number = 0;\n avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);\n\n if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&\n avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {\n const char *codec_string = av_codec_is_encoder(codec) ? \"encoder\" : \"decoder\";\n AVCodec *codec2;\n av_log(avctx, AV_LOG_ERROR,\n \"The %s '%s' is experimental but experimental codecs are not enabled, \"\n \"add '-strict %d' if you want to use it.\\n\",\n codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL);\n codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id);\n if (!(codec2->capabilities & AV_CODEC_CAP_EXPERIMENTAL))\n av_log(avctx, AV_LOG_ERROR, \"Alternatively use the non experimental %s '%s'.\\n\",\n codec_string, codec2->name);\n ret = AVERROR_EXPERIMENTAL;\n goto free_and_end;\n }\n\n if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&\n (!avctx->time_base.num || !avctx->time_base.den)) {\n avctx->time_base.num = 1;\n avctx->time_base.den = avctx->sample_rate;\n }\n\n if (!HAVE_THREADS)\n av_log(avctx, AV_LOG_WARNING, \"Warning: not compiled with thread support, using thread emulation\\n\");\n\n if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {\n ff_unlock_avcodec(codec); //we will instantiate a few encoders thus kick the counter to prevent false detection of a problem\n ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL);\n ff_lock_avcodec(avctx, codec);\n if (ret < 0)\n goto free_and_end;\n }\n\n if (av_codec_is_decoder(avctx->codec)) {\n ret = ff_decode_bsfs_init(avctx);\n if (ret < 0)\n goto free_and_end;\n }\n\n if (HAVE_THREADS\n && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) {\n ret = ff_thread_init(avctx);\n if (ret < 0) {\n goto free_and_end;\n }\n }\n if (!HAVE_THREADS && !(codec->capabilities & AV_CODEC_CAP_AUTO_THREADS))\n avctx->thread_count = 1;\n\n if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {\n av_log(avctx, AV_LOG_WARNING, \"The maximum value for lowres supported by the decoder is %d\\n\",\n avctx->codec->max_lowres);\n avctx->lowres = avctx->codec->max_lowres;\n }\n\n if (av_codec_is_encoder(avctx->codec)) {\n int i;\n#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\n avctx->coded_frame = av_frame_alloc();\n if (!avctx->coded_frame) {\n ret = AVERROR(ENOMEM);\n goto free_and_end;\n }\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n\n if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"The encoder timebase is not set.\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n\n if (avctx->codec->sample_fmts) {\n for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {\n if (avctx->sample_fmt == avctx->codec->sample_fmts[i])\n break;\n if (avctx->channels == 1 &&\n av_get_planar_sample_fmt(avctx->sample_fmt) ==\n av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {\n avctx->sample_fmt = avctx->codec->sample_fmts[i];\n break;\n }\n }\n if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {\n char buf[128];\n snprintf(buf, sizeof(buf), \"%d\", avctx->sample_fmt);\n av_log(avctx, AV_LOG_ERROR, \"Specified sample format %s is invalid or not supported\\n\",\n (char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if (avctx->codec->pix_fmts) {\n for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)\n if (avctx->pix_fmt == avctx->codec->pix_fmts[i])\n break;\n if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE\n && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG)\n && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) {\n char buf[128];\n snprintf(buf, sizeof(buf), \"%d\", avctx->pix_fmt);\n av_log(avctx, AV_LOG_ERROR, \"Specified pixel format %s is invalid or not supported\\n\",\n (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||\n avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)\n avctx->color_range = AVCOL_RANGE_JPEG;\n }\n if (avctx->codec->supported_samplerates) {\n for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)\n if (avctx->sample_rate == avctx->codec->supported_samplerates[i])\n break;\n if (avctx->codec->supported_samplerates[i] == 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified sample rate %d is not supported\\n\",\n avctx->sample_rate);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if (avctx->sample_rate < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified sample rate %d is not supported\\n\",\n avctx->sample_rate);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->codec->channel_layouts) {\n if (!avctx->channel_layout) {\n av_log(avctx, AV_LOG_WARNING, \"Channel layout not specified\\n\");\n } else {\n for (i = 0; avctx->codec->channel_layouts[i] != 0; i++)\n if (avctx->channel_layout == avctx->codec->channel_layouts[i])\n break;\n if (avctx->codec->channel_layouts[i] == 0) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_ERROR, \"Specified channel layout '%s' is not supported\\n\", buf);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n }\n if (avctx->channel_layout && avctx->channels) {\n int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n if (channels != avctx->channels) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_ERROR,\n \"Channel layout '%s' with %d channels does not match number of specified channels %d\\n\",\n buf, channels, avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n } else if (avctx->channel_layout) {\n avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n }\n if (avctx->channels < 0) {\n av_log(avctx, AV_LOG_ERROR, \"Specified number of channels %d is not supported\\n\",\n avctx->channels);\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if(avctx->codec_type == AVMEDIA_TYPE_VIDEO) {\n pixdesc = av_pix_fmt_desc_get(avctx->pix_fmt);\n if ( avctx->bits_per_raw_sample < 0\n || (avctx->bits_per_raw_sample > 8 && pixdesc->comp[0].depth <= 8)) {\n av_log(avctx, AV_LOG_WARNING, \"Specified bit depth %d not possible with the specified pixel formats depth %d\\n\",\n avctx->bits_per_raw_sample, pixdesc->comp[0].depth);\n avctx->bits_per_raw_sample = pixdesc->comp[0].depth;\n }\n if (avctx->width <= 0 || avctx->height <= 0) {\n av_log(avctx, AV_LOG_ERROR, \"dimensions not set\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n }\n if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)\n && avctx->bit_rate>0 && avctx->bit_rate<1000) {\n av_log(avctx, AV_LOG_WARNING, \"Bitrate %\"PRId64\" is extremely low, maybe you mean %\"PRId64\"k\\n\", avctx->bit_rate, avctx->bit_rate);\n }\n\n if (!avctx->rc_initial_buffer_occupancy)\n avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;\n\n if (avctx->ticks_per_frame && avctx->time_base.num &&\n avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {\n av_log(avctx, AV_LOG_ERROR,\n \"ticks_per_frame %d too large for the timebase %d/%d.\",\n avctx->ticks_per_frame,\n avctx->time_base.num,\n avctx->time_base.den);\n goto free_and_end;\n }\n\n if (avctx->hw_frames_ctx) {\n AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;\n if (frames_ctx->format != avctx->pix_fmt) {\n av_log(avctx, AV_LOG_ERROR,\n \"Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&\n avctx->sw_pix_fmt != frames_ctx->sw_format) {\n av_log(avctx, AV_LOG_ERROR,\n \"Mismatching AVCodecContext.sw_pix_fmt (%s) \"\n \"and AVHWFramesContext.sw_format (%s)\\n\",\n av_get_pix_fmt_name(avctx->sw_pix_fmt),\n av_get_pix_fmt_name(frames_ctx->sw_format));\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n avctx->sw_pix_fmt = frames_ctx->sw_format;\n }\n }\n\n avctx->pts_correction_num_faulty_pts =\n avctx->pts_correction_num_faulty_dts = 0;\n avctx->pts_correction_last_pts =\n avctx->pts_correction_last_dts = INT64_MIN;\n\n if ( !CONFIG_GRAY && avctx->flags & AV_CODEC_FLAG_GRAY\n && avctx->codec_descriptor->type == AVMEDIA_TYPE_VIDEO)\n av_log(avctx, AV_LOG_WARNING,\n \"gray decoding requested but not enabled at configuration time\\n\");\n\n if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME)\n || avctx->internal->frame_thread_encoder)) {\n ret = avctx->codec->init(avctx);\n if (ret < 0) {\n goto free_and_end;\n }\n codec_init_ok = 1;\n }\n\n ret=0;\n\n if (av_codec_is_decoder(avctx->codec)) {\n if (!avctx->bit_rate)\n avctx->bit_rate = get_bit_rate(avctx);\n /* validate channel layout from the decoder */\n if (avctx->channel_layout) {\n int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);\n if (!avctx->channels)\n avctx->channels = channels;\n else if (channels != avctx->channels) {\n char buf[512];\n av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);\n av_log(avctx, AV_LOG_WARNING,\n \"Channel layout '%s' with %d channels does not match specified number of channels %d: \"\n \"ignoring specified channel layout\\n\",\n buf, channels, avctx->channels);\n avctx->channel_layout = 0;\n }\n }\n if (avctx->channels && avctx->channels < 0 ||\n avctx->channels > FF_SANE_NB_CHANNELS) {\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->bits_per_coded_sample < 0) {\n ret = AVERROR(EINVAL);\n goto free_and_end;\n }\n if (avctx->sub_charenc) {\n if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {\n av_log(avctx, AV_LOG_ERROR, \"Character encoding is only \"\n \"supported with subtitles codecs\\n\");\n ret = AVERROR(EINVAL);\n goto free_and_end;\n } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) {\n av_log(avctx, AV_LOG_WARNING, \"Codec '%s' is bitmap-based, \"\n \"subtitles character encoding will be ignored\\n\",\n avctx->codec_descriptor->name);\n avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_DO_NOTHING;\n } else {\n /* input character encoding is set for a text based subtitle\n * codec at this point */\n if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_AUTOMATIC)\n avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_PRE_DECODER;\n\n if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_PRE_DECODER) {\n#if CONFIG_ICONV\n iconv_t cd = iconv_open(\"UTF-8\", avctx->sub_charenc);\n if (cd == (iconv_t)-1) {\n ret = AVERROR(errno);\n av_log(avctx, AV_LOG_ERROR, \"Unable to open iconv context \"\n \"with input character encoding \\\"%s\\\"\\n\", avctx->sub_charenc);\n goto free_and_end;\n }\n iconv_close(cd);\n#else\n av_log(avctx, AV_LOG_ERROR, \"Character encoding subtitles \"\n \"conversion needs a libavcodec built with iconv support \"\n \"for this codec\\n\");\n ret = AVERROR(ENOSYS);\n goto free_and_end;\n#endif\n }\n }\n }\n\n#if FF_API_AVCTX_TIMEBASE\n if (avctx->framerate.num > 0 && avctx->framerate.den > 0)\n avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));\n#endif\n }\n if (codec->priv_data_size > 0 && avctx->priv_data && codec->priv_class) {\n av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);\n }\n\nend:\n ff_unlock_avcodec(codec);\n if (options) {\n av_dict_free(options);\n *options = tmp;\n }\n\n return ret;\nfree_and_end:\n if (avctx->codec && avctx->codec->close &&\n (codec_init_ok ||\n (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP)))\n avctx->codec->close(avctx);\n\n if (codec->priv_class && codec->priv_data_size)\n av_opt_free(avctx->priv_data);\n av_opt_free(avctx);\n\n#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\n av_frame_free(&avctx->coded_frame);\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n\n av_dict_free(&tmp);\n av_freep(&avctx->priv_data);\n if (avctx->internal) {\n av_frame_free(&avctx->internal->to_free);\n av_frame_free(&avctx->internal->compat_decode_frame);\n av_frame_free(&avctx->internal->buffer_frame);\n av_packet_free(&avctx->internal->buffer_pkt);\n av_packet_free(&avctx->internal->last_pkt_props);\n\n av_packet_free(&avctx->internal->ds.in_pkt);\n ff_decode_bsfs_uninit(avctx);\n\n av_freep(&avctx->internal->pool);\n }\n av_freep(&avctx->internal);\n avctx->codec = NULL;\n goto end;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"avcodec_open2","file_name":"libavcodec/utils.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/8df6884832ec413cf032dfaa45c23b1c7876670c","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#43-14b5450892d5","input":"TfLiteStatus Subgraph::Invoke() {\n if (!consistent_) {\n ReportError(\"Invoke called on model that is not consistent.\");\n return kTfLiteError;\n }\n\n TfLiteStatus status = kTfLiteOk;\n if (state_ == kStateUninvokable) {\n ReportError(\"Invoke called on model that is not ready.\");\n return kTfLiteError;\n } else if (memory_planner_ && !memory_planner_->HasNonPersistentMemory()) {\n ReportError(\"Non-persistent memory is not available.\");\n return kTfLiteError;\n }\n\n // This is only needed for UseNNAPI(true);\n if (should_apply_nnapi_delegate_ && !applied_nnapi_delegate_) {\n TF_LITE_ENSURE_OK(&context_, ModifyGraphWithDelegate(NnApiDelegate()));\n // only need to modify the graph once upon the first invocation.\n applied_nnapi_delegate_ = true;\n }\n\n // Invocations are always done in node order.\n // Note that calling Invoke repeatedly will cause the original memory plan to\n // be reused, unless either ResizeInputTensor() or AllocateTensors() has been\n // called.\n for (int execution_plan_index = 0;\n execution_plan_index < execution_plan_.size(); execution_plan_index++) {\n if (execution_plan_index == next_execution_plan_index_to_prepare_) {\n TF_LITE_ENSURE_STATUS(PrepareOpsAndTensors());\n TF_LITE_ENSURE(&context_, next_execution_plan_index_to_prepare_ >=\n execution_plan_index);\n }\n int node_index = execution_plan_[execution_plan_index];\n TfLiteNode& node = nodes_and_registration_[node_index].first;\n const TfLiteRegistration& registration =\n nodes_and_registration_[node_index].second;\n\n const char* op_name = nullptr;\n if (profiler_) op_name = GetTFLiteOpName(registration);\n TFLITE_SCOPED_TAGGED_OPERATOR_PROFILE(profiler_.get(), op_name, node_index);\n\n // TODO(ycling): This is an extra loop through inputs to check if the data\n // need to be copied from Delegate buffer to raw memory, which is often not\n // needed. We may want to cache this in prepare to know if this needs to be\n // done for a node or not.\n for (int i = 0; i < node.inputs->size; ++i) {\n int tensor_index = node.inputs->data[i];\n if (tensor_index == kTfLiteOptionalTensor) {\n continue;\n }\n TfLiteTensor* tensor = &tensors_[tensor_index];\n if (tensor->delegate && tensor->delegate != node.delegate &&\n tensor->data_is_stale) {\n TF_LITE_ENSURE_STATUS(EnsureTensorDataIsReadable(tensor_index));\n }\n }\n\n if (check_cancelled_func_ != nullptr &&\n check_cancelled_func_(cancellation_data_)) {\n ReportError(\"Client requested cancel during Invoke()\");\n return kTfLiteError;\n }\n\n EnsureTensorsVectorCapacity();\n tensor_resized_since_op_invoke_ = false;\n if (OpInvoke(registration, &node) != kTfLiteOk) {\n return ReportOpError(&context_, node, registration, node_index,\n \"failed to invoke\");\n }\n\n // Force execution prep for downstream ops if the latest op triggered the\n // resize of a dynamic tensor.\n if (tensor_resized_since_op_invoke_ &&\n HasDynamicTensor(context_, node.outputs)) {\n next_execution_plan_index_to_prepare_ = execution_plan_index + 1;\n\n // This happens when an intermediate dynamic tensor is resized.\n // We don't have to prepare all the ops, but we need to recompute\n // the allocation plan.\n if (next_execution_plan_index_to_plan_allocation_ >\n next_execution_plan_index_to_prepare_) {\n next_execution_plan_index_to_plan_allocation_ =\n next_execution_plan_index_to_prepare_;\n if (memory_planner_) {\n TF_LITE_ENSURE_STATUS(memory_planner_->ResetAllocationsAfter(\n next_execution_plan_index_to_plan_allocation_ - 1));\n }\n }\n }\n }\n\n return status;\n}","target":"TfLiteStatus Subgraph::Invoke() {\n if (!consistent_) {\n ReportError(\"Invoke called on model that is not consistent.\");\n return kTfLiteError;\n }\n\n TfLiteStatus status = kTfLiteOk;\n if (state_ == kStateUninvokable) {\n ReportError(\"Invoke called on model that is not ready.\");\n return kTfLiteError;\n } else if (memory_planner_ && !memory_planner_->HasNonPersistentMemory()) {\n ReportError(\"Non-persistent memory is not available.\");\n return kTfLiteError;\n }\n\n // This is only needed for UseNNAPI(true);\n if (should_apply_nnapi_delegate_ && !applied_nnapi_delegate_) {\n TF_LITE_ENSURE_OK(&context_, ModifyGraphWithDelegate(NnApiDelegate()));\n // only need to modify the graph once upon the first invocation.\n applied_nnapi_delegate_ = true;\n }\n\n // Invocations are always done in node order.\n // Note that calling Invoke repeatedly will cause the original memory plan to\n // be reused, unless either ResizeInputTensor() or AllocateTensors() has been\n // called.\n for (int execution_plan_index = 0;\n execution_plan_index < execution_plan_.size(); execution_plan_index++) {\n if (execution_plan_index == next_execution_plan_index_to_prepare_) {\n TF_LITE_ENSURE_STATUS(PrepareOpsAndTensors());\n TF_LITE_ENSURE(&context_, next_execution_plan_index_to_prepare_ >=\n execution_plan_index);\n }\n int node_index = execution_plan_[execution_plan_index];\n TfLiteNode& node = nodes_and_registration_[node_index].first;\n const TfLiteRegistration& registration =\n nodes_and_registration_[node_index].second;\n\n const char* op_name = nullptr;\n if (profiler_) op_name = GetTFLiteOpName(registration);\n TFLITE_SCOPED_TAGGED_OPERATOR_PROFILE(profiler_.get(), op_name, node_index);\n\n // TODO(ycling): This is an extra loop through inputs to check if the data\n // need to be copied from Delegate buffer to raw memory, which is often not\n // needed. We may want to cache this in prepare to know if this needs to be\n // done for a node or not.\n for (int i = 0; i < node.inputs->size; ++i) {\n int tensor_index = node.inputs->data[i];\n if (tensor_index == kTfLiteOptionalTensor) {\n continue;\n }\n TfLiteTensor* tensor = &tensors_[tensor_index];\n if (tensor->delegate && tensor->delegate != node.delegate &&\n tensor->data_is_stale) {\n TF_LITE_ENSURE_STATUS(EnsureTensorDataIsReadable(tensor_index));\n }\n if (tensor->data.raw == nullptr && tensor->bytes > 0) {\n if (registration.builtin_code == kTfLiteBuiltinReshape && i == 1) {\n // In general, having a tensor here with no buffer will be an error.\n // However, for the reshape operator, the second input tensor is only\n // used for the shape, not for the data. Thus, null buffer is ok.\n continue;\n } else {\n // In all other cases, we need to return an error as otherwise we will\n // trigger a null pointer dereference (likely).\n ReportError(\"Input tensor %d lacks data\", tensor_index);\n return kTfLiteError;\n }\n }\n }\n\n if (check_cancelled_func_ != nullptr &&\n check_cancelled_func_(cancellation_data_)) {\n ReportError(\"Client requested cancel during Invoke()\");\n return kTfLiteError;\n }\n\n EnsureTensorsVectorCapacity();\n tensor_resized_since_op_invoke_ = false;\n if (OpInvoke(registration, &node) != kTfLiteOk) {\n return ReportOpError(&context_, node, registration, node_index,\n \"failed to invoke\");\n }\n\n // Force execution prep for downstream ops if the latest op triggered the\n // resize of a dynamic tensor.\n if (tensor_resized_since_op_invoke_ &&\n HasDynamicTensor(context_, node.outputs)) {\n next_execution_plan_index_to_prepare_ = execution_plan_index + 1;\n\n // This happens when an intermediate dynamic tensor is resized.\n // We don't have to prepare all the ops, but we need to recompute\n // the allocation plan.\n if (next_execution_plan_index_to_plan_allocation_ >\n next_execution_plan_index_to_prepare_) {\n next_execution_plan_index_to_plan_allocation_ =\n next_execution_plan_index_to_prepare_;\n if (memory_planner_) {\n TF_LITE_ENSURE_STATUS(memory_planner_->ResetAllocationsAfter(\n next_execution_plan_index_to_plan_allocation_ - 1));\n }\n }\n }\n }\n\n return status;\n}","lang":"cpp","vul_type":"cwe-476","sven_meta":{"func_name":"tflite::Subgraph::Invoke","file_name":"tensorflow/lite/core/subgraph.cc","commit_link":"github.com/tensorflow/tensorflow/commit/0b5662bc2be13a8c8f044d925d87fb6e56247cd8","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#44-0d6eab7eb5af","input":"static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tconst char *section_name = \"\";\n\tconst char *link_section_name = \"\";\n\tchar *end = NULL;\n\tElf_(Shdr) *link_shdr = NULL;\n\tut8 dfs[sizeof (Elf_(Verdef))] = {0};\n\tSdb *sdb;\n\tint cnt, i;\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn false;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (shdr->sh_size < 1 || shdr->sh_size > SIZE_MAX) {\n\t\treturn false;\n\t}\n\tElf_(Verdef) *defs = calloc (shdr->sh_size, sizeof (char));\n\tif (!defs) {\n\t\treturn false;\n\t}\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (link_shdr && bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!defs) {\n\t\tbprintf (\"Warning: Cannot allocate memory (Check Elf_(Verdef))\\n\");\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tend = (char *)defs + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tfor (cnt = 0, i = 0; i >= 0 && cnt < shdr->sh_info && ((char *)defs + i < end); ++cnt) {\n\t\tSdb *sdb_verdef = sdb_new0 ();\n\t\tchar *vstart = ((char*)defs) + i;\n\t\tchar key[32] = {0};\n\t\tElf_(Verdef) *verdef = (Elf_(Verdef)*)vstart;\n\t\tElf_(Verdaux) aux = {0};\n\t\tint j = 0;\n\t\tint isum = 0;\n\n\t\tr_buf_read_at (bin->b, shdr->sh_offset + i, dfs, sizeof (Elf_(Verdef)));\n\t\tverdef->vd_version = READ16 (dfs, j)\n\t\tverdef->vd_flags = READ16 (dfs, j)\n\t\tverdef->vd_ndx = READ16 (dfs, j)\n\t\tverdef->vd_cnt = READ16 (dfs, j)\n\t\tverdef->vd_hash = READ32 (dfs, j)\n\t\tverdef->vd_aux = READ32 (dfs, j)\n\t\tverdef->vd_next = READ32 (dfs, j)\n\t\tint vdaux = verdef->vd_aux;\n\t\tif (vdaux < 1) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tvstart += vdaux;\n\t\tif (vstart > end || vstart + sizeof (Elf_(Verdaux)) > end) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tj = 0;\n\t\taux.vda_name = READ32 (vstart, j)\n\t\taux.vda_next = READ32 (vstart, j)\n\n\t\tisum = i + verdef->vd_aux;\n\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tsdb_num_set (sdb_verdef, \"idx\", i, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_version\", verdef->vd_version, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_ndx\", verdef->vd_ndx, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_cnt\", verdef->vd_cnt, 0);\n\t\tsdb_set (sdb_verdef, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\tsdb_set (sdb_verdef, \"flags\", get_ver_flags (verdef->vd_flags), 0);\n\n\t\tfor (j = 1; j < verdef->vd_cnt; ++j) {\n\t\t\tint k;\n\t\t\tSdb *sdb_parent = sdb_new0 ();\n\t\t\tisum += aux.vda_next;\n\t\t\tvstart += aux.vda_next;\n\t\t\tif (vstart > end || vstart + sizeof(Elf_(Verdaux)) > end) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tk = 0;\n\t\t\taux.vda_name = READ32 (vstart, k)\n\t\t\taux.vda_next = READ32 (vstart, k)\n\t\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_parent, \"idx\", isum, 0);\n\t\t\tsdb_num_set (sdb_parent, \"parent\", j, 0);\n\t\t\tsdb_set (sdb_parent, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\t\tsnprintf (key, sizeof (key), \"parent%d\", j - 1);\n\t\t\tsdb_ns_set (sdb_verdef, key, sdb_parent);\n\t\t}\n\n\t\tsnprintf (key, sizeof (key), \"verdef%d\", cnt);\n\t\tsdb_ns_set (sdb, key, sdb_verdef);\n\t\tif (!verdef->vd_next) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tif ((st32)verdef->vd_next < 1) {\n\t\t\teprintf (\"Warning: Invalid vd_next in the ELF version\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += verdef->vd_next;\n\t}\n\tfree (defs);\n\treturn sdb;\nout_error:\n\tfree (defs);\n\tsdb_free (sdb);\n\treturn NULL;\n}","target":"static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) {\n\tconst char *section_name = \"\";\n\tconst char *link_section_name = \"\";\n\tchar *end = NULL;\n\tElf_(Shdr) *link_shdr = NULL;\n\tut8 dfs[sizeof (Elf_(Verdef))] = {0};\n\tSdb *sdb;\n\tint cnt, i;\n\tif (shdr->sh_link > bin->ehdr.e_shnum) {\n\t\treturn false;\n\t}\n\tlink_shdr = &bin->shdr[shdr->sh_link];\n\tif (shdr->sh_size < 1 || shdr->sh_size > SIZE_MAX) {\n\t\treturn false;\n\t}\n\tElf_(Verdef) *defs = calloc (shdr->sh_size, sizeof (char));\n\tif (!defs) {\n\t\treturn false;\n\t}\n\tif (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) {\n\t\tsection_name = &bin->shstrtab[shdr->sh_name];\n\t}\n\tif (link_shdr && bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) {\n\t\tlink_section_name = &bin->shstrtab[link_shdr->sh_name];\n\t}\n\tif (!defs) {\n\t\tbprintf (\"Warning: Cannot allocate memory (Check Elf_(Verdef))\\n\");\n\t\treturn NULL;\n\t}\n\tsdb = sdb_new0 ();\n\tend = (char *)defs + shdr->sh_size;\n\tsdb_set (sdb, \"section_name\", section_name, 0);\n\tsdb_num_set (sdb, \"entries\", shdr->sh_info, 0);\n\tsdb_num_set (sdb, \"addr\", shdr->sh_addr, 0);\n\tsdb_num_set (sdb, \"offset\", shdr->sh_offset, 0);\n\tsdb_num_set (sdb, \"link\", shdr->sh_link, 0);\n\tsdb_set (sdb, \"link_section_name\", link_section_name, 0);\n\n\tfor (cnt = 0, i = 0; i >= 0 && cnt < shdr->sh_info && (end - (char *)defs > i); ++cnt) {\n\t\tSdb *sdb_verdef = sdb_new0 ();\n\t\tchar *vstart = ((char*)defs) + i;\n\t\tchar key[32] = {0};\n\t\tElf_(Verdef) *verdef = (Elf_(Verdef)*)vstart;\n\t\tElf_(Verdaux) aux = {0};\n\t\tint j = 0;\n\t\tint isum = 0;\n\n\t\tr_buf_read_at (bin->b, shdr->sh_offset + i, dfs, sizeof (Elf_(Verdef)));\n\t\tverdef->vd_version = READ16 (dfs, j)\n\t\tverdef->vd_flags = READ16 (dfs, j)\n\t\tverdef->vd_ndx = READ16 (dfs, j)\n\t\tverdef->vd_cnt = READ16 (dfs, j)\n\t\tverdef->vd_hash = READ32 (dfs, j)\n\t\tverdef->vd_aux = READ32 (dfs, j)\n\t\tverdef->vd_next = READ32 (dfs, j)\n\t\tint vdaux = verdef->vd_aux;\n\t\tif (vdaux < 1 || (char *)UINTPTR_MAX - vstart < vdaux) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tvstart += vdaux;\n\t\tif (vstart > end || end - vstart < sizeof (Elf_(Verdaux))) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tj = 0;\n\t\taux.vda_name = READ32 (vstart, j)\n\t\taux.vda_next = READ32 (vstart, j)\n\n\t\tisum = i + verdef->vd_aux;\n\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\n\t\tsdb_num_set (sdb_verdef, \"idx\", i, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_version\", verdef->vd_version, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_ndx\", verdef->vd_ndx, 0);\n\t\tsdb_num_set (sdb_verdef, \"vd_cnt\", verdef->vd_cnt, 0);\n\t\tsdb_set (sdb_verdef, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\tsdb_set (sdb_verdef, \"flags\", get_ver_flags (verdef->vd_flags), 0);\n\n\t\tfor (j = 1; j < verdef->vd_cnt; ++j) {\n\t\t\tint k;\n\t\t\tSdb *sdb_parent = sdb_new0 ();\n\t\t\tisum += aux.vda_next;\n\t\t\tvstart += aux.vda_next;\n\t\t\tif (vstart > end || end - vstart < sizeof (Elf_(Verdaux))) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tk = 0;\n\t\t\taux.vda_name = READ32 (vstart, k)\n\t\t\taux.vda_next = READ32 (vstart, k)\n\t\t\tif (aux.vda_name > bin->dynstr_size) {\n\t\t\t\tsdb_free (sdb_verdef);\n\t\t\t\tsdb_free (sdb_parent);\n\t\t\t\tgoto out_error;\n\t\t\t}\n\t\t\tsdb_num_set (sdb_parent, \"idx\", isum, 0);\n\t\t\tsdb_num_set (sdb_parent, \"parent\", j, 0);\n\t\t\tsdb_set (sdb_parent, \"vda_name\", &bin->dynstr[aux.vda_name], 0);\n\t\t\tsnprintf (key, sizeof (key), \"parent%d\", j - 1);\n\t\t\tsdb_ns_set (sdb_verdef, key, sdb_parent);\n\t\t}\n\n\t\tsnprintf (key, sizeof (key), \"verdef%d\", cnt);\n\t\tsdb_ns_set (sdb, key, sdb_verdef);\n\t\tif (!verdef->vd_next) {\n\t\t\tsdb_free (sdb_verdef);\n\t\t\tgoto out_error;\n\t\t}\n\t\tif ((st32)verdef->vd_next < 1) {\n\t\t\teprintf (\"Warning: Invalid vd_next in the ELF version\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ti += verdef->vd_next;\n\t}\n\tfree (defs);\n\treturn sdb;\nout_error:\n\tfree (defs);\n\tsdb_free (sdb);\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"store_versioninfo_gnu_verdef","file_name":"libr/bin/format/elf/elf.c","commit_link":"github.com/radare/radare2/commit/62e39f34b2705131a2d08aff0c2e542c6a52cf0e","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#45-2478f58af2a6","input":"upnp_redirect(const char * rhost, unsigned short eport,\n const char * iaddr, unsigned short iport,\n const char * protocol, const char * desc,\n unsigned int leaseduration)\n{\n\tint proto, r;\n\tchar iaddr_old[32];\n\tchar rhost_old[32];\n\tunsigned short iport_old;\n\tstruct in_addr address;\n\tunsigned int timestamp;\n\n\tproto = proto_atoi(protocol);\n\tif(inet_aton(iaddr, &address) <= 0) {\n\t\tsyslog(LOG_ERR, \"inet_aton(%s) FAILED\", iaddr);\n\t\treturn -1;\n\t}\n\n\tif(!check_upnp_rule_against_permissions(upnppermlist, num_upnpperm,\n\t eport, address, iport)) {\n\t\tsyslog(LOG_INFO, \"redirection permission check failed for \"\n\t\t \"%hu->%s:%hu %s\", eport, iaddr, iport, protocol);\n\t\treturn -3;\n\t}\n\t/* IGDv1 (WANIPConnection:1 Service Template Version 1.01 / Nov 12, 2001)\n\t * - 2.2.20.PortMappingDescription :\n\t * Overwriting Previous / Existing Port Mappings:\n\t * If the RemoteHost, ExternalPort, PortMappingProtocol and InternalClient\n\t * are exactly the same as an existing mapping, the existing mapping values\n\t * for InternalPort, PortMappingDescription, PortMappingEnabled and\n\t * PortMappingLeaseDuration are overwritten.\n\t * Rejecting a New Port Mapping:\n\t * In cases where the RemoteHost, ExternalPort and PortMappingProtocol\n\t * are the same as an existing mapping, but the InternalClient is\n\t * different, the action is rejected with an appropriate error.\n\t * Add or Reject New Port Mapping behavior based on vendor implementation:\n\t * In cases where the ExternalPort, PortMappingProtocol and InternalClient\n\t * are the same, but RemoteHost is different, the vendor can choose to\n\t * support both mappings simultaneously, or reject the second mapping\n\t * with an appropriate error.\n\t *\n\t * - 2.4.16.AddPortMapping\n\t * This action creates a new port mapping or overwrites an existing\n\t * mapping with the same internal client. If the ExternalPort and\n\t * PortMappingProtocol pair is already mapped to another internal client,\n\t * an error is returned.\n\t *\n\t * IGDv2 (WANIPConnection:2 Service Standardized DCP (SDCP) Sep 10, 2010)\n\t * Protocol ExternalPort RemoteHost InternalClient Result\n\t * = = ≠ ≠ Failure\n\t * = = ≠ = Failure or success\n\t * (vendor specific)\n\t * = = = ≠ Failure\n\t * = = = = Success (overwrite)\n\t */\n\trhost_old[0] = '\\0';\n\tr = get_redirect_rule(ext_if_name, eport, proto,\n\t iaddr_old, sizeof(iaddr_old), &iport_old, 0, 0,\n\t rhost_old, sizeof(rhost_old),\n\t ×tamp, 0, 0);\n\tif(r == 0) {\n\t\tif(strcmp(iaddr, iaddr_old)==0 &&\n\t\t ((rhost == NULL && rhost_old[0]=='\\0') ||\n\t\t (rhost && (strcmp(rhost, \"*\") == 0) && rhost_old[0]=='\\0') ||\n\t\t (rhost && (strcmp(rhost, rhost_old) == 0)))) {\n\t\t\tsyslog(LOG_INFO, \"updating existing port mapping %hu %s (rhost '%s') => %s:%hu\",\n\t\t\t\teport, protocol, rhost_old, iaddr_old, iport_old);\n\t\t\ttimestamp = (leaseduration > 0) ? upnp_time() + leaseduration : 0;\n\t\t\tif(iport != iport_old) {\n\t\t\t\tr = update_portmapping(ext_if_name, eport, proto, iport, desc, timestamp);\n\t\t\t} else {\n\t\t\t\tr = update_portmapping_desc_timestamp(ext_if_name, eport, proto, desc, timestamp);\n\t\t\t}\n#ifdef ENABLE_LEASEFILE\n\t\t\tif(r == 0) {\n\t\t\t\tlease_file_remove(eport, proto);\n\t\t\t\tlease_file_add(eport, iaddr, iport, proto, desc, timestamp);\n\t\t\t}\n#endif /* ENABLE_LEASEFILE */\n\t\t\treturn r;\n\t\t} else {\n\t\t\tsyslog(LOG_INFO, \"port %hu %s (rhost '%s') already redirected to %s:%hu\",\n\t\t\t\teport, protocol, rhost_old, iaddr_old, iport_old);\n\t\t\treturn -2;\n\t\t}\n#ifdef CHECK_PORTINUSE\n\t} else if (port_in_use(ext_if_name, eport, proto, iaddr, iport) > 0) {\n\t\tsyslog(LOG_INFO, \"port %hu protocol %s already in use\",\n\t\t eport, protocol);\n\t\treturn -4;\n#endif /* CHECK_PORTINUSE */\n\t} else {\n\t\ttimestamp = (leaseduration > 0) ? upnp_time() + leaseduration : 0;\n\t\tsyslog(LOG_INFO, \"redirecting port %hu to %s:%hu protocol %s for: %s\",\n\t\t\teport, iaddr, iport, protocol, desc);\n\t\treturn upnp_redirect_internal(rhost, eport, iaddr, iport, proto,\n\t\t desc, timestamp);\n\t}\n}","target":"upnp_redirect(const char * rhost, unsigned short eport,\n const char * iaddr, unsigned short iport,\n const char * protocol, const char * desc,\n unsigned int leaseduration)\n{\n\tint proto, r;\n\tchar iaddr_old[32];\n\tchar rhost_old[32];\n\tunsigned short iport_old;\n\tstruct in_addr address;\n\tunsigned int timestamp;\n\n\tproto = proto_atoi(protocol);\n\tif(inet_aton(iaddr, &address) <= 0) {\n\t\tsyslog(LOG_ERR, \"inet_aton(%s) FAILED\", iaddr);\n\t\treturn -1;\n\t}\n\n\tif(!check_upnp_rule_against_permissions(upnppermlist, num_upnpperm,\n\t eport, address, iport)) {\n\t\tsyslog(LOG_INFO, \"redirection permission check failed for \"\n\t\t \"%hu->%s:%hu %s\", eport, iaddr, iport, protocol);\n\t\treturn -3;\n\t}\n\n\tif (desc == NULL)\n\t\tdesc = \"\";\t/* assume empty description */\n\n\t/* IGDv1 (WANIPConnection:1 Service Template Version 1.01 / Nov 12, 2001)\n\t * - 2.2.20.PortMappingDescription :\n\t * Overwriting Previous / Existing Port Mappings:\n\t * If the RemoteHost, ExternalPort, PortMappingProtocol and InternalClient\n\t * are exactly the same as an existing mapping, the existing mapping values\n\t * for InternalPort, PortMappingDescription, PortMappingEnabled and\n\t * PortMappingLeaseDuration are overwritten.\n\t * Rejecting a New Port Mapping:\n\t * In cases where the RemoteHost, ExternalPort and PortMappingProtocol\n\t * are the same as an existing mapping, but the InternalClient is\n\t * different, the action is rejected with an appropriate error.\n\t * Add or Reject New Port Mapping behavior based on vendor implementation:\n\t * In cases where the ExternalPort, PortMappingProtocol and InternalClient\n\t * are the same, but RemoteHost is different, the vendor can choose to\n\t * support both mappings simultaneously, or reject the second mapping\n\t * with an appropriate error.\n\t *\n\t * - 2.4.16.AddPortMapping\n\t * This action creates a new port mapping or overwrites an existing\n\t * mapping with the same internal client. If the ExternalPort and\n\t * PortMappingProtocol pair is already mapped to another internal client,\n\t * an error is returned.\n\t *\n\t * IGDv2 (WANIPConnection:2 Service Standardized DCP (SDCP) Sep 10, 2010)\n\t * Protocol ExternalPort RemoteHost InternalClient Result\n\t * = = ≠ ≠ Failure\n\t * = = ≠ = Failure or success\n\t * (vendor specific)\n\t * = = = ≠ Failure\n\t * = = = = Success (overwrite)\n\t */\n\trhost_old[0] = '\\0';\n\tr = get_redirect_rule(ext_if_name, eport, proto,\n\t iaddr_old, sizeof(iaddr_old), &iport_old, 0, 0,\n\t rhost_old, sizeof(rhost_old),\n\t ×tamp, 0, 0);\n\tif(r == 0) {\n\t\tif(strcmp(iaddr, iaddr_old)==0 &&\n\t\t ((rhost == NULL && rhost_old[0]=='\\0') ||\n\t\t (rhost && (strcmp(rhost, \"*\") == 0) && rhost_old[0]=='\\0') ||\n\t\t (rhost && (strcmp(rhost, rhost_old) == 0)))) {\n\t\t\tsyslog(LOG_INFO, \"updating existing port mapping %hu %s (rhost '%s') => %s:%hu\",\n\t\t\t\teport, protocol, rhost_old, iaddr_old, iport_old);\n\t\t\ttimestamp = (leaseduration > 0) ? upnp_time() + leaseduration : 0;\n\t\t\tif(iport != iport_old) {\n\t\t\t\tr = update_portmapping(ext_if_name, eport, proto, iport, desc, timestamp);\n\t\t\t} else {\n\t\t\t\tr = update_portmapping_desc_timestamp(ext_if_name, eport, proto, desc, timestamp);\n\t\t\t}\n#ifdef ENABLE_LEASEFILE\n\t\t\tif(r == 0) {\n\t\t\t\tlease_file_remove(eport, proto);\n\t\t\t\tlease_file_add(eport, iaddr, iport, proto, desc, timestamp);\n\t\t\t}\n#endif /* ENABLE_LEASEFILE */\n\t\t\treturn r;\n\t\t} else {\n\t\t\tsyslog(LOG_INFO, \"port %hu %s (rhost '%s') already redirected to %s:%hu\",\n\t\t\t\teport, protocol, rhost_old, iaddr_old, iport_old);\n\t\t\treturn -2;\n\t\t}\n#ifdef CHECK_PORTINUSE\n\t} else if (port_in_use(ext_if_name, eport, proto, iaddr, iport) > 0) {\n\t\tsyslog(LOG_INFO, \"port %hu protocol %s already in use\",\n\t\t eport, protocol);\n\t\treturn -4;\n#endif /* CHECK_PORTINUSE */\n\t} else {\n\t\ttimestamp = (leaseduration > 0) ? upnp_time() + leaseduration : 0;\n\t\tsyslog(LOG_INFO, \"redirecting port %hu to %s:%hu protocol %s for: %s\",\n\t\t\teport, iaddr, iport, protocol, desc);\n\t\treturn upnp_redirect_internal(rhost, eport, iaddr, iport, proto,\n\t\t desc, timestamp);\n\t}\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"upnp_redirect","file_name":"miniupnpd/upnpredirect.c","commit_link":"github.com/miniupnp/miniupnp/commit/f321c2066b96d18afa5158dfa2d2873a2957ef38","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#46-fb6fee9ea8da","input":"static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,\n const ImageInfo *IMimage_info,Image *IMimage,ExceptionInfo *exception)\n{\n char\n im_vers[32],\n libpng_runv[32],\n libpng_vers[32],\n zlib_runv[32],\n zlib_vers[32];\n\n Image\n *image;\n\n ImageInfo\n *image_info;\n\n char\n s[2];\n\n const char\n *name,\n *property,\n *value;\n\n const StringInfo\n *profile;\n\n int\n num_passes,\n pass,\n ping_wrote_caNv;\n\n png_byte\n ping_trans_alpha[256];\n\n png_color\n palette[257];\n\n png_color_16\n ping_background,\n ping_trans_color;\n\n png_info\n *ping_info;\n\n png_struct\n *ping;\n\n png_uint_32\n ping_height,\n ping_width;\n\n ssize_t\n y;\n\n MagickBooleanType\n image_matte,\n logging,\n matte,\n\n ping_have_blob,\n ping_have_cheap_transparency,\n ping_have_color,\n ping_have_non_bw,\n ping_have_PLTE,\n ping_have_bKGD,\n ping_have_eXIf,\n ping_have_iCCP,\n ping_have_pHYs,\n ping_have_sRGB,\n ping_have_tRNS,\n\n ping_exclude_bKGD,\n ping_exclude_cHRM,\n ping_exclude_date,\n /* ping_exclude_EXIF, */\n ping_exclude_eXIf,\n ping_exclude_gAMA,\n ping_exclude_iCCP,\n /* ping_exclude_iTXt, */\n ping_exclude_oFFs,\n ping_exclude_pHYs,\n ping_exclude_sRGB,\n ping_exclude_tEXt,\n ping_exclude_tIME,\n /* ping_exclude_tRNS, */\n ping_exclude_vpAg,\n ping_exclude_caNv,\n ping_exclude_zCCP, /* hex-encoded iCCP */\n ping_exclude_zTXt,\n\n ping_preserve_colormap,\n ping_preserve_iCCP,\n ping_need_colortype_warning,\n\n status,\n tried_332,\n tried_333,\n tried_444;\n\n MemoryInfo\n *volatile pixel_info;\n\n QuantumInfo\n *quantum_info;\n\n PNGErrorInfo\n error_info;\n\n register ssize_t\n i,\n x;\n\n unsigned char\n *ping_pixels;\n\n volatile int\n image_colors,\n ping_bit_depth,\n ping_color_type,\n ping_interlace_method,\n ping_compression_method,\n ping_filter_method,\n ping_num_trans;\n\n volatile size_t\n image_depth,\n old_bit_depth;\n\n size_t\n quality,\n rowbytes,\n save_image_depth;\n\n int\n j,\n number_colors,\n number_opaque,\n number_semitransparent,\n number_transparent,\n ping_pHYs_unit_type;\n\n png_uint_32\n ping_pHYs_x_resolution,\n ping_pHYs_y_resolution;\n\n logging=LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter WriteOnePNGImage()\");\n\n image = CloneImage(IMimage,0,0,MagickFalse,exception);\n image_info=(ImageInfo *) CloneImageInfo(IMimage_info);\n if (image_info == (ImageInfo *) NULL)\n ThrowWriterException(ResourceLimitError, \"MemoryAllocationFailed\");\n\n /* Define these outside of the following \"if logging()\" block so they will\n * show in debuggers.\n */\n *im_vers='\\0';\n (void) ConcatenateMagickString(im_vers,\n MagickLibVersionText,MagickPathExtent);\n (void) ConcatenateMagickString(im_vers,\n MagickLibAddendum,MagickPathExtent);\n\n *libpng_vers='\\0';\n (void) ConcatenateMagickString(libpng_vers,\n PNG_LIBPNG_VER_STRING,32);\n *libpng_runv='\\0';\n (void) ConcatenateMagickString(libpng_runv,\n png_get_libpng_ver(NULL),32);\n\n *zlib_vers='\\0';\n (void) ConcatenateMagickString(zlib_vers,\n ZLIB_VERSION,32);\n *zlib_runv='\\0';\n (void) ConcatenateMagickString(zlib_runv,\n zlib_version,32);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" IM version = %s\",\n im_vers);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Libpng version = %s\",\n libpng_vers);\n if (LocaleCompare(libpng_vers,libpng_runv) != 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" running with %s\",\n libpng_runv);\n }\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Zlib version = %s\",\n zlib_vers);\n if (LocaleCompare(zlib_vers,zlib_runv) != 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" running with %s\",\n zlib_runv);\n }\n }\n\n /* Initialize some stuff */\n ping_bit_depth=0,\n ping_color_type=0,\n ping_interlace_method=0,\n ping_compression_method=0,\n ping_filter_method=0,\n ping_num_trans = 0;\n\n ping_background.red = 0;\n ping_background.green = 0;\n ping_background.blue = 0;\n ping_background.gray = 0;\n ping_background.index = 0;\n\n ping_trans_color.red=0;\n ping_trans_color.green=0;\n ping_trans_color.blue=0;\n ping_trans_color.gray=0;\n\n ping_pHYs_unit_type = 0;\n ping_pHYs_x_resolution = 0;\n ping_pHYs_y_resolution = 0;\n\n ping_have_blob=MagickFalse;\n ping_have_cheap_transparency=MagickFalse;\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n ping_have_PLTE=MagickFalse;\n ping_have_bKGD=MagickFalse;\n ping_have_eXIf=MagickTrue;\n ping_have_iCCP=MagickFalse;\n ping_have_pHYs=MagickFalse;\n ping_have_sRGB=MagickFalse;\n ping_have_tRNS=MagickFalse;\n\n ping_exclude_bKGD=mng_info->ping_exclude_bKGD;\n ping_exclude_caNv=mng_info->ping_exclude_caNv;\n ping_exclude_cHRM=mng_info->ping_exclude_cHRM;\n ping_exclude_date=mng_info->ping_exclude_date;\n ping_exclude_eXIf=mng_info->ping_exclude_eXIf;\n ping_exclude_gAMA=mng_info->ping_exclude_gAMA;\n ping_exclude_iCCP=mng_info->ping_exclude_iCCP;\n /* ping_exclude_iTXt=mng_info->ping_exclude_iTXt; */\n ping_exclude_oFFs=mng_info->ping_exclude_oFFs;\n ping_exclude_pHYs=mng_info->ping_exclude_pHYs;\n ping_exclude_sRGB=mng_info->ping_exclude_sRGB;\n ping_exclude_tEXt=mng_info->ping_exclude_tEXt;\n ping_exclude_tIME=mng_info->ping_exclude_tIME;\n /* ping_exclude_tRNS=mng_info->ping_exclude_tRNS; */\n ping_exclude_vpAg=mng_info->ping_exclude_vpAg;\n ping_exclude_zCCP=mng_info->ping_exclude_zCCP; /* hex-encoded iCCP in zTXt */\n ping_exclude_zTXt=mng_info->ping_exclude_zTXt;\n\n ping_preserve_colormap = mng_info->ping_preserve_colormap;\n ping_preserve_iCCP = mng_info->ping_preserve_iCCP;\n ping_need_colortype_warning = MagickFalse;\n\n /* Recognize the ICC sRGB profile and convert it to the sRGB chunk,\n * i.e., eliminate the ICC profile and set image->rendering_intent.\n * Note that this will not involve any changes to the actual pixels\n * but merely passes information to applications that read the resulting\n * PNG image.\n *\n * To do: recognize other variants of the sRGB profile, using the CRC to\n * verify all recognized variants including the 7 already known.\n *\n * Work around libpng16+ rejecting some \"known invalid sRGB profiles\".\n *\n * Use something other than image->rendering_intent to record the fact\n * that the sRGB profile was found.\n *\n * Record the ICC version (currently v2 or v4) of the incoming sRGB ICC\n * profile. Record the Blackpoint Compensation, if any.\n */\n if (ping_exclude_sRGB == MagickFalse && ping_preserve_iCCP == MagickFalse)\n {\n char\n *name;\n\n const StringInfo\n *profile;\n\n ResetImageProfileIterator(image);\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n\n {\n int\n icheck,\n got_crc=0;\n\n\n png_uint_32\n length,\n profile_crc=0;\n\n unsigned char\n *data;\n\n length=(png_uint_32) GetStringInfoLength(profile);\n\n for (icheck=0; sRGB_info[icheck].len > 0; icheck++)\n {\n if (length == sRGB_info[icheck].len)\n {\n if (got_crc == 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Got a %lu-byte ICC profile (potentially sRGB)\",\n (unsigned long) length);\n\n data=GetStringInfoDatum(profile);\n profile_crc=crc32(0,data,length);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" with crc=%8x\",(unsigned int) profile_crc);\n got_crc++;\n }\n\n if (profile_crc == sRGB_info[icheck].crc)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" It is sRGB with rendering intent = %s\",\n Magick_RenderingIntentString_from_PNG_RenderingIntent(\n sRGB_info[icheck].intent));\n if (image->rendering_intent==UndefinedIntent)\n {\n image->rendering_intent=\n Magick_RenderingIntent_from_PNG_RenderingIntent(\n sRGB_info[icheck].intent);\n }\n ping_exclude_iCCP = MagickTrue;\n ping_exclude_zCCP = MagickTrue;\n ping_have_sRGB = MagickTrue;\n break;\n }\n }\n }\n if (sRGB_info[icheck].len == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Got %lu-byte ICC profile not recognized as sRGB\",\n (unsigned long) length);\n }\n }\n name=GetNextImageProfile(image);\n }\n }\n\n number_opaque = 0;\n number_semitransparent = 0;\n number_transparent = 0;\n\n if (logging != MagickFalse)\n {\n if (image->storage_class == UndefinedClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=UndefinedClass\");\n if (image->storage_class == DirectClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=DirectClass\");\n if (image->storage_class == PseudoClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=PseudoClass\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(), image->taint ?\n \" image->taint=MagickTrue\":\n \" image->taint=MagickFalse\");\n }\n\n if (image->storage_class == PseudoClass &&\n (mng_info->write_png8 || mng_info->write_png24 || mng_info->write_png32 ||\n mng_info->write_png48 || mng_info->write_png64 ||\n (mng_info->write_png_colortype != 1 &&\n mng_info->write_png_colortype != 5)))\n {\n (void) SyncImage(image,exception);\n image->storage_class = DirectClass;\n }\n\n if (ping_preserve_colormap == MagickFalse)\n {\n if (image->storage_class != PseudoClass && image->colormap != NULL)\n {\n /* Free the bogus colormap; it can cause trouble later */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Freeing bogus colormap\");\n (void) RelinquishMagickMemory(image->colormap);\n image->colormap=NULL;\n }\n }\n\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n\n /*\n Sometimes we get PseudoClass images whose RGB values don't match\n the colors in the colormap. This code syncs the RGB values.\n */\n if (image->depth <= 8 && image->taint && image->storage_class == PseudoClass)\n (void) SyncImage(image,exception);\n\n#if (MAGICKCORE_QUANTUM_DEPTH == 8)\n if (image->depth > 8)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reducing PNG bit depth to 8 since this is a Q8 build.\");\n\n image->depth=8;\n }\n#endif\n\n /* Respect the -depth option */\n if (image->depth < 4)\n {\n register Quantum\n *r;\n\n if (image->depth > 2)\n {\n /* Scale to 4-bit */\n LBR04PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR04PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR04PacketRGBO(image->colormap[i]);\n }\n }\n }\n else if (image->depth > 1)\n {\n /* Scale to 2-bit */\n LBR02PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR02PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR02PacketRGBO(image->colormap[i]);\n }\n }\n }\n else\n {\n /* Scale to 1-bit */\n LBR01PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR01PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR01PacketRGBO(image->colormap[i]);\n }\n }\n }\n }\n\n /* To do: set to next higher multiple of 8 */\n if (image->depth < 8)\n image->depth=8;\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n /* PNG does not handle depths greater than 16 so reduce it even\n * if lossy\n */\n if (image->depth > 8)\n image->depth=16;\n#endif\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 8)\n if (image->depth > 8)\n {\n /* To do: fill low byte properly */\n image->depth=16;\n }\n\n if (image->depth == 16 && mng_info->write_png_depth != 16)\n if (mng_info->write_png8 ||\n LosslessReduceDepthOK(image,exception) != MagickFalse)\n image->depth = 8;\n#endif\n\n image_colors = (int) image->colors;\n number_opaque = (int) image->colors;\n number_transparent = 0;\n number_semitransparent = 0;\n\n if (mng_info->write_png_colortype &&\n (mng_info->write_png_colortype > 4 || (mng_info->write_png_depth >= 8 &&\n mng_info->write_png_colortype < 4 &&\n image->alpha_trait == UndefinedPixelTrait)))\n {\n /* Avoid the expensive BUILD_PALETTE operation if we're sure that we\n * are not going to need the result.\n */\n if (mng_info->write_png_colortype == 1 ||\n mng_info->write_png_colortype == 5)\n ping_have_color=MagickFalse;\n\n if (image->alpha_trait != UndefinedPixelTrait)\n {\n number_transparent = 2;\n number_semitransparent = 1;\n }\n }\n\n if (mng_info->write_png_colortype < 7)\n {\n /* BUILD_PALETTE\n *\n * Normally we run this just once, but in the case of writing PNG8\n * we reduce the transparency to binary and run again, then if there\n * are still too many colors we reduce to a simple 4-4-4-1, then 3-3-3-1\n * RGBA palette and run again, and then to a simple 3-3-2-1 RGBA\n * palette. Then (To do) we take care of a final reduction that is only\n * needed if there are still 256 colors present and one of them has both\n * transparent and opaque instances.\n */\n\n tried_332 = MagickFalse;\n tried_333 = MagickFalse;\n tried_444 = MagickFalse;\n\n for (j=0; j<6; j++)\n {\n /*\n * Sometimes we get DirectClass images that have 256 colors or fewer.\n * This code will build a colormap.\n *\n * Also, sometimes we get PseudoClass images with an out-of-date\n * colormap. This code will replace the colormap with a new one.\n * Sometimes we get PseudoClass images that have more than 256 colors.\n * This code will delete the colormap and change the image to\n * DirectClass.\n *\n * If image->alpha_trait is MagickFalse, we ignore the alpha channel\n * even though it sometimes contains left-over non-opaque values.\n *\n * Also we gather some information (number of opaque, transparent,\n * and semitransparent pixels, and whether the image has any non-gray\n * pixels or only black-and-white pixels) that we might need later.\n *\n * Even if the user wants to force GrayAlpha or RGBA (colortype 4 or 6)\n * we need to check for bogus non-opaque values, at least.\n */\n\n int\n n;\n\n PixelInfo\n opaque[260],\n semitransparent[260],\n transparent[260];\n\n register const Quantum\n *s;\n\n register Quantum\n *q,\n *r;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter BUILD_PALETTE:\");\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->columns=%.20g\",(double) image->columns);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->rows=%.20g\",(double) image->rows);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->alpha_trait=%.20g\",(double) image->alpha_trait);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->depth=%.20g\",(double) image->depth);\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Original colormap:\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" i (red,green,blue,alpha)\");\n\n for (i=0; i < 256; i++)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n\n for (i=image->colors - 10; i < (ssize_t) image->colors; i++)\n {\n if (i > 255)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n }\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d\",(int) image->colors);\n\n if (image->colors == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" (zero means unknown)\");\n\n if (ping_preserve_colormap == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Regenerate the colormap\");\n }\n\n image_colors=0;\n number_opaque = 0;\n number_semitransparent = 0;\n number_transparent = 0;\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (image->alpha_trait == UndefinedPixelTrait ||\n GetPixelAlpha(image,q) == OpaqueAlpha)\n {\n if (number_opaque < 259)\n {\n if (number_opaque == 0)\n {\n GetPixelInfoPixel(image, q, opaque);\n opaque[0].alpha=OpaqueAlpha;\n number_opaque=1;\n }\n\n for (i=0; i< (ssize_t) number_opaque; i++)\n {\n if (Magick_png_color_equal(image,q,opaque+i))\n break;\n }\n\n if (i == (ssize_t) number_opaque && number_opaque < 259)\n {\n number_opaque++;\n GetPixelInfoPixel(image, q, opaque+i);\n opaque[i].alpha=OpaqueAlpha;\n }\n }\n }\n else if (GetPixelAlpha(image,q) == TransparentAlpha)\n {\n if (number_transparent < 259)\n {\n if (number_transparent == 0)\n {\n GetPixelInfoPixel(image, q, transparent);\n ping_trans_color.red=(unsigned short)\n GetPixelRed(image,q);\n ping_trans_color.green=(unsigned short)\n GetPixelGreen(image,q);\n ping_trans_color.blue=(unsigned short)\n GetPixelBlue(image,q);\n ping_trans_color.gray=(unsigned short)\n GetPixelGray(image,q);\n number_transparent = 1;\n }\n\n for (i=0; i< (ssize_t) number_transparent; i++)\n {\n if (Magick_png_color_equal(image,q,transparent+i))\n break;\n }\n\n if (i == (ssize_t) number_transparent &&\n number_transparent < 259)\n {\n number_transparent++;\n GetPixelInfoPixel(image,q,transparent+i);\n }\n }\n }\n else\n {\n if (number_semitransparent < 259)\n {\n if (number_semitransparent == 0)\n {\n GetPixelInfoPixel(image,q,semitransparent);\n number_semitransparent = 1;\n }\n\n for (i=0; i< (ssize_t) number_semitransparent; i++)\n {\n if (Magick_png_color_equal(image,q,semitransparent+i)\n && GetPixelAlpha(image,q) ==\n semitransparent[i].alpha)\n break;\n }\n\n if (i == (ssize_t) number_semitransparent &&\n number_semitransparent < 259)\n {\n number_semitransparent++;\n GetPixelInfoPixel(image, q, semitransparent+i);\n }\n }\n }\n q+=GetPixelChannels(image);\n }\n }\n\n if (mng_info->write_png8 == MagickFalse &&\n ping_exclude_bKGD == MagickFalse)\n {\n /* Add the background color to the palette, if it\n * isn't already there.\n */\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Check colormap for background (%d,%d,%d)\",\n (int) image->background_color.red,\n (int) image->background_color.green,\n (int) image->background_color.blue);\n }\n for (i=0; ibackground_color.red &&\n opaque[i].green == image->background_color.green &&\n opaque[i].blue == image->background_color.blue)\n break;\n }\n if (number_opaque < 259 && i == number_opaque)\n {\n opaque[i] = image->background_color;\n ping_background.index = i;\n number_opaque++;\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",(int) i);\n }\n\n }\n else if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No room in the colormap to add background color\");\n }\n\n image_colors=number_opaque+number_transparent+number_semitransparent;\n\n if (logging != MagickFalse)\n {\n if (image_colors > 256)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has more than 256 colors\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has %d colors\",image_colors);\n }\n\n if (ping_preserve_colormap != MagickFalse)\n break;\n\n if (mng_info->write_png_colortype != 7) /* We won't need this info */\n {\n ping_have_color=MagickFalse;\n ping_have_non_bw=MagickFalse;\n\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"incompatible colorspace\");\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n }\n\n if(image_colors > 256)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n s=q;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelRed(image,s) != GetPixelGreen(image,s) ||\n GetPixelRed(image,s) != GetPixelBlue(image,s))\n {\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n break;\n }\n s+=GetPixelChannels(image);\n }\n\n if (ping_have_color != MagickFalse)\n break;\n\n /* Worst case is black-and-white; we are looking at every\n * pixel twice.\n */\n\n if (ping_have_non_bw == MagickFalse)\n {\n s=q;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelRed(image,s) != 0 &&\n GetPixelRed(image,s) != QuantumRange)\n {\n ping_have_non_bw=MagickTrue;\n break;\n }\n s+=GetPixelChannels(image);\n }\n }\n }\n }\n }\n\n if (image_colors < 257)\n {\n PixelInfo\n colormap[260];\n\n /*\n * Initialize image colormap.\n */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Sort the new colormap\");\n\n /* Sort palette, transparent first */;\n\n n = 0;\n\n for (i=0; iping_exclude_tRNS == MagickFalse ||\n (number_transparent == 0 && number_semitransparent == 0)) &&\n (((mng_info->write_png_colortype-1) ==\n PNG_COLOR_TYPE_PALETTE) ||\n (mng_info->write_png_colortype == 0)))\n {\n if (logging != MagickFalse)\n {\n if (n != (ssize_t) image_colors)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_colors (%d) and n (%d) don't match\",\n image_colors, n);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" AcquireImageColormap\");\n }\n\n image->colors = image_colors;\n\n if (AcquireImageColormap(image,image_colors,exception) ==\n MagickFalse)\n ThrowWriterException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n\n for (i=0; i< (ssize_t) image_colors; i++)\n image->colormap[i] = colormap[i];\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d (%d)\",\n (int) image->colors, image_colors);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Update the pixel indexes\");\n }\n\n /* Sync the pixel indices with the new colormap */\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n for (i=0; i< (ssize_t) image_colors; i++)\n {\n if ((image->alpha_trait == UndefinedPixelTrait ||\n image->colormap[i].alpha == GetPixelAlpha(image,q)) &&\n image->colormap[i].red == GetPixelRed(image,q) &&\n image->colormap[i].green == GetPixelGreen(image,q) &&\n image->colormap[i].blue == GetPixelBlue(image,q))\n {\n SetPixelIndex(image,i,q);\n break;\n }\n }\n q+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d\", (int) image->colors);\n\n if (image->colormap != NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" i (red,green,blue,alpha)\");\n\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n if (i < 300 || i >= (ssize_t) image->colors - 10)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n }\n }\n\n if (number_transparent < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_transparent = %d\",\n number_transparent);\n else\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_transparent > 256\");\n\n if (number_opaque < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_opaque = %d\",\n number_opaque);\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_opaque > 256\");\n\n if (number_semitransparent < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_semitransparent = %d\",\n number_semitransparent);\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_semitransparent > 256\");\n\n if (ping_have_non_bw == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" All pixels and the background are black or white\");\n\n else if (ping_have_color == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" All pixels and the background are gray\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" At least one pixel or the background is non-gray\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Exit BUILD_PALETTE:\");\n }\n\n if (mng_info->write_png8 == MagickFalse)\n break;\n\n /* Make any reductions necessary for the PNG8 format */\n if (image_colors <= 256 &&\n image_colors != 0 && image->colormap != NULL &&\n number_semitransparent == 0 &&\n number_transparent <= 1)\n break;\n\n /* PNG8 can't have semitransparent colors so we threshold the\n * opacity to 0 or OpaqueOpacity, and PNG8 can only have one\n * transparent color so if more than one is transparent we merge\n * them into image->background_color.\n */\n if (number_semitransparent != 0 || number_transparent > 1)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Thresholding the alpha channel to binary\");\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) < OpaqueAlpha/2)\n {\n SetPixelViaPixelInfo(image,&image->background_color,r);\n SetPixelAlpha(image,TransparentAlpha,r);\n }\n else\n SetPixelAlpha(image,OpaqueAlpha,r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n\n if (image_colors != 0 && image_colors <= 256 &&\n image->colormap != NULL)\n for (i=0; icolormap[i].alpha =\n (image->colormap[i].alpha > TransparentAlpha/2 ?\n TransparentAlpha : OpaqueAlpha);\n }\n continue;\n }\n\n /* PNG8 can't have more than 256 colors so we quantize the pixels and\n * background color to the 4-4-4-1, 3-3-3-1 or 3-3-2-1 palette. If the\n * image is mostly gray, the 4-4-4-1 palette is likely to end up with 256\n * colors or less.\n */\n if (tried_444 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 4-4-4\");\n\n tried_444 = MagickTrue;\n\n LBR04PacketRGB(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 4-4-4\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR04PixelRGB(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 4-4-4\");\n\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (tried_333 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 3-3-3\");\n\n tried_333 = MagickTrue;\n\n LBR03PacketRGB(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 3-3-3-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR03RGB(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 3-3-3-1\");\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (tried_332 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 3-3-2\");\n\n tried_332 = MagickTrue;\n\n /* Red and green were already done so we only quantize the blue\n * channel\n */\n\n LBR02PacketBlue(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 3-3-2-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR02PixelBlue(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 3-3-2-1\");\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (image_colors == 0 || image_colors > 256)\n {\n /* Take care of special case with 256 opaque colors + 1 transparent\n * color. We don't need to quantize to 2-3-2-1; we only need to\n * eliminate one color, so we'll merge the two darkest red\n * colors (0x49, 0, 0) -> (0x24, 0, 0).\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Merging two dark red background colors to 3-3-2-1\");\n\n if (ScaleQuantumToChar(image->background_color.red) == 0x49 &&\n ScaleQuantumToChar(image->background_color.green) == 0x00 &&\n ScaleQuantumToChar(image->background_color.blue) == 0x00)\n {\n image->background_color.red=ScaleCharToQuantum(0x24);\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Merging two dark red pixel colors to 3-3-2-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (ScaleQuantumToChar(GetPixelRed(image,r)) == 0x49 &&\n ScaleQuantumToChar(GetPixelGreen(image,r)) == 0x00 &&\n ScaleQuantumToChar(GetPixelBlue(image,r)) == 0x00 &&\n GetPixelAlpha(image,r) == OpaqueAlpha)\n {\n SetPixelRed(image,ScaleCharToQuantum(0x24),r);\n }\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n\n }\n }\n\n else\n {\n for (i=0; icolormap[i].red) == 0x49 &&\n ScaleQuantumToChar(image->colormap[i].green) == 0x00 &&\n ScaleQuantumToChar(image->colormap[i].blue) == 0x00)\n {\n image->colormap[i].red=ScaleCharToQuantum(0x24);\n }\n }\n }\n }\n }\n }\n /* END OF BUILD_PALETTE */\n\n /* If we are excluding the tRNS chunk and there is transparency,\n * then we must write a Gray-Alpha (color-type 4) or RGBA (color-type 6)\n * PNG.\n */\n if (mng_info->ping_exclude_tRNS != MagickFalse &&\n (number_transparent != 0 || number_semitransparent != 0))\n {\n unsigned int colortype=mng_info->write_png_colortype;\n\n if (ping_have_color == MagickFalse)\n mng_info->write_png_colortype = 5;\n\n else\n mng_info->write_png_colortype = 7;\n\n if (colortype != 0 &&\n mng_info->write_png_colortype != colortype)\n ping_need_colortype_warning=MagickTrue;\n\n }\n\n /* See if cheap transparency is possible. It is only possible\n * when there is a single transparent color, no semitransparent\n * color, and no opaque color that has the same RGB components\n * as the transparent color. We only need this information if\n * we are writing a PNG with colortype 0 or 2, and we have not\n * excluded the tRNS chunk.\n */\n if (number_transparent == 1 &&\n mng_info->write_png_colortype < 4)\n {\n ping_have_cheap_transparency = MagickTrue;\n\n if (number_semitransparent != 0)\n ping_have_cheap_transparency = MagickFalse;\n\n else if (image_colors == 0 || image_colors > 256 ||\n image->colormap == NULL)\n {\n register const Quantum\n *q;\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,q) != TransparentAlpha &&\n (unsigned short) GetPixelRed(image,q) ==\n ping_trans_color.red &&\n (unsigned short) GetPixelGreen(image,q) ==\n ping_trans_color.green &&\n (unsigned short) GetPixelBlue(image,q) ==\n ping_trans_color.blue)\n {\n ping_have_cheap_transparency = MagickFalse;\n break;\n }\n\n q+=GetPixelChannels(image);\n }\n\n if (ping_have_cheap_transparency == MagickFalse)\n break;\n }\n }\n else\n {\n /* Assuming that image->colormap[0] is the one transparent color\n * and that all others are opaque.\n */\n if (image_colors > 1)\n for (i=1; icolormap[i].red == image->colormap[0].red &&\n image->colormap[i].green == image->colormap[0].green &&\n image->colormap[i].blue == image->colormap[0].blue)\n {\n ping_have_cheap_transparency = MagickFalse;\n break;\n }\n }\n\n if (logging != MagickFalse)\n {\n if (ping_have_cheap_transparency == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Cheap transparency is not possible.\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Cheap transparency is possible.\");\n }\n }\n else\n ping_have_cheap_transparency = MagickFalse;\n\n image_depth=image->depth;\n\n quantum_info = (QuantumInfo *) NULL;\n number_colors=0;\n image_colors=(int) image->colors;\n image_matte=image->alpha_trait !=\n UndefinedPixelTrait ? MagickTrue : MagickFalse;\n\n if (mng_info->write_png_colortype < 5)\n mng_info->IsPalette=image->storage_class == PseudoClass &&\n image_colors <= 256 && image->colormap != NULL;\n else\n mng_info->IsPalette = MagickFalse;\n\n if ((mng_info->write_png_colortype == 4 || mng_info->write_png8) &&\n (image->colors == 0 || image->colormap == NULL))\n {\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n (void) ThrowMagickException(exception,GetMagickModule(),CoderError,\n \"Cannot write PNG8 or color-type 3; colormap is NULL\",\n \"`%s'\",IMimage->filename);\n return(MagickFalse);\n }\n\n /*\n Allocate the PNG structures\n */\n#ifdef PNG_USER_MEM_SUPPORTED\n error_info.image=image;\n error_info.exception=exception;\n ping=png_create_write_struct_2(PNG_LIBPNG_VER_STRING,&error_info,\n MagickPNGErrorHandler,MagickPNGWarningHandler,(void *) NULL,\n (png_malloc_ptr) Magick_png_malloc,(png_free_ptr) Magick_png_free);\n\n#else\n ping=png_create_write_struct(PNG_LIBPNG_VER_STRING,&error_info,\n MagickPNGErrorHandler,MagickPNGWarningHandler);\n\n#endif\n if (ping == (png_struct *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n ping_info=png_create_info_struct(ping);\n\n if (ping_info == (png_info *) NULL)\n {\n png_destroy_write_struct(&ping,(png_info **) NULL);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n\n png_set_write_fn(ping,image,png_put_data,png_flush_data);\n pixel_info=(MemoryInfo *) NULL;\n\n if (setjmp(png_jmpbuf(ping)))\n {\n /*\n PNG write failed.\n */\n#ifdef PNG_DEBUG\n if (image_info->verbose)\n (void) printf(\"PNG write has failed.\\n\");\n#endif\n png_destroy_write_struct(&ping,&ping_info);\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n UnlockSemaphoreInfo(ping_semaphore);\n#endif\n\n if (pixel_info != (MemoryInfo *) NULL)\n pixel_info=RelinquishVirtualMemory(pixel_info);\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n\n if (ping_have_blob != MagickFalse)\n (void) CloseBlob(image);\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n return(MagickFalse);\n }\n\n /* { For navigation to end of SETJMP-protected block. Within this\n * block, use png_error() instead of Throwing an Exception, to ensure\n * that libpng is able to clean up, and that the semaphore is unlocked.\n */\n\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n LockSemaphoreInfo(ping_semaphore);\n#endif\n\n#ifdef PNG_BENIGN_ERRORS_SUPPORTED\n /* Allow benign errors */\n png_set_benign_errors(ping, 1);\n#endif\n\n#ifdef PNG_SET_USER_LIMITS_SUPPORTED\n /* Reject images with too many rows or columns */\n png_set_user_limits(ping,\n (png_uint_32) MagickMin(0x7fffffffL,\n GetMagickResourceLimit(WidthResource)),\n (png_uint_32) MagickMin(0x7fffffffL,\n GetMagickResourceLimit(HeightResource)));\n#endif /* PNG_SET_USER_LIMITS_SUPPORTED */\n\n /*\n Prepare PNG for writing.\n */\n\n#if defined(PNG_MNG_FEATURES_SUPPORTED)\n if (mng_info->write_mng)\n {\n (void) png_permit_mng_features(ping,PNG_ALL_MNG_FEATURES);\n# ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED\n /* Disable new libpng-1.5.10 feature when writing a MNG because\n * zero-length PLTE is OK\n */\n png_set_check_for_invalid_index (ping, 0);\n# endif\n }\n\n#else\n# ifdef PNG_WRITE_EMPTY_PLTE_SUPPORTED\n if (mng_info->write_mng)\n png_permit_empty_plte(ping,MagickTrue);\n\n# endif\n#endif\n\n x=0;\n\n ping_width=(png_uint_32) image->columns;\n ping_height=(png_uint_32) image->rows;\n\n if (mng_info->write_png8 || mng_info->write_png24 || mng_info->write_png32)\n image_depth=8;\n\n if (mng_info->write_png48 || mng_info->write_png64)\n image_depth=16;\n\n if (mng_info->write_png_depth != 0)\n image_depth=mng_info->write_png_depth;\n\n /* Adjust requested depth to next higher valid depth if necessary */\n if (image_depth > 8)\n image_depth=16;\n\n if ((image_depth > 4) && (image_depth < 8))\n image_depth=8;\n\n if (image_depth == 3)\n image_depth=4;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" width=%.20g\",(double) ping_width);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" height=%.20g\",(double) ping_height);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_matte=%.20g\",(double) image->alpha_trait);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->depth=%.20g\",(double) image->depth);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative ping_bit_depth=%.20g\",(double) image_depth);\n }\n\n save_image_depth=image_depth;\n ping_bit_depth=(png_byte) save_image_depth;\n\n\n#if defined(PNG_pHYs_SUPPORTED)\n if (ping_exclude_pHYs == MagickFalse)\n {\n if ((image->resolution.x != 0) && (image->resolution.y != 0) &&\n (!mng_info->write_mng || !mng_info->equal_physs))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up pHYs chunk\");\n\n if (image->units == PixelsPerInchResolution)\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_METER;\n ping_pHYs_x_resolution=\n (png_uint_32) ((100.0*image->resolution.x+0.5)/2.54);\n ping_pHYs_y_resolution=\n (png_uint_32) ((100.0*image->resolution.y+0.5)/2.54);\n }\n\n else if (image->units == PixelsPerCentimeterResolution)\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_METER;\n ping_pHYs_x_resolution=(png_uint_32) (100.0*image->resolution.x+0.5);\n ping_pHYs_y_resolution=(png_uint_32) (100.0*image->resolution.y+0.5);\n }\n\n else\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_UNKNOWN;\n ping_pHYs_x_resolution=(png_uint_32) image->resolution.x;\n ping_pHYs_y_resolution=(png_uint_32) image->resolution.y;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Set up PNG pHYs chunk: xres: %.20g, yres: %.20g, units: %d.\",\n (double) ping_pHYs_x_resolution,(double) ping_pHYs_y_resolution,\n (int) ping_pHYs_unit_type);\n ping_have_pHYs = MagickTrue;\n }\n }\n#endif\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if ((!mng_info->adjoin || !mng_info->equal_backgrounds))\n {\n unsigned int\n mask;\n\n mask=0xffff;\n if (ping_bit_depth == 8)\n mask=0x00ff;\n\n if (ping_bit_depth == 4)\n mask=0x000f;\n\n if (ping_bit_depth == 2)\n mask=0x0003;\n\n if (ping_bit_depth == 1)\n mask=0x0001;\n\n ping_background.red=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.red) & mask);\n\n ping_background.green=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.green) & mask);\n\n ping_background.blue=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.blue) & mask);\n\n ping_background.gray=(png_uint_16) ping_background.green;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk (1)\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_bit_depth=%d\",ping_bit_depth);\n }\n\n ping_have_bKGD = MagickTrue;\n }\n\n /*\n Select the color type.\n */\n matte=image_matte;\n old_bit_depth=0;\n\n if (mng_info->IsPalette && mng_info->write_png8)\n {\n /* To do: make this a function cause it's used twice, except\n for reducing the sample depth from 8. */\n\n number_colors=image_colors;\n\n ping_have_tRNS=MagickFalse;\n\n /*\n Set image palette.\n */\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up PLTE chunk with %d colors (%d)\",\n number_colors, image_colors);\n\n for (i=0; i < (ssize_t) number_colors; i++)\n {\n palette[i].red=ScaleQuantumToChar(image->colormap[i].red);\n palette[i].green=ScaleQuantumToChar(image->colormap[i].green);\n palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n#if MAGICKCORE_QUANTUM_DEPTH == 8\n \" %3ld (%3d,%3d,%3d)\",\n#else\n \" %5ld (%5d,%5d,%5d)\",\n#endif\n (long) i,palette[i].red,palette[i].green,palette[i].blue);\n\n }\n\n ping_have_PLTE=MagickTrue;\n image_depth=ping_bit_depth;\n ping_num_trans=0;\n\n if (matte != MagickFalse)\n {\n /*\n Identify which colormap entry is transparent.\n */\n assert(number_colors <= 256);\n assert(image->colormap != NULL);\n\n for (i=0; i < (ssize_t) number_transparent; i++)\n ping_trans_alpha[i]=0;\n\n\n ping_num_trans=(unsigned short) (number_transparent +\n number_semitransparent);\n\n if (ping_num_trans == 0)\n ping_have_tRNS=MagickFalse;\n\n else\n ping_have_tRNS=MagickTrue;\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n /*\n * Identify which colormap entry is the background color.\n */\n\n for (i=0; i < (ssize_t) MagickMax(1L*number_colors-1L,1L); i++)\n if (IsPNGColorEqual(ping_background,image->colormap[i]))\n break;\n\n ping_background.index=(png_byte) i;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n }\n }\n } /* end of write_png8 */\n\n else if (mng_info->write_png_colortype == 1)\n {\n image_matte=MagickFalse;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;\n }\n\n else if (mng_info->write_png24 || mng_info->write_png48 ||\n mng_info->write_png_colortype == 3)\n {\n image_matte=MagickFalse;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n }\n\n else if (mng_info->write_png32 || mng_info->write_png64 ||\n mng_info->write_png_colortype == 7)\n {\n image_matte=MagickTrue;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA;\n }\n\n else /* mng_info->write_pngNN not specified */\n {\n image_depth=ping_bit_depth;\n\n if (mng_info->write_png_colortype != 0)\n {\n ping_color_type=(png_byte) mng_info->write_png_colortype-1;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||\n ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA)\n image_matte=MagickTrue;\n\n else\n image_matte=MagickFalse;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG colortype %d was specified:\",(int) ping_color_type);\n }\n\n else /* write_png_colortype not specified */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Selecting PNG colortype:\");\n\n ping_color_type=(png_byte) ((matte != MagickFalse)?\n PNG_COLOR_TYPE_RGB_ALPHA:PNG_COLOR_TYPE_RGB);\n\n if (image_info->type == TrueColorType)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n image_matte=MagickFalse;\n }\n\n if (image_info->type == TrueColorAlphaType)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA;\n image_matte=MagickTrue;\n }\n\n if (image_info->type == PaletteType ||\n image_info->type == PaletteAlphaType)\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (mng_info->write_png_colortype == 0 &&\n image_info->type == UndefinedType)\n {\n if (ping_have_color == MagickFalse)\n {\n if (image_matte == MagickFalse)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;\n image_matte=MagickFalse;\n }\n\n else\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY_ALPHA;\n image_matte=MagickTrue;\n }\n }\n else\n {\n if (image_matte == MagickFalse)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n image_matte=MagickFalse;\n }\n\n else\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGBA;\n image_matte=MagickTrue;\n }\n }\n }\n\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Selected PNG colortype=%d\",ping_color_type);\n\n if (ping_bit_depth < 8)\n {\n if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||\n ping_color_type == PNG_COLOR_TYPE_RGB ||\n ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA)\n ping_bit_depth=8;\n }\n\n old_bit_depth=ping_bit_depth;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (image->alpha_trait == UndefinedPixelTrait &&\n ping_have_non_bw == MagickFalse)\n ping_bit_depth=1;\n }\n\n if (ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n size_t one = 1;\n ping_bit_depth=1;\n\n if (image->colors == 0)\n {\n /* DO SOMETHING */\n png_error(ping,\"image has 0 colors\");\n }\n\n while ((int) (one << ping_bit_depth) < (ssize_t) image_colors)\n ping_bit_depth <<= 1;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number of colors: %.20g\",(double) image_colors);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative PNG bit depth: %d\",ping_bit_depth);\n }\n\n if (ping_bit_depth < (int) mng_info->write_png_depth)\n ping_bit_depth = mng_info->write_png_depth;\n }\n\n image_depth=ping_bit_depth;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative PNG color type: %s (%.20g)\",\n PngColorTypeToString(ping_color_type),\n (double) ping_color_type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_info->type: %.20g\",(double) image_info->type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_depth: %.20g\",(double) image_depth);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n\n \" image->depth: %.20g\",(double) image->depth);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_bit_depth: %.20g\",(double) ping_bit_depth);\n }\n\n if (matte != MagickFalse)\n {\n if (mng_info->IsPalette)\n {\n if (mng_info->write_png_colortype == 0)\n {\n ping_color_type=PNG_COLOR_TYPE_GRAY_ALPHA;\n\n if (ping_have_color != MagickFalse)\n ping_color_type=PNG_COLOR_TYPE_RGBA;\n }\n\n /*\n * Determine if there is any transparent color.\n */\n if (number_transparent + number_semitransparent == 0)\n {\n /*\n No transparent pixels are present. Change 4 or 6 to 0 or 2.\n */\n\n image_matte=MagickFalse;\n\n if (mng_info->write_png_colortype == 0)\n ping_color_type&=0x03;\n }\n\n else\n {\n unsigned int\n mask;\n\n mask=0xffff;\n\n if (ping_bit_depth == 8)\n mask=0x00ff;\n\n if (ping_bit_depth == 4)\n mask=0x000f;\n\n if (ping_bit_depth == 2)\n mask=0x0003;\n\n if (ping_bit_depth == 1)\n mask=0x0001;\n\n ping_trans_color.red=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].red) & mask);\n\n ping_trans_color.green=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].green) & mask);\n\n ping_trans_color.blue=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].blue) & mask);\n\n ping_trans_color.gray=(png_uint_16)\n (ScaleQuantumToShort(GetPixelInfoIntensity(image,\n image->colormap)) & mask);\n\n ping_trans_color.index=(png_byte) 0;\n\n ping_have_tRNS=MagickTrue;\n }\n\n if (ping_have_tRNS != MagickFalse)\n {\n /*\n * Determine if there is one and only one transparent color\n * and if so if it is fully transparent.\n */\n if (ping_have_cheap_transparency == MagickFalse)\n ping_have_tRNS=MagickFalse;\n }\n\n if (ping_have_tRNS != MagickFalse)\n {\n if (mng_info->write_png_colortype == 0)\n ping_color_type &= 0x03; /* changes 4 or 6 to 0 or 2 */\n\n if (image_depth == 8)\n {\n ping_trans_color.red&=0xff;\n ping_trans_color.green&=0xff;\n ping_trans_color.blue&=0xff;\n ping_trans_color.gray&=0xff;\n }\n }\n }\n else\n {\n if (image_depth == 8)\n {\n ping_trans_color.red&=0xff;\n ping_trans_color.green&=0xff;\n ping_trans_color.blue&=0xff;\n ping_trans_color.gray&=0xff;\n }\n }\n }\n\n matte=image_matte;\n\n if (ping_have_tRNS != MagickFalse)\n image_matte=MagickFalse;\n\n if ((mng_info->IsPalette) &&\n mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE &&\n ping_have_color == MagickFalse &&\n (image_matte == MagickFalse || image_depth >= 8))\n {\n size_t one=1;\n\n if (image_matte != MagickFalse)\n ping_color_type=PNG_COLOR_TYPE_GRAY_ALPHA;\n\n else if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n ping_color_type=PNG_COLOR_TYPE_GRAY;\n\n if (save_image_depth == 16 && image_depth == 8)\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color (0)\");\n }\n ping_trans_color.gray*=0x0101;\n }\n }\n\n if (image_depth > MAGICKCORE_QUANTUM_DEPTH)\n image_depth=MAGICKCORE_QUANTUM_DEPTH;\n\n if ((image_colors == 0) ||\n ((ssize_t) (image_colors-1) > (ssize_t) MaxColormapSize))\n image_colors=(int) (one << image_depth);\n\n if (image_depth > 8)\n ping_bit_depth=16;\n\n else\n {\n ping_bit_depth=8;\n if ((int) ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n if(!mng_info->write_png_depth)\n {\n ping_bit_depth=1;\n\n while ((int) (one << ping_bit_depth)\n < (ssize_t) image_colors)\n ping_bit_depth <<= 1;\n }\n }\n\n else if (ping_color_type ==\n PNG_COLOR_TYPE_GRAY && image_colors < 17 &&\n mng_info->IsPalette)\n {\n /* Check if grayscale is reducible */\n\n int\n depth_4_ok=MagickTrue,\n depth_2_ok=MagickTrue,\n depth_1_ok=MagickTrue;\n\n for (i=0; i < (ssize_t) image_colors; i++)\n {\n unsigned char\n intensity;\n\n intensity=ScaleQuantumToChar(image->colormap[i].red);\n\n if ((intensity & 0x0f) != ((intensity & 0xf0) >> 4))\n depth_4_ok=depth_2_ok=depth_1_ok=MagickFalse;\n else if ((intensity & 0x03) != ((intensity & 0x0c) >> 2))\n depth_2_ok=depth_1_ok=MagickFalse;\n else if ((intensity & 0x01) != ((intensity & 0x02) >> 1))\n depth_1_ok=MagickFalse;\n }\n\n if (depth_1_ok && mng_info->write_png_depth <= 1)\n ping_bit_depth=1;\n\n else if (depth_2_ok && mng_info->write_png_depth <= 2)\n ping_bit_depth=2;\n\n else if (depth_4_ok && mng_info->write_png_depth <= 4)\n ping_bit_depth=4;\n }\n }\n\n image_depth=ping_bit_depth;\n }\n\n else\n\n if (mng_info->IsPalette)\n {\n number_colors=image_colors;\n\n if (image_depth <= 8)\n {\n /*\n Set image palette.\n */\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (!(mng_info->have_write_global_plte && matte == MagickFalse))\n {\n for (i=0; i < (ssize_t) number_colors; i++)\n {\n palette[i].red=ScaleQuantumToChar(image->colormap[i].red);\n palette[i].green=\n ScaleQuantumToChar(image->colormap[i].green);\n palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up PLTE chunk with %d colors\",\n number_colors);\n\n ping_have_PLTE=MagickTrue;\n }\n\n /* color_type is PNG_COLOR_TYPE_PALETTE */\n if (mng_info->write_png_depth == 0)\n {\n size_t\n one;\n\n ping_bit_depth=1;\n one=1;\n\n while ((one << ping_bit_depth) < (size_t) number_colors)\n ping_bit_depth <<= 1;\n }\n\n ping_num_trans=0;\n\n if (matte != MagickFalse)\n {\n /*\n * Set up trans_colors array.\n */\n assert(number_colors <= 256);\n\n ping_num_trans=(unsigned short) (number_transparent +\n number_semitransparent);\n\n if (ping_num_trans == 0)\n ping_have_tRNS=MagickFalse;\n\n else\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color (1)\");\n }\n ping_have_tRNS=MagickTrue;\n\n for (i=0; i < ping_num_trans; i++)\n {\n ping_trans_alpha[i]= (png_byte)\n ScaleQuantumToChar(image->colormap[i].alpha);\n }\n }\n }\n }\n }\n\n else\n {\n\n if (image_depth < 8)\n image_depth=8;\n\n if ((save_image_depth == 16) && (image_depth == 8))\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color from (%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n\n ping_trans_color.red*=0x0101;\n ping_trans_color.green*=0x0101;\n ping_trans_color.blue*=0x0101;\n ping_trans_color.gray*=0x0101;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" to (%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n }\n }\n\n if (ping_bit_depth < (ssize_t) mng_info->write_png_depth)\n ping_bit_depth = (ssize_t) mng_info->write_png_depth;\n\n /*\n Adjust background and transparency samples in sub-8-bit grayscale files.\n */\n if (ping_bit_depth < 8 && ping_color_type ==\n PNG_COLOR_TYPE_GRAY)\n {\n png_uint_16\n maxval;\n\n size_t\n one=1;\n\n maxval=(png_uint_16) ((one << ping_bit_depth)-1);\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n\n ping_background.gray=(png_uint_16) ((maxval/65535.)*\n (ScaleQuantumToShort(((GetPixelInfoIntensity(image,\n &image->background_color))) +.5)));\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk (2)\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n\n ping_have_bKGD = MagickTrue;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color.gray from %d\",\n (int)ping_trans_color.gray);\n\n ping_trans_color.gray=(png_uint_16) ((maxval/255.)*(\n ping_trans_color.gray)+.5);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" to %d\", (int)ping_trans_color.gray);\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if (mng_info->IsPalette && (int) ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n /*\n Identify which colormap entry is the background color.\n */\n\n number_colors=image_colors;\n\n for (i=0; i < (ssize_t) MagickMax(1L*number_colors,1L); i++)\n if (IsPNGColorEqual(image->background_color,image->colormap[i]))\n break;\n\n ping_background.index=(png_byte) i;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk with index=%d\",(int) i);\n }\n\n if (i < (ssize_t) number_colors)\n {\n ping_have_bKGD = MagickTrue;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background =(%d,%d,%d)\",\n (int) ping_background.red,\n (int) ping_background.green,\n (int) ping_background.blue);\n }\n }\n\n else /* Can't happen */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No room in PLTE to add bKGD color\");\n ping_have_bKGD = MagickFalse;\n }\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG color type: %s (%d)\", PngColorTypeToString(ping_color_type),\n ping_color_type);\n /*\n Initialize compression level and filtering.\n */\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up deflate compression\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression buffer size: 32768\");\n }\n\n png_set_compression_buffer_size(ping,32768L);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression mem level: 9\");\n\n png_set_compression_mem_level(ping, 9);\n\n /* Untangle the \"-quality\" setting:\n\n Undefined is 0; the default is used.\n Default is 75\n\n 10's digit:\n\n 0 or omitted: Use Z_HUFFMAN_ONLY strategy with the\n zlib default compression level\n\n 1-9: the zlib compression level\n\n 1's digit:\n\n 0-4: the PNG filter method\n\n 5: libpng adaptive filtering if compression level > 5\n libpng filter type \"none\" if compression level <= 5\n or if image is grayscale or palette\n\n 6: libpng adaptive filtering\n\n 7: \"LOCO\" filtering (intrapixel differing) if writing\n a MNG, otherwise \"none\". Did not work in IM-6.7.0-9\n and earlier because of a missing \"else\".\n\n 8: Z_RLE strategy (or Z_HUFFMAN_ONLY if quality < 10), adaptive\n filtering. Unused prior to IM-6.7.0-10, was same as 6\n\n 9: Z_RLE strategy (or Z_HUFFMAN_ONLY if quality < 10), no PNG filters\n Unused prior to IM-6.7.0-10, was same as 6\n\n Note that using the -quality option, not all combinations of\n PNG filter type, zlib compression level, and zlib compression\n strategy are possible. This will be addressed soon in a\n release that accomodates \"-define png:compression-strategy\", etc.\n\n */\n\n quality=image_info->quality == UndefinedCompressionQuality ? 75UL :\n image_info->quality;\n\n if (quality <= 9)\n {\n if (mng_info->write_png_compression_strategy == 0)\n mng_info->write_png_compression_strategy = Z_HUFFMAN_ONLY+1;\n }\n\n else if (mng_info->write_png_compression_level == 0)\n {\n int\n level;\n\n level=(int) MagickMin((ssize_t) quality/10,9);\n\n mng_info->write_png_compression_level = level+1;\n }\n\n if (mng_info->write_png_compression_strategy == 0)\n {\n if ((quality %10) == 8 || (quality %10) == 9)\n#ifdef Z_RLE /* Z_RLE was added to zlib-1.2.0 */\n mng_info->write_png_compression_strategy=Z_RLE+1;\n#else\n mng_info->write_png_compression_strategy = Z_DEFAULT_STRATEGY+1;\n#endif\n }\n\n if (mng_info->write_png_compression_filter == 0)\n mng_info->write_png_compression_filter=((int) quality % 10) + 1;\n\n if (logging != MagickFalse)\n {\n if (mng_info->write_png_compression_level)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression level: %d\",\n (int) mng_info->write_png_compression_level-1);\n\n if (mng_info->write_png_compression_strategy)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression strategy: %d\",\n (int) mng_info->write_png_compression_strategy-1);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up filtering\");\n\n if (mng_info->write_png_compression_filter == 6)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: ADAPTIVE\");\n else if (mng_info->write_png_compression_filter == 0 ||\n mng_info->write_png_compression_filter == 1)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: NONE\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: %d\",\n (int) mng_info->write_png_compression_filter-1);\n }\n\n if (mng_info->write_png_compression_level != 0)\n png_set_compression_level(ping,mng_info->write_png_compression_level-1);\n\n if (mng_info->write_png_compression_filter == 6)\n {\n if (((int) ping_color_type == PNG_COLOR_TYPE_GRAY) ||\n ((int) ping_color_type == PNG_COLOR_TYPE_PALETTE) ||\n (quality < 50))\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n else\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_ALL_FILTERS);\n }\n else if (mng_info->write_png_compression_filter == 7 ||\n mng_info->write_png_compression_filter == 10)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_ALL_FILTERS);\n\n else if (mng_info->write_png_compression_filter == 8)\n {\n#if defined(PNG_MNG_FEATURES_SUPPORTED) && defined(PNG_INTRAPIXEL_DIFFERENCING)\n if (mng_info->write_mng)\n {\n if (((int) ping_color_type == PNG_COLOR_TYPE_RGB) ||\n ((int) ping_color_type == PNG_COLOR_TYPE_RGBA))\n ping_filter_method=PNG_INTRAPIXEL_DIFFERENCING;\n }\n#endif\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n }\n\n else if (mng_info->write_png_compression_filter == 9)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n\n else if (mng_info->write_png_compression_filter != 0)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,\n mng_info->write_png_compression_filter-1);\n\n if (mng_info->write_png_compression_strategy != 0)\n png_set_compression_strategy(ping,\n mng_info->write_png_compression_strategy-1);\n\n ping_interlace_method=image_info->interlace != NoInterlace;\n\n if (mng_info->write_mng)\n png_set_sig_bytes(ping,8);\n\n /* Bail out if cannot meet defined png:bit-depth or png:color-type */\n\n if (mng_info->write_png_colortype != 0)\n {\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_GRAY)\n if (ping_have_color != MagickFalse)\n {\n ping_color_type = PNG_COLOR_TYPE_RGB;\n\n if (ping_bit_depth < 8)\n ping_bit_depth=8;\n }\n\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_GRAY_ALPHA)\n if (ping_have_color != MagickFalse)\n ping_color_type = PNG_COLOR_TYPE_RGB_ALPHA;\n }\n\n if (ping_need_colortype_warning != MagickFalse ||\n ((mng_info->write_png_depth &&\n (int) mng_info->write_png_depth != ping_bit_depth) ||\n (mng_info->write_png_colortype &&\n ((int) mng_info->write_png_colortype-1 != ping_color_type &&\n mng_info->write_png_colortype != 7 &&\n !(mng_info->write_png_colortype == 5 && ping_color_type == 0)))))\n {\n if (logging != MagickFalse)\n {\n if (ping_need_colortype_warning != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image has transparency but tRNS chunk was excluded\");\n }\n\n if (mng_info->write_png_depth)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:bit-depth=%u, Computed depth=%u\",\n mng_info->write_png_depth,\n ping_bit_depth);\n }\n\n if (mng_info->write_png_colortype)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:color-type=%u, Computed color type=%u\",\n mng_info->write_png_colortype-1,\n ping_color_type);\n }\n }\n\n png_warning(ping,\n \"Cannot write image with defined png:bit-depth or png:color-type.\");\n }\n\n if (image_matte != MagickFalse && image->alpha_trait == UndefinedPixelTrait)\n {\n /* Add an opaque matte channel */\n image->alpha_trait = BlendPixelTrait;\n (void) SetImageAlpha(image,OpaqueAlpha,exception);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Added an opaque matte channel\");\n }\n\n if (number_transparent != 0 || number_semitransparent != 0)\n {\n if (ping_color_type < 4)\n {\n ping_have_tRNS=MagickTrue;\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting ping_have_tRNS=MagickTrue.\");\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG header chunks\");\n\n png_set_IHDR(ping,ping_info,ping_width,ping_height,\n ping_bit_depth,ping_color_type,\n ping_interlace_method,ping_compression_method,\n ping_filter_method);\n\n if (ping_color_type == 3 && ping_have_PLTE != MagickFalse)\n {\n png_set_PLTE(ping,ping_info,palette,number_colors);\n\n if (logging != MagickFalse)\n {\n for (i=0; i< (ssize_t) number_colors; i++)\n {\n if (i < ping_num_trans)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PLTE[%d] = (%d,%d,%d), tRNS[%d] = (%d)\",\n (int) i,\n (int) palette[i].red,\n (int) palette[i].green,\n (int) palette[i].blue,\n (int) i,\n (int) ping_trans_alpha[i]);\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PLTE[%d] = (%d,%d,%d)\",\n (int) i,\n (int) palette[i].red,\n (int) palette[i].green,\n (int) palette[i].blue);\n }\n }\n }\n\n /* Only write the iCCP chunk if we are not writing the sRGB chunk. */\n if (ping_exclude_sRGB != MagickFalse ||\n (!png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n {\n if ((ping_exclude_tEXt == MagickFalse ||\n ping_exclude_zTXt == MagickFalse) &&\n (ping_exclude_iCCP == MagickFalse || ping_exclude_zCCP == MagickFalse))\n {\n ResetImageProfileIterator(image);\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n#ifdef PNG_WRITE_iCCP_SUPPORTED\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n {\n ping_have_iCCP = MagickTrue;\n if (ping_exclude_iCCP == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up iCCP chunk\");\n\n png_set_iCCP(ping,ping_info,(png_charp) name,0,\n#if (PNG_LIBPNG_VER < 10500)\n (png_charp) GetStringInfoDatum(profile),\n#else\n (const png_byte *) GetStringInfoDatum(profile),\n#endif\n (png_uint_32) GetStringInfoLength(profile));\n }\n else\n {\n /* Do not write hex-encoded ICC chunk */\n name=GetNextImageProfile(image);\n continue;\n }\n }\n#endif /* WRITE_iCCP */\n\n if (LocaleCompare(name,\"exif\") == 0)\n {\n /* Do not write hex-encoded ICC chunk; we will\n write it later as an eXIf chunk */\n name=GetNextImageProfile(image);\n continue;\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up zTXt chunk with uuencoded %s profile\",\n name);\n Magick_png_write_raw_profile(image_info,ping,ping_info,\n (unsigned char *) name,(unsigned char *) name,\n GetStringInfoDatum(profile),\n (png_uint_32) GetStringInfoLength(profile));\n }\n name=GetNextImageProfile(image);\n }\n }\n }\n\n#if defined(PNG_WRITE_sRGB_SUPPORTED)\n if ((mng_info->have_write_global_srgb == 0) &&\n ping_have_iCCP != MagickTrue &&\n (ping_have_sRGB != MagickFalse ||\n png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n {\n if (ping_exclude_sRGB == MagickFalse)\n {\n /*\n Note image rendering intent.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up sRGB chunk\");\n\n (void) png_set_sRGB(ping,ping_info,(\n Magick_RenderingIntent_to_PNG_RenderingIntent(\n image->rendering_intent)));\n\n ping_have_sRGB = MagickTrue;\n }\n }\n\n if ((!mng_info->write_mng) || (!png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n#endif\n {\n if (ping_exclude_gAMA == MagickFalse &&\n ping_have_iCCP == MagickFalse &&\n ping_have_sRGB == MagickFalse &&\n (ping_exclude_sRGB == MagickFalse ||\n (image->gamma < .45 || image->gamma > .46)))\n {\n if ((mng_info->have_write_global_gama == 0) && (image->gamma != 0.0))\n {\n /*\n Note image gamma.\n To do: check for cHRM+gAMA == sRGB, and write sRGB instead.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up gAMA chunk\");\n\n png_set_gAMA(ping,ping_info,image->gamma);\n }\n }\n\n if (ping_exclude_cHRM == MagickFalse && ping_have_sRGB == MagickFalse)\n {\n if ((mng_info->have_write_global_chrm == 0) &&\n (image->chromaticity.red_primary.x != 0.0))\n {\n /*\n Note image chromaticity.\n Note: if cHRM+gAMA == sRGB write sRGB instead.\n */\n PrimaryInfo\n bp,\n gp,\n rp,\n wp;\n\n wp=image->chromaticity.white_point;\n rp=image->chromaticity.red_primary;\n gp=image->chromaticity.green_primary;\n bp=image->chromaticity.blue_primary;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up cHRM chunk\");\n\n png_set_cHRM(ping,ping_info,wp.x,wp.y,rp.x,rp.y,gp.x,gp.y,\n bp.x,bp.y);\n }\n }\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if (ping_have_bKGD != MagickFalse)\n {\n png_set_bKGD(ping,ping_info,&ping_background);\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background color = (%d,%d,%d)\",\n (int) ping_background.red,\n (int) ping_background.green,\n (int) ping_background.blue);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" index = %d, gray=%d\",\n (int) ping_background.index,\n (int) ping_background.gray);\n }\n }\n }\n\n if (ping_exclude_pHYs == MagickFalse)\n {\n if (ping_have_pHYs != MagickFalse)\n {\n png_set_pHYs(ping,ping_info,\n ping_pHYs_x_resolution,\n ping_pHYs_y_resolution,\n ping_pHYs_unit_type);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up pHYs chunk\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" x_resolution=%lu\",\n (unsigned long) ping_pHYs_x_resolution);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" y_resolution=%lu\",\n (unsigned long) ping_pHYs_y_resolution);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" unit_type=%lu\",\n (unsigned long) ping_pHYs_unit_type);\n }\n }\n }\n\n#if defined(PNG_tIME_SUPPORTED)\n if (ping_exclude_tIME == MagickFalse)\n {\n const char\n *timestamp;\n\n if (image->taint == MagickFalse)\n {\n timestamp=GetImageOption(image_info,\"png:tIME\");\n\n if (timestamp == (const char *) NULL)\n timestamp=GetImageProperty(image,\"png:tIME\",exception);\n }\n\n else\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reset tIME in tainted image\");\n\n timestamp=GetImageProperty(image,\"date:modify\",exception);\n }\n\n if (timestamp != (const char *) NULL)\n write_tIME_chunk(image,ping,ping_info,timestamp,exception);\n }\n#endif\n\n if (mng_info->need_blob != MagickFalse)\n {\n if (OpenBlob(image_info,image,WriteBinaryBlobMode,exception) ==\n MagickFalse)\n png_error(ping,\"WriteBlob Failed\");\n\n ping_have_blob=MagickTrue;\n }\n\n png_write_info_before_PLTE(ping, ping_info);\n\n if (ping_have_tRNS != MagickFalse && ping_color_type < 4)\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Calling png_set_tRNS with num_trans=%d\",ping_num_trans);\n }\n\n if (ping_color_type == 3)\n (void) png_set_tRNS(ping, ping_info,\n ping_trans_alpha,\n ping_num_trans,\n NULL);\n\n else\n {\n (void) png_set_tRNS(ping, ping_info,\n NULL,\n 0,\n &ping_trans_color);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" tRNS color =(%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n }\n }\n\n /* write any png-chunk-b profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-b\",logging);\n\n png_write_info(ping,ping_info);\n\n /* write any PNG-chunk-m profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-m\",logging);\n\n ping_wrote_caNv = MagickFalse;\n\n /* write caNv chunk */\n if (ping_exclude_caNv == MagickFalse)\n {\n if ((image->page.width != 0 && image->page.width != image->columns) ||\n (image->page.height != 0 && image->page.height != image->rows) ||\n image->page.x != 0 || image->page.y != 0)\n {\n unsigned char\n chunk[20];\n\n (void) WriteBlobMSBULong(image,16L); /* data length=8 */\n PNGType(chunk,mng_caNv);\n LogPNGChunk(logging,mng_caNv,16L);\n PNGLong(chunk+4,(png_uint_32) image->page.width);\n PNGLong(chunk+8,(png_uint_32) image->page.height);\n PNGsLong(chunk+12,(png_int_32) image->page.x);\n PNGsLong(chunk+16,(png_int_32) image->page.y);\n (void) WriteBlob(image,20,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,20));\n ping_wrote_caNv = MagickTrue;\n }\n }\n\n#if defined(PNG_oFFs_SUPPORTED)\n if (ping_exclude_oFFs == MagickFalse && ping_wrote_caNv == MagickFalse)\n {\n if (image->page.x || image->page.y)\n {\n png_set_oFFs(ping,ping_info,(png_int_32) image->page.x,\n (png_int_32) image->page.y, 0);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up oFFs chunk with x=%d, y=%d, units=0\",\n (int) image->page.x, (int) image->page.y);\n }\n }\n#endif\n\n /* write vpAg chunk (deprecated, replaced by caNv) */\n if (ping_exclude_vpAg == MagickFalse && ping_wrote_caNv == MagickFalse)\n {\n if ((image->page.width != 0 && image->page.width != image->columns) ||\n (image->page.height != 0 && image->page.height != image->rows))\n {\n unsigned char\n chunk[14];\n\n (void) WriteBlobMSBULong(image,9L); /* data length=8 */\n PNGType(chunk,mng_vpAg);\n LogPNGChunk(logging,mng_vpAg,9L);\n PNGLong(chunk+4,(png_uint_32) image->page.width);\n PNGLong(chunk+8,(png_uint_32) image->page.height);\n chunk[12]=0; /* unit = pixels */\n (void) WriteBlob(image,13,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,13));\n }\n }\n\n#if (PNG_LIBPNG_VER == 10206)\n /* avoid libpng-1.2.6 bug by setting PNG_HAVE_IDAT flag */\n#define PNG_HAVE_IDAT 0x04\n ping->mode |= PNG_HAVE_IDAT;\n#undef PNG_HAVE_IDAT\n#endif\n\n png_set_packing(ping);\n /*\n Allocate memory.\n */\n rowbytes=image->columns;\n if (image_depth > 8)\n rowbytes*=2;\n switch (ping_color_type)\n {\n case PNG_COLOR_TYPE_RGB:\n rowbytes*=3;\n break;\n\n case PNG_COLOR_TYPE_GRAY_ALPHA:\n rowbytes*=2;\n break;\n\n case PNG_COLOR_TYPE_RGBA:\n rowbytes*=4;\n break;\n\n default:\n break;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG image data\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocating %.20g bytes of memory for pixels\",(double) rowbytes);\n }\n pixel_info=AcquireVirtualMemory(rowbytes,sizeof(*ping_pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n png_error(ping,\"Allocation of memory for pixels failed\");\n ping_pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n\n /*\n Initialize image scanlines.\n */\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n png_error(ping,\"Memory allocation for quantum_info failed\");\n quantum_info->format=UndefinedQuantumFormat;\n SetQuantumDepth(image,quantum_info,image_depth);\n (void) SetQuantumEndian(image,quantum_info,MSBEndian);\n num_passes=png_set_interlace_handling(ping);\n\n if ((!mng_info->write_png8 && !mng_info->write_png24 &&\n !mng_info->write_png48 && !mng_info->write_png64 &&\n !mng_info->write_png32) &&\n (mng_info->IsPalette ||\n (image_info->type == BilevelType)) &&\n image_matte == MagickFalse &&\n ping_have_non_bw == MagickFalse)\n {\n /* Palette, Bilevel, or Opaque Monochrome */\n register const Quantum\n *p;\n\n SetQuantumDepth(image,quantum_info,8);\n for (pass=0; pass < num_passes; pass++)\n {\n /*\n Convert PseudoClass image to a PNG monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (0)\");\n\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (mng_info->IsPalette)\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_PALETTE &&\n mng_info->write_png_depth &&\n mng_info->write_png_depth != old_bit_depth)\n {\n /* Undo pixel scaling */\n for (i=0; i < (ssize_t) image->columns; i++)\n *(ping_pixels+i)=(unsigned char) (*(ping_pixels+i)\n >> (8-old_bit_depth));\n }\n }\n\n else\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n }\n\n if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE)\n for (i=0; i < (ssize_t) image->columns; i++)\n *(ping_pixels+i)=(unsigned char) ((*(ping_pixels+i) > 127) ?\n 255 : 0);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (1)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n\n else /* Not Palette, Bilevel, or Opaque Monochrome */\n {\n if ((!mng_info->write_png8 && !mng_info->write_png24 &&\n !mng_info->write_png48 && !mng_info->write_png64 &&\n !mng_info->write_png32) && (image_matte != MagickFalse ||\n (ping_bit_depth >= MAGICKCORE_QUANTUM_DEPTH)) &&\n (mng_info->IsPalette) && ping_have_color == MagickFalse)\n {\n register const Quantum\n *p;\n\n for (pass=0; pass < num_passes; pass++)\n {\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (mng_info->IsPalette)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY PNG pixels (2)\");\n }\n\n else /* PNG_COLOR_TYPE_GRAY_ALPHA */\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (2)\");\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,exception);\n }\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (2)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n\n else\n {\n register const Quantum\n *p;\n\n for (pass=0; pass < num_passes; pass++)\n {\n if ((image_depth > 8) ||\n mng_info->write_png24 ||\n mng_info->write_png32 ||\n mng_info->write_png48 ||\n mng_info->write_png64 ||\n (!mng_info->write_png8 && !mng_info->IsPalette))\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (image->storage_class == DirectClass)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n }\n\n else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,\n exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (3)\");\n }\n\n else if (image_matte != MagickFalse)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RGBAQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RGBQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (3)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n\n else\n /* not ((image_depth > 8) ||\n mng_info->write_png24 || mng_info->write_png32 ||\n mng_info->write_png48 || mng_info->write_png64 ||\n (!mng_info->write_png8 && !mng_info->IsPalette))\n */\n {\n if ((ping_color_type != PNG_COLOR_TYPE_GRAY) &&\n (ping_color_type != PNG_COLOR_TYPE_GRAY_ALPHA))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" pass %d, Image Is not GRAY or GRAY_ALPHA\",pass);\n\n SetQuantumDepth(image,quantum_info,8);\n image_depth=8;\n }\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" pass %d, Image Is RGB, 16-bit GRAY, or GRAY_ALPHA\",\n pass);\n\n p=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n SetQuantumDepth(image,quantum_info,image->depth);\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n }\n\n else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (4)\");\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,\n exception);\n }\n\n else\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,IndexQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y <= 2)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of non-gray pixels (4)\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_pixels[0]=%d,ping_pixels[1]=%d\",\n (int)ping_pixels[0],(int)ping_pixels[1]);\n }\n }\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n }\n }\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Wrote PNG image data\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Width: %.20g\",(double) ping_width);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Height: %.20g\",(double) ping_height);\n\n if (mng_info->write_png_depth)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:bit-depth: %d\",mng_info->write_png_depth);\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG bit-depth written: %d\",ping_bit_depth);\n\n if (mng_info->write_png_colortype)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:color-type: %d\",mng_info->write_png_colortype-1);\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG color-type written: %d\",ping_color_type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG Interlace method: %d\",ping_interlace_method);\n }\n /*\n Generate text chunks after IDAT.\n */\n if (ping_exclude_tEXt == MagickFalse || ping_exclude_zTXt == MagickFalse)\n {\n ResetImagePropertyIterator(image);\n property=GetNextImageProperty(image);\n while (property != (const char *) NULL)\n {\n png_textp\n text;\n\n value=GetImageProperty(image,property,exception);\n\n /* Don't write any \"png:\" or \"jpeg:\" properties; those are just for\n * \"identify\" or for passing through to another JPEG\n */\n if ((LocaleNCompare(property,\"png:\",4) != 0 &&\n LocaleNCompare(property,\"jpeg:\",5) != 0) &&\n\n\n /* Suppress density and units if we wrote a pHYs chunk */\n (ping_exclude_pHYs != MagickFalse ||\n LocaleCompare(property,\"density\") != 0 ||\n LocaleCompare(property,\"units\") != 0) &&\n\n /* Suppress the IM-generated Date:create and Date:modify */\n (ping_exclude_date == MagickFalse ||\n LocaleNCompare(property, \"Date:\",5) != 0))\n {\n if (value != (const char *) NULL)\n {\n\n#if PNG_LIBPNG_VER >= 10400\n text=(png_textp) png_malloc(ping,\n (png_alloc_size_t) sizeof(png_text));\n#else\n text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text));\n#endif\n text[0].key=(char *) property;\n text[0].text=(char *) value;\n text[0].text_length=strlen(value);\n\n if (ping_exclude_tEXt != MagickFalse)\n text[0].compression=PNG_TEXT_COMPRESSION_zTXt;\n\n else if (ping_exclude_zTXt != MagickFalse)\n text[0].compression=PNG_TEXT_COMPRESSION_NONE;\n\n else\n {\n text[0].compression=image_info->compression == NoCompression ||\n (image_info->compression == UndefinedCompression &&\n text[0].text_length < 128) ? PNG_TEXT_COMPRESSION_NONE :\n PNG_TEXT_COMPRESSION_zTXt ;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up text chunk\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" keyword: '%s'\",text[0].key);\n }\n\n png_set_text(ping,ping_info,text,1);\n png_free(ping,text);\n }\n }\n property=GetNextImageProperty(image);\n }\n }\n\n /* write any PNG-chunk-e profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-e\",logging);\n\n /* write exIf profile */\n if (ping_have_eXIf != MagickFalse && ping_exclude_eXIf == MagickFalse)\n {\n char\n *name;\n\n ResetImageProfileIterator(image);\n\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n if (LocaleCompare(name,\"exif\") == 0)\n {\n const StringInfo\n *profile;\n\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n png_uint_32\n length;\n\n unsigned char\n chunk[4],\n *data;\n\n StringInfo\n *ping_profile;\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Have eXIf profile\");\n\n ping_profile=CloneStringInfo(profile);\n data=GetStringInfoDatum(ping_profile),\n length=(png_uint_32) GetStringInfoLength(ping_profile);\n\n PNGType(chunk,mng_eXIf);\n if (length < 7)\n {\n ping_profile=DestroyStringInfo(ping_profile);\n break; /* otherwise crashes */\n }\n\n /* skip the \"Exif\\0\\0\" JFIF Exif Header ID */\n length -= 6;\n\n LogPNGChunk(logging,chunk,length);\n (void) WriteBlobMSBULong(image,length);\n (void) WriteBlob(image,4,chunk);\n (void) WriteBlob(image,length,data+6);\n (void) WriteBlobMSBULong(image,crc32(crc32(0,chunk,4),\n data+6, (uInt) length));\n ping_profile=DestroyStringInfo(ping_profile);\n break;\n }\n }\n name=GetNextImageProfile(image);\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG end info\");\n\n png_write_end(ping,ping_info);\n\n if (mng_info->need_fram && (int) image->dispose == BackgroundDispose)\n {\n if (mng_info->page.x || mng_info->page.y ||\n (ping_width != mng_info->page.width) ||\n (ping_height != mng_info->page.height))\n {\n unsigned char\n chunk[32];\n\n /*\n Write FRAM 4 with clipping boundaries followed by FRAM 1.\n */\n (void) WriteBlobMSBULong(image,27L); /* data length=27 */\n PNGType(chunk,mng_FRAM);\n LogPNGChunk(logging,mng_FRAM,27L);\n chunk[4]=4;\n chunk[5]=0; /* frame name separator (no name) */\n chunk[6]=1; /* flag for changing delay, for next frame only */\n chunk[7]=0; /* flag for changing frame timeout */\n chunk[8]=1; /* flag for changing frame clipping for next frame */\n chunk[9]=0; /* flag for changing frame sync_id */\n PNGLong(chunk+10,(png_uint_32) (0L)); /* temporary 0 delay */\n chunk[14]=0; /* clipping boundaries delta type */\n PNGLong(chunk+15,(png_uint_32) (mng_info->page.x)); /* left cb */\n PNGLong(chunk+19,\n (png_uint_32) (mng_info->page.x + ping_width));\n PNGLong(chunk+23,(png_uint_32) (mng_info->page.y)); /* top cb */\n PNGLong(chunk+27,\n (png_uint_32) (mng_info->page.y + ping_height));\n (void) WriteBlob(image,31,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,31));\n mng_info->old_framing_mode=4;\n mng_info->framing_mode=1;\n }\n\n else\n mng_info->framing_mode=3;\n }\n if (mng_info->write_mng && !mng_info->need_fram &&\n ((int) image->dispose == 3))\n png_error(ping, \"Cannot convert GIF with disposal method 3 to MNG-LC\");\n\n /*\n Free PNG resources.\n */\n\n png_destroy_write_struct(&ping,&ping_info);\n\n pixel_info=RelinquishVirtualMemory(pixel_info);\n\n if (ping_have_blob != MagickFalse)\n (void) CloseBlob(image);\n\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n\n /* Store bit depth actually written */\n s[0]=(char) ping_bit_depth;\n s[1]='\\0';\n\n (void) SetImageProperty(IMimage,\"png:bit-depth-written\",s,exception);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" exit WriteOnePNGImage()\");\n\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n UnlockSemaphoreInfo(ping_semaphore);\n#endif\n\n /* } for navigation to beginning of SETJMP-protected block. Revert to\n * Throwing an Exception when an error occurs.\n */\n\n return(MagickTrue);\n/* End write one PNG image */\n\n}","target":"static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,\n const ImageInfo *IMimage_info,Image *IMimage,ExceptionInfo *exception)\n{\n char\n im_vers[32],\n libpng_runv[32],\n libpng_vers[32],\n zlib_runv[32],\n zlib_vers[32];\n\n Image\n *image;\n\n ImageInfo\n *image_info;\n\n char\n s[2];\n\n const char\n *name,\n *property,\n *value;\n\n const StringInfo\n *profile;\n\n int\n num_passes,\n pass,\n ping_wrote_caNv;\n\n png_byte\n ping_trans_alpha[256];\n\n png_color\n palette[257];\n\n png_color_16\n ping_background,\n ping_trans_color;\n\n png_info\n *ping_info;\n\n png_struct\n *ping;\n\n png_uint_32\n ping_height,\n ping_width;\n\n ssize_t\n y;\n\n MagickBooleanType\n image_matte,\n logging,\n matte,\n\n ping_have_blob,\n ping_have_cheap_transparency,\n ping_have_color,\n ping_have_non_bw,\n ping_have_PLTE,\n ping_have_bKGD,\n ping_have_eXIf,\n ping_have_iCCP,\n ping_have_pHYs,\n ping_have_sRGB,\n ping_have_tRNS,\n\n ping_exclude_bKGD,\n ping_exclude_cHRM,\n ping_exclude_date,\n /* ping_exclude_EXIF, */\n ping_exclude_eXIf,\n ping_exclude_gAMA,\n ping_exclude_iCCP,\n /* ping_exclude_iTXt, */\n ping_exclude_oFFs,\n ping_exclude_pHYs,\n ping_exclude_sRGB,\n ping_exclude_tEXt,\n ping_exclude_tIME,\n /* ping_exclude_tRNS, */\n ping_exclude_vpAg,\n ping_exclude_caNv,\n ping_exclude_zCCP, /* hex-encoded iCCP */\n ping_exclude_zTXt,\n\n ping_preserve_colormap,\n ping_preserve_iCCP,\n ping_need_colortype_warning,\n\n status,\n tried_332,\n tried_333,\n tried_444;\n\n MemoryInfo\n *volatile pixel_info;\n\n QuantumInfo\n *quantum_info;\n\n PNGErrorInfo\n error_info;\n\n register ssize_t\n i,\n x;\n\n unsigned char\n *ping_pixels;\n\n volatile int\n image_colors,\n ping_bit_depth,\n ping_color_type,\n ping_interlace_method,\n ping_compression_method,\n ping_filter_method,\n ping_num_trans;\n\n volatile size_t\n image_depth,\n old_bit_depth;\n\n size_t\n quality,\n rowbytes,\n save_image_depth;\n\n int\n j,\n number_colors,\n number_opaque,\n number_semitransparent,\n number_transparent,\n ping_pHYs_unit_type;\n\n png_uint_32\n ping_pHYs_x_resolution,\n ping_pHYs_y_resolution;\n\n logging=LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter WriteOnePNGImage()\");\n\n image = CloneImage(IMimage,0,0,MagickFalse,exception);\n if (image == (Image *) NULL)\n return(MagickFalse);\n image_info=(ImageInfo *) CloneImageInfo(IMimage_info);\n if (image_info == (ImageInfo *) NULL)\n ThrowWriterException(ResourceLimitError, \"MemoryAllocationFailed\");\n\n /* Define these outside of the following \"if logging()\" block so they will\n * show in debuggers.\n */\n *im_vers='\\0';\n (void) ConcatenateMagickString(im_vers,\n MagickLibVersionText,MagickPathExtent);\n (void) ConcatenateMagickString(im_vers,\n MagickLibAddendum,MagickPathExtent);\n\n *libpng_vers='\\0';\n (void) ConcatenateMagickString(libpng_vers,\n PNG_LIBPNG_VER_STRING,32);\n *libpng_runv='\\0';\n (void) ConcatenateMagickString(libpng_runv,\n png_get_libpng_ver(NULL),32);\n\n *zlib_vers='\\0';\n (void) ConcatenateMagickString(zlib_vers,\n ZLIB_VERSION,32);\n *zlib_runv='\\0';\n (void) ConcatenateMagickString(zlib_runv,\n zlib_version,32);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" IM version = %s\",\n im_vers);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Libpng version = %s\",\n libpng_vers);\n if (LocaleCompare(libpng_vers,libpng_runv) != 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" running with %s\",\n libpng_runv);\n }\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Zlib version = %s\",\n zlib_vers);\n if (LocaleCompare(zlib_vers,zlib_runv) != 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" running with %s\",\n zlib_runv);\n }\n }\n\n /* Initialize some stuff */\n ping_bit_depth=0,\n ping_color_type=0,\n ping_interlace_method=0,\n ping_compression_method=0,\n ping_filter_method=0,\n ping_num_trans = 0;\n\n ping_background.red = 0;\n ping_background.green = 0;\n ping_background.blue = 0;\n ping_background.gray = 0;\n ping_background.index = 0;\n\n ping_trans_color.red=0;\n ping_trans_color.green=0;\n ping_trans_color.blue=0;\n ping_trans_color.gray=0;\n\n ping_pHYs_unit_type = 0;\n ping_pHYs_x_resolution = 0;\n ping_pHYs_y_resolution = 0;\n\n ping_have_blob=MagickFalse;\n ping_have_cheap_transparency=MagickFalse;\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n ping_have_PLTE=MagickFalse;\n ping_have_bKGD=MagickFalse;\n ping_have_eXIf=MagickTrue;\n ping_have_iCCP=MagickFalse;\n ping_have_pHYs=MagickFalse;\n ping_have_sRGB=MagickFalse;\n ping_have_tRNS=MagickFalse;\n\n ping_exclude_bKGD=mng_info->ping_exclude_bKGD;\n ping_exclude_caNv=mng_info->ping_exclude_caNv;\n ping_exclude_cHRM=mng_info->ping_exclude_cHRM;\n ping_exclude_date=mng_info->ping_exclude_date;\n ping_exclude_eXIf=mng_info->ping_exclude_eXIf;\n ping_exclude_gAMA=mng_info->ping_exclude_gAMA;\n ping_exclude_iCCP=mng_info->ping_exclude_iCCP;\n /* ping_exclude_iTXt=mng_info->ping_exclude_iTXt; */\n ping_exclude_oFFs=mng_info->ping_exclude_oFFs;\n ping_exclude_pHYs=mng_info->ping_exclude_pHYs;\n ping_exclude_sRGB=mng_info->ping_exclude_sRGB;\n ping_exclude_tEXt=mng_info->ping_exclude_tEXt;\n ping_exclude_tIME=mng_info->ping_exclude_tIME;\n /* ping_exclude_tRNS=mng_info->ping_exclude_tRNS; */\n ping_exclude_vpAg=mng_info->ping_exclude_vpAg;\n ping_exclude_zCCP=mng_info->ping_exclude_zCCP; /* hex-encoded iCCP in zTXt */\n ping_exclude_zTXt=mng_info->ping_exclude_zTXt;\n\n ping_preserve_colormap = mng_info->ping_preserve_colormap;\n ping_preserve_iCCP = mng_info->ping_preserve_iCCP;\n ping_need_colortype_warning = MagickFalse;\n\n /* Recognize the ICC sRGB profile and convert it to the sRGB chunk,\n * i.e., eliminate the ICC profile and set image->rendering_intent.\n * Note that this will not involve any changes to the actual pixels\n * but merely passes information to applications that read the resulting\n * PNG image.\n *\n * To do: recognize other variants of the sRGB profile, using the CRC to\n * verify all recognized variants including the 7 already known.\n *\n * Work around libpng16+ rejecting some \"known invalid sRGB profiles\".\n *\n * Use something other than image->rendering_intent to record the fact\n * that the sRGB profile was found.\n *\n * Record the ICC version (currently v2 or v4) of the incoming sRGB ICC\n * profile. Record the Blackpoint Compensation, if any.\n */\n if (ping_exclude_sRGB == MagickFalse && ping_preserve_iCCP == MagickFalse)\n {\n char\n *name;\n\n const StringInfo\n *profile;\n\n ResetImageProfileIterator(image);\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n\n {\n int\n icheck,\n got_crc=0;\n\n\n png_uint_32\n length,\n profile_crc=0;\n\n unsigned char\n *data;\n\n length=(png_uint_32) GetStringInfoLength(profile);\n\n for (icheck=0; sRGB_info[icheck].len > 0; icheck++)\n {\n if (length == sRGB_info[icheck].len)\n {\n if (got_crc == 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Got a %lu-byte ICC profile (potentially sRGB)\",\n (unsigned long) length);\n\n data=GetStringInfoDatum(profile);\n profile_crc=crc32(0,data,length);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" with crc=%8x\",(unsigned int) profile_crc);\n got_crc++;\n }\n\n if (profile_crc == sRGB_info[icheck].crc)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" It is sRGB with rendering intent = %s\",\n Magick_RenderingIntentString_from_PNG_RenderingIntent(\n sRGB_info[icheck].intent));\n if (image->rendering_intent==UndefinedIntent)\n {\n image->rendering_intent=\n Magick_RenderingIntent_from_PNG_RenderingIntent(\n sRGB_info[icheck].intent);\n }\n ping_exclude_iCCP = MagickTrue;\n ping_exclude_zCCP = MagickTrue;\n ping_have_sRGB = MagickTrue;\n break;\n }\n }\n }\n if (sRGB_info[icheck].len == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Got %lu-byte ICC profile not recognized as sRGB\",\n (unsigned long) length);\n }\n }\n name=GetNextImageProfile(image);\n }\n }\n\n number_opaque = 0;\n number_semitransparent = 0;\n number_transparent = 0;\n\n if (logging != MagickFalse)\n {\n if (image->storage_class == UndefinedClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=UndefinedClass\");\n if (image->storage_class == DirectClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=DirectClass\");\n if (image->storage_class == PseudoClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=PseudoClass\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(), image->taint ?\n \" image->taint=MagickTrue\":\n \" image->taint=MagickFalse\");\n }\n\n if (image->storage_class == PseudoClass &&\n (mng_info->write_png8 || mng_info->write_png24 || mng_info->write_png32 ||\n mng_info->write_png48 || mng_info->write_png64 ||\n (mng_info->write_png_colortype != 1 &&\n mng_info->write_png_colortype != 5)))\n {\n (void) SyncImage(image,exception);\n image->storage_class = DirectClass;\n }\n\n if (ping_preserve_colormap == MagickFalse)\n {\n if (image->storage_class != PseudoClass && image->colormap != NULL)\n {\n /* Free the bogus colormap; it can cause trouble later */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Freeing bogus colormap\");\n (void) RelinquishMagickMemory(image->colormap);\n image->colormap=NULL;\n }\n }\n\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n\n /*\n Sometimes we get PseudoClass images whose RGB values don't match\n the colors in the colormap. This code syncs the RGB values.\n */\n if (image->depth <= 8 && image->taint && image->storage_class == PseudoClass)\n (void) SyncImage(image,exception);\n\n#if (MAGICKCORE_QUANTUM_DEPTH == 8)\n if (image->depth > 8)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reducing PNG bit depth to 8 since this is a Q8 build.\");\n\n image->depth=8;\n }\n#endif\n\n /* Respect the -depth option */\n if (image->depth < 4)\n {\n register Quantum\n *r;\n\n if (image->depth > 2)\n {\n /* Scale to 4-bit */\n LBR04PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR04PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR04PacketRGBO(image->colormap[i]);\n }\n }\n }\n else if (image->depth > 1)\n {\n /* Scale to 2-bit */\n LBR02PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR02PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR02PacketRGBO(image->colormap[i]);\n }\n }\n }\n else\n {\n /* Scale to 1-bit */\n LBR01PacketRGBO(image->background_color);\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR01PixelRGBA(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR01PacketRGBO(image->colormap[i]);\n }\n }\n }\n }\n\n /* To do: set to next higher multiple of 8 */\n if (image->depth < 8)\n image->depth=8;\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n /* PNG does not handle depths greater than 16 so reduce it even\n * if lossy\n */\n if (image->depth > 8)\n image->depth=16;\n#endif\n\n#if (MAGICKCORE_QUANTUM_DEPTH > 8)\n if (image->depth > 8)\n {\n /* To do: fill low byte properly */\n image->depth=16;\n }\n\n if (image->depth == 16 && mng_info->write_png_depth != 16)\n if (mng_info->write_png8 ||\n LosslessReduceDepthOK(image,exception) != MagickFalse)\n image->depth = 8;\n#endif\n\n image_colors = (int) image->colors;\n number_opaque = (int) image->colors;\n number_transparent = 0;\n number_semitransparent = 0;\n\n if (mng_info->write_png_colortype &&\n (mng_info->write_png_colortype > 4 || (mng_info->write_png_depth >= 8 &&\n mng_info->write_png_colortype < 4 &&\n image->alpha_trait == UndefinedPixelTrait)))\n {\n /* Avoid the expensive BUILD_PALETTE operation if we're sure that we\n * are not going to need the result.\n */\n if (mng_info->write_png_colortype == 1 ||\n mng_info->write_png_colortype == 5)\n ping_have_color=MagickFalse;\n\n if (image->alpha_trait != UndefinedPixelTrait)\n {\n number_transparent = 2;\n number_semitransparent = 1;\n }\n }\n\n if (mng_info->write_png_colortype < 7)\n {\n /* BUILD_PALETTE\n *\n * Normally we run this just once, but in the case of writing PNG8\n * we reduce the transparency to binary and run again, then if there\n * are still too many colors we reduce to a simple 4-4-4-1, then 3-3-3-1\n * RGBA palette and run again, and then to a simple 3-3-2-1 RGBA\n * palette. Then (To do) we take care of a final reduction that is only\n * needed if there are still 256 colors present and one of them has both\n * transparent and opaque instances.\n */\n\n tried_332 = MagickFalse;\n tried_333 = MagickFalse;\n tried_444 = MagickFalse;\n\n for (j=0; j<6; j++)\n {\n /*\n * Sometimes we get DirectClass images that have 256 colors or fewer.\n * This code will build a colormap.\n *\n * Also, sometimes we get PseudoClass images with an out-of-date\n * colormap. This code will replace the colormap with a new one.\n * Sometimes we get PseudoClass images that have more than 256 colors.\n * This code will delete the colormap and change the image to\n * DirectClass.\n *\n * If image->alpha_trait is MagickFalse, we ignore the alpha channel\n * even though it sometimes contains left-over non-opaque values.\n *\n * Also we gather some information (number of opaque, transparent,\n * and semitransparent pixels, and whether the image has any non-gray\n * pixels or only black-and-white pixels) that we might need later.\n *\n * Even if the user wants to force GrayAlpha or RGBA (colortype 4 or 6)\n * we need to check for bogus non-opaque values, at least.\n */\n\n int\n n;\n\n PixelInfo\n opaque[260],\n semitransparent[260],\n transparent[260];\n\n register const Quantum\n *s;\n\n register Quantum\n *q,\n *r;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter BUILD_PALETTE:\");\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->columns=%.20g\",(double) image->columns);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->rows=%.20g\",(double) image->rows);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->alpha_trait=%.20g\",(double) image->alpha_trait);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->depth=%.20g\",(double) image->depth);\n\n if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Original colormap:\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" i (red,green,blue,alpha)\");\n\n for (i=0; i < 256; i++)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n\n for (i=image->colors - 10; i < (ssize_t) image->colors; i++)\n {\n if (i > 255)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n }\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d\",(int) image->colors);\n\n if (image->colors == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" (zero means unknown)\");\n\n if (ping_preserve_colormap == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Regenerate the colormap\");\n }\n\n image_colors=0;\n number_opaque = 0;\n number_semitransparent = 0;\n number_transparent = 0;\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (image->alpha_trait == UndefinedPixelTrait ||\n GetPixelAlpha(image,q) == OpaqueAlpha)\n {\n if (number_opaque < 259)\n {\n if (number_opaque == 0)\n {\n GetPixelInfoPixel(image, q, opaque);\n opaque[0].alpha=OpaqueAlpha;\n number_opaque=1;\n }\n\n for (i=0; i< (ssize_t) number_opaque; i++)\n {\n if (Magick_png_color_equal(image,q,opaque+i))\n break;\n }\n\n if (i == (ssize_t) number_opaque && number_opaque < 259)\n {\n number_opaque++;\n GetPixelInfoPixel(image, q, opaque+i);\n opaque[i].alpha=OpaqueAlpha;\n }\n }\n }\n else if (GetPixelAlpha(image,q) == TransparentAlpha)\n {\n if (number_transparent < 259)\n {\n if (number_transparent == 0)\n {\n GetPixelInfoPixel(image, q, transparent);\n ping_trans_color.red=(unsigned short)\n GetPixelRed(image,q);\n ping_trans_color.green=(unsigned short)\n GetPixelGreen(image,q);\n ping_trans_color.blue=(unsigned short)\n GetPixelBlue(image,q);\n ping_trans_color.gray=(unsigned short)\n GetPixelGray(image,q);\n number_transparent = 1;\n }\n\n for (i=0; i< (ssize_t) number_transparent; i++)\n {\n if (Magick_png_color_equal(image,q,transparent+i))\n break;\n }\n\n if (i == (ssize_t) number_transparent &&\n number_transparent < 259)\n {\n number_transparent++;\n GetPixelInfoPixel(image,q,transparent+i);\n }\n }\n }\n else\n {\n if (number_semitransparent < 259)\n {\n if (number_semitransparent == 0)\n {\n GetPixelInfoPixel(image,q,semitransparent);\n number_semitransparent = 1;\n }\n\n for (i=0; i< (ssize_t) number_semitransparent; i++)\n {\n if (Magick_png_color_equal(image,q,semitransparent+i)\n && GetPixelAlpha(image,q) ==\n semitransparent[i].alpha)\n break;\n }\n\n if (i == (ssize_t) number_semitransparent &&\n number_semitransparent < 259)\n {\n number_semitransparent++;\n GetPixelInfoPixel(image, q, semitransparent+i);\n }\n }\n }\n q+=GetPixelChannels(image);\n }\n }\n\n if (mng_info->write_png8 == MagickFalse &&\n ping_exclude_bKGD == MagickFalse)\n {\n /* Add the background color to the palette, if it\n * isn't already there.\n */\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Check colormap for background (%d,%d,%d)\",\n (int) image->background_color.red,\n (int) image->background_color.green,\n (int) image->background_color.blue);\n }\n for (i=0; ibackground_color.red &&\n opaque[i].green == image->background_color.green &&\n opaque[i].blue == image->background_color.blue)\n break;\n }\n if (number_opaque < 259 && i == number_opaque)\n {\n opaque[i] = image->background_color;\n ping_background.index = i;\n number_opaque++;\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",(int) i);\n }\n\n }\n else if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No room in the colormap to add background color\");\n }\n\n image_colors=number_opaque+number_transparent+number_semitransparent;\n\n if (logging != MagickFalse)\n {\n if (image_colors > 256)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has more than 256 colors\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has %d colors\",image_colors);\n }\n\n if (ping_preserve_colormap != MagickFalse)\n break;\n\n if (mng_info->write_png_colortype != 7) /* We won't need this info */\n {\n ping_have_color=MagickFalse;\n ping_have_non_bw=MagickFalse;\n\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"incompatible colorspace\");\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n }\n\n if(image_colors > 256)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n s=q;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelRed(image,s) != GetPixelGreen(image,s) ||\n GetPixelRed(image,s) != GetPixelBlue(image,s))\n {\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n break;\n }\n s+=GetPixelChannels(image);\n }\n\n if (ping_have_color != MagickFalse)\n break;\n\n /* Worst case is black-and-white; we are looking at every\n * pixel twice.\n */\n\n if (ping_have_non_bw == MagickFalse)\n {\n s=q;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelRed(image,s) != 0 &&\n GetPixelRed(image,s) != QuantumRange)\n {\n ping_have_non_bw=MagickTrue;\n break;\n }\n s+=GetPixelChannels(image);\n }\n }\n }\n }\n }\n\n if (image_colors < 257)\n {\n PixelInfo\n colormap[260];\n\n /*\n * Initialize image colormap.\n */\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Sort the new colormap\");\n\n /* Sort palette, transparent first */;\n\n n = 0;\n\n for (i=0; iping_exclude_tRNS == MagickFalse ||\n (number_transparent == 0 && number_semitransparent == 0)) &&\n (((mng_info->write_png_colortype-1) ==\n PNG_COLOR_TYPE_PALETTE) ||\n (mng_info->write_png_colortype == 0)))\n {\n if (logging != MagickFalse)\n {\n if (n != (ssize_t) image_colors)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_colors (%d) and n (%d) don't match\",\n image_colors, n);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" AcquireImageColormap\");\n }\n\n image->colors = image_colors;\n\n if (AcquireImageColormap(image,image_colors,exception) ==\n MagickFalse)\n ThrowWriterException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n\n for (i=0; i< (ssize_t) image_colors; i++)\n image->colormap[i] = colormap[i];\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d (%d)\",\n (int) image->colors, image_colors);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Update the pixel indexes\");\n }\n\n /* Sync the pixel indices with the new colormap */\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n for (i=0; i< (ssize_t) image_colors; i++)\n {\n if ((image->alpha_trait == UndefinedPixelTrait ||\n image->colormap[i].alpha == GetPixelAlpha(image,q)) &&\n image->colormap[i].red == GetPixelRed(image,q) &&\n image->colormap[i].green == GetPixelGreen(image,q) &&\n image->colormap[i].blue == GetPixelBlue(image,q))\n {\n SetPixelIndex(image,i,q);\n break;\n }\n }\n q+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d\", (int) image->colors);\n\n if (image->colormap != NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" i (red,green,blue,alpha)\");\n\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n if (i < 300 || i >= (ssize_t) image->colors - 10)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].alpha);\n }\n }\n }\n\n if (number_transparent < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_transparent = %d\",\n number_transparent);\n else\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_transparent > 256\");\n\n if (number_opaque < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_opaque = %d\",\n number_opaque);\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_opaque > 256\");\n\n if (number_semitransparent < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_semitransparent = %d\",\n number_semitransparent);\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_semitransparent > 256\");\n\n if (ping_have_non_bw == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" All pixels and the background are black or white\");\n\n else if (ping_have_color == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" All pixels and the background are gray\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" At least one pixel or the background is non-gray\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Exit BUILD_PALETTE:\");\n }\n\n if (mng_info->write_png8 == MagickFalse)\n break;\n\n /* Make any reductions necessary for the PNG8 format */\n if (image_colors <= 256 &&\n image_colors != 0 && image->colormap != NULL &&\n number_semitransparent == 0 &&\n number_transparent <= 1)\n break;\n\n /* PNG8 can't have semitransparent colors so we threshold the\n * opacity to 0 or OpaqueOpacity, and PNG8 can only have one\n * transparent color so if more than one is transparent we merge\n * them into image->background_color.\n */\n if (number_semitransparent != 0 || number_transparent > 1)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Thresholding the alpha channel to binary\");\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) < OpaqueAlpha/2)\n {\n SetPixelViaPixelInfo(image,&image->background_color,r);\n SetPixelAlpha(image,TransparentAlpha,r);\n }\n else\n SetPixelAlpha(image,OpaqueAlpha,r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n\n if (image_colors != 0 && image_colors <= 256 &&\n image->colormap != NULL)\n for (i=0; icolormap[i].alpha =\n (image->colormap[i].alpha > TransparentAlpha/2 ?\n TransparentAlpha : OpaqueAlpha);\n }\n continue;\n }\n\n /* PNG8 can't have more than 256 colors so we quantize the pixels and\n * background color to the 4-4-4-1, 3-3-3-1 or 3-3-2-1 palette. If the\n * image is mostly gray, the 4-4-4-1 palette is likely to end up with 256\n * colors or less.\n */\n if (tried_444 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 4-4-4\");\n\n tried_444 = MagickTrue;\n\n LBR04PacketRGB(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 4-4-4\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR04PixelRGB(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 4-4-4\");\n\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (tried_333 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 3-3-3\");\n\n tried_333 = MagickTrue;\n\n LBR03PacketRGB(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 3-3-3-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR03RGB(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 3-3-3-1\");\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (tried_332 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 3-3-2\");\n\n tried_332 = MagickTrue;\n\n /* Red and green were already done so we only quantize the blue\n * channel\n */\n\n LBR02PacketBlue(image->background_color);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 3-3-2-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,r) == OpaqueAlpha)\n LBR02PixelBlue(r);\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n\n else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 3-3-2-1\");\n for (i=0; icolormap[i]);\n }\n }\n continue;\n }\n\n if (image_colors == 0 || image_colors > 256)\n {\n /* Take care of special case with 256 opaque colors + 1 transparent\n * color. We don't need to quantize to 2-3-2-1; we only need to\n * eliminate one color, so we'll merge the two darkest red\n * colors (0x49, 0, 0) -> (0x24, 0, 0).\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Merging two dark red background colors to 3-3-2-1\");\n\n if (ScaleQuantumToChar(image->background_color.red) == 0x49 &&\n ScaleQuantumToChar(image->background_color.green) == 0x00 &&\n ScaleQuantumToChar(image->background_color.blue) == 0x00)\n {\n image->background_color.red=ScaleCharToQuantum(0x24);\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Merging two dark red pixel colors to 3-3-2-1\");\n\n if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,exception);\n\n if (r == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (ScaleQuantumToChar(GetPixelRed(image,r)) == 0x49 &&\n ScaleQuantumToChar(GetPixelGreen(image,r)) == 0x00 &&\n ScaleQuantumToChar(GetPixelBlue(image,r)) == 0x00 &&\n GetPixelAlpha(image,r) == OpaqueAlpha)\n {\n SetPixelRed(image,ScaleCharToQuantum(0x24),r);\n }\n r+=GetPixelChannels(image);\n }\n\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n\n }\n }\n\n else\n {\n for (i=0; icolormap[i].red) == 0x49 &&\n ScaleQuantumToChar(image->colormap[i].green) == 0x00 &&\n ScaleQuantumToChar(image->colormap[i].blue) == 0x00)\n {\n image->colormap[i].red=ScaleCharToQuantum(0x24);\n }\n }\n }\n }\n }\n }\n /* END OF BUILD_PALETTE */\n\n /* If we are excluding the tRNS chunk and there is transparency,\n * then we must write a Gray-Alpha (color-type 4) or RGBA (color-type 6)\n * PNG.\n */\n if (mng_info->ping_exclude_tRNS != MagickFalse &&\n (number_transparent != 0 || number_semitransparent != 0))\n {\n unsigned int colortype=mng_info->write_png_colortype;\n\n if (ping_have_color == MagickFalse)\n mng_info->write_png_colortype = 5;\n\n else\n mng_info->write_png_colortype = 7;\n\n if (colortype != 0 &&\n mng_info->write_png_colortype != colortype)\n ping_need_colortype_warning=MagickTrue;\n\n }\n\n /* See if cheap transparency is possible. It is only possible\n * when there is a single transparent color, no semitransparent\n * color, and no opaque color that has the same RGB components\n * as the transparent color. We only need this information if\n * we are writing a PNG with colortype 0 or 2, and we have not\n * excluded the tRNS chunk.\n */\n if (number_transparent == 1 &&\n mng_info->write_png_colortype < 4)\n {\n ping_have_cheap_transparency = MagickTrue;\n\n if (number_semitransparent != 0)\n ping_have_cheap_transparency = MagickFalse;\n\n else if (image_colors == 0 || image_colors > 256 ||\n image->colormap == NULL)\n {\n register const Quantum\n *q;\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (q == (Quantum *) NULL)\n break;\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelAlpha(image,q) != TransparentAlpha &&\n (unsigned short) GetPixelRed(image,q) ==\n ping_trans_color.red &&\n (unsigned short) GetPixelGreen(image,q) ==\n ping_trans_color.green &&\n (unsigned short) GetPixelBlue(image,q) ==\n ping_trans_color.blue)\n {\n ping_have_cheap_transparency = MagickFalse;\n break;\n }\n\n q+=GetPixelChannels(image);\n }\n\n if (ping_have_cheap_transparency == MagickFalse)\n break;\n }\n }\n else\n {\n /* Assuming that image->colormap[0] is the one transparent color\n * and that all others are opaque.\n */\n if (image_colors > 1)\n for (i=1; icolormap[i].red == image->colormap[0].red &&\n image->colormap[i].green == image->colormap[0].green &&\n image->colormap[i].blue == image->colormap[0].blue)\n {\n ping_have_cheap_transparency = MagickFalse;\n break;\n }\n }\n\n if (logging != MagickFalse)\n {\n if (ping_have_cheap_transparency == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Cheap transparency is not possible.\");\n\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Cheap transparency is possible.\");\n }\n }\n else\n ping_have_cheap_transparency = MagickFalse;\n\n image_depth=image->depth;\n\n quantum_info = (QuantumInfo *) NULL;\n number_colors=0;\n image_colors=(int) image->colors;\n image_matte=image->alpha_trait !=\n UndefinedPixelTrait ? MagickTrue : MagickFalse;\n\n if (mng_info->write_png_colortype < 5)\n mng_info->IsPalette=image->storage_class == PseudoClass &&\n image_colors <= 256 && image->colormap != NULL;\n else\n mng_info->IsPalette = MagickFalse;\n\n if ((mng_info->write_png_colortype == 4 || mng_info->write_png8) &&\n (image->colors == 0 || image->colormap == NULL))\n {\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n (void) ThrowMagickException(exception,GetMagickModule(),CoderError,\n \"Cannot write PNG8 or color-type 3; colormap is NULL\",\n \"`%s'\",IMimage->filename);\n return(MagickFalse);\n }\n\n /*\n Allocate the PNG structures\n */\n#ifdef PNG_USER_MEM_SUPPORTED\n error_info.image=image;\n error_info.exception=exception;\n ping=png_create_write_struct_2(PNG_LIBPNG_VER_STRING,&error_info,\n MagickPNGErrorHandler,MagickPNGWarningHandler,(void *) NULL,\n (png_malloc_ptr) Magick_png_malloc,(png_free_ptr) Magick_png_free);\n\n#else\n ping=png_create_write_struct(PNG_LIBPNG_VER_STRING,&error_info,\n MagickPNGErrorHandler,MagickPNGWarningHandler);\n\n#endif\n if (ping == (png_struct *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n ping_info=png_create_info_struct(ping);\n\n if (ping_info == (png_info *) NULL)\n {\n png_destroy_write_struct(&ping,(png_info **) NULL);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n\n png_set_write_fn(ping,image,png_put_data,png_flush_data);\n pixel_info=(MemoryInfo *) NULL;\n\n if (setjmp(png_jmpbuf(ping)))\n {\n /*\n PNG write failed.\n */\n#ifdef PNG_DEBUG\n if (image_info->verbose)\n (void) printf(\"PNG write has failed.\\n\");\n#endif\n png_destroy_write_struct(&ping,&ping_info);\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n UnlockSemaphoreInfo(ping_semaphore);\n#endif\n\n if (pixel_info != (MemoryInfo *) NULL)\n pixel_info=RelinquishVirtualMemory(pixel_info);\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n\n if (ping_have_blob != MagickFalse)\n (void) CloseBlob(image);\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n return(MagickFalse);\n }\n\n /* { For navigation to end of SETJMP-protected block. Within this\n * block, use png_error() instead of Throwing an Exception, to ensure\n * that libpng is able to clean up, and that the semaphore is unlocked.\n */\n\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n LockSemaphoreInfo(ping_semaphore);\n#endif\n\n#ifdef PNG_BENIGN_ERRORS_SUPPORTED\n /* Allow benign errors */\n png_set_benign_errors(ping, 1);\n#endif\n\n#ifdef PNG_SET_USER_LIMITS_SUPPORTED\n /* Reject images with too many rows or columns */\n png_set_user_limits(ping,\n (png_uint_32) MagickMin(0x7fffffffL,\n GetMagickResourceLimit(WidthResource)),\n (png_uint_32) MagickMin(0x7fffffffL,\n GetMagickResourceLimit(HeightResource)));\n#endif /* PNG_SET_USER_LIMITS_SUPPORTED */\n\n /*\n Prepare PNG for writing.\n */\n\n#if defined(PNG_MNG_FEATURES_SUPPORTED)\n if (mng_info->write_mng)\n {\n (void) png_permit_mng_features(ping,PNG_ALL_MNG_FEATURES);\n# ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED\n /* Disable new libpng-1.5.10 feature when writing a MNG because\n * zero-length PLTE is OK\n */\n png_set_check_for_invalid_index (ping, 0);\n# endif\n }\n\n#else\n# ifdef PNG_WRITE_EMPTY_PLTE_SUPPORTED\n if (mng_info->write_mng)\n png_permit_empty_plte(ping,MagickTrue);\n\n# endif\n#endif\n\n x=0;\n\n ping_width=(png_uint_32) image->columns;\n ping_height=(png_uint_32) image->rows;\n\n if (mng_info->write_png8 || mng_info->write_png24 || mng_info->write_png32)\n image_depth=8;\n\n if (mng_info->write_png48 || mng_info->write_png64)\n image_depth=16;\n\n if (mng_info->write_png_depth != 0)\n image_depth=mng_info->write_png_depth;\n\n /* Adjust requested depth to next higher valid depth if necessary */\n if (image_depth > 8)\n image_depth=16;\n\n if ((image_depth > 4) && (image_depth < 8))\n image_depth=8;\n\n if (image_depth == 3)\n image_depth=4;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" width=%.20g\",(double) ping_width);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" height=%.20g\",(double) ping_height);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_matte=%.20g\",(double) image->alpha_trait);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->depth=%.20g\",(double) image->depth);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative ping_bit_depth=%.20g\",(double) image_depth);\n }\n\n save_image_depth=image_depth;\n ping_bit_depth=(png_byte) save_image_depth;\n\n\n#if defined(PNG_pHYs_SUPPORTED)\n if (ping_exclude_pHYs == MagickFalse)\n {\n if ((image->resolution.x != 0) && (image->resolution.y != 0) &&\n (!mng_info->write_mng || !mng_info->equal_physs))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up pHYs chunk\");\n\n if (image->units == PixelsPerInchResolution)\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_METER;\n ping_pHYs_x_resolution=\n (png_uint_32) ((100.0*image->resolution.x+0.5)/2.54);\n ping_pHYs_y_resolution=\n (png_uint_32) ((100.0*image->resolution.y+0.5)/2.54);\n }\n\n else if (image->units == PixelsPerCentimeterResolution)\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_METER;\n ping_pHYs_x_resolution=(png_uint_32) (100.0*image->resolution.x+0.5);\n ping_pHYs_y_resolution=(png_uint_32) (100.0*image->resolution.y+0.5);\n }\n\n else\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_UNKNOWN;\n ping_pHYs_x_resolution=(png_uint_32) image->resolution.x;\n ping_pHYs_y_resolution=(png_uint_32) image->resolution.y;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Set up PNG pHYs chunk: xres: %.20g, yres: %.20g, units: %d.\",\n (double) ping_pHYs_x_resolution,(double) ping_pHYs_y_resolution,\n (int) ping_pHYs_unit_type);\n ping_have_pHYs = MagickTrue;\n }\n }\n#endif\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if ((!mng_info->adjoin || !mng_info->equal_backgrounds))\n {\n unsigned int\n mask;\n\n mask=0xffff;\n if (ping_bit_depth == 8)\n mask=0x00ff;\n\n if (ping_bit_depth == 4)\n mask=0x000f;\n\n if (ping_bit_depth == 2)\n mask=0x0003;\n\n if (ping_bit_depth == 1)\n mask=0x0001;\n\n ping_background.red=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.red) & mask);\n\n ping_background.green=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.green) & mask);\n\n ping_background.blue=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.blue) & mask);\n\n ping_background.gray=(png_uint_16) ping_background.green;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk (1)\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_bit_depth=%d\",ping_bit_depth);\n }\n\n ping_have_bKGD = MagickTrue;\n }\n\n /*\n Select the color type.\n */\n matte=image_matte;\n old_bit_depth=0;\n\n if (mng_info->IsPalette && mng_info->write_png8)\n {\n /* To do: make this a function cause it's used twice, except\n for reducing the sample depth from 8. */\n\n number_colors=image_colors;\n\n ping_have_tRNS=MagickFalse;\n\n /*\n Set image palette.\n */\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up PLTE chunk with %d colors (%d)\",\n number_colors, image_colors);\n\n for (i=0; i < (ssize_t) number_colors; i++)\n {\n palette[i].red=ScaleQuantumToChar(image->colormap[i].red);\n palette[i].green=ScaleQuantumToChar(image->colormap[i].green);\n palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n#if MAGICKCORE_QUANTUM_DEPTH == 8\n \" %3ld (%3d,%3d,%3d)\",\n#else\n \" %5ld (%5d,%5d,%5d)\",\n#endif\n (long) i,palette[i].red,palette[i].green,palette[i].blue);\n\n }\n\n ping_have_PLTE=MagickTrue;\n image_depth=ping_bit_depth;\n ping_num_trans=0;\n\n if (matte != MagickFalse)\n {\n /*\n Identify which colormap entry is transparent.\n */\n assert(number_colors <= 256);\n assert(image->colormap != NULL);\n\n for (i=0; i < (ssize_t) number_transparent; i++)\n ping_trans_alpha[i]=0;\n\n\n ping_num_trans=(unsigned short) (number_transparent +\n number_semitransparent);\n\n if (ping_num_trans == 0)\n ping_have_tRNS=MagickFalse;\n\n else\n ping_have_tRNS=MagickTrue;\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n /*\n * Identify which colormap entry is the background color.\n */\n\n for (i=0; i < (ssize_t) MagickMax(1L*number_colors-1L,1L); i++)\n if (IsPNGColorEqual(ping_background,image->colormap[i]))\n break;\n\n ping_background.index=(png_byte) i;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n }\n }\n } /* end of write_png8 */\n\n else if (mng_info->write_png_colortype == 1)\n {\n image_matte=MagickFalse;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;\n }\n\n else if (mng_info->write_png24 || mng_info->write_png48 ||\n mng_info->write_png_colortype == 3)\n {\n image_matte=MagickFalse;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n }\n\n else if (mng_info->write_png32 || mng_info->write_png64 ||\n mng_info->write_png_colortype == 7)\n {\n image_matte=MagickTrue;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA;\n }\n\n else /* mng_info->write_pngNN not specified */\n {\n image_depth=ping_bit_depth;\n\n if (mng_info->write_png_colortype != 0)\n {\n ping_color_type=(png_byte) mng_info->write_png_colortype-1;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||\n ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA)\n image_matte=MagickTrue;\n\n else\n image_matte=MagickFalse;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG colortype %d was specified:\",(int) ping_color_type);\n }\n\n else /* write_png_colortype not specified */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Selecting PNG colortype:\");\n\n ping_color_type=(png_byte) ((matte != MagickFalse)?\n PNG_COLOR_TYPE_RGB_ALPHA:PNG_COLOR_TYPE_RGB);\n\n if (image_info->type == TrueColorType)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n image_matte=MagickFalse;\n }\n\n if (image_info->type == TrueColorAlphaType)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA;\n image_matte=MagickTrue;\n }\n\n if (image_info->type == PaletteType ||\n image_info->type == PaletteAlphaType)\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (mng_info->write_png_colortype == 0 &&\n image_info->type == UndefinedType)\n {\n if (ping_have_color == MagickFalse)\n {\n if (image_matte == MagickFalse)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;\n image_matte=MagickFalse;\n }\n\n else\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY_ALPHA;\n image_matte=MagickTrue;\n }\n }\n else\n {\n if (image_matte == MagickFalse)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n image_matte=MagickFalse;\n }\n\n else\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGBA;\n image_matte=MagickTrue;\n }\n }\n }\n\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Selected PNG colortype=%d\",ping_color_type);\n\n if (ping_bit_depth < 8)\n {\n if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||\n ping_color_type == PNG_COLOR_TYPE_RGB ||\n ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA)\n ping_bit_depth=8;\n }\n\n old_bit_depth=ping_bit_depth;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (image->alpha_trait == UndefinedPixelTrait &&\n ping_have_non_bw == MagickFalse)\n ping_bit_depth=1;\n }\n\n if (ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n size_t one = 1;\n ping_bit_depth=1;\n\n if (image->colors == 0)\n {\n /* DO SOMETHING */\n png_error(ping,\"image has 0 colors\");\n }\n\n while ((int) (one << ping_bit_depth) < (ssize_t) image_colors)\n ping_bit_depth <<= 1;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number of colors: %.20g\",(double) image_colors);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative PNG bit depth: %d\",ping_bit_depth);\n }\n\n if (ping_bit_depth < (int) mng_info->write_png_depth)\n ping_bit_depth = mng_info->write_png_depth;\n }\n\n image_depth=ping_bit_depth;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative PNG color type: %s (%.20g)\",\n PngColorTypeToString(ping_color_type),\n (double) ping_color_type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_info->type: %.20g\",(double) image_info->type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_depth: %.20g\",(double) image_depth);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n\n \" image->depth: %.20g\",(double) image->depth);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_bit_depth: %.20g\",(double) ping_bit_depth);\n }\n\n if (matte != MagickFalse)\n {\n if (mng_info->IsPalette)\n {\n if (mng_info->write_png_colortype == 0)\n {\n ping_color_type=PNG_COLOR_TYPE_GRAY_ALPHA;\n\n if (ping_have_color != MagickFalse)\n ping_color_type=PNG_COLOR_TYPE_RGBA;\n }\n\n /*\n * Determine if there is any transparent color.\n */\n if (number_transparent + number_semitransparent == 0)\n {\n /*\n No transparent pixels are present. Change 4 or 6 to 0 or 2.\n */\n\n image_matte=MagickFalse;\n\n if (mng_info->write_png_colortype == 0)\n ping_color_type&=0x03;\n }\n\n else\n {\n unsigned int\n mask;\n\n mask=0xffff;\n\n if (ping_bit_depth == 8)\n mask=0x00ff;\n\n if (ping_bit_depth == 4)\n mask=0x000f;\n\n if (ping_bit_depth == 2)\n mask=0x0003;\n\n if (ping_bit_depth == 1)\n mask=0x0001;\n\n ping_trans_color.red=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].red) & mask);\n\n ping_trans_color.green=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].green) & mask);\n\n ping_trans_color.blue=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].blue) & mask);\n\n ping_trans_color.gray=(png_uint_16)\n (ScaleQuantumToShort(GetPixelInfoIntensity(image,\n image->colormap)) & mask);\n\n ping_trans_color.index=(png_byte) 0;\n\n ping_have_tRNS=MagickTrue;\n }\n\n if (ping_have_tRNS != MagickFalse)\n {\n /*\n * Determine if there is one and only one transparent color\n * and if so if it is fully transparent.\n */\n if (ping_have_cheap_transparency == MagickFalse)\n ping_have_tRNS=MagickFalse;\n }\n\n if (ping_have_tRNS != MagickFalse)\n {\n if (mng_info->write_png_colortype == 0)\n ping_color_type &= 0x03; /* changes 4 or 6 to 0 or 2 */\n\n if (image_depth == 8)\n {\n ping_trans_color.red&=0xff;\n ping_trans_color.green&=0xff;\n ping_trans_color.blue&=0xff;\n ping_trans_color.gray&=0xff;\n }\n }\n }\n else\n {\n if (image_depth == 8)\n {\n ping_trans_color.red&=0xff;\n ping_trans_color.green&=0xff;\n ping_trans_color.blue&=0xff;\n ping_trans_color.gray&=0xff;\n }\n }\n }\n\n matte=image_matte;\n\n if (ping_have_tRNS != MagickFalse)\n image_matte=MagickFalse;\n\n if ((mng_info->IsPalette) &&\n mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE &&\n ping_have_color == MagickFalse &&\n (image_matte == MagickFalse || image_depth >= 8))\n {\n size_t one=1;\n\n if (image_matte != MagickFalse)\n ping_color_type=PNG_COLOR_TYPE_GRAY_ALPHA;\n\n else if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n ping_color_type=PNG_COLOR_TYPE_GRAY;\n\n if (save_image_depth == 16 && image_depth == 8)\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color (0)\");\n }\n ping_trans_color.gray*=0x0101;\n }\n }\n\n if (image_depth > MAGICKCORE_QUANTUM_DEPTH)\n image_depth=MAGICKCORE_QUANTUM_DEPTH;\n\n if ((image_colors == 0) ||\n ((ssize_t) (image_colors-1) > (ssize_t) MaxColormapSize))\n image_colors=(int) (one << image_depth);\n\n if (image_depth > 8)\n ping_bit_depth=16;\n\n else\n {\n ping_bit_depth=8;\n if ((int) ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n if(!mng_info->write_png_depth)\n {\n ping_bit_depth=1;\n\n while ((int) (one << ping_bit_depth)\n < (ssize_t) image_colors)\n ping_bit_depth <<= 1;\n }\n }\n\n else if (ping_color_type ==\n PNG_COLOR_TYPE_GRAY && image_colors < 17 &&\n mng_info->IsPalette)\n {\n /* Check if grayscale is reducible */\n\n int\n depth_4_ok=MagickTrue,\n depth_2_ok=MagickTrue,\n depth_1_ok=MagickTrue;\n\n for (i=0; i < (ssize_t) image_colors; i++)\n {\n unsigned char\n intensity;\n\n intensity=ScaleQuantumToChar(image->colormap[i].red);\n\n if ((intensity & 0x0f) != ((intensity & 0xf0) >> 4))\n depth_4_ok=depth_2_ok=depth_1_ok=MagickFalse;\n else if ((intensity & 0x03) != ((intensity & 0x0c) >> 2))\n depth_2_ok=depth_1_ok=MagickFalse;\n else if ((intensity & 0x01) != ((intensity & 0x02) >> 1))\n depth_1_ok=MagickFalse;\n }\n\n if (depth_1_ok && mng_info->write_png_depth <= 1)\n ping_bit_depth=1;\n\n else if (depth_2_ok && mng_info->write_png_depth <= 2)\n ping_bit_depth=2;\n\n else if (depth_4_ok && mng_info->write_png_depth <= 4)\n ping_bit_depth=4;\n }\n }\n\n image_depth=ping_bit_depth;\n }\n\n else\n\n if (mng_info->IsPalette)\n {\n number_colors=image_colors;\n\n if (image_depth <= 8)\n {\n /*\n Set image palette.\n */\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;\n\n if (!(mng_info->have_write_global_plte && matte == MagickFalse))\n {\n for (i=0; i < (ssize_t) number_colors; i++)\n {\n palette[i].red=ScaleQuantumToChar(image->colormap[i].red);\n palette[i].green=\n ScaleQuantumToChar(image->colormap[i].green);\n palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up PLTE chunk with %d colors\",\n number_colors);\n\n ping_have_PLTE=MagickTrue;\n }\n\n /* color_type is PNG_COLOR_TYPE_PALETTE */\n if (mng_info->write_png_depth == 0)\n {\n size_t\n one;\n\n ping_bit_depth=1;\n one=1;\n\n while ((one << ping_bit_depth) < (size_t) number_colors)\n ping_bit_depth <<= 1;\n }\n\n ping_num_trans=0;\n\n if (matte != MagickFalse)\n {\n /*\n * Set up trans_colors array.\n */\n assert(number_colors <= 256);\n\n ping_num_trans=(unsigned short) (number_transparent +\n number_semitransparent);\n\n if (ping_num_trans == 0)\n ping_have_tRNS=MagickFalse;\n\n else\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color (1)\");\n }\n ping_have_tRNS=MagickTrue;\n\n for (i=0; i < ping_num_trans; i++)\n {\n ping_trans_alpha[i]= (png_byte)\n ScaleQuantumToChar(image->colormap[i].alpha);\n }\n }\n }\n }\n }\n\n else\n {\n\n if (image_depth < 8)\n image_depth=8;\n\n if ((save_image_depth == 16) && (image_depth == 8))\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color from (%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n\n ping_trans_color.red*=0x0101;\n ping_trans_color.green*=0x0101;\n ping_trans_color.blue*=0x0101;\n ping_trans_color.gray*=0x0101;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" to (%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n }\n }\n\n if (ping_bit_depth < (ssize_t) mng_info->write_png_depth)\n ping_bit_depth = (ssize_t) mng_info->write_png_depth;\n\n /*\n Adjust background and transparency samples in sub-8-bit grayscale files.\n */\n if (ping_bit_depth < 8 && ping_color_type ==\n PNG_COLOR_TYPE_GRAY)\n {\n png_uint_16\n maxval;\n\n size_t\n one=1;\n\n maxval=(png_uint_16) ((one << ping_bit_depth)-1);\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n\n ping_background.gray=(png_uint_16) ((maxval/65535.)*\n (ScaleQuantumToShort(((GetPixelInfoIntensity(image,\n &image->background_color))) +.5)));\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk (2)\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n\n ping_have_bKGD = MagickTrue;\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color.gray from %d\",\n (int)ping_trans_color.gray);\n\n ping_trans_color.gray=(png_uint_16) ((maxval/255.)*(\n ping_trans_color.gray)+.5);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" to %d\", (int)ping_trans_color.gray);\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if (mng_info->IsPalette && (int) ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n /*\n Identify which colormap entry is the background color.\n */\n\n number_colors=image_colors;\n\n for (i=0; i < (ssize_t) MagickMax(1L*number_colors,1L); i++)\n if (IsPNGColorEqual(image->background_color,image->colormap[i]))\n break;\n\n ping_background.index=(png_byte) i;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk with index=%d\",(int) i);\n }\n\n if (i < (ssize_t) number_colors)\n {\n ping_have_bKGD = MagickTrue;\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background =(%d,%d,%d)\",\n (int) ping_background.red,\n (int) ping_background.green,\n (int) ping_background.blue);\n }\n }\n\n else /* Can't happen */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No room in PLTE to add bKGD color\");\n ping_have_bKGD = MagickFalse;\n }\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG color type: %s (%d)\", PngColorTypeToString(ping_color_type),\n ping_color_type);\n /*\n Initialize compression level and filtering.\n */\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up deflate compression\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression buffer size: 32768\");\n }\n\n png_set_compression_buffer_size(ping,32768L);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression mem level: 9\");\n\n png_set_compression_mem_level(ping, 9);\n\n /* Untangle the \"-quality\" setting:\n\n Undefined is 0; the default is used.\n Default is 75\n\n 10's digit:\n\n 0 or omitted: Use Z_HUFFMAN_ONLY strategy with the\n zlib default compression level\n\n 1-9: the zlib compression level\n\n 1's digit:\n\n 0-4: the PNG filter method\n\n 5: libpng adaptive filtering if compression level > 5\n libpng filter type \"none\" if compression level <= 5\n or if image is grayscale or palette\n\n 6: libpng adaptive filtering\n\n 7: \"LOCO\" filtering (intrapixel differing) if writing\n a MNG, otherwise \"none\". Did not work in IM-6.7.0-9\n and earlier because of a missing \"else\".\n\n 8: Z_RLE strategy (or Z_HUFFMAN_ONLY if quality < 10), adaptive\n filtering. Unused prior to IM-6.7.0-10, was same as 6\n\n 9: Z_RLE strategy (or Z_HUFFMAN_ONLY if quality < 10), no PNG filters\n Unused prior to IM-6.7.0-10, was same as 6\n\n Note that using the -quality option, not all combinations of\n PNG filter type, zlib compression level, and zlib compression\n strategy are possible. This will be addressed soon in a\n release that accomodates \"-define png:compression-strategy\", etc.\n\n */\n\n quality=image_info->quality == UndefinedCompressionQuality ? 75UL :\n image_info->quality;\n\n if (quality <= 9)\n {\n if (mng_info->write_png_compression_strategy == 0)\n mng_info->write_png_compression_strategy = Z_HUFFMAN_ONLY+1;\n }\n\n else if (mng_info->write_png_compression_level == 0)\n {\n int\n level;\n\n level=(int) MagickMin((ssize_t) quality/10,9);\n\n mng_info->write_png_compression_level = level+1;\n }\n\n if (mng_info->write_png_compression_strategy == 0)\n {\n if ((quality %10) == 8 || (quality %10) == 9)\n#ifdef Z_RLE /* Z_RLE was added to zlib-1.2.0 */\n mng_info->write_png_compression_strategy=Z_RLE+1;\n#else\n mng_info->write_png_compression_strategy = Z_DEFAULT_STRATEGY+1;\n#endif\n }\n\n if (mng_info->write_png_compression_filter == 0)\n mng_info->write_png_compression_filter=((int) quality % 10) + 1;\n\n if (logging != MagickFalse)\n {\n if (mng_info->write_png_compression_level)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression level: %d\",\n (int) mng_info->write_png_compression_level-1);\n\n if (mng_info->write_png_compression_strategy)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression strategy: %d\",\n (int) mng_info->write_png_compression_strategy-1);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up filtering\");\n\n if (mng_info->write_png_compression_filter == 6)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: ADAPTIVE\");\n else if (mng_info->write_png_compression_filter == 0 ||\n mng_info->write_png_compression_filter == 1)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: NONE\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: %d\",\n (int) mng_info->write_png_compression_filter-1);\n }\n\n if (mng_info->write_png_compression_level != 0)\n png_set_compression_level(ping,mng_info->write_png_compression_level-1);\n\n if (mng_info->write_png_compression_filter == 6)\n {\n if (((int) ping_color_type == PNG_COLOR_TYPE_GRAY) ||\n ((int) ping_color_type == PNG_COLOR_TYPE_PALETTE) ||\n (quality < 50))\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n else\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_ALL_FILTERS);\n }\n else if (mng_info->write_png_compression_filter == 7 ||\n mng_info->write_png_compression_filter == 10)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_ALL_FILTERS);\n\n else if (mng_info->write_png_compression_filter == 8)\n {\n#if defined(PNG_MNG_FEATURES_SUPPORTED) && defined(PNG_INTRAPIXEL_DIFFERENCING)\n if (mng_info->write_mng)\n {\n if (((int) ping_color_type == PNG_COLOR_TYPE_RGB) ||\n ((int) ping_color_type == PNG_COLOR_TYPE_RGBA))\n ping_filter_method=PNG_INTRAPIXEL_DIFFERENCING;\n }\n#endif\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n }\n\n else if (mng_info->write_png_compression_filter == 9)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n\n else if (mng_info->write_png_compression_filter != 0)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,\n mng_info->write_png_compression_filter-1);\n\n if (mng_info->write_png_compression_strategy != 0)\n png_set_compression_strategy(ping,\n mng_info->write_png_compression_strategy-1);\n\n ping_interlace_method=image_info->interlace != NoInterlace;\n\n if (mng_info->write_mng)\n png_set_sig_bytes(ping,8);\n\n /* Bail out if cannot meet defined png:bit-depth or png:color-type */\n\n if (mng_info->write_png_colortype != 0)\n {\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_GRAY)\n if (ping_have_color != MagickFalse)\n {\n ping_color_type = PNG_COLOR_TYPE_RGB;\n\n if (ping_bit_depth < 8)\n ping_bit_depth=8;\n }\n\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_GRAY_ALPHA)\n if (ping_have_color != MagickFalse)\n ping_color_type = PNG_COLOR_TYPE_RGB_ALPHA;\n }\n\n if (ping_need_colortype_warning != MagickFalse ||\n ((mng_info->write_png_depth &&\n (int) mng_info->write_png_depth != ping_bit_depth) ||\n (mng_info->write_png_colortype &&\n ((int) mng_info->write_png_colortype-1 != ping_color_type &&\n mng_info->write_png_colortype != 7 &&\n !(mng_info->write_png_colortype == 5 && ping_color_type == 0)))))\n {\n if (logging != MagickFalse)\n {\n if (ping_need_colortype_warning != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image has transparency but tRNS chunk was excluded\");\n }\n\n if (mng_info->write_png_depth)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:bit-depth=%u, Computed depth=%u\",\n mng_info->write_png_depth,\n ping_bit_depth);\n }\n\n if (mng_info->write_png_colortype)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:color-type=%u, Computed color type=%u\",\n mng_info->write_png_colortype-1,\n ping_color_type);\n }\n }\n\n png_warning(ping,\n \"Cannot write image with defined png:bit-depth or png:color-type.\");\n }\n\n if (image_matte != MagickFalse && image->alpha_trait == UndefinedPixelTrait)\n {\n /* Add an opaque matte channel */\n image->alpha_trait = BlendPixelTrait;\n (void) SetImageAlpha(image,OpaqueAlpha,exception);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Added an opaque matte channel\");\n }\n\n if (number_transparent != 0 || number_semitransparent != 0)\n {\n if (ping_color_type < 4)\n {\n ping_have_tRNS=MagickTrue;\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting ping_have_tRNS=MagickTrue.\");\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG header chunks\");\n\n png_set_IHDR(ping,ping_info,ping_width,ping_height,\n ping_bit_depth,ping_color_type,\n ping_interlace_method,ping_compression_method,\n ping_filter_method);\n\n if (ping_color_type == 3 && ping_have_PLTE != MagickFalse)\n {\n png_set_PLTE(ping,ping_info,palette,number_colors);\n\n if (logging != MagickFalse)\n {\n for (i=0; i< (ssize_t) number_colors; i++)\n {\n if (i < ping_num_trans)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PLTE[%d] = (%d,%d,%d), tRNS[%d] = (%d)\",\n (int) i,\n (int) palette[i].red,\n (int) palette[i].green,\n (int) palette[i].blue,\n (int) i,\n (int) ping_trans_alpha[i]);\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PLTE[%d] = (%d,%d,%d)\",\n (int) i,\n (int) palette[i].red,\n (int) palette[i].green,\n (int) palette[i].blue);\n }\n }\n }\n\n /* Only write the iCCP chunk if we are not writing the sRGB chunk. */\n if (ping_exclude_sRGB != MagickFalse ||\n (!png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n {\n if ((ping_exclude_tEXt == MagickFalse ||\n ping_exclude_zTXt == MagickFalse) &&\n (ping_exclude_iCCP == MagickFalse || ping_exclude_zCCP == MagickFalse))\n {\n ResetImageProfileIterator(image);\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n#ifdef PNG_WRITE_iCCP_SUPPORTED\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n {\n ping_have_iCCP = MagickTrue;\n if (ping_exclude_iCCP == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up iCCP chunk\");\n\n png_set_iCCP(ping,ping_info,(png_charp) name,0,\n#if (PNG_LIBPNG_VER < 10500)\n (png_charp) GetStringInfoDatum(profile),\n#else\n (const png_byte *) GetStringInfoDatum(profile),\n#endif\n (png_uint_32) GetStringInfoLength(profile));\n }\n else\n {\n /* Do not write hex-encoded ICC chunk */\n name=GetNextImageProfile(image);\n continue;\n }\n }\n#endif /* WRITE_iCCP */\n\n if (LocaleCompare(name,\"exif\") == 0)\n {\n /* Do not write hex-encoded ICC chunk; we will\n write it later as an eXIf chunk */\n name=GetNextImageProfile(image);\n continue;\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up zTXt chunk with uuencoded %s profile\",\n name);\n Magick_png_write_raw_profile(image_info,ping,ping_info,\n (unsigned char *) name,(unsigned char *) name,\n GetStringInfoDatum(profile),\n (png_uint_32) GetStringInfoLength(profile));\n }\n name=GetNextImageProfile(image);\n }\n }\n }\n\n#if defined(PNG_WRITE_sRGB_SUPPORTED)\n if ((mng_info->have_write_global_srgb == 0) &&\n ping_have_iCCP != MagickTrue &&\n (ping_have_sRGB != MagickFalse ||\n png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n {\n if (ping_exclude_sRGB == MagickFalse)\n {\n /*\n Note image rendering intent.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up sRGB chunk\");\n\n (void) png_set_sRGB(ping,ping_info,(\n Magick_RenderingIntent_to_PNG_RenderingIntent(\n image->rendering_intent)));\n\n ping_have_sRGB = MagickTrue;\n }\n }\n\n if ((!mng_info->write_mng) || (!png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n#endif\n {\n if (ping_exclude_gAMA == MagickFalse &&\n ping_have_iCCP == MagickFalse &&\n ping_have_sRGB == MagickFalse &&\n (ping_exclude_sRGB == MagickFalse ||\n (image->gamma < .45 || image->gamma > .46)))\n {\n if ((mng_info->have_write_global_gama == 0) && (image->gamma != 0.0))\n {\n /*\n Note image gamma.\n To do: check for cHRM+gAMA == sRGB, and write sRGB instead.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up gAMA chunk\");\n\n png_set_gAMA(ping,ping_info,image->gamma);\n }\n }\n\n if (ping_exclude_cHRM == MagickFalse && ping_have_sRGB == MagickFalse)\n {\n if ((mng_info->have_write_global_chrm == 0) &&\n (image->chromaticity.red_primary.x != 0.0))\n {\n /*\n Note image chromaticity.\n Note: if cHRM+gAMA == sRGB write sRGB instead.\n */\n PrimaryInfo\n bp,\n gp,\n rp,\n wp;\n\n wp=image->chromaticity.white_point;\n rp=image->chromaticity.red_primary;\n gp=image->chromaticity.green_primary;\n bp=image->chromaticity.blue_primary;\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up cHRM chunk\");\n\n png_set_cHRM(ping,ping_info,wp.x,wp.y,rp.x,rp.y,gp.x,gp.y,\n bp.x,bp.y);\n }\n }\n }\n\n if (ping_exclude_bKGD == MagickFalse)\n {\n if (ping_have_bKGD != MagickFalse)\n {\n png_set_bKGD(ping,ping_info,&ping_background);\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background color = (%d,%d,%d)\",\n (int) ping_background.red,\n (int) ping_background.green,\n (int) ping_background.blue);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" index = %d, gray=%d\",\n (int) ping_background.index,\n (int) ping_background.gray);\n }\n }\n }\n\n if (ping_exclude_pHYs == MagickFalse)\n {\n if (ping_have_pHYs != MagickFalse)\n {\n png_set_pHYs(ping,ping_info,\n ping_pHYs_x_resolution,\n ping_pHYs_y_resolution,\n ping_pHYs_unit_type);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up pHYs chunk\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" x_resolution=%lu\",\n (unsigned long) ping_pHYs_x_resolution);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" y_resolution=%lu\",\n (unsigned long) ping_pHYs_y_resolution);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" unit_type=%lu\",\n (unsigned long) ping_pHYs_unit_type);\n }\n }\n }\n\n#if defined(PNG_tIME_SUPPORTED)\n if (ping_exclude_tIME == MagickFalse)\n {\n const char\n *timestamp;\n\n if (image->taint == MagickFalse)\n {\n timestamp=GetImageOption(image_info,\"png:tIME\");\n\n if (timestamp == (const char *) NULL)\n timestamp=GetImageProperty(image,\"png:tIME\",exception);\n }\n\n else\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reset tIME in tainted image\");\n\n timestamp=GetImageProperty(image,\"date:modify\",exception);\n }\n\n if (timestamp != (const char *) NULL)\n write_tIME_chunk(image,ping,ping_info,timestamp,exception);\n }\n#endif\n\n if (mng_info->need_blob != MagickFalse)\n {\n if (OpenBlob(image_info,image,WriteBinaryBlobMode,exception) ==\n MagickFalse)\n png_error(ping,\"WriteBlob Failed\");\n\n ping_have_blob=MagickTrue;\n }\n\n png_write_info_before_PLTE(ping, ping_info);\n\n if (ping_have_tRNS != MagickFalse && ping_color_type < 4)\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Calling png_set_tRNS with num_trans=%d\",ping_num_trans);\n }\n\n if (ping_color_type == 3)\n (void) png_set_tRNS(ping, ping_info,\n ping_trans_alpha,\n ping_num_trans,\n NULL);\n\n else\n {\n (void) png_set_tRNS(ping, ping_info,\n NULL,\n 0,\n &ping_trans_color);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" tRNS color =(%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n }\n }\n\n /* write any png-chunk-b profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-b\",logging);\n\n png_write_info(ping,ping_info);\n\n /* write any PNG-chunk-m profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-m\",logging);\n\n ping_wrote_caNv = MagickFalse;\n\n /* write caNv chunk */\n if (ping_exclude_caNv == MagickFalse)\n {\n if ((image->page.width != 0 && image->page.width != image->columns) ||\n (image->page.height != 0 && image->page.height != image->rows) ||\n image->page.x != 0 || image->page.y != 0)\n {\n unsigned char\n chunk[20];\n\n (void) WriteBlobMSBULong(image,16L); /* data length=8 */\n PNGType(chunk,mng_caNv);\n LogPNGChunk(logging,mng_caNv,16L);\n PNGLong(chunk+4,(png_uint_32) image->page.width);\n PNGLong(chunk+8,(png_uint_32) image->page.height);\n PNGsLong(chunk+12,(png_int_32) image->page.x);\n PNGsLong(chunk+16,(png_int_32) image->page.y);\n (void) WriteBlob(image,20,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,20));\n ping_wrote_caNv = MagickTrue;\n }\n }\n\n#if defined(PNG_oFFs_SUPPORTED)\n if (ping_exclude_oFFs == MagickFalse && ping_wrote_caNv == MagickFalse)\n {\n if (image->page.x || image->page.y)\n {\n png_set_oFFs(ping,ping_info,(png_int_32) image->page.x,\n (png_int_32) image->page.y, 0);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up oFFs chunk with x=%d, y=%d, units=0\",\n (int) image->page.x, (int) image->page.y);\n }\n }\n#endif\n\n /* write vpAg chunk (deprecated, replaced by caNv) */\n if (ping_exclude_vpAg == MagickFalse && ping_wrote_caNv == MagickFalse)\n {\n if ((image->page.width != 0 && image->page.width != image->columns) ||\n (image->page.height != 0 && image->page.height != image->rows))\n {\n unsigned char\n chunk[14];\n\n (void) WriteBlobMSBULong(image,9L); /* data length=8 */\n PNGType(chunk,mng_vpAg);\n LogPNGChunk(logging,mng_vpAg,9L);\n PNGLong(chunk+4,(png_uint_32) image->page.width);\n PNGLong(chunk+8,(png_uint_32) image->page.height);\n chunk[12]=0; /* unit = pixels */\n (void) WriteBlob(image,13,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,13));\n }\n }\n\n#if (PNG_LIBPNG_VER == 10206)\n /* avoid libpng-1.2.6 bug by setting PNG_HAVE_IDAT flag */\n#define PNG_HAVE_IDAT 0x04\n ping->mode |= PNG_HAVE_IDAT;\n#undef PNG_HAVE_IDAT\n#endif\n\n png_set_packing(ping);\n /*\n Allocate memory.\n */\n rowbytes=image->columns;\n if (image_depth > 8)\n rowbytes*=2;\n switch (ping_color_type)\n {\n case PNG_COLOR_TYPE_RGB:\n rowbytes*=3;\n break;\n\n case PNG_COLOR_TYPE_GRAY_ALPHA:\n rowbytes*=2;\n break;\n\n case PNG_COLOR_TYPE_RGBA:\n rowbytes*=4;\n break;\n\n default:\n break;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG image data\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocating %.20g bytes of memory for pixels\",(double) rowbytes);\n }\n pixel_info=AcquireVirtualMemory(rowbytes,sizeof(*ping_pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n png_error(ping,\"Allocation of memory for pixels failed\");\n ping_pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n\n /*\n Initialize image scanlines.\n */\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n png_error(ping,\"Memory allocation for quantum_info failed\");\n quantum_info->format=UndefinedQuantumFormat;\n SetQuantumDepth(image,quantum_info,image_depth);\n (void) SetQuantumEndian(image,quantum_info,MSBEndian);\n num_passes=png_set_interlace_handling(ping);\n\n if ((!mng_info->write_png8 && !mng_info->write_png24 &&\n !mng_info->write_png48 && !mng_info->write_png64 &&\n !mng_info->write_png32) &&\n (mng_info->IsPalette ||\n (image_info->type == BilevelType)) &&\n image_matte == MagickFalse &&\n ping_have_non_bw == MagickFalse)\n {\n /* Palette, Bilevel, or Opaque Monochrome */\n register const Quantum\n *p;\n\n SetQuantumDepth(image,quantum_info,8);\n for (pass=0; pass < num_passes; pass++)\n {\n /*\n Convert PseudoClass image to a PNG monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (0)\");\n\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (mng_info->IsPalette)\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_PALETTE &&\n mng_info->write_png_depth &&\n mng_info->write_png_depth != old_bit_depth)\n {\n /* Undo pixel scaling */\n for (i=0; i < (ssize_t) image->columns; i++)\n *(ping_pixels+i)=(unsigned char) (*(ping_pixels+i)\n >> (8-old_bit_depth));\n }\n }\n\n else\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n }\n\n if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE)\n for (i=0; i < (ssize_t) image->columns; i++)\n *(ping_pixels+i)=(unsigned char) ((*(ping_pixels+i) > 127) ?\n 255 : 0);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (1)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n\n else /* Not Palette, Bilevel, or Opaque Monochrome */\n {\n if ((!mng_info->write_png8 && !mng_info->write_png24 &&\n !mng_info->write_png48 && !mng_info->write_png64 &&\n !mng_info->write_png32) && (image_matte != MagickFalse ||\n (ping_bit_depth >= MAGICKCORE_QUANTUM_DEPTH)) &&\n (mng_info->IsPalette) && ping_have_color == MagickFalse)\n {\n register const Quantum\n *p;\n\n for (pass=0; pass < num_passes; pass++)\n {\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (mng_info->IsPalette)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY PNG pixels (2)\");\n }\n\n else /* PNG_COLOR_TYPE_GRAY_ALPHA */\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (2)\");\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,exception);\n }\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (2)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n\n else\n {\n register const Quantum\n *p;\n\n for (pass=0; pass < num_passes; pass++)\n {\n if ((image_depth > 8) ||\n mng_info->write_png24 ||\n mng_info->write_png32 ||\n mng_info->write_png48 ||\n mng_info->write_png64 ||\n (!mng_info->write_png8 && !mng_info->IsPalette))\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (image->storage_class == DirectClass)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n }\n\n else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,\n exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (3)\");\n }\n\n else if (image_matte != MagickFalse)\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RGBAQuantum,ping_pixels,exception);\n\n else\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,RGBQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (3)\");\n\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n\n else\n /* not ((image_depth > 8) ||\n mng_info->write_png24 || mng_info->write_png32 ||\n mng_info->write_png48 || mng_info->write_png64 ||\n (!mng_info->write_png8 && !mng_info->IsPalette))\n */\n {\n if ((ping_color_type != PNG_COLOR_TYPE_GRAY) &&\n (ping_color_type != PNG_COLOR_TYPE_GRAY_ALPHA))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" pass %d, Image Is not GRAY or GRAY_ALPHA\",pass);\n\n SetQuantumDepth(image,quantum_info,8);\n image_depth=8;\n }\n\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" pass %d, Image Is RGB, 16-bit GRAY, or GRAY_ALPHA\",\n pass);\n\n p=GetVirtualPixels(image,0,y,image->columns,1, exception);\n\n if (p == (const Quantum *) NULL)\n break;\n\n if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n SetQuantumDepth(image,quantum_info,image->depth);\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,exception);\n }\n\n else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (4)\");\n\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,\n exception);\n }\n\n else\n {\n (void) ExportQuantumPixels(image,(CacheView *) NULL,\n quantum_info,IndexQuantum,ping_pixels,exception);\n\n if (logging != MagickFalse && y <= 2)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of non-gray pixels (4)\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_pixels[0]=%d,ping_pixels[1]=%d\",\n (int)ping_pixels[0],(int)ping_pixels[1]);\n }\n }\n png_write_row(ping,ping_pixels);\n\n status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n\n if (status == MagickFalse)\n break;\n }\n }\n }\n }\n }\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Wrote PNG image data\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Width: %.20g\",(double) ping_width);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Height: %.20g\",(double) ping_height);\n\n if (mng_info->write_png_depth)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:bit-depth: %d\",mng_info->write_png_depth);\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG bit-depth written: %d\",ping_bit_depth);\n\n if (mng_info->write_png_colortype)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:color-type: %d\",mng_info->write_png_colortype-1);\n }\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG color-type written: %d\",ping_color_type);\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG Interlace method: %d\",ping_interlace_method);\n }\n /*\n Generate text chunks after IDAT.\n */\n if (ping_exclude_tEXt == MagickFalse || ping_exclude_zTXt == MagickFalse)\n {\n ResetImagePropertyIterator(image);\n property=GetNextImageProperty(image);\n while (property != (const char *) NULL)\n {\n png_textp\n text;\n\n value=GetImageProperty(image,property,exception);\n\n /* Don't write any \"png:\" or \"jpeg:\" properties; those are just for\n * \"identify\" or for passing through to another JPEG\n */\n if ((LocaleNCompare(property,\"png:\",4) != 0 &&\n LocaleNCompare(property,\"jpeg:\",5) != 0) &&\n\n\n /* Suppress density and units if we wrote a pHYs chunk */\n (ping_exclude_pHYs != MagickFalse ||\n LocaleCompare(property,\"density\") != 0 ||\n LocaleCompare(property,\"units\") != 0) &&\n\n /* Suppress the IM-generated Date:create and Date:modify */\n (ping_exclude_date == MagickFalse ||\n LocaleNCompare(property, \"Date:\",5) != 0))\n {\n if (value != (const char *) NULL)\n {\n\n#if PNG_LIBPNG_VER >= 10400\n text=(png_textp) png_malloc(ping,\n (png_alloc_size_t) sizeof(png_text));\n#else\n text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text));\n#endif\n text[0].key=(char *) property;\n text[0].text=(char *) value;\n text[0].text_length=strlen(value);\n\n if (ping_exclude_tEXt != MagickFalse)\n text[0].compression=PNG_TEXT_COMPRESSION_zTXt;\n\n else if (ping_exclude_zTXt != MagickFalse)\n text[0].compression=PNG_TEXT_COMPRESSION_NONE;\n\n else\n {\n text[0].compression=image_info->compression == NoCompression ||\n (image_info->compression == UndefinedCompression &&\n text[0].text_length < 128) ? PNG_TEXT_COMPRESSION_NONE :\n PNG_TEXT_COMPRESSION_zTXt ;\n }\n\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up text chunk\");\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" keyword: '%s'\",text[0].key);\n }\n\n png_set_text(ping,ping_info,text,1);\n png_free(ping,text);\n }\n }\n property=GetNextImageProperty(image);\n }\n }\n\n /* write any PNG-chunk-e profiles */\n (void) Magick_png_write_chunk_from_profile(image,\"PNG-chunk-e\",logging);\n\n /* write exIf profile */\n if (ping_have_eXIf != MagickFalse && ping_exclude_eXIf == MagickFalse)\n {\n char\n *name;\n\n ResetImageProfileIterator(image);\n\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n if (LocaleCompare(name,\"exif\") == 0)\n {\n const StringInfo\n *profile;\n\n profile=GetImageProfile(image,name);\n\n if (profile != (StringInfo *) NULL)\n {\n png_uint_32\n length;\n\n unsigned char\n chunk[4],\n *data;\n\n StringInfo\n *ping_profile;\n\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Have eXIf profile\");\n\n ping_profile=CloneStringInfo(profile);\n data=GetStringInfoDatum(ping_profile),\n length=(png_uint_32) GetStringInfoLength(ping_profile);\n\n PNGType(chunk,mng_eXIf);\n if (length < 7)\n {\n ping_profile=DestroyStringInfo(ping_profile);\n break; /* otherwise crashes */\n }\n\n /* skip the \"Exif\\0\\0\" JFIF Exif Header ID */\n length -= 6;\n\n LogPNGChunk(logging,chunk,length);\n (void) WriteBlobMSBULong(image,length);\n (void) WriteBlob(image,4,chunk);\n (void) WriteBlob(image,length,data+6);\n (void) WriteBlobMSBULong(image,crc32(crc32(0,chunk,4),\n data+6, (uInt) length));\n ping_profile=DestroyStringInfo(ping_profile);\n break;\n }\n }\n name=GetNextImageProfile(image);\n }\n }\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG end info\");\n\n png_write_end(ping,ping_info);\n\n if (mng_info->need_fram && (int) image->dispose == BackgroundDispose)\n {\n if (mng_info->page.x || mng_info->page.y ||\n (ping_width != mng_info->page.width) ||\n (ping_height != mng_info->page.height))\n {\n unsigned char\n chunk[32];\n\n /*\n Write FRAM 4 with clipping boundaries followed by FRAM 1.\n */\n (void) WriteBlobMSBULong(image,27L); /* data length=27 */\n PNGType(chunk,mng_FRAM);\n LogPNGChunk(logging,mng_FRAM,27L);\n chunk[4]=4;\n chunk[5]=0; /* frame name separator (no name) */\n chunk[6]=1; /* flag for changing delay, for next frame only */\n chunk[7]=0; /* flag for changing frame timeout */\n chunk[8]=1; /* flag for changing frame clipping for next frame */\n chunk[9]=0; /* flag for changing frame sync_id */\n PNGLong(chunk+10,(png_uint_32) (0L)); /* temporary 0 delay */\n chunk[14]=0; /* clipping boundaries delta type */\n PNGLong(chunk+15,(png_uint_32) (mng_info->page.x)); /* left cb */\n PNGLong(chunk+19,\n (png_uint_32) (mng_info->page.x + ping_width));\n PNGLong(chunk+23,(png_uint_32) (mng_info->page.y)); /* top cb */\n PNGLong(chunk+27,\n (png_uint_32) (mng_info->page.y + ping_height));\n (void) WriteBlob(image,31,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,31));\n mng_info->old_framing_mode=4;\n mng_info->framing_mode=1;\n }\n\n else\n mng_info->framing_mode=3;\n }\n if (mng_info->write_mng && !mng_info->need_fram &&\n ((int) image->dispose == 3))\n png_error(ping, \"Cannot convert GIF with disposal method 3 to MNG-LC\");\n\n /*\n Free PNG resources.\n */\n\n png_destroy_write_struct(&ping,&ping_info);\n\n pixel_info=RelinquishVirtualMemory(pixel_info);\n\n if (ping_have_blob != MagickFalse)\n (void) CloseBlob(image);\n\n image_info=DestroyImageInfo(image_info);\n image=DestroyImage(image);\n\n /* Store bit depth actually written */\n s[0]=(char) ping_bit_depth;\n s[1]='\\0';\n\n (void) SetImageProperty(IMimage,\"png:bit-depth-written\",s,exception);\n\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" exit WriteOnePNGImage()\");\n\n#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n UnlockSemaphoreInfo(ping_semaphore);\n#endif\n\n /* } for navigation to beginning of SETJMP-protected block. Revert to\n * Throwing an Exception when an error occurs.\n */\n\n return(MagickTrue);\n/* End write one PNG image */\n\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"WriteOnePNGImage","file_name":"coders/png.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/816ecab6c532ae086ff4186b3eaf4aa7092d536f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#47-1bf6e0cbc1c9","input":"static MagickBooleanType ReadPSDChannel(Image *image,\n const ImageInfo *image_info,const PSDInfo *psd_info,LayerInfo* layer_info,\n const size_t channel,const PSDCompressionType compression,\n ExceptionInfo *exception)\n{\n Image\n *channel_image,\n *mask;\n\n MagickOffsetType\n offset;\n\n MagickBooleanType\n status;\n\n channel_image=image;\n mask=(Image *) NULL;\n if (layer_info->channel_info[channel].type < -1)\n {\n const char\n *option;\n /*\n Ignore mask that is not a user supplied layer mask, if the mask is\n disabled or if the flags have unsupported values.\n */\n option=GetImageOption(image_info,\"psd:preserve-opacity-mask\");\n if ((layer_info->channel_info[channel].type != -2) ||\n (layer_info->mask.flags > 2) || ((layer_info->mask.flags & 0x02) &&\n (IsStringTrue(option) == MagickFalse)))\n {\n SeekBlob(image,layer_info->channel_info[channel].size-2,SEEK_CUR);\n return(MagickTrue);\n }\n mask=CloneImage(image,layer_info->mask.page.width,\n layer_info->mask.page.height,MagickFalse,exception);\n mask->matte=MagickFalse;\n channel_image=mask;\n }\n\n offset=TellBlob(image);\n status=MagickTrue;\n switch(compression)\n {\n case Raw:\n status=ReadPSDChannelRaw(channel_image,psd_info->channels,\n layer_info->channel_info[channel].type,exception);\n break;\n case RLE:\n {\n MagickOffsetType\n *sizes;\n\n sizes=ReadPSDRLESizes(channel_image,psd_info,channel_image->rows);\n if (sizes == (MagickOffsetType *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n status=ReadPSDChannelRLE(channel_image,psd_info,\n layer_info->channel_info[channel].type,sizes,exception);\n sizes=(MagickOffsetType *) RelinquishMagickMemory(sizes);\n }\n break;\n case ZipWithPrediction:\n case ZipWithoutPrediction:\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n status=ReadPSDChannelZip(channel_image,layer_info->channels,\n layer_info->channel_info[channel].type,compression,\n layer_info->channel_info[channel].size-2,exception);\n#else\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateWarning,\"DelegateLibrarySupportNotBuiltIn\",\n \"'%s' (ZLIB)\",image->filename);\n#endif\n break;\n default:\n (void) ThrowMagickException(exception,GetMagickModule(),TypeWarning,\n \"CompressionNotSupported\",\"'%.20g'\",(double) compression);\n break;\n }\n\n SeekBlob(image,offset+layer_info->channel_info[channel].size-2,SEEK_SET);\n if (status == MagickFalse)\n {\n if (mask != (Image *) NULL)\n DestroyImage(mask);\n ThrowBinaryException(CoderError,\"UnableToDecompressImage\",\n image->filename);\n }\n layer_info->mask.image=mask;\n return(status);\n}","target":"static MagickBooleanType ReadPSDChannel(Image *image,\n const ImageInfo *image_info,const PSDInfo *psd_info,LayerInfo* layer_info,\n const size_t channel,const PSDCompressionType compression,\n ExceptionInfo *exception)\n{\n Image\n *channel_image,\n *mask;\n\n MagickOffsetType\n offset;\n\n MagickBooleanType\n status;\n\n channel_image=image;\n mask=(Image *) NULL;\n if (layer_info->channel_info[channel].type < -1)\n {\n const char\n *option;\n /*\n Ignore mask that is not a user supplied layer mask, if the mask is\n disabled or if the flags have unsupported values.\n */\n option=GetImageOption(image_info,\"psd:preserve-opacity-mask\");\n if ((layer_info->channel_info[channel].type != -2) ||\n (layer_info->mask.flags > 2) || ((layer_info->mask.flags & 0x02) &&\n (IsStringTrue(option) == MagickFalse)))\n {\n SeekBlob(image,layer_info->channel_info[channel].size-2,SEEK_CUR);\n return(MagickTrue);\n }\n mask=CloneImage(image,layer_info->mask.page.width,\n layer_info->mask.page.height,MagickFalse,exception);\n if (mask != (Image *) NULL)\n {\n mask->matte=MagickFalse;\n channel_image=mask;\n }\n }\n\n offset=TellBlob(image);\n status=MagickTrue;\n switch(compression)\n {\n case Raw:\n status=ReadPSDChannelRaw(channel_image,psd_info->channels,\n layer_info->channel_info[channel].type,exception);\n break;\n case RLE:\n {\n MagickOffsetType\n *sizes;\n\n sizes=ReadPSDRLESizes(channel_image,psd_info,channel_image->rows);\n if (sizes == (MagickOffsetType *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n status=ReadPSDChannelRLE(channel_image,psd_info,\n layer_info->channel_info[channel].type,sizes,exception);\n sizes=(MagickOffsetType *) RelinquishMagickMemory(sizes);\n }\n break;\n case ZipWithPrediction:\n case ZipWithoutPrediction:\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n status=ReadPSDChannelZip(channel_image,layer_info->channels,\n layer_info->channel_info[channel].type,compression,\n layer_info->channel_info[channel].size-2,exception);\n#else\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateWarning,\"DelegateLibrarySupportNotBuiltIn\",\n \"'%s' (ZLIB)\",image->filename);\n#endif\n break;\n default:\n (void) ThrowMagickException(exception,GetMagickModule(),TypeWarning,\n \"CompressionNotSupported\",\"'%.20g'\",(double) compression);\n break;\n }\n\n SeekBlob(image,offset+layer_info->channel_info[channel].size-2,SEEK_SET);\n if (status == MagickFalse)\n {\n if (mask != (Image *) NULL)\n DestroyImage(mask);\n ThrowBinaryException(CoderError,\"UnableToDecompressImage\",\n image->filename);\n }\n layer_info->mask.image=mask;\n return(status);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"ReadPSDChannel","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/7f2dc7a1afc067d0c89f12c82bcdec0445fb1b94","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#48-61c457b51706","input":"long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)\n{\n\tstruct key *key;\n\tkey_ref_t key_ref;\n\tlong ret;\n\n\t/* find the key first */\n\tkey_ref = lookup_user_key(keyid, 0, 0);\n\tif (IS_ERR(key_ref)) {\n\t\tret = -ENOKEY;\n\t\tgoto error;\n\t}\n\n\tkey = key_ref_to_ptr(key_ref);\n\n\t/* see if we can read it directly */\n\tret = key_permission(key_ref, KEY_NEED_READ);\n\tif (ret == 0)\n\t\tgoto can_read_key;\n\tif (ret != -EACCES)\n\t\tgoto error2;\n\n\t/* we can't; see if it's searchable from this process's keyrings\n\t * - we automatically take account of the fact that it may be\n\t * dangling off an instantiation key\n\t */\n\tif (!is_key_possessed(key_ref)) {\n\t\tret = -EACCES;\n\t\tgoto error2;\n\t}\n\n\t/* the key is probably readable - now try to read it */\ncan_read_key:\n\tret = -EOPNOTSUPP;\n\tif (key->type->read) {\n\t\t/* Read the data with the semaphore held (since we might sleep)\n\t\t * to protect against the key being updated or revoked.\n\t\t */\n\t\tdown_read(&key->sem);\n\t\tret = key_validate(key);\n\t\tif (ret == 0)\n\t\t\tret = key->type->read(key, buffer, buflen);\n\t\tup_read(&key->sem);\n\t}\n\nerror2:\n\tkey_put(key);\nerror:\n\treturn ret;\n}","target":"long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)\n{\n\tstruct key *key;\n\tkey_ref_t key_ref;\n\tlong ret;\n\n\t/* find the key first */\n\tkey_ref = lookup_user_key(keyid, 0, 0);\n\tif (IS_ERR(key_ref)) {\n\t\tret = -ENOKEY;\n\t\tgoto error;\n\t}\n\n\tkey = key_ref_to_ptr(key_ref);\n\n\tif (test_bit(KEY_FLAG_NEGATIVE, &key->flags)) {\n\t\tret = -ENOKEY;\n\t\tgoto error2;\n\t}\n\n\t/* see if we can read it directly */\n\tret = key_permission(key_ref, KEY_NEED_READ);\n\tif (ret == 0)\n\t\tgoto can_read_key;\n\tif (ret != -EACCES)\n\t\tgoto error2;\n\n\t/* we can't; see if it's searchable from this process's keyrings\n\t * - we automatically take account of the fact that it may be\n\t * dangling off an instantiation key\n\t */\n\tif (!is_key_possessed(key_ref)) {\n\t\tret = -EACCES;\n\t\tgoto error2;\n\t}\n\n\t/* the key is probably readable - now try to read it */\ncan_read_key:\n\tret = -EOPNOTSUPP;\n\tif (key->type->read) {\n\t\t/* Read the data with the semaphore held (since we might sleep)\n\t\t * to protect against the key being updated or revoked.\n\t\t */\n\t\tdown_read(&key->sem);\n\t\tret = key_validate(key);\n\t\tif (ret == 0)\n\t\t\tret = key->type->read(key, buffer, buflen);\n\t\tup_read(&key->sem);\n\t}\n\nerror2:\n\tkey_put(key);\nerror:\n\treturn ret;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"keyctl_read_key","file_name":"security/keys/keyctl.c","commit_link":"github.com/torvalds/linux/commit/37863c43b2c6464f252862bf2e9768264e961678","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#49-d65a5d8c68df","input":"ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr,\n const char **elem_rtrn, const char **field_rtrn,\n ExprDef **index_rtrn)\n{\n switch (expr->expr.op) {\n case EXPR_IDENT:\n *elem_rtrn = NULL;\n *field_rtrn = xkb_atom_text(ctx, expr->ident.ident);\n *index_rtrn = NULL;\n return (*field_rtrn != NULL);\n case EXPR_FIELD_REF:\n *elem_rtrn = xkb_atom_text(ctx, expr->field_ref.element);\n *field_rtrn = xkb_atom_text(ctx, expr->field_ref.field);\n *index_rtrn = NULL;\n return true;\n case EXPR_ARRAY_REF:\n *elem_rtrn = xkb_atom_text(ctx, expr->array_ref.element);\n *field_rtrn = xkb_atom_text(ctx, expr->array_ref.field);\n *index_rtrn = expr->array_ref.entry;\n return true;\n default:\n break;\n }\n log_wsgo(ctx, \"Unexpected operator %d in ResolveLhs\\n\", expr->expr.op);\n return false;\n}","target":"ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr,\n const char **elem_rtrn, const char **field_rtrn,\n ExprDef **index_rtrn)\n{\n switch (expr->expr.op) {\n case EXPR_IDENT:\n *elem_rtrn = NULL;\n *field_rtrn = xkb_atom_text(ctx, expr->ident.ident);\n *index_rtrn = NULL;\n return (*field_rtrn != NULL);\n case EXPR_FIELD_REF:\n *elem_rtrn = xkb_atom_text(ctx, expr->field_ref.element);\n *field_rtrn = xkb_atom_text(ctx, expr->field_ref.field);\n *index_rtrn = NULL;\n return (*elem_rtrn != NULL && *field_rtrn != NULL);\n case EXPR_ARRAY_REF:\n *elem_rtrn = xkb_atom_text(ctx, expr->array_ref.element);\n *field_rtrn = xkb_atom_text(ctx, expr->array_ref.field);\n *index_rtrn = expr->array_ref.entry;\n\tif (expr->array_ref.element != XKB_ATOM_NONE && *elem_rtrn == NULL)\n\t\treturn false;\n\tif (*field_rtrn == NULL)\n\t\treturn false;\n return true;\n default:\n break;\n }\n log_wsgo(ctx, \"Unexpected operator %d in ResolveLhs\\n\", expr->expr.op);\n return false;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"ExprResolveLhs","file_name":"src/xkbcomp/expr.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/bb4909d2d8fa6b08155e449986a478101e2b2634","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#50-ff4ae20c385d","input":"tar_directory_for_file (GsfInfileTar *dir, const char *name, gboolean last)\n{\n\tconst char *s = name;\n\n\twhile (1) {\n\t\tconst char *s0 = s;\n\t\tchar *dirname;\n\n\t\t/* Find a directory component, if any. */\n\t\twhile (1) {\n\t\t\tif (*s == 0) {\n\t\t\t\tif (last && s != s0)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\treturn dir;\n\t\t\t}\n\t\t\t/* This is deliberately slash-only. */\n\t\t\tif (*s == '/')\n\t\t\t\tbreak;\n\t\t\ts++;\n\t\t}\n\n\t\tdirname = g_strndup (s0, s - s0);\n\t\twhile (*s == '/')\n\t\t\ts++;\n\n\t\tif (strcmp (dirname, \".\") != 0) {\n\t\t\tGsfInput *subdir =\n\t\t\t\tgsf_infile_child_by_name (GSF_INFILE (dir),\n\t\t\t\t\t\t\t dirname);\n\t\t\tif (subdir) {\n\t\t\t\t/* Undo the ref. */\n\t\t\t\tg_object_unref (subdir);\n\t\t\t\tdir = GSF_INFILE_TAR (subdir);\n\t\t\t} else\n\t\t\t\tdir = tar_create_dir (dir, dirname);\n\t\t}\n\n\t\tg_free (dirname);\n\t}\n}","target":"tar_directory_for_file (GsfInfileTar *dir, const char *name, gboolean last)\n{\n\tconst char *s = name;\n\n\twhile (1) {\n\t\tconst char *s0 = s;\n\t\tchar *dirname;\n\n\t\t/* Find a directory component, if any. */\n\t\twhile (1) {\n\t\t\tif (*s == 0) {\n\t\t\t\tif (last && s != s0)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\treturn dir;\n\t\t\t}\n\t\t\t/* This is deliberately slash-only. */\n\t\t\tif (*s == '/')\n\t\t\t\tbreak;\n\t\t\ts++;\n\t\t}\n\n\t\tdirname = g_strndup (s0, s - s0);\n\t\twhile (*s == '/')\n\t\t\ts++;\n\n\t\tif (strcmp (dirname, \".\") != 0) {\n\t\t\tGsfInput *subdir =\n\t\t\t\tgsf_infile_child_by_name (GSF_INFILE (dir),\n\t\t\t\t\t\t\t dirname);\n\t\t\tif (subdir) {\n\t\t\t\tdir = GSF_IS_INFILE_TAR (subdir)\n\t\t\t\t\t? GSF_INFILE_TAR (subdir)\n\t\t\t\t\t: dir;\n\t\t\t\t/* Undo the ref. */\n\t\t\t\tg_object_unref (subdir);\n\t\t\t} else\n\t\t\t\tdir = tar_create_dir (dir, dirname);\n\t\t}\n\n\t\tg_free (dirname);\n\t}\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"tar_directory_for_file","file_name":"gsf/gsf-infile-tar.c","commit_link":"github.com/GNOME/libgsf/commit/95a8351a75758cf10b3bf6abae0b6b461f90d9e5","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#51-8c713e0b41bd","input":"static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm)\n{\n\tstruct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm);\n\tstruct skcipher_alg *alg = crypto_skcipher_alg(skcipher);\n\n\tif (tfm->__crt_alg->cra_type == &crypto_blkcipher_type)\n\t\treturn crypto_init_skcipher_ops_blkcipher(tfm);\n\n\tif (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type ||\n\t tfm->__crt_alg->cra_type == &crypto_givcipher_type)\n\t\treturn crypto_init_skcipher_ops_ablkcipher(tfm);\n\n\tskcipher->setkey = alg->setkey;\n\tskcipher->encrypt = alg->encrypt;\n\tskcipher->decrypt = alg->decrypt;\n\tskcipher->ivsize = alg->ivsize;\n\tskcipher->keysize = alg->max_keysize;\n\n\tif (alg->exit)\n\t\tskcipher->base.exit = crypto_skcipher_exit_tfm;\n\n\tif (alg->init)\n\t\treturn alg->init(skcipher);\n\n\treturn 0;\n}","target":"static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm)\n{\n\tstruct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm);\n\tstruct skcipher_alg *alg = crypto_skcipher_alg(skcipher);\n\n\tif (tfm->__crt_alg->cra_type == &crypto_blkcipher_type)\n\t\treturn crypto_init_skcipher_ops_blkcipher(tfm);\n\n\tif (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type ||\n\t tfm->__crt_alg->cra_type == &crypto_givcipher_type)\n\t\treturn crypto_init_skcipher_ops_ablkcipher(tfm);\n\n\tskcipher->setkey = skcipher_setkey;\n\tskcipher->encrypt = alg->encrypt;\n\tskcipher->decrypt = alg->decrypt;\n\tskcipher->ivsize = alg->ivsize;\n\tskcipher->keysize = alg->max_keysize;\n\n\tif (alg->exit)\n\t\tskcipher->base.exit = crypto_skcipher_exit_tfm;\n\n\tif (alg->init)\n\t\treturn alg->init(skcipher);\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"crypto_skcipher_init_tfm","file_name":"crypto/skcipher.c","commit_link":"github.com/torvalds/linux/commit/9933e113c2e87a9f46a40fde8dafbf801dca1ab9","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#52-c11e40dd75e7","input":"static int __init fm10k_init_module(void)\n{\n\tpr_info(\"%s - version %s\\n\", fm10k_driver_string, fm10k_driver_version);\n\tpr_info(\"%s\\n\", fm10k_copyright);\n\n\t/* create driver workqueue */\n\tfm10k_workqueue = alloc_workqueue(\"%s\", WQ_MEM_RECLAIM, 0,\n\t\t\t\t\t fm10k_driver_name);\n\n\tfm10k_dbg_init();\n\n\treturn fm10k_register_pci_driver();\n}","target":"static int __init fm10k_init_module(void)\n{\n\tpr_info(\"%s - version %s\\n\", fm10k_driver_string, fm10k_driver_version);\n\tpr_info(\"%s\\n\", fm10k_copyright);\n\n\t/* create driver workqueue */\n\tfm10k_workqueue = alloc_workqueue(\"%s\", WQ_MEM_RECLAIM, 0,\n\t\t\t\t\t fm10k_driver_name);\n\tif (!fm10k_workqueue)\n\t\treturn -ENOMEM;\n\n\tfm10k_dbg_init();\n\n\treturn fm10k_register_pci_driver();\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"fm10k_init_module","file_name":"drivers/net/ethernet/intel/fm10k/fm10k_main.c","commit_link":"github.com/torvalds/linux/commit/01ca667133d019edc9f0a1f70a272447c84ec41f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#53-47c4612a587b","input":"static void parse_class(RBinFile *binfile, RBinDexObj *bin, RBinDexClass *c,\n\t\t\t int class_index, int *methods, int *sym_count) {\n\tstruct r_bin_t *rbin = binfile->rbin;\n\n\tchar *class_name;\n\tint z;\n\tconst ut8 *p, *p_end;\n\n\tif (!c) {\n\t\treturn;\n\t}\n\n\tclass_name = dex_class_name (bin, c);\n\tclass_name = r_str_replace (class_name, \";\", \"\", 0); //TODO: move to func\n\n\tif (!class_name || !*class_name) {\n\t\treturn;\n\t}\n\n\tRBinClass *cls = R_NEW0 (RBinClass);\n\tif (!cls) {\n\t\treturn;\n\t}\n\tcls->name = class_name;\n\tcls->index = class_index;\n\tcls->addr = bin->header.class_offset + class_index * DEX_CLASS_SIZE;\n\tcls->methods = r_list_new ();\n\tif (!cls->methods) {\n\t\tfree (cls);\n\t\treturn;\n\t}\n\tcls->fields = r_list_new ();\n\tif (!cls->fields) {\n\t\tr_list_free (cls->methods);\n\t\tfree (cls);\n\t\treturn;\n\t}\n\tr_list_append (bin->classes_list, cls);\n\tif (dexdump) {\n\t\trbin->cb_printf (\" Class descriptor : '%s;'\\n\", class_name);\n\t\trbin->cb_printf (\n\t\t\t\" Access flags : 0x%04x (%s)\\n\", c->access_flags,\n\t\t\tcreateAccessFlagStr (c->access_flags, kAccessForClass));\n\t\trbin->cb_printf (\" Superclass : '%s'\\n\",\n\t\t\t\t dex_class_super_name (bin, c));\n\t\trbin->cb_printf (\" Interfaces -\\n\");\n\t}\n\n\tif (c->interfaces_offset > 0 &&\n\t bin->header.data_offset < c->interfaces_offset &&\n\t c->interfaces_offset <\n\t\t bin->header.data_offset + bin->header.data_size) {\n\t\tp = r_buf_get_at (binfile->buf, c->interfaces_offset, NULL);\n\t\tint types_list_size = r_read_le32(p);\n\t\tif (types_list_size < 0 || types_list_size >= bin->header.types_size ) {\n\t\t\treturn;\n\t\t}\n\t\tfor (z = 0; z < types_list_size; z++) {\n\t\t\tint t = r_read_le16 (p + 4 + z * 2);\n\t\t\tif (t > 0 && t < bin->header.types_size ) {\n\t\t\t\tint tid = bin->types[t].descriptor_id;\n\t\t\t\tif (dexdump) {\n\t\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\t\" #%d : '%s'\\n\",\n\t\t\t\t\t\tz, getstr (bin, tid));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: this is quite ugly\n\tif (!c || !c->class_data_offset) {\n\t\tif (dexdump) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" Static fields -\\n Instance fields \"\n\t\t\t\t\"-\\n Direct methods -\\n Virtual methods \"\n\t\t\t\t\"-\\n\");\n\t\t}\n\t} else {\n\t\t// TODO: move to func, def or inline\n\t\t// class_data_offset => [class_offset, class_defs_off+class_defs_size*32]\n\t\tif (bin->header.class_offset > c->class_data_offset ||\n\t\t c->class_data_offset <\n\t\t\t bin->header.class_offset +\n\t\t\t\t bin->header.class_size * DEX_CLASS_SIZE) {\n\t\t\treturn;\n\t\t}\n\n\t\tp = r_buf_get_at (binfile->buf, c->class_data_offset, NULL);\n\t\tp_end = p + binfile->buf->length - c->class_data_offset;\n\t\t//XXX check for NULL!!\n\t\tc->class_data = (struct dex_class_data_item_t *)malloc (\n\t\t\tsizeof (struct dex_class_data_item_t));\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->static_fields_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->instance_fields_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->direct_methods_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->virtual_methods_size);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Static fields -\\n\"); \n\t\t}\n\t\tp = parse_dex_class_fields (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->static_fields_size, true);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Instance fields -\\n\");\n\t\t}\n\t\tp = parse_dex_class_fields (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->instance_fields_size, false);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Direct methods -\\n\");\n\t\t}\n\t\tp = parse_dex_class_method (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->direct_methods_size, methods, true);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Virtual methods -\\n\");\n\t\t}\n\t\tp = parse_dex_class_method (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->virtual_methods_size, methods, false);\n\t}\n\n\tif (dexdump) { \n\t\tchar *source_file = getstr (bin, c->source_file);\n\t\tif (!source_file) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" source_file_idx : %d (unknown)\\n\\n\",\n\t\t\t\tc->source_file);\n\t\t} else {\n\t\t\trbin->cb_printf (\" source_file_idx : %d (%s)\\n\\n\",\n\t\t\t\t\t c->source_file, source_file);\n\t\t}\n\t}\n\t// TODO:!!!!\n\t// FIX: FREE BEFORE ALLOCATE!!!\n\t//free (class_name);\n}","target":"static void parse_class(RBinFile *binfile, RBinDexObj *bin, RBinDexClass *c,\n\t\t\t int class_index, int *methods, int *sym_count) {\n\tstruct r_bin_t *rbin = binfile->rbin;\n\n\tchar *class_name;\n\tint z;\n\tconst ut8 *p, *p_end;\n\n\tif (!c) {\n\t\treturn;\n\t}\n\n\tclass_name = dex_class_name (bin, c);\n\tclass_name = r_str_replace (class_name, \";\", \"\", 0); //TODO: move to func\n\n\tif (!class_name || !*class_name) {\n\t\treturn;\n\t}\n\n\tRBinClass *cls = R_NEW0 (RBinClass);\n\tif (!cls) {\n\t\treturn;\n\t}\n\tcls->name = class_name;\n\tcls->index = class_index;\n\tcls->addr = bin->header.class_offset + class_index * DEX_CLASS_SIZE;\n\tcls->methods = r_list_new ();\n\tif (!cls->methods) {\n\t\tfree (cls);\n\t\treturn;\n\t}\n\tcls->fields = r_list_new ();\n\tif (!cls->fields) {\n\t\tr_list_free (cls->methods);\n\t\tfree (cls);\n\t\treturn;\n\t}\n\tr_list_append (bin->classes_list, cls);\n\tif (dexdump) {\n\t\trbin->cb_printf (\" Class descriptor : '%s;'\\n\", class_name);\n\t\trbin->cb_printf (\n\t\t\t\" Access flags : 0x%04x (%s)\\n\", c->access_flags,\n\t\t\tcreateAccessFlagStr (c->access_flags, kAccessForClass));\n\t\trbin->cb_printf (\" Superclass : '%s'\\n\",\n\t\t\t\t dex_class_super_name (bin, c));\n\t\trbin->cb_printf (\" Interfaces -\\n\");\n\t}\n\n\tif (c->interfaces_offset > 0 &&\n\t bin->header.data_offset < c->interfaces_offset &&\n\t c->interfaces_offset <\n\t\t bin->header.data_offset + bin->header.data_size) {\n\t\tp = r_buf_get_at (binfile->buf, c->interfaces_offset, NULL);\n\t\tint types_list_size = r_read_le32 (p);\n\t\tif (types_list_size < 0 || types_list_size >= bin->header.types_size ) {\n\t\t\treturn;\n\t\t}\n\t\tfor (z = 0; z < types_list_size; z++) {\n\t\t\tint t = r_read_le16 (p + 4 + z * 2);\n\t\t\tif (t > 0 && t < bin->header.types_size ) {\n\t\t\t\tint tid = bin->types[t].descriptor_id;\n\t\t\t\tif (dexdump) {\n\t\t\t\t\trbin->cb_printf (\n\t\t\t\t\t\t\" #%d : '%s'\\n\",\n\t\t\t\t\t\tz, getstr (bin, tid));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// TODO: this is quite ugly\n\tif (!c || !c->class_data_offset) {\n\t\tif (dexdump) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" Static fields -\\n Instance fields \"\n\t\t\t\t\"-\\n Direct methods -\\n Virtual methods \"\n\t\t\t\t\"-\\n\");\n\t\t}\n\t} else {\n\t\t// TODO: move to func, def or inline\n\t\t// class_data_offset => [class_offset, class_defs_off+class_defs_size*32]\n\t\tif (bin->header.class_offset > c->class_data_offset ||\n\t\t c->class_data_offset <\n\t\t\t bin->header.class_offset +\n\t\t\t\t bin->header.class_size * DEX_CLASS_SIZE) {\n\t\t\treturn;\n\t\t}\n\n\t\tp = r_buf_get_at (binfile->buf, c->class_data_offset, NULL);\n\t\tp_end = p + binfile->buf->length - c->class_data_offset;\n\t\t//XXX check for NULL!!\n\t\tc->class_data = (struct dex_class_data_item_t *)malloc (\n\t\t\tsizeof (struct dex_class_data_item_t));\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->static_fields_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->instance_fields_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->direct_methods_size);\n\t\tp = r_uleb128 (p, p_end - p, &c->class_data->virtual_methods_size);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Static fields -\\n\"); \n\t\t}\n\t\tp = parse_dex_class_fields (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->static_fields_size, true);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Instance fields -\\n\");\n\t\t}\n\t\tp = parse_dex_class_fields (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->instance_fields_size, false);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Direct methods -\\n\");\n\t\t}\n\t\tp = parse_dex_class_method (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->direct_methods_size, methods, true);\n\n\t\tif (dexdump) { \n\t\t\trbin->cb_printf (\" Virtual methods -\\n\");\n\t\t}\n\t\tp = parse_dex_class_method (\n\t\t\tbinfile, bin, c, cls, p, p_end, sym_count,\n\t\t\tc->class_data->virtual_methods_size, methods, false);\n\t}\n\n\tif (dexdump) { \n\t\tchar *source_file = getstr (bin, c->source_file);\n\t\tif (!source_file) {\n\t\t\trbin->cb_printf (\n\t\t\t\t\" source_file_idx : %d (unknown)\\n\\n\",\n\t\t\t\tc->source_file);\n\t\t} else {\n\t\t\trbin->cb_printf (\" source_file_idx : %d (%s)\\n\\n\",\n\t\t\t\t\t c->source_file, source_file);\n\t\t}\n\t}\n\t// TODO:!!!!\n\t// FIX: FREE BEFORE ALLOCATE!!!\n\t//free (class_name);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"parse_class","file_name":"libr/bin/p/bin_dex.c","commit_link":"github.com/radare/radare2/commit/1ea23bd6040441a21fbcfba69dce9a01af03f989","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#54-5706f1417726","input":"lexer_process_char_literal (parser_context_t *context_p, /**< context */\n const uint8_t *char_p, /**< characters */\n size_t length, /**< length of string */\n uint8_t literal_type, /**< final literal type */\n bool has_escape) /**< has escape sequences */\n{\n parser_list_iterator_t literal_iterator;\n lexer_literal_t *literal_p;\n uint32_t literal_index = 0;\n\n JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL\n || literal_type == LEXER_STRING_LITERAL);\n\n JERRY_ASSERT (literal_type != LEXER_IDENT_LITERAL || length <= PARSER_MAXIMUM_IDENT_LENGTH);\n JERRY_ASSERT (literal_type != LEXER_STRING_LITERAL || length <= PARSER_MAXIMUM_STRING_LENGTH);\n\n parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n {\n if (literal_p->type == literal_type\n && literal_p->prop.length == length\n && memcmp (literal_p->u.char_p, char_p, length) == 0)\n {\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n literal_p->status_flags = (uint8_t) (literal_p->status_flags & ~LEXER_FLAG_UNUSED_IDENT);\n return;\n }\n\n literal_index++;\n }\n\n JERRY_ASSERT (literal_index == context_p->literal_count);\n\n if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n {\n parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n }\n\n literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n literal_p->prop.length = (uint16_t) length;\n literal_p->type = literal_type;\n literal_p->status_flags = has_escape ? 0 : LEXER_FLAG_SOURCE_PTR;\n\n if (has_escape)\n {\n literal_p->u.char_p = (uint8_t *) jmem_heap_alloc_block (length);\n memcpy ((uint8_t *) literal_p->u.char_p, char_p, length);\n }\n else\n {\n literal_p->u.char_p = char_p;\n }\n\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n context_p->literal_count++;\n} /* lexer_process_char_literal */","target":"lexer_process_char_literal (parser_context_t *context_p, /**< context */\n const uint8_t *char_p, /**< characters */\n size_t length, /**< length of string */\n uint8_t literal_type, /**< final literal type */\n bool has_escape) /**< has escape sequences */\n{\n parser_list_iterator_t literal_iterator;\n lexer_literal_t *literal_p;\n uint32_t literal_index = 0;\n\n JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL\n || literal_type == LEXER_STRING_LITERAL);\n\n JERRY_ASSERT (literal_type != LEXER_IDENT_LITERAL || length <= PARSER_MAXIMUM_IDENT_LENGTH);\n JERRY_ASSERT (literal_type != LEXER_STRING_LITERAL || length <= PARSER_MAXIMUM_STRING_LENGTH);\n\n parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n {\n if (literal_p->type == literal_type\n && literal_p->prop.length == length\n && memcmp (literal_p->u.char_p, char_p, length) == 0)\n {\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n literal_p->status_flags = (uint8_t) (literal_p->status_flags & ~LEXER_FLAG_UNUSED_IDENT);\n return;\n }\n\n literal_index++;\n }\n\n JERRY_ASSERT (literal_index == context_p->literal_count);\n\n if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n {\n parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n }\n\n if (length == 0)\n {\n has_escape = false;\n }\n\n literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n literal_p->prop.length = (uint16_t) length;\n literal_p->type = literal_type;\n literal_p->status_flags = has_escape ? 0 : LEXER_FLAG_SOURCE_PTR;\n\n if (has_escape)\n {\n literal_p->u.char_p = (uint8_t *) jmem_heap_alloc_block (length);\n memcpy ((uint8_t *) literal_p->u.char_p, char_p, length);\n }\n else\n {\n literal_p->u.char_p = char_p;\n }\n\n context_p->lit_object.literal_p = literal_p;\n context_p->lit_object.index = (uint16_t) literal_index;\n context_p->literal_count++;\n} /* lexer_process_char_literal */","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"lexer_process_char_literal","file_name":"jerry-core/parser/js/js-lexer.c","commit_link":"github.com/jerryscript-project/jerryscript/commit/e58f2880df608652aff7fd35c45b242467ec0e79","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#55-c989cc3f8c86","input":"mrb_obj_clone(mrb_state *mrb, mrb_value self)\n{\n struct RObject *p;\n mrb_value clone;\n\n if (mrb_immediate_p(self)) {\n mrb_raisef(mrb, E_TYPE_ERROR, \"can't clone %S\", self);\n }\n if (mrb_type(self) == MRB_TT_SCLASS) {\n mrb_raise(mrb, E_TYPE_ERROR, \"can't clone singleton class\");\n }\n p = (struct RObject*)mrb_obj_alloc(mrb, mrb_type(self), mrb_obj_class(mrb, self));\n p->c = mrb_singleton_class_clone(mrb, self);\n mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)p->c);\n clone = mrb_obj_value(p);\n init_copy(mrb, clone, self);\n p->flags = mrb_obj_ptr(self)->flags;\n\n return clone;\n}","target":"mrb_obj_clone(mrb_state *mrb, mrb_value self)\n{\n struct RObject *p;\n mrb_value clone;\n\n if (mrb_immediate_p(self)) {\n mrb_raisef(mrb, E_TYPE_ERROR, \"can't clone %S\", self);\n }\n if (mrb_type(self) == MRB_TT_SCLASS) {\n mrb_raise(mrb, E_TYPE_ERROR, \"can't clone singleton class\");\n }\n p = (struct RObject*)mrb_obj_alloc(mrb, mrb_type(self), mrb_obj_class(mrb, self));\n p->c = mrb_singleton_class_clone(mrb, self);\n mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)p->c);\n clone = mrb_obj_value(p);\n init_copy(mrb, clone, self);\n p->flags |= mrb_obj_ptr(self)->flags & MRB_FLAG_IS_FROZEN;\n\n return clone;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"mrb_obj_clone","file_name":"src/kernel.c","commit_link":"github.com/mruby/mruby/commit/55edae0226409de25e59922807cb09acb45731a2","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#56-0bd5324e7689","input":"static int __init big_key_init(void)\n{\n\treturn register_key_type(&key_type_big_key);\n}","target":"static int __init big_key_init(void)\n{\n\tstruct crypto_skcipher *cipher;\n\tstruct crypto_rng *rng;\n\tint ret;\n\n\trng = crypto_alloc_rng(big_key_rng_name, 0, 0);\n\tif (IS_ERR(rng)) {\n\t\tpr_err(\"Can't alloc rng: %ld\\n\", PTR_ERR(rng));\n\t\treturn PTR_ERR(rng);\n\t}\n\n\tbig_key_rng = rng;\n\n\t/* seed RNG */\n\tret = crypto_rng_reset(rng, NULL, crypto_rng_seedsize(rng));\n\tif (ret) {\n\t\tpr_err(\"Can't reset rng: %d\\n\", ret);\n\t\tgoto error_rng;\n\t}\n\n\t/* init block cipher */\n\tcipher = crypto_alloc_skcipher(big_key_alg_name, 0, CRYPTO_ALG_ASYNC);\n\tif (IS_ERR(cipher)) {\n\t\tret = PTR_ERR(cipher);\n\t\tpr_err(\"Can't alloc crypto: %d\\n\", ret);\n\t\tgoto error_rng;\n\t}\n\n\tbig_key_skcipher = cipher;\n\n\tret = register_key_type(&key_type_big_key);\n\tif (ret < 0) {\n\t\tpr_err(\"Can't register type: %d\\n\", ret);\n\t\tgoto error_cipher;\n\t}\n\n\treturn 0;\n\nerror_cipher:\n\tcrypto_free_skcipher(big_key_skcipher);\nerror_rng:\n\tcrypto_free_rng(big_key_rng);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"big_key_init","file_name":"security/keys/big_key.c","commit_link":"github.com/torvalds/linux/commit/7df3e59c3d1df4f87fe874c7956ef7a3d2f4d5fb","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#57-a893d6045904","input":"static int flattenSubquery(\n Parse *pParse, /* Parsing context */\n Select *p, /* The parent or outer SELECT statement */\n int iFrom, /* Index in p->pSrc->a[] of the inner subquery */\n int isAgg /* True if outer SELECT uses aggregate functions */\n){\n const char *zSavedAuthContext = pParse->zAuthContext;\n Select *pParent; /* Current UNION ALL term of the other query */\n Select *pSub; /* The inner query or \"subquery\" */\n Select *pSub1; /* Pointer to the rightmost select in sub-query */\n SrcList *pSrc; /* The FROM clause of the outer query */\n SrcList *pSubSrc; /* The FROM clause of the subquery */\n int iParent; /* VDBE cursor number of the pSub result set temp table */\n int iNewParent = -1;/* Replacement table for iParent */\n int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */ \n int i; /* Loop counter */\n Expr *pWhere; /* The WHERE clause */\n struct SrcList_item *pSubitem; /* The subquery */\n sqlite3 *db = pParse->db;\n\n /* Check to see if flattening is permitted. Return 0 if not.\n */\n assert( p!=0 );\n assert( p->pPrior==0 );\n if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0;\n pSrc = p->pSrc;\n assert( pSrc && iFrom>=0 && iFromnSrc );\n pSubitem = &pSrc->a[iFrom];\n iParent = pSubitem->iCursor;\n pSub = pSubitem->pSelect;\n assert( pSub!=0 );\n\n#ifndef SQLITE_OMIT_WINDOWFUNC\n if( p->pWin || pSub->pWin ) return 0; /* Restriction (25) */\n#endif\n\n pSubSrc = pSub->pSrc;\n assert( pSubSrc );\n /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,\n ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET\n ** because they could be computed at compile-time. But when LIMIT and OFFSET\n ** became arbitrary expressions, we were forced to add restrictions (13)\n ** and (14). */\n if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */\n if( pSub->pLimit && pSub->pLimit->pRight ) return 0; /* Restriction (14) */\n if( (p->selFlags & SF_Compound)!=0 && pSub->pLimit ){\n return 0; /* Restriction (15) */\n }\n if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */\n if( pSub->selFlags & SF_Distinct ) return 0; /* Restriction (4) */\n if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){\n return 0; /* Restrictions (8)(9) */\n }\n if( p->pOrderBy && pSub->pOrderBy ){\n return 0; /* Restriction (11) */\n }\n if( isAgg && pSub->pOrderBy ) return 0; /* Restriction (16) */\n if( pSub->pLimit && p->pWhere ) return 0; /* Restriction (19) */\n if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){\n return 0; /* Restriction (21) */\n }\n if( pSub->selFlags & (SF_Recursive) ){\n return 0; /* Restrictions (22) */\n }\n\n /*\n ** If the subquery is the right operand of a LEFT JOIN, then the\n ** subquery may not be a join itself (3a). Example of why this is not\n ** allowed:\n **\n ** t1 LEFT OUTER JOIN (t2 JOIN t3)\n **\n ** If we flatten the above, we would get\n **\n ** (t1 LEFT OUTER JOIN t2) JOIN t3\n **\n ** which is not at all the same thing.\n **\n ** If the subquery is the right operand of a LEFT JOIN, then the outer\n ** query cannot be an aggregate. (3c) This is an artifact of the way\n ** aggregates are processed - there is no mechanism to determine if\n ** the LEFT JOIN table should be all-NULL.\n **\n ** See also tickets #306, #350, and #3300.\n */\n if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){\n isLeftJoin = 1;\n if( pSubSrc->nSrc>1 || isAgg || IsVirtual(pSubSrc->a[0].pTab) ){\n /* (3a) (3c) (3b) */\n return 0;\n }\n }\n#ifdef SQLITE_EXTRA_IFNULLROW\n else if( iFrom>0 && !isAgg ){\n /* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for\n ** every reference to any result column from subquery in a join, even\n ** though they are not necessary. This will stress-test the OP_IfNullRow \n ** opcode. */\n isLeftJoin = -1;\n }\n#endif\n\n /* Restriction (17): If the sub-query is a compound SELECT, then it must\n ** use only the UNION ALL operator. And none of the simple select queries\n ** that make up the compound SELECT are allowed to be aggregate or distinct\n ** queries.\n */\n if( pSub->pPrior ){\n if( pSub->pOrderBy ){\n return 0; /* Restriction (20) */\n }\n if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){\n return 0; /* (17d1), (17d2), or (17d3) */\n }\n for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){\n testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );\n testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );\n assert( pSub->pSrc!=0 );\n assert( pSub->pEList->nExpr==pSub1->pEList->nExpr );\n if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */\n || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */\n || pSub1->pSrc->nSrc<1 /* (17c) */\n ){\n return 0;\n }\n testcase( pSub1->pSrc->nSrc>1 );\n }\n\n /* Restriction (18). */\n if( p->pOrderBy ){\n int ii;\n for(ii=0; iipOrderBy->nExpr; ii++){\n if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0;\n }\n }\n }\n\n /* Ex-restriction (23):\n ** The only way that the recursive part of a CTE can contain a compound\n ** subquery is for the subquery to be one term of a join. But if the\n ** subquery is a join, then the flattening has already been stopped by\n ** restriction (17d3)\n */\n assert( (p->selFlags & SF_Recursive)==0 || pSub->pPrior==0 );\n\n /***** If we reach this point, flattening is permitted. *****/\n SELECTTRACE(1,pParse,p,(\"flatten %u.%p from term %d\\n\",\n pSub->selId, pSub, iFrom));\n\n /* Authorize the subquery */\n pParse->zAuthContext = pSubitem->zName;\n TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);\n testcase( i==SQLITE_DENY );\n pParse->zAuthContext = zSavedAuthContext;\n\n /* If the sub-query is a compound SELECT statement, then (by restrictions\n ** 17 and 18 above) it must be a UNION ALL and the parent query must \n ** be of the form:\n **\n ** SELECT FROM () \n **\n ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block\n ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or \n ** OFFSET clauses and joins them to the left-hand-side of the original\n ** using UNION ALL operators. In this case N is the number of simple\n ** select statements in the compound sub-query.\n **\n ** Example:\n **\n ** SELECT a+1 FROM (\n ** SELECT x FROM tab\n ** UNION ALL\n ** SELECT y FROM tab\n ** UNION ALL\n ** SELECT abs(z*2) FROM tab2\n ** ) WHERE a!=5 ORDER BY 1\n **\n ** Transformed into:\n **\n ** SELECT x+1 FROM tab WHERE x+1!=5\n ** UNION ALL\n ** SELECT y+1 FROM tab WHERE y+1!=5\n ** UNION ALL\n ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5\n ** ORDER BY 1\n **\n ** We call this the \"compound-subquery flattening\".\n */\n for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){\n Select *pNew;\n ExprList *pOrderBy = p->pOrderBy;\n Expr *pLimit = p->pLimit;\n Select *pPrior = p->pPrior;\n p->pOrderBy = 0;\n p->pSrc = 0;\n p->pPrior = 0;\n p->pLimit = 0;\n pNew = sqlite3SelectDup(db, p, 0);\n p->pLimit = pLimit;\n p->pOrderBy = pOrderBy;\n p->pSrc = pSrc;\n p->op = TK_ALL;\n if( pNew==0 ){\n p->pPrior = pPrior;\n }else{\n pNew->pPrior = pPrior;\n if( pPrior ) pPrior->pNext = pNew;\n pNew->pNext = p;\n p->pPrior = pNew;\n SELECTTRACE(2,pParse,p,(\"compound-subquery flattener\"\n \" creates %u as peer\\n\",pNew->selId));\n }\n if( db->mallocFailed ) return 1;\n }\n\n /* Begin flattening the iFrom-th entry of the FROM clause \n ** in the outer query.\n */\n pSub = pSub1 = pSubitem->pSelect;\n\n /* Delete the transient table structure associated with the\n ** subquery\n */\n sqlite3DbFree(db, pSubitem->zDatabase);\n sqlite3DbFree(db, pSubitem->zName);\n sqlite3DbFree(db, pSubitem->zAlias);\n pSubitem->zDatabase = 0;\n pSubitem->zName = 0;\n pSubitem->zAlias = 0;\n pSubitem->pSelect = 0;\n\n /* Defer deleting the Table object associated with the\n ** subquery until code generation is\n ** complete, since there may still exist Expr.pTab entries that\n ** refer to the subquery even after flattening. Ticket #3346.\n **\n ** pSubitem->pTab is always non-NULL by test restrictions and tests above.\n */\n if( ALWAYS(pSubitem->pTab!=0) ){\n Table *pTabToDel = pSubitem->pTab;\n if( pTabToDel->nTabRef==1 ){\n Parse *pToplevel = sqlite3ParseToplevel(pParse);\n pTabToDel->pNextZombie = pToplevel->pZombieTab;\n pToplevel->pZombieTab = pTabToDel;\n }else{\n pTabToDel->nTabRef--;\n }\n pSubitem->pTab = 0;\n }\n\n /* The following loop runs once for each term in a compound-subquery\n ** flattening (as described above). If we are doing a different kind\n ** of flattening - a flattening other than a compound-subquery flattening -\n ** then this loop only runs once.\n **\n ** This loop moves all of the FROM elements of the subquery into the\n ** the FROM clause of the outer query. Before doing this, remember\n ** the cursor number for the original outer query FROM element in\n ** iParent. The iParent cursor will never be used. Subsequent code\n ** will scan expressions looking for iParent references and replace\n ** those references with expressions that resolve to the subquery FROM\n ** elements we are now copying in.\n */\n for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){\n int nSubSrc;\n u8 jointype = 0;\n assert( pSub!=0 );\n pSubSrc = pSub->pSrc; /* FROM clause of subquery */\n nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */\n pSrc = pParent->pSrc; /* FROM clause of the outer query */\n\n if( pSrc ){\n assert( pParent==p ); /* First time through the loop */\n jointype = pSubitem->fg.jointype;\n }else{\n assert( pParent!=p ); /* 2nd and subsequent times through the loop */\n pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);\n if( pSrc==0 ) break;\n pParent->pSrc = pSrc;\n }\n\n /* The subquery uses a single slot of the FROM clause of the outer\n ** query. If the subquery has more than one element in its FROM clause,\n ** then expand the outer query to make space for it to hold all elements\n ** of the subquery.\n **\n ** Example:\n **\n ** SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB;\n **\n ** The outer query has 3 slots in its FROM clause. One slot of the\n ** outer query (the middle slot) is used by the subquery. The next\n ** block of code will expand the outer query FROM clause to 4 slots.\n ** The middle slot is expanded to two slots in order to make space\n ** for the two elements in the FROM clause of the subquery.\n */\n if( nSubSrc>1 ){\n pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1);\n if( pSrc==0 ) break;\n pParent->pSrc = pSrc;\n }\n\n /* Transfer the FROM clause terms from the subquery into the\n ** outer query.\n */\n for(i=0; ia[i+iFrom].pUsing);\n assert( pSrc->a[i+iFrom].fg.isTabFunc==0 );\n pSrc->a[i+iFrom] = pSubSrc->a[i];\n iNewParent = pSubSrc->a[i].iCursor;\n memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));\n }\n pSrc->a[iFrom].fg.jointype = jointype;\n \n /* Now begin substituting subquery result set expressions for \n ** references to the iParent in the outer query.\n ** \n ** Example:\n **\n ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;\n ** \\ \\_____________ subquery __________/ /\n ** \\_____________________ outer query ______________________________/\n **\n ** We look at every expression in the outer query and every place we see\n ** \"a\" we substitute \"x*3\" and every place we see \"b\" we substitute \"y+10\".\n */\n if( pSub->pOrderBy ){\n /* At this point, any non-zero iOrderByCol values indicate that the\n ** ORDER BY column expression is identical to the iOrderByCol'th\n ** expression returned by SELECT statement pSub. Since these values\n ** do not necessarily correspond to columns in SELECT statement pParent,\n ** zero them before transfering the ORDER BY clause.\n **\n ** Not doing this may cause an error if a subsequent call to this\n ** function attempts to flatten a compound sub-query into pParent\n ** (the only way this can happen is if the compound sub-query is\n ** currently part of pSub->pSrc). See ticket [d11a6e908f]. */\n ExprList *pOrderBy = pSub->pOrderBy;\n for(i=0; inExpr; i++){\n pOrderBy->a[i].u.x.iOrderByCol = 0;\n }\n assert( pParent->pOrderBy==0 );\n pParent->pOrderBy = pOrderBy;\n pSub->pOrderBy = 0;\n }\n pWhere = pSub->pWhere;\n pSub->pWhere = 0;\n if( isLeftJoin>0 ){\n sqlite3SetJoinExpr(pWhere, iNewParent);\n }\n pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere);\n if( db->mallocFailed==0 ){\n SubstContext x;\n x.pParse = pParse;\n x.iTable = iParent;\n x.iNewTable = iNewParent;\n x.isLeftJoin = isLeftJoin;\n x.pEList = pSub->pEList;\n substSelect(&x, pParent, 0);\n }\n \n /* The flattened query is a compound if either the inner or the\n ** outer query is a compound. */\n pParent->selFlags |= pSub->selFlags & SF_Compound;\n assert( (pSub->selFlags & SF_Distinct)==0 ); /* restriction (17b) */\n \n /*\n ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;\n **\n ** One is tempted to try to add a and b to combine the limits. But this\n ** does not work if either limit is negative.\n */\n if( pSub->pLimit ){\n pParent->pLimit = pSub->pLimit;\n pSub->pLimit = 0;\n }\n }\n\n /* Finially, delete what is left of the subquery and return\n ** success.\n */\n sqlite3SelectDelete(db, pSub1);\n\n#if SELECTTRACE_ENABLED\n if( sqlite3SelectTrace & 0x100 ){\n SELECTTRACE(0x100,pParse,p,(\"After flattening:\\n\"));\n sqlite3TreeViewSelect(0, p, 0);\n }\n#endif\n\n return 1;\n}","target":"static int flattenSubquery(\n Parse *pParse, /* Parsing context */\n Select *p, /* The parent or outer SELECT statement */\n int iFrom, /* Index in p->pSrc->a[] of the inner subquery */\n int isAgg /* True if outer SELECT uses aggregate functions */\n){\n const char *zSavedAuthContext = pParse->zAuthContext;\n Select *pParent; /* Current UNION ALL term of the other query */\n Select *pSub; /* The inner query or \"subquery\" */\n Select *pSub1; /* Pointer to the rightmost select in sub-query */\n SrcList *pSrc; /* The FROM clause of the outer query */\n SrcList *pSubSrc; /* The FROM clause of the subquery */\n int iParent; /* VDBE cursor number of the pSub result set temp table */\n int iNewParent = -1;/* Replacement table for iParent */\n int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */ \n int i; /* Loop counter */\n Expr *pWhere; /* The WHERE clause */\n struct SrcList_item *pSubitem; /* The subquery */\n sqlite3 *db = pParse->db;\n\n /* Check to see if flattening is permitted. Return 0 if not.\n */\n assert( p!=0 );\n assert( p->pPrior==0 );\n if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0;\n pSrc = p->pSrc;\n assert( pSrc && iFrom>=0 && iFromnSrc );\n pSubitem = &pSrc->a[iFrom];\n iParent = pSubitem->iCursor;\n pSub = pSubitem->pSelect;\n assert( pSub!=0 );\n\n#ifndef SQLITE_OMIT_WINDOWFUNC\n if( p->pWin || pSub->pWin ) return 0; /* Restriction (25) */\n#endif\n\n pSubSrc = pSub->pSrc;\n assert( pSubSrc );\n /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,\n ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET\n ** because they could be computed at compile-time. But when LIMIT and OFFSET\n ** became arbitrary expressions, we were forced to add restrictions (13)\n ** and (14). */\n if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */\n if( pSub->pLimit && pSub->pLimit->pRight ) return 0; /* Restriction (14) */\n if( (p->selFlags & SF_Compound)!=0 && pSub->pLimit ){\n return 0; /* Restriction (15) */\n }\n if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */\n if( pSub->selFlags & SF_Distinct ) return 0; /* Restriction (4) */\n if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){\n return 0; /* Restrictions (8)(9) */\n }\n if( p->pOrderBy && pSub->pOrderBy ){\n return 0; /* Restriction (11) */\n }\n if( isAgg && pSub->pOrderBy ) return 0; /* Restriction (16) */\n if( pSub->pLimit && p->pWhere ) return 0; /* Restriction (19) */\n if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){\n return 0; /* Restriction (21) */\n }\n if( pSub->selFlags & (SF_Recursive) ){\n return 0; /* Restrictions (22) */\n }\n\n /*\n ** If the subquery is the right operand of a LEFT JOIN, then the\n ** subquery may not be a join itself (3a). Example of why this is not\n ** allowed:\n **\n ** t1 LEFT OUTER JOIN (t2 JOIN t3)\n **\n ** If we flatten the above, we would get\n **\n ** (t1 LEFT OUTER JOIN t2) JOIN t3\n **\n ** which is not at all the same thing.\n **\n ** If the subquery is the right operand of a LEFT JOIN, then the outer\n ** query cannot be an aggregate. (3c) This is an artifact of the way\n ** aggregates are processed - there is no mechanism to determine if\n ** the LEFT JOIN table should be all-NULL.\n **\n ** See also tickets #306, #350, and #3300.\n */\n if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){\n isLeftJoin = 1;\n if( pSubSrc->nSrc>1 /* (3a) */\n || isAgg /* (3b) */\n || IsVirtual(pSubSrc->a[0].pTab) /* (3c) */\n || (p->selFlags & SF_Distinct)!=0 /* (3d) */\n ){\n return 0;\n }\n }\n#ifdef SQLITE_EXTRA_IFNULLROW\n else if( iFrom>0 && !isAgg ){\n /* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for\n ** every reference to any result column from subquery in a join, even\n ** though they are not necessary. This will stress-test the OP_IfNullRow \n ** opcode. */\n isLeftJoin = -1;\n }\n#endif\n\n /* Restriction (17): If the sub-query is a compound SELECT, then it must\n ** use only the UNION ALL operator. And none of the simple select queries\n ** that make up the compound SELECT are allowed to be aggregate or distinct\n ** queries.\n */\n if( pSub->pPrior ){\n if( pSub->pOrderBy ){\n return 0; /* Restriction (20) */\n }\n if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){\n return 0; /* (17d1), (17d2), or (17d3) */\n }\n for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){\n testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );\n testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );\n assert( pSub->pSrc!=0 );\n assert( pSub->pEList->nExpr==pSub1->pEList->nExpr );\n if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */\n || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */\n || pSub1->pSrc->nSrc<1 /* (17c) */\n ){\n return 0;\n }\n testcase( pSub1->pSrc->nSrc>1 );\n }\n\n /* Restriction (18). */\n if( p->pOrderBy ){\n int ii;\n for(ii=0; iipOrderBy->nExpr; ii++){\n if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0;\n }\n }\n }\n\n /* Ex-restriction (23):\n ** The only way that the recursive part of a CTE can contain a compound\n ** subquery is for the subquery to be one term of a join. But if the\n ** subquery is a join, then the flattening has already been stopped by\n ** restriction (17d3)\n */\n assert( (p->selFlags & SF_Recursive)==0 || pSub->pPrior==0 );\n\n /***** If we reach this point, flattening is permitted. *****/\n SELECTTRACE(1,pParse,p,(\"flatten %u.%p from term %d\\n\",\n pSub->selId, pSub, iFrom));\n\n /* Authorize the subquery */\n pParse->zAuthContext = pSubitem->zName;\n TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);\n testcase( i==SQLITE_DENY );\n pParse->zAuthContext = zSavedAuthContext;\n\n /* If the sub-query is a compound SELECT statement, then (by restrictions\n ** 17 and 18 above) it must be a UNION ALL and the parent query must \n ** be of the form:\n **\n ** SELECT FROM () \n **\n ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block\n ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or \n ** OFFSET clauses and joins them to the left-hand-side of the original\n ** using UNION ALL operators. In this case N is the number of simple\n ** select statements in the compound sub-query.\n **\n ** Example:\n **\n ** SELECT a+1 FROM (\n ** SELECT x FROM tab\n ** UNION ALL\n ** SELECT y FROM tab\n ** UNION ALL\n ** SELECT abs(z*2) FROM tab2\n ** ) WHERE a!=5 ORDER BY 1\n **\n ** Transformed into:\n **\n ** SELECT x+1 FROM tab WHERE x+1!=5\n ** UNION ALL\n ** SELECT y+1 FROM tab WHERE y+1!=5\n ** UNION ALL\n ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5\n ** ORDER BY 1\n **\n ** We call this the \"compound-subquery flattening\".\n */\n for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){\n Select *pNew;\n ExprList *pOrderBy = p->pOrderBy;\n Expr *pLimit = p->pLimit;\n Select *pPrior = p->pPrior;\n p->pOrderBy = 0;\n p->pSrc = 0;\n p->pPrior = 0;\n p->pLimit = 0;\n pNew = sqlite3SelectDup(db, p, 0);\n p->pLimit = pLimit;\n p->pOrderBy = pOrderBy;\n p->pSrc = pSrc;\n p->op = TK_ALL;\n if( pNew==0 ){\n p->pPrior = pPrior;\n }else{\n pNew->pPrior = pPrior;\n if( pPrior ) pPrior->pNext = pNew;\n pNew->pNext = p;\n p->pPrior = pNew;\n SELECTTRACE(2,pParse,p,(\"compound-subquery flattener\"\n \" creates %u as peer\\n\",pNew->selId));\n }\n if( db->mallocFailed ) return 1;\n }\n\n /* Begin flattening the iFrom-th entry of the FROM clause \n ** in the outer query.\n */\n pSub = pSub1 = pSubitem->pSelect;\n\n /* Delete the transient table structure associated with the\n ** subquery\n */\n sqlite3DbFree(db, pSubitem->zDatabase);\n sqlite3DbFree(db, pSubitem->zName);\n sqlite3DbFree(db, pSubitem->zAlias);\n pSubitem->zDatabase = 0;\n pSubitem->zName = 0;\n pSubitem->zAlias = 0;\n pSubitem->pSelect = 0;\n\n /* Defer deleting the Table object associated with the\n ** subquery until code generation is\n ** complete, since there may still exist Expr.pTab entries that\n ** refer to the subquery even after flattening. Ticket #3346.\n **\n ** pSubitem->pTab is always non-NULL by test restrictions and tests above.\n */\n if( ALWAYS(pSubitem->pTab!=0) ){\n Table *pTabToDel = pSubitem->pTab;\n if( pTabToDel->nTabRef==1 ){\n Parse *pToplevel = sqlite3ParseToplevel(pParse);\n pTabToDel->pNextZombie = pToplevel->pZombieTab;\n pToplevel->pZombieTab = pTabToDel;\n }else{\n pTabToDel->nTabRef--;\n }\n pSubitem->pTab = 0;\n }\n\n /* The following loop runs once for each term in a compound-subquery\n ** flattening (as described above). If we are doing a different kind\n ** of flattening - a flattening other than a compound-subquery flattening -\n ** then this loop only runs once.\n **\n ** This loop moves all of the FROM elements of the subquery into the\n ** the FROM clause of the outer query. Before doing this, remember\n ** the cursor number for the original outer query FROM element in\n ** iParent. The iParent cursor will never be used. Subsequent code\n ** will scan expressions looking for iParent references and replace\n ** those references with expressions that resolve to the subquery FROM\n ** elements we are now copying in.\n */\n for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){\n int nSubSrc;\n u8 jointype = 0;\n assert( pSub!=0 );\n pSubSrc = pSub->pSrc; /* FROM clause of subquery */\n nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */\n pSrc = pParent->pSrc; /* FROM clause of the outer query */\n\n if( pSrc ){\n assert( pParent==p ); /* First time through the loop */\n jointype = pSubitem->fg.jointype;\n }else{\n assert( pParent!=p ); /* 2nd and subsequent times through the loop */\n pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);\n if( pSrc==0 ) break;\n pParent->pSrc = pSrc;\n }\n\n /* The subquery uses a single slot of the FROM clause of the outer\n ** query. If the subquery has more than one element in its FROM clause,\n ** then expand the outer query to make space for it to hold all elements\n ** of the subquery.\n **\n ** Example:\n **\n ** SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB;\n **\n ** The outer query has 3 slots in its FROM clause. One slot of the\n ** outer query (the middle slot) is used by the subquery. The next\n ** block of code will expand the outer query FROM clause to 4 slots.\n ** The middle slot is expanded to two slots in order to make space\n ** for the two elements in the FROM clause of the subquery.\n */\n if( nSubSrc>1 ){\n pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1);\n if( pSrc==0 ) break;\n pParent->pSrc = pSrc;\n }\n\n /* Transfer the FROM clause terms from the subquery into the\n ** outer query.\n */\n for(i=0; ia[i+iFrom].pUsing);\n assert( pSrc->a[i+iFrom].fg.isTabFunc==0 );\n pSrc->a[i+iFrom] = pSubSrc->a[i];\n iNewParent = pSubSrc->a[i].iCursor;\n memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));\n }\n pSrc->a[iFrom].fg.jointype = jointype;\n \n /* Now begin substituting subquery result set expressions for \n ** references to the iParent in the outer query.\n ** \n ** Example:\n **\n ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;\n ** \\ \\_____________ subquery __________/ /\n ** \\_____________________ outer query ______________________________/\n **\n ** We look at every expression in the outer query and every place we see\n ** \"a\" we substitute \"x*3\" and every place we see \"b\" we substitute \"y+10\".\n */\n if( pSub->pOrderBy ){\n /* At this point, any non-zero iOrderByCol values indicate that the\n ** ORDER BY column expression is identical to the iOrderByCol'th\n ** expression returned by SELECT statement pSub. Since these values\n ** do not necessarily correspond to columns in SELECT statement pParent,\n ** zero them before transfering the ORDER BY clause.\n **\n ** Not doing this may cause an error if a subsequent call to this\n ** function attempts to flatten a compound sub-query into pParent\n ** (the only way this can happen is if the compound sub-query is\n ** currently part of pSub->pSrc). See ticket [d11a6e908f]. */\n ExprList *pOrderBy = pSub->pOrderBy;\n for(i=0; inExpr; i++){\n pOrderBy->a[i].u.x.iOrderByCol = 0;\n }\n assert( pParent->pOrderBy==0 );\n pParent->pOrderBy = pOrderBy;\n pSub->pOrderBy = 0;\n }\n pWhere = pSub->pWhere;\n pSub->pWhere = 0;\n if( isLeftJoin>0 ){\n sqlite3SetJoinExpr(pWhere, iNewParent);\n }\n pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere);\n if( db->mallocFailed==0 ){\n SubstContext x;\n x.pParse = pParse;\n x.iTable = iParent;\n x.iNewTable = iNewParent;\n x.isLeftJoin = isLeftJoin;\n x.pEList = pSub->pEList;\n substSelect(&x, pParent, 0);\n }\n \n /* The flattened query is a compound if either the inner or the\n ** outer query is a compound. */\n pParent->selFlags |= pSub->selFlags & SF_Compound;\n assert( (pSub->selFlags & SF_Distinct)==0 ); /* restriction (17b) */\n \n /*\n ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;\n **\n ** One is tempted to try to add a and b to combine the limits. But this\n ** does not work if either limit is negative.\n */\n if( pSub->pLimit ){\n pParent->pLimit = pSub->pLimit;\n pSub->pLimit = 0;\n }\n }\n\n /* Finially, delete what is left of the subquery and return\n ** success.\n */\n sqlite3SelectDelete(db, pSub1);\n\n#if SELECTTRACE_ENABLED\n if( sqlite3SelectTrace & 0x100 ){\n SELECTTRACE(0x100,pParse,p,(\"After flattening:\\n\"));\n sqlite3TreeViewSelect(0, p, 0);\n }\n#endif\n\n return 1;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"flattenSubquery","file_name":"src/select.c","commit_link":"github.com/sqlite/sqlite/commit/396afe6f6aa90a31303c183e11b2b2d4b7956b35","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#58-b51548a923e2","input":"CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)\n{\n bool ok;\n XkbFile *files[LAST_KEYMAP_FILE_TYPE + 1] = { NULL };\n enum xkb_file_type type;\n struct xkb_context *ctx = keymap->ctx;\n\n /* Collect section files and check for duplicates. */\n for (file = (XkbFile *) file->defs; file;\n file = (XkbFile *) file->common.next) {\n if (file->file_type < FIRST_KEYMAP_FILE_TYPE ||\n file->file_type > LAST_KEYMAP_FILE_TYPE) {\n log_err(ctx, \"Cannot define %s in a keymap file\\n\",\n xkb_file_type_to_string(file->file_type));\n continue;\n }\n\n if (files[file->file_type]) {\n log_err(ctx,\n \"More than one %s section in keymap file; \"\n \"All sections after the first ignored\\n\",\n xkb_file_type_to_string(file->file_type));\n continue;\n }\n\n files[file->file_type] = file;\n }\n\n /*\n * Check that all required section were provided.\n * Report everything before failing.\n */\n ok = true;\n for (type = FIRST_KEYMAP_FILE_TYPE;\n type <= LAST_KEYMAP_FILE_TYPE;\n type++) {\n if (files[type] == NULL) {\n log_err(ctx, \"Required section %s missing from keymap\\n\",\n xkb_file_type_to_string(type));\n ok = false;\n }\n }\n if (!ok)\n return false;\n\n /* Compile sections. */\n for (type = FIRST_KEYMAP_FILE_TYPE;\n type <= LAST_KEYMAP_FILE_TYPE;\n type++) {\n log_dbg(ctx, \"Compiling %s \\\"%s\\\"\\n\",\n xkb_file_type_to_string(type), files[type]->name);\n\n ok = compile_file_fns[type](files[type], keymap, merge);\n if (!ok) {\n log_err(ctx, \"Failed to compile %s\\n\",\n xkb_file_type_to_string(type));\n return false;\n }\n }\n\n return UpdateDerivedKeymapFields(keymap);\n}","target":"CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)\n{\n bool ok;\n XkbFile *files[LAST_KEYMAP_FILE_TYPE + 1] = { NULL };\n enum xkb_file_type type;\n struct xkb_context *ctx = keymap->ctx;\n\n /* Collect section files and check for duplicates. */\n for (file = (XkbFile *) file->defs; file;\n file = (XkbFile *) file->common.next) {\n if (file->file_type < FIRST_KEYMAP_FILE_TYPE ||\n file->file_type > LAST_KEYMAP_FILE_TYPE) {\n if (file->file_type == FILE_TYPE_GEOMETRY) {\n log_vrb(ctx, 1,\n \"Geometry sections are not supported; ignoring\\n\");\n } else {\n log_err(ctx, \"Cannot define %s in a keymap file\\n\",\n xkb_file_type_to_string(file->file_type));\n }\n continue;\n }\n\n if (files[file->file_type]) {\n log_err(ctx,\n \"More than one %s section in keymap file; \"\n \"All sections after the first ignored\\n\",\n xkb_file_type_to_string(file->file_type));\n continue;\n }\n\n files[file->file_type] = file;\n }\n\n /*\n * Check that all required section were provided.\n * Report everything before failing.\n */\n ok = true;\n for (type = FIRST_KEYMAP_FILE_TYPE;\n type <= LAST_KEYMAP_FILE_TYPE;\n type++) {\n if (files[type] == NULL) {\n log_err(ctx, \"Required section %s missing from keymap\\n\",\n xkb_file_type_to_string(type));\n ok = false;\n }\n }\n if (!ok)\n return false;\n\n /* Compile sections. */\n for (type = FIRST_KEYMAP_FILE_TYPE;\n type <= LAST_KEYMAP_FILE_TYPE;\n type++) {\n log_dbg(ctx, \"Compiling %s \\\"%s\\\"\\n\",\n xkb_file_type_to_string(type), files[type]->name);\n\n ok = compile_file_fns[type](files[type], keymap, merge);\n if (!ok) {\n log_err(ctx, \"Failed to compile %s\\n\",\n xkb_file_type_to_string(type));\n return false;\n }\n }\n\n return UpdateDerivedKeymapFields(keymap);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"CompileKeymap","file_name":"src/xkbcomp/keymap.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/917636b1d0d70205a13f89062b95e3a0fc31d4ff","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#59-aae4857e0809","input":"int avpriv_ac3_parse_header(AC3HeaderInfo **phdr, const uint8_t *buf,\n size_t size)\n{\n GetBitContext gb;\n AC3HeaderInfo *hdr;\n int err;\n\n if (!*phdr)\n *phdr = av_mallocz(sizeof(AC3HeaderInfo));\n if (!*phdr)\n return AVERROR(ENOMEM);\n hdr = *phdr;\n\n init_get_bits8(&gb, buf, size);\n err = ff_ac3_parse_header(&gb, hdr);\n if (err < 0)\n return AVERROR_INVALIDDATA;\n\n return get_bits_count(&gb);\n}","target":"int avpriv_ac3_parse_header(AC3HeaderInfo **phdr, const uint8_t *buf,\n size_t size)\n{\n GetBitContext gb;\n AC3HeaderInfo *hdr;\n int err;\n\n if (!*phdr)\n *phdr = av_mallocz(sizeof(AC3HeaderInfo));\n if (!*phdr)\n return AVERROR(ENOMEM);\n hdr = *phdr;\n\n err = init_get_bits8(&gb, buf, size);\n if (err < 0)\n return AVERROR_INVALIDDATA;\n err = ff_ac3_parse_header(&gb, hdr);\n if (err < 0)\n return AVERROR_INVALIDDATA;\n\n return get_bits_count(&gb);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"avpriv_ac3_parse_header","file_name":"libavcodec/ac3_parser.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/00e8181bd97c834fe60751b0c511d4bb97875f78","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#60-5f6e218f67f8","input":"static int mailimf_group_parse(const char * message, size_t length,\n\t\t\t size_t * indx,\n\t\t\t struct mailimf_group ** result)\n{\n size_t cur_token;\n char * display_name;\n struct mailimf_mailbox_list * mailbox_list;\n struct mailimf_group * group;\n int r;\n int res;\n\n cur_token = * indx;\n\n mailbox_list = NULL;\n\n r = mailimf_display_name_parse(message, length, &cur_token, &display_name);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto err;\n }\n\n r = mailimf_colon_parse(message, length, &cur_token);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto free_display_name;\n }\n\n r = mailimf_mailbox_list_parse(message, length, &cur_token, &mailbox_list);\n switch (r) {\n case MAILIMF_NO_ERROR:\n break;\n case MAILIMF_ERROR_PARSE:\n r = mailimf_cfws_parse(message, length, &cur_token);\n if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {\n res = r;\n goto free_display_name;\n }\n break;\n default:\n res = r;\n goto free_display_name;\n }\n\n r = mailimf_semi_colon_parse(message, length, &cur_token);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto free_mailbox_list;\n }\n\n group = mailimf_group_new(display_name, mailbox_list);\n if (group == NULL) {\n res = MAILIMF_ERROR_MEMORY;\n goto free_mailbox_list;\n }\n\n * indx = cur_token;\n * result = group;\n\n return MAILIMF_NO_ERROR;\n\n free_mailbox_list:\n if (mailbox_list != NULL) {\n mailimf_mailbox_list_free(mailbox_list);\n }\n free_display_name:\n mailimf_display_name_free(display_name);\n err:\n return res;\n}","target":"static int mailimf_group_parse(const char * message, size_t length,\n\t\t\t size_t * indx,\n\t\t\t struct mailimf_group ** result)\n{\n size_t cur_token;\n char * display_name;\n struct mailimf_mailbox_list * mailbox_list;\n struct mailimf_group * group;\n int r;\n int res;\n clist * list;\n\n cur_token = * indx;\n\n mailbox_list = NULL;\n\n r = mailimf_display_name_parse(message, length, &cur_token, &display_name);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto err;\n }\n\n r = mailimf_colon_parse(message, length, &cur_token);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto free_display_name;\n }\n\n r = mailimf_mailbox_list_parse(message, length, &cur_token, &mailbox_list);\n switch (r) {\n case MAILIMF_NO_ERROR:\n break;\n case MAILIMF_ERROR_PARSE:\n r = mailimf_cfws_parse(message, length, &cur_token);\n if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {\n res = r;\n goto free_display_name;\n }\n list = clist_new();\n if (list == NULL) {\n res = MAILIMF_ERROR_MEMORY;\n goto free_display_name;\n }\n mailbox_list = mailimf_mailbox_list_new(list);\n if (mailbox_list == NULL) {\n res = MAILIMF_ERROR_MEMORY;\n clist_free(list);\n goto free_display_name;\n }\n break;\n default:\n res = r;\n goto free_display_name;\n }\n\n r = mailimf_semi_colon_parse(message, length, &cur_token);\n if (r != MAILIMF_NO_ERROR) {\n res = r;\n goto free_mailbox_list;\n }\n\n group = mailimf_group_new(display_name, mailbox_list);\n if (group == NULL) {\n res = MAILIMF_ERROR_MEMORY;\n goto free_mailbox_list;\n }\n\n * indx = cur_token;\n * result = group;\n\n return MAILIMF_NO_ERROR;\n\n free_mailbox_list:\n if (mailbox_list != NULL) {\n mailimf_mailbox_list_free(mailbox_list);\n }\n free_display_name:\n mailimf_display_name_free(display_name);\n err:\n return res;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"mailimf_group_parse","file_name":"src/low-level/imf/mailimf.c","commit_link":"github.com/dinhviethoa/libetpan/commit/1fe8fbc032ccda1db9af66d93016b49c16c1f22d","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#61-1e3644f547d7","input":"static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,\n\t\t\t\t struct srpt_recv_ioctx *recv_ioctx,\n\t\t\t\t struct srpt_send_ioctx *send_ioctx)\n{\n\tstruct srp_tsk_mgmt *srp_tsk;\n\tstruct se_cmd *cmd;\n\tstruct se_session *sess = ch->sess;\n\tuint64_t unpacked_lun;\n\tuint32_t tag = 0;\n\tint tcm_tmr;\n\tint rc;\n\n\tBUG_ON(!send_ioctx);\n\n\tsrp_tsk = recv_ioctx->ioctx.buf;\n\tcmd = &send_ioctx->cmd;\n\n\tpr_debug(\"recv tsk_mgmt fn %d for task_tag %lld and cmd tag %lld\"\n\t\t \" cm_id %p sess %p\\n\", srp_tsk->tsk_mgmt_func,\n\t\t srp_tsk->task_tag, srp_tsk->tag, ch->cm_id, ch->sess);\n\n\tsrpt_set_cmd_state(send_ioctx, SRPT_STATE_MGMT);\n\tsend_ioctx->cmd.tag = srp_tsk->tag;\n\ttcm_tmr = srp_tmr_to_tcm(srp_tsk->tsk_mgmt_func);\n\tif (tcm_tmr < 0) {\n\t\tsend_ioctx->cmd.se_tmr_req->response =\n\t\t\tTMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED;\n\t\tgoto fail;\n\t}\n\tunpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun,\n\t\t\t\t sizeof(srp_tsk->lun));\n\n\tif (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK) {\n\t\trc = srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag);\n\t\tif (rc < 0) {\n\t\t\tsend_ioctx->cmd.se_tmr_req->response =\n\t\t\t\t\tTMR_TASK_DOES_NOT_EXIST;\n\t\t\tgoto fail;\n\t\t}\n\t\ttag = srp_tsk->task_tag;\n\t}\n\trc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, unpacked_lun,\n\t\t\t\tsrp_tsk, tcm_tmr, GFP_KERNEL, tag,\n\t\t\t\tTARGET_SCF_ACK_KREF);\n\tif (rc != 0) {\n\t\tsend_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;\n\t\tgoto fail;\n\t}\n\treturn;\nfail:\n\ttransport_send_check_condition_and_sense(cmd, 0, 0); // XXX:\n}","target":"static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,\n\t\t\t\t struct srpt_recv_ioctx *recv_ioctx,\n\t\t\t\t struct srpt_send_ioctx *send_ioctx)\n{\n\tstruct srp_tsk_mgmt *srp_tsk;\n\tstruct se_cmd *cmd;\n\tstruct se_session *sess = ch->sess;\n\tuint64_t unpacked_lun;\n\tint tcm_tmr;\n\tint rc;\n\n\tBUG_ON(!send_ioctx);\n\n\tsrp_tsk = recv_ioctx->ioctx.buf;\n\tcmd = &send_ioctx->cmd;\n\n\tpr_debug(\"recv tsk_mgmt fn %d for task_tag %lld and cmd tag %lld\"\n\t\t \" cm_id %p sess %p\\n\", srp_tsk->tsk_mgmt_func,\n\t\t srp_tsk->task_tag, srp_tsk->tag, ch->cm_id, ch->sess);\n\n\tsrpt_set_cmd_state(send_ioctx, SRPT_STATE_MGMT);\n\tsend_ioctx->cmd.tag = srp_tsk->tag;\n\ttcm_tmr = srp_tmr_to_tcm(srp_tsk->tsk_mgmt_func);\n\tunpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun,\n\t\t\t\t sizeof(srp_tsk->lun));\n\trc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, unpacked_lun,\n\t\t\t\tsrp_tsk, tcm_tmr, GFP_KERNEL, srp_tsk->task_tag,\n\t\t\t\tTARGET_SCF_ACK_KREF);\n\tif (rc != 0) {\n\t\tsend_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;\n\t\tgoto fail;\n\t}\n\treturn;\nfail:\n\ttransport_send_check_condition_and_sense(cmd, 0, 0); // XXX:\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"srpt_handle_tsk_mgmt","file_name":"drivers/infiniband/ulp/srpt/ib_srpt.c","commit_link":"github.com/torvalds/linux/commit/51093254bf879bc9ce96590400a87897c7498463","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#62-b93674cb7ca0","input":"ResolveStateAndPredicate(ExprDef *expr, enum xkb_match_operation *pred_rtrn,\n xkb_mod_mask_t *mods_rtrn, CompatInfo *info)\n{\n if (expr == NULL) {\n *pred_rtrn = MATCH_ANY_OR_NONE;\n *mods_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n\n *pred_rtrn = MATCH_EXACTLY;\n if (expr->expr.op == EXPR_ACTION_DECL) {\n const char *pred_txt = xkb_atom_text(info->ctx, expr->action.name);\n if (!LookupString(symInterpretMatchMaskNames, pred_txt, pred_rtrn)) {\n log_err(info->ctx,\n \"Illegal modifier predicate \\\"%s\\\"; Ignored\\n\", pred_txt);\n return false;\n }\n expr = expr->action.args;\n }\n else if (expr->expr.op == EXPR_IDENT) {\n const char *pred_txt = xkb_atom_text(info->ctx, expr->ident.ident);\n if (pred_txt && istreq(pred_txt, \"any\")) {\n *pred_rtrn = MATCH_ANY;\n *mods_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n }\n\n return ExprResolveModMask(info->ctx, expr, MOD_REAL, &info->mods,\n mods_rtrn);\n}","target":"ResolveStateAndPredicate(ExprDef *expr, enum xkb_match_operation *pred_rtrn,\n xkb_mod_mask_t *mods_rtrn, CompatInfo *info)\n{\n if (expr == NULL) {\n *pred_rtrn = MATCH_ANY_OR_NONE;\n *mods_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n\n *pred_rtrn = MATCH_EXACTLY;\n if (expr->expr.op == EXPR_ACTION_DECL) {\n const char *pred_txt = xkb_atom_text(info->ctx, expr->action.name);\n if (!LookupString(symInterpretMatchMaskNames, pred_txt, pred_rtrn) ||\n !expr->action.args) {\n log_err(info->ctx,\n \"Illegal modifier predicate \\\"%s\\\"; Ignored\\n\", pred_txt);\n return false;\n }\n expr = expr->action.args;\n }\n else if (expr->expr.op == EXPR_IDENT) {\n const char *pred_txt = xkb_atom_text(info->ctx, expr->ident.ident);\n if (pred_txt && istreq(pred_txt, \"any\")) {\n *pred_rtrn = MATCH_ANY;\n *mods_rtrn = MOD_REAL_MASK_ALL;\n return true;\n }\n }\n\n return ExprResolveModMask(info->ctx, expr, MOD_REAL, &info->mods,\n mods_rtrn);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"ResolveStateAndPredicate","file_name":"src/xkbcomp/compat.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/96df3106d49438e442510c59acad306e94f3db4d","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#63-efa1be432df8","input":"GetOutboundPinholeTimeout(struct upnphttp * h, const char * action, const char * ns)\n{\n\tint r;\n\n\tstatic const char resp[] =\n\t\t\"\"\n\t\t\"%d\"\n\t\t\"\";\n\n\tchar body[512];\n\tint bodylen;\n\tstruct NameValueParserData data;\n\tchar * int_ip, * int_port, * rem_host, * rem_port, * protocol;\n\tint opt=0;\n\t/*int proto=0;*/\n\tunsigned short iport, rport;\n\n\tif (GETFLAG(IPV6FCFWDISABLEDMASK))\n\t{\n\t\tSoapError(h, 702, \"FirewallDisabled\");\n\t\treturn;\n\t}\n\n\tParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);\n\tint_ip = GetValueFromNameValueList(&data, \"InternalClient\");\n\tint_port = GetValueFromNameValueList(&data, \"InternalPort\");\n\trem_host = GetValueFromNameValueList(&data, \"RemoteHost\");\n\trem_port = GetValueFromNameValueList(&data, \"RemotePort\");\n\tprotocol = GetValueFromNameValueList(&data, \"Protocol\");\n\n\trport = (unsigned short)atoi(rem_port);\n\tiport = (unsigned short)atoi(int_port);\n\t/*proto = atoi(protocol);*/\n\n\tsyslog(LOG_INFO, \"%s: retrieving timeout for outbound pinhole from [%s]:%hu to [%s]:%hu protocol %s\", action, int_ip, iport,rem_host, rport, protocol);\n\n\t/* TODO */\n\tr = -1;/*upnp_check_outbound_pinhole(proto, &opt);*/\n\n\tswitch(r)\n\t{\n\t\tcase 1:\t/* success */\n\t\t\tbodylen = snprintf(body, sizeof(body), resp,\n\t\t\t action, ns/*\"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1\"*/,\n\t\t\t opt, action);\n\t\t\tBuildSendAndCloseSoapResp(h, body, bodylen);\n\t\t\tbreak;\n\t\tcase -5:\t/* Protocol not supported */\n\t\t\tSoapError(h, 705, \"ProtocolNotSupported\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tSoapError(h, 501, \"ActionFailed\");\n\t}\n\tClearNameValueList(&data);\n}","target":"GetOutboundPinholeTimeout(struct upnphttp * h, const char * action, const char * ns)\n{\n\tint r;\n\n\tstatic const char resp[] =\n\t\t\"\"\n\t\t\"%d\"\n\t\t\"\";\n\n\tchar body[512];\n\tint bodylen;\n\tstruct NameValueParserData data;\n\tchar * int_ip, * int_port, * rem_host, * rem_port, * protocol;\n\tint opt=0;\n\t/*int proto=0;*/\n\tunsigned short iport, rport;\n\n\tif (GETFLAG(IPV6FCFWDISABLEDMASK))\n\t{\n\t\tSoapError(h, 702, \"FirewallDisabled\");\n\t\treturn;\n\t}\n\n\tParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);\n\tint_ip = GetValueFromNameValueList(&data, \"InternalClient\");\n\tint_port = GetValueFromNameValueList(&data, \"InternalPort\");\n\trem_host = GetValueFromNameValueList(&data, \"RemoteHost\");\n\trem_port = GetValueFromNameValueList(&data, \"RemotePort\");\n\tprotocol = GetValueFromNameValueList(&data, \"Protocol\");\n\n\tif (!int_port || !ext_port || !protocol)\n\t{\n\t\tClearNameValueList(&data);\n\t\tSoapError(h, 402, \"Invalid Args\");\n\t\treturn;\n\t}\n\n\trport = (unsigned short)atoi(rem_port);\n\tiport = (unsigned short)atoi(int_port);\n\t/*proto = atoi(protocol);*/\n\n\tsyslog(LOG_INFO, \"%s: retrieving timeout for outbound pinhole from [%s]:%hu to [%s]:%hu protocol %s\", action, int_ip, iport,rem_host, rport, protocol);\n\n\t/* TODO */\n\tr = -1;/*upnp_check_outbound_pinhole(proto, &opt);*/\n\n\tswitch(r)\n\t{\n\t\tcase 1:\t/* success */\n\t\t\tbodylen = snprintf(body, sizeof(body), resp,\n\t\t\t action, ns/*\"urn:schemas-upnp-org:service:WANIPv6FirewallControl:1\"*/,\n\t\t\t opt, action);\n\t\t\tBuildSendAndCloseSoapResp(h, body, bodylen);\n\t\t\tbreak;\n\t\tcase -5:\t/* Protocol not supported */\n\t\t\tSoapError(h, 705, \"ProtocolNotSupported\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tSoapError(h, 501, \"ActionFailed\");\n\t}\n\tClearNameValueList(&data);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"GetOutboundPinholeTimeout","file_name":"miniupnpd/upnpsoap.c","commit_link":"github.com/miniupnp/miniupnp/commit/13585f15c7f7dc28bbbba1661efb280d530d114c","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#64-4fe8f4cc8f7e","input":"AP4_AtomSampleTable::GetSample(AP4_Ordinal index, \n AP4_Sample& sample)\n{\n AP4_Result result;\n\n // check that we have an stsc atom\n if (!m_StscAtom) {\n return AP4_ERROR_INVALID_FORMAT;\n }\n \n // check that we have a chunk offset table\n if (m_StcoAtom == NULL && m_Co64Atom == NULL) {\n return AP4_ERROR_INVALID_FORMAT;\n }\n\n // MP4 uses 1-based indexes internally, so adjust by one\n index++;\n\n // find out in which chunk this sample is located\n AP4_Ordinal chunk, skip, desc;\n result = m_StscAtom->GetChunkForSample(index, chunk, skip, desc);\n if (AP4_FAILED(result)) return result;\n \n // check that the result is within bounds\n if (skip > index) return AP4_ERROR_INTERNAL;\n\n // get the atom offset for this chunk\n AP4_UI64 offset;\n if (m_StcoAtom) {\n AP4_UI32 offset_32;\n result = m_StcoAtom->GetChunkOffset(chunk, offset_32);\n offset = offset_32;\n } else {\n result = m_Co64Atom->GetChunkOffset(chunk, offset);\n }\n if (AP4_FAILED(result)) return result;\n \n // compute the additional offset inside the chunk\n for (unsigned int i = index-skip; i < index; i++) {\n AP4_Size size = 0;\n if (m_StszAtom) {\n result = m_StszAtom->GetSampleSize(i, size); \n } else if (m_Stz2Atom) {\n result = m_Stz2Atom->GetSampleSize(i, size); \n } else {\n result = AP4_ERROR_INVALID_FORMAT;\n }\n if (AP4_FAILED(result)) return result;\n offset += size;\n }\n\n // set the description index\n sample.SetDescriptionIndex(desc-1); // adjust for 0-based indexes\n\n // set the dts and cts\n AP4_UI32 cts_offset = 0;\n AP4_UI64 dts = 0;\n AP4_UI32 duration = 0;\n result = m_SttsAtom->GetDts(index, dts, &duration);\n if (AP4_FAILED(result)) return result;\n sample.SetDuration(duration);\n sample.SetDts(dts);\n if (m_CttsAtom == NULL) {\n sample.SetCts(dts);\n } else {\n result = m_CttsAtom->GetCtsOffset(index, cts_offset); \n\t if (AP4_FAILED(result)) return result;\n sample.SetCtsDelta(cts_offset);\n } \n\n // set the size\n AP4_Size sample_size = 0;\n if (m_StszAtom) {\n result = m_StszAtom->GetSampleSize(index, sample_size); \n } else if (m_Stz2Atom) {\n result = m_Stz2Atom->GetSampleSize(index, sample_size); \n } else {\n result = AP4_ERROR_INVALID_FORMAT;\n }\n if (AP4_FAILED(result)) return result;\n sample.SetSize(sample_size);\n\n // set the sync flag\n if (m_StssAtom == NULL) {\n sample.SetSync(true);\n } else {\n sample.SetSync(m_StssAtom->IsSampleSync(index));\n }\n\n // set the offset\n sample.SetOffset(offset);\n\n // set the data stream\n sample.SetDataStream(m_SampleStream);\n\n\n return AP4_SUCCESS;\n}","target":"AP4_AtomSampleTable::GetSample(AP4_Ordinal index, \n AP4_Sample& sample)\n{\n AP4_Result result;\n\n // check that we have an stsc atom\n if (!m_StscAtom) {\n return AP4_ERROR_INVALID_FORMAT;\n }\n \n // check that we have a chunk offset table\n if (m_StcoAtom == NULL && m_Co64Atom == NULL) {\n return AP4_ERROR_INVALID_FORMAT;\n }\n\n // MP4 uses 1-based indexes internally, so adjust by one\n index++;\n\n // find out in which chunk this sample is located\n AP4_Ordinal chunk, skip, desc;\n result = m_StscAtom->GetChunkForSample(index, chunk, skip, desc);\n if (AP4_FAILED(result)) return result;\n \n // check that the result is within bounds\n if (skip > index) return AP4_ERROR_INTERNAL;\n\n // get the atom offset for this chunk\n AP4_UI64 offset;\n if (m_StcoAtom) {\n AP4_UI32 offset_32;\n result = m_StcoAtom->GetChunkOffset(chunk, offset_32);\n offset = offset_32;\n } else {\n result = m_Co64Atom->GetChunkOffset(chunk, offset);\n }\n if (AP4_FAILED(result)) return result;\n \n // compute the additional offset inside the chunk\n for (unsigned int i = index-skip; i < index; i++) {\n AP4_Size size = 0;\n if (m_StszAtom) {\n result = m_StszAtom->GetSampleSize(i, size); \n } else if (m_Stz2Atom) {\n result = m_Stz2Atom->GetSampleSize(i, size); \n } else {\n result = AP4_ERROR_INVALID_FORMAT;\n }\n if (AP4_FAILED(result)) return result;\n offset += size;\n }\n\n // set the description index\n sample.SetDescriptionIndex(desc-1); // adjust for 0-based indexes\n\n // set the dts and cts\n AP4_UI32 cts_offset = 0;\n AP4_UI64 dts = 0;\n AP4_UI32 duration = 0;\n if (m_SttsAtom) {\n result = m_SttsAtom->GetDts(index, dts, &duration);\n if (AP4_FAILED(result)) return result;\n }\n sample.SetDuration(duration);\n sample.SetDts(dts);\n if (m_CttsAtom == NULL) {\n sample.SetCts(dts);\n } else {\n result = m_CttsAtom->GetCtsOffset(index, cts_offset); \n\t if (AP4_FAILED(result)) return result;\n sample.SetCtsDelta(cts_offset);\n } \n\n // set the size\n AP4_Size sample_size = 0;\n if (m_StszAtom) {\n result = m_StszAtom->GetSampleSize(index, sample_size); \n } else if (m_Stz2Atom) {\n result = m_Stz2Atom->GetSampleSize(index, sample_size); \n } else {\n result = AP4_ERROR_INVALID_FORMAT;\n }\n if (AP4_FAILED(result)) return result;\n sample.SetSize(sample_size);\n\n // set the sync flag\n if (m_StssAtom == NULL) {\n sample.SetSync(true);\n } else {\n sample.SetSync(m_StssAtom->IsSampleSync(index));\n }\n\n // set the offset\n sample.SetOffset(offset);\n\n // set the data stream\n sample.SetDataStream(m_SampleStream);\n\n\n return AP4_SUCCESS;\n}","lang":"cpp","vul_type":"cwe-476","sven_meta":{"func_name":"AP4_AtomSampleTable::GetSample","file_name":"Source/C++/Core/Ap4AtomSampleTable.cpp","commit_link":"github.com/axiomatic-systems/Bento4/commit/2f267f89f957088197f4b1fc254632d1645b415d","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#65-f8ef24f24430","input":"acc_ctx_cont(OM_uint32 *minstat,\n\t gss_buffer_t buf,\n\t gss_ctx_id_t *ctx,\n\t gss_buffer_t *responseToken,\n\t gss_buffer_t *mechListMIC,\n\t OM_uint32 *negState,\n\t send_token_flag *return_token)\n{\n\tOM_uint32 ret, tmpmin;\n\tgss_OID supportedMech;\n\tspnego_gss_ctx_id_t sc;\n\tunsigned int len;\n\tunsigned char *ptr, *bufstart;\n\n\tsc = (spnego_gss_ctx_id_t)*ctx;\n\tret = GSS_S_DEFECTIVE_TOKEN;\n\t*negState = REJECT;\n\t*minstat = 0;\n\tsupportedMech = GSS_C_NO_OID;\n\t*return_token = ERROR_TOKEN_SEND;\n\t*responseToken = *mechListMIC = GSS_C_NO_BUFFER;\n\n\tptr = bufstart = buf->value;\n#define REMAIN (buf->length - (ptr - bufstart))\n\tif (REMAIN > INT_MAX)\n\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\n\t/*\n\t * Attempt to work with old Sun SPNEGO.\n\t */\n\tif (*ptr == HEADER_ID) {\n\t\tret = g_verify_token_header(gss_mech_spnego,\n\t\t\t\t\t &len, &ptr, 0, REMAIN);\n\t\tif (ret) {\n\t\t\t*minstat = ret;\n\t\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\t\t}\n\t}\n\tif (*ptr != (CONTEXT | 0x01)) {\n\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\t}\n\tret = get_negTokenResp(minstat, ptr, REMAIN,\n\t\t\t negState, &supportedMech,\n\t\t\t responseToken, mechListMIC);\n\tif (ret != GSS_S_COMPLETE)\n\t\tgoto cleanup;\n\n\tif (*responseToken == GSS_C_NO_BUFFER &&\n\t *mechListMIC == GSS_C_NO_BUFFER) {\n\n\t\tret = GSS_S_DEFECTIVE_TOKEN;\n\t\tgoto cleanup;\n\t}\n\tif (supportedMech != GSS_C_NO_OID) {\n\t\tret = GSS_S_DEFECTIVE_TOKEN;\n\t\tgoto cleanup;\n\t}\n\tsc->firstpass = 0;\n\t*negState = ACCEPT_INCOMPLETE;\n\t*return_token = CONT_TOKEN_SEND;\ncleanup:\n\tif (supportedMech != GSS_C_NO_OID) {\n\t\tgeneric_gss_release_oid(&tmpmin, &supportedMech);\n\t}\n\treturn ret;\n#undef REMAIN\n}","target":"acc_ctx_cont(OM_uint32 *minstat,\n\t gss_buffer_t buf,\n\t gss_ctx_id_t *ctx,\n\t gss_buffer_t *responseToken,\n\t gss_buffer_t *mechListMIC,\n\t OM_uint32 *negState,\n\t send_token_flag *return_token)\n{\n\tOM_uint32 ret, tmpmin;\n\tgss_OID supportedMech;\n\tspnego_gss_ctx_id_t sc;\n\tunsigned int len;\n\tunsigned char *ptr, *bufstart;\n\n\tsc = (spnego_gss_ctx_id_t)*ctx;\n\tret = GSS_S_DEFECTIVE_TOKEN;\n\t*negState = REJECT;\n\t*minstat = 0;\n\tsupportedMech = GSS_C_NO_OID;\n\t*return_token = ERROR_TOKEN_SEND;\n\t*responseToken = *mechListMIC = GSS_C_NO_BUFFER;\n\n\tptr = bufstart = buf->value;\n#define REMAIN (buf->length - (ptr - bufstart))\n\tif (REMAIN == 0 || REMAIN > INT_MAX)\n\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\n\t/*\n\t * Attempt to work with old Sun SPNEGO.\n\t */\n\tif (*ptr == HEADER_ID) {\n\t\tret = g_verify_token_header(gss_mech_spnego,\n\t\t\t\t\t &len, &ptr, 0, REMAIN);\n\t\tif (ret) {\n\t\t\t*minstat = ret;\n\t\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\t\t}\n\t}\n\tif (*ptr != (CONTEXT | 0x01)) {\n\t\treturn GSS_S_DEFECTIVE_TOKEN;\n\t}\n\tret = get_negTokenResp(minstat, ptr, REMAIN,\n\t\t\t negState, &supportedMech,\n\t\t\t responseToken, mechListMIC);\n\tif (ret != GSS_S_COMPLETE)\n\t\tgoto cleanup;\n\n\tif (*responseToken == GSS_C_NO_BUFFER &&\n\t *mechListMIC == GSS_C_NO_BUFFER) {\n\n\t\tret = GSS_S_DEFECTIVE_TOKEN;\n\t\tgoto cleanup;\n\t}\n\tif (supportedMech != GSS_C_NO_OID) {\n\t\tret = GSS_S_DEFECTIVE_TOKEN;\n\t\tgoto cleanup;\n\t}\n\tsc->firstpass = 0;\n\t*negState = ACCEPT_INCOMPLETE;\n\t*return_token = CONT_TOKEN_SEND;\ncleanup:\n\tif (supportedMech != GSS_C_NO_OID) {\n\t\tgeneric_gss_release_oid(&tmpmin, &supportedMech);\n\t}\n\treturn ret;\n#undef REMAIN\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"acc_ctx_cont","file_name":"src/lib/gssapi/spnego/spnego_mech.c","commit_link":"github.com/krb5/krb5/commit/524688ce87a15fc75f87efc8c039ba4c7d5c197b","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#66-006733e045af","input":"static int chmd_read_headers(struct mspack_system *sys, struct mspack_file *fh,\n\t\t\t struct mschmd_header *chm, int entire)\n{\n unsigned int section, name_len, x, errors, num_chunks;\n unsigned char buf[0x54], *chunk = NULL, *name, *p, *end;\n struct mschmd_file *fi, *link = NULL;\n off_t offset, length;\n int num_entries;\n\n /* initialise pointers */\n chm->files = NULL;\n chm->sysfiles = NULL;\n chm->chunk_cache = NULL;\n chm->sec0.base.chm = chm;\n chm->sec0.base.id = 0;\n chm->sec1.base.chm = chm;\n chm->sec1.base.id = 1;\n chm->sec1.content = NULL;\n chm->sec1.control = NULL;\n chm->sec1.spaninfo = NULL;\n chm->sec1.rtable = NULL;\n\n /* read the first header */\n if (sys->read(fh, &buf[0], chmhead_SIZEOF) != chmhead_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n /* check ITSF signature */\n if (EndGetI32(&buf[chmhead_Signature]) != 0x46535449) {\n return MSPACK_ERR_SIGNATURE;\n }\n\n /* check both header GUIDs */\n if (mspack_memcmp(&buf[chmhead_GUID1], &guids[0], 32L) != 0) {\n D((\"incorrect GUIDs\"))\n return MSPACK_ERR_SIGNATURE;\n }\n\n chm->version = EndGetI32(&buf[chmhead_Version]);\n chm->timestamp = EndGetM32(&buf[chmhead_Timestamp]);\n chm->language = EndGetI32(&buf[chmhead_LanguageID]);\n if (chm->version > 3) {\n sys->message(fh, \"WARNING; CHM version > 3\");\n }\n\n /* read the header section table */\n if (sys->read(fh, &buf[0], chmhst3_SIZEOF) != chmhst3_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n /* chmhst3_OffsetCS0 does not exist in version 1 or 2 CHM files.\n * The offset will be corrected later, once HS1 is read.\n */\n if (read_off64(&offset, &buf[chmhst_OffsetHS0], sys, fh) ||\n read_off64(&chm->dir_offset, &buf[chmhst_OffsetHS1], sys, fh) ||\n read_off64(&chm->sec0.offset, &buf[chmhst3_OffsetCS0], sys, fh))\n {\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* seek to header section 0 */\n if (sys->seek(fh, offset, MSPACK_SYS_SEEK_START)) {\n return MSPACK_ERR_SEEK;\n }\n\n /* read header section 0 */\n if (sys->read(fh, &buf[0], chmhs0_SIZEOF) != chmhs0_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n if (read_off64(&chm->length, &buf[chmhs0_FileLen], sys, fh)) {\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* seek to header section 1 */\n if (sys->seek(fh, chm->dir_offset, MSPACK_SYS_SEEK_START)) {\n return MSPACK_ERR_SEEK;\n }\n\n /* read header section 1 */\n if (sys->read(fh, &buf[0], chmhs1_SIZEOF) != chmhs1_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n chm->dir_offset = sys->tell(fh);\n chm->chunk_size = EndGetI32(&buf[chmhs1_ChunkSize]);\n chm->density = EndGetI32(&buf[chmhs1_Density]);\n chm->depth = EndGetI32(&buf[chmhs1_Depth]);\n chm->index_root = EndGetI32(&buf[chmhs1_IndexRoot]);\n chm->num_chunks = EndGetI32(&buf[chmhs1_NumChunks]);\n chm->first_pmgl = EndGetI32(&buf[chmhs1_FirstPMGL]);\n chm->last_pmgl = EndGetI32(&buf[chmhs1_LastPMGL]);\n\n if (chm->version < 3) {\n /* versions before 3 don't have chmhst3_OffsetCS0 */\n chm->sec0.offset = chm->dir_offset + (chm->chunk_size * chm->num_chunks);\n }\n\n /* check if content offset or file size is wrong */\n if (chm->sec0.offset > chm->length) {\n D((\"content section begins after file has ended\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n \n /* ensure there are chunks and that chunk size is\n * large enough for signature and num_entries */\n if (chm->chunk_size < (pmgl_Entries + 2)) {\n D((\"chunk size not large enough\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n if (chm->num_chunks == 0) {\n D((\"no chunks\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* The chunk_cache data structure is not great; large values for num_chunks\n * or num_chunks*chunk_size can exhaust all memory. Until a better chunk\n * cache is implemented, put arbitrary limits on num_chunks and chunk size.\n */\n if (chm->num_chunks > 100000) {\n D((\"more than 100,000 chunks\"))\n return MSPACK_ERR_DATAFORMAT;\n } \n if ((off_t)chm->chunk_size * (off_t)chm->num_chunks > chm->length) {\n D((\"chunks larger than entire file\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* common sense checks on header section 1 fields */\n if ((chm->chunk_size & (chm->chunk_size - 1)) != 0) {\n sys->message(fh, \"WARNING; chunk size is not a power of two\");\n }\n if (chm->first_pmgl != 0) {\n sys->message(fh, \"WARNING; first PMGL chunk is not zero\");\n }\n if (chm->first_pmgl > chm->last_pmgl) {\n D((\"first pmgl chunk is after last pmgl chunk\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n if (chm->index_root != 0xFFFFFFFF && chm->index_root >= chm->num_chunks) {\n D((\"index_root outside valid range\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* if we are doing a quick read, stop here! */\n if (!entire) {\n return MSPACK_ERR_OK;\n }\n\n /* seek to the first PMGL chunk, and reduce the number of chunks to read */\n if ((x = chm->first_pmgl) != 0) {\n if (sys->seek(fh,(off_t) (x * chm->chunk_size), MSPACK_SYS_SEEK_CUR)) {\n return MSPACK_ERR_SEEK;\n }\n }\n num_chunks = chm->last_pmgl - x + 1;\n\n if (!(chunk = (unsigned char *) sys->alloc(sys, (size_t)chm->chunk_size))) {\n return MSPACK_ERR_NOMEMORY;\n }\n\n /* read and process all chunks from FirstPMGL to LastPMGL */\n errors = 0;\n while (num_chunks--) {\n /* read next chunk */\n if (sys->read(fh, chunk, (int)chm->chunk_size) != (int)chm->chunk_size) {\n sys->free(chunk);\n return MSPACK_ERR_READ;\n }\n\n /* process only directory (PMGL) chunks */\n if (EndGetI32(&chunk[pmgl_Signature]) != 0x4C474D50) continue;\n\n if (EndGetI32(&chunk[pmgl_QuickRefSize]) < 2) {\n sys->message(fh, \"WARNING; PMGL quickref area is too small\");\n }\n if (EndGetI32(&chunk[pmgl_QuickRefSize]) > \n\t((int)chm->chunk_size - pmgl_Entries))\n {\n sys->message(fh, \"WARNING; PMGL quickref area is too large\");\n }\n\n p = &chunk[pmgl_Entries];\n end = &chunk[chm->chunk_size - 2];\n num_entries = EndGetI16(end);\n\n while (num_entries--) {\n READ_ENCINT(name_len);\n if (name_len > (unsigned int) (end - p)) goto chunk_end;\n /* consider blank filenames to be an error */\n if (name_len == 0) goto chunk_end;\n name = p; p += name_len;\n\n READ_ENCINT(section);\n READ_ENCINT(offset);\n READ_ENCINT(length);\n\n /* empty files and directory names are stored as a file entry at\n * offset 0 with length 0. We want to keep empty files, but not\n * directory names, which end with a \"/\" */\n if ((offset == 0) && (length == 0)) {\n\tif ((name_len > 0) && (name[name_len-1] == '/')) continue;\n }\n\n if (section > 1) {\n\tsys->message(fh, \"invalid section number '%u'.\", section);\n\tcontinue;\n }\n\n if (!(fi = (struct mschmd_file *) sys->alloc(sys, sizeof(struct mschmd_file) + name_len + 1))) {\n\tsys->free(chunk);\n\treturn MSPACK_ERR_NOMEMORY;\n }\n\n fi->next = NULL;\n fi->filename = (char *) &fi[1];\n fi->section = ((section == 0) ? (struct mschmd_section *) (&chm->sec0)\n\t\t : (struct mschmd_section *) (&chm->sec1));\n fi->offset = offset;\n fi->length = length;\n sys->copy(name, fi->filename, (size_t) name_len);\n fi->filename[name_len] = '\\0';\n\n if (name[0] == ':' && name[1] == ':') {\n\t/* system file */\n\tif (mspack_memcmp(&name[2], &content_name[2], 31L) == 0) {\n\t if (mspack_memcmp(&name[33], &content_name[33], 8L) == 0) {\n\t chm->sec1.content = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &control_name[33], 11L) == 0) {\n\t chm->sec1.control = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &spaninfo_name[33], 8L) == 0) {\n\t chm->sec1.spaninfo = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &rtable_name[33], 72L) == 0) {\n\t chm->sec1.rtable = fi;\n\t }\n\t}\n\tfi->next = chm->sysfiles;\n\tchm->sysfiles = fi;\n }\n else {\n\t/* normal file */\n\tif (link) link->next = fi; else chm->files = fi;\n\tlink = fi;\n }\n }\n\n /* this is reached either when num_entries runs out, or if\n * reading data from the chunk reached a premature end of chunk */\n chunk_end:\n if (num_entries >= 0) {\n D((\"chunk ended before all entries could be read\"))\n errors++;\n }\n\n }\n sys->free(chunk);\n return (errors > 0) ? MSPACK_ERR_DATAFORMAT : MSPACK_ERR_OK;\n}","target":"static int chmd_read_headers(struct mspack_system *sys, struct mspack_file *fh,\n\t\t\t struct mschmd_header *chm, int entire)\n{\n unsigned int section, name_len, x, errors, num_chunks;\n unsigned char buf[0x54], *chunk = NULL, *name, *p, *end;\n struct mschmd_file *fi, *link = NULL;\n off_t offset, length;\n int num_entries;\n\n /* initialise pointers */\n chm->files = NULL;\n chm->sysfiles = NULL;\n chm->chunk_cache = NULL;\n chm->sec0.base.chm = chm;\n chm->sec0.base.id = 0;\n chm->sec1.base.chm = chm;\n chm->sec1.base.id = 1;\n chm->sec1.content = NULL;\n chm->sec1.control = NULL;\n chm->sec1.spaninfo = NULL;\n chm->sec1.rtable = NULL;\n\n /* read the first header */\n if (sys->read(fh, &buf[0], chmhead_SIZEOF) != chmhead_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n /* check ITSF signature */\n if (EndGetI32(&buf[chmhead_Signature]) != 0x46535449) {\n return MSPACK_ERR_SIGNATURE;\n }\n\n /* check both header GUIDs */\n if (mspack_memcmp(&buf[chmhead_GUID1], &guids[0], 32L) != 0) {\n D((\"incorrect GUIDs\"))\n return MSPACK_ERR_SIGNATURE;\n }\n\n chm->version = EndGetI32(&buf[chmhead_Version]);\n chm->timestamp = EndGetM32(&buf[chmhead_Timestamp]);\n chm->language = EndGetI32(&buf[chmhead_LanguageID]);\n if (chm->version > 3) {\n sys->message(fh, \"WARNING; CHM version > 3\");\n }\n\n /* read the header section table */\n if (sys->read(fh, &buf[0], chmhst3_SIZEOF) != chmhst3_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n /* chmhst3_OffsetCS0 does not exist in version 1 or 2 CHM files.\n * The offset will be corrected later, once HS1 is read.\n */\n if (read_off64(&offset, &buf[chmhst_OffsetHS0], sys, fh) ||\n read_off64(&chm->dir_offset, &buf[chmhst_OffsetHS1], sys, fh) ||\n read_off64(&chm->sec0.offset, &buf[chmhst3_OffsetCS0], sys, fh))\n {\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* seek to header section 0 */\n if (sys->seek(fh, offset, MSPACK_SYS_SEEK_START)) {\n return MSPACK_ERR_SEEK;\n }\n\n /* read header section 0 */\n if (sys->read(fh, &buf[0], chmhs0_SIZEOF) != chmhs0_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n if (read_off64(&chm->length, &buf[chmhs0_FileLen], sys, fh)) {\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* seek to header section 1 */\n if (sys->seek(fh, chm->dir_offset, MSPACK_SYS_SEEK_START)) {\n return MSPACK_ERR_SEEK;\n }\n\n /* read header section 1 */\n if (sys->read(fh, &buf[0], chmhs1_SIZEOF) != chmhs1_SIZEOF) {\n return MSPACK_ERR_READ;\n }\n\n chm->dir_offset = sys->tell(fh);\n chm->chunk_size = EndGetI32(&buf[chmhs1_ChunkSize]);\n chm->density = EndGetI32(&buf[chmhs1_Density]);\n chm->depth = EndGetI32(&buf[chmhs1_Depth]);\n chm->index_root = EndGetI32(&buf[chmhs1_IndexRoot]);\n chm->num_chunks = EndGetI32(&buf[chmhs1_NumChunks]);\n chm->first_pmgl = EndGetI32(&buf[chmhs1_FirstPMGL]);\n chm->last_pmgl = EndGetI32(&buf[chmhs1_LastPMGL]);\n\n if (chm->version < 3) {\n /* versions before 3 don't have chmhst3_OffsetCS0 */\n chm->sec0.offset = chm->dir_offset + (chm->chunk_size * chm->num_chunks);\n }\n\n /* check if content offset or file size is wrong */\n if (chm->sec0.offset > chm->length) {\n D((\"content section begins after file has ended\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n \n /* ensure there are chunks and that chunk size is\n * large enough for signature and num_entries */\n if (chm->chunk_size < (pmgl_Entries + 2)) {\n D((\"chunk size not large enough\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n if (chm->num_chunks == 0) {\n D((\"no chunks\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* The chunk_cache data structure is not great; large values for num_chunks\n * or num_chunks*chunk_size can exhaust all memory. Until a better chunk\n * cache is implemented, put arbitrary limits on num_chunks and chunk size.\n */\n if (chm->num_chunks > 100000) {\n D((\"more than 100,000 chunks\"))\n return MSPACK_ERR_DATAFORMAT;\n } \n if ((off_t)chm->chunk_size * (off_t)chm->num_chunks > chm->length) {\n D((\"chunks larger than entire file\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* common sense checks on header section 1 fields */\n if ((chm->chunk_size & (chm->chunk_size - 1)) != 0) {\n sys->message(fh, \"WARNING; chunk size is not a power of two\");\n }\n if (chm->first_pmgl != 0) {\n sys->message(fh, \"WARNING; first PMGL chunk is not zero\");\n }\n if (chm->first_pmgl > chm->last_pmgl) {\n D((\"first pmgl chunk is after last pmgl chunk\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n if (chm->index_root != 0xFFFFFFFF && chm->index_root >= chm->num_chunks) {\n D((\"index_root outside valid range\"))\n return MSPACK_ERR_DATAFORMAT;\n }\n\n /* if we are doing a quick read, stop here! */\n if (!entire) {\n return MSPACK_ERR_OK;\n }\n\n /* seek to the first PMGL chunk, and reduce the number of chunks to read */\n if ((x = chm->first_pmgl) != 0) {\n if (sys->seek(fh,(off_t) (x * chm->chunk_size), MSPACK_SYS_SEEK_CUR)) {\n return MSPACK_ERR_SEEK;\n }\n }\n num_chunks = chm->last_pmgl - x + 1;\n\n if (!(chunk = (unsigned char *) sys->alloc(sys, (size_t)chm->chunk_size))) {\n return MSPACK_ERR_NOMEMORY;\n }\n\n /* read and process all chunks from FirstPMGL to LastPMGL */\n errors = 0;\n while (num_chunks--) {\n /* read next chunk */\n if (sys->read(fh, chunk, (int)chm->chunk_size) != (int)chm->chunk_size) {\n sys->free(chunk);\n return MSPACK_ERR_READ;\n }\n\n /* process only directory (PMGL) chunks */\n if (EndGetI32(&chunk[pmgl_Signature]) != 0x4C474D50) continue;\n\n if (EndGetI32(&chunk[pmgl_QuickRefSize]) < 2) {\n sys->message(fh, \"WARNING; PMGL quickref area is too small\");\n }\n if (EndGetI32(&chunk[pmgl_QuickRefSize]) > \n\t((int)chm->chunk_size - pmgl_Entries))\n {\n sys->message(fh, \"WARNING; PMGL quickref area is too large\");\n }\n\n p = &chunk[pmgl_Entries];\n end = &chunk[chm->chunk_size - 2];\n num_entries = EndGetI16(end);\n\n while (num_entries--) {\n READ_ENCINT(name_len);\n if (name_len > (unsigned int) (end - p)) goto chunk_end;\n name = p; p += name_len;\n READ_ENCINT(section);\n READ_ENCINT(offset);\n READ_ENCINT(length);\n\n /* ignore blank or one-char (e.g. \"/\") filenames we'd return as blank */\n if (name_len < 2 || !name[0] || !name[1]) continue;\n\n /* empty files and directory names are stored as a file entry at\n * offset 0 with length 0. We want to keep empty files, but not\n * directory names, which end with a \"/\" */\n if ((offset == 0) && (length == 0)) {\n\tif ((name_len > 0) && (name[name_len-1] == '/')) continue;\n }\n\n if (section > 1) {\n\tsys->message(fh, \"invalid section number '%u'.\", section);\n\tcontinue;\n }\n\n if (!(fi = (struct mschmd_file *) sys->alloc(sys, sizeof(struct mschmd_file) + name_len + 1))) {\n\tsys->free(chunk);\n\treturn MSPACK_ERR_NOMEMORY;\n }\n\n fi->next = NULL;\n fi->filename = (char *) &fi[1];\n fi->section = ((section == 0) ? (struct mschmd_section *) (&chm->sec0)\n\t\t : (struct mschmd_section *) (&chm->sec1));\n fi->offset = offset;\n fi->length = length;\n sys->copy(name, fi->filename, (size_t) name_len);\n fi->filename[name_len] = '\\0';\n\n if (name[0] == ':' && name[1] == ':') {\n\t/* system file */\n\tif (mspack_memcmp(&name[2], &content_name[2], 31L) == 0) {\n\t if (mspack_memcmp(&name[33], &content_name[33], 8L) == 0) {\n\t chm->sec1.content = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &control_name[33], 11L) == 0) {\n\t chm->sec1.control = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &spaninfo_name[33], 8L) == 0) {\n\t chm->sec1.spaninfo = fi;\n\t }\n\t else if (mspack_memcmp(&name[33], &rtable_name[33], 72L) == 0) {\n\t chm->sec1.rtable = fi;\n\t }\n\t}\n\tfi->next = chm->sysfiles;\n\tchm->sysfiles = fi;\n }\n else {\n\t/* normal file */\n\tif (link) link->next = fi; else chm->files = fi;\n\tlink = fi;\n }\n }\n\n /* this is reached either when num_entries runs out, or if\n * reading data from the chunk reached a premature end of chunk */\n chunk_end:\n if (num_entries >= 0) {\n D((\"chunk ended before all entries could be read\"))\n errors++;\n }\n\n }\n sys->free(chunk);\n return (errors > 0) ? MSPACK_ERR_DATAFORMAT : MSPACK_ERR_OK;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"chmd_read_headers","file_name":"libmspack/mspack/chmd.c","commit_link":"github.com/kyz/libmspack/commit/8759da8db6ec9e866cb8eb143313f397f925bb4f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#67-65d9f9ddfcb5","input":"filter_session_io(struct io *io, int evt, void *arg)\n{\n\tstruct filter_session *fs = arg;\n\tchar *line = NULL;\n\tssize_t len;\n\n\tlog_trace(TRACE_IO, \"filter session: %p: %s %s\", fs, io_strevent(evt),\n\t io_strio(io));\n\n\tswitch (evt) {\n\tcase IO_DATAIN:\n\tnextline:\n\t\tline = io_getline(fs->io, &len);\n\t\t/* No complete line received */\n\t\tif (line == NULL)\n\t\t\treturn;\n\n\t\tfilter_data(fs->id, line);\n\n\t\tgoto nextline;\n\n\tcase IO_DISCONNECTED:\n\t\tio_free(fs->io);\n\t\tfs->io = NULL;\n\t\tbreak;\n\t}\n}","target":"filter_session_io(struct io *io, int evt, void *arg)\n{\n\tstruct filter_session *fs = arg;\n\tchar *line = NULL;\n\tssize_t len;\n\n\tlog_trace(TRACE_IO, \"filter session: %p: %s %s\", fs, io_strevent(evt),\n\t io_strio(io));\n\n\tswitch (evt) {\n\tcase IO_DATAIN:\n\tnextline:\n\t\tline = io_getline(fs->io, &len);\n\t\t/* No complete line received */\n\t\tif (line == NULL)\n\t\t\treturn;\n\n\t\tfilter_data(fs->id, line);\n\n\t\tgoto nextline;\n\t}\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"filter_session_io","file_name":"usr.sbin/smtpd/lka_filter.c","commit_link":"github.com/openbsd/src/commit/6c3220444ed06b5796dedfd53a0f4becd903c0d1","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#68-bfea35aae0ef","input":"int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)\n{\n\tint rc = X86EMUL_CONTINUE;\n\tint mode = ctxt->mode;\n\tint def_op_bytes, def_ad_bytes, goffset, simd_prefix;\n\tbool op_prefix = false;\n\tbool has_seg_override = false;\n\tstruct opcode opcode;\n\n\tctxt->memop.type = OP_NONE;\n\tctxt->memopp = NULL;\n\tctxt->_eip = ctxt->eip;\n\tctxt->fetch.ptr = ctxt->fetch.data;\n\tctxt->fetch.end = ctxt->fetch.data + insn_len;\n\tctxt->opcode_len = 1;\n\tif (insn_len > 0)\n\t\tmemcpy(ctxt->fetch.data, insn, insn_len);\n\telse {\n\t\trc = __do_insn_fetch_bytes(ctxt, 1);\n\t\tif (rc != X86EMUL_CONTINUE)\n\t\t\treturn rc;\n\t}\n\n\tswitch (mode) {\n\tcase X86EMUL_MODE_REAL:\n\tcase X86EMUL_MODE_VM86:\n\tcase X86EMUL_MODE_PROT16:\n\t\tdef_op_bytes = def_ad_bytes = 2;\n\t\tbreak;\n\tcase X86EMUL_MODE_PROT32:\n\t\tdef_op_bytes = def_ad_bytes = 4;\n\t\tbreak;\n#ifdef CONFIG_X86_64\n\tcase X86EMUL_MODE_PROT64:\n\t\tdef_op_bytes = 4;\n\t\tdef_ad_bytes = 8;\n\t\tbreak;\n#endif\n\tdefault:\n\t\treturn EMULATION_FAILED;\n\t}\n\n\tctxt->op_bytes = def_op_bytes;\n\tctxt->ad_bytes = def_ad_bytes;\n\n\t/* Legacy prefixes. */\n\tfor (;;) {\n\t\tswitch (ctxt->b = insn_fetch(u8, ctxt)) {\n\t\tcase 0x66:\t/* operand-size override */\n\t\t\top_prefix = true;\n\t\t\t/* switch between 2/4 bytes */\n\t\t\tctxt->op_bytes = def_op_bytes ^ 6;\n\t\t\tbreak;\n\t\tcase 0x67:\t/* address-size override */\n\t\t\tif (mode == X86EMUL_MODE_PROT64)\n\t\t\t\t/* switch between 4/8 bytes */\n\t\t\t\tctxt->ad_bytes = def_ad_bytes ^ 12;\n\t\t\telse\n\t\t\t\t/* switch between 2/4 bytes */\n\t\t\t\tctxt->ad_bytes = def_ad_bytes ^ 6;\n\t\t\tbreak;\n\t\tcase 0x26:\t/* ES override */\n\t\tcase 0x2e:\t/* CS override */\n\t\tcase 0x36:\t/* SS override */\n\t\tcase 0x3e:\t/* DS override */\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = (ctxt->b >> 3) & 3;\n\t\t\tbreak;\n\t\tcase 0x64:\t/* FS override */\n\t\tcase 0x65:\t/* GS override */\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = ctxt->b & 7;\n\t\t\tbreak;\n\t\tcase 0x40 ... 0x4f: /* REX */\n\t\t\tif (mode != X86EMUL_MODE_PROT64)\n\t\t\t\tgoto done_prefixes;\n\t\t\tctxt->rex_prefix = ctxt->b;\n\t\t\tcontinue;\n\t\tcase 0xf0:\t/* LOCK */\n\t\t\tctxt->lock_prefix = 1;\n\t\t\tbreak;\n\t\tcase 0xf2:\t/* REPNE/REPNZ */\n\t\tcase 0xf3:\t/* REP/REPE/REPZ */\n\t\t\tctxt->rep_prefix = ctxt->b;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tgoto done_prefixes;\n\t\t}\n\n\t\t/* Any legacy prefix after a REX prefix nullifies its effect. */\n\n\t\tctxt->rex_prefix = 0;\n\t}\n\ndone_prefixes:\n\n\t/* REX prefix. */\n\tif (ctxt->rex_prefix & 8)\n\t\tctxt->op_bytes = 8;\t/* REX.W */\n\n\t/* Opcode byte(s). */\n\topcode = opcode_table[ctxt->b];\n\t/* Two-byte opcode? */\n\tif (ctxt->b == 0x0f) {\n\t\tctxt->opcode_len = 2;\n\t\tctxt->b = insn_fetch(u8, ctxt);\n\t\topcode = twobyte_table[ctxt->b];\n\n\t\t/* 0F_38 opcode map */\n\t\tif (ctxt->b == 0x38) {\n\t\t\tctxt->opcode_len = 3;\n\t\t\tctxt->b = insn_fetch(u8, ctxt);\n\t\t\topcode = opcode_map_0f_38[ctxt->b];\n\t\t}\n\t}\n\tctxt->d = opcode.flags;\n\n\tif (ctxt->d & ModRM)\n\t\tctxt->modrm = insn_fetch(u8, ctxt);\n\n\t/* vex-prefix instructions are not implemented */\n\tif (ctxt->opcode_len == 1 && (ctxt->b == 0xc5 || ctxt->b == 0xc4) &&\n\t (mode == X86EMUL_MODE_PROT64 || (ctxt->modrm & 0xc0) == 0xc0)) {\n\t\tctxt->d = NotImpl;\n\t}\n\n\twhile (ctxt->d & GroupMask) {\n\t\tswitch (ctxt->d & GroupMask) {\n\t\tcase Group:\n\t\t\tgoffset = (ctxt->modrm >> 3) & 7;\n\t\t\topcode = opcode.u.group[goffset];\n\t\t\tbreak;\n\t\tcase GroupDual:\n\t\t\tgoffset = (ctxt->modrm >> 3) & 7;\n\t\t\tif ((ctxt->modrm >> 6) == 3)\n\t\t\t\topcode = opcode.u.gdual->mod3[goffset];\n\t\t\telse\n\t\t\t\topcode = opcode.u.gdual->mod012[goffset];\n\t\t\tbreak;\n\t\tcase RMExt:\n\t\t\tgoffset = ctxt->modrm & 7;\n\t\t\topcode = opcode.u.group[goffset];\n\t\t\tbreak;\n\t\tcase Prefix:\n\t\t\tif (ctxt->rep_prefix && op_prefix)\n\t\t\t\treturn EMULATION_FAILED;\n\t\t\tsimd_prefix = op_prefix ? 0x66 : ctxt->rep_prefix;\n\t\t\tswitch (simd_prefix) {\n\t\t\tcase 0x00: opcode = opcode.u.gprefix->pfx_no; break;\n\t\t\tcase 0x66: opcode = opcode.u.gprefix->pfx_66; break;\n\t\t\tcase 0xf2: opcode = opcode.u.gprefix->pfx_f2; break;\n\t\t\tcase 0xf3: opcode = opcode.u.gprefix->pfx_f3; break;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase Escape:\n\t\t\tif (ctxt->modrm > 0xbf)\n\t\t\t\topcode = opcode.u.esc->high[ctxt->modrm - 0xc0];\n\t\t\telse\n\t\t\t\topcode = opcode.u.esc->op[(ctxt->modrm >> 3) & 7];\n\t\t\tbreak;\n\t\tcase InstrDual:\n\t\t\tif ((ctxt->modrm >> 6) == 3)\n\t\t\t\topcode = opcode.u.idual->mod3;\n\t\t\telse\n\t\t\t\topcode = opcode.u.idual->mod012;\n\t\t\tbreak;\n\t\tcase ModeDual:\n\t\t\tif (ctxt->mode == X86EMUL_MODE_PROT64)\n\t\t\t\topcode = opcode.u.mdual->mode64;\n\t\t\telse\n\t\t\t\topcode = opcode.u.mdual->mode32;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn EMULATION_FAILED;\n\t\t}\n\n\t\tctxt->d &= ~(u64)GroupMask;\n\t\tctxt->d |= opcode.flags;\n\t}\n\n\t/* Unrecognised? */\n\tif (ctxt->d == 0)\n\t\treturn EMULATION_FAILED;\n\n\tctxt->execute = opcode.u.execute;\n\n\tif (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD)))\n\t\treturn EMULATION_FAILED;\n\n\tif (unlikely(ctxt->d &\n\t (NotImpl|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm|NearBranch|\n\t No16))) {\n\t\t/*\n\t\t * These are copied unconditionally here, and checked unconditionally\n\t\t * in x86_emulate_insn.\n\t\t */\n\t\tctxt->check_perm = opcode.check_perm;\n\t\tctxt->intercept = opcode.intercept;\n\n\t\tif (ctxt->d & NotImpl)\n\t\t\treturn EMULATION_FAILED;\n\n\t\tif (mode == X86EMUL_MODE_PROT64) {\n\t\t\tif (ctxt->op_bytes == 4 && (ctxt->d & Stack))\n\t\t\t\tctxt->op_bytes = 8;\n\t\t\telse if (ctxt->d & NearBranch)\n\t\t\t\tctxt->op_bytes = 8;\n\t\t}\n\n\t\tif (ctxt->d & Op3264) {\n\t\t\tif (mode == X86EMUL_MODE_PROT64)\n\t\t\t\tctxt->op_bytes = 8;\n\t\t\telse\n\t\t\t\tctxt->op_bytes = 4;\n\t\t}\n\n\t\tif ((ctxt->d & No16) && ctxt->op_bytes == 2)\n\t\t\tctxt->op_bytes = 4;\n\n\t\tif (ctxt->d & Sse)\n\t\t\tctxt->op_bytes = 16;\n\t\telse if (ctxt->d & Mmx)\n\t\t\tctxt->op_bytes = 8;\n\t}\n\n\t/* ModRM and SIB bytes. */\n\tif (ctxt->d & ModRM) {\n\t\trc = decode_modrm(ctxt, &ctxt->memop);\n\t\tif (!has_seg_override) {\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = ctxt->modrm_seg;\n\t\t}\n\t} else if (ctxt->d & MemAbs)\n\t\trc = decode_abs(ctxt, &ctxt->memop);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\tif (!has_seg_override)\n\t\tctxt->seg_override = VCPU_SREG_DS;\n\n\tctxt->memop.addr.mem.seg = ctxt->seg_override;\n\n\t/*\n\t * Decode and fetch the source operand: register, memory\n\t * or immediate.\n\t */\n\trc = decode_operand(ctxt, &ctxt->src, (ctxt->d >> SrcShift) & OpMask);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\t/*\n\t * Decode and fetch the second source operand: register, memory\n\t * or immediate.\n\t */\n\trc = decode_operand(ctxt, &ctxt->src2, (ctxt->d >> Src2Shift) & OpMask);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\t/* Decode and fetch the destination operand: register or memory. */\n\trc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask);\n\n\tif (ctxt->rip_relative)\n\t\tctxt->memopp->addr.mem.ea = address_mask(ctxt,\n\t\t\t\t\tctxt->memopp->addr.mem.ea + ctxt->_eip);\n\ndone:\n\treturn (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK;\n}","target":"int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)\n{\n\tint rc = X86EMUL_CONTINUE;\n\tint mode = ctxt->mode;\n\tint def_op_bytes, def_ad_bytes, goffset, simd_prefix;\n\tbool op_prefix = false;\n\tbool has_seg_override = false;\n\tstruct opcode opcode;\n\n\tctxt->memop.type = OP_NONE;\n\tctxt->memopp = NULL;\n\tctxt->_eip = ctxt->eip;\n\tctxt->fetch.ptr = ctxt->fetch.data;\n\tctxt->fetch.end = ctxt->fetch.data + insn_len;\n\tctxt->opcode_len = 1;\n\tif (insn_len > 0)\n\t\tmemcpy(ctxt->fetch.data, insn, insn_len);\n\telse {\n\t\trc = __do_insn_fetch_bytes(ctxt, 1);\n\t\tif (rc != X86EMUL_CONTINUE)\n\t\t\treturn rc;\n\t}\n\n\tswitch (mode) {\n\tcase X86EMUL_MODE_REAL:\n\tcase X86EMUL_MODE_VM86:\n\tcase X86EMUL_MODE_PROT16:\n\t\tdef_op_bytes = def_ad_bytes = 2;\n\t\tbreak;\n\tcase X86EMUL_MODE_PROT32:\n\t\tdef_op_bytes = def_ad_bytes = 4;\n\t\tbreak;\n#ifdef CONFIG_X86_64\n\tcase X86EMUL_MODE_PROT64:\n\t\tdef_op_bytes = 4;\n\t\tdef_ad_bytes = 8;\n\t\tbreak;\n#endif\n\tdefault:\n\t\treturn EMULATION_FAILED;\n\t}\n\n\tctxt->op_bytes = def_op_bytes;\n\tctxt->ad_bytes = def_ad_bytes;\n\n\t/* Legacy prefixes. */\n\tfor (;;) {\n\t\tswitch (ctxt->b = insn_fetch(u8, ctxt)) {\n\t\tcase 0x66:\t/* operand-size override */\n\t\t\top_prefix = true;\n\t\t\t/* switch between 2/4 bytes */\n\t\t\tctxt->op_bytes = def_op_bytes ^ 6;\n\t\t\tbreak;\n\t\tcase 0x67:\t/* address-size override */\n\t\t\tif (mode == X86EMUL_MODE_PROT64)\n\t\t\t\t/* switch between 4/8 bytes */\n\t\t\t\tctxt->ad_bytes = def_ad_bytes ^ 12;\n\t\t\telse\n\t\t\t\t/* switch between 2/4 bytes */\n\t\t\t\tctxt->ad_bytes = def_ad_bytes ^ 6;\n\t\t\tbreak;\n\t\tcase 0x26:\t/* ES override */\n\t\tcase 0x2e:\t/* CS override */\n\t\tcase 0x36:\t/* SS override */\n\t\tcase 0x3e:\t/* DS override */\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = (ctxt->b >> 3) & 3;\n\t\t\tbreak;\n\t\tcase 0x64:\t/* FS override */\n\t\tcase 0x65:\t/* GS override */\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = ctxt->b & 7;\n\t\t\tbreak;\n\t\tcase 0x40 ... 0x4f: /* REX */\n\t\t\tif (mode != X86EMUL_MODE_PROT64)\n\t\t\t\tgoto done_prefixes;\n\t\t\tctxt->rex_prefix = ctxt->b;\n\t\t\tcontinue;\n\t\tcase 0xf0:\t/* LOCK */\n\t\t\tctxt->lock_prefix = 1;\n\t\t\tbreak;\n\t\tcase 0xf2:\t/* REPNE/REPNZ */\n\t\tcase 0xf3:\t/* REP/REPE/REPZ */\n\t\t\tctxt->rep_prefix = ctxt->b;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tgoto done_prefixes;\n\t\t}\n\n\t\t/* Any legacy prefix after a REX prefix nullifies its effect. */\n\n\t\tctxt->rex_prefix = 0;\n\t}\n\ndone_prefixes:\n\n\t/* REX prefix. */\n\tif (ctxt->rex_prefix & 8)\n\t\tctxt->op_bytes = 8;\t/* REX.W */\n\n\t/* Opcode byte(s). */\n\topcode = opcode_table[ctxt->b];\n\t/* Two-byte opcode? */\n\tif (ctxt->b == 0x0f) {\n\t\tctxt->opcode_len = 2;\n\t\tctxt->b = insn_fetch(u8, ctxt);\n\t\topcode = twobyte_table[ctxt->b];\n\n\t\t/* 0F_38 opcode map */\n\t\tif (ctxt->b == 0x38) {\n\t\t\tctxt->opcode_len = 3;\n\t\t\tctxt->b = insn_fetch(u8, ctxt);\n\t\t\topcode = opcode_map_0f_38[ctxt->b];\n\t\t}\n\t}\n\tctxt->d = opcode.flags;\n\n\tif (ctxt->d & ModRM)\n\t\tctxt->modrm = insn_fetch(u8, ctxt);\n\n\t/* vex-prefix instructions are not implemented */\n\tif (ctxt->opcode_len == 1 && (ctxt->b == 0xc5 || ctxt->b == 0xc4) &&\n\t (mode == X86EMUL_MODE_PROT64 || (ctxt->modrm & 0xc0) == 0xc0)) {\n\t\tctxt->d = NotImpl;\n\t}\n\n\twhile (ctxt->d & GroupMask) {\n\t\tswitch (ctxt->d & GroupMask) {\n\t\tcase Group:\n\t\t\tgoffset = (ctxt->modrm >> 3) & 7;\n\t\t\topcode = opcode.u.group[goffset];\n\t\t\tbreak;\n\t\tcase GroupDual:\n\t\t\tgoffset = (ctxt->modrm >> 3) & 7;\n\t\t\tif ((ctxt->modrm >> 6) == 3)\n\t\t\t\topcode = opcode.u.gdual->mod3[goffset];\n\t\t\telse\n\t\t\t\topcode = opcode.u.gdual->mod012[goffset];\n\t\t\tbreak;\n\t\tcase RMExt:\n\t\t\tgoffset = ctxt->modrm & 7;\n\t\t\topcode = opcode.u.group[goffset];\n\t\t\tbreak;\n\t\tcase Prefix:\n\t\t\tif (ctxt->rep_prefix && op_prefix)\n\t\t\t\treturn EMULATION_FAILED;\n\t\t\tsimd_prefix = op_prefix ? 0x66 : ctxt->rep_prefix;\n\t\t\tswitch (simd_prefix) {\n\t\t\tcase 0x00: opcode = opcode.u.gprefix->pfx_no; break;\n\t\t\tcase 0x66: opcode = opcode.u.gprefix->pfx_66; break;\n\t\t\tcase 0xf2: opcode = opcode.u.gprefix->pfx_f2; break;\n\t\t\tcase 0xf3: opcode = opcode.u.gprefix->pfx_f3; break;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase Escape:\n\t\t\tif (ctxt->modrm > 0xbf)\n\t\t\t\topcode = opcode.u.esc->high[ctxt->modrm - 0xc0];\n\t\t\telse\n\t\t\t\topcode = opcode.u.esc->op[(ctxt->modrm >> 3) & 7];\n\t\t\tbreak;\n\t\tcase InstrDual:\n\t\t\tif ((ctxt->modrm >> 6) == 3)\n\t\t\t\topcode = opcode.u.idual->mod3;\n\t\t\telse\n\t\t\t\topcode = opcode.u.idual->mod012;\n\t\t\tbreak;\n\t\tcase ModeDual:\n\t\t\tif (ctxt->mode == X86EMUL_MODE_PROT64)\n\t\t\t\topcode = opcode.u.mdual->mode64;\n\t\t\telse\n\t\t\t\topcode = opcode.u.mdual->mode32;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn EMULATION_FAILED;\n\t\t}\n\n\t\tctxt->d &= ~(u64)GroupMask;\n\t\tctxt->d |= opcode.flags;\n\t}\n\n\t/* Unrecognised? */\n\tif (ctxt->d == 0)\n\t\treturn EMULATION_FAILED;\n\n\tctxt->execute = opcode.u.execute;\n\n\tif (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD)))\n\t\treturn EMULATION_FAILED;\n\n\tif (unlikely(ctxt->d &\n\t (NotImpl|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm|NearBranch|\n\t No16))) {\n\t\t/*\n\t\t * These are copied unconditionally here, and checked unconditionally\n\t\t * in x86_emulate_insn.\n\t\t */\n\t\tctxt->check_perm = opcode.check_perm;\n\t\tctxt->intercept = opcode.intercept;\n\n\t\tif (ctxt->d & NotImpl)\n\t\t\treturn EMULATION_FAILED;\n\n\t\tif (mode == X86EMUL_MODE_PROT64) {\n\t\t\tif (ctxt->op_bytes == 4 && (ctxt->d & Stack))\n\t\t\t\tctxt->op_bytes = 8;\n\t\t\telse if (ctxt->d & NearBranch)\n\t\t\t\tctxt->op_bytes = 8;\n\t\t}\n\n\t\tif (ctxt->d & Op3264) {\n\t\t\tif (mode == X86EMUL_MODE_PROT64)\n\t\t\t\tctxt->op_bytes = 8;\n\t\t\telse\n\t\t\t\tctxt->op_bytes = 4;\n\t\t}\n\n\t\tif ((ctxt->d & No16) && ctxt->op_bytes == 2)\n\t\t\tctxt->op_bytes = 4;\n\n\t\tif (ctxt->d & Sse)\n\t\t\tctxt->op_bytes = 16;\n\t\telse if (ctxt->d & Mmx)\n\t\t\tctxt->op_bytes = 8;\n\t}\n\n\t/* ModRM and SIB bytes. */\n\tif (ctxt->d & ModRM) {\n\t\trc = decode_modrm(ctxt, &ctxt->memop);\n\t\tif (!has_seg_override) {\n\t\t\thas_seg_override = true;\n\t\t\tctxt->seg_override = ctxt->modrm_seg;\n\t\t}\n\t} else if (ctxt->d & MemAbs)\n\t\trc = decode_abs(ctxt, &ctxt->memop);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\tif (!has_seg_override)\n\t\tctxt->seg_override = VCPU_SREG_DS;\n\n\tctxt->memop.addr.mem.seg = ctxt->seg_override;\n\n\t/*\n\t * Decode and fetch the source operand: register, memory\n\t * or immediate.\n\t */\n\trc = decode_operand(ctxt, &ctxt->src, (ctxt->d >> SrcShift) & OpMask);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\t/*\n\t * Decode and fetch the second source operand: register, memory\n\t * or immediate.\n\t */\n\trc = decode_operand(ctxt, &ctxt->src2, (ctxt->d >> Src2Shift) & OpMask);\n\tif (rc != X86EMUL_CONTINUE)\n\t\tgoto done;\n\n\t/* Decode and fetch the destination operand: register or memory. */\n\trc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask);\n\n\tif (ctxt->rip_relative && likely(ctxt->memopp))\n\t\tctxt->memopp->addr.mem.ea = address_mask(ctxt,\n\t\t\t\t\tctxt->memopp->addr.mem.ea + ctxt->_eip);\n\ndone:\n\treturn (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"x86_decode_insn","file_name":"arch/x86/kvm/emulate.c","commit_link":"github.com/torvalds/linux/commit/d9092f52d7e61dd1557f2db2400ddb430e85937e","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#69-06c6e0f8aaad","input":"int expand_downwards(struct vm_area_struct *vma,\n\t\t\t\t unsigned long address)\n{\n\tstruct mm_struct *mm = vma->vm_mm;\n\tstruct vm_area_struct *prev;\n\tint error;\n\n\taddress &= PAGE_MASK;\n\terror = security_mmap_addr(address);\n\tif (error)\n\t\treturn error;\n\n\t/* Enforce stack_guard_gap */\n\tprev = vma->vm_prev;\n\t/* Check that both stack segments have the same anon_vma? */\n\tif (prev && !(prev->vm_flags & VM_GROWSDOWN) &&\n\t\t\t(prev->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {\n\t\tif (address - prev->vm_end < stack_guard_gap)\n\t\t\treturn -ENOMEM;\n\t}\n\n\t/* We must make sure the anon_vma is allocated. */\n\tif (unlikely(anon_vma_prepare(vma)))\n\t\treturn -ENOMEM;\n\n\t/*\n\t * vma->vm_start/vm_end cannot change under us because the caller\n\t * is required to hold the mmap_sem in read mode. We need the\n\t * anon_vma lock to serialize against concurrent expand_stacks.\n\t */\n\tanon_vma_lock_write(vma->anon_vma);\n\n\t/* Somebody else might have raced and expanded it already */\n\tif (address < vma->vm_start) {\n\t\tunsigned long size, grow;\n\n\t\tsize = vma->vm_end - address;\n\t\tgrow = (vma->vm_start - address) >> PAGE_SHIFT;\n\n\t\terror = -ENOMEM;\n\t\tif (grow <= vma->vm_pgoff) {\n\t\t\terror = acct_stack_growth(vma, size, grow);\n\t\t\tif (!error) {\n\t\t\t\t/*\n\t\t\t\t * vma_gap_update() doesn't support concurrent\n\t\t\t\t * updates, but we only hold a shared mmap_sem\n\t\t\t\t * lock here, so we need to protect against\n\t\t\t\t * concurrent vma expansions.\n\t\t\t\t * anon_vma_lock_write() doesn't help here, as\n\t\t\t\t * we don't guarantee that all growable vmas\n\t\t\t\t * in a mm share the same root anon vma.\n\t\t\t\t * So, we reuse mm->page_table_lock to guard\n\t\t\t\t * against concurrent vma expansions.\n\t\t\t\t */\n\t\t\t\tspin_lock(&mm->page_table_lock);\n\t\t\t\tif (vma->vm_flags & VM_LOCKED)\n\t\t\t\t\tmm->locked_vm += grow;\n\t\t\t\tvm_stat_account(mm, vma->vm_flags, grow);\n\t\t\t\tanon_vma_interval_tree_pre_update_vma(vma);\n\t\t\t\tvma->vm_start = address;\n\t\t\t\tvma->vm_pgoff -= grow;\n\t\t\t\tanon_vma_interval_tree_post_update_vma(vma);\n\t\t\t\tvma_gap_update(vma);\n\t\t\t\tspin_unlock(&mm->page_table_lock);\n\n\t\t\t\tperf_event_mmap(vma);\n\t\t\t}\n\t\t}\n\t}\n\tanon_vma_unlock_write(vma->anon_vma);\n\tkhugepaged_enter_vma_merge(vma, vma->vm_flags);\n\tvalidate_mm(mm);\n\treturn error;\n}","target":"int expand_downwards(struct vm_area_struct *vma,\n\t\t\t\t unsigned long address)\n{\n\tstruct mm_struct *mm = vma->vm_mm;\n\tstruct vm_area_struct *prev;\n\tint error = 0;\n\n\taddress &= PAGE_MASK;\n\tif (address < mmap_min_addr)\n\t\treturn -EPERM;\n\n\t/* Enforce stack_guard_gap */\n\tprev = vma->vm_prev;\n\t/* Check that both stack segments have the same anon_vma? */\n\tif (prev && !(prev->vm_flags & VM_GROWSDOWN) &&\n\t\t\t(prev->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {\n\t\tif (address - prev->vm_end < stack_guard_gap)\n\t\t\treturn -ENOMEM;\n\t}\n\n\t/* We must make sure the anon_vma is allocated. */\n\tif (unlikely(anon_vma_prepare(vma)))\n\t\treturn -ENOMEM;\n\n\t/*\n\t * vma->vm_start/vm_end cannot change under us because the caller\n\t * is required to hold the mmap_sem in read mode. We need the\n\t * anon_vma lock to serialize against concurrent expand_stacks.\n\t */\n\tanon_vma_lock_write(vma->anon_vma);\n\n\t/* Somebody else might have raced and expanded it already */\n\tif (address < vma->vm_start) {\n\t\tunsigned long size, grow;\n\n\t\tsize = vma->vm_end - address;\n\t\tgrow = (vma->vm_start - address) >> PAGE_SHIFT;\n\n\t\terror = -ENOMEM;\n\t\tif (grow <= vma->vm_pgoff) {\n\t\t\terror = acct_stack_growth(vma, size, grow);\n\t\t\tif (!error) {\n\t\t\t\t/*\n\t\t\t\t * vma_gap_update() doesn't support concurrent\n\t\t\t\t * updates, but we only hold a shared mmap_sem\n\t\t\t\t * lock here, so we need to protect against\n\t\t\t\t * concurrent vma expansions.\n\t\t\t\t * anon_vma_lock_write() doesn't help here, as\n\t\t\t\t * we don't guarantee that all growable vmas\n\t\t\t\t * in a mm share the same root anon vma.\n\t\t\t\t * So, we reuse mm->page_table_lock to guard\n\t\t\t\t * against concurrent vma expansions.\n\t\t\t\t */\n\t\t\t\tspin_lock(&mm->page_table_lock);\n\t\t\t\tif (vma->vm_flags & VM_LOCKED)\n\t\t\t\t\tmm->locked_vm += grow;\n\t\t\t\tvm_stat_account(mm, vma->vm_flags, grow);\n\t\t\t\tanon_vma_interval_tree_pre_update_vma(vma);\n\t\t\t\tvma->vm_start = address;\n\t\t\t\tvma->vm_pgoff -= grow;\n\t\t\t\tanon_vma_interval_tree_post_update_vma(vma);\n\t\t\t\tvma_gap_update(vma);\n\t\t\t\tspin_unlock(&mm->page_table_lock);\n\n\t\t\t\tperf_event_mmap(vma);\n\t\t\t}\n\t\t}\n\t}\n\tanon_vma_unlock_write(vma->anon_vma);\n\tkhugepaged_enter_vma_merge(vma, vma->vm_flags);\n\tvalidate_mm(mm);\n\treturn error;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"expand_downwards","file_name":"mm/mmap.c","commit_link":"github.com/torvalds/linux/commit/0a1d52994d440e21def1c2174932410b4f2a98a1","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-416#0-eb9b3e8040bf","input":"static void disk_seqf_stop(struct seq_file *seqf, void *v)\n{\n\tstruct class_dev_iter *iter = seqf->private;\n\n\t/* stop is called even after start failed :-( */\n\tif (iter) {\n\t\tclass_dev_iter_exit(iter);\n\t\tkfree(iter);\n\t}\n}","target":"static void disk_seqf_stop(struct seq_file *seqf, void *v)\n{\n\tstruct class_dev_iter *iter = seqf->private;\n\n\t/* stop is called even after start failed :-( */\n\tif (iter) {\n\t\tclass_dev_iter_exit(iter);\n\t\tkfree(iter);\n\t\tseqf->private = NULL;\n\t}\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"disk_seqf_stop","file_name":"block/genhd.c","commit_link":"github.com/torvalds/linux/commit/77da160530dd1dc94f6ae15a981f24e5f0021e84","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#1-c9c73052250c","input":"dbd_st_fetch(SV *sth, imp_sth_t* imp_sth)\n{\n dTHX;\n int num_fields, ChopBlanks, i, rc;\n unsigned long *lengths;\n AV *av;\n int av_length, av_readonly;\n MYSQL_ROW cols;\n D_imp_dbh_from_sth;\n MYSQL* svsock= imp_dbh->pmysql;\n imp_sth_fbh_t *fbh;\n D_imp_xxh(sth);\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n MYSQL_BIND *buffer;\n#endif\n MYSQL_FIELD *fields;\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t-> dbd_st_fetch\\n\");\n\n#if MYSQL_ASYNC\n if(imp_dbh->async_query_in_flight) {\n if(mysql_db_async_result(sth, &imp_sth->result) <= 0) {\n return Nullav;\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (!DBIc_ACTIVE(imp_sth) )\n {\n do_error(sth, JW_ERR_SEQUENCE, \"no statement executing\\n\",NULL);\n return Nullav;\n }\n\n if (imp_sth->fetch_done)\n {\n do_error(sth, JW_ERR_SEQUENCE, \"fetch() but fetch already done\",NULL);\n return Nullav;\n }\n\n if (!imp_sth->done_desc)\n {\n if (!dbd_describe(sth, imp_sth))\n {\n do_error(sth, JW_ERR_SEQUENCE, \"Error while describe result set.\",\n NULL);\n return Nullav;\n }\n }\n }\n#endif\n\n ChopBlanks = DBIc_is(imp_sth, DBIcf_ChopBlanks);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tdbd_st_fetch for %p, chopblanks %d\\n\",\n sth, ChopBlanks);\n\n if (!imp_sth->result)\n {\n do_error(sth, JW_ERR_SEQUENCE, \"fetch() without execute()\" ,NULL);\n return Nullav;\n }\n\n /* fix from 2.9008 */\n imp_dbh->pmysql->net.last_errno = 0;\n\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch calling mysql_fetch\\n\");\n\n if ((rc= mysql_stmt_fetch(imp_sth->stmt)))\n {\n if (rc == 1)\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_stmt_sqlstate(imp_sth->stmt));\n\n#if MYSQL_VERSION_ID >= MYSQL_VERSION_5_0 \n if (rc == MYSQL_DATA_TRUNCATED) {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch data truncated\\n\");\n goto process;\n }\n#endif\n\n if (rc == MYSQL_NO_DATA)\n {\n /* Update row_num to affected_rows value */\n imp_sth->row_num= mysql_stmt_affected_rows(imp_sth->stmt);\n imp_sth->fetch_done=1;\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch no data\\n\");\n }\n\n dbd_st_finish(sth, imp_sth);\n\n return Nullav;\n }\n\nprocess:\n imp_sth->currow++;\n\n av= DBIc_DBISTATE(imp_sth)->get_fbav(imp_sth);\n num_fields=mysql_stmt_field_count(imp_sth->stmt);\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tdbd_st_fetch called mysql_fetch, rc %d num_fields %d\\n\",\n rc, num_fields);\n\n for (\n buffer= imp_sth->buffer,\n fbh= imp_sth->fbh,\n i= 0;\n i < num_fields;\n i++,\n fbh++,\n buffer++\n )\n {\n SV *sv= AvARRAY(av)[i]; /* Note: we (re)use the SV in the AV\t*/\n STRLEN len;\n\n /* This is wrong, null is not being set correctly\n * This is not the way to determine length (this would break blobs!)\n */\n if (fbh->is_null)\n (void) SvOK_off(sv); /* Field is NULL, return undef */\n else\n {\n /* In case of BLOB/TEXT fields we allocate only 8192 bytes\n in dbd_describe() for data. Here we know real size of field\n so we should increase buffer size and refetch column value\n */\n if (fbh->length > buffer->buffer_length || fbh->error)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tRefetch BLOB/TEXT column: %d, length: %lu, error: %d\\n\",\n i, fbh->length, fbh->error);\n\n Renew(fbh->data, fbh->length, char);\n buffer->buffer_length= fbh->length;\n buffer->buffer= (char *) fbh->data;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) {\n int j;\n int m = MIN(*buffer->length, buffer->buffer_length);\n char *ptr = (char*)buffer->buffer;\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\t\\tbefore buffer->buffer: \");\n for (j = 0; j < m; j++) {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"%c\", *ptr++);\n }\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\n\");\n }\n\n /*TODO: Use offset instead of 0 to fetch only remain part of data*/\n if (mysql_stmt_fetch_column(imp_sth->stmt, buffer , i, 0))\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_stmt_sqlstate(imp_sth->stmt));\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) {\n int j;\n int m = MIN(*buffer->length, buffer->buffer_length);\n char *ptr = (char*)buffer->buffer;\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\t\\tafter buffer->buffer: \");\n for (j = 0; j < m; j++) {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"%c\", *ptr++);\n }\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\n\");\n }\n }\n\n /* This does look a lot like Georg's PHP driver doesn't it? --Brian */\n /* Credit due to Georg - mysqli_api.c ;) --PMG */\n switch (buffer->buffer_type) {\n case MYSQL_TYPE_DOUBLE:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tst_fetch double data %f\\n\", fbh->ddata);\n sv_setnv(sv, fbh->ddata);\n break;\n\n case MYSQL_TYPE_LONG:\n case MYSQL_TYPE_LONGLONG:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tst_fetch int data %\"IVdf\", unsigned? %d\\n\",\n fbh->ldata, buffer->is_unsigned);\n if (buffer->is_unsigned)\n sv_setuv(sv, fbh->ldata);\n else\n sv_setiv(sv, fbh->ldata);\n\n break;\n\n case MYSQL_TYPE_BIT:\n sv_setpvn(sv, fbh->data, fbh->length);\n\n break;\n\n default:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tERROR IN st_fetch_string\");\n len= fbh->length;\n\t /* ChopBlanks server-side prepared statement */\n if (ChopBlanks)\n {\n /* \n see bottom of:\n http://www.mysql.org/doc/refman/5.0/en/c-api-datatypes.html\n */\n if (fbh->charsetnr != 63)\n while (len && fbh->data[len-1] == ' ') { --len; }\n }\n\t /* END OF ChopBlanks */\n\n sv_setpvn(sv, fbh->data, len);\n\n\t/* UTF8 */\n /*HELMUT*/\n#if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n\n#if MYSQL_VERSION_ID >= FIELD_CHARSETNR_VERSION \n /* SHOW COLLATION WHERE Id = 63; -- 63 == charset binary, collation binary */\n if ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && fbh->charsetnr != 63)\n#else\n\tif ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && !(fbh->flags & BINARY_FLAG))\n#endif\n\t sv_utf8_decode(sv);\n#endif\n\t/* END OF UTF8 */\n break;\n\n }\n\n }\n }\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, %d cols\\n\", num_fields);\n\n return av;\n }\n else\n {\n#endif\n\n imp_sth->currow++;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch result set details\\n\");\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\timp_sth->result=%p\\n\", imp_sth->result);\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_num_fields=%u\\n\",\n mysql_num_fields(imp_sth->result));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_num_rows=%llu\\n\",\n mysql_num_rows(imp_sth->result));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_affected_rows=%llu\\n\",\n mysql_affected_rows(imp_dbh->pmysql));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch for %p, currow= %d\\n\",\n sth,imp_sth->currow);\n }\n\n if (!(cols= mysql_fetch_row(imp_sth->result)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch, no more rows to fetch\");\n }\n if (mysql_errno(imp_dbh->pmysql))\n do_error(sth, mysql_errno(imp_dbh->pmysql),\n mysql_error(imp_dbh->pmysql),\n mysql_sqlstate(imp_dbh->pmysql));\n\n\n#if MYSQL_VERSION_ID >= MULTIPLE_RESULT_SET_VERSION\n if (!mysql_more_results(svsock))\n#endif\n dbd_st_finish(sth, imp_sth);\n return Nullav;\n }\n\n num_fields= mysql_num_fields(imp_sth->result);\n fields= mysql_fetch_fields(imp_sth->result);\n lengths= mysql_fetch_lengths(imp_sth->result);\n\n if ((av= DBIc_FIELDS_AV(imp_sth)) != Nullav)\n {\n av_length= av_len(av)+1;\n\n if (av_length != num_fields) /* Resize array if necessary */\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, size of results array(%d) != num_fields(%d)\\n\",\n av_length, num_fields);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, result fields(%d)\\n\",\n DBIc_NUM_FIELDS(imp_sth));\n\n av_readonly = SvREADONLY(av);\n\n if (av_readonly)\n SvREADONLY_off( av ); /* DBI sets this readonly */\n\n while (av_length < num_fields)\n {\n av_store(av, av_length++, newSV(0));\n }\n\n while (av_length > num_fields)\n {\n SvREFCNT_dec(av_pop(av));\n av_length--;\n }\n if (av_readonly)\n SvREADONLY_on(av);\n }\n }\n\n av= DBIc_DBISTATE(imp_sth)->get_fbav(imp_sth);\n\n for (i= 0; i < num_fields; ++i)\n {\n char *col= cols[i];\n SV *sv= AvARRAY(av)[i]; /* Note: we (re)use the SV in the AV\t*/\n\n if (col)\n {\n STRLEN len= lengths[i];\n if (ChopBlanks)\n {\n while (len && col[len-1] == ' ')\n {\t--len; }\n }\n\n /* Set string value returned from mysql server */\n sv_setpvn(sv, col, len);\n\n switch (mysql_to_perl_type(fields[i].type)) {\n case MYSQL_TYPE_DOUBLE:\n /* Coerce to dobule and set scalar as NV */\n (void) SvNV(sv);\n SvNOK_only(sv);\n break;\n\n case MYSQL_TYPE_LONG:\n case MYSQL_TYPE_LONGLONG:\n /* Coerce to integer and set scalar as UV resp. IV */\n if (fields[i].flags & UNSIGNED_FLAG)\n {\n (void) SvUV(sv);\n SvIOK_only_UV(sv);\n }\n else\n {\n (void) SvIV(sv);\n SvIOK_only(sv);\n }\n break;\n\n#if MYSQL_VERSION_ID > NEW_DATATYPE_VERSION\n case MYSQL_TYPE_BIT:\n /* Let it as binary string */\n break;\n#endif\n\n default:\n\t/* UTF8 */\n /*HELMUT*/\n#if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n\n /* see bottom of: http://www.mysql.org/doc/refman/5.0/en/c-api-datatypes.html */\n if ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && fields[i].charsetnr != 63)\n\t sv_utf8_decode(sv);\n#endif\n\t/* END OF UTF8 */\n break;\n }\n }\n else\n (void) SvOK_off(sv); /* Field is NULL, return undef */\n }\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, %d cols\\n\", num_fields);\n return av;\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n }\n#endif\n\n}","target":"dbd_st_fetch(SV *sth, imp_sth_t* imp_sth)\n{\n dTHX;\n int num_fields, ChopBlanks, i, rc;\n unsigned long *lengths;\n AV *av;\n int av_length, av_readonly;\n MYSQL_ROW cols;\n D_imp_dbh_from_sth;\n MYSQL* svsock= imp_dbh->pmysql;\n imp_sth_fbh_t *fbh;\n D_imp_xxh(sth);\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n MYSQL_BIND *buffer;\n#endif\n MYSQL_FIELD *fields;\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t-> dbd_st_fetch\\n\");\n\n#if MYSQL_ASYNC\n if(imp_dbh->async_query_in_flight) {\n if(mysql_db_async_result(sth, &imp_sth->result) <= 0) {\n return Nullav;\n }\n }\n#endif\n\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (!DBIc_ACTIVE(imp_sth) )\n {\n do_error(sth, JW_ERR_SEQUENCE, \"no statement executing\\n\",NULL);\n return Nullav;\n }\n\n if (imp_sth->fetch_done)\n {\n do_error(sth, JW_ERR_SEQUENCE, \"fetch() but fetch already done\",NULL);\n return Nullav;\n }\n\n if (!imp_sth->done_desc)\n {\n if (!dbd_describe(sth, imp_sth))\n {\n do_error(sth, JW_ERR_SEQUENCE, \"Error while describe result set.\",\n NULL);\n return Nullav;\n }\n }\n }\n#endif\n\n ChopBlanks = DBIc_is(imp_sth, DBIcf_ChopBlanks);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tdbd_st_fetch for %p, chopblanks %d\\n\",\n sth, ChopBlanks);\n\n if (!imp_sth->result)\n {\n do_error(sth, JW_ERR_SEQUENCE, \"fetch() without execute()\" ,NULL);\n return Nullav;\n }\n\n /* fix from 2.9008 */\n imp_dbh->pmysql->net.last_errno = 0;\n\n#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n if (imp_sth->use_server_side_prepare)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch calling mysql_fetch\\n\");\n\n if ((rc= mysql_stmt_fetch(imp_sth->stmt)))\n {\n if (rc == 1)\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_stmt_sqlstate(imp_sth->stmt));\n\n#if MYSQL_VERSION_ID >= MYSQL_VERSION_5_0 \n if (rc == MYSQL_DATA_TRUNCATED) {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch data truncated\\n\");\n goto process;\n }\n#endif\n\n if (rc == MYSQL_NO_DATA)\n {\n /* Update row_num to affected_rows value */\n imp_sth->row_num= mysql_stmt_affected_rows(imp_sth->stmt);\n imp_sth->fetch_done=1;\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tdbd_st_fetch no data\\n\");\n }\n\n dbd_st_finish(sth, imp_sth);\n\n return Nullav;\n }\n\nprocess:\n imp_sth->currow++;\n\n av= DBIc_DBISTATE(imp_sth)->get_fbav(imp_sth);\n num_fields=mysql_stmt_field_count(imp_sth->stmt);\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tdbd_st_fetch called mysql_fetch, rc %d num_fields %d\\n\",\n rc, num_fields);\n\n for (\n buffer= imp_sth->buffer,\n fbh= imp_sth->fbh,\n i= 0;\n i < num_fields;\n i++,\n fbh++,\n buffer++\n )\n {\n SV *sv= AvARRAY(av)[i]; /* Note: we (re)use the SV in the AV\t*/\n STRLEN len;\n\n /* This is wrong, null is not being set correctly\n * This is not the way to determine length (this would break blobs!)\n */\n if (fbh->is_null)\n (void) SvOK_off(sv); /* Field is NULL, return undef */\n else\n {\n /* In case of BLOB/TEXT fields we allocate only 8192 bytes\n in dbd_describe() for data. Here we know real size of field\n so we should increase buffer size and refetch column value\n */\n if (fbh->length > buffer->buffer_length || fbh->error)\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\n \"\\t\\tRefetch BLOB/TEXT column: %d, length: %lu, error: %d\\n\",\n i, fbh->length, fbh->error);\n\n Renew(fbh->data, fbh->length, char);\n buffer->buffer_length= fbh->length;\n buffer->buffer= (char *) fbh->data;\n imp_sth->stmt->bind[i].buffer_length = fbh->length;\n imp_sth->stmt->bind[i].buffer = (char *)fbh->data;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) {\n int j;\n int m = MIN(*buffer->length, buffer->buffer_length);\n char *ptr = (char*)buffer->buffer;\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\t\\tbefore buffer->buffer: \");\n for (j = 0; j < m; j++) {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"%c\", *ptr++);\n }\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\n\");\n }\n\n /*TODO: Use offset instead of 0 to fetch only remain part of data*/\n if (mysql_stmt_fetch_column(imp_sth->stmt, buffer , i, 0))\n do_error(sth, mysql_stmt_errno(imp_sth->stmt),\n mysql_stmt_error(imp_sth->stmt),\n mysql_stmt_sqlstate(imp_sth->stmt));\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) {\n int j;\n int m = MIN(*buffer->length, buffer->buffer_length);\n char *ptr = (char*)buffer->buffer;\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\t\\tafter buffer->buffer: \");\n for (j = 0; j < m; j++) {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"%c\", *ptr++);\n }\n PerlIO_printf(DBIc_LOGPIO(imp_xxh),\"\\n\");\n }\n }\n\n /* This does look a lot like Georg's PHP driver doesn't it? --Brian */\n /* Credit due to Georg - mysqli_api.c ;) --PMG */\n switch (buffer->buffer_type) {\n case MYSQL_TYPE_DOUBLE:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tst_fetch double data %f\\n\", fbh->ddata);\n sv_setnv(sv, fbh->ddata);\n break;\n\n case MYSQL_TYPE_LONG:\n case MYSQL_TYPE_LONGLONG:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tst_fetch int data %\"IVdf\", unsigned? %d\\n\",\n fbh->ldata, buffer->is_unsigned);\n if (buffer->is_unsigned)\n sv_setuv(sv, fbh->ldata);\n else\n sv_setiv(sv, fbh->ldata);\n\n break;\n\n case MYSQL_TYPE_BIT:\n sv_setpvn(sv, fbh->data, fbh->length);\n\n break;\n\n default:\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t\\tERROR IN st_fetch_string\");\n len= fbh->length;\n\t /* ChopBlanks server-side prepared statement */\n if (ChopBlanks)\n {\n /* \n see bottom of:\n http://www.mysql.org/doc/refman/5.0/en/c-api-datatypes.html\n */\n if (fbh->charsetnr != 63)\n while (len && fbh->data[len-1] == ' ') { --len; }\n }\n\t /* END OF ChopBlanks */\n\n sv_setpvn(sv, fbh->data, len);\n\n\t/* UTF8 */\n /*HELMUT*/\n#if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n\n#if MYSQL_VERSION_ID >= FIELD_CHARSETNR_VERSION \n /* SHOW COLLATION WHERE Id = 63; -- 63 == charset binary, collation binary */\n if ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && fbh->charsetnr != 63)\n#else\n\tif ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && !(fbh->flags & BINARY_FLAG))\n#endif\n\t sv_utf8_decode(sv);\n#endif\n\t/* END OF UTF8 */\n break;\n\n }\n\n }\n }\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, %d cols\\n\", num_fields);\n\n return av;\n }\n else\n {\n#endif\n\n imp_sth->currow++;\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch result set details\\n\");\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\timp_sth->result=%p\\n\", imp_sth->result);\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_num_fields=%u\\n\",\n mysql_num_fields(imp_sth->result));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_num_rows=%llu\\n\",\n mysql_num_rows(imp_sth->result));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tmysql_affected_rows=%llu\\n\",\n mysql_affected_rows(imp_dbh->pmysql));\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch for %p, currow= %d\\n\",\n sth,imp_sth->currow);\n }\n\n if (!(cols= mysql_fetch_row(imp_sth->result)))\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n {\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\tdbd_st_fetch, no more rows to fetch\");\n }\n if (mysql_errno(imp_dbh->pmysql))\n do_error(sth, mysql_errno(imp_dbh->pmysql),\n mysql_error(imp_dbh->pmysql),\n mysql_sqlstate(imp_dbh->pmysql));\n\n\n#if MYSQL_VERSION_ID >= MULTIPLE_RESULT_SET_VERSION\n if (!mysql_more_results(svsock))\n#endif\n dbd_st_finish(sth, imp_sth);\n return Nullav;\n }\n\n num_fields= mysql_num_fields(imp_sth->result);\n fields= mysql_fetch_fields(imp_sth->result);\n lengths= mysql_fetch_lengths(imp_sth->result);\n\n if ((av= DBIc_FIELDS_AV(imp_sth)) != Nullav)\n {\n av_length= av_len(av)+1;\n\n if (av_length != num_fields) /* Resize array if necessary */\n {\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, size of results array(%d) != num_fields(%d)\\n\",\n av_length, num_fields);\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, result fields(%d)\\n\",\n DBIc_NUM_FIELDS(imp_sth));\n\n av_readonly = SvREADONLY(av);\n\n if (av_readonly)\n SvREADONLY_off( av ); /* DBI sets this readonly */\n\n while (av_length < num_fields)\n {\n av_store(av, av_length++, newSV(0));\n }\n\n while (av_length > num_fields)\n {\n SvREFCNT_dec(av_pop(av));\n av_length--;\n }\n if (av_readonly)\n SvREADONLY_on(av);\n }\n }\n\n av= DBIc_DBISTATE(imp_sth)->get_fbav(imp_sth);\n\n for (i= 0; i < num_fields; ++i)\n {\n char *col= cols[i];\n SV *sv= AvARRAY(av)[i]; /* Note: we (re)use the SV in the AV\t*/\n\n if (col)\n {\n STRLEN len= lengths[i];\n if (ChopBlanks)\n {\n while (len && col[len-1] == ' ')\n {\t--len; }\n }\n\n /* Set string value returned from mysql server */\n sv_setpvn(sv, col, len);\n\n switch (mysql_to_perl_type(fields[i].type)) {\n case MYSQL_TYPE_DOUBLE:\n /* Coerce to dobule and set scalar as NV */\n (void) SvNV(sv);\n SvNOK_only(sv);\n break;\n\n case MYSQL_TYPE_LONG:\n case MYSQL_TYPE_LONGLONG:\n /* Coerce to integer and set scalar as UV resp. IV */\n if (fields[i].flags & UNSIGNED_FLAG)\n {\n (void) SvUV(sv);\n SvIOK_only_UV(sv);\n }\n else\n {\n (void) SvIV(sv);\n SvIOK_only(sv);\n }\n break;\n\n#if MYSQL_VERSION_ID > NEW_DATATYPE_VERSION\n case MYSQL_TYPE_BIT:\n /* Let it as binary string */\n break;\n#endif\n\n default:\n\t/* UTF8 */\n /*HELMUT*/\n#if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION\n\n /* see bottom of: http://www.mysql.org/doc/refman/5.0/en/c-api-datatypes.html */\n if ((imp_dbh->enable_utf8 || imp_dbh->enable_utf8mb4) && fields[i].charsetnr != 63)\n\t sv_utf8_decode(sv);\n#endif\n\t/* END OF UTF8 */\n break;\n }\n }\n else\n (void) SvOK_off(sv); /* Field is NULL, return undef */\n }\n\n if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)\n PerlIO_printf(DBIc_LOGPIO(imp_xxh), \"\\t<- dbd_st_fetch, %d cols\\n\", num_fields);\n return av;\n\n#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION\n }\n#endif\n\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"dbd_st_fetch","file_name":"dbdimp.c","commit_link":"github.com/perl5-dbi/DBD-mysql/commit/3619c170461a3107a258d1fd2d00ed4832adb1b1","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#2-ef37067ff03d","input":"void Magick::Image::read(MagickCore::Image *image,\n MagickCore::ExceptionInfo *exceptionInfo)\n{\n // Ensure that multiple image frames were not read.\n if (image != (MagickCore::Image *) NULL &&\n image->next != (MagickCore::Image *) NULL)\n {\n MagickCore::Image\n *next;\n\n // Destroy any extra image frames\n next=image->next;\n image->next=(MagickCore::Image *) NULL;\n next->previous=(MagickCore::Image *) NULL;\n DestroyImageList(next);\n }\n replaceImage(image);\n if (exceptionInfo->severity == MagickCore::UndefinedException &&\n image == (MagickCore::Image *) NULL)\n {\n (void) MagickCore::DestroyExceptionInfo(exceptionInfo);\n if (!quiet())\n throwExceptionExplicit(MagickCore::ImageWarning,\n \"No image was loaded.\");\n }\n ThrowImageException;\n}","target":"void Magick::Image::read(MagickCore::Image *image,\n MagickCore::ExceptionInfo *exceptionInfo)\n{\n // Ensure that multiple image frames were not read.\n if (image != (MagickCore::Image *) NULL &&\n image->next != (MagickCore::Image *) NULL)\n {\n MagickCore::Image\n *next;\n\n // Destroy any extra image frames\n next=image->next;\n image->next=(MagickCore::Image *) NULL;\n next->previous=(MagickCore::Image *) NULL;\n DestroyImageList(next);\n }\n replaceImage(image);\n if (exceptionInfo->severity == MagickCore::UndefinedException &&\n image == (MagickCore::Image *) NULL)\n {\n (void) MagickCore::DestroyExceptionInfo(exceptionInfo);\n if (!quiet())\n throwExceptionExplicit(MagickCore::ImageWarning,\n \"No image was loaded.\");\n return;\n }\n ThrowImageException;\n}","lang":"cpp","vul_type":"cwe-416","sven_meta":{"func_name":"Magick::Image::read","file_name":"Magick++/lib/Image.cpp","commit_link":"github.com/ImageMagick/ImageMagick/commit/8c35502217c1879cb8257c617007282eee3fe1cc","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#3-f862b96faa78","input":"int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)\n{\n\tstruct sctp_association *asoc = sctp_id2assoc(sk, id);\n\tstruct sctp_sock *sp = sctp_sk(sk);\n\tstruct socket *sock;\n\tint err = 0;\n\n\tif (!asoc)\n\t\treturn -EINVAL;\n\n\t/* If there is a thread waiting on more sndbuf space for\n\t * sending on this asoc, it cannot be peeled.\n\t */\n\tif (waitqueue_active(&asoc->wait))\n\t\treturn -EBUSY;\n\n\t/* An association cannot be branched off from an already peeled-off\n\t * socket, nor is this supported for tcp style sockets.\n\t */\n\tif (!sctp_style(sk, UDP))\n\t\treturn -EINVAL;\n\n\t/* Create a new socket. */\n\terr = sock_create(sk->sk_family, SOCK_SEQPACKET, IPPROTO_SCTP, &sock);\n\tif (err < 0)\n\t\treturn err;\n\n\tsctp_copy_sock(sock->sk, sk, asoc);\n\n\t/* Make peeled-off sockets more like 1-1 accepted sockets.\n\t * Set the daddr and initialize id to something more random\n\t */\n\tsp->pf->to_sk_daddr(&asoc->peer.primary_addr, sk);\n\n\t/* Populate the fields of the newsk from the oldsk and migrate the\n\t * asoc to the newsk.\n\t */\n\tsctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH);\n\n\t*sockp = sock;\n\n\treturn err;\n}","target":"int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)\n{\n\tstruct sctp_association *asoc = sctp_id2assoc(sk, id);\n\tstruct sctp_sock *sp = sctp_sk(sk);\n\tstruct socket *sock;\n\tint err = 0;\n\n\t/* Do not peel off from one netns to another one. */\n\tif (!net_eq(current->nsproxy->net_ns, sock_net(sk)))\n\t\treturn -EINVAL;\n\n\tif (!asoc)\n\t\treturn -EINVAL;\n\n\t/* If there is a thread waiting on more sndbuf space for\n\t * sending on this asoc, it cannot be peeled.\n\t */\n\tif (waitqueue_active(&asoc->wait))\n\t\treturn -EBUSY;\n\n\t/* An association cannot be branched off from an already peeled-off\n\t * socket, nor is this supported for tcp style sockets.\n\t */\n\tif (!sctp_style(sk, UDP))\n\t\treturn -EINVAL;\n\n\t/* Create a new socket. */\n\terr = sock_create(sk->sk_family, SOCK_SEQPACKET, IPPROTO_SCTP, &sock);\n\tif (err < 0)\n\t\treturn err;\n\n\tsctp_copy_sock(sock->sk, sk, asoc);\n\n\t/* Make peeled-off sockets more like 1-1 accepted sockets.\n\t * Set the daddr and initialize id to something more random\n\t */\n\tsp->pf->to_sk_daddr(&asoc->peer.primary_addr, sk);\n\n\t/* Populate the fields of the newsk from the oldsk and migrate the\n\t * asoc to the newsk.\n\t */\n\tsctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH);\n\n\t*sockp = sock;\n\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"sctp_do_peeloff","file_name":"net/sctp/socket.c","commit_link":"github.com/torvalds/linux/commit/df80cd9b28b9ebaa284a41df611dbf3a2d05ca74","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#4-9262b517762c","input":"AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd,\n void *dummy,\n const char *arg)\n{\n const char *endp = ap_strrchr_c(arg, '>');\n const char *limited_methods;\n void *tog = cmd->cmd->cmd_data;\n apr_int64_t limited = 0;\n apr_int64_t old_limited = cmd->limited;\n const char *errmsg;\n\n if (endp == NULL) {\n return unclosed_directive(cmd);\n }\n\n limited_methods = apr_pstrmemdup(cmd->temp_pool, arg, endp - arg);\n\n if (!limited_methods[0]) {\n return missing_container_arg(cmd);\n }\n\n while (limited_methods[0]) {\n char *method = ap_getword_conf(cmd->temp_pool, &limited_methods);\n int methnum;\n\n /* check for builtin or module registered method number */\n methnum = ap_method_number_of(method);\n\n if (methnum == M_TRACE && !tog) {\n return \"TRACE cannot be controlled by , see TraceEnable\";\n }\n else if (methnum == M_INVALID) {\n /* method has not been registered yet, but resource restriction\n * is always checked before method handling, so register it.\n */\n methnum = ap_method_register(cmd->pool,\n apr_pstrdup(cmd->pool, method));\n }\n\n limited |= (AP_METHOD_BIT << methnum);\n }\n\n /* Killing two features with one function,\n * if (tog == NULL) , else \n */\n limited = tog ? ~limited : limited;\n\n if (!(old_limited & limited)) {\n return apr_pstrcat(cmd->pool, cmd->cmd->name,\n \"> directive excludes all methods\", NULL);\n }\n else if ((old_limited & limited) == old_limited) {\n return apr_pstrcat(cmd->pool, cmd->cmd->name,\n \"> directive specifies methods already excluded\",\n NULL);\n }\n\n cmd->limited &= limited;\n\n errmsg = ap_walk_config(cmd->directive->first_child, cmd, cmd->context);\n\n cmd->limited = old_limited;\n\n return errmsg;\n}","target":"AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd,\n void *dummy,\n const char *arg)\n{\n const char *endp = ap_strrchr_c(arg, '>');\n const char *limited_methods;\n void *tog = cmd->cmd->cmd_data;\n apr_int64_t limited = 0;\n apr_int64_t old_limited = cmd->limited;\n const char *errmsg;\n\n if (endp == NULL) {\n return unclosed_directive(cmd);\n }\n\n limited_methods = apr_pstrmemdup(cmd->temp_pool, arg, endp - arg);\n\n if (!limited_methods[0]) {\n return missing_container_arg(cmd);\n }\n\n while (limited_methods[0]) {\n char *method = ap_getword_conf(cmd->temp_pool, &limited_methods);\n int methnum;\n\n /* check for builtin or module registered method number */\n methnum = ap_method_number_of(method);\n\n if (methnum == M_TRACE && !tog) {\n return \"TRACE cannot be controlled by , see TraceEnable\";\n }\n else if (methnum == M_INVALID) {\n /* method has not been registered yet, but resource restriction\n * is always checked before method handling, so register it.\n */\n if (cmd->pool == cmd->temp_pool) {\n /* In .htaccess, we can't globally register new methods. */\n return apr_psprintf(cmd->pool, \"Could not register method '%s' \"\n \"for %s from .htaccess configuration\",\n method, cmd->cmd->name);\n }\n methnum = ap_method_register(cmd->pool,\n apr_pstrdup(cmd->pool, method));\n }\n\n limited |= (AP_METHOD_BIT << methnum);\n }\n\n /* Killing two features with one function,\n * if (tog == NULL) , else \n */\n limited = tog ? ~limited : limited;\n\n if (!(old_limited & limited)) {\n return apr_pstrcat(cmd->pool, cmd->cmd->name,\n \"> directive excludes all methods\", NULL);\n }\n else if ((old_limited & limited) == old_limited) {\n return apr_pstrcat(cmd->pool, cmd->cmd->name,\n \"> directive specifies methods already excluded\",\n NULL);\n }\n\n cmd->limited &= limited;\n\n errmsg = ap_walk_config(cmd->directive->first_child, cmd, cmd->context);\n\n cmd->limited = old_limited;\n\n return errmsg;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"ap_limit_section","file_name":"server/core.c","commit_link":"github.com/apache/httpd/commit/29afdd2550b3d30a8defece2b95ae81edcf66ac9","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#5-425877cf51e9","input":"static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)\n{\n\tint ret;\n\tstruct fd f;\n\tstruct sock *sock;\n\tstruct inode *inode;\n\tstruct mqueue_inode_info *info;\n\tstruct sk_buff *nc;\n\n\taudit_mq_notify(mqdes, notification);\n\n\tnc = NULL;\n\tsock = NULL;\n\tif (notification != NULL) {\n\t\tif (unlikely(notification->sigev_notify != SIGEV_NONE &&\n\t\t\t notification->sigev_notify != SIGEV_SIGNAL &&\n\t\t\t notification->sigev_notify != SIGEV_THREAD))\n\t\t\treturn -EINVAL;\n\t\tif (notification->sigev_notify == SIGEV_SIGNAL &&\n\t\t\t!valid_signal(notification->sigev_signo)) {\n\t\t\treturn -EINVAL;\n\t\t}\n\t\tif (notification->sigev_notify == SIGEV_THREAD) {\n\t\t\tlong timeo;\n\n\t\t\t/* create the notify skb */\n\t\t\tnc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL);\n\t\t\tif (!nc) {\n\t\t\t\tret = -ENOMEM;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tif (copy_from_user(nc->data,\n\t\t\t\t\tnotification->sigev_value.sival_ptr,\n\t\t\t\t\tNOTIFY_COOKIE_LEN)) {\n\t\t\t\tret = -EFAULT;\n\t\t\t\tgoto out;\n\t\t\t}\n\n\t\t\t/* TODO: add a header? */\n\t\t\tskb_put(nc, NOTIFY_COOKIE_LEN);\n\t\t\t/* and attach it to the socket */\nretry:\n\t\t\tf = fdget(notification->sigev_signo);\n\t\t\tif (!f.file) {\n\t\t\t\tret = -EBADF;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tsock = netlink_getsockbyfilp(f.file);\n\t\t\tfdput(f);\n\t\t\tif (IS_ERR(sock)) {\n\t\t\t\tret = PTR_ERR(sock);\n\t\t\t\tsock = NULL;\n\t\t\t\tgoto out;\n\t\t\t}\n\n\t\t\ttimeo = MAX_SCHEDULE_TIMEOUT;\n\t\t\tret = netlink_attachskb(sock, nc, &timeo, NULL);\n\t\t\tif (ret == 1)\n\t\t\t\tgoto retry;\n\t\t\tif (ret) {\n\t\t\t\tsock = NULL;\n\t\t\t\tnc = NULL;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t}\n\t}\n\n\tf = fdget(mqdes);\n\tif (!f.file) {\n\t\tret = -EBADF;\n\t\tgoto out;\n\t}\n\n\tinode = file_inode(f.file);\n\tif (unlikely(f.file->f_op != &mqueue_file_operations)) {\n\t\tret = -EBADF;\n\t\tgoto out_fput;\n\t}\n\tinfo = MQUEUE_I(inode);\n\n\tret = 0;\n\tspin_lock(&info->lock);\n\tif (notification == NULL) {\n\t\tif (info->notify_owner == task_tgid(current)) {\n\t\t\tremove_notification(info);\n\t\t\tinode->i_atime = inode->i_ctime = current_time(inode);\n\t\t}\n\t} else if (info->notify_owner != NULL) {\n\t\tret = -EBUSY;\n\t} else {\n\t\tswitch (notification->sigev_notify) {\n\t\tcase SIGEV_NONE:\n\t\t\tinfo->notify.sigev_notify = SIGEV_NONE;\n\t\t\tbreak;\n\t\tcase SIGEV_THREAD:\n\t\t\tinfo->notify_sock = sock;\n\t\t\tinfo->notify_cookie = nc;\n\t\t\tsock = NULL;\n\t\t\tnc = NULL;\n\t\t\tinfo->notify.sigev_notify = SIGEV_THREAD;\n\t\t\tbreak;\n\t\tcase SIGEV_SIGNAL:\n\t\t\tinfo->notify.sigev_signo = notification->sigev_signo;\n\t\t\tinfo->notify.sigev_value = notification->sigev_value;\n\t\t\tinfo->notify.sigev_notify = SIGEV_SIGNAL;\n\t\t\tbreak;\n\t\t}\n\n\t\tinfo->notify_owner = get_pid(task_tgid(current));\n\t\tinfo->notify_user_ns = get_user_ns(current_user_ns());\n\t\tinode->i_atime = inode->i_ctime = current_time(inode);\n\t}\n\tspin_unlock(&info->lock);\nout_fput:\n\tfdput(f);\nout:\n\tif (sock)\n\t\tnetlink_detachskb(sock, nc);\n\telse if (nc)\n\t\tdev_kfree_skb(nc);\n\n\treturn ret;\n}","target":"static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)\n{\n\tint ret;\n\tstruct fd f;\n\tstruct sock *sock;\n\tstruct inode *inode;\n\tstruct mqueue_inode_info *info;\n\tstruct sk_buff *nc;\n\n\taudit_mq_notify(mqdes, notification);\n\n\tnc = NULL;\n\tsock = NULL;\n\tif (notification != NULL) {\n\t\tif (unlikely(notification->sigev_notify != SIGEV_NONE &&\n\t\t\t notification->sigev_notify != SIGEV_SIGNAL &&\n\t\t\t notification->sigev_notify != SIGEV_THREAD))\n\t\t\treturn -EINVAL;\n\t\tif (notification->sigev_notify == SIGEV_SIGNAL &&\n\t\t\t!valid_signal(notification->sigev_signo)) {\n\t\t\treturn -EINVAL;\n\t\t}\n\t\tif (notification->sigev_notify == SIGEV_THREAD) {\n\t\t\tlong timeo;\n\n\t\t\t/* create the notify skb */\n\t\t\tnc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL);\n\t\t\tif (!nc) {\n\t\t\t\tret = -ENOMEM;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tif (copy_from_user(nc->data,\n\t\t\t\t\tnotification->sigev_value.sival_ptr,\n\t\t\t\t\tNOTIFY_COOKIE_LEN)) {\n\t\t\t\tret = -EFAULT;\n\t\t\t\tgoto out;\n\t\t\t}\n\n\t\t\t/* TODO: add a header? */\n\t\t\tskb_put(nc, NOTIFY_COOKIE_LEN);\n\t\t\t/* and attach it to the socket */\nretry:\n\t\t\tf = fdget(notification->sigev_signo);\n\t\t\tif (!f.file) {\n\t\t\t\tret = -EBADF;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tsock = netlink_getsockbyfilp(f.file);\n\t\t\tfdput(f);\n\t\t\tif (IS_ERR(sock)) {\n\t\t\t\tret = PTR_ERR(sock);\n\t\t\t\tsock = NULL;\n\t\t\t\tgoto out;\n\t\t\t}\n\n\t\t\ttimeo = MAX_SCHEDULE_TIMEOUT;\n\t\t\tret = netlink_attachskb(sock, nc, &timeo, NULL);\n\t\t\tif (ret == 1) {\n\t\t\t\tsock = NULL;\n\t\t\t\tgoto retry;\n\t\t\t}\n\t\t\tif (ret) {\n\t\t\t\tsock = NULL;\n\t\t\t\tnc = NULL;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t}\n\t}\n\n\tf = fdget(mqdes);\n\tif (!f.file) {\n\t\tret = -EBADF;\n\t\tgoto out;\n\t}\n\n\tinode = file_inode(f.file);\n\tif (unlikely(f.file->f_op != &mqueue_file_operations)) {\n\t\tret = -EBADF;\n\t\tgoto out_fput;\n\t}\n\tinfo = MQUEUE_I(inode);\n\n\tret = 0;\n\tspin_lock(&info->lock);\n\tif (notification == NULL) {\n\t\tif (info->notify_owner == task_tgid(current)) {\n\t\t\tremove_notification(info);\n\t\t\tinode->i_atime = inode->i_ctime = current_time(inode);\n\t\t}\n\t} else if (info->notify_owner != NULL) {\n\t\tret = -EBUSY;\n\t} else {\n\t\tswitch (notification->sigev_notify) {\n\t\tcase SIGEV_NONE:\n\t\t\tinfo->notify.sigev_notify = SIGEV_NONE;\n\t\t\tbreak;\n\t\tcase SIGEV_THREAD:\n\t\t\tinfo->notify_sock = sock;\n\t\t\tinfo->notify_cookie = nc;\n\t\t\tsock = NULL;\n\t\t\tnc = NULL;\n\t\t\tinfo->notify.sigev_notify = SIGEV_THREAD;\n\t\t\tbreak;\n\t\tcase SIGEV_SIGNAL:\n\t\t\tinfo->notify.sigev_signo = notification->sigev_signo;\n\t\t\tinfo->notify.sigev_value = notification->sigev_value;\n\t\t\tinfo->notify.sigev_notify = SIGEV_SIGNAL;\n\t\t\tbreak;\n\t\t}\n\n\t\tinfo->notify_owner = get_pid(task_tgid(current));\n\t\tinfo->notify_user_ns = get_user_ns(current_user_ns());\n\t\tinode->i_atime = inode->i_ctime = current_time(inode);\n\t}\n\tspin_unlock(&info->lock);\nout_fput:\n\tfdput(f);\nout:\n\tif (sock)\n\t\tnetlink_detachskb(sock, nc);\n\telse if (nc)\n\t\tdev_kfree_skb(nc);\n\n\treturn ret;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"do_mq_notify","file_name":"ipc/mqueue.c","commit_link":"github.com/torvalds/linux/commit/f991af3daabaecff34684fd51fac80319d1baad1","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#6-1ad71a59d50d","input":"static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)\n{\n\tstruct xc2028_data *priv = fe->tuner_priv;\n\tstruct xc2028_ctrl *p = priv_cfg;\n\tint rc = 0;\n\n\ttuner_dbg(\"%s called\\n\", __func__);\n\n\tmutex_lock(&priv->lock);\n\n\t/*\n\t * Copy the config data.\n\t * For the firmware name, keep a local copy of the string,\n\t * in order to avoid troubles during device release.\n\t */\n\tkfree(priv->ctrl.fname);\n\tmemcpy(&priv->ctrl, p, sizeof(priv->ctrl));\n\tif (p->fname) {\n\t\tpriv->ctrl.fname = kstrdup(p->fname, GFP_KERNEL);\n\t\tif (priv->ctrl.fname == NULL)\n\t\t\trc = -ENOMEM;\n\t}\n\n\t/*\n\t * If firmware name changed, frees firmware. As free_firmware will\n\t * reset the status to NO_FIRMWARE, this forces a new request_firmware\n\t */\n\tif (!firmware_name[0] && p->fname &&\n\t priv->fname && strcmp(p->fname, priv->fname))\n\t\tfree_firmware(priv);\n\n\tif (priv->ctrl.max_len < 9)\n\t\tpriv->ctrl.max_len = 13;\n\n\tif (priv->state == XC2028_NO_FIRMWARE) {\n\t\tif (!firmware_name[0])\n\t\t\tpriv->fname = priv->ctrl.fname;\n\t\telse\n\t\t\tpriv->fname = firmware_name;\n\n\t\trc = request_firmware_nowait(THIS_MODULE, 1,\n\t\t\t\t\t priv->fname,\n\t\t\t\t\t priv->i2c_props.adap->dev.parent,\n\t\t\t\t\t GFP_KERNEL,\n\t\t\t\t\t fe, load_firmware_cb);\n\t\tif (rc < 0) {\n\t\t\ttuner_err(\"Failed to request firmware %s\\n\",\n\t\t\t\t priv->fname);\n\t\t\tpriv->state = XC2028_NODEV;\n\t\t} else\n\t\t\tpriv->state = XC2028_WAITING_FIRMWARE;\n\t}\n\tmutex_unlock(&priv->lock);\n\n\treturn rc;\n}","target":"static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)\n{\n\tstruct xc2028_data *priv = fe->tuner_priv;\n\tstruct xc2028_ctrl *p = priv_cfg;\n\tint rc = 0;\n\n\ttuner_dbg(\"%s called\\n\", __func__);\n\n\tmutex_lock(&priv->lock);\n\n\t/*\n\t * Copy the config data.\n\t * For the firmware name, keep a local copy of the string,\n\t * in order to avoid troubles during device release.\n\t */\n\tkfree(priv->ctrl.fname);\n\tpriv->ctrl.fname = NULL;\n\tmemcpy(&priv->ctrl, p, sizeof(priv->ctrl));\n\tif (p->fname) {\n\t\tpriv->ctrl.fname = kstrdup(p->fname, GFP_KERNEL);\n\t\tif (priv->ctrl.fname == NULL)\n\t\t\treturn -ENOMEM;\n\t}\n\n\t/*\n\t * If firmware name changed, frees firmware. As free_firmware will\n\t * reset the status to NO_FIRMWARE, this forces a new request_firmware\n\t */\n\tif (!firmware_name[0] && p->fname &&\n\t priv->fname && strcmp(p->fname, priv->fname))\n\t\tfree_firmware(priv);\n\n\tif (priv->ctrl.max_len < 9)\n\t\tpriv->ctrl.max_len = 13;\n\n\tif (priv->state == XC2028_NO_FIRMWARE) {\n\t\tif (!firmware_name[0])\n\t\t\tpriv->fname = priv->ctrl.fname;\n\t\telse\n\t\t\tpriv->fname = firmware_name;\n\n\t\trc = request_firmware_nowait(THIS_MODULE, 1,\n\t\t\t\t\t priv->fname,\n\t\t\t\t\t priv->i2c_props.adap->dev.parent,\n\t\t\t\t\t GFP_KERNEL,\n\t\t\t\t\t fe, load_firmware_cb);\n\t\tif (rc < 0) {\n\t\t\ttuner_err(\"Failed to request firmware %s\\n\",\n\t\t\t\t priv->fname);\n\t\t\tpriv->state = XC2028_NODEV;\n\t\t} else\n\t\t\tpriv->state = XC2028_WAITING_FIRMWARE;\n\t}\n\tmutex_unlock(&priv->lock);\n\n\treturn rc;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"xc2028_set_config","file_name":"drivers/media/tuners/tuner-xc2028.c","commit_link":"github.com/torvalds/linux/commit/8dfbcc4351a0b6d2f2d77f367552f48ffefafe18","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#7-131489108720","input":"void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)\n{\n\tstruct snd_pcm_runtime *runtime;\n\tunsigned long flags;\n\n\tif (PCM_RUNTIME_CHECK(substream))\n\t\treturn;\n\truntime = substream->runtime;\n\n\tsnd_pcm_stream_lock_irqsave(substream, flags);\n\tif (!snd_pcm_running(substream) ||\n\t snd_pcm_update_hw_ptr0(substream, 1) < 0)\n\t\tgoto _end;\n\n#ifdef CONFIG_SND_PCM_TIMER\n\tif (substream->timer_running)\n\t\tsnd_timer_interrupt(substream->timer, 1);\n#endif\n _end:\n\tsnd_pcm_stream_unlock_irqrestore(substream, flags);\n\tkill_fasync(&runtime->fasync, SIGIO, POLL_IN);\n}","target":"void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)\n{\n\tstruct snd_pcm_runtime *runtime;\n\tunsigned long flags;\n\n\tif (PCM_RUNTIME_CHECK(substream))\n\t\treturn;\n\truntime = substream->runtime;\n\n\tsnd_pcm_stream_lock_irqsave(substream, flags);\n\tif (!snd_pcm_running(substream) ||\n\t snd_pcm_update_hw_ptr0(substream, 1) < 0)\n\t\tgoto _end;\n\n#ifdef CONFIG_SND_PCM_TIMER\n\tif (substream->timer_running)\n\t\tsnd_timer_interrupt(substream->timer, 1);\n#endif\n _end:\n\tkill_fasync(&runtime->fasync, SIGIO, POLL_IN);\n\tsnd_pcm_stream_unlock_irqrestore(substream, flags);\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"snd_pcm_period_elapsed","file_name":"sound/core/pcm_lib.c","commit_link":"github.com/torvalds/linux/commit/3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#8-baaf9cd04744","input":"int wwunpack(uint8_t *exe, uint32_t exesz, uint8_t *wwsect, struct cli_exe_section *sects, uint16_t scount, uint32_t pe, int desc) {\n uint8_t *structs = wwsect + 0x2a1, *compd, *ccur, *unpd, *ucur, bc;\n uint32_t src, srcend, szd, bt, bits;\n int error=0, i;\n\n cli_dbgmsg(\"in wwunpack\\n\");\n while (1) {\n if (!CLI_ISCONTAINED(wwsect, sects[scount].rsz, structs, 17)) {\n cli_dbgmsg(\"WWPack: Array of structs out of section\\n\");\n break;\n }\n src = sects[scount].rva - cli_readint32(structs); /* src delta / dst delta - not used / dwords / end of src */\n structs+=8;\n szd = cli_readint32(structs) * 4;\n structs+=4;\n srcend = cli_readint32(structs);\n structs+=4;\n\n unpd = ucur = exe+src+srcend+4-szd;\n if (!szd || !CLI_ISCONTAINED(exe, exesz, unpd, szd)) {\n cli_dbgmsg(\"WWPack: Compressed data out of file\\n\");\n break;\n }\n cli_dbgmsg(\"WWP: src: %x, szd: %x, srcend: %x - %x\\n\", src, szd, srcend, srcend+4-szd);\n if (!(compd = cli_malloc(szd))) {\n cli_dbgmsg(\"WWPack: Unable to allocate memory for compd\\n\");\n break;\n }\n memcpy(compd, unpd, szd);\n memset(unpd, -1, szd); /*FIXME*/\n ccur=compd;\n \n RESEED;\n while(!error) {\n uint32_t backbytes, backsize;\n uint8_t saved;\n\n BIT;\n if (!bits) { /* BYTE copy */\n\tif(ccur-compd>=szd || !CLI_ISCONTAINED(exe, exesz, ucur, 1))\n\t error=1;\n\telse\n\t *ucur++=*ccur++;\n\tcontinue;\n }\n\n BITS(2);\n if(bits==3) { /* WORD backcopy */\n\tuint8_t shifted, subbed = 31;\n\tBITS(2);\n\tshifted = bits + 5;\n\tif(bits>=2) {\n\t shifted++;\n\t subbed += 0x80;\n\t}\n\tbackbytes = (1< exesz || pe+7 > exesz || pe+0x28 > exesz ||\n\t\tpe+0x50 > exesz || pe+0x14 > exesz) \n\treturn CL_EFORMAT;\n exe[pe+6]=(uint8_t)scount;\n exe[pe+7]=(uint8_t)(scount>>8);\n cli_writeint32(&exe[pe+0x28], cli_readint32(wwsect+0x295)+sects[scount].rva+0x299);\n cli_writeint32(&exe[pe+0x50], cli_readint32(&exe[pe+0x50])-sects[scount].vsz);\n\n structs = &exe[(0xffff&cli_readint32(&exe[pe+0x14]))+pe+0x18];\n for(i=0 ; i=szd || !CLI_ISCONTAINED(exe, exesz, ucur, 1))\n\t error=1;\n\telse\n\t *ucur++=*ccur++;\n\tcontinue;\n }\n\n BITS(2);\n if(bits==3) { /* WORD backcopy */\n\tuint8_t shifted, subbed = 31;\n\tBITS(2);\n\tshifted = bits + 5;\n\tif(bits>=2) {\n\t shifted++;\n\t subbed += 0x80;\n\t}\n\tbackbytes = (1< exesz || pe+7 > exesz || pe+0x28 > exesz ||\n\t\tpe+0x50 > exesz || pe+0x14 > exesz) \n\treturn CL_EFORMAT;\n exe[pe+6]=(uint8_t)scount;\n exe[pe+7]=(uint8_t)(scount>>8);\n if (!CLI_ISCONTAINED(wwsect, sects[scount].rsz, wwsect+0x295, 4) ||\n !CLI_ISCONTAINED(wwsect, sects[scount].rsz, wwsect+0x295+sects[scount].rva, 4) ||\n !CLI_ISCONTAINED(wwsect, sects[scount].rsz, wwsect+0x295+sects[scount].rva+0x299, 4)) {\n cli_dbgmsg(\"WWPack: unpack memory address out of bounds.\\n\");\n return CL_EFORMAT;\n }\n cli_writeint32(&exe[pe+0x28], cli_readint32(wwsect+0x295)+sects[scount].rva+0x299);\n cli_writeint32(&exe[pe+0x50], cli_readint32(&exe[pe+0x50])-sects[scount].vsz);\n\n structs = &exe[(0xffff&cli_readint32(&exe[pe+0x14]))+pe+0x18];\n for(i=0 ; ih_transaction) {\n\t\terr = jbd2_journal_stop(handle);\n\t\treturn handle->h_err ? handle->h_err : err;\n\t}\n\n\tsb = handle->h_transaction->t_journal->j_private;\n\terr = handle->h_err;\n\trc = jbd2_journal_stop(handle);\n\n\tif (!err)\n\t\terr = rc;\n\tif (err)\n\t\t__ext4_std_error(sb, where, line, err);\n\treturn err;\n}","target":"int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle)\n{\n\tstruct super_block *sb;\n\tint err;\n\tint rc;\n\n\tif (!ext4_handle_valid(handle)) {\n\t\text4_put_nojournal(handle);\n\t\treturn 0;\n\t}\n\n\terr = handle->h_err;\n\tif (!handle->h_transaction) {\n\t\trc = jbd2_journal_stop(handle);\n\t\treturn err ? err : rc;\n\t}\n\n\tsb = handle->h_transaction->t_journal->j_private;\n\trc = jbd2_journal_stop(handle);\n\n\tif (!err)\n\t\terr = rc;\n\tif (err)\n\t\t__ext4_std_error(sb, where, line, err);\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"__ext4_journal_stop","file_name":"fs/ext4/ext4_jbd2.c","commit_link":"github.com/torvalds/linux/commit/6934da9238da947628be83635e365df41064b09b","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#10-daef89c72ecd","input":"int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,\n\t\t\tstruct rq_map_data *map_data,\n\t\t\tconst struct iov_iter *iter, gfp_t gfp_mask)\n{\n\tbool copy = false;\n\tunsigned long align = q->dma_pad_mask | queue_dma_alignment(q);\n\tstruct bio *bio = NULL;\n\tstruct iov_iter i;\n\tint ret;\n\n\tif (map_data)\n\t\tcopy = true;\n\telse if (iov_iter_alignment(iter) & align)\n\t\tcopy = true;\n\telse if (queue_virt_boundary(q))\n\t\tcopy = queue_virt_boundary(q) & iov_iter_gap_alignment(iter);\n\n\ti = *iter;\n\tdo {\n\t\tret =__blk_rq_map_user_iov(rq, map_data, &i, gfp_mask, copy);\n\t\tif (ret)\n\t\t\tgoto unmap_rq;\n\t\tif (!bio)\n\t\t\tbio = rq->bio;\n\t} while (iov_iter_count(&i));\n\n\tif (!bio_flagged(bio, BIO_USER_MAPPED))\n\t\trq->cmd_flags |= REQ_COPY_USER;\n\treturn 0;\n\nunmap_rq:\n\t__blk_rq_unmap_user(bio);\n\trq->bio = NULL;\n\treturn -EINVAL;\n}","target":"int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,\n\t\t\tstruct rq_map_data *map_data,\n\t\t\tconst struct iov_iter *iter, gfp_t gfp_mask)\n{\n\tbool copy = false;\n\tunsigned long align = q->dma_pad_mask | queue_dma_alignment(q);\n\tstruct bio *bio = NULL;\n\tstruct iov_iter i;\n\tint ret;\n\n\tif (!iter_is_iovec(iter))\n\t\tgoto fail;\n\n\tif (map_data)\n\t\tcopy = true;\n\telse if (iov_iter_alignment(iter) & align)\n\t\tcopy = true;\n\telse if (queue_virt_boundary(q))\n\t\tcopy = queue_virt_boundary(q) & iov_iter_gap_alignment(iter);\n\n\ti = *iter;\n\tdo {\n\t\tret =__blk_rq_map_user_iov(rq, map_data, &i, gfp_mask, copy);\n\t\tif (ret)\n\t\t\tgoto unmap_rq;\n\t\tif (!bio)\n\t\t\tbio = rq->bio;\n\t} while (iov_iter_count(&i));\n\n\tif (!bio_flagged(bio, BIO_USER_MAPPED))\n\t\trq->cmd_flags |= REQ_COPY_USER;\n\treturn 0;\n\nunmap_rq:\n\t__blk_rq_unmap_user(bio);\nfail:\n\trq->bio = NULL;\n\treturn -EINVAL;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"blk_rq_map_user_iov","file_name":"block/blk-map.c","commit_link":"github.com/torvalds/linux/commit/a0ac402cfcdc904f9772e1762b3fda112dcc56a0","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#11-b2379e553241","input":"static int mif_process_cmpt(mif_hdr_t *hdr, char *buf)\n{\n\tjas_tvparser_t *tvp;\n\tmif_cmpt_t *cmpt;\n\tint id;\n\n\tcmpt = 0;\n\ttvp = 0;\n\n\tif (!(cmpt = mif_cmpt_create())) {\n\t\tgoto error;\n\t}\n\tcmpt->tlx = 0;\n\tcmpt->tly = 0;\n\tcmpt->sampperx = 0;\n\tcmpt->samppery = 0;\n\tcmpt->width = 0;\n\tcmpt->height = 0;\n\tcmpt->prec = 0;\n\tcmpt->sgnd = -1;\n\tcmpt->data = 0;\n\n\tif (!(tvp = jas_tvparser_create(buf))) {\n\t\tgoto error;\n\t}\n\twhile (!(id = jas_tvparser_next(tvp))) {\n\t\tswitch (jas_taginfo_nonull(jas_taginfos_lookup(mif_tags,\n\t\t jas_tvparser_gettag(tvp)))->id) {\n\t\tcase MIF_TLX:\n\t\t\tcmpt->tlx = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_TLY:\n\t\t\tcmpt->tly = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_WIDTH:\n\t\t\tcmpt->width = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_HEIGHT:\n\t\t\tcmpt->height = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_HSAMP:\n\t\t\tcmpt->sampperx = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_VSAMP:\n\t\t\tcmpt->samppery = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_PREC:\n\t\t\tcmpt->prec = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_SGND:\n\t\t\tcmpt->sgnd = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_DATA:\n\t\t\tif (!(cmpt->data = jas_strdup(jas_tvparser_getval(tvp)))) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\tjas_tvparser_destroy(tvp);\n\tif (!cmpt->sampperx || !cmpt->samppery) {\n\t\tgoto error;\n\t}\n\tif (mif_hdr_addcmpt(hdr, hdr->numcmpts, cmpt)) {\n\t\tgoto error;\n\t}\n\treturn 0;\n\nerror:\n\tif (cmpt) {\n\t\tmif_cmpt_destroy(cmpt);\n\t}\n\tif (tvp) {\n\t\tjas_tvparser_destroy(tvp);\n\t}\n\treturn -1;\n}","target":"static int mif_process_cmpt(mif_hdr_t *hdr, char *buf)\n{\n\tjas_tvparser_t *tvp;\n\tmif_cmpt_t *cmpt;\n\tint id;\n\n\tcmpt = 0;\n\ttvp = 0;\n\n\tif (!(cmpt = mif_cmpt_create())) {\n\t\tgoto error;\n\t}\n\tcmpt->tlx = 0;\n\tcmpt->tly = 0;\n\tcmpt->sampperx = 0;\n\tcmpt->samppery = 0;\n\tcmpt->width = 0;\n\tcmpt->height = 0;\n\tcmpt->prec = 0;\n\tcmpt->sgnd = -1;\n\tcmpt->data = 0;\n\n\tif (!(tvp = jas_tvparser_create(buf))) {\n\t\tgoto error;\n\t}\n\twhile (!(id = jas_tvparser_next(tvp))) {\n\t\tswitch (jas_taginfo_nonull(jas_taginfos_lookup(mif_tags,\n\t\t jas_tvparser_gettag(tvp)))->id) {\n\t\tcase MIF_TLX:\n\t\t\tcmpt->tlx = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_TLY:\n\t\t\tcmpt->tly = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_WIDTH:\n\t\t\tcmpt->width = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_HEIGHT:\n\t\t\tcmpt->height = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_HSAMP:\n\t\t\tcmpt->sampperx = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_VSAMP:\n\t\t\tcmpt->samppery = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_PREC:\n\t\t\tcmpt->prec = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_SGND:\n\t\t\tcmpt->sgnd = atoi(jas_tvparser_getval(tvp));\n\t\t\tbreak;\n\t\tcase MIF_DATA:\n\t\t\tif (!(cmpt->data = jas_strdup(jas_tvparser_getval(tvp)))) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!cmpt->sampperx || !cmpt->samppery) {\n\t\tgoto error;\n\t}\n\tif (mif_hdr_addcmpt(hdr, hdr->numcmpts, cmpt)) {\n\t\tgoto error;\n\t}\n\tjas_tvparser_destroy(tvp);\n\treturn 0;\n\nerror:\n\tif (cmpt) {\n\t\tmif_cmpt_destroy(cmpt);\n\t}\n\tif (tvp) {\n\t\tjas_tvparser_destroy(tvp);\n\t}\n\treturn -1;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"mif_process_cmpt","file_name":"src/libjasper/mif/mif_cod.c","commit_link":"github.com/mdadams/jasper/commit/df5d2867e8004e51e18b89865bc4aa69229227b3","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#12-9291b4857ded","input":"onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,\n OnigCompileInfo* ci, OnigErrorInfo* einfo)\n{\n int r;\n UChar *cpat, *cpat_end;\n\n if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL;\n\n if (ci->pattern_enc != ci->target_enc) {\n r = conv_encoding(ci->pattern_enc, ci->target_enc, pattern, pattern_end,\n &cpat, &cpat_end);\n if (r != 0) return r;\n }\n else {\n cpat = (UChar* )pattern;\n cpat_end = (UChar* )pattern_end;\n }\n\n *reg = (regex_t* )xmalloc(sizeof(regex_t));\n if (IS_NULL(*reg)) {\n r = ONIGERR_MEMORY;\n goto err2;\n }\n\n r = onig_reg_init(*reg, ci->option, ci->case_fold_flag, ci->target_enc,\n ci->syntax);\n if (r != 0) goto err;\n\n r = onig_compile(*reg, cpat, cpat_end, einfo);\n if (r != 0) {\n err:\n onig_free(*reg);\n *reg = NULL;\n }\n\n err2:\n if (cpat != pattern) xfree(cpat);\n\n return r;\n}","target":"onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,\n OnigCompileInfo* ci, OnigErrorInfo* einfo)\n{\n int r;\n UChar *cpat, *cpat_end;\n\n if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL;\n\n if (ci->pattern_enc != ci->target_enc) {\n return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION;\n }\n else {\n cpat = (UChar* )pattern;\n cpat_end = (UChar* )pattern_end;\n }\n\n *reg = (regex_t* )xmalloc(sizeof(regex_t));\n if (IS_NULL(*reg)) {\n r = ONIGERR_MEMORY;\n goto err2;\n }\n\n r = onig_reg_init(*reg, ci->option, ci->case_fold_flag, ci->target_enc,\n ci->syntax);\n if (r != 0) goto err;\n\n r = onig_compile(*reg, cpat, cpat_end, einfo);\n if (r != 0) {\n err:\n onig_free(*reg);\n *reg = NULL;\n }\n\n err2:\n if (cpat != pattern) xfree(cpat);\n\n return r;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"onig_new_deluxe","file_name":"src/regext.c","commit_link":"github.com/kkos/oniguruma/commit/0f7f61ed1b7b697e283e37bd2d731d0bd57adb55","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#13-839d8f3f21fb","input":"void usb_sg_cancel(struct usb_sg_request *io)\n{\n\tunsigned long flags;\n\tint i, retval;\n\n\tspin_lock_irqsave(&io->lock, flags);\n\tif (io->status) {\n\t\tspin_unlock_irqrestore(&io->lock, flags);\n\t\treturn;\n\t}\n\t/* shut everything down */\n\tio->status = -ECONNRESET;\n\tspin_unlock_irqrestore(&io->lock, flags);\n\n\tfor (i = io->entries - 1; i >= 0; --i) {\n\t\tusb_block_urb(io->urbs[i]);\n\n\t\tretval = usb_unlink_urb(io->urbs[i]);\n\t\tif (retval != -EINPROGRESS\n\t\t && retval != -ENODEV\n\t\t && retval != -EBUSY\n\t\t && retval != -EIDRM)\n\t\t\tdev_warn(&io->dev->dev, \"%s, unlink --> %d\\n\",\n\t\t\t\t __func__, retval);\n\t}\n}","target":"void usb_sg_cancel(struct usb_sg_request *io)\n{\n\tunsigned long flags;\n\tint i, retval;\n\n\tspin_lock_irqsave(&io->lock, flags);\n\tif (io->status || io->count == 0) {\n\t\tspin_unlock_irqrestore(&io->lock, flags);\n\t\treturn;\n\t}\n\t/* shut everything down */\n\tio->status = -ECONNRESET;\n\tio->count++;\t\t/* Keep the request alive until we're done */\n\tspin_unlock_irqrestore(&io->lock, flags);\n\n\tfor (i = io->entries - 1; i >= 0; --i) {\n\t\tusb_block_urb(io->urbs[i]);\n\n\t\tretval = usb_unlink_urb(io->urbs[i]);\n\t\tif (retval != -EINPROGRESS\n\t\t && retval != -ENODEV\n\t\t && retval != -EBUSY\n\t\t && retval != -EIDRM)\n\t\t\tdev_warn(&io->dev->dev, \"%s, unlink --> %d\\n\",\n\t\t\t\t __func__, retval);\n\t}\n\n\tspin_lock_irqsave(&io->lock, flags);\n\tio->count--;\n\tif (!io->count)\n\t\tcomplete(&io->complete);\n\tspin_unlock_irqrestore(&io->lock, flags);\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"usb_sg_cancel","file_name":"drivers/usb/core/message.c","commit_link":"github.com/torvalds/linux/commit/056ad39ee9253873522f6469c3364964a322912b","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#14-d394ae829c02","input":"void ip4_datagram_release_cb(struct sock *sk)\n{\n\tconst struct inet_sock *inet = inet_sk(sk);\n\tconst struct ip_options_rcu *inet_opt;\n\t__be32 daddr = inet->inet_daddr;\n\tstruct flowi4 fl4;\n\tstruct rtable *rt;\n\n\tif (! __sk_dst_get(sk) || __sk_dst_check(sk, 0))\n\t\treturn;\n\n\trcu_read_lock();\n\tinet_opt = rcu_dereference(inet->inet_opt);\n\tif (inet_opt && inet_opt->opt.srr)\n\t\tdaddr = inet_opt->opt.faddr;\n\trt = ip_route_output_ports(sock_net(sk), &fl4, sk, daddr,\n\t\t\t\t inet->inet_saddr, inet->inet_dport,\n\t\t\t\t inet->inet_sport, sk->sk_protocol,\n\t\t\t\t RT_CONN_FLAGS(sk), sk->sk_bound_dev_if);\n\tif (!IS_ERR(rt))\n\t\t__sk_dst_set(sk, &rt->dst);\n\trcu_read_unlock();\n}","target":"void ip4_datagram_release_cb(struct sock *sk)\n{\n\tconst struct inet_sock *inet = inet_sk(sk);\n\tconst struct ip_options_rcu *inet_opt;\n\t__be32 daddr = inet->inet_daddr;\n\tstruct dst_entry *dst;\n\tstruct flowi4 fl4;\n\tstruct rtable *rt;\n\n\trcu_read_lock();\n\n\tdst = __sk_dst_get(sk);\n\tif (!dst || !dst->obsolete || dst->ops->check(dst, 0)) {\n\t\trcu_read_unlock();\n\t\treturn;\n\t}\n\tinet_opt = rcu_dereference(inet->inet_opt);\n\tif (inet_opt && inet_opt->opt.srr)\n\t\tdaddr = inet_opt->opt.faddr;\n\trt = ip_route_output_ports(sock_net(sk), &fl4, sk, daddr,\n\t\t\t\t inet->inet_saddr, inet->inet_dport,\n\t\t\t\t inet->inet_sport, sk->sk_protocol,\n\t\t\t\t RT_CONN_FLAGS(sk), sk->sk_bound_dev_if);\n\n\tdst = !IS_ERR(rt) ? &rt->dst : NULL;\n\tsk_dst_set(sk, dst);\n\n\trcu_read_unlock();\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"ip4_datagram_release_cb","file_name":"net/ipv4/datagram.c","commit_link":"github.com/torvalds/linux/commit/9709674e68646cee5a24e3000b3558d25412203a","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#15-2a8d605720da","input":"mark_context_stack(mrb_state *mrb, struct mrb_context *c)\n{\n size_t i;\n size_t e;\n\n if (c->stack == NULL) return;\n e = c->stack - c->stbase;\n if (c->ci) e += c->ci->nregs;\n if (c->stbase + e > c->stend) e = c->stend - c->stbase;\n for (i=0; istbase[i];\n\n if (!mrb_immediate_p(v)) {\n if (mrb_basic_ptr(v)->tt == MRB_TT_FREE) {\n c->stbase[i] = mrb_nil_value();\n }\n else {\n mrb_gc_mark(mrb, mrb_basic_ptr(v));\n }\n }\n }\n}","target":"mark_context_stack(mrb_state *mrb, struct mrb_context *c)\n{\n size_t i;\n size_t e;\n mrb_value nil;\n\n if (c->stack == NULL) return;\n e = c->stack - c->stbase;\n if (c->ci) e += c->ci->nregs;\n if (c->stbase + e > c->stend) e = c->stend - c->stbase;\n for (i=0; istbase[i];\n\n if (!mrb_immediate_p(v)) {\n mrb_gc_mark(mrb, mrb_basic_ptr(v));\n }\n }\n e = c->stend - c->stbase;\n nil = mrb_nil_value();\n for (; istbase[i] = nil;\n }\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"mark_context_stack","file_name":"src/gc.c","commit_link":"github.com/mruby/mruby/commit/5c114c91d4ff31859fcd84cf8bf349b737b90d99","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#16-a82a08b96d69","input":"int shadow_server_start(rdpShadowServer* server)\n{\n\tBOOL ipc;\n\tBOOL status;\n\tWSADATA wsaData;\n\n\tif (!server)\n\t\treturn -1;\n\n\tif (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)\n\t\treturn -1;\n\n#ifndef _WIN32\n\tsignal(SIGPIPE, SIG_IGN);\n#endif\n\tserver->screen = shadow_screen_new(server);\n\n\tif (!server->screen)\n\t{\n\t\tWLog_ERR(TAG, \"screen_new failed\");\n\t\treturn -1;\n\t}\n\n\tserver->capture = shadow_capture_new(server);\n\n\tif (!server->capture)\n\t{\n\t\tWLog_ERR(TAG, \"capture_new failed\");\n\t\treturn -1;\n\t}\n\n\t/* Bind magic:\n\t *\n\t * emtpy ... bind TCP all\n\t * ... bind local (IPC)\n\t * bind-socket,
... bind TCP to specified interface\n\t */\n\tipc = server->ipcSocket && (strncmp(bind_address, server->ipcSocket,\n\t strnlen(bind_address, sizeof(bind_address))) != 0);\n\tif (!ipc)\n\t{\n\t\tsize_t x, count;\n\t\tchar** list = CommandLineParseCommaSeparatedValuesEx(NULL, server->ipcSocket, &count);\n\t\tif (!list || (count <= 1))\n\t\t{\n\t\t\tfree(list);\n\t\t\tif (server->ipcSocket == NULL)\n\t\t\t{\n\t\t\t\tif (!open_port(server, NULL))\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tfor (x = 1; x < count; x++)\n\t\t{\n\t\t\tBOOL success = open_port(server, list[x]);\n\t\t\tif (!success)\n\t\t\t{\n\t\t\t\tfree(list);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfree(list);\n\t}\n\telse\n\t{\n\t\tstatus = server->listener->OpenLocal(server->listener, server->ipcSocket);\n\t\tif (!status)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"Problem creating local socket listener. (Port already used or \"\n\t\t\t \"insufficient permissions?)\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\tif (!(server->thread = CreateThread(NULL, 0, shadow_server_thread, (void*)server, 0, NULL)))\n\t{\n\t\treturn -1;\n\t}\n\n\treturn 0;\n}","target":"int shadow_server_start(rdpShadowServer* server)\n{\n\tBOOL ipc;\n\tBOOL status;\n\tWSADATA wsaData;\n\n\tif (!server)\n\t\treturn -1;\n\n\tif (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)\n\t\treturn -1;\n\n#ifndef _WIN32\n\tsignal(SIGPIPE, SIG_IGN);\n#endif\n\tserver->screen = shadow_screen_new(server);\n\n\tif (!server->screen)\n\t{\n\t\tWLog_ERR(TAG, \"screen_new failed\");\n\t\treturn -1;\n\t}\n\n\tserver->capture = shadow_capture_new(server);\n\n\tif (!server->capture)\n\t{\n\t\tWLog_ERR(TAG, \"capture_new failed\");\n\t\treturn -1;\n\t}\n\n\t/* Bind magic:\n\t *\n\t * emtpy ... bind TCP all\n\t * ... bind local (IPC)\n\t * bind-socket,
... bind TCP to specified interface\n\t */\n\tipc = server->ipcSocket && (strncmp(bind_address, server->ipcSocket,\n\t strnlen(bind_address, sizeof(bind_address))) != 0);\n\tif (!ipc)\n\t{\n\t\tsize_t x, count;\n\t\tchar** list = CommandLineParseCommaSeparatedValuesEx(NULL, server->ipcSocket, &count);\n\t\tif (!list || (count <= 1))\n\t\t{\n\t\t\tif (server->ipcSocket == NULL)\n\t\t\t{\n\t\t\t\tif (!open_port(server, NULL))\n\t\t\t\t{\n\t\t\t\t\tfree(list);\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfree(list);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\n\t\tfor (x = 1; x < count; x++)\n\t\t{\n\t\t\tBOOL success = open_port(server, list[x]);\n\t\t\tif (!success)\n\t\t\t{\n\t\t\t\tfree(list);\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfree(list);\n\t}\n\telse\n\t{\n\t\tstatus = server->listener->OpenLocal(server->listener, server->ipcSocket);\n\t\tif (!status)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"Problem creating local socket listener. (Port already used or \"\n\t\t\t \"insufficient permissions?)\");\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\tif (!(server->thread = CreateThread(NULL, 0, shadow_server_thread, (void*)server, 0, NULL)))\n\t{\n\t\treturn -1;\n\t}\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"shadow_server_start","file_name":"server/shadow/shadow_server.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/6d86e20e1e7caaab4f0c7f89e36d32914dbccc52","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#17-81092e48d8c0","input":"CURLcode Curl_close(struct Curl_easy *data)\n{\n struct Curl_multi *m;\n\n if(!data)\n return CURLE_OK;\n\n Curl_expire_clear(data); /* shut off timers */\n\n m = data->multi;\n if(m)\n /* This handle is still part of a multi handle, take care of this first\n and detach this handle from there. */\n curl_multi_remove_handle(data->multi, data);\n\n if(data->multi_easy)\n /* when curl_easy_perform() is used, it creates its own multi handle to\n use and this is the one */\n curl_multi_cleanup(data->multi_easy);\n\n /* Destroy the timeout list that is held in the easy handle. It is\n /normally/ done by curl_multi_remove_handle() but this is \"just in\n case\" */\n Curl_llist_destroy(&data->state.timeoutlist, NULL);\n\n data->magic = 0; /* force a clear AFTER the possibly enforced removal from\n the multi handle, since that function uses the magic\n field! */\n\n if(data->state.rangestringalloc)\n free(data->state.range);\n\n /* freed here just in case DONE wasn't called */\n Curl_free_request_state(data);\n\n /* Close down all open SSL info and sessions */\n Curl_ssl_close_all(data);\n Curl_safefree(data->state.first_host);\n Curl_safefree(data->state.scratch);\n Curl_ssl_free_certinfo(data);\n\n /* Cleanup possible redirect junk */\n free(data->req.newurl);\n data->req.newurl = NULL;\n\n if(data->change.referer_alloc) {\n Curl_safefree(data->change.referer);\n data->change.referer_alloc = FALSE;\n }\n data->change.referer = NULL;\n\n Curl_up_free(data);\n Curl_safefree(data->state.buffer);\n Curl_safefree(data->state.headerbuff);\n Curl_safefree(data->state.ulbuf);\n Curl_flush_cookies(data, 1);\n Curl_digest_cleanup(data);\n Curl_safefree(data->info.contenttype);\n Curl_safefree(data->info.wouldredirect);\n\n /* this destroys the channel and we cannot use it anymore after this */\n Curl_resolver_cleanup(data->state.resolver);\n\n Curl_http2_cleanup_dependencies(data);\n Curl_convert_close(data);\n\n /* No longer a dirty share, if it exists */\n if(data->share) {\n Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);\n data->share->dirty--;\n Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);\n }\n\n /* destruct wildcard structures if it is needed */\n Curl_wildcard_dtor(&data->wildcard);\n Curl_freeset(data);\n free(data);\n return CURLE_OK;\n}","target":"CURLcode Curl_close(struct Curl_easy *data)\n{\n struct Curl_multi *m;\n\n if(!data)\n return CURLE_OK;\n\n Curl_expire_clear(data); /* shut off timers */\n\n m = data->multi;\n if(m)\n /* This handle is still part of a multi handle, take care of this first\n and detach this handle from there. */\n curl_multi_remove_handle(data->multi, data);\n\n if(data->multi_easy) {\n /* when curl_easy_perform() is used, it creates its own multi handle to\n use and this is the one */\n curl_multi_cleanup(data->multi_easy);\n data->multi_easy = NULL;\n }\n\n /* Destroy the timeout list that is held in the easy handle. It is\n /normally/ done by curl_multi_remove_handle() but this is \"just in\n case\" */\n Curl_llist_destroy(&data->state.timeoutlist, NULL);\n\n data->magic = 0; /* force a clear AFTER the possibly enforced removal from\n the multi handle, since that function uses the magic\n field! */\n\n if(data->state.rangestringalloc)\n free(data->state.range);\n\n /* freed here just in case DONE wasn't called */\n Curl_free_request_state(data);\n\n /* Close down all open SSL info and sessions */\n Curl_ssl_close_all(data);\n Curl_safefree(data->state.first_host);\n Curl_safefree(data->state.scratch);\n Curl_ssl_free_certinfo(data);\n\n /* Cleanup possible redirect junk */\n free(data->req.newurl);\n data->req.newurl = NULL;\n\n if(data->change.referer_alloc) {\n Curl_safefree(data->change.referer);\n data->change.referer_alloc = FALSE;\n }\n data->change.referer = NULL;\n\n Curl_up_free(data);\n Curl_safefree(data->state.buffer);\n Curl_safefree(data->state.headerbuff);\n Curl_safefree(data->state.ulbuf);\n Curl_flush_cookies(data, 1);\n Curl_digest_cleanup(data);\n Curl_safefree(data->info.contenttype);\n Curl_safefree(data->info.wouldredirect);\n\n /* this destroys the channel and we cannot use it anymore after this */\n Curl_resolver_cleanup(data->state.resolver);\n\n Curl_http2_cleanup_dependencies(data);\n Curl_convert_close(data);\n\n /* No longer a dirty share, if it exists */\n if(data->share) {\n Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);\n data->share->dirty--;\n Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);\n }\n\n /* destruct wildcard structures if it is needed */\n Curl_wildcard_dtor(&data->wildcard);\n Curl_freeset(data);\n free(data);\n return CURLE_OK;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"Curl_close","file_name":"lib/url.c","commit_link":"github.com/curl/curl/commit/81d135d67155c5295b1033679c606165d4e28f3f","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#18-e757c3320e5f","input":"ExprAppendMultiKeysymList(ExprDef *expr, ExprDef *append)\n{\n unsigned nSyms = darray_size(expr->keysym_list.syms);\n unsigned numEntries = darray_size(append->keysym_list.syms);\n\n darray_append(expr->keysym_list.symsMapIndex, nSyms);\n darray_append(expr->keysym_list.symsNumEntries, numEntries);\n darray_concat(expr->keysym_list.syms, append->keysym_list.syms);\n\n FreeStmt((ParseCommon *) &append);\n\n return expr;\n}","target":"ExprAppendMultiKeysymList(ExprDef *expr, ExprDef *append)\n{\n unsigned nSyms = darray_size(expr->keysym_list.syms);\n unsigned numEntries = darray_size(append->keysym_list.syms);\n\n darray_append(expr->keysym_list.symsMapIndex, nSyms);\n darray_append(expr->keysym_list.symsNumEntries, numEntries);\n darray_concat(expr->keysym_list.syms, append->keysym_list.syms);\n\n FreeStmt((ParseCommon *) append);\n\n return expr;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"ExprAppendMultiKeysymList","file_name":"src/xkbcomp/ast-build.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/c1e5ac16e77a21f87bdf3bc4dea61b037a17dddb","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#19-1f066d22ef08","input":"static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,\n\tstruct user_namespace *user_ns)\n{\n\tmm->mmap = NULL;\n\tmm->mm_rb = RB_ROOT;\n\tmm->vmacache_seqnum = 0;\n\tatomic_set(&mm->mm_users, 1);\n\tatomic_set(&mm->mm_count, 1);\n\tinit_rwsem(&mm->mmap_sem);\n\tINIT_LIST_HEAD(&mm->mmlist);\n\tmm->core_state = NULL;\n\tatomic_long_set(&mm->nr_ptes, 0);\n\tmm_nr_pmds_init(mm);\n\tmm->map_count = 0;\n\tmm->locked_vm = 0;\n\tmm->pinned_vm = 0;\n\tmemset(&mm->rss_stat, 0, sizeof(mm->rss_stat));\n\tspin_lock_init(&mm->page_table_lock);\n\tmm_init_cpumask(mm);\n\tmm_init_aio(mm);\n\tmm_init_owner(mm, p);\n\tmmu_notifier_mm_init(mm);\n\tinit_tlb_flush_pending(mm);\n#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS\n\tmm->pmd_huge_pte = NULL;\n#endif\n\n\tif (current->mm) {\n\t\tmm->flags = current->mm->flags & MMF_INIT_MASK;\n\t\tmm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK;\n\t} else {\n\t\tmm->flags = default_dump_filter;\n\t\tmm->def_flags = 0;\n\t}\n\n\tif (mm_alloc_pgd(mm))\n\t\tgoto fail_nopgd;\n\n\tif (init_new_context(p, mm))\n\t\tgoto fail_nocontext;\n\n\tmm->user_ns = get_user_ns(user_ns);\n\treturn mm;\n\nfail_nocontext:\n\tmm_free_pgd(mm);\nfail_nopgd:\n\tfree_mm(mm);\n\treturn NULL;\n}","target":"static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,\n\tstruct user_namespace *user_ns)\n{\n\tmm->mmap = NULL;\n\tmm->mm_rb = RB_ROOT;\n\tmm->vmacache_seqnum = 0;\n\tatomic_set(&mm->mm_users, 1);\n\tatomic_set(&mm->mm_count, 1);\n\tinit_rwsem(&mm->mmap_sem);\n\tINIT_LIST_HEAD(&mm->mmlist);\n\tmm->core_state = NULL;\n\tatomic_long_set(&mm->nr_ptes, 0);\n\tmm_nr_pmds_init(mm);\n\tmm->map_count = 0;\n\tmm->locked_vm = 0;\n\tmm->pinned_vm = 0;\n\tmemset(&mm->rss_stat, 0, sizeof(mm->rss_stat));\n\tspin_lock_init(&mm->page_table_lock);\n\tmm_init_cpumask(mm);\n\tmm_init_aio(mm);\n\tmm_init_owner(mm, p);\n\tRCU_INIT_POINTER(mm->exe_file, NULL);\n\tmmu_notifier_mm_init(mm);\n\tinit_tlb_flush_pending(mm);\n#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS\n\tmm->pmd_huge_pte = NULL;\n#endif\n\n\tif (current->mm) {\n\t\tmm->flags = current->mm->flags & MMF_INIT_MASK;\n\t\tmm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK;\n\t} else {\n\t\tmm->flags = default_dump_filter;\n\t\tmm->def_flags = 0;\n\t}\n\n\tif (mm_alloc_pgd(mm))\n\t\tgoto fail_nopgd;\n\n\tif (init_new_context(p, mm))\n\t\tgoto fail_nocontext;\n\n\tmm->user_ns = get_user_ns(user_ns);\n\treturn mm;\n\nfail_nocontext:\n\tmm_free_pgd(mm);\nfail_nopgd:\n\tfree_mm(mm);\n\treturn NULL;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"mm_init","file_name":"kernel/fork.c","commit_link":"github.com/torvalds/linux/commit/2b7e8665b4ff51c034c55df3cff76518d1a9ee3a","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#20-1e72969746fc","input":"PHP_MINIT_FUNCTION(spl_array)\n{\n\tREGISTER_SPL_STD_CLASS_EX(ArrayObject, spl_array_object_new, spl_funcs_ArrayObject);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Serializable);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Countable);\n\tmemcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers));\n\n\tspl_handler_ArrayObject.clone_obj = spl_array_object_clone;\n\tspl_handler_ArrayObject.read_dimension = spl_array_read_dimension;\n\tspl_handler_ArrayObject.write_dimension = spl_array_write_dimension;\n\tspl_handler_ArrayObject.unset_dimension = spl_array_unset_dimension;\n\tspl_handler_ArrayObject.has_dimension = spl_array_has_dimension;\n\tspl_handler_ArrayObject.count_elements = spl_array_object_count_elements;\n\n\tspl_handler_ArrayObject.get_properties = spl_array_get_properties;\n\tspl_handler_ArrayObject.get_debug_info = spl_array_get_debug_info;\n\tspl_handler_ArrayObject.get_gc = spl_array_get_gc;\n\tspl_handler_ArrayObject.read_property = spl_array_read_property;\n\tspl_handler_ArrayObject.write_property = spl_array_write_property;\n\tspl_handler_ArrayObject.get_property_ptr_ptr = spl_array_get_property_ptr_ptr;\n\tspl_handler_ArrayObject.has_property = spl_array_has_property;\n\tspl_handler_ArrayObject.unset_property = spl_array_unset_property;\n\n\tspl_handler_ArrayObject.compare_objects = spl_array_compare_objects;\n\n\tREGISTER_SPL_STD_CLASS_EX(ArrayIterator, spl_array_object_new, spl_funcs_ArrayIterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Iterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Serializable);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable);\n\tmemcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers));\n\tspl_ce_ArrayIterator->get_iterator = spl_array_get_iterator;\n\n\tREGISTER_SPL_SUB_CLASS_EX(RecursiveArrayIterator, ArrayIterator, spl_array_object_new, spl_funcs_RecursiveArrayIterator);\n\tREGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator);\n\tspl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator;\n\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayObject, \"STD_PROP_LIST\", SPL_ARRAY_STD_PROP_LIST);\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayObject, \"ARRAY_AS_PROPS\", SPL_ARRAY_ARRAY_AS_PROPS);\n\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, \"STD_PROP_LIST\", SPL_ARRAY_STD_PROP_LIST);\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, \"ARRAY_AS_PROPS\", SPL_ARRAY_ARRAY_AS_PROPS);\n\n\tREGISTER_SPL_CLASS_CONST_LONG(RecursiveArrayIterator, \"CHILD_ARRAYS_ONLY\", SPL_ARRAY_CHILD_ARRAYS_ONLY);\n\n\treturn SUCCESS;\n}","target":"PHP_MINIT_FUNCTION(spl_array)\n{\n\tREGISTER_SPL_STD_CLASS_EX(ArrayObject, spl_array_object_new, spl_funcs_ArrayObject);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Serializable);\n\tREGISTER_SPL_IMPLEMENTS(ArrayObject, Countable);\n\tmemcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers));\n\n\tspl_handler_ArrayObject.clone_obj = spl_array_object_clone;\n\tspl_handler_ArrayObject.read_dimension = spl_array_read_dimension;\n\tspl_handler_ArrayObject.write_dimension = spl_array_write_dimension;\n\tspl_handler_ArrayObject.unset_dimension = spl_array_unset_dimension;\n\tspl_handler_ArrayObject.has_dimension = spl_array_has_dimension;\n\tspl_handler_ArrayObject.count_elements = spl_array_object_count_elements;\n\n\tspl_handler_ArrayObject.get_properties = spl_array_get_properties;\n\tspl_handler_ArrayObject.get_debug_info = spl_array_get_debug_info;\n\tspl_handler_ArrayObject.get_gc = spl_array_get_gc;\n\tspl_handler_ArrayObject.read_property = spl_array_read_property;\n\tspl_handler_ArrayObject.write_property = spl_array_write_property;\n\tspl_handler_ArrayObject.get_property_ptr_ptr = spl_array_get_property_ptr_ptr;\n\tspl_handler_ArrayObject.has_property = spl_array_has_property;\n\tspl_handler_ArrayObject.unset_property = spl_array_unset_property;\n\n\tspl_handler_ArrayObject.compare_objects = spl_array_compare_objects;\n\n\tREGISTER_SPL_STD_CLASS_EX(ArrayIterator, spl_array_object_new, spl_funcs_ArrayIterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Iterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Serializable);\n\tREGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable);\n\tmemcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers));\n\tspl_ce_ArrayIterator->get_iterator = spl_array_get_iterator;\n\n\tREGISTER_SPL_SUB_CLASS_EX(RecursiveArrayIterator, ArrayIterator, spl_array_object_new, spl_funcs_RecursiveArrayIterator);\n\tREGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator);\n\tspl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator;\n\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayObject, \"STD_PROP_LIST\", SPL_ARRAY_STD_PROP_LIST);\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayObject, \"ARRAY_AS_PROPS\", SPL_ARRAY_ARRAY_AS_PROPS);\n\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, \"STD_PROP_LIST\", SPL_ARRAY_STD_PROP_LIST);\n\tREGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, \"ARRAY_AS_PROPS\", SPL_ARRAY_ARRAY_AS_PROPS);\n\n\tREGISTER_SPL_CLASS_CONST_LONG(RecursiveArrayIterator, \"CHILD_ARRAYS_ONLY\", SPL_ARRAY_CHILD_ARRAYS_ONLY);\n\n\treturn SUCCESS;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"PHP_MINIT_FUNCTION","file_name":"ext/spl/spl_array.c","commit_link":"github.com/php/php-src/commit/3f627e580acfdaf0595ae3b115b8bec677f203ee?w=1","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#21-b37ea06419b0","input":"static long do_get_mempolicy(int *policy, nodemask_t *nmask,\n\t\t\t unsigned long addr, unsigned long flags)\n{\n\tint err;\n\tstruct mm_struct *mm = current->mm;\n\tstruct vm_area_struct *vma = NULL;\n\tstruct mempolicy *pol = current->mempolicy;\n\n\tif (flags &\n\t\t~(unsigned long)(MPOL_F_NODE|MPOL_F_ADDR|MPOL_F_MEMS_ALLOWED))\n\t\treturn -EINVAL;\n\n\tif (flags & MPOL_F_MEMS_ALLOWED) {\n\t\tif (flags & (MPOL_F_NODE|MPOL_F_ADDR))\n\t\t\treturn -EINVAL;\n\t\t*policy = 0;\t/* just so it's initialized */\n\t\ttask_lock(current);\n\t\t*nmask = cpuset_current_mems_allowed;\n\t\ttask_unlock(current);\n\t\treturn 0;\n\t}\n\n\tif (flags & MPOL_F_ADDR) {\n\t\t/*\n\t\t * Do NOT fall back to task policy if the\n\t\t * vma/shared policy at addr is NULL. We\n\t\t * want to return MPOL_DEFAULT in this case.\n\t\t */\n\t\tdown_read(&mm->mmap_sem);\n\t\tvma = find_vma_intersection(mm, addr, addr+1);\n\t\tif (!vma) {\n\t\t\tup_read(&mm->mmap_sem);\n\t\t\treturn -EFAULT;\n\t\t}\n\t\tif (vma->vm_ops && vma->vm_ops->get_policy)\n\t\t\tpol = vma->vm_ops->get_policy(vma, addr);\n\t\telse\n\t\t\tpol = vma->vm_policy;\n\t} else if (addr)\n\t\treturn -EINVAL;\n\n\tif (!pol)\n\t\tpol = &default_policy;\t/* indicates default behavior */\n\n\tif (flags & MPOL_F_NODE) {\n\t\tif (flags & MPOL_F_ADDR) {\n\t\t\terr = lookup_node(addr);\n\t\t\tif (err < 0)\n\t\t\t\tgoto out;\n\t\t\t*policy = err;\n\t\t} else if (pol == current->mempolicy &&\n\t\t\t\tpol->mode == MPOL_INTERLEAVE) {\n\t\t\t*policy = next_node_in(current->il_prev, pol->v.nodes);\n\t\t} else {\n\t\t\terr = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t} else {\n\t\t*policy = pol == &default_policy ? MPOL_DEFAULT :\n\t\t\t\t\t\tpol->mode;\n\t\t/*\n\t\t * Internal mempolicy flags must be masked off before exposing\n\t\t * the policy to userspace.\n\t\t */\n\t\t*policy |= (pol->flags & MPOL_MODE_FLAGS);\n\t}\n\n\tif (vma) {\n\t\tup_read(¤t->mm->mmap_sem);\n\t\tvma = NULL;\n\t}\n\n\terr = 0;\n\tif (nmask) {\n\t\tif (mpol_store_user_nodemask(pol)) {\n\t\t\t*nmask = pol->w.user_nodemask;\n\t\t} else {\n\t\t\ttask_lock(current);\n\t\t\tget_policy_nodemask(pol, nmask);\n\t\t\ttask_unlock(current);\n\t\t}\n\t}\n\n out:\n\tmpol_cond_put(pol);\n\tif (vma)\n\t\tup_read(¤t->mm->mmap_sem);\n\treturn err;\n}","target":"static long do_get_mempolicy(int *policy, nodemask_t *nmask,\n\t\t\t unsigned long addr, unsigned long flags)\n{\n\tint err;\n\tstruct mm_struct *mm = current->mm;\n\tstruct vm_area_struct *vma = NULL;\n\tstruct mempolicy *pol = current->mempolicy;\n\n\tif (flags &\n\t\t~(unsigned long)(MPOL_F_NODE|MPOL_F_ADDR|MPOL_F_MEMS_ALLOWED))\n\t\treturn -EINVAL;\n\n\tif (flags & MPOL_F_MEMS_ALLOWED) {\n\t\tif (flags & (MPOL_F_NODE|MPOL_F_ADDR))\n\t\t\treturn -EINVAL;\n\t\t*policy = 0;\t/* just so it's initialized */\n\t\ttask_lock(current);\n\t\t*nmask = cpuset_current_mems_allowed;\n\t\ttask_unlock(current);\n\t\treturn 0;\n\t}\n\n\tif (flags & MPOL_F_ADDR) {\n\t\t/*\n\t\t * Do NOT fall back to task policy if the\n\t\t * vma/shared policy at addr is NULL. We\n\t\t * want to return MPOL_DEFAULT in this case.\n\t\t */\n\t\tdown_read(&mm->mmap_sem);\n\t\tvma = find_vma_intersection(mm, addr, addr+1);\n\t\tif (!vma) {\n\t\t\tup_read(&mm->mmap_sem);\n\t\t\treturn -EFAULT;\n\t\t}\n\t\tif (vma->vm_ops && vma->vm_ops->get_policy)\n\t\t\tpol = vma->vm_ops->get_policy(vma, addr);\n\t\telse\n\t\t\tpol = vma->vm_policy;\n\t} else if (addr)\n\t\treturn -EINVAL;\n\n\tif (!pol)\n\t\tpol = &default_policy;\t/* indicates default behavior */\n\n\tif (flags & MPOL_F_NODE) {\n\t\tif (flags & MPOL_F_ADDR) {\n\t\t\terr = lookup_node(addr);\n\t\t\tif (err < 0)\n\t\t\t\tgoto out;\n\t\t\t*policy = err;\n\t\t} else if (pol == current->mempolicy &&\n\t\t\t\tpol->mode == MPOL_INTERLEAVE) {\n\t\t\t*policy = next_node_in(current->il_prev, pol->v.nodes);\n\t\t} else {\n\t\t\terr = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t} else {\n\t\t*policy = pol == &default_policy ? MPOL_DEFAULT :\n\t\t\t\t\t\tpol->mode;\n\t\t/*\n\t\t * Internal mempolicy flags must be masked off before exposing\n\t\t * the policy to userspace.\n\t\t */\n\t\t*policy |= (pol->flags & MPOL_MODE_FLAGS);\n\t}\n\n\terr = 0;\n\tif (nmask) {\n\t\tif (mpol_store_user_nodemask(pol)) {\n\t\t\t*nmask = pol->w.user_nodemask;\n\t\t} else {\n\t\t\ttask_lock(current);\n\t\t\tget_policy_nodemask(pol, nmask);\n\t\t\ttask_unlock(current);\n\t\t}\n\t}\n\n out:\n\tmpol_cond_put(pol);\n\tif (vma)\n\t\tup_read(¤t->mm->mmap_sem);\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"do_get_mempolicy","file_name":"mm/mempolicy.c","commit_link":"github.com/torvalds/linux/commit/73223e4e2e3867ebf033a5a8eb2e5df0158ccc99","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#22-7273dbd16cf8","input":" */\nstatic int wddx_stack_destroy(wddx_stack *stack)\n{\n\tregister int i;\n\n\tif (stack->elements) {\n\t\tfor (i = 0; i < stack->top; i++) {\n\t\t\tif (((st_entry *)stack->elements[i])->data\n\t\t\t\t\t&& ((st_entry *)stack->elements[i])->type != ST_FIELD)\t{\n\t\t\t\tzval_ptr_dtor(&((st_entry *)stack->elements[i])->data);\n\t\t\t}\n\t\t\tif (((st_entry *)stack->elements[i])->varname) {\n\t\t\t\tefree(((st_entry *)stack->elements[i])->varname);\n\t\t\t}\n\t\t\tefree(stack->elements[i]);\n\t\t}\n\t\tefree(stack->elements);\n\t}\n\treturn SUCCESS;","target":" */\nstatic int wddx_stack_destroy(wddx_stack *stack)\n{\n\tregister int i;\n\n\tif (stack->elements) {\n\t\tfor (i = 0; i < stack->top; i++) {\n\t\t\tif (((st_entry *)stack->elements[i])->data\n\t\t\t\t\t&& ((st_entry *)stack->elements[i])->type != ST_FIELD)\t{\n\t\t\t\tzval_ptr_dtor(&((st_entry *)stack->elements[i])->data);\n\t\t\t}\n\t\t\tif (((st_entry *)stack->elements[i])->varname) {\n\t\t\t\tefree(((st_entry *)stack->elements[i])->varname);\n\t\t\t}\n\t\t\tefree(stack->elements[i]);\n\t\t}\n\t\tefree(stack->elements);\n\t}\n\treturn SUCCESS;","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"wddx_stack_destroy","file_name":"ext/wddx/wddx.c","commit_link":"github.com/php/php-src/commit/b88393f08a558eec14964a55d3c680fe67407712?w=1","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#23-e00be796edec","input":"static void regulator_ena_gpio_free(struct regulator_dev *rdev)\n{\n\tstruct regulator_enable_gpio *pin, *n;\n\n\tif (!rdev->ena_pin)\n\t\treturn;\n\n\t/* Free the GPIO only in case of no use */\n\tlist_for_each_entry_safe(pin, n, ®ulator_ena_gpio_list, list) {\n\t\tif (pin->gpiod == rdev->ena_pin->gpiod) {\n\t\t\tif (pin->request_count <= 1) {\n\t\t\t\tpin->request_count = 0;\n\t\t\t\tgpiod_put(pin->gpiod);\n\t\t\t\tlist_del(&pin->list);\n\t\t\t\tkfree(pin);\n\t\t\t} else {\n\t\t\t\tpin->request_count--;\n\t\t\t}\n\t\t}\n\t}\n}","target":"static void regulator_ena_gpio_free(struct regulator_dev *rdev)\n{\n\tstruct regulator_enable_gpio *pin, *n;\n\n\tif (!rdev->ena_pin)\n\t\treturn;\n\n\t/* Free the GPIO only in case of no use */\n\tlist_for_each_entry_safe(pin, n, ®ulator_ena_gpio_list, list) {\n\t\tif (pin->gpiod == rdev->ena_pin->gpiod) {\n\t\t\tif (pin->request_count <= 1) {\n\t\t\t\tpin->request_count = 0;\n\t\t\t\tgpiod_put(pin->gpiod);\n\t\t\t\tlist_del(&pin->list);\n\t\t\t\tkfree(pin);\n\t\t\t\trdev->ena_pin = NULL;\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tpin->request_count--;\n\t\t\t}\n\t\t}\n\t}\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"regulator_ena_gpio_free","file_name":"drivers/regulator/core.c","commit_link":"github.com/torvalds/linux/commit/60a2362f769cf549dc466134efe71c8bf9fbaaba","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#24-e19cb1ec270e","input":"static int usb_console_setup(struct console *co, char *options)\n{\n\tstruct usbcons_info *info = &usbcons_info;\n\tint baud = 9600;\n\tint bits = 8;\n\tint parity = 'n';\n\tint doflow = 0;\n\tint cflag = CREAD | HUPCL | CLOCAL;\n\tchar *s;\n\tstruct usb_serial *serial;\n\tstruct usb_serial_port *port;\n\tint retval;\n\tstruct tty_struct *tty = NULL;\n\tstruct ktermios dummy;\n\n\tif (options) {\n\t\tbaud = simple_strtoul(options, NULL, 10);\n\t\ts = options;\n\t\twhile (*s >= '0' && *s <= '9')\n\t\t\ts++;\n\t\tif (*s)\n\t\t\tparity = *s++;\n\t\tif (*s)\n\t\t\tbits = *s++ - '0';\n\t\tif (*s)\n\t\t\tdoflow = (*s++ == 'r');\n\t}\n\t\n\t/* Sane default */\n\tif (baud == 0)\n\t\tbaud = 9600;\n\n\tswitch (bits) {\n\tcase 7:\n\t\tcflag |= CS7;\n\t\tbreak;\n\tdefault:\n\tcase 8:\n\t\tcflag |= CS8;\n\t\tbreak;\n\t}\n\tswitch (parity) {\n\tcase 'o': case 'O':\n\t\tcflag |= PARODD;\n\t\tbreak;\n\tcase 'e': case 'E':\n\t\tcflag |= PARENB;\n\t\tbreak;\n\t}\n\tco->cflag = cflag;\n\n\t/*\n\t * no need to check the index here: if the index is wrong, console\n\t * code won't call us\n\t */\n\tport = usb_serial_port_get_by_minor(co->index);\n\tif (port == NULL) {\n\t\t/* no device is connected yet, sorry :( */\n\t\tpr_err(\"No USB device connected to ttyUSB%i\\n\", co->index);\n\t\treturn -ENODEV;\n\t}\n\tserial = port->serial;\n\n\tretval = usb_autopm_get_interface(serial->interface);\n\tif (retval)\n\t\tgoto error_get_interface;\n\n\ttty_port_tty_set(&port->port, NULL);\n\n\tinfo->port = port;\n\n\t++port->port.count;\n\tif (!tty_port_initialized(&port->port)) {\n\t\tif (serial->type->set_termios) {\n\t\t\t/*\n\t\t\t * allocate a fake tty so the driver can initialize\n\t\t\t * the termios structure, then later call set_termios to\n\t\t\t * configure according to command line arguments\n\t\t\t */\n\t\t\ttty = kzalloc(sizeof(*tty), GFP_KERNEL);\n\t\t\tif (!tty) {\n\t\t\t\tretval = -ENOMEM;\n\t\t\t\tgoto reset_open_count;\n\t\t\t}\n\t\t\tkref_init(&tty->kref);\n\t\t\ttty->driver = usb_serial_tty_driver;\n\t\t\ttty->index = co->index;\n\t\t\tinit_ldsem(&tty->ldisc_sem);\n\t\t\tspin_lock_init(&tty->files_lock);\n\t\t\tINIT_LIST_HEAD(&tty->tty_files);\n\t\t\tkref_get(&tty->driver->kref);\n\t\t\t__module_get(tty->driver->owner);\n\t\t\ttty->ops = &usb_console_fake_tty_ops;\n\t\t\ttty_init_termios(tty);\n\t\t\ttty_port_tty_set(&port->port, tty);\n\t\t}\n\n\t\t/* only call the device specific open if this\n\t\t * is the first time the port is opened */\n\t\tretval = serial->type->open(NULL, port);\n\t\tif (retval) {\n\t\t\tdev_err(&port->dev, \"could not open USB console port\\n\");\n\t\t\tgoto fail;\n\t\t}\n\n\t\tif (serial->type->set_termios) {\n\t\t\ttty->termios.c_cflag = cflag;\n\t\t\ttty_termios_encode_baud_rate(&tty->termios, baud, baud);\n\t\t\tmemset(&dummy, 0, sizeof(struct ktermios));\n\t\t\tserial->type->set_termios(tty, port, &dummy);\n\n\t\t\ttty_port_tty_set(&port->port, NULL);\n\t\t\ttty_kref_put(tty);\n\t\t}\n\t\ttty_port_set_initialized(&port->port, 1);\n\t}\n\t/* Now that any required fake tty operations are completed restore\n\t * the tty port count */\n\t--port->port.count;\n\t/* The console is special in terms of closing the device so\n\t * indicate this port is now acting as a system console. */\n\tport->port.console = 1;\n\n\tmutex_unlock(&serial->disc_mutex);\n\treturn retval;\n\n fail:\n\ttty_port_tty_set(&port->port, NULL);\n\ttty_kref_put(tty);\n reset_open_count:\n\tport->port.count = 0;\n\tusb_autopm_put_interface(serial->interface);\n error_get_interface:\n\tusb_serial_put(serial);\n\tmutex_unlock(&serial->disc_mutex);\n\treturn retval;\n}","target":"static int usb_console_setup(struct console *co, char *options)\n{\n\tstruct usbcons_info *info = &usbcons_info;\n\tint baud = 9600;\n\tint bits = 8;\n\tint parity = 'n';\n\tint doflow = 0;\n\tint cflag = CREAD | HUPCL | CLOCAL;\n\tchar *s;\n\tstruct usb_serial *serial;\n\tstruct usb_serial_port *port;\n\tint retval;\n\tstruct tty_struct *tty = NULL;\n\tstruct ktermios dummy;\n\n\tif (options) {\n\t\tbaud = simple_strtoul(options, NULL, 10);\n\t\ts = options;\n\t\twhile (*s >= '0' && *s <= '9')\n\t\t\ts++;\n\t\tif (*s)\n\t\t\tparity = *s++;\n\t\tif (*s)\n\t\t\tbits = *s++ - '0';\n\t\tif (*s)\n\t\t\tdoflow = (*s++ == 'r');\n\t}\n\t\n\t/* Sane default */\n\tif (baud == 0)\n\t\tbaud = 9600;\n\n\tswitch (bits) {\n\tcase 7:\n\t\tcflag |= CS7;\n\t\tbreak;\n\tdefault:\n\tcase 8:\n\t\tcflag |= CS8;\n\t\tbreak;\n\t}\n\tswitch (parity) {\n\tcase 'o': case 'O':\n\t\tcflag |= PARODD;\n\t\tbreak;\n\tcase 'e': case 'E':\n\t\tcflag |= PARENB;\n\t\tbreak;\n\t}\n\tco->cflag = cflag;\n\n\t/*\n\t * no need to check the index here: if the index is wrong, console\n\t * code won't call us\n\t */\n\tport = usb_serial_port_get_by_minor(co->index);\n\tif (port == NULL) {\n\t\t/* no device is connected yet, sorry :( */\n\t\tpr_err(\"No USB device connected to ttyUSB%i\\n\", co->index);\n\t\treturn -ENODEV;\n\t}\n\tserial = port->serial;\n\n\tretval = usb_autopm_get_interface(serial->interface);\n\tif (retval)\n\t\tgoto error_get_interface;\n\n\ttty_port_tty_set(&port->port, NULL);\n\n\tinfo->port = port;\n\n\t++port->port.count;\n\tif (!tty_port_initialized(&port->port)) {\n\t\tif (serial->type->set_termios) {\n\t\t\t/*\n\t\t\t * allocate a fake tty so the driver can initialize\n\t\t\t * the termios structure, then later call set_termios to\n\t\t\t * configure according to command line arguments\n\t\t\t */\n\t\t\ttty = kzalloc(sizeof(*tty), GFP_KERNEL);\n\t\t\tif (!tty) {\n\t\t\t\tretval = -ENOMEM;\n\t\t\t\tgoto reset_open_count;\n\t\t\t}\n\t\t\tkref_init(&tty->kref);\n\t\t\ttty->driver = usb_serial_tty_driver;\n\t\t\ttty->index = co->index;\n\t\t\tinit_ldsem(&tty->ldisc_sem);\n\t\t\tspin_lock_init(&tty->files_lock);\n\t\t\tINIT_LIST_HEAD(&tty->tty_files);\n\t\t\tkref_get(&tty->driver->kref);\n\t\t\t__module_get(tty->driver->owner);\n\t\t\ttty->ops = &usb_console_fake_tty_ops;\n\t\t\ttty_init_termios(tty);\n\t\t\ttty_port_tty_set(&port->port, tty);\n\t\t}\n\n\t\t/* only call the device specific open if this\n\t\t * is the first time the port is opened */\n\t\tretval = serial->type->open(NULL, port);\n\t\tif (retval) {\n\t\t\tdev_err(&port->dev, \"could not open USB console port\\n\");\n\t\t\tgoto fail;\n\t\t}\n\n\t\tif (serial->type->set_termios) {\n\t\t\ttty->termios.c_cflag = cflag;\n\t\t\ttty_termios_encode_baud_rate(&tty->termios, baud, baud);\n\t\t\tmemset(&dummy, 0, sizeof(struct ktermios));\n\t\t\tserial->type->set_termios(tty, port, &dummy);\n\n\t\t\ttty_port_tty_set(&port->port, NULL);\n\t\t\ttty_kref_put(tty);\n\t\t}\n\t\ttty_port_set_initialized(&port->port, 1);\n\t}\n\t/* Now that any required fake tty operations are completed restore\n\t * the tty port count */\n\t--port->port.count;\n\t/* The console is special in terms of closing the device so\n\t * indicate this port is now acting as a system console. */\n\tport->port.console = 1;\n\n\tmutex_unlock(&serial->disc_mutex);\n\treturn retval;\n\n fail:\n\ttty_port_tty_set(&port->port, NULL);\n\ttty_kref_put(tty);\n reset_open_count:\n\tport->port.count = 0;\n\tinfo->port = NULL;\n\tusb_autopm_put_interface(serial->interface);\n error_get_interface:\n\tusb_serial_put(serial);\n\tmutex_unlock(&serial->disc_mutex);\n\treturn retval;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"usb_console_setup","file_name":"drivers/usb/serial/console.c","commit_link":"github.com/torvalds/linux/commit/299d7572e46f98534033a9e65973f13ad1ce9047","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#25-7fd54bf29395","input":"static int ipxitf_ioctl(unsigned int cmd, void __user *arg)\n{\n\tint rc = -EINVAL;\n\tstruct ifreq ifr;\n\tint val;\n\n\tswitch (cmd) {\n\tcase SIOCSIFADDR: {\n\t\tstruct sockaddr_ipx *sipx;\n\t\tstruct ipx_interface_definition f;\n\n\t\trc = -EFAULT;\n\t\tif (copy_from_user(&ifr, arg, sizeof(ifr)))\n\t\t\tbreak;\n\t\tsipx = (struct sockaddr_ipx *)&ifr.ifr_addr;\n\t\trc = -EINVAL;\n\t\tif (sipx->sipx_family != AF_IPX)\n\t\t\tbreak;\n\t\tf.ipx_network = sipx->sipx_network;\n\t\tmemcpy(f.ipx_device, ifr.ifr_name,\n\t\t\tsizeof(f.ipx_device));\n\t\tmemcpy(f.ipx_node, sipx->sipx_node, IPX_NODE_LEN);\n\t\tf.ipx_dlink_type = sipx->sipx_type;\n\t\tf.ipx_special = sipx->sipx_special;\n\n\t\tif (sipx->sipx_action == IPX_DLTITF)\n\t\t\trc = ipxitf_delete(&f);\n\t\telse\n\t\t\trc = ipxitf_create(&f);\n\t\tbreak;\n\t}\n\tcase SIOCGIFADDR: {\n\t\tstruct sockaddr_ipx *sipx;\n\t\tstruct ipx_interface *ipxif;\n\t\tstruct net_device *dev;\n\n\t\trc = -EFAULT;\n\t\tif (copy_from_user(&ifr, arg, sizeof(ifr)))\n\t\t\tbreak;\n\t\tsipx = (struct sockaddr_ipx *)&ifr.ifr_addr;\n\t\tdev = __dev_get_by_name(&init_net, ifr.ifr_name);\n\t\trc = -ENODEV;\n\t\tif (!dev)\n\t\t\tbreak;\n\t\tipxif = ipxitf_find_using_phys(dev,\n\t\t\t\t\t ipx_map_frame_type(sipx->sipx_type));\n\t\trc = -EADDRNOTAVAIL;\n\t\tif (!ipxif)\n\t\t\tbreak;\n\n\t\tsipx->sipx_family\t= AF_IPX;\n\t\tsipx->sipx_network\t= ipxif->if_netnum;\n\t\tmemcpy(sipx->sipx_node, ipxif->if_node,\n\t\t\tsizeof(sipx->sipx_node));\n\t\trc = -EFAULT;\n\t\tif (copy_to_user(arg, &ifr, sizeof(ifr)))\n\t\t\tbreak;\n\t\tipxitf_put(ipxif);\n\t\trc = 0;\n\t\tbreak;\n\t}\n\tcase SIOCAIPXITFCRT:\n\t\trc = -EFAULT;\n\t\tif (get_user(val, (unsigned char __user *) arg))\n\t\t\tbreak;\n\t\trc = 0;\n\t\tipxcfg_auto_create_interfaces = val;\n\t\tbreak;\n\tcase SIOCAIPXPRISLT:\n\t\trc = -EFAULT;\n\t\tif (get_user(val, (unsigned char __user *) arg))\n\t\t\tbreak;\n\t\trc = 0;\n\t\tipxcfg_set_auto_select(val);\n\t\tbreak;\n\t}\n\n\treturn rc;\n}","target":"static int ipxitf_ioctl(unsigned int cmd, void __user *arg)\n{\n\tint rc = -EINVAL;\n\tstruct ifreq ifr;\n\tint val;\n\n\tswitch (cmd) {\n\tcase SIOCSIFADDR: {\n\t\tstruct sockaddr_ipx *sipx;\n\t\tstruct ipx_interface_definition f;\n\n\t\trc = -EFAULT;\n\t\tif (copy_from_user(&ifr, arg, sizeof(ifr)))\n\t\t\tbreak;\n\t\tsipx = (struct sockaddr_ipx *)&ifr.ifr_addr;\n\t\trc = -EINVAL;\n\t\tif (sipx->sipx_family != AF_IPX)\n\t\t\tbreak;\n\t\tf.ipx_network = sipx->sipx_network;\n\t\tmemcpy(f.ipx_device, ifr.ifr_name,\n\t\t\tsizeof(f.ipx_device));\n\t\tmemcpy(f.ipx_node, sipx->sipx_node, IPX_NODE_LEN);\n\t\tf.ipx_dlink_type = sipx->sipx_type;\n\t\tf.ipx_special = sipx->sipx_special;\n\n\t\tif (sipx->sipx_action == IPX_DLTITF)\n\t\t\trc = ipxitf_delete(&f);\n\t\telse\n\t\t\trc = ipxitf_create(&f);\n\t\tbreak;\n\t}\n\tcase SIOCGIFADDR: {\n\t\tstruct sockaddr_ipx *sipx;\n\t\tstruct ipx_interface *ipxif;\n\t\tstruct net_device *dev;\n\n\t\trc = -EFAULT;\n\t\tif (copy_from_user(&ifr, arg, sizeof(ifr)))\n\t\t\tbreak;\n\t\tsipx = (struct sockaddr_ipx *)&ifr.ifr_addr;\n\t\tdev = __dev_get_by_name(&init_net, ifr.ifr_name);\n\t\trc = -ENODEV;\n\t\tif (!dev)\n\t\t\tbreak;\n\t\tipxif = ipxitf_find_using_phys(dev,\n\t\t\t\t\t ipx_map_frame_type(sipx->sipx_type));\n\t\trc = -EADDRNOTAVAIL;\n\t\tif (!ipxif)\n\t\t\tbreak;\n\n\t\tsipx->sipx_family\t= AF_IPX;\n\t\tsipx->sipx_network\t= ipxif->if_netnum;\n\t\tmemcpy(sipx->sipx_node, ipxif->if_node,\n\t\t\tsizeof(sipx->sipx_node));\n\t\trc = 0;\n\t\tif (copy_to_user(arg, &ifr, sizeof(ifr)))\n\t\t\trc = -EFAULT;\n\t\tipxitf_put(ipxif);\n\t\tbreak;\n\t}\n\tcase SIOCAIPXITFCRT:\n\t\trc = -EFAULT;\n\t\tif (get_user(val, (unsigned char __user *) arg))\n\t\t\tbreak;\n\t\trc = 0;\n\t\tipxcfg_auto_create_interfaces = val;\n\t\tbreak;\n\tcase SIOCAIPXPRISLT:\n\t\trc = -EFAULT;\n\t\tif (get_user(val, (unsigned char __user *) arg))\n\t\t\tbreak;\n\t\trc = 0;\n\t\tipxcfg_set_auto_select(val);\n\t\tbreak;\n\t}\n\n\treturn rc;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"ipxitf_ioctl","file_name":"net/ipx/af_ipx.c","commit_link":"github.com/torvalds/linux/commit/ee0d8d8482345ff97a75a7d747efc309f13b0d80","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#26-f3045cf99036","input":"static PHP_MINIT_FUNCTION(zip)\n{\n#ifdef PHP_ZIP_USE_OO\n\tzend_class_entry ce;\n\n\tmemcpy(&zip_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));\n\tzip_object_handlers.clone_obj\t\t= NULL;\n\tzip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr;\n\n\tzip_object_handlers.get_gc = php_zip_get_gc;\n\tzip_object_handlers.get_properties = php_zip_get_properties;\n\tzip_object_handlers.read_property\t= php_zip_read_property;\n\tzip_object_handlers.has_property\t= php_zip_has_property;\n\n\tINIT_CLASS_ENTRY(ce, \"ZipArchive\", zip_class_functions);\n\tce.create_object = php_zip_object_new;\n\tzip_class_entry = zend_register_internal_class(&ce TSRMLS_CC);\n\n\tzend_hash_init(&zip_prop_handlers, 0, NULL, NULL, 1);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"status\", php_zip_status, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"statusSys\", php_zip_status_sys, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"numFiles\", php_zip_get_num_files, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"filename\", NULL, NULL, php_zipobj_get_filename, IS_STRING TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"comment\", NULL, php_zipobj_get_zip_comment, NULL, IS_STRING TSRMLS_CC);\n\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CREATE\", ZIP_CREATE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"EXCL\", ZIP_EXCL);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CHECKCONS\", ZIP_CHECKCONS);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"OVERWRITE\", ZIP_OVERWRITE);\n\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_NOCASE\", ZIP_FL_NOCASE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_NODIR\", ZIP_FL_NODIR);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_COMPRESSED\", ZIP_FL_COMPRESSED);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_UNCHANGED\", ZIP_FL_UNCHANGED);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFAULT\", ZIP_CM_DEFAULT);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_STORE\", ZIP_CM_STORE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_SHRINK\", ZIP_CM_SHRINK);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_1\", ZIP_CM_REDUCE_1);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_2\", ZIP_CM_REDUCE_2);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_3\", ZIP_CM_REDUCE_3);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_4\", ZIP_CM_REDUCE_4);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_IMPLODE\", ZIP_CM_IMPLODE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFLATE\", ZIP_CM_DEFLATE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFLATE64\", ZIP_CM_DEFLATE64);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_PKWARE_IMPLODE\", ZIP_CM_PKWARE_IMPLODE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_BZIP2\", ZIP_CM_BZIP2);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_LZMA\", ZIP_CM_LZMA);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_TERSE\", ZIP_CM_TERSE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_LZ77\", ZIP_CM_LZ77);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_WAVPACK\", ZIP_CM_WAVPACK);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_PPMD\", ZIP_CM_PPMD);\n\n\t/* Error code */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_OK\",\t\t\tZIP_ER_OK);\t\t\t/* N No error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_MULTIDISK\",\tZIP_ER_MULTIDISK);\t/* N Multi-disk zip archives not supported */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_RENAME\",\t\tZIP_ER_RENAME);\t\t/* S Renaming temporary file failed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CLOSE\",\t\tZIP_ER_CLOSE);\t\t/* S Closing zip archive failed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_SEEK\",\t\tZIP_ER_SEEK);\t\t/* S Seek error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_READ\",\t\tZIP_ER_READ);\t\t/* S Read error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_WRITE\",\t\tZIP_ER_WRITE);\t\t/* S Write error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CRC\",\t\t\tZIP_ER_CRC);\t\t/* N CRC error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_ZIPCLOSED\",\tZIP_ER_ZIPCLOSED);\t/* N Containing zip archive was closed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_NOENT\",\t\tZIP_ER_NOENT);\t\t/* N No such file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_EXISTS\",\t\tZIP_ER_EXISTS);\t\t/* N File already exists */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_OPEN\",\t\tZIP_ER_OPEN);\t\t/* S Can't open file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_TMPOPEN\",\t\tZIP_ER_TMPOPEN);\t/* S Failure to create temporary file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_ZLIB\",\t\tZIP_ER_ZLIB);\t\t/* Z Zlib error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_MEMORY\",\t\tZIP_ER_MEMORY);\t\t/* N Malloc failure */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CHANGED\",\t\tZIP_ER_CHANGED);\t/* N Entry has been changed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_COMPNOTSUPP\",\tZIP_ER_COMPNOTSUPP);/* N Compression method not supported */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_EOF\",\t\t\tZIP_ER_EOF);\t\t/* N Premature EOF */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INVAL\",\t\tZIP_ER_INVAL);\t\t/* N Invalid argument */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_NOZIP\",\t\tZIP_ER_NOZIP);\t\t/* N Not a zip archive */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INTERNAL\",\tZIP_ER_INTERNAL);\t/* N Internal error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INCONS\",\t\tZIP_ER_INCONS);\t\t/* N Zip archive inconsistent */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_REMOVE\",\t\tZIP_ER_REMOVE);\t\t/* S Can't remove file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_DELETED\", \tZIP_ER_DELETED);\t/* N Entry has been deleted */\n\n\tphp_register_url_stream_wrapper(\"zip\", &php_stream_zip_wrapper TSRMLS_CC);\n#endif\n\n\tle_zip_dir = zend_register_list_destructors_ex(php_zip_free_dir, NULL, le_zip_dir_name, module_number);\n\tle_zip_entry = zend_register_list_destructors_ex(php_zip_free_entry, NULL, le_zip_entry_name, module_number);\n\n\treturn SUCCESS;\n}","target":"static PHP_MINIT_FUNCTION(zip)\n{\n#ifdef PHP_ZIP_USE_OO\n\tzend_class_entry ce;\n\n\tmemcpy(&zip_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));\n\tzip_object_handlers.clone_obj\t\t= NULL;\n\tzip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr;\n\n\tzip_object_handlers.get_gc = php_zip_get_gc;\n\tzip_object_handlers.get_properties = php_zip_get_properties;\n\tzip_object_handlers.read_property\t= php_zip_read_property;\n\tzip_object_handlers.has_property\t= php_zip_has_property;\n\n\tINIT_CLASS_ENTRY(ce, \"ZipArchive\", zip_class_functions);\n\tce.create_object = php_zip_object_new;\n\tzip_class_entry = zend_register_internal_class(&ce TSRMLS_CC);\n\n\tzend_hash_init(&zip_prop_handlers, 0, NULL, NULL, 1);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"status\", php_zip_status, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"statusSys\", php_zip_status_sys, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"numFiles\", php_zip_get_num_files, NULL, NULL, IS_LONG TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"filename\", NULL, NULL, php_zipobj_get_filename, IS_STRING TSRMLS_CC);\n\tphp_zip_register_prop_handler(&zip_prop_handlers, \"comment\", NULL, php_zipobj_get_zip_comment, NULL, IS_STRING TSRMLS_CC);\n\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CREATE\", ZIP_CREATE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"EXCL\", ZIP_EXCL);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CHECKCONS\", ZIP_CHECKCONS);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"OVERWRITE\", ZIP_OVERWRITE);\n\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_NOCASE\", ZIP_FL_NOCASE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_NODIR\", ZIP_FL_NODIR);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_COMPRESSED\", ZIP_FL_COMPRESSED);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"FL_UNCHANGED\", ZIP_FL_UNCHANGED);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFAULT\", ZIP_CM_DEFAULT);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_STORE\", ZIP_CM_STORE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_SHRINK\", ZIP_CM_SHRINK);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_1\", ZIP_CM_REDUCE_1);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_2\", ZIP_CM_REDUCE_2);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_3\", ZIP_CM_REDUCE_3);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_REDUCE_4\", ZIP_CM_REDUCE_4);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_IMPLODE\", ZIP_CM_IMPLODE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFLATE\", ZIP_CM_DEFLATE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_DEFLATE64\", ZIP_CM_DEFLATE64);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_PKWARE_IMPLODE\", ZIP_CM_PKWARE_IMPLODE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_BZIP2\", ZIP_CM_BZIP2);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_LZMA\", ZIP_CM_LZMA);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_TERSE\", ZIP_CM_TERSE);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_LZ77\", ZIP_CM_LZ77);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_WAVPACK\", ZIP_CM_WAVPACK);\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"CM_PPMD\", ZIP_CM_PPMD);\n\n\t/* Error code */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_OK\",\t\t\tZIP_ER_OK);\t\t\t/* N No error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_MULTIDISK\",\tZIP_ER_MULTIDISK);\t/* N Multi-disk zip archives not supported */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_RENAME\",\t\tZIP_ER_RENAME);\t\t/* S Renaming temporary file failed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CLOSE\",\t\tZIP_ER_CLOSE);\t\t/* S Closing zip archive failed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_SEEK\",\t\tZIP_ER_SEEK);\t\t/* S Seek error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_READ\",\t\tZIP_ER_READ);\t\t/* S Read error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_WRITE\",\t\tZIP_ER_WRITE);\t\t/* S Write error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CRC\",\t\t\tZIP_ER_CRC);\t\t/* N CRC error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_ZIPCLOSED\",\tZIP_ER_ZIPCLOSED);\t/* N Containing zip archive was closed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_NOENT\",\t\tZIP_ER_NOENT);\t\t/* N No such file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_EXISTS\",\t\tZIP_ER_EXISTS);\t\t/* N File already exists */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_OPEN\",\t\tZIP_ER_OPEN);\t\t/* S Can't open file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_TMPOPEN\",\t\tZIP_ER_TMPOPEN);\t/* S Failure to create temporary file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_ZLIB\",\t\tZIP_ER_ZLIB);\t\t/* Z Zlib error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_MEMORY\",\t\tZIP_ER_MEMORY);\t\t/* N Malloc failure */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_CHANGED\",\t\tZIP_ER_CHANGED);\t/* N Entry has been changed */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_COMPNOTSUPP\",\tZIP_ER_COMPNOTSUPP);/* N Compression method not supported */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_EOF\",\t\t\tZIP_ER_EOF);\t\t/* N Premature EOF */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INVAL\",\t\tZIP_ER_INVAL);\t\t/* N Invalid argument */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_NOZIP\",\t\tZIP_ER_NOZIP);\t\t/* N Not a zip archive */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INTERNAL\",\tZIP_ER_INTERNAL);\t/* N Internal error */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_INCONS\",\t\tZIP_ER_INCONS);\t\t/* N Zip archive inconsistent */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_REMOVE\",\t\tZIP_ER_REMOVE);\t\t/* S Can't remove file */\n\tREGISTER_ZIP_CLASS_CONST_LONG(\"ER_DELETED\", \tZIP_ER_DELETED);\t/* N Entry has been deleted */\n\n\tphp_register_url_stream_wrapper(\"zip\", &php_stream_zip_wrapper TSRMLS_CC);\n#endif\n\n\tle_zip_dir = zend_register_list_destructors_ex(php_zip_free_dir, NULL, le_zip_dir_name, module_number);\n\tle_zip_entry = zend_register_list_destructors_ex(php_zip_free_entry, NULL, le_zip_entry_name, module_number);\n\n\treturn SUCCESS;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"PHP_MINIT_FUNCTION","file_name":"ext/zip/php_zip.c","commit_link":"github.com/php/php-src/commit/f6aef68089221c5ea047d4a74224ee3deead99a6?w=1","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#27-b1b8f495f594","input":"static int get_task_ioprio(struct task_struct *p)\n{\n\tint ret;\n\n\tret = security_task_getioprio(p);\n\tif (ret)\n\t\tgoto out;\n\tret = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, IOPRIO_NORM);\n\tif (p->io_context)\n\t\tret = p->io_context->ioprio;\nout:\n\treturn ret;\n}","target":"static int get_task_ioprio(struct task_struct *p)\n{\n\tint ret;\n\n\tret = security_task_getioprio(p);\n\tif (ret)\n\t\tgoto out;\n\tret = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, IOPRIO_NORM);\n\ttask_lock(p);\n\tif (p->io_context)\n\t\tret = p->io_context->ioprio;\n\ttask_unlock(p);\nout:\n\treturn ret;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"get_task_ioprio","file_name":"block/ioprio.c","commit_link":"github.com/torvalds/linux/commit/8ba8682107ee2ca3347354e018865d8e1967c5f4","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#28-29e0547979e2","input":"MagickExport MagickBooleanType SetImageType(Image *image,const ImageType type)\n{\n const char\n *artifact;\n\n ImageInfo\n *image_info;\n\n MagickBooleanType\n status;\n\n QuantizeInfo\n *quantize_info;\n\n assert(image != (Image *) NULL);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n assert(image->signature == MagickSignature);\n status=MagickTrue;\n image_info=AcquireImageInfo();\n image_info->dither=image->dither;\n artifact=GetImageArtifact(image,\"dither\");\n if (artifact != (const char *) NULL)\n (void) SetImageOption(image_info,\"dither\",artifact);\n switch (type)\n {\n case BilevelType:\n {\n if (SetImageMonochrome(image,&image->exception) == MagickFalse)\n {\n status=TransformImageColorspace(image,GRAYColorspace);\n (void) NormalizeImage(image);\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->number_colors=2;\n quantize_info->colorspace=GRAYColorspace;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n }\n image->colors=2;\n image->matte=MagickFalse;\n break;\n }\n case GrayscaleType:\n {\n if (SetImageGray(image,&image->exception) == MagickFalse)\n status=TransformImageColorspace(image,GRAYColorspace);\n image->matte=MagickFalse;\n break;\n }\n case GrayscaleMatteType:\n {\n if (SetImageGray(image,&image->exception) == MagickFalse)\n status=TransformImageColorspace(image,GRAYColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case PaletteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n {\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->number_colors=256;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n }\n image->matte=MagickFalse;\n break;\n }\n case PaletteBilevelMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n (void) BilevelImageChannel(image,AlphaChannel,(double) QuantumRange/2.0);\n quantize_info=AcquireQuantizeInfo(image_info);\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n break;\n }\n case PaletteMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->colorspace=TransparentColorspace;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n break;\n }\n case TrueColorType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n image->matte=MagickFalse;\n break;\n }\n case TrueColorMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case ColorSeparationType:\n {\n if (image->colorspace != CMYKColorspace)\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);\n status=TransformImageColorspace(image,CMYKColorspace);\n }\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n image->matte=MagickFalse;\n break;\n }\n case ColorSeparationMatteType:\n {\n if (image->colorspace != CMYKColorspace)\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);\n status=TransformImageColorspace(image,CMYKColorspace);\n }\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case OptimizeType:\n case UndefinedType:\n break;\n }\n image_info=DestroyImageInfo(image_info);\n if (status == MagickFalse)\n return(MagickFalse);\n image->type=type;\n return(MagickTrue);\n}","target":"MagickExport MagickBooleanType SetImageType(Image *image,const ImageType type)\n{\n const char\n *artifact;\n\n ImageInfo\n *image_info;\n\n MagickBooleanType\n status;\n\n QuantizeInfo\n *quantize_info;\n\n assert(image != (Image *) NULL);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n assert(image->signature == MagickSignature);\n status=MagickTrue;\n image_info=AcquireImageInfo();\n image_info->dither=image->dither;\n artifact=GetImageArtifact(image,\"dither\");\n if (artifact != (const char *) NULL)\n (void) SetImageOption(image_info,\"dither\",artifact);\n switch (type)\n {\n case BilevelType:\n {\n if (SetImageMonochrome(image,&image->exception) == MagickFalse)\n {\n status=TransformImageColorspace(image,GRAYColorspace);\n (void) NormalizeImage(image);\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->number_colors=2;\n quantize_info->colorspace=GRAYColorspace;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n }\n status=AcquireImageColormap(image,2);\n image->matte=MagickFalse;\n break;\n }\n case GrayscaleType:\n {\n if (SetImageGray(image,&image->exception) == MagickFalse)\n status=TransformImageColorspace(image,GRAYColorspace);\n image->matte=MagickFalse;\n break;\n }\n case GrayscaleMatteType:\n {\n if (SetImageGray(image,&image->exception) == MagickFalse)\n status=TransformImageColorspace(image,GRAYColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case PaletteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n {\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->number_colors=256;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n }\n image->matte=MagickFalse;\n break;\n }\n case PaletteBilevelMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n (void) BilevelImageChannel(image,AlphaChannel,(double) QuantumRange/2.0);\n quantize_info=AcquireQuantizeInfo(image_info);\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n break;\n }\n case PaletteMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n quantize_info=AcquireQuantizeInfo(image_info);\n quantize_info->colorspace=TransparentColorspace;\n status=QuantizeImage(quantize_info,image);\n quantize_info=DestroyQuantizeInfo(quantize_info);\n break;\n }\n case TrueColorType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n image->matte=MagickFalse;\n break;\n }\n case TrueColorMatteType:\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n status=TransformImageColorspace(image,sRGBColorspace);\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case ColorSeparationType:\n {\n if (image->colorspace != CMYKColorspace)\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);\n status=TransformImageColorspace(image,CMYKColorspace);\n }\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n image->matte=MagickFalse;\n break;\n }\n case ColorSeparationMatteType:\n {\n if (image->colorspace != CMYKColorspace)\n {\n if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);\n status=TransformImageColorspace(image,CMYKColorspace);\n }\n if (image->storage_class != DirectClass)\n status=SetImageStorageClass(image,DirectClass);\n if (image->matte == MagickFalse)\n (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);\n break;\n }\n case OptimizeType:\n case UndefinedType:\n break;\n }\n image_info=DestroyImageInfo(image_info);\n if (status == MagickFalse)\n return(MagickFalse);\n image->type=type;\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"SetImageType","file_name":"magick/attribute.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/d63a3c5729df59f183e9e110d5d8385d17caaad0","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#29-741e251af25b","input":"updateDevice(const struct header * headers, time_t t)\n{\n\tstruct device ** pp = &devlist;\n\tstruct device * p = *pp;\t/* = devlist; */\n\twhile(p)\n\t{\n\t\tif( p->headers[HEADER_NT].l == headers[HEADER_NT].l\n\t\t && (0==memcmp(p->headers[HEADER_NT].p, headers[HEADER_NT].p, headers[HEADER_NT].l))\n\t\t && p->headers[HEADER_USN].l == headers[HEADER_USN].l\n\t\t && (0==memcmp(p->headers[HEADER_USN].p, headers[HEADER_USN].p, headers[HEADER_USN].l)) )\n\t\t{\n\t\t\t/*printf(\"found! %d\\n\", (int)(t - p->t));*/\n\t\t\tsyslog(LOG_DEBUG, \"device updated : %.*s\", headers[HEADER_USN].l, headers[HEADER_USN].p);\n\t\t\tp->t = t;\n\t\t\t/* update Location ! */\n\t\t\tif(headers[HEADER_LOCATION].l > p->headers[HEADER_LOCATION].l)\n\t\t\t{\n\t\t\t\tstruct device * tmp;\n\t\t\t\ttmp = realloc(p, sizeof(struct device)\n\t\t\t\t + headers[0].l+headers[1].l+headers[2].l);\n\t\t\t\tif(!tmp)\t/* allocation error */\n\t\t\t\t{\n\t\t\t\t\tsyslog(LOG_ERR, \"updateDevice() : memory allocation error\");\n\t\t\t\t\tfree(p);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tp = tmp;\n\t\t\t\t*pp = p;\n\t\t\t}\n\t\t\tmemcpy(p->data + p->headers[0].l + p->headers[1].l,\n\t\t\t headers[2].p, headers[2].l);\n\t\t\t/* TODO : check p->headers[HEADER_LOCATION].l */\n\t\t\treturn 0;\n\t\t}\n\t\tpp = &p->next;\n\t\tp = *pp;\t/* p = p->next; */\n\t}\n\tsyslog(LOG_INFO, \"new device discovered : %.*s\",\n\t headers[HEADER_USN].l, headers[HEADER_USN].p);\n\t/* add */\n\t{\n\t\tchar * pc;\n\t\tint i;\n\t\tp = malloc( sizeof(struct device)\n\t\t + headers[0].l+headers[1].l+headers[2].l );\n\t\tif(!p) {\n\t\t\tsyslog(LOG_ERR, \"updateDevice(): cannot allocate memory\");\n\t\t\treturn -1;\n\t\t}\n\t\tp->next = devlist;\n\t\tp->t = t;\n\t\tpc = p->data;\n\t\tfor(i = 0; i < 3; i++)\n\t\t{\n\t\t\tp->headers[i].p = pc;\n\t\t\tp->headers[i].l = headers[i].l;\n\t\t\tmemcpy(pc, headers[i].p, headers[i].l);\n\t\t\tpc += headers[i].l;\n\t\t}\n\t\tdevlist = p;\n\t\tsendNotifications(NOTIF_NEW, p, NULL);\n\t}\n\treturn 1;\n}","target":"updateDevice(const struct header * headers, time_t t)\n{\n\tstruct device ** pp = &devlist;\n\tstruct device * p = *pp;\t/* = devlist; */\n\twhile(p)\n\t{\n\t\tif( p->headers[HEADER_NT].l == headers[HEADER_NT].l\n\t\t && (0==memcmp(p->headers[HEADER_NT].p, headers[HEADER_NT].p, headers[HEADER_NT].l))\n\t\t && p->headers[HEADER_USN].l == headers[HEADER_USN].l\n\t\t && (0==memcmp(p->headers[HEADER_USN].p, headers[HEADER_USN].p, headers[HEADER_USN].l)) )\n\t\t{\n\t\t\t/*printf(\"found! %d\\n\", (int)(t - p->t));*/\n\t\t\tsyslog(LOG_DEBUG, \"device updated : %.*s\", headers[HEADER_USN].l, headers[HEADER_USN].p);\n\t\t\tp->t = t;\n\t\t\t/* update Location ! */\n\t\t\tif(headers[HEADER_LOCATION].l > p->headers[HEADER_LOCATION].l)\n\t\t\t{\n\t\t\t\tstruct device * tmp;\n\t\t\t\ttmp = realloc(p, sizeof(struct device)\n\t\t\t\t + headers[0].l+headers[1].l+headers[2].l);\n\t\t\t\tif(!tmp)\t/* allocation error */\n\t\t\t\t{\n\t\t\t\t\tsyslog(LOG_ERR, \"updateDevice() : memory allocation error\");\n\t\t\t\t\t*pp = p->next;\t/* remove \"p\" from the list */\n\t\t\t\t\tfree(p);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tp = tmp;\n\t\t\t\t*pp = p;\n\t\t\t}\n\t\t\tmemcpy(p->data + p->headers[0].l + p->headers[1].l,\n\t\t\t headers[2].p, headers[2].l);\n\t\t\t/* TODO : check p->headers[HEADER_LOCATION].l */\n\t\t\treturn 0;\n\t\t}\n\t\tpp = &p->next;\n\t\tp = *pp;\t/* p = p->next; */\n\t}\n\tsyslog(LOG_INFO, \"new device discovered : %.*s\",\n\t headers[HEADER_USN].l, headers[HEADER_USN].p);\n\t/* add */\n\t{\n\t\tchar * pc;\n\t\tint i;\n\t\tp = malloc( sizeof(struct device)\n\t\t + headers[0].l+headers[1].l+headers[2].l );\n\t\tif(!p) {\n\t\t\tsyslog(LOG_ERR, \"updateDevice(): cannot allocate memory\");\n\t\t\treturn -1;\n\t\t}\n\t\tp->next = devlist;\n\t\tp->t = t;\n\t\tpc = p->data;\n\t\tfor(i = 0; i < 3; i++)\n\t\t{\n\t\t\tp->headers[i].p = pc;\n\t\t\tp->headers[i].l = headers[i].l;\n\t\t\tmemcpy(pc, headers[i].p, headers[i].l);\n\t\t\tpc += headers[i].l;\n\t\t}\n\t\tdevlist = p;\n\t\tsendNotifications(NOTIF_NEW, p, NULL);\n\t}\n\treturn 1;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"updateDevice","file_name":"minissdpd/minissdpd.c","commit_link":"github.com/miniupnp/miniupnp/commit/cd506a67e174a45c6a202eff182a712955ed6d6f","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#30-1190aec5743f","input":"static int kvm_ioctl_create_device(struct kvm *kvm,\n\t\t\t\t struct kvm_create_device *cd)\n{\n\tstruct kvm_device_ops *ops = NULL;\n\tstruct kvm_device *dev;\n\tbool test = cd->flags & KVM_CREATE_DEVICE_TEST;\n\tint ret;\n\n\tif (cd->type >= ARRAY_SIZE(kvm_device_ops_table))\n\t\treturn -ENODEV;\n\n\tops = kvm_device_ops_table[cd->type];\n\tif (ops == NULL)\n\t\treturn -ENODEV;\n\n\tif (test)\n\t\treturn 0;\n\n\tdev = kzalloc(sizeof(*dev), GFP_KERNEL);\n\tif (!dev)\n\t\treturn -ENOMEM;\n\n\tdev->ops = ops;\n\tdev->kvm = kvm;\n\n\tmutex_lock(&kvm->lock);\n\tret = ops->create(dev, cd->type);\n\tif (ret < 0) {\n\t\tmutex_unlock(&kvm->lock);\n\t\tkfree(dev);\n\t\treturn ret;\n\t}\n\tlist_add(&dev->vm_node, &kvm->devices);\n\tmutex_unlock(&kvm->lock);\n\n\tif (ops->init)\n\t\tops->init(dev);\n\n\tret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC);\n\tif (ret < 0) {\n\t\tops->destroy(dev);\n\t\tmutex_lock(&kvm->lock);\n\t\tlist_del(&dev->vm_node);\n\t\tmutex_unlock(&kvm->lock);\n\t\treturn ret;\n\t}\n\n\tkvm_get_kvm(kvm);\n\tcd->fd = ret;\n\treturn 0;\n}","target":"static int kvm_ioctl_create_device(struct kvm *kvm,\n\t\t\t\t struct kvm_create_device *cd)\n{\n\tstruct kvm_device_ops *ops = NULL;\n\tstruct kvm_device *dev;\n\tbool test = cd->flags & KVM_CREATE_DEVICE_TEST;\n\tint ret;\n\n\tif (cd->type >= ARRAY_SIZE(kvm_device_ops_table))\n\t\treturn -ENODEV;\n\n\tops = kvm_device_ops_table[cd->type];\n\tif (ops == NULL)\n\t\treturn -ENODEV;\n\n\tif (test)\n\t\treturn 0;\n\n\tdev = kzalloc(sizeof(*dev), GFP_KERNEL);\n\tif (!dev)\n\t\treturn -ENOMEM;\n\n\tdev->ops = ops;\n\tdev->kvm = kvm;\n\n\tmutex_lock(&kvm->lock);\n\tret = ops->create(dev, cd->type);\n\tif (ret < 0) {\n\t\tmutex_unlock(&kvm->lock);\n\t\tkfree(dev);\n\t\treturn ret;\n\t}\n\tlist_add(&dev->vm_node, &kvm->devices);\n\tmutex_unlock(&kvm->lock);\n\n\tif (ops->init)\n\t\tops->init(dev);\n\n\tret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC);\n\tif (ret < 0) {\n\t\tmutex_lock(&kvm->lock);\n\t\tlist_del(&dev->vm_node);\n\t\tmutex_unlock(&kvm->lock);\n\t\tops->destroy(dev);\n\t\treturn ret;\n\t}\n\n\tkvm_get_kvm(kvm);\n\tcd->fd = ret;\n\treturn 0;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"kvm_ioctl_create_device","file_name":"virt/kvm/kvm_main.c","commit_link":"github.com/torvalds/linux/commit/a0f1d21c1ccb1da66629627a74059dd7f5ac9c61","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#31-9f4e2a873583","input":"SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,\n\t unsigned int *nbytes, char **buf, int *buf_type)\n{\n\tstruct smb_rqst rqst;\n\tint resp_buftype, rc = -EACCES;\n\tstruct smb2_read_plain_req *req = NULL;\n\tstruct smb2_read_rsp *rsp = NULL;\n\tstruct kvec iov[1];\n\tstruct kvec rsp_iov;\n\tunsigned int total_len;\n\tint flags = CIFS_LOG_ERROR;\n\tstruct cifs_ses *ses = io_parms->tcon->ses;\n\n\t*nbytes = 0;\n\trc = smb2_new_read_req((void **)&req, &total_len, io_parms, NULL, 0, 0);\n\tif (rc)\n\t\treturn rc;\n\n\tif (smb3_encryption_required(io_parms->tcon))\n\t\tflags |= CIFS_TRANSFORM_REQ;\n\n\tiov[0].iov_base = (char *)req;\n\tiov[0].iov_len = total_len;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = 1;\n\n\trc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);\n\tcifs_small_buf_release(req);\n\n\trsp = (struct smb2_read_rsp *)rsp_iov.iov_base;\n\n\tif (rc) {\n\t\tif (rc != -ENODATA) {\n\t\t\tcifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE);\n\t\t\tcifs_dbg(VFS, \"Send error in read = %d\\n\", rc);\n\t\t\ttrace_smb3_read_err(xid, req->PersistentFileId,\n\t\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t\t io_parms->offset, io_parms->length,\n\t\t\t\t\t rc);\n\t\t} else\n\t\t\ttrace_smb3_read_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t io_parms->offset, 0);\n\t\tfree_rsp_buf(resp_buftype, rsp_iov.iov_base);\n\t\treturn rc == -ENODATA ? 0 : rc;\n\t} else\n\t\ttrace_smb3_read_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t io_parms->offset, io_parms->length);\n\n\t*nbytes = le32_to_cpu(rsp->DataLength);\n\tif ((*nbytes > CIFS_MAX_MSGSIZE) ||\n\t (*nbytes > io_parms->length)) {\n\t\tcifs_dbg(FYI, \"bad length %d for count %d\\n\",\n\t\t\t *nbytes, io_parms->length);\n\t\trc = -EIO;\n\t\t*nbytes = 0;\n\t}\n\n\tif (*buf) {\n\t\tmemcpy(*buf, (char *)rsp + rsp->DataOffset, *nbytes);\n\t\tfree_rsp_buf(resp_buftype, rsp_iov.iov_base);\n\t} else if (resp_buftype != CIFS_NO_BUFFER) {\n\t\t*buf = rsp_iov.iov_base;\n\t\tif (resp_buftype == CIFS_SMALL_BUFFER)\n\t\t\t*buf_type = CIFS_SMALL_BUFFER;\n\t\telse if (resp_buftype == CIFS_LARGE_BUFFER)\n\t\t\t*buf_type = CIFS_LARGE_BUFFER;\n\t}\n\treturn rc;\n}","target":"SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,\n\t unsigned int *nbytes, char **buf, int *buf_type)\n{\n\tstruct smb_rqst rqst;\n\tint resp_buftype, rc = -EACCES;\n\tstruct smb2_read_plain_req *req = NULL;\n\tstruct smb2_read_rsp *rsp = NULL;\n\tstruct kvec iov[1];\n\tstruct kvec rsp_iov;\n\tunsigned int total_len;\n\tint flags = CIFS_LOG_ERROR;\n\tstruct cifs_ses *ses = io_parms->tcon->ses;\n\n\t*nbytes = 0;\n\trc = smb2_new_read_req((void **)&req, &total_len, io_parms, NULL, 0, 0);\n\tif (rc)\n\t\treturn rc;\n\n\tif (smb3_encryption_required(io_parms->tcon))\n\t\tflags |= CIFS_TRANSFORM_REQ;\n\n\tiov[0].iov_base = (char *)req;\n\tiov[0].iov_len = total_len;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = 1;\n\n\trc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);\n\trsp = (struct smb2_read_rsp *)rsp_iov.iov_base;\n\n\tif (rc) {\n\t\tif (rc != -ENODATA) {\n\t\t\tcifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE);\n\t\t\tcifs_dbg(VFS, \"Send error in read = %d\\n\", rc);\n\t\t\ttrace_smb3_read_err(xid, req->PersistentFileId,\n\t\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t\t io_parms->offset, io_parms->length,\n\t\t\t\t\t rc);\n\t\t} else\n\t\t\ttrace_smb3_read_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t io_parms->offset, 0);\n\t\tfree_rsp_buf(resp_buftype, rsp_iov.iov_base);\n\t\treturn rc == -ENODATA ? 0 : rc;\n\t} else\n\t\ttrace_smb3_read_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid, ses->Suid,\n\t\t\t\t io_parms->offset, io_parms->length);\n\n\tcifs_small_buf_release(req);\n\n\t*nbytes = le32_to_cpu(rsp->DataLength);\n\tif ((*nbytes > CIFS_MAX_MSGSIZE) ||\n\t (*nbytes > io_parms->length)) {\n\t\tcifs_dbg(FYI, \"bad length %d for count %d\\n\",\n\t\t\t *nbytes, io_parms->length);\n\t\trc = -EIO;\n\t\t*nbytes = 0;\n\t}\n\n\tif (*buf) {\n\t\tmemcpy(*buf, (char *)rsp + rsp->DataOffset, *nbytes);\n\t\tfree_rsp_buf(resp_buftype, rsp_iov.iov_base);\n\t} else if (resp_buftype != CIFS_NO_BUFFER) {\n\t\t*buf = rsp_iov.iov_base;\n\t\tif (resp_buftype == CIFS_SMALL_BUFFER)\n\t\t\t*buf_type = CIFS_SMALL_BUFFER;\n\t\telse if (resp_buftype == CIFS_LARGE_BUFFER)\n\t\t\t*buf_type = CIFS_LARGE_BUFFER;\n\t}\n\treturn rc;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"SMB2_read","file_name":"fs/cifs/smb2pdu.c","commit_link":"github.com/torvalds/linux/commit/088aaf17aa79300cab14dbee2569c58cfafd7d6e","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#32-7944a99ad014","input":"archive_read_format_rar_read_data(struct archive_read *a, const void **buff,\n size_t *size, int64_t *offset)\n{\n struct rar *rar = (struct rar *)(a->format->data);\n int ret;\n\n if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {\n\t rar->has_encrypted_entries = 0;\n }\n\n if (rar->bytes_unconsumed > 0) {\n /* Consume as much as the decompressor actually used. */\n __archive_read_consume(a, rar->bytes_unconsumed);\n rar->bytes_unconsumed = 0;\n }\n\n *buff = NULL;\n if (rar->entry_eof || rar->offset_seek >= rar->unp_size) {\n *size = 0;\n *offset = rar->offset;\n if (*offset < rar->unp_size)\n *offset = rar->unp_size;\n return (ARCHIVE_EOF);\n }\n\n switch (rar->compression_method)\n {\n case COMPRESS_METHOD_STORE:\n ret = read_data_stored(a, buff, size, offset);\n break;\n\n case COMPRESS_METHOD_FASTEST:\n case COMPRESS_METHOD_FAST:\n case COMPRESS_METHOD_NORMAL:\n case COMPRESS_METHOD_GOOD:\n case COMPRESS_METHOD_BEST:\n ret = read_data_compressed(a, buff, size, offset);\n if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN)\n __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context);\n break;\n\n default:\n archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,\n \"Unsupported compression method for RAR file.\");\n ret = ARCHIVE_FATAL;\n break;\n }\n return (ret);\n}","target":"archive_read_format_rar_read_data(struct archive_read *a, const void **buff,\n size_t *size, int64_t *offset)\n{\n struct rar *rar = (struct rar *)(a->format->data);\n int ret;\n\n if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {\n\t rar->has_encrypted_entries = 0;\n }\n\n if (rar->bytes_unconsumed > 0) {\n /* Consume as much as the decompressor actually used. */\n __archive_read_consume(a, rar->bytes_unconsumed);\n rar->bytes_unconsumed = 0;\n }\n\n *buff = NULL;\n if (rar->entry_eof || rar->offset_seek >= rar->unp_size) {\n *size = 0;\n *offset = rar->offset;\n if (*offset < rar->unp_size)\n *offset = rar->unp_size;\n return (ARCHIVE_EOF);\n }\n\n switch (rar->compression_method)\n {\n case COMPRESS_METHOD_STORE:\n ret = read_data_stored(a, buff, size, offset);\n break;\n\n case COMPRESS_METHOD_FASTEST:\n case COMPRESS_METHOD_FAST:\n case COMPRESS_METHOD_NORMAL:\n case COMPRESS_METHOD_GOOD:\n case COMPRESS_METHOD_BEST:\n ret = read_data_compressed(a, buff, size, offset);\n if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN) {\n __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context);\n rar->start_new_table = 1;\n }\n break;\n\n default:\n archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,\n \"Unsupported compression method for RAR file.\");\n ret = ARCHIVE_FATAL;\n break;\n }\n return (ret);\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"archive_read_format_rar_read_data","file_name":"libarchive/archive_read_support_format_rar.c","commit_link":"github.com/libarchive/libarchive/commit/b8592ecba2f9e451e1f5cb7ab6dcee8b8e7b3f60","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#33-81e260d134cb","input":"R_API void r_anal_bb_free(RAnalBlock *bb) {\n\tif (!bb) {\n\t\treturn;\n\t}\n\tr_anal_cond_free (bb->cond);\n\tR_FREE (bb->fingerprint);\n\tr_anal_diff_free (bb->diff);\n\tbb->diff = NULL;\n\tR_FREE (bb->op_bytes);\n\tr_anal_switch_op_free (bb->switch_op);\n\tbb->switch_op = NULL;\n\tbb->fingerprint = NULL;\n\tbb->cond = NULL;\n\tR_FREE (bb->label);\n\tR_FREE (bb->op_pos);\n\tR_FREE (bb->parent_reg_arena);\n\tif (bb->prev) {\n\t\tif (bb->prev->jumpbb == bb) {\n\t\t\tbb->prev->jumpbb = NULL;\n\t\t}\n\t\tif (bb->prev->failbb == bb) {\n\t\t\tbb->prev->failbb = NULL;\n\t\t}\n\t\tbb->prev = NULL;\n\t}\n\tif (bb->jumpbb) {\n\t\tbb->jumpbb->prev = NULL;\n\t\tbb->jumpbb = NULL;\n\t}\n\tif (bb->failbb) {\n\t\tbb->failbb->prev = NULL;\n\t\tbb->failbb = NULL;\n\t}\n\tR_FREE (bb);\n}","target":"R_API void r_anal_bb_free(RAnalBlock *bb) {\n\tif (!bb) {\n\t\treturn;\n\t}\n\tr_anal_cond_free (bb->cond);\n\tR_FREE (bb->fingerprint);\n\tr_anal_diff_free (bb->diff);\n\tbb->diff = NULL;\n\tR_FREE (bb->op_bytes);\n\tr_anal_switch_op_free (bb->switch_op);\n\tbb->switch_op = NULL;\n\tbb->fingerprint = NULL;\n\tbb->cond = NULL;\n\tR_FREE (bb->label);\n\tR_FREE (bb->op_pos);\n\tR_FREE (bb->parent_reg_arena);\n\tif (bb->prev) {\n\t\tif (bb->prev->jumpbb == bb) {\n\t\t\tbb->prev->jumpbb = NULL;\n\t\t}\n\t\tif (bb->prev->failbb == bb) {\n\t\t\tbb->prev->failbb = NULL;\n\t\t}\n\t\tbb->prev = NULL;\n\t}\n\tif (bb->jumpbb) {\n\t\tbb->jumpbb->prev = NULL;\n\t\tbb->jumpbb = NULL;\n\t}\n\tif (bb->failbb) {\n\t\tbb->failbb->prev = NULL;\n\t\tbb->failbb = NULL;\n\t}\n\tif (bb->next) {\n\t\t// avoid double free\n\t\tbb->next->prev = NULL;\n\t}\n\tR_FREE (bb); // double free\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"r_anal_bb_free","file_name":"libr/anal/bb.c","commit_link":"github.com/radare/radare2/commit/90b71c017a7fa9732fe45fd21b245ee051b1f548","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#34-361e7defc730","input":"static int hci_uart_set_proto(struct hci_uart *hu, int id)\n{\n\tconst struct hci_uart_proto *p;\n\tint err;\n\n\tp = hci_uart_get_proto(id);\n\tif (!p)\n\t\treturn -EPROTONOSUPPORT;\n\n\thu->proto = p;\n\tset_bit(HCI_UART_PROTO_READY, &hu->flags);\n\n\terr = hci_uart_register_dev(hu);\n\tif (err) {\n\t\tclear_bit(HCI_UART_PROTO_READY, &hu->flags);\n\t\treturn err;\n\t}\n\n\treturn 0;\n}","target":"static int hci_uart_set_proto(struct hci_uart *hu, int id)\n{\n\tconst struct hci_uart_proto *p;\n\tint err;\n\n\tp = hci_uart_get_proto(id);\n\tif (!p)\n\t\treturn -EPROTONOSUPPORT;\n\n\thu->proto = p;\n\n\terr = hci_uart_register_dev(hu);\n\tif (err) {\n\t\treturn err;\n\t}\n\n\tset_bit(HCI_UART_PROTO_READY, &hu->flags);\n\treturn 0;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"hci_uart_set_proto","file_name":"drivers/bluetooth/hci_ldisc.c","commit_link":"github.com/torvalds/linux/commit/56897b217a1d0a91c9920cb418d6b3fe922f590a","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#35-e668b1c21939","input":"static int rm_read_multi(AVFormatContext *s, AVIOContext *pb,\n AVStream *st, char *mime)\n{\n int number_of_streams = avio_rb16(pb);\n int number_of_mdpr;\n int i, ret;\n unsigned size2;\n for (i = 0; i 0) {\n st2 = avformat_new_stream(s, NULL);\n if (!st2) {\n ret = AVERROR(ENOMEM);\n return ret;\n }\n st2->id = st->id + (i<<16);\n st2->codecpar->bit_rate = st->codecpar->bit_rate;\n st2->start_time = st->start_time;\n st2->duration = st->duration;\n st2->codecpar->codec_type = AVMEDIA_TYPE_DATA;\n st2->priv_data = ff_rm_alloc_rmstream();\n if (!st2->priv_data)\n return AVERROR(ENOMEM);\n } else\n st2 = st;\n\n size2 = avio_rb32(pb);\n ret = ff_rm_read_mdpr_codecdata(s, s->pb, st2, st2->priv_data,\n size2, mime);\n if (ret < 0)\n return ret;\n }\n return 0;\n}","target":"static int rm_read_multi(AVFormatContext *s, AVIOContext *pb,\n AVStream *st, char *mime)\n{\n int number_of_streams = avio_rb16(pb);\n int number_of_mdpr;\n int i, ret;\n unsigned size2;\n for (i = 0; i 0) {\n st2 = avformat_new_stream(s, NULL);\n if (!st2) {\n ret = AVERROR(ENOMEM);\n return ret;\n }\n st2->id = st->id + (i<<16);\n st2->codecpar->bit_rate = st->codecpar->bit_rate;\n st2->start_time = st->start_time;\n st2->duration = st->duration;\n st2->codecpar->codec_type = AVMEDIA_TYPE_DATA;\n st2->priv_data = ff_rm_alloc_rmstream();\n if (!st2->priv_data)\n return AVERROR(ENOMEM);\n } else\n st2 = st;\n\n size2 = avio_rb32(pb);\n ret = ff_rm_read_mdpr_codecdata(s, s->pb, st2, st2->priv_data,\n size2, NULL);\n if (ret < 0)\n return ret;\n }\n return 0;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"rm_read_multi","file_name":"libavformat/rmdec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/a7e032a277452366771951e29fd0bf2bd5c029f0","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#36-664f886f3ef2","input":"Error HeifContext::interpret_heif_file()\n{\n m_all_images.clear();\n m_top_level_images.clear();\n m_primary_image.reset();\n\n\n // --- reference all non-hidden images\n\n std::vector image_IDs = m_heif_file->get_item_IDs();\n\n bool primary_is_grid = false;\n for (heif_item_id id : image_IDs) {\n auto infe_box = m_heif_file->get_infe_box(id);\n if (!infe_box) {\n // TODO(farindk): Should we return an error instead of skipping the invalid id?\n continue;\n }\n\n if (item_type_is_image(infe_box->get_item_type())) {\n auto image = std::make_shared(this, id);\n m_all_images.insert(std::make_pair(id, image));\n\n if (!infe_box->is_hidden_item()) {\n if (id==m_heif_file->get_primary_image_ID()) {\n image->set_primary(true);\n m_primary_image = image;\n primary_is_grid = infe_box->get_item_type() == \"grid\";\n }\n\n m_top_level_images.push_back(image);\n }\n }\n }\n\n\n if (!m_primary_image) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"'pitm' box references a non-existing image\");\n }\n\n\n // --- remove thumbnails from top-level images and assign to their respective image\n\n auto iref_box = m_heif_file->get_iref_box();\n if (iref_box) {\n // m_top_level_images.clear();\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::vector references = iref_box->get_references_from(image->get_id());\n\n for (const Box_iref::Reference& ref : references) {\n uint32_t type = ref.header.get_short_type();\n\n if (type==fourcc(\"thmb\")) {\n // --- this is a thumbnail image, attach to the main image\n\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Too many thumbnail references\");\n }\n\n image->set_is_thumbnail_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (master_iter == m_all_images.end()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Thumbnail references a non-existing image\");\n }\n\n if (master_iter->second->is_thumbnail()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Thumbnail references another thumbnail\");\n }\n\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive thumbnail image detected\");\n }\n master_iter->second->add_thumbnail(image);\n\n remove_top_level_image(image);\n }\n else if (type==fourcc(\"auxl\")) {\n\n // --- this is an auxiliary image\n // check whether it is an alpha channel and attach to the main image if yes\n\n std::vector properties;\n Error err = m_heif_file->get_properties(image->get_id(), properties);\n if (err) {\n return err;\n }\n\n std::shared_ptr auxC_property;\n for (const auto& property : properties) {\n auto auxC = std::dynamic_pointer_cast(property.property);\n if (auxC) {\n auxC_property = auxC;\n }\n }\n\n if (!auxC_property) {\n std::stringstream sstr;\n sstr << \"No auxC property for image \" << image->get_id();\n return Error(heif_error_Invalid_input,\n heif_suberror_Auxiliary_image_type_unspecified,\n sstr.str());\n }\n\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Too many auxiliary image references\");\n }\n\n\n // alpha channel\n\n if (auxC_property->get_aux_type() == \"urn:mpeg:avc:2015:auxid:1\" ||\n auxC_property->get_aux_type() == \"urn:mpeg:hevc:2015:auxid:1\") {\n image->set_is_alpha_channel_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive alpha image detected\");\n }\n master_iter->second->set_alpha_channel(image);\n }\n\n\n // depth channel\n\n if (auxC_property->get_aux_type() == \"urn:mpeg:hevc:2015:auxid:2\") {\n image->set_is_depth_channel_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive depth image detected\");\n }\n master_iter->second->set_depth_channel(image);\n\n auto subtypes = auxC_property->get_subtypes();\n\n std::vector> sei_messages;\n Error err = decode_hevc_aux_sei_messages(subtypes, sei_messages);\n\n for (auto& msg : sei_messages) {\n auto depth_msg = std::dynamic_pointer_cast(msg);\n if (depth_msg) {\n image->set_depth_representation_info(*depth_msg);\n }\n }\n }\n\n remove_top_level_image(image);\n }\n else {\n // 'image' is a normal image, keep it as a top-level image\n }\n }\n }\n }\n\n\n // --- check that HEVC images have an hvcC property\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::shared_ptr infe = m_heif_file->get_infe_box(image->get_id());\n if (infe->get_item_type() == \"hvc1\") {\n\n auto ipma = m_heif_file->get_ipma_box();\n auto ipco = m_heif_file->get_ipco_box();\n\n if (!ipco->get_property_for_item_ID(image->get_id(), ipma, fourcc(\"hvcC\"))) {\n return Error(heif_error_Invalid_input,\n heif_suberror_No_hvcC_box,\n \"No hvcC property in hvc1 type image\");\n }\n }\n }\n\n\n // --- read through properties for each image and extract image resolutions\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::vector properties;\n\n Error err = m_heif_file->get_properties(pair.first, properties);\n if (err) {\n return err;\n }\n\n bool ispe_read = false;\n bool primary_colr_set = false;\n for (const auto& prop : properties) {\n auto ispe = std::dynamic_pointer_cast(prop.property);\n if (ispe) {\n uint32_t width = ispe->get_width();\n uint32_t height = ispe->get_height();\n\n\n // --- check whether the image size is \"too large\"\n\n if (width >= static_cast(MAX_IMAGE_WIDTH) ||\n height >= static_cast(MAX_IMAGE_HEIGHT)) {\n std::stringstream sstr;\n sstr << \"Image size \" << width << \"x\" << height << \" exceeds the maximum image size \"\n << MAX_IMAGE_WIDTH << \"x\" << MAX_IMAGE_HEIGHT << \"\\n\";\n\n return Error(heif_error_Memory_allocation_error,\n heif_suberror_Security_limit_exceeded,\n sstr.str());\n }\n\n image->set_resolution(width, height);\n image->set_ispe_resolution(width, height);\n ispe_read = true;\n }\n\n if (ispe_read) {\n auto clap = std::dynamic_pointer_cast(prop.property);\n if (clap) {\n image->set_resolution( clap->get_width_rounded(),\n clap->get_height_rounded() );\n }\n\n auto irot = std::dynamic_pointer_cast(prop.property);\n if (irot) {\n if (irot->get_rotation()==90 ||\n irot->get_rotation()==270) {\n // swap width and height\n image->set_resolution( image->get_height(),\n image->get_width() );\n }\n }\n }\n\n auto colr = std::dynamic_pointer_cast(prop.property);\n if (colr) {\n auto profile = colr->get_color_profile();\n\n image->set_color_profile(profile);\n\n // if this is a grid item we assign the first one's color profile\n // to the main image which is supposed to be a grid\n\n // TODO: this condition is not correct. It would also classify a secondary image as a 'grid item'.\n // We have to set the grid-image color profile in another way...\n const bool is_grid_item = !image->is_primary() && !image->is_alpha_channel() && !image->is_depth_channel();\n\n if (primary_is_grid &&\n !primary_colr_set &&\n is_grid_item) {\n m_primary_image->set_color_profile(profile);\n primary_colr_set = true;\n }\n }\n }\n }\n\n\n // --- read metadata and assign to image\n\n for (heif_item_id id : image_IDs) {\n std::string item_type = m_heif_file->get_item_type(id);\n std::string content_type = m_heif_file->get_content_type(id);\n if (item_type == \"Exif\" ||\n (item_type==\"mime\" && content_type==\"application/rdf+xml\")) {\n std::shared_ptr metadata = std::make_shared();\n metadata->item_id = id;\n metadata->item_type = item_type;\n metadata->content_type = content_type;\n\n Error err = m_heif_file->get_compressed_image_data(id, &(metadata->m_data));\n if (err) {\n return err;\n }\n\n //std::cerr.write((const char*)data.data(), data.size());\n\n\n // --- assign metadata to the image\n\n if (iref_box) {\n std::vector references = iref_box->get_references_from(id);\n for (const auto& ref : references) {\n if (ref.header.get_short_type() == fourcc(\"cdsc\")) {\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Exif data not correctly assigned to image\");\n }\n\n uint32_t exif_image_id = refs[0];\n auto img_iter = m_all_images.find(exif_image_id);\n if (img_iter == m_all_images.end()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Exif data assigned to non-existing image\");\n }\n\n img_iter->second->add_metadata(metadata);\n }\n }\n }\n }\n }\n\n return Error::Ok;\n}","target":"Error HeifContext::interpret_heif_file()\n{\n m_all_images.clear();\n m_top_level_images.clear();\n m_primary_image.reset();\n\n\n // --- reference all non-hidden images\n\n std::vector image_IDs = m_heif_file->get_item_IDs();\n\n bool primary_is_grid = false;\n for (heif_item_id id : image_IDs) {\n auto infe_box = m_heif_file->get_infe_box(id);\n if (!infe_box) {\n // TODO(farindk): Should we return an error instead of skipping the invalid id?\n continue;\n }\n\n if (item_type_is_image(infe_box->get_item_type())) {\n auto image = std::make_shared(this, id);\n m_all_images.insert(std::make_pair(id, image));\n\n if (!infe_box->is_hidden_item()) {\n if (id==m_heif_file->get_primary_image_ID()) {\n image->set_primary(true);\n m_primary_image = image;\n primary_is_grid = infe_box->get_item_type() == \"grid\";\n }\n\n m_top_level_images.push_back(image);\n }\n }\n }\n\n\n if (!m_primary_image) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"'pitm' box references a non-existing image\");\n }\n\n\n // --- remove thumbnails from top-level images and assign to their respective image\n\n auto iref_box = m_heif_file->get_iref_box();\n if (iref_box) {\n // m_top_level_images.clear();\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::vector references = iref_box->get_references_from(image->get_id());\n\n for (const Box_iref::Reference& ref : references) {\n uint32_t type = ref.header.get_short_type();\n\n if (type==fourcc(\"thmb\")) {\n // --- this is a thumbnail image, attach to the main image\n\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Too many thumbnail references\");\n }\n\n image->set_is_thumbnail_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (master_iter == m_all_images.end()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Thumbnail references a non-existing image\");\n }\n\n if (master_iter->second->is_thumbnail()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Thumbnail references another thumbnail\");\n }\n\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive thumbnail image detected\");\n }\n master_iter->second->add_thumbnail(image);\n\n remove_top_level_image(image);\n }\n else if (type==fourcc(\"auxl\")) {\n\n // --- this is an auxiliary image\n // check whether it is an alpha channel and attach to the main image if yes\n\n std::vector properties;\n Error err = m_heif_file->get_properties(image->get_id(), properties);\n if (err) {\n return err;\n }\n\n std::shared_ptr auxC_property;\n for (const auto& property : properties) {\n auto auxC = std::dynamic_pointer_cast(property.property);\n if (auxC) {\n auxC_property = auxC;\n }\n }\n\n if (!auxC_property) {\n std::stringstream sstr;\n sstr << \"No auxC property for image \" << image->get_id();\n return Error(heif_error_Invalid_input,\n heif_suberror_Auxiliary_image_type_unspecified,\n sstr.str());\n }\n\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Too many auxiliary image references\");\n }\n\n\n // alpha channel\n\n if (auxC_property->get_aux_type() == \"urn:mpeg:avc:2015:auxid:1\" ||\n auxC_property->get_aux_type() == \"urn:mpeg:hevc:2015:auxid:1\") {\n image->set_is_alpha_channel_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (master_iter == m_all_images.end()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Non-existing alpha image referenced\");\n }\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive alpha image detected\");\n }\n master_iter->second->set_alpha_channel(image);\n }\n\n\n // depth channel\n\n if (auxC_property->get_aux_type() == \"urn:mpeg:hevc:2015:auxid:2\") {\n image->set_is_depth_channel_of(refs[0]);\n\n auto master_iter = m_all_images.find(refs[0]);\n if (image.get() == master_iter->second.get()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Recursive depth image detected\");\n }\n master_iter->second->set_depth_channel(image);\n\n auto subtypes = auxC_property->get_subtypes();\n\n std::vector> sei_messages;\n Error err = decode_hevc_aux_sei_messages(subtypes, sei_messages);\n\n for (auto& msg : sei_messages) {\n auto depth_msg = std::dynamic_pointer_cast(msg);\n if (depth_msg) {\n image->set_depth_representation_info(*depth_msg);\n }\n }\n }\n\n remove_top_level_image(image);\n }\n else {\n // 'image' is a normal image, keep it as a top-level image\n }\n }\n }\n }\n\n\n // --- check that HEVC images have an hvcC property\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::shared_ptr infe = m_heif_file->get_infe_box(image->get_id());\n if (infe->get_item_type() == \"hvc1\") {\n\n auto ipma = m_heif_file->get_ipma_box();\n auto ipco = m_heif_file->get_ipco_box();\n\n if (!ipco->get_property_for_item_ID(image->get_id(), ipma, fourcc(\"hvcC\"))) {\n return Error(heif_error_Invalid_input,\n heif_suberror_No_hvcC_box,\n \"No hvcC property in hvc1 type image\");\n }\n }\n }\n\n\n // --- read through properties for each image and extract image resolutions\n\n for (auto& pair : m_all_images) {\n auto& image = pair.second;\n\n std::vector properties;\n\n Error err = m_heif_file->get_properties(pair.first, properties);\n if (err) {\n return err;\n }\n\n bool ispe_read = false;\n bool primary_colr_set = false;\n for (const auto& prop : properties) {\n auto ispe = std::dynamic_pointer_cast(prop.property);\n if (ispe) {\n uint32_t width = ispe->get_width();\n uint32_t height = ispe->get_height();\n\n\n // --- check whether the image size is \"too large\"\n\n if (width >= static_cast(MAX_IMAGE_WIDTH) ||\n height >= static_cast(MAX_IMAGE_HEIGHT)) {\n std::stringstream sstr;\n sstr << \"Image size \" << width << \"x\" << height << \" exceeds the maximum image size \"\n << MAX_IMAGE_WIDTH << \"x\" << MAX_IMAGE_HEIGHT << \"\\n\";\n\n return Error(heif_error_Memory_allocation_error,\n heif_suberror_Security_limit_exceeded,\n sstr.str());\n }\n\n image->set_resolution(width, height);\n image->set_ispe_resolution(width, height);\n ispe_read = true;\n }\n\n if (ispe_read) {\n auto clap = std::dynamic_pointer_cast(prop.property);\n if (clap) {\n image->set_resolution( clap->get_width_rounded(),\n clap->get_height_rounded() );\n }\n\n auto irot = std::dynamic_pointer_cast(prop.property);\n if (irot) {\n if (irot->get_rotation()==90 ||\n irot->get_rotation()==270) {\n // swap width and height\n image->set_resolution( image->get_height(),\n image->get_width() );\n }\n }\n }\n\n auto colr = std::dynamic_pointer_cast(prop.property);\n if (colr) {\n auto profile = colr->get_color_profile();\n\n image->set_color_profile(profile);\n\n // if this is a grid item we assign the first one's color profile\n // to the main image which is supposed to be a grid\n\n // TODO: this condition is not correct. It would also classify a secondary image as a 'grid item'.\n // We have to set the grid-image color profile in another way...\n const bool is_grid_item = !image->is_primary() && !image->is_alpha_channel() && !image->is_depth_channel();\n\n if (primary_is_grid &&\n !primary_colr_set &&\n is_grid_item) {\n m_primary_image->set_color_profile(profile);\n primary_colr_set = true;\n }\n }\n }\n }\n\n\n // --- read metadata and assign to image\n\n for (heif_item_id id : image_IDs) {\n std::string item_type = m_heif_file->get_item_type(id);\n std::string content_type = m_heif_file->get_content_type(id);\n if (item_type == \"Exif\" ||\n (item_type==\"mime\" && content_type==\"application/rdf+xml\")) {\n std::shared_ptr metadata = std::make_shared();\n metadata->item_id = id;\n metadata->item_type = item_type;\n metadata->content_type = content_type;\n\n Error err = m_heif_file->get_compressed_image_data(id, &(metadata->m_data));\n if (err) {\n return err;\n }\n\n //std::cerr.write((const char*)data.data(), data.size());\n\n\n // --- assign metadata to the image\n\n if (iref_box) {\n std::vector references = iref_box->get_references_from(id);\n for (const auto& ref : references) {\n if (ref.header.get_short_type() == fourcc(\"cdsc\")) {\n std::vector refs = ref.to_item_ID;\n if (refs.size() != 1) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Unspecified,\n \"Exif data not correctly assigned to image\");\n }\n\n uint32_t exif_image_id = refs[0];\n auto img_iter = m_all_images.find(exif_image_id);\n if (img_iter == m_all_images.end()) {\n return Error(heif_error_Invalid_input,\n heif_suberror_Nonexisting_item_referenced,\n \"Exif data assigned to non-existing image\");\n }\n\n img_iter->second->add_metadata(metadata);\n }\n }\n }\n }\n }\n\n return Error::Ok;\n}","lang":"cpp","vul_type":"cwe-416","sven_meta":{"func_name":"HeifContext::interpret_heif_file","file_name":"libheif/heif_context.cc","commit_link":"github.com/strukturag/libheif/commit/995a4283d8ed2d0d2c1ceb1a577b993df2f0e014","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#37-825ae2642222","input":"PlayerGeneric::~PlayerGeneric()\n{\n\tif (mixer)\n\t\tdelete mixer;\n\n\tif (player)\n\t{\n\t\tif (mixer->isActive() && !mixer->isDeviceRemoved(player))\n\t\t\tmixer->removeDevice(player);\n\t\tdelete player;\n\t}\n\n\tdelete[] audioDriverName;\n\t\n\tdelete listener;\n}","target":"PlayerGeneric::~PlayerGeneric()\n{\n\n\tif (player)\n\t{\n\t\tif (mixer && mixer->isActive() && !mixer->isDeviceRemoved(player))\n\t\t\tmixer->removeDevice(player);\n\t\tdelete player;\n\t}\n\t\n\tif (mixer)\n\t\tdelete mixer;\n\n\tdelete[] audioDriverName;\n\t\n\tdelete listener;\n}","lang":"cpp","vul_type":"cwe-416","sven_meta":{"func_name":"PlayerGeneric::~PlayerGeneric","file_name":"src/milkyplay/PlayerGeneric.cpp","commit_link":"github.com/milkytracker/MilkyTracker/commit/7afd55c42ad80d01a339197a2d8b5461d214edaf","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#38-285a1a2f364b","input":"vips_foreign_load_gif_scan_image( VipsForeignLoadGif *gif ) \n{\n\tVipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gif );\n\tGifFileType *file = gif->file;\n\tColorMapObject *map = file->Image.ColorMap ?\n\t\tfile->Image.ColorMap : file->SColorMap;\n\n\tGifByteType *extension;\n\n\tif( DGifGetImageDesc( gif->file ) == GIF_ERROR ) {\n\t\tvips_foreign_load_gif_error( gif ); \n\t\treturn( -1 );\n\t}\n\n\t/* Check that the frame looks sane. Perhaps giflib checks\n\t * this for us.\n\t */\n\tif( file->Image.Left < 0 ||\n\t\tfile->Image.Width < 1 ||\n\t\tfile->Image.Width > 10000 ||\n\t\tfile->Image.Left + file->Image.Width > file->SWidth ||\n\t\tfile->Image.Top < 0 ||\n\t\tfile->Image.Height < 1 ||\n\t\tfile->Image.Height > 10000 ||\n\t\tfile->Image.Top + file->Image.Height > file->SHeight ) {\n\t\tvips_error( class->nickname, \"%s\", _( \"bad frame size\" ) ); \n\t\treturn( -1 ); \n\t}\n\n\t/* Test for a non-greyscale colourmap for this frame.\n\t */\n\tif( !gif->has_colour &&\n\t\tmap ) {\n\t\tint i;\n\n\t\tfor( i = 0; i < map->ColorCount; i++ ) \n\t\t\tif( map->Colors[i].Red != map->Colors[i].Green ||\n\t\t\t\tmap->Colors[i].Green != map->Colors[i].Blue ) {\n\t\t\t\tgif->has_colour = TRUE;\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\n\t/* Step over compressed image data.\n\t */\n\tdo {\n\t\tif( vips_foreign_load_gif_code_next( gif, &extension ) ) \n\t\t\treturn( -1 );\n\t} while( extension != NULL );\n\n\treturn( 0 );\n}","target":"vips_foreign_load_gif_scan_image( VipsForeignLoadGif *gif ) \n{\n\tVipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gif );\n\tGifFileType *file = gif->file;\n\n\tColorMapObject *map;\n\tGifByteType *extension;\n\n\tif( DGifGetImageDesc( gif->file ) == GIF_ERROR ) {\n\t\tvips_foreign_load_gif_error( gif ); \n\t\treturn( -1 );\n\t}\n\n\t/* Check that the frame looks sane. Perhaps giflib checks\n\t * this for us.\n\t */\n\tif( file->Image.Left < 0 ||\n\t\tfile->Image.Width < 1 ||\n\t\tfile->Image.Width > 10000 ||\n\t\tfile->Image.Left + file->Image.Width > file->SWidth ||\n\t\tfile->Image.Top < 0 ||\n\t\tfile->Image.Height < 1 ||\n\t\tfile->Image.Height > 10000 ||\n\t\tfile->Image.Top + file->Image.Height > file->SHeight ) {\n\t\tvips_error( class->nickname, \"%s\", _( \"bad frame size\" ) ); \n\t\treturn( -1 ); \n\t}\n\n\t/* Test for a non-greyscale colourmap for this frame.\n\t */\n\tmap = file->Image.ColorMap ? file->Image.ColorMap : file->SColorMap;\n\tif( !gif->has_colour &&\n\t\tmap ) {\n\t\tint i;\n\n\t\tfor( i = 0; i < map->ColorCount; i++ ) \n\t\t\tif( map->Colors[i].Red != map->Colors[i].Green ||\n\t\t\t\tmap->Colors[i].Green != map->Colors[i].Blue ) {\n\t\t\t\tgif->has_colour = TRUE;\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\n\t/* Step over compressed image data.\n\t */\n\tdo {\n\t\tif( vips_foreign_load_gif_code_next( gif, &extension ) ) \n\t\t\treturn( -1 );\n\t} while( extension != NULL );\n\n\treturn( 0 );\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"vips_foreign_load_gif_scan_image","file_name":"libvips/foreign/gifload.c","commit_link":"github.com/libvips/libvips/commit/ce684dd008532ea0bf9d4a1d89bacb35f4a83f4d","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#39-5e2ddff81c75","input":"static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image *image, *image2=NULL,\n *rotated_image;\n register Quantum *q;\n\n unsigned int status;\n MATHeader MATLAB_HDR;\n size_t size;\n size_t CellType;\n QuantumInfo *quantum_info;\n ImageInfo *clone_info;\n int i;\n ssize_t ldblk;\n unsigned char *BImgBuff = NULL;\n double MinVal, MaxVal;\n unsigned z, z2;\n unsigned Frames;\n int logging;\n int sample_size;\n MagickOffsetType filepos=0x80;\n BlobInfo *blob;\n size_t one;\n\n unsigned int (*ReadBlobXXXLong)(Image *image);\n unsigned short (*ReadBlobXXXShort)(Image *image);\n void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data);\n void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data);\n\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n logging = LogMagickEvent(CoderEvent,GetMagickModule(),\"enter\");\n\n /*\n Open image file.\n */\n image = AcquireImage(image_info,exception);\n\n status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read MATLAB image.\n */\n quantum_info=(QuantumInfo *) NULL;\n clone_info=(ImageInfo *) NULL;\n if (ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (strncmp(MATLAB_HDR.identific,\"MATLAB\",6) != 0)\n {\n image2=ReadMATImageV4(image_info,image,exception);\n if (image2 == NULL)\n goto MATLAB_KO;\n image=image2;\n goto END_OF_READING;\n }\n MATLAB_HDR.Version = ReadBlobLSBShort(image);\n if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Endian %c%c\",\n MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]);\n if (!strncmp(MATLAB_HDR.EndianIndicator, \"IM\", 2))\n {\n ReadBlobXXXLong = ReadBlobLSBLong;\n ReadBlobXXXShort = ReadBlobLSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesLSB;\n ReadBlobFloatsXXX = ReadBlobFloatsLSB;\n image->endian = LSBEndian;\n }\n else if (!strncmp(MATLAB_HDR.EndianIndicator, \"MI\", 2))\n {\n ReadBlobXXXLong = ReadBlobMSBLong;\n ReadBlobXXXShort = ReadBlobMSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesMSB;\n ReadBlobFloatsXXX = ReadBlobFloatsMSB;\n image->endian = MSBEndian;\n }\n else\n goto MATLAB_KO; /* unsupported endian */\n\n if (strncmp(MATLAB_HDR.identific, \"MATLAB\", 6))\n {\nMATLAB_KO:\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n if (clone_info != (ImageInfo *) NULL)\n clone_info=DestroyImageInfo(clone_info);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n filepos = TellBlob(image);\n while(!EOFBlob(image)) /* object parser loop */\n {\n Frames = 1;\n (void) SeekBlob(image,filepos,SEEK_SET);\n /* printf(\"pos=%X\\n\",TellBlob(image)); */\n\n MATLAB_HDR.DataType = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n if((MagickSizeType) (MATLAB_HDR.ObjectSize+filepos) > GetBlobSize(image))\n goto MATLAB_KO;\n filepos += MATLAB_HDR.ObjectSize + 4 + 4;\n\n clone_info=CloneImageInfo(image_info);\n image2 = image;\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if(MATLAB_HDR.DataType == miCOMPRESSED)\n {\n image2 = decompress_block(image,&MATLAB_HDR.ObjectSize,clone_info,exception);\n if(image2==NULL) continue;\n MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */\n }\n#endif\n\n if (MATLAB_HDR.DataType!=miMATRIX)\n {\n clone_info=DestroyImageInfo(clone_info);\n continue; /* skip another objects. */\n }\n\n MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2);\n MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2);\n\n MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2);\n MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF;\n MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF;\n\n MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2);\n if(image!=image2)\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2);\n MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeX = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeY = ReadBlobXXXLong(image2);\n\n\n switch(MATLAB_HDR.DimFlag)\n {\n case 8: z2=z=1; break; /* 2D matrix*/\n case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/\n (void) ReadBlobXXXLong(image2);\n if(z!=3) ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n break;\n case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */\n if(z!=3 && z!=1)\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n Frames = ReadBlobXXXLong(image2);\n if (Frames == 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n break;\n default:\n if (clone_info != (ImageInfo *) NULL)\n clone_info=DestroyImageInfo(clone_info);\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n }\n\n MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2);\n MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2);\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.StructureClass %d\",MATLAB_HDR.StructureClass);\n if (MATLAB_HDR.StructureClass != mxCHAR_CLASS &&\n MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */\n MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */\n MATLAB_HDR.StructureClass != mxINT8_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */\n MATLAB_HDR.StructureClass != mxINT16_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */\n MATLAB_HDR.StructureClass != mxINT32_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */\n MATLAB_HDR.StructureClass != mxINT64_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */\n ThrowReaderException(CoderError,\"UnsupportedCellTypeInTheMatrix\");\n\n switch (MATLAB_HDR.NameFlag)\n {\n case 0:\n size = ReadBlobXXXLong(image2); /* Object name string size */\n size = 4 * (ssize_t) ((size + 3 + 1) / 4);\n (void) SeekBlob(image2, size, SEEK_CUR);\n break;\n case 1:\n case 2:\n case 3:\n case 4:\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */\n break;\n default:\n goto MATLAB_KO;\n }\n\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.CellType: %.20g\",(double) CellType);\n\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */\n\n NEXT_FRAME:\n switch (CellType)\n {\n case miINT8:\n case miUINT8:\n sample_size = 8;\n if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL)\n image->depth = 1;\n else\n image->depth = 8; /* Byte type cell */\n ldblk = (ssize_t) MATLAB_HDR.SizeX;\n break;\n case miINT16:\n case miUINT16:\n sample_size = 16;\n image->depth = 16; /* Word type cell */\n ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX);\n break;\n case miINT32:\n case miUINT32:\n sample_size = 32;\n image->depth = 32; /* Dword type cell */\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miINT64:\n case miUINT64:\n sample_size = 64;\n image->depth = 64; /* Qword type cell */\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n case miSINGLE:\n sample_size = 32;\n image->depth = 32; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex float type cell */\n }\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miDOUBLE:\n sample_size = 64;\n image->depth = 64; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\nDisableMSCWarning(4127)\n if (sizeof(double) != 8)\nRestoreMSCWarning\n ThrowReaderException(CoderError, \"IncompatibleSizeOfDouble\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex double type cell */\n }\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n default:\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n if (clone_info)\n clone_info=DestroyImageInfo(clone_info);\n ThrowReaderException(CoderError, \"UnsupportedCellTypeInTheMatrix\");\n }\n (void) sample_size;\n image->columns = MATLAB_HDR.SizeX;\n image->rows = MATLAB_HDR.SizeY;\n one=1;\n image->colors = one << image->depth;\n if (image->columns == 0 || image->rows == 0)\n goto MATLAB_KO;\n if((unsigned long)ldblk*MATLAB_HDR.SizeY > MATLAB_HDR.ObjectSize)\n goto MATLAB_KO;\n /* Image is gray when no complex flag is set and 2D Matrix */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n {\n image->type=GrayscaleType;\n SetImageColorspace(image,GRAYColorspace,exception);\n }\n\n\n /*\n If ping is true, then only set image size and colors without\n reading any image data.\n */\n if (image_info->ping)\n {\n size_t temp = image->columns;\n image->columns = image->rows;\n image->rows = temp;\n goto done_reading; /* !!!!!! BAD !!!! */\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n {\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n return(DestroyImageList(image));\n }\n quantum_info=AcquireQuantumInfo(clone_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n /* ----- Load raster data ----- */\n BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */\n if (BImgBuff == NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(BImgBuff,0,ldblk*sizeof(double));\n\n MinVal = 0;\n MaxVal = 0;\n if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum);\n }\n\n /* Main loop for reading all scanlines */\n if(z==1) z=0; /* read grey scanlines */\n /* else read color scanlines */\n do\n {\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT set image pixels returns unexpected NULL on a row %u.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto done_reading; /* Skip image rotation, when cannot set image pixels */\n }\n if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT cannot read scanrow %u from a file.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL))\n {\n FixLogical((unsigned char *)BImgBuff,ldblk);\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n {\nImportQuantumPixelsFailed:\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to ImportQuantumPixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n break;\n }\n }\n else\n {\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n goto ImportQuantumPixelsFailed;\n\n\n if (z<=1 && /* fix only during a last pass z==0 || z==1 */\n (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64))\n FixSignedValues(image,q,MATLAB_HDR.SizeX);\n }\n\n if (!SyncAuthenticPixels(image,exception))\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to sync image pixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n }\n } while(z-- >= 2);\nExitLoop:\n\n\n /* Read complex part of numbers here */\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* Find Min and Max Values for complex parts of floats */\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/\n\n if (CellType==miDOUBLE || CellType==miSINGLE)\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal);\n }\n\n if (CellType==miDOUBLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff);\n InsertComplexDoubleRow(image, (double *)BImgBuff, i, MinVal, MaxVal,\n exception);\n }\n\n if (CellType==miSINGLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff);\n InsertComplexFloatRow(image,(float *)BImgBuff,i,MinVal,MaxVal,\n exception);\n }\n }\n\n /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n image->type=GrayscaleType;\n if (image->depth == 1)\n image->type=BilevelType;\n\n if(image2==image)\n image2 = NULL; /* Remove shadow copy to an image before rotation. */\n\n /* Rotate image. */\n rotated_image = RotateImage(image, 90.0, exception);\n if (rotated_image != (Image *) NULL)\n {\n /* Remove page offsets added by RotateImage */\n rotated_image->page.x=0;\n rotated_image->page.y=0;\n\n blob = rotated_image->blob;\n rotated_image->blob = image->blob;\n rotated_image->colors = image->colors;\n image->blob = blob;\n AppendImageToList(&image,rotated_image);\n DeleteImageFromList(&image);\n }\n\ndone_reading:\n\n if(image2!=NULL)\n if(image2!=image)\n {\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n if (image->next == (Image *) NULL) break;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n\n /* row scan buffer is no longer needed */\n RelinquishMagickMemory(BImgBuff);\n BImgBuff = NULL;\n\n if(--Frames>0)\n {\n z = z2;\n if(image2==NULL) image2 = image;\n goto NEXT_FRAME;\n }\n if ((image2!=NULL) && (image2!=image)) /* Does shadow temporary decompressed image exist? */\n {\n/* CloseBlob(image2); */\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n if (clone_info)\n clone_info=DestroyImageInfo(clone_info);\n }\n\n RelinquishMagickMemory(BImgBuff);\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\nEND_OF_READING:\n if (clone_info)\n clone_info=DestroyImageInfo(clone_info);\n CloseBlob(image);\n\n\n {\n Image *p;\n ssize_t scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n\n /*\n Fix scene numbers\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=scene++;\n }\n\n if(clone_info != NULL) /* cleanup garbage file from compression */\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n DestroyImageInfo(clone_info);\n clone_info = NULL;\n }\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\"return\");\n if (image==NULL)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\")\n else\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n return (image);\n}","target":"static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n Image *image, *image2=NULL,\n *rotated_image;\n register Quantum *q;\n\n unsigned int status;\n MATHeader MATLAB_HDR;\n size_t size;\n size_t CellType;\n QuantumInfo *quantum_info;\n ImageInfo *clone_info;\n int i;\n ssize_t ldblk;\n unsigned char *BImgBuff = NULL;\n double MinVal, MaxVal;\n unsigned z, z2;\n unsigned Frames;\n int logging;\n int sample_size;\n MagickOffsetType filepos=0x80;\n BlobInfo *blob;\n size_t one;\n\n unsigned int (*ReadBlobXXXLong)(Image *image);\n unsigned short (*ReadBlobXXXShort)(Image *image);\n void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data);\n void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data);\n\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n logging = LogMagickEvent(CoderEvent,GetMagickModule(),\"enter\");\n\n /*\n Open image file.\n */\n image = AcquireImage(image_info,exception);\n\n status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read MATLAB image.\n */\n quantum_info=(QuantumInfo *) NULL;\n clone_info=(ImageInfo *) NULL;\n if (ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n if (strncmp(MATLAB_HDR.identific,\"MATLAB\",6) != 0)\n {\n image2=ReadMATImageV4(image_info,image,exception);\n if (image2 == NULL)\n goto MATLAB_KO;\n image=image2;\n goto END_OF_READING;\n }\n MATLAB_HDR.Version = ReadBlobLSBShort(image);\n if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Endian %c%c\",\n MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]);\n if (!strncmp(MATLAB_HDR.EndianIndicator, \"IM\", 2))\n {\n ReadBlobXXXLong = ReadBlobLSBLong;\n ReadBlobXXXShort = ReadBlobLSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesLSB;\n ReadBlobFloatsXXX = ReadBlobFloatsLSB;\n image->endian = LSBEndian;\n }\n else if (!strncmp(MATLAB_HDR.EndianIndicator, \"MI\", 2))\n {\n ReadBlobXXXLong = ReadBlobMSBLong;\n ReadBlobXXXShort = ReadBlobMSBShort;\n ReadBlobDoublesXXX = ReadBlobDoublesMSB;\n ReadBlobFloatsXXX = ReadBlobFloatsMSB;\n image->endian = MSBEndian;\n }\n else\n goto MATLAB_KO; /* unsupported endian */\n\n if (strncmp(MATLAB_HDR.identific, \"MATLAB\", 6))\n {\nMATLAB_KO:\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n if (clone_info != (ImageInfo *) NULL)\n clone_info=DestroyImageInfo(clone_info);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n\n filepos = TellBlob(image);\n while(!EOFBlob(image)) /* object parser loop */\n {\n Frames = 1;\n (void) SeekBlob(image,filepos,SEEK_SET);\n /* printf(\"pos=%X\\n\",TellBlob(image)); */\n\n MATLAB_HDR.DataType = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image);\n if(EOFBlob(image)) break;\n if((MagickSizeType) (MATLAB_HDR.ObjectSize+filepos) > GetBlobSize(image))\n goto MATLAB_KO;\n filepos += MATLAB_HDR.ObjectSize + 4 + 4;\n\n clone_info=CloneImageInfo(image_info);\n image2 = image;\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if(MATLAB_HDR.DataType == miCOMPRESSED)\n {\n image2 = decompress_block(image,&MATLAB_HDR.ObjectSize,clone_info,exception);\n if(image2==NULL) continue;\n MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */\n }\n#endif\n\n if (MATLAB_HDR.DataType!=miMATRIX)\n {\n clone_info=DestroyImageInfo(clone_info);\n continue; /* skip another objects. */\n }\n\n MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2);\n MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2);\n\n MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2);\n MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF;\n MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF;\n\n MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2);\n if(image!=image2)\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */\n MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2);\n MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeX = ReadBlobXXXLong(image2);\n MATLAB_HDR.SizeY = ReadBlobXXXLong(image2);\n\n\n switch(MATLAB_HDR.DimFlag)\n {\n case 8: z2=z=1; break; /* 2D matrix*/\n case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/\n (void) ReadBlobXXXLong(image2);\n if(z!=3) ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n break;\n case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */\n if(z!=3 && z!=1)\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n Frames = ReadBlobXXXLong(image2);\n if (Frames == 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n break;\n default:\n if (clone_info != (ImageInfo *) NULL)\n clone_info=DestroyImageInfo(clone_info);\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\");\n }\n\n MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2);\n MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2);\n\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.StructureClass %d\",MATLAB_HDR.StructureClass);\n if (MATLAB_HDR.StructureClass != mxCHAR_CLASS &&\n MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */\n MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */\n MATLAB_HDR.StructureClass != mxINT8_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */\n MATLAB_HDR.StructureClass != mxINT16_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */\n MATLAB_HDR.StructureClass != mxINT32_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */\n MATLAB_HDR.StructureClass != mxINT64_CLASS &&\n MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */\n ThrowReaderException(CoderError,\"UnsupportedCellTypeInTheMatrix\");\n\n switch (MATLAB_HDR.NameFlag)\n {\n case 0:\n size = ReadBlobXXXLong(image2); /* Object name string size */\n size = 4 * (ssize_t) ((size + 3 + 1) / 4);\n (void) SeekBlob(image2, size, SEEK_CUR);\n break;\n case 1:\n case 2:\n case 3:\n case 4:\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */\n break;\n default:\n goto MATLAB_KO;\n }\n\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n if (logging)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"MATLAB_HDR.CellType: %.20g\",(double) CellType);\n\n (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */\n\n NEXT_FRAME:\n switch (CellType)\n {\n case miINT8:\n case miUINT8:\n sample_size = 8;\n if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL)\n image->depth = 1;\n else\n image->depth = 8; /* Byte type cell */\n ldblk = (ssize_t) MATLAB_HDR.SizeX;\n break;\n case miINT16:\n case miUINT16:\n sample_size = 16;\n image->depth = 16; /* Word type cell */\n ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX);\n break;\n case miINT32:\n case miUINT32:\n sample_size = 32;\n image->depth = 32; /* Dword type cell */\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miINT64:\n case miUINT64:\n sample_size = 64;\n image->depth = 64; /* Qword type cell */\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n case miSINGLE:\n sample_size = 32;\n image->depth = 32; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex float type cell */\n }\n ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX);\n break;\n case miDOUBLE:\n sample_size = 64;\n image->depth = 64; /* double type cell */\n (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\");\nDisableMSCWarning(4127)\n if (sizeof(double) != 8)\nRestoreMSCWarning\n ThrowReaderException(CoderError, \"IncompatibleSizeOfDouble\");\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* complex double type cell */\n }\n ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX);\n break;\n default:\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n if (clone_info)\n clone_info=DestroyImageInfo(clone_info);\n ThrowReaderException(CoderError, \"UnsupportedCellTypeInTheMatrix\");\n }\n (void) sample_size;\n image->columns = MATLAB_HDR.SizeX;\n image->rows = MATLAB_HDR.SizeY;\n one=1;\n image->colors = one << image->depth;\n if (image->columns == 0 || image->rows == 0)\n goto MATLAB_KO;\n if((unsigned long)ldblk*MATLAB_HDR.SizeY > MATLAB_HDR.ObjectSize)\n goto MATLAB_KO;\n /* Image is gray when no complex flag is set and 2D Matrix */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n {\n image->type=GrayscaleType;\n SetImageColorspace(image,GRAYColorspace,exception);\n }\n\n\n /*\n If ping is true, then only set image size and colors without\n reading any image data.\n */\n if (image_info->ping)\n {\n size_t temp = image->columns;\n image->columns = image->rows;\n image->rows = temp;\n goto done_reading; /* !!!!!! BAD !!!! */\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n {\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n return(DestroyImageList(image));\n }\n quantum_info=AcquireQuantumInfo(clone_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n\n /* ----- Load raster data ----- */\n BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */\n if (BImgBuff == NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(BImgBuff,0,ldblk*sizeof(double));\n\n MinVal = 0;\n MaxVal = 0;\n if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum);\n }\n\n /* Main loop for reading all scanlines */\n if(z==1) z=0; /* read grey scanlines */\n /* else read color scanlines */\n do\n {\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT set image pixels returns unexpected NULL on a row %u.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto done_reading; /* Skip image rotation, when cannot set image pixels */\n }\n if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk)\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT cannot read scanrow %u from a file.\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL))\n {\n FixLogical((unsigned char *)BImgBuff,ldblk);\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n {\nImportQuantumPixelsFailed:\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to ImportQuantumPixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n break;\n }\n }\n else\n {\n if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0)\n goto ImportQuantumPixelsFailed;\n\n\n if (z<=1 && /* fix only during a last pass z==0 || z==1 */\n (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64))\n FixSignedValues(image,q,MATLAB_HDR.SizeX);\n }\n\n if (!SyncAuthenticPixels(image,exception))\n {\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\n \" MAT failed to sync image pixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1));\n goto ExitLoop;\n }\n }\n } while(z-- >= 2);\nExitLoop:\n\n\n /* Read complex part of numbers here */\n if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)\n { /* Find Min and Max Values for complex parts of floats */\n CellType = ReadBlobXXXLong(image2); /* Additional object type */\n i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/\n\n if (CellType==miDOUBLE || CellType==miSINGLE)\n {\n CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal);\n }\n\n if (CellType==miDOUBLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff);\n InsertComplexDoubleRow(image, (double *)BImgBuff, i, MinVal, MaxVal,\n exception);\n }\n\n if (CellType==miSINGLE)\n for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++)\n {\n ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff);\n InsertComplexFloatRow(image,(float *)BImgBuff,i,MinVal,MaxVal,\n exception);\n }\n }\n\n /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */\n if ((MATLAB_HDR.DimFlag == 8) &&\n ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0))\n image->type=GrayscaleType;\n if (image->depth == 1)\n image->type=BilevelType;\n\n if(image2==image)\n image2 = NULL; /* Remove shadow copy to an image before rotation. */\n\n /* Rotate image. */\n rotated_image = RotateImage(image, 90.0, exception);\n if (rotated_image != (Image *) NULL)\n {\n /* Remove page offsets added by RotateImage */\n rotated_image->page.x=0;\n rotated_image->page.y=0;\n\n blob = rotated_image->blob;\n rotated_image->blob = image->blob;\n rotated_image->colors = image->colors;\n image->blob = blob;\n AppendImageToList(&image,rotated_image);\n DeleteImageFromList(&image);\n }\n\ndone_reading:\n\n if(image2!=NULL)\n if(image2!=image)\n {\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n /* Allocate next image structure. */\n AcquireNextImage(image_info,image,exception);\n if (image->next == (Image *) NULL) break;\n image=SyncNextImageInList(image);\n image->columns=image->rows=0;\n image->colors=0;\n\n /* row scan buffer is no longer needed */\n RelinquishMagickMemory(BImgBuff);\n BImgBuff = NULL;\n\n if(--Frames>0)\n {\n z = z2;\n if(image2==NULL) image2 = image;\n goto NEXT_FRAME;\n }\n if ((image2!=NULL) && (image2!=image)) /* Does shadow temporary decompressed image exist? */\n {\n/* CloseBlob(image2); */\n DeleteImageFromList(&image2);\n if(clone_info)\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n }\n }\n\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\n if (clone_info)\n clone_info=DestroyImageInfo(clone_info);\n }\n\n RelinquishMagickMemory(BImgBuff);\n if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);\nEND_OF_READING:\n CloseBlob(image);\n\n\n {\n Image *p;\n ssize_t scene=0;\n\n /*\n Rewind list, removing any empty images while rewinding.\n */\n p=image;\n image=NULL;\n while (p != (Image *) NULL)\n {\n Image *tmp=p;\n if ((p->rows == 0) || (p->columns == 0)) {\n p=p->previous;\n if (tmp == image2)\n image2=(Image *) NULL;\n DeleteImageFromList(&tmp);\n } else {\n image=p;\n p=p->previous;\n }\n }\n\n /*\n Fix scene numbers\n */\n for (p=image; p != (Image *) NULL; p=p->next)\n p->scene=scene++;\n }\n\n if(clone_info != NULL) /* cleanup garbage file from compression */\n {\n if(clone_info->file)\n {\n fclose(clone_info->file);\n clone_info->file = NULL;\n (void) remove_utf8(clone_info->filename);\n }\n DestroyImageInfo(clone_info);\n clone_info = NULL;\n }\n if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\"return\");\n if (image==NULL)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\")\n else\n if ((image != image2) && (image2 != (Image *) NULL))\n image2=DestroyImage(image2);\n return (image);\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"ReadMATImage","file_name":"coders/mat.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/04178de2247e353fc095846784b9a10fefdbf890","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#40-b0163fcddb5c","input":"static OPJ_BOOL opj_j2k_write_mco( opj_j2k_t *p_j2k,\n struct opj_stream_private *p_stream,\n struct opj_event_mgr * p_manager\n )\n{\n OPJ_BYTE * l_current_data = 00;\n OPJ_UINT32 l_mco_size;\n opj_tcp_t * l_tcp = 00;\n opj_simple_mcc_decorrelation_data_t * l_mcc_record;\n OPJ_UINT32 i;\n\n /* preconditions */\n assert(p_j2k != 00);\n assert(p_manager != 00);\n assert(p_stream != 00);\n\n l_tcp =&(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]);\n l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data;\n\n l_mco_size = 5 + l_tcp->m_nb_mcc_records;\n if (l_mco_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) {\n\n OPJ_BYTE *new_header_tile_data = (OPJ_BYTE *) opj_realloc(p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_mco_size);\n if (! new_header_tile_data) {\n opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data);\n p_j2k->m_specific_param.m_encoder.m_header_tile_data = NULL;\n p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0;\n opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to write MCO marker\\n\");\n return OPJ_FALSE;\n }\n p_j2k->m_specific_param.m_encoder.m_header_tile_data = new_header_tile_data;\n p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = l_mco_size;\n }\n\n opj_write_bytes(l_current_data,J2K_MS_MCO,2); /* MCO */\n l_current_data += 2;\n\n opj_write_bytes(l_current_data,l_mco_size-2,2); /* Lmco */\n l_current_data += 2;\n\n opj_write_bytes(l_current_data,l_tcp->m_nb_mcc_records,1); /* Nmco : only one tranform stage*/\n ++l_current_data;\n\n l_mcc_record = l_tcp->m_mcc_records;\n for (i=0;im_nb_mcc_records;++i) {\n opj_write_bytes(l_current_data,l_mcc_record->m_index,1);/* Imco -> use the mcc indicated by 1*/\n ++l_current_data;\n\n ++l_mcc_record;\n }\n\n if (opj_stream_write_data(p_stream,p_j2k->m_specific_param.m_encoder.m_header_tile_data,l_mco_size,p_manager) != l_mco_size) {\n return OPJ_FALSE;\n }\n\n return OPJ_TRUE;\n}","target":"static OPJ_BOOL opj_j2k_write_mco( opj_j2k_t *p_j2k,\n struct opj_stream_private *p_stream,\n struct opj_event_mgr * p_manager\n )\n{\n OPJ_BYTE * l_current_data = 00;\n OPJ_UINT32 l_mco_size;\n opj_tcp_t * l_tcp = 00;\n opj_simple_mcc_decorrelation_data_t * l_mcc_record;\n OPJ_UINT32 i;\n\n /* preconditions */\n assert(p_j2k != 00);\n assert(p_manager != 00);\n assert(p_stream != 00);\n\n l_tcp =&(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]);\n\t\n l_mco_size = 5 + l_tcp->m_nb_mcc_records;\n if (l_mco_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) {\n\n OPJ_BYTE *new_header_tile_data = (OPJ_BYTE *) opj_realloc(p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_mco_size);\n if (! new_header_tile_data) {\n opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data);\n p_j2k->m_specific_param.m_encoder.m_header_tile_data = NULL;\n p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0;\n opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to write MCO marker\\n\");\n return OPJ_FALSE;\n }\n p_j2k->m_specific_param.m_encoder.m_header_tile_data = new_header_tile_data;\n p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = l_mco_size;\n }\n l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data;\n\n\n opj_write_bytes(l_current_data,J2K_MS_MCO,2); /* MCO */\n l_current_data += 2;\n\n opj_write_bytes(l_current_data,l_mco_size-2,2); /* Lmco */\n l_current_data += 2;\n\n opj_write_bytes(l_current_data,l_tcp->m_nb_mcc_records,1); /* Nmco : only one tranform stage*/\n ++l_current_data;\n\n l_mcc_record = l_tcp->m_mcc_records;\n for (i=0;im_nb_mcc_records;++i) {\n opj_write_bytes(l_current_data,l_mcc_record->m_index,1);/* Imco -> use the mcc indicated by 1*/\n ++l_current_data;\n ++l_mcc_record;\n }\n\n if (opj_stream_write_data(p_stream,p_j2k->m_specific_param.m_encoder.m_header_tile_data,l_mco_size,p_manager) != l_mco_size) {\n return OPJ_FALSE;\n }\n\n return OPJ_TRUE;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"opj_j2k_write_mco","file_name":"src/lib/openjp2/j2k.c","commit_link":"github.com/uclouvain/openjpeg/commit/940100c28ae28931722290794889cf84a92c5f6f","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#41-7c0967581c5b","input":"tcpmss_mangle_packet(struct sk_buff *skb,\n\t\t const struct xt_action_param *par,\n\t\t unsigned int family,\n\t\t unsigned int tcphoff,\n\t\t unsigned int minlen)\n{\n\tconst struct xt_tcpmss_info *info = par->targinfo;\n\tstruct tcphdr *tcph;\n\tint len, tcp_hdrlen;\n\tunsigned int i;\n\t__be16 oldval;\n\tu16 newmss;\n\tu8 *opt;\n\n\t/* This is a fragment, no TCP header is available */\n\tif (par->fragoff != 0)\n\t\treturn 0;\n\n\tif (!skb_make_writable(skb, skb->len))\n\t\treturn -1;\n\n\tlen = skb->len - tcphoff;\n\tif (len < (int)sizeof(struct tcphdr))\n\t\treturn -1;\n\n\ttcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);\n\ttcp_hdrlen = tcph->doff * 4;\n\n\tif (len < tcp_hdrlen)\n\t\treturn -1;\n\n\tif (info->mss == XT_TCPMSS_CLAMP_PMTU) {\n\t\tstruct net *net = xt_net(par);\n\t\tunsigned int in_mtu = tcpmss_reverse_mtu(net, skb, family);\n\t\tunsigned int min_mtu = min(dst_mtu(skb_dst(skb)), in_mtu);\n\n\t\tif (min_mtu <= minlen) {\n\t\t\tnet_err_ratelimited(\"unknown or invalid path-MTU (%u)\\n\",\n\t\t\t\t\t min_mtu);\n\t\t\treturn -1;\n\t\t}\n\t\tnewmss = min_mtu - minlen;\n\t} else\n\t\tnewmss = info->mss;\n\n\topt = (u_int8_t *)tcph;\n\tfor (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += optlen(opt, i)) {\n\t\tif (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) {\n\t\t\tu_int16_t oldmss;\n\n\t\t\toldmss = (opt[i+2] << 8) | opt[i+3];\n\n\t\t\t/* Never increase MSS, even when setting it, as\n\t\t\t * doing so results in problems for hosts that rely\n\t\t\t * on MSS being set correctly.\n\t\t\t */\n\t\t\tif (oldmss <= newmss)\n\t\t\t\treturn 0;\n\n\t\t\topt[i+2] = (newmss & 0xff00) >> 8;\n\t\t\topt[i+3] = newmss & 0x00ff;\n\n\t\t\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t\t\t htons(oldmss), htons(newmss),\n\t\t\t\t\t\t false);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t/* There is data after the header so the option can't be added\n\t * without moving it, and doing so may make the SYN packet\n\t * itself too large. Accept the packet unmodified instead.\n\t */\n\tif (len > tcp_hdrlen)\n\t\treturn 0;\n\n\t/*\n\t * MSS Option not found ?! add it..\n\t */\n\tif (skb_tailroom(skb) < TCPOLEN_MSS) {\n\t\tif (pskb_expand_head(skb, 0,\n\t\t\t\t TCPOLEN_MSS - skb_tailroom(skb),\n\t\t\t\t GFP_ATOMIC))\n\t\t\treturn -1;\n\t\ttcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);\n\t}\n\n\tskb_put(skb, TCPOLEN_MSS);\n\n\t/*\n\t * IPv4: RFC 1122 states \"If an MSS option is not received at\n\t * connection setup, TCP MUST assume a default send MSS of 536\".\n\t * IPv6: RFC 2460 states IPv6 has a minimum MTU of 1280 and a minimum\n\t * length IPv6 header of 60, ergo the default MSS value is 1220\n\t * Since no MSS was provided, we must use the default values\n\t */\n\tif (xt_family(par) == NFPROTO_IPV4)\n\t\tnewmss = min(newmss, (u16)536);\n\telse\n\t\tnewmss = min(newmss, (u16)1220);\n\n\topt = (u_int8_t *)tcph + sizeof(struct tcphdr);\n\tmemmove(opt + TCPOLEN_MSS, opt, len - sizeof(struct tcphdr));\n\n\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t htons(len), htons(len + TCPOLEN_MSS), true);\n\topt[0] = TCPOPT_MSS;\n\topt[1] = TCPOLEN_MSS;\n\topt[2] = (newmss & 0xff00) >> 8;\n\topt[3] = newmss & 0x00ff;\n\n\tinet_proto_csum_replace4(&tcph->check, skb, 0, *((__be32 *)opt), false);\n\n\toldval = ((__be16 *)tcph)[6];\n\ttcph->doff += TCPOLEN_MSS/4;\n\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t oldval, ((__be16 *)tcph)[6], false);\n\treturn TCPOLEN_MSS;\n}","target":"tcpmss_mangle_packet(struct sk_buff *skb,\n\t\t const struct xt_action_param *par,\n\t\t unsigned int family,\n\t\t unsigned int tcphoff,\n\t\t unsigned int minlen)\n{\n\tconst struct xt_tcpmss_info *info = par->targinfo;\n\tstruct tcphdr *tcph;\n\tint len, tcp_hdrlen;\n\tunsigned int i;\n\t__be16 oldval;\n\tu16 newmss;\n\tu8 *opt;\n\n\t/* This is a fragment, no TCP header is available */\n\tif (par->fragoff != 0)\n\t\treturn 0;\n\n\tif (!skb_make_writable(skb, skb->len))\n\t\treturn -1;\n\n\tlen = skb->len - tcphoff;\n\tif (len < (int)sizeof(struct tcphdr))\n\t\treturn -1;\n\n\ttcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);\n\ttcp_hdrlen = tcph->doff * 4;\n\n\tif (len < tcp_hdrlen || tcp_hdrlen < sizeof(struct tcphdr))\n\t\treturn -1;\n\n\tif (info->mss == XT_TCPMSS_CLAMP_PMTU) {\n\t\tstruct net *net = xt_net(par);\n\t\tunsigned int in_mtu = tcpmss_reverse_mtu(net, skb, family);\n\t\tunsigned int min_mtu = min(dst_mtu(skb_dst(skb)), in_mtu);\n\n\t\tif (min_mtu <= minlen) {\n\t\t\tnet_err_ratelimited(\"unknown or invalid path-MTU (%u)\\n\",\n\t\t\t\t\t min_mtu);\n\t\t\treturn -1;\n\t\t}\n\t\tnewmss = min_mtu - minlen;\n\t} else\n\t\tnewmss = info->mss;\n\n\topt = (u_int8_t *)tcph;\n\tfor (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += optlen(opt, i)) {\n\t\tif (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) {\n\t\t\tu_int16_t oldmss;\n\n\t\t\toldmss = (opt[i+2] << 8) | opt[i+3];\n\n\t\t\t/* Never increase MSS, even when setting it, as\n\t\t\t * doing so results in problems for hosts that rely\n\t\t\t * on MSS being set correctly.\n\t\t\t */\n\t\t\tif (oldmss <= newmss)\n\t\t\t\treturn 0;\n\n\t\t\topt[i+2] = (newmss & 0xff00) >> 8;\n\t\t\topt[i+3] = newmss & 0x00ff;\n\n\t\t\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t\t\t htons(oldmss), htons(newmss),\n\t\t\t\t\t\t false);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t/* There is data after the header so the option can't be added\n\t * without moving it, and doing so may make the SYN packet\n\t * itself too large. Accept the packet unmodified instead.\n\t */\n\tif (len > tcp_hdrlen)\n\t\treturn 0;\n\n\t/* tcph->doff has 4 bits, do not wrap it to 0 */\n\tif (tcp_hdrlen >= 15 * 4)\n\t\treturn 0;\n\n\t/*\n\t * MSS Option not found ?! add it..\n\t */\n\tif (skb_tailroom(skb) < TCPOLEN_MSS) {\n\t\tif (pskb_expand_head(skb, 0,\n\t\t\t\t TCPOLEN_MSS - skb_tailroom(skb),\n\t\t\t\t GFP_ATOMIC))\n\t\t\treturn -1;\n\t\ttcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);\n\t}\n\n\tskb_put(skb, TCPOLEN_MSS);\n\n\t/*\n\t * IPv4: RFC 1122 states \"If an MSS option is not received at\n\t * connection setup, TCP MUST assume a default send MSS of 536\".\n\t * IPv6: RFC 2460 states IPv6 has a minimum MTU of 1280 and a minimum\n\t * length IPv6 header of 60, ergo the default MSS value is 1220\n\t * Since no MSS was provided, we must use the default values\n\t */\n\tif (xt_family(par) == NFPROTO_IPV4)\n\t\tnewmss = min(newmss, (u16)536);\n\telse\n\t\tnewmss = min(newmss, (u16)1220);\n\n\topt = (u_int8_t *)tcph + sizeof(struct tcphdr);\n\tmemmove(opt + TCPOLEN_MSS, opt, len - sizeof(struct tcphdr));\n\n\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t htons(len), htons(len + TCPOLEN_MSS), true);\n\topt[0] = TCPOPT_MSS;\n\topt[1] = TCPOLEN_MSS;\n\topt[2] = (newmss & 0xff00) >> 8;\n\topt[3] = newmss & 0x00ff;\n\n\tinet_proto_csum_replace4(&tcph->check, skb, 0, *((__be32 *)opt), false);\n\n\toldval = ((__be16 *)tcph)[6];\n\ttcph->doff += TCPOLEN_MSS/4;\n\tinet_proto_csum_replace2(&tcph->check, skb,\n\t\t\t\t oldval, ((__be16 *)tcph)[6], false);\n\treturn TCPOLEN_MSS;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"tcpmss_mangle_packet","file_name":"net/netfilter/xt_TCPMSS.c","commit_link":"github.com/torvalds/linux/commit/2638fd0f92d4397884fd991d8f4925cb3f081901","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#42-65fa15009a6f","input":"void luaD_shrinkstack (lua_State *L) {\n int inuse = stackinuse(L);\n int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK;\n if (goodsize > LUAI_MAXSTACK)\n goodsize = LUAI_MAXSTACK; /* respect stack limit */\n /* if thread is currently not handling a stack overflow and its\n good size is smaller than current size, shrink its stack */\n if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) &&\n goodsize < L->stacksize)\n luaD_reallocstack(L, goodsize, 0); /* ok if that fails */\n else /* don't change stack */\n condmovestack(L,{},{}); /* (change only for debugging) */\n luaE_shrinkCI(L); /* shrink CI list */\n}","target":"void luaD_shrinkstack (lua_State *L) {\n int inuse = stackinuse(L);\n int goodsize = inuse + BASIC_STACK_SIZE;\n if (goodsize > LUAI_MAXSTACK)\n goodsize = LUAI_MAXSTACK; /* respect stack limit */\n /* if thread is currently not handling a stack overflow and its\n good size is smaller than current size, shrink its stack */\n if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && goodsize < L->stacksize)\n luaD_reallocstack(L, goodsize, 0); /* ok if that fails */\n else /* don't change stack */\n condmovestack(L,{},{}); /* (change only for debugging) */\n luaE_shrinkCI(L); /* shrink CI list */\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"luaD_shrinkstack","file_name":"ldo.c","commit_link":"github.com/lua/lua/commit/6298903e35217ab69c279056f925fb72900ce0b7","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#43-3d68ccabe9a1","input":"mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)\n{\n /* mrb_assert(mrb_proc_cfunc_p(proc)) */\n mrb_irep *irep = proc->body.irep;\n mrb_value *pool = irep->pool;\n mrb_sym *syms = irep->syms;\n mrb_code i;\n int ai = mrb_gc_arena_save(mrb);\n struct mrb_jmpbuf *prev_jmp = mrb->jmp;\n struct mrb_jmpbuf c_jmp;\n\n#ifdef DIRECT_THREADED\n static void *optable[] = {\n &&L_OP_NOP, &&L_OP_MOVE,\n &&L_OP_LOADL, &&L_OP_LOADI, &&L_OP_LOADSYM, &&L_OP_LOADNIL,\n &&L_OP_LOADSELF, &&L_OP_LOADT, &&L_OP_LOADF,\n &&L_OP_GETGLOBAL, &&L_OP_SETGLOBAL, &&L_OP_GETSPECIAL, &&L_OP_SETSPECIAL,\n &&L_OP_GETIV, &&L_OP_SETIV, &&L_OP_GETCV, &&L_OP_SETCV,\n &&L_OP_GETCONST, &&L_OP_SETCONST, &&L_OP_GETMCNST, &&L_OP_SETMCNST,\n &&L_OP_GETUPVAR, &&L_OP_SETUPVAR,\n &&L_OP_JMP, &&L_OP_JMPIF, &&L_OP_JMPNOT,\n &&L_OP_ONERR, &&L_OP_RESCUE, &&L_OP_POPERR, &&L_OP_RAISE, &&L_OP_EPUSH, &&L_OP_EPOP,\n &&L_OP_SEND, &&L_OP_SENDB, &&L_OP_FSEND,\n &&L_OP_CALL, &&L_OP_SUPER, &&L_OP_ARGARY, &&L_OP_ENTER,\n &&L_OP_KARG, &&L_OP_KDICT, &&L_OP_RETURN, &&L_OP_TAILCALL, &&L_OP_BLKPUSH,\n &&L_OP_ADD, &&L_OP_ADDI, &&L_OP_SUB, &&L_OP_SUBI, &&L_OP_MUL, &&L_OP_DIV,\n &&L_OP_EQ, &&L_OP_LT, &&L_OP_LE, &&L_OP_GT, &&L_OP_GE,\n &&L_OP_ARRAY, &&L_OP_ARYCAT, &&L_OP_ARYPUSH, &&L_OP_AREF, &&L_OP_ASET, &&L_OP_APOST,\n &&L_OP_STRING, &&L_OP_STRCAT, &&L_OP_HASH,\n &&L_OP_LAMBDA, &&L_OP_RANGE, &&L_OP_OCLASS,\n &&L_OP_CLASS, &&L_OP_MODULE, &&L_OP_EXEC,\n &&L_OP_METHOD, &&L_OP_SCLASS, &&L_OP_TCLASS,\n &&L_OP_DEBUG, &&L_OP_STOP, &&L_OP_ERR,\n };\n#endif\n\n mrb_bool exc_catched = FALSE;\nRETRY_TRY_BLOCK:\n\n MRB_TRY(&c_jmp) {\n\n if (exc_catched) {\n exc_catched = FALSE;\n if (mrb->exc && mrb->exc->tt == MRB_TT_BREAK)\n goto L_BREAK;\n goto L_RAISE;\n }\n mrb->jmp = &c_jmp;\n mrb->c->ci->proc = proc;\n mrb->c->ci->nregs = irep->nregs;\n\n#define regs (mrb->c->stack)\n INIT_DISPATCH {\n CASE(OP_NOP) {\n /* do nothing */\n NEXT;\n }\n\n CASE(OP_MOVE) {\n /* A B R(A) := R(B) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n regs[a] = regs[b];\n NEXT;\n }\n\n CASE(OP_LOADL) {\n /* A Bx R(A) := Pool(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n#ifdef MRB_WORD_BOXING\n mrb_value val = pool[bx];\n#ifndef MRB_WITHOUT_FLOAT\n if (mrb_float_p(val)) {\n val = mrb_float_value(mrb, mrb_float(val));\n }\n#endif\n regs[a] = val;\n#else\n regs[a] = pool[bx];\n#endif\n NEXT;\n }\n\n CASE(OP_LOADI) {\n /* A sBx R(A) := sBx */\n int a = GETARG_A(i);\n mrb_int bx = GETARG_sBx(i);\n SET_INT_VALUE(regs[a], bx);\n NEXT;\n }\n\n CASE(OP_LOADSYM) {\n /* A Bx R(A) := Syms(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n SET_SYM_VALUE(regs[a], syms[bx]);\n NEXT;\n }\n\n CASE(OP_LOADSELF) {\n /* A R(A) := self */\n int a = GETARG_A(i);\n regs[a] = regs[0];\n NEXT;\n }\n\n CASE(OP_LOADT) {\n /* A R(A) := true */\n int a = GETARG_A(i);\n SET_TRUE_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_LOADF) {\n /* A R(A) := false */\n int a = GETARG_A(i);\n SET_FALSE_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_GETGLOBAL) {\n /* A Bx R(A) := getglobal(Syms(Bx)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_gv_get(mrb, syms[bx]);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETGLOBAL) {\n /* A Bx setglobal(Syms(Bx), R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_gv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETSPECIAL) {\n /* A Bx R(A) := Special[Bx] */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_vm_special_get(mrb, bx);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETSPECIAL) {\n /* A Bx Special[Bx] := R(A) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_special_set(mrb, bx, regs[a]);\n NEXT;\n }\n\n CASE(OP_GETIV) {\n /* A Bx R(A) := ivget(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_vm_iv_get(mrb, syms[bx]);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETIV) {\n /* A Bx ivset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_iv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETCV) {\n /* A Bx R(A) := cvget(Syms(Bx)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val;\n ERR_PC_SET(mrb, pc);\n val = mrb_vm_cv_get(mrb, syms[bx]);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETCV) {\n /* A Bx cvset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_cv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETCONST) {\n /* A Bx R(A) := constget(Syms(Bx)) */\n mrb_value val;\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_sym sym = syms[bx];\n\n ERR_PC_SET(mrb, pc);\n val = mrb_vm_const_get(mrb, sym);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETCONST) {\n /* A Bx constset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_const_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETMCNST) {\n /* A Bx R(A) := R(A)::Syms(Bx) */\n mrb_value val;\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n\n ERR_PC_SET(mrb, pc);\n val = mrb_const_get(mrb, regs[a], syms[bx]);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETMCNST) {\n /* A Bx R(A+1)::Syms(Bx) := R(A) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_const_set(mrb, regs[a+1], syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETUPVAR) {\n /* A B C R(A) := uvget(B,C) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value *regs_a = regs + a;\n struct REnv *e = uvenv(mrb, c);\n\n if (!e) {\n *regs_a = mrb_nil_value();\n }\n else {\n *regs_a = e->stack[b];\n }\n NEXT;\n }\n\n CASE(OP_SETUPVAR) {\n /* A B C uvset(B,C,R(A)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n\n struct REnv *e = uvenv(mrb, c);\n\n if (e) {\n mrb_value *regs_a = regs + a;\n\n if (b < MRB_ENV_STACK_LEN(e)) {\n e->stack[b] = *regs_a;\n mrb_write_barrier(mrb, (struct RBasic*)e);\n }\n }\n NEXT;\n }\n\n CASE(OP_JMP) {\n /* sBx pc+=sBx */\n int sbx = GETARG_sBx(i);\n pc += sbx;\n JUMP;\n }\n\n CASE(OP_JMPIF) {\n /* A sBx if R(A) pc+=sBx */\n int a = GETARG_A(i);\n int sbx = GETARG_sBx(i);\n if (mrb_test(regs[a])) {\n pc += sbx;\n JUMP;\n }\n NEXT;\n }\n\n CASE(OP_JMPNOT) {\n /* A sBx if !R(A) pc+=sBx */\n int a = GETARG_A(i);\n int sbx = GETARG_sBx(i);\n if (!mrb_test(regs[a])) {\n pc += sbx;\n JUMP;\n }\n NEXT;\n }\n\n CASE(OP_ONERR) {\n /* sBx pc+=sBx on exception */\n int sbx = GETARG_sBx(i);\n if (mrb->c->rsize <= mrb->c->ci->ridx) {\n if (mrb->c->rsize == 0) mrb->c->rsize = RESCUE_STACK_INIT_SIZE;\n else mrb->c->rsize *= 2;\n mrb->c->rescue = (mrb_code **)mrb_realloc(mrb, mrb->c->rescue, sizeof(mrb_code*) * mrb->c->rsize);\n }\n mrb->c->rescue[mrb->c->ci->ridx++] = pc + sbx;\n NEXT;\n }\n\n CASE(OP_RESCUE) {\n /* A B R(A) := exc; clear(exc); R(B) := matched (bool) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value exc;\n\n if (c == 0) {\n exc = mrb_obj_value(mrb->exc);\n mrb->exc = 0;\n }\n else { /* continued; exc taken from R(A) */\n exc = regs[a];\n }\n if (b != 0) {\n mrb_value e = regs[b];\n struct RClass *ec;\n\n switch (mrb_type(e)) {\n case MRB_TT_CLASS:\n case MRB_TT_MODULE:\n break;\n default:\n {\n mrb_value exc;\n\n exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR,\n \"class or module required for rescue clause\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n ec = mrb_class_ptr(e);\n regs[b] = mrb_bool_value(mrb_obj_is_kind_of(mrb, exc, ec));\n }\n if (a != 0 && c == 0) {\n regs[a] = exc;\n }\n NEXT;\n }\n\n CASE(OP_POPERR) {\n /* A A.times{rescue_pop()} */\n int a = GETARG_A(i);\n\n mrb->c->ci->ridx -= a;\n NEXT;\n }\n\n CASE(OP_RAISE) {\n /* A raise(R(A)) */\n int a = GETARG_A(i);\n\n mrb_exc_set(mrb, regs[a]);\n goto L_RAISE;\n }\n\n CASE(OP_EPUSH) {\n /* Bx ensure_push(SEQ[Bx]) */\n int bx = GETARG_Bx(i);\n struct RProc *p;\n\n p = mrb_closure_new(mrb, irep->reps[bx]);\n /* push ensure_stack */\n if (mrb->c->esize <= mrb->c->eidx+1) {\n if (mrb->c->esize == 0) mrb->c->esize = ENSURE_STACK_INIT_SIZE;\n else mrb->c->esize *= 2;\n mrb->c->ensure = (struct RProc **)mrb_realloc(mrb, mrb->c->ensure, sizeof(struct RProc*) * mrb->c->esize);\n }\n mrb->c->ensure[mrb->c->eidx++] = p;\n mrb->c->ensure[mrb->c->eidx] = NULL;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_EPOP) {\n /* A A.times{ensure_pop().call} */\n int a = GETARG_A(i);\n mrb_callinfo *ci = mrb->c->ci;\n int n, epos = ci->epos;\n mrb_value self = regs[0];\n struct RClass *target_class = ci->target_class;\n\n if (mrb->c->eidx <= epos) {\n NEXT;\n }\n\n if (a > mrb->c->eidx - epos)\n a = mrb->c->eidx - epos;\n pc = pc + 1;\n for (n=0; nc->ensure[epos+n];\n mrb->c->ensure[epos+n] = NULL;\n if (proc == NULL) continue;\n irep = proc->body.irep;\n ci = cipush(mrb);\n ci->mid = ci[-1].mid;\n ci->argc = 0;\n ci->proc = proc;\n ci->stackent = mrb->c->stack;\n ci->nregs = irep->nregs;\n ci->target_class = target_class;\n ci->pc = pc;\n ci->acc = ci[-1].nregs;\n mrb->c->stack += ci->acc;\n stack_extend(mrb, ci->nregs);\n regs[0] = self;\n pc = irep->iseq;\n }\n pool = irep->pool;\n syms = irep->syms;\n mrb->c->eidx = epos;\n JUMP;\n }\n\n CASE(OP_LOADNIL) {\n /* A R(A) := nil */\n int a = GETARG_A(i);\n\n SET_NIL_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_SENDB) {\n /* A B C R(A) := call(R(A),Syms(B),R(A+1),...,R(A+C),&R(A+C+1))*/\n /* fall through */\n };\n\n L_SEND:\n CASE(OP_SEND) {\n /* A B C R(A) := call(R(A),Syms(B),R(A+1),...,R(A+C)) */\n int a = GETARG_A(i);\n int n = GETARG_C(i);\n int argc = (n == CALL_MAXARGS) ? -1 : n;\n int bidx = (argc < 0) ? a+2 : a+n+1;\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci = mrb->c->ci;\n mrb_value recv, blk;\n mrb_sym mid = syms[GETARG_B(i)];\n\n mrb_assert(bidx < ci->nregs);\n\n recv = regs[a];\n if (GET_OPCODE(i) != OP_SENDB) {\n SET_NIL_VALUE(regs[bidx]);\n blk = regs[bidx];\n }\n else {\n blk = regs[bidx];\n if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {\n blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, \"Proc\", \"to_proc\");\n /* The stack might have been reallocated during mrb_convert_type(),\n see #3622 */\n regs[bidx] = blk;\n }\n }\n c = mrb_class(mrb, recv);\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m) || (missing == mrb->c->ci->mid && mrb_obj_eq(mrb, regs[0], recv))) {\n mrb_value args = (argc < 0) ? regs[a+1] : mrb_ary_new_from_values(mrb, n, regs+a+1);\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n if (argc >= 0) {\n if (a+2 >= irep->nregs) {\n stack_extend(mrb, a+3);\n }\n regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1);\n regs[a+2] = blk;\n argc = -1;\n }\n mrb_ary_unshift(mrb, regs[a+1], mrb_symbol_value(mid));\n mid = missing;\n }\n\n /* push callinfo */\n ci = cipush(mrb);\n ci->mid = mid;\n ci->stackent = mrb->c->stack;\n ci->target_class = c;\n ci->argc = argc;\n\n ci->pc = pc + 1;\n ci->acc = a;\n\n /* prepare stack */\n mrb->c->stack += a;\n\n if (MRB_METHOD_CFUNC_P(m)) {\n ci->nregs = (argc < 0) ? 3 : n+2;\n if (MRB_METHOD_PROC_P(m)) {\n struct RProc *p = MRB_METHOD_PROC(m);\n\n ci->proc = p;\n recv = p->body.func(mrb, recv);\n }\n else {\n recv = MRB_METHOD_FUNC(m)(mrb, recv);\n }\n mrb_gc_arena_restore(mrb, ai);\n mrb_gc_arena_shrink(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n ci = mrb->c->ci;\n if (GET_OPCODE(i) == OP_SENDB) {\n if (mrb_type(blk) == MRB_TT_PROC) {\n struct RProc *p = mrb_proc_ptr(blk);\n if (p && !MRB_PROC_STRICT_P(p) && MRB_PROC_ENV(p) == ci[-1].env) {\n p->flags |= MRB_PROC_ORPHAN;\n }\n }\n }\n if (!ci->target_class) { /* return from context modifying method (resume/yield) */\n if (ci->acc == CI_ACC_RESUMED) {\n mrb->jmp = prev_jmp;\n return recv;\n }\n else {\n mrb_assert(!MRB_PROC_CFUNC_P(ci[-1].proc));\n proc = ci[-1].proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n }\n }\n mrb->c->stack[0] = recv;\n /* pop stackpos */\n mrb->c->stack = ci->stackent;\n pc = ci->pc;\n cipop(mrb);\n JUMP;\n }\n else {\n /* setup environment for calling method */\n proc = ci->proc = MRB_METHOD_PROC(m);\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, (argc < 0 && ci->nregs < 3) ? 3 : ci->nregs);\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_FSEND) {\n /* A B C R(A) := fcall(R(A),Syms(B),R(A+1),... ,R(A+C-1)) */\n /* not implemented yet */\n NEXT;\n }\n\n CASE(OP_CALL) {\n /* A R(A) := self.call(frame.argc, frame.argv) */\n mrb_callinfo *ci;\n mrb_value recv = mrb->c->stack[0];\n struct RProc *m = mrb_proc_ptr(recv);\n\n /* replace callinfo */\n ci = mrb->c->ci;\n ci->target_class = MRB_PROC_TARGET_CLASS(m);\n ci->proc = m;\n if (MRB_PROC_ENV_P(m)) {\n mrb_sym mid;\n struct REnv *e = MRB_PROC_ENV(m);\n\n mid = e->mid;\n if (mid) ci->mid = mid;\n if (!e->stack) {\n e->stack = mrb->c->stack;\n }\n }\n\n /* prepare stack */\n if (MRB_PROC_CFUNC_P(m)) {\n recv = MRB_PROC_CFUNC(m)(mrb, recv);\n mrb_gc_arena_restore(mrb, ai);\n mrb_gc_arena_shrink(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n /* pop stackpos */\n ci = mrb->c->ci;\n mrb->c->stack = ci->stackent;\n regs[ci->acc] = recv;\n pc = ci->pc;\n cipop(mrb);\n irep = mrb->c->ci->proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n JUMP;\n }\n else {\n /* setup environment for calling method */\n proc = m;\n irep = m->body.irep;\n if (!irep) {\n mrb->c->stack[0] = mrb_nil_value();\n goto L_RETURN;\n }\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, ci->nregs);\n if (ci->argc < 0) {\n if (irep->nregs > 3) {\n stack_clear(regs+3, irep->nregs-3);\n }\n }\n else if (ci->argc+2 < irep->nregs) {\n stack_clear(regs+ci->argc+2, irep->nregs-ci->argc-2);\n }\n if (MRB_PROC_ENV_P(m)) {\n regs[0] = MRB_PROC_ENV(m)->stack[0];\n }\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_SUPER) {\n /* A C R(A) := super(R(A+1),... ,R(A+C+1)) */\n int a = GETARG_A(i);\n int n = GETARG_C(i);\n int argc = (n == CALL_MAXARGS) ? -1 : n;\n int bidx = (argc < 0) ? a+2 : a+n+1;\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci = mrb->c->ci;\n mrb_value recv, blk;\n mrb_sym mid = ci->mid;\n struct RClass* target_class = MRB_PROC_TARGET_CLASS(ci->proc);\n\n mrb_assert(bidx < ci->nregs);\n\n if (mid == 0 || !target_class) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, \"super called outside of method\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (target_class->tt == MRB_TT_MODULE) {\n target_class = ci->target_class;\n if (target_class->tt != MRB_TT_ICLASS) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_RUNTIME_ERROR, \"superclass info lost [mruby limitations]\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n recv = regs[0];\n if (!mrb_obj_is_kind_of(mrb, recv, target_class)) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR,\n \"self has wrong type to call super in this context\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n blk = regs[bidx];\n if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {\n blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, \"Proc\", \"to_proc\");\n /* The stack or ci stack might have been reallocated during\n mrb_convert_type(), see #3622 and #3784 */\n regs[bidx] = blk;\n ci = mrb->c->ci;\n }\n c = target_class->super;\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n\n if (mid != missing) {\n c = mrb_class(mrb, recv);\n }\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value args = (argc < 0) ? regs[a+1] : mrb_ary_new_from_values(mrb, n, regs+a+1);\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n mid = missing;\n if (argc >= 0) {\n if (a+2 >= ci->nregs) {\n stack_extend(mrb, a+3);\n }\n regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1);\n regs[a+2] = blk;\n argc = -1;\n }\n mrb_ary_unshift(mrb, regs[a+1], mrb_symbol_value(ci->mid));\n }\n\n /* push callinfo */\n ci = cipush(mrb);\n ci->mid = mid;\n ci->stackent = mrb->c->stack;\n ci->target_class = c;\n ci->pc = pc + 1;\n ci->argc = argc;\n\n /* prepare stack */\n mrb->c->stack += a;\n mrb->c->stack[0] = recv;\n\n if (MRB_METHOD_CFUNC_P(m)) {\n mrb_value v;\n ci->nregs = (argc < 0) ? 3 : n+2;\n if (MRB_METHOD_PROC_P(m)) {\n ci->proc = MRB_METHOD_PROC(m);\n }\n v = MRB_METHOD_CFUNC(m)(mrb, recv);\n mrb_gc_arena_restore(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n ci = mrb->c->ci;\n if (!ci->target_class) { /* return from context modifying method (resume/yield) */\n if (ci->acc == CI_ACC_RESUMED) {\n mrb->jmp = prev_jmp;\n return v;\n }\n else {\n mrb_assert(!MRB_PROC_CFUNC_P(ci[-1].proc));\n proc = ci[-1].proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n }\n }\n mrb->c->stack[0] = v;\n /* pop stackpos */\n mrb->c->stack = ci->stackent;\n pc = ci->pc;\n cipop(mrb);\n JUMP;\n }\n else {\n /* fill callinfo */\n ci->acc = a;\n\n /* setup environment for calling method */\n proc = ci->proc = MRB_METHOD_PROC(m);\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, (argc < 0 && ci->nregs < 3) ? 3 : ci->nregs);\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_ARGARY) {\n /* A Bx R(A) := argument array (16=6:1:5:4) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n int m1 = (bx>>10)&0x3f;\n int r = (bx>>9)&0x1;\n int m2 = (bx>>4)&0x1f;\n int lv = (bx>>0)&0xf;\n mrb_value *stack;\n\n if (mrb->c->ci->mid == 0 || mrb->c->ci->target_class == NULL) {\n mrb_value exc;\n\n L_NOSUPER:\n exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, \"super called outside of method\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (lv == 0) stack = regs + 1;\n else {\n struct REnv *e = uvenv(mrb, lv-1);\n if (!e) goto L_NOSUPER;\n if (MRB_ENV_STACK_LEN(e) <= m1+r+m2+1)\n goto L_NOSUPER;\n stack = e->stack + 1;\n }\n if (r == 0) {\n regs[a] = mrb_ary_new_from_values(mrb, m1+m2, stack);\n }\n else {\n mrb_value *pp = NULL;\n struct RArray *rest;\n int len = 0;\n\n if (mrb_array_p(stack[m1])) {\n struct RArray *ary = mrb_ary_ptr(stack[m1]);\n\n pp = ARY_PTR(ary);\n len = (int)ARY_LEN(ary);\n }\n regs[a] = mrb_ary_new_capa(mrb, m1+len+m2);\n rest = mrb_ary_ptr(regs[a]);\n if (m1 > 0) {\n stack_copy(ARY_PTR(rest), stack, m1);\n }\n if (len > 0) {\n stack_copy(ARY_PTR(rest)+m1, pp, len);\n }\n if (m2 > 0) {\n stack_copy(ARY_PTR(rest)+m1+len, stack+m1+1, m2);\n }\n ARY_SET_LEN(rest, m1+len+m2);\n }\n regs[a+1] = stack[m1+r+m2];\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ENTER) {\n /* Ax arg setup according to flags (23=5:5:1:5:5:1:1) */\n /* number of optional arguments times OP_JMP should follow */\n mrb_aspec ax = GETARG_Ax(i);\n int m1 = MRB_ASPEC_REQ(ax);\n int o = MRB_ASPEC_OPT(ax);\n int r = MRB_ASPEC_REST(ax);\n int m2 = MRB_ASPEC_POST(ax);\n /* unused\n int k = MRB_ASPEC_KEY(ax);\n int kd = MRB_ASPEC_KDICT(ax);\n int b = MRB_ASPEC_BLOCK(ax);\n */\n int argc = mrb->c->ci->argc;\n mrb_value *argv = regs+1;\n mrb_value *argv0 = argv;\n int len = m1 + o + r + m2;\n mrb_value *blk = &argv[argc < 0 ? 1 : argc];\n\n if (argc < 0) {\n struct RArray *ary = mrb_ary_ptr(regs[1]);\n argv = ARY_PTR(ary);\n argc = (int)ARY_LEN(ary);\n mrb_gc_protect(mrb, regs[1]);\n }\n if (mrb->c->ci->proc && MRB_PROC_STRICT_P(mrb->c->ci->proc)) {\n if (argc >= 0) {\n if (argc < m1 + m2 || (r == 0 && argc > len)) {\n argnum_error(mrb, m1+m2);\n goto L_RAISE;\n }\n }\n }\n else if (len > 1 && argc == 1 && mrb_array_p(argv[0])) {\n mrb_gc_protect(mrb, argv[0]);\n argc = (int)RARRAY_LEN(argv[0]);\n argv = RARRAY_PTR(argv[0]);\n }\n if (argc < len) {\n int mlen = m2;\n if (argc < m1+m2) {\n if (m1 < argc)\n mlen = argc - m1;\n else\n mlen = 0;\n }\n regs[len+1] = *blk; /* move block */\n SET_NIL_VALUE(regs[argc+1]);\n if (argv0 != argv) {\n value_move(®s[1], argv, argc-mlen); /* m1 + o */\n }\n if (argc < m1) {\n stack_clear(®s[argc+1], m1-argc);\n }\n if (mlen) {\n value_move(®s[len-m2+1], &argv[argc-mlen], mlen);\n }\n if (mlen < m2) {\n stack_clear(®s[len-m2+mlen+1], m2-mlen);\n }\n if (r) {\n regs[m1+o+1] = mrb_ary_new_capa(mrb, 0);\n }\n if (o == 0 || argc < m1+m2) pc++;\n else\n pc += argc - m1 - m2 + 1;\n }\n else {\n int rnum = 0;\n if (argv0 != argv) {\n regs[len+1] = *blk; /* move block */\n value_move(®s[1], argv, m1+o);\n }\n if (r) {\n rnum = argc-m1-o-m2;\n regs[m1+o+1] = mrb_ary_new_from_values(mrb, rnum, argv+m1+o);\n }\n if (m2) {\n if (argc-m2 > m1) {\n value_move(®s[m1+o+r+1], &argv[m1+o+rnum], m2);\n }\n }\n if (argv0 == argv) {\n regs[len+1] = *blk; /* move block */\n }\n pc += o + 1;\n }\n mrb->c->ci->argc = len;\n /* clear local (but non-argument) variables */\n if (irep->nlocals-len-2 > 0) {\n stack_clear(®s[len+2], irep->nlocals-len-2);\n }\n JUMP;\n }\n\n CASE(OP_KARG) {\n /* A B C R(A) := kdict[Syms(B)]; if C kdict.rm(Syms(B)) */\n /* if C == 2; raise unless kdict.empty? */\n /* OP_JMP should follow to skip init code */\n NEXT;\n }\n\n CASE(OP_KDICT) {\n /* A C R(A) := kdict */\n NEXT;\n }\n\n L_RETURN:\n i = MKOP_AB(OP_RETURN, GETARG_A(i), OP_R_NORMAL);\n /* fall through */\n CASE(OP_RETURN) {\n /* A B return R(A) (B=normal,in-block return/break) */\n mrb_callinfo *ci;\n\n#define ecall_adjust() do {\\\n ptrdiff_t cioff = ci - mrb->c->cibase;\\\n ecall(mrb);\\\n ci = mrb->c->cibase + cioff;\\\n} while (0)\n\n ci = mrb->c->ci;\n if (ci->mid) {\n mrb_value blk;\n\n if (ci->argc < 0) {\n blk = regs[2];\n }\n else {\n blk = regs[ci->argc+1];\n }\n if (mrb_type(blk) == MRB_TT_PROC) {\n struct RProc *p = mrb_proc_ptr(blk);\n\n if (!MRB_PROC_STRICT_P(p) &&\n ci > mrb->c->cibase && MRB_PROC_ENV(p) == ci[-1].env) {\n p->flags |= MRB_PROC_ORPHAN;\n }\n }\n }\n\n if (mrb->exc) {\n mrb_callinfo *ci0;\n\n L_RAISE:\n ci0 = ci = mrb->c->ci;\n if (ci == mrb->c->cibase) {\n if (ci->ridx == 0) goto L_FTOP;\n goto L_RESCUE;\n }\n while (ci[0].ridx == ci[-1].ridx) {\n cipop(mrb);\n mrb->c->stack = ci->stackent;\n if (ci->acc == CI_ACC_SKIP && prev_jmp) {\n mrb->jmp = prev_jmp;\n MRB_THROW(prev_jmp);\n }\n ci = mrb->c->ci;\n if (ci == mrb->c->cibase) {\n if (ci->ridx == 0) {\n L_FTOP: /* fiber top */\n if (mrb->c == mrb->root_c) {\n mrb->c->stack = mrb->c->stbase;\n goto L_STOP;\n }\n else {\n struct mrb_context *c = mrb->c;\n\n while (c->eidx > ci->epos) {\n ecall_adjust();\n }\n if (c->fib) {\n mrb_write_barrier(mrb, (struct RBasic*)c->fib);\n }\n mrb->c->status = MRB_FIBER_TERMINATED;\n mrb->c = c->prev;\n c->prev = NULL;\n goto L_RAISE;\n }\n }\n break;\n }\n /* call ensure only when we skip this callinfo */\n if (ci[0].ridx == ci[-1].ridx) {\n while (mrb->c->eidx > ci->epos) {\n ecall_adjust();\n }\n }\n }\n L_RESCUE:\n if (ci->ridx == 0) goto L_STOP;\n proc = ci->proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n if (ci < ci0) {\n mrb->c->stack = ci[1].stackent;\n }\n stack_extend(mrb, irep->nregs);\n pc = mrb->c->rescue[--ci->ridx];\n }\n else {\n int acc;\n mrb_value v;\n struct RProc *dst;\n\n ci = mrb->c->ci;\n v = regs[GETARG_A(i)];\n mrb_gc_protect(mrb, v);\n switch (GETARG_B(i)) {\n case OP_R_RETURN:\n /* Fall through to OP_R_NORMAL otherwise */\n if (ci->acc >=0 && MRB_PROC_ENV_P(proc) && !MRB_PROC_STRICT_P(proc)) {\n mrb_callinfo *cibase = mrb->c->cibase;\n dst = top_proc(mrb, proc);\n\n if (MRB_PROC_ENV_P(dst)) {\n struct REnv *e = MRB_PROC_ENV(dst);\n\n if (!MRB_ENV_STACK_SHARED_P(e) || e->cxt != mrb->c) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n }\n while (cibase <= ci && ci->proc != dst) {\n if (ci->acc < 0) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n ci--;\n }\n if (ci <= cibase) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n break;\n }\n case OP_R_NORMAL:\n NORMAL_RETURN:\n if (ci == mrb->c->cibase) {\n struct mrb_context *c;\n\n if (!mrb->c->prev) { /* toplevel return */\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n if (mrb->c->prev->ci == mrb->c->prev->cibase) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_FIBER_ERROR, \"double resume\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n while (mrb->c->eidx > 0) {\n ecall(mrb);\n }\n /* automatic yield at the end */\n c = mrb->c;\n c->status = MRB_FIBER_TERMINATED;\n mrb->c = c->prev;\n c->prev = NULL;\n mrb->c->status = MRB_FIBER_RUNNING;\n ci = mrb->c->ci;\n }\n break;\n case OP_R_BREAK:\n if (MRB_PROC_STRICT_P(proc)) goto NORMAL_RETURN;\n if (MRB_PROC_ORPHAN_P(proc)) { \n mrb_value exc;\n\n L_BREAK_ERROR:\n exc = mrb_exc_new_str_lit(mrb, E_LOCALJUMP_ERROR,\n \"break from proc-closure\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (!MRB_PROC_ENV_P(proc) || !MRB_ENV_STACK_SHARED_P(MRB_PROC_ENV(proc))) {\n goto L_BREAK_ERROR;\n }\n else {\n struct REnv *e = MRB_PROC_ENV(proc);\n\n if (e == mrb->c->cibase->env && proc != mrb->c->cibase->proc) {\n goto L_BREAK_ERROR;\n }\n if (e->cxt != mrb->c) {\n goto L_BREAK_ERROR;\n }\n }\n while (mrb->c->eidx > mrb->c->ci->epos) {\n ecall_adjust();\n }\n /* break from fiber block */\n if (ci == mrb->c->cibase && ci->pc) {\n struct mrb_context *c = mrb->c;\n\n mrb->c = c->prev;\n c->prev = NULL;\n ci = mrb->c->ci;\n }\n if (ci->acc < 0) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->c->vmexec = FALSE;\n mrb->exc = (struct RObject*)break_new(mrb, proc, v);\n mrb->jmp = prev_jmp;\n MRB_THROW(prev_jmp);\n }\n if (FALSE) {\n L_BREAK:\n v = ((struct RBreak*)mrb->exc)->val;\n proc = ((struct RBreak*)mrb->exc)->proc;\n mrb->exc = NULL;\n ci = mrb->c->ci;\n }\n mrb->c->stack = ci->stackent;\n proc = proc->upper;\n while (mrb->c->cibase < ci && ci[-1].proc != proc) {\n if (ci[-1].acc == CI_ACC_SKIP) {\n while (ci < mrb->c->ci) {\n cipop(mrb);\n }\n goto L_BREAK_ERROR;\n }\n ci--;\n }\n if (ci == mrb->c->cibase) {\n goto L_BREAK_ERROR;\n }\n break;\n default:\n /* cannot happen */\n break;\n }\n while (ci < mrb->c->ci) {\n cipop(mrb);\n }\n ci[0].ridx = ci[-1].ridx;\n while (mrb->c->eidx > ci->epos) {\n ecall_adjust();\n }\n if (mrb->c->vmexec && !ci->target_class) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->c->vmexec = FALSE;\n mrb->jmp = prev_jmp;\n return v;\n }\n acc = ci->acc;\n mrb->c->stack = ci->stackent;\n cipop(mrb);\n if (acc == CI_ACC_SKIP || acc == CI_ACC_DIRECT) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->jmp = prev_jmp;\n return v;\n }\n pc = ci->pc;\n ci = mrb->c->ci;\n DEBUG(fprintf(stderr, \"from :%s\\n\", mrb_sym2name(mrb, ci->mid)));\n proc = mrb->c->ci->proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n\n regs[acc] = v;\n mrb_gc_arena_restore(mrb, ai);\n }\n JUMP;\n }\n\n CASE(OP_TAILCALL) {\n /* A B C return call(R(A),Syms(B),R(A+1),... ,R(A+C+1)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int n = GETARG_C(i);\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci;\n mrb_value recv;\n mrb_sym mid = syms[b];\n\n recv = regs[a];\n c = mrb_class(mrb, recv);\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value sym = mrb_symbol_value(mid);\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value args;\n\n if (n == CALL_MAXARGS) {\n args = regs[a+1];\n }\n else {\n args = mrb_ary_new_from_values(mrb, n, regs+a+1);\n }\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n mid = missing;\n if (n == CALL_MAXARGS) {\n mrb_ary_unshift(mrb, regs[a+1], sym);\n }\n else {\n value_move(regs+a+2, regs+a+1, ++n);\n regs[a+1] = sym;\n }\n }\n\n /* replace callinfo */\n ci = mrb->c->ci;\n ci->mid = mid;\n ci->target_class = c;\n if (n == CALL_MAXARGS) {\n ci->argc = -1;\n }\n else {\n ci->argc = n;\n }\n\n /* move stack */\n value_move(mrb->c->stack, ®s[a], ci->argc+1);\n\n if (MRB_METHOD_CFUNC_P(m)) {\n mrb_value v = MRB_METHOD_CFUNC(m)(mrb, recv);\n mrb->c->stack[0] = v;\n mrb_gc_arena_restore(mrb, ai);\n goto L_RETURN;\n }\n else {\n /* setup environment for calling method */\n struct RProc *p = MRB_METHOD_PROC(m);\n irep = p->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n if (ci->argc < 0) {\n stack_extend(mrb, (irep->nregs < 3) ? 3 : irep->nregs);\n }\n else {\n stack_extend(mrb, irep->nregs);\n }\n pc = irep->iseq;\n }\n JUMP;\n }\n\n CASE(OP_BLKPUSH) {\n /* A Bx R(A) := block (16=6:1:5:4) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n int m1 = (bx>>10)&0x3f;\n int r = (bx>>9)&0x1;\n int m2 = (bx>>4)&0x1f;\n int lv = (bx>>0)&0xf;\n mrb_value *stack;\n\n if (lv == 0) stack = regs + 1;\n else {\n struct REnv *e = uvenv(mrb, lv-1);\n if (!e || (!MRB_ENV_STACK_SHARED_P(e) && e->mid == 0) ||\n MRB_ENV_STACK_LEN(e) <= m1+r+m2+1) {\n localjump_error(mrb, LOCALJUMP_ERROR_YIELD);\n goto L_RAISE;\n }\n stack = e->stack + 1;\n }\n if (mrb_nil_p(stack[m1+r+m2])) {\n localjump_error(mrb, LOCALJUMP_ERROR_YIELD);\n goto L_RAISE;\n }\n regs[a] = stack[m1+r+m2];\n NEXT;\n }\n\n#define TYPES2(a,b) ((((uint16_t)(a))<<8)|(((uint16_t)(b))&0xff))\n#define OP_MATH_BODY(op,v1,v2) do {\\\n v1(regs[a]) = v1(regs[a]) op v2(regs[a+1]);\\\n} while(0)\n\n CASE(OP_ADD) {\n /* A B C R(A) := R(A)+R(A+1) (Syms[B]=:+,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n mrb_value *regs_a = regs + a;\n\n x = mrb_fixnum(regs_a[0]);\n y = mrb_fixnum(regs_a[1]);\n if (mrb_int_add_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs_a[0], (mrb_float)x + (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x + y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x + y);\n }\n#else\n OP_MATH_BODY(+,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x + y);\n }\n#else\n OP_MATH_BODY(+,mrb_float,mrb_float);\n#endif\n break;\n#endif\n case TYPES2(MRB_TT_STRING,MRB_TT_STRING):\n regs[a] = mrb_str_plus(mrb, regs[a], regs[a+1]);\n break;\n default:\n goto L_SEND;\n }\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_SUB) {\n /* A B C R(A) := R(A)-R(A+1) (Syms[B]=:-,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n\n x = mrb_fixnum(regs[a]);\n y = mrb_fixnum(regs[a+1]);\n if (mrb_int_sub_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x - y);\n }\n#else\n OP_MATH_BODY(-,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x - y);\n }\n#else\n OP_MATH_BODY(-,mrb_float,mrb_float);\n#endif\n break;\n#endif\n default:\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_MUL) {\n /* A B C R(A) := R(A)*R(A+1) (Syms[B]=:*,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n\n x = mrb_fixnum(regs[a]);\n y = mrb_fixnum(regs[a+1]);\n if (mrb_int_mul_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x * (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x * y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x * y);\n }\n#else\n OP_MATH_BODY(*,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x * y);\n }\n#else\n OP_MATH_BODY(*,mrb_float,mrb_float);\n#endif\n break;\n#endif\n default:\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_DIV) {\n /* A B C R(A) := R(A)/R(A+1) (Syms[B]=:/,C=1)*/\n int a = GETARG_A(i);\n#ifndef MRB_WITHOUT_FLOAT\n double x, y, f;\n#endif\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n#ifdef MRB_WITHOUT_FLOAT\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_INT_VALUE(regs[a], y ? x / y : 0);\n }\n break;\n#else\n x = (mrb_float)mrb_fixnum(regs[a]);\n y = (mrb_float)mrb_fixnum(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n x = (mrb_float)mrb_fixnum(regs[a]);\n y = mrb_float(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n x = mrb_float(regs[a]);\n y = (mrb_float)mrb_fixnum(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n x = mrb_float(regs[a]);\n y = mrb_float(regs[a+1]);\n break;\n#endif\n default:\n goto L_SEND;\n }\n\n#ifndef MRB_WITHOUT_FLOAT\n if (y == 0) {\n if (x > 0) f = INFINITY;\n else if (x < 0) f = -INFINITY;\n else /* if (x == 0) */ f = NAN;\n }\n else {\n f = x / y;\n }\n SET_FLOAT_VALUE(mrb, regs[a], f);\n#endif\n NEXT;\n }\n\n CASE(OP_ADDI) {\n /* A B C R(A) := R(A)+C (Syms[B]=:+)*/\n int a = GETARG_A(i);\n\n /* need to check if + is overridden */\n switch (mrb_type(regs[a])) {\n case MRB_TT_FIXNUM:\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_int y = GETARG_C(i);\n mrb_int z;\n\n if (mrb_int_add_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x + (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case MRB_TT_FLOAT:\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n SET_FLOAT_VALUE(mrb, regs[a], x + GETARG_C(i));\n }\n#else\n mrb_float(regs[a]) += GETARG_C(i);\n#endif\n break;\n#endif\n default:\n SET_INT_VALUE(regs[a+1], GETARG_C(i));\n i = MKOP_ABC(OP_SEND, a, GETARG_B(i), 1);\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_SUBI) {\n /* A B C R(A) := R(A)-C (Syms[B]=:-)*/\n int a = GETARG_A(i);\n mrb_value *regs_a = regs + a;\n\n /* need to check if + is overridden */\n switch (mrb_type(regs_a[0])) {\n case MRB_TT_FIXNUM:\n {\n mrb_int x = mrb_fixnum(regs_a[0]);\n mrb_int y = GETARG_C(i);\n mrb_int z;\n\n if (mrb_int_sub_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs_a[0], (mrb_float)x - (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs_a[0], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case MRB_TT_FLOAT:\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n SET_FLOAT_VALUE(mrb, regs[a], x - GETARG_C(i));\n }\n#else\n mrb_float(regs_a[0]) -= GETARG_C(i);\n#endif\n break;\n#endif\n default:\n SET_INT_VALUE(regs_a[1], GETARG_C(i));\n i = MKOP_ABC(OP_SEND, a, GETARG_B(i), 1);\n goto L_SEND;\n }\n NEXT;\n }\n\n#define OP_CMP_BODY(op,v1,v2) (v1(regs[a]) op v2(regs[a+1]))\n\n#ifdef MRB_WITHOUT_FLOAT\n#define OP_CMP(op) do {\\\n int result;\\\n /* need to check if - is overridden */\\\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_fixnum);\\\n break;\\\n default:\\\n goto L_SEND;\\\n }\\\n if (result) {\\\n SET_TRUE_VALUE(regs[a]);\\\n }\\\n else {\\\n SET_FALSE_VALUE(regs[a]);\\\n }\\\n} while(0)\n#else\n#define OP_CMP(op) do {\\\n int result;\\\n /* need to check if - is overridden */\\\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_fixnum);\\\n break;\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_float);\\\n break;\\\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_float,mrb_fixnum);\\\n break;\\\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\\\n result = OP_CMP_BODY(op,mrb_float,mrb_float);\\\n break;\\\n default:\\\n goto L_SEND;\\\n }\\\n if (result) {\\\n SET_TRUE_VALUE(regs[a]);\\\n }\\\n else {\\\n SET_FALSE_VALUE(regs[a]);\\\n }\\\n} while(0)\n#endif\n\n CASE(OP_EQ) {\n /* A B C R(A) := R(A)==R(A+1) (Syms[B]=:==,C=1)*/\n int a = GETARG_A(i);\n if (mrb_obj_eq(mrb, regs[a], regs[a+1])) {\n SET_TRUE_VALUE(regs[a]);\n }\n else {\n OP_CMP(==);\n }\n NEXT;\n }\n\n CASE(OP_LT) {\n /* A B C R(A) := R(A)R(A+1) (Syms[B]=:>,C=1)*/\n int a = GETARG_A(i);\n OP_CMP(>);\n NEXT;\n }\n\n CASE(OP_GE) {\n /* A B C R(A) := R(A)>=R(A+1) (Syms[B]=:>=,C=1)*/\n int a = GETARG_A(i);\n OP_CMP(>=);\n NEXT;\n }\n\n CASE(OP_ARRAY) {\n /* A B C R(A) := ary_new(R(B),R(B+1)..R(B+C)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value v = mrb_ary_new_from_values(mrb, c, ®s[b]);\n regs[a] = v;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ARYCAT) {\n /* A B mrb_ary_concat(R(A),R(B)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n mrb_value splat = mrb_ary_splat(mrb, regs[b]);\n mrb_ary_concat(mrb, regs[a], splat);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ARYPUSH) {\n /* A B R(A).push(R(B)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n mrb_ary_push(mrb, regs[a], regs[b]);\n NEXT;\n }\n\n CASE(OP_AREF) {\n /* A B C R(A) := R(B)[C] */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value v = regs[b];\n\n if (!mrb_array_p(v)) {\n if (c == 0) {\n regs[a] = v;\n }\n else {\n SET_NIL_VALUE(regs[a]);\n }\n }\n else {\n v = mrb_ary_ref(mrb, v, c);\n regs[a] = v;\n }\n NEXT;\n }\n\n CASE(OP_ASET) {\n /* A B C R(B)[C] := R(A) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_ary_set(mrb, regs[b], c, regs[a]);\n NEXT;\n }\n\n CASE(OP_APOST) {\n /* A B C *R(A),R(A+1)..R(A+C) := R(A) */\n int a = GETARG_A(i);\n mrb_value v = regs[a];\n int pre = GETARG_B(i);\n int post = GETARG_C(i);\n struct RArray *ary;\n int len, idx;\n\n if (!mrb_array_p(v)) {\n v = mrb_ary_new_from_values(mrb, 1, ®s[a]);\n }\n ary = mrb_ary_ptr(v);\n len = (int)ARY_LEN(ary);\n if (len > pre + post) {\n v = mrb_ary_new_from_values(mrb, len - pre - post, ARY_PTR(ary)+pre);\n regs[a++] = v;\n while (post--) {\n regs[a++] = ARY_PTR(ary)[len-post-1];\n }\n }\n else {\n v = mrb_ary_new_capa(mrb, 0);\n regs[a++] = v;\n for (idx=0; idx+prereps[b];\n\n if (c & OP_L_CAPTURE) {\n p = mrb_closure_new(mrb, nirep);\n }\n else {\n p = mrb_proc_new(mrb, nirep);\n p->flags |= MRB_PROC_SCOPE;\n }\n if (c & OP_L_STRICT) p->flags |= MRB_PROC_STRICT;\n regs[a] = mrb_obj_value(p);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_OCLASS) {\n /* A R(A) := ::Object */\n regs[GETARG_A(i)] = mrb_obj_value(mrb->object_class);\n NEXT;\n }\n\n CASE(OP_CLASS) {\n /* A B R(A) := newclass(R(A),Syms(B),R(A+1)) */\n struct RClass *c = 0, *baseclass;\n int a = GETARG_A(i);\n mrb_value base, super;\n mrb_sym id = syms[GETARG_B(i)];\n\n base = regs[a];\n super = regs[a+1];\n if (mrb_nil_p(base)) {\n baseclass = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc);\n base = mrb_obj_value(baseclass);\n }\n c = mrb_vm_define_class(mrb, base, super, id);\n regs[a] = mrb_obj_value(c);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_MODULE) {\n /* A B R(A) := newmodule(R(A),Syms(B)) */\n struct RClass *c = 0, *baseclass;\n int a = GETARG_A(i);\n mrb_value base;\n mrb_sym id = syms[GETARG_B(i)];\n\n base = regs[a];\n if (mrb_nil_p(base)) {\n baseclass = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc);\n base = mrb_obj_value(baseclass);\n }\n c = mrb_vm_define_module(mrb, base, id);\n regs[a] = mrb_obj_value(c);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_EXEC) {\n /* A Bx R(A) := blockexec(R(A),SEQ[Bx]) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_callinfo *ci;\n mrb_value recv = regs[a];\n struct RProc *p;\n mrb_irep *nirep = irep->reps[bx];\n\n /* prepare closure */\n p = mrb_proc_new(mrb, nirep);\n p->c = NULL;\n mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)proc);\n MRB_PROC_SET_TARGET_CLASS(p, mrb_class_ptr(recv));\n p->flags |= MRB_PROC_SCOPE;\n\n /* prepare call stack */\n ci = cipush(mrb);\n ci->pc = pc + 1;\n ci->acc = a;\n ci->mid = 0;\n ci->stackent = mrb->c->stack;\n ci->argc = 0;\n ci->target_class = mrb_class_ptr(recv);\n\n /* prepare stack */\n mrb->c->stack += a;\n\n /* setup block to call */\n ci->proc = p;\n\n irep = p->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, ci->nregs);\n stack_clear(regs+1, ci->nregs-1);\n pc = irep->iseq;\n JUMP;\n }\n\n CASE(OP_METHOD) {\n /* A B R(A).newmethod(Syms(B),R(A+1)) */\n int a = GETARG_A(i);\n struct RClass *c = mrb_class_ptr(regs[a]);\n struct RProc *p = mrb_proc_ptr(regs[a+1]);\n mrb_method_t m;\n\n MRB_METHOD_FROM_PROC(m, p);\n mrb_define_method_raw(mrb, c, syms[GETARG_B(i)], m);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_SCLASS) {\n /* A B R(A) := R(B).singleton_class */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n\n regs[a] = mrb_singleton_class(mrb, regs[b]);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_TCLASS) {\n /* A R(A) := target_class */\n if (!mrb->c->ci->target_class) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR, \"no target class or module\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n regs[GETARG_A(i)] = mrb_obj_value(mrb->c->ci->target_class);\n NEXT;\n }\n\n CASE(OP_RANGE) {\n /* A B C R(A) := range_new(R(B),R(B+1),C) */\n int b = GETARG_B(i);\n mrb_value val = mrb_range_new(mrb, regs[b], regs[b+1], GETARG_C(i));\n regs[GETARG_A(i)] = val;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_DEBUG) {\n /* A B C debug print R(A),R(B),R(C) */\n#ifdef MRB_ENABLE_DEBUG_HOOK\n mrb->debug_op_hook(mrb, irep, pc, regs);\n#else\n#ifndef MRB_DISABLE_STDIO\n printf(\"OP_DEBUG %d %d %d\\n\", GETARG_A(i), GETARG_B(i), GETARG_C(i));\n#else\n abort();\n#endif\n#endif\n NEXT;\n }\n\n CASE(OP_STOP) {\n /* stop VM */\n L_STOP:\n while (mrb->c->eidx > 0) {\n ecall(mrb);\n }\n ERR_PC_CLR(mrb);\n mrb->jmp = prev_jmp;\n if (mrb->exc) {\n return mrb_obj_value(mrb->exc);\n }\n return regs[irep->nlocals];\n }\n\n CASE(OP_ERR) {\n /* Bx raise RuntimeError with message Lit(Bx) */\n mrb_value msg = mrb_str_dup(mrb, pool[GETARG_Bx(i)]);\n mrb_value exc;\n\n if (GETARG_A(i) == 0) {\n exc = mrb_exc_new_str(mrb, E_RUNTIME_ERROR, msg);\n }\n else {\n exc = mrb_exc_new_str(mrb, E_LOCALJUMP_ERROR, msg);\n }\n ERR_PC_SET(mrb, pc);\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n END_DISPATCH;\n#undef regs\n\n }\n MRB_CATCH(&c_jmp) {\n exc_catched = TRUE;\n goto RETRY_TRY_BLOCK;\n }\n MRB_END_EXC(&c_jmp);\n}","target":"mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)\n{\n /* mrb_assert(mrb_proc_cfunc_p(proc)) */\n mrb_irep *irep = proc->body.irep;\n mrb_value *pool = irep->pool;\n mrb_sym *syms = irep->syms;\n mrb_code i;\n int ai = mrb_gc_arena_save(mrb);\n struct mrb_jmpbuf *prev_jmp = mrb->jmp;\n struct mrb_jmpbuf c_jmp;\n\n#ifdef DIRECT_THREADED\n static void *optable[] = {\n &&L_OP_NOP, &&L_OP_MOVE,\n &&L_OP_LOADL, &&L_OP_LOADI, &&L_OP_LOADSYM, &&L_OP_LOADNIL,\n &&L_OP_LOADSELF, &&L_OP_LOADT, &&L_OP_LOADF,\n &&L_OP_GETGLOBAL, &&L_OP_SETGLOBAL, &&L_OP_GETSPECIAL, &&L_OP_SETSPECIAL,\n &&L_OP_GETIV, &&L_OP_SETIV, &&L_OP_GETCV, &&L_OP_SETCV,\n &&L_OP_GETCONST, &&L_OP_SETCONST, &&L_OP_GETMCNST, &&L_OP_SETMCNST,\n &&L_OP_GETUPVAR, &&L_OP_SETUPVAR,\n &&L_OP_JMP, &&L_OP_JMPIF, &&L_OP_JMPNOT,\n &&L_OP_ONERR, &&L_OP_RESCUE, &&L_OP_POPERR, &&L_OP_RAISE, &&L_OP_EPUSH, &&L_OP_EPOP,\n &&L_OP_SEND, &&L_OP_SENDB, &&L_OP_FSEND,\n &&L_OP_CALL, &&L_OP_SUPER, &&L_OP_ARGARY, &&L_OP_ENTER,\n &&L_OP_KARG, &&L_OP_KDICT, &&L_OP_RETURN, &&L_OP_TAILCALL, &&L_OP_BLKPUSH,\n &&L_OP_ADD, &&L_OP_ADDI, &&L_OP_SUB, &&L_OP_SUBI, &&L_OP_MUL, &&L_OP_DIV,\n &&L_OP_EQ, &&L_OP_LT, &&L_OP_LE, &&L_OP_GT, &&L_OP_GE,\n &&L_OP_ARRAY, &&L_OP_ARYCAT, &&L_OP_ARYPUSH, &&L_OP_AREF, &&L_OP_ASET, &&L_OP_APOST,\n &&L_OP_STRING, &&L_OP_STRCAT, &&L_OP_HASH,\n &&L_OP_LAMBDA, &&L_OP_RANGE, &&L_OP_OCLASS,\n &&L_OP_CLASS, &&L_OP_MODULE, &&L_OP_EXEC,\n &&L_OP_METHOD, &&L_OP_SCLASS, &&L_OP_TCLASS,\n &&L_OP_DEBUG, &&L_OP_STOP, &&L_OP_ERR,\n };\n#endif\n\n mrb_bool exc_catched = FALSE;\nRETRY_TRY_BLOCK:\n\n MRB_TRY(&c_jmp) {\n\n if (exc_catched) {\n exc_catched = FALSE;\n if (mrb->exc && mrb->exc->tt == MRB_TT_BREAK)\n goto L_BREAK;\n goto L_RAISE;\n }\n mrb->jmp = &c_jmp;\n mrb->c->ci->proc = proc;\n mrb->c->ci->nregs = irep->nregs;\n\n#define regs (mrb->c->stack)\n INIT_DISPATCH {\n CASE(OP_NOP) {\n /* do nothing */\n NEXT;\n }\n\n CASE(OP_MOVE) {\n /* A B R(A) := R(B) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n regs[a] = regs[b];\n NEXT;\n }\n\n CASE(OP_LOADL) {\n /* A Bx R(A) := Pool(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n#ifdef MRB_WORD_BOXING\n mrb_value val = pool[bx];\n#ifndef MRB_WITHOUT_FLOAT\n if (mrb_float_p(val)) {\n val = mrb_float_value(mrb, mrb_float(val));\n }\n#endif\n regs[a] = val;\n#else\n regs[a] = pool[bx];\n#endif\n NEXT;\n }\n\n CASE(OP_LOADI) {\n /* A sBx R(A) := sBx */\n int a = GETARG_A(i);\n mrb_int bx = GETARG_sBx(i);\n SET_INT_VALUE(regs[a], bx);\n NEXT;\n }\n\n CASE(OP_LOADSYM) {\n /* A Bx R(A) := Syms(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n SET_SYM_VALUE(regs[a], syms[bx]);\n NEXT;\n }\n\n CASE(OP_LOADSELF) {\n /* A R(A) := self */\n int a = GETARG_A(i);\n regs[a] = regs[0];\n NEXT;\n }\n\n CASE(OP_LOADT) {\n /* A R(A) := true */\n int a = GETARG_A(i);\n SET_TRUE_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_LOADF) {\n /* A R(A) := false */\n int a = GETARG_A(i);\n SET_FALSE_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_GETGLOBAL) {\n /* A Bx R(A) := getglobal(Syms(Bx)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_gv_get(mrb, syms[bx]);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETGLOBAL) {\n /* A Bx setglobal(Syms(Bx), R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_gv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETSPECIAL) {\n /* A Bx R(A) := Special[Bx] */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_vm_special_get(mrb, bx);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETSPECIAL) {\n /* A Bx Special[Bx] := R(A) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_special_set(mrb, bx, regs[a]);\n NEXT;\n }\n\n CASE(OP_GETIV) {\n /* A Bx R(A) := ivget(Bx) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val = mrb_vm_iv_get(mrb, syms[bx]);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETIV) {\n /* A Bx ivset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_iv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETCV) {\n /* A Bx R(A) := cvget(Syms(Bx)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_value val;\n ERR_PC_SET(mrb, pc);\n val = mrb_vm_cv_get(mrb, syms[bx]);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETCV) {\n /* A Bx cvset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_cv_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETCONST) {\n /* A Bx R(A) := constget(Syms(Bx)) */\n mrb_value val;\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_sym sym = syms[bx];\n\n ERR_PC_SET(mrb, pc);\n val = mrb_vm_const_get(mrb, sym);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETCONST) {\n /* A Bx constset(Syms(Bx),R(A)) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_vm_const_set(mrb, syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETMCNST) {\n /* A Bx R(A) := R(A)::Syms(Bx) */\n mrb_value val;\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n\n ERR_PC_SET(mrb, pc);\n val = mrb_const_get(mrb, regs[a], syms[bx]);\n ERR_PC_CLR(mrb);\n regs[a] = val;\n NEXT;\n }\n\n CASE(OP_SETMCNST) {\n /* A Bx R(A+1)::Syms(Bx) := R(A) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_const_set(mrb, regs[a+1], syms[bx], regs[a]);\n NEXT;\n }\n\n CASE(OP_GETUPVAR) {\n /* A B C R(A) := uvget(B,C) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value *regs_a = regs + a;\n struct REnv *e = uvenv(mrb, c);\n\n if (e && b < MRB_ENV_STACK_LEN(e)) {\n *regs_a = e->stack[b];\n }\n else {\n *regs_a = mrb_nil_value();\n }\n NEXT;\n }\n\n CASE(OP_SETUPVAR) {\n /* A B C uvset(B,C,R(A)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n\n struct REnv *e = uvenv(mrb, c);\n\n if (e) {\n mrb_value *regs_a = regs + a;\n\n if (b < MRB_ENV_STACK_LEN(e)) {\n e->stack[b] = *regs_a;\n mrb_write_barrier(mrb, (struct RBasic*)e);\n }\n }\n NEXT;\n }\n\n CASE(OP_JMP) {\n /* sBx pc+=sBx */\n int sbx = GETARG_sBx(i);\n pc += sbx;\n JUMP;\n }\n\n CASE(OP_JMPIF) {\n /* A sBx if R(A) pc+=sBx */\n int a = GETARG_A(i);\n int sbx = GETARG_sBx(i);\n if (mrb_test(regs[a])) {\n pc += sbx;\n JUMP;\n }\n NEXT;\n }\n\n CASE(OP_JMPNOT) {\n /* A sBx if !R(A) pc+=sBx */\n int a = GETARG_A(i);\n int sbx = GETARG_sBx(i);\n if (!mrb_test(regs[a])) {\n pc += sbx;\n JUMP;\n }\n NEXT;\n }\n\n CASE(OP_ONERR) {\n /* sBx pc+=sBx on exception */\n int sbx = GETARG_sBx(i);\n if (mrb->c->rsize <= mrb->c->ci->ridx) {\n if (mrb->c->rsize == 0) mrb->c->rsize = RESCUE_STACK_INIT_SIZE;\n else mrb->c->rsize *= 2;\n mrb->c->rescue = (mrb_code **)mrb_realloc(mrb, mrb->c->rescue, sizeof(mrb_code*) * mrb->c->rsize);\n }\n mrb->c->rescue[mrb->c->ci->ridx++] = pc + sbx;\n NEXT;\n }\n\n CASE(OP_RESCUE) {\n /* A B R(A) := exc; clear(exc); R(B) := matched (bool) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value exc;\n\n if (c == 0) {\n exc = mrb_obj_value(mrb->exc);\n mrb->exc = 0;\n }\n else { /* continued; exc taken from R(A) */\n exc = regs[a];\n }\n if (b != 0) {\n mrb_value e = regs[b];\n struct RClass *ec;\n\n switch (mrb_type(e)) {\n case MRB_TT_CLASS:\n case MRB_TT_MODULE:\n break;\n default:\n {\n mrb_value exc;\n\n exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR,\n \"class or module required for rescue clause\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n ec = mrb_class_ptr(e);\n regs[b] = mrb_bool_value(mrb_obj_is_kind_of(mrb, exc, ec));\n }\n if (a != 0 && c == 0) {\n regs[a] = exc;\n }\n NEXT;\n }\n\n CASE(OP_POPERR) {\n /* A A.times{rescue_pop()} */\n int a = GETARG_A(i);\n\n mrb->c->ci->ridx -= a;\n NEXT;\n }\n\n CASE(OP_RAISE) {\n /* A raise(R(A)) */\n int a = GETARG_A(i);\n\n mrb_exc_set(mrb, regs[a]);\n goto L_RAISE;\n }\n\n CASE(OP_EPUSH) {\n /* Bx ensure_push(SEQ[Bx]) */\n int bx = GETARG_Bx(i);\n struct RProc *p;\n\n p = mrb_closure_new(mrb, irep->reps[bx]);\n /* push ensure_stack */\n if (mrb->c->esize <= mrb->c->eidx+1) {\n if (mrb->c->esize == 0) mrb->c->esize = ENSURE_STACK_INIT_SIZE;\n else mrb->c->esize *= 2;\n mrb->c->ensure = (struct RProc **)mrb_realloc(mrb, mrb->c->ensure, sizeof(struct RProc*) * mrb->c->esize);\n }\n mrb->c->ensure[mrb->c->eidx++] = p;\n mrb->c->ensure[mrb->c->eidx] = NULL;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_EPOP) {\n /* A A.times{ensure_pop().call} */\n int a = GETARG_A(i);\n mrb_callinfo *ci = mrb->c->ci;\n int n, epos = ci->epos;\n mrb_value self = regs[0];\n struct RClass *target_class = ci->target_class;\n\n if (mrb->c->eidx <= epos) {\n NEXT;\n }\n\n if (a > mrb->c->eidx - epos)\n a = mrb->c->eidx - epos;\n pc = pc + 1;\n for (n=0; nc->ensure[epos+n];\n mrb->c->ensure[epos+n] = NULL;\n if (proc == NULL) continue;\n irep = proc->body.irep;\n ci = cipush(mrb);\n ci->mid = ci[-1].mid;\n ci->argc = 0;\n ci->proc = proc;\n ci->stackent = mrb->c->stack;\n ci->nregs = irep->nregs;\n ci->target_class = target_class;\n ci->pc = pc;\n ci->acc = ci[-1].nregs;\n mrb->c->stack += ci->acc;\n stack_extend(mrb, ci->nregs);\n regs[0] = self;\n pc = irep->iseq;\n }\n pool = irep->pool;\n syms = irep->syms;\n mrb->c->eidx = epos;\n JUMP;\n }\n\n CASE(OP_LOADNIL) {\n /* A R(A) := nil */\n int a = GETARG_A(i);\n\n SET_NIL_VALUE(regs[a]);\n NEXT;\n }\n\n CASE(OP_SENDB) {\n /* A B C R(A) := call(R(A),Syms(B),R(A+1),...,R(A+C),&R(A+C+1))*/\n /* fall through */\n };\n\n L_SEND:\n CASE(OP_SEND) {\n /* A B C R(A) := call(R(A),Syms(B),R(A+1),...,R(A+C)) */\n int a = GETARG_A(i);\n int n = GETARG_C(i);\n int argc = (n == CALL_MAXARGS) ? -1 : n;\n int bidx = (argc < 0) ? a+2 : a+n+1;\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci = mrb->c->ci;\n mrb_value recv, blk;\n mrb_sym mid = syms[GETARG_B(i)];\n\n mrb_assert(bidx < ci->nregs);\n\n recv = regs[a];\n if (GET_OPCODE(i) != OP_SENDB) {\n SET_NIL_VALUE(regs[bidx]);\n blk = regs[bidx];\n }\n else {\n blk = regs[bidx];\n if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {\n blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, \"Proc\", \"to_proc\");\n /* The stack might have been reallocated during mrb_convert_type(),\n see #3622 */\n regs[bidx] = blk;\n }\n }\n c = mrb_class(mrb, recv);\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m) || (missing == mrb->c->ci->mid && mrb_obj_eq(mrb, regs[0], recv))) {\n mrb_value args = (argc < 0) ? regs[a+1] : mrb_ary_new_from_values(mrb, n, regs+a+1);\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n if (argc >= 0) {\n if (a+2 >= irep->nregs) {\n stack_extend(mrb, a+3);\n }\n regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1);\n regs[a+2] = blk;\n argc = -1;\n }\n mrb_ary_unshift(mrb, regs[a+1], mrb_symbol_value(mid));\n mid = missing;\n }\n\n /* push callinfo */\n ci = cipush(mrb);\n ci->mid = mid;\n ci->stackent = mrb->c->stack;\n ci->target_class = c;\n ci->argc = argc;\n\n ci->pc = pc + 1;\n ci->acc = a;\n\n /* prepare stack */\n mrb->c->stack += a;\n\n if (MRB_METHOD_CFUNC_P(m)) {\n ci->nregs = (argc < 0) ? 3 : n+2;\n if (MRB_METHOD_PROC_P(m)) {\n struct RProc *p = MRB_METHOD_PROC(m);\n\n ci->proc = p;\n recv = p->body.func(mrb, recv);\n }\n else {\n recv = MRB_METHOD_FUNC(m)(mrb, recv);\n }\n mrb_gc_arena_restore(mrb, ai);\n mrb_gc_arena_shrink(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n ci = mrb->c->ci;\n if (GET_OPCODE(i) == OP_SENDB) {\n if (mrb_type(blk) == MRB_TT_PROC) {\n struct RProc *p = mrb_proc_ptr(blk);\n if (p && !MRB_PROC_STRICT_P(p) && MRB_PROC_ENV(p) == ci[-1].env) {\n p->flags |= MRB_PROC_ORPHAN;\n }\n }\n }\n if (!ci->target_class) { /* return from context modifying method (resume/yield) */\n if (ci->acc == CI_ACC_RESUMED) {\n mrb->jmp = prev_jmp;\n return recv;\n }\n else {\n mrb_assert(!MRB_PROC_CFUNC_P(ci[-1].proc));\n proc = ci[-1].proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n }\n }\n mrb->c->stack[0] = recv;\n /* pop stackpos */\n mrb->c->stack = ci->stackent;\n pc = ci->pc;\n cipop(mrb);\n JUMP;\n }\n else {\n /* setup environment for calling method */\n proc = ci->proc = MRB_METHOD_PROC(m);\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, (argc < 0 && ci->nregs < 3) ? 3 : ci->nregs);\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_FSEND) {\n /* A B C R(A) := fcall(R(A),Syms(B),R(A+1),... ,R(A+C-1)) */\n /* not implemented yet */\n NEXT;\n }\n\n CASE(OP_CALL) {\n /* A R(A) := self.call(frame.argc, frame.argv) */\n mrb_callinfo *ci;\n mrb_value recv = mrb->c->stack[0];\n struct RProc *m = mrb_proc_ptr(recv);\n\n /* replace callinfo */\n ci = mrb->c->ci;\n ci->target_class = MRB_PROC_TARGET_CLASS(m);\n ci->proc = m;\n if (MRB_PROC_ENV_P(m)) {\n mrb_sym mid;\n struct REnv *e = MRB_PROC_ENV(m);\n\n mid = e->mid;\n if (mid) ci->mid = mid;\n if (!e->stack) {\n e->stack = mrb->c->stack;\n }\n }\n\n /* prepare stack */\n if (MRB_PROC_CFUNC_P(m)) {\n recv = MRB_PROC_CFUNC(m)(mrb, recv);\n mrb_gc_arena_restore(mrb, ai);\n mrb_gc_arena_shrink(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n /* pop stackpos */\n ci = mrb->c->ci;\n mrb->c->stack = ci->stackent;\n regs[ci->acc] = recv;\n pc = ci->pc;\n cipop(mrb);\n irep = mrb->c->ci->proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n JUMP;\n }\n else {\n /* setup environment for calling method */\n proc = m;\n irep = m->body.irep;\n if (!irep) {\n mrb->c->stack[0] = mrb_nil_value();\n goto L_RETURN;\n }\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, ci->nregs);\n if (ci->argc < 0) {\n if (irep->nregs > 3) {\n stack_clear(regs+3, irep->nregs-3);\n }\n }\n else if (ci->argc+2 < irep->nregs) {\n stack_clear(regs+ci->argc+2, irep->nregs-ci->argc-2);\n }\n if (MRB_PROC_ENV_P(m)) {\n regs[0] = MRB_PROC_ENV(m)->stack[0];\n }\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_SUPER) {\n /* A C R(A) := super(R(A+1),... ,R(A+C+1)) */\n int a = GETARG_A(i);\n int n = GETARG_C(i);\n int argc = (n == CALL_MAXARGS) ? -1 : n;\n int bidx = (argc < 0) ? a+2 : a+n+1;\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci = mrb->c->ci;\n mrb_value recv, blk;\n mrb_sym mid = ci->mid;\n struct RClass* target_class = MRB_PROC_TARGET_CLASS(ci->proc);\n\n mrb_assert(bidx < ci->nregs);\n\n if (mid == 0 || !target_class) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, \"super called outside of method\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (target_class->tt == MRB_TT_MODULE) {\n target_class = ci->target_class;\n if (target_class->tt != MRB_TT_ICLASS) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_RUNTIME_ERROR, \"superclass info lost [mruby limitations]\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n recv = regs[0];\n if (!mrb_obj_is_kind_of(mrb, recv, target_class)) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR,\n \"self has wrong type to call super in this context\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n blk = regs[bidx];\n if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {\n blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, \"Proc\", \"to_proc\");\n /* The stack or ci stack might have been reallocated during\n mrb_convert_type(), see #3622 and #3784 */\n regs[bidx] = blk;\n ci = mrb->c->ci;\n }\n c = target_class->super;\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n\n if (mid != missing) {\n c = mrb_class(mrb, recv);\n }\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value args = (argc < 0) ? regs[a+1] : mrb_ary_new_from_values(mrb, n, regs+a+1);\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n mid = missing;\n if (argc >= 0) {\n if (a+2 >= ci->nregs) {\n stack_extend(mrb, a+3);\n }\n regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1);\n regs[a+2] = blk;\n argc = -1;\n }\n mrb_ary_unshift(mrb, regs[a+1], mrb_symbol_value(ci->mid));\n }\n\n /* push callinfo */\n ci = cipush(mrb);\n ci->mid = mid;\n ci->stackent = mrb->c->stack;\n ci->target_class = c;\n ci->pc = pc + 1;\n ci->argc = argc;\n\n /* prepare stack */\n mrb->c->stack += a;\n mrb->c->stack[0] = recv;\n\n if (MRB_METHOD_CFUNC_P(m)) {\n mrb_value v;\n ci->nregs = (argc < 0) ? 3 : n+2;\n if (MRB_METHOD_PROC_P(m)) {\n ci->proc = MRB_METHOD_PROC(m);\n }\n v = MRB_METHOD_CFUNC(m)(mrb, recv);\n mrb_gc_arena_restore(mrb, ai);\n if (mrb->exc) goto L_RAISE;\n ci = mrb->c->ci;\n if (!ci->target_class) { /* return from context modifying method (resume/yield) */\n if (ci->acc == CI_ACC_RESUMED) {\n mrb->jmp = prev_jmp;\n return v;\n }\n else {\n mrb_assert(!MRB_PROC_CFUNC_P(ci[-1].proc));\n proc = ci[-1].proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n }\n }\n mrb->c->stack[0] = v;\n /* pop stackpos */\n mrb->c->stack = ci->stackent;\n pc = ci->pc;\n cipop(mrb);\n JUMP;\n }\n else {\n /* fill callinfo */\n ci->acc = a;\n\n /* setup environment for calling method */\n proc = ci->proc = MRB_METHOD_PROC(m);\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, (argc < 0 && ci->nregs < 3) ? 3 : ci->nregs);\n pc = irep->iseq;\n JUMP;\n }\n }\n\n CASE(OP_ARGARY) {\n /* A Bx R(A) := argument array (16=6:1:5:4) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n int m1 = (bx>>10)&0x3f;\n int r = (bx>>9)&0x1;\n int m2 = (bx>>4)&0x1f;\n int lv = (bx>>0)&0xf;\n mrb_value *stack;\n\n if (mrb->c->ci->mid == 0 || mrb->c->ci->target_class == NULL) {\n mrb_value exc;\n\n L_NOSUPER:\n exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, \"super called outside of method\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (lv == 0) stack = regs + 1;\n else {\n struct REnv *e = uvenv(mrb, lv-1);\n if (!e) goto L_NOSUPER;\n if (MRB_ENV_STACK_LEN(e) <= m1+r+m2+1)\n goto L_NOSUPER;\n stack = e->stack + 1;\n }\n if (r == 0) {\n regs[a] = mrb_ary_new_from_values(mrb, m1+m2, stack);\n }\n else {\n mrb_value *pp = NULL;\n struct RArray *rest;\n int len = 0;\n\n if (mrb_array_p(stack[m1])) {\n struct RArray *ary = mrb_ary_ptr(stack[m1]);\n\n pp = ARY_PTR(ary);\n len = (int)ARY_LEN(ary);\n }\n regs[a] = mrb_ary_new_capa(mrb, m1+len+m2);\n rest = mrb_ary_ptr(regs[a]);\n if (m1 > 0) {\n stack_copy(ARY_PTR(rest), stack, m1);\n }\n if (len > 0) {\n stack_copy(ARY_PTR(rest)+m1, pp, len);\n }\n if (m2 > 0) {\n stack_copy(ARY_PTR(rest)+m1+len, stack+m1+1, m2);\n }\n ARY_SET_LEN(rest, m1+len+m2);\n }\n regs[a+1] = stack[m1+r+m2];\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ENTER) {\n /* Ax arg setup according to flags (23=5:5:1:5:5:1:1) */\n /* number of optional arguments times OP_JMP should follow */\n mrb_aspec ax = GETARG_Ax(i);\n int m1 = MRB_ASPEC_REQ(ax);\n int o = MRB_ASPEC_OPT(ax);\n int r = MRB_ASPEC_REST(ax);\n int m2 = MRB_ASPEC_POST(ax);\n /* unused\n int k = MRB_ASPEC_KEY(ax);\n int kd = MRB_ASPEC_KDICT(ax);\n int b = MRB_ASPEC_BLOCK(ax);\n */\n int argc = mrb->c->ci->argc;\n mrb_value *argv = regs+1;\n mrb_value *argv0 = argv;\n int len = m1 + o + r + m2;\n mrb_value *blk = &argv[argc < 0 ? 1 : argc];\n\n if (argc < 0) {\n struct RArray *ary = mrb_ary_ptr(regs[1]);\n argv = ARY_PTR(ary);\n argc = (int)ARY_LEN(ary);\n mrb_gc_protect(mrb, regs[1]);\n }\n if (mrb->c->ci->proc && MRB_PROC_STRICT_P(mrb->c->ci->proc)) {\n if (argc >= 0) {\n if (argc < m1 + m2 || (r == 0 && argc > len)) {\n argnum_error(mrb, m1+m2);\n goto L_RAISE;\n }\n }\n }\n else if (len > 1 && argc == 1 && mrb_array_p(argv[0])) {\n mrb_gc_protect(mrb, argv[0]);\n argc = (int)RARRAY_LEN(argv[0]);\n argv = RARRAY_PTR(argv[0]);\n }\n if (argc < len) {\n int mlen = m2;\n if (argc < m1+m2) {\n if (m1 < argc)\n mlen = argc - m1;\n else\n mlen = 0;\n }\n regs[len+1] = *blk; /* move block */\n SET_NIL_VALUE(regs[argc+1]);\n if (argv0 != argv) {\n value_move(®s[1], argv, argc-mlen); /* m1 + o */\n }\n if (argc < m1) {\n stack_clear(®s[argc+1], m1-argc);\n }\n if (mlen) {\n value_move(®s[len-m2+1], &argv[argc-mlen], mlen);\n }\n if (mlen < m2) {\n stack_clear(®s[len-m2+mlen+1], m2-mlen);\n }\n if (r) {\n regs[m1+o+1] = mrb_ary_new_capa(mrb, 0);\n }\n if (o == 0 || argc < m1+m2) pc++;\n else\n pc += argc - m1 - m2 + 1;\n }\n else {\n int rnum = 0;\n if (argv0 != argv) {\n regs[len+1] = *blk; /* move block */\n value_move(®s[1], argv, m1+o);\n }\n if (r) {\n rnum = argc-m1-o-m2;\n regs[m1+o+1] = mrb_ary_new_from_values(mrb, rnum, argv+m1+o);\n }\n if (m2) {\n if (argc-m2 > m1) {\n value_move(®s[m1+o+r+1], &argv[m1+o+rnum], m2);\n }\n }\n if (argv0 == argv) {\n regs[len+1] = *blk; /* move block */\n }\n pc += o + 1;\n }\n mrb->c->ci->argc = len;\n /* clear local (but non-argument) variables */\n if (irep->nlocals-len-2 > 0) {\n stack_clear(®s[len+2], irep->nlocals-len-2);\n }\n JUMP;\n }\n\n CASE(OP_KARG) {\n /* A B C R(A) := kdict[Syms(B)]; if C kdict.rm(Syms(B)) */\n /* if C == 2; raise unless kdict.empty? */\n /* OP_JMP should follow to skip init code */\n NEXT;\n }\n\n CASE(OP_KDICT) {\n /* A C R(A) := kdict */\n NEXT;\n }\n\n L_RETURN:\n i = MKOP_AB(OP_RETURN, GETARG_A(i), OP_R_NORMAL);\n /* fall through */\n CASE(OP_RETURN) {\n /* A B return R(A) (B=normal,in-block return/break) */\n mrb_callinfo *ci;\n\n#define ecall_adjust() do {\\\n ptrdiff_t cioff = ci - mrb->c->cibase;\\\n ecall(mrb);\\\n ci = mrb->c->cibase + cioff;\\\n} while (0)\n\n ci = mrb->c->ci;\n if (ci->mid) {\n mrb_value blk;\n\n if (ci->argc < 0) {\n blk = regs[2];\n }\n else {\n blk = regs[ci->argc+1];\n }\n if (mrb_type(blk) == MRB_TT_PROC) {\n struct RProc *p = mrb_proc_ptr(blk);\n\n if (!MRB_PROC_STRICT_P(p) &&\n ci > mrb->c->cibase && MRB_PROC_ENV(p) == ci[-1].env) {\n p->flags |= MRB_PROC_ORPHAN;\n }\n }\n }\n\n if (mrb->exc) {\n mrb_callinfo *ci0;\n\n L_RAISE:\n ci0 = ci = mrb->c->ci;\n if (ci == mrb->c->cibase) {\n if (ci->ridx == 0) goto L_FTOP;\n goto L_RESCUE;\n }\n while (ci[0].ridx == ci[-1].ridx) {\n cipop(mrb);\n mrb->c->stack = ci->stackent;\n if (ci->acc == CI_ACC_SKIP && prev_jmp) {\n mrb->jmp = prev_jmp;\n MRB_THROW(prev_jmp);\n }\n ci = mrb->c->ci;\n if (ci == mrb->c->cibase) {\n if (ci->ridx == 0) {\n L_FTOP: /* fiber top */\n if (mrb->c == mrb->root_c) {\n mrb->c->stack = mrb->c->stbase;\n goto L_STOP;\n }\n else {\n struct mrb_context *c = mrb->c;\n\n while (c->eidx > ci->epos) {\n ecall_adjust();\n }\n if (c->fib) {\n mrb_write_barrier(mrb, (struct RBasic*)c->fib);\n }\n mrb->c->status = MRB_FIBER_TERMINATED;\n mrb->c = c->prev;\n c->prev = NULL;\n goto L_RAISE;\n }\n }\n break;\n }\n /* call ensure only when we skip this callinfo */\n if (ci[0].ridx == ci[-1].ridx) {\n while (mrb->c->eidx > ci->epos) {\n ecall_adjust();\n }\n }\n }\n L_RESCUE:\n if (ci->ridx == 0) goto L_STOP;\n proc = ci->proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n if (ci < ci0) {\n mrb->c->stack = ci[1].stackent;\n }\n stack_extend(mrb, irep->nregs);\n pc = mrb->c->rescue[--ci->ridx];\n }\n else {\n int acc;\n mrb_value v;\n struct RProc *dst;\n\n ci = mrb->c->ci;\n v = regs[GETARG_A(i)];\n mrb_gc_protect(mrb, v);\n switch (GETARG_B(i)) {\n case OP_R_RETURN:\n /* Fall through to OP_R_NORMAL otherwise */\n if (ci->acc >=0 && MRB_PROC_ENV_P(proc) && !MRB_PROC_STRICT_P(proc)) {\n mrb_callinfo *cibase = mrb->c->cibase;\n dst = top_proc(mrb, proc);\n\n if (MRB_PROC_ENV_P(dst)) {\n struct REnv *e = MRB_PROC_ENV(dst);\n\n if (!MRB_ENV_STACK_SHARED_P(e) || e->cxt != mrb->c) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n }\n while (cibase <= ci && ci->proc != dst) {\n if (ci->acc < 0) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n ci--;\n }\n if (ci <= cibase) {\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n break;\n }\n case OP_R_NORMAL:\n NORMAL_RETURN:\n if (ci == mrb->c->cibase) {\n struct mrb_context *c;\n\n if (!mrb->c->prev) { /* toplevel return */\n localjump_error(mrb, LOCALJUMP_ERROR_RETURN);\n goto L_RAISE;\n }\n if (mrb->c->prev->ci == mrb->c->prev->cibase) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_FIBER_ERROR, \"double resume\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n while (mrb->c->eidx > 0) {\n ecall(mrb);\n }\n /* automatic yield at the end */\n c = mrb->c;\n c->status = MRB_FIBER_TERMINATED;\n mrb->c = c->prev;\n c->prev = NULL;\n mrb->c->status = MRB_FIBER_RUNNING;\n ci = mrb->c->ci;\n }\n break;\n case OP_R_BREAK:\n if (MRB_PROC_STRICT_P(proc)) goto NORMAL_RETURN;\n if (MRB_PROC_ORPHAN_P(proc)) { \n mrb_value exc;\n\n L_BREAK_ERROR:\n exc = mrb_exc_new_str_lit(mrb, E_LOCALJUMP_ERROR,\n \"break from proc-closure\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n if (!MRB_PROC_ENV_P(proc) || !MRB_ENV_STACK_SHARED_P(MRB_PROC_ENV(proc))) {\n goto L_BREAK_ERROR;\n }\n else {\n struct REnv *e = MRB_PROC_ENV(proc);\n\n if (e == mrb->c->cibase->env && proc != mrb->c->cibase->proc) {\n goto L_BREAK_ERROR;\n }\n if (e->cxt != mrb->c) {\n goto L_BREAK_ERROR;\n }\n }\n while (mrb->c->eidx > mrb->c->ci->epos) {\n ecall_adjust();\n }\n /* break from fiber block */\n if (ci == mrb->c->cibase && ci->pc) {\n struct mrb_context *c = mrb->c;\n\n mrb->c = c->prev;\n c->prev = NULL;\n ci = mrb->c->ci;\n }\n if (ci->acc < 0) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->c->vmexec = FALSE;\n mrb->exc = (struct RObject*)break_new(mrb, proc, v);\n mrb->jmp = prev_jmp;\n MRB_THROW(prev_jmp);\n }\n if (FALSE) {\n L_BREAK:\n v = ((struct RBreak*)mrb->exc)->val;\n proc = ((struct RBreak*)mrb->exc)->proc;\n mrb->exc = NULL;\n ci = mrb->c->ci;\n }\n mrb->c->stack = ci->stackent;\n proc = proc->upper;\n while (mrb->c->cibase < ci && ci[-1].proc != proc) {\n if (ci[-1].acc == CI_ACC_SKIP) {\n while (ci < mrb->c->ci) {\n cipop(mrb);\n }\n goto L_BREAK_ERROR;\n }\n ci--;\n }\n if (ci == mrb->c->cibase) {\n goto L_BREAK_ERROR;\n }\n break;\n default:\n /* cannot happen */\n break;\n }\n while (ci < mrb->c->ci) {\n cipop(mrb);\n }\n ci[0].ridx = ci[-1].ridx;\n while (mrb->c->eidx > ci->epos) {\n ecall_adjust();\n }\n if (mrb->c->vmexec && !ci->target_class) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->c->vmexec = FALSE;\n mrb->jmp = prev_jmp;\n return v;\n }\n acc = ci->acc;\n mrb->c->stack = ci->stackent;\n cipop(mrb);\n if (acc == CI_ACC_SKIP || acc == CI_ACC_DIRECT) {\n mrb_gc_arena_restore(mrb, ai);\n mrb->jmp = prev_jmp;\n return v;\n }\n pc = ci->pc;\n ci = mrb->c->ci;\n DEBUG(fprintf(stderr, \"from :%s\\n\", mrb_sym2name(mrb, ci->mid)));\n proc = mrb->c->ci->proc;\n irep = proc->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n\n regs[acc] = v;\n mrb_gc_arena_restore(mrb, ai);\n }\n JUMP;\n }\n\n CASE(OP_TAILCALL) {\n /* A B C return call(R(A),Syms(B),R(A+1),... ,R(A+C+1)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int n = GETARG_C(i);\n mrb_method_t m;\n struct RClass *c;\n mrb_callinfo *ci;\n mrb_value recv;\n mrb_sym mid = syms[b];\n\n recv = regs[a];\n c = mrb_class(mrb, recv);\n m = mrb_method_search_vm(mrb, &c, mid);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value sym = mrb_symbol_value(mid);\n mrb_sym missing = mrb_intern_lit(mrb, \"method_missing\");\n m = mrb_method_search_vm(mrb, &c, missing);\n if (MRB_METHOD_UNDEF_P(m)) {\n mrb_value args;\n\n if (n == CALL_MAXARGS) {\n args = regs[a+1];\n }\n else {\n args = mrb_ary_new_from_values(mrb, n, regs+a+1);\n }\n ERR_PC_SET(mrb, pc);\n mrb_method_missing(mrb, mid, recv, args);\n }\n mid = missing;\n if (n == CALL_MAXARGS) {\n mrb_ary_unshift(mrb, regs[a+1], sym);\n }\n else {\n value_move(regs+a+2, regs+a+1, ++n);\n regs[a+1] = sym;\n }\n }\n\n /* replace callinfo */\n ci = mrb->c->ci;\n ci->mid = mid;\n ci->target_class = c;\n if (n == CALL_MAXARGS) {\n ci->argc = -1;\n }\n else {\n ci->argc = n;\n }\n\n /* move stack */\n value_move(mrb->c->stack, ®s[a], ci->argc+1);\n\n if (MRB_METHOD_CFUNC_P(m)) {\n mrb_value v = MRB_METHOD_CFUNC(m)(mrb, recv);\n mrb->c->stack[0] = v;\n mrb_gc_arena_restore(mrb, ai);\n goto L_RETURN;\n }\n else {\n /* setup environment for calling method */\n struct RProc *p = MRB_METHOD_PROC(m);\n irep = p->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n if (ci->argc < 0) {\n stack_extend(mrb, (irep->nregs < 3) ? 3 : irep->nregs);\n }\n else {\n stack_extend(mrb, irep->nregs);\n }\n pc = irep->iseq;\n }\n JUMP;\n }\n\n CASE(OP_BLKPUSH) {\n /* A Bx R(A) := block (16=6:1:5:4) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n int m1 = (bx>>10)&0x3f;\n int r = (bx>>9)&0x1;\n int m2 = (bx>>4)&0x1f;\n int lv = (bx>>0)&0xf;\n mrb_value *stack;\n\n if (lv == 0) stack = regs + 1;\n else {\n struct REnv *e = uvenv(mrb, lv-1);\n if (!e || (!MRB_ENV_STACK_SHARED_P(e) && e->mid == 0) ||\n MRB_ENV_STACK_LEN(e) <= m1+r+m2+1) {\n localjump_error(mrb, LOCALJUMP_ERROR_YIELD);\n goto L_RAISE;\n }\n stack = e->stack + 1;\n }\n if (mrb_nil_p(stack[m1+r+m2])) {\n localjump_error(mrb, LOCALJUMP_ERROR_YIELD);\n goto L_RAISE;\n }\n regs[a] = stack[m1+r+m2];\n NEXT;\n }\n\n#define TYPES2(a,b) ((((uint16_t)(a))<<8)|(((uint16_t)(b))&0xff))\n#define OP_MATH_BODY(op,v1,v2) do {\\\n v1(regs[a]) = v1(regs[a]) op v2(regs[a+1]);\\\n} while(0)\n\n CASE(OP_ADD) {\n /* A B C R(A) := R(A)+R(A+1) (Syms[B]=:+,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n mrb_value *regs_a = regs + a;\n\n x = mrb_fixnum(regs_a[0]);\n y = mrb_fixnum(regs_a[1]);\n if (mrb_int_add_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs_a[0], (mrb_float)x + (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x + y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x + y);\n }\n#else\n OP_MATH_BODY(+,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x + y);\n }\n#else\n OP_MATH_BODY(+,mrb_float,mrb_float);\n#endif\n break;\n#endif\n case TYPES2(MRB_TT_STRING,MRB_TT_STRING):\n regs[a] = mrb_str_plus(mrb, regs[a], regs[a+1]);\n break;\n default:\n goto L_SEND;\n }\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_SUB) {\n /* A B C R(A) := R(A)-R(A+1) (Syms[B]=:-,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n\n x = mrb_fixnum(regs[a]);\n y = mrb_fixnum(regs[a+1]);\n if (mrb_int_sub_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x - y);\n }\n#else\n OP_MATH_BODY(-,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x - y);\n }\n#else\n OP_MATH_BODY(-,mrb_float,mrb_float);\n#endif\n break;\n#endif\n default:\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_MUL) {\n /* A B C R(A) := R(A)*R(A+1) (Syms[B]=:*,C=1)*/\n int a = GETARG_A(i);\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n {\n mrb_int x, y, z;\n\n x = mrb_fixnum(regs[a]);\n y = mrb_fixnum(regs[a+1]);\n if (mrb_int_mul_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x * (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x * y);\n }\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x * y);\n }\n#else\n OP_MATH_BODY(*,mrb_float,mrb_fixnum);\n#endif\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n mrb_float y = mrb_float(regs[a+1]);\n SET_FLOAT_VALUE(mrb, regs[a], x * y);\n }\n#else\n OP_MATH_BODY(*,mrb_float,mrb_float);\n#endif\n break;\n#endif\n default:\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_DIV) {\n /* A B C R(A) := R(A)/R(A+1) (Syms[B]=:/,C=1)*/\n int a = GETARG_A(i);\n#ifndef MRB_WITHOUT_FLOAT\n double x, y, f;\n#endif\n\n /* need to check if op is overridden */\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\n#ifdef MRB_WITHOUT_FLOAT\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_int y = mrb_fixnum(regs[a+1]);\n SET_INT_VALUE(regs[a], y ? x / y : 0);\n }\n break;\n#else\n x = (mrb_float)mrb_fixnum(regs[a]);\n y = (mrb_float)mrb_fixnum(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\n x = (mrb_float)mrb_fixnum(regs[a]);\n y = mrb_float(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\n x = mrb_float(regs[a]);\n y = (mrb_float)mrb_fixnum(regs[a+1]);\n break;\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\n x = mrb_float(regs[a]);\n y = mrb_float(regs[a+1]);\n break;\n#endif\n default:\n goto L_SEND;\n }\n\n#ifndef MRB_WITHOUT_FLOAT\n if (y == 0) {\n if (x > 0) f = INFINITY;\n else if (x < 0) f = -INFINITY;\n else /* if (x == 0) */ f = NAN;\n }\n else {\n f = x / y;\n }\n SET_FLOAT_VALUE(mrb, regs[a], f);\n#endif\n NEXT;\n }\n\n CASE(OP_ADDI) {\n /* A B C R(A) := R(A)+C (Syms[B]=:+)*/\n int a = GETARG_A(i);\n\n /* need to check if + is overridden */\n switch (mrb_type(regs[a])) {\n case MRB_TT_FIXNUM:\n {\n mrb_int x = mrb_fixnum(regs[a]);\n mrb_int y = GETARG_C(i);\n mrb_int z;\n\n if (mrb_int_add_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x + (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs[a], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case MRB_TT_FLOAT:\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n SET_FLOAT_VALUE(mrb, regs[a], x + GETARG_C(i));\n }\n#else\n mrb_float(regs[a]) += GETARG_C(i);\n#endif\n break;\n#endif\n default:\n SET_INT_VALUE(regs[a+1], GETARG_C(i));\n i = MKOP_ABC(OP_SEND, a, GETARG_B(i), 1);\n goto L_SEND;\n }\n NEXT;\n }\n\n CASE(OP_SUBI) {\n /* A B C R(A) := R(A)-C (Syms[B]=:-)*/\n int a = GETARG_A(i);\n mrb_value *regs_a = regs + a;\n\n /* need to check if + is overridden */\n switch (mrb_type(regs_a[0])) {\n case MRB_TT_FIXNUM:\n {\n mrb_int x = mrb_fixnum(regs_a[0]);\n mrb_int y = GETARG_C(i);\n mrb_int z;\n\n if (mrb_int_sub_overflow(x, y, &z)) {\n#ifndef MRB_WITHOUT_FLOAT\n SET_FLOAT_VALUE(mrb, regs_a[0], (mrb_float)x - (mrb_float)y);\n break;\n#endif\n }\n SET_INT_VALUE(regs_a[0], z);\n }\n break;\n#ifndef MRB_WITHOUT_FLOAT\n case MRB_TT_FLOAT:\n#ifdef MRB_WORD_BOXING\n {\n mrb_float x = mrb_float(regs[a]);\n SET_FLOAT_VALUE(mrb, regs[a], x - GETARG_C(i));\n }\n#else\n mrb_float(regs_a[0]) -= GETARG_C(i);\n#endif\n break;\n#endif\n default:\n SET_INT_VALUE(regs_a[1], GETARG_C(i));\n i = MKOP_ABC(OP_SEND, a, GETARG_B(i), 1);\n goto L_SEND;\n }\n NEXT;\n }\n\n#define OP_CMP_BODY(op,v1,v2) (v1(regs[a]) op v2(regs[a+1]))\n\n#ifdef MRB_WITHOUT_FLOAT\n#define OP_CMP(op) do {\\\n int result;\\\n /* need to check if - is overridden */\\\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_fixnum);\\\n break;\\\n default:\\\n goto L_SEND;\\\n }\\\n if (result) {\\\n SET_TRUE_VALUE(regs[a]);\\\n }\\\n else {\\\n SET_FALSE_VALUE(regs[a]);\\\n }\\\n} while(0)\n#else\n#define OP_CMP(op) do {\\\n int result;\\\n /* need to check if - is overridden */\\\n switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_fixnum);\\\n break;\\\n case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):\\\n result = OP_CMP_BODY(op,mrb_fixnum,mrb_float);\\\n break;\\\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):\\\n result = OP_CMP_BODY(op,mrb_float,mrb_fixnum);\\\n break;\\\n case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):\\\n result = OP_CMP_BODY(op,mrb_float,mrb_float);\\\n break;\\\n default:\\\n goto L_SEND;\\\n }\\\n if (result) {\\\n SET_TRUE_VALUE(regs[a]);\\\n }\\\n else {\\\n SET_FALSE_VALUE(regs[a]);\\\n }\\\n} while(0)\n#endif\n\n CASE(OP_EQ) {\n /* A B C R(A) := R(A)==R(A+1) (Syms[B]=:==,C=1)*/\n int a = GETARG_A(i);\n if (mrb_obj_eq(mrb, regs[a], regs[a+1])) {\n SET_TRUE_VALUE(regs[a]);\n }\n else {\n OP_CMP(==);\n }\n NEXT;\n }\n\n CASE(OP_LT) {\n /* A B C R(A) := R(A)R(A+1) (Syms[B]=:>,C=1)*/\n int a = GETARG_A(i);\n OP_CMP(>);\n NEXT;\n }\n\n CASE(OP_GE) {\n /* A B C R(A) := R(A)>=R(A+1) (Syms[B]=:>=,C=1)*/\n int a = GETARG_A(i);\n OP_CMP(>=);\n NEXT;\n }\n\n CASE(OP_ARRAY) {\n /* A B C R(A) := ary_new(R(B),R(B+1)..R(B+C)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value v = mrb_ary_new_from_values(mrb, c, ®s[b]);\n regs[a] = v;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ARYCAT) {\n /* A B mrb_ary_concat(R(A),R(B)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n mrb_value splat = mrb_ary_splat(mrb, regs[b]);\n mrb_ary_concat(mrb, regs[a], splat);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_ARYPUSH) {\n /* A B R(A).push(R(B)) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n mrb_ary_push(mrb, regs[a], regs[b]);\n NEXT;\n }\n\n CASE(OP_AREF) {\n /* A B C R(A) := R(B)[C] */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_value v = regs[b];\n\n if (!mrb_array_p(v)) {\n if (c == 0) {\n regs[a] = v;\n }\n else {\n SET_NIL_VALUE(regs[a]);\n }\n }\n else {\n v = mrb_ary_ref(mrb, v, c);\n regs[a] = v;\n }\n NEXT;\n }\n\n CASE(OP_ASET) {\n /* A B C R(B)[C] := R(A) */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n int c = GETARG_C(i);\n mrb_ary_set(mrb, regs[b], c, regs[a]);\n NEXT;\n }\n\n CASE(OP_APOST) {\n /* A B C *R(A),R(A+1)..R(A+C) := R(A) */\n int a = GETARG_A(i);\n mrb_value v = regs[a];\n int pre = GETARG_B(i);\n int post = GETARG_C(i);\n struct RArray *ary;\n int len, idx;\n\n if (!mrb_array_p(v)) {\n v = mrb_ary_new_from_values(mrb, 1, ®s[a]);\n }\n ary = mrb_ary_ptr(v);\n len = (int)ARY_LEN(ary);\n if (len > pre + post) {\n v = mrb_ary_new_from_values(mrb, len - pre - post, ARY_PTR(ary)+pre);\n regs[a++] = v;\n while (post--) {\n regs[a++] = ARY_PTR(ary)[len-post-1];\n }\n }\n else {\n v = mrb_ary_new_capa(mrb, 0);\n regs[a++] = v;\n for (idx=0; idx+prereps[b];\n\n if (c & OP_L_CAPTURE) {\n p = mrb_closure_new(mrb, nirep);\n }\n else {\n p = mrb_proc_new(mrb, nirep);\n p->flags |= MRB_PROC_SCOPE;\n }\n if (c & OP_L_STRICT) p->flags |= MRB_PROC_STRICT;\n regs[a] = mrb_obj_value(p);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_OCLASS) {\n /* A R(A) := ::Object */\n regs[GETARG_A(i)] = mrb_obj_value(mrb->object_class);\n NEXT;\n }\n\n CASE(OP_CLASS) {\n /* A B R(A) := newclass(R(A),Syms(B),R(A+1)) */\n struct RClass *c = 0, *baseclass;\n int a = GETARG_A(i);\n mrb_value base, super;\n mrb_sym id = syms[GETARG_B(i)];\n\n base = regs[a];\n super = regs[a+1];\n if (mrb_nil_p(base)) {\n baseclass = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc);\n base = mrb_obj_value(baseclass);\n }\n c = mrb_vm_define_class(mrb, base, super, id);\n regs[a] = mrb_obj_value(c);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_MODULE) {\n /* A B R(A) := newmodule(R(A),Syms(B)) */\n struct RClass *c = 0, *baseclass;\n int a = GETARG_A(i);\n mrb_value base;\n mrb_sym id = syms[GETARG_B(i)];\n\n base = regs[a];\n if (mrb_nil_p(base)) {\n baseclass = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc);\n base = mrb_obj_value(baseclass);\n }\n c = mrb_vm_define_module(mrb, base, id);\n regs[a] = mrb_obj_value(c);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_EXEC) {\n /* A Bx R(A) := blockexec(R(A),SEQ[Bx]) */\n int a = GETARG_A(i);\n int bx = GETARG_Bx(i);\n mrb_callinfo *ci;\n mrb_value recv = regs[a];\n struct RProc *p;\n mrb_irep *nirep = irep->reps[bx];\n\n /* prepare closure */\n p = mrb_proc_new(mrb, nirep);\n p->c = NULL;\n mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)proc);\n MRB_PROC_SET_TARGET_CLASS(p, mrb_class_ptr(recv));\n p->flags |= MRB_PROC_SCOPE;\n\n /* prepare call stack */\n ci = cipush(mrb);\n ci->pc = pc + 1;\n ci->acc = a;\n ci->mid = 0;\n ci->stackent = mrb->c->stack;\n ci->argc = 0;\n ci->target_class = mrb_class_ptr(recv);\n\n /* prepare stack */\n mrb->c->stack += a;\n\n /* setup block to call */\n ci->proc = p;\n\n irep = p->body.irep;\n pool = irep->pool;\n syms = irep->syms;\n ci->nregs = irep->nregs;\n stack_extend(mrb, ci->nregs);\n stack_clear(regs+1, ci->nregs-1);\n pc = irep->iseq;\n JUMP;\n }\n\n CASE(OP_METHOD) {\n /* A B R(A).newmethod(Syms(B),R(A+1)) */\n int a = GETARG_A(i);\n struct RClass *c = mrb_class_ptr(regs[a]);\n struct RProc *p = mrb_proc_ptr(regs[a+1]);\n mrb_method_t m;\n\n MRB_METHOD_FROM_PROC(m, p);\n mrb_define_method_raw(mrb, c, syms[GETARG_B(i)], m);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_SCLASS) {\n /* A B R(A) := R(B).singleton_class */\n int a = GETARG_A(i);\n int b = GETARG_B(i);\n\n regs[a] = mrb_singleton_class(mrb, regs[b]);\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_TCLASS) {\n /* A R(A) := target_class */\n if (!mrb->c->ci->target_class) {\n mrb_value exc = mrb_exc_new_str_lit(mrb, E_TYPE_ERROR, \"no target class or module\");\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n regs[GETARG_A(i)] = mrb_obj_value(mrb->c->ci->target_class);\n NEXT;\n }\n\n CASE(OP_RANGE) {\n /* A B C R(A) := range_new(R(B),R(B+1),C) */\n int b = GETARG_B(i);\n mrb_value val = mrb_range_new(mrb, regs[b], regs[b+1], GETARG_C(i));\n regs[GETARG_A(i)] = val;\n mrb_gc_arena_restore(mrb, ai);\n NEXT;\n }\n\n CASE(OP_DEBUG) {\n /* A B C debug print R(A),R(B),R(C) */\n#ifdef MRB_ENABLE_DEBUG_HOOK\n mrb->debug_op_hook(mrb, irep, pc, regs);\n#else\n#ifndef MRB_DISABLE_STDIO\n printf(\"OP_DEBUG %d %d %d\\n\", GETARG_A(i), GETARG_B(i), GETARG_C(i));\n#else\n abort();\n#endif\n#endif\n NEXT;\n }\n\n CASE(OP_STOP) {\n /* stop VM */\n L_STOP:\n while (mrb->c->eidx > 0) {\n ecall(mrb);\n }\n ERR_PC_CLR(mrb);\n mrb->jmp = prev_jmp;\n if (mrb->exc) {\n return mrb_obj_value(mrb->exc);\n }\n return regs[irep->nlocals];\n }\n\n CASE(OP_ERR) {\n /* Bx raise RuntimeError with message Lit(Bx) */\n mrb_value msg = mrb_str_dup(mrb, pool[GETARG_Bx(i)]);\n mrb_value exc;\n\n if (GETARG_A(i) == 0) {\n exc = mrb_exc_new_str(mrb, E_RUNTIME_ERROR, msg);\n }\n else {\n exc = mrb_exc_new_str(mrb, E_LOCALJUMP_ERROR, msg);\n }\n ERR_PC_SET(mrb, pc);\n mrb_exc_set(mrb, exc);\n goto L_RAISE;\n }\n }\n END_DISPATCH;\n#undef regs\n\n }\n MRB_CATCH(&c_jmp) {\n exc_catched = TRUE;\n goto RETRY_TRY_BLOCK;\n }\n MRB_END_EXC(&c_jmp);\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"mrb_vm_exec","file_name":"src/vm.c","commit_link":"github.com/mruby/mruby/commit/1905091634a6a2925c911484434448e568330626","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#44-8d0abf8ced87","input":"static void *__ns_get_path(struct path *path, struct ns_common *ns)\n{\n\tstruct vfsmount *mnt = nsfs_mnt;\n\tstruct qstr qname = { .name = \"\", };\n\tstruct dentry *dentry;\n\tstruct inode *inode;\n\tunsigned long d;\n\n\trcu_read_lock();\n\td = atomic_long_read(&ns->stashed);\n\tif (!d)\n\t\tgoto slow;\n\tdentry = (struct dentry *)d;\n\tif (!lockref_get_not_dead(&dentry->d_lockref))\n\t\tgoto slow;\n\trcu_read_unlock();\n\tns->ops->put(ns);\ngot_it:\n\tpath->mnt = mntget(mnt);\n\tpath->dentry = dentry;\n\treturn NULL;\nslow:\n\trcu_read_unlock();\n\tinode = new_inode_pseudo(mnt->mnt_sb);\n\tif (!inode) {\n\t\tns->ops->put(ns);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}\n\tinode->i_ino = ns->inum;\n\tinode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);\n\tinode->i_flags |= S_IMMUTABLE;\n\tinode->i_mode = S_IFREG | S_IRUGO;\n\tinode->i_fop = &ns_file_operations;\n\tinode->i_private = ns;\n\n\tdentry = d_alloc_pseudo(mnt->mnt_sb, &qname);\n\tif (!dentry) {\n\t\tiput(inode);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}\n\td_instantiate(dentry, inode);\n\tdentry->d_fsdata = (void *)ns->ops;\n\td = atomic_long_cmpxchg(&ns->stashed, 0, (unsigned long)dentry);\n\tif (d) {\n\t\td_delete(dentry);\t/* make sure ->d_prune() does nothing */\n\t\tdput(dentry);\n\t\tcpu_relax();\n\t\treturn ERR_PTR(-EAGAIN);\n\t}\n\tgoto got_it;\n}","target":"static void *__ns_get_path(struct path *path, struct ns_common *ns)\n{\n\tstruct vfsmount *mnt = nsfs_mnt;\n\tstruct qstr qname = { .name = \"\", };\n\tstruct dentry *dentry;\n\tstruct inode *inode;\n\tunsigned long d;\n\n\trcu_read_lock();\n\td = atomic_long_read(&ns->stashed);\n\tif (!d)\n\t\tgoto slow;\n\tdentry = (struct dentry *)d;\n\tif (!lockref_get_not_dead(&dentry->d_lockref))\n\t\tgoto slow;\n\trcu_read_unlock();\n\tns->ops->put(ns);\ngot_it:\n\tpath->mnt = mntget(mnt);\n\tpath->dentry = dentry;\n\treturn NULL;\nslow:\n\trcu_read_unlock();\n\tinode = new_inode_pseudo(mnt->mnt_sb);\n\tif (!inode) {\n\t\tns->ops->put(ns);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}\n\tinode->i_ino = ns->inum;\n\tinode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);\n\tinode->i_flags |= S_IMMUTABLE;\n\tinode->i_mode = S_IFREG | S_IRUGO;\n\tinode->i_fop = &ns_file_operations;\n\tinode->i_private = ns;\n\n\tdentry = d_alloc_pseudo(mnt->mnt_sb, &qname);\n\tif (!dentry) {\n\t\tiput(inode);\n\t\treturn ERR_PTR(-ENOMEM);\n\t}\n\td_instantiate(dentry, inode);\n\tdentry->d_flags |= DCACHE_RCUACCESS;\n\tdentry->d_fsdata = (void *)ns->ops;\n\td = atomic_long_cmpxchg(&ns->stashed, 0, (unsigned long)dentry);\n\tif (d) {\n\t\td_delete(dentry);\t/* make sure ->d_prune() does nothing */\n\t\tdput(dentry);\n\t\tcpu_relax();\n\t\treturn ERR_PTR(-EAGAIN);\n\t}\n\tgoto got_it;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"__ns_get_path","file_name":"fs/nsfs.c","commit_link":"github.com/torvalds/linux/commit/073c516ff73557a8f7315066856c04b50383ac34","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#45-e7f448494cd5","input":"PHP_FUNCTION(unserialize)\n{\n\tchar *buf = NULL;\n\tsize_t buf_len;\n\tconst unsigned char *p;\n\tphp_unserialize_data_t var_hash;\n\tzval *options = NULL, *classes = NULL;\n\tHashTable *class_hash = NULL;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS(), \"s|a\", &buf, &buf_len, &options) == FAILURE) {\n\t\tRETURN_FALSE;\n\t}\n\n\tif (buf_len == 0) {\n\t\tRETURN_FALSE;\n\t}\n\n\tp = (const unsigned char*) buf;\n\tPHP_VAR_UNSERIALIZE_INIT(var_hash);\n\tif(options != NULL) {\n\t\tclasses = zend_hash_str_find(Z_ARRVAL_P(options), \"allowed_classes\", sizeof(\"allowed_classes\")-1);\n\t\tif(classes && (Z_TYPE_P(classes) == IS_ARRAY || !zend_is_true(classes))) {\n\t\t\tALLOC_HASHTABLE(class_hash);\n\t\t\tzend_hash_init(class_hash, (Z_TYPE_P(classes) == IS_ARRAY)?zend_hash_num_elements(Z_ARRVAL_P(classes)):0, NULL, NULL, 0);\n\t\t}\n\t\tif(class_hash && Z_TYPE_P(classes) == IS_ARRAY) {\n\t\t\tzval *entry;\n\t\t\tzend_string *lcname;\n\n\t\t\tZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(classes), entry) {\n\t\t\t\tconvert_to_string_ex(entry);\n\t\t\t\tlcname = zend_string_tolower(Z_STR_P(entry));\n\t\t\t\tzend_hash_add_empty_element(class_hash, lcname);\n\t\t zend_string_release(lcname);\n\t\t\t} ZEND_HASH_FOREACH_END();\n\t\t}\n\t}\n\n\tif (!php_var_unserialize_ex(return_value, &p, p + buf_len, &var_hash, class_hash)) {\n\t\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\t\tif (class_hash) {\n\t\t\tzend_hash_destroy(class_hash);\n\t\t\tFREE_HASHTABLE(class_hash);\n\t\t}\n\t\tzval_ptr_dtor(return_value);\n\t\tif (!EG(exception)) {\n\t\t\tphp_error_docref(NULL, E_NOTICE, \"Error at offset \" ZEND_LONG_FMT \" of %zd bytes\",\n\t\t\t\t(zend_long)((char*)p - buf), buf_len);\n\t\t}\n\t\tRETURN_FALSE;\n\t}\n\t/* We should keep an reference to return_value to prevent it from being dtor\n\t in case nesting calls to unserialize */\n\tvar_push_dtor(&var_hash, return_value);\n\n\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\tif (class_hash) {\n\t\tzend_hash_destroy(class_hash);\n\t\tFREE_HASHTABLE(class_hash);\n\t}\n}","target":"PHP_FUNCTION(unserialize)\n{\n\tchar *buf = NULL;\n\tsize_t buf_len;\n\tconst unsigned char *p;\n\tphp_unserialize_data_t var_hash;\n\tzval *options = NULL, *classes = NULL;\n\tzval *retval;\n\tHashTable *class_hash = NULL;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS(), \"s|a\", &buf, &buf_len, &options) == FAILURE) {\n\t\tRETURN_FALSE;\n\t}\n\n\tif (buf_len == 0) {\n\t\tRETURN_FALSE;\n\t}\n\n\tp = (const unsigned char*) buf;\n\tPHP_VAR_UNSERIALIZE_INIT(var_hash);\n\tif(options != NULL) {\n\t\tclasses = zend_hash_str_find(Z_ARRVAL_P(options), \"allowed_classes\", sizeof(\"allowed_classes\")-1);\n\t\tif(classes && (Z_TYPE_P(classes) == IS_ARRAY || !zend_is_true(classes))) {\n\t\t\tALLOC_HASHTABLE(class_hash);\n\t\t\tzend_hash_init(class_hash, (Z_TYPE_P(classes) == IS_ARRAY)?zend_hash_num_elements(Z_ARRVAL_P(classes)):0, NULL, NULL, 0);\n\t\t}\n\t\tif(class_hash && Z_TYPE_P(classes) == IS_ARRAY) {\n\t\t\tzval *entry;\n\t\t\tzend_string *lcname;\n\n\t\t\tZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(classes), entry) {\n\t\t\t\tconvert_to_string_ex(entry);\n\t\t\t\tlcname = zend_string_tolower(Z_STR_P(entry));\n\t\t\t\tzend_hash_add_empty_element(class_hash, lcname);\n\t\t zend_string_release(lcname);\n\t\t\t} ZEND_HASH_FOREACH_END();\n\t\t}\n\t}\n\n\tretval = var_tmp_var(&var_hash);\n\tif (!php_var_unserialize_ex(retval, &p, p + buf_len, &var_hash, class_hash)) {\n\t\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\t\tif (class_hash) {\n\t\t\tzend_hash_destroy(class_hash);\n\t\t\tFREE_HASHTABLE(class_hash);\n\t\t}\n\t\tif (!EG(exception)) {\n\t\t\tphp_error_docref(NULL, E_NOTICE, \"Error at offset \" ZEND_LONG_FMT \" of %zd bytes\",\n\t\t\t\t(zend_long)((char*)p - buf), buf_len);\n\t\t}\n\t\tRETURN_FALSE;\n\t}\n\n\tZVAL_COPY(return_value, retval);\n\n\tPHP_VAR_UNSERIALIZE_DESTROY(var_hash);\n\tif (class_hash) {\n\t\tzend_hash_destroy(class_hash);\n\t\tFREE_HASHTABLE(class_hash);\n\t}\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"PHP_FUNCTION","file_name":"ext/standard/var.c","commit_link":"github.com/php/php-src/commit/b2af4e8868726a040234de113436c6e4f6372d17","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#46-95fbddccd7dd","input":"static MagickBooleanType TraceBezier(MVGInfo *mvg_info,\n const size_t number_coordinates)\n{\n double\n alpha,\n *coefficients,\n weight;\n\n PointInfo\n end,\n point,\n *points;\n\n PrimitiveInfo\n *primitive_info;\n\n register PrimitiveInfo\n *p;\n\n register ssize_t\n i,\n j;\n\n size_t\n control_points,\n quantum;\n\n /*\n Allocate coefficients.\n */\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n quantum=number_coordinates;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n {\n for (j=i+1; j < (ssize_t) number_coordinates; j++)\n {\n alpha=fabs(primitive_info[j].point.x-primitive_info[i].point.x);\n if (alpha > (double) SSIZE_MAX)\n {\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n if (alpha > (double) quantum)\n quantum=(size_t) alpha;\n alpha=fabs(primitive_info[j].point.y-primitive_info[i].point.y);\n if (alpha > (double) SSIZE_MAX)\n {\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n if (alpha > (double) quantum)\n quantum=(size_t) alpha;\n }\n }\n quantum=MagickMin(quantum/number_coordinates,BezierQuantum);\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n coefficients=(double *) AcquireQuantumMemory(number_coordinates,\n sizeof(*coefficients));\n points=(PointInfo *) AcquireQuantumMemory(quantum,number_coordinates*\n sizeof(*points));\n if ((coefficients == (double *) NULL) || (points == (PointInfo *) NULL))\n {\n if (points != (PointInfo *) NULL)\n points=(PointInfo *) RelinquishMagickMemory(points);\n if (coefficients != (double *) NULL)\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n control_points=quantum*number_coordinates;\n if (CheckPrimitiveExtent(mvg_info,control_points+1) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n /*\n Compute bezier points.\n */\n end=primitive_info[number_coordinates-1].point;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n coefficients[i]=Permutate((ssize_t) number_coordinates-1,i);\n weight=0.0;\n for (i=0; i < (ssize_t) control_points; i++)\n {\n p=primitive_info;\n point.x=0.0;\n point.y=0.0;\n alpha=pow((double) (1.0-weight),(double) number_coordinates-1.0);\n for (j=0; j < (ssize_t) number_coordinates; j++)\n {\n point.x+=alpha*coefficients[j]*p->point.x;\n point.y+=alpha*coefficients[j]*p->point.y;\n alpha*=weight/(1.0-weight);\n p++;\n }\n points[i]=point;\n weight+=1.0/control_points;\n }\n /*\n Bezier curves are just short segmented polys.\n */\n p=primitive_info;\n for (i=0; i < (ssize_t) control_points; i++)\n {\n if (TracePoint(p,points[i]) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n p+=p->coordinates;\n }\n if (TracePoint(p,end) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n p+=p->coordinates;\n primitive_info->coordinates=(size_t) (p-primitive_info);\n primitive_info->closed_subpath=MagickFalse;\n for (i=0; i < (ssize_t) primitive_info->coordinates; i++)\n {\n p->primitive=primitive_info->primitive;\n p--;\n }\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickTrue);\n}","target":"static MagickBooleanType TraceBezier(MVGInfo *mvg_info,\n const size_t number_coordinates)\n{\n double\n alpha,\n *coefficients,\n weight;\n\n PointInfo\n end,\n point,\n *points;\n\n PrimitiveInfo\n *primitive_info;\n\n register PrimitiveInfo\n *p;\n\n register ssize_t\n i,\n j;\n\n size_t\n control_points,\n quantum;\n\n /*\n Allocate coefficients.\n */\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n quantum=number_coordinates;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n {\n for (j=i+1; j < (ssize_t) number_coordinates; j++)\n {\n alpha=fabs(primitive_info[j].point.x-primitive_info[i].point.x);\n if (alpha > (double) SSIZE_MAX)\n {\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n if (alpha > (double) quantum)\n quantum=(size_t) alpha;\n alpha=fabs(primitive_info[j].point.y-primitive_info[i].point.y);\n if (alpha > (double) SSIZE_MAX)\n {\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n if (alpha > (double) quantum)\n quantum=(size_t) alpha;\n }\n }\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n quantum=MagickMin(quantum/number_coordinates,BezierQuantum);\n coefficients=(double *) AcquireQuantumMemory(number_coordinates,\n sizeof(*coefficients));\n points=(PointInfo *) AcquireQuantumMemory(quantum,number_coordinates*\n sizeof(*points));\n if ((coefficients == (double *) NULL) || (points == (PointInfo *) NULL))\n {\n if (points != (PointInfo *) NULL)\n points=(PointInfo *) RelinquishMagickMemory(points);\n if (coefficients != (double *) NULL)\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n control_points=quantum*number_coordinates;\n if (CheckPrimitiveExtent(mvg_info,control_points+1) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n /*\n Compute bezier points.\n */\n end=primitive_info[number_coordinates-1].point;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n coefficients[i]=Permutate((ssize_t) number_coordinates-1,i);\n weight=0.0;\n for (i=0; i < (ssize_t) control_points; i++)\n {\n p=primitive_info;\n point.x=0.0;\n point.y=0.0;\n alpha=pow((double) (1.0-weight),(double) number_coordinates-1.0);\n for (j=0; j < (ssize_t) number_coordinates; j++)\n {\n point.x+=alpha*coefficients[j]*p->point.x;\n point.y+=alpha*coefficients[j]*p->point.y;\n alpha*=weight/(1.0-weight);\n p++;\n }\n points[i]=point;\n weight+=1.0/control_points;\n }\n /*\n Bezier curves are just short segmented polys.\n */\n p=primitive_info;\n for (i=0; i < (ssize_t) control_points; i++)\n {\n if (TracePoint(p,points[i]) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n p+=p->coordinates;\n }\n if (TracePoint(p,end) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n p+=p->coordinates;\n primitive_info->coordinates=(size_t) (p-primitive_info);\n primitive_info->closed_subpath=MagickFalse;\n for (i=0; i < (ssize_t) primitive_info->coordinates; i++)\n {\n p->primitive=primitive_info->primitive;\n p--;\n }\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"TraceBezier","file_name":"MagickCore/draw.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/ecf7c6b288e11e7e7f75387c5e9e93e423b98397","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#47-a7f7a11bdb20","input":"static int parse_playlist(HLSContext *c, const char *url,\n struct playlist *pls, AVIOContext *in)\n{\n int ret = 0, is_segment = 0, is_variant = 0;\n int64_t duration = 0;\n enum KeyType key_type = KEY_NONE;\n uint8_t iv[16] = \"\";\n int has_iv = 0;\n char key[MAX_URL_SIZE] = \"\";\n char line[MAX_URL_SIZE];\n const char *ptr;\n int close_in = 0;\n int64_t seg_offset = 0;\n int64_t seg_size = -1;\n uint8_t *new_url = NULL;\n struct variant_info variant_info;\n char tmp_str[MAX_URL_SIZE];\n struct segment *cur_init_section = NULL;\n\n if (!in) {\n#if 1\n AVDictionary *opts = NULL;\n close_in = 1;\n /* Some HLS servers don't like being sent the range header */\n av_dict_set(&opts, \"seekable\", \"0\", 0);\n\n // broker prior HTTP options that should be consistent across requests\n av_dict_set(&opts, \"user-agent\", c->user_agent, 0);\n av_dict_set(&opts, \"cookies\", c->cookies, 0);\n av_dict_set(&opts, \"headers\", c->headers, 0);\n\n ret = avio_open2(&in, url, AVIO_FLAG_READ,\n c->interrupt_callback, &opts);\n av_dict_free(&opts);\n if (ret < 0)\n return ret;\n#else\n ret = open_in(c, &in, url);\n if (ret < 0)\n return ret;\n close_in = 1;\n#endif\n }\n\n if (av_opt_get(in, \"location\", AV_OPT_SEARCH_CHILDREN, &new_url) >= 0)\n url = new_url;\n\n read_chomp_line(in, line, sizeof(line));\n if (strcmp(line, \"#EXTM3U\")) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n if (pls) {\n free_segment_list(pls);\n pls->finished = 0;\n pls->type = PLS_TYPE_UNSPECIFIED;\n }\n while (!avio_feof(in)) {\n read_chomp_line(in, line, sizeof(line));\n if (av_strstart(line, \"#EXT-X-STREAM-INF:\", &ptr)) {\n is_variant = 1;\n memset(&variant_info, 0, sizeof(variant_info));\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,\n &variant_info);\n } else if (av_strstart(line, \"#EXT-X-KEY:\", &ptr)) {\n struct key_info info = {{0}};\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_key_args,\n &info);\n key_type = KEY_NONE;\n has_iv = 0;\n if (!strcmp(info.method, \"AES-128\"))\n key_type = KEY_AES_128;\n if (!strcmp(info.method, \"SAMPLE-AES\"))\n key_type = KEY_SAMPLE_AES;\n if (!strncmp(info.iv, \"0x\", 2) || !strncmp(info.iv, \"0X\", 2)) {\n ff_hex_to_data(iv, info.iv + 2);\n has_iv = 1;\n }\n av_strlcpy(key, info.uri, sizeof(key));\n } else if (av_strstart(line, \"#EXT-X-MEDIA:\", &ptr)) {\n struct rendition_info info = {{0}};\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_rendition_args,\n &info);\n new_rendition(c, &info, url);\n } else if (av_strstart(line, \"#EXT-X-TARGETDURATION:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n pls->target_duration = atoi(ptr) * AV_TIME_BASE;\n } else if (av_strstart(line, \"#EXT-X-MEDIA-SEQUENCE:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n pls->start_seq_no = atoi(ptr);\n } else if (av_strstart(line, \"#EXT-X-PLAYLIST-TYPE:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n if (!strcmp(ptr, \"EVENT\"))\n pls->type = PLS_TYPE_EVENT;\n else if (!strcmp(ptr, \"VOD\"))\n pls->type = PLS_TYPE_VOD;\n } else if (av_strstart(line, \"#EXT-X-MAP:\", &ptr)) {\n struct init_section_info info = {{0}};\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_init_section_args,\n &info);\n cur_init_section = new_init_section(pls, &info, url);\n } else if (av_strstart(line, \"#EXT-X-ENDLIST\", &ptr)) {\n if (pls)\n pls->finished = 1;\n } else if (av_strstart(line, \"#EXTINF:\", &ptr)) {\n is_segment = 1;\n duration = atof(ptr) * AV_TIME_BASE;\n } else if (av_strstart(line, \"#EXT-X-BYTERANGE:\", &ptr)) {\n seg_size = atoi(ptr);\n ptr = strchr(ptr, '@');\n if (ptr)\n seg_offset = atoi(ptr+1);\n } else if (av_strstart(line, \"#\", NULL)) {\n continue;\n } else if (line[0]) {\n if (is_variant) {\n if (!new_variant(c, &variant_info, line, url)) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n is_variant = 0;\n }\n if (is_segment) {\n struct segment *seg;\n if (!pls) {\n if (!new_variant(c, 0, url, NULL)) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n pls = c->playlists[c->n_playlists - 1];\n }\n seg = av_malloc(sizeof(struct segment));\n if (!seg) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n seg->duration = duration;\n seg->key_type = key_type;\n if (has_iv) {\n memcpy(seg->iv, iv, sizeof(iv));\n } else {\n int seq = pls->start_seq_no + pls->n_segments;\n memset(seg->iv, 0, sizeof(seg->iv));\n AV_WB32(seg->iv + 12, seq);\n }\n\n if (key_type != KEY_NONE) {\n ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, key);\n seg->key = av_strdup(tmp_str);\n if (!seg->key) {\n av_free(seg);\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n } else {\n seg->key = NULL;\n }\n\n ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, line);\n seg->url = av_strdup(tmp_str);\n if (!seg->url) {\n av_free(seg->key);\n av_free(seg);\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n\n dynarray_add(&pls->segments, &pls->n_segments, seg);\n is_segment = 0;\n\n seg->size = seg_size;\n if (seg_size >= 0) {\n seg->url_offset = seg_offset;\n seg_offset += seg_size;\n seg_size = -1;\n } else {\n seg->url_offset = 0;\n seg_offset = 0;\n }\n\n seg->init_section = cur_init_section;\n }\n }\n }\n if (pls)\n pls->last_load_time = av_gettime_relative();\n\nfail:\n av_free(new_url);\n if (close_in)\n avio_close(in);\n return ret;\n}","target":"static int parse_playlist(HLSContext *c, const char *url,\n struct playlist *pls, AVIOContext *in)\n{\n int ret = 0, is_segment = 0, is_variant = 0;\n int64_t duration = 0;\n enum KeyType key_type = KEY_NONE;\n uint8_t iv[16] = \"\";\n int has_iv = 0;\n char key[MAX_URL_SIZE] = \"\";\n char line[MAX_URL_SIZE];\n const char *ptr;\n int close_in = 0;\n int64_t seg_offset = 0;\n int64_t seg_size = -1;\n uint8_t *new_url = NULL;\n struct variant_info variant_info;\n char tmp_str[MAX_URL_SIZE];\n struct segment *cur_init_section = NULL;\n\n if (!in) {\n#if 1\n AVDictionary *opts = NULL;\n close_in = 1;\n /* Some HLS servers don't like being sent the range header */\n av_dict_set(&opts, \"seekable\", \"0\", 0);\n\n // broker prior HTTP options that should be consistent across requests\n av_dict_set(&opts, \"user-agent\", c->user_agent, 0);\n av_dict_set(&opts, \"cookies\", c->cookies, 0);\n av_dict_set(&opts, \"headers\", c->headers, 0);\n\n ret = avio_open2(&in, url, AVIO_FLAG_READ,\n c->interrupt_callback, &opts);\n av_dict_free(&opts);\n if (ret < 0)\n return ret;\n#else\n ret = open_in(c, &in, url);\n if (ret < 0)\n return ret;\n close_in = 1;\n#endif\n }\n\n if (av_opt_get(in, \"location\", AV_OPT_SEARCH_CHILDREN, &new_url) >= 0)\n url = new_url;\n\n read_chomp_line(in, line, sizeof(line));\n if (strcmp(line, \"#EXTM3U\")) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n if (pls) {\n free_segment_list(pls);\n pls->finished = 0;\n pls->type = PLS_TYPE_UNSPECIFIED;\n }\n while (!avio_feof(in)) {\n read_chomp_line(in, line, sizeof(line));\n if (av_strstart(line, \"#EXT-X-STREAM-INF:\", &ptr)) {\n is_variant = 1;\n memset(&variant_info, 0, sizeof(variant_info));\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,\n &variant_info);\n } else if (av_strstart(line, \"#EXT-X-KEY:\", &ptr)) {\n struct key_info info = {{0}};\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_key_args,\n &info);\n key_type = KEY_NONE;\n has_iv = 0;\n if (!strcmp(info.method, \"AES-128\"))\n key_type = KEY_AES_128;\n if (!strcmp(info.method, \"SAMPLE-AES\"))\n key_type = KEY_SAMPLE_AES;\n if (!strncmp(info.iv, \"0x\", 2) || !strncmp(info.iv, \"0X\", 2)) {\n ff_hex_to_data(iv, info.iv + 2);\n has_iv = 1;\n }\n av_strlcpy(key, info.uri, sizeof(key));\n } else if (av_strstart(line, \"#EXT-X-MEDIA:\", &ptr)) {\n struct rendition_info info = {{0}};\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_rendition_args,\n &info);\n new_rendition(c, &info, url);\n } else if (av_strstart(line, \"#EXT-X-TARGETDURATION:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n pls->target_duration = atoi(ptr) * AV_TIME_BASE;\n } else if (av_strstart(line, \"#EXT-X-MEDIA-SEQUENCE:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n pls->start_seq_no = atoi(ptr);\n } else if (av_strstart(line, \"#EXT-X-PLAYLIST-TYPE:\", &ptr)) {\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n if (!strcmp(ptr, \"EVENT\"))\n pls->type = PLS_TYPE_EVENT;\n else if (!strcmp(ptr, \"VOD\"))\n pls->type = PLS_TYPE_VOD;\n } else if (av_strstart(line, \"#EXT-X-MAP:\", &ptr)) {\n struct init_section_info info = {{0}};\n ret = ensure_playlist(c, &pls, url);\n if (ret < 0)\n goto fail;\n ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_init_section_args,\n &info);\n cur_init_section = new_init_section(pls, &info, url);\n } else if (av_strstart(line, \"#EXT-X-ENDLIST\", &ptr)) {\n if (pls)\n pls->finished = 1;\n } else if (av_strstart(line, \"#EXTINF:\", &ptr)) {\n is_segment = 1;\n duration = atof(ptr) * AV_TIME_BASE;\n } else if (av_strstart(line, \"#EXT-X-BYTERANGE:\", &ptr)) {\n seg_size = atoi(ptr);\n ptr = strchr(ptr, '@');\n if (ptr)\n seg_offset = atoi(ptr+1);\n } else if (av_strstart(line, \"#\", NULL)) {\n continue;\n } else if (line[0]) {\n if (is_variant) {\n if (!new_variant(c, &variant_info, line, url)) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n is_variant = 0;\n }\n if (is_segment) {\n struct segment *seg;\n if (!pls) {\n if (!new_variant(c, 0, url, NULL)) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n pls = c->playlists[c->n_playlists - 1];\n }\n seg = av_malloc(sizeof(struct segment));\n if (!seg) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n if (has_iv) {\n memcpy(seg->iv, iv, sizeof(iv));\n } else {\n int seq = pls->start_seq_no + pls->n_segments;\n memset(seg->iv, 0, sizeof(seg->iv));\n AV_WB32(seg->iv + 12, seq);\n }\n\n if (key_type != KEY_NONE) {\n ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, key);\n seg->key = av_strdup(tmp_str);\n if (!seg->key) {\n av_free(seg);\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n } else {\n seg->key = NULL;\n }\n\n ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, line);\n seg->url = av_strdup(tmp_str);\n if (!seg->url) {\n av_free(seg->key);\n av_free(seg);\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n\n if (duration < 0.001 * AV_TIME_BASE) {\n duration = 0.001 * AV_TIME_BASE;\n }\n seg->duration = duration;\n seg->key_type = key_type;\n dynarray_add(&pls->segments, &pls->n_segments, seg);\n is_segment = 0;\n\n seg->size = seg_size;\n if (seg_size >= 0) {\n seg->url_offset = seg_offset;\n seg_offset += seg_size;\n seg_size = -1;\n } else {\n seg->url_offset = 0;\n seg_offset = 0;\n }\n\n seg->init_section = cur_init_section;\n }\n }\n }\n if (pls)\n pls->last_load_time = av_gettime_relative();\n\nfail:\n av_free(new_url);\n if (close_in)\n avio_close(in);\n return ret;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"parse_playlist","file_name":"libavformat/hls.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/6959358683c7533f586c07a766acc5fe9544d8b2","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#48-1b92d67df79b","input":"struct net *get_net_ns_by_id(struct net *net, int id)\n{\n\tstruct net *peer;\n\n\tif (id < 0)\n\t\treturn NULL;\n\n\trcu_read_lock();\n\tspin_lock_bh(&net->nsid_lock);\n\tpeer = idr_find(&net->netns_ids, id);\n\tif (peer)\n\t\tget_net(peer);\n\tspin_unlock_bh(&net->nsid_lock);\n\trcu_read_unlock();\n\n\treturn peer;\n}","target":"struct net *get_net_ns_by_id(struct net *net, int id)\n{\n\tstruct net *peer;\n\n\tif (id < 0)\n\t\treturn NULL;\n\n\trcu_read_lock();\n\tspin_lock_bh(&net->nsid_lock);\n\tpeer = idr_find(&net->netns_ids, id);\n\tif (peer)\n\t\tpeer = maybe_get_net(peer);\n\tspin_unlock_bh(&net->nsid_lock);\n\trcu_read_unlock();\n\n\treturn peer;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"get_net_ns_by_id","file_name":"net/core/net_namespace.c","commit_link":"github.com/torvalds/linux/commit/21b5944350052d2583e82dd59b19a9ba94a007f0","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#49-c723aaeff572","input":"static int usb_audio_probe(struct usb_interface *intf,\n\t\t\t const struct usb_device_id *usb_id)\n{\n\tstruct usb_device *dev = interface_to_usbdev(intf);\n\tconst struct snd_usb_audio_quirk *quirk =\n\t\t(const struct snd_usb_audio_quirk *)usb_id->driver_info;\n\tstruct snd_usb_audio *chip;\n\tint i, err;\n\tstruct usb_host_interface *alts;\n\tint ifnum;\n\tu32 id;\n\n\talts = &intf->altsetting[0];\n\tifnum = get_iface_desc(alts)->bInterfaceNumber;\n\tid = USB_ID(le16_to_cpu(dev->descriptor.idVendor),\n\t\t le16_to_cpu(dev->descriptor.idProduct));\n\tif (get_alias_id(dev, &id))\n\t\tquirk = get_alias_quirk(dev, id);\n\tif (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)\n\t\treturn -ENXIO;\n\n\terr = snd_usb_apply_boot_quirk(dev, intf, quirk, id);\n\tif (err < 0)\n\t\treturn err;\n\n\t/*\n\t * found a config. now register to ALSA\n\t */\n\n\t/* check whether it's already registered */\n\tchip = NULL;\n\tmutex_lock(®ister_mutex);\n\tfor (i = 0; i < SNDRV_CARDS; i++) {\n\t\tif (usb_chip[i] && usb_chip[i]->dev == dev) {\n\t\t\tif (atomic_read(&usb_chip[i]->shutdown)) {\n\t\t\t\tdev_err(&dev->dev, \"USB device is in the shutdown state, cannot create a card instance\\n\");\n\t\t\t\terr = -EIO;\n\t\t\t\tgoto __error;\n\t\t\t}\n\t\t\tchip = usb_chip[i];\n\t\t\tatomic_inc(&chip->active); /* avoid autopm */\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (! chip) {\n\t\t/* it's a fresh one.\n\t\t * now look for an empty slot and create a new card instance\n\t\t */\n\t\tfor (i = 0; i < SNDRV_CARDS; i++)\n\t\t\tif (!usb_chip[i] &&\n\t\t\t (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) &&\n\t\t\t (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) {\n\t\t\t\tif (enable[i]) {\n\t\t\t\t\terr = snd_usb_audio_create(intf, dev, i, quirk,\n\t\t\t\t\t\t\t\t id, &chip);\n\t\t\t\t\tif (err < 0)\n\t\t\t\t\t\tgoto __error;\n\t\t\t\t\tchip->pm_intf = intf;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (vid[i] != -1 || pid[i] != -1) {\n\t\t\t\t\tdev_info(&dev->dev,\n\t\t\t\t\t\t \"device (%04x:%04x) is disabled\\n\",\n\t\t\t\t\t\t USB_ID_VENDOR(id),\n\t\t\t\t\t\t USB_ID_PRODUCT(id));\n\t\t\t\t\terr = -ENOENT;\n\t\t\t\t\tgoto __error;\n\t\t\t\t}\n\t\t\t}\n\t\tif (!chip) {\n\t\t\tdev_err(&dev->dev, \"no available usb audio device\\n\");\n\t\t\terr = -ENODEV;\n\t\t\tgoto __error;\n\t\t}\n\t}\n\tdev_set_drvdata(&dev->dev, chip);\n\n\t/*\n\t * For devices with more than one control interface, we assume the\n\t * first contains the audio controls. We might need a more specific\n\t * check here in the future.\n\t */\n\tif (!chip->ctrl_intf)\n\t\tchip->ctrl_intf = alts;\n\n\tchip->txfr_quirk = 0;\n\terr = 1; /* continue */\n\tif (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {\n\t\t/* need some special handlings */\n\t\terr = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\tif (err > 0) {\n\t\t/* create normal USB audio interfaces */\n\t\terr = snd_usb_create_streams(chip, ifnum);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t\terr = snd_usb_create_mixer(chip, ifnum, ignore_ctl_error);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\t/* we are allowed to call snd_card_register() many times */\n\terr = snd_card_register(chip->card);\n\tif (err < 0)\n\t\tgoto __error;\n\n\tusb_chip[chip->index] = chip;\n\tchip->num_interfaces++;\n\tusb_set_intfdata(intf, chip);\n\tatomic_dec(&chip->active);\n\tmutex_unlock(®ister_mutex);\n\treturn 0;\n\n __error:\n\tif (chip) {\n\t\tif (!chip->num_interfaces)\n\t\t\tsnd_card_free(chip->card);\n\t\tatomic_dec(&chip->active);\n\t}\n\tmutex_unlock(®ister_mutex);\n\treturn err;\n}","target":"static int usb_audio_probe(struct usb_interface *intf,\n\t\t\t const struct usb_device_id *usb_id)\n{\n\tstruct usb_device *dev = interface_to_usbdev(intf);\n\tconst struct snd_usb_audio_quirk *quirk =\n\t\t(const struct snd_usb_audio_quirk *)usb_id->driver_info;\n\tstruct snd_usb_audio *chip;\n\tint i, err;\n\tstruct usb_host_interface *alts;\n\tint ifnum;\n\tu32 id;\n\n\talts = &intf->altsetting[0];\n\tifnum = get_iface_desc(alts)->bInterfaceNumber;\n\tid = USB_ID(le16_to_cpu(dev->descriptor.idVendor),\n\t\t le16_to_cpu(dev->descriptor.idProduct));\n\tif (get_alias_id(dev, &id))\n\t\tquirk = get_alias_quirk(dev, id);\n\tif (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)\n\t\treturn -ENXIO;\n\n\terr = snd_usb_apply_boot_quirk(dev, intf, quirk, id);\n\tif (err < 0)\n\t\treturn err;\n\n\t/*\n\t * found a config. now register to ALSA\n\t */\n\n\t/* check whether it's already registered */\n\tchip = NULL;\n\tmutex_lock(®ister_mutex);\n\tfor (i = 0; i < SNDRV_CARDS; i++) {\n\t\tif (usb_chip[i] && usb_chip[i]->dev == dev) {\n\t\t\tif (atomic_read(&usb_chip[i]->shutdown)) {\n\t\t\t\tdev_err(&dev->dev, \"USB device is in the shutdown state, cannot create a card instance\\n\");\n\t\t\t\terr = -EIO;\n\t\t\t\tgoto __error;\n\t\t\t}\n\t\t\tchip = usb_chip[i];\n\t\t\tatomic_inc(&chip->active); /* avoid autopm */\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (! chip) {\n\t\t/* it's a fresh one.\n\t\t * now look for an empty slot and create a new card instance\n\t\t */\n\t\tfor (i = 0; i < SNDRV_CARDS; i++)\n\t\t\tif (!usb_chip[i] &&\n\t\t\t (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) &&\n\t\t\t (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) {\n\t\t\t\tif (enable[i]) {\n\t\t\t\t\terr = snd_usb_audio_create(intf, dev, i, quirk,\n\t\t\t\t\t\t\t\t id, &chip);\n\t\t\t\t\tif (err < 0)\n\t\t\t\t\t\tgoto __error;\n\t\t\t\t\tchip->pm_intf = intf;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (vid[i] != -1 || pid[i] != -1) {\n\t\t\t\t\tdev_info(&dev->dev,\n\t\t\t\t\t\t \"device (%04x:%04x) is disabled\\n\",\n\t\t\t\t\t\t USB_ID_VENDOR(id),\n\t\t\t\t\t\t USB_ID_PRODUCT(id));\n\t\t\t\t\terr = -ENOENT;\n\t\t\t\t\tgoto __error;\n\t\t\t\t}\n\t\t\t}\n\t\tif (!chip) {\n\t\t\tdev_err(&dev->dev, \"no available usb audio device\\n\");\n\t\t\terr = -ENODEV;\n\t\t\tgoto __error;\n\t\t}\n\t}\n\tdev_set_drvdata(&dev->dev, chip);\n\n\t/*\n\t * For devices with more than one control interface, we assume the\n\t * first contains the audio controls. We might need a more specific\n\t * check here in the future.\n\t */\n\tif (!chip->ctrl_intf)\n\t\tchip->ctrl_intf = alts;\n\n\tchip->txfr_quirk = 0;\n\terr = 1; /* continue */\n\tif (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {\n\t\t/* need some special handlings */\n\t\terr = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\tif (err > 0) {\n\t\t/* create normal USB audio interfaces */\n\t\terr = snd_usb_create_streams(chip, ifnum);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t\terr = snd_usb_create_mixer(chip, ifnum, ignore_ctl_error);\n\t\tif (err < 0)\n\t\t\tgoto __error;\n\t}\n\n\t/* we are allowed to call snd_card_register() many times */\n\terr = snd_card_register(chip->card);\n\tif (err < 0)\n\t\tgoto __error;\n\n\tusb_chip[chip->index] = chip;\n\tchip->num_interfaces++;\n\tusb_set_intfdata(intf, chip);\n\tatomic_dec(&chip->active);\n\tmutex_unlock(®ister_mutex);\n\treturn 0;\n\n __error:\n\tif (chip) {\n\t\t/* chip->active is inside the chip->card object,\n\t\t * decrement before memory is possibly returned.\n\t\t */\n\t\tatomic_dec(&chip->active);\n\t\tif (!chip->num_interfaces)\n\t\t\tsnd_card_free(chip->card);\n\t}\n\tmutex_unlock(®ister_mutex);\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"usb_audio_probe","file_name":"sound/usb/card.c","commit_link":"github.com/torvalds/linux/commit/5f8cf712582617d523120df67d392059eaf2fc4b","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#50-7f3ac9ed10fc","input":"GF_Err audio_sample_entry_Read(GF_Box *s, GF_BitStream *bs)\n{\n\tGF_MPEGAudioSampleEntryBox *ptr;\n\tchar *data;\n\tu8 a, b, c, d;\n\tu32 i, size, v, nb_alnum;\n\tGF_Err e;\n\tu64 pos, start;\n\n\tptr = (GF_MPEGAudioSampleEntryBox *)s;\n\n\tstart = gf_bs_get_position(bs);\n\tgf_bs_seek(bs, start + 8);\n\tv = gf_bs_read_u16(bs);\n\tif (v)\n\t\tptr->is_qtff = 1;\n\n\t//try to disambiguate QTFF v1 and MP4 v1 audio sample entries ...\n\tif (v==1) {\n\t\t//go to end of ISOM audio sample entry, skip 4 byte (box size field), read 4 bytes (box type) and check if this looks like a box\n\t\tgf_bs_seek(bs, start + 8 + 20 + 4);\n\t\ta = gf_bs_read_u8(bs);\n\t\tb = gf_bs_read_u8(bs);\n\t\tc = gf_bs_read_u8(bs);\n\t\td = gf_bs_read_u8(bs);\n\t\tnb_alnum = 0;\n\t\tif (isalnum(a)) nb_alnum++;\n\t\tif (isalnum(b)) nb_alnum++;\n\t\tif (isalnum(c)) nb_alnum++;\n\t\tif (isalnum(d)) nb_alnum++;\n\t\tif (nb_alnum>2) ptr->is_qtff = 0;\n\t}\n\n\tgf_bs_seek(bs, start);\n\te = gf_isom_audio_sample_entry_read((GF_AudioSampleEntryBox*)s, bs);\n\tif (e) return e;\n\tpos = gf_bs_get_position(bs);\n\tsize = (u32) s->size;\n\n\t//when cookie is set on bs, always convert qtff-style mp4a to isobmff-style\n\t//since the conversion is done in addBox and we don't have the bitstream there (arg...), flag the box\n \tif (gf_bs_get_cookie(bs)) {\n \t\tptr->is_qtff |= 1<<16;\n \t}\n\n\te = gf_isom_box_array_read(s, bs, audio_sample_entry_AddBox);\n\tif (!e) return GF_OK;\n\tif (size<8) return GF_ISOM_INVALID_FILE;\n\n\t/*hack for some weird files (possibly recorded with live.com tools, needs further investigations)*/\n\tgf_bs_seek(bs, pos);\n\tdata = (char*)gf_malloc(sizeof(char) * size);\n\tgf_bs_read_data(bs, data, size);\n\tfor (i=0; iesd) {\n\t\t\t\tgf_isom_box_del((GF_Box *)ptr->esd);\n\t\t\t\tptr->esd=NULL;\n\t\t\t}\n\n\t\t\te = gf_isom_box_parse((GF_Box **)&ptr->esd, mybs);\n\n\t\t\tif (e==GF_OK) {\n\t\t\t\tgf_isom_box_add_for_dump_mode((GF_Box*)ptr, (GF_Box*)ptr->esd);\n\t\t\t} else if (ptr->esd) {\n\t\t\t\tgf_isom_box_del((GF_Box *)ptr->esd);\n\t\t\t\tptr->esd=NULL;\n\t\t\t}\n\n\t\t\tgf_bs_del(mybs);\n\t\t\tbreak;\n\t\t}\n\t}\n\tgf_free(data);\n\treturn e;\n}","target":"GF_Err audio_sample_entry_Read(GF_Box *s, GF_BitStream *bs)\n{\n\tGF_MPEGAudioSampleEntryBox *ptr;\n\tchar *data;\n\tu8 a, b, c, d;\n\tu32 i, size, v, nb_alnum;\n\tGF_Err e;\n\tu64 pos, start;\n\n\tptr = (GF_MPEGAudioSampleEntryBox *)s;\n\n\tstart = gf_bs_get_position(bs);\n\tgf_bs_seek(bs, start + 8);\n\tv = gf_bs_read_u16(bs);\n\tif (v)\n\t\tptr->is_qtff = 1;\n\n\t//try to disambiguate QTFF v1 and MP4 v1 audio sample entries ...\n\tif (v==1) {\n\t\t//go to end of ISOM audio sample entry, skip 4 byte (box size field), read 4 bytes (box type) and check if this looks like a box\n\t\tgf_bs_seek(bs, start + 8 + 20 + 4);\n\t\ta = gf_bs_read_u8(bs);\n\t\tb = gf_bs_read_u8(bs);\n\t\tc = gf_bs_read_u8(bs);\n\t\td = gf_bs_read_u8(bs);\n\t\tnb_alnum = 0;\n\t\tif (isalnum(a)) nb_alnum++;\n\t\tif (isalnum(b)) nb_alnum++;\n\t\tif (isalnum(c)) nb_alnum++;\n\t\tif (isalnum(d)) nb_alnum++;\n\t\tif (nb_alnum>2) ptr->is_qtff = 0;\n\t}\n\n\tgf_bs_seek(bs, start);\n\te = gf_isom_audio_sample_entry_read((GF_AudioSampleEntryBox*)s, bs);\n\tif (e) return e;\n\tpos = gf_bs_get_position(bs);\n\tsize = (u32) s->size;\n\n\t//when cookie is set on bs, always convert qtff-style mp4a to isobmff-style\n\t//since the conversion is done in addBox and we don't have the bitstream there (arg...), flag the box\n \tif (gf_bs_get_cookie(bs)) {\n \t\tptr->is_qtff |= 1<<16;\n \t}\n\n\te = gf_isom_box_array_read(s, bs, audio_sample_entry_AddBox);\n\tif (!e) return GF_OK;\n\tif (size<8) return GF_ISOM_INVALID_FILE;\n\n\t/*hack for some weird files (possibly recorded with live.com tools, needs further investigations)*/\n\tgf_bs_seek(bs, pos);\n\tdata = (char*)gf_malloc(sizeof(char) * size);\n\tgf_bs_read_data(bs, data, size);\n\tfor (i=0; iesd) {\n\t\t\t\tif (!use_dump_mode) gf_isom_box_del((GF_Box *)ptr->esd);\n\t\t\t\tptr->esd=NULL;\n\t\t\t}\n\n\t\t\te = gf_isom_box_parse((GF_Box **)&ptr->esd, mybs);\n\n\t\t\tif (e==GF_OK) {\n\t\t\t\tgf_isom_box_add_for_dump_mode((GF_Box*)ptr, (GF_Box*)ptr->esd);\n\t\t\t} else if (ptr->esd) {\n\t\t\t\tgf_isom_box_del((GF_Box *)ptr->esd);\n\t\t\t\tptr->esd=NULL;\n\t\t\t}\n\n\t\t\tgf_bs_del(mybs);\n\t\t\tbreak;\n\t\t}\n\t}\n\tgf_free(data);\n\treturn e;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"audio_sample_entry_Read","file_name":"src/isomedia/box_code_base.c","commit_link":"github.com/gpac/gpac/commit/6063b1a011c3f80cee25daade18154e15e4c058c","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#51-27fb01f9c311","input":"static void ffs_user_copy_worker(struct work_struct *work)\n{\n\tstruct ffs_io_data *io_data = container_of(work, struct ffs_io_data,\n\t\t\t\t\t\t work);\n\tint ret = io_data->req->status ? io_data->req->status :\n\t\t\t\t\t io_data->req->actual;\n\n\tif (io_data->read && ret > 0) {\n\t\tuse_mm(io_data->mm);\n\t\tret = copy_to_iter(io_data->buf, ret, &io_data->data);\n\t\tif (iov_iter_count(&io_data->data))\n\t\t\tret = -EFAULT;\n\t\tunuse_mm(io_data->mm);\n\t}\n\n\tio_data->kiocb->ki_complete(io_data->kiocb, ret, ret);\n\n\tif (io_data->ffs->ffs_eventfd &&\n\t !(io_data->kiocb->ki_flags & IOCB_EVENTFD))\n\t\teventfd_signal(io_data->ffs->ffs_eventfd, 1);\n\n\tusb_ep_free_request(io_data->ep, io_data->req);\n\n\tio_data->kiocb->private = NULL;\n\tif (io_data->read)\n\t\tkfree(io_data->to_free);\n\tkfree(io_data->buf);\n\tkfree(io_data);\n}","target":"static void ffs_user_copy_worker(struct work_struct *work)\n{\n\tstruct ffs_io_data *io_data = container_of(work, struct ffs_io_data,\n\t\t\t\t\t\t work);\n\tint ret = io_data->req->status ? io_data->req->status :\n\t\t\t\t\t io_data->req->actual;\n\tbool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD;\n\n\tif (io_data->read && ret > 0) {\n\t\tuse_mm(io_data->mm);\n\t\tret = copy_to_iter(io_data->buf, ret, &io_data->data);\n\t\tif (iov_iter_count(&io_data->data))\n\t\t\tret = -EFAULT;\n\t\tunuse_mm(io_data->mm);\n\t}\n\n\tio_data->kiocb->ki_complete(io_data->kiocb, ret, ret);\n\n\tif (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd)\n\t\teventfd_signal(io_data->ffs->ffs_eventfd, 1);\n\n\tusb_ep_free_request(io_data->ep, io_data->req);\n\n\tif (io_data->read)\n\t\tkfree(io_data->to_free);\n\tkfree(io_data->buf);\n\tkfree(io_data);\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"ffs_user_copy_worker","file_name":"drivers/usb/gadget/function/f_fs.c","commit_link":"github.com/torvalds/linux/commit/38740a5b87d53ceb89eb2c970150f6e94e00373a","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#52-a4ddb36a5478","input":"static void ndpi_reset_packet_line_info(struct ndpi_packet_struct *packet) {\n packet->parsed_lines = 0, packet->empty_line_position_set = 0, packet->host_line.ptr = NULL,\n packet->host_line.len = 0, packet->referer_line.ptr = NULL, packet->referer_line.len = 0,\n packet->content_line.ptr = NULL, packet->content_line.len = 0, packet->accept_line.ptr = NULL,\n packet->accept_line.len = 0, packet->user_agent_line.ptr = NULL, packet->user_agent_line.len = 0,\n packet->http_url_name.ptr = NULL, packet->http_url_name.len = 0, packet->http_encoding.ptr = NULL,\n packet->http_encoding.len = 0, packet->http_transfer_encoding.ptr = NULL, packet->http_transfer_encoding.len = 0,\n packet->http_contentlen.ptr = NULL, packet->http_contentlen.len = 0, packet->http_cookie.ptr = NULL,\n packet->http_cookie.len = 0, packet->http_origin.len = 0, packet->http_origin.ptr = NULL,\n packet->http_x_session_type.ptr = NULL, packet->http_x_session_type.len = 0, packet->server_line.ptr = NULL,\n packet->server_line.len = 0, packet->http_method.ptr = NULL, packet->http_method.len = 0,\n packet->http_response.ptr = NULL, packet->http_response.len = 0, packet->http_num_headers = 0;\n}","target":"static void ndpi_reset_packet_line_info(struct ndpi_packet_struct *packet) {\n packet->parsed_lines = 0, packet->empty_line_position_set = 0, packet->host_line.ptr = NULL,\n packet->host_line.len = 0, packet->referer_line.ptr = NULL, packet->referer_line.len = 0,\n packet->content_line.ptr = NULL, packet->content_line.len = 0, packet->accept_line.ptr = NULL,\n packet->accept_line.len = 0, packet->user_agent_line.ptr = NULL, packet->user_agent_line.len = 0,\n packet->http_url_name.ptr = NULL, packet->http_url_name.len = 0, packet->http_encoding.ptr = NULL,\n packet->http_encoding.len = 0, packet->http_transfer_encoding.ptr = NULL, packet->http_transfer_encoding.len = 0,\n packet->http_contentlen.ptr = NULL, packet->http_contentlen.len = 0, packet->content_disposition_line.ptr = NULL,\n packet->content_disposition_line.len = 0, packet->http_cookie.ptr = NULL,\n packet->http_cookie.len = 0, packet->http_origin.len = 0, packet->http_origin.ptr = NULL,\n packet->http_x_session_type.ptr = NULL, packet->http_x_session_type.len = 0, packet->server_line.ptr = NULL,\n packet->server_line.len = 0, packet->http_method.ptr = NULL, packet->http_method.len = 0,\n packet->http_response.ptr = NULL, packet->http_response.len = 0, packet->http_num_headers = 0;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"ndpi_reset_packet_line_info","file_name":"src/lib/ndpi_main.c","commit_link":"github.com/ntop/nDPI/commit/6a9f5e4f7c3fd5ddab3e6727b071904d76773952","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#53-1f6d62676756","input":"static int snd_seq_device_dev_free(struct snd_device *device)\n{\n\tstruct snd_seq_device *dev = device->device_data;\n\n\tput_device(&dev->dev);\n\treturn 0;\n}","target":"static int snd_seq_device_dev_free(struct snd_device *device)\n{\n\tstruct snd_seq_device *dev = device->device_data;\n\n\tcancel_autoload_drivers();\n\tput_device(&dev->dev);\n\treturn 0;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"snd_seq_device_dev_free","file_name":"sound/core/seq_device.c","commit_link":"github.com/torvalds/linux/commit/fc27fe7e8deef2f37cba3f2be2d52b6ca5eb9d57","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#54-eada77edac3e","input":"int __mdiobus_register(struct mii_bus *bus, struct module *owner)\n{\n\tstruct mdio_device *mdiodev;\n\tint i, err;\n\tstruct gpio_desc *gpiod;\n\n\tif (NULL == bus || NULL == bus->name ||\n\t NULL == bus->read || NULL == bus->write)\n\t\treturn -EINVAL;\n\n\tBUG_ON(bus->state != MDIOBUS_ALLOCATED &&\n\t bus->state != MDIOBUS_UNREGISTERED);\n\n\tbus->owner = owner;\n\tbus->dev.parent = bus->parent;\n\tbus->dev.class = &mdio_bus_class;\n\tbus->dev.groups = NULL;\n\tdev_set_name(&bus->dev, \"%s\", bus->id);\n\n\terr = device_register(&bus->dev);\n\tif (err) {\n\t\tpr_err(\"mii_bus %s failed to register\\n\", bus->id);\n\t\tput_device(&bus->dev);\n\t\treturn -EINVAL;\n\t}\n\n\tmutex_init(&bus->mdio_lock);\n\n\t/* de-assert bus level PHY GPIO reset */\n\tgpiod = devm_gpiod_get_optional(&bus->dev, \"reset\", GPIOD_OUT_LOW);\n\tif (IS_ERR(gpiod)) {\n\t\tdev_err(&bus->dev, \"mii_bus %s couldn't get reset GPIO\\n\",\n\t\t\tbus->id);\n\t\tdevice_del(&bus->dev);\n\t\treturn PTR_ERR(gpiod);\n\t} else\tif (gpiod) {\n\t\tbus->reset_gpiod = gpiod;\n\n\t\tgpiod_set_value_cansleep(gpiod, 1);\n\t\tudelay(bus->reset_delay_us);\n\t\tgpiod_set_value_cansleep(gpiod, 0);\n\t}\n\n\tif (bus->reset)\n\t\tbus->reset(bus);\n\n\tfor (i = 0; i < PHY_MAX_ADDR; i++) {\n\t\tif ((bus->phy_mask & (1 << i)) == 0) {\n\t\t\tstruct phy_device *phydev;\n\n\t\t\tphydev = mdiobus_scan(bus, i);\n\t\t\tif (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) {\n\t\t\t\terr = PTR_ERR(phydev);\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\tmdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device);\n\n\tbus->state = MDIOBUS_REGISTERED;\n\tpr_info(\"%s: probed\\n\", bus->name);\n\treturn 0;\n\nerror:\n\twhile (--i >= 0) {\n\t\tmdiodev = bus->mdio_map[i];\n\t\tif (!mdiodev)\n\t\t\tcontinue;\n\n\t\tmdiodev->device_remove(mdiodev);\n\t\tmdiodev->device_free(mdiodev);\n\t}\n\n\t/* Put PHYs in RESET to save power */\n\tif (bus->reset_gpiod)\n\t\tgpiod_set_value_cansleep(bus->reset_gpiod, 1);\n\n\tdevice_del(&bus->dev);\n\treturn err;\n}","target":"int __mdiobus_register(struct mii_bus *bus, struct module *owner)\n{\n\tstruct mdio_device *mdiodev;\n\tint i, err;\n\tstruct gpio_desc *gpiod;\n\n\tif (NULL == bus || NULL == bus->name ||\n\t NULL == bus->read || NULL == bus->write)\n\t\treturn -EINVAL;\n\n\tBUG_ON(bus->state != MDIOBUS_ALLOCATED &&\n\t bus->state != MDIOBUS_UNREGISTERED);\n\n\tbus->owner = owner;\n\tbus->dev.parent = bus->parent;\n\tbus->dev.class = &mdio_bus_class;\n\tbus->dev.groups = NULL;\n\tdev_set_name(&bus->dev, \"%s\", bus->id);\n\n\terr = device_register(&bus->dev);\n\tif (err) {\n\t\tpr_err(\"mii_bus %s failed to register\\n\", bus->id);\n\t\treturn -EINVAL;\n\t}\n\n\tmutex_init(&bus->mdio_lock);\n\n\t/* de-assert bus level PHY GPIO reset */\n\tgpiod = devm_gpiod_get_optional(&bus->dev, \"reset\", GPIOD_OUT_LOW);\n\tif (IS_ERR(gpiod)) {\n\t\tdev_err(&bus->dev, \"mii_bus %s couldn't get reset GPIO\\n\",\n\t\t\tbus->id);\n\t\tdevice_del(&bus->dev);\n\t\treturn PTR_ERR(gpiod);\n\t} else\tif (gpiod) {\n\t\tbus->reset_gpiod = gpiod;\n\n\t\tgpiod_set_value_cansleep(gpiod, 1);\n\t\tudelay(bus->reset_delay_us);\n\t\tgpiod_set_value_cansleep(gpiod, 0);\n\t}\n\n\tif (bus->reset)\n\t\tbus->reset(bus);\n\n\tfor (i = 0; i < PHY_MAX_ADDR; i++) {\n\t\tif ((bus->phy_mask & (1 << i)) == 0) {\n\t\t\tstruct phy_device *phydev;\n\n\t\t\tphydev = mdiobus_scan(bus, i);\n\t\t\tif (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) {\n\t\t\t\terr = PTR_ERR(phydev);\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\tmdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device);\n\n\tbus->state = MDIOBUS_REGISTERED;\n\tpr_info(\"%s: probed\\n\", bus->name);\n\treturn 0;\n\nerror:\n\twhile (--i >= 0) {\n\t\tmdiodev = bus->mdio_map[i];\n\t\tif (!mdiodev)\n\t\t\tcontinue;\n\n\t\tmdiodev->device_remove(mdiodev);\n\t\tmdiodev->device_free(mdiodev);\n\t}\n\n\t/* Put PHYs in RESET to save power */\n\tif (bus->reset_gpiod)\n\t\tgpiod_set_value_cansleep(bus->reset_gpiod, 1);\n\n\tdevice_del(&bus->dev);\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"__mdiobus_register","file_name":"drivers/net/phy/mdio_bus.c","commit_link":"github.com/torvalds/linux/commit/6ff7b060535e87c2ae14dd8548512abfdda528fb","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#55-c1d2c18f1f94","input":"mrb_io_initialize_copy(mrb_state *mrb, mrb_value copy)\n{\n mrb_value orig;\n mrb_value buf;\n struct mrb_io *fptr_copy;\n struct mrb_io *fptr_orig;\n mrb_bool failed = TRUE;\n\n mrb_get_args(mrb, \"o\", &orig);\n fptr_copy = (struct mrb_io *)DATA_PTR(copy);\n if (fptr_copy != NULL) {\n fptr_finalize(mrb, fptr_copy, FALSE);\n mrb_free(mrb, fptr_copy);\n }\n fptr_copy = (struct mrb_io *)mrb_io_alloc(mrb);\n fptr_orig = io_get_open_fptr(mrb, orig);\n\n DATA_TYPE(copy) = &mrb_io_type;\n DATA_PTR(copy) = fptr_copy;\n\n buf = mrb_iv_get(mrb, orig, mrb_intern_cstr(mrb, \"@buf\"));\n mrb_iv_set(mrb, copy, mrb_intern_cstr(mrb, \"@buf\"), buf);\n\n fptr_copy->fd = mrb_dup(mrb, fptr_orig->fd, &failed);\n if (failed) {\n mrb_sys_fail(mrb, 0);\n }\n mrb_fd_cloexec(mrb, fptr_copy->fd);\n\n if (fptr_orig->fd2 != -1) {\n fptr_copy->fd2 = mrb_dup(mrb, fptr_orig->fd2, &failed);\n if (failed) {\n close(fptr_copy->fd);\n mrb_sys_fail(mrb, 0);\n }\n mrb_fd_cloexec(mrb, fptr_copy->fd2);\n }\n\n fptr_copy->pid = fptr_orig->pid;\n fptr_copy->readable = fptr_orig->readable;\n fptr_copy->writable = fptr_orig->writable;\n fptr_copy->sync = fptr_orig->sync;\n fptr_copy->is_socket = fptr_orig->is_socket;\n\n return copy;\n}","target":"mrb_io_initialize_copy(mrb_state *mrb, mrb_value copy)\n{\n mrb_value orig;\n mrb_value buf;\n struct mrb_io *fptr_copy;\n struct mrb_io *fptr_orig;\n mrb_bool failed = TRUE;\n\n mrb_get_args(mrb, \"o\", &orig);\n fptr_orig = io_get_open_fptr(mrb, orig);\n fptr_copy = (struct mrb_io *)DATA_PTR(copy);\n if (fptr_copy != NULL) {\n fptr_finalize(mrb, fptr_copy, FALSE);\n mrb_free(mrb, fptr_copy);\n }\n fptr_copy = (struct mrb_io *)mrb_io_alloc(mrb);\n\n DATA_TYPE(copy) = &mrb_io_type;\n DATA_PTR(copy) = fptr_copy;\n\n buf = mrb_iv_get(mrb, orig, mrb_intern_cstr(mrb, \"@buf\"));\n mrb_iv_set(mrb, copy, mrb_intern_cstr(mrb, \"@buf\"), buf);\n\n fptr_copy->fd = mrb_dup(mrb, fptr_orig->fd, &failed);\n if (failed) {\n mrb_sys_fail(mrb, 0);\n }\n mrb_fd_cloexec(mrb, fptr_copy->fd);\n\n if (fptr_orig->fd2 != -1) {\n fptr_copy->fd2 = mrb_dup(mrb, fptr_orig->fd2, &failed);\n if (failed) {\n close(fptr_copy->fd);\n mrb_sys_fail(mrb, 0);\n }\n mrb_fd_cloexec(mrb, fptr_copy->fd2);\n }\n\n fptr_copy->pid = fptr_orig->pid;\n fptr_copy->readable = fptr_orig->readable;\n fptr_copy->writable = fptr_orig->writable;\n fptr_copy->sync = fptr_orig->sync;\n fptr_copy->is_socket = fptr_orig->is_socket;\n\n return copy;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"mrb_io_initialize_copy","file_name":"mrbgems/mruby-io/src/io.c","commit_link":"github.com/mruby/mruby/commit/b51b21fc63c9805862322551387d9036f2b63433","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#56-67ec0f6f947a","input":"SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,\n\t unsigned int *nbytes, struct kvec *iov, int n_vec)\n{\n\tstruct smb_rqst rqst;\n\tint rc = 0;\n\tstruct smb2_write_req *req = NULL;\n\tstruct smb2_write_rsp *rsp = NULL;\n\tint resp_buftype;\n\tstruct kvec rsp_iov;\n\tint flags = 0;\n\tunsigned int total_len;\n\n\t*nbytes = 0;\n\n\tif (n_vec < 1)\n\t\treturn rc;\n\n\trc = smb2_plain_req_init(SMB2_WRITE, io_parms->tcon, (void **) &req,\n\t\t\t &total_len);\n\tif (rc)\n\t\treturn rc;\n\n\tif (io_parms->tcon->ses->server == NULL)\n\t\treturn -ECONNABORTED;\n\n\tif (smb3_encryption_required(io_parms->tcon))\n\t\tflags |= CIFS_TRANSFORM_REQ;\n\n\treq->sync_hdr.ProcessId = cpu_to_le32(io_parms->pid);\n\n\treq->PersistentFileId = io_parms->persistent_fid;\n\treq->VolatileFileId = io_parms->volatile_fid;\n\treq->WriteChannelInfoOffset = 0;\n\treq->WriteChannelInfoLength = 0;\n\treq->Channel = 0;\n\treq->Length = cpu_to_le32(io_parms->length);\n\treq->Offset = cpu_to_le64(io_parms->offset);\n\treq->DataOffset = cpu_to_le16(\n\t\t\t\toffsetof(struct smb2_write_req, Buffer));\n\treq->RemainingBytes = 0;\n\n\ttrace_smb3_write_enter(xid, io_parms->persistent_fid,\n\t\tio_parms->tcon->tid, io_parms->tcon->ses->Suid,\n\t\tio_parms->offset, io_parms->length);\n\n\tiov[0].iov_base = (char *)req;\n\t/* 1 for Buffer */\n\tiov[0].iov_len = total_len - 1;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = n_vec + 1;\n\n\trc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst,\n\t\t\t &resp_buftype, flags, &rsp_iov);\n\tcifs_small_buf_release(req);\n\trsp = (struct smb2_write_rsp *)rsp_iov.iov_base;\n\n\tif (rc) {\n\t\ttrace_smb3_write_err(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid,\n\t\t\t\t io_parms->tcon->ses->Suid,\n\t\t\t\t io_parms->offset, io_parms->length, rc);\n\t\tcifs_stats_fail_inc(io_parms->tcon, SMB2_WRITE_HE);\n\t\tcifs_dbg(VFS, \"Send error in write = %d\\n\", rc);\n\t} else {\n\t\t*nbytes = le32_to_cpu(rsp->DataLength);\n\t\ttrace_smb3_write_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid,\n\t\t\t\t io_parms->tcon->ses->Suid,\n\t\t\t\t io_parms->offset, *nbytes);\n\t}\n\n\tfree_rsp_buf(resp_buftype, rsp);\n\treturn rc;\n}","target":"SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,\n\t unsigned int *nbytes, struct kvec *iov, int n_vec)\n{\n\tstruct smb_rqst rqst;\n\tint rc = 0;\n\tstruct smb2_write_req *req = NULL;\n\tstruct smb2_write_rsp *rsp = NULL;\n\tint resp_buftype;\n\tstruct kvec rsp_iov;\n\tint flags = 0;\n\tunsigned int total_len;\n\n\t*nbytes = 0;\n\n\tif (n_vec < 1)\n\t\treturn rc;\n\n\trc = smb2_plain_req_init(SMB2_WRITE, io_parms->tcon, (void **) &req,\n\t\t\t &total_len);\n\tif (rc)\n\t\treturn rc;\n\n\tif (io_parms->tcon->ses->server == NULL)\n\t\treturn -ECONNABORTED;\n\n\tif (smb3_encryption_required(io_parms->tcon))\n\t\tflags |= CIFS_TRANSFORM_REQ;\n\n\treq->sync_hdr.ProcessId = cpu_to_le32(io_parms->pid);\n\n\treq->PersistentFileId = io_parms->persistent_fid;\n\treq->VolatileFileId = io_parms->volatile_fid;\n\treq->WriteChannelInfoOffset = 0;\n\treq->WriteChannelInfoLength = 0;\n\treq->Channel = 0;\n\treq->Length = cpu_to_le32(io_parms->length);\n\treq->Offset = cpu_to_le64(io_parms->offset);\n\treq->DataOffset = cpu_to_le16(\n\t\t\t\toffsetof(struct smb2_write_req, Buffer));\n\treq->RemainingBytes = 0;\n\n\ttrace_smb3_write_enter(xid, io_parms->persistent_fid,\n\t\tio_parms->tcon->tid, io_parms->tcon->ses->Suid,\n\t\tio_parms->offset, io_parms->length);\n\n\tiov[0].iov_base = (char *)req;\n\t/* 1 for Buffer */\n\tiov[0].iov_len = total_len - 1;\n\n\tmemset(&rqst, 0, sizeof(struct smb_rqst));\n\trqst.rq_iov = iov;\n\trqst.rq_nvec = n_vec + 1;\n\n\trc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst,\n\t\t\t &resp_buftype, flags, &rsp_iov);\n\trsp = (struct smb2_write_rsp *)rsp_iov.iov_base;\n\n\tif (rc) {\n\t\ttrace_smb3_write_err(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid,\n\t\t\t\t io_parms->tcon->ses->Suid,\n\t\t\t\t io_parms->offset, io_parms->length, rc);\n\t\tcifs_stats_fail_inc(io_parms->tcon, SMB2_WRITE_HE);\n\t\tcifs_dbg(VFS, \"Send error in write = %d\\n\", rc);\n\t} else {\n\t\t*nbytes = le32_to_cpu(rsp->DataLength);\n\t\ttrace_smb3_write_done(xid, req->PersistentFileId,\n\t\t\t\t io_parms->tcon->tid,\n\t\t\t\t io_parms->tcon->ses->Suid,\n\t\t\t\t io_parms->offset, *nbytes);\n\t}\n\n\tcifs_small_buf_release(req);\n\tfree_rsp_buf(resp_buftype, rsp);\n\treturn rc;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"SMB2_write","file_name":"fs/cifs/smb2pdu.c","commit_link":"github.com/torvalds/linux/commit/6a3eb3360667170988f8a6477f6686242061488a","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-022#0-32960ca655d6","input":"long dd_get_item_size(struct dump_dir *dd, const char *name)\n{\n long size = -1;\n char *iname = concat_path_file(dd->dd_dirname, name);\n struct stat statbuf;\n\n if (lstat(iname, &statbuf) == 0 && S_ISREG(statbuf.st_mode))\n size = statbuf.st_size;\n else\n {\n if (errno == ENOENT)\n size = 0;\n else\n perror_msg(\"Can't get size of file '%s'\", iname);\n }\n\n free(iname);\n\n return size;\n}","target":"long dd_get_item_size(struct dump_dir *dd, const char *name)\n{\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot get item size. '%s' is not a valid file name\", name);\n\n long size = -1;\n char *iname = concat_path_file(dd->dd_dirname, name);\n struct stat statbuf;\n\n if (lstat(iname, &statbuf) == 0 && S_ISREG(statbuf.st_mode))\n size = statbuf.st_size;\n else\n {\n if (errno == ENOENT)\n size = 0;\n else\n perror_msg(\"Can't get size of file '%s'\", iname);\n }\n\n free(iname);\n\n return size;\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"dd_get_item_size","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#1-a631ff381000","input":" def zmi_page_request(self, *args, **kwargs):\r\n request = self.REQUEST\r\n RESPONSE = request.RESPONSE\r\n SESSION = request.SESSION\r\n self._zmi_page_request()\r\n RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822())\r\n RESPONSE.setHeader('Cache-Control', 'no-cache')\r\n RESPONSE.setHeader('Pragma', 'no-cache')\r\n RESPONSE.setHeader('Content-Type', 'text/html;charset=%s'%request['ZMS_CHARSET'])\r\n if not request.get( 'preview'):\r\n request.set( 'preview','preview')\r\n langs = self.getLanguages(request)\r\n if request.get('lang') not in langs:\r\n request.set('lang',langs[0])\r\n if request.get('manage_lang') not in self.getLocale().get_manage_langs():\r\n request.set('manage_lang',self.get_manage_lang())\r\n if not request.get('manage_tabs_message'):\r\n request.set( 'manage_tabs_message',self.getConfProperty('ZMS.manage_tabs_message',''))\r\n # manage_system\r\n if request.form.has_key('zmi-manage-system'):\r\n request.SESSION.set('zmi-manage-system',int(request.get('zmi-manage-system')))\r\n # avoid declarative urls\r\n physical_path = self.getPhysicalPath()\r\n path_to_handle = request['URL0'][len(request['BASE0']):].split('/')\r\n path = path_to_handle[:-1]\r\n if len(filter(lambda x:x.find('.')>0 or x.startswith('manage_'),path))==0:\r\n for i in range(len(path)):\r\n if path[:-(i+1)] != physical_path[:-(i+1)]:\r\n path[:-(i+1)] = physical_path[:-(i+1)]\r\n new_path = path+[path_to_handle[-1]]\r\n if path_to_handle != new_path:\r\n request.RESPONSE.redirect('/'.join(new_path))","target":" def zmi_page_request(self, *args, **kwargs):\r\n request = self.REQUEST\r\n RESPONSE = request.RESPONSE\r\n SESSION = request.SESSION\r\n self._zmi_page_request()\r\n RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822())\r\n RESPONSE.setHeader('Cache-Control', 'no-cache')\r\n RESPONSE.setHeader('Pragma', 'no-cache')\r\n RESPONSE.setHeader('Content-Type', 'text/html;charset=%s'%request['ZMS_CHARSET'])\r\n if not request.get( 'preview'):\r\n request.set( 'preview','preview')\r\n langs = self.getLanguages(request)\r\n if request.get('lang') not in langs:\r\n request.set('lang',langs[0])\r\n if request.get('manage_lang') not in self.getLocale().get_manage_langs():\r\n request.set('manage_lang',self.get_manage_lang())\r\n if not request.get('manage_tabs_message'):\r\n request.set( 'manage_tabs_message',self.getConfProperty('ZMS.manage_tabs_message',''))\r\n # manage_system\r\n if request.form.has_key('zmi-manage-system'):\r\n request.SESSION.set('zmi-manage-system',int(request.get('zmi-manage-system')))\r\n # avoid declarative urls\r\n physical_path = self.getPhysicalPath()\r\n path_to_handle = request['URL0'][len(request['BASE0']):].split('/')\r\n path = path_to_handle[:-1]\r\n if self.getDocumentElement().id in path and len(filter(lambda x:x.find('.')>0 or x.startswith('manage_'),path))==0:\r\n for i in range(len(path)):\r\n if path[:-(i+1)] != physical_path[:-(i+1)]:\r\n path[:-(i+1)] = physical_path[:-(i+1)]\r\n new_path = path+[path_to_handle[-1]]\r\n if path_to_handle != new_path:\r\n request.RESPONSE.redirect('/'.join(new_path))","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"zmi_page_request","file_name":"ZMSItem.py","commit_link":"github.com/zms-publishing/zms4/commit/3f28620d475220dfdb06f79787158ac50727c61a","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#2-6241e4c1b809","input":"static int nntp_hcache_namer(const char *path, char *dest, size_t destlen)\n{\n return snprintf(dest, destlen, \"%s.hcache\", path);\n}","target":"static int nntp_hcache_namer(const char *path, char *dest, size_t destlen)\n{\n int count = snprintf(dest, destlen, \"%s.hcache\", path);\n\n /* Strip out any directories in the path */\n char *first = strchr(dest, '/');\n char *last = strrchr(dest, '/');\n if (first && last && (last > first))\n {\n memmove(first, last, strlen(last) + 1);\n count -= (last - first);\n }\n\n return count;\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"nntp_hcache_namer","file_name":"newsrc.c","commit_link":"github.com/neomutt/neomutt/commit/9bfab35522301794483f8f9ed60820bdec9be59e","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#3-af140e22ce53","input":"std::string TarFileReader::extract(const string &_path) {\n if (_path.empty()) THROW(\"path cannot be empty\");\n if (!hasMore()) THROW(\"No more tar files\");\n\n string path = _path;\n if (SystemUtilities::isDirectory(path)) path += \"/\" + getFilename();\n\n LOG_DEBUG(5, \"Extracting: \" << path);\n\n return extract(*SystemUtilities::oopen(path));\n}","target":"std::string TarFileReader::extract(const string &_path) {\n if (_path.empty()) THROW(\"path cannot be empty\");\n if (!hasMore()) THROW(\"No more tar files\");\n\n string path = _path;\n if (SystemUtilities::isDirectory(path)) {\n path += \"/\" + getFilename();\n\n // Check that path is under the target directory\n string a = SystemUtilities::getCanonicalPath(_path);\n string b = SystemUtilities::getCanonicalPath(path);\n if (!String::startsWith(b, a))\n THROW(\"Tar path points outside of the extraction directory: \" << path);\n }\n\n LOG_DEBUG(5, \"Extracting: \" << path);\n\n switch (getType()) {\n case NORMAL_FILE: case CONTIGUOUS_FILE:\n return extract(*SystemUtilities::oopen(path));\n case DIRECTORY: SystemUtilities::ensureDirectory(path); break;\n default: THROW(\"Unsupported tar file type \" << getType());\n }\n\n return getFilename();\n}","lang":"cpp","vul_type":"cwe-022","sven_meta":{"func_name":"TarFileReader::extract","file_name":"src/cbang/tar/TarFileReader.cpp","commit_link":"github.com/CauldronDevelopmentLLC/cbang/commit/1c1dba62bd3e6fa9d0d0c0aa21926043b75382c7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#4-1e7893debf07","input":"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n GDBusMethodInvocation *invocation,\n gpointer user_data)\n{\n reset_timeout();\n\n uid_t caller_uid;\n GVariant *response;\n\n caller_uid = get_caller_uid(connection, invocation, caller);\n\n log_notice(\"caller_uid:%ld method:'%s'\", (long)caller_uid, method_name);\n\n if (caller_uid == (uid_t) -1)\n return;\n\n if (g_strcmp0(method_name, \"NewProblem\") == 0)\n {\n char *error = NULL;\n char *problem_id = handle_new_problem(g_variant_get_child_value(parameters, 0), caller_uid, &error);\n if (!problem_id)\n {\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n /* else */\n response = g_variant_new(\"(s)\", problem_id);\n g_dbus_method_invocation_return_value(invocation, response);\n free(problem_id);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"GetProblems\") == 0)\n {\n GList *dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n //I was told that g_dbus_method frees the response\n //g_variant_unref(response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetAllProblems\") == 0)\n {\n /*\n - so, we have UID,\n - if it's 0, then we don't have to check anything and just return all directories\n - if uid != 0 then we want to ask for authorization\n */\n if (caller_uid != 0)\n {\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n }\n\n GList * dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetForeignProblems\") == 0)\n {\n GList * dirs = get_problem_dirs_not_accessible_by_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"ChownProblemDir\") == 0)\n {\n const gchar *problem_dir;\n g_variant_get(parameters, \"(&s)\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int ddstat = fdump_dir_stat_for_uid(dir_fd, caller_uid);\n if (ddstat < 0)\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"requested directory does not exist '%s'\", problem_dir);\n }\n else\n {\n perror_msg(\"can't get stat of '%s'\", problem_dir);\n }\n\n return_InvalidProblemDir_error(invocation, problem_dir);\n\n close(dir_fd);\n return;\n }\n\n if (ddstat & DD_STAT_OWNED_BY_UID)\n { //caller seems to be in group with access to this dir, so no action needed\n log_notice(\"caller has access to the requested directory %s\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, NULL);\n close(dir_fd);\n return;\n }\n\n if ((ddstat & DD_STAT_ACCESSIBLE_BY_UID) == 0 &&\n polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int chown_res = dd_chown(dd, caller_uid);\n if (chown_res != 0)\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.ChownError\",\n _(\"Chowning directory failed. Check system logs for more details.\"));\n else\n g_dbus_method_invocation_return_value(invocation, NULL);\n\n dd_close(dd);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetInfo\") == 0)\n {\n /* Parameter tuple is (sas) */\n\n\t/* Get 1st param - problem dir name */\n const gchar *problem_dir;\n g_variant_get_child(parameters, 0, \"&s\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n close(dir_fd);\n return;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n\t/* Get 2nd param - vector of element names */\n GVariant *array = g_variant_get_child_value(parameters, 1);\n GList *elements = string_list_from_variant(array);\n g_variant_unref(array);\n\n GVariantBuilder *builder = NULL;\n for (GList *l = elements; l; l = l->next)\n {\n const char *element_name = (const char*)l->data;\n char *value = dd_load_text_ext(dd, element_name, 0\n | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE\n | DD_FAIL_QUIETLY_ENOENT\n | DD_FAIL_QUIETLY_EACCES);\n log_notice(\"element '%s' %s\", element_name, value ? \"fetched\" : \"not found\");\n if (value)\n {\n if (!builder)\n builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);\n\n /* g_variant_builder_add makes a copy. No need to xstrdup here */\n g_variant_builder_add(builder, \"{ss}\", element_name, value);\n free(value);\n }\n }\n list_free_with_free(elements);\n dd_close(dd);\n /* It is OK to call g_variant_new(\"(a{ss})\", NULL) because */\n /* G_VARIANT_TYPE_TUPLE allows NULL value */\n GVariant *response = g_variant_new(\"(a{ss})\", builder);\n\n if (builder)\n g_variant_builder_unref(builder);\n\n log_info(\"GetInfo: returning value for '%s'\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"SetElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n const char *value;\n\n g_variant_get(parameters, \"(&s&s&s)\", &problem_id, &element, &value);\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n /* Is it good idea to make it static? Is it possible to change the max size while a single run? */\n const double max_dir_size = g_settings_nMaxCrashReportsSize * (1024 * 1024);\n const long item_size = dd_get_item_size(dd, element);\n if (item_size < 0)\n {\n log_notice(\"Can't get size of '%s/%s'\", problem_id, element);\n char *error = xasprintf(_(\"Can't get size of '%s'\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n return;\n }\n\n const double requested_size = (double)strlen(value) - item_size;\n /* Don't want to check the size limit in case of reducing of size */\n if (requested_size > 0\n && requested_size > (max_dir_size - get_dirsize(g_settings_dump_location)))\n {\n log_notice(\"No problem space left in '%s' (requested Bytes %f)\", problem_id, requested_size);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n _(\"No problem space left\"));\n }\n else\n {\n dd_save_text(dd, element, value);\n g_dbus_method_invocation_return_value(invocation, NULL);\n }\n\n dd_close(dd);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n\n g_variant_get(parameters, \"(&s&s)\", &problem_id, &element);\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n const int res = dd_delete_item(dd, element);\n dd_close(dd);\n\n if (res != 0)\n {\n log_notice(\"Can't delete the element '%s' from the problem directory '%s'\", element, problem_id);\n char *error = xasprintf(_(\"Can't delete the element '%s' from the problem directory '%s'\"), element, problem_id);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteProblem\") == 0)\n {\n /* Dbus parameters are always tuples.\n * In this case, it's (as) - a tuple of one element (array of strings).\n * Need to fetch the array:\n */\n GVariant *array = g_variant_get_child_value(parameters, 0);\n GList *problem_dirs = string_list_from_variant(array);\n g_variant_unref(array);\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n log_notice(\"dir_name:'%s'\", dir_name);\n if (!allowed_problem_dir(dir_name))\n {\n return_InvalidProblemDir_error(invocation, dir_name);\n goto ret;\n }\n }\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n\n int dir_fd = dd_openfd(dir_name);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", dir_name);\n return_InvalidProblemDir_error(invocation, dir_name);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", dir_name);\n close(dir_fd);\n continue;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n { // if user didn't provide correct credentials, just move to the next dir\n close(dir_fd);\n continue;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, dir_name, /*flags:*/ 0);\n if (dd)\n {\n if (dd_delete(dd) != 0)\n {\n error_msg(\"Failed to delete problem directory '%s'\", dir_name);\n dd_close(dd);\n }\n }\n }\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n ret:\n list_free_with_free(problem_dirs);\n return;\n }\n\n if (g_strcmp0(method_name, \"FindProblemByElementInTimeRange\") == 0)\n {\n const gchar *element;\n const gchar *value;\n glong timestamp_from;\n glong timestamp_to;\n gboolean all;\n\n g_variant_get_child(parameters, 0, \"&s\", &element);\n g_variant_get_child(parameters, 1, \"&s\", &value);\n g_variant_get_child(parameters, 2, \"x\", ×tamp_from);\n g_variant_get_child(parameters, 3, \"x\", ×tamp_to);\n g_variant_get_child(parameters, 4, \"b\", &all);\n\n if (all && polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n\n GList *dirs = get_problem_dirs_for_element_in_time(caller_uid, element, value, timestamp_from,\n timestamp_to);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"Quit\") == 0)\n {\n g_dbus_method_invocation_return_value(invocation, NULL);\n g_main_loop_quit(loop);\n return;\n }\n}","target":"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n GDBusMethodInvocation *invocation,\n gpointer user_data)\n{\n reset_timeout();\n\n uid_t caller_uid;\n GVariant *response;\n\n caller_uid = get_caller_uid(connection, invocation, caller);\n\n log_notice(\"caller_uid:%ld method:'%s'\", (long)caller_uid, method_name);\n\n if (caller_uid == (uid_t) -1)\n return;\n\n if (g_strcmp0(method_name, \"NewProblem\") == 0)\n {\n char *error = NULL;\n char *problem_id = handle_new_problem(g_variant_get_child_value(parameters, 0), caller_uid, &error);\n if (!problem_id)\n {\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n /* else */\n response = g_variant_new(\"(s)\", problem_id);\n g_dbus_method_invocation_return_value(invocation, response);\n free(problem_id);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"GetProblems\") == 0)\n {\n GList *dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n //I was told that g_dbus_method frees the response\n //g_variant_unref(response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetAllProblems\") == 0)\n {\n /*\n - so, we have UID,\n - if it's 0, then we don't have to check anything and just return all directories\n - if uid != 0 then we want to ask for authorization\n */\n if (caller_uid != 0)\n {\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n }\n\n GList * dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetForeignProblems\") == 0)\n {\n GList * dirs = get_problem_dirs_not_accessible_by_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"ChownProblemDir\") == 0)\n {\n const gchar *problem_dir;\n g_variant_get(parameters, \"(&s)\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int ddstat = fdump_dir_stat_for_uid(dir_fd, caller_uid);\n if (ddstat < 0)\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"requested directory does not exist '%s'\", problem_dir);\n }\n else\n {\n perror_msg(\"can't get stat of '%s'\", problem_dir);\n }\n\n return_InvalidProblemDir_error(invocation, problem_dir);\n\n close(dir_fd);\n return;\n }\n\n if (ddstat & DD_STAT_OWNED_BY_UID)\n { //caller seems to be in group with access to this dir, so no action needed\n log_notice(\"caller has access to the requested directory %s\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, NULL);\n close(dir_fd);\n return;\n }\n\n if ((ddstat & DD_STAT_ACCESSIBLE_BY_UID) == 0 &&\n polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int chown_res = dd_chown(dd, caller_uid);\n if (chown_res != 0)\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.ChownError\",\n _(\"Chowning directory failed. Check system logs for more details.\"));\n else\n g_dbus_method_invocation_return_value(invocation, NULL);\n\n dd_close(dd);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetInfo\") == 0)\n {\n /* Parameter tuple is (sas) */\n\n\t/* Get 1st param - problem dir name */\n const gchar *problem_dir;\n g_variant_get_child(parameters, 0, \"&s\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n close(dir_fd);\n return;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n\t/* Get 2nd param - vector of element names */\n GVariant *array = g_variant_get_child_value(parameters, 1);\n GList *elements = string_list_from_variant(array);\n g_variant_unref(array);\n\n GVariantBuilder *builder = NULL;\n for (GList *l = elements; l; l = l->next)\n {\n const char *element_name = (const char*)l->data;\n char *value = dd_load_text_ext(dd, element_name, 0\n | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE\n | DD_FAIL_QUIETLY_ENOENT\n | DD_FAIL_QUIETLY_EACCES);\n log_notice(\"element '%s' %s\", element_name, value ? \"fetched\" : \"not found\");\n if (value)\n {\n if (!builder)\n builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);\n\n /* g_variant_builder_add makes a copy. No need to xstrdup here */\n g_variant_builder_add(builder, \"{ss}\", element_name, value);\n free(value);\n }\n }\n list_free_with_free(elements);\n dd_close(dd);\n /* It is OK to call g_variant_new(\"(a{ss})\", NULL) because */\n /* G_VARIANT_TYPE_TUPLE allows NULL value */\n GVariant *response = g_variant_new(\"(a{ss})\", builder);\n\n if (builder)\n g_variant_builder_unref(builder);\n\n log_info(\"GetInfo: returning value for '%s'\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"SetElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n const char *value;\n\n g_variant_get(parameters, \"(&s&s&s)\", &problem_id, &element, &value);\n\n if (!allowed_problem_dir(problem_id))\n {\n return_InvalidProblemDir_error(invocation, problem_id);\n return;\n }\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n /* Is it good idea to make it static? Is it possible to change the max size while a single run? */\n const double max_dir_size = g_settings_nMaxCrashReportsSize * (1024 * 1024);\n const long item_size = dd_get_item_size(dd, element);\n if (item_size < 0)\n {\n log_notice(\"Can't get size of '%s/%s'\", problem_id, element);\n char *error = xasprintf(_(\"Can't get size of '%s'\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n return;\n }\n\n const double requested_size = (double)strlen(value) - item_size;\n /* Don't want to check the size limit in case of reducing of size */\n if (requested_size > 0\n && requested_size > (max_dir_size - get_dirsize(g_settings_dump_location)))\n {\n log_notice(\"No problem space left in '%s' (requested Bytes %f)\", problem_id, requested_size);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n _(\"No problem space left\"));\n }\n else\n {\n dd_save_text(dd, element, value);\n g_dbus_method_invocation_return_value(invocation, NULL);\n }\n\n dd_close(dd);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n\n g_variant_get(parameters, \"(&s&s)\", &problem_id, &element);\n\n if (!allowed_problem_dir(problem_id))\n {\n return_InvalidProblemDir_error(invocation, problem_id);\n return;\n }\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n const int res = dd_delete_item(dd, element);\n dd_close(dd);\n\n if (res != 0)\n {\n log_notice(\"Can't delete the element '%s' from the problem directory '%s'\", element, problem_id);\n char *error = xasprintf(_(\"Can't delete the element '%s' from the problem directory '%s'\"), element, problem_id);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteProblem\") == 0)\n {\n /* Dbus parameters are always tuples.\n * In this case, it's (as) - a tuple of one element (array of strings).\n * Need to fetch the array:\n */\n GVariant *array = g_variant_get_child_value(parameters, 0);\n GList *problem_dirs = string_list_from_variant(array);\n g_variant_unref(array);\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n log_notice(\"dir_name:'%s'\", dir_name);\n if (!allowed_problem_dir(dir_name))\n {\n return_InvalidProblemDir_error(invocation, dir_name);\n goto ret;\n }\n }\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n\n int dir_fd = dd_openfd(dir_name);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", dir_name);\n return_InvalidProblemDir_error(invocation, dir_name);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", dir_name);\n close(dir_fd);\n continue;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n { // if user didn't provide correct credentials, just move to the next dir\n close(dir_fd);\n continue;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, dir_name, /*flags:*/ 0);\n if (dd)\n {\n if (dd_delete(dd) != 0)\n {\n error_msg(\"Failed to delete problem directory '%s'\", dir_name);\n dd_close(dd);\n }\n }\n }\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n ret:\n list_free_with_free(problem_dirs);\n return;\n }\n\n if (g_strcmp0(method_name, \"FindProblemByElementInTimeRange\") == 0)\n {\n const gchar *element;\n const gchar *value;\n glong timestamp_from;\n glong timestamp_to;\n gboolean all;\n\n g_variant_get_child(parameters, 0, \"&s\", &element);\n g_variant_get_child(parameters, 1, \"&s\", &value);\n g_variant_get_child(parameters, 2, \"x\", ×tamp_from);\n g_variant_get_child(parameters, 3, \"x\", ×tamp_to);\n g_variant_get_child(parameters, 4, \"b\", &all);\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name\", element);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n if (all && polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n\n GList *dirs = get_problem_dirs_for_element_in_time(caller_uid, element, value, timestamp_from,\n timestamp_to);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"Quit\") == 0)\n {\n g_dbus_method_invocation_return_value(invocation, NULL);\n g_main_loop_quit(loop);\n return;\n }\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"handle_method_call","file_name":"src/dbus/abrt-dbus.c","commit_link":"github.com/abrt/abrt/commit/7a47f57975be0d285a2f20758e4572dca6d9cdd3","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#5-226e5ab02e65","input":"def _inject_file_into_fs(fs, path, contents):\n absolute_path = os.path.join(fs, path.lstrip('/'))\n parent_dir = os.path.dirname(absolute_path)\n utils.execute('mkdir', '-p', parent_dir, run_as_root=True)\n utils.execute('tee', absolute_path, process_input=contents,\n run_as_root=True)","target":"def _inject_file_into_fs(fs, path, contents, append=False):\n absolute_path = _join_and_check_path_within_fs(fs, path.lstrip('/'))\n\n parent_dir = os.path.dirname(absolute_path)\n utils.execute('mkdir', '-p', parent_dir, run_as_root=True)\n\n args = []\n if append:\n args.append('-a')\n args.append(absolute_path)\n\n kwargs = dict(process_input=contents, run_as_root=True)\n\n utils.execute('tee', *args, **kwargs)","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"_inject_file_into_fs","file_name":"nova/virt/disk/api.py","commit_link":"github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#6-babb75076496","input":"set_interface_var(const char *iface,\n\t\t const char *var, const char *name,\n\t\t uint32_t val)\n{\n\tFILE *fp;\n\tchar spath[64+IFNAMSIZ];\t/* XXX: magic constant */\n\tif (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath))\n\t\treturn -1;\n\n\tif (access(spath, F_OK) != 0)\n\t\treturn -1;\n\n\tfp = fopen(spath, \"w\");\n\tif (!fp) {\n\t\tif (name)\n\t\t\tflog(LOG_ERR, \"failed to set %s (%u) for %s: %s\",\n\t\t\t name, val, iface, strerror(errno));\n\t\treturn -1;\n\t}\n\tfprintf(fp, \"%u\", val);\n\tfclose(fp);\n\n\treturn 0;\n}","target":"set_interface_var(const char *iface,\n\t\t const char *var, const char *name,\n\t\t uint32_t val)\n{\n\tFILE *fp;\n\tchar spath[64+IFNAMSIZ];\t/* XXX: magic constant */\n\tif (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath))\n\t\treturn -1;\n\n\t/* No path traversal */\n\tif (strstr(name, \"..\") || strchr(name, '/'))\n\t\treturn -1;\n\n\tif (access(spath, F_OK) != 0)\n\t\treturn -1;\n\n\tfp = fopen(spath, \"w\");\n\tif (!fp) {\n\t\tif (name)\n\t\t\tflog(LOG_ERR, \"failed to set %s (%u) for %s: %s\",\n\t\t\t name, val, iface, strerror(errno));\n\t\treturn -1;\n\t}\n\tfprintf(fp, \"%u\", val);\n\tfclose(fp);\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"set_interface_var","file_name":"device-linux.c","commit_link":"github.com/reubenhwk/radvd/commit/92e22ca23e52066da2258df8c76a2dca8a428bcc","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#7-ad0f9aabe39b","input":" def cut(self, key):\n try:\n self.etcd.delete(os.path.join(self.namespace, key))\n except etcd.EtcdKeyNotFound:\n return False\n except etcd.EtcdException as err:\n log_error(\"Error removing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to cut key')\n return True","target":" def cut(self, key):\n try:\n self.etcd.delete(self._absolute_key(key))\n except etcd.EtcdKeyNotFound:\n return False\n except etcd.EtcdException as err:\n log_error(\"Error removing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to cut key')\n return True","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"cut","file_name":"custodia/store/etcdstore.py","commit_link":"github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#8-467508569625","input":"wiki_handle_http_request(HttpRequest *req)\n{\n HttpResponse *res = http_response_new(req);\n char *page = http_request_get_path_info(req); \n char *command = http_request_get_query_string(req); \n char *wikitext = \"\";\n\n util_dehttpize(page); \t/* remove any encoding on the requested\n\t\t\t\t page name. */\n\n if (!strcmp(page, \"/\"))\n {\n if (access(\"WikiHome\", R_OK) != 0)\n\twiki_redirect(res, \"/WikiHome?create\");\n page = \"/WikiHome\";\n }\n\n if (!strcmp(page, \"/styles.css\"))\n {\n /* Return CSS page */\n http_response_set_content_type(res, \"text/css\");\n http_response_printf(res, \"%s\", CssData);\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"/favicon.ico\"))\n {\n /* Return favicon */\n http_response_set_content_type(res, \"image/ico\");\n http_response_set_data(res, FaviconData, FaviconDataLen);\n http_response_send(res);\n exit(0);\n }\n\n\n page = page + 1; \t\t/* skip slash */\n\n if (!strncmp(page, \"api/\", 4))\n {\n char *p;\n\n page += 4; \n for (p=page; *p != '\\0'; p++)\n\tif (*p=='?') { *p ='\\0'; break; }\n \n wiki_handle_rest_call(req, res, page); \n exit(0);\n }\n\n /* A little safety. issue a malformed request for any paths,\n * There shouldn't need to be any..\n */\n if (strchr(page, '/'))\n {\n http_response_set_status(res, 404, \"Not Found\");\n http_response_printf(res, \"404 Not Found\\n\");\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"Changes\"))\n {\n wiki_show_changes_page(res);\n }\n else if (!strcmp(page, \"ChangesRss\"))\n {\n wiki_show_changes_page_rss(res);\n }\n else if (!strcmp(page, \"Search\"))\n {\n wiki_show_search_results_page(res, http_request_param_get(req, \"expr\"));\n }\n else if (!strcmp(page, \"Create\"))\n {\n if ( (wikitext = http_request_param_get(req, \"title\")) != NULL)\n\t{\n\t /* create page and redirect */\n\t wiki_redirect(res, http_request_param_get(req, \"title\"));\n\t}\n else\n\t{\n\t /* show create page form */\n\t wiki_show_create_page(res);\n\t}\n }\n else\n {\n /* TODO: dont blindly write wikitext data to disk */\n if ( (wikitext = http_request_param_get(req, \"wikitext\")) != NULL)\n\t{\n\t file_write(page, wikitext);\t \n\t}\n\n if (access(page, R_OK) == 0) \t/* page exists */\n\t{\n\t wikitext = file_read(page);\n\t \n\t if (!strcmp(command, \"edit\"))\n\t {\n\t /* print edit page */\n\t wiki_show_edit_page(res, wikitext, page);\n\t }\n\t else\n\t {\n\t wiki_show_page(res, wikitext, page);\n\t }\n\t}\n else\n\t{\n\t if (!strcmp(command, \"create\"))\n\t {\n\t wiki_show_edit_page(res, NULL, page);\n\t }\n\t else\n\t {\n\t char buf[1024];\n\t snprintf(buf, 1024, \"%s?create\", page);\n\t wiki_redirect(res, buf);\n\t }\n\t}\n }\n\n}","target":"wiki_handle_http_request(HttpRequest *req)\n{\n HttpResponse *res = http_response_new(req);\n char *page = http_request_get_path_info(req); \n char *command = http_request_get_query_string(req); \n char *wikitext = \"\";\n\n util_dehttpize(page); \t/* remove any encoding on the requested\n\t\t\t\t page name. */\n\n if (!strcmp(page, \"/\"))\n {\n if (access(\"WikiHome\", R_OK) != 0)\n\twiki_redirect(res, \"/WikiHome?create\");\n page = \"/WikiHome\";\n }\n\n if (!strcmp(page, \"/styles.css\"))\n {\n /* Return CSS page */\n http_response_set_content_type(res, \"text/css\");\n http_response_printf(res, \"%s\", CssData);\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"/favicon.ico\"))\n {\n /* Return favicon */\n http_response_set_content_type(res, \"image/ico\");\n http_response_set_data(res, FaviconData, FaviconDataLen);\n http_response_send(res);\n exit(0);\n }\n\n\n page = page + 1; \t\t/* skip slash */\n\n if (!strncmp(page, \"api/\", 4))\n {\n char *p;\n\n page += 4; \n for (p=page; *p != '\\0'; p++)\n\tif (*p=='?') { *p ='\\0'; break; }\n \n wiki_handle_rest_call(req, res, page); \n exit(0);\n }\n\n /* A little safety. issue a malformed request for any paths,\n * There shouldn't need to be any..\n */\n if (!page_name_is_good(page))\n {\n http_response_set_status(res, 404, \"Not Found\");\n http_response_printf(res, \"404 Not Found\\n\");\n http_response_send(res);\n exit(0);\n }\n\n if (!strcmp(page, \"Changes\"))\n {\n wiki_show_changes_page(res);\n }\n else if (!strcmp(page, \"ChangesRss\"))\n {\n wiki_show_changes_page_rss(res);\n }\n else if (!strcmp(page, \"Search\"))\n {\n wiki_show_search_results_page(res, http_request_param_get(req, \"expr\"));\n }\n else if (!strcmp(page, \"Create\"))\n {\n if ( (wikitext = http_request_param_get(req, \"title\")) != NULL)\n\t{\n\t /* create page and redirect */\n\t wiki_redirect(res, http_request_param_get(req, \"title\"));\n\t}\n else\n\t{\n\t /* show create page form */\n\t wiki_show_create_page(res);\n\t}\n }\n else\n {\n /* TODO: dont blindly write wikitext data to disk */\n if ( (wikitext = http_request_param_get(req, \"wikitext\")) != NULL)\n\t{\n\t file_write(page, wikitext);\t \n\t}\n\n if (access(page, R_OK) == 0) \t/* page exists */\n\t{\n\t wikitext = file_read(page);\n\t \n\t if (!strcmp(command, \"edit\"))\n\t {\n\t /* print edit page */\n\t wiki_show_edit_page(res, wikitext, page);\n\t }\n\t else\n\t {\n\t wiki_show_page(res, wikitext, page);\n\t }\n\t}\n else\n\t{\n\t if (!strcmp(command, \"create\"))\n\t {\n\t wiki_show_edit_page(res, NULL, page);\n\t }\n\t else\n\t {\n\t char buf[1024];\n\t snprintf(buf, 1024, \"%s?create\", page);\n\t wiki_redirect(res, buf);\n\t }\n\t}\n }\n\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"wiki_handle_http_request","file_name":"src/wiki.c","commit_link":"github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#9-bb0b57f9d8fa","input":" def candidate_paths_for_url(self, url):\n for root, prefix in self.directories:\n if url.startswith(prefix):\n yield os.path.join(root, url[len(prefix):])","target":" def candidate_paths_for_url(self, url):\n for root, prefix in self.directories:\n if url.startswith(prefix):\n path = os.path.join(root, url[len(prefix):])\n if os.path.commonprefix((root, path)) == root:\n yield path","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"candidate_paths_for_url","file_name":"whitenoise/base.py","commit_link":"github.com/evansd/whitenoise/commit/4d8a3ab1e97d7ddb18b3fa8b4909c92bad5529c6","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#10-fde387f9e8e5","input":"def updateKey(client):\n\t\"\"\"Updates the contents of a key that already exists in our system.\n\tReturns an error if the specified key doesn't exist for the specified user.\n\t\"\"\"\n\tglobal NOT_FOUND\n\tglobal CREATED\n\n\tvalidateClient(client)\n\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateNewKeyData(token_data)\n\n\t# Use 'w' flag to replace existing key file with the new key data\n\tif os.path.isfile('keys/%s/%s.key' % (client, token_data['name'])):\n\t\twith open('keys/%s/%s.key' % (client, token_data['name']), 'w') as f:\n\t\t\tf.write(token_data['key'])\n\telse:\n\t\traise FoxlockError(NOT_FOUND, \"Key '%s' not found\" % token_data['name'])\n\n\treturn 'Key successfully updated', CREATED","target":"def updateKey(client):\n\t\"\"\"Updates the contents of a key that already exists in our system.\n\tReturns an error if the specified key doesn't exist for the specified user.\n\t\"\"\"\n\tglobal NOT_FOUND\n\tglobal CREATED\n\n\tvalidateClient(client)\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateNewKeyData(token_data)\n\tvalidateKeyName(token_data['name'])\n\n\t# Use 'w' flag to replace existing key file with the new key data\n\tif os.path.isfile('keys/%s/%s.key' % (client, token_data['name'])):\n\t\twith open('keys/%s/%s.key' % (client, token_data['name']), 'w') as f:\n\t\t\tf.write(token_data['key'])\n\telse:\n\t\traise FoxlockError(NOT_FOUND, \"Key '%s' not found\" % token_data['name'])\n\n\treturn 'Key successfully updated', CREATED","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"updateKey","file_name":"impl.py","commit_link":"github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#11-3bdc24de76e9","input":"def create_basename_core(basename):\n try:\n basename = basename.casefold()\n except Exception:\n basename = basename.lower()\n\n basename = basename.replace(' ', '-')\n basename = re.sub(r'<[^>]*>', r'', basename)\n basename = re.sub(r'[^a-z0-9\\-]', r'', basename)\n basename = re.sub(r'\\-\\-', r'-', basename)\n basename = urllib.parse.quote_plus(basename)\n\n return basename","target":"def create_basename_core(basename):\n try:\n basename = basename.casefold()\n except Exception:\n basename = basename.lower()\n\n basename = re.sub(r'[ \\./]', r'-', basename)\n basename = re.sub(r'<[^>]*>', r'', basename)\n basename = re.sub(r'[^a-z0-9\\-]', r'', basename)\n basename = re.sub(r'\\-\\-', r'-', basename)\n basename = urllib.parse.quote_plus(basename)\n\n return basename","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"create_basename_core","file_name":"MeTal/core/utils.py","commit_link":"github.com/syegulalp/mercury/commit/3f7c7442fa49aec37577dbdb47ce11a848e7bd03","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#12-71b22f274d93","input":" def get(self, key):\n try:\n result = self.etcd.get(os.path.join(self.namespace, key))\n except etcd.EtcdException as err:\n log_error(\"Error fetching key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to get key')\n return result.value","target":" def get(self, key):\n try:\n result = self.etcd.get(self._absolute_key(key))\n except etcd.EtcdException as err:\n log_error(\"Error fetching key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to get key')\n return result.value","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"get","file_name":"custodia/store/etcdstore.py","commit_link":"github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#13-055305645a7a","input":"PHYSICALPATH_FUNC(mod_alias_physical_handler) {\n\tplugin_data *p = p_d;\n\tint uri_len, basedir_len;\n\tchar *uri_ptr;\n\tsize_t k;\n\n\tif (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON;\n\n\tmod_alias_patch_connection(srv, con, p);\n\n\t/* not to include the tailing slash */\n\tbasedir_len = buffer_string_length(con->physical.basedir);\n\tif ('/' == con->physical.basedir->ptr[basedir_len-1]) --basedir_len;\n\turi_len = buffer_string_length(con->physical.path) - basedir_len;\n\turi_ptr = con->physical.path->ptr + basedir_len;\n\n\tfor (k = 0; k < p->conf.alias->used; k++) {\n\t\tdata_string *ds = (data_string *)p->conf.alias->data[k];\n\t\tint alias_len = buffer_string_length(ds->key);\n\n\t\tif (alias_len > uri_len) continue;\n\t\tif (buffer_is_empty(ds->key)) continue;\n\n\t\tif (0 == (con->conf.force_lowercase_filenames ?\n\t\t\t\t\tstrncasecmp(uri_ptr, ds->key->ptr, alias_len) :\n\t\t\t\t\tstrncmp(uri_ptr, ds->key->ptr, alias_len))) {\n\t\t\t/* matched */\n\n\t\t\tbuffer_copy_buffer(con->physical.basedir, ds->value);\n\t\t\tbuffer_copy_buffer(srv->tmp_buf, ds->value);\n\t\t\tbuffer_append_string(srv->tmp_buf, uri_ptr + alias_len);\n\t\t\tbuffer_copy_buffer(con->physical.path, srv->tmp_buf);\n\n\t\t\treturn HANDLER_GO_ON;\n\t\t}\n\t}\n\n\t/* not found */\n\treturn HANDLER_GO_ON;\n}","target":"PHYSICALPATH_FUNC(mod_alias_physical_handler) {\n\tplugin_data *p = p_d;\n\tint uri_len, basedir_len;\n\tchar *uri_ptr;\n\tsize_t k;\n\n\tif (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON;\n\n\tmod_alias_patch_connection(srv, con, p);\n\n\t/* not to include the tailing slash */\n\tbasedir_len = buffer_string_length(con->physical.basedir);\n\tif ('/' == con->physical.basedir->ptr[basedir_len-1]) --basedir_len;\n\turi_len = buffer_string_length(con->physical.path) - basedir_len;\n\turi_ptr = con->physical.path->ptr + basedir_len;\n\n\tfor (k = 0; k < p->conf.alias->used; k++) {\n\t\tdata_string *ds = (data_string *)p->conf.alias->data[k];\n\t\tint alias_len = buffer_string_length(ds->key);\n\n\t\tif (alias_len > uri_len) continue;\n\t\tif (buffer_is_empty(ds->key)) continue;\n\n\t\tif (0 == (con->conf.force_lowercase_filenames ?\n\t\t\t\t\tstrncasecmp(uri_ptr, ds->key->ptr, alias_len) :\n\t\t\t\t\tstrncmp(uri_ptr, ds->key->ptr, alias_len))) {\n\t\t\t/* matched */\n\n\t\t\t/* check for path traversal in url-path following alias if key\n\t\t\t * does not end in slash, but replacement value ends in slash */\n\t\t\tif (uri_ptr[alias_len] == '.') {\n\t\t\t\tchar *s = uri_ptr + alias_len + 1;\n\t\t\t\tif (*s == '.') ++s;\n\t\t\t\tif (*s == '/' || *s == '\\0') {\n\t\t\t\t\tsize_t vlen = buffer_string_length(ds->value);\n\t\t\t\t\tif (0 != alias_len && ds->key->ptr[alias_len-1] != '/'\n\t\t\t\t\t && 0 != vlen && ds->value->ptr[vlen-1] == '/') {\n\t\t\t\t\t\tcon->http_status = 403;\n\t\t\t\t\t\treturn HANDLER_FINISHED;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbuffer_copy_buffer(con->physical.basedir, ds->value);\n\t\t\tbuffer_copy_buffer(srv->tmp_buf, ds->value);\n\t\t\tbuffer_append_string(srv->tmp_buf, uri_ptr + alias_len);\n\t\t\tbuffer_copy_buffer(con->physical.path, srv->tmp_buf);\n\n\t\t\treturn HANDLER_GO_ON;\n\t\t}\n\t}\n\n\t/* not found */\n\treturn HANDLER_GO_ON;\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"PHYSICALPATH_FUNC","file_name":"src/mod_alias.c","commit_link":"github.com/lighttpd/lighttpd1.4/commit/2105dae0f9d7a964375ce681e53cb165375f84c1","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#14-89325fac8183","input":" def download_check_files(self, filelist):\n # only admins and allowed users may download\n if not cherrypy.session['admin']:\n uo = self.useroptions.forUser(self.getUserId())\n if not uo.getOptionValue('media.may_download'):\n return 'not_permitted'\n # make sure nobody tries to escape from basedir\n for f in filelist:\n if '/../' in f:\n return 'invalid_file'\n # make sure all files are smaller than maximum download size\n size_limit = cherry.config['media.maximum_download_size']\n try:\n if self.model.file_size_within_limit(filelist, size_limit):\n return 'ok'\n else:\n return 'too_big'\n except OSError as e: # use OSError for python2 compatibility\n return str(e)","target":" def download_check_files(self, filelist):\n # only admins and allowed users may download\n if not cherrypy.session['admin']:\n uo = self.useroptions.forUser(self.getUserId())\n if not uo.getOptionValue('media.may_download'):\n return 'not_permitted'\n # make sure nobody tries to escape from basedir\n for f in filelist:\n # don't allow to traverse up in the file system\n if '/../' in f or f.startswith('../'):\n return 'invalid_file'\n # CVE-2015-8309: do not allow absolute file paths\n if os.path.isabs(f):\n return 'invalid_file'\n # make sure all files are smaller than maximum download size\n size_limit = cherry.config['media.maximum_download_size']\n try:\n if self.model.file_size_within_limit(filelist, size_limit):\n return 'ok'\n else:\n return 'too_big'\n except OSError as e: # use OSError for python2 compatibility\n return str(e)","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"download_check_files","file_name":"cherrymusicserver/httphandler.py","commit_link":"github.com/devsnd/cherrymusic/commit/62dec34a1ea0741400dd6b6c660d303dcd651e86","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#15-76bee86ce6de","input":" def get_files(self, submit_id, password=None, astree=False):\n \"\"\"\n Returns files from a submitted analysis.\n @param password: The password to unlock container archives with\n @param astree: sflock option; determines the format in which the files are returned\n @return: A tree of files\n \"\"\"\n submit = Database().view_submit(submit_id)\n files, duplicates = [], []\n\n for data in submit.data[\"data\"]:\n if data[\"type\"] == \"file\":\n filename = Storage.get_filename_from_path(data[\"data\"])\n filepath = os.path.join(submit.tmp_path, data[\"data\"])\n filedata = open(filepath, \"rb\").read()\n\n unpacked = sflock.unpack(\n filepath=filename, contents=filedata,\n password=password, duplicates=duplicates\n )\n\n if astree:\n unpacked = unpacked.astree()\n\n files.append(unpacked)\n elif data[\"type\"] == \"url\":\n files.append({\n \"filename\": data[\"data\"],\n \"filepath\": \"\",\n \"relapath\": \"\",\n \"selected\": True,\n \"size\": 0,\n \"type\": \"url\",\n \"package\": \"ie\",\n \"extrpath\": [],\n \"duplicate\": False,\n \"children\": [],\n \"mime\": \"text/html\",\n \"finger\": {\n \"magic_human\": \"url\",\n \"magic\": \"url\"\n }\n })\n else:\n raise RuntimeError(\n \"Unknown data entry type: %s\" % data[\"type\"]\n )\n\n return {\n \"files\": files,\n \"path\": submit.tmp_path,\n }","target":" def get_files(self, submit_id, password=None, astree=False):\n \"\"\"\n Returns files from a submitted analysis.\n @param password: The password to unlock container archives with\n @param astree: sflock option; determines the format in which the files are returned\n @return: A tree of files\n \"\"\"\n submit = Database().view_submit(submit_id)\n files, duplicates = [], []\n\n for data in submit.data[\"data\"]:\n if data[\"type\"] == \"file\":\n filename = Storage.get_filename_from_path(data[\"data\"])\n filepath = os.path.join(submit.tmp_path, filename)\n\n unpacked = sflock.unpack(\n filepath=filepath, password=password, duplicates=duplicates\n )\n\n if astree:\n unpacked = unpacked.astree(sanitize=True)\n\n files.append(unpacked)\n elif data[\"type\"] == \"url\":\n files.append({\n \"filename\": data[\"data\"],\n \"filepath\": \"\",\n \"relapath\": \"\",\n \"selected\": True,\n \"size\": 0,\n \"type\": \"url\",\n \"package\": \"ie\",\n \"extrpath\": [],\n \"duplicate\": False,\n \"children\": [],\n \"mime\": \"text/html\",\n \"finger\": {\n \"magic_human\": \"url\",\n \"magic\": \"url\"\n }\n })\n else:\n raise RuntimeError(\n \"Unknown data entry type: %s\" % data[\"type\"]\n )\n\n return files","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"get_files","file_name":"cuckoo/core/submit.py","commit_link":"github.com/cuckoosandbox/cuckoo/commit/168cabf86730d56b7fa319278bf0f0034052666a","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#16-e17ea3436592","input":" def handle(self, keepalive=True, initial_timeout=None):\n # we are requested to skip processing and keep the previous values\n if self.skip:\n return self.response.handle()\n\n # default to no keepalive in case something happens while even trying ensure we have a request\n self.keepalive = False\n\n self.headers = HTTPHeaders()\n\n # if initial_timeout is set, only wait that long for the initial request line\n if initial_timeout:\n self.connection.settimeout(initial_timeout)\n else:\n self.connection.settimeout(self.timeout)\n\n # get request line\n try:\n # ignore empty lines waiting on request\n request = '\\r\\n'\n while request == '\\r\\n':\n request = self.rfile.readline(max_line_size + 1).decode(http_encoding)\n # if read hits timeout or has some other error, ignore the request\n except Exception:\n return True\n\n # ignore empty requests\n if not request:\n return True\n\n # we have a request, go back to normal timeout\n if initial_timeout:\n self.connection.settimeout(self.timeout)\n\n # remove \\r\\n from the end\n self.request_line = request[:-2]\n\n # set some reasonable defaults in case the worst happens and we need to tell the client\n self.method = ''\n self.resource = '/'\n\n try:\n # HTTP Status 414\n if len(request) > max_line_size:\n raise HTTPError(414)\n\n # HTTP Status 400\n if request[-2:] != '\\r\\n':\n raise HTTPError(400)\n\n # try the request line and error out if can't parse it\n try:\n self.method, self.resource, self.request_http = self.request_line.split()\n # HTTP Status 400\n except ValueError:\n raise HTTPError(400)\n\n # HTTP Status 505\n if self.request_http != http_version:\n raise HTTPError(505)\n\n # read and parse request headers\n while True:\n line = self.rfile.readline(max_line_size + 1).decode(http_encoding)\n\n # hit end of headers\n if line == '\\r\\n':\n break\n\n self.headers.add(line)\n\n # if we are requested to close the connection after we finish, do so\n if self.headers.get('Connection') == 'close':\n self.keepalive = False\n # else since we are sure we have a request and have read all of the request data, keepalive for more later (if allowed)\n else:\n self.keepalive = keepalive\n\n # find a matching regex to handle the request with\n for regex, handler in self.server.routes.items():\n match = regex.match(self.resource)\n if match:\n # create a dictionary of groups\n groups = match.groupdict()\n values = groups.values()\n\n for idx, group in enumerate(match.groups()):\n if group not in values:\n groups[idx] = group\n\n # create handler\n self.handler = handler(self, self.response, groups)\n break\n # HTTP Status 404\n # if loop is not broken (handler is not found), raise a 404\n else:\n raise HTTPError(404)\n # use DummyHandler so the error is raised again when ready for response\n except Exception as error:\n self.handler = DummyHandler(self, self.response, (), error)\n finally:\n # we finished listening and handling early errors and so let a response class now finish up the job of talking\n return self.response.handle()","target":" def handle(self, keepalive=True, initial_timeout=None):\n # we are requested to skip processing and keep the previous values\n if self.skip:\n return self.response.handle()\n\n # default to no keepalive in case something happens while even trying ensure we have a request\n self.keepalive = False\n\n self.headers = HTTPHeaders()\n\n # if initial_timeout is set, only wait that long for the initial request line\n if initial_timeout:\n self.connection.settimeout(initial_timeout)\n else:\n self.connection.settimeout(self.timeout)\n\n # get request line\n try:\n # ignore empty lines waiting on request\n request = '\\r\\n'\n while request == '\\r\\n':\n request = self.rfile.readline(max_line_size + 1).decode(http_encoding)\n # if read hits timeout or has some other error, ignore the request\n except Exception:\n return True\n\n # ignore empty requests\n if not request:\n return True\n\n # we have a request, go back to normal timeout\n if initial_timeout:\n self.connection.settimeout(self.timeout)\n\n # remove \\r\\n from the end\n self.request_line = request[:-2]\n\n # set some reasonable defaults in case the worst happens and we need to tell the client\n self.method = ''\n self.resource = '/'\n\n try:\n # HTTP Status 414\n if len(request) > max_line_size:\n raise HTTPError(414)\n\n # HTTP Status 400\n if request[-2:] != '\\r\\n':\n raise HTTPError(400)\n\n # try the request line and error out if can't parse it\n try:\n self.method, resource, self.request_http = self.request_line.split()\n self.resource = urllib.parse.unquote(resource)\n # HTTP Status 400\n except ValueError:\n raise HTTPError(400)\n\n # HTTP Status 505\n if self.request_http != http_version:\n raise HTTPError(505)\n\n # read and parse request headers\n while True:\n line = self.rfile.readline(max_line_size + 1).decode(http_encoding)\n\n # hit end of headers\n if line == '\\r\\n':\n break\n\n self.headers.add(line)\n\n # if we are requested to close the connection after we finish, do so\n if self.headers.get('Connection') == 'close':\n self.keepalive = False\n # else since we are sure we have a request and have read all of the request data, keepalive for more later (if allowed)\n else:\n self.keepalive = keepalive\n\n # find a matching regex to handle the request with\n for regex, handler in self.server.routes.items():\n match = regex.match(self.resource)\n if match:\n # create a dictionary of groups\n groups = match.groupdict()\n values = groups.values()\n\n for idx, group in enumerate(match.groups()):\n if group not in values:\n groups[idx] = group\n\n # create handler\n self.handler = handler(self, self.response, groups)\n break\n # HTTP Status 404\n # if loop is not broken (handler is not found), raise a 404\n else:\n raise HTTPError(404)\n # use DummyHandler so the error is raised again when ready for response\n except Exception as error:\n self.handler = DummyHandler(self, self.response, (), error)\n finally:\n # we finished listening and handling early errors and so let a response class now finish up the job of talking\n return self.response.handle()","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"handle","file_name":"fooster/web/web.py","commit_link":"github.com/fkmclane/python-fooster-web/commit/80202a6d3788ad1212a162d19785c600025e6aa4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#17-cf939205715a","input":"int dd_delete_item(struct dump_dir *dd, const char *name)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n char *path = concat_path_file(dd->dd_dirname, name);\n int res = unlink(path);\n\n if (res < 0)\n {\n if (errno == ENOENT)\n errno = res = 0;\n else\n perror_msg(\"Can't delete file '%s'\", path);\n }\n\n free(path);\n return res;\n}","target":"int dd_delete_item(struct dump_dir *dd, const char *name)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot delete item. '%s' is not a valid file name\", name);\n\n char *path = concat_path_file(dd->dd_dirname, name);\n int res = unlink(path);\n\n if (res < 0)\n {\n if (errno == ENOENT)\n errno = res = 0;\n else\n perror_msg(\"Can't delete file '%s'\", path);\n }\n\n free(path);\n return res;\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"dd_delete_item","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#18-341b4fb32824","input":"\tdef render(self, request):\n\t\taction = \"download\"\n\t\tif \"action\" in request.args:\n\t\t\taction = request.args[\"action\"][0]\n\n\t\tif \"file\" in request.args:\n\t\t\tfilename = request.args[\"file\"][0].decode('utf-8', 'ignore').encode('utf-8')\n\t\t\tfilename = re.sub(\"^/+\", \"/\", os.path.realpath(filename))\n\n\t\t\tif not os.path.exists(filename):\n\t\t\t\treturn \"File '%s' not found\" % (filename)\n\n\t\t\tif action == \"stream\":\n\t\t\t\tname = \"stream\"\n\t\t\t\tif \"name\" in request.args:\n\t\t\t\t\tname = request.args[\"name\"][0]\n\n\t\t\t\tport = config.OpenWebif.port.value\n\t\t\t\tproto = 'http'\n\t\t\t\tif request.isSecure():\n\t\t\t\t\tport = config.OpenWebif.https_port.value\n\t\t\t\t\tproto = 'https'\n\t\t\t\tourhost = request.getHeader('host')\n\t\t\t\tm = re.match('.+\\:(\\d+)$', ourhost)\n\t\t\t\tif m is not None:\n\t\t\t\t\tport = m.group(1)\n\n\t\t\t\tresponse = \"#EXTM3U\\n#EXTVLCOPT--http-reconnect=true\\n#EXTINF:-1,%s\\n%s://%s:%s/file?action=download&file=%s\" % (name, proto, request.getRequestHostname(), port, quote(filename))\n\t\t\t\trequest.setHeader(\"Content-Disposition\", 'attachment;filename=\"%s.m3u\"' % name)\n\t\t\t\trequest.setHeader(\"Content-Type\", \"application/x-mpegurl\")\n\t\t\t\treturn response\n\t\t\telif action == \"delete\":\n\t\t\t\trequest.setResponseCode(http.OK)\n\t\t\t\treturn \"TODO: DELETE FILE: %s\" % (filename)\n\t\t\telif action == \"download\":\n\t\t\t\trequest.setHeader(\"Content-Disposition\", \"attachment;filename=\\\"%s\\\"\" % (filename.split('/')[-1]))\n\t\t\t\trfile = static.File(filename, defaultType = \"application/octet-stream\")\n\t\t\t\treturn rfile.render(request)\n\t\t\telse: \n\t\t\t\treturn \"wrong action parameter\"\n\n\t\tif \"dir\" in request.args:\n\t\t\tpath = request.args[\"dir\"][0]\n\t\t\tpattern = '*'\n\t\t\tdata = []\n\t\t\tif \"pattern\" in request.args:\n\t\t\t\tpattern = request.args[\"pattern\"][0]\n\t\t\tdirectories = []\n\t\t\tfiles = []\n\t\t\tif fileExists(path):\n\t\t\t\ttry:\n\t\t\t\t\tfiles = glob.glob(path+'/'+pattern)\n\t\t\t\texcept:\n\t\t\t\t\tfiles = []\n\t\t\t\tfiles.sort()\n\t\t\t\ttmpfiles = files[:]\n\t\t\t\tfor x in tmpfiles:\n\t\t\t\t\tif os.path.isdir(x):\n\t\t\t\t\t\tdirectories.append(x + '/')\n\t\t\t\t\t\tfiles.remove(x)\n\t\t\t\tdata.append({\"result\": True,\"dirs\": directories,\"files\": files})\n\t\t\telse:\n\t\t\t\tdata.append({\"result\": False,\"message\": \"path %s not exits\" % (path)})\n\t\t\trequest.setHeader(\"content-type\", \"application/json; charset=utf-8\")\n\t\t\treturn json.dumps(data, indent=2)","target":"\tdef render(self, request):\n\t\taction = \"download\"\n\t\tif \"action\" in request.args:\n\t\t\taction = request.args[\"action\"][0]\n\n\t\tif \"file\" in request.args:\n\t\t\tfilename = lenient_force_utf_8(request.args[\"file\"][0])\n\t\t\tfilename = sanitise_filename_slashes(os.path.realpath(filename))\n\n\t\t\tif not os.path.exists(filename):\n\t\t\t\treturn \"File '%s' not found\" % (filename)\n\n\t\t\tif action == \"stream\":\n\t\t\t\tname = \"stream\"\n\t\t\t\tif \"name\" in request.args:\n\t\t\t\t\tname = request.args[\"name\"][0]\n\n\t\t\t\tport = config.OpenWebif.port.value\n\t\t\t\tproto = 'http'\n\t\t\t\tif request.isSecure():\n\t\t\t\t\tport = config.OpenWebif.https_port.value\n\t\t\t\t\tproto = 'https'\n\t\t\t\tourhost = request.getHeader('host')\n\t\t\t\tm = re.match('.+\\:(\\d+)$', ourhost)\n\t\t\t\tif m is not None:\n\t\t\t\t\tport = m.group(1)\n\n\t\t\t\tresponse = \"#EXTM3U\\n#EXTVLCOPT--http-reconnect=true\\n#EXTINF:-1,%s\\n%s://%s:%s/file?action=download&file=%s\" % (name, proto, request.getRequestHostname(), port, quote(filename))\n\t\t\t\trequest.setHeader(\"Content-Disposition\", 'attachment;filename=\"%s.m3u\"' % name)\n\t\t\t\trequest.setHeader(\"Content-Type\", \"application/x-mpegurl\")\n\t\t\t\treturn response\n\t\t\telif action == \"delete\":\n\t\t\t\trequest.setResponseCode(http.OK)\n\t\t\t\treturn \"TODO: DELETE FILE: %s\" % (filename)\n\t\t\telif action == \"download\":\n\t\t\t\trequest.setHeader(\"Content-Disposition\", \"attachment;filename=\\\"%s\\\"\" % (filename.split('/')[-1]))\n\t\t\t\trfile = static.File(filename, defaultType = \"application/octet-stream\")\n\t\t\t\treturn rfile.render(request)\n\t\t\telse: \n\t\t\t\treturn \"wrong action parameter\"\n\n\t\tif \"dir\" in request.args:\n\t\t\tpath = request.args[\"dir\"][0]\n\t\t\tpattern = '*'\n\t\t\tdata = []\n\t\t\tif \"pattern\" in request.args:\n\t\t\t\tpattern = request.args[\"pattern\"][0]\n\t\t\tdirectories = []\n\t\t\tfiles = []\n\t\t\tif fileExists(path):\n\t\t\t\ttry:\n\t\t\t\t\tfiles = glob.glob(path+'/'+pattern)\n\t\t\t\texcept:\n\t\t\t\t\tfiles = []\n\t\t\t\tfiles.sort()\n\t\t\t\ttmpfiles = files[:]\n\t\t\t\tfor x in tmpfiles:\n\t\t\t\t\tif os.path.isdir(x):\n\t\t\t\t\t\tdirectories.append(x + '/')\n\t\t\t\t\t\tfiles.remove(x)\n\t\t\t\tdata.append({\"result\": True,\"dirs\": directories,\"files\": files})\n\t\t\telse:\n\t\t\t\tdata.append({\"result\": False,\"message\": \"path %s not exits\" % (path)})\n\t\t\trequest.setHeader(\"content-type\", \"application/json; charset=utf-8\")\n\t\t\treturn json.dumps(data, indent=2)","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"render","file_name":"plugin/controllers/file.py","commit_link":"github.com/E2OpenPlugins/e2openplugin-OpenWebif/commit/a846b7664eda3a4c51a452e00638cf7337dc2013","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#19-ac95273d3e18","input":"def _inject_net_into_fs(net, fs, execute=None):\n \"\"\"Inject /etc/network/interfaces into the filesystem rooted at fs.\n\n net is the contents of /etc/network/interfaces.\n \"\"\"\n netdir = os.path.join(os.path.join(fs, 'etc'), 'network')\n utils.execute('mkdir', '-p', netdir, run_as_root=True)\n utils.execute('chown', 'root:root', netdir, run_as_root=True)\n utils.execute('chmod', 755, netdir, run_as_root=True)\n netfile = os.path.join(netdir, 'interfaces')\n utils.execute('tee', netfile, process_input=net, run_as_root=True)","target":"def _inject_net_into_fs(net, fs, execute=None):\n \"\"\"Inject /etc/network/interfaces into the filesystem rooted at fs.\n\n net is the contents of /etc/network/interfaces.\n \"\"\"\n netdir = _join_and_check_path_within_fs(fs, 'etc', 'network')\n utils.execute('mkdir', '-p', netdir, run_as_root=True)\n utils.execute('chown', 'root:root', netdir, run_as_root=True)\n utils.execute('chmod', 755, netdir, run_as_root=True)\n\n netfile = os.path.join('etc', 'network', 'interfaces')\n _inject_file_into_fs(fs, netfile, net)","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"_inject_net_into_fs","file_name":"nova/virt/disk/api.py","commit_link":"github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#20-e5de8ad85825","input":" def canonicalize(self):\n \"\"\"::\n\n path = path.canonicalize()\n\n Canonicalize path. ::\n\n # \"/foo/baz\"\n Pyjo.Path.new('/foo/./bar/../baz').canonicalize()\n\n # \"/../baz\"\n Pyjo.Path.new('/foo/../bar/../../baz').canonicalize()\n \"\"\"\n parts = self.parts\n i = 0\n while i < len(parts):\n if parts[i] == '.' or parts[i] == '':\n parts.pop(i)\n elif i < 1 or parts[i] != '..' or parts[i - 1] == '..':\n i += 1\n else:\n i -= 1\n parts.pop(i)\n parts.pop(i)\n\n if not parts:\n self.trailing_slash = False\n\n return self","target":" def canonicalize(self):\n \"\"\"::\n\n path = path.canonicalize()\n\n Canonicalize path by resolving ``.`` and ``..``, in addition ``...`` will be\n treated as ``.`` to protect from path traversal attacks.\n\n # \"/foo/baz\"\n Pyjo.Path.new('/foo/./bar/../baz').canonicalize()\n\n # \"/../baz\"\n Pyjo.Path.new('/foo/../bar/../../baz').canonicalize()\n\n # \"/foo/bar\"\n Pyjo.Path.new('/foo/.../bar').canonicalize()\n \"\"\"\n parts = self.parts\n i = 0\n while i < len(parts):\n if parts[i] == '' or parts[i] == '.' or parts[i] == '...':\n parts.pop(i)\n elif i < 1 or parts[i] != '..' or parts[i - 1] == '..':\n i += 1\n else:\n i -= 1\n parts.pop(i)\n parts.pop(i)\n\n if not parts:\n self.trailing_slash = False\n\n return self","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"canonicalize","file_name":"Pyjo/Path.py","commit_link":"github.com/dex4er/Pyjoyment/commit/e4b115bc80c41615b2133091af3a74ee5d995c2e","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#21-5ecb38f4f63d","input":"CString CWebSock::GetSkinPath(const CString& sSkinName) {\n CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkinName;\n\n if (!CFile::IsDir(sRet)) {\n sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkinName;\n\n if (!CFile::IsDir(sRet)) {\n sRet = CString(_SKINDIR_) + \"/\" + sSkinName;\n }\n }\n\n return sRet + \"/\";\n}","target":"CString CWebSock::GetSkinPath(const CString& sSkinName) {\n const CString sSkin = sSkinName.Replace_n(\"/\", \"_\").Replace_n(\".\", \"_\");\n\n CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkin;\n\n if (!CFile::IsDir(sRet)) {\n sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkin;\n\n if (!CFile::IsDir(sRet)) {\n sRet = CString(_SKINDIR_) + \"/\" + sSkin;\n }\n }\n\n return sRet + \"/\";\n}","lang":"cpp","vul_type":"cwe-022","sven_meta":{"func_name":"CWebSock::GetSkinPath","file_name":"src/WebModules.cpp","commit_link":"github.com/znc/znc/commit/a4a5aeeb17d32937d8c7d743dae9a4cc755ce773","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#22-1ebc2f1e91c2","input":"def addKey(client):\n\t\"\"\"Adds a new key with the specified name and contents.\n\tReturns an error if a key with the specified name already exists.\n\t\"\"\"\n\tglobal BAD_REQUEST\n\tglobal CREATED\n\n\tvalidateClient(client)\n\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateNewKeyData(token_data)\n\n\t# Use 'x' flag so we can throw an error if a key with this name already exists\n\ttry:\n\t\twith open('keys/%s/%s.key' % (client, token_data['name']), 'x') as f:\n\t\t\tf.write(token_data['key'])\n\texcept FileExistsError:\n\t\traise FoxlockError(BAD_REQUEST, \"Key '%s' already exists\" % token_data['name'])\n\n\treturn 'Key successfully created', CREATED","target":"def addKey(client):\n\t\"\"\"Adds a new key with the specified name and contents.\n\tReturns an error if a key with the specified name already exists.\n\t\"\"\"\n\tglobal BAD_REQUEST\n\tglobal CREATED\n\n\tvalidateClient(client)\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateNewKeyData(token_data)\n\tvalidateKeyName(token_data['name'])\n\n\t# Use 'x' flag so we can throw an error if a key with this name already exists\n\ttry:\n\t\twith open('keys/%s/%s.key' % (client, token_data['name']), 'x') as f:\n\t\t\tf.write(token_data['key'])\n\texcept FileExistsError:\n\t\traise FoxlockError(BAD_REQUEST, \"Key '%s' already exists\" % token_data['name'])\n\n\treturn 'Key successfully created', CREATED","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"addKey","file_name":"impl.py","commit_link":"github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#23-7d2d7dc8d2fd","input":"void dd_save_text(struct dump_dir *dd, const char *name, const char *data)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n save_binary_file(full_path, data, strlen(data), dd->dd_uid, dd->dd_gid, dd->mode);\n free(full_path);\n}","target":"void dd_save_text(struct dump_dir *dd, const char *name, const char *data)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot save text. '%s' is not a valid file name\", name);\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n save_binary_file(full_path, data, strlen(data), dd->dd_uid, dd->dd_gid, dd->mode);\n free(full_path);\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"dd_save_text","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#24-d81ce033326b","input":" def misc_file_checks(self):\n\n print_header(\"MISC FILE CHECKS\")\n\n #\n # Check for recommended and mandatory files\n #\n\n filenames = (\"manifest.json\", \"LICENSE\", \"README.md\",\n \"scripts/install\", \"scripts/remove\",\n \"scripts/upgrade\",\n \"scripts/backup\", \"scripts/restore\")\n non_mandatory = (\"script/backup\", \"script/restore\")\n\n for filename in filenames:\n if file_exists(self.path + \"/\" + filename):\n continue\n elif filename in non_mandatory:\n print_warning(\"Consider adding a file %s\" % filename)\n else:\n print_error(\"File %s is mandatory\" % filename)\n\n #\n # Deprecated php-fpm.ini thing\n #\n\n if file_exists(self.path + \"/conf/php-fpm.ini\"):\n print_warning(\n \"Using a separate php-fpm.ini file is deprecated. \"\n \"Please merge your php-fpm directives directly in the pool file. \"\n \"(c.f. https://github.com/YunoHost-Apps/nextcloud_ynh/issues/138 )\"\n )\n\n #\n # Deprecated usage of 'add_header' in nginx conf\n #\n\n for filename in os.listdir(self.path + \"/conf\"):\n if not os.path.isfile(self.path + \"/conf/\" + filename):\n continue\n content = open(self.path + \"/conf/\" + filename).read()\n if \"location\" in content and \"add_header\" in content:\n print_warning(\n \"Do not use 'add_header' in the nginx conf. Use 'more_set_headers' instead. \"\n \"(See https://www.peterbe.com/plog/be-very-careful-with-your-add_header-in-nginx \"\n \"and https://github.com/openresty/headers-more-nginx-module#more_set_headers )\"\n )","target":" def misc_file_checks(self):\n\n print_header(\"MISC FILE CHECKS\")\n\n #\n # Check for recommended and mandatory files\n #\n\n filenames = (\"manifest.json\", \"LICENSE\", \"README.md\",\n \"scripts/install\", \"scripts/remove\",\n \"scripts/upgrade\",\n \"scripts/backup\", \"scripts/restore\")\n non_mandatory = (\"script/backup\", \"script/restore\")\n\n for filename in filenames:\n if file_exists(self.path + \"/\" + filename):\n continue\n elif filename in non_mandatory:\n print_warning(\"Consider adding a file %s\" % filename)\n else:\n print_error(\"File %s is mandatory\" % filename)\n\n #\n # Deprecated php-fpm.ini thing\n #\n\n if file_exists(self.path + \"/conf/php-fpm.ini\"):\n print_warning(\n \"Using a separate php-fpm.ini file is deprecated. \"\n \"Please merge your php-fpm directives directly in the pool file. \"\n \"(c.f. https://github.com/YunoHost-Apps/nextcloud_ynh/issues/138 )\"\n )\n\n #\n # Analyze nginx conf\n # - Deprecated usage of 'add_header' in nginx conf\n # - Spot path traversal issue vulnerability\n #\n\n for filename in os.listdir(self.path + \"/conf\"):\n # Ignore subdirs or filename not containing nginx in the name\n if not os.path.isfile(self.path + \"/conf/\" + filename) or \"nginx\" not in filename:\n continue\n\n #\n # 'add_header' usage\n #\n content = open(self.path + \"/conf/\" + filename).read()\n if \"location\" in content and \"add_header\" in content:\n print_warning(\n \"Do not use 'add_header' in the nginx conf. Use 'more_set_headers' instead. \"\n \"(See https://www.peterbe.com/plog/be-very-careful-with-your-add_header-in-nginx \"\n \"and https://github.com/openresty/headers-more-nginx-module#more_set_headers )\"\n )\n\n #\n # Path traversal issues\n #\n lines = open(self.path + \"/conf/\" + filename).readlines()\n lines = [line.strip() for line in lines if not line.strip().startswith(\"#\")]\n # Let's find the first location line\n location_line = None\n path_traversal_vulnerable = False\n lines_iter = lines.__iter__()\n for line in lines_iter:\n if line.startswith(\"location\"):\n location_line = line\n break\n # Look at the next lines for an 'alias' directive\n if location_line is not None:\n for line in lines_iter:\n if line.startswith(\"location\"):\n # Entering a new location block ... abort here\n # and assume there's no alias block later...\n break\n if line.startswith(\"alias\"):\n # We should definitely check for path traversal issue\n # Does the location target ends with / ?\n target = location_line.split()[-2]\n if not target.endswith(\"/\"):\n path_traversal_vulnerable = True\n break\n if path_traversal_vulnerable:\n print_warning(\n \"The nginx configuration appears vulnerable to path traversal as explained in \"\n \"https://www.acunetix.com/vulnerabilities/web/path-traversal-via-misconfigured-nginx-alias/\\n\"\n \"To fix it, look at the first lines of the nginx conf of the example app : \"\n \"https://github.com/YunoHost/example_ynh/blob/master/conf/nginx.conf\"\n )","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"misc_file_checks","file_name":"package_linter.py","commit_link":"github.com/YunoHost/package_linter/commit/f6e98894cfe841aedaa7efd590937f0255193913","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#25-398e401855d6","input":"void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n save_binary_file(full_path, data, size, dd->dd_uid, dd->dd_gid, dd->mode);\n free(full_path);\n}","target":"void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot save binary. '%s' is not a valid file name\", name);\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n save_binary_file(full_path, data, size, dd->dd_uid, dd->dd_gid, dd->mode);\n free(full_path);\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"dd_save_binary","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#26-4f0f9c1b3ddc","input":"def pascal_case(value: str) -> str:\n return stringcase.pascalcase(value)","target":"def pascal_case(value: str) -> str:\n return stringcase.pascalcase(_sanitize(value))","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"pascal_case","file_name":"openapi_python_client/utils.py","commit_link":"github.com/openapi-generators/openapi-python-client/commit/3e7dfae5d0b3685abf1ede1bc6c086a116ac4746","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#27-665b62e9178c","input":"cleanup_pathname(struct archive_write_disk *a)\n{\n\tchar *dest, *src;\n\tchar separator = '\\0';\n\n\tdest = src = a->name;\n\tif (*src == '\\0') {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Invalid empty pathname\");\n\t\treturn (ARCHIVE_FAILED);\n\t}\n\n#if defined(__CYGWIN__)\n\tcleanup_pathname_win(a);\n#endif\n\t/* Skip leading '/'. */\n\tif (*src == '/')\n\t\tseparator = *src++;\n\n\t/* Scan the pathname one element at a time. */\n\tfor (;;) {\n\t\t/* src points to first char after '/' */\n\t\tif (src[0] == '\\0') {\n\t\t\tbreak;\n\t\t} else if (src[0] == '/') {\n\t\t\t/* Found '//', ignore second one. */\n\t\t\tsrc++;\n\t\t\tcontinue;\n\t\t} else if (src[0] == '.') {\n\t\t\tif (src[1] == '\\0') {\n\t\t\t\t/* Ignore trailing '.' */\n\t\t\t\tbreak;\n\t\t\t} else if (src[1] == '/') {\n\t\t\t\t/* Skip './'. */\n\t\t\t\tsrc += 2;\n\t\t\t\tcontinue;\n\t\t\t} else if (src[1] == '.') {\n\t\t\t\tif (src[2] == '/' || src[2] == '\\0') {\n\t\t\t\t\t/* Conditionally warn about '..' */\n\t\t\t\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {\n\t\t\t\t\t\tarchive_set_error(&a->archive,\n\t\t\t\t\t\t ARCHIVE_ERRNO_MISC,\n\t\t\t\t\t\t \"Path contains '..'\");\n\t\t\t\t\t\treturn (ARCHIVE_FAILED);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Note: Under no circumstances do we\n\t\t\t\t * remove '..' elements. In\n\t\t\t\t * particular, restoring\n\t\t\t\t * '/foo/../bar/' should create the\n\t\t\t\t * 'foo' dir as a side-effect.\n\t\t\t\t */\n\t\t\t}\n\t\t}\n\n\t\t/* Copy current element, including leading '/'. */\n\t\tif (separator)\n\t\t\t*dest++ = '/';\n\t\twhile (*src != '\\0' && *src != '/') {\n\t\t\t*dest++ = *src++;\n\t\t}\n\n\t\tif (*src == '\\0')\n\t\t\tbreak;\n\n\t\t/* Skip '/' separator. */\n\t\tseparator = *src++;\n\t}\n\t/*\n\t * We've just copied zero or more path elements, not including the\n\t * final '/'.\n\t */\n\tif (dest == a->name) {\n\t\t/*\n\t\t * Nothing got copied. The path must have been something\n\t\t * like '.' or '/' or './' or '/././././/./'.\n\t\t */\n\t\tif (separator)\n\t\t\t*dest++ = '/';\n\t\telse\n\t\t\t*dest++ = '.';\n\t}\n\t/* Terminate the result. */\n\t*dest = '\\0';\n\treturn (ARCHIVE_OK);\n}","target":"cleanup_pathname(struct archive_write_disk *a)\n{\n\tchar *dest, *src;\n\tchar separator = '\\0';\n\n\tdest = src = a->name;\n\tif (*src == '\\0') {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Invalid empty pathname\");\n\t\treturn (ARCHIVE_FAILED);\n\t}\n\n#if defined(__CYGWIN__)\n\tcleanup_pathname_win(a);\n#endif\n\t/* Skip leading '/'. */\n\tif (*src == '/') {\n\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {\n\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t\t \"Path is absolute\");\n\t\t\treturn (ARCHIVE_FAILED);\n\t\t}\n\n\t\tseparator = *src++;\n\t}\n\n\t/* Scan the pathname one element at a time. */\n\tfor (;;) {\n\t\t/* src points to first char after '/' */\n\t\tif (src[0] == '\\0') {\n\t\t\tbreak;\n\t\t} else if (src[0] == '/') {\n\t\t\t/* Found '//', ignore second one. */\n\t\t\tsrc++;\n\t\t\tcontinue;\n\t\t} else if (src[0] == '.') {\n\t\t\tif (src[1] == '\\0') {\n\t\t\t\t/* Ignore trailing '.' */\n\t\t\t\tbreak;\n\t\t\t} else if (src[1] == '/') {\n\t\t\t\t/* Skip './'. */\n\t\t\t\tsrc += 2;\n\t\t\t\tcontinue;\n\t\t\t} else if (src[1] == '.') {\n\t\t\t\tif (src[2] == '/' || src[2] == '\\0') {\n\t\t\t\t\t/* Conditionally warn about '..' */\n\t\t\t\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {\n\t\t\t\t\t\tarchive_set_error(&a->archive,\n\t\t\t\t\t\t ARCHIVE_ERRNO_MISC,\n\t\t\t\t\t\t \"Path contains '..'\");\n\t\t\t\t\t\treturn (ARCHIVE_FAILED);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Note: Under no circumstances do we\n\t\t\t\t * remove '..' elements. In\n\t\t\t\t * particular, restoring\n\t\t\t\t * '/foo/../bar/' should create the\n\t\t\t\t * 'foo' dir as a side-effect.\n\t\t\t\t */\n\t\t\t}\n\t\t}\n\n\t\t/* Copy current element, including leading '/'. */\n\t\tif (separator)\n\t\t\t*dest++ = '/';\n\t\twhile (*src != '\\0' && *src != '/') {\n\t\t\t*dest++ = *src++;\n\t\t}\n\n\t\tif (*src == '\\0')\n\t\t\tbreak;\n\n\t\t/* Skip '/' separator. */\n\t\tseparator = *src++;\n\t}\n\t/*\n\t * We've just copied zero or more path elements, not including the\n\t * final '/'.\n\t */\n\tif (dest == a->name) {\n\t\t/*\n\t\t * Nothing got copied. The path must have been something\n\t\t * like '.' or '/' or './' or '/././././/./'.\n\t\t */\n\t\tif (separator)\n\t\t\t*dest++ = '/';\n\t\telse\n\t\t\t*dest++ = '.';\n\t}\n\t/* Terminate the result. */\n\t*dest = '\\0';\n\treturn (ARCHIVE_OK);\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"cleanup_pathname","file_name":"libarchive/archive_write_disk_posix.c","commit_link":"github.com/libarchive/libarchive/commit/59357157706d47c365b2227739e17daba3607526","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#28-21c0ac75823c","input":"struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)\n{\n INITIALIZE_LIBREPORT();\n\n char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER);\n\n if (!type)\n {\n error_msg(_(\"Missing required item: '%s'\"), FILENAME_ANALYZER);\n return NULL;\n }\n\n uid_t uid = (uid_t)-1L;\n char *uid_str = problem_data_get_content_or_NULL(problem_data, FILENAME_UID);\n\n if (uid_str)\n {\n char *endptr;\n errno = 0;\n long val = strtol(uid_str, &endptr, 10);\n\n if (errno != 0 || endptr == uid_str || *endptr != '\\0' || INT_MAX < val)\n {\n error_msg(_(\"uid value is not valid: '%s'\"), uid_str);\n return NULL;\n }\n\n uid = (uid_t)val;\n }\n\n struct timeval tv;\n if (gettimeofday(&tv, NULL) < 0)\n {\n perror_msg(\"gettimeofday()\");\n return NULL;\n }\n\n char *problem_id = xasprintf(\"%s-%s.%ld-%lu\"NEW_PD_SUFFIX, type, iso_date_string(&(tv.tv_sec)), (long)tv.tv_usec, (long)getpid());\n\n log_info(\"Saving to %s/%s with uid %d\", base_dir_name, problem_id, uid);\n\n struct dump_dir *dd;\n if (base_dir_name)\n dd = try_dd_create(base_dir_name, problem_id, uid);\n else\n {\n /* Try /var/run/abrt */\n dd = try_dd_create(LOCALSTATEDIR\"/run/abrt\", problem_id, uid);\n /* Try $HOME/tmp */\n if (!dd)\n {\n char *home = getenv(\"HOME\");\n if (home && home[0])\n {\n home = concat_path_file(home, \"tmp\");\n /*mkdir(home, 0777); - do we want this? */\n dd = try_dd_create(home, problem_id, uid);\n free(home);\n }\n }\n//TODO: try user's home dir obtained by getpwuid(getuid())?\n /* Try system temporary directory */\n if (!dd)\n dd = try_dd_create(LARGE_DATA_TMP_DIR, problem_id, uid);\n }\n\n if (!dd) /* try_dd_create() already emitted the error message */\n goto ret;\n\n GHashTableIter iter;\n char *name;\n struct problem_item *value;\n g_hash_table_iter_init(&iter, problem_data);\n while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value))\n {\n if (value->flags & CD_FLAG_BIN)\n {\n char *dest = concat_path_file(dd->dd_dirname, name);\n log_info(\"copying '%s' to '%s'\", value->content, dest);\n off_t copied = copy_file(value->content, dest, DEFAULT_DUMP_DIR_MODE | S_IROTH);\n if (copied < 0)\n error_msg(\"Can't copy %s to %s\", value->content, dest);\n else\n log_info(\"copied %li bytes\", (unsigned long)copied);\n free(dest);\n\n continue;\n }\n\n /* only files should contain '/' and those are handled earlier */\n if (name[0] == '.' || strchr(name, '/'))\n {\n error_msg(\"Problem data field name contains disallowed chars: '%s'\", name);\n continue;\n }\n\n dd_save_text(dd, name, value->content);\n }\n\n /* need to create basic files AFTER we save the pd to dump_dir\n * otherwise we can't skip already created files like in case when\n * reporting from anaconda where we can't read /etc/{system,redhat}-release\n * and os_release is taken from anaconda\n */\n dd_create_basic_files(dd, uid, NULL);\n\n problem_id[strlen(problem_id) - strlen(NEW_PD_SUFFIX)] = '\\0';\n char* new_path = concat_path_file(base_dir_name, problem_id);\n log_info(\"Renaming from '%s' to '%s'\", dd->dd_dirname, new_path);\n dd_rename(dd, new_path);\n\n ret:\n free(problem_id);\n return dd;\n}","target":"struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)\n{\n INITIALIZE_LIBREPORT();\n\n char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER);\n\n if (!type)\n {\n error_msg(_(\"Missing required item: '%s'\"), FILENAME_ANALYZER);\n return NULL;\n }\n\n if (!str_is_correct_filename(type))\n {\n error_msg(_(\"'%s' is not correct file name\"), FILENAME_ANALYZER);\n return NULL;\n }\n\n uid_t uid = (uid_t)-1L;\n char *uid_str = problem_data_get_content_or_NULL(problem_data, FILENAME_UID);\n\n if (uid_str)\n {\n char *endptr;\n errno = 0;\n long val = strtol(uid_str, &endptr, 10);\n\n if (errno != 0 || endptr == uid_str || *endptr != '\\0' || INT_MAX < val)\n {\n error_msg(_(\"uid value is not valid: '%s'\"), uid_str);\n return NULL;\n }\n\n uid = (uid_t)val;\n }\n\n struct timeval tv;\n if (gettimeofday(&tv, NULL) < 0)\n {\n perror_msg(\"gettimeofday()\");\n return NULL;\n }\n\n char *problem_id = xasprintf(\"%s-%s.%ld-%lu\"NEW_PD_SUFFIX, type, iso_date_string(&(tv.tv_sec)), (long)tv.tv_usec, (long)getpid());\n\n log_info(\"Saving to %s/%s with uid %d\", base_dir_name, problem_id, uid);\n\n struct dump_dir *dd;\n if (base_dir_name)\n dd = try_dd_create(base_dir_name, problem_id, uid);\n else\n {\n /* Try /var/run/abrt */\n dd = try_dd_create(LOCALSTATEDIR\"/run/abrt\", problem_id, uid);\n /* Try $HOME/tmp */\n if (!dd)\n {\n char *home = getenv(\"HOME\");\n if (home && home[0])\n {\n home = concat_path_file(home, \"tmp\");\n /*mkdir(home, 0777); - do we want this? */\n dd = try_dd_create(home, problem_id, uid);\n free(home);\n }\n }\n//TODO: try user's home dir obtained by getpwuid(getuid())?\n /* Try system temporary directory */\n if (!dd)\n dd = try_dd_create(LARGE_DATA_TMP_DIR, problem_id, uid);\n }\n\n if (!dd) /* try_dd_create() already emitted the error message */\n goto ret;\n\n GHashTableIter iter;\n char *name;\n struct problem_item *value;\n g_hash_table_iter_init(&iter, problem_data);\n while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value))\n {\n if (!str_is_correct_filename(name))\n {\n error_msg(\"Problem data field name contains disallowed chars: '%s'\", name);\n continue;\n }\n\n if (value->flags & CD_FLAG_BIN)\n {\n char *dest = concat_path_file(dd->dd_dirname, name);\n log_info(\"copying '%s' to '%s'\", value->content, dest);\n off_t copied = copy_file(value->content, dest, DEFAULT_DUMP_DIR_MODE | S_IROTH);\n if (copied < 0)\n error_msg(\"Can't copy %s to %s\", value->content, dest);\n else\n log_info(\"copied %li bytes\", (unsigned long)copied);\n free(dest);\n\n continue;\n }\n\n dd_save_text(dd, name, value->content);\n }\n\n /* need to create basic files AFTER we save the pd to dump_dir\n * otherwise we can't skip already created files like in case when\n * reporting from anaconda where we can't read /etc/{system,redhat}-release\n * and os_release is taken from anaconda\n */\n dd_create_basic_files(dd, uid, NULL);\n\n problem_id[strlen(problem_id) - strlen(NEW_PD_SUFFIX)] = '\\0';\n char* new_path = concat_path_file(base_dir_name, problem_id);\n log_info(\"Renaming from '%s' to '%s'\", dd->dd_dirname, new_path);\n dd_rename(dd, new_path);\n\n ret:\n free(problem_id);\n return dd;\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"create_dump_dir_from_problem_data","file_name":"src/lib/create_dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#29-ccc28408d7e9","input":" def list(self, keyfilter='/'):\n path = os.path.join(self.namespace, keyfilter)\n if path != '/':\n path = path.rstrip('/')\n try:\n result = self.etcd.read(path, recursive=True)\n except etcd.EtcdKeyNotFound:\n return None\n except etcd.EtcdException as err:\n log_error(\"Error listing %s: [%r]\" % (keyfilter, repr(err)))\n raise CSStoreError('Error occurred while trying to list keys')\n\n value = set()\n for entry in result.get_subtree():\n if entry.key == path:\n continue\n name = entry.key[len(path):]\n if entry.dir and not name.endswith('/'):\n name += '/'\n value.add(name.lstrip('/'))\n return sorted(value)","target":" def list(self, keyfilter='/'):\n path = self._absolute_key(keyfilter)\n if path != '/':\n path = path.rstrip('/')\n try:\n result = self.etcd.read(path, recursive=True)\n except etcd.EtcdKeyNotFound:\n return None\n except etcd.EtcdException as err:\n log_error(\"Error listing %s: [%r]\" % (keyfilter, repr(err)))\n raise CSStoreError('Error occurred while trying to list keys')\n\n value = set()\n for entry in result.get_subtree():\n if entry.key == path:\n continue\n name = entry.key[len(path):]\n if entry.dir and not name.endswith('/'):\n name += '/'\n value.add(name.lstrip('/'))\n return sorted(value)","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"list","file_name":"custodia/store/etcdstore.py","commit_link":"github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#30-323dff97d0b5","input":"local void process(char *path)\n{\n int method = -1; /* get_header() return value */\n size_t len; /* length of base name (minus suffix) */\n struct stat st; /* to get file type and mod time */\n /* all compressed suffixes for decoding search, in length order */\n static char *sufs[] = {\".z\", \"-z\", \"_z\", \".Z\", \".gz\", \"-gz\", \".zz\", \"-zz\",\n \".zip\", \".ZIP\", \".tgz\", NULL};\n\n /* open input file with name in, descriptor ind -- set name and mtime */\n if (path == NULL) {\n strcpy(g.inf, \"\");\n g.ind = 0;\n g.name = NULL;\n g.mtime = g.headis & 2 ?\n (fstat(g.ind, &st) ? time(NULL) : st.st_mtime) : 0;\n len = 0;\n }\n else {\n /* set input file name (already set if recursed here) */\n if (path != g.inf) {\n strncpy(g.inf, path, sizeof(g.inf));\n if (g.inf[sizeof(g.inf) - 1])\n bail(\"name too long: \", path);\n }\n len = strlen(g.inf);\n\n /* try to stat input file -- if not there and decoding, look for that\n name with compressed suffixes */\n if (lstat(g.inf, &st)) {\n if (errno == ENOENT && (g.list || g.decode)) {\n char **try = sufs;\n do {\n if (*try == NULL || len + strlen(*try) >= sizeof(g.inf))\n break;\n strcpy(g.inf + len, *try++);\n errno = 0;\n } while (lstat(g.inf, &st) && errno == ENOENT);\n }\n#ifdef EOVERFLOW\n if (errno == EOVERFLOW || errno == EFBIG)\n bail(g.inf,\n \" too large -- not compiled with large file support\");\n#endif\n if (errno) {\n g.inf[len] = 0;\n complain(\"%s does not exist -- skipping\", g.inf);\n return;\n }\n len = strlen(g.inf);\n }\n\n /* only process regular files, but allow symbolic links if -f,\n recurse into directory if -r */\n if ((st.st_mode & S_IFMT) != S_IFREG &&\n (st.st_mode & S_IFMT) != S_IFLNK &&\n (st.st_mode & S_IFMT) != S_IFDIR) {\n complain(\"%s is a special file or device -- skipping\", g.inf);\n return;\n }\n if ((st.st_mode & S_IFMT) == S_IFLNK && !g.force && !g.pipeout) {\n complain(\"%s is a symbolic link -- skipping\", g.inf);\n return;\n }\n if ((st.st_mode & S_IFMT) == S_IFDIR && !g.recurse) {\n complain(\"%s is a directory -- skipping\", g.inf);\n return;\n }\n\n /* recurse into directory (assumes Unix) */\n if ((st.st_mode & S_IFMT) == S_IFDIR) {\n char *roll, *item, *cut, *base, *bigger;\n size_t len, hold;\n DIR *here;\n struct dirent *next;\n\n /* accumulate list of entries (need to do this, since readdir()\n behavior not defined if directory modified between calls) */\n here = opendir(g.inf);\n if (here == NULL)\n return;\n hold = 512;\n roll = MALLOC(hold);\n if (roll == NULL)\n bail(\"not enough memory\", \"\");\n *roll = 0;\n item = roll;\n while ((next = readdir(here)) != NULL) {\n if (next->d_name[0] == 0 ||\n (next->d_name[0] == '.' && (next->d_name[1] == 0 ||\n (next->d_name[1] == '.' && next->d_name[2] == 0))))\n continue;\n len = strlen(next->d_name) + 1;\n if (item + len + 1 > roll + hold) {\n do { /* make roll bigger */\n hold <<= 1;\n } while (item + len + 1 > roll + hold);\n bigger = REALLOC(roll, hold);\n if (bigger == NULL) {\n FREE(roll);\n bail(\"not enough memory\", \"\");\n }\n item = bigger + (item - roll);\n roll = bigger;\n }\n strcpy(item, next->d_name);\n item += len;\n *item = 0;\n }\n closedir(here);\n\n /* run process() for each entry in the directory */\n cut = base = g.inf + strlen(g.inf);\n if (base > g.inf && base[-1] != (unsigned char)'/') {\n if ((size_t)(base - g.inf) >= sizeof(g.inf))\n bail(\"path too long\", g.inf);\n *base++ = '/';\n }\n item = roll;\n while (*item) {\n strncpy(base, item, sizeof(g.inf) - (base - g.inf));\n if (g.inf[sizeof(g.inf) - 1]) {\n strcpy(g.inf + (sizeof(g.inf) - 4), \"...\");\n bail(\"path too long: \", g.inf);\n }\n process(g.inf);\n item += strlen(item) + 1;\n }\n *cut = 0;\n\n /* release list of entries */\n FREE(roll);\n return;\n }\n\n /* don't compress .gz (or provided suffix) files, unless -f */\n if (!(g.force || g.list || g.decode) && len >= strlen(g.sufx) &&\n strcmp(g.inf + len - strlen(g.sufx), g.sufx) == 0) {\n complain(\"%s ends with %s -- skipping\", g.inf, g.sufx);\n return;\n }\n\n /* create output file only if input file has compressed suffix */\n if (g.decode == 1 && !g.pipeout && !g.list) {\n int suf = compressed_suffix(g.inf);\n if (suf == 0) {\n complain(\"%s does not have compressed suffix -- skipping\",\n g.inf);\n return;\n }\n len -= suf;\n }\n\n /* open input file */\n g.ind = open(g.inf, O_RDONLY, 0);\n if (g.ind < 0)\n bail(\"read error on \", g.inf);\n\n /* prepare gzip header information for compression */\n g.name = g.headis & 1 ? justname(g.inf) : NULL;\n g.mtime = g.headis & 2 ? st.st_mtime : 0;\n }\n SET_BINARY_MODE(g.ind);\n\n /* if decoding or testing, try to read gzip header */\n g.hname = NULL;\n if (g.decode) {\n in_init();\n method = get_header(1);\n if (method != 8 && method != 257 &&\n /* gzip -cdf acts like cat on uncompressed input */\n !(method == -2 && g.force && g.pipeout && g.decode != 2 &&\n !g.list)) {\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n if (method != -1)\n complain(method < 0 ? \"%s is not compressed -- skipping\" :\n \"%s has unknown compression method -- skipping\",\n g.inf);\n return;\n }\n\n /* if requested, test input file (possibly a special list) */\n if (g.decode == 2) {\n if (method == 8)\n infchk();\n else {\n unlzw();\n if (g.list) {\n g.in_tot -= 3;\n show_info(method, 0, g.out_tot, 0);\n }\n }\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n }\n\n /* if requested, just list information about input file */\n if (g.list) {\n list_info();\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n\n /* create output file out, descriptor outd */\n if (path == NULL || g.pipeout) {\n /* write to stdout */\n g.outf = MALLOC(strlen(\"\") + 1);\n if (g.outf == NULL)\n bail(\"not enough memory\", \"\");\n strcpy(g.outf, \"\");\n g.outd = 1;\n if (!g.decode && !g.force && isatty(g.outd))\n bail(\"trying to write compressed data to a terminal\",\n \" (use -f to force)\");\n }\n else {\n char *to, *repl;\n\n /* use header name for output when decompressing with -N */\n to = g.inf;\n if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {\n to = g.hname;\n len = strlen(g.hname);\n }\n\n /* replace .tgz with .tar when decoding */\n repl = g.decode && strcmp(to + len, \".tgz\") ? \"\" : \".tar\";\n\n /* create output file and open to write */\n g.outf = MALLOC(len + (g.decode ? strlen(repl) : strlen(g.sufx)) + 1);\n if (g.outf == NULL)\n bail(\"not enough memory\", \"\");\n memcpy(g.outf, to, len);\n strcpy(g.outf + len, g.decode ? repl : g.sufx);\n g.outd = open(g.outf, O_CREAT | O_TRUNC | O_WRONLY |\n (g.force ? 0 : O_EXCL), 0600);\n\n /* if exists and not -f, give user a chance to overwrite */\n if (g.outd < 0 && errno == EEXIST && isatty(0) && g.verbosity) {\n int ch, reply;\n\n fprintf(stderr, \"%s exists -- overwrite (y/n)? \", g.outf);\n fflush(stderr);\n reply = -1;\n do {\n ch = getchar();\n if (reply < 0 && ch != ' ' && ch != '\\t')\n reply = ch == 'y' || ch == 'Y' ? 1 : 0;\n } while (ch != EOF && ch != '\\n' && ch != '\\r');\n if (reply == 1)\n g.outd = open(g.outf, O_CREAT | O_TRUNC | O_WRONLY,\n 0600);\n }\n\n /* if exists and no overwrite, report and go on to next */\n if (g.outd < 0 && errno == EEXIST) {\n complain(\"%s exists -- skipping\", g.outf);\n RELEASE(g.outf);\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n\n /* if some other error, give up */\n if (g.outd < 0)\n bail(\"write error on \", g.outf);\n }\n SET_BINARY_MODE(g.outd);\n RELEASE(g.hname);\n\n /* process ind to outd */\n if (g.verbosity > 1)\n fprintf(stderr, \"%s to %s \", g.inf, g.outf);\n if (g.decode) {\n if (method == 8)\n infchk();\n else if (method == 257)\n unlzw();\n else\n cat();\n }\n#ifndef NOTHREAD\n else if (g.procs > 1)\n parallel_compress();\n#endif\n else\n single_compress(0);\n if (g.verbosity > 1) {\n putc('\\n', stderr);\n fflush(stderr);\n }\n\n /* finish up, copy attributes, set times, delete original */\n if (g.ind != 0)\n close(g.ind);\n if (g.outd != 1) {\n if (close(g.outd))\n bail(\"write error on \", g.outf);\n g.outd = -1; /* now prevent deletion on interrupt */\n if (g.ind != 0) {\n copymeta(g.inf, g.outf);\n if (!g.keep)\n unlink(g.inf);\n }\n if (g.decode && (g.headis & 2) != 0 && g.stamp)\n touch(g.outf, g.stamp);\n }\n RELEASE(g.outf);\n}","target":"local void process(char *path)\n{\n int method = -1; /* get_header() return value */\n size_t len; /* length of base name (minus suffix) */\n struct stat st; /* to get file type and mod time */\n /* all compressed suffixes for decoding search, in length order */\n static char *sufs[] = {\".z\", \"-z\", \"_z\", \".Z\", \".gz\", \"-gz\", \".zz\", \"-zz\",\n \".zip\", \".ZIP\", \".tgz\", NULL};\n\n /* open input file with name in, descriptor ind -- set name and mtime */\n if (path == NULL) {\n strcpy(g.inf, \"\");\n g.ind = 0;\n g.name = NULL;\n g.mtime = g.headis & 2 ?\n (fstat(g.ind, &st) ? time(NULL) : st.st_mtime) : 0;\n len = 0;\n }\n else {\n /* set input file name (already set if recursed here) */\n if (path != g.inf) {\n strncpy(g.inf, path, sizeof(g.inf));\n if (g.inf[sizeof(g.inf) - 1])\n bail(\"name too long: \", path);\n }\n len = strlen(g.inf);\n\n /* try to stat input file -- if not there and decoding, look for that\n name with compressed suffixes */\n if (lstat(g.inf, &st)) {\n if (errno == ENOENT && (g.list || g.decode)) {\n char **try = sufs;\n do {\n if (*try == NULL || len + strlen(*try) >= sizeof(g.inf))\n break;\n strcpy(g.inf + len, *try++);\n errno = 0;\n } while (lstat(g.inf, &st) && errno == ENOENT);\n }\n#ifdef EOVERFLOW\n if (errno == EOVERFLOW || errno == EFBIG)\n bail(g.inf,\n \" too large -- not compiled with large file support\");\n#endif\n if (errno) {\n g.inf[len] = 0;\n complain(\"%s does not exist -- skipping\", g.inf);\n return;\n }\n len = strlen(g.inf);\n }\n\n /* only process regular files, but allow symbolic links if -f,\n recurse into directory if -r */\n if ((st.st_mode & S_IFMT) != S_IFREG &&\n (st.st_mode & S_IFMT) != S_IFLNK &&\n (st.st_mode & S_IFMT) != S_IFDIR) {\n complain(\"%s is a special file or device -- skipping\", g.inf);\n return;\n }\n if ((st.st_mode & S_IFMT) == S_IFLNK && !g.force && !g.pipeout) {\n complain(\"%s is a symbolic link -- skipping\", g.inf);\n return;\n }\n if ((st.st_mode & S_IFMT) == S_IFDIR && !g.recurse) {\n complain(\"%s is a directory -- skipping\", g.inf);\n return;\n }\n\n /* recurse into directory (assumes Unix) */\n if ((st.st_mode & S_IFMT) == S_IFDIR) {\n char *roll, *item, *cut, *base, *bigger;\n size_t len, hold;\n DIR *here;\n struct dirent *next;\n\n /* accumulate list of entries (need to do this, since readdir()\n behavior not defined if directory modified between calls) */\n here = opendir(g.inf);\n if (here == NULL)\n return;\n hold = 512;\n roll = MALLOC(hold);\n if (roll == NULL)\n bail(\"not enough memory\", \"\");\n *roll = 0;\n item = roll;\n while ((next = readdir(here)) != NULL) {\n if (next->d_name[0] == 0 ||\n (next->d_name[0] == '.' && (next->d_name[1] == 0 ||\n (next->d_name[1] == '.' && next->d_name[2] == 0))))\n continue;\n len = strlen(next->d_name) + 1;\n if (item + len + 1 > roll + hold) {\n do { /* make roll bigger */\n hold <<= 1;\n } while (item + len + 1 > roll + hold);\n bigger = REALLOC(roll, hold);\n if (bigger == NULL) {\n FREE(roll);\n bail(\"not enough memory\", \"\");\n }\n item = bigger + (item - roll);\n roll = bigger;\n }\n strcpy(item, next->d_name);\n item += len;\n *item = 0;\n }\n closedir(here);\n\n /* run process() for each entry in the directory */\n cut = base = g.inf + strlen(g.inf);\n if (base > g.inf && base[-1] != (unsigned char)'/') {\n if ((size_t)(base - g.inf) >= sizeof(g.inf))\n bail(\"path too long\", g.inf);\n *base++ = '/';\n }\n item = roll;\n while (*item) {\n strncpy(base, item, sizeof(g.inf) - (base - g.inf));\n if (g.inf[sizeof(g.inf) - 1]) {\n strcpy(g.inf + (sizeof(g.inf) - 4), \"...\");\n bail(\"path too long: \", g.inf);\n }\n process(g.inf);\n item += strlen(item) + 1;\n }\n *cut = 0;\n\n /* release list of entries */\n FREE(roll);\n return;\n }\n\n /* don't compress .gz (or provided suffix) files, unless -f */\n if (!(g.force || g.list || g.decode) && len >= strlen(g.sufx) &&\n strcmp(g.inf + len - strlen(g.sufx), g.sufx) == 0) {\n complain(\"%s ends with %s -- skipping\", g.inf, g.sufx);\n return;\n }\n\n /* create output file only if input file has compressed suffix */\n if (g.decode == 1 && !g.pipeout && !g.list) {\n int suf = compressed_suffix(g.inf);\n if (suf == 0) {\n complain(\"%s does not have compressed suffix -- skipping\",\n g.inf);\n return;\n }\n len -= suf;\n }\n\n /* open input file */\n g.ind = open(g.inf, O_RDONLY, 0);\n if (g.ind < 0)\n bail(\"read error on \", g.inf);\n\n /* prepare gzip header information for compression */\n g.name = g.headis & 1 ? justname(g.inf) : NULL;\n g.mtime = g.headis & 2 ? st.st_mtime : 0;\n }\n SET_BINARY_MODE(g.ind);\n\n /* if decoding or testing, try to read gzip header */\n g.hname = NULL;\n if (g.decode) {\n in_init();\n method = get_header(1);\n if (method != 8 && method != 257 &&\n /* gzip -cdf acts like cat on uncompressed input */\n !(method == -2 && g.force && g.pipeout && g.decode != 2 &&\n !g.list)) {\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n if (method != -1)\n complain(method < 0 ? \"%s is not compressed -- skipping\" :\n \"%s has unknown compression method -- skipping\",\n g.inf);\n return;\n }\n\n /* if requested, test input file (possibly a special list) */\n if (g.decode == 2) {\n if (method == 8)\n infchk();\n else {\n unlzw();\n if (g.list) {\n g.in_tot -= 3;\n show_info(method, 0, g.out_tot, 0);\n }\n }\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n }\n\n /* if requested, just list information about input file */\n if (g.list) {\n list_info();\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n\n /* create output file out, descriptor outd */\n if (path == NULL || g.pipeout) {\n /* write to stdout */\n g.outf = MALLOC(strlen(\"\") + 1);\n if (g.outf == NULL)\n bail(\"not enough memory\", \"\");\n strcpy(g.outf, \"\");\n g.outd = 1;\n if (!g.decode && !g.force && isatty(g.outd))\n bail(\"trying to write compressed data to a terminal\",\n \" (use -f to force)\");\n }\n else {\n char *to = g.inf, *sufx = \"\";\n size_t pre = 0;\n\n /* select parts of the output file name */\n if (g.decode) {\n /* for -dN or -dNT, use the path from the input file and the name\n from the header, stripping any path in the header name */\n if ((g.headis & 1) != 0 && g.hname != NULL) {\n pre = justname(g.inf) - g.inf;\n to = justname(g.hname);\n len = strlen(to);\n }\n /* for -d or -dNn, replace abbreviated suffixes */\n else if (strcmp(to + len, \".tgz\") == 0)\n sufx = \".tar\";\n }\n else\n /* add appropriate suffix when compressing */\n sufx = g.sufx;\n\n /* create output file and open to write */\n g.outf = MALLOC(pre + len + strlen(sufx) + 1);\n if (g.outf == NULL)\n bail(\"not enough memory\", \"\");\n memcpy(g.outf, g.inf, pre);\n memcpy(g.outf + pre, to, len);\n strcpy(g.outf + pre + len, sufx);\n g.outd = open(g.outf, O_CREAT | O_TRUNC | O_WRONLY |\n (g.force ? 0 : O_EXCL), 0600);\n\n /* if exists and not -f, give user a chance to overwrite */\n if (g.outd < 0 && errno == EEXIST && isatty(0) && g.verbosity) {\n int ch, reply;\n\n fprintf(stderr, \"%s exists -- overwrite (y/n)? \", g.outf);\n fflush(stderr);\n reply = -1;\n do {\n ch = getchar();\n if (reply < 0 && ch != ' ' && ch != '\\t')\n reply = ch == 'y' || ch == 'Y' ? 1 : 0;\n } while (ch != EOF && ch != '\\n' && ch != '\\r');\n if (reply == 1)\n g.outd = open(g.outf, O_CREAT | O_TRUNC | O_WRONLY,\n 0600);\n }\n\n /* if exists and no overwrite, report and go on to next */\n if (g.outd < 0 && errno == EEXIST) {\n complain(\"%s exists -- skipping\", g.outf);\n RELEASE(g.outf);\n RELEASE(g.hname);\n if (g.ind != 0)\n close(g.ind);\n return;\n }\n\n /* if some other error, give up */\n if (g.outd < 0)\n bail(\"write error on \", g.outf);\n }\n SET_BINARY_MODE(g.outd);\n RELEASE(g.hname);\n\n /* process ind to outd */\n if (g.verbosity > 1)\n fprintf(stderr, \"%s to %s \", g.inf, g.outf);\n if (g.decode) {\n if (method == 8)\n infchk();\n else if (method == 257)\n unlzw();\n else\n cat();\n }\n#ifndef NOTHREAD\n else if (g.procs > 1)\n parallel_compress();\n#endif\n else\n single_compress(0);\n if (g.verbosity > 1) {\n putc('\\n', stderr);\n fflush(stderr);\n }\n\n /* finish up, copy attributes, set times, delete original */\n if (g.ind != 0)\n close(g.ind);\n if (g.outd != 1) {\n if (close(g.outd))\n bail(\"write error on \", g.outf);\n g.outd = -1; /* now prevent deletion on interrupt */\n if (g.ind != 0) {\n copymeta(g.inf, g.outf);\n if (!g.keep)\n unlink(g.inf);\n }\n if (g.decode && (g.headis & 2) != 0 && g.stamp)\n touch(g.outf, g.stamp);\n }\n RELEASE(g.outf);\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"process","file_name":"pigz.c","commit_link":"github.com/madler/pigz/commit/fdad1406b3ec809f4954ff7cdf9e99eb18c2458f","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#31-cc0c10d323d2","input":"header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)\n{\n struct ImapMbox mx;\n struct Url url;\n char cachepath[PATH_MAX];\n char mbox[PATH_MAX];\n\n if (path)\n imap_cachepath(idata, path, mbox, sizeof(mbox));\n else\n {\n if (!idata->ctx || imap_parse_path(idata->ctx->path, &mx) < 0)\n return NULL;\n\n imap_cachepath(idata, mx.mbox, mbox, sizeof(mbox));\n FREE(&mx.mbox);\n }\n\n mutt_account_tourl(&idata->conn->account, &url);\n url.path = mbox;\n url_tostring(&url, cachepath, sizeof(cachepath), U_PATH);\n\n return mutt_hcache_open(HeaderCache, cachepath, imap_hcache_namer);\n}","target":"header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)\n{\n struct ImapMbox mx;\n struct Url url;\n char cachepath[PATH_MAX];\n char mbox[PATH_MAX];\n\n if (path)\n imap_cachepath(idata, path, mbox, sizeof(mbox));\n else\n {\n if (!idata->ctx || imap_parse_path(idata->ctx->path, &mx) < 0)\n return NULL;\n\n imap_cachepath(idata, mx.mbox, mbox, sizeof(mbox));\n FREE(&mx.mbox);\n }\n\n if (strstr(mbox, \"/../\") || (strcmp(mbox, \"..\") == 0) || (strncmp(mbox, \"../\", 3) == 0))\n return NULL;\n size_t len = strlen(mbox);\n if ((len > 3) && (strcmp(mbox + len - 3, \"/..\") == 0))\n return NULL;\n\n mutt_account_tourl(&idata->conn->account, &url);\n url.path = mbox;\n url_tostring(&url, cachepath, sizeof(cachepath), U_PATH);\n\n return mutt_hcache_open(HeaderCache, cachepath, imap_hcache_namer);\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"imap_hcache_open","file_name":"imap/util.c","commit_link":"github.com/neomutt/neomutt/commit/57971dba06346b2d7179294f4528b8d4427a7c5d","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#32-0c5c9d496b9b","input":" def _normalize(self, metaerrors):\n \"\"\"Normalize output format to be usable by Anaconda's linting frontend\n \"\"\"\n\n errors = []\n for error in metaerrors:\n if self.filepath not in error.get('path', ''):\n continue\n\n error_type = error.get('severity', 'X').capitalize()[0]\n if error_type == 'X':\n continue\n if error_type not in ['E', 'W']:\n error_type = 'V'\n errors.append({\n 'underline_range': True,\n 'lineno': error.get('line', 0),\n 'offset': error.get('col', 0),\n 'raw_message': error.get('message', ''),\n 'code': 0,\n 'level': error_type,\n 'message': '[{0}] {1} ({2}): {3}'.format(\n error_type,\n error.get('linter', 'none'),\n error.get('severity', 'none'),\n error.get('message')\n )\n })\n\n return errors","target":" def _normalize(self, metaerrors):\n \"\"\"Normalize output format to be usable by Anaconda's linting frontend\n \"\"\"\n\n errors = []\n for error in metaerrors:\n last_path = os.path.join(\n os.path.basename(os.path.dirname(self.filepath)),\n os.path.basename(self.filepath)\n )\n if last_path not in error.get('path', ''):\n continue\n\n error_type = error.get('severity', 'X').capitalize()[0]\n if error_type == 'X':\n continue\n if error_type not in ['E', 'W']:\n error_type = 'V'\n errors.append({\n 'underline_range': True,\n 'lineno': error.get('line', 0),\n 'offset': error.get('col', 0),\n 'raw_message': error.get('message', ''),\n 'code': 0,\n 'level': error_type,\n 'message': '[{0}] {1} ({2}): {3}'.format(\n error_type,\n error.get('linter', 'none'),\n error.get('severity', 'none'),\n error.get('message')\n )\n })\n\n return errors","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"_normalize","file_name":"plugin/handlers_go/anagonda/context/gometalinter.py","commit_link":"github.com/DamnWidget/anaconda_go/commit/d3db90bb8853d832927818699591b91f56f6413c","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#33-cbec5836ee49","input":"char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags)\n{\n// if (!dd->locked)\n// error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n /* Compat with old abrt dumps. Remove in abrt-2.1 */\n if (strcmp(name, \"release\") == 0)\n name = FILENAME_OS_RELEASE;\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n char *ret = load_text_file(full_path, flags);\n free(full_path);\n\n return ret;\n}","target":"char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags)\n{\n// if (!dd->locked)\n// error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n\n if (!str_is_correct_filename(name))\n {\n error_msg(\"Cannot load text. '%s' is not a valid file name\", name);\n if (!(flags & DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE))\n xfunc_die();\n }\n\n /* Compat with old abrt dumps. Remove in abrt-2.1 */\n if (strcmp(name, \"release\") == 0)\n name = FILENAME_OS_RELEASE;\n\n char *full_path = concat_path_file(dd->dd_dirname, name);\n char *ret = load_text_file(full_path, flags);\n free(full_path);\n\n return ret;\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"dd_load_text_ext","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#34-0bfc2f9cdba5","input":" @staticmethod\n def _download_file(bucket, filename, local_dir):\n key = bucket.get_key(filename)\n local_filename = os.path.join(local_dir, filename)\n key.get_contents_to_filename(local_filename)\n return local_filename","target":" @staticmethod\n def _download_file(bucket, filename, local_dir):\n key = bucket.get_key(filename)\n local_filename = os.path.join(local_dir, os.path.basename(filename))\n key.get_contents_to_filename(local_filename)\n return local_filename","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"_download_file","file_name":"nova/image/s3.py","commit_link":"github.com/openstack/nova/commit/76363226bd8533256f7795bba358d7f4b8a6c9e6","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#35-894b15cd85fa","input":"bool Utility::UnZip(const QString &zippath, const QString &destpath)\n{\n int res = 0;\n QDir dir(destpath);\n if (!cp437) {\n cp437 = new QCodePage437Codec();\n }\n#ifdef Q_OS_WIN32\n zlib_filefunc64_def ffunc;\n fill_win32_filefunc64W(&ffunc);\n unzFile zfile = unzOpen2_64(Utility::QStringToStdWString(QDir::toNativeSeparators(zippath)).c_str(), &ffunc);\n#else\n unzFile zfile = unzOpen64(QDir::toNativeSeparators(zippath).toUtf8().constData());\n#endif\n\n if ((zfile == NULL) || (!IsFileReadable(zippath)) || (!dir.exists())) {\n return false;\n }\n\n res = unzGoToFirstFile(zfile);\n\n if (res == UNZ_OK) {\n do {\n // Get the name of the file in the archive.\n char file_name[MAX_PATH] = {0};\n unz_file_info64 file_info;\n unzGetCurrentFileInfo64(zfile, &file_info, file_name, MAX_PATH, NULL, 0, NULL, 0);\n QString qfile_name;\n QString cp437_file_name;\n qfile_name = QString::fromUtf8(file_name);\n if (!(file_info.flag & (1<<11))) {\n // General purpose bit 11 says the filename is utf-8 encoded. If not set then\n // IBM 437 encoding might be used.\n cp437_file_name = cp437->toUnicode(file_name);\n }\n\n // If there is no file name then we can't do anything with it.\n if (!qfile_name.isEmpty()) {\n // We use the dir object to create the path in the temporary directory.\n // Unfortunately, we need a dir ojbect to do this as it's not a static function.\n // Full file path in the temporary directory.\n QString file_path = destpath + \"/\" + qfile_name;\n QFileInfo qfile_info(file_path);\n\n // Is this entry a directory?\n if (file_info.uncompressed_size == 0 && qfile_name.endsWith('/')) {\n dir.mkpath(qfile_name);\n continue;\n } else {\n dir.mkpath(qfile_info.path());\n }\n\n // Open the file entry in the archive for reading.\n if (unzOpenCurrentFile(zfile) != UNZ_OK) {\n unzClose(zfile);\n return false;\n }\n\n // Open the file on disk to write the entry in the archive to.\n QFile entry(file_path);\n\n if (!entry.open(QIODevice::WriteOnly | QIODevice::Truncate)) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n return false;\n }\n\n // Buffered reading and writing.\n char buff[BUFF_SIZE] = {0};\n int read = 0;\n\n while ((read = unzReadCurrentFile(zfile, buff, BUFF_SIZE)) > 0) {\n entry.write(buff, read);\n }\n\n entry.close();\n\n // Read errors are marked by a negative read amount.\n if (read < 0) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n return false;\n }\n\n // The file was read but the CRC did not match.\n // We don't check the read file size vs the uncompressed file size\n // because if they're different there should be a CRC error.\n if (unzCloseCurrentFile(zfile) == UNZ_CRCERROR) {\n unzClose(zfile);\n return false;\n }\n\n if (!cp437_file_name.isEmpty() && cp437_file_name != qfile_name) {\n QString cp437_file_path = destpath + \"/\" + cp437_file_name;\n QFile::copy(file_path, cp437_file_path);\n }\n }\n } while ((res = unzGoToNextFile(zfile)) == UNZ_OK);\n }\n\n if (res != UNZ_END_OF_LIST_OF_FILE) {\n unzClose(zfile);\n return false;\n }\n\n unzClose(zfile);\n return true;\n}","target":"bool Utility::UnZip(const QString &zippath, const QString &destpath)\n{\n int res = 0;\n QDir dir(destpath);\n if (!cp437) {\n cp437 = new QCodePage437Codec();\n }\n#ifdef Q_OS_WIN32\n zlib_filefunc64_def ffunc;\n fill_win32_filefunc64W(&ffunc);\n unzFile zfile = unzOpen2_64(Utility::QStringToStdWString(QDir::toNativeSeparators(zippath)).c_str(), &ffunc);\n#else\n unzFile zfile = unzOpen64(QDir::toNativeSeparators(zippath).toUtf8().constData());\n#endif\n\n if ((zfile == NULL) || (!IsFileReadable(zippath)) || (!dir.exists())) {\n return false;\n }\n\n res = unzGoToFirstFile(zfile);\n\n if (res == UNZ_OK) {\n do {\n // Get the name of the file in the archive.\n char file_name[MAX_PATH] = {0};\n unz_file_info64 file_info;\n unzGetCurrentFileInfo64(zfile, &file_info, file_name, MAX_PATH, NULL, 0, NULL, 0);\n QString qfile_name;\n QString cp437_file_name;\n qfile_name = QString::fromUtf8(file_name);\n if (!(file_info.flag & (1<<11))) {\n // General purpose bit 11 says the filename is utf-8 encoded. If not set then\n // IBM 437 encoding might be used.\n cp437_file_name = cp437->toUnicode(file_name);\n }\n\n // If there is no file name then we can't do anything with it.\n if (!qfile_name.isEmpty()) {\n\n\t // for security reasons against maliciously crafted zip archives\n\t // we need the file path to always be inside the target folder \n\t // and not outside, so we will remove all illegal backslashes\n\t // and all relative upward paths segments \"/../\" from the zip's local \n\t // file name/path before prepending the target folder to create \n\t // the final path\n\n\t QString original_path = qfile_name;\n\t bool evil_or_corrupt_epub = false;\n\n\t if (qfile_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n\t qfile_name = \"/\" + qfile_name.replace(\"\\\\\",\"\");\n\n\t if (qfile_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n\t qfile_name = qfile_name.replace(\"/../\",\"/\");\n\n\t while(qfile_name.startsWith(\"/\")) { \n\t\t qfile_name = qfile_name.remove(0,1);\n\t }\n \n\t if (cp437_file_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n\t cp437_file_name = \"/\" + cp437_file_name.replace(\"\\\\\",\"\");\n\n\t if (cp437_file_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n\t cp437_file_name = cp437_file_name.replace(\"/../\",\"/\");\n\n\t while(cp437_file_name.startsWith(\"/\")) { \n\t\t cp437_file_name = cp437_file_name.remove(0,1);\n\t }\n\n\t if (evil_or_corrupt_epub) {\n\t\t unzCloseCurrentFile(zfile);\n\t\t unzClose(zfile);\n\t\t // throw (UNZIPLoadParseError(QString(QObject::tr(\"Possible evil or corrupt zip file name: %1\")).arg(original_path).toStdString()));\n return false;\n\t }\n\n // We use the dir object to create the path in the temporary directory.\n // Unfortunately, we need a dir ojbect to do this as it's not a static function.\n // Full file path in the temporary directory.\n QString file_path = destpath + \"/\" + qfile_name;\n QFileInfo qfile_info(file_path);\n\n // Is this entry a directory?\n if (file_info.uncompressed_size == 0 && qfile_name.endsWith('/')) {\n dir.mkpath(qfile_name);\n continue;\n } else {\n dir.mkpath(qfile_info.path());\n }\n\n // Open the file entry in the archive for reading.\n if (unzOpenCurrentFile(zfile) != UNZ_OK) {\n unzClose(zfile);\n return false;\n }\n\n // Open the file on disk to write the entry in the archive to.\n QFile entry(file_path);\n\n if (!entry.open(QIODevice::WriteOnly | QIODevice::Truncate)) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n return false;\n }\n\n // Buffered reading and writing.\n char buff[BUFF_SIZE] = {0};\n int read = 0;\n\n while ((read = unzReadCurrentFile(zfile, buff, BUFF_SIZE)) > 0) {\n entry.write(buff, read);\n }\n\n entry.close();\n\n // Read errors are marked by a negative read amount.\n if (read < 0) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n return false;\n }\n\n // The file was read but the CRC did not match.\n // We don't check the read file size vs the uncompressed file size\n // because if they're different there should be a CRC error.\n if (unzCloseCurrentFile(zfile) == UNZ_CRCERROR) {\n unzClose(zfile);\n return false;\n }\n\n if (!cp437_file_name.isEmpty() && cp437_file_name != qfile_name) {\n QString cp437_file_path = destpath + \"/\" + cp437_file_name;\n QFile::copy(file_path, cp437_file_path);\n }\n }\n } while ((res = unzGoToNextFile(zfile)) == UNZ_OK);\n }\n\n if (res != UNZ_END_OF_LIST_OF_FILE) {\n unzClose(zfile);\n return false;\n }\n\n unzClose(zfile);\n return true;\n}","lang":"cpp","vul_type":"cwe-022","sven_meta":{"func_name":"Utility::UnZip","file_name":"src/Misc/Utility.cpp","commit_link":"github.com/Sigil-Ebook/Sigil/commit/0979ba8d10c96ebca330715bfd4494ea0e019a8f","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#36-cfa530b836e2","input":"async def save(request):\n # TODO csrf\n data = await request.post()\n item = Item(data['src'])\n\n # Update name\n new_src = data.get('new_src')\n if new_src and new_src != data['src']:\n # don't need to worry about html unquote\n shutil.move(item.abspath, settings.STORAGE_DIR + new_src)\n old_backup_abspath = item.backup_abspath\n item = Item(new_src)\n if os.path.isfile(old_backup_abspath):\n shutil.move(old_backup_abspath, item.backup_abspath)\n\n # Update meta\n for field in item.FORM:\n # TODO handle .repeatable (keywords)\n item.meta[field] = [data.get(field, '')]\n\n if settings.SAVE_ORIGINALS and not os.path.isfile(item.backup_abspath):\n shutil.copyfile(item.abspath, item.backup_abspath)\n\n # WISHLIST don't write() if nothing changed\n item.meta.write()\n\n return web.Response(\n status=200,\n body=json.dumps(item.get_form_fields()).encode('utf8'),\n content_type='application/json',\n )","target":"async def save(request):\n # TODO csrf\n data = await request.post()\n item = Item(data['src'])\n\n # Update name\n new_src = data.get('new_src')\n if new_src:\n new_abspath = os.path.abspath(settings.STORAGE_DIR + new_src)\n if not new_abspath.startswith(settings.STORAGE_DIR):\n return web.Response(status=400, body=b'Invalid Request')\n\n if new_abspath != item.abspath:\n shutil.move(item.abspath, new_abspath)\n old_backup_abspath = item.backup_abspath\n item = Item(new_src)\n if os.path.isfile(old_backup_abspath):\n shutil.move(old_backup_abspath, item.backup_abspath)\n\n # Update meta\n for field in item.FORM:\n # TODO handle .repeatable (keywords)\n item.meta[field] = [data.get(field, '')]\n\n if settings.SAVE_ORIGINALS and not os.path.isfile(item.backup_abspath):\n shutil.copyfile(item.abspath, item.backup_abspath)\n\n # WISHLIST don't write() if nothing changed\n item.meta.write()\n\n return web.Response(\n status=200,\n body=json.dumps(item.get_form_fields()).encode('utf8'),\n content_type='application/json',\n )","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"save","file_name":"gallery/gallery.py","commit_link":"github.com/crccheck/gallery-cms/commit/60dec5c580a779ae27824ed54cb113eca25afdc0","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#37-bdc96a61de99","input":"wiki_handle_rest_call(HttpRequest *req, \n\t\t HttpResponse *res,\n\t\t char *func)\n{\n\n if (func != NULL && *func != '\\0')\n {\n if (!strcmp(func, \"page/get\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && (access(page, R_OK) == 0)) \n\t {\n\t http_response_printf(res, \"%s\", file_read(page));\n\t http_response_send(res);\n\t return;\n\t } \n\t}\n else if (!strcmp(func, \"page/set\"))\n\t{\n\t char *wikitext = NULL, *page = NULL;\n\t if( ( (wikitext = http_request_param_get(req, \"text\")) != NULL)\n\t && ( (page = http_request_param_get(req, \"page\")) != NULL))\n\t {\n\t file_write(page, wikitext);\t \n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return;\n\t }\n\t}\n else if (!strcmp(func, \"page/delete\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && (unlink(page) > 0))\n\t {\n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"page/exists\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && (access(page, R_OK) == 0)) \n\t {\n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"pages\") || !strcmp(func, \"search\"))\n\t{\n\t WikiPageList **pages = NULL;\n\t int n_pages, i;\n\t char *expr = http_request_param_get(req, \"expr\");\n\n\t if (expr == NULL)\n\t expr = http_request_get_query_string(req);\n\t \n\t pages = wiki_get_pages(&n_pages, expr);\n\n\t if (pages)\n\t {\n\t for (i=0; imtime);\n\t\t strftime(datebuf, sizeof(datebuf), \"%Y-%m-%d %H:%M\", pTm);\n\t\t http_response_printf(res, \"%s\\t%s\\n\", pages[i]->name, datebuf);\n\t\t}\n\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n }\n\n http_response_set_status(res, 500, \"Error\");\n http_response_printf(res, \"Failed\\n\");\n http_response_send(res);\n\n return; \n}","target":"wiki_handle_rest_call(HttpRequest *req, \n\t\t HttpResponse *res,\n\t\t char *func)\n{\n\n if (func != NULL && *func != '\\0')\n {\n if (!strcmp(func, \"page/get\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && page_name_is_good(page) && (access(page, R_OK) == 0))\n\t {\n\t http_response_printf(res, \"%s\", file_read(page));\n\t http_response_send(res);\n\t return;\n\t } \n\t}\n else if (!strcmp(func, \"page/set\"))\n\t{\n\t char *wikitext = NULL, *page = NULL;\n\t if( ( (wikitext = http_request_param_get(req, \"text\")) != NULL)\n\t && ( (page = http_request_param_get(req, \"page\")) != NULL))\n\t {\n\t if (page_name_is_good(page))\n\t {\n\t file_write(page, wikitext);\n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return;\n\t }\n\t }\n\t}\n else if (!strcmp(func, \"page/delete\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && page_name_is_good(page) && (unlink(page) > 0))\n\t {\n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"page/exists\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\n\n\t if (page == NULL)\n\t page = http_request_get_query_string(req);\n\n\t if (page && page_name_is_good(page) && (access(page, R_OK) == 0))\n\t {\n\t http_response_printf(res, \"success\");\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n else if (!strcmp(func, \"pages\") || !strcmp(func, \"search\"))\n\t{\n\t WikiPageList **pages = NULL;\n\t int n_pages, i;\n\t char *expr = http_request_param_get(req, \"expr\");\n\n\t if (expr == NULL)\n\t expr = http_request_get_query_string(req);\n\t \n\t pages = wiki_get_pages(&n_pages, expr);\n\n\t if (pages)\n\t {\n\t for (i=0; imtime);\n\t\t strftime(datebuf, sizeof(datebuf), \"%Y-%m-%d %H:%M\", pTm);\n\t\t http_response_printf(res, \"%s\\t%s\\n\", pages[i]->name, datebuf);\n\t\t}\n\n\t http_response_send(res);\n\t return; \n\t }\n\t}\n }\n\n http_response_set_status(res, 500, \"Error\");\n http_response_printf(res, \"Failed\\n\");\n http_response_send(res);\n\n return; \n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"wiki_handle_rest_call","file_name":"src/wiki.c","commit_link":"github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#38-1e7893debf07","input":"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n GDBusMethodInvocation *invocation,\n gpointer user_data)\n{\n reset_timeout();\n\n uid_t caller_uid;\n GVariant *response;\n\n caller_uid = get_caller_uid(connection, invocation, caller);\n\n log_notice(\"caller_uid:%ld method:'%s'\", (long)caller_uid, method_name);\n\n if (caller_uid == (uid_t) -1)\n return;\n\n if (g_strcmp0(method_name, \"NewProblem\") == 0)\n {\n char *error = NULL;\n char *problem_id = handle_new_problem(g_variant_get_child_value(parameters, 0), caller_uid, &error);\n if (!problem_id)\n {\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n /* else */\n response = g_variant_new(\"(s)\", problem_id);\n g_dbus_method_invocation_return_value(invocation, response);\n free(problem_id);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"GetProblems\") == 0)\n {\n GList *dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n //I was told that g_dbus_method frees the response\n //g_variant_unref(response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetAllProblems\") == 0)\n {\n /*\n - so, we have UID,\n - if it's 0, then we don't have to check anything and just return all directories\n - if uid != 0 then we want to ask for authorization\n */\n if (caller_uid != 0)\n {\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n }\n\n GList * dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetForeignProblems\") == 0)\n {\n GList * dirs = get_problem_dirs_not_accessible_by_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"ChownProblemDir\") == 0)\n {\n const gchar *problem_dir;\n g_variant_get(parameters, \"(&s)\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int ddstat = fdump_dir_stat_for_uid(dir_fd, caller_uid);\n if (ddstat < 0)\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"requested directory does not exist '%s'\", problem_dir);\n }\n else\n {\n perror_msg(\"can't get stat of '%s'\", problem_dir);\n }\n\n return_InvalidProblemDir_error(invocation, problem_dir);\n\n close(dir_fd);\n return;\n }\n\n if (ddstat & DD_STAT_OWNED_BY_UID)\n { //caller seems to be in group with access to this dir, so no action needed\n log_notice(\"caller has access to the requested directory %s\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, NULL);\n close(dir_fd);\n return;\n }\n\n if ((ddstat & DD_STAT_ACCESSIBLE_BY_UID) == 0 &&\n polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int chown_res = dd_chown(dd, caller_uid);\n if (chown_res != 0)\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.ChownError\",\n _(\"Chowning directory failed. Check system logs for more details.\"));\n else\n g_dbus_method_invocation_return_value(invocation, NULL);\n\n dd_close(dd);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetInfo\") == 0)\n {\n /* Parameter tuple is (sas) */\n\n\t/* Get 1st param - problem dir name */\n const gchar *problem_dir;\n g_variant_get_child(parameters, 0, \"&s\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n close(dir_fd);\n return;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n\t/* Get 2nd param - vector of element names */\n GVariant *array = g_variant_get_child_value(parameters, 1);\n GList *elements = string_list_from_variant(array);\n g_variant_unref(array);\n\n GVariantBuilder *builder = NULL;\n for (GList *l = elements; l; l = l->next)\n {\n const char *element_name = (const char*)l->data;\n char *value = dd_load_text_ext(dd, element_name, 0\n | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE\n | DD_FAIL_QUIETLY_ENOENT\n | DD_FAIL_QUIETLY_EACCES);\n log_notice(\"element '%s' %s\", element_name, value ? \"fetched\" : \"not found\");\n if (value)\n {\n if (!builder)\n builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);\n\n /* g_variant_builder_add makes a copy. No need to xstrdup here */\n g_variant_builder_add(builder, \"{ss}\", element_name, value);\n free(value);\n }\n }\n list_free_with_free(elements);\n dd_close(dd);\n /* It is OK to call g_variant_new(\"(a{ss})\", NULL) because */\n /* G_VARIANT_TYPE_TUPLE allows NULL value */\n GVariant *response = g_variant_new(\"(a{ss})\", builder);\n\n if (builder)\n g_variant_builder_unref(builder);\n\n log_info(\"GetInfo: returning value for '%s'\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"SetElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n const char *value;\n\n g_variant_get(parameters, \"(&s&s&s)\", &problem_id, &element, &value);\n\n if (element == NULL || element[0] == '\\0' || strlen(element) > 64)\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n /* Is it good idea to make it static? Is it possible to change the max size while a single run? */\n const double max_dir_size = g_settings_nMaxCrashReportsSize * (1024 * 1024);\n const long item_size = dd_get_item_size(dd, element);\n if (item_size < 0)\n {\n log_notice(\"Can't get size of '%s/%s'\", problem_id, element);\n char *error = xasprintf(_(\"Can't get size of '%s'\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n return;\n }\n\n const double requested_size = (double)strlen(value) - item_size;\n /* Don't want to check the size limit in case of reducing of size */\n if (requested_size > 0\n && requested_size > (max_dir_size - get_dirsize(g_settings_dump_location)))\n {\n log_notice(\"No problem space left in '%s' (requested Bytes %f)\", problem_id, requested_size);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n _(\"No problem space left\"));\n }\n else\n {\n dd_save_text(dd, element, value);\n g_dbus_method_invocation_return_value(invocation, NULL);\n }\n\n dd_close(dd);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n\n g_variant_get(parameters, \"(&s&s)\", &problem_id, &element);\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n const int res = dd_delete_item(dd, element);\n dd_close(dd);\n\n if (res != 0)\n {\n log_notice(\"Can't delete the element '%s' from the problem directory '%s'\", element, problem_id);\n char *error = xasprintf(_(\"Can't delete the element '%s' from the problem directory '%s'\"), element, problem_id);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteProblem\") == 0)\n {\n /* Dbus parameters are always tuples.\n * In this case, it's (as) - a tuple of one element (array of strings).\n * Need to fetch the array:\n */\n GVariant *array = g_variant_get_child_value(parameters, 0);\n GList *problem_dirs = string_list_from_variant(array);\n g_variant_unref(array);\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n log_notice(\"dir_name:'%s'\", dir_name);\n if (!allowed_problem_dir(dir_name))\n {\n return_InvalidProblemDir_error(invocation, dir_name);\n goto ret;\n }\n }\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n\n int dir_fd = dd_openfd(dir_name);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", dir_name);\n return_InvalidProblemDir_error(invocation, dir_name);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", dir_name);\n close(dir_fd);\n continue;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n { // if user didn't provide correct credentials, just move to the next dir\n close(dir_fd);\n continue;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, dir_name, /*flags:*/ 0);\n if (dd)\n {\n if (dd_delete(dd) != 0)\n {\n error_msg(\"Failed to delete problem directory '%s'\", dir_name);\n dd_close(dd);\n }\n }\n }\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n ret:\n list_free_with_free(problem_dirs);\n return;\n }\n\n if (g_strcmp0(method_name, \"FindProblemByElementInTimeRange\") == 0)\n {\n const gchar *element;\n const gchar *value;\n glong timestamp_from;\n glong timestamp_to;\n gboolean all;\n\n g_variant_get_child(parameters, 0, \"&s\", &element);\n g_variant_get_child(parameters, 1, \"&s\", &value);\n g_variant_get_child(parameters, 2, \"x\", ×tamp_from);\n g_variant_get_child(parameters, 3, \"x\", ×tamp_to);\n g_variant_get_child(parameters, 4, \"b\", &all);\n\n if (all && polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n\n GList *dirs = get_problem_dirs_for_element_in_time(caller_uid, element, value, timestamp_from,\n timestamp_to);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"Quit\") == 0)\n {\n g_dbus_method_invocation_return_value(invocation, NULL);\n g_main_loop_quit(loop);\n return;\n }\n}","target":"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n GDBusMethodInvocation *invocation,\n gpointer user_data)\n{\n reset_timeout();\n\n uid_t caller_uid;\n GVariant *response;\n\n caller_uid = get_caller_uid(connection, invocation, caller);\n\n log_notice(\"caller_uid:%ld method:'%s'\", (long)caller_uid, method_name);\n\n if (caller_uid == (uid_t) -1)\n return;\n\n if (g_strcmp0(method_name, \"NewProblem\") == 0)\n {\n char *error = NULL;\n char *problem_id = handle_new_problem(g_variant_get_child_value(parameters, 0), caller_uid, &error);\n if (!problem_id)\n {\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n /* else */\n response = g_variant_new(\"(s)\", problem_id);\n g_dbus_method_invocation_return_value(invocation, response);\n free(problem_id);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"GetProblems\") == 0)\n {\n GList *dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n //I was told that g_dbus_method frees the response\n //g_variant_unref(response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetAllProblems\") == 0)\n {\n /*\n - so, we have UID,\n - if it's 0, then we don't have to check anything and just return all directories\n - if uid != 0 then we want to ask for authorization\n */\n if (caller_uid != 0)\n {\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n }\n\n GList * dirs = get_problem_dirs_for_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetForeignProblems\") == 0)\n {\n GList * dirs = get_problem_dirs_not_accessible_by_uid(caller_uid, g_settings_dump_location);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"ChownProblemDir\") == 0)\n {\n const gchar *problem_dir;\n g_variant_get(parameters, \"(&s)\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int ddstat = fdump_dir_stat_for_uid(dir_fd, caller_uid);\n if (ddstat < 0)\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"requested directory does not exist '%s'\", problem_dir);\n }\n else\n {\n perror_msg(\"can't get stat of '%s'\", problem_dir);\n }\n\n return_InvalidProblemDir_error(invocation, problem_dir);\n\n close(dir_fd);\n return;\n }\n\n if (ddstat & DD_STAT_OWNED_BY_UID)\n { //caller seems to be in group with access to this dir, so no action needed\n log_notice(\"caller has access to the requested directory %s\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, NULL);\n close(dir_fd);\n return;\n }\n\n if ((ddstat & DD_STAT_ACCESSIBLE_BY_UID) == 0 &&\n polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int chown_res = dd_chown(dd, caller_uid);\n if (chown_res != 0)\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.ChownError\",\n _(\"Chowning directory failed. Check system logs for more details.\"));\n else\n g_dbus_method_invocation_return_value(invocation, NULL);\n\n dd_close(dd);\n return;\n }\n\n if (g_strcmp0(method_name, \"GetInfo\") == 0)\n {\n /* Parameter tuple is (sas) */\n\n\t/* Get 1st param - problem dir name */\n const gchar *problem_dir;\n g_variant_get_child(parameters, 0, \"&s\", &problem_dir);\n log_notice(\"problem_dir:'%s'\", problem_dir);\n\n if (!allowed_problem_dir(problem_dir))\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n int dir_fd = dd_openfd(problem_dir);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", problem_dir);\n return_InvalidProblemDir_error(invocation, problem_dir);\n close(dir_fd);\n return;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n {\n log_notice(\"not authorized\");\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.AuthFailure\",\n _(\"Not Authorized\"));\n close(dir_fd);\n return;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, problem_dir, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES);\n if (!dd)\n {\n return_InvalidProblemDir_error(invocation, problem_dir);\n return;\n }\n\n\t/* Get 2nd param - vector of element names */\n GVariant *array = g_variant_get_child_value(parameters, 1);\n GList *elements = string_list_from_variant(array);\n g_variant_unref(array);\n\n GVariantBuilder *builder = NULL;\n for (GList *l = elements; l; l = l->next)\n {\n const char *element_name = (const char*)l->data;\n char *value = dd_load_text_ext(dd, element_name, 0\n | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE\n | DD_FAIL_QUIETLY_ENOENT\n | DD_FAIL_QUIETLY_EACCES);\n log_notice(\"element '%s' %s\", element_name, value ? \"fetched\" : \"not found\");\n if (value)\n {\n if (!builder)\n builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);\n\n /* g_variant_builder_add makes a copy. No need to xstrdup here */\n g_variant_builder_add(builder, \"{ss}\", element_name, value);\n free(value);\n }\n }\n list_free_with_free(elements);\n dd_close(dd);\n /* It is OK to call g_variant_new(\"(a{ss})\", NULL) because */\n /* G_VARIANT_TYPE_TUPLE allows NULL value */\n GVariant *response = g_variant_new(\"(a{ss})\", builder);\n\n if (builder)\n g_variant_builder_unref(builder);\n\n log_info(\"GetInfo: returning value for '%s'\", problem_dir);\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"SetElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n const char *value;\n\n g_variant_get(parameters, \"(&s&s&s)\", &problem_id, &element, &value);\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n /* Is it good idea to make it static? Is it possible to change the max size while a single run? */\n const double max_dir_size = g_settings_nMaxCrashReportsSize * (1024 * 1024);\n const long item_size = dd_get_item_size(dd, element);\n if (item_size < 0)\n {\n log_notice(\"Can't get size of '%s/%s'\", problem_id, element);\n char *error = xasprintf(_(\"Can't get size of '%s'\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n return;\n }\n\n const double requested_size = (double)strlen(value) - item_size;\n /* Don't want to check the size limit in case of reducing of size */\n if (requested_size > 0\n && requested_size > (max_dir_size - get_dirsize(g_settings_dump_location)))\n {\n log_notice(\"No problem space left in '%s' (requested Bytes %f)\", problem_id, requested_size);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n _(\"No problem space left\"));\n }\n else\n {\n dd_save_text(dd, element, value);\n g_dbus_method_invocation_return_value(invocation, NULL);\n }\n\n dd_close(dd);\n\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteElement\") == 0)\n {\n const char *problem_id;\n const char *element;\n\n g_variant_get(parameters, \"(&s&s)\", &problem_id, &element);\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }\n\n struct dump_dir *dd = open_directory_for_modification_of_element(\n invocation, caller_uid, problem_id, element);\n if (!dd)\n /* Already logged from open_directory_for_modification_of_element() */\n return;\n\n const int res = dd_delete_item(dd, element);\n dd_close(dd);\n\n if (res != 0)\n {\n log_notice(\"Can't delete the element '%s' from the problem directory '%s'\", element, problem_id);\n char *error = xasprintf(_(\"Can't delete the element '%s' from the problem directory '%s'\"), element, problem_id);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.Failure\",\n error);\n free(error);\n return;\n }\n\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n return;\n }\n\n if (g_strcmp0(method_name, \"DeleteProblem\") == 0)\n {\n /* Dbus parameters are always tuples.\n * In this case, it's (as) - a tuple of one element (array of strings).\n * Need to fetch the array:\n */\n GVariant *array = g_variant_get_child_value(parameters, 0);\n GList *problem_dirs = string_list_from_variant(array);\n g_variant_unref(array);\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n log_notice(\"dir_name:'%s'\", dir_name);\n if (!allowed_problem_dir(dir_name))\n {\n return_InvalidProblemDir_error(invocation, dir_name);\n goto ret;\n }\n }\n\n for (GList *l = problem_dirs; l; l = l->next)\n {\n const char *dir_name = (const char*)l->data;\n\n int dir_fd = dd_openfd(dir_name);\n if (dir_fd < 0)\n {\n perror_msg(\"can't open problem directory '%s'\", dir_name);\n return_InvalidProblemDir_error(invocation, dir_name);\n return;\n }\n\n if (!fdump_dir_accessible_by_uid(dir_fd, caller_uid))\n {\n if (errno == ENOTDIR)\n {\n log_notice(\"Requested directory does not exist '%s'\", dir_name);\n close(dir_fd);\n continue;\n }\n\n if (polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") != PolkitYes)\n { // if user didn't provide correct credentials, just move to the next dir\n close(dir_fd);\n continue;\n }\n }\n\n struct dump_dir *dd = dd_fdopendir(dir_fd, dir_name, /*flags:*/ 0);\n if (dd)\n {\n if (dd_delete(dd) != 0)\n {\n error_msg(\"Failed to delete problem directory '%s'\", dir_name);\n dd_close(dd);\n }\n }\n }\n\n g_dbus_method_invocation_return_value(invocation, NULL);\n ret:\n list_free_with_free(problem_dirs);\n return;\n }\n\n if (g_strcmp0(method_name, \"FindProblemByElementInTimeRange\") == 0)\n {\n const gchar *element;\n const gchar *value;\n glong timestamp_from;\n glong timestamp_to;\n gboolean all;\n\n g_variant_get_child(parameters, 0, \"&s\", &element);\n g_variant_get_child(parameters, 1, \"&s\", &value);\n g_variant_get_child(parameters, 2, \"x\", ×tamp_from);\n g_variant_get_child(parameters, 3, \"x\", ×tamp_to);\n g_variant_get_child(parameters, 4, \"b\", &all);\n\n if (all && polkit_check_authorization_dname(caller, \"org.freedesktop.problems.getall\") == PolkitYes)\n caller_uid = 0;\n\n GList *dirs = get_problem_dirs_for_element_in_time(caller_uid, element, value, timestamp_from,\n timestamp_to);\n response = variant_from_string_list(dirs);\n list_free_with_free(dirs);\n\n g_dbus_method_invocation_return_value(invocation, response);\n return;\n }\n\n if (g_strcmp0(method_name, \"Quit\") == 0)\n {\n g_dbus_method_invocation_return_value(invocation, NULL);\n g_main_loop_quit(loop);\n return;\n }\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"handle_method_call","file_name":"src/dbus/abrt-dbus.c","commit_link":"github.com/abrt/abrt/commit/f3c2a6af3455b2882e28570e8a04f1c2d4500d5b","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#39-17d4a82c5000","input":"static bool extractFileTo(zip* zip, const std::string &file, std::string& to,\n char* buf, size_t len) {\n auto sep = file.rfind('/');\n if (sep != std::string::npos) {\n auto path = to + file.substr(0, sep);\n if (!HHVM_FN(is_dir)(path) && !HHVM_FN(mkdir)(path, 0777, true)) {\n return false;\n }\n\n if (sep == file.length() - 1) {\n return true;\n }\n }\n\n to.append(file);\n struct zip_stat zipStat;\n if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n return false;\n }\n\n auto zipFile = zip_fopen_index(zip, zipStat.index, 0);\n FAIL_IF_INVALID_PTR(zipFile);\n\n auto outFile = fopen(to.c_str(), \"wb\");\n if (outFile == nullptr) {\n zip_fclose(zipFile);\n return false;\n }\n\n for (auto n = zip_fread(zipFile, buf, len); n != 0;\n n = zip_fread(zipFile, buf, len)) {\n if (n < 0 || fwrite(buf, sizeof(char), n, outFile) != n) {\n zip_fclose(zipFile);\n fclose(outFile);\n remove(to.c_str());\n return false;\n }\n }\n\n zip_fclose(zipFile);\n if (fclose(outFile) != 0) {\n return false;\n }\n\n return true;\n}","target":"static bool extractFileTo(zip* zip, const std::string &file, std::string& to,\n char* buf, size_t len) {\n\n struct zip_stat zipStat;\n // Verify the file to be extracted is actually in the zip file\n if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n return false;\n }\n\n auto clean_file = file;\n auto sep = std::string::npos;\n // Normally would just use std::string::rfind here, but if we want to be\n // consistent between Windows and Linux, even if techincally Linux won't use\n // backslash for a separator, we are checking for both types.\n int idx = file.length() - 1;\n while (idx >= 0) {\n if (FileUtil::isDirSeparator(file[idx])) {\n sep = idx;\n break;\n }\n idx--;\n }\n if (sep != std::string::npos) {\n // make_relative_path so we do not try to put files or dirs in bad\n // places. This securely \"cleans\" the file.\n clean_file = make_relative_path(file);\n std::string path = to + clean_file;\n bool is_dir_only = true;\n if (sep < file.length() - 1) { // not just a directory\n auto clean_file_dir = HHVM_FN(dirname)(clean_file);\n path = to + clean_file_dir.toCppString();\n is_dir_only = false;\n }\n\n // Make sure the directory path to extract to exists or can be created\n if (!HHVM_FN(is_dir)(path) && !HHVM_FN(mkdir)(path, 0777, true)) {\n return false;\n }\n\n // If we have a good directory to extract to above, we now check whether\n // the \"file\" parameter passed in is a directory or actually a file.\n if (is_dir_only) { // directory, like /usr/bin/\n return true;\n }\n // otherwise file is actually a file, so we actually extract.\n }\n\n // We have ensured that clean_file will be added to a relative path by the\n // time we get here.\n to.append(clean_file);\n\n auto zipFile = zip_fopen_index(zip, zipStat.index, 0);\n FAIL_IF_INVALID_PTR(zipFile);\n\n auto outFile = fopen(to.c_str(), \"wb\");\n if (outFile == nullptr) {\n zip_fclose(zipFile);\n return false;\n }\n\n for (auto n = zip_fread(zipFile, buf, len); n != 0;\n n = zip_fread(zipFile, buf, len)) {\n if (n < 0 || fwrite(buf, sizeof(char), n, outFile) != n) {\n zip_fclose(zipFile);\n fclose(outFile);\n remove(to.c_str());\n return false;\n }\n }\n\n zip_fclose(zipFile);\n if (fclose(outFile) != 0) {\n return false;\n }\n\n return true;\n}","lang":"cpp","vul_type":"cwe-022","sven_meta":{"func_name":"HPHP::extractFileTo","file_name":"hphp/runtime/ext/zip/ext_zip.cpp","commit_link":"github.com/facebook/hhvm/commit/65c95a01541dd2fbc9c978ac53bed235b5376686","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#40-4f5ccce9780b","input":"def new_goal():\n \"\"\"\n new goal\n \"\"\"\n\n goals_dir_check()\n\n click.echo(chalk.blue('Input a single-word name of the goal:'))\n goal_name = input().strip()\n\n if goal_name_exists(goal_name):\n click.echo(chalk.red(\n 'A goal with this name already exists. Please type \"yoda goals view\" to see a list of existing goals'))\n else:\n click.echo(chalk.blue('Input description of the goal:'))\n text = input().strip()\n\n click.echo(chalk.blue('Input due date for the goal (YYYY-MM-DD):'))\n deadline = input().strip()\n\n if os.path.isfile(GOALS_CONFIG_FILE_PATH):\n setup_data = dict(\n name=goal_name,\n text=text,\n deadline=deadline,\n status=0\n )\n append_data_into_file(setup_data, GOALS_CONFIG_FILE_PATH)\n else:\n setup_data = dict(\n entries=[\n dict(\n name=goal_name,\n text=text,\n deadline=deadline,\n status=0\n )\n ]\n )\n input_data(setup_data, GOALS_CONFIG_FILE_PATH)\n\n input_data(dict(entries=[]), get_goal_file_path(goal_name))","target":"def new_goal():\n \"\"\"\n new goal\n \"\"\"\n\n goals_dir_check()\n\n goal_name_not_ok = True\n\n click.echo(chalk.blue('Input a single-word name of the goal:'))\n while goal_name_not_ok:\n goal_name = input().strip()\n if goal_name.isalnum():\n goal_name_not_ok = False\n else:\n click.echo(chalk.red('Only alphanumeric characters can be used! Please input the goal name:'))\n\n if goal_name_exists(goal_name):\n click.echo(chalk.red(\n 'A goal with this name already exists. Please type \"yoda goals view\" to see a list of existing goals'))\n else:\n click.echo(chalk.blue('Input description of the goal:'))\n text = input().strip()\n\n click.echo(chalk.blue('Input due date for the goal (YYYY-MM-DD):'))\n incorrect_date_format = True\n while incorrect_date_format:\n deadline = input().strip()\n try:\n date_str = datetime.datetime.strptime(deadline, '%Y-%m-%d').strftime('%Y-%m-%d')\n if date_str != deadline:\n raise ValueError\n incorrect_date_format = False\n except ValueError:\n click.echo(chalk.red(\"Incorrect data format, should be YYYY-MM-DD. Please repeat:\"))\n\n if os.path.isfile(GOALS_CONFIG_FILE_PATH):\n setup_data = dict(\n name=goal_name,\n text=text,\n deadline=deadline,\n status=0\n )\n append_data_into_file(setup_data, GOALS_CONFIG_FILE_PATH)\n else:\n setup_data = dict(\n entries=[\n dict(\n name=goal_name,\n text=text,\n deadline=deadline,\n status=0\n )\n ]\n )\n input_data(setup_data, GOALS_CONFIG_FILE_PATH)\n\n input_data(dict(entries=[]), get_goal_file_path(goal_name))","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"new_goal","file_name":"modules/goals.py","commit_link":"github.com/yoda-pa/yoda/commit/263946316041601de75638ee303a892f2652cf40","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#41-1868f634d06d","input":"def _inject_admin_password_into_fs(admin_passwd, fs, execute=None):\n \"\"\"Set the root password to admin_passwd\n\n admin_password is a root password\n fs is the path to the base of the filesystem into which to inject\n the key.\n\n This method modifies the instance filesystem directly,\n and does not require a guest agent running in the instance.\n\n \"\"\"\n # The approach used here is to copy the password and shadow\n # files from the instance filesystem to local files, make any\n # necessary changes, and then copy them back.\n\n admin_user = 'root'\n\n fd, tmp_passwd = tempfile.mkstemp()\n os.close(fd)\n fd, tmp_shadow = tempfile.mkstemp()\n os.close(fd)\n\n utils.execute('cp', os.path.join(fs, 'etc', 'passwd'), tmp_passwd,\n run_as_root=True)\n utils.execute('cp', os.path.join(fs, 'etc', 'shadow'), tmp_shadow,\n run_as_root=True)\n _set_passwd(admin_user, admin_passwd, tmp_passwd, tmp_shadow)\n utils.execute('cp', tmp_passwd, os.path.join(fs, 'etc', 'passwd'),\n run_as_root=True)\n os.unlink(tmp_passwd)\n utils.execute('cp', tmp_shadow, os.path.join(fs, 'etc', 'shadow'),\n run_as_root=True)\n os.unlink(tmp_shadow)","target":"def _inject_admin_password_into_fs(admin_passwd, fs, execute=None):\n \"\"\"Set the root password to admin_passwd\n\n admin_password is a root password\n fs is the path to the base of the filesystem into which to inject\n the key.\n\n This method modifies the instance filesystem directly,\n and does not require a guest agent running in the instance.\n\n \"\"\"\n # The approach used here is to copy the password and shadow\n # files from the instance filesystem to local files, make any\n # necessary changes, and then copy them back.\n\n admin_user = 'root'\n\n fd, tmp_passwd = tempfile.mkstemp()\n os.close(fd)\n fd, tmp_shadow = tempfile.mkstemp()\n os.close(fd)\n\n passwd_path = _join_and_check_path_within_fs(fs, 'etc', 'passwd')\n shadow_path = _join_and_check_path_within_fs(fs, 'etc', 'shadow')\n\n utils.execute('cp', passwd_path, tmp_passwd, run_as_root=True)\n utils.execute('cp', shadow_path, tmp_shadow, run_as_root=True)\n _set_passwd(admin_user, admin_passwd, tmp_passwd, tmp_shadow)\n utils.execute('cp', tmp_passwd, passwd_path, run_as_root=True)\n os.unlink(tmp_passwd)\n utils.execute('cp', tmp_shadow, shadow_path, run_as_root=True)\n os.unlink(tmp_shadow)","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"_inject_admin_password_into_fs","file_name":"nova/virt/disk/api.py","commit_link":"github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#42-7b8d67274477","input":"def get_paths(base_path: pathlib.Path):\n data_file = pathlib.Path(str(base_path) + \".data\")\n metadata_file = pathlib.Path(str(base_path) + \".meta\")\n\n return data_file, metadata_file","target":"def get_paths(root: str, sub_path: str) \\\n -> typing.Tuple[pathlib.Path, pathlib.Path]:\n base_path = flask.safe_join(root, sub_path)\n data_file = pathlib.Path(base_path + \".data\")\n metadata_file = pathlib.Path(base_path + \".meta\")\n\n return data_file, metadata_file","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"get_paths","file_name":"xhu.py","commit_link":"github.com/horazont/xmpp-http-upload/commit/82056540191e89f0cd697c81f57714c00962ed75","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#43-d7a867fffdf8","input":"char *compose_path(ctrl_t *ctrl, char *path)\n{\n\tstruct stat st;\n\tstatic char rpath[PATH_MAX];\n\tchar *name, *ptr;\n\tchar dir[PATH_MAX] = { 0 };\n\n\tstrlcpy(dir, ctrl->cwd, sizeof(dir));\n\tDBG(\"Compose path from cwd: %s, arg: %s\", ctrl->cwd, path ?: \"\");\n\tif (!path || !strlen(path))\n\t\tgoto check;\n\n\tif (path) {\n\t\tif (path[0] != '/') {\n\t\t\tif (dir[strlen(dir) - 1] != '/')\n\t\t\t\tstrlcat(dir, \"/\", sizeof(dir));\n\t\t}\n\t\tstrlcat(dir, path, sizeof(dir));\n\t}\n\ncheck:\n\twhile ((ptr = strstr(dir, \"//\")))\n\t\tmemmove(ptr, &ptr[1], strlen(&ptr[1]) + 1);\n\n\tif (!chrooted) {\n\t\tsize_t len = strlen(home);\n\n\t\tDBG(\"Server path from CWD: %s\", dir);\n\t\tif (len > 0 && home[len - 1] == '/')\n\t\t\tlen--;\n\t\tmemmove(dir + len, dir, strlen(dir) + 1);\n\t\tmemcpy(dir, home, len);\n\t\tDBG(\"Resulting non-chroot path: %s\", dir);\n\t}\n\n\t/*\n\t * Handle directories slightly differently, since dirname() on a\n\t * directory returns the parent directory. So, just squash ..\n\t */\n\tif (!stat(dir, &st) && S_ISDIR(st.st_mode)) {\n\t\tif (!realpath(dir, rpath))\n\t\t\treturn NULL;\n\t} else {\n\t\t/*\n\t\t * Check realpath() of directory containing the file, a\n\t\t * STOR may want to save a new file. Then append the\n\t\t * file and return it.\n\t\t */\n\t\tname = basename(path);\n\t\tptr = dirname(dir);\n\n\t\tmemset(rpath, 0, sizeof(rpath));\n\t\tif (!realpath(ptr, rpath)) {\n\t\t\tINFO(\"Failed realpath(%s): %m\", ptr);\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (rpath[1] != 0)\n\t\t\tstrlcat(rpath, \"/\", sizeof(rpath));\n\t\tstrlcat(rpath, name, sizeof(rpath));\n\t}\n\n\tif (!chrooted && strncmp(dir, home, strlen(home))) {\n\t\tDBG(\"Failed non-chroot dir:%s vs home:%s\", dir, home);\n\t\treturn NULL;\n\t}\n\n\treturn rpath;\n}","target":"char *compose_path(ctrl_t *ctrl, char *path)\n{\n\tstruct stat st;\n\tstatic char rpath[PATH_MAX];\n\tchar *name, *ptr;\n\tchar dir[PATH_MAX] = { 0 };\n\n\tstrlcpy(dir, ctrl->cwd, sizeof(dir));\n\tDBG(\"Compose path from cwd: %s, arg: %s\", ctrl->cwd, path ?: \"\");\n\tif (!path || !strlen(path))\n\t\tgoto check;\n\n\tif (path) {\n\t\tif (path[0] != '/') {\n\t\t\tif (dir[strlen(dir) - 1] != '/')\n\t\t\t\tstrlcat(dir, \"/\", sizeof(dir));\n\t\t}\n\t\tstrlcat(dir, path, sizeof(dir));\n\t}\n\ncheck:\n\twhile ((ptr = strstr(dir, \"//\")))\n\t\tmemmove(ptr, &ptr[1], strlen(&ptr[1]) + 1);\n\n\tif (!chrooted) {\n\t\tsize_t len = strlen(home);\n\n\t\tDBG(\"Server path from CWD: %s\", dir);\n\t\tif (len > 0 && home[len - 1] == '/')\n\t\t\tlen--;\n\t\tmemmove(dir + len, dir, strlen(dir) + 1);\n\t\tmemcpy(dir, home, len);\n\t\tDBG(\"Resulting non-chroot path: %s\", dir);\n\t}\n\n\t/*\n\t * Handle directories slightly differently, since dirname() on a\n\t * directory returns the parent directory. So, just squash ..\n\t */\n\tif (!stat(dir, &st) && S_ISDIR(st.st_mode)) {\n\t\tif (!realpath(dir, rpath))\n\t\t\treturn NULL;\n\t} else {\n\t\t/*\n\t\t * Check realpath() of directory containing the file, a\n\t\t * STOR may want to save a new file. Then append the\n\t\t * file and return it.\n\t\t */\n\t\tname = basename(path);\n\t\tptr = dirname(dir);\n\n\t\tmemset(rpath, 0, sizeof(rpath));\n\t\tif (!realpath(ptr, rpath)) {\n\t\t\tINFO(\"Failed realpath(%s): %m\", ptr);\n\t\t\treturn NULL;\n\t\t}\n\n\t\tif (rpath[1] != 0)\n\t\t\tstrlcat(rpath, \"/\", sizeof(rpath));\n\t\tstrlcat(rpath, name, sizeof(rpath));\n\t}\n\n\tif (!chrooted && strncmp(rpath, home, strlen(home))) {\n\t\tDBG(\"Failed non-chroot dir:%s vs home:%s\", dir, home);\n\t\treturn NULL;\n\t}\n\n\treturn rpath;\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"compose_path","file_name":"src/common.c","commit_link":"github.com/troglobit/uftpd/commit/455b47d3756aed162d2d0ef7f40b549f3b5b30fe","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#44-c2312c8f5b91","input":"def valid_id(opts, id_):\n '''\n Returns if the passed id is valid\n '''\n try:\n return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_)\n except (AttributeError, KeyError, TypeError) as e:\n return False","target":"def valid_id(opts, id_):\n '''\n Returns if the passed id is valid\n '''\n try:\n if any(x in id_ for x in ('/', '\\\\', '\\0')):\n return False\n return bool(clean_path(opts['pki_dir'], id_))\n except (AttributeError, KeyError, TypeError):\n return False","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"valid_id","file_name":"salt/utils/verify.py","commit_link":"github.com/saltstack/salt/commit/80d90307b07b3703428ecbb7c8bb468e28a9ae6d","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#45-df0c3974d942","input":" def get(self, path):\n return static_file(path, self.get_base_path())","target":" def get(self, path):\n path = self.sanitize_path(path)\n base_paths = self.get_base_paths()\n if hasattr(base_paths, 'split'):\n # String, so go simple\n base_path = base_paths\n else:\n base_path = self.get_first_base(base_paths, path)\n return static_file(path, base_path)","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"get","file_name":"seagull/routes/app.py","commit_link":"github.com/foxbunny/seagull/commit/1fb790712fe0c1d1957b31e34a8e0e6593af87a7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#46-48fed782bfed","input":"int dd_exist(const struct dump_dir *dd, const char *path)\n{\n char *full_path = concat_path_file(dd->dd_dirname, path);\n int ret = exist_file_dir(full_path);\n free(full_path);\n return ret;\n}","target":"int dd_exist(const struct dump_dir *dd, const char *path)\n{\n if (!str_is_correct_filename(path))\n error_msg_and_die(\"Cannot test existence. '%s' is not a valid file name\", path);\n\n char *full_path = concat_path_file(dd->dd_dirname, path);\n int ret = exist_file_dir(full_path);\n free(full_path);\n return ret;\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"dd_exist","file_name":"src/lib/dump_dir.c","commit_link":"github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#47-b362740ea400","input":" def is_cgi(self):\n \"\"\"Test whether self.path corresponds to a CGI script,\n and return a boolean.\n\n This function sets self.cgi_info to a tuple (dir, rest)\n when it returns True, where dir is the directory part before\n the CGI script name. Note that rest begins with a\n slash if it is not empty.\n\n The default implementation tests whether the path\n begins with one of the strings in the list\n self.cgi_directories (and the next character is a '/'\n or the end of the string).\n \"\"\"\n\n path = self.path\n\n for x in self.cgi_directories:\n i = len(x)\n if path[:i] == x and (not path[i:] or path[i] == '/'):\n self.cgi_info = path[:i], path[i+1:]\n return True\n return False","target":" def is_cgi(self):\n \"\"\"Test whether self.path corresponds to a CGI script.\n\n Returns True and updates the cgi_info attribute to the tuple\n (dir, rest) if self.path requires running a CGI script.\n Returns False otherwise.\n\n The default implementation tests whether the normalized url\n path begins with one of the strings in self.cgi_directories\n (and the next character is a '/' or the end of the string).\n \"\"\"\n splitpath = _url_collapse_path_split(self.path)\n if splitpath[0] in self.cgi_directories:\n self.cgi_info = splitpath\n return True\n return False","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"is_cgi","file_name":"Lib/CGIHTTPServer.py","commit_link":"github.com/Ricky-Wilson/Python/commit/c5abced949e6a4b001d1dee321593e74ecadecfe","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#48-80f68c61320e","input":"def deleteKey(client):\n\t\"\"\"Deletes the specified key.\n\tReturns an error if the key doesn't exist\n\t\"\"\"\n\tglobal BAD_REQUEST\n\tglobal NOT_FOUND\n\n\tvalidateClient(client)\n\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\n\tif re.search('[^a-zA-Z0-9]', token_data['key']):\n\t\traise FoxlockError(BAD_REQUEST, 'Invalid key requested')\n\n\ttry:\n\t\tos.remove('keys/%s/%s.key' % (client, token_data['key']))\n\texcept FileNotFoundError:\n\t\traise FoxlockError(NOT_FOUND, \"Key '%s' not found\" % token_data['key'])\n\n\treturn \"Key '%s' successfully deleted\" % token_data['key']","target":"def deleteKey(client):\n\t\"\"\"Deletes the specified key.\n\tReturns an error if the key doesn't exist\n\t\"\"\"\n\tglobal NOT_FOUND\n\n\tvalidateClient(client)\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateKeyName(token_data['key'])\n\n\ttry:\n\t\tos.remove('keys/%s/%s.key' % (client, token_data['key']))\n\texcept FileNotFoundError:\n\t\traise FoxlockError(NOT_FOUND, \"Key '%s' not found\" % token_data['key'])\n\n\treturn \"Key '%s' successfully deleted\" % token_data['key']","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"deleteKey","file_name":"impl.py","commit_link":"github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#49-641b4cfbd863","input":" def set(self, key, value, replace=False):\n path = os.path.join(self.namespace, key)\n try:\n self.etcd.write(path, value, prevExist=replace)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error storing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to store key')","target":" def set(self, key, value, replace=False):\n path = self._absolute_key(key)\n try:\n self.etcd.write(path, value, prevExist=replace)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error storing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to store key')","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"set","file_name":"custodia/store/etcdstore.py","commit_link":"github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#50-b4b02a129f3c","input":"def _inject_key_into_fs(key, fs, execute=None):\n \"\"\"Add the given public ssh key to root's authorized_keys.\n\n key is an ssh key string.\n fs is the path to the base of the filesystem into which to inject the key.\n \"\"\"\n sshdir = os.path.join(fs, 'root', '.ssh')\n utils.execute('mkdir', '-p', sshdir, run_as_root=True)\n utils.execute('chown', 'root', sshdir, run_as_root=True)\n utils.execute('chmod', '700', sshdir, run_as_root=True)\n keyfile = os.path.join(sshdir, 'authorized_keys')\n key_data = [\n '\\n',\n '# The following ssh key was injected by Nova',\n '\\n',\n key.strip(),\n '\\n',\n ]\n utils.execute('tee', '-a', keyfile,\n process_input=''.join(key_data), run_as_root=True)","target":"def _inject_key_into_fs(key, fs, execute=None):\n \"\"\"Add the given public ssh key to root's authorized_keys.\n\n key is an ssh key string.\n fs is the path to the base of the filesystem into which to inject the key.\n \"\"\"\n sshdir = _join_and_check_path_within_fs(fs, 'root', '.ssh')\n utils.execute('mkdir', '-p', sshdir, run_as_root=True)\n utils.execute('chown', 'root', sshdir, run_as_root=True)\n utils.execute('chmod', '700', sshdir, run_as_root=True)\n\n keyfile = os.path.join('root', '.ssh', 'authorized_keys')\n\n key_data = ''.join([\n '\\n',\n '# The following ssh key was injected by Nova',\n '\\n',\n key.strip(),\n '\\n',\n ])\n\n _inject_file_into_fs(fs, keyfile, key_data, append=True)","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"_inject_key_into_fs","file_name":"nova/virt/disk/api.py","commit_link":"github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-787#0-06ab8781d9a4","input":"rfbHandleAuthResult(rfbClient* client)\n{\n uint32_t authResult=0, reasonLen=0;\n char *reason=NULL;\n\n if (!ReadFromRFBServer(client, (char *)&authResult, 4)) return FALSE;\n\n authResult = rfbClientSwap32IfLE(authResult);\n\n switch (authResult) {\n case rfbVncAuthOK:\n rfbClientLog(\"VNC authentication succeeded\\n\");\n return TRUE;\n break;\n case rfbVncAuthFailed:\n if (client->major==3 && client->minor>7)\n {\n /* we have an error following */\n if (!ReadFromRFBServer(client, (char *)&reasonLen, 4)) return FALSE;\n reasonLen = rfbClientSwap32IfLE(reasonLen);\n reason = malloc((uint64_t)reasonLen+1);\n if (!ReadFromRFBServer(client, reason, reasonLen)) { free(reason); return FALSE; }\n reason[reasonLen]=0;\n rfbClientLog(\"VNC connection failed: %s\\n\",reason);\n free(reason);\n return FALSE;\n }\n rfbClientLog(\"VNC authentication failed\\n\");\n return FALSE;\n case rfbVncAuthTooMany:\n rfbClientLog(\"VNC authentication failed - too many tries\\n\");\n return FALSE;\n }\n\n rfbClientLog(\"Unknown VNC authentication result: %d\\n\",\n (int)authResult);\n return FALSE;\n}","target":"rfbHandleAuthResult(rfbClient* client)\n{\n uint32_t authResult=0;\n\n if (!ReadFromRFBServer(client, (char *)&authResult, 4)) return FALSE;\n\n authResult = rfbClientSwap32IfLE(authResult);\n\n switch (authResult) {\n case rfbVncAuthOK:\n rfbClientLog(\"VNC authentication succeeded\\n\");\n return TRUE;\n break;\n case rfbVncAuthFailed:\n if (client->major==3 && client->minor>7)\n {\n /* we have an error following */\n ReadReason(client);\n return FALSE;\n }\n rfbClientLog(\"VNC authentication failed\\n\");\n return FALSE;\n case rfbVncAuthTooMany:\n rfbClientLog(\"VNC authentication failed - too many tries\\n\");\n return FALSE;\n }\n\n rfbClientLog(\"Unknown VNC authentication result: %d\\n\",\n (int)authResult);\n return FALSE;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"rfbHandleAuthResult","file_name":"libvncclient/rfbproto.c","commit_link":"github.com/LibVNC/libvncserver/commit/e34bcbb759ca5bef85809967a268fdf214c1ad2c","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#1-4b11beb4e976","input":"jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int y, Jbig2ComposeOp op)\n{\n uint32_t w, h;\n uint32_t shift;\n uint32_t leftbyte;\n uint8_t *ss;\n uint8_t *dd;\n uint8_t leftmask, rightmask;\n int early = x >= 0;\n int late;\n uint32_t bytewidth;\n uint32_t syoffset = 0;\n\n if (src == NULL)\n return 0;\n\n /* This code takes a src image and combines it onto dst at offset (x,y), with operation op. */\n\n /* Data is packed msb first within a byte, so with bits numbered: 01234567.\n * Second byte is: 89abcdef. So to combine into a run, we use:\n * (s[0]<<8) | s[1] == 0123456789abcdef.\n * To read from src into dst at offset 3, we need to read:\n * read: 0123456789abcdef...\n * write: 0123456798abcdef...\n * In general, to read from src and write into dst at offset x, we need to shift\n * down by (x&7) bits to allow for bit alignment. So shift = x&7.\n * So the 'central' part of our runs will see us doing:\n * *d++ op= ((s[0]<<8)|s[1])>>shift;\n * with special cases on the left and right edges of the run to mask.\n * With the left hand edge, we have to be careful not to 'underread' the start of\n * the src image; this is what the early flag is about. Similarly we have to be\n * careful not to read off the right hand edge; this is what the late flag is for.\n */\n\n /* clip */\n w = src->width;\n h = src->height;\n shift = (x & 7);\n ss = src->data - early;\n\n if (x < 0) {\n if (w < (uint32_t) -x)\n w = 0;\n else\n w += x;\n ss += (-x-1)>>3;\n x = 0;\n }\n if (y < 0) {\n if (h < (uint32_t) -y)\n h = 0;\n else\n h += y;\n syoffset = -y * src->stride;\n y = 0;\n }\n if ((uint32_t)x + w > dst->width)\n {\n if (dst->width < (uint32_t)x)\n w = 0;\n else\n w = dst->width - x;\n }\n if ((uint32_t)y + h > dst->height)\n {\n if (dst->height < (uint32_t)y)\n h = 0;\n else\n h = dst->height - y;\n }\n#ifdef JBIG2_DEBUG\n jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, \"compositing %dx%d at (%d, %d) after clipping\", w, h, x, y);\n#endif\n\n /* check for zero clipping region */\n if ((w <= 0) || (h <= 0)) {\n#ifdef JBIG2_DEBUG\n jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, \"zero clipping region\");\n#endif\n return 0;\n }\n\n leftbyte = (uint32_t) x >> 3;\n dd = dst->data + y * dst->stride + leftbyte;\n bytewidth = (((uint32_t) x + w - 1) >> 3) - leftbyte + 1;\n leftmask = 255>>(x&7);\n rightmask = (((x+w)&7) == 0) ? 255 : ~(255>>((x+w)&7));\n if (bytewidth == 1)\n leftmask &= rightmask;\n late = (ss + bytewidth >= src->data + ((src->width+7)>>3));\n ss += syoffset;\n\n switch(op)\n {\n case JBIG2_COMPOSE_OR:\n jbig2_image_compose_opt_OR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_AND:\n jbig2_image_compose_opt_AND(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_XOR:\n jbig2_image_compose_opt_XOR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_XNOR:\n jbig2_image_compose_opt_XNOR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_REPLACE:\n jbig2_image_compose_opt_REPLACE(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n }\n\n return 0;\n}","target":"jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int y, Jbig2ComposeOp op)\n{\n uint32_t w, h;\n uint32_t shift;\n uint32_t leftbyte;\n uint8_t *ss;\n uint8_t *dd;\n uint8_t leftmask, rightmask;\n int early = x >= 0;\n int late;\n uint32_t bytewidth;\n uint32_t syoffset = 0;\n\n if (src == NULL)\n return 0;\n\n if ((UINT32_MAX - src->width < (x > 0 ? x : -x)) ||\n (UINT32_MAX - src->height < (y > 0 ? y : -y)))\n {\n#ifdef JBIG2_DEBUG\n jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, \"overflow in compose_image\");\n#endif\n return 0;\n }\n\n /* This code takes a src image and combines it onto dst at offset (x,y), with operation op. */\n\n /* Data is packed msb first within a byte, so with bits numbered: 01234567.\n * Second byte is: 89abcdef. So to combine into a run, we use:\n * (s[0]<<8) | s[1] == 0123456789abcdef.\n * To read from src into dst at offset 3, we need to read:\n * read: 0123456789abcdef...\n * write: 0123456798abcdef...\n * In general, to read from src and write into dst at offset x, we need to shift\n * down by (x&7) bits to allow for bit alignment. So shift = x&7.\n * So the 'central' part of our runs will see us doing:\n * *d++ op= ((s[0]<<8)|s[1])>>shift;\n * with special cases on the left and right edges of the run to mask.\n * With the left hand edge, we have to be careful not to 'underread' the start of\n * the src image; this is what the early flag is about. Similarly we have to be\n * careful not to read off the right hand edge; this is what the late flag is for.\n */\n\n /* clip */\n w = src->width;\n h = src->height;\n shift = (x & 7);\n ss = src->data - early;\n\n if (x < 0) {\n if (w < (uint32_t) -x)\n w = 0;\n else\n w += x;\n ss += (-x-1)>>3;\n x = 0;\n }\n if (y < 0) {\n if (h < (uint32_t) -y)\n h = 0;\n else\n h += y;\n syoffset = -y * src->stride;\n y = 0;\n }\n if ((uint32_t)x + w > dst->width)\n {\n if (dst->width < (uint32_t)x)\n w = 0;\n else\n w = dst->width - x;\n }\n if ((uint32_t)y + h > dst->height)\n {\n if (dst->height < (uint32_t)y)\n h = 0;\n else\n h = dst->height - y;\n }\n#ifdef JBIG2_DEBUG\n jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, \"compositing %dx%d at (%d, %d) after clipping\", w, h, x, y);\n#endif\n\n /* check for zero clipping region */\n if ((w <= 0) || (h <= 0)) {\n#ifdef JBIG2_DEBUG\n jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, \"zero clipping region\");\n#endif\n return 0;\n }\n\n leftbyte = (uint32_t) x >> 3;\n dd = dst->data + y * dst->stride + leftbyte;\n bytewidth = (((uint32_t) x + w - 1) >> 3) - leftbyte + 1;\n leftmask = 255>>(x&7);\n rightmask = (((x+w)&7) == 0) ? 255 : ~(255>>((x+w)&7));\n if (bytewidth == 1)\n leftmask &= rightmask;\n late = (ss + bytewidth >= src->data + ((src->width+7)>>3));\n ss += syoffset;\n\n switch(op)\n {\n case JBIG2_COMPOSE_OR:\n jbig2_image_compose_opt_OR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_AND:\n jbig2_image_compose_opt_AND(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_XOR:\n jbig2_image_compose_opt_XOR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_XNOR:\n jbig2_image_compose_opt_XNOR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n case JBIG2_COMPOSE_REPLACE:\n jbig2_image_compose_opt_REPLACE(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride);\n break;\n }\n\n return 0;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"jbig2_image_compose","file_name":"jbig2_image.c","commit_link":"github.com/ArtifexSoftware/jbig2dec/commit/0726320a4b55078e9d8deb590e477d598b3da66e","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#2-159ad4048c96","input":"next_state_class(CClassNode* cc, OnigCodePoint* vs, enum CCVALTYPE* type,\n\t\t enum CCSTATE* state, ScanEnv* env)\n{\n int r;\n\n if (*state == CCS_RANGE)\n return ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE;\n\n if (*state == CCS_VALUE && *type != CCV_CLASS) {\n if (*type == CCV_SB)\n BITSET_SET_BIT(cc->bs, (int )(*vs));\n else if (*type == CCV_CODE_POINT) {\n r = add_code_range(&(cc->mbuf), env, *vs, *vs);\n if (r < 0) return r;\n }\n }\n\n *state = CCS_VALUE;\n *type = CCV_CLASS;\n return 0;\n}","target":"next_state_class(CClassNode* cc, OnigCodePoint* vs, enum CCVALTYPE* type,\n\t\t enum CCSTATE* state, ScanEnv* env)\n{\n int r;\n\n if (*state == CCS_RANGE)\n return ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE;\n\n if (*state == CCS_VALUE && *type != CCV_CLASS) {\n if (*type == CCV_SB)\n BITSET_SET_BIT(cc->bs, (int )(*vs));\n else if (*type == CCV_CODE_POINT) {\n r = add_code_range(&(cc->mbuf), env, *vs, *vs);\n if (r < 0) return r;\n }\n }\n\n if (*state != CCS_START)\n *state = CCS_VALUE;\n\n *type = CCV_CLASS;\n return 0;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"next_state_class","file_name":"src/regparse.c","commit_link":"github.com/kkos/oniguruma/commit/3b63d12038c8d8fc278e81c942fa9bec7c704c8b","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#3-ef6277c3d03d","input":"int mpol_parse_str(char *str, struct mempolicy **mpol)\n{\n\tstruct mempolicy *new = NULL;\n\tunsigned short mode_flags;\n\tnodemask_t nodes;\n\tchar *nodelist = strchr(str, ':');\n\tchar *flags = strchr(str, '=');\n\tint err = 1, mode;\n\n\tif (flags)\n\t\t*flags++ = '\\0';\t/* terminate mode string */\n\n\tif (nodelist) {\n\t\t/* NUL-terminate mode or flags string */\n\t\t*nodelist++ = '\\0';\n\t\tif (nodelist_parse(nodelist, nodes))\n\t\t\tgoto out;\n\t\tif (!nodes_subset(nodes, node_states[N_MEMORY]))\n\t\t\tgoto out;\n\t} else\n\t\tnodes_clear(nodes);\n\n\tmode = match_string(policy_modes, MPOL_MAX, str);\n\tif (mode < 0)\n\t\tgoto out;\n\n\tswitch (mode) {\n\tcase MPOL_PREFERRED:\n\t\t/*\n\t\t * Insist on a nodelist of one node only\n\t\t */\n\t\tif (nodelist) {\n\t\t\tchar *rest = nodelist;\n\t\t\twhile (isdigit(*rest))\n\t\t\t\trest++;\n\t\t\tif (*rest)\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase MPOL_INTERLEAVE:\n\t\t/*\n\t\t * Default to online nodes with memory if no nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\tnodes = node_states[N_MEMORY];\n\t\tbreak;\n\tcase MPOL_LOCAL:\n\t\t/*\n\t\t * Don't allow a nodelist; mpol_new() checks flags\n\t\t */\n\t\tif (nodelist)\n\t\t\tgoto out;\n\t\tmode = MPOL_PREFERRED;\n\t\tbreak;\n\tcase MPOL_DEFAULT:\n\t\t/*\n\t\t * Insist on a empty nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\terr = 0;\n\t\tgoto out;\n\tcase MPOL_BIND:\n\t\t/*\n\t\t * Insist on a nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\tgoto out;\n\t}\n\n\tmode_flags = 0;\n\tif (flags) {\n\t\t/*\n\t\t * Currently, we only support two mutually exclusive\n\t\t * mode flags.\n\t\t */\n\t\tif (!strcmp(flags, \"static\"))\n\t\t\tmode_flags |= MPOL_F_STATIC_NODES;\n\t\telse if (!strcmp(flags, \"relative\"))\n\t\t\tmode_flags |= MPOL_F_RELATIVE_NODES;\n\t\telse\n\t\t\tgoto out;\n\t}\n\n\tnew = mpol_new(mode, mode_flags, &nodes);\n\tif (IS_ERR(new))\n\t\tgoto out;\n\n\t/*\n\t * Save nodes for mpol_to_str() to show the tmpfs mount options\n\t * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo.\n\t */\n\tif (mode != MPOL_PREFERRED)\n\t\tnew->v.nodes = nodes;\n\telse if (nodelist)\n\t\tnew->v.preferred_node = first_node(nodes);\n\telse\n\t\tnew->flags |= MPOL_F_LOCAL;\n\n\t/*\n\t * Save nodes for contextualization: this will be used to \"clone\"\n\t * the mempolicy in a specific context [cpuset] at a later time.\n\t */\n\tnew->w.user_nodemask = nodes;\n\n\terr = 0;\n\nout:\n\t/* Restore string for error message */\n\tif (nodelist)\n\t\t*--nodelist = ':';\n\tif (flags)\n\t\t*--flags = '=';\n\tif (!err)\n\t\t*mpol = new;\n\treturn err;\n}","target":"int mpol_parse_str(char *str, struct mempolicy **mpol)\n{\n\tstruct mempolicy *new = NULL;\n\tunsigned short mode_flags;\n\tnodemask_t nodes;\n\tchar *nodelist = strchr(str, ':');\n\tchar *flags = strchr(str, '=');\n\tint err = 1, mode;\n\n\tif (flags)\n\t\t*flags++ = '\\0';\t/* terminate mode string */\n\n\tif (nodelist) {\n\t\t/* NUL-terminate mode or flags string */\n\t\t*nodelist++ = '\\0';\n\t\tif (nodelist_parse(nodelist, nodes))\n\t\t\tgoto out;\n\t\tif (!nodes_subset(nodes, node_states[N_MEMORY]))\n\t\t\tgoto out;\n\t} else\n\t\tnodes_clear(nodes);\n\n\tmode = match_string(policy_modes, MPOL_MAX, str);\n\tif (mode < 0)\n\t\tgoto out;\n\n\tswitch (mode) {\n\tcase MPOL_PREFERRED:\n\t\t/*\n\t\t * Insist on a nodelist of one node only, although later\n\t\t * we use first_node(nodes) to grab a single node, so here\n\t\t * nodelist (or nodes) cannot be empty.\n\t\t */\n\t\tif (nodelist) {\n\t\t\tchar *rest = nodelist;\n\t\t\twhile (isdigit(*rest))\n\t\t\t\trest++;\n\t\t\tif (*rest)\n\t\t\t\tgoto out;\n\t\t\tif (nodes_empty(nodes))\n\t\t\t\tgoto out;\n\t\t}\n\t\tbreak;\n\tcase MPOL_INTERLEAVE:\n\t\t/*\n\t\t * Default to online nodes with memory if no nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\tnodes = node_states[N_MEMORY];\n\t\tbreak;\n\tcase MPOL_LOCAL:\n\t\t/*\n\t\t * Don't allow a nodelist; mpol_new() checks flags\n\t\t */\n\t\tif (nodelist)\n\t\t\tgoto out;\n\t\tmode = MPOL_PREFERRED;\n\t\tbreak;\n\tcase MPOL_DEFAULT:\n\t\t/*\n\t\t * Insist on a empty nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\terr = 0;\n\t\tgoto out;\n\tcase MPOL_BIND:\n\t\t/*\n\t\t * Insist on a nodelist\n\t\t */\n\t\tif (!nodelist)\n\t\t\tgoto out;\n\t}\n\n\tmode_flags = 0;\n\tif (flags) {\n\t\t/*\n\t\t * Currently, we only support two mutually exclusive\n\t\t * mode flags.\n\t\t */\n\t\tif (!strcmp(flags, \"static\"))\n\t\t\tmode_flags |= MPOL_F_STATIC_NODES;\n\t\telse if (!strcmp(flags, \"relative\"))\n\t\t\tmode_flags |= MPOL_F_RELATIVE_NODES;\n\t\telse\n\t\t\tgoto out;\n\t}\n\n\tnew = mpol_new(mode, mode_flags, &nodes);\n\tif (IS_ERR(new))\n\t\tgoto out;\n\n\t/*\n\t * Save nodes for mpol_to_str() to show the tmpfs mount options\n\t * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo.\n\t */\n\tif (mode != MPOL_PREFERRED)\n\t\tnew->v.nodes = nodes;\n\telse if (nodelist)\n\t\tnew->v.preferred_node = first_node(nodes);\n\telse\n\t\tnew->flags |= MPOL_F_LOCAL;\n\n\t/*\n\t * Save nodes for contextualization: this will be used to \"clone\"\n\t * the mempolicy in a specific context [cpuset] at a later time.\n\t */\n\tnew->w.user_nodemask = nodes;\n\n\terr = 0;\n\nout:\n\t/* Restore string for error message */\n\tif (nodelist)\n\t\t*--nodelist = ':';\n\tif (flags)\n\t\t*--flags = '=';\n\tif (!err)\n\t\t*mpol = new;\n\treturn err;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"mpol_parse_str","file_name":"mm/mempolicy.c","commit_link":"github.com/torvalds/linux/commit/aa9f7d5172fac9bf1f09e678c35e287a40a7b7dd","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#4-c0c883b6ed3a","input":"keycompare_mb (const struct line *a, const struct line *b)\n{\n struct keyfield *key = keylist;\n\n /* For the first iteration only, the key positions have been\n precomputed for us. */\n char *texta = a->keybeg;\n char *textb = b->keybeg;\n char *lima = a->keylim;\n char *limb = b->keylim;\n\n size_t mblength_a, mblength_b;\n wchar_t wc_a, wc_b;\n mbstate_t state_a, state_b;\n\n int diff = 0;\n\n memset (&state_a, '\\0', sizeof(mbstate_t));\n memset (&state_b, '\\0', sizeof(mbstate_t));\n /* Ignore keys with start after end. */\n if (a->keybeg - a->keylim > 0)\n return 0;\n\n\n /* Ignore and/or translate chars before comparing. */\n# define IGNORE_CHARS(NEW_LEN, LEN, TEXT, COPY, WC, MBLENGTH, STATE) \\\n do \\\n { \\\n wchar_t uwc; \\\n char mbc[MB_LEN_MAX]; \\\n mbstate_t state_wc; \\\n \\\n for (NEW_LEN = i = 0; i < LEN;) \\\n { \\\n mbstate_t state_bak; \\\n \\\n state_bak = STATE; \\\n MBLENGTH = mbrtowc (&WC, TEXT + i, LEN - i, &STATE); \\\n \\\n if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1 \\\n || MBLENGTH == 0) \\\n { \\\n if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \\\n STATE = state_bak; \\\n if (!ignore) \\\n COPY[NEW_LEN++] = TEXT[i]; \\\n i++; \\\n continue; \\\n } \\\n \\\n if (ignore) \\\n { \\\n if ((ignore == nonprinting && !iswprint (WC)) \\\n || (ignore == nondictionary \\\n && !iswalnum (WC) && !iswblank (WC))) \\\n { \\\n i += MBLENGTH; \\\n continue; \\\n } \\\n } \\\n \\\n if (translate) \\\n { \\\n \\\n uwc = towupper(WC); \\\n if (WC == uwc) \\\n { \\\n memcpy (mbc, TEXT + i, MBLENGTH); \\\n i += MBLENGTH; \\\n } \\\n else \\\n { \\\n i += MBLENGTH; \\\n WC = uwc; \\\n memset (&state_wc, '\\0', sizeof (mbstate_t)); \\\n \\\n MBLENGTH = wcrtomb (mbc, WC, &state_wc); \\\n assert (MBLENGTH != (size_t)-1 && MBLENGTH != 0); \\\n } \\\n \\\n for (j = 0; j < MBLENGTH; j++) \\\n COPY[NEW_LEN++] = mbc[j]; \\\n } \\\n else \\\n for (j = 0; j < MBLENGTH; j++) \\\n COPY[NEW_LEN++] = TEXT[i++]; \\\n } \\\n COPY[NEW_LEN] = '\\0'; \\\n } \\\n while (0)\n\n /* Actually compare the fields. */\n\n for (;;)\n {\n /* Find the lengths. */\n size_t lena = lima <= texta ? 0 : lima - texta;\n size_t lenb = limb <= textb ? 0 : limb - textb;\n\n char enda IF_LINT (= 0);\n char endb IF_LINT (= 0);\n\n char const *translate = key->translate;\n bool const *ignore = key->ignore;\n\n if (ignore || translate)\n {\n char *copy_a = (char *) xmalloc (lena + 1 + lenb + 1);\n char *copy_b = copy_a + lena + 1;\n size_t new_len_a, new_len_b;\n size_t i, j;\n\n IGNORE_CHARS (new_len_a, lena, texta, copy_a,\n wc_a, mblength_a, state_a);\n IGNORE_CHARS (new_len_b, lenb, textb, copy_b,\n wc_b, mblength_b, state_b);\n texta = copy_a; textb = copy_b;\n lena = new_len_a; lenb = new_len_b;\n }\n else\n {\n /* Use the keys in-place, temporarily null-terminated. */\n enda = texta[lena]; texta[lena] = '\\0';\n endb = textb[lenb]; textb[lenb] = '\\0';\n }\n\n if (key->random)\n diff = compare_random (texta, lena, textb, lenb);\n else if (key->numeric | key->general_numeric | key->human_numeric)\n {\n char savea = *lima, saveb = *limb;\n\n *lima = *limb = '\\0';\n diff = (key->numeric ? numcompare (texta, textb)\n : key->general_numeric ? general_numcompare (texta, textb)\n : human_numcompare (texta, textb));\n *lima = savea, *limb = saveb;\n }\n else if (key->version)\n diff = filevercmp (texta, textb);\n else if (key->month)\n diff = getmonth (texta, lena, NULL) - getmonth (textb, lenb, NULL);\n else if (lena == 0)\n diff = - NONZERO (lenb);\n else if (lenb == 0)\n diff = 1;\n else if (hard_LC_COLLATE && !folding)\n {\n diff = xmemcoll0 (texta, lena + 1, textb, lenb + 1);\n }\n else\n {\n diff = memcmp (texta, textb, MIN (lena, lenb));\n if (diff == 0)\n diff = lena < lenb ? -1 : lena != lenb;\n }\n\n if (ignore || translate)\n free (texta);\n else\n {\n texta[lena] = enda;\n textb[lenb] = endb;\n }\n\n if (diff)\n goto not_equal;\n\n key = key->next;\n if (! key)\n break;\n\n /* Find the beginning and limit of the next field. */\n if (key->eword != -1)\n lima = limfield (a, key), limb = limfield (b, key);\n else\n lima = a->text + a->length - 1, limb = b->text + b->length - 1;\n\n if (key->sword != -1)\n texta = begfield (a, key), textb = begfield (b, key);\n else\n {\n texta = a->text, textb = b->text;\n if (key->skipsblanks)\n {\n while (texta < lima && ismbblank (texta, lima - texta, &mblength_a))\n texta += mblength_a;\n while (textb < limb && ismbblank (textb, limb - textb, &mblength_b))\n textb += mblength_b;\n }\n }\n }\n\nnot_equal:\n if (key && key->reverse)\n return -diff;\n else\n return diff;\n}","target":"keycompare_mb (const struct line *a, const struct line *b)\n{\n struct keyfield *key = keylist;\n\n /* For the first iteration only, the key positions have been\n precomputed for us. */\n char *texta = a->keybeg;\n char *textb = b->keybeg;\n char *lima = a->keylim;\n char *limb = b->keylim;\n\n size_t mblength_a, mblength_b;\n wchar_t wc_a, wc_b;\n mbstate_t state_a, state_b;\n\n int diff = 0;\n\n memset (&state_a, '\\0', sizeof(mbstate_t));\n memset (&state_b, '\\0', sizeof(mbstate_t));\n /* Ignore keys with start after end. */\n if (a->keybeg - a->keylim > 0)\n return 0;\n\n\n /* Ignore and/or translate chars before comparing. */\n# define IGNORE_CHARS(NEW_LEN, LEN, TEXT, COPY, WC, MBLENGTH, STATE) \\\n do \\\n { \\\n wchar_t uwc; \\\n char mbc[MB_LEN_MAX]; \\\n mbstate_t state_wc; \\\n \\\n for (NEW_LEN = i = 0; i < LEN;) \\\n { \\\n mbstate_t state_bak; \\\n \\\n state_bak = STATE; \\\n MBLENGTH = mbrtowc (&WC, TEXT + i, LEN - i, &STATE); \\\n \\\n if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1 \\\n || MBLENGTH == 0) \\\n { \\\n if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \\\n STATE = state_bak; \\\n if (!ignore) \\\n COPY[NEW_LEN++] = TEXT[i]; \\\n i++; \\\n continue; \\\n } \\\n \\\n if (ignore) \\\n { \\\n if ((ignore == nonprinting && !iswprint (WC)) \\\n || (ignore == nondictionary \\\n && !iswalnum (WC) && !iswblank (WC))) \\\n { \\\n i += MBLENGTH; \\\n continue; \\\n } \\\n } \\\n \\\n if (translate) \\\n { \\\n \\\n uwc = towupper(WC); \\\n if (WC == uwc) \\\n { \\\n memcpy (mbc, TEXT + i, MBLENGTH); \\\n i += MBLENGTH; \\\n } \\\n else \\\n { \\\n i += MBLENGTH; \\\n WC = uwc; \\\n memset (&state_wc, '\\0', sizeof (mbstate_t)); \\\n \\\n MBLENGTH = wcrtomb (mbc, WC, &state_wc); \\\n assert (MBLENGTH != (size_t)-1 && MBLENGTH != 0); \\\n } \\\n \\\n for (j = 0; j < MBLENGTH; j++) \\\n COPY[NEW_LEN++] = mbc[j]; \\\n } \\\n else \\\n for (j = 0; j < MBLENGTH; j++) \\\n COPY[NEW_LEN++] = TEXT[i++]; \\\n } \\\n COPY[NEW_LEN] = '\\0'; \\\n } \\\n while (0)\n\n /* Actually compare the fields. */\n\n for (;;)\n {\n /* Find the lengths. */\n size_t lena = lima <= texta ? 0 : lima - texta;\n size_t lenb = limb <= textb ? 0 : limb - textb;\n\n char enda IF_LINT (= 0);\n char endb IF_LINT (= 0);\n\n char const *translate = key->translate;\n bool const *ignore = key->ignore;\n\n if (ignore || translate)\n {\n if (SIZE_MAX - lenb - 2 < lena)\n xalloc_die ();\n char *copy_a = (char *) xnmalloc (lena + lenb + 2, MB_CUR_MAX);\n char *copy_b = copy_a + lena * MB_CUR_MAX + 1;\n size_t new_len_a, new_len_b;\n size_t i, j;\n\n IGNORE_CHARS (new_len_a, lena, texta, copy_a,\n wc_a, mblength_a, state_a);\n IGNORE_CHARS (new_len_b, lenb, textb, copy_b,\n wc_b, mblength_b, state_b);\n texta = copy_a; textb = copy_b;\n lena = new_len_a; lenb = new_len_b;\n }\n else\n {\n /* Use the keys in-place, temporarily null-terminated. */\n enda = texta[lena]; texta[lena] = '\\0';\n endb = textb[lenb]; textb[lenb] = '\\0';\n }\n\n if (key->random)\n diff = compare_random (texta, lena, textb, lenb);\n else if (key->numeric | key->general_numeric | key->human_numeric)\n {\n char savea = *lima, saveb = *limb;\n\n *lima = *limb = '\\0';\n diff = (key->numeric ? numcompare (texta, textb)\n : key->general_numeric ? general_numcompare (texta, textb)\n : human_numcompare (texta, textb));\n *lima = savea, *limb = saveb;\n }\n else if (key->version)\n diff = filevercmp (texta, textb);\n else if (key->month)\n diff = getmonth (texta, lena, NULL) - getmonth (textb, lenb, NULL);\n else if (lena == 0)\n diff = - NONZERO (lenb);\n else if (lenb == 0)\n diff = 1;\n else if (hard_LC_COLLATE && !folding)\n {\n diff = xmemcoll0 (texta, lena + 1, textb, lenb + 1);\n }\n else\n {\n diff = memcmp (texta, textb, MIN (lena, lenb));\n if (diff == 0)\n diff = lena < lenb ? -1 : lena != lenb;\n }\n\n if (ignore || translate)\n free (texta);\n else\n {\n texta[lena] = enda;\n textb[lenb] = endb;\n }\n\n if (diff)\n goto not_equal;\n\n key = key->next;\n if (! key)\n break;\n\n /* Find the beginning and limit of the next field. */\n if (key->eword != -1)\n lima = limfield (a, key), limb = limfield (b, key);\n else\n lima = a->text + a->length - 1, limb = b->text + b->length - 1;\n\n if (key->sword != -1)\n texta = begfield (a, key), textb = begfield (b, key);\n else\n {\n texta = a->text, textb = b->text;\n if (key->skipsblanks)\n {\n while (texta < lima && ismbblank (texta, lima - texta, &mblength_a))\n texta += mblength_a;\n while (textb < limb && ismbblank (textb, limb - textb, &mblength_b))\n textb += mblength_b;\n }\n }\n }\n\nnot_equal:\n if (key && key->reverse)\n return -diff;\n else\n return diff;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"keycompare_mb","file_name":"src/sort.c","commit_link":"github.com/pixelb/coreutils/commit/bea5e36cc876ed627bb5e0eca36fdfaa6465e940","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#5-46586135959f","input":"next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,\n\t int* vs_israw, int v_israw,\n\t enum CCVALTYPE intype, enum CCVALTYPE* type,\n\t enum CCSTATE* state, ScanEnv* env)\n{\n int r;\n\n switch (*state) {\n case CCS_VALUE:\n if (*type == CCV_SB) {\n BITSET_SET_BIT(cc->bs, (int )(*vs));\n }\n else if (*type == CCV_CODE_POINT) {\n r = add_code_range(&(cc->mbuf), env, *vs, *vs);\n if (r < 0) return r;\n }\n break;\n\n case CCS_RANGE:\n if (intype == *type) {\n if (intype == CCV_SB) {\n if (*vs > 0xff || v > 0xff)\n return ONIGERR_INVALID_CODE_POINT_VALUE;\n\n if (*vs > v) {\n if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC))\n goto ccs_range_end;\n else\n return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS;\n }\n bitset_set_range(cc->bs, (int )*vs, (int )v);\n }\n else {\n r = add_code_range(&(cc->mbuf), env, *vs, v);\n if (r < 0) return r;\n }\n }\n else {\n#if 0\n if (intype == CCV_CODE_POINT && *type == CCV_SB) {\n#endif\n if (*vs > v) {\n if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC))\n goto ccs_range_end;\n else\n return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS;\n }\n bitset_set_range(cc->bs, (int )*vs, (int )(v < 0xff ? v : 0xff));\n r = add_code_range(&(cc->mbuf), env, (OnigCodePoint )*vs, v);\n if (r < 0) return r;\n#if 0\n }\n else\n return ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE;\n#endif\n }\n ccs_range_end:\n *state = CCS_COMPLETE;\n break;\n\n case CCS_COMPLETE:\n case CCS_START:\n *state = CCS_VALUE;\n break;\n\n default:\n break;\n }\n\n *vs_israw = v_israw;\n *vs = v;\n *type = intype;\n return 0;\n}","target":"next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,\n\t int* vs_israw, int v_israw,\n\t enum CCVALTYPE intype, enum CCVALTYPE* type,\n\t enum CCSTATE* state, ScanEnv* env)\n{\n int r;\n\n switch (*state) {\n case CCS_VALUE:\n if (*type == CCV_SB) {\n if (*vs > 0xff)\n return ONIGERR_INVALID_CODE_POINT_VALUE;\n\n BITSET_SET_BIT(cc->bs, (int )(*vs));\n }\n else if (*type == CCV_CODE_POINT) {\n r = add_code_range(&(cc->mbuf), env, *vs, *vs);\n if (r < 0) return r;\n }\n break;\n\n case CCS_RANGE:\n if (intype == *type) {\n if (intype == CCV_SB) {\n if (*vs > 0xff || v > 0xff)\n return ONIGERR_INVALID_CODE_POINT_VALUE;\n\n if (*vs > v) {\n if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC))\n goto ccs_range_end;\n else\n return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS;\n }\n bitset_set_range(cc->bs, (int )*vs, (int )v);\n }\n else {\n r = add_code_range(&(cc->mbuf), env, *vs, v);\n if (r < 0) return r;\n }\n }\n else {\n#if 0\n if (intype == CCV_CODE_POINT && *type == CCV_SB) {\n#endif\n if (*vs > v) {\n if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC))\n goto ccs_range_end;\n else\n return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS;\n }\n bitset_set_range(cc->bs, (int )*vs, (int )(v < 0xff ? v : 0xff));\n r = add_code_range(&(cc->mbuf), env, (OnigCodePoint )*vs, v);\n if (r < 0) return r;\n#if 0\n }\n else\n return ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE;\n#endif\n }\n ccs_range_end:\n *state = CCS_COMPLETE;\n break;\n\n case CCS_COMPLETE:\n case CCS_START:\n *state = CCS_VALUE;\n break;\n\n default:\n break;\n }\n\n *vs_israw = v_israw;\n *vs = v;\n *type = intype;\n return 0;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"next_state_val","file_name":"src/regparse.c","commit_link":"github.com/kkos/oniguruma/commit/b4bf968ad52afe14e60a2dc8a95d3555c543353a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#6-ca81f6b34f54","input":"static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,\n CodedBitstreamFragment *frag,\n int header)\n{\n AVBufferRef *data_ref;\n uint8_t *data;\n size_t data_size;\n int unit, start, end, marker, next_start, next_marker;\n int err, i, j, length;\n\n if (frag->data_size < 4) {\n // Definitely too short to be meaningful.\n return AVERROR_INVALIDDATA;\n }\n\n for (i = 0; i + 1 < frag->data_size && frag->data[i] != 0xff; i++);\n if (i > 0) {\n av_log(ctx->log_ctx, AV_LOG_WARNING, \"Discarding %d bytes at \"\n \"beginning of image.\\n\", i);\n }\n for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size && frag->data[i]) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"no SOI marker found.\\n\");\n return AVERROR_INVALIDDATA;\n }\n marker = frag->data[i];\n if (marker != JPEG_MARKER_SOI) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: first \"\n \"marker is %02x, should be SOI.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"no image content found.\\n\");\n return AVERROR_INVALIDDATA;\n }\n marker = frag->data[i];\n start = i + 1;\n\n for (unit = 0;; unit++) {\n if (marker == JPEG_MARKER_EOI) {\n break;\n } else if (marker == JPEG_MARKER_SOS) {\n for (i = start; i + 1 < frag->data_size; i++) {\n if (frag->data[i] != 0xff)\n continue;\n end = i;\n for (++i; i + 1 < frag->data_size &&\n frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n next_marker = -1;\n } else {\n if (frag->data[i] == 0x00)\n continue;\n next_marker = frag->data[i];\n next_start = i + 1;\n }\n break;\n }\n } else {\n i = start;\n if (i + 2 > frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"truncated at %02x marker.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n length = AV_RB16(frag->data + i);\n if (i + length > frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"truncated at %02x marker segment.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n end = start + length;\n\n i = end;\n if (frag->data[i] != 0xff) {\n next_marker = -1;\n } else {\n for (++i; i + 1 < frag->data_size &&\n frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n next_marker = -1;\n } else {\n next_marker = frag->data[i];\n next_start = i + 1;\n }\n }\n }\n\n if (marker == JPEG_MARKER_SOS) {\n length = AV_RB16(frag->data + start);\n\n data_ref = NULL;\n data = av_malloc(end - start +\n AV_INPUT_BUFFER_PADDING_SIZE);\n if (!data)\n return AVERROR(ENOMEM);\n\n memcpy(data, frag->data + start, length);\n for (i = start + length, j = length; i < end; i++, j++) {\n if (frag->data[i] == 0xff) {\n while (frag->data[i] == 0xff)\n ++i;\n data[j] = 0xff;\n } else {\n data[j] = frag->data[i];\n }\n }\n data_size = j;\n\n memset(data + data_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);\n\n } else {\n data = frag->data + start;\n data_size = end - start;\n data_ref = frag->data_ref;\n }\n\n err = ff_cbs_insert_unit_data(ctx, frag, unit, marker,\n data, data_size, data_ref);\n if (err < 0)\n return err;\n\n if (next_marker == -1)\n break;\n marker = next_marker;\n start = next_start;\n }\n\n return 0;\n}","target":"static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,\n CodedBitstreamFragment *frag,\n int header)\n{\n AVBufferRef *data_ref;\n uint8_t *data;\n size_t data_size;\n int unit, start, end, marker, next_start, next_marker;\n int err, i, j, length;\n\n if (frag->data_size < 4) {\n // Definitely too short to be meaningful.\n return AVERROR_INVALIDDATA;\n }\n\n for (i = 0; i + 1 < frag->data_size && frag->data[i] != 0xff; i++);\n if (i > 0) {\n av_log(ctx->log_ctx, AV_LOG_WARNING, \"Discarding %d bytes at \"\n \"beginning of image.\\n\", i);\n }\n for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size && frag->data[i]) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"no SOI marker found.\\n\");\n return AVERROR_INVALIDDATA;\n }\n marker = frag->data[i];\n if (marker != JPEG_MARKER_SOI) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: first \"\n \"marker is %02x, should be SOI.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"no image content found.\\n\");\n return AVERROR_INVALIDDATA;\n }\n marker = frag->data[i];\n start = i + 1;\n\n for (unit = 0;; unit++) {\n if (marker == JPEG_MARKER_EOI) {\n break;\n } else if (marker == JPEG_MARKER_SOS) {\n for (i = start; i + 1 < frag->data_size; i++) {\n if (frag->data[i] != 0xff)\n continue;\n end = i;\n for (++i; i + 1 < frag->data_size &&\n frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n next_marker = -1;\n } else {\n if (frag->data[i] == 0x00)\n continue;\n next_marker = frag->data[i];\n next_start = i + 1;\n }\n break;\n }\n } else {\n i = start;\n if (i + 2 > frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"truncated at %02x marker.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n length = AV_RB16(frag->data + i);\n if (i + length > frag->data_size) {\n av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \"\n \"truncated at %02x marker segment.\\n\", marker);\n return AVERROR_INVALIDDATA;\n }\n end = start + length;\n\n i = end;\n if (frag->data[i] != 0xff) {\n next_marker = -1;\n } else {\n for (++i; i + 1 < frag->data_size &&\n frag->data[i] == 0xff; i++);\n if (i + 1 >= frag->data_size) {\n next_marker = -1;\n } else {\n next_marker = frag->data[i];\n next_start = i + 1;\n }\n }\n }\n\n if (marker == JPEG_MARKER_SOS) {\n length = AV_RB16(frag->data + start);\n\n if (length > end - start)\n return AVERROR_INVALIDDATA;\n\n data_ref = NULL;\n data = av_malloc(end - start +\n AV_INPUT_BUFFER_PADDING_SIZE);\n if (!data)\n return AVERROR(ENOMEM);\n\n memcpy(data, frag->data + start, length);\n for (i = start + length, j = length; i < end; i++, j++) {\n if (frag->data[i] == 0xff) {\n while (frag->data[i] == 0xff)\n ++i;\n data[j] = 0xff;\n } else {\n data[j] = frag->data[i];\n }\n }\n data_size = j;\n\n memset(data + data_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);\n\n } else {\n data = frag->data + start;\n data_size = end - start;\n data_ref = frag->data_ref;\n }\n\n err = ff_cbs_insert_unit_data(ctx, frag, unit, marker,\n data, data_size, data_ref);\n if (err < 0)\n return err;\n\n if (next_marker == -1)\n break;\n marker = next_marker;\n start = next_start;\n }\n\n return 0;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"cbs_jpeg_split_fragment","file_name":"libavcodec/cbs_jpeg.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/1812352d767ccf5431aa440123e2e260a4db2726","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#7-9f95cd1e2f00","input":"void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,\n int linesize_align[AV_NUM_DATA_POINTERS])\n{\n int i;\n int w_align = 1;\n int h_align = 1;\n AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);\n\n if (desc) {\n w_align = 1 << desc->log2_chroma_w;\n h_align = 1 << desc->log2_chroma_h;\n }\n\n switch (s->pix_fmt) {\n case AV_PIX_FMT_YUV420P:\n case AV_PIX_FMT_YUYV422:\n case AV_PIX_FMT_YVYU422:\n case AV_PIX_FMT_UYVY422:\n case AV_PIX_FMT_YUV422P:\n case AV_PIX_FMT_YUV440P:\n case AV_PIX_FMT_YUV444P:\n case AV_PIX_FMT_GBRP:\n case AV_PIX_FMT_GBRAP:\n case AV_PIX_FMT_GRAY8:\n case AV_PIX_FMT_GRAY16BE:\n case AV_PIX_FMT_GRAY16LE:\n case AV_PIX_FMT_YUVJ420P:\n case AV_PIX_FMT_YUVJ422P:\n case AV_PIX_FMT_YUVJ440P:\n case AV_PIX_FMT_YUVJ444P:\n case AV_PIX_FMT_YUVA420P:\n case AV_PIX_FMT_YUVA422P:\n case AV_PIX_FMT_YUVA444P:\n case AV_PIX_FMT_YUV420P9LE:\n case AV_PIX_FMT_YUV420P9BE:\n case AV_PIX_FMT_YUV420P10LE:\n case AV_PIX_FMT_YUV420P10BE:\n case AV_PIX_FMT_YUV420P12LE:\n case AV_PIX_FMT_YUV420P12BE:\n case AV_PIX_FMT_YUV420P14LE:\n case AV_PIX_FMT_YUV420P14BE:\n case AV_PIX_FMT_YUV420P16LE:\n case AV_PIX_FMT_YUV420P16BE:\n case AV_PIX_FMT_YUVA420P9LE:\n case AV_PIX_FMT_YUVA420P9BE:\n case AV_PIX_FMT_YUVA420P10LE:\n case AV_PIX_FMT_YUVA420P10BE:\n case AV_PIX_FMT_YUVA420P16LE:\n case AV_PIX_FMT_YUVA420P16BE:\n case AV_PIX_FMT_YUV422P9LE:\n case AV_PIX_FMT_YUV422P9BE:\n case AV_PIX_FMT_YUV422P10LE:\n case AV_PIX_FMT_YUV422P10BE:\n case AV_PIX_FMT_YUV422P12LE:\n case AV_PIX_FMT_YUV422P12BE:\n case AV_PIX_FMT_YUV422P14LE:\n case AV_PIX_FMT_YUV422P14BE:\n case AV_PIX_FMT_YUV422P16LE:\n case AV_PIX_FMT_YUV422P16BE:\n case AV_PIX_FMT_YUVA422P9LE:\n case AV_PIX_FMT_YUVA422P9BE:\n case AV_PIX_FMT_YUVA422P10LE:\n case AV_PIX_FMT_YUVA422P10BE:\n case AV_PIX_FMT_YUVA422P16LE:\n case AV_PIX_FMT_YUVA422P16BE:\n case AV_PIX_FMT_YUV440P10LE:\n case AV_PIX_FMT_YUV440P10BE:\n case AV_PIX_FMT_YUV440P12LE:\n case AV_PIX_FMT_YUV440P12BE:\n case AV_PIX_FMT_YUV444P9LE:\n case AV_PIX_FMT_YUV444P9BE:\n case AV_PIX_FMT_YUV444P10LE:\n case AV_PIX_FMT_YUV444P10BE:\n case AV_PIX_FMT_YUV444P12LE:\n case AV_PIX_FMT_YUV444P12BE:\n case AV_PIX_FMT_YUV444P14LE:\n case AV_PIX_FMT_YUV444P14BE:\n case AV_PIX_FMT_YUV444P16LE:\n case AV_PIX_FMT_YUV444P16BE:\n case AV_PIX_FMT_YUVA444P9LE:\n case AV_PIX_FMT_YUVA444P9BE:\n case AV_PIX_FMT_YUVA444P10LE:\n case AV_PIX_FMT_YUVA444P10BE:\n case AV_PIX_FMT_YUVA444P16LE:\n case AV_PIX_FMT_YUVA444P16BE:\n case AV_PIX_FMT_GBRP9LE:\n case AV_PIX_FMT_GBRP9BE:\n case AV_PIX_FMT_GBRP10LE:\n case AV_PIX_FMT_GBRP10BE:\n case AV_PIX_FMT_GBRP12LE:\n case AV_PIX_FMT_GBRP12BE:\n case AV_PIX_FMT_GBRP14LE:\n case AV_PIX_FMT_GBRP14BE:\n case AV_PIX_FMT_GBRP16LE:\n case AV_PIX_FMT_GBRP16BE:\n case AV_PIX_FMT_GBRAP12LE:\n case AV_PIX_FMT_GBRAP12BE:\n case AV_PIX_FMT_GBRAP16LE:\n case AV_PIX_FMT_GBRAP16BE:\n w_align = 16; //FIXME assume 16 pixel per macroblock\n h_align = 16 * 2; // interlaced needs 2 macroblocks height\n break;\n case AV_PIX_FMT_YUV411P:\n case AV_PIX_FMT_YUVJ411P:\n case AV_PIX_FMT_UYYVYY411:\n w_align = 32;\n h_align = 16 * 2;\n break;\n case AV_PIX_FMT_YUV410P:\n if (s->codec_id == AV_CODEC_ID_SVQ1) {\n w_align = 64;\n h_align = 64;\n }\n break;\n case AV_PIX_FMT_RGB555:\n if (s->codec_id == AV_CODEC_ID_RPZA) {\n w_align = 4;\n h_align = 4;\n }\n break;\n case AV_PIX_FMT_PAL8:\n case AV_PIX_FMT_BGR8:\n case AV_PIX_FMT_RGB8:\n if (s->codec_id == AV_CODEC_ID_SMC ||\n s->codec_id == AV_CODEC_ID_CINEPAK) {\n w_align = 4;\n h_align = 4;\n }\n if (s->codec_id == AV_CODEC_ID_JV) {\n w_align = 8;\n h_align = 8;\n }\n break;\n case AV_PIX_FMT_BGR24:\n if ((s->codec_id == AV_CODEC_ID_MSZH) ||\n (s->codec_id == AV_CODEC_ID_ZLIB)) {\n w_align = 4;\n h_align = 4;\n }\n break;\n case AV_PIX_FMT_RGB24:\n if (s->codec_id == AV_CODEC_ID_CINEPAK) {\n w_align = 4;\n h_align = 4;\n }\n break;\n default:\n break;\n }\n\n if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {\n w_align = FFMAX(w_align, 8);\n }\n\n *width = FFALIGN(*width, w_align);\n *height = FFALIGN(*height, h_align);\n if (s->codec_id == AV_CODEC_ID_H264 || s->lowres) {\n // some of the optimized chroma MC reads one line too much\n // which is also done in mpeg decoders with lowres > 0\n *height += 2;\n\n // H.264 uses edge emulation for out of frame motion vectors, for this\n // it requires a temporary area large enough to hold a 21x21 block,\n // increasing witdth ensure that the temporary area is large enough,\n // the next rounded up width is 32\n *width = FFMAX(*width, 32);\n }\n\n for (i = 0; i < 4; i++)\n linesize_align[i] = STRIDE_ALIGN;\n}","target":"void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,\n int linesize_align[AV_NUM_DATA_POINTERS])\n{\n int i;\n int w_align = 1;\n int h_align = 1;\n AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);\n\n if (desc) {\n w_align = 1 << desc->log2_chroma_w;\n h_align = 1 << desc->log2_chroma_h;\n }\n\n switch (s->pix_fmt) {\n case AV_PIX_FMT_YUV420P:\n case AV_PIX_FMT_YUYV422:\n case AV_PIX_FMT_YVYU422:\n case AV_PIX_FMT_UYVY422:\n case AV_PIX_FMT_YUV422P:\n case AV_PIX_FMT_YUV440P:\n case AV_PIX_FMT_YUV444P:\n case AV_PIX_FMT_GBRP:\n case AV_PIX_FMT_GBRAP:\n case AV_PIX_FMT_GRAY8:\n case AV_PIX_FMT_GRAY16BE:\n case AV_PIX_FMT_GRAY16LE:\n case AV_PIX_FMT_YUVJ420P:\n case AV_PIX_FMT_YUVJ422P:\n case AV_PIX_FMT_YUVJ440P:\n case AV_PIX_FMT_YUVJ444P:\n case AV_PIX_FMT_YUVA420P:\n case AV_PIX_FMT_YUVA422P:\n case AV_PIX_FMT_YUVA444P:\n case AV_PIX_FMT_YUV420P9LE:\n case AV_PIX_FMT_YUV420P9BE:\n case AV_PIX_FMT_YUV420P10LE:\n case AV_PIX_FMT_YUV420P10BE:\n case AV_PIX_FMT_YUV420P12LE:\n case AV_PIX_FMT_YUV420P12BE:\n case AV_PIX_FMT_YUV420P14LE:\n case AV_PIX_FMT_YUV420P14BE:\n case AV_PIX_FMT_YUV420P16LE:\n case AV_PIX_FMT_YUV420P16BE:\n case AV_PIX_FMT_YUVA420P9LE:\n case AV_PIX_FMT_YUVA420P9BE:\n case AV_PIX_FMT_YUVA420P10LE:\n case AV_PIX_FMT_YUVA420P10BE:\n case AV_PIX_FMT_YUVA420P16LE:\n case AV_PIX_FMT_YUVA420P16BE:\n case AV_PIX_FMT_YUV422P9LE:\n case AV_PIX_FMT_YUV422P9BE:\n case AV_PIX_FMT_YUV422P10LE:\n case AV_PIX_FMT_YUV422P10BE:\n case AV_PIX_FMT_YUV422P12LE:\n case AV_PIX_FMT_YUV422P12BE:\n case AV_PIX_FMT_YUV422P14LE:\n case AV_PIX_FMT_YUV422P14BE:\n case AV_PIX_FMT_YUV422P16LE:\n case AV_PIX_FMT_YUV422P16BE:\n case AV_PIX_FMT_YUVA422P9LE:\n case AV_PIX_FMT_YUVA422P9BE:\n case AV_PIX_FMT_YUVA422P10LE:\n case AV_PIX_FMT_YUVA422P10BE:\n case AV_PIX_FMT_YUVA422P16LE:\n case AV_PIX_FMT_YUVA422P16BE:\n case AV_PIX_FMT_YUV440P10LE:\n case AV_PIX_FMT_YUV440P10BE:\n case AV_PIX_FMT_YUV440P12LE:\n case AV_PIX_FMT_YUV440P12BE:\n case AV_PIX_FMT_YUV444P9LE:\n case AV_PIX_FMT_YUV444P9BE:\n case AV_PIX_FMT_YUV444P10LE:\n case AV_PIX_FMT_YUV444P10BE:\n case AV_PIX_FMT_YUV444P12LE:\n case AV_PIX_FMT_YUV444P12BE:\n case AV_PIX_FMT_YUV444P14LE:\n case AV_PIX_FMT_YUV444P14BE:\n case AV_PIX_FMT_YUV444P16LE:\n case AV_PIX_FMT_YUV444P16BE:\n case AV_PIX_FMT_YUVA444P9LE:\n case AV_PIX_FMT_YUVA444P9BE:\n case AV_PIX_FMT_YUVA444P10LE:\n case AV_PIX_FMT_YUVA444P10BE:\n case AV_PIX_FMT_YUVA444P16LE:\n case AV_PIX_FMT_YUVA444P16BE:\n case AV_PIX_FMT_GBRP9LE:\n case AV_PIX_FMT_GBRP9BE:\n case AV_PIX_FMT_GBRP10LE:\n case AV_PIX_FMT_GBRP10BE:\n case AV_PIX_FMT_GBRP12LE:\n case AV_PIX_FMT_GBRP12BE:\n case AV_PIX_FMT_GBRP14LE:\n case AV_PIX_FMT_GBRP14BE:\n case AV_PIX_FMT_GBRP16LE:\n case AV_PIX_FMT_GBRP16BE:\n case AV_PIX_FMT_GBRAP12LE:\n case AV_PIX_FMT_GBRAP12BE:\n case AV_PIX_FMT_GBRAP16LE:\n case AV_PIX_FMT_GBRAP16BE:\n w_align = 16; //FIXME assume 16 pixel per macroblock\n h_align = 16 * 2; // interlaced needs 2 macroblocks height\n break;\n case AV_PIX_FMT_YUV411P:\n case AV_PIX_FMT_YUVJ411P:\n case AV_PIX_FMT_UYYVYY411:\n w_align = 32;\n h_align = 16 * 2;\n break;\n case AV_PIX_FMT_YUV410P:\n if (s->codec_id == AV_CODEC_ID_SVQ1) {\n w_align = 64;\n h_align = 64;\n }\n break;\n case AV_PIX_FMT_RGB555:\n if (s->codec_id == AV_CODEC_ID_RPZA) {\n w_align = 4;\n h_align = 4;\n }\n if (s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {\n w_align = 8;\n h_align = 8;\n }\n break;\n case AV_PIX_FMT_PAL8:\n case AV_PIX_FMT_BGR8:\n case AV_PIX_FMT_RGB8:\n if (s->codec_id == AV_CODEC_ID_SMC ||\n s->codec_id == AV_CODEC_ID_CINEPAK) {\n w_align = 4;\n h_align = 4;\n }\n if (s->codec_id == AV_CODEC_ID_JV ||\n s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {\n w_align = 8;\n h_align = 8;\n }\n break;\n case AV_PIX_FMT_BGR24:\n if ((s->codec_id == AV_CODEC_ID_MSZH) ||\n (s->codec_id == AV_CODEC_ID_ZLIB)) {\n w_align = 4;\n h_align = 4;\n }\n break;\n case AV_PIX_FMT_RGB24:\n if (s->codec_id == AV_CODEC_ID_CINEPAK) {\n w_align = 4;\n h_align = 4;\n }\n break;\n default:\n break;\n }\n\n if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {\n w_align = FFMAX(w_align, 8);\n }\n\n *width = FFALIGN(*width, w_align);\n *height = FFALIGN(*height, h_align);\n if (s->codec_id == AV_CODEC_ID_H264 || s->lowres) {\n // some of the optimized chroma MC reads one line too much\n // which is also done in mpeg decoders with lowres > 0\n *height += 2;\n\n // H.264 uses edge emulation for out of frame motion vectors, for this\n // it requires a temporary area large enough to hold a 21x21 block,\n // increasing witdth ensure that the temporary area is large enough,\n // the next rounded up width is 32\n *width = FFMAX(*width, 32);\n }\n\n for (i = 0; i < 4; i++)\n linesize_align[i] = STRIDE_ALIGN;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"avcodec_align_dimensions2","file_name":"libavcodec/utils.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/2080bc33717955a0e4268e738acf8c1eeddbf8cb","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#8-a540590b95c1","input":"int ContentLine_Analyzer::DoDeliverOnce(int len, const u_char* data)\n\t{\n\tconst u_char* data_start = data;\n\n\tif ( len <= 0 )\n\t\treturn 0;\n\n\tfor ( ; len > 0; --len, ++data )\n\t\t{\n\t\tif ( offset >= buf_len )\n\t\t\tInitBuffer(buf_len * 2);\n\n\t\tint c = data[0];\n\n#define EMIT_LINE \\\n\t{ \\\n\tbuf[offset] = '\\0'; \\\n\tint seq_len = data + 1 - data_start; \\\n\tseq_delivered_in_lines = seq + seq_len; \\\n\tlast_char = c; \\\n\tForwardStream(offset, buf, IsOrig()); \\\n\toffset = 0; \\\n\treturn seq_len; \\\n\t}\n\n\t\tswitch ( c ) {\n\t\tcase '\\r':\n\t\t\t// Look ahead for '\\n'.\n\t\t\tif ( len > 1 && data[1] == '\\n' )\n\t\t\t\t{\n\t\t\t\t--len; ++data;\n\t\t\t\tlast_char = c;\n\t\t\t\tc = data[0];\n\t\t\t\tEMIT_LINE\n\t\t\t\t}\n\n\t\t\telse if ( CR_LF_as_EOL & CR_as_EOL )\n\t\t\t\tEMIT_LINE\n\n\t\t\telse\n\t\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\n\t\tcase '\\n':\n\t\t\tif ( last_char == '\\r' )\n\t\t\t\t{\n\t\t\t\t--offset; // remove '\\r'\n\t\t\t\tEMIT_LINE\n\t\t\t\t}\n\n\t\t\telse if ( CR_LF_as_EOL & LF_as_EOL )\n\t\t\t\tEMIT_LINE\n\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tif ( ! suppress_weirds && Conn()->FlagEvent(SINGULAR_LF) )\n\t\t\t\t\tConn()->Weird(\"line_terminated_with_single_LF\");\n\t\t\t\tbuf[offset++] = c;\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\tcase '\\0':\n\t\t\tif ( flag_NULs )\n\t\t\t\tCheckNUL();\n\t\t\telse\n\t\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\t\t}\n\n\t\tif ( last_char == '\\r' )\n\t\t\tif ( ! suppress_weirds && Conn()->FlagEvent(SINGULAR_CR) )\n\t\t\t\tConn()->Weird(\"line_terminated_with_single_CR\");\n\n\t\tlast_char = c;\n\t\t}\n\n\treturn data - data_start;\n\t}","target":"int ContentLine_Analyzer::DoDeliverOnce(int len, const u_char* data)\n\t{\n\tconst u_char* data_start = data;\n\n\tif ( len <= 0 )\n\t\treturn 0;\n\n\tfor ( ; len > 0; --len, ++data )\n\t\t{\n\t\tif ( offset >= buf_len )\n\t\t\tInitBuffer(buf_len * 2);\n\n\t\tint c = data[0];\n\n#define EMIT_LINE \\\n\t{ \\\n\tbuf[offset] = '\\0'; \\\n\tint seq_len = data + 1 - data_start; \\\n\tseq_delivered_in_lines = seq + seq_len; \\\n\tlast_char = c; \\\n\tForwardStream(offset, buf, IsOrig()); \\\n\toffset = 0; \\\n\treturn seq_len; \\\n\t}\n\n\t\tswitch ( c ) {\n\t\tcase '\\r':\n\t\t\t// Look ahead for '\\n'.\n\t\t\tif ( len > 1 && data[1] == '\\n' )\n\t\t\t\t{\n\t\t\t\t--len; ++data;\n\t\t\t\tlast_char = c;\n\t\t\t\tc = data[0];\n\t\t\t\tEMIT_LINE\n\t\t\t\t}\n\n\t\t\telse if ( CR_LF_as_EOL & CR_as_EOL )\n\t\t\t\tEMIT_LINE\n\n\t\t\telse\n\t\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\n\t\tcase '\\n':\n\t\t\tif ( last_char == '\\r' )\n\t\t\t\t{\n\t\t\t\t// Weird corner-case:\n\t\t\t\t// this can happen if we see a \\r at the end of a packet where crlf is\n\t\t\t\t// set to CR_as_EOL | LF_as_EOL, with the packet causing crlf to be set to\n\t\t\t\t// 0 and the next packet beginning with a \\n. In this case we just swallow\n\t\t\t\t// the character and re-set last_char.\n\t\t\t\tif ( offset == 0 )\n\t\t\t\t\t{\n\t\t\t\t\tlast_char = c;\n\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t--offset; // remove '\\r'\n\t\t\t\tEMIT_LINE\n\t\t\t\t}\n\n\t\t\telse if ( CR_LF_as_EOL & LF_as_EOL )\n\t\t\t\tEMIT_LINE\n\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tif ( ! suppress_weirds && Conn()->FlagEvent(SINGULAR_LF) )\n\t\t\t\t\tConn()->Weird(\"line_terminated_with_single_LF\");\n\t\t\t\tbuf[offset++] = c;\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\tcase '\\0':\n\t\t\tif ( flag_NULs )\n\t\t\t\tCheckNUL();\n\t\t\telse\n\t\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbuf[offset++] = c;\n\t\t\tbreak;\n\t\t}\n\n\t\tif ( last_char == '\\r' )\n\t\t\tif ( ! suppress_weirds && Conn()->FlagEvent(SINGULAR_CR) )\n\t\t\t\tConn()->Weird(\"line_terminated_with_single_CR\");\n\n\t\tlast_char = c;\n\t\t}\n\n\treturn data - data_start;\n\t}","lang":"cpp","vul_type":"cwe-787","sven_meta":{"func_name":"ContentLine_Analyzer::DoDeliverOnce","file_name":"src/analyzer/protocol/tcp/ContentLine.cc","commit_link":"github.com/bro/bro/commit/6c0f101a62489b1c5927b4ed63b0e1d37db40282","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#9-836517feae17","input":"idn2_to_ascii_4i (const uint32_t * input, size_t inlen, char * output, int flags)\n{\n uint32_t *input_u32;\n uint8_t *input_u8, *output_u8;\n size_t length;\n int rc;\n\n if (!input)\n {\n if (output)\n\t*output = 0;\n return IDN2_OK;\n }\n\n input_u32 = (uint32_t *) malloc ((inlen + 1) * sizeof(uint32_t));\n if (!input_u32)\n return IDN2_MALLOC;\n\n u32_cpy (input_u32, input, inlen);\n input_u32[inlen] = 0;\n\n input_u8 = u32_to_u8 (input_u32, inlen + 1, NULL, &length);\n free (input_u32);\n if (!input_u8)\n {\n if (errno == ENOMEM)\n\treturn IDN2_MALLOC;\n return IDN2_ENCODING_ERROR;\n }\n\n rc = idn2_lookup_u8 (input_u8, &output_u8, flags);\n free (input_u8);\n\n if (rc == IDN2_OK)\n {\n /* wow, this is ugly, but libidn manpage states:\n * char * out output zero terminated string that must have room for at\n * least 63 characters plus the terminating zero.\n */\n if (output)\n\tstrcpy (output, (const char *) output_u8);\n\n free(output_u8);\n }\n\n return rc;\n}","target":"idn2_to_ascii_4i (const uint32_t * input, size_t inlen, char * output, int flags)\n{\n uint32_t *input_u32;\n uint8_t *input_u8, *output_u8;\n size_t length;\n int rc;\n\n if (!input)\n {\n if (output)\n\t*output = 0;\n return IDN2_OK;\n }\n\n input_u32 = (uint32_t *) malloc ((inlen + 1) * sizeof(uint32_t));\n if (!input_u32)\n return IDN2_MALLOC;\n\n u32_cpy (input_u32, input, inlen);\n input_u32[inlen] = 0;\n\n input_u8 = u32_to_u8 (input_u32, inlen + 1, NULL, &length);\n free (input_u32);\n if (!input_u8)\n {\n if (errno == ENOMEM)\n\treturn IDN2_MALLOC;\n return IDN2_ENCODING_ERROR;\n }\n\n rc = idn2_lookup_u8 (input_u8, &output_u8, flags);\n free (input_u8);\n\n if (rc == IDN2_OK)\n {\n /* wow, this is ugly, but libidn manpage states:\n * char * out output zero terminated string that must have room for at\n * least 63 characters plus the terminating zero.\n */\n size_t len = strlen ((char *) output_u8);\n\n if (len > 63)\n {\n\t free (output_u8);\n\t return IDN2_TOO_BIG_DOMAIN;\n }\n\n if (output)\n\tstrcpy (output, (char *) output_u8);\n\n free (output_u8);\n }\n\n return rc;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"idn2_to_ascii_4i","file_name":"lib/lookup.c","commit_link":"github.com/libidn/libidn2/commit/e4d1558aa2c1c04a05066ee8600f37603890ba8c","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#10-9007af95bfe5","input":"static int blosc_c(struct thread_context* thread_context, int32_t bsize,\n int32_t leftoverblock, int32_t ntbytes, int32_t maxbytes,\n const uint8_t* src, const int32_t offset, uint8_t* dest,\n uint8_t* tmp, uint8_t* tmp2) {\n blosc2_context* context = thread_context->parent_context;\n int dont_split = (context->header_flags & 0x10) >> 4;\n int dict_training = context->use_dict && context->dict_cdict == NULL;\n int32_t j, neblock, nstreams;\n int32_t cbytes; /* number of compressed bytes in split */\n int32_t ctbytes = 0; /* number of compressed bytes in block */\n int64_t maxout;\n int32_t typesize = context->typesize;\n const char* compname;\n int accel;\n const uint8_t* _src;\n uint8_t *_tmp = tmp, *_tmp2 = tmp2;\n uint8_t *_tmp3 = thread_context->tmp4;\n int last_filter_index = last_filter(context->filters, 'c');\n bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;\n\n if (last_filter_index >= 0 || context->prefilter != NULL) {\n /* Apply the filter pipeline just for the prefilter */\n if (memcpyed && context->prefilter != NULL) {\n // We only need the prefilter output\n _src = pipeline_c(thread_context, bsize, src, offset, dest, _tmp2, _tmp3);\n\n if (_src == NULL) {\n return -9; // signals a problem with the filter pipeline\n }\n return bsize;\n }\n /* Apply regular filter pipeline */\n _src = pipeline_c(thread_context, bsize, src, offset, _tmp, _tmp2, _tmp3);\n\n if (_src == NULL) {\n return -9; // signals a problem with the filter pipeline\n }\n } else {\n _src = src + offset;\n }\n\n assert(context->clevel > 0);\n\n /* Calculate acceleration for different compressors */\n accel = get_accel(context);\n\n /* The number of compressed data streams for this block */\n if (!dont_split && !leftoverblock && !dict_training) {\n nstreams = (int32_t)typesize;\n }\n else {\n nstreams = 1;\n }\n neblock = bsize / nstreams;\n for (j = 0; j < nstreams; j++) {\n if (!dict_training) {\n dest += sizeof(int32_t);\n ntbytes += sizeof(int32_t);\n ctbytes += sizeof(int32_t);\n }\n\n // See if we have a run here\n const uint8_t* ip = (uint8_t*)_src + j * neblock;\n const uint8_t* ipbound = (uint8_t*)_src + (j + 1) * neblock;\n if (get_run(ip, ipbound)) {\n // A run. Encode the repeated byte as a negative length in the length of the split.\n int32_t value = _src[j * neblock];\n _sw32(dest - 4, -value);\n continue;\n }\n\n maxout = neblock;\n #if defined(HAVE_SNAPPY)\n if (context->compcode == BLOSC_SNAPPY) {\n maxout = (int32_t)snappy_max_compressed_length((size_t)neblock);\n }\n #endif /* HAVE_SNAPPY */\n if (ntbytes + maxout > maxbytes) {\n /* avoid buffer * overrun */\n maxout = (int64_t)maxbytes - (int64_t)ntbytes;\n if (maxout <= 0) {\n return 0; /* non-compressible block */\n }\n }\n if (dict_training) {\n // We are in the build dict state, so don't compress\n // TODO: copy only a percentage for sampling\n memcpy(dest, _src + j * neblock, (unsigned int)neblock);\n cbytes = (int32_t)neblock;\n }\n else if (context->compcode == BLOSC_BLOSCLZ) {\n cbytes = blosclz_compress(context->clevel, _src + j * neblock,\n (int)neblock, dest, (int)maxout);\n }\n #if defined(HAVE_LZ4)\n else if (context->compcode == BLOSC_LZ4) {\n void *hash_table = NULL;\n #ifdef HAVE_IPP\n hash_table = (void*)thread_context->lz4_hash_table;\n #endif\n cbytes = lz4_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, accel, hash_table);\n }\n else if (context->compcode == BLOSC_LZ4HC) {\n cbytes = lz4hc_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_LZ4 */\n #if defined(HAVE_LIZARD)\n else if (context->compcode == BLOSC_LIZARD) {\n cbytes = lizard_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, accel);\n }\n #endif /* HAVE_LIZARD */\n #if defined(HAVE_SNAPPY)\n else if (context->compcode == BLOSC_SNAPPY) {\n cbytes = snappy_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout);\n }\n #endif /* HAVE_SNAPPY */\n #if defined(HAVE_ZLIB)\n else if (context->compcode == BLOSC_ZLIB) {\n cbytes = zlib_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_ZLIB */\n #if defined(HAVE_ZSTD)\n else if (context->compcode == BLOSC_ZSTD) {\n cbytes = zstd_wrap_compress(thread_context,\n (char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_ZSTD */\n\n else {\n blosc_compcode_to_compname(context->compcode, &compname);\n fprintf(stderr, \"Blosc has not been compiled with '%s' \", compname);\n fprintf(stderr, \"compression support. Please use one having it.\");\n return -5; /* signals no compression support */\n }\n\n if (cbytes > maxout) {\n /* Buffer overrun caused by compression (should never happen) */\n return -1;\n }\n if (cbytes < 0) {\n /* cbytes should never be negative */\n return -2;\n }\n if (!dict_training) {\n if (cbytes == 0 || cbytes == neblock) {\n /* The compressor has been unable to compress data at all. */\n /* Before doing the copy, check that we are not running into a\n buffer overflow. */\n if ((ntbytes + neblock) > maxbytes) {\n return 0; /* Non-compressible data */\n }\n memcpy(dest, _src + j * neblock, (unsigned int)neblock);\n cbytes = neblock;\n }\n _sw32(dest - 4, cbytes);\n }\n dest += cbytes;\n ntbytes += cbytes;\n ctbytes += cbytes;\n } /* Closes j < nstreams */\n\n //printf(\"c%d\", ctbytes);\n return ctbytes;\n}","target":"static int blosc_c(struct thread_context* thread_context, int32_t bsize,\n int32_t leftoverblock, int32_t ntbytes, int32_t destsize,\n const uint8_t* src, const int32_t offset, uint8_t* dest,\n uint8_t* tmp, uint8_t* tmp2) {\n blosc2_context* context = thread_context->parent_context;\n int dont_split = (context->header_flags & 0x10) >> 4;\n int dict_training = context->use_dict && context->dict_cdict == NULL;\n int32_t j, neblock, nstreams;\n int32_t cbytes; /* number of compressed bytes in split */\n int32_t ctbytes = 0; /* number of compressed bytes in block */\n int64_t maxout;\n int32_t typesize = context->typesize;\n const char* compname;\n int accel;\n const uint8_t* _src;\n uint8_t *_tmp = tmp, *_tmp2 = tmp2;\n uint8_t *_tmp3 = thread_context->tmp4;\n int last_filter_index = last_filter(context->filters, 'c');\n bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;\n\n if (last_filter_index >= 0 || context->prefilter != NULL) {\n /* Apply the filter pipeline just for the prefilter */\n if (memcpyed && context->prefilter != NULL) {\n // We only need the prefilter output\n _src = pipeline_c(thread_context, bsize, src, offset, dest, _tmp2, _tmp3);\n\n if (_src == NULL) {\n return -9; // signals a problem with the filter pipeline\n }\n return bsize;\n }\n /* Apply regular filter pipeline */\n _src = pipeline_c(thread_context, bsize, src, offset, _tmp, _tmp2, _tmp3);\n\n if (_src == NULL) {\n return -9; // signals a problem with the filter pipeline\n }\n } else {\n _src = src + offset;\n }\n\n assert(context->clevel > 0);\n\n /* Calculate acceleration for different compressors */\n accel = get_accel(context);\n\n /* The number of compressed data streams for this block */\n if (!dont_split && !leftoverblock && !dict_training) {\n nstreams = (int32_t)typesize;\n }\n else {\n nstreams = 1;\n }\n neblock = bsize / nstreams;\n for (j = 0; j < nstreams; j++) {\n if (!dict_training) {\n dest += sizeof(int32_t);\n ntbytes += sizeof(int32_t);\n ctbytes += sizeof(int32_t);\n }\n\n // See if we have a run here\n const uint8_t* ip = (uint8_t*)_src + j * neblock;\n const uint8_t* ipbound = (uint8_t*)_src + (j + 1) * neblock;\n if (get_run(ip, ipbound)) {\n // A run. Encode the repeated byte as a negative length in the length of the split.\n int32_t value = _src[j * neblock];\n if (ntbytes > destsize) {\n /* Not enough space to write out compressed block size */\n return -1;\n }\n _sw32(dest - 4, -value);\n continue;\n }\n\n maxout = neblock;\n #if defined(HAVE_SNAPPY)\n if (context->compcode == BLOSC_SNAPPY) {\n maxout = (int32_t)snappy_max_compressed_length((size_t)neblock);\n }\n #endif /* HAVE_SNAPPY */\n if (ntbytes + maxout > destsize) {\n /* avoid buffer * overrun */\n maxout = (int64_t)destsize - (int64_t)ntbytes;\n if (maxout <= 0) {\n return 0; /* non-compressible block */\n }\n }\n if (dict_training) {\n // We are in the build dict state, so don't compress\n // TODO: copy only a percentage for sampling\n memcpy(dest, _src + j * neblock, (unsigned int)neblock);\n cbytes = (int32_t)neblock;\n }\n else if (context->compcode == BLOSC_BLOSCLZ) {\n cbytes = blosclz_compress(context->clevel, _src + j * neblock,\n (int)neblock, dest, (int)maxout);\n }\n #if defined(HAVE_LZ4)\n else if (context->compcode == BLOSC_LZ4) {\n void *hash_table = NULL;\n #ifdef HAVE_IPP\n hash_table = (void*)thread_context->lz4_hash_table;\n #endif\n cbytes = lz4_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, accel, hash_table);\n }\n else if (context->compcode == BLOSC_LZ4HC) {\n cbytes = lz4hc_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_LZ4 */\n #if defined(HAVE_LIZARD)\n else if (context->compcode == BLOSC_LIZARD) {\n cbytes = lizard_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, accel);\n }\n #endif /* HAVE_LIZARD */\n #if defined(HAVE_SNAPPY)\n else if (context->compcode == BLOSC_SNAPPY) {\n cbytes = snappy_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout);\n }\n #endif /* HAVE_SNAPPY */\n #if defined(HAVE_ZLIB)\n else if (context->compcode == BLOSC_ZLIB) {\n cbytes = zlib_wrap_compress((char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_ZLIB */\n #if defined(HAVE_ZSTD)\n else if (context->compcode == BLOSC_ZSTD) {\n cbytes = zstd_wrap_compress(thread_context,\n (char*)_src + j * neblock, (size_t)neblock,\n (char*)dest, (size_t)maxout, context->clevel);\n }\n #endif /* HAVE_ZSTD */\n\n else {\n blosc_compcode_to_compname(context->compcode, &compname);\n fprintf(stderr, \"Blosc has not been compiled with '%s' \", compname);\n fprintf(stderr, \"compression support. Please use one having it.\");\n return -5; /* signals no compression support */\n }\n\n if (cbytes > maxout) {\n /* Buffer overrun caused by compression (should never happen) */\n return -1;\n }\n if (cbytes < 0) {\n /* cbytes should never be negative */\n return -2;\n }\n if (!dict_training) {\n if (cbytes == 0 || cbytes == neblock) {\n /* The compressor has been unable to compress data at all. */\n /* Before doing the copy, check that we are not running into a\n buffer overflow. */\n if ((ntbytes + neblock) > destsize) {\n return 0; /* Non-compressible data */\n }\n memcpy(dest, _src + j * neblock, (unsigned int)neblock);\n cbytes = neblock;\n }\n _sw32(dest - 4, cbytes);\n }\n dest += cbytes;\n ntbytes += cbytes;\n ctbytes += cbytes;\n } /* Closes j < nstreams */\n\n //printf(\"c%d\", ctbytes);\n return ctbytes;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"blosc_c","file_name":"blosc/blosc2.c","commit_link":"github.com/Blosc/c-blosc2/commit/c4c6470e88210afc95262c8b9fcc27e30ca043ee","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#11-446653130560","input":"bool Scanner::fill(size_t need)\n{\n if (eof) return false;\n\n pop_finished_files();\n\n DASSERT(bot <= tok && tok <= lim);\n size_t free = static_cast(tok - bot);\n size_t copy = static_cast(lim - tok);\n\n if (free >= need) {\n memmove(bot, tok, copy);\n shift_ptrs_and_fpos(-static_cast(free));\n }\n else {\n BSIZE += std::max(BSIZE, need);\n char * buf = new char[BSIZE + YYMAXFILL];\n if (!buf) fatal(\"out of memory\");\n\n memmove(buf, tok, copy);\n shift_ptrs_and_fpos(buf - bot);\n delete [] bot;\n bot = buf;\n\n free = BSIZE - copy;\n }\n\n if (!read(free)) {\n eof = lim;\n memset(lim, 0, YYMAXFILL);\n lim += YYMAXFILL;\n }\n\n return true;\n}","target":"bool Scanner::fill(size_t need)\n{\n if (eof) return false;\n\n pop_finished_files();\n\n DASSERT(bot <= tok && tok <= lim);\n size_t free = static_cast(tok - bot);\n size_t copy = static_cast(lim - tok);\n\n if (free >= need) {\n memmove(bot, tok, copy);\n shift_ptrs_and_fpos(-static_cast(free));\n }\n else {\n BSIZE += std::max(BSIZE, need);\n char * buf = new char[BSIZE + YYMAXFILL];\n if (!buf) fatal(\"out of memory\");\n\n memmove(buf, tok, copy);\n shift_ptrs_and_fpos(buf - tok);\n delete [] bot;\n bot = buf;\n\n free = BSIZE - copy;\n }\n\n DASSERT(lim + free <= bot + BSIZE);\n if (!read(free)) {\n eof = lim;\n memset(lim, 0, YYMAXFILL);\n lim += YYMAXFILL;\n }\n\n return true;\n}","lang":"cpp","vul_type":"cwe-787","sven_meta":{"func_name":"re2c::Scanner::fill","file_name":"src/parse/scanner.cc","commit_link":"github.com/skvadrik/re2c/commit/c4603ba5ce229db83a2a4fb93e6d4b4e3ec3776a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#12-670696a3597d","input":"input_csi_dispatch_sgr_colon(struct input_ctx *ictx, u_int i)\n{\n\tstruct grid_cell\t*gc = &ictx->cell.cell;\n\tchar\t\t\t*s = ictx->param_list[i].str, *copy, *ptr, *out;\n\tint\t\t\t p[8];\n\tu_int\t\t\t n;\n\tconst char\t\t*errstr;\n\n\tfor (n = 0; n < nitems(p); n++)\n\t\tp[n] = -1;\n\tn = 0;\n\n\tptr = copy = xstrdup(s);\n\twhile ((out = strsep(&ptr, \":\")) != NULL) {\n\t\tif (*out != '\\0') {\n\t\t\tp[n++] = strtonum(out, 0, INT_MAX, &errstr);\n\t\t\tif (errstr != NULL || n == nitems(p)) {\n\t\t\t\tfree(copy);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else\n\t\t\tn++;\n\t\tlog_debug(\"%s: %u = %d\", __func__, n - 1, p[n - 1]);\n\t}\n\tfree(copy);\n\n\tif (n == 0)\n\t\treturn;\n\tif (p[0] == 4) {\n\t\tif (n != 2)\n\t\t\treturn;\n\t\tswitch (p[1]) {\n\t\tcase 0:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_2;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_3;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_4;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_5;\n\t\t\tbreak;\n\t\t}\n\t\treturn;\n\t}\n\tif (n < 2 || (p[0] != 38 && p[0] != 48 && p[0] != 58))\n\t\treturn;\n\tswitch (p[1]) {\n\tcase 2:\n\t\tif (n < 3)\n\t\t\tbreak;\n\t\tif (n == 5)\n\t\t\ti = 2;\n\t\telse\n\t\t\ti = 3;\n\t\tif (n < i + 3)\n\t\t\tbreak;\n\t\tinput_csi_dispatch_sgr_rgb_do(ictx, p[0], p[i], p[i + 1],\n\t\t p[i + 2]);\n\t\tbreak;\n\tcase 5:\n\t\tif (n < 3)\n\t\t\tbreak;\n\t\tinput_csi_dispatch_sgr_256_do(ictx, p[0], p[2]);\n\t\tbreak;\n\t}\n}","target":"input_csi_dispatch_sgr_colon(struct input_ctx *ictx, u_int i)\n{\n\tstruct grid_cell\t*gc = &ictx->cell.cell;\n\tchar\t\t\t*s = ictx->param_list[i].str, *copy, *ptr, *out;\n\tint\t\t\t p[8];\n\tu_int\t\t\t n;\n\tconst char\t\t*errstr;\n\n\tfor (n = 0; n < nitems(p); n++)\n\t\tp[n] = -1;\n\tn = 0;\n\n\tptr = copy = xstrdup(s);\n\twhile ((out = strsep(&ptr, \":\")) != NULL) {\n\t\tif (*out != '\\0') {\n\t\t\tp[n++] = strtonum(out, 0, INT_MAX, &errstr);\n\t\t\tif (errstr != NULL || n == nitems(p)) {\n\t\t\t\tfree(copy);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tn++;\n\t\t\tif (n == nitems(p)) {\n\t\t\t\tfree(copy);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tlog_debug(\"%s: %u = %d\", __func__, n - 1, p[n - 1]);\n\t}\n\tfree(copy);\n\n\tif (n == 0)\n\t\treturn;\n\tif (p[0] == 4) {\n\t\tif (n != 2)\n\t\t\treturn;\n\t\tswitch (p[1]) {\n\t\tcase 0:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_2;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_3;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_4;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tgc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;\n\t\t\tgc->attr |= GRID_ATTR_UNDERSCORE_5;\n\t\t\tbreak;\n\t\t}\n\t\treturn;\n\t}\n\tif (n < 2 || (p[0] != 38 && p[0] != 48 && p[0] != 58))\n\t\treturn;\n\tswitch (p[1]) {\n\tcase 2:\n\t\tif (n < 3)\n\t\t\tbreak;\n\t\tif (n == 5)\n\t\t\ti = 2;\n\t\telse\n\t\t\ti = 3;\n\t\tif (n < i + 3)\n\t\t\tbreak;\n\t\tinput_csi_dispatch_sgr_rgb_do(ictx, p[0], p[i], p[i + 1],\n\t\t p[i + 2]);\n\t\tbreak;\n\tcase 5:\n\t\tif (n < 3)\n\t\t\tbreak;\n\t\tinput_csi_dispatch_sgr_256_do(ictx, p[0], p[2]);\n\t\tbreak;\n\t}\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"input_csi_dispatch_sgr_colon","file_name":"input.c","commit_link":"github.com/tmux/tmux/commit/a868bacb46e3c900530bed47a1c6f85b0fbe701c","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#13-4472376d45c6","input":"char *enl_ipc_get(const char *msg_data)\n{\n\n\tstatic char *message = NULL;\n\tstatic unsigned short len = 0;\n\tchar buff[13], *ret_msg = NULL;\n\tregister unsigned char i;\n\tunsigned char blen;\n\n\tif (msg_data == IPC_TIMEOUT) {\n\t\treturn(IPC_TIMEOUT);\n\t}\n\tfor (i = 0; i < 12; i++) {\n\t\tbuff[i] = msg_data[i];\n\t}\n\tbuff[12] = 0;\n\tblen = strlen(buff);\n\tif (message != NULL) {\n\t\tlen += blen;\n\t\tmessage = (char *) erealloc(message, len + 1);\n\t\tstrcat(message, buff);\n\t} else {\n\t\tlen = blen;\n\t\tmessage = (char *) emalloc(len + 1);\n\t\tstrcpy(message, buff);\n\t}\n\tif (blen < 12) {\n\t\tret_msg = message;\n\t\tmessage = NULL;\n\t\tD((\"Received complete reply: \\\"%s\\\"\\n\", ret_msg));\n\t}\n\treturn(ret_msg);\n}","target":"char *enl_ipc_get(const char *msg_data)\n{\n\n\tstatic char *message = NULL;\n\tstatic size_t len = 0;\n\tchar buff[13], *ret_msg = NULL;\n\tregister unsigned char i;\n\tunsigned char blen;\n\n\tif (msg_data == IPC_TIMEOUT) {\n\t\treturn(IPC_TIMEOUT);\n\t}\n\tfor (i = 0; i < 12; i++) {\n\t\tbuff[i] = msg_data[i];\n\t}\n\tbuff[12] = 0;\n\tblen = strlen(buff);\n\tif (message != NULL) {\n\t\tlen += blen;\n\t\tmessage = (char *) erealloc(message, len + 1);\n\t\tstrcat(message, buff);\n\t} else {\n\t\tlen = blen;\n\t\tmessage = (char *) emalloc(len + 1);\n\t\tstrcpy(message, buff);\n\t}\n\tif (blen < 12) {\n\t\tret_msg = message;\n\t\tmessage = NULL;\n\t\tD((\"Received complete reply: \\\"%s\\\"\\n\", ret_msg));\n\t}\n\treturn(ret_msg);\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"enl_ipc_get","file_name":"src/wallpaper.c","commit_link":"github.com/derf/feh/commit/f7a547b7ef8fc8ebdeaa4c28515c9d72e592fb6d","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#14-c2de46ef5043","input":"static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)\n{\n\tbool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;\n\tu32 chunk_size = mr->chunk_size, headroom = mr->headroom;\n\tunsigned int chunks, chunks_per_page;\n\tu64 addr = mr->addr, size = mr->len;\n\tint size_chk, err;\n\n\tif (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {\n\t\t/* Strictly speaking we could support this, if:\n\t\t * - huge pages, or*\n\t\t * - using an IOMMU, or\n\t\t * - making sure the memory area is consecutive\n\t\t * but for now, we simply say \"computer says no\".\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif (mr->flags & ~(XDP_UMEM_UNALIGNED_CHUNK_FLAG |\n\t\t\tXDP_UMEM_USES_NEED_WAKEUP))\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks && !is_power_of_2(chunk_size))\n\t\treturn -EINVAL;\n\n\tif (!PAGE_ALIGNED(addr)) {\n\t\t/* Memory area has to be page size aligned. For\n\t\t * simplicity, this might change.\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif ((addr + size) < addr)\n\t\treturn -EINVAL;\n\n\tchunks = (unsigned int)div_u64(size, chunk_size);\n\tif (chunks == 0)\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks) {\n\t\tchunks_per_page = PAGE_SIZE / chunk_size;\n\t\tif (chunks < chunks_per_page || chunks % chunks_per_page)\n\t\t\treturn -EINVAL;\n\t}\n\n\tsize_chk = chunk_size - headroom - XDP_PACKET_HEADROOM;\n\tif (size_chk < 0)\n\t\treturn -EINVAL;\n\n\tumem->address = (unsigned long)addr;\n\tumem->chunk_mask = unaligned_chunks ? XSK_UNALIGNED_BUF_ADDR_MASK\n\t\t\t\t\t : ~((u64)chunk_size - 1);\n\tumem->size = size;\n\tumem->headroom = headroom;\n\tumem->chunk_size_nohr = chunk_size - headroom;\n\tumem->npgs = size / PAGE_SIZE;\n\tumem->pgs = NULL;\n\tumem->user = NULL;\n\tumem->flags = mr->flags;\n\tINIT_LIST_HEAD(&umem->xsk_list);\n\tspin_lock_init(&umem->xsk_list_lock);\n\n\trefcount_set(&umem->users, 1);\n\n\terr = xdp_umem_account_pages(umem);\n\tif (err)\n\t\treturn err;\n\n\terr = xdp_umem_pin_pages(umem);\n\tif (err)\n\t\tgoto out_account;\n\n\tumem->pages = kvcalloc(umem->npgs, sizeof(*umem->pages),\n\t\t\t GFP_KERNEL_ACCOUNT);\n\tif (!umem->pages) {\n\t\terr = -ENOMEM;\n\t\tgoto out_pin;\n\t}\n\n\terr = xdp_umem_map_pages(umem);\n\tif (!err)\n\t\treturn 0;\n\n\tkvfree(umem->pages);\n\nout_pin:\n\txdp_umem_unpin_pages(umem);\nout_account:\n\txdp_umem_unaccount_pages(umem);\n\treturn err;\n}","target":"static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)\n{\n\tbool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;\n\tu32 chunk_size = mr->chunk_size, headroom = mr->headroom;\n\tunsigned int chunks, chunks_per_page;\n\tu64 addr = mr->addr, size = mr->len;\n\tint err;\n\n\tif (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {\n\t\t/* Strictly speaking we could support this, if:\n\t\t * - huge pages, or*\n\t\t * - using an IOMMU, or\n\t\t * - making sure the memory area is consecutive\n\t\t * but for now, we simply say \"computer says no\".\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif (mr->flags & ~(XDP_UMEM_UNALIGNED_CHUNK_FLAG |\n\t\t\tXDP_UMEM_USES_NEED_WAKEUP))\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks && !is_power_of_2(chunk_size))\n\t\treturn -EINVAL;\n\n\tif (!PAGE_ALIGNED(addr)) {\n\t\t/* Memory area has to be page size aligned. For\n\t\t * simplicity, this might change.\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif ((addr + size) < addr)\n\t\treturn -EINVAL;\n\n\tchunks = (unsigned int)div_u64(size, chunk_size);\n\tif (chunks == 0)\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks) {\n\t\tchunks_per_page = PAGE_SIZE / chunk_size;\n\t\tif (chunks < chunks_per_page || chunks % chunks_per_page)\n\t\t\treturn -EINVAL;\n\t}\n\n\tif (headroom >= chunk_size - XDP_PACKET_HEADROOM)\n\t\treturn -EINVAL;\n\n\tumem->address = (unsigned long)addr;\n\tumem->chunk_mask = unaligned_chunks ? XSK_UNALIGNED_BUF_ADDR_MASK\n\t\t\t\t\t : ~((u64)chunk_size - 1);\n\tumem->size = size;\n\tumem->headroom = headroom;\n\tumem->chunk_size_nohr = chunk_size - headroom;\n\tumem->npgs = size / PAGE_SIZE;\n\tumem->pgs = NULL;\n\tumem->user = NULL;\n\tumem->flags = mr->flags;\n\tINIT_LIST_HEAD(&umem->xsk_list);\n\tspin_lock_init(&umem->xsk_list_lock);\n\n\trefcount_set(&umem->users, 1);\n\n\terr = xdp_umem_account_pages(umem);\n\tif (err)\n\t\treturn err;\n\n\terr = xdp_umem_pin_pages(umem);\n\tif (err)\n\t\tgoto out_account;\n\n\tumem->pages = kvcalloc(umem->npgs, sizeof(*umem->pages),\n\t\t\t GFP_KERNEL_ACCOUNT);\n\tif (!umem->pages) {\n\t\terr = -ENOMEM;\n\t\tgoto out_pin;\n\t}\n\n\terr = xdp_umem_map_pages(umem);\n\tif (!err)\n\t\treturn 0;\n\n\tkvfree(umem->pages);\n\nout_pin:\n\txdp_umem_unpin_pages(umem);\nout_account:\n\txdp_umem_unaccount_pages(umem);\n\treturn err;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"xdp_umem_reg","file_name":"net/xdp/xdp_umem.c","commit_link":"github.com/torvalds/linux/commit/99e3a236dd43d06c65af0a2ef9cb44306aef6e02","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#15-b8122127aa08","input":"void gps_tracker( void )\n{\n\tssize_t unused;\n int gpsd_sock;\n char line[256], *temp;\n struct sockaddr_in gpsd_addr;\n int ret, is_json, pos;\n fd_set read_fd;\n struct timeval timeout;\n\n /* attempt to connect to localhost, port 2947 */\n\n pos = 0;\n gpsd_sock = socket( AF_INET, SOCK_STREAM, 0 );\n\n if( gpsd_sock < 0 ) {\n return;\n }\n\n gpsd_addr.sin_family = AF_INET;\n gpsd_addr.sin_port = htons( 2947 );\n gpsd_addr.sin_addr.s_addr = inet_addr( \"127.0.0.1\" );\n\n if( connect( gpsd_sock, (struct sockaddr *) &gpsd_addr,\n sizeof( gpsd_addr ) ) < 0 ) {\n return;\n }\n\n // Check if it's GPSd < 2.92 or the new one\n // 2.92+ immediately send stuff\n // < 2.92 requires to send PVTAD command\n FD_ZERO(&read_fd);\n FD_SET(gpsd_sock, &read_fd);\n timeout.tv_sec = 1;\n timeout.tv_usec = 0;\n is_json = select(gpsd_sock + 1, &read_fd, NULL, NULL, &timeout);\n if (is_json) {\n \t/*\n\t\t\t{\"class\":\"VERSION\",\"release\":\"2.95\",\"rev\":\"2010-11-16T21:12:35\",\"proto_major\":3,\"proto_minor\":3}\n\t\t\t?WATCH={\"json\":true};\n\t\t\t{\"class\":\"DEVICES\",\"devices\":[]}\n \t */\n\n\n \t// Get the crap and ignore it: {\"class\":\"VERSION\",\"release\":\"2.95\",\"rev\":\"2010-11-16T21:12:35\",\"proto_major\":3,\"proto_minor\":3}\n \tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n \t\treturn;\n\n \tis_json = (line[0] == '{');\n \tif (is_json) {\n\t\t\t// Send ?WATCH={\"json\":true};\n\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\tstrcpy(line, \"?WATCH={\\\"json\\\":true};\\n\");\n\t\t\tif( send( gpsd_sock, line, 22, 0 ) != 22 )\n\t\t\t\treturn;\n\n\t\t\t// Check that we have devices\n\t\t\tmemset(line, 0, sizeof(line));\n\t\t\tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n\t\t\t\treturn;\n\n\t\t\t// Stop processing if there is no device\n\t\t\tif (strncmp(line, \"{\\\"class\\\":\\\"DEVICES\\\",\\\"devices\\\":[]}\", 32) == 0) {\n\t\t\t\tclose(gpsd_sock);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tpos = strlen(line);\n\t\t\t}\n \t}\n }\n\n /* loop reading the GPS coordinates */\n\n while( G.do_exit == 0 )\n {\n usleep( 500000 );\n memset( G.gps_loc, 0, sizeof( float ) * 5 );\n\n /* read position, speed, heading, altitude */\n if (is_json) {\n \t// Format definition: http://catb.org/gpsd/gpsd_json.html\n\n \tif (pos == sizeof( line )) {\n \t\tmemset(line, 0, sizeof(line));\n \t\tpos = 0;\n \t}\n\n \t// New version, JSON\n \tif( recv( gpsd_sock, line + pos, sizeof( line ) - 1, 0 ) <= 0 )\n \t\treturn;\n\n \t// search for TPV class: {\"class\":\"TPV\"\n \ttemp = strstr(line, \"{\\\"class\\\":\\\"TPV\\\"\");\n \tif (temp == NULL) {\n \t\tcontinue;\n \t}\n\n \t// Make sure the data we have is complete\n \tif (strchr(temp, '}') == NULL) {\n \t\t// Move the data at the beginning of the buffer;\n \t\tpos = strlen(temp);\n \t\tif (temp != line) {\n \t\t\tmemmove(line, temp, pos);\n \t\t\tmemset(line + pos, 0, sizeof(line) - pos);\n \t\t}\n \t}\n\n\t\t\t// Example line: {\"class\":\"TPV\",\"tag\":\"MID2\",\"device\":\"/dev/ttyUSB0\",\"time\":1350957517.000,\"ept\":0.005,\"lat\":46.878936576,\"lon\":-115.832602964,\"alt\":1968.382,\"track\":0.0000,\"speed\":0.000,\"climb\":0.000,\"mode\":3}\n\n \t// Latitude\n \ttemp = strstr(temp, \"\\\"lat\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[0]);\n\n\t\t\t// Longitude\n\t\t\ttemp = strstr(temp, \"\\\"lon\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[1]);\n\n\t\t\t// Altitude\n\t\t\ttemp = strstr(temp, \"\\\"alt\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[4]);\n\n\t\t\t// Speed\n\t\t\ttemp = strstr(temp, \"\\\"speed\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[2]);\n\n\t\t\t// No more heading\n\n\t\t\t// Get the next TPV class\n\t\t\ttemp = strstr(temp, \"{\\\"class\\\":\\\"TPV\\\"\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\t\tpos = 0;\n\t\t\t} else {\n\t\t\t\tpos = strlen(temp);\n\t\t\t\tmemmove(line, temp, pos);\n\t\t\t\tmemset(line + pos, 0, sizeof(line) - pos);\n\t\t\t}\n\n } else {\n \tmemset( line, 0, sizeof( line ) );\n\n\t\t\tsnprintf( line, sizeof( line ) - 1, \"PVTAD\\r\\n\" );\n\t\t\tif( send( gpsd_sock, line, 7, 0 ) != 7 )\n\t\t\t\treturn;\n\n\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n\t\t\t\treturn;\n\n\t\t\tif( memcmp( line, \"GPSD,P=\", 7 ) != 0 )\n\t\t\t\tcontinue;\n\n\t\t\t/* make sure the coordinates are present */\n\n\t\t\tif( line[7] == '?' )\n\t\t\t\tcontinue;\n\n\t\t\tret = sscanf( line + 7, \"%f %f\", &G.gps_loc[0], &G.gps_loc[1] );\n\n\t\t\tif( ( temp = strstr( line, \"V=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[2] ); /* speed */\n\n\t\t\tif( ( temp = strstr( line, \"T=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[3] ); /* heading */\n\n\t\t\tif( ( temp = strstr( line, \"A=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[4] ); /* altitude */\n }\n\n if (G.record_data)\n\t\t\tfputs( line, G.f_gps );\n\n\t\tG.save_gps = 1;\n\n if (G.do_exit == 0)\n\t\t{\n\t\t\tunused = write( G.gc_pipe[1], G.gps_loc, sizeof( float ) * 5 );\n\t\t\tkill( getppid(), SIGUSR2 );\n\t\t}\n }\n}","target":"void gps_tracker( void )\n{\n\tssize_t unused;\n int gpsd_sock;\n char line[256], *temp;\n struct sockaddr_in gpsd_addr;\n int ret, is_json, pos;\n fd_set read_fd;\n struct timeval timeout;\n\n /* attempt to connect to localhost, port 2947 */\n\n pos = 0;\n gpsd_sock = socket( AF_INET, SOCK_STREAM, 0 );\n\n if( gpsd_sock < 0 ) {\n return;\n }\n\n gpsd_addr.sin_family = AF_INET;\n gpsd_addr.sin_port = htons( 2947 );\n gpsd_addr.sin_addr.s_addr = inet_addr( \"127.0.0.1\" );\n\n if( connect( gpsd_sock, (struct sockaddr *) &gpsd_addr,\n sizeof( gpsd_addr ) ) < 0 ) {\n return;\n }\n\n // Check if it's GPSd < 2.92 or the new one\n // 2.92+ immediately send stuff\n // < 2.92 requires to send PVTAD command\n FD_ZERO(&read_fd);\n FD_SET(gpsd_sock, &read_fd);\n timeout.tv_sec = 1;\n timeout.tv_usec = 0;\n is_json = select(gpsd_sock + 1, &read_fd, NULL, NULL, &timeout);\n if (is_json) {\n \t/*\n\t\t\t{\"class\":\"VERSION\",\"release\":\"2.95\",\"rev\":\"2010-11-16T21:12:35\",\"proto_major\":3,\"proto_minor\":3}\n\t\t\t?WATCH={\"json\":true};\n\t\t\t{\"class\":\"DEVICES\",\"devices\":[]}\n \t */\n\n\n \t// Get the crap and ignore it: {\"class\":\"VERSION\",\"release\":\"2.95\",\"rev\":\"2010-11-16T21:12:35\",\"proto_major\":3,\"proto_minor\":3}\n \tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n \t\treturn;\n\n \tis_json = (line[0] == '{');\n \tif (is_json) {\n\t\t\t// Send ?WATCH={\"json\":true};\n\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\tstrcpy(line, \"?WATCH={\\\"json\\\":true};\\n\");\n\t\t\tif( send( gpsd_sock, line, 22, 0 ) != 22 )\n\t\t\t\treturn;\n\n\t\t\t// Check that we have devices\n\t\t\tmemset(line, 0, sizeof(line));\n\t\t\tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n\t\t\t\treturn;\n\n\t\t\t// Stop processing if there is no device\n\t\t\tif (strncmp(line, \"{\\\"class\\\":\\\"DEVICES\\\",\\\"devices\\\":[]}\", 32) == 0) {\n\t\t\t\tclose(gpsd_sock);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tpos = strlen(line);\n\t\t\t}\n \t}\n }\n\n /* loop reading the GPS coordinates */\n\n while( G.do_exit == 0 )\n {\n usleep( 500000 );\n memset( G.gps_loc, 0, sizeof( float ) * 5 );\n\n /* read position, speed, heading, altitude */\n if (is_json) {\n \t// Format definition: http://catb.org/gpsd/gpsd_json.html\n\n \tif (pos == sizeof( line )) {\n \t\tmemset(line, 0, sizeof(line));\n \t\tpos = 0;\n \t}\n\n \t// New version, JSON\n \tif( recv( gpsd_sock, line + pos, sizeof( line ) - pos - 1, 0 ) <= 0 )\n \t\treturn;\n\n \t// search for TPV class: {\"class\":\"TPV\"\n \ttemp = strstr(line, \"{\\\"class\\\":\\\"TPV\\\"\");\n \tif (temp == NULL) {\n \t\tcontinue;\n \t}\n\n \t// Make sure the data we have is complete\n \tif (strchr(temp, '}') == NULL) {\n \t\t// Move the data at the beginning of the buffer;\n \t\tpos = strlen(temp);\n \t\tif (temp != line) {\n \t\t\tmemmove(line, temp, pos);\n \t\t\tmemset(line + pos, 0, sizeof(line) - pos);\n \t\t}\n \t}\n\n\t\t\t// Example line: {\"class\":\"TPV\",\"tag\":\"MID2\",\"device\":\"/dev/ttyUSB0\",\"time\":1350957517.000,\"ept\":0.005,\"lat\":46.878936576,\"lon\":-115.832602964,\"alt\":1968.382,\"track\":0.0000,\"speed\":0.000,\"climb\":0.000,\"mode\":3}\n\n \t// Latitude\n \ttemp = strstr(temp, \"\\\"lat\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[0]);\n\n\t\t\t// Longitude\n\t\t\ttemp = strstr(temp, \"\\\"lon\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[1]);\n\n\t\t\t// Altitude\n\t\t\ttemp = strstr(temp, \"\\\"alt\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[4]);\n\n\t\t\t// Speed\n\t\t\ttemp = strstr(temp, \"\\\"speed\\\":\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tret = sscanf(temp + 6, \"%f\", &G.gps_loc[2]);\n\n\t\t\t// No more heading\n\n\t\t\t// Get the next TPV class\n\t\t\ttemp = strstr(temp, \"{\\\"class\\\":\\\"TPV\\\"\");\n\t\t\tif (temp == NULL) {\n\t\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\t\tpos = 0;\n\t\t\t} else {\n\t\t\t\tpos = strlen(temp);\n\t\t\t\tmemmove(line, temp, pos);\n\t\t\t\tmemset(line + pos, 0, sizeof(line) - pos);\n\t\t\t}\n\n } else {\n \tmemset( line, 0, sizeof( line ) );\n\n\t\t\tsnprintf( line, sizeof( line ) - 1, \"PVTAD\\r\\n\" );\n\t\t\tif( send( gpsd_sock, line, 7, 0 ) != 7 )\n\t\t\t\treturn;\n\n\t\t\tmemset( line, 0, sizeof( line ) );\n\t\t\tif( recv( gpsd_sock, line, sizeof( line ) - 1, 0 ) <= 0 )\n\t\t\t\treturn;\n\n\t\t\tif( memcmp( line, \"GPSD,P=\", 7 ) != 0 )\n\t\t\t\tcontinue;\n\n\t\t\t/* make sure the coordinates are present */\n\n\t\t\tif( line[7] == '?' )\n\t\t\t\tcontinue;\n\n\t\t\tret = sscanf( line + 7, \"%f %f\", &G.gps_loc[0], &G.gps_loc[1] );\n\n\t\t\tif( ( temp = strstr( line, \"V=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[2] ); /* speed */\n\n\t\t\tif( ( temp = strstr( line, \"T=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[3] ); /* heading */\n\n\t\t\tif( ( temp = strstr( line, \"A=\" ) ) == NULL ) continue;\n\t\t\tret = sscanf( temp + 2, \"%f\", &G.gps_loc[4] ); /* altitude */\n }\n\n if (G.record_data)\n\t\t\tfputs( line, G.f_gps );\n\n\t\tG.save_gps = 1;\n\n if (G.do_exit == 0)\n\t\t{\n\t\t\tunused = write( G.gc_pipe[1], G.gps_loc, sizeof( float ) * 5 );\n\t\t\tkill( getppid(), SIGUSR2 );\n\t\t}\n }\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"gps_tracker","file_name":"src/airodump-ng.c","commit_link":"github.com/aircrack-ng/aircrack-ng/commit/ff70494dd389ba570dbdbf36f217c28d4381c6b5/","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#16-a9d906d18163","input":"int tcp_test(const char* ip_str, const short port)\n{\n int sock, i;\n struct sockaddr_in s_in;\n int packetsize = 1024;\n unsigned char packet[packetsize];\n struct timeval tv, tv2, tv3;\n int caplen = 0;\n int times[REQUESTS];\n int min, avg, max, len;\n struct net_hdr nh;\n\n tv3.tv_sec=0;\n tv3.tv_usec=1;\n\n s_in.sin_family = PF_INET;\n s_in.sin_port = htons(port);\n if (!inet_aton(ip_str, &s_in.sin_addr))\n return -1;\n\n if ((sock = socket(s_in.sin_family, SOCK_STREAM, IPPROTO_TCP)) == -1)\n return -1;\n\n /* avoid blocking on reading the socket */\n if( fcntl( sock, F_SETFL, O_NONBLOCK ) < 0 )\n {\n perror( \"fcntl(O_NONBLOCK) failed\" );\n return( 1 );\n }\n\n gettimeofday( &tv, NULL );\n\n while (1) //waiting for relayed packet\n {\n if (connect(sock, (struct sockaddr*) &s_in, sizeof(s_in)) == -1)\n {\n if(errno != EINPROGRESS && errno != EALREADY)\n {\n perror(\"connect\");\n close(sock);\n\n printf(\"Failed to connect\\n\");\n\n return -1;\n }\n }\n else\n {\n gettimeofday( &tv2, NULL );\n break;\n }\n\n gettimeofday( &tv2, NULL );\n //wait 3000ms for a successful connect\n if (((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec)) > (3000*1000))\n {\n printf(\"Connection timed out\\n\");\n close(sock);\n return(-1);\n }\n usleep(10);\n }\n\n PCT; printf(\"TCP connection successful\\n\");\n\n //trying to identify airserv-ng\n memset(&nh, 0, sizeof(nh));\n// command: GET_CHAN\n nh.nh_type\t= 2;\n nh.nh_len\t= htonl(0);\n\n if (send(sock, &nh, sizeof(nh), 0) != sizeof(nh))\n {\n perror(\"send\");\n return -1;\n }\n\n gettimeofday( &tv, NULL );\n i=0;\n\n while (1) //waiting for GET_CHAN answer\n {\n caplen = read(sock, &nh, sizeof(nh));\n\n if(caplen == -1)\n {\n if( errno != EAGAIN )\n {\n perror(\"read\");\n return -1;\n }\n }\n\n if( (unsigned)caplen == sizeof(nh))\n {\n len = ntohl(nh.nh_len);\n if( nh.nh_type == 1 && i==0 )\n {\n i=1;\n caplen = read(sock, packet, len);\n if(caplen == len)\n {\n i=2;\n break;\n }\n else\n {\n i=0;\n }\n }\n else\n {\n caplen = read(sock, packet, len);\n }\n }\n\n gettimeofday( &tv2, NULL );\n //wait 1000ms for an answer\n if (((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec)) > (1000*1000))\n {\n break;\n }\n if(caplen == -1)\n usleep(10);\n }\n\n if(i==2)\n {\n PCT; printf(\"airserv-ng found\\n\");\n }\n else\n {\n PCT; printf(\"airserv-ng NOT found\\n\");\n }\n\n close(sock);\n\n for(i=0; i (1000*1000))\n {\n break;\n }\n //simple \"high-precision\" usleep\n select(1, NULL, NULL, NULL, &tv3);\n }\n times[i] = ((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec));\n printf( \"\\r%d/%d\\r\", i, REQUESTS);\n fflush(stdout);\n close(sock);\n }\n\n min = INT_MAX;\n avg = 0;\n max = 0;\n\n for(i=0; i max) max = times[i];\n avg += times[i];\n }\n avg /= REQUESTS;\n\n PCT; printf(\"ping %s:%d (min/avg/max): %.3fms/%.3fms/%.3fms\\n\", ip_str, port, min/1000.0, avg/1000.0, max/1000.0);\n\n return 0;\n}","target":"int tcp_test(const char* ip_str, const short port)\n{\n int sock, i;\n struct sockaddr_in s_in;\n int packetsize = 1024;\n unsigned char packet[packetsize];\n struct timeval tv, tv2, tv3;\n int caplen = 0;\n int times[REQUESTS];\n int min, avg, max, len;\n struct net_hdr nh;\n\n tv3.tv_sec=0;\n tv3.tv_usec=1;\n\n s_in.sin_family = PF_INET;\n s_in.sin_port = htons(port);\n if (!inet_aton(ip_str, &s_in.sin_addr))\n return -1;\n\n if ((sock = socket(s_in.sin_family, SOCK_STREAM, IPPROTO_TCP)) == -1)\n return -1;\n\n /* avoid blocking on reading the socket */\n if( fcntl( sock, F_SETFL, O_NONBLOCK ) < 0 )\n {\n perror( \"fcntl(O_NONBLOCK) failed\" );\n return( 1 );\n }\n\n gettimeofday( &tv, NULL );\n\n while (1) //waiting for relayed packet\n {\n if (connect(sock, (struct sockaddr*) &s_in, sizeof(s_in)) == -1)\n {\n if(errno != EINPROGRESS && errno != EALREADY)\n {\n perror(\"connect\");\n close(sock);\n\n printf(\"Failed to connect\\n\");\n\n return -1;\n }\n }\n else\n {\n gettimeofday( &tv2, NULL );\n break;\n }\n\n gettimeofday( &tv2, NULL );\n //wait 3000ms for a successful connect\n if (((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec)) > (3000*1000))\n {\n printf(\"Connection timed out\\n\");\n close(sock);\n return(-1);\n }\n usleep(10);\n }\n\n PCT; printf(\"TCP connection successful\\n\");\n\n //trying to identify airserv-ng\n memset(&nh, 0, sizeof(nh));\n// command: GET_CHAN\n nh.nh_type\t= 2;\n nh.nh_len\t= htonl(0);\n\n if (send(sock, &nh, sizeof(nh), 0) != sizeof(nh))\n {\n perror(\"send\");\n return -1;\n }\n\n gettimeofday( &tv, NULL );\n i=0;\n\n while (1) //waiting for GET_CHAN answer\n {\n caplen = read(sock, &nh, sizeof(nh));\n\n if(caplen == -1)\n {\n if( errno != EAGAIN )\n {\n perror(\"read\");\n return -1;\n }\n }\n\n if( (unsigned)caplen == sizeof(nh))\n {\n len = ntohl(nh.nh_len);\n if (len > 1024 || len < 0)\n continue;\n if( nh.nh_type == 1 && i==0 )\n {\n i=1;\n caplen = read(sock, packet, len);\n if(caplen == len)\n {\n i=2;\n break;\n }\n else\n {\n i=0;\n }\n }\n else\n {\n caplen = read(sock, packet, len);\n }\n }\n\n gettimeofday( &tv2, NULL );\n //wait 1000ms for an answer\n if (((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec)) > (1000*1000))\n {\n break;\n }\n if(caplen == -1)\n usleep(10);\n }\n\n if(i==2)\n {\n PCT; printf(\"airserv-ng found\\n\");\n }\n else\n {\n PCT; printf(\"airserv-ng NOT found\\n\");\n }\n\n close(sock);\n\n for(i=0; i (1000*1000))\n {\n break;\n }\n //simple \"high-precision\" usleep\n select(1, NULL, NULL, NULL, &tv3);\n }\n times[i] = ((tv2.tv_sec*1000000 - tv.tv_sec*1000000) + (tv2.tv_usec - tv.tv_usec));\n printf( \"\\r%d/%d\\r\", i, REQUESTS);\n fflush(stdout);\n close(sock);\n }\n\n min = INT_MAX;\n avg = 0;\n max = 0;\n\n for(i=0; i max) max = times[i];\n avg += times[i];\n }\n avg /= REQUESTS;\n\n PCT; printf(\"ping %s:%d (min/avg/max): %.3fms/%.3fms/%.3fms\\n\", ip_str, port, min/1000.0, avg/1000.0, max/1000.0);\n\n return 0;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"tcp_test","file_name":"src/aireplay-ng.c","commit_link":"github.com/aircrack-ng/aircrack-ng/commit/091b153f294b9b695b0b2831e65936438b550d7b","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#17-ad3ac11840a9","input":"mapi_attr_read (size_t len, unsigned char *buf)\n{\n size_t idx = 0;\n uint32 i,j;\n assert(len > 4);\n uint32 num_properties = GETINT32(buf+idx);\n MAPI_Attr** attrs = CHECKED_XMALLOC (MAPI_Attr*, (num_properties + 1));\n\n idx += 4;\n\n if (!attrs) return NULL;\n for (i = 0; i < num_properties; i++)\n {\n\tMAPI_Attr* a = attrs[i] = CHECKED_XCALLOC(MAPI_Attr, 1);\n\tMAPI_Value* v = NULL;\n\n\tCHECKINT16(idx, len); a->type = GETINT16(buf+idx); idx += 2;\n\tCHECKINT16(idx, len); a->name = GETINT16(buf+idx); idx += 2;\n\n\t/* handle special case of GUID prefixed properties */\n\tif (a->name & GUID_EXISTS_FLAG)\n\t{\n\t /* copy GUID */\n\t a->guid = CHECKED_XMALLOC(GUID, 1);\n\t copy_guid_from_buf(a->guid, buf+idx, len);\n\t idx += sizeof (GUID);\n\n\t CHECKINT32(idx, len); a->num_names = GETINT32(buf+idx); idx += 4;\n\t if (a->num_names > 0)\n\t {\n\t\t/* FIXME: do something useful here! */\n\t\tsize_t i;\n\n\t\ta->names = CHECKED_XCALLOC(VarLenData, a->num_names);\n\n\t\tfor (i = 0; i < a->num_names; i++)\n\t\t{\n\t\t size_t j;\n\n\t\t CHECKINT32(idx, len); a->names[i].len = GETINT32(buf+idx); idx += 4;\n\n\t\t /* read the data into a buffer */\n\t\t a->names[i].data \n\t\t\t= CHECKED_XMALLOC(unsigned char, a->names[i].len);\n\t\t for (j = 0; j < (a->names[i].len >> 1); j++)\n\t\t\ta->names[i].data[j] = (buf+idx)[j*2];\n\n\t\t /* But what are we going to do with it? */\n\t\t \n\t\t idx += pad_to_4byte(a->names[i].len);\n\t\t}\n\t }\n\t else\n\t {\n\t\t/* get the 'real' name */\n\t\tCHECKINT32(idx, len); a->name = GETINT32(buf+idx); idx+= 4;\n\t }\n\t}\n\n\t/* \n\t * Multi-value types and string/object/binary types have\n\t * multiple values \n\t */\n\tif (a->type & MULTI_VALUE_FLAG ||\n\t a->type == szMAPI_STRING ||\n\t a->type == szMAPI_UNICODE_STRING ||\n\t a->type == szMAPI_OBJECT ||\n\t a->type == szMAPI_BINARY)\n\t{\n\t CHECKINT32(idx, len); a->num_values = GETINT32(buf+idx);\n\t idx += 4;\n\t}\n else\n {\n\t a->num_values = 1;\n }\n\n\t/* Amend the type in case of multi-value type */\n\tif (a->type & MULTI_VALUE_FLAG)\n\t{\n\t a->type -= MULTI_VALUE_FLAG;\n\t}\n\n\n\tv = alloc_mapi_values (a);\n\n\tfor (j = 0; j < a->num_values; j++) \n\t{\n\t switch (a->type)\n\t {\n\t case szMAPI_SHORT:\t/* 2 bytes */\n\t\tv->len = 2;\n\t\tCHECKINT16(idx, len); v->data.bytes2 = GETINT16(buf+idx);\n\t\tidx += 4;\t/* assume padding of 2, advance by 4! */\n\t\tbreak;\n\n\t case szMAPI_INT:\t/* 4 bytes */\n\t\tv->len = 4;\n\t\tCHECKINT32(idx, len); v->data.bytes4 = GETINT32(buf+idx);\n\t\tidx += 4;\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_FLOAT:\t/* 4 bytes */\n\t case szMAPI_BOOLEAN: /* this should be 2 bytes + 2 padding */\n\t\tv->len = 4;\n\t\tCHECKINT32(idx, len); v->data.bytes4 = GETINT32(buf+idx);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_SYSTIME: /* 8 bytes */\n\t\tv->len = 8;\n\t\tCHECKINT32(idx, len); v->data.bytes8[0] = GETINT32(buf+idx);\n\t\tCHECKINT32(idx+4, len); v->data.bytes8[1] = GETINT32(buf+idx+4);\n\t\tidx += 8;\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_DOUBLE:\t/* 8 bytes */\n\t case szMAPI_APPTIME:\n\t case szMAPI_CURRENCY:\n\t case szMAPI_INT8BYTE:\n\t\tv->len = 8;\n\t\tCHECKINT32(idx, len); v->data.bytes8[0] = GETINT32(buf+idx);\n\t\tCHECKINT32(idx+4, len); v->data.bytes8[1] = GETINT32(buf+idx+4);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_CLSID:\n\t\tv->len = sizeof (GUID);\n\t\tcopy_guid_from_buf(&v->data.guid, buf+idx, len);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_STRING:\n\t case szMAPI_UNICODE_STRING:\n\t case szMAPI_OBJECT:\n\t case szMAPI_BINARY:\n\t\tCHECKINT32(idx, len); v->len = GETINT32(buf+idx); idx += 4;\n\n\t\tif (a->type == szMAPI_UNICODE_STRING)\n\t\t{\n\t\t v->data.buf = (unsigned char*)unicode_to_utf8(v->len, buf+idx);\n\t\t}\n\t\telse\n\t\t{\n\t\t v->data.buf = CHECKED_XMALLOC(unsigned char, v->len);\n\t\t memmove (v->data.buf, buf+idx, v->len);\n\t\t}\n\n\t\tidx += pad_to_4byte(v->len);\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_NULL:\t/* illegal in input tnef streams */\n\t case szMAPI_ERROR:\n\t case szMAPI_UNSPECIFIED:\n\t\tfprintf (stderr,\n\t\t\t \"Invalid attribute, input file may be corrupted\\n\");\n\t\tif (!ENCODE_SKIP) exit (1);\n\n\t\treturn NULL;\n\n\t default:\t\t/* should never get here */\n\t\tfprintf (stderr,\n\t\t\t \"Undefined attribute, input file may be corrupted\\n\");\n\t\tif (!ENCODE_SKIP) exit (1);\n\n\t\treturn NULL;\n\n\t }\n\t if (DEBUG_ON) mapi_attr_dump (attrs[i]);\n\t}\n }\n attrs[i] = NULL;\n\n return attrs;\n}","target":"mapi_attr_read (size_t len, unsigned char *buf)\n{\n size_t idx = 0;\n uint32 i,j;\n assert(len > 4);\n uint32 num_properties = GETINT32(buf+idx);\n assert((num_properties+1) != 0);\n MAPI_Attr** attrs = CHECKED_XMALLOC (MAPI_Attr*, (num_properties + 1));\n\n idx += 4;\n\n if (!attrs) return NULL;\n for (i = 0; i < num_properties; i++)\n {\n\tMAPI_Attr* a = attrs[i] = CHECKED_XCALLOC(MAPI_Attr, 1);\n\tMAPI_Value* v = NULL;\n\n\tCHECKINT16(idx, len); a->type = GETINT16(buf+idx); idx += 2;\n\tCHECKINT16(idx, len); a->name = GETINT16(buf+idx); idx += 2;\n\n\t/* handle special case of GUID prefixed properties */\n\tif (a->name & GUID_EXISTS_FLAG)\n\t{\n\t /* copy GUID */\n\t a->guid = CHECKED_XMALLOC(GUID, 1);\n\t copy_guid_from_buf(a->guid, buf+idx, len);\n\t idx += sizeof (GUID);\n\n\t CHECKINT32(idx, len); a->num_names = GETINT32(buf+idx); idx += 4;\n\t if (a->num_names > 0)\n\t {\n\t\t/* FIXME: do something useful here! */\n\t\tsize_t i;\n\n\t\ta->names = CHECKED_XCALLOC(VarLenData, a->num_names);\n\n\t\tfor (i = 0; i < a->num_names; i++)\n\t\t{\n\t\t size_t j;\n\n\t\t CHECKINT32(idx, len); a->names[i].len = GETINT32(buf+idx); idx += 4;\n\n\t\t /* read the data into a buffer */\n\t\t a->names[i].data \n\t\t\t= CHECKED_XMALLOC(unsigned char, a->names[i].len);\n\t\t assert((idx+(a->names[i].len*2)) <= len);\n\t\t for (j = 0; j < (a->names[i].len >> 1); j++)\n\t\t\ta->names[i].data[j] = (buf+idx)[j*2];\n\n\t\t /* But what are we going to do with it? */\n\t\t \n\t\t idx += pad_to_4byte(a->names[i].len);\n\t\t}\n\t }\n\t else\n\t {\n\t\t/* get the 'real' name */\n\t\tCHECKINT32(idx, len); a->name = GETINT32(buf+idx); idx+= 4;\n\t }\n\t}\n\n\t/* \n\t * Multi-value types and string/object/binary types have\n\t * multiple values \n\t */\n\tif (a->type & MULTI_VALUE_FLAG ||\n\t a->type == szMAPI_STRING ||\n\t a->type == szMAPI_UNICODE_STRING ||\n\t a->type == szMAPI_OBJECT ||\n\t a->type == szMAPI_BINARY)\n\t{\n\t CHECKINT32(idx, len); a->num_values = GETINT32(buf+idx);\n\t idx += 4;\n\t}\n else\n {\n\t a->num_values = 1;\n }\n\n\t/* Amend the type in case of multi-value type */\n\tif (a->type & MULTI_VALUE_FLAG)\n\t{\n\t a->type -= MULTI_VALUE_FLAG;\n\t}\n\n\n\tv = alloc_mapi_values (a);\n\n\tfor (j = 0; j < a->num_values; j++) \n\t{\n\t switch (a->type)\n\t {\n\t case szMAPI_SHORT:\t/* 2 bytes */\n\t\tv->len = 2;\n\t\tCHECKINT16(idx, len); v->data.bytes2 = GETINT16(buf+idx);\n\t\tidx += 4;\t/* assume padding of 2, advance by 4! */\n\t\tbreak;\n\n\t case szMAPI_INT:\t/* 4 bytes */\n\t\tv->len = 4;\n\t\tCHECKINT32(idx, len); v->data.bytes4 = GETINT32(buf+idx);\n\t\tidx += 4;\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_FLOAT:\t/* 4 bytes */\n\t case szMAPI_BOOLEAN: /* this should be 2 bytes + 2 padding */\n\t\tv->len = 4;\n\t\tCHECKINT32(idx, len); v->data.bytes4 = GETINT32(buf+idx);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_SYSTIME: /* 8 bytes */\n\t\tv->len = 8;\n\t\tCHECKINT32(idx, len); v->data.bytes8[0] = GETINT32(buf+idx);\n\t\tCHECKINT32(idx+4, len); v->data.bytes8[1] = GETINT32(buf+idx+4);\n\t\tidx += 8;\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_DOUBLE:\t/* 8 bytes */\n\t case szMAPI_APPTIME:\n\t case szMAPI_CURRENCY:\n\t case szMAPI_INT8BYTE:\n\t\tv->len = 8;\n\t\tCHECKINT32(idx, len); v->data.bytes8[0] = GETINT32(buf+idx);\n\t\tCHECKINT32(idx+4, len); v->data.bytes8[1] = GETINT32(buf+idx+4);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_CLSID:\n\t\tv->len = sizeof (GUID);\n\t\tcopy_guid_from_buf(&v->data.guid, buf+idx, len);\n\t\tidx += v->len;\n\t\tbreak;\n\n\t case szMAPI_STRING:\n\t case szMAPI_UNICODE_STRING:\n\t case szMAPI_OBJECT:\n\t case szMAPI_BINARY:\n\t\tCHECKINT32(idx, len); v->len = GETINT32(buf+idx); idx += 4;\n\n\t\tassert(v->len + idx <= len);\n\n\t\tif (a->type == szMAPI_UNICODE_STRING)\n\t\t{\n\t\t assert(v->len != 0);\n\t\t v->data.buf = (unsigned char*)unicode_to_utf8(v->len, buf+idx);\n\t\t}\n\t\telse\n\t\t{\n\t\t v->data.buf = CHECKED_XMALLOC(unsigned char, v->len);\n\t\t memmove (v->data.buf, buf+idx, v->len);\n\t\t}\n\n\t\tidx += pad_to_4byte(v->len);\n\t\tv++;\n\t\tbreak;\n\n\t case szMAPI_NULL:\t/* illegal in input tnef streams */\n\t case szMAPI_ERROR:\n\t case szMAPI_UNSPECIFIED:\n\t\tfprintf (stderr,\n\t\t\t \"Invalid attribute, input file may be corrupted\\n\");\n\t\tif (!ENCODE_SKIP) exit (1);\n\n\t\treturn NULL;\n\n\t default:\t\t/* should never get here */\n\t\tfprintf (stderr,\n\t\t\t \"Undefined attribute, input file may be corrupted\\n\");\n\t\tif (!ENCODE_SKIP) exit (1);\n\n\t\treturn NULL;\n\n\t }\n\t if (DEBUG_ON) mapi_attr_dump (attrs[i]);\n\t}\n }\n attrs[i] = NULL;\n\n return attrs;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"mapi_attr_read","file_name":"src/mapi_attr.c","commit_link":"github.com/verdammelt/tnef/commit/1a17af1ed0c791aec44dbdc9eab91218cc1e335a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#18-825667bd2f54","input":"static size_t WritePSDChannel(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n const QuantumType quantum_type, unsigned char *compact_pixels,\n MagickOffsetType size_offset,const MagickBooleanType separate,\n ExceptionInfo *exception)\n{\n int\n y;\n\n MagickBooleanType\n monochrome;\n\n QuantumInfo\n *quantum_info;\n\n register const Quantum\n *p;\n\n register ssize_t\n i;\n\n size_t\n count,\n length;\n\n unsigned char\n *pixels;\n\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n\n#define CHUNK 16384\n\n int\n flush,\n level;\n\n unsigned char\n *compressed_pixels;\n\n z_stream\n stream;\n\n compressed_pixels=(unsigned char *) NULL;\n flush=Z_NO_FLUSH;\n#endif\n count=0;\n if (separate != MagickFalse)\n {\n size_offset=TellBlob(image)+2;\n count+=WriteCompressionStart(psd_info,image,next_image,1);\n }\n if (next_image->depth > 8)\n next_image->depth=16;\n monochrome=IsImageMonochrome(image) && (image->depth == 1) ?\n MagickTrue : MagickFalse;\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n return(0);\n pixels=(unsigned char *) GetQuantumPixels(quantum_info);\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (next_image->compression == ZipCompression)\n {\n compressed_pixels=(unsigned char *) AcquireQuantumMemory(CHUNK,\n sizeof(*compressed_pixels));\n if (compressed_pixels == (unsigned char *) NULL)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n ResetMagickMemory(&stream,0,sizeof(stream));\n stream.data_type=Z_BINARY;\n level=Z_DEFAULT_COMPRESSION;\n if ((image_info->quality > 0 && image_info->quality < 10))\n level=(int) image_info->quality;\n if (deflateInit(&stream,level) != Z_OK)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n }\n#endif\n for (y=0; y < (ssize_t) next_image->rows; y++)\n {\n p=GetVirtualPixels(next_image,0,y,next_image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n length=ExportQuantumPixels(next_image,(CacheView *) NULL,quantum_info,\n quantum_type,pixels,exception);\n if (monochrome != MagickFalse)\n for (i=0; i < (ssize_t) length; i++)\n pixels[i]=(~pixels[i]);\n if (next_image->compression == RLECompression)\n {\n length=PSDPackbitsEncodeImage(image,length,pixels,compact_pixels,\n exception);\n count+=WriteBlob(image,length,compact_pixels);\n size_offset+=WritePSDOffset(psd_info,image,length,size_offset);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n else if (next_image->compression == ZipCompression)\n {\n stream.avail_in=(uInt) length;\n stream.next_in=(Bytef *) pixels;\n if (y == (ssize_t) next_image->rows-1)\n flush=Z_FINISH;\n do {\n stream.avail_out=(uInt) CHUNK;\n stream.next_out=(Bytef *) compressed_pixels;\n if (deflate(&stream,flush) == Z_STREAM_ERROR)\n break;\n length=(size_t) CHUNK-stream.avail_out;\n if (length > 0)\n count+=WriteBlob(image,length,compressed_pixels);\n } while (stream.avail_out == 0);\n }\n#endif\n else\n count+=WriteBlob(image,length,pixels);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (next_image->compression == ZipCompression)\n {\n (void) deflateEnd(&stream);\n compressed_pixels=(unsigned char *) RelinquishMagickMemory(\n compressed_pixels);\n }\n#endif\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(count);\n}","target":"static size_t WritePSDChannel(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n const QuantumType quantum_type, unsigned char *compact_pixels,\n MagickOffsetType size_offset,const MagickBooleanType separate,\n ExceptionInfo *exception)\n{\n int\n y;\n\n MagickBooleanType\n monochrome;\n\n QuantumInfo\n *quantum_info;\n\n register const Quantum\n *p;\n\n register ssize_t\n i;\n\n size_t\n count,\n length;\n\n unsigned char\n *pixels;\n\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n\n#define CHUNK 16384\n\n int\n flush,\n level;\n\n unsigned char\n *compressed_pixels;\n\n z_stream\n stream;\n\n compressed_pixels=(unsigned char *) NULL;\n flush=Z_NO_FLUSH;\n#endif\n count=0;\n if (separate != MagickFalse)\n {\n size_offset=TellBlob(image)+2;\n count+=WriteCompressionStart(psd_info,image,next_image,1);\n }\n if (next_image->depth > 8)\n next_image->depth=16;\n monochrome=IsImageMonochrome(image) && (image->depth == 1) ?\n MagickTrue : MagickFalse;\n quantum_info=AcquireQuantumInfo(image_info,next_image);\n if (quantum_info == (QuantumInfo *) NULL)\n return(0);\n pixels=(unsigned char *) GetQuantumPixels(quantum_info);\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (next_image->compression == ZipCompression)\n {\n compressed_pixels=(unsigned char *) AcquireQuantumMemory(CHUNK,\n sizeof(*compressed_pixels));\n if (compressed_pixels == (unsigned char *) NULL)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n ResetMagickMemory(&stream,0,sizeof(stream));\n stream.data_type=Z_BINARY;\n level=Z_DEFAULT_COMPRESSION;\n if ((image_info->quality > 0 && image_info->quality < 10))\n level=(int) image_info->quality;\n if (deflateInit(&stream,level) != Z_OK)\n {\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(0);\n }\n }\n#endif\n for (y=0; y < (ssize_t) next_image->rows; y++)\n {\n p=GetVirtualPixels(next_image,0,y,next_image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n length=ExportQuantumPixels(next_image,(CacheView *) NULL,quantum_info,\n quantum_type,pixels,exception);\n if (monochrome != MagickFalse)\n for (i=0; i < (ssize_t) length; i++)\n pixels[i]=(~pixels[i]);\n if (next_image->compression == RLECompression)\n {\n length=PSDPackbitsEncodeImage(image,length,pixels,compact_pixels,\n exception);\n count+=WriteBlob(image,length,compact_pixels);\n size_offset+=WritePSDOffset(psd_info,image,length,size_offset);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n else if (next_image->compression == ZipCompression)\n {\n stream.avail_in=(uInt) length;\n stream.next_in=(Bytef *) pixels;\n if (y == (ssize_t) next_image->rows-1)\n flush=Z_FINISH;\n do {\n stream.avail_out=(uInt) CHUNK;\n stream.next_out=(Bytef *) compressed_pixels;\n if (deflate(&stream,flush) == Z_STREAM_ERROR)\n break;\n length=(size_t) CHUNK-stream.avail_out;\n if (length > 0)\n count+=WriteBlob(image,length,compressed_pixels);\n } while (stream.avail_out == 0);\n }\n#endif\n else\n count+=WriteBlob(image,length,pixels);\n }\n#ifdef MAGICKCORE_ZLIB_DELEGATE\n if (next_image->compression == ZipCompression)\n {\n (void) deflateEnd(&stream);\n compressed_pixels=(unsigned char *) RelinquishMagickMemory(\n compressed_pixels);\n }\n#endif\n quantum_info=DestroyQuantumInfo(quantum_info);\n return(count);\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"WritePSDChannel","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/91cc3f36f2ccbd485a0456bab9aebe63b635da88","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#19-a0a0ea5b4471","input":"int flb_gzip_compress(void *in_data, size_t in_len,\n void **out_data, size_t *out_len)\n{\n int flush;\n int status;\n int footer_start;\n uint8_t *pb;\n size_t out_size;\n void *out_buf;\n z_stream strm;\n mz_ulong crc;\n\n out_size = in_len + 32;\n out_buf = flb_malloc(out_size);\n if (!out_buf) {\n flb_errno();\n flb_error(\"[gzip] could not allocate outgoing buffer\");\n return -1;\n }\n\n /* Initialize streaming buffer context */\n memset(&strm, '\\0', sizeof(strm));\n strm.zalloc = Z_NULL;\n strm.zfree = Z_NULL;\n strm.opaque = Z_NULL;\n strm.next_in = in_data;\n strm.avail_in = in_len;\n strm.total_out = 0;\n\n /* Deflate mode */\n deflateInit2(&strm, Z_DEFAULT_COMPRESSION,\n Z_DEFLATED, -Z_DEFAULT_WINDOW_BITS, 9, Z_DEFAULT_STRATEGY);\n\n /*\n * Miniz don't support GZip format directly, instead we will:\n *\n * - append manual GZip magic bytes\n * - deflate raw content\n * - append manual CRC32 data\n */\n gzip_header(out_buf);\n\n /* Header offset */\n pb = (uint8_t *) out_buf + FLB_GZIP_HEADER_OFFSET;\n\n flush = Z_NO_FLUSH;\n while (1) {\n strm.next_out = pb + strm.total_out;\n strm.avail_out = out_size - (pb - (uint8_t *) out_buf);\n\n if (strm.avail_in == 0) {\n flush = Z_FINISH;\n }\n\n status = deflate(&strm, flush);\n if (status == Z_STREAM_END) {\n break;\n }\n else if (status != Z_OK) {\n deflateEnd(&strm);\n return -1;\n }\n }\n\n if (deflateEnd(&strm) != Z_OK) {\n flb_free(out_buf);\n return -1;\n }\n *out_len = strm.total_out;\n\n /* Construct the gzip checksum (CRC32 footer) */\n footer_start = FLB_GZIP_HEADER_OFFSET + *out_len;\n pb = (uint8_t *) out_buf + footer_start;\n\n crc = mz_crc32(MZ_CRC32_INIT, in_data, in_len);\n *pb++ = crc & 0xFF;\n *pb++ = (crc >> 8) & 0xFF;\n *pb++ = (crc >> 16) & 0xFF;\n *pb++ = (crc >> 24) & 0xFF;\n *pb++ = in_len & 0xFF;\n *pb++ = (in_len >> 8) & 0xFF;\n *pb++ = (in_len >> 16) & 0xFF;\n *pb++ = (in_len >> 24) & 0xFF;\n\n /* Set the real buffer size for the caller */\n *out_len += FLB_GZIP_HEADER_OFFSET + 8;\n *out_data = out_buf;\n\n return 0;\n}","target":"int flb_gzip_compress(void *in_data, size_t in_len,\n void **out_data, size_t *out_len)\n{\n int flush;\n int status;\n int footer_start;\n uint8_t *pb;\n size_t out_size;\n void *out_buf;\n z_stream strm;\n mz_ulong crc;\n\n\n /*\n * GZIP relies on an algorithm with worst-case expansion\n * of 5 bytes per 32KB data. This means we need to create a variable\n * length output, that depends on the input length.\n * See RFC 1951 for details.\n */\n int max_input_expansion = ((int)(in_len / 32000) + 1) * 5;\n\n /*\n * Max compressed size is equal to sum of:\n * 10 byte header\n * 8 byte foot\n * max input expansion\n * size of input\n */\n out_size = 10 + 8 + max_input_expansion + in_len;\n out_buf = flb_malloc(out_size);\n\n if (!out_buf) {\n flb_errno();\n flb_error(\"[gzip] could not allocate outgoing buffer\");\n return -1;\n }\n\n /* Initialize streaming buffer context */\n memset(&strm, '\\0', sizeof(strm));\n strm.zalloc = Z_NULL;\n strm.zfree = Z_NULL;\n strm.opaque = Z_NULL;\n strm.next_in = in_data;\n strm.avail_in = in_len;\n strm.total_out = 0;\n\n /* Deflate mode */\n deflateInit2(&strm, Z_DEFAULT_COMPRESSION,\n Z_DEFLATED, -Z_DEFAULT_WINDOW_BITS, 9, Z_DEFAULT_STRATEGY);\n\n /*\n * Miniz don't support GZip format directly, instead we will:\n *\n * - append manual GZip magic bytes\n * - deflate raw content\n * - append manual CRC32 data\n */\n gzip_header(out_buf);\n\n /* Header offset */\n pb = (uint8_t *) out_buf + FLB_GZIP_HEADER_OFFSET;\n\n flush = Z_NO_FLUSH;\n while (1) {\n strm.next_out = pb + strm.total_out;\n strm.avail_out = out_size - (pb - (uint8_t *) out_buf);\n\n if (strm.avail_in == 0) {\n flush = Z_FINISH;\n }\n\n status = deflate(&strm, flush);\n if (status == Z_STREAM_END) {\n break;\n }\n else if (status != Z_OK) {\n deflateEnd(&strm);\n return -1;\n }\n }\n\n if (deflateEnd(&strm) != Z_OK) {\n flb_free(out_buf);\n return -1;\n }\n *out_len = strm.total_out;\n\n /* Construct the gzip checksum (CRC32 footer) */\n footer_start = FLB_GZIP_HEADER_OFFSET + *out_len;\n pb = (uint8_t *) out_buf + footer_start;\n\n crc = mz_crc32(MZ_CRC32_INIT, in_data, in_len);\n *pb++ = crc & 0xFF;\n *pb++ = (crc >> 8) & 0xFF;\n *pb++ = (crc >> 16) & 0xFF;\n *pb++ = (crc >> 24) & 0xFF;\n *pb++ = in_len & 0xFF;\n *pb++ = (in_len >> 8) & 0xFF;\n *pb++ = (in_len >> 16) & 0xFF;\n *pb++ = (in_len >> 24) & 0xFF;\n\n /* Set the real buffer size for the caller */\n *out_len += FLB_GZIP_HEADER_OFFSET + 8;\n *out_data = out_buf;\n\n return 0;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"flb_gzip_compress","file_name":"src/flb_gzip.c","commit_link":"github.com/fluent/fluent-bit/commit/cadff53c093210404aed01c4cf586adb8caa07af","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#20-0a526cba418b","input":"sc_oberthur_read_file(struct sc_pkcs15_card *p15card, const char *in_path,\n\t\tunsigned char **out, size_t *out_len,\n\t\tint verify_pin)\n{\n\tstruct sc_context *ctx = p15card->card->ctx;\n\tstruct sc_card *card = p15card->card;\n\tstruct sc_file *file = NULL;\n\tstruct sc_path path;\n\tsize_t sz;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tif (!in_path || !out || !out_len)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, \"Cannot read oberthur file\");\n\n\tsc_log(ctx, \"read file '%s'; verify_pin:%i\", in_path, verify_pin);\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\tsc_format_path(in_path, &path);\n\trv = sc_select_file(card, &path, &file);\n\tif (rv != SC_SUCCESS) {\n\t\tsc_file_free(file);\n\t\tLOG_TEST_RET(ctx, rv, \"Cannot select oberthur file to read\");\n\t}\n\n\tif (file->ef_structure == SC_FILE_EF_TRANSPARENT)\n\t\tsz = file->size;\n\telse\n\t\tsz = (file->record_length + 2) * file->record_count;\n\n\t*out = calloc(sz, 1);\n\tif (*out == NULL) {\n\t\tsc_file_free(file);\n\t\tLOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, \"Cannot read oberthur file\");\n\t}\n\n\tif (file->ef_structure == SC_FILE_EF_TRANSPARENT) {\n\t\trv = sc_read_binary(card, 0, *out, sz, 0);\n\t}\n\telse\t{\n\t\tint rec;\n\t\tint offs = 0;\n\t\tint rec_len = file->record_length;\n\n\t\tfor (rec = 1; ; rec++) {\n\t\t\trv = sc_read_record(card, rec, *out + offs + 2, rec_len, SC_RECORD_BY_REC_NR);\n\t\t\tif (rv == SC_ERROR_RECORD_NOT_FOUND) {\n\t\t\t\trv = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (rv < 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\trec_len = rv;\n\n\t\t\t*(*out + offs) = 'R';\n\t\t\t*(*out + offs + 1) = rv;\n\n\t\t\toffs += rv + 2;\n\t\t}\n\n\t\tsz = offs;\n\t}\n\n\tsc_log(ctx, \"read oberthur file result %i\", rv);\n\tif (verify_pin && rv == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED) {\n\t\tstruct sc_pkcs15_object *objs[0x10], *pin_obj = NULL;\n\t\tconst struct sc_acl_entry *acl = sc_file_get_acl_entry(file, SC_AC_OP_READ);\n\t\tint ii;\n\n\t\trv = sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_AUTH_PIN, objs, 0x10);\n\t\tif (rv != SC_SUCCESS) {\n\t\t\tsc_file_free(file);\n\t\t\tLOG_TEST_RET(ctx, rv, \"Cannot read oberthur file: get AUTH objects error\");\n\t\t}\n\n\t\tfor (ii=0; iidata;\n\t\t\tsc_log(ctx, \"compare PIN/ACL refs:%i/%i, method:%i/%i\",\n\t\t\t\t\tauth_info->attrs.pin.reference, acl->key_ref, auth_info->auth_method, acl->method);\n\t\t\tif (auth_info->attrs.pin.reference == (int)acl->key_ref && auth_info->auth_method == (unsigned)acl->method) {\n\t\t\t\tpin_obj = objs[ii];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!pin_obj || !pin_obj->content.value) {\n\t\t\trv = SC_ERROR_SECURITY_STATUS_NOT_SATISFIED;\n\t\t}\n\t\telse {\n\t\t\trv = sc_pkcs15_verify_pin(p15card, pin_obj, pin_obj->content.value, pin_obj->content.len);\n\t\t\tif (!rv)\n\t\t\t\trv = sc_oberthur_read_file(p15card, in_path, out, out_len, 0);\n\t\t}\n\t};\n\n\tsc_file_free(file);\n\n\tif (rv < 0) {\n\t\tfree(*out);\n\t\t*out = NULL;\n\t\t*out_len = 0;\n\t}\n\n\t*out_len = sz;\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}","target":"sc_oberthur_read_file(struct sc_pkcs15_card *p15card, const char *in_path,\n\t\tunsigned char **out, size_t *out_len,\n\t\tint verify_pin)\n{\n\tstruct sc_context *ctx = p15card->card->ctx;\n\tstruct sc_card *card = p15card->card;\n\tstruct sc_file *file = NULL;\n\tstruct sc_path path;\n\tsize_t sz;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tif (!in_path || !out || !out_len)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, \"Cannot read oberthur file\");\n\n\tsc_log(ctx, \"read file '%s'; verify_pin:%i\", in_path, verify_pin);\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\tsc_format_path(in_path, &path);\n\trv = sc_select_file(card, &path, &file);\n\tif (rv != SC_SUCCESS) {\n\t\tsc_file_free(file);\n\t\tLOG_TEST_RET(ctx, rv, \"Cannot select oberthur file to read\");\n\t}\n\n\tif (file->ef_structure == SC_FILE_EF_TRANSPARENT)\n\t\tsz = file->size;\n\telse\n\t\tsz = (file->record_length + 2) * file->record_count;\n\n\t*out = calloc(sz, 1);\n\tif (*out == NULL) {\n\t\tsc_file_free(file);\n\t\tLOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, \"Cannot read oberthur file\");\n\t}\n\n\tif (file->ef_structure == SC_FILE_EF_TRANSPARENT) {\n\t\trv = sc_read_binary(card, 0, *out, sz, 0);\n\t}\n\telse\t{\n\t\tsize_t rec;\n\t\tsize_t offs = 0;\n\t\tsize_t rec_len = file->record_length;\n\n\t\tfor (rec = 1; ; rec++) {\n\t\t\tif (rec > file->record_count) {\n\t\t\t\trv = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\trv = sc_read_record(card, rec, *out + offs + 2, rec_len, SC_RECORD_BY_REC_NR);\n\t\t\tif (rv == SC_ERROR_RECORD_NOT_FOUND) {\n\t\t\t\trv = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (rv < 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\trec_len = rv;\n\n\t\t\t*(*out + offs) = 'R';\n\t\t\t*(*out + offs + 1) = rv;\n\n\t\t\toffs += rv + 2;\n\t\t}\n\n\t\tsz = offs;\n\t}\n\n\tsc_log(ctx, \"read oberthur file result %i\", rv);\n\tif (verify_pin && rv == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED) {\n\t\tstruct sc_pkcs15_object *objs[0x10], *pin_obj = NULL;\n\t\tconst struct sc_acl_entry *acl = sc_file_get_acl_entry(file, SC_AC_OP_READ);\n\t\tint ii;\n\n\t\trv = sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_AUTH_PIN, objs, 0x10);\n\t\tif (rv != SC_SUCCESS) {\n\t\t\tsc_file_free(file);\n\t\t\tLOG_TEST_RET(ctx, rv, \"Cannot read oberthur file: get AUTH objects error\");\n\t\t}\n\n\t\tfor (ii=0; iidata;\n\t\t\tsc_log(ctx, \"compare PIN/ACL refs:%i/%i, method:%i/%i\",\n\t\t\t\t\tauth_info->attrs.pin.reference, acl->key_ref, auth_info->auth_method, acl->method);\n\t\t\tif (auth_info->attrs.pin.reference == (int)acl->key_ref && auth_info->auth_method == (unsigned)acl->method) {\n\t\t\t\tpin_obj = objs[ii];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!pin_obj || !pin_obj->content.value) {\n\t\t\trv = SC_ERROR_SECURITY_STATUS_NOT_SATISFIED;\n\t\t}\n\t\telse {\n\t\t\trv = sc_pkcs15_verify_pin(p15card, pin_obj, pin_obj->content.value, pin_obj->content.len);\n\t\t\tif (!rv)\n\t\t\t\trv = sc_oberthur_read_file(p15card, in_path, out, out_len, 0);\n\t\t}\n\t};\n\n\tsc_file_free(file);\n\n\tif (rv < 0) {\n\t\tfree(*out);\n\t\t*out = NULL;\n\t\t*out_len = 0;\n\t}\n\n\t*out_len = sz;\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"sc_oberthur_read_file","file_name":"src/libopensc/pkcs15-oberthur.c","commit_link":"github.com/OpenSC/OpenSC/commit/6903aebfddc466d966c7b865fae34572bf3ed23e","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#21-7d71d71a0a22","input":"TfLiteStatus ResizeOutputTensor(TfLiteContext* context,\n const TfLiteTensor* data,\n const TfLiteTensor* segment_ids,\n TfLiteTensor* output) {\n int max_index = -1;\n const int segment_id_size = segment_ids->dims->data[0];\n if (segment_id_size > 0) {\n max_index = segment_ids->data.i32[segment_id_size - 1];\n }\n const int data_rank = NumDimensions(data);\n TfLiteIntArray* output_shape = TfLiteIntArrayCreate(NumDimensions(data));\n output_shape->data[0] = max_index + 1;\n for (int i = 1; i < data_rank; ++i) {\n output_shape->data[i] = data->dims->data[i];\n }\n return context->ResizeTensor(context, output, output_shape);\n}","target":"TfLiteStatus ResizeOutputTensor(TfLiteContext* context,\n const TfLiteTensor* data,\n const TfLiteTensor* segment_ids,\n TfLiteTensor* output) {\n // Segment ids should be of same cardinality as first input dimension and they\n // should be increasing by at most 1, from 0 (e.g., [0, 0, 1, 2, 3] is valid)\n const int segment_id_size = segment_ids->dims->data[0];\n TF_LITE_ENSURE_EQ(context, segment_id_size, data->dims->data[0]);\n int previous_segment_id = -1;\n for (int i = 0; i < segment_id_size; i++) {\n const int current_segment_id = GetTensorData(segment_ids)[i];\n if (i == 0) {\n TF_LITE_ENSURE_EQ(context, current_segment_id, 0);\n } else {\n int delta = current_segment_id - previous_segment_id;\n TF_LITE_ENSURE(context, delta == 0 || delta == 1);\n }\n previous_segment_id = current_segment_id;\n }\n\n const int max_index = previous_segment_id;\n\n const int data_rank = NumDimensions(data);\n TfLiteIntArray* output_shape = TfLiteIntArrayCreate(NumDimensions(data));\n output_shape->data[0] = max_index + 1;\n for (int i = 1; i < data_rank; ++i) {\n output_shape->data[i] = data->dims->data[i];\n }\n return context->ResizeTensor(context, output, output_shape);\n}","lang":"cpp","vul_type":"cwe-787","sven_meta":{"func_name":"tflite::ops::builtin::segment_sum::ResizeOutputTensor","file_name":"tensorflow/lite/kernels/segment_sum.cc","commit_link":"github.com/tensorflow/tensorflow/commit/204945b19e44b57906c9344c0d00120eeeae178a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#22-7485c08e0f2e","input":"int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,\n\t\t\t const struct host_cmd_ds_command *resp)\n{\n\tu8 *curr = (u8 *) &resp->params.get_wmm_status;\n\tuint16_t resp_len = le16_to_cpu(resp->size), tlv_len;\n\tint mask = IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK;\n\tbool valid = true;\n\n\tstruct mwifiex_ie_types_data *tlv_hdr;\n\tstruct mwifiex_ie_types_wmm_queue_status *tlv_wmm_qstatus;\n\tstruct ieee_types_wmm_parameter *wmm_param_ie = NULL;\n\tstruct mwifiex_wmm_ac_status *ac_status;\n\n\tmwifiex_dbg(priv->adapter, INFO,\n\t\t \"info: WMM: WMM_GET_STATUS cmdresp received: %d\\n\",\n\t\t resp_len);\n\n\twhile ((resp_len >= sizeof(tlv_hdr->header)) && valid) {\n\t\ttlv_hdr = (struct mwifiex_ie_types_data *) curr;\n\t\ttlv_len = le16_to_cpu(tlv_hdr->header.len);\n\n\t\tif (resp_len < tlv_len + sizeof(tlv_hdr->header))\n\t\t\tbreak;\n\n\t\tswitch (le16_to_cpu(tlv_hdr->header.type)) {\n\t\tcase TLV_TYPE_WMMQSTATUS:\n\t\t\ttlv_wmm_qstatus =\n\t\t\t\t(struct mwifiex_ie_types_wmm_queue_status *)\n\t\t\t\ttlv_hdr;\n\t\t\tmwifiex_dbg(priv->adapter, CMD,\n\t\t\t\t \"info: CMD_RESP: WMM_GET_STATUS:\\t\"\n\t\t\t\t \"QSTATUS TLV: %d, %d, %d\\n\",\n\t\t\t\t tlv_wmm_qstatus->queue_index,\n\t\t\t\t tlv_wmm_qstatus->flow_required,\n\t\t\t\t tlv_wmm_qstatus->disabled);\n\n\t\t\tac_status = &priv->wmm.ac_status[tlv_wmm_qstatus->\n\t\t\t\t\t\t\t queue_index];\n\t\t\tac_status->disabled = tlv_wmm_qstatus->disabled;\n\t\t\tac_status->flow_required =\n\t\t\t\t\t\ttlv_wmm_qstatus->flow_required;\n\t\t\tac_status->flow_created = tlv_wmm_qstatus->flow_created;\n\t\t\tbreak;\n\n\t\tcase WLAN_EID_VENDOR_SPECIFIC:\n\t\t\t/*\n\t\t\t * Point the regular IEEE IE 2 bytes into the Marvell IE\n\t\t\t * and setup the IEEE IE type and length byte fields\n\t\t\t */\n\n\t\t\twmm_param_ie =\n\t\t\t\t(struct ieee_types_wmm_parameter *) (curr +\n\t\t\t\t\t\t\t\t 2);\n\t\t\twmm_param_ie->vend_hdr.len = (u8) tlv_len;\n\t\t\twmm_param_ie->vend_hdr.element_id =\n\t\t\t\t\t\tWLAN_EID_VENDOR_SPECIFIC;\n\n\t\t\tmwifiex_dbg(priv->adapter, CMD,\n\t\t\t\t \"info: CMD_RESP: WMM_GET_STATUS:\\t\"\n\t\t\t\t \"WMM Parameter Set Count: %d\\n\",\n\t\t\t\t wmm_param_ie->qos_info_bitmap & mask);\n\n\t\t\tmemcpy((u8 *) &priv->curr_bss_params.bss_descriptor.\n\t\t\t wmm_ie, wmm_param_ie,\n\t\t\t wmm_param_ie->vend_hdr.len + 2);\n\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tvalid = false;\n\t\t\tbreak;\n\t\t}\n\n\t\tcurr += (tlv_len + sizeof(tlv_hdr->header));\n\t\tresp_len -= (tlv_len + sizeof(tlv_hdr->header));\n\t}\n\n\tmwifiex_wmm_setup_queue_priorities(priv, wmm_param_ie);\n\tmwifiex_wmm_setup_ac_downgrade(priv);\n\n\treturn 0;\n}","target":"int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,\n\t\t\t const struct host_cmd_ds_command *resp)\n{\n\tu8 *curr = (u8 *) &resp->params.get_wmm_status;\n\tuint16_t resp_len = le16_to_cpu(resp->size), tlv_len;\n\tint mask = IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK;\n\tbool valid = true;\n\n\tstruct mwifiex_ie_types_data *tlv_hdr;\n\tstruct mwifiex_ie_types_wmm_queue_status *tlv_wmm_qstatus;\n\tstruct ieee_types_wmm_parameter *wmm_param_ie = NULL;\n\tstruct mwifiex_wmm_ac_status *ac_status;\n\n\tmwifiex_dbg(priv->adapter, INFO,\n\t\t \"info: WMM: WMM_GET_STATUS cmdresp received: %d\\n\",\n\t\t resp_len);\n\n\twhile ((resp_len >= sizeof(tlv_hdr->header)) && valid) {\n\t\ttlv_hdr = (struct mwifiex_ie_types_data *) curr;\n\t\ttlv_len = le16_to_cpu(tlv_hdr->header.len);\n\n\t\tif (resp_len < tlv_len + sizeof(tlv_hdr->header))\n\t\t\tbreak;\n\n\t\tswitch (le16_to_cpu(tlv_hdr->header.type)) {\n\t\tcase TLV_TYPE_WMMQSTATUS:\n\t\t\ttlv_wmm_qstatus =\n\t\t\t\t(struct mwifiex_ie_types_wmm_queue_status *)\n\t\t\t\ttlv_hdr;\n\t\t\tmwifiex_dbg(priv->adapter, CMD,\n\t\t\t\t \"info: CMD_RESP: WMM_GET_STATUS:\\t\"\n\t\t\t\t \"QSTATUS TLV: %d, %d, %d\\n\",\n\t\t\t\t tlv_wmm_qstatus->queue_index,\n\t\t\t\t tlv_wmm_qstatus->flow_required,\n\t\t\t\t tlv_wmm_qstatus->disabled);\n\n\t\t\tac_status = &priv->wmm.ac_status[tlv_wmm_qstatus->\n\t\t\t\t\t\t\t queue_index];\n\t\t\tac_status->disabled = tlv_wmm_qstatus->disabled;\n\t\t\tac_status->flow_required =\n\t\t\t\t\t\ttlv_wmm_qstatus->flow_required;\n\t\t\tac_status->flow_created = tlv_wmm_qstatus->flow_created;\n\t\t\tbreak;\n\n\t\tcase WLAN_EID_VENDOR_SPECIFIC:\n\t\t\t/*\n\t\t\t * Point the regular IEEE IE 2 bytes into the Marvell IE\n\t\t\t * and setup the IEEE IE type and length byte fields\n\t\t\t */\n\n\t\t\twmm_param_ie =\n\t\t\t\t(struct ieee_types_wmm_parameter *) (curr +\n\t\t\t\t\t\t\t\t 2);\n\t\t\twmm_param_ie->vend_hdr.len = (u8) tlv_len;\n\t\t\twmm_param_ie->vend_hdr.element_id =\n\t\t\t\t\t\tWLAN_EID_VENDOR_SPECIFIC;\n\n\t\t\tmwifiex_dbg(priv->adapter, CMD,\n\t\t\t\t \"info: CMD_RESP: WMM_GET_STATUS:\\t\"\n\t\t\t\t \"WMM Parameter Set Count: %d\\n\",\n\t\t\t\t wmm_param_ie->qos_info_bitmap & mask);\n\n\t\t\tif (wmm_param_ie->vend_hdr.len + 2 >\n\t\t\t\tsizeof(struct ieee_types_wmm_parameter))\n\t\t\t\tbreak;\n\n\t\t\tmemcpy((u8 *) &priv->curr_bss_params.bss_descriptor.\n\t\t\t wmm_ie, wmm_param_ie,\n\t\t\t wmm_param_ie->vend_hdr.len + 2);\n\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tvalid = false;\n\t\t\tbreak;\n\t\t}\n\n\t\tcurr += (tlv_len + sizeof(tlv_hdr->header));\n\t\tresp_len -= (tlv_len + sizeof(tlv_hdr->header));\n\t}\n\n\tmwifiex_wmm_setup_queue_priorities(priv, wmm_param_ie);\n\tmwifiex_wmm_setup_ac_downgrade(priv);\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"mwifiex_ret_wmm_get_status","file_name":"drivers/net/wireless/marvell/mwifiex/wmm.c","commit_link":"github.com/torvalds/linux/commit/3a9b153c5591548612c3955c9600a98150c81875","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#23-df154c19bd19","input":"static PyObject* patch(PyObject* self, PyObject* args)\n{\n char *origData, *newData, *diffBlock, *extraBlock, *diffPtr, *extraPtr;\n Py_ssize_t origDataLength, newDataLength, diffBlockLength, extraBlockLength;\n PyObject *controlTuples, *tuple, *results;\n off_t oldpos, newpos, x, y, z;\n int i, j, numTuples;\n\n if (!PyArg_ParseTuple(args, \"s#nO!s#s#\",\n &origData, &origDataLength, &newDataLength,\n &PyList_Type, &controlTuples,\n &diffBlock, &diffBlockLength,\n &extraBlock, &extraBlockLength))\n return NULL;\n\n /* allocate the memory for the new data */\n newData = PyMem_Malloc(newDataLength + 1);\n if (!newData)\n return PyErr_NoMemory();\n\n oldpos = 0;\n newpos = 0;\n diffPtr = diffBlock;\n extraPtr = extraBlock;\n numTuples = PyList_GET_SIZE(controlTuples);\n for (i = 0; i < numTuples; i++) {\n tuple = PyList_GET_ITEM(controlTuples, i);\n if (!PyTuple_Check(tuple)) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_TypeError, \"expecting tuple\");\n return NULL;\n }\n if (PyTuple_GET_SIZE(tuple) != 3) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_TypeError, \"expecting tuple of size 3\");\n return NULL;\n }\n x = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 0));\n y = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 1));\n z = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 2));\n if (newpos + x > newDataLength ||\n diffPtr + x > diffBlock + diffBlockLength ||\n extraPtr + y > extraBlock + extraBlockLength) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_ValueError, \"corrupt patch (overflow)\");\n return NULL;\n }\n memcpy(newData + newpos, diffPtr, x);\n diffPtr += x;\n for (j = 0; j < x; j++)\n if ((oldpos + j >= 0) && (oldpos + j < origDataLength))\n newData[newpos + j] += origData[oldpos + j];\n newpos += x;\n oldpos += x;\n memcpy(newData + newpos, extraPtr, y);\n extraPtr += y;\n newpos += y;\n oldpos += z;\n }\n\n /* confirm that a valid patch was applied */\n if (newpos != newDataLength ||\n diffPtr != diffBlock + diffBlockLength ||\n extraPtr != extraBlock + extraBlockLength) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_ValueError, \"corrupt patch (underflow)\");\n return NULL;\n }\n\n results = PyBytes_FromStringAndSize(newData, newDataLength);\n PyMem_Free(newData);\n return results;\n}","target":"static PyObject* patch(PyObject* self, PyObject* args)\n{\n char *origData, *newData, *diffBlock, *extraBlock, *diffPtr, *extraPtr;\n Py_ssize_t origDataLength, newDataLength, diffBlockLength, extraBlockLength;\n PyObject *controlTuples, *tuple, *results;\n off_t oldpos, newpos, x, y, z;\n int i, j, numTuples;\n\n if (!PyArg_ParseTuple(args, \"s#nO!s#s#\",\n &origData, &origDataLength, &newDataLength,\n &PyList_Type, &controlTuples,\n &diffBlock, &diffBlockLength,\n &extraBlock, &extraBlockLength))\n return NULL;\n\n /* allocate the memory for the new data */\n newData = PyMem_Malloc(newDataLength + 1);\n if (!newData)\n return PyErr_NoMemory();\n\n oldpos = 0;\n newpos = 0;\n diffPtr = diffBlock;\n extraPtr = extraBlock;\n numTuples = PyList_GET_SIZE(controlTuples);\n for (i = 0; i < numTuples; i++) {\n tuple = PyList_GET_ITEM(controlTuples, i);\n if (!PyTuple_Check(tuple)) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_TypeError, \"expecting tuple\");\n return NULL;\n }\n if (PyTuple_GET_SIZE(tuple) != 3) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_TypeError, \"expecting tuple of size 3\");\n return NULL;\n }\n x = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 0));\n y = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 1));\n z = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 2));\n if (newpos + x > newDataLength ||\n diffPtr + x > diffBlock + diffBlockLength) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_ValueError, \"corrupt patch (overflow)\");\n return NULL;\n }\n memcpy(newData + newpos, diffPtr, x);\n diffPtr += x;\n for (j = 0; j < x; j++)\n if ((oldpos + j >= 0) && (oldpos + j < origDataLength))\n newData[newpos + j] += origData[oldpos + j];\n newpos += x;\n oldpos += x;\n if (newpos + y > newDataLength ||\n extraPtr + y > extraBlock + extraBlockLength) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_ValueError, \"corrupt patch (overflow)\");\n return NULL;\n }\n memcpy(newData + newpos, extraPtr, y);\n extraPtr += y;\n newpos += y;\n oldpos += z;\n }\n\n /* confirm that a valid patch was applied */\n if (newpos != newDataLength ||\n diffPtr != diffBlock + diffBlockLength ||\n extraPtr != extraBlock + extraBlockLength) {\n PyMem_Free(newData);\n PyErr_SetString(PyExc_ValueError, \"corrupt patch (underflow)\");\n return NULL;\n }\n\n results = PyBytes_FromStringAndSize(newData, newDataLength);\n PyMem_Free(newData);\n return results;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"patch","file_name":"bsdiff4/core.c","commit_link":"github.com/ilanschnell/bsdiff4/commit/49a4cee2feef7deaf9d89e5e793a8824930284d7","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#24-0c418166dabe","input":"HandleRFBServerMessage(rfbClient* client)\n{\n rfbServerToClientMsg msg;\n\n if (client->serverPort==-1)\n client->vncRec->readTimestamp = TRUE;\n if (!ReadFromRFBServer(client, (char *)&msg, 1))\n return FALSE;\n\n switch (msg.type) {\n\n case rfbSetColourMapEntries:\n {\n /* TODO:\n int i;\n uint16_t rgb[3];\n XColor xc;\n\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n\t\t\t sz_rfbSetColourMapEntriesMsg - 1))\n return FALSE;\n\n msg.scme.firstColour = rfbClientSwap16IfLE(msg.scme.firstColour);\n msg.scme.nColours = rfbClientSwap16IfLE(msg.scme.nColours);\n\n for (i = 0; i < msg.scme.nColours; i++) {\n if (!ReadFromRFBServer(client, (char *)rgb, 6))\n\treturn FALSE;\n xc.pixel = msg.scme.firstColour + i;\n xc.red = rfbClientSwap16IfLE(rgb[0]);\n xc.green = rfbClientSwap16IfLE(rgb[1]);\n xc.blue = rfbClientSwap16IfLE(rgb[2]);\n xc.flags = DoRed|DoGreen|DoBlue;\n XStoreColor(dpy, cmap, &xc);\n }\n */\n\n break;\n }\n\n case rfbFramebufferUpdate:\n {\n rfbFramebufferUpdateRectHeader rect;\n int linesToRead;\n int bytesPerLine;\n int i;\n\n if (!ReadFromRFBServer(client, ((char *)&msg.fu) + 1,\n\t\t\t sz_rfbFramebufferUpdateMsg - 1))\n return FALSE;\n\n msg.fu.nRects = rfbClientSwap16IfLE(msg.fu.nRects);\n\n for (i = 0; i < msg.fu.nRects; i++) {\n if (!ReadFromRFBServer(client, (char *)&rect, sz_rfbFramebufferUpdateRectHeader))\n\treturn FALSE;\n\n rect.encoding = rfbClientSwap32IfLE(rect.encoding);\n if (rect.encoding == rfbEncodingLastRect)\n\tbreak;\n\n rect.r.x = rfbClientSwap16IfLE(rect.r.x);\n rect.r.y = rfbClientSwap16IfLE(rect.r.y);\n rect.r.w = rfbClientSwap16IfLE(rect.r.w);\n rect.r.h = rfbClientSwap16IfLE(rect.r.h);\n\n\n if (rect.encoding == rfbEncodingXCursor ||\n\t rect.encoding == rfbEncodingRichCursor) {\n\n\tif (!HandleCursorShape(client,\n\t\t\t rect.r.x, rect.r.y, rect.r.w, rect.r.h,\n\t\t\t rect.encoding)) {\n\t return FALSE;\n\t}\n\tcontinue;\n }\n\n if (rect.encoding == rfbEncodingPointerPos) {\n\tif (!client->HandleCursorPos(client,rect.r.x, rect.r.y)) {\n\t return FALSE;\n\t}\n\tcontinue;\n }\n \n if (rect.encoding == rfbEncodingKeyboardLedState) {\n /* OK! We have received a keyboard state message!!! */\n client->KeyboardLedStateEnabled = 1;\n if (client->HandleKeyboardLedState!=NULL)\n client->HandleKeyboardLedState(client, rect.r.x, 0);\n /* stash it for the future */\n client->CurrentKeyboardLedState = rect.r.x;\n continue;\n }\n\n if (rect.encoding == rfbEncodingNewFBSize) {\n\tclient->width = rect.r.w;\n\tclient->height = rect.r.h;\n\tclient->updateRect.x = client->updateRect.y = 0;\n\tclient->updateRect.w = client->width;\n\tclient->updateRect.h = client->height;\n\tif (!client->MallocFrameBuffer(client))\n\t return FALSE;\n\tSendFramebufferUpdateRequest(client, 0, 0, rect.r.w, rect.r.h, FALSE);\n\trfbClientLog(\"Got new framebuffer size: %dx%d\\n\", rect.r.w, rect.r.h);\n\tcontinue;\n }\n\n /* rect.r.w=byte count */\n if (rect.encoding == rfbEncodingSupportedMessages) {\n int loop;\n if (!ReadFromRFBServer(client, (char *)&client->supportedMessages, sz_rfbSupportedMessages))\n return FALSE;\n\n /* msgs is two sets of bit flags of supported messages client2server[] and server2client[] */\n /* currently ignored by this library */\n\n rfbClientLog(\"client2server supported messages (bit flags)\\n\");\n for (loop=0;loop<32;loop+=8)\n rfbClientLog(\"%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\\n\", loop,\n client->supportedMessages.client2server[loop], client->supportedMessages.client2server[loop+1],\n client->supportedMessages.client2server[loop+2], client->supportedMessages.client2server[loop+3],\n client->supportedMessages.client2server[loop+4], client->supportedMessages.client2server[loop+5],\n client->supportedMessages.client2server[loop+6], client->supportedMessages.client2server[loop+7]);\n\n rfbClientLog(\"server2client supported messages (bit flags)\\n\");\n for (loop=0;loop<32;loop+=8)\n rfbClientLog(\"%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\\n\", loop,\n client->supportedMessages.server2client[loop], client->supportedMessages.server2client[loop+1],\n client->supportedMessages.server2client[loop+2], client->supportedMessages.server2client[loop+3],\n client->supportedMessages.server2client[loop+4], client->supportedMessages.server2client[loop+5],\n client->supportedMessages.server2client[loop+6], client->supportedMessages.server2client[loop+7]);\n continue;\n }\n\n /* rect.r.w=byte count, rect.r.h=# of encodings */\n if (rect.encoding == rfbEncodingSupportedEncodings) {\n char *buffer;\n buffer = malloc(rect.r.w);\n if (!ReadFromRFBServer(client, buffer, rect.r.w))\n {\n free(buffer);\n return FALSE;\n }\n\n /* buffer now contains rect.r.h # of uint32_t encodings that the server supports */\n /* currently ignored by this library */\n free(buffer);\n continue;\n }\n\n /* rect.r.w=byte count */\n if (rect.encoding == rfbEncodingServerIdentity) {\n char *buffer;\n buffer = malloc(rect.r.w+1);\n if (!ReadFromRFBServer(client, buffer, rect.r.w))\n {\n free(buffer);\n return FALSE;\n }\n buffer[rect.r.w]=0; /* null terminate, just in case */\n rfbClientLog(\"Connected to Server \\\"%s\\\"\\n\", buffer);\n free(buffer);\n continue;\n }\n\n /* rfbEncodingUltraZip is a collection of subrects. x = # of subrects, and h is always 0 */\n if (rect.encoding != rfbEncodingUltraZip)\n {\n if ((rect.r.x + rect.r.w > client->width) ||\n\t (rect.r.y + rect.r.h > client->height))\n\t {\n\t rfbClientLog(\"Rect too large: %dx%d at (%d, %d)\\n\",\n\t \t rect.r.w, rect.r.h, rect.r.x, rect.r.y);\n\t return FALSE;\n }\n\n /* UltraVNC with scaling, will send rectangles with a zero W or H\n *\n if ((rect.encoding != rfbEncodingTight) && \n (rect.r.h * rect.r.w == 0))\n {\n\t rfbClientLog(\"Zero size rect - ignoring (encoding=%d (0x%08x) %dx, %dy, %dw, %dh)\\n\", rect.encoding, rect.encoding, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n\t continue;\n }\n */\n \n /* If RichCursor encoding is used, we should prevent collisions\n\t between framebuffer updates and cursor drawing operations. */\n client->SoftCursorLockArea(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n }\n\n switch (rect.encoding) {\n\n case rfbEncodingRaw: {\n\tint y=rect.r.y, h=rect.r.h;\n\n\tbytesPerLine = rect.r.w * client->format.bitsPerPixel / 8;\n\t/* RealVNC 4.x-5.x on OSX can induce bytesPerLine==0, \n\t usually during GPU accel. */\n\t/* Regardless of cause, do not divide by zero. */\n\tlinesToRead = bytesPerLine ? (RFB_BUFFER_SIZE / bytesPerLine) : 0;\n\n\twhile (linesToRead && h > 0) {\n\t if (linesToRead > h)\n\t linesToRead = h;\n\n\t if (!ReadFromRFBServer(client, client->buffer,bytesPerLine * linesToRead))\n\t return FALSE;\n\n\t client->GotBitmap(client, (uint8_t *)client->buffer,\n\t\t\t rect.r.x, y, rect.r.w,linesToRead);\n\n\t h -= linesToRead;\n\t y += linesToRead;\n\n\t}\n\tbreak;\n } \n\n case rfbEncodingCopyRect:\n {\n\trfbCopyRect cr;\n\n\tif (!ReadFromRFBServer(client, (char *)&cr, sz_rfbCopyRect))\n\t return FALSE;\n\n\tcr.srcX = rfbClientSwap16IfLE(cr.srcX);\n\tcr.srcY = rfbClientSwap16IfLE(cr.srcY);\n\n\t/* If RichCursor encoding is used, we should extend our\n\t \"cursor lock area\" (previously set to destination\n\t rectangle) to the source rectangle as well. */\n\tclient->SoftCursorLockArea(client,\n\t\t\t\t cr.srcX, cr.srcY, rect.r.w, rect.r.h);\n\n client->GotCopyRect(client, cr.srcX, cr.srcY, rect.r.w, rect.r.h,\n rect.r.x, rect.r.y);\n\n\tbreak;\n }\n\n case rfbEncodingRRE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleRRE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleRRE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleRRE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingCoRRE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleCoRRE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleCoRRE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleCoRRE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingHextile:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleHextile8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleHextile16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleHextile32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingUltra:\n {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleUltra8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 16:\n if (!HandleUltra16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 32:\n if (!HandleUltra32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n }\n break;\n }\n case rfbEncodingUltraZip:\n {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleUltraZip8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 16:\n if (!HandleUltraZip16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 32:\n if (!HandleUltraZip32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n }\n break;\n }\n\n case rfbEncodingTRLE:\n\t {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleTRLE8(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n break;\n case 16:\n if (client->si.format.greenMax > 0x1F) {\n if (!HandleTRLE16(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else {\n if (!HandleTRLE15(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n }\n break;\n case 32: {\n uint32_t maxColor =\n (client->format.redMax << client->format.redShift) |\n (client->format.greenMax << client->format.greenShift) |\n (client->format.blueMax << client->format.blueShift);\n if ((client->format.bigEndian && (maxColor & 0xff) == 0) ||\n (!client->format.bigEndian && (maxColor & 0xff000000) == 0)) {\n if (!HandleTRLE24(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else if (!client->format.bigEndian && (maxColor & 0xff) == 0) {\n if (!HandleTRLE24Up(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else if (client->format.bigEndian && (maxColor & 0xff000000) == 0) {\n if (!HandleTRLE24Down(client, rect.r.x, rect.r.y, rect.r.w,\n rect.r.h))\n return FALSE;\n } else if (!HandleTRLE32(client, rect.r.x, rect.r.y, rect.r.w,\n rect.r.h))\n return FALSE;\n break;\n }\n }\n break;\n }\n\n#ifdef LIBVNCSERVER_HAVE_LIBZ\n case rfbEncodingZlib:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleZlib8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleZlib16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleZlib32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n#ifdef LIBVNCSERVER_HAVE_LIBJPEG\n case rfbEncodingTight:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleTight8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleTight16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleTight32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n#endif\n case rfbEncodingZRLE:\n\t/* Fail safe for ZYWRLE unsupport VNC server. */\n\tclient->appData.qualityLevel = 9;\n\t/* fall through */\n case rfbEncodingZYWRLE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleZRLE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (client->si.format.greenMax > 0x1F) {\n\t if (!HandleZRLE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else {\n\t if (!HandleZRLE15(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t }\n\t break;\n\tcase 32:\n\t{\n\t uint32_t maxColor=(client->format.redMax<format.redShift)|\n\t\t(client->format.greenMax<format.greenShift)|\n\t\t(client->format.blueMax<format.blueShift);\n\t if ((client->format.bigEndian && (maxColor&0xff)==0) ||\n\t (!client->format.bigEndian && (maxColor&0xff000000)==0)) {\n\t if (!HandleZRLE24(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (!client->format.bigEndian && (maxColor&0xff)==0) {\n\t if (!HandleZRLE24Up(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (client->format.bigEndian && (maxColor&0xff000000)==0) {\n\t if (!HandleZRLE24Down(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (!HandleZRLE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\t}\n\tbreak;\n }\n\n#endif\n\n default:\n\t {\n\t rfbBool handled = FALSE;\n\t rfbClientProtocolExtension* e;\n\n\t for(e = rfbClientExtensions; !handled && e; e = e->next)\n\t if(e->handleEncoding && e->handleEncoding(client, &rect))\n\t handled = TRUE;\n\n\t if(!handled) {\n\t rfbClientLog(\"Unknown rect encoding %d\\n\",\n\t\t (int)rect.encoding);\n\t return FALSE;\n\t }\n\t }\n }\n\n /* Now we may discard \"soft cursor locks\". */\n client->SoftCursorUnlockScreen(client);\n\n client->GotFrameBufferUpdate(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n }\n\n if (!SendIncrementalFramebufferUpdateRequest(client))\n return FALSE;\n\n if (client->FinishedFrameBufferUpdate)\n client->FinishedFrameBufferUpdate(client);\n\n break;\n }\n\n case rfbBell:\n {\n client->Bell(client);\n\n break;\n }\n\n case rfbServerCutText:\n {\n char *buffer;\n\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n\t\t\t sz_rfbServerCutTextMsg - 1))\n return FALSE;\n\n msg.sct.length = rfbClientSwap32IfLE(msg.sct.length);\n\n if (msg.sct.length > 1<<20) {\n\t rfbClientErr(\"Ignoring too big cut text length sent by server: %u B > 1 MB\\n\", (unsigned int)msg.sct.length);\n\t return FALSE;\n } \n\n buffer = malloc((uint64_t)msg.sct.length+1);\n\n if (!ReadFromRFBServer(client, buffer, msg.sct.length)) {\n free(buffer);\n return FALSE;\n }\n\n buffer[msg.sct.length] = 0;\n\n if (client->GotXCutText)\n client->GotXCutText(client, buffer, msg.sct.length);\n\n free(buffer);\n\n break;\n }\n\n case rfbTextChat:\n {\n char *buffer=NULL;\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbTextChatMsg- 1))\n return FALSE;\n msg.tc.length = rfbClientSwap32IfLE(msg.sct.length);\n switch(msg.tc.length) {\n case rfbTextChatOpen:\n rfbClientLog(\"Received TextChat Open\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatOpen, NULL);\n break;\n case rfbTextChatClose:\n rfbClientLog(\"Received TextChat Close\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatClose, NULL);\n break;\n case rfbTextChatFinished:\n rfbClientLog(\"Received TextChat Finished\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatFinished, NULL);\n break;\n default:\n buffer=malloc(msg.tc.length+1);\n if (!ReadFromRFBServer(client, buffer, msg.tc.length))\n {\n free(buffer);\n return FALSE;\n }\n /* Null Terminate */\n buffer[msg.tc.length]=0;\n rfbClientLog(\"Received TextChat \\\"%s\\\"\\n\", buffer);\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)msg.tc.length, buffer);\n free(buffer);\n break;\n }\n break;\n }\n\n case rfbXvp:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbXvpMsg -1))\n return FALSE;\n\n SetClient2Server(client, rfbXvp);\n /* technically, we only care what we can *send* to the server\n * but, we set Server2Client Just in case it ever becomes useful\n */\n SetServer2Client(client, rfbXvp);\n\n if(client->HandleXvpMsg)\n client->HandleXvpMsg(client, msg.xvp.version, msg.xvp.code);\n\n break;\n }\n\n case rfbResizeFrameBuffer:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbResizeFrameBufferMsg -1))\n return FALSE;\n client->width = rfbClientSwap16IfLE(msg.rsfb.framebufferWidth);\n client->height = rfbClientSwap16IfLE(msg.rsfb.framebufferHeigth);\n client->updateRect.x = client->updateRect.y = 0;\n client->updateRect.w = client->width;\n client->updateRect.h = client->height;\n if (!client->MallocFrameBuffer(client))\n return FALSE;\n\n SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE);\n rfbClientLog(\"Got new framebuffer size: %dx%d\\n\", client->width, client->height);\n break;\n }\n\n case rfbPalmVNCReSizeFrameBuffer:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbPalmVNCReSizeFrameBufferMsg -1))\n return FALSE;\n client->width = rfbClientSwap16IfLE(msg.prsfb.buffer_w);\n client->height = rfbClientSwap16IfLE(msg.prsfb.buffer_h);\n client->updateRect.x = client->updateRect.y = 0;\n client->updateRect.w = client->width;\n client->updateRect.h = client->height;\n if (!client->MallocFrameBuffer(client))\n return FALSE;\n SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE);\n rfbClientLog(\"Got new framebuffer size: %dx%d\\n\", client->width, client->height);\n break;\n }\n\n default:\n {\n rfbBool handled = FALSE;\n rfbClientProtocolExtension* e;\n\n for(e = rfbClientExtensions; !handled && e; e = e->next)\n\tif(e->handleMessage && e->handleMessage(client, &msg))\n\t handled = TRUE;\n\n if(!handled) {\n\tchar buffer[256];\n\trfbClientLog(\"Unknown message type %d from VNC server\\n\",msg.type);\n\tReadFromRFBServer(client, buffer, 256);\n\treturn FALSE;\n }\n }\n }\n\n return TRUE;\n}","target":"HandleRFBServerMessage(rfbClient* client)\n{\n rfbServerToClientMsg msg;\n\n if (client->serverPort==-1)\n client->vncRec->readTimestamp = TRUE;\n if (!ReadFromRFBServer(client, (char *)&msg, 1))\n return FALSE;\n\n switch (msg.type) {\n\n case rfbSetColourMapEntries:\n {\n /* TODO:\n int i;\n uint16_t rgb[3];\n XColor xc;\n\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n\t\t\t sz_rfbSetColourMapEntriesMsg - 1))\n return FALSE;\n\n msg.scme.firstColour = rfbClientSwap16IfLE(msg.scme.firstColour);\n msg.scme.nColours = rfbClientSwap16IfLE(msg.scme.nColours);\n\n for (i = 0; i < msg.scme.nColours; i++) {\n if (!ReadFromRFBServer(client, (char *)rgb, 6))\n\treturn FALSE;\n xc.pixel = msg.scme.firstColour + i;\n xc.red = rfbClientSwap16IfLE(rgb[0]);\n xc.green = rfbClientSwap16IfLE(rgb[1]);\n xc.blue = rfbClientSwap16IfLE(rgb[2]);\n xc.flags = DoRed|DoGreen|DoBlue;\n XStoreColor(dpy, cmap, &xc);\n }\n */\n\n break;\n }\n\n case rfbFramebufferUpdate:\n {\n rfbFramebufferUpdateRectHeader rect;\n int linesToRead;\n int bytesPerLine;\n int i;\n\n if (!ReadFromRFBServer(client, ((char *)&msg.fu) + 1,\n\t\t\t sz_rfbFramebufferUpdateMsg - 1))\n return FALSE;\n\n msg.fu.nRects = rfbClientSwap16IfLE(msg.fu.nRects);\n\n for (i = 0; i < msg.fu.nRects; i++) {\n if (!ReadFromRFBServer(client, (char *)&rect, sz_rfbFramebufferUpdateRectHeader))\n\treturn FALSE;\n\n rect.encoding = rfbClientSwap32IfLE(rect.encoding);\n if (rect.encoding == rfbEncodingLastRect)\n\tbreak;\n\n rect.r.x = rfbClientSwap16IfLE(rect.r.x);\n rect.r.y = rfbClientSwap16IfLE(rect.r.y);\n rect.r.w = rfbClientSwap16IfLE(rect.r.w);\n rect.r.h = rfbClientSwap16IfLE(rect.r.h);\n\n\n if (rect.encoding == rfbEncodingXCursor ||\n\t rect.encoding == rfbEncodingRichCursor) {\n\n\tif (!HandleCursorShape(client,\n\t\t\t rect.r.x, rect.r.y, rect.r.w, rect.r.h,\n\t\t\t rect.encoding)) {\n\t return FALSE;\n\t}\n\tcontinue;\n }\n\n if (rect.encoding == rfbEncodingPointerPos) {\n\tif (!client->HandleCursorPos(client,rect.r.x, rect.r.y)) {\n\t return FALSE;\n\t}\n\tcontinue;\n }\n \n if (rect.encoding == rfbEncodingKeyboardLedState) {\n /* OK! We have received a keyboard state message!!! */\n client->KeyboardLedStateEnabled = 1;\n if (client->HandleKeyboardLedState!=NULL)\n client->HandleKeyboardLedState(client, rect.r.x, 0);\n /* stash it for the future */\n client->CurrentKeyboardLedState = rect.r.x;\n continue;\n }\n\n if (rect.encoding == rfbEncodingNewFBSize) {\n\tclient->width = rect.r.w;\n\tclient->height = rect.r.h;\n\tclient->updateRect.x = client->updateRect.y = 0;\n\tclient->updateRect.w = client->width;\n\tclient->updateRect.h = client->height;\n\tif (!client->MallocFrameBuffer(client))\n\t return FALSE;\n\tSendFramebufferUpdateRequest(client, 0, 0, rect.r.w, rect.r.h, FALSE);\n\trfbClientLog(\"Got new framebuffer size: %dx%d\\n\", rect.r.w, rect.r.h);\n\tcontinue;\n }\n\n /* rect.r.w=byte count */\n if (rect.encoding == rfbEncodingSupportedMessages) {\n int loop;\n if (!ReadFromRFBServer(client, (char *)&client->supportedMessages, sz_rfbSupportedMessages))\n return FALSE;\n\n /* msgs is two sets of bit flags of supported messages client2server[] and server2client[] */\n /* currently ignored by this library */\n\n rfbClientLog(\"client2server supported messages (bit flags)\\n\");\n for (loop=0;loop<32;loop+=8)\n rfbClientLog(\"%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\\n\", loop,\n client->supportedMessages.client2server[loop], client->supportedMessages.client2server[loop+1],\n client->supportedMessages.client2server[loop+2], client->supportedMessages.client2server[loop+3],\n client->supportedMessages.client2server[loop+4], client->supportedMessages.client2server[loop+5],\n client->supportedMessages.client2server[loop+6], client->supportedMessages.client2server[loop+7]);\n\n rfbClientLog(\"server2client supported messages (bit flags)\\n\");\n for (loop=0;loop<32;loop+=8)\n rfbClientLog(\"%02X: %04x %04x %04x %04x - %04x %04x %04x %04x\\n\", loop,\n client->supportedMessages.server2client[loop], client->supportedMessages.server2client[loop+1],\n client->supportedMessages.server2client[loop+2], client->supportedMessages.server2client[loop+3],\n client->supportedMessages.server2client[loop+4], client->supportedMessages.server2client[loop+5],\n client->supportedMessages.server2client[loop+6], client->supportedMessages.server2client[loop+7]);\n continue;\n }\n\n /* rect.r.w=byte count, rect.r.h=# of encodings */\n if (rect.encoding == rfbEncodingSupportedEncodings) {\n char *buffer;\n buffer = malloc(rect.r.w);\n if (!ReadFromRFBServer(client, buffer, rect.r.w))\n {\n free(buffer);\n return FALSE;\n }\n\n /* buffer now contains rect.r.h # of uint32_t encodings that the server supports */\n /* currently ignored by this library */\n free(buffer);\n continue;\n }\n\n /* rect.r.w=byte count */\n if (rect.encoding == rfbEncodingServerIdentity) {\n char *buffer;\n buffer = malloc(rect.r.w+1);\n if (!ReadFromRFBServer(client, buffer, rect.r.w))\n {\n free(buffer);\n return FALSE;\n }\n buffer[rect.r.w]=0; /* null terminate, just in case */\n rfbClientLog(\"Connected to Server \\\"%s\\\"\\n\", buffer);\n free(buffer);\n continue;\n }\n\n /* rfbEncodingUltraZip is a collection of subrects. x = # of subrects, and h is always 0 */\n if (rect.encoding != rfbEncodingUltraZip)\n {\n if ((rect.r.x + rect.r.w > client->width) ||\n\t (rect.r.y + rect.r.h > client->height))\n\t {\n\t rfbClientLog(\"Rect too large: %dx%d at (%d, %d)\\n\",\n\t \t rect.r.w, rect.r.h, rect.r.x, rect.r.y);\n\t return FALSE;\n }\n\n /* UltraVNC with scaling, will send rectangles with a zero W or H\n *\n if ((rect.encoding != rfbEncodingTight) && \n (rect.r.h * rect.r.w == 0))\n {\n\t rfbClientLog(\"Zero size rect - ignoring (encoding=%d (0x%08x) %dx, %dy, %dw, %dh)\\n\", rect.encoding, rect.encoding, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n\t continue;\n }\n */\n \n /* If RichCursor encoding is used, we should prevent collisions\n\t between framebuffer updates and cursor drawing operations. */\n client->SoftCursorLockArea(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n }\n\n switch (rect.encoding) {\n\n case rfbEncodingRaw: {\n\tint y=rect.r.y, h=rect.r.h;\n\n\tbytesPerLine = rect.r.w * client->format.bitsPerPixel / 8;\n\t/* RealVNC 4.x-5.x on OSX can induce bytesPerLine==0, \n\t usually during GPU accel. */\n\t/* Regardless of cause, do not divide by zero. */\n\tlinesToRead = bytesPerLine ? (RFB_BUFFER_SIZE / bytesPerLine) : 0;\n\n\twhile (linesToRead && h > 0) {\n\t if (linesToRead > h)\n\t linesToRead = h;\n\n\t if (!ReadFromRFBServer(client, client->buffer,bytesPerLine * linesToRead))\n\t return FALSE;\n\n\t client->GotBitmap(client, (uint8_t *)client->buffer,\n\t\t\t rect.r.x, y, rect.r.w,linesToRead);\n\n\t h -= linesToRead;\n\t y += linesToRead;\n\n\t}\n\tbreak;\n } \n\n case rfbEncodingCopyRect:\n {\n\trfbCopyRect cr;\n\n\tif (!ReadFromRFBServer(client, (char *)&cr, sz_rfbCopyRect))\n\t return FALSE;\n\n\tcr.srcX = rfbClientSwap16IfLE(cr.srcX);\n\tcr.srcY = rfbClientSwap16IfLE(cr.srcY);\n\n\t/* If RichCursor encoding is used, we should extend our\n\t \"cursor lock area\" (previously set to destination\n\t rectangle) to the source rectangle as well. */\n\tclient->SoftCursorLockArea(client,\n\t\t\t\t cr.srcX, cr.srcY, rect.r.w, rect.r.h);\n\n client->GotCopyRect(client, cr.srcX, cr.srcY, rect.r.w, rect.r.h,\n rect.r.x, rect.r.y);\n\n\tbreak;\n }\n\n case rfbEncodingRRE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleRRE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleRRE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleRRE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingCoRRE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleCoRRE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleCoRRE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleCoRRE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingHextile:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleHextile8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleHextile16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleHextile32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n case rfbEncodingUltra:\n {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleUltra8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 16:\n if (!HandleUltra16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 32:\n if (!HandleUltra32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n }\n break;\n }\n case rfbEncodingUltraZip:\n {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleUltraZip8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 16:\n if (!HandleUltraZip16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n case 32:\n if (!HandleUltraZip32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n return FALSE;\n break;\n }\n break;\n }\n\n case rfbEncodingTRLE:\n\t {\n switch (client->format.bitsPerPixel) {\n case 8:\n if (!HandleTRLE8(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n break;\n case 16:\n if (client->si.format.greenMax > 0x1F) {\n if (!HandleTRLE16(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else {\n if (!HandleTRLE15(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n }\n break;\n case 32: {\n uint32_t maxColor =\n (client->format.redMax << client->format.redShift) |\n (client->format.greenMax << client->format.greenShift) |\n (client->format.blueMax << client->format.blueShift);\n if ((client->format.bigEndian && (maxColor & 0xff) == 0) ||\n (!client->format.bigEndian && (maxColor & 0xff000000) == 0)) {\n if (!HandleTRLE24(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else if (!client->format.bigEndian && (maxColor & 0xff) == 0) {\n if (!HandleTRLE24Up(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h))\n return FALSE;\n } else if (client->format.bigEndian && (maxColor & 0xff000000) == 0) {\n if (!HandleTRLE24Down(client, rect.r.x, rect.r.y, rect.r.w,\n rect.r.h))\n return FALSE;\n } else if (!HandleTRLE32(client, rect.r.x, rect.r.y, rect.r.w,\n rect.r.h))\n return FALSE;\n break;\n }\n }\n break;\n }\n\n#ifdef LIBVNCSERVER_HAVE_LIBZ\n case rfbEncodingZlib:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleZlib8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleZlib16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleZlib32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n\n#ifdef LIBVNCSERVER_HAVE_LIBJPEG\n case rfbEncodingTight:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleTight8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (!HandleTight16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 32:\n\t if (!HandleTight32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\tbreak;\n }\n#endif\n case rfbEncodingZRLE:\n\t/* Fail safe for ZYWRLE unsupport VNC server. */\n\tclient->appData.qualityLevel = 9;\n\t/* fall through */\n case rfbEncodingZYWRLE:\n {\n\tswitch (client->format.bitsPerPixel) {\n\tcase 8:\n\t if (!HandleZRLE8(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\tcase 16:\n\t if (client->si.format.greenMax > 0x1F) {\n\t if (!HandleZRLE16(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else {\n\t if (!HandleZRLE15(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t }\n\t break;\n\tcase 32:\n\t{\n\t uint32_t maxColor=(client->format.redMax<format.redShift)|\n\t\t(client->format.greenMax<format.greenShift)|\n\t\t(client->format.blueMax<format.blueShift);\n\t if ((client->format.bigEndian && (maxColor&0xff)==0) ||\n\t (!client->format.bigEndian && (maxColor&0xff000000)==0)) {\n\t if (!HandleZRLE24(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (!client->format.bigEndian && (maxColor&0xff)==0) {\n\t if (!HandleZRLE24Up(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (client->format.bigEndian && (maxColor&0xff000000)==0) {\n\t if (!HandleZRLE24Down(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t } else if (!HandleZRLE32(client, rect.r.x,rect.r.y,rect.r.w,rect.r.h))\n\t return FALSE;\n\t break;\n\t}\n\t}\n\tbreak;\n }\n\n#endif\n\n default:\n\t {\n\t rfbBool handled = FALSE;\n\t rfbClientProtocolExtension* e;\n\n\t for(e = rfbClientExtensions; !handled && e; e = e->next)\n\t if(e->handleEncoding && e->handleEncoding(client, &rect))\n\t handled = TRUE;\n\n\t if(!handled) {\n\t rfbClientLog(\"Unknown rect encoding %d\\n\",\n\t\t (int)rect.encoding);\n\t return FALSE;\n\t }\n\t }\n }\n\n /* Now we may discard \"soft cursor locks\". */\n client->SoftCursorUnlockScreen(client);\n\n client->GotFrameBufferUpdate(client, rect.r.x, rect.r.y, rect.r.w, rect.r.h);\n }\n\n if (!SendIncrementalFramebufferUpdateRequest(client))\n return FALSE;\n\n if (client->FinishedFrameBufferUpdate)\n client->FinishedFrameBufferUpdate(client);\n\n break;\n }\n\n case rfbBell:\n {\n client->Bell(client);\n\n break;\n }\n\n case rfbServerCutText:\n {\n char *buffer;\n\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n\t\t\t sz_rfbServerCutTextMsg - 1))\n return FALSE;\n\n msg.sct.length = rfbClientSwap32IfLE(msg.sct.length);\n\n if (msg.sct.length > 1<<20) {\n\t rfbClientErr(\"Ignoring too big cut text length sent by server: %u B > 1 MB\\n\", (unsigned int)msg.sct.length);\n\t return FALSE;\n } \n\n buffer = malloc(msg.sct.length+1);\n\n if (!ReadFromRFBServer(client, buffer, msg.sct.length)) {\n free(buffer);\n return FALSE;\n }\n\n buffer[msg.sct.length] = 0;\n\n if (client->GotXCutText)\n client->GotXCutText(client, buffer, msg.sct.length);\n\n free(buffer);\n\n break;\n }\n\n case rfbTextChat:\n {\n char *buffer=NULL;\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbTextChatMsg- 1))\n return FALSE;\n msg.tc.length = rfbClientSwap32IfLE(msg.sct.length);\n switch(msg.tc.length) {\n case rfbTextChatOpen:\n rfbClientLog(\"Received TextChat Open\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatOpen, NULL);\n break;\n case rfbTextChatClose:\n rfbClientLog(\"Received TextChat Close\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatClose, NULL);\n break;\n case rfbTextChatFinished:\n rfbClientLog(\"Received TextChat Finished\\n\");\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)rfbTextChatFinished, NULL);\n break;\n default:\n buffer=malloc(msg.tc.length+1);\n if (!ReadFromRFBServer(client, buffer, msg.tc.length))\n {\n free(buffer);\n return FALSE;\n }\n /* Null Terminate */\n buffer[msg.tc.length]=0;\n rfbClientLog(\"Received TextChat \\\"%s\\\"\\n\", buffer);\n if (client->HandleTextChat!=NULL)\n client->HandleTextChat(client, (int)msg.tc.length, buffer);\n free(buffer);\n break;\n }\n break;\n }\n\n case rfbXvp:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbXvpMsg -1))\n return FALSE;\n\n SetClient2Server(client, rfbXvp);\n /* technically, we only care what we can *send* to the server\n * but, we set Server2Client Just in case it ever becomes useful\n */\n SetServer2Client(client, rfbXvp);\n\n if(client->HandleXvpMsg)\n client->HandleXvpMsg(client, msg.xvp.version, msg.xvp.code);\n\n break;\n }\n\n case rfbResizeFrameBuffer:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbResizeFrameBufferMsg -1))\n return FALSE;\n client->width = rfbClientSwap16IfLE(msg.rsfb.framebufferWidth);\n client->height = rfbClientSwap16IfLE(msg.rsfb.framebufferHeigth);\n client->updateRect.x = client->updateRect.y = 0;\n client->updateRect.w = client->width;\n client->updateRect.h = client->height;\n if (!client->MallocFrameBuffer(client))\n return FALSE;\n\n SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE);\n rfbClientLog(\"Got new framebuffer size: %dx%d\\n\", client->width, client->height);\n break;\n }\n\n case rfbPalmVNCReSizeFrameBuffer:\n {\n if (!ReadFromRFBServer(client, ((char *)&msg) + 1,\n sz_rfbPalmVNCReSizeFrameBufferMsg -1))\n return FALSE;\n client->width = rfbClientSwap16IfLE(msg.prsfb.buffer_w);\n client->height = rfbClientSwap16IfLE(msg.prsfb.buffer_h);\n client->updateRect.x = client->updateRect.y = 0;\n client->updateRect.w = client->width;\n client->updateRect.h = client->height;\n if (!client->MallocFrameBuffer(client))\n return FALSE;\n SendFramebufferUpdateRequest(client, 0, 0, client->width, client->height, FALSE);\n rfbClientLog(\"Got new framebuffer size: %dx%d\\n\", client->width, client->height);\n break;\n }\n\n default:\n {\n rfbBool handled = FALSE;\n rfbClientProtocolExtension* e;\n\n for(e = rfbClientExtensions; !handled && e; e = e->next)\n\tif(e->handleMessage && e->handleMessage(client, &msg))\n\t handled = TRUE;\n\n if(!handled) {\n\tchar buffer[256];\n\trfbClientLog(\"Unknown message type %d from VNC server\\n\",msg.type);\n\tReadFromRFBServer(client, buffer, 256);\n\treturn FALSE;\n }\n }\n }\n\n return TRUE;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"HandleRFBServerMessage","file_name":"libvncclient/rfbproto.c","commit_link":"github.com/LibVNC/libvncserver/commit/a64c3b37af9a6c8f8009d7516874b8d266b42bae","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#25-c5cd2b518aef","input":"int32_t *enc_untrusted_create_wait_queue() {\n MessageWriter input;\n MessageReader output;\n input.Push(sizeof(int32_t));\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kLocalLifetimeAllocHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_create_wait_queue\",\n 2);\n int32_t *queue = reinterpret_cast(output.next());\n int klinux_errno = output.next();\n if (queue == nullptr) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n }\n enc_untrusted_disable_waiting(queue);\n return queue;\n}","target":"int32_t *enc_untrusted_create_wait_queue() {\n MessageWriter input;\n MessageReader output;\n input.Push(sizeof(int32_t));\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kLocalLifetimeAllocHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_create_wait_queue\",\n 2);\n int32_t *queue = reinterpret_cast(output.next());\n if (!TrustedPrimitives::IsOutsideEnclave(queue, sizeof(int32_t))) {\n TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_create_wait_queue: queue should be in untrusted memory\");\n }\n int klinux_errno = output.next();\n if (queue == nullptr) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n }\n enc_untrusted_disable_waiting(queue);\n return queue;\n}","lang":"cpp","vul_type":"cwe-787","sven_meta":{"func_name":"enc_untrusted_create_wait_queue","file_name":"asylo/platform/host_call/trusted/concurrency.cc","commit_link":"github.com/google/asylo/commit/a37fb6a0e7daf30134dbbf357c9a518a1026aa02","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#26-1432e8be7f87","input":"bool FromkLinuxSockAddr(const struct klinux_sockaddr *input,\n socklen_t input_len, struct sockaddr *output,\n socklen_t *output_len,\n void (*abort_handler)(const char *)) {\n if (!input || !output || !output_len || input_len == 0) {\n output = nullptr;\n return false;\n }\n\n int16_t klinux_family = input->klinux_sa_family;\n if (klinux_family == kLinux_AF_UNIX) {\n struct klinux_sockaddr_un *klinux_sockaddr_un_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_un sockaddr_un_out;\n sockaddr_un_out.sun_family = AF_UNIX;\n InitializeToZeroArray(sockaddr_un_out.sun_path);\n ReinterpretCopyArray(\n sockaddr_un_out.sun_path, klinux_sockaddr_un_in->klinux_sun_path,\n std::min(sizeof(sockaddr_un_out.sun_path),\n sizeof(klinux_sockaddr_un_in->klinux_sun_path)));\n CopySockaddr(&sockaddr_un_out, sizeof(sockaddr_un_out), output, output_len);\n } else if (klinux_family == kLinux_AF_INET) {\n struct klinux_sockaddr_in *klinux_sockaddr_in_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_in sockaddr_in_out;\n sockaddr_in_out.sin_family = AF_INET;\n sockaddr_in_out.sin_port = klinux_sockaddr_in_in->klinux_sin_port;\n InitializeToZeroSingle(&sockaddr_in_out.sin_addr);\n ReinterpretCopySingle(&sockaddr_in_out.sin_addr,\n &klinux_sockaddr_in_in->klinux_sin_addr);\n InitializeToZeroArray(sockaddr_in_out.sin_zero);\n ReinterpretCopyArray(sockaddr_in_out.sin_zero,\n klinux_sockaddr_in_in->klinux_sin_zero);\n CopySockaddr(&sockaddr_in_out, sizeof(sockaddr_in_out), output, output_len);\n } else if (klinux_family == kLinux_AF_INET6) {\n struct klinux_sockaddr_in6 *klinux_sockaddr_in6_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_in6 sockaddr_in6_out;\n sockaddr_in6_out.sin6_family = AF_INET6;\n sockaddr_in6_out.sin6_port = klinux_sockaddr_in6_in->klinux_sin6_port;\n sockaddr_in6_out.sin6_flowinfo =\n klinux_sockaddr_in6_in->klinux_sin6_flowinfo;\n sockaddr_in6_out.sin6_scope_id =\n klinux_sockaddr_in6_in->klinux_sin6_scope_id;\n InitializeToZeroSingle(&sockaddr_in6_out.sin6_addr);\n ReinterpretCopySingle(&sockaddr_in6_out.sin6_addr,\n &klinux_sockaddr_in6_in->klinux_sin6_addr);\n CopySockaddr(&sockaddr_in6_out, sizeof(sockaddr_in6_out), output,\n output_len);\n } else if (klinux_family == kLinux_AF_UNSPEC) {\n output = nullptr;\n *output_len = 0;\n } else {\n if (abort_handler != nullptr) {\n std::string message = absl::StrCat(\n \"Type conversion error - Unsupported AF family: \", klinux_family);\n abort_handler(message.c_str());\n } else {\n abort();\n }\n }\n return true;\n}","target":"bool FromkLinuxSockAddr(const struct klinux_sockaddr *input,\n socklen_t input_len, struct sockaddr *output,\n socklen_t *output_len,\n void (*abort_handler)(const char *)) {\n if (!input || !output || !output_len || input_len == 0) {\n output = nullptr;\n return false;\n }\n\n int16_t klinux_family = input->klinux_sa_family;\n if (klinux_family == kLinux_AF_UNIX) {\n if (input_len < sizeof(struct klinux_sockaddr_un)) {\n return false;\n }\n\n struct klinux_sockaddr_un *klinux_sockaddr_un_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_un sockaddr_un_out;\n sockaddr_un_out.sun_family = AF_UNIX;\n InitializeToZeroArray(sockaddr_un_out.sun_path);\n ReinterpretCopyArray(\n sockaddr_un_out.sun_path, klinux_sockaddr_un_in->klinux_sun_path,\n std::min(sizeof(sockaddr_un_out.sun_path),\n sizeof(klinux_sockaddr_un_in->klinux_sun_path)));\n CopySockaddr(&sockaddr_un_out, sizeof(sockaddr_un_out), output, output_len);\n } else if (klinux_family == kLinux_AF_INET) {\n if (input_len < sizeof(struct klinux_sockaddr_in)) {\n return false;\n }\n struct klinux_sockaddr_in *klinux_sockaddr_in_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_in sockaddr_in_out;\n sockaddr_in_out.sin_family = AF_INET;\n sockaddr_in_out.sin_port = klinux_sockaddr_in_in->klinux_sin_port;\n InitializeToZeroSingle(&sockaddr_in_out.sin_addr);\n ReinterpretCopySingle(&sockaddr_in_out.sin_addr,\n &klinux_sockaddr_in_in->klinux_sin_addr);\n InitializeToZeroArray(sockaddr_in_out.sin_zero);\n ReinterpretCopyArray(sockaddr_in_out.sin_zero,\n klinux_sockaddr_in_in->klinux_sin_zero);\n CopySockaddr(&sockaddr_in_out, sizeof(sockaddr_in_out), output, output_len);\n } else if (klinux_family == kLinux_AF_INET6) {\n if (input_len < sizeof(struct klinux_sockaddr_in6)) {\n return false;\n }\n\n struct klinux_sockaddr_in6 *klinux_sockaddr_in6_in =\n const_cast(\n reinterpret_cast(input));\n\n struct sockaddr_in6 sockaddr_in6_out;\n sockaddr_in6_out.sin6_family = AF_INET6;\n sockaddr_in6_out.sin6_port = klinux_sockaddr_in6_in->klinux_sin6_port;\n sockaddr_in6_out.sin6_flowinfo =\n klinux_sockaddr_in6_in->klinux_sin6_flowinfo;\n sockaddr_in6_out.sin6_scope_id =\n klinux_sockaddr_in6_in->klinux_sin6_scope_id;\n InitializeToZeroSingle(&sockaddr_in6_out.sin6_addr);\n ReinterpretCopySingle(&sockaddr_in6_out.sin6_addr,\n &klinux_sockaddr_in6_in->klinux_sin6_addr);\n CopySockaddr(&sockaddr_in6_out, sizeof(sockaddr_in6_out), output,\n output_len);\n } else if (klinux_family == kLinux_AF_UNSPEC) {\n output = nullptr;\n *output_len = 0;\n } else {\n if (abort_handler != nullptr) {\n std::string message = absl::StrCat(\n \"Type conversion error - Unsupported AF family: \", klinux_family);\n abort_handler(message.c_str());\n } else {\n abort();\n }\n }\n return true;\n}","lang":"cpp","vul_type":"cwe-787","sven_meta":{"func_name":"FromkLinuxSockAddr","file_name":"asylo/platform/system_call/type_conversions/manual_types_functions.cc","commit_link":"github.com/google/asylo/commit/bda9772e7872b0d2b9bee32930cf7a4983837b39","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#27-23fb5e8487de","input":"opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,\n\t\t\t\t\t\t\t\t\t\topj_cp_t *p_cp,\n\t\t\t\t\t\t\t\t\t\tOPJ_UINT32 p_tile_no)\n{\n\t/* loop */\n\tOPJ_UINT32 pino;\n\tOPJ_UINT32 compno, resno;\n\n\t/* to store w, h, dx and dy fro all components and resolutions */\n\tOPJ_UINT32 * l_tmp_data;\n\tOPJ_UINT32 ** l_tmp_ptr;\n\n\t/* encoding prameters to set */\n\tOPJ_UINT32 l_max_res;\n\tOPJ_UINT32 l_max_prec;\n\tOPJ_INT32 l_tx0,l_tx1,l_ty0,l_ty1;\n\tOPJ_UINT32 l_dx_min,l_dy_min;\n\tOPJ_UINT32 l_bound;\n\tOPJ_UINT32 l_step_p , l_step_c , l_step_r , l_step_l ;\n\tOPJ_UINT32 l_data_stride;\n\n\t/* pointers */\n\topj_pi_iterator_t *l_pi = 00;\n\topj_tcp_t *l_tcp = 00;\n\tconst opj_tccp_t *l_tccp = 00;\n\topj_pi_comp_t *l_current_comp = 00;\n\topj_image_comp_t * l_img_comp = 00;\n\topj_pi_iterator_t * l_current_pi = 00;\n\tOPJ_UINT32 * l_encoding_value_ptr = 00;\n\n\t/* preconditions in debug */\n\tassert(p_cp != 00);\n\tassert(p_image != 00);\n\tassert(p_tile_no < p_cp->tw * p_cp->th);\n\n\t/* initializations */\n\tl_tcp = &p_cp->tcps[p_tile_no];\n\tl_bound = l_tcp->numpocs+1;\n\n\tl_data_stride = 4 * OPJ_J2K_MAXRLVLS;\n\tl_tmp_data = (OPJ_UINT32*)opj_malloc(\n\t\tl_data_stride * p_image->numcomps * sizeof(OPJ_UINT32));\n\tif\n\t\t(! l_tmp_data)\n\t{\n\t\treturn 00;\n\t}\n\tl_tmp_ptr = (OPJ_UINT32**)opj_malloc(\n\t\tp_image->numcomps * sizeof(OPJ_UINT32 *));\n\tif\n\t\t(! l_tmp_ptr)\n\t{\n\t\topj_free(l_tmp_data);\n\t\treturn 00;\n\t}\n\n\t/* memory allocation for pi */\n\tl_pi = opj_pi_create(p_image, p_cp, p_tile_no);\n\tif (!l_pi) {\n\t\topj_free(l_tmp_data);\n\t\topj_free(l_tmp_ptr);\n\t\treturn 00;\n\t}\n\n\tl_encoding_value_ptr = l_tmp_data;\n\t/* update pointer array */\n\tfor\n\t\t(compno = 0; compno < p_image->numcomps; ++compno)\n\t{\n\t\tl_tmp_ptr[compno] = l_encoding_value_ptr;\n\t\tl_encoding_value_ptr += l_data_stride;\n\t}\n\t/* get encoding parameters */\n\topj_get_all_encoding_parameters(p_image,p_cp,p_tile_no,&l_tx0,&l_tx1,&l_ty0,&l_ty1,&l_dx_min,&l_dy_min,&l_max_prec,&l_max_res,l_tmp_ptr);\n\n\t/* step calculations */\n\tl_step_p = 1;\n\tl_step_c = l_max_prec * l_step_p;\n\tl_step_r = p_image->numcomps * l_step_c;\n\tl_step_l = l_max_res * l_step_r;\n\n\t/* set values for first packet iterator */\n\tl_current_pi = l_pi;\n\n\t/* memory allocation for include */\n\tl_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));\n\tif\n\t\t(!l_current_pi->include)\n\t{\n\t\topj_free(l_tmp_data);\n\t\topj_free(l_tmp_ptr);\n\t\topj_pi_destroy(l_pi, l_bound);\n\t\treturn 00;\n\t}\n\n\t/* special treatment for the first packet iterator */\n\tl_current_comp = l_current_pi->comps;\n\tl_img_comp = p_image->comps;\n\tl_tccp = l_tcp->tccps;\n\n\tl_current_pi->tx0 = l_tx0;\n\tl_current_pi->ty0 = l_ty0;\n\tl_current_pi->tx1 = l_tx1;\n\tl_current_pi->ty1 = l_ty1;\n\n\t/*l_current_pi->dx = l_img_comp->dx;*/\n\t/*l_current_pi->dy = l_img_comp->dy;*/\n\n\tl_current_pi->step_p = l_step_p;\n\tl_current_pi->step_c = l_step_c;\n\tl_current_pi->step_r = l_step_r;\n\tl_current_pi->step_l = l_step_l;\n\n\t/* allocation for components and number of components has already been calculated by opj_pi_create */\n\tfor\n\t\t(compno = 0; compno < l_current_pi->numcomps; ++compno)\n\t{\n\t\topj_pi_resolution_t *l_res = l_current_comp->resolutions;\n\t\tl_encoding_value_ptr = l_tmp_ptr[compno];\n\n\t\tl_current_comp->dx = l_img_comp->dx;\n\t\tl_current_comp->dy = l_img_comp->dy;\n\t\t/* resolutions have already been initialized */\n\t\tfor\n\t\t\t(resno = 0; resno < l_current_comp->numresolutions; resno++)\n\t\t{\n\t\t\tl_res->pdx = *(l_encoding_value_ptr++);\n\t\t\tl_res->pdy = *(l_encoding_value_ptr++);\n\t\t\tl_res->pw = *(l_encoding_value_ptr++);\n\t\t\tl_res->ph = *(l_encoding_value_ptr++);\n\t\t\t++l_res;\n\t\t}\n\t\t++l_current_comp;\n\t\t++l_img_comp;\n\t\t++l_tccp;\n\t}\n\t++l_current_pi;\n\n\tfor (pino = 1 ; pinocomps;\n\t\tl_img_comp = p_image->comps;\n\t\tl_tccp = l_tcp->tccps;\n\n\t\tl_current_pi->tx0 = l_tx0;\n\t\tl_current_pi->ty0 = l_ty0;\n\t\tl_current_pi->tx1 = l_tx1;\n\t\tl_current_pi->ty1 = l_ty1;\n\t\t/*l_current_pi->dx = l_dx_min;*/\n\t\t/*l_current_pi->dy = l_dy_min;*/\n\t\tl_current_pi->step_p = l_step_p;\n\t\tl_current_pi->step_c = l_step_c;\n\t\tl_current_pi->step_r = l_step_r;\n\t\tl_current_pi->step_l = l_step_l;\n\n\t\t/* allocation for components and number of components has already been calculated by opj_pi_create */\n\t\tfor\n\t\t\t(compno = 0; compno < l_current_pi->numcomps; ++compno)\n\t\t{\n\t\t\topj_pi_resolution_t *l_res = l_current_comp->resolutions;\n\t\t\tl_encoding_value_ptr = l_tmp_ptr[compno];\n\n\t\t\tl_current_comp->dx = l_img_comp->dx;\n\t\t\tl_current_comp->dy = l_img_comp->dy;\n\t\t\t/* resolutions have already been initialized */\n\t\t\tfor\n\t\t\t\t(resno = 0; resno < l_current_comp->numresolutions; resno++)\n\t\t\t{\n\t\t\t\tl_res->pdx = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->pdy = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->pw = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->ph = *(l_encoding_value_ptr++);\n\t\t\t\t++l_res;\n\t\t\t}\n\t\t\t++l_current_comp;\n\t\t\t++l_img_comp;\n\t\t\t++l_tccp;\n\t\t}\n\t\t/* special treatment*/\n\t\tl_current_pi->include = (l_current_pi-1)->include;\n\t\t++l_current_pi;\n\t}\n\topj_free(l_tmp_data);\n\tl_tmp_data = 00;\n\topj_free(l_tmp_ptr);\n\tl_tmp_ptr = 00;\n\tif\n\t\t(l_tcp->POC)\n\t{\n\t\topj_pi_update_decode_poc (l_pi,l_tcp,l_max_prec,l_max_res);\n\t}\n\telse\n\t{\n\t\topj_pi_update_decode_not_poc(l_pi,l_tcp,l_max_prec,l_max_res);\n\t}\n\treturn l_pi;\n}","target":"opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,\n\t\t\t\t\t\t\t\t\t\topj_cp_t *p_cp,\n\t\t\t\t\t\t\t\t\t\tOPJ_UINT32 p_tile_no)\n{\n\t/* loop */\n\tOPJ_UINT32 pino;\n\tOPJ_UINT32 compno, resno;\n\n\t/* to store w, h, dx and dy fro all components and resolutions */\n\tOPJ_UINT32 * l_tmp_data;\n\tOPJ_UINT32 ** l_tmp_ptr;\n\n\t/* encoding prameters to set */\n\tOPJ_UINT32 l_max_res;\n\tOPJ_UINT32 l_max_prec;\n\tOPJ_INT32 l_tx0,l_tx1,l_ty0,l_ty1;\n\tOPJ_UINT32 l_dx_min,l_dy_min;\n\tOPJ_UINT32 l_bound;\n\tOPJ_UINT32 l_step_p , l_step_c , l_step_r , l_step_l ;\n\tOPJ_UINT32 l_data_stride;\n\n\t/* pointers */\n\topj_pi_iterator_t *l_pi = 00;\n\topj_tcp_t *l_tcp = 00;\n\tconst opj_tccp_t *l_tccp = 00;\n\topj_pi_comp_t *l_current_comp = 00;\n\topj_image_comp_t * l_img_comp = 00;\n\topj_pi_iterator_t * l_current_pi = 00;\n\tOPJ_UINT32 * l_encoding_value_ptr = 00;\n\n\t/* preconditions in debug */\n\tassert(p_cp != 00);\n\tassert(p_image != 00);\n\tassert(p_tile_no < p_cp->tw * p_cp->th);\n\n\t/* initializations */\n\tl_tcp = &p_cp->tcps[p_tile_no];\n\tl_bound = l_tcp->numpocs+1;\n\n\tl_data_stride = 4 * OPJ_J2K_MAXRLVLS;\n\tl_tmp_data = (OPJ_UINT32*)opj_malloc(\n\t\tl_data_stride * p_image->numcomps * sizeof(OPJ_UINT32));\n\tif\n\t\t(! l_tmp_data)\n\t{\n\t\treturn 00;\n\t}\n\tl_tmp_ptr = (OPJ_UINT32**)opj_malloc(\n\t\tp_image->numcomps * sizeof(OPJ_UINT32 *));\n\tif\n\t\t(! l_tmp_ptr)\n\t{\n\t\topj_free(l_tmp_data);\n\t\treturn 00;\n\t}\n\n\t/* memory allocation for pi */\n\tl_pi = opj_pi_create(p_image, p_cp, p_tile_no);\n\tif (!l_pi) {\n\t\topj_free(l_tmp_data);\n\t\topj_free(l_tmp_ptr);\n\t\treturn 00;\n\t}\n\n\tl_encoding_value_ptr = l_tmp_data;\n\t/* update pointer array */\n\tfor\n\t\t(compno = 0; compno < p_image->numcomps; ++compno)\n\t{\n\t\tl_tmp_ptr[compno] = l_encoding_value_ptr;\n\t\tl_encoding_value_ptr += l_data_stride;\n\t}\n\t/* get encoding parameters */\n\topj_get_all_encoding_parameters(p_image,p_cp,p_tile_no,&l_tx0,&l_tx1,&l_ty0,&l_ty1,&l_dx_min,&l_dy_min,&l_max_prec,&l_max_res,l_tmp_ptr);\n\n\t/* step calculations */\n\tl_step_p = 1;\n\tl_step_c = l_max_prec * l_step_p;\n\tl_step_r = p_image->numcomps * l_step_c;\n\tl_step_l = l_max_res * l_step_r;\n\n\t/* set values for first packet iterator */\n\tl_current_pi = l_pi;\n\n\t/* memory allocation for include */\n\t/* prevent an integer overflow issue */\n\tl_current_pi->include = 00;\n\tif (l_step_l <= (SIZE_MAX / (l_tcp->numlayers + 1U)))\n\t{\n\t\tl_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));\n\t}\n\n\tif\n\t\t(!l_current_pi->include)\n\t{\n\t\topj_free(l_tmp_data);\n\t\topj_free(l_tmp_ptr);\n\t\topj_pi_destroy(l_pi, l_bound);\n\t\treturn 00;\n\t}\n\n\t/* special treatment for the first packet iterator */\n\tl_current_comp = l_current_pi->comps;\n\tl_img_comp = p_image->comps;\n\tl_tccp = l_tcp->tccps;\n\n\tl_current_pi->tx0 = l_tx0;\n\tl_current_pi->ty0 = l_ty0;\n\tl_current_pi->tx1 = l_tx1;\n\tl_current_pi->ty1 = l_ty1;\n\n\t/*l_current_pi->dx = l_img_comp->dx;*/\n\t/*l_current_pi->dy = l_img_comp->dy;*/\n\n\tl_current_pi->step_p = l_step_p;\n\tl_current_pi->step_c = l_step_c;\n\tl_current_pi->step_r = l_step_r;\n\tl_current_pi->step_l = l_step_l;\n\n\t/* allocation for components and number of components has already been calculated by opj_pi_create */\n\tfor\n\t\t(compno = 0; compno < l_current_pi->numcomps; ++compno)\n\t{\n\t\topj_pi_resolution_t *l_res = l_current_comp->resolutions;\n\t\tl_encoding_value_ptr = l_tmp_ptr[compno];\n\n\t\tl_current_comp->dx = l_img_comp->dx;\n\t\tl_current_comp->dy = l_img_comp->dy;\n\t\t/* resolutions have already been initialized */\n\t\tfor\n\t\t\t(resno = 0; resno < l_current_comp->numresolutions; resno++)\n\t\t{\n\t\t\tl_res->pdx = *(l_encoding_value_ptr++);\n\t\t\tl_res->pdy = *(l_encoding_value_ptr++);\n\t\t\tl_res->pw = *(l_encoding_value_ptr++);\n\t\t\tl_res->ph = *(l_encoding_value_ptr++);\n\t\t\t++l_res;\n\t\t}\n\t\t++l_current_comp;\n\t\t++l_img_comp;\n\t\t++l_tccp;\n\t}\n\t++l_current_pi;\n\n\tfor (pino = 1 ; pinocomps;\n\t\tl_img_comp = p_image->comps;\n\t\tl_tccp = l_tcp->tccps;\n\n\t\tl_current_pi->tx0 = l_tx0;\n\t\tl_current_pi->ty0 = l_ty0;\n\t\tl_current_pi->tx1 = l_tx1;\n\t\tl_current_pi->ty1 = l_ty1;\n\t\t/*l_current_pi->dx = l_dx_min;*/\n\t\t/*l_current_pi->dy = l_dy_min;*/\n\t\tl_current_pi->step_p = l_step_p;\n\t\tl_current_pi->step_c = l_step_c;\n\t\tl_current_pi->step_r = l_step_r;\n\t\tl_current_pi->step_l = l_step_l;\n\n\t\t/* allocation for components and number of components has already been calculated by opj_pi_create */\n\t\tfor\n\t\t\t(compno = 0; compno < l_current_pi->numcomps; ++compno)\n\t\t{\n\t\t\topj_pi_resolution_t *l_res = l_current_comp->resolutions;\n\t\t\tl_encoding_value_ptr = l_tmp_ptr[compno];\n\n\t\t\tl_current_comp->dx = l_img_comp->dx;\n\t\t\tl_current_comp->dy = l_img_comp->dy;\n\t\t\t/* resolutions have already been initialized */\n\t\t\tfor\n\t\t\t\t(resno = 0; resno < l_current_comp->numresolutions; resno++)\n\t\t\t{\n\t\t\t\tl_res->pdx = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->pdy = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->pw = *(l_encoding_value_ptr++);\n\t\t\t\tl_res->ph = *(l_encoding_value_ptr++);\n\t\t\t\t++l_res;\n\t\t\t}\n\t\t\t++l_current_comp;\n\t\t\t++l_img_comp;\n\t\t\t++l_tccp;\n\t\t}\n\t\t/* special treatment*/\n\t\tl_current_pi->include = (l_current_pi-1)->include;\n\t\t++l_current_pi;\n\t}\n\topj_free(l_tmp_data);\n\tl_tmp_data = 00;\n\topj_free(l_tmp_ptr);\n\tl_tmp_ptr = 00;\n\tif\n\t\t(l_tcp->POC)\n\t{\n\t\topj_pi_update_decode_poc (l_pi,l_tcp,l_max_prec,l_max_res);\n\t}\n\telse\n\t{\n\t\topj_pi_update_decode_not_poc(l_pi,l_tcp,l_max_prec,l_max_res);\n\t}\n\treturn l_pi;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"opj_pi_create_decode","file_name":"src/lib/openjp2/pi.c","commit_link":"github.com/uclouvain/openjpeg/commit/c16bc057ba3f125051c9966cf1f5b68a05681de4","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#28-125310adc074","input":"static void opj_j2k_set_cinema_parameters(opj_cparameters_t *parameters,\n opj_image_t *image, opj_event_mgr_t *p_manager)\n{\n /* Configure cinema parameters */\n int i;\n\n /* No tiling */\n parameters->tile_size_on = OPJ_FALSE;\n parameters->cp_tdx = 1;\n parameters->cp_tdy = 1;\n\n /* One tile part for each component */\n parameters->tp_flag = 'C';\n parameters->tp_on = 1;\n\n /* Tile and Image shall be at (0,0) */\n parameters->cp_tx0 = 0;\n parameters->cp_ty0 = 0;\n parameters->image_offset_x0 = 0;\n parameters->image_offset_y0 = 0;\n\n /* Codeblock size= 32*32 */\n parameters->cblockw_init = 32;\n parameters->cblockh_init = 32;\n\n /* Codeblock style: no mode switch enabled */\n parameters->mode = 0;\n\n /* No ROI */\n parameters->roi_compno = -1;\n\n /* No subsampling */\n parameters->subsampling_dx = 1;\n parameters->subsampling_dy = 1;\n\n /* 9-7 transform */\n parameters->irreversible = 1;\n\n /* Number of layers */\n if (parameters->tcp_numlayers > 1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"1 single quality layer\"\n \"-> Number of layers forced to 1 (rather than %d)\\n\"\n \"-> Rate of the last layer (%3.1f) will be used\",\n parameters->tcp_numlayers,\n parameters->tcp_rates[parameters->tcp_numlayers - 1]);\n parameters->tcp_rates[0] = parameters->tcp_rates[parameters->tcp_numlayers - 1];\n parameters->tcp_numlayers = 1;\n }\n\n /* Resolution levels */\n switch (parameters->rsiz) {\n case OPJ_PROFILE_CINEMA_2K:\n if (parameters->numresolution > 6) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 (2k dc profile) requires:\\n\"\n \"Number of decomposition levels <= 5\\n\"\n \"-> Number of decomposition levels forced to 5 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 6;\n }\n break;\n case OPJ_PROFILE_CINEMA_4K:\n if (parameters->numresolution < 2) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"Number of decomposition levels >= 1 && <= 6\\n\"\n \"-> Number of decomposition levels forced to 1 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 1;\n } else if (parameters->numresolution > 7) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"Number of decomposition levels >= 1 && <= 6\\n\"\n \"-> Number of decomposition levels forced to 6 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 7;\n }\n break;\n default :\n break;\n }\n\n /* Precincts */\n parameters->csty |= 0x01;\n parameters->res_spec = parameters->numresolution - 1;\n for (i = 0; i < parameters->res_spec; i++) {\n parameters->prcw_init[i] = 256;\n parameters->prch_init[i] = 256;\n }\n\n /* The progression order shall be CPRL */\n parameters->prog_order = OPJ_CPRL;\n\n /* Progression order changes for 4K, disallowed for 2K */\n if (parameters->rsiz == OPJ_PROFILE_CINEMA_4K) {\n parameters->numpocs = (OPJ_UINT32)opj_j2k_initialise_4K_poc(parameters->POC,\n parameters->numresolution);\n } else {\n parameters->numpocs = 0;\n }\n\n /* Limited bit-rate */\n parameters->cp_disto_alloc = 1;\n if (parameters->max_cs_size <= 0) {\n /* No rate has been introduced, 24 fps is assumed */\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1302083 compressed bytes @ 24fps\\n\"\n \"As no rate has been given, this limit will be used.\\n\");\n } else if (parameters->max_cs_size > OPJ_CINEMA_24_CS) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1302083 compressed bytes @ 24fps\\n\"\n \"-> Specified rate exceeds this limit. Rate will be forced to 1302083 bytes.\\n\");\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n }\n\n if (parameters->max_comp_size <= 0) {\n /* No rate has been introduced, 24 fps is assumed */\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1041666 compressed bytes @ 24fps\\n\"\n \"As no rate has been given, this limit will be used.\\n\");\n } else if (parameters->max_comp_size > OPJ_CINEMA_24_COMP) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1041666 compressed bytes @ 24fps\\n\"\n \"-> Specified rate exceeds this limit. Rate will be forced to 1041666 bytes.\\n\");\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n }\n\n parameters->tcp_rates[0] = (OPJ_FLOAT32)(image->numcomps * image->comps[0].w *\n image->comps[0].h * image->comps[0].prec) /\n (OPJ_FLOAT32)(((OPJ_UINT32)parameters->max_cs_size) * 8 * image->comps[0].dx *\n image->comps[0].dy);\n\n}","target":"static void opj_j2k_set_cinema_parameters(opj_cparameters_t *parameters,\n opj_image_t *image, opj_event_mgr_t *p_manager)\n{\n /* Configure cinema parameters */\n int i;\n\n /* No tiling */\n parameters->tile_size_on = OPJ_FALSE;\n parameters->cp_tdx = 1;\n parameters->cp_tdy = 1;\n\n /* One tile part for each component */\n parameters->tp_flag = 'C';\n parameters->tp_on = 1;\n\n /* Tile and Image shall be at (0,0) */\n parameters->cp_tx0 = 0;\n parameters->cp_ty0 = 0;\n parameters->image_offset_x0 = 0;\n parameters->image_offset_y0 = 0;\n\n /* Codeblock size= 32*32 */\n parameters->cblockw_init = 32;\n parameters->cblockh_init = 32;\n\n /* Codeblock style: no mode switch enabled */\n parameters->mode = 0;\n\n /* No ROI */\n parameters->roi_compno = -1;\n\n /* No subsampling */\n parameters->subsampling_dx = 1;\n parameters->subsampling_dy = 1;\n\n /* 9-7 transform */\n parameters->irreversible = 1;\n\n /* Number of layers */\n if (parameters->tcp_numlayers > 1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"1 single quality layer\"\n \"-> Number of layers forced to 1 (rather than %d)\\n\"\n \"-> Rate of the last layer (%3.1f) will be used\",\n parameters->tcp_numlayers,\n parameters->tcp_rates[parameters->tcp_numlayers - 1]);\n parameters->tcp_rates[0] = parameters->tcp_rates[parameters->tcp_numlayers - 1];\n parameters->tcp_numlayers = 1;\n }\n\n /* Resolution levels */\n switch (parameters->rsiz) {\n case OPJ_PROFILE_CINEMA_2K:\n if (parameters->numresolution > 6) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 (2k dc profile) requires:\\n\"\n \"Number of decomposition levels <= 5\\n\"\n \"-> Number of decomposition levels forced to 5 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 6;\n }\n break;\n case OPJ_PROFILE_CINEMA_4K:\n if (parameters->numresolution < 2) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"Number of decomposition levels >= 1 && <= 6\\n\"\n \"-> Number of decomposition levels forced to 1 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 1;\n } else if (parameters->numresolution > 7) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"Number of decomposition levels >= 1 && <= 6\\n\"\n \"-> Number of decomposition levels forced to 6 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 7;\n }\n break;\n default :\n break;\n }\n\n /* Precincts */\n parameters->csty |= 0x01;\n if (parameters->numresolution == 1) {\n parameters->res_spec = 1;\n parameters->prcw_init[0] = 128;\n parameters->prch_init[0] = 128;\n } else {\n parameters->res_spec = parameters->numresolution - 1;\n for (i = 0; i < parameters->res_spec; i++) {\n parameters->prcw_init[i] = 256;\n parameters->prch_init[i] = 256;\n }\n }\n\n /* The progression order shall be CPRL */\n parameters->prog_order = OPJ_CPRL;\n\n /* Progression order changes for 4K, disallowed for 2K */\n if (parameters->rsiz == OPJ_PROFILE_CINEMA_4K) {\n parameters->numpocs = (OPJ_UINT32)opj_j2k_initialise_4K_poc(parameters->POC,\n parameters->numresolution);\n } else {\n parameters->numpocs = 0;\n }\n\n /* Limited bit-rate */\n parameters->cp_disto_alloc = 1;\n if (parameters->max_cs_size <= 0) {\n /* No rate has been introduced, 24 fps is assumed */\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1302083 compressed bytes @ 24fps\\n\"\n \"As no rate has been given, this limit will be used.\\n\");\n } else if (parameters->max_cs_size > OPJ_CINEMA_24_CS) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1302083 compressed bytes @ 24fps\\n\"\n \"-> Specified rate exceeds this limit. Rate will be forced to 1302083 bytes.\\n\");\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n }\n\n if (parameters->max_comp_size <= 0) {\n /* No rate has been introduced, 24 fps is assumed */\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1041666 compressed bytes @ 24fps\\n\"\n \"As no rate has been given, this limit will be used.\\n\");\n } else if (parameters->max_comp_size > OPJ_CINEMA_24_COMP) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1041666 compressed bytes @ 24fps\\n\"\n \"-> Specified rate exceeds this limit. Rate will be forced to 1041666 bytes.\\n\");\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n }\n\n parameters->tcp_rates[0] = (OPJ_FLOAT32)(image->numcomps * image->comps[0].w *\n image->comps[0].h * image->comps[0].prec) /\n (OPJ_FLOAT32)(((OPJ_UINT32)parameters->max_cs_size) * 8 * image->comps[0].dx *\n image->comps[0].dy);\n\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"opj_j2k_set_cinema_parameters","file_name":"src/lib/openjp2/j2k.c","commit_link":"github.com/uclouvain/openjpeg/commit/4241ae6fbbf1de9658764a80944dc8108f2b4154","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#29-88e64b87e45e","input":"void * adminchild(struct clientparam* param) {\n int i, res;\n char * buf;\n char username[256];\n char *sb;\n char *req = NULL;\n struct printparam pp;\n int contentlen = 0;\n int isform = 0;\n\n pp.inbuf = 0;\n pp.cp = param;\n\n buf = myalloc(LINESIZE);\n if(!buf) {RETURN(555);}\n i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '\\n', conf.timeouts[STRING_S]);\n if(i<5 || ((buf[0]!='G' || buf[1]!='E' || buf[2]!='T' || buf[3]!=' ' || buf[4]!='/') && \n\t (buf[0]!='P' || buf[1]!='O' || buf[2]!='S' || buf[3]!='T' || buf[4]!=' ' || buf[5]!='/')))\n {\n\tRETURN(701);\n }\n buf[i] = 0;\n sb = strchr(buf+5, ' ');\n if(!sb){\n\tRETURN(702);\n }\n *sb = 0;\n req = mystrdup(buf + ((*buf == 'P')? 6 : 5));\n while((i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '\\n', conf.timeouts[STRING_S])) > 2){\n\tbuf[i] = 0;\n\tif(i > 19 && (!strncasecmp(buf, \"authorization\", 13))){\n\t\tsb = strchr(buf, ':');\n\t\tif(!sb)continue;\n\t\t++sb;\n\t\twhile(isspace(*sb))sb++;\n\t\tif(!*sb || strncasecmp(sb, \"basic\", 5)){\n\t\t\tcontinue;\n\t\t}\n\t\tsb+=5;\n\t\twhile(isspace(*sb))sb++;\n\t\ti = de64((unsigned char *)sb, (unsigned char *)username, 255);\n\t\tif(i<=0)continue;\n\t\tusername[i] = 0;\n\t\tsb = strchr((char *)username, ':');\n\t\tif(sb){\n\t\t\t*sb = 0;\n\t\t\tif(param->password)myfree(param->password);\n\t\t\tparam->password = (unsigned char *)mystrdup(sb+1);\n\t\t}\n\t\tif(param->username) myfree(param->username);\n\t\tparam->username = (unsigned char *)mystrdup(username);\n\t\tcontinue;\n\t}\n\telse if(i > 15 && (!strncasecmp(buf, \"content-length:\", 15))){\n\t\tsb = buf + 15;\n\t\twhile(isspace(*sb))sb++;\n\t\tcontentlen = atoi(sb);\n\t}\n\telse if(i > 13 && (!strncasecmp(buf, \"content-type:\", 13))){\n\t\tsb = buf + 13;\n\t\twhile(isspace(*sb))sb++;\n\t\tif(!strncasecmp(sb, \"x-www-form-urlencoded\", 21)) isform = 1;\n\t}\n }\n param->operation = ADMIN;\n if(isform && contentlen) {\n\tprintstr(&pp, \"HTTP/1.0 100 Continue\\r\\n\\r\\n\");\n\tstdpr(&pp, NULL, 0);\n }\n res = (*param->srv->authfunc)(param);\n if(res && res != 10) {\n\tprintstr(&pp, authreq);\n\tRETURN(res);\n }\n if(param->srv->singlepacket || param->redirected){\n\tif(*req == 'C') req[1] = 0;\n\telse *req = 0;\n }\n sprintf(buf, ok, conf.stringtable?(char *)conf.stringtable[2]:\"3proxy\", conf.stringtable?(char *)conf.stringtable[2]:\"3[APA3A] tiny proxy\", conf.stringtable?(char *)conf.stringtable[3]:\"\");\n if(*req != 'S') printstr(&pp, buf);\n switch(*req){\n\tcase 'C':\n\t\tprintstr(&pp, counters);\n\t\t{\n\t\t\tstruct trafcount *cp; \n\t\t\tint num = 0;\n\t\t\tfor(cp = conf.trafcounter; cp; cp = cp->next, num++){\n\t\t\t int inbuf = 0;\n\n\t\t\t if(cp->ace && (param->srv->singlepacket || param->redirected)){\n\t\t\t\tif(!ACLmatches(cp->ace, param))continue;\n\t\t\t }\n\t\t\t if(req[1] == 'S' && atoi(req+2) == num) cp->disabled=0;\n\t\t\t if(req[1] == 'D' && atoi(req+2) == num) cp->disabled=1;\n\t\t\t inbuf += sprintf(buf,\t\"\"\n\t\t\t\t\t\t\"%s%s\",\n\t\t\t\t\t\t(cp->comment)?cp->comment:\" \",\n\t\t\t\t\t\t(cp->disabled)?'S':'D',\n\t\t\t\t\t\tnum,\n\t\t\t\t\t\t(cp->disabled)?\"NO\":\"YES\"\n\t\t\t\t\t);\n\t\t\t if(!cp->ace || !cp->ace->users){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printuserlist(buf+inbuf, LINESIZE-800, cp->ace->users, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->src){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printiplist(buf+inbuf, LINESIZE-512, cp->ace->src, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->dst){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printiplist(buf+inbuf, LINESIZE-512, cp->ace->dst, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->ports){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printportlist(buf+inbuf, LINESIZE-128, cp->ace->ports, \",
\\r\\n\");\n\t\t\t }\n\t\t\t if(cp->type == NONE) {\n\t\t\t inbuf += sprintf(buf+inbuf,\t\n\t\t\t\t\t\"exclude from limitation\\r\\n\"\n\t\t\t\t );\n\t\t\t }\n\t\t\t else {\n\t\t\t inbuf += sprintf(buf+inbuf,\t\n\t\t\t\t\t\"%\"PRINTF_INT64_MODIFIER\"u\"\n\t\t\t\t\t\"MB%s\"\n\t\t\t\t\t\"%\"PRINTF_INT64_MODIFIER\"u\"\n\t\t\t\t\t\"%s\",\n\t\t\t\t cp->traflim64 / (1024 * 1024),\n\t\t\t\t rotations[cp->type],\n\t\t\t\t cp->traf64,\n\t\t\t\t cp->cleared?ctime(&cp->cleared):\"never\"\n\t\t\t\t);\n\t\t\t inbuf += sprintf(buf + inbuf,\n\t\t\t\t\t\"%s\"\n\t\t\t\t\t\"%i\"\n\t\t\t\t\t\"\\r\\n\",\n\n\t\t\t\t cp->updated?ctime(&cp->updated):\"never\",\n\t\t\t\t cp->number\n\t\t\t\t);\n\t\t\t }\n\t\t\t printstr(&pp, buf);\n\t\t\t}\n\n\t\t}\n\t\tprintstr(&pp, counterstail);\n\t\tbreak;\n\t\t\n\tcase 'R':\n\t\tconf.needreload = 1;\n\t\tprintstr(&pp, \"

Reload scheduled

\");\n\t\tbreak;\n\tcase 'S':\n\t\t{\n\t\t\tif(req[1] == 'X'){\n\t\t\t\tprintstr(&pp, style);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tprintstr(&pp, xml);\n\t\t\tprintval(conf.services, TYPE_SERVER, 0, &pp);\n\t\t\tprintstr(&pp, postxml);\n\t\t}\n\t\t\tbreak;\n\tcase 'F':\n\t\t{\n\t\t\tFILE *fp;\n\t\t\tchar buf[256];\n\n\t\t\tfp = confopen();\n\t\t\tif(!fp){\n\t\t\t\tprintstr(&pp, \"

Failed to open config file

\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\tprintstr(&pp, \"

Please be careful editing config file remotely

\");\n\t\t\t\tprintstr(&pp, \"

\");\n\t\t\tbreak;\n\t\t}\n\tcase 'U':\n\t\t{\n\t\t\tint l=0;\n\t\t\tint error = 0;\n\n\t\t\tif(!writable || fseek(writable, 0, 0)){\n\t\t\t\terror = 1;\n\t\t\t}\n\t\t\twhile((i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '+', conf.timeouts[STRING_S])) > 0){\n\t\t\t\tif(i > (contentlen - l)) i = (contentlen - l);\n\t\t\t\tbuf[i] = 0;\n\t\t\t\tif(!l){\n\t\t\t\t\tif(strncasecmp(buf, \"conffile=\", 9)) error = 1;\n\t\t\t\t}\n\t\t\t\tif(!error){\n\t\t\t\t\tdecodeurl((unsigned char *)buf, 1);\n\t\t\t\t\tfprintf(writable, \"%s\", l? buf : buf + 9);\n\t\t\t\t}\n\t\t\t\tl += i;\n\t\t\t\tif(l >= contentlen) break;\n\t\t\t}\n\t\t\tif(writable && !error){\n\t\t\t\tfflush(writable);\n#ifndef _WINCE\n\t\t\t\tftruncate(fileno(writable), ftell(writable));\n#endif\n\t\t\t}\n\t\t\tprintstr(&pp, error? \"

Config file is not writable

Make sure you have \\\"writable\\\" command in configuration file\":\n\t\t\t\t\t\t\"

Configuration updated

\");\n\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tprintstr(&pp, (char *)conf.stringtable[WEBBANNERS]);\n\t\tbreak;\n }\n if(*req != 'S') printstr(&pp, tail);\n\nCLEANRET:\n\n\n printstr(&pp, NULL);\n if(buf) myfree(buf);\n (*param->srv->logfunc)(param, (unsigned char *)req);\n if(req)myfree(req);\n freeparam(param);\n return (NULL);\n}","target":"void * adminchild(struct clientparam* param) {\n int i, res;\n char * buf;\n char username[256];\n char *sb;\n char *req = NULL;\n struct printparam pp;\n unsigned contentlen = 0;\n int isform = 0;\n\n pp.inbuf = 0;\n pp.cp = param;\n\n buf = myalloc(LINESIZE);\n if(!buf) {RETURN(555);}\n i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '\\n', conf.timeouts[STRING_S]);\n if(i<5 || ((buf[0]!='G' || buf[1]!='E' || buf[2]!='T' || buf[3]!=' ' || buf[4]!='/') && \n\t (buf[0]!='P' || buf[1]!='O' || buf[2]!='S' || buf[3]!='T' || buf[4]!=' ' || buf[5]!='/')))\n {\n\tRETURN(701);\n }\n buf[i] = 0;\n sb = strchr(buf+5, ' ');\n if(!sb){\n\tRETURN(702);\n }\n *sb = 0;\n req = mystrdup(buf + ((*buf == 'P')? 6 : 5));\n while((i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '\\n', conf.timeouts[STRING_S])) > 2){\n\tbuf[i] = 0;\n\tif(i > 19 && (!strncasecmp(buf, \"authorization\", 13))){\n\t\tsb = strchr(buf, ':');\n\t\tif(!sb)continue;\n\t\t++sb;\n\t\twhile(isspace(*sb))sb++;\n\t\tif(!*sb || strncasecmp(sb, \"basic\", 5)){\n\t\t\tcontinue;\n\t\t}\n\t\tsb+=5;\n\t\twhile(isspace(*sb))sb++;\n\t\ti = de64((unsigned char *)sb, (unsigned char *)username, 255);\n\t\tif(i<=0)continue;\n\t\tusername[i] = 0;\n\t\tsb = strchr((char *)username, ':');\n\t\tif(sb){\n\t\t\t*sb = 0;\n\t\t\tif(param->password)myfree(param->password);\n\t\t\tparam->password = (unsigned char *)mystrdup(sb+1);\n\t\t}\n\t\tif(param->username) myfree(param->username);\n\t\tparam->username = (unsigned char *)mystrdup(username);\n\t\tcontinue;\n\t}\n\telse if(i > 15 && (!strncasecmp(buf, \"content-length:\", 15))){\n\t\tsb = buf + 15;\n\t\twhile(isspace(*sb))sb++;\n\t\tsscanf(sb, \"%u\", &contentlen);\n\t\tif(contentlen > LINESIZE*1024) contentlen = 0;\n\t}\n\telse if(i > 13 && (!strncasecmp(buf, \"content-type:\", 13))){\n\t\tsb = buf + 13;\n\t\twhile(isspace(*sb))sb++;\n\t\tif(!strncasecmp(sb, \"x-www-form-urlencoded\", 21)) isform = 1;\n\t}\n }\n param->operation = ADMIN;\n if(isform && contentlen) {\n\tprintstr(&pp, \"HTTP/1.0 100 Continue\\r\\n\\r\\n\");\n\tstdpr(&pp, NULL, 0);\n }\n res = (*param->srv->authfunc)(param);\n if(res && res != 10) {\n\tprintstr(&pp, authreq);\n\tRETURN(res);\n }\n if(param->srv->singlepacket || param->redirected){\n\tif(*req == 'C') req[1] = 0;\n\telse *req = 0;\n }\n sprintf(buf, ok, conf.stringtable?(char *)conf.stringtable[2]:\"3proxy\", conf.stringtable?(char *)conf.stringtable[2]:\"3[APA3A] tiny proxy\", conf.stringtable?(char *)conf.stringtable[3]:\"\");\n if(*req != 'S') printstr(&pp, buf);\n switch(*req){\n\tcase 'C':\n\t\tprintstr(&pp, counters);\n\t\t{\n\t\t\tstruct trafcount *cp; \n\t\t\tint num = 0;\n\t\t\tfor(cp = conf.trafcounter; cp; cp = cp->next, num++){\n\t\t\t int inbuf = 0;\n\n\t\t\t if(cp->ace && (param->srv->singlepacket || param->redirected)){\n\t\t\t\tif(!ACLmatches(cp->ace, param))continue;\n\t\t\t }\n\t\t\t if(req[1] == 'S' && atoi(req+2) == num) cp->disabled=0;\n\t\t\t if(req[1] == 'D' && atoi(req+2) == num) cp->disabled=1;\n\t\t\t inbuf += sprintf(buf,\t\"\"\n\t\t\t\t\t\t\"%s%s\",\n\t\t\t\t\t\t(cp->comment)?cp->comment:\" \",\n\t\t\t\t\t\t(cp->disabled)?'S':'D',\n\t\t\t\t\t\tnum,\n\t\t\t\t\t\t(cp->disabled)?\"NO\":\"YES\"\n\t\t\t\t\t);\n\t\t\t if(!cp->ace || !cp->ace->users){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printuserlist(buf+inbuf, LINESIZE-800, cp->ace->users, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->src){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printiplist(buf+inbuf, LINESIZE-512, cp->ace->src, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->dst){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printiplist(buf+inbuf, LINESIZE-512, cp->ace->dst, \",
\\r\\n\");\n\t\t\t }\n\t\t\t inbuf += sprintf(buf+inbuf, \"\");\n\t\t\t if(!cp->ace || !cp->ace->ports){\n\t\t\t\tinbuf += sprintf(buf+inbuf, \"
ANY
\");\n\t\t\t }\n\t\t\t else {\n\t\t\t\tinbuf += printportlist(buf+inbuf, LINESIZE-128, cp->ace->ports, \",
\\r\\n\");\n\t\t\t }\n\t\t\t if(cp->type == NONE) {\n\t\t\t inbuf += sprintf(buf+inbuf,\t\n\t\t\t\t\t\"exclude from limitation\\r\\n\"\n\t\t\t\t );\n\t\t\t }\n\t\t\t else {\n\t\t\t inbuf += sprintf(buf+inbuf,\t\n\t\t\t\t\t\"%\"PRINTF_INT64_MODIFIER\"u\"\n\t\t\t\t\t\"MB%s\"\n\t\t\t\t\t\"%\"PRINTF_INT64_MODIFIER\"u\"\n\t\t\t\t\t\"%s\",\n\t\t\t\t cp->traflim64 / (1024 * 1024),\n\t\t\t\t rotations[cp->type],\n\t\t\t\t cp->traf64,\n\t\t\t\t cp->cleared?ctime(&cp->cleared):\"never\"\n\t\t\t\t);\n\t\t\t inbuf += sprintf(buf + inbuf,\n\t\t\t\t\t\"%s\"\n\t\t\t\t\t\"%i\"\n\t\t\t\t\t\"\\r\\n\",\n\n\t\t\t\t cp->updated?ctime(&cp->updated):\"never\",\n\t\t\t\t cp->number\n\t\t\t\t);\n\t\t\t }\n\t\t\t printstr(&pp, buf);\n\t\t\t}\n\n\t\t}\n\t\tprintstr(&pp, counterstail);\n\t\tbreak;\n\t\t\n\tcase 'R':\n\t\tconf.needreload = 1;\n\t\tprintstr(&pp, \"

Reload scheduled

\");\n\t\tbreak;\n\tcase 'S':\n\t\t{\n\t\t\tif(req[1] == 'X'){\n\t\t\t\tprintstr(&pp, style);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tprintstr(&pp, xml);\n\t\t\tprintval(conf.services, TYPE_SERVER, 0, &pp);\n\t\t\tprintstr(&pp, postxml);\n\t\t}\n\t\t\tbreak;\n\tcase 'F':\n\t\t{\n\t\t\tFILE *fp;\n\t\t\tchar buf[256];\n\n\t\t\tfp = confopen();\n\t\t\tif(!fp){\n\t\t\t\tprintstr(&pp, \"

Failed to open config file

\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\tprintstr(&pp, \"

Please be careful editing config file remotely

\");\n\t\t\t\tprintstr(&pp, \"

\");\n\t\t\tbreak;\n\t\t}\n\tcase 'U':\n\t\t{\n\t\t\tunsigned l=0;\n\t\t\tint error = 0;\n\n\t\t\tif(!writable || !contentlen || fseek(writable, 0, 0)){\n\t\t\t\terror = 1;\n\t\t\t}\n\t\t\twhile(l < contentlen && (i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, (contentlen - l) > LINESIZE - 1?LINESIZE - 1:contentlen - l, '+', conf.timeouts[STRING_S])) > 0){\n\t\t\t\tif(i > (contentlen - l)) i = (contentlen - l);\n\t\t\t\tif(!l){\n\t\t\t\t\tif(i<9 || strncasecmp(buf, \"conffile=\", 9)) error = 1;\n\t\t\t\t}\n\t\t\t\tif(!error){\n\t\t\t\t\tbuf[i] = 0;\n\t\t\t\t\tdecodeurl((unsigned char *)buf, 1);\n\t\t\t\t\tfprintf(writable, \"%s\", l? buf : buf + 9);\n\t\t\t\t}\n\t\t\t\tl += i;\n\t\t\t}\n\t\t\tif(writable && !error){\n\t\t\t\tfflush(writable);\n#ifndef _WINCE\n\t\t\t\tftruncate(fileno(writable), ftell(writable));\n#endif\n\t\t\t}\n\t\t\tprintstr(&pp, error? \"

Config file is not writable

Make sure you have \\\"writable\\\" command in configuration file\":\n\t\t\t\t\t\t\"

Configuration updated

\");\n\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tprintstr(&pp, (char *)conf.stringtable[WEBBANNERS]);\n\t\tbreak;\n }\n if(*req != 'S') printstr(&pp, tail);\n\nCLEANRET:\n\n\n printstr(&pp, NULL);\n if(buf) myfree(buf);\n (*param->srv->logfunc)(param, (unsigned char *)req);\n if(req)myfree(req);\n freeparam(param);\n return (NULL);\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"adminchild","file_name":"src/webadmin.c","commit_link":"github.com/z3APA3A/3proxy/commit/3b67dc844789dc0f00e934270c7b349bcb547865","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#30-c1a8db8a64f6","input":"int ecall_restore(const char *input, uint64_t input_len, char **output,\n uint64_t *output_len) {\n if (!asylo::primitives::TrustedPrimitives::IsOutsideEnclave(input,\n input_len) ||\n !asylo::primitives::TrustedPrimitives::IsOutsideEnclave(\n output_len, sizeof(uint64_t))) {\n asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"ecall_restore: input/output found to not be in untrusted memory.\");\n }\n int result = 0;\n size_t tmp_output_len;\n try {\n result = asylo::Restore(input, static_cast(input_len), output,\n &tmp_output_len);\n } catch (...) {\n LOG(FATAL) << \"Uncaught exception in enclave\";\n }\n\n if (output_len) {\n *output_len = static_cast(tmp_output_len);\n }\n return result;\n}","target":"int ecall_restore(const char *input, uint64_t input_len, char **output,\n uint64_t *output_len) {\n if (!asylo::primitives::TrustedPrimitives::IsOutsideEnclave(input,\n input_len) ||\n !asylo::primitives::TrustedPrimitives::IsOutsideEnclave(\n output_len, sizeof(uint64_t)) ||\n !asylo::primitives::TrustedPrimitives::IsOutsideEnclave(output,\n *output_len)) {\n asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"ecall_restore: input/output found to not be in untrusted memory.\");\n }\n int result = 0;\n size_t tmp_output_len;\n try {\n result = asylo::Restore(input, static_cast(input_len), output,\n &tmp_output_len);\n } catch (...) {\n LOG(FATAL) << \"Uncaught exception in enclave\";\n }\n\n if (output_len) {\n *output_len = static_cast(tmp_output_len);\n }\n return result;\n}","lang":"cpp","vul_type":"cwe-787","sven_meta":{"func_name":"ecall_restore","file_name":"asylo/platform/primitives/sgx/ecalls.cc","commit_link":"github.com/google/asylo/commit/382da2b8b09cbf928668a2445efb778f76bd9c8a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#31-fc99fe3f0b38","input":"static void handle_PORT(ctrl_t *ctrl, char *str)\n{\n\tint a, b, c, d, e, f;\n\tchar addr[INET_ADDRSTRLEN];\n\tstruct sockaddr_in sin;\n\n\tif (ctrl->data_sd > 0) {\n\t\tuev_io_stop(&ctrl->data_watcher);\n\t\tclose(ctrl->data_sd);\n\t\tctrl->data_sd = -1;\n\t}\n\n\t/* Convert PORT command's argument to IP address + port */\n\tsscanf(str, \"%d,%d,%d,%d,%d,%d\", &a, &b, &c, &d, &e, &f);\n\tsprintf(addr, \"%d.%d.%d.%d\", a, b, c, d);\n\n\t/* Check IPv4 address using inet_aton(), throw away converted result */\n\tif (!inet_aton(addr, &(sin.sin_addr))) {\n\t\tERR(0, \"Invalid address '%s' given to PORT command\", addr);\n\t\tsend_msg(ctrl->sd, \"500 Illegal PORT command.\\r\\n\");\n\t\treturn;\n\t}\n\n\tstrlcpy(ctrl->data_address, addr, sizeof(ctrl->data_address));\n\tctrl->data_port = e * 256 + f;\n\n\tDBG(\"Client PORT command accepted for %s:%d\", ctrl->data_address, ctrl->data_port);\n\tsend_msg(ctrl->sd, \"200 PORT command successful.\\r\\n\");\n}","target":"static void handle_PORT(ctrl_t *ctrl, char *str)\n{\n\tint a, b, c, d, e, f;\n\tchar addr[INET_ADDRSTRLEN];\n\tstruct sockaddr_in sin;\n\n\tif (ctrl->data_sd > 0) {\n\t\tuev_io_stop(&ctrl->data_watcher);\n\t\tclose(ctrl->data_sd);\n\t\tctrl->data_sd = -1;\n\t}\n\n\t/* Convert PORT command's argument to IP address + port */\n\tsscanf(str, \"%d,%d,%d,%d,%d,%d\", &a, &b, &c, &d, &e, &f);\n\tsnprintf(addr, sizeof(addr), \"%d.%d.%d.%d\", a, b, c, d);\n\n\t/* Check IPv4 address using inet_aton(), throw away converted result */\n\tif (!inet_aton(addr, &(sin.sin_addr))) {\n\t\tERR(0, \"Invalid address '%s' given to PORT command\", addr);\n\t\tsend_msg(ctrl->sd, \"500 Illegal PORT command.\\r\\n\");\n\t\treturn;\n\t}\n\n\tstrlcpy(ctrl->data_address, addr, sizeof(ctrl->data_address));\n\tctrl->data_port = e * 256 + f;\n\n\tDBG(\"Client PORT command accepted for %s:%d\", ctrl->data_address, ctrl->data_port);\n\tsend_msg(ctrl->sd, \"200 PORT command successful.\\r\\n\");\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"handle_PORT","file_name":"src/ftpcmd.c","commit_link":"github.com/troglobit/uftpd/commit/0fb2c031ce0ace07cc19cd2cb2143c4b5a63c9dd","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#32-36a832e48755","input":"int rom_copy(uint8_t *dest, hwaddr addr, size_t size)\n{\n hwaddr end = addr + size;\n uint8_t *s, *d = dest;\n size_t l = 0;\n Rom *rom;\n\n QTAILQ_FOREACH(rom, &roms, next) {\n if (rom->fw_file) {\n continue;\n }\n if (rom->mr) {\n continue;\n }\n if (rom->addr + rom->romsize < addr) {\n continue;\n }\n if (rom->addr > end) {\n break;\n }\n\n d = dest + (rom->addr - addr);\n s = rom->data;\n l = rom->datasize;\n\n if ((d + l) > (dest + size)) {\n l = dest - d;\n }\n\n if (l > 0) {\n memcpy(d, s, l);\n }\n\n if (rom->romsize > rom->datasize) {\n /* If datasize is less than romsize, it means that we didn't\n * allocate all the ROM because the trailing data are only zeros.\n */\n\n d += l;\n l = rom->romsize - rom->datasize;\n\n if ((d + l) > (dest + size)) {\n /* Rom size doesn't fit in the destination area. Adjust to avoid\n * overflow.\n */\n l = dest - d;\n }\n\n if (l > 0) {\n memset(d, 0x0, l);\n }\n }\n }\n\n return (d + l) - dest;\n}","target":"int rom_copy(uint8_t *dest, hwaddr addr, size_t size)\n{\n hwaddr end = addr + size;\n uint8_t *s, *d = dest;\n size_t l = 0;\n Rom *rom;\n\n QTAILQ_FOREACH(rom, &roms, next) {\n if (rom->fw_file) {\n continue;\n }\n if (rom->mr) {\n continue;\n }\n if (rom->addr + rom->romsize < addr) {\n continue;\n }\n if (rom->addr > end || rom->addr < addr) {\n break;\n }\n\n d = dest + (rom->addr - addr);\n s = rom->data;\n l = rom->datasize;\n\n if ((d + l) > (dest + size)) {\n l = dest - d;\n }\n\n if (l > 0) {\n memcpy(d, s, l);\n }\n\n if (rom->romsize > rom->datasize) {\n /* If datasize is less than romsize, it means that we didn't\n * allocate all the ROM because the trailing data are only zeros.\n */\n\n d += l;\n l = rom->romsize - rom->datasize;\n\n if ((d + l) > (dest + size)) {\n /* Rom size doesn't fit in the destination area. Adjust to avoid\n * overflow.\n */\n l = dest - d;\n }\n\n if (l > 0) {\n memset(d, 0x0, l);\n }\n }\n }\n\n return (d + l) - dest;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"rom_copy","file_name":"hw/core/loader.c","commit_link":"github.com/qemu/qemu/commit/4f1c6cb2f9afafda05eab150fd2bd284edce6676","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#33-dc72d21d516c","input":"NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)\n{\n\tstatic const char module[] = \"NeXTDecode\";\n\tunsigned char *bp, *op;\n\ttmsize_t cc;\n\tuint8* row;\n\ttmsize_t scanline, n;\n\n\t(void) s;\n\t/*\n\t * Each scanline is assumed to start off as all\n\t * white (we assume a PhotometricInterpretation\n\t * of ``min-is-black'').\n\t */\n\tfor (op = (unsigned char*) buf, cc = occ; cc-- > 0;)\n\t\t*op++ = 0xff;\n\n\tbp = (unsigned char *)tif->tif_rawcp;\n\tcc = tif->tif_rawcc;\n\tscanline = tif->tif_scanlinesize;\n\tif (occ % scanline)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Fractional scanlines cannot be read\");\n\t\treturn (0);\n\t}\n\tfor (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline) {\n\t\tn = *bp++, cc--;\n\t\tswitch (n) {\n\t\tcase LITERALROW:\n\t\t\t/*\n\t\t\t * The entire scanline is given as literal values.\n\t\t\t */\n\t\t\tif (cc < scanline)\n\t\t\t\tgoto bad;\n\t\t\t_TIFFmemcpy(row, bp, scanline);\n\t\t\tbp += scanline;\n\t\t\tcc -= scanline;\n\t\t\tbreak;\n\t\tcase LITERALSPAN: {\n\t\t\ttmsize_t off;\n\t\t\t/*\n\t\t\t * The scanline has a literal span that begins at some\n\t\t\t * offset.\n\t\t\t */\n\t\t\tif( cc < 4 )\n\t\t\t\tgoto bad;\n\t\t\toff = (bp[0] * 256) + bp[1];\n\t\t\tn = (bp[2] * 256) + bp[3];\n\t\t\tif (cc < 4+n || off+n > scanline)\n\t\t\t\tgoto bad;\n\t\t\t_TIFFmemcpy(row+off, bp+4, n);\n\t\t\tbp += 4+n;\n\t\t\tcc -= 4+n;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tuint32 npixels = 0, grey;\n\t\t\tuint32 imagewidth = tif->tif_dir.td_imagewidth;\n if( isTiled(tif) )\n imagewidth = tif->tif_dir.td_tilewidth;\n\n\t\t\t/*\n\t\t\t * The scanline is composed of a sequence of constant\n\t\t\t * color ``runs''. We shift into ``run mode'' and\n\t\t\t * interpret bytes as codes of the form\n\t\t\t * until we've filled the scanline.\n\t\t\t */\n\t\t\top = row;\n\t\t\tfor (;;) {\n\t\t\t\tgrey = (uint32)((n>>6) & 0x3);\n\t\t\t\tn &= 0x3f;\n\t\t\t\t/*\n\t\t\t\t * Ensure the run does not exceed the scanline\n\t\t\t\t * bounds, potentially resulting in a security\n\t\t\t\t * issue.\n\t\t\t\t */\n\t\t\t\twhile (n-- > 0 && npixels < imagewidth)\n\t\t\t\t\tSETPIXEL(op, grey);\n\t\t\t\tif (npixels >= imagewidth)\n\t\t\t\t\tbreak;\n\t\t\t\tif (cc == 0)\n\t\t\t\t\tgoto bad;\n\t\t\t\tn = *bp++, cc--;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\t}\n\t}\n\ttif->tif_rawcp = (uint8*) bp;\n\ttif->tif_rawcc = cc;\n\treturn (1);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, module, \"Not enough data for scanline %ld\",\n\t (long) tif->tif_row);\n\treturn (0);\n}","target":"NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)\n{\n\tstatic const char module[] = \"NeXTDecode\";\n\tunsigned char *bp, *op;\n\ttmsize_t cc;\n\tuint8* row;\n\ttmsize_t scanline, n;\n\n\t(void) s;\n\t/*\n\t * Each scanline is assumed to start off as all\n\t * white (we assume a PhotometricInterpretation\n\t * of ``min-is-black'').\n\t */\n\tfor (op = (unsigned char*) buf, cc = occ; cc-- > 0;)\n\t\t*op++ = 0xff;\n\n\tbp = (unsigned char *)tif->tif_rawcp;\n\tcc = tif->tif_rawcc;\n\tscanline = tif->tif_scanlinesize;\n\tif (occ % scanline)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata, module, \"Fractional scanlines cannot be read\");\n\t\treturn (0);\n\t}\n\tfor (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline) {\n\t\tn = *bp++, cc--;\n\t\tswitch (n) {\n\t\tcase LITERALROW:\n\t\t\t/*\n\t\t\t * The entire scanline is given as literal values.\n\t\t\t */\n\t\t\tif (cc < scanline)\n\t\t\t\tgoto bad;\n\t\t\t_TIFFmemcpy(row, bp, scanline);\n\t\t\tbp += scanline;\n\t\t\tcc -= scanline;\n\t\t\tbreak;\n\t\tcase LITERALSPAN: {\n\t\t\ttmsize_t off;\n\t\t\t/*\n\t\t\t * The scanline has a literal span that begins at some\n\t\t\t * offset.\n\t\t\t */\n\t\t\tif( cc < 4 )\n\t\t\t\tgoto bad;\n\t\t\toff = (bp[0] * 256) + bp[1];\n\t\t\tn = (bp[2] * 256) + bp[3];\n\t\t\tif (cc < 4+n || off+n > scanline)\n\t\t\t\tgoto bad;\n\t\t\t_TIFFmemcpy(row+off, bp+4, n);\n\t\t\tbp += 4+n;\n\t\t\tcc -= 4+n;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tuint32 npixels = 0, grey;\n\t\t\tuint32 imagewidth = tif->tif_dir.td_imagewidth;\n if( isTiled(tif) )\n imagewidth = tif->tif_dir.td_tilewidth;\n tmsize_t op_offset = 0;\n\n\t\t\t/*\n\t\t\t * The scanline is composed of a sequence of constant\n\t\t\t * color ``runs''. We shift into ``run mode'' and\n\t\t\t * interpret bytes as codes of the form\n\t\t\t * until we've filled the scanline.\n\t\t\t */\n\t\t\top = row;\n\t\t\tfor (;;) {\n\t\t\t\tgrey = (uint32)((n>>6) & 0x3);\n\t\t\t\tn &= 0x3f;\n\t\t\t\t/*\n\t\t\t\t * Ensure the run does not exceed the scanline\n\t\t\t\t * bounds, potentially resulting in a security\n\t\t\t\t * issue.\n\t\t\t\t */\n\t\t\t\twhile (n-- > 0 && npixels < imagewidth && op_offset < scanline)\n\t\t\t\t\tSETPIXEL(op, grey);\n\t\t\t\tif (npixels >= imagewidth)\n\t\t\t\t\tbreak;\n if (op_offset >= scanline ) {\n TIFFErrorExt(tif->tif_clientdata, module, \"Invalid data for scanline %ld\",\n (long) tif->tif_row);\n return (0);\n }\n\t\t\t\tif (cc == 0)\n\t\t\t\t\tgoto bad;\n\t\t\t\tn = *bp++, cc--;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\t}\n\t}\n\ttif->tif_rawcp = (uint8*) bp;\n\ttif->tif_rawcc = cc;\n\treturn (1);\nbad:\n\tTIFFErrorExt(tif->tif_clientdata, module, \"Not enough data for scanline %ld\",\n\t (long) tif->tif_row);\n\treturn (0);\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"NeXTDecode","file_name":"libtiff/tif_next.c","commit_link":"github.com/vadz/libtiff/commit/b18012dae552f85dcc5c57d3bf4e997a15b1cc1c","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#34-3eda953a2788","input":"TiledInputFile::rawTileData (int &dx, int &dy,\n\t\t\t int &lx, int &ly,\n const char *&pixelData,\n\t\t\t int &pixelDataSize)\n{\n try\n {\n Lock lock (*_data->_streamData);\n\n if (!isValidTile (dx, dy, lx, ly))\n throw IEX_NAMESPACE::ArgExc (\"Tried to read a tile outside \"\n\t\t\t \"the image file's data window.\");\n\n TileBuffer *tileBuffer = _data->getTileBuffer (0);\n\n //\n // if file is a multipart file, we have to seek to the required tile\n // since we don't know where the file pointer is\n //\n int old_dx=dx;\n int old_dy=dy;\n int old_lx=lx;\n int old_ly=ly;\n if(isMultiPart(version()))\n {\n _data->_streamData->is->seekg(_data->tileOffsets(dx,dy,lx,ly));\n }\n readNextTileData (_data->_streamData, _data, dx, dy, lx, ly,\n\t\t\t tileBuffer->buffer,\n pixelDataSize);\n if(isMultiPart(version()))\n {\n if (old_dx!=dx || old_dy !=dy || old_lx!=lx || old_ly!=ly)\n {\n throw IEX_NAMESPACE::ArgExc (\"rawTileData read the wrong tile\");\n }\n }\n pixelData = tileBuffer->buffer;\n }\n catch (IEX_NAMESPACE::BaseExc &e)\n {\n REPLACE_EXC (e, \"Error reading pixel data from image \"\n \"file \\\"\" << fileName() << \"\\\". \" << e.what());\n throw;\n }\n}","target":"TiledInputFile::rawTileData (int &dx, int &dy,\n\t\t\t int &lx, int &ly,\n const char *&pixelData,\n\t\t\t int &pixelDataSize)\n{\n try\n {\n Lock lock (*_data->_streamData);\n\n if (!isValidTile (dx, dy, lx, ly))\n throw IEX_NAMESPACE::ArgExc (\"Tried to read a tile outside \"\n\t\t\t \"the image file's data window.\");\n\n TileBuffer *tileBuffer = _data->getTileBuffer (0);\n\n //\n // if file is a multipart file, we have to seek to the required tile\n // since we don't know where the file pointer is\n //\n int old_dx=dx;\n int old_dy=dy;\n int old_lx=lx;\n int old_ly=ly;\n if(isMultiPart(version()))\n {\n _data->_streamData->is->seekg(_data->tileOffsets(dx,dy,lx,ly));\n }\n readNextTileData (_data->_streamData, _data, dx, dy, lx, ly,\n\t\t\t tileBuffer->buffer,\n pixelDataSize);\n if(isMultiPart(version()))\n {\n if (old_dx!=dx || old_dy !=dy || old_lx!=lx || old_ly!=ly)\n {\n throw IEX_NAMESPACE::ArgExc (\"rawTileData read the wrong tile\");\n }\n }\n else\n {\n if(!isValidTile (dx, dy, lx, ly) )\n {\n throw IEX_NAMESPACE::IoExc (\"rawTileData read an invalid tile\");\n }\n }\n pixelData = tileBuffer->buffer;\n }\n catch (IEX_NAMESPACE::BaseExc &e)\n {\n REPLACE_EXC (e, \"Error reading pixel data from image \"\n \"file \\\"\" << fileName() << \"\\\". \" << e.what());\n throw;\n }\n}","lang":"cpp","vul_type":"cwe-787","sven_meta":{"func_name":"TiledInputFile::rawTileData","file_name":"OpenEXR/IlmImf/ImfTiledInputFile.cpp","commit_link":"github.com/AcademySoftwareFoundation/openexr/commit/6bb36714528a9563dd3b92720c5063a1284b86f8","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#35-1b5cf111d8be","input":"static int tcos_decipher(sc_card_t *card, const u8 * crgram, size_t crgram_len, u8 * out, size_t outlen)\n{\n\tsc_context_t *ctx;\n\tsc_apdu_t apdu;\n\tu8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n\tu8 sbuf[SC_MAX_APDU_BUFFER_SIZE];\n\ttcos_data *data;\n\tint tcos3, r;\n\n\tassert(card != NULL && crgram != NULL && out != NULL);\n\tctx = card->ctx;\n\ttcos3=(card->type==SC_CARD_TYPE_TCOS_V3);\n\tdata=(tcos_data *)card->drv_data;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx,\n\t\t\"TCOS3:%d PKCS1:%d\\n\",tcos3,\n\t\t!!(data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1));\n\n\tsc_format_apdu(card, &apdu, crgram_len>255 ? SC_APDU_CASE_4_EXT : SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86);\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.le = crgram_len;\n\n\tapdu.data = sbuf;\n\tapdu.lc = apdu.datalen = crgram_len+1;\n\tsbuf[0] = tcos3 ? 0x00 : ((data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) ? 0x81 : 0x02);\n\tmemcpy(sbuf+1, crgram, crgram_len);\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tif (apdu.sw1==0x90 && apdu.sw2==0x00) {\n\t\tsize_t len= (apdu.resplen>outlen) ? outlen : apdu.resplen;\n\t\tunsigned int offset=0;\n\t\tif(tcos3 && (data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) && apdu.resp[0]==0 && apdu.resp[1]==2) {\n\t\t\toffset=2; while(offsetctx, SC_LOG_DEBUG_VERBOSE, len-offset);\n\t}\n\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2));\n}","target":"static int tcos_decipher(sc_card_t *card, const u8 * crgram, size_t crgram_len, u8 * out, size_t outlen)\n{\n\tsc_context_t *ctx;\n\tsc_apdu_t apdu;\n\tu8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n\tu8 sbuf[SC_MAX_APDU_BUFFER_SIZE];\n\ttcos_data *data;\n\tint tcos3, r;\n\n\tassert(card != NULL && crgram != NULL && out != NULL);\n\tctx = card->ctx;\n\ttcos3=(card->type==SC_CARD_TYPE_TCOS_V3);\n\tdata=(tcos_data *)card->drv_data;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx,\n\t\t\"TCOS3:%d PKCS1:%d\\n\",tcos3,\n\t\t!!(data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1));\n\n\tsc_format_apdu(card, &apdu, crgram_len>255 ? SC_APDU_CASE_4_EXT : SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86);\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.le = crgram_len;\n\n\tapdu.data = sbuf;\n\tapdu.lc = apdu.datalen = crgram_len+1;\n\tsbuf[0] = tcos3 ? 0x00 : ((data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) ? 0x81 : 0x02);\n\tif (sizeof sbuf - 1 < crgram_len)\n\t\treturn SC_ERROR_INVALID_ARGUMENTS;\n\tmemcpy(sbuf+1, crgram, crgram_len);\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tif (apdu.sw1==0x90 && apdu.sw2==0x00) {\n\t\tsize_t len= (apdu.resplen>outlen) ? outlen : apdu.resplen;\n\t\tunsigned int offset=0;\n\t\tif(tcos3 && (data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) && apdu.resp[0]==0 && apdu.resp[1]==2) {\n\t\t\toffset=2; while(offsetctx, SC_LOG_DEBUG_VERBOSE, len-offset);\n\t}\n\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2));\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"tcos_decipher","file_name":"src/libopensc/card-tcos.c","commit_link":"github.com/OpenSC/OpenSC/commit/9d294de90d1cc66956389856e60b6944b27b4817","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#36-c2a7543d01b7","input":"static int decode_zbuf(AVBPrint *bp, const uint8_t *data,\n const uint8_t *data_end)\n{\n z_stream zstream;\n unsigned char *buf;\n unsigned buf_size;\n int ret;\n\n zstream.zalloc = ff_png_zalloc;\n zstream.zfree = ff_png_zfree;\n zstream.opaque = NULL;\n if (inflateInit(&zstream) != Z_OK)\n return AVERROR_EXTERNAL;\n zstream.next_in = (unsigned char *)data;\n zstream.avail_in = data_end - data;\n av_bprint_init(bp, 0, -1);\n\n while (zstream.avail_in > 0) {\n av_bprint_get_buffer(bp, 1, &buf, &buf_size);\n if (!buf_size) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n zstream.next_out = buf;\n zstream.avail_out = buf_size;\n ret = inflate(&zstream, Z_PARTIAL_FLUSH);\n if (ret != Z_OK && ret != Z_STREAM_END) {\n ret = AVERROR_EXTERNAL;\n goto fail;\n }\n bp->len += zstream.next_out - buf;\n if (ret == Z_STREAM_END)\n break;\n }\n inflateEnd(&zstream);\n bp->str[bp->len] = 0;\n return 0;\n\nfail:\n inflateEnd(&zstream);\n av_bprint_finalize(bp, NULL);\n return ret;\n}","target":"static int decode_zbuf(AVBPrint *bp, const uint8_t *data,\n const uint8_t *data_end)\n{\n z_stream zstream;\n unsigned char *buf;\n unsigned buf_size;\n int ret;\n\n zstream.zalloc = ff_png_zalloc;\n zstream.zfree = ff_png_zfree;\n zstream.opaque = NULL;\n if (inflateInit(&zstream) != Z_OK)\n return AVERROR_EXTERNAL;\n zstream.next_in = (unsigned char *)data;\n zstream.avail_in = data_end - data;\n av_bprint_init(bp, 0, -1);\n\n while (zstream.avail_in > 0) {\n av_bprint_get_buffer(bp, 2, &buf, &buf_size);\n if (buf_size < 2) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n zstream.next_out = buf;\n zstream.avail_out = buf_size - 1;\n ret = inflate(&zstream, Z_PARTIAL_FLUSH);\n if (ret != Z_OK && ret != Z_STREAM_END) {\n ret = AVERROR_EXTERNAL;\n goto fail;\n }\n bp->len += zstream.next_out - buf;\n if (ret == Z_STREAM_END)\n break;\n }\n inflateEnd(&zstream);\n bp->str[bp->len] = 0;\n return 0;\n\nfail:\n inflateEnd(&zstream);\n av_bprint_finalize(bp, NULL);\n return ret;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"decode_zbuf","file_name":"libavcodec/pngdec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/e371f031b942d73e02c090170975561fabd5c264","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#37-0f22a40e83a8","input":"MultiPartInputFile::Data::chunkOffsetReconstruction(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream& is, const vector& parts)\n{\n //\n // Reconstruct broken chunk offset tables. Stop once we received any exception.\n //\n\n Int64 position = is.tellg();\n\n \n //\n // check we understand all the parts available: if not, we cannot continue\n // exceptions thrown here should trickle back up to the constructor\n //\n \n for (size_t i = 0; i < parts.size(); i++)\n {\n Header& header=parts[i]->header;\n \n //\n // do we have a valid type entry?\n // we only need them for true multipart files or single part non-image (deep) files\n //\n if(!header.hasType() && (isMultiPart(version) || isNonImage(version)))\n {\n throw IEX_NAMESPACE::ArgExc(\"cannot reconstruct incomplete file: part with missing type\");\n }\n if(!isSupportedType(header.type()))\n {\n throw IEX_NAMESPACE::ArgExc(\"cannot reconstruct incomplete file: part with unknown type \"+header.type());\n }\n }\n \n \n // how many chunks should we read? We should stop when we reach the end\n size_t total_chunks = 0;\n \n // for tiled-based parts, array of (pointers to) tileOffsets objects\n // to create mapping between tile coordinates and chunk table indices\n \n \n vector tileOffsets(parts.size());\n \n // for scanline-based parts, number of scanlines in each chunk\n vector rowsizes(parts.size());\n \n for(size_t i = 0 ; i < parts.size() ; i++)\n {\n total_chunks += parts[i]->chunkOffsets.size();\n if (isTiled(parts[i]->header.type()))\n {\n tileOffsets[i] = createTileOffsets(parts[i]->header);\n }else{\n tileOffsets[i] = NULL;\n // (TODO) fix this so that it doesn't need to be revised for future compression types.\n switch(parts[i]->header.compression())\n {\n case DWAB_COMPRESSION :\n rowsizes[i] = 256;\n break;\n case PIZ_COMPRESSION :\n case B44_COMPRESSION :\n case B44A_COMPRESSION :\n case DWAA_COMPRESSION :\n rowsizes[i]=32;\n break;\n case ZIP_COMPRESSION :\n case PXR24_COMPRESSION :\n rowsizes[i]=16;\n break;\n case ZIPS_COMPRESSION :\n case RLE_COMPRESSION :\n case NO_COMPRESSION :\n rowsizes[i]=1;\n break;\n default :\n throw(IEX_NAMESPACE::ArgExc(\"Unknown compression method in chunk offset reconstruction\"));\n }\n }\n }\n \n try\n {\n \n //\n // \n //\n \n Int64 chunk_start = position;\n for (size_t i = 0; i < total_chunks ; i++)\n {\n //\n // do we have a part number?\n //\n \n int partNumber = 0;\n if(isMultiPart(version))\n {\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, partNumber);\n }\n \n \n \n if(partNumber<0 || partNumber> static_cast(parts.size()))\n {\n throw IEX_NAMESPACE::IoExc(\"part number out of range\");\n }\n \n Header& header = parts[partNumber]->header;\n\n // size of chunk NOT including multipart field\n \n Int64 size_of_chunk=0;\n\n if (isTiled(header.type()))\n {\n //\n // \n //\n int tilex,tiley,levelx,levely;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, tilex);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, tiley);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, levelx);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, levely);\n \n //std::cout << \"chunk_start for \" << tilex <<',' << tiley << ',' << levelx << ' ' << levely << ':' << chunk_start << std::endl;\n \n \n if(!tileOffsets[partNumber])\n {\n // this shouldn't actually happen - we should have allocated a valid\n // tileOffsets for any part which isTiled\n throw IEX_NAMESPACE::IoExc(\"part not tiled\");\n \n }\n \n if(!tileOffsets[partNumber]->isValidTile(tilex,tiley,levelx,levely))\n {\n throw IEX_NAMESPACE::IoExc(\"invalid tile coordinates\");\n }\n \n (*tileOffsets[partNumber])(tilex,tiley,levelx,levely)=chunk_start;\n \n // compute chunk sizes - different procedure for deep tiles and regular\n // ones\n if(header.type()==DEEPTILE)\n {\n Int64 packed_offset;\n Int64 packed_sample;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_offset);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_sample);\n \n //add 40 byte header to packed sizes (tile coordinates, packed sizes, unpacked size)\n size_of_chunk=packed_offset+packed_sample+40;\n }\n else\n {\n \n // regular image has 20 bytes of header, 4 byte chunksize;\n int chunksize;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, chunksize);\n size_of_chunk=chunksize+20;\n }\n }\n else\n {\n int y_coordinate;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, y_coordinate);\n \n \n if(y_coordinate < header.dataWindow().min.y || y_coordinate > header.dataWindow().max.y)\n {\n throw IEX_NAMESPACE::IoExc(\"y out of range\");\n }\n y_coordinate -= header.dataWindow().min.y;\n y_coordinate /= rowsizes[partNumber]; \n \n if(y_coordinate < 0 || y_coordinate >= int(parts[partNumber]->chunkOffsets.size()))\n {\n throw IEX_NAMESPACE::IoExc(\"chunk index out of range\");\n }\n \n parts[partNumber]->chunkOffsets[y_coordinate]=chunk_start;\n \n if(header.type()==DEEPSCANLINE)\n {\n Int64 packed_offset;\n Int64 packed_sample;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_offset);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_sample);\n \n \n size_of_chunk=packed_offset+packed_sample+28;\n }\n else\n {\n int chunksize;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, chunksize); \n size_of_chunk=chunksize+8;\n }\n \n }\n \n if(isMultiPart(version))\n {\n chunk_start+=4;\n }\n \n chunk_start+=size_of_chunk;\n \n is.seekg(chunk_start);\n \n }\n \n }\n catch (...)\n {\n //\n // Suppress all exceptions. This functions is\n // called only to reconstruct the line offset\n // table for incomplete files, and exceptions\n // are likely.\n //\n }\n\n // copy tiled part data back to chunk offsets\n \n for(size_t partNumber=0;partNumber > > offsets = tileOffsets[partNumber]->getOffsets();\n for (size_t l = 0; l < offsets.size(); l++)\n for (size_t y = 0; y < offsets[l].size(); y++)\n for (size_t x = 0; x < offsets[l][y].size(); x++)\n {\n parts[ partNumber ]->chunkOffsets[pos] = offsets[l][y][x];\n pos++;\n }\n delete tileOffsets[partNumber];\n }\n }\n\n is.clear();\n is.seekg (position);\n}","target":"MultiPartInputFile::Data::chunkOffsetReconstruction(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream& is, const vector& parts)\n{\n //\n // Reconstruct broken chunk offset tables. Stop once we received any exception.\n //\n\n Int64 position = is.tellg();\n\n \n //\n // check we understand all the parts available: if not, we cannot continue\n // exceptions thrown here should trickle back up to the constructor\n //\n \n for (size_t i = 0; i < parts.size(); i++)\n {\n Header& header=parts[i]->header;\n \n //\n // do we have a valid type entry?\n // we only need them for true multipart files or single part non-image (deep) files\n //\n if(!header.hasType() && (isMultiPart(version) || isNonImage(version)))\n {\n throw IEX_NAMESPACE::ArgExc(\"cannot reconstruct incomplete file: part with missing type\");\n }\n if(!isSupportedType(header.type()))\n {\n throw IEX_NAMESPACE::ArgExc(\"cannot reconstruct incomplete file: part with unknown type \"+header.type());\n }\n }\n \n \n // how many chunks should we read? We should stop when we reach the end\n size_t total_chunks = 0;\n \n // for tiled-based parts, array of (pointers to) tileOffsets objects\n // to create mapping between tile coordinates and chunk table indices\n \n \n vector tileOffsets(parts.size());\n \n // for scanline-based parts, number of scanlines in each chunk\n vector rowsizes(parts.size());\n \n for(size_t i = 0 ; i < parts.size() ; i++)\n {\n total_chunks += parts[i]->chunkOffsets.size();\n if (isTiled(parts[i]->header.type()))\n {\n tileOffsets[i] = createTileOffsets(parts[i]->header);\n }else{\n tileOffsets[i] = NULL;\n // (TODO) fix this so that it doesn't need to be revised for future compression types.\n switch(parts[i]->header.compression())\n {\n case DWAB_COMPRESSION :\n rowsizes[i] = 256;\n break;\n case PIZ_COMPRESSION :\n case B44_COMPRESSION :\n case B44A_COMPRESSION :\n case DWAA_COMPRESSION :\n rowsizes[i]=32;\n break;\n case ZIP_COMPRESSION :\n case PXR24_COMPRESSION :\n rowsizes[i]=16;\n break;\n case ZIPS_COMPRESSION :\n case RLE_COMPRESSION :\n case NO_COMPRESSION :\n rowsizes[i]=1;\n break;\n default :\n throw(IEX_NAMESPACE::ArgExc(\"Unknown compression method in chunk offset reconstruction\"));\n }\n }\n }\n \n try\n {\n \n //\n // \n //\n \n Int64 chunk_start = position;\n for (size_t i = 0; i < total_chunks ; i++)\n {\n //\n // do we have a part number?\n //\n \n int partNumber = 0;\n if(isMultiPart(version))\n {\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, partNumber);\n }\n \n \n \n if(partNumber<0 || partNumber>= static_cast(parts.size()))\n {\n throw IEX_NAMESPACE::IoExc(\"part number out of range\");\n }\n \n Header& header = parts[partNumber]->header;\n\n // size of chunk NOT including multipart field\n \n Int64 size_of_chunk=0;\n\n if (isTiled(header.type()))\n {\n //\n // \n //\n int tilex,tiley,levelx,levely;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, tilex);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, tiley);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, levelx);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, levely);\n \n //std::cout << \"chunk_start for \" << tilex <<',' << tiley << ',' << levelx << ' ' << levely << ':' << chunk_start << std::endl;\n \n \n if(!tileOffsets[partNumber])\n {\n // this shouldn't actually happen - we should have allocated a valid\n // tileOffsets for any part which isTiled\n throw IEX_NAMESPACE::IoExc(\"part not tiled\");\n \n }\n \n if(!tileOffsets[partNumber]->isValidTile(tilex,tiley,levelx,levely))\n {\n throw IEX_NAMESPACE::IoExc(\"invalid tile coordinates\");\n }\n \n (*tileOffsets[partNumber])(tilex,tiley,levelx,levely)=chunk_start;\n \n // compute chunk sizes - different procedure for deep tiles and regular\n // ones\n if(header.type()==DEEPTILE)\n {\n Int64 packed_offset;\n Int64 packed_sample;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_offset);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_sample);\n \n //add 40 byte header to packed sizes (tile coordinates, packed sizes, unpacked size)\n size_of_chunk=packed_offset+packed_sample+40;\n }\n else\n {\n \n // regular image has 20 bytes of header, 4 byte chunksize;\n int chunksize;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, chunksize);\n size_of_chunk=chunksize+20;\n }\n }\n else\n {\n int y_coordinate;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, y_coordinate);\n \n \n if(y_coordinate < header.dataWindow().min.y || y_coordinate > header.dataWindow().max.y)\n {\n throw IEX_NAMESPACE::IoExc(\"y out of range\");\n }\n y_coordinate -= header.dataWindow().min.y;\n y_coordinate /= rowsizes[partNumber]; \n \n if(y_coordinate < 0 || y_coordinate >= int(parts[partNumber]->chunkOffsets.size()))\n {\n throw IEX_NAMESPACE::IoExc(\"chunk index out of range\");\n }\n \n parts[partNumber]->chunkOffsets[y_coordinate]=chunk_start;\n \n if(header.type()==DEEPSCANLINE)\n {\n Int64 packed_offset;\n Int64 packed_sample;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_offset);\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, packed_sample);\n \n \n size_of_chunk=packed_offset+packed_sample+28;\n }\n else\n {\n int chunksize;\n OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (is, chunksize); \n size_of_chunk=chunksize+8;\n }\n \n }\n \n if(isMultiPart(version))\n {\n chunk_start+=4;\n }\n \n chunk_start+=size_of_chunk;\n \n is.seekg(chunk_start);\n \n }\n \n }\n catch (...)\n {\n //\n // Suppress all exceptions. This functions is\n // called only to reconstruct the line offset\n // table for incomplete files, and exceptions\n // are likely.\n //\n }\n\n // copy tiled part data back to chunk offsets\n \n for(size_t partNumber=0;partNumber > > offsets = tileOffsets[partNumber]->getOffsets();\n for (size_t l = 0; l < offsets.size(); l++)\n for (size_t y = 0; y < offsets[l].size(); y++)\n for (size_t x = 0; x < offsets[l][y].size(); x++)\n {\n parts[ partNumber ]->chunkOffsets[pos] = offsets[l][y][x];\n pos++;\n }\n delete tileOffsets[partNumber];\n }\n }\n\n is.clear();\n is.seekg (position);\n}","lang":"cpp","vul_type":"cwe-787","sven_meta":{"func_name":"MultiPartInputFile::Data::chunkOffsetReconstruction","file_name":"OpenEXR/IlmImf/ImfMultiPartInputFile.cpp","commit_link":"github.com/AcademySoftwareFoundation/openexr/commit/8b5370c688a7362673c3a5256d93695617a4cd9a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#38-f636ecbbf371","input":"make_canonical(struct ly_ctx *ctx, int type, const char **value, void *data1, void *data2)\n{\n const uint16_t buf_len = 511;\n char buf[buf_len + 1];\n struct lys_type_bit **bits = NULL;\n struct lyxp_expr *exp;\n const char *module_name, *cur_expr, *end;\n int i, j, count;\n int64_t num;\n uint64_t unum;\n uint8_t c;\n\n#define LOGBUF(str) LOGERR(ctx, LY_EINVAL, \"Value \\\"%s\\\" is too long.\", str)\n\n switch (type) {\n case LY_TYPE_BITS:\n bits = (struct lys_type_bit **)data1;\n count = *((int *)data2);\n /* in canonical form, the bits are ordered by their position */\n buf[0] = '\\0';\n for (i = 0; i < count; i++) {\n if (!bits[i]) {\n /* bit not set */\n continue;\n }\n if (buf[0]) {\n LY_CHECK_ERR_RETURN(strlen(buf) + 1 + strlen(bits[i]->name) > buf_len, LOGBUF(bits[i]->name), -1);\n sprintf(buf + strlen(buf), \" %s\", bits[i]->name);\n } else {\n LY_CHECK_ERR_RETURN(strlen(bits[i]->name) > buf_len, LOGBUF(bits[i]->name), -1);\n strcpy(buf, bits[i]->name);\n }\n }\n break;\n\n case LY_TYPE_IDENT:\n module_name = (const char *)data1;\n /* identity must always have a prefix */\n if (!strchr(*value, ':')) {\n sprintf(buf, \"%s:%s\", module_name, *value);\n } else {\n strcpy(buf, *value);\n }\n break;\n\n case LY_TYPE_INST:\n exp = lyxp_parse_expr(ctx, *value);\n LY_CHECK_ERR_RETURN(!exp, LOGINT(ctx), -1);\n\n module_name = NULL;\n count = 0;\n for (i = 0; (unsigned)i < exp->used; ++i) {\n cur_expr = &exp->expr[exp->expr_pos[i]];\n\n /* copy WS */\n if (i && ((end = exp->expr + exp->expr_pos[i - 1] + exp->tok_len[i - 1]) != cur_expr)) {\n if (count + (cur_expr - end) > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(end);\n return -1;\n }\n strncpy(&buf[count], end, cur_expr - end);\n count += cur_expr - end;\n }\n\n if ((exp->tokens[i] == LYXP_TOKEN_NAMETEST) && (end = strnchr(cur_expr, ':', exp->tok_len[i]))) {\n /* get the module name with \":\" */\n ++end;\n j = end - cur_expr;\n\n if (!module_name || strncmp(cur_expr, module_name, j)) {\n /* print module name with colon, it does not equal to the parent one */\n if (count + j > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(cur_expr);\n return -1;\n }\n strncpy(&buf[count], cur_expr, j);\n count += j;\n }\n module_name = cur_expr;\n\n /* copy the rest */\n if (count + (exp->tok_len[i] - j) > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(end);\n return -1;\n }\n strncpy(&buf[count], end, exp->tok_len[i] - j);\n count += exp->tok_len[i] - j;\n } else {\n if (count + exp->tok_len[i] > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(&exp->expr[exp->expr_pos[i]]);\n return -1;\n }\n strncpy(&buf[count], &exp->expr[exp->expr_pos[i]], exp->tok_len[i]);\n count += exp->tok_len[i];\n }\n }\n if (count > buf_len) {\n LOGINT(ctx);\n lyxp_expr_free(exp);\n return -1;\n }\n buf[count] = '\\0';\n\n lyxp_expr_free(exp);\n break;\n\n case LY_TYPE_DEC64:\n num = *((int64_t *)data1);\n c = *((uint8_t *)data2);\n if (num) {\n count = sprintf(buf, \"%\"PRId64\" \", num);\n if ( (num > 0 && (count - 1) <= c)\n || (count - 2) <= c ) {\n /* we have 0. value, print the value with the leading zeros\n * (one for 0. and also keep the correct with of num according\n * to fraction-digits value)\n * for (num<0) - extra character for '-' sign */\n count = sprintf(buf, \"%0*\"PRId64\" \", (num > 0) ? (c + 1) : (c + 2), num);\n }\n for (i = c, j = 1; i > 0 ; i--) {\n if (j && i > 1 && buf[count - 2] == '0') {\n /* we have trailing zero to skip */\n buf[count - 1] = '\\0';\n } else {\n j = 0;\n buf[count - 1] = buf[count - 2];\n }\n count--;\n }\n buf[count - 1] = '.';\n } else {\n /* zero */\n sprintf(buf, \"0.0\");\n }\n break;\n\n case LY_TYPE_INT8:\n case LY_TYPE_INT16:\n case LY_TYPE_INT32:\n case LY_TYPE_INT64:\n num = *((int64_t *)data1);\n sprintf(buf, \"%\"PRId64, num);\n break;\n\n case LY_TYPE_UINT8:\n case LY_TYPE_UINT16:\n case LY_TYPE_UINT32:\n case LY_TYPE_UINT64:\n unum = *((uint64_t *)data1);\n sprintf(buf, \"%\"PRIu64, unum);\n break;\n\n default:\n /* should not be even called - just do nothing */\n return 0;\n }\n\n if (strcmp(buf, *value)) {\n lydict_remove(ctx, *value);\n *value = lydict_insert(ctx, buf, 0);\n return 1;\n }\n\n return 0;\n\n#undef LOGBUF\n}","target":"make_canonical(struct ly_ctx *ctx, int type, const char **value, void *data1, void *data2)\n{\n const uint16_t buf_len = 511;\n char buf[buf_len + 1];\n struct lys_type_bit **bits = NULL;\n struct lyxp_expr *exp;\n const char *module_name, *cur_expr, *end;\n int i, j, count;\n int64_t num;\n uint64_t unum;\n uint8_t c;\n\n#define LOGBUF(str) LOGERR(ctx, LY_EINVAL, \"Value \\\"%s\\\" is too long.\", str)\n\n switch (type) {\n case LY_TYPE_BITS:\n bits = (struct lys_type_bit **)data1;\n count = *((int *)data2);\n /* in canonical form, the bits are ordered by their position */\n buf[0] = '\\0';\n for (i = 0; i < count; i++) {\n if (!bits[i]) {\n /* bit not set */\n continue;\n }\n if (buf[0]) {\n LY_CHECK_ERR_RETURN(strlen(buf) + 1 + strlen(bits[i]->name) > buf_len, LOGBUF(bits[i]->name), -1);\n sprintf(buf + strlen(buf), \" %s\", bits[i]->name);\n } else {\n LY_CHECK_ERR_RETURN(strlen(bits[i]->name) > buf_len, LOGBUF(bits[i]->name), -1);\n strcpy(buf, bits[i]->name);\n }\n }\n break;\n\n case LY_TYPE_IDENT:\n module_name = (const char *)data1;\n /* identity must always have a prefix */\n if (!strchr(*value, ':')) {\n LY_CHECK_ERR_RETURN(strlen(module_name) + 1 + strlen(*value) > buf_len, LOGBUF(*value), -1);\n sprintf(buf, \"%s:%s\", module_name, *value);\n } else {\n LY_CHECK_ERR_RETURN(strlen(*value) > buf_len, LOGBUF(*value), -1);\n strcpy(buf, *value);\n }\n break;\n\n case LY_TYPE_INST:\n exp = lyxp_parse_expr(ctx, *value);\n LY_CHECK_ERR_RETURN(!exp, LOGINT(ctx), -1);\n\n module_name = NULL;\n count = 0;\n for (i = 0; (unsigned)i < exp->used; ++i) {\n cur_expr = &exp->expr[exp->expr_pos[i]];\n\n /* copy WS */\n if (i && ((end = exp->expr + exp->expr_pos[i - 1] + exp->tok_len[i - 1]) != cur_expr)) {\n if (count + (cur_expr - end) > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(end);\n return -1;\n }\n strncpy(&buf[count], end, cur_expr - end);\n count += cur_expr - end;\n }\n\n if ((exp->tokens[i] == LYXP_TOKEN_NAMETEST) && (end = strnchr(cur_expr, ':', exp->tok_len[i]))) {\n /* get the module name with \":\" */\n ++end;\n j = end - cur_expr;\n\n if (!module_name || strncmp(cur_expr, module_name, j)) {\n /* print module name with colon, it does not equal to the parent one */\n if (count + j > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(cur_expr);\n return -1;\n }\n strncpy(&buf[count], cur_expr, j);\n count += j;\n }\n module_name = cur_expr;\n\n /* copy the rest */\n if (count + (exp->tok_len[i] - j) > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(end);\n return -1;\n }\n strncpy(&buf[count], end, exp->tok_len[i] - j);\n count += exp->tok_len[i] - j;\n } else {\n if (count + exp->tok_len[i] > buf_len) {\n lyxp_expr_free(exp);\n LOGBUF(&exp->expr[exp->expr_pos[i]]);\n return -1;\n }\n strncpy(&buf[count], &exp->expr[exp->expr_pos[i]], exp->tok_len[i]);\n count += exp->tok_len[i];\n }\n }\n if (count > buf_len) {\n LOGINT(ctx);\n lyxp_expr_free(exp);\n return -1;\n }\n buf[count] = '\\0';\n\n lyxp_expr_free(exp);\n break;\n\n case LY_TYPE_DEC64:\n num = *((int64_t *)data1);\n c = *((uint8_t *)data2);\n if (num) {\n count = sprintf(buf, \"%\"PRId64\" \", num);\n if ( (num > 0 && (count - 1) <= c)\n || (count - 2) <= c ) {\n /* we have 0. value, print the value with the leading zeros\n * (one for 0. and also keep the correct with of num according\n * to fraction-digits value)\n * for (num<0) - extra character for '-' sign */\n count = sprintf(buf, \"%0*\"PRId64\" \", (num > 0) ? (c + 1) : (c + 2), num);\n }\n for (i = c, j = 1; i > 0 ; i--) {\n if (j && i > 1 && buf[count - 2] == '0') {\n /* we have trailing zero to skip */\n buf[count - 1] = '\\0';\n } else {\n j = 0;\n buf[count - 1] = buf[count - 2];\n }\n count--;\n }\n buf[count - 1] = '.';\n } else {\n /* zero */\n sprintf(buf, \"0.0\");\n }\n break;\n\n case LY_TYPE_INT8:\n case LY_TYPE_INT16:\n case LY_TYPE_INT32:\n case LY_TYPE_INT64:\n num = *((int64_t *)data1);\n sprintf(buf, \"%\"PRId64, num);\n break;\n\n case LY_TYPE_UINT8:\n case LY_TYPE_UINT16:\n case LY_TYPE_UINT32:\n case LY_TYPE_UINT64:\n unum = *((uint64_t *)data1);\n sprintf(buf, \"%\"PRIu64, unum);\n break;\n\n default:\n /* should not be even called - just do nothing */\n return 0;\n }\n\n if (strcmp(buf, *value)) {\n lydict_remove(ctx, *value);\n *value = lydict_insert(ctx, buf, 0);\n return 1;\n }\n\n return 0;\n\n#undef LOGBUF\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"make_canonical","file_name":"src/parser.c","commit_link":"github.com/CESNET/libyang/commit/6980afae2ff9fcd6d67508b0a3f694d75fd059d6","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#39-08fcb7df1d7e","input":"static int decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame, AVPacket *avpkt)\n{\n EXRContext *s = avctx->priv_data;\n ThreadFrame frame = { .f = data };\n AVFrame *picture = data;\n uint8_t *ptr;\n\n int i, y, ret, ymax;\n int planes;\n int out_line_size;\n int nb_blocks; /* nb scanline or nb tile */\n uint64_t start_offset_table;\n uint64_t start_next_scanline;\n PutByteContext offset_table_writer;\n\n bytestream2_init(&s->gb, avpkt->data, avpkt->size);\n\n if ((ret = decode_header(s, picture)) < 0)\n return ret;\n\n switch (s->pixel_type) {\n case EXR_FLOAT:\n case EXR_HALF:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n } else {\n /* todo: change this when a floating point pixel format with luma with alpha is implemented */\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRPF32;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAYF32;\n }\n }\n break;\n case EXR_UINT:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGBA64;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_YA16;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGB48;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAY16;\n }\n }\n break;\n default:\n av_log(avctx, AV_LOG_ERROR, \"Missing channel list.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if (s->apply_trc_type != AVCOL_TRC_UNSPECIFIED)\n avctx->color_trc = s->apply_trc_type;\n\n switch (s->compression) {\n case EXR_RAW:\n case EXR_RLE:\n case EXR_ZIP1:\n s->scan_lines_per_block = 1;\n break;\n case EXR_PXR24:\n case EXR_ZIP16:\n s->scan_lines_per_block = 16;\n break;\n case EXR_PIZ:\n case EXR_B44:\n case EXR_B44A:\n s->scan_lines_per_block = 32;\n break;\n default:\n avpriv_report_missing_feature(avctx, \"Compression %d\", s->compression);\n return AVERROR_PATCHWELCOME;\n }\n\n /* Verify the xmin, xmax, ymin and ymax before setting the actual image size.\n * It's possible for the data window can larger or outside the display window */\n if (s->xmin > s->xmax || s->ymin > s->ymax ||\n s->ydelta == 0xFFFFFFFF || s->xdelta == 0xFFFFFFFF) {\n av_log(avctx, AV_LOG_ERROR, \"Wrong or missing size information.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if ((ret = ff_set_dimensions(avctx, s->w, s->h)) < 0)\n return ret;\n\n s->desc = av_pix_fmt_desc_get(avctx->pix_fmt);\n if (!s->desc)\n return AVERROR_INVALIDDATA;\n\n if (s->desc->flags & AV_PIX_FMT_FLAG_FLOAT) {\n planes = s->desc->nb_components;\n out_line_size = avctx->width * 4;\n } else {\n planes = 1;\n out_line_size = avctx->width * 2 * s->desc->nb_components;\n }\n\n if (s->is_tile) {\n nb_blocks = ((s->xdelta + s->tile_attr.xSize - 1) / s->tile_attr.xSize) *\n ((s->ydelta + s->tile_attr.ySize - 1) / s->tile_attr.ySize);\n } else { /* scanline */\n nb_blocks = (s->ydelta + s->scan_lines_per_block - 1) /\n s->scan_lines_per_block;\n }\n\n if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)\n return ret;\n\n if (bytestream2_get_bytes_left(&s->gb)/8 < nb_blocks)\n return AVERROR_INVALIDDATA;\n\n // check offset table and recreate it if need\n if (!s->is_tile && bytestream2_peek_le64(&s->gb) == 0) {\n av_log(s->avctx, AV_LOG_DEBUG, \"recreating invalid scanline offset table\\n\");\n\n start_offset_table = bytestream2_tell(&s->gb);\n start_next_scanline = start_offset_table + nb_blocks * 8;\n bytestream2_init_writer(&offset_table_writer, &avpkt->data[start_offset_table], nb_blocks * 8);\n\n for (y = 0; y < nb_blocks; y++) {\n /* write offset of prev scanline in offset table */\n bytestream2_put_le64(&offset_table_writer, start_next_scanline);\n\n /* get len of next scanline */\n bytestream2_seek(&s->gb, start_next_scanline + 4, SEEK_SET);/* skip line number */\n start_next_scanline += (bytestream2_get_le32(&s->gb) + 8);\n }\n bytestream2_seek(&s->gb, start_offset_table, SEEK_SET);\n }\n\n // save pointer we are going to use in decode_block\n s->buf = avpkt->data;\n s->buf_size = avpkt->size;\n\n // Zero out the start if ymin is not 0\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i];\n for (y = 0; y < s->ymin; y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n s->picture = picture;\n\n avctx->execute2(avctx, decode_block, s->thread_data, NULL, nb_blocks);\n\n ymax = FFMAX(0, s->ymax + 1);\n // Zero out the end if ymax+1 is not h\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i] + (ymax * picture->linesize[i]);\n for (y = ymax; y < avctx->height; y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n picture->pict_type = AV_PICTURE_TYPE_I;\n *got_frame = 1;\n\n return avpkt->size;\n}","target":"static int decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame, AVPacket *avpkt)\n{\n EXRContext *s = avctx->priv_data;\n ThreadFrame frame = { .f = data };\n AVFrame *picture = data;\n uint8_t *ptr;\n\n int i, y, ret, ymax;\n int planes;\n int out_line_size;\n int nb_blocks; /* nb scanline or nb tile */\n uint64_t start_offset_table;\n uint64_t start_next_scanline;\n PutByteContext offset_table_writer;\n\n bytestream2_init(&s->gb, avpkt->data, avpkt->size);\n\n if ((ret = decode_header(s, picture)) < 0)\n return ret;\n\n switch (s->pixel_type) {\n case EXR_FLOAT:\n case EXR_HALF:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n } else {\n /* todo: change this when a floating point pixel format with luma with alpha is implemented */\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRPF32;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAYF32;\n }\n }\n break;\n case EXR_UINT:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGBA64;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_YA16;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGB48;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAY16;\n }\n }\n break;\n default:\n av_log(avctx, AV_LOG_ERROR, \"Missing channel list.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if (s->apply_trc_type != AVCOL_TRC_UNSPECIFIED)\n avctx->color_trc = s->apply_trc_type;\n\n switch (s->compression) {\n case EXR_RAW:\n case EXR_RLE:\n case EXR_ZIP1:\n s->scan_lines_per_block = 1;\n break;\n case EXR_PXR24:\n case EXR_ZIP16:\n s->scan_lines_per_block = 16;\n break;\n case EXR_PIZ:\n case EXR_B44:\n case EXR_B44A:\n s->scan_lines_per_block = 32;\n break;\n default:\n avpriv_report_missing_feature(avctx, \"Compression %d\", s->compression);\n return AVERROR_PATCHWELCOME;\n }\n\n /* Verify the xmin, xmax, ymin and ymax before setting the actual image size.\n * It's possible for the data window can larger or outside the display window */\n if (s->xmin > s->xmax || s->ymin > s->ymax ||\n s->ydelta == 0xFFFFFFFF || s->xdelta == 0xFFFFFFFF) {\n av_log(avctx, AV_LOG_ERROR, \"Wrong or missing size information.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if ((ret = ff_set_dimensions(avctx, s->w, s->h)) < 0)\n return ret;\n\n s->desc = av_pix_fmt_desc_get(avctx->pix_fmt);\n if (!s->desc)\n return AVERROR_INVALIDDATA;\n\n if (s->desc->flags & AV_PIX_FMT_FLAG_FLOAT) {\n planes = s->desc->nb_components;\n out_line_size = avctx->width * 4;\n } else {\n planes = 1;\n out_line_size = avctx->width * 2 * s->desc->nb_components;\n }\n\n if (s->is_tile) {\n nb_blocks = ((s->xdelta + s->tile_attr.xSize - 1) / s->tile_attr.xSize) *\n ((s->ydelta + s->tile_attr.ySize - 1) / s->tile_attr.ySize);\n } else { /* scanline */\n nb_blocks = (s->ydelta + s->scan_lines_per_block - 1) /\n s->scan_lines_per_block;\n }\n\n if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)\n return ret;\n\n if (bytestream2_get_bytes_left(&s->gb)/8 < nb_blocks)\n return AVERROR_INVALIDDATA;\n\n // check offset table and recreate it if need\n if (!s->is_tile && bytestream2_peek_le64(&s->gb) == 0) {\n av_log(s->avctx, AV_LOG_DEBUG, \"recreating invalid scanline offset table\\n\");\n\n start_offset_table = bytestream2_tell(&s->gb);\n start_next_scanline = start_offset_table + nb_blocks * 8;\n bytestream2_init_writer(&offset_table_writer, &avpkt->data[start_offset_table], nb_blocks * 8);\n\n for (y = 0; y < nb_blocks; y++) {\n /* write offset of prev scanline in offset table */\n bytestream2_put_le64(&offset_table_writer, start_next_scanline);\n\n /* get len of next scanline */\n bytestream2_seek(&s->gb, start_next_scanline + 4, SEEK_SET);/* skip line number */\n start_next_scanline += (bytestream2_get_le32(&s->gb) + 8);\n }\n bytestream2_seek(&s->gb, start_offset_table, SEEK_SET);\n }\n\n // save pointer we are going to use in decode_block\n s->buf = avpkt->data;\n s->buf_size = avpkt->size;\n\n // Zero out the start if ymin is not 0\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i];\n for (y = 0; y < FFMIN(s->ymin, s->h); y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n s->picture = picture;\n\n avctx->execute2(avctx, decode_block, s->thread_data, NULL, nb_blocks);\n\n ymax = FFMAX(0, s->ymax + 1);\n // Zero out the end if ymax+1 is not h\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i] + (ymax * picture->linesize[i]);\n for (y = ymax; y < avctx->height; y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n picture->pict_type = AV_PICTURE_TYPE_I;\n *got_frame = 1;\n\n return avpkt->size;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"decode_frame","file_name":"libavcodec/exr.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/3e5959b3457f7f1856d997261e6ac672bba49e8b","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#40-c9bf2469a925","input":"static void add_password(AUTH_HDR *request, unsigned char type, CONST char *password, char *secret)\n{\n\tMD5_CTX md5_secret, my_md5;\n\tunsigned char misc[AUTH_VECTOR_LEN];\n\tint i;\n\tint length = strlen(password);\n\tunsigned char hashed[256 + AUTH_PASS_LEN];\t/* can't be longer than this */\n\tunsigned char *vector;\n\tattribute_t *attr;\n\n\tif (length > MAXPASS) {\t\t\t\t/* shorten the password for now */\n\t\tlength = MAXPASS;\n\t}\n\n\tif (length == 0) {\n\t\tlength = AUTH_PASS_LEN;\t\t\t/* 0 maps to 16 */\n\t} if ((length & (AUTH_PASS_LEN - 1)) != 0) {\n\t\tlength += (AUTH_PASS_LEN - 1);\t\t/* round it up */\n\t\tlength &= ~(AUTH_PASS_LEN - 1);\t\t/* chop it off */\n\t}\t\t\t\t\t\t/* 16*N maps to itself */\n\n\tmemset(hashed, 0, length);\n\tmemcpy(hashed, password, strlen(password));\n\n\tattr = find_attribute(request, PW_PASSWORD);\n\n\tif (type == PW_PASSWORD) {\n\t\tvector = request->vector;\n\t} else {\n\t\tvector = attr->data;\t\t\t/* attr CANNOT be NULL here. */\n\t}\n\n\t/* ************************************************************ */\n\t/* encrypt the password */\n\t/* password : e[0] = p[0] ^ MD5(secret + vector) */\n\tMD5Init(&md5_secret);\n\tMD5Update(&md5_secret, (unsigned char *) secret, strlen(secret));\n\tmy_md5 = md5_secret;\t\t\t\t/* so we won't re-do the hash later */\n\tMD5Update(&my_md5, vector, AUTH_VECTOR_LEN);\n\tMD5Final(misc, &my_md5);\t\t\t/* set the final vector */\n\txor(hashed, misc, AUTH_PASS_LEN);\n\n\t/* For each step through, e[i] = p[i] ^ MD5(secret + e[i-1]) */\n\tfor (i = 1; i < (length >> 4); i++) {\n\t\tmy_md5 = md5_secret;\t\t\t/* grab old value of the hash */\n\t\tMD5Update(&my_md5, &hashed[(i-1) * AUTH_PASS_LEN], AUTH_PASS_LEN);\n\t\tMD5Final(misc, &my_md5);\t\t\t/* set the final vector */\n\t\txor(&hashed[i * AUTH_PASS_LEN], misc, AUTH_PASS_LEN);\n\t}\n\n\tif (type == PW_OLD_PASSWORD) {\n\t\tattr = find_attribute(request, PW_OLD_PASSWORD);\n\t}\n\n\tif (!attr) {\n\t\tadd_attribute(request, type, hashed, length);\n\t} else {\n\t\tmemcpy(attr->data, hashed, length); /* overwrite the packet */\n\t}\n}","target":"static void add_password(AUTH_HDR *request, unsigned char type, CONST char *password, char *secret)\n{\n\tMD5_CTX md5_secret, my_md5;\n\tunsigned char misc[AUTH_VECTOR_LEN];\n\tint i;\n\tint length = strlen(password);\n\tunsigned char hashed[256 + AUTH_PASS_LEN];\t/* can't be longer than this */\n\tunsigned char *vector;\n\tattribute_t *attr;\n\n\tif (length > MAXPASS) {\t\t\t\t/* shorten the password for now */\n\t\tlength = MAXPASS;\n\t}\n\n\tif (length == 0) {\n\t\tlength = AUTH_PASS_LEN;\t\t\t/* 0 maps to 16 */\n\t} if ((length & (AUTH_PASS_LEN - 1)) != 0) {\n\t\tlength += (AUTH_PASS_LEN - 1);\t\t/* round it up */\n\t\tlength &= ~(AUTH_PASS_LEN - 1);\t\t/* chop it off */\n\t}\t\t\t\t\t\t/* 16*N maps to itself */\n\n\tmemset(hashed, 0, length);\n\tmemcpy(hashed, password, length);\n\n\tattr = find_attribute(request, PW_PASSWORD);\n\n\tif (type == PW_PASSWORD) {\n\t\tvector = request->vector;\n\t} else {\n\t\tvector = attr->data;\t\t\t/* attr CANNOT be NULL here. */\n\t}\n\n\t/* ************************************************************ */\n\t/* encrypt the password */\n\t/* password : e[0] = p[0] ^ MD5(secret + vector) */\n\tMD5Init(&md5_secret);\n\tMD5Update(&md5_secret, (unsigned char *) secret, strlen(secret));\n\tmy_md5 = md5_secret;\t\t\t\t/* so we won't re-do the hash later */\n\tMD5Update(&my_md5, vector, AUTH_VECTOR_LEN);\n\tMD5Final(misc, &my_md5);\t\t\t/* set the final vector */\n\txor(hashed, misc, AUTH_PASS_LEN);\n\n\t/* For each step through, e[i] = p[i] ^ MD5(secret + e[i-1]) */\n\tfor (i = 1; i < (length >> 4); i++) {\n\t\tmy_md5 = md5_secret;\t\t\t/* grab old value of the hash */\n\t\tMD5Update(&my_md5, &hashed[(i-1) * AUTH_PASS_LEN], AUTH_PASS_LEN);\n\t\tMD5Final(misc, &my_md5);\t\t\t/* set the final vector */\n\t\txor(&hashed[i * AUTH_PASS_LEN], misc, AUTH_PASS_LEN);\n\t}\n\n\tif (type == PW_OLD_PASSWORD) {\n\t\tattr = find_attribute(request, PW_OLD_PASSWORD);\n\t}\n\n\tif (!attr) {\n\t\tadd_attribute(request, type, hashed, length);\n\t} else {\n\t\tmemcpy(attr->data, hashed, length); /* overwrite the packet */\n\t}\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"add_password","file_name":"src/pam_radius_auth.c","commit_link":"github.com/FreeRADIUS/pam_radius/commit/01173ec2426627dbb1e0d96c06c3ffa0b14d36d0","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#41-63d2fc7811e0","input":"unicode_unfold_key(OnigCodePoint code)\n{\n static const struct ByUnfoldKey wordlist[] =\n {\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0x1040a, 3267, 1},\n\n {0x1e0a, 1727, 1},\n\n {0x040a, 1016, 1},\n\n {0x010a, 186, 1},\n\n {0x1f0a, 2088, 1},\n\n {0x2c0a, 2451, 1},\n\n {0x0189, 619, 1},\n\n {0x1f89, 134, 2},\n\n {0x1f85, 154, 2},\n\n {0x0389, 733, 1},\n\n {0x03ff, 724, 1},\n\n {0xab89, 1523, 1},\n\n {0xab85, 1511, 1},\n\n {0x10c89, 3384, 1},\n\n {0x10c85, 3372, 1},\n\n {0x1e84, 1911, 1},\n\n {0x03f5, 752, 1},\n\n {0x0184, 360, 1},\n\n {0x1f84, 149, 2},\n\n {0x2c84, 2592, 1},\n\n {0x017d, 351, 1},\n\n {0x1ff3, 96, 2},\n\n {0xab84, 1508, 1},\n\n {0xa784, 3105, 1},\n\n {0x10c84, 3369, 1},\n\n {0xab7d, 1487, 1},\n\n {0xa77d, 1706, 1},\n\n {0x1e98, 38, 2},\n\n {0x0498, 1106, 1},\n\n {0x0198, 375, 1},\n\n {0x1f98, 169, 2},\n\n {0x2c98, 2622, 1},\n\n {0x0398, 762, 1},\n\n {0xa684, 2940, 1},\n\n {0xab98, 1568, 1},\n\n {0xa798, 3123, 1},\n\n {0x10c98, 3429, 1},\n\n {0x050a, 1277, 1},\n\n {0x1ffb, 2265, 1},\n\n {0x1e96, 16, 2},\n\n {0x0496, 1103, 1},\n\n {0x0196, 652, 1},\n\n {0x1f96, 199, 2},\n\n {0x2c96, 2619, 1},\n\n {0x0396, 756, 1},\n\n {0xa698, 2970, 1},\n\n {0xab96, 1562, 1},\n\n {0xa796, 3120, 1},\n\n {0x10c96, 3423, 1},\n\n {0x1feb, 2259, 1},\n\n {0x2ceb, 2736, 1},\n\n {0x1e90, 1929, 1},\n\n {0x0490, 1094, 1},\n\n {0x0190, 628, 1},\n\n {0x1f90, 169, 2},\n\n {0x2c90, 2610, 1},\n\n {0x0390, 25, 3},\n\n {0xa696, 2967, 1},\n\n {0xab90, 1544, 1},\n\n {0xa790, 3114, 1},\n\n {0x10c90, 3405, 1},\n\n {0x01d7, 444, 1},\n\n {0x1fd7, 31, 3},\n\n {0x1ea6, 1947, 1},\n\n {0x04a6, 1127, 1},\n\n {0x01a6, 676, 1},\n\n {0x1fa6, 239, 2},\n\n {0x2ca6, 2643, 1},\n\n {0x03a6, 810, 1},\n\n {0xa690, 2958, 1},\n\n {0xaba6, 1610, 1},\n\n {0xa7a6, 3144, 1},\n\n {0x10ca6, 3471, 1},\n\n {0x1ea4, 1944, 1},\n\n {0x04a4, 1124, 1},\n\n {0x01a4, 390, 1},\n\n {0x1fa4, 229, 2},\n\n {0x2ca4, 2640, 1},\n\n {0x03a4, 804, 1},\n\n {0x10a6, 2763, 1},\n\n {0xaba4, 1604, 1},\n\n {0xa7a4, 3141, 1},\n\n {0x10ca4, 3465, 1},\n\n {0x1ea0, 1938, 1},\n\n {0x04a0, 1118, 1},\n\n {0x01a0, 384, 1},\n\n {0x1fa0, 209, 2},\n\n {0x2ca0, 2634, 1},\n\n {0x03a0, 792, 1},\n\n {0x10a4, 2757, 1},\n\n {0xaba0, 1592, 1},\n\n {0xa7a0, 3135, 1},\n\n {0x10ca0, 3453, 1},\n\n {0x1eb2, 1965, 1},\n\n {0x04b2, 1145, 1},\n\n {0x01b2, 694, 1},\n\n {0x1fb2, 249, 2},\n\n {0x2cb2, 2661, 1},\n\n {0x03fd, 718, 1},\n\n {0x10a0, 2745, 1},\n\n {0xabb2, 1646, 1},\n\n {0xa7b2, 703, 1},\n\n {0x10cb2, 3507, 1},\n\n {0x1eac, 1956, 1},\n\n {0x04ac, 1136, 1},\n\n {0x01ac, 396, 1},\n\n {0x1fac, 229, 2},\n\n {0x2cac, 2652, 1},\n\n {0x0537, 1352, 1},\n\n {0x10b2, 2799, 1},\n\n {0xabac, 1628, 1},\n\n {0xa7ac, 637, 1},\n\n {0x10cac, 3489, 1},\n\n {0x1eaa, 1953, 1},\n\n {0x04aa, 1133, 1},\n\n {0x00dd, 162, 1},\n\n {0x1faa, 219, 2},\n\n {0x2caa, 2649, 1},\n\n {0x03aa, 824, 1},\n\n {0x10ac, 2781, 1},\n\n {0xabaa, 1622, 1},\n\n {0xa7aa, 646, 1},\n\n {0x10caa, 3483, 1},\n\n {0x1ea8, 1950, 1},\n\n {0x04a8, 1130, 1},\n\n {0x020a, 517, 1},\n\n {0x1fa8, 209, 2},\n\n {0x2ca8, 2646, 1},\n\n {0x03a8, 817, 1},\n\n {0x10aa, 2775, 1},\n\n {0xaba8, 1616, 1},\n\n {0xa7a8, 3147, 1},\n\n {0x10ca8, 3477, 1},\n\n {0x1ea2, 1941, 1},\n\n {0x04a2, 1121, 1},\n\n {0x01a2, 387, 1},\n\n {0x1fa2, 219, 2},\n\n {0x2ca2, 2637, 1},\n\n {0x118a6, 3528, 1},\n\n {0x10a8, 2769, 1},\n\n {0xaba2, 1598, 1},\n\n {0xa7a2, 3138, 1},\n\n {0x10ca2, 3459, 1},\n\n {0x2ced, 2739, 1},\n\n {0x1fe9, 2283, 1},\n\n {0x1fe7, 47, 3},\n\n {0x1eb0, 1962, 1},\n\n {0x04b0, 1142, 1},\n\n {0x118a4, 3522, 1},\n\n {0x10a2, 2751, 1},\n\n {0x2cb0, 2658, 1},\n\n {0x03b0, 41, 3},\n\n {0x1fe3, 41, 3},\n\n {0xabb0, 1640, 1},\n\n {0xa7b0, 706, 1},\n\n {0x10cb0, 3501, 1},\n\n {0x01d9, 447, 1},\n\n {0x1fd9, 2277, 1},\n\n {0x118a0, 3510, 1},\n\n {0x00df, 24, 2},\n\n {0x00d9, 150, 1},\n\n {0xab77, 1469, 1},\n\n {0x10b0, 2793, 1},\n\n {0x1eae, 1959, 1},\n\n {0x04ae, 1139, 1},\n\n {0x01ae, 685, 1},\n\n {0x1fae, 239, 2},\n\n {0x2cae, 2655, 1},\n\n {0x118b2, 3564, 1},\n\n {0xab73, 1457, 1},\n\n {0xabae, 1634, 1},\n\n {0xab71, 1451, 1},\n\n {0x10cae, 3495, 1},\n\n {0x1e2a, 1775, 1},\n\n {0x042a, 968, 1},\n\n {0x012a, 234, 1},\n\n {0x1f2a, 2130, 1},\n\n {0x2c2a, 2547, 1},\n\n {0x118ac, 3546, 1},\n\n {0x10ae, 2787, 1},\n\n {0x0535, 1346, 1},\n\n {0xa72a, 2988, 1},\n\n {0x1e9a, 0, 2},\n\n {0x049a, 1109, 1},\n\n {0xff37, 3225, 1},\n\n {0x1f9a, 179, 2},\n\n {0x2c9a, 2625, 1},\n\n {0x039a, 772, 1},\n\n {0x118aa, 3540, 1},\n\n {0xab9a, 1574, 1},\n\n {0xa79a, 3126, 1},\n\n {0x10c9a, 3435, 1},\n\n {0x1e94, 1935, 1},\n\n {0x0494, 1100, 1},\n\n {0x0194, 640, 1},\n\n {0x1f94, 189, 2},\n\n {0x2c94, 2616, 1},\n\n {0x0394, 749, 1},\n\n {0x118a8, 3534, 1},\n\n {0xab94, 1556, 1},\n\n {0xa69a, 2973, 1},\n\n {0x10c94, 3417, 1},\n\n {0x10402, 3243, 1},\n\n {0x1e02, 1715, 1},\n\n {0x0402, 992, 1},\n\n {0x0102, 174, 1},\n\n {0x0533, 1340, 1},\n\n {0x2c02, 2427, 1},\n\n {0x118a2, 3516, 1},\n\n {0x052a, 1325, 1},\n\n {0xa694, 2964, 1},\n\n {0x1e92, 1932, 1},\n\n {0x0492, 1097, 1},\n\n {0x2165, 2307, 1},\n\n {0x1f92, 179, 2},\n\n {0x2c92, 2613, 1},\n\n {0x0392, 742, 1},\n\n {0x2161, 2295, 1},\n\n {0xab92, 1550, 1},\n\n {0xa792, 3117, 1},\n\n {0x10c92, 3411, 1},\n\n {0x118b0, 3558, 1},\n\n {0x1f5f, 2199, 1},\n\n {0x1e8e, 1926, 1},\n\n {0x048e, 1091, 1},\n\n {0x018e, 453, 1},\n\n {0x1f8e, 159, 2},\n\n {0x2c8e, 2607, 1},\n\n {0x038e, 833, 1},\n\n {0xa692, 2961, 1},\n\n {0xab8e, 1538, 1},\n\n {0x0055, 59, 1},\n\n {0x10c8e, 3399, 1},\n\n {0x1f5d, 2196, 1},\n\n {0x212a, 27, 1},\n\n {0x04cb, 1181, 1},\n\n {0x01cb, 425, 1},\n\n {0x1fcb, 2241, 1},\n\n {0x118ae, 3552, 1},\n\n {0x0502, 1265, 1},\n\n {0x00cb, 111, 1},\n\n {0xa68e, 2955, 1},\n\n {0x1e8a, 1920, 1},\n\n {0x048a, 1085, 1},\n\n {0x018a, 622, 1},\n\n {0x1f8a, 139, 2},\n\n {0x2c8a, 2601, 1},\n\n {0x038a, 736, 1},\n\n {0x2c67, 2571, 1},\n\n {0xab8a, 1526, 1},\n\n {0x1e86, 1914, 1},\n\n {0x10c8a, 3387, 1},\n\n {0x0186, 616, 1},\n\n {0x1f86, 159, 2},\n\n {0x2c86, 2595, 1},\n\n {0x0386, 727, 1},\n\n {0xff35, 3219, 1},\n\n {0xab86, 1514, 1},\n\n {0xa786, 3108, 1},\n\n {0x10c86, 3375, 1},\n\n {0xa68a, 2949, 1},\n\n {0x0555, 1442, 1},\n\n {0x1ebc, 1980, 1},\n\n {0x04bc, 1160, 1},\n\n {0x01bc, 411, 1},\n\n {0x1fbc, 62, 2},\n\n {0x2cbc, 2676, 1},\n\n {0x1f5b, 2193, 1},\n\n {0xa686, 2943, 1},\n\n {0xabbc, 1676, 1},\n\n {0x1eb8, 1974, 1},\n\n {0x04b8, 1154, 1},\n\n {0x01b8, 408, 1},\n\n {0x1fb8, 2268, 1},\n\n {0x2cb8, 2670, 1},\n\n {0x01db, 450, 1},\n\n {0x1fdb, 2247, 1},\n\n {0xabb8, 1664, 1},\n\n {0x10bc, 2829, 1},\n\n {0x00db, 156, 1},\n\n {0x1eb6, 1971, 1},\n\n {0x04b6, 1151, 1},\n\n {0xff33, 3213, 1},\n\n {0x1fb6, 58, 2},\n\n {0x2cb6, 2667, 1},\n\n {0xff2a, 3186, 1},\n\n {0x10b8, 2817, 1},\n\n {0xabb6, 1658, 1},\n\n {0xa7b6, 3153, 1},\n\n {0x10426, 3351, 1},\n\n {0x1e26, 1769, 1},\n\n {0x0426, 956, 1},\n\n {0x0126, 228, 1},\n\n {0x0053, 52, 1},\n\n {0x2c26, 2535, 1},\n\n {0x0057, 65, 1},\n\n {0x10b6, 2811, 1},\n\n {0x022a, 562, 1},\n\n {0xa726, 2982, 1},\n\n {0x1e2e, 1781, 1},\n\n {0x042e, 980, 1},\n\n {0x012e, 240, 1},\n\n {0x1f2e, 2142, 1},\n\n {0x2c2e, 2559, 1},\n {0xffffffff, -1, 0},\n\n {0x2167, 2313, 1},\n {0xffffffff, -1, 0},\n\n {0xa72e, 2994, 1},\n\n {0x1e2c, 1778, 1},\n\n {0x042c, 974, 1},\n\n {0x012c, 237, 1},\n\n {0x1f2c, 2136, 1},\n\n {0x2c2c, 2553, 1},\n\n {0x1f6f, 2223, 1},\n\n {0x2c6f, 604, 1},\n\n {0xabbf, 1685, 1},\n\n {0xa72c, 2991, 1},\n\n {0x1e28, 1772, 1},\n\n {0x0428, 962, 1},\n\n {0x0128, 231, 1},\n\n {0x1f28, 2124, 1},\n\n {0x2c28, 2541, 1},\n {0xffffffff, -1, 0},\n\n {0x0553, 1436, 1},\n\n {0x10bf, 2838, 1},\n\n {0xa728, 2985, 1},\n\n {0x0526, 1319, 1},\n\n {0x0202, 505, 1},\n\n {0x1e40, 1808, 1},\n\n {0x10424, 3345, 1},\n\n {0x1e24, 1766, 1},\n\n {0x0424, 950, 1},\n\n {0x0124, 225, 1},\n {0xffffffff, -1, 0},\n\n {0x2c24, 2529, 1},\n\n {0x052e, 1331, 1},\n\n {0xa740, 3018, 1},\n\n {0x118bc, 3594, 1},\n\n {0xa724, 2979, 1},\n\n {0x1ef2, 2061, 1},\n\n {0x04f2, 1241, 1},\n\n {0x01f2, 483, 1},\n\n {0x1ff2, 257, 2},\n\n {0x2cf2, 2742, 1},\n\n {0x052c, 1328, 1},\n\n {0x118b8, 3582, 1},\n\n {0xa640, 2865, 1},\n\n {0x10422, 3339, 1},\n\n {0x1e22, 1763, 1},\n\n {0x0422, 944, 1},\n\n {0x0122, 222, 1},\n\n {0x2126, 820, 1},\n\n {0x2c22, 2523, 1},\n\n {0x0528, 1322, 1},\n\n {0x01f1, 483, 1},\n\n {0x118b6, 3576, 1},\n\n {0xa722, 2976, 1},\n\n {0x03f1, 796, 1},\n\n {0x1ebe, 1983, 1},\n\n {0x04be, 1163, 1},\n\n {0xfb02, 12, 2},\n\n {0x1fbe, 767, 1},\n\n {0x2cbe, 2679, 1},\n\n {0x01b5, 405, 1},\n\n {0x0540, 1379, 1},\n\n {0xabbe, 1682, 1},\n\n {0x0524, 1316, 1},\n\n {0x00b5, 779, 1},\n\n {0xabb5, 1655, 1},\n\n {0x1eba, 1977, 1},\n\n {0x04ba, 1157, 1},\n\n {0x216f, 2337, 1},\n\n {0x1fba, 2226, 1},\n\n {0x2cba, 2673, 1},\n\n {0x10be, 2835, 1},\n\n {0x0051, 46, 1},\n\n {0xabba, 1670, 1},\n\n {0x10b5, 2808, 1},\n\n {0x1e6e, 1878, 1},\n\n {0x046e, 1055, 1},\n\n {0x016e, 330, 1},\n\n {0x1f6e, 2220, 1},\n\n {0x2c6e, 664, 1},\n\n {0x118bf, 3603, 1},\n\n {0x0522, 1313, 1},\n\n {0x10ba, 2823, 1},\n\n {0xa76e, 3087, 1},\n\n {0x1eb4, 1968, 1},\n\n {0x04b4, 1148, 1},\n\n {0x2c75, 2583, 1},\n\n {0x1fb4, 50, 2},\n\n {0x2cb4, 2664, 1},\n\n {0xab75, 1463, 1},\n\n {0x1ec2, 1989, 1},\n\n {0xabb4, 1652, 1},\n\n {0xa7b4, 3150, 1},\n\n {0x1fc2, 253, 2},\n\n {0x2cc2, 2685, 1},\n\n {0x03c2, 800, 1},\n\n {0x00c2, 83, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff26, 3174, 1},\n\n {0x10b4, 2805, 1},\n\n {0x1eca, 2001, 1},\n\n {0x0551, 1430, 1},\n\n {0x01ca, 425, 1},\n\n {0x1fca, 2238, 1},\n\n {0x2cca, 2697, 1},\n\n {0x10c2, 2847, 1},\n\n {0x00ca, 108, 1},\n\n {0xff2e, 3198, 1},\n\n {0x1e8c, 1923, 1},\n\n {0x048c, 1088, 1},\n\n {0x0226, 556, 1},\n\n {0x1f8c, 149, 2},\n\n {0x2c8c, 2604, 1},\n\n {0x038c, 830, 1},\n {0xffffffff, -1, 0},\n\n {0xab8c, 1532, 1},\n\n {0xff2c, 3192, 1},\n\n {0x10c8c, 3393, 1},\n\n {0x1ec4, 1992, 1},\n\n {0x022e, 568, 1},\n\n {0x01c4, 417, 1},\n\n {0x1fc4, 54, 2},\n\n {0x2cc4, 2688, 1},\n {0xffffffff, -1, 0},\n\n {0x00c4, 89, 1},\n\n {0xff28, 3180, 1},\n\n {0xa68c, 2952, 1},\n\n {0x01cf, 432, 1},\n\n {0x022c, 565, 1},\n\n {0x118be, 3600, 1},\n\n {0x03cf, 839, 1},\n\n {0x00cf, 123, 1},\n\n {0x118b5, 3573, 1},\n {0xffffffff, -1, 0},\n\n {0x10c4, 2853, 1},\n\n {0x216e, 2334, 1},\n\n {0x24cb, 2406, 1},\n\n {0x0228, 559, 1},\n\n {0xff24, 3168, 1},\n {0xffffffff, -1, 0},\n\n {0x118ba, 3588, 1},\n\n {0x1efe, 2079, 1},\n\n {0x04fe, 1259, 1},\n\n {0x01fe, 499, 1},\n\n {0x1e9e, 24, 2},\n\n {0x049e, 1115, 1},\n\n {0x03fe, 721, 1},\n\n {0x1f9e, 199, 2},\n\n {0x2c9e, 2631, 1},\n\n {0x039e, 786, 1},\n\n {0x0224, 553, 1},\n\n {0xab9e, 1586, 1},\n\n {0xa79e, 3132, 1},\n\n {0x10c9e, 3447, 1},\n\n {0x01f7, 414, 1},\n\n {0x1ff7, 67, 3},\n\n {0xff22, 3162, 1},\n\n {0x03f7, 884, 1},\n\n {0x118b4, 3570, 1},\n\n {0x049c, 1112, 1},\n\n {0x019c, 661, 1},\n\n {0x1f9c, 189, 2},\n\n {0x2c9c, 2628, 1},\n\n {0x039c, 779, 1},\n\n {0x24bc, 2361, 1},\n\n {0xab9c, 1580, 1},\n\n {0xa79c, 3129, 1},\n\n {0x10c9c, 3441, 1},\n\n {0x0222, 550, 1},\n\n {0x1e7c, 1899, 1},\n\n {0x047c, 1076, 1},\n\n {0x1e82, 1908, 1},\n\n {0x24b8, 2349, 1},\n\n {0x0182, 357, 1},\n\n {0x1f82, 139, 2},\n\n {0x2c82, 2589, 1},\n\n {0xab7c, 1484, 1},\n {0xffffffff, -1, 0},\n\n {0xab82, 1502, 1},\n\n {0xa782, 3102, 1},\n\n {0x10c82, 3363, 1},\n\n {0x2c63, 1709, 1},\n\n {0x24b6, 2343, 1},\n\n {0x1e80, 1905, 1},\n\n {0x0480, 1082, 1},\n\n {0x1f59, 2190, 1},\n\n {0x1f80, 129, 2},\n\n {0x2c80, 2586, 1},\n\n {0x0059, 71, 1},\n\n {0xa682, 2937, 1},\n\n {0xab80, 1496, 1},\n\n {0xa780, 3099, 1},\n\n {0x10c80, 3357, 1},\n {0xffffffff, -1, 0},\n\n {0x1e4c, 1826, 1},\n\n {0x0145, 270, 1},\n\n {0x014c, 279, 1},\n\n {0x1f4c, 2184, 1},\n\n {0x0345, 767, 1},\n\n {0x0045, 12, 1},\n\n {0x004c, 31, 1},\n\n {0xa680, 2934, 1},\n\n {0xa74c, 3036, 1},\n\n {0x1e4a, 1823, 1},\n\n {0x01d5, 441, 1},\n\n {0x014a, 276, 1},\n\n {0x1f4a, 2178, 1},\n\n {0x03d5, 810, 1},\n\n {0x00d5, 141, 1},\n\n {0x004a, 24, 1},\n\n {0x24bf, 2370, 1},\n\n {0xa74a, 3033, 1},\n\n {0xa64c, 2883, 1},\n\n {0x1041c, 3321, 1},\n\n {0x1e1c, 1754, 1},\n\n {0x041c, 926, 1},\n\n {0x011c, 213, 1},\n\n {0x1f1c, 2118, 1},\n\n {0x2c1c, 2505, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xa64a, 2880, 1},\n\n {0x1041a, 3315, 1},\n\n {0x1e1a, 1751, 1},\n\n {0x041a, 920, 1},\n\n {0x011a, 210, 1},\n\n {0x1f1a, 2112, 1},\n\n {0x2c1a, 2499, 1},\n\n {0xabbd, 1679, 1},\n\n {0x0545, 1394, 1},\n\n {0x054c, 1415, 1},\n\n {0x10418, 3309, 1},\n\n {0x1e18, 1748, 1},\n\n {0x0418, 914, 1},\n\n {0x0118, 207, 1},\n\n {0x1f18, 2106, 1},\n\n {0x2c18, 2493, 1},\n\n {0x10bd, 2832, 1},\n\n {0x2163, 2301, 1},\n\n {0x054a, 1409, 1},\n\n {0x1040e, 3279, 1},\n\n {0x1e0e, 1733, 1},\n\n {0x040e, 1028, 1},\n\n {0x010e, 192, 1},\n\n {0x1f0e, 2100, 1},\n\n {0x2c0e, 2463, 1},\n\n {0x1efc, 2076, 1},\n\n {0x04fc, 1256, 1},\n\n {0x01fc, 496, 1},\n\n {0x1ffc, 96, 2},\n\n {0x051c, 1304, 1},\n\n {0x1040c, 3273, 1},\n\n {0x1e0c, 1730, 1},\n\n {0x040c, 1022, 1},\n\n {0x010c, 189, 1},\n\n {0x1f0c, 2094, 1},\n\n {0x2c0c, 2457, 1},\n\n {0x1f6d, 2217, 1},\n\n {0x2c6d, 607, 1},\n\n {0x051a, 1301, 1},\n\n {0x24be, 2367, 1},\n\n {0x10408, 3261, 1},\n\n {0x1e08, 1724, 1},\n\n {0x0408, 1010, 1},\n\n {0x0108, 183, 1},\n\n {0x1f08, 2082, 1},\n\n {0x2c08, 2445, 1},\n\n {0x04c9, 1178, 1},\n\n {0x0518, 1298, 1},\n\n {0x1fc9, 2235, 1},\n {0xffffffff, -1, 0},\n\n {0x24ba, 2355, 1},\n\n {0x00c9, 105, 1},\n\n {0x10416, 3303, 1},\n\n {0x1e16, 1745, 1},\n\n {0x0416, 908, 1},\n\n {0x0116, 204, 1},\n\n {0x050e, 1283, 1},\n\n {0x2c16, 2487, 1},\n\n {0x10414, 3297, 1},\n\n {0x1e14, 1742, 1},\n\n {0x0414, 902, 1},\n\n {0x0114, 201, 1},\n\n {0x042b, 971, 1},\n\n {0x2c14, 2481, 1},\n\n {0x1f2b, 2133, 1},\n\n {0x2c2b, 2550, 1},\n {0xffffffff, -1, 0},\n\n {0x050c, 1280, 1},\n\n {0x10406, 3255, 1},\n\n {0x1e06, 1721, 1},\n\n {0x0406, 1004, 1},\n\n {0x0106, 180, 1},\n\n {0x13fb, 1697, 1},\n\n {0x2c06, 2439, 1},\n\n {0x24c2, 2379, 1},\n\n {0x118bd, 3597, 1},\n {0xffffffff, -1, 0},\n\n {0x0508, 1274, 1},\n\n {0x10404, 3249, 1},\n\n {0x1e04, 1718, 1},\n\n {0x0404, 998, 1},\n\n {0x0104, 177, 1},\n\n {0x1f95, 194, 2},\n\n {0x2c04, 2433, 1},\n\n {0x0395, 752, 1},\n\n {0x24ca, 2403, 1},\n\n {0xab95, 1559, 1},\n\n {0x0531, 1334, 1},\n\n {0x10c95, 3420, 1},\n\n {0x0516, 1295, 1},\n\n {0x1e6c, 1875, 1},\n\n {0x046c, 1052, 1},\n\n {0x016c, 327, 1},\n\n {0x1f6c, 2214, 1},\n\n {0x216d, 2331, 1},\n\n {0x0514, 1292, 1},\n\n {0x0245, 697, 1},\n\n {0x024c, 598, 1},\n\n {0xa76c, 3084, 1},\n\n {0x10400, 3237, 1},\n\n {0x1e00, 1712, 1},\n\n {0x0400, 986, 1},\n\n {0x0100, 171, 1},\n\n {0x24c4, 2385, 1},\n\n {0x2c00, 2421, 1},\n\n {0x0506, 1271, 1},\n\n {0x024a, 595, 1},\n\n {0x1fab, 224, 2},\n\n {0xa66c, 2931, 1},\n\n {0x03ab, 827, 1},\n\n {0x24cf, 2418, 1},\n\n {0xabab, 1625, 1},\n\n {0xa7ab, 631, 1},\n\n {0x10cab, 3486, 1},\n {0xffffffff, -1, 0},\n\n {0x0504, 1268, 1},\n {0xffffffff, -1, 0},\n\n {0x021c, 544, 1},\n\n {0x01a9, 679, 1},\n\n {0x1fa9, 214, 2},\n\n {0x10ab, 2778, 1},\n\n {0x03a9, 820, 1},\n\n {0x212b, 92, 1},\n\n {0xaba9, 1619, 1},\n\n {0x1e88, 1917, 1},\n\n {0x10ca9, 3480, 1},\n\n {0x021a, 541, 1},\n\n {0x1f88, 129, 2},\n\n {0x2c88, 2598, 1},\n\n {0x0388, 730, 1},\n\n {0x13fd, 1703, 1},\n\n {0xab88, 1520, 1},\n\n {0x10a9, 2772, 1},\n\n {0x10c88, 3381, 1},\n {0xffffffff, -1, 0},\n\n {0x0218, 538, 1},\n\n {0x0500, 1262, 1},\n\n {0x1f4d, 2187, 1},\n\n {0x01a7, 393, 1},\n\n {0x1fa7, 244, 2},\n\n {0x004d, 34, 1},\n\n {0x03a7, 814, 1},\n\n {0xa688, 2946, 1},\n\n {0xaba7, 1613, 1},\n\n {0x020e, 523, 1},\n\n {0x10ca7, 3474, 1},\n\n {0x1e6a, 1872, 1},\n\n {0x046a, 1049, 1},\n\n {0x016a, 324, 1},\n\n {0x1f6a, 2208, 1},\n {0xffffffff, -1, 0},\n\n {0x216c, 2328, 1},\n\n {0x10a7, 2766, 1},\n\n {0x01d1, 435, 1},\n\n {0xa76a, 3081, 1},\n\n {0x020c, 520, 1},\n\n {0x03d1, 762, 1},\n\n {0x00d1, 129, 1},\n\n {0x1e68, 1869, 1},\n\n {0x0468, 1046, 1},\n\n {0x0168, 321, 1},\n\n {0x1f68, 2202, 1},\n {0xffffffff, -1, 0},\n\n {0xff31, 3207, 1},\n\n {0xa66a, 2928, 1},\n\n {0x0208, 514, 1},\n\n {0xa768, 3078, 1},\n\n {0x1e64, 1863, 1},\n\n {0x0464, 1040, 1},\n\n {0x0164, 315, 1},\n\n {0x054d, 1418, 1},\n\n {0x2c64, 673, 1},\n {0xffffffff, -1, 0},\n\n {0xff2b, 3189, 1},\n {0xffffffff, -1, 0},\n\n {0xa764, 3072, 1},\n\n {0xa668, 2925, 1},\n\n {0x0216, 535, 1},\n {0xffffffff, -1, 0},\n\n {0x118ab, 3543, 1},\n\n {0x1e62, 1860, 1},\n\n {0x0462, 1037, 1},\n\n {0x0162, 312, 1},\n\n {0x0214, 532, 1},\n\n {0x2c62, 655, 1},\n\n {0xa664, 2919, 1},\n\n {0x1ed2, 2013, 1},\n\n {0x04d2, 1193, 1},\n\n {0xa762, 3069, 1},\n\n {0x1fd2, 20, 3},\n\n {0x2cd2, 2709, 1},\n\n {0x118a9, 3537, 1},\n\n {0x00d2, 132, 1},\n\n {0x0206, 511, 1},\n\n {0x10420, 3333, 1},\n\n {0x1e20, 1760, 1},\n\n {0x0420, 938, 1},\n\n {0x0120, 219, 1},\n\n {0xa662, 2916, 1},\n\n {0x2c20, 2517, 1},\n\n {0x1e60, 1856, 1},\n\n {0x0460, 1034, 1},\n\n {0x0160, 309, 1},\n\n {0x0204, 508, 1},\n\n {0x2c60, 2562, 1},\n {0xffffffff, -1, 0},\n\n {0x24bd, 2364, 1},\n\n {0x216a, 2322, 1},\n\n {0xa760, 3066, 1},\n {0xffffffff, -1, 0},\n\n {0xfb16, 125, 2},\n\n {0x118a7, 3531, 1},\n\n {0x1efa, 2073, 1},\n\n {0x04fa, 1253, 1},\n\n {0x01fa, 493, 1},\n\n {0x1ffa, 2262, 1},\n\n {0xfb14, 109, 2},\n\n {0x03fa, 887, 1},\n\n {0xa660, 2913, 1},\n\n {0x2168, 2316, 1},\n\n {0x01b7, 700, 1},\n\n {0x1fb7, 10, 3},\n\n {0x1f6b, 2211, 1},\n\n {0x2c6b, 2577, 1},\n\n {0x0200, 502, 1},\n\n {0xabb7, 1661, 1},\n\n {0xfb06, 29, 2},\n\n {0x1e56, 1841, 1},\n\n {0x2164, 2304, 1},\n\n {0x0156, 294, 1},\n\n {0x1f56, 62, 3},\n\n {0x0520, 1310, 1},\n\n {0x004f, 40, 1},\n\n {0x0056, 62, 1},\n\n {0x10b7, 2814, 1},\n\n {0xa756, 3051, 1},\n\n {0xfb04, 5, 3},\n\n {0x1e78, 1893, 1},\n\n {0x0478, 1070, 1},\n\n {0x0178, 168, 1},\n\n {0x1e54, 1838, 1},\n\n {0x2162, 2298, 1},\n\n {0x0154, 291, 1},\n\n {0x1f54, 57, 3},\n\n {0xab78, 1472, 1},\n\n {0xa656, 2898, 1},\n\n {0x0054, 56, 1},\n\n {0x1e52, 1835, 1},\n\n {0xa754, 3048, 1},\n\n {0x0152, 288, 1},\n\n {0x1f52, 52, 3},\n\n {0x24c9, 2400, 1},\n\n {0x1e32, 1787, 1},\n\n {0x0052, 49, 1},\n\n {0x0132, 243, 1},\n\n {0xa752, 3045, 1},\n {0xffffffff, -1, 0},\n\n {0xfb00, 4, 2},\n\n {0xa654, 2895, 1},\n {0xffffffff, -1, 0},\n\n {0xa732, 2997, 1},\n\n {0x2160, 2292, 1},\n\n {0x054f, 1424, 1},\n\n {0x0556, 1445, 1},\n\n {0x1e50, 1832, 1},\n\n {0xa652, 2892, 1},\n\n {0x0150, 285, 1},\n\n {0x1f50, 84, 2},\n\n {0x017b, 348, 1},\n\n {0x1e4e, 1829, 1},\n\n {0x0050, 43, 1},\n\n {0x014e, 282, 1},\n\n {0xa750, 3042, 1},\n\n {0xab7b, 1481, 1},\n\n {0xa77b, 3093, 1},\n\n {0x004e, 37, 1},\n\n {0x0554, 1439, 1},\n\n {0xa74e, 3039, 1},\n\n {0x1e48, 1820, 1},\n {0xffffffff, -1, 0},\n\n {0x216b, 2325, 1},\n\n {0x1f48, 2172, 1},\n\n {0xa650, 2889, 1},\n\n {0x0552, 1433, 1},\n\n {0x0048, 21, 1},\n {0xffffffff, -1, 0},\n\n {0xa748, 3030, 1},\n\n {0xa64e, 2886, 1},\n\n {0x0532, 1337, 1},\n\n {0x1041e, 3327, 1},\n\n {0x1e1e, 1757, 1},\n\n {0x041e, 932, 1},\n\n {0x011e, 216, 1},\n\n {0x118b7, 3579, 1},\n\n {0x2c1e, 2511, 1},\n {0xffffffff, -1, 0},\n\n {0xa648, 2877, 1},\n\n {0x1ff9, 2253, 1},\n {0xffffffff, -1, 0},\n\n {0x03f9, 878, 1},\n\n {0x0550, 1427, 1},\n\n {0x10412, 3291, 1},\n\n {0x1e12, 1739, 1},\n\n {0x0412, 896, 1},\n\n {0x0112, 198, 1},\n\n {0x054e, 1421, 1},\n\n {0x2c12, 2475, 1},\n\n {0x10410, 3285, 1},\n\n {0x1e10, 1736, 1},\n\n {0x0410, 890, 1},\n\n {0x0110, 195, 1},\n {0xffffffff, -1, 0},\n\n {0x2c10, 2469, 1},\n\n {0x2132, 2289, 1},\n\n {0x0548, 1403, 1},\n\n {0x1ef8, 2070, 1},\n\n {0x04f8, 1250, 1},\n\n {0x01f8, 490, 1},\n\n {0x1ff8, 2250, 1},\n\n {0x0220, 381, 1},\n\n {0x1ee2, 2037, 1},\n\n {0x04e2, 1217, 1},\n\n {0x01e2, 462, 1},\n\n {0x1fe2, 36, 3},\n\n {0x2ce2, 2733, 1},\n\n {0x03e2, 857, 1},\n\n {0x051e, 1307, 1},\n\n {0x1ede, 2031, 1},\n\n {0x04de, 1211, 1},\n\n {0x01de, 456, 1},\n {0xffffffff, -1, 0},\n\n {0x2cde, 2727, 1},\n\n {0x03de, 851, 1},\n\n {0x00de, 165, 1},\n\n {0x1f69, 2205, 1},\n\n {0x2c69, 2574, 1},\n\n {0x1eda, 2025, 1},\n\n {0x04da, 1205, 1},\n\n {0x0512, 1289, 1},\n\n {0x1fda, 2244, 1},\n\n {0x2cda, 2721, 1},\n\n {0x03da, 845, 1},\n\n {0x00da, 153, 1},\n {0xffffffff, -1, 0},\n\n {0x0510, 1286, 1},\n\n {0x1ed8, 2022, 1},\n\n {0x04d8, 1202, 1},\n {0xffffffff, -1, 0},\n\n {0x1fd8, 2274, 1},\n\n {0x2cd8, 2718, 1},\n\n {0x03d8, 842, 1},\n\n {0x00d8, 147, 1},\n\n {0x1ed6, 2019, 1},\n\n {0x04d6, 1199, 1},\n {0xffffffff, -1, 0},\n\n {0x1fd6, 76, 2},\n\n {0x2cd6, 2715, 1},\n\n {0x03d6, 792, 1},\n\n {0x00d6, 144, 1},\n\n {0x1ec8, 1998, 1},\n {0xffffffff, -1, 0},\n\n {0x01c8, 421, 1},\n\n {0x1fc8, 2232, 1},\n\n {0x2cc8, 2694, 1},\n\n {0xff32, 3210, 1},\n\n {0x00c8, 102, 1},\n\n {0x04c7, 1175, 1},\n\n {0x01c7, 421, 1},\n\n {0x1fc7, 15, 3},\n\n {0x1ec0, 1986, 1},\n\n {0x04c0, 1187, 1},\n\n {0x00c7, 99, 1},\n {0xffffffff, -1, 0},\n\n {0x2cc0, 2682, 1},\n\n {0x0179, 345, 1},\n\n {0x00c0, 77, 1},\n\n {0x0232, 574, 1},\n\n {0x01b3, 402, 1},\n\n {0x1fb3, 62, 2},\n\n {0xab79, 1475, 1},\n\n {0xa779, 3090, 1},\n\n {0x10c7, 2859, 1},\n\n {0xabb3, 1649, 1},\n\n {0xa7b3, 3156, 1},\n\n {0x1fa5, 234, 2},\n\n {0x10c0, 2841, 1},\n\n {0x03a5, 807, 1},\n {0xffffffff, -1, 0},\n\n {0xaba5, 1607, 1},\n\n {0x01b1, 691, 1},\n\n {0x10ca5, 3468, 1},\n\n {0x10b3, 2802, 1},\n\n {0x2169, 2319, 1},\n\n {0x024e, 601, 1},\n\n {0xabb1, 1643, 1},\n\n {0xa7b1, 682, 1},\n\n {0x10cb1, 3504, 1},\n\n {0x10a5, 2760, 1},\n {0xffffffff, -1, 0},\n\n {0x01af, 399, 1},\n\n {0x1faf, 244, 2},\n {0xffffffff, -1, 0},\n\n {0x0248, 592, 1},\n\n {0x10b1, 2796, 1},\n\n {0xabaf, 1637, 1},\n\n {0x1fad, 234, 2},\n\n {0x10caf, 3498, 1},\n\n {0x04cd, 1184, 1},\n\n {0x01cd, 429, 1},\n\n {0xabad, 1631, 1},\n\n {0xa7ad, 658, 1},\n\n {0x10cad, 3492, 1},\n\n {0x00cd, 117, 1},\n\n {0x10af, 2790, 1},\n\n {0x021e, 547, 1},\n\n {0x1fa3, 224, 2},\n {0xffffffff, -1, 0},\n\n {0x03a3, 800, 1},\n\n {0x10ad, 2784, 1},\n\n {0xaba3, 1601, 1},\n {0xffffffff, -1, 0},\n\n {0x10ca3, 3462, 1},\n\n {0x10cd, 2862, 1},\n\n {0x1fa1, 214, 2},\n\n {0x24b7, 2346, 1},\n\n {0x03a1, 796, 1},\n\n {0x0212, 529, 1},\n\n {0xaba1, 1595, 1},\n\n {0x10a3, 2754, 1},\n\n {0x10ca1, 3456, 1},\n\n {0x01d3, 438, 1},\n\n {0x1fd3, 25, 3},\n\n {0x0210, 526, 1},\n {0xffffffff, -1, 0},\n\n {0x00d3, 135, 1},\n\n {0x1e97, 34, 2},\n\n {0x10a1, 2748, 1},\n\n {0x0197, 649, 1},\n\n {0x1f97, 204, 2},\n {0xffffffff, -1, 0},\n\n {0x0397, 759, 1},\n\n {0x1041d, 3324, 1},\n\n {0xab97, 1565, 1},\n\n {0x041d, 929, 1},\n\n {0x10c97, 3426, 1},\n\n {0x1f1d, 2121, 1},\n\n {0x2c1d, 2508, 1},\n\n {0x1e72, 1884, 1},\n\n {0x0472, 1061, 1},\n\n {0x0172, 336, 1},\n\n {0x118b3, 3567, 1},\n\n {0x2c72, 2580, 1},\n\n {0x0372, 712, 1},\n\n {0x1041b, 3318, 1},\n\n {0xab72, 1454, 1},\n\n {0x041b, 923, 1},\n\n {0x118a5, 3525, 1},\n\n {0x1f1b, 2115, 1},\n\n {0x2c1b, 2502, 1},\n\n {0x1e70, 1881, 1},\n\n {0x0470, 1058, 1},\n\n {0x0170, 333, 1},\n\n {0x118b1, 3561, 1},\n\n {0x2c70, 610, 1},\n\n {0x0370, 709, 1},\n\n {0x1e46, 1817, 1},\n\n {0xab70, 1448, 1},\n\n {0x1e66, 1866, 1},\n\n {0x0466, 1043, 1},\n\n {0x0166, 318, 1},\n\n {0x1e44, 1814, 1},\n\n {0x0046, 15, 1},\n\n {0x118af, 3555, 1},\n\n {0xa746, 3027, 1},\n {0xffffffff, -1, 0},\n\n {0xa766, 3075, 1},\n\n {0x0044, 9, 1},\n\n {0x118ad, 3549, 1},\n\n {0xa744, 3024, 1},\n\n {0x1e7a, 1896, 1},\n\n {0x047a, 1073, 1},\n\n {0x1e3a, 1799, 1},\n {0xffffffff, -1, 0},\n\n {0xa646, 2874, 1},\n\n {0x1f3a, 2154, 1},\n\n {0xa666, 2922, 1},\n\n {0xab7a, 1478, 1},\n\n {0x118a3, 3519, 1},\n\n {0xa644, 2871, 1},\n\n {0xa73a, 3009, 1},\n {0xffffffff, -1, 0},\n\n {0x1ef4, 2064, 1},\n\n {0x04f4, 1244, 1},\n\n {0x01f4, 487, 1},\n\n {0x1ff4, 101, 2},\n\n {0x118a1, 3513, 1},\n\n {0x03f4, 762, 1},\n\n {0x1eec, 2052, 1},\n\n {0x04ec, 1232, 1},\n\n {0x01ec, 477, 1},\n\n {0x1fec, 2286, 1},\n\n {0x0546, 1397, 1},\n\n {0x03ec, 872, 1},\n {0xffffffff, -1, 0},\n\n {0x013f, 261, 1},\n\n {0x1f3f, 2169, 1},\n\n {0x0544, 1391, 1},\n\n {0x1eea, 2049, 1},\n\n {0x04ea, 1229, 1},\n\n {0x01ea, 474, 1},\n\n {0x1fea, 2256, 1},\n {0xffffffff, -1, 0},\n\n {0x03ea, 869, 1},\n\n {0x1ee8, 2046, 1},\n\n {0x04e8, 1226, 1},\n\n {0x01e8, 471, 1},\n\n {0x1fe8, 2280, 1},\n\n {0x053a, 1361, 1},\n\n {0x03e8, 866, 1},\n\n {0x1ee6, 2043, 1},\n\n {0x04e6, 1223, 1},\n\n {0x01e6, 468, 1},\n\n {0x1fe6, 88, 2},\n\n {0x1f4b, 2181, 1},\n\n {0x03e6, 863, 1},\n\n {0x1e5e, 1853, 1},\n\n {0x004b, 27, 1},\n\n {0x015e, 306, 1},\n\n {0x2166, 2310, 1},\n\n {0x1ee4, 2040, 1},\n\n {0x04e4, 1220, 1},\n\n {0x01e4, 465, 1},\n\n {0x1fe4, 80, 2},\n\n {0xa75e, 3063, 1},\n\n {0x03e4, 860, 1},\n\n {0x1ee0, 2034, 1},\n\n {0x04e0, 1214, 1},\n\n {0x01e0, 459, 1},\n\n {0x053f, 1376, 1},\n\n {0x2ce0, 2730, 1},\n\n {0x03e0, 854, 1},\n\n {0x1edc, 2028, 1},\n\n {0x04dc, 1208, 1},\n\n {0xa65e, 2910, 1},\n {0xffffffff, -1, 0},\n\n {0x2cdc, 2724, 1},\n\n {0x03dc, 848, 1},\n\n {0x00dc, 159, 1},\n\n {0x1ed0, 2010, 1},\n\n {0x04d0, 1190, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x2cd0, 2706, 1},\n\n {0x03d0, 742, 1},\n\n {0x00d0, 126, 1},\n\n {0x1ecc, 2004, 1},\n\n {0x054b, 1412, 1},\n {0xffffffff, -1, 0},\n\n {0x1fcc, 71, 2},\n\n {0x2ccc, 2700, 1},\n\n {0x1ec6, 1995, 1},\n\n {0x00cc, 114, 1},\n {0xffffffff, -1, 0},\n\n {0x1fc6, 67, 2},\n\n {0x2cc6, 2691, 1},\n\n {0x24c8, 2397, 1},\n\n {0x00c6, 96, 1},\n\n {0x04c5, 1172, 1},\n\n {0x01c5, 417, 1},\n {0xffffffff, -1, 0},\n\n {0x1fbb, 2229, 1},\n\n {0x24c7, 2394, 1},\n\n {0x00c5, 92, 1},\n\n {0x1fb9, 2271, 1},\n\n {0xabbb, 1673, 1},\n\n {0x24c0, 2373, 1},\n\n {0x04c3, 1169, 1},\n\n {0xabb9, 1667, 1},\n\n {0x1fc3, 71, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x00c3, 86, 1},\n\n {0x10c5, 2856, 1},\n\n {0x10bb, 2826, 1},\n\n {0x1ed4, 2016, 1},\n\n {0x04d4, 1196, 1},\n\n {0x10b9, 2820, 1},\n\n {0x13fc, 1700, 1},\n\n {0x2cd4, 2712, 1},\n\n {0x0246, 589, 1},\n\n {0x00d4, 138, 1},\n\n {0x10c3, 2850, 1},\n {0xffffffff, -1, 0},\n\n {0xff3a, 3234, 1},\n\n {0x0244, 688, 1},\n\n {0x019f, 670, 1},\n\n {0x1f9f, 204, 2},\n {0xffffffff, -1, 0},\n\n {0x039f, 789, 1},\n {0xffffffff, -1, 0},\n\n {0xab9f, 1589, 1},\n {0xffffffff, -1, 0},\n\n {0x10c9f, 3450, 1},\n\n {0x019d, 667, 1},\n\n {0x1f9d, 194, 2},\n\n {0x023a, 2565, 1},\n\n {0x039d, 783, 1},\n\n {0x1e5a, 1847, 1},\n\n {0xab9d, 1583, 1},\n\n {0x015a, 300, 1},\n\n {0x10c9d, 3444, 1},\n\n {0x1e9b, 1856, 1},\n\n {0x24cd, 2412, 1},\n\n {0x005a, 74, 1},\n\n {0x1f9b, 184, 2},\n\n {0xa75a, 3057, 1},\n\n {0x039b, 776, 1},\n\n {0x1ece, 2007, 1},\n\n {0xab9b, 1577, 1},\n\n {0x1e99, 42, 2},\n\n {0x10c9b, 3438, 1},\n\n {0x2cce, 2703, 1},\n\n {0x1f99, 174, 2},\n\n {0x00ce, 120, 1},\n\n {0x0399, 767, 1},\n\n {0xa65a, 2904, 1},\n\n {0xab99, 1571, 1},\n {0xffffffff, -1, 0},\n\n {0x10c99, 3432, 1},\n\n {0x0193, 634, 1},\n\n {0x1f93, 184, 2},\n\n {0x1e58, 1844, 1},\n\n {0x0393, 746, 1},\n\n {0x0158, 297, 1},\n\n {0xab93, 1553, 1},\n {0xffffffff, -1, 0},\n\n {0x10c93, 3414, 1},\n\n {0x0058, 68, 1},\n\n {0x042d, 977, 1},\n\n {0xa758, 3054, 1},\n\n {0x1f2d, 2139, 1},\n\n {0x2c2d, 2556, 1},\n\n {0x118bb, 3591, 1},\n\n {0x0191, 369, 1},\n\n {0x1f91, 174, 2},\n\n {0x118b9, 3585, 1},\n\n {0x0391, 739, 1},\n {0xffffffff, -1, 0},\n\n {0xab91, 1547, 1},\n\n {0xa658, 2901, 1},\n\n {0x10c91, 3408, 1},\n\n {0x018f, 625, 1},\n\n {0x1f8f, 164, 2},\n {0xffffffff, -1, 0},\n\n {0x038f, 836, 1},\n {0xffffffff, -1, 0},\n\n {0xab8f, 1541, 1},\n {0xffffffff, -1, 0},\n\n {0x10c8f, 3402, 1},\n\n {0x018b, 366, 1},\n\n {0x1f8b, 144, 2},\n {0xffffffff, -1, 0},\n\n {0x0187, 363, 1},\n\n {0x1f87, 164, 2},\n\n {0xab8b, 1529, 1},\n\n {0xa78b, 3111, 1},\n\n {0x10c8b, 3390, 1},\n\n {0xab87, 1517, 1},\n\n {0x04c1, 1166, 1},\n\n {0x10c87, 3378, 1},\n\n {0x1e7e, 1902, 1},\n\n {0x047e, 1079, 1},\n {0xffffffff, -1, 0},\n\n {0x00c1, 80, 1},\n\n {0x2c7e, 580, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xab7e, 1490, 1},\n\n {0xa77e, 3096, 1},\n\n {0x1e76, 1890, 1},\n\n {0x0476, 1067, 1},\n\n {0x0176, 342, 1},\n\n {0x1e42, 1811, 1},\n\n {0x10c1, 2844, 1},\n\n {0x0376, 715, 1},\n\n {0x1e36, 1793, 1},\n\n {0xab76, 1466, 1},\n\n {0x0136, 249, 1},\n\n {0x0042, 3, 1},\n\n {0x1e3e, 1805, 1},\n\n {0xa742, 3021, 1},\n\n {0x1e38, 1796, 1},\n\n {0x1f3e, 2166, 1},\n\n {0xa736, 3003, 1},\n\n {0x1f38, 2148, 1},\n {0xffffffff, -1, 0},\n\n {0x0587, 105, 2},\n\n {0xa73e, 3015, 1},\n {0xffffffff, -1, 0},\n\n {0xa738, 3006, 1},\n\n {0xa642, 2868, 1},\n\n {0x1e5c, 1850, 1},\n\n {0x1e34, 1790, 1},\n\n {0x015c, 303, 1},\n\n {0x0134, 246, 1},\n\n {0x1ef6, 2067, 1},\n\n {0x04f6, 1247, 1},\n\n {0x01f6, 372, 1},\n\n {0x1ff6, 92, 2},\n\n {0xa75c, 3060, 1},\n\n {0xa734, 3000, 1},\n\n {0x1ef0, 2058, 1},\n\n {0x04f0, 1238, 1},\n\n {0x01f0, 20, 2},\n {0xffffffff, -1, 0},\n\n {0x1e30, 1784, 1},\n\n {0x03f0, 772, 1},\n\n {0x0130, 261, 2},\n\n {0x0542, 1385, 1},\n\n {0xa65c, 2907, 1},\n\n {0x1f83, 144, 2},\n\n {0x0536, 1349, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xab83, 1505, 1},\n\n {0x053e, 1373, 1},\n\n {0x10c83, 3366, 1},\n\n {0x0538, 1355, 1},\n\n {0x1eee, 2055, 1},\n\n {0x04ee, 1235, 1},\n\n {0x01ee, 480, 1},\n\n {0x1f8d, 154, 2},\n {0xffffffff, -1, 0},\n\n {0x03ee, 875, 1},\n {0xffffffff, -1, 0},\n\n {0xab8d, 1535, 1},\n\n {0xa78d, 643, 1},\n\n {0x10c8d, 3396, 1},\n\n {0x0534, 1343, 1},\n\n {0x0181, 613, 1},\n\n {0x1f81, 134, 2},\n\n {0x013d, 258, 1},\n\n {0x1f3d, 2163, 1},\n {0xffffffff, -1, 0},\n\n {0xab81, 1499, 1},\n\n {0x017f, 52, 1},\n\n {0x10c81, 3360, 1},\n\n {0x2c7f, 583, 1},\n\n {0x037f, 881, 1},\n\n {0xff2d, 3195, 1},\n\n {0xab7f, 1493, 1},\n\n {0x1e74, 1887, 1},\n\n {0x0474, 1064, 1},\n\n {0x0174, 339, 1},\n\n {0x1e3c, 1802, 1},\n\n {0x0149, 46, 2},\n\n {0x1f49, 2175, 1},\n\n {0x1f3c, 2160, 1},\n\n {0xab74, 1460, 1},\n\n {0x0049, 3606, 1},\n\n {0x0143, 267, 1},\n\n {0x24cc, 2409, 1},\n\n {0xa73c, 3012, 1},\n {0xffffffff, -1, 0},\n\n {0x0043, 6, 1},\n\n {0x0141, 264, 1},\n\n {0x24c6, 2391, 1},\n\n {0x013b, 255, 1},\n\n {0x1f3b, 2157, 1},\n\n {0x0041, 0, 1},\n\n {0x0139, 252, 1},\n\n {0x1f39, 2151, 1},\n\n {0x24c5, 2388, 1},\n\n {0x24bb, 2358, 1},\n\n {0x13fa, 1694, 1},\n\n {0x053d, 1370, 1},\n\n {0x24b9, 2352, 1},\n\n {0x0429, 965, 1},\n\n {0x2183, 2340, 1},\n\n {0x1f29, 2127, 1},\n\n {0x2c29, 2544, 1},\n\n {0x24c3, 2382, 1},\n\n {0x10427, 3354, 1},\n\n {0x10425, 3348, 1},\n\n {0x0427, 959, 1},\n\n {0x0425, 953, 1},\n {0xffffffff, -1, 0},\n\n {0x2c27, 2538, 1},\n\n {0x2c25, 2532, 1},\n\n {0x0549, 1406, 1},\n\n {0x053c, 1367, 1},\n\n {0x10423, 3342, 1},\n {0xffffffff, -1, 0},\n\n {0x0423, 947, 1},\n\n {0x0543, 1388, 1},\n {0xffffffff, -1, 0},\n\n {0x2c23, 2526, 1},\n\n {0xff36, 3222, 1},\n {0xffffffff, -1, 0},\n\n {0x0541, 1382, 1},\n\n {0x10421, 3336, 1},\n\n {0x053b, 1364, 1},\n\n {0x0421, 941, 1},\n\n {0xff38, 3228, 1},\n\n {0x0539, 1358, 1},\n\n {0x2c21, 2520, 1},\n\n {0x10419, 3312, 1},\n\n {0x10417, 3306, 1},\n\n {0x0419, 917, 1},\n\n {0x0417, 911, 1},\n\n {0x1f19, 2109, 1},\n\n {0x2c19, 2496, 1},\n\n {0x2c17, 2490, 1},\n\n {0x023e, 2568, 1},\n\n {0xff34, 3216, 1},\n\n {0x10415, 3300, 1},\n\n {0x10413, 3294, 1},\n\n {0x0415, 905, 1},\n\n {0x0413, 899, 1},\n {0xffffffff, -1, 0},\n\n {0x2c15, 2484, 1},\n\n {0x2c13, 2478, 1},\n {0xffffffff, -1, 0},\n\n {0x24ce, 2415, 1},\n\n {0x1040f, 3282, 1},\n {0xffffffff, -1, 0},\n\n {0x040f, 1031, 1},\n\n {0xff30, 3204, 1},\n\n {0x1f0f, 2103, 1},\n\n {0x2c0f, 2466, 1},\n\n {0x1040d, 3276, 1},\n {0xffffffff, -1, 0},\n\n {0x040d, 1025, 1},\n\n {0x0147, 273, 1},\n\n {0x1f0d, 2097, 1},\n\n {0x2c0d, 2460, 1},\n\n {0x1040b, 3270, 1},\n\n {0x0047, 18, 1},\n\n {0x040b, 1019, 1},\n\n {0x0230, 571, 1},\n\n {0x1f0b, 2091, 1},\n\n {0x2c0b, 2454, 1},\n\n {0x10409, 3264, 1},\n\n {0x10405, 3252, 1},\n\n {0x0409, 1013, 1},\n\n {0x0405, 1001, 1},\n\n {0x1f09, 2085, 1},\n\n {0x2c09, 2448, 1},\n\n {0x2c05, 2436, 1},\n\n {0x10403, 3246, 1},\n\n {0x10401, 3240, 1},\n\n {0x0403, 995, 1},\n\n {0x0401, 989, 1},\n {0xffffffff, -1, 0},\n\n {0x2c03, 2430, 1},\n\n {0x2c01, 2424, 1},\n\n {0x13f9, 1691, 1},\n\n {0x042f, 983, 1},\n {0xffffffff, -1, 0},\n\n {0x1f2f, 2145, 1},\n\n {0x1041f, 3330, 1},\n {0xffffffff, -1, 0},\n\n {0x041f, 935, 1},\n\n {0x023d, 378, 1},\n\n {0x10411, 3288, 1},\n\n {0x2c1f, 2514, 1},\n\n {0x0411, 893, 1},\n\n {0x0547, 1400, 1},\n {0xffffffff, -1, 0},\n\n {0x2c11, 2472, 1},\n\n {0x10407, 3258, 1},\n {0xffffffff, -1, 0},\n\n {0x0407, 1007, 1},\n\n {0x24c1, 2376, 1},\n {0xffffffff, -1, 0},\n\n {0x2c07, 2442, 1},\n {0xffffffff, -1, 0},\n\n {0x13f8, 1688, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff39, 3231, 1},\n {0xffffffff, -1, 0},\n\n {0x0243, 354, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x0241, 586, 1},\n\n {0xff29, 3183, 1},\n\n {0x023b, 577, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff27, 3177, 1},\n\n {0xff25, 3171, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff23, 3165, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff21, 3159, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0xfb17, 117, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff2f, 3201, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xfb15, 113, 2},\n\n {0xfb13, 121, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0xfb05, 29, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xfb03, 0, 3},\n\n {0xfb01, 8, 2}\n };\n\n if (0 == 0)\n {\n int key = hash(&code);\n\n if (key <= MAX_HASH_VALUE && key >= 0)\n {\n OnigCodePoint gcode = wordlist[key].code;\n\n if (code == gcode)\n return &wordlist[key];\n }\n }\n return 0;\n}","target":"unicode_unfold_key(OnigCodePoint code)\n{\n static const struct ByUnfoldKey wordlist[] =\n {\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0x1040a, 3267, 1},\n\n {0x1e0a, 1727, 1},\n\n {0x040a, 1016, 1},\n\n {0x010a, 186, 1},\n\n {0x1f0a, 2088, 1},\n\n {0x2c0a, 2451, 1},\n\n {0x0189, 619, 1},\n\n {0x1f89, 134, 2},\n\n {0x1f85, 154, 2},\n\n {0x0389, 733, 1},\n\n {0x03ff, 724, 1},\n\n {0xab89, 1523, 1},\n\n {0xab85, 1511, 1},\n\n {0x10c89, 3384, 1},\n\n {0x10c85, 3372, 1},\n\n {0x1e84, 1911, 1},\n\n {0x03f5, 752, 1},\n\n {0x0184, 360, 1},\n\n {0x1f84, 149, 2},\n\n {0x2c84, 2592, 1},\n\n {0x017d, 351, 1},\n\n {0x1ff3, 96, 2},\n\n {0xab84, 1508, 1},\n\n {0xa784, 3105, 1},\n\n {0x10c84, 3369, 1},\n\n {0xab7d, 1487, 1},\n\n {0xa77d, 1706, 1},\n\n {0x1e98, 38, 2},\n\n {0x0498, 1106, 1},\n\n {0x0198, 375, 1},\n\n {0x1f98, 169, 2},\n\n {0x2c98, 2622, 1},\n\n {0x0398, 762, 1},\n\n {0xa684, 2940, 1},\n\n {0xab98, 1568, 1},\n\n {0xa798, 3123, 1},\n\n {0x10c98, 3429, 1},\n\n {0x050a, 1277, 1},\n\n {0x1ffb, 2265, 1},\n\n {0x1e96, 16, 2},\n\n {0x0496, 1103, 1},\n\n {0x0196, 652, 1},\n\n {0x1f96, 199, 2},\n\n {0x2c96, 2619, 1},\n\n {0x0396, 756, 1},\n\n {0xa698, 2970, 1},\n\n {0xab96, 1562, 1},\n\n {0xa796, 3120, 1},\n\n {0x10c96, 3423, 1},\n\n {0x1feb, 2259, 1},\n\n {0x2ceb, 2736, 1},\n\n {0x1e90, 1929, 1},\n\n {0x0490, 1094, 1},\n\n {0x0190, 628, 1},\n\n {0x1f90, 169, 2},\n\n {0x2c90, 2610, 1},\n\n {0x0390, 25, 3},\n\n {0xa696, 2967, 1},\n\n {0xab90, 1544, 1},\n\n {0xa790, 3114, 1},\n\n {0x10c90, 3405, 1},\n\n {0x01d7, 444, 1},\n\n {0x1fd7, 31, 3},\n\n {0x1ea6, 1947, 1},\n\n {0x04a6, 1127, 1},\n\n {0x01a6, 676, 1},\n\n {0x1fa6, 239, 2},\n\n {0x2ca6, 2643, 1},\n\n {0x03a6, 810, 1},\n\n {0xa690, 2958, 1},\n\n {0xaba6, 1610, 1},\n\n {0xa7a6, 3144, 1},\n\n {0x10ca6, 3471, 1},\n\n {0x1ea4, 1944, 1},\n\n {0x04a4, 1124, 1},\n\n {0x01a4, 390, 1},\n\n {0x1fa4, 229, 2},\n\n {0x2ca4, 2640, 1},\n\n {0x03a4, 804, 1},\n\n {0x10a6, 2763, 1},\n\n {0xaba4, 1604, 1},\n\n {0xa7a4, 3141, 1},\n\n {0x10ca4, 3465, 1},\n\n {0x1ea0, 1938, 1},\n\n {0x04a0, 1118, 1},\n\n {0x01a0, 384, 1},\n\n {0x1fa0, 209, 2},\n\n {0x2ca0, 2634, 1},\n\n {0x03a0, 792, 1},\n\n {0x10a4, 2757, 1},\n\n {0xaba0, 1592, 1},\n\n {0xa7a0, 3135, 1},\n\n {0x10ca0, 3453, 1},\n\n {0x1eb2, 1965, 1},\n\n {0x04b2, 1145, 1},\n\n {0x01b2, 694, 1},\n\n {0x1fb2, 249, 2},\n\n {0x2cb2, 2661, 1},\n\n {0x03fd, 718, 1},\n\n {0x10a0, 2745, 1},\n\n {0xabb2, 1646, 1},\n\n {0xa7b2, 703, 1},\n\n {0x10cb2, 3507, 1},\n\n {0x1eac, 1956, 1},\n\n {0x04ac, 1136, 1},\n\n {0x01ac, 396, 1},\n\n {0x1fac, 229, 2},\n\n {0x2cac, 2652, 1},\n\n {0x0537, 1352, 1},\n\n {0x10b2, 2799, 1},\n\n {0xabac, 1628, 1},\n\n {0xa7ac, 637, 1},\n\n {0x10cac, 3489, 1},\n\n {0x1eaa, 1953, 1},\n\n {0x04aa, 1133, 1},\n\n {0x00dd, 162, 1},\n\n {0x1faa, 219, 2},\n\n {0x2caa, 2649, 1},\n\n {0x03aa, 824, 1},\n\n {0x10ac, 2781, 1},\n\n {0xabaa, 1622, 1},\n\n {0xa7aa, 646, 1},\n\n {0x10caa, 3483, 1},\n\n {0x1ea8, 1950, 1},\n\n {0x04a8, 1130, 1},\n\n {0x020a, 517, 1},\n\n {0x1fa8, 209, 2},\n\n {0x2ca8, 2646, 1},\n\n {0x03a8, 817, 1},\n\n {0x10aa, 2775, 1},\n\n {0xaba8, 1616, 1},\n\n {0xa7a8, 3147, 1},\n\n {0x10ca8, 3477, 1},\n\n {0x1ea2, 1941, 1},\n\n {0x04a2, 1121, 1},\n\n {0x01a2, 387, 1},\n\n {0x1fa2, 219, 2},\n\n {0x2ca2, 2637, 1},\n\n {0x118a6, 3528, 1},\n\n {0x10a8, 2769, 1},\n\n {0xaba2, 1598, 1},\n\n {0xa7a2, 3138, 1},\n\n {0x10ca2, 3459, 1},\n\n {0x2ced, 2739, 1},\n\n {0x1fe9, 2283, 1},\n\n {0x1fe7, 47, 3},\n\n {0x1eb0, 1962, 1},\n\n {0x04b0, 1142, 1},\n\n {0x118a4, 3522, 1},\n\n {0x10a2, 2751, 1},\n\n {0x2cb0, 2658, 1},\n\n {0x03b0, 41, 3},\n\n {0x1fe3, 41, 3},\n\n {0xabb0, 1640, 1},\n\n {0xa7b0, 706, 1},\n\n {0x10cb0, 3501, 1},\n\n {0x01d9, 447, 1},\n\n {0x1fd9, 2277, 1},\n\n {0x118a0, 3510, 1},\n\n {0x00df, 24, 2},\n\n {0x00d9, 150, 1},\n\n {0xab77, 1469, 1},\n\n {0x10b0, 2793, 1},\n\n {0x1eae, 1959, 1},\n\n {0x04ae, 1139, 1},\n\n {0x01ae, 685, 1},\n\n {0x1fae, 239, 2},\n\n {0x2cae, 2655, 1},\n\n {0x118b2, 3564, 1},\n\n {0xab73, 1457, 1},\n\n {0xabae, 1634, 1},\n\n {0xab71, 1451, 1},\n\n {0x10cae, 3495, 1},\n\n {0x1e2a, 1775, 1},\n\n {0x042a, 968, 1},\n\n {0x012a, 234, 1},\n\n {0x1f2a, 2130, 1},\n\n {0x2c2a, 2547, 1},\n\n {0x118ac, 3546, 1},\n\n {0x10ae, 2787, 1},\n\n {0x0535, 1346, 1},\n\n {0xa72a, 2988, 1},\n\n {0x1e9a, 0, 2},\n\n {0x049a, 1109, 1},\n\n {0xff37, 3225, 1},\n\n {0x1f9a, 179, 2},\n\n {0x2c9a, 2625, 1},\n\n {0x039a, 772, 1},\n\n {0x118aa, 3540, 1},\n\n {0xab9a, 1574, 1},\n\n {0xa79a, 3126, 1},\n\n {0x10c9a, 3435, 1},\n\n {0x1e94, 1935, 1},\n\n {0x0494, 1100, 1},\n\n {0x0194, 640, 1},\n\n {0x1f94, 189, 2},\n\n {0x2c94, 2616, 1},\n\n {0x0394, 749, 1},\n\n {0x118a8, 3534, 1},\n\n {0xab94, 1556, 1},\n\n {0xa69a, 2973, 1},\n\n {0x10c94, 3417, 1},\n\n {0x10402, 3243, 1},\n\n {0x1e02, 1715, 1},\n\n {0x0402, 992, 1},\n\n {0x0102, 174, 1},\n\n {0x0533, 1340, 1},\n\n {0x2c02, 2427, 1},\n\n {0x118a2, 3516, 1},\n\n {0x052a, 1325, 1},\n\n {0xa694, 2964, 1},\n\n {0x1e92, 1932, 1},\n\n {0x0492, 1097, 1},\n\n {0x2165, 2307, 1},\n\n {0x1f92, 179, 2},\n\n {0x2c92, 2613, 1},\n\n {0x0392, 742, 1},\n\n {0x2161, 2295, 1},\n\n {0xab92, 1550, 1},\n\n {0xa792, 3117, 1},\n\n {0x10c92, 3411, 1},\n\n {0x118b0, 3558, 1},\n\n {0x1f5f, 2199, 1},\n\n {0x1e8e, 1926, 1},\n\n {0x048e, 1091, 1},\n\n {0x018e, 453, 1},\n\n {0x1f8e, 159, 2},\n\n {0x2c8e, 2607, 1},\n\n {0x038e, 833, 1},\n\n {0xa692, 2961, 1},\n\n {0xab8e, 1538, 1},\n\n {0x0055, 59, 1},\n\n {0x10c8e, 3399, 1},\n\n {0x1f5d, 2196, 1},\n\n {0x212a, 27, 1},\n\n {0x04cb, 1181, 1},\n\n {0x01cb, 425, 1},\n\n {0x1fcb, 2241, 1},\n\n {0x118ae, 3552, 1},\n\n {0x0502, 1265, 1},\n\n {0x00cb, 111, 1},\n\n {0xa68e, 2955, 1},\n\n {0x1e8a, 1920, 1},\n\n {0x048a, 1085, 1},\n\n {0x018a, 622, 1},\n\n {0x1f8a, 139, 2},\n\n {0x2c8a, 2601, 1},\n\n {0x038a, 736, 1},\n\n {0x2c67, 2571, 1},\n\n {0xab8a, 1526, 1},\n\n {0x1e86, 1914, 1},\n\n {0x10c8a, 3387, 1},\n\n {0x0186, 616, 1},\n\n {0x1f86, 159, 2},\n\n {0x2c86, 2595, 1},\n\n {0x0386, 727, 1},\n\n {0xff35, 3219, 1},\n\n {0xab86, 1514, 1},\n\n {0xa786, 3108, 1},\n\n {0x10c86, 3375, 1},\n\n {0xa68a, 2949, 1},\n\n {0x0555, 1442, 1},\n\n {0x1ebc, 1980, 1},\n\n {0x04bc, 1160, 1},\n\n {0x01bc, 411, 1},\n\n {0x1fbc, 62, 2},\n\n {0x2cbc, 2676, 1},\n\n {0x1f5b, 2193, 1},\n\n {0xa686, 2943, 1},\n\n {0xabbc, 1676, 1},\n\n {0x1eb8, 1974, 1},\n\n {0x04b8, 1154, 1},\n\n {0x01b8, 408, 1},\n\n {0x1fb8, 2268, 1},\n\n {0x2cb8, 2670, 1},\n\n {0x01db, 450, 1},\n\n {0x1fdb, 2247, 1},\n\n {0xabb8, 1664, 1},\n\n {0x10bc, 2829, 1},\n\n {0x00db, 156, 1},\n\n {0x1eb6, 1971, 1},\n\n {0x04b6, 1151, 1},\n\n {0xff33, 3213, 1},\n\n {0x1fb6, 58, 2},\n\n {0x2cb6, 2667, 1},\n\n {0xff2a, 3186, 1},\n\n {0x10b8, 2817, 1},\n\n {0xabb6, 1658, 1},\n\n {0xa7b6, 3153, 1},\n\n {0x10426, 3351, 1},\n\n {0x1e26, 1769, 1},\n\n {0x0426, 956, 1},\n\n {0x0126, 228, 1},\n\n {0x0053, 52, 1},\n\n {0x2c26, 2535, 1},\n\n {0x0057, 65, 1},\n\n {0x10b6, 2811, 1},\n\n {0x022a, 562, 1},\n\n {0xa726, 2982, 1},\n\n {0x1e2e, 1781, 1},\n\n {0x042e, 980, 1},\n\n {0x012e, 240, 1},\n\n {0x1f2e, 2142, 1},\n\n {0x2c2e, 2559, 1},\n {0xffffffff, -1, 0},\n\n {0x2167, 2313, 1},\n {0xffffffff, -1, 0},\n\n {0xa72e, 2994, 1},\n\n {0x1e2c, 1778, 1},\n\n {0x042c, 974, 1},\n\n {0x012c, 237, 1},\n\n {0x1f2c, 2136, 1},\n\n {0x2c2c, 2553, 1},\n\n {0x1f6f, 2223, 1},\n\n {0x2c6f, 604, 1},\n\n {0xabbf, 1685, 1},\n\n {0xa72c, 2991, 1},\n\n {0x1e28, 1772, 1},\n\n {0x0428, 962, 1},\n\n {0x0128, 231, 1},\n\n {0x1f28, 2124, 1},\n\n {0x2c28, 2541, 1},\n {0xffffffff, -1, 0},\n\n {0x0553, 1436, 1},\n\n {0x10bf, 2838, 1},\n\n {0xa728, 2985, 1},\n\n {0x0526, 1319, 1},\n\n {0x0202, 505, 1},\n\n {0x1e40, 1808, 1},\n\n {0x10424, 3345, 1},\n\n {0x1e24, 1766, 1},\n\n {0x0424, 950, 1},\n\n {0x0124, 225, 1},\n {0xffffffff, -1, 0},\n\n {0x2c24, 2529, 1},\n\n {0x052e, 1331, 1},\n\n {0xa740, 3018, 1},\n\n {0x118bc, 3594, 1},\n\n {0xa724, 2979, 1},\n\n {0x1ef2, 2061, 1},\n\n {0x04f2, 1241, 1},\n\n {0x01f2, 483, 1},\n\n {0x1ff2, 257, 2},\n\n {0x2cf2, 2742, 1},\n\n {0x052c, 1328, 1},\n\n {0x118b8, 3582, 1},\n\n {0xa640, 2865, 1},\n\n {0x10422, 3339, 1},\n\n {0x1e22, 1763, 1},\n\n {0x0422, 944, 1},\n\n {0x0122, 222, 1},\n\n {0x2126, 820, 1},\n\n {0x2c22, 2523, 1},\n\n {0x0528, 1322, 1},\n\n {0x01f1, 483, 1},\n\n {0x118b6, 3576, 1},\n\n {0xa722, 2976, 1},\n\n {0x03f1, 796, 1},\n\n {0x1ebe, 1983, 1},\n\n {0x04be, 1163, 1},\n\n {0xfb02, 12, 2},\n\n {0x1fbe, 767, 1},\n\n {0x2cbe, 2679, 1},\n\n {0x01b5, 405, 1},\n\n {0x0540, 1379, 1},\n\n {0xabbe, 1682, 1},\n\n {0x0524, 1316, 1},\n\n {0x00b5, 779, 1},\n\n {0xabb5, 1655, 1},\n\n {0x1eba, 1977, 1},\n\n {0x04ba, 1157, 1},\n\n {0x216f, 2337, 1},\n\n {0x1fba, 2226, 1},\n\n {0x2cba, 2673, 1},\n\n {0x10be, 2835, 1},\n\n {0x0051, 46, 1},\n\n {0xabba, 1670, 1},\n\n {0x10b5, 2808, 1},\n\n {0x1e6e, 1878, 1},\n\n {0x046e, 1055, 1},\n\n {0x016e, 330, 1},\n\n {0x1f6e, 2220, 1},\n\n {0x2c6e, 664, 1},\n\n {0x118bf, 3603, 1},\n\n {0x0522, 1313, 1},\n\n {0x10ba, 2823, 1},\n\n {0xa76e, 3087, 1},\n\n {0x1eb4, 1968, 1},\n\n {0x04b4, 1148, 1},\n\n {0x2c75, 2583, 1},\n\n {0x1fb4, 50, 2},\n\n {0x2cb4, 2664, 1},\n\n {0xab75, 1463, 1},\n\n {0x1ec2, 1989, 1},\n\n {0xabb4, 1652, 1},\n\n {0xa7b4, 3150, 1},\n\n {0x1fc2, 253, 2},\n\n {0x2cc2, 2685, 1},\n\n {0x03c2, 800, 1},\n\n {0x00c2, 83, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff26, 3174, 1},\n\n {0x10b4, 2805, 1},\n\n {0x1eca, 2001, 1},\n\n {0x0551, 1430, 1},\n\n {0x01ca, 425, 1},\n\n {0x1fca, 2238, 1},\n\n {0x2cca, 2697, 1},\n\n {0x10c2, 2847, 1},\n\n {0x00ca, 108, 1},\n\n {0xff2e, 3198, 1},\n\n {0x1e8c, 1923, 1},\n\n {0x048c, 1088, 1},\n\n {0x0226, 556, 1},\n\n {0x1f8c, 149, 2},\n\n {0x2c8c, 2604, 1},\n\n {0x038c, 830, 1},\n {0xffffffff, -1, 0},\n\n {0xab8c, 1532, 1},\n\n {0xff2c, 3192, 1},\n\n {0x10c8c, 3393, 1},\n\n {0x1ec4, 1992, 1},\n\n {0x022e, 568, 1},\n\n {0x01c4, 417, 1},\n\n {0x1fc4, 54, 2},\n\n {0x2cc4, 2688, 1},\n {0xffffffff, -1, 0},\n\n {0x00c4, 89, 1},\n\n {0xff28, 3180, 1},\n\n {0xa68c, 2952, 1},\n\n {0x01cf, 432, 1},\n\n {0x022c, 565, 1},\n\n {0x118be, 3600, 1},\n\n {0x03cf, 839, 1},\n\n {0x00cf, 123, 1},\n\n {0x118b5, 3573, 1},\n {0xffffffff, -1, 0},\n\n {0x10c4, 2853, 1},\n\n {0x216e, 2334, 1},\n\n {0x24cb, 2406, 1},\n\n {0x0228, 559, 1},\n\n {0xff24, 3168, 1},\n {0xffffffff, -1, 0},\n\n {0x118ba, 3588, 1},\n\n {0x1efe, 2079, 1},\n\n {0x04fe, 1259, 1},\n\n {0x01fe, 499, 1},\n\n {0x1e9e, 24, 2},\n\n {0x049e, 1115, 1},\n\n {0x03fe, 721, 1},\n\n {0x1f9e, 199, 2},\n\n {0x2c9e, 2631, 1},\n\n {0x039e, 786, 1},\n\n {0x0224, 553, 1},\n\n {0xab9e, 1586, 1},\n\n {0xa79e, 3132, 1},\n\n {0x10c9e, 3447, 1},\n\n {0x01f7, 414, 1},\n\n {0x1ff7, 67, 3},\n\n {0xff22, 3162, 1},\n\n {0x03f7, 884, 1},\n\n {0x118b4, 3570, 1},\n\n {0x049c, 1112, 1},\n\n {0x019c, 661, 1},\n\n {0x1f9c, 189, 2},\n\n {0x2c9c, 2628, 1},\n\n {0x039c, 779, 1},\n\n {0x24bc, 2361, 1},\n\n {0xab9c, 1580, 1},\n\n {0xa79c, 3129, 1},\n\n {0x10c9c, 3441, 1},\n\n {0x0222, 550, 1},\n\n {0x1e7c, 1899, 1},\n\n {0x047c, 1076, 1},\n\n {0x1e82, 1908, 1},\n\n {0x24b8, 2349, 1},\n\n {0x0182, 357, 1},\n\n {0x1f82, 139, 2},\n\n {0x2c82, 2589, 1},\n\n {0xab7c, 1484, 1},\n {0xffffffff, -1, 0},\n\n {0xab82, 1502, 1},\n\n {0xa782, 3102, 1},\n\n {0x10c82, 3363, 1},\n\n {0x2c63, 1709, 1},\n\n {0x24b6, 2343, 1},\n\n {0x1e80, 1905, 1},\n\n {0x0480, 1082, 1},\n\n {0x1f59, 2190, 1},\n\n {0x1f80, 129, 2},\n\n {0x2c80, 2586, 1},\n\n {0x0059, 71, 1},\n\n {0xa682, 2937, 1},\n\n {0xab80, 1496, 1},\n\n {0xa780, 3099, 1},\n\n {0x10c80, 3357, 1},\n {0xffffffff, -1, 0},\n\n {0x1e4c, 1826, 1},\n\n {0x0145, 270, 1},\n\n {0x014c, 279, 1},\n\n {0x1f4c, 2184, 1},\n\n {0x0345, 767, 1},\n\n {0x0045, 12, 1},\n\n {0x004c, 31, 1},\n\n {0xa680, 2934, 1},\n\n {0xa74c, 3036, 1},\n\n {0x1e4a, 1823, 1},\n\n {0x01d5, 441, 1},\n\n {0x014a, 276, 1},\n\n {0x1f4a, 2178, 1},\n\n {0x03d5, 810, 1},\n\n {0x00d5, 141, 1},\n\n {0x004a, 24, 1},\n\n {0x24bf, 2370, 1},\n\n {0xa74a, 3033, 1},\n\n {0xa64c, 2883, 1},\n\n {0x1041c, 3321, 1},\n\n {0x1e1c, 1754, 1},\n\n {0x041c, 926, 1},\n\n {0x011c, 213, 1},\n\n {0x1f1c, 2118, 1},\n\n {0x2c1c, 2505, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xa64a, 2880, 1},\n\n {0x1041a, 3315, 1},\n\n {0x1e1a, 1751, 1},\n\n {0x041a, 920, 1},\n\n {0x011a, 210, 1},\n\n {0x1f1a, 2112, 1},\n\n {0x2c1a, 2499, 1},\n\n {0xabbd, 1679, 1},\n\n {0x0545, 1394, 1},\n\n {0x054c, 1415, 1},\n\n {0x10418, 3309, 1},\n\n {0x1e18, 1748, 1},\n\n {0x0418, 914, 1},\n\n {0x0118, 207, 1},\n\n {0x1f18, 2106, 1},\n\n {0x2c18, 2493, 1},\n\n {0x10bd, 2832, 1},\n\n {0x2163, 2301, 1},\n\n {0x054a, 1409, 1},\n\n {0x1040e, 3279, 1},\n\n {0x1e0e, 1733, 1},\n\n {0x040e, 1028, 1},\n\n {0x010e, 192, 1},\n\n {0x1f0e, 2100, 1},\n\n {0x2c0e, 2463, 1},\n\n {0x1efc, 2076, 1},\n\n {0x04fc, 1256, 1},\n\n {0x01fc, 496, 1},\n\n {0x1ffc, 96, 2},\n\n {0x051c, 1304, 1},\n\n {0x1040c, 3273, 1},\n\n {0x1e0c, 1730, 1},\n\n {0x040c, 1022, 1},\n\n {0x010c, 189, 1},\n\n {0x1f0c, 2094, 1},\n\n {0x2c0c, 2457, 1},\n\n {0x1f6d, 2217, 1},\n\n {0x2c6d, 607, 1},\n\n {0x051a, 1301, 1},\n\n {0x24be, 2367, 1},\n\n {0x10408, 3261, 1},\n\n {0x1e08, 1724, 1},\n\n {0x0408, 1010, 1},\n\n {0x0108, 183, 1},\n\n {0x1f08, 2082, 1},\n\n {0x2c08, 2445, 1},\n\n {0x04c9, 1178, 1},\n\n {0x0518, 1298, 1},\n\n {0x1fc9, 2235, 1},\n {0xffffffff, -1, 0},\n\n {0x24ba, 2355, 1},\n\n {0x00c9, 105, 1},\n\n {0x10416, 3303, 1},\n\n {0x1e16, 1745, 1},\n\n {0x0416, 908, 1},\n\n {0x0116, 204, 1},\n\n {0x050e, 1283, 1},\n\n {0x2c16, 2487, 1},\n\n {0x10414, 3297, 1},\n\n {0x1e14, 1742, 1},\n\n {0x0414, 902, 1},\n\n {0x0114, 201, 1},\n\n {0x042b, 971, 1},\n\n {0x2c14, 2481, 1},\n\n {0x1f2b, 2133, 1},\n\n {0x2c2b, 2550, 1},\n {0xffffffff, -1, 0},\n\n {0x050c, 1280, 1},\n\n {0x10406, 3255, 1},\n\n {0x1e06, 1721, 1},\n\n {0x0406, 1004, 1},\n\n {0x0106, 180, 1},\n\n {0x13fb, 1697, 1},\n\n {0x2c06, 2439, 1},\n\n {0x24c2, 2379, 1},\n\n {0x118bd, 3597, 1},\n {0xffffffff, -1, 0},\n\n {0x0508, 1274, 1},\n\n {0x10404, 3249, 1},\n\n {0x1e04, 1718, 1},\n\n {0x0404, 998, 1},\n\n {0x0104, 177, 1},\n\n {0x1f95, 194, 2},\n\n {0x2c04, 2433, 1},\n\n {0x0395, 752, 1},\n\n {0x24ca, 2403, 1},\n\n {0xab95, 1559, 1},\n\n {0x0531, 1334, 1},\n\n {0x10c95, 3420, 1},\n\n {0x0516, 1295, 1},\n\n {0x1e6c, 1875, 1},\n\n {0x046c, 1052, 1},\n\n {0x016c, 327, 1},\n\n {0x1f6c, 2214, 1},\n\n {0x216d, 2331, 1},\n\n {0x0514, 1292, 1},\n\n {0x0245, 697, 1},\n\n {0x024c, 598, 1},\n\n {0xa76c, 3084, 1},\n\n {0x10400, 3237, 1},\n\n {0x1e00, 1712, 1},\n\n {0x0400, 986, 1},\n\n {0x0100, 171, 1},\n\n {0x24c4, 2385, 1},\n\n {0x2c00, 2421, 1},\n\n {0x0506, 1271, 1},\n\n {0x024a, 595, 1},\n\n {0x1fab, 224, 2},\n\n {0xa66c, 2931, 1},\n\n {0x03ab, 827, 1},\n\n {0x24cf, 2418, 1},\n\n {0xabab, 1625, 1},\n\n {0xa7ab, 631, 1},\n\n {0x10cab, 3486, 1},\n {0xffffffff, -1, 0},\n\n {0x0504, 1268, 1},\n {0xffffffff, -1, 0},\n\n {0x021c, 544, 1},\n\n {0x01a9, 679, 1},\n\n {0x1fa9, 214, 2},\n\n {0x10ab, 2778, 1},\n\n {0x03a9, 820, 1},\n\n {0x212b, 92, 1},\n\n {0xaba9, 1619, 1},\n\n {0x1e88, 1917, 1},\n\n {0x10ca9, 3480, 1},\n\n {0x021a, 541, 1},\n\n {0x1f88, 129, 2},\n\n {0x2c88, 2598, 1},\n\n {0x0388, 730, 1},\n\n {0x13fd, 1703, 1},\n\n {0xab88, 1520, 1},\n\n {0x10a9, 2772, 1},\n\n {0x10c88, 3381, 1},\n {0xffffffff, -1, 0},\n\n {0x0218, 538, 1},\n\n {0x0500, 1262, 1},\n\n {0x1f4d, 2187, 1},\n\n {0x01a7, 393, 1},\n\n {0x1fa7, 244, 2},\n\n {0x004d, 34, 1},\n\n {0x03a7, 814, 1},\n\n {0xa688, 2946, 1},\n\n {0xaba7, 1613, 1},\n\n {0x020e, 523, 1},\n\n {0x10ca7, 3474, 1},\n\n {0x1e6a, 1872, 1},\n\n {0x046a, 1049, 1},\n\n {0x016a, 324, 1},\n\n {0x1f6a, 2208, 1},\n {0xffffffff, -1, 0},\n\n {0x216c, 2328, 1},\n\n {0x10a7, 2766, 1},\n\n {0x01d1, 435, 1},\n\n {0xa76a, 3081, 1},\n\n {0x020c, 520, 1},\n\n {0x03d1, 762, 1},\n\n {0x00d1, 129, 1},\n\n {0x1e68, 1869, 1},\n\n {0x0468, 1046, 1},\n\n {0x0168, 321, 1},\n\n {0x1f68, 2202, 1},\n {0xffffffff, -1, 0},\n\n {0xff31, 3207, 1},\n\n {0xa66a, 2928, 1},\n\n {0x0208, 514, 1},\n\n {0xa768, 3078, 1},\n\n {0x1e64, 1863, 1},\n\n {0x0464, 1040, 1},\n\n {0x0164, 315, 1},\n\n {0x054d, 1418, 1},\n\n {0x2c64, 673, 1},\n {0xffffffff, -1, 0},\n\n {0xff2b, 3189, 1},\n {0xffffffff, -1, 0},\n\n {0xa764, 3072, 1},\n\n {0xa668, 2925, 1},\n\n {0x0216, 535, 1},\n {0xffffffff, -1, 0},\n\n {0x118ab, 3543, 1},\n\n {0x1e62, 1860, 1},\n\n {0x0462, 1037, 1},\n\n {0x0162, 312, 1},\n\n {0x0214, 532, 1},\n\n {0x2c62, 655, 1},\n\n {0xa664, 2919, 1},\n\n {0x1ed2, 2013, 1},\n\n {0x04d2, 1193, 1},\n\n {0xa762, 3069, 1},\n\n {0x1fd2, 20, 3},\n\n {0x2cd2, 2709, 1},\n\n {0x118a9, 3537, 1},\n\n {0x00d2, 132, 1},\n\n {0x0206, 511, 1},\n\n {0x10420, 3333, 1},\n\n {0x1e20, 1760, 1},\n\n {0x0420, 938, 1},\n\n {0x0120, 219, 1},\n\n {0xa662, 2916, 1},\n\n {0x2c20, 2517, 1},\n\n {0x1e60, 1856, 1},\n\n {0x0460, 1034, 1},\n\n {0x0160, 309, 1},\n\n {0x0204, 508, 1},\n\n {0x2c60, 2562, 1},\n {0xffffffff, -1, 0},\n\n {0x24bd, 2364, 1},\n\n {0x216a, 2322, 1},\n\n {0xa760, 3066, 1},\n {0xffffffff, -1, 0},\n\n {0xfb16, 125, 2},\n\n {0x118a7, 3531, 1},\n\n {0x1efa, 2073, 1},\n\n {0x04fa, 1253, 1},\n\n {0x01fa, 493, 1},\n\n {0x1ffa, 2262, 1},\n\n {0xfb14, 109, 2},\n\n {0x03fa, 887, 1},\n\n {0xa660, 2913, 1},\n\n {0x2168, 2316, 1},\n\n {0x01b7, 700, 1},\n\n {0x1fb7, 10, 3},\n\n {0x1f6b, 2211, 1},\n\n {0x2c6b, 2577, 1},\n\n {0x0200, 502, 1},\n\n {0xabb7, 1661, 1},\n\n {0xfb06, 29, 2},\n\n {0x1e56, 1841, 1},\n\n {0x2164, 2304, 1},\n\n {0x0156, 294, 1},\n\n {0x1f56, 62, 3},\n\n {0x0520, 1310, 1},\n\n {0x004f, 40, 1},\n\n {0x0056, 62, 1},\n\n {0x10b7, 2814, 1},\n\n {0xa756, 3051, 1},\n\n {0xfb04, 5, 3},\n\n {0x1e78, 1893, 1},\n\n {0x0478, 1070, 1},\n\n {0x0178, 168, 1},\n\n {0x1e54, 1838, 1},\n\n {0x2162, 2298, 1},\n\n {0x0154, 291, 1},\n\n {0x1f54, 57, 3},\n\n {0xab78, 1472, 1},\n\n {0xa656, 2898, 1},\n\n {0x0054, 56, 1},\n\n {0x1e52, 1835, 1},\n\n {0xa754, 3048, 1},\n\n {0x0152, 288, 1},\n\n {0x1f52, 52, 3},\n\n {0x24c9, 2400, 1},\n\n {0x1e32, 1787, 1},\n\n {0x0052, 49, 1},\n\n {0x0132, 243, 1},\n\n {0xa752, 3045, 1},\n {0xffffffff, -1, 0},\n\n {0xfb00, 4, 2},\n\n {0xa654, 2895, 1},\n {0xffffffff, -1, 0},\n\n {0xa732, 2997, 1},\n\n {0x2160, 2292, 1},\n\n {0x054f, 1424, 1},\n\n {0x0556, 1445, 1},\n\n {0x1e50, 1832, 1},\n\n {0xa652, 2892, 1},\n\n {0x0150, 285, 1},\n\n {0x1f50, 84, 2},\n\n {0x017b, 348, 1},\n\n {0x1e4e, 1829, 1},\n\n {0x0050, 43, 1},\n\n {0x014e, 282, 1},\n\n {0xa750, 3042, 1},\n\n {0xab7b, 1481, 1},\n\n {0xa77b, 3093, 1},\n\n {0x004e, 37, 1},\n\n {0x0554, 1439, 1},\n\n {0xa74e, 3039, 1},\n\n {0x1e48, 1820, 1},\n {0xffffffff, -1, 0},\n\n {0x216b, 2325, 1},\n\n {0x1f48, 2172, 1},\n\n {0xa650, 2889, 1},\n\n {0x0552, 1433, 1},\n\n {0x0048, 21, 1},\n {0xffffffff, -1, 0},\n\n {0xa748, 3030, 1},\n\n {0xa64e, 2886, 1},\n\n {0x0532, 1337, 1},\n\n {0x1041e, 3327, 1},\n\n {0x1e1e, 1757, 1},\n\n {0x041e, 932, 1},\n\n {0x011e, 216, 1},\n\n {0x118b7, 3579, 1},\n\n {0x2c1e, 2511, 1},\n {0xffffffff, -1, 0},\n\n {0xa648, 2877, 1},\n\n {0x1ff9, 2253, 1},\n {0xffffffff, -1, 0},\n\n {0x03f9, 878, 1},\n\n {0x0550, 1427, 1},\n\n {0x10412, 3291, 1},\n\n {0x1e12, 1739, 1},\n\n {0x0412, 896, 1},\n\n {0x0112, 198, 1},\n\n {0x054e, 1421, 1},\n\n {0x2c12, 2475, 1},\n\n {0x10410, 3285, 1},\n\n {0x1e10, 1736, 1},\n\n {0x0410, 890, 1},\n\n {0x0110, 195, 1},\n {0xffffffff, -1, 0},\n\n {0x2c10, 2469, 1},\n\n {0x2132, 2289, 1},\n\n {0x0548, 1403, 1},\n\n {0x1ef8, 2070, 1},\n\n {0x04f8, 1250, 1},\n\n {0x01f8, 490, 1},\n\n {0x1ff8, 2250, 1},\n\n {0x0220, 381, 1},\n\n {0x1ee2, 2037, 1},\n\n {0x04e2, 1217, 1},\n\n {0x01e2, 462, 1},\n\n {0x1fe2, 36, 3},\n\n {0x2ce2, 2733, 1},\n\n {0x03e2, 857, 1},\n\n {0x051e, 1307, 1},\n\n {0x1ede, 2031, 1},\n\n {0x04de, 1211, 1},\n\n {0x01de, 456, 1},\n {0xffffffff, -1, 0},\n\n {0x2cde, 2727, 1},\n\n {0x03de, 851, 1},\n\n {0x00de, 165, 1},\n\n {0x1f69, 2205, 1},\n\n {0x2c69, 2574, 1},\n\n {0x1eda, 2025, 1},\n\n {0x04da, 1205, 1},\n\n {0x0512, 1289, 1},\n\n {0x1fda, 2244, 1},\n\n {0x2cda, 2721, 1},\n\n {0x03da, 845, 1},\n\n {0x00da, 153, 1},\n {0xffffffff, -1, 0},\n\n {0x0510, 1286, 1},\n\n {0x1ed8, 2022, 1},\n\n {0x04d8, 1202, 1},\n {0xffffffff, -1, 0},\n\n {0x1fd8, 2274, 1},\n\n {0x2cd8, 2718, 1},\n\n {0x03d8, 842, 1},\n\n {0x00d8, 147, 1},\n\n {0x1ed6, 2019, 1},\n\n {0x04d6, 1199, 1},\n {0xffffffff, -1, 0},\n\n {0x1fd6, 76, 2},\n\n {0x2cd6, 2715, 1},\n\n {0x03d6, 792, 1},\n\n {0x00d6, 144, 1},\n\n {0x1ec8, 1998, 1},\n {0xffffffff, -1, 0},\n\n {0x01c8, 421, 1},\n\n {0x1fc8, 2232, 1},\n\n {0x2cc8, 2694, 1},\n\n {0xff32, 3210, 1},\n\n {0x00c8, 102, 1},\n\n {0x04c7, 1175, 1},\n\n {0x01c7, 421, 1},\n\n {0x1fc7, 15, 3},\n\n {0x1ec0, 1986, 1},\n\n {0x04c0, 1187, 1},\n\n {0x00c7, 99, 1},\n {0xffffffff, -1, 0},\n\n {0x2cc0, 2682, 1},\n\n {0x0179, 345, 1},\n\n {0x00c0, 77, 1},\n\n {0x0232, 574, 1},\n\n {0x01b3, 402, 1},\n\n {0x1fb3, 62, 2},\n\n {0xab79, 1475, 1},\n\n {0xa779, 3090, 1},\n\n {0x10c7, 2859, 1},\n\n {0xabb3, 1649, 1},\n\n {0xa7b3, 3156, 1},\n\n {0x1fa5, 234, 2},\n\n {0x10c0, 2841, 1},\n\n {0x03a5, 807, 1},\n {0xffffffff, -1, 0},\n\n {0xaba5, 1607, 1},\n\n {0x01b1, 691, 1},\n\n {0x10ca5, 3468, 1},\n\n {0x10b3, 2802, 1},\n\n {0x2169, 2319, 1},\n\n {0x024e, 601, 1},\n\n {0xabb1, 1643, 1},\n\n {0xa7b1, 682, 1},\n\n {0x10cb1, 3504, 1},\n\n {0x10a5, 2760, 1},\n {0xffffffff, -1, 0},\n\n {0x01af, 399, 1},\n\n {0x1faf, 244, 2},\n {0xffffffff, -1, 0},\n\n {0x0248, 592, 1},\n\n {0x10b1, 2796, 1},\n\n {0xabaf, 1637, 1},\n\n {0x1fad, 234, 2},\n\n {0x10caf, 3498, 1},\n\n {0x04cd, 1184, 1},\n\n {0x01cd, 429, 1},\n\n {0xabad, 1631, 1},\n\n {0xa7ad, 658, 1},\n\n {0x10cad, 3492, 1},\n\n {0x00cd, 117, 1},\n\n {0x10af, 2790, 1},\n\n {0x021e, 547, 1},\n\n {0x1fa3, 224, 2},\n {0xffffffff, -1, 0},\n\n {0x03a3, 800, 1},\n\n {0x10ad, 2784, 1},\n\n {0xaba3, 1601, 1},\n {0xffffffff, -1, 0},\n\n {0x10ca3, 3462, 1},\n\n {0x10cd, 2862, 1},\n\n {0x1fa1, 214, 2},\n\n {0x24b7, 2346, 1},\n\n {0x03a1, 796, 1},\n\n {0x0212, 529, 1},\n\n {0xaba1, 1595, 1},\n\n {0x10a3, 2754, 1},\n\n {0x10ca1, 3456, 1},\n\n {0x01d3, 438, 1},\n\n {0x1fd3, 25, 3},\n\n {0x0210, 526, 1},\n {0xffffffff, -1, 0},\n\n {0x00d3, 135, 1},\n\n {0x1e97, 34, 2},\n\n {0x10a1, 2748, 1},\n\n {0x0197, 649, 1},\n\n {0x1f97, 204, 2},\n {0xffffffff, -1, 0},\n\n {0x0397, 759, 1},\n\n {0x1041d, 3324, 1},\n\n {0xab97, 1565, 1},\n\n {0x041d, 929, 1},\n\n {0x10c97, 3426, 1},\n\n {0x1f1d, 2121, 1},\n\n {0x2c1d, 2508, 1},\n\n {0x1e72, 1884, 1},\n\n {0x0472, 1061, 1},\n\n {0x0172, 336, 1},\n\n {0x118b3, 3567, 1},\n\n {0x2c72, 2580, 1},\n\n {0x0372, 712, 1},\n\n {0x1041b, 3318, 1},\n\n {0xab72, 1454, 1},\n\n {0x041b, 923, 1},\n\n {0x118a5, 3525, 1},\n\n {0x1f1b, 2115, 1},\n\n {0x2c1b, 2502, 1},\n\n {0x1e70, 1881, 1},\n\n {0x0470, 1058, 1},\n\n {0x0170, 333, 1},\n\n {0x118b1, 3561, 1},\n\n {0x2c70, 610, 1},\n\n {0x0370, 709, 1},\n\n {0x1e46, 1817, 1},\n\n {0xab70, 1448, 1},\n\n {0x1e66, 1866, 1},\n\n {0x0466, 1043, 1},\n\n {0x0166, 318, 1},\n\n {0x1e44, 1814, 1},\n\n {0x0046, 15, 1},\n\n {0x118af, 3555, 1},\n\n {0xa746, 3027, 1},\n {0xffffffff, -1, 0},\n\n {0xa766, 3075, 1},\n\n {0x0044, 9, 1},\n\n {0x118ad, 3549, 1},\n\n {0xa744, 3024, 1},\n\n {0x1e7a, 1896, 1},\n\n {0x047a, 1073, 1},\n\n {0x1e3a, 1799, 1},\n {0xffffffff, -1, 0},\n\n {0xa646, 2874, 1},\n\n {0x1f3a, 2154, 1},\n\n {0xa666, 2922, 1},\n\n {0xab7a, 1478, 1},\n\n {0x118a3, 3519, 1},\n\n {0xa644, 2871, 1},\n\n {0xa73a, 3009, 1},\n {0xffffffff, -1, 0},\n\n {0x1ef4, 2064, 1},\n\n {0x04f4, 1244, 1},\n\n {0x01f4, 487, 1},\n\n {0x1ff4, 101, 2},\n\n {0x118a1, 3513, 1},\n\n {0x03f4, 762, 1},\n\n {0x1eec, 2052, 1},\n\n {0x04ec, 1232, 1},\n\n {0x01ec, 477, 1},\n\n {0x1fec, 2286, 1},\n\n {0x0546, 1397, 1},\n\n {0x03ec, 872, 1},\n {0xffffffff, -1, 0},\n\n {0x013f, 261, 1},\n\n {0x1f3f, 2169, 1},\n\n {0x0544, 1391, 1},\n\n {0x1eea, 2049, 1},\n\n {0x04ea, 1229, 1},\n\n {0x01ea, 474, 1},\n\n {0x1fea, 2256, 1},\n {0xffffffff, -1, 0},\n\n {0x03ea, 869, 1},\n\n {0x1ee8, 2046, 1},\n\n {0x04e8, 1226, 1},\n\n {0x01e8, 471, 1},\n\n {0x1fe8, 2280, 1},\n\n {0x053a, 1361, 1},\n\n {0x03e8, 866, 1},\n\n {0x1ee6, 2043, 1},\n\n {0x04e6, 1223, 1},\n\n {0x01e6, 468, 1},\n\n {0x1fe6, 88, 2},\n\n {0x1f4b, 2181, 1},\n\n {0x03e6, 863, 1},\n\n {0x1e5e, 1853, 1},\n\n {0x004b, 27, 1},\n\n {0x015e, 306, 1},\n\n {0x2166, 2310, 1},\n\n {0x1ee4, 2040, 1},\n\n {0x04e4, 1220, 1},\n\n {0x01e4, 465, 1},\n\n {0x1fe4, 80, 2},\n\n {0xa75e, 3063, 1},\n\n {0x03e4, 860, 1},\n\n {0x1ee0, 2034, 1},\n\n {0x04e0, 1214, 1},\n\n {0x01e0, 459, 1},\n\n {0x053f, 1376, 1},\n\n {0x2ce0, 2730, 1},\n\n {0x03e0, 854, 1},\n\n {0x1edc, 2028, 1},\n\n {0x04dc, 1208, 1},\n\n {0xa65e, 2910, 1},\n {0xffffffff, -1, 0},\n\n {0x2cdc, 2724, 1},\n\n {0x03dc, 848, 1},\n\n {0x00dc, 159, 1},\n\n {0x1ed0, 2010, 1},\n\n {0x04d0, 1190, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x2cd0, 2706, 1},\n\n {0x03d0, 742, 1},\n\n {0x00d0, 126, 1},\n\n {0x1ecc, 2004, 1},\n\n {0x054b, 1412, 1},\n {0xffffffff, -1, 0},\n\n {0x1fcc, 71, 2},\n\n {0x2ccc, 2700, 1},\n\n {0x1ec6, 1995, 1},\n\n {0x00cc, 114, 1},\n {0xffffffff, -1, 0},\n\n {0x1fc6, 67, 2},\n\n {0x2cc6, 2691, 1},\n\n {0x24c8, 2397, 1},\n\n {0x00c6, 96, 1},\n\n {0x04c5, 1172, 1},\n\n {0x01c5, 417, 1},\n {0xffffffff, -1, 0},\n\n {0x1fbb, 2229, 1},\n\n {0x24c7, 2394, 1},\n\n {0x00c5, 92, 1},\n\n {0x1fb9, 2271, 1},\n\n {0xabbb, 1673, 1},\n\n {0x24c0, 2373, 1},\n\n {0x04c3, 1169, 1},\n\n {0xabb9, 1667, 1},\n\n {0x1fc3, 71, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x00c3, 86, 1},\n\n {0x10c5, 2856, 1},\n\n {0x10bb, 2826, 1},\n\n {0x1ed4, 2016, 1},\n\n {0x04d4, 1196, 1},\n\n {0x10b9, 2820, 1},\n\n {0x13fc, 1700, 1},\n\n {0x2cd4, 2712, 1},\n\n {0x0246, 589, 1},\n\n {0x00d4, 138, 1},\n\n {0x10c3, 2850, 1},\n {0xffffffff, -1, 0},\n\n {0xff3a, 3234, 1},\n\n {0x0244, 688, 1},\n\n {0x019f, 670, 1},\n\n {0x1f9f, 204, 2},\n {0xffffffff, -1, 0},\n\n {0x039f, 789, 1},\n {0xffffffff, -1, 0},\n\n {0xab9f, 1589, 1},\n {0xffffffff, -1, 0},\n\n {0x10c9f, 3450, 1},\n\n {0x019d, 667, 1},\n\n {0x1f9d, 194, 2},\n\n {0x023a, 2565, 1},\n\n {0x039d, 783, 1},\n\n {0x1e5a, 1847, 1},\n\n {0xab9d, 1583, 1},\n\n {0x015a, 300, 1},\n\n {0x10c9d, 3444, 1},\n\n {0x1e9b, 1856, 1},\n\n {0x24cd, 2412, 1},\n\n {0x005a, 74, 1},\n\n {0x1f9b, 184, 2},\n\n {0xa75a, 3057, 1},\n\n {0x039b, 776, 1},\n\n {0x1ece, 2007, 1},\n\n {0xab9b, 1577, 1},\n\n {0x1e99, 42, 2},\n\n {0x10c9b, 3438, 1},\n\n {0x2cce, 2703, 1},\n\n {0x1f99, 174, 2},\n\n {0x00ce, 120, 1},\n\n {0x0399, 767, 1},\n\n {0xa65a, 2904, 1},\n\n {0xab99, 1571, 1},\n {0xffffffff, -1, 0},\n\n {0x10c99, 3432, 1},\n\n {0x0193, 634, 1},\n\n {0x1f93, 184, 2},\n\n {0x1e58, 1844, 1},\n\n {0x0393, 746, 1},\n\n {0x0158, 297, 1},\n\n {0xab93, 1553, 1},\n {0xffffffff, -1, 0},\n\n {0x10c93, 3414, 1},\n\n {0x0058, 68, 1},\n\n {0x042d, 977, 1},\n\n {0xa758, 3054, 1},\n\n {0x1f2d, 2139, 1},\n\n {0x2c2d, 2556, 1},\n\n {0x118bb, 3591, 1},\n\n {0x0191, 369, 1},\n\n {0x1f91, 174, 2},\n\n {0x118b9, 3585, 1},\n\n {0x0391, 739, 1},\n {0xffffffff, -1, 0},\n\n {0xab91, 1547, 1},\n\n {0xa658, 2901, 1},\n\n {0x10c91, 3408, 1},\n\n {0x018f, 625, 1},\n\n {0x1f8f, 164, 2},\n {0xffffffff, -1, 0},\n\n {0x038f, 836, 1},\n {0xffffffff, -1, 0},\n\n {0xab8f, 1541, 1},\n {0xffffffff, -1, 0},\n\n {0x10c8f, 3402, 1},\n\n {0x018b, 366, 1},\n\n {0x1f8b, 144, 2},\n {0xffffffff, -1, 0},\n\n {0x0187, 363, 1},\n\n {0x1f87, 164, 2},\n\n {0xab8b, 1529, 1},\n\n {0xa78b, 3111, 1},\n\n {0x10c8b, 3390, 1},\n\n {0xab87, 1517, 1},\n\n {0x04c1, 1166, 1},\n\n {0x10c87, 3378, 1},\n\n {0x1e7e, 1902, 1},\n\n {0x047e, 1079, 1},\n {0xffffffff, -1, 0},\n\n {0x00c1, 80, 1},\n\n {0x2c7e, 580, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xab7e, 1490, 1},\n\n {0xa77e, 3096, 1},\n\n {0x1e76, 1890, 1},\n\n {0x0476, 1067, 1},\n\n {0x0176, 342, 1},\n\n {0x1e42, 1811, 1},\n\n {0x10c1, 2844, 1},\n\n {0x0376, 715, 1},\n\n {0x1e36, 1793, 1},\n\n {0xab76, 1466, 1},\n\n {0x0136, 249, 1},\n\n {0x0042, 3, 1},\n\n {0x1e3e, 1805, 1},\n\n {0xa742, 3021, 1},\n\n {0x1e38, 1796, 1},\n\n {0x1f3e, 2166, 1},\n\n {0xa736, 3003, 1},\n\n {0x1f38, 2148, 1},\n {0xffffffff, -1, 0},\n\n {0x0587, 105, 2},\n\n {0xa73e, 3015, 1},\n {0xffffffff, -1, 0},\n\n {0xa738, 3006, 1},\n\n {0xa642, 2868, 1},\n\n {0x1e5c, 1850, 1},\n\n {0x1e34, 1790, 1},\n\n {0x015c, 303, 1},\n\n {0x0134, 246, 1},\n\n {0x1ef6, 2067, 1},\n\n {0x04f6, 1247, 1},\n\n {0x01f6, 372, 1},\n\n {0x1ff6, 92, 2},\n\n {0xa75c, 3060, 1},\n\n {0xa734, 3000, 1},\n\n {0x1ef0, 2058, 1},\n\n {0x04f0, 1238, 1},\n\n {0x01f0, 20, 2},\n {0xffffffff, -1, 0},\n\n {0x1e30, 1784, 1},\n\n {0x03f0, 772, 1},\n\n {0x0130, 261, 2},\n\n {0x0542, 1385, 1},\n\n {0xa65c, 2907, 1},\n\n {0x1f83, 144, 2},\n\n {0x0536, 1349, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xab83, 1505, 1},\n\n {0x053e, 1373, 1},\n\n {0x10c83, 3366, 1},\n\n {0x0538, 1355, 1},\n\n {0x1eee, 2055, 1},\n\n {0x04ee, 1235, 1},\n\n {0x01ee, 480, 1},\n\n {0x1f8d, 154, 2},\n {0xffffffff, -1, 0},\n\n {0x03ee, 875, 1},\n {0xffffffff, -1, 0},\n\n {0xab8d, 1535, 1},\n\n {0xa78d, 643, 1},\n\n {0x10c8d, 3396, 1},\n\n {0x0534, 1343, 1},\n\n {0x0181, 613, 1},\n\n {0x1f81, 134, 2},\n\n {0x013d, 258, 1},\n\n {0x1f3d, 2163, 1},\n {0xffffffff, -1, 0},\n\n {0xab81, 1499, 1},\n\n {0x017f, 52, 1},\n\n {0x10c81, 3360, 1},\n\n {0x2c7f, 583, 1},\n\n {0x037f, 881, 1},\n\n {0xff2d, 3195, 1},\n\n {0xab7f, 1493, 1},\n\n {0x1e74, 1887, 1},\n\n {0x0474, 1064, 1},\n\n {0x0174, 339, 1},\n\n {0x1e3c, 1802, 1},\n\n {0x0149, 46, 2},\n\n {0x1f49, 2175, 1},\n\n {0x1f3c, 2160, 1},\n\n {0xab74, 1460, 1},\n\n {0x0049, 3606, 1},\n\n {0x0143, 267, 1},\n\n {0x24cc, 2409, 1},\n\n {0xa73c, 3012, 1},\n {0xffffffff, -1, 0},\n\n {0x0043, 6, 1},\n\n {0x0141, 264, 1},\n\n {0x24c6, 2391, 1},\n\n {0x013b, 255, 1},\n\n {0x1f3b, 2157, 1},\n\n {0x0041, 0, 1},\n\n {0x0139, 252, 1},\n\n {0x1f39, 2151, 1},\n\n {0x24c5, 2388, 1},\n\n {0x24bb, 2358, 1},\n\n {0x13fa, 1694, 1},\n\n {0x053d, 1370, 1},\n\n {0x24b9, 2352, 1},\n\n {0x0429, 965, 1},\n\n {0x2183, 2340, 1},\n\n {0x1f29, 2127, 1},\n\n {0x2c29, 2544, 1},\n\n {0x24c3, 2382, 1},\n\n {0x10427, 3354, 1},\n\n {0x10425, 3348, 1},\n\n {0x0427, 959, 1},\n\n {0x0425, 953, 1},\n {0xffffffff, -1, 0},\n\n {0x2c27, 2538, 1},\n\n {0x2c25, 2532, 1},\n\n {0x0549, 1406, 1},\n\n {0x053c, 1367, 1},\n\n {0x10423, 3342, 1},\n {0xffffffff, -1, 0},\n\n {0x0423, 947, 1},\n\n {0x0543, 1388, 1},\n {0xffffffff, -1, 0},\n\n {0x2c23, 2526, 1},\n\n {0xff36, 3222, 1},\n {0xffffffff, -1, 0},\n\n {0x0541, 1382, 1},\n\n {0x10421, 3336, 1},\n\n {0x053b, 1364, 1},\n\n {0x0421, 941, 1},\n\n {0xff38, 3228, 1},\n\n {0x0539, 1358, 1},\n\n {0x2c21, 2520, 1},\n\n {0x10419, 3312, 1},\n\n {0x10417, 3306, 1},\n\n {0x0419, 917, 1},\n\n {0x0417, 911, 1},\n\n {0x1f19, 2109, 1},\n\n {0x2c19, 2496, 1},\n\n {0x2c17, 2490, 1},\n\n {0x023e, 2568, 1},\n\n {0xff34, 3216, 1},\n\n {0x10415, 3300, 1},\n\n {0x10413, 3294, 1},\n\n {0x0415, 905, 1},\n\n {0x0413, 899, 1},\n {0xffffffff, -1, 0},\n\n {0x2c15, 2484, 1},\n\n {0x2c13, 2478, 1},\n {0xffffffff, -1, 0},\n\n {0x24ce, 2415, 1},\n\n {0x1040f, 3282, 1},\n {0xffffffff, -1, 0},\n\n {0x040f, 1031, 1},\n\n {0xff30, 3204, 1},\n\n {0x1f0f, 2103, 1},\n\n {0x2c0f, 2466, 1},\n\n {0x1040d, 3276, 1},\n {0xffffffff, -1, 0},\n\n {0x040d, 1025, 1},\n\n {0x0147, 273, 1},\n\n {0x1f0d, 2097, 1},\n\n {0x2c0d, 2460, 1},\n\n {0x1040b, 3270, 1},\n\n {0x0047, 18, 1},\n\n {0x040b, 1019, 1},\n\n {0x0230, 571, 1},\n\n {0x1f0b, 2091, 1},\n\n {0x2c0b, 2454, 1},\n\n {0x10409, 3264, 1},\n\n {0x10405, 3252, 1},\n\n {0x0409, 1013, 1},\n\n {0x0405, 1001, 1},\n\n {0x1f09, 2085, 1},\n\n {0x2c09, 2448, 1},\n\n {0x2c05, 2436, 1},\n\n {0x10403, 3246, 1},\n\n {0x10401, 3240, 1},\n\n {0x0403, 995, 1},\n\n {0x0401, 989, 1},\n {0xffffffff, -1, 0},\n\n {0x2c03, 2430, 1},\n\n {0x2c01, 2424, 1},\n\n {0x13f9, 1691, 1},\n\n {0x042f, 983, 1},\n {0xffffffff, -1, 0},\n\n {0x1f2f, 2145, 1},\n\n {0x1041f, 3330, 1},\n {0xffffffff, -1, 0},\n\n {0x041f, 935, 1},\n\n {0x023d, 378, 1},\n\n {0x10411, 3288, 1},\n\n {0x2c1f, 2514, 1},\n\n {0x0411, 893, 1},\n\n {0x0547, 1400, 1},\n {0xffffffff, -1, 0},\n\n {0x2c11, 2472, 1},\n\n {0x10407, 3258, 1},\n {0xffffffff, -1, 0},\n\n {0x0407, 1007, 1},\n\n {0x24c1, 2376, 1},\n {0xffffffff, -1, 0},\n\n {0x2c07, 2442, 1},\n {0xffffffff, -1, 0},\n\n {0x13f8, 1688, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff39, 3231, 1},\n {0xffffffff, -1, 0},\n\n {0x0243, 354, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0x0241, 586, 1},\n\n {0xff29, 3183, 1},\n\n {0x023b, 577, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff27, 3177, 1},\n\n {0xff25, 3171, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff23, 3165, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff21, 3159, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0xfb17, 117, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xff2f, 3201, 1},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xfb15, 113, 2},\n\n {0xfb13, 121, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n {0xffffffff, -1, 0},\n\n {0xfb05, 29, 2},\n {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0},\n\n {0xfb03, 0, 3},\n\n {0xfb01, 8, 2}\n };\n\n if (0 == 0)\n {\n int key = hash(&code);\n\n if (key <= MAX_HASH_VALUE && key >= 0)\n {\n OnigCodePoint gcode = wordlist[key].code;\n\n if (code == gcode && wordlist[key].index >= 0)\n return &wordlist[key];\n }\n }\n return 0;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"unicode_unfold_key","file_name":"src/unicode_unfold_key.c","commit_link":"github.com/kkos/oniguruma/commit/166a6c3999bf06b4de0ab4ce6b088a468cc4029f","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#42-21d2d1055117","input":"PHP_FUNCTION(imagegammacorrect)\n{\n\tzval *IM;\n\tgdImagePtr im;\n\tint i;\n\tdouble input, output;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rdd\", &IM, &input, &output) == FAILURE) {\n\t\treturn;\n\t}\n\n\tZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, \"Image\", le_gd);\n\n\tif (gdImageTrueColor(im))\t{\n\t\tint x, y, c;\n\n\t\tfor (y = 0; y < gdImageSY(im); y++)\t{\n\t\t\tfor (x = 0; x < gdImageSX(im); x++)\t{\n\t\t\t\tc = gdImageGetPixel(im, x, y);\n\t\t\t\tgdImageSetPixel(im, x, y,\n\t\t\t\t\tgdTrueColorAlpha(\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetRed(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetGreen(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\tgdTrueColorGetAlpha(c)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tRETURN_TRUE;\n\t}\n\n\tfor (i = 0; i < gdImageColorsTotal(im); i++) {\n\t\tim->red[i] = (int)((pow((pow((im->red[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t\tim->green[i] = (int)((pow((pow((im->green[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t\tim->blue[i] = (int)((pow((pow((im->blue[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t}\n\n\tRETURN_TRUE;\n}","target":"PHP_FUNCTION(imagegammacorrect)\n{\n\tzval *IM;\n\tgdImagePtr im;\n\tint i;\n\tdouble input, output;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rdd\", &IM, &input, &output) == FAILURE) {\n\t\treturn;\n\t}\n\n\tif ( input <= 0.0 || output <= 0.0 ) {\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Gamma values should be positive\");\n\t\tRETURN_FALSE;\n\t}\n\n\tZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, \"Image\", le_gd);\n\n\tif (gdImageTrueColor(im))\t{\n\t\tint x, y, c;\n\n\t\tfor (y = 0; y < gdImageSY(im); y++)\t{\n\t\t\tfor (x = 0; x < gdImageSX(im); x++)\t{\n\t\t\t\tc = gdImageGetPixel(im, x, y);\n\t\t\t\tgdImageSetPixel(im, x, y,\n\t\t\t\t\tgdTrueColorAlpha(\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetRed(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetGreen(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\t(int) ((pow((pow((gdTrueColorGetBlue(c) / 255.0), input)), 1.0 / output) * 255) + .5),\n\t\t\t\t\t\tgdTrueColorGetAlpha(c)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tRETURN_TRUE;\n\t}\n\n\tfor (i = 0; i < gdImageColorsTotal(im); i++) {\n\t\tim->red[i] = (int)((pow((pow((im->red[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t\tim->green[i] = (int)((pow((pow((im->green[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t\tim->blue[i] = (int)((pow((pow((im->blue[i] / 255.0), input)), 1.0 / output) * 255) + .5);\n\t}\n\n\tRETURN_TRUE;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"PHP_FUNCTION","file_name":"ext/gd/gd.c","commit_link":"github.com/php/php-src/commit/1bd103df00f49cf4d4ade2cfe3f456ac058a4eae","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#43-37e1405ec1f6","input":"char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length)\n{\n char *buffer=NULL;\n int n=0;\n\n FILEXFER_ALLOWED_OR_CLOSE_AND_RETURN(\"\", cl, NULL);\n /*\n rfbLog(\"rfbProcessFileTransferReadBuffer(%dlen)\\n\", length);\n */\n if (length>0) {\n buffer=malloc((uint64_t)length+1);\n if (buffer!=NULL) {\n if ((n = rfbReadExact(cl, (char *)buffer, length)) <= 0) {\n if (n != 0)\n rfbLogPerror(\"rfbProcessFileTransferReadBuffer: read\");\n rfbCloseClient(cl);\n /* NOTE: don't forget to free(buffer) if you return early! */\n if (buffer!=NULL) free(buffer);\n return NULL;\n }\n /* Null Terminate */\n buffer[length]=0;\n }\n }\n return buffer;\n}","target":"char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length)\n{\n char *buffer=NULL;\n int n=0;\n\n FILEXFER_ALLOWED_OR_CLOSE_AND_RETURN(\"\", cl, NULL);\n\n /*\n We later alloc length+1, which might wrap around on 32-bit systems if length equals\n 0XFFFFFFFF, i.e. SIZE_MAX for 32-bit systems. On 64-bit systems, a length of 0XFFFFFFFF\n will safely be allocated since this check will never trigger and malloc() can digest length+1\n without problems as length is a uint32_t.\n */\n if(length == SIZE_MAX) {\n\trfbErr(\"rfbProcessFileTransferReadBuffer: too big file transfer length requested: %u\", (unsigned int)length);\n\trfbCloseClient(cl);\n\treturn NULL;\n }\n\n if (length>0) {\n buffer=malloc((size_t)length+1);\n if (buffer!=NULL) {\n if ((n = rfbReadExact(cl, (char *)buffer, length)) <= 0) {\n if (n != 0)\n rfbLogPerror(\"rfbProcessFileTransferReadBuffer: read\");\n rfbCloseClient(cl);\n /* NOTE: don't forget to free(buffer) if you return early! */\n if (buffer!=NULL) free(buffer);\n return NULL;\n }\n /* Null Terminate */\n buffer[length]=0;\n }\n }\n return buffer;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"rfbProcessFileTransferReadBuffer","file_name":"libvncserver/rfbserver.c","commit_link":"github.com/LibVNC/libvncserver/commit/15bb719c03cc70f14c36a843dcb16ed69b405707","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#44-b0622fbb6b76","input":"static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *buf, int size)\n{\n int i, j, ret;\n int64_t off;\n int val_1;\n int num_video;\n AVIOContext pb0, *pb = &pb0;\n\n ffio_init_context(pb, buf, size, 0, NULL, NULL, NULL, NULL);\n\n ffio_read_varlen(pb); // track_header_len\n avio_r8(pb); // '1'\n\n val_1 = ffio_read_varlen(pb);\n\n for (i=0;iid = i;\n\n st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;\n st->codecpar->codec_id = AV_CODEC_ID_VP6;\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb);\n avio_r8(pb); // '3'\n avio_r8(pb); // val_7\n num = avio_rl32(pb); // frame_time\n den = avio_rl32(pb); // time_base\n avpriv_set_pts_info(st, 64, num, den);\n st->nb_frames = avio_rl32(pb); // n frames\n st->codecpar->width = avio_rl16(pb); // width\n st->codecpar->height = avio_rl16(pb); // height\n avio_r8(pb); // val_8\n avio_rl32(pb); // val_9\n\n avio_seek(pb, off, SEEK_SET);\n }\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb); // val_10\n avio_r8(pb); // '4'\n viv->num_audio = avio_r8(pb);\n avio_seek(pb, off, SEEK_SET);\n\n if (viv->num_audio != 1)\n av_log(s, AV_LOG_WARNING, \"number of audio tracks %d is not 1\\n\", viv->num_audio);\n\n for(i=0;inum_audio;i++) {\n int q;\n AVStream *st = avformat_new_stream(s, NULL);\n if (!st)\n return AVERROR(ENOMEM);\n\n st->id = num_video + i;\n\n st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;\n st->codecpar->codec_id = AV_CODEC_ID_VORBIS;\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb); // length\n avio_r8(pb); // '5'\n avio_r8(pb); //codec_id\n avio_rl16(pb); //codec_subid\n st->codecpar->channels = avio_rl16(pb); // channels\n st->codecpar->sample_rate = avio_rl32(pb); // sample_rate\n avio_seek(pb, 10, SEEK_CUR); // data_1\n q = avio_r8(pb);\n avio_seek(pb, q, SEEK_CUR); // data_2\n avio_r8(pb); // zeropad\n\n if (avio_tell(pb) < off) {\n int num_data;\n int xd_size = 0;\n int data_len[256];\n int offset = 1;\n uint8_t *p;\n ffio_read_varlen(pb); // val_13\n avio_r8(pb); // '19'\n ffio_read_varlen(pb); // len_3\n num_data = avio_r8(pb);\n for (j = 0; j < num_data; j++) {\n uint64_t len = ffio_read_varlen(pb);\n if (len > INT_MAX/2 - xd_size) {\n return AVERROR_INVALIDDATA;\n }\n data_len[j] = len;\n xd_size += len;\n }\n\n ret = ff_alloc_extradata(st->codecpar, 64 + xd_size + xd_size / 255);\n if (ret < 0)\n return ret;\n\n p = st->codecpar->extradata;\n p[0] = 2;\n\n for (j = 0; j < num_data - 1; j++) {\n unsigned delta = av_xiphlacing(&p[offset], data_len[j]);\n if (delta > data_len[j]) {\n return AVERROR_INVALIDDATA;\n }\n offset += delta;\n }\n\n for (j = 0; j < num_data; j++) {\n int ret = avio_read(pb, &p[offset], data_len[j]);\n if (ret < data_len[j]) {\n st->codecpar->extradata_size = 0;\n av_freep(&st->codecpar->extradata);\n break;\n }\n offset += data_len[j];\n }\n\n if (offset < st->codecpar->extradata_size)\n st->codecpar->extradata_size = offset;\n }\n }\n\n return 0;\n}","target":"static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *buf, int size)\n{\n int i, j, ret;\n int64_t off;\n int val_1;\n int num_video;\n AVIOContext pb0, *pb = &pb0;\n\n ffio_init_context(pb, buf, size, 0, NULL, NULL, NULL, NULL);\n\n ffio_read_varlen(pb); // track_header_len\n avio_r8(pb); // '1'\n\n val_1 = ffio_read_varlen(pb);\n\n for (i=0;iid = i;\n\n st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;\n st->codecpar->codec_id = AV_CODEC_ID_VP6;\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb);\n avio_r8(pb); // '3'\n avio_r8(pb); // val_7\n num = avio_rl32(pb); // frame_time\n den = avio_rl32(pb); // time_base\n avpriv_set_pts_info(st, 64, num, den);\n st->nb_frames = avio_rl32(pb); // n frames\n st->codecpar->width = avio_rl16(pb); // width\n st->codecpar->height = avio_rl16(pb); // height\n avio_r8(pb); // val_8\n avio_rl32(pb); // val_9\n\n avio_seek(pb, off, SEEK_SET);\n }\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb); // val_10\n avio_r8(pb); // '4'\n viv->num_audio = avio_r8(pb);\n avio_seek(pb, off, SEEK_SET);\n\n if (viv->num_audio != 1)\n av_log(s, AV_LOG_WARNING, \"number of audio tracks %d is not 1\\n\", viv->num_audio);\n\n for(i=0;inum_audio;i++) {\n int q;\n AVStream *st = avformat_new_stream(s, NULL);\n if (!st)\n return AVERROR(ENOMEM);\n\n st->id = num_video + i;\n\n st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;\n st->codecpar->codec_id = AV_CODEC_ID_VORBIS;\n\n off = avio_tell(pb);\n off += ffio_read_varlen(pb); // length\n avio_r8(pb); // '5'\n avio_r8(pb); //codec_id\n avio_rl16(pb); //codec_subid\n st->codecpar->channels = avio_rl16(pb); // channels\n st->codecpar->sample_rate = avio_rl32(pb); // sample_rate\n avio_seek(pb, 10, SEEK_CUR); // data_1\n q = avio_r8(pb);\n avio_seek(pb, q, SEEK_CUR); // data_2\n avio_r8(pb); // zeropad\n\n if (avio_tell(pb) < off) {\n int num_data;\n int xd_size = 1;\n int data_len[256];\n int offset = 1;\n uint8_t *p;\n ffio_read_varlen(pb); // val_13\n avio_r8(pb); // '19'\n ffio_read_varlen(pb); // len_3\n num_data = avio_r8(pb);\n for (j = 0; j < num_data; j++) {\n uint64_t len = ffio_read_varlen(pb);\n if (len > INT_MAX/2 - xd_size) {\n return AVERROR_INVALIDDATA;\n }\n data_len[j] = len;\n xd_size += len + 1 + len/255;\n }\n\n ret = ff_alloc_extradata(st->codecpar, xd_size);\n if (ret < 0)\n return ret;\n\n p = st->codecpar->extradata;\n p[0] = 2;\n\n for (j = 0; j < num_data - 1; j++) {\n unsigned delta = av_xiphlacing(&p[offset], data_len[j]);\n av_assert0(delta <= xd_size - offset);\n offset += delta;\n }\n\n for (j = 0; j < num_data; j++) {\n int ret = avio_read(pb, &p[offset], data_len[j]);\n if (ret < data_len[j]) {\n st->codecpar->extradata_size = 0;\n av_freep(&st->codecpar->extradata);\n break;\n }\n av_assert0(data_len[j] <= xd_size - offset);\n offset += data_len[j];\n }\n\n if (offset < st->codecpar->extradata_size)\n st->codecpar->extradata_size = offset;\n }\n }\n\n return 0;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"track_header","file_name":"libavformat/vividas.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/27a99e2c7d450fef15594671eef4465c8a166bd7","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#45-ce6c4f95924c","input":" yaffsfs_istat(TSK_FS_INFO *fs, TSK_FS_ISTAT_FLAG_ENUM flags, FILE * hFile, TSK_INUM_T inum,\n TSK_DADDR_T numblock, int32_t sec_skew)\n{\n TSK_FS_META *fs_meta;\n TSK_FS_FILE *fs_file;\n YAFFSFS_INFO *yfs = (YAFFSFS_INFO *)fs;\n char ls[12];\n YAFFSFS_PRINT_ADDR print;\n char timeBuf[32];\n YaffsCacheObject * obj = NULL;\n YaffsCacheVersion * version = NULL;\n YaffsHeader * header = NULL;\n\n yaffscache_version_find_by_inode(yfs, inum, &version, &obj);\n\n if ((fs_file = tsk_fs_file_open_meta(fs, NULL, inum)) == NULL) {\n return 1;\n }\n fs_meta = fs_file->meta;\n\n tsk_fprintf(hFile, \"inode: %\" PRIuINUM \"\\n\", inum);\n tsk_fprintf(hFile, \"%sAllocated\\n\",\n (fs_meta->flags & TSK_FS_META_FLAG_ALLOC) ? \"\" : \"Not \");\n\n if (fs_meta->link)\n tsk_fprintf(hFile, \"symbolic link to: %s\\n\", fs_meta->link);\n\n tsk_fprintf(hFile, \"uid / gid: %\" PRIuUID \" / %\" PRIuGID \"\\n\",\n fs_meta->uid, fs_meta->gid);\n\n tsk_fs_meta_make_ls(fs_meta, ls, sizeof(ls));\n tsk_fprintf(hFile, \"mode: %s\\n\", ls);\n\n tsk_fprintf(hFile, \"size: %\" PRIdOFF \"\\n\", fs_meta->size);\n tsk_fprintf(hFile, \"num of links: %d\\n\", fs_meta->nlink);\n\n if(version != NULL){\n yaffsfs_read_header(yfs, &header, version->ycv_header_chunk->ycc_offset);\n if(header != NULL){\n tsk_fprintf(hFile, \"Name: %s\\n\", header->name);\n }\n }\n\n if (sec_skew != 0) {\n tsk_fprintf(hFile, \"\\nAdjusted Inode Times:\\n\");\n fs_meta->mtime -= sec_skew;\n fs_meta->atime -= sec_skew;\n fs_meta->ctime -= sec_skew;\n\n tsk_fprintf(hFile, \"Accessed:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->atime, timeBuf));\n tsk_fprintf(hFile, \"File Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->mtime, timeBuf));\n tsk_fprintf(hFile, \"Inode Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->ctime, timeBuf));\n\n fs_meta->mtime += sec_skew;\n fs_meta->atime += sec_skew;\n fs_meta->ctime += sec_skew;\n\n tsk_fprintf(hFile, \"\\nOriginal Inode Times:\\n\");\n }\n else {\n tsk_fprintf(hFile, \"\\nInode Times:\\n\");\n }\n\n tsk_fprintf(hFile, \"Accessed:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->atime, timeBuf));\n tsk_fprintf(hFile, \"File Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->mtime, timeBuf));\n tsk_fprintf(hFile, \"Inode Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->ctime, timeBuf));\n\n if(version != NULL){\n tsk_fprintf(hFile, \"\\nHeader Chunk:\\n\");\n tsk_fprintf(hFile, \"%\" PRIuDADDR \"\\n\", (version->ycv_header_chunk->ycc_offset / (yfs->page_size + yfs->spare_size)));\n }\n\n if (numblock > 0) {\n TSK_OFF_T lower_size = numblock * fs->block_size;\n fs_meta->size = (lower_size < fs_meta->size)?(lower_size):(fs_meta->size);\n }\n tsk_fprintf(hFile, \"\\nData Chunks:\\n\");\n\n\n if (flags & TSK_FS_ISTAT_RUNLIST){\n const TSK_FS_ATTR *fs_attr_default =\n tsk_fs_file_attr_get_type(fs_file,\n TSK_FS_ATTR_TYPE_DEFAULT, 0, 0);\n if (fs_attr_default && (fs_attr_default->flags & TSK_FS_ATTR_NONRES)) {\n if (tsk_fs_attr_print(fs_attr_default, hFile)) {\n tsk_fprintf(hFile, \"\\nError creating run lists \");\n tsk_error_print(hFile);\n tsk_error_reset();\n }\n }\n }\n else {\n print.idx = 0;\n print.hFile = hFile;\n\n if (tsk_fs_file_walk(fs_file, TSK_FS_FILE_WALK_FLAG_AONLY,\n (TSK_FS_FILE_WALK_CB)print_addr_act, (void *)&print)) {\n tsk_fprintf(hFile, \"\\nError reading file: \");\n tsk_error_print(hFile);\n tsk_error_reset();\n }\n else if (print.idx != 0) {\n tsk_fprintf(hFile, \"\\n\");\n }\n }\n\n tsk_fs_file_close(fs_file);\n\n return 0;\n}","target":" yaffsfs_istat(TSK_FS_INFO *fs, TSK_FS_ISTAT_FLAG_ENUM flags, FILE * hFile, TSK_INUM_T inum,\n TSK_DADDR_T numblock, int32_t sec_skew)\n{\n TSK_FS_META *fs_meta;\n TSK_FS_FILE *fs_file;\n YAFFSFS_INFO *yfs = (YAFFSFS_INFO *)fs;\n char ls[12];\n YAFFSFS_PRINT_ADDR print;\n char timeBuf[128];\n YaffsCacheObject * obj = NULL;\n YaffsCacheVersion * version = NULL;\n YaffsHeader * header = NULL;\n\n yaffscache_version_find_by_inode(yfs, inum, &version, &obj);\n\n if ((fs_file = tsk_fs_file_open_meta(fs, NULL, inum)) == NULL) {\n return 1;\n }\n fs_meta = fs_file->meta;\n\n tsk_fprintf(hFile, \"inode: %\" PRIuINUM \"\\n\", inum);\n tsk_fprintf(hFile, \"%sAllocated\\n\",\n (fs_meta->flags & TSK_FS_META_FLAG_ALLOC) ? \"\" : \"Not \");\n\n if (fs_meta->link)\n tsk_fprintf(hFile, \"symbolic link to: %s\\n\", fs_meta->link);\n\n tsk_fprintf(hFile, \"uid / gid: %\" PRIuUID \" / %\" PRIuGID \"\\n\",\n fs_meta->uid, fs_meta->gid);\n\n tsk_fs_meta_make_ls(fs_meta, ls, sizeof(ls));\n tsk_fprintf(hFile, \"mode: %s\\n\", ls);\n\n tsk_fprintf(hFile, \"size: %\" PRIdOFF \"\\n\", fs_meta->size);\n tsk_fprintf(hFile, \"num of links: %d\\n\", fs_meta->nlink);\n\n if(version != NULL){\n yaffsfs_read_header(yfs, &header, version->ycv_header_chunk->ycc_offset);\n if(header != NULL){\n tsk_fprintf(hFile, \"Name: %s\\n\", header->name);\n }\n }\n\n if (sec_skew != 0) {\n tsk_fprintf(hFile, \"\\nAdjusted Inode Times:\\n\");\n fs_meta->mtime -= sec_skew;\n fs_meta->atime -= sec_skew;\n fs_meta->ctime -= sec_skew;\n\n tsk_fprintf(hFile, \"Accessed:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->atime, timeBuf));\n tsk_fprintf(hFile, \"File Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->mtime, timeBuf));\n tsk_fprintf(hFile, \"Inode Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->ctime, timeBuf));\n\n fs_meta->mtime += sec_skew;\n fs_meta->atime += sec_skew;\n fs_meta->ctime += sec_skew;\n\n tsk_fprintf(hFile, \"\\nOriginal Inode Times:\\n\");\n }\n else {\n tsk_fprintf(hFile, \"\\nInode Times:\\n\");\n }\n\n tsk_fprintf(hFile, \"Accessed:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->atime, timeBuf));\n tsk_fprintf(hFile, \"File Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->mtime, timeBuf));\n tsk_fprintf(hFile, \"Inode Modified:\\t%s\\n\",\n tsk_fs_time_to_str(fs_meta->ctime, timeBuf));\n\n if(version != NULL){\n tsk_fprintf(hFile, \"\\nHeader Chunk:\\n\");\n tsk_fprintf(hFile, \"%\" PRIuDADDR \"\\n\", (version->ycv_header_chunk->ycc_offset / (yfs->page_size + yfs->spare_size)));\n }\n\n if (numblock > 0) {\n TSK_OFF_T lower_size = numblock * fs->block_size;\n fs_meta->size = (lower_size < fs_meta->size)?(lower_size):(fs_meta->size);\n }\n tsk_fprintf(hFile, \"\\nData Chunks:\\n\");\n\n\n if (flags & TSK_FS_ISTAT_RUNLIST){\n const TSK_FS_ATTR *fs_attr_default =\n tsk_fs_file_attr_get_type(fs_file,\n TSK_FS_ATTR_TYPE_DEFAULT, 0, 0);\n if (fs_attr_default && (fs_attr_default->flags & TSK_FS_ATTR_NONRES)) {\n if (tsk_fs_attr_print(fs_attr_default, hFile)) {\n tsk_fprintf(hFile, \"\\nError creating run lists \");\n tsk_error_print(hFile);\n tsk_error_reset();\n }\n }\n }\n else {\n print.idx = 0;\n print.hFile = hFile;\n\n if (tsk_fs_file_walk(fs_file, TSK_FS_FILE_WALK_FLAG_AONLY,\n (TSK_FS_FILE_WALK_CB)print_addr_act, (void *)&print)) {\n tsk_fprintf(hFile, \"\\nError reading file: \");\n tsk_error_print(hFile);\n tsk_error_reset();\n }\n else if (print.idx != 0) {\n tsk_fprintf(hFile, \"\\n\");\n }\n }\n\n tsk_fs_file_close(fs_file);\n\n return 0;\n}","lang":"cpp","vul_type":"cwe-787","sven_meta":{"func_name":"yaffsfs_istat","file_name":"tsk/fs/yaffs.cpp","commit_link":"github.com/sleuthkit/sleuthkit/commit/459ae818fc8dae717549810150de4d191ce158f1","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#46-2fb4764cdb9e","input":"static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)\n{\n ExceptionInfo\n *exception;\n\n int\n bit;\n\n ssize_t\n x;\n\n register PixelPacket\n *q;\n\n IndexPacket\n index;\n\n register IndexPacket\n *indexes;\n\n exception=(&image->exception);\n switch (bpp)\n {\n case 1: /* Convert bitmap scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-7); x+=8)\n {\n for (bit=0; bit < 8; bit++)\n {\n index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);\n SetPixelIndex(indexes+x+bit,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=0; bit < (ssize_t) (image->columns % 8); bit++)\n {\n index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);\n SetPixelIndex(indexes+x+bit,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n p++;\n }\n if (!SyncAuthenticPixels(image,exception))\n break;\n break;\n }\n case 2: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-1); x+=2)\n {\n index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p) & 0x3);\n SetPixelIndex(indexes+x+1,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if ((image->columns % 4) != 0)\n {\n index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n if ((image->columns % 4) >= 1)\n\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n if ((image->columns % 4) >= 2)\n\n {\n index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n }\n p++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n break;\n }\n\n case 4: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-1); x+=2)\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p) & 0x0f);\n SetPixelIndex(indexes+x+1,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if ((image->columns % 2) != 0)\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n break;\n }\n case 8: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL) break;\n indexes=GetAuthenticIndexQueue(image);\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n index=ConstrainColormapIndex(image,*p);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n break;\n\n case 24: /* Convert DirectColor scanline. */\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(q,ScaleCharToQuantum(*p++));\n SetPixelGreen(q,ScaleCharToQuantum(*p++));\n SetPixelBlue(q,ScaleCharToQuantum(*p++));\n q++;\n }\n if (!SyncAuthenticPixels(image,exception))\n break;\n break;\n }\n}","target":"static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)\n{\n ExceptionInfo\n *exception;\n\n int\n bit;\n\n ssize_t\n x;\n\n register PixelPacket\n *q;\n\n IndexPacket\n index;\n\n register IndexPacket\n *indexes;\n\n exception=(&image->exception);\n switch (bpp)\n {\n case 1: /* Convert bitmap scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-7); x+=8)\n {\n for (bit=0; bit < 8; bit++)\n {\n index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);\n SetPixelIndex(indexes+x+bit,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n p++;\n }\n if ((image->columns % 8) != 0)\n {\n for (bit=0; bit < (ssize_t) (image->columns % 8); bit++)\n {\n index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);\n SetPixelIndex(indexes+x+bit,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n p++;\n }\n if (!SyncAuthenticPixels(image,exception))\n break;\n break;\n }\n case 2: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-1); x+=4)\n {\n index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p) & 0x3);\n SetPixelIndex(indexes+x+1,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if ((image->columns % 4) != 0)\n {\n index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n if ((image->columns % 4) >= 1)\n\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n if ((image->columns % 4) >= 2)\n\n {\n index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n }\n }\n p++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n break;\n }\n\n case 4: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n indexes=GetAuthenticIndexQueue(image);\n for (x=0; x < ((ssize_t) image->columns-1); x+=2)\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n q++;\n index=ConstrainColormapIndex(image,(*p) & 0x0f);\n SetPixelIndex(indexes+x+1,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if ((image->columns % 2) != 0)\n {\n index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n break;\n }\n case 8: /* Convert PseudoColor scanline. */\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL) break;\n indexes=GetAuthenticIndexQueue(image);\n\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n index=ConstrainColormapIndex(image,*p);\n SetPixelIndex(indexes+x,index);\n SetPixelRGBO(q,image->colormap+(ssize_t) index);\n p++;\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n break;\n\n case 24: /* Convert DirectColor scanline. */\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetPixelRed(q,ScaleCharToQuantum(*p++));\n SetPixelGreen(q,ScaleCharToQuantum(*p++));\n SetPixelBlue(q,ScaleCharToQuantum(*p++));\n q++;\n }\n if (!SyncAuthenticPixels(image,exception))\n break;\n break;\n }\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"InsertRow","file_name":"coders/wpg.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/b6ae2f9e0ab13343c0281732d479757a8e8979c7","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#47-fc36a5ab46ac","input":"int rds_rdma_extra_size(struct rds_rdma_args *args)\n{\n\tstruct rds_iovec vec;\n\tstruct rds_iovec __user *local_vec;\n\tint tot_pages = 0;\n\tunsigned int nr_pages;\n\tunsigned int i;\n\n\tlocal_vec = (struct rds_iovec __user *)(unsigned long) args->local_vec_addr;\n\n\t/* figure out the number of pages in the vector */\n\tfor (i = 0; i < args->nr_local; i++) {\n\t\tif (copy_from_user(&vec, &local_vec[i],\n\t\t\t\t sizeof(struct rds_iovec)))\n\t\t\treturn -EFAULT;\n\n\t\tnr_pages = rds_pages_in_vec(&vec);\n\t\tif (nr_pages == 0)\n\t\t\treturn -EINVAL;\n\n\t\ttot_pages += nr_pages;\n\n\t\t/*\n\t\t * nr_pages for one entry is limited to (UINT_MAX>>PAGE_SHIFT)+1,\n\t\t * so tot_pages cannot overflow without first going negative.\n\t\t */\n\t\tif (tot_pages < 0)\n\t\t\treturn -EINVAL;\n\t}\n\n\treturn tot_pages * sizeof(struct scatterlist);\n}","target":"int rds_rdma_extra_size(struct rds_rdma_args *args)\n{\n\tstruct rds_iovec vec;\n\tstruct rds_iovec __user *local_vec;\n\tint tot_pages = 0;\n\tunsigned int nr_pages;\n\tunsigned int i;\n\n\tlocal_vec = (struct rds_iovec __user *)(unsigned long) args->local_vec_addr;\n\n\tif (args->nr_local == 0)\n\t\treturn -EINVAL;\n\n\t/* figure out the number of pages in the vector */\n\tfor (i = 0; i < args->nr_local; i++) {\n\t\tif (copy_from_user(&vec, &local_vec[i],\n\t\t\t\t sizeof(struct rds_iovec)))\n\t\t\treturn -EFAULT;\n\n\t\tnr_pages = rds_pages_in_vec(&vec);\n\t\tif (nr_pages == 0)\n\t\t\treturn -EINVAL;\n\n\t\ttot_pages += nr_pages;\n\n\t\t/*\n\t\t * nr_pages for one entry is limited to (UINT_MAX>>PAGE_SHIFT)+1,\n\t\t * so tot_pages cannot overflow without first going negative.\n\t\t */\n\t\tif (tot_pages < 0)\n\t\t\treturn -EINVAL;\n\t}\n\n\treturn tot_pages * sizeof(struct scatterlist);\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"rds_rdma_extra_size","file_name":"net/rds/rdma.c","commit_link":"github.com/torvalds/linux/commit/c095508770aebf1b9218e77026e48345d719b17c","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#48-61fd22b24328","input":"static int decode_frame(AVCodecContext *avctx,\n void *data, int *got_frame,\n AVPacket *avpkt)\n{\n PicContext *s = avctx->priv_data;\n AVFrame *frame = data;\n uint32_t *palette;\n int bits_per_plane, bpp, etype, esize, npal, pos_after_pal;\n int i, x, y, plane, tmp, ret, val;\n\n bytestream2_init(&s->g, avpkt->data, avpkt->size);\n\n if (bytestream2_get_bytes_left(&s->g) < 11)\n return AVERROR_INVALIDDATA;\n\n if (bytestream2_get_le16u(&s->g) != 0x1234)\n return AVERROR_INVALIDDATA;\n\n s->width = bytestream2_get_le16u(&s->g);\n s->height = bytestream2_get_le16u(&s->g);\n bytestream2_skip(&s->g, 4);\n tmp = bytestream2_get_byteu(&s->g);\n bits_per_plane = tmp & 0xF;\n s->nb_planes = (tmp >> 4) + 1;\n bpp = bits_per_plane * s->nb_planes;\n if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {\n avpriv_request_sample(avctx, \"Unsupported bit depth\");\n return AVERROR_PATCHWELCOME;\n }\n\n if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) {\n bytestream2_skip(&s->g, 2);\n etype = bytestream2_get_le16(&s->g);\n esize = bytestream2_get_le16(&s->g);\n if (bytestream2_get_bytes_left(&s->g) < esize)\n return AVERROR_INVALIDDATA;\n } else {\n etype = -1;\n esize = 0;\n }\n\n avctx->pix_fmt = AV_PIX_FMT_PAL8;\n\n if (av_image_check_size(s->width, s->height, 0, avctx) < 0)\n return -1;\n if (s->width != avctx->width && s->height != avctx->height) {\n ret = ff_set_dimensions(avctx, s->width, s->height);\n if (ret < 0)\n return ret;\n }\n\n if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)\n return ret;\n memset(frame->data[0], 0, s->height * frame->linesize[0]);\n frame->pict_type = AV_PICTURE_TYPE_I;\n frame->palette_has_changed = 1;\n\n pos_after_pal = bytestream2_tell(&s->g) + esize;\n palette = (uint32_t*)frame->data[1];\n if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->g) < 6) {\n int idx = bytestream2_get_byte(&s->g);\n npal = 4;\n for (i = 0; i < npal; i++)\n palette[i] = ff_cga_palette[ cga_mode45_index[idx][i] ];\n } else if (etype == 2) {\n npal = FFMIN(esize, 16);\n for (i = 0; i < npal; i++) {\n int pal_idx = bytestream2_get_byte(&s->g);\n palette[i] = ff_cga_palette[FFMIN(pal_idx, 15)];\n }\n } else if (etype == 3) {\n npal = FFMIN(esize, 16);\n for (i = 0; i < npal; i++) {\n int pal_idx = bytestream2_get_byte(&s->g);\n palette[i] = ff_ega_palette[FFMIN(pal_idx, 63)];\n }\n } else if (etype == 4 || etype == 5) {\n npal = FFMIN(esize / 3, 256);\n for (i = 0; i < npal; i++) {\n palette[i] = bytestream2_get_be24(&s->g) << 2;\n palette[i] |= 0xFFU << 24 | palette[i] >> 6 & 0x30303;\n }\n } else {\n if (bpp == 1) {\n npal = 2;\n palette[0] = 0xFF000000;\n palette[1] = 0xFFFFFFFF;\n } else if (bpp == 2) {\n npal = 4;\n for (i = 0; i < npal; i++)\n palette[i] = ff_cga_palette[ cga_mode45_index[0][i] ];\n } else {\n npal = 16;\n memcpy(palette, ff_cga_palette, npal * 4);\n }\n }\n // fill remaining palette entries\n memset(palette + npal, 0, AVPALETTE_SIZE - npal * 4);\n // skip remaining palette bytes\n bytestream2_seek(&s->g, pos_after_pal, SEEK_SET);\n\n val = 0;\n y = s->height - 1;\n if (bytestream2_get_le16(&s->g)) {\n x = 0;\n plane = 0;\n while (bytestream2_get_bytes_left(&s->g) >= 6) {\n int stop_size, marker, t1, t2;\n\n t1 = bytestream2_get_bytes_left(&s->g);\n t2 = bytestream2_get_le16(&s->g);\n stop_size = t1 - FFMIN(t1, t2);\n // ignore uncompressed block size\n bytestream2_skip(&s->g, 2);\n marker = bytestream2_get_byte(&s->g);\n\n while (plane < s->nb_planes &&\n bytestream2_get_bytes_left(&s->g) > stop_size) {\n int run = 1;\n val = bytestream2_get_byte(&s->g);\n if (val == marker) {\n run = bytestream2_get_byte(&s->g);\n if (run == 0)\n run = bytestream2_get_le16(&s->g);\n val = bytestream2_get_byte(&s->g);\n }\n if (!bytestream2_get_bytes_left(&s->g))\n break;\n\n if (bits_per_plane == 8) {\n picmemset_8bpp(s, frame, val, run, &x, &y);\n if (y < 0)\n goto finish;\n } else {\n picmemset(s, frame, val, run, &x, &y, &plane, bits_per_plane);\n }\n }\n }\n\n if (x < avctx->width) {\n int run = (y + 1) * avctx->width - x;\n if (bits_per_plane == 8)\n picmemset_8bpp(s, frame, val, run, &x, &y);\n else\n picmemset(s, frame, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane);\n }\n } else {\n while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) {\n memcpy(frame->data[0] + y * frame->linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g)));\n bytestream2_skip(&s->g, avctx->width);\n y--;\n }\n }\nfinish:\n\n *got_frame = 1;\n return avpkt->size;\n}","target":"static int decode_frame(AVCodecContext *avctx,\n void *data, int *got_frame,\n AVPacket *avpkt)\n{\n PicContext *s = avctx->priv_data;\n AVFrame *frame = data;\n uint32_t *palette;\n int bits_per_plane, bpp, etype, esize, npal, pos_after_pal;\n int i, x, y, plane, tmp, ret, val;\n\n bytestream2_init(&s->g, avpkt->data, avpkt->size);\n\n if (bytestream2_get_bytes_left(&s->g) < 11)\n return AVERROR_INVALIDDATA;\n\n if (bytestream2_get_le16u(&s->g) != 0x1234)\n return AVERROR_INVALIDDATA;\n\n s->width = bytestream2_get_le16u(&s->g);\n s->height = bytestream2_get_le16u(&s->g);\n bytestream2_skip(&s->g, 4);\n tmp = bytestream2_get_byteu(&s->g);\n bits_per_plane = tmp & 0xF;\n s->nb_planes = (tmp >> 4) + 1;\n bpp = bits_per_plane * s->nb_planes;\n if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {\n avpriv_request_sample(avctx, \"Unsupported bit depth\");\n return AVERROR_PATCHWELCOME;\n }\n\n if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) {\n bytestream2_skip(&s->g, 2);\n etype = bytestream2_get_le16(&s->g);\n esize = bytestream2_get_le16(&s->g);\n if (bytestream2_get_bytes_left(&s->g) < esize)\n return AVERROR_INVALIDDATA;\n } else {\n etype = -1;\n esize = 0;\n }\n\n avctx->pix_fmt = AV_PIX_FMT_PAL8;\n\n if (av_image_check_size(s->width, s->height, 0, avctx) < 0)\n return -1;\n if (s->width != avctx->width || s->height != avctx->height) {\n ret = ff_set_dimensions(avctx, s->width, s->height);\n if (ret < 0)\n return ret;\n }\n\n if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)\n return ret;\n memset(frame->data[0], 0, s->height * frame->linesize[0]);\n frame->pict_type = AV_PICTURE_TYPE_I;\n frame->palette_has_changed = 1;\n\n pos_after_pal = bytestream2_tell(&s->g) + esize;\n palette = (uint32_t*)frame->data[1];\n if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->g) < 6) {\n int idx = bytestream2_get_byte(&s->g);\n npal = 4;\n for (i = 0; i < npal; i++)\n palette[i] = ff_cga_palette[ cga_mode45_index[idx][i] ];\n } else if (etype == 2) {\n npal = FFMIN(esize, 16);\n for (i = 0; i < npal; i++) {\n int pal_idx = bytestream2_get_byte(&s->g);\n palette[i] = ff_cga_palette[FFMIN(pal_idx, 15)];\n }\n } else if (etype == 3) {\n npal = FFMIN(esize, 16);\n for (i = 0; i < npal; i++) {\n int pal_idx = bytestream2_get_byte(&s->g);\n palette[i] = ff_ega_palette[FFMIN(pal_idx, 63)];\n }\n } else if (etype == 4 || etype == 5) {\n npal = FFMIN(esize / 3, 256);\n for (i = 0; i < npal; i++) {\n palette[i] = bytestream2_get_be24(&s->g) << 2;\n palette[i] |= 0xFFU << 24 | palette[i] >> 6 & 0x30303;\n }\n } else {\n if (bpp == 1) {\n npal = 2;\n palette[0] = 0xFF000000;\n palette[1] = 0xFFFFFFFF;\n } else if (bpp == 2) {\n npal = 4;\n for (i = 0; i < npal; i++)\n palette[i] = ff_cga_palette[ cga_mode45_index[0][i] ];\n } else {\n npal = 16;\n memcpy(palette, ff_cga_palette, npal * 4);\n }\n }\n // fill remaining palette entries\n memset(palette + npal, 0, AVPALETTE_SIZE - npal * 4);\n // skip remaining palette bytes\n bytestream2_seek(&s->g, pos_after_pal, SEEK_SET);\n\n val = 0;\n y = s->height - 1;\n if (bytestream2_get_le16(&s->g)) {\n x = 0;\n plane = 0;\n while (bytestream2_get_bytes_left(&s->g) >= 6) {\n int stop_size, marker, t1, t2;\n\n t1 = bytestream2_get_bytes_left(&s->g);\n t2 = bytestream2_get_le16(&s->g);\n stop_size = t1 - FFMIN(t1, t2);\n // ignore uncompressed block size\n bytestream2_skip(&s->g, 2);\n marker = bytestream2_get_byte(&s->g);\n\n while (plane < s->nb_planes &&\n bytestream2_get_bytes_left(&s->g) > stop_size) {\n int run = 1;\n val = bytestream2_get_byte(&s->g);\n if (val == marker) {\n run = bytestream2_get_byte(&s->g);\n if (run == 0)\n run = bytestream2_get_le16(&s->g);\n val = bytestream2_get_byte(&s->g);\n }\n if (!bytestream2_get_bytes_left(&s->g))\n break;\n\n if (bits_per_plane == 8) {\n picmemset_8bpp(s, frame, val, run, &x, &y);\n if (y < 0)\n goto finish;\n } else {\n picmemset(s, frame, val, run, &x, &y, &plane, bits_per_plane);\n }\n }\n }\n\n if (x < avctx->width) {\n int run = (y + 1) * avctx->width - x;\n if (bits_per_plane == 8)\n picmemset_8bpp(s, frame, val, run, &x, &y);\n else\n picmemset(s, frame, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane);\n }\n } else {\n while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) {\n memcpy(frame->data[0] + y * frame->linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g)));\n bytestream2_skip(&s->g, avctx->width);\n y--;\n }\n }\nfinish:\n\n *got_frame = 1;\n return avpkt->size;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"decode_frame","file_name":"libavcodec/pictordec.c","commit_link":"github.com/FFmpeg/FFmpeg/commit/8c2ea3030af7b40a3c4275696fb5c76cdb80950a","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#49-d0e19e60cfd3","input":"concat_opt_exact_str(OptStr* to, UChar* s, UChar* end, OnigEncoding enc)\n{\n int i, j, len;\n UChar *p;\n\n for (i = to->len, p = s; p < end && i < OPT_EXACT_MAXLEN; ) {\n len = enclen(enc, p);\n if (i + len > OPT_EXACT_MAXLEN) break;\n for (j = 0; j < len && p < end; j++)\n to->s[i++] = *p++;\n }\n\n to->len = i;\n\n if (p >= end)\n to->reach_end = 1;\n}","target":"concat_opt_exact_str(OptStr* to, UChar* s, UChar* end, OnigEncoding enc)\n{\n int i, j, len;\n UChar *p;\n\n for (i = to->len, p = s; p < end && i < OPT_EXACT_MAXLEN; ) {\n len = enclen(enc, p);\n if (i + len >= OPT_EXACT_MAXLEN) break;\n for (j = 0; j < len && p < end; j++)\n to->s[i++] = *p++;\n }\n\n to->len = i;\n\n if (p >= end)\n to->reach_end = 1;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"concat_opt_exact_str","file_name":"src/regcomp.c","commit_link":"github.com/kkos/oniguruma/commit/cbe9f8bd9cfc6c3c87a60fbae58fa1a85db59df0","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-079#0-04f62704d43f","input":" def init_settings(self, ipython_app, kernel_manager, contents_manager,\n cluster_manager, session_manager, kernel_spec_manager,\n config_manager,\n log, base_url, default_url, settings_overrides,\n jinja_env_options=None):\n\n _template_path = settings_overrides.get(\n \"template_path\",\n ipython_app.template_file_path,\n )\n if isinstance(_template_path, py3compat.string_types):\n _template_path = (_template_path,)\n template_path = [os.path.expanduser(path) for path in _template_path]\n\n jenv_opt = jinja_env_options if jinja_env_options else {}\n env = Environment(loader=FileSystemLoader(template_path), **jenv_opt)\n \n sys_info = get_sys_info()\n if sys_info['commit_source'] == 'repository':\n # don't cache (rely on 304) when working from master\n version_hash = ''\n else:\n # reset the cache on server restart\n version_hash = datetime.datetime.now().strftime(\"%Y%m%d%H%M%S\")\n\n settings = dict(\n # basics\n log_function=log_request,\n base_url=base_url,\n default_url=default_url,\n template_path=template_path,\n static_path=ipython_app.static_file_path,\n static_handler_class = FileFindHandler,\n static_url_prefix = url_path_join(base_url,'/static/'),\n static_handler_args = {\n # don't cache custom.js\n 'no_cache_paths': [url_path_join(base_url, 'static', 'custom')],\n },\n version_hash=version_hash,\n \n # authentication\n cookie_secret=ipython_app.cookie_secret,\n login_url=url_path_join(base_url,'/login'),\n login_handler_class=ipython_app.login_handler_class,\n logout_handler_class=ipython_app.logout_handler_class,\n password=ipython_app.password,\n\n # managers\n kernel_manager=kernel_manager,\n contents_manager=contents_manager,\n cluster_manager=cluster_manager,\n session_manager=session_manager,\n kernel_spec_manager=kernel_spec_manager,\n config_manager=config_manager,\n\n # IPython stuff\n jinja_template_vars=ipython_app.jinja_template_vars,\n nbextensions_path=ipython_app.nbextensions_path,\n websocket_url=ipython_app.websocket_url,\n mathjax_url=ipython_app.mathjax_url,\n config=ipython_app.config,\n jinja2_env=env,\n terminals_available=False, # Set later if terminals are available\n )\n\n # allow custom overrides for the tornado web app.\n settings.update(settings_overrides)\n return settings","target":" def init_settings(self, ipython_app, kernel_manager, contents_manager,\n cluster_manager, session_manager, kernel_spec_manager,\n config_manager,\n log, base_url, default_url, settings_overrides,\n jinja_env_options=None):\n\n _template_path = settings_overrides.get(\n \"template_path\",\n ipython_app.template_file_path,\n )\n if isinstance(_template_path, py3compat.string_types):\n _template_path = (_template_path,)\n template_path = [os.path.expanduser(path) for path in _template_path]\n\n jenv_opt = {\"autoescape\": True}\n jenv_opt.update(jinja_env_options if jinja_env_options else {})\n\n env = Environment(loader=FileSystemLoader(template_path), **jenv_opt)\n \n sys_info = get_sys_info()\n if sys_info['commit_source'] == 'repository':\n # don't cache (rely on 304) when working from master\n version_hash = ''\n else:\n # reset the cache on server restart\n version_hash = datetime.datetime.now().strftime(\"%Y%m%d%H%M%S\")\n\n settings = dict(\n # basics\n log_function=log_request,\n base_url=base_url,\n default_url=default_url,\n template_path=template_path,\n static_path=ipython_app.static_file_path,\n static_handler_class = FileFindHandler,\n static_url_prefix = url_path_join(base_url,'/static/'),\n static_handler_args = {\n # don't cache custom.js\n 'no_cache_paths': [url_path_join(base_url, 'static', 'custom')],\n },\n version_hash=version_hash,\n \n # authentication\n cookie_secret=ipython_app.cookie_secret,\n login_url=url_path_join(base_url,'/login'),\n login_handler_class=ipython_app.login_handler_class,\n logout_handler_class=ipython_app.logout_handler_class,\n password=ipython_app.password,\n\n # managers\n kernel_manager=kernel_manager,\n contents_manager=contents_manager,\n cluster_manager=cluster_manager,\n session_manager=session_manager,\n kernel_spec_manager=kernel_spec_manager,\n config_manager=config_manager,\n\n # IPython stuff\n jinja_template_vars=ipython_app.jinja_template_vars,\n nbextensions_path=ipython_app.nbextensions_path,\n websocket_url=ipython_app.websocket_url,\n mathjax_url=ipython_app.mathjax_url,\n config=ipython_app.config,\n jinja2_env=env,\n terminals_available=False, # Set later if terminals are available\n )\n\n # allow custom overrides for the tornado web app.\n settings.update(settings_overrides)\n return settings","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"init_settings","file_name":"IPython/html/notebookapp.py","commit_link":"github.com/ipython/ipython/commit/3ab41641cf6fce3860c73d5cf4645aa12e1e5892","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#1-fdc5cca261bb","input":" DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) {\n setupUi(this);\n if (size == 1)\n label->setText(tr(\"Are you sure you want to delete '%1' from the transfer list?\", \"Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?\").arg(name));\n else\n label->setText(tr(\"Are you sure you want to delete these %1 torrents from the transfer list?\", \"Are you sure you want to delete these 5 torrents from the transfer list?\").arg(QString::number(size)));\n // Icons\n lbl_warn->setPixmap(GuiIconProvider::instance()->getIcon(\"dialog-warning\").pixmap(lbl_warn->height()));\n lbl_warn->setFixedWidth(lbl_warn->height());\n rememberBtn->setIcon(GuiIconProvider::instance()->getIcon(\"object-locked\"));\n\n move(Utils::Misc::screenCenter(this));\n checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());\n connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));\n buttonBox->button(QDialogButtonBox::Cancel)->setFocus();\n }","target":" DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) {\n setupUi(this);\n if (size == 1)\n label->setText(tr(\"Are you sure you want to delete '%1' from the transfer list?\", \"Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?\").arg(Utils::String::toHtmlEscaped(name)));\n else\n label->setText(tr(\"Are you sure you want to delete these %1 torrents from the transfer list?\", \"Are you sure you want to delete these 5 torrents from the transfer list?\").arg(QString::number(size)));\n // Icons\n lbl_warn->setPixmap(GuiIconProvider::instance()->getIcon(\"dialog-warning\").pixmap(lbl_warn->height()));\n lbl_warn->setFixedWidth(lbl_warn->height());\n rememberBtn->setIcon(GuiIconProvider::instance()->getIcon(\"object-locked\"));\n\n move(Utils::Misc::screenCenter(this));\n checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());\n connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));\n buttonBox->button(QDialogButtonBox::Cancel)->setFocus();\n }","lang":"c","vul_type":"cwe-079","sven_meta":{"func_name":"DeletionConfirmationDlg::DeletionConfirmationDlg","file_name":"src/gui/deletionconfirmationdlg.h","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#2-1f5e3f3e9515","input":" @auth.public\n def get(self, build_id):\n try:\n build_id = int(build_id)\n except ValueError as ex:\n self.response.write(ex.message)\n self.abort(400)\n\n build = model.Build.get_by_id(build_id)\n can_view = build and user.can_view_build_async(build).get_result()\n\n if not can_view:\n if auth.get_current_identity().is_anonymous:\n return self.redirect(gae_users.create_login_url(self.request.url))\n self.response.write('build %d not found' % build_id)\n self.abort(404)\n\n return self.redirect(str(build.url))","target":" @auth.public\n def get(self, build_id):\n try:\n build_id = int(build_id)\n except ValueError:\n self.response.write('invalid build id')\n self.abort(400)\n\n build = model.Build.get_by_id(build_id)\n can_view = build and user.can_view_build_async(build).get_result()\n\n if not can_view:\n if auth.get_current_identity().is_anonymous:\n return self.redirect(self.create_login_url(self.request.url))\n self.response.write('build %d not found' % build_id)\n self.abort(404)\n\n return self.redirect(str(build.url))","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"get","file_name":"appengine/cr-buildbucket/handlers.py","commit_link":"github.com/asdfghjjklllllaaa/infra/commit/2f39f3df54fb79b56744f00bcf97583b3807851f","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#3-4412e8937473","input":"def index(request, is_mobile=False):\n hue_collections = DashboardController(request.user).get_search_collections()\n collection_id = request.GET.get('collection')\n\n if not hue_collections or not collection_id:\n return admin_collections(request, True, is_mobile)\n\n try:\n collection_doc = Document2.objects.get(id=collection_id)\n if USE_NEW_EDITOR.get():\n collection_doc.can_read_or_exception(request.user)\n else:\n collection_doc.doc.get().can_read_or_exception(request.user)\n collection = Collection2(request.user, document=collection_doc)\n except Exception, e:\n raise PopupException(e, title=_(\"Dashboard does not exist or you don't have the permission to access it.\"))\n\n query = {'qs': [{'q': ''}], 'fqs': [], 'start': 0}\n\n if request.method == 'GET':\n if 'q' in request.GET:\n query['qs'][0]['q'] = request.GET.get('q')\n if 'qd' in request.GET:\n query['qd'] = request.GET.get('qd')\n\n template = 'search.mako'\n if is_mobile:\n template = 'search_m.mako'\n\n return render(template, request, {\n 'collection': collection,\n 'query': json.dumps(query),\n 'initial': json.dumps({\n 'collections': [],\n 'layout': DEFAULT_LAYOUT,\n 'is_latest': LATEST.get(),\n 'engines': get_engines(request.user)\n }),\n 'is_owner': collection_doc.doc.get().can_write(request.user),\n 'can_edit_index': can_edit_index(request.user),\n 'is_embeddable': request.GET.get('is_embeddable', False),\n 'mobile': is_mobile,\n })","target":"def index(request, is_mobile=False):\n hue_collections = DashboardController(request.user).get_search_collections()\n collection_id = request.GET.get('collection')\n\n if not hue_collections or not collection_id:\n return admin_collections(request, True, is_mobile)\n\n try:\n collection_doc = Document2.objects.get(id=collection_id)\n if USE_NEW_EDITOR.get():\n collection_doc.can_read_or_exception(request.user)\n else:\n collection_doc.doc.get().can_read_or_exception(request.user)\n collection = Collection2(request.user, document=collection_doc)\n except Exception, e:\n raise PopupException(e, title=_(\"Dashboard does not exist or you don't have the permission to access it.\"))\n\n query = {'qs': [{'q': ''}], 'fqs': [], 'start': 0}\n\n if request.method == 'GET':\n if 'q' in request.GET:\n query['qs'][0]['q'] = antixss(request.GET.get('q', ''))\n if 'qd' in request.GET:\n query['qd'] = antixss(request.GET.get('qd', ''))\n\n template = 'search.mako'\n if is_mobile:\n template = 'search_m.mako'\n\n return render(template, request, {\n 'collection': collection,\n 'query': json.dumps(query),\n 'initial': json.dumps({\n 'collections': [],\n 'layout': DEFAULT_LAYOUT,\n 'is_latest': LATEST.get(),\n 'engines': get_engines(request.user)\n }),\n 'is_owner': collection_doc.can_write(request.user) if USE_NEW_EDITOR.get() else collection_doc.doc.get().can_write(request.user),\n 'can_edit_index': can_edit_index(request.user),\n 'is_embeddable': request.GET.get('is_embeddable', False),\n 'mobile': is_mobile,\n })","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"index","file_name":"desktop/libs/dashboard/src/dashboard/views.py","commit_link":"github.com/gethue/hue/commit/37b529b1f9aeb5d746599a9ed4e2288cf3ad3e1d","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#4-58bb34cd48a1","input":" def respond_error(self, context, exception):\n context.respond_server_error()\n stack = traceback.format_exc()\n return \"\"\"\n \n \n\n \n\n \n
\n

\n Server error\n

\n
\n%s\n                
\n \n \n \"\"\" % stack","target":" def respond_error(self, context, exception):\n context.respond_server_error()\n stack = traceback.format_exc()\n return \"\"\"\n \n \n\n \n\n \n
\n

\n Server error\n

\n
\n%s\n                
\n \n \n \"\"\" % cgi.escape(stack)","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"respond_error","file_name":"ajenti/routing.py","commit_link":"github.com/Eugeny/ajenti/commit/d3fc5eb142ff16d55d158afb050af18d5ff09120","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#5-ebc94b604080","input":"@check_document_access_permission()\ndef edit_bundle(request):\n bundle_id = request.GET.get('bundle')\n doc = None\n \n if bundle_id:\n doc = Document2.objects.get(id=bundle_id)\n bundle = Bundle(document=doc)\n else:\n bundle = Bundle()\n\n coordinators = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='coordinator2')]\n\n return render('editor/bundle_editor.mako', request, {\n 'bundle_json': bundle.json,\n 'coordinators_json': json.dumps(coordinators),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user)) \n })","target":"@check_document_access_permission()\ndef edit_bundle(request):\n bundle_id = request.GET.get('bundle')\n doc = None\n \n if bundle_id:\n doc = Document2.objects.get(id=bundle_id)\n bundle = Bundle(document=doc)\n else:\n bundle = Bundle()\n\n coordinators = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='coordinator2')]\n\n return render('editor/bundle_editor.mako', request, {\n 'bundle_json': bundle.json_for_html(),\n 'coordinators_json': json.dumps(coordinators, cls=JSONEncoderForHTML),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user)) \n })","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"edit_bundle","file_name":"apps/oozie/src/oozie/views/editor2.py","commit_link":"github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#6-63c855d4e2b4","input":"def history_data(start_time, offset=None):\n \"\"\"Return history data.\n\n Arguments:\n start_time: select history starting from this timestamp.\n offset: number of items to skip\n \"\"\"\n # history atimes are stored as ints, ensure start_time is not a float\n start_time = int(start_time)\n hist = objreg.get('web-history')\n if offset is not None:\n entries = hist.entries_before(start_time, limit=1000, offset=offset)\n else:\n # end is 24hrs earlier than start\n end_time = start_time - 24*60*60\n entries = hist.entries_between(end_time, start_time)\n\n return [{\"url\": e.url, \"title\": e.title or e.url, \"time\": e.atime}\n for e in entries]","target":"def history_data(start_time, offset=None):\n \"\"\"Return history data.\n\n Arguments:\n start_time: select history starting from this timestamp.\n offset: number of items to skip\n \"\"\"\n # history atimes are stored as ints, ensure start_time is not a float\n start_time = int(start_time)\n hist = objreg.get('web-history')\n if offset is not None:\n entries = hist.entries_before(start_time, limit=1000, offset=offset)\n else:\n # end is 24hrs earlier than start\n end_time = start_time - 24*60*60\n entries = hist.entries_between(end_time, start_time)\n\n return [{\"url\": html.escape(e.url),\n \"title\": html.escape(e.title) or html.escape(e.url),\n \"time\": e.atime} for e in entries]","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"history_data","file_name":"qutebrowser/browser/qutescheme.py","commit_link":"github.com/qutebrowser/qutebrowser/commit/4c9360237f186681b1e3f2a0f30c45161cf405c7","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#7-ef681c040ce3","input":"@register.filter\ndef json_dumps(value, indent=None):\n if isinstance(value, QuerySet):\n result = serialize('json', value, indent=indent)\n else:\n result = json.dumps(value, indent=indent, cls=DjbletsJSONEncoder)\n\n return mark_safe(result)","target":"@register.filter\ndef json_dumps(value, indent=None):\n if isinstance(value, QuerySet):\n result = serialize('json', value, indent=indent)\n else:\n result = json.dumps(value, indent=indent, cls=DjbletsJSONEncoder)\n\n return mark_safe(force_text(result).translate(_safe_js_escapes))","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"json_dumps","file_name":"djblets/util/templatetags/djblets_js.py","commit_link":"github.com/djblets/djblets/commit/77a68c03cd619a0996f3f37337b8c39ca6643d6e","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#8-9869a184bb30","input":" def htmlvalue(self, val):\n return self.block.render_basic(val)","target":" def htmlvalue(self, val):\n \"\"\"\n Return an HTML representation of this block that is safe to be included\n in comparison views\n \"\"\"\n return escape(text_from_html(self.block.render_basic(val)))","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"htmlvalue","file_name":"wagtail/admin/compare.py","commit_link":"github.com/wagtail/wagtail/commit/61045ceefea114c40ac4b680af58990dbe732389","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#9-ffe37f29f6f1","input":"@register.tag\n@basictag(takes_context=True)\ndef gravatar(context, user, size=None):\n \"\"\"\n Outputs the HTML for displaying a user's gravatar.\n\n This can take an optional size of the image (defaults to 80 if not\n specified).\n\n This is also influenced by the following settings:\n\n GRAVATAR_SIZE - Default size for gravatars\n GRAVATAR_RATING - Maximum allowed rating (g, pg, r, x)\n GRAVATAR_DEFAULT - Default image set to show if the user hasn't\n specified a gravatar (identicon, monsterid, wavatar)\n\n See http://www.gravatar.com/ for more information.\n \"\"\"\n url = get_gravatar_url(context['request'], user, size)\n\n if url:\n return ('\"%s\"' %\n (url, size, size, user.get_full_name() or user.username))\n else:\n return ''","target":"@register.tag\n@basictag(takes_context=True)\ndef gravatar(context, user, size=None):\n \"\"\"\n Outputs the HTML for displaying a user's gravatar.\n\n This can take an optional size of the image (defaults to 80 if not\n specified).\n\n This is also influenced by the following settings:\n\n GRAVATAR_SIZE - Default size for gravatars\n GRAVATAR_RATING - Maximum allowed rating (g, pg, r, x)\n GRAVATAR_DEFAULT - Default image set to show if the user hasn't\n specified a gravatar (identicon, monsterid, wavatar)\n\n See http://www.gravatar.com/ for more information.\n \"\"\"\n url = get_gravatar_url(context['request'], user, size)\n\n if url:\n return format_html(\n '\"{2}\"',\n url, size, user.get_full_name() or user.username)\n else:\n return ''","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"gravatar","file_name":"djblets/gravatars/templatetags/gravatars.py","commit_link":"github.com/djblets/djblets/commit/77ac64642ad530bf69e390c51fc6fdcb8914c8e7","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#10-dcd7d2696a16","input":"QStandardItem* PeerListWidget::addPeer(const QString& ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)\n{\n int row = m_listModel->rowCount();\n // Adding Peer to peer list\n m_listModel->insertRow(row);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip, Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP_HIDDEN), ip);\n if (m_resolveCountries) {\n const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());\n if (!ico.isNull()) {\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);\n const QString countryName = Net::GeoIPManager::CountryName(peer.country());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), countryName, Qt::ToolTipRole);\n }\n else {\n m_missingFlags.insert(ip);\n }\n }\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), peer.connectionType());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flags());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flagsDescription(), Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), peer.client());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PROGRESS), peer.progress());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payloadDownSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::UP_SPEED), peer.payloadUpSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_DOWN), peer.totalDownload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());\n QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\";\")));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\"\\n\")), Qt::ToolTipRole);\n\n return m_listModel->item(row, PeerListDelegate::IP);\n}","target":"QStandardItem* PeerListWidget::addPeer(const QString& ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)\n{\n int row = m_listModel->rowCount();\n // Adding Peer to peer list\n m_listModel->insertRow(row);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP), ip, Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP_HIDDEN), ip);\n if (m_resolveCountries) {\n const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());\n if (!ico.isNull()) {\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);\n const QString countryName = Net::GeoIPManager::CountryName(peer.country());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), countryName, Qt::ToolTipRole);\n }\n else {\n m_missingFlags.insert(ip);\n }\n }\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), peer.connectionType());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flags());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flagsDescription(), Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), Utils::String::toHtmlEscaped(peer.client()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PROGRESS), peer.progress());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payloadDownSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::UP_SPEED), peer.payloadUpSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_DOWN), peer.totalDownload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());\n QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\";\")));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\"\\n\")), Qt::ToolTipRole);\n\n return m_listModel->item(row, PeerListDelegate::IP);\n}","lang":"cpp","vul_type":"cwe-079","sven_meta":{"func_name":"PeerListWidget::addPeer","file_name":"src/gui/properties/peerlistwidget.cpp","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#11-71864406ed9e","input":"def is_safe_url(url, host=None):\n \"\"\"\n Return ``True`` if the url is a safe redirection (i.e. it doesn't point to\n a different host and uses a safe scheme).\n\n Always returns ``False`` on an empty url.\n \"\"\"\n if url is not None:\n url = url.strip()\n if not url:\n return False\n # Chrome treats \\ completely as /\n url = url.replace('\\\\', '/')\n # Chrome considers any URL with more than two slashes to be absolute, but\n # urlparse is not so flexible. Treat any url with three slashes as unsafe.\n if url.startswith('///'):\n return False\n url_info = urlparse(url)\n # Forbid URLs like http:///example.com - with a scheme, but without a hostname.\n # In that URL, example.com is not the hostname but, a path component. However,\n # Chrome will still consider example.com to be the hostname, so we must not\n # allow this syntax.\n if not url_info.netloc and url_info.scheme:\n return False\n # Forbid URLs that start with control characters. Some browsers (like\n # Chrome) ignore quite a few control characters at the start of a\n # URL and might consider the URL as scheme relative.\n if unicodedata.category(url[0])[0] == 'C':\n return False\n return ((not url_info.netloc or url_info.netloc == host) and\n (not url_info.scheme or url_info.scheme in ['http', 'https']))","target":"def is_safe_url(url, host=None):\n \"\"\"\n Return ``True`` if the url is a safe redirection (i.e. it doesn't point to\n a different host and uses a safe scheme).\n\n Always returns ``False`` on an empty url.\n \"\"\"\n if url is not None:\n url = url.strip()\n if not url:\n return False\n # Chrome treats \\ completely as / in paths but it could be part of some\n # basic auth credentials so we need to check both URLs.\n return _is_safe_url(url, host) and _is_safe_url(url.replace('\\\\', '/'), host)","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"is_safe_url","file_name":"django/utils/http.py","commit_link":"github.com/django/django/commit/c5544d289233f501917e25970c03ed444abbd4f0","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#12-27bf8de1e44d","input":" def get_context_data(self, **kwargs):\n context = super().get_context_data(**kwargs)\n context['comments'] = self.object.comment_set.all().order_by('-time')\n context['form'] = self.get_form()\n context['md'] = markdown(self.object.content,\n extensions=[\n 'markdown.extensions.extra',\n 'markdown.extensions.codehilite',\n 'markdown.extensions.toc',\n ])\n\n return context","target":" def get_context_data(self, **kwargs):\n context = super().get_context_data(**kwargs)\n context['comments'] = self.object.comment_set.all().order_by('-time')\n context['form'] = self.get_form()\n context['md'] = safe_md(self.object.content)\n\n return context","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"get_context_data","file_name":"app/Index/views.py","commit_link":"github.com/Cheng-mq1216/production-practice/commit/333dc34f5feada55d1f6ff1255949ca00dec0f9c","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#13-803f93e40115","input":"@check_document_access_permission()\ndef edit_workflow(request):\n workflow_id = request.GET.get('workflow')\n \n if workflow_id:\n wid = {}\n if workflow_id.isdigit():\n wid['id'] = workflow_id\n else:\n wid['uuid'] = workflow_id\n doc = Document2.objects.get(type='oozie-workflow2', **wid)\n workflow = Workflow(document=doc)\n else:\n doc = None\n workflow = Workflow()\n workflow.set_workspace(request.user)\n workflow.check_workspace(request.fs, request.user)\n \n workflow_data = workflow.get_data()\n\n api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))\n\n return render('editor/workflow_editor.mako', request, {\n 'layout_json': json.dumps(workflow_data['layout']),\n 'workflow_json': json.dumps(workflow_data['workflow']),\n 'credentials_json': json.dumps(credentials.credentials.keys()),\n 'workflow_properties_json': json.dumps(WORKFLOW_NODE_PROPERTIES),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'subworkflows_json': json.dumps(_get_workflows(request.user)),\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })","target":"@check_document_access_permission()\ndef edit_workflow(request):\n workflow_id = request.GET.get('workflow')\n \n if workflow_id:\n wid = {}\n if workflow_id.isdigit():\n wid['id'] = workflow_id\n else:\n wid['uuid'] = workflow_id\n doc = Document2.objects.get(type='oozie-workflow2', **wid)\n workflow = Workflow(document=doc)\n else:\n doc = None\n workflow = Workflow()\n workflow.set_workspace(request.user)\n workflow.check_workspace(request.fs, request.user)\n \n workflow_data = workflow.get_data()\n\n api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))\n\n return render('editor/workflow_editor.mako', request, {\n 'layout_json': json.dumps(workflow_data['layout'], cls=JSONEncoderForHTML),\n 'workflow_json': json.dumps(workflow_data['workflow'], cls=JSONEncoderForHTML),\n 'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),\n 'workflow_properties_json': json.dumps(WORKFLOW_NODE_PROPERTIES, cls=JSONEncoderForHTML),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'subworkflows_json': json.dumps(_get_workflows(request.user), cls=JSONEncoderForHTML),\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"edit_workflow","file_name":"apps/oozie/src/oozie/views/editor2.py","commit_link":"github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#14-5914b850b3e2","input":" @classmethod\n def simple_search(cls, query, using=None, index=None):\n es_search = cls.search(using=using, index=index)\n es_query = cls.get_es_query(query=query)\n highlighted_fields = [f.split('^', 1)[0] for f in cls.search_fields]\n\n es_search = es_search.query(es_query).highlight(*highlighted_fields)\n return es_search","target":" @classmethod\n def simple_search(cls, query, using=None, index=None):\n \"\"\"\n Do a search without facets.\n\n This is used in:\n\n * The Docsearch API\n * The Project Admin Search page\n \"\"\"\n\n es_search = cls.search(using=using, index=index)\n es_search = es_search.highlight_options(encoder='html')\n\n es_query = cls.get_es_query(query=query)\n highlighted_fields = [f.split('^', 1)[0] for f in cls.search_fields]\n es_search = es_search.query(es_query).highlight(*highlighted_fields)\n\n return es_search","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"simple_search","file_name":"readthedocs/search/documents.py","commit_link":"github.com/readthedocs/readthedocs.org/commit/1ebe494ffde18109307f205d2bd94102452f697a","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#15-223341fd9637","input":"bool WddxPacket::recursiveAddVar(const String& varName,\n const Variant& varVariant,\n bool hasVarTag) {\n\n bool isArray = varVariant.isArray();\n bool isObject = varVariant.isObject();\n\n if (isArray || isObject) {\n if (hasVarTag) {\n m_packetString += \"\";\n }\n\n Array varAsArray;\n Object varAsObject = varVariant.toObject();\n if (isArray) varAsArray = varVariant.toArray();\n if (isObject) varAsArray = varAsObject.toArray();\n\n int length = varAsArray.length();\n if (length > 0) {\n ArrayIter it = ArrayIter(varAsArray);\n if (it.first().isString()) isObject = true;\n if (isObject) {\n m_packetString += \"\";\n if (!isArray) {\n m_packetString += \"\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"\";\n }\n } else {\n m_packetString += \"\";\n }\n for (ArrayIter it(varAsArray); it; ++it) {\n Variant key = it.first();\n Variant value = it.second();\n recursiveAddVar(key.toString(), value, isObject);\n }\n if (isObject) {\n m_packetString += \"\";\n }\n else {\n m_packetString += \"\";\n }\n }\n else {\n //empty object\n if (isObject) {\n m_packetString += \"\";\n if (!isArray) {\n m_packetString += \"\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"\";\n }\n m_packetString += \"\";\n }\n }\n if (hasVarTag) {\n m_packetString += \"\";\n }\n return true;\n }\n\n std::string varType = getDataTypeString(varVariant.getType()).data();\n if (!getWddxEncoded(varType, \"\", varName, false).empty()) {\n std::string varValue = varVariant.toString().data();\n if (varType.compare(\"boolean\") == 0) {\n varValue = varVariant.toBoolean() ? \"true\" : \"false\";\n }\n m_packetString += getWddxEncoded(varType, varValue, varName, hasVarTag);\n return true;\n }\n\n return false;\n}","target":"bool WddxPacket::recursiveAddVar(const String& varName,\n const Variant& varVariant,\n bool hasVarTag) {\n\n bool isArray = varVariant.isArray();\n bool isObject = varVariant.isObject();\n\n if (isArray || isObject) {\n if (hasVarTag) {\n m_packetString += \"\";\n }\n\n Array varAsArray;\n Object varAsObject = varVariant.toObject();\n if (isArray) varAsArray = varVariant.toArray();\n if (isObject) varAsArray = varAsObject.toArray();\n\n int length = varAsArray.length();\n if (length > 0) {\n ArrayIter it = ArrayIter(varAsArray);\n if (it.first().isString()) isObject = true;\n if (isObject) {\n m_packetString += \"\";\n if (!isArray) {\n m_packetString += \"\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"\";\n }\n } else {\n m_packetString += \"\";\n }\n for (ArrayIter it(varAsArray); it; ++it) {\n Variant key = it.first();\n Variant value = it.second();\n recursiveAddVar(key.toString(), value, isObject);\n }\n if (isObject) {\n m_packetString += \"\";\n }\n else {\n m_packetString += \"\";\n }\n }\n else {\n //empty object\n if (isObject) {\n m_packetString += \"\";\n if (!isArray) {\n m_packetString += \"\";\n m_packetString += varAsObject->o_getClassName().c_str();\n m_packetString += \"\";\n }\n m_packetString += \"\";\n }\n }\n if (hasVarTag) {\n m_packetString += \"\";\n }\n return true;\n }\n\n std::string varType = getDataTypeString(varVariant.getType()).data();\n if (!getWddxEncoded(varType, \"\", varName, false).empty()) {\n std::string varValue;\n if (varType.compare(\"boolean\") == 0) {\n varValue = varVariant.toBoolean() ? \"true\" : \"false\";\n } else {\n varValue = StringUtil::HtmlEncode(varVariant.toString(),\n StringUtil::QuoteStyle::Double,\n \"UTF-8\", false, false).toCppString();\n }\n m_packetString += getWddxEncoded(varType, varValue, varName, hasVarTag);\n return true;\n }\n\n return false;\n}","lang":"cpp","vul_type":"cwe-079","sven_meta":{"func_name":"HPHP::WddxPacket::recursiveAddVar","file_name":"hphp/runtime/ext/wddx/ext_wddx.cpp","commit_link":"github.com/facebook/hhvm/commit/324701c9fd31beb4f070f1b7ef78b115fbdfec34","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#16-5cfb869ae4db","input":" def mode_receive(self, request):\n \"\"\"\n This is called by render_POST when the client is telling us\n that it is ready to receive data as soon as it is available.\n This is the basis of a long-polling (comet) mechanism: the\n server will wait to reply until data is available.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = request.args.get('csessid')[0]\n self.last_alive[csessid] = (time.time(), False)\n\n dataentries = self.databuffer.get(csessid, [])\n if dataentries:\n return dataentries.pop(0)\n request.notifyFinish().addErrback(self._responseFailed, csessid, request)\n if csessid in self.requests:\n self.requests[csessid].finish() # Clear any stale request.\n self.requests[csessid] = request\n return server.NOT_DONE_YET","target":" def mode_receive(self, request):\n \"\"\"\n This is called by render_POST when the client is telling us\n that it is ready to receive data as soon as it is available.\n This is the basis of a long-polling (comet) mechanism: the\n server will wait to reply until data is available.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = cgi.escape(request.args['csessid'][0])\n self.last_alive[csessid] = (time.time(), False)\n\n dataentries = self.databuffer.get(csessid, [])\n if dataentries:\n return dataentries.pop(0)\n request.notifyFinish().addErrback(self._responseFailed, csessid, request)\n if csessid in self.requests:\n self.requests[csessid].finish() # Clear any stale request.\n self.requests[csessid] = request\n return server.NOT_DONE_YET","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"mode_receive","file_name":"evennia/server/portal/webclient_ajax.py","commit_link":"github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#17-1a1121e69073","input":"@check_document_access_permission()\ndef edit_coordinator(request):\n coordinator_id = request.GET.get('coordinator')\n doc = None\n \n if coordinator_id:\n doc = Document2.objects.get(id=coordinator_id)\n coordinator = Coordinator(document=doc)\n else:\n coordinator = Coordinator()\n\n api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))\n\n workflows = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]\n\n if coordinator_id and not filter(lambda a: a['uuid'] == coordinator.data['properties']['workflow'], workflows):\n raise PopupException(_('You don\\'t have access to the workflow of this coordinator.'))\n\n return render('editor/coordinator_editor.mako', request, {\n 'coordinator_json': coordinator.json,\n 'credentials_json': json.dumps(credentials.credentials.keys()),\n 'workflows_json': json.dumps(workflows),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })","target":"@check_document_access_permission()\ndef edit_coordinator(request):\n coordinator_id = request.GET.get('coordinator')\n doc = None\n \n if coordinator_id:\n doc = Document2.objects.get(id=coordinator_id)\n coordinator = Coordinator(document=doc)\n else:\n coordinator = Coordinator()\n\n api = get_oozie(request.user)\n credentials = Credentials()\n \n try: \n credentials.fetch(api)\n except Exception, e:\n LOG.error(smart_str(e))\n\n workflows = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])\n for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]\n\n if coordinator_id and not filter(lambda a: a['uuid'] == coordinator.data['properties']['workflow'], workflows):\n raise PopupException(_('You don\\'t have access to the workflow of this coordinator.'))\n\n return render('editor/coordinator_editor.mako', request, {\n 'coordinator_json': coordinator.json_for_html(),\n 'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),\n 'workflows_json': json.dumps(workflows, cls=JSONEncoderForHTML),\n 'doc1_id': doc.doc.get().id if doc else -1,\n 'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))\n })","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"edit_coordinator","file_name":"apps/oozie/src/oozie/views/editor2.py","commit_link":"github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#18-d6fc2ce88441","input":"def _keyify(key):\n return _key_pattern.sub(' ', key.lower())","target":"def _keyify(key):\n key = escape(key.lower(), quote=True)\n return _key_pattern.sub(' ', key)","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"_keyify","file_name":"mistune.py","commit_link":"github.com/lepture/mistune/commit/5f06d724bc05580e7f203db2d4a4905fc1127f98","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#19-9f4c6cd26f57","input":"@login_required(redirect_field_name='', login_url='/403')\n@require_POST\n@require_AJAX\n@transaction.atomic\ndef batch_edit_translations(request):\n \"\"\"Perform an action on a list of translations.\n\n Available actions are defined in `ACTIONS_FN_MAP`. Arguments to this view\n are defined in `models.BatchActionsForm`.\n\n \"\"\"\n form = forms.BatchActionsForm(request.POST)\n if not form.is_valid():\n return HttpResponseBadRequest(form.errors.as_json())\n\n locale = get_object_or_404(Locale, code=form.cleaned_data['locale'])\n entities = Entity.objects.filter(pk__in=form.cleaned_data['entities'])\n\n if not entities.exists():\n return JsonResponse({'count': 0})\n\n # Batch editing is only available to translators. Check if user has\n # translate permissions for all of the projects in passed entities.\n # Also make sure projects are not enabled in read-only mode for a locale.\n projects_pk = entities.values_list('resource__project__pk', flat=True)\n projects = Project.objects.filter(pk__in=projects_pk.distinct())\n\n for project in projects:\n if (\n not request.user.can_translate(project=project, locale=locale)\n or readonly_exists(projects, locale)\n ):\n return HttpResponseForbidden(\n \"Forbidden: You don't have permission for batch editing\"\n )\n\n # Find all impacted active translations, including plural forms.\n active_translations = Translation.objects.filter(\n active=True,\n locale=locale,\n entity__in=entities,\n )\n\n # Execute the actual action.\n action_function = ACTIONS_FN_MAP[form.cleaned_data['action']]\n action_status = action_function(\n form,\n request.user,\n active_translations,\n locale,\n )\n\n if action_status.get('error'):\n return JsonResponse(action_status)\n\n invalid_translation_count = len(action_status.get('invalid_translation_pks', []))\n if action_status['count'] == 0:\n return JsonResponse({\n 'count': 0,\n 'invalid_translation_count': invalid_translation_count,\n })\n\n update_stats(action_status['translated_resources'], locale)\n mark_changed_translation(action_status['changed_entities'], locale)\n\n # Update latest translation.\n if action_status['latest_translation_pk']:\n Translation.objects.get(\n pk=action_status['latest_translation_pk']\n ).update_latest_translation()\n\n update_translation_memory(\n action_status['changed_translation_pks'],\n project,\n locale\n )\n\n return JsonResponse({\n 'count': action_status['count'],\n 'invalid_translation_count': invalid_translation_count,\n })","target":"@login_required(redirect_field_name='', login_url='/403')\n@require_POST\n@require_AJAX\n@transaction.atomic\ndef batch_edit_translations(request):\n \"\"\"Perform an action on a list of translations.\n\n Available actions are defined in `ACTIONS_FN_MAP`. Arguments to this view\n are defined in `models.BatchActionsForm`.\n\n \"\"\"\n form = forms.BatchActionsForm(request.POST)\n if not form.is_valid():\n return HttpResponseBadRequest(form.errors.as_json(escape_html=True))\n\n locale = get_object_or_404(Locale, code=form.cleaned_data['locale'])\n entities = Entity.objects.filter(pk__in=form.cleaned_data['entities'])\n\n if not entities.exists():\n return JsonResponse({'count': 0})\n\n # Batch editing is only available to translators. Check if user has\n # translate permissions for all of the projects in passed entities.\n # Also make sure projects are not enabled in read-only mode for a locale.\n projects_pk = entities.values_list('resource__project__pk', flat=True)\n projects = Project.objects.filter(pk__in=projects_pk.distinct())\n\n for project in projects:\n if (\n not request.user.can_translate(project=project, locale=locale)\n or readonly_exists(projects, locale)\n ):\n return HttpResponseForbidden(\n \"Forbidden: You don't have permission for batch editing\"\n )\n\n # Find all impacted active translations, including plural forms.\n active_translations = Translation.objects.filter(\n active=True,\n locale=locale,\n entity__in=entities,\n )\n\n # Execute the actual action.\n action_function = ACTIONS_FN_MAP[form.cleaned_data['action']]\n action_status = action_function(\n form,\n request.user,\n active_translations,\n locale,\n )\n\n if action_status.get('error'):\n return JsonResponse(action_status)\n\n invalid_translation_count = len(action_status.get('invalid_translation_pks', []))\n if action_status['count'] == 0:\n return JsonResponse({\n 'count': 0,\n 'invalid_translation_count': invalid_translation_count,\n })\n\n update_stats(action_status['translated_resources'], locale)\n mark_changed_translation(action_status['changed_entities'], locale)\n\n # Update latest translation.\n if action_status['latest_translation_pk']:\n Translation.objects.get(\n pk=action_status['latest_translation_pk']\n ).update_latest_translation()\n\n update_translation_memory(\n action_status['changed_translation_pks'],\n project,\n locale\n )\n\n return JsonResponse({\n 'count': action_status['count'],\n 'invalid_translation_count': invalid_translation_count,\n })","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"batch_edit_translations","file_name":"pontoon/batch/views.py","commit_link":"github.com/onefork/pontoon-sr/commit/fc07ed9c68e08d41f74c078b4e7727f1a0888be8","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#20-544180b3a8dc","input":"def make_eb_config(application_name, default_region):\n # Capture our current directory\n UTILS_DIR = os.path.dirname(os.path.abspath(__file__))\n # Create the jinja2 environment.\n # Notice the use of trim_blocks, which greatly helps control whitespace.\n j2_env = Environment(loader=FileSystemLoader(UTILS_DIR))\n return j2_env.get_template('templates/eb/config.yml').render(\n APPLICATION_NAME=application_name,\n DEFAULT_REGION=default_region\n )","target":"def make_eb_config(application_name, default_region):\n # Capture our current directory\n UTILS_DIR = os.path.dirname(os.path.abspath(__file__))\n # Create the jinja2 environment.\n # Notice the use of trim_blocks, which greatly helps control whitespace.\n j2_env = Environment(loader=FileSystemLoader(UTILS_DIR), autoescape=True)\n return j2_env.get_template('templates/eb/config.yml').render(\n APPLICATION_NAME=application_name,\n DEFAULT_REGION=default_region\n )","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"make_eb_config","file_name":"utils/make_eb_config.py","commit_link":"github.com/OkunaOrg/okuna-www-api/commit/8c40c66ea7c483a0cbda4c21940180af909aab99","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#21-e935be5d8294","input":" def mode_keepalive(self, request):\n \"\"\"\n This is called by render_POST when the\n client is replying to the keepalive.\n \"\"\"\n csessid = request.args.get('csessid')[0]\n self.last_alive[csessid] = (time.time(), False)\n return '\"\"'","target":" def mode_keepalive(self, request):\n \"\"\"\n This is called by render_POST when the\n client is replying to the keepalive.\n \"\"\"\n csessid = cgi.escape(request.args['csessid'][0])\n self.last_alive[csessid] = (time.time(), False)\n return '\"\"'","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"mode_keepalive","file_name":"evennia/server/portal/webclient_ajax.py","commit_link":"github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#22-576cdf9d07a6","input":"void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)\n{\n QWriteLocker locker(&lock);\n\n Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), ip, blocked, reason };\n m_peers.push_back(temp);\n\n if (m_peers.size() >= MAX_LOG_MESSAGES)\n m_peers.pop_front();\n\n emit newLogPeer(temp);\n}","target":"void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)\n{\n QWriteLocker locker(&lock);\n\n Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), Utils::String::toHtmlEscaped(ip), blocked, Utils::String::toHtmlEscaped(reason) };\n m_peers.push_back(temp);\n\n if (m_peers.size() >= MAX_LOG_MESSAGES)\n m_peers.pop_front();\n\n emit newLogPeer(temp);\n}","lang":"cpp","vul_type":"cwe-079","sven_meta":{"func_name":"Logger::addPeer","file_name":"src/base/logger.cpp","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#23-dcbe3bb95c17","input":"@csrf.csrf_protect\ndef subscribe_for_tags(request):\n \"\"\"process subscription of users by tags\"\"\"\n #todo - use special separator to split tags\n tag_names = request.REQUEST.get('tags','').strip().split()\n pure_tag_names, wildcards = forms.clean_marked_tagnames(tag_names)\n if request.user.is_authenticated():\n if request.method == 'POST':\n if 'ok' in request.POST:\n request.user.mark_tags(\n pure_tag_names,\n wildcards,\n reason = 'good',\n action = 'add'\n )\n request.user.message_set.create(\n message = _('Your tag subscription was saved, thanks!')\n )\n else:\n message = _(\n 'Tag subscription was canceled (undo).'\n ) % {'url': request.path + '?tags=' + request.REQUEST['tags']}\n request.user.message_set.create(message = message)\n return HttpResponseRedirect(reverse('index'))\n else:\n data = {'tags': tag_names}\n return render(request, 'subscribe_for_tags.html', data)\n else:\n all_tag_names = pure_tag_names + wildcards\n message = _('Please sign in to subscribe for: %(tags)s') \\\n % {'tags': ', '.join(all_tag_names)}\n request.user.message_set.create(message = message)\n request.session['subscribe_for_tags'] = (pure_tag_names, wildcards)\n return HttpResponseRedirect(url_utils.get_login_url())","target":"@csrf.csrf_protect\ndef subscribe_for_tags(request):\n \"\"\"process subscription of users by tags\"\"\"\n #todo - use special separator to split tags\n tag_names = request.REQUEST.get('tags','').strip().split()\n pure_tag_names, wildcards = forms.clean_marked_tagnames(tag_names)\n if request.user.is_authenticated():\n if request.method == 'POST':\n if 'ok' in request.POST:\n request.user.mark_tags(\n pure_tag_names,\n wildcards,\n reason = 'good',\n action = 'add'\n )\n request.user.message_set.create(\n message = _('Your tag subscription was saved, thanks!')\n )\n else:\n message = _(\n 'Tag subscription was canceled (undo).'\n ) % {'url': escape(request.path) + '?tags=' + request.REQUEST['tags']}\n request.user.message_set.create(message = message)\n return HttpResponseRedirect(reverse('index'))\n else:\n data = {'tags': tag_names}\n return render(request, 'subscribe_for_tags.html', data)\n else:\n all_tag_names = pure_tag_names + wildcards\n message = _('Please sign in to subscribe for: %(tags)s') \\\n % {'tags': ', '.join(all_tag_names)}\n request.user.message_set.create(message = message)\n request.session['subscribe_for_tags'] = (pure_tag_names, wildcards)\n return HttpResponseRedirect(url_utils.get_login_url())","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"subscribe_for_tags","file_name":"askbot/views/commands.py","commit_link":"github.com/ASKBOT/askbot-devel/commit/a676a86b6b7a5737d4da4f59f71e037406f88d29","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#24-966e998331fa","input":"def nav_path(request):\n \"\"\"Return current path as list of items with \"name\" and \"href\" members\n\n The href members are view_directory links for directories and view_log\n links for files, but are set to None when the link would point to\n the current view\"\"\"\n\n if not request.repos:\n return []\n\n is_dir = request.pathtype == vclib.DIR\n\n # add root item\n items = []\n root_item = _item(name=request.server.escape(request.repos.name), href=None)\n if request.path_parts or request.view_func is not view_directory:\n root_item.href = request.get_url(view_func=view_directory,\n where='', pathtype=vclib.DIR,\n params={}, escape=1)\n items.append(root_item)\n\n # add path part items\n path_parts = []\n for part in request.path_parts:\n path_parts.append(part)\n is_last = len(path_parts) == len(request.path_parts)\n\n item = _item(name=part, href=None)\n\n if not is_last or (is_dir and request.view_func is not view_directory):\n item.href = request.get_url(view_func=view_directory,\n where=_path_join(path_parts),\n pathtype=vclib.DIR,\n params={}, escape=1)\n elif not is_dir and request.view_func is not view_log:\n item.href = request.get_url(view_func=view_log,\n where=_path_join(path_parts),\n pathtype=vclib.FILE,\n params={}, escape=1)\n items.append(item)\n\n return items","target":"def nav_path(request):\n \"\"\"Return current path as list of items with \"name\" and \"href\" members\n\n The href members are view_directory links for directories and view_log\n links for files, but are set to None when the link would point to\n the current view\"\"\"\n\n if not request.repos:\n return []\n\n is_dir = request.pathtype == vclib.DIR\n\n # add root item\n items = []\n root_item = _item(name=request.server.escape(request.repos.name), href=None)\n if request.path_parts or request.view_func is not view_directory:\n root_item.href = request.get_url(view_func=view_directory,\n where='', pathtype=vclib.DIR,\n params={}, escape=1)\n items.append(root_item)\n\n # add path part items\n path_parts = []\n for part in request.path_parts:\n path_parts.append(part)\n is_last = len(path_parts) == len(request.path_parts)\n\n item = _item(name=request.server.escape(part), href=None)\n\n if not is_last or (is_dir and request.view_func is not view_directory):\n item.href = request.get_url(view_func=view_directory,\n where=_path_join(path_parts),\n pathtype=vclib.DIR,\n params={}, escape=1)\n elif not is_dir and request.view_func is not view_log:\n item.href = request.get_url(view_func=view_log,\n where=_path_join(path_parts),\n pathtype=vclib.FILE,\n params={}, escape=1)\n items.append(item)\n\n return items","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"nav_path","file_name":"lib/viewvc.py","commit_link":"github.com/viewvc/viewvc/commit/9dcfc7daa4c940992920d3b2fbd317da20e44aad","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#25-a78acea86ee7","input":" def __init__(self, *args, **kwargs):\n \"\"\"\n Takes two additional keyword arguments:\n\n :param cartpos: The cart position the form should be for\n :param event: The event this belongs to\n \"\"\"\n cartpos = self.cartpos = kwargs.pop('cartpos', None)\n orderpos = self.orderpos = kwargs.pop('orderpos', None)\n pos = cartpos or orderpos\n item = pos.item\n questions = pos.item.questions_to_ask\n event = kwargs.pop('event')\n\n super().__init__(*args, **kwargs)\n\n if item.admission and event.settings.attendee_names_asked:\n self.fields['attendee_name_parts'] = NamePartsFormField(\n max_length=255,\n required=event.settings.attendee_names_required,\n scheme=event.settings.name_scheme,\n label=_('Attendee name'),\n initial=(cartpos.attendee_name_parts if cartpos else orderpos.attendee_name_parts),\n )\n if item.admission and event.settings.attendee_emails_asked:\n self.fields['attendee_email'] = forms.EmailField(\n required=event.settings.attendee_emails_required,\n label=_('Attendee email'),\n initial=(cartpos.attendee_email if cartpos else orderpos.attendee_email)\n )\n\n for q in questions:\n # Do we already have an answer? Provide it as the initial value\n answers = [a for a in pos.answerlist if a.question_id == q.id]\n if answers:\n initial = answers[0]\n else:\n initial = None\n tz = pytz.timezone(event.settings.timezone)\n help_text = rich_text(q.help_text)\n if q.type == Question.TYPE_BOOLEAN:\n if q.required:\n # For some reason, django-bootstrap3 does not set the required attribute\n # itself.\n widget = forms.CheckboxInput(attrs={'required': 'required'})\n else:\n widget = forms.CheckboxInput()\n\n if initial:\n initialbool = (initial.answer == \"True\")\n else:\n initialbool = False\n\n field = forms.BooleanField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=initialbool, widget=widget,\n )\n elif q.type == Question.TYPE_NUMBER:\n field = forms.DecimalField(\n label=q.question, required=q.required,\n help_text=q.help_text,\n initial=initial.answer if initial else None,\n min_value=Decimal('0.00'),\n )\n elif q.type == Question.TYPE_STRING:\n field = forms.CharField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_TEXT:\n field = forms.CharField(\n label=q.question, required=q.required,\n help_text=help_text,\n widget=forms.Textarea,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE:\n field = forms.ModelChoiceField(\n queryset=q.options,\n label=q.question, required=q.required,\n help_text=help_text,\n widget=forms.Select,\n empty_label='',\n initial=initial.options.first() if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE_MULTIPLE:\n field = forms.ModelMultipleChoiceField(\n queryset=q.options,\n label=q.question, required=q.required,\n help_text=help_text,\n widget=forms.CheckboxSelectMultiple,\n initial=initial.options.all() if initial else None,\n )\n elif q.type == Question.TYPE_FILE:\n field = forms.FileField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=initial.file if initial else None,\n widget=UploadedFileWidget(position=pos, event=event, answer=initial),\n )\n elif q.type == Question.TYPE_DATE:\n field = forms.DateField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).date() if initial and initial.answer else None,\n widget=DatePickerWidget(),\n )\n elif q.type == Question.TYPE_TIME:\n field = forms.TimeField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).time() if initial and initial.answer else None,\n widget=TimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n elif q.type == Question.TYPE_DATETIME:\n field = SplitDateTimeField(\n label=q.question, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).astimezone(tz) if initial and initial.answer else None,\n widget=SplitDateTimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n field.question = q\n if answers:\n # Cache the answer object for later use\n field.answer = answers[0]\n self.fields['question_%s' % q.id] = field\n\n responses = question_form_fields.send(sender=event, position=pos)\n data = pos.meta_info_data\n for r, response in sorted(responses, key=lambda r: str(r[0])):\n for key, value in response.items():\n # We need to be this explicit, since OrderedDict.update does not retain ordering\n self.fields[key] = value\n value.initial = data.get('question_form_data', {}).get(key)","target":" def __init__(self, *args, **kwargs):\n \"\"\"\n Takes two additional keyword arguments:\n\n :param cartpos: The cart position the form should be for\n :param event: The event this belongs to\n \"\"\"\n cartpos = self.cartpos = kwargs.pop('cartpos', None)\n orderpos = self.orderpos = kwargs.pop('orderpos', None)\n pos = cartpos or orderpos\n item = pos.item\n questions = pos.item.questions_to_ask\n event = kwargs.pop('event')\n\n super().__init__(*args, **kwargs)\n\n if item.admission and event.settings.attendee_names_asked:\n self.fields['attendee_name_parts'] = NamePartsFormField(\n max_length=255,\n required=event.settings.attendee_names_required,\n scheme=event.settings.name_scheme,\n label=_('Attendee name'),\n initial=(cartpos.attendee_name_parts if cartpos else orderpos.attendee_name_parts),\n )\n if item.admission and event.settings.attendee_emails_asked:\n self.fields['attendee_email'] = forms.EmailField(\n required=event.settings.attendee_emails_required,\n label=_('Attendee email'),\n initial=(cartpos.attendee_email if cartpos else orderpos.attendee_email)\n )\n\n for q in questions:\n # Do we already have an answer? Provide it as the initial value\n answers = [a for a in pos.answerlist if a.question_id == q.id]\n if answers:\n initial = answers[0]\n else:\n initial = None\n tz = pytz.timezone(event.settings.timezone)\n help_text = rich_text(q.help_text)\n label = escape(q.question) # django-bootstrap3 calls mark_safe\n if q.type == Question.TYPE_BOOLEAN:\n if q.required:\n # For some reason, django-bootstrap3 does not set the required attribute\n # itself.\n widget = forms.CheckboxInput(attrs={'required': 'required'})\n else:\n widget = forms.CheckboxInput()\n\n if initial:\n initialbool = (initial.answer == \"True\")\n else:\n initialbool = False\n\n field = forms.BooleanField(\n label=label, required=q.required,\n help_text=help_text,\n initial=initialbool, widget=widget,\n )\n elif q.type == Question.TYPE_NUMBER:\n field = forms.DecimalField(\n label=label, required=q.required,\n help_text=q.help_text,\n initial=initial.answer if initial else None,\n min_value=Decimal('0.00'),\n )\n elif q.type == Question.TYPE_STRING:\n field = forms.CharField(\n label=label, required=q.required,\n help_text=help_text,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_TEXT:\n field = forms.CharField(\n label=label, required=q.required,\n help_text=help_text,\n widget=forms.Textarea,\n initial=initial.answer if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE:\n field = forms.ModelChoiceField(\n queryset=q.options,\n label=label, required=q.required,\n help_text=help_text,\n widget=forms.Select,\n empty_label='',\n initial=initial.options.first() if initial else None,\n )\n elif q.type == Question.TYPE_CHOICE_MULTIPLE:\n field = forms.ModelMultipleChoiceField(\n queryset=q.options,\n label=label, required=q.required,\n help_text=help_text,\n widget=forms.CheckboxSelectMultiple,\n initial=initial.options.all() if initial else None,\n )\n elif q.type == Question.TYPE_FILE:\n field = forms.FileField(\n label=label, required=q.required,\n help_text=help_text,\n initial=initial.file if initial else None,\n widget=UploadedFileWidget(position=pos, event=event, answer=initial),\n )\n elif q.type == Question.TYPE_DATE:\n field = forms.DateField(\n label=label, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).date() if initial and initial.answer else None,\n widget=DatePickerWidget(),\n )\n elif q.type == Question.TYPE_TIME:\n field = forms.TimeField(\n label=label, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).time() if initial and initial.answer else None,\n widget=TimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n elif q.type == Question.TYPE_DATETIME:\n field = SplitDateTimeField(\n label=label, required=q.required,\n help_text=help_text,\n initial=dateutil.parser.parse(initial.answer).astimezone(tz) if initial and initial.answer else None,\n widget=SplitDateTimePickerWidget(time_format=get_format_without_seconds('TIME_INPUT_FORMATS')),\n )\n field.question = q\n if answers:\n # Cache the answer object for later use\n field.answer = answers[0]\n self.fields['question_%s' % q.id] = field\n\n responses = question_form_fields.send(sender=event, position=pos)\n data = pos.meta_info_data\n for r, response in sorted(responses, key=lambda r: str(r[0])):\n for key, value in response.items():\n # We need to be this explicit, since OrderedDict.update does not retain ordering\n self.fields[key] = value\n value.initial = data.get('question_form_data', {}).get(key)","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"__init__","file_name":"src/pretix/base/forms/questions.py","commit_link":"github.com/pretix/pretix/commit/affc6254a8316643d4afe9e8b7f8cd288c86ca1f","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#26-72e8a1a5efee","input":"def link_dialog(request):\n # list of wiki pages\n name = request.values.get(\"pagename\", \"\")\n if name:\n from MoinMoin import search\n # XXX error handling!\n searchresult = search.searchPages(request, 't:\"%s\"' % name)\n\n pages = [p.page_name for p in searchresult.hits]\n pages.sort()\n pages[0:0] = [name]\n page_list = '''\n \n \n \n \n \n''' % \"\\n\".join(['' % (wikiutil.escape(page), wikiutil.escape(page))\n for page in pages])\n else:\n page_list = \"\"\n\n # list of interwiki names\n interwiki_list = wikiutil.load_wikimap(request)\n interwiki = interwiki_list.keys()\n interwiki.sort()\n iwpreferred = request.cfg.interwiki_preferred[:]\n if not iwpreferred or iwpreferred and iwpreferred[-1] is not None:\n resultlist = iwpreferred\n for iw in interwiki:\n if not iw in iwpreferred:\n resultlist.append(iw)\n else:\n resultlist = iwpreferred[:-1]\n interwiki = \"\\n\".join(\n ['' % (wikiutil.escape(key), wikiutil.escape(key))\n for key in resultlist])\n\n # wiki url\n url_prefix_static = request.cfg.url_prefix_static\n scriptname = request.script_root + '/'\n action = scriptname\n basepage = wikiutil.escape(request.page.page_name)\n request.write(u'''\n\n\n\n\n\n \n Link Properties\n \n \n \n \n \n \n \n
\n Link Type
\n \n
\n
\n
\n \n \n \n \n
\n
\n \n \n \n \n \n \n \n \n %(page_list)s\n
\n Page Name
\n \n
\n \n
\n
\n
\n
\n
\n \n \n \n \n
\n \n \n \n \n
\n Wiki:PageName
\n :\n \n
\n
\n
\n
\n \n \n \n \n \n \n
\n Protocol
\n \n
 \n URL
\n \n
\n
\n
\n
\n \n\n''' % locals())","target":"def link_dialog(request):\n # list of wiki pages\n name = request.values.get(\"pagename\", \"\")\n name_escaped = wikiutil.escape(name)\n if name:\n from MoinMoin import search\n # XXX error handling!\n searchresult = search.searchPages(request, 't:\"%s\"' % name)\n\n pages = [p.page_name for p in searchresult.hits]\n pages.sort()\n pages[0:0] = [name]\n page_list = '''\n \n \n \n \n \n''' % \"\\n\".join(['' % (wikiutil.escape(page), wikiutil.escape(page))\n for page in pages])\n else:\n page_list = \"\"\n\n # list of interwiki names\n interwiki_list = wikiutil.load_wikimap(request)\n interwiki = interwiki_list.keys()\n interwiki.sort()\n iwpreferred = request.cfg.interwiki_preferred[:]\n if not iwpreferred or iwpreferred and iwpreferred[-1] is not None:\n resultlist = iwpreferred\n for iw in interwiki:\n if not iw in iwpreferred:\n resultlist.append(iw)\n else:\n resultlist = iwpreferred[:-1]\n interwiki = \"\\n\".join(\n ['' % (wikiutil.escape(key), wikiutil.escape(key))\n for key in resultlist])\n\n # wiki url\n url_prefix_static = request.cfg.url_prefix_static\n scriptname = request.script_root + '/'\n action = scriptname\n basepage = wikiutil.escape(request.page.page_name)\n request.write(u'''\n\n\n\n\n\n \n Link Properties\n \n \n \n \n \n \n \n
\n Link Type
\n \n
\n
\n
\n \n \n \n \n
\n
\n \n \n \n \n \n \n \n \n %(page_list)s\n
\n Page Name
\n \n
\n \n
\n
\n
\n
\n
\n \n \n \n \n
\n \n \n \n \n
\n Wiki:PageName
\n :\n \n
\n
\n
\n
\n \n \n \n \n \n \n
\n Protocol
\n \n
 \n URL
\n \n
\n
\n
\n
\n \n\n''' % locals())","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"link_dialog","file_name":"MoinMoin/action/fckdialog.py","commit_link":"github.com/moinwiki/moin-1.9/commit/70955a8eae091cc88fd9a6e510177e70289ec024","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#27-645ac2c41fe8","input":"def action_save_user(request: HttpRequest, default_forward_url: str = \"/admin/users\"):\n \"\"\"\n This functions saves the changes to the user or adds a new one. It completely creates the HttpResponse\n :param request: the HttpRequest\n :param default_forward_url: The URL to forward to if nothing was specified\n :return: The crafted HttpResponse\n \"\"\"\n forward_url = default_forward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if not request.user.is_authenticated:\n return HttpResponseForbidden()\n profile = Profile.objects.get(authuser=request.user)\n if profile.rights < 2:\n return HttpResponseForbidden()\n try:\n if request.GET.get(\"user_id\"):\n pid = int(request.GET[\"user_id\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n user: Profile = Profile.objects.get(pk=pid)\n user.displayName = displayname\n user.dect = dect\n user.notes = notes\n user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])\n if request.POST.get(\"active\"):\n user.active = magic.parse_bool(request.POST[\"active\"])\n au: User = user.authuser\n if check_password_conformity(pw1, pw2):\n logging.log(logging.INFO, \"Set password for user: \" + user.displayName)\n au.set_password(pw1)\n else:\n logging.log(logging.INFO, \"Failed to set password for: \" + user.displayName)\n au.email = mail\n au.save()\n user.save()\n else:\n # assume new user\n username = str(request.POST[\"username\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n if not check_password_conformity(pw1, pw2):\n recreate_form('password mismatch')\n auth_user: User = User.objects.create_user(username=username, email=mail, password=pw1)\n auth_user.save()\n user: Profile = Profile()\n user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])\n user.displayName = displayname\n user.authuser = auth_user\n user.dect = dect\n user.notes = notes\n user.active = True\n user.save()\n pass\n pass\n except Exception as e:\n return HttpResponseBadRequest(str(e))\n return redirect(forward_url)","target":"def action_save_user(request: HttpRequest, default_forward_url: str = \"/admin/users\"):\n \"\"\"\n This functions saves the changes to the user or adds a new one. It completely creates the HttpResponse\n :param request: the HttpRequest\n :param default_forward_url: The URL to forward to if nothing was specified\n :return: The crafted HttpResponse\n \"\"\"\n forward_url = default_forward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if not request.user.is_authenticated:\n return HttpResponseForbidden()\n profile = Profile.objects.get(authuser=request.user)\n if profile.rights < 2:\n return HttpResponseForbidden()\n try:\n if request.GET.get(\"user_id\"):\n pid = int(request.GET[\"user_id\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n user: Profile = Profile.objects.get(pk=pid)\n user.displayName = escape(displayname)\n user.dect = dect\n user.notes = escape(notes)\n user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])\n if request.POST.get(\"active\"):\n user.active = magic.parse_bool(request.POST[\"active\"])\n au: User = user.authuser\n if check_password_conformity(pw1, pw2):\n logging.log(logging.INFO, \"Set password for user: \" + user.displayName)\n au.set_password(pw1)\n else:\n logging.log(logging.INFO, \"Failed to set password for: \" + user.displayName)\n au.email = escape(mail)\n au.save()\n user.save()\n else:\n # assume new user\n username = str(request.POST[\"username\"])\n displayname = str(request.POST[\"display_name\"])\n dect = int(request.POST[\"dect\"])\n notes = str(request.POST[\"notes\"])\n pw1 = str(request.POST[\"password\"])\n pw2 = str(request.POST[\"confirm_password\"])\n mail = str(request.POST[\"email\"])\n rights = int(request.POST[\"rights\"])\n if not check_password_conformity(pw1, pw2):\n recreate_form('password mismatch')\n auth_user: User = User.objects.create_user(username=escape(username), email=escape(mail), password=pw1)\n auth_user.save()\n user: Profile = Profile()\n user.rights = rights\n user.number_of_allowed_reservations = int(request.POST[\"allowed_reservations\"])\n user.displayName = escape(displayname)\n user.authuser = auth_user\n user.dect = dect\n user.notes = escape(notes)\n user.active = True\n user.save()\n pass\n pass\n except Exception as e:\n return HttpResponseBadRequest(str(e))\n return redirect(forward_url)","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"action_save_user","file_name":"c3shop/frontpage/management/edit_user.py","commit_link":"github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#28-2b222187be43","input":" def save(self):\n # copy the user's input from plain text to description to be processed\n self.description = self.description_plain_text\n if CE.settings.auto_cross_reference:\n self.auto_cross_ref()\n else:\n self.find_tag()\n self.slug = slugify(self.title)\n super().save()","target":" def save(self):\n # copy the user's input from plain text to description to be processed\n # uses bleach to remove potentially harmful HTML code\n self.description = bleach.clean(str(self.description_plain_text),\n tags=CE.settings.bleach_allowed,\n strip=True)\n if CE.settings.auto_cross_reference:\n self.auto_cross_ref()\n else:\n self.find_tag()\n self.slug = slugify(self.title)\n super().save()","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"save","file_name":"CE/models.py","commit_link":"github.com/stevetasticsteve/CLA_Hub/commit/a06d85cd0b0964f8469e5c4bc9a6c132aa0b4c37","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#29-02244c7fdbeb","input":"void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent)\n{\n clear();\n m_torrent = torrent;\n downloaded_pieces->setTorrent(m_torrent);\n pieces_availability->setTorrent(m_torrent);\n if (!m_torrent) return;\n\n // Save path\n updateSavePath(m_torrent);\n // Hash\n hash_lbl->setText(m_torrent->hash());\n PropListModel->model()->clear();\n if (m_torrent->hasMetadata()) {\n // Creation date\n lbl_creationDate->setText(m_torrent->creationDate().toString(Qt::DefaultLocaleShortDate));\n\n label_total_size_val->setText(Utils::Misc::friendlyUnit(m_torrent->totalSize()));\n\n // Comment\n comment_text->setText(Utils::Misc::parseHtmlLinks(m_torrent->comment()));\n\n // URL seeds\n loadUrlSeeds();\n\n label_created_by_val->setText(m_torrent->creator());\n\n // List files in torrent\n PropListModel->model()->setupModelData(m_torrent->info());\n filesList->setExpanded(PropListModel->index(0, 0), true);\n\n // Load file priorities\n PropListModel->model()->updateFilesPriorities(m_torrent->filePriorities());\n }\n // Load dynamic data\n loadDynamicData();\n}","target":"void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent)\n{\n clear();\n m_torrent = torrent;\n downloaded_pieces->setTorrent(m_torrent);\n pieces_availability->setTorrent(m_torrent);\n if (!m_torrent) return;\n\n // Save path\n updateSavePath(m_torrent);\n // Hash\n hash_lbl->setText(m_torrent->hash());\n PropListModel->model()->clear();\n if (m_torrent->hasMetadata()) {\n // Creation date\n lbl_creationDate->setText(m_torrent->creationDate().toString(Qt::DefaultLocaleShortDate));\n\n label_total_size_val->setText(Utils::Misc::friendlyUnit(m_torrent->totalSize()));\n\n // Comment\n comment_text->setText(Utils::Misc::parseHtmlLinks(Utils::String::toHtmlEscaped(m_torrent->comment())));\n\n // URL seeds\n loadUrlSeeds();\n\n label_created_by_val->setText(Utils::String::toHtmlEscaped(m_torrent->creator()));\n\n // List files in torrent\n PropListModel->model()->setupModelData(m_torrent->info());\n filesList->setExpanded(PropListModel->index(0, 0), true);\n\n // Load file priorities\n PropListModel->model()->updateFilesPriorities(m_torrent->filePriorities());\n }\n // Load dynamic data\n loadDynamicData();\n}","lang":"cpp","vul_type":"cwe-079","sven_meta":{"func_name":"PropertiesWidget::loadTorrentInfos","file_name":"src/gui/properties/propertieswidget.cpp","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#30-fbdb24f62060","input":" def mode_close(self, request):\n \"\"\"\n This is called by render_POST when the client is signalling\n that it is about to be closed.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = request.args.get('csessid')[0]\n try:\n sess = self.sessionhandler.sessions_from_csessid(csessid)[0]\n sess.sessionhandler.disconnect(sess)\n except IndexError:\n self.client_disconnect(csessid)\n return '\"\"'","target":" def mode_close(self, request):\n \"\"\"\n This is called by render_POST when the client is signalling\n that it is about to be closed.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = cgi.escape(request.args['csessid'][0])\n try:\n sess = self.sessionhandler.sessions_from_csessid(csessid)[0]\n sess.sessionhandler.disconnect(sess)\n except IndexError:\n self.client_disconnect(csessid)\n return '\"\"'","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"mode_close","file_name":"evennia/server/portal/webclient_ajax.py","commit_link":"github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#31-692feaf28db0","input":" def get_queryset(self, **kwargs):\n queryset = Article.objects.order_by('-time')\n for i in queryset:\n i.md = markdown(i.content, extensions=[\n 'markdown.extensions.extra',\n 'markdown.extensions.codehilite',\n 'markdown.extensions.toc',\n ])\n\n return queryset","target":" def get_queryset(self, **kwargs):\n queryset = Article.objects.order_by('-time')\n for i in queryset:\n i.md = safe_md(i.content)\n\n return queryset","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"get_queryset","file_name":"app/Index/views.py","commit_link":"github.com/Cheng-mq1216/production-practice/commit/333dc34f5feada55d1f6ff1255949ca00dec0f9c","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#32-94da25c4c470","input":"@register.tag\n@basictag(takes_context=True)\ndef screenshotcommentcounts(context, screenshot):\n \"\"\"\n Returns a JSON array of current comments for a screenshot.\n\n Each entry in the array has a dictionary containing the following keys:\n\n =========== ==================================================\n Key Description\n =========== ==================================================\n text The text of the comment\n localdraft True if this is the current user's draft comment\n x The X location of the comment's region\n y The Y location of the comment's region\n w The width of the comment's region\n h The height of the comment's region\n =========== ==================================================\n \"\"\"\n comments = {}\n user = context.get('user', None)\n\n for comment in screenshot.comments.all():\n review = get_object_or_none(comment.review)\n\n if review and (review.public or review.user == user):\n position = '%dx%d+%d+%d' % (comment.w, comment.h, \\\n comment.x, comment.y)\n\n comments.setdefault(position, []).append({\n 'id': comment.id,\n 'text': comment.text,\n 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n 'url': comment.get_review_url(),\n 'localdraft' : review.user == user and \\\n not review.public,\n 'x' : comment.x,\n 'y' : comment.y,\n 'w' : comment.w,\n 'h' : comment.h,\n })\n\n return simplejson.dumps(comments)","target":"@register.tag\n@basictag(takes_context=True)\ndef screenshotcommentcounts(context, screenshot):\n \"\"\"\n Returns a JSON array of current comments for a screenshot.\n\n Each entry in the array has a dictionary containing the following keys:\n\n =========== ==================================================\n Key Description\n =========== ==================================================\n text The text of the comment\n localdraft True if this is the current user's draft comment\n x The X location of the comment's region\n y The Y location of the comment's region\n w The width of the comment's region\n h The height of the comment's region\n =========== ==================================================\n \"\"\"\n comments = {}\n user = context.get('user', None)\n\n for comment in screenshot.comments.all():\n review = get_object_or_none(comment.review)\n\n if review and (review.public or review.user == user):\n position = '%dx%d+%d+%d' % (comment.w, comment.h, \\\n comment.x, comment.y)\n\n comments.setdefault(position, []).append({\n 'id': comment.id,\n 'text': escape(comment.text),\n 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n 'url': comment.get_review_url(),\n 'localdraft' : review.user == user and \\\n not review.public,\n 'x' : comment.x,\n 'y' : comment.y,\n 'w' : comment.w,\n 'h' : comment.h,\n })\n\n return simplejson.dumps(comments)","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"screenshotcommentcounts","file_name":"reviewboard/reviews/templatetags/reviewtags.py","commit_link":"github.com/reviewboard/reviewboard/commit/7a0a9d94555502278534dedcf2d75e9fccce8c3d","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#33-b447d5f760eb","input":" def mode_input(self, request):\n \"\"\"\n This is called by render_POST when the client\n is sending data to the server.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = request.args.get('csessid')[0]\n\n self.last_alive[csessid] = (time.time(), False)\n sess = self.sessionhandler.sessions_from_csessid(csessid)\n if sess:\n sess = sess[0]\n cmdarray = json.loads(request.args.get('data')[0])\n sess.sessionhandler.data_in(sess, **{cmdarray[0]: [cmdarray[1], cmdarray[2]]})\n return '\"\"'","target":" def mode_input(self, request):\n \"\"\"\n This is called by render_POST when the client\n is sending data to the server.\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = cgi.escape(request.args['csessid'][0])\n self.last_alive[csessid] = (time.time(), False)\n sess = self.sessionhandler.sessions_from_csessid(csessid)\n if sess:\n sess = sess[0]\n cmdarray = json.loads(cgi.escape(request.args.get('data')[0]))\n sess.sessionhandler.data_in(sess, **{cmdarray[0]: [cmdarray[1], cmdarray[2]]})\n return '\"\"'","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"mode_input","file_name":"evennia/server/portal/webclient_ajax.py","commit_link":"github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#34-ad88dc49ed96","input":"def get_list_context(context=None):\n\tlist_context = frappe._dict(\n\t\ttemplate = \"templates/includes/blog/blog.html\",\n\t\tget_list = get_blog_list,\n\t\thide_filters = True,\n\t\tchildren = get_children(),\n\t\t# show_search = True,\n\t\ttitle = _('Blog')\n\t)\n\n\tcategory = frappe.local.form_dict.blog_category or frappe.local.form_dict.category\n\tif category:\n\t\tcategory_title = get_blog_category(category)\n\t\tlist_context.sub_title = _(\"Posts filed under {0}\").format(category_title)\n\t\tlist_context.title = category_title\n\n\telif frappe.local.form_dict.blogger:\n\t\tblogger = frappe.db.get_value(\"Blogger\", {\"name\": frappe.local.form_dict.blogger}, \"full_name\")\n\t\tlist_context.sub_title = _(\"Posts by {0}\").format(blogger)\n\t\tlist_context.title = blogger\n\n\telif frappe.local.form_dict.txt:\n\t\tlist_context.sub_title = _('Filtered by \"{0}\"').format(frappe.local.form_dict.txt)\n\n\tif list_context.sub_title:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"},\n\t\t\t\t\t\t\t\t{\"name\": \"Blog\", \"route\": \"/blog\"}]\n\telse:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"}]\n\n\tlist_context.update(frappe.get_doc(\"Blog Settings\", \"Blog Settings\").as_dict(no_default_fields=True))\n\treturn list_context","target":"def get_list_context(context=None):\n\tlist_context = frappe._dict(\n\t\ttemplate = \"templates/includes/blog/blog.html\",\n\t\tget_list = get_blog_list,\n\t\thide_filters = True,\n\t\tchildren = get_children(),\n\t\t# show_search = True,\n\t\ttitle = _('Blog')\n\t)\n\n\tcategory = sanitize_html(frappe.local.form_dict.blog_category or frappe.local.form_dict.category)\n\tif category:\n\t\tcategory_title = get_blog_category(category)\n\t\tlist_context.sub_title = _(\"Posts filed under {0}\").format(category_title)\n\t\tlist_context.title = category_title\n\n\telif frappe.local.form_dict.blogger:\n\t\tblogger = frappe.db.get_value(\"Blogger\", {\"name\": frappe.local.form_dict.blogger}, \"full_name\")\n\t\tlist_context.sub_title = _(\"Posts by {0}\").format(blogger)\n\t\tlist_context.title = blogger\n\n\telif frappe.local.form_dict.txt:\n\t\tlist_context.sub_title = _('Filtered by \"{0}\"').format(sanitize_html(frappe.local.form_dict.txt))\n\n\tif list_context.sub_title:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"},\n\t\t\t\t\t\t\t\t{\"name\": \"Blog\", \"route\": \"/blog\"}]\n\telse:\n\t\tlist_context.parents = [{\"name\": _(\"Home\"), \"route\": \"/\"}]\n\n\tlist_context.update(frappe.get_doc(\"Blog Settings\", \"Blog Settings\").as_dict(no_default_fields=True))\n\treturn list_context","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"get_list_context","file_name":"frappe/website/doctype/blog_post/blog_post.py","commit_link":"github.com/omirajkar/bench_frappe/commit/2fa19c25066ed17478d683666895e3266936aee6","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#35-83e51d3d3dc7","input":" def mode_init(self, request):\n \"\"\"\n This is called by render_POST when the client requests an init\n mode operation (at startup)\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = request.args.get('csessid')[0]\n\n remote_addr = request.getClientIP()\n host_string = \"%s (%s:%s)\" % (_SERVERNAME, request.getRequestHostname(), request.getHost().port)\n\n sess = AjaxWebClientSession()\n sess.client = self\n sess.init_session(\"ajax/comet\", remote_addr, self.sessionhandler)\n\n sess.csessid = csessid\n csession = _CLIENT_SESSIONS(session_key=sess.csessid)\n uid = csession and csession.get(\"webclient_authenticated_uid\", False)\n if uid:\n # the client session is already logged in\n sess.uid = uid\n sess.logged_in = True\n\n sess.sessionhandler.connect(sess)\n\n self.last_alive[csessid] = (time.time(), False)\n if not self.keep_alive:\n # the keepalive is not running; start it.\n self.keep_alive = LoopingCall(self._keepalive)\n self.keep_alive.start(_KEEPALIVE, now=False)\n\n return jsonify({'msg': host_string, 'csessid': csessid})","target":" def mode_init(self, request):\n \"\"\"\n This is called by render_POST when the client requests an init\n mode operation (at startup)\n\n Args:\n request (Request): Incoming request.\n\n \"\"\"\n csessid = cgi.escape(request.args['csessid'][0])\n\n remote_addr = request.getClientIP()\n host_string = \"%s (%s:%s)\" % (_SERVERNAME, request.getRequestHostname(), request.getHost().port)\n\n sess = AjaxWebClientSession()\n sess.client = self\n sess.init_session(\"ajax/comet\", remote_addr, self.sessionhandler)\n\n sess.csessid = csessid\n csession = _CLIENT_SESSIONS(session_key=sess.csessid)\n uid = csession and csession.get(\"webclient_authenticated_uid\", False)\n if uid:\n # the client session is already logged in\n sess.uid = uid\n sess.logged_in = True\n\n sess.sessionhandler.connect(sess)\n\n self.last_alive[csessid] = (time.time(), False)\n if not self.keep_alive:\n # the keepalive is not running; start it.\n self.keep_alive = LoopingCall(self._keepalive)\n self.keep_alive.start(_KEEPALIVE, now=False)\n\n return jsonify({'msg': host_string, 'csessid': csessid})","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"mode_init","file_name":"evennia/server/portal/webclient_ajax.py","commit_link":"github.com/evennia/evennia/commit/300261529b82f95414c9d1d7150d6eda4695bb93","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#36-cc81169c84c4","input":"def handle_file(u: Profile, headline: str, category: str, text: str, file):\n m: Media = Media()\n upload_base_path: str = 'uploads/' + str(date.today().year)\n high_res_file_name = upload_base_path + '/HIGHRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n low_res_file_name = upload_base_path + '/LOWRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n if not os.path.exists(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path):\n os.makedirs(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path)\n with open(high_res_file_name, 'wb+') as destination:\n for chunk in file.chunks():\n destination.write(chunk)\n # TODO crop image\n original = Image.open(high_res_file_name)\n width, height = original.size\n diameter = math.sqrt(math.pow(width, 2) + math.pow(height, 2))\n width /= diameter\n height /= diameter\n width *= IMAGE_SCALE\n height *= IMAGE_SCALE\n cropped = original.resize((int(width), int(height)), PIL.Image.LANCZOS)\n cropped.save(low_res_file_name)\n m.text = text\n m.cachedText = compile_markdown(text)\n m.category = category\n m.highResFile = \"/\" + high_res_file_name\n m.lowResFile = \"/\" + low_res_file_name\n m.headline = headline\n m.save()\n mu: MediaUpload = MediaUpload()\n mu.UID = u\n mu.MID = m\n mu.save()\n logging.info(\"Uploaded file '\" + str(file.name) + \"' and cropped it. The resulting PK is \" + str(m.pk))","target":"def handle_file(u: Profile, headline: str, category: str, text: str, file):\n m: Media = Media()\n upload_base_path: str = 'uploads/' + str(date.today().year)\n high_res_file_name = upload_base_path + '/HIGHRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n low_res_file_name = upload_base_path + '/LOWRES_' + ntpath.basename(file.name.replace(\" \", \"_\"))\n if not os.path.exists(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path):\n os.makedirs(PATH_TO_UPLOAD_FOLDER_ON_DISK + upload_base_path)\n with open(high_res_file_name, 'wb+') as destination:\n for chunk in file.chunks():\n destination.write(chunk)\n # TODO crop image\n original = Image.open(high_res_file_name)\n width, height = original.size\n diameter = math.sqrt(math.pow(width, 2) + math.pow(height, 2))\n width /= diameter\n height /= diameter\n width *= IMAGE_SCALE\n height *= IMAGE_SCALE\n cropped = original.resize((int(width), int(height)), PIL.Image.LANCZOS)\n cropped.save(low_res_file_name)\n m.text = escape(text)\n m.cachedText = compile_markdown(escape(text))\n m.category = escape(category)\n m.highResFile = \"/\" + high_res_file_name\n m.lowResFile = \"/\" + low_res_file_name\n m.headline = escape(headline)\n m.save()\n mu: MediaUpload = MediaUpload()\n mu.UID = u\n mu.MID = m\n mu.save()\n logging.info(\"Uploaded file '\" + str(file.name) + \"' and cropped it. The resulting PK is \" + str(m.pk))","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"handle_file","file_name":"c3shop/frontpage/management/mediatools/media_actions.py","commit_link":"github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#37-b4fe315c51a8","input":"@register.tag\n@basictag(takes_context=True)\ndef commentcounts(context, filediff, interfilediff=None):\n \"\"\"\n Returns a JSON array of current comments for a filediff, sorted by\n line number.\n\n Each entry in the array has a dictionary containing the following keys:\n\n =========== ==================================================\n Key Description\n =========== ==================================================\n comment_id The ID of the comment\n text The text of the comment\n line The first line number\n num_lines The number of lines this comment spans\n user A dictionary containing \"username\" and \"name\" keys\n for the user\n url The URL to the comment\n localdraft True if this is the current user's draft comment\n =========== ==================================================\n \"\"\"\n comment_dict = {}\n user = context.get('user', None)\n\n if interfilediff:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff=interfilediff)\n else:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff__isnull=True)\n\n for comment in query:\n review = get_object_or_none(comment.review)\n\n if review and (review.public or review.user == user):\n key = (comment.first_line, comment.num_lines)\n\n comment_dict.setdefault(key, []).append({\n 'comment_id': comment.id,\n 'text': comment.text,\n 'line': comment.first_line,\n 'num_lines': comment.num_lines,\n 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n #'timestamp': comment.timestamp,\n 'url': comment.get_review_url(),\n 'localdraft': review.user == user and \\\n not review.public,\n })\n\n comments_array = []\n\n for key, value in comment_dict.iteritems():\n comments_array.append({\n 'linenum': key[0],\n 'num_lines': key[1],\n 'comments': value,\n })\n\n comments_array.sort(cmp=lambda x, y: cmp(x['linenum'], y['linenum'] or\n cmp(x['num_lines'], y['num_lines'])))\n\n return simplejson.dumps(comments_array)","target":"@register.tag\n@basictag(takes_context=True)\ndef commentcounts(context, filediff, interfilediff=None):\n \"\"\"\n Returns a JSON array of current comments for a filediff, sorted by\n line number.\n\n Each entry in the array has a dictionary containing the following keys:\n\n =========== ==================================================\n Key Description\n =========== ==================================================\n comment_id The ID of the comment\n text The text of the comment\n line The first line number\n num_lines The number of lines this comment spans\n user A dictionary containing \"username\" and \"name\" keys\n for the user\n url The URL to the comment\n localdraft True if this is the current user's draft comment\n =========== ==================================================\n \"\"\"\n comment_dict = {}\n user = context.get('user', None)\n\n if interfilediff:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff=interfilediff)\n else:\n query = Comment.objects.filter(filediff=filediff,\n interfilediff__isnull=True)\n\n for comment in query:\n review = get_object_or_none(comment.review)\n\n if review and (review.public or review.user == user):\n key = (comment.first_line, comment.num_lines)\n\n comment_dict.setdefault(key, []).append({\n 'comment_id': comment.id,\n 'text': escape(comment.text),\n 'line': comment.first_line,\n 'num_lines': comment.num_lines,\n 'user': {\n 'username': review.user.username,\n 'name': review.user.get_full_name() or review.user.username,\n },\n #'timestamp': comment.timestamp,\n 'url': comment.get_review_url(),\n 'localdraft': review.user == user and \\\n not review.public,\n })\n\n comments_array = []\n\n for key, value in comment_dict.iteritems():\n comments_array.append({\n 'linenum': key[0],\n 'num_lines': key[1],\n 'comments': value,\n })\n\n comments_array.sort(cmp=lambda x, y: cmp(x['linenum'], y['linenum'] or\n cmp(x['num_lines'], y['num_lines'])))\n\n return simplejson.dumps(comments_array)","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"commentcounts","file_name":"reviewboard/reviews/templatetags/reviewtags.py","commit_link":"github.com/reviewboard/reviewboard/commit/7a0a9d94555502278534dedcf2d75e9fccce8c3d","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#38-72821e099e31","input":"static int oidc_handle_session_management_iframe_rp(request_rec *r, oidc_cfg *c,\n\t\toidc_session_t *session, const char *client_id,\n\t\tconst char *check_session_iframe) {\n\n\toidc_debug(r, \"enter\");\n\n\tconst char *java_script =\n\t\t\t\" \\n\";\n\n\t/* determine the origin for the check_session_iframe endpoint */\n\tchar *origin = apr_pstrdup(r->pool, check_session_iframe);\n\tapr_uri_t uri;\n\tapr_uri_parse(r->pool, check_session_iframe, &uri);\n\tchar *p = strstr(origin, uri.path);\n\t*p = '\\0';\n\n\t/* the element identifier for the OP iframe */\n\tconst char *op_iframe_id = \"openidc-op\";\n\n\t/* restore the OP session_state from the session */\n\tconst char *session_state = oidc_session_get_session_state(r, session);\n\tif (session_state == NULL) {\n\t\toidc_warn(r,\n\t\t\t\t\"no session_state found in the session; the OP does probably not support session management!?\");\n\t\treturn DONE;\n\t}\n\n\tchar *s_poll_interval = NULL;\n\toidc_util_get_request_parameter(r, \"poll\", &s_poll_interval);\n\tif (s_poll_interval == NULL)\n\t\ts_poll_interval = \"3000\";\n\n\tconst char *redirect_uri = oidc_get_redirect_uri(r, c);\n\tjava_script = apr_psprintf(r->pool, java_script, origin, client_id,\n\t\t\tsession_state, op_iframe_id, s_poll_interval, redirect_uri,\n\t\t\tredirect_uri);\n\n\treturn oidc_util_html_send(r, NULL, java_script, \"setTimer\", NULL, DONE);\n}","target":"static int oidc_handle_session_management_iframe_rp(request_rec *r, oidc_cfg *c,\n\t\toidc_session_t *session, const char *client_id,\n\t\tconst char *check_session_iframe) {\n\n\toidc_debug(r, \"enter\");\n\n\tconst char *java_script =\n\t\t\t\" \\n\";\n\n\t/* determine the origin for the check_session_iframe endpoint */\n\tchar *origin = apr_pstrdup(r->pool, check_session_iframe);\n\tapr_uri_t uri;\n\tapr_uri_parse(r->pool, check_session_iframe, &uri);\n\tchar *p = strstr(origin, uri.path);\n\t*p = '\\0';\n\n\t/* the element identifier for the OP iframe */\n\tconst char *op_iframe_id = \"openidc-op\";\n\n\t/* restore the OP session_state from the session */\n\tconst char *session_state = oidc_session_get_session_state(r, session);\n\tif (session_state == NULL) {\n\t\toidc_warn(r,\n\t\t\t\t\"no session_state found in the session; the OP does probably not support session management!?\");\n\t\treturn DONE;\n\t}\n\n\tchar *s_poll_interval = NULL;\n\toidc_util_get_request_parameter(r, \"poll\", &s_poll_interval);\n\tint poll_interval = s_poll_interval ? strtol(s_poll_interval, NULL, 10) : 0;\n\tif ((poll_interval <= 0) || (poll_interval > 3600 * 24))\n\t\tpoll_interval = 3000;\n\n\tconst char *redirect_uri = oidc_get_redirect_uri(r, c);\n\tjava_script = apr_psprintf(r->pool, java_script, origin, client_id,\n\t\t\tsession_state, op_iframe_id, poll_interval, redirect_uri,\n\t\t\tredirect_uri);\n\n\treturn oidc_util_html_send(r, NULL, java_script, \"setTimer\", NULL, DONE);\n}","lang":"c","vul_type":"cwe-079","sven_meta":{"func_name":"oidc_handle_session_management_iframe_rp","file_name":"src/mod_auth_openidc.c","commit_link":"github.com/zmartzone/mod_auth_openidc/commit/132a4111bf3791e76437619a66336dce2ce4c79b","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#39-df317e1ae5be","input":"void Logger::addMessage(const QString &message, const Log::MsgType &type)\n{\n QWriteLocker locker(&lock);\n\n Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, message };\n m_messages.push_back(temp);\n\n if (m_messages.size() >= MAX_LOG_MESSAGES)\n m_messages.pop_front();\n\n emit newLogMessage(temp);\n}","target":"void Logger::addMessage(const QString &message, const Log::MsgType &type)\n{\n QWriteLocker locker(&lock);\n\n Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, Utils::String::toHtmlEscaped(message) };\n m_messages.push_back(temp);\n\n if (m_messages.size() >= MAX_LOG_MESSAGES)\n m_messages.pop_front();\n\n emit newLogMessage(temp);\n}","lang":"cpp","vul_type":"cwe-079","sven_meta":{"func_name":"Logger::addMessage","file_name":"src/base/logger.cpp","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#40-9a01affe0d76","input":" @handler.unsupported_on_local_server\n @handler.get(handler.HTML)\n def get(self):\n \"\"\"Handle a get request.\"\"\"\n self.render(\n 'login.html', {\n 'apiKey': local_config.ProjectConfig().get('firebase.api_key'),\n 'authDomain': auth.auth_domain(),\n 'dest': self.request.get('dest'),\n })","target":" @handler.unsupported_on_local_server\n @handler.get(handler.HTML)\n def get(self):\n \"\"\"Handle a get request.\"\"\"\n dest = self.request.get('dest')\n base_handler.check_redirect_url(dest)\n\n self.render(\n 'login.html', {\n 'apiKey': local_config.ProjectConfig().get('firebase.api_key'),\n 'authDomain': auth.auth_domain(),\n 'dest': dest,\n })","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"get","file_name":"src/appengine/handlers/login.py","commit_link":"github.com/google/clusterfuzz/commit/3d66c1146550eecd4e34d47332a8616b435a21fe","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#41-a1231ab75c3a","input":"def manipulate_reservation_action(request: HttpRequest, default_foreward_url: str):\n \"\"\"\n This function is used to alter the reservation beeing build inside\n a cookie. This function automatically crafts the required response.\n \"\"\"\n js_string: str = \"\"\n r: GroupReservation = None\n u: Profile = get_current_user(request)\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if \"srid\" in request.GET:\n if not request.GET.get(\"rid\"):\n return HttpResponseRedirect(\"/admin?error=missing%20primary%20reservation%20id\")\n srid: int = int(request.GET[\"srid\"])\n sr: SubReservation = None\n if srid == 0:\n sr = SubReservation()\n else:\n sr = SubReservation.objects.get(id=srid)\n if request.POST.get(\"notes\"):\n sr.notes = request.POST[\"notes\"]\n else:\n sr.notes = \" \"\n sr.primary_reservation = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n sr.save()\n print(request.POST)\n print(sr.notes)\n return HttpResponseRedirect(\"/admin/reservations/edit?rid=\" + str(int(request.GET[\"rid\"])) + \"&srid=\" + str(sr.id))\n if \"rid\" in request.GET:\n # update reservation\n r = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n elif u.number_of_allowed_reservations > GroupReservation.objects.all().filter(createdByUser=u).count():\n r = GroupReservation()\n r.createdByUser = u\n r.ready = False\n r.open = True\n r.pickupDate = datetime.datetime.now()\n else:\n return HttpResponseRedirect(\"/admin?error=Too%20Many%20reservations\")\n if request.POST.get(\"notes\"):\n r.notes = request.POST[\"notes\"]\n if request.POST.get(\"contact\"):\n r.responsiblePerson = str(request.POST[\"contact\"])\n if (r.createdByUser == u or o.rights > 1) and not r.submitted:\n r.save()\n else:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n response: HttpResponseRedirect = HttpResponseRedirect(forward_url + \"?rid=\" + str(r.id))\n return response","target":"def manipulate_reservation_action(request: HttpRequest, default_foreward_url: str):\n \"\"\"\n This function is used to alter the reservation beeing build inside\n a cookie. This function automatically crafts the required response.\n \"\"\"\n js_string: str = \"\"\n r: GroupReservation = None\n u: Profile = get_current_user(request)\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n if \"srid\" in request.GET:\n if not request.GET.get(\"rid\"):\n return HttpResponseRedirect(\"/admin?error=missing%20primary%20reservation%20id\")\n srid: int = int(request.GET[\"srid\"])\n sr: SubReservation = None\n if srid == 0:\n sr = SubReservation()\n else:\n sr = SubReservation.objects.get(id=srid)\n if request.POST.get(\"notes\"):\n sr.notes = escape(request.POST[\"notes\"])\n else:\n sr.notes = \" \"\n sr.primary_reservation = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n sr.save()\n print(request.POST)\n print(sr.notes)\n return HttpResponseRedirect(\"/admin/reservations/edit?rid=\" + str(int(request.GET[\"rid\"])) + \"&srid=\" + str(sr.id))\n if \"rid\" in request.GET:\n # update reservation\n r = GroupReservation.objects.get(id=int(request.GET[\"rid\"]))\n elif u.number_of_allowed_reservations > GroupReservation.objects.all().filter(createdByUser=u).count():\n r = GroupReservation()\n r.createdByUser = u\n r.ready = False\n r.open = True\n r.pickupDate = datetime.datetime.now()\n else:\n return HttpResponseRedirect(\"/admin?error=Too%20Many%20reservations\")\n if request.POST.get(\"notes\"):\n r.notes = escape(request.POST[\"notes\"])\n if request.POST.get(\"contact\"):\n r.responsiblePerson = escape(str(request.POST[\"contact\"]))\n if (r.createdByUser == u or o.rights > 1) and not r.submitted:\n r.save()\n else:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n response: HttpResponseRedirect = HttpResponseRedirect(forward_url + \"?rid=\" + str(r.id))\n return response","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"manipulate_reservation_action","file_name":"c3shop/frontpage/management/reservation_actions.py","commit_link":"github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#42-b9eec320d323","input":" @property\n async def html_content(self):\n content = await self.content\n if not content:\n return ''\n return markdown(content)","target":" @property\n async def html_content(self):\n content = markupsafe.escape(await self.content)\n if not content:\n return ''\n return markdown(content)","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"html_content","file_name":"models/comment.py","commit_link":"github.com/dongweiming/lyanna/commit/fcefac79e4b7601e81a3b3fe0ad26ab18ee95d7d","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#43-87b0eb38c618","input":" def get_context_data(self, *args, **kwargs):\n data = super().get_context_data(*args, **kwargs)\n\n if self.request.GET.get('back', None) is not None:\n data['back_link'] = self.request.GET['back']\n\n return data","target":" def get_context_data(self, *args, **kwargs):\n data = super().get_context_data(*args, **kwargs)\n\n back = self.request.GET.get('back', None)\n parsed_back_url = urllib.parse.urlparse(back)\n\n # We only allow blank scheme, e.g. relative urls to avoid reflected XSS\n if back is not None and parsed_back_url.scheme == \"\":\n data['back_link'] = back\n\n return data","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"get_context_data","file_name":"socialsystem/core/views.py","commit_link":"github.com/pirati-web/socialnisystem.cz/commit/1bd25d971ac3f9ac7ae3915cc2dd86b0ceb44b53","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#44-71bd584b82b3","input":"def add_article_action(request: HttpRequest, default_foreward_url: str):\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n else:\n forward_url = \"/admin\"\n if \"rid\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=Missing%20reservation%20id%20in%20request\")\n u: Profile = get_current_user(request)\n current_reservation = GroupReservation.objects.get(id=str(request.GET[\"rid\"]))\n if current_reservation.createdByUser != u and u.rights < 2:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n if current_reservation.submitted == True:\n return HttpResponseRedirect(\"/admin?error=Already%20submitted\")\n # Test for multiple or single article\n if \"article_id\" in request.POST:\n # Actual adding of article\n aid: int = int(request.GET.get(\"article_id\"))\n quantity: int = int(request.POST[\"quantity\"])\n notes: str = request.POST[\"notes\"]\n ar = ArticleRequested()\n ar.AID = Article.objects.get(id=aid)\n ar.RID = current_reservation\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))\n ar.amount = quantity\n ar.notes = notes\n ar.save()\n # Actual adding of multiple articles\n else:\n if \"group_id\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=missing%20group%20id\")\n g: ArticleGroup = ArticleGroup.objects.get(id=int(request.GET[\"group_id\"]))\n for art in Article.objects.all().filter(group=g):\n if str(\"quantity_\" + str(art.id)) not in request.POST or str(\"notes_\" + str(art.id)) not in request.POST:\n return HttpResponseRedirect(\"/admin?error=Missing%20article%20data%20in%20request\")\n amount = int(request.POST[\"quantity_\" + str(art.id)])\n if amount > 0:\n ar = ArticleRequested()\n ar.AID = art\n ar.RID = current_reservation\n ar.amount = amount\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))\n ar.notes = str(request.POST[str(\"notes_\" + str(art.id))])\n ar.save()\n if \"srid\" in request.GET:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id) + \"&srid=\" + request.GET[\"srid\"])\n else:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id))\n return response","target":"def add_article_action(request: HttpRequest, default_foreward_url: str):\n forward_url: str = default_foreward_url\n if request.GET.get(\"redirect\"):\n forward_url = request.GET[\"redirect\"]\n else:\n forward_url = \"/admin\"\n if \"rid\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=Missing%20reservation%20id%20in%20request\")\n u: Profile = get_current_user(request)\n current_reservation = GroupReservation.objects.get(id=str(request.GET[\"rid\"]))\n if current_reservation.createdByUser != u and u.rights < 2:\n return HttpResponseRedirect(\"/admin?error=noyb\")\n if current_reservation.submitted == True:\n return HttpResponseRedirect(\"/admin?error=Already%20submitted\")\n # Test for multiple or single article\n if \"article_id\" in request.POST:\n # Actual adding of article\n aid: int = int(request.GET.get(\"article_id\"))\n quantity: int = int(request.POST[\"quantity\"])\n notes: str = escape(request.POST[\"notes\"])\n ar = ArticleRequested()\n ar.AID = Article.objects.get(id=aid)\n ar.RID = current_reservation\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))\n ar.amount = quantity\n ar.notes = notes\n ar.save()\n # Actual adding of multiple articles\n else:\n if \"group_id\" not in request.GET:\n return HttpResponseRedirect(\"/admin?error=missing%20group%20id\")\n g: ArticleGroup = ArticleGroup.objects.get(id=int(request.GET[\"group_id\"]))\n for art in Article.objects.all().filter(group=g):\n if str(\"quantity_\" + str(art.id)) not in request.POST or str(\"notes_\" + str(art.id)) not in request.POST:\n return HttpResponseRedirect(\"/admin?error=Missing%20article%20data%20in%20request\")\n amount = int(request.POST[\"quantity_\" + str(art.id)])\n if amount > 0:\n ar = ArticleRequested()\n ar.AID = art\n ar.RID = current_reservation\n ar.amount = amount\n if \"srid\" in request.GET:\n ar.SRID = SubReservation.objects.get(id=int(request.GET[\"srid\"]))\n ar.notes = escape(str(request.POST[str(\"notes_\" + str(art.id))]))\n ar.save()\n if \"srid\" in request.GET:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id) + \"&srid=\" + request.GET[\"srid\"])\n else:\n response = HttpResponseRedirect(forward_url + \"?rid=\" + str(current_reservation.id))\n return response","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"add_article_action","file_name":"c3shop/frontpage/management/reservation_actions.py","commit_link":"github.com/Technikradio/C3FOCSite/commit/6e330d4d44bbfdfce9993dffea97008276771600","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-190#0-b49215d0e77b","input":"int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, UINT8* buffer, Py_ssize_t bytes) {\n TIFFSTATE *clientstate = (TIFFSTATE *)state->context;\n char *filename = \"tempfile.tif\";\n char *mode = \"r\";\n TIFF *tiff;\n\n /* buffer is the encoded file, bytes is the length of the encoded file */\n /* it all ends up in state->buffer, which is a uint8* from Imaging.h */\n\n TRACE((\"in decoder: bytes %d\\n\", bytes));\n TRACE((\"State: count %d, state %d, x %d, y %d, ystep %d\\n\", state->count, state->state,\n state->x, state->y, state->ystep));\n TRACE((\"State: xsize %d, ysize %d, xoff %d, yoff %d \\n\", state->xsize, state->ysize,\n state->xoff, state->yoff));\n TRACE((\"State: bits %d, bytes %d \\n\", state->bits, state->bytes));\n TRACE((\"Buffer: %p: %c%c%c%c\\n\", buffer, (char)buffer[0], (char)buffer[1],(char)buffer[2], (char)buffer[3]));\n TRACE((\"State->Buffer: %c%c%c%c\\n\", (char)state->buffer[0], (char)state->buffer[1],(char)state->buffer[2], (char)state->buffer[3]));\n TRACE((\"Image: mode %s, type %d, bands: %d, xsize %d, ysize %d \\n\",\n im->mode, im->type, im->bands, im->xsize, im->ysize));\n TRACE((\"Image: image8 %p, image32 %p, image %p, block %p \\n\",\n im->image8, im->image32, im->image, im->block));\n TRACE((\"Image: pixelsize: %d, linesize %d \\n\",\n im->pixelsize, im->linesize));\n\n dump_state(clientstate);\n clientstate->size = bytes;\n clientstate->eof = clientstate->size;\n clientstate->loc = 0;\n clientstate->data = (tdata_t)buffer;\n clientstate->flrealloc = 0;\n dump_state(clientstate);\n\n TIFFSetWarningHandler(NULL);\n TIFFSetWarningHandlerExt(NULL);\n\n if (clientstate->fp) {\n TRACE((\"Opening using fd: %d\\n\",clientstate->fp));\n lseek(clientstate->fp,0,SEEK_SET); // Sometimes, I get it set to the end.\n tiff = TIFFFdOpen(clientstate->fp, filename, mode);\n } else {\n TRACE((\"Opening from string\\n\"));\n tiff = TIFFClientOpen(filename, mode,\n (thandle_t) clientstate,\n _tiffReadProc, _tiffWriteProc,\n _tiffSeekProc, _tiffCloseProc, _tiffSizeProc,\n _tiffMapProc, _tiffUnmapProc);\n }\n\n if (!tiff){\n TRACE((\"Error, didn't get the tiff\\n\"));\n state->errcode = IMAGING_CODEC_BROKEN;\n return -1;\n }\n\n if (clientstate->ifd){\n int rv;\n uint32 ifdoffset = clientstate->ifd;\n TRACE((\"reading tiff ifd %u\\n\", ifdoffset));\n rv = TIFFSetSubDirectory(tiff, ifdoffset);\n if (!rv){\n TRACE((\"error in TIFFSetSubDirectory\"));\n return -1;\n }\n }\n\n if (TIFFIsTiled(tiff)) {\n UINT32 x, y, tile_y, row_byte_size;\n UINT32 tile_width, tile_length, current_tile_width;\n UINT8 *new_data;\n\n TIFFGetField(tiff, TIFFTAG_TILEWIDTH, &tile_width);\n TIFFGetField(tiff, TIFFTAG_TILELENGTH, &tile_length);\n\n // We could use TIFFTileSize, but for YCbCr data it returns subsampled data size\n row_byte_size = (tile_width * state->bits + 7) / 8;\n state->bytes = row_byte_size * tile_length;\n\n /* overflow check for malloc */\n if (state->bytes > INT_MAX - 1) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n\n /* realloc to fit whole tile */\n new_data = realloc (state->buffer, state->bytes);\n if (!new_data) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n\n state->buffer = new_data;\n\n TRACE((\"TIFFTileSize: %d\\n\", state->bytes));\n\n for (y = state->yoff; y < state->ysize; y += tile_length) {\n for (x = state->xoff; x < state->xsize; x += tile_width) {\n if (ReadTile(tiff, x, y, (UINT32*) state->buffer) == -1) {\n TRACE((\"Decode Error, Tile at %dx%d\\n\", x, y));\n state->errcode = IMAGING_CODEC_BROKEN;\n TIFFClose(tiff);\n return -1;\n }\n\n TRACE((\"Read tile at %dx%d; \\n\\n\", x, y));\n\n current_tile_width = min(tile_width, state->xsize - x);\n\n // iterate over each line in the tile and stuff data into image\n for (tile_y = 0; tile_y < min(tile_length, state->ysize - y); tile_y++) {\n TRACE((\"Writing tile data at %dx%d using tile_width: %d; \\n\", tile_y + y, x, current_tile_width));\n\n // UINT8 * bbb = state->buffer + tile_y * row_byte_size;\n // TRACE((\"chars: %x%x%x%x\\n\", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3]));\n\n state->shuffle((UINT8*) im->image[tile_y + y] + x * im->pixelsize,\n state->buffer + tile_y * row_byte_size,\n current_tile_width\n );\n }\n }\n }\n } else {\n UINT32 strip_row, row_byte_size;\n UINT8 *new_data;\n UINT32 rows_per_strip;\n int ret;\n\n ret = TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_strip);\n if (ret != 1) {\n rows_per_strip = state->ysize;\n }\n TRACE((\"RowsPerStrip: %u \\n\", rows_per_strip));\n\n // We could use TIFFStripSize, but for YCbCr data it returns subsampled data size\n row_byte_size = (state->xsize * state->bits + 7) / 8;\n state->bytes = rows_per_strip * row_byte_size;\n\n TRACE((\"StripSize: %d \\n\", state->bytes));\n\n /* realloc to fit whole strip */\n new_data = realloc (state->buffer, state->bytes);\n if (!new_data) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n\n state->buffer = new_data;\n\n for (; state->y < state->ysize; state->y += rows_per_strip) {\n if (ReadStrip(tiff, state->y, (UINT32 *)state->buffer) == -1) {\n TRACE((\"Decode Error, strip %d\\n\", TIFFComputeStrip(tiff, state->y, 0)));\n state->errcode = IMAGING_CODEC_BROKEN;\n TIFFClose(tiff);\n return -1;\n }\n\n TRACE((\"Decoded strip for row %d \\n\", state->y));\n\n // iterate over each row in the strip and stuff data into image\n for (strip_row = 0; strip_row < min(rows_per_strip, state->ysize - state->y); strip_row++) {\n TRACE((\"Writing data into line %d ; \\n\", state->y + strip_row));\n\n // UINT8 * bbb = state->buffer + strip_row * (state->bytes / rows_per_strip);\n // TRACE((\"chars: %x %x %x %x\\n\", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3]));\n\n state->shuffle((UINT8*) im->image[state->y + state->yoff + strip_row] +\n state->xoff * im->pixelsize,\n state->buffer + strip_row * row_byte_size,\n state->xsize);\n }\n }\n }\n\n TIFFClose(tiff);\n TRACE((\"Done Decoding, Returning \\n\"));\n // Returning -1 here to force ImageFile.load to break, rather than\n // even think about looping back around.\n return -1;\n}","target":"int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, UINT8* buffer, Py_ssize_t bytes) {\n TIFFSTATE *clientstate = (TIFFSTATE *)state->context;\n char *filename = \"tempfile.tif\";\n char *mode = \"r\";\n TIFF *tiff;\n\n /* buffer is the encoded file, bytes is the length of the encoded file */\n /* it all ends up in state->buffer, which is a uint8* from Imaging.h */\n\n TRACE((\"in decoder: bytes %d\\n\", bytes));\n TRACE((\"State: count %d, state %d, x %d, y %d, ystep %d\\n\", state->count, state->state,\n state->x, state->y, state->ystep));\n TRACE((\"State: xsize %d, ysize %d, xoff %d, yoff %d \\n\", state->xsize, state->ysize,\n state->xoff, state->yoff));\n TRACE((\"State: bits %d, bytes %d \\n\", state->bits, state->bytes));\n TRACE((\"Buffer: %p: %c%c%c%c\\n\", buffer, (char)buffer[0], (char)buffer[1],(char)buffer[2], (char)buffer[3]));\n TRACE((\"State->Buffer: %c%c%c%c\\n\", (char)state->buffer[0], (char)state->buffer[1],(char)state->buffer[2], (char)state->buffer[3]));\n TRACE((\"Image: mode %s, type %d, bands: %d, xsize %d, ysize %d \\n\",\n im->mode, im->type, im->bands, im->xsize, im->ysize));\n TRACE((\"Image: image8 %p, image32 %p, image %p, block %p \\n\",\n im->image8, im->image32, im->image, im->block));\n TRACE((\"Image: pixelsize: %d, linesize %d \\n\",\n im->pixelsize, im->linesize));\n\n dump_state(clientstate);\n clientstate->size = bytes;\n clientstate->eof = clientstate->size;\n clientstate->loc = 0;\n clientstate->data = (tdata_t)buffer;\n clientstate->flrealloc = 0;\n dump_state(clientstate);\n\n TIFFSetWarningHandler(NULL);\n TIFFSetWarningHandlerExt(NULL);\n\n if (clientstate->fp) {\n TRACE((\"Opening using fd: %d\\n\",clientstate->fp));\n lseek(clientstate->fp,0,SEEK_SET); // Sometimes, I get it set to the end.\n tiff = TIFFFdOpen(clientstate->fp, filename, mode);\n } else {\n TRACE((\"Opening from string\\n\"));\n tiff = TIFFClientOpen(filename, mode,\n (thandle_t) clientstate,\n _tiffReadProc, _tiffWriteProc,\n _tiffSeekProc, _tiffCloseProc, _tiffSizeProc,\n _tiffMapProc, _tiffUnmapProc);\n }\n\n if (!tiff){\n TRACE((\"Error, didn't get the tiff\\n\"));\n state->errcode = IMAGING_CODEC_BROKEN;\n return -1;\n }\n\n if (clientstate->ifd){\n int rv;\n uint32 ifdoffset = clientstate->ifd;\n TRACE((\"reading tiff ifd %u\\n\", ifdoffset));\n rv = TIFFSetSubDirectory(tiff, ifdoffset);\n if (!rv){\n TRACE((\"error in TIFFSetSubDirectory\"));\n return -1;\n }\n }\n\n if (TIFFIsTiled(tiff)) {\n UINT32 x, y, tile_y, row_byte_size;\n UINT32 tile_width, tile_length, current_tile_width;\n UINT8 *new_data;\n\n TIFFGetField(tiff, TIFFTAG_TILEWIDTH, &tile_width);\n TIFFGetField(tiff, TIFFTAG_TILELENGTH, &tile_length);\n\n // We could use TIFFTileSize, but for YCbCr data it returns subsampled data size\n row_byte_size = (tile_width * state->bits + 7) / 8;\n\n /* overflow check for realloc */\n if (INT_MAX / row_byte_size < tile_length) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n \n state->bytes = row_byte_size * tile_length;\n\n /* realloc to fit whole tile */\n /* malloc check above */\n new_data = realloc (state->buffer, state->bytes);\n if (!new_data) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n\n state->buffer = new_data;\n\n TRACE((\"TIFFTileSize: %d\\n\", state->bytes));\n\n for (y = state->yoff; y < state->ysize; y += tile_length) {\n for (x = state->xoff; x < state->xsize; x += tile_width) {\n if (ReadTile(tiff, x, y, (UINT32*) state->buffer) == -1) {\n TRACE((\"Decode Error, Tile at %dx%d\\n\", x, y));\n state->errcode = IMAGING_CODEC_BROKEN;\n TIFFClose(tiff);\n return -1;\n }\n\n TRACE((\"Read tile at %dx%d; \\n\\n\", x, y));\n\n current_tile_width = min(tile_width, state->xsize - x);\n\n // iterate over each line in the tile and stuff data into image\n for (tile_y = 0; tile_y < min(tile_length, state->ysize - y); tile_y++) {\n TRACE((\"Writing tile data at %dx%d using tile_width: %d; \\n\", tile_y + y, x, current_tile_width));\n\n // UINT8 * bbb = state->buffer + tile_y * row_byte_size;\n // TRACE((\"chars: %x%x%x%x\\n\", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3]));\n\n state->shuffle((UINT8*) im->image[tile_y + y] + x * im->pixelsize,\n state->buffer + tile_y * row_byte_size,\n current_tile_width\n );\n }\n }\n }\n } else {\n UINT32 strip_row, row_byte_size;\n UINT8 *new_data;\n UINT32 rows_per_strip;\n int ret;\n\n ret = TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_strip);\n if (ret != 1) {\n rows_per_strip = state->ysize;\n }\n TRACE((\"RowsPerStrip: %u \\n\", rows_per_strip));\n\n // We could use TIFFStripSize, but for YCbCr data it returns subsampled data size\n row_byte_size = (state->xsize * state->bits + 7) / 8;\n\n /* overflow check for realloc */\n if (INT_MAX / row_byte_size < rows_per_strip) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n \n state->bytes = rows_per_strip * row_byte_size;\n\n TRACE((\"StripSize: %d \\n\", state->bytes));\n\n /* realloc to fit whole strip */\n /* malloc check above */\n new_data = realloc (state->buffer, state->bytes);\n if (!new_data) {\n state->errcode = IMAGING_CODEC_MEMORY;\n TIFFClose(tiff);\n return -1;\n }\n\n state->buffer = new_data;\n\n for (; state->y < state->ysize; state->y += rows_per_strip) {\n if (ReadStrip(tiff, state->y, (UINT32 *)state->buffer) == -1) {\n TRACE((\"Decode Error, strip %d\\n\", TIFFComputeStrip(tiff, state->y, 0)));\n state->errcode = IMAGING_CODEC_BROKEN;\n TIFFClose(tiff);\n return -1;\n }\n\n TRACE((\"Decoded strip for row %d \\n\", state->y));\n\n // iterate over each row in the strip and stuff data into image\n for (strip_row = 0; strip_row < min(rows_per_strip, state->ysize - state->y); strip_row++) {\n TRACE((\"Writing data into line %d ; \\n\", state->y + strip_row));\n\n // UINT8 * bbb = state->buffer + strip_row * (state->bytes / rows_per_strip);\n // TRACE((\"chars: %x %x %x %x\\n\", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3]));\n\n state->shuffle((UINT8*) im->image[state->y + state->yoff + strip_row] +\n state->xoff * im->pixelsize,\n state->buffer + strip_row * row_byte_size,\n state->xsize);\n }\n }\n }\n\n TIFFClose(tiff);\n TRACE((\"Done Decoding, Returning \\n\"));\n // Returning -1 here to force ImageFile.load to break, rather than\n // even think about looping back around.\n return -1;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"ImagingLibTiffDecode","file_name":"src/libImaging/TiffDecode.c","commit_link":"github.com/python-pillow/Pillow/commit/4e2def2539ec13e53a82e06c4b3daf00454100c4","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#1-37247d4b40f2","input":"static int futex_requeue(u32 __user *uaddr1, unsigned int flags,\n\t\t\t u32 __user *uaddr2, int nr_wake, int nr_requeue,\n\t\t\t u32 *cmpval, int requeue_pi)\n{\n\tunion futex_key key1 = FUTEX_KEY_INIT, key2 = FUTEX_KEY_INIT;\n\tint drop_count = 0, task_count = 0, ret;\n\tstruct futex_pi_state *pi_state = NULL;\n\tstruct futex_hash_bucket *hb1, *hb2;\n\tstruct futex_q *this, *next;\n\tDEFINE_WAKE_Q(wake_q);\n\n\t/*\n\t * When PI not supported: return -ENOSYS if requeue_pi is true,\n\t * consequently the compiler knows requeue_pi is always false past\n\t * this point which will optimize away all the conditional code\n\t * further down.\n\t */\n\tif (!IS_ENABLED(CONFIG_FUTEX_PI) && requeue_pi)\n\t\treturn -ENOSYS;\n\n\tif (requeue_pi) {\n\t\t/*\n\t\t * Requeue PI only works on two distinct uaddrs. This\n\t\t * check is only valid for private futexes. See below.\n\t\t */\n\t\tif (uaddr1 == uaddr2)\n\t\t\treturn -EINVAL;\n\n\t\t/*\n\t\t * requeue_pi requires a pi_state, try to allocate it now\n\t\t * without any locks in case it fails.\n\t\t */\n\t\tif (refill_pi_state_cache())\n\t\t\treturn -ENOMEM;\n\t\t/*\n\t\t * requeue_pi must wake as many tasks as it can, up to nr_wake\n\t\t * + nr_requeue, since it acquires the rt_mutex prior to\n\t\t * returning to userspace, so as to not leave the rt_mutex with\n\t\t * waiters and no owner. However, second and third wake-ups\n\t\t * cannot be predicted as they involve race conditions with the\n\t\t * first wake and a fault while looking up the pi_state. Both\n\t\t * pthread_cond_signal() and pthread_cond_broadcast() should\n\t\t * use nr_wake=1.\n\t\t */\n\t\tif (nr_wake != 1)\n\t\t\treturn -EINVAL;\n\t}\n\nretry:\n\tret = get_futex_key(uaddr1, flags & FLAGS_SHARED, &key1, VERIFY_READ);\n\tif (unlikely(ret != 0))\n\t\tgoto out;\n\tret = get_futex_key(uaddr2, flags & FLAGS_SHARED, &key2,\n\t\t\t requeue_pi ? VERIFY_WRITE : VERIFY_READ);\n\tif (unlikely(ret != 0))\n\t\tgoto out_put_key1;\n\n\t/*\n\t * The check above which compares uaddrs is not sufficient for\n\t * shared futexes. We need to compare the keys:\n\t */\n\tif (requeue_pi && match_futex(&key1, &key2)) {\n\t\tret = -EINVAL;\n\t\tgoto out_put_keys;\n\t}\n\n\thb1 = hash_futex(&key1);\n\thb2 = hash_futex(&key2);\n\nretry_private:\n\thb_waiters_inc(hb2);\n\tdouble_lock_hb(hb1, hb2);\n\n\tif (likely(cmpval != NULL)) {\n\t\tu32 curval;\n\n\t\tret = get_futex_value_locked(&curval, uaddr1);\n\n\t\tif (unlikely(ret)) {\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\n\t\t\tret = get_user(curval, uaddr1);\n\t\t\tif (ret)\n\t\t\t\tgoto out_put_keys;\n\n\t\t\tif (!(flags & FLAGS_SHARED))\n\t\t\t\tgoto retry_private;\n\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tgoto retry;\n\t\t}\n\t\tif (curval != *cmpval) {\n\t\t\tret = -EAGAIN;\n\t\t\tgoto out_unlock;\n\t\t}\n\t}\n\n\tif (requeue_pi && (task_count - nr_wake < nr_requeue)) {\n\t\t/*\n\t\t * Attempt to acquire uaddr2 and wake the top waiter. If we\n\t\t * intend to requeue waiters, force setting the FUTEX_WAITERS\n\t\t * bit. We force this here where we are able to easily handle\n\t\t * faults rather in the requeue loop below.\n\t\t */\n\t\tret = futex_proxy_trylock_atomic(uaddr2, hb1, hb2, &key1,\n\t\t\t\t\t\t &key2, &pi_state, nr_requeue);\n\n\t\t/*\n\t\t * At this point the top_waiter has either taken uaddr2 or is\n\t\t * waiting on it. If the former, then the pi_state will not\n\t\t * exist yet, look it up one more time to ensure we have a\n\t\t * reference to it. If the lock was taken, ret contains the\n\t\t * vpid of the top waiter task.\n\t\t * If the lock was not taken, we have pi_state and an initial\n\t\t * refcount on it. In case of an error we have nothing.\n\t\t */\n\t\tif (ret > 0) {\n\t\t\tWARN_ON(pi_state);\n\t\t\tdrop_count++;\n\t\t\ttask_count++;\n\t\t\t/*\n\t\t\t * If we acquired the lock, then the user space value\n\t\t\t * of uaddr2 should be vpid. It cannot be changed by\n\t\t\t * the top waiter as it is blocked on hb2 lock if it\n\t\t\t * tries to do so. If something fiddled with it behind\n\t\t\t * our back the pi state lookup might unearth it. So\n\t\t\t * we rather use the known value than rereading and\n\t\t\t * handing potential crap to lookup_pi_state.\n\t\t\t *\n\t\t\t * If that call succeeds then we have pi_state and an\n\t\t\t * initial refcount on it.\n\t\t\t */\n\t\t\tret = lookup_pi_state(uaddr2, ret, hb2, &key2, &pi_state);\n\t\t}\n\n\t\tswitch (ret) {\n\t\tcase 0:\n\t\t\t/* We hold a reference on the pi state. */\n\t\t\tbreak;\n\n\t\t\t/* If the above failed, then pi_state is NULL */\n\t\tcase -EFAULT:\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tret = fault_in_user_writeable(uaddr2);\n\t\t\tif (!ret)\n\t\t\t\tgoto retry;\n\t\t\tgoto out;\n\t\tcase -EAGAIN:\n\t\t\t/*\n\t\t\t * Two reasons for this:\n\t\t\t * - Owner is exiting and we just wait for the\n\t\t\t * exit to complete.\n\t\t\t * - The user space value changed.\n\t\t\t */\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tcond_resched();\n\t\t\tgoto retry;\n\t\tdefault:\n\t\t\tgoto out_unlock;\n\t\t}\n\t}\n\n\tplist_for_each_entry_safe(this, next, &hb1->chain, list) {\n\t\tif (task_count - nr_wake >= nr_requeue)\n\t\t\tbreak;\n\n\t\tif (!match_futex(&this->key, &key1))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always\n\t\t * be paired with each other and no other futex ops.\n\t\t *\n\t\t * We should never be requeueing a futex_q with a pi_state,\n\t\t * which is awaiting a futex_unlock_pi().\n\t\t */\n\t\tif ((requeue_pi && !this->rt_waiter) ||\n\t\t (!requeue_pi && this->rt_waiter) ||\n\t\t this->pi_state) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * Wake nr_wake waiters. For requeue_pi, if we acquired the\n\t\t * lock, we already woke the top_waiter. If not, it will be\n\t\t * woken by futex_unlock_pi().\n\t\t */\n\t\tif (++task_count <= nr_wake && !requeue_pi) {\n\t\t\tmark_wake_futex(&wake_q, this);\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Ensure we requeue to the expected futex for requeue_pi. */\n\t\tif (requeue_pi && !match_futex(this->requeue_pi_key, &key2)) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * Requeue nr_requeue waiters and possibly one more in the case\n\t\t * of requeue_pi if we couldn't acquire the lock atomically.\n\t\t */\n\t\tif (requeue_pi) {\n\t\t\t/*\n\t\t\t * Prepare the waiter to take the rt_mutex. Take a\n\t\t\t * refcount on the pi_state and store the pointer in\n\t\t\t * the futex_q object of the waiter.\n\t\t\t */\n\t\t\tget_pi_state(pi_state);\n\t\t\tthis->pi_state = pi_state;\n\t\t\tret = rt_mutex_start_proxy_lock(&pi_state->pi_mutex,\n\t\t\t\t\t\t\tthis->rt_waiter,\n\t\t\t\t\t\t\tthis->task);\n\t\t\tif (ret == 1) {\n\t\t\t\t/*\n\t\t\t\t * We got the lock. We do neither drop the\n\t\t\t\t * refcount on pi_state nor clear\n\t\t\t\t * this->pi_state because the waiter needs the\n\t\t\t\t * pi_state for cleaning up the user space\n\t\t\t\t * value. It will drop the refcount after\n\t\t\t\t * doing so.\n\t\t\t\t */\n\t\t\t\trequeue_pi_wake_futex(this, &key2, hb2);\n\t\t\t\tdrop_count++;\n\t\t\t\tcontinue;\n\t\t\t} else if (ret) {\n\t\t\t\t/*\n\t\t\t\t * rt_mutex_start_proxy_lock() detected a\n\t\t\t\t * potential deadlock when we tried to queue\n\t\t\t\t * that waiter. Drop the pi_state reference\n\t\t\t\t * which we took above and remove the pointer\n\t\t\t\t * to the state from the waiters futex_q\n\t\t\t\t * object.\n\t\t\t\t */\n\t\t\t\tthis->pi_state = NULL;\n\t\t\t\tput_pi_state(pi_state);\n\t\t\t\t/*\n\t\t\t\t * We stop queueing more waiters and let user\n\t\t\t\t * space deal with the mess.\n\t\t\t\t */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\trequeue_futex(this, hb1, hb2, &key2);\n\t\tdrop_count++;\n\t}\n\n\t/*\n\t * We took an extra initial reference to the pi_state either\n\t * in futex_proxy_trylock_atomic() or in lookup_pi_state(). We\n\t * need to drop it here again.\n\t */\n\tput_pi_state(pi_state);\n\nout_unlock:\n\tdouble_unlock_hb(hb1, hb2);\n\twake_up_q(&wake_q);\n\thb_waiters_dec(hb2);\n\n\t/*\n\t * drop_futex_key_refs() must be called outside the spinlocks. During\n\t * the requeue we moved futex_q's from the hash bucket at key1 to the\n\t * one at key2 and updated their key pointer. We no longer need to\n\t * hold the references to key1.\n\t */\n\twhile (--drop_count >= 0)\n\t\tdrop_futex_key_refs(&key1);\n\nout_put_keys:\n\tput_futex_key(&key2);\nout_put_key1:\n\tput_futex_key(&key1);\nout:\n\treturn ret ? ret : task_count;\n}","target":"static int futex_requeue(u32 __user *uaddr1, unsigned int flags,\n\t\t\t u32 __user *uaddr2, int nr_wake, int nr_requeue,\n\t\t\t u32 *cmpval, int requeue_pi)\n{\n\tunion futex_key key1 = FUTEX_KEY_INIT, key2 = FUTEX_KEY_INIT;\n\tint drop_count = 0, task_count = 0, ret;\n\tstruct futex_pi_state *pi_state = NULL;\n\tstruct futex_hash_bucket *hb1, *hb2;\n\tstruct futex_q *this, *next;\n\tDEFINE_WAKE_Q(wake_q);\n\n\tif (nr_wake < 0 || nr_requeue < 0)\n\t\treturn -EINVAL;\n\n\t/*\n\t * When PI not supported: return -ENOSYS if requeue_pi is true,\n\t * consequently the compiler knows requeue_pi is always false past\n\t * this point which will optimize away all the conditional code\n\t * further down.\n\t */\n\tif (!IS_ENABLED(CONFIG_FUTEX_PI) && requeue_pi)\n\t\treturn -ENOSYS;\n\n\tif (requeue_pi) {\n\t\t/*\n\t\t * Requeue PI only works on two distinct uaddrs. This\n\t\t * check is only valid for private futexes. See below.\n\t\t */\n\t\tif (uaddr1 == uaddr2)\n\t\t\treturn -EINVAL;\n\n\t\t/*\n\t\t * requeue_pi requires a pi_state, try to allocate it now\n\t\t * without any locks in case it fails.\n\t\t */\n\t\tif (refill_pi_state_cache())\n\t\t\treturn -ENOMEM;\n\t\t/*\n\t\t * requeue_pi must wake as many tasks as it can, up to nr_wake\n\t\t * + nr_requeue, since it acquires the rt_mutex prior to\n\t\t * returning to userspace, so as to not leave the rt_mutex with\n\t\t * waiters and no owner. However, second and third wake-ups\n\t\t * cannot be predicted as they involve race conditions with the\n\t\t * first wake and a fault while looking up the pi_state. Both\n\t\t * pthread_cond_signal() and pthread_cond_broadcast() should\n\t\t * use nr_wake=1.\n\t\t */\n\t\tif (nr_wake != 1)\n\t\t\treturn -EINVAL;\n\t}\n\nretry:\n\tret = get_futex_key(uaddr1, flags & FLAGS_SHARED, &key1, VERIFY_READ);\n\tif (unlikely(ret != 0))\n\t\tgoto out;\n\tret = get_futex_key(uaddr2, flags & FLAGS_SHARED, &key2,\n\t\t\t requeue_pi ? VERIFY_WRITE : VERIFY_READ);\n\tif (unlikely(ret != 0))\n\t\tgoto out_put_key1;\n\n\t/*\n\t * The check above which compares uaddrs is not sufficient for\n\t * shared futexes. We need to compare the keys:\n\t */\n\tif (requeue_pi && match_futex(&key1, &key2)) {\n\t\tret = -EINVAL;\n\t\tgoto out_put_keys;\n\t}\n\n\thb1 = hash_futex(&key1);\n\thb2 = hash_futex(&key2);\n\nretry_private:\n\thb_waiters_inc(hb2);\n\tdouble_lock_hb(hb1, hb2);\n\n\tif (likely(cmpval != NULL)) {\n\t\tu32 curval;\n\n\t\tret = get_futex_value_locked(&curval, uaddr1);\n\n\t\tif (unlikely(ret)) {\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\n\t\t\tret = get_user(curval, uaddr1);\n\t\t\tif (ret)\n\t\t\t\tgoto out_put_keys;\n\n\t\t\tif (!(flags & FLAGS_SHARED))\n\t\t\t\tgoto retry_private;\n\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tgoto retry;\n\t\t}\n\t\tif (curval != *cmpval) {\n\t\t\tret = -EAGAIN;\n\t\t\tgoto out_unlock;\n\t\t}\n\t}\n\n\tif (requeue_pi && (task_count - nr_wake < nr_requeue)) {\n\t\t/*\n\t\t * Attempt to acquire uaddr2 and wake the top waiter. If we\n\t\t * intend to requeue waiters, force setting the FUTEX_WAITERS\n\t\t * bit. We force this here where we are able to easily handle\n\t\t * faults rather in the requeue loop below.\n\t\t */\n\t\tret = futex_proxy_trylock_atomic(uaddr2, hb1, hb2, &key1,\n\t\t\t\t\t\t &key2, &pi_state, nr_requeue);\n\n\t\t/*\n\t\t * At this point the top_waiter has either taken uaddr2 or is\n\t\t * waiting on it. If the former, then the pi_state will not\n\t\t * exist yet, look it up one more time to ensure we have a\n\t\t * reference to it. If the lock was taken, ret contains the\n\t\t * vpid of the top waiter task.\n\t\t * If the lock was not taken, we have pi_state and an initial\n\t\t * refcount on it. In case of an error we have nothing.\n\t\t */\n\t\tif (ret > 0) {\n\t\t\tWARN_ON(pi_state);\n\t\t\tdrop_count++;\n\t\t\ttask_count++;\n\t\t\t/*\n\t\t\t * If we acquired the lock, then the user space value\n\t\t\t * of uaddr2 should be vpid. It cannot be changed by\n\t\t\t * the top waiter as it is blocked on hb2 lock if it\n\t\t\t * tries to do so. If something fiddled with it behind\n\t\t\t * our back the pi state lookup might unearth it. So\n\t\t\t * we rather use the known value than rereading and\n\t\t\t * handing potential crap to lookup_pi_state.\n\t\t\t *\n\t\t\t * If that call succeeds then we have pi_state and an\n\t\t\t * initial refcount on it.\n\t\t\t */\n\t\t\tret = lookup_pi_state(uaddr2, ret, hb2, &key2, &pi_state);\n\t\t}\n\n\t\tswitch (ret) {\n\t\tcase 0:\n\t\t\t/* We hold a reference on the pi state. */\n\t\t\tbreak;\n\n\t\t\t/* If the above failed, then pi_state is NULL */\n\t\tcase -EFAULT:\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tret = fault_in_user_writeable(uaddr2);\n\t\t\tif (!ret)\n\t\t\t\tgoto retry;\n\t\t\tgoto out;\n\t\tcase -EAGAIN:\n\t\t\t/*\n\t\t\t * Two reasons for this:\n\t\t\t * - Owner is exiting and we just wait for the\n\t\t\t * exit to complete.\n\t\t\t * - The user space value changed.\n\t\t\t */\n\t\t\tdouble_unlock_hb(hb1, hb2);\n\t\t\thb_waiters_dec(hb2);\n\t\t\tput_futex_key(&key2);\n\t\t\tput_futex_key(&key1);\n\t\t\tcond_resched();\n\t\t\tgoto retry;\n\t\tdefault:\n\t\t\tgoto out_unlock;\n\t\t}\n\t}\n\n\tplist_for_each_entry_safe(this, next, &hb1->chain, list) {\n\t\tif (task_count - nr_wake >= nr_requeue)\n\t\t\tbreak;\n\n\t\tif (!match_futex(&this->key, &key1))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always\n\t\t * be paired with each other and no other futex ops.\n\t\t *\n\t\t * We should never be requeueing a futex_q with a pi_state,\n\t\t * which is awaiting a futex_unlock_pi().\n\t\t */\n\t\tif ((requeue_pi && !this->rt_waiter) ||\n\t\t (!requeue_pi && this->rt_waiter) ||\n\t\t this->pi_state) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * Wake nr_wake waiters. For requeue_pi, if we acquired the\n\t\t * lock, we already woke the top_waiter. If not, it will be\n\t\t * woken by futex_unlock_pi().\n\t\t */\n\t\tif (++task_count <= nr_wake && !requeue_pi) {\n\t\t\tmark_wake_futex(&wake_q, this);\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Ensure we requeue to the expected futex for requeue_pi. */\n\t\tif (requeue_pi && !match_futex(this->requeue_pi_key, &key2)) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * Requeue nr_requeue waiters and possibly one more in the case\n\t\t * of requeue_pi if we couldn't acquire the lock atomically.\n\t\t */\n\t\tif (requeue_pi) {\n\t\t\t/*\n\t\t\t * Prepare the waiter to take the rt_mutex. Take a\n\t\t\t * refcount on the pi_state and store the pointer in\n\t\t\t * the futex_q object of the waiter.\n\t\t\t */\n\t\t\tget_pi_state(pi_state);\n\t\t\tthis->pi_state = pi_state;\n\t\t\tret = rt_mutex_start_proxy_lock(&pi_state->pi_mutex,\n\t\t\t\t\t\t\tthis->rt_waiter,\n\t\t\t\t\t\t\tthis->task);\n\t\t\tif (ret == 1) {\n\t\t\t\t/*\n\t\t\t\t * We got the lock. We do neither drop the\n\t\t\t\t * refcount on pi_state nor clear\n\t\t\t\t * this->pi_state because the waiter needs the\n\t\t\t\t * pi_state for cleaning up the user space\n\t\t\t\t * value. It will drop the refcount after\n\t\t\t\t * doing so.\n\t\t\t\t */\n\t\t\t\trequeue_pi_wake_futex(this, &key2, hb2);\n\t\t\t\tdrop_count++;\n\t\t\t\tcontinue;\n\t\t\t} else if (ret) {\n\t\t\t\t/*\n\t\t\t\t * rt_mutex_start_proxy_lock() detected a\n\t\t\t\t * potential deadlock when we tried to queue\n\t\t\t\t * that waiter. Drop the pi_state reference\n\t\t\t\t * which we took above and remove the pointer\n\t\t\t\t * to the state from the waiters futex_q\n\t\t\t\t * object.\n\t\t\t\t */\n\t\t\t\tthis->pi_state = NULL;\n\t\t\t\tput_pi_state(pi_state);\n\t\t\t\t/*\n\t\t\t\t * We stop queueing more waiters and let user\n\t\t\t\t * space deal with the mess.\n\t\t\t\t */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\trequeue_futex(this, hb1, hb2, &key2);\n\t\tdrop_count++;\n\t}\n\n\t/*\n\t * We took an extra initial reference to the pi_state either\n\t * in futex_proxy_trylock_atomic() or in lookup_pi_state(). We\n\t * need to drop it here again.\n\t */\n\tput_pi_state(pi_state);\n\nout_unlock:\n\tdouble_unlock_hb(hb1, hb2);\n\twake_up_q(&wake_q);\n\thb_waiters_dec(hb2);\n\n\t/*\n\t * drop_futex_key_refs() must be called outside the spinlocks. During\n\t * the requeue we moved futex_q's from the hash bucket at key1 to the\n\t * one at key2 and updated their key pointer. We no longer need to\n\t * hold the references to key1.\n\t */\n\twhile (--drop_count >= 0)\n\t\tdrop_futex_key_refs(&key1);\n\nout_put_keys:\n\tput_futex_key(&key2);\nout_put_key1:\n\tput_futex_key(&key1);\nout:\n\treturn ret ? ret : task_count;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"futex_requeue","file_name":"kernel/futex.c","commit_link":"github.com/torvalds/linux/commit/fbe0e839d1e22d88810f3ee3e2f1479be4c0aa4a","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#2-8f341a600992","input":"static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, int *fmt, int *ncx, int *ncy, t_chunk_info ** chunkIdx)\n{\n\tint i;\n\tint ch;\n\tchar id[5];\n\tt_chunk_info *cidx;\n\tint sidx;\n\tint nc;\n\n\tGD2_DBG(php_gd_error(\"Reading gd2 header info\"));\n\n\tfor (i = 0; i < 4; i++) {\n\t\tch = gdGetC(in);\n\t\tif (ch == EOF) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tid[i] = ch;\n\t}\n\tid[4] = 0;\n\n\tGD2_DBG(php_gd_error(\"Got file code: %s\", id));\n\n\t/* Equiv. of 'magick'. */\n\tif (strcmp(id, GD2_ID) != 0) {\n\t\tGD2_DBG(php_gd_error(\"Not a valid gd2 file\"));\n\t\tgoto fail1;\n\t}\n\n\t/* Version */\n\tif (gdGetWord(vers, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Version: %d\", *vers));\n\n\tif ((*vers != 1) && (*vers != 2)) {\n\t\tGD2_DBG(php_gd_error(\"Bad version: %d\", *vers));\n\t\tgoto fail1;\n\t}\n\n\t/* Image Size */\n\tif (!gdGetWord(sx, in)) {\n\t\tGD2_DBG(php_gd_error(\"Could not get x-size\"));\n\t\tgoto fail1;\n\t}\n\tif (!gdGetWord(sy, in)) {\n\t\tGD2_DBG(php_gd_error(\"Could not get y-size\"));\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Image is %dx%d\", *sx, *sy));\n\n\t/* Chunk Size (pixels, not bytes!) */\n\tif (gdGetWord(cs, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"ChunkSize: %d\", *cs));\n\n\tif ((*cs < GD2_CHUNKSIZE_MIN) || (*cs > GD2_CHUNKSIZE_MAX)) {\n\t\tGD2_DBG(php_gd_error(\"Bad chunk size: %d\", *cs));\n\t\tgoto fail1;\n\t}\n\n\t/* Data Format */\n\tif (gdGetWord(fmt, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Format: %d\", *fmt));\n\n\tif ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED) && (*fmt != GD2_FMT_TRUECOLOR_RAW) && (*fmt != GD2_FMT_TRUECOLOR_COMPRESSED)) {\n\t\tGD2_DBG(php_gd_error(\"Bad data format: %d\", *fmt));\n\t\tgoto fail1;\n\t}\n\n\t/* # of chunks wide */\n\tif (gdGetWord(ncx, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"%d Chunks Wide\", *ncx));\n\n\t/* # of chunks high */\n\tif (gdGetWord(ncy, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"%d Chunks vertically\", *ncy));\n\n\tif (gd2_compressed(*fmt)) {\n\t\tnc = (*ncx) * (*ncy);\n\t\tGD2_DBG(php_gd_error(\"Reading %d chunk index entries\", nc));\n\t\tsidx = sizeof(t_chunk_info) * nc;\n\t\tif (sidx <= 0) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tcidx = gdCalloc(sidx, 1);\n\t\tfor (i = 0; i < nc; i++) {\n\t\t\tif (gdGetInt(&cidx[i].offset, in) != 1) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t\tif (gdGetInt(&cidx[i].size, in) != 1) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t\tif (cidx[i].offset < 0 || cidx[i].size < 0) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t}\n\t\t*chunkIdx = cidx;\n\t}\n\n\tGD2_DBG(php_gd_error(\"gd2 header complete\"));\n\n\treturn 1;\n\nfail1:\n\treturn 0;\n}","target":"static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, int *fmt, int *ncx, int *ncy, t_chunk_info ** chunkIdx)\n{\n\tint i;\n\tint ch;\n\tchar id[5];\n\tt_chunk_info *cidx;\n\tint sidx;\n\tint nc;\n\n\tGD2_DBG(php_gd_error(\"Reading gd2 header info\"));\n\n\tfor (i = 0; i < 4; i++) {\n\t\tch = gdGetC(in);\n\t\tif (ch == EOF) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tid[i] = ch;\n\t}\n\tid[4] = 0;\n\n\tGD2_DBG(php_gd_error(\"Got file code: %s\", id));\n\n\t/* Equiv. of 'magick'. */\n\tif (strcmp(id, GD2_ID) != 0) {\n\t\tGD2_DBG(php_gd_error(\"Not a valid gd2 file\"));\n\t\tgoto fail1;\n\t}\n\n\t/* Version */\n\tif (gdGetWord(vers, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Version: %d\", *vers));\n\n\tif ((*vers != 1) && (*vers != 2)) {\n\t\tGD2_DBG(php_gd_error(\"Bad version: %d\", *vers));\n\t\tgoto fail1;\n\t}\n\n\t/* Image Size */\n\tif (!gdGetWord(sx, in)) {\n\t\tGD2_DBG(php_gd_error(\"Could not get x-size\"));\n\t\tgoto fail1;\n\t}\n\tif (!gdGetWord(sy, in)) {\n\t\tGD2_DBG(php_gd_error(\"Could not get y-size\"));\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Image is %dx%d\", *sx, *sy));\n\n\t/* Chunk Size (pixels, not bytes!) */\n\tif (gdGetWord(cs, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"ChunkSize: %d\", *cs));\n\n\tif ((*cs < GD2_CHUNKSIZE_MIN) || (*cs > GD2_CHUNKSIZE_MAX)) {\n\t\tGD2_DBG(php_gd_error(\"Bad chunk size: %d\", *cs));\n\t\tgoto fail1;\n\t}\n\n\t/* Data Format */\n\tif (gdGetWord(fmt, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"Format: %d\", *fmt));\n\n\tif ((*fmt != GD2_FMT_RAW) && (*fmt != GD2_FMT_COMPRESSED) && (*fmt != GD2_FMT_TRUECOLOR_RAW) && (*fmt != GD2_FMT_TRUECOLOR_COMPRESSED)) {\n\t\tGD2_DBG(php_gd_error(\"Bad data format: %d\", *fmt));\n\t\tgoto fail1;\n\t}\n\n\t/* # of chunks wide */\n\tif (gdGetWord(ncx, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"%d Chunks Wide\", *ncx));\n\n\t/* # of chunks high */\n\tif (gdGetWord(ncy, in) != 1) {\n\t\tgoto fail1;\n\t}\n\tGD2_DBG(php_gd_error(\"%d Chunks vertically\", *ncy));\n\n\tif (gd2_compressed(*fmt)) {\n\t\tnc = (*ncx) * (*ncy);\n\t\tGD2_DBG(php_gd_error(\"Reading %d chunk index entries\", nc));\n\t\tif (overflow2(sidx, nc)) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tsidx = sizeof(t_chunk_info) * nc;\n\t\tif (sidx <= 0) {\n\t\t\tgoto fail1;\n\t\t}\n\t\tcidx = gdCalloc(sidx, 1);\n\t\tif (cidx == NULL) {\n\t\t\tgoto fail1;\n\t\t}\n\n\t\tfor (i = 0; i < nc; i++) {\n\t\t\tif (gdGetInt(&cidx[i].offset, in) != 1) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t\tif (gdGetInt(&cidx[i].size, in) != 1) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t\tif (cidx[i].offset < 0 || cidx[i].size < 0) {\n\t\t\t\tgdFree(cidx);\n\t\t\t\tgoto fail1;\n\t\t\t}\n\t\t}\n\t\t*chunkIdx = cidx;\n\t}\n\n\tGD2_DBG(php_gd_error(\"gd2 header complete\"));\n\n\treturn 1;\n\nfail1:\n\treturn 0;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"_gd2GetHeader","file_name":"ext/gd/libgd/gd_gd2.c","commit_link":"github.com/php/php-src/commit/7722455726bec8c53458a32851d2a87982cf0eac","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#3-00b7d721271b","input":"static int jpc_pi_nextcprl(register jpc_pi_t *pi)\n{\n\tint rlvlno;\n\tjpc_pirlvl_t *pirlvl;\n\tjpc_pchg_t *pchg;\n\tint prchind;\n\tint prcvind;\n\tint *prclyrno;\n\tuint_fast32_t trx0;\n\tuint_fast32_t try0;\n\tuint_fast32_t r;\n\tuint_fast32_t rpx;\n\tuint_fast32_t rpy;\n\n\tpchg = pi->pchg;\n\tif (!pi->prgvolfirst) {\n\t\tgoto skip;\n\t} else {\n\t\tpi->prgvolfirst = 0;\n\t}\n\n\tfor (pi->compno = pchg->compnostart, pi->picomp =\n\t &pi->picomps[pi->compno]; pi->compno < JAS_CAST(int, pchg->compnoend) && pi->compno < pi->numcomps; ++pi->compno,\n\t ++pi->picomp) {\n\t\tpirlvl = pi->picomp->pirlvls;\n\t\tpi->xstep = pi->picomp->hsamp * (1 << (pirlvl->prcwidthexpn +\n\t\t pi->picomp->numrlvls - 1));\n\t\tpi->ystep = pi->picomp->vsamp * (1 << (pirlvl->prcheightexpn +\n\t\t pi->picomp->numrlvls - 1));\n\t\tfor (rlvlno = 1, pirlvl = &pi->picomp->pirlvls[1];\n\t\t rlvlno < pi->picomp->numrlvls; ++rlvlno, ++pirlvl) {\n\t\t\tpi->xstep = JAS_MIN(pi->xstep, pi->picomp->hsamp * (1 <<\n\t\t\t (pirlvl->prcwidthexpn + pi->picomp->numrlvls -\n\t\t\t rlvlno - 1)));\n\t\t\tpi->ystep = JAS_MIN(pi->ystep, pi->picomp->vsamp * (1 <<\n\t\t\t (pirlvl->prcheightexpn + pi->picomp->numrlvls -\n\t\t\t rlvlno - 1)));\n\t\t}\n\t\tfor (pi->y = pi->ystart; pi->y < pi->yend;\n\t\t pi->y += pi->ystep - (pi->y % pi->ystep)) {\n\t\t\tfor (pi->x = pi->xstart; pi->x < pi->xend;\n\t\t\t pi->x += pi->xstep - (pi->x % pi->xstep)) {\n\t\t\t\tfor (pi->rlvlno = pchg->rlvlnostart,\n\t\t\t\t pi->pirlvl = &pi->picomp->pirlvls[pi->rlvlno];\n\t\t\t\t pi->rlvlno < pi->picomp->numrlvls && pi->rlvlno <\n\t\t\t\t pchg->rlvlnoend; ++pi->rlvlno, ++pi->pirlvl) {\n\t\t\t\t\tif (pi->pirlvl->numprcs == 0) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tr = pi->picomp->numrlvls - 1 - pi->rlvlno;\n\t\t\t\t\ttrx0 = JPC_CEILDIV(pi->xstart, pi->picomp->hsamp << r);\n\t\t\t\t\ttry0 = JPC_CEILDIV(pi->ystart, pi->picomp->vsamp << r);\n\t\t\t\t\trpx = r + pi->pirlvl->prcwidthexpn;\n\t\t\t\t\trpy = r + pi->pirlvl->prcheightexpn;\n\t\t\t\t\tif (((pi->x == pi->xstart && ((trx0 << r) % (1 << rpx))) ||\n\t\t\t\t\t !(pi->x % (pi->picomp->hsamp << rpx))) &&\n\t\t\t\t\t ((pi->y == pi->ystart && ((try0 << r) % (1 << rpy))) ||\n\t\t\t\t\t !(pi->y % (pi->picomp->vsamp << rpy)))) {\n\t\t\t\t\t\tprchind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->x, pi->picomp->hsamp\n\t\t\t\t\t\t << r), pi->pirlvl->prcwidthexpn) - JPC_FLOORDIVPOW2(trx0,\n\t\t\t\t\t\t pi->pirlvl->prcwidthexpn);\n\t\t\t\t\t\tprcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y, pi->picomp->vsamp\n\t\t\t\t\t\t << r), pi->pirlvl->prcheightexpn) - JPC_FLOORDIVPOW2(try0,\n\t\t\t\t\t\t pi->pirlvl->prcheightexpn);\n\t\t\t\t\t\tpi->prcno = prcvind *\n\t\t\t\t\t\t pi->pirlvl->numhprcs +\n\t\t\t\t\t\t prchind;\n\t\t\t\t\t\tassert(pi->prcno <\n\t\t\t\t\t\t pi->pirlvl->numprcs);\n\t\t\t\t\t\tfor (pi->lyrno = 0; pi->lyrno <\n\t\t\t\t\t\t pi->numlyrs && pi->lyrno < JAS_CAST(int, pchg->lyrnoend); ++pi->lyrno) {\n\t\t\t\t\t\t\tprclyrno = &pi->pirlvl->prclyrnos[pi->prcno];\n\t\t\t\t\t\t\tif (pi->lyrno >= *prclyrno) {\n\t\t\t\t\t\t\t\t++(*prclyrno);\n\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t}\nskip:\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 1;\n}","target":"static int jpc_pi_nextcprl(register jpc_pi_t *pi)\n{\n\tint rlvlno;\n\tjpc_pirlvl_t *pirlvl;\n\tjpc_pchg_t *pchg;\n\tint prchind;\n\tint prcvind;\n\tint *prclyrno;\n\tuint_fast32_t trx0;\n\tuint_fast32_t try0;\n\tuint_fast32_t r;\n\tuint_fast32_t rpx;\n\tuint_fast32_t rpy;\n\n\tpchg = pi->pchg;\n\tif (!pi->prgvolfirst) {\n\t\tgoto skip;\n\t} else {\n\t\tpi->prgvolfirst = 0;\n\t}\n\n\tfor (pi->compno = pchg->compnostart, pi->picomp =\n\t &pi->picomps[pi->compno]; pi->compno < JAS_CAST(int, pchg->compnoend) && pi->compno < pi->numcomps; ++pi->compno,\n\t ++pi->picomp) {\n\t\tpirlvl = pi->picomp->pirlvls;\n\t\tpi->xstep = pi->picomp->hsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t (pirlvl->prcwidthexpn + pi->picomp->numrlvls - 1));\n\t\tpi->ystep = pi->picomp->vsamp * (JAS_CAST(uint_fast32_t, 1) <<\n\t\t (pirlvl->prcheightexpn + pi->picomp->numrlvls - 1));\n\t\tfor (rlvlno = 1, pirlvl = &pi->picomp->pirlvls[1];\n\t\t rlvlno < pi->picomp->numrlvls; ++rlvlno, ++pirlvl) {\n\t\t\tpi->xstep = JAS_MIN(pi->xstep, pi->picomp->hsamp *\n\t\t\t (JAS_CAST(uint_fast32_t, 1) << (pirlvl->prcwidthexpn +\n\t\t\t pi->picomp->numrlvls - rlvlno - 1)));\n\t\t\tpi->ystep = JAS_MIN(pi->ystep, pi->picomp->vsamp *\n\t\t\t (JAS_CAST(uint_fast32_t, 1) << (pirlvl->prcheightexpn +\n\t\t\t pi->picomp->numrlvls - rlvlno - 1)));\n\t\t}\n\t\tfor (pi->y = pi->ystart; pi->y < pi->yend;\n\t\t pi->y += pi->ystep - (pi->y % pi->ystep)) {\n\t\t\tfor (pi->x = pi->xstart; pi->x < pi->xend;\n\t\t\t pi->x += pi->xstep - (pi->x % pi->xstep)) {\n\t\t\t\tfor (pi->rlvlno = pchg->rlvlnostart,\n\t\t\t\t pi->pirlvl = &pi->picomp->pirlvls[pi->rlvlno];\n\t\t\t\t pi->rlvlno < pi->picomp->numrlvls && pi->rlvlno <\n\t\t\t\t pchg->rlvlnoend; ++pi->rlvlno, ++pi->pirlvl) {\n\t\t\t\t\tif (pi->pirlvl->numprcs == 0) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tr = pi->picomp->numrlvls - 1 - pi->rlvlno;\n\t\t\t\t\ttrx0 = JPC_CEILDIV(pi->xstart, pi->picomp->hsamp << r);\n\t\t\t\t\ttry0 = JPC_CEILDIV(pi->ystart, pi->picomp->vsamp << r);\n\t\t\t\t\trpx = r + pi->pirlvl->prcwidthexpn;\n\t\t\t\t\trpy = r + pi->pirlvl->prcheightexpn;\n\t\t\t\t\tif (((pi->x == pi->xstart && ((trx0 << r) % (1 << rpx))) ||\n\t\t\t\t\t !(pi->x % (pi->picomp->hsamp << rpx))) &&\n\t\t\t\t\t ((pi->y == pi->ystart && ((try0 << r) % (1 << rpy))) ||\n\t\t\t\t\t !(pi->y % (pi->picomp->vsamp << rpy)))) {\n\t\t\t\t\t\tprchind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->x, pi->picomp->hsamp\n\t\t\t\t\t\t << r), pi->pirlvl->prcwidthexpn) - JPC_FLOORDIVPOW2(trx0,\n\t\t\t\t\t\t pi->pirlvl->prcwidthexpn);\n\t\t\t\t\t\tprcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y, pi->picomp->vsamp\n\t\t\t\t\t\t << r), pi->pirlvl->prcheightexpn) - JPC_FLOORDIVPOW2(try0,\n\t\t\t\t\t\t pi->pirlvl->prcheightexpn);\n\t\t\t\t\t\tpi->prcno = prcvind *\n\t\t\t\t\t\t pi->pirlvl->numhprcs +\n\t\t\t\t\t\t prchind;\n\t\t\t\t\t\tassert(pi->prcno <\n\t\t\t\t\t\t pi->pirlvl->numprcs);\n\t\t\t\t\t\tfor (pi->lyrno = 0; pi->lyrno <\n\t\t\t\t\t\t pi->numlyrs && pi->lyrno < JAS_CAST(int, pchg->lyrnoend); ++pi->lyrno) {\n\t\t\t\t\t\t\tprclyrno = &pi->pirlvl->prclyrnos[pi->prcno];\n\t\t\t\t\t\t\tif (pi->lyrno >= *prclyrno) {\n\t\t\t\t\t\t\t\t++(*prclyrno);\n\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t}\nskip:\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 1;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"jpc_pi_nextcprl","file_name":"src/libjasper/jpc/jpc_t2cod.c","commit_link":"github.com/mdadams/jasper/commit/1f0dfe5a42911b6880a1445f13f6d615ddb55387","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#4-78c452b20932","input":"static inline void process_get_command(conn *c, token_t *tokens, size_t ntokens, bool return_cas) {\n char *key;\n size_t nkey;\n int i = 0;\n item *it;\n token_t *key_token = &tokens[KEY_TOKEN];\n char *suffix;\n assert(c != NULL);\n\n do {\n while(key_token->length != 0) {\n\n key = key_token->value;\n nkey = key_token->length;\n\n if(nkey > KEY_MAX_LENGTH) {\n out_string(c, \"CLIENT_ERROR bad command line format\");\n while (i-- > 0) {\n item_remove(*(c->ilist + i));\n }\n return;\n }\n\n it = item_get(key, nkey, c, DO_UPDATE);\n if (settings.detail_enabled) {\n stats_prefix_record_get(key, nkey, NULL != it);\n }\n if (it) {\n if (i >= c->isize) {\n item **new_list = realloc(c->ilist, sizeof(item *) * c->isize * 2);\n if (new_list) {\n c->isize *= 2;\n c->ilist = new_list;\n } else {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n item_remove(it);\n break;\n }\n }\n\n /*\n * Construct the response. Each hit adds three elements to the\n * outgoing data list:\n * \"VALUE \"\n * key\n * \" \" + flags + \" \" + data length + \"\\r\\n\" + data (with \\r\\n)\n */\n\n if (return_cas || !settings.inline_ascii_response)\n {\n MEMCACHED_COMMAND_GET(c->sfd, ITEM_key(it), it->nkey,\n it->nbytes, ITEM_get_cas(it));\n /* Goofy mid-flight realloc. */\n if (i >= c->suffixsize) {\n char **new_suffix_list = realloc(c->suffixlist,\n sizeof(char *) * c->suffixsize * 2);\n if (new_suffix_list) {\n c->suffixsize *= 2;\n c->suffixlist = new_suffix_list;\n } else {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n item_remove(it);\n break;\n }\n }\n\n suffix = do_cache_alloc(c->thread->suffix_cache);\n if (suffix == NULL) {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n out_of_memory(c, \"SERVER_ERROR out of memory making CAS suffix\");\n item_remove(it);\n while (i-- > 0) {\n item_remove(*(c->ilist + i));\n }\n return;\n }\n *(c->suffixlist + i) = suffix;\n int suffix_len = make_ascii_get_suffix(suffix, it, return_cas);\n if (add_iov(c, \"VALUE \", 6) != 0 ||\n add_iov(c, ITEM_key(it), it->nkey) != 0 ||\n (settings.inline_ascii_response && add_iov(c, ITEM_suffix(it), it->nsuffix - 2) != 0) ||\n add_iov(c, suffix, suffix_len) != 0)\n {\n item_remove(it);\n break;\n }\n if ((it->it_flags & ITEM_CHUNKED) == 0) {\n add_iov(c, ITEM_data(it), it->nbytes);\n } else if (add_chunked_item_iovs(c, it, it->nbytes) != 0) {\n item_remove(it);\n break;\n }\n }\n else\n {\n MEMCACHED_COMMAND_GET(c->sfd, ITEM_key(it), it->nkey,\n it->nbytes, ITEM_get_cas(it));\n if (add_iov(c, \"VALUE \", 6) != 0 ||\n add_iov(c, ITEM_key(it), it->nkey) != 0)\n {\n item_remove(it);\n break;\n }\n if ((it->it_flags & ITEM_CHUNKED) == 0)\n {\n if (add_iov(c, ITEM_suffix(it), it->nsuffix + it->nbytes) != 0)\n {\n item_remove(it);\n break;\n }\n } else if (add_iov(c, ITEM_suffix(it), it->nsuffix) != 0 ||\n add_chunked_item_iovs(c, it, it->nbytes) != 0) {\n item_remove(it);\n break;\n }\n }\n\n\n if (settings.verbose > 1) {\n int ii;\n fprintf(stderr, \">%d sending key \", c->sfd);\n for (ii = 0; ii < it->nkey; ++ii) {\n fprintf(stderr, \"%c\", key[ii]);\n }\n fprintf(stderr, \"\\n\");\n }\n\n /* item_get() has incremented it->refcount for us */\n pthread_mutex_lock(&c->thread->stats.mutex);\n c->thread->stats.slab_stats[ITEM_clsid(it)].get_hits++;\n c->thread->stats.get_cmds++;\n pthread_mutex_unlock(&c->thread->stats.mutex);\n *(c->ilist + i) = it;\n i++;\n\n } else {\n pthread_mutex_lock(&c->thread->stats.mutex);\n c->thread->stats.get_misses++;\n c->thread->stats.get_cmds++;\n pthread_mutex_unlock(&c->thread->stats.mutex);\n MEMCACHED_COMMAND_GET(c->sfd, key, nkey, -1, 0);\n }\n\n key_token++;\n }\n\n /*\n * If the command string hasn't been fully processed, get the next set\n * of tokens.\n */\n if(key_token->value != NULL) {\n ntokens = tokenize_command(key_token->value, tokens, MAX_TOKENS);\n key_token = tokens;\n }\n\n } while(key_token->value != NULL);\n\n c->icurr = c->ilist;\n c->ileft = i;\n if (return_cas || !settings.inline_ascii_response) {\n c->suffixcurr = c->suffixlist;\n c->suffixleft = i;\n }\n\n if (settings.verbose > 1)\n fprintf(stderr, \">%d END\\n\", c->sfd);\n\n /*\n If the loop was terminated because of out-of-memory, it is not\n reliable to add END\\r\\n to the buffer, because it might not end\n in \\r\\n. So we send SERVER_ERROR instead.\n */\n if (key_token->value != NULL || add_iov(c, \"END\\r\\n\", 5) != 0\n || (IS_UDP(c->transport) && build_udp_headers(c) != 0)) {\n out_of_memory(c, \"SERVER_ERROR out of memory writing get response\");\n }\n else {\n conn_set_state(c, conn_mwrite);\n c->msgcurr = 0;\n }\n}","target":"static inline void process_get_command(conn *c, token_t *tokens, size_t ntokens, bool return_cas) {\n char *key;\n size_t nkey;\n int i = 0;\n item *it;\n token_t *key_token = &tokens[KEY_TOKEN];\n char *suffix;\n assert(c != NULL);\n\n do {\n while(key_token->length != 0) {\n\n key = key_token->value;\n nkey = key_token->length;\n\n if(nkey > KEY_MAX_LENGTH) {\n out_string(c, \"CLIENT_ERROR bad command line format\");\n while (i-- > 0) {\n item_remove(*(c->ilist + i));\n }\n return;\n }\n\n it = limited_get(key, nkey, c);\n if (settings.detail_enabled) {\n stats_prefix_record_get(key, nkey, NULL != it);\n }\n if (it) {\n if (i >= c->isize) {\n item **new_list = realloc(c->ilist, sizeof(item *) * c->isize * 2);\n if (new_list) {\n c->isize *= 2;\n c->ilist = new_list;\n } else {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n item_remove(it);\n break;\n }\n }\n\n /*\n * Construct the response. Each hit adds three elements to the\n * outgoing data list:\n * \"VALUE \"\n * key\n * \" \" + flags + \" \" + data length + \"\\r\\n\" + data (with \\r\\n)\n */\n\n if (return_cas || !settings.inline_ascii_response)\n {\n MEMCACHED_COMMAND_GET(c->sfd, ITEM_key(it), it->nkey,\n it->nbytes, ITEM_get_cas(it));\n /* Goofy mid-flight realloc. */\n if (i >= c->suffixsize) {\n char **new_suffix_list = realloc(c->suffixlist,\n sizeof(char *) * c->suffixsize * 2);\n if (new_suffix_list) {\n c->suffixsize *= 2;\n c->suffixlist = new_suffix_list;\n } else {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n item_remove(it);\n break;\n }\n }\n\n suffix = do_cache_alloc(c->thread->suffix_cache);\n if (suffix == NULL) {\n STATS_LOCK();\n stats.malloc_fails++;\n STATS_UNLOCK();\n out_of_memory(c, \"SERVER_ERROR out of memory making CAS suffix\");\n item_remove(it);\n while (i-- > 0) {\n item_remove(*(c->ilist + i));\n }\n return;\n }\n *(c->suffixlist + i) = suffix;\n int suffix_len = make_ascii_get_suffix(suffix, it, return_cas);\n if (add_iov(c, \"VALUE \", 6) != 0 ||\n add_iov(c, ITEM_key(it), it->nkey) != 0 ||\n (settings.inline_ascii_response && add_iov(c, ITEM_suffix(it), it->nsuffix - 2) != 0) ||\n add_iov(c, suffix, suffix_len) != 0)\n {\n item_remove(it);\n break;\n }\n if ((it->it_flags & ITEM_CHUNKED) == 0) {\n add_iov(c, ITEM_data(it), it->nbytes);\n } else if (add_chunked_item_iovs(c, it, it->nbytes) != 0) {\n item_remove(it);\n break;\n }\n }\n else\n {\n MEMCACHED_COMMAND_GET(c->sfd, ITEM_key(it), it->nkey,\n it->nbytes, ITEM_get_cas(it));\n if (add_iov(c, \"VALUE \", 6) != 0 ||\n add_iov(c, ITEM_key(it), it->nkey) != 0)\n {\n item_remove(it);\n break;\n }\n if ((it->it_flags & ITEM_CHUNKED) == 0)\n {\n if (add_iov(c, ITEM_suffix(it), it->nsuffix + it->nbytes) != 0)\n {\n item_remove(it);\n break;\n }\n } else if (add_iov(c, ITEM_suffix(it), it->nsuffix) != 0 ||\n add_chunked_item_iovs(c, it, it->nbytes) != 0) {\n item_remove(it);\n break;\n }\n }\n\n\n if (settings.verbose > 1) {\n int ii;\n fprintf(stderr, \">%d sending key \", c->sfd);\n for (ii = 0; ii < it->nkey; ++ii) {\n fprintf(stderr, \"%c\", key[ii]);\n }\n fprintf(stderr, \"\\n\");\n }\n\n /* item_get() has incremented it->refcount for us */\n pthread_mutex_lock(&c->thread->stats.mutex);\n c->thread->stats.slab_stats[ITEM_clsid(it)].get_hits++;\n c->thread->stats.get_cmds++;\n pthread_mutex_unlock(&c->thread->stats.mutex);\n *(c->ilist + i) = it;\n i++;\n\n } else {\n pthread_mutex_lock(&c->thread->stats.mutex);\n c->thread->stats.get_misses++;\n c->thread->stats.get_cmds++;\n pthread_mutex_unlock(&c->thread->stats.mutex);\n MEMCACHED_COMMAND_GET(c->sfd, key, nkey, -1, 0);\n }\n\n key_token++;\n }\n\n /*\n * If the command string hasn't been fully processed, get the next set\n * of tokens.\n */\n if(key_token->value != NULL) {\n ntokens = tokenize_command(key_token->value, tokens, MAX_TOKENS);\n key_token = tokens;\n }\n\n } while(key_token->value != NULL);\n\n c->icurr = c->ilist;\n c->ileft = i;\n if (return_cas || !settings.inline_ascii_response) {\n c->suffixcurr = c->suffixlist;\n c->suffixleft = i;\n }\n\n if (settings.verbose > 1)\n fprintf(stderr, \">%d END\\n\", c->sfd);\n\n /*\n If the loop was terminated because of out-of-memory, it is not\n reliable to add END\\r\\n to the buffer, because it might not end\n in \\r\\n. So we send SERVER_ERROR instead.\n */\n if (key_token->value != NULL || add_iov(c, \"END\\r\\n\", 5) != 0\n || (IS_UDP(c->transport) && build_udp_headers(c) != 0)) {\n out_of_memory(c, \"SERVER_ERROR out of memory writing get response\");\n }\n else {\n conn_set_state(c, conn_mwrite);\n c->msgcurr = 0;\n }\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"process_get_command","file_name":"memcached.c","commit_link":"github.com/memcached/memcached/commit/a8c4a82787b8b6c256d61bd5c42fb7f92d1bae00","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#5-c781f360c33f","input":" long WebPImage::getHeaderOffset(byte *data, long data_size,\n byte *header, long header_size) {\n long pos = -1;\n for (long i=0; i < data_size - header_size; i++) {\n if (memcmp(header, &data[i], header_size) == 0) {\n pos = i;\n break;\n }\n }\n return pos;\n }","target":" long WebPImage::getHeaderOffset(byte* data, long data_size, byte* header, long header_size)\n {\n if (data_size < header_size) { return -1; }\n long pos = -1;\n for (long i=0; i < data_size - header_size; i++) {\n if (memcmp(header, &data[i], header_size) == 0) {\n pos = i;\n break;\n }\n }\n return pos;\n }","lang":"cpp","vul_type":"cwe-190","sven_meta":{"func_name":"Exiv2::WebPImage::getHeaderOffset","file_name":"src/webpimage.cpp","commit_link":"github.com/Exiv2/exiv2/commit/e925bc5addd881543fa503470c8a859e112cca62","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#6-c2a66c3aa481","input":"int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,\n\t\t\tint cpu_id)\n{\n\tstruct ring_buffer_per_cpu *cpu_buffer;\n\tunsigned long nr_pages;\n\tint cpu, err = 0;\n\n\t/*\n\t * Always succeed at resizing a non-existent buffer:\n\t */\n\tif (!buffer)\n\t\treturn size;\n\n\t/* Make sure the requested buffer exists */\n\tif (cpu_id != RING_BUFFER_ALL_CPUS &&\n\t !cpumask_test_cpu(cpu_id, buffer->cpumask))\n\t\treturn size;\n\n\tsize = DIV_ROUND_UP(size, BUF_PAGE_SIZE);\n\tsize *= BUF_PAGE_SIZE;\n\n\t/* we need a minimum of two pages */\n\tif (size < BUF_PAGE_SIZE * 2)\n\t\tsize = BUF_PAGE_SIZE * 2;\n\n\tnr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);\n\n\t/*\n\t * Don't succeed if resizing is disabled, as a reader might be\n\t * manipulating the ring buffer and is expecting a sane state while\n\t * this is true.\n\t */\n\tif (atomic_read(&buffer->resize_disabled))\n\t\treturn -EBUSY;\n\n\t/* prevent another thread from changing buffer sizes */\n\tmutex_lock(&buffer->mutex);\n\n\tif (cpu_id == RING_BUFFER_ALL_CPUS) {\n\t\t/* calculate the pages to update */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\n\t\t\tcpu_buffer->nr_pages_to_update = nr_pages -\n\t\t\t\t\t\t\tcpu_buffer->nr_pages;\n\t\t\t/*\n\t\t\t * nothing more to do for removing pages or no update\n\t\t\t */\n\t\t\tif (cpu_buffer->nr_pages_to_update <= 0)\n\t\t\t\tcontinue;\n\t\t\t/*\n\t\t\t * to add pages, make sure all new pages can be\n\t\t\t * allocated without receiving ENOMEM\n\t\t\t */\n\t\t\tINIT_LIST_HEAD(&cpu_buffer->new_pages);\n\t\t\tif (__rb_allocate_pages(cpu_buffer->nr_pages_to_update,\n\t\t\t\t\t\t&cpu_buffer->new_pages, cpu)) {\n\t\t\t\t/* not enough memory for new pages */\n\t\t\t\terr = -ENOMEM;\n\t\t\t\tgoto out_err;\n\t\t\t}\n\t\t}\n\n\t\tget_online_cpus();\n\t\t/*\n\t\t * Fire off all the required work handlers\n\t\t * We can't schedule on offline CPUs, but it's not necessary\n\t\t * since we can change their buffer sizes without any race.\n\t\t */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\tif (!cpu_buffer->nr_pages_to_update)\n\t\t\t\tcontinue;\n\n\t\t\t/* Can't run something on an offline CPU. */\n\t\t\tif (!cpu_online(cpu)) {\n\t\t\t\trb_update_pages(cpu_buffer);\n\t\t\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\t\t} else {\n\t\t\t\tschedule_work_on(cpu,\n\t\t\t\t\t\t&cpu_buffer->update_pages_work);\n\t\t\t}\n\t\t}\n\n\t\t/* wait for all the updates to complete */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\tif (!cpu_buffer->nr_pages_to_update)\n\t\t\t\tcontinue;\n\n\t\t\tif (cpu_online(cpu))\n\t\t\t\twait_for_completion(&cpu_buffer->update_done);\n\t\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\t}\n\n\t\tput_online_cpus();\n\t} else {\n\t\t/* Make sure this CPU has been intitialized */\n\t\tif (!cpumask_test_cpu(cpu_id, buffer->cpumask))\n\t\t\tgoto out;\n\n\t\tcpu_buffer = buffer->buffers[cpu_id];\n\n\t\tif (nr_pages == cpu_buffer->nr_pages)\n\t\t\tgoto out;\n\n\t\tcpu_buffer->nr_pages_to_update = nr_pages -\n\t\t\t\t\t\tcpu_buffer->nr_pages;\n\n\t\tINIT_LIST_HEAD(&cpu_buffer->new_pages);\n\t\tif (cpu_buffer->nr_pages_to_update > 0 &&\n\t\t\t__rb_allocate_pages(cpu_buffer->nr_pages_to_update,\n\t\t\t\t\t &cpu_buffer->new_pages, cpu_id)) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto out_err;\n\t\t}\n\n\t\tget_online_cpus();\n\n\t\t/* Can't run something on an offline CPU. */\n\t\tif (!cpu_online(cpu_id))\n\t\t\trb_update_pages(cpu_buffer);\n\t\telse {\n\t\t\tschedule_work_on(cpu_id,\n\t\t\t\t\t &cpu_buffer->update_pages_work);\n\t\t\twait_for_completion(&cpu_buffer->update_done);\n\t\t}\n\n\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\tput_online_cpus();\n\t}\n\n out:\n\t/*\n\t * The ring buffer resize can happen with the ring buffer\n\t * enabled, so that the update disturbs the tracing as little\n\t * as possible. But if the buffer is disabled, we do not need\n\t * to worry about that, and we can take the time to verify\n\t * that the buffer is not corrupt.\n\t */\n\tif (atomic_read(&buffer->record_disabled)) {\n\t\tatomic_inc(&buffer->record_disabled);\n\t\t/*\n\t\t * Even though the buffer was disabled, we must make sure\n\t\t * that it is truly disabled before calling rb_check_pages.\n\t\t * There could have been a race between checking\n\t\t * record_disable and incrementing it.\n\t\t */\n\t\tsynchronize_sched();\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\trb_check_pages(cpu_buffer);\n\t\t}\n\t\tatomic_dec(&buffer->record_disabled);\n\t}\n\n\tmutex_unlock(&buffer->mutex);\n\treturn size;\n\n out_err:\n\tfor_each_buffer_cpu(buffer, cpu) {\n\t\tstruct buffer_page *bpage, *tmp;\n\n\t\tcpu_buffer = buffer->buffers[cpu];\n\t\tcpu_buffer->nr_pages_to_update = 0;\n\n\t\tif (list_empty(&cpu_buffer->new_pages))\n\t\t\tcontinue;\n\n\t\tlist_for_each_entry_safe(bpage, tmp, &cpu_buffer->new_pages,\n\t\t\t\t\tlist) {\n\t\t\tlist_del_init(&bpage->list);\n\t\t\tfree_buffer_page(bpage);\n\t\t}\n\t}\n\tmutex_unlock(&buffer->mutex);\n\treturn err;\n}","target":"int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,\n\t\t\tint cpu_id)\n{\n\tstruct ring_buffer_per_cpu *cpu_buffer;\n\tunsigned long nr_pages;\n\tint cpu, err = 0;\n\n\t/*\n\t * Always succeed at resizing a non-existent buffer:\n\t */\n\tif (!buffer)\n\t\treturn size;\n\n\t/* Make sure the requested buffer exists */\n\tif (cpu_id != RING_BUFFER_ALL_CPUS &&\n\t !cpumask_test_cpu(cpu_id, buffer->cpumask))\n\t\treturn size;\n\n\tnr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);\n\n\t/* we need a minimum of two pages */\n\tif (nr_pages < 2)\n\t\tnr_pages = 2;\n\n\tsize = nr_pages * BUF_PAGE_SIZE;\n\n\t/*\n\t * Don't succeed if resizing is disabled, as a reader might be\n\t * manipulating the ring buffer and is expecting a sane state while\n\t * this is true.\n\t */\n\tif (atomic_read(&buffer->resize_disabled))\n\t\treturn -EBUSY;\n\n\t/* prevent another thread from changing buffer sizes */\n\tmutex_lock(&buffer->mutex);\n\n\tif (cpu_id == RING_BUFFER_ALL_CPUS) {\n\t\t/* calculate the pages to update */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\n\t\t\tcpu_buffer->nr_pages_to_update = nr_pages -\n\t\t\t\t\t\t\tcpu_buffer->nr_pages;\n\t\t\t/*\n\t\t\t * nothing more to do for removing pages or no update\n\t\t\t */\n\t\t\tif (cpu_buffer->nr_pages_to_update <= 0)\n\t\t\t\tcontinue;\n\t\t\t/*\n\t\t\t * to add pages, make sure all new pages can be\n\t\t\t * allocated without receiving ENOMEM\n\t\t\t */\n\t\t\tINIT_LIST_HEAD(&cpu_buffer->new_pages);\n\t\t\tif (__rb_allocate_pages(cpu_buffer->nr_pages_to_update,\n\t\t\t\t\t\t&cpu_buffer->new_pages, cpu)) {\n\t\t\t\t/* not enough memory for new pages */\n\t\t\t\terr = -ENOMEM;\n\t\t\t\tgoto out_err;\n\t\t\t}\n\t\t}\n\n\t\tget_online_cpus();\n\t\t/*\n\t\t * Fire off all the required work handlers\n\t\t * We can't schedule on offline CPUs, but it's not necessary\n\t\t * since we can change their buffer sizes without any race.\n\t\t */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\tif (!cpu_buffer->nr_pages_to_update)\n\t\t\t\tcontinue;\n\n\t\t\t/* Can't run something on an offline CPU. */\n\t\t\tif (!cpu_online(cpu)) {\n\t\t\t\trb_update_pages(cpu_buffer);\n\t\t\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\t\t} else {\n\t\t\t\tschedule_work_on(cpu,\n\t\t\t\t\t\t&cpu_buffer->update_pages_work);\n\t\t\t}\n\t\t}\n\n\t\t/* wait for all the updates to complete */\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\tif (!cpu_buffer->nr_pages_to_update)\n\t\t\t\tcontinue;\n\n\t\t\tif (cpu_online(cpu))\n\t\t\t\twait_for_completion(&cpu_buffer->update_done);\n\t\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\t}\n\n\t\tput_online_cpus();\n\t} else {\n\t\t/* Make sure this CPU has been intitialized */\n\t\tif (!cpumask_test_cpu(cpu_id, buffer->cpumask))\n\t\t\tgoto out;\n\n\t\tcpu_buffer = buffer->buffers[cpu_id];\n\n\t\tif (nr_pages == cpu_buffer->nr_pages)\n\t\t\tgoto out;\n\n\t\tcpu_buffer->nr_pages_to_update = nr_pages -\n\t\t\t\t\t\tcpu_buffer->nr_pages;\n\n\t\tINIT_LIST_HEAD(&cpu_buffer->new_pages);\n\t\tif (cpu_buffer->nr_pages_to_update > 0 &&\n\t\t\t__rb_allocate_pages(cpu_buffer->nr_pages_to_update,\n\t\t\t\t\t &cpu_buffer->new_pages, cpu_id)) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto out_err;\n\t\t}\n\n\t\tget_online_cpus();\n\n\t\t/* Can't run something on an offline CPU. */\n\t\tif (!cpu_online(cpu_id))\n\t\t\trb_update_pages(cpu_buffer);\n\t\telse {\n\t\t\tschedule_work_on(cpu_id,\n\t\t\t\t\t &cpu_buffer->update_pages_work);\n\t\t\twait_for_completion(&cpu_buffer->update_done);\n\t\t}\n\n\t\tcpu_buffer->nr_pages_to_update = 0;\n\t\tput_online_cpus();\n\t}\n\n out:\n\t/*\n\t * The ring buffer resize can happen with the ring buffer\n\t * enabled, so that the update disturbs the tracing as little\n\t * as possible. But if the buffer is disabled, we do not need\n\t * to worry about that, and we can take the time to verify\n\t * that the buffer is not corrupt.\n\t */\n\tif (atomic_read(&buffer->record_disabled)) {\n\t\tatomic_inc(&buffer->record_disabled);\n\t\t/*\n\t\t * Even though the buffer was disabled, we must make sure\n\t\t * that it is truly disabled before calling rb_check_pages.\n\t\t * There could have been a race between checking\n\t\t * record_disable and incrementing it.\n\t\t */\n\t\tsynchronize_sched();\n\t\tfor_each_buffer_cpu(buffer, cpu) {\n\t\t\tcpu_buffer = buffer->buffers[cpu];\n\t\t\trb_check_pages(cpu_buffer);\n\t\t}\n\t\tatomic_dec(&buffer->record_disabled);\n\t}\n\n\tmutex_unlock(&buffer->mutex);\n\treturn size;\n\n out_err:\n\tfor_each_buffer_cpu(buffer, cpu) {\n\t\tstruct buffer_page *bpage, *tmp;\n\n\t\tcpu_buffer = buffer->buffers[cpu];\n\t\tcpu_buffer->nr_pages_to_update = 0;\n\n\t\tif (list_empty(&cpu_buffer->new_pages))\n\t\t\tcontinue;\n\n\t\tlist_for_each_entry_safe(bpage, tmp, &cpu_buffer->new_pages,\n\t\t\t\t\tlist) {\n\t\t\tlist_del_init(&bpage->list);\n\t\t\tfree_buffer_page(bpage);\n\t\t}\n\t}\n\tmutex_unlock(&buffer->mutex);\n\treturn err;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"ring_buffer_resize","file_name":"kernel/trace/ring_buffer.c","commit_link":"github.com/torvalds/linux/commit/59643d1535eb220668692a5359de22545af579f6","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#7-9f59655978f4","input":"static pngquant_error rwpng_read_image24_libpng(FILE *infile, png24_image *mainprog_ptr, int verbose)\n{\n png_structp png_ptr = NULL;\n png_infop info_ptr = NULL;\n png_size_t rowbytes;\n int color_type, bit_depth;\n\n png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr,\n rwpng_error_handler, verbose ? rwpng_warning_stderr_handler : rwpng_warning_silent_handler);\n if (!png_ptr) {\n return PNG_OUT_OF_MEMORY_ERROR; /* out of memory */\n }\n\n info_ptr = png_create_info_struct(png_ptr);\n if (!info_ptr) {\n png_destroy_read_struct(&png_ptr, NULL, NULL);\n return PNG_OUT_OF_MEMORY_ERROR; /* out of memory */\n }\n\n /* setjmp() must be called in every function that calls a non-trivial\n * libpng function */\n\n if (setjmp(mainprog_ptr->jmpbuf)) {\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return LIBPNG_FATAL_ERROR; /* fatal libpng error (via longjmp()) */\n }\n\n#if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && defined(PNG_SET_OPTION_SUPPORTED)\n png_set_option(png_ptr, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON);\n#endif\n\n#if PNG_LIBPNG_VER >= 10500 && defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)\n /* copy standard chunks too */\n png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_IF_SAFE, (png_const_bytep)\"pHYs\\0iTXt\\0tEXt\\0zTXt\", 4);\n#endif\n png_set_read_user_chunk_fn(png_ptr, &mainprog_ptr->chunks, read_chunk_callback);\n\n struct rwpng_read_data read_data = {infile, 0};\n png_set_read_fn(png_ptr, &read_data, user_read_data);\n\n png_read_info(png_ptr, info_ptr); /* read all PNG info up to image data */\n\n /* alternatively, could make separate calls to png_get_image_width(),\n * etc., but want bit_depth and color_type for later [don't care about\n * compression_type and filter_type => NULLs] */\n\n png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width, &mainprog_ptr->height,\n &bit_depth, &color_type, NULL, NULL, NULL);\n\n // For overflow safety reject images that won't fit in 32-bit\n if (mainprog_ptr->width > INT_MAX/mainprog_ptr->height) {\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return PNG_OUT_OF_MEMORY_ERROR; /* not quite true, but whatever */\n }\n\n /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,\n * transparency chunks to full alpha channel; strip 16-bit-per-sample\n * images to 8 bits per sample; and convert grayscale to RGB[A] */\n\n /* GRR TO DO: preserve all safe-to-copy ancillary PNG chunks */\n\n if (!(color_type & PNG_COLOR_MASK_ALPHA)) {\n#ifdef PNG_READ_FILLER_SUPPORTED\n png_set_expand(png_ptr);\n png_set_filler(png_ptr, 65535L, PNG_FILLER_AFTER);\n#else\n fprintf(stderr, \"pngquant readpng: image is neither RGBA nor GA\\n\");\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n mainprog_ptr->retval = WRONG_INPUT_COLOR_TYPE;\n return mainprog_ptr->retval;\n#endif\n }\n\n if (bit_depth == 16) {\n png_set_strip_16(png_ptr);\n }\n\n if (!(color_type & PNG_COLOR_MASK_COLOR)) {\n png_set_gray_to_rgb(png_ptr);\n }\n\n /* get source gamma for gamma correction, or use sRGB default */\n double gamma = 0.45455;\n if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {\n mainprog_ptr->input_color = RWPNG_SRGB;\n mainprog_ptr->output_color = RWPNG_SRGB;\n } else {\n png_get_gAMA(png_ptr, info_ptr, &gamma);\n if (gamma > 0 && gamma <= 1.0) {\n mainprog_ptr->input_color = RWPNG_GAMA_ONLY;\n mainprog_ptr->output_color = RWPNG_GAMA_ONLY;\n } else {\n fprintf(stderr, \"pngquant readpng: ignored out-of-range gamma %f\\n\", gamma);\n mainprog_ptr->input_color = RWPNG_NONE;\n mainprog_ptr->output_color = RWPNG_NONE;\n gamma = 0.45455;\n }\n }\n mainprog_ptr->gamma = gamma;\n\n png_set_interlace_handling(png_ptr);\n\n /* all transformations have been registered; now update info_ptr data,\n * get rowbytes and channels, and allocate image memory */\n\n png_read_update_info(png_ptr, info_ptr);\n\n rowbytes = png_get_rowbytes(png_ptr, info_ptr);\n\n if ((mainprog_ptr->rgba_data = malloc(rowbytes * mainprog_ptr->height)) == NULL) {\n fprintf(stderr, \"pngquant readpng: unable to allocate image data\\n\");\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return PNG_OUT_OF_MEMORY_ERROR;\n }\n\n png_bytepp row_pointers = rwpng_create_row_pointers(info_ptr, png_ptr, mainprog_ptr->rgba_data, mainprog_ptr->height, 0);\n\n /* now we can go ahead and just read the whole image */\n\n png_read_image(png_ptr, row_pointers);\n\n /* and we're done! (png_read_end() can be omitted if no processing of\n * post-IDAT text/time/etc. is desired) */\n\n png_read_end(png_ptr, NULL);\n\n#if USE_LCMS\n#if PNG_LIBPNG_VER < 10500\n png_charp ProfileData;\n#else\n png_bytep ProfileData;\n#endif\n png_uint_32 ProfileLen;\n\n cmsHPROFILE hInProfile = NULL;\n\n /* color_type is read from the image before conversion to RGBA */\n int COLOR_PNG = color_type & PNG_COLOR_MASK_COLOR;\n\n /* embedded ICC profile */\n if (png_get_iCCP(png_ptr, info_ptr, &(png_charp){0}, &(int){0}, &ProfileData, &ProfileLen)) {\n\n hInProfile = cmsOpenProfileFromMem(ProfileData, ProfileLen);\n cmsColorSpaceSignature colorspace = cmsGetColorSpace(hInProfile);\n\n /* only RGB (and GRAY) valid for PNGs */\n if (colorspace == cmsSigRgbData && COLOR_PNG) {\n mainprog_ptr->input_color = RWPNG_ICCP;\n mainprog_ptr->output_color = RWPNG_SRGB;\n } else {\n if (colorspace == cmsSigGrayData && !COLOR_PNG) {\n mainprog_ptr->input_color = RWPNG_ICCP_WARN_GRAY;\n mainprog_ptr->output_color = RWPNG_SRGB;\n }\n cmsCloseProfile(hInProfile);\n hInProfile = NULL;\n }\n }\n\n /* build RGB profile from cHRM and gAMA */\n if (hInProfile == NULL && COLOR_PNG &&\n !png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB) &&\n png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA) &&\n png_get_valid(png_ptr, info_ptr, PNG_INFO_cHRM)) {\n\n cmsCIExyY WhitePoint;\n cmsCIExyYTRIPLE Primaries;\n\n png_get_cHRM(png_ptr, info_ptr, &WhitePoint.x, &WhitePoint.y,\n &Primaries.Red.x, &Primaries.Red.y,\n &Primaries.Green.x, &Primaries.Green.y,\n &Primaries.Blue.x, &Primaries.Blue.y);\n\n WhitePoint.Y = Primaries.Red.Y = Primaries.Green.Y = Primaries.Blue.Y = 1.0;\n\n cmsToneCurve *GammaTable[3];\n GammaTable[0] = GammaTable[1] = GammaTable[2] = cmsBuildGamma(NULL, 1/gamma);\n\n hInProfile = cmsCreateRGBProfile(&WhitePoint, &Primaries, GammaTable);\n\n cmsFreeToneCurve(GammaTable[0]);\n\n mainprog_ptr->input_color = RWPNG_GAMA_CHRM;\n mainprog_ptr->output_color = RWPNG_SRGB;\n }\n\n /* transform image to sRGB colorspace */\n if (hInProfile != NULL) {\n\n cmsHPROFILE hOutProfile = cmsCreate_sRGBProfile();\n cmsHTRANSFORM hTransform = cmsCreateTransform(hInProfile, TYPE_RGBA_8,\n hOutProfile, TYPE_RGBA_8,\n INTENT_PERCEPTUAL,\n omp_get_max_threads() > 1 ? cmsFLAGS_NOCACHE : 0);\n\n #pragma omp parallel for \\\n if (mainprog_ptr->height*mainprog_ptr->width > 8000) \\\n schedule(static)\n for (unsigned int i = 0; i < mainprog_ptr->height; i++) {\n /* It is safe to use the same block for input and output,\n when both are of the same TYPE. */\n cmsDoTransform(hTransform, row_pointers[i],\n row_pointers[i],\n mainprog_ptr->width);\n }\n\n cmsDeleteTransform(hTransform);\n cmsCloseProfile(hOutProfile);\n cmsCloseProfile(hInProfile);\n\n mainprog_ptr->gamma = 0.45455;\n }\n#endif\n\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n\n mainprog_ptr->file_size = read_data.bytes_read;\n mainprog_ptr->row_pointers = (unsigned char **)row_pointers;\n\n return SUCCESS;\n}","target":"static pngquant_error rwpng_read_image24_libpng(FILE *infile, png24_image *mainprog_ptr, int verbose)\n{\n png_structp png_ptr = NULL;\n png_infop info_ptr = NULL;\n png_size_t rowbytes;\n int color_type, bit_depth;\n\n png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr,\n rwpng_error_handler, verbose ? rwpng_warning_stderr_handler : rwpng_warning_silent_handler);\n if (!png_ptr) {\n return PNG_OUT_OF_MEMORY_ERROR; /* out of memory */\n }\n\n info_ptr = png_create_info_struct(png_ptr);\n if (!info_ptr) {\n png_destroy_read_struct(&png_ptr, NULL, NULL);\n return PNG_OUT_OF_MEMORY_ERROR; /* out of memory */\n }\n\n /* setjmp() must be called in every function that calls a non-trivial\n * libpng function */\n\n if (setjmp(mainprog_ptr->jmpbuf)) {\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return LIBPNG_FATAL_ERROR; /* fatal libpng error (via longjmp()) */\n }\n\n#if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && defined(PNG_SET_OPTION_SUPPORTED)\n png_set_option(png_ptr, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON);\n#endif\n\n#if PNG_LIBPNG_VER >= 10500 && defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)\n /* copy standard chunks too */\n png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_IF_SAFE, (png_const_bytep)\"pHYs\\0iTXt\\0tEXt\\0zTXt\", 4);\n#endif\n png_set_read_user_chunk_fn(png_ptr, &mainprog_ptr->chunks, read_chunk_callback);\n\n struct rwpng_read_data read_data = {infile, 0};\n png_set_read_fn(png_ptr, &read_data, user_read_data);\n\n png_read_info(png_ptr, info_ptr); /* read all PNG info up to image data */\n\n /* alternatively, could make separate calls to png_get_image_width(),\n * etc., but want bit_depth and color_type for later [don't care about\n * compression_type and filter_type => NULLs] */\n\n png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width, &mainprog_ptr->height,\n &bit_depth, &color_type, NULL, NULL, NULL);\n\n /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,\n * transparency chunks to full alpha channel; strip 16-bit-per-sample\n * images to 8 bits per sample; and convert grayscale to RGB[A] */\n\n /* GRR TO DO: preserve all safe-to-copy ancillary PNG chunks */\n\n if (!(color_type & PNG_COLOR_MASK_ALPHA)) {\n#ifdef PNG_READ_FILLER_SUPPORTED\n png_set_expand(png_ptr);\n png_set_filler(png_ptr, 65535L, PNG_FILLER_AFTER);\n#else\n fprintf(stderr, \"pngquant readpng: image is neither RGBA nor GA\\n\");\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n mainprog_ptr->retval = WRONG_INPUT_COLOR_TYPE;\n return mainprog_ptr->retval;\n#endif\n }\n\n if (bit_depth == 16) {\n png_set_strip_16(png_ptr);\n }\n\n if (!(color_type & PNG_COLOR_MASK_COLOR)) {\n png_set_gray_to_rgb(png_ptr);\n }\n\n /* get source gamma for gamma correction, or use sRGB default */\n double gamma = 0.45455;\n if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {\n mainprog_ptr->input_color = RWPNG_SRGB;\n mainprog_ptr->output_color = RWPNG_SRGB;\n } else {\n png_get_gAMA(png_ptr, info_ptr, &gamma);\n if (gamma > 0 && gamma <= 1.0) {\n mainprog_ptr->input_color = RWPNG_GAMA_ONLY;\n mainprog_ptr->output_color = RWPNG_GAMA_ONLY;\n } else {\n fprintf(stderr, \"pngquant readpng: ignored out-of-range gamma %f\\n\", gamma);\n mainprog_ptr->input_color = RWPNG_NONE;\n mainprog_ptr->output_color = RWPNG_NONE;\n gamma = 0.45455;\n }\n }\n mainprog_ptr->gamma = gamma;\n\n png_set_interlace_handling(png_ptr);\n\n /* all transformations have been registered; now update info_ptr data,\n * get rowbytes and channels, and allocate image memory */\n\n png_read_update_info(png_ptr, info_ptr);\n\n rowbytes = png_get_rowbytes(png_ptr, info_ptr);\n\n // For overflow safety reject images that won't fit in 32-bit\n if (rowbytes > INT_MAX/mainprog_ptr->height) {\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return PNG_OUT_OF_MEMORY_ERROR;\n }\n\n if ((mainprog_ptr->rgba_data = malloc(rowbytes * mainprog_ptr->height)) == NULL) {\n fprintf(stderr, \"pngquant readpng: unable to allocate image data\\n\");\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n return PNG_OUT_OF_MEMORY_ERROR;\n }\n\n png_bytepp row_pointers = rwpng_create_row_pointers(info_ptr, png_ptr, mainprog_ptr->rgba_data, mainprog_ptr->height, 0);\n\n /* now we can go ahead and just read the whole image */\n\n png_read_image(png_ptr, row_pointers);\n\n /* and we're done! (png_read_end() can be omitted if no processing of\n * post-IDAT text/time/etc. is desired) */\n\n png_read_end(png_ptr, NULL);\n\n#if USE_LCMS\n#if PNG_LIBPNG_VER < 10500\n png_charp ProfileData;\n#else\n png_bytep ProfileData;\n#endif\n png_uint_32 ProfileLen;\n\n cmsHPROFILE hInProfile = NULL;\n\n /* color_type is read from the image before conversion to RGBA */\n int COLOR_PNG = color_type & PNG_COLOR_MASK_COLOR;\n\n /* embedded ICC profile */\n if (png_get_iCCP(png_ptr, info_ptr, &(png_charp){0}, &(int){0}, &ProfileData, &ProfileLen)) {\n\n hInProfile = cmsOpenProfileFromMem(ProfileData, ProfileLen);\n cmsColorSpaceSignature colorspace = cmsGetColorSpace(hInProfile);\n\n /* only RGB (and GRAY) valid for PNGs */\n if (colorspace == cmsSigRgbData && COLOR_PNG) {\n mainprog_ptr->input_color = RWPNG_ICCP;\n mainprog_ptr->output_color = RWPNG_SRGB;\n } else {\n if (colorspace == cmsSigGrayData && !COLOR_PNG) {\n mainprog_ptr->input_color = RWPNG_ICCP_WARN_GRAY;\n mainprog_ptr->output_color = RWPNG_SRGB;\n }\n cmsCloseProfile(hInProfile);\n hInProfile = NULL;\n }\n }\n\n /* build RGB profile from cHRM and gAMA */\n if (hInProfile == NULL && COLOR_PNG &&\n !png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB) &&\n png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA) &&\n png_get_valid(png_ptr, info_ptr, PNG_INFO_cHRM)) {\n\n cmsCIExyY WhitePoint;\n cmsCIExyYTRIPLE Primaries;\n\n png_get_cHRM(png_ptr, info_ptr, &WhitePoint.x, &WhitePoint.y,\n &Primaries.Red.x, &Primaries.Red.y,\n &Primaries.Green.x, &Primaries.Green.y,\n &Primaries.Blue.x, &Primaries.Blue.y);\n\n WhitePoint.Y = Primaries.Red.Y = Primaries.Green.Y = Primaries.Blue.Y = 1.0;\n\n cmsToneCurve *GammaTable[3];\n GammaTable[0] = GammaTable[1] = GammaTable[2] = cmsBuildGamma(NULL, 1/gamma);\n\n hInProfile = cmsCreateRGBProfile(&WhitePoint, &Primaries, GammaTable);\n\n cmsFreeToneCurve(GammaTable[0]);\n\n mainprog_ptr->input_color = RWPNG_GAMA_CHRM;\n mainprog_ptr->output_color = RWPNG_SRGB;\n }\n\n /* transform image to sRGB colorspace */\n if (hInProfile != NULL) {\n\n cmsHPROFILE hOutProfile = cmsCreate_sRGBProfile();\n cmsHTRANSFORM hTransform = cmsCreateTransform(hInProfile, TYPE_RGBA_8,\n hOutProfile, TYPE_RGBA_8,\n INTENT_PERCEPTUAL,\n omp_get_max_threads() > 1 ? cmsFLAGS_NOCACHE : 0);\n\n #pragma omp parallel for \\\n if (mainprog_ptr->height*mainprog_ptr->width > 8000) \\\n schedule(static)\n for (unsigned int i = 0; i < mainprog_ptr->height; i++) {\n /* It is safe to use the same block for input and output,\n when both are of the same TYPE. */\n cmsDoTransform(hTransform, row_pointers[i],\n row_pointers[i],\n mainprog_ptr->width);\n }\n\n cmsDeleteTransform(hTransform);\n cmsCloseProfile(hOutProfile);\n cmsCloseProfile(hInProfile);\n\n mainprog_ptr->gamma = 0.45455;\n }\n#endif\n\n png_destroy_read_struct(&png_ptr, &info_ptr, NULL);\n\n mainprog_ptr->file_size = read_data.bytes_read;\n mainprog_ptr->row_pointers = (unsigned char **)row_pointers;\n\n return SUCCESS;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"rwpng_read_image24_libpng","file_name":"rwpng.c","commit_link":"github.com/pornel/pngquant/commit/b7c217680cda02dddced245d237ebe8c383be285","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#8-106070f03b78","input":"UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLength) {\n if(!isWritable() || srcLength == 0 || srcChars == NULL) {\n return *this;\n }\n\n // Perform all remaining operations relative to srcChars + srcStart.\n // From this point forward, do not use srcStart.\n srcChars += srcStart;\n\n if(srcLength < 0) {\n // get the srcLength if necessary\n if((srcLength = u_strlen(srcChars)) == 0) {\n return *this;\n }\n }\n\n int32_t oldLength = length();\n int32_t newLength = oldLength + srcLength;\n\n // Check for append onto ourself\n const UChar* oldArray = getArrayStart();\n if (isBufferWritable() &&\n oldArray < srcChars + srcLength &&\n srcChars < oldArray + oldLength) {\n // Copy into a new UnicodeString and start over\n UnicodeString copy(srcChars, srcLength);\n if (copy.isBogus()) {\n setToBogus();\n return *this;\n }\n return doAppend(copy.getArrayStart(), 0, srcLength);\n }\n\n // optimize append() onto a large-enough, owned string\n if((newLength <= getCapacity() && isBufferWritable()) ||\n cloneArrayIfNeeded(newLength, getGrowCapacity(newLength))) {\n UChar *newArray = getArrayStart();\n // Do not copy characters when\n // UChar *buffer=str.getAppendBuffer(...);\n // is followed by\n // str.append(buffer, length);\n // or\n // str.appendString(buffer, length)\n // or similar.\n if(srcChars != newArray + oldLength) {\n us_arrayCopy(srcChars, 0, newArray, oldLength, srcLength);\n }\n setLength(newLength);\n }\n return *this;\n}","target":"UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLength) {\n if(!isWritable() || srcLength == 0 || srcChars == NULL) {\n return *this;\n }\n\n // Perform all remaining operations relative to srcChars + srcStart.\n // From this point forward, do not use srcStart.\n srcChars += srcStart;\n\n if(srcLength < 0) {\n // get the srcLength if necessary\n if((srcLength = u_strlen(srcChars)) == 0) {\n return *this;\n }\n }\n\n int32_t oldLength = length();\n int32_t newLength;\n if (uprv_add32_overflow(oldLength, srcLength, &newLength)) {\n setToBogus();\n return *this;\n }\n\n // Check for append onto ourself\n const UChar* oldArray = getArrayStart();\n if (isBufferWritable() &&\n oldArray < srcChars + srcLength &&\n srcChars < oldArray + oldLength) {\n // Copy into a new UnicodeString and start over\n UnicodeString copy(srcChars, srcLength);\n if (copy.isBogus()) {\n setToBogus();\n return *this;\n }\n return doAppend(copy.getArrayStart(), 0, srcLength);\n }\n\n // optimize append() onto a large-enough, owned string\n if((newLength <= getCapacity() && isBufferWritable()) ||\n cloneArrayIfNeeded(newLength, getGrowCapacity(newLength))) {\n UChar *newArray = getArrayStart();\n // Do not copy characters when\n // UChar *buffer=str.getAppendBuffer(...);\n // is followed by\n // str.append(buffer, length);\n // or\n // str.appendString(buffer, length)\n // or similar.\n if(srcChars != newArray + oldLength) {\n us_arrayCopy(srcChars, 0, newArray, oldLength, srcLength);\n }\n setLength(newLength);\n }\n return *this;\n}","lang":"cpp","vul_type":"cwe-190","sven_meta":{"func_name":"UnicodeString::doAppend","file_name":"icu4c/source/common/unistr.cpp","commit_link":"github.com/unicode-org/icu/commit/b7d08bc04a4296982fcef8b6b8a354a9e4e7afca","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#9-86715854d32a","input":"static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n BMPInfo\n bmp_info;\n\n const char\n *option;\n\n const StringInfo\n *profile;\n\n MagickBooleanType\n have_color_info,\n status;\n\n MagickOffsetType\n scene;\n\n MemoryInfo\n *pixel_info;\n\n register const Quantum\n *p;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *q;\n\n size_t\n bytes_per_line,\n type;\n\n ssize_t\n y;\n\n unsigned char\n *bmp_data,\n *pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n type=4;\n if (LocaleCompare(image_info->magick,\"BMP2\") == 0)\n type=2;\n else\n if (LocaleCompare(image_info->magick,\"BMP3\") == 0)\n type=3;\n\n option=GetImageOption(image_info,\"bmp:format\");\n if (option != (char *) NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Format=%s\",option);\n\n if (LocaleCompare(option,\"bmp2\") == 0)\n type=2;\n if (LocaleCompare(option,\"bmp3\") == 0)\n type=3;\n if (LocaleCompare(option,\"bmp4\") == 0)\n type=4;\n }\n\n scene=0;\n do\n {\n /*\n Initialize BMP raster file header.\n */\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n (void) ResetMagickMemory(&bmp_info,0,sizeof(bmp_info));\n bmp_info.file_size=14+12;\n if (type > 2)\n bmp_info.file_size+=28;\n bmp_info.offset_bits=bmp_info.file_size;\n bmp_info.compression=BI_RGB;\n if ((image->storage_class == PseudoClass) && (image->colors > 256))\n (void) SetImageStorageClass(image,DirectClass,exception);\n if (image->storage_class != DirectClass)\n {\n /*\n Colormapped BMP raster.\n */\n bmp_info.bits_per_pixel=8;\n if (image->colors <= 2)\n bmp_info.bits_per_pixel=1;\n else\n if (image->colors <= 16)\n bmp_info.bits_per_pixel=4;\n else\n if (image->colors <= 256)\n bmp_info.bits_per_pixel=8;\n if (image_info->compression == RLECompression)\n bmp_info.bits_per_pixel=8;\n bmp_info.number_colors=1U << bmp_info.bits_per_pixel;\n if (image->alpha_trait != UndefinedPixelTrait)\n (void) SetImageStorageClass(image,DirectClass,exception);\n else\n if ((size_t) bmp_info.number_colors < image->colors)\n (void) SetImageStorageClass(image,DirectClass,exception);\n else\n {\n bmp_info.file_size+=3*(1UL << bmp_info.bits_per_pixel);\n bmp_info.offset_bits+=3*(1UL << bmp_info.bits_per_pixel);\n if (type > 2)\n {\n bmp_info.file_size+=(1UL << bmp_info.bits_per_pixel);\n bmp_info.offset_bits+=(1UL << bmp_info.bits_per_pixel);\n }\n }\n }\n if (image->storage_class == DirectClass)\n {\n /*\n Full color BMP raster.\n */\n bmp_info.number_colors=0;\n bmp_info.bits_per_pixel=(unsigned short)\n ((type > 3) && (image->alpha_trait != UndefinedPixelTrait) ? 32 : 24);\n bmp_info.compression=(unsigned int) ((type > 3) &&\n (image->alpha_trait != UndefinedPixelTrait) ? BI_BITFIELDS : BI_RGB);\n if ((type == 3) && (image->alpha_trait != UndefinedPixelTrait))\n {\n option=GetImageOption(image_info,\"bmp3:alpha\");\n if (IsStringTrue(option))\n bmp_info.bits_per_pixel=32;\n }\n }\n bytes_per_line=4*((image->columns*bmp_info.bits_per_pixel+31)/32);\n bmp_info.ba_offset=0;\n profile=GetImageProfile(image,\"icc\");\n have_color_info=(image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL) || (image->gamma != 0.0) ? MagickTrue :\n MagickFalse;\n if (type == 2)\n bmp_info.size=12;\n else\n if ((type == 3) || ((image->alpha_trait == UndefinedPixelTrait) &&\n (have_color_info == MagickFalse)))\n {\n type=3;\n bmp_info.size=40;\n }\n else\n {\n int\n extra_size;\n\n bmp_info.size=108;\n extra_size=68;\n if ((image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL))\n {\n bmp_info.size=124;\n extra_size+=16;\n }\n bmp_info.file_size+=extra_size;\n bmp_info.offset_bits+=extra_size;\n }\n bmp_info.width=(ssize_t) image->columns;\n bmp_info.height=(ssize_t) image->rows;\n bmp_info.planes=1;\n bmp_info.image_size=(unsigned int) (bytes_per_line*image->rows);\n bmp_info.file_size+=bmp_info.image_size;\n bmp_info.x_pixels=75*39;\n bmp_info.y_pixels=75*39;\n switch (image->units)\n {\n case UndefinedResolution:\n case PixelsPerInchResolution:\n {\n bmp_info.x_pixels=(unsigned int) (100.0*image->resolution.x/2.54);\n bmp_info.y_pixels=(unsigned int) (100.0*image->resolution.y/2.54);\n break;\n }\n case PixelsPerCentimeterResolution:\n {\n bmp_info.x_pixels=(unsigned int) (100.0*image->resolution.x);\n bmp_info.y_pixels=(unsigned int) (100.0*image->resolution.y);\n break;\n }\n }\n bmp_info.colors_important=bmp_info.number_colors;\n /*\n Convert MIFF to BMP raster pixels.\n */\n pixel_info=AcquireVirtualMemory((size_t) bmp_info.image_size,\n sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n (void) ResetMagickMemory(pixels,0,(size_t) bmp_info.image_size);\n switch (bmp_info.bits_per_pixel)\n {\n case 1:\n {\n size_t\n bit,\n byte;\n\n /*\n Convert PseudoClass image to a BMP monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n ssize_t\n offset;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n bit=0;\n byte=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n byte<<=1;\n byte|=GetPixelIndex(image,p) != 0 ? 0x01 : 0x00;\n bit++;\n if (bit == 8)\n {\n *q++=(unsigned char) byte;\n bit=0;\n byte=0;\n }\n p+=GetPixelChannels(image);\n }\n if (bit != 0)\n {\n *q++=(unsigned char) (byte << (8-bit));\n x++;\n }\n offset=(ssize_t) (image->columns+7)/8;\n for (x=offset; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 4:\n {\n size_t\n byte,\n nibble;\n\n ssize_t\n offset;\n\n /*\n Convert PseudoClass image to a BMP monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n nibble=0;\n byte=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n byte<<=4;\n byte|=((size_t) GetPixelIndex(image,p) & 0x0f);\n nibble++;\n if (nibble == 2)\n {\n *q++=(unsigned char) byte;\n nibble=0;\n byte=0;\n }\n p+=GetPixelChannels(image);\n }\n if (nibble != 0)\n {\n *q++=(unsigned char) (byte << 4);\n x++;\n }\n offset=(ssize_t) (image->columns+1)/2;\n for (x=offset; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 8:\n {\n /*\n Convert PseudoClass packet to BMP pixel.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=(unsigned char) GetPixelIndex(image,p);\n p+=GetPixelChannels(image);\n }\n for ( ; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 24:\n {\n /*\n Convert DirectClass packet to BMP BGR888.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(GetPixelBlue(image,p));\n *q++=ScaleQuantumToChar(GetPixelGreen(image,p));\n *q++=ScaleQuantumToChar(GetPixelRed(image,p));\n p+=GetPixelChannels(image);\n }\n for (x=3L*(ssize_t) image->columns; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 32:\n {\n /*\n Convert DirectClass packet to ARGB8888 pixel.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(GetPixelBlue(image,p));\n *q++=ScaleQuantumToChar(GetPixelGreen(image,p));\n *q++=ScaleQuantumToChar(GetPixelRed(image,p));\n *q++=ScaleQuantumToChar(GetPixelAlpha(image,p));\n p+=GetPixelChannels(image);\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n }\n if ((type > 2) && (bmp_info.bits_per_pixel == 8))\n if (image_info->compression != NoCompression)\n {\n MemoryInfo\n *rle_info;\n\n /*\n Convert run-length encoded raster pixels.\n */\n rle_info=AcquireVirtualMemory((size_t) (2*(bytes_per_line+2)+2),\n (image->rows+2)*sizeof(*pixels));\n if (rle_info == (MemoryInfo *) NULL)\n {\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n bmp_data=(unsigned char *) GetVirtualMemoryBlob(rle_info);\n bmp_info.file_size-=bmp_info.image_size;\n bmp_info.image_size=(unsigned int) EncodeImage(image,bytes_per_line,\n pixels,bmp_data);\n bmp_info.file_size+=bmp_info.image_size;\n pixel_info=RelinquishVirtualMemory(pixel_info);\n pixel_info=rle_info;\n pixels=bmp_data;\n bmp_info.compression=BI_RLE8;\n }\n /*\n Write BMP for Windows, all versions, 14-byte header.\n */\n if (image->debug != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing BMP version %.20g datastream\",(double) type);\n if (image->storage_class == DirectClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Storage class=DirectClass\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Storage class=PseudoClass\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image depth=%.20g\",(double) image->depth);\n if (image->alpha_trait != UndefinedPixelTrait)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Matte=True\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Matte=MagickFalse\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" BMP bits_per_pixel=%.20g\",(double) bmp_info.bits_per_pixel);\n switch ((int) bmp_info.compression)\n {\n case BI_RGB:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_RGB\");\n break;\n }\n case BI_RLE8:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_RLE8\");\n break;\n }\n case BI_BITFIELDS:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_BITFIELDS\");\n break;\n }\n default:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=UNKNOWN (%lu)\",bmp_info.compression);\n break;\n }\n }\n if (bmp_info.number_colors == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number_colors=unspecified\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number_colors=%lu\",bmp_info.number_colors);\n }\n (void) WriteBlob(image,2,(unsigned char *) \"BM\");\n (void) WriteBlobLSBLong(image,bmp_info.file_size);\n (void) WriteBlobLSBLong(image,bmp_info.ba_offset); /* always 0 */\n (void) WriteBlobLSBLong(image,bmp_info.offset_bits);\n if (type == 2)\n {\n /*\n Write 12-byte version 2 bitmap header.\n */\n (void) WriteBlobLSBLong(image,bmp_info.size);\n (void) WriteBlobLSBSignedShort(image,(signed short) bmp_info.width);\n (void) WriteBlobLSBSignedShort(image,(signed short) bmp_info.height);\n (void) WriteBlobLSBShort(image,bmp_info.planes);\n (void) WriteBlobLSBShort(image,bmp_info.bits_per_pixel);\n }\n else\n {\n /*\n Write 40-byte version 3+ bitmap header.\n */\n (void) WriteBlobLSBLong(image,bmp_info.size);\n (void) WriteBlobLSBSignedLong(image,(signed int) bmp_info.width);\n (void) WriteBlobLSBSignedLong(image,(signed int) bmp_info.height);\n (void) WriteBlobLSBShort(image,bmp_info.planes);\n (void) WriteBlobLSBShort(image,bmp_info.bits_per_pixel);\n (void) WriteBlobLSBLong(image,bmp_info.compression);\n (void) WriteBlobLSBLong(image,bmp_info.image_size);\n (void) WriteBlobLSBLong(image,bmp_info.x_pixels);\n (void) WriteBlobLSBLong(image,bmp_info.y_pixels);\n (void) WriteBlobLSBLong(image,bmp_info.number_colors);\n (void) WriteBlobLSBLong(image,bmp_info.colors_important);\n }\n if ((type > 3) && ((image->alpha_trait != UndefinedPixelTrait) ||\n (have_color_info != MagickFalse)))\n {\n /*\n Write the rest of the 108-byte BMP Version 4 header.\n */\n (void) WriteBlobLSBLong(image,0x00ff0000U); /* Red mask */\n (void) WriteBlobLSBLong(image,0x0000ff00U); /* Green mask */\n (void) WriteBlobLSBLong(image,0x000000ffU); /* Blue mask */\n (void) WriteBlobLSBLong(image,0xff000000U); /* Alpha mask */\n (void) WriteBlobLSBLong(image,0x73524742U); /* sRGB */\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.red_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.red_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.red_primary.x+\n image->chromaticity.red_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.green_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.green_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.green_primary.x+\n image->chromaticity.green_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.blue_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.blue_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.blue_primary.x+\n image->chromaticity.blue_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.x*0x10000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.y*0x10000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.z*0x10000));\n if ((image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL))\n {\n ssize_t\n intent;\n\n switch ((int) image->rendering_intent)\n {\n case SaturationIntent:\n {\n intent=LCS_GM_BUSINESS;\n break;\n }\n case RelativeIntent:\n {\n intent=LCS_GM_GRAPHICS;\n break;\n }\n case PerceptualIntent:\n {\n intent=LCS_GM_IMAGES;\n break;\n }\n case AbsoluteIntent:\n {\n intent=LCS_GM_ABS_COLORIMETRIC;\n break;\n }\n default:\n {\n intent=0;\n break;\n }\n }\n (void) WriteBlobLSBLong(image,(unsigned int) intent);\n (void) WriteBlobLSBLong(image,0x00); /* dummy profile data */\n (void) WriteBlobLSBLong(image,0x00); /* dummy profile length */\n (void) WriteBlobLSBLong(image,0x00); /* reserved */\n }\n }\n if (image->storage_class == PseudoClass)\n {\n unsigned char\n *bmp_colormap;\n\n /*\n Dump colormap to file.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Colormap: %.20g entries\",(double) image->colors);\n bmp_colormap=(unsigned char *) AcquireQuantumMemory((size_t) (1UL <<\n bmp_info.bits_per_pixel),4*sizeof(*bmp_colormap));\n if (bmp_colormap == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n q=bmp_colormap;\n for (i=0; i < (ssize_t) MagickMin((ssize_t) image->colors,(ssize_t) bmp_info.number_colors); i++)\n {\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].blue));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].green));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].red));\n if (type > 2)\n *q++=(unsigned char) 0x0;\n }\n for ( ; i < (ssize_t) (1UL << bmp_info.bits_per_pixel); i++)\n {\n *q++=(unsigned char) 0x00;\n *q++=(unsigned char) 0x00;\n *q++=(unsigned char) 0x00;\n if (type > 2)\n *q++=(unsigned char) 0x00;\n }\n if (type <= 2)\n (void) WriteBlob(image,(size_t) (3*(1L << bmp_info.bits_per_pixel)),\n bmp_colormap);\n else\n (void) WriteBlob(image,(size_t) (4*(1L << bmp_info.bits_per_pixel)),\n bmp_colormap);\n bmp_colormap=(unsigned char *) RelinquishMagickMemory(bmp_colormap);\n }\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Pixels: %lu bytes\",bmp_info.image_size);\n (void) WriteBlob(image,(size_t) bmp_info.image_size,pixels);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (GetNextImageInList(image) == (Image *) NULL)\n break;\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,SaveImagesTag,scene++,\n GetImageListLength(image));\n if (status == MagickFalse)\n break;\n } while (image_info->adjoin != MagickFalse);\n (void) CloseBlob(image);\n return(MagickTrue);\n}","target":"static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n BMPInfo\n bmp_info;\n\n const char\n *option;\n\n const StringInfo\n *profile;\n\n MagickBooleanType\n have_color_info,\n status;\n\n MagickOffsetType\n scene;\n\n MemoryInfo\n *pixel_info;\n\n register const Quantum\n *p;\n\n register ssize_t\n i,\n x;\n\n register unsigned char\n *q;\n\n size_t\n bytes_per_line,\n type;\n\n ssize_t\n y;\n\n unsigned char\n *bmp_data,\n *pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n type=4;\n if (LocaleCompare(image_info->magick,\"BMP2\") == 0)\n type=2;\n else\n if (LocaleCompare(image_info->magick,\"BMP3\") == 0)\n type=3;\n\n option=GetImageOption(image_info,\"bmp:format\");\n if (option != (char *) NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Format=%s\",option);\n\n if (LocaleCompare(option,\"bmp2\") == 0)\n type=2;\n if (LocaleCompare(option,\"bmp3\") == 0)\n type=3;\n if (LocaleCompare(option,\"bmp4\") == 0)\n type=4;\n }\n\n scene=0;\n do\n {\n /*\n Initialize BMP raster file header.\n */\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n (void) ResetMagickMemory(&bmp_info,0,sizeof(bmp_info));\n bmp_info.file_size=14+12;\n if (type > 2)\n bmp_info.file_size+=28;\n bmp_info.offset_bits=bmp_info.file_size;\n bmp_info.compression=BI_RGB;\n if ((image->storage_class == PseudoClass) && (image->colors > 256))\n (void) SetImageStorageClass(image,DirectClass,exception);\n if (image->storage_class != DirectClass)\n {\n /*\n Colormapped BMP raster.\n */\n bmp_info.bits_per_pixel=8;\n if (image->colors <= 2)\n bmp_info.bits_per_pixel=1;\n else\n if (image->colors <= 16)\n bmp_info.bits_per_pixel=4;\n else\n if (image->colors <= 256)\n bmp_info.bits_per_pixel=8;\n if (image_info->compression == RLECompression)\n bmp_info.bits_per_pixel=8;\n bmp_info.number_colors=1U << bmp_info.bits_per_pixel;\n if (image->alpha_trait != UndefinedPixelTrait)\n (void) SetImageStorageClass(image,DirectClass,exception);\n else\n if ((size_t) bmp_info.number_colors < image->colors)\n (void) SetImageStorageClass(image,DirectClass,exception);\n else\n {\n bmp_info.file_size+=3*(1UL << bmp_info.bits_per_pixel);\n bmp_info.offset_bits+=3*(1UL << bmp_info.bits_per_pixel);\n if (type > 2)\n {\n bmp_info.file_size+=(1UL << bmp_info.bits_per_pixel);\n bmp_info.offset_bits+=(1UL << bmp_info.bits_per_pixel);\n }\n }\n }\n if (image->storage_class == DirectClass)\n {\n /*\n Full color BMP raster.\n */\n bmp_info.number_colors=0;\n bmp_info.bits_per_pixel=(unsigned short)\n ((type > 3) && (image->alpha_trait != UndefinedPixelTrait) ? 32 : 24);\n bmp_info.compression=(unsigned int) ((type > 3) &&\n (image->alpha_trait != UndefinedPixelTrait) ? BI_BITFIELDS : BI_RGB);\n if ((type == 3) && (image->alpha_trait != UndefinedPixelTrait))\n {\n option=GetImageOption(image_info,\"bmp3:alpha\");\n if (IsStringTrue(option))\n bmp_info.bits_per_pixel=32;\n }\n }\n bytes_per_line=4*((image->columns*bmp_info.bits_per_pixel+31)/32);\n bmp_info.ba_offset=0;\n profile=GetImageProfile(image,\"icc\");\n have_color_info=(image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL) || (image->gamma != 0.0) ? MagickTrue :\n MagickFalse;\n if (type == 2)\n bmp_info.size=12;\n else\n if ((type == 3) || ((image->alpha_trait == UndefinedPixelTrait) &&\n (have_color_info == MagickFalse)))\n {\n type=3;\n bmp_info.size=40;\n }\n else\n {\n int\n extra_size;\n\n bmp_info.size=108;\n extra_size=68;\n if ((image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL))\n {\n bmp_info.size=124;\n extra_size+=16;\n }\n bmp_info.file_size+=extra_size;\n bmp_info.offset_bits+=extra_size;\n }\n if ((image->columns != (signed int) image->columns) ||\n (image->rows != (signed int) image->rows))\n ThrowWriterException(ImageError,\"WidthOrHeightExceedsLimit\");\n bmp_info.width=(ssize_t) image->columns;\n bmp_info.height=(ssize_t) image->rows;\n bmp_info.planes=1;\n bmp_info.image_size=(unsigned long) (bytes_per_line*image->rows);\n bmp_info.file_size+=bmp_info.image_size;\n bmp_info.x_pixels=75*39;\n bmp_info.y_pixels=75*39;\n switch (image->units)\n {\n case UndefinedResolution:\n case PixelsPerInchResolution:\n {\n bmp_info.x_pixels=(unsigned int) (100.0*image->resolution.x/2.54);\n bmp_info.y_pixels=(unsigned int) (100.0*image->resolution.y/2.54);\n break;\n }\n case PixelsPerCentimeterResolution:\n {\n bmp_info.x_pixels=(unsigned int) (100.0*image->resolution.x);\n bmp_info.y_pixels=(unsigned int) (100.0*image->resolution.y);\n break;\n }\n }\n bmp_info.colors_important=bmp_info.number_colors;\n /*\n Convert MIFF to BMP raster pixels.\n */\n pixel_info=AcquireVirtualMemory((size_t) bmp_info.image_size,\n sizeof(*pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n (void) ResetMagickMemory(pixels,0,(size_t) bmp_info.image_size);\n switch (bmp_info.bits_per_pixel)\n {\n case 1:\n {\n size_t\n bit,\n byte;\n\n /*\n Convert PseudoClass image to a BMP monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n ssize_t\n offset;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n bit=0;\n byte=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n byte<<=1;\n byte|=GetPixelIndex(image,p) != 0 ? 0x01 : 0x00;\n bit++;\n if (bit == 8)\n {\n *q++=(unsigned char) byte;\n bit=0;\n byte=0;\n }\n p+=GetPixelChannels(image);\n }\n if (bit != 0)\n {\n *q++=(unsigned char) (byte << (8-bit));\n x++;\n }\n offset=(ssize_t) (image->columns+7)/8;\n for (x=offset; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 4:\n {\n size_t\n byte,\n nibble;\n\n ssize_t\n offset;\n\n /*\n Convert PseudoClass image to a BMP monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n nibble=0;\n byte=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n byte<<=4;\n byte|=((size_t) GetPixelIndex(image,p) & 0x0f);\n nibble++;\n if (nibble == 2)\n {\n *q++=(unsigned char) byte;\n nibble=0;\n byte=0;\n }\n p+=GetPixelChannels(image);\n }\n if (nibble != 0)\n {\n *q++=(unsigned char) (byte << 4);\n x++;\n }\n offset=(ssize_t) (image->columns+1)/2;\n for (x=offset; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 8:\n {\n /*\n Convert PseudoClass packet to BMP pixel.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=(unsigned char) GetPixelIndex(image,p);\n p+=GetPixelChannels(image);\n }\n for ( ; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 24:\n {\n /*\n Convert DirectClass packet to BMP BGR888.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(GetPixelBlue(image,p));\n *q++=ScaleQuantumToChar(GetPixelGreen(image,p));\n *q++=ScaleQuantumToChar(GetPixelRed(image,p));\n p+=GetPixelChannels(image);\n }\n for (x=3L*(ssize_t) image->columns; x < (ssize_t) bytes_per_line; x++)\n *q++=0x00;\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n case 32:\n {\n /*\n Convert DirectClass packet to ARGB8888 pixel.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n q=pixels+(image->rows-y-1)*bytes_per_line;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(GetPixelBlue(image,p));\n *q++=ScaleQuantumToChar(GetPixelGreen(image,p));\n *q++=ScaleQuantumToChar(GetPixelRed(image,p));\n *q++=ScaleQuantumToChar(GetPixelAlpha(image,p));\n p+=GetPixelChannels(image);\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n break;\n }\n }\n if ((type > 2) && (bmp_info.bits_per_pixel == 8))\n if (image_info->compression != NoCompression)\n {\n MemoryInfo\n *rle_info;\n\n /*\n Convert run-length encoded raster pixels.\n */\n rle_info=AcquireVirtualMemory((size_t) (2*(bytes_per_line+2)+2),\n (image->rows+2)*sizeof(*pixels));\n if (rle_info == (MemoryInfo *) NULL)\n {\n pixel_info=RelinquishVirtualMemory(pixel_info);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n bmp_data=(unsigned char *) GetVirtualMemoryBlob(rle_info);\n bmp_info.file_size-=bmp_info.image_size;\n bmp_info.image_size=(unsigned int) EncodeImage(image,bytes_per_line,\n pixels,bmp_data);\n bmp_info.file_size+=bmp_info.image_size;\n pixel_info=RelinquishVirtualMemory(pixel_info);\n pixel_info=rle_info;\n pixels=bmp_data;\n bmp_info.compression=BI_RLE8;\n }\n /*\n Write BMP for Windows, all versions, 14-byte header.\n */\n if (image->debug != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing BMP version %.20g datastream\",(double) type);\n if (image->storage_class == DirectClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Storage class=DirectClass\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Storage class=PseudoClass\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image depth=%.20g\",(double) image->depth);\n if (image->alpha_trait != UndefinedPixelTrait)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Matte=True\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Matte=MagickFalse\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" BMP bits_per_pixel=%.20g\",(double) bmp_info.bits_per_pixel);\n switch ((int) bmp_info.compression)\n {\n case BI_RGB:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_RGB\");\n break;\n }\n case BI_RLE8:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_RLE8\");\n break;\n }\n case BI_BITFIELDS:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=BI_BITFIELDS\");\n break;\n }\n default:\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression=UNKNOWN (%lu)\",bmp_info.compression);\n break;\n }\n }\n if (bmp_info.number_colors == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number_colors=unspecified\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number_colors=%lu\",bmp_info.number_colors);\n }\n (void) WriteBlob(image,2,(unsigned char *) \"BM\");\n (void) WriteBlobLSBLong(image,bmp_info.file_size);\n (void) WriteBlobLSBLong(image,bmp_info.ba_offset); /* always 0 */\n (void) WriteBlobLSBLong(image,bmp_info.offset_bits);\n if (type == 2)\n {\n /*\n Write 12-byte version 2 bitmap header.\n */\n (void) WriteBlobLSBLong(image,bmp_info.size);\n (void) WriteBlobLSBSignedShort(image,(signed short) bmp_info.width);\n (void) WriteBlobLSBSignedShort(image,(signed short) bmp_info.height);\n (void) WriteBlobLSBShort(image,bmp_info.planes);\n (void) WriteBlobLSBShort(image,bmp_info.bits_per_pixel);\n }\n else\n {\n /*\n Write 40-byte version 3+ bitmap header.\n */\n (void) WriteBlobLSBLong(image,bmp_info.size);\n (void) WriteBlobLSBSignedLong(image,(signed int) bmp_info.width);\n (void) WriteBlobLSBSignedLong(image,(signed int) bmp_info.height);\n (void) WriteBlobLSBShort(image,bmp_info.planes);\n (void) WriteBlobLSBShort(image,bmp_info.bits_per_pixel);\n (void) WriteBlobLSBLong(image,bmp_info.compression);\n (void) WriteBlobLSBLong(image,bmp_info.image_size);\n (void) WriteBlobLSBLong(image,bmp_info.x_pixels);\n (void) WriteBlobLSBLong(image,bmp_info.y_pixels);\n (void) WriteBlobLSBLong(image,bmp_info.number_colors);\n (void) WriteBlobLSBLong(image,bmp_info.colors_important);\n }\n if ((type > 3) && ((image->alpha_trait != UndefinedPixelTrait) ||\n (have_color_info != MagickFalse)))\n {\n /*\n Write the rest of the 108-byte BMP Version 4 header.\n */\n (void) WriteBlobLSBLong(image,0x00ff0000U); /* Red mask */\n (void) WriteBlobLSBLong(image,0x0000ff00U); /* Green mask */\n (void) WriteBlobLSBLong(image,0x000000ffU); /* Blue mask */\n (void) WriteBlobLSBLong(image,0xff000000U); /* Alpha mask */\n (void) WriteBlobLSBLong(image,0x73524742U); /* sRGB */\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.red_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.red_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.red_primary.x+\n image->chromaticity.red_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.green_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.green_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.green_primary.x+\n image->chromaticity.green_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.blue_primary.x*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (image->chromaticity.blue_primary.y*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n ((1.000f-(image->chromaticity.blue_primary.x+\n image->chromaticity.blue_primary.y))*0x40000000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.x*0x10000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.y*0x10000));\n (void) WriteBlobLSBLong(image,(unsigned int)\n (bmp_info.gamma_scale.z*0x10000));\n if ((image->rendering_intent != UndefinedIntent) ||\n (profile != (StringInfo *) NULL))\n {\n ssize_t\n intent;\n\n switch ((int) image->rendering_intent)\n {\n case SaturationIntent:\n {\n intent=LCS_GM_BUSINESS;\n break;\n }\n case RelativeIntent:\n {\n intent=LCS_GM_GRAPHICS;\n break;\n }\n case PerceptualIntent:\n {\n intent=LCS_GM_IMAGES;\n break;\n }\n case AbsoluteIntent:\n {\n intent=LCS_GM_ABS_COLORIMETRIC;\n break;\n }\n default:\n {\n intent=0;\n break;\n }\n }\n (void) WriteBlobLSBLong(image,(unsigned int) intent);\n (void) WriteBlobLSBLong(image,0x00); /* dummy profile data */\n (void) WriteBlobLSBLong(image,0x00); /* dummy profile length */\n (void) WriteBlobLSBLong(image,0x00); /* reserved */\n }\n }\n if (image->storage_class == PseudoClass)\n {\n unsigned char\n *bmp_colormap;\n\n /*\n Dump colormap to file.\n */\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Colormap: %.20g entries\",(double) image->colors);\n bmp_colormap=(unsigned char *) AcquireQuantumMemory((size_t) (1UL <<\n bmp_info.bits_per_pixel),4*sizeof(*bmp_colormap));\n if (bmp_colormap == (unsigned char *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n q=bmp_colormap;\n for (i=0; i < (ssize_t) MagickMin((ssize_t) image->colors,(ssize_t) bmp_info.number_colors); i++)\n {\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].blue));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].green));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].red));\n if (type > 2)\n *q++=(unsigned char) 0x0;\n }\n for ( ; i < (ssize_t) (1UL << bmp_info.bits_per_pixel); i++)\n {\n *q++=(unsigned char) 0x00;\n *q++=(unsigned char) 0x00;\n *q++=(unsigned char) 0x00;\n if (type > 2)\n *q++=(unsigned char) 0x00;\n }\n if (type <= 2)\n (void) WriteBlob(image,(size_t) (3*(1L << bmp_info.bits_per_pixel)),\n bmp_colormap);\n else\n (void) WriteBlob(image,(size_t) (4*(1L << bmp_info.bits_per_pixel)),\n bmp_colormap);\n bmp_colormap=(unsigned char *) RelinquishMagickMemory(bmp_colormap);\n }\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Pixels: %lu bytes\",bmp_info.image_size);\n (void) WriteBlob(image,(size_t) bmp_info.image_size,pixels);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n if (GetNextImageInList(image) == (Image *) NULL)\n break;\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,SaveImagesTag,scene++,\n GetImageListLength(image));\n if (status == MagickFalse)\n break;\n } while (image_info->adjoin != MagickFalse);\n (void) CloseBlob(image);\n return(MagickTrue);\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"WriteBMPImage","file_name":"coders/bmp.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/4cc6ec8a4197d4c008577127736bf7985d632323","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#10-d2e220664989","input":"void AllocateDataSet(cmsIT8* it8)\n{\n TABLE* t = GetTable(it8);\n\n if (t -> Data) return; // Already allocated\n\n t-> nSamples = atoi(cmsIT8GetProperty(it8, \"NUMBER_OF_FIELDS\"));\n t-> nPatches = atoi(cmsIT8GetProperty(it8, \"NUMBER_OF_SETS\"));\n\n t-> Data = (char**)AllocChunk (it8, ((cmsUInt32Number) t->nSamples + 1) * ((cmsUInt32Number) t->nPatches + 1) *sizeof (char*));\n if (t->Data == NULL) {\n\n SynError(it8, \"AllocateDataSet: Unable to allocate data array\");\n }\n\n}","target":"void AllocateDataSet(cmsIT8* it8)\n{\n TABLE* t = GetTable(it8);\n\n if (t -> Data) return; // Already allocated\n\n t-> nSamples = atoi(cmsIT8GetProperty(it8, \"NUMBER_OF_FIELDS\"));\n t-> nPatches = atoi(cmsIT8GetProperty(it8, \"NUMBER_OF_SETS\"));\n\n if (t -> nSamples < 0 || t->nSamples > 0x7ffe || t->nPatches < 0 || t->nPatches > 0x7ffe)\n {\n SynError(it8, \"AllocateDataSet: too much data\");\n }\n else {\n t->Data = (char**)AllocChunk(it8, ((cmsUInt32Number)t->nSamples + 1) * ((cmsUInt32Number)t->nPatches + 1) * sizeof(char*));\n if (t->Data == NULL) {\n\n SynError(it8, \"AllocateDataSet: Unable to allocate data array\");\n }\n }\n\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"AllocateDataSet","file_name":"src/cmscgats.c","commit_link":"github.com/mm2/Little-CMS/commit/768f70ca405cd3159d990e962d54456773bb8cf8","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#11-869fec8c60f9","input":"vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)\n{\n\tstruct drm_vc4_submit_cl *args = exec->args;\n\tvoid *temp = NULL;\n\tvoid *bin;\n\tint ret = 0;\n\tuint32_t bin_offset = 0;\n\tuint32_t shader_rec_offset = roundup(bin_offset + args->bin_cl_size,\n\t\t\t\t\t 16);\n\tuint32_t uniforms_offset = shader_rec_offset + args->shader_rec_size;\n\tuint32_t exec_size = uniforms_offset + args->uniforms_size;\n\tuint32_t temp_size = exec_size + (sizeof(struct vc4_shader_state) *\n\t\t\t\t\t args->shader_rec_count);\n\tstruct vc4_bo *bo;\n\n\tif (uniforms_offset < shader_rec_offset ||\n\t exec_size < uniforms_offset ||\n\t args->shader_rec_count >= (UINT_MAX /\n\t\t\t\t\t sizeof(struct vc4_shader_state)) ||\n\t temp_size < exec_size) {\n\t\tDRM_ERROR(\"overflow in exec arguments\\n\");\n\t\tgoto fail;\n\t}\n\n\t/* Allocate space where we'll store the copied in user command lists\n\t * and shader records.\n\t *\n\t * We don't just copy directly into the BOs because we need to\n\t * read the contents back for validation, and I think the\n\t * bo->vaddr is uncached access.\n\t */\n\ttemp = drm_malloc_ab(temp_size, 1);\n\tif (!temp) {\n\t\tDRM_ERROR(\"Failed to allocate storage for copying \"\n\t\t\t \"in bin/render CLs.\\n\");\n\t\tret = -ENOMEM;\n\t\tgoto fail;\n\t}\n\tbin = temp + bin_offset;\n\texec->shader_rec_u = temp + shader_rec_offset;\n\texec->uniforms_u = temp + uniforms_offset;\n\texec->shader_state = temp + exec_size;\n\texec->shader_state_size = args->shader_rec_count;\n\n\tif (copy_from_user(bin,\n\t\t\t (void __user *)(uintptr_t)args->bin_cl,\n\t\t\t args->bin_cl_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->shader_rec_u,\n\t\t\t (void __user *)(uintptr_t)args->shader_rec,\n\t\t\t args->shader_rec_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->uniforms_u,\n\t\t\t (void __user *)(uintptr_t)args->uniforms,\n\t\t\t args->uniforms_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tbo = vc4_bo_create(dev, exec_size, true);\n\tif (IS_ERR(bo)) {\n\t\tDRM_ERROR(\"Couldn't allocate BO for binning\\n\");\n\t\tret = PTR_ERR(bo);\n\t\tgoto fail;\n\t}\n\texec->exec_bo = &bo->base;\n\n\tlist_add_tail(&to_vc4_bo(&exec->exec_bo->base)->unref_head,\n\t\t &exec->unref_list);\n\n\texec->ct0ca = exec->exec_bo->paddr + bin_offset;\n\n\texec->bin_u = bin;\n\n\texec->shader_rec_v = exec->exec_bo->vaddr + shader_rec_offset;\n\texec->shader_rec_p = exec->exec_bo->paddr + shader_rec_offset;\n\texec->shader_rec_size = args->shader_rec_size;\n\n\texec->uniforms_v = exec->exec_bo->vaddr + uniforms_offset;\n\texec->uniforms_p = exec->exec_bo->paddr + uniforms_offset;\n\texec->uniforms_size = args->uniforms_size;\n\n\tret = vc4_validate_bin_cl(dev,\n\t\t\t\t exec->exec_bo->vaddr + bin_offset,\n\t\t\t\t bin,\n\t\t\t\t exec);\n\tif (ret)\n\t\tgoto fail;\n\n\tret = vc4_validate_shader_recs(dev, exec);\n\tif (ret)\n\t\tgoto fail;\n\n\t/* Block waiting on any previous rendering into the CS's VBO,\n\t * IB, or textures, so that pixels are actually written by the\n\t * time we try to read them.\n\t */\n\tret = vc4_wait_for_seqno(dev, exec->bin_dep_seqno, ~0ull, true);\n\nfail:\n\tdrm_free_large(temp);\n\treturn ret;\n}","target":"vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)\n{\n\tstruct drm_vc4_submit_cl *args = exec->args;\n\tvoid *temp = NULL;\n\tvoid *bin;\n\tint ret = 0;\n\tuint32_t bin_offset = 0;\n\tuint32_t shader_rec_offset = roundup(bin_offset + args->bin_cl_size,\n\t\t\t\t\t 16);\n\tuint32_t uniforms_offset = shader_rec_offset + args->shader_rec_size;\n\tuint32_t exec_size = uniforms_offset + args->uniforms_size;\n\tuint32_t temp_size = exec_size + (sizeof(struct vc4_shader_state) *\n\t\t\t\t\t args->shader_rec_count);\n\tstruct vc4_bo *bo;\n\n\tif (shader_rec_offset < args->bin_cl_size ||\n\t uniforms_offset < shader_rec_offset ||\n\t exec_size < uniforms_offset ||\n\t args->shader_rec_count >= (UINT_MAX /\n\t\t\t\t\t sizeof(struct vc4_shader_state)) ||\n\t temp_size < exec_size) {\n\t\tDRM_ERROR(\"overflow in exec arguments\\n\");\n\t\tgoto fail;\n\t}\n\n\t/* Allocate space where we'll store the copied in user command lists\n\t * and shader records.\n\t *\n\t * We don't just copy directly into the BOs because we need to\n\t * read the contents back for validation, and I think the\n\t * bo->vaddr is uncached access.\n\t */\n\ttemp = drm_malloc_ab(temp_size, 1);\n\tif (!temp) {\n\t\tDRM_ERROR(\"Failed to allocate storage for copying \"\n\t\t\t \"in bin/render CLs.\\n\");\n\t\tret = -ENOMEM;\n\t\tgoto fail;\n\t}\n\tbin = temp + bin_offset;\n\texec->shader_rec_u = temp + shader_rec_offset;\n\texec->uniforms_u = temp + uniforms_offset;\n\texec->shader_state = temp + exec_size;\n\texec->shader_state_size = args->shader_rec_count;\n\n\tif (copy_from_user(bin,\n\t\t\t (void __user *)(uintptr_t)args->bin_cl,\n\t\t\t args->bin_cl_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->shader_rec_u,\n\t\t\t (void __user *)(uintptr_t)args->shader_rec,\n\t\t\t args->shader_rec_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tif (copy_from_user(exec->uniforms_u,\n\t\t\t (void __user *)(uintptr_t)args->uniforms,\n\t\t\t args->uniforms_size)) {\n\t\tret = -EFAULT;\n\t\tgoto fail;\n\t}\n\n\tbo = vc4_bo_create(dev, exec_size, true);\n\tif (IS_ERR(bo)) {\n\t\tDRM_ERROR(\"Couldn't allocate BO for binning\\n\");\n\t\tret = PTR_ERR(bo);\n\t\tgoto fail;\n\t}\n\texec->exec_bo = &bo->base;\n\n\tlist_add_tail(&to_vc4_bo(&exec->exec_bo->base)->unref_head,\n\t\t &exec->unref_list);\n\n\texec->ct0ca = exec->exec_bo->paddr + bin_offset;\n\n\texec->bin_u = bin;\n\n\texec->shader_rec_v = exec->exec_bo->vaddr + shader_rec_offset;\n\texec->shader_rec_p = exec->exec_bo->paddr + shader_rec_offset;\n\texec->shader_rec_size = args->shader_rec_size;\n\n\texec->uniforms_v = exec->exec_bo->vaddr + uniforms_offset;\n\texec->uniforms_p = exec->exec_bo->paddr + uniforms_offset;\n\texec->uniforms_size = args->uniforms_size;\n\n\tret = vc4_validate_bin_cl(dev,\n\t\t\t\t exec->exec_bo->vaddr + bin_offset,\n\t\t\t\t bin,\n\t\t\t\t exec);\n\tif (ret)\n\t\tgoto fail;\n\n\tret = vc4_validate_shader_recs(dev, exec);\n\tif (ret)\n\t\tgoto fail;\n\n\t/* Block waiting on any previous rendering into the CS's VBO,\n\t * IB, or textures, so that pixels are actually written by the\n\t * time we try to read them.\n\t */\n\tret = vc4_wait_for_seqno(dev, exec->bin_dep_seqno, ~0ull, true);\n\nfail:\n\tdrm_free_large(temp);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"vc4_get_bcl","file_name":"drivers/gpu/drm/vc4/vc4_gem.c","commit_link":"github.com/torvalds/linux/commit/0f2ff82e11c86c05d051cae32b58226392d33bbf","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#12-370d7a5620d1","input":"static MagickOffsetType TIFFSeekCustomStream(const MagickOffsetType offset,\n const int whence,void *user_data)\n{\n PhotoshopProfile\n *profile;\n\n profile=(PhotoshopProfile *) user_data;\n switch (whence)\n {\n case SEEK_SET:\n default:\n {\n if (offset < 0)\n return(-1);\n profile->offset=offset;\n break;\n }\n case SEEK_CUR:\n {\n if ((profile->offset+offset) < 0)\n return(-1);\n profile->offset+=offset;\n break;\n }\n case SEEK_END:\n {\n if (((MagickOffsetType) profile->length+offset) < 0)\n return(-1);\n profile->offset=profile->length+offset;\n break;\n }\n }\n\n return(profile->offset);\n}","target":"static MagickOffsetType TIFFSeekCustomStream(const MagickOffsetType offset,\n const int whence,void *user_data)\n{\n PhotoshopProfile\n *profile;\n\n profile=(PhotoshopProfile *) user_data;\n switch (whence)\n {\n case SEEK_SET:\n default:\n {\n if (offset < 0)\n return(-1);\n profile->offset=offset;\n break;\n }\n case SEEK_CUR:\n {\n if (((offset > 0) && (profile->offset > (SSIZE_MAX-offset))) ||\n ((offset < 0) && (profile->offset < (-SSIZE_MAX-offset))))\n {\n errno=EOVERFLOW;\n return(-1);\n }\n if ((profile->offset+offset) < 0)\n return(-1);\n profile->offset+=offset;\n break;\n }\n case SEEK_END:\n {\n if (((MagickOffsetType) profile->length+offset) < 0)\n return(-1);\n profile->offset=profile->length+offset;\n break;\n }\n }\n\n return(profile->offset);\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"TIFFSeekCustomStream","file_name":"coders/tiff.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/fe5f4b85e6b1b54d3b4588a77133c06ade46d891","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#13-581d72a38720","input":"int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,\n\t\t\t\tvoid __user *buffer, size_t *lenp,\n\t\t\t\tloff_t *ppos)\n{\n\tint ret = proc_dointvec(table, write, buffer, lenp, ppos);\n\n\tif (ret || !write)\n\t\treturn ret;\n\n\tif (sysctl_perf_cpu_time_max_percent == 100 ||\n\t sysctl_perf_cpu_time_max_percent == 0) {\n\t\tprintk(KERN_WARNING\n\t\t \"perf: Dynamic interrupt throttling disabled, can hang your system!\\n\");\n\t\tWRITE_ONCE(perf_sample_allowed_ns, 0);\n\t} else {\n\t\tupdate_perf_cpu_limits();\n\t}\n\n\treturn 0;\n}","target":"int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,\n\t\t\t\tvoid __user *buffer, size_t *lenp,\n\t\t\t\tloff_t *ppos)\n{\n\tint ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);\n\n\tif (ret || !write)\n\t\treturn ret;\n\n\tif (sysctl_perf_cpu_time_max_percent == 100 ||\n\t sysctl_perf_cpu_time_max_percent == 0) {\n\t\tprintk(KERN_WARNING\n\t\t \"perf: Dynamic interrupt throttling disabled, can hang your system!\\n\");\n\t\tWRITE_ONCE(perf_sample_allowed_ns, 0);\n\t} else {\n\t\tupdate_perf_cpu_limits();\n\t}\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"perf_cpu_time_max_percent_handler","file_name":"kernel/events/core.c","commit_link":"github.com/torvalds/linux/commit/1572e45a924f254d9570093abde46430c3172e3d","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#14-3a776e8ed71c","input":"int git_delta_apply(\n\tvoid **out,\n\tsize_t *out_len,\n\tconst unsigned char *base,\n\tsize_t base_len,\n\tconst unsigned char *delta,\n\tsize_t delta_len)\n{\n\tconst unsigned char *delta_end = delta + delta_len;\n\tsize_t base_sz, res_sz, alloc_sz;\n\tunsigned char *res_dp;\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\t/*\n\t * Check that the base size matches the data we were given;\n\t * if not we would underflow while accessing data from the\n\t * base object, resulting in data corruption or segfault.\n\t */\n\tif ((hdr_sz(&base_sz, &delta, delta_end) < 0) || (base_sz != base_len)) {\n\t\tgiterr_set(GITERR_INVALID, \"failed to apply delta: base size does not match given data\");\n\t\treturn -1;\n\t}\n\n\tif (hdr_sz(&res_sz, &delta, delta_end) < 0) {\n\t\tgiterr_set(GITERR_INVALID, \"failed to apply delta: base size does not match given data\");\n\t\treturn -1;\n\t}\n\n\tGITERR_CHECK_ALLOC_ADD(&alloc_sz, res_sz, 1);\n\tres_dp = git__malloc(alloc_sz);\n\tGITERR_CHECK_ALLOC(res_dp);\n\n\tres_dp[res_sz] = '\\0';\n\t*out = res_dp;\n\t*out_len = res_sz;\n\n\twhile (delta < delta_end) {\n\t\tunsigned char cmd = *delta++;\n\t\tif (cmd & 0x80) {\n\t\t\t/* cmd is a copy instruction; copy from the base. */\n\t\t\tsize_t off = 0, len = 0;\n\n#define ADD_DELTA(o, shift) { if (delta < delta_end) (o) |= ((unsigned) *delta++ << shift); else goto fail; }\n\t\t\tif (cmd & 0x01) ADD_DELTA(off, 0UL);\n\t\t\tif (cmd & 0x02) ADD_DELTA(off, 8UL);\n\t\t\tif (cmd & 0x04) ADD_DELTA(off, 16UL);\n\t\t\tif (cmd & 0x08) ADD_DELTA(off, 24UL);\n\n\t\t\tif (cmd & 0x10) ADD_DELTA(len, 0UL);\n\t\t\tif (cmd & 0x20) ADD_DELTA(len, 8UL);\n\t\t\tif (cmd & 0x40) ADD_DELTA(len, 16UL);\n\t\t\tif (!len) len = 0x10000;\n#undef ADD_DELTA\n\n\t\t\tif (base_len < off + len || res_sz < len)\n\t\t\t\tgoto fail;\n\t\t\tmemcpy(res_dp, base + off, len);\n\t\t\tres_dp += len;\n\t\t\tres_sz -= len;\n\n\t\t} else if (cmd) {\n\t\t\t/*\n\t\t\t * cmd is a literal insert instruction; copy from\n\t\t\t * the delta stream itself.\n\t\t\t */\n\t\t\tif (delta_end - delta < cmd || res_sz < cmd)\n\t\t\t\tgoto fail;\n\t\t\tmemcpy(res_dp, delta, cmd);\n\t\t\tdelta += cmd;\n\t\t\tres_dp += cmd;\n\t\t\tres_sz -= cmd;\n\n\t\t} else {\n\t\t\t/* cmd == 0 is reserved for future encodings. */\n\t\t\tgoto fail;\n\t\t}\n\t}\n\n\tif (delta != delta_end || res_sz)\n\t\tgoto fail;\n\treturn 0;\n\nfail:\n\tgit__free(*out);\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\tgiterr_set(GITERR_INVALID, \"failed to apply delta\");\n\treturn -1;\n}","target":"int git_delta_apply(\n\tvoid **out,\n\tsize_t *out_len,\n\tconst unsigned char *base,\n\tsize_t base_len,\n\tconst unsigned char *delta,\n\tsize_t delta_len)\n{\n\tconst unsigned char *delta_end = delta + delta_len;\n\tsize_t base_sz, res_sz, alloc_sz;\n\tunsigned char *res_dp;\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\t/*\n\t * Check that the base size matches the data we were given;\n\t * if not we would underflow while accessing data from the\n\t * base object, resulting in data corruption or segfault.\n\t */\n\tif ((hdr_sz(&base_sz, &delta, delta_end) < 0) || (base_sz != base_len)) {\n\t\tgiterr_set(GITERR_INVALID, \"failed to apply delta: base size does not match given data\");\n\t\treturn -1;\n\t}\n\n\tif (hdr_sz(&res_sz, &delta, delta_end) < 0) {\n\t\tgiterr_set(GITERR_INVALID, \"failed to apply delta: base size does not match given data\");\n\t\treturn -1;\n\t}\n\n\tGITERR_CHECK_ALLOC_ADD(&alloc_sz, res_sz, 1);\n\tres_dp = git__malloc(alloc_sz);\n\tGITERR_CHECK_ALLOC(res_dp);\n\n\tres_dp[res_sz] = '\\0';\n\t*out = res_dp;\n\t*out_len = res_sz;\n\n\twhile (delta < delta_end) {\n\t\tunsigned char cmd = *delta++;\n\t\tif (cmd & 0x80) {\n\t\t\t/* cmd is a copy instruction; copy from the base. */\n\t\t\tsize_t off = 0, len = 0, end;\n\n#define ADD_DELTA(o, shift) { if (delta < delta_end) (o) |= ((unsigned) *delta++ << shift); else goto fail; }\n\t\t\tif (cmd & 0x01) ADD_DELTA(off, 0UL);\n\t\t\tif (cmd & 0x02) ADD_DELTA(off, 8UL);\n\t\t\tif (cmd & 0x04) ADD_DELTA(off, 16UL);\n\t\t\tif (cmd & 0x08) ADD_DELTA(off, 24UL);\n\n\t\t\tif (cmd & 0x10) ADD_DELTA(len, 0UL);\n\t\t\tif (cmd & 0x20) ADD_DELTA(len, 8UL);\n\t\t\tif (cmd & 0x40) ADD_DELTA(len, 16UL);\n\t\t\tif (!len) len = 0x10000;\n#undef ADD_DELTA\n\n\t\t\tif (GIT_ADD_SIZET_OVERFLOW(&end, off, len) ||\n\t\t\t base_len < end || res_sz < len)\n\t\t\t\tgoto fail;\n\n\t\t\tmemcpy(res_dp, base + off, len);\n\t\t\tres_dp += len;\n\t\t\tres_sz -= len;\n\n\t\t} else if (cmd) {\n\t\t\t/*\n\t\t\t * cmd is a literal insert instruction; copy from\n\t\t\t * the delta stream itself.\n\t\t\t */\n\t\t\tif (delta_end - delta < cmd || res_sz < cmd)\n\t\t\t\tgoto fail;\n\t\t\tmemcpy(res_dp, delta, cmd);\n\t\t\tdelta += cmd;\n\t\t\tres_dp += cmd;\n\t\t\tres_sz -= cmd;\n\n\t\t} else {\n\t\t\t/* cmd == 0 is reserved for future encodings. */\n\t\t\tgoto fail;\n\t\t}\n\t}\n\n\tif (delta != delta_end || res_sz)\n\t\tgoto fail;\n\treturn 0;\n\nfail:\n\tgit__free(*out);\n\n\t*out = NULL;\n\t*out_len = 0;\n\n\tgiterr_set(GITERR_INVALID, \"failed to apply delta\");\n\treturn -1;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"git_delta_apply","file_name":"src/delta.c","commit_link":"github.com/libgit2/libgit2/commit/c1577110467b701dcbcf9439ac225ea851b47d22","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#15-67865420feee","input":"static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info)\n{\n\tstruct uvesafb_pal_entry *entries;\n\tint shift = 16 - dac_width;\n\tint i, err = 0;\n\n\tif (info->var.bits_per_pixel == 8) {\n\t\tif (cmap->start + cmap->len > info->cmap.start +\n\t\t info->cmap.len || cmap->start < info->cmap.start)\n\t\t\treturn -EINVAL;\n\n\t\tentries = kmalloc(sizeof(*entries) * cmap->len, GFP_KERNEL);\n\t\tif (!entries)\n\t\t\treturn -ENOMEM;\n\n\t\tfor (i = 0; i < cmap->len; i++) {\n\t\t\tentries[i].red = cmap->red[i] >> shift;\n\t\t\tentries[i].green = cmap->green[i] >> shift;\n\t\t\tentries[i].blue = cmap->blue[i] >> shift;\n\t\t\tentries[i].pad = 0;\n\t\t}\n\t\terr = uvesafb_setpalette(entries, cmap->len, cmap->start, info);\n\t\tkfree(entries);\n\t} else {\n\t\t/*\n\t\t * For modes with bpp > 8, we only set the pseudo palette in\n\t\t * the fb_info struct. We rely on uvesafb_setcolreg to do all\n\t\t * sanity checking.\n\t\t */\n\t\tfor (i = 0; i < cmap->len; i++) {\n\t\t\terr |= uvesafb_setcolreg(cmap->start + i, cmap->red[i],\n\t\t\t\t\t\tcmap->green[i], cmap->blue[i],\n\t\t\t\t\t\t0, info);\n\t\t}\n\t}\n\treturn err;\n}","target":"static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info)\n{\n\tstruct uvesafb_pal_entry *entries;\n\tint shift = 16 - dac_width;\n\tint i, err = 0;\n\n\tif (info->var.bits_per_pixel == 8) {\n\t\tif (cmap->start + cmap->len > info->cmap.start +\n\t\t info->cmap.len || cmap->start < info->cmap.start)\n\t\t\treturn -EINVAL;\n\n\t\tentries = kmalloc_array(cmap->len, sizeof(*entries),\n\t\t\t\t\tGFP_KERNEL);\n\t\tif (!entries)\n\t\t\treturn -ENOMEM;\n\n\t\tfor (i = 0; i < cmap->len; i++) {\n\t\t\tentries[i].red = cmap->red[i] >> shift;\n\t\t\tentries[i].green = cmap->green[i] >> shift;\n\t\t\tentries[i].blue = cmap->blue[i] >> shift;\n\t\t\tentries[i].pad = 0;\n\t\t}\n\t\terr = uvesafb_setpalette(entries, cmap->len, cmap->start, info);\n\t\tkfree(entries);\n\t} else {\n\t\t/*\n\t\t * For modes with bpp > 8, we only set the pseudo palette in\n\t\t * the fb_info struct. We rely on uvesafb_setcolreg to do all\n\t\t * sanity checking.\n\t\t */\n\t\tfor (i = 0; i < cmap->len; i++) {\n\t\t\terr |= uvesafb_setcolreg(cmap->start + i, cmap->red[i],\n\t\t\t\t\t\tcmap->green[i], cmap->blue[i],\n\t\t\t\t\t\t0, info);\n\t\t}\n\t}\n\treturn err;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"uvesafb_setcmap","file_name":"drivers/video/fbdev/uvesafb.c","commit_link":"github.com/torvalds/linux/commit/9f645bcc566a1e9f921bdae7528a01ced5bc3713","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#16-dbb2414fe9f7","input":"static int b_unpack (lua_State *L) {\n Header h;\n const char *fmt = luaL_checkstring(L, 1);\n size_t ld;\n const char *data = luaL_checklstring(L, 2, &ld);\n size_t pos = luaL_optinteger(L, 3, 1) - 1;\n int n = 0; /* number of results */\n defaultoptions(&h);\n while (*fmt) {\n int opt = *fmt++;\n size_t size = optsize(L, opt, &fmt);\n pos += gettoalign(pos, &h, opt, size);\n luaL_argcheck(L, pos+size <= ld, 2, \"data string too short\");\n /* stack space for item + next position */\n luaL_checkstack(L, 2, \"too many results\");\n switch (opt) {\n case 'b': case 'B': case 'h': case 'H':\n case 'l': case 'L': case 'T': case 'i': case 'I': { /* integer types */\n int issigned = islower(opt);\n lua_Number res = getinteger(data+pos, h.endian, issigned, size);\n lua_pushnumber(L, res); n++;\n break;\n }\n case 'x': {\n break;\n }\n case 'f': {\n float f;\n memcpy(&f, data+pos, size);\n correctbytes((char *)&f, sizeof(f), h.endian);\n lua_pushnumber(L, f); n++;\n break;\n }\n case 'd': {\n double d;\n memcpy(&d, data+pos, size);\n correctbytes((char *)&d, sizeof(d), h.endian);\n lua_pushnumber(L, d); n++;\n break;\n }\n case 'c': {\n if (size == 0) {\n if (n == 0 || !lua_isnumber(L, -1))\n luaL_error(L, \"format 'c0' needs a previous size\");\n size = lua_tonumber(L, -1);\n lua_pop(L, 1); n--;\n luaL_argcheck(L, size <= ld && pos <= ld - size,\n 2, \"data string too short\");\n }\n lua_pushlstring(L, data+pos, size); n++;\n break;\n }\n case 's': {\n const char *e = (const char *)memchr(data+pos, '\\0', ld - pos);\n if (e == NULL)\n luaL_error(L, \"unfinished string in data\");\n size = (e - (data+pos)) + 1;\n lua_pushlstring(L, data+pos, size - 1); n++;\n break;\n }\n default: controloptions(L, opt, &fmt, &h);\n }\n pos += size;\n }\n lua_pushinteger(L, pos + 1); /* next position */\n return n + 1;\n}","target":"static int b_unpack (lua_State *L) {\n Header h;\n const char *fmt = luaL_checkstring(L, 1);\n size_t ld;\n const char *data = luaL_checklstring(L, 2, &ld);\n size_t pos = luaL_optinteger(L, 3, 1);\n luaL_argcheck(L, pos > 0, 3, \"offset must be 1 or greater\");\n pos--; /* Lua indexes are 1-based, but here we want 0-based for C\n * pointer math. */\n int n = 0; /* number of results */\n defaultoptions(&h);\n while (*fmt) {\n int opt = *fmt++;\n size_t size = optsize(L, opt, &fmt);\n pos += gettoalign(pos, &h, opt, size);\n luaL_argcheck(L, size <= ld && pos <= ld - size,\n 2, \"data string too short\");\n /* stack space for item + next position */\n luaL_checkstack(L, 2, \"too many results\");\n switch (opt) {\n case 'b': case 'B': case 'h': case 'H':\n case 'l': case 'L': case 'T': case 'i': case 'I': { /* integer types */\n int issigned = islower(opt);\n lua_Number res = getinteger(data+pos, h.endian, issigned, size);\n lua_pushnumber(L, res); n++;\n break;\n }\n case 'x': {\n break;\n }\n case 'f': {\n float f;\n memcpy(&f, data+pos, size);\n correctbytes((char *)&f, sizeof(f), h.endian);\n lua_pushnumber(L, f); n++;\n break;\n }\n case 'd': {\n double d;\n memcpy(&d, data+pos, size);\n correctbytes((char *)&d, sizeof(d), h.endian);\n lua_pushnumber(L, d); n++;\n break;\n }\n case 'c': {\n if (size == 0) {\n if (n == 0 || !lua_isnumber(L, -1))\n luaL_error(L, \"format 'c0' needs a previous size\");\n size = lua_tonumber(L, -1);\n lua_pop(L, 1); n--;\n luaL_argcheck(L, size <= ld && pos <= ld - size,\n 2, \"data string too short\");\n }\n lua_pushlstring(L, data+pos, size); n++;\n break;\n }\n case 's': {\n const char *e = (const char *)memchr(data+pos, '\\0', ld - pos);\n if (e == NULL)\n luaL_error(L, \"unfinished string in data\");\n size = (e - (data+pos)) + 1;\n lua_pushlstring(L, data+pos, size - 1); n++;\n break;\n }\n default: controloptions(L, opt, &fmt, &h);\n }\n pos += size;\n }\n lua_pushinteger(L, pos + 1); /* next position */\n return n + 1;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"b_unpack","file_name":"deps/lua/src/lua_struct.c","commit_link":"github.com/antirez/redis/commit/e89086e09a38cc6713bcd4b9c29abf92cf393936","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#17-d189ca95612d","input":"bool copyaudiodata (AFfilehandle infile, AFfilehandle outfile, int trackid)\n{\n\tint frameSize = afGetVirtualFrameSize(infile, trackid, 1);\n\n\tconst int kBufferFrameCount = 65536;\n\tvoid *buffer = malloc(kBufferFrameCount * frameSize);\n\n\tAFframecount totalFrames = afGetFrameCount(infile, AF_DEFAULT_TRACK);\n\tAFframecount totalFramesWritten = 0;\n\n\tbool success = true;\n\n\twhile (totalFramesWritten < totalFrames)\n\t{\n\t\tAFframecount framesToRead = totalFrames - totalFramesWritten;\n\t\tif (framesToRead > kBufferFrameCount)\n\t\t\tframesToRead = kBufferFrameCount;\n\n\t\tAFframecount framesRead = afReadFrames(infile, trackid, buffer,\n\t\t\tframesToRead);\n\n\t\tif (framesRead < framesToRead)\n\t\t{\n\t\t\tfprintf(stderr, \"Bad read of audio track data.\\n\");\n\t\t\tsuccess = false;\n\t\t\tbreak;\n\t\t}\n\n\t\tAFframecount framesWritten = afWriteFrames(outfile, trackid, buffer,\n\t\t\tframesRead);\n\n\t\tif (framesWritten < framesRead)\n\t\t{\n\t\t\tfprintf(stderr, \"Bad write of audio track data.\\n\");\n\t\t\tsuccess = false;\n\t\t\tbreak;\n\t\t}\n\n\t\ttotalFramesWritten += framesWritten;\n\t}\n\n\tfree(buffer);\n\n\treturn success;\n}","target":"bool copyaudiodata (AFfilehandle infile, AFfilehandle outfile, int trackid)\n{\n\tint frameSize = afGetVirtualFrameSize(infile, trackid, 1);\n\n\tint kBufferFrameCount = 65536;\n\tint bufferSize;\n\twhile (multiplyCheckOverflow(kBufferFrameCount, frameSize, &bufferSize))\n\t\tkBufferFrameCount /= 2;\n\tvoid *buffer = malloc(bufferSize);\n\n\tAFframecount totalFrames = afGetFrameCount(infile, AF_DEFAULT_TRACK);\n\tAFframecount totalFramesWritten = 0;\n\n\tbool success = true;\n\n\twhile (totalFramesWritten < totalFrames)\n\t{\n\t\tAFframecount framesToRead = totalFrames - totalFramesWritten;\n\t\tif (framesToRead > kBufferFrameCount)\n\t\t\tframesToRead = kBufferFrameCount;\n\n\t\tAFframecount framesRead = afReadFrames(infile, trackid, buffer,\n\t\t\tframesToRead);\n\n\t\tif (framesRead < framesToRead)\n\t\t{\n\t\t\tfprintf(stderr, \"Bad read of audio track data.\\n\");\n\t\t\tsuccess = false;\n\t\t\tbreak;\n\t\t}\n\n\t\tAFframecount framesWritten = afWriteFrames(outfile, trackid, buffer,\n\t\t\tframesRead);\n\n\t\tif (framesWritten < framesRead)\n\t\t{\n\t\t\tfprintf(stderr, \"Bad write of audio track data.\\n\");\n\t\t\tsuccess = false;\n\t\t\tbreak;\n\t\t}\n\n\t\ttotalFramesWritten += framesWritten;\n\t}\n\n\tfree(buffer);\n\n\treturn success;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"copyaudiodata","file_name":"sfcommands/sfconvert.c","commit_link":"github.com/antlarr/audiofile/commit/7d65f89defb092b63bcbc5d98349fb222ca73b3c","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#18-327f7d85d3c2","input":"ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)\n{\n\tGC_REFCOUNT(ht) = 1;\n\tGC_TYPE_INFO(ht) = IS_ARRAY;\n\tht->u.flags = (persistent ? HASH_FLAG_PERSISTENT : 0) | HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_STATIC_KEYS;\n\tht->nTableSize = zend_hash_check_size(nSize);\n\tht->nTableMask = HT_MIN_MASK;\n\tHT_SET_DATA_ADDR(ht, &uninitialized_bucket);\n\tht->nNumUsed = 0;\n\tht->nNumOfElements = 0;\n\tht->nInternalPointer = HT_INVALID_IDX;\n\tht->nNextFreeElement = 0;\n\tht->pDestructor = pDestructor;\n}","target":"ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)\n{\n\tGC_REFCOUNT(ht) = 1;\n\tGC_TYPE_INFO(ht) = IS_ARRAY;\n\tht->u.flags = (persistent ? HASH_FLAG_PERSISTENT : 0) | HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_STATIC_KEYS;\n\tht->nTableMask = HT_MIN_MASK;\n\tHT_SET_DATA_ADDR(ht, &uninitialized_bucket);\n\tht->nNumUsed = 0;\n\tht->nNumOfElements = 0;\n\tht->nInternalPointer = HT_INVALID_IDX;\n\tht->nNextFreeElement = 0;\n\tht->pDestructor = pDestructor;\n\tht->nTableSize = zend_hash_check_size(nSize);\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"_zend_hash_init","file_name":"Zend/zend_hash.c","commit_link":"github.com/php/php-src/commit/4cc0286f2f3780abc6084bcdae5dce595daa3c12","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#19-04842805da95","input":"REGEXP *\nPerl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,\n\t\t OP *expr, const regexp_engine* eng, REGEXP *old_re,\n\t\t bool *is_bare_re, const U32 orig_rx_flags, const U32 pm_flags)\n{\n dVAR;\n REGEXP *Rx; /* Capital 'R' means points to a REGEXP */\n STRLEN plen;\n char *exp;\n regnode *scan;\n I32 flags;\n SSize_t minlen = 0;\n U32 rx_flags;\n SV *pat;\n SV** new_patternp = patternp;\n\n /* these are all flags - maybe they should be turned\n * into a single int with different bit masks */\n I32 sawlookahead = 0;\n I32 sawplus = 0;\n I32 sawopen = 0;\n I32 sawminmod = 0;\n\n regex_charset initial_charset = get_regex_charset(orig_rx_flags);\n bool recompile = 0;\n bool runtime_code = 0;\n scan_data_t data;\n RExC_state_t RExC_state;\n RExC_state_t * const pRExC_state = &RExC_state;\n#ifdef TRIE_STUDY_OPT\n int restudied = 0;\n RExC_state_t copyRExC_state;\n#endif\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_RE_OP_COMPILE;\n\n DEBUG_r(if (!PL_colorset) reginitcolors());\n\n /* Initialize these here instead of as-needed, as is quick and avoids\n * having to test them each time otherwise */\n if (! PL_InBitmap) {\n#ifdef DEBUGGING\n char * dump_len_string;\n#endif\n\n /* This is calculated here, because the Perl program that generates the\n * static global ones doesn't currently have access to\n * NUM_ANYOF_CODE_POINTS */\n\tPL_InBitmap = _new_invlist(2);\n\tPL_InBitmap = _add_range_to_invlist(PL_InBitmap, 0,\n NUM_ANYOF_CODE_POINTS - 1);\n#ifdef DEBUGGING\n dump_len_string = PerlEnv_getenv(\"PERL_DUMP_RE_MAX_LEN\");\n if ( ! dump_len_string\n || ! grok_atoUV(dump_len_string, (UV *)&PL_dump_re_max_len, NULL))\n {\n PL_dump_re_max_len = 60; /* A reasonable default */\n }\n#endif\n }\n\n pRExC_state->warn_text = NULL;\n pRExC_state->unlexed_names = NULL;\n pRExC_state->code_blocks = NULL;\n\n if (is_bare_re)\n\t*is_bare_re = FALSE;\n\n if (expr && (expr->op_type == OP_LIST ||\n\t\t(expr->op_type == OP_NULL && expr->op_targ == OP_LIST))) {\n\t/* allocate code_blocks if needed */\n\tOP *o;\n\tint ncode = 0;\n\n\tfor (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o))\n\t if (o->op_type == OP_NULL && (o->op_flags & OPf_SPECIAL))\n\t\tncode++; /* count of DO blocks */\n\n\tif (ncode)\n pRExC_state->code_blocks = S_alloc_code_blocks(aTHX_ ncode);\n }\n\n if (!pat_count) {\n /* compile-time pattern with just OP_CONSTs and DO blocks */\n\n int n;\n OP *o;\n\n /* find how many CONSTs there are */\n assert(expr);\n n = 0;\n if (expr->op_type == OP_CONST)\n n = 1;\n else\n for (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o)) {\n if (o->op_type == OP_CONST)\n n++;\n }\n\n /* fake up an SV array */\n\n assert(!new_patternp);\n Newx(new_patternp, n, SV*);\n SAVEFREEPV(new_patternp);\n pat_count = n;\n\n n = 0;\n if (expr->op_type == OP_CONST)\n new_patternp[n] = cSVOPx_sv(expr);\n else\n for (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o)) {\n if (o->op_type == OP_CONST)\n new_patternp[n++] = cSVOPo_sv;\n }\n\n }\n\n DEBUG_PARSE_r(Perl_re_printf( aTHX_\n \"Assembling pattern from %d elements%s\\n\", pat_count,\n orig_rx_flags & RXf_SPLIT ? \" for split\" : \"\"));\n\n /* set expr to the first arg op */\n\n if (pRExC_state->code_blocks && pRExC_state->code_blocks->count\n && expr->op_type != OP_CONST)\n {\n expr = cLISTOPx(expr)->op_first;\n assert( expr->op_type == OP_PUSHMARK\n || (expr->op_type == OP_NULL && expr->op_targ == OP_PUSHMARK)\n || expr->op_type == OP_PADRANGE);\n expr = OpSIBLING(expr);\n }\n\n pat = S_concat_pat(aTHX_ pRExC_state, NULL, new_patternp, pat_count,\n expr, &recompile, NULL);\n\n /* handle bare (possibly after overloading) regex: foo =~ $re */\n {\n SV *re = pat;\n if (SvROK(re))\n re = SvRV(re);\n if (SvTYPE(re) == SVt_REGEXP) {\n if (is_bare_re)\n *is_bare_re = TRUE;\n SvREFCNT_inc(re);\n DEBUG_PARSE_r(Perl_re_printf( aTHX_\n \"Precompiled pattern%s\\n\",\n orig_rx_flags & RXf_SPLIT ? \" for split\" : \"\"));\n\n return (REGEXP*)re;\n }\n }\n\n exp = SvPV_nomg(pat, plen);\n\n if (!eng->op_comp) {\n\tif ((SvUTF8(pat) && IN_BYTES)\n\t\t|| SvGMAGICAL(pat) || SvAMAGIC(pat))\n\t{\n\t /* make a temporary copy; either to convert to bytes,\n\t * or to avoid repeating get-magic / overloaded stringify */\n\t pat = newSVpvn_flags(exp, plen, SVs_TEMP |\n\t\t\t\t\t(IN_BYTES ? 0 : SvUTF8(pat)));\n\t}\n\treturn CALLREGCOMP_ENG(eng, pat, orig_rx_flags);\n }\n\n /* ignore the utf8ness if the pattern is 0 length */\n RExC_utf8 = RExC_orig_utf8 = (plen == 0 || IN_BYTES) ? 0 : SvUTF8(pat);\n RExC_uni_semantics = 0;\n RExC_contains_locale = 0;\n RExC_strict = cBOOL(pm_flags & RXf_PMf_STRICT);\n RExC_in_script_run = 0;\n RExC_study_started = 0;\n pRExC_state->runtime_code_qr = NULL;\n RExC_frame_head= NULL;\n RExC_frame_last= NULL;\n RExC_frame_count= 0;\n RExC_latest_warn_offset = 0;\n RExC_use_BRANCHJ = 0;\n RExC_total_parens = 0;\n RExC_open_parens = NULL;\n RExC_close_parens = NULL;\n RExC_paren_names = NULL;\n RExC_size = 0;\n RExC_seen_d_op = FALSE;\n#ifdef DEBUGGING\n RExC_paren_name_list = NULL;\n#endif\n\n DEBUG_r({\n RExC_mysv1= sv_newmortal();\n RExC_mysv2= sv_newmortal();\n });\n\n DEBUG_COMPILE_r({\n SV *dsv= sv_newmortal();\n RE_PV_QUOTED_DECL(s, RExC_utf8, dsv, exp, plen, PL_dump_re_max_len);\n Perl_re_printf( aTHX_ \"%sCompiling REx%s %s\\n\",\n PL_colors[4], PL_colors[5], s);\n });\n\n /* we jump here if we have to recompile, e.g., from upgrading the pattern\n * to utf8 */\n\n if ((pm_flags & PMf_USE_RE_EVAL)\n\t\t/* this second condition covers the non-regex literal case,\n\t\t * i.e. $foo =~ '(?{})'. */\n\t\t|| (IN_PERL_COMPILETIME && (PL_hints & HINT_RE_EVAL))\n )\n\truntime_code = S_has_runtime_code(aTHX_ pRExC_state, exp, plen);\n\n redo_parse:\n /* return old regex if pattern hasn't changed */\n /* XXX: note in the below we have to check the flags as well as the\n * pattern.\n *\n * Things get a touch tricky as we have to compare the utf8 flag\n * independently from the compile flags. */\n\n if ( old_re\n && !recompile\n && !!RX_UTF8(old_re) == !!RExC_utf8\n && ( RX_COMPFLAGS(old_re) == ( orig_rx_flags & RXf_PMf_FLAGCOPYMASK ) )\n\t&& RX_PRECOMP(old_re)\n\t&& RX_PRELEN(old_re) == plen\n && memEQ(RX_PRECOMP(old_re), exp, plen)\n\t&& !runtime_code /* with runtime code, always recompile */ )\n {\n return old_re;\n }\n\n /* Allocate the pattern's SV */\n RExC_rx_sv = Rx = (REGEXP*) newSV_type(SVt_REGEXP);\n RExC_rx = ReANY(Rx);\n if ( RExC_rx == NULL )\n FAIL(\"Regexp out of space\");\n\n rx_flags = orig_rx_flags;\n\n if ( (UTF || RExC_uni_semantics)\n && initial_charset == REGEX_DEPENDS_CHARSET)\n {\n\n\t/* Set to use unicode semantics if the pattern is in utf8 and has the\n\t * 'depends' charset specified, as it means unicode when utf8 */\n\tset_regex_charset(&rx_flags, REGEX_UNICODE_CHARSET);\n RExC_uni_semantics = 1;\n }\n\n RExC_pm_flags = pm_flags;\n\n if (runtime_code) {\n assert(TAINTING_get || !TAINT_get);\n\tif (TAINT_get)\n\t Perl_croak(aTHX_ \"Eval-group in insecure regular expression\");\n\n\tif (!S_compile_runtime_code(aTHX_ pRExC_state, exp, plen)) {\n\t /* whoops, we have a non-utf8 pattern, whilst run-time code\n\t * got compiled as utf8. Try again with a utf8 pattern */\n S_pat_upgrade_to_utf8(aTHX_ pRExC_state, &exp, &plen,\n pRExC_state->code_blocks ? pRExC_state->code_blocks->count : 0);\n goto redo_parse;\n\t}\n }\n assert(!pRExC_state->runtime_code_qr);\n\n RExC_sawback = 0;\n\n RExC_seen = 0;\n RExC_maxlen = 0;\n RExC_in_lookbehind = 0;\n RExC_seen_zerolen = *exp == '^' ? -1 : 0;\n#ifdef EBCDIC\n RExC_recode_x_to_native = 0;\n#endif\n RExC_in_multi_char_class = 0;\n\n RExC_start = RExC_copy_start_in_constructed = RExC_copy_start_in_input = RExC_precomp = exp;\n RExC_precomp_end = RExC_end = exp + plen;\n RExC_nestroot = 0;\n RExC_whilem_seen = 0;\n RExC_end_op = NULL;\n RExC_recurse = NULL;\n RExC_study_chunk_recursed = NULL;\n RExC_study_chunk_recursed_bytes= 0;\n RExC_recurse_count = 0;\n pRExC_state->code_index = 0;\n\n /* Initialize the string in the compiled pattern. This is so that there is\n * something to output if necessary */\n set_regex_pv(pRExC_state, Rx);\n\n DEBUG_PARSE_r({\n Perl_re_printf( aTHX_\n \"Starting parse and generation\\n\");\n RExC_lastnum=0;\n RExC_lastparse=NULL;\n });\n\n /* Allocate space and zero-initialize. Note, the two step process\n of zeroing when in debug mode, thus anything assigned has to\n happen after that */\n if (! RExC_size) {\n\n /* On the first pass of the parse, we guess how big this will be. Then\n * we grow in one operation to that amount and then give it back. As\n * we go along, we re-allocate what we need.\n *\n * XXX Currently the guess is essentially that the pattern will be an\n * EXACT node with one byte input, one byte output. This is crude, and\n * better heuristics are welcome.\n *\n * On any subsequent passes, we guess what we actually computed in the\n * latest earlier pass. Such a pass probably didn't complete so is\n * missing stuff. We could improve those guesses by knowing where the\n * parse stopped, and use the length so far plus apply the above\n * assumption to what's left. */\n RExC_size = STR_SZ(RExC_end - RExC_start);\n }\n\n Newxc(RExC_rxi, sizeof(regexp_internal) + RExC_size, char, regexp_internal);\n if ( RExC_rxi == NULL )\n FAIL(\"Regexp out of space\");\n\n Zero(RExC_rxi, sizeof(regexp_internal) + RExC_size, char);\n RXi_SET( RExC_rx, RExC_rxi );\n\n /* We start from 0 (over from 0 in the case this is a reparse. The first\n * node parsed will give back any excess memory we have allocated so far).\n * */\n RExC_size = 0;\n\n /* non-zero initialization begins here */\n RExC_rx->engine= eng;\n RExC_rx->extflags = rx_flags;\n RXp_COMPFLAGS(RExC_rx) = orig_rx_flags & RXf_PMf_FLAGCOPYMASK;\n\n if (pm_flags & PMf_IS_QR) {\n\tRExC_rxi->code_blocks = pRExC_state->code_blocks;\n if (RExC_rxi->code_blocks) {\n RExC_rxi->code_blocks->refcnt++;\n }\n }\n\n RExC_rx->intflags = 0;\n\n RExC_flags = rx_flags;\t/* don't let top level (?i) bleed */\n RExC_parse = exp;\n\n /* This NUL is guaranteed because the pattern comes from an SV*, and the sv\n * code makes sure the final byte is an uncounted NUL. But should this\n * ever not be the case, lots of things could read beyond the end of the\n * buffer: loops like\n * while(isFOO(*RExC_parse)) RExC_parse++;\n * strchr(RExC_parse, \"foo\");\n * etc. So it is worth noting. */\n assert(*RExC_end == '\\0');\n\n RExC_naughty = 0;\n RExC_npar = 1;\n RExC_parens_buf_size = 0;\n RExC_emit_start = RExC_rxi->program;\n pRExC_state->code_index = 0;\n\n *((char*) RExC_emit_start) = (char) REG_MAGIC;\n RExC_emit = 1;\n\n /* Do the parse */\n if (reg(pRExC_state, 0, &flags, 1)) {\n\n /* Success!, But we may need to redo the parse knowing how many parens\n * there actually are */\n if (IN_PARENS_PASS) {\n flags |= RESTART_PARSE;\n }\n\n /* We have that number in RExC_npar */\n RExC_total_parens = RExC_npar;\n }\n else if (! MUST_RESTART(flags)) {\n\tReREFCNT_dec(Rx);\n Perl_croak(aTHX_ \"panic: reg returned failure to re_op_compile, flags=%#\" UVxf, (UV) flags);\n }\n\n /* Here, we either have success, or we have to redo the parse for some reason */\n if (MUST_RESTART(flags)) {\n\n /* It's possible to write a regexp in ascii that represents Unicode\n codepoints outside of the byte range, such as via \\x{100}. If we\n detect such a sequence we have to convert the entire pattern to utf8\n and then recompile, as our sizing calculation will have been based\n on 1 byte == 1 character, but we will need to use utf8 to encode\n at least some part of the pattern, and therefore must convert the whole\n thing.\n -- dmq */\n if (flags & NEED_UTF8) {\n\n /* We have stored the offset of the final warning output so far.\n * That must be adjusted. Any variant characters between the start\n * of the pattern and this warning count for 2 bytes in the final,\n * so just add them again */\n if (UNLIKELY(RExC_latest_warn_offset > 0)) {\n RExC_latest_warn_offset +=\n variant_under_utf8_count((U8 *) exp, (U8 *) exp\n + RExC_latest_warn_offset);\n }\n S_pat_upgrade_to_utf8(aTHX_ pRExC_state, &exp, &plen,\n pRExC_state->code_blocks ? pRExC_state->code_blocks->count : 0);\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"Need to redo parse after upgrade\\n\"));\n }\n else {\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"Need to redo parse\\n\"));\n }\n\n if (ALL_PARENS_COUNTED) {\n /* Make enough room for all the known parens, and zero it */\n Renew(RExC_open_parens, RExC_total_parens, regnode_offset);\n Zero(RExC_open_parens, RExC_total_parens, regnode_offset);\n RExC_open_parens[0] = 1; /* +1 for REG_MAGIC */\n\n Renew(RExC_close_parens, RExC_total_parens, regnode_offset);\n Zero(RExC_close_parens, RExC_total_parens, regnode_offset);\n }\n else { /* Parse did not complete. Reinitialize the parentheses\n structures */\n RExC_total_parens = 0;\n if (RExC_open_parens) {\n Safefree(RExC_open_parens);\n RExC_open_parens = NULL;\n }\n if (RExC_close_parens) {\n Safefree(RExC_close_parens);\n RExC_close_parens = NULL;\n }\n }\n\n /* Clean up what we did in this parse */\n SvREFCNT_dec_NN(RExC_rx_sv);\n\n goto redo_parse;\n }\n\n /* Here, we have successfully parsed and generated the pattern's program\n * for the regex engine. We are ready to finish things up and look for\n * optimizations. */\n\n /* Update the string to compile, with correct modifiers, etc */\n set_regex_pv(pRExC_state, Rx);\n\n RExC_rx->nparens = RExC_total_parens - 1;\n\n /* Uses the upper 4 bits of the FLAGS field, so keep within that size */\n if (RExC_whilem_seen > 15)\n RExC_whilem_seen = 15;\n\n DEBUG_PARSE_r({\n Perl_re_printf( aTHX_\n \"Required size %\" IVdf \" nodes\\n\", (IV)RExC_size);\n RExC_lastnum=0;\n RExC_lastparse=NULL;\n });\n\n#ifdef RE_TRACK_PATTERN_OFFSETS\n DEBUG_OFFSETS_r(Perl_re_printf( aTHX_\n \"%s %\" UVuf \" bytes for offset annotations.\\n\",\n RExC_offsets ? \"Got\" : \"Couldn't get\",\n (UV)((RExC_offsets[0] * 2 + 1))));\n DEBUG_OFFSETS_r(if (RExC_offsets) {\n const STRLEN len = RExC_offsets[0];\n STRLEN i;\n GET_RE_DEBUG_FLAGS_DECL;\n Perl_re_printf( aTHX_\n \"Offsets: [%\" UVuf \"]\\n\\t\", (UV)RExC_offsets[0]);\n for (i = 1; i <= len; i++) {\n if (RExC_offsets[i*2-1] || RExC_offsets[i*2])\n Perl_re_printf( aTHX_ \"%\" UVuf \":%\" UVuf \"[%\" UVuf \"] \",\n (UV)i, (UV)RExC_offsets[i*2-1], (UV)RExC_offsets[i*2]);\n }\n Perl_re_printf( aTHX_ \"\\n\");\n });\n\n#else\n SetProgLen(RExC_rxi,RExC_size);\n#endif\n\n DEBUG_OPTIMISE_r(\n Perl_re_printf( aTHX_ \"Starting post parse optimization\\n\");\n );\n\n /* XXXX To minimize changes to RE engine we always allocate\n 3-units-long substrs field. */\n Newx(RExC_rx->substrs, 1, struct reg_substr_data);\n if (RExC_recurse_count) {\n Newx(RExC_recurse, RExC_recurse_count, regnode *);\n SAVEFREEPV(RExC_recurse);\n }\n\n if (RExC_seen & REG_RECURSE_SEEN) {\n /* Note, RExC_total_parens is 1 + the number of parens in a pattern.\n * So its 1 if there are no parens. */\n RExC_study_chunk_recursed_bytes= (RExC_total_parens >> 3) +\n ((RExC_total_parens & 0x07) != 0);\n Newx(RExC_study_chunk_recursed,\n RExC_study_chunk_recursed_bytes * RExC_total_parens, U8);\n SAVEFREEPV(RExC_study_chunk_recursed);\n }\n\n reStudy:\n RExC_rx->minlen = minlen = sawlookahead = sawplus = sawopen = sawminmod = 0;\n DEBUG_r(\n RExC_study_chunk_recursed_count= 0;\n );\n Zero(RExC_rx->substrs, 1, struct reg_substr_data);\n if (RExC_study_chunk_recursed) {\n Zero(RExC_study_chunk_recursed,\n RExC_study_chunk_recursed_bytes * RExC_total_parens, U8);\n }\n\n\n#ifdef TRIE_STUDY_OPT\n if (!restudied) {\n StructCopy(&zero_scan_data, &data, scan_data_t);\n copyRExC_state = RExC_state;\n } else {\n U32 seen=RExC_seen;\n DEBUG_OPTIMISE_r(Perl_re_printf( aTHX_ \"Restudying\\n\"));\n\n RExC_state = copyRExC_state;\n if (seen & REG_TOP_LEVEL_BRANCHES_SEEN)\n RExC_seen |= REG_TOP_LEVEL_BRANCHES_SEEN;\n else\n RExC_seen &= ~REG_TOP_LEVEL_BRANCHES_SEEN;\n\tStructCopy(&zero_scan_data, &data, scan_data_t);\n }\n#else\n StructCopy(&zero_scan_data, &data, scan_data_t);\n#endif\n\n /* Dig out information for optimizations. */\n RExC_rx->extflags = RExC_flags; /* was pm_op */\n /*dmq: removed as part of de-PMOP: pm->op_pmflags = RExC_flags; */\n\n if (UTF)\n\tSvUTF8_on(Rx);\t/* Unicode in it? */\n RExC_rxi->regstclass = NULL;\n if (RExC_naughty >= TOO_NAUGHTY)\t/* Probably an expensive pattern. */\n\tRExC_rx->intflags |= PREGf_NAUGHTY;\n scan = RExC_rxi->program + 1;\t\t/* First BRANCH. */\n\n /* testing for BRANCH here tells us whether there is \"must appear\"\n data in the pattern. If there is then we can use it for optimisations */\n if (!(RExC_seen & REG_TOP_LEVEL_BRANCHES_SEEN)) { /* Only one top-level choice.\n */\n\tSSize_t fake;\n\tSTRLEN longest_length[2];\n\tregnode_ssc ch_class; /* pointed to by data */\n\tint stclass_flag;\n\tSSize_t last_close = 0; /* pointed to by data */\n regnode *first= scan;\n regnode *first_next= regnext(first);\n int i;\n\n\t/*\n\t * Skip introductions and multiplicators >= 1\n\t * so that we can extract the 'meat' of the pattern that must\n\t * match in the large if() sequence following.\n\t * NOTE that EXACT is NOT covered here, as it is normally\n\t * picked up by the optimiser separately.\n\t *\n\t * This is unfortunate as the optimiser isnt handling lookahead\n\t * properly currently.\n\t *\n\t */\n\twhile ((OP(first) == OPEN && (sawopen = 1)) ||\n\t /* An OR of *one* alternative - should not happen now. */\n\t (OP(first) == BRANCH && OP(first_next) != BRANCH) ||\n\t /* for now we can't handle lookbehind IFMATCH*/\n\t (OP(first) == IFMATCH && !first->flags && (sawlookahead = 1)) ||\n\t (OP(first) == PLUS) ||\n\t (OP(first) == MINMOD) ||\n\t /* An {n,m} with n>0 */\n\t (PL_regkind[OP(first)] == CURLY && ARG1(first) > 0) ||\n\t (OP(first) == NOTHING && PL_regkind[OP(first_next)] != END ))\n\t{\n\t\t/*\n\t\t * the only op that could be a regnode is PLUS, all the rest\n\t\t * will be regnode_1 or regnode_2.\n\t\t *\n * (yves doesn't think this is true)\n\t\t */\n\t\tif (OP(first) == PLUS)\n\t\t sawplus = 1;\n else {\n if (OP(first) == MINMOD)\n sawminmod = 1;\n\t\t first += regarglen[OP(first)];\n }\n\t\tfirst = NEXTOPER(first);\n\t\tfirst_next= regnext(first);\n\t}\n\n\t/* Starting-point info. */\n again:\n DEBUG_PEEP(\"first:\", first, 0, 0);\n /* Ignore EXACT as we deal with it later. */\n\tif (PL_regkind[OP(first)] == EXACT) {\n\t if ( OP(first) == EXACT\n || OP(first) == EXACT_ONLY8\n || OP(first) == EXACTL)\n {\n\t\tNOOP;\t/* Empty, get anchored substr later. */\n }\n\t else\n\t\tRExC_rxi->regstclass = first;\n\t}\n#ifdef TRIE_STCLASS\n\telse if (PL_regkind[OP(first)] == TRIE &&\n\t ((reg_trie_data *)RExC_rxi->data->data[ ARG(first) ])->minlen>0)\n\t{\n /* this can happen only on restudy */\n RExC_rxi->regstclass = construct_ahocorasick_from_trie(pRExC_state, (regnode *)first, 0);\n\t}\n#endif\n\telse if (REGNODE_SIMPLE(OP(first)))\n\t RExC_rxi->regstclass = first;\n\telse if (PL_regkind[OP(first)] == BOUND ||\n\t\t PL_regkind[OP(first)] == NBOUND)\n\t RExC_rxi->regstclass = first;\n\telse if (PL_regkind[OP(first)] == BOL) {\n RExC_rx->intflags |= (OP(first) == MBOL\n ? PREGf_ANCH_MBOL\n : PREGf_ANCH_SBOL);\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n\telse if (OP(first) == GPOS) {\n RExC_rx->intflags |= PREGf_ANCH_GPOS;\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n\telse if ((!sawopen || !RExC_sawback) &&\n !sawlookahead &&\n\t (OP(first) == STAR &&\n\t PL_regkind[OP(NEXTOPER(first))] == REG_ANY) &&\n !(RExC_rx->intflags & PREGf_ANCH) && !pRExC_state->code_blocks)\n\t{\n\t /* turn .* into ^.* with an implied $*=1 */\n\t const int type =\n\t\t(OP(NEXTOPER(first)) == REG_ANY)\n ? PREGf_ANCH_MBOL\n : PREGf_ANCH_SBOL;\n RExC_rx->intflags |= (type | PREGf_IMPLICIT);\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n if (sawplus && !sawminmod && !sawlookahead\n && (!sawopen || !RExC_sawback)\n\t && !pRExC_state->code_blocks) /* May examine pos and $& */\n\t /* x+ must match at the 1st pos of run of x's */\n\t RExC_rx->intflags |= PREGf_SKIP;\n\n\t/* Scan is after the zeroth branch, first is atomic matcher. */\n#ifdef TRIE_STUDY_OPT\n\tDEBUG_PARSE_r(\n\t if (!restudied)\n Perl_re_printf( aTHX_ \"first at %\" IVdf \"\\n\",\n\t\t\t (IV)(first - scan + 1))\n );\n#else\n\tDEBUG_PARSE_r(\n Perl_re_printf( aTHX_ \"first at %\" IVdf \"\\n\",\n\t (IV)(first - scan + 1))\n );\n#endif\n\n\n\t/*\n\t* If there's something expensive in the r.e., find the\n\t* longest literal string that must appear and make it the\n\t* regmust. Resolve ties in favor of later strings, since\n\t* the regstart check works with the beginning of the r.e.\n\t* and avoiding duplication strengthens checking. Not a\n\t* strong reason, but sufficient in the absence of others.\n\t* [Now we resolve ties in favor of the earlier string if\n\t* it happens that c_offset_min has been invalidated, since the\n\t* earlier string may buy us something the later one won't.]\n\t*/\n\n\tdata.substrs[0].str = newSVpvs(\"\");\n\tdata.substrs[1].str = newSVpvs(\"\");\n\tdata.last_found = newSVpvs(\"\");\n\tdata.cur_is_floating = 0; /* initially any found substring is fixed */\n\tENTER_with_name(\"study_chunk\");\n\tSAVEFREESV(data.substrs[0].str);\n\tSAVEFREESV(data.substrs[1].str);\n\tSAVEFREESV(data.last_found);\n\tfirst = scan;\n\tif (!RExC_rxi->regstclass) {\n\t ssc_init(pRExC_state, &ch_class);\n\t data.start_class = &ch_class;\n\t stclass_flag = SCF_DO_STCLASS_AND;\n\t} else\t\t\t\t/* XXXX Check for BOUND? */\n\t stclass_flag = 0;\n\tdata.last_closep = &last_close;\n\n DEBUG_RExC_seen();\n /*\n * MAIN ENTRY FOR study_chunk() FOR m/PATTERN/\n * (NO top level branches)\n */\n\tminlen = study_chunk(pRExC_state, &first, &minlen, &fake,\n scan + RExC_size, /* Up to end */\n &data, -1, 0, NULL,\n SCF_DO_SUBSTR | SCF_WHILEM_VISITED_POS | stclass_flag\n | (restudied ? SCF_TRIE_DOING_RESTUDY : 0),\n 0);\n\n\n CHECK_RESTUDY_GOTO_butfirst(LEAVE_with_name(\"study_chunk\"));\n\n\n\tif ( RExC_total_parens == 1 && !data.cur_is_floating\n\t && data.last_start_min == 0 && data.last_end > 0\n\t && !RExC_seen_zerolen\n && !(RExC_seen & REG_VERBARG_SEEN)\n && !(RExC_seen & REG_GPOS_SEEN)\n ){\n\t RExC_rx->extflags |= RXf_CHECK_ALL;\n }\n\tscan_commit(pRExC_state, &data,&minlen, 0);\n\n\n /* XXX this is done in reverse order because that's the way the\n * code was before it was parameterised. Don't know whether it\n * actually needs doing in reverse order. DAPM */\n for (i = 1; i >= 0; i--) {\n longest_length[i] = CHR_SVLEN(data.substrs[i].str);\n\n if ( !( i\n && SvCUR(data.substrs[0].str) /* ok to leave SvCUR */\n && data.substrs[0].min_offset\n == data.substrs[1].min_offset\n && SvCUR(data.substrs[0].str)\n == SvCUR(data.substrs[1].str)\n )\n && S_setup_longest (aTHX_ pRExC_state,\n &(RExC_rx->substrs->data[i]),\n &(data.substrs[i]),\n longest_length[i]))\n {\n RExC_rx->substrs->data[i].min_offset =\n data.substrs[i].min_offset - data.substrs[i].lookbehind;\n\n RExC_rx->substrs->data[i].max_offset = data.substrs[i].max_offset;\n /* Don't offset infinity */\n if (data.substrs[i].max_offset < SSize_t_MAX)\n RExC_rx->substrs->data[i].max_offset -= data.substrs[i].lookbehind;\n SvREFCNT_inc_simple_void_NN(data.substrs[i].str);\n }\n else {\n RExC_rx->substrs->data[i].substr = NULL;\n RExC_rx->substrs->data[i].utf8_substr = NULL;\n longest_length[i] = 0;\n }\n }\n\n\tLEAVE_with_name(\"study_chunk\");\n\n\tif (RExC_rxi->regstclass\n\t && (OP(RExC_rxi->regstclass) == REG_ANY || OP(RExC_rxi->regstclass) == SANY))\n\t RExC_rxi->regstclass = NULL;\n\n\tif ((!(RExC_rx->substrs->data[0].substr || RExC_rx->substrs->data[0].utf8_substr)\n || RExC_rx->substrs->data[0].min_offset)\n\t && stclass_flag\n && ! (ANYOF_FLAGS(data.start_class) & SSC_MATCHES_EMPTY_STRING)\n\t && is_ssc_worth_it(pRExC_state, data.start_class))\n\t{\n\t const U32 n = add_data(pRExC_state, STR_WITH_LEN(\"f\"));\n\n ssc_finalize(pRExC_state, data.start_class);\n\n\t Newx(RExC_rxi->data->data[n], 1, regnode_ssc);\n\t StructCopy(data.start_class,\n\t\t (regnode_ssc*)RExC_rxi->data->data[n],\n\t\t regnode_ssc);\n\t RExC_rxi->regstclass = (regnode*)RExC_rxi->data->data[n];\n\t RExC_rx->intflags &= ~PREGf_SKIP;\t/* Used in find_byclass(). */\n\t DEBUG_COMPILE_r({ SV *sv = sv_newmortal();\n regprop(RExC_rx, sv, (regnode*)data.start_class, NULL, pRExC_state);\n Perl_re_printf( aTHX_\n\t\t\t\t \"synthetic stclass \\\"%s\\\".\\n\",\n\t\t\t\t SvPVX_const(sv));});\n data.start_class = NULL;\n\t}\n\n /* A temporary algorithm prefers floated substr to fixed one of\n * same length to dig more info. */\n\ti = (longest_length[0] <= longest_length[1]);\n RExC_rx->substrs->check_ix = i;\n RExC_rx->check_end_shift = RExC_rx->substrs->data[i].end_shift;\n RExC_rx->check_substr = RExC_rx->substrs->data[i].substr;\n RExC_rx->check_utf8 = RExC_rx->substrs->data[i].utf8_substr;\n RExC_rx->check_offset_min = RExC_rx->substrs->data[i].min_offset;\n RExC_rx->check_offset_max = RExC_rx->substrs->data[i].max_offset;\n if (!i && (RExC_rx->intflags & (PREGf_ANCH_SBOL|PREGf_ANCH_GPOS)))\n RExC_rx->intflags |= PREGf_NOSCAN;\n\n\tif ((RExC_rx->check_substr || RExC_rx->check_utf8) ) {\n\t RExC_rx->extflags |= RXf_USE_INTUIT;\n\t if (SvTAIL(RExC_rx->check_substr ? RExC_rx->check_substr : RExC_rx->check_utf8))\n\t\tRExC_rx->extflags |= RXf_INTUIT_TAIL;\n\t}\n\n\t/* XXX Unneeded? dmq (shouldn't as this is handled elsewhere)\n\tif ( (STRLEN)minlen < longest_length[1] )\n minlen= longest_length[1];\n if ( (STRLEN)minlen < longest_length[0] )\n minlen= longest_length[0];\n */\n }\n else {\n\t/* Several toplevels. Best we can is to set minlen. */\n\tSSize_t fake;\n\tregnode_ssc ch_class;\n\tSSize_t last_close = 0;\n\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"\\nMulti Top Level\\n\"));\n\n\tscan = RExC_rxi->program + 1;\n\tssc_init(pRExC_state, &ch_class);\n\tdata.start_class = &ch_class;\n\tdata.last_closep = &last_close;\n\n DEBUG_RExC_seen();\n /*\n * MAIN ENTRY FOR study_chunk() FOR m/P1|P2|.../\n * (patterns WITH top level branches)\n */\n\tminlen = study_chunk(pRExC_state,\n &scan, &minlen, &fake, scan + RExC_size, &data, -1, 0, NULL,\n SCF_DO_STCLASS_AND|SCF_WHILEM_VISITED_POS|(restudied\n ? SCF_TRIE_DOING_RESTUDY\n : 0),\n 0);\n\n CHECK_RESTUDY_GOTO_butfirst(NOOP);\n\n\tRExC_rx->check_substr = NULL;\n RExC_rx->check_utf8 = NULL;\n RExC_rx->substrs->data[0].substr = NULL;\n RExC_rx->substrs->data[0].utf8_substr = NULL;\n RExC_rx->substrs->data[1].substr = NULL;\n RExC_rx->substrs->data[1].utf8_substr = NULL;\n\n if (! (ANYOF_FLAGS(data.start_class) & SSC_MATCHES_EMPTY_STRING)\n\t && is_ssc_worth_it(pRExC_state, data.start_class))\n {\n\t const U32 n = add_data(pRExC_state, STR_WITH_LEN(\"f\"));\n\n ssc_finalize(pRExC_state, data.start_class);\n\n\t Newx(RExC_rxi->data->data[n], 1, regnode_ssc);\n\t StructCopy(data.start_class,\n\t\t (regnode_ssc*)RExC_rxi->data->data[n],\n\t\t regnode_ssc);\n\t RExC_rxi->regstclass = (regnode*)RExC_rxi->data->data[n];\n\t RExC_rx->intflags &= ~PREGf_SKIP;\t/* Used in find_byclass(). */\n\t DEBUG_COMPILE_r({ SV* sv = sv_newmortal();\n regprop(RExC_rx, sv, (regnode*)data.start_class, NULL, pRExC_state);\n Perl_re_printf( aTHX_\n\t\t\t\t \"synthetic stclass \\\"%s\\\".\\n\",\n\t\t\t\t SvPVX_const(sv));});\n data.start_class = NULL;\n\t}\n }\n\n if (RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN) {\n RExC_rx->extflags |= RXf_UNBOUNDED_QUANTIFIER_SEEN;\n RExC_rx->maxlen = REG_INFTY;\n }\n else {\n RExC_rx->maxlen = RExC_maxlen;\n }\n\n /* Guard against an embedded (?=) or (?<=) with a longer minlen than\n the \"real\" pattern. */\n DEBUG_OPTIMISE_r({\n Perl_re_printf( aTHX_ \"minlen: %\" IVdf \" RExC_rx->minlen:%\" IVdf \" maxlen:%\" IVdf \"\\n\",\n (IV)minlen, (IV)RExC_rx->minlen, (IV)RExC_maxlen);\n });\n RExC_rx->minlenret = minlen;\n if (RExC_rx->minlen < minlen)\n RExC_rx->minlen = minlen;\n\n if (RExC_seen & REG_RECURSE_SEEN ) {\n RExC_rx->intflags |= PREGf_RECURSE_SEEN;\n Newx(RExC_rx->recurse_locinput, RExC_rx->nparens + 1, char *);\n }\n if (RExC_seen & REG_GPOS_SEEN)\n RExC_rx->intflags |= PREGf_GPOS_SEEN;\n if (RExC_seen & REG_LOOKBEHIND_SEEN)\n RExC_rx->extflags |= RXf_NO_INPLACE_SUBST; /* inplace might break the\n lookbehind */\n if (pRExC_state->code_blocks)\n\tRExC_rx->extflags |= RXf_EVAL_SEEN;\n if (RExC_seen & REG_VERBARG_SEEN)\n {\n\tRExC_rx->intflags |= PREGf_VERBARG_SEEN;\n RExC_rx->extflags |= RXf_NO_INPLACE_SUBST; /* don't understand this! Yves */\n }\n if (RExC_seen & REG_CUTGROUP_SEEN)\n\tRExC_rx->intflags |= PREGf_CUTGROUP_SEEN;\n if (pm_flags & PMf_USE_RE_EVAL)\n\tRExC_rx->intflags |= PREGf_USE_RE_EVAL;\n if (RExC_paren_names)\n RXp_PAREN_NAMES(RExC_rx) = MUTABLE_HV(SvREFCNT_inc(RExC_paren_names));\n else\n RXp_PAREN_NAMES(RExC_rx) = NULL;\n\n /* If we have seen an anchor in our pattern then we set the extflag RXf_IS_ANCHORED\n * so it can be used in pp.c */\n if (RExC_rx->intflags & PREGf_ANCH)\n RExC_rx->extflags |= RXf_IS_ANCHORED;\n\n\n {\n /* this is used to identify \"special\" patterns that might result\n * in Perl NOT calling the regex engine and instead doing the match \"itself\",\n * particularly special cases in split//. By having the regex compiler\n * do this pattern matching at a regop level (instead of by inspecting the pattern)\n * we avoid weird issues with equivalent patterns resulting in different behavior,\n * AND we allow non Perl engines to get the same optimizations by the setting the\n * flags appropriately - Yves */\n regnode *first = RExC_rxi->program + 1;\n U8 fop = OP(first);\n regnode *next = regnext(first);\n U8 nop = OP(next);\n\n if (PL_regkind[fop] == NOTHING && nop == END)\n RExC_rx->extflags |= RXf_NULL;\n else if ((fop == MBOL || (fop == SBOL && !first->flags)) && nop == END)\n /* when fop is SBOL first->flags will be true only when it was\n * produced by parsing /\\A/, and not when parsing /^/. This is\n * very important for the split code as there we want to\n * treat /^/ as /^/m, but we do not want to treat /\\A/ as /^/m.\n * See rt #122761 for more details. -- Yves */\n RExC_rx->extflags |= RXf_START_ONLY;\n else if (fop == PLUS\n && PL_regkind[nop] == POSIXD && FLAGS(next) == _CC_SPACE\n && nop == END)\n RExC_rx->extflags |= RXf_WHITE;\n else if ( RExC_rx->extflags & RXf_SPLIT\n && (fop == EXACT || fop == EXACT_ONLY8 || fop == EXACTL)\n && STR_LEN(first) == 1\n && *(STRING(first)) == ' '\n && nop == END )\n RExC_rx->extflags |= (RXf_SKIPWHITE|RXf_WHITE);\n\n }\n\n if (RExC_contains_locale) {\n RXp_EXTFLAGS(RExC_rx) |= RXf_TAINTED;\n }\n\n#ifdef DEBUGGING\n if (RExC_paren_names) {\n RExC_rxi->name_list_idx = add_data( pRExC_state, STR_WITH_LEN(\"a\"));\n RExC_rxi->data->data[RExC_rxi->name_list_idx]\n = (void*)SvREFCNT_inc(RExC_paren_name_list);\n } else\n#endif\n RExC_rxi->name_list_idx = 0;\n\n while ( RExC_recurse_count > 0 ) {\n const regnode *scan = RExC_recurse[ --RExC_recurse_count ];\n /*\n * This data structure is set up in study_chunk() and is used\n * to calculate the distance between a GOSUB regopcode and\n * the OPEN/CURLYM (CURLYM's are special and can act like OPEN's)\n * it refers to.\n *\n * If for some reason someone writes code that optimises\n * away a GOSUB opcode then the assert should be changed to\n * an if(scan) to guard the ARG2L_SET() - Yves\n *\n */\n assert(scan && OP(scan) == GOSUB);\n ARG2L_SET( scan, RExC_open_parens[ARG(scan)] - REGNODE_OFFSET(scan));\n }\n\n Newxz(RExC_rx->offs, RExC_total_parens, regexp_paren_pair);\n /* assume we don't need to swap parens around before we match */\n DEBUG_TEST_r({\n Perl_re_printf( aTHX_ \"study_chunk_recursed_count: %lu\\n\",\n (unsigned long)RExC_study_chunk_recursed_count);\n });\n DEBUG_DUMP_r({\n DEBUG_RExC_seen();\n Perl_re_printf( aTHX_ \"Final program:\\n\");\n regdump(RExC_rx);\n });\n\n if (RExC_open_parens) {\n Safefree(RExC_open_parens);\n RExC_open_parens = NULL;\n }\n if (RExC_close_parens) {\n Safefree(RExC_close_parens);\n RExC_close_parens = NULL;\n }\n\n#ifdef USE_ITHREADS\n /* under ithreads the ?pat? PMf_USED flag on the pmop is simulated\n * by setting the regexp SV to readonly-only instead. If the\n * pattern's been recompiled, the USEDness should remain. */\n if (old_re && SvREADONLY(old_re))\n SvREADONLY_on(Rx);\n#endif\n return Rx;","target":"REGEXP *\nPerl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,\n\t\t OP *expr, const regexp_engine* eng, REGEXP *old_re,\n\t\t bool *is_bare_re, const U32 orig_rx_flags, const U32 pm_flags)\n{\n dVAR;\n REGEXP *Rx; /* Capital 'R' means points to a REGEXP */\n STRLEN plen;\n char *exp;\n regnode *scan;\n I32 flags;\n SSize_t minlen = 0;\n U32 rx_flags;\n SV *pat;\n SV** new_patternp = patternp;\n\n /* these are all flags - maybe they should be turned\n * into a single int with different bit masks */\n I32 sawlookahead = 0;\n I32 sawplus = 0;\n I32 sawopen = 0;\n I32 sawminmod = 0;\n\n regex_charset initial_charset = get_regex_charset(orig_rx_flags);\n bool recompile = 0;\n bool runtime_code = 0;\n scan_data_t data;\n RExC_state_t RExC_state;\n RExC_state_t * const pRExC_state = &RExC_state;\n#ifdef TRIE_STUDY_OPT\n int restudied = 0;\n RExC_state_t copyRExC_state;\n#endif\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_RE_OP_COMPILE;\n\n DEBUG_r(if (!PL_colorset) reginitcolors());\n\n /* Initialize these here instead of as-needed, as is quick and avoids\n * having to test them each time otherwise */\n if (! PL_InBitmap) {\n#ifdef DEBUGGING\n char * dump_len_string;\n#endif\n\n /* This is calculated here, because the Perl program that generates the\n * static global ones doesn't currently have access to\n * NUM_ANYOF_CODE_POINTS */\n\tPL_InBitmap = _new_invlist(2);\n\tPL_InBitmap = _add_range_to_invlist(PL_InBitmap, 0,\n NUM_ANYOF_CODE_POINTS - 1);\n#ifdef DEBUGGING\n dump_len_string = PerlEnv_getenv(\"PERL_DUMP_RE_MAX_LEN\");\n if ( ! dump_len_string\n || ! grok_atoUV(dump_len_string, (UV *)&PL_dump_re_max_len, NULL))\n {\n PL_dump_re_max_len = 60; /* A reasonable default */\n }\n#endif\n }\n\n pRExC_state->warn_text = NULL;\n pRExC_state->unlexed_names = NULL;\n pRExC_state->code_blocks = NULL;\n\n if (is_bare_re)\n\t*is_bare_re = FALSE;\n\n if (expr && (expr->op_type == OP_LIST ||\n\t\t(expr->op_type == OP_NULL && expr->op_targ == OP_LIST))) {\n\t/* allocate code_blocks if needed */\n\tOP *o;\n\tint ncode = 0;\n\n\tfor (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o))\n\t if (o->op_type == OP_NULL && (o->op_flags & OPf_SPECIAL))\n\t\tncode++; /* count of DO blocks */\n\n\tif (ncode)\n pRExC_state->code_blocks = S_alloc_code_blocks(aTHX_ ncode);\n }\n\n if (!pat_count) {\n /* compile-time pattern with just OP_CONSTs and DO blocks */\n\n int n;\n OP *o;\n\n /* find how many CONSTs there are */\n assert(expr);\n n = 0;\n if (expr->op_type == OP_CONST)\n n = 1;\n else\n for (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o)) {\n if (o->op_type == OP_CONST)\n n++;\n }\n\n /* fake up an SV array */\n\n assert(!new_patternp);\n Newx(new_patternp, n, SV*);\n SAVEFREEPV(new_patternp);\n pat_count = n;\n\n n = 0;\n if (expr->op_type == OP_CONST)\n new_patternp[n] = cSVOPx_sv(expr);\n else\n for (o = cLISTOPx(expr)->op_first; o; o = OpSIBLING(o)) {\n if (o->op_type == OP_CONST)\n new_patternp[n++] = cSVOPo_sv;\n }\n\n }\n\n DEBUG_PARSE_r(Perl_re_printf( aTHX_\n \"Assembling pattern from %d elements%s\\n\", pat_count,\n orig_rx_flags & RXf_SPLIT ? \" for split\" : \"\"));\n\n /* set expr to the first arg op */\n\n if (pRExC_state->code_blocks && pRExC_state->code_blocks->count\n && expr->op_type != OP_CONST)\n {\n expr = cLISTOPx(expr)->op_first;\n assert( expr->op_type == OP_PUSHMARK\n || (expr->op_type == OP_NULL && expr->op_targ == OP_PUSHMARK)\n || expr->op_type == OP_PADRANGE);\n expr = OpSIBLING(expr);\n }\n\n pat = S_concat_pat(aTHX_ pRExC_state, NULL, new_patternp, pat_count,\n expr, &recompile, NULL);\n\n /* handle bare (possibly after overloading) regex: foo =~ $re */\n {\n SV *re = pat;\n if (SvROK(re))\n re = SvRV(re);\n if (SvTYPE(re) == SVt_REGEXP) {\n if (is_bare_re)\n *is_bare_re = TRUE;\n SvREFCNT_inc(re);\n DEBUG_PARSE_r(Perl_re_printf( aTHX_\n \"Precompiled pattern%s\\n\",\n orig_rx_flags & RXf_SPLIT ? \" for split\" : \"\"));\n\n return (REGEXP*)re;\n }\n }\n\n exp = SvPV_nomg(pat, plen);\n\n if (!eng->op_comp) {\n\tif ((SvUTF8(pat) && IN_BYTES)\n\t\t|| SvGMAGICAL(pat) || SvAMAGIC(pat))\n\t{\n\t /* make a temporary copy; either to convert to bytes,\n\t * or to avoid repeating get-magic / overloaded stringify */\n\t pat = newSVpvn_flags(exp, plen, SVs_TEMP |\n\t\t\t\t\t(IN_BYTES ? 0 : SvUTF8(pat)));\n\t}\n\treturn CALLREGCOMP_ENG(eng, pat, orig_rx_flags);\n }\n\n /* ignore the utf8ness if the pattern is 0 length */\n RExC_utf8 = RExC_orig_utf8 = (plen == 0 || IN_BYTES) ? 0 : SvUTF8(pat);\n RExC_uni_semantics = 0;\n RExC_contains_locale = 0;\n RExC_strict = cBOOL(pm_flags & RXf_PMf_STRICT);\n RExC_in_script_run = 0;\n RExC_study_started = 0;\n pRExC_state->runtime_code_qr = NULL;\n RExC_frame_head= NULL;\n RExC_frame_last= NULL;\n RExC_frame_count= 0;\n RExC_latest_warn_offset = 0;\n RExC_use_BRANCHJ = 0;\n RExC_total_parens = 0;\n RExC_open_parens = NULL;\n RExC_close_parens = NULL;\n RExC_paren_names = NULL;\n RExC_size = 0;\n RExC_seen_d_op = FALSE;\n#ifdef DEBUGGING\n RExC_paren_name_list = NULL;\n#endif\n\n DEBUG_r({\n RExC_mysv1= sv_newmortal();\n RExC_mysv2= sv_newmortal();\n });\n\n DEBUG_COMPILE_r({\n SV *dsv= sv_newmortal();\n RE_PV_QUOTED_DECL(s, RExC_utf8, dsv, exp, plen, PL_dump_re_max_len);\n Perl_re_printf( aTHX_ \"%sCompiling REx%s %s\\n\",\n PL_colors[4], PL_colors[5], s);\n });\n\n /* we jump here if we have to recompile, e.g., from upgrading the pattern\n * to utf8 */\n\n if ((pm_flags & PMf_USE_RE_EVAL)\n\t\t/* this second condition covers the non-regex literal case,\n\t\t * i.e. $foo =~ '(?{})'. */\n\t\t|| (IN_PERL_COMPILETIME && (PL_hints & HINT_RE_EVAL))\n )\n\truntime_code = S_has_runtime_code(aTHX_ pRExC_state, exp, plen);\n\n redo_parse:\n /* return old regex if pattern hasn't changed */\n /* XXX: note in the below we have to check the flags as well as the\n * pattern.\n *\n * Things get a touch tricky as we have to compare the utf8 flag\n * independently from the compile flags. */\n\n if ( old_re\n && !recompile\n && !!RX_UTF8(old_re) == !!RExC_utf8\n && ( RX_COMPFLAGS(old_re) == ( orig_rx_flags & RXf_PMf_FLAGCOPYMASK ) )\n\t&& RX_PRECOMP(old_re)\n\t&& RX_PRELEN(old_re) == plen\n && memEQ(RX_PRECOMP(old_re), exp, plen)\n\t&& !runtime_code /* with runtime code, always recompile */ )\n {\n return old_re;\n }\n\n /* Allocate the pattern's SV */\n RExC_rx_sv = Rx = (REGEXP*) newSV_type(SVt_REGEXP);\n RExC_rx = ReANY(Rx);\n if ( RExC_rx == NULL )\n FAIL(\"Regexp out of space\");\n\n rx_flags = orig_rx_flags;\n\n if ( (UTF || RExC_uni_semantics)\n && initial_charset == REGEX_DEPENDS_CHARSET)\n {\n\n\t/* Set to use unicode semantics if the pattern is in utf8 and has the\n\t * 'depends' charset specified, as it means unicode when utf8 */\n\tset_regex_charset(&rx_flags, REGEX_UNICODE_CHARSET);\n RExC_uni_semantics = 1;\n }\n\n RExC_pm_flags = pm_flags;\n\n if (runtime_code) {\n assert(TAINTING_get || !TAINT_get);\n\tif (TAINT_get)\n\t Perl_croak(aTHX_ \"Eval-group in insecure regular expression\");\n\n\tif (!S_compile_runtime_code(aTHX_ pRExC_state, exp, plen)) {\n\t /* whoops, we have a non-utf8 pattern, whilst run-time code\n\t * got compiled as utf8. Try again with a utf8 pattern */\n S_pat_upgrade_to_utf8(aTHX_ pRExC_state, &exp, &plen,\n pRExC_state->code_blocks ? pRExC_state->code_blocks->count : 0);\n goto redo_parse;\n\t}\n }\n assert(!pRExC_state->runtime_code_qr);\n\n RExC_sawback = 0;\n\n RExC_seen = 0;\n RExC_maxlen = 0;\n RExC_in_lookbehind = 0;\n RExC_seen_zerolen = *exp == '^' ? -1 : 0;\n#ifdef EBCDIC\n RExC_recode_x_to_native = 0;\n#endif\n RExC_in_multi_char_class = 0;\n\n RExC_start = RExC_copy_start_in_constructed = RExC_copy_start_in_input = RExC_precomp = exp;\n RExC_precomp_end = RExC_end = exp + plen;\n RExC_nestroot = 0;\n RExC_whilem_seen = 0;\n RExC_end_op = NULL;\n RExC_recurse = NULL;\n RExC_study_chunk_recursed = NULL;\n RExC_study_chunk_recursed_bytes= 0;\n RExC_recurse_count = 0;\n pRExC_state->code_index = 0;\n\n /* Initialize the string in the compiled pattern. This is so that there is\n * something to output if necessary */\n set_regex_pv(pRExC_state, Rx);\n\n DEBUG_PARSE_r({\n Perl_re_printf( aTHX_\n \"Starting parse and generation\\n\");\n RExC_lastnum=0;\n RExC_lastparse=NULL;\n });\n\n /* Allocate space and zero-initialize. Note, the two step process\n of zeroing when in debug mode, thus anything assigned has to\n happen after that */\n if (! RExC_size) {\n\n /* On the first pass of the parse, we guess how big this will be. Then\n * we grow in one operation to that amount and then give it back. As\n * we go along, we re-allocate what we need.\n *\n * XXX Currently the guess is essentially that the pattern will be an\n * EXACT node with one byte input, one byte output. This is crude, and\n * better heuristics are welcome.\n *\n * On any subsequent passes, we guess what we actually computed in the\n * latest earlier pass. Such a pass probably didn't complete so is\n * missing stuff. We could improve those guesses by knowing where the\n * parse stopped, and use the length so far plus apply the above\n * assumption to what's left. */\n RExC_size = STR_SZ(RExC_end - RExC_start);\n }\n\n Newxc(RExC_rxi, sizeof(regexp_internal) + RExC_size, char, regexp_internal);\n if ( RExC_rxi == NULL )\n FAIL(\"Regexp out of space\");\n\n Zero(RExC_rxi, sizeof(regexp_internal) + RExC_size, char);\n RXi_SET( RExC_rx, RExC_rxi );\n\n /* We start from 0 (over from 0 in the case this is a reparse. The first\n * node parsed will give back any excess memory we have allocated so far).\n * */\n RExC_size = 0;\n\n /* non-zero initialization begins here */\n RExC_rx->engine= eng;\n RExC_rx->extflags = rx_flags;\n RXp_COMPFLAGS(RExC_rx) = orig_rx_flags & RXf_PMf_FLAGCOPYMASK;\n\n if (pm_flags & PMf_IS_QR) {\n\tRExC_rxi->code_blocks = pRExC_state->code_blocks;\n if (RExC_rxi->code_blocks) {\n RExC_rxi->code_blocks->refcnt++;\n }\n }\n\n RExC_rx->intflags = 0;\n\n RExC_flags = rx_flags;\t/* don't let top level (?i) bleed */\n RExC_parse = exp;\n\n /* This NUL is guaranteed because the pattern comes from an SV*, and the sv\n * code makes sure the final byte is an uncounted NUL. But should this\n * ever not be the case, lots of things could read beyond the end of the\n * buffer: loops like\n * while(isFOO(*RExC_parse)) RExC_parse++;\n * strchr(RExC_parse, \"foo\");\n * etc. So it is worth noting. */\n assert(*RExC_end == '\\0');\n\n RExC_naughty = 0;\n RExC_npar = 1;\n RExC_parens_buf_size = 0;\n RExC_emit_start = RExC_rxi->program;\n pRExC_state->code_index = 0;\n\n *((char*) RExC_emit_start) = (char) REG_MAGIC;\n RExC_emit = 1;\n\n /* Do the parse */\n if (reg(pRExC_state, 0, &flags, 1)) {\n\n /* Success!, But we may need to redo the parse knowing how many parens\n * there actually are */\n if (IN_PARENS_PASS) {\n flags |= RESTART_PARSE;\n }\n\n /* We have that number in RExC_npar */\n RExC_total_parens = RExC_npar;\n\n /* XXX For backporting, use long jumps if there is any possibility of\n * overflow */\n if (RExC_size > U16_MAX && ! RExC_use_BRANCHJ) {\n RExC_use_BRANCHJ = TRUE;\n flags |= RESTART_PARSE;\n }\n }\n else if (! MUST_RESTART(flags)) {\n\tReREFCNT_dec(Rx);\n Perl_croak(aTHX_ \"panic: reg returned failure to re_op_compile, flags=%#\" UVxf, (UV) flags);\n }\n\n /* Here, we either have success, or we have to redo the parse for some reason */\n if (MUST_RESTART(flags)) {\n\n /* It's possible to write a regexp in ascii that represents Unicode\n codepoints outside of the byte range, such as via \\x{100}. If we\n detect such a sequence we have to convert the entire pattern to utf8\n and then recompile, as our sizing calculation will have been based\n on 1 byte == 1 character, but we will need to use utf8 to encode\n at least some part of the pattern, and therefore must convert the whole\n thing.\n -- dmq */\n if (flags & NEED_UTF8) {\n\n /* We have stored the offset of the final warning output so far.\n * That must be adjusted. Any variant characters between the start\n * of the pattern and this warning count for 2 bytes in the final,\n * so just add them again */\n if (UNLIKELY(RExC_latest_warn_offset > 0)) {\n RExC_latest_warn_offset +=\n variant_under_utf8_count((U8 *) exp, (U8 *) exp\n + RExC_latest_warn_offset);\n }\n S_pat_upgrade_to_utf8(aTHX_ pRExC_state, &exp, &plen,\n pRExC_state->code_blocks ? pRExC_state->code_blocks->count : 0);\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"Need to redo parse after upgrade\\n\"));\n }\n else {\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"Need to redo parse\\n\"));\n }\n\n if (ALL_PARENS_COUNTED) {\n /* Make enough room for all the known parens, and zero it */\n Renew(RExC_open_parens, RExC_total_parens, regnode_offset);\n Zero(RExC_open_parens, RExC_total_parens, regnode_offset);\n RExC_open_parens[0] = 1; /* +1 for REG_MAGIC */\n\n Renew(RExC_close_parens, RExC_total_parens, regnode_offset);\n Zero(RExC_close_parens, RExC_total_parens, regnode_offset);\n }\n else { /* Parse did not complete. Reinitialize the parentheses\n structures */\n RExC_total_parens = 0;\n if (RExC_open_parens) {\n Safefree(RExC_open_parens);\n RExC_open_parens = NULL;\n }\n if (RExC_close_parens) {\n Safefree(RExC_close_parens);\n RExC_close_parens = NULL;\n }\n }\n\n /* Clean up what we did in this parse */\n SvREFCNT_dec_NN(RExC_rx_sv);\n\n goto redo_parse;\n }\n\n /* Here, we have successfully parsed and generated the pattern's program\n * for the regex engine. We are ready to finish things up and look for\n * optimizations. */\n\n /* Update the string to compile, with correct modifiers, etc */\n set_regex_pv(pRExC_state, Rx);\n\n RExC_rx->nparens = RExC_total_parens - 1;\n\n /* Uses the upper 4 bits of the FLAGS field, so keep within that size */\n if (RExC_whilem_seen > 15)\n RExC_whilem_seen = 15;\n\n DEBUG_PARSE_r({\n Perl_re_printf( aTHX_\n \"Required size %\" IVdf \" nodes\\n\", (IV)RExC_size);\n RExC_lastnum=0;\n RExC_lastparse=NULL;\n });\n\n#ifdef RE_TRACK_PATTERN_OFFSETS\n DEBUG_OFFSETS_r(Perl_re_printf( aTHX_\n \"%s %\" UVuf \" bytes for offset annotations.\\n\",\n RExC_offsets ? \"Got\" : \"Couldn't get\",\n (UV)((RExC_offsets[0] * 2 + 1))));\n DEBUG_OFFSETS_r(if (RExC_offsets) {\n const STRLEN len = RExC_offsets[0];\n STRLEN i;\n GET_RE_DEBUG_FLAGS_DECL;\n Perl_re_printf( aTHX_\n \"Offsets: [%\" UVuf \"]\\n\\t\", (UV)RExC_offsets[0]);\n for (i = 1; i <= len; i++) {\n if (RExC_offsets[i*2-1] || RExC_offsets[i*2])\n Perl_re_printf( aTHX_ \"%\" UVuf \":%\" UVuf \"[%\" UVuf \"] \",\n (UV)i, (UV)RExC_offsets[i*2-1], (UV)RExC_offsets[i*2]);\n }\n Perl_re_printf( aTHX_ \"\\n\");\n });\n\n#else\n SetProgLen(RExC_rxi,RExC_size);\n#endif\n\n DEBUG_OPTIMISE_r(\n Perl_re_printf( aTHX_ \"Starting post parse optimization\\n\");\n );\n\n /* XXXX To minimize changes to RE engine we always allocate\n 3-units-long substrs field. */\n Newx(RExC_rx->substrs, 1, struct reg_substr_data);\n if (RExC_recurse_count) {\n Newx(RExC_recurse, RExC_recurse_count, regnode *);\n SAVEFREEPV(RExC_recurse);\n }\n\n if (RExC_seen & REG_RECURSE_SEEN) {\n /* Note, RExC_total_parens is 1 + the number of parens in a pattern.\n * So its 1 if there are no parens. */\n RExC_study_chunk_recursed_bytes= (RExC_total_parens >> 3) +\n ((RExC_total_parens & 0x07) != 0);\n Newx(RExC_study_chunk_recursed,\n RExC_study_chunk_recursed_bytes * RExC_total_parens, U8);\n SAVEFREEPV(RExC_study_chunk_recursed);\n }\n\n reStudy:\n RExC_rx->minlen = minlen = sawlookahead = sawplus = sawopen = sawminmod = 0;\n DEBUG_r(\n RExC_study_chunk_recursed_count= 0;\n );\n Zero(RExC_rx->substrs, 1, struct reg_substr_data);\n if (RExC_study_chunk_recursed) {\n Zero(RExC_study_chunk_recursed,\n RExC_study_chunk_recursed_bytes * RExC_total_parens, U8);\n }\n\n\n#ifdef TRIE_STUDY_OPT\n if (!restudied) {\n StructCopy(&zero_scan_data, &data, scan_data_t);\n copyRExC_state = RExC_state;\n } else {\n U32 seen=RExC_seen;\n DEBUG_OPTIMISE_r(Perl_re_printf( aTHX_ \"Restudying\\n\"));\n\n RExC_state = copyRExC_state;\n if (seen & REG_TOP_LEVEL_BRANCHES_SEEN)\n RExC_seen |= REG_TOP_LEVEL_BRANCHES_SEEN;\n else\n RExC_seen &= ~REG_TOP_LEVEL_BRANCHES_SEEN;\n\tStructCopy(&zero_scan_data, &data, scan_data_t);\n }\n#else\n StructCopy(&zero_scan_data, &data, scan_data_t);\n#endif\n\n /* Dig out information for optimizations. */\n RExC_rx->extflags = RExC_flags; /* was pm_op */\n /*dmq: removed as part of de-PMOP: pm->op_pmflags = RExC_flags; */\n\n if (UTF)\n\tSvUTF8_on(Rx);\t/* Unicode in it? */\n RExC_rxi->regstclass = NULL;\n if (RExC_naughty >= TOO_NAUGHTY)\t/* Probably an expensive pattern. */\n\tRExC_rx->intflags |= PREGf_NAUGHTY;\n scan = RExC_rxi->program + 1;\t\t/* First BRANCH. */\n\n /* testing for BRANCH here tells us whether there is \"must appear\"\n data in the pattern. If there is then we can use it for optimisations */\n if (!(RExC_seen & REG_TOP_LEVEL_BRANCHES_SEEN)) { /* Only one top-level choice.\n */\n\tSSize_t fake;\n\tSTRLEN longest_length[2];\n\tregnode_ssc ch_class; /* pointed to by data */\n\tint stclass_flag;\n\tSSize_t last_close = 0; /* pointed to by data */\n regnode *first= scan;\n regnode *first_next= regnext(first);\n int i;\n\n\t/*\n\t * Skip introductions and multiplicators >= 1\n\t * so that we can extract the 'meat' of the pattern that must\n\t * match in the large if() sequence following.\n\t * NOTE that EXACT is NOT covered here, as it is normally\n\t * picked up by the optimiser separately.\n\t *\n\t * This is unfortunate as the optimiser isnt handling lookahead\n\t * properly currently.\n\t *\n\t */\n\twhile ((OP(first) == OPEN && (sawopen = 1)) ||\n\t /* An OR of *one* alternative - should not happen now. */\n\t (OP(first) == BRANCH && OP(first_next) != BRANCH) ||\n\t /* for now we can't handle lookbehind IFMATCH*/\n\t (OP(first) == IFMATCH && !first->flags && (sawlookahead = 1)) ||\n\t (OP(first) == PLUS) ||\n\t (OP(first) == MINMOD) ||\n\t /* An {n,m} with n>0 */\n\t (PL_regkind[OP(first)] == CURLY && ARG1(first) > 0) ||\n\t (OP(first) == NOTHING && PL_regkind[OP(first_next)] != END ))\n\t{\n\t\t/*\n\t\t * the only op that could be a regnode is PLUS, all the rest\n\t\t * will be regnode_1 or regnode_2.\n\t\t *\n * (yves doesn't think this is true)\n\t\t */\n\t\tif (OP(first) == PLUS)\n\t\t sawplus = 1;\n else {\n if (OP(first) == MINMOD)\n sawminmod = 1;\n\t\t first += regarglen[OP(first)];\n }\n\t\tfirst = NEXTOPER(first);\n\t\tfirst_next= regnext(first);\n\t}\n\n\t/* Starting-point info. */\n again:\n DEBUG_PEEP(\"first:\", first, 0, 0);\n /* Ignore EXACT as we deal with it later. */\n\tif (PL_regkind[OP(first)] == EXACT) {\n\t if ( OP(first) == EXACT\n || OP(first) == EXACT_ONLY8\n || OP(first) == EXACTL)\n {\n\t\tNOOP;\t/* Empty, get anchored substr later. */\n }\n\t else\n\t\tRExC_rxi->regstclass = first;\n\t}\n#ifdef TRIE_STCLASS\n\telse if (PL_regkind[OP(first)] == TRIE &&\n\t ((reg_trie_data *)RExC_rxi->data->data[ ARG(first) ])->minlen>0)\n\t{\n /* this can happen only on restudy */\n RExC_rxi->regstclass = construct_ahocorasick_from_trie(pRExC_state, (regnode *)first, 0);\n\t}\n#endif\n\telse if (REGNODE_SIMPLE(OP(first)))\n\t RExC_rxi->regstclass = first;\n\telse if (PL_regkind[OP(first)] == BOUND ||\n\t\t PL_regkind[OP(first)] == NBOUND)\n\t RExC_rxi->regstclass = first;\n\telse if (PL_regkind[OP(first)] == BOL) {\n RExC_rx->intflags |= (OP(first) == MBOL\n ? PREGf_ANCH_MBOL\n : PREGf_ANCH_SBOL);\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n\telse if (OP(first) == GPOS) {\n RExC_rx->intflags |= PREGf_ANCH_GPOS;\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n\telse if ((!sawopen || !RExC_sawback) &&\n !sawlookahead &&\n\t (OP(first) == STAR &&\n\t PL_regkind[OP(NEXTOPER(first))] == REG_ANY) &&\n !(RExC_rx->intflags & PREGf_ANCH) && !pRExC_state->code_blocks)\n\t{\n\t /* turn .* into ^.* with an implied $*=1 */\n\t const int type =\n\t\t(OP(NEXTOPER(first)) == REG_ANY)\n ? PREGf_ANCH_MBOL\n : PREGf_ANCH_SBOL;\n RExC_rx->intflags |= (type | PREGf_IMPLICIT);\n\t first = NEXTOPER(first);\n\t goto again;\n\t}\n if (sawplus && !sawminmod && !sawlookahead\n && (!sawopen || !RExC_sawback)\n\t && !pRExC_state->code_blocks) /* May examine pos and $& */\n\t /* x+ must match at the 1st pos of run of x's */\n\t RExC_rx->intflags |= PREGf_SKIP;\n\n\t/* Scan is after the zeroth branch, first is atomic matcher. */\n#ifdef TRIE_STUDY_OPT\n\tDEBUG_PARSE_r(\n\t if (!restudied)\n Perl_re_printf( aTHX_ \"first at %\" IVdf \"\\n\",\n\t\t\t (IV)(first - scan + 1))\n );\n#else\n\tDEBUG_PARSE_r(\n Perl_re_printf( aTHX_ \"first at %\" IVdf \"\\n\",\n\t (IV)(first - scan + 1))\n );\n#endif\n\n\n\t/*\n\t* If there's something expensive in the r.e., find the\n\t* longest literal string that must appear and make it the\n\t* regmust. Resolve ties in favor of later strings, since\n\t* the regstart check works with the beginning of the r.e.\n\t* and avoiding duplication strengthens checking. Not a\n\t* strong reason, but sufficient in the absence of others.\n\t* [Now we resolve ties in favor of the earlier string if\n\t* it happens that c_offset_min has been invalidated, since the\n\t* earlier string may buy us something the later one won't.]\n\t*/\n\n\tdata.substrs[0].str = newSVpvs(\"\");\n\tdata.substrs[1].str = newSVpvs(\"\");\n\tdata.last_found = newSVpvs(\"\");\n\tdata.cur_is_floating = 0; /* initially any found substring is fixed */\n\tENTER_with_name(\"study_chunk\");\n\tSAVEFREESV(data.substrs[0].str);\n\tSAVEFREESV(data.substrs[1].str);\n\tSAVEFREESV(data.last_found);\n\tfirst = scan;\n\tif (!RExC_rxi->regstclass) {\n\t ssc_init(pRExC_state, &ch_class);\n\t data.start_class = &ch_class;\n\t stclass_flag = SCF_DO_STCLASS_AND;\n\t} else\t\t\t\t/* XXXX Check for BOUND? */\n\t stclass_flag = 0;\n\tdata.last_closep = &last_close;\n\n DEBUG_RExC_seen();\n /*\n * MAIN ENTRY FOR study_chunk() FOR m/PATTERN/\n * (NO top level branches)\n */\n\tminlen = study_chunk(pRExC_state, &first, &minlen, &fake,\n scan + RExC_size, /* Up to end */\n &data, -1, 0, NULL,\n SCF_DO_SUBSTR | SCF_WHILEM_VISITED_POS | stclass_flag\n | (restudied ? SCF_TRIE_DOING_RESTUDY : 0),\n 0);\n\n\n CHECK_RESTUDY_GOTO_butfirst(LEAVE_with_name(\"study_chunk\"));\n\n\n\tif ( RExC_total_parens == 1 && !data.cur_is_floating\n\t && data.last_start_min == 0 && data.last_end > 0\n\t && !RExC_seen_zerolen\n && !(RExC_seen & REG_VERBARG_SEEN)\n && !(RExC_seen & REG_GPOS_SEEN)\n ){\n\t RExC_rx->extflags |= RXf_CHECK_ALL;\n }\n\tscan_commit(pRExC_state, &data,&minlen, 0);\n\n\n /* XXX this is done in reverse order because that's the way the\n * code was before it was parameterised. Don't know whether it\n * actually needs doing in reverse order. DAPM */\n for (i = 1; i >= 0; i--) {\n longest_length[i] = CHR_SVLEN(data.substrs[i].str);\n\n if ( !( i\n && SvCUR(data.substrs[0].str) /* ok to leave SvCUR */\n && data.substrs[0].min_offset\n == data.substrs[1].min_offset\n && SvCUR(data.substrs[0].str)\n == SvCUR(data.substrs[1].str)\n )\n && S_setup_longest (aTHX_ pRExC_state,\n &(RExC_rx->substrs->data[i]),\n &(data.substrs[i]),\n longest_length[i]))\n {\n RExC_rx->substrs->data[i].min_offset =\n data.substrs[i].min_offset - data.substrs[i].lookbehind;\n\n RExC_rx->substrs->data[i].max_offset = data.substrs[i].max_offset;\n /* Don't offset infinity */\n if (data.substrs[i].max_offset < SSize_t_MAX)\n RExC_rx->substrs->data[i].max_offset -= data.substrs[i].lookbehind;\n SvREFCNT_inc_simple_void_NN(data.substrs[i].str);\n }\n else {\n RExC_rx->substrs->data[i].substr = NULL;\n RExC_rx->substrs->data[i].utf8_substr = NULL;\n longest_length[i] = 0;\n }\n }\n\n\tLEAVE_with_name(\"study_chunk\");\n\n\tif (RExC_rxi->regstclass\n\t && (OP(RExC_rxi->regstclass) == REG_ANY || OP(RExC_rxi->regstclass) == SANY))\n\t RExC_rxi->regstclass = NULL;\n\n\tif ((!(RExC_rx->substrs->data[0].substr || RExC_rx->substrs->data[0].utf8_substr)\n || RExC_rx->substrs->data[0].min_offset)\n\t && stclass_flag\n && ! (ANYOF_FLAGS(data.start_class) & SSC_MATCHES_EMPTY_STRING)\n\t && is_ssc_worth_it(pRExC_state, data.start_class))\n\t{\n\t const U32 n = add_data(pRExC_state, STR_WITH_LEN(\"f\"));\n\n ssc_finalize(pRExC_state, data.start_class);\n\n\t Newx(RExC_rxi->data->data[n], 1, regnode_ssc);\n\t StructCopy(data.start_class,\n\t\t (regnode_ssc*)RExC_rxi->data->data[n],\n\t\t regnode_ssc);\n\t RExC_rxi->regstclass = (regnode*)RExC_rxi->data->data[n];\n\t RExC_rx->intflags &= ~PREGf_SKIP;\t/* Used in find_byclass(). */\n\t DEBUG_COMPILE_r({ SV *sv = sv_newmortal();\n regprop(RExC_rx, sv, (regnode*)data.start_class, NULL, pRExC_state);\n Perl_re_printf( aTHX_\n\t\t\t\t \"synthetic stclass \\\"%s\\\".\\n\",\n\t\t\t\t SvPVX_const(sv));});\n data.start_class = NULL;\n\t}\n\n /* A temporary algorithm prefers floated substr to fixed one of\n * same length to dig more info. */\n\ti = (longest_length[0] <= longest_length[1]);\n RExC_rx->substrs->check_ix = i;\n RExC_rx->check_end_shift = RExC_rx->substrs->data[i].end_shift;\n RExC_rx->check_substr = RExC_rx->substrs->data[i].substr;\n RExC_rx->check_utf8 = RExC_rx->substrs->data[i].utf8_substr;\n RExC_rx->check_offset_min = RExC_rx->substrs->data[i].min_offset;\n RExC_rx->check_offset_max = RExC_rx->substrs->data[i].max_offset;\n if (!i && (RExC_rx->intflags & (PREGf_ANCH_SBOL|PREGf_ANCH_GPOS)))\n RExC_rx->intflags |= PREGf_NOSCAN;\n\n\tif ((RExC_rx->check_substr || RExC_rx->check_utf8) ) {\n\t RExC_rx->extflags |= RXf_USE_INTUIT;\n\t if (SvTAIL(RExC_rx->check_substr ? RExC_rx->check_substr : RExC_rx->check_utf8))\n\t\tRExC_rx->extflags |= RXf_INTUIT_TAIL;\n\t}\n\n\t/* XXX Unneeded? dmq (shouldn't as this is handled elsewhere)\n\tif ( (STRLEN)minlen < longest_length[1] )\n minlen= longest_length[1];\n if ( (STRLEN)minlen < longest_length[0] )\n minlen= longest_length[0];\n */\n }\n else {\n\t/* Several toplevels. Best we can is to set minlen. */\n\tSSize_t fake;\n\tregnode_ssc ch_class;\n\tSSize_t last_close = 0;\n\n DEBUG_PARSE_r(Perl_re_printf( aTHX_ \"\\nMulti Top Level\\n\"));\n\n\tscan = RExC_rxi->program + 1;\n\tssc_init(pRExC_state, &ch_class);\n\tdata.start_class = &ch_class;\n\tdata.last_closep = &last_close;\n\n DEBUG_RExC_seen();\n /*\n * MAIN ENTRY FOR study_chunk() FOR m/P1|P2|.../\n * (patterns WITH top level branches)\n */\n\tminlen = study_chunk(pRExC_state,\n &scan, &minlen, &fake, scan + RExC_size, &data, -1, 0, NULL,\n SCF_DO_STCLASS_AND|SCF_WHILEM_VISITED_POS|(restudied\n ? SCF_TRIE_DOING_RESTUDY\n : 0),\n 0);\n\n CHECK_RESTUDY_GOTO_butfirst(NOOP);\n\n\tRExC_rx->check_substr = NULL;\n RExC_rx->check_utf8 = NULL;\n RExC_rx->substrs->data[0].substr = NULL;\n RExC_rx->substrs->data[0].utf8_substr = NULL;\n RExC_rx->substrs->data[1].substr = NULL;\n RExC_rx->substrs->data[1].utf8_substr = NULL;\n\n if (! (ANYOF_FLAGS(data.start_class) & SSC_MATCHES_EMPTY_STRING)\n\t && is_ssc_worth_it(pRExC_state, data.start_class))\n {\n\t const U32 n = add_data(pRExC_state, STR_WITH_LEN(\"f\"));\n\n ssc_finalize(pRExC_state, data.start_class);\n\n\t Newx(RExC_rxi->data->data[n], 1, regnode_ssc);\n\t StructCopy(data.start_class,\n\t\t (regnode_ssc*)RExC_rxi->data->data[n],\n\t\t regnode_ssc);\n\t RExC_rxi->regstclass = (regnode*)RExC_rxi->data->data[n];\n\t RExC_rx->intflags &= ~PREGf_SKIP;\t/* Used in find_byclass(). */\n\t DEBUG_COMPILE_r({ SV* sv = sv_newmortal();\n regprop(RExC_rx, sv, (regnode*)data.start_class, NULL, pRExC_state);\n Perl_re_printf( aTHX_\n\t\t\t\t \"synthetic stclass \\\"%s\\\".\\n\",\n\t\t\t\t SvPVX_const(sv));});\n data.start_class = NULL;\n\t}\n }\n\n if (RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN) {\n RExC_rx->extflags |= RXf_UNBOUNDED_QUANTIFIER_SEEN;\n RExC_rx->maxlen = REG_INFTY;\n }\n else {\n RExC_rx->maxlen = RExC_maxlen;\n }\n\n /* Guard against an embedded (?=) or (?<=) with a longer minlen than\n the \"real\" pattern. */\n DEBUG_OPTIMISE_r({\n Perl_re_printf( aTHX_ \"minlen: %\" IVdf \" RExC_rx->minlen:%\" IVdf \" maxlen:%\" IVdf \"\\n\",\n (IV)minlen, (IV)RExC_rx->minlen, (IV)RExC_maxlen);\n });\n RExC_rx->minlenret = minlen;\n if (RExC_rx->minlen < minlen)\n RExC_rx->minlen = minlen;\n\n if (RExC_seen & REG_RECURSE_SEEN ) {\n RExC_rx->intflags |= PREGf_RECURSE_SEEN;\n Newx(RExC_rx->recurse_locinput, RExC_rx->nparens + 1, char *);\n }\n if (RExC_seen & REG_GPOS_SEEN)\n RExC_rx->intflags |= PREGf_GPOS_SEEN;\n if (RExC_seen & REG_LOOKBEHIND_SEEN)\n RExC_rx->extflags |= RXf_NO_INPLACE_SUBST; /* inplace might break the\n lookbehind */\n if (pRExC_state->code_blocks)\n\tRExC_rx->extflags |= RXf_EVAL_SEEN;\n if (RExC_seen & REG_VERBARG_SEEN)\n {\n\tRExC_rx->intflags |= PREGf_VERBARG_SEEN;\n RExC_rx->extflags |= RXf_NO_INPLACE_SUBST; /* don't understand this! Yves */\n }\n if (RExC_seen & REG_CUTGROUP_SEEN)\n\tRExC_rx->intflags |= PREGf_CUTGROUP_SEEN;\n if (pm_flags & PMf_USE_RE_EVAL)\n\tRExC_rx->intflags |= PREGf_USE_RE_EVAL;\n if (RExC_paren_names)\n RXp_PAREN_NAMES(RExC_rx) = MUTABLE_HV(SvREFCNT_inc(RExC_paren_names));\n else\n RXp_PAREN_NAMES(RExC_rx) = NULL;\n\n /* If we have seen an anchor in our pattern then we set the extflag RXf_IS_ANCHORED\n * so it can be used in pp.c */\n if (RExC_rx->intflags & PREGf_ANCH)\n RExC_rx->extflags |= RXf_IS_ANCHORED;\n\n\n {\n /* this is used to identify \"special\" patterns that might result\n * in Perl NOT calling the regex engine and instead doing the match \"itself\",\n * particularly special cases in split//. By having the regex compiler\n * do this pattern matching at a regop level (instead of by inspecting the pattern)\n * we avoid weird issues with equivalent patterns resulting in different behavior,\n * AND we allow non Perl engines to get the same optimizations by the setting the\n * flags appropriately - Yves */\n regnode *first = RExC_rxi->program + 1;\n U8 fop = OP(first);\n regnode *next = regnext(first);\n U8 nop = OP(next);\n\n if (PL_regkind[fop] == NOTHING && nop == END)\n RExC_rx->extflags |= RXf_NULL;\n else if ((fop == MBOL || (fop == SBOL && !first->flags)) && nop == END)\n /* when fop is SBOL first->flags will be true only when it was\n * produced by parsing /\\A/, and not when parsing /^/. This is\n * very important for the split code as there we want to\n * treat /^/ as /^/m, but we do not want to treat /\\A/ as /^/m.\n * See rt #122761 for more details. -- Yves */\n RExC_rx->extflags |= RXf_START_ONLY;\n else if (fop == PLUS\n && PL_regkind[nop] == POSIXD && FLAGS(next) == _CC_SPACE\n && nop == END)\n RExC_rx->extflags |= RXf_WHITE;\n else if ( RExC_rx->extflags & RXf_SPLIT\n && (fop == EXACT || fop == EXACT_ONLY8 || fop == EXACTL)\n && STR_LEN(first) == 1\n && *(STRING(first)) == ' '\n && nop == END )\n RExC_rx->extflags |= (RXf_SKIPWHITE|RXf_WHITE);\n\n }\n\n if (RExC_contains_locale) {\n RXp_EXTFLAGS(RExC_rx) |= RXf_TAINTED;\n }\n\n#ifdef DEBUGGING\n if (RExC_paren_names) {\n RExC_rxi->name_list_idx = add_data( pRExC_state, STR_WITH_LEN(\"a\"));\n RExC_rxi->data->data[RExC_rxi->name_list_idx]\n = (void*)SvREFCNT_inc(RExC_paren_name_list);\n } else\n#endif\n RExC_rxi->name_list_idx = 0;\n\n while ( RExC_recurse_count > 0 ) {\n const regnode *scan = RExC_recurse[ --RExC_recurse_count ];\n /*\n * This data structure is set up in study_chunk() and is used\n * to calculate the distance between a GOSUB regopcode and\n * the OPEN/CURLYM (CURLYM's are special and can act like OPEN's)\n * it refers to.\n *\n * If for some reason someone writes code that optimises\n * away a GOSUB opcode then the assert should be changed to\n * an if(scan) to guard the ARG2L_SET() - Yves\n *\n */\n assert(scan && OP(scan) == GOSUB);\n ARG2L_SET( scan, RExC_open_parens[ARG(scan)] - REGNODE_OFFSET(scan));\n }\n\n Newxz(RExC_rx->offs, RExC_total_parens, regexp_paren_pair);\n /* assume we don't need to swap parens around before we match */\n DEBUG_TEST_r({\n Perl_re_printf( aTHX_ \"study_chunk_recursed_count: %lu\\n\",\n (unsigned long)RExC_study_chunk_recursed_count);\n });\n DEBUG_DUMP_r({\n DEBUG_RExC_seen();\n Perl_re_printf( aTHX_ \"Final program:\\n\");\n regdump(RExC_rx);\n });\n\n if (RExC_open_parens) {\n Safefree(RExC_open_parens);\n RExC_open_parens = NULL;\n }\n if (RExC_close_parens) {\n Safefree(RExC_close_parens);\n RExC_close_parens = NULL;\n }\n\n#ifdef USE_ITHREADS\n /* under ithreads the ?pat? PMf_USED flag on the pmop is simulated\n * by setting the regexp SV to readonly-only instead. If the\n * pattern's been recompiled, the USEDness should remain. */\n if (old_re && SvREADONLY(old_re))\n SvREADONLY_on(Rx);\n#endif\n return Rx;","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"Perl_re_op_compile","file_name":"regcomp.c","commit_link":"github.com/perl/perl5/commit/3295b48defa0f8570114877b063fe546dd348b3c","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#20-39c4a938bc37","input":"int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length)\n{\n\tswitch (mem->type) {\n\tcase RXE_MEM_TYPE_DMA:\n\t\treturn 0;\n\n\tcase RXE_MEM_TYPE_MR:\n\tcase RXE_MEM_TYPE_FMR:\n\t\treturn ((iova < mem->iova) ||\n\t\t\t((iova + length) > (mem->iova + mem->length))) ?\n\t\t\t-EFAULT : 0;\n\n\tdefault:\n\t\treturn -EFAULT;\n\t}\n}","target":"int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length)\n{\n\tswitch (mem->type) {\n\tcase RXE_MEM_TYPE_DMA:\n\t\treturn 0;\n\n\tcase RXE_MEM_TYPE_MR:\n\tcase RXE_MEM_TYPE_FMR:\n\t\tif (iova < mem->iova ||\n\t\t length > mem->length ||\n\t\t iova > mem->iova + mem->length - length)\n\t\t\treturn -EFAULT;\n\t\treturn 0;\n\n\tdefault:\n\t\treturn -EFAULT;\n\t}\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"mem_check_range","file_name":"drivers/infiniband/sw/rxe/rxe_mr.c","commit_link":"github.com/torvalds/linux/commit/647bf3d8a8e5777319da92af672289b2a6c4dc66","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#21-eda854d3b1f5","input":"static int set_geometry(unsigned int cmd, struct floppy_struct *g,\n\t\t\t int drive, int type, struct block_device *bdev)\n{\n\tint cnt;\n\n\t/* sanity checking for parameters. */\n\tif (g->sect <= 0 ||\n\t g->head <= 0 ||\n\t /* check for zero in F_SECT_PER_TRACK */\n\t (unsigned char)((g->sect << 2) >> FD_SIZECODE(g)) == 0 ||\n\t g->track <= 0 || g->track > UDP->tracks >> STRETCH(g) ||\n\t /* check if reserved bits are set */\n\t (g->stretch & ~(FD_STRETCH | FD_SWAPSIDES | FD_SECTBASEMASK)) != 0)\n\t\treturn -EINVAL;\n\tif (type) {\n\t\tif (!capable(CAP_SYS_ADMIN))\n\t\t\treturn -EPERM;\n\t\tmutex_lock(&open_lock);\n\t\tif (lock_fdc(drive)) {\n\t\t\tmutex_unlock(&open_lock);\n\t\t\treturn -EINTR;\n\t\t}\n\t\tfloppy_type[type] = *g;\n\t\tfloppy_type[type].name = \"user format\";\n\t\tfor (cnt = type << 2; cnt < (type << 2) + 4; cnt++)\n\t\t\tfloppy_sizes[cnt] = floppy_sizes[cnt + 0x80] =\n\t\t\t floppy_type[type].size + 1;\n\t\tprocess_fd_request();\n\t\tfor (cnt = 0; cnt < N_DRIVE; cnt++) {\n\t\t\tstruct block_device *bdev = opened_bdev[cnt];\n\t\t\tif (!bdev || ITYPE(drive_state[cnt].fd_device) != type)\n\t\t\t\tcontinue;\n\t\t\t__invalidate_device(bdev, true);\n\t\t}\n\t\tmutex_unlock(&open_lock);\n\t} else {\n\t\tint oldStretch;\n\n\t\tif (lock_fdc(drive))\n\t\t\treturn -EINTR;\n\t\tif (cmd != FDDEFPRM) {\n\t\t\t/* notice a disk change immediately, else\n\t\t\t * we lose our settings immediately*/\n\t\t\tif (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)\n\t\t\t\treturn -EINTR;\n\t\t}\n\t\toldStretch = g->stretch;\n\t\tuser_params[drive] = *g;\n\t\tif (buffer_drive == drive)\n\t\t\tSUPBOUND(buffer_max, user_params[drive].sect);\n\t\tcurrent_type[drive] = &user_params[drive];\n\t\tfloppy_sizes[drive] = user_params[drive].size;\n\t\tif (cmd == FDDEFPRM)\n\t\t\tDRS->keep_data = -1;\n\t\telse\n\t\t\tDRS->keep_data = 1;\n\t\t/* invalidation. Invalidate only when needed, i.e.\n\t\t * when there are already sectors in the buffer cache\n\t\t * whose number will change. This is useful, because\n\t\t * mtools often changes the geometry of the disk after\n\t\t * looking at the boot block */\n\t\tif (DRS->maxblock > user_params[drive].sect ||\n\t\t DRS->maxtrack ||\n\t\t ((user_params[drive].sect ^ oldStretch) &\n\t\t (FD_SWAPSIDES | FD_SECTBASEMASK)))\n\t\t\tinvalidate_drive(bdev);\n\t\telse\n\t\t\tprocess_fd_request();\n\t}\n\treturn 0;\n}","target":"static int set_geometry(unsigned int cmd, struct floppy_struct *g,\n\t\t\t int drive, int type, struct block_device *bdev)\n{\n\tint cnt;\n\n\t/* sanity checking for parameters. */\n\tif ((int)g->sect <= 0 ||\n\t (int)g->head <= 0 ||\n\t /* check for overflow in max_sector */\n\t (int)(g->sect * g->head) <= 0 ||\n\t /* check for zero in F_SECT_PER_TRACK */\n\t (unsigned char)((g->sect << 2) >> FD_SIZECODE(g)) == 0 ||\n\t g->track <= 0 || g->track > UDP->tracks >> STRETCH(g) ||\n\t /* check if reserved bits are set */\n\t (g->stretch & ~(FD_STRETCH | FD_SWAPSIDES | FD_SECTBASEMASK)) != 0)\n\t\treturn -EINVAL;\n\tif (type) {\n\t\tif (!capable(CAP_SYS_ADMIN))\n\t\t\treturn -EPERM;\n\t\tmutex_lock(&open_lock);\n\t\tif (lock_fdc(drive)) {\n\t\t\tmutex_unlock(&open_lock);\n\t\t\treturn -EINTR;\n\t\t}\n\t\tfloppy_type[type] = *g;\n\t\tfloppy_type[type].name = \"user format\";\n\t\tfor (cnt = type << 2; cnt < (type << 2) + 4; cnt++)\n\t\t\tfloppy_sizes[cnt] = floppy_sizes[cnt + 0x80] =\n\t\t\t floppy_type[type].size + 1;\n\t\tprocess_fd_request();\n\t\tfor (cnt = 0; cnt < N_DRIVE; cnt++) {\n\t\t\tstruct block_device *bdev = opened_bdev[cnt];\n\t\t\tif (!bdev || ITYPE(drive_state[cnt].fd_device) != type)\n\t\t\t\tcontinue;\n\t\t\t__invalidate_device(bdev, true);\n\t\t}\n\t\tmutex_unlock(&open_lock);\n\t} else {\n\t\tint oldStretch;\n\n\t\tif (lock_fdc(drive))\n\t\t\treturn -EINTR;\n\t\tif (cmd != FDDEFPRM) {\n\t\t\t/* notice a disk change immediately, else\n\t\t\t * we lose our settings immediately*/\n\t\t\tif (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)\n\t\t\t\treturn -EINTR;\n\t\t}\n\t\toldStretch = g->stretch;\n\t\tuser_params[drive] = *g;\n\t\tif (buffer_drive == drive)\n\t\t\tSUPBOUND(buffer_max, user_params[drive].sect);\n\t\tcurrent_type[drive] = &user_params[drive];\n\t\tfloppy_sizes[drive] = user_params[drive].size;\n\t\tif (cmd == FDDEFPRM)\n\t\t\tDRS->keep_data = -1;\n\t\telse\n\t\t\tDRS->keep_data = 1;\n\t\t/* invalidation. Invalidate only when needed, i.e.\n\t\t * when there are already sectors in the buffer cache\n\t\t * whose number will change. This is useful, because\n\t\t * mtools often changes the geometry of the disk after\n\t\t * looking at the boot block */\n\t\tif (DRS->maxblock > user_params[drive].sect ||\n\t\t DRS->maxtrack ||\n\t\t ((user_params[drive].sect ^ oldStretch) &\n\t\t (FD_SWAPSIDES | FD_SECTBASEMASK)))\n\t\t\tinvalidate_drive(bdev);\n\t\telse\n\t\t\tprocess_fd_request();\n\t}\n\treturn 0;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"set_geometry","file_name":"drivers/block/floppy.c","commit_link":"github.com/torvalds/linux/commit/da99466ac243f15fbba65bd261bfc75ffa1532b6","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#22-4a88cdf99c78","input":"static int __get_data_block(struct inode *inode, sector_t iblock,\n\t\t\tstruct buffer_head *bh, int create, int flag,\n\t\t\tpgoff_t *next_pgofs)\n{\n\tstruct f2fs_map_blocks map;\n\tint err;\n\n\tmap.m_lblk = iblock;\n\tmap.m_len = bh->b_size >> inode->i_blkbits;\n\tmap.m_next_pgofs = next_pgofs;\n\n\terr = f2fs_map_blocks(inode, &map, create, flag);\n\tif (!err) {\n\t\tmap_bh(bh, inode->i_sb, map.m_pblk);\n\t\tbh->b_state = (bh->b_state & ~F2FS_MAP_FLAGS) | map.m_flags;\n\t\tbh->b_size = map.m_len << inode->i_blkbits;\n\t}\n\treturn err;\n}","target":"static int __get_data_block(struct inode *inode, sector_t iblock,\n\t\t\tstruct buffer_head *bh, int create, int flag,\n\t\t\tpgoff_t *next_pgofs)\n{\n\tstruct f2fs_map_blocks map;\n\tint err;\n\n\tmap.m_lblk = iblock;\n\tmap.m_len = bh->b_size >> inode->i_blkbits;\n\tmap.m_next_pgofs = next_pgofs;\n\n\terr = f2fs_map_blocks(inode, &map, create, flag);\n\tif (!err) {\n\t\tmap_bh(bh, inode->i_sb, map.m_pblk);\n\t\tbh->b_state = (bh->b_state & ~F2FS_MAP_FLAGS) | map.m_flags;\n\t\tbh->b_size = (u64)map.m_len << inode->i_blkbits;\n\t}\n\treturn err;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"__get_data_block","file_name":"fs/f2fs/data.c","commit_link":"github.com/torvalds/linux/commit/b86e33075ed1909d8002745b56ecf73b833db143","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#23-d91a1a46f304","input":"String StringUtil::Implode(const Variant& items, const String& delim,\n const bool checkIsContainer /* = true */) {\n if (checkIsContainer && !isContainer(items)) {\n throw_param_is_not_container();\n }\n int size = getContainerSize(items);\n if (size == 0) return empty_string();\n\n req::vector sitems;\n sitems.reserve(size);\n int len = 0;\n int lenDelim = delim.size();\n for (ArrayIter iter(items); iter; ++iter) {\n sitems.emplace_back(iter.second().toString());\n len += sitems.back().size() + lenDelim;\n }\n len -= lenDelim; // always one delimiter less than count of items\n assert(sitems.size() == size);\n\n String s = String(len, ReserveString);\n char *buffer = s.mutableData();\n const char *sdelim = delim.data();\n char *p = buffer;\n String &init_str = sitems[0];\n int init_len = init_str.size();\n memcpy(p, init_str.data(), init_len);\n p += init_len;\n for (int i = 1; i < size; i++) {\n String &item = sitems[i];\n memcpy(p, sdelim, lenDelim);\n p += lenDelim;\n int lenItem = item.size();\n memcpy(p, item.data(), lenItem);\n p += lenItem;\n }\n assert(p - buffer == len);\n s.setSize(len);\n return s;\n}","target":"String StringUtil::Implode(const Variant& items, const String& delim,\n const bool checkIsContainer /* = true */) {\n if (checkIsContainer && !isContainer(items)) {\n throw_param_is_not_container();\n }\n int size = getContainerSize(items);\n if (size == 0) return empty_string();\n\n req::vector sitems;\n sitems.reserve(size);\n size_t len = 0;\n size_t lenDelim = delim.size();\n for (ArrayIter iter(items); iter; ++iter) {\n sitems.emplace_back(iter.second().toString());\n len += sitems.back().size() + lenDelim;\n }\n len -= lenDelim; // always one delimiter less than count of items\n assert(sitems.size() == size);\n\n String s = String(len, ReserveString);\n char *buffer = s.mutableData();\n const char *sdelim = delim.data();\n char *p = buffer;\n String &init_str = sitems[0];\n int init_len = init_str.size();\n memcpy(p, init_str.data(), init_len);\n p += init_len;\n for (int i = 1; i < size; i++) {\n String &item = sitems[i];\n memcpy(p, sdelim, lenDelim);\n p += lenDelim;\n int lenItem = item.size();\n memcpy(p, item.data(), lenItem);\n p += lenItem;\n }\n assert(p - buffer == len);\n s.setSize(len);\n return s;\n}","lang":"cpp","vul_type":"cwe-190","sven_meta":{"func_name":"HPHP::StringUtil::Implode","file_name":"hphp/runtime/base/string-util.cpp","commit_link":"github.com/facebook/hhvm/commit/2c9a8fcc73a151608634d3e712973d192027c271","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#24-3e1eba9443b2","input":"PHPAPI PHP_FUNCTION(fread)\n{\n\tzval *arg1;\n\tlong len;\n\tphp_stream *stream;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rl\", &arg1, &len) == FAILURE) {\n\t\tRETURN_FALSE;\n\t}\n\n\tPHP_STREAM_TO_ZVAL(stream, &arg1);\n\n\tif (len <= 0) {\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Length parameter must be greater than 0\");\n\t\tRETURN_FALSE;\n\t}\n\n\tZ_STRVAL_P(return_value) = emalloc(len + 1);\n\tZ_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);\n\n\t/* needed because recv/read/gzread doesnt put a null at the end*/\n\tZ_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;\n\tZ_TYPE_P(return_value) = IS_STRING;\n}","target":"PHPAPI PHP_FUNCTION(fread)\n{\n\tzval *arg1;\n\tlong len;\n\tphp_stream *stream;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rl\", &arg1, &len) == FAILURE) {\n\t\tRETURN_FALSE;\n\t}\n\n\tPHP_STREAM_TO_ZVAL(stream, &arg1);\n\n\tif (len <= 0) {\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Length parameter must be greater than 0\");\n\t\tRETURN_FALSE;\n\t}\n\n\tif (len > INT_MAX) {\n\t\t/* string length is int in 5.x so we can not read more than int */\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Length parameter must be no more than %d\", INT_MAX);\n\t\tRETURN_FALSE;\n\t}\n\n\tZ_STRVAL_P(return_value) = emalloc(len + 1);\n\tZ_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);\n\n\t/* needed because recv/read/gzread doesnt put a null at the end*/\n\tZ_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;\n\tZ_TYPE_P(return_value) = IS_STRING;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"PHP_FUNCTION","file_name":"ext/standard/file.c","commit_link":"github.com/php/php-src/commit/abd159cce48f3e34f08e4751c568e09677d5ec9c","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#25-af023b90e4d1","input":"int amqp_handle_input(amqp_connection_state_t state, amqp_bytes_t received_data,\n amqp_frame_t *decoded_frame) {\n size_t bytes_consumed;\n void *raw_frame;\n\n /* Returning frame_type of zero indicates either insufficient input,\n or a complete, ignored frame was read. */\n decoded_frame->frame_type = 0;\n\n if (received_data.len == 0) {\n return AMQP_STATUS_OK;\n }\n\n if (state->state == CONNECTION_STATE_IDLE) {\n state->state = CONNECTION_STATE_HEADER;\n }\n\n bytes_consumed = consume_data(state, &received_data);\n\n /* do we have target_size data yet? if not, return with the\n expectation that more will arrive */\n if (state->inbound_offset < state->target_size) {\n return (int)bytes_consumed;\n }\n\n raw_frame = state->inbound_buffer.bytes;\n\n switch (state->state) {\n case CONNECTION_STATE_INITIAL:\n /* check for a protocol header from the server */\n if (memcmp(raw_frame, \"AMQP\", 4) == 0) {\n decoded_frame->frame_type = AMQP_PSEUDOFRAME_PROTOCOL_HEADER;\n decoded_frame->channel = 0;\n\n decoded_frame->payload.protocol_header.transport_high =\n amqp_d8(amqp_offset(raw_frame, 4));\n decoded_frame->payload.protocol_header.transport_low =\n amqp_d8(amqp_offset(raw_frame, 5));\n decoded_frame->payload.protocol_header.protocol_version_major =\n amqp_d8(amqp_offset(raw_frame, 6));\n decoded_frame->payload.protocol_header.protocol_version_minor =\n amqp_d8(amqp_offset(raw_frame, 7));\n\n return_to_idle(state);\n return (int)bytes_consumed;\n }\n\n /* it's not a protocol header; fall through to process it as a\n regular frame header */\n\n case CONNECTION_STATE_HEADER: {\n amqp_channel_t channel;\n amqp_pool_t *channel_pool;\n /* frame length is 3 bytes in */\n channel = amqp_d16(amqp_offset(raw_frame, 1));\n\n state->target_size =\n amqp_d32(amqp_offset(raw_frame, 3)) + HEADER_SIZE + FOOTER_SIZE;\n\n if ((size_t)state->frame_max < state->target_size) {\n return AMQP_STATUS_BAD_AMQP_DATA;\n }\n\n channel_pool = amqp_get_or_create_channel_pool(state, channel);\n if (NULL == channel_pool) {\n return AMQP_STATUS_NO_MEMORY;\n }\n\n amqp_pool_alloc_bytes(channel_pool, state->target_size,\n &state->inbound_buffer);\n if (NULL == state->inbound_buffer.bytes) {\n return AMQP_STATUS_NO_MEMORY;\n }\n memcpy(state->inbound_buffer.bytes, state->header_buffer, HEADER_SIZE);\n raw_frame = state->inbound_buffer.bytes;\n\n state->state = CONNECTION_STATE_BODY;\n\n bytes_consumed += consume_data(state, &received_data);\n\n /* do we have target_size data yet? if not, return with the\n expectation that more will arrive */\n if (state->inbound_offset < state->target_size) {\n return (int)bytes_consumed;\n }\n }\n /* fall through to process body */\n\n case CONNECTION_STATE_BODY: {\n amqp_bytes_t encoded;\n int res;\n amqp_pool_t *channel_pool;\n\n /* Check frame end marker (footer) */\n if (amqp_d8(amqp_offset(raw_frame, state->target_size - 1)) !=\n AMQP_FRAME_END) {\n return AMQP_STATUS_BAD_AMQP_DATA;\n }\n\n decoded_frame->frame_type = amqp_d8(amqp_offset(raw_frame, 0));\n decoded_frame->channel = amqp_d16(amqp_offset(raw_frame, 1));\n\n channel_pool =\n amqp_get_or_create_channel_pool(state, decoded_frame->channel);\n if (NULL == channel_pool) {\n return AMQP_STATUS_NO_MEMORY;\n }\n\n switch (decoded_frame->frame_type) {\n case AMQP_FRAME_METHOD:\n decoded_frame->payload.method.id =\n amqp_d32(amqp_offset(raw_frame, HEADER_SIZE));\n encoded.bytes = amqp_offset(raw_frame, HEADER_SIZE + 4);\n encoded.len = state->target_size - HEADER_SIZE - 4 - FOOTER_SIZE;\n\n res = amqp_decode_method(decoded_frame->payload.method.id,\n channel_pool, encoded,\n &decoded_frame->payload.method.decoded);\n if (res < 0) {\n return res;\n }\n\n break;\n\n case AMQP_FRAME_HEADER:\n decoded_frame->payload.properties.class_id =\n amqp_d16(amqp_offset(raw_frame, HEADER_SIZE));\n /* unused 2-byte weight field goes here */\n decoded_frame->payload.properties.body_size =\n amqp_d64(amqp_offset(raw_frame, HEADER_SIZE + 4));\n encoded.bytes = amqp_offset(raw_frame, HEADER_SIZE + 12);\n encoded.len = state->target_size - HEADER_SIZE - 12 - FOOTER_SIZE;\n decoded_frame->payload.properties.raw = encoded;\n\n res = amqp_decode_properties(\n decoded_frame->payload.properties.class_id, channel_pool, encoded,\n &decoded_frame->payload.properties.decoded);\n if (res < 0) {\n return res;\n }\n\n break;\n\n case AMQP_FRAME_BODY:\n decoded_frame->payload.body_fragment.len =\n state->target_size - HEADER_SIZE - FOOTER_SIZE;\n decoded_frame->payload.body_fragment.bytes =\n amqp_offset(raw_frame, HEADER_SIZE);\n break;\n\n case AMQP_FRAME_HEARTBEAT:\n break;\n\n default:\n /* Ignore the frame */\n decoded_frame->frame_type = 0;\n break;\n }\n\n return_to_idle(state);\n return (int)bytes_consumed;\n }\n\n default:\n amqp_abort(\"Internal error: invalid amqp_connection_state_t->state %d\",\n state->state);\n }\n}","target":"int amqp_handle_input(amqp_connection_state_t state, amqp_bytes_t received_data,\n amqp_frame_t *decoded_frame) {\n size_t bytes_consumed;\n void *raw_frame;\n\n /* Returning frame_type of zero indicates either insufficient input,\n or a complete, ignored frame was read. */\n decoded_frame->frame_type = 0;\n\n if (received_data.len == 0) {\n return AMQP_STATUS_OK;\n }\n\n if (state->state == CONNECTION_STATE_IDLE) {\n state->state = CONNECTION_STATE_HEADER;\n }\n\n bytes_consumed = consume_data(state, &received_data);\n\n /* do we have target_size data yet? if not, return with the\n expectation that more will arrive */\n if (state->inbound_offset < state->target_size) {\n return (int)bytes_consumed;\n }\n\n raw_frame = state->inbound_buffer.bytes;\n\n switch (state->state) {\n case CONNECTION_STATE_INITIAL:\n /* check for a protocol header from the server */\n if (memcmp(raw_frame, \"AMQP\", 4) == 0) {\n decoded_frame->frame_type = AMQP_PSEUDOFRAME_PROTOCOL_HEADER;\n decoded_frame->channel = 0;\n\n decoded_frame->payload.protocol_header.transport_high =\n amqp_d8(amqp_offset(raw_frame, 4));\n decoded_frame->payload.protocol_header.transport_low =\n amqp_d8(amqp_offset(raw_frame, 5));\n decoded_frame->payload.protocol_header.protocol_version_major =\n amqp_d8(amqp_offset(raw_frame, 6));\n decoded_frame->payload.protocol_header.protocol_version_minor =\n amqp_d8(amqp_offset(raw_frame, 7));\n\n return_to_idle(state);\n return (int)bytes_consumed;\n }\n\n /* it's not a protocol header; fall through to process it as a\n regular frame header */\n\n case CONNECTION_STATE_HEADER: {\n amqp_channel_t channel;\n amqp_pool_t *channel_pool;\n uint32_t frame_size;\n\n channel = amqp_d16(amqp_offset(raw_frame, 1));\n\n /* frame length is 3 bytes in */\n frame_size = amqp_d32(amqp_offset(raw_frame, 3));\n /* To prevent the target_size calculation below from overflowing, check\n * that the stated frame_size is smaller than a signed 32-bit. Given\n * the library only allows configuring frame_max as an int32_t, and\n * frame_size is uint32_t, the math below is safe from overflow. */\n if (frame_size >= INT32_MAX) {\n return AMQP_STATUS_BAD_AMQP_DATA;\n }\n\n state->target_size = frame_size + HEADER_SIZE + FOOTER_SIZE;\n if ((size_t)state->frame_max < state->target_size) {\n return AMQP_STATUS_BAD_AMQP_DATA;\n }\n\n channel_pool = amqp_get_or_create_channel_pool(state, channel);\n if (NULL == channel_pool) {\n return AMQP_STATUS_NO_MEMORY;\n }\n\n amqp_pool_alloc_bytes(channel_pool, state->target_size,\n &state->inbound_buffer);\n if (NULL == state->inbound_buffer.bytes) {\n return AMQP_STATUS_NO_MEMORY;\n }\n memcpy(state->inbound_buffer.bytes, state->header_buffer, HEADER_SIZE);\n raw_frame = state->inbound_buffer.bytes;\n\n state->state = CONNECTION_STATE_BODY;\n\n bytes_consumed += consume_data(state, &received_data);\n\n /* do we have target_size data yet? if not, return with the\n expectation that more will arrive */\n if (state->inbound_offset < state->target_size) {\n return (int)bytes_consumed;\n }\n }\n /* fall through to process body */\n\n case CONNECTION_STATE_BODY: {\n amqp_bytes_t encoded;\n int res;\n amqp_pool_t *channel_pool;\n\n /* Check frame end marker (footer) */\n if (amqp_d8(amqp_offset(raw_frame, state->target_size - 1)) !=\n AMQP_FRAME_END) {\n return AMQP_STATUS_BAD_AMQP_DATA;\n }\n\n decoded_frame->frame_type = amqp_d8(amqp_offset(raw_frame, 0));\n decoded_frame->channel = amqp_d16(amqp_offset(raw_frame, 1));\n\n channel_pool =\n amqp_get_or_create_channel_pool(state, decoded_frame->channel);\n if (NULL == channel_pool) {\n return AMQP_STATUS_NO_MEMORY;\n }\n\n switch (decoded_frame->frame_type) {\n case AMQP_FRAME_METHOD:\n decoded_frame->payload.method.id =\n amqp_d32(amqp_offset(raw_frame, HEADER_SIZE));\n encoded.bytes = amqp_offset(raw_frame, HEADER_SIZE + 4);\n encoded.len = state->target_size - HEADER_SIZE - 4 - FOOTER_SIZE;\n\n res = amqp_decode_method(decoded_frame->payload.method.id,\n channel_pool, encoded,\n &decoded_frame->payload.method.decoded);\n if (res < 0) {\n return res;\n }\n\n break;\n\n case AMQP_FRAME_HEADER:\n decoded_frame->payload.properties.class_id =\n amqp_d16(amqp_offset(raw_frame, HEADER_SIZE));\n /* unused 2-byte weight field goes here */\n decoded_frame->payload.properties.body_size =\n amqp_d64(amqp_offset(raw_frame, HEADER_SIZE + 4));\n encoded.bytes = amqp_offset(raw_frame, HEADER_SIZE + 12);\n encoded.len = state->target_size - HEADER_SIZE - 12 - FOOTER_SIZE;\n decoded_frame->payload.properties.raw = encoded;\n\n res = amqp_decode_properties(\n decoded_frame->payload.properties.class_id, channel_pool, encoded,\n &decoded_frame->payload.properties.decoded);\n if (res < 0) {\n return res;\n }\n\n break;\n\n case AMQP_FRAME_BODY:\n decoded_frame->payload.body_fragment.len =\n state->target_size - HEADER_SIZE - FOOTER_SIZE;\n decoded_frame->payload.body_fragment.bytes =\n amqp_offset(raw_frame, HEADER_SIZE);\n break;\n\n case AMQP_FRAME_HEARTBEAT:\n break;\n\n default:\n /* Ignore the frame */\n decoded_frame->frame_type = 0;\n break;\n }\n\n return_to_idle(state);\n return (int)bytes_consumed;\n }\n\n default:\n amqp_abort(\"Internal error: invalid amqp_connection_state_t->state %d\",\n state->state);\n }\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"amqp_handle_input","file_name":"librabbitmq/amqp_connection.c","commit_link":"github.com/alanxz/rabbitmq-c/commit/fc85be7123050b91b054e45b91c78d3241a5047a","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#26-ae952943b38a","input":"choose_volume(struct archive_read *a, struct iso9660 *iso9660)\n{\n\tstruct file_info *file;\n\tint64_t skipsize;\n\tstruct vd *vd;\n\tconst void *block;\n\tchar seenJoliet;\n\n\tvd = &(iso9660->primary);\n\tif (!iso9660->opt_support_joliet)\n\t\tiso9660->seenJoliet = 0;\n\tif (iso9660->seenJoliet &&\n\t\tvd->location > iso9660->joliet.location)\n\t\t/* This condition is unlikely; by way of caution. */\n\t\tvd = &(iso9660->joliet);\n\n\tskipsize = LOGICAL_BLOCK_SIZE * vd->location;\n\tskipsize = __archive_read_consume(a, skipsize);\n\tif (skipsize < 0)\n\t\treturn ((int)skipsize);\n\tiso9660->current_position = skipsize;\n\n\tblock = __archive_read_ahead(a, vd->size, NULL);\n\tif (block == NULL) {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Failed to read full block when scanning \"\n\t\t \"ISO9660 directory list\");\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\n\t/*\n\t * While reading Root Directory, flag seenJoliet must be zero to\n\t * avoid converting special name 0x00(Current Directory) and\n\t * next byte to UCS2.\n\t */\n\tseenJoliet = iso9660->seenJoliet;/* Save flag. */\n\tiso9660->seenJoliet = 0;\n\tfile = parse_file_info(a, NULL, block);\n\tif (file == NULL)\n\t\treturn (ARCHIVE_FATAL);\n\tiso9660->seenJoliet = seenJoliet;\n\n\t/*\n\t * If the iso image has both RockRidge and Joliet, we preferentially\n\t * use RockRidge Extensions rather than Joliet ones.\n\t */\n\tif (vd == &(iso9660->primary) && iso9660->seenRockridge\n\t && iso9660->seenJoliet)\n\t\tiso9660->seenJoliet = 0;\n\n\tif (vd == &(iso9660->primary) && !iso9660->seenRockridge\n\t && iso9660->seenJoliet) {\n\t\t/* Switch reading data from primary to joliet. */\n\t\tvd = &(iso9660->joliet);\n\t\tskipsize = LOGICAL_BLOCK_SIZE * vd->location;\n\t\tskipsize -= iso9660->current_position;\n\t\tskipsize = __archive_read_consume(a, skipsize);\n\t\tif (skipsize < 0)\n\t\t\treturn ((int)skipsize);\n\t\tiso9660->current_position += skipsize;\n\n\t\tblock = __archive_read_ahead(a, vd->size, NULL);\n\t\tif (block == NULL) {\n\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t\t \"Failed to read full block when scanning \"\n\t\t\t \"ISO9660 directory list\");\n\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tiso9660->seenJoliet = 0;\n\t\tfile = parse_file_info(a, NULL, block);\n\t\tif (file == NULL)\n\t\t\treturn (ARCHIVE_FATAL);\n\t\tiso9660->seenJoliet = seenJoliet;\n\t}\n\n\t/* Store the root directory in the pending list. */\n\tif (add_entry(a, iso9660, file) != ARCHIVE_OK)\n\t\treturn (ARCHIVE_FATAL);\n\tif (iso9660->seenRockridge) {\n\t\ta->archive.archive_format = ARCHIVE_FORMAT_ISO9660_ROCKRIDGE;\n\t\ta->archive.archive_format_name =\n\t\t \"ISO9660 with Rockridge extensions\";\n\t}\n\n\treturn (ARCHIVE_OK);\n}","target":"choose_volume(struct archive_read *a, struct iso9660 *iso9660)\n{\n\tstruct file_info *file;\n\tint64_t skipsize;\n\tstruct vd *vd;\n\tconst void *block;\n\tchar seenJoliet;\n\n\tvd = &(iso9660->primary);\n\tif (!iso9660->opt_support_joliet)\n\t\tiso9660->seenJoliet = 0;\n\tif (iso9660->seenJoliet &&\n\t\tvd->location > iso9660->joliet.location)\n\t\t/* This condition is unlikely; by way of caution. */\n\t\tvd = &(iso9660->joliet);\n\n\tskipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location;\n\tskipsize = __archive_read_consume(a, skipsize);\n\tif (skipsize < 0)\n\t\treturn ((int)skipsize);\n\tiso9660->current_position = skipsize;\n\n\tblock = __archive_read_ahead(a, vd->size, NULL);\n\tif (block == NULL) {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Failed to read full block when scanning \"\n\t\t \"ISO9660 directory list\");\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\n\t/*\n\t * While reading Root Directory, flag seenJoliet must be zero to\n\t * avoid converting special name 0x00(Current Directory) and\n\t * next byte to UCS2.\n\t */\n\tseenJoliet = iso9660->seenJoliet;/* Save flag. */\n\tiso9660->seenJoliet = 0;\n\tfile = parse_file_info(a, NULL, block);\n\tif (file == NULL)\n\t\treturn (ARCHIVE_FATAL);\n\tiso9660->seenJoliet = seenJoliet;\n\n\t/*\n\t * If the iso image has both RockRidge and Joliet, we preferentially\n\t * use RockRidge Extensions rather than Joliet ones.\n\t */\n\tif (vd == &(iso9660->primary) && iso9660->seenRockridge\n\t && iso9660->seenJoliet)\n\t\tiso9660->seenJoliet = 0;\n\n\tif (vd == &(iso9660->primary) && !iso9660->seenRockridge\n\t && iso9660->seenJoliet) {\n\t\t/* Switch reading data from primary to joliet. */\n\t\tvd = &(iso9660->joliet);\n\t\tskipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location;\n\t\tskipsize -= iso9660->current_position;\n\t\tskipsize = __archive_read_consume(a, skipsize);\n\t\tif (skipsize < 0)\n\t\t\treturn ((int)skipsize);\n\t\tiso9660->current_position += skipsize;\n\n\t\tblock = __archive_read_ahead(a, vd->size, NULL);\n\t\tif (block == NULL) {\n\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t\t \"Failed to read full block when scanning \"\n\t\t\t \"ISO9660 directory list\");\n\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tiso9660->seenJoliet = 0;\n\t\tfile = parse_file_info(a, NULL, block);\n\t\tif (file == NULL)\n\t\t\treturn (ARCHIVE_FATAL);\n\t\tiso9660->seenJoliet = seenJoliet;\n\t}\n\n\t/* Store the root directory in the pending list. */\n\tif (add_entry(a, iso9660, file) != ARCHIVE_OK)\n\t\treturn (ARCHIVE_FATAL);\n\tif (iso9660->seenRockridge) {\n\t\ta->archive.archive_format = ARCHIVE_FORMAT_ISO9660_ROCKRIDGE;\n\t\ta->archive.archive_format_name =\n\t\t \"ISO9660 with Rockridge extensions\";\n\t}\n\n\treturn (ARCHIVE_OK);\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"choose_volume","file_name":"libarchive/archive_read_support_format_iso9660.c","commit_link":"github.com/libarchive/libarchive/commit/3ad08e01b4d253c66ae56414886089684155af22","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#27-83253717d88f","input":"void * CAPSTONE_API cs_winkernel_malloc(size_t size)\n{\n\t// Disallow zero length allocation because they waste pool header space and,\n\t// in many cases, indicate a potential validation issue in the calling code.\n\tNT_ASSERT(size);\n\n\t// FP; a use of NonPagedPool is required for Windows 7 support\n#pragma prefast(suppress : 30030)\t\t// Allocating executable POOL_TYPE memory\n\tCS_WINKERNEL_MEMBLOCK *block = (CS_WINKERNEL_MEMBLOCK *)ExAllocatePoolWithTag(\n\t\t\tNonPagedPool, size + sizeof(CS_WINKERNEL_MEMBLOCK), CS_WINKERNEL_POOL_TAG);\n\tif (!block) {\n\t\treturn NULL;\n\t}\n\tblock->size = size;\n\n\treturn block->data;\n}","target":"void * CAPSTONE_API cs_winkernel_malloc(size_t size)\n{\n\t// Disallow zero length allocation because they waste pool header space and,\n\t// in many cases, indicate a potential validation issue in the calling code.\n\tNT_ASSERT(size);\n\n\t// FP; a use of NonPagedPool is required for Windows 7 support\n#pragma prefast(suppress : 30030)\t\t// Allocating executable POOL_TYPE memory\n\tsize_t number_of_bytes = 0;\n\tCS_WINKERNEL_MEMBLOCK *block = NULL;\n\t// A specially crafted size value can trigger the overflow.\n\t// If the sum in a value that overflows or underflows the capacity of the type,\n\t// the function returns NULL.\n\tif (!NT_SUCCESS(RtlSizeTAdd(size, sizeof(CS_WINKERNEL_MEMBLOCK), &number_of_bytes))) {\n\t\treturn NULL;\n\t}\n\tblock = (CS_WINKERNEL_MEMBLOCK *)ExAllocatePoolWithTag(\n\t\t\tNonPagedPool, number_of_bytes, CS_WINKERNEL_POOL_TAG);\n\tif (!block) {\n\t\treturn NULL;\n\t}\n\tblock->size = size;\n\n\treturn block->data;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"cs_winkernel_malloc","file_name":"windows/winkernel_mm.c","commit_link":"github.com/aquynh/capstone/commit/6fe86eef621b9849f51a5e1e5d73258a93440403","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#28-47d3aafa3fe0","input":"hfs_cat_traverse(HFS_INFO * hfs,\n TSK_HFS_BTREE_CB a_cb, void *ptr)\n{\n TSK_FS_INFO *fs = &(hfs->fs_info);\n uint32_t cur_node; /* node id of the current node */\n char *node;\n\n uint16_t nodesize;\n uint8_t is_done = 0;\n\n tsk_error_reset();\n\n nodesize = tsk_getu16(fs->endian, hfs->catalog_header.nodesize);\n if ((node = (char *) tsk_malloc(nodesize)) == NULL)\n return 1;\n\n /* start at root node */\n cur_node = tsk_getu32(fs->endian, hfs->catalog_header.rootNode);\n\n /* if the root node is zero, then the extents btree is empty */\n /* if no files have overflow extents, the Extents B-tree still\n exists on disk, but is an empty B-tree containing only\n the header node */\n if (cur_node == 0) {\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: \"\n \"empty extents btree\\n\");\n free(node);\n return 1;\n }\n\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: starting at \"\n \"root node %\" PRIu32 \"; nodesize = %\"\n PRIu16 \"\\n\", cur_node, nodesize);\n\n /* Recurse down to the needed leaf nodes and then go forward */\n is_done = 0;\n while (is_done == 0) {\n TSK_OFF_T cur_off; /* start address of cur_node */\n uint16_t num_rec; /* number of records in this node */\n ssize_t cnt;\n hfs_btree_node *node_desc;\n\n // sanity check\n if (cur_node > tsk_getu32(fs->endian,\n hfs->catalog_header.totalNodes)) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: Node %d too large for file\", cur_node);\n free(node);\n return 1;\n }\n\n // read the current node\n cur_off = cur_node * nodesize;\n cnt = tsk_fs_attr_read(hfs->catalog_attr, cur_off,\n node, nodesize, 0);\n if (cnt != nodesize) {\n if (cnt >= 0) {\n tsk_error_reset();\n tsk_error_set_errno(TSK_ERR_FS_READ);\n }\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Error reading node %d at offset %\"\n PRIuOFF, cur_node, cur_off);\n free(node);\n return 1;\n }\n\n // process the header / descriptor\n if (nodesize < sizeof(hfs_btree_node)) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: Node size %d is too small to be valid\", nodesize);\n free(node);\n return 1;\n }\n node_desc = (hfs_btree_node *) node;\n num_rec = tsk_getu16(fs->endian, node_desc->num_rec);\n\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: node %\" PRIu32\n \" @ %\" PRIu64 \" has %\" PRIu16 \" records\\n\",\n cur_node, cur_off, num_rec);\n\n if (num_rec == 0) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr(\"hfs_cat_traverse: zero records in node %\"\n PRIu32, cur_node);\n free(node);\n return 1;\n }\n\n /* With an index node, find the record with the largest key that is smaller\n * to or equal to cnid */\n if (node_desc->type == HFS_BT_NODE_TYPE_IDX) {\n uint32_t next_node = 0;\n int rec;\n\n for (rec = 0; rec < num_rec; ++rec) {\n size_t rec_off;\n hfs_btree_key_cat *key;\n uint8_t retval;\n uint16_t keylen;\n\n // get the record offset in the node\n rec_off =\n tsk_getu16(fs->endian,\n &node[nodesize - (rec + 1) * 2]);\n if (rec_off > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, (int) rec_off,\n nodesize);\n free(node);\n return 1;\n }\n\n key = (hfs_btree_key_cat *) & node[rec_off];\n\n keylen = 2 + tsk_getu16(hfs->fs_info.endian, key->key_len);\n if ((keylen) > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: length of key %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, keylen, nodesize);\n free(node);\n return 1;\n }\n\n\n /*\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: record %\" PRIu16\n \" ; keylen %\" PRIu16 \" (%\" PRIu32 \")\\n\", rec,\n tsk_getu16(fs->endian, key->key_len),\n tsk_getu32(fs->endian, key->parent_cnid));\n */\n\n\n /* save the info from this record unless it is too big */\n retval =\n a_cb(hfs, HFS_BT_NODE_TYPE_IDX, key,\n cur_off + rec_off, ptr);\n if (retval == HFS_BTREE_CB_ERR) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Callback returned error\");\n free(node);\n return 1;\n }\n // record the closest entry\n else if ((retval == HFS_BTREE_CB_IDX_LT)\n || (next_node == 0)) {\n hfs_btree_index_record *idx_rec;\n int keylen =\n 2 + hfs_get_idxkeylen(hfs, tsk_getu16(fs->endian,\n key->key_len), &(hfs->catalog_header));\n if (rec_off + keylen > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record and keylength %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node,\n (int) rec_off + keylen, nodesize);\n free(node);\n return 1;\n }\n idx_rec =\n (hfs_btree_index_record *) & node[rec_off +\n keylen];\n next_node = tsk_getu32(fs->endian, idx_rec->childNode);\n }\n if (retval == HFS_BTREE_CB_IDX_EQGT) {\n // move down to the next node\n break;\n }\n }\n // check if we found a relevant node\n if (next_node == 0) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: did not find any keys in index node %d\",\n cur_node);\n is_done = 1;\n break;\n }\n // TODO: Handle multinode loops\n if (next_node == cur_node) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: node %d references itself as next node\",\n cur_node);\n is_done = 1;\n break;\n }\n cur_node = next_node;\n }\n\n /* With a leaf, we look for the specific record. */\n else if (node_desc->type == HFS_BT_NODE_TYPE_LEAF) {\n int rec;\n\n for (rec = 0; rec < num_rec; ++rec) {\n size_t rec_off;\n hfs_btree_key_cat *key;\n uint8_t retval;\n uint16_t keylen;\n\n // get the record offset in the node\n rec_off =\n tsk_getu16(fs->endian,\n &node[nodesize - (rec + 1) * 2]);\n if (rec_off > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record %d in leaf node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, (int) rec_off,\n nodesize);\n free(node);\n return 1;\n }\n key = (hfs_btree_key_cat *) & node[rec_off];\n\n keylen = 2 + tsk_getu16(hfs->fs_info.endian, key->key_len);\n if ((keylen) > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: length of key %d in leaf node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, keylen, nodesize);\n free(node);\n return 1;\n }\n\n /*\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: record %\" PRIu16\n \"; keylen %\" PRIu16 \" (%\" PRIu32 \")\\n\", rec,\n tsk_getu16(fs->endian, key->key_len),\n tsk_getu32(fs->endian, key->parent_cnid));\n */\n // rec_cnid = tsk_getu32(fs->endian, key->file_id);\n\n retval =\n a_cb(hfs, HFS_BT_NODE_TYPE_LEAF, key,\n cur_off + rec_off, ptr);\n if (retval == HFS_BTREE_CB_LEAF_STOP) {\n is_done = 1;\n break;\n }\n else if (retval == HFS_BTREE_CB_ERR) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Callback returned error\");\n free(node);\n return 1;\n }\n }\n\n // move right to the next node if we got this far\n if (is_done == 0) {\n cur_node = tsk_getu32(fs->endian, node_desc->flink);\n if (cur_node == 0) {\n is_done = 1;\n }\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: moving forward to next leaf\");\n }\n }\n else {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr(\"hfs_cat_traverse: btree node %\" PRIu32\n \" (%\" PRIu64 \") is neither index nor leaf (%\" PRIu8 \")\",\n cur_node, cur_off, node_desc->type);\n free(node);\n return 1;\n }\n }\n free(node);\n return 0;\n}","target":"hfs_cat_traverse(HFS_INFO * hfs,\n TSK_HFS_BTREE_CB a_cb, void *ptr)\n{\n TSK_FS_INFO *fs = &(hfs->fs_info);\n uint32_t cur_node; /* node id of the current node */\n char *node;\n\n uint16_t nodesize;\n uint8_t is_done = 0;\n\n tsk_error_reset();\n\n nodesize = tsk_getu16(fs->endian, hfs->catalog_header.nodesize);\n if ((node = (char *) tsk_malloc(nodesize)) == NULL)\n return 1;\n\n /* start at root node */\n cur_node = tsk_getu32(fs->endian, hfs->catalog_header.rootNode);\n\n /* if the root node is zero, then the extents btree is empty */\n /* if no files have overflow extents, the Extents B-tree still\n exists on disk, but is an empty B-tree containing only\n the header node */\n if (cur_node == 0) {\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: \"\n \"empty extents btree\\n\");\n free(node);\n return 1;\n }\n\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: starting at \"\n \"root node %\" PRIu32 \"; nodesize = %\"\n PRIu16 \"\\n\", cur_node, nodesize);\n\n /* Recurse down to the needed leaf nodes and then go forward */\n is_done = 0;\n while (is_done == 0) {\n TSK_OFF_T cur_off; /* start address of cur_node */\n uint16_t num_rec; /* number of records in this node */\n ssize_t cnt;\n hfs_btree_node *node_desc;\n\n // sanity check\n if (cur_node > tsk_getu32(fs->endian,\n hfs->catalog_header.totalNodes)) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: Node %d too large for file\", cur_node);\n free(node);\n return 1;\n }\n\n // read the current node\n cur_off = cur_node * nodesize;\n cnt = tsk_fs_attr_read(hfs->catalog_attr, cur_off,\n node, nodesize, 0);\n if (cnt != nodesize) {\n if (cnt >= 0) {\n tsk_error_reset();\n tsk_error_set_errno(TSK_ERR_FS_READ);\n }\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Error reading node %d at offset %\"\n PRIuOFF, cur_node, cur_off);\n free(node);\n return 1;\n }\n\n // process the header / descriptor\n if (nodesize < sizeof(hfs_btree_node)) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: Node size %d is too small to be valid\", nodesize);\n free(node);\n return 1;\n }\n node_desc = (hfs_btree_node *) node;\n num_rec = tsk_getu16(fs->endian, node_desc->num_rec);\n\n if (tsk_verbose)\n tsk_fprintf(stderr, \"hfs_cat_traverse: node %\" PRIu32\n \" @ %\" PRIu64 \" has %\" PRIu16 \" records\\n\",\n cur_node, cur_off, num_rec);\n\n if (num_rec == 0) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr(\"hfs_cat_traverse: zero records in node %\"\n PRIu32, cur_node);\n free(node);\n return 1;\n }\n\n /* With an index node, find the record with the largest key that is smaller\n * to or equal to cnid */\n if (node_desc->type == HFS_BT_NODE_TYPE_IDX) {\n uint32_t next_node = 0;\n int rec;\n\n for (rec = 0; rec < num_rec; ++rec) {\n size_t rec_off;\n hfs_btree_key_cat *key;\n uint8_t retval;\n int keylen;\n\n // get the record offset in the node\n rec_off =\n tsk_getu16(fs->endian,\n &node[nodesize - (rec + 1) * 2]);\n if (rec_off > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, (int) rec_off,\n nodesize);\n free(node);\n return 1;\n }\n\n key = (hfs_btree_key_cat *) & node[rec_off];\n\n keylen = 2 + tsk_getu16(hfs->fs_info.endian, key->key_len);\n if ((keylen) > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: length of key %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, keylen, nodesize);\n free(node);\n return 1;\n }\n\n\n /*\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: record %\" PRIu16\n \" ; keylen %\" PRIu16 \" (%\" PRIu32 \")\\n\", rec,\n tsk_getu16(fs->endian, key->key_len),\n tsk_getu32(fs->endian, key->parent_cnid));\n */\n\n\n /* save the info from this record unless it is too big */\n retval =\n a_cb(hfs, HFS_BT_NODE_TYPE_IDX, key,\n cur_off + rec_off, ptr);\n if (retval == HFS_BTREE_CB_ERR) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Callback returned error\");\n free(node);\n return 1;\n }\n // record the closest entry\n else if ((retval == HFS_BTREE_CB_IDX_LT)\n || (next_node == 0)) {\n hfs_btree_index_record *idx_rec;\n int keylen =\n 2 + hfs_get_idxkeylen(hfs, tsk_getu16(fs->endian,\n key->key_len), &(hfs->catalog_header));\n if (rec_off + keylen > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record and keylength %d in index node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node,\n (int) rec_off + keylen, nodesize);\n free(node);\n return 1;\n }\n idx_rec =\n (hfs_btree_index_record *) & node[rec_off +\n keylen];\n next_node = tsk_getu32(fs->endian, idx_rec->childNode);\n }\n if (retval == HFS_BTREE_CB_IDX_EQGT) {\n // move down to the next node\n break;\n }\n }\n // check if we found a relevant node\n if (next_node == 0) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: did not find any keys in index node %d\",\n cur_node);\n is_done = 1;\n break;\n }\n // TODO: Handle multinode loops\n if (next_node == cur_node) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: node %d references itself as next node\",\n cur_node);\n is_done = 1;\n break;\n }\n cur_node = next_node;\n }\n\n /* With a leaf, we look for the specific record. */\n else if (node_desc->type == HFS_BT_NODE_TYPE_LEAF) {\n int rec;\n\n for (rec = 0; rec < num_rec; ++rec) {\n size_t rec_off;\n hfs_btree_key_cat *key;\n uint8_t retval;\n int keylen;\n\n // get the record offset in the node\n rec_off =\n tsk_getu16(fs->endian,\n &node[nodesize - (rec + 1) * 2]);\n if (rec_off > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: offset of record %d in leaf node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, (int) rec_off,\n nodesize);\n free(node);\n return 1;\n }\n key = (hfs_btree_key_cat *) & node[rec_off];\n\n keylen = 2 + tsk_getu16(hfs->fs_info.endian, key->key_len);\n if ((keylen) > nodesize) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr\n (\"hfs_cat_traverse: length of key %d in leaf node %d too large (%d vs %\"\n PRIu16 \")\", rec, cur_node, keylen, nodesize);\n free(node);\n return 1;\n }\n\n /*\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: record %\" PRIu16\n \"; keylen %\" PRIu16 \" (%\" PRIu32 \")\\n\", rec,\n tsk_getu16(fs->endian, key->key_len),\n tsk_getu32(fs->endian, key->parent_cnid));\n */\n // rec_cnid = tsk_getu32(fs->endian, key->file_id);\n\n retval =\n a_cb(hfs, HFS_BT_NODE_TYPE_LEAF, key,\n cur_off + rec_off, ptr);\n if (retval == HFS_BTREE_CB_LEAF_STOP) {\n is_done = 1;\n break;\n }\n else if (retval == HFS_BTREE_CB_ERR) {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr2\n (\"hfs_cat_traverse: Callback returned error\");\n free(node);\n return 1;\n }\n }\n\n // move right to the next node if we got this far\n if (is_done == 0) {\n cur_node = tsk_getu32(fs->endian, node_desc->flink);\n if (cur_node == 0) {\n is_done = 1;\n }\n if (tsk_verbose)\n tsk_fprintf(stderr,\n \"hfs_cat_traverse: moving forward to next leaf\");\n }\n }\n else {\n tsk_error_set_errno(TSK_ERR_FS_GENFS);\n tsk_error_set_errstr(\"hfs_cat_traverse: btree node %\" PRIu32\n \" (%\" PRIu64 \") is neither index nor leaf (%\" PRIu8 \")\",\n cur_node, cur_off, node_desc->type);\n free(node);\n return 1;\n }\n }\n free(node);\n return 0;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"hfs_cat_traverse","file_name":"tsk/fs/hfs.c","commit_link":"github.com/sleuthkit/sleuthkit/commit/114cd3d0aac8bd1aeaf4b33840feb0163d342d5b","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#29-39add5cb3df0","input":"PyImaging_MapBuffer(PyObject* self, PyObject* args)\n{\n Py_ssize_t y, size;\n Imaging im;\n\n PyObject* target;\n Py_buffer view;\n char* mode;\n char* codec;\n PyObject* bbox;\n Py_ssize_t offset;\n int xsize, ysize;\n int stride;\n int ystep;\n\n if (!PyArg_ParseTuple(args, \"O(ii)sOn(sii)\", &target, &xsize, &ysize,\n &codec, &bbox, &offset, &mode, &stride, &ystep))\n return NULL;\n\n if (!PyImaging_CheckBuffer(target)) {\n PyErr_SetString(PyExc_TypeError, \"expected string or buffer\");\n return NULL;\n }\n\n if (stride <= 0) {\n if (!strcmp(mode, \"L\") || !strcmp(mode, \"P\"))\n stride = xsize;\n else if (!strncmp(mode, \"I;16\", 4))\n stride = xsize * 2;\n else\n stride = xsize * 4;\n }\n\n size = (Py_ssize_t) ysize * stride;\n\n /* check buffer size */\n if (PyImaging_GetBuffer(target, &view) < 0)\n return NULL;\n\n if (view.len < 0) {\n PyErr_SetString(PyExc_ValueError, \"buffer has negative size\");\n return NULL;\n }\n if (offset + size > view.len) {\n PyErr_SetString(PyExc_ValueError, \"buffer is not large enough\");\n return NULL;\n }\n\n im = ImagingNewPrologueSubtype(\n mode, xsize, ysize, sizeof(ImagingBufferInstance)\n );\n if (!im)\n return NULL;\n\n /* setup file pointers */\n if (ystep > 0)\n for (y = 0; y < ysize; y++)\n im->image[y] = (char*)view.buf + offset + y * stride;\n else\n for (y = 0; y < ysize; y++)\n im->image[ysize-y-1] = (char*)view.buf + offset + y * stride;\n\n im->destroy = mapping_destroy_buffer;\n\n Py_INCREF(target);\n ((ImagingBufferInstance*) im)->target = target;\n ((ImagingBufferInstance*) im)->view = view;\n\n if (!ImagingNewEpilogue(im))\n return NULL;\n\n return PyImagingNew(im);\n}","target":"PyImaging_MapBuffer(PyObject* self, PyObject* args)\n{\n Py_ssize_t y, size;\n Imaging im;\n\n PyObject* target;\n Py_buffer view;\n char* mode;\n char* codec;\n PyObject* bbox;\n Py_ssize_t offset;\n int xsize, ysize;\n int stride;\n int ystep;\n\n if (!PyArg_ParseTuple(args, \"O(ii)sOn(sii)\", &target, &xsize, &ysize,\n &codec, &bbox, &offset, &mode, &stride, &ystep))\n return NULL;\n\n if (!PyImaging_CheckBuffer(target)) {\n PyErr_SetString(PyExc_TypeError, \"expected string or buffer\");\n return NULL;\n }\n\n if (stride <= 0) {\n if (!strcmp(mode, \"L\") || !strcmp(mode, \"P\"))\n stride = xsize;\n else if (!strncmp(mode, \"I;16\", 4))\n stride = xsize * 2;\n else\n stride = xsize * 4;\n }\n\n if (ysize > INT_MAX / stride) {\n PyErr_SetString(PyExc_MemoryError, \"Integer overflow in ysize\");\n return NULL;\n }\n\n size = (Py_ssize_t) ysize * stride;\n\n if (offset > SIZE_MAX - size) {\n PyErr_SetString(PyExc_MemoryError, \"Integer overflow in offset\");\n return NULL;\n } \n\n /* check buffer size */\n if (PyImaging_GetBuffer(target, &view) < 0)\n return NULL;\n\n if (view.len < 0) {\n PyErr_SetString(PyExc_ValueError, \"buffer has negative size\");\n return NULL;\n }\n if (offset + size > view.len) {\n PyErr_SetString(PyExc_ValueError, \"buffer is not large enough\");\n return NULL;\n }\n\n im = ImagingNewPrologueSubtype(\n mode, xsize, ysize, sizeof(ImagingBufferInstance)\n );\n if (!im)\n return NULL;\n\n /* setup file pointers */\n if (ystep > 0)\n for (y = 0; y < ysize; y++)\n im->image[y] = (char*)view.buf + offset + y * stride;\n else\n for (y = 0; y < ysize; y++)\n im->image[ysize-y-1] = (char*)view.buf + offset + y * stride;\n\n im->destroy = mapping_destroy_buffer;\n\n Py_INCREF(target);\n ((ImagingBufferInstance*) im)->target = target;\n ((ImagingBufferInstance*) im)->view = view;\n\n if (!ImagingNewEpilogue(im))\n return NULL;\n\n return PyImagingNew(im);\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"PyImaging_MapBuffer","file_name":"map.c","commit_link":"github.com/python-pillow/Pillow/commit/c50ebe6459a131a1ea8ca531f10da616d3ceaa0f","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#30-7f971d67599a","input":"static int read_entry(\n\tgit_index_entry **out,\n\tsize_t *out_size,\n\tgit_index *index,\n\tconst void *buffer,\n\tsize_t buffer_size,\n\tconst char *last)\n{\n\tsize_t path_length, entry_size;\n\tconst char *path_ptr;\n\tstruct entry_short source;\n\tgit_index_entry entry = {{0}};\n\tbool compressed = index->version >= INDEX_VERSION_NUMBER_COMP;\n\tchar *tmp_path = NULL;\n\n\tif (INDEX_FOOTER_SIZE + minimal_entry_size > buffer_size)\n\t\treturn -1;\n\n\t/* buffer is not guaranteed to be aligned */\n\tmemcpy(&source, buffer, sizeof(struct entry_short));\n\n\tentry.ctime.seconds = (git_time_t)ntohl(source.ctime.seconds);\n\tentry.ctime.nanoseconds = ntohl(source.ctime.nanoseconds);\n\tentry.mtime.seconds = (git_time_t)ntohl(source.mtime.seconds);\n\tentry.mtime.nanoseconds = ntohl(source.mtime.nanoseconds);\n\tentry.dev = ntohl(source.dev);\n\tentry.ino = ntohl(source.ino);\n\tentry.mode = ntohl(source.mode);\n\tentry.uid = ntohl(source.uid);\n\tentry.gid = ntohl(source.gid);\n\tentry.file_size = ntohl(source.file_size);\n\tgit_oid_cpy(&entry.id, &source.oid);\n\tentry.flags = ntohs(source.flags);\n\n\tif (entry.flags & GIT_IDXENTRY_EXTENDED) {\n\t\tuint16_t flags_raw;\n\t\tsize_t flags_offset;\n\n\t\tflags_offset = offsetof(struct entry_long, flags_extended);\n\t\tmemcpy(&flags_raw, (const char *) buffer + flags_offset,\n\t\t\tsizeof(flags_raw));\n\t\tflags_raw = ntohs(flags_raw);\n\n\t\tmemcpy(&entry.flags_extended, &flags_raw, sizeof(flags_raw));\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_long, path);\n\t} else\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_short, path);\n\n\tif (!compressed) {\n\t\tpath_length = entry.flags & GIT_IDXENTRY_NAMEMASK;\n\n\t\t/* if this is a very long string, we must find its\n\t\t * real length without overflowing */\n\t\tif (path_length == 0xFFF) {\n\t\t\tconst char *path_end;\n\n\t\t\tpath_end = memchr(path_ptr, '\\0', buffer_size);\n\t\t\tif (path_end == NULL)\n\t\t\t\treturn -1;\n\n\t\t\tpath_length = path_end - path_ptr;\n\t\t}\n\n\t\tentry_size = index_entry_size(path_length, 0, entry.flags);\n\t\tentry.path = (char *)path_ptr;\n\t} else {\n\t\tsize_t varint_len;\n\t\tsize_t strip_len = git_decode_varint((const unsigned char *)path_ptr,\n\t\t\t\t\t\t &varint_len);\n\t\tsize_t last_len = strlen(last);\n\t\tsize_t prefix_len = last_len - strip_len;\n\t\tsize_t suffix_len = strlen(path_ptr + varint_len);\n\t\tsize_t path_len;\n\n\t\tif (varint_len == 0)\n\t\t\treturn index_error_invalid(\"incorrect prefix length\");\n\n\t\tGITERR_CHECK_ALLOC_ADD(&path_len, prefix_len, suffix_len);\n\t\tGITERR_CHECK_ALLOC_ADD(&path_len, path_len, 1);\n\t\ttmp_path = git__malloc(path_len);\n\t\tGITERR_CHECK_ALLOC(tmp_path);\n\n\t\tmemcpy(tmp_path, last, prefix_len);\n\t\tmemcpy(tmp_path + prefix_len, path_ptr + varint_len, suffix_len + 1);\n\t\tentry_size = index_entry_size(suffix_len, varint_len, entry.flags);\n\t\tentry.path = tmp_path;\n\t}\n\n\tif (entry_size == 0)\n\t\treturn -1;\n\n\tif (INDEX_FOOTER_SIZE + entry_size > buffer_size)\n\t\treturn -1;\n\n\tif (index_entry_dup(out, index, &entry) < 0) {\n\t\tgit__free(tmp_path);\n\t\treturn -1;\n\t}\n\n\tgit__free(tmp_path);\n\t*out_size = entry_size;\n\treturn 0;\n}","target":"static int read_entry(\n\tgit_index_entry **out,\n\tsize_t *out_size,\n\tgit_index *index,\n\tconst void *buffer,\n\tsize_t buffer_size,\n\tconst char *last)\n{\n\tsize_t path_length, entry_size;\n\tconst char *path_ptr;\n\tstruct entry_short source;\n\tgit_index_entry entry = {{0}};\n\tbool compressed = index->version >= INDEX_VERSION_NUMBER_COMP;\n\tchar *tmp_path = NULL;\n\n\tif (INDEX_FOOTER_SIZE + minimal_entry_size > buffer_size)\n\t\treturn -1;\n\n\t/* buffer is not guaranteed to be aligned */\n\tmemcpy(&source, buffer, sizeof(struct entry_short));\n\n\tentry.ctime.seconds = (git_time_t)ntohl(source.ctime.seconds);\n\tentry.ctime.nanoseconds = ntohl(source.ctime.nanoseconds);\n\tentry.mtime.seconds = (git_time_t)ntohl(source.mtime.seconds);\n\tentry.mtime.nanoseconds = ntohl(source.mtime.nanoseconds);\n\tentry.dev = ntohl(source.dev);\n\tentry.ino = ntohl(source.ino);\n\tentry.mode = ntohl(source.mode);\n\tentry.uid = ntohl(source.uid);\n\tentry.gid = ntohl(source.gid);\n\tentry.file_size = ntohl(source.file_size);\n\tgit_oid_cpy(&entry.id, &source.oid);\n\tentry.flags = ntohs(source.flags);\n\n\tif (entry.flags & GIT_IDXENTRY_EXTENDED) {\n\t\tuint16_t flags_raw;\n\t\tsize_t flags_offset;\n\n\t\tflags_offset = offsetof(struct entry_long, flags_extended);\n\t\tmemcpy(&flags_raw, (const char *) buffer + flags_offset,\n\t\t\tsizeof(flags_raw));\n\t\tflags_raw = ntohs(flags_raw);\n\n\t\tmemcpy(&entry.flags_extended, &flags_raw, sizeof(flags_raw));\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_long, path);\n\t} else\n\t\tpath_ptr = (const char *) buffer + offsetof(struct entry_short, path);\n\n\tif (!compressed) {\n\t\tpath_length = entry.flags & GIT_IDXENTRY_NAMEMASK;\n\n\t\t/* if this is a very long string, we must find its\n\t\t * real length without overflowing */\n\t\tif (path_length == 0xFFF) {\n\t\t\tconst char *path_end;\n\n\t\t\tpath_end = memchr(path_ptr, '\\0', buffer_size);\n\t\t\tif (path_end == NULL)\n\t\t\t\treturn -1;\n\n\t\t\tpath_length = path_end - path_ptr;\n\t\t}\n\n\t\tentry_size = index_entry_size(path_length, 0, entry.flags);\n\t\tentry.path = (char *)path_ptr;\n\t} else {\n\t\tsize_t varint_len, last_len, prefix_len, suffix_len, path_len;\n\t\tuintmax_t strip_len;\n\n\t\tstrip_len = git_decode_varint((const unsigned char *)path_ptr, &varint_len);\n\t\tlast_len = strlen(last);\n\n\t\tif (varint_len == 0 || last_len < strip_len)\n\t\t\treturn index_error_invalid(\"incorrect prefix length\");\n\n\t\tprefix_len = last_len - strip_len;\n\t\tsuffix_len = strlen(path_ptr + varint_len);\n\n\t\tGITERR_CHECK_ALLOC_ADD(&path_len, prefix_len, suffix_len);\n\t\tGITERR_CHECK_ALLOC_ADD(&path_len, path_len, 1);\n\t\ttmp_path = git__malloc(path_len);\n\t\tGITERR_CHECK_ALLOC(tmp_path);\n\n\t\tmemcpy(tmp_path, last, prefix_len);\n\t\tmemcpy(tmp_path + prefix_len, path_ptr + varint_len, suffix_len + 1);\n\t\tentry_size = index_entry_size(suffix_len, varint_len, entry.flags);\n\t\tentry.path = tmp_path;\n\t}\n\n\tif (entry_size == 0)\n\t\treturn -1;\n\n\tif (INDEX_FOOTER_SIZE + entry_size > buffer_size)\n\t\treturn -1;\n\n\tif (index_entry_dup(out, index, &entry) < 0) {\n\t\tgit__free(tmp_path);\n\t\treturn -1;\n\t}\n\n\tgit__free(tmp_path);\n\t*out_size = entry_size;\n\treturn 0;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"read_entry","file_name":"src/index.c","commit_link":"github.com/libgit2/libgit2/commit/3207ddb0103543da8ad2139ec6539f590f9900c1","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#31-9f21ef4303c1","input":"read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss,\n struct _7z_folder *f, size_t numFolders)\n{\n\tconst unsigned char *p;\n\tuint64_t *usizes;\n\tsize_t unpack_streams;\n\tint type;\n\tunsigned i;\n\tuint32_t numDigests;\n\n\tmemset(ss, 0, sizeof(*ss));\n\n\tfor (i = 0; i < numFolders; i++)\n\t\tf[i].numUnpackStreams = 1;\n\n\tif ((p = header_bytes(a, 1)) == NULL)\n\t\treturn (-1);\n\ttype = *p;\n\n\tif (type == kNumUnPackStream) {\n\t\tunpack_streams = 0;\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (parse_7zip_uint64(a, &(f[i].numUnpackStreams)) < 0)\n\t\t\t\treturn (-1);\n\t\t\tif (UMAX_ENTRY < f[i].numUnpackStreams)\n\t\t\t\treturn (-1);\n\t\t\tunpack_streams += (size_t)f[i].numUnpackStreams;\n\t\t}\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t} else\n\t\tunpack_streams = numFolders;\n\n\tss->unpack_streams = unpack_streams;\n\tif (unpack_streams) {\n\t\tss->unpackSizes = calloc(unpack_streams,\n\t\t sizeof(*ss->unpackSizes));\n\t\tss->digestsDefined = calloc(unpack_streams,\n\t\t sizeof(*ss->digestsDefined));\n\t\tss->digests = calloc(unpack_streams,\n\t\t sizeof(*ss->digests));\n\t\tif (ss->unpackSizes == NULL || ss->digestsDefined == NULL ||\n\t\t ss->digests == NULL)\n\t\t\treturn (-1);\n\t}\n\n\tusizes = ss->unpackSizes;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tunsigned pack;\n\t\tuint64_t sum;\n\n\t\tif (f[i].numUnpackStreams == 0)\n\t\t\tcontinue;\n\n\t\tsum = 0;\n\t\tif (type == kSize) {\n\t\t\tfor (pack = 1; pack < f[i].numUnpackStreams; pack++) {\n\t\t\t\tif (parse_7zip_uint64(a, usizes) < 0)\n\t\t\t\t\treturn (-1);\n\t\t\t\tsum += *usizes++;\n\t\t\t}\n\t\t}\n\t\t*usizes++ = folder_uncompressed_size(&f[i]) - sum;\n\t}\n\n\tif (type == kSize) {\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\tfor (i = 0; i < unpack_streams; i++) {\n\t\tss->digestsDefined[i] = 0;\n\t\tss->digests[i] = 0;\n\t}\n\n\tnumDigests = 0;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tif (f[i].numUnpackStreams != 1 || !f[i].digest_defined)\n\t\t\tnumDigests += (uint32_t)f[i].numUnpackStreams;\n\t}\n\n\tif (type == kCRC) {\n\t\tstruct _7z_digests tmpDigests;\n\t\tunsigned char *digestsDefined = ss->digestsDefined;\n\t\tuint32_t * digests = ss->digests;\n\t\tint di = 0;\n\n\t\tmemset(&tmpDigests, 0, sizeof(tmpDigests));\n\t\tif (read_Digests(a, &(tmpDigests), numDigests) < 0) {\n\t\t\tfree_Digest(&tmpDigests);\n\t\t\treturn (-1);\n\t\t}\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (f[i].numUnpackStreams == 1 && f[i].digest_defined) {\n\t\t\t\t*digestsDefined++ = 1;\n\t\t\t\t*digests++ = f[i].digest;\n\t\t\t} else {\n\t\t\t\tunsigned j;\n\n\t\t\t\tfor (j = 0; j < f[i].numUnpackStreams;\n\t\t\t\t j++, di++) {\n\t\t\t\t\t*digestsDefined++ =\n\t\t\t\t\t tmpDigests.defineds[di];\n\t\t\t\t\t*digests++ =\n\t\t\t\t\t tmpDigests.digests[di];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfree_Digest(&tmpDigests);\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\t/*\n\t * Must be kEnd.\n\t */\n\tif (type != kEnd)\n\t\treturn (-1);\n\treturn (0);\n}","target":"read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss,\n struct _7z_folder *f, size_t numFolders)\n{\n\tconst unsigned char *p;\n\tuint64_t *usizes;\n\tsize_t unpack_streams;\n\tint type;\n\tunsigned i;\n\tuint32_t numDigests;\n\n\tmemset(ss, 0, sizeof(*ss));\n\n\tfor (i = 0; i < numFolders; i++)\n\t\tf[i].numUnpackStreams = 1;\n\n\tif ((p = header_bytes(a, 1)) == NULL)\n\t\treturn (-1);\n\ttype = *p;\n\n\tif (type == kNumUnPackStream) {\n\t\tunpack_streams = 0;\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (parse_7zip_uint64(a, &(f[i].numUnpackStreams)) < 0)\n\t\t\t\treturn (-1);\n\t\t\tif (UMAX_ENTRY < f[i].numUnpackStreams)\n\t\t\t\treturn (-1);\n\t\t\tif (unpack_streams > SIZE_MAX - UMAX_ENTRY) {\n\t\t\t\treturn (-1);\n\t\t\t}\n\t\t\tunpack_streams += (size_t)f[i].numUnpackStreams;\n\t\t}\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t} else\n\t\tunpack_streams = numFolders;\n\n\tss->unpack_streams = unpack_streams;\n\tif (unpack_streams) {\n\t\tss->unpackSizes = calloc(unpack_streams,\n\t\t sizeof(*ss->unpackSizes));\n\t\tss->digestsDefined = calloc(unpack_streams,\n\t\t sizeof(*ss->digestsDefined));\n\t\tss->digests = calloc(unpack_streams,\n\t\t sizeof(*ss->digests));\n\t\tif (ss->unpackSizes == NULL || ss->digestsDefined == NULL ||\n\t\t ss->digests == NULL)\n\t\t\treturn (-1);\n\t}\n\n\tusizes = ss->unpackSizes;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tunsigned pack;\n\t\tuint64_t sum;\n\n\t\tif (f[i].numUnpackStreams == 0)\n\t\t\tcontinue;\n\n\t\tsum = 0;\n\t\tif (type == kSize) {\n\t\t\tfor (pack = 1; pack < f[i].numUnpackStreams; pack++) {\n\t\t\t\tif (parse_7zip_uint64(a, usizes) < 0)\n\t\t\t\t\treturn (-1);\n\t\t\t\tsum += *usizes++;\n\t\t\t}\n\t\t}\n\t\t*usizes++ = folder_uncompressed_size(&f[i]) - sum;\n\t}\n\n\tif (type == kSize) {\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\tfor (i = 0; i < unpack_streams; i++) {\n\t\tss->digestsDefined[i] = 0;\n\t\tss->digests[i] = 0;\n\t}\n\n\tnumDigests = 0;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tif (f[i].numUnpackStreams != 1 || !f[i].digest_defined)\n\t\t\tnumDigests += (uint32_t)f[i].numUnpackStreams;\n\t}\n\n\tif (type == kCRC) {\n\t\tstruct _7z_digests tmpDigests;\n\t\tunsigned char *digestsDefined = ss->digestsDefined;\n\t\tuint32_t * digests = ss->digests;\n\t\tint di = 0;\n\n\t\tmemset(&tmpDigests, 0, sizeof(tmpDigests));\n\t\tif (read_Digests(a, &(tmpDigests), numDigests) < 0) {\n\t\t\tfree_Digest(&tmpDigests);\n\t\t\treturn (-1);\n\t\t}\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (f[i].numUnpackStreams == 1 && f[i].digest_defined) {\n\t\t\t\t*digestsDefined++ = 1;\n\t\t\t\t*digests++ = f[i].digest;\n\t\t\t} else {\n\t\t\t\tunsigned j;\n\n\t\t\t\tfor (j = 0; j < f[i].numUnpackStreams;\n\t\t\t\t j++, di++) {\n\t\t\t\t\t*digestsDefined++ =\n\t\t\t\t\t tmpDigests.defineds[di];\n\t\t\t\t\t*digests++ =\n\t\t\t\t\t tmpDigests.digests[di];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfree_Digest(&tmpDigests);\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\t/*\n\t * Must be kEnd.\n\t */\n\tif (type != kEnd)\n\t\treturn (-1);\n\treturn (0);\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"read_SubStreamsInfo","file_name":"libarchive/archive_read_support_format_7zip.c","commit_link":"github.com/libarchive/libarchive/commit/e79ef306afe332faf22e9b442a2c6b59cb175573","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#32-4f469965a46d","input":"static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,\n const BYTE* pSrcData, UINT32 DstWidth, UINT32 DstHeight,\n UINT32 bpp, UINT32 length, BOOL compressed,\n UINT32 codecId)\n{\n\tUINT32 SrcSize = length;\n\trdpGdi* gdi = context->gdi;\n\tbitmap->compressed = FALSE;\n\tbitmap->format = gdi->dstFormat;\n\tbitmap->length = DstWidth * DstHeight * GetBytesPerPixel(bitmap->format);\n\tbitmap->data = (BYTE*) _aligned_malloc(bitmap->length, 16);\n\n\tif (!bitmap->data)\n\t\treturn FALSE;\n\n\tif (compressed)\n\t{\n\t\tif (bpp < 32)\n\t\t{\n\t\t\tif (!interleaved_decompress(context->codecs->interleaved,\n\t\t\t pSrcData, SrcSize,\n\t\t\t DstWidth, DstHeight,\n\t\t\t bpp,\n\t\t\t bitmap->data, bitmap->format,\n\t\t\t 0, 0, 0, DstWidth, DstHeight,\n\t\t\t &gdi->palette))\n\t\t\t\treturn FALSE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (!planar_decompress(context->codecs->planar, pSrcData, SrcSize,\n\t\t\t DstWidth, DstHeight,\n\t\t\t bitmap->data, bitmap->format, 0, 0, 0,\n\t\t\t DstWidth, DstHeight, TRUE))\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tconst UINT32 SrcFormat = gdi_get_pixel_format(bpp);\n\t\tconst size_t sbpp = GetBytesPerPixel(SrcFormat);\n\t\tconst size_t dbpp = GetBytesPerPixel(bitmap->format);\n\n\t\tif ((sbpp == 0) || (dbpp == 0))\n\t\t\treturn FALSE;\n\t\telse\n\t\t{\n\t\t\tconst size_t dstSize = SrcSize * dbpp / sbpp;\n\n\t\t\tif (dstSize < bitmap->length)\n\t\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (!freerdp_image_copy(bitmap->data, bitmap->format, 0, 0, 0,\n\t\t DstWidth, DstHeight, pSrcData, SrcFormat,\n\t\t 0, 0, 0, &gdi->palette, FREERDP_FLIP_VERTICAL))\n\t\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}","target":"static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,\n const BYTE* pSrcData, UINT32 DstWidth, UINT32 DstHeight,\n UINT32 bpp, UINT32 length, BOOL compressed,\n UINT32 codecId)\n{\n\tUINT32 SrcSize = length;\n\trdpGdi* gdi = context->gdi;\n\tUINT32 size = DstWidth * DstHeight;\n\tbitmap->compressed = FALSE;\n\tbitmap->format = gdi->dstFormat;\n\n\tif ((GetBytesPerPixel(bitmap->format) == 0) ||\n\t (DstWidth == 0) || (DstHeight == 0) || (DstWidth > UINT32_MAX / DstHeight) ||\n\t (size > (UINT32_MAX / GetBytesPerPixel(bitmap->format))))\n\t\treturn FALSE;\n\n\tsize *= GetBytesPerPixel(bitmap->format);\n\tbitmap->length = size;\n\tbitmap->data = (BYTE*) _aligned_malloc(bitmap->length, 16);\n\n\tif (!bitmap->data)\n\t\treturn FALSE;\n\n\tif (compressed)\n\t{\n\t\tif (bpp < 32)\n\t\t{\n\t\t\tif (!interleaved_decompress(context->codecs->interleaved,\n\t\t\t pSrcData, SrcSize,\n\t\t\t DstWidth, DstHeight,\n\t\t\t bpp,\n\t\t\t bitmap->data, bitmap->format,\n\t\t\t 0, 0, 0, DstWidth, DstHeight,\n\t\t\t &gdi->palette))\n\t\t\t\treturn FALSE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (!planar_decompress(context->codecs->planar, pSrcData, SrcSize,\n\t\t\t DstWidth, DstHeight,\n\t\t\t bitmap->data, bitmap->format, 0, 0, 0,\n\t\t\t DstWidth, DstHeight, TRUE))\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tconst UINT32 SrcFormat = gdi_get_pixel_format(bpp);\n\t\tconst size_t sbpp = GetBytesPerPixel(SrcFormat);\n\t\tconst size_t dbpp = GetBytesPerPixel(bitmap->format);\n\n\t\tif ((sbpp == 0) || (dbpp == 0))\n\t\t\treturn FALSE;\n\t\telse\n\t\t{\n\t\t\tconst size_t dstSize = SrcSize * dbpp / sbpp;\n\n\t\t\tif (dstSize < bitmap->length)\n\t\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (!freerdp_image_copy(bitmap->data, bitmap->format, 0, 0, 0,\n\t\t DstWidth, DstHeight, pSrcData, SrcFormat,\n\t\t 0, 0, 0, &gdi->palette, FREERDP_FLIP_VERTICAL))\n\t\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"gdi_Bitmap_Decompress","file_name":"libfreerdp/gdi/graphics.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/09b9d4f1994a674c4ec85b4947aa656eda1aed8a","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#33-3d4adfe350d5","input":"SWFInput_readSBits(SWFInput input, int number)\n{\n\tint num = SWFInput_readBits(input, number);\n\n\tif ( num & (1<<(number-1)) )\n\t\treturn num - (1<layers[layer].width;\n\told_height = s_map->layers[layer].height;\n\n\t// allocate a new tilemap and copy the old layer tiles into it. we can't simply realloc\n\t// because the tilemap is a 2D array.\n\tif (!(tilemap = malloc(x_size * y_size * sizeof(struct map_tile))))\n\t\treturn false;\n\tfor (x = 0; x < x_size; ++x) {\n\t\tfor (y = 0; y < y_size; ++y) {\n\t\t\tif (x < old_width && y < old_height) {\n\t\t\t\ttilemap[x + y * x_size] = s_map->layers[layer].tilemap[x + y * old_width];\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttile = &tilemap[x + y * x_size];\n\t\t\t\ttile->frames_left = tileset_get_delay(s_map->tileset, 0);\n\t\t\t\ttile->tile_index = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\t// free the old tilemap and substitute the new one\n\tfree(s_map->layers[layer].tilemap);\n\ts_map->layers[layer].tilemap = tilemap;\n\ts_map->layers[layer].width = x_size;\n\ts_map->layers[layer].height = y_size;\n\n\t// if we resize the largest layer, the overall map size will change.\n\t// recalcuate it.\n\ttileset_get_size(s_map->tileset, &tile_width, &tile_height);\n\ts_map->width = 0;\n\ts_map->height = 0;\n\tfor (i = 0; i < s_map->num_layers; ++i) {\n\t\tif (!s_map->layers[i].is_parallax) {\n\t\t\ts_map->width = fmax(s_map->width, s_map->layers[i].width * tile_width);\n\t\t\ts_map->height = fmax(s_map->height, s_map->layers[i].height * tile_height);\n\t\t}\n\t}\n\n\t// ensure zones and triggers remain in-bounds. if any are completely\n\t// out-of-bounds, delete them.\n\tfor (i = (int)vector_len(s_map->zones) - 1; i >= 0; --i) {\n\t\tzone = vector_get(s_map->zones, i);\n\t\tif (zone->bounds.x1 >= s_map->width || zone->bounds.y1 >= s_map->height)\n\t\t\tvector_remove(s_map->zones, i);\n\t\telse {\n\t\t\tif (zone->bounds.x2 > s_map->width)\n\t\t\t\tzone->bounds.x2 = s_map->width;\n\t\t\tif (zone->bounds.y2 > s_map->height)\n\t\t\t\tzone->bounds.y2 = s_map->height;\n\t\t}\n\t}\n\tfor (i = (int)vector_len(s_map->triggers) - 1; i >= 0; --i) {\n\t\ttrigger = vector_get(s_map->triggers, i);\n\t\tif (trigger->x >= s_map->width || trigger->y >= s_map->height)\n\t\t\tvector_remove(s_map->triggers, i);\n\t}\n\n\treturn true;\n}","target":"layer_resize(int layer, int x_size, int y_size)\n{\n\tint old_height;\n\tint old_width;\n\tstruct map_tile* tile;\n\tint tile_width;\n\tint tile_height;\n\tstruct map_tile* tilemap;\n\tstruct map_trigger* trigger;\n\tstruct map_zone* zone;\n\tsize_t tilemap_size;\n\n\tint x, y, i;\n\n\told_width = s_map->layers[layer].width;\n\told_height = s_map->layers[layer].height;\n\n\t// allocate a new tilemap and copy the old layer tiles into it. we can't simply realloc\n\t// because the tilemap is a 2D array.\n\ttilemap_size = x_size * y_size * sizeof(struct map_tile);\n\tif (x_size == 0 || tilemap_size / x_size / sizeof(struct map_tile) != y_size\n\t\t|| !(tilemap = malloc(tilemap_size)))\n\t\treturn false;\n\tfor (x = 0; x < x_size; ++x) {\n\t\tfor (y = 0; y < y_size; ++y) {\n\t\t\tif (x < old_width && y < old_height) {\n\t\t\t\ttilemap[x + y * x_size] = s_map->layers[layer].tilemap[x + y * old_width];\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttile = &tilemap[x + y * x_size];\n\t\t\t\ttile->frames_left = tileset_get_delay(s_map->tileset, 0);\n\t\t\t\ttile->tile_index = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\t// free the old tilemap and substitute the new one\n\tfree(s_map->layers[layer].tilemap);\n\ts_map->layers[layer].tilemap = tilemap;\n\ts_map->layers[layer].width = x_size;\n\ts_map->layers[layer].height = y_size;\n\n\t// if we resize the largest layer, the overall map size will change.\n\t// recalcuate it.\n\ttileset_get_size(s_map->tileset, &tile_width, &tile_height);\n\ts_map->width = 0;\n\ts_map->height = 0;\n\tfor (i = 0; i < s_map->num_layers; ++i) {\n\t\tif (!s_map->layers[i].is_parallax) {\n\t\t\ts_map->width = fmax(s_map->width, s_map->layers[i].width * tile_width);\n\t\t\ts_map->height = fmax(s_map->height, s_map->layers[i].height * tile_height);\n\t\t}\n\t}\n\n\t// ensure zones and triggers remain in-bounds. if any are completely\n\t// out-of-bounds, delete them.\n\tfor (i = (int)vector_len(s_map->zones) - 1; i >= 0; --i) {\n\t\tzone = vector_get(s_map->zones, i);\n\t\tif (zone->bounds.x1 >= s_map->width || zone->bounds.y1 >= s_map->height)\n\t\t\tvector_remove(s_map->zones, i);\n\t\telse {\n\t\t\tif (zone->bounds.x2 > s_map->width)\n\t\t\t\tzone->bounds.x2 = s_map->width;\n\t\t\tif (zone->bounds.y2 > s_map->height)\n\t\t\t\tzone->bounds.y2 = s_map->height;\n\t\t}\n\t}\n\tfor (i = (int)vector_len(s_map->triggers) - 1; i >= 0; --i) {\n\t\ttrigger = vector_get(s_map->triggers, i);\n\t\tif (trigger->x >= s_map->width || trigger->y >= s_map->height)\n\t\t\tvector_remove(s_map->triggers, i);\n\t}\n\n\treturn true;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"layer_resize","file_name":"src/minisphere/map_engine.c","commit_link":"github.com/fatcerberus/minisphere/commit/252c1ca184cb38e1acb917aa0e451c5f08519996","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#35-2e83f7a124b9","input":"static MagickRealType ApplyEvaluateOperator(RandomInfo *random_info,\n const Quantum pixel,const MagickEvaluateOperator op,\n const MagickRealType value)\n{\n MagickRealType\n result;\n\n result=0.0;\n switch (op)\n {\n case UndefinedEvaluateOperator:\n break;\n case AbsEvaluateOperator:\n {\n result=(MagickRealType) fabs((double) (pixel+value));\n break;\n }\n case AddEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case AddModulusEvaluateOperator:\n {\n /*\n This returns a 'floored modulus' of the addition which is a\n positive result. It differs from % or fmod() which returns a\n 'truncated modulus' result, where floor() is replaced by trunc()\n and could return a negative result (which is clipped).\n */\n result=pixel+value;\n result-=(QuantumRange+1.0)*floor((double) result/(QuantumRange+1.0));\n break;\n }\n case AndEvaluateOperator:\n {\n result=(MagickRealType) ((size_t) pixel & (size_t) (value+0.5));\n break;\n }\n case CosineEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*(0.5*cos((double) (2.0*MagickPI*\n QuantumScale*pixel*value))+0.5));\n break;\n }\n case DivideEvaluateOperator:\n {\n result=pixel/(value == 0.0 ? 1.0 : value);\n break;\n }\n case ExponentialEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*exp((double) (value*QuantumScale*\n pixel)));\n break;\n }\n case GaussianNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n GaussianNoise,value);\n break;\n }\n case ImpulseNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n ImpulseNoise,value);\n break;\n }\n case LaplacianNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n LaplacianNoise,value);\n break;\n }\n case LeftShiftEvaluateOperator:\n {\n result=(MagickRealType) ((size_t) pixel << (size_t) (value+0.5));\n break;\n }\n case LogEvaluateOperator:\n {\n if ((QuantumScale*pixel) >= MagickEpsilon)\n result=(MagickRealType) (QuantumRange*log((double) (QuantumScale*value*\n pixel+1.0))/log((double) (value+1.0)));\n break;\n }\n case MaxEvaluateOperator:\n {\n result=(MagickRealType) EvaluateMax((double) pixel,value);\n break;\n }\n case MeanEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case MedianEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case MinEvaluateOperator:\n {\n result=(MagickRealType) MagickMin((double) pixel,value);\n break;\n }\n case MultiplicativeNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n MultiplicativeGaussianNoise,value);\n break;\n }\n case MultiplyEvaluateOperator:\n {\n result=(MagickRealType) (value*pixel);\n break;\n }\n case OrEvaluateOperator:\n {\n result=(MagickRealType) ((size_t) pixel | (size_t) (value+0.5));\n break;\n }\n case PoissonNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n PoissonNoise,value);\n break;\n }\n case PowEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*pow((double) (QuantumScale*pixel),\n (double) value));\n break;\n }\n case RightShiftEvaluateOperator:\n {\n result=(MagickRealType) ((size_t) pixel >> (size_t) (value+0.5));\n break;\n }\n case RootMeanSquareEvaluateOperator:\n {\n result=(MagickRealType) (pixel*pixel+value);\n break;\n }\n case SetEvaluateOperator:\n {\n result=value;\n break;\n }\n case SineEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*(0.5*sin((double) (2.0*MagickPI*\n QuantumScale*pixel*value))+0.5));\n break;\n }\n case SubtractEvaluateOperator:\n {\n result=(MagickRealType) (pixel-value);\n break;\n }\n case SumEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case ThresholdEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel <= value) ? 0 :\n QuantumRange);\n break;\n }\n case ThresholdBlackEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel <= value) ? 0 : pixel);\n break;\n }\n case ThresholdWhiteEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel > value) ? QuantumRange :\n pixel);\n break;\n }\n case UniformNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n UniformNoise,value);\n break;\n }\n case XorEvaluateOperator:\n {\n result=(MagickRealType) ((size_t) pixel ^ (size_t) (value+0.5));\n break;\n }\n }\n return(result);\n}","target":"static MagickRealType ApplyEvaluateOperator(RandomInfo *random_info,\n const Quantum pixel,const MagickEvaluateOperator op,\n const MagickRealType value)\n{\n MagickRealType\n result;\n\n result=0.0;\n switch (op)\n {\n case UndefinedEvaluateOperator:\n break;\n case AbsEvaluateOperator:\n {\n result=(MagickRealType) fabs((double) (pixel+value));\n break;\n }\n case AddEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case AddModulusEvaluateOperator:\n {\n /*\n This returns a 'floored modulus' of the addition which is a\n positive result. It differs from % or fmod() which returns a\n 'truncated modulus' result, where floor() is replaced by trunc()\n and could return a negative result (which is clipped).\n */\n result=pixel+value;\n result-=(QuantumRange+1.0)*floor((double) result/(QuantumRange+1.0));\n break;\n }\n case AndEvaluateOperator:\n {\n result=(MagickRealType) ((ssize_t) pixel & (ssize_t) (value+0.5));\n break;\n }\n case CosineEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*(0.5*cos((double) (2.0*MagickPI*\n QuantumScale*pixel*value))+0.5));\n break;\n }\n case DivideEvaluateOperator:\n {\n result=pixel/(value == 0.0 ? 1.0 : value);\n break;\n }\n case ExponentialEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*exp((double) (value*QuantumScale*\n pixel)));\n break;\n }\n case GaussianNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n GaussianNoise,value);\n break;\n }\n case ImpulseNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n ImpulseNoise,value);\n break;\n }\n case LaplacianNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n LaplacianNoise,value);\n break;\n }\n case LeftShiftEvaluateOperator:\n {\n result=(MagickRealType) ((ssize_t) pixel << (ssize_t) (value+0.5));\n break;\n }\n case LogEvaluateOperator:\n {\n if ((QuantumScale*pixel) >= MagickEpsilon)\n result=(MagickRealType) (QuantumRange*log((double) (QuantumScale*value*\n pixel+1.0))/log((double) (value+1.0)));\n break;\n }\n case MaxEvaluateOperator:\n {\n result=(MagickRealType) EvaluateMax((double) pixel,value);\n break;\n }\n case MeanEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case MedianEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case MinEvaluateOperator:\n {\n result=(MagickRealType) MagickMin((double) pixel,value);\n break;\n }\n case MultiplicativeNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n MultiplicativeGaussianNoise,value);\n break;\n }\n case MultiplyEvaluateOperator:\n {\n result=(MagickRealType) (value*pixel);\n break;\n }\n case OrEvaluateOperator:\n {\n result=(MagickRealType) ((ssize_t) pixel | (ssize_t) (value+0.5));\n break;\n }\n case PoissonNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n PoissonNoise,value);\n break;\n }\n case PowEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*pow((double) (QuantumScale*pixel),\n (double) value));\n break;\n }\n case RightShiftEvaluateOperator:\n {\n result=(MagickRealType) ((ssize_t) pixel >> (ssize_t) (value+0.5));\n break;\n }\n case RootMeanSquareEvaluateOperator:\n {\n result=(MagickRealType) (pixel*pixel+value);\n break;\n }\n case SetEvaluateOperator:\n {\n result=value;\n break;\n }\n case SineEvaluateOperator:\n {\n result=(MagickRealType) (QuantumRange*(0.5*sin((double) (2.0*MagickPI*\n QuantumScale*pixel*value))+0.5));\n break;\n }\n case SubtractEvaluateOperator:\n {\n result=(MagickRealType) (pixel-value);\n break;\n }\n case SumEvaluateOperator:\n {\n result=(MagickRealType) (pixel+value);\n break;\n }\n case ThresholdEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel <= value) ? 0 :\n QuantumRange);\n break;\n }\n case ThresholdBlackEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel <= value) ? 0 : pixel);\n break;\n }\n case ThresholdWhiteEvaluateOperator:\n {\n result=(MagickRealType) (((MagickRealType) pixel > value) ? QuantumRange :\n pixel);\n break;\n }\n case UniformNoiseEvaluateOperator:\n {\n result=(MagickRealType) GenerateDifferentialNoise(random_info,pixel,\n UniformNoise,value);\n break;\n }\n case XorEvaluateOperator:\n {\n result=(MagickRealType) ((ssize_t) pixel ^ (ssize_t) (value+0.5));\n break;\n }\n }\n return(result);\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"ApplyEvaluateOperator","file_name":"magick/statistic.c","commit_link":"github.com/ImageMagick/ImageMagick6/commit/3e21bc8a58b4ae38d24c7e283837cc279f35b6a5","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#36-d6d83138474a","input":"authDigestNonceLink(digest_nonce_h * nonce)\n{\n assert(nonce != NULL);\n ++nonce->references;\n debugs(29, 9, \"nonce '\" << nonce << \"' now at '\" << nonce->references << \"'.\");\n}","target":"authDigestNonceLink(digest_nonce_h * nonce)\n{\n assert(nonce != NULL);\n ++nonce->references;\n assert(nonce->references != 0); // no overflows\n debugs(29, 9, \"nonce '\" << nonce << \"' now at '\" << nonce->references << \"'.\");\n}","lang":"cpp","vul_type":"cwe-190","sven_meta":{"func_name":"authDigestNonceLink","file_name":"src/auth/digest/Config.cc","commit_link":"github.com/squid-cache/squid/commit/eeebf0f37a72a2de08348e85ae34b02c34e9a811","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#37-122859b8778f","input":"static int jpc_dec_process_siz(jpc_dec_t *dec, jpc_ms_t *ms)\n{\n\tjpc_siz_t *siz = &ms->parms.siz;\n\tint compno;\n\tint tileno;\n\tjpc_dec_tile_t *tile;\n\tjpc_dec_tcomp_t *tcomp;\n\tint htileno;\n\tint vtileno;\n\tjpc_dec_cmpt_t *cmpt;\n\n\tdec->xstart = siz->xoff;\n\tdec->ystart = siz->yoff;\n\tdec->xend = siz->width;\n\tdec->yend = siz->height;\n\tdec->tilewidth = siz->tilewidth;\n\tdec->tileheight = siz->tileheight;\n\tdec->tilexoff = siz->tilexoff;\n\tdec->tileyoff = siz->tileyoff;\n\tdec->numcomps = siz->numcomps;\n\tif (!(dec->cp = jpc_dec_cp_create(dec->numcomps))) {\n\t\treturn -1;\n\t}\n\n\tif (!(dec->cmpts = jas_alloc2(dec->numcomps, sizeof(jpc_dec_cmpt_t)))) {\n\t\treturn -1;\n\t}\n\n\tfor (compno = 0, cmpt = dec->cmpts; compno < dec->numcomps; ++compno,\n\t ++cmpt) {\n\t\tcmpt->prec = siz->comps[compno].prec;\n\t\tcmpt->sgnd = siz->comps[compno].sgnd;\n\t\tcmpt->hstep = siz->comps[compno].hsamp;\n\t\tcmpt->vstep = siz->comps[compno].vsamp;\n\t\tcmpt->width = JPC_CEILDIV(dec->xend, cmpt->hstep) -\n\t\t JPC_CEILDIV(dec->xstart, cmpt->hstep);\n\t\tcmpt->height = JPC_CEILDIV(dec->yend, cmpt->vstep) -\n\t\t JPC_CEILDIV(dec->ystart, cmpt->vstep);\n\t\tcmpt->hsubstep = 0;\n\t\tcmpt->vsubstep = 0;\n\t}\n\n\tdec->image = 0;\n\n\tdec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth);\n\tdec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight);\n\tdec->numtiles = dec->numhtiles * dec->numvtiles;\n\tJAS_DBGLOG(10, (\"numtiles = %d; numhtiles = %d; numvtiles = %d;\\n\",\n\t dec->numtiles, dec->numhtiles, dec->numvtiles));\n\tif (!(dec->tiles = jas_alloc2(dec->numtiles, sizeof(jpc_dec_tile_t)))) {\n\t\treturn -1;\n\t}\n\n\tfor (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno,\n\t ++tile) {\n\t\thtileno = tileno % dec->numhtiles;\n\t\tvtileno = tileno / dec->numhtiles;\n\t\ttile->realmode = 0;\n\t\ttile->state = JPC_TILE_INIT;\n\t\ttile->xstart = JAS_MAX(dec->tilexoff + htileno * dec->tilewidth,\n\t\t dec->xstart);\n\t\ttile->ystart = JAS_MAX(dec->tileyoff + vtileno * dec->tileheight,\n\t\t dec->ystart);\n\t\ttile->xend = JAS_MIN(dec->tilexoff + (htileno + 1) *\n\t\t dec->tilewidth, dec->xend);\n\t\ttile->yend = JAS_MIN(dec->tileyoff + (vtileno + 1) *\n\t\t dec->tileheight, dec->yend);\n\t\ttile->numparts = 0;\n\t\ttile->partno = 0;\n\t\ttile->pkthdrstream = 0;\n\t\ttile->pkthdrstreampos = 0;\n\t\ttile->pptstab = 0;\n\t\ttile->cp = 0;\n\t\ttile->pi = 0;\n\t\tif (!(tile->tcomps = jas_alloc2(dec->numcomps,\n\t\t sizeof(jpc_dec_tcomp_t)))) {\n\t\t\treturn -1;\n\t\t}\n\t\tfor (compno = 0, cmpt = dec->cmpts, tcomp = tile->tcomps;\n\t\t compno < dec->numcomps; ++compno, ++cmpt, ++tcomp) {\n\t\t\ttcomp->rlvls = 0;\n\t\t\ttcomp->numrlvls = 0;\n\t\t\ttcomp->data = 0;\n\t\t\ttcomp->xstart = JPC_CEILDIV(tile->xstart, cmpt->hstep);\n\t\t\ttcomp->ystart = JPC_CEILDIV(tile->ystart, cmpt->vstep);\n\t\t\ttcomp->xend = JPC_CEILDIV(tile->xend, cmpt->hstep);\n\t\t\ttcomp->yend = JPC_CEILDIV(tile->yend, cmpt->vstep);\n\t\t\ttcomp->tsfb = 0;\n\t\t}\n\t}\n\n\tdec->pkthdrstreams = 0;\n\n\t/* We should expect to encounter other main header marker segments\n\t or an SOT marker segment next. */\n\tdec->state = JPC_MH;\n\n\treturn 0;\n}","target":"static int jpc_dec_process_siz(jpc_dec_t *dec, jpc_ms_t *ms)\n{\n\tjpc_siz_t *siz = &ms->parms.siz;\n\tint compno;\n\tint tileno;\n\tjpc_dec_tile_t *tile;\n\tjpc_dec_tcomp_t *tcomp;\n\tint htileno;\n\tint vtileno;\n\tjpc_dec_cmpt_t *cmpt;\n\tsize_t size;\n\n\tdec->xstart = siz->xoff;\n\tdec->ystart = siz->yoff;\n\tdec->xend = siz->width;\n\tdec->yend = siz->height;\n\tdec->tilewidth = siz->tilewidth;\n\tdec->tileheight = siz->tileheight;\n\tdec->tilexoff = siz->tilexoff;\n\tdec->tileyoff = siz->tileyoff;\n\tdec->numcomps = siz->numcomps;\n\tif (!(dec->cp = jpc_dec_cp_create(dec->numcomps))) {\n\t\treturn -1;\n\t}\n\n\tif (!(dec->cmpts = jas_alloc2(dec->numcomps, sizeof(jpc_dec_cmpt_t)))) {\n\t\treturn -1;\n\t}\n\n\tfor (compno = 0, cmpt = dec->cmpts; compno < dec->numcomps; ++compno,\n\t ++cmpt) {\n\t\tcmpt->prec = siz->comps[compno].prec;\n\t\tcmpt->sgnd = siz->comps[compno].sgnd;\n\t\tcmpt->hstep = siz->comps[compno].hsamp;\n\t\tcmpt->vstep = siz->comps[compno].vsamp;\n\t\tcmpt->width = JPC_CEILDIV(dec->xend, cmpt->hstep) -\n\t\t JPC_CEILDIV(dec->xstart, cmpt->hstep);\n\t\tcmpt->height = JPC_CEILDIV(dec->yend, cmpt->vstep) -\n\t\t JPC_CEILDIV(dec->ystart, cmpt->vstep);\n\t\tcmpt->hsubstep = 0;\n\t\tcmpt->vsubstep = 0;\n\t}\n\n\tdec->image = 0;\n\n\tdec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth);\n\tdec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight);\n\tif (!jas_safe_size_mul(dec->numhtiles, dec->numvtiles, &size)) {\n\t\treturn -1;\n\t}\n\tdec->numtiles = size;\n\tJAS_DBGLOG(10, (\"numtiles = %d; numhtiles = %d; numvtiles = %d;\\n\",\n\t dec->numtiles, dec->numhtiles, dec->numvtiles));\n\tif (!(dec->tiles = jas_alloc2(dec->numtiles, sizeof(jpc_dec_tile_t)))) {\n\t\treturn -1;\n\t}\n\n\tfor (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno,\n\t ++tile) {\n\t\thtileno = tileno % dec->numhtiles;\n\t\tvtileno = tileno / dec->numhtiles;\n\t\ttile->realmode = 0;\n\t\ttile->state = JPC_TILE_INIT;\n\t\ttile->xstart = JAS_MAX(dec->tilexoff + htileno * dec->tilewidth,\n\t\t dec->xstart);\n\t\ttile->ystart = JAS_MAX(dec->tileyoff + vtileno * dec->tileheight,\n\t\t dec->ystart);\n\t\ttile->xend = JAS_MIN(dec->tilexoff + (htileno + 1) *\n\t\t dec->tilewidth, dec->xend);\n\t\ttile->yend = JAS_MIN(dec->tileyoff + (vtileno + 1) *\n\t\t dec->tileheight, dec->yend);\n\t\ttile->numparts = 0;\n\t\ttile->partno = 0;\n\t\ttile->pkthdrstream = 0;\n\t\ttile->pkthdrstreampos = 0;\n\t\ttile->pptstab = 0;\n\t\ttile->cp = 0;\n\t\ttile->pi = 0;\n\t\tif (!(tile->tcomps = jas_alloc2(dec->numcomps,\n\t\t sizeof(jpc_dec_tcomp_t)))) {\n\t\t\treturn -1;\n\t\t}\n\t\tfor (compno = 0, cmpt = dec->cmpts, tcomp = tile->tcomps;\n\t\t compno < dec->numcomps; ++compno, ++cmpt, ++tcomp) {\n\t\t\ttcomp->rlvls = 0;\n\t\t\ttcomp->numrlvls = 0;\n\t\t\ttcomp->data = 0;\n\t\t\ttcomp->xstart = JPC_CEILDIV(tile->xstart, cmpt->hstep);\n\t\t\ttcomp->ystart = JPC_CEILDIV(tile->ystart, cmpt->vstep);\n\t\t\ttcomp->xend = JPC_CEILDIV(tile->xend, cmpt->hstep);\n\t\t\ttcomp->yend = JPC_CEILDIV(tile->yend, cmpt->vstep);\n\t\t\ttcomp->tsfb = 0;\n\t\t}\n\t}\n\n\tdec->pkthdrstreams = 0;\n\n\t/* We should expect to encounter other main header marker segments\n\t or an SOT marker segment next. */\n\tdec->state = JPC_MH;\n\n\treturn 0;\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"jpc_dec_process_siz","file_name":"src/libjasper/jpc/jpc_dec.c","commit_link":"github.com/mdadams/jasper/commit/d91198abd00fc435a397fe6bad906a4c1748e9cf","source_cwe_file":"cwe-190.jsonl"}} diff --git a/sven_rl_val.jsonl b/sven_rl_val.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..ba490178aa95ea933640c8ba9d5639e83585961a --- /dev/null +++ b/sven_rl_val.jsonl @@ -0,0 +1,83 @@ +{"problem_id":"cwe-089#0-dfc76ecee75b","input":" def likeComments(self,commentid,userid):\n sqlText=\"insert into comment_like values(%d,%d);\"%(userid,commentid)\n result=sql.insertDB(self.conn,sqlText)\n return result;","target":" def likeComments(self,commentid,userid):\n sqlText=\"insert into comment_like values(%s,%s);\"\n params=[userid,commentid]\n result=sql.insertDB(self.conn,sqlText,params)\n return result;","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"likeComments","file_name":"modules/comment.py","commit_link":"github.com/ShaominLi/Twitter_project/commit/5329d91f9e569c95184053c8e7ef596949c33ce9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#1-6f4a009d2b32","input":" def add_inverters(self):\n interfaces = self.config.get_connection_interfaces()\n for source in interfaces:\n if source[\"type\"] == \"inverter\":\n\n query = '''\n INSERT OR IGNORE INTO Inverters (\n Serial,\n EToday,\n ETotal\n ) VALUES (\n %s,\n %s,\n %s\n );\n ''' % (source[\"serial_id\"], 0, source[\"prev_etotal\"])\n self.c.execute(query)\n\n query = '''\n UPDATE Inverters\n SET \n Name='%s', \n Type='%s', \n SW_Version='%s', \n Status='%s',\n TimeStamp='%s'\n WHERE Serial='%s';\n ''' % (source[\"name\"], source[\"inverter_type\"], \"s0-bridge v0\", \"OK\", int(datetime.now().timestamp()), source[\"serial_id\"] )\n self.c.execute(query)\n\n self.db.commit()","target":" def add_inverters(self):\n interfaces = self.config.get_connection_interfaces()\n for source in interfaces:\n if source[\"type\"] == \"inverter\":\n\n query = '''\n INSERT OR IGNORE INTO Inverters (\n Serial,\n EToday,\n ETotal\n ) VALUES (\n ?,\n ?,\n ?\n );\n '''\n self.c.execute(query, (source[\"serial_id\"], 0, source[\"prev_etotal\"]))\n\n query = '''\n UPDATE Inverters\n SET \n Name=?, \n Type=?, \n SW_Version=?, \n Status=?,\n TimeStamp=?\n WHERE Serial=?;\n '''\n self.c.execute(query, (source[\"name\"], source[\"inverter_type\"], \"s0-bridge v0\", \"OK\", int(datetime.now().timestamp()), source[\"serial_id\"] ))\n\n self.db.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_inverters","file_name":"util/database.py","commit_link":"github.com/philipptrenz/s0-bridge/commit/269b48caa05377b7c58c3e6d1622a4429cb5ba65","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#2-0ffbec2a3792","input":"@mod.route('/delete/', methods=['GET', 'POST'])\ndef delete(msg_id):\n if request.method == 'GET':\n sql = \"DELETE FROM message where msg_id = '%d';\" % (msg_id)\n cursor.execute(sql)\n conn.commit()\n flash('Delete Success!')\n return redirect(url_for('show_entries'))","target":"@mod.route('/delete/', methods=['GET', 'POST'])\ndef delete(msg_id):\n if request.method == 'GET':\n cursor.execute(\"DELETE FROM message where msg_id = %s;\", (msg_id,))\n conn.commit()\n flash('Delete Success!')\n return redirect(url_for('show_entries'))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"delete","file_name":"flaskr/flaskr/views/message.py","commit_link":"github.com/ulyssetsd/bjtu-sql/commit/17d7b21864b72ba5666f15236474a93268b32ec9","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#3-675023f3129b","input":"def karma_rank(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n SELECT (SELECT COUNT(*) FROM people AS t2 WHERE t2.karma > t1.karma)\n AS row_Num FROM people AS t1 WHERE name='{}'\n '''.format(name))\n rank = cursor.fetchone()[0] + 1\n logger.debug('Rank of {} found for name {}'.format(rank, name))\n db.close()\n return rank\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","target":"def karma_rank(name):\n db = db_connect()\n cursor = db.cursor()\n try:\n cursor.execute('''\n SELECT (SELECT COUNT(*) FROM people AS t2 WHERE t2.karma > t1.karma)\n AS row_Num FROM people AS t1 WHERE name=%(name)s\n ''', (name, ))\n rank = cursor.fetchone()[0] + 1\n logger.debug('Rank of {} found for name {}'.format(rank, name))\n db.close()\n return rank\n except Exception as e:\n logger.error('Execution failed with error: {}'.format(e))\n raise","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"karma_rank","file_name":"KarmaBoi/dbopts.py","commit_link":"github.com/tylarb/KarmaBoi-PCF/commit/c1d00a27d7f6b7eb6f15a3dacd4269654a32c10a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#4-a5385cd0f2c9","input":"def get_last_month(db, scene):\n sql = \"select date from matches where scene='{}' order by date desc limit 1;\".format(scene)\n res = db.exec(sql)\n date = res[0][0]\n\n # If it has been more than 1 month since this last tournament,\n # go ahead and round this date up by a 1 month\n # eg, if the last tournament was 2015-01-15 (a long time ago)\n # we can assume the scene won't have more tournaments\n # So just round to 2015-02-01\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n y, m, d = today.split('-')\n cy, cm, cd = date.split('-')\n if y > cy or m > cm:\n # Add 1 to the month before we return\n # eg 2018-03-01 -> 2018-04-01\n date = get_next_month(date)\n\n return date","target":"def get_last_month(db, scene):\n sql = \"select date from matches where scene='{scene}' order by date desc limit 1;\"\n args = {'scene': scene}\n res = db.exec(sql, args)\n date = res[0][0]\n\n # If it has been more than 1 month since this last tournament,\n # go ahead and round this date up by a 1 month\n # eg, if the last tournament was 2015-01-15 (a long time ago)\n # we can assume the scene won't have more tournaments\n # So just round to 2015-02-01\n today = datetime.datetime.today().strftime('%Y-%m-%d')\n y, m, d = today.split('-')\n cy, cm, cd = date.split('-')\n if y > cy or m > cm:\n # Add 1 to the month before we return\n # eg 2018-03-01 -> 2018-04-01\n date = get_next_month(date)\n\n return date","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_last_month","file_name":"bracket_utils.py","commit_link":"github.com/DKelle/Smash_stats/commit/4bb83f3f6ce7d6bebbeb512cd015f9e72cf36d63","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#5-839c7649fee9","input":"@app.route('/players//achievements')\ndef achievements_list_player(player_id):\n \"\"\"Lists the progress of achievements for a player.\n\n :param player_id: ID of the player.\n\n :return:\n If successful, this method returns a response body with the following structure::\n\n {\n \"items\": [\n {\n \"achievement_id\": string,\n \"state\": string,\n \"current_steps\": integer,\n \"create_time\": long,\n \"update_time\": long\n }\n ]\n }\n \"\"\"\n with db.connection:\n cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n cursor.execute(\"\"\"SELECT\n achievement_id,\n current_steps,\n state,\n UNIX_TIMESTAMP(create_time) as create_time,\n UNIX_TIMESTAMP(update_time) as update_time\n FROM player_achievements\n WHERE player_id = '%s'\"\"\" % player_id)\n\n return flask.jsonify(items=cursor.fetchall())","target":"@app.route('/players//achievements')\ndef achievements_list_player(player_id):\n \"\"\"Lists the progress of achievements for a player.\n\n :param player_id: ID of the player.\n\n :return:\n If successful, this method returns a response body with the following structure::\n\n {\n \"items\": [\n {\n \"achievement_id\": string,\n \"state\": string,\n \"current_steps\": integer,\n \"create_time\": long,\n \"update_time\": long\n }\n ]\n }\n \"\"\"\n with db.connection:\n cursor = db.connection.cursor(db.pymysql.cursors.DictCursor)\n cursor.execute(\"\"\"SELECT\n achievement_id,\n current_steps,\n state,\n UNIX_TIMESTAMP(create_time) as create_time,\n UNIX_TIMESTAMP(update_time) as update_time\n FROM player_achievements\n WHERE player_id = %s\"\"\", player_id)\n\n return flask.jsonify(items=cursor.fetchall())","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"achievements_list_player","file_name":"api/achievements.py","commit_link":"github.com/FAForever/api/commit/5fe7f23868cd191616b088bdd5b24010f004dd5a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#6-3eb4912201d0","input":" def check_if_this_project_is_in_database(self, project_id):\n self.cursor.execute(\"SELECT count(id) FROM projects where id = %s\" % project_id)\n return self.cursor.fetchall()[0][0] == 1","target":" def check_if_this_project_is_in_database(self, project_id):\n self.cursor.execute(\"SELECT count(id) FROM projects where id = %s\", (project_id,))\n return self.cursor.fetchall()[0][0] == 1","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"check_if_this_project_is_in_database","file_name":"backend/transactions/TransactionConnector.py","commit_link":"github.com/JLucka/kickstarter-dev/commit/e2ffa062697e060fdfbd2eccbb89a8c53a569e0b","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#7-d6ed886028d6","input":"@app.route(\"//edit\")\ndef edit_page(page_name):\n query = db.query(\"select * from page where title = '%s'\" % page_name).namedresult()\n if len(query) == 0:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query\n )\n else:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query[0]\n )","target":"@app.route(\"//edit\")\ndef edit_page(page_name):\n query = db.query(\"select * from page where title = $1\", page_name).namedresult()\n if len(query) == 0:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query\n )\n else:\n return render_template(\n \"edit.html\",\n page_name=page_name,\n query=query[0]\n )","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"edit_page","file_name":"server.py","commit_link":"github.com/jcortes0309/wiki_flask/commit/a6bf5316abe2eb528adf36c8241a013fd02c5ffa","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#8-f66442e7331e","input":"def reportMatch(winner, loser):\n \"\"\"Records the outcome of a single match between two players.\n\n Args:\n winner: the id number of the player who won\n loser: the id number of the player who lost\n \"\"\"\n conn = connect()\n cursor = conn.cursor()\n cursor.execute(\"INSERT INTO playsRecord (winner, loser) VALUES ('%s', '%s')\" % (winner, loser));\n conn.commit()\n conn.close()","target":"def reportMatch(winner, loser):\n \"\"\"Records the outcome of a single match between two players.\n\n Args:\n winner: the id number of the player who won\n loser: the id number of the player who lost\n \"\"\"\n conn = connect()\n cursor = conn.cursor()\n query = \"INSERT INTO playsRecord (winner, loser) VALUES (%s, %s);\"\n cursor.execute(query, (winner, loser));\n conn.commit()\n conn.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"reportMatch","file_name":"tournament.py","commit_link":"github.com/sarahkcaplan/tournament/commit/40aba5686059f5f398f6323b1483412c56140cc0","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#9-5283547f22c3","input":"def get_game_info(conn, game):\n # get the basic game properties\n cursor = conn.cursor()\n cursor.execute(\"SELECT player1,player2,size,state FROM games WHERE id = %d;\" % game)\n if cursor.rowcount != 1:\n raise FormError(\"Invalid game ID\")\n\n row = cursor.fetchall()[0]\n players = [row[0],row[1]]\n size = row[2]\n state = row[3]\n\n if state is None:\n state = \"Active\"\n\n cursor.close()\n\n return (players,size,state)","target":"def get_game_info(conn, game):\n # get the basic game properties\n cursor = conn.cursor()\n cursor.execute(\"SELECT player1,player2,size,state FROM games WHERE id = %d;\", (game,))\n if cursor.rowcount != 1:\n raise FormError(\"Invalid game ID\")\n\n row = cursor.fetchall()[0]\n players = [row[0],row[1]]\n size = row[2]\n state = row[3]\n\n if state is None:\n state = \"Active\"\n\n cursor.close()\n\n return (players,size,state)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_game_info","file_name":"cgi/common.py","commit_link":"github.com/russ-lewis/ttt_-_python_cgi/commit/6096f43fd4b2d91211eec4614b7960c0816900da","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#10-d79fe6f8970c","input":"def process_as_reply(email_obj):\n job_number = email_obj['subject'].split(': #')[1]\n feedback = re.findall(\"^[\\W]*([Oo\\d]){1}(?=[\\W]*)\", email_obj['content'].replace('#','').replace('link', ''))[0]\n feedback = int(0 if feedback == ('O' or 'o') else feedback)\n dcn_key = re.findall('\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}', email_obj['content'])[0]\n logger.info(f\"got feedback `{feedback}` for job #`{job_number}`\")\n with create_connection() as conn:\n was_prev_closed = pd.read_sql(f\"SELECT * FROM df_dilfo WHERE job_number={job_number}\", conn).iloc[0].closed\n if was_prev_closed:\n logger.info(f\"job was already matched successfully and logged as `closed`... skipping.\")\n return\n if feedback == 1:\n logger.info(f\"got feeback that DCN key {dcn_key} was correct\")\n update_status_query = \"UPDATE df_dilfo SET closed = 1 WHERE job_number = {}\"\n with create_connection() as conn:\n conn.cursor().execute(update_status_query.format(job_number))\n logger.info(f\"updated df_dilfo to show `closed` status for job #{job_number}\")\n with create_connection() as conn:\n df = pd.read_sql(\"SELECT * FROM df_matched\", conn)\n match_dict_input = {\n 'job_number': job_number,\n 'dcn_key': dcn_key,\n 'ground_truth': 1 if feedback == 1 else 0,\n 'multi_phase': 1 if feedback == 2 else 0,\n 'verifier': email_obj[\"sender\"],\n 'source': 'feedback',\n 'log_date': str(datetime.datetime.now().date()),\n 'validate': 0,\n }\n df = df.append(match_dict_input, ignore_index=True)\n df = df.drop_duplicates(subset=[\"job_number\", \"dcn_key\"], keep='last')\n df.to_sql('df_matched', conn, if_exists='replace', index=False)\n logger.info(\n f\"DCN key `{dcn_key}` was a \"\n f\"{'successful match' if feedback == 1 else 'mis-match'} for job \"\n f\"#{job_number}\"\n )","target":"def process_as_reply(email_obj):\n job_number = email_obj['subject'].split(': #')[1]\n feedback = re.findall(\"^[\\W]*([Oo\\d]){1}(?=[\\W]*)\", email_obj['content'].replace('#','').replace('link', ''))[0]\n feedback = int(0 if feedback == ('O' or 'o') else feedback)\n dcn_key = re.findall('\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}', email_obj['content'])[0]\n logger.info(f\"got feedback `{feedback}` for job #`{job_number}`\")\n with create_connection() as conn:\n was_prev_closed = pd.read_sql(\"SELECT * FROM df_dilfo WHERE job_number=?\", conn, params=[job_number]).iloc[0].closed\n if was_prev_closed:\n logger.info(f\"job was already matched successfully and logged as `closed`... skipping.\")\n return\n if feedback == 1:\n logger.info(f\"got feeback that DCN key {dcn_key} was correct\")\n update_status_query = \"UPDATE df_dilfo SET closed = 1 WHERE job_number = ?\"\n with create_connection() as conn:\n conn.cursor().execute(update_status_query, [job_number])\n logger.info(f\"updated df_dilfo to show `closed` status for job #{job_number}\")\n with create_connection() as conn:\n df = pd.read_sql(\"SELECT * FROM df_matched\", conn)\n match_dict_input = {\n 'job_number': job_number,\n 'dcn_key': dcn_key,\n 'ground_truth': 1 if feedback == 1 else 0,\n 'multi_phase': 1 if feedback == 2 else 0,\n 'verifier': email_obj[\"sender\"],\n 'source': 'feedback',\n 'log_date': str(datetime.datetime.now().date()),\n 'validate': 0,\n }\n df = df.append(match_dict_input, ignore_index=True)\n df = df.drop_duplicates(subset=[\"job_number\", \"dcn_key\"], keep='last')\n df.to_sql('df_matched', conn, if_exists='replace', index=False)\n logger.info(\n f\"DCN key `{dcn_key}` was a \"\n f\"{'successful match' if feedback == 1 else 'mis-match'} for job \"\n f\"#{job_number}\"\n )","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"process_as_reply","file_name":"inbox_scanner.py","commit_link":"github.com/confirmationbias616/certificate_checker/commit/9e890b9613b627e3a5995d0e4a594c8e0831e2ce","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#11-14341513f37c","input":"def update_playlist(id, name, db):\n db.execute(\n \"UPDATE playlist SET name='{name}' WHERE id={id};\".format(name=name, id=id))","target":"def update_playlist(id, name, db):\n db.execute(\"UPDATE playlist SET name=%s WHERE id=%s;\", (name, id,))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"update_playlist","file_name":"playlist/playlist_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#12-0955f5d98dec","input":" def get_requested_month(self, date):\n data = dict()\n\n month_start, month_end = self.get_epoch_month(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}\n month_total = 0\n\n query = '''\n SELECT TimeStamp, SUM(DayYield) AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN %s AND %s\n GROUP BY TimeStamp\n '''\n\n data['data'] = list()\n for row in self.c.execute(query % (month_start, month_end)):\n data['data'].append({'time': self.convert_local_ts_to_utc(row[0], self.local_timezone), 'power': row[1]})\n month_total += row[1]\n\n data['total'] = month_total\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM ( SELECT TimeStamp FROM MonthData GROUP BY TimeStamp );\n '''\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if first_data: data['hasPrevious'] = (first_data < month_start)\n else: data['hasPrevious'] = False\n if last_data: data['hasNext'] = (last_data > month_end)\n else: data['hasNext'] = False\n\n return data","target":" def get_requested_month(self, date):\n data = dict()\n\n month_start, month_end = self.get_epoch_month(date)\n data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}\n month_total = 0\n\n query = '''\n SELECT TimeStamp, SUM(DayYield) AS Power \n FROM MonthData \n WHERE TimeStamp BETWEEN ? AND ?\n GROUP BY TimeStamp;\n '''\n\n data['data'] = list()\n for row in self.c.execute(query, (month_start, month_end)):\n data['data'].append({'time': self.convert_local_ts_to_utc(row[0], self.local_timezone), 'power': row[1]})\n month_total += row[1]\n\n data['total'] = month_total\n\n query = '''\n SELECT MIN(TimeStamp) as Min, MAX(TimeStamp) as Max \n FROM ( SELECT TimeStamp FROM MonthData GROUP BY TimeStamp );\n '''\n\n self.c.execute(query)\n first_data, last_data = self.c.fetchone()\n\n if first_data: data['hasPrevious'] = (first_data < month_start)\n else: data['hasPrevious'] = False\n if last_data: data['hasNext'] = (last_data > month_end)\n else: data['hasNext'] = False\n\n return data","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"get_requested_month","file_name":"util/database.py","commit_link":"github.com/philipptrenz/sunportal/commit/7eef493a168ed4e6731ff800713bfb8aee99a506","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#13-4e8c70c2602d","input":"def retrieve_videos_from_playlist(playlist_id, db):\n db.execute(\"SELECT id, title, thumbnail, position from video WHERE playlist_id={playlist_id} ORDER BY position ASC;\".format(\n playlist_id=playlist_id))\n rows = db.fetchall()\n return rows","target":"def retrieve_videos_from_playlist(playlist_id, db):\n db.execute(\"SELECT id, title, thumbnail, position from video WHERE playlist_id=%s ORDER BY position ASC;\", (playlist_id,))\n rows = db.fetchall()\n return rows","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"retrieve_videos_from_playlist","file_name":"video/video_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#14-15e31f919ed2","input":"def create_playlist(name):\n db = connect_to_database()\n cursor = db.cursor()\n cursor.execute(\n \"INSERT INTO playlist (name, video_position) VALUES('{name}', 0);\".format(name=name))\n db.commit()\n db.close()","target":"def create_playlist(name):\n db = connect_to_database()\n cursor = db.cursor()\n cursor.execute(\n \"INSERT INTO playlist (name, video_position) VALUES(%s, 0);\", (name,))\n db.commit()\n db.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"create_playlist","file_name":"main_test.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#15-08854d838c25","input":"def update_video_positions(removed_position, db):\n db.execute(\"UPDATE video SET position = position - 1 WHERE position > {removed_position}\".format(\n removed_position=removed_position))","target":"def update_video_positions(removed_position, db):\n db.execute(\"UPDATE video SET position = position - 1 WHERE position > %s\", (removed_position,))","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"update_video_positions","file_name":"video/video_repository.py","commit_link":"github.com/Madmous/playlist/commit/666e52c5f0b8c1f4296e84471637033d9542a7a6","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#16-887d1e8b6c0a","input":" @staticmethod\n def _check_camera_tags(tags):\n \"\"\"\n Function that convert stupid code name of a smartphone or camera\n from EXIF to meaningful one by looking a collation in a special MySQL\n table For example instead of just Nikon there can be\n NIKON CORPORATION in EXIF\n\n :param tags: name of a camera and lens from EXIF\n :return: list with one or two strings which are name of\n camera and/or lens. If there is not better name for the gadget\n in database, function just returns name how it is\n \"\"\"\n checked_tags = []\n\n for tag in tags:\n if tag: # If there was this information inside EXIF of the photo\n tag = str(tag).strip()\n log.info('Looking up collation for %s', tag)\n query = ('SELECT right_tag '\n 'FROM tag_table '\n 'WHERE wrong_tag=\"{}\"'.format(tag))\n cursor = db.execute_query(query)\n if not cursor:\n log.error(\"Can't check the tag because of the db error\")\n log.warning(\"Tag will stay as is.\")\n continue\n if cursor.rowcount:\n # Get appropriate tag from the table\n tag = cursor.fetchone()[0]\n log.info('Tag after looking up in tag_tables - %s.', tag)\n\n checked_tags.append(tag)\n return checked_tags","target":" @staticmethod\n def _check_camera_tags(tags):\n \"\"\"\n Function that convert stupid code name of a smartphone or camera\n from EXIF to meaningful one by looking a collation in a special MySQL\n table For example instead of just Nikon there can be\n NIKON CORPORATION in EXIF\n\n :param tags: name of a camera and lens from EXIF\n :return: list with one or two strings which are name of\n camera and/or lens. If there is not better name for the gadget\n in database, function just returns name how it is\n \"\"\"\n checked_tags = []\n\n for tag in tags:\n if tag: # If there was this information inside EXIF of the photo\n tag = str(tag).strip()\n log.info('Looking up collation for %s', tag)\n query = ('SELECT right_tag '\n 'FROM tag_table '\n 'WHERE wrong_tag=%s')\n parameters = tag,\n cursor = db.execute_query(query, parameters)\n if not cursor:\n log.error(\"Can't check the tag because of the db error\")\n log.warning(\"Tag will stay as is.\")\n continue\n if cursor.rowcount:\n # Get appropriate tag from the table\n tag = cursor.fetchone()[0]\n log.info('Tag after looking up in tag_tables - %s.', tag)\n\n checked_tags.append(tag)\n return checked_tags","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"_check_camera_tags","file_name":"photogpsbot/process_image.py","commit_link":"github.com/RandyRomero/photoGPSbot/commit/0e9f57f13e61863b3672f5730e27f149da00786a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#17-69233f4e2a93","input":"\tdef add_input(self, data):\n\t\tconnection = self.connect()\n\t\ttry:\n\t\t\t# The following introduces a deliberate security flaw.See section on SQL injection below\n\t\t\tquery = \"INSERT INTO crimes (description) VALUES('{}');\".format(data)\n\t\t\twith connection.cursor() as cursor:\n\t\t\t\tcursor.execute(query)\n\t\t\t\tconnection.commit()\n\t\tfinally:\n\t\t\tconnection.close()","target":"\tdef add_input(self, data):\n\t\tconnection = self.connect()\n\t\ttry:\n\t\t\t# The following introduces a deliberate security flaw.See section on SQL injection below\n\t\t\tquery = \"INSERT INTO crimes (description) VALUES (%s);\"\n\t\t\twith connection.cursor() as cursor:\n\t\t\t\tcursor.execute(query, data)\n\t\t\t\tconnection.commit()\n\t\tfinally:\n\t\t\tconnection.close()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"add_input","file_name":"dbhelper.py","commit_link":"github.com/fangyansun/crimemap/commit/a3ab652c214f801c2910e2f96e4de18848de58ae","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#18-fea1cd1a8ae7","input":"def getResults(poll_name):\n conn, c = connectDB()\n req = \"SELECT options from {} where name = '{}'\".format(CFG(\"poll_table_name\"), poll_name)\n options_str = queryOne(c, req)\n\n if not options_str:\n raise LookupError(\"Poll '{}' not found in DB\".format(poll_name))\n\n total = 0\n options = options_str.split(\",\")\n results = dict()\n for opt in options:\n count = getOptionCount(c, poll_name, opt)\n total += int(count)\n results.update({opt:count})\n\n conn.close()\n return (results, total)","target":"def getResults(poll_name):\n conn, c = connectDB()\n req = \"SELECT options from {} where name=?\".format(CFG(\"poll_table_name\"))\n options_str = queryOne(c, req, (poll_name,))\n\n if not options_str:\n raise LookupError(\"Poll '{}' not found in DB\".format(poll_name))\n\n total = 0\n options = options_str.split(\",\")\n results = dict()\n for opt in options:\n count = getOptionCount(c, poll_name, opt)\n total += int(count)\n results.update({opt:count})\n\n conn.close()\n return (results, total)","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"getResults","file_name":"database.py","commit_link":"github.com/FAUSheppy/simple-python-poll/commit/186c5ff5cdf58272e253a1bb432419ee50d93109","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-089#19-6100d3d66534","input":"def update_sources(conn, sqlite, k10plus, ai):\n \"\"\"\n Update the source table.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n old_sources = get_all_old_sources(conn, sqlite)\n\n # Check if the source table is allready filled and this is not the first checkup\n source_table_is_filled = len(old_sources) > 100\n\n for old_source in old_sources:\n if source_table_is_filled and old_source not in current_sources:\n message = \"Die SID %s ist im aktuellen Import nicht mehr vorhanden.\\nWenn dies beabsichtigt ist, bitte die SID aus der Datenbank loeschen.\" % old_source\n send_message(message)\n\n for current_source in current_sources:\n if current_source not in old_sources:\n message = \"The source %s is new in Solr.\" % current_source\n if source_table_is_filled:\n send_message(message)\n else:\n logging.info(message)\n sql = \"INSERT INTO source (source) VALUES (%s)\" % current_source\n sqlite.execute(sql)\n conn.commit()","target":"def update_sources(conn, sqlite, k10plus, ai):\n \"\"\"\n Update the source table.\n \"\"\"\n current_sources = get_all_current_sources(k10plus, ai)\n old_sources = get_all_old_sources(conn, sqlite)\n\n # Check if the source table is allready filled and this is not the first checkup\n source_table_is_filled = len(old_sources) > 100\n\n for old_source in old_sources:\n if source_table_is_filled and old_source not in current_sources:\n message = \"Die SID %s ist im aktuellen Import nicht mehr vorhanden.\\nWenn dies beabsichtigt ist, bitte die SID aus der Datenbank loeschen.\" % old_source\n send_message(message)\n\n for current_source in current_sources:\n if current_source not in old_sources:\n message = \"The source %s is new in Solr.\" % current_source\n if source_table_is_filled:\n send_message(message)\n else:\n logging.info(message)\n sql = \"INSERT INTO source (source) VALUES (?)\"\n sqlite.execute(sql, (current_source,))\n conn.commit()","lang":"python","vul_type":"cwe-089","sven_meta":{"func_name":"update_sources","file_name":"bin/solrcheckup.py","commit_link":"github.com/miku/siskin/commit/7fa398d2fea72bf2e8b4808f75df4b3d35ae959a","source_cwe_file":"cwe-089.jsonl"}} +{"problem_id":"cwe-125#0-fc6540dac2d4","input":"search_make_new(const struct search_state *const state, int n, const char *const base_name) {\n\tconst size_t base_len = strlen(base_name);\n\tconst char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;\n\tstruct search_domain *dom;\n\n\tfor (dom = state->head; dom; dom = dom->next) {\n\t\tif (!n--) {\n\t\t\t/* this is the postfix we want */\n\t\t\t/* the actual postfix string is kept at the end of the structure */\n\t\t\tconst u8 *const postfix = ((u8 *) dom) + sizeof(struct search_domain);\n\t\t\tconst int postfix_len = dom->len;\n\t\t\tchar *const newname = (char *) mm_malloc(base_len + need_to_append_dot + postfix_len + 1);\n\t\t\tif (!newname) return NULL;\n\t\t\tmemcpy(newname, base_name, base_len);\n\t\t\tif (need_to_append_dot) newname[base_len] = '.';\n\t\t\tmemcpy(newname + base_len + need_to_append_dot, postfix, postfix_len);\n\t\t\tnewname[base_len + need_to_append_dot + postfix_len] = 0;\n\t\t\treturn newname;\n\t\t}\n\t}\n\n\t/* we ran off the end of the list and still didn't find the requested string */\n\tEVUTIL_ASSERT(0);\n\treturn NULL; /* unreachable; stops warnings in some compilers. */\n}","target":"search_make_new(const struct search_state *const state, int n, const char *const base_name) {\n\tconst size_t base_len = strlen(base_name);\n\tchar need_to_append_dot;\n\tstruct search_domain *dom;\n\n\tif (!base_len) return NULL;\n\tneed_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1;\n\n\tfor (dom = state->head; dom; dom = dom->next) {\n\t\tif (!n--) {\n\t\t\t/* this is the postfix we want */\n\t\t\t/* the actual postfix string is kept at the end of the structure */\n\t\t\tconst u8 *const postfix = ((u8 *) dom) + sizeof(struct search_domain);\n\t\t\tconst int postfix_len = dom->len;\n\t\t\tchar *const newname = (char *) mm_malloc(base_len + need_to_append_dot + postfix_len + 1);\n\t\t\tif (!newname) return NULL;\n\t\t\tmemcpy(newname, base_name, base_len);\n\t\t\tif (need_to_append_dot) newname[base_len] = '.';\n\t\t\tmemcpy(newname + base_len + need_to_append_dot, postfix, postfix_len);\n\t\t\tnewname[base_len + need_to_append_dot + postfix_len] = 0;\n\t\t\treturn newname;\n\t\t}\n\t}\n\n\t/* we ran off the end of the list and still didn't find the requested string */\n\tEVUTIL_ASSERT(0);\n\treturn NULL; /* unreachable; stops warnings in some compilers. */\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"search_make_new","file_name":"evdns.c","commit_link":"github.com/libevent/libevent/commit/ec65c42052d95d2c23d1d837136d1cf1d9ecef9e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#1-d92b392e6f63","input":"int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj)\n{\n char obj_txt[128];\n\n int len = OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);\n BIO_write(bio, obj_txt, len);\n BIO_write(bio, \"\\n\", 1);\n\n return 1;\n}","target":"int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj)\n{\n char obj_txt[128];\n\n OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);\n BIO_printf(bio, \"%s\\n\", obj_txt);\n\n return 1;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"TS_OBJ_print_bio","file_name":"crypto/ts/ts_lib.c","commit_link":"github.com/openssl/openssl/commit/0ed26acce328ec16a3aa635f1ca37365e8c7403a","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#2-0976a5319794","input":"int main(int argc, char *argv[])\n{\n FILE *iplist = NULL;\n plist_t root_node = NULL;\n char *plist_out = NULL;\n uint32_t size = 0;\n int read_size = 0;\n char *plist_entire = NULL;\n struct stat filestats;\n options_t *options = parse_arguments(argc, argv);\n\n if (!options)\n {\n print_usage(argc, argv);\n return 0;\n }\n\n // read input file\n iplist = fopen(options->in_file, \"rb\");\n if (!iplist) {\n free(options);\n return 1;\n }\n\n stat(options->in_file, &filestats);\n plist_entire = (char *) malloc(sizeof(char) * (filestats.st_size + 1));\n read_size = fread(plist_entire, sizeof(char), filestats.st_size, iplist);\n fclose(iplist);\n\n // convert from binary to xml or vice-versa\n if (memcmp(plist_entire, \"bplist00\", 8) == 0)\n {\n plist_from_bin(plist_entire, read_size, &root_node);\n plist_to_xml(root_node, &plist_out, &size);\n }\n else\n {\n plist_from_xml(plist_entire, read_size, &root_node);\n plist_to_bin(root_node, &plist_out, &size);\n }\n plist_free(root_node);\n free(plist_entire);\n\n if (plist_out)\n {\n if (options->out_file != NULL)\n {\n FILE *oplist = fopen(options->out_file, \"wb\");\n if (!oplist) {\n free(options);\n return 1;\n }\n fwrite(plist_out, size, sizeof(char), oplist);\n fclose(oplist);\n }\n // if no output file specified, write to stdout\n else\n fwrite(plist_out, size, sizeof(char), stdout);\n\n free(plist_out);\n }\n else\n printf(\"ERROR: Failed to convert input file.\\n\");\n\n free(options);\n return 0;\n}","target":"int main(int argc, char *argv[])\n{\n FILE *iplist = NULL;\n plist_t root_node = NULL;\n char *plist_out = NULL;\n uint32_t size = 0;\n int read_size = 0;\n char *plist_entire = NULL;\n struct stat filestats;\n options_t *options = parse_arguments(argc, argv);\n\n if (!options)\n {\n print_usage(argc, argv);\n return 0;\n }\n\n // read input file\n iplist = fopen(options->in_file, \"rb\");\n if (!iplist) {\n free(options);\n return 1;\n }\n\n stat(options->in_file, &filestats);\n\n if (filestats.st_size < 8) {\n printf(\"ERROR: Input file is too small to contain valid plist data.\\n\");\n return -1;\n }\n\n plist_entire = (char *) malloc(sizeof(char) * (filestats.st_size + 1));\n read_size = fread(plist_entire, sizeof(char), filestats.st_size, iplist);\n fclose(iplist);\n\n // convert from binary to xml or vice-versa\n if (memcmp(plist_entire, \"bplist00\", 8) == 0)\n {\n plist_from_bin(plist_entire, read_size, &root_node);\n plist_to_xml(root_node, &plist_out, &size);\n }\n else\n {\n plist_from_xml(plist_entire, read_size, &root_node);\n plist_to_bin(root_node, &plist_out, &size);\n }\n plist_free(root_node);\n free(plist_entire);\n\n if (plist_out)\n {\n if (options->out_file != NULL)\n {\n FILE *oplist = fopen(options->out_file, \"wb\");\n if (!oplist) {\n free(options);\n return 1;\n }\n fwrite(plist_out, size, sizeof(char), oplist);\n fclose(oplist);\n }\n // if no output file specified, write to stdout\n else\n fwrite(plist_out, size, sizeof(char), stdout);\n\n free(plist_out);\n }\n else\n printf(\"ERROR: Failed to convert input file.\\n\");\n\n free(options);\n return 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"main","file_name":"tools/plistutil.c","commit_link":"github.com/libimobiledevice/libplist/commit/7391a506352c009fe044dead7baad9e22dd279ee","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#3-53f9a370667f","input":"AirPDcapDecryptWPABroadcastKey(const EAPOL_RSN_KEY *pEAPKey, guint8 *decryption_key, PAIRPDCAP_SEC_ASSOCIATION sa, guint eapol_len)\n{\n guint8 key_version;\n guint8 *key_data;\n guint8 *szEncryptedKey;\n guint16 key_bytes_len = 0; /* Length of the total key data field */\n guint16 key_len; /* Actual group key length */\n static AIRPDCAP_KEY_ITEM dummy_key; /* needed in case AirPDcapRsnaMng() wants the key structure */\n AIRPDCAP_SEC_ASSOCIATION *tmp_sa;\n\n /* We skip verifying the MIC of the key. If we were implementing a WPA supplicant we'd want to verify, but for a sniffer it's not needed. */\n\n /* Preparation for decrypting the group key - determine group key data length */\n /* depending on whether the pairwise key is TKIP or AES encryption key */\n key_version = AIRPDCAP_EAP_KEY_DESCR_VER(pEAPKey->key_information[1]);\n if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){\n /* TKIP */\n key_bytes_len = pntoh16(pEAPKey->key_length);\n }else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){\n /* AES */\n key_bytes_len = pntoh16(pEAPKey->key_data_len);\n\n /* AES keys must be at least 128 bits = 16 bytes. */\n if (key_bytes_len < 16) {\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n }\n\n if (key_bytes_len < GROUP_KEY_MIN_LEN || key_bytes_len > eapol_len - sizeof(EAPOL_RSN_KEY)) {\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Encrypted key is in the information element field of the EAPOL key packet */\n key_data = (guint8 *)pEAPKey + sizeof(EAPOL_RSN_KEY);\n szEncryptedKey = (guint8 *)g_memdup(key_data, key_bytes_len);\n\n DEBUG_DUMP(\"Encrypted Broadcast key:\", szEncryptedKey, key_bytes_len);\n DEBUG_DUMP(\"KeyIV:\", pEAPKey->key_iv, 16);\n DEBUG_DUMP(\"decryption_key:\", decryption_key, 16);\n\n /* We are rekeying, save old sa */\n tmp_sa=(AIRPDCAP_SEC_ASSOCIATION *)g_malloc(sizeof(AIRPDCAP_SEC_ASSOCIATION));\n memcpy(tmp_sa, sa, sizeof(AIRPDCAP_SEC_ASSOCIATION));\n sa->next=tmp_sa;\n\n /* As we have no concept of the prior association request at this point, we need to deduce the */\n /* group key cipher from the length of the key bytes. In WPA this is straightforward as the */\n /* keybytes just contain the GTK, and the GTK is only in the group handshake, NOT the M3. */\n /* In WPA2 its a little more tricky as the M3 keybytes contain an RSN_IE, but the group handshake */\n /* does not. Also there are other (variable length) items in the keybytes which we need to account */\n /* for to determine the true key length, and thus the group cipher. */\n\n if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){\n guint8 new_key[32];\n guint8 dummy[256];\n /* TKIP key */\n /* Per 802.11i, Draft 3.0 spec, section 8.5.2, p. 97, line 4-8, */\n /* group key is decrypted using RC4. Concatenate the IV with the 16 byte EK (PTK+16) to get the decryption key */\n\n rc4_state_struct rc4_state;\n\n /* The WPA group key just contains the GTK bytes so deducing the type is straightforward */\n /* Note - WPA M3 doesn't contain a group key so we'll only be here for the group handshake */\n sa->wpa.key_ver = (key_bytes_len >=TKIP_GROUP_KEY_LEN)?AIRPDCAP_WPA_KEY_VER_NOT_CCMP:AIRPDCAP_WPA_KEY_VER_AES_CCMP;\n\n /* Build the full decryption key based on the IV and part of the pairwise key */\n memcpy(new_key, pEAPKey->key_iv, 16);\n memcpy(new_key+16, decryption_key, 16);\n DEBUG_DUMP(\"FullDecrKey:\", new_key, 32);\n\n crypt_rc4_init(&rc4_state, new_key, sizeof(new_key));\n\n /* Do dummy 256 iterations of the RC4 algorithm (per 802.11i, Draft 3.0, p. 97 line 6) */\n crypt_rc4(&rc4_state, dummy, 256);\n crypt_rc4(&rc4_state, szEncryptedKey, key_bytes_len);\n\n } else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){\n /* AES CCMP key */\n\n guint8 key_found;\n guint8 key_length;\n guint16 key_index;\n guint8 *decrypted_data;\n\n /* Unwrap the key; the result is key_bytes_len in length */\n decrypted_data = AES_unwrap(decryption_key, 16, szEncryptedKey, key_bytes_len);\n\n /* With WPA2 what we get after Broadcast Key decryption is an actual RSN structure.\n The key itself is stored as a GTK KDE\n WPA2 IE (1 byte) id = 0xdd, length (1 byte), GTK OUI (4 bytes), key index (1 byte) and 1 reserved byte. Thus we have to\n pass pointer to the actual key with 8 bytes offset */\n\n key_found = FALSE;\n key_index = 0;\n\n /* Parse Key data until we found GTK KDE */\n /* GTK KDE = 00-0F-AC 01 */\n while(key_index < (key_bytes_len - 6) && !key_found){\n guint8 rsn_id;\n guint32 type;\n\n /* Get RSN ID */\n rsn_id = decrypted_data[key_index];\n type = ((decrypted_data[key_index + 2] << 24) +\n (decrypted_data[key_index + 3] << 16) +\n (decrypted_data[key_index + 4] << 8) +\n (decrypted_data[key_index + 5]));\n\n if (rsn_id == 0xdd && type == 0x000fac01) {\n key_found = TRUE;\n } else {\n key_index += decrypted_data[key_index+1]+2;\n }\n }\n\n if (key_found){\n key_length = decrypted_data[key_index+1] - 6;\n\n if (key_index+8 >= key_bytes_len ||\n key_length > key_bytes_len - key_index - 8) {\n g_free(decrypted_data);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Skip over the GTK header info, and don't copy past the end of the encrypted data */\n memcpy(szEncryptedKey, decrypted_data+key_index+8, key_length);\n } else {\n g_free(decrypted_data);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n if (key_length == TKIP_GROUP_KEY_LEN)\n sa->wpa.key_ver = AIRPDCAP_WPA_KEY_VER_NOT_CCMP;\n else\n sa->wpa.key_ver = AIRPDCAP_WPA_KEY_VER_AES_CCMP;\n\n g_free(decrypted_data);\n }\n\n key_len = (sa->wpa.key_ver==AIRPDCAP_WPA_KEY_VER_NOT_CCMP)?TKIP_GROUP_KEY_LEN:CCMP_GROUP_KEY_LEN;\n if (key_len > key_bytes_len) {\n /* the key required for this protocol is longer than the key that we just calculated */\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Decrypted key is now in szEncryptedKey with len of key_len */\n DEBUG_DUMP(\"Broadcast key:\", szEncryptedKey, key_len);\n\n /* Load the proper key material info into the SA */\n sa->key = &dummy_key; /* we just need key to be not null because it is checked in AirPDcapRsnaMng(). The WPA key materials are actually in the .wpa structure */\n sa->validKey = TRUE;\n\n /* Since this is a GTK and its size is only 32 bytes (vs. the 64 byte size of a PTK), we fake it and put it in at a 32-byte offset so the */\n /* AirPDcapRsnaMng() function will extract the right piece of the GTK for decryption. (The first 16 bytes of the GTK are used for decryption.) */\n memset(sa->wpa.ptk, 0, sizeof(sa->wpa.ptk));\n memcpy(sa->wpa.ptk+32, szEncryptedKey, key_len);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_SUCCESS_HANDSHAKE;\n}","target":"AirPDcapDecryptWPABroadcastKey(const EAPOL_RSN_KEY *pEAPKey, guint8 *decryption_key, PAIRPDCAP_SEC_ASSOCIATION sa, guint eapol_len)\n{\n guint8 key_version;\n guint8 *key_data;\n guint8 *szEncryptedKey;\n guint16 key_bytes_len = 0; /* Length of the total key data field */\n guint16 key_len; /* Actual group key length */\n static AIRPDCAP_KEY_ITEM dummy_key; /* needed in case AirPDcapRsnaMng() wants the key structure */\n AIRPDCAP_SEC_ASSOCIATION *tmp_sa;\n\n /* We skip verifying the MIC of the key. If we were implementing a WPA supplicant we'd want to verify, but for a sniffer it's not needed. */\n\n /* Preparation for decrypting the group key - determine group key data length */\n /* depending on whether the pairwise key is TKIP or AES encryption key */\n key_version = AIRPDCAP_EAP_KEY_DESCR_VER(pEAPKey->key_information[1]);\n if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){\n /* TKIP */\n key_bytes_len = pntoh16(pEAPKey->key_length);\n }else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){\n /* AES */\n key_bytes_len = pntoh16(pEAPKey->key_data_len);\n\n /* AES keys must be at least 128 bits = 16 bytes. */\n if (key_bytes_len < 16) {\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n }\n\n if ((key_bytes_len < GROUP_KEY_MIN_LEN) ||\n (eapol_len < sizeof(EAPOL_RSN_KEY)) ||\n (key_bytes_len > eapol_len - sizeof(EAPOL_RSN_KEY))) {\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Encrypted key is in the information element field of the EAPOL key packet */\n key_data = (guint8 *)pEAPKey + sizeof(EAPOL_RSN_KEY);\n szEncryptedKey = (guint8 *)g_memdup(key_data, key_bytes_len);\n\n DEBUG_DUMP(\"Encrypted Broadcast key:\", szEncryptedKey, key_bytes_len);\n DEBUG_DUMP(\"KeyIV:\", pEAPKey->key_iv, 16);\n DEBUG_DUMP(\"decryption_key:\", decryption_key, 16);\n\n /* We are rekeying, save old sa */\n tmp_sa=(AIRPDCAP_SEC_ASSOCIATION *)g_malloc(sizeof(AIRPDCAP_SEC_ASSOCIATION));\n memcpy(tmp_sa, sa, sizeof(AIRPDCAP_SEC_ASSOCIATION));\n sa->next=tmp_sa;\n\n /* As we have no concept of the prior association request at this point, we need to deduce the */\n /* group key cipher from the length of the key bytes. In WPA this is straightforward as the */\n /* keybytes just contain the GTK, and the GTK is only in the group handshake, NOT the M3. */\n /* In WPA2 its a little more tricky as the M3 keybytes contain an RSN_IE, but the group handshake */\n /* does not. Also there are other (variable length) items in the keybytes which we need to account */\n /* for to determine the true key length, and thus the group cipher. */\n\n if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){\n guint8 new_key[32];\n guint8 dummy[256];\n /* TKIP key */\n /* Per 802.11i, Draft 3.0 spec, section 8.5.2, p. 97, line 4-8, */\n /* group key is decrypted using RC4. Concatenate the IV with the 16 byte EK (PTK+16) to get the decryption key */\n\n rc4_state_struct rc4_state;\n\n /* The WPA group key just contains the GTK bytes so deducing the type is straightforward */\n /* Note - WPA M3 doesn't contain a group key so we'll only be here for the group handshake */\n sa->wpa.key_ver = (key_bytes_len >=TKIP_GROUP_KEY_LEN)?AIRPDCAP_WPA_KEY_VER_NOT_CCMP:AIRPDCAP_WPA_KEY_VER_AES_CCMP;\n\n /* Build the full decryption key based on the IV and part of the pairwise key */\n memcpy(new_key, pEAPKey->key_iv, 16);\n memcpy(new_key+16, decryption_key, 16);\n DEBUG_DUMP(\"FullDecrKey:\", new_key, 32);\n\n crypt_rc4_init(&rc4_state, new_key, sizeof(new_key));\n\n /* Do dummy 256 iterations of the RC4 algorithm (per 802.11i, Draft 3.0, p. 97 line 6) */\n crypt_rc4(&rc4_state, dummy, 256);\n crypt_rc4(&rc4_state, szEncryptedKey, key_bytes_len);\n\n } else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){\n /* AES CCMP key */\n\n guint8 key_found;\n guint8 key_length;\n guint16 key_index;\n guint8 *decrypted_data;\n\n /* Unwrap the key; the result is key_bytes_len in length */\n decrypted_data = AES_unwrap(decryption_key, 16, szEncryptedKey, key_bytes_len);\n\n /* With WPA2 what we get after Broadcast Key decryption is an actual RSN structure.\n The key itself is stored as a GTK KDE\n WPA2 IE (1 byte) id = 0xdd, length (1 byte), GTK OUI (4 bytes), key index (1 byte) and 1 reserved byte. Thus we have to\n pass pointer to the actual key with 8 bytes offset */\n\n key_found = FALSE;\n key_index = 0;\n\n /* Parse Key data until we found GTK KDE */\n /* GTK KDE = 00-0F-AC 01 */\n while(key_index < (key_bytes_len - 6) && !key_found){\n guint8 rsn_id;\n guint32 type;\n\n /* Get RSN ID */\n rsn_id = decrypted_data[key_index];\n type = ((decrypted_data[key_index + 2] << 24) +\n (decrypted_data[key_index + 3] << 16) +\n (decrypted_data[key_index + 4] << 8) +\n (decrypted_data[key_index + 5]));\n\n if (rsn_id == 0xdd && type == 0x000fac01) {\n key_found = TRUE;\n } else {\n key_index += decrypted_data[key_index+1]+2;\n }\n }\n\n if (key_found){\n key_length = decrypted_data[key_index+1] - 6;\n\n if (key_index+8 >= key_bytes_len ||\n key_length > key_bytes_len - key_index - 8) {\n g_free(decrypted_data);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Skip over the GTK header info, and don't copy past the end of the encrypted data */\n memcpy(szEncryptedKey, decrypted_data+key_index+8, key_length);\n } else {\n g_free(decrypted_data);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n if (key_length == TKIP_GROUP_KEY_LEN)\n sa->wpa.key_ver = AIRPDCAP_WPA_KEY_VER_NOT_CCMP;\n else\n sa->wpa.key_ver = AIRPDCAP_WPA_KEY_VER_AES_CCMP;\n\n g_free(decrypted_data);\n }\n\n key_len = (sa->wpa.key_ver==AIRPDCAP_WPA_KEY_VER_NOT_CCMP)?TKIP_GROUP_KEY_LEN:CCMP_GROUP_KEY_LEN;\n if (key_len > key_bytes_len) {\n /* the key required for this protocol is longer than the key that we just calculated */\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_NO_VALID_HANDSHAKE;\n }\n\n /* Decrypted key is now in szEncryptedKey with len of key_len */\n DEBUG_DUMP(\"Broadcast key:\", szEncryptedKey, key_len);\n\n /* Load the proper key material info into the SA */\n sa->key = &dummy_key; /* we just need key to be not null because it is checked in AirPDcapRsnaMng(). The WPA key materials are actually in the .wpa structure */\n sa->validKey = TRUE;\n\n /* Since this is a GTK and its size is only 32 bytes (vs. the 64 byte size of a PTK), we fake it and put it in at a 32-byte offset so the */\n /* AirPDcapRsnaMng() function will extract the right piece of the GTK for decryption. (The first 16 bytes of the GTK are used for decryption.) */\n memset(sa->wpa.ptk, 0, sizeof(sa->wpa.ptk));\n memcpy(sa->wpa.ptk+32, szEncryptedKey, key_len);\n g_free(szEncryptedKey);\n return AIRPDCAP_RET_SUCCESS_HANDSHAKE;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"AirPDcapDecryptWPABroadcastKey","file_name":"epan/crypt/airpdcap.c","commit_link":"github.com/wireshark/wireshark/commit/b6d838eebf4456192360654092e5587c5207f185","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#4-f92394cda624","input":"MagickExport Image *AdaptiveThresholdImage(const Image *image,\n const size_t width,const size_t height,const double bias,\n ExceptionInfo *exception)\n{\n#define AdaptiveThresholdImageTag \"AdaptiveThreshold/Image\"\n\n CacheView\n *image_view,\n *threshold_view;\n\n Image\n *threshold_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n MagickSizeType\n number_pixels;\n\n ssize_t\n y;\n\n /*\n Initialize threshold image attributes.\n */\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n threshold_image=CloneImage(image,0,0,MagickTrue,exception);\n if (threshold_image == (Image *) NULL)\n return((Image *) NULL);\n status=SetImageStorageClass(threshold_image,DirectClass,exception);\n if (status == MagickFalse)\n {\n threshold_image=DestroyImage(threshold_image);\n return((Image *) NULL);\n }\n /*\n Threshold image.\n */\n status=MagickTrue;\n progress=0;\n number_pixels=(MagickSizeType) width*height;\n image_view=AcquireVirtualCacheView(image,exception);\n threshold_view=AcquireAuthenticCacheView(threshold_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(image,threshold_image,image->rows,1)\n#endif\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n double\n channel_bias[MaxPixelChannels],\n channel_sum[MaxPixelChannels];\n\n register const Quantum\n *magick_restrict p,\n *magick_restrict pixels;\n\n register Quantum\n *magick_restrict q;\n\n register ssize_t\n i,\n x;\n\n ssize_t\n center,\n u,\n v;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)\n (height/2L),image->columns+width,height,exception);\n q=QueueCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns,\n 1,exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n center=(ssize_t) GetPixelChannels(image)*(image->columns+width)*(height/2L)+\n GetPixelChannels(image)*(width/2);\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel = GetPixelChannelChannel(image,i);\n PixelTrait traits = GetPixelChannelTraits(image,channel);\n PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image,\n channel);\n if ((traits == UndefinedPixelTrait) ||\n (threshold_traits == UndefinedPixelTrait))\n continue;\n if ((threshold_traits & CopyPixelTrait) != 0)\n {\n SetPixelChannel(threshold_image,channel,p[center+i],q);\n continue;\n }\n pixels=p;\n channel_bias[channel]=0.0;\n channel_sum[channel]=0.0;\n for (v=0; v < (ssize_t) height; v++)\n {\n for (u=0; u < (ssize_t) width; u++)\n {\n if (u == (ssize_t) (width-1))\n channel_bias[channel]+=pixels[i];\n channel_sum[channel]+=pixels[i];\n pixels+=GetPixelChannels(image);\n }\n pixels+=GetPixelChannels(image)*image->columns;\n }\n }\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n double\n mean;\n\n PixelChannel channel = GetPixelChannelChannel(image,i);\n PixelTrait traits = GetPixelChannelTraits(image,channel);\n PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image,\n channel);\n if ((traits == UndefinedPixelTrait) ||\n (threshold_traits == UndefinedPixelTrait))\n continue;\n if ((threshold_traits & CopyPixelTrait) != 0)\n {\n SetPixelChannel(threshold_image,channel,p[center+i],q);\n continue;\n }\n channel_sum[channel]-=channel_bias[channel];\n channel_bias[channel]=0.0;\n pixels=p;\n for (v=0; v < (ssize_t) height; v++)\n {\n channel_bias[channel]+=pixels[i];\n pixels+=(width-1)*GetPixelChannels(image);\n channel_sum[channel]+=pixels[i];\n pixels+=GetPixelChannels(image)*(image->columns+1);\n }\n mean=(double) (channel_sum[channel]/number_pixels+bias);\n SetPixelChannel(threshold_image,channel,(Quantum) ((double)\n p[center+i] <= mean ? 0 : QuantumRange),q);\n }\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(threshold_image);\n }\n if (SyncCacheViewAuthenticPixels(threshold_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(image,AdaptiveThresholdImageTag,progress,\n image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n threshold_image->type=image->type;\n threshold_view=DestroyCacheView(threshold_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n threshold_image=DestroyImage(threshold_image);\n return(threshold_image);\n}","target":"MagickExport Image *AdaptiveThresholdImage(const Image *image,\n const size_t width,const size_t height,const double bias,\n ExceptionInfo *exception)\n{\n#define AdaptiveThresholdImageTag \"AdaptiveThreshold/Image\"\n\n CacheView\n *image_view,\n *threshold_view;\n\n Image\n *threshold_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n progress;\n\n MagickSizeType\n number_pixels;\n\n ssize_t\n y;\n\n /*\n Initialize threshold image attributes.\n */\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n threshold_image=CloneImage(image,0,0,MagickTrue,exception);\n if (threshold_image == (Image *) NULL)\n return((Image *) NULL);\n if (width == 0)\n return(threshold_image);\n status=SetImageStorageClass(threshold_image,DirectClass,exception);\n if (status == MagickFalse)\n {\n threshold_image=DestroyImage(threshold_image);\n return((Image *) NULL);\n }\n /*\n Threshold image.\n */\n status=MagickTrue;\n progress=0;\n number_pixels=(MagickSizeType) width*height;\n image_view=AcquireVirtualCacheView(image,exception);\n threshold_view=AcquireAuthenticCacheView(threshold_image,exception);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\\n magick_number_threads(image,threshold_image,image->rows,1)\n#endif\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n double\n channel_bias[MaxPixelChannels],\n channel_sum[MaxPixelChannels];\n\n register const Quantum\n *magick_restrict p,\n *magick_restrict pixels;\n\n register Quantum\n *magick_restrict q;\n\n register ssize_t\n i,\n x;\n\n ssize_t\n center,\n u,\n v;\n\n if (status == MagickFalse)\n continue;\n p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)\n (height/2L),image->columns+width,height,exception);\n q=QueueCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns,\n 1,exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }\n center=(ssize_t) GetPixelChannels(image)*(image->columns+width)*(height/2L)+\n GetPixelChannels(image)*(width/2);\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n PixelChannel channel = GetPixelChannelChannel(image,i);\n PixelTrait traits = GetPixelChannelTraits(image,channel);\n PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image,\n channel);\n if ((traits == UndefinedPixelTrait) ||\n (threshold_traits == UndefinedPixelTrait))\n continue;\n if ((threshold_traits & CopyPixelTrait) != 0)\n {\n SetPixelChannel(threshold_image,channel,p[center+i],q);\n continue;\n }\n pixels=p;\n channel_bias[channel]=0.0;\n channel_sum[channel]=0.0;\n for (v=0; v < (ssize_t) height; v++)\n {\n for (u=0; u < (ssize_t) width; u++)\n {\n if (u == (ssize_t) (width-1))\n channel_bias[channel]+=pixels[i];\n channel_sum[channel]+=pixels[i];\n pixels+=GetPixelChannels(image);\n }\n pixels+=GetPixelChannels(image)*image->columns;\n }\n }\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n for (i=0; i < (ssize_t) GetPixelChannels(image); i++)\n {\n double\n mean;\n\n PixelChannel channel = GetPixelChannelChannel(image,i);\n PixelTrait traits = GetPixelChannelTraits(image,channel);\n PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image,\n channel);\n if ((traits == UndefinedPixelTrait) ||\n (threshold_traits == UndefinedPixelTrait))\n continue;\n if ((threshold_traits & CopyPixelTrait) != 0)\n {\n SetPixelChannel(threshold_image,channel,p[center+i],q);\n continue;\n }\n channel_sum[channel]-=channel_bias[channel];\n channel_bias[channel]=0.0;\n pixels=p;\n for (v=0; v < (ssize_t) height; v++)\n {\n channel_bias[channel]+=pixels[i];\n pixels+=(width-1)*GetPixelChannels(image);\n channel_sum[channel]+=pixels[i];\n pixels+=GetPixelChannels(image)*(image->columns+1);\n }\n mean=(double) (channel_sum[channel]/number_pixels+bias);\n SetPixelChannel(threshold_image,channel,(Quantum) ((double)\n p[center+i] <= mean ? 0 : QuantumRange),q);\n }\n p+=GetPixelChannels(image);\n q+=GetPixelChannels(threshold_image);\n }\n if (SyncCacheViewAuthenticPixels(threshold_view,exception) == MagickFalse)\n status=MagickFalse;\n if (image->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;\n\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(image,AdaptiveThresholdImageTag,progress,\n image->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n threshold_image->type=image->type;\n threshold_view=DestroyCacheView(threshold_view);\n image_view=DestroyCacheView(image_view);\n if (status == MagickFalse)\n threshold_image=DestroyImage(threshold_image);\n return(threshold_image);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"AdaptiveThresholdImage","file_name":"MagickCore/threshold.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/a7759f410b773a1dd57b0e1fb28112e1cd8b97bc","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#5-695fa97f705c","input":"INST_HANDLER (lds) {\t// LDS Rd, k\n\tint d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4);\n\tint k = (buf[3] << 8) | buf[2];\n\top->ptr = k;\n\n\t// load value from RAMPD:k\n\t__generic_ld_st (op, \"ram\", 0, 1, 0, k, 0);\n\tESIL_A (\"r%d,=,\", d);\n}","target":"INST_HANDLER (lds) {\t// LDS Rd, k\n\tif (len < 4) {\n\t\treturn;\n\t}\n\tint d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4);\n\tint k = (buf[3] << 8) | buf[2];\n\top->ptr = k;\n\n\t// load value from RAMPD:k\n\t__generic_ld_st (op, \"ram\", 0, 1, 0, k, 0);\n\tESIL_A (\"r%d,=,\", d);\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"INST_HANDLER","file_name":"libr/anal/p/anal_avr.c","commit_link":"github.com/radare/radare2/commit/041e53cab7ca33481ae45ecd65ad596976d78e68","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#6-82db917d9f97","input":"static int jpeg_size(unsigned char* data, unsigned int data_size,\n int *width, int *height)\n{\n int i = 0;\n if (i + 3 < data_size && data[i] == 0xFF && data[i+1] == 0xD8 &&\n data[i+2] == 0xFF && data[i+3] == 0xE0) {\n i += 4;\n if(i + 6 < data_size &&\n data[i+2] == 'J' && data[i+3] == 'F' && data[i+4] == 'I' &&\n data[i+5] == 'F' && data[i+6] == 0x00) {\n unsigned short block_length = data[i] * 256 + data[i+1];\n while(i= data_size)\n return -1;\n if(data[i] != 0xFF)\n return -1;\n if(data[i+1] == 0xC0) {\n *height = data[i+5]*256 + data[i+6];\n *width = data[i+7]*256 + data[i+8];\n return 0;\n }\n i+=2;\n block_length = data[i] * 256 + data[i+1];\n }\n }\n }\n\n return -1;\n}","target":"static int jpeg_size(unsigned char* data, unsigned int data_size,\n int *width, int *height)\n{\n int i = 0;\n if (i + 3 < data_size && data[i] == 0xFF && data[i+1] == 0xD8 &&\n data[i+2] == 0xFF && data[i+3] == 0xE0) {\n i += 4;\n if(i + 6 < data_size &&\n data[i+2] == 'J' && data[i+3] == 'F' && data[i+4] == 'I' &&\n data[i+5] == 'F' && data[i+6] == 0x00) {\n unsigned short block_length = data[i] * 256 + data[i+1];\n while(i= data_size)\n return -1;\n if(data[i] != 0xFF)\n return -1;\n if(data[i+1] == 0xC0) {\n *height = data[i+5]*256 + data[i+6];\n *width = data[i+7]*256 + data[i+8];\n return 0;\n }\n i+=2;\n if (i + 1 < data_size)\n block_length = data[i] * 256 + data[i+1];\n }\n }\n }\n\n return -1;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"jpeg_size","file_name":"pdfgen.c","commit_link":"github.com/AndreRenaud/PDFGen/commit/ee58aff6918b8bbc3be29b9e3089485ea46ff956","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#7-2b127153357a","input":"static INLINE BOOL RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer, BYTE* pbDestBuffer,\n UINT32 rowDelta, UINT32 width, UINT32 height)\n{\n\tconst BYTE* pbSrc = pbSrcBuffer;\n\tconst BYTE* pbEnd;\n\tconst BYTE* pbDestEnd;\n\tBYTE* pbDest = pbDestBuffer;\n\tPIXEL temp;\n\tPIXEL fgPel = WHITE_PIXEL;\n\tBOOL fInsertFgPel = FALSE;\n\tBOOL fFirstLine = TRUE;\n\tBYTE bitmask;\n\tPIXEL pixelA, pixelB;\n\tUINT32 runLength;\n\tUINT32 code;\n\tUINT32 advance;\n\tRLEEXTRA\n\n\tif ((rowDelta == 0) || (rowDelta < width))\n\t\treturn FALSE;\n\n\tif (!pbSrcBuffer || !pbDestBuffer)\n\t\treturn FALSE;\n\n\tpbEnd = pbSrcBuffer + cbSrcBuffer;\n\tpbDestEnd = pbDestBuffer + rowDelta * height;\n\n\twhile (pbSrc < pbEnd)\n\t{\n\t\t/* Watch out for the end of the first scanline. */\n\t\tif (fFirstLine)\n\t\t{\n\t\t\tif ((UINT32)(pbDest - pbDestBuffer) >= rowDelta)\n\t\t\t{\n\t\t\t\tfFirstLine = FALSE;\n\t\t\t\tfInsertFgPel = FALSE;\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t Extract the compression order code ID from the compression\n\t\t order header.\n\t\t*/\n\t\tcode = ExtractCodeId(*pbSrc);\n\n\t\t/* Handle Background Run Orders. */\n\t\tif (code == REGULAR_BG_RUN || code == MEGA_MEGA_BG_RUN)\n\t\t{\n\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\tif (fFirstLine)\n\t\t\t{\n\t\t\t\tif (fInsertFgPel)\n\t\t\t\t{\n\t\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, fgPel);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\trunLength = runLength - 1;\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, BLACK_PIXEL);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (fInsertFgPel)\n\t\t\t\t{\n\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\n\t\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp ^ fgPel);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\trunLength--;\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/* A follow-on background run order will need a foreground pel inserted. */\n\t\t\tfInsertFgPel = TRUE;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* For any of the other run-types a follow-on background run\n\t\t order does not need a foreground pel inserted. */\n\t\tfInsertFgPel = FALSE;\n\n\t\tswitch (code)\n\t\t{\n\t\t\t/* Handle Foreground Run Orders. */\n\t\t\tcase REGULAR_FG_RUN:\n\t\t\tcase MEGA_MEGA_FG_RUN:\n\t\t\tcase LITE_SET_FG_FG_RUN:\n\t\t\tcase MEGA_MEGA_SET_FG_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\t\tif (code == LITE_SET_FG_FG_RUN || code == MEGA_MEGA_SET_FG_RUN)\n\t\t\t\t{\n\t\t\t\t\tSRCREADPIXEL(fgPel, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\t\tDESTWRITEPIXEL(pbDest, fgPel);\n\t\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\t\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp ^ fgPel);\n\t\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Dithered Run Orders. */\n\t\t\tcase LITE_DITHERED_RUN:\n\t\t\tcase MEGA_MEGA_DITHERED_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tSRCREADPIXEL(pixelA, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\tSRCREADPIXEL(pixelB, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength * 2))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelA);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelB);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Color Run Orders. */\n\t\t\tcase REGULAR_COLOR_RUN:\n\t\t\tcase MEGA_MEGA_COLOR_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tSRCREADPIXEL(pixelA, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelA);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Foreground/Background Image Orders. */\n\t\t\tcase REGULAR_FGBG_IMAGE:\n\t\t\tcase MEGA_MEGA_FGBG_IMAGE:\n\t\t\tcase LITE_SET_FG_FGBG_IMAGE:\n\t\t\tcase MEGA_MEGA_SET_FGBG_IMAGE:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\t\tif (code == LITE_SET_FG_FGBG_IMAGE || code == MEGA_MEGA_SET_FGBG_IMAGE)\n\t\t\t\t{\n\t\t\t\t\tSRCREADPIXEL(fgPel, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t}\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\twhile (runLength > 8)\n\t\t\t\t\t{\n\t\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\t\tpbSrc = pbSrc + 1;\n\t\t\t\t\t\tpbDest = WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, bitmask, fgPel, 8);\n\n\t\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\trunLength = runLength - 8;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twhile (runLength > 8)\n\t\t\t\t\t{\n\t\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\t\tpbSrc = pbSrc + 1;\n\t\t\t\t\t\tpbDest = WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, bitmask, fgPel, 8);\n\n\t\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\trunLength = runLength - 8;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (runLength > 0)\n\t\t\t\t{\n\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\t\tif (fFirstLine)\n\t\t\t\t\t{\n\t\t\t\t\t\tpbDest =\n\t\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, bitmask, fgPel, runLength);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tpbDest =\n\t\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, bitmask, fgPel, runLength);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Color Image Orders. */\n\t\t\tcase REGULAR_COLOR_IMAGE:\n\t\t\tcase MEGA_MEGA_COLOR_IMAGE:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tSRCREADPIXEL(temp, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Special Order 1. */\n\t\t\tcase SPECIAL_FGBG_1:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, g_MaskSpecialFgBg1, fgPel, 8);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, g_MaskSpecialFgBg1, fgPel, 8);\n\t\t\t\t}\n\n\t\t\t\tif (!pbDest)\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Special Order 2. */\n\t\t\tcase SPECIAL_FGBG_2:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, g_MaskSpecialFgBg2, fgPel, 8);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, g_MaskSpecialFgBg2, fgPel, 8);\n\t\t\t\t}\n\n\t\t\t\tif (!pbDest)\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle White Order. */\n\t\t\tcase SPECIAL_WHITE:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tDESTWRITEPIXEL(pbDest, WHITE_PIXEL);\n\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Black Order. */\n\t\t\tcase SPECIAL_BLACK:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tDESTWRITEPIXEL(pbDest, BLACK_PIXEL);\n\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\n\treturn TRUE;\n}","target":"static INLINE BOOL RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer, BYTE* pbDestBuffer,\n UINT32 rowDelta, UINT32 width, UINT32 height)\n{\n\tconst BYTE* pbSrc = pbSrcBuffer;\n\tconst BYTE* pbEnd;\n\tconst BYTE* pbDestEnd;\n\tBYTE* pbDest = pbDestBuffer;\n\tPIXEL temp;\n\tPIXEL fgPel = WHITE_PIXEL;\n\tBOOL fInsertFgPel = FALSE;\n\tBOOL fFirstLine = TRUE;\n\tBYTE bitmask;\n\tPIXEL pixelA, pixelB;\n\tUINT32 runLength;\n\tUINT32 code;\n\tUINT32 advance;\n\tRLEEXTRA\n\n\tif ((rowDelta == 0) || (rowDelta < width))\n\t\treturn FALSE;\n\n\tif (!pbSrcBuffer || !pbDestBuffer)\n\t\treturn FALSE;\n\n\tpbEnd = pbSrcBuffer + cbSrcBuffer;\n\tpbDestEnd = pbDestBuffer + rowDelta * height;\n\n\twhile (pbSrc < pbEnd)\n\t{\n\t\t/* Watch out for the end of the first scanline. */\n\t\tif (fFirstLine)\n\t\t{\n\t\t\tif ((UINT32)(pbDest - pbDestBuffer) >= rowDelta)\n\t\t\t{\n\t\t\t\tfFirstLine = FALSE;\n\t\t\t\tfInsertFgPel = FALSE;\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t Extract the compression order code ID from the compression\n\t\t order header.\n\t\t*/\n\t\tcode = ExtractCodeId(*pbSrc);\n\n\t\t/* Handle Background Run Orders. */\n\t\tif (code == REGULAR_BG_RUN || code == MEGA_MEGA_BG_RUN)\n\t\t{\n\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\tif (fFirstLine)\n\t\t\t{\n\t\t\t\tif (fInsertFgPel)\n\t\t\t\t{\n\t\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, fgPel);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\trunLength = runLength - 1;\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, BLACK_PIXEL);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (fInsertFgPel)\n\t\t\t\t{\n\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\n\t\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp ^ fgPel);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\trunLength--;\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/* A follow-on background run order will need a foreground pel inserted. */\n\t\t\tfInsertFgPel = TRUE;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* For any of the other run-types a follow-on background run\n\t\t order does not need a foreground pel inserted. */\n\t\tfInsertFgPel = FALSE;\n\n\t\tswitch (code)\n\t\t{\n\t\t\t/* Handle Foreground Run Orders. */\n\t\t\tcase REGULAR_FG_RUN:\n\t\t\tcase MEGA_MEGA_FG_RUN:\n\t\t\tcase LITE_SET_FG_FG_RUN:\n\t\t\tcase MEGA_MEGA_SET_FG_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\t\tif (code == LITE_SET_FG_FG_RUN || code == MEGA_MEGA_SET_FG_RUN)\n\t\t\t\t{\n\t\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\tSRCREADPIXEL(fgPel, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t}\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\t\tDESTWRITEPIXEL(pbDest, fgPel);\n\t\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\t\tDESTREADPIXEL(temp, pbDest - rowDelta);\n\t\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp ^ fgPel);\n\t\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Dithered Run Orders. */\n\t\t\tcase LITE_DITHERED_RUN:\n\t\t\tcase MEGA_MEGA_DITHERED_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\treturn FALSE;\n\t\t\t\tSRCREADPIXEL(pixelA, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\treturn FALSE;\n\t\t\t\tSRCREADPIXEL(pixelB, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength * 2))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelA);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelB);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Color Run Orders. */\n\t\t\tcase REGULAR_COLOR_RUN:\n\t\t\tcase MEGA_MEGA_COLOR_RUN:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\treturn FALSE;\n\t\t\t\tSRCREADPIXEL(pixelA, pbSrc);\n\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, pixelA);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Foreground/Background Image Orders. */\n\t\t\tcase REGULAR_FGBG_IMAGE:\n\t\t\tcase MEGA_MEGA_FGBG_IMAGE:\n\t\t\tcase LITE_SET_FG_FGBG_IMAGE:\n\t\t\tcase MEGA_MEGA_SET_FGBG_IMAGE:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\n\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\treturn FALSE;\n\t\t\t\tif (code == LITE_SET_FG_FGBG_IMAGE || code == MEGA_MEGA_SET_FGBG_IMAGE)\n\t\t\t\t{\n\t\t\t\t\tSRCREADPIXEL(fgPel, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t}\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\twhile (runLength > 8)\n\t\t\t\t\t{\n\t\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\t\tpbSrc = pbSrc + 1;\n\t\t\t\t\t\tpbDest = WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, bitmask, fgPel, 8);\n\n\t\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\trunLength = runLength - 8;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twhile (runLength > 8)\n\t\t\t\t\t{\n\t\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\t\tpbSrc = pbSrc + 1;\n\t\t\t\t\t\tpbDest = WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, bitmask, fgPel, 8);\n\n\t\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\trunLength = runLength - 8;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (runLength > 0)\n\t\t\t\t{\n\t\t\t\t\tbitmask = *pbSrc;\n\t\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\t\tif (fFirstLine)\n\t\t\t\t\t{\n\t\t\t\t\t\tpbDest =\n\t\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, bitmask, fgPel, runLength);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tpbDest =\n\t\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, bitmask, fgPel, runLength);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!pbDest)\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Color Image Orders. */\n\t\t\tcase REGULAR_COLOR_IMAGE:\n\t\t\tcase MEGA_MEGA_COLOR_IMAGE:\n\t\t\t\trunLength = ExtractRunLength(code, pbSrc, &advance);\n\t\t\t\tpbSrc = pbSrc + advance;\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tUNROLL(runLength, {\n\t\t\t\t\tif (pbSrc >= pbEnd)\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\tSRCREADPIXEL(temp, pbSrc);\n\t\t\t\t\tSRCNEXTPIXEL(pbSrc);\n\t\t\t\t\tDESTWRITEPIXEL(pbDest, temp);\n\t\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Special Order 1. */\n\t\t\tcase SPECIAL_FGBG_1:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, g_MaskSpecialFgBg1, fgPel, 8);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, g_MaskSpecialFgBg1, fgPel, 8);\n\t\t\t\t}\n\n\t\t\t\tif (!pbDest)\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Special Order 2. */\n\t\t\tcase SPECIAL_FGBG_2:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (fFirstLine)\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, g_MaskSpecialFgBg2, fgPel, 8);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpbDest =\n\t\t\t\t\t WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, g_MaskSpecialFgBg2, fgPel, 8);\n\t\t\t\t}\n\n\t\t\t\tif (!pbDest)\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\t/* Handle White Order. */\n\t\t\tcase SPECIAL_WHITE:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tDESTWRITEPIXEL(pbDest, WHITE_PIXEL);\n\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\tbreak;\n\n\t\t\t/* Handle Black Order. */\n\t\t\tcase SPECIAL_BLACK:\n\t\t\t\tpbSrc = pbSrc + 1;\n\n\t\t\t\tif (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tDESTWRITEPIXEL(pbDest, BLACK_PIXEL);\n\t\t\t\tDESTNEXTPIXEL(pbDest);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\n\treturn TRUE;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"RLEDECOMPRESS","file_name":"libfreerdp/codec/include/bitmap.c","commit_link":"github.com/FreeRDP/FreeRDP/commit/0a98c450c58ec150e44781c89aa6f8e7e0f571f5","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#8-4584c231274e","input":"jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr)\n{\n\tjp2_box_t *box;\n\tint found;\n\tjas_image_t *image;\n\tjp2_dec_t *dec;\n\tbool samedtype;\n\tint dtype;\n\tunsigned int i;\n\tjp2_cmap_t *cmapd;\n\tjp2_pclr_t *pclrd;\n\tjp2_cdef_t *cdefd;\n\tunsigned int channo;\n\tint newcmptno;\n\tint_fast32_t *lutents;\n#if 0\n\tjp2_cdefchan_t *cdefent;\n\tint cmptno;\n#endif\n\tjp2_cmapent_t *cmapent;\n\tjas_icchdr_t icchdr;\n\tjas_iccprof_t *iccprof;\n\n\tdec = 0;\n\tbox = 0;\n\timage = 0;\n\n\tJAS_DBGLOG(100, (\"jp2_decode(%p, \\\"%s\\\")\\n\", in, optstr));\n\n\tif (!(dec = jp2_dec_create())) {\n\t\tgoto error;\n\t}\n\n\t/* Get the first box. This should be a JP box. */\n\tif (!(box = jp2_box_get(in))) {\n\t\tjas_eprintf(\"error: cannot get box\\n\");\n\t\tgoto error;\n\t}\n\tif (box->type != JP2_BOX_JP) {\n\t\tjas_eprintf(\"error: expecting signature box\\n\");\n\t\tgoto error;\n\t}\n\tif (box->data.jp.magic != JP2_JP_MAGIC) {\n\t\tjas_eprintf(\"incorrect magic number\\n\");\n\t\tgoto error;\n\t}\n\tjp2_box_destroy(box);\n\tbox = 0;\n\n\t/* Get the second box. This should be a FTYP box. */\n\tif (!(box = jp2_box_get(in))) {\n\t\tgoto error;\n\t}\n\tif (box->type != JP2_BOX_FTYP) {\n\t\tjas_eprintf(\"expecting file type box\\n\");\n\t\tgoto error;\n\t}\n\tjp2_box_destroy(box);\n\tbox = 0;\n\n\t/* Get more boxes... */\n\tfound = 0;\n\twhile ((box = jp2_box_get(in))) {\n\t\tif (jas_getdbglevel() >= 1) {\n\t\t\tjas_eprintf(\"got box type %s\\n\", box->info->name);\n\t\t}\n\t\tswitch (box->type) {\n\t\tcase JP2_BOX_JP2C:\n\t\t\tfound = 1;\n\t\t\tbreak;\n\t\tcase JP2_BOX_IHDR:\n\t\t\tif (!dec->ihdr) {\n\t\t\t\tdec->ihdr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_BPCC:\n\t\t\tif (!dec->bpcc) {\n\t\t\t\tdec->bpcc = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_CDEF:\n\t\t\tif (!dec->cdef) {\n\t\t\t\tdec->cdef = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_PCLR:\n\t\t\tif (!dec->pclr) {\n\t\t\t\tdec->pclr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_CMAP:\n\t\t\tif (!dec->cmap) {\n\t\t\t\tdec->cmap = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_COLR:\n\t\t\tif (!dec->colr) {\n\t\t\t\tdec->colr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif (box) {\n\t\t\tjp2_box_destroy(box);\n\t\t\tbox = 0;\n\t\t}\n\t\tif (found) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!found) {\n\t\tjas_eprintf(\"error: no code stream found\\n\");\n\t\tgoto error;\n\t}\n\n\tif (!(dec->image = jpc_decode(in, optstr))) {\n\t\tjas_eprintf(\"error: cannot decode code stream\\n\");\n\t\tgoto error;\n\t}\n\n\t/* An IHDR box must be present. */\n\tif (!dec->ihdr) {\n\t\tjas_eprintf(\"error: missing IHDR box\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Does the number of components indicated in the IHDR box match\n\t the value specified in the code stream? */\n\tif (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(jas_uint,\n\t jas_image_numcmpts(dec->image))) {\n\t\tjas_eprintf(\"warning: number of components mismatch\\n\");\n\t}\n\n\t/* At least one component must be present. */\n\tif (!jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: no components\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Determine if all components have the same data type. */\n\tsamedtype = true;\n\tdtype = jas_image_cmptdtype(dec->image, 0);\n\tfor (i = 1; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {\n\t\tif (jas_image_cmptdtype(dec->image, i) != dtype) {\n\t\t\tsamedtype = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* Is the component data type indicated in the IHDR box consistent\n\t with the data in the code stream? */\n\tif ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||\n\t (!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {\n\t\tjas_eprintf(\"warning: component data type mismatch (IHDR)\\n\");\n\t}\n\n\t/* Is the compression type supported? */\n\tif (dec->ihdr->data.ihdr.comptype != JP2_IHDR_COMPTYPE) {\n\t\tjas_eprintf(\"error: unsupported compression type\\n\");\n\t\tgoto error;\n\t}\n\n\tif (dec->bpcc) {\n\t\t/* Is the number of components indicated in the BPCC box\n\t\t consistent with the code stream data? */\n\t\tif (dec->bpcc->data.bpcc.numcmpts != JAS_CAST(jas_uint, jas_image_numcmpts(\n\t\t dec->image))) {\n\t\t\tjas_eprintf(\"warning: number of components mismatch\\n\");\n\t\t}\n\t\t/* Is the component data type information indicated in the BPCC\n\t\t box consistent with the code stream data? */\n\t\tif (!samedtype) {\n\t\t\tfor (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));\n\t\t\t ++i) {\n\t\t\t\tif (jas_image_cmptdtype(dec->image, i) !=\n\t\t\t\t JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {\n\t\t\t\t\tjas_eprintf(\"warning: component data type mismatch (BPCC)\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tjas_eprintf(\"warning: superfluous BPCC box\\n\");\n\t\t}\n\t}\n\n\t/* A COLR box must be present. */\n\tif (!dec->colr) {\n\t\tjas_eprintf(\"error: no COLR box\\n\");\n\t\tgoto error;\n\t}\n\n\tswitch (dec->colr->data.colr.method) {\n\tcase JP2_COLR_ENUM:\n\t\tjas_image_setclrspc(dec->image, jp2_getcs(&dec->colr->data.colr));\n\t\tbreak;\n\tcase JP2_COLR_ICC:\n\t\ticcprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp,\n\t\t dec->colr->data.colr.iccplen);\n\t\tif (!iccprof) {\n\t\t\tjas_eprintf(\"error: failed to parse ICC profile\\n\");\n\t\t\tgoto error;\n\t\t}\n\t\tjas_iccprof_gethdr(iccprof, &icchdr);\n\t\tjas_eprintf(\"ICC Profile CS %08x\\n\", icchdr.colorspc);\n\t\tjas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc));\n\t\tdec->image->cmprof_ = jas_cmprof_createfromiccprof(iccprof);\n\t\tif (!dec->image->cmprof_) {\n\t\t\tjas_iccprof_destroy(iccprof);\n\t\t\tgoto error;\n\t\t}\n\t\tjas_iccprof_destroy(iccprof);\n\t\tbreak;\n\t}\n\n\t/* If a CMAP box is present, a PCLR box must also be present. */\n\tif (dec->cmap && !dec->pclr) {\n\t\tjas_eprintf(\"warning: missing PCLR box or superfluous CMAP box\\n\");\n\t\tjp2_box_destroy(dec->cmap);\n\t\tdec->cmap = 0;\n\t}\n\n\t/* If a CMAP box is not present, a PCLR box must not be present. */\n\tif (!dec->cmap && dec->pclr) {\n\t\tjas_eprintf(\"warning: missing CMAP box or superfluous PCLR box\\n\");\n\t\tjp2_box_destroy(dec->pclr);\n\t\tdec->pclr = 0;\n\t}\n\n\t/* Determine the number of channels (which is essentially the number\n\t of components after any palette mappings have been applied). */\n\tdec->numchans = dec->cmap ? dec->cmap->data.cmap.numchans :\n\t JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));\n\n\t/* Perform a basic sanity check on the CMAP box if present. */\n\tif (dec->cmap) {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\t/* Is the component number reasonable? */\n\t\t\tif (dec->cmap->data.cmap.ents[i].cmptno >= JAS_CAST(jas_uint,\n\t\t\t jas_image_numcmpts(dec->image))) {\n\t\t\t\tjas_eprintf(\"error: invalid component number in CMAP box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\t/* Is the LUT index reasonable? */\n\t\t\tif (dec->cmap->data.cmap.ents[i].pcol >=\n\t\t\t dec->pclr->data.pclr.numchans) {\n\t\t\t\tjas_eprintf(\"error: invalid CMAP LUT index\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Allocate space for the channel-number to component-number LUT. */\n\tif (!(dec->chantocmptlut = jas_alloc2(dec->numchans,\n\t sizeof(uint_fast16_t)))) {\n\t\tjas_eprintf(\"error: no memory\\n\");\n\t\tgoto error;\n\t}\n\n\tif (!dec->cmap) {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\tdec->chantocmptlut[i] = i;\n\t\t}\n\t} else {\n\t\tcmapd = &dec->cmap->data.cmap;\n\t\tpclrd = &dec->pclr->data.pclr;\n\t\tcdefd = &dec->cdef->data.cdef;\n\t\tfor (channo = 0; channo < cmapd->numchans; ++channo) {\n\t\t\tcmapent = &cmapd->ents[channo];\n\t\t\tif (cmapent->map == JP2_CMAP_DIRECT) {\n\t\t\t\tdec->chantocmptlut[channo] = channo;\n\t\t\t} else if (cmapent->map == JP2_CMAP_PALETTE) {\n\t\t\t\tif (!pclrd->numlutents) {\n\t\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t\tlutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t));\n\t\t\t\tif (!lutents) {\n\t\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t\tfor (i = 0; i < pclrd->numlutents; ++i) {\n\t\t\t\t\tlutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];\n\t\t\t\t}\n\t\t\t\tnewcmptno = jas_image_numcmpts(dec->image);\n\t\t\t\tjas_image_depalettize(dec->image, cmapent->cmptno,\n\t\t\t\t pclrd->numlutents, lutents,\n\t\t\t\t JP2_BPCTODTYPE(pclrd->bpc[cmapent->pcol]), newcmptno);\n\t\t\t\tdec->chantocmptlut[channo] = newcmptno;\n\t\t\t\tjas_free(lutents);\n#if 0\n\t\t\t\tif (dec->cdef) {\n\t\t\t\t\tcdefent = jp2_cdef_lookup(cdefd, channo);\n\t\t\t\t\tif (!cdefent) {\n\t\t\t\t\t\tabort();\n\t\t\t\t\t}\n\t\t\t\tjas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), cdefent->type, cdefent->assoc));\n\t\t\t\t} else {\n\t\t\t\tjas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), 0, channo + 1));\n\t\t\t\t}\n#else\n\t\t\t\t/* suppress -Wunused-but-set-variable */\n\t\t\t\t(void)cdefd;\n#endif\n\t\t\t} else {\n\t\t\t\tjas_eprintf(\"error: invalid MTYP in CMAP box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Ensure that the number of channels being used by the decoder\n\t matches the number of image components. */\n\tif (dec->numchans != jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: mismatch in number of components (%d != %d)\\n\",\n\t\t dec->numchans, jas_image_numcmpts(dec->image));\n\t\tgoto error;\n\t}\n\n\t/* Mark all components as being of unknown type. */\n\n\tfor (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {\n\t\tjas_image_setcmpttype(dec->image, i, JAS_IMAGE_CT_UNKNOWN);\n\t}\n\n\t/* Determine the type of each component. */\n\tif (dec->cdef) {\n\t\tfor (i = 0; i < dec->cdef->data.cdef.numchans; ++i) {\n\t\t\t/* Is the channel number reasonable? */\n\t\t\tif (dec->cdef->data.cdef.ents[i].channo >= dec->numchans) {\n\t\t\t\tjas_eprintf(\"error: invalid channel number in CDEF box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\tjas_image_setcmpttype(dec->image,\n\t\t\t dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo],\n\t\t\t jp2_getct(jas_image_clrspc(dec->image),\n\t\t\t dec->cdef->data.cdef.ents[i].type,\n\t\t\t dec->cdef->data.cdef.ents[i].assoc));\n\t\t}\n\t} else {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\tjas_image_setcmpttype(dec->image, dec->chantocmptlut[i],\n\t\t\t jp2_getct(jas_image_clrspc(dec->image), 0, i + 1));\n\t\t}\n\t}\n\n\t/* Delete any components that are not of interest. */\n\tfor (i = jas_image_numcmpts(dec->image); i > 0; --i) {\n\t\tif (jas_image_cmpttype(dec->image, i - 1) == JAS_IMAGE_CT_UNKNOWN) {\n\t\t\tjas_image_delcmpt(dec->image, i - 1);\n\t\t}\n\t}\n\n\t/* Ensure that some components survived. */\n\tif (!jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: no components\\n\");\n\t\tgoto error;\n\t}\n#if 0\njas_eprintf(\"no of components is %d\\n\", jas_image_numcmpts(dec->image));\n#endif\n\n\t/* Prevent the image from being destroyed later. */\n\timage = dec->image;\n\tdec->image = 0;\n\n\tjp2_dec_destroy(dec);\n\n\treturn image;\n\nerror:\n\tif (box) {\n\t\tjp2_box_destroy(box);\n\t}\n\tif (dec) {\n\t\tjp2_dec_destroy(dec);\n\t}\n\treturn 0;\n}","target":"jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr)\n{\n\tjp2_box_t *box;\n\tint found;\n\tjas_image_t *image;\n\tjp2_dec_t *dec;\n\tbool samedtype;\n\tint dtype;\n\tunsigned int i;\n\tjp2_cmap_t *cmapd;\n\tjp2_pclr_t *pclrd;\n\tjp2_cdef_t *cdefd;\n\tunsigned int channo;\n\tint newcmptno;\n\tint_fast32_t *lutents;\n#if 0\n\tjp2_cdefchan_t *cdefent;\n\tint cmptno;\n#endif\n\tjp2_cmapent_t *cmapent;\n\tjas_icchdr_t icchdr;\n\tjas_iccprof_t *iccprof;\n\n\tdec = 0;\n\tbox = 0;\n\timage = 0;\n\n\tJAS_DBGLOG(100, (\"jp2_decode(%p, \\\"%s\\\")\\n\", in, optstr));\n\n\tif (!(dec = jp2_dec_create())) {\n\t\tgoto error;\n\t}\n\n\t/* Get the first box. This should be a JP box. */\n\tif (!(box = jp2_box_get(in))) {\n\t\tjas_eprintf(\"error: cannot get box\\n\");\n\t\tgoto error;\n\t}\n\tif (box->type != JP2_BOX_JP) {\n\t\tjas_eprintf(\"error: expecting signature box\\n\");\n\t\tgoto error;\n\t}\n\tif (box->data.jp.magic != JP2_JP_MAGIC) {\n\t\tjas_eprintf(\"incorrect magic number\\n\");\n\t\tgoto error;\n\t}\n\tjp2_box_destroy(box);\n\tbox = 0;\n\n\t/* Get the second box. This should be a FTYP box. */\n\tif (!(box = jp2_box_get(in))) {\n\t\tgoto error;\n\t}\n\tif (box->type != JP2_BOX_FTYP) {\n\t\tjas_eprintf(\"expecting file type box\\n\");\n\t\tgoto error;\n\t}\n\tjp2_box_destroy(box);\n\tbox = 0;\n\n\t/* Get more boxes... */\n\tfound = 0;\n\twhile ((box = jp2_box_get(in))) {\n\t\tif (jas_getdbglevel() >= 1) {\n\t\t\tjas_eprintf(\"got box type %s\\n\", box->info->name);\n\t\t}\n\t\tswitch (box->type) {\n\t\tcase JP2_BOX_JP2C:\n\t\t\tfound = 1;\n\t\t\tbreak;\n\t\tcase JP2_BOX_IHDR:\n\t\t\tif (!dec->ihdr) {\n\t\t\t\tdec->ihdr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_BPCC:\n\t\t\tif (!dec->bpcc) {\n\t\t\t\tdec->bpcc = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_CDEF:\n\t\t\tif (!dec->cdef) {\n\t\t\t\tdec->cdef = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_PCLR:\n\t\t\tif (!dec->pclr) {\n\t\t\t\tdec->pclr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_CMAP:\n\t\t\tif (!dec->cmap) {\n\t\t\t\tdec->cmap = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase JP2_BOX_COLR:\n\t\t\tif (!dec->colr) {\n\t\t\t\tdec->colr = box;\n\t\t\t\tbox = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif (box) {\n\t\t\tjp2_box_destroy(box);\n\t\t\tbox = 0;\n\t\t}\n\t\tif (found) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!found) {\n\t\tjas_eprintf(\"error: no code stream found\\n\");\n\t\tgoto error;\n\t}\n\n\tif (!(dec->image = jpc_decode(in, optstr))) {\n\t\tjas_eprintf(\"error: cannot decode code stream\\n\");\n\t\tgoto error;\n\t}\n\n\t/* An IHDR box must be present. */\n\tif (!dec->ihdr) {\n\t\tjas_eprintf(\"error: missing IHDR box\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Does the number of components indicated in the IHDR box match\n\t the value specified in the code stream? */\n\tif (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(jas_uint,\n\t jas_image_numcmpts(dec->image))) {\n\t\tjas_eprintf(\"error: number of components mismatch (IHDR)\\n\");\n\t\tgoto error;\n\t}\n\n\t/* At least one component must be present. */\n\tif (!jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: no components\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Determine if all components have the same data type. */\n\tsamedtype = true;\n\tdtype = jas_image_cmptdtype(dec->image, 0);\n\tfor (i = 1; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {\n\t\tif (jas_image_cmptdtype(dec->image, i) != dtype) {\n\t\t\tsamedtype = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* Is the component data type indicated in the IHDR box consistent\n\t with the data in the code stream? */\n\tif ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||\n\t (!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {\n\t\tjas_eprintf(\"error: component data type mismatch (IHDR)\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Is the compression type supported? */\n\tif (dec->ihdr->data.ihdr.comptype != JP2_IHDR_COMPTYPE) {\n\t\tjas_eprintf(\"error: unsupported compression type\\n\");\n\t\tgoto error;\n\t}\n\n\tif (dec->bpcc) {\n\t\t/* Is the number of components indicated in the BPCC box\n\t\t consistent with the code stream data? */\n\t\tif (dec->bpcc->data.bpcc.numcmpts !=\n\t\t JAS_CAST(jas_uint, jas_image_numcmpts(dec->image))) {\n\t\t\tjas_eprintf(\"error: number of components mismatch (BPCC)\\n\");\n\t\t\tgoto error;\n\t\t}\n\t\t/* Is the component data type information indicated in the BPCC\n\t\t box consistent with the code stream data? */\n\t\tif (!samedtype) {\n\t\t\tfor (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));\n\t\t\t ++i) {\n\t\t\t\tif (jas_image_cmptdtype(dec->image, i) !=\n\t\t\t\t JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {\n\t\t\t\t\tjas_eprintf(\"error: component data type mismatch (BPCC)\\n\");\n\t\t\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tjas_eprintf(\"warning: superfluous BPCC box\\n\");\n\t\t}\n\t}\n\n\t/* A COLR box must be present. */\n\tif (!dec->colr) {\n\t\tjas_eprintf(\"error: no COLR box\\n\");\n\t\tgoto error;\n\t}\n\n\tswitch (dec->colr->data.colr.method) {\n\tcase JP2_COLR_ENUM:\n\t\tjas_image_setclrspc(dec->image, jp2_getcs(&dec->colr->data.colr));\n\t\tbreak;\n\tcase JP2_COLR_ICC:\n\t\ticcprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp,\n\t\t dec->colr->data.colr.iccplen);\n\t\tif (!iccprof) {\n\t\t\tjas_eprintf(\"error: failed to parse ICC profile\\n\");\n\t\t\tgoto error;\n\t\t}\n\t\tjas_iccprof_gethdr(iccprof, &icchdr);\n\t\tjas_eprintf(\"ICC Profile CS %08x\\n\", icchdr.colorspc);\n\t\tjas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc));\n\t\tdec->image->cmprof_ = jas_cmprof_createfromiccprof(iccprof);\n\t\tif (!dec->image->cmprof_) {\n\t\t\tjas_iccprof_destroy(iccprof);\n\t\t\tgoto error;\n\t\t}\n\t\tjas_iccprof_destroy(iccprof);\n\t\tbreak;\n\t}\n\n\t/* If a CMAP box is present, a PCLR box must also be present. */\n\tif (dec->cmap && !dec->pclr) {\n\t\tjas_eprintf(\"warning: missing PCLR box or superfluous CMAP box\\n\");\n\t\tjp2_box_destroy(dec->cmap);\n\t\tdec->cmap = 0;\n\t}\n\n\t/* If a CMAP box is not present, a PCLR box must not be present. */\n\tif (!dec->cmap && dec->pclr) {\n\t\tjas_eprintf(\"warning: missing CMAP box or superfluous PCLR box\\n\");\n\t\tjp2_box_destroy(dec->pclr);\n\t\tdec->pclr = 0;\n\t}\n\n\t/* Determine the number of channels (which is essentially the number\n\t of components after any palette mappings have been applied). */\n\tdec->numchans = dec->cmap ? dec->cmap->data.cmap.numchans :\n\t JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));\n\n\t/* Perform a basic sanity check on the CMAP box if present. */\n\tif (dec->cmap) {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\t/* Is the component number reasonable? */\n\t\t\tif (dec->cmap->data.cmap.ents[i].cmptno >= JAS_CAST(jas_uint,\n\t\t\t jas_image_numcmpts(dec->image))) {\n\t\t\t\tjas_eprintf(\"error: invalid component number in CMAP box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\t/* Is the LUT index reasonable? */\n\t\t\tif (dec->cmap->data.cmap.ents[i].pcol >=\n\t\t\t dec->pclr->data.pclr.numchans) {\n\t\t\t\tjas_eprintf(\"error: invalid CMAP LUT index\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Allocate space for the channel-number to component-number LUT. */\n\tif (!(dec->chantocmptlut = jas_alloc2(dec->numchans,\n\t sizeof(uint_fast16_t)))) {\n\t\tjas_eprintf(\"error: no memory\\n\");\n\t\tgoto error;\n\t}\n\n\tif (!dec->cmap) {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\tdec->chantocmptlut[i] = i;\n\t\t}\n\t} else {\n\t\tcmapd = &dec->cmap->data.cmap;\n\t\tpclrd = &dec->pclr->data.pclr;\n\t\tcdefd = &dec->cdef->data.cdef;\n\t\tfor (channo = 0; channo < cmapd->numchans; ++channo) {\n\t\t\tcmapent = &cmapd->ents[channo];\n\t\t\tif (cmapent->map == JP2_CMAP_DIRECT) {\n\t\t\t\tdec->chantocmptlut[channo] = channo;\n\t\t\t} else if (cmapent->map == JP2_CMAP_PALETTE) {\n\t\t\t\tif (!pclrd->numlutents) {\n\t\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t\tlutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t));\n\t\t\t\tif (!lutents) {\n\t\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t\tfor (i = 0; i < pclrd->numlutents; ++i) {\n\t\t\t\t\tlutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];\n\t\t\t\t}\n\t\t\t\tnewcmptno = jas_image_numcmpts(dec->image);\n\t\t\t\tjas_image_depalettize(dec->image, cmapent->cmptno,\n\t\t\t\t pclrd->numlutents, lutents,\n\t\t\t\t JP2_BPCTODTYPE(pclrd->bpc[cmapent->pcol]), newcmptno);\n\t\t\t\tdec->chantocmptlut[channo] = newcmptno;\n\t\t\t\tjas_free(lutents);\n#if 0\n\t\t\t\tif (dec->cdef) {\n\t\t\t\t\tcdefent = jp2_cdef_lookup(cdefd, channo);\n\t\t\t\t\tif (!cdefent) {\n\t\t\t\t\t\tabort();\n\t\t\t\t\t}\n\t\t\t\tjas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), cdefent->type, cdefent->assoc));\n\t\t\t\t} else {\n\t\t\t\tjas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), 0, channo + 1));\n\t\t\t\t}\n#else\n\t\t\t\t/* suppress -Wunused-but-set-variable */\n\t\t\t\t(void)cdefd;\n#endif\n\t\t\t} else {\n\t\t\t\tjas_eprintf(\"error: invalid MTYP in CMAP box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Ensure that the number of channels being used by the decoder\n\t matches the number of image components. */\n\tif (dec->numchans != jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: mismatch in number of components (%d != %d)\\n\",\n\t\t dec->numchans, jas_image_numcmpts(dec->image));\n\t\tgoto error;\n\t}\n\n\t/* Mark all components as being of unknown type. */\n\n\tfor (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {\n\t\tjas_image_setcmpttype(dec->image, i, JAS_IMAGE_CT_UNKNOWN);\n\t}\n\n\t/* Determine the type of each component. */\n\tif (dec->cdef) {\n\t\tfor (i = 0; i < dec->cdef->data.cdef.numchans; ++i) {\n\t\t\t/* Is the channel number reasonable? */\n\t\t\tif (dec->cdef->data.cdef.ents[i].channo >= dec->numchans) {\n\t\t\t\tjas_eprintf(\"error: invalid channel number in CDEF box\\n\");\n\t\t\t\tgoto error;\n\t\t\t}\n\t\t\tjas_image_setcmpttype(dec->image,\n\t\t\t dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo],\n\t\t\t jp2_getct(jas_image_clrspc(dec->image),\n\t\t\t dec->cdef->data.cdef.ents[i].type,\n\t\t\t dec->cdef->data.cdef.ents[i].assoc));\n\t\t}\n\t} else {\n\t\tfor (i = 0; i < dec->numchans; ++i) {\n\t\t\tjas_image_setcmpttype(dec->image, dec->chantocmptlut[i],\n\t\t\t jp2_getct(jas_image_clrspc(dec->image), 0, i + 1));\n\t\t}\n\t}\n\n\t/* Delete any components that are not of interest. */\n\tfor (i = jas_image_numcmpts(dec->image); i > 0; --i) {\n\t\tif (jas_image_cmpttype(dec->image, i - 1) == JAS_IMAGE_CT_UNKNOWN) {\n\t\t\tjas_image_delcmpt(dec->image, i - 1);\n\t\t}\n\t}\n\n\t/* Ensure that some components survived. */\n\tif (!jas_image_numcmpts(dec->image)) {\n\t\tjas_eprintf(\"error: no components\\n\");\n\t\tgoto error;\n\t}\n#if 0\njas_eprintf(\"no of components is %d\\n\", jas_image_numcmpts(dec->image));\n#endif\n\n\t/* Prevent the image from being destroyed later. */\n\timage = dec->image;\n\tdec->image = 0;\n\n\tjp2_dec_destroy(dec);\n\n\treturn image;\n\nerror:\n\tif (box) {\n\t\tjp2_box_destroy(box);\n\t}\n\tif (dec) {\n\t\tjp2_dec_destroy(dec);\n\t}\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"jp2_decode","file_name":"src/libjasper/jp2/jp2_dec.c","commit_link":"github.com/jasper-software/jasper/commit/41f214b121b837fa30d9ca5f2430212110f5cd9b","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#9-de2fd9dfb4b7","input":"static inline void get_conn_text(const conn *c, const int af,\n char* addr, struct sockaddr *sock_addr) {\n char addr_text[MAXPATHLEN];\n addr_text[0] = '\\0';\n const char *protoname = \"?\";\n unsigned short port = 0;\n\n switch (af) {\n case AF_INET:\n (void) inet_ntop(af,\n &((struct sockaddr_in *)sock_addr)->sin_addr,\n addr_text,\n sizeof(addr_text) - 1);\n port = ntohs(((struct sockaddr_in *)sock_addr)->sin_port);\n protoname = IS_UDP(c->transport) ? \"udp\" : \"tcp\";\n break;\n\n case AF_INET6:\n addr_text[0] = '[';\n addr_text[1] = '\\0';\n if (inet_ntop(af,\n &((struct sockaddr_in6 *)sock_addr)->sin6_addr,\n addr_text + 1,\n sizeof(addr_text) - 2)) {\n strcat(addr_text, \"]\");\n }\n port = ntohs(((struct sockaddr_in6 *)sock_addr)->sin6_port);\n protoname = IS_UDP(c->transport) ? \"udp6\" : \"tcp6\";\n break;\n\n case AF_UNIX:\n strncpy(addr_text,\n ((struct sockaddr_un *)sock_addr)->sun_path,\n sizeof(addr_text) - 1);\n addr_text[sizeof(addr_text)-1] = '\\0';\n protoname = \"unix\";\n break;\n }\n\n if (strlen(addr_text) < 2) {\n /* Most likely this is a connected UNIX-domain client which\n * has no peer socket address, but there's no portable way\n * to tell for sure.\n */\n sprintf(addr_text, \"\", af);\n }\n\n if (port) {\n sprintf(addr, \"%s:%s:%u\", protoname, addr_text, port);\n } else {\n sprintf(addr, \"%s:%s\", protoname, addr_text);\n }\n}","target":"static inline void get_conn_text(const conn *c, const int af,\n char* addr, struct sockaddr *sock_addr) {\n char addr_text[MAXPATHLEN];\n addr_text[0] = '\\0';\n const char *protoname = \"?\";\n unsigned short port = 0;\n size_t pathlen = 0;\n\n switch (af) {\n case AF_INET:\n (void) inet_ntop(af,\n &((struct sockaddr_in *)sock_addr)->sin_addr,\n addr_text,\n sizeof(addr_text) - 1);\n port = ntohs(((struct sockaddr_in *)sock_addr)->sin_port);\n protoname = IS_UDP(c->transport) ? \"udp\" : \"tcp\";\n break;\n\n case AF_INET6:\n addr_text[0] = '[';\n addr_text[1] = '\\0';\n if (inet_ntop(af,\n &((struct sockaddr_in6 *)sock_addr)->sin6_addr,\n addr_text + 1,\n sizeof(addr_text) - 2)) {\n strcat(addr_text, \"]\");\n }\n port = ntohs(((struct sockaddr_in6 *)sock_addr)->sin6_port);\n protoname = IS_UDP(c->transport) ? \"udp6\" : \"tcp6\";\n break;\n\n case AF_UNIX:\n // this strncpy call originally could piss off an address\n // sanitizer; we supplied the size of the dest buf as a limiter,\n // but optimized versions of strncpy could read past the end of\n // *src while looking for a null terminator. Since buf and\n // sun_path here are both on the stack they could even overlap,\n // which is \"undefined\". In all OSS versions of strncpy I could\n // find this has no effect; it'll still only copy until the first null\n // terminator is found. Thus it's possible to get the OS to\n // examine past the end of sun_path but it's unclear to me if this\n // can cause any actual problem.\n //\n // We need a safe_strncpy util function but I'll punt on figuring\n // that out for now.\n pathlen = sizeof(((struct sockaddr_un *)sock_addr)->sun_path);\n if (MAXPATHLEN <= pathlen) {\n pathlen = MAXPATHLEN - 1;\n }\n strncpy(addr_text,\n ((struct sockaddr_un *)sock_addr)->sun_path,\n pathlen);\n addr_text[pathlen] = '\\0';\n protoname = \"unix\";\n break;\n }\n\n if (strlen(addr_text) < 2) {\n /* Most likely this is a connected UNIX-domain client which\n * has no peer socket address, but there's no portable way\n * to tell for sure.\n */\n sprintf(addr_text, \"\", af);\n }\n\n if (port) {\n sprintf(addr, \"%s:%s:%u\", protoname, addr_text, port);\n } else {\n sprintf(addr, \"%s:%s\", protoname, addr_text);\n }\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"get_conn_text","file_name":"memcached.c","commit_link":"github.com/memcached/memcached/commit/554b56687a19300a75ec24184746b5512580c819","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#10-0f8c86ffd07f","input":"static void parse_sec_attr_44(sc_file_t *file, const u8 *buf, size_t len)\n{\n\t/* OpenSc Operation values for each command operation-type */\n\tconst int df_idx[8] = {\t /* byte 1 = OpenSC type of AC Bit0, byte 2 = OpenSC type of AC Bit1 ...*/\n\t\tSC_AC_OP_DELETE, SC_AC_OP_CREATE, SC_AC_OP_CREATE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\tSC_AC_OP_LOCK, SC_AC_OP_DELETE, -1};\n\tconst int ef_idx[8] = {\n\t\tSC_AC_OP_READ, SC_AC_OP_UPDATE, SC_AC_OP_WRITE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\t-1, SC_AC_OP_ERASE, -1};\n\tconst int efi_idx[8] = { /* internal EF used for RSA keys */\n\t\tSC_AC_OP_READ, SC_AC_OP_ERASE, SC_AC_OP_UPDATE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\t-1, SC_AC_OP_ERASE, -1};\n\n\tu8\t\tbValue;\n\tint\t\ti;\n\tint\t\tiKeyRef = 0;\n\tint\t\tiMethod;\n\tint\t\tiPinCount;\n\tint\t\tiOffset = 0;\n\tint\t\tiOperation;\n\tconst int*\tp_idx;\n\n\t/* Check all sub-AC definitions within the total AC */\n\twhile (len > 1) {\t\t\t\t/* minimum length = 2 */\n\t\tsize_t iACLen = buf[iOffset] & 0x0F;\n\t\tif (iACLen > len)\n\t\t\tbreak;\n\n\t\tiMethod = SC_AC_NONE;\t\t/* default no authentication required */\n\n\t\tif (buf[iOffset] & 0X80) { /* AC in adaptive coding */\n\t\t\t/* Evaluates only the command-byte, not the optional P1/P2/Option bytes */\n\t\t\tsize_t\tiParmLen = 1;\t\t\t/* command-byte is always present */\n\t\t\tsize_t\tiKeyLen = 0;\t\t\t/* Encryption key is optional */\n\n\t\t\tif (buf[iOffset] & 0x20) iKeyLen++;\n\t\t\tif (buf[iOffset+1] & 0x40) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x20) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x10) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x08) iParmLen++;\n\n\t\t\t/* Get KeyNumber if available */\n\t\t\tif(iKeyLen) {\n\t\t\t\tint iSC;\n\t\t\t\tif (len < 1+(size_t)iACLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiSC = buf[iOffset+iACLen];\n\n\t\t\t\tswitch( (iSC>>5) & 0x03 ){\n\t\t\t\tcase 0:\n\t\t\t\t\tiMethod = SC_AC_TERM;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tiMethod = SC_AC_AUT;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\tcase 3:\n\t\t\t\t\tiMethod = SC_AC_PRO;\t\t/* secure messaging */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tiKeyRef = iSC & 0x1F;\t\t\t/* get key number */\n\t\t\t}\n\n\t\t\t/* Get PinNumber if available */\n\t\t\tif (iACLen > (1+iParmLen+iKeyLen)) { /* check via total length if pin is present */\n\t\t\t\tif (len < 1+1+1+(size_t)iParmLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiKeyRef = buf[iOffset+1+1+iParmLen]; /* PTL + AM-header + parameter-bytes */\n\t\t\t\tiMethod = SC_AC_CHV;\n\t\t\t}\n\n\t\t\t/* Convert SETCOS command to OpenSC command group */\n\t\t\tif (len < 1+2)\n\t\t\t\tbreak;\n\t\t\tswitch(buf[iOffset+2]){\n\t\t\tcase 0x2A:\t\t\t/* crypto operation */\n\t\t\t\tiOperation = SC_AC_OP_CRYPTO;\n\t\t\t\tbreak;\n\t\t\tcase 0x46:\t\t\t/* key-generation operation */\n\t\t\t\tiOperation = SC_AC_OP_UPDATE;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tiOperation = SC_AC_OP_SELECT;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsc_file_add_acl_entry(file, iOperation, iMethod, iKeyRef);\n\t\t}\n\t\telse { /* AC in simple coding */\n\t\t\t /* Initial AC is treated as an operational AC */\n\n\t\t\t/* Get specific Cmd groups for specified file-type */\n\t\t\tswitch (file->type) {\n\t\t\tcase SC_FILE_TYPE_DF: /* DF */\n\t\t\t\tp_idx = df_idx;\n\t\t\t\tbreak;\n\t\t\tcase SC_FILE_TYPE_INTERNAL_EF: /* EF for RSA keys */\n\t\t\t\tp_idx = efi_idx;\n\t\t\t\tbreak;\n\t\t\tdefault: /* EF */\n\t\t\t\tp_idx = ef_idx;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t/* Encryption key present ? */\n\t\t\tiPinCount = iACLen - 1;\t\t\n\n\t\t\tif (buf[iOffset] & 0x20) {\n\t\t\t\tint iSC;\n\t\t\t\tif (len < 1 + (size_t)iACLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiSC = buf[iOffset + iACLen];\n\n\t\t\t\tswitch( (iSC>>5) & 0x03 ) {\n\t\t\t\tcase 0:\n\t\t\t\t\tiMethod = SC_AC_TERM;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tiMethod = SC_AC_AUT;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\tcase 3:\n\t\t\t\t\tiMethod = SC_AC_PRO;\t\t/* secure messaging */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tiKeyRef = iSC & 0x1F;\t\t\t/* get key number */\n\n\t\t\t\tiPinCount--;\t\t\t\t/* one byte used for keyReference */\n\t\t\t}\n\n\t\t\t/* Pin present ? */\n\t\t\tif ( iPinCount > 0 ) {\n\t\t\t\tif (len < 1 + 2)\n\t\t\t\t\tbreak;\n\t\t\t\tiKeyRef = buf[iOffset + 2];\t/* pin ref */\n\t\t\t\tiMethod = SC_AC_CHV;\n\t\t\t}\n\n\t\t\t/* Add AC for each command-operationType into OpenSc structure */\n\t\t\tbValue = buf[iOffset + 1];\n\t\t\tfor (i = 0; i < 8; i++) {\n\t\t\t\tif((bValue & 1) && (p_idx[i] >= 0))\n\t\t\t\t\tsc_file_add_acl_entry(file, p_idx[i], iMethod, iKeyRef);\n\t\t\t\tbValue >>= 1;\n\t\t\t}\n\t\t}\n\t\t/* Current field treated, get next AC sub-field */\n\t\tiOffset += iACLen +1;\t\t/* AC + PTL-byte */\n\t\tlen -= iACLen +1;\n\t}\n}","target":"static void parse_sec_attr_44(sc_file_t *file, const u8 *buf, size_t len)\n{\n\t/* OpenSc Operation values for each command operation-type */\n\tconst int df_idx[8] = {\t /* byte 1 = OpenSC type of AC Bit0, byte 2 = OpenSC type of AC Bit1 ...*/\n\t\tSC_AC_OP_DELETE, SC_AC_OP_CREATE, SC_AC_OP_CREATE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\tSC_AC_OP_LOCK, SC_AC_OP_DELETE, -1};\n\tconst int ef_idx[8] = {\n\t\tSC_AC_OP_READ, SC_AC_OP_UPDATE, SC_AC_OP_WRITE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\t-1, SC_AC_OP_ERASE, -1};\n\tconst int efi_idx[8] = { /* internal EF used for RSA keys */\n\t\tSC_AC_OP_READ, SC_AC_OP_ERASE, SC_AC_OP_UPDATE,\n\t\tSC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE,\n\t\t-1, SC_AC_OP_ERASE, -1};\n\n\tu8\t\tbValue;\n\tint\t\ti;\n\tint\t\tiKeyRef = 0;\n\tint\t\tiMethod;\n\tint\t\tiPinCount;\n\tint\t\tiOffset = 0;\n\tint\t\tiOperation;\n\tconst int*\tp_idx;\n\n\t/* Check all sub-AC definitions within the total AC */\n\twhile (len > 1) {\t\t\t\t/* minimum length = 2 */\n\t\tsize_t iACLen = buf[iOffset] & 0x0F;\n\t\tif (iACLen > len)\n\t\t\tbreak;\n\n\t\tiMethod = SC_AC_NONE;\t\t/* default no authentication required */\n\n\t\tif (buf[iOffset] & 0X80) { /* AC in adaptive coding */\n\t\t\t/* Evaluates only the command-byte, not the optional P1/P2/Option bytes */\n\t\t\tsize_t\tiParmLen = 1;\t\t\t/* command-byte is always present */\n\t\t\tsize_t\tiKeyLen = 0;\t\t\t/* Encryption key is optional */\n\n\t\t\tif (buf[iOffset] & 0x20) iKeyLen++;\n\t\t\tif (buf[iOffset+1] & 0x40) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x20) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x10) iParmLen++;\n\t\t\tif (buf[iOffset+1] & 0x08) iParmLen++;\n\n\t\t\t/* Get KeyNumber if available */\n\t\t\tif(iKeyLen) {\n\t\t\t\tint iSC;\n\t\t\t\tif (len < 1+(size_t)iACLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiSC = buf[iOffset+iACLen];\n\n\t\t\t\tswitch( (iSC>>5) & 0x03 ){\n\t\t\t\tcase 0:\n\t\t\t\t\tiMethod = SC_AC_TERM;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tiMethod = SC_AC_AUT;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\tcase 3:\n\t\t\t\t\tiMethod = SC_AC_PRO;\t\t/* secure messaging */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tiKeyRef = iSC & 0x1F;\t\t\t/* get key number */\n\t\t\t}\n\n\t\t\t/* Get PinNumber if available */\n\t\t\tif (iACLen > (1+iParmLen+iKeyLen)) { /* check via total length if pin is present */\n\t\t\t\tif (len < 1+1+1+(size_t)iParmLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiKeyRef = buf[iOffset+1+1+iParmLen]; /* PTL + AM-header + parameter-bytes */\n\t\t\t\tiMethod = SC_AC_CHV;\n\t\t\t}\n\n\t\t\t/* Convert SETCOS command to OpenSC command group */\n\t\t\tif (len < 1+2)\n\t\t\t\tbreak;\n\t\t\tswitch(buf[iOffset+2]){\n\t\t\tcase 0x2A:\t\t\t/* crypto operation */\n\t\t\t\tiOperation = SC_AC_OP_CRYPTO;\n\t\t\t\tbreak;\n\t\t\tcase 0x46:\t\t\t/* key-generation operation */\n\t\t\t\tiOperation = SC_AC_OP_UPDATE;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tiOperation = SC_AC_OP_SELECT;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsc_file_add_acl_entry(file, iOperation, iMethod, iKeyRef);\n\t\t}\n\t\telse { /* AC in simple coding */\n\t\t\t /* Initial AC is treated as an operational AC */\n\n\t\t\t/* Get specific Cmd groups for specified file-type */\n\t\t\tswitch (file->type) {\n\t\t\tcase SC_FILE_TYPE_DF: /* DF */\n\t\t\t\tp_idx = df_idx;\n\t\t\t\tbreak;\n\t\t\tcase SC_FILE_TYPE_INTERNAL_EF: /* EF for RSA keys */\n\t\t\t\tp_idx = efi_idx;\n\t\t\t\tbreak;\n\t\t\tdefault: /* EF */\n\t\t\t\tp_idx = ef_idx;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t/* Encryption key present ? */\n\t\t\tiPinCount = iACLen > 0 ? iACLen - 1 : 0;\n\n\t\t\tif (buf[iOffset] & 0x20) {\n\t\t\t\tint iSC;\n\t\t\t\tif (len < 1 + (size_t)iACLen)\n\t\t\t\t\tbreak;\n\t\t\t\tiSC = buf[iOffset + iACLen];\n\n\t\t\t\tswitch( (iSC>>5) & 0x03 ) {\n\t\t\t\tcase 0:\n\t\t\t\t\tiMethod = SC_AC_TERM;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tiMethod = SC_AC_AUT;\t\t/* key authentication */\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\tcase 3:\n\t\t\t\t\tiMethod = SC_AC_PRO;\t\t/* secure messaging */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tiKeyRef = iSC & 0x1F;\t\t\t/* get key number */\n\n\t\t\t\tiPinCount--;\t\t\t\t/* one byte used for keyReference */\n\t\t\t}\n\n\t\t\t/* Pin present ? */\n\t\t\tif ( iPinCount > 0 ) {\n\t\t\t\tif (len < 1 + 2)\n\t\t\t\t\tbreak;\n\t\t\t\tiKeyRef = buf[iOffset + 2];\t/* pin ref */\n\t\t\t\tiMethod = SC_AC_CHV;\n\t\t\t}\n\n\t\t\t/* Add AC for each command-operationType into OpenSc structure */\n\t\t\tbValue = buf[iOffset + 1];\n\t\t\tfor (i = 0; i < 8; i++) {\n\t\t\t\tif((bValue & 1) && (p_idx[i] >= 0))\n\t\t\t\t\tsc_file_add_acl_entry(file, p_idx[i], iMethod, iKeyRef);\n\t\t\t\tbValue >>= 1;\n\t\t\t}\n\t\t}\n\t\t/* Current field treated, get next AC sub-field */\n\t\tiOffset += iACLen +1;\t\t/* AC + PTL-byte */\n\t\tlen -= iACLen +1;\n\t}\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"parse_sec_attr_44","file_name":"src/libopensc/card-setcos.c","commit_link":"github.com/OpenSC/OpenSC/commit/c3f23b836e5a1766c36617fe1da30d22f7b63de2","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#11-01598c77f374","input":"do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,\n int swap, uint32_t namesz, uint32_t descsz,\n size_t noff, size_t doff, int *flags, size_t size, int clazz)\n{\n#ifdef ELFCORE\n\tint os_style = -1;\n\t/*\n\t * Sigh. The 2.0.36 kernel in Debian 2.1, at\n\t * least, doesn't correctly implement name\n\t * sections, in core dumps, as specified by\n\t * the \"Program Linking\" section of \"UNIX(R) System\n\t * V Release 4 Programmer's Guide: ANSI C and\n\t * Programming Support Tools\", because my copy\n\t * clearly says \"The first 'namesz' bytes in 'name'\n\t * contain a *null-terminated* [emphasis mine]\n\t * character representation of the entry's owner\n\t * or originator\", but the 2.0.36 kernel code\n\t * doesn't include the terminating null in the\n\t * name....\n\t */\n\tif ((namesz == 4 && strncmp((char *)&nbuf[noff], \"CORE\", 4) == 0) ||\n\t (namesz == 5 && strcmp((char *)&nbuf[noff], \"CORE\") == 0)) {\n\t\tos_style = OS_STYLE_SVR4;\n\t} \n\n\tif ((namesz == 8 && strcmp((char *)&nbuf[noff], \"FreeBSD\") == 0)) {\n\t\tos_style = OS_STYLE_FREEBSD;\n\t}\n\n\tif ((namesz >= 11 && strncmp((char *)&nbuf[noff], \"NetBSD-CORE\", 11)\n\t == 0)) {\n\t\tos_style = OS_STYLE_NETBSD;\n\t}\n\n\tif (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {\n\t\tif (file_printf(ms, \", %s-style\", os_style_names[os_style])\n\t\t == -1)\n\t\t\treturn 1;\n\t\t*flags |= FLAGS_DID_CORE_STYLE;\n\t\t*flags |= os_style;\n\t}\n\n\tswitch (os_style) {\n\tcase OS_STYLE_NETBSD:\n\t\tif (type == NT_NETBSD_CORE_PROCINFO) {\n\t\t\tchar sbuf[512];\n\t\t\tstruct NetBSD_elfcore_procinfo pi;\n\t\t\tmemset(&pi, 0, sizeof(pi));\n\t\t\tmemcpy(&pi, nbuf + doff, descsz);\n\n\t\t\tif (file_printf(ms, \", from '%.31s', pid=%u, uid=%u, \"\n\t\t\t \"gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)\",\n\t\t\t file_printable(sbuf, sizeof(sbuf),\n\t\t\t CAST(char *, pi.cpi_name)),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_pid),\n\t\t\t elf_getu32(swap, pi.cpi_euid),\n\t\t\t elf_getu32(swap, pi.cpi_egid),\n\t\t\t elf_getu32(swap, pi.cpi_nlwps),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_siglwp),\n\t\t\t elf_getu32(swap, pi.cpi_signo),\n\t\t\t elf_getu32(swap, pi.cpi_sigcode)) == -1)\n\t\t\t\treturn 1;\n\n\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\treturn 1;\n\t\t}\n\t\tbreak;\n\n\tdefault:\n\t\tif (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {\n\t\t\tsize_t i, j;\n\t\t\tunsigned char c;\n\t\t\t/*\n\t\t\t * Extract the program name. We assume\n\t\t\t * it to be 16 characters (that's what it\n\t\t\t * is in SunOS 5.x and Linux).\n\t\t\t *\n\t\t\t * Unfortunately, it's at a different offset\n\t\t\t * in various OSes, so try multiple offsets.\n\t\t\t * If the characters aren't all printable,\n\t\t\t * reject it.\n\t\t\t */\n\t\t\tfor (i = 0; i < NOFFSETS; i++) {\n\t\t\t\tunsigned char *cname, *cp;\n\t\t\t\tsize_t reloffset = prpsoffsets(i);\n\t\t\t\tsize_t noffset = doff + reloffset;\n\t\t\t\tsize_t k;\n\t\t\t\tfor (j = 0; j < 16; j++, noffset++,\n\t\t\t\t reloffset++) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the buffer; if\n\t\t\t\t\t * we are, just give up.\n\t\t\t\t\t */\n\t\t\t\t\tif (noffset >= size)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the contents;\n\t\t\t\t\t * if we are, this obviously\n\t\t\t\t\t * isn't the right offset.\n\t\t\t\t\t */\n\t\t\t\t\tif (reloffset >= descsz)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\tc = nbuf[noffset];\n\t\t\t\t\tif (c == '\\0') {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A '\\0' at the\n\t\t\t\t\t\t * beginning is\n\t\t\t\t\t\t * obviously wrong.\n\t\t\t\t\t\t * Any other '\\0'\n\t\t\t\t\t\t * means we're done.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (j == 0)\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A nonprintable\n\t\t\t\t\t\t * character is also\n\t\t\t\t\t\t * wrong.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (!isprint(c) || isquote(c))\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Well, that worked.\n\t\t\t\t */\n\n\t\t\t\t/*\n\t\t\t\t * Try next offsets, in case this match is\n\t\t\t\t * in the middle of a string.\n\t\t\t\t */\n\t\t\t\tfor (k = i + 1 ; k < NOFFSETS; k++) {\n\t\t\t\t\tsize_t no;\n\t\t\t\t\tint adjust = 1;\n\t\t\t\t\tif (prpsoffsets(k) >= prpsoffsets(i))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tfor (no = doff + prpsoffsets(k);\n\t\t\t\t\t no < doff + prpsoffsets(i); no++)\n\t\t\t\t\t\tadjust = adjust\n\t\t\t\t\t\t && isprint(nbuf[no]);\n\t\t\t\t\tif (adjust)\n\t\t\t\t\t\ti = k;\n\t\t\t\t}\n\n\t\t\t\tcname = (unsigned char *)\n\t\t\t\t &nbuf[doff + prpsoffsets(i)];\n\t\t\t\tfor (cp = cname; *cp && isprint(*cp); cp++)\n\t\t\t\t\tcontinue;\n\t\t\t\t/*\n\t\t\t\t * Linux apparently appends a space at the end\n\t\t\t\t * of the command line: remove it.\n\t\t\t\t */\n\t\t\t\twhile (cp > cname && isspace(cp[-1]))\n\t\t\t\t\tcp--;\n\t\t\t\tif (file_printf(ms, \", from '%.*s'\",\n\t\t\t\t (int)(cp - cname), cname) == -1)\n\t\t\t\t\treturn 1;\n\t\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\t\treturn 1;\n\n\t\t\ttryanother:\n\t\t\t\t;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n#endif\n\treturn 0;\n}","target":"do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,\n int swap, uint32_t namesz, uint32_t descsz,\n size_t noff, size_t doff, int *flags, size_t size, int clazz)\n{\n#ifdef ELFCORE\n\tint os_style = -1;\n\t/*\n\t * Sigh. The 2.0.36 kernel in Debian 2.1, at\n\t * least, doesn't correctly implement name\n\t * sections, in core dumps, as specified by\n\t * the \"Program Linking\" section of \"UNIX(R) System\n\t * V Release 4 Programmer's Guide: ANSI C and\n\t * Programming Support Tools\", because my copy\n\t * clearly says \"The first 'namesz' bytes in 'name'\n\t * contain a *null-terminated* [emphasis mine]\n\t * character representation of the entry's owner\n\t * or originator\", but the 2.0.36 kernel code\n\t * doesn't include the terminating null in the\n\t * name....\n\t */\n\tif ((namesz == 4 && strncmp((char *)&nbuf[noff], \"CORE\", 4) == 0) ||\n\t (namesz == 5 && strcmp((char *)&nbuf[noff], \"CORE\") == 0)) {\n\t\tos_style = OS_STYLE_SVR4;\n\t} \n\n\tif ((namesz == 8 && strcmp((char *)&nbuf[noff], \"FreeBSD\") == 0)) {\n\t\tos_style = OS_STYLE_FREEBSD;\n\t}\n\n\tif ((namesz >= 11 && strncmp((char *)&nbuf[noff], \"NetBSD-CORE\", 11)\n\t == 0)) {\n\t\tos_style = OS_STYLE_NETBSD;\n\t}\n\n\tif (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {\n\t\tif (file_printf(ms, \", %s-style\", os_style_names[os_style])\n\t\t == -1)\n\t\t\treturn 1;\n\t\t*flags |= FLAGS_DID_CORE_STYLE;\n\t\t*flags |= os_style;\n\t}\n\n\tswitch (os_style) {\n\tcase OS_STYLE_NETBSD:\n\t\tif (type == NT_NETBSD_CORE_PROCINFO) {\n\t\t\tchar sbuf[512];\n\t\t\tstruct NetBSD_elfcore_procinfo pi;\n\t\t\tmemset(&pi, 0, sizeof(pi));\n\t\t\tmemcpy(&pi, nbuf + doff, descsz);\n\n\t\t\tif (file_printf(ms, \", from '%.31s', pid=%u, uid=%u, \"\n\t\t\t \"gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)\",\n\t\t\t file_printable(sbuf, sizeof(sbuf),\n\t\t\t CAST(char *, pi.cpi_name)),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_pid),\n\t\t\t elf_getu32(swap, pi.cpi_euid),\n\t\t\t elf_getu32(swap, pi.cpi_egid),\n\t\t\t elf_getu32(swap, pi.cpi_nlwps),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_siglwp),\n\t\t\t elf_getu32(swap, pi.cpi_signo),\n\t\t\t elf_getu32(swap, pi.cpi_sigcode)) == -1)\n\t\t\t\treturn 1;\n\n\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\treturn 1;\n\t\t}\n\t\tbreak;\n\n\tdefault:\n\t\tif (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {\n\t\t\tsize_t i, j;\n\t\t\tunsigned char c;\n\t\t\t/*\n\t\t\t * Extract the program name. We assume\n\t\t\t * it to be 16 characters (that's what it\n\t\t\t * is in SunOS 5.x and Linux).\n\t\t\t *\n\t\t\t * Unfortunately, it's at a different offset\n\t\t\t * in various OSes, so try multiple offsets.\n\t\t\t * If the characters aren't all printable,\n\t\t\t * reject it.\n\t\t\t */\n\t\t\tfor (i = 0; i < NOFFSETS; i++) {\n\t\t\t\tunsigned char *cname, *cp;\n\t\t\t\tsize_t reloffset = prpsoffsets(i);\n\t\t\t\tsize_t noffset = doff + reloffset;\n\t\t\t\tsize_t k;\n\t\t\t\tfor (j = 0; j < 16; j++, noffset++,\n\t\t\t\t reloffset++) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the buffer; if\n\t\t\t\t\t * we are, just give up.\n\t\t\t\t\t */\n\t\t\t\t\tif (noffset >= size)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the contents;\n\t\t\t\t\t * if we are, this obviously\n\t\t\t\t\t * isn't the right offset.\n\t\t\t\t\t */\n\t\t\t\t\tif (reloffset >= descsz)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\tc = nbuf[noffset];\n\t\t\t\t\tif (c == '\\0') {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A '\\0' at the\n\t\t\t\t\t\t * beginning is\n\t\t\t\t\t\t * obviously wrong.\n\t\t\t\t\t\t * Any other '\\0'\n\t\t\t\t\t\t * means we're done.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (j == 0)\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A nonprintable\n\t\t\t\t\t\t * character is also\n\t\t\t\t\t\t * wrong.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (!isprint(c) || isquote(c))\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Well, that worked.\n\t\t\t\t */\n\n\t\t\t\t/*\n\t\t\t\t * Try next offsets, in case this match is\n\t\t\t\t * in the middle of a string.\n\t\t\t\t */\n\t\t\t\tfor (k = i + 1 ; k < NOFFSETS; k++) {\n\t\t\t\t\tsize_t no;\n\t\t\t\t\tint adjust = 1;\n\t\t\t\t\tif (prpsoffsets(k) >= prpsoffsets(i))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tfor (no = doff + prpsoffsets(k);\n\t\t\t\t\t no < doff + prpsoffsets(i); no++)\n\t\t\t\t\t\tadjust = adjust\n\t\t\t\t\t\t && isprint(nbuf[no]);\n\t\t\t\t\tif (adjust)\n\t\t\t\t\t\ti = k;\n\t\t\t\t}\n\n\t\t\t\tcname = (unsigned char *)\n\t\t\t\t &nbuf[doff + prpsoffsets(i)];\n\t\t\t\tfor (cp = cname; cp < nbuf + size && *cp\n\t\t\t\t && isprint(*cp); cp++)\n\t\t\t\t\tcontinue;\n\t\t\t\t/*\n\t\t\t\t * Linux apparently appends a space at the end\n\t\t\t\t * of the command line: remove it.\n\t\t\t\t */\n\t\t\t\twhile (cp > cname && isspace(cp[-1]))\n\t\t\t\t\tcp--;\n\t\t\t\tif (file_printf(ms, \", from '%.*s'\",\n\t\t\t\t (int)(cp - cname), cname) == -1)\n\t\t\t\t\treturn 1;\n\t\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\t\treturn 1;\n\n\t\t\ttryanother:\n\t\t\t\t;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n#endif\n\treturn 0;\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"do_core_note","file_name":"src/readelf.c","commit_link":"github.com/file/file/commit/a642587a9c9e2dd7feacdf513c3643ce26ad3c22","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#12-28ae63503698","input":"gst_asf_demux_process_ext_content_desc (GstASFDemux * demux, guint8 * data,\n guint64 size)\n{\n /* Other known (and unused) 'text/unicode' metadata available :\n *\n * WM/Lyrics =\n * WM/MediaPrimaryClassID = {D1607DBC-E323-4BE2-86A1-48A42A28441E}\n * WMFSDKVersion = 9.00.00.2980\n * WMFSDKNeeded = 0.0.0.0000\n * WM/UniqueFileIdentifier = AMGa_id=R 15334;AMGp_id=P 5149;AMGt_id=T 2324984\n * WM/Publisher = 4AD\n * WM/Provider = AMG\n * WM/ProviderRating = 8\n * WM/ProviderStyle = Rock (similar to WM/Genre)\n * WM/GenreID (similar to WM/Genre)\n * WM/TrackNumber (same as WM/Track but as a string)\n *\n * Other known (and unused) 'non-text' metadata available :\n *\n * WM/EncodingTime\n * WM/MCDI\n * IsVBR\n *\n * We might want to read WM/TrackNumber and use atoi() if we don't have\n * WM/Track\n */\n\n GstTagList *taglist;\n guint16 blockcount, i;\n gboolean content3D = FALSE;\n\n struct\n {\n const gchar *interleave_name;\n GstASF3DMode interleaving_type;\n } stereoscopic_layout_map[] = {\n {\n \"SideBySideRF\", GST_ASF_3D_SIDE_BY_SIDE_HALF_RL}, {\n \"SideBySideLF\", GST_ASF_3D_SIDE_BY_SIDE_HALF_LR}, {\n \"OverUnderRT\", GST_ASF_3D_TOP_AND_BOTTOM_HALF_RL}, {\n \"OverUnderLT\", GST_ASF_3D_TOP_AND_BOTTOM_HALF_LR}, {\n \"DualStream\", GST_ASF_3D_DUAL_STREAM}\n };\n GST_INFO_OBJECT (demux, \"object is an extended content description\");\n\n taglist = gst_tag_list_new_empty ();\n\n /* Content Descriptor Count */\n if (size < 2)\n goto not_enough_data;\n\n blockcount = gst_asf_demux_get_uint16 (&data, &size);\n\n for (i = 1; i <= blockcount; ++i) {\n const gchar *gst_tag_name;\n guint16 datatype;\n guint16 value_len;\n guint16 name_len;\n GValue tag_value = { 0, };\n gsize in, out;\n gchar *name;\n gchar *name_utf8 = NULL;\n gchar *value;\n\n /* Descriptor */\n if (!gst_asf_demux_get_string (&name, &name_len, &data, &size))\n goto not_enough_data;\n\n if (size < 2) {\n g_free (name);\n goto not_enough_data;\n }\n /* Descriptor Value Data Type */\n datatype = gst_asf_demux_get_uint16 (&data, &size);\n\n /* Descriptor Value (not really a string, but same thing reading-wise) */\n if (!gst_asf_demux_get_string (&value, &value_len, &data, &size)) {\n g_free (name);\n goto not_enough_data;\n }\n\n name_utf8 =\n g_convert (name, name_len, \"UTF-8\", \"UTF-16LE\", &in, &out, NULL);\n\n if (name_utf8 != NULL) {\n GST_DEBUG (\"Found tag/metadata %s\", name_utf8);\n\n gst_tag_name = gst_asf_demux_get_gst_tag_from_tag_name (name_utf8);\n GST_DEBUG (\"gst_tag_name %s\", GST_STR_NULL (gst_tag_name));\n\n switch (datatype) {\n case ASF_DEMUX_DATA_TYPE_UTF16LE_STRING:{\n gchar *value_utf8;\n\n value_utf8 = g_convert (value, value_len, \"UTF-8\", \"UTF-16LE\",\n &in, &out, NULL);\n\n /* get rid of tags with empty value */\n if (value_utf8 != NULL && *value_utf8 != '\\0') {\n GST_DEBUG (\"string value %s\", value_utf8);\n\n value_utf8[out] = '\\0';\n\n if (gst_tag_name != NULL) {\n if (strcmp (gst_tag_name, GST_TAG_DATE_TIME) == 0) {\n guint year = atoi (value_utf8);\n\n if (year > 0) {\n g_value_init (&tag_value, GST_TYPE_DATE_TIME);\n g_value_take_boxed (&tag_value, gst_date_time_new_y (year));\n }\n } else if (strcmp (gst_tag_name, GST_TAG_GENRE) == 0) {\n guint id3v1_genre_id;\n const gchar *genre_str;\n\n if (sscanf (value_utf8, \"(%u)\", &id3v1_genre_id) == 1 &&\n ((genre_str = gst_tag_id3_genre_get (id3v1_genre_id)))) {\n GST_DEBUG (\"Genre: %s -> %s\", value_utf8, genre_str);\n g_free (value_utf8);\n value_utf8 = g_strdup (genre_str);\n }\n } else {\n GType tag_type;\n\n /* convert tag from string to other type if required */\n tag_type = gst_tag_get_type (gst_tag_name);\n g_value_init (&tag_value, tag_type);\n if (!gst_value_deserialize (&tag_value, value_utf8)) {\n GValue from_val = { 0, };\n\n g_value_init (&from_val, G_TYPE_STRING);\n g_value_set_string (&from_val, value_utf8);\n if (!g_value_transform (&from_val, &tag_value)) {\n GST_WARNING_OBJECT (demux,\n \"Could not transform string tag to \" \"%s tag type %s\",\n gst_tag_name, g_type_name (tag_type));\n g_value_unset (&tag_value);\n }\n g_value_unset (&from_val);\n }\n }\n } else {\n /* metadata ! */\n GST_DEBUG (\"Setting metadata\");\n g_value_init (&tag_value, G_TYPE_STRING);\n g_value_set_string (&tag_value, value_utf8);\n /* If we found a stereoscopic marker, look for StereoscopicLayout\n * metadata */\n if (content3D) {\n guint i;\n if (strncmp (\"StereoscopicLayout\", name_utf8,\n strlen (name_utf8)) == 0) {\n for (i = 0; i < G_N_ELEMENTS (stereoscopic_layout_map); i++) {\n if (g_str_equal (stereoscopic_layout_map[i].interleave_name,\n value_utf8)) {\n demux->asf_3D_mode =\n stereoscopic_layout_map[i].interleaving_type;\n GST_INFO (\"find interleave type %u\", demux->asf_3D_mode);\n }\n }\n }\n GST_INFO_OBJECT (demux, \"3d type is %u\", demux->asf_3D_mode);\n } else {\n demux->asf_3D_mode = GST_ASF_3D_NONE;\n GST_INFO_OBJECT (demux, \"None 3d type\");\n }\n }\n } else if (value_utf8 == NULL) {\n GST_WARNING (\"Failed to convert string value to UTF8, skipping\");\n } else {\n GST_DEBUG (\"Skipping empty string value for %s\",\n GST_STR_NULL (gst_tag_name));\n }\n g_free (value_utf8);\n break;\n }\n case ASF_DEMUX_DATA_TYPE_BYTE_ARRAY:{\n if (gst_tag_name) {\n if (!g_str_equal (gst_tag_name, GST_TAG_IMAGE)) {\n GST_FIXME (\"Unhandled byte array tag %s\",\n GST_STR_NULL (gst_tag_name));\n break;\n } else {\n asf_demux_parse_picture_tag (taglist, (guint8 *) value,\n value_len);\n }\n }\n break;\n }\n case ASF_DEMUX_DATA_TYPE_DWORD:{\n guint uint_val = GST_READ_UINT32_LE (value);\n\n /* this is the track number */\n g_value_init (&tag_value, G_TYPE_UINT);\n\n /* WM/Track counts from 0 */\n if (!strcmp (name_utf8, \"WM/Track\"))\n ++uint_val;\n\n g_value_set_uint (&tag_value, uint_val);\n break;\n }\n /* Detect 3D */\n case ASF_DEMUX_DATA_TYPE_BOOL:{\n gboolean bool_val = GST_READ_UINT32_LE (value);\n\n if (strncmp (\"Stereoscopic\", name_utf8, strlen (name_utf8)) == 0) {\n if (bool_val) {\n GST_INFO_OBJECT (demux, \"This is 3D contents\");\n content3D = TRUE;\n } else {\n GST_INFO_OBJECT (demux, \"This is not 3D contenst\");\n content3D = FALSE;\n }\n }\n\n break;\n }\n default:{\n GST_DEBUG (\"Skipping tag %s of type %d\", gst_tag_name, datatype);\n break;\n }\n }\n\n if (G_IS_VALUE (&tag_value)) {\n if (gst_tag_name) {\n GstTagMergeMode merge_mode = GST_TAG_MERGE_APPEND;\n\n /* WM/TrackNumber is more reliable than WM/Track, since the latter\n * is supposed to have a 0 base but is often wrongly written to start\n * from 1 as well, so prefer WM/TrackNumber when we have it: either\n * replace the value added earlier from WM/Track or put it first in\n * the list, so that it will get picked up by _get_uint() */\n if (strcmp (name_utf8, \"WM/TrackNumber\") == 0)\n merge_mode = GST_TAG_MERGE_REPLACE;\n\n gst_tag_list_add_values (taglist, merge_mode, gst_tag_name,\n &tag_value, NULL);\n } else {\n GST_DEBUG (\"Setting global metadata %s\", name_utf8);\n gst_structure_set_value (demux->global_metadata, name_utf8,\n &tag_value);\n }\n\n g_value_unset (&tag_value);\n }\n }\n\n g_free (name);\n g_free (value);\n g_free (name_utf8);\n }\n\n gst_asf_demux_add_global_tags (demux, taglist);\n\n return GST_FLOW_OK;\n\n /* Errors */\nnot_enough_data:\n {\n GST_WARNING (\"Unexpected end of data parsing ext content desc object\");\n gst_tag_list_unref (taglist);\n return GST_FLOW_OK; /* not really fatal */\n }\n}","target":"gst_asf_demux_process_ext_content_desc (GstASFDemux * demux, guint8 * data,\n guint64 size)\n{\n /* Other known (and unused) 'text/unicode' metadata available :\n *\n * WM/Lyrics =\n * WM/MediaPrimaryClassID = {D1607DBC-E323-4BE2-86A1-48A42A28441E}\n * WMFSDKVersion = 9.00.00.2980\n * WMFSDKNeeded = 0.0.0.0000\n * WM/UniqueFileIdentifier = AMGa_id=R 15334;AMGp_id=P 5149;AMGt_id=T 2324984\n * WM/Publisher = 4AD\n * WM/Provider = AMG\n * WM/ProviderRating = 8\n * WM/ProviderStyle = Rock (similar to WM/Genre)\n * WM/GenreID (similar to WM/Genre)\n * WM/TrackNumber (same as WM/Track but as a string)\n *\n * Other known (and unused) 'non-text' metadata available :\n *\n * WM/EncodingTime\n * WM/MCDI\n * IsVBR\n *\n * We might want to read WM/TrackNumber and use atoi() if we don't have\n * WM/Track\n */\n\n GstTagList *taglist;\n guint16 blockcount, i;\n gboolean content3D = FALSE;\n\n struct\n {\n const gchar *interleave_name;\n GstASF3DMode interleaving_type;\n } stereoscopic_layout_map[] = {\n {\n \"SideBySideRF\", GST_ASF_3D_SIDE_BY_SIDE_HALF_RL}, {\n \"SideBySideLF\", GST_ASF_3D_SIDE_BY_SIDE_HALF_LR}, {\n \"OverUnderRT\", GST_ASF_3D_TOP_AND_BOTTOM_HALF_RL}, {\n \"OverUnderLT\", GST_ASF_3D_TOP_AND_BOTTOM_HALF_LR}, {\n \"DualStream\", GST_ASF_3D_DUAL_STREAM}\n };\n GST_INFO_OBJECT (demux, \"object is an extended content description\");\n\n taglist = gst_tag_list_new_empty ();\n\n /* Content Descriptor Count */\n if (size < 2)\n goto not_enough_data;\n\n blockcount = gst_asf_demux_get_uint16 (&data, &size);\n\n for (i = 1; i <= blockcount; ++i) {\n const gchar *gst_tag_name;\n guint16 datatype;\n guint16 value_len;\n guint16 name_len;\n GValue tag_value = { 0, };\n gsize in, out;\n gchar *name;\n gchar *name_utf8 = NULL;\n gchar *value;\n\n /* Descriptor */\n if (!gst_asf_demux_get_string (&name, &name_len, &data, &size))\n goto not_enough_data;\n\n if (size < 2) {\n g_free (name);\n goto not_enough_data;\n }\n /* Descriptor Value Data Type */\n datatype = gst_asf_demux_get_uint16 (&data, &size);\n\n /* Descriptor Value (not really a string, but same thing reading-wise) */\n if (!gst_asf_demux_get_string (&value, &value_len, &data, &size)) {\n g_free (name);\n goto not_enough_data;\n }\n\n name_utf8 =\n g_convert (name, name_len, \"UTF-8\", \"UTF-16LE\", &in, &out, NULL);\n\n if (name_utf8 != NULL) {\n GST_DEBUG (\"Found tag/metadata %s\", name_utf8);\n\n gst_tag_name = gst_asf_demux_get_gst_tag_from_tag_name (name_utf8);\n GST_DEBUG (\"gst_tag_name %s\", GST_STR_NULL (gst_tag_name));\n\n switch (datatype) {\n case ASF_DEMUX_DATA_TYPE_UTF16LE_STRING:{\n gchar *value_utf8;\n\n value_utf8 = g_convert (value, value_len, \"UTF-8\", \"UTF-16LE\",\n &in, &out, NULL);\n\n /* get rid of tags with empty value */\n if (value_utf8 != NULL && *value_utf8 != '\\0') {\n GST_DEBUG (\"string value %s\", value_utf8);\n\n value_utf8[out] = '\\0';\n\n if (gst_tag_name != NULL) {\n if (strcmp (gst_tag_name, GST_TAG_DATE_TIME) == 0) {\n guint year = atoi (value_utf8);\n\n if (year > 0) {\n g_value_init (&tag_value, GST_TYPE_DATE_TIME);\n g_value_take_boxed (&tag_value, gst_date_time_new_y (year));\n }\n } else if (strcmp (gst_tag_name, GST_TAG_GENRE) == 0) {\n guint id3v1_genre_id;\n const gchar *genre_str;\n\n if (sscanf (value_utf8, \"(%u)\", &id3v1_genre_id) == 1 &&\n ((genre_str = gst_tag_id3_genre_get (id3v1_genre_id)))) {\n GST_DEBUG (\"Genre: %s -> %s\", value_utf8, genre_str);\n g_free (value_utf8);\n value_utf8 = g_strdup (genre_str);\n }\n } else {\n GType tag_type;\n\n /* convert tag from string to other type if required */\n tag_type = gst_tag_get_type (gst_tag_name);\n g_value_init (&tag_value, tag_type);\n if (!gst_value_deserialize (&tag_value, value_utf8)) {\n GValue from_val = { 0, };\n\n g_value_init (&from_val, G_TYPE_STRING);\n g_value_set_string (&from_val, value_utf8);\n if (!g_value_transform (&from_val, &tag_value)) {\n GST_WARNING_OBJECT (demux,\n \"Could not transform string tag to \" \"%s tag type %s\",\n gst_tag_name, g_type_name (tag_type));\n g_value_unset (&tag_value);\n }\n g_value_unset (&from_val);\n }\n }\n } else {\n /* metadata ! */\n GST_DEBUG (\"Setting metadata\");\n g_value_init (&tag_value, G_TYPE_STRING);\n g_value_set_string (&tag_value, value_utf8);\n /* If we found a stereoscopic marker, look for StereoscopicLayout\n * metadata */\n if (content3D) {\n guint i;\n if (strncmp (\"StereoscopicLayout\", name_utf8,\n strlen (name_utf8)) == 0) {\n for (i = 0; i < G_N_ELEMENTS (stereoscopic_layout_map); i++) {\n if (g_str_equal (stereoscopic_layout_map[i].interleave_name,\n value_utf8)) {\n demux->asf_3D_mode =\n stereoscopic_layout_map[i].interleaving_type;\n GST_INFO (\"find interleave type %u\", demux->asf_3D_mode);\n }\n }\n }\n GST_INFO_OBJECT (demux, \"3d type is %u\", demux->asf_3D_mode);\n } else {\n demux->asf_3D_mode = GST_ASF_3D_NONE;\n GST_INFO_OBJECT (demux, \"None 3d type\");\n }\n }\n } else if (value_utf8 == NULL) {\n GST_WARNING (\"Failed to convert string value to UTF8, skipping\");\n } else {\n GST_DEBUG (\"Skipping empty string value for %s\",\n GST_STR_NULL (gst_tag_name));\n }\n g_free (value_utf8);\n break;\n }\n case ASF_DEMUX_DATA_TYPE_BYTE_ARRAY:{\n if (gst_tag_name) {\n if (!g_str_equal (gst_tag_name, GST_TAG_IMAGE)) {\n GST_FIXME (\"Unhandled byte array tag %s\",\n GST_STR_NULL (gst_tag_name));\n break;\n } else {\n asf_demux_parse_picture_tag (taglist, (guint8 *) value,\n value_len);\n }\n }\n break;\n }\n case ASF_DEMUX_DATA_TYPE_DWORD:{\n guint uint_val;\n\n if (value_len < 4)\n break;\n\n uint_val = GST_READ_UINT32_LE (value);\n\n /* this is the track number */\n g_value_init (&tag_value, G_TYPE_UINT);\n\n /* WM/Track counts from 0 */\n if (!strcmp (name_utf8, \"WM/Track\"))\n ++uint_val;\n\n g_value_set_uint (&tag_value, uint_val);\n break;\n }\n /* Detect 3D */\n case ASF_DEMUX_DATA_TYPE_BOOL:{\n gboolean bool_val;\n\n if (value_len < 4)\n break;\n\n bool_val = GST_READ_UINT32_LE (value);\n\n if (strncmp (\"Stereoscopic\", name_utf8, strlen (name_utf8)) == 0) {\n if (bool_val) {\n GST_INFO_OBJECT (demux, \"This is 3D contents\");\n content3D = TRUE;\n } else {\n GST_INFO_OBJECT (demux, \"This is not 3D contenst\");\n content3D = FALSE;\n }\n }\n\n break;\n }\n default:{\n GST_DEBUG (\"Skipping tag %s of type %d\", gst_tag_name, datatype);\n break;\n }\n }\n\n if (G_IS_VALUE (&tag_value)) {\n if (gst_tag_name) {\n GstTagMergeMode merge_mode = GST_TAG_MERGE_APPEND;\n\n /* WM/TrackNumber is more reliable than WM/Track, since the latter\n * is supposed to have a 0 base but is often wrongly written to start\n * from 1 as well, so prefer WM/TrackNumber when we have it: either\n * replace the value added earlier from WM/Track or put it first in\n * the list, so that it will get picked up by _get_uint() */\n if (strcmp (name_utf8, \"WM/TrackNumber\") == 0)\n merge_mode = GST_TAG_MERGE_REPLACE;\n\n gst_tag_list_add_values (taglist, merge_mode, gst_tag_name,\n &tag_value, NULL);\n } else {\n GST_DEBUG (\"Setting global metadata %s\", name_utf8);\n gst_structure_set_value (demux->global_metadata, name_utf8,\n &tag_value);\n }\n\n g_value_unset (&tag_value);\n }\n }\n\n g_free (name);\n g_free (value);\n g_free (name_utf8);\n }\n\n gst_asf_demux_add_global_tags (demux, taglist);\n\n return GST_FLOW_OK;\n\n /* Errors */\nnot_enough_data:\n {\n GST_WARNING (\"Unexpected end of data parsing ext content desc object\");\n gst_tag_list_unref (taglist);\n return GST_FLOW_OK; /* not really fatal */\n }\n}","lang":"c","vul_type":"cwe-125","sven_meta":{"func_name":"gst_asf_demux_process_ext_content_desc","file_name":"gst/asfdemux/gstasfdemux.c","commit_link":"github.com/GStreamer/gst-plugins-ugly/commit/d21017b52a585f145e8d62781bcc1c5fefc7ee37","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#13-069d7844999c","input":"ssize_t enc_untrusted_recvmsg(int sockfd, struct msghdr *msg, int flags) {\n size_t total_buffer_size = CalculateTotalMessageSize(msg);\n\n MessageWriter input;\n input.Push(sockfd);\n input.Push(msg->msg_namelen);\n input.Push(total_buffer_size);\n input.Push(msg->msg_controllen);\n input.Push(msg->msg_flags);\n input.Push(flags);\n\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kRecvMsgHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_recvmsg\", 2,\n /*match_exact_params=*/false);\n\n ssize_t result = output.next();\n int klinux_errno = output.next();\n\n // recvmsg() returns the number of characters received. On error, -1 is\n // returned, with errno set to indicate the cause of the error.\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return result;\n }\n\n auto msg_name_extent = output.next();\n // The returned |msg_namelen| should not exceed the buffer size.\n if (msg_name_extent.size() <= msg->msg_namelen) {\n msg->msg_namelen = msg_name_extent.size();\n }\n memcpy(msg->msg_name, msg_name_extent.As(), msg->msg_namelen);\n\n // A single buffer is passed from the untrusted side, copy it into the\n // scattered buffers inside the enclave.\n auto msg_iov_extent = output.next();\n size_t total_bytes = msg_iov_extent.size();\n size_t bytes_copied = 0;\n for (int i = 0; i < msg->msg_iovlen && bytes_copied < total_bytes; ++i) {\n size_t bytes_to_copy =\n std::min(msg->msg_iov[i].iov_len, total_bytes - bytes_copied);\n memcpy(msg->msg_iov[i].iov_base, msg_iov_extent.As() + bytes_copied,\n bytes_to_copy);\n bytes_copied += bytes_to_copy;\n }\n\n auto msg_control_extent = output.next();\n // The returned |msg_controllen| should not exceed the buffer size.\n if (msg_control_extent.size() <= msg->msg_controllen) {\n msg->msg_controllen = msg_control_extent.size();\n }\n memcpy(msg->msg_control, msg_control_extent.As(), msg->msg_controllen);\n\n return result;\n}","target":"ssize_t enc_untrusted_recvmsg(int sockfd, struct msghdr *msg, int flags) {\n size_t total_buffer_size = CalculateTotalMessageSize(msg);\n\n MessageWriter input;\n input.Push(sockfd);\n input.Push(msg->msg_namelen);\n input.Push(total_buffer_size);\n input.Push(msg->msg_controllen);\n input.Push(msg->msg_flags);\n input.Push(flags);\n\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kRecvMsgHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_recvmsg\", 2,\n /*match_exact_params=*/false);\n\n ssize_t result = output.next();\n int klinux_errno = output.next();\n\n // recvmsg() returns the number of characters received. On error, -1 is\n // returned, with errno set to indicate the cause of the error.\n if (result == -1) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return result;\n }\n\n if (result > total_buffer_size) {\n ::asylo::primitives::TrustedPrimitives::BestEffortAbort(\n \"enc_untrusted_recvmsg: result exceeds requested\");\n }\n\n auto msg_name_extent = output.next();\n // The returned |msg_namelen| should not exceed the buffer size.\n if (msg_name_extent.size() <= msg->msg_namelen) {\n msg->msg_namelen = msg_name_extent.size();\n }\n memcpy(msg->msg_name, msg_name_extent.As(), msg->msg_namelen);\n\n // A single buffer is passed from the untrusted side, copy it into the\n // scattered buffers inside the enclave.\n auto msg_iov_extent = output.next();\n size_t total_bytes = msg_iov_extent.size();\n size_t bytes_copied = 0;\n for (int i = 0; i < msg->msg_iovlen && bytes_copied < total_bytes; ++i) {\n size_t bytes_to_copy =\n std::min(msg->msg_iov[i].iov_len, total_bytes - bytes_copied);\n memcpy(msg->msg_iov[i].iov_base, msg_iov_extent.As() + bytes_copied,\n bytes_to_copy);\n bytes_copied += bytes_to_copy;\n }\n\n auto msg_control_extent = output.next();\n // The returned |msg_controllen| should not exceed the buffer size.\n if (msg_control_extent.size() <= msg->msg_controllen) {\n msg->msg_controllen = msg_control_extent.size();\n }\n memcpy(msg->msg_control, msg_control_extent.As(), msg->msg_controllen);\n\n return result;\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"enc_untrusted_recvmsg","file_name":"asylo/platform/host_call/trusted/host_calls.cc","commit_link":"github.com/google/asylo/commit/fa6485c5d16a7355eab047d4a44345a73bc9131e","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-125#14-a4d3f21d2cf3","input":"static Array HHVM_METHOD(Memcache, getextendedstats,\n const String& /*type*/ /* = null_string */,\n int /*slabid*/ /* = 0 */, int /*limit*/ /* = 100 */) {\n auto data = Native::data(this_);\n memcached_return_t ret;\n memcached_stat_st *stats;\n\n stats = memcached_stat(&data->m_memcache, nullptr, &ret);\n if (ret != MEMCACHED_SUCCESS) {\n return Array();\n }\n\n int server_count = memcached_server_count(&data->m_memcache);\n\n Array return_val;\n\n for (int server_id = 0; server_id < server_count; server_id++) {\n memcached_stat_st *stat;\n char stats_key[30] = {0};\n size_t key_len;\n\n LMCD_SERVER_POSITION_INSTANCE_TYPE instance =\n memcached_server_instance_by_position(&data->m_memcache, server_id);\n const char *hostname = LMCD_SERVER_HOSTNAME(instance);\n in_port_t port = LMCD_SERVER_PORT(instance);\n\n stat = stats + server_id;\n\n Array server_stats = memcache_build_stats(&data->m_memcache, stat, &ret);\n if (ret != MEMCACHED_SUCCESS) {\n continue;\n }\n\n key_len = snprintf(stats_key, sizeof(stats_key), \"%s:%d\", hostname, port);\n\n return_val.set(String(stats_key, key_len, CopyString), server_stats);\n }\n\n free(stats);\n return return_val;\n}","target":"static Array HHVM_METHOD(Memcache, getextendedstats,\n const String& /*type*/ /* = null_string */,\n int /*slabid*/ /* = 0 */, int /*limit*/ /* = 100 */) {\n auto data = Native::data(this_);\n memcached_return_t ret;\n memcached_stat_st *stats;\n\n stats = memcached_stat(&data->m_memcache, nullptr, &ret);\n if (ret != MEMCACHED_SUCCESS) {\n return Array();\n }\n\n int server_count = memcached_server_count(&data->m_memcache);\n\n Array return_val;\n\n for (int server_id = 0; server_id < server_count; server_id++) {\n memcached_stat_st *stat;\n LMCD_SERVER_POSITION_INSTANCE_TYPE instance =\n memcached_server_instance_by_position(&data->m_memcache, server_id);\n const char *hostname = LMCD_SERVER_HOSTNAME(instance);\n in_port_t port = LMCD_SERVER_PORT(instance);\n\n stat = stats + server_id;\n\n Array server_stats = memcache_build_stats(&data->m_memcache, stat, &ret);\n if (ret != MEMCACHED_SUCCESS) {\n continue;\n }\n\n auto const port_str = folly::to(port);\n auto const key_len = strlen(hostname) + 1 + port_str.length();\n auto key = String(key_len, ReserveString);\n key += hostname;\n key += \":\";\n key += port_str;\n return_val.set(key, server_stats);\n }\n\n free(stats);\n return return_val;\n}","lang":"cpp","vul_type":"cwe-125","sven_meta":{"func_name":"HPHP::HHVM_METHOD","file_name":"hphp/runtime/ext/memcache/ext_memcache.cpp","commit_link":"github.com/facebook/hhvm/commit/4bff3bfbe90d10451e4638c2118d1ad1117bb3e3","source_cwe_file":"cwe-125.jsonl"}} +{"problem_id":"cwe-078#0-0f5ffa5776ca","input":" def _get_3par_host(self, hostname):\n out = self._cli_run('showhost -verbose %s' % (hostname), None)\n LOG.debug(\"OUTPUT = \\n%s\" % (pprint.pformat(out)))\n host = {'id': None, 'name': None,\n 'domain': None,\n 'descriptors': {},\n 'iSCSIPaths': [],\n 'FCPaths': []}\n\n if out:\n err = out[0]\n if err == 'no hosts listed':\n msg = {'code': 'NON_EXISTENT_HOST',\n 'desc': \"HOST '%s' was not found\" % hostname}\n raise hpexceptions.HTTPNotFound(msg)\n\n # start parsing the lines after the header line\n for line in out[1:]:\n if line == '':\n break\n tmp = line.split(',')\n paths = {}\n\n LOG.debug(\"line = %s\" % (pprint.pformat(tmp)))\n host['id'] = tmp[0]\n host['name'] = tmp[1]\n\n portPos = tmp[4]\n LOG.debug(\"portPos = %s\" % (pprint.pformat(portPos)))\n if portPos == '---':\n portPos = None\n else:\n port = portPos.split(':')\n portPos = {'node': int(port[0]), 'slot': int(port[1]),\n 'cardPort': int(port[2])}\n\n paths['portPos'] = portPos\n\n # If FC entry\n if tmp[5] == 'n/a':\n paths['wwn'] = tmp[3]\n host['FCPaths'].append(paths)\n # else iSCSI entry\n else:\n paths['name'] = tmp[3]\n paths['ipAddr'] = tmp[5]\n host['iSCSIPaths'].append(paths)\n\n # find the offset to the description stuff\n offset = 0\n for line in out:\n if line[:15] == '---------- Host':\n break\n else:\n offset += 1\n\n info = out[offset + 2]\n tmp = info.split(':')\n host['domain'] = tmp[1]\n\n info = out[offset + 4]\n tmp = info.split(':')\n host['descriptors']['location'] = tmp[1]\n\n info = out[offset + 5]\n tmp = info.split(':')\n host['descriptors']['ipAddr'] = tmp[1]\n\n info = out[offset + 6]\n tmp = info.split(':')\n host['descriptors']['os'] = tmp[1]\n\n info = out[offset + 7]\n tmp = info.split(':')\n host['descriptors']['model'] = tmp[1]\n\n info = out[offset + 8]\n tmp = info.split(':')\n host['descriptors']['contact'] = tmp[1]\n\n info = out[offset + 9]\n tmp = info.split(':')\n host['descriptors']['comment'] = tmp[1]\n\n return host","target":" def _get_3par_host(self, hostname):\n out = self._cli_run(['showhost', '-verbose', hostname])\n LOG.debug(\"OUTPUT = \\n%s\" % (pprint.pformat(out)))\n host = {'id': None, 'name': None,\n 'domain': None,\n 'descriptors': {},\n 'iSCSIPaths': [],\n 'FCPaths': []}\n\n if out:\n err = out[0]\n if err == 'no hosts listed':\n msg = {'code': 'NON_EXISTENT_HOST',\n 'desc': \"HOST '%s' was not found\" % hostname}\n raise hpexceptions.HTTPNotFound(msg)\n\n # start parsing the lines after the header line\n for line in out[1:]:\n if line == '':\n break\n tmp = line.split(',')\n paths = {}\n\n LOG.debug(\"line = %s\" % (pprint.pformat(tmp)))\n host['id'] = tmp[0]\n host['name'] = tmp[1]\n\n portPos = tmp[4]\n LOG.debug(\"portPos = %s\" % (pprint.pformat(portPos)))\n if portPos == '---':\n portPos = None\n else:\n port = portPos.split(':')\n portPos = {'node': int(port[0]), 'slot': int(port[1]),\n 'cardPort': int(port[2])}\n\n paths['portPos'] = portPos\n\n # If FC entry\n if tmp[5] == 'n/a':\n paths['wwn'] = tmp[3]\n host['FCPaths'].append(paths)\n # else iSCSI entry\n else:\n paths['name'] = tmp[3]\n paths['ipAddr'] = tmp[5]\n host['iSCSIPaths'].append(paths)\n\n # find the offset to the description stuff\n offset = 0\n for line in out:\n if line[:15] == '---------- Host':\n break\n else:\n offset += 1\n\n info = out[offset + 2]\n tmp = info.split(':')\n host['domain'] = tmp[1]\n\n info = out[offset + 4]\n tmp = info.split(':')\n host['descriptors']['location'] = tmp[1]\n\n info = out[offset + 5]\n tmp = info.split(':')\n host['descriptors']['ipAddr'] = tmp[1]\n\n info = out[offset + 6]\n tmp = info.split(':')\n host['descriptors']['os'] = tmp[1]\n\n info = out[offset + 7]\n tmp = info.split(':')\n host['descriptors']['model'] = tmp[1]\n\n info = out[offset + 8]\n tmp = info.split(':')\n host['descriptors']['contact'] = tmp[1]\n\n info = out[offset + 9]\n tmp = info.split(':')\n host['descriptors']['comment'] = tmp[1]\n\n return host","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_3par_host","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#1-c0b43df0fd3d","input":" def _get_vdisk_attributes(self, vdisk_name):\n \"\"\"Return vdisk attributes, or None if vdisk does not exist\n\n Exception is raised if the information from system can not be\n parsed/matched to a single vdisk.\n \"\"\"\n\n ssh_cmd = 'svcinfo lsvdisk -bytes -delim ! %s ' % vdisk_name\n return self._execute_command_and_parse_attributes(ssh_cmd)","target":" def _get_vdisk_attributes(self, vdisk_name):\n \"\"\"Return vdisk attributes, or None if vdisk does not exist\n\n Exception is raised if the information from system can not be\n parsed/matched to a single vdisk.\n \"\"\"\n\n ssh_cmd = ['svcinfo', 'lsvdisk', '-bytes', '-delim', '!', vdisk_name]\n return self._execute_command_and_parse_attributes(ssh_cmd)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_vdisk_attributes","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#2-88e5cf802a30","input":"def git_hook(strict=False, modify=False):\n \"\"\"\n Git pre-commit hook to check staged files for isort errors\n\n :param bool strict - if True, return number of errors on exit,\n causing the hook to fail. If False, return zero so it will\n just act as a warning.\n :param bool modify - if True, fix the sources if they are not\n sorted properly. If False, only report result without\n modifying anything.\n\n :return number of errors if in strict mode, 0 otherwise.\n \"\"\"\n\n # Get list of files modified and staged\n diff_cmd = \"git diff-index --cached --name-only --diff-filter=ACMRTUXB HEAD\"\n files_modified = get_lines(diff_cmd)\n\n errors = 0\n for filename in files_modified:\n if filename.endswith('.py'):\n # Get the staged contents of the file\n staged_cmd = \"git show :%s\" % filename\n staged_contents = get_output(staged_cmd)\n\n sort = SortImports(\n file_path=filename,\n file_contents=staged_contents.decode(),\n check=True\n )\n\n if sort.incorrectly_sorted:\n errors += 1\n if modify:\n SortImports(\n file_path=filename,\n file_contents=staged_contents.decode(),\n check=False,\n )\n\n return errors if strict else 0","target":"def git_hook(strict=False, modify=False):\n \"\"\"\n Git pre-commit hook to check staged files for isort errors\n\n :param bool strict - if True, return number of errors on exit,\n causing the hook to fail. If False, return zero so it will\n just act as a warning.\n :param bool modify - if True, fix the sources if they are not\n sorted properly. If False, only report result without\n modifying anything.\n\n :return number of errors if in strict mode, 0 otherwise.\n \"\"\"\n\n # Get list of files modified and staged\n diff_cmd = [\"git\", \"diff-index\", \"--cached\", \"--name-only\", \"--diff-filter=ACMRTUXB HEAD\"]\n files_modified = get_lines(diff_cmd)\n\n errors = 0\n for filename in files_modified:\n if filename.endswith('.py'):\n # Get the staged contents of the file\n staged_cmd = [\"git\", \"show\", \":%s\" % filename]\n staged_contents = get_output(staged_cmd)\n\n sort = SortImports(\n file_path=filename,\n file_contents=staged_contents,\n check=True\n )\n\n if sort.incorrectly_sorted:\n errors += 1\n if modify:\n SortImports(\n file_path=filename,\n file_contents=staged_contents,\n check=False,\n )\n\n return errors if strict else 0","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"git_hook","file_name":"isort/hooks.py","commit_link":"github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#3-8035e4e0e399","input":" def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = 'showhost -verbose fakehost'\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_NO_HOST_RET), ''])\n\n create_host_cmd = ('createhost -iscsi -add fakehost '\n 'iqn.1993-08.org.debian:01:222')\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","target":" def test_create_modify_host(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_cpg\",\n self.fake_get_cpg)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"get_domain\",\n self.fake_get_domain)\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_host_cmd = ['showhost', '-verbose', 'fakehost']\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_NO_HOST_RET), ''])\n\n create_host_cmd = ['createhost', '-iscsi', '-add', 'fakehost',\n 'iqn.1993-08.org.debian:01:222']\n _run_ssh(create_host_cmd, False).AndReturn([CLI_CR, ''])\n _run_ssh(show_host_cmd, False).AndReturn([pack(ISCSI_HOST_RET), ''])\n self.mox.ReplayAll()\n\n host = self.driver._create_host(self.volume, self.connector)\n self.assertEqual(host['name'], self.FAKE_HOST)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_create_modify_host","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#4-d492b51213ce","input":" def _run_ssh(self, command, check_exit_code=True, attempts=1):\n if not self.sshpool:\n password = self.configuration.san_password\n privatekey = self.configuration.san_private_key\n min_size = self.configuration.ssh_min_pool_conn\n max_size = self.configuration.ssh_max_pool_conn\n self.sshpool = utils.SSHPool(self.configuration.san_ip,\n self.configuration.san_ssh_port,\n self.configuration.ssh_conn_timeout,\n self.configuration.san_login,\n password=password,\n privatekey=privatekey,\n min_size=min_size,\n max_size=max_size)\n last_exception = None\n try:\n total_attempts = attempts\n with self.sshpool.item() as ssh:\n while attempts > 0:\n attempts -= 1\n try:\n return utils.ssh_execute(\n ssh,\n command,\n check_exit_code=check_exit_code)\n except Exception as e:\n LOG.error(e)\n last_exception = e\n greenthread.sleep(random.randint(20, 500) / 100.0)\n try:\n raise exception.ProcessExecutionError(\n exit_code=last_exception.exit_code,\n stdout=last_exception.stdout,\n stderr=last_exception.stderr,\n cmd=last_exception.cmd)\n except AttributeError:\n raise exception.ProcessExecutionError(\n exit_code=-1,\n stdout=\"\",\n stderr=\"Error running SSH command\",\n cmd=command)\n\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error running SSH command: %s\") % command)","target":" def _run_ssh(self, cmd_list, check_exit_code=True, attempts=1):\n utils.check_ssh_injection(cmd_list)\n command = ' '. join(cmd_list)\n\n if not self.sshpool:\n password = self.configuration.san_password\n privatekey = self.configuration.san_private_key\n min_size = self.configuration.ssh_min_pool_conn\n max_size = self.configuration.ssh_max_pool_conn\n self.sshpool = utils.SSHPool(self.configuration.san_ip,\n self.configuration.san_ssh_port,\n self.configuration.ssh_conn_timeout,\n self.configuration.san_login,\n password=password,\n privatekey=privatekey,\n min_size=min_size,\n max_size=max_size)\n last_exception = None\n try:\n total_attempts = attempts\n with self.sshpool.item() as ssh:\n while attempts > 0:\n attempts -= 1\n try:\n return utils.ssh_execute(\n ssh,\n command,\n check_exit_code=check_exit_code)\n except Exception as e:\n LOG.error(e)\n last_exception = e\n greenthread.sleep(random.randint(20, 500) / 100.0)\n try:\n raise exception.ProcessExecutionError(\n exit_code=last_exception.exit_code,\n stdout=last_exception.stdout,\n stderr=last_exception.stderr,\n cmd=last_exception.cmd)\n except AttributeError:\n raise exception.ProcessExecutionError(\n exit_code=-1,\n stdout=\"\",\n stderr=\"Error running SSH command\",\n cmd=command)\n\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error(_(\"Error running SSH command: %s\") % command)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_run_ssh","file_name":"cinder/volume/drivers/san/san.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#5-181dbf70779d","input":"@app.route('/view/')\ndef view(sid):\n if '/' not in sid:\n path = os.path.join(app.config['UPLOAD_FOLDER'], sid)\n if os.path.isdir(path):\n using_firebase = 'true' if app.config['FIREBASE'] else 'false'\n return render_template('view.html',\n sid=sid, title=\"Progress for %s\" % sid, using_firebase=using_firebase)\n else:\n abort(404)\n else:\n abort(403)","target":"@app.route('/view/')\ndef view(sid):\n if utils.sid_is_valid(sid):\n path = join(app.config['UPLOAD_FOLDER'], sid)\n if os.path.isdir(path):\n using_firebase = 'true' if app.config['FIREBASE'] else 'false'\n return render_template('view.html', sid=sid,\n title=\"Progress for %s\" % sid,\n using_firebase=using_firebase)\n else:\n abort(404)\n else:\n abort(403)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"view","file_name":"app/views.py","commit_link":"github.com/cheukyin699/genset-demo-site/commit/abb55b1a6786b0a995c2cdf77a7977a1d51cfc0d","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#6-0e192cb6110d","input":"def get_title_from_youtube_url(url):\n try:\n output = str(subprocess.check_output('youtube-dl --get-title %s --no-warnings' % url, stderr=subprocess.STDOUT,\n shell=True)).strip()\n except subprocess.CalledProcessError as ex:\n output = str(ex.output).strip()\n except OSError as ex:\n output = 'youtube-dl not found: %s' % ex\n except Exception as ex:\n output = 'Something bad happened: %s' % ex\n return remove_commas_from_string(output)","target":"def get_title_from_youtube_url(url):\n try:\n output = str(subprocess.check_output(['youtube-dl', '--get-title', url, '--no-warnings'],\n stderr=subprocess.STDOUT)).strip()\n except subprocess.CalledProcessError as ex:\n output = str(ex.output).strip()\n except OSError as ex:\n output = 'youtube-dl not found: %s' % ex\n except Exception as ex:\n output = 'Something bad happened: %s' % ex\n return remove_commas_from_string(output)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"get_title_from_youtube_url","file_name":"src/util.py","commit_link":"github.com/w-martin/mindfulness/commit/62e1d5ce9deb57468cf917ce0ce838120ec84c46","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#7-35e4733721a9","input":" def test_get_ports(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = 'showport'\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = 'showport -iscsi'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = 'showport -iscsiname'\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI),\n ''])\n self.mox.ReplayAll()\n\n ports = self.driver.common.get_ports()\n self.assertEqual(ports['FC'][0], '20210002AC00383D')\n self.assertEqual(ports['iSCSI']['10.10.120.252']['nsp'], '0:8:2')","target":" def test_get_ports(self):\n self.flags(lock_path=self.tempdir)\n\n #record\n self.clear_mox()\n _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)\n self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, \"_run_ssh\", _run_ssh)\n\n show_port_cmd = ['showport']\n _run_ssh(show_port_cmd, False).AndReturn([pack(PORT_RET), ''])\n\n show_port_i_cmd = ['showport', '-iscsi']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(READY_ISCSI_PORT_RET),\n ''])\n\n show_port_i_cmd = ['showport', '-iscsiname']\n _run_ssh(show_port_i_cmd, False).AndReturn([pack(SHOW_PORT_ISCSI),\n ''])\n self.mox.ReplayAll()\n\n ports = self.driver.common.get_ports()\n self.assertEqual(ports['FC'][0], '20210002AC00383D')\n self.assertEqual(ports['iSCSI']['10.10.120.252']['nsp'], '0:8:2')","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"test_get_ports","file_name":"cinder/tests/test_hp3par.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#8-f2cfe9c45da3","input":" def _create_3par_vlun(self, volume, hostname):\n out = self._cli_run('createvlun %s auto %s' % (volume, hostname), None)\n if out and len(out) > 1:\n if \"must be in the same domain\" in out[0]:\n err = out[0].strip()\n err = err + \" \" + out[1].strip()\n raise exception.Invalid3PARDomain(err=err)","target":" def _create_3par_vlun(self, volume, hostname):\n out = self._cli_run(['createvlun', volume, 'auto', hostname])\n if out and len(out) > 1:\n if \"must be in the same domain\" in out[0]:\n err = out[0].strip()\n err = err + \" \" + out[1].strip()\n raise exception.Invalid3PARDomain(err=err)","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_create_3par_vlun","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#9-ec3e10f7a444","input":" def _set_connections(self):\n \"\"\"Set the number of concurrent connections.\n\n The 3PAR WS API server has a limit of concurrent connections.\n This is setting the number to the highest allowed, 15 connections.\n \"\"\"\n self._cli_run(\"setwsapi -sru high\", None)","target":" def _set_connections(self):\n \"\"\"Set the number of concurrent connections.\n\n The 3PAR WS API server has a limit of concurrent connections.\n This is setting the number to the highest allowed, 15 connections.\n \"\"\"\n self._cli_run(['setwsapi', '-sru', 'high'])","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_set_connections","file_name":"cinder/volume/drivers/san/hp/hp_3par_common.py","commit_link":"github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-078#10-511f80696d9d","input":" def _get_chap_secret_for_host(self, host_name):\n \"\"\"Return the CHAP secret for the given host.\"\"\"\n\n LOG.debug(_('enter: _get_chap_secret_for_host: host name %s')\n % host_name)\n\n ssh_cmd = 'svcinfo lsiscsiauth -delim !'\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return None\n\n host_lines = out.strip().split('\\n')\n self._assert_ssh_return(len(host_lines), '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('name' in header, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_auth_method' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_chap_secret' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n name_index = header.index('name')\n method_index = header.index('iscsi_auth_method')\n secret_index = header.index('iscsi_chap_secret')\n\n chap_secret = None\n host_found = False\n for line in host_lines:\n info = line.split('!')\n if info[name_index] == host_name:\n host_found = True\n if info[method_index] == 'chap':\n chap_secret = info[secret_index]\n\n self._assert_ssh_return(host_found, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n LOG.debug(_('leave: _get_chap_secret_for_host: host name '\n '%(host_name)s with secret %(chap_secret)s')\n % {'host_name': host_name, 'chap_secret': chap_secret})\n\n return chap_secret","target":" def _get_chap_secret_for_host(self, host_name):\n \"\"\"Return the CHAP secret for the given host.\"\"\"\n\n LOG.debug(_('enter: _get_chap_secret_for_host: host name %s')\n % host_name)\n\n ssh_cmd = ['svcinfo', 'lsiscsiauth', '-delim', '!']\n out, err = self._run_ssh(ssh_cmd)\n\n if not len(out.strip()):\n return None\n\n host_lines = out.strip().split('\\n')\n self._assert_ssh_return(len(host_lines), '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n header = host_lines.pop(0).split('!')\n self._assert_ssh_return('name' in header, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_auth_method' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n self._assert_ssh_return('iscsi_chap_secret' in header,\n '_get_chap_secret_for_host', ssh_cmd, out, err)\n name_index = header.index('name')\n method_index = header.index('iscsi_auth_method')\n secret_index = header.index('iscsi_chap_secret')\n\n chap_secret = None\n host_found = False\n for line in host_lines:\n info = line.split('!')\n if info[name_index] == host_name:\n host_found = True\n if info[method_index] == 'chap':\n chap_secret = info[secret_index]\n\n self._assert_ssh_return(host_found, '_get_chap_secret_for_host',\n ssh_cmd, out, err)\n\n LOG.debug(_('leave: _get_chap_secret_for_host: host name '\n '%(host_name)s with secret %(chap_secret)s')\n % {'host_name': host_name, 'chap_secret': chap_secret})\n\n return chap_secret","lang":"python","vul_type":"cwe-078","sven_meta":{"func_name":"_get_chap_secret_for_host","file_name":"cinder/volume/drivers/storwize_svc.py","commit_link":"github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4","source_cwe_file":"cwe-078.jsonl"}} +{"problem_id":"cwe-476#0-e53ee06b7cc8","input":"Status KernelAndDeviceOp::Run(\n ScopedStepContainer* step_container, const EagerKernelArgs& inputs,\n std::vector* outputs,\n CancellationManager* cancellation_manager,\n const absl::optional& remote_func_params) {\n OpKernelContext::Params params;\n params.device = device_;\n params.frame_iter = FrameAndIter(0, 0);\n params.inputs = inputs.GetTensorValues();\n params.op_kernel = kernel_.get();\n params.resource_manager = device_->resource_manager();\n params.input_alloc_attrs = &input_alloc_attrs_;\n params.output_attr_array = output_alloc_attrs_.data();\n params.function_library = flr_;\n params.slice_reader_cache = &slice_reader_cache_;\n params.rendezvous = rendezvous_;\n OpExecutionState* op_execution_state = nullptr;\n\n CancellationManager default_cancellation_manager;\n if (cancellation_manager) {\n params.cancellation_manager = cancellation_manager;\n } else if (kernel_->is_deferred()) {\n op_execution_state = new OpExecutionState;\n params.cancellation_manager = &op_execution_state->cancellation_manager;\n params.inc_num_deferred_ops_function = [op_execution_state]() {\n op_execution_state->Ref();\n };\n params.dec_num_deferred_ops_function = [op_execution_state]() {\n op_execution_state->Unref();\n };\n } else {\n params.cancellation_manager = &default_cancellation_manager;\n }\n\n params.log_memory = log_memory_;\n\n params.runner = get_runner();\n\n params.step_container =\n step_container == nullptr ? &step_container_ : step_container;\n auto step_container_cleanup = gtl::MakeCleanup([step_container, this] {\n if (step_container == nullptr) {\n this->step_container_.CleanUp();\n }\n });\n\n params.collective_executor =\n collective_executor_ ? collective_executor_->get() : nullptr;\n\n OpKernelContext context(¶ms);\n\n {\n port::ScopedFlushDenormal flush;\n port::ScopedSetRound round(FE_TONEAREST);\n // 'AnnotatedTraceMe' will trace both scheduling time on host and execution\n // time on device of the OpKernel.\n profiler::AnnotatedTraceMe activity(\n [&] { return kernel_->TraceString(context, /*verbose=*/false); },\n profiler::TraceMeLevel::kInfo);\n device_->Compute(kernel_.get(), &context);\n }\n\n // Clean up execution op_execution_state if deferred ops aren't running.\n if (op_execution_state != nullptr) {\n op_execution_state->Unref();\n }\n\n if (!context.status().ok()) return context.status();\n\n if (outputs != nullptr) {\n outputs->clear();\n for (int i = 0; i < context.num_outputs(); ++i) {\n outputs->push_back(Tensor(*context.mutable_output(i)));\n }\n }\n return Status::OK();\n}","target":"Status KernelAndDeviceOp::Run(\n ScopedStepContainer* step_container, const EagerKernelArgs& inputs,\n std::vector* outputs,\n CancellationManager* cancellation_manager,\n const absl::optional& remote_func_params) {\n OpKernelContext::Params params;\n params.device = device_;\n params.frame_iter = FrameAndIter(0, 0);\n params.inputs = inputs.GetTensorValues();\n params.op_kernel = kernel_.get();\n params.resource_manager = device_->resource_manager();\n params.input_alloc_attrs = &input_alloc_attrs_;\n params.output_attr_array = output_alloc_attrs_.data();\n params.function_library = flr_;\n params.slice_reader_cache = &slice_reader_cache_;\n params.rendezvous = rendezvous_;\n OpExecutionState* op_execution_state = nullptr;\n\n CancellationManager default_cancellation_manager;\n if (cancellation_manager) {\n params.cancellation_manager = cancellation_manager;\n } else if (kernel_->is_deferred()) {\n op_execution_state = new OpExecutionState;\n params.cancellation_manager = &op_execution_state->cancellation_manager;\n params.inc_num_deferred_ops_function = [op_execution_state]() {\n op_execution_state->Ref();\n };\n params.dec_num_deferred_ops_function = [op_execution_state]() {\n op_execution_state->Unref();\n };\n } else {\n params.cancellation_manager = &default_cancellation_manager;\n }\n\n params.log_memory = log_memory_;\n\n params.runner = get_runner();\n\n params.step_container =\n step_container == nullptr ? &step_container_ : step_container;\n auto step_container_cleanup = gtl::MakeCleanup([step_container, this] {\n if (step_container == nullptr) {\n this->step_container_.CleanUp();\n }\n });\n\n params.collective_executor =\n collective_executor_ ? collective_executor_->get() : nullptr;\n\n OpKernelContext context(¶ms);\n\n {\n port::ScopedFlushDenormal flush;\n port::ScopedSetRound round(FE_TONEAREST);\n // 'AnnotatedTraceMe' will trace both scheduling time on host and execution\n // time on device of the OpKernel.\n profiler::AnnotatedTraceMe activity(\n [&] { return kernel_->TraceString(context, /*verbose=*/false); },\n profiler::TraceMeLevel::kInfo);\n device_->Compute(kernel_.get(), &context);\n }\n\n // Clean up execution op_execution_state if deferred ops aren't running.\n if (op_execution_state != nullptr) {\n op_execution_state->Unref();\n }\n\n if (!context.status().ok()) return context.status();\n\n if (outputs != nullptr) {\n outputs->clear();\n for (int i = 0; i < context.num_outputs(); ++i) {\n const auto* output_tensor = context.mutable_output(i);\n if (output_tensor != nullptr) {\n outputs->push_back(Tensor(*output_tensor));\n } else {\n outputs->push_back(Tensor());\n }\n }\n }\n return Status::OK();\n}","lang":"cpp","vul_type":"cwe-476","sven_meta":{"func_name":"tensorflow::KernelAndDeviceOp::Run","file_name":"tensorflow/core/common_runtime/eager/kernel_and_device.cc","commit_link":"github.com/tensorflow/tensorflow/commit/da8558533d925694483d2c136a9220d6d49d843c","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#1-a95c0f6c9f72","input":"static bool check_client_passwd(PgSocket *client, const char *passwd)\n{\n\tchar md5[MD5_PASSWD_LEN + 1];\n\tconst char *correct;\n\tPgUser *user = client->auth_user;\n\n\t/* disallow empty passwords */\n\tif (!*passwd || !*user->passwd)\n\t\treturn false;\n\n\tswitch (cf_auth_type) {\n\tcase AUTH_PLAIN:\n\t\treturn strcmp(user->passwd, passwd) == 0;\n\tcase AUTH_CRYPT:\n\t\tcorrect = crypt(user->passwd, (char *)client->tmp_login_salt);\n\t\treturn correct && strcmp(correct, passwd) == 0;\n\tcase AUTH_MD5:\n\t\tif (strlen(passwd) != MD5_PASSWD_LEN)\n\t\t\treturn false;\n\t\tif (!isMD5(user->passwd))\n\t\t\tpg_md5_encrypt(user->passwd, user->name, strlen(user->name), user->passwd);\n\t\tpg_md5_encrypt(user->passwd + 3, (char *)client->tmp_login_salt, 4, md5);\n\t\treturn strcmp(md5, passwd) == 0;\n\t}\n\treturn false;\n}","target":"static bool check_client_passwd(PgSocket *client, const char *passwd)\n{\n\tchar md5[MD5_PASSWD_LEN + 1];\n\tconst char *correct;\n\tPgUser *user = client->auth_user;\n\n\t/* auth_user may be missing */\n\tif (!user) {\n\t\tslog_error(client, \"Password packet before auth packet?\");\n\t\treturn false;\n\t}\n\n\t/* disallow empty passwords */\n\tif (!*passwd || !*user->passwd)\n\t\treturn false;\n\n\tswitch (cf_auth_type) {\n\tcase AUTH_PLAIN:\n\t\treturn strcmp(user->passwd, passwd) == 0;\n\tcase AUTH_CRYPT:\n\t\tcorrect = crypt(user->passwd, (char *)client->tmp_login_salt);\n\t\treturn correct && strcmp(correct, passwd) == 0;\n\tcase AUTH_MD5:\n\t\tif (strlen(passwd) != MD5_PASSWD_LEN)\n\t\t\treturn false;\n\t\tif (!isMD5(user->passwd))\n\t\t\tpg_md5_encrypt(user->passwd, user->name, strlen(user->name), user->passwd);\n\t\tpg_md5_encrypt(user->passwd + 3, (char *)client->tmp_login_salt, 4, md5);\n\t\treturn strcmp(md5, passwd) == 0;\n\t}\n\treturn false;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"check_client_passwd","file_name":"src/client.c","commit_link":"github.com/pgbouncer/pgbouncer/commit/edab5be6665b9e8de66c25ba527509b229468573","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#2-25352d3438ce","input":"static void rds_tcp_kill_sock(struct net *net)\n{\n\tstruct rds_tcp_connection *tc, *_tc;\n\tstruct sock *sk;\n\tLIST_HEAD(tmp_list);\n\tstruct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid);\n\n\trds_tcp_listen_stop(rtn->rds_tcp_listen_sock);\n\trtn->rds_tcp_listen_sock = NULL;\n\tflush_work(&rtn->rds_tcp_accept_w);\n\tspin_lock_irq(&rds_tcp_conn_lock);\n\tlist_for_each_entry_safe(tc, _tc, &rds_tcp_conn_list, t_tcp_node) {\n\t\tstruct net *c_net = read_pnet(&tc->conn->c_net);\n\n\t\tif (net != c_net)\n\t\t\tcontinue;\n\t\tlist_move_tail(&tc->t_tcp_node, &tmp_list);\n\t}\n\tspin_unlock_irq(&rds_tcp_conn_lock);\n\tlist_for_each_entry_safe(tc, _tc, &tmp_list, t_tcp_node) {\n\t\tsk = tc->t_sock->sk;\n\t\tsk->sk_prot->disconnect(sk, 0);\n\t\ttcp_done(sk);\n\t\tif (tc->conn->c_passive)\n\t\t\trds_conn_destroy(tc->conn->c_passive);\n\t\trds_conn_destroy(tc->conn);\n\t}\n}","target":"static void rds_tcp_kill_sock(struct net *net)\n{\n\tstruct rds_tcp_connection *tc, *_tc;\n\tstruct sock *sk;\n\tLIST_HEAD(tmp_list);\n\tstruct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid);\n\n\trds_tcp_listen_stop(rtn->rds_tcp_listen_sock);\n\trtn->rds_tcp_listen_sock = NULL;\n\tflush_work(&rtn->rds_tcp_accept_w);\n\tspin_lock_irq(&rds_tcp_conn_lock);\n\tlist_for_each_entry_safe(tc, _tc, &rds_tcp_conn_list, t_tcp_node) {\n\t\tstruct net *c_net = read_pnet(&tc->conn->c_net);\n\n\t\tif (net != c_net)\n\t\t\tcontinue;\n\t\tlist_move_tail(&tc->t_tcp_node, &tmp_list);\n\t}\n\tspin_unlock_irq(&rds_tcp_conn_lock);\n\tlist_for_each_entry_safe(tc, _tc, &tmp_list, t_tcp_node) {\n\t\tif (tc->t_sock) {\n\t\t\tsk = tc->t_sock->sk;\n\t\t\tsk->sk_prot->disconnect(sk, 0);\n\t\t\ttcp_done(sk);\n\t\t}\n\t\tif (tc->conn->c_passive)\n\t\t\trds_conn_destroy(tc->conn->c_passive);\n\t\trds_conn_destroy(tc->conn);\n\t}\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"rds_tcp_kill_sock","file_name":"net/rds/tcp.c","commit_link":"github.com/torvalds/linux/commit/91573ae4aed0a49660abdad4d42f2a0db995ee5e","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#3-31eb3926843c","input":"static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n magick[14];\n\n Image\n *image;\n\n int\n foundPropEnd = 0;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n offset;\n\n register ssize_t\n i;\n\n size_t\n image_type,\n length;\n\n ssize_t\n count;\n\n XCFDocInfo\n doc_info;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n count=ReadBlob(image,14,(unsigned char *) magick);\n if ((count != 14) ||\n (LocaleNCompare((char *) magick,\"gimp xcf\",8) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n (void) ResetMagickMemory(&doc_info,0,sizeof(XCFDocInfo));\n doc_info.exception=exception;\n doc_info.width=ReadBlobMSBLong(image);\n doc_info.height=ReadBlobMSBLong(image);\n if ((doc_info.width > 262144) || (doc_info.height > 262144))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n doc_info.image_type=ReadBlobMSBLong(image);\n /*\n Initialize image attributes.\n */\n image->columns=doc_info.width;\n image->rows=doc_info.height;\n image_type=doc_info.image_type;\n doc_info.file_size=GetBlobSize(image);\n image->compression=NoCompression;\n image->depth=8;\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n if (image_type == GIMP_RGB)\n ;\n else\n if (image_type == GIMP_GRAY)\n image->colorspace=GRAYColorspace;\n else\n if (image_type == GIMP_INDEXED)\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n (void) SetImageOpacity(image,OpaqueOpacity); \n (void) SetImageBackgroundColor(image);\n /*\n Read properties.\n */\n while ((foundPropEnd == MagickFalse) && (EOFBlob(image) == MagickFalse))\n {\n PropType prop_type = (PropType) ReadBlobMSBLong(image);\n size_t prop_size = ReadBlobMSBLong(image);\n\n switch (prop_type)\n {\n case PROP_END:\n foundPropEnd=1;\n break;\n case PROP_COLORMAP:\n {\n /* Cannot rely on prop_size here--the value is set incorrectly\n by some Gimp versions.\n */\n size_t num_colours = ReadBlobMSBLong(image);\n if (DiscardBlobBytes(image,3*num_colours) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n /*\n if (info->file_version == 0)\n {\n gint i;\n\n g_message (_(\"XCF warning: version 0 of XCF file format\\n\"\n \"did not save indexed colormaps correctly.\\n\"\n \"Substituting grayscale map.\"));\n info->cp +=\n xcf_read_int32 (info->fp, (guint32*) &gimage->num_cols, 1);\n gimage->cmap = g_new (guchar, gimage->num_cols*3);\n xcf_seek_pos (info, info->cp + gimage->num_cols);\n for (i = 0; inum_cols; i++)\n {\n gimage->cmap[i*3+0] = i;\n gimage->cmap[i*3+1] = i;\n gimage->cmap[i*3+2] = i;\n }\n }\n else\n {\n info->cp +=\n xcf_read_int32 (info->fp, (guint32*) &gimage->num_cols, 1);\n gimage->cmap = g_new (guchar, gimage->num_cols*3);\n info->cp +=\n xcf_read_int8 (info->fp,\n (guint8*) gimage->cmap, gimage->num_cols*3);\n }\n */\n break;\n }\n case PROP_COMPRESSION:\n {\n doc_info.compression = ReadBlobByte(image);\n if ((doc_info.compression != COMPRESS_NONE) &&\n (doc_info.compression != COMPRESS_RLE) &&\n (doc_info.compression != COMPRESS_ZLIB) &&\n (doc_info.compression != COMPRESS_FRACTAL))\n ThrowReaderException(CorruptImageError,\"UnrecognizedImageCompression\");\n }\n break;\n\n case PROP_GUIDES:\n {\n /* just skip it - we don't care about guides */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n }\n break;\n\n case PROP_RESOLUTION:\n {\n /* float xres = (float) */ (void) ReadBlobMSBLong(image);\n /* float yres = (float) */ (void) ReadBlobMSBLong(image);\n\n /*\n if (xres < GIMP_MIN_RESOLUTION || xres > GIMP_MAX_RESOLUTION ||\n yres < GIMP_MIN_RESOLUTION || yres > GIMP_MAX_RESOLUTION)\n {\n g_message (\"Warning, resolution out of range in XCF file\");\n xres = gimage->gimp->config->default_xresolution;\n yres = gimage->gimp->config->default_yresolution;\n }\n */\n\n\n /* BOGUS: we don't write these yet because we aren't\n reading them properly yet :(\n image->x_resolution = xres;\n image->y_resolution = yres;\n */\n }\n break;\n\n case PROP_TATTOO:\n {\n /* we need to read it, even if we ignore it */\n /*size_t tattoo_state = */ (void) ReadBlobMSBLong(image);\n }\n break;\n\n case PROP_PARASITES:\n {\n /* BOGUS: we may need these for IPTC stuff */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n /*\n gssize_t base = info->cp;\n GimpParasite *p;\n\n while (info->cp - base < prop_size)\n {\n p = xcf_load_parasite (info);\n gimp_image_parasite_attach (gimage, p);\n gimp_parasite_free (p);\n }\n if (info->cp - base != prop_size)\n g_message (\"Error detected while loading an image's parasites\");\n */\n }\n break;\n\n case PROP_UNIT:\n {\n /* BOGUS: ignore for now... */\n /*size_t unit = */ (void) ReadBlobMSBLong(image);\n }\n break;\n\n case PROP_PATHS:\n {\n /* BOGUS: just skip it for now */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n\n /*\n PathList *paths = xcf_load_bzpaths (gimage, info);\n gimp_image_set_paths (gimage, paths);\n */\n }\n break;\n\n case PROP_USER_UNIT:\n {\n char unit_string[1000];\n /*BOGUS: ignored for now */\n /*float factor = (float) */ (void) ReadBlobMSBLong(image);\n /* size_t digits = */ (void) ReadBlobMSBLong(image);\n for (i=0; i<5; i++)\n (void) ReadBlobStringWithLongSize(image, unit_string,\n sizeof(unit_string));\n }\n break;\n\n default:\n {\n int buf[16];\n ssize_t amount;\n\n /* read over it... */\n while ((prop_size > 0) && (EOFBlob(image) == MagickFalse))\n {\n amount=(ssize_t) MagickMin(16, prop_size);\n amount=(ssize_t) ReadBlob(image,(size_t) amount,(unsigned char *) &buf);\n if (!amount)\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n prop_size -= (size_t) MagickMin(16,(size_t) amount);\n }\n }\n break;\n }\n }\n if (foundPropEnd == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n {\n ; /* do nothing, were just pinging! */\n }\n else\n {\n int\n current_layer = 0,\n foundAllLayers = MagickFalse,\n number_layers = 0;\n\n MagickOffsetType\n oldPos=TellBlob(image);\n\n XCFLayerInfo\n *layer_info;\n\n /*\n The read pointer.\n */\n do\n {\n ssize_t offset = ReadBlobMSBSignedLong(image);\n if (offset == 0)\n foundAllLayers=MagickTrue;\n else\n number_layers++;\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n break;\n }\n } while (foundAllLayers == MagickFalse);\n doc_info.number_layers=number_layers;\n offset=SeekBlob(image,oldPos,SEEK_SET); /* restore the position! */\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n /* allocate our array of layer info blocks */\n length=(size_t) number_layers;\n layer_info=(XCFLayerInfo *) AcquireQuantumMemory(length,\n sizeof(*layer_info));\n if (layer_info == (XCFLayerInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(layer_info,0,number_layers*sizeof(XCFLayerInfo));\n for ( ; ; )\n {\n MagickBooleanType\n layer_ok;\n\n MagickOffsetType\n offset,\n saved_pos;\n\n /* read in the offset of the next layer */\n offset=(MagickOffsetType) ReadBlobMSBLong(image);\n /* if the offset is 0 then we are at the end\n * of the layer list.\n */\n if (offset == 0)\n break;\n /* save the current position as it is where the\n * next layer offset is stored.\n */\n saved_pos=TellBlob(image);\n /* seek to the layer offset */\n if (SeekBlob(image,offset,SEEK_SET) != offset)\n ThrowReaderException(ResourceLimitError,\"NotEnoughPixelData\");\n /* read in the layer */\n layer_ok=ReadOneLayer(image_info,image,&doc_info,\n &layer_info[current_layer],current_layer);\n if (layer_ok == MagickFalse)\n {\n int j;\n\n for (j=0; j < current_layer; j++)\n layer_info[j].image=DestroyImage(layer_info[j].image);\n layer_info=(XCFLayerInfo *) RelinquishMagickMemory(layer_info);\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n /* restore the saved position so we'll be ready to\n * read the next offset.\n */\n offset=SeekBlob(image, saved_pos, SEEK_SET);\n current_layer++;\n }\n#if 0\n {\n /* NOTE: XCF layers are REVERSED from composite order! */\n signed int j;\n for (j=number_layers-1; j>=0; j--) {\n /* BOGUS: need to consider layer blending modes!! */\n\n if ( layer_info[j].visible ) { /* only visible ones, please! */\n CompositeImage(image, OverCompositeOp, layer_info[j].image,\n layer_info[j].offset_x, layer_info[j].offset_y );\n layer_info[j].image =DestroyImage( layer_info[j].image );\n\n /* If we do this, we'll get REAL gray images! */\n if ( image_type == GIMP_GRAY ) {\n QuantizeInfo qi;\n GetQuantizeInfo(&qi);\n qi.colorspace = GRAYColorspace;\n QuantizeImage( &qi, layer_info[j].image );\n }\n }\n }\n }\n#else\n {\n /* NOTE: XCF layers are REVERSED from composite order! */\n ssize_t j;\n\n /* now reverse the order of the layers as they are put\n into subimages\n */\n for (j=(long) number_layers-1; j >= 0; j--)\n AppendImageToList(&image,layer_info[j].image);\n }\n#endif\n\n layer_info=(XCFLayerInfo *) RelinquishMagickMemory(layer_info);\n\n#if 0 /* BOGUS: do we need the channels?? */\n while (MagickTrue)\n {\n /* read in the offset of the next channel */\n info->cp += xcf_read_int32 (info->fp, &offset, 1);\n\n /* if the offset is 0 then we are at the end\n * of the channel list.\n */\n if (offset == 0)\n break;\n\n /* save the current position as it is where the\n * next channel offset is stored.\n */\n saved_pos = info->cp;\n\n /* seek to the channel offset */\n xcf_seek_pos (info, offset);\n\n /* read in the layer */\n channel = xcf_load_channel (info, gimage);\n if (channel == 0)\n goto error;\n\n num_successful_elements++;\n\n /* add the channel to the image if its not the selection */\n if (channel != gimage->selection_mask)\n gimp_image_add_channel (gimage, channel, -1);\n\n /* restore the saved position so we'll be ready to\n * read the next offset.\n */\n xcf_seek_pos (info, saved_pos);\n }\n#endif\n }\n\n (void) CloseBlob(image);\n DestroyImage(RemoveFirstImageFromList(&image));\n if (image_type == GIMP_GRAY)\n image->type=GrayscaleType;\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n magick[14];\n\n Image\n *image;\n\n int\n foundPropEnd = 0;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n offset;\n\n register ssize_t\n i;\n\n size_t\n image_type,\n length;\n\n ssize_t\n count;\n\n XCFDocInfo\n doc_info;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n image=AcquireImage(image_info);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n count=ReadBlob(image,14,(unsigned char *) magick);\n if ((count != 14) ||\n (LocaleNCompare((char *) magick,\"gimp xcf\",8) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n (void) ResetMagickMemory(&doc_info,0,sizeof(XCFDocInfo));\n doc_info.exception=exception;\n doc_info.width=ReadBlobMSBLong(image);\n doc_info.height=ReadBlobMSBLong(image);\n if ((doc_info.width > 262144) || (doc_info.height > 262144))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n doc_info.image_type=ReadBlobMSBLong(image);\n /*\n Initialize image attributes.\n */\n image->columns=doc_info.width;\n image->rows=doc_info.height;\n image_type=doc_info.image_type;\n doc_info.file_size=GetBlobSize(image);\n image->compression=NoCompression;\n image->depth=8;\n status=SetImageExtent(image,image->columns,image->rows);\n if (status == MagickFalse)\n {\n InheritException(exception,&image->exception);\n return(DestroyImageList(image));\n }\n if (image_type == GIMP_RGB)\n ;\n else\n if (image_type == GIMP_GRAY)\n image->colorspace=GRAYColorspace;\n else\n if (image_type == GIMP_INDEXED)\n ThrowReaderException(CoderError,\"ColormapTypeNotSupported\");\n (void) SetImageOpacity(image,OpaqueOpacity); \n (void) SetImageBackgroundColor(image);\n /*\n Read properties.\n */\n while ((foundPropEnd == MagickFalse) && (EOFBlob(image) == MagickFalse))\n {\n PropType prop_type = (PropType) ReadBlobMSBLong(image);\n size_t prop_size = ReadBlobMSBLong(image);\n\n switch (prop_type)\n {\n case PROP_END:\n foundPropEnd=1;\n break;\n case PROP_COLORMAP:\n {\n /* Cannot rely on prop_size here--the value is set incorrectly\n by some Gimp versions.\n */\n size_t num_colours = ReadBlobMSBLong(image);\n if (DiscardBlobBytes(image,3*num_colours) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n /*\n if (info->file_version == 0)\n {\n gint i;\n\n g_message (_(\"XCF warning: version 0 of XCF file format\\n\"\n \"did not save indexed colormaps correctly.\\n\"\n \"Substituting grayscale map.\"));\n info->cp +=\n xcf_read_int32 (info->fp, (guint32*) &gimage->num_cols, 1);\n gimage->cmap = g_new (guchar, gimage->num_cols*3);\n xcf_seek_pos (info, info->cp + gimage->num_cols);\n for (i = 0; inum_cols; i++)\n {\n gimage->cmap[i*3+0] = i;\n gimage->cmap[i*3+1] = i;\n gimage->cmap[i*3+2] = i;\n }\n }\n else\n {\n info->cp +=\n xcf_read_int32 (info->fp, (guint32*) &gimage->num_cols, 1);\n gimage->cmap = g_new (guchar, gimage->num_cols*3);\n info->cp +=\n xcf_read_int8 (info->fp,\n (guint8*) gimage->cmap, gimage->num_cols*3);\n }\n */\n break;\n }\n case PROP_COMPRESSION:\n {\n doc_info.compression = ReadBlobByte(image);\n if ((doc_info.compression != COMPRESS_NONE) &&\n (doc_info.compression != COMPRESS_RLE) &&\n (doc_info.compression != COMPRESS_ZLIB) &&\n (doc_info.compression != COMPRESS_FRACTAL))\n ThrowReaderException(CorruptImageError,\"UnrecognizedImageCompression\");\n }\n break;\n\n case PROP_GUIDES:\n {\n /* just skip it - we don't care about guides */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n }\n break;\n\n case PROP_RESOLUTION:\n {\n /* float xres = (float) */ (void) ReadBlobMSBLong(image);\n /* float yres = (float) */ (void) ReadBlobMSBLong(image);\n\n /*\n if (xres < GIMP_MIN_RESOLUTION || xres > GIMP_MAX_RESOLUTION ||\n yres < GIMP_MIN_RESOLUTION || yres > GIMP_MAX_RESOLUTION)\n {\n g_message (\"Warning, resolution out of range in XCF file\");\n xres = gimage->gimp->config->default_xresolution;\n yres = gimage->gimp->config->default_yresolution;\n }\n */\n\n\n /* BOGUS: we don't write these yet because we aren't\n reading them properly yet :(\n image->x_resolution = xres;\n image->y_resolution = yres;\n */\n }\n break;\n\n case PROP_TATTOO:\n {\n /* we need to read it, even if we ignore it */\n /*size_t tattoo_state = */ (void) ReadBlobMSBLong(image);\n }\n break;\n\n case PROP_PARASITES:\n {\n /* BOGUS: we may need these for IPTC stuff */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n /*\n gssize_t base = info->cp;\n GimpParasite *p;\n\n while (info->cp - base < prop_size)\n {\n p = xcf_load_parasite (info);\n gimp_image_parasite_attach (gimage, p);\n gimp_parasite_free (p);\n }\n if (info->cp - base != prop_size)\n g_message (\"Error detected while loading an image's parasites\");\n */\n }\n break;\n\n case PROP_UNIT:\n {\n /* BOGUS: ignore for now... */\n /*size_t unit = */ (void) ReadBlobMSBLong(image);\n }\n break;\n\n case PROP_PATHS:\n {\n /* BOGUS: just skip it for now */\n if (DiscardBlobBytes(image,prop_size) == MagickFalse)\n ThrowFileException(&image->exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n\n /*\n PathList *paths = xcf_load_bzpaths (gimage, info);\n gimp_image_set_paths (gimage, paths);\n */\n }\n break;\n\n case PROP_USER_UNIT:\n {\n char unit_string[1000];\n /*BOGUS: ignored for now */\n /*float factor = (float) */ (void) ReadBlobMSBLong(image);\n /* size_t digits = */ (void) ReadBlobMSBLong(image);\n for (i=0; i<5; i++)\n (void) ReadBlobStringWithLongSize(image, unit_string,\n sizeof(unit_string));\n }\n break;\n\n default:\n {\n int buf[16];\n ssize_t amount;\n\n /* read over it... */\n while ((prop_size > 0) && (EOFBlob(image) == MagickFalse))\n {\n amount=(ssize_t) MagickMin(16, prop_size);\n amount=(ssize_t) ReadBlob(image,(size_t) amount,(unsigned char *) &buf);\n if (!amount)\n ThrowReaderException(CorruptImageError,\"CorruptImage\");\n prop_size -= (size_t) MagickMin(16,(size_t) amount);\n }\n }\n break;\n }\n }\n if (foundPropEnd == MagickFalse)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n {\n ; /* do nothing, were just pinging! */\n }\n else\n {\n int\n current_layer = 0,\n foundAllLayers = MagickFalse,\n number_layers = 0;\n\n MagickOffsetType\n oldPos=TellBlob(image);\n\n XCFLayerInfo\n *layer_info;\n\n /*\n The read pointer.\n */\n do\n {\n ssize_t offset = ReadBlobMSBSignedLong(image);\n if (offset == 0)\n foundAllLayers=MagickTrue;\n else\n number_layers++;\n if (EOFBlob(image) != MagickFalse)\n {\n ThrowFileException(exception,CorruptImageError,\n \"UnexpectedEndOfFile\",image->filename);\n break;\n }\n } while (foundAllLayers == MagickFalse);\n doc_info.number_layers=number_layers;\n offset=SeekBlob(image,oldPos,SEEK_SET); /* restore the position! */\n if (offset < 0)\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n /* allocate our array of layer info blocks */\n length=(size_t) number_layers;\n layer_info=(XCFLayerInfo *) AcquireQuantumMemory(length,\n sizeof(*layer_info));\n if (layer_info == (XCFLayerInfo *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(layer_info,0,number_layers*sizeof(XCFLayerInfo));\n for ( ; ; )\n {\n MagickBooleanType\n layer_ok;\n\n MagickOffsetType\n offset,\n saved_pos;\n\n /* read in the offset of the next layer */\n offset=(MagickOffsetType) ReadBlobMSBLong(image);\n /* if the offset is 0 then we are at the end\n * of the layer list.\n */\n if (offset == 0)\n break;\n /* save the current position as it is where the\n * next layer offset is stored.\n */\n saved_pos=TellBlob(image);\n /* seek to the layer offset */\n if (SeekBlob(image,offset,SEEK_SET) != offset)\n ThrowReaderException(ResourceLimitError,\"NotEnoughPixelData\");\n /* read in the layer */\n layer_ok=ReadOneLayer(image_info,image,&doc_info,\n &layer_info[current_layer],current_layer);\n if (layer_ok == MagickFalse)\n {\n int j;\n\n for (j=0; j < current_layer; j++)\n layer_info[j].image=DestroyImage(layer_info[j].image);\n layer_info=(XCFLayerInfo *) RelinquishMagickMemory(layer_info);\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n /* restore the saved position so we'll be ready to\n * read the next offset.\n */\n offset=SeekBlob(image, saved_pos, SEEK_SET);\n current_layer++;\n }\n#if 0\n {\n /* NOTE: XCF layers are REVERSED from composite order! */\n signed int j;\n for (j=number_layers-1; j>=0; j--) {\n /* BOGUS: need to consider layer blending modes!! */\n\n if ( layer_info[j].visible ) { /* only visible ones, please! */\n CompositeImage(image, OverCompositeOp, layer_info[j].image,\n layer_info[j].offset_x, layer_info[j].offset_y );\n layer_info[j].image =DestroyImage( layer_info[j].image );\n\n /* If we do this, we'll get REAL gray images! */\n if ( image_type == GIMP_GRAY ) {\n QuantizeInfo qi;\n GetQuantizeInfo(&qi);\n qi.colorspace = GRAYColorspace;\n QuantizeImage( &qi, layer_info[j].image );\n }\n }\n }\n }\n#else\n {\n /* NOTE: XCF layers are REVERSED from composite order! */\n ssize_t j;\n\n /* now reverse the order of the layers as they are put\n into subimages\n */\n for (j=(long) number_layers-1; j >= 0; j--)\n AppendImageToList(&image,layer_info[j].image);\n }\n#endif\n\n layer_info=(XCFLayerInfo *) RelinquishMagickMemory(layer_info);\n\n#if 0 /* BOGUS: do we need the channels?? */\n while (MagickTrue)\n {\n /* read in the offset of the next channel */\n info->cp += xcf_read_int32 (info->fp, &offset, 1);\n\n /* if the offset is 0 then we are at the end\n * of the channel list.\n */\n if (offset == 0)\n break;\n\n /* save the current position as it is where the\n * next channel offset is stored.\n */\n saved_pos = info->cp;\n\n /* seek to the channel offset */\n xcf_seek_pos (info, offset);\n\n /* read in the layer */\n channel = xcf_load_channel (info, gimage);\n if (channel == 0)\n goto error;\n\n num_successful_elements++;\n\n /* add the channel to the image if its not the selection */\n if (channel != gimage->selection_mask)\n gimp_image_add_channel (gimage, channel, -1);\n\n /* restore the saved position so we'll be ready to\n * read the next offset.\n */\n xcf_seek_pos (info, saved_pos);\n }\n#endif\n }\n\n (void) CloseBlob(image);\n if (GetNextImageInList(image) != (Image *) NULL)\n DestroyImage(RemoveFirstImageFromList(&image));\n if (image_type == GIMP_GRAY)\n image->type=GrayscaleType;\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"ReadXCFImage","file_name":"coders/xcf.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/d31fec57e9dfb0516deead2053a856e3c71e9751","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#4-74fcbc5b2afa","input":"CopyKeyAliasesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info)\n{\n AliasInfo *alias;\n unsigned i, num_key_aliases;\n struct xkb_key_alias *key_aliases;\n\n /*\n * Do some sanity checking on the aliases. We can't do it before\n * because keys and their aliases may be added out-of-order.\n */\n num_key_aliases = 0;\n darray_foreach(alias, info->aliases) {\n /* Check that ->real is a key. */\n if (!XkbKeyByName(keymap, alias->real, false)) {\n log_vrb(info->ctx, 5,\n \"Attempt to alias %s to non-existent key %s; Ignored\\n\",\n KeyNameText(info->ctx, alias->alias),\n KeyNameText(info->ctx, alias->real));\n alias->real = XKB_ATOM_NONE;\n continue;\n }\n\n /* Check that ->alias is not a key. */\n if (XkbKeyByName(keymap, alias->alias, false)) {\n log_vrb(info->ctx, 5,\n \"Attempt to create alias with the name of a real key; \"\n \"Alias \\\"%s = %s\\\" ignored\\n\",\n KeyNameText(info->ctx, alias->alias),\n KeyNameText(info->ctx, alias->real));\n alias->real = XKB_ATOM_NONE;\n continue;\n }\n\n num_key_aliases++;\n }\n\n /* Copy key aliases. */\n key_aliases = NULL;\n if (num_key_aliases > 0) {\n key_aliases = calloc(num_key_aliases, sizeof(*key_aliases));\n if (!key_aliases)\n return false;\n }\n\n i = 0;\n darray_foreach(alias, info->aliases) {\n if (alias->real != XKB_ATOM_NONE) {\n key_aliases[i].alias = alias->alias;\n key_aliases[i].real = alias->real;\n i++;\n }\n }\n\n keymap->num_key_aliases = num_key_aliases;\n keymap->key_aliases = key_aliases;\n return true;\n}","target":"CopyKeyAliasesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info)\n{\n AliasInfo *alias;\n unsigned i, num_key_aliases;\n struct xkb_key_alias *key_aliases;\n\n /*\n * Do some sanity checking on the aliases. We can't do it before\n * because keys and their aliases may be added out-of-order.\n */\n num_key_aliases = 0;\n darray_foreach(alias, info->aliases) {\n /* Check that ->real is a key. */\n if (!XkbKeyByName(keymap, alias->real, false)) {\n log_vrb(info->ctx, 5,\n \"Attempt to alias %s to non-existent key %s; Ignored\\n\",\n KeyNameText(info->ctx, alias->alias),\n KeyNameText(info->ctx, alias->real));\n alias->real = XKB_ATOM_NONE;\n continue;\n }\n\n /* Check that ->alias is not a key. */\n if (XkbKeyByName(keymap, alias->alias, false)) {\n log_vrb(info->ctx, 5,\n \"Attempt to create alias with the name of a real key; \"\n \"Alias \\\"%s = %s\\\" ignored\\n\",\n KeyNameText(info->ctx, alias->alias),\n KeyNameText(info->ctx, alias->real));\n alias->real = XKB_ATOM_NONE;\n continue;\n }\n\n num_key_aliases++;\n }\n\n /* Copy key aliases. */\n key_aliases = NULL;\n if (num_key_aliases > 0) {\n key_aliases = calloc(num_key_aliases, sizeof(*key_aliases));\n if (!key_aliases)\n return false;\n\n i = 0;\n darray_foreach(alias, info->aliases) {\n if (alias->real != XKB_ATOM_NONE) {\n key_aliases[i].alias = alias->alias;\n key_aliases[i].real = alias->real;\n i++;\n }\n }\n }\n\n keymap->num_key_aliases = num_key_aliases;\n keymap->key_aliases = key_aliases;\n return true;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"CopyKeyAliasesToKeymap","file_name":"src/xkbcomp/keycodes.c","commit_link":"github.com/xkbcommon/libxkbcommon/commit/badb428e63387140720f22486b3acbd3d738859f","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#5-b4e0ca7bcf7d","input":" void Compute(OpKernelContext* ctx) override {\n const Tensor& val = ctx->input(0);\n int64 id = ctx->session_state()->GetNewId();\n TensorStore::TensorAndKey tk{val, id, requested_device()};\n OP_REQUIRES_OK(ctx, ctx->tensor_store()->AddTensor(name(), tk));\n\n Tensor* handle = nullptr;\n OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &handle));\n if (ctx->expected_output_dtype(0) == DT_RESOURCE) {\n ResourceHandle resource_handle = MakeResourceHandle(\n ctx, SessionState::kTensorHandleResourceTypeName,\n tk.GetHandle(name()));\n resource_handle.set_maybe_type_name(\n SessionState::kTensorHandleResourceTypeName);\n handle->scalar()() = resource_handle;\n } else {\n // Legacy behavior in V1.\n handle->flat().setConstant(tk.GetHandle(name()));\n }\n }","target":" void Compute(OpKernelContext* ctx) override {\n const Tensor& val = ctx->input(0);\n auto session_state = ctx->session_state();\n OP_REQUIRES(ctx, session_state != nullptr,\n errors::FailedPrecondition(\n \"GetSessionHandle called on null session state\"));\n int64 id = session_state->GetNewId();\n TensorStore::TensorAndKey tk{val, id, requested_device()};\n OP_REQUIRES_OK(ctx, ctx->tensor_store()->AddTensor(name(), tk));\n\n Tensor* handle = nullptr;\n OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &handle));\n if (ctx->expected_output_dtype(0) == DT_RESOURCE) {\n ResourceHandle resource_handle = MakeResourceHandle(\n ctx, SessionState::kTensorHandleResourceTypeName,\n tk.GetHandle(name()));\n resource_handle.set_maybe_type_name(\n SessionState::kTensorHandleResourceTypeName);\n handle->scalar()() = resource_handle;\n } else {\n // Legacy behavior in V1.\n handle->flat().setConstant(tk.GetHandle(name()));\n }\n }","lang":"cpp","vul_type":"cwe-476","sven_meta":{"func_name":"tensorflow::GetSessionHandleOp::Compute","file_name":"tensorflow/core/kernels/session_ops.cc","commit_link":"github.com/tensorflow/tensorflow/commit/9a133d73ae4b4664d22bd1aa6d654fec13c52ee1","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#6-c074193b792b","input":"static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)\n{\n\tstruct tun_struct *tun;\n\tstruct tun_file *tfile = file->private_data;\n\tstruct net_device *dev;\n\tint err;\n\n\tif (tfile->detached)\n\t\treturn -EINVAL;\n\n\tdev = __dev_get_by_name(net, ifr->ifr_name);\n\tif (dev) {\n\t\tif (ifr->ifr_flags & IFF_TUN_EXCL)\n\t\t\treturn -EBUSY;\n\t\tif ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops)\n\t\t\ttun = netdev_priv(dev);\n\t\telse if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops)\n\t\t\ttun = netdev_priv(dev);\n\t\telse\n\t\t\treturn -EINVAL;\n\n\t\tif (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) !=\n\t\t !!(tun->flags & IFF_MULTI_QUEUE))\n\t\t\treturn -EINVAL;\n\n\t\tif (tun_not_capable(tun))\n\t\t\treturn -EPERM;\n\t\terr = security_tun_dev_open(tun->security);\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\terr = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER);\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\tif (tun->flags & IFF_MULTI_QUEUE &&\n\t\t (tun->numqueues + tun->numdisabled > 1)) {\n\t\t\t/* One or more queue has already been attached, no need\n\t\t\t * to initialize the device again.\n\t\t\t */\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse {\n\t\tchar *name;\n\t\tunsigned long flags = 0;\n\t\tint queues = ifr->ifr_flags & IFF_MULTI_QUEUE ?\n\t\t\t MAX_TAP_QUEUES : 1;\n\n\t\tif (!ns_capable(net->user_ns, CAP_NET_ADMIN))\n\t\t\treturn -EPERM;\n\t\terr = security_tun_dev_create();\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\t/* Set dev type */\n\t\tif (ifr->ifr_flags & IFF_TUN) {\n\t\t\t/* TUN device */\n\t\t\tflags |= IFF_TUN;\n\t\t\tname = \"tun%d\";\n\t\t} else if (ifr->ifr_flags & IFF_TAP) {\n\t\t\t/* TAP device */\n\t\t\tflags |= IFF_TAP;\n\t\t\tname = \"tap%d\";\n\t\t} else\n\t\t\treturn -EINVAL;\n\n\t\tif (*ifr->ifr_name)\n\t\t\tname = ifr->ifr_name;\n\n\t\tdev = alloc_netdev_mqs(sizeof(struct tun_struct), name,\n\t\t\t\t NET_NAME_UNKNOWN, tun_setup, queues,\n\t\t\t\t queues);\n\n\t\tif (!dev)\n\t\t\treturn -ENOMEM;\n\t\terr = dev_get_valid_name(net, dev, name);\n\t\tif (err)\n\t\t\tgoto err_free_dev;\n\n\t\tdev_net_set(dev, net);\n\t\tdev->rtnl_link_ops = &tun_link_ops;\n\t\tdev->ifindex = tfile->ifindex;\n\t\tdev->sysfs_groups[0] = &tun_attr_group;\n\n\t\ttun = netdev_priv(dev);\n\t\ttun->dev = dev;\n\t\ttun->flags = flags;\n\t\ttun->txflt.count = 0;\n\t\ttun->vnet_hdr_sz = sizeof(struct virtio_net_hdr);\n\n\t\ttun->align = NET_SKB_PAD;\n\t\ttun->filter_attached = false;\n\t\ttun->sndbuf = tfile->socket.sk->sk_sndbuf;\n\t\ttun->rx_batched = 0;\n\n\t\ttun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats);\n\t\tif (!tun->pcpu_stats) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto err_free_dev;\n\t\t}\n\n\t\tspin_lock_init(&tun->lock);\n\n\t\terr = security_tun_dev_alloc_security(&tun->security);\n\t\tif (err < 0)\n\t\t\tgoto err_free_stat;\n\n\t\ttun_net_init(dev);\n\t\ttun_flow_init(tun);\n\n\t\tdev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |\n\t\t\t\t TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |\n\t\t\t\t NETIF_F_HW_VLAN_STAG_TX;\n\t\tdev->features = dev->hw_features | NETIF_F_LLTX;\n\t\tdev->vlan_features = dev->features &\n\t\t\t\t ~(NETIF_F_HW_VLAN_CTAG_TX |\n\t\t\t\t NETIF_F_HW_VLAN_STAG_TX);\n\n\t\tINIT_LIST_HEAD(&tun->disabled);\n\t\terr = tun_attach(tun, file, false);\n\t\tif (err < 0)\n\t\t\tgoto err_free_flow;\n\n\t\terr = register_netdevice(tun->dev);\n\t\tif (err < 0)\n\t\t\tgoto err_detach;\n\t}\n\n\tnetif_carrier_on(tun->dev);\n\n\ttun_debug(KERN_INFO, tun, \"tun_set_iff\\n\");\n\n\ttun->flags = (tun->flags & ~TUN_FEATURES) |\n\t\t(ifr->ifr_flags & TUN_FEATURES);\n\n\t/* Make sure persistent devices do not get stuck in\n\t * xoff state.\n\t */\n\tif (netif_running(tun->dev))\n\t\tnetif_tx_wake_all_queues(tun->dev);\n\n\tstrcpy(ifr->ifr_name, tun->dev->name);\n\treturn 0;\n\nerr_detach:\n\ttun_detach_all(dev);\n\t/* register_netdevice() already called tun_free_netdev() */\n\tgoto err_free_dev;\n\nerr_free_flow:\n\ttun_flow_uninit(tun);\n\tsecurity_tun_dev_free_security(tun->security);\nerr_free_stat:\n\tfree_percpu(tun->pcpu_stats);\nerr_free_dev:\n\tfree_netdev(dev);\n\treturn err;\n}","target":"static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)\n{\n\tstruct tun_struct *tun;\n\tstruct tun_file *tfile = file->private_data;\n\tstruct net_device *dev;\n\tint err;\n\n\tif (tfile->detached)\n\t\treturn -EINVAL;\n\n\tdev = __dev_get_by_name(net, ifr->ifr_name);\n\tif (dev) {\n\t\tif (ifr->ifr_flags & IFF_TUN_EXCL)\n\t\t\treturn -EBUSY;\n\t\tif ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops)\n\t\t\ttun = netdev_priv(dev);\n\t\telse if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops)\n\t\t\ttun = netdev_priv(dev);\n\t\telse\n\t\t\treturn -EINVAL;\n\n\t\tif (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) !=\n\t\t !!(tun->flags & IFF_MULTI_QUEUE))\n\t\t\treturn -EINVAL;\n\n\t\tif (tun_not_capable(tun))\n\t\t\treturn -EPERM;\n\t\terr = security_tun_dev_open(tun->security);\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\terr = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER);\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\tif (tun->flags & IFF_MULTI_QUEUE &&\n\t\t (tun->numqueues + tun->numdisabled > 1)) {\n\t\t\t/* One or more queue has already been attached, no need\n\t\t\t * to initialize the device again.\n\t\t\t */\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse {\n\t\tchar *name;\n\t\tunsigned long flags = 0;\n\t\tint queues = ifr->ifr_flags & IFF_MULTI_QUEUE ?\n\t\t\t MAX_TAP_QUEUES : 1;\n\n\t\tif (!ns_capable(net->user_ns, CAP_NET_ADMIN))\n\t\t\treturn -EPERM;\n\t\terr = security_tun_dev_create();\n\t\tif (err < 0)\n\t\t\treturn err;\n\n\t\t/* Set dev type */\n\t\tif (ifr->ifr_flags & IFF_TUN) {\n\t\t\t/* TUN device */\n\t\t\tflags |= IFF_TUN;\n\t\t\tname = \"tun%d\";\n\t\t} else if (ifr->ifr_flags & IFF_TAP) {\n\t\t\t/* TAP device */\n\t\t\tflags |= IFF_TAP;\n\t\t\tname = \"tap%d\";\n\t\t} else\n\t\t\treturn -EINVAL;\n\n\t\tif (*ifr->ifr_name)\n\t\t\tname = ifr->ifr_name;\n\n\t\tdev = alloc_netdev_mqs(sizeof(struct tun_struct), name,\n\t\t\t\t NET_NAME_UNKNOWN, tun_setup, queues,\n\t\t\t\t queues);\n\n\t\tif (!dev)\n\t\t\treturn -ENOMEM;\n\t\terr = dev_get_valid_name(net, dev, name);\n\t\tif (err < 0)\n\t\t\tgoto err_free_dev;\n\n\t\tdev_net_set(dev, net);\n\t\tdev->rtnl_link_ops = &tun_link_ops;\n\t\tdev->ifindex = tfile->ifindex;\n\t\tdev->sysfs_groups[0] = &tun_attr_group;\n\n\t\ttun = netdev_priv(dev);\n\t\ttun->dev = dev;\n\t\ttun->flags = flags;\n\t\ttun->txflt.count = 0;\n\t\ttun->vnet_hdr_sz = sizeof(struct virtio_net_hdr);\n\n\t\ttun->align = NET_SKB_PAD;\n\t\ttun->filter_attached = false;\n\t\ttun->sndbuf = tfile->socket.sk->sk_sndbuf;\n\t\ttun->rx_batched = 0;\n\n\t\ttun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats);\n\t\tif (!tun->pcpu_stats) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto err_free_dev;\n\t\t}\n\n\t\tspin_lock_init(&tun->lock);\n\n\t\terr = security_tun_dev_alloc_security(&tun->security);\n\t\tif (err < 0)\n\t\t\tgoto err_free_stat;\n\n\t\ttun_net_init(dev);\n\t\ttun_flow_init(tun);\n\n\t\tdev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |\n\t\t\t\t TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX |\n\t\t\t\t NETIF_F_HW_VLAN_STAG_TX;\n\t\tdev->features = dev->hw_features | NETIF_F_LLTX;\n\t\tdev->vlan_features = dev->features &\n\t\t\t\t ~(NETIF_F_HW_VLAN_CTAG_TX |\n\t\t\t\t NETIF_F_HW_VLAN_STAG_TX);\n\n\t\tINIT_LIST_HEAD(&tun->disabled);\n\t\terr = tun_attach(tun, file, false);\n\t\tif (err < 0)\n\t\t\tgoto err_free_flow;\n\n\t\terr = register_netdevice(tun->dev);\n\t\tif (err < 0)\n\t\t\tgoto err_detach;\n\t}\n\n\tnetif_carrier_on(tun->dev);\n\n\ttun_debug(KERN_INFO, tun, \"tun_set_iff\\n\");\n\n\ttun->flags = (tun->flags & ~TUN_FEATURES) |\n\t\t(ifr->ifr_flags & TUN_FEATURES);\n\n\t/* Make sure persistent devices do not get stuck in\n\t * xoff state.\n\t */\n\tif (netif_running(tun->dev))\n\t\tnetif_tx_wake_all_queues(tun->dev);\n\n\tstrcpy(ifr->ifr_name, tun->dev->name);\n\treturn 0;\n\nerr_detach:\n\ttun_detach_all(dev);\n\t/* register_netdevice() already called tun_free_netdev() */\n\tgoto err_free_dev;\n\nerr_free_flow:\n\ttun_flow_uninit(tun);\n\tsecurity_tun_dev_free_security(tun->security);\nerr_free_stat:\n\tfree_percpu(tun->pcpu_stats);\nerr_free_dev:\n\tfree_netdev(dev);\n\treturn err;\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"tun_set_iff","file_name":"drivers/net/tun.c","commit_link":"github.com/torvalds/linux/commit/5c25f65fd1e42685f7ccd80e0621829c105785d9","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-476#7-1feb5aa9b804","input":"MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info,\n Image *images,const char *filename,ExceptionInfo *exception)\n{\n#define WriteImageTag \"Write/Image\"\n\n ExceptionInfo\n *sans_exception;\n\n ImageInfo\n *write_info;\n\n MagickBooleanType\n proceed;\n\n MagickOffsetType\n progress;\n\n MagickProgressMonitor\n progress_monitor;\n\n MagickSizeType\n number_images;\n\n MagickStatusType\n status;\n\n register Image\n *p;\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n write_info=CloneImageInfo(image_info);\n *write_info->magick='\\0';\n images=GetFirstImageInList(images);\n if (filename != (const char *) NULL)\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n (void) CopyMagickString(p->filename,filename,MagickPathExtent);\n (void) CopyMagickString(write_info->filename,images->filename,MagickPathExtent);\n sans_exception=AcquireExceptionInfo();\n (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),\n sans_exception);\n sans_exception=DestroyExceptionInfo(sans_exception);\n if (*write_info->magick == '\\0')\n (void) CopyMagickString(write_info->magick,images->magick,MagickPathExtent);\n p=images;\n for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))\n if (p->scene >= GetNextImageInList(p)->scene)\n {\n register ssize_t\n i;\n\n /*\n Generate consistent scene numbers.\n */\n i=(ssize_t) images->scene;\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n p->scene=(size_t) i++;\n break;\n }\n /*\n Write images.\n */\n status=MagickTrue;\n progress_monitor=(MagickProgressMonitor) NULL;\n progress=0;\n number_images=GetImageListLength(images);\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n {\n if (number_images != 1)\n progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,\n p->client_data);\n status&=WriteImage(write_info,p,exception);\n if (number_images != 1)\n (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);\n if (write_info->adjoin != MagickFalse)\n break;\n if (number_images != 1)\n {\n proceed=SetImageProgress(p,WriteImageTag,progress++,number_images);\n if (proceed == MagickFalse)\n break;\n }\n }\n write_info=DestroyImageInfo(write_info);\n return(status != 0 ? MagickTrue : MagickFalse);\n}","target":"MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info,\n Image *images,const char *filename,ExceptionInfo *exception)\n{\n#define WriteImageTag \"Write/Image\"\n\n ExceptionInfo\n *sans_exception;\n\n ImageInfo\n *write_info;\n\n MagickBooleanType\n proceed;\n\n MagickOffsetType\n progress;\n\n MagickProgressMonitor\n progress_monitor;\n\n MagickSizeType\n number_images;\n\n MagickStatusType\n status;\n\n register Image\n *p;\n\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n write_info=CloneImageInfo(image_info);\n *write_info->magick='\\0';\n images=GetFirstImageInList(images);\n if (filename != (const char *) NULL)\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n (void) CopyMagickString(p->filename,filename,MagickPathExtent);\n (void) CopyMagickString(write_info->filename,images->filename,MagickPathExtent);\n sans_exception=AcquireExceptionInfo();\n (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),\n sans_exception);\n sans_exception=DestroyExceptionInfo(sans_exception);\n if (*write_info->magick == '\\0')\n (void) CopyMagickString(write_info->magick,images->magick,MagickPathExtent);\n p=images;\n for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))\n {\n register Image\n *next;\n \n next=GetNextImageInList(p);\n if (next == (Image *) NULL)\n break;\n if (p->scene >= next->scene)\n {\n register ssize_t\n i;\n\n /*\n Generate consistent scene numbers.\n */\n i=(ssize_t) images->scene;\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n p->scene=(size_t) i++;\n break;\n }\n }\n /*\n Write images.\n */\n status=MagickTrue;\n progress_monitor=(MagickProgressMonitor) NULL;\n progress=0;\n number_images=GetImageListLength(images);\n for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))\n {\n if (number_images != 1)\n progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,\n p->client_data);\n status&=WriteImage(write_info,p,exception);\n if (number_images != 1)\n (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);\n if (write_info->adjoin != MagickFalse)\n break;\n if (number_images != 1)\n {\n proceed=SetImageProgress(p,WriteImageTag,progress++,number_images);\n if (proceed == MagickFalse)\n break;\n }\n }\n write_info=DestroyImageInfo(write_info);\n return(status != 0 ? MagickTrue : MagickFalse);\n}","lang":"c","vul_type":"cwe-476","sven_meta":{"func_name":"WriteImages","file_name":"MagickCore/constitute.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/5b4bebaa91849c592a8448bc353ab25a54ff8c44","source_cwe_file":"cwe-476.jsonl"}} +{"problem_id":"cwe-416#0-ca230407bed8","input":"static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)\n{\n\tstruct mmu_gather tlb;\n\tstruct vm_area_struct *vma;\n\tbool ret = true;\n\n\t/*\n\t * We have to make sure to not race with the victim exit path\n\t * and cause premature new oom victim selection:\n\t * __oom_reap_task_mm\t\texit_mm\n\t * mmget_not_zero\n\t *\t\t\t\t mmput\n\t *\t\t\t\t atomic_dec_and_test\n\t *\t\t\t\t exit_oom_victim\n\t *\t\t\t\t[...]\n\t *\t\t\t\tout_of_memory\n\t *\t\t\t\t select_bad_process\n\t *\t\t\t\t # no TIF_MEMDIE task selects new victim\n\t * unmap_page_range # frees some memory\n\t */\n\tmutex_lock(&oom_lock);\n\n\tif (!down_read_trylock(&mm->mmap_sem)) {\n\t\tret = false;\n\t\ttrace_skip_task_reaping(tsk->pid);\n\t\tgoto unlock_oom;\n\t}\n\n\t/*\n\t * If the mm has notifiers then we would need to invalidate them around\n\t * unmap_page_range and that is risky because notifiers can sleep and\n\t * what they do is basically undeterministic. So let's have a short\n\t * sleep to give the oom victim some more time.\n\t * TODO: we really want to get rid of this ugly hack and make sure that\n\t * notifiers cannot block for unbounded amount of time and add\n\t * mmu_notifier_invalidate_range_{start,end} around unmap_page_range\n\t */\n\tif (mm_has_notifiers(mm)) {\n\t\tup_read(&mm->mmap_sem);\n\t\tschedule_timeout_idle(HZ);\n\t\tgoto unlock_oom;\n\t}\n\n\t/*\n\t * MMF_OOM_SKIP is set by exit_mmap when the OOM reaper can't\n\t * work on the mm anymore. The check for MMF_OOM_SKIP must run\n\t * under mmap_sem for reading because it serializes against the\n\t * down_write();up_write() cycle in exit_mmap().\n\t */\n\tif (test_bit(MMF_OOM_SKIP, &mm->flags)) {\n\t\tup_read(&mm->mmap_sem);\n\t\ttrace_skip_task_reaping(tsk->pid);\n\t\tgoto unlock_oom;\n\t}\n\n\ttrace_start_task_reaping(tsk->pid);\n\n\t/*\n\t * Tell all users of get_user/copy_from_user etc... that the content\n\t * is no longer stable. No barriers really needed because unmapping\n\t * should imply barriers already and the reader would hit a page fault\n\t * if it stumbled over a reaped memory.\n\t */\n\tset_bit(MMF_UNSTABLE, &mm->flags);\n\n\ttlb_gather_mmu(&tlb, mm, 0, -1);\n\tfor (vma = mm->mmap ; vma; vma = vma->vm_next) {\n\t\tif (!can_madv_dontneed_vma(vma))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * Only anonymous pages have a good chance to be dropped\n\t\t * without additional steps which we cannot afford as we\n\t\t * are OOM already.\n\t\t *\n\t\t * We do not even care about fs backed pages because all\n\t\t * which are reclaimable have already been reclaimed and\n\t\t * we do not want to block exit_mmap by keeping mm ref\n\t\t * count elevated without a good reason.\n\t\t */\n\t\tif (vma_is_anonymous(vma) || !(vma->vm_flags & VM_SHARED))\n\t\t\tunmap_page_range(&tlb, vma, vma->vm_start, vma->vm_end,\n\t\t\t\t\t NULL);\n\t}\n\ttlb_finish_mmu(&tlb, 0, -1);\n\tpr_info(\"oom_reaper: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\\n\",\n\t\t\ttask_pid_nr(tsk), tsk->comm,\n\t\t\tK(get_mm_counter(mm, MM_ANONPAGES)),\n\t\t\tK(get_mm_counter(mm, MM_FILEPAGES)),\n\t\t\tK(get_mm_counter(mm, MM_SHMEMPAGES)));\n\tup_read(&mm->mmap_sem);\n\n\ttrace_finish_task_reaping(tsk->pid);\nunlock_oom:\n\tmutex_unlock(&oom_lock);\n\treturn ret;\n}","target":"static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)\n{\n\tstruct mmu_gather tlb;\n\tstruct vm_area_struct *vma;\n\tbool ret = true;\n\n\t/*\n\t * We have to make sure to not race with the victim exit path\n\t * and cause premature new oom victim selection:\n\t * __oom_reap_task_mm\t\texit_mm\n\t * mmget_not_zero\n\t *\t\t\t\t mmput\n\t *\t\t\t\t atomic_dec_and_test\n\t *\t\t\t\t exit_oom_victim\n\t *\t\t\t\t[...]\n\t *\t\t\t\tout_of_memory\n\t *\t\t\t\t select_bad_process\n\t *\t\t\t\t # no TIF_MEMDIE task selects new victim\n\t * unmap_page_range # frees some memory\n\t */\n\tmutex_lock(&oom_lock);\n\n\tif (!down_read_trylock(&mm->mmap_sem)) {\n\t\tret = false;\n\t\ttrace_skip_task_reaping(tsk->pid);\n\t\tgoto unlock_oom;\n\t}\n\n\t/*\n\t * If the mm has notifiers then we would need to invalidate them around\n\t * unmap_page_range and that is risky because notifiers can sleep and\n\t * what they do is basically undeterministic. So let's have a short\n\t * sleep to give the oom victim some more time.\n\t * TODO: we really want to get rid of this ugly hack and make sure that\n\t * notifiers cannot block for unbounded amount of time and add\n\t * mmu_notifier_invalidate_range_{start,end} around unmap_page_range\n\t */\n\tif (mm_has_notifiers(mm)) {\n\t\tup_read(&mm->mmap_sem);\n\t\tschedule_timeout_idle(HZ);\n\t\tgoto unlock_oom;\n\t}\n\n\t/*\n\t * MMF_OOM_SKIP is set by exit_mmap when the OOM reaper can't\n\t * work on the mm anymore. The check for MMF_OOM_SKIP must run\n\t * under mmap_sem for reading because it serializes against the\n\t * down_write();up_write() cycle in exit_mmap().\n\t */\n\tif (test_bit(MMF_OOM_SKIP, &mm->flags)) {\n\t\tup_read(&mm->mmap_sem);\n\t\ttrace_skip_task_reaping(tsk->pid);\n\t\tgoto unlock_oom;\n\t}\n\n\ttrace_start_task_reaping(tsk->pid);\n\n\t/*\n\t * Tell all users of get_user/copy_from_user etc... that the content\n\t * is no longer stable. No barriers really needed because unmapping\n\t * should imply barriers already and the reader would hit a page fault\n\t * if it stumbled over a reaped memory.\n\t */\n\tset_bit(MMF_UNSTABLE, &mm->flags);\n\n\tfor (vma = mm->mmap ; vma; vma = vma->vm_next) {\n\t\tif (!can_madv_dontneed_vma(vma))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * Only anonymous pages have a good chance to be dropped\n\t\t * without additional steps which we cannot afford as we\n\t\t * are OOM already.\n\t\t *\n\t\t * We do not even care about fs backed pages because all\n\t\t * which are reclaimable have already been reclaimed and\n\t\t * we do not want to block exit_mmap by keeping mm ref\n\t\t * count elevated without a good reason.\n\t\t */\n\t\tif (vma_is_anonymous(vma) || !(vma->vm_flags & VM_SHARED)) {\n\t\t\ttlb_gather_mmu(&tlb, mm, vma->vm_start, vma->vm_end);\n\t\t\tunmap_page_range(&tlb, vma, vma->vm_start, vma->vm_end,\n\t\t\t\t\t NULL);\n\t\t\ttlb_finish_mmu(&tlb, vma->vm_start, vma->vm_end);\n\t\t}\n\t}\n\tpr_info(\"oom_reaper: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\\n\",\n\t\t\ttask_pid_nr(tsk), tsk->comm,\n\t\t\tK(get_mm_counter(mm, MM_ANONPAGES)),\n\t\t\tK(get_mm_counter(mm, MM_FILEPAGES)),\n\t\t\tK(get_mm_counter(mm, MM_SHMEMPAGES)));\n\tup_read(&mm->mmap_sem);\n\n\ttrace_finish_task_reaping(tsk->pid);\nunlock_oom:\n\tmutex_unlock(&oom_lock);\n\treturn ret;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"__oom_reap_task_mm","file_name":"mm/oom_kill.c","commit_link":"github.com/torvalds/linux/commit/687cb0884a714ff484d038e9190edc874edcf146","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#1-d8729780a16f","input":"static void gf_m2ts_process_pat(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *ses, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)\n{\n\tGF_M2TS_Program *prog;\n\tGF_M2TS_SECTION_ES *pmt;\n\tu32 i, nb_progs, evt_type;\n\tu32 nb_sections;\n\tu32 data_size;\n\tunsigned char *data;\n\tGF_M2TS_Section *section;\n\n\t/*wait for the last section */\n\tif (!(status&GF_M2TS_TABLE_END)) return;\n\n\t/*skip if already received*/\n\tif (status&GF_M2TS_TABLE_REPEAT) {\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PAT_REPEAT, NULL);\n\t\treturn;\n\t}\n\n\tnb_sections = gf_list_count(sections);\n\tif (nb_sections > 1) {\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"PAT on multiple sections not supported\\n\"));\n\t}\n\n\tsection = (GF_M2TS_Section *)gf_list_get(sections, 0);\n\tdata = section->data;\n\tdata_size = section->data_size;\n\n\tif (!(status&GF_M2TS_TABLE_UPDATE) && gf_list_count(ts->programs)) {\n\t\tif (ts->pat->demux_restarted) {\n\t\t\tts->pat->demux_restarted = 0;\n\t\t} else {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Multiple different PAT on single TS found, ignoring new PAT declaration (table id %d - extended table id %d)\\n\", table_id, ex_table_id));\n\t\t}\n\t\treturn;\n\t}\n\tnb_progs = data_size / 4;\n\n\tfor (i=0; init) {\n\t\t\t\tts->nit = gf_m2ts_section_filter_new(gf_m2ts_process_nit, 0);\n\t\t\t}\n\t\t} else {\n\t\t\tGF_SAFEALLOC(prog, GF_M2TS_Program);\n\t\t\tif (!prog) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Fail to allocate program for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tprog->streams = gf_list_new();\n\t\t\tprog->pmt_pid = pid;\n\t\t\tprog->number = number;\n\t\t\tprog->ts = ts;\n\t\t\tgf_list_add(ts->programs, prog);\n\t\t\tGF_SAFEALLOC(pmt, GF_M2TS_SECTION_ES);\n\t\t\tif (!pmt) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Fail to allocate pmt filter for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpmt->flags = GF_M2TS_ES_IS_SECTION;\n\t\t\tgf_list_add(prog->streams, pmt);\n\t\t\tpmt->pid = prog->pmt_pid;\n\t\t\tpmt->program = prog;\n\t\t\tts->ess[pmt->pid] = (GF_M2TS_ES *)pmt;\n\t\t\tpmt->sec = gf_m2ts_section_filter_new(gf_m2ts_process_pmt, 0);\n\t\t}\n\t}\n\n\tevt_type = (status&GF_M2TS_TABLE_UPDATE) ? GF_M2TS_EVT_PAT_UPDATE : GF_M2TS_EVT_PAT_FOUND;\n\tif (ts->on_event) ts->on_event(ts, evt_type, NULL);\n}","target":"static void gf_m2ts_process_pat(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *ses, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)\n{\n\tGF_M2TS_Program *prog;\n\tGF_M2TS_SECTION_ES *pmt;\n\tu32 i, nb_progs, evt_type;\n\tu32 nb_sections;\n\tu32 data_size;\n\tunsigned char *data;\n\tGF_M2TS_Section *section;\n\n\t/*wait for the last section */\n\tif (!(status&GF_M2TS_TABLE_END)) return;\n\n\t/*skip if already received*/\n\tif (status&GF_M2TS_TABLE_REPEAT) {\n\t\tif (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_PAT_REPEAT, NULL);\n\t\treturn;\n\t}\n\n\tnb_sections = gf_list_count(sections);\n\tif (nb_sections > 1) {\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"PAT on multiple sections not supported\\n\"));\n\t}\n\n\tsection = (GF_M2TS_Section *)gf_list_get(sections, 0);\n\tdata = section->data;\n\tdata_size = section->data_size;\n\n\tif (!(status&GF_M2TS_TABLE_UPDATE) && gf_list_count(ts->programs)) {\n\t\tif (ts->pat->demux_restarted) {\n\t\t\tts->pat->demux_restarted = 0;\n\t\t} else {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Multiple different PAT on single TS found, ignoring new PAT declaration (table id %d - extended table id %d)\\n\", table_id, ex_table_id));\n\t\t}\n\t\treturn;\n\t}\n\tnb_progs = data_size / 4;\n\n\tfor (i=0; init) {\n\t\t\t\tts->nit = gf_m2ts_section_filter_new(gf_m2ts_process_nit, 0);\n\t\t\t}\n\t\t} else if (!pid) {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Broken PAT found reserved PID 0, ignoring\\n\", pid));\n\t\t} else if (! ts->ess[pid]) {\n\t\t\tGF_SAFEALLOC(prog, GF_M2TS_Program);\n\t\t\tif (!prog) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Fail to allocate program for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tprog->streams = gf_list_new();\n\t\t\tprog->pmt_pid = pid;\n\t\t\tprog->number = number;\n\t\t\tprog->ts = ts;\n\t\t\tgf_list_add(ts->programs, prog);\n\t\t\tGF_SAFEALLOC(pmt, GF_M2TS_SECTION_ES);\n\t\t\tif (!pmt) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"Fail to allocate pmt filter for pid %d\\n\", pid));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpmt->flags = GF_M2TS_ES_IS_SECTION;\n\t\t\tgf_list_add(prog->streams, pmt);\n\t\t\tpmt->pid = prog->pmt_pid;\n\t\t\tpmt->program = prog;\n\t\t\tts->ess[pmt->pid] = (GF_M2TS_ES *)pmt;\n\t\t\tpmt->sec = gf_m2ts_section_filter_new(gf_m2ts_process_pmt, 0);\n\t\t}\n\t}\n\n\tevt_type = (status&GF_M2TS_TABLE_UPDATE) ? GF_M2TS_EVT_PAT_UPDATE : GF_M2TS_EVT_PAT_FOUND;\n\tif (ts->on_event) ts->on_event(ts, evt_type, NULL);\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"gf_m2ts_process_pat","file_name":"src/media_tools/mpegts.c","commit_link":"github.com/gpac/gpac/commit/98b727637e32d1d4824101d8947e2dbd573d4fc8","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#2-7743c66f226e","input":"static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n FILE\n *file;\n\n Image\n *image,\n *next_image,\n *pwp_image;\n\n ImageInfo\n *read_info;\n\n int\n c,\n unique_file;\n\n MagickBooleanType\n status;\n\n register Image\n *p;\n\n register ssize_t\n i;\n\n size_t\n filesize,\n length;\n\n ssize_t\n count;\n\n unsigned char\n magick[MaxTextExtent];\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n pwp_image=AcquireImage(image_info);\n image=pwp_image;\n status=OpenBlob(image_info,pwp_image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n return((Image *) NULL);\n count=ReadBlob(pwp_image,5,magick);\n if ((count != 5) || (LocaleNCompare((char *) magick,\"SFW95\",5) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n read_info=CloneImageInfo(image_info);\n (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,\n (void *) NULL);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n unique_file=AcquireUniqueFileResource(read_info->filename);\n for ( ; ; )\n {\n for (c=ReadBlobByte(pwp_image); c != EOF; c=ReadBlobByte(pwp_image))\n {\n for (i=0; i < 17; i++)\n magick[i]=magick[i+1];\n magick[17]=(unsigned char) c;\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) == 0)\n break;\n }\n if (c == EOF)\n break;\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) != 0)\n {\n (void) RelinquishUniqueFileResource(read_info->filename);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Dump SFW image to a temporary file.\n */\n file=(FILE *) NULL;\n if (unique_file != -1)\n file=fdopen(unique_file,\"wb\");\n if ((unique_file == -1) || (file == (FILE *) NULL))\n {\n (void) RelinquishUniqueFileResource(read_info->filename);\n ThrowFileException(exception,FileOpenError,\"UnableToWriteFile\",\n image->filename);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n length=fwrite(\"SFW94A\",1,6,file);\n (void) length;\n filesize=65535UL*magick[2]+256L*magick[1]+magick[0];\n for (i=0; i < (ssize_t) filesize; i++)\n {\n c=ReadBlobByte(pwp_image);\n (void) fputc(c,file);\n }\n (void) fclose(file);\n next_image=ReadImage(read_info,exception);\n if (next_image == (Image *) NULL)\n break;\n (void) FormatLocaleString(next_image->filename,MaxTextExtent,\n \"slide_%02ld.sfw\",(long) next_image->scene);\n if (image == (Image *) NULL)\n image=next_image;\n else\n {\n /*\n Link image into image list.\n */\n for (p=image; p->next != (Image *) NULL; p=GetNextImageInList(p)) ;\n next_image->previous=p;\n next_image->scene=p->scene+1;\n p->next=next_image;\n }\n if (image_info->number_scenes != 0)\n if (next_image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageProgress(image,LoadImagesTag,TellBlob(pwp_image),\n GetBlobSize(pwp_image));\n if (status == MagickFalse)\n break;\n }\n if (unique_file != -1)\n (void) close(unique_file);\n (void) RelinquishUniqueFileResource(read_info->filename);\n read_info=DestroyImageInfo(read_info);\n (void) CloseBlob(pwp_image);\n pwp_image=DestroyImage(pwp_image);\n if (EOFBlob(image) != MagickFalse)\n {\n char\n *message;\n\n message=GetExceptionMessage(errno);\n (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,\n \"UnexpectedEndOfFile\",\"`%s': %s\",image->filename,message);\n message=DestroyString(message);\n }\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","target":"static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n FILE\n *file;\n\n Image\n *image,\n *next_image,\n *pwp_image;\n\n ImageInfo\n *read_info;\n\n int\n c,\n unique_file;\n\n MagickBooleanType\n status;\n\n register Image\n *p;\n\n register ssize_t\n i;\n\n size_t\n filesize,\n length;\n\n ssize_t\n count;\n\n unsigned char\n magick[MaxTextExtent];\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickSignature);\n pwp_image=AcquireImage(image_info);\n image=pwp_image;\n status=OpenBlob(image_info,pwp_image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n return((Image *) NULL);\n count=ReadBlob(pwp_image,5,magick);\n if ((count != 5) || (LocaleNCompare((char *) magick,\"SFW95\",5) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n read_info=CloneImageInfo(image_info);\n (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,\n (void *) NULL);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n unique_file=AcquireUniqueFileResource(read_info->filename);\n for ( ; ; )\n {\n for (c=ReadBlobByte(pwp_image); c != EOF; c=ReadBlobByte(pwp_image))\n {\n for (i=0; i < 17; i++)\n magick[i]=magick[i+1];\n magick[17]=(unsigned char) c;\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) == 0)\n break;\n }\n if (c == EOF)\n break;\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) != 0)\n {\n (void) RelinquishUniqueFileResource(read_info->filename);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Dump SFW image to a temporary file.\n */\n file=(FILE *) NULL;\n if (unique_file != -1)\n file=fdopen(unique_file,\"wb\");\n if ((unique_file == -1) || (file == (FILE *) NULL))\n {\n (void) RelinquishUniqueFileResource(read_info->filename);\n ThrowFileException(exception,FileOpenError,\"UnableToWriteFile\",\n image->filename);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n length=fwrite(\"SFW94A\",1,6,file);\n (void) length;\n filesize=65535UL*magick[2]+256L*magick[1]+magick[0];\n for (i=0; i < (ssize_t) filesize; i++)\n {\n c=ReadBlobByte(pwp_image);\n (void) fputc(c,file);\n }\n (void) fclose(file);\n next_image=ReadImage(read_info,exception);\n if (next_image == (Image *) NULL)\n break;\n (void) FormatLocaleString(next_image->filename,MaxTextExtent,\n \"slide_%02ld.sfw\",(long) next_image->scene);\n if (image == (Image *) NULL)\n image=next_image;\n else\n {\n /*\n Link image into image list.\n */\n for (p=image; p->next != (Image *) NULL; p=GetNextImageInList(p)) ;\n next_image->previous=p;\n next_image->scene=p->scene+1;\n p->next=next_image;\n }\n if (image_info->number_scenes != 0)\n if (next_image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageProgress(image,LoadImagesTag,TellBlob(pwp_image),\n GetBlobSize(pwp_image));\n if (status == MagickFalse)\n break;\n }\n if (unique_file != -1)\n (void) close(unique_file);\n (void) RelinquishUniqueFileResource(read_info->filename);\n read_info=DestroyImageInfo(read_info);\n if (EOFBlob(image) != MagickFalse)\n {\n char\n *message;\n\n message=GetExceptionMessage(errno);\n (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,\n \"UnexpectedEndOfFile\",\"`%s': %s\",image->filename,message);\n message=DestroyString(message);\n }\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"ReadPWPImage","file_name":"coders/pwp.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/ecc03a2518c2b7dd375fde3a040fdae0bdf6a521","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#3-70fd7adb727e","input":"struct sk_buff *skb_segment(struct sk_buff *head_skb,\n\t\t\t netdev_features_t features)\n{\n\tstruct sk_buff *segs = NULL;\n\tstruct sk_buff *tail = NULL;\n\tstruct sk_buff *list_skb = skb_shinfo(head_skb)->frag_list;\n\tskb_frag_t *frag = skb_shinfo(head_skb)->frags;\n\tunsigned int mss = skb_shinfo(head_skb)->gso_size;\n\tunsigned int doffset = head_skb->data - skb_mac_header(head_skb);\n\tunsigned int offset = doffset;\n\tunsigned int tnl_hlen = skb_tnl_header_len(head_skb);\n\tunsigned int headroom;\n\tunsigned int len;\n\t__be16 proto;\n\tbool csum;\n\tint sg = !!(features & NETIF_F_SG);\n\tint nfrags = skb_shinfo(head_skb)->nr_frags;\n\tint err = -ENOMEM;\n\tint i = 0;\n\tint pos;\n\n\tproto = skb_network_protocol(head_skb);\n\tif (unlikely(!proto))\n\t\treturn ERR_PTR(-EINVAL);\n\n\tcsum = !!can_checksum_protocol(features, proto);\n\t__skb_push(head_skb, doffset);\n\theadroom = skb_headroom(head_skb);\n\tpos = skb_headlen(head_skb);\n\n\tdo {\n\t\tstruct sk_buff *nskb;\n\t\tskb_frag_t *nskb_frag;\n\t\tint hsize;\n\t\tint size;\n\n\t\tlen = head_skb->len - offset;\n\t\tif (len > mss)\n\t\t\tlen = mss;\n\n\t\thsize = skb_headlen(head_skb) - offset;\n\t\tif (hsize < 0)\n\t\t\thsize = 0;\n\t\tif (hsize > len || !sg)\n\t\t\thsize = len;\n\n\t\tif (!hsize && i >= nfrags && skb_headlen(list_skb) &&\n\t\t (skb_headlen(list_skb) == len || sg)) {\n\t\t\tBUG_ON(skb_headlen(list_skb) > len);\n\n\t\t\ti = 0;\n\t\t\tnfrags = skb_shinfo(list_skb)->nr_frags;\n\t\t\tfrag = skb_shinfo(list_skb)->frags;\n\t\t\tpos += skb_headlen(list_skb);\n\n\t\t\twhile (pos < offset + len) {\n\t\t\t\tBUG_ON(i >= nfrags);\n\n\t\t\t\tsize = skb_frag_size(frag);\n\t\t\t\tif (pos + size > offset + len)\n\t\t\t\t\tbreak;\n\n\t\t\t\ti++;\n\t\t\t\tpos += size;\n\t\t\t\tfrag++;\n\t\t\t}\n\n\t\t\tnskb = skb_clone(list_skb, GFP_ATOMIC);\n\t\t\tlist_skb = list_skb->next;\n\n\t\t\tif (unlikely(!nskb))\n\t\t\t\tgoto err;\n\n\t\t\tif (unlikely(pskb_trim(nskb, len))) {\n\t\t\t\tkfree_skb(nskb);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\thsize = skb_end_offset(nskb);\n\t\t\tif (skb_cow_head(nskb, doffset + headroom)) {\n\t\t\t\tkfree_skb(nskb);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\tnskb->truesize += skb_end_offset(nskb) - hsize;\n\t\t\tskb_release_head_state(nskb);\n\t\t\t__skb_push(nskb, doffset);\n\t\t} else {\n\t\t\tnskb = __alloc_skb(hsize + doffset + headroom,\n\t\t\t\t\t GFP_ATOMIC, skb_alloc_rx_flag(head_skb),\n\t\t\t\t\t NUMA_NO_NODE);\n\n\t\t\tif (unlikely(!nskb))\n\t\t\t\tgoto err;\n\n\t\t\tskb_reserve(nskb, headroom);\n\t\t\t__skb_put(nskb, doffset);\n\t\t}\n\n\t\tif (segs)\n\t\t\ttail->next = nskb;\n\t\telse\n\t\t\tsegs = nskb;\n\t\ttail = nskb;\n\n\t\t__copy_skb_header(nskb, head_skb);\n\t\tnskb->mac_len = head_skb->mac_len;\n\n\t\tskb_headers_offset_update(nskb, skb_headroom(nskb) - headroom);\n\n\t\tskb_copy_from_linear_data_offset(head_skb, -tnl_hlen,\n\t\t\t\t\t\t nskb->data - tnl_hlen,\n\t\t\t\t\t\t doffset + tnl_hlen);\n\n\t\tif (nskb->len == len + doffset)\n\t\t\tgoto perform_csum_check;\n\n\t\tif (!sg) {\n\t\t\tnskb->ip_summed = CHECKSUM_NONE;\n\t\t\tnskb->csum = skb_copy_and_csum_bits(head_skb, offset,\n\t\t\t\t\t\t\t skb_put(nskb, len),\n\t\t\t\t\t\t\t len, 0);\n\t\t\tcontinue;\n\t\t}\n\n\t\tnskb_frag = skb_shinfo(nskb)->frags;\n\n\t\tskb_copy_from_linear_data_offset(head_skb, offset,\n\t\t\t\t\t\t skb_put(nskb, hsize), hsize);\n\n\t\tskb_shinfo(nskb)->tx_flags = skb_shinfo(head_skb)->tx_flags &\n\t\t\tSKBTX_SHARED_FRAG;\n\n\t\twhile (pos < offset + len) {\n\t\t\tif (i >= nfrags) {\n\t\t\t\tBUG_ON(skb_headlen(list_skb));\n\n\t\t\t\ti = 0;\n\t\t\t\tnfrags = skb_shinfo(list_skb)->nr_frags;\n\t\t\t\tfrag = skb_shinfo(list_skb)->frags;\n\n\t\t\t\tBUG_ON(!nfrags);\n\n\t\t\t\tlist_skb = list_skb->next;\n\t\t\t}\n\n\t\t\tif (unlikely(skb_shinfo(nskb)->nr_frags >=\n\t\t\t\t MAX_SKB_FRAGS)) {\n\t\t\t\tnet_warn_ratelimited(\n\t\t\t\t\t\"skb_segment: too many frags: %u %u\\n\",\n\t\t\t\t\tpos, mss);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\t*nskb_frag = *frag;\n\t\t\t__skb_frag_ref(nskb_frag);\n\t\t\tsize = skb_frag_size(nskb_frag);\n\n\t\t\tif (pos < offset) {\n\t\t\t\tnskb_frag->page_offset += offset - pos;\n\t\t\t\tskb_frag_size_sub(nskb_frag, offset - pos);\n\t\t\t}\n\n\t\t\tskb_shinfo(nskb)->nr_frags++;\n\n\t\t\tif (pos + size <= offset + len) {\n\t\t\t\ti++;\n\t\t\t\tfrag++;\n\t\t\t\tpos += size;\n\t\t\t} else {\n\t\t\t\tskb_frag_size_sub(nskb_frag, pos + size - (offset + len));\n\t\t\t\tgoto skip_fraglist;\n\t\t\t}\n\n\t\t\tnskb_frag++;\n\t\t}\n\nskip_fraglist:\n\t\tnskb->data_len = len - hsize;\n\t\tnskb->len += nskb->data_len;\n\t\tnskb->truesize += nskb->data_len;\n\nperform_csum_check:\n\t\tif (!csum) {\n\t\t\tnskb->csum = skb_checksum(nskb, doffset,\n\t\t\t\t\t\t nskb->len - doffset, 0);\n\t\t\tnskb->ip_summed = CHECKSUM_NONE;\n\t\t}\n\t} while ((offset += len) < head_skb->len);\n\n\treturn segs;\n\nerr:\n\tkfree_skb_list(segs);\n\treturn ERR_PTR(err);\n}","target":"struct sk_buff *skb_segment(struct sk_buff *head_skb,\n\t\t\t netdev_features_t features)\n{\n\tstruct sk_buff *segs = NULL;\n\tstruct sk_buff *tail = NULL;\n\tstruct sk_buff *list_skb = skb_shinfo(head_skb)->frag_list;\n\tskb_frag_t *frag = skb_shinfo(head_skb)->frags;\n\tunsigned int mss = skb_shinfo(head_skb)->gso_size;\n\tunsigned int doffset = head_skb->data - skb_mac_header(head_skb);\n\tstruct sk_buff *frag_skb = head_skb;\n\tunsigned int offset = doffset;\n\tunsigned int tnl_hlen = skb_tnl_header_len(head_skb);\n\tunsigned int headroom;\n\tunsigned int len;\n\t__be16 proto;\n\tbool csum;\n\tint sg = !!(features & NETIF_F_SG);\n\tint nfrags = skb_shinfo(head_skb)->nr_frags;\n\tint err = -ENOMEM;\n\tint i = 0;\n\tint pos;\n\n\tproto = skb_network_protocol(head_skb);\n\tif (unlikely(!proto))\n\t\treturn ERR_PTR(-EINVAL);\n\n\tcsum = !!can_checksum_protocol(features, proto);\n\t__skb_push(head_skb, doffset);\n\theadroom = skb_headroom(head_skb);\n\tpos = skb_headlen(head_skb);\n\n\tdo {\n\t\tstruct sk_buff *nskb;\n\t\tskb_frag_t *nskb_frag;\n\t\tint hsize;\n\t\tint size;\n\n\t\tlen = head_skb->len - offset;\n\t\tif (len > mss)\n\t\t\tlen = mss;\n\n\t\thsize = skb_headlen(head_skb) - offset;\n\t\tif (hsize < 0)\n\t\t\thsize = 0;\n\t\tif (hsize > len || !sg)\n\t\t\thsize = len;\n\n\t\tif (!hsize && i >= nfrags && skb_headlen(list_skb) &&\n\t\t (skb_headlen(list_skb) == len || sg)) {\n\t\t\tBUG_ON(skb_headlen(list_skb) > len);\n\n\t\t\ti = 0;\n\t\t\tnfrags = skb_shinfo(list_skb)->nr_frags;\n\t\t\tfrag = skb_shinfo(list_skb)->frags;\n\t\t\tfrag_skb = list_skb;\n\t\t\tpos += skb_headlen(list_skb);\n\n\t\t\twhile (pos < offset + len) {\n\t\t\t\tBUG_ON(i >= nfrags);\n\n\t\t\t\tsize = skb_frag_size(frag);\n\t\t\t\tif (pos + size > offset + len)\n\t\t\t\t\tbreak;\n\n\t\t\t\ti++;\n\t\t\t\tpos += size;\n\t\t\t\tfrag++;\n\t\t\t}\n\n\t\t\tnskb = skb_clone(list_skb, GFP_ATOMIC);\n\t\t\tlist_skb = list_skb->next;\n\n\t\t\tif (unlikely(!nskb))\n\t\t\t\tgoto err;\n\n\t\t\tif (unlikely(pskb_trim(nskb, len))) {\n\t\t\t\tkfree_skb(nskb);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\thsize = skb_end_offset(nskb);\n\t\t\tif (skb_cow_head(nskb, doffset + headroom)) {\n\t\t\t\tkfree_skb(nskb);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\tnskb->truesize += skb_end_offset(nskb) - hsize;\n\t\t\tskb_release_head_state(nskb);\n\t\t\t__skb_push(nskb, doffset);\n\t\t} else {\n\t\t\tnskb = __alloc_skb(hsize + doffset + headroom,\n\t\t\t\t\t GFP_ATOMIC, skb_alloc_rx_flag(head_skb),\n\t\t\t\t\t NUMA_NO_NODE);\n\n\t\t\tif (unlikely(!nskb))\n\t\t\t\tgoto err;\n\n\t\t\tskb_reserve(nskb, headroom);\n\t\t\t__skb_put(nskb, doffset);\n\t\t}\n\n\t\tif (segs)\n\t\t\ttail->next = nskb;\n\t\telse\n\t\t\tsegs = nskb;\n\t\ttail = nskb;\n\n\t\t__copy_skb_header(nskb, head_skb);\n\t\tnskb->mac_len = head_skb->mac_len;\n\n\t\tskb_headers_offset_update(nskb, skb_headroom(nskb) - headroom);\n\n\t\tskb_copy_from_linear_data_offset(head_skb, -tnl_hlen,\n\t\t\t\t\t\t nskb->data - tnl_hlen,\n\t\t\t\t\t\t doffset + tnl_hlen);\n\n\t\tif (nskb->len == len + doffset)\n\t\t\tgoto perform_csum_check;\n\n\t\tif (!sg) {\n\t\t\tnskb->ip_summed = CHECKSUM_NONE;\n\t\t\tnskb->csum = skb_copy_and_csum_bits(head_skb, offset,\n\t\t\t\t\t\t\t skb_put(nskb, len),\n\t\t\t\t\t\t\t len, 0);\n\t\t\tcontinue;\n\t\t}\n\n\t\tnskb_frag = skb_shinfo(nskb)->frags;\n\n\t\tskb_copy_from_linear_data_offset(head_skb, offset,\n\t\t\t\t\t\t skb_put(nskb, hsize), hsize);\n\n\t\tskb_shinfo(nskb)->tx_flags = skb_shinfo(head_skb)->tx_flags &\n\t\t\tSKBTX_SHARED_FRAG;\n\n\t\twhile (pos < offset + len) {\n\t\t\tif (i >= nfrags) {\n\t\t\t\tBUG_ON(skb_headlen(list_skb));\n\n\t\t\t\ti = 0;\n\t\t\t\tnfrags = skb_shinfo(list_skb)->nr_frags;\n\t\t\t\tfrag = skb_shinfo(list_skb)->frags;\n\t\t\t\tfrag_skb = list_skb;\n\n\t\t\t\tBUG_ON(!nfrags);\n\n\t\t\t\tlist_skb = list_skb->next;\n\t\t\t}\n\n\t\t\tif (unlikely(skb_shinfo(nskb)->nr_frags >=\n\t\t\t\t MAX_SKB_FRAGS)) {\n\t\t\t\tnet_warn_ratelimited(\n\t\t\t\t\t\"skb_segment: too many frags: %u %u\\n\",\n\t\t\t\t\tpos, mss);\n\t\t\t\tgoto err;\n\t\t\t}\n\n\t\t\tif (unlikely(skb_orphan_frags(frag_skb, GFP_ATOMIC)))\n\t\t\t\tgoto err;\n\n\t\t\t*nskb_frag = *frag;\n\t\t\t__skb_frag_ref(nskb_frag);\n\t\t\tsize = skb_frag_size(nskb_frag);\n\n\t\t\tif (pos < offset) {\n\t\t\t\tnskb_frag->page_offset += offset - pos;\n\t\t\t\tskb_frag_size_sub(nskb_frag, offset - pos);\n\t\t\t}\n\n\t\t\tskb_shinfo(nskb)->nr_frags++;\n\n\t\t\tif (pos + size <= offset + len) {\n\t\t\t\ti++;\n\t\t\t\tfrag++;\n\t\t\t\tpos += size;\n\t\t\t} else {\n\t\t\t\tskb_frag_size_sub(nskb_frag, pos + size - (offset + len));\n\t\t\t\tgoto skip_fraglist;\n\t\t\t}\n\n\t\t\tnskb_frag++;\n\t\t}\n\nskip_fraglist:\n\t\tnskb->data_len = len - hsize;\n\t\tnskb->len += nskb->data_len;\n\t\tnskb->truesize += nskb->data_len;\n\nperform_csum_check:\n\t\tif (!csum) {\n\t\t\tnskb->csum = skb_checksum(nskb, doffset,\n\t\t\t\t\t\t nskb->len - doffset, 0);\n\t\t\tnskb->ip_summed = CHECKSUM_NONE;\n\t\t}\n\t} while ((offset += len) < head_skb->len);\n\n\treturn segs;\n\nerr:\n\tkfree_skb_list(segs);\n\treturn ERR_PTR(err);\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"skb_segment","file_name":"net/core/skbuff.c","commit_link":"github.com/torvalds/linux/commit/1fd819ecb90cc9b822cd84d3056ddba315d3340f","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#4-c2981f6cf866","input":"void usb_serial_console_disconnect(struct usb_serial *serial)\n{\n\tif (serial->port[0] == usbcons_info.port) {\n\t\tusb_serial_console_exit();\n\t\tusb_serial_put(serial);\n\t}\n}","target":"void usb_serial_console_disconnect(struct usb_serial *serial)\n{\n\tif (serial->port[0] && serial->port[0] == usbcons_info.port) {\n\t\tusb_serial_console_exit();\n\t\tusb_serial_put(serial);\n\t}\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"usb_serial_console_disconnect","file_name":"drivers/usb/serial/console.c","commit_link":"github.com/torvalds/linux/commit/bd998c2e0df0469707503023d50d46cf0b10c787","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#5-f61743563a32","input":"int blk_init_allocated_queue(struct request_queue *q)\n{\n\tWARN_ON_ONCE(q->mq_ops);\n\n\tq->fq = blk_alloc_flush_queue(q, NUMA_NO_NODE, q->cmd_size);\n\tif (!q->fq)\n\t\treturn -ENOMEM;\n\n\tif (q->init_rq_fn && q->init_rq_fn(q, q->fq->flush_rq, GFP_KERNEL))\n\t\tgoto out_free_flush_queue;\n\n\tif (blk_init_rl(&q->root_rl, q, GFP_KERNEL))\n\t\tgoto out_exit_flush_rq;\n\n\tINIT_WORK(&q->timeout_work, blk_timeout_work);\n\tq->queue_flags\t\t|= QUEUE_FLAG_DEFAULT;\n\n\t/*\n\t * This also sets hw/phys segments, boundary and size\n\t */\n\tblk_queue_make_request(q, blk_queue_bio);\n\n\tq->sg_reserved_size = INT_MAX;\n\n\tif (elevator_init(q))\n\t\tgoto out_exit_flush_rq;\n\treturn 0;\n\nout_exit_flush_rq:\n\tif (q->exit_rq_fn)\n\t\tq->exit_rq_fn(q, q->fq->flush_rq);\nout_free_flush_queue:\n\tblk_free_flush_queue(q->fq);\n\treturn -ENOMEM;\n}","target":"int blk_init_allocated_queue(struct request_queue *q)\n{\n\tWARN_ON_ONCE(q->mq_ops);\n\n\tq->fq = blk_alloc_flush_queue(q, NUMA_NO_NODE, q->cmd_size);\n\tif (!q->fq)\n\t\treturn -ENOMEM;\n\n\tif (q->init_rq_fn && q->init_rq_fn(q, q->fq->flush_rq, GFP_KERNEL))\n\t\tgoto out_free_flush_queue;\n\n\tif (blk_init_rl(&q->root_rl, q, GFP_KERNEL))\n\t\tgoto out_exit_flush_rq;\n\n\tINIT_WORK(&q->timeout_work, blk_timeout_work);\n\tq->queue_flags\t\t|= QUEUE_FLAG_DEFAULT;\n\n\t/*\n\t * This also sets hw/phys segments, boundary and size\n\t */\n\tblk_queue_make_request(q, blk_queue_bio);\n\n\tq->sg_reserved_size = INT_MAX;\n\n\tif (elevator_init(q))\n\t\tgoto out_exit_flush_rq;\n\treturn 0;\n\nout_exit_flush_rq:\n\tif (q->exit_rq_fn)\n\t\tq->exit_rq_fn(q, q->fq->flush_rq);\nout_free_flush_queue:\n\tblk_free_flush_queue(q->fq);\n\tq->fq = NULL;\n\treturn -ENOMEM;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"blk_init_allocated_queue","file_name":"block/blk-core.c","commit_link":"github.com/torvalds/linux/commit/54648cf1ec2d7f4b6a71767799c45676a138ca24","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-416#6-9581a4247980","input":"int snd_timer_open(struct snd_timer_instance **ti,\n\t\t char *owner, struct snd_timer_id *tid,\n\t\t unsigned int slave_id)\n{\n\tstruct snd_timer *timer;\n\tstruct snd_timer_instance *timeri = NULL;\n\tstruct device *card_dev_to_put = NULL;\n\tint err;\n\n\tmutex_lock(®ister_mutex);\n\tif (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {\n\t\t/* open a slave instance */\n\t\tif (tid->dev_sclass <= SNDRV_TIMER_SCLASS_NONE ||\n\t\t tid->dev_sclass > SNDRV_TIMER_SCLASS_OSS_SEQUENCER) {\n\t\t\tpr_debug(\"ALSA: timer: invalid slave class %i\\n\",\n\t\t\t\t tid->dev_sclass);\n\t\t\terr = -EINVAL;\n\t\t\tgoto unlock;\n\t\t}\n\t\ttimeri = snd_timer_instance_new(owner, NULL);\n\t\tif (!timeri) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto unlock;\n\t\t}\n\t\ttimeri->slave_class = tid->dev_sclass;\n\t\ttimeri->slave_id = tid->device;\n\t\ttimeri->flags |= SNDRV_TIMER_IFLG_SLAVE;\n\t\tlist_add_tail(&timeri->open_list, &snd_timer_slave_list);\n\t\terr = snd_timer_check_slave(timeri);\n\t\tif (err < 0) {\n\t\t\tsnd_timer_close_locked(timeri, &card_dev_to_put);\n\t\t\ttimeri = NULL;\n\t\t}\n\t\tgoto unlock;\n\t}\n\n\t/* open a master instance */\n\ttimer = snd_timer_find(tid);\n#ifdef CONFIG_MODULES\n\tif (!timer) {\n\t\tmutex_unlock(®ister_mutex);\n\t\tsnd_timer_request(tid);\n\t\tmutex_lock(®ister_mutex);\n\t\ttimer = snd_timer_find(tid);\n\t}\n#endif\n\tif (!timer) {\n\t\terr = -ENODEV;\n\t\tgoto unlock;\n\t}\n\tif (!list_empty(&timer->open_list_head)) {\n\t\ttimeri = list_entry(timer->open_list_head.next,\n\t\t\t\t struct snd_timer_instance, open_list);\n\t\tif (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) {\n\t\t\terr = -EBUSY;\n\t\t\ttimeri = NULL;\n\t\t\tgoto unlock;\n\t\t}\n\t}\n\tif (timer->num_instances >= timer->max_instances) {\n\t\terr = -EBUSY;\n\t\tgoto unlock;\n\t}\n\ttimeri = snd_timer_instance_new(owner, timer);\n\tif (!timeri) {\n\t\terr = -ENOMEM;\n\t\tgoto unlock;\n\t}\n\t/* take a card refcount for safe disconnection */\n\tif (timer->card)\n\t\tget_device(&timer->card->card_dev);\n\ttimeri->slave_class = tid->dev_sclass;\n\ttimeri->slave_id = slave_id;\n\n\tif (list_empty(&timer->open_list_head) && timer->hw.open) {\n\t\terr = timer->hw.open(timer);\n\t\tif (err) {\n\t\t\tkfree(timeri->owner);\n\t\t\tkfree(timeri);\n\t\t\ttimeri = NULL;\n\n\t\t\tif (timer->card)\n\t\t\t\tcard_dev_to_put = &timer->card->card_dev;\n\t\t\tmodule_put(timer->module);\n\t\t\tgoto unlock;\n\t\t}\n\t}\n\n\tlist_add_tail(&timeri->open_list, &timer->open_list_head);\n\ttimer->num_instances++;\n\terr = snd_timer_check_master(timeri);\n\tif (err < 0) {\n\t\tsnd_timer_close_locked(timeri, &card_dev_to_put);\n\t\ttimeri = NULL;\n\t}\n\n unlock:\n\tmutex_unlock(®ister_mutex);\n\t/* put_device() is called after unlock for avoiding deadlock */\n\tif (card_dev_to_put)\n\t\tput_device(card_dev_to_put);\n\t*ti = timeri;\n\treturn err;\n}","target":"int snd_timer_open(struct snd_timer_instance **ti,\n\t\t char *owner, struct snd_timer_id *tid,\n\t\t unsigned int slave_id)\n{\n\tstruct snd_timer *timer;\n\tstruct snd_timer_instance *timeri = NULL;\n\tstruct device *card_dev_to_put = NULL;\n\tint err;\n\n\tmutex_lock(®ister_mutex);\n\tif (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {\n\t\t/* open a slave instance */\n\t\tif (tid->dev_sclass <= SNDRV_TIMER_SCLASS_NONE ||\n\t\t tid->dev_sclass > SNDRV_TIMER_SCLASS_OSS_SEQUENCER) {\n\t\t\tpr_debug(\"ALSA: timer: invalid slave class %i\\n\",\n\t\t\t\t tid->dev_sclass);\n\t\t\terr = -EINVAL;\n\t\t\tgoto unlock;\n\t\t}\n\t\ttimeri = snd_timer_instance_new(owner, NULL);\n\t\tif (!timeri) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto unlock;\n\t\t}\n\t\ttimeri->slave_class = tid->dev_sclass;\n\t\ttimeri->slave_id = tid->device;\n\t\ttimeri->flags |= SNDRV_TIMER_IFLG_SLAVE;\n\t\tlist_add_tail(&timeri->open_list, &snd_timer_slave_list);\n\t\terr = snd_timer_check_slave(timeri);\n\t\tif (err < 0) {\n\t\t\tsnd_timer_close_locked(timeri, &card_dev_to_put);\n\t\t\ttimeri = NULL;\n\t\t}\n\t\tgoto unlock;\n\t}\n\n\t/* open a master instance */\n\ttimer = snd_timer_find(tid);\n#ifdef CONFIG_MODULES\n\tif (!timer) {\n\t\tmutex_unlock(®ister_mutex);\n\t\tsnd_timer_request(tid);\n\t\tmutex_lock(®ister_mutex);\n\t\ttimer = snd_timer_find(tid);\n\t}\n#endif\n\tif (!timer) {\n\t\terr = -ENODEV;\n\t\tgoto unlock;\n\t}\n\tif (!list_empty(&timer->open_list_head)) {\n\t\tstruct snd_timer_instance *t =\n\t\t\tlist_entry(timer->open_list_head.next,\n\t\t\t\t struct snd_timer_instance, open_list);\n\t\tif (t->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) {\n\t\t\terr = -EBUSY;\n\t\t\tgoto unlock;\n\t\t}\n\t}\n\tif (timer->num_instances >= timer->max_instances) {\n\t\terr = -EBUSY;\n\t\tgoto unlock;\n\t}\n\ttimeri = snd_timer_instance_new(owner, timer);\n\tif (!timeri) {\n\t\terr = -ENOMEM;\n\t\tgoto unlock;\n\t}\n\t/* take a card refcount for safe disconnection */\n\tif (timer->card)\n\t\tget_device(&timer->card->card_dev);\n\ttimeri->slave_class = tid->dev_sclass;\n\ttimeri->slave_id = slave_id;\n\n\tif (list_empty(&timer->open_list_head) && timer->hw.open) {\n\t\terr = timer->hw.open(timer);\n\t\tif (err) {\n\t\t\tkfree(timeri->owner);\n\t\t\tkfree(timeri);\n\t\t\ttimeri = NULL;\n\n\t\t\tif (timer->card)\n\t\t\t\tcard_dev_to_put = &timer->card->card_dev;\n\t\t\tmodule_put(timer->module);\n\t\t\tgoto unlock;\n\t\t}\n\t}\n\n\tlist_add_tail(&timeri->open_list, &timer->open_list_head);\n\ttimer->num_instances++;\n\terr = snd_timer_check_master(timeri);\n\tif (err < 0) {\n\t\tsnd_timer_close_locked(timeri, &card_dev_to_put);\n\t\ttimeri = NULL;\n\t}\n\n unlock:\n\tmutex_unlock(®ister_mutex);\n\t/* put_device() is called after unlock for avoiding deadlock */\n\tif (card_dev_to_put)\n\t\tput_device(card_dev_to_put);\n\t*ti = timeri;\n\treturn err;\n}","lang":"c","vul_type":"cwe-416","sven_meta":{"func_name":"snd_timer_open","file_name":"sound/core/timer.c","commit_link":"github.com/torvalds/linux/commit/e7af6307a8a54f0b873960b32b6a644f2d0fbd97","source_cwe_file":"cwe-416.jsonl"}} +{"problem_id":"cwe-022#0-68e32b5cd09e","input":"def getKey(client):\n\t\"\"\"Retrieves the specified key for the specified client\n\tReturns an error if the key doesn't exist, obviously.\n\t\"\"\"\n\tglobal SERVER_JWT_PRIVATE_KEY\n\tglobal BAD_REQUEST\n\n\tvalidateClient(client)\n\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\n\t# Keys may only have alpha-numeric names\n\ttry:\n\t\tif re.search('[^a-zA-Z0-9]', token_data['key']):\n\t\t\traise FoxlockError(BAD_REQUEST, 'Invalid key requested')\n\t\trequested_key = open('keys/%s/%s.key' % (client, token_data['key']), 'r').read()\n\texcept KeyError:\n\t\traise FoxlockError(BAD_REQUEST, \"JWT did not contain attribute 'key'\")\n\texcept IOError:\n\t\traise FoxlockError(BAD_REQUEST, \"Key '%s' not found\" % token_data['key'])\n\n\t# Key is returned in a JWT encrypted with the client's public key, so only they can decrypt it\n\tkeytoken = packJWT({'key': requested_key}, SERVER_JWT_PRIVATE_KEY, client_pub_key)\n\n\treturn keytoken","target":"def getKey(client):\n\t\"\"\"Retrieves the specified key for the specified client\n\tReturns an error if the key doesn't exist, obviously.\n\t\"\"\"\n\tglobal SERVER_JWT_PRIVATE_KEY\n\tglobal BAD_REQUEST\n\n\tvalidateClient(client)\n\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tvalidateKeyName(token_data['key'])\n\n\t# Keys may only have alpha-numeric names\n\ttry:\n\t\trequested_key = open('keys/%s/%s.key' % (client, token_data['key']), 'r').read()\n\texcept KeyError:\n\t\traise FoxlockError(BAD_REQUEST, \"JWT did not contain attribute 'key'\")\n\texcept IOError:\n\t\traise FoxlockError(BAD_REQUEST, \"Key '%s' not found\" % token_data['key'])\n\n\t# Key is returned in a JWT encrypted with the client's public key, so only they can decrypt it\n\tkeytoken = packJWT({'key': requested_key}, SERVER_JWT_PRIVATE_KEY, client_pub_key)\n\n\treturn keytoken","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"getKey","file_name":"impl.py","commit_link":"github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#1-36cdce9d7a8f","input":"void ImportEPUB::ExtractContainer()\n{\n int res = 0;\n if (!cp437) {\n cp437 = new QCodePage437Codec();\n }\n#ifdef Q_OS_WIN32\n zlib_filefunc64_def ffunc;\n fill_win32_filefunc64W(&ffunc);\n unzFile zfile = unzOpen2_64(Utility::QStringToStdWString(QDir::toNativeSeparators(m_FullFilePath)).c_str(), &ffunc);\n#else\n unzFile zfile = unzOpen64(QDir::toNativeSeparators(m_FullFilePath).toUtf8().constData());\n#endif\n\n if (zfile == NULL) {\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot unzip EPUB: %1\")).arg(QDir::toNativeSeparators(m_FullFilePath)).toStdString()));\n }\n\n res = unzGoToFirstFile(zfile);\n\n if (res == UNZ_OK) {\n do {\n // Get the name of the file in the archive.\n char file_name[MAX_PATH] = {0};\n unz_file_info64 file_info;\n unzGetCurrentFileInfo64(zfile, &file_info, file_name, MAX_PATH, NULL, 0, NULL, 0);\n QString qfile_name;\n QString cp437_file_name;\n qfile_name = QString::fromUtf8(file_name);\n if (!(file_info.flag & (1<<11))) {\n // General purpose bit 11 says the filename is utf-8 encoded. If not set then\n // IBM 437 encoding might be used.\n cp437_file_name = cp437->toUnicode(file_name);\n }\n\n // If there is no file name then we can't do anything with it.\n if (!qfile_name.isEmpty()) {\n // We use the dir object to create the path in the temporary directory.\n // Unfortunately, we need a dir ojbect to do this as it's not a static function.\n QDir dir(m_ExtractedFolderPath);\n // Full file path in the temporary directory.\n QString file_path = m_ExtractedFolderPath + \"/\" + qfile_name;\n QFileInfo qfile_info(file_path);\n\n // Is this entry a directory?\n if (file_info.uncompressed_size == 0 && qfile_name.endsWith('/')) {\n dir.mkpath(qfile_name);\n continue;\n } else {\n dir.mkpath(qfile_info.path());\n\t\t // add it to the list of files found inside the zip\n\t\t if (cp437_file_name.isEmpty()) {\n\t\t m_ZipFilePaths << qfile_name;\n\t\t } else {\n m_ZipFilePaths << cp437_file_name;\n\t\t }\n }\n\n // Open the file entry in the archive for reading.\n if (unzOpenCurrentFile(zfile) != UNZ_OK) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // Open the file on disk to write the entry in the archive to.\n QFile entry(file_path);\n\n if (!entry.open(QIODevice::WriteOnly | QIODevice::Truncate)) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // Buffered reading and writing.\n char buff[BUFF_SIZE] = {0};\n int read = 0;\n\n while ((read = unzReadCurrentFile(zfile, buff, BUFF_SIZE)) > 0) {\n entry.write(buff, read);\n }\n\n entry.close();\n\n // Read errors are marked by a negative read amount.\n if (read < 0) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // The file was read but the CRC did not match.\n // We don't check the read file size vs the uncompressed file size\n // because if they're different there should be a CRC error.\n if (unzCloseCurrentFile(zfile) == UNZ_CRCERROR) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n if (!cp437_file_name.isEmpty() && cp437_file_name != qfile_name) {\n QString cp437_file_path = m_ExtractedFolderPath + \"/\" + cp437_file_name;\n QFile::copy(file_path, cp437_file_path);\n }\n }\n } while ((res = unzGoToNextFile(zfile)) == UNZ_OK);\n }\n\n if (res != UNZ_END_OF_LIST_OF_FILE) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot open EPUB: %1\")).arg(QDir::toNativeSeparators(m_FullFilePath)).toStdString()));\n }\n\n unzClose(zfile);\n}","target":"void ImportEPUB::ExtractContainer()\n{\n int res = 0;\n if (!cp437) {\n cp437 = new QCodePage437Codec();\n }\n#ifdef Q_OS_WIN32\n zlib_filefunc64_def ffunc;\n fill_win32_filefunc64W(&ffunc);\n unzFile zfile = unzOpen2_64(Utility::QStringToStdWString(QDir::toNativeSeparators(m_FullFilePath)).c_str(), &ffunc);\n#else\n unzFile zfile = unzOpen64(QDir::toNativeSeparators(m_FullFilePath).toUtf8().constData());\n#endif\n\n if (zfile == NULL) {\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot unzip EPUB: %1\")).arg(QDir::toNativeSeparators(m_FullFilePath)).toStdString()));\n }\n\n res = unzGoToFirstFile(zfile);\n\n if (res == UNZ_OK) {\n do {\n // Get the name of the file in the archive.\n char file_name[MAX_PATH] = {0};\n unz_file_info64 file_info;\n unzGetCurrentFileInfo64(zfile, &file_info, file_name, MAX_PATH, NULL, 0, NULL, 0);\n QString qfile_name;\n QString cp437_file_name;\n qfile_name = QString::fromUtf8(file_name);\n if (!(file_info.flag & (1<<11))) {\n // General purpose bit 11 says the filename is utf-8 encoded. If not set then\n // IBM 437 encoding might be used.\n cp437_file_name = cp437->toUnicode(file_name);\n }\n\n // If there is no file name then we can't do anything with it.\n if (!qfile_name.isEmpty()) {\n\n\t // for security reasons we need the file path to always be inside the \n // target folder and not outside, so we will remove all relative upward \n // paths segments \"..\" from the file path before prepending the target \n // folder to create the final target path\n\t qfile_name = qfile_name.replace(\"../\",\"\");\n cp437_file_name = cp437_file_name.replace(\"../\",\"\");\n\n // We use the dir object to create the path in the temporary directory.\n // Unfortunately, we need a dir ojbect to do this as it's not a static function.\n QDir dir(m_ExtractedFolderPath);\n // Full file path in the temporary directory.\n QString file_path = m_ExtractedFolderPath + \"/\" + qfile_name;\n QFileInfo qfile_info(file_path);\n\n // Is this entry a directory?\n if (file_info.uncompressed_size == 0 && qfile_name.endsWith('/')) {\n dir.mkpath(qfile_name);\n continue;\n } else {\n dir.mkpath(qfile_info.path());\n\t\t // add it to the list of files found inside the zip\n\t\t if (cp437_file_name.isEmpty()) {\n\t\t m_ZipFilePaths << qfile_name;\n\t\t } else {\n m_ZipFilePaths << cp437_file_name;\n\t\t }\n }\n\n // Open the file entry in the archive for reading.\n if (unzOpenCurrentFile(zfile) != UNZ_OK) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // Open the file on disk to write the entry in the archive to.\n QFile entry(file_path);\n\n if (!entry.open(QIODevice::WriteOnly | QIODevice::Truncate)) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // Buffered reading and writing.\n char buff[BUFF_SIZE] = {0};\n int read = 0;\n\n while ((read = unzReadCurrentFile(zfile, buff, BUFF_SIZE)) > 0) {\n entry.write(buff, read);\n }\n\n entry.close();\n\n // Read errors are marked by a negative read amount.\n if (read < 0) {\n unzCloseCurrentFile(zfile);\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n\n // The file was read but the CRC did not match.\n // We don't check the read file size vs the uncompressed file size\n // because if they're different there should be a CRC error.\n if (unzCloseCurrentFile(zfile) == UNZ_CRCERROR) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot extract file: %1\")).arg(qfile_name).toStdString()));\n }\n if (!cp437_file_name.isEmpty() && cp437_file_name != qfile_name) {\n QString cp437_file_path = m_ExtractedFolderPath + \"/\" + cp437_file_name;\n QFile::copy(file_path, cp437_file_path);\n }\n }\n } while ((res = unzGoToNextFile(zfile)) == UNZ_OK);\n }\n\n if (res != UNZ_END_OF_LIST_OF_FILE) {\n unzClose(zfile);\n throw (EPUBLoadParseError(QString(QObject::tr(\"Cannot open EPUB: %1\")).arg(QDir::toNativeSeparators(m_FullFilePath)).toStdString()));\n }\n\n unzClose(zfile);\n}","lang":"cpp","vul_type":"cwe-022","sven_meta":{"func_name":"ImportEPUB::ExtractContainer","file_name":"src/Importers/ImportEPUB.cpp","commit_link":"github.com/Sigil-Ebook/Sigil/commit/369eebe936e4a8c83cc54662a3412ce8bef189e4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#2-2fb22e67d2c4","input":"static MagickBooleanType GetMagickModulePath(const char *filename,\n MagickModuleType module_type,char *path,ExceptionInfo *exception)\n{\n char\n *module_path;\n\n assert(filename != (const char *) NULL);\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n assert(path != (char *) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n (void) CopyMagickString(path,filename,MaxTextExtent);\n module_path=(char *) NULL;\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n (void) LogMagickEvent(ModuleEvent,GetMagickModule(),\n \"Searching for coder module file \\\"%s\\\" ...\",filename);\n module_path=GetEnvironmentValue(\"MAGICK_CODER_MODULE_PATH\");\n#if defined(MAGICKCORE_CODER_PATH)\n if (module_path == (char *) NULL)\n module_path=AcquireString(MAGICKCORE_CODER_PATH);\n#endif\n break;\n }\n case MagickImageFilterModule:\n {\n (void) LogMagickEvent(ModuleEvent,GetMagickModule(),\n \"Searching for filter module file \\\"%s\\\" ...\",filename);\n module_path=GetEnvironmentValue(\"MAGICK_CODER_FILTER_PATH\");\n#if defined(MAGICKCORE_FILTER_PATH)\n if (module_path == (char *) NULL)\n module_path=AcquireString(MAGICKCORE_FILTER_PATH);\n#endif\n break;\n }\n }\n if (module_path != (char *) NULL)\n {\n register char\n *p,\n *q;\n\n for (p=module_path-1; p != (char *) NULL; )\n {\n (void) CopyMagickString(path,p+1,MaxTextExtent);\n q=strchr(path,DirectoryListSeparator);\n if (q != (char *) NULL)\n *q='\\0';\n q=path+strlen(path)-1;\n if ((q >= path) && (*q != *DirectorySeparator))\n (void) ConcatenateMagickString(path,DirectorySeparator,MaxTextExtent);\n (void) ConcatenateMagickString(path,filename,MaxTextExtent);\n if (IsPathAccessible(path) != MagickFalse)\n {\n module_path=DestroyString(module_path);\n return(MagickTrue);\n }\n p=strchr(p+1,DirectoryListSeparator);\n }\n module_path=DestroyString(module_path);\n }\n#if defined(MAGICKCORE_INSTALLED_SUPPORT)\n else\n#if defined(MAGICKCORE_CODER_PATH)\n {\n const char\n *directory;\n\n /*\n Search hard coded paths.\n */\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=MAGICKCORE_CODER_PATH;\n break;\n }\n case MagickImageFilterModule:\n {\n directory=MAGICKCORE_FILTER_PATH;\n break;\n }\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s\",directory,filename);\n if (IsPathAccessible(path) == MagickFalse)\n {\n ThrowFileException(exception,ConfigureWarning,\n \"UnableToOpenModuleFile\",path);\n return(MagickFalse);\n }\n return(MagickTrue);\n }\n#else\n#if defined(MAGICKCORE_WINDOWS_SUPPORT)\n {\n const char\n *registery_key;\n\n unsigned char\n *key_value;\n\n /*\n Locate path via registry key.\n */\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n registery_key=\"CoderModulesPath\";\n break;\n }\n case MagickImageFilterModule:\n {\n registery_key=\"FilterModulesPath\";\n break;\n }\n }\n key_value=NTRegistryKeyLookup(registery_key);\n if (key_value == (unsigned char *) NULL)\n {\n ThrowMagickException(exception,GetMagickModule(),ConfigureError,\n \"RegistryKeyLookupFailed\",\"`%s'\",registery_key);\n return(MagickFalse);\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",(char *) key_value,\n DirectorySeparator,filename);\n key_value=(unsigned char *) RelinquishMagickMemory(key_value);\n if (IsPathAccessible(path) == MagickFalse)\n {\n ThrowFileException(exception,ConfigureWarning,\n \"UnableToOpenModuleFile\",path);\n return(MagickFalse);\n }\n return(MagickTrue);\n }\n#endif\n#endif\n#if !defined(MAGICKCORE_CODER_PATH) && !defined(MAGICKCORE_WINDOWS_SUPPORT)\n# error MAGICKCORE_CODER_PATH or MAGICKCORE_WINDOWS_SUPPORT must be defined when MAGICKCORE_INSTALLED_SUPPORT is defined\n#endif\n#else\n {\n char\n *home;\n\n home=GetEnvironmentValue(\"MAGICK_HOME\");\n if (home != (char *) NULL)\n {\n /*\n Search MAGICK_HOME.\n */\n#if !defined(MAGICKCORE_POSIX_SUPPORT)\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",home,\n DirectorySeparator,filename);\n#else\n const char\n *directory;\n\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=MAGICKCORE_CODER_RELATIVE_PATH;\n break;\n }\n case MagickImageFilterModule:\n {\n directory=MAGICKCORE_FILTER_RELATIVE_PATH;\n break;\n }\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s/lib/%s/%s\",home,\n directory,filename);\n#endif\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n if (*GetClientPath() != '\\0')\n {\n /*\n Search based on executable directory.\n */\n#if !defined(MAGICKCORE_POSIX_SUPPORT)\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",GetClientPath(),\n DirectorySeparator,filename);\n#else\n char\n prefix[MaxTextExtent];\n\n const char\n *directory;\n\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=\"coders\";\n break;\n }\n case MagickImageFilterModule:\n {\n directory=\"filters\";\n break;\n }\n }\n (void) CopyMagickString(prefix,GetClientPath(),MaxTextExtent);\n ChopPathComponents(prefix,1);\n (void) FormatLocaleString(path,MaxTextExtent,\"%s/lib/%s/%s/%s\",prefix,\n MAGICKCORE_MODULES_RELATIVE_PATH,directory,filename);\n#endif\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n#if defined(MAGICKCORE_WINDOWS_SUPPORT)\n {\n /*\n Search module path.\n */\n if ((NTGetModulePath(\"CORE_RL_magick_.dll\",path) != MagickFalse) ||\n (NTGetModulePath(\"CORE_DB_magick_.dll\",path) != MagickFalse) ||\n (NTGetModulePath(\"Magick.dll\",path) != MagickFalse))\n {\n (void) ConcatenateMagickString(path,DirectorySeparator,MaxTextExtent);\n (void) ConcatenateMagickString(path,filename,MaxTextExtent);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n#endif\n {\n char\n *home;\n\n home=GetEnvironmentValue(\"XDG_CONFIG_HOME\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"LOCALAPPDATA\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"APPDATA\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"USERPROFILE\");\n if (home != (char *) NULL)\n {\n /*\n Search $XDG_CONFIG_HOME/ImageMagick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%sImageMagick%s%s\",\n home,DirectorySeparator,DirectorySeparator,filename);\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n home=GetEnvironmentValue(\"HOME\");\n if (home != (char *) NULL)\n {\n /*\n Search $HOME/.config/ImageMagick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\n \"%s%s.config%sImageMagick%s%s\",home,DirectorySeparator,\n DirectorySeparator,DirectorySeparator,filename);\n if (IsPathAccessible(path) != MagickFalse)\n {\n home=DestroyString(home);\n return(MagickTrue);\n }\n /*\n Search $HOME/.magick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s.magick%s%s\",home,\n DirectorySeparator,DirectorySeparator,filename);\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n /*\n Search current directory.\n */\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n if (exception->severity < ConfigureError)\n ThrowFileException(exception,ConfigureWarning,\"UnableToOpenModuleFile\",\n path);\n#endif\n return(MagickFalse);\n}","target":"static MagickBooleanType GetMagickModulePath(const char *filename,\n MagickModuleType module_type,char *path,ExceptionInfo *exception)\n{\n char\n *module_path;\n\n assert(filename != (const char *) NULL);\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n assert(path != (char *) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n (void) CopyMagickString(path,filename,MaxTextExtent);\n#if defined(MAGICKCORE_INSTALLED_SUPPORT)\n if (strstr(path,\"../\") != (char *) NULL)\n {\n errno=EPERM;\n (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,\n \"NotAuthorized\",\"`%s'\",path);\n return(MagickFalse);\n }\n#endif\n module_path=(char *) NULL;\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n (void) LogMagickEvent(ModuleEvent,GetMagickModule(),\n \"Searching for coder module file \\\"%s\\\" ...\",filename);\n module_path=GetEnvironmentValue(\"MAGICK_CODER_MODULE_PATH\");\n#if defined(MAGICKCORE_CODER_PATH)\n if (module_path == (char *) NULL)\n module_path=AcquireString(MAGICKCORE_CODER_PATH);\n#endif\n break;\n }\n case MagickImageFilterModule:\n {\n (void) LogMagickEvent(ModuleEvent,GetMagickModule(),\n \"Searching for filter module file \\\"%s\\\" ...\",filename);\n module_path=GetEnvironmentValue(\"MAGICK_CODER_FILTER_PATH\");\n#if defined(MAGICKCORE_FILTER_PATH)\n if (module_path == (char *) NULL)\n module_path=AcquireString(MAGICKCORE_FILTER_PATH);\n#endif\n break;\n }\n }\n if (module_path != (char *) NULL)\n {\n register char\n *p,\n *q;\n\n for (p=module_path-1; p != (char *) NULL; )\n {\n (void) CopyMagickString(path,p+1,MaxTextExtent);\n q=strchr(path,DirectoryListSeparator);\n if (q != (char *) NULL)\n *q='\\0';\n q=path+strlen(path)-1;\n if ((q >= path) && (*q != *DirectorySeparator))\n (void) ConcatenateMagickString(path,DirectorySeparator,MaxTextExtent);\n (void) ConcatenateMagickString(path,filename,MaxTextExtent);\n if (IsPathAccessible(path) != MagickFalse)\n {\n module_path=DestroyString(module_path);\n return(MagickTrue);\n }\n p=strchr(p+1,DirectoryListSeparator);\n }\n module_path=DestroyString(module_path);\n }\n#if defined(MAGICKCORE_INSTALLED_SUPPORT)\n else\n#if defined(MAGICKCORE_CODER_PATH)\n {\n const char\n *directory;\n\n /*\n Search hard coded paths.\n */\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=MAGICKCORE_CODER_PATH;\n break;\n }\n case MagickImageFilterModule:\n {\n directory=MAGICKCORE_FILTER_PATH;\n break;\n }\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s\",directory,filename);\n if (IsPathAccessible(path) == MagickFalse)\n {\n ThrowFileException(exception,ConfigureWarning,\n \"UnableToOpenModuleFile\",path);\n return(MagickFalse);\n }\n return(MagickTrue);\n }\n#else\n#if defined(MAGICKCORE_WINDOWS_SUPPORT)\n {\n const char\n *registery_key;\n\n unsigned char\n *key_value;\n\n /*\n Locate path via registry key.\n */\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n registery_key=\"CoderModulesPath\";\n break;\n }\n case MagickImageFilterModule:\n {\n registery_key=\"FilterModulesPath\";\n break;\n }\n }\n key_value=NTRegistryKeyLookup(registery_key);\n if (key_value == (unsigned char *) NULL)\n {\n ThrowMagickException(exception,GetMagickModule(),ConfigureError,\n \"RegistryKeyLookupFailed\",\"`%s'\",registery_key);\n return(MagickFalse);\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",(char *) key_value,\n DirectorySeparator,filename);\n key_value=(unsigned char *) RelinquishMagickMemory(key_value);\n if (IsPathAccessible(path) == MagickFalse)\n {\n ThrowFileException(exception,ConfigureWarning,\n \"UnableToOpenModuleFile\",path);\n return(MagickFalse);\n }\n return(MagickTrue);\n }\n#endif\n#endif\n#if !defined(MAGICKCORE_CODER_PATH) && !defined(MAGICKCORE_WINDOWS_SUPPORT)\n# error MAGICKCORE_CODER_PATH or MAGICKCORE_WINDOWS_SUPPORT must be defined when MAGICKCORE_INSTALLED_SUPPORT is defined\n#endif\n#else\n {\n char\n *home;\n\n home=GetEnvironmentValue(\"MAGICK_HOME\");\n if (home != (char *) NULL)\n {\n /*\n Search MAGICK_HOME.\n */\n#if !defined(MAGICKCORE_POSIX_SUPPORT)\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",home,\n DirectorySeparator,filename);\n#else\n const char\n *directory;\n\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=MAGICKCORE_CODER_RELATIVE_PATH;\n break;\n }\n case MagickImageFilterModule:\n {\n directory=MAGICKCORE_FILTER_RELATIVE_PATH;\n break;\n }\n }\n (void) FormatLocaleString(path,MaxTextExtent,\"%s/lib/%s/%s\",home,\n directory,filename);\n#endif\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n if (*GetClientPath() != '\\0')\n {\n /*\n Search based on executable directory.\n */\n#if !defined(MAGICKCORE_POSIX_SUPPORT)\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s%s\",GetClientPath(),\n DirectorySeparator,filename);\n#else\n char\n prefix[MaxTextExtent];\n\n const char\n *directory;\n\n switch (module_type)\n {\n case MagickImageCoderModule:\n default:\n {\n directory=\"coders\";\n break;\n }\n case MagickImageFilterModule:\n {\n directory=\"filters\";\n break;\n }\n }\n (void) CopyMagickString(prefix,GetClientPath(),MaxTextExtent);\n ChopPathComponents(prefix,1);\n (void) FormatLocaleString(path,MaxTextExtent,\"%s/lib/%s/%s/%s\",prefix,\n MAGICKCORE_MODULES_RELATIVE_PATH,directory,filename);\n#endif\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n#if defined(MAGICKCORE_WINDOWS_SUPPORT)\n {\n /*\n Search module path.\n */\n if ((NTGetModulePath(\"CORE_RL_magick_.dll\",path) != MagickFalse) ||\n (NTGetModulePath(\"CORE_DB_magick_.dll\",path) != MagickFalse) ||\n (NTGetModulePath(\"Magick.dll\",path) != MagickFalse))\n {\n (void) ConcatenateMagickString(path,DirectorySeparator,MaxTextExtent);\n (void) ConcatenateMagickString(path,filename,MaxTextExtent);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n#endif\n {\n char\n *home;\n\n home=GetEnvironmentValue(\"XDG_CONFIG_HOME\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"LOCALAPPDATA\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"APPDATA\");\n if (home == (char *) NULL)\n home=GetEnvironmentValue(\"USERPROFILE\");\n if (home != (char *) NULL)\n {\n /*\n Search $XDG_CONFIG_HOME/ImageMagick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%sImageMagick%s%s\",\n home,DirectorySeparator,DirectorySeparator,filename);\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n home=GetEnvironmentValue(\"HOME\");\n if (home != (char *) NULL)\n {\n /*\n Search $HOME/.config/ImageMagick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\n \"%s%s.config%sImageMagick%s%s\",home,DirectorySeparator,\n DirectorySeparator,DirectorySeparator,filename);\n if (IsPathAccessible(path) != MagickFalse)\n {\n home=DestroyString(home);\n return(MagickTrue);\n }\n /*\n Search $HOME/.magick.\n */\n (void) FormatLocaleString(path,MaxTextExtent,\"%s%s.magick%s%s\",home,\n DirectorySeparator,DirectorySeparator,filename);\n home=DestroyString(home);\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n }\n }\n /*\n Search current directory.\n */\n if (IsPathAccessible(path) != MagickFalse)\n return(MagickTrue);\n if (exception->severity < ConfigureError)\n ThrowFileException(exception,ConfigureWarning,\"UnableToOpenModuleFile\",\n path);\n#endif\n return(MagickFalse);\n}","lang":"c","vul_type":"cwe-022","sven_meta":{"func_name":"GetMagickModulePath","file_name":"magick/module.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/fc6080f1321fd21e86ef916195cc110b05d9effb","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#3-57ed4bb1cc30","input":" @staticmethod\n def estimate_size(task_id, taken_dirs, taken_files):\n report = AnalysisController.get_report(task_id)\n report = report[\"analysis\"]\n path = report[\"info\"][\"analysis_path\"]\n\n size_total = 0\n\n for directory in taken_dirs:\n destination = \"%s/%s\" % (path, directory)\n if os.path.isdir(destination):\n size_total += get_directory_size(destination)\n\n for filename in taken_files:\n destination = \"%s/%s\" % (path, filename)\n if os.path.isfile(destination):\n size_total += os.path.getsize(destination)\n\n # estimate file size after zipping; 60% compression rate typically\n size_estimated = size_total / 6.5\n\n return {\n \"size\": int(size_estimated),\n \"size_human\": filesizeformat(size_estimated)\n }","target":" @staticmethod\n def estimate_size(task_id, taken_dirs, taken_files):\n report = AnalysisController.get_report(task_id)\n report = report[\"analysis\"]\n path = report[\"info\"][\"analysis_path\"]\n\n size_total = 0\n\n for directory in taken_dirs:\n destination = \"%s/%s\" % (path, os.path.basename(directory))\n if os.path.isdir(destination):\n size_total += get_directory_size(destination)\n\n for filename in taken_files:\n destination = \"%s/%s\" % (path, os.path.basename(filename))\n if os.path.isfile(destination):\n size_total += os.path.getsize(destination)\n\n # estimate file size after zipping; 60% compression rate typically\n size_estimated = size_total / 6.5\n\n return {\n \"size\": int(size_estimated),\n \"size_human\": filesizeformat(size_estimated)\n }","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"estimate_size","file_name":"cuckoo/web/controllers/analysis/export/export.py","commit_link":"github.com/cuckoosandbox/cuckoo/commit/b90267fe4e5ee266ec3d4310a7b5c92c805b7ea3","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#4-0b32e23f8f22","input":" def span(self, key):\n path = os.path.join(self.namespace, key)\n try:\n self.etcd.write(path, None, dir=True, prevExist=False)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error storing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to store key')","target":" def span(self, key):\n path = self._absolute_key(key)\n try:\n self.etcd.write(path, None, dir=True, prevExist=False)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error storing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to store key')","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"span","file_name":"custodia/store/etcdstore.py","commit_link":"github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-022#5-cd467764fc9b","input":"def _get_settings(view):\n return {\n 'linters': get_settings(view, 'anaconda_go_linters', []),\n 'lint_test': get_settings(\n view, 'anaconda_go_lint_test', False),\n 'exclude_regexps': get_settings(\n view, 'anaconda_go_exclude_regexps', []),\n 'max_line_length': get_settings(\n view, 'anaconda_go_max_line_length', 120),\n 'gocyclo_threshold': get_settings(\n view, 'anaconda_go_gocyclo_threshold', 10),\n 'golint_min_confidence': get_settings(\n view, 'anaconda_go_golint_min_confidence', 0.80),\n 'goconst_min_occurrences': get_settings(\n view, 'anaconda_go_goconst_min_occurrences', 3),\n 'min_const_length': get_settings(\n view, 'anaconda_go_min_const_length', 3),\n 'dupl_threshold': get_settings(\n view, 'anaconda_go_dupl_threshold', 50),\n 'path': get_working_directory(view)\n }","target":"def _get_settings(view):\n return {\n 'linters': get_settings(view, 'anaconda_go_linters', []),\n 'lint_test': get_settings(\n view, 'anaconda_go_lint_test', False),\n 'exclude_regexps': get_settings(\n view, 'anaconda_go_exclude_regexps', []),\n 'max_line_length': get_settings(\n view, 'anaconda_go_max_line_length', 120),\n 'gocyclo_threshold': get_settings(\n view, 'anaconda_go_gocyclo_threshold', 10),\n 'golint_min_confidence': get_settings(\n view, 'anaconda_go_golint_min_confidence', 0.80),\n 'goconst_min_occurrences': get_settings(\n view, 'anaconda_go_goconst_min_occurrences', 3),\n 'min_const_length': get_settings(\n view, 'anaconda_go_min_const_length', 3),\n 'dupl_threshold': get_settings(\n view, 'anaconda_go_dupl_threshold', 50),\n 'path': os.path.dirname(view.file_name())\n }","lang":"python","vul_type":"cwe-022","sven_meta":{"func_name":"_get_settings","file_name":"lib/_sublime.py","commit_link":"github.com/DamnWidget/anaconda_go/commit/d3db90bb8853d832927818699591b91f56f6413c","source_cwe_file":"cwe-022.jsonl"}} +{"problem_id":"cwe-787#0-fb2c7770ea63","input":"static ssize_t WritePSDChannels(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n MagickOffsetType size_offset,const MagickBooleanType separate)\n{\n Image\n *mask;\n\n MagickOffsetType\n rows_offset;\n\n size_t\n channels,\n count,\n length,\n offset_length;\n\n unsigned char\n *compact_pixels;\n\n count=0;\n offset_length=0;\n rows_offset=0;\n compact_pixels=(unsigned char *) NULL;\n if (next_image->compression == RLECompression)\n {\n compact_pixels=AcquireCompactPixels(image);\n if (compact_pixels == (unsigned char *) NULL)\n return(0);\n }\n channels=1;\n if (separate == MagickFalse)\n {\n if (next_image->storage_class != PseudoClass)\n {\n if (IsGrayImage(next_image,&next_image->exception) == MagickFalse)\n channels=next_image->colorspace == CMYKColorspace ? 4 : 3;\n if (next_image->matte != MagickFalse)\n channels++;\n }\n rows_offset=TellBlob(image)+2;\n count+=WriteCompressionStart(psd_info,image,next_image,channels);\n offset_length=(next_image->rows*(psd_info->version == 1 ? 2 : 4));\n }\n size_offset+=2;\n if (next_image->storage_class == PseudoClass)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n IndexQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n else\n {\n if (IsGrayImage(next_image,&next_image->exception) != MagickFalse)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n GrayQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n else\n {\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateImage(next_image,MagickFalse);\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n RedQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n GreenQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n BlueQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n if (next_image->colorspace == CMYKColorspace)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n BlackQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n }\n if (next_image->matte != MagickFalse)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n AlphaQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n }\n compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateImage(next_image,MagickFalse);\n if (separate != MagickFalse)\n {\n const char\n *property;\n\n property=GetImageArtifact(next_image,\"psd:opacity-mask\");\n if (property != (const char *) NULL)\n {\n mask=(Image *) GetImageRegistry(ImageRegistryType,property,\n &image->exception);\n if (mask != (Image *) NULL)\n {\n if (mask->compression == RLECompression)\n {\n compact_pixels=AcquireCompactPixels(mask);\n if (compact_pixels == (unsigned char *) NULL)\n return(0);\n }\n length=WritePSDChannel(psd_info,image_info,image,mask,\n RedQuantum,compact_pixels,rows_offset,MagickTrue);\n (void) WritePSDSize(psd_info,image,length,size_offset);\n count+=length;\n compact_pixels=(unsigned char *) RelinquishMagickMemory(\n compact_pixels);\n }\n }\n }\n return(count);\n}","target":"static ssize_t WritePSDChannels(const PSDInfo *psd_info,\n const ImageInfo *image_info,Image *image,Image *next_image,\n MagickOffsetType size_offset,const MagickBooleanType separate)\n{\n Image\n *mask;\n\n MagickOffsetType\n rows_offset;\n\n size_t\n channels,\n count,\n length,\n offset_length;\n\n unsigned char\n *compact_pixels;\n\n count=0;\n offset_length=0;\n rows_offset=0;\n compact_pixels=(unsigned char *) NULL;\n if (next_image->compression == RLECompression)\n {\n compact_pixels=AcquireCompactPixels(next_image);\n if (compact_pixels == (unsigned char *) NULL)\n return(0);\n }\n channels=1;\n if (separate == MagickFalse)\n {\n if (next_image->storage_class != PseudoClass)\n {\n if (IsGrayImage(next_image,&next_image->exception) == MagickFalse)\n channels=next_image->colorspace == CMYKColorspace ? 4 : 3;\n if (next_image->matte != MagickFalse)\n channels++;\n }\n rows_offset=TellBlob(image)+2;\n count+=WriteCompressionStart(psd_info,image,next_image,channels);\n offset_length=(next_image->rows*(psd_info->version == 1 ? 2 : 4));\n }\n size_offset+=2;\n if (next_image->storage_class == PseudoClass)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n IndexQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n else\n {\n if (IsGrayImage(next_image,&next_image->exception) != MagickFalse)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n GrayQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n else\n {\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateImage(next_image,MagickFalse);\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n RedQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n GreenQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n BlueQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n\n if (next_image->colorspace == CMYKColorspace)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n BlackQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n }\n if (next_image->matte != MagickFalse)\n {\n length=WritePSDChannel(psd_info,image_info,image,next_image,\n AlphaQuantum,compact_pixels,rows_offset,separate);\n if (separate != MagickFalse)\n size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2;\n else\n rows_offset+=offset_length;\n count+=length;\n }\n }\n compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);\n if (next_image->colorspace == CMYKColorspace)\n (void) NegateImage(next_image,MagickFalse);\n if (separate != MagickFalse)\n {\n const char\n *property;\n\n property=GetImageArtifact(next_image,\"psd:opacity-mask\");\n if (property != (const char *) NULL)\n {\n mask=(Image *) GetImageRegistry(ImageRegistryType,property,\n &image->exception);\n if (mask != (Image *) NULL)\n {\n if (mask->compression == RLECompression)\n {\n compact_pixels=AcquireCompactPixels(mask);\n if (compact_pixels == (unsigned char *) NULL)\n return(0);\n }\n length=WritePSDChannel(psd_info,image_info,image,mask,\n RedQuantum,compact_pixels,rows_offset,MagickTrue);\n (void) WritePSDSize(psd_info,image,length,size_offset);\n count+=length;\n compact_pixels=(unsigned char *) RelinquishMagickMemory(\n compact_pixels);\n }\n }\n }\n return(count);\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"WritePSDChannels","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/37a1710e2dab6ed91128ea648d654a22fbe2a6af","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#1-26c099fc3c8e","input":"InitialiseRFBConnection(rfbClient* client)\n{\n rfbProtocolVersionMsg pv;\n int major,minor;\n uint32_t authScheme;\n uint32_t subAuthScheme;\n rfbClientInitMsg ci;\n\n /* if the connection is immediately closed, don't report anything, so\n that pmw's monitor can make test connections */\n\n if (client->listenSpecified)\n errorMessageOnReadFailure = FALSE;\n\n if (!ReadFromRFBServer(client, pv, sz_rfbProtocolVersionMsg)) return FALSE;\n pv[sz_rfbProtocolVersionMsg]=0;\n\n errorMessageOnReadFailure = TRUE;\n\n pv[sz_rfbProtocolVersionMsg] = 0;\n\n if (sscanf(pv,rfbProtocolVersionFormat,&major,&minor) != 2) {\n rfbClientLog(\"Not a valid VNC server (%s)\\n\",pv);\n return FALSE;\n }\n\n\n DefaultSupportedMessages(client);\n client->major = major;\n client->minor = minor;\n\n /* fall back to viewer supported version */\n if ((major==rfbProtocolMajorVersion) && (minor>rfbProtocolMinorVersion))\n client->minor = rfbProtocolMinorVersion;\n\n /* UltraVNC uses minor codes 4 and 6 for the server */\n if (major==3 && (minor==4 || minor==6)) {\n rfbClientLog(\"UltraVNC server detected, enabling UltraVNC specific messages\\n\",pv);\n DefaultSupportedMessagesUltraVNC(client);\n }\n\n /* UltraVNC Single Click uses minor codes 14 and 16 for the server */\n if (major==3 && (minor==14 || minor==16)) {\n minor = minor - 10;\n client->minor = minor;\n rfbClientLog(\"UltraVNC Single Click server detected, enabling UltraVNC specific messages\\n\",pv);\n DefaultSupportedMessagesUltraVNC(client);\n }\n\n /* TightVNC uses minor codes 5 for the server */\n if (major==3 && minor==5) {\n rfbClientLog(\"TightVNC server detected, enabling TightVNC specific messages\\n\",pv);\n DefaultSupportedMessagesTightVNC(client);\n }\n\n /* we do not support > RFB3.8 */\n if ((major==3 && minor>8) || major>3)\n {\n client->major=3;\n client->minor=8;\n }\n\n rfbClientLog(\"VNC server supports protocol version %d.%d (viewer %d.%d)\\n\",\n\t major, minor, rfbProtocolMajorVersion, rfbProtocolMinorVersion);\n\n sprintf(pv,rfbProtocolVersionFormat,client->major,client->minor);\n\n if (!WriteToRFBServer(client, pv, sz_rfbProtocolVersionMsg)) return FALSE;\n\n\n /* 3.7 and onwards sends a # of security types first */\n if (client->major==3 && client->minor > 6)\n {\n if (!ReadSupportedSecurityType(client, &authScheme, FALSE)) return FALSE;\n }\n else\n {\n if (!ReadFromRFBServer(client, (char *)&authScheme, 4)) return FALSE;\n authScheme = rfbClientSwap32IfLE(authScheme);\n }\n \n rfbClientLog(\"Selected Security Scheme %d\\n\", authScheme);\n client->authScheme = authScheme;\n \n switch (authScheme) {\n\n case rfbConnFailed:\n ReadReason(client);\n return FALSE;\n\n case rfbNoAuth:\n rfbClientLog(\"No authentication needed\\n\");\n\n /* 3.8 and upwards sends a Security Result for rfbNoAuth */\n if ((client->major==3 && client->minor > 7) || client->major>3)\n if (!rfbHandleAuthResult(client)) return FALSE; \n\n break;\n\n case rfbVncAuth:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n case rfbMSLogon:\n if (!HandleMSLogonAuth(client)) return FALSE;\n break;\n\n case rfbARD:\n#ifndef LIBVNCSERVER_WITH_CLIENT_GCRYPT\n rfbClientLog(\"GCrypt support was not compiled in\\n\");\n return FALSE;\n#else\n if (!HandleARDAuth(client)) return FALSE;\n#endif\n break;\n\n case rfbTLS:\n if (!HandleAnonTLSAuth(client)) return FALSE;\n /* After the TLS session is established, sub auth types are expected.\n * Note that all following reading/writing are through the TLS session from here.\n */\n if (!ReadSupportedSecurityType(client, &subAuthScheme, TRUE)) return FALSE;\n client->subAuthScheme = subAuthScheme;\n\n switch (subAuthScheme) {\n\n case rfbConnFailed:\n ReadReason(client);\n return FALSE;\n\n case rfbNoAuth:\n rfbClientLog(\"No sub authentication needed\\n\");\n /* 3.8 and upwards sends a Security Result for rfbNoAuth */\n if ((client->major==3 && client->minor > 7) || client->major>3)\n if (!rfbHandleAuthResult(client)) return FALSE;\n break;\n\n case rfbVncAuth:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n default:\n rfbClientLog(\"Unknown sub authentication scheme from VNC server: %d\\n\",\n (int)subAuthScheme);\n return FALSE;\n }\n\n break;\n\n case rfbVeNCrypt:\n if (!HandleVeNCryptAuth(client)) return FALSE;\n\n switch (client->subAuthScheme) {\n\n case rfbVeNCryptTLSNone:\n case rfbVeNCryptX509None:\n rfbClientLog(\"No sub authentication needed\\n\");\n if (!rfbHandleAuthResult(client)) return FALSE;\n break;\n\n case rfbVeNCryptTLSVNC:\n case rfbVeNCryptX509VNC:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n case rfbVeNCryptTLSPlain:\n case rfbVeNCryptX509Plain:\n if (!HandlePlainAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbVeNCryptX509SASL:\n case rfbVeNCryptTLSSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n default:\n rfbClientLog(\"Unknown sub authentication scheme from VNC server: %d\\n\",\n client->subAuthScheme);\n return FALSE;\n }\n\n break;\n\n default:\n {\n rfbBool authHandled=FALSE;\n rfbClientProtocolExtension* e;\n for (e = rfbClientExtensions; e; e = e->next) {\n uint32_t const* secType;\n if (!e->handleAuthentication) continue;\n for (secType = e->securityTypes; secType && *secType; secType++) {\n if (authScheme==*secType) {\n if (!e->handleAuthentication(client, authScheme)) return FALSE;\n if (!rfbHandleAuthResult(client)) return FALSE;\n authHandled=TRUE;\n }\n }\n }\n if (authHandled) break;\n }\n rfbClientLog(\"Unknown authentication scheme from VNC server: %d\\n\",\n\t (int)authScheme);\n return FALSE;\n }\n\n ci.shared = (client->appData.shareDesktop ? 1 : 0);\n\n if (!WriteToRFBServer(client, (char *)&ci, sz_rfbClientInitMsg)) return FALSE;\n\n if (!ReadFromRFBServer(client, (char *)&client->si, sz_rfbServerInitMsg)) return FALSE;\n\n client->si.framebufferWidth = rfbClientSwap16IfLE(client->si.framebufferWidth);\n client->si.framebufferHeight = rfbClientSwap16IfLE(client->si.framebufferHeight);\n client->si.format.redMax = rfbClientSwap16IfLE(client->si.format.redMax);\n client->si.format.greenMax = rfbClientSwap16IfLE(client->si.format.greenMax);\n client->si.format.blueMax = rfbClientSwap16IfLE(client->si.format.blueMax);\n client->si.nameLength = rfbClientSwap32IfLE(client->si.nameLength);\n\n /* To guard against integer wrap-around, si.nameLength is cast to 64 bit */\n client->desktopName = malloc((uint64_t)client->si.nameLength + 1);\n if (!client->desktopName) {\n rfbClientLog(\"Error allocating memory for desktop name, %lu bytes\\n\",\n (unsigned long)client->si.nameLength);\n return FALSE;\n }\n\n if (!ReadFromRFBServer(client, client->desktopName, client->si.nameLength)) return FALSE;\n\n client->desktopName[client->si.nameLength] = 0;\n\n rfbClientLog(\"Desktop name \\\"%s\\\"\\n\",client->desktopName);\n\n rfbClientLog(\"Connected to VNC server, using protocol version %d.%d\\n\",\n\t client->major, client->minor);\n\n rfbClientLog(\"VNC server default format:\\n\");\n PrintPixelFormat(&client->si.format);\n\n return TRUE;\n}","target":"InitialiseRFBConnection(rfbClient* client)\n{\n rfbProtocolVersionMsg pv;\n int major,minor;\n uint32_t authScheme;\n uint32_t subAuthScheme;\n rfbClientInitMsg ci;\n\n /* if the connection is immediately closed, don't report anything, so\n that pmw's monitor can make test connections */\n\n if (client->listenSpecified)\n errorMessageOnReadFailure = FALSE;\n\n if (!ReadFromRFBServer(client, pv, sz_rfbProtocolVersionMsg)) return FALSE;\n pv[sz_rfbProtocolVersionMsg]=0;\n\n errorMessageOnReadFailure = TRUE;\n\n pv[sz_rfbProtocolVersionMsg] = 0;\n\n if (sscanf(pv,rfbProtocolVersionFormat,&major,&minor) != 2) {\n rfbClientLog(\"Not a valid VNC server (%s)\\n\",pv);\n return FALSE;\n }\n\n\n DefaultSupportedMessages(client);\n client->major = major;\n client->minor = minor;\n\n /* fall back to viewer supported version */\n if ((major==rfbProtocolMajorVersion) && (minor>rfbProtocolMinorVersion))\n client->minor = rfbProtocolMinorVersion;\n\n /* UltraVNC uses minor codes 4 and 6 for the server */\n if (major==3 && (minor==4 || minor==6)) {\n rfbClientLog(\"UltraVNC server detected, enabling UltraVNC specific messages\\n\",pv);\n DefaultSupportedMessagesUltraVNC(client);\n }\n\n /* UltraVNC Single Click uses minor codes 14 and 16 for the server */\n if (major==3 && (minor==14 || minor==16)) {\n minor = minor - 10;\n client->minor = minor;\n rfbClientLog(\"UltraVNC Single Click server detected, enabling UltraVNC specific messages\\n\",pv);\n DefaultSupportedMessagesUltraVNC(client);\n }\n\n /* TightVNC uses minor codes 5 for the server */\n if (major==3 && minor==5) {\n rfbClientLog(\"TightVNC server detected, enabling TightVNC specific messages\\n\",pv);\n DefaultSupportedMessagesTightVNC(client);\n }\n\n /* we do not support > RFB3.8 */\n if ((major==3 && minor>8) || major>3)\n {\n client->major=3;\n client->minor=8;\n }\n\n rfbClientLog(\"VNC server supports protocol version %d.%d (viewer %d.%d)\\n\",\n\t major, minor, rfbProtocolMajorVersion, rfbProtocolMinorVersion);\n\n sprintf(pv,rfbProtocolVersionFormat,client->major,client->minor);\n\n if (!WriteToRFBServer(client, pv, sz_rfbProtocolVersionMsg)) return FALSE;\n\n\n /* 3.7 and onwards sends a # of security types first */\n if (client->major==3 && client->minor > 6)\n {\n if (!ReadSupportedSecurityType(client, &authScheme, FALSE)) return FALSE;\n }\n else\n {\n if (!ReadFromRFBServer(client, (char *)&authScheme, 4)) return FALSE;\n authScheme = rfbClientSwap32IfLE(authScheme);\n }\n \n rfbClientLog(\"Selected Security Scheme %d\\n\", authScheme);\n client->authScheme = authScheme;\n \n switch (authScheme) {\n\n case rfbConnFailed:\n ReadReason(client);\n return FALSE;\n\n case rfbNoAuth:\n rfbClientLog(\"No authentication needed\\n\");\n\n /* 3.8 and upwards sends a Security Result for rfbNoAuth */\n if ((client->major==3 && client->minor > 7) || client->major>3)\n if (!rfbHandleAuthResult(client)) return FALSE; \n\n break;\n\n case rfbVncAuth:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n case rfbMSLogon:\n if (!HandleMSLogonAuth(client)) return FALSE;\n break;\n\n case rfbARD:\n#ifndef LIBVNCSERVER_WITH_CLIENT_GCRYPT\n rfbClientLog(\"GCrypt support was not compiled in\\n\");\n return FALSE;\n#else\n if (!HandleARDAuth(client)) return FALSE;\n#endif\n break;\n\n case rfbTLS:\n if (!HandleAnonTLSAuth(client)) return FALSE;\n /* After the TLS session is established, sub auth types are expected.\n * Note that all following reading/writing are through the TLS session from here.\n */\n if (!ReadSupportedSecurityType(client, &subAuthScheme, TRUE)) return FALSE;\n client->subAuthScheme = subAuthScheme;\n\n switch (subAuthScheme) {\n\n case rfbConnFailed:\n ReadReason(client);\n return FALSE;\n\n case rfbNoAuth:\n rfbClientLog(\"No sub authentication needed\\n\");\n /* 3.8 and upwards sends a Security Result for rfbNoAuth */\n if ((client->major==3 && client->minor > 7) || client->major>3)\n if (!rfbHandleAuthResult(client)) return FALSE;\n break;\n\n case rfbVncAuth:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n default:\n rfbClientLog(\"Unknown sub authentication scheme from VNC server: %d\\n\",\n (int)subAuthScheme);\n return FALSE;\n }\n\n break;\n\n case rfbVeNCrypt:\n if (!HandleVeNCryptAuth(client)) return FALSE;\n\n switch (client->subAuthScheme) {\n\n case rfbVeNCryptTLSNone:\n case rfbVeNCryptX509None:\n rfbClientLog(\"No sub authentication needed\\n\");\n if (!rfbHandleAuthResult(client)) return FALSE;\n break;\n\n case rfbVeNCryptTLSVNC:\n case rfbVeNCryptX509VNC:\n if (!HandleVncAuth(client)) return FALSE;\n break;\n\n case rfbVeNCryptTLSPlain:\n case rfbVeNCryptX509Plain:\n if (!HandlePlainAuth(client)) return FALSE;\n break;\n\n#ifdef LIBVNCSERVER_HAVE_SASL\n case rfbVeNCryptX509SASL:\n case rfbVeNCryptTLSSASL:\n if (!HandleSASLAuth(client)) return FALSE;\n break;\n#endif /* LIBVNCSERVER_HAVE_SASL */\n\n default:\n rfbClientLog(\"Unknown sub authentication scheme from VNC server: %d\\n\",\n client->subAuthScheme);\n return FALSE;\n }\n\n break;\n\n default:\n {\n rfbBool authHandled=FALSE;\n rfbClientProtocolExtension* e;\n for (e = rfbClientExtensions; e; e = e->next) {\n uint32_t const* secType;\n if (!e->handleAuthentication) continue;\n for (secType = e->securityTypes; secType && *secType; secType++) {\n if (authScheme==*secType) {\n if (!e->handleAuthentication(client, authScheme)) return FALSE;\n if (!rfbHandleAuthResult(client)) return FALSE;\n authHandled=TRUE;\n }\n }\n }\n if (authHandled) break;\n }\n rfbClientLog(\"Unknown authentication scheme from VNC server: %d\\n\",\n\t (int)authScheme);\n return FALSE;\n }\n\n ci.shared = (client->appData.shareDesktop ? 1 : 0);\n\n if (!WriteToRFBServer(client, (char *)&ci, sz_rfbClientInitMsg)) return FALSE;\n\n if (!ReadFromRFBServer(client, (char *)&client->si, sz_rfbServerInitMsg)) return FALSE;\n\n client->si.framebufferWidth = rfbClientSwap16IfLE(client->si.framebufferWidth);\n client->si.framebufferHeight = rfbClientSwap16IfLE(client->si.framebufferHeight);\n client->si.format.redMax = rfbClientSwap16IfLE(client->si.format.redMax);\n client->si.format.greenMax = rfbClientSwap16IfLE(client->si.format.greenMax);\n client->si.format.blueMax = rfbClientSwap16IfLE(client->si.format.blueMax);\n client->si.nameLength = rfbClientSwap32IfLE(client->si.nameLength);\n\n if (client->si.nameLength > 1<<20) {\n rfbClientErr(\"Too big desktop name length sent by server: %u B > 1 MB\\n\", (unsigned int)client->si.nameLength);\n return FALSE;\n }\n\n client->desktopName = malloc(client->si.nameLength + 1);\n if (!client->desktopName) {\n rfbClientLog(\"Error allocating memory for desktop name, %lu bytes\\n\",\n (unsigned long)client->si.nameLength);\n return FALSE;\n }\n\n if (!ReadFromRFBServer(client, client->desktopName, client->si.nameLength)) return FALSE;\n\n client->desktopName[client->si.nameLength] = 0;\n\n rfbClientLog(\"Desktop name \\\"%s\\\"\\n\",client->desktopName);\n\n rfbClientLog(\"Connected to VNC server, using protocol version %d.%d\\n\",\n\t client->major, client->minor);\n\n rfbClientLog(\"VNC server default format:\\n\");\n PrintPixelFormat(&client->si.format);\n\n return TRUE;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"InitialiseRFBConnection","file_name":"libvncclient/rfbproto.c","commit_link":"github.com/LibVNC/libvncserver/commit/c2c4b81e6cb3b485fb1ec7ba9e7defeb889f6ba7","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#2-28a8f50cd3cb","input":"cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,\n uint32_t offs, cdf_property_info_t **info, size_t *count, size_t *maxcount)\n{\n\tconst cdf_section_header_t *shp;\n\tcdf_section_header_t sh;\n\tconst uint8_t *p, *q, *e;\n\tsize_t i, o4, nelements, j, slen, left;\n\tcdf_property_info_t *inp;\n\n\tif (offs > UINT32_MAX / 4) {\n\t\terrno = EFTYPE;\n\t\tgoto out;\n\t}\n\tshp = CAST(const cdf_section_header_t *,\n\t cdf_offset(sst->sst_tab, offs));\n\tif (cdf_check_stream_offset(sst, h, shp, sizeof(*shp), __LINE__) == -1)\n\t\tgoto out;\n\tsh.sh_len = CDF_TOLE4(shp->sh_len);\n\tif (sh.sh_len > CDF_SHLEN_LIMIT) {\n\t\terrno = EFTYPE;\n\t\tgoto out;\n\t}\n\n\tif (cdf_check_stream_offset(sst, h, shp, sh.sh_len, __LINE__) == -1)\n\t\tgoto out;\n\n\tsh.sh_properties = CDF_TOLE4(shp->sh_properties);\n\tDPRINTF((\"section len: %u properties %u\\n\", sh.sh_len,\n\t sh.sh_properties));\n\tif (sh.sh_properties > CDF_PROP_LIMIT)\n\t\tgoto out;\n\tinp = cdf_grow_info(info, maxcount, sh.sh_properties);\n\tif (inp == NULL)\n\t\tgoto out;\n\tinp += *count;\n\t*count += sh.sh_properties;\n\tp = CAST(const uint8_t *, cdf_offset(sst->sst_tab, offs + sizeof(sh)));\n\te = CAST(const uint8_t *, cdf_offset(shp, sh.sh_len));\n\tif (p >= e || cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)\n\t\tgoto out;\n\n\tfor (i = 0; i < sh.sh_properties; i++) {\n\t\tif ((q = cdf_get_property_info_pos(sst, h, p, e, i)) == NULL)\n\t\t\tgoto out;\n\t\tinp[i].pi_id = CDF_GETUINT32(p, i << 1);\n\t\tleft = CAST(size_t, e - q);\n\t\tif (left < sizeof(uint32_t)) {\n\t\t\tDPRINTF((\"short info (no type)_\\n\"));\n\t\t\tgoto out;\n\t\t}\n\t\tinp[i].pi_type = CDF_GETUINT32(q, 0);\n\t\tDPRINTF((\"%\" SIZE_T_FORMAT \"u) id=%#x type=%#x offs=%#tx,%#x\\n\",\n\t\t i, inp[i].pi_id, inp[i].pi_type, q - p, offs));\n\t\tif (inp[i].pi_type & CDF_VECTOR) {\n\t\t\tif (left < sizeof(uint32_t) * 2) {\n\t\t\t\tDPRINTF((\"missing CDF_VECTOR length\\n\"));\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tnelements = CDF_GETUINT32(q, 1);\n\t\t\tif (nelements == 0) {\n\t\t\t\tDPRINTF((\"CDF_VECTOR with nelements == 0\\n\"));\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tslen = 2;\n\t\t} else {\n\t\t\tnelements = 1;\n\t\t\tslen = 1;\n\t\t}\n\t\to4 = slen * sizeof(uint32_t);\n\t\tif (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))\n\t\t\tgoto unknown;\n\t\tswitch (inp[i].pi_type & CDF_TYPEMASK) {\n\t\tcase CDF_NULL:\n\t\tcase CDF_EMPTY:\n\t\t\tbreak;\n\t\tcase CDF_SIGNED16:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int16_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_SIGNED32:\n\t\tcase CDF_BOOL:\n\t\tcase CDF_UNSIGNED32:\n\t\tcase CDF_FLOAT:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int32_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_SIGNED64:\n\t\tcase CDF_UNSIGNED64:\n\t\tcase CDF_DOUBLE:\n\t\tcase CDF_FILETIME:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int64_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_LENGTH32_STRING:\n\t\tcase CDF_LENGTH32_WSTRING:\n\t\t\tif (nelements > 1) {\n\t\t\t\tsize_t nelem = inp - *info;\n\t\t\t\tinp = cdf_grow_info(info, maxcount, nelements);\n\t\t\t\tif (inp == NULL)\n\t\t\t\t\tgoto out;\n\t\t\t\tinp += nelem;\n\t\t\t}\n\t\t\tDPRINTF((\"nelements = %\" SIZE_T_FORMAT \"u\\n\",\n\t\t\t nelements));\n\t\t\tfor (j = 0; j < nelements && i < sh.sh_properties;\n\t\t\t j++, i++)\n\t\t\t{\n\t\t\t\tuint32_t l;\n\n\t\t\t\tif (o4 + sizeof(uint32_t) > left)\n\t\t\t\t\tgoto out;\n\n\t\t\t\tl = CDF_GETUINT32(q, slen);\n\t\t\t\to4 += sizeof(uint32_t);\n\t\t\t\tif (o4 + l > left)\n\t\t\t\t\tgoto out;\n\n\t\t\t\tinp[i].pi_str.s_len = l;\n\t\t\t\tinp[i].pi_str.s_buf = CAST(const char *,\n\t\t\t\t CAST(const void *, &q[o4]));\n\n\t\t\t\tDPRINTF((\"o=%\" SIZE_T_FORMAT \"u l=%d(%\"\n\t\t\t\t SIZE_T_FORMAT \"u), t=%\" SIZE_T_FORMAT\n\t\t\t\t \"u s=%s\\n\", o4, l, CDF_ROUND(l, sizeof(l)),\n\t\t\t\t left, inp[i].pi_str.s_buf));\n\n\t\t\t\tif (l & 1)\n\t\t\t\t\tl++;\n\n\t\t\t\tslen += l >> 1;\n\t\t\t\to4 = slen * sizeof(uint32_t);\n\t\t\t}\n\t\t\ti--;\n\t\t\tbreak;\n\t\tcase CDF_CLIPBOARD:\n\t\t\tif (inp[i].pi_type & CDF_VECTOR)\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tdefault:\n\t\tunknown:\n\t\t\tmemset(&inp[i].pi_val, 0, sizeof(inp[i].pi_val));\n\t\t\tDPRINTF((\"Don't know how to deal with %#x\\n\",\n\t\t\t inp[i].pi_type));\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\nout:\n\tfree(*info);\n\t*info = NULL;\n\t*count = 0;\n\t*maxcount = 0;\n\terrno = EFTYPE;\n\treturn -1;\n}","target":"cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,\n uint32_t offs, cdf_property_info_t **info, size_t *count, size_t *maxcount)\n{\n\tconst cdf_section_header_t *shp;\n\tcdf_section_header_t sh;\n\tconst uint8_t *p, *q, *e;\n\tsize_t i, o4, nelements, j, slen, left;\n\tcdf_property_info_t *inp;\n\n\tif (offs > UINT32_MAX / 4) {\n\t\terrno = EFTYPE;\n\t\tgoto out;\n\t}\n\tshp = CAST(const cdf_section_header_t *,\n\t cdf_offset(sst->sst_tab, offs));\n\tif (cdf_check_stream_offset(sst, h, shp, sizeof(*shp), __LINE__) == -1)\n\t\tgoto out;\n\tsh.sh_len = CDF_TOLE4(shp->sh_len);\n\tif (sh.sh_len > CDF_SHLEN_LIMIT) {\n\t\terrno = EFTYPE;\n\t\tgoto out;\n\t}\n\n\tif (cdf_check_stream_offset(sst, h, shp, sh.sh_len, __LINE__) == -1)\n\t\tgoto out;\n\n\tsh.sh_properties = CDF_TOLE4(shp->sh_properties);\n\tDPRINTF((\"section len: %u properties %u\\n\", sh.sh_len,\n\t sh.sh_properties));\n\tif (sh.sh_properties > CDF_PROP_LIMIT)\n\t\tgoto out;\n\tinp = cdf_grow_info(info, maxcount, sh.sh_properties);\n\tif (inp == NULL)\n\t\tgoto out;\n\tinp += *count;\n\t*count += sh.sh_properties;\n\tp = CAST(const uint8_t *, cdf_offset(sst->sst_tab, offs + sizeof(sh)));\n\te = CAST(const uint8_t *, cdf_offset(shp, sh.sh_len));\n\tif (p >= e || cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)\n\t\tgoto out;\n\n\tfor (i = 0; i < sh.sh_properties; i++) {\n\t\tif ((q = cdf_get_property_info_pos(sst, h, p, e, i)) == NULL)\n\t\t\tgoto out;\n\t\tinp[i].pi_id = CDF_GETUINT32(p, i << 1);\n\t\tleft = CAST(size_t, e - q);\n\t\tif (left < sizeof(uint32_t)) {\n\t\t\tDPRINTF((\"short info (no type)_\\n\"));\n\t\t\tgoto out;\n\t\t}\n\t\tinp[i].pi_type = CDF_GETUINT32(q, 0);\n\t\tDPRINTF((\"%\" SIZE_T_FORMAT \"u) id=%#x type=%#x offs=%#tx,%#x\\n\",\n\t\t i, inp[i].pi_id, inp[i].pi_type, q - p, offs));\n\t\tif (inp[i].pi_type & CDF_VECTOR) {\n\t\t\tif (left < sizeof(uint32_t) * 2) {\n\t\t\t\tDPRINTF((\"missing CDF_VECTOR length\\n\"));\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tnelements = CDF_GETUINT32(q, 1);\n\t\t\tif (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {\n\t\t\t\tDPRINTF((\"CDF_VECTOR with nelements == %\"\n\t\t\t\t SIZE_T_FORMAT \"u\\n\", nelements));\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tslen = 2;\n\t\t} else {\n\t\t\tnelements = 1;\n\t\t\tslen = 1;\n\t\t}\n\t\to4 = slen * sizeof(uint32_t);\n\t\tif (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))\n\t\t\tgoto unknown;\n\t\tswitch (inp[i].pi_type & CDF_TYPEMASK) {\n\t\tcase CDF_NULL:\n\t\tcase CDF_EMPTY:\n\t\t\tbreak;\n\t\tcase CDF_SIGNED16:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int16_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_SIGNED32:\n\t\tcase CDF_BOOL:\n\t\tcase CDF_UNSIGNED32:\n\t\tcase CDF_FLOAT:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int32_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_SIGNED64:\n\t\tcase CDF_UNSIGNED64:\n\t\tcase CDF_DOUBLE:\n\t\tcase CDF_FILETIME:\n\t\t\tif (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int64_t)))\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tcase CDF_LENGTH32_STRING:\n\t\tcase CDF_LENGTH32_WSTRING:\n\t\t\tif (nelements > 1) {\n\t\t\t\tsize_t nelem = inp - *info;\n\t\t\t\tinp = cdf_grow_info(info, maxcount, nelements);\n\t\t\t\tif (inp == NULL)\n\t\t\t\t\tgoto out;\n\t\t\t\tinp += nelem;\n\t\t\t}\n\t\t\tfor (j = 0; j < nelements && i < sh.sh_properties;\n\t\t\t j++, i++)\n\t\t\t{\n\t\t\t\tuint32_t l;\n\n\t\t\t\tif (o4 + sizeof(uint32_t) > left)\n\t\t\t\t\tgoto out;\n\n\t\t\t\tl = CDF_GETUINT32(q, slen);\n\t\t\t\to4 += sizeof(uint32_t);\n\t\t\t\tif (o4 + l > left)\n\t\t\t\t\tgoto out;\n\n\t\t\t\tinp[i].pi_str.s_len = l;\n\t\t\t\tinp[i].pi_str.s_buf = CAST(const char *,\n\t\t\t\t CAST(const void *, &q[o4]));\n\n\t\t\t\tDPRINTF((\"o=%\" SIZE_T_FORMAT \"u l=%d(%\"\n\t\t\t\t SIZE_T_FORMAT \"u), t=%\" SIZE_T_FORMAT\n\t\t\t\t \"u s=%s\\n\", o4, l, CDF_ROUND(l, sizeof(l)),\n\t\t\t\t left, inp[i].pi_str.s_buf));\n\n\t\t\t\tif (l & 1)\n\t\t\t\t\tl++;\n\n\t\t\t\tslen += l >> 1;\n\t\t\t\to4 = slen * sizeof(uint32_t);\n\t\t\t}\n\t\t\ti--;\n\t\t\tbreak;\n\t\tcase CDF_CLIPBOARD:\n\t\t\tif (inp[i].pi_type & CDF_VECTOR)\n\t\t\t\tgoto unknown;\n\t\t\tbreak;\n\t\tdefault:\n\t\tunknown:\n\t\t\tmemset(&inp[i].pi_val, 0, sizeof(inp[i].pi_val));\n\t\t\tDPRINTF((\"Don't know how to deal with %#x\\n\",\n\t\t\t inp[i].pi_type));\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\nout:\n\tfree(*info);\n\t*info = NULL;\n\t*count = 0;\n\t*maxcount = 0;\n\terrno = EFTYPE;\n\treturn -1;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"cdf_read_property_info","file_name":"src/cdf.c","commit_link":"github.com/file/file/commit/46a8443f76cec4b41ec736eca396984c74664f84","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#3-17d8aa9f8685","input":"opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)\n{\n FILE *f = NULL;\n int w, h, prec;\n int i, numcomps, max;\n OPJ_COLOR_SPACE color_space;\n opj_image_cmptparm_t cmptparm; /* maximum of 1 component */\n opj_image_t * image = NULL;\n int adjustS, ushift, dshift, force8;\n\n char endian1, endian2, sign;\n char signtmp[32];\n\n char temp[32];\n int bigendian;\n opj_image_comp_t *comp = NULL;\n\n numcomps = 1;\n color_space = OPJ_CLRSPC_GRAY;\n\n memset(&cmptparm, 0, sizeof(opj_image_cmptparm_t));\n\n max = 0;\n\n f = fopen(filename, \"rb\");\n if (!f) {\n fprintf(stderr, \"Failed to open %s for reading !\\n\", filename);\n return NULL;\n }\n\n fseek(f, 0, SEEK_SET);\n if (fscanf(f, \"PG%[ \\t]%c%c%[ \\t+-]%d%[ \\t]%d%[ \\t]%d\", temp, &endian1,\n &endian2, signtmp, &prec, temp, &w, temp, &h) != 9) {\n fclose(f);\n fprintf(stderr,\n \"ERROR: Failed to read the right number of element from the fscanf() function!\\n\");\n return NULL;\n }\n\n i = 0;\n sign = '+';\n while (signtmp[i] != '\\0') {\n if (signtmp[i] == '-') {\n sign = '-';\n }\n i++;\n }\n\n fgetc(f);\n if (endian1 == 'M' && endian2 == 'L') {\n bigendian = 1;\n } else if (endian2 == 'M' && endian1 == 'L') {\n bigendian = 0;\n } else {\n fclose(f);\n fprintf(stderr, \"Bad pgx header, please check input file\\n\");\n return NULL;\n }\n\n /* initialize image component */\n\n cmptparm.x0 = (OPJ_UINT32)parameters->image_offset_x0;\n cmptparm.y0 = (OPJ_UINT32)parameters->image_offset_y0;\n cmptparm.w = !cmptparm.x0 ? (OPJ_UINT32)((w - 1) * parameters->subsampling_dx +\n 1) : cmptparm.x0 + (OPJ_UINT32)(w - 1) * (OPJ_UINT32)parameters->subsampling_dx\n + 1;\n cmptparm.h = !cmptparm.y0 ? (OPJ_UINT32)((h - 1) * parameters->subsampling_dy +\n 1) : cmptparm.y0 + (OPJ_UINT32)(h - 1) * (OPJ_UINT32)parameters->subsampling_dy\n + 1;\n\n if (sign == '-') {\n cmptparm.sgnd = 1;\n } else {\n cmptparm.sgnd = 0;\n }\n if (prec < 8) {\n force8 = 1;\n ushift = 8 - prec;\n dshift = prec - ushift;\n if (cmptparm.sgnd) {\n adjustS = (1 << (prec - 1));\n } else {\n adjustS = 0;\n }\n cmptparm.sgnd = 0;\n prec = 8;\n } else {\n ushift = dshift = force8 = adjustS = 0;\n }\n\n cmptparm.prec = (OPJ_UINT32)prec;\n cmptparm.bpp = (OPJ_UINT32)prec;\n cmptparm.dx = (OPJ_UINT32)parameters->subsampling_dx;\n cmptparm.dy = (OPJ_UINT32)parameters->subsampling_dy;\n\n /* create the image */\n image = opj_image_create((OPJ_UINT32)numcomps, &cmptparm, color_space);\n if (!image) {\n fclose(f);\n return NULL;\n }\n /* set image offset and reference grid */\n image->x0 = cmptparm.x0;\n image->y0 = cmptparm.x0;\n image->x1 = cmptparm.w;\n image->y1 = cmptparm.h;\n\n /* set image data */\n\n comp = &image->comps[0];\n\n for (i = 0; i < w * h; i++) {\n int v;\n if (force8) {\n v = readuchar(f) + adjustS;\n v = (v << ushift) + (v >> dshift);\n comp->data[i] = (unsigned char)v;\n\n if (v > max) {\n max = v;\n }\n\n continue;\n }\n if (comp->prec == 8) {\n if (!comp->sgnd) {\n v = readuchar(f);\n } else {\n v = (char) readuchar(f);\n }\n } else if (comp->prec <= 16) {\n if (!comp->sgnd) {\n v = readushort(f, bigendian);\n } else {\n v = (short) readushort(f, bigendian);\n }\n } else {\n if (!comp->sgnd) {\n v = (int)readuint(f, bigendian);\n } else {\n v = (int) readuint(f, bigendian);\n }\n }\n if (v > max) {\n max = v;\n }\n comp->data[i] = v;\n }\n fclose(f);\n comp->bpp = (OPJ_UINT32)int_floorlog2(max) + 1;\n\n return image;\n}","target":"opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters)\n{\n FILE *f = NULL;\n int w, h, prec;\n int i, numcomps, max;\n OPJ_COLOR_SPACE color_space;\n opj_image_cmptparm_t cmptparm; /* maximum of 1 component */\n opj_image_t * image = NULL;\n int adjustS, ushift, dshift, force8;\n\n char endian1, endian2, sign;\n char signtmp[32];\n\n char temp[32];\n int bigendian;\n opj_image_comp_t *comp = NULL;\n\n numcomps = 1;\n color_space = OPJ_CLRSPC_GRAY;\n\n memset(&cmptparm, 0, sizeof(opj_image_cmptparm_t));\n\n max = 0;\n\n f = fopen(filename, \"rb\");\n if (!f) {\n fprintf(stderr, \"Failed to open %s for reading !\\n\", filename);\n return NULL;\n }\n\n fseek(f, 0, SEEK_SET);\n if (fscanf(f, \"PG%31[ \\t]%c%c%31[ \\t+-]%d%31[ \\t]%d%31[ \\t]%d\", temp, &endian1,\n &endian2, signtmp, &prec, temp, &w, temp, &h) != 9) {\n fclose(f);\n fprintf(stderr,\n \"ERROR: Failed to read the right number of element from the fscanf() function!\\n\");\n return NULL;\n }\n\n i = 0;\n sign = '+';\n while (signtmp[i] != '\\0') {\n if (signtmp[i] == '-') {\n sign = '-';\n }\n i++;\n }\n\n fgetc(f);\n if (endian1 == 'M' && endian2 == 'L') {\n bigendian = 1;\n } else if (endian2 == 'M' && endian1 == 'L') {\n bigendian = 0;\n } else {\n fclose(f);\n fprintf(stderr, \"Bad pgx header, please check input file\\n\");\n return NULL;\n }\n\n /* initialize image component */\n\n cmptparm.x0 = (OPJ_UINT32)parameters->image_offset_x0;\n cmptparm.y0 = (OPJ_UINT32)parameters->image_offset_y0;\n cmptparm.w = !cmptparm.x0 ? (OPJ_UINT32)((w - 1) * parameters->subsampling_dx +\n 1) : cmptparm.x0 + (OPJ_UINT32)(w - 1) * (OPJ_UINT32)parameters->subsampling_dx\n + 1;\n cmptparm.h = !cmptparm.y0 ? (OPJ_UINT32)((h - 1) * parameters->subsampling_dy +\n 1) : cmptparm.y0 + (OPJ_UINT32)(h - 1) * (OPJ_UINT32)parameters->subsampling_dy\n + 1;\n\n if (sign == '-') {\n cmptparm.sgnd = 1;\n } else {\n cmptparm.sgnd = 0;\n }\n if (prec < 8) {\n force8 = 1;\n ushift = 8 - prec;\n dshift = prec - ushift;\n if (cmptparm.sgnd) {\n adjustS = (1 << (prec - 1));\n } else {\n adjustS = 0;\n }\n cmptparm.sgnd = 0;\n prec = 8;\n } else {\n ushift = dshift = force8 = adjustS = 0;\n }\n\n cmptparm.prec = (OPJ_UINT32)prec;\n cmptparm.bpp = (OPJ_UINT32)prec;\n cmptparm.dx = (OPJ_UINT32)parameters->subsampling_dx;\n cmptparm.dy = (OPJ_UINT32)parameters->subsampling_dy;\n\n /* create the image */\n image = opj_image_create((OPJ_UINT32)numcomps, &cmptparm, color_space);\n if (!image) {\n fclose(f);\n return NULL;\n }\n /* set image offset and reference grid */\n image->x0 = cmptparm.x0;\n image->y0 = cmptparm.x0;\n image->x1 = cmptparm.w;\n image->y1 = cmptparm.h;\n\n /* set image data */\n\n comp = &image->comps[0];\n\n for (i = 0; i < w * h; i++) {\n int v;\n if (force8) {\n v = readuchar(f) + adjustS;\n v = (v << ushift) + (v >> dshift);\n comp->data[i] = (unsigned char)v;\n\n if (v > max) {\n max = v;\n }\n\n continue;\n }\n if (comp->prec == 8) {\n if (!comp->sgnd) {\n v = readuchar(f);\n } else {\n v = (char) readuchar(f);\n }\n } else if (comp->prec <= 16) {\n if (!comp->sgnd) {\n v = readushort(f, bigendian);\n } else {\n v = (short) readushort(f, bigendian);\n }\n } else {\n if (!comp->sgnd) {\n v = (int)readuint(f, bigendian);\n } else {\n v = (int) readuint(f, bigendian);\n }\n }\n if (v > max) {\n max = v;\n }\n comp->data[i] = v;\n }\n fclose(f);\n comp->bpp = (OPJ_UINT32)int_floorlog2(max) + 1;\n\n return image;\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"pgxtoimage","file_name":"src/bin/jp2/convert.c","commit_link":"github.com/uclouvain/openjpeg/commit/e5285319229a5d77bf316bb0d3a6cbd3cb8666d9","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#4-6c549ab1f669","input":"STATIC SSize_t\nS_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,\n SSize_t *minlenp, SSize_t *deltap,\n\t\t\tregnode *last,\n\t\t\tscan_data_t *data,\n\t\t\tI32 stopparen,\n U32 recursed_depth,\n\t\t\tregnode_ssc *and_withp,\n\t\t\tU32 flags, U32 depth)\n\t\t\t/* scanp: Start here (read-write). */\n\t\t\t/* deltap: Write maxlen-minlen here. */\n\t\t\t/* last: Stop before this one. */\n\t\t\t/* data: string data about the pattern */\n\t\t\t/* stopparen: treat close N as END */\n\t\t\t/* recursed: which subroutines have we recursed into */\n\t\t\t/* and_withp: Valid if flags & SCF_DO_STCLASS_OR */\n{\n dVAR;\n /* There must be at least this number of characters to match */\n SSize_t min = 0;\n I32 pars = 0, code;\n regnode *scan = *scanp, *next;\n SSize_t delta = 0;\n int is_inf = (flags & SCF_DO_SUBSTR) && (data->flags & SF_IS_INF);\n int is_inf_internal = 0;\t\t/* The studied chunk is infinite */\n I32 is_par = OP(scan) == OPEN ? ARG(scan) : 0;\n scan_data_t data_fake;\n SV *re_trie_maxbuff = NULL;\n regnode *first_non_open = scan;\n SSize_t stopmin = SSize_t_MAX;\n scan_frame *frame = NULL;\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_STUDY_CHUNK;\n RExC_study_started= 1;\n\n Zero(&data_fake, 1, scan_data_t);\n\n if ( depth == 0 ) {\n while (first_non_open && OP(first_non_open) == OPEN)\n first_non_open=regnext(first_non_open);\n }\n\n\n fake_study_recurse:\n DEBUG_r(\n RExC_study_chunk_recursed_count++;\n );\n DEBUG_OPTIMISE_MORE_r(\n {\n Perl_re_indentf( aTHX_ \"study_chunk stopparen=%ld recursed_count=%lu depth=%lu recursed_depth=%lu scan=%p last=%p\",\n depth, (long)stopparen,\n (unsigned long)RExC_study_chunk_recursed_count,\n (unsigned long)depth, (unsigned long)recursed_depth,\n scan,\n last);\n if (recursed_depth) {\n U32 i;\n U32 j;\n for ( j = 0 ; j < recursed_depth ; j++ ) {\n for ( i = 0 ; i < (U32)RExC_total_parens ; i++ ) {\n if (\n PAREN_TEST(RExC_study_chunk_recursed +\n ( j * RExC_study_chunk_recursed_bytes), i )\n && (\n !j ||\n !PAREN_TEST(RExC_study_chunk_recursed +\n (( j - 1 ) * RExC_study_chunk_recursed_bytes), i)\n )\n ) {\n Perl_re_printf( aTHX_ \" %d\",(int)i);\n break;\n }\n }\n if ( j + 1 < recursed_depth ) {\n Perl_re_printf( aTHX_ \",\");\n }\n }\n }\n Perl_re_printf( aTHX_ \"\\n\");\n }\n );\n while ( scan && OP(scan) != END && scan < last ){\n UV min_subtract = 0; /* How mmany chars to subtract from the minimum\n node length to get a real minimum (because\n the folded version may be shorter) */\n\tbool unfolded_multi_char = FALSE;\n\t/* Peephole optimizer: */\n DEBUG_STUDYDATA(\"Peep\", data, depth, is_inf);\n DEBUG_PEEP(\"Peep\", scan, depth, flags);\n\n\n /* The reason we do this here is that we need to deal with things like\n * /(?:f)(?:o)(?:o)/ which cant be dealt with by the normal EXACT\n * parsing code, as each (?:..) is handled by a different invocation of\n * reg() -- Yves\n */\n JOIN_EXACT(scan,&min_subtract, &unfolded_multi_char, 0);\n\n\t/* Follow the next-chain of the current node and optimize\n\t away all the NOTHINGs from it. */\n\tif (OP(scan) != CURLYX) {\n\t const int max = (reg_off_by_arg[OP(scan)]\n\t\t ? I32_MAX\n\t\t /* I32 may be smaller than U16 on CRAYs! */\n\t\t : (I32_MAX < U16_MAX ? I32_MAX : U16_MAX));\n\t int off = (reg_off_by_arg[OP(scan)] ? ARG(scan) : NEXT_OFF(scan));\n\t int noff;\n\t regnode *n = scan;\n\n\t /* Skip NOTHING and LONGJMP. */\n\t while ((n = regnext(n))\n\t\t && ((PL_regkind[OP(n)] == NOTHING && (noff = NEXT_OFF(n)))\n\t\t || ((OP(n) == LONGJMP) && (noff = ARG(n))))\n\t\t && off + noff < max)\n\t\toff += noff;\n\t if (reg_off_by_arg[OP(scan)])\n\t\tARG(scan) = off;\n\t else\n\t\tNEXT_OFF(scan) = off;\n\t}\n\n\t/* The principal pseudo-switch. Cannot be a switch, since we\n\t look into several different things. */\n if ( OP(scan) == DEFINEP ) {\n SSize_t minlen = 0;\n SSize_t deltanext = 0;\n SSize_t fake_last_close = 0;\n I32 f = SCF_IN_DEFINE;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n scan = regnext(scan);\n assert( OP(scan) == IFTHEN );\n DEBUG_PEEP(\"expect IFTHEN\", scan, depth, flags);\n\n data_fake.last_closep= &fake_last_close;\n minlen = *minlenp;\n next = regnext(scan);\n scan = NEXTOPER(NEXTOPER(scan));\n DEBUG_PEEP(\"scan\", scan, depth, flags);\n DEBUG_PEEP(\"next\", next, depth, flags);\n\n /* we suppose the run is continuous, last=next...\n * NOTE we dont use the return here! */\n /* DEFINEP study_chunk() recursion */\n (void)study_chunk(pRExC_state, &scan, &minlen,\n &deltanext, next, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n\n scan = next;\n } else\n if (\n OP(scan) == BRANCH ||\n OP(scan) == BRANCHJ ||\n OP(scan) == IFTHEN\n ) {\n\t next = regnext(scan);\n\t code = OP(scan);\n\n /* The op(next)==code check below is to see if we\n * have \"BRANCH-BRANCH\", \"BRANCHJ-BRANCHJ\", \"IFTHEN-IFTHEN\"\n * IFTHEN is special as it might not appear in pairs.\n * Not sure whether BRANCH-BRANCHJ is possible, regardless\n * we dont handle it cleanly. */\n\t if (OP(next) == code || code == IFTHEN) {\n /* NOTE - There is similar code to this block below for\n * handling TRIE nodes on a re-study. If you change stuff here\n * check there too. */\n\t\tSSize_t max1 = 0, min1 = SSize_t_MAX, num = 0;\n\t\tregnode_ssc accum;\n\t\tregnode * const startbranch=scan;\n\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot merge strings after this. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n }\n\n if (flags & SCF_DO_STCLASS)\n\t\t ssc_init_zero(pRExC_state, &accum);\n\n\t\twhile (OP(scan) == code) {\n\t\t SSize_t deltanext, minnext, fake;\n\t\t I32 f = 0;\n\t\t regnode_ssc this_class;\n\n DEBUG_PEEP(\"Branch\", scan, depth, flags);\n\n\t\t num++;\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n\t\t if (data) {\n\t\t\tdata_fake.whilem_c = data->whilem_c;\n\t\t\tdata_fake.last_closep = data->last_closep;\n\t\t }\n\t\t else\n\t\t\tdata_fake.last_closep = &fake;\n\n\t\t data_fake.pos_delta = delta;\n\t\t next = regnext(scan);\n\n scan = NEXTOPER(scan); /* everything */\n if (code != BRANCH) /* everything but BRANCH */\n\t\t\tscan = NEXTOPER(scan);\n\n\t\t if (flags & SCF_DO_STCLASS) {\n\t\t\tssc_init(pRExC_state, &this_class);\n\t\t\tdata_fake.start_class = &this_class;\n\t\t\tf = SCF_DO_STCLASS_AND;\n\t\t }\n\t\t if (flags & SCF_WHILEM_VISITED_POS)\n\t\t\tf |= SCF_WHILEM_VISITED_POS;\n\n\t\t /* we suppose the run is continuous, last=next...*/\n /* recurse study_chunk() for each BRANCH in an alternation */\n\t\t minnext = study_chunk(pRExC_state, &scan, minlenp,\n &deltanext, next, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n\n\t\t if (min1 > minnext)\n\t\t\tmin1 = minnext;\n\t\t if (deltanext == SSize_t_MAX) {\n\t\t\tis_inf = is_inf_internal = 1;\n\t\t\tmax1 = SSize_t_MAX;\n\t\t } else if (max1 < minnext + deltanext)\n\t\t\tmax1 = minnext + deltanext;\n\t\t scan = next;\n\t\t if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n\t\t\tpars++;\n\t if (data_fake.flags & SCF_SEEN_ACCEPT) {\n\t if ( stopmin > minnext)\n\t stopmin = min + min1;\n\t flags &= ~SCF_DO_SUBSTR;\n\t if (data)\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t }\n\t\t if (data) {\n\t\t\tif (data_fake.flags & SF_HAS_EVAL)\n\t\t\t data->flags |= SF_HAS_EVAL;\n\t\t\tdata->whilem_c = data_fake.whilem_c;\n\t\t }\n\t\t if (flags & SCF_DO_STCLASS)\n\t\t\tssc_or(pRExC_state, &accum, (regnode_charclass*)&this_class);\n\t\t}\n\t\tif (code == IFTHEN && num < 2) /* Empty ELSE branch */\n\t\t min1 = 0;\n\t\tif (flags & SCF_DO_SUBSTR) {\n\t\t data->pos_min += min1;\n\t\t if (data->pos_delta >= SSize_t_MAX - (max1 - min1))\n\t\t data->pos_delta = SSize_t_MAX;\n\t\t else\n\t\t data->pos_delta += max1 - min1;\n\t\t if (max1 != min1 || is_inf)\n\t\t\tdata->cur_is_floating = 1;\n\t\t}\n\t\tmin += min1;\n\t\tif (delta == SSize_t_MAX\n\t\t || SSize_t_MAX - delta - (max1 - min1) < 0)\n\t\t delta = SSize_t_MAX;\n\t\telse\n\t\t delta += max1 - min1;\n\t\tif (flags & SCF_DO_STCLASS_OR) {\n\t\t ssc_or(pRExC_state, data->start_class, (regnode_charclass*) &accum);\n\t\t if (min1) {\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\t\tflags &= ~SCF_DO_STCLASS;\n\t\t }\n\t\t}\n\t\telse if (flags & SCF_DO_STCLASS_AND) {\n\t\t if (min1) {\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n\t\t\tflags &= ~SCF_DO_STCLASS;\n\t\t }\n\t\t else {\n\t\t\t/* Switch to OR mode: cache the old value of\n\t\t\t * data->start_class */\n\t\t\tINIT_AND_WITHP;\n\t\t\tStructCopy(data->start_class, and_withp, regnode_ssc);\n\t\t\tflags &= ~SCF_DO_STCLASS_AND;\n\t\t\tStructCopy(&accum, data->start_class, regnode_ssc);\n\t\t\tflags |= SCF_DO_STCLASS_OR;\n\t\t }\n\t\t}\n\n if (PERL_ENABLE_TRIE_OPTIMISATION &&\n OP( startbranch ) == BRANCH )\n {\n\t\t/* demq.\n\n Assuming this was/is a branch we are dealing with: 'scan'\n now points at the item that follows the branch sequence,\n whatever it is. We now start at the beginning of the\n sequence and look for subsequences of\n\n\t\t BRANCH->EXACT=>x1\n\t\t BRANCH->EXACT=>x2\n\t\t tail\n\n which would be constructed from a pattern like\n /A|LIST|OF|WORDS/\n\n\t\t If we can find such a subsequence we need to turn the first\n\t\t element into a trie and then add the subsequent branch exact\n\t\t strings to the trie.\n\n\t\t We have two cases\n\n 1. patterns where the whole set of branches can be\n converted.\n\n\t\t 2. patterns where only a subset can be converted.\n\n\t\t In case 1 we can replace the whole set with a single regop\n\t\t for the trie. In case 2 we need to keep the start and end\n\t\t branches so\n\n\t\t 'BRANCH EXACT; BRANCH EXACT; BRANCH X'\n\t\t becomes BRANCH TRIE; BRANCH X;\n\n\t\t There is an additional case, that being where there is a\n\t\t common prefix, which gets split out into an EXACT like node\n\t\t preceding the TRIE node.\n\n\t\t If x(1..n)==tail then we can do a simple trie, if not we make\n\t\t a \"jump\" trie, such that when we match the appropriate word\n\t\t we \"jump\" to the appropriate tail node. Essentially we turn\n\t\t a nested if into a case structure of sorts.\n\n\t\t*/\n\n\t\t int made=0;\n\t\t if (!re_trie_maxbuff) {\n\t\t\tre_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1);\n\t\t\tif (!SvIOK(re_trie_maxbuff))\n\t\t\t sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT);\n\t\t }\n if ( SvIV(re_trie_maxbuff)>=0 ) {\n regnode *cur;\n regnode *first = (regnode *)NULL;\n regnode *last = (regnode *)NULL;\n regnode *tail = scan;\n U8 trietype = 0;\n U32 count=0;\n\n /* var tail is used because there may be a TAIL\n regop in the way. Ie, the exacts will point to the\n thing following the TAIL, but the last branch will\n point at the TAIL. So we advance tail. If we\n have nested (?:) we may have to move through several\n tails.\n */\n\n while ( OP( tail ) == TAIL ) {\n /* this is the TAIL generated by (?:) */\n tail = regnext( tail );\n }\n\n\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, tail, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"%s %\" UVuf \":%s\\n\",\n depth+1,\n \"Looking for TRIE'able sequences. Tail node is \",\n (UV) REGNODE_OFFSET(tail),\n SvPV_nolen_const( RExC_mysv )\n );\n });\n\n /*\n\n Step through the branches\n cur represents each branch,\n noper is the first thing to be matched as part\n of that branch\n noper_next is the regnext() of that node.\n\n We normally handle a case like this\n /FOO[xyz]|BAR[pqr]/ via a \"jump trie\" but we also\n support building with NOJUMPTRIE, which restricts\n the trie logic to structures like /FOO|BAR/.\n\n If noper is a trieable nodetype then the branch is\n a possible optimization target. If we are building\n under NOJUMPTRIE then we require that noper_next is\n the same as scan (our current position in the regex\n program).\n\n Once we have two or more consecutive such branches\n we can create a trie of the EXACT's contents and\n stitch it in place into the program.\n\n If the sequence represents all of the branches in\n the alternation we replace the entire thing with a\n single TRIE node.\n\n Otherwise when it is a subsequence we need to\n stitch it in place and replace only the relevant\n branches. This means the first branch has to remain\n as it is used by the alternation logic, and its\n next pointer, and needs to be repointed at the item\n on the branch chain following the last branch we\n have optimized away.\n\n This could be either a BRANCH, in which case the\n subsequence is internal, or it could be the item\n following the branch sequence in which case the\n subsequence is at the end (which does not\n necessarily mean the first node is the start of the\n alternation).\n\n TRIE_TYPE(X) is a define which maps the optype to a\n trietype.\n\n optype | trietype\n ----------------+-----------\n NOTHING | NOTHING\n EXACT | EXACT\n EXACT_ONLY8 | EXACT\n EXACTFU | EXACTFU\n EXACTFU_ONLY8 | EXACTFU\n EXACTFUP | EXACTFU\n EXACTFAA | EXACTFAA\n EXACTL | EXACTL\n EXACTFLU8 | EXACTFLU8\n\n\n */\n#define TRIE_TYPE(X) ( ( NOTHING == (X) ) \\\n ? NOTHING \\\n : ( EXACT == (X) || EXACT_ONLY8 == (X) ) \\\n ? EXACT \\\n : ( EXACTFU == (X) \\\n || EXACTFU_ONLY8 == (X) \\\n || EXACTFUP == (X) ) \\\n ? EXACTFU \\\n : ( EXACTFAA == (X) ) \\\n ? EXACTFAA \\\n : ( EXACTL == (X) ) \\\n ? EXACTL \\\n : ( EXACTFLU8 == (X) ) \\\n ? EXACTFLU8 \\\n : 0 )\n\n /* dont use tail as the end marker for this traverse */\n for ( cur = startbranch ; cur != scan ; cur = regnext( cur ) ) {\n regnode * const noper = NEXTOPER( cur );\n U8 noper_type = OP( noper );\n U8 noper_trietype = TRIE_TYPE( noper_type );\n#if defined(DEBUGGING) || defined(NOJUMPTRIE)\n regnode * const noper_next = regnext( noper );\n U8 noper_next_type = (noper_next && noper_next < tail) ? OP(noper_next) : 0;\n U8 noper_next_trietype = (noper_next && noper_next < tail) ? TRIE_TYPE( noper_next_type ) :0;\n#endif\n\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %d:%s (%d)\",\n depth+1,\n REG_NODE_NUM(cur), SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur) );\n\n regprop(RExC_rx, RExC_mysv, noper, NULL, pRExC_state);\n Perl_re_printf( aTHX_ \" -> %d:%s\",\n REG_NODE_NUM(noper), SvPV_nolen_const(RExC_mysv));\n\n if ( noper_next ) {\n regprop(RExC_rx, RExC_mysv, noper_next, NULL, pRExC_state);\n Perl_re_printf( aTHX_ \"\\t=> %d:%s\\t\",\n REG_NODE_NUM(noper_next), SvPV_nolen_const(RExC_mysv));\n }\n Perl_re_printf( aTHX_ \"(First==%d,Last==%d,Cur==%d,tt==%s,ntt==%s,nntt==%s)\\n\",\n REG_NODE_NUM(first), REG_NODE_NUM(last), REG_NODE_NUM(cur),\n\t\t\t\t PL_reg_name[trietype], PL_reg_name[noper_trietype], PL_reg_name[noper_next_trietype]\n\t\t\t\t);\n });\n\n /* Is noper a trieable nodetype that can be merged\n * with the current trie (if there is one)? */\n if ( noper_trietype\n &&\n (\n ( noper_trietype == NOTHING )\n || ( trietype == NOTHING )\n || ( trietype == noper_trietype )\n )\n#ifdef NOJUMPTRIE\n && noper_next >= tail\n#endif\n && count < U16_MAX)\n {\n /* Handle mergable triable node Either we are\n * the first node in a new trieable sequence,\n * in which case we do some bookkeeping,\n * otherwise we update the end pointer. */\n if ( !first ) {\n first = cur;\n\t\t\t\t if ( noper_trietype == NOTHING ) {\n#if !defined(DEBUGGING) && !defined(NOJUMPTRIE)\n\t\t\t\t\tregnode * const noper_next = regnext( noper );\n U8 noper_next_type = (noper_next && noper_next < tail) ? OP(noper_next) : 0;\n\t\t\t\t\tU8 noper_next_trietype = noper_next_type ? TRIE_TYPE( noper_next_type ) :0;\n#endif\n\n if ( noper_next_trietype ) {\n\t\t\t\t\t trietype = noper_next_trietype;\n } else if (noper_next_type) {\n /* a NOTHING regop is 1 regop wide.\n * We need at least two for a trie\n * so we can't merge this in */\n first = NULL;\n }\n } else {\n trietype = noper_trietype;\n }\n } else {\n if ( trietype == NOTHING )\n trietype = noper_trietype;\n last = cur;\n }\n\t\t\t\tif (first)\n\t\t\t\t count++;\n } /* end handle mergable triable node */\n else {\n /* handle unmergable node -\n * noper may either be a triable node which can\n * not be tried together with the current trie,\n * or a non triable node */\n if ( last ) {\n /* If last is set and trietype is not\n * NOTHING then we have found at least two\n * triable branch sequences in a row of a\n * similar trietype so we can turn them\n * into a trie. If/when we allow NOTHING to\n * start a trie sequence this condition\n * will be required, and it isn't expensive\n * so we leave it in for now. */\n if ( trietype && trietype != NOTHING )\n make_trie( pRExC_state,\n startbranch, first, cur, tail,\n count, trietype, depth+1 );\n last = NULL; /* note: we clear/update\n first, trietype etc below,\n so we dont do it here */\n }\n if ( noper_trietype\n#ifdef NOJUMPTRIE\n && noper_next >= tail\n#endif\n ){\n /* noper is triable, so we can start a new\n * trie sequence */\n count = 1;\n first = cur;\n trietype = noper_trietype;\n } else if (first) {\n /* if we already saw a first but the\n * current node is not triable then we have\n * to reset the first information. */\n count = 0;\n first = NULL;\n trietype = 0;\n }\n } /* end handle unmergable node */\n } /* loop over branches */\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %s (%d) \",\n depth+1, SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur));\n Perl_re_printf( aTHX_ \"(First==%d, Last==%d, Cur==%d, tt==%s)\\n\",\n REG_NODE_NUM(first), REG_NODE_NUM(last), REG_NODE_NUM(cur),\n PL_reg_name[trietype]\n );\n\n });\n if ( last && trietype ) {\n if ( trietype != NOTHING ) {\n /* the last branch of the sequence was part of\n * a trie, so we have to construct it here\n * outside of the loop */\n made= make_trie( pRExC_state, startbranch,\n first, scan, tail, count,\n trietype, depth+1 );\n#ifdef TRIE_STUDY_OPT\n if ( ((made == MADE_EXACT_TRIE &&\n startbranch == first)\n || ( first_non_open == first )) &&\n depth==0 ) {\n flags |= SCF_TRIE_RESTUDY;\n if ( startbranch == first\n && scan >= tail )\n {\n RExC_seen &=~REG_TOP_LEVEL_BRANCHES_SEEN;\n }\n }\n#endif\n } else {\n /* at this point we know whatever we have is a\n * NOTHING sequence/branch AND if 'startbranch'\n * is 'first' then we can turn the whole thing\n * into a NOTHING\n */\n if ( startbranch == first ) {\n regnode *opt;\n /* the entire thing is a NOTHING sequence,\n * something like this: (?:|) So we can\n * turn it into a plain NOTHING op. */\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %s (%d) \\n\",\n depth+1,\n SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur));\n\n });\n OP(startbranch)= NOTHING;\n NEXT_OFF(startbranch)= tail - startbranch;\n for ( opt= startbranch + 1; opt < tail ; opt++ )\n OP(opt)= OPTIMIZED;\n }\n }\n } /* end if ( last) */\n } /* TRIE_MAXBUF is non zero */\n\n } /* do trie */\n\n\t }\n\t else if ( code == BRANCHJ ) { /* single branch is optimized. */\n\t\tscan = NEXTOPER(NEXTOPER(scan));\n\t } else\t\t\t/* single branch is optimized. */\n\t\tscan = NEXTOPER(scan);\n\t continue;\n } else if (OP(scan) == SUSPEND || OP(scan) == GOSUB) {\n I32 paren = 0;\n regnode *start = NULL;\n regnode *end = NULL;\n U32 my_recursed_depth= recursed_depth;\n\n if (OP(scan) != SUSPEND) { /* GOSUB */\n /* Do setup, note this code has side effects beyond\n * the rest of this block. Specifically setting\n * RExC_recurse[] must happen at least once during\n * study_chunk(). */\n paren = ARG(scan);\n RExC_recurse[ARG2L(scan)] = scan;\n start = REGNODE_p(RExC_open_parens[paren]);\n end = REGNODE_p(RExC_close_parens[paren]);\n\n /* NOTE we MUST always execute the above code, even\n * if we do nothing with a GOSUB */\n if (\n ( flags & SCF_IN_DEFINE )\n ||\n (\n (is_inf_internal || is_inf || (data && data->flags & SF_IS_INF))\n &&\n ( (flags & (SCF_DO_STCLASS | SCF_DO_SUBSTR)) == 0 )\n )\n ) {\n /* no need to do anything here if we are in a define. */\n /* or we are after some kind of infinite construct\n * so we can skip recursing into this item.\n * Since it is infinite we will not change the maxlen\n * or delta, and if we miss something that might raise\n * the minlen it will merely pessimise a little.\n *\n * Iow /(?(DEFINE)(?foo|food))a+(?&foo)/\n * might result in a minlen of 1 and not of 4,\n * but this doesn't make us mismatch, just try a bit\n * harder than we should.\n * */\n scan= regnext(scan);\n continue;\n }\n\n if (\n !recursed_depth\n ||\n !PAREN_TEST(RExC_study_chunk_recursed + ((recursed_depth-1) * RExC_study_chunk_recursed_bytes), paren)\n ) {\n /* it is quite possible that there are more efficient ways\n * to do this. We maintain a bitmap per level of recursion\n * of which patterns we have entered so we can detect if a\n * pattern creates a possible infinite loop. When we\n * recurse down a level we copy the previous levels bitmap\n * down. When we are at recursion level 0 we zero the top\n * level bitmap. It would be nice to implement a different\n * more efficient way of doing this. In particular the top\n * level bitmap may be unnecessary.\n */\n if (!recursed_depth) {\n Zero(RExC_study_chunk_recursed, RExC_study_chunk_recursed_bytes, U8);\n } else {\n Copy(RExC_study_chunk_recursed + ((recursed_depth-1) * RExC_study_chunk_recursed_bytes),\n RExC_study_chunk_recursed + (recursed_depth * RExC_study_chunk_recursed_bytes),\n RExC_study_chunk_recursed_bytes, U8);\n }\n /* we havent recursed into this paren yet, so recurse into it */\n DEBUG_STUDYDATA(\"gosub-set\", data, depth, is_inf);\n PAREN_SET(RExC_study_chunk_recursed + (recursed_depth * RExC_study_chunk_recursed_bytes), paren);\n my_recursed_depth= recursed_depth + 1;\n } else {\n DEBUG_STUDYDATA(\"gosub-inf\", data, depth, is_inf);\n /* some form of infinite recursion, assume infinite length\n * */\n if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n data->cur_is_floating = 1;\n }\n is_inf = is_inf_internal = 1;\n if (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n ssc_anything(data->start_class);\n flags &= ~SCF_DO_STCLASS;\n\n start= NULL; /* reset start so we dont recurse later on. */\n\t }\n } else {\n\t paren = stopparen;\n start = scan + 2;\n\t end = regnext(scan);\n\t }\n if (start) {\n scan_frame *newframe;\n assert(end);\n if (!RExC_frame_last) {\n Newxz(newframe, 1, scan_frame);\n SAVEDESTRUCTOR_X(S_unwind_scan_frames, newframe);\n RExC_frame_head= newframe;\n RExC_frame_count++;\n } else if (!RExC_frame_last->next_frame) {\n Newxz(newframe, 1, scan_frame);\n RExC_frame_last->next_frame= newframe;\n newframe->prev_frame= RExC_frame_last;\n RExC_frame_count++;\n } else {\n newframe= RExC_frame_last->next_frame;\n }\n RExC_frame_last= newframe;\n\n newframe->next_regnode = regnext(scan);\n newframe->last_regnode = last;\n newframe->stopparen = stopparen;\n newframe->prev_recursed_depth = recursed_depth;\n newframe->this_prev_frame= frame;\n\n DEBUG_STUDYDATA(\"frame-new\", data, depth, is_inf);\n DEBUG_PEEP(\"fnew\", scan, depth, flags);\n\n\t frame = newframe;\n\t scan = start;\n\t stopparen = paren;\n\t last = end;\n depth = depth + 1;\n recursed_depth= my_recursed_depth;\n\n\t continue;\n\t }\n\t}\n\telse if ( OP(scan) == EXACT\n || OP(scan) == EXACT_ONLY8\n || OP(scan) == EXACTL)\n {\n\t SSize_t l = STR_LEN(scan);\n\t UV uc;\n assert(l);\n\t if (UTF) {\n\t\tconst U8 * const s = (U8*)STRING(scan);\n\t\tuc = utf8_to_uvchr_buf(s, s + l, NULL);\n\t\tl = utf8_length(s, s + l);\n\t } else {\n\t\tuc = *((U8*)STRING(scan));\n\t }\n\t min += l;\n\t if (flags & SCF_DO_SUBSTR) { /* Update longest substr. */\n\t\t/* The code below prefers earlier match for fixed\n\t\t offset, later match for variable offset. */\n\t\tif (data->last_end == -1) { /* Update the start info. */\n\t\t data->last_start_min = data->pos_min;\n \t\t data->last_start_max = is_inf\n \t\t\t? SSize_t_MAX : data->pos_min + data->pos_delta;\n\t\t}\n\t\tsv_catpvn(data->last_found, STRING(scan), STR_LEN(scan));\n\t\tif (UTF)\n\t\t SvUTF8_on(data->last_found);\n\t\t{\n\t\t SV * const sv = data->last_found;\n\t\t MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\t\t if (mg && mg->mg_len >= 0)\n\t\t\tmg->mg_len += utf8_length((U8*)STRING(scan),\n (U8*)STRING(scan)+STR_LEN(scan));\n\t\t}\n\t\tdata->last_end = data->pos_min + l;\n\t\tdata->pos_min += l; /* As in the first entry. */\n\t\tdata->flags &= ~SF_BEFORE_EOL;\n\t }\n\n /* ANDing the code point leaves at most it, and not in locale, and\n * can't match null string */\n\t if (flags & SCF_DO_STCLASS_AND) {\n ssc_cp_and(data->start_class, uc);\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n ssc_clear_locale(data->start_class);\n\t }\n\t else if (flags & SCF_DO_STCLASS_OR) {\n ssc_add_cp(data->start_class, uc);\n\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n\t }\n\t flags &= ~SCF_DO_STCLASS;\n\t}\n else if (PL_regkind[OP(scan)] == EXACT) {\n /* But OP != EXACT!, so is EXACTFish */\n\t SSize_t l = STR_LEN(scan);\n const U8 * s = (U8*)STRING(scan);\n\n\t /* Search for fixed substrings supports EXACT only. */\n\t if (flags & SCF_DO_SUBSTR) {\n\t\tassert(data);\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t }\n\t if (UTF) {\n\t\tl = utf8_length(s, s + l);\n\t }\n\t if (unfolded_multi_char) {\n RExC_seen |= REG_UNFOLDED_MULTI_SEEN;\n\t }\n\t min += l - min_subtract;\n assert (min >= 0);\n delta += min_subtract;\n\t if (flags & SCF_DO_SUBSTR) {\n\t\tdata->pos_min += l - min_subtract;\n\t\tif (data->pos_min < 0) {\n data->pos_min = 0;\n }\n data->pos_delta += min_subtract;\n\t\tif (min_subtract) {\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t }\n\n if (flags & SCF_DO_STCLASS) {\n SV* EXACTF_invlist = _make_exactf_invlist(pRExC_state, scan);\n\n assert(EXACTF_invlist);\n if (flags & SCF_DO_STCLASS_AND) {\n if (OP(scan) != EXACTFL)\n ssc_clear_locale(data->start_class);\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n ANYOF_POSIXL_ZERO(data->start_class);\n ssc_intersection(data->start_class, EXACTF_invlist, FALSE);\n }\n else { /* SCF_DO_STCLASS_OR */\n ssc_union(data->start_class, EXACTF_invlist, FALSE);\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n }\n flags &= ~SCF_DO_STCLASS;\n SvREFCNT_dec(EXACTF_invlist);\n }\n\t}\n\telse if (REGNODE_VARIES(OP(scan))) {\n\t SSize_t mincount, maxcount, minnext, deltanext, pos_before = 0;\n\t I32 fl = 0, f = flags;\n\t regnode * const oscan = scan;\n\t regnode_ssc this_class;\n\t regnode_ssc *oclass = NULL;\n\t I32 next_is_eval = 0;\n\n\t switch (PL_regkind[OP(scan)]) {\n\t case WHILEM:\t\t/* End of (?:...)* . */\n\t\tscan = NEXTOPER(scan);\n\t\tgoto finish;\n\t case PLUS:\n\t\tif (flags & (SCF_DO_SUBSTR | SCF_DO_STCLASS)) {\n\t\t next = NEXTOPER(scan);\n\t\t if ( OP(next) == EXACT\n || OP(next) == EXACT_ONLY8\n || OP(next) == EXACTL\n || (flags & SCF_DO_STCLASS))\n {\n\t\t\tmincount = 1;\n\t\t\tmaxcount = REG_INFTY;\n\t\t\tnext = regnext(scan);\n\t\t\tscan = NEXTOPER(scan);\n\t\t\tgoto do_curly;\n\t\t }\n\t\t}\n\t\tif (flags & SCF_DO_SUBSTR)\n\t\t data->pos_min++;\n\t\tmin++;\n\t\t/* FALLTHROUGH */\n\t case STAR:\n next = NEXTOPER(scan);\n\n /* This temporary node can now be turned into EXACTFU, and\n * must, as regexec.c doesn't handle it */\n if (OP(next) == EXACTFU_S_EDGE) {\n OP(next) = EXACTFU;\n }\n\n if ( STR_LEN(next) == 1\n && isALPHA_A(* STRING(next))\n && ( OP(next) == EXACTFAA\n || ( OP(next) == EXACTFU\n && ! HAS_NONLATIN1_SIMPLE_FOLD_CLOSURE(* STRING(next)))))\n {\n /* These differ in just one bit */\n U8 mask = ~ ('A' ^ 'a');\n\n assert(isALPHA_A(* STRING(next)));\n\n /* Then replace it by an ANYOFM node, with\n * the mask set to the complement of the\n * bit that differs between upper and lower\n * case, and the lowest code point of the\n * pair (which the '&' forces) */\n OP(next) = ANYOFM;\n ARG_SET(next, *STRING(next) & mask);\n FLAGS(next) = mask;\n }\n\n\t\tif (flags & SCF_DO_STCLASS) {\n\t\t mincount = 0;\n\t\t maxcount = REG_INFTY;\n\t\t next = regnext(scan);\n\t\t scan = NEXTOPER(scan);\n\t\t goto do_curly;\n\t\t}\n\t\tif (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n /* Cannot extend fixed substrings */\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n is_inf = is_inf_internal = 1;\n scan = regnext(scan);\n\t\tgoto optimize_curly_tail;\n\t case CURLY:\n\t if (stopparen>0 && (OP(scan)==CURLYN || OP(scan)==CURLYM)\n\t && (scan->flags == stopparen))\n\t\t{\n\t\t mincount = 1;\n\t\t maxcount = 1;\n\t\t} else {\n\t\t mincount = ARG1(scan);\n\t\t maxcount = ARG2(scan);\n\t\t}\n\t\tnext = regnext(scan);\n\t\tif (OP(scan) == CURLYX) {\n\t\t I32 lp = (data ? *(data->last_closep) : 0);\n\t\t scan->flags = ((lp <= (I32)U8_MAX) ? (U8)lp : U8_MAX);\n\t\t}\n\t\tscan = NEXTOPER(scan) + EXTRA_STEP_2ARGS;\n\t\tnext_is_eval = (OP(scan) == EVAL);\n\t do_curly:\n\t\tif (flags & SCF_DO_SUBSTR) {\n if (mincount == 0)\n scan_commit(pRExC_state, data, minlenp, is_inf);\n /* Cannot extend fixed substrings */\n\t\t pos_before = data->pos_min;\n\t\t}\n\t\tif (data) {\n\t\t fl = data->flags;\n\t\t data->flags &= ~(SF_HAS_PAR|SF_IN_PAR|SF_HAS_EVAL);\n\t\t if (is_inf)\n\t\t\tdata->flags |= SF_IS_INF;\n\t\t}\n\t\tif (flags & SCF_DO_STCLASS) {\n\t\t ssc_init(pRExC_state, &this_class);\n\t\t oclass = data->start_class;\n\t\t data->start_class = &this_class;\n\t\t f |= SCF_DO_STCLASS_AND;\n\t\t f &= ~SCF_DO_STCLASS_OR;\n\t\t}\n\t /* Exclude from super-linear cache processing any {n,m}\n\t\t regops for which the combination of input pos and regex\n\t\t pos is not enough information to determine if a match\n\t\t will be possible.\n\n\t\t For example, in the regex /foo(bar\\s*){4,8}baz/ with the\n\t\t regex pos at the \\s*, the prospects for a match depend not\n\t\t only on the input position but also on how many (bar\\s*)\n\t\t repeats into the {4,8} we are. */\n if ((mincount > 1) || (maxcount > 1 && maxcount != REG_INFTY))\n\t\t f &= ~SCF_WHILEM_VISITED_POS;\n\n\t\t/* This will finish on WHILEM, setting scan, or on NULL: */\n /* recurse study_chunk() on loop bodies */\n\t\tminnext = study_chunk(pRExC_state, &scan, minlenp, &deltanext,\n last, data, stopparen, recursed_depth, NULL,\n (mincount == 0\n ? (f & ~SCF_DO_SUBSTR)\n : f)\n ,depth+1);\n\n\t\tif (flags & SCF_DO_STCLASS)\n\t\t data->start_class = oclass;\n\t\tif (mincount == 0 || minnext == 0) {\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\tssc_or(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t }\n\t\t else if (flags & SCF_DO_STCLASS_AND) {\n\t\t\t/* Switch to OR mode: cache the old value of\n\t\t\t * data->start_class */\n\t\t\tINIT_AND_WITHP;\n\t\t\tStructCopy(data->start_class, and_withp, regnode_ssc);\n\t\t\tflags &= ~SCF_DO_STCLASS_AND;\n\t\t\tStructCopy(&this_class, data->start_class, regnode_ssc);\n\t\t\tflags |= SCF_DO_STCLASS_OR;\n ANYOF_FLAGS(data->start_class)\n |= SSC_MATCHES_EMPTY_STRING;\n\t\t }\n\t\t} else {\t\t/* Non-zero len */\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\tssc_or(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\t }\n\t\t else if (flags & SCF_DO_STCLASS_AND)\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t flags &= ~SCF_DO_STCLASS;\n\t\t}\n\t\tif (!scan) \t\t/* It was not CURLYX, but CURLY. */\n\t\t scan = next;\n\t\tif (((flags & (SCF_TRIE_DOING_RESTUDY|SCF_DO_SUBSTR))==SCF_DO_SUBSTR)\n\t\t /* ? quantifier ok, except for (?{ ... }) */\n\t\t && (next_is_eval || !(mincount == 0 && maxcount == 1))\n\t\t && (minnext == 0) && (deltanext == 0)\n\t\t && data && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))\n && maxcount <= REG_INFTY/3) /* Complement check for big\n count */\n\t\t{\n\t\t _WARN_HELPER(RExC_precomp_end, packWARN(WARN_REGEXP),\n Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP),\n \"Quantifier unexpected on zero-length expression \"\n \"in regex m/%\" UTF8f \"/\",\n\t\t\t UTF8fARG(UTF, RExC_precomp_end - RExC_precomp,\n\t\t\t\t RExC_precomp)));\n }\n\n\t\tmin += minnext * mincount;\n\t\tis_inf_internal |= deltanext == SSize_t_MAX\n || (maxcount == REG_INFTY && minnext + deltanext > 0);\n\t\tis_inf |= is_inf_internal;\n if (is_inf) {\n\t\t delta = SSize_t_MAX;\n } else {\n\t\t delta += (minnext + deltanext) * maxcount\n - minnext * mincount;\n }\n\t\t/* Try powerful optimization CURLYX => CURLYN. */\n\t\tif ( OP(oscan) == CURLYX && data\n\t\t && data->flags & SF_IN_PAR\n\t\t && !(data->flags & SF_HAS_EVAL)\n\t\t && !deltanext && minnext == 1 ) {\n\t\t /* Try to optimize to CURLYN. */\n\t\t regnode *nxt = NEXTOPER(oscan) + EXTRA_STEP_2ARGS;\n\t\t regnode * const nxt1 = nxt;\n#ifdef DEBUGGING\n\t\t regnode *nxt2;\n#endif\n\n\t\t /* Skip open. */\n\t\t nxt = regnext(nxt);\n\t\t if (!REGNODE_SIMPLE(OP(nxt))\n\t\t\t&& !(PL_regkind[OP(nxt)] == EXACT\n\t\t\t && STR_LEN(nxt) == 1))\n\t\t\tgoto nogo;\n#ifdef DEBUGGING\n\t\t nxt2 = nxt;\n#endif\n\t\t nxt = regnext(nxt);\n\t\t if (OP(nxt) != CLOSE)\n\t\t\tgoto nogo;\n\t\t if (RExC_open_parens) {\n\n /*open->CURLYM*/\n RExC_open_parens[ARG(nxt1)] = REGNODE_OFFSET(oscan);\n\n /*close->while*/\n RExC_close_parens[ARG(nxt1)] = REGNODE_OFFSET(nxt) + 2;\n\t\t }\n\t\t /* Now we know that nxt2 is the only contents: */\n\t\t oscan->flags = (U8)ARG(nxt);\n\t\t OP(oscan) = CURLYN;\n\t\t OP(nxt1) = NOTHING;\t/* was OPEN. */\n\n#ifdef DEBUGGING\n\t\t OP(nxt1 + 1) = OPTIMIZED; /* was count. */\n\t\t NEXT_OFF(nxt1+ 1) = 0; /* just for consistency. */\n\t\t NEXT_OFF(nxt2) = 0;\t/* just for consistency with CURLY. */\n\t\t OP(nxt) = OPTIMIZED;\t/* was CLOSE. */\n\t\t OP(nxt + 1) = OPTIMIZED; /* was count. */\n\t\t NEXT_OFF(nxt+ 1) = 0; /* just for consistency. */\n#endif\n\t\t}\n\t nogo:\n\n\t\t/* Try optimization CURLYX => CURLYM. */\n\t\tif ( OP(oscan) == CURLYX && data\n\t\t && !(data->flags & SF_HAS_PAR)\n\t\t && !(data->flags & SF_HAS_EVAL)\n\t\t && !deltanext\t/* atom is fixed width */\n\t\t && minnext != 0\t/* CURLYM can't handle zero width */\n\n /* Nor characters whose fold at run-time may be\n * multi-character */\n && ! (RExC_seen & REG_UNFOLDED_MULTI_SEEN)\n\t\t) {\n\t\t /* XXXX How to optimize if data == 0? */\n\t\t /* Optimize to a simpler form. */\n\t\t regnode *nxt = NEXTOPER(oscan) + EXTRA_STEP_2ARGS; /* OPEN */\n\t\t regnode *nxt2;\n\n\t\t OP(oscan) = CURLYM;\n\t\t while ( (nxt2 = regnext(nxt)) /* skip over embedded stuff*/\n\t\t\t && (OP(nxt2) != WHILEM))\n\t\t\tnxt = nxt2;\n\t\t OP(nxt2) = SUCCEED; /* Whas WHILEM */\n\t\t /* Need to optimize away parenths. */\n\t\t if ((data->flags & SF_IN_PAR) && OP(nxt) == CLOSE) {\n\t\t\t/* Set the parenth number. */\n\t\t\tregnode *nxt1 = NEXTOPER(oscan) + EXTRA_STEP_2ARGS; /* OPEN*/\n\n\t\t\toscan->flags = (U8)ARG(nxt);\n\t\t\tif (RExC_open_parens) {\n /*open->CURLYM*/\n RExC_open_parens[ARG(nxt1)] = REGNODE_OFFSET(oscan);\n\n /*close->NOTHING*/\n RExC_close_parens[ARG(nxt1)] = REGNODE_OFFSET(nxt2)\n + 1;\n\t\t\t}\n\t\t\tOP(nxt1) = OPTIMIZED;\t/* was OPEN. */\n\t\t\tOP(nxt) = OPTIMIZED;\t/* was CLOSE. */\n\n#ifdef DEBUGGING\n\t\t\tOP(nxt1 + 1) = OPTIMIZED; /* was count. */\n\t\t\tOP(nxt + 1) = OPTIMIZED; /* was count. */\n\t\t\tNEXT_OFF(nxt1 + 1) = 0; /* just for consistency. */\n\t\t\tNEXT_OFF(nxt + 1) = 0; /* just for consistency. */\n#endif\n#if 0\n\t\t\twhile ( nxt1 && (OP(nxt1) != WHILEM)) {\n\t\t\t regnode *nnxt = regnext(nxt1);\n\t\t\t if (nnxt == nxt) {\n\t\t\t\tif (reg_off_by_arg[OP(nxt1)])\n\t\t\t\t ARG_SET(nxt1, nxt2 - nxt1);\n\t\t\t\telse if (nxt2 - nxt1 < U16_MAX)\n\t\t\t\t NEXT_OFF(nxt1) = nxt2 - nxt1;\n\t\t\t\telse\n\t\t\t\t OP(nxt) = NOTHING;\t/* Cannot beautify */\n\t\t\t }\n\t\t\t nxt1 = nnxt;\n\t\t\t}\n#endif\n\t\t\t/* Optimize again: */\n /* recurse study_chunk() on optimised CURLYX => CURLYM */\n\t\t\tstudy_chunk(pRExC_state, &nxt1, minlenp, &deltanext, nxt,\n NULL, stopparen, recursed_depth, NULL, 0,\n depth+1);\n\t\t }\n\t\t else\n\t\t\toscan->flags = 0;\n\t\t}\n\t\telse if ((OP(oscan) == CURLYX)\n\t\t\t && (flags & SCF_WHILEM_VISITED_POS)\n\t\t\t /* See the comment on a similar expression above.\n\t\t\t However, this time it's not a subexpression\n\t\t\t we care about, but the expression itself. */\n\t\t\t && (maxcount == REG_INFTY)\n\t\t\t && data) {\n\t\t /* This stays as CURLYX, we can put the count/of pair. */\n\t\t /* Find WHILEM (as in regexec.c) */\n\t\t regnode *nxt = oscan + NEXT_OFF(oscan);\n\n\t\t if (OP(PREVOPER(nxt)) == NOTHING) /* LONGJMP */\n\t\t\tnxt += ARG(nxt);\n nxt = PREVOPER(nxt);\n if (nxt->flags & 0xf) {\n /* we've already set whilem count on this node */\n } else if (++data->whilem_c < 16) {\n assert(data->whilem_c <= RExC_whilem_seen);\n nxt->flags = (U8)(data->whilem_c\n | (RExC_whilem_seen << 4)); /* On WHILEM */\n }\n\t\t}\n\t\tif (data && fl & (SF_HAS_PAR|SF_IN_PAR))\n\t\t pars++;\n\t\tif (flags & SCF_DO_SUBSTR) {\n\t\t SV *last_str = NULL;\n STRLEN last_chrs = 0;\n\t\t int counted = mincount != 0;\n\n if (data->last_end > 0 && mincount != 0) { /* Ends with a\n string. */\n\t\t\tSSize_t b = pos_before >= data->last_start_min\n\t\t\t ? pos_before : data->last_start_min;\n\t\t\tSTRLEN l;\n\t\t\tconst char * const s = SvPV_const(data->last_found, l);\n\t\t\tSSize_t old = b - data->last_start_min;\n assert(old >= 0);\n\n\t\t\tif (UTF)\n\t\t\t old = utf8_hop_forward((U8*)s, old,\n (U8 *) SvEND(data->last_found))\n - (U8*)s;\n\t\t\tl -= old;\n\t\t\t/* Get the added string: */\n\t\t\tlast_str = newSVpvn_utf8(s + old, l, UTF);\n last_chrs = UTF ? utf8_length((U8*)(s + old),\n (U8*)(s + old + l)) : l;\n\t\t\tif (deltanext == 0 && pos_before == b) {\n\t\t\t /* What was added is a constant string */\n\t\t\t if (mincount > 1) {\n\n\t\t\t\tSvGROW(last_str, (mincount * l) + 1);\n\t\t\t\trepeatcpy(SvPVX(last_str) + l,\n\t\t\t\t\t SvPVX_const(last_str), l,\n mincount - 1);\n\t\t\t\tSvCUR_set(last_str, SvCUR(last_str) * mincount);\n\t\t\t\t/* Add additional parts. */\n\t\t\t\tSvCUR_set(data->last_found,\n\t\t\t\t\t SvCUR(data->last_found) - l);\n\t\t\t\tsv_catsv(data->last_found, last_str);\n\t\t\t\t{\n\t\t\t\t SV * sv = data->last_found;\n\t\t\t\t MAGIC *mg =\n\t\t\t\t\tSvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\t\t\t\t if (mg && mg->mg_len >= 0)\n\t\t\t\t\tmg->mg_len += last_chrs * (mincount-1);\n\t\t\t\t}\n last_chrs *= mincount;\n\t\t\t\tdata->last_end += l * (mincount - 1);\n\t\t\t }\n\t\t\t} else {\n\t\t\t /* start offset must point into the last copy */\n\t\t\t data->last_start_min += minnext * (mincount - 1);\n\t\t\t data->last_start_max =\n is_inf\n ? SSize_t_MAX\n\t\t\t : data->last_start_max +\n (maxcount - 1) * (minnext + data->pos_delta);\n\t\t\t}\n\t\t }\n\t\t /* It is counted once already... */\n\t\t data->pos_min += minnext * (mincount - counted);\n#if 0\nPerl_re_printf( aTHX_ \"counted=%\" UVuf \" deltanext=%\" UVuf\n \" SSize_t_MAX=%\" UVuf \" minnext=%\" UVuf\n \" maxcount=%\" UVuf \" mincount=%\" UVuf \"\\n\",\n (UV)counted, (UV)deltanext, (UV)SSize_t_MAX, (UV)minnext, (UV)maxcount,\n (UV)mincount);\nif (deltanext != SSize_t_MAX)\nPerl_re_printf( aTHX_ \"LHS=%\" UVuf \" RHS=%\" UVuf \"\\n\",\n (UV)(-counted * deltanext + (minnext + deltanext) * maxcount\n - minnext * mincount), (UV)(SSize_t_MAX - data->pos_delta));\n#endif\n\t\t if (deltanext == SSize_t_MAX\n || -counted * deltanext + (minnext + deltanext) * maxcount - minnext * mincount >= SSize_t_MAX - data->pos_delta)\n\t\t data->pos_delta = SSize_t_MAX;\n\t\t else\n\t\t data->pos_delta += - counted * deltanext +\n\t\t\t(minnext + deltanext) * maxcount - minnext * mincount;\n\t\t if (mincount != maxcount) {\n\t\t\t /* Cannot extend fixed substrings found inside\n\t\t\t the group. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t\tif (mincount && last_str) {\n\t\t\t SV * const sv = data->last_found;\n\t\t\t MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\n\t\t\t if (mg)\n\t\t\t\tmg->mg_len = -1;\n\t\t\t sv_setsv(sv, last_str);\n\t\t\t data->last_end = data->pos_min;\n\t\t\t data->last_start_min = data->pos_min - last_chrs;\n\t\t\t data->last_start_max = is_inf\n\t\t\t\t? SSize_t_MAX\n\t\t\t\t: data->pos_min + data->pos_delta - last_chrs;\n\t\t\t}\n\t\t\tdata->cur_is_floating = 1; /* float */\n\t\t }\n\t\t SvREFCNT_dec(last_str);\n\t\t}\n\t\tif (data && (fl & SF_HAS_EVAL))\n\t\t data->flags |= SF_HAS_EVAL;\n\t optimize_curly_tail:\n\t\tif (OP(oscan) != CURLYX) {\n\t\t while (PL_regkind[OP(next = regnext(oscan))] == NOTHING\n\t\t\t && NEXT_OFF(next))\n\t\t\tNEXT_OFF(oscan) += NEXT_OFF(next);\n\t\t}\n\t\tcontinue;\n\n\t default:\n#ifdef DEBUGGING\n Perl_croak(aTHX_ \"panic: unexpected varying REx opcode %d\",\n OP(scan));\n#endif\n case REF:\n case CLUMP:\n\t\tif (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t\tis_inf = is_inf_internal = 1;\n\t\tif (flags & SCF_DO_STCLASS_OR) {\n if (OP(scan) == CLUMP) {\n /* Actually is any start char, but very few code points\n * aren't start characters */\n ssc_match_all_cp(data->start_class);\n }\n else {\n ssc_anything(data->start_class);\n }\n }\n\t\tflags &= ~SCF_DO_STCLASS;\n\t\tbreak;\n\t }\n\t}\n\telse if (OP(scan) == LNBREAK) {\n\t if (flags & SCF_DO_STCLASS) {\n \t if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class,\n PL_XPosix_ptrs[_CC_VERTSPACE], FALSE);\n ssc_clear_locale(data->start_class);\n ANYOF_FLAGS(data->start_class)\n &= ~SSC_MATCHES_EMPTY_STRING;\n }\n else if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class,\n PL_XPosix_ptrs[_CC_VERTSPACE],\n FALSE);\n\t\t ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg for\n * 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class)\n &= ~SSC_MATCHES_EMPTY_STRING;\n }\n\t\tflags &= ~SCF_DO_STCLASS;\n }\n\t min++;\n if (delta != SSize_t_MAX)\n delta++; /* Because of the 2 char string cr-lf */\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n \t data->pos_min += 1;\n if (data->pos_delta != SSize_t_MAX) {\n data->pos_delta += 1;\n }\n\t\tdata->cur_is_floating = 1; /* float */\n \t }\n\t}\n\telse if (REGNODE_SIMPLE(OP(scan))) {\n\n\t if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\tdata->pos_min++;\n\t }\n\t min++;\n\t if (flags & SCF_DO_STCLASS) {\n bool invert = 0;\n SV* my_invlist = NULL;\n U8 namedclass;\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n\n\t\t/* Some of the logic below assumes that switching\n\t\t locale on will only add false positives. */\n\t\tswitch (OP(scan)) {\n\n\t\tdefault:\n#ifdef DEBUGGING\n Perl_croak(aTHX_ \"panic: unexpected simple REx opcode %d\",\n OP(scan));\n#endif\n\t\tcase SANY:\n\t\t if (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n\t\t\tssc_match_all_cp(data->start_class);\n\t\t break;\n\n\t\tcase REG_ANY:\n {\n SV* REG_ANY_invlist = _new_invlist(2);\n REG_ANY_invlist = add_cp_to_invlist(REG_ANY_invlist,\n '\\n');\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class,\n REG_ANY_invlist,\n TRUE /* TRUE => invert, hence all but \\n\n */\n );\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class,\n REG_ANY_invlist,\n TRUE /* TRUE => invert */\n );\n ssc_clear_locale(data->start_class);\n }\n SvREFCNT_dec_NN(REG_ANY_invlist);\n\t\t }\n\t\t break;\n\n case ANYOFD:\n case ANYOFL:\n case ANYOFPOSIXL:\n case ANYOFH:\n case ANYOF:\n\t\t if (flags & SCF_DO_STCLASS_AND)\n\t\t\tssc_and(pRExC_state, data->start_class,\n (regnode_charclass *) scan);\n\t\t else\n\t\t\tssc_or(pRExC_state, data->start_class,\n (regnode_charclass *) scan);\n\t\t break;\n\n case NANYOFM:\n case ANYOFM:\n {\n SV* cp_list = get_ANYOFM_contents(scan);\n\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class, cp_list, invert);\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class, cp_list, invert);\n }\n\n SvREFCNT_dec_NN(cp_list);\n break;\n }\n\n\t\tcase NPOSIXL:\n invert = 1;\n /* FALLTHROUGH */\n\n\t\tcase POSIXL:\n namedclass = classnum_to_namedclass(FLAGS(scan)) + invert;\n if (flags & SCF_DO_STCLASS_AND) {\n bool was_there = cBOOL(\n ANYOF_POSIXL_TEST(data->start_class,\n namedclass));\n ANYOF_POSIXL_ZERO(data->start_class);\n if (was_there) { /* Do an AND */\n ANYOF_POSIXL_SET(data->start_class, namedclass);\n }\n /* No individual code points can now match */\n data->start_class->invlist\n = sv_2mortal(_new_invlist(0));\n }\n else {\n int complement = namedclass + ((invert) ? -1 : 1);\n\n assert(flags & SCF_DO_STCLASS_OR);\n\n /* If the complement of this class was already there,\n * the result is that they match all code points,\n * (\\d + \\D == everything). Remove the classes from\n * future consideration. Locale is not relevant in\n * this case */\n if (ANYOF_POSIXL_TEST(data->start_class, complement)) {\n ssc_match_all_cp(data->start_class);\n ANYOF_POSIXL_CLEAR(data->start_class, namedclass);\n ANYOF_POSIXL_CLEAR(data->start_class, complement);\n }\n else { /* The usual case; just add this class to the\n existing set */\n ANYOF_POSIXL_SET(data->start_class, namedclass);\n }\n }\n break;\n\n case NPOSIXA: /* For these, we always know the exact set of\n what's matched */\n invert = 1;\n /* FALLTHROUGH */\n\t\tcase POSIXA:\n my_invlist = invlist_clone(PL_Posix_ptrs[FLAGS(scan)], NULL);\n goto join_posix_and_ascii;\n\n\t\tcase NPOSIXD:\n\t\tcase NPOSIXU:\n invert = 1;\n /* FALLTHROUGH */\n\t\tcase POSIXD:\n\t\tcase POSIXU:\n my_invlist = invlist_clone(PL_XPosix_ptrs[FLAGS(scan)], NULL);\n\n /* NPOSIXD matches all upper Latin1 code points unless the\n * target string being matched is UTF-8, which is\n * unknowable until match time. Since we are going to\n * invert, we want to get rid of all of them so that the\n * inversion will match all */\n if (OP(scan) == NPOSIXD) {\n _invlist_subtract(my_invlist, PL_UpperLatin1,\n &my_invlist);\n }\n\n join_posix_and_ascii:\n\n if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class, my_invlist, invert);\n ssc_clear_locale(data->start_class);\n }\n else {\n assert(flags & SCF_DO_STCLASS_OR);\n ssc_union(data->start_class, my_invlist, invert);\n }\n SvREFCNT_dec(my_invlist);\n\t\t}\n\t\tif (flags & SCF_DO_STCLASS_OR)\n\t\t ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\tflags &= ~SCF_DO_STCLASS;\n\t }\n\t}\n\telse if (PL_regkind[OP(scan)] == EOL && flags & SCF_DO_SUBSTR) {\n\t data->flags |= (OP(scan) == MEOL\n\t\t\t ? SF_BEFORE_MEOL\n\t\t\t : SF_BEFORE_SEOL);\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\n\t}\n\telse if ( PL_regkind[OP(scan)] == BRANCHJ\n\t\t /* Lookbehind, or need to calculate parens/evals/stclass: */\n\t\t && (scan->flags || data || (flags & SCF_DO_STCLASS))\n\t\t && (OP(scan) == IFMATCH || OP(scan) == UNLESSM))\n {\n if ( !PERL_ENABLE_POSITIVE_ASSERTION_STUDY\n || OP(scan) == UNLESSM )\n {\n /* Negative Lookahead/lookbehind\n In this case we can't do fixed string optimisation.\n */\n\n SSize_t deltanext, minnext, fake = 0;\n regnode *nscan;\n regnode_ssc intrnl;\n int f = 0;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n if (data) {\n data_fake.whilem_c = data->whilem_c;\n data_fake.last_closep = data->last_closep;\n\t\t}\n else\n data_fake.last_closep = &fake;\n\t\tdata_fake.pos_delta = delta;\n if ( flags & SCF_DO_STCLASS && !scan->flags\n && OP(scan) == IFMATCH ) { /* Lookahead */\n ssc_init(pRExC_state, &intrnl);\n data_fake.start_class = &intrnl;\n f |= SCF_DO_STCLASS_AND;\n\t\t}\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n next = regnext(scan);\n nscan = NEXTOPER(NEXTOPER(scan));\n\n /* recurse study_chunk() for lookahead body */\n minnext = study_chunk(pRExC_state, &nscan, minlenp, &deltanext,\n last, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n if (scan->flags) {\n if ( deltanext < 0\n || deltanext > (I32) U8_MAX\n || minnext > (I32)U8_MAX\n || minnext + deltanext > (I32)U8_MAX)\n {\n\t\t\tFAIL2(\"Lookbehind longer than %\" UVuf \" not implemented\",\n (UV)U8_MAX);\n }\n\n /* The 'next_off' field has been repurposed to count the\n * additional starting positions to try beyond the initial\n * one. (This leaves it at 0 for non-variable length\n * matches to avoid breakage for those not using this\n * extension) */\n if (deltanext) {\n scan->next_off = deltanext;\n ckWARNexperimental(RExC_parse,\n WARN_EXPERIMENTAL__VLB,\n \"Variable length lookbehind is experimental\");\n }\n scan->flags = (U8)minnext + deltanext;\n }\n if (data) {\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n }\n if (f & SCF_DO_STCLASS_AND) {\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\t/* OR before, AND after: ideally we would recurse with\n\t\t\t * data_fake to get the AND applied by study of the\n\t\t\t * remainder of the pattern, and then derecurse;\n\t\t\t * *** HACK *** for now just treat as \"no information\".\n\t\t\t * See [perl #56690].\n\t\t\t */\n\t\t\tssc_init(pRExC_state, data->start_class);\n\t\t } else {\n /* AND before and after: combine and continue. These\n * assertions are zero-length, so can match an EMPTY\n * string */\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &intrnl);\n ANYOF_FLAGS(data->start_class)\n |= SSC_MATCHES_EMPTY_STRING;\n\t\t }\n }\n\t }\n#if PERL_ENABLE_POSITIVE_ASSERTION_STUDY\n else {\n /* Positive Lookahead/lookbehind\n In this case we can do fixed string optimisation,\n but we must be careful about it. Note in the case of\n lookbehind the positions will be offset by the minimum\n length of the pattern, something we won't know about\n until after the recurse.\n */\n SSize_t deltanext, fake = 0;\n regnode *nscan;\n regnode_ssc intrnl;\n int f = 0;\n /* We use SAVEFREEPV so that when the full compile\n is finished perl will clean up the allocated\n minlens when it's all done. This way we don't\n have to worry about freeing them when we know\n they wont be used, which would be a pain.\n */\n SSize_t *minnextp;\n Newx( minnextp, 1, SSize_t );\n SAVEFREEPV(minnextp);\n\n if (data) {\n StructCopy(data, &data_fake, scan_data_t);\n if ((flags & SCF_DO_SUBSTR) && data->last_found) {\n f |= SCF_DO_SUBSTR;\n if (scan->flags)\n scan_commit(pRExC_state, &data_fake, minlenp, is_inf);\n data_fake.last_found=newSVsv(data->last_found);\n }\n }\n else\n data_fake.last_closep = &fake;\n data_fake.flags = 0;\n data_fake.substrs[0].flags = 0;\n data_fake.substrs[1].flags = 0;\n\t\tdata_fake.pos_delta = delta;\n if (is_inf)\n\t data_fake.flags |= SF_IS_INF;\n if ( flags & SCF_DO_STCLASS && !scan->flags\n && OP(scan) == IFMATCH ) { /* Lookahead */\n ssc_init(pRExC_state, &intrnl);\n data_fake.start_class = &intrnl;\n f |= SCF_DO_STCLASS_AND;\n }\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n next = regnext(scan);\n nscan = NEXTOPER(NEXTOPER(scan));\n\n /* positive lookahead study_chunk() recursion */\n *minnextp = study_chunk(pRExC_state, &nscan, minnextp,\n &deltanext, last, &data_fake,\n stopparen, recursed_depth, NULL,\n f, depth+1);\n if (scan->flags) {\n assert(0); /* This code has never been tested since this\n is normally not compiled */\n if ( deltanext < 0\n || deltanext > (I32) U8_MAX\n || *minnextp > (I32)U8_MAX\n || *minnextp + deltanext > (I32)U8_MAX)\n {\n\t\t\tFAIL2(\"Lookbehind longer than %\" UVuf \" not implemented\",\n (UV)U8_MAX);\n }\n\n if (deltanext) {\n scan->next_off = deltanext;\n }\n scan->flags = (U8)*minnextp + deltanext;\n }\n\n *minnextp += min;\n\n if (f & SCF_DO_STCLASS_AND) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &intrnl);\n ANYOF_FLAGS(data->start_class) |= SSC_MATCHES_EMPTY_STRING;\n }\n if (data) {\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n if ((flags & SCF_DO_SUBSTR) && data_fake.last_found) {\n int i;\n if (RExC_rx->minlen<*minnextp)\n RExC_rx->minlen=*minnextp;\n scan_commit(pRExC_state, &data_fake, minnextp, is_inf);\n SvREFCNT_dec_NN(data_fake.last_found);\n\n for (i = 0; i < 2; i++) {\n if (data_fake.substrs[i].minlenp != minlenp) {\n data->substrs[i].min_offset =\n data_fake.substrs[i].min_offset;\n data->substrs[i].max_offset =\n data_fake.substrs[i].max_offset;\n data->substrs[i].minlenp =\n data_fake.substrs[i].minlenp;\n data->substrs[i].lookbehind += scan->flags;\n }\n }\n }\n }\n\t }\n#endif\n\t}\n\n\telse if (OP(scan) == OPEN) {\n\t if (stopparen != (I32)ARG(scan))\n\t pars++;\n\t}\n\telse if (OP(scan) == CLOSE) {\n\t if (stopparen == (I32)ARG(scan)) {\n\t break;\n\t }\n\t if ((I32)ARG(scan) == is_par) {\n\t\tnext = regnext(scan);\n\n\t\tif ( next && (OP(next) != WHILEM) && next < last)\n\t\t is_par = 0;\t\t/* Disable optimization */\n\t }\n\t if (data)\n\t\t*(data->last_closep) = ARG(scan);\n\t}\n\telse if (OP(scan) == EVAL) {\n\t\tif (data)\n\t\t data->flags |= SF_HAS_EVAL;\n\t}\n\telse if ( PL_regkind[OP(scan)] == ENDLIKE ) {\n\t if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\tflags &= ~SCF_DO_SUBSTR;\n\t }\n\t if (data && OP(scan)==ACCEPT) {\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t if (stopmin > min)\n\t stopmin = min;\n\t }\n\t}\n\telse if (OP(scan) == LOGICAL && scan->flags == 2) /* Embedded follows */\n\t{\n\t\tif (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t\tis_inf = is_inf_internal = 1;\n\t\tif (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n\t\t ssc_anything(data->start_class);\n\t\tflags &= ~SCF_DO_STCLASS;\n\t}\n\telse if (OP(scan) == GPOS) {\n if (!(RExC_rx->intflags & PREGf_GPOS_FLOAT) &&\n\t !(delta || is_inf || (data && data->pos_delta)))\n\t {\n if (!(RExC_rx->intflags & PREGf_ANCH) && (flags & SCF_DO_SUBSTR))\n RExC_rx->intflags |= PREGf_ANCH_GPOS;\n\t if (RExC_rx->gofs < (STRLEN)min)\n\t\t RExC_rx->gofs = min;\n } else {\n RExC_rx->intflags |= PREGf_GPOS_FLOAT;\n RExC_rx->gofs = 0;\n }\n\t}\n#ifdef TRIE_STUDY_OPT\n#ifdef FULL_TRIE_STUDY\n else if (PL_regkind[OP(scan)] == TRIE) {\n /* NOTE - There is similar code to this block above for handling\n BRANCH nodes on the initial study. If you change stuff here\n check there too. */\n regnode *trie_node= scan;\n regnode *tail= regnext(scan);\n reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ];\n SSize_t max1 = 0, min1 = SSize_t_MAX;\n regnode_ssc accum;\n\n if (flags & SCF_DO_SUBSTR) { /* XXXX Add !SUSPEND? */\n /* Cannot merge strings after this. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n }\n if (flags & SCF_DO_STCLASS)\n ssc_init_zero(pRExC_state, &accum);\n\n if (!trie->jump) {\n min1= trie->minlen;\n max1= trie->maxlen;\n } else {\n const regnode *nextbranch= NULL;\n U32 word;\n\n for ( word=1 ; word <= trie->wordcount ; word++)\n {\n SSize_t deltanext=0, minnext=0, f = 0, fake;\n regnode_ssc this_class;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n if (data) {\n data_fake.whilem_c = data->whilem_c;\n data_fake.last_closep = data->last_closep;\n }\n else\n data_fake.last_closep = &fake;\n\t\t data_fake.pos_delta = delta;\n if (flags & SCF_DO_STCLASS) {\n ssc_init(pRExC_state, &this_class);\n data_fake.start_class = &this_class;\n f = SCF_DO_STCLASS_AND;\n }\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n\n if (trie->jump[word]) {\n if (!nextbranch)\n nextbranch = trie_node + trie->jump[0];\n scan= trie_node + trie->jump[word];\n /* We go from the jump point to the branch that follows\n it. Note this means we need the vestigal unused\n branches even though they arent otherwise used. */\n /* optimise study_chunk() for TRIE */\n minnext = study_chunk(pRExC_state, &scan, minlenp,\n &deltanext, (regnode *)nextbranch, &data_fake,\n stopparen, recursed_depth, NULL, f, depth+1);\n }\n if (nextbranch && PL_regkind[OP(nextbranch)]==BRANCH)\n nextbranch= regnext((regnode*)nextbranch);\n\n if (min1 > (SSize_t)(minnext + trie->minlen))\n min1 = minnext + trie->minlen;\n if (deltanext == SSize_t_MAX) {\n is_inf = is_inf_internal = 1;\n max1 = SSize_t_MAX;\n } else if (max1 < (SSize_t)(minnext + deltanext + trie->maxlen))\n max1 = minnext + deltanext + trie->maxlen;\n\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SCF_SEEN_ACCEPT) {\n if ( stopmin > min + min1)\n\t stopmin = min + min1;\n\t flags &= ~SCF_DO_SUBSTR;\n\t if (data)\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t }\n if (data) {\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n }\n if (flags & SCF_DO_STCLASS)\n ssc_or(pRExC_state, &accum, (regnode_charclass *) &this_class);\n }\n }\n if (flags & SCF_DO_SUBSTR) {\n data->pos_min += min1;\n data->pos_delta += max1 - min1;\n if (max1 != min1 || is_inf)\n data->cur_is_floating = 1; /* float */\n }\n min += min1;\n if (delta != SSize_t_MAX) {\n if (SSize_t_MAX - (max1 - min1) >= delta)\n delta += max1 - min1;\n else\n delta = SSize_t_MAX;\n }\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_or(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n if (min1) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n flags &= ~SCF_DO_STCLASS;\n }\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n if (min1) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n flags &= ~SCF_DO_STCLASS;\n }\n else {\n /* Switch to OR mode: cache the old value of\n * data->start_class */\n\t\t INIT_AND_WITHP;\n StructCopy(data->start_class, and_withp, regnode_ssc);\n flags &= ~SCF_DO_STCLASS_AND;\n StructCopy(&accum, data->start_class, regnode_ssc);\n flags |= SCF_DO_STCLASS_OR;\n }\n }\n scan= tail;\n continue;\n }\n#else\n\telse if (PL_regkind[OP(scan)] == TRIE) {\n\t reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ];\n\t U8*bang=NULL;\n\n\t min += trie->minlen;\n\t delta += (trie->maxlen - trie->minlen);\n\t flags &= ~SCF_DO_STCLASS; /* xxx */\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n \t data->pos_min += trie->minlen;\n \t data->pos_delta += (trie->maxlen - trie->minlen);\n\t\tif (trie->maxlen != trie->minlen)\n\t\t data->cur_is_floating = 1; /* float */\n \t }\n \t if (trie->jump) /* no more substrings -- for now /grr*/\n flags &= ~SCF_DO_SUBSTR;\n\t}\n#endif /* old or new */\n#endif /* TRIE_STUDY_OPT */\n\n\t/* Else: zero-length, ignore. */\n\tscan = regnext(scan);\n }\n\n finish:\n if (frame) {\n /* we need to unwind recursion. */\n depth = depth - 1;\n\n DEBUG_STUDYDATA(\"frame-end\", data, depth, is_inf);\n DEBUG_PEEP(\"fend\", scan, depth, flags);\n\n /* restore previous context */\n last = frame->last_regnode;\n scan = frame->next_regnode;\n stopparen = frame->stopparen;\n recursed_depth = frame->prev_recursed_depth;\n\n RExC_frame_last = frame->prev_frame;\n frame = frame->this_prev_frame;\n goto fake_study_recurse;\n }\n\n assert(!frame);\n DEBUG_STUDYDATA(\"pre-fin\", data, depth, is_inf);\n\n *scanp = scan;\n *deltap = is_inf_internal ? SSize_t_MAX : delta;\n\n if (flags & SCF_DO_SUBSTR && is_inf)\n\tdata->pos_delta = SSize_t_MAX - data->pos_min;\n if (is_par > (I32)U8_MAX)\n\tis_par = 0;\n if (is_par && pars==1 && data) {\n\tdata->flags |= SF_IN_PAR;\n\tdata->flags &= ~SF_HAS_PAR;\n }\n else if (pars && data) {\n\tdata->flags |= SF_HAS_PAR;\n\tdata->flags &= ~SF_IN_PAR;\n }\n if (flags & SCF_DO_STCLASS_OR)\n\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n if (flags & SCF_TRIE_RESTUDY)\n data->flags |= \tSCF_TRIE_RESTUDY;\n\n DEBUG_STUDYDATA(\"post-fin\", data, depth, is_inf);\n\n {\n SSize_t final_minlen= min < stopmin ? min : stopmin;\n\n if (!(RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN)) {\n if (final_minlen > SSize_t_MAX - delta)\n RExC_maxlen = SSize_t_MAX;\n else if (RExC_maxlen < final_minlen + delta)\n RExC_maxlen = final_minlen + delta;\n }\n return final_minlen;\n }\n NOT_REACHED; /* NOTREACHED */","target":"STATIC SSize_t\nS_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,\n SSize_t *minlenp, SSize_t *deltap,\n\t\t\tregnode *last,\n\t\t\tscan_data_t *data,\n\t\t\tI32 stopparen,\n U32 recursed_depth,\n\t\t\tregnode_ssc *and_withp,\n\t\t\tU32 flags, U32 depth)\n\t\t\t/* scanp: Start here (read-write). */\n\t\t\t/* deltap: Write maxlen-minlen here. */\n\t\t\t/* last: Stop before this one. */\n\t\t\t/* data: string data about the pattern */\n\t\t\t/* stopparen: treat close N as END */\n\t\t\t/* recursed: which subroutines have we recursed into */\n\t\t\t/* and_withp: Valid if flags & SCF_DO_STCLASS_OR */\n{\n dVAR;\n /* There must be at least this number of characters to match */\n SSize_t min = 0;\n I32 pars = 0, code;\n regnode *scan = *scanp, *next;\n SSize_t delta = 0;\n int is_inf = (flags & SCF_DO_SUBSTR) && (data->flags & SF_IS_INF);\n int is_inf_internal = 0;\t\t/* The studied chunk is infinite */\n I32 is_par = OP(scan) == OPEN ? ARG(scan) : 0;\n scan_data_t data_fake;\n SV *re_trie_maxbuff = NULL;\n regnode *first_non_open = scan;\n SSize_t stopmin = SSize_t_MAX;\n scan_frame *frame = NULL;\n GET_RE_DEBUG_FLAGS_DECL;\n\n PERL_ARGS_ASSERT_STUDY_CHUNK;\n RExC_study_started= 1;\n\n Zero(&data_fake, 1, scan_data_t);\n\n if ( depth == 0 ) {\n while (first_non_open && OP(first_non_open) == OPEN)\n first_non_open=regnext(first_non_open);\n }\n\n\n fake_study_recurse:\n DEBUG_r(\n RExC_study_chunk_recursed_count++;\n );\n DEBUG_OPTIMISE_MORE_r(\n {\n Perl_re_indentf( aTHX_ \"study_chunk stopparen=%ld recursed_count=%lu depth=%lu recursed_depth=%lu scan=%p last=%p\",\n depth, (long)stopparen,\n (unsigned long)RExC_study_chunk_recursed_count,\n (unsigned long)depth, (unsigned long)recursed_depth,\n scan,\n last);\n if (recursed_depth) {\n U32 i;\n U32 j;\n for ( j = 0 ; j < recursed_depth ; j++ ) {\n for ( i = 0 ; i < (U32)RExC_total_parens ; i++ ) {\n if (\n PAREN_TEST(RExC_study_chunk_recursed +\n ( j * RExC_study_chunk_recursed_bytes), i )\n && (\n !j ||\n !PAREN_TEST(RExC_study_chunk_recursed +\n (( j - 1 ) * RExC_study_chunk_recursed_bytes), i)\n )\n ) {\n Perl_re_printf( aTHX_ \" %d\",(int)i);\n break;\n }\n }\n if ( j + 1 < recursed_depth ) {\n Perl_re_printf( aTHX_ \",\");\n }\n }\n }\n Perl_re_printf( aTHX_ \"\\n\");\n }\n );\n while ( scan && OP(scan) != END && scan < last ){\n UV min_subtract = 0; /* How mmany chars to subtract from the minimum\n node length to get a real minimum (because\n the folded version may be shorter) */\n\tbool unfolded_multi_char = FALSE;\n\t/* Peephole optimizer: */\n DEBUG_STUDYDATA(\"Peep\", data, depth, is_inf);\n DEBUG_PEEP(\"Peep\", scan, depth, flags);\n\n\n /* The reason we do this here is that we need to deal with things like\n * /(?:f)(?:o)(?:o)/ which cant be dealt with by the normal EXACT\n * parsing code, as each (?:..) is handled by a different invocation of\n * reg() -- Yves\n */\n JOIN_EXACT(scan,&min_subtract, &unfolded_multi_char, 0);\n\n\t/* Follow the next-chain of the current node and optimize\n\t away all the NOTHINGs from it. */\n\tif (OP(scan) != CURLYX) {\n\t const int max = (reg_off_by_arg[OP(scan)]\n\t\t ? I32_MAX\n\t\t /* I32 may be smaller than U16 on CRAYs! */\n\t\t : (I32_MAX < U16_MAX ? I32_MAX : U16_MAX));\n\t int off = (reg_off_by_arg[OP(scan)] ? ARG(scan) : NEXT_OFF(scan));\n\t int noff;\n\t regnode *n = scan;\n\n\t /* Skip NOTHING and LONGJMP. */\n\t while ((n = regnext(n))\n\t\t && ((PL_regkind[OP(n)] == NOTHING && (noff = NEXT_OFF(n)))\n\t\t || ((OP(n) == LONGJMP) && (noff = ARG(n))))\n\t\t && off + noff < max)\n\t\toff += noff;\n\t if (reg_off_by_arg[OP(scan)])\n\t\tARG(scan) = off;\n\t else\n\t\tNEXT_OFF(scan) = off;\n\t}\n\n\t/* The principal pseudo-switch. Cannot be a switch, since we\n\t look into several different things. */\n if ( OP(scan) == DEFINEP ) {\n SSize_t minlen = 0;\n SSize_t deltanext = 0;\n SSize_t fake_last_close = 0;\n I32 f = SCF_IN_DEFINE;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n scan = regnext(scan);\n assert( OP(scan) == IFTHEN );\n DEBUG_PEEP(\"expect IFTHEN\", scan, depth, flags);\n\n data_fake.last_closep= &fake_last_close;\n minlen = *minlenp;\n next = regnext(scan);\n scan = NEXTOPER(NEXTOPER(scan));\n DEBUG_PEEP(\"scan\", scan, depth, flags);\n DEBUG_PEEP(\"next\", next, depth, flags);\n\n /* we suppose the run is continuous, last=next...\n * NOTE we dont use the return here! */\n /* DEFINEP study_chunk() recursion */\n (void)study_chunk(pRExC_state, &scan, &minlen,\n &deltanext, next, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n\n scan = next;\n } else\n if (\n OP(scan) == BRANCH ||\n OP(scan) == BRANCHJ ||\n OP(scan) == IFTHEN\n ) {\n\t next = regnext(scan);\n\t code = OP(scan);\n\n /* The op(next)==code check below is to see if we\n * have \"BRANCH-BRANCH\", \"BRANCHJ-BRANCHJ\", \"IFTHEN-IFTHEN\"\n * IFTHEN is special as it might not appear in pairs.\n * Not sure whether BRANCH-BRANCHJ is possible, regardless\n * we dont handle it cleanly. */\n\t if (OP(next) == code || code == IFTHEN) {\n /* NOTE - There is similar code to this block below for\n * handling TRIE nodes on a re-study. If you change stuff here\n * check there too. */\n\t\tSSize_t max1 = 0, min1 = SSize_t_MAX, num = 0;\n\t\tregnode_ssc accum;\n\t\tregnode * const startbranch=scan;\n\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot merge strings after this. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n }\n\n if (flags & SCF_DO_STCLASS)\n\t\t ssc_init_zero(pRExC_state, &accum);\n\n\t\twhile (OP(scan) == code) {\n\t\t SSize_t deltanext, minnext, fake;\n\t\t I32 f = 0;\n\t\t regnode_ssc this_class;\n\n DEBUG_PEEP(\"Branch\", scan, depth, flags);\n\n\t\t num++;\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n\t\t if (data) {\n\t\t\tdata_fake.whilem_c = data->whilem_c;\n\t\t\tdata_fake.last_closep = data->last_closep;\n\t\t }\n\t\t else\n\t\t\tdata_fake.last_closep = &fake;\n\n\t\t data_fake.pos_delta = delta;\n\t\t next = regnext(scan);\n\n scan = NEXTOPER(scan); /* everything */\n if (code != BRANCH) /* everything but BRANCH */\n\t\t\tscan = NEXTOPER(scan);\n\n\t\t if (flags & SCF_DO_STCLASS) {\n\t\t\tssc_init(pRExC_state, &this_class);\n\t\t\tdata_fake.start_class = &this_class;\n\t\t\tf = SCF_DO_STCLASS_AND;\n\t\t }\n\t\t if (flags & SCF_WHILEM_VISITED_POS)\n\t\t\tf |= SCF_WHILEM_VISITED_POS;\n\n\t\t /* we suppose the run is continuous, last=next...*/\n /* recurse study_chunk() for each BRANCH in an alternation */\n\t\t minnext = study_chunk(pRExC_state, &scan, minlenp,\n &deltanext, next, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n\n\t\t if (min1 > minnext)\n\t\t\tmin1 = minnext;\n\t\t if (deltanext == SSize_t_MAX) {\n\t\t\tis_inf = is_inf_internal = 1;\n\t\t\tmax1 = SSize_t_MAX;\n\t\t } else if (max1 < minnext + deltanext)\n\t\t\tmax1 = minnext + deltanext;\n\t\t scan = next;\n\t\t if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n\t\t\tpars++;\n\t if (data_fake.flags & SCF_SEEN_ACCEPT) {\n\t if ( stopmin > minnext)\n\t stopmin = min + min1;\n\t flags &= ~SCF_DO_SUBSTR;\n\t if (data)\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t }\n\t\t if (data) {\n\t\t\tif (data_fake.flags & SF_HAS_EVAL)\n\t\t\t data->flags |= SF_HAS_EVAL;\n\t\t\tdata->whilem_c = data_fake.whilem_c;\n\t\t }\n\t\t if (flags & SCF_DO_STCLASS)\n\t\t\tssc_or(pRExC_state, &accum, (regnode_charclass*)&this_class);\n\t\t}\n\t\tif (code == IFTHEN && num < 2) /* Empty ELSE branch */\n\t\t min1 = 0;\n\t\tif (flags & SCF_DO_SUBSTR) {\n\t\t data->pos_min += min1;\n\t\t if (data->pos_delta >= SSize_t_MAX - (max1 - min1))\n\t\t data->pos_delta = SSize_t_MAX;\n\t\t else\n\t\t data->pos_delta += max1 - min1;\n\t\t if (max1 != min1 || is_inf)\n\t\t\tdata->cur_is_floating = 1;\n\t\t}\n\t\tmin += min1;\n\t\tif (delta == SSize_t_MAX\n\t\t || SSize_t_MAX - delta - (max1 - min1) < 0)\n\t\t delta = SSize_t_MAX;\n\t\telse\n\t\t delta += max1 - min1;\n\t\tif (flags & SCF_DO_STCLASS_OR) {\n\t\t ssc_or(pRExC_state, data->start_class, (regnode_charclass*) &accum);\n\t\t if (min1) {\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\t\tflags &= ~SCF_DO_STCLASS;\n\t\t }\n\t\t}\n\t\telse if (flags & SCF_DO_STCLASS_AND) {\n\t\t if (min1) {\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n\t\t\tflags &= ~SCF_DO_STCLASS;\n\t\t }\n\t\t else {\n\t\t\t/* Switch to OR mode: cache the old value of\n\t\t\t * data->start_class */\n\t\t\tINIT_AND_WITHP;\n\t\t\tStructCopy(data->start_class, and_withp, regnode_ssc);\n\t\t\tflags &= ~SCF_DO_STCLASS_AND;\n\t\t\tStructCopy(&accum, data->start_class, regnode_ssc);\n\t\t\tflags |= SCF_DO_STCLASS_OR;\n\t\t }\n\t\t}\n\n if (PERL_ENABLE_TRIE_OPTIMISATION &&\n OP( startbranch ) == BRANCH )\n {\n\t\t/* demq.\n\n Assuming this was/is a branch we are dealing with: 'scan'\n now points at the item that follows the branch sequence,\n whatever it is. We now start at the beginning of the\n sequence and look for subsequences of\n\n\t\t BRANCH->EXACT=>x1\n\t\t BRANCH->EXACT=>x2\n\t\t tail\n\n which would be constructed from a pattern like\n /A|LIST|OF|WORDS/\n\n\t\t If we can find such a subsequence we need to turn the first\n\t\t element into a trie and then add the subsequent branch exact\n\t\t strings to the trie.\n\n\t\t We have two cases\n\n 1. patterns where the whole set of branches can be\n converted.\n\n\t\t 2. patterns where only a subset can be converted.\n\n\t\t In case 1 we can replace the whole set with a single regop\n\t\t for the trie. In case 2 we need to keep the start and end\n\t\t branches so\n\n\t\t 'BRANCH EXACT; BRANCH EXACT; BRANCH X'\n\t\t becomes BRANCH TRIE; BRANCH X;\n\n\t\t There is an additional case, that being where there is a\n\t\t common prefix, which gets split out into an EXACT like node\n\t\t preceding the TRIE node.\n\n\t\t If x(1..n)==tail then we can do a simple trie, if not we make\n\t\t a \"jump\" trie, such that when we match the appropriate word\n\t\t we \"jump\" to the appropriate tail node. Essentially we turn\n\t\t a nested if into a case structure of sorts.\n\n\t\t*/\n\n\t\t int made=0;\n\t\t if (!re_trie_maxbuff) {\n\t\t\tre_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1);\n\t\t\tif (!SvIOK(re_trie_maxbuff))\n\t\t\t sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT);\n\t\t }\n if ( SvIV(re_trie_maxbuff)>=0 ) {\n regnode *cur;\n regnode *first = (regnode *)NULL;\n regnode *last = (regnode *)NULL;\n regnode *tail = scan;\n U8 trietype = 0;\n U32 count=0;\n\n /* var tail is used because there may be a TAIL\n regop in the way. Ie, the exacts will point to the\n thing following the TAIL, but the last branch will\n point at the TAIL. So we advance tail. If we\n have nested (?:) we may have to move through several\n tails.\n */\n\n while ( OP( tail ) == TAIL ) {\n /* this is the TAIL generated by (?:) */\n tail = regnext( tail );\n }\n\n\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, tail, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"%s %\" UVuf \":%s\\n\",\n depth+1,\n \"Looking for TRIE'able sequences. Tail node is \",\n (UV) REGNODE_OFFSET(tail),\n SvPV_nolen_const( RExC_mysv )\n );\n });\n\n /*\n\n Step through the branches\n cur represents each branch,\n noper is the first thing to be matched as part\n of that branch\n noper_next is the regnext() of that node.\n\n We normally handle a case like this\n /FOO[xyz]|BAR[pqr]/ via a \"jump trie\" but we also\n support building with NOJUMPTRIE, which restricts\n the trie logic to structures like /FOO|BAR/.\n\n If noper is a trieable nodetype then the branch is\n a possible optimization target. If we are building\n under NOJUMPTRIE then we require that noper_next is\n the same as scan (our current position in the regex\n program).\n\n Once we have two or more consecutive such branches\n we can create a trie of the EXACT's contents and\n stitch it in place into the program.\n\n If the sequence represents all of the branches in\n the alternation we replace the entire thing with a\n single TRIE node.\n\n Otherwise when it is a subsequence we need to\n stitch it in place and replace only the relevant\n branches. This means the first branch has to remain\n as it is used by the alternation logic, and its\n next pointer, and needs to be repointed at the item\n on the branch chain following the last branch we\n have optimized away.\n\n This could be either a BRANCH, in which case the\n subsequence is internal, or it could be the item\n following the branch sequence in which case the\n subsequence is at the end (which does not\n necessarily mean the first node is the start of the\n alternation).\n\n TRIE_TYPE(X) is a define which maps the optype to a\n trietype.\n\n optype | trietype\n ----------------+-----------\n NOTHING | NOTHING\n EXACT | EXACT\n EXACT_ONLY8 | EXACT\n EXACTFU | EXACTFU\n EXACTFU_ONLY8 | EXACTFU\n EXACTFUP | EXACTFU\n EXACTFAA | EXACTFAA\n EXACTL | EXACTL\n EXACTFLU8 | EXACTFLU8\n\n\n */\n#define TRIE_TYPE(X) ( ( NOTHING == (X) ) \\\n ? NOTHING \\\n : ( EXACT == (X) || EXACT_ONLY8 == (X) ) \\\n ? EXACT \\\n : ( EXACTFU == (X) \\\n || EXACTFU_ONLY8 == (X) \\\n || EXACTFUP == (X) ) \\\n ? EXACTFU \\\n : ( EXACTFAA == (X) ) \\\n ? EXACTFAA \\\n : ( EXACTL == (X) ) \\\n ? EXACTL \\\n : ( EXACTFLU8 == (X) ) \\\n ? EXACTFLU8 \\\n : 0 )\n\n /* dont use tail as the end marker for this traverse */\n for ( cur = startbranch ; cur != scan ; cur = regnext( cur ) ) {\n regnode * const noper = NEXTOPER( cur );\n U8 noper_type = OP( noper );\n U8 noper_trietype = TRIE_TYPE( noper_type );\n#if defined(DEBUGGING) || defined(NOJUMPTRIE)\n regnode * const noper_next = regnext( noper );\n U8 noper_next_type = (noper_next && noper_next < tail) ? OP(noper_next) : 0;\n U8 noper_next_trietype = (noper_next && noper_next < tail) ? TRIE_TYPE( noper_next_type ) :0;\n#endif\n\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %d:%s (%d)\",\n depth+1,\n REG_NODE_NUM(cur), SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur) );\n\n regprop(RExC_rx, RExC_mysv, noper, NULL, pRExC_state);\n Perl_re_printf( aTHX_ \" -> %d:%s\",\n REG_NODE_NUM(noper), SvPV_nolen_const(RExC_mysv));\n\n if ( noper_next ) {\n regprop(RExC_rx, RExC_mysv, noper_next, NULL, pRExC_state);\n Perl_re_printf( aTHX_ \"\\t=> %d:%s\\t\",\n REG_NODE_NUM(noper_next), SvPV_nolen_const(RExC_mysv));\n }\n Perl_re_printf( aTHX_ \"(First==%d,Last==%d,Cur==%d,tt==%s,ntt==%s,nntt==%s)\\n\",\n REG_NODE_NUM(first), REG_NODE_NUM(last), REG_NODE_NUM(cur),\n\t\t\t\t PL_reg_name[trietype], PL_reg_name[noper_trietype], PL_reg_name[noper_next_trietype]\n\t\t\t\t);\n });\n\n /* Is noper a trieable nodetype that can be merged\n * with the current trie (if there is one)? */\n if ( noper_trietype\n &&\n (\n ( noper_trietype == NOTHING )\n || ( trietype == NOTHING )\n || ( trietype == noper_trietype )\n )\n#ifdef NOJUMPTRIE\n && noper_next >= tail\n#endif\n && count < U16_MAX)\n {\n /* Handle mergable triable node Either we are\n * the first node in a new trieable sequence,\n * in which case we do some bookkeeping,\n * otherwise we update the end pointer. */\n if ( !first ) {\n first = cur;\n\t\t\t\t if ( noper_trietype == NOTHING ) {\n#if !defined(DEBUGGING) && !defined(NOJUMPTRIE)\n\t\t\t\t\tregnode * const noper_next = regnext( noper );\n U8 noper_next_type = (noper_next && noper_next < tail) ? OP(noper_next) : 0;\n\t\t\t\t\tU8 noper_next_trietype = noper_next_type ? TRIE_TYPE( noper_next_type ) :0;\n#endif\n\n if ( noper_next_trietype ) {\n\t\t\t\t\t trietype = noper_next_trietype;\n } else if (noper_next_type) {\n /* a NOTHING regop is 1 regop wide.\n * We need at least two for a trie\n * so we can't merge this in */\n first = NULL;\n }\n } else {\n trietype = noper_trietype;\n }\n } else {\n if ( trietype == NOTHING )\n trietype = noper_trietype;\n last = cur;\n }\n\t\t\t\tif (first)\n\t\t\t\t count++;\n } /* end handle mergable triable node */\n else {\n /* handle unmergable node -\n * noper may either be a triable node which can\n * not be tried together with the current trie,\n * or a non triable node */\n if ( last ) {\n /* If last is set and trietype is not\n * NOTHING then we have found at least two\n * triable branch sequences in a row of a\n * similar trietype so we can turn them\n * into a trie. If/when we allow NOTHING to\n * start a trie sequence this condition\n * will be required, and it isn't expensive\n * so we leave it in for now. */\n if ( trietype && trietype != NOTHING )\n make_trie( pRExC_state,\n startbranch, first, cur, tail,\n count, trietype, depth+1 );\n last = NULL; /* note: we clear/update\n first, trietype etc below,\n so we dont do it here */\n }\n if ( noper_trietype\n#ifdef NOJUMPTRIE\n && noper_next >= tail\n#endif\n ){\n /* noper is triable, so we can start a new\n * trie sequence */\n count = 1;\n first = cur;\n trietype = noper_trietype;\n } else if (first) {\n /* if we already saw a first but the\n * current node is not triable then we have\n * to reset the first information. */\n count = 0;\n first = NULL;\n trietype = 0;\n }\n } /* end handle unmergable node */\n } /* loop over branches */\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %s (%d) \",\n depth+1, SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur));\n Perl_re_printf( aTHX_ \"(First==%d, Last==%d, Cur==%d, tt==%s)\\n\",\n REG_NODE_NUM(first), REG_NODE_NUM(last), REG_NODE_NUM(cur),\n PL_reg_name[trietype]\n );\n\n });\n if ( last && trietype ) {\n if ( trietype != NOTHING ) {\n /* the last branch of the sequence was part of\n * a trie, so we have to construct it here\n * outside of the loop */\n made= make_trie( pRExC_state, startbranch,\n first, scan, tail, count,\n trietype, depth+1 );\n#ifdef TRIE_STUDY_OPT\n if ( ((made == MADE_EXACT_TRIE &&\n startbranch == first)\n || ( first_non_open == first )) &&\n depth==0 ) {\n flags |= SCF_TRIE_RESTUDY;\n if ( startbranch == first\n && scan >= tail )\n {\n RExC_seen &=~REG_TOP_LEVEL_BRANCHES_SEEN;\n }\n }\n#endif\n } else {\n /* at this point we know whatever we have is a\n * NOTHING sequence/branch AND if 'startbranch'\n * is 'first' then we can turn the whole thing\n * into a NOTHING\n */\n if ( startbranch == first ) {\n regnode *opt;\n /* the entire thing is a NOTHING sequence,\n * something like this: (?:|) So we can\n * turn it into a plain NOTHING op. */\n DEBUG_TRIE_COMPILE_r({\n regprop(RExC_rx, RExC_mysv, cur, NULL, pRExC_state);\n Perl_re_indentf( aTHX_ \"- %s (%d) \\n\",\n depth+1,\n SvPV_nolen_const( RExC_mysv ), REG_NODE_NUM(cur));\n\n });\n OP(startbranch)= NOTHING;\n NEXT_OFF(startbranch)= tail - startbranch;\n for ( opt= startbranch + 1; opt < tail ; opt++ )\n OP(opt)= OPTIMIZED;\n }\n }\n } /* end if ( last) */\n } /* TRIE_MAXBUF is non zero */\n\n } /* do trie */\n\n\t }\n\t else if ( code == BRANCHJ ) { /* single branch is optimized. */\n\t\tscan = NEXTOPER(NEXTOPER(scan));\n\t } else\t\t\t/* single branch is optimized. */\n\t\tscan = NEXTOPER(scan);\n\t continue;\n } else if (OP(scan) == SUSPEND || OP(scan) == GOSUB) {\n I32 paren = 0;\n regnode *start = NULL;\n regnode *end = NULL;\n U32 my_recursed_depth= recursed_depth;\n\n if (OP(scan) != SUSPEND) { /* GOSUB */\n /* Do setup, note this code has side effects beyond\n * the rest of this block. Specifically setting\n * RExC_recurse[] must happen at least once during\n * study_chunk(). */\n paren = ARG(scan);\n RExC_recurse[ARG2L(scan)] = scan;\n start = REGNODE_p(RExC_open_parens[paren]);\n end = REGNODE_p(RExC_close_parens[paren]);\n\n /* NOTE we MUST always execute the above code, even\n * if we do nothing with a GOSUB */\n if (\n ( flags & SCF_IN_DEFINE )\n ||\n (\n (is_inf_internal || is_inf || (data && data->flags & SF_IS_INF))\n &&\n ( (flags & (SCF_DO_STCLASS | SCF_DO_SUBSTR)) == 0 )\n )\n ) {\n /* no need to do anything here if we are in a define. */\n /* or we are after some kind of infinite construct\n * so we can skip recursing into this item.\n * Since it is infinite we will not change the maxlen\n * or delta, and if we miss something that might raise\n * the minlen it will merely pessimise a little.\n *\n * Iow /(?(DEFINE)(?foo|food))a+(?&foo)/\n * might result in a minlen of 1 and not of 4,\n * but this doesn't make us mismatch, just try a bit\n * harder than we should.\n * */\n scan= regnext(scan);\n continue;\n }\n\n if (\n !recursed_depth\n ||\n !PAREN_TEST(RExC_study_chunk_recursed + ((recursed_depth-1) * RExC_study_chunk_recursed_bytes), paren)\n ) {\n /* it is quite possible that there are more efficient ways\n * to do this. We maintain a bitmap per level of recursion\n * of which patterns we have entered so we can detect if a\n * pattern creates a possible infinite loop. When we\n * recurse down a level we copy the previous levels bitmap\n * down. When we are at recursion level 0 we zero the top\n * level bitmap. It would be nice to implement a different\n * more efficient way of doing this. In particular the top\n * level bitmap may be unnecessary.\n */\n if (!recursed_depth) {\n Zero(RExC_study_chunk_recursed, RExC_study_chunk_recursed_bytes, U8);\n } else {\n Copy(RExC_study_chunk_recursed + ((recursed_depth-1) * RExC_study_chunk_recursed_bytes),\n RExC_study_chunk_recursed + (recursed_depth * RExC_study_chunk_recursed_bytes),\n RExC_study_chunk_recursed_bytes, U8);\n }\n /* we havent recursed into this paren yet, so recurse into it */\n DEBUG_STUDYDATA(\"gosub-set\", data, depth, is_inf);\n PAREN_SET(RExC_study_chunk_recursed + (recursed_depth * RExC_study_chunk_recursed_bytes), paren);\n my_recursed_depth= recursed_depth + 1;\n } else {\n DEBUG_STUDYDATA(\"gosub-inf\", data, depth, is_inf);\n /* some form of infinite recursion, assume infinite length\n * */\n if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n data->cur_is_floating = 1;\n }\n is_inf = is_inf_internal = 1;\n if (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n ssc_anything(data->start_class);\n flags &= ~SCF_DO_STCLASS;\n\n start= NULL; /* reset start so we dont recurse later on. */\n\t }\n } else {\n\t paren = stopparen;\n start = scan + 2;\n\t end = regnext(scan);\n\t }\n if (start) {\n scan_frame *newframe;\n assert(end);\n if (!RExC_frame_last) {\n Newxz(newframe, 1, scan_frame);\n SAVEDESTRUCTOR_X(S_unwind_scan_frames, newframe);\n RExC_frame_head= newframe;\n RExC_frame_count++;\n } else if (!RExC_frame_last->next_frame) {\n Newxz(newframe, 1, scan_frame);\n RExC_frame_last->next_frame= newframe;\n newframe->prev_frame= RExC_frame_last;\n RExC_frame_count++;\n } else {\n newframe= RExC_frame_last->next_frame;\n }\n RExC_frame_last= newframe;\n\n newframe->next_regnode = regnext(scan);\n newframe->last_regnode = last;\n newframe->stopparen = stopparen;\n newframe->prev_recursed_depth = recursed_depth;\n newframe->this_prev_frame= frame;\n\n DEBUG_STUDYDATA(\"frame-new\", data, depth, is_inf);\n DEBUG_PEEP(\"fnew\", scan, depth, flags);\n\n\t frame = newframe;\n\t scan = start;\n\t stopparen = paren;\n\t last = end;\n depth = depth + 1;\n recursed_depth= my_recursed_depth;\n\n\t continue;\n\t }\n\t}\n\telse if ( OP(scan) == EXACT\n || OP(scan) == EXACT_ONLY8\n || OP(scan) == EXACTL)\n {\n\t SSize_t l = STR_LEN(scan);\n\t UV uc;\n assert(l);\n\t if (UTF) {\n\t\tconst U8 * const s = (U8*)STRING(scan);\n\t\tuc = utf8_to_uvchr_buf(s, s + l, NULL);\n\t\tl = utf8_length(s, s + l);\n\t } else {\n\t\tuc = *((U8*)STRING(scan));\n\t }\n\t min += l;\n\t if (flags & SCF_DO_SUBSTR) { /* Update longest substr. */\n\t\t/* The code below prefers earlier match for fixed\n\t\t offset, later match for variable offset. */\n\t\tif (data->last_end == -1) { /* Update the start info. */\n\t\t data->last_start_min = data->pos_min;\n \t\t data->last_start_max = is_inf\n \t\t\t? SSize_t_MAX : data->pos_min + data->pos_delta;\n\t\t}\n\t\tsv_catpvn(data->last_found, STRING(scan), STR_LEN(scan));\n\t\tif (UTF)\n\t\t SvUTF8_on(data->last_found);\n\t\t{\n\t\t SV * const sv = data->last_found;\n\t\t MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\t\t if (mg && mg->mg_len >= 0)\n\t\t\tmg->mg_len += utf8_length((U8*)STRING(scan),\n (U8*)STRING(scan)+STR_LEN(scan));\n\t\t}\n\t\tdata->last_end = data->pos_min + l;\n\t\tdata->pos_min += l; /* As in the first entry. */\n\t\tdata->flags &= ~SF_BEFORE_EOL;\n\t }\n\n /* ANDing the code point leaves at most it, and not in locale, and\n * can't match null string */\n\t if (flags & SCF_DO_STCLASS_AND) {\n ssc_cp_and(data->start_class, uc);\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n ssc_clear_locale(data->start_class);\n\t }\n\t else if (flags & SCF_DO_STCLASS_OR) {\n ssc_add_cp(data->start_class, uc);\n\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n\t }\n\t flags &= ~SCF_DO_STCLASS;\n\t}\n else if (PL_regkind[OP(scan)] == EXACT) {\n /* But OP != EXACT!, so is EXACTFish */\n\t SSize_t l = STR_LEN(scan);\n const U8 * s = (U8*)STRING(scan);\n\n\t /* Search for fixed substrings supports EXACT only. */\n\t if (flags & SCF_DO_SUBSTR) {\n\t\tassert(data);\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t }\n\t if (UTF) {\n\t\tl = utf8_length(s, s + l);\n\t }\n\t if (unfolded_multi_char) {\n RExC_seen |= REG_UNFOLDED_MULTI_SEEN;\n\t }\n\t min += l - min_subtract;\n assert (min >= 0);\n delta += min_subtract;\n\t if (flags & SCF_DO_SUBSTR) {\n\t\tdata->pos_min += l - min_subtract;\n\t\tif (data->pos_min < 0) {\n data->pos_min = 0;\n }\n data->pos_delta += min_subtract;\n\t\tif (min_subtract) {\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t }\n\n if (flags & SCF_DO_STCLASS) {\n SV* EXACTF_invlist = _make_exactf_invlist(pRExC_state, scan);\n\n assert(EXACTF_invlist);\n if (flags & SCF_DO_STCLASS_AND) {\n if (OP(scan) != EXACTFL)\n ssc_clear_locale(data->start_class);\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n ANYOF_POSIXL_ZERO(data->start_class);\n ssc_intersection(data->start_class, EXACTF_invlist, FALSE);\n }\n else { /* SCF_DO_STCLASS_OR */\n ssc_union(data->start_class, EXACTF_invlist, FALSE);\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n }\n flags &= ~SCF_DO_STCLASS;\n SvREFCNT_dec(EXACTF_invlist);\n }\n\t}\n\telse if (REGNODE_VARIES(OP(scan))) {\n\t SSize_t mincount, maxcount, minnext, deltanext, pos_before = 0;\n\t I32 fl = 0, f = flags;\n\t regnode * const oscan = scan;\n\t regnode_ssc this_class;\n\t regnode_ssc *oclass = NULL;\n\t I32 next_is_eval = 0;\n\n\t switch (PL_regkind[OP(scan)]) {\n\t case WHILEM:\t\t/* End of (?:...)* . */\n\t\tscan = NEXTOPER(scan);\n\t\tgoto finish;\n\t case PLUS:\n\t\tif (flags & (SCF_DO_SUBSTR | SCF_DO_STCLASS)) {\n\t\t next = NEXTOPER(scan);\n\t\t if ( OP(next) == EXACT\n || OP(next) == EXACT_ONLY8\n || OP(next) == EXACTL\n || (flags & SCF_DO_STCLASS))\n {\n\t\t\tmincount = 1;\n\t\t\tmaxcount = REG_INFTY;\n\t\t\tnext = regnext(scan);\n\t\t\tscan = NEXTOPER(scan);\n\t\t\tgoto do_curly;\n\t\t }\n\t\t}\n\t\tif (flags & SCF_DO_SUBSTR)\n\t\t data->pos_min++;\n\t\tmin++;\n\t\t/* FALLTHROUGH */\n\t case STAR:\n next = NEXTOPER(scan);\n\n /* This temporary node can now be turned into EXACTFU, and\n * must, as regexec.c doesn't handle it */\n if (OP(next) == EXACTFU_S_EDGE) {\n OP(next) = EXACTFU;\n }\n\n if ( STR_LEN(next) == 1\n && isALPHA_A(* STRING(next))\n && ( OP(next) == EXACTFAA\n || ( OP(next) == EXACTFU\n && ! HAS_NONLATIN1_SIMPLE_FOLD_CLOSURE(* STRING(next)))))\n {\n /* These differ in just one bit */\n U8 mask = ~ ('A' ^ 'a');\n\n assert(isALPHA_A(* STRING(next)));\n\n /* Then replace it by an ANYOFM node, with\n * the mask set to the complement of the\n * bit that differs between upper and lower\n * case, and the lowest code point of the\n * pair (which the '&' forces) */\n OP(next) = ANYOFM;\n ARG_SET(next, *STRING(next) & mask);\n FLAGS(next) = mask;\n }\n\n\t\tif (flags & SCF_DO_STCLASS) {\n\t\t mincount = 0;\n\t\t maxcount = REG_INFTY;\n\t\t next = regnext(scan);\n\t\t scan = NEXTOPER(scan);\n\t\t goto do_curly;\n\t\t}\n\t\tif (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n /* Cannot extend fixed substrings */\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n is_inf = is_inf_internal = 1;\n scan = regnext(scan);\n\t\tgoto optimize_curly_tail;\n\t case CURLY:\n\t if (stopparen>0 && (OP(scan)==CURLYN || OP(scan)==CURLYM)\n\t && (scan->flags == stopparen))\n\t\t{\n\t\t mincount = 1;\n\t\t maxcount = 1;\n\t\t} else {\n\t\t mincount = ARG1(scan);\n\t\t maxcount = ARG2(scan);\n\t\t}\n\t\tnext = regnext(scan);\n\t\tif (OP(scan) == CURLYX) {\n\t\t I32 lp = (data ? *(data->last_closep) : 0);\n\t\t scan->flags = ((lp <= (I32)U8_MAX) ? (U8)lp : U8_MAX);\n\t\t}\n\t\tscan = NEXTOPER(scan) + EXTRA_STEP_2ARGS;\n\t\tnext_is_eval = (OP(scan) == EVAL);\n\t do_curly:\n\t\tif (flags & SCF_DO_SUBSTR) {\n if (mincount == 0)\n scan_commit(pRExC_state, data, minlenp, is_inf);\n /* Cannot extend fixed substrings */\n\t\t pos_before = data->pos_min;\n\t\t}\n\t\tif (data) {\n\t\t fl = data->flags;\n\t\t data->flags &= ~(SF_HAS_PAR|SF_IN_PAR|SF_HAS_EVAL);\n\t\t if (is_inf)\n\t\t\tdata->flags |= SF_IS_INF;\n\t\t}\n\t\tif (flags & SCF_DO_STCLASS) {\n\t\t ssc_init(pRExC_state, &this_class);\n\t\t oclass = data->start_class;\n\t\t data->start_class = &this_class;\n\t\t f |= SCF_DO_STCLASS_AND;\n\t\t f &= ~SCF_DO_STCLASS_OR;\n\t\t}\n\t /* Exclude from super-linear cache processing any {n,m}\n\t\t regops for which the combination of input pos and regex\n\t\t pos is not enough information to determine if a match\n\t\t will be possible.\n\n\t\t For example, in the regex /foo(bar\\s*){4,8}baz/ with the\n\t\t regex pos at the \\s*, the prospects for a match depend not\n\t\t only on the input position but also on how many (bar\\s*)\n\t\t repeats into the {4,8} we are. */\n if ((mincount > 1) || (maxcount > 1 && maxcount != REG_INFTY))\n\t\t f &= ~SCF_WHILEM_VISITED_POS;\n\n\t\t/* This will finish on WHILEM, setting scan, or on NULL: */\n /* recurse study_chunk() on loop bodies */\n\t\tminnext = study_chunk(pRExC_state, &scan, minlenp, &deltanext,\n last, data, stopparen, recursed_depth, NULL,\n (mincount == 0\n ? (f & ~SCF_DO_SUBSTR)\n : f)\n ,depth+1);\n\n\t\tif (flags & SCF_DO_STCLASS)\n\t\t data->start_class = oclass;\n\t\tif (mincount == 0 || minnext == 0) {\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\tssc_or(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t }\n\t\t else if (flags & SCF_DO_STCLASS_AND) {\n\t\t\t/* Switch to OR mode: cache the old value of\n\t\t\t * data->start_class */\n\t\t\tINIT_AND_WITHP;\n\t\t\tStructCopy(data->start_class, and_withp, regnode_ssc);\n\t\t\tflags &= ~SCF_DO_STCLASS_AND;\n\t\t\tStructCopy(&this_class, data->start_class, regnode_ssc);\n\t\t\tflags |= SCF_DO_STCLASS_OR;\n ANYOF_FLAGS(data->start_class)\n |= SSC_MATCHES_EMPTY_STRING;\n\t\t }\n\t\t} else {\t\t/* Non-zero len */\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\tssc_or(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\t }\n\t\t else if (flags & SCF_DO_STCLASS_AND)\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &this_class);\n\t\t flags &= ~SCF_DO_STCLASS;\n\t\t}\n\t\tif (!scan) \t\t/* It was not CURLYX, but CURLY. */\n\t\t scan = next;\n\t\tif (((flags & (SCF_TRIE_DOING_RESTUDY|SCF_DO_SUBSTR))==SCF_DO_SUBSTR)\n\t\t /* ? quantifier ok, except for (?{ ... }) */\n\t\t && (next_is_eval || !(mincount == 0 && maxcount == 1))\n\t\t && (minnext == 0) && (deltanext == 0)\n\t\t && data && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))\n && maxcount <= REG_INFTY/3) /* Complement check for big\n count */\n\t\t{\n\t\t _WARN_HELPER(RExC_precomp_end, packWARN(WARN_REGEXP),\n Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP),\n \"Quantifier unexpected on zero-length expression \"\n \"in regex m/%\" UTF8f \"/\",\n\t\t\t UTF8fARG(UTF, RExC_precomp_end - RExC_precomp,\n\t\t\t\t RExC_precomp)));\n }\n\n if ( ( minnext > 0 && mincount >= SSize_t_MAX / minnext )\n || min >= SSize_t_MAX - minnext * mincount )\n {\n FAIL(\"Regexp out of space\");\n }\n\n\t\tmin += minnext * mincount;\n\t\tis_inf_internal |= deltanext == SSize_t_MAX\n || (maxcount == REG_INFTY && minnext + deltanext > 0);\n\t\tis_inf |= is_inf_internal;\n if (is_inf) {\n\t\t delta = SSize_t_MAX;\n } else {\n\t\t delta += (minnext + deltanext) * maxcount\n - minnext * mincount;\n }\n\t\t/* Try powerful optimization CURLYX => CURLYN. */\n\t\tif ( OP(oscan) == CURLYX && data\n\t\t && data->flags & SF_IN_PAR\n\t\t && !(data->flags & SF_HAS_EVAL)\n\t\t && !deltanext && minnext == 1 ) {\n\t\t /* Try to optimize to CURLYN. */\n\t\t regnode *nxt = NEXTOPER(oscan) + EXTRA_STEP_2ARGS;\n\t\t regnode * const nxt1 = nxt;\n#ifdef DEBUGGING\n\t\t regnode *nxt2;\n#endif\n\n\t\t /* Skip open. */\n\t\t nxt = regnext(nxt);\n\t\t if (!REGNODE_SIMPLE(OP(nxt))\n\t\t\t&& !(PL_regkind[OP(nxt)] == EXACT\n\t\t\t && STR_LEN(nxt) == 1))\n\t\t\tgoto nogo;\n#ifdef DEBUGGING\n\t\t nxt2 = nxt;\n#endif\n\t\t nxt = regnext(nxt);\n\t\t if (OP(nxt) != CLOSE)\n\t\t\tgoto nogo;\n\t\t if (RExC_open_parens) {\n\n /*open->CURLYM*/\n RExC_open_parens[ARG(nxt1)] = REGNODE_OFFSET(oscan);\n\n /*close->while*/\n RExC_close_parens[ARG(nxt1)] = REGNODE_OFFSET(nxt) + 2;\n\t\t }\n\t\t /* Now we know that nxt2 is the only contents: */\n\t\t oscan->flags = (U8)ARG(nxt);\n\t\t OP(oscan) = CURLYN;\n\t\t OP(nxt1) = NOTHING;\t/* was OPEN. */\n\n#ifdef DEBUGGING\n\t\t OP(nxt1 + 1) = OPTIMIZED; /* was count. */\n\t\t NEXT_OFF(nxt1+ 1) = 0; /* just for consistency. */\n\t\t NEXT_OFF(nxt2) = 0;\t/* just for consistency with CURLY. */\n\t\t OP(nxt) = OPTIMIZED;\t/* was CLOSE. */\n\t\t OP(nxt + 1) = OPTIMIZED; /* was count. */\n\t\t NEXT_OFF(nxt+ 1) = 0; /* just for consistency. */\n#endif\n\t\t}\n\t nogo:\n\n\t\t/* Try optimization CURLYX => CURLYM. */\n\t\tif ( OP(oscan) == CURLYX && data\n\t\t && !(data->flags & SF_HAS_PAR)\n\t\t && !(data->flags & SF_HAS_EVAL)\n\t\t && !deltanext\t/* atom is fixed width */\n\t\t && minnext != 0\t/* CURLYM can't handle zero width */\n\n /* Nor characters whose fold at run-time may be\n * multi-character */\n && ! (RExC_seen & REG_UNFOLDED_MULTI_SEEN)\n\t\t) {\n\t\t /* XXXX How to optimize if data == 0? */\n\t\t /* Optimize to a simpler form. */\n\t\t regnode *nxt = NEXTOPER(oscan) + EXTRA_STEP_2ARGS; /* OPEN */\n\t\t regnode *nxt2;\n\n\t\t OP(oscan) = CURLYM;\n\t\t while ( (nxt2 = regnext(nxt)) /* skip over embedded stuff*/\n\t\t\t && (OP(nxt2) != WHILEM))\n\t\t\tnxt = nxt2;\n\t\t OP(nxt2) = SUCCEED; /* Whas WHILEM */\n\t\t /* Need to optimize away parenths. */\n\t\t if ((data->flags & SF_IN_PAR) && OP(nxt) == CLOSE) {\n\t\t\t/* Set the parenth number. */\n\t\t\tregnode *nxt1 = NEXTOPER(oscan) + EXTRA_STEP_2ARGS; /* OPEN*/\n\n\t\t\toscan->flags = (U8)ARG(nxt);\n\t\t\tif (RExC_open_parens) {\n /*open->CURLYM*/\n RExC_open_parens[ARG(nxt1)] = REGNODE_OFFSET(oscan);\n\n /*close->NOTHING*/\n RExC_close_parens[ARG(nxt1)] = REGNODE_OFFSET(nxt2)\n + 1;\n\t\t\t}\n\t\t\tOP(nxt1) = OPTIMIZED;\t/* was OPEN. */\n\t\t\tOP(nxt) = OPTIMIZED;\t/* was CLOSE. */\n\n#ifdef DEBUGGING\n\t\t\tOP(nxt1 + 1) = OPTIMIZED; /* was count. */\n\t\t\tOP(nxt + 1) = OPTIMIZED; /* was count. */\n\t\t\tNEXT_OFF(nxt1 + 1) = 0; /* just for consistency. */\n\t\t\tNEXT_OFF(nxt + 1) = 0; /* just for consistency. */\n#endif\n#if 0\n\t\t\twhile ( nxt1 && (OP(nxt1) != WHILEM)) {\n\t\t\t regnode *nnxt = regnext(nxt1);\n\t\t\t if (nnxt == nxt) {\n\t\t\t\tif (reg_off_by_arg[OP(nxt1)])\n\t\t\t\t ARG_SET(nxt1, nxt2 - nxt1);\n\t\t\t\telse if (nxt2 - nxt1 < U16_MAX)\n\t\t\t\t NEXT_OFF(nxt1) = nxt2 - nxt1;\n\t\t\t\telse\n\t\t\t\t OP(nxt) = NOTHING;\t/* Cannot beautify */\n\t\t\t }\n\t\t\t nxt1 = nnxt;\n\t\t\t}\n#endif\n\t\t\t/* Optimize again: */\n /* recurse study_chunk() on optimised CURLYX => CURLYM */\n\t\t\tstudy_chunk(pRExC_state, &nxt1, minlenp, &deltanext, nxt,\n NULL, stopparen, recursed_depth, NULL, 0,\n depth+1);\n\t\t }\n\t\t else\n\t\t\toscan->flags = 0;\n\t\t}\n\t\telse if ((OP(oscan) == CURLYX)\n\t\t\t && (flags & SCF_WHILEM_VISITED_POS)\n\t\t\t /* See the comment on a similar expression above.\n\t\t\t However, this time it's not a subexpression\n\t\t\t we care about, but the expression itself. */\n\t\t\t && (maxcount == REG_INFTY)\n\t\t\t && data) {\n\t\t /* This stays as CURLYX, we can put the count/of pair. */\n\t\t /* Find WHILEM (as in regexec.c) */\n\t\t regnode *nxt = oscan + NEXT_OFF(oscan);\n\n\t\t if (OP(PREVOPER(nxt)) == NOTHING) /* LONGJMP */\n\t\t\tnxt += ARG(nxt);\n nxt = PREVOPER(nxt);\n if (nxt->flags & 0xf) {\n /* we've already set whilem count on this node */\n } else if (++data->whilem_c < 16) {\n assert(data->whilem_c <= RExC_whilem_seen);\n nxt->flags = (U8)(data->whilem_c\n | (RExC_whilem_seen << 4)); /* On WHILEM */\n }\n\t\t}\n\t\tif (data && fl & (SF_HAS_PAR|SF_IN_PAR))\n\t\t pars++;\n\t\tif (flags & SCF_DO_SUBSTR) {\n\t\t SV *last_str = NULL;\n STRLEN last_chrs = 0;\n\t\t int counted = mincount != 0;\n\n if (data->last_end > 0 && mincount != 0) { /* Ends with a\n string. */\n\t\t\tSSize_t b = pos_before >= data->last_start_min\n\t\t\t ? pos_before : data->last_start_min;\n\t\t\tSTRLEN l;\n\t\t\tconst char * const s = SvPV_const(data->last_found, l);\n\t\t\tSSize_t old = b - data->last_start_min;\n assert(old >= 0);\n\n\t\t\tif (UTF)\n\t\t\t old = utf8_hop_forward((U8*)s, old,\n (U8 *) SvEND(data->last_found))\n - (U8*)s;\n\t\t\tl -= old;\n\t\t\t/* Get the added string: */\n\t\t\tlast_str = newSVpvn_utf8(s + old, l, UTF);\n last_chrs = UTF ? utf8_length((U8*)(s + old),\n (U8*)(s + old + l)) : l;\n\t\t\tif (deltanext == 0 && pos_before == b) {\n\t\t\t /* What was added is a constant string */\n\t\t\t if (mincount > 1) {\n\n\t\t\t\tSvGROW(last_str, (mincount * l) + 1);\n\t\t\t\trepeatcpy(SvPVX(last_str) + l,\n\t\t\t\t\t SvPVX_const(last_str), l,\n mincount - 1);\n\t\t\t\tSvCUR_set(last_str, SvCUR(last_str) * mincount);\n\t\t\t\t/* Add additional parts. */\n\t\t\t\tSvCUR_set(data->last_found,\n\t\t\t\t\t SvCUR(data->last_found) - l);\n\t\t\t\tsv_catsv(data->last_found, last_str);\n\t\t\t\t{\n\t\t\t\t SV * sv = data->last_found;\n\t\t\t\t MAGIC *mg =\n\t\t\t\t\tSvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\t\t\t\t if (mg && mg->mg_len >= 0)\n\t\t\t\t\tmg->mg_len += last_chrs * (mincount-1);\n\t\t\t\t}\n last_chrs *= mincount;\n\t\t\t\tdata->last_end += l * (mincount - 1);\n\t\t\t }\n\t\t\t} else {\n\t\t\t /* start offset must point into the last copy */\n\t\t\t data->last_start_min += minnext * (mincount - 1);\n\t\t\t data->last_start_max =\n is_inf\n ? SSize_t_MAX\n\t\t\t : data->last_start_max +\n (maxcount - 1) * (minnext + data->pos_delta);\n\t\t\t}\n\t\t }\n\t\t /* It is counted once already... */\n\t\t data->pos_min += minnext * (mincount - counted);\n#if 0\nPerl_re_printf( aTHX_ \"counted=%\" UVuf \" deltanext=%\" UVuf\n \" SSize_t_MAX=%\" UVuf \" minnext=%\" UVuf\n \" maxcount=%\" UVuf \" mincount=%\" UVuf \"\\n\",\n (UV)counted, (UV)deltanext, (UV)SSize_t_MAX, (UV)minnext, (UV)maxcount,\n (UV)mincount);\nif (deltanext != SSize_t_MAX)\nPerl_re_printf( aTHX_ \"LHS=%\" UVuf \" RHS=%\" UVuf \"\\n\",\n (UV)(-counted * deltanext + (minnext + deltanext) * maxcount\n - minnext * mincount), (UV)(SSize_t_MAX - data->pos_delta));\n#endif\n\t\t if (deltanext == SSize_t_MAX\n || -counted * deltanext + (minnext + deltanext) * maxcount - minnext * mincount >= SSize_t_MAX - data->pos_delta)\n\t\t data->pos_delta = SSize_t_MAX;\n\t\t else\n\t\t data->pos_delta += - counted * deltanext +\n\t\t\t(minnext + deltanext) * maxcount - minnext * mincount;\n\t\t if (mincount != maxcount) {\n\t\t\t /* Cannot extend fixed substrings found inside\n\t\t\t the group. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t\tif (mincount && last_str) {\n\t\t\t SV * const sv = data->last_found;\n\t\t\t MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ?\n\t\t\t\tmg_find(sv, PERL_MAGIC_utf8) : NULL;\n\n\t\t\t if (mg)\n\t\t\t\tmg->mg_len = -1;\n\t\t\t sv_setsv(sv, last_str);\n\t\t\t data->last_end = data->pos_min;\n\t\t\t data->last_start_min = data->pos_min - last_chrs;\n\t\t\t data->last_start_max = is_inf\n\t\t\t\t? SSize_t_MAX\n\t\t\t\t: data->pos_min + data->pos_delta - last_chrs;\n\t\t\t}\n\t\t\tdata->cur_is_floating = 1; /* float */\n\t\t }\n\t\t SvREFCNT_dec(last_str);\n\t\t}\n\t\tif (data && (fl & SF_HAS_EVAL))\n\t\t data->flags |= SF_HAS_EVAL;\n\t optimize_curly_tail:\n\t\tif (OP(oscan) != CURLYX) {\n\t\t while (PL_regkind[OP(next = regnext(oscan))] == NOTHING\n\t\t\t && NEXT_OFF(next))\n\t\t\tNEXT_OFF(oscan) += NEXT_OFF(next);\n\t\t}\n\t\tcontinue;\n\n\t default:\n#ifdef DEBUGGING\n Perl_croak(aTHX_ \"panic: unexpected varying REx opcode %d\",\n OP(scan));\n#endif\n case REF:\n case CLUMP:\n\t\tif (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t\tis_inf = is_inf_internal = 1;\n\t\tif (flags & SCF_DO_STCLASS_OR) {\n if (OP(scan) == CLUMP) {\n /* Actually is any start char, but very few code points\n * aren't start characters */\n ssc_match_all_cp(data->start_class);\n }\n else {\n ssc_anything(data->start_class);\n }\n }\n\t\tflags &= ~SCF_DO_STCLASS;\n\t\tbreak;\n\t }\n\t}\n\telse if (OP(scan) == LNBREAK) {\n\t if (flags & SCF_DO_STCLASS) {\n \t if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class,\n PL_XPosix_ptrs[_CC_VERTSPACE], FALSE);\n ssc_clear_locale(data->start_class);\n ANYOF_FLAGS(data->start_class)\n &= ~SSC_MATCHES_EMPTY_STRING;\n }\n else if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class,\n PL_XPosix_ptrs[_CC_VERTSPACE],\n FALSE);\n\t\t ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\n /* See commit msg for\n * 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class)\n &= ~SSC_MATCHES_EMPTY_STRING;\n }\n\t\tflags &= ~SCF_DO_STCLASS;\n }\n\t min++;\n if (delta != SSize_t_MAX)\n delta++; /* Because of the 2 char string cr-lf */\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n \t data->pos_min += 1;\n if (data->pos_delta != SSize_t_MAX) {\n data->pos_delta += 1;\n }\n\t\tdata->cur_is_floating = 1; /* float */\n \t }\n\t}\n\telse if (REGNODE_SIMPLE(OP(scan))) {\n\n\t if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\tdata->pos_min++;\n\t }\n\t min++;\n\t if (flags & SCF_DO_STCLASS) {\n bool invert = 0;\n SV* my_invlist = NULL;\n U8 namedclass;\n\n /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */\n ANYOF_FLAGS(data->start_class) &= ~SSC_MATCHES_EMPTY_STRING;\n\n\t\t/* Some of the logic below assumes that switching\n\t\t locale on will only add false positives. */\n\t\tswitch (OP(scan)) {\n\n\t\tdefault:\n#ifdef DEBUGGING\n Perl_croak(aTHX_ \"panic: unexpected simple REx opcode %d\",\n OP(scan));\n#endif\n\t\tcase SANY:\n\t\t if (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n\t\t\tssc_match_all_cp(data->start_class);\n\t\t break;\n\n\t\tcase REG_ANY:\n {\n SV* REG_ANY_invlist = _new_invlist(2);\n REG_ANY_invlist = add_cp_to_invlist(REG_ANY_invlist,\n '\\n');\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class,\n REG_ANY_invlist,\n TRUE /* TRUE => invert, hence all but \\n\n */\n );\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class,\n REG_ANY_invlist,\n TRUE /* TRUE => invert */\n );\n ssc_clear_locale(data->start_class);\n }\n SvREFCNT_dec_NN(REG_ANY_invlist);\n\t\t }\n\t\t break;\n\n case ANYOFD:\n case ANYOFL:\n case ANYOFPOSIXL:\n case ANYOFH:\n case ANYOF:\n\t\t if (flags & SCF_DO_STCLASS_AND)\n\t\t\tssc_and(pRExC_state, data->start_class,\n (regnode_charclass *) scan);\n\t\t else\n\t\t\tssc_or(pRExC_state, data->start_class,\n (regnode_charclass *) scan);\n\t\t break;\n\n case NANYOFM:\n case ANYOFM:\n {\n SV* cp_list = get_ANYOFM_contents(scan);\n\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_union(data->start_class, cp_list, invert);\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class, cp_list, invert);\n }\n\n SvREFCNT_dec_NN(cp_list);\n break;\n }\n\n\t\tcase NPOSIXL:\n invert = 1;\n /* FALLTHROUGH */\n\n\t\tcase POSIXL:\n namedclass = classnum_to_namedclass(FLAGS(scan)) + invert;\n if (flags & SCF_DO_STCLASS_AND) {\n bool was_there = cBOOL(\n ANYOF_POSIXL_TEST(data->start_class,\n namedclass));\n ANYOF_POSIXL_ZERO(data->start_class);\n if (was_there) { /* Do an AND */\n ANYOF_POSIXL_SET(data->start_class, namedclass);\n }\n /* No individual code points can now match */\n data->start_class->invlist\n = sv_2mortal(_new_invlist(0));\n }\n else {\n int complement = namedclass + ((invert) ? -1 : 1);\n\n assert(flags & SCF_DO_STCLASS_OR);\n\n /* If the complement of this class was already there,\n * the result is that they match all code points,\n * (\\d + \\D == everything). Remove the classes from\n * future consideration. Locale is not relevant in\n * this case */\n if (ANYOF_POSIXL_TEST(data->start_class, complement)) {\n ssc_match_all_cp(data->start_class);\n ANYOF_POSIXL_CLEAR(data->start_class, namedclass);\n ANYOF_POSIXL_CLEAR(data->start_class, complement);\n }\n else { /* The usual case; just add this class to the\n existing set */\n ANYOF_POSIXL_SET(data->start_class, namedclass);\n }\n }\n break;\n\n case NPOSIXA: /* For these, we always know the exact set of\n what's matched */\n invert = 1;\n /* FALLTHROUGH */\n\t\tcase POSIXA:\n my_invlist = invlist_clone(PL_Posix_ptrs[FLAGS(scan)], NULL);\n goto join_posix_and_ascii;\n\n\t\tcase NPOSIXD:\n\t\tcase NPOSIXU:\n invert = 1;\n /* FALLTHROUGH */\n\t\tcase POSIXD:\n\t\tcase POSIXU:\n my_invlist = invlist_clone(PL_XPosix_ptrs[FLAGS(scan)], NULL);\n\n /* NPOSIXD matches all upper Latin1 code points unless the\n * target string being matched is UTF-8, which is\n * unknowable until match time. Since we are going to\n * invert, we want to get rid of all of them so that the\n * inversion will match all */\n if (OP(scan) == NPOSIXD) {\n _invlist_subtract(my_invlist, PL_UpperLatin1,\n &my_invlist);\n }\n\n join_posix_and_ascii:\n\n if (flags & SCF_DO_STCLASS_AND) {\n ssc_intersection(data->start_class, my_invlist, invert);\n ssc_clear_locale(data->start_class);\n }\n else {\n assert(flags & SCF_DO_STCLASS_OR);\n ssc_union(data->start_class, my_invlist, invert);\n }\n SvREFCNT_dec(my_invlist);\n\t\t}\n\t\tif (flags & SCF_DO_STCLASS_OR)\n\t\t ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n\t\tflags &= ~SCF_DO_STCLASS;\n\t }\n\t}\n\telse if (PL_regkind[OP(scan)] == EOL && flags & SCF_DO_SUBSTR) {\n\t data->flags |= (OP(scan) == MEOL\n\t\t\t ? SF_BEFORE_MEOL\n\t\t\t : SF_BEFORE_SEOL);\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\n\t}\n\telse if ( PL_regkind[OP(scan)] == BRANCHJ\n\t\t /* Lookbehind, or need to calculate parens/evals/stclass: */\n\t\t && (scan->flags || data || (flags & SCF_DO_STCLASS))\n\t\t && (OP(scan) == IFMATCH || OP(scan) == UNLESSM))\n {\n if ( !PERL_ENABLE_POSITIVE_ASSERTION_STUDY\n || OP(scan) == UNLESSM )\n {\n /* Negative Lookahead/lookbehind\n In this case we can't do fixed string optimisation.\n */\n\n SSize_t deltanext, minnext, fake = 0;\n regnode *nscan;\n regnode_ssc intrnl;\n int f = 0;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n if (data) {\n data_fake.whilem_c = data->whilem_c;\n data_fake.last_closep = data->last_closep;\n\t\t}\n else\n data_fake.last_closep = &fake;\n\t\tdata_fake.pos_delta = delta;\n if ( flags & SCF_DO_STCLASS && !scan->flags\n && OP(scan) == IFMATCH ) { /* Lookahead */\n ssc_init(pRExC_state, &intrnl);\n data_fake.start_class = &intrnl;\n f |= SCF_DO_STCLASS_AND;\n\t\t}\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n next = regnext(scan);\n nscan = NEXTOPER(NEXTOPER(scan));\n\n /* recurse study_chunk() for lookahead body */\n minnext = study_chunk(pRExC_state, &nscan, minlenp, &deltanext,\n last, &data_fake, stopparen,\n recursed_depth, NULL, f, depth+1);\n if (scan->flags) {\n if ( deltanext < 0\n || deltanext > (I32) U8_MAX\n || minnext > (I32)U8_MAX\n || minnext + deltanext > (I32)U8_MAX)\n {\n\t\t\tFAIL2(\"Lookbehind longer than %\" UVuf \" not implemented\",\n (UV)U8_MAX);\n }\n\n /* The 'next_off' field has been repurposed to count the\n * additional starting positions to try beyond the initial\n * one. (This leaves it at 0 for non-variable length\n * matches to avoid breakage for those not using this\n * extension) */\n if (deltanext) {\n scan->next_off = deltanext;\n ckWARNexperimental(RExC_parse,\n WARN_EXPERIMENTAL__VLB,\n \"Variable length lookbehind is experimental\");\n }\n scan->flags = (U8)minnext + deltanext;\n }\n if (data) {\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n }\n if (f & SCF_DO_STCLASS_AND) {\n\t\t if (flags & SCF_DO_STCLASS_OR) {\n\t\t\t/* OR before, AND after: ideally we would recurse with\n\t\t\t * data_fake to get the AND applied by study of the\n\t\t\t * remainder of the pattern, and then derecurse;\n\t\t\t * *** HACK *** for now just treat as \"no information\".\n\t\t\t * See [perl #56690].\n\t\t\t */\n\t\t\tssc_init(pRExC_state, data->start_class);\n\t\t } else {\n /* AND before and after: combine and continue. These\n * assertions are zero-length, so can match an EMPTY\n * string */\n\t\t\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) &intrnl);\n ANYOF_FLAGS(data->start_class)\n |= SSC_MATCHES_EMPTY_STRING;\n\t\t }\n }\n\t }\n#if PERL_ENABLE_POSITIVE_ASSERTION_STUDY\n else {\n /* Positive Lookahead/lookbehind\n In this case we can do fixed string optimisation,\n but we must be careful about it. Note in the case of\n lookbehind the positions will be offset by the minimum\n length of the pattern, something we won't know about\n until after the recurse.\n */\n SSize_t deltanext, fake = 0;\n regnode *nscan;\n regnode_ssc intrnl;\n int f = 0;\n /* We use SAVEFREEPV so that when the full compile\n is finished perl will clean up the allocated\n minlens when it's all done. This way we don't\n have to worry about freeing them when we know\n they wont be used, which would be a pain.\n */\n SSize_t *minnextp;\n Newx( minnextp, 1, SSize_t );\n SAVEFREEPV(minnextp);\n\n if (data) {\n StructCopy(data, &data_fake, scan_data_t);\n if ((flags & SCF_DO_SUBSTR) && data->last_found) {\n f |= SCF_DO_SUBSTR;\n if (scan->flags)\n scan_commit(pRExC_state, &data_fake, minlenp, is_inf);\n data_fake.last_found=newSVsv(data->last_found);\n }\n }\n else\n data_fake.last_closep = &fake;\n data_fake.flags = 0;\n data_fake.substrs[0].flags = 0;\n data_fake.substrs[1].flags = 0;\n\t\tdata_fake.pos_delta = delta;\n if (is_inf)\n\t data_fake.flags |= SF_IS_INF;\n if ( flags & SCF_DO_STCLASS && !scan->flags\n && OP(scan) == IFMATCH ) { /* Lookahead */\n ssc_init(pRExC_state, &intrnl);\n data_fake.start_class = &intrnl;\n f |= SCF_DO_STCLASS_AND;\n }\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n next = regnext(scan);\n nscan = NEXTOPER(NEXTOPER(scan));\n\n /* positive lookahead study_chunk() recursion */\n *minnextp = study_chunk(pRExC_state, &nscan, minnextp,\n &deltanext, last, &data_fake,\n stopparen, recursed_depth, NULL,\n f, depth+1);\n if (scan->flags) {\n assert(0); /* This code has never been tested since this\n is normally not compiled */\n if ( deltanext < 0\n || deltanext > (I32) U8_MAX\n || *minnextp > (I32)U8_MAX\n || *minnextp + deltanext > (I32)U8_MAX)\n {\n\t\t\tFAIL2(\"Lookbehind longer than %\" UVuf \" not implemented\",\n (UV)U8_MAX);\n }\n\n if (deltanext) {\n scan->next_off = deltanext;\n }\n scan->flags = (U8)*minnextp + deltanext;\n }\n\n *minnextp += min;\n\n if (f & SCF_DO_STCLASS_AND) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &intrnl);\n ANYOF_FLAGS(data->start_class) |= SSC_MATCHES_EMPTY_STRING;\n }\n if (data) {\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n if ((flags & SCF_DO_SUBSTR) && data_fake.last_found) {\n int i;\n if (RExC_rx->minlen<*minnextp)\n RExC_rx->minlen=*minnextp;\n scan_commit(pRExC_state, &data_fake, minnextp, is_inf);\n SvREFCNT_dec_NN(data_fake.last_found);\n\n for (i = 0; i < 2; i++) {\n if (data_fake.substrs[i].minlenp != minlenp) {\n data->substrs[i].min_offset =\n data_fake.substrs[i].min_offset;\n data->substrs[i].max_offset =\n data_fake.substrs[i].max_offset;\n data->substrs[i].minlenp =\n data_fake.substrs[i].minlenp;\n data->substrs[i].lookbehind += scan->flags;\n }\n }\n }\n }\n\t }\n#endif\n\t}\n\n\telse if (OP(scan) == OPEN) {\n\t if (stopparen != (I32)ARG(scan))\n\t pars++;\n\t}\n\telse if (OP(scan) == CLOSE) {\n\t if (stopparen == (I32)ARG(scan)) {\n\t break;\n\t }\n\t if ((I32)ARG(scan) == is_par) {\n\t\tnext = regnext(scan);\n\n\t\tif ( next && (OP(next) != WHILEM) && next < last)\n\t\t is_par = 0;\t\t/* Disable optimization */\n\t }\n\t if (data)\n\t\t*(data->last_closep) = ARG(scan);\n\t}\n\telse if (OP(scan) == EVAL) {\n\t\tif (data)\n\t\t data->flags |= SF_HAS_EVAL;\n\t}\n\telse if ( PL_regkind[OP(scan)] == ENDLIKE ) {\n\t if (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\tflags &= ~SCF_DO_SUBSTR;\n\t }\n\t if (data && OP(scan)==ACCEPT) {\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t if (stopmin > min)\n\t stopmin = min;\n\t }\n\t}\n\telse if (OP(scan) == LOGICAL && scan->flags == 2) /* Embedded follows */\n\t{\n\t\tif (flags & SCF_DO_SUBSTR) {\n scan_commit(pRExC_state, data, minlenp, is_inf);\n\t\t data->cur_is_floating = 1; /* float */\n\t\t}\n\t\tis_inf = is_inf_internal = 1;\n\t\tif (flags & SCF_DO_STCLASS_OR) /* Allow everything */\n\t\t ssc_anything(data->start_class);\n\t\tflags &= ~SCF_DO_STCLASS;\n\t}\n\telse if (OP(scan) == GPOS) {\n if (!(RExC_rx->intflags & PREGf_GPOS_FLOAT) &&\n\t !(delta || is_inf || (data && data->pos_delta)))\n\t {\n if (!(RExC_rx->intflags & PREGf_ANCH) && (flags & SCF_DO_SUBSTR))\n RExC_rx->intflags |= PREGf_ANCH_GPOS;\n\t if (RExC_rx->gofs < (STRLEN)min)\n\t\t RExC_rx->gofs = min;\n } else {\n RExC_rx->intflags |= PREGf_GPOS_FLOAT;\n RExC_rx->gofs = 0;\n }\n\t}\n#ifdef TRIE_STUDY_OPT\n#ifdef FULL_TRIE_STUDY\n else if (PL_regkind[OP(scan)] == TRIE) {\n /* NOTE - There is similar code to this block above for handling\n BRANCH nodes on the initial study. If you change stuff here\n check there too. */\n regnode *trie_node= scan;\n regnode *tail= regnext(scan);\n reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ];\n SSize_t max1 = 0, min1 = SSize_t_MAX;\n regnode_ssc accum;\n\n if (flags & SCF_DO_SUBSTR) { /* XXXX Add !SUSPEND? */\n /* Cannot merge strings after this. */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n }\n if (flags & SCF_DO_STCLASS)\n ssc_init_zero(pRExC_state, &accum);\n\n if (!trie->jump) {\n min1= trie->minlen;\n max1= trie->maxlen;\n } else {\n const regnode *nextbranch= NULL;\n U32 word;\n\n for ( word=1 ; word <= trie->wordcount ; word++)\n {\n SSize_t deltanext=0, minnext=0, f = 0, fake;\n regnode_ssc this_class;\n\n StructCopy(&zero_scan_data, &data_fake, scan_data_t);\n if (data) {\n data_fake.whilem_c = data->whilem_c;\n data_fake.last_closep = data->last_closep;\n }\n else\n data_fake.last_closep = &fake;\n\t\t data_fake.pos_delta = delta;\n if (flags & SCF_DO_STCLASS) {\n ssc_init(pRExC_state, &this_class);\n data_fake.start_class = &this_class;\n f = SCF_DO_STCLASS_AND;\n }\n if (flags & SCF_WHILEM_VISITED_POS)\n f |= SCF_WHILEM_VISITED_POS;\n\n if (trie->jump[word]) {\n if (!nextbranch)\n nextbranch = trie_node + trie->jump[0];\n scan= trie_node + trie->jump[word];\n /* We go from the jump point to the branch that follows\n it. Note this means we need the vestigal unused\n branches even though they arent otherwise used. */\n /* optimise study_chunk() for TRIE */\n minnext = study_chunk(pRExC_state, &scan, minlenp,\n &deltanext, (regnode *)nextbranch, &data_fake,\n stopparen, recursed_depth, NULL, f, depth+1);\n }\n if (nextbranch && PL_regkind[OP(nextbranch)]==BRANCH)\n nextbranch= regnext((regnode*)nextbranch);\n\n if (min1 > (SSize_t)(minnext + trie->minlen))\n min1 = minnext + trie->minlen;\n if (deltanext == SSize_t_MAX) {\n is_inf = is_inf_internal = 1;\n max1 = SSize_t_MAX;\n } else if (max1 < (SSize_t)(minnext + deltanext + trie->maxlen))\n max1 = minnext + deltanext + trie->maxlen;\n\n if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))\n pars++;\n if (data_fake.flags & SCF_SEEN_ACCEPT) {\n if ( stopmin > min + min1)\n\t stopmin = min + min1;\n\t flags &= ~SCF_DO_SUBSTR;\n\t if (data)\n\t data->flags |= SCF_SEEN_ACCEPT;\n\t }\n if (data) {\n if (data_fake.flags & SF_HAS_EVAL)\n data->flags |= SF_HAS_EVAL;\n data->whilem_c = data_fake.whilem_c;\n }\n if (flags & SCF_DO_STCLASS)\n ssc_or(pRExC_state, &accum, (regnode_charclass *) &this_class);\n }\n }\n if (flags & SCF_DO_SUBSTR) {\n data->pos_min += min1;\n data->pos_delta += max1 - min1;\n if (max1 != min1 || is_inf)\n data->cur_is_floating = 1; /* float */\n }\n min += min1;\n if (delta != SSize_t_MAX) {\n if (SSize_t_MAX - (max1 - min1) >= delta)\n delta += max1 - min1;\n else\n delta = SSize_t_MAX;\n }\n if (flags & SCF_DO_STCLASS_OR) {\n ssc_or(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n if (min1) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n flags &= ~SCF_DO_STCLASS;\n }\n }\n else if (flags & SCF_DO_STCLASS_AND) {\n if (min1) {\n ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &accum);\n flags &= ~SCF_DO_STCLASS;\n }\n else {\n /* Switch to OR mode: cache the old value of\n * data->start_class */\n\t\t INIT_AND_WITHP;\n StructCopy(data->start_class, and_withp, regnode_ssc);\n flags &= ~SCF_DO_STCLASS_AND;\n StructCopy(&accum, data->start_class, regnode_ssc);\n flags |= SCF_DO_STCLASS_OR;\n }\n }\n scan= tail;\n continue;\n }\n#else\n\telse if (PL_regkind[OP(scan)] == TRIE) {\n\t reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ];\n\t U8*bang=NULL;\n\n\t min += trie->minlen;\n\t delta += (trie->maxlen - trie->minlen);\n\t flags &= ~SCF_DO_STCLASS; /* xxx */\n if (flags & SCF_DO_SUBSTR) {\n /* Cannot expect anything... */\n scan_commit(pRExC_state, data, minlenp, is_inf);\n \t data->pos_min += trie->minlen;\n \t data->pos_delta += (trie->maxlen - trie->minlen);\n\t\tif (trie->maxlen != trie->minlen)\n\t\t data->cur_is_floating = 1; /* float */\n \t }\n \t if (trie->jump) /* no more substrings -- for now /grr*/\n flags &= ~SCF_DO_SUBSTR;\n\t}\n#endif /* old or new */\n#endif /* TRIE_STUDY_OPT */\n\n\t/* Else: zero-length, ignore. */\n\tscan = regnext(scan);\n }\n\n finish:\n if (frame) {\n /* we need to unwind recursion. */\n depth = depth - 1;\n\n DEBUG_STUDYDATA(\"frame-end\", data, depth, is_inf);\n DEBUG_PEEP(\"fend\", scan, depth, flags);\n\n /* restore previous context */\n last = frame->last_regnode;\n scan = frame->next_regnode;\n stopparen = frame->stopparen;\n recursed_depth = frame->prev_recursed_depth;\n\n RExC_frame_last = frame->prev_frame;\n frame = frame->this_prev_frame;\n goto fake_study_recurse;\n }\n\n assert(!frame);\n DEBUG_STUDYDATA(\"pre-fin\", data, depth, is_inf);\n\n *scanp = scan;\n *deltap = is_inf_internal ? SSize_t_MAX : delta;\n\n if (flags & SCF_DO_SUBSTR && is_inf)\n\tdata->pos_delta = SSize_t_MAX - data->pos_min;\n if (is_par > (I32)U8_MAX)\n\tis_par = 0;\n if (is_par && pars==1 && data) {\n\tdata->flags |= SF_IN_PAR;\n\tdata->flags &= ~SF_HAS_PAR;\n }\n else if (pars && data) {\n\tdata->flags |= SF_HAS_PAR;\n\tdata->flags &= ~SF_IN_PAR;\n }\n if (flags & SCF_DO_STCLASS_OR)\n\tssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp);\n if (flags & SCF_TRIE_RESTUDY)\n data->flags |= \tSCF_TRIE_RESTUDY;\n\n DEBUG_STUDYDATA(\"post-fin\", data, depth, is_inf);\n\n {\n SSize_t final_minlen= min < stopmin ? min : stopmin;\n\n if (!(RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN)) {\n if (final_minlen > SSize_t_MAX - delta)\n RExC_maxlen = SSize_t_MAX;\n else if (RExC_maxlen < final_minlen + delta)\n RExC_maxlen = final_minlen + delta;\n }\n return final_minlen;\n }\n NOT_REACHED; /* NOTREACHED */","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"S_study_chunk","file_name":"regcomp.c","commit_link":"github.com/perl/perl5/commit/897d1f7fd515b828e4b198d8b8bef76c6faf03ed","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-787#5-76f9ec416b60","input":"static void RemoveICCProfileFromResourceBlock(StringInfo *bim_profile)\n{\n register const unsigned char\n *p;\n\n size_t\n length;\n\n unsigned char\n *datum;\n\n unsigned int\n count,\n long_sans;\n\n unsigned short\n id,\n short_sans;\n\n length=GetStringInfoLength(bim_profile);\n if (length < 16)\n return;\n datum=GetStringInfoDatum(bim_profile);\n for (p=datum; (p >= datum) && (p < (datum+length-16)); )\n {\n register unsigned char\n *q;\n\n q=(unsigned char *) p;\n if (LocaleNCompare((const char *) p,\"8BIM\",4) != 0)\n break;\n p=PushLongPixel(MSBEndian,p,&long_sans);\n p=PushShortPixel(MSBEndian,p,&id);\n p=PushShortPixel(MSBEndian,p,&short_sans);\n p=PushLongPixel(MSBEndian,p,&count);\n if (id == 0x0000040f)\n {\n (void) CopyMagickMemory(q,q+PSDQuantum(count)+12,length-\n (PSDQuantum(count)+12)-(q-datum));\n SetStringInfoLength(bim_profile,length-(PSDQuantum(count)+12));\n break;\n }\n p+=count;\n if ((count & 0x01) != 0)\n p++;\n }\n}","target":"static void RemoveICCProfileFromResourceBlock(StringInfo *bim_profile)\n{\n register const unsigned char\n *p;\n\n size_t\n length;\n\n unsigned char\n *datum;\n\n unsigned int\n count,\n long_sans;\n\n unsigned short\n id,\n short_sans;\n\n length=GetStringInfoLength(bim_profile);\n if (length < 16)\n return;\n datum=GetStringInfoDatum(bim_profile);\n for (p=datum; (p >= datum) && (p < (datum+length-16)); )\n {\n register unsigned char\n *q;\n\n q=(unsigned char *) p;\n if (LocaleNCompare((const char *) p,\"8BIM\",4) != 0)\n break;\n p=PushLongPixel(MSBEndian,p,&long_sans);\n p=PushShortPixel(MSBEndian,p,&id);\n p=PushShortPixel(MSBEndian,p,&short_sans);\n p=PushLongPixel(MSBEndian,p,&count);\n if (id == 0x0000040f)\n {\n if ((q+PSDQuantum(count)+12) < (datum+length-16))\n {\n (void) CopyMagickMemory(q,q+PSDQuantum(count)+12,length-\n (PSDQuantum(count)+12)-(q-datum));\n SetStringInfoLength(bim_profile,length-(PSDQuantum(count)+12));\n }\n break;\n }\n p+=count;\n if ((count & 0x01) != 0)\n p++;\n }\n}","lang":"c","vul_type":"cwe-787","sven_meta":{"func_name":"RemoveICCProfileFromResourceBlock","file_name":"coders/psd.c","commit_link":"github.com/ImageMagick/ImageMagick/commit/53c1dcd34bed85181b901bfce1a2322f85a59472","source_cwe_file":"cwe-787.jsonl"}} +{"problem_id":"cwe-079#0-21e64a3cf7ce","input":"void PeerListWidget::updatePeer(const QString &ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)\n{\n QStandardItem *item = m_peerItems.value(ip);\n int row = item->row();\n if (m_resolveCountries) {\n const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());\n if (!ico.isNull()) {\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);\n const QString countryName = Net::GeoIPManager::CountryName(peer.country());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), countryName, Qt::ToolTipRole);\n m_missingFlags.remove(ip);\n }\n }\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), peer.connectionType());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flags());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flagsDescription(), Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), peer.client());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PROGRESS), peer.progress());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payloadDownSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::UP_SPEED), peer.payloadUpSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_DOWN), peer.totalDownload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());\n QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\";\")));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\"\\n\")), Qt::ToolTipRole);\n}","target":"void PeerListWidget::updatePeer(const QString &ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)\n{\n QStandardItem *item = m_peerItems.value(ip);\n int row = item->row();\n if (m_resolveCountries) {\n const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());\n if (!ico.isNull()) {\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);\n const QString countryName = Net::GeoIPManager::CountryName(peer.country());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), countryName, Qt::ToolTipRole);\n m_missingFlags.remove(ip);\n }\n }\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CONNECTION), peer.connectionType());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flags());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::FLAGS), peer.flagsDescription(), Qt::ToolTipRole);\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::CLIENT), Utils::String::toHtmlEscaped(peer.client()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::PROGRESS), peer.progress());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payloadDownSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::UP_SPEED), peer.payloadUpSpeed());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_DOWN), peer.totalDownload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::TOT_UP), peer.totalUpload());\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::RELEVANCE), peer.relevance());\n QStringList downloadingFiles(torrent->info().filesForPiece(peer.downloadingPieceIndex()));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\";\")));\n m_listModel->setData(m_listModel->index(row, PeerListDelegate::DOWNLOADING_PIECE), downloadingFiles.join(QLatin1String(\"\\n\")), Qt::ToolTipRole);\n}","lang":"cpp","vul_type":"cwe-079","sven_meta":{"func_name":"PeerListWidget::updatePeer","file_name":"src/gui/properties/peerlistwidget.cpp","commit_link":"github.com/qbittorrent/qBittorrent/commit/6ca3e4f094da0a0017cb2d483ec1db6176bb0b16","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#1-f5b73f1c28f1","input":" def redirect(self, url, **kwargs):\n \"\"\"Explicitly converts url to 'str', because webapp2.RequestHandler.redirect\n strongly requires 'str' but url might be an unicode string.\"\"\"\n super(Handler, self).redirect(str(url), **kwargs)","target":" def redirect(self, url, **kwargs):\n \"\"\"Explicitly converts url to 'str', because webapp2.RequestHandler.redirect\n strongly requires 'str' but url might be an unicode string.\"\"\"\n url = str(url)\n check_redirect_url(url)\n super(Handler, self).redirect(url, **kwargs)","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"redirect","file_name":"src/appengine/handlers/base_handler.py","commit_link":"github.com/google/clusterfuzz/commit/3d66c1146550eecd4e34d47332a8616b435a21fe","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#2-e3262a46f2fc","input":" def get_value(self):\n if self.column.render_function:\n # We don't want to escape our html\n return self.column.render_function(self.object)\n\n field = getattr(self.object, self.column.field_name) if self.column.field_name else None\n if type(self.object) == dict:\n value = self.object.get(self.column.field_name)\n elif callable(field):\n value = field() if getattr(field, 'do_not_call_in_templates', False) else field\n else:\n display_function = getattr(self.object, 'get_%s_display' % self.column.field_name, False)\n value = display_function() if display_function else field\n\n return escape(value)","target":" def get_value(self):\n field = getattr(self.object, self.column.field_name) if self.column.field_name else None\n if self.column.render_function:\n template = self.column.render_function(self.object)\n if not self.is_template_instance(template):\n raise SmartListException(\n 'Your render_function {} should return django.template.Template or django.template.backends.django.Template object instead of {}'.format(\n self.column.render_function.__name__,\n type(template),\n )\n )\n value = template.render()\n elif type(self.object) == dict:\n value = self.object.get(self.column.field_name)\n elif callable(field):\n value = field() if getattr(field, 'do_not_call_in_templates', False) else field\n else:\n display_function = getattr(self.object, 'get_%s_display' % self.column.field_name, False)\n value = display_function() if display_function else field\n\n return value","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"get_value","file_name":"smart_lists/helpers.py","commit_link":"github.com/plecto/django-smart-lists/commit/44314e51b371e01cd9bceb2e0ed6c8d75d7f87c3","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#3-35e4c0aaf5b1","input":"http_error_t::make_body (int n, const str &si, const str &aux)\n{\n strbuf b;\n str ldesc;\n const str sdesc = http_status.get_desc (n, &ldesc);\n b << \"\\n\"\n << \" \\n\"\n << \" \" << n << \" \" << sdesc << \"\\n\"\n << \" \\n\"\n << \" \\n\"\n << \"

Error \" << n << \" \" << sdesc << \"



\\n\"\n ;\n if (n == HTTP_NOT_FOUND && aux) {\n b << \"The file \" << aux \n << \" was not found on this server.

\\n\\n\";\n }\n b << \"
\\n\"\n << \" \" << si << \"\\n\"\n << \"
\\n\"\n << \" \\n\"\n << \"\\n\"\n ;\n return b;\n}","target":"http_error_t::make_body (int n, const str &si, const str &aux)\n{\n strbuf b;\n str ldesc;\n const str sdesc = xss_escape (http_status.get_desc (n, &ldesc));\n b << \"\\n\"\n << \" \\n\"\n << \" \" << n << \" \" << sdesc << \"\\n\"\n << \" \\n\"\n << \" \\n\"\n << \"

Error \" << n << \" \" << sdesc << \"



\\n\"\n ;\n if (n == HTTP_NOT_FOUND && aux) {\n b << \"The file \" << xss_escape (aux)\n << \" was not found on this server.

\\n\\n\";\n }\n b << \"
\\n\"\n << \" \" << xss_escape (si) << \"\\n\"\n << \"
\\n\"\n << \" \\n\"\n << \"\\n\"\n ;\n return b;\n}","lang":"c","vul_type":"cwe-079","sven_meta":{"func_name":"http_error_t::make_body","file_name":"libahttp/err.C","commit_link":"github.com/okws/okws/commit/e9bedb644d106a043e33e1058bedd1c2c0b2e2e0","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-079#4-62957905f62d","input":"def list_editor_workflows(request): \n workflows = [d.content_object.to_dict() for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]\n\n return render('editor/list_editor_workflows.mako', request, {\n 'workflows_json': json.dumps(workflows)\n })","target":"def list_editor_workflows(request): \n workflows = [d.content_object.to_dict() for d in Document.objects.get_docs(request.user, Document2, extra='workflow2')]\n\n return render('editor/list_editor_workflows.mako', request, {\n 'workflows_json': json.dumps(workflows, cls=JSONEncoderForHTML)\n })","lang":"python","vul_type":"cwe-079","sven_meta":{"func_name":"list_editor_workflows","file_name":"apps/oozie/src/oozie/views/editor2.py","commit_link":"github.com/gethue/hue/commit/6641c62beaa1468082e47d82da5ed758d11c7735","source_cwe_file":"cwe-079.jsonl"}} +{"problem_id":"cwe-190#0-0afd7accaf6c","input":"static void opj_get_encoding_parameters(const opj_image_t *p_image,\n const opj_cp_t *p_cp,\n OPJ_UINT32 p_tileno,\n OPJ_INT32 * p_tx0,\n OPJ_INT32 * p_tx1,\n OPJ_INT32 * p_ty0,\n OPJ_INT32 * p_ty1,\n OPJ_UINT32 * p_dx_min,\n OPJ_UINT32 * p_dy_min,\n OPJ_UINT32 * p_max_prec,\n OPJ_UINT32 * p_max_res)\n{\n /* loop */\n OPJ_UINT32 compno, resno;\n /* pointers */\n const opj_tcp_t *l_tcp = 00;\n const opj_tccp_t * l_tccp = 00;\n const opj_image_comp_t * l_img_comp = 00;\n\n /* position in x and y of tile */\n OPJ_UINT32 p, q;\n\n /* preconditions */\n assert(p_cp != 00);\n assert(p_image != 00);\n assert(p_tileno < p_cp->tw * p_cp->th);\n\n /* initializations */\n l_tcp = &p_cp->tcps [p_tileno];\n l_img_comp = p_image->comps;\n l_tccp = l_tcp->tccps;\n\n /* here calculation of tx0, tx1, ty0, ty1, maxprec, dx and dy */\n p = p_tileno % p_cp->tw;\n q = p_tileno / p_cp->tw;\n\n /* find extent of tile */\n *p_tx0 = opj_int_max((OPJ_INT32)(p_cp->tx0 + p * p_cp->tdx),\n (OPJ_INT32)p_image->x0);\n *p_tx1 = opj_int_min((OPJ_INT32)(p_cp->tx0 + (p + 1) * p_cp->tdx),\n (OPJ_INT32)p_image->x1);\n *p_ty0 = opj_int_max((OPJ_INT32)(p_cp->ty0 + q * p_cp->tdy),\n (OPJ_INT32)p_image->y0);\n *p_ty1 = opj_int_min((OPJ_INT32)(p_cp->ty0 + (q + 1) * p_cp->tdy),\n (OPJ_INT32)p_image->y1);\n\n /* max precision is 0 (can only grow) */\n *p_max_prec = 0;\n *p_max_res = 0;\n\n /* take the largest value for dx_min and dy_min */\n *p_dx_min = 0x7fffffff;\n *p_dy_min = 0x7fffffff;\n\n for (compno = 0; compno < p_image->numcomps; ++compno) {\n /* arithmetic variables to calculate */\n OPJ_UINT32 l_level_no;\n OPJ_INT32 l_rx0, l_ry0, l_rx1, l_ry1;\n OPJ_INT32 l_px0, l_py0, l_px1, py1;\n OPJ_UINT32 l_pdx, l_pdy;\n OPJ_UINT32 l_pw, l_ph;\n OPJ_UINT32 l_product;\n OPJ_INT32 l_tcx0, l_tcy0, l_tcx1, l_tcy1;\n\n l_tcx0 = opj_int_ceildiv(*p_tx0, (OPJ_INT32)l_img_comp->dx);\n l_tcy0 = opj_int_ceildiv(*p_ty0, (OPJ_INT32)l_img_comp->dy);\n l_tcx1 = opj_int_ceildiv(*p_tx1, (OPJ_INT32)l_img_comp->dx);\n l_tcy1 = opj_int_ceildiv(*p_ty1, (OPJ_INT32)l_img_comp->dy);\n\n if (l_tccp->numresolutions > *p_max_res) {\n *p_max_res = l_tccp->numresolutions;\n }\n\n /* use custom size for precincts */\n for (resno = 0; resno < l_tccp->numresolutions; ++resno) {\n OPJ_UINT32 l_dx, l_dy;\n\n /* precinct width and height */\n l_pdx = l_tccp->prcw[resno];\n l_pdy = l_tccp->prch[resno];\n\n l_dx = l_img_comp->dx * (1u << (l_pdx + l_tccp->numresolutions - 1 - resno));\n l_dy = l_img_comp->dy * (1u << (l_pdy + l_tccp->numresolutions - 1 - resno));\n\n /* take the minimum size for dx for each comp and resolution */\n *p_dx_min = opj_uint_min(*p_dx_min, l_dx);\n *p_dy_min = opj_uint_min(*p_dy_min, l_dy);\n\n /* various calculations of extents */\n l_level_no = l_tccp->numresolutions - 1 - resno;\n\n l_rx0 = opj_int_ceildivpow2(l_tcx0, (OPJ_INT32)l_level_no);\n l_ry0 = opj_int_ceildivpow2(l_tcy0, (OPJ_INT32)l_level_no);\n l_rx1 = opj_int_ceildivpow2(l_tcx1, (OPJ_INT32)l_level_no);\n l_ry1 = opj_int_ceildivpow2(l_tcy1, (OPJ_INT32)l_level_no);\n\n l_px0 = opj_int_floordivpow2(l_rx0, (OPJ_INT32)l_pdx) << l_pdx;\n l_py0 = opj_int_floordivpow2(l_ry0, (OPJ_INT32)l_pdy) << l_pdy;\n l_px1 = opj_int_ceildivpow2(l_rx1, (OPJ_INT32)l_pdx) << l_pdx;\n\n py1 = opj_int_ceildivpow2(l_ry1, (OPJ_INT32)l_pdy) << l_pdy;\n\n l_pw = (l_rx0 == l_rx1) ? 0 : (OPJ_UINT32)((l_px1 - l_px0) >> l_pdx);\n l_ph = (l_ry0 == l_ry1) ? 0 : (OPJ_UINT32)((py1 - l_py0) >> l_pdy);\n\n l_product = l_pw * l_ph;\n\n /* update precision */\n if (l_product > *p_max_prec) {\n *p_max_prec = l_product;\n }\n }\n ++l_img_comp;\n ++l_tccp;\n }\n}","target":"static void opj_get_encoding_parameters(const opj_image_t *p_image,\n const opj_cp_t *p_cp,\n OPJ_UINT32 p_tileno,\n OPJ_INT32 * p_tx0,\n OPJ_INT32 * p_tx1,\n OPJ_INT32 * p_ty0,\n OPJ_INT32 * p_ty1,\n OPJ_UINT32 * p_dx_min,\n OPJ_UINT32 * p_dy_min,\n OPJ_UINT32 * p_max_prec,\n OPJ_UINT32 * p_max_res)\n{\n /* loop */\n OPJ_UINT32 compno, resno;\n /* pointers */\n const opj_tcp_t *l_tcp = 00;\n const opj_tccp_t * l_tccp = 00;\n const opj_image_comp_t * l_img_comp = 00;\n\n /* position in x and y of tile */\n OPJ_UINT32 p, q;\n\n /* non-corrected (in regard to image offset) tile offset */\n OPJ_UINT32 l_tx0, l_ty0;\n\n /* preconditions */\n assert(p_cp != 00);\n assert(p_image != 00);\n assert(p_tileno < p_cp->tw * p_cp->th);\n\n /* initializations */\n l_tcp = &p_cp->tcps [p_tileno];\n l_img_comp = p_image->comps;\n l_tccp = l_tcp->tccps;\n\n /* here calculation of tx0, tx1, ty0, ty1, maxprec, dx and dy */\n p = p_tileno % p_cp->tw;\n q = p_tileno / p_cp->tw;\n\n /* find extent of tile */\n l_tx0 = p_cp->tx0 + p *\n p_cp->tdx; /* can't be greater than p_image->x1 so won't overflow */\n *p_tx0 = (OPJ_INT32)opj_uint_max(l_tx0, p_image->x0);\n *p_tx1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_tx0, p_cp->tdx), p_image->x1);\n l_ty0 = p_cp->ty0 + q *\n p_cp->tdy; /* can't be greater than p_image->y1 so won't overflow */\n *p_ty0 = (OPJ_INT32)opj_uint_max(l_ty0, p_image->y0);\n *p_ty1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_ty0, p_cp->tdy), p_image->y1);\n\n /* max precision is 0 (can only grow) */\n *p_max_prec = 0;\n *p_max_res = 0;\n\n /* take the largest value for dx_min and dy_min */\n *p_dx_min = 0x7fffffff;\n *p_dy_min = 0x7fffffff;\n\n for (compno = 0; compno < p_image->numcomps; ++compno) {\n /* arithmetic variables to calculate */\n OPJ_UINT32 l_level_no;\n OPJ_INT32 l_rx0, l_ry0, l_rx1, l_ry1;\n OPJ_INT32 l_px0, l_py0, l_px1, py1;\n OPJ_UINT32 l_pdx, l_pdy;\n OPJ_UINT32 l_pw, l_ph;\n OPJ_UINT32 l_product;\n OPJ_INT32 l_tcx0, l_tcy0, l_tcx1, l_tcy1;\n\n l_tcx0 = opj_int_ceildiv(*p_tx0, (OPJ_INT32)l_img_comp->dx);\n l_tcy0 = opj_int_ceildiv(*p_ty0, (OPJ_INT32)l_img_comp->dy);\n l_tcx1 = opj_int_ceildiv(*p_tx1, (OPJ_INT32)l_img_comp->dx);\n l_tcy1 = opj_int_ceildiv(*p_ty1, (OPJ_INT32)l_img_comp->dy);\n\n if (l_tccp->numresolutions > *p_max_res) {\n *p_max_res = l_tccp->numresolutions;\n }\n\n /* use custom size for precincts */\n for (resno = 0; resno < l_tccp->numresolutions; ++resno) {\n OPJ_UINT32 l_dx, l_dy;\n\n /* precinct width and height */\n l_pdx = l_tccp->prcw[resno];\n l_pdy = l_tccp->prch[resno];\n\n l_dx = l_img_comp->dx * (1u << (l_pdx + l_tccp->numresolutions - 1 - resno));\n l_dy = l_img_comp->dy * (1u << (l_pdy + l_tccp->numresolutions - 1 - resno));\n\n /* take the minimum size for dx for each comp and resolution */\n *p_dx_min = opj_uint_min(*p_dx_min, l_dx);\n *p_dy_min = opj_uint_min(*p_dy_min, l_dy);\n\n /* various calculations of extents */\n l_level_no = l_tccp->numresolutions - 1 - resno;\n\n l_rx0 = opj_int_ceildivpow2(l_tcx0, (OPJ_INT32)l_level_no);\n l_ry0 = opj_int_ceildivpow2(l_tcy0, (OPJ_INT32)l_level_no);\n l_rx1 = opj_int_ceildivpow2(l_tcx1, (OPJ_INT32)l_level_no);\n l_ry1 = opj_int_ceildivpow2(l_tcy1, (OPJ_INT32)l_level_no);\n\n l_px0 = opj_int_floordivpow2(l_rx0, (OPJ_INT32)l_pdx) << l_pdx;\n l_py0 = opj_int_floordivpow2(l_ry0, (OPJ_INT32)l_pdy) << l_pdy;\n l_px1 = opj_int_ceildivpow2(l_rx1, (OPJ_INT32)l_pdx) << l_pdx;\n\n py1 = opj_int_ceildivpow2(l_ry1, (OPJ_INT32)l_pdy) << l_pdy;\n\n l_pw = (l_rx0 == l_rx1) ? 0 : (OPJ_UINT32)((l_px1 - l_px0) >> l_pdx);\n l_ph = (l_ry0 == l_ry1) ? 0 : (OPJ_UINT32)((py1 - l_py0) >> l_pdy);\n\n l_product = l_pw * l_ph;\n\n /* update precision */\n if (l_product > *p_max_prec) {\n *p_max_prec = l_product;\n }\n }\n ++l_img_comp;\n ++l_tccp;\n }\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"opj_get_encoding_parameters","file_name":"src/lib/openjp2/pi.c","commit_link":"github.com/uclouvain/openjpeg/commit/c58df149900df862806d0e892859b41115875845","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#1-6e0d3ab5ecf1","input":"void rfbScaledScreenUpdateRect(rfbScreenInfoPtr screen, rfbScreenInfoPtr ptr, int x0, int y0, int w0, int h0)\n{\n int x,y,w,v,z;\n int x1, y1, w1, h1;\n int bitsPerPixel, bytesPerPixel, bytesPerLine, areaX, areaY, area2;\n unsigned char *srcptr, *dstptr;\n\n /* Nothing to do!!! */\n if (screen==ptr) return;\n\n x1 = x0;\n y1 = y0;\n w1 = w0;\n h1 = h0;\n\n rfbScaledCorrection(screen, ptr, &x1, &y1, &w1, &h1, \"rfbScaledScreenUpdateRect\");\n x0 = ScaleX(ptr, screen, x1);\n y0 = ScaleY(ptr, screen, y1);\n w0 = ScaleX(ptr, screen, w1);\n h0 = ScaleY(ptr, screen, h1);\n\n bitsPerPixel = screen->bitsPerPixel;\n bytesPerPixel = bitsPerPixel / 8;\n bytesPerLine = w1 * bytesPerPixel;\n srcptr = (unsigned char *)(screen->frameBuffer +\n (y0 * screen->paddedWidthInBytes + x0 * bytesPerPixel));\n dstptr = (unsigned char *)(ptr->frameBuffer +\n ( y1 * ptr->paddedWidthInBytes + x1 * bytesPerPixel));\n /* The area of the source framebuffer for each destination pixel */\n areaX = ScaleX(ptr,screen,1);\n areaY = ScaleY(ptr,screen,1);\n area2 = areaX*areaY;\n\n\n /* Ensure that we do not go out of bounds */\n if ((x1+w1) > (ptr->width))\n {\n if (x1==0) w1=ptr->width; else x1 = ptr->width - w1;\n }\n if ((y1+h1) > (ptr->height))\n {\n if (y1==0) h1=ptr->height; else y1 = ptr->height - h1;\n }\n /*\n * rfbLog(\"rfbScaledScreenUpdateRect(%dXx%dY-%dWx%dH -> %dXx%dY-%dWx%dH <%dx%d>) {%dWx%dH -> %dWx%dH} 0x%p\\n\",\n * x0, y0, w0, h0, x1, y1, w1, h1, areaX, areaY,\n * screen->width, screen->height, ptr->width, ptr->height, ptr->frameBuffer);\n */\n\n if (screen->serverFormat.trueColour) { /* Blend neighbouring pixels together */\n unsigned char *srcptr2;\n unsigned long pixel_value, red, green, blue;\n unsigned int redShift = screen->serverFormat.redShift;\n unsigned int greenShift = screen->serverFormat.greenShift;\n unsigned int blueShift = screen->serverFormat.blueShift;\n unsigned long redMax = screen->serverFormat.redMax;\n unsigned long greenMax = screen->serverFormat.greenMax;\n unsigned long blueMax = screen->serverFormat.blueMax;\n\n /* for each *destination* pixel... */\n for (y = 0; y < h1; y++) {\n for (x = 0; x < w1; x++) {\n red = green = blue = 0;\n /* Get the totals for rgb from the source grid... */\n for (w = 0; w < areaX; w++) {\n for (v = 0; v < areaY; v++) {\n srcptr2 = &srcptr[(((x * areaX) + w) * bytesPerPixel) +\n (v * screen->paddedWidthInBytes)];\n pixel_value = 0;\n\n\n switch (bytesPerPixel) {\n case 4: pixel_value = *((unsigned int *)srcptr2); break;\n case 2: pixel_value = *((unsigned short *)srcptr2); break;\n case 1: pixel_value = *((unsigned char *)srcptr2); break;\n default:\n /* fixme: endianness problem? */\n for (z = 0; z < bytesPerPixel; z++)\n pixel_value += (srcptr2[z] << (8 * z));\n break;\n }\n /*\n srcptr2 += bytesPerPixel;\n */\n\n red += ((pixel_value >> redShift) & redMax);\n green += ((pixel_value >> greenShift) & greenMax);\n blue += ((pixel_value >> blueShift) & blueMax);\n\n }\n }\n /* We now have a total for all of the colors, find the average! */\n red /= area2;\n green /= area2;\n blue /= area2;\n /* Stuff the new value back into memory */\n pixel_value = ((red & redMax) << redShift) | ((green & greenMax) << greenShift) | ((blue & blueMax) << blueShift);\n\n switch (bytesPerPixel) {\n case 4: *((unsigned int *)dstptr) = (unsigned int) pixel_value; break;\n case 2: *((unsigned short *)dstptr) = (unsigned short) pixel_value; break;\n case 1: *((unsigned char *)dstptr) = (unsigned char) pixel_value; break;\n default:\n /* fixme: endianness problem? */\n for (z = 0; z < bytesPerPixel; z++)\n dstptr[z]=(pixel_value >> (8 * z)) & 0xff;\n break;\n }\n dstptr += bytesPerPixel;\n }\n srcptr += (screen->paddedWidthInBytes * areaY);\n dstptr += (ptr->paddedWidthInBytes - bytesPerLine);\n }\n } else\n { /* Not truecolour, so we can't blend. Just use the top-left pixel instead */\n for (y = y1; y < (y1+h1); y++) {\n for (x = x1; x < (x1+w1); x++)\n memcpy (&ptr->frameBuffer[(y *ptr->paddedWidthInBytes) + (x * bytesPerPixel)],\n &screen->frameBuffer[(y * areaY * screen->paddedWidthInBytes) + (x *areaX * bytesPerPixel)], bytesPerPixel);\n }\n }\n}","target":"void rfbScaledScreenUpdateRect(rfbScreenInfoPtr screen, rfbScreenInfoPtr ptr, int x0, int y0, int w0, int h0)\n{\n int x,y,w,v,z;\n int x1, y1, w1, h1;\n int bitsPerPixel, bytesPerPixel, bytesPerLine, areaX, areaY, area2;\n unsigned char *srcptr, *dstptr;\n\n /* Nothing to do!!! */\n if (screen==ptr) return;\n\n x1 = x0;\n y1 = y0;\n w1 = w0;\n h1 = h0;\n\n rfbScaledCorrection(screen, ptr, &x1, &y1, &w1, &h1, \"rfbScaledScreenUpdateRect\");\n x0 = ScaleX(ptr, screen, x1);\n y0 = ScaleY(ptr, screen, y1);\n w0 = ScaleX(ptr, screen, w1);\n h0 = ScaleY(ptr, screen, h1);\n\n bitsPerPixel = screen->bitsPerPixel;\n bytesPerPixel = bitsPerPixel / 8;\n bytesPerLine = w1 * bytesPerPixel;\n srcptr = (unsigned char *)(screen->frameBuffer +\n (y0 * screen->paddedWidthInBytes + x0 * bytesPerPixel));\n dstptr = (unsigned char *)(ptr->frameBuffer +\n ( y1 * ptr->paddedWidthInBytes + x1 * bytesPerPixel));\n /* The area of the source framebuffer for each destination pixel */\n areaX = ScaleX(ptr,screen,1);\n areaY = ScaleY(ptr,screen,1);\n area2 = areaX*areaY;\n\n\n /* Ensure that we do not go out of bounds */\n if ((x1+w1) > (ptr->width))\n {\n if (x1==0) w1=ptr->width; else x1 = ptr->width - w1;\n }\n if ((y1+h1) > (ptr->height))\n {\n if (y1==0) h1=ptr->height; else y1 = ptr->height - h1;\n }\n /*\n * rfbLog(\"rfbScaledScreenUpdateRect(%dXx%dY-%dWx%dH -> %dXx%dY-%dWx%dH <%dx%d>) {%dWx%dH -> %dWx%dH} 0x%p\\n\",\n * x0, y0, w0, h0, x1, y1, w1, h1, areaX, areaY,\n * screen->width, screen->height, ptr->width, ptr->height, ptr->frameBuffer);\n */\n\n if (screen->serverFormat.trueColour) { /* Blend neighbouring pixels together */\n unsigned char *srcptr2;\n unsigned long pixel_value, red, green, blue;\n unsigned int redShift = screen->serverFormat.redShift;\n unsigned int greenShift = screen->serverFormat.greenShift;\n unsigned int blueShift = screen->serverFormat.blueShift;\n unsigned long redMax = screen->serverFormat.redMax;\n unsigned long greenMax = screen->serverFormat.greenMax;\n unsigned long blueMax = screen->serverFormat.blueMax;\n\n /* for each *destination* pixel... */\n for (y = 0; y < h1; y++) {\n for (x = 0; x < w1; x++) {\n red = green = blue = 0;\n /* Get the totals for rgb from the source grid... */\n for (w = 0; w < areaX; w++) {\n for (v = 0; v < areaY; v++) {\n srcptr2 = &srcptr[(((x * areaX) + w) * bytesPerPixel) +\n (v * screen->paddedWidthInBytes)];\n pixel_value = 0;\n\n\n switch (bytesPerPixel) {\n case 4: pixel_value = *((unsigned int *)srcptr2); break;\n case 2: pixel_value = *((unsigned short *)srcptr2); break;\n case 1: pixel_value = *((unsigned char *)srcptr2); break;\n default:\n /* fixme: endianness problem? */\n for (z = 0; z < bytesPerPixel; z++)\n pixel_value += ((unsigned long)srcptr2[z] << (8 * z));\n break;\n }\n /*\n srcptr2 += bytesPerPixel;\n */\n\n red += ((pixel_value >> redShift) & redMax);\n green += ((pixel_value >> greenShift) & greenMax);\n blue += ((pixel_value >> blueShift) & blueMax);\n\n }\n }\n /* We now have a total for all of the colors, find the average! */\n red /= area2;\n green /= area2;\n blue /= area2;\n /* Stuff the new value back into memory */\n pixel_value = ((red & redMax) << redShift) | ((green & greenMax) << greenShift) | ((blue & blueMax) << blueShift);\n\n switch (bytesPerPixel) {\n case 4: *((unsigned int *)dstptr) = (unsigned int) pixel_value; break;\n case 2: *((unsigned short *)dstptr) = (unsigned short) pixel_value; break;\n case 1: *((unsigned char *)dstptr) = (unsigned char) pixel_value; break;\n default:\n /* fixme: endianness problem? */\n for (z = 0; z < bytesPerPixel; z++)\n dstptr[z]=(pixel_value >> (8 * z)) & 0xff;\n break;\n }\n dstptr += bytesPerPixel;\n }\n srcptr += (screen->paddedWidthInBytes * areaY);\n dstptr += (ptr->paddedWidthInBytes - bytesPerLine);\n }\n } else\n { /* Not truecolour, so we can't blend. Just use the top-left pixel instead */\n for (y = y1; y < (y1+h1); y++) {\n for (x = x1; x < (x1+w1); x++)\n memcpy (&ptr->frameBuffer[(y *ptr->paddedWidthInBytes) + (x * bytesPerPixel)],\n &screen->frameBuffer[(y * areaY * screen->paddedWidthInBytes) + (x *areaX * bytesPerPixel)], bytesPerPixel);\n }\n }\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"rfbScaledScreenUpdateRect","file_name":"libvncserver/scale.c","commit_link":"github.com/LibVNC/libvncserver/commit/a6788d1da719ae006605b78d22f5a9f170b423af","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#2-5886f3471a74","input":"size_t jsuGetFreeStack() {\n#ifdef ARM\n void *frame = __builtin_frame_address(0);\n size_t stackPos = (size_t)((char*)frame);\n size_t stackEnd = (size_t)((char*)&LINKER_END_VAR);\n if (stackPos < stackEnd) return 0; // should never happen, but just in case of overflow!\n return stackPos - stackEnd;\n#elif defined(LINUX)\n // On linux, we set STACK_BASE from `main`.\n char ptr; // this is on the stack\n extern void *STACK_BASE;\n uint32_t count = (uint32_t)((size_t)STACK_BASE - (size_t)&ptr);\n return 1000000 - count; // give it 1 megabyte of stack\n#else\n // stack depth seems pretty platform-specific :( Default to a value that disables it\n return 1000000; // no stack depth check on this platform\n#endif\n}","target":"size_t jsuGetFreeStack() {\n#ifdef ARM\n void *frame = __builtin_frame_address(0);\n size_t stackPos = (size_t)((char*)frame);\n size_t stackEnd = (size_t)((char*)&LINKER_END_VAR);\n if (stackPos < stackEnd) return 0; // should never happen, but just in case of overflow!\n return stackPos - stackEnd;\n#elif defined(LINUX)\n // On linux, we set STACK_BASE from `main`.\n char ptr; // this is on the stack\n extern void *STACK_BASE;\n uint32_t count = (uint32_t)((size_t)STACK_BASE - (size_t)&ptr);\n const uint32_t max_stack = 1000000; // give it 1 megabyte of stack\n if (count>max_stack) return 0;\n return max_stack - count;\n#else\n // stack depth seems pretty platform-specific :( Default to a value that disables it\n return 1000000; // no stack depth check on this platform\n#endif\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"jsuGetFreeStack","file_name":"src/jsutils.c","commit_link":"github.com/espruino/Espruino/commit/a0d7f432abee692402c00e8b615ff5982dde9780","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#3-ce0501c0c5ff","input":"static int ssl_parse_client_psk_identity( mbedtls_ssl_context *ssl, unsigned char **p,\n const unsigned char *end )\n{\n int ret = 0;\n size_t n;\n\n if( ssl->conf->f_psk == NULL &&\n ( ssl->conf->psk == NULL || ssl->conf->psk_identity == NULL ||\n ssl->conf->psk_identity_len == 0 || ssl->conf->psk_len == 0 ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"got no pre-shared key\" ) );\n return( MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED );\n }\n\n /*\n * Receive client pre-shared key identity name\n */\n if( *p + 2 > end )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad client key exchange message\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );\n }\n\n n = ( (*p)[0] << 8 ) | (*p)[1];\n *p += 2;\n\n if( n < 1 || n > 65535 || *p + n > end )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad client key exchange message\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );\n }\n\n if( ssl->conf->f_psk != NULL )\n {\n if( ssl->conf->f_psk( ssl->conf->p_psk, ssl, *p, n ) != 0 )\n ret = MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY;\n }\n else\n {\n /* Identity is not a big secret since clients send it in the clear,\n * but treat it carefully anyway, just in case */\n if( n != ssl->conf->psk_identity_len ||\n mbedtls_ssl_safer_memcmp( ssl->conf->psk_identity, *p, n ) != 0 )\n {\n ret = MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY;\n }\n }\n\n if( ret == MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY )\n {\n MBEDTLS_SSL_DEBUG_BUF( 3, \"Unknown PSK identity\", *p, n );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY );\n return( MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY );\n }\n\n *p += n;\n\n return( 0 );\n}","target":"static int ssl_parse_client_psk_identity( mbedtls_ssl_context *ssl, unsigned char **p,\n const unsigned char *end )\n{\n int ret = 0;\n size_t n;\n\n if( ssl->conf->f_psk == NULL &&\n ( ssl->conf->psk == NULL || ssl->conf->psk_identity == NULL ||\n ssl->conf->psk_identity_len == 0 || ssl->conf->psk_len == 0 ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"got no pre-shared key\" ) );\n return( MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED );\n }\n\n /*\n * Receive client pre-shared key identity name\n */\n if( end - *p < 2 )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad client key exchange message\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );\n }\n\n n = ( (*p)[0] << 8 ) | (*p)[1];\n *p += 2;\n\n if( n < 1 || n > 65535 || n > (size_t) ( end - *p ) )\n {\n MBEDTLS_SSL_DEBUG_MSG( 1, ( \"bad client key exchange message\" ) );\n return( MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );\n }\n\n if( ssl->conf->f_psk != NULL )\n {\n if( ssl->conf->f_psk( ssl->conf->p_psk, ssl, *p, n ) != 0 )\n ret = MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY;\n }\n else\n {\n /* Identity is not a big secret since clients send it in the clear,\n * but treat it carefully anyway, just in case */\n if( n != ssl->conf->psk_identity_len ||\n mbedtls_ssl_safer_memcmp( ssl->conf->psk_identity, *p, n ) != 0 )\n {\n ret = MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY;\n }\n }\n\n if( ret == MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY )\n {\n MBEDTLS_SSL_DEBUG_BUF( 3, \"Unknown PSK identity\", *p, n );\n mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,\n MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY );\n return( MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY );\n }\n\n *p += n;\n\n return( 0 );\n}","lang":"c","vul_type":"cwe-190","sven_meta":{"func_name":"ssl_parse_client_psk_identity","file_name":"library/ssl_srv.c","commit_link":"github.com/ARMmbed/mbedtls/commit/83c9f495ffe70c7dd280b41fdfd4881485a3bc28","source_cwe_file":"cwe-190.jsonl"}} +{"problem_id":"cwe-190#4-1216e1d42e75","input":"bool read_ujpg( void )\n{\n using namespace IOUtil;\n using namespace Sirikata;\n// colldata.start_decoder_worker_thread(std::bind(&simple_decoder, &colldata, str_in));\n unsigned char ujpg_mrk[ 64 ];\n // this is where we will enable seccomp, before reading user data\n write_byte_bill(Billing::HEADER, true, 24); // for the fixed header\n\n str_out->call_size_callback(max_file_size);\n uint32_t compressed_header_size = 0;\n if (ReadFull(str_in, ujpg_mrk, 4) != 4) {\n custom_exit(ExitCode::SHORT_READ);\n }\n write_byte_bill(Billing::HEADER, true, 4);\n\n compressed_header_size = LEtoUint32(ujpg_mrk);\n if (compressed_header_size > 128 * 1024 * 1024 || max_file_size > 128 * 1024 * 1024) {\n always_assert(false && \"Only support images < 128 megs\");\n return false; // bool too big\n }\n bool pending_header_reads = false;\n if (header_reader == NULL) {\n std::vector > compressed_header_buffer(compressed_header_size);\n IOUtil::ReadFull(str_in, compressed_header_buffer.data(), compressed_header_buffer.size());\n header_reader = new MemReadWriter((JpegAllocator()));\n {\n if (ujgversion == 1) {\n JpegAllocator no_free_allocator;\n#if !defined(USE_STANDARD_MEMORY_ALLOCATORS) && !defined(_WIN32) && !defined(EMSCRIPTEN)\n no_free_allocator.setup_memory_subsystem(32 * 1024 * 1024,\n 16,\n &mem_init_nop,\n &MemMgrAllocatorMalloc,\n &mem_nop,\n &mem_realloc_nop,\n &MemMgrAllocatorMsize);\n#endif\n std::pair >,\n JpegError> uncompressed_header_buffer(\n ZlibDecoderDecompressionReader::Decompress(compressed_header_buffer.data(),\n compressed_header_buffer.size(),\n no_free_allocator,\n max_file_size + 2048));\n if (uncompressed_header_buffer.second) {\n always_assert(false && \"Data not properly zlib coded\");\n return false;\n }\n zlib_hdrs = compressed_header_buffer.size();\n header_reader->SwapIn(uncompressed_header_buffer.first, 0);\n } else {\n std::pair >,\n JpegError> uncompressed_header_buffer(\n Sirikata::BrotliCodec::Decompress(compressed_header_buffer.data(),\n compressed_header_buffer.size(),\n JpegAllocator(),\n max_file_size * 2 + 128 * 1024 * 1024));\n if (uncompressed_header_buffer.second) {\n always_assert(false && \"Data not properly zlib coded\");\n return false;\n }\n zlib_hdrs = compressed_header_buffer.size();\n header_reader->SwapIn(uncompressed_header_buffer.first, 0); \n }\n }\n write_byte_bill(Billing::HEADER,\n true,\n compressed_header_buffer.size());\n } else {\n always_assert(compressed_header_size == 0 && \"Special concatenation requires 0 size header\");\n }\n grbs = sizeof(EOI);\n grbgdata = EOI; // if we don't have any garbage, assume FFD9 EOI\n // read header from file\n ReadFull(header_reader, ujpg_mrk, 3 ) ;\n // check marker\n if ( memcmp( ujpg_mrk, \"HDR\", 3 ) == 0 ) {\n // read size of header, alloc memory\n ReadFull(header_reader, ujpg_mrk, 4 );\n hdrs = LEtoUint32(ujpg_mrk);\n hdrdata = (unsigned char*) aligned_alloc(hdrs);\n memset(hdrdata, 0, hdrs);\n if ( hdrdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read hdrdata\n ReadFull(header_reader, hdrdata, hdrs );\n }\n else {\n fprintf( stderr, \"HDR marker not found\" );\n errorlevel.store(2);\n return false;\n }\n bool memory_optimized_image = (filetype != UJG) && !g_allow_progressive;\n // parse header for image-info\n if ( !setup_imginfo_jpg(memory_optimized_image) )\n return false;\n\n // beginning here: recovery information (needed for exact JPEG recovery)\n\n // read padbit information from file\n ReadFull(header_reader, ujpg_mrk, 3 );\n // check marker\n if ( memcmp( ujpg_mrk, \"P0D\", 3 ) == 0 ) {\n // This is a more nuanced pad byte that can have different values per bit\n header_reader->Read( reinterpret_cast(&padbit), 1 );\n }\n else if ( memcmp( ujpg_mrk, \"PAD\", 3 ) == 0 ) {\n // this is a single pad bit that is implied to have all the same values\n header_reader->Read( reinterpret_cast(&padbit), 1 );\n if (!(padbit == 0 || padbit == 1 ||padbit == -1)) {\n while (write(2,\n \"Legacy Padbit must be 0, 1 or -1\\n\",\n strlen(\"Legacy Padbit must be 0, 1 or -1\\n\")) < 0\n && errno == EINTR) {\n }\n custom_exit(ExitCode::STREAM_INCONSISTENT);\n }\n if (padbit == 1) {\n padbit = 0x7f; // all 6 bits set\n }\n }\n else {\n fprintf( stderr, \"PAD marker not found\" );\n errorlevel.store(2);\n return false;\n }\n std::vector thread_handoff;\n // read further recovery information if any\n while ( ReadFull(header_reader, ujpg_mrk, 3 ) == 3 ) {\n // check marker\n if ( memcmp( ujpg_mrk, \"CRS\", 3 ) == 0 ) {\n rst_cnt_set = true;\n ReadFull(header_reader, ujpg_mrk, 4);\n rst_cnt.resize(LEtoUint32(ujpg_mrk));\n for (size_t i = 0; i < rst_cnt.size(); ++i) {\n ReadFull(header_reader, ujpg_mrk, 4);\n rst_cnt.at(i) = LEtoUint32(ujpg_mrk);\n }\n } else if ( memcmp( ujpg_mrk, \"HHX\", 2 ) == 0 ) { // only look at first two bytes\n size_t to_alloc = ThreadHandoff::get_remaining_data_size_from_two_bytes(ujpg_mrk + 1) + 2;\n if(to_alloc) {\n std::vector data(to_alloc);\n data[0] = ujpg_mrk[1];\n data[1] = ujpg_mrk[2];\n ReadFull(header_reader, &data[2], to_alloc - 2);\n thread_handoff = ThreadHandoff::deserialize(&data[0], to_alloc);\n }\n } else if ( memcmp( ujpg_mrk, \"FRS\", 3 ) == 0 ) {\n // read number of false set RST markers per scan from file\n ReadFull(header_reader, ujpg_mrk, 4);\n scnc = LEtoUint32(ujpg_mrk);\n \n rst_err.insert(rst_err.end(), scnc - rst_err.size(), 0);\n // read data\n ReadFull(header_reader, rst_err.data(), scnc );\n }\n else if ( memcmp( ujpg_mrk, \"GRB\", 3 ) == 0 ) {\n // read garbage (data after end of JPG) from file\n ReadFull(header_reader, ujpg_mrk, 4);\n grbs = LEtoUint32(ujpg_mrk);\n grbgdata = aligned_alloc(grbs);\n memset(grbgdata, 0, sizeof(grbs));\n if ( grbgdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read garbage data\n ReadFull(header_reader, grbgdata, grbs );\n }\n else if ( memcmp( ujpg_mrk, \"PGR\", 3 ) == 0 || memcmp( ujpg_mrk, \"PGE\", 3 ) == 0 ) {\n // read prefix garbage (data before beginning of JPG) from file\n if (ujpg_mrk[2] == 'E') {\n // embedded jpeg: full header required\n embedded_jpeg = true;\n }\n ReadFull(header_reader, ujpg_mrk, 4);\n prefix_grbs = LEtoUint32(ujpg_mrk);\n prefix_grbgdata = aligned_alloc(prefix_grbs);\n memset(prefix_grbgdata, 0, sizeof(prefix_grbs));\n if ( prefix_grbgdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read garbage data\n ReadFull(header_reader, prefix_grbgdata, prefix_grbs );\n }\n else if ( memcmp( ujpg_mrk, \"SIZ\", 3 ) == 0 ) {\n // full size of the original file\n ReadFull(header_reader, ujpg_mrk, 4);\n max_file_size = LEtoUint32(ujpg_mrk);\n }\n else if ( memcmp( ujpg_mrk, \"EEE\", 3) == 0) {\n ReadFull(header_reader, ujpg_mrk, 28);\n max_cmp = LEtoUint32(ujpg_mrk);\n max_bpos = LEtoUint32(ujpg_mrk + 4);\n max_sah = LEtoUint32(ujpg_mrk + 8);\n max_dpos[0] = LEtoUint32(ujpg_mrk + 12);\n max_dpos[1] = LEtoUint32(ujpg_mrk + 16);\n max_dpos[2] = LEtoUint32(ujpg_mrk + 20);\n max_dpos[3] = LEtoUint32(ujpg_mrk + 24);\n early_eof_encountered = true;\n colldata.set_truncation_bounds(max_cmp, max_bpos, max_dpos, max_sah);\n }\n else {\n if (memcmp(ujpg_mrk, \"CNT\", 3) == 0 ) {\n pending_header_reads = true;\n break;\n } else if (memcmp(ujpg_mrk, \"CMP\", 3) == 0 ) {\n break;\n } else {\n fprintf( stderr, \"unknown data found\" );\n errorlevel.store(2);\n }\n return false;\n }\n }\n if (!pending_header_reads) {\n delete header_reader;\n header_reader = NULL;\n }\n write_byte_bill(Billing::HEADER,\n false,\n 2 + hdrs + prefix_grbs + grbs);\n\n ReadFull(str_in, ujpg_mrk, 3 ) ;\n write_byte_bill(Billing::HEADER, true, 3);\n\n write_byte_bill(Billing::DELIMITERS, true, 4 * NUM_THREADS); // trailing vpx_encode bits\n write_byte_bill(Billing::HEADER, true, 4); //trailing size\n\n if (memcmp(ujpg_mrk, \"CMP\", 3) != 0) {\n always_assert(false && \"CMP must be present (uncompressed) in the file or CNT continue marker\");\n return false; // not a JPG\n }\n colldata.signal_worker_should_begin();\n g_decoder->initialize(str_in, thread_handoff);\n colldata.start_decoder(g_decoder);\n return true;\n}","target":"bool read_ujpg( void )\n{\n using namespace IOUtil;\n using namespace Sirikata;\n// colldata.start_decoder_worker_thread(std::bind(&simple_decoder, &colldata, str_in));\n unsigned char ujpg_mrk[ 64 ];\n // this is where we will enable seccomp, before reading user data\n write_byte_bill(Billing::HEADER, true, 24); // for the fixed header\n\n str_out->call_size_callback(max_file_size);\n uint32_t compressed_header_size = 0;\n if (ReadFull(str_in, ujpg_mrk, 4) != 4) {\n custom_exit(ExitCode::SHORT_READ);\n }\n write_byte_bill(Billing::HEADER, true, 4);\n\n compressed_header_size = LEtoUint32(ujpg_mrk);\n if (compressed_header_size > 128 * 1024 * 1024 || max_file_size > 128 * 1024 * 1024) {\n always_assert(false && \"Only support images < 128 megs\");\n return false; // bool too big\n }\n bool pending_header_reads = false;\n if (header_reader == NULL) {\n std::vector > compressed_header_buffer(compressed_header_size);\n IOUtil::ReadFull(str_in, compressed_header_buffer.data(), compressed_header_buffer.size());\n header_reader = new MemReadWriter((JpegAllocator()));\n {\n if (ujgversion == 1) {\n JpegAllocator no_free_allocator;\n#if !defined(USE_STANDARD_MEMORY_ALLOCATORS) && !defined(_WIN32) && !defined(EMSCRIPTEN)\n no_free_allocator.setup_memory_subsystem(32 * 1024 * 1024,\n 16,\n &mem_init_nop,\n &MemMgrAllocatorMalloc,\n &mem_nop,\n &mem_realloc_nop,\n &MemMgrAllocatorMsize);\n#endif\n std::pair >,\n JpegError> uncompressed_header_buffer(\n ZlibDecoderDecompressionReader::Decompress(compressed_header_buffer.data(),\n compressed_header_buffer.size(),\n no_free_allocator,\n max_file_size + 2048));\n if (uncompressed_header_buffer.second) {\n always_assert(false && \"Data not properly zlib coded\");\n return false;\n }\n zlib_hdrs = compressed_header_buffer.size();\n header_reader->SwapIn(uncompressed_header_buffer.first, 0);\n } else {\n std::pair >,\n JpegError> uncompressed_header_buffer(\n Sirikata::BrotliCodec::Decompress(compressed_header_buffer.data(),\n compressed_header_buffer.size(),\n JpegAllocator(),\n ((size_t)max_file_size) * 2 + 128 * 1024 * 1024));\n if (uncompressed_header_buffer.second) {\n always_assert(false && \"Data not properly zlib coded\");\n return false;\n }\n zlib_hdrs = compressed_header_buffer.size();\n header_reader->SwapIn(uncompressed_header_buffer.first, 0); \n }\n }\n write_byte_bill(Billing::HEADER,\n true,\n compressed_header_buffer.size());\n } else {\n always_assert(compressed_header_size == 0 && \"Special concatenation requires 0 size header\");\n }\n grbs = sizeof(EOI);\n grbgdata = EOI; // if we don't have any garbage, assume FFD9 EOI\n // read header from file\n ReadFull(header_reader, ujpg_mrk, 3 ) ;\n // check marker\n if ( memcmp( ujpg_mrk, \"HDR\", 3 ) == 0 ) {\n // read size of header, alloc memory\n ReadFull(header_reader, ujpg_mrk, 4 );\n hdrs = LEtoUint32(ujpg_mrk);\n hdrdata = (unsigned char*) aligned_alloc(hdrs);\n memset(hdrdata, 0, hdrs);\n if ( hdrdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read hdrdata\n ReadFull(header_reader, hdrdata, hdrs );\n }\n else {\n fprintf( stderr, \"HDR marker not found\" );\n errorlevel.store(2);\n return false;\n }\n bool memory_optimized_image = (filetype != UJG) && !g_allow_progressive;\n // parse header for image-info\n if ( !setup_imginfo_jpg(memory_optimized_image) )\n return false;\n\n // beginning here: recovery information (needed for exact JPEG recovery)\n\n // read padbit information from file\n ReadFull(header_reader, ujpg_mrk, 3 );\n // check marker\n if ( memcmp( ujpg_mrk, \"P0D\", 3 ) == 0 ) {\n // This is a more nuanced pad byte that can have different values per bit\n header_reader->Read( reinterpret_cast(&padbit), 1 );\n }\n else if ( memcmp( ujpg_mrk, \"PAD\", 3 ) == 0 ) {\n // this is a single pad bit that is implied to have all the same values\n header_reader->Read( reinterpret_cast(&padbit), 1 );\n if (!(padbit == 0 || padbit == 1 ||padbit == -1)) {\n while (write(2,\n \"Legacy Padbit must be 0, 1 or -1\\n\",\n strlen(\"Legacy Padbit must be 0, 1 or -1\\n\")) < 0\n && errno == EINTR) {\n }\n custom_exit(ExitCode::STREAM_INCONSISTENT);\n }\n if (padbit == 1) {\n padbit = 0x7f; // all 6 bits set\n }\n }\n else {\n fprintf( stderr, \"PAD marker not found\" );\n errorlevel.store(2);\n return false;\n }\n std::vector thread_handoff;\n // read further recovery information if any\n while ( ReadFull(header_reader, ujpg_mrk, 3 ) == 3 ) {\n // check marker\n if ( memcmp( ujpg_mrk, \"CRS\", 3 ) == 0 ) {\n rst_cnt_set = true;\n ReadFull(header_reader, ujpg_mrk, 4);\n rst_cnt.resize(LEtoUint32(ujpg_mrk));\n for (size_t i = 0; i < rst_cnt.size(); ++i) {\n ReadFull(header_reader, ujpg_mrk, 4);\n rst_cnt.at(i) = LEtoUint32(ujpg_mrk);\n }\n } else if ( memcmp( ujpg_mrk, \"HHX\", 2 ) == 0 ) { // only look at first two bytes\n size_t to_alloc = ThreadHandoff::get_remaining_data_size_from_two_bytes(ujpg_mrk + 1) + 2;\n if(to_alloc) {\n std::vector data(to_alloc);\n data[0] = ujpg_mrk[1];\n data[1] = ujpg_mrk[2];\n ReadFull(header_reader, &data[2], to_alloc - 2);\n thread_handoff = ThreadHandoff::deserialize(&data[0], to_alloc);\n }\n } else if ( memcmp( ujpg_mrk, \"FRS\", 3 ) == 0 ) {\n // read number of false set RST markers per scan from file\n ReadFull(header_reader, ujpg_mrk, 4);\n scnc = LEtoUint32(ujpg_mrk);\n \n rst_err.insert(rst_err.end(), scnc - rst_err.size(), 0);\n // read data\n ReadFull(header_reader, rst_err.data(), scnc );\n }\n else if ( memcmp( ujpg_mrk, \"GRB\", 3 ) == 0 ) {\n // read garbage (data after end of JPG) from file\n ReadFull(header_reader, ujpg_mrk, 4);\n grbs = LEtoUint32(ujpg_mrk);\n grbgdata = aligned_alloc(grbs);\n memset(grbgdata, 0, sizeof(grbs));\n if ( grbgdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read garbage data\n ReadFull(header_reader, grbgdata, grbs );\n }\n else if ( memcmp( ujpg_mrk, \"PGR\", 3 ) == 0 || memcmp( ujpg_mrk, \"PGE\", 3 ) == 0 ) {\n // read prefix garbage (data before beginning of JPG) from file\n if (ujpg_mrk[2] == 'E') {\n // embedded jpeg: full header required\n embedded_jpeg = true;\n }\n ReadFull(header_reader, ujpg_mrk, 4);\n prefix_grbs = LEtoUint32(ujpg_mrk);\n prefix_grbgdata = aligned_alloc(prefix_grbs);\n memset(prefix_grbgdata, 0, sizeof(prefix_grbs));\n if ( prefix_grbgdata == NULL ) {\n fprintf( stderr, MEM_ERRMSG );\n errorlevel.store(2);\n return false;\n }\n // read garbage data\n ReadFull(header_reader, prefix_grbgdata, prefix_grbs );\n }\n else if ( memcmp( ujpg_mrk, \"SIZ\", 3 ) == 0 ) {\n // full size of the original file\n ReadFull(header_reader, ujpg_mrk, 4);\n max_file_size = LEtoUint32(ujpg_mrk);\n }\n else if ( memcmp( ujpg_mrk, \"EEE\", 3) == 0) {\n ReadFull(header_reader, ujpg_mrk, 28);\n max_cmp = LEtoUint32(ujpg_mrk);\n max_bpos = LEtoUint32(ujpg_mrk + 4);\n max_sah = LEtoUint32(ujpg_mrk + 8);\n max_dpos[0] = LEtoUint32(ujpg_mrk + 12);\n max_dpos[1] = LEtoUint32(ujpg_mrk + 16);\n max_dpos[2] = LEtoUint32(ujpg_mrk + 20);\n max_dpos[3] = LEtoUint32(ujpg_mrk + 24);\n early_eof_encountered = true;\n colldata.set_truncation_bounds(max_cmp, max_bpos, max_dpos, max_sah);\n }\n else {\n if (memcmp(ujpg_mrk, \"CNT\", 3) == 0 ) {\n pending_header_reads = true;\n break;\n } else if (memcmp(ujpg_mrk, \"CMP\", 3) == 0 ) {\n break;\n } else {\n fprintf( stderr, \"unknown data found\" );\n errorlevel.store(2);\n }\n return false;\n }\n }\n if (!pending_header_reads) {\n delete header_reader;\n header_reader = NULL;\n }\n write_byte_bill(Billing::HEADER,\n false,\n 2 + hdrs + prefix_grbs + grbs);\n\n ReadFull(str_in, ujpg_mrk, 3 ) ;\n write_byte_bill(Billing::HEADER, true, 3);\n\n write_byte_bill(Billing::DELIMITERS, true, 4 * NUM_THREADS); // trailing vpx_encode bits\n write_byte_bill(Billing::HEADER, true, 4); //trailing size\n\n if (memcmp(ujpg_mrk, \"CMP\", 3) != 0) {\n always_assert(false && \"CMP must be present (uncompressed) in the file or CNT continue marker\");\n return false; // not a JPG\n }\n colldata.signal_worker_should_begin();\n g_decoder->initialize(str_in, thread_handoff);\n colldata.start_decoder(g_decoder);\n return true;\n}","lang":"cpp","vul_type":"cwe-190","sven_meta":{"func_name":"read_ujpg","file_name":"src/lepton/jpgcoder.cc","commit_link":"github.com/dropbox/lepton/commit/6a5ceefac1162783fffd9506a3de39c85c725761","source_cwe_file":"cwe-190.jsonl"}}